mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-27 17:50:54 +00:00
358 lines
524 KiB
JavaScript
358 lines
524 KiB
JavaScript
var qd=Object.defineProperty;var Wd=(e,n,t)=>n in e?qd(e,n,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[n]=t;var hi=(e,n,t)=>Wd(e,typeof n!="symbol"?n+"":n,t);import{y as Zn,C as Zs,r as b,D as Kd,E as qa,G as Yd,R as Mn,J as gl,K as ye,N as ge,O as Fn,P as Qd,j as s,Q as K,T as Xd,V as Le,W as Ke,X as Et,Y as $t,Z as Rt,_ as Ye,$ as En,a0 as Pt,a1 as Jn,a2 as Cs,a3 as ft,a4 as ml,a5 as Zd,a6 as Wa,a7 as Ka,a8 as js,a9 as Ya,aa as Wt,ab as Jd,ac as eu,ad as es,ae as xs,af as oo,ag as yn,ah as tu,ai as ao,aj as Ce,ak as wn,al as Cn,am as hl,an as Qa,ao as pi,ap as nu,aq as On,ar as su,as as pl,at as ou,au,av as fi,aw as ru,ax as iu,ay as Ws,az as Lt,v as N,aA as ro,aB as io,B as Be,aC as lo,aD as Xa,aE as ct,d as Za,A as lu,aF as _t,aG as fl,aH as cu,aI as du,aJ as Js,aK as xt,aL as bt,aM as yt,aN as wt,I as ze,t as Ee,aO as uu,aP as gu,aQ as mu,aR as Xt,k as hu,m as kt,u as vl,n as Ot,aS as pu,l as Ra,w as vi,aT as xl,aU as Ja,aV as je,aW as fu,aX as Qt,aY as We,aZ as Na,a_ as Ge,a$ as vu,b0 as xu,b1 as bl,o as Zt,b2 as Ve,b3 as bu}from"./index-7T7TTikv.js";import{u as yl}from"./use-toast-mIxmYSs4.js";import{S as an,a as rn,b as ln,c as cn,d as Ft}from"./select--i8koVXg.js";import{c as vn}from"./utils-N2wtfq7C.js";import{E as er}from"./ellipsis-DBW5EePE.js";import{P as bs}from"./plus-CC3ol2sL.js";import{T as wl,u as co}from"./useEmployeePostions-BZG3u-zs.js";import{U as Cl}from"./user-plus-tzUBEFtH.js";import{P as yu}from"./pencil-cYosDPxl.js";import{B as jl}from"./badge-D4t6Wb1T.js";import{A as Zo,a as Jo,b as uo}from"./avatar-BU_IHgzI.js";import{u as wu}from"./employeePositionsService-C7MSoCNC.js";import{C as Tt,m as Cu}from"./proxy-B5PBxN2F.js";import{M as ju}from"./mail-q8lHlEPt.js";import{R as xi}from"./refresh-cw-B7fipPS4.js";import{P as Su}from"./phone-w_VmAt3l.js";import{C as Ss}from"./circle-alert-HVqsZpe-.js";import{E as _u}from"./ellipsis-vertical-CoMd89ns.js";import{E as Mu}from"./eye-DYwZYJcQ.js";import{L as Ue}from"./label-CABYEcfW.js";import{u as An,a as Ru}from"./usePosition-B4V039Jv.js";import{u as tr}from"./usePositionTypes-BnS1UB0m.js";import{S as St}from"./search-y8VSu0lZ.js";import{u as Nu,e as ku}from"./useEmployees-DreGarUD.js";import{u as Du}from"./useOrganizations-CPt4mkXS.js";import{u as zn}from"./useUnit-CRt6YBLp.js";import{b as Tu}from"./Utils-BP0IYDrC.js";import{g as Iu}from"./positionService-BwPU5sNe.js";import{A as go,a as mo,b as ho,c as po,d as fo,e as vo,f as xo}from"./alert-dialog-DwppaTz4.js";import{g as Pu}from"./organizationsService-DIFVjoLn.js";import{g as Fu,a as Sl}from"./unitService-DTtkt-Pb.js";import{u as nr}from"./useConfig-DEF3qQqh.js";import{u as Eu}from"./useQueries-DzmDq0fy.js";import{u as ut,w as Ou}from"./xlsx-sUI8S2SR.js";import{u as Au}from"./useArchived-5V0W60Gf.js";import{D as zu}from"./download-Btm1n-GQ.js";import{C as $u}from"./chevron-left-G_a9-f9o.js";import{S as _l}from"./Switch-ByfhjkDo.js";import{R as Lu}from"./Radio-D43EoWlg.js";import{C as Vu,a as bo}from"./Checkbox-CAXGYFGh.js";import{f as Bu,c as Uu}from"./create-scoped-keydown-handler-O-eo68DQ.js";import{P as Mt,u as Hu}from"./Popover-BSKEfTKH.js";import{u as At}from"./use-uncontrolled-tg0LIUAX.js";import{g as sr}from"./get-auto-contrast-value-Da6zqqWm.js";import{S as Gu}from"./Skeleton-BOu0YqbY.js";import"./InputsGroupFieldset-B16dMH0P.js";/**
|
||
* @license lucide-react v0.513.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const qu=[["circle",{cx:"12.1",cy:"12.1",r:"1",key:"18d7e5"}]],bi=Zn("dot",qu);/**
|
||
* @license lucide-react v0.513.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const Wu=[["path",{d:"M12 10v6",key:"1bos4e"}],["path",{d:"M9 13h6",key:"1uhe8q"}],["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]],Ku=Zn("folder-plus",Wu);/**
|
||
* @license lucide-react v0.513.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const Yu=[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}],["path",{d:"m9.5 10.5 5 5",key:"ra9qjz"}],["path",{d:"m14.5 10.5-5 5",key:"l2rkpq"}]],Ml=Zn("folder-x",Yu);/**
|
||
* @license lucide-react v0.513.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const Qu=[["path",{d:"M12 2v20",key:"t6zp3m"}],["path",{d:"m15 19-3 3-3-3",key:"11eu04"}],["path",{d:"m19 9 3 3-3 3",key:"1mg7y2"}],["path",{d:"M2 12h20",key:"9i4pu4"}],["path",{d:"m5 9-3 3 3 3",key:"j64kie"}],["path",{d:"m9 5 3-3 3 3",key:"l8vdw6"}]],Xu=Zn("move",Qu);/**
|
||
* @license lucide-react v0.513.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const Zu=[["path",{d:"M13 2a9 9 0 0 1 9 9",key:"1itnx2"}],["path",{d:"M13 6a5 5 0 0 1 5 5",key:"11nki7"}],["path",{d:"M13.832 16.568a1 1 0 0 0 1.213-.303l.355-.465A2 2 0 0 1 17 15h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2A18 18 0 0 1 2 4a2 2 0 0 1 2-2h3a2 2 0 0 1 2 2v3a2 2 0 0 1-.8 1.6l-.468.351a1 1 0 0 0-.292 1.233 14 14 0 0 0 6.392 6.384",key:"9njp5v"}]],Ju=Zn("phone-call",Zu);/**
|
||
* @license lucide-react v0.513.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const eg=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"22",x2:"16",y1:"11",y2:"11",key:"1shjgl"}]],tg=Zn("user-minus",eg);function vt(e,n){return t=>{e==null||e(t),n==null||n(t)}}function ng(e,n){return e in n?Zs(n[e]):Zs(e)}function sg(e,n){const t=e.map(o=>({value:o,px:ng(o,n)}));return t.sort((o,a)=>o.px-a.px),t}function Gn(e){return typeof e=="object"&&e!==null?"base"in e?e.base:void 0:e}function og(e,n,t){var o;return t?Array.from(((o=Bu(t,n))==null?void 0:o.querySelectorAll(e))||[]).findIndex(a=>a===t):null}function ag(){const[e,n]=b.useState(-1);return[e,{setHovered:n,resetHovered:()=>n(-1)}]}function Dn(e,n,t){return n===void 0&&t===void 0?e:n!==void 0&&t===void 0?Math.max(e,n):Math.min(n===void 0&&t!==void 0?e:Math.max(e,n),t)}function rg({timeout:e=2e3}={}){const[n,t]=b.useState(null),[o,a]=b.useState(!1),[r,i]=b.useState(null),l=u=>{window.clearTimeout(r),i(window.setTimeout(()=>a(!1),e)),a(u)};return{copy:u=>{"clipboard"in navigator?navigator.clipboard.writeText(u).then(()=>l(!0)).catch(g=>t(g)):t(new Error("useClipboard: navigator.clipboard is not supported"))},reset:()=>{a(!1),t(null),window.clearTimeout(r)},error:n,copied:o}}function Rl(e,n,t={leading:!1}){const[o,a]=b.useState(e),r=b.useRef(!1),i=b.useRef(null),l=b.useRef(!1),d=()=>window.clearTimeout(i.current);return b.useEffect(()=>{r.current&&(!l.current&&t.leading?(l.current=!0,a(e)):(d(),i.current=window.setTimeout(()=>{l.current=!1,a(e)},n)))},[e,t.leading,n]),b.useEffect(()=>(r.current=!0,d),[]),[o,d]}function ig(e,n,t="ltr"){const o=b.useRef(null),a=b.useRef(!1),r=b.useRef(!1),i=b.useRef(0),[l,d]=b.useState(!1);return b.useEffect(()=>{a.current=!0},[]),b.useEffect(()=>{const c=o.current,u=({x:w,y:C})=>{cancelAnimationFrame(i.current),i.current=requestAnimationFrame(()=>{if(a.current&&c){c.style.userSelect="none";const j=c.getBoundingClientRect();if(j.width&&j.height){const S=Dn((w-j.left)/j.width,0,1);e({x:t==="ltr"?S:1-S,y:Dn((C-j.top)/j.height,0,1)})}}})},g=()=>{document.addEventListener("mousemove",v),document.addEventListener("mouseup",p),document.addEventListener("touchmove",y),document.addEventListener("touchend",p)},h=()=>{document.removeEventListener("mousemove",v),document.removeEventListener("mouseup",p),document.removeEventListener("touchmove",y),document.removeEventListener("touchend",p)},m=()=>{!r.current&&a.current&&(r.current=!0,typeof(n==null?void 0:n.onScrubStart)=="function"&&n.onScrubStart(),d(!0),g())},p=()=>{r.current&&a.current&&(r.current=!1,d(!1),h(),setTimeout(()=>{typeof(n==null?void 0:n.onScrubEnd)=="function"&&n.onScrubEnd()},0))},f=w=>{m(),w.preventDefault(),v(w)},v=w=>u({x:w.clientX,y:w.clientY}),x=w=>{w.cancelable&&w.preventDefault(),m(),y(w)},y=w=>{w.cancelable&&w.preventDefault(),u({x:w.changedTouches[0].clientX,y:w.changedTouches[0].clientY})};return c==null||c.addEventListener("mousedown",f),c==null||c.addEventListener("touchstart",x,{passive:!1}),()=>{c&&(c.removeEventListener("mousedown",f),c.removeEventListener("touchstart",x))}},[t,e]),{ref:o,active:l}}function un(e,n){const t=n-e+1;return Array.from({length:t},(o,a)=>a+e)}const Ps="dots";function lg({total:e,siblings:n=1,boundaries:t=1,page:o,initialPage:a=1,onChange:r}){const i=Math.max(Math.trunc(e),0),[l,d]=At({value:o,onChange:r,defaultValue:a,finalValue:a}),c=f=>{f<=0?d(1):f>i?d(i):d(f)},u=()=>c(l+1),g=()=>c(l-1),h=()=>c(1),m=()=>c(i);return{range:b.useMemo(()=>{if(n*2+3+t*2>=i)return un(1,i);const v=Math.max(l-n,t),x=Math.min(l+n,i-t),y=v>t+2,w=x<i-(t+1);if(!y&&w){const C=n*2+t+2;return[...un(1,C),Ps,...un(i-(t-1),i)]}if(y&&!w){const C=t+1+2*n;return[...un(1,t),Ps,...un(i-C,i)]}return[...un(1,t),Ps,...un(v,x),Ps,...un(i-t+1,i)]},[i,n,l]),active:l,setPage:c,next:u,previous:g,first:h,last:m}}function cg(){const[e,n]=b.useState(!1),t=b.useRef(null),o=b.useCallback(()=>n(!0),[]),a=b.useCallback(()=>n(!1),[]);return b.useEffect(()=>{const r=t.current;if(r)return r.addEventListener("mouseenter",o),r.addEventListener("mouseleave",a),()=>{r==null||r.removeEventListener("mouseenter",o),r==null||r.removeEventListener("mouseleave",a)}},[t.current]),{ref:t,hovered:e}}function dg(e){const n=b.useRef(void 0);return b.useEffect(()=>{n.current=e},[e]),n.current}function ug(e,n){return n.length===0?e:n.reduce((t,o)=>Math.abs(o-e)<Math.abs(t-e)?o:t)}function gg(e,n){if(e.startsWith("var("))return`color-mix(in srgb, ${e}, white ${n*100}%)`;const{r:t,g:o,b:a,a:r}=Kd(e),i=l=>Math.round(l+(255-l)*n);return`rgba(${i(t)}, ${i(o)}, ${i(a)}, ${r})`}function mg(e){if(!e||typeof e=="string")return 0;const n=e/36;return Math.round((4+15*n**.25+n/5)*10)}function ea(e){return e!=null&&e.current?e.current.scrollHeight:"auto"}const cs=typeof window<"u"&&window.requestAnimationFrame;function hg({transitionDuration:e,transitionTimingFunction:n="ease",onTransitionEnd:t=()=>{},opened:o}){const a=b.useRef(null),r=0,i={height:0,overflow:"hidden"},[l,d]=b.useState(o?{}:i),c=p=>{gl.flushSync(()=>d(p))},u=p=>{c(f=>({...f,...p}))};function g(p){const f=e||mg(p);return{transition:`height ${f}ms ${n}, opacity ${f}ms ${n}`}}qa(()=>{typeof cs=="function"&&cs(o?()=>{u({willChange:"height",display:"block",overflow:"hidden"}),cs(()=>{const p=ea(a);u({...g(p),height:p})})}:()=>{const p=ea(a);u({...g(p),willChange:"height",height:p}),cs(()=>u({height:r,overflow:"hidden"}))})},[o]);const h=p=>{if(!(p.target!==a.current||p.propertyName!=="height"))if(o){const f=ea(a);f===l.height?c({}):u({height:f}),t()}else l.height===r&&(c(i),t())};function m({style:p={},refKey:f="ref",...v}={}){const x=v[f],y={"aria-hidden":!o,...v,[f]:Yd(a,x),onTransitionEnd:h,style:{boxSizing:"border-box",...p,...l}};return Mn.version.startsWith("18")?o||(y.inert=""):y.inert=!o,y}return m}const pg={transitionDuration:200,transitionTimingFunction:"ease",animateOpacity:!0},ts=ye((e,n)=>{const{children:t,in:o,transitionDuration:a,transitionTimingFunction:r,style:i,onTransitionEnd:l,animateOpacity:d,...c}=ge("Collapse",pg,e),u=Fn(),g=Qd(),m=(u.respectReducedMotion?g:!1)?0:a,p=hg({opened:o,transitionDuration:m,transitionTimingFunction:r,onTransitionEnd:l});return m===0?o?s.jsx(K,{...c,children:t}):null:s.jsx(K,{...p({style:{opacity:o||!d?1:0,transition:d?`opacity ${m}ms ${r}`:"none",...Xd(i,u)},ref:n,...c}),children:t})});ts.displayName="@mantine/core/Collapse";var ns={root:"m_8d3f4000",icon:"m_8d3afb97",loader:"m_302b9fb1",group:"m_1a0f1b21",groupSection:"m_437b6484"};const yi={orientation:"horizontal"},fg=Ke((e,{borderWidth:n})=>({group:{"--ai-border-width":Et(n)}})),or=ye((e,n)=>{const t=ge("ActionIconGroup",yi,e),{className:o,style:a,classNames:r,styles:i,unstyled:l,orientation:d,vars:c,borderWidth:u,variant:g,mod:h,...m}=ge("ActionIconGroup",yi,e),p=Le({name:"ActionIconGroup",props:t,classes:ns,className:o,style:a,classNames:r,styles:i,unstyled:l,vars:c,varsResolver:fg,rootSelector:"group"});return s.jsx(K,{...p("group"),ref:n,variant:g,mod:[{"data-orientation":d},h],role:"group",...m})});or.classes=ns;or.displayName="@mantine/core/ActionIconGroup";const wi={},vg=Ke((e,{radius:n,color:t,gradient:o,variant:a,autoContrast:r,size:i})=>{const l=e.variantColorResolver({color:t||e.primaryColor,theme:e,gradient:o,variant:a||"filled",autoContrast:r});return{groupSection:{"--section-height":Ye(i,"section-height"),"--section-padding-x":Ye(i,"section-padding-x"),"--section-fz":Rt(i),"--section-radius":n===void 0?void 0:$t(n),"--section-bg":t||a?l.background:void 0,"--section-color":l.color,"--section-bd":t||a?l.border:void 0}}}),ar=ye((e,n)=>{const t=ge("ActionIconGroupSection",wi,e),{className:o,style:a,classNames:r,styles:i,unstyled:l,vars:d,variant:c,gradient:u,radius:g,autoContrast:h,...m}=ge("ActionIconGroupSection",wi,e),p=Le({name:"ActionIconGroupSection",props:t,classes:ns,className:o,style:a,classNames:r,styles:i,unstyled:l,vars:d,varsResolver:vg,rootSelector:"groupSection"});return s.jsx(K,{...p("groupSection"),ref:n,variant:c,...m})});ar.classes=ns;ar.displayName="@mantine/core/ActionIconGroupSection";const xg={},bg=Ke((e,{size:n,radius:t,variant:o,gradient:a,color:r,autoContrast:i})=>{const l=e.variantColorResolver({color:r||e.primaryColor,theme:e,gradient:a,variant:o||"filled",autoContrast:i});return{root:{"--ai-size":Ye(n,"ai-size"),"--ai-radius":t===void 0?void 0:$t(t),"--ai-bg":r||o?l.background:void 0,"--ai-hover":r||o?l.hover:void 0,"--ai-hover-color":r||o?l.hoverColor:void 0,"--ai-color":l.color,"--ai-bd":r||o?l.border:void 0}}}),Oe=En((e,n)=>{const t=ge("ActionIcon",xg,e),{className:o,unstyled:a,variant:r,classNames:i,styles:l,style:d,loading:c,loaderProps:u,size:g,color:h,radius:m,__staticSelector:p,gradient:f,vars:v,children:x,disabled:y,"data-disabled":w,autoContrast:C,mod:j,...S}=t,R=Le({name:["ActionIcon",p],props:t,className:o,style:d,classes:ns,classNames:i,styles:l,unstyled:a,vars:v,varsResolver:bg});return s.jsxs(Pt,{...R("root",{active:!y&&!c&&!w}),...S,unstyled:a,variant:r,size:g,disabled:y||c,ref:n,mod:[{loading:c,disabled:y||w},j],children:[s.jsx(Jn,{mounted:!!c,transition:"slide-down",duration:150,children:_=>s.jsx(K,{component:"span",...R("loader",{style:_}),"aria-hidden":!0,children:s.jsx(Cs,{color:"var(--ai-color)",size:"calc(var(--ai-size) * 0.55)",...u})})}),s.jsx(K,{component:"span",mod:{loading:c},...R("icon"),children:x})]})});Oe.classes=ns;Oe.displayName="@mantine/core/ActionIcon";Oe.Group=or;Oe.GroupSection=ar;function yg(e){return b.Children.toArray(e).filter(Boolean)}var Nl={root:"m_4081bf90"};const wg={preventGrowOverflow:!0,gap:"md",align:"center",justify:"flex-start",wrap:"wrap"},Cg=Ke((e,{grow:n,preventGrowOverflow:t,gap:o,align:a,justify:r,wrap:i},{childWidth:l})=>({root:{"--group-child-width":n&&t?l:void 0,"--group-gap":ft(o),"--group-align":a,"--group-justify":r,"--group-wrap":i}})),Pe=ye((e,n)=>{const t=ge("Group",wg,e),{classNames:o,className:a,style:r,styles:i,unstyled:l,children:d,gap:c,align:u,justify:g,wrap:h,grow:m,preventGrowOverflow:p,vars:f,variant:v,__size:x,mod:y,...w}=t,C=yg(d),j=C.length,S=ft(c??"md"),_={childWidth:`calc(${100/j}% - (${S} - ${S} / ${j}))`},T=Le({name:"Group",props:t,stylesCtx:_,className:a,style:r,classes:Nl,classNames:o,styles:i,unstyled:l,vars:f,varsResolver:Cg});return s.jsx(K,{...T("root"),ref:n,variant:v,mod:[{grow:m},y],size:x,...w,children:C})});Pe.classes=Nl;Pe.displayName="@mantine/core/Group";const jg={gap:{type:"spacing",property:"gap"},rowGap:{type:"spacing",property:"rowGap"},columnGap:{type:"spacing",property:"columnGap"},align:{type:"identity",property:"alignItems"},justify:{type:"identity",property:"justifyContent"},wrap:{type:"identity",property:"flexWrap"},direction:{type:"identity",property:"flexDirection"}};var kl={root:"m_8bffd616"};const Sg={},tt=En((e,n)=>{const t=ge("Flex",Sg,e),{classNames:o,className:a,style:r,styles:i,unstyled:l,vars:d,gap:c,rowGap:u,columnGap:g,align:h,justify:m,wrap:p,direction:f,...v}=t,x=Le({name:"Flex",classes:kl,props:t,className:a,style:r,classNames:o,styles:i,unstyled:l,vars:d}),y=Fn(),w=ml(),C=Zd({styleProps:{gap:c,rowGap:u,columnGap:g,align:h,justify:m,wrap:p,direction:f},theme:y,data:jg});return s.jsxs(s.Fragment,{children:[C.hasResponsiveStyles&&s.jsx(Wa,{selector:`.${w}`,styles:C.styles,media:C.media}),s.jsx(K,{ref:n,...x("root",{className:w,style:Ka(C.inlineStyles)}),...v})]})});tt.classes=kl;tt.displayName="@mantine/core/Flex";function ka({style:e,size:n=16,...t}){return s.jsx("svg",{viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{...e,width:Et(n),height:Et(n),display:"block"},...t,children:s.jsx("path",{d:"M3.13523 6.15803C3.3241 5.95657 3.64052 5.94637 3.84197 6.13523L7.5 9.56464L11.158 6.13523C11.3595 5.94637 11.6759 5.95657 11.8648 6.15803C12.0536 6.35949 12.0434 6.67591 11.842 6.86477L7.84197 10.6148C7.64964 10.7951 7.35036 10.7951 7.15803 10.6148L3.15803 6.86477C2.95657 6.67591 2.94637 6.35949 3.13523 6.15803Z",fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd"})})}ka.displayName="@mantine/core/AccordionChevron";var Dl={root:"m_66836ed3",wrapper:"m_a5d60502",body:"m_667c2793",title:"m_6a03f287",label:"m_698f4f23",icon:"m_667f2a6a",message:"m_7fa78076",closeButton:"m_87f54839"};const _g={},Mg=Ke((e,{radius:n,color:t,variant:o,autoContrast:a})=>{const r=e.variantColorResolver({color:t||e.primaryColor,theme:e,variant:o||"light",autoContrast:a});return{root:{"--alert-radius":n===void 0?void 0:$t(n),"--alert-bg":t||o?r.background:void 0,"--alert-color":r.color,"--alert-bd":t||o?r.border:void 0}}}),yo=ye((e,n)=>{const t=ge("Alert",_g,e),{classNames:o,className:a,style:r,styles:i,unstyled:l,vars:d,radius:c,color:u,title:g,children:h,id:m,icon:p,withCloseButton:f,onClose:v,closeButtonLabel:x,variant:y,autoContrast:w,...C}=t,j=Le({name:"Alert",classes:Dl,props:t,className:a,style:r,classNames:o,styles:i,unstyled:l,vars:d,varsResolver:Mg}),S=js(m),R=g&&`${S}-title`||void 0,_=`${S}-body`;return s.jsx(K,{id:S,...j("root",{variant:y}),variant:y,ref:n,...C,role:"alert","aria-describedby":_,"aria-labelledby":R,children:s.jsxs("div",{...j("wrapper"),children:[p&&s.jsx("div",{...j("icon"),children:p}),s.jsxs("div",{...j("body"),children:[g&&s.jsx("div",{...j("title"),"data-with-close-button":f||void 0,children:s.jsx("span",{id:R,...j("label"),children:g})}),h&&s.jsx("div",{id:_,...j("message"),"data-variant":y,children:h})]}),f&&s.jsx(Ya,{...j("closeButton"),onClick:v,variant:"transparent",size:16,iconSize:16,"aria-label":x,unstyled:l})]})})});yo.classes=Dl;yo.displayName="@mantine/core/Alert";var Tl={root:"m_b6d8b162"};function Rg(e){if(e==="start")return"start";if(e==="end"||e)return"end"}const Ng={inherit:!1},kg=Ke((e,{variant:n,lineClamp:t,gradient:o,size:a,color:r})=>({root:{"--text-fz":Rt(a),"--text-lh":eu(a),"--text-gradient":n==="gradient"?Jd(o,e):void 0,"--text-line-clamp":typeof t=="number"?t.toString():void 0,"--text-color":r?Wt(r,e):void 0}})),ue=En((e,n)=>{const t=ge("Text",Ng,e),{lineClamp:o,truncate:a,inline:r,inherit:i,gradient:l,span:d,__staticSelector:c,vars:u,className:g,style:h,classNames:m,styles:p,unstyled:f,variant:v,mod:x,size:y,...w}=t,C=Le({name:["Text",c],props:t,classes:Tl,className:g,style:h,classNames:m,styles:p,unstyled:f,vars:u,varsResolver:kg});return s.jsx(K,{...C("root",{focusable:!0}),ref:n,component:d?"span":"p",variant:v,mod:[{"data-truncate":Rg(a),"data-line-clamp":typeof o=="number","data-inline":r,"data-inherit":i},x],size:y,...w})});ue.classes=Tl;ue.displayName="@mantine/core/Text";function Il(e){return typeof e=="string"?{value:e,label:e}:"value"in e&&!("label"in e)?{value:e.value,label:e.value,disabled:e.disabled}:typeof e=="number"?{value:e.toString(),label:e.toString()}:"group"in e?{group:e.group,items:e.items.map(n=>Il(n))}:e}function rr(e){return e?e.map(n=>Il(n)):[]}function wo(e){return e.reduce((n,t)=>"group"in t?{...n,...wo(t.items)}:(n[t.value]=t,n),{})}var Ct={dropdown:"m_88b62a41",search:"m_985517d8",options:"m_b2821a6e",option:"m_92253aa5",empty:"m_2530cd1d",header:"m_858f94bd",footer:"m_82b967cb",group:"m_254f3e4f",groupLabel:"m_2bb2e9e5",chevron:"m_2943220b",optionsDropdownOption:"m_390b5f4",optionsDropdownCheckIcon:"m_8ee53fc2"};const Dg={error:null},Tg=Ke((e,{size:n,color:t})=>({chevron:{"--combobox-chevron-size":Ye(n,"combobox-chevron-size"),"--combobox-chevron-color":t?Wt(t,e):void 0}})),ir=ye((e,n)=>{const t=ge("ComboboxChevron",Dg,e),{size:o,error:a,style:r,className:i,classNames:l,styles:d,unstyled:c,vars:u,mod:g,...h}=t,m=Le({name:"ComboboxChevron",classes:Ct,props:t,style:r,className:i,classNames:l,styles:d,unstyled:c,vars:u,varsResolver:Tg,rootSelector:"chevron"});return s.jsx(K,{component:"svg",...h,...m("chevron"),size:o,viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",mod:["combobox-chevron",{error:a},g],ref:n,children:s.jsx("path",{d:"M4.93179 5.43179C4.75605 5.60753 4.75605 5.89245 4.93179 6.06819C5.10753 6.24392 5.39245 6.24392 5.56819 6.06819L7.49999 4.13638L9.43179 6.06819C9.60753 6.24392 9.89245 6.24392 10.0682 6.06819C10.2439 5.89245 10.2439 5.60753 10.0682 5.43179L7.81819 3.18179C7.73379 3.0974 7.61933 3.04999 7.49999 3.04999C7.38064 3.04999 7.26618 3.0974 7.18179 3.18179L4.93179 5.43179ZM10.0682 9.56819C10.2439 9.39245 10.2439 9.10753 10.0682 8.93179C9.89245 8.75606 9.60753 8.75606 9.43179 8.93179L7.49999 10.8636L5.56819 8.93179C5.39245 8.75606 5.10753 8.75606 4.93179 8.93179C4.75605 9.10753 4.75605 9.39245 4.93179 9.56819L7.18179 11.8182C7.35753 11.9939 7.64245 11.9939 7.81819 11.8182L10.0682 9.56819Z",fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd"})})});ir.classes=Ct;ir.displayName="@mantine/core/ComboboxChevron";const[Ig,Vt]=es("Combobox component was not found in tree"),Pl=b.forwardRef(({size:e,onMouseDown:n,onClick:t,onClear:o,...a},r)=>s.jsx(xs.ClearButton,{ref:r,tabIndex:-1,"aria-hidden":!0,...a,onMouseDown:i=>{i.preventDefault(),n==null||n(i)},onClick:i=>{o(),t==null||t(i)}}));Pl.displayName="@mantine/core/ComboboxClearButton";const Pg={},lr=ye((e,n)=>{const{classNames:t,styles:o,className:a,style:r,hidden:i,...l}=ge("ComboboxDropdown",Pg,e),d=Vt();return s.jsx(Mt.Dropdown,{...l,ref:n,role:"presentation","data-hidden":i||void 0,...d.getStyles("dropdown",{className:a,style:r,classNames:t,styles:o})})});lr.classes=Ct;lr.displayName="@mantine/core/ComboboxDropdown";const Fg={refProp:"ref"},Fl=ye((e,n)=>{const{children:t,refProp:o}=ge("ComboboxDropdownTarget",Fg,e);if(Vt(),!oo(t))throw new Error("Combobox.DropdownTarget component children should be an element or a component that accepts ref. Fragments, strings, numbers and other primitive values are not supported");return s.jsx(Mt.Target,{ref:n,refProp:o,children:t})});Fl.displayName="@mantine/core/ComboboxDropdownTarget";const Eg={},cr=ye((e,n)=>{const{classNames:t,className:o,style:a,styles:r,vars:i,...l}=ge("ComboboxEmpty",Eg,e),d=Vt();return s.jsx(K,{ref:n,...d.getStyles("empty",{className:o,classNames:t,styles:r,style:a}),...l})});cr.classes=Ct;cr.displayName="@mantine/core/ComboboxEmpty";function dr({onKeyDown:e,withKeyboardNavigation:n,withAriaAttributes:t,withExpandedAttribute:o,targetType:a,autoComplete:r}){const i=Vt(),[l,d]=b.useState(null),c=g=>{if(e==null||e(g),!i.readOnly&&n){if(g.nativeEvent.isComposing)return;if(g.nativeEvent.code==="ArrowDown"&&(g.preventDefault(),i.store.dropdownOpened?d(i.store.selectNextOption()):(i.store.openDropdown("keyboard"),d(i.store.selectActiveOption()),i.store.updateSelectedOptionIndex("selected",{scrollIntoView:!0}))),g.nativeEvent.code==="ArrowUp"&&(g.preventDefault(),i.store.dropdownOpened?d(i.store.selectPreviousOption()):(i.store.openDropdown("keyboard"),d(i.store.selectActiveOption()),i.store.updateSelectedOptionIndex("selected",{scrollIntoView:!0}))),g.nativeEvent.code==="Enter"||g.nativeEvent.code==="NumpadEnter"){if(g.nativeEvent.keyCode===229)return;const h=i.store.getSelectedOptionIndex();i.store.dropdownOpened&&h!==-1?(g.preventDefault(),i.store.clickSelectedOption()):a==="button"&&(g.preventDefault(),i.store.openDropdown("keyboard"))}g.key==="Escape"&&i.store.closeDropdown("keyboard"),g.nativeEvent.code==="Space"&&a==="button"&&(g.preventDefault(),i.store.toggleDropdown("keyboard"))}};return{...t?{"aria-haspopup":"listbox","aria-expanded":o&&!!(i.store.listId&&i.store.dropdownOpened)||void 0,"aria-controls":i.store.dropdownOpened?i.store.listId:void 0,"aria-activedescendant":i.store.dropdownOpened&&l||void 0,autoComplete:r,"data-expanded":i.store.dropdownOpened||void 0,"data-mantine-stop-propagation":i.store.dropdownOpened||void 0}:{},onKeyDown:c}}const Og={refProp:"ref",targetType:"input",withKeyboardNavigation:!0,withAriaAttributes:!0,withExpandedAttribute:!1,autoComplete:"off"},El=ye((e,n)=>{const{children:t,refProp:o,withKeyboardNavigation:a,withAriaAttributes:r,withExpandedAttribute:i,targetType:l,autoComplete:d,...c}=ge("ComboboxEventsTarget",Og,e);if(!oo(t))throw new Error("Combobox.EventsTarget component children should be an element or a component that accepts ref. Fragments, strings, numbers and other primitive values are not supported");const u=Vt(),g=dr({targetType:l,withAriaAttributes:r,withKeyboardNavigation:a,withExpandedAttribute:i,onKeyDown:t.props.onKeyDown,autoComplete:d});return b.cloneElement(t,{...g,...c,[o]:yn(n,u.store.targetRef,tu(t))})});El.displayName="@mantine/core/ComboboxEventsTarget";const Ag={},ur=ye((e,n)=>{const{classNames:t,className:o,style:a,styles:r,vars:i,...l}=ge("ComboboxFooter",Ag,e),d=Vt();return s.jsx(K,{ref:n,...d.getStyles("footer",{className:o,classNames:t,style:a,styles:r}),...l,onMouseDown:c=>{c.preventDefault()}})});ur.classes=Ct;ur.displayName="@mantine/core/ComboboxFooter";const zg={},gr=ye((e,n)=>{const{classNames:t,className:o,style:a,styles:r,vars:i,children:l,label:d,...c}=ge("ComboboxGroup",zg,e),u=Vt();return s.jsxs(K,{ref:n,...u.getStyles("group",{className:o,classNames:t,style:a,styles:r}),...c,children:[d&&s.jsx("div",{...u.getStyles("groupLabel",{classNames:t,styles:r}),children:d}),l]})});gr.classes=Ct;gr.displayName="@mantine/core/ComboboxGroup";const $g={},mr=ye((e,n)=>{const{classNames:t,className:o,style:a,styles:r,vars:i,...l}=ge("ComboboxHeader",$g,e),d=Vt();return s.jsx(K,{ref:n,...d.getStyles("header",{className:o,classNames:t,style:a,styles:r}),...l,onMouseDown:c=>{c.preventDefault()}})});mr.classes=Ct;mr.displayName="@mantine/core/ComboboxHeader";function Ol({value:e,valuesDivider:n=",",...t}){return s.jsx("input",{type:"hidden",value:Array.isArray(e)?e.join(n):e||"",...t})}Ol.displayName="@mantine/core/ComboboxHiddenInput";const Lg={},hr=ye((e,n)=>{const t=ge("ComboboxOption",Lg,e),{classNames:o,className:a,style:r,styles:i,vars:l,onClick:d,id:c,active:u,onMouseDown:g,onMouseOver:h,disabled:m,selected:p,mod:f,...v}=t,x=Vt(),y=b.useId(),w=c||y;return s.jsx(K,{...x.getStyles("option",{className:a,classNames:o,styles:i,style:r}),...v,ref:n,id:w,mod:["combobox-option",{"combobox-active":u,"combobox-disabled":m,"combobox-selected":p},f],role:"option",onClick:C=>{var j;m?C.preventDefault():((j=x.onOptionSubmit)==null||j.call(x,t.value,t),d==null||d(C))},onMouseDown:C=>{C.preventDefault(),g==null||g(C)},onMouseOver:C=>{x.resetSelectionOnOptionHover&&x.store.resetSelectedOption(),h==null||h(C)}})});hr.classes=Ct;hr.displayName="@mantine/core/ComboboxOption";const Vg={},pr=ye((e,n)=>{const t=ge("ComboboxOptions",Vg,e),{classNames:o,className:a,style:r,styles:i,id:l,onMouseDown:d,labelledBy:c,...u}=t,g=Vt(),h=js(l);return b.useEffect(()=>{g.store.setListId(h)},[h]),s.jsx(K,{ref:n,...g.getStyles("options",{className:a,style:r,classNames:o,styles:i}),...u,id:h,role:"listbox","aria-labelledby":c,onMouseDown:m=>{m.preventDefault(),d==null||d(m)}})});pr.classes=Ct;pr.displayName="@mantine/core/ComboboxOptions";const Bg={withAriaAttributes:!0,withKeyboardNavigation:!0},fr=ye((e,n)=>{const t=ge("ComboboxSearch",Bg,e),{classNames:o,styles:a,unstyled:r,vars:i,withAriaAttributes:l,onKeyDown:d,withKeyboardNavigation:c,size:u,...g}=t,h=Vt(),m=h.getStyles("search"),p=dr({targetType:"input",withAriaAttributes:l,withKeyboardNavigation:c,withExpandedAttribute:!1,onKeyDown:d,autoComplete:"off"});return s.jsx(xs,{ref:yn(n,h.store.searchRef),classNames:[{input:m.className},o],styles:[{input:m.style},a],size:u||h.size,...p,...g,__staticSelector:"Combobox"})});fr.classes=Ct;fr.displayName="@mantine/core/ComboboxSearch";const Ug={refProp:"ref",targetType:"input",withKeyboardNavigation:!0,withAriaAttributes:!0,withExpandedAttribute:!1,autoComplete:"off"},Al=ye((e,n)=>{const{children:t,refProp:o,withKeyboardNavigation:a,withAriaAttributes:r,withExpandedAttribute:i,targetType:l,autoComplete:d,...c}=ge("ComboboxTarget",Ug,e);if(!oo(t))throw new Error("Combobox.Target component children should be an element or a component that accepts ref. Fragments, strings, numbers and other primitive values are not supported");const u=Vt(),g=dr({targetType:l,withAriaAttributes:r,withKeyboardNavigation:a,withExpandedAttribute:i,onKeyDown:t.props.onKeyDown,autoComplete:d}),h=b.cloneElement(t,{...g,...c});return s.jsx(Mt.Target,{ref:yn(n,u.store.targetRef),children:h})});Al.displayName="@mantine/core/ComboboxTarget";function Hg(e,n,t){for(let o=e-1;o>=0;o-=1)if(!n[o].hasAttribute("data-combobox-disabled"))return o;if(t){for(let o=n.length-1;o>-1;o-=1)if(!n[o].hasAttribute("data-combobox-disabled"))return o}return e}function Gg(e,n,t){for(let o=e+1;o<n.length;o+=1)if(!n[o].hasAttribute("data-combobox-disabled"))return o;if(t){for(let o=0;o<n.length;o+=1)if(!n[o].hasAttribute("data-combobox-disabled"))return o}return e}function qg(e){for(let n=0;n<e.length;n+=1)if(!e[n].hasAttribute("data-combobox-disabled"))return n;return-1}function Co({defaultOpened:e,opened:n,onOpenedChange:t,onDropdownClose:o,onDropdownOpen:a,loop:r=!0,scrollBehavior:i="instant"}={}){const[l,d]=At({value:n,defaultValue:e,finalValue:!1,onChange:t}),c=b.useRef(null),u=b.useRef(-1),g=b.useRef(null),h=b.useRef(null),m=b.useRef(-1),p=b.useRef(-1),f=b.useRef(-1),v=b.useCallback((M="unknown")=>{l||(d(!0),a==null||a(M))},[d,a,l]),x=b.useCallback((M="unknown")=>{l&&(d(!1),o==null||o(M))},[d,o,l]),y=b.useCallback((M="unknown")=>{l?x(M):v(M)},[x,v,l]),w=b.useCallback(()=>{const M=document.querySelector(`#${c.current} [data-combobox-selected]`);M==null||M.removeAttribute("data-combobox-selected"),M==null||M.removeAttribute("aria-selected")},[]),C=b.useCallback(M=>{const D=document.getElementById(c.current),O=D==null?void 0:D.querySelectorAll("[data-combobox-option]");if(!O)return null;const F=M>=O.length?0:M<0?O.length-1:M;return u.current=F,O!=null&&O[F]&&!O[F].hasAttribute("data-combobox-disabled")?(w(),O[F].setAttribute("data-combobox-selected","true"),O[F].setAttribute("aria-selected","true"),O[F].scrollIntoView({block:"nearest",behavior:i}),O[F].id):null},[i,w]),j=b.useCallback(()=>{const M=document.querySelector(`#${c.current} [data-combobox-active]`);if(M){const D=document.querySelectorAll(`#${c.current} [data-combobox-option]`),O=Array.from(D).findIndex(F=>F===M);return C(O)}return C(0)},[C]),S=b.useCallback(()=>C(Gg(u.current,document.querySelectorAll(`#${c.current} [data-combobox-option]`),r)),[C,r]),R=b.useCallback(()=>C(Hg(u.current,document.querySelectorAll(`#${c.current} [data-combobox-option]`),r)),[C,r]),_=b.useCallback(()=>C(qg(document.querySelectorAll(`#${c.current} [data-combobox-option]`))),[C]),T=b.useCallback((M="selected",D)=>{f.current=window.setTimeout(()=>{var $;const O=document.querySelectorAll(`#${c.current} [data-combobox-option]`),F=Array.from(O).findIndex(z=>z.hasAttribute(`data-combobox-${M}`));u.current=F,D!=null&&D.scrollIntoView&&(($=O[F])==null||$.scrollIntoView({block:"nearest",behavior:i}))},0)},[]),k=b.useCallback(()=>{u.current=-1,w()},[w]),I=b.useCallback(()=>{const M=document.querySelectorAll(`#${c.current} [data-combobox-option]`),D=M==null?void 0:M[u.current];D==null||D.click()},[]),E=b.useCallback(M=>{c.current=M},[]),V=b.useCallback(()=>{m.current=window.setTimeout(()=>g.current.focus(),0)},[]),L=b.useCallback(()=>{p.current=window.setTimeout(()=>h.current.focus(),0)},[]),B=b.useCallback(()=>u.current,[]);return b.useEffect(()=>()=>{window.clearTimeout(m.current),window.clearTimeout(p.current),window.clearTimeout(f.current)},[]),{dropdownOpened:l,openDropdown:v,closeDropdown:x,toggleDropdown:y,selectedOptionIndex:u.current,getSelectedOptionIndex:B,selectOption:C,selectFirstOption:_,selectActiveOption:j,selectNextOption:S,selectPreviousOption:R,resetSelectedOption:k,updateSelectedOptionIndex:T,listId:c.current,setListId:E,clickSelectedOption:I,searchRef:g,focusSearchInput:V,targetRef:h,focusTarget:L}}const Wg={keepMounted:!0,withinPortal:!0,resetSelectionOnOptionHover:!1,width:"target",transitionProps:{transition:"fade",duration:0}},Kg=Ke((e,{size:n,dropdownPadding:t})=>({options:{"--combobox-option-fz":Rt(n),"--combobox-option-padding":Ye(n,"combobox-option-padding")},dropdown:{"--combobox-padding":t===void 0?void 0:Et(t),"--combobox-option-fz":Rt(n),"--combobox-option-padding":Ye(n,"combobox-option-padding")}}));function $e(e){const n=ge("Combobox",Wg,e),{classNames:t,styles:o,unstyled:a,children:r,store:i,vars:l,onOptionSubmit:d,onClose:c,size:u,dropdownPadding:g,resetSelectionOnOptionHover:h,__staticSelector:m,readOnly:p,...f}=n,v=Co(),x=i||v,y=Le({name:m||"Combobox",classes:Ct,props:n,classNames:t,styles:o,unstyled:a,vars:l,varsResolver:Kg}),w=()=>{c==null||c(),x.closeDropdown()};return s.jsx(Ig,{value:{getStyles:y,store:x,onOptionSubmit:d,size:u,resetSelectionOnOptionHover:h,readOnly:p},children:s.jsx(Mt,{opened:x.dropdownOpened,...f,onChange:C=>!C&&w(),withRoles:!1,unstyled:a,children:r})})}const Yg=e=>e;$e.extend=Yg;$e.classes=Ct;$e.displayName="@mantine/core/Combobox";$e.Target=Al;$e.Dropdown=lr;$e.Options=pr;$e.Option=hr;$e.Search=fr;$e.Empty=cr;$e.Chevron=ir;$e.Footer=ur;$e.Header=mr;$e.EventsTarget=El;$e.DropdownTarget=Fl;$e.Group=gr;$e.ClearButton=Pl;$e.HiddenInput=Ol;function Yn(e){return"group"in e}function zl({options:e,search:n,limit:t}){const o=n.trim().toLowerCase(),a=[];for(let r=0;r<e.length;r+=1){const i=e[r];if(a.length===t)return a;Yn(i)&&a.push({group:i.group,items:zl({options:i.items,search:n,limit:t-a.length})}),Yn(i)||i.label.toLowerCase().includes(o)&&a.push(i)}return a}function Qg(e){if(e.length===0)return!0;for(const n of e)if(!("group"in n)||n.items.length>0)return!1;return!0}function $l(e,n=new Set){if(Array.isArray(e))for(const t of e)if(Yn(t))$l(t.items,n);else{if(typeof t.value>"u")throw new Error("[@mantine/core] Each option must have value property");if(typeof t.value!="string")throw new Error(`[@mantine/core] Option value must be a string, other data formats are not supported, got ${typeof t.value}`);if(n.has(t.value))throw new Error(`[@mantine/core] Duplicate options are not supported. Option with value "${t.value}" was provided more than once`);n.add(t.value)}}function Xg(e,n){return Array.isArray(e)?e.includes(n):e===n}function Ll({data:e,withCheckIcon:n,value:t,checkIconPosition:o,unstyled:a,renderOption:r}){if(!Yn(e)){const l=Xg(t,e.value),d=n&&l&&s.jsx(Vu,{className:Ct.optionsDropdownCheckIcon}),c=s.jsxs(s.Fragment,{children:[o==="left"&&d,s.jsx("span",{children:e.label}),o==="right"&&d]});return s.jsx($e.Option,{value:e.value,disabled:e.disabled,className:Ce({[Ct.optionsDropdownOption]:!a}),"data-reverse":o==="right"||void 0,"data-checked":l||void 0,"aria-selected":l,active:l,children:typeof r=="function"?r({option:e,checked:l}):c})}const i=e.items.map(l=>s.jsx(Ll,{data:l,value:t,unstyled:a,withCheckIcon:n,checkIconPosition:o,renderOption:r},l.value));return s.jsx($e.Group,{label:e.group,children:i})}function vr({data:e,hidden:n,hiddenWhenEmpty:t,filter:o,search:a,limit:r,maxDropdownHeight:i,withScrollArea:l=!0,filterOptions:d=!0,withCheckIcon:c=!1,value:u,checkIconPosition:g,nothingFoundMessage:h,unstyled:m,labelId:p,renderOption:f,scrollAreaProps:v,"aria-label":x}){$l(e);const w=typeof a=="string"?(o||zl)({options:e,search:d?a:"",limit:r??1/0}):e,C=Qg(w),j=w.map(S=>s.jsx(Ll,{data:S,withCheckIcon:c,value:u,checkIconPosition:g,unstyled:m,renderOption:f},Yn(S)?S.group:S.value));return s.jsx($e.Dropdown,{hidden:n||t&&C,"data-composed":!0,children:s.jsxs($e.Options,{labelledBy:p,"aria-label":x,children:[l?s.jsx(ao.Autosize,{mah:i??220,type:"scroll",scrollbarSize:"var(--combobox-padding)",offsetScrollbars:"y",...v,children:j}):j,C&&h&&s.jsx($e.Empty,{children:h})]})})}const Zg={},xr=ye((e,n)=>{const t=ge("Autocomplete",Zg,e),{classNames:o,styles:a,unstyled:r,vars:i,dropdownOpened:l,defaultDropdownOpened:d,onDropdownClose:c,onDropdownOpen:u,onFocus:g,onBlur:h,onClick:m,onChange:p,data:f,value:v,defaultValue:x,selectFirstOptionOnChange:y,onOptionSubmit:w,comboboxProps:C,readOnly:j,disabled:S,filter:R,limit:_,withScrollArea:T,maxDropdownHeight:k,size:I,id:E,renderOption:V,autoComplete:L,scrollAreaProps:B,onClear:M,clearButtonProps:D,error:O,clearable:F,rightSection:$,...z}=t,H=js(E),re=rr(f),ie=wo(re),[X,oe]=At({value:v,defaultValue:x,finalValue:"",onChange:p}),ne=Co({opened:l,defaultOpened:d,onDropdownOpen:u,onDropdownClose:()=>{c==null||c(),ne.resetSelectedOption()}}),J=te=>{oe(te),ne.resetSelectedOption()},{resolvedClassNames:P,resolvedStyles:Q}=wn({props:t,styles:a,classNames:o});b.useEffect(()=>{y&&ne.selectFirstOption()},[y,X]);const ce=s.jsx($e.ClearButton,{...D,onClear:()=>{J(""),M==null||M()}});return s.jsxs($e,{store:ne,__staticSelector:"Autocomplete",classNames:P,styles:Q,unstyled:r,readOnly:j,onOptionSubmit:te=>{w==null||w(te),J(ie[te].label),ne.closeDropdown()},size:I,...C,children:[s.jsx($e.Target,{autoComplete:L,children:s.jsx(Cn,{ref:n,...z,size:I,__staticSelector:"Autocomplete",__clearSection:ce,__clearable:F&&!!X&&!S&&!j,rightSection:$,disabled:S,readOnly:j,value:X,error:O,onChange:te=>{J(te.currentTarget.value),ne.openDropdown(),y&&ne.selectFirstOption()},onFocus:te=>{ne.openDropdown(),g==null||g(te)},onBlur:te=>{ne.closeDropdown(),h==null||h(te)},onClick:te=>{ne.openDropdown(),m==null||m(te)},classNames:P,styles:Q,unstyled:r,id:H})}),s.jsx(vr,{data:re,hidden:j||S,filter:R,search:X,limit:_,hiddenWhenEmpty:!0,withScrollArea:T,maxDropdownHeight:k,unstyled:r,labelId:z.label?`${H}-label`:void 0,"aria-label":z.label?void 0:z["aria-label"],renderOption:V,scrollAreaProps:B})]})});xr.classes={...Cn.classes,...$e.classes};xr.displayName="@mantine/core/Autocomplete";var Vl={root:"m_347db0ec","root--dot":"m_fbd81e3d",label:"m_5add502a",section:"m_91fdda9b"};const Jg={},em=Ke((e,{radius:n,color:t,gradient:o,variant:a,size:r,autoContrast:i})=>{const l=e.variantColorResolver({color:t||e.primaryColor,theme:e,gradient:o,variant:a||"filled",autoContrast:i});return{root:{"--badge-height":Ye(r,"badge-height"),"--badge-padding-x":Ye(r,"badge-padding-x"),"--badge-fz":Ye(r,"badge-fz"),"--badge-radius":n===void 0?void 0:$t(n),"--badge-bg":t||a?l.background:void 0,"--badge-color":t||a?l.color:void 0,"--badge-bd":t||a?l.border:void 0,"--badge-dot-color":a==="dot"?Wt(t,e):void 0}}}),ot=En((e,n)=>{const t=ge("Badge",Jg,e),{classNames:o,className:a,style:r,styles:i,unstyled:l,vars:d,radius:c,color:u,gradient:g,leftSection:h,rightSection:m,children:p,variant:f,fullWidth:v,autoContrast:x,circle:y,mod:w,...C}=t,j=Le({name:"Badge",props:t,classes:Vl,className:a,style:r,classNames:o,styles:i,unstyled:l,vars:d,varsResolver:em});return s.jsxs(K,{variant:f,mod:[{block:v,circle:y,"with-right-section":!!m,"with-left-section":!!h},w],...j("root",{variant:f}),ref:n,...C,children:[h&&s.jsx("span",{...j("section"),"data-position":"left",children:h}),s.jsx("span",{...j("label"),children:p}),m&&s.jsx("span",{...j("section"),"data-position":"right",children:m})]})});ot.classes=Vl;ot.displayName="@mantine/core/Badge";var ss={root:"m_77c9d27d",inner:"m_80f1301b",label:"m_811560b9",section:"m_a74036a",loader:"m_a25b86ee",group:"m_80d6d844",groupSection:"m_70be2a01"};const Ci={orientation:"horizontal"},tm=Ke((e,{borderWidth:n})=>({group:{"--button-border-width":Et(n)}})),br=ye((e,n)=>{const t=ge("ButtonGroup",Ci,e),{className:o,style:a,classNames:r,styles:i,unstyled:l,orientation:d,vars:c,borderWidth:u,variant:g,mod:h,...m}=ge("ButtonGroup",Ci,e),p=Le({name:"ButtonGroup",props:t,classes:ss,className:o,style:a,classNames:r,styles:i,unstyled:l,vars:c,varsResolver:tm,rootSelector:"group"});return s.jsx(K,{...p("group"),ref:n,variant:g,mod:[{"data-orientation":d},h],role:"group",...m})});br.classes=ss;br.displayName="@mantine/core/ButtonGroup";const ji={},nm=Ke((e,{radius:n,color:t,gradient:o,variant:a,autoContrast:r,size:i})=>{const l=e.variantColorResolver({color:t||e.primaryColor,theme:e,gradient:o,variant:a||"filled",autoContrast:r});return{groupSection:{"--section-height":Ye(i,"section-height"),"--section-padding-x":Ye(i,"section-padding-x"),"--section-fz":i!=null&&i.includes("compact")?Rt(i.replace("compact-","")):Rt(i),"--section-radius":n===void 0?void 0:$t(n),"--section-bg":t||a?l.background:void 0,"--section-color":l.color,"--section-bd":t||a?l.border:void 0}}}),yr=ye((e,n)=>{const t=ge("ButtonGroupSection",ji,e),{className:o,style:a,classNames:r,styles:i,unstyled:l,vars:d,variant:c,gradient:u,radius:g,autoContrast:h,...m}=ge("ButtonGroupSection",ji,e),p=Le({name:"ButtonGroupSection",props:t,classes:ss,className:o,style:a,classNames:r,styles:i,unstyled:l,vars:d,varsResolver:nm,rootSelector:"groupSection"});return s.jsx(K,{...p("groupSection"),ref:n,variant:c,...m})});yr.classes=ss;yr.displayName="@mantine/core/ButtonGroupSection";const sm={in:{opacity:1,transform:`translate(-50%, calc(-50% + ${Et(1)}))`},out:{opacity:0,transform:"translate(-50%, -200%)"},common:{transformOrigin:"center"},transitionProperty:"transform, opacity"},om={},am=Ke((e,{radius:n,color:t,gradient:o,variant:a,size:r,justify:i,autoContrast:l})=>{const d=e.variantColorResolver({color:t||e.primaryColor,theme:e,gradient:o,variant:a||"filled",autoContrast:l});return{root:{"--button-justify":i,"--button-height":Ye(r,"button-height"),"--button-padding-x":Ye(r,"button-padding-x"),"--button-fz":r!=null&&r.includes("compact")?Rt(r.replace("compact-","")):Rt(r),"--button-radius":n===void 0?void 0:$t(n),"--button-bg":t||a?d.background:void 0,"--button-hover":t||a?d.hover:void 0,"--button-color":d.color,"--button-bd":t||a?d.border:void 0,"--button-hover-color":t||a?d.hoverColor:void 0}}}),pt=En((e,n)=>{const t=ge("Button",om,e),{style:o,vars:a,className:r,color:i,disabled:l,children:d,leftSection:c,rightSection:u,fullWidth:g,variant:h,radius:m,loading:p,loaderProps:f,gradient:v,classNames:x,styles:y,unstyled:w,"data-disabled":C,autoContrast:j,mod:S,...R}=t,_=Le({name:"Button",props:t,classes:ss,className:r,style:o,classNames:x,styles:y,unstyled:w,vars:a,varsResolver:am}),T=!!c,k=!!u;return s.jsxs(Pt,{ref:n,..._("root",{active:!l&&!p&&!C}),unstyled:w,variant:h,disabled:l||p,mod:[{disabled:l||C,loading:p,block:g,"with-left-section":T,"with-right-section":k},S],...R,children:[s.jsx(Jn,{mounted:!!p,transition:sm,duration:150,children:I=>s.jsx(K,{component:"span",..._("loader",{style:I}),"aria-hidden":!0,children:s.jsx(Cs,{color:"var(--button-color)",size:"calc(var(--button-height) / 1.8)",...f})})}),s.jsxs("span",{..._("inner"),children:[c&&s.jsx(K,{component:"span",..._("section"),mod:{position:"left"},children:c}),s.jsx(K,{component:"span",mod:{loading:p},..._("label"),children:d}),u&&s.jsx(K,{component:"span",..._("section"),mod:{position:"right"},children:u})]})]})});pt.classes=ss;pt.displayName="@mantine/core/Button";pt.Group=br;pt.GroupSection=yr;const rm={timeout:1e3};function Bl(e){const{children:n,timeout:t,value:o,...a}=ge("CopyButton",rm,e),r=rg({timeout:t}),i=()=>r.copy(o);return s.jsx(s.Fragment,{children:n({copy:i,copied:r.copied,...a})})}Bl.displayName="@mantine/core/CopyButton";var Ul={root:"m_3eebeb36",label:"m_9e365f20"};const im={orientation:"horizontal"},lm=Ke((e,{color:n,variant:t,size:o})=>({root:{"--divider-color":n?Wt(n,e):void 0,"--divider-border-style":t,"--divider-size":Ye(o,"divider-size")}})),wr=ye((e,n)=>{const t=ge("Divider",im,e),{classNames:o,className:a,style:r,styles:i,unstyled:l,vars:d,color:c,orientation:u,label:g,labelPosition:h,mod:m,...p}=t,f=Le({name:"Divider",classes:Ul,props:t,className:a,style:r,classNames:o,styles:i,unstyled:l,vars:d,varsResolver:lm});return s.jsx(K,{ref:n,mod:[{orientation:u,"with-label":!!g},m],...f("root"),...p,role:"separator",children:g&&s.jsx(K,{component:"span",mod:{position:h},...f("label"),children:g})})});wr.classes=Ul;wr.displayName="@mantine/core/Divider";function cm({open:e,close:n,openDelay:t,closeDelay:o}){const a=b.useRef(-1),r=b.useRef(-1),i=()=>{window.clearTimeout(a.current),window.clearTimeout(r.current)},l=()=>{i(),t===0||t===void 0?e():a.current=window.setTimeout(e,t)},d=()=>{i(),o===0||o===void 0?n():r.current=window.setTimeout(n,o)};return b.useEffect(()=>i,[]),{openDropdown:l,closeDropdown:d}}function Si({color:e,theme:n,defaultShade:t}){const o=hl({color:e,theme:n});return o.isThemeColor?o.shade===void 0?`var(--mantine-color-${o.color}-${t})`:`var(${o.variable})`:e}var Hl={root:"m_bcb3f3c2"};const dm={color:"yellow"},um=Ke((e,{color:n})=>({root:{"--mark-bg-dark":Si({color:n,theme:e,defaultShade:5}),"--mark-bg-light":Si({color:n,theme:e,defaultShade:2})}})),Cr=ye((e,n)=>{const t=ge("Mark",dm,e),{classNames:o,className:a,style:r,styles:i,unstyled:l,vars:d,color:c,variant:u,...g}=t,h=Le({name:"Mark",props:t,className:a,style:r,classes:Hl,classNames:o,styles:i,unstyled:l,vars:d,varsResolver:um});return s.jsx(K,{component:"mark",ref:n,variant:u,...h("root"),...g})});Cr.classes=Hl;Cr.displayName="@mantine/core/Mark";function _i(e){return e.replace(/[-[\]{}()*+?.,\\^$|#]/g,"\\$&")}function gm(e,n){if(n==null)return[{chunk:e,highlighted:!1}];const t=Array.isArray(n)?n.map(_i):_i(n);if(!(Array.isArray(t)?t.filter(l=>l.trim().length>0).length>0:t.trim()!==""))return[{chunk:e,highlighted:!1}];const a=typeof t=="string"?t.trim():t.filter(l=>l.trim().length!==0).map(l=>l.trim()).sort((l,d)=>d.length-l.length).join("|"),r=new RegExp(`(${a})`,"gi");return e.split(r).map(l=>({chunk:l,highlighted:r.test(l)})).filter(({chunk:l})=>l)}const mm={},jr=En((e,n)=>{const{unstyled:t,children:o,highlight:a,highlightStyles:r,color:i,...l}=ge("Highlight",mm,e),d=gm(o,a);return s.jsx(ue,{unstyled:t,ref:n,...l,__staticSelector:"Highlight",children:d.map(({chunk:c,highlighted:u},g)=>u?s.jsx(Cr,{unstyled:t,color:i,style:r,"data-highlight":c,children:c},g):s.jsx("span",{children:c},g))})});jr.classes=ue.classes;jr.displayName="@mantine/core/Highlight";function hm(e="top-end",n=0){const t={"--indicator-top":void 0,"--indicator-bottom":void 0,"--indicator-left":void 0,"--indicator-right":void 0,"--indicator-translate-x":void 0,"--indicator-translate-y":void 0},o=Et(n),[a,r]=e.split("-");return a==="top"&&(t["--indicator-top"]=o,t["--indicator-translate-y"]="-50%"),a==="middle"&&(t["--indicator-top"]="50%",t["--indicator-translate-y"]="-50%"),a==="bottom"&&(t["--indicator-bottom"]=o,t["--indicator-translate-y"]="50%"),r==="start"&&(t["--indicator-left"]=o,t["--indicator-translate-x"]="-50%"),r==="center"&&(t["--indicator-left"]="50%",t["--indicator-translate-x"]="-50%"),r==="end"&&(t["--indicator-right"]=o,t["--indicator-translate-x"]="50%"),t}var Gl={root:"m_e5262200",indicator:"m_760d1fb1",processing:"m_885901b1"};const pm={position:"top-end",offset:0,inline:!1,withBorder:!1,disabled:!1,processing:!1},fm=Ke((e,{color:n,position:t,offset:o,size:a,radius:r,zIndex:i,autoContrast:l})=>({root:{"--indicator-color":n?Wt(n,e):void 0,"--indicator-text-color":sr(l,e)?Qa({color:n,theme:e,autoContrast:l}):void 0,"--indicator-size":Et(a),"--indicator-radius":r===void 0?void 0:$t(r),"--indicator-z-index":i==null?void 0:i.toString(),...hm(t,o)}})),Sr=ye((e,n)=>{const t=ge("Indicator",pm,e),{classNames:o,className:a,style:r,styles:i,unstyled:l,vars:d,children:c,position:u,offset:g,inline:h,label:m,radius:p,color:f,withBorder:v,disabled:x,processing:y,zIndex:w,autoContrast:C,mod:j,...S}=t,R=Le({name:"Indicator",classes:Gl,props:t,className:a,style:r,classNames:o,styles:i,unstyled:l,vars:d,varsResolver:fm});return s.jsxs(K,{ref:n,...R("root"),mod:[{inline:h},j],...S,children:[!x&&s.jsx(K,{mod:{"with-label":!!m,"with-border":v,processing:y},...R("indicator"),children:m}),c]})});Sr.classes=Gl;Sr.displayName="@mantine/core/Indicator";var ql={root:"m_6e45937b",loader:"m_e8eb006c",overlay:"m_df587f17"};const Mi={transitionProps:{transition:"fade",duration:0},overlayProps:{backgroundOpacity:.75},zIndex:nu("overlay")},vm=Ke((e,{zIndex:n})=>({root:{"--lo-z-index":n==null?void 0:n.toString()}})),_r=ye((e,n)=>{const t=ge("LoadingOverlay",Mi,e),{classNames:o,className:a,style:r,styles:i,unstyled:l,vars:d,transitionProps:c,loaderProps:u,overlayProps:g,visible:h,zIndex:m,...p}=t,f=Fn(),v=Le({name:"LoadingOverlay",classes:ql,props:t,className:a,style:r,classNames:o,styles:i,unstyled:l,vars:d,varsResolver:vm}),x={...Mi.overlayProps,...g};return s.jsx(Jn,{transition:"fade",...c,mounted:!!h,children:y=>s.jsxs(K,{...v("root",{style:y}),ref:n,...p,children:[s.jsx(Cs,{...v("loader"),unstyled:l,...u}),s.jsx(pi,{...x,...v("overlay"),darkHidden:!0,unstyled:l,color:(g==null?void 0:g.color)||f.white}),s.jsx(pi,{...x,...v("overlay"),lightHidden:!0,unstyled:l,color:(g==null?void 0:g.color)||f.colors.dark[5]})]})})});_r.classes=ql;_r.displayName="@mantine/core/LoadingOverlay";const[xm,_s]=es("Menu component was not found in the tree");var os={dropdown:"m_dc9b7c9f",label:"m_9bfac126",divider:"m_efdf90cb",item:"m_99ac2aa1",itemLabel:"m_5476e0d3",itemSection:"m_8b75e504"};const bm={},Mr=ye((e,n)=>{const{classNames:t,className:o,style:a,styles:r,vars:i,...l}=ge("MenuDivider",bm,e),d=_s();return s.jsx(K,{ref:n,...d.getStyles("divider",{className:o,style:a,styles:r,classNames:t}),...l})});Mr.classes=os;Mr.displayName="@mantine/core/MenuDivider";const ym={},Rr=ye((e,n)=>{const{classNames:t,className:o,style:a,styles:r,vars:i,onMouseEnter:l,onMouseLeave:d,onKeyDown:c,children:u,...g}=ge("MenuDropdown",ym,e),h=b.useRef(null),m=_s(),p=vt(c,x=>{var y,w;(x.key==="ArrowUp"||x.key==="ArrowDown")&&(x.preventDefault(),(w=(y=h.current)==null?void 0:y.querySelectorAll("[data-menu-item]:not(:disabled)")[0])==null||w.focus())}),f=vt(l,()=>(m.trigger==="hover"||m.trigger==="click-hover")&&m.openDropdown()),v=vt(d,()=>(m.trigger==="hover"||m.trigger==="click-hover")&&m.closeDropdown());return s.jsxs(Mt.Dropdown,{...g,onMouseEnter:f,onMouseLeave:v,role:"menu","aria-orientation":"vertical",ref:yn(n,h),...m.getStyles("dropdown",{className:o,style:a,styles:r,classNames:t,withStaticClass:!1}),tabIndex:-1,"data-menu-dropdown":!0,onKeyDown:p,children:[m.withInitialFocusPlaceholder&&s.jsx("div",{tabIndex:-1,"data-autofocus":!0,"data-mantine-stop-propagation":!0,style:{outline:0}}),u]})});Rr.classes=os;Rr.displayName="@mantine/core/MenuDropdown";const wm={},Nr=En((e,n)=>{const{classNames:t,className:o,style:a,styles:r,vars:i,color:l,closeMenuOnClick:d,leftSection:c,rightSection:u,children:g,disabled:h,"data-disabled":m,...p}=ge("MenuItem",wm,e),f=_s(),v=Fn(),{dir:x}=On(),y=b.useRef(null),w=f.getItemIndex(y.current),C=p,j=vt(C.onMouseLeave,()=>f.setHovered(-1)),S=vt(C.onMouseEnter,()=>f.setHovered(f.getItemIndex(y.current))),R=vt(C.onClick,()=>{m||(typeof d=="boolean"?d&&f.closeDropdownImmediately():f.closeOnItemClick&&f.closeDropdownImmediately())}),_=vt(C.onFocus,()=>f.setHovered(f.getItemIndex(y.current))),T=l?v.variantColorResolver({color:l,theme:v,variant:"light"}):void 0,k=l?hl({color:l,theme:v}):null;return s.jsxs(Pt,{...p,unstyled:f.unstyled,tabIndex:f.menuItemTabIndex,onFocus:_,...f.getStyles("item",{className:o,style:a,styles:r,classNames:t}),ref:yn(y,n),role:"menuitem",disabled:h,"data-menu-item":!0,"data-disabled":h||m||void 0,"data-hovered":f.hovered===w?!0:void 0,"data-mantine-stop-propagation":!0,onMouseEnter:S,onMouseLeave:j,onClick:R,onKeyDown:Uu({siblingSelector:"[data-menu-item]:not([data-disabled])",parentSelector:"[data-menu-dropdown]",activateOnFocus:!1,loop:f.loop,dir:x,orientation:"vertical",onKeyDown:C.onKeyDown}),__vars:{"--menu-item-color":k!=null&&k.isThemeColor&&(k==null?void 0:k.shade)===void 0?`var(--mantine-color-${k.color}-6)`:T==null?void 0:T.color,"--menu-item-hover":T==null?void 0:T.hover},children:[c&&s.jsx("div",{...f.getStyles("itemSection",{styles:r,classNames:t}),"data-position":"left",children:c}),g&&s.jsx("div",{...f.getStyles("itemLabel",{styles:r,classNames:t}),children:g}),u&&s.jsx("div",{...f.getStyles("itemSection",{styles:r,classNames:t}),"data-position":"right",children:u})]})});Nr.classes=os;Nr.displayName="@mantine/core/MenuItem";const Cm={},kr=ye((e,n)=>{const{classNames:t,className:o,style:a,styles:r,vars:i,...l}=ge("MenuLabel",Cm,e),d=_s();return s.jsx(K,{ref:n,...d.getStyles("label",{className:o,style:a,styles:r,classNames:t}),...l})});kr.classes=os;kr.displayName="@mantine/core/MenuLabel";const jm={refProp:"ref"},Wl=b.forwardRef((e,n)=>{const{children:t,refProp:o,...a}=ge("MenuTarget",jm,e);if(!oo(t))throw new Error("Menu.Target component children should be an element or a component that accepts ref. Fragments, strings, numbers and other primitive values are not supported");const r=_s(),i=t.props,l=vt(i.onClick,()=>{r.trigger==="click"?r.toggleDropdown():r.trigger==="click-hover"&&(r.setOpenedViaClick(!0),r.opened||r.openDropdown())}),d=vt(i.onMouseEnter,()=>(r.trigger==="hover"||r.trigger==="click-hover")&&r.openDropdown()),c=vt(i.onMouseLeave,()=>{(r.trigger==="hover"||r.trigger==="click-hover"&&!r.openedViaClick)&&r.closeDropdown()});return s.jsx(Mt.Target,{refProp:o,popupType:"menu",ref:n,...a,children:b.cloneElement(t,{onClick:l,onMouseEnter:d,onMouseLeave:c,"data-expanded":r.opened?!0:void 0})})});Wl.displayName="@mantine/core/MenuTarget";const Sm={trapFocus:!0,closeOnItemClick:!0,withInitialFocusPlaceholder:!0,clickOutsideEvents:["mousedown","touchstart","keydown"],loop:!0,trigger:"click",openDelay:0,closeDelay:100,menuItemTabIndex:-1};function Te(e){const n=ge("Menu",Sm,e),{children:t,onOpen:o,onClose:a,opened:r,defaultOpened:i,trapFocus:l,onChange:d,closeOnItemClick:c,loop:u,closeOnEscape:g,trigger:h,openDelay:m,closeDelay:p,classNames:f,styles:v,unstyled:x,variant:y,vars:w,menuItemTabIndex:C,keepMounted:j,withInitialFocusPlaceholder:S,...R}=n,_=Le({name:"Menu",classes:os,props:n,classNames:f,styles:v,unstyled:x}),[T,{setHovered:k,resetHovered:I}]=ag(),[E,V]=At({value:r,defaultValue:i,finalValue:!1,onChange:d}),[L,B]=b.useState(!1),M=()=>{V(!1),B(!1),E&&(a==null||a())},D=()=>{V(!0),!E&&(o==null||o())},O=()=>{E?M():D()},{openDropdown:F,closeDropdown:$}=cm({open:D,close:M,closeDelay:p,openDelay:m}),z=ie=>og("[data-menu-item]","[data-menu-dropdown]",ie),{resolvedClassNames:H,resolvedStyles:re}=wn({classNames:f,styles:v,props:n});return qa(()=>{I()},[E]),s.jsx(xm,{value:{getStyles:_,opened:E,toggleDropdown:O,getItemIndex:z,hovered:T,setHovered:k,openedViaClick:L,setOpenedViaClick:B,closeOnItemClick:c,closeDropdown:h==="click"?M:$,openDropdown:h==="click"?D:F,closeDropdownImmediately:M,loop:u,trigger:h,unstyled:x,menuItemTabIndex:C,withInitialFocusPlaceholder:S},children:s.jsx(Mt,{...R,opened:E,onChange:O,defaultOpened:i,trapFocus:j?!1:l,closeOnEscape:g,__staticSelector:"Menu",classNames:H,styles:re,unstyled:x,variant:y,keepMounted:j,children:t})})}Te.extend=e=>e;Te.withProps=su(Te);Te.classes=os;Te.displayName="@mantine/core/Menu";Te.Item=Nr;Te.Label=kr;Te.Dropdown=Rr;Te.Target=Wl;Te.Divider=Mr;const[_m,Dr]=pl(),[Mm,Rm]=pl();var jo={root:"m_7cda1cd6","root--default":"m_44da308b","root--contrast":"m_e3a01f8",label:"m_1e0e6180",remove:"m_ae386778",group:"m_1dcfd90b"};const Nm={},km=Ke((e,{gap:n},{size:t})=>({group:{"--pg-gap":n!==void 0?Ye(n):Ye(t,"pg-gap")}})),Tr=ye((e,n)=>{const t=ge("PillGroup",Nm,e),{classNames:o,className:a,style:r,styles:i,unstyled:l,vars:d,size:c,disabled:u,...g}=t,h=Dr(),m=(h==null?void 0:h.size)||c||void 0,p=Le({name:"PillGroup",classes:jo,props:t,className:a,style:r,classNames:o,styles:i,unstyled:l,vars:d,varsResolver:km,stylesCtx:{size:m},rootSelector:"group"});return s.jsx(Mm,{value:{size:m,disabled:u},children:s.jsx(K,{ref:n,size:m,...p("group"),...g})})});Tr.classes=jo;Tr.displayName="@mantine/core/PillGroup";const Dm={variant:"default"},Tm=Ke((e,{radius:n},{size:t})=>({root:{"--pill-fz":Ye(t,"pill-fz"),"--pill-height":Ye(t,"pill-height"),"--pill-radius":n===void 0?void 0:$t(n)}})),ys=ye((e,n)=>{const t=ge("Pill",Dm,e),{classNames:o,className:a,style:r,styles:i,unstyled:l,vars:d,variant:c,children:u,withRemoveButton:g,onRemove:h,removeButtonProps:m,radius:p,size:f,disabled:v,mod:x,...y}=t,w=Rm(),C=Dr(),j=f||(w==null?void 0:w.size)||void 0,S=(C==null?void 0:C.variant)==="filled"?"contrast":c||"default",R=Le({name:"Pill",classes:jo,props:t,className:a,style:r,classNames:o,styles:i,unstyled:l,vars:d,varsResolver:Tm,stylesCtx:{size:j}});return s.jsxs(K,{component:"span",ref:n,variant:S,size:j,...R("root",{variant:S}),mod:[{"with-remove":g&&!v,disabled:v||(w==null?void 0:w.disabled)},x],...y,children:[s.jsx("span",{...R("label"),children:u}),g&&s.jsx(Ya,{variant:"transparent",radius:p,tabIndex:-1,"aria-hidden":!0,unstyled:l,...m,...R("remove",{className:m==null?void 0:m.className,style:m==null?void 0:m.style}),onMouseDown:_=>{var T;_.preventDefault(),_.stopPropagation(),(T=m==null?void 0:m.onMouseDown)==null||T.call(m,_)},onClick:_=>{var T;_.stopPropagation(),h==null||h(),(T=m==null?void 0:m.onClick)==null||T.call(m,_)}})]})});ys.classes=jo;ys.displayName="@mantine/core/Pill";ys.Group=Tr;var Kl={field:"m_45c4369d"};const Im={type:"visible"},Ir=ye((e,n)=>{const t=ge("PillsInputField",Im,e),{classNames:o,className:a,style:r,styles:i,unstyled:l,vars:d,type:c,disabled:u,id:g,pointer:h,mod:m,...p}=t,f=Dr(),v=ou(),x=Le({name:"PillsInputField",classes:Kl,props:t,className:a,style:r,classNames:o,styles:i,unstyled:l,rootSelector:"field"}),y=u||(f==null?void 0:f.disabled);return s.jsx(K,{component:"input",ref:yn(n,f==null?void 0:f.fieldRef),"data-type":c,disabled:y,mod:[{disabled:y,pointer:h},m],...x("field"),...p,id:(v==null?void 0:v.inputId)||g,"aria-invalid":f==null?void 0:f.hasError,"aria-describedby":v==null?void 0:v.describedBy,type:"text",onMouseDown:w=>!h&&w.stopPropagation()})});Ir.classes=Kl;Ir.displayName="@mantine/core/PillsInputField";const Pm={},eo=ye((e,n)=>{const t=ge("PillsInput",Pm,e),{children:o,onMouseDown:a,onClick:r,size:i,disabled:l,__staticSelector:d,error:c,variant:u,...g}=t,h=b.useRef(null);return s.jsx(_m,{value:{fieldRef:h,size:i,disabled:l,hasError:!!c,variant:u},children:s.jsx(Cn,{size:i,error:c,variant:u,component:"div",ref:n,onMouseDown:m=>{var p;m.preventDefault(),a==null||a(m),(p=h.current)==null||p.focus()},onClick:m=>{var f;m.preventDefault();const p=m.currentTarget.closest("fieldset");p!=null&&p.disabled||((f=h.current)==null||f.focus(),r==null||r(m))},...g,multiline:!0,disabled:l,__staticSelector:d||"PillsInput",withAria:!1,children:o})})});eo.displayName="@mantine/core/PillsInput";eo.Field=Ir;function Fm({data:e,value:n}){const t=n.map(a=>a.trim().toLowerCase());return e.reduce((a,r)=>(Yn(r)?a.push({group:r.group,items:r.items.filter(i=>t.indexOf(i.value.toLowerCase().trim())===-1)}):t.indexOf(r.value.toLowerCase().trim())===-1&&a.push(r),a),[])}const Em={maxValues:1/0,withCheckIcon:!0,checkIconPosition:"left",hiddenInputValuesDivider:","},So=ye((e,n)=>{const t=ge("MultiSelect",Em,e),{classNames:o,className:a,style:r,styles:i,unstyled:l,vars:d,size:c,value:u,defaultValue:g,onChange:h,onKeyDown:m,variant:p,data:f,dropdownOpened:v,defaultDropdownOpened:x,onDropdownOpen:y,onDropdownClose:w,selectFirstOptionOnChange:C,onOptionSubmit:j,comboboxProps:S,filter:R,limit:_,withScrollArea:T,maxDropdownHeight:k,searchValue:I,defaultSearchValue:E,onSearchChange:V,readOnly:L,disabled:B,onFocus:M,onBlur:D,radius:O,rightSection:F,rightSectionWidth:$,rightSectionPointerEvents:z,rightSectionProps:H,leftSection:re,leftSectionWidth:ie,leftSectionPointerEvents:X,leftSectionProps:oe,inputContainer:ne,inputWrapperOrder:J,withAsterisk:P,labelProps:Q,descriptionProps:ce,errorProps:te,wrapperProps:W,description:me,label:le,error:de,maxValues:Y,searchable:A,nothingFoundMessage:se,withCheckIcon:be,checkIconPosition:ve,hidePickedOptions:Se,withErrorStyles:we,name:U,form:G,id:ae,clearable:Fe,clearButtonProps:pe,hiddenInputProps:Z,placeholder:_e,hiddenInputValuesDivider:Ae,required:Qe,mod:nt,renderOption:et,onRemove:ee,onClear:q,scrollAreaProps:Re,chevronColor:He,...st}=t,rt=js(ae),nn=rr(f),Dt=wo(nn),qe=Co({opened:v,defaultOpened:x,onDropdownOpen:y,onDropdownClose:()=>{w==null||w(),qe.resetSelectedOption()}}),{styleProps:is,rest:{type:Is,autoComplete:ls,...Je}}=au(st),[xe,dn]=At({value:u,defaultValue:g,finalValue:[],onChange:h}),[Ze,it]=At({value:I,defaultValue:E,finalValue:"",onChange:V}),dt=Xe=>{it(Xe),qe.resetSelectedOption()},Gt=Le({name:"MultiSelect",classes:{},props:t,classNames:o,styles:i,unstyled:l}),{resolvedClassNames:qt,resolvedStyles:Vn}=wn({props:t,styles:i,classNames:o}),Bd=Xe=>{m==null||m(Xe),Xe.key===" "&&!A&&(Xe.preventDefault(),qe.toggleDropdown()),Xe.key==="Backspace"&&Ze.length===0&&xe.length>0&&(ee==null||ee(xe[xe.length-1]),dn(xe.slice(0,xe.length-1)))},Ud=xe.map((Xe,Xo)=>{var gi,mi;return s.jsx(ys,{withRemoveButton:!L&&!((gi=Dt[Xe])!=null&&gi.disabled),onRemove:()=>{dn(xe.filter(Gd=>Xe!==Gd)),ee==null||ee(Xe)},unstyled:l,disabled:B,...Gt("pill"),children:((mi=Dt[Xe])==null?void 0:mi.label)||Xe},`${Xe}-${Xo}`)});b.useEffect(()=>{C&&qe.selectFirstOption()},[C,Ze]);const di=s.jsx($e.ClearButton,{...pe,onClear:()=>{q==null||q(),dn([]),dt("")}}),Hd=Fm({data:nn,value:xe}),ui=Fe&&xe.length>0&&!B&&!L;return s.jsxs(s.Fragment,{children:[s.jsxs($e,{store:qe,classNames:qt,styles:Vn,unstyled:l,size:c,readOnly:L,__staticSelector:"MultiSelect",onOptionSubmit:Xe=>{j==null||j(Xe),dt(""),qe.updateSelectedOptionIndex("selected"),xe.includes(Dt[Xe].value)?(dn(xe.filter(Xo=>Xo!==Dt[Xe].value)),ee==null||ee(Dt[Xe].value)):xe.length<Y&&dn([...xe,Dt[Xe].value])},...S,children:[s.jsx($e.DropdownTarget,{children:s.jsx(eo,{...is,__staticSelector:"MultiSelect",classNames:qt,styles:Vn,unstyled:l,size:c,className:a,style:r,variant:p,disabled:B,radius:O,__defaultRightSection:s.jsx($e.Chevron,{size:c,error:de,unstyled:l,color:He}),__clearSection:di,__clearable:ui,rightSection:F,rightSectionPointerEvents:z||(di?"all":"none"),rightSectionWidth:$,rightSectionProps:H,leftSection:re,leftSectionWidth:ie,leftSectionPointerEvents:X,leftSectionProps:oe,inputContainer:ne,inputWrapperOrder:J,withAsterisk:P,labelProps:Q,descriptionProps:ce,errorProps:te,wrapperProps:W,description:me,label:le,error:de,withErrorStyles:we,__stylesApiProps:{...t,rightSectionPointerEvents:z||(ui?"all":"none"),multiline:!0},pointer:!A,onClick:()=>A?qe.openDropdown():qe.toggleDropdown(),"data-expanded":qe.dropdownOpened||void 0,id:rt,required:Qe,mod:nt,children:s.jsxs(ys.Group,{disabled:B,unstyled:l,...Gt("pillsList"),children:[Ud,s.jsx($e.EventsTarget,{autoComplete:ls,children:s.jsx(eo.Field,{...Je,ref:n,id:rt,placeholder:_e,type:!A&&!_e?"hidden":"visible",...Gt("inputField"),unstyled:l,onFocus:Xe=>{M==null||M(Xe),A&&qe.openDropdown()},onBlur:Xe=>{D==null||D(Xe),qe.closeDropdown(),dt("")},onKeyDown:Bd,value:Ze,onChange:Xe=>{dt(Xe.currentTarget.value),A&&qe.openDropdown(),C&&qe.selectFirstOption()},disabled:B,readOnly:L||!A,pointer:!A})})]})})}),s.jsx(vr,{data:Se?Hd:nn,hidden:L||B,filter:R,search:Ze,limit:_,hiddenWhenEmpty:!se,withScrollArea:T,maxDropdownHeight:k,filterOptions:A,value:xe,checkIconPosition:ve,withCheckIcon:be,nothingFoundMessage:se,unstyled:l,labelId:le?`${rt}-label`:void 0,"aria-label":le?void 0:st["aria-label"],renderOption:et,scrollAreaProps:Re})]}),s.jsx($e.HiddenInput,{name:U,valuesDivider:Ae,value:xe,form:G,disabled:B,...Z})]})});So.classes={...Cn.classes,...$e.classes};So.displayName="@mantine/core/MultiSelect";function Yl(e,n){var t={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&n.indexOf(o)<0&&(t[o]=e[o]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var a=0,o=Object.getOwnPropertySymbols(e);a<o.length;a++)n.indexOf(o[a])<0&&Object.prototype.propertyIsEnumerable.call(e,o[a])&&(t[o[a]]=e[o[a]]);return t}var Qn;(function(e){e.event="event",e.props="prop"})(Qn||(Qn={}));function hn(){}function Om(e){var n,t=void 0;return function(){for(var o=[],a=arguments.length;a--;)o[a]=arguments[a];return n&&o.length===n.length&&o.every(function(r,i){return r===n[i]})||(n=o,t=e.apply(void 0,o)),t}}function ws(e){return!!(e||"").match(/\d/)}function pn(e){return e==null}function Am(e){return typeof e=="number"&&isNaN(e)}function Ql(e){return pn(e)||Am(e)||typeof e=="number"&&!isFinite(e)}function Xl(e){return e.replace(/[-[\]/{}()*+?.\\^$|]/g,"\\$&")}function zm(e){switch(e){case"lakh":return/(\d+?)(?=(\d\d)+(\d)(?!\d))(\.\d+)?/g;case"wan":return/(\d)(?=(\d{4})+(?!\d))/g;case"thousand":default:return/(\d)(?=(\d{3})+(?!\d))/g}}function $m(e,n,t){var o=zm(t),a=e.search(/[1-9]/);return a=a===-1?e.length:a,e.substring(0,a)+e.substring(a,e.length).replace(o,"$1"+n)}function Ri(e){var n=b.useRef(e);n.current=e;var t=b.useRef(function(){for(var o=[],a=arguments.length;a--;)o[a]=arguments[a];return n.current.apply(n,o)});return t.current}function Pr(e,n){n===void 0&&(n=!0);var t=e[0]==="-",o=t&&n;e=e.replace("-","");var a=e.split("."),r=a[0],i=a[1]||"";return{beforeDecimal:r,afterDecimal:i,hasNegation:t,addNegation:o}}function Lm(e){if(!e)return e;var n=e[0]==="-";n&&(e=e.substring(1,e.length));var t=e.split("."),o=t[0].replace(/^0+/,"")||"0",a=t[1]||"";return(n?"-":"")+o+(a?"."+a:"")}function Zl(e,n,t){for(var o="",a=t?"0":"",r=0;r<=n-1;r++)o+=e[r]||a;return o}function Ni(e,n){return Array(n+1).join(e)}function Jl(e){var n=e+"",t=n[0]==="-"?"-":"";t&&(n=n.substring(1));var o=n.split(/[eE]/g),a=o[0],r=o[1];if(r=Number(r),!r)return t+a;a=a.replace(".","");var i=1+r,l=a.length;return i<0?a="0."+Ni("0",Math.abs(i))+a:i>=l?a=a+Ni("0",i-l):a=(a.substring(0,i)||"0")+"."+a.substring(i),t+a}function ki(e,n,t){if(["","-"].indexOf(e)!==-1)return e;var o=(e.indexOf(".")!==-1||t)&&n,a=Pr(e),r=a.beforeDecimal,i=a.afterDecimal,l=a.hasNegation,d=parseFloat("0."+(i||"0")),c=i.length<=n?"0."+i:d.toFixed(n),u=c.split("."),g=r;r&&Number(u[0])&&(g=r.split("").reverse().reduce(function(f,v,x){return f.length>x?(Number(f[0])+Number(v)).toString()+f.substring(1,f.length):v+f},u[0]));var h=Zl(u[1]||"",n,t),m=l?"-":"",p=o?".":"";return""+m+g+p+h}function Rn(e,n){if(e.value=e.value,e!==null){if(e.createTextRange){var t=e.createTextRange();return t.move("character",n),t.select(),!0}return e.selectionStart||e.selectionStart===0?(e.focus(),e.setSelectionRange(n,n),!0):(e.focus(),!1)}}var ec=Om(function(e,n){for(var t=0,o=0,a=e.length,r=n.length;e[t]===n[t]&&t<a;)t++;for(;e[a-1-o]===n[r-1-o]&&r-o>t&&a-o>t;)o++;return{from:{start:t,end:a-o},to:{start:t,end:r-o}}}),Vm=function(e,n){var t=Math.min(e.selectionStart,n);return{from:{start:t,end:e.selectionEnd},to:{start:t,end:n}}};function Bm(e,n,t){return Math.min(Math.max(e,n),t)}function ta(e){return Math.max(e.selectionStart,e.selectionEnd)}function Um(){return typeof navigator<"u"&&!(navigator.platform&&/iPhone|iPod/.test(navigator.platform))}function Hm(e){return{from:{start:0,end:0},to:{start:0,end:e.length},lastValue:""}}function Gm(e){var n=e.currentValue,t=e.formattedValue,o=e.currentValueIndex,a=e.formattedValueIndex;return n[o]===t[a]}function qm(e,n,t,o,a,r,i){i===void 0&&(i=Gm);var l=a.findIndex(function(C){return C}),d=e.slice(0,l);!n&&!t.startsWith(d)&&(n=d,t=d+t,o=o+d.length);for(var c=t.length,u=e.length,g={},h=new Array(c),m=0;m<c;m++){h[m]=-1;for(var p=0,f=u;p<f;p++){var v=i({currentValue:t,lastValue:n,formattedValue:e,currentValueIndex:m,formattedValueIndex:p});if(v&&g[p]!==!0){h[m]=p,g[p]=!0;break}}}for(var x=o;x<c&&(h[x]===-1||!r(t[x]));)x++;var y=x===c||h[x]===-1?u:h[x];for(x=o-1;x>0&&h[x]===-1;)x--;var w=x===-1||h[x]===-1?0:h[x]+1;return w>y?y:o-w<y-o?w:y}function Di(e,n,t,o){var a=e.length;if(n=Bm(n,0,a),o==="left"){for(;n>=0&&!t[n];)n--;n===-1&&(n=t.indexOf(!0))}else{for(;n<=a&&!t[n];)n++;n>a&&(n=t.lastIndexOf(!0))}return n===-1&&(n=a),n}function Wm(e){for(var n=Array.from({length:e.length+1}).map(function(){return!0}),t=0,o=n.length;t<o;t++)n[t]=!!(ws(e[t])||ws(e[t-1]));return n}function tc(e,n,t,o,a,r){r===void 0&&(r=hn);var i=Ri(function(p,f){var v,x;return Ql(p)?(x="",v=""):typeof p=="number"||f?(x=typeof p=="number"?Jl(p):p,v=o(x)):(x=a(p,void 0),v=o(x)),{formattedValue:v,numAsString:x}}),l=b.useState(function(){return i(pn(e)?n:e,t)}),d=l[0],c=l[1],u=Ri(function(p,f){p.formattedValue!==d.formattedValue&&c({formattedValue:p.formattedValue,numAsString:p.value}),r(p,f)}),g=e,h=t;pn(e)&&(g=d.numAsString,h=!0);var m=i(g,h);return b.useMemo(function(){c(m)},[m.formattedValue]),b.useEffect(function(){if(!pn(n)&&pn(e)&&d.formattedValue!==""){var p=parseFloat(d.numAsString);u({formattedValue:d.formattedValue,value:d.numAsString,floatValue:isNaN(p)?void 0:p},{event:void 0,source:Qn.props})}},[]),[d,u]}function Km(e){return e.replace(/[^0-9]/g,"")}function Ym(e){return e}function Qm(e){var n=e.type;n===void 0&&(n="text");var t=e.displayType;t===void 0&&(t="input");var o=e.customInput,a=e.renderText,r=e.getInputRef,i=e.format;i===void 0&&(i=Ym);var l=e.removeFormatting;l===void 0&&(l=Km);var d=e.defaultValue,c=e.valueIsNumericString,u=e.onValueChange,g=e.isAllowed,h=e.onChange;h===void 0&&(h=hn);var m=e.onKeyDown;m===void 0&&(m=hn);var p=e.onMouseUp;p===void 0&&(p=hn);var f=e.onFocus;f===void 0&&(f=hn);var v=e.onBlur;v===void 0&&(v=hn);var x=e.value,y=e.getCaretBoundary;y===void 0&&(y=Wm);var w=e.isValidInputCharacter;w===void 0&&(w=ws);var C=e.isCharacterSame,j=Yl(e,["type","displayType","customInput","renderText","getInputRef","format","removeFormatting","defaultValue","valueIsNumericString","onValueChange","isAllowed","onChange","onKeyDown","onMouseUp","onFocus","onBlur","value","getCaretBoundary","isValidInputCharacter","isCharacterSame"]),S=tc(x,d,!!c,i,l,u),R=S[0],_=R.formattedValue,T=R.numAsString,k=S[1],I=b.useRef(),E=b.useRef({formattedValue:_,numAsString:T}),V=function(Y,A){E.current={formattedValue:Y.formattedValue,numAsString:Y.value},k(Y,A)},L=b.useState(!1),B=L[0],M=L[1],D=b.useRef(null),O=b.useRef({setCaretTimeout:null,focusTimeout:null});b.useEffect(function(){return M(!0),function(){clearTimeout(O.current.setCaretTimeout),clearTimeout(O.current.focusTimeout)}},[]);var F=i,$=function(Y,A){var se=parseFloat(A);return{formattedValue:Y,value:A,floatValue:isNaN(se)?void 0:se}},z=function(Y,A,se){Y.selectionStart===0&&Y.selectionEnd===Y.value.length||(Rn(Y,A),O.current.setCaretTimeout=setTimeout(function(){Y.value===se&&Y.selectionStart!==A&&Rn(Y,A)},0))},H=function(Y,A,se){return Di(Y,A,y(Y),se)},re=function(Y,A,se){var be=y(A),ve=qm(A,_,Y,se,be,w,C);return ve=Di(A,ve,be),ve},ie=function(Y){var A=Y.formattedValue;A===void 0&&(A="");var se=Y.input,be=Y.source,ve=Y.event,Se=Y.numAsString,we;if(se){var U=Y.inputValue||se.value,G=ta(se);se.value=A,we=re(U,A,G),we!==void 0&&z(se,we,A)}A!==_&&V($(A,Se),{event:ve,source:be})};b.useEffect(function(){var Y=E.current,A=Y.formattedValue,se=Y.numAsString;(_!==A||T!==se)&&V($(_,T),{event:void 0,source:Qn.props})},[_,T]);var X=D.current?ta(D.current):void 0,oe=typeof window<"u"?b.useLayoutEffect:b.useEffect;oe(function(){var Y=D.current;if(_!==E.current.formattedValue&&Y){var A=re(E.current.formattedValue,_,X);Y.value=_,z(Y,A,_)}},[_]);var ne=function(Y,A,se){var be=A.target,ve=I.current?Vm(I.current,be.selectionEnd):ec(_,Y),Se=Object.assign(Object.assign({},ve),{lastValue:_}),we=l(Y,Se),U=F(we);if(we=l(U,void 0),g&&!g($(U,we))){var G=A.target,ae=ta(G),Fe=re(Y,_,ae);return G.value=_,z(G,Fe,_),!1}return ie({formattedValue:U,numAsString:we,inputValue:Y,event:A,source:se,input:A.target}),!0},J=function(Y,A){A===void 0&&(A=0);var se=Y.selectionStart,be=Y.selectionEnd;I.current={selectionStart:se,selectionEnd:be+A}},P=function(Y){var A=Y.target,se=A.value,be=ne(se,Y,Qn.event);be&&h(Y),I.current=void 0},Q=function(Y){var A=Y.target,se=Y.key,be=A.selectionStart,ve=A.selectionEnd,Se=A.value;Se===void 0&&(Se="");var we;se==="ArrowLeft"||se==="Backspace"?we=Math.max(be-1,0):se==="ArrowRight"?we=Math.min(be+1,Se.length):se==="Delete"&&(we=be);var U=0;se==="Delete"&&be===ve&&(U=1);var G=se==="ArrowLeft"||se==="ArrowRight";if(we===void 0||be!==ve&&!G){m(Y),J(A,U);return}var ae=we;if(G){var Fe=se==="ArrowLeft"?"left":"right";ae=H(Se,we,Fe),ae!==we&&Y.preventDefault()}else se==="Delete"&&!w(Se[we])?ae=H(Se,we,"right"):se==="Backspace"&&!w(Se[we])&&(ae=H(Se,we,"left"));ae!==we&&z(A,ae,Se),m(Y),J(A,U)},ce=function(Y){var A=Y.target,se=function(){var be=A.selectionStart,ve=A.selectionEnd,Se=A.value;if(Se===void 0&&(Se=""),be===ve){var we=H(Se,be);we!==be&&z(A,we,Se)}};se(),requestAnimationFrame(function(){se()}),p(Y),J(A)},te=function(Y){Y.persist&&Y.persist();var A=Y.target,se=Y.currentTarget;D.current=A,O.current.focusTimeout=setTimeout(function(){var be=A.selectionStart,ve=A.selectionEnd,Se=A.value;Se===void 0&&(Se="");var we=H(Se,be);we!==be&&!(be===0&&ve===Se.length)&&z(A,we,Se),f(Object.assign(Object.assign({},Y),{currentTarget:se}))},0)},W=function(Y){D.current=null,clearTimeout(O.current.focusTimeout),clearTimeout(O.current.setCaretTimeout),v(Y)},me=B&&Um()?"numeric":void 0,le=Object.assign({inputMode:me},j,{type:n,value:_,onChange:P,onKeyDown:Q,onMouseUp:ce,onFocus:te,onBlur:W});if(t==="text")return a?Mn.createElement(Mn.Fragment,null,a(_,j)||null):Mn.createElement("span",Object.assign({},j,{ref:r}),_);if(o){var de=o;return Mn.createElement(de,Object.assign({},le,{ref:r}))}return Mn.createElement("input",Object.assign({},le,{ref:r}))}function Ti(e,n){var t=n.decimalScale,o=n.fixedDecimalScale,a=n.prefix;a===void 0&&(a="");var r=n.suffix;r===void 0&&(r="");var i=n.allowNegative,l=n.thousandsGroupStyle;if(l===void 0&&(l="thousand"),e===""||e==="-")return e;var d=_o(n),c=d.thousandSeparator,u=d.decimalSeparator,g=t!==0&&e.indexOf(".")!==-1||t&&o,h=Pr(e,i),m=h.beforeDecimal,p=h.afterDecimal,f=h.addNegation;return t!==void 0&&(p=Zl(p,t,!!o)),c&&(m=$m(m,c,l)),a&&(m=a+m),r&&(p=p+r),f&&(m="-"+m),e=m+(g&&u||"")+p,e}function _o(e){var n=e.decimalSeparator;n===void 0&&(n=".");var t=e.thousandSeparator,o=e.allowedDecimalSeparators;return t===!0&&(t=","),o||(o=[n,"."]),{decimalSeparator:n,thousandSeparator:t,allowedDecimalSeparators:o}}function Xm(e,n){e===void 0&&(e="");var t=new RegExp("(-)"),o=new RegExp("(-)(.)*(-)"),a=t.test(e),r=o.test(e);return e=e.replace(/-/g,""),a&&!r&&n&&(e="-"+e),e}function Zm(e,n){return new RegExp("(^-)|[0-9]|"+Xl(e),"g")}function Jm(e,n,t){return e===""?!0:!(n!=null&&n.match(/\d/))&&!(t!=null&&t.match(/\d/))&&typeof e=="string"&&!isNaN(Number(e))}function eh(e,n,t){var o;n===void 0&&(n=Hm(e));var a=t.allowNegative,r=t.prefix;r===void 0&&(r="");var i=t.suffix;i===void 0&&(i="");var l=t.decimalScale,d=n.from,c=n.to,u=c.start,g=c.end,h=_o(t),m=h.allowedDecimalSeparators,p=h.decimalSeparator,f=e[g]===p;if(ws(e)&&(e===r||e===i)&&n.lastValue==="")return e;if(g-u===1&&m.indexOf(e[u])!==-1){var v=l===0?"":p;e=e.substring(0,u)+v+e.substring(u+1,e.length)}var x=function(D,O,F){var $=!1,z=!1;r.startsWith("-")?$=!1:D.startsWith("--")?($=!1,z=!0):i.startsWith("-")&&D.length===i.length?$=!1:D[0]==="-"&&($=!0);var H=$?1:0;return z&&(H=2),H&&(D=D.substring(H),O-=H,F-=H),{value:D,start:O,end:F,hasNegation:$}},y=x(e,u,g),w=y.hasNegation;o=y,e=o.value,u=o.start,g=o.end;var C=x(n.lastValue,d.start,d.end),j=C.start,S=C.end,R=C.value,_=e.substring(u,g);e.length&&R.length&&(j>R.length-i.length||S<r.length)&&!(_&&i.startsWith(_))&&(e=R);var T=0;e.startsWith(r)?T+=r.length:u<r.length&&(T=u),e=e.substring(T),g-=T;var k=e.length,I=e.length-i.length;e.endsWith(i)?k=I:(g>I||g>e.length-i.length)&&(k=g),e=e.substring(0,k),e=Xm(w?"-"+e:e,a),e=(e.match(Zm(p))||[]).join("");var E=e.indexOf(p);e=e.replace(new RegExp(Xl(p),"g"),function(D,O){return O===E?".":""});var V=Pr(e,a),L=V.beforeDecimal,B=V.afterDecimal,M=V.addNegation;return c.end-c.start<d.end-d.start&&L===""&&f&&!parseFloat(B)&&(e=M?"-":""),e}function th(e,n){var t=n.prefix;t===void 0&&(t="");var o=n.suffix;o===void 0&&(o="");var a=Array.from({length:e.length+1}).map(function(){return!0}),r=e[0]==="-";a.fill(!1,0,Math.min(t.length+(r?1:0),e.length));var i=e.length;return a.fill(!1,i-o.length+1,i+1),a}function nh(e){var n=_o(e),t=n.thousandSeparator,o=n.decimalSeparator,a=e.prefix;a===void 0&&(a="");var r=e.allowNegative;if(r===void 0&&(r=!0),t===o)throw new Error(`
|
||
Decimal separator can't be same as thousand separator.
|
||
thousandSeparator: `+t+` (thousandSeparator = {true} is same as thousandSeparator = ",")
|
||
decimalSeparator: `+o+` (default value for decimalSeparator is .)
|
||
`);return a.startsWith("-")&&r&&(r=!1),Object.assign(Object.assign({},e),{allowNegative:r})}function sh(e){e=nh(e),e.decimalSeparator,e.allowedDecimalSeparators,e.thousandsGroupStyle;var n=e.suffix,t=e.allowNegative,o=e.allowLeadingZeros,a=e.onKeyDown;a===void 0&&(a=hn);var r=e.onBlur;r===void 0&&(r=hn);var i=e.thousandSeparator,l=e.decimalScale,d=e.fixedDecimalScale,c=e.prefix;c===void 0&&(c="");var u=e.defaultValue,g=e.value,h=e.valueIsNumericString,m=e.onValueChange,p=Yl(e,["decimalSeparator","allowedDecimalSeparators","thousandsGroupStyle","suffix","allowNegative","allowLeadingZeros","onKeyDown","onBlur","thousandSeparator","decimalScale","fixedDecimalScale","prefix","defaultValue","value","valueIsNumericString","onValueChange"]),f=_o(e),v=f.decimalSeparator,x=f.allowedDecimalSeparators,y=function(M){return Ti(M,e)},w=function(M,D){return eh(M,D,e)},C=pn(g)?u:g,j=h??Jm(C,c,n);pn(g)?pn(u)||(j=j||typeof u=="number"):j=j||typeof g=="number";var S=function(M){return Ql(M)?M:(typeof M=="number"&&(M=Jl(M)),j&&typeof l=="number"?ki(M,l,!!d):M)},R=tc(S(g),S(u),!!j,y,w,m),_=R[0],T=_.numAsString,k=_.formattedValue,I=R[1],E=function(M){var D=M.target,O=M.key,F=D.selectionStart,$=D.selectionEnd,z=D.value;if(z===void 0&&(z=""),(O==="Backspace"||O==="Delete")&&$<c.length&&z!=="-"){M.preventDefault();return}if(F!==$){a(M);return}O==="Backspace"&&z[0]==="-"&&F===c.length+1&&t&&Rn(D,1),l&&d&&(O==="Backspace"&&z[F-1]===v?(Rn(D,F-1),M.preventDefault()):O==="Delete"&&z[F]===v&&M.preventDefault()),x!=null&&x.includes(O)&&z[F]===v&&Rn(D,F+1);var H=i===!0?",":i;O==="Backspace"&&z[F-1]===H&&Rn(D,F-1),O==="Delete"&&z[F]===H&&Rn(D,F+1),a(M)},V=function(M){var D=T;if(D.match(/\d/g)||(D=""),o||(D=Lm(D)),d&&l&&(D=ki(D,l,d)),D!==T){var O=Ti(D,e);I({formattedValue:O,value:D,floatValue:parseFloat(D)},{event:M,source:Qn.event})}r(M)},L=function(M){return M===v?!0:ws(M)},B=function(M){var D=M.currentValue,O=M.lastValue,F=M.formattedValue,$=M.currentValueIndex,z=M.formattedValueIndex,H=D[$],re=F[z],ie=ec(O,D),X=ie.to,oe=function(ne){return w(ne).indexOf(".")+c.length};return g===0&&d&&l&&D[X.start]===v&&oe(D)<$&&oe(F)>z?!1:$>=X.start&&$<X.end&&x&&x.includes(H)&&re===v?!0:H===re};return Object.assign(Object.assign({},p),{value:k,valueIsNumericString:!1,isValidInputCharacter:L,isCharacterSame:B,onValueChange:I,format:y,removeFormatting:w,getCaretBoundary:function(M){return th(M,e)},onKeyDown:E,onBlur:V})}function oh(e){var n=sh(e);return Mn.createElement(Qm,Object.assign({},n))}function Ii({direction:e,style:n,...t}){return s.jsx("svg",{style:{width:"var(--ni-chevron-size)",height:"var(--ni-chevron-size)",transform:e==="up"?"rotate(180deg)":void 0,...n},viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t,children:s.jsx("path",{d:"M3.13523 6.15803C3.3241 5.95657 3.64052 5.94637 3.84197 6.13523L7.5 9.56464L11.158 6.13523C11.3595 5.94637 11.6759 5.95657 11.8648 6.15803C12.0536 6.35949 12.0434 6.67591 11.842 6.86477L7.84197 10.6148C7.64964 10.7951 7.35036 10.7951 7.15803 10.6148L3.15803 6.86477C2.95657 6.67591 2.94637 6.35949 3.13523 6.15803Z",fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd"})})}var Da={root:"m_e2f5cd4e",controls:"m_95e17d22",control:"m_80b4b171"};const ah=/^(0\.0*|-0(\.0*)?)$/,rh=/^-?0\d+(\.\d+)?\.?$/;function Ta(e){return typeof e=="string"&&e!==""&&!Number.isNaN(Number(e))}function na(e){return typeof e=="number"?e<Number.MAX_SAFE_INTEGER:e===""||Ta(e)&&Number(e)<Number.MAX_SAFE_INTEGER}function ih(e){return e.toString().replace(".","").length}function lh(e,n){return(typeof e=="number"?e<Number.MAX_SAFE_INTEGER:!Number.isNaN(Number(e)))&&!Number.isNaN(e)&&ih(n)<14&&n!==""}function Pi(e,n,t){if(e===void 0)return!0;const o=n===void 0||e>=n,a=t===void 0||e<=t;return o&&a}const ch={step:1,clampBehavior:"blur",allowDecimal:!0,allowNegative:!0,withKeyboardEvents:!0,allowLeadingZeros:!0,trimLeadingZeroesOnBlur:!0,startValue:0},dh=Ke((e,{size:n})=>({controls:{"--ni-chevron-size":Ye(n,"ni-chevron-size")}}));function uh(e,n,t){const o=e.toString().replace(/^0+/,""),a=parseFloat(o);return Number.isNaN(a)?o:a>Number.MAX_SAFE_INTEGER?n!==void 0?String(n):o:Dn(a,t,n)}const Fr=ye((e,n)=>{const t=ge("NumberInput",ch,e),{className:o,classNames:a,styles:r,unstyled:i,vars:l,onChange:d,onValueChange:c,value:u,defaultValue:g,max:h,min:m,step:p,hideControls:f,rightSection:v,isAllowed:x,clampBehavior:y,onBlur:w,allowDecimal:C,decimalScale:j,onKeyDown:S,onKeyDownCapture:R,handlersRef:_,startValue:T,disabled:k,rightSectionPointerEvents:I,allowNegative:E,readOnly:V,size:L,rightSectionWidth:B,stepHoldInterval:M,stepHoldDelay:D,allowLeadingZeros:O,withKeyboardEvents:F,trimLeadingZeroesOnBlur:$,...z}=t,H=Le({name:"NumberInput",classes:Da,props:t,classNames:a,styles:r,unstyled:i,vars:l,varsResolver:dh}),{resolvedClassNames:re,resolvedStyles:ie}=wn({classNames:a,styles:r,props:t}),[X,oe]=At({value:u,defaultValue:g,finalValue:"",onChange:d}),ne=D!==void 0&&M!==void 0,J=b.useRef(null),P=b.useRef(null),Q=b.useRef(0),ce=(U,G)=>{G.source==="event"&&oe(lh(U.floatValue,U.value)&&!ah.test(U.value)&&!(O&&rh.test(U.value))?U.floatValue:U.value),c==null||c(U,G)},te=U=>{const G=String(U).match(/(?:\.(\d+))?(?:[eE]([+-]?\d+))?$/);return G?Math.max(0,(G[1]?G[1].length:0)-(G[2]?+G[2]:0)):0},W=U=>{J.current&&typeof U<"u"&&J.current.setSelectionRange(U,U)},me=b.useRef(fi);me.current=()=>{if(!na(X))return;let U;const G=te(X),ae=te(p),Fe=Math.max(G,ae),pe=10**Fe;if(!Ta(X)&&(typeof X!="number"||Number.isNaN(X)))U=Dn(T,m,h);else if(h!==void 0){const _e=(Math.round(Number(X)*pe)+Math.round(p*pe))/pe;U=_e<=h?_e:h}else U=(Math.round(Number(X)*pe)+Math.round(p*pe))/pe;const Z=U.toFixed(Fe);oe(parseFloat(Z)),c==null||c({floatValue:parseFloat(Z),formattedValue:Z,value:Z},{source:"increment"}),setTimeout(()=>{var _e;return W((_e=J.current)==null?void 0:_e.value.length)},0)};const le=b.useRef(fi);le.current=()=>{if(!na(X))return;let U;const G=m!==void 0?m:E?Number.MIN_SAFE_INTEGER:0,ae=te(X),Fe=te(p),pe=Math.max(ae,Fe),Z=10**pe;if(!Ta(X)&&typeof X!="number"||Number.isNaN(X))U=Dn(T,G,h);else{const Ae=(Math.round(Number(X)*Z)-Math.round(p*Z))/Z;U=G!==void 0&&Ae<G?G:Ae}const _e=U.toFixed(pe);oe(parseFloat(_e)),c==null||c({floatValue:parseFloat(_e),formattedValue:_e,value:_e},{source:"decrement"}),setTimeout(()=>{var Ae;return W((Ae=J.current)==null?void 0:Ae.value.length)},0)};const de=U=>{S==null||S(U),!(V||!F)&&(U.key==="ArrowUp"&&(U.preventDefault(),me.current()),U.key==="ArrowDown"&&(U.preventDefault(),le.current()))},Y=U=>{if(R==null||R(U),U.key==="Backspace"){const G=J.current;G.selectionStart===0&&G.selectionStart===G.selectionEnd&&(U.preventDefault(),window.setTimeout(()=>W(0),0))}},A=U=>{let G=X;y==="blur"&&typeof G=="number"&&(G=Dn(G,m,h)),$&&typeof G=="string"&&te(G)<15&&(G=uh(G,h,m)),X!==G&&oe(G),w==null||w(U)};ru(_,{increment:me.current,decrement:le.current});const se=U=>{U?me.current():le.current(),Q.current+=1},be=U=>{if(se(U),ne){const G=typeof M=="number"?M:M(Q.current);P.current=window.setTimeout(()=>be(U),G)}},ve=(U,G)=>{var ae;U.preventDefault(),(ae=J.current)==null||ae.focus(),se(G),ne&&(P.current=window.setTimeout(()=>be(G),D))},Se=()=>{P.current&&window.clearTimeout(P.current),P.current=null,Q.current=0},we=s.jsxs("div",{...H("controls"),children:[s.jsx(Pt,{...H("control"),tabIndex:-1,"aria-hidden":!0,disabled:k||typeof X=="number"&&h!==void 0&&X>=h,mod:{direction:"up"},onMouseDown:U=>U.preventDefault(),onPointerDown:U=>{ve(U,!0)},onPointerUp:Se,onPointerLeave:Se,children:s.jsx(Ii,{direction:"up"})}),s.jsx(Pt,{...H("control"),tabIndex:-1,"aria-hidden":!0,disabled:k||typeof X=="number"&&m!==void 0&&X<=m,mod:{direction:"down"},onMouseDown:U=>U.preventDefault(),onPointerDown:U=>{ve(U,!1)},onPointerUp:Se,onPointerLeave:Se,children:s.jsx(Ii,{direction:"down"})})]});return s.jsx(Cn,{component:oh,allowNegative:E,className:Ce(Da.root,o),size:L,...z,readOnly:V,disabled:k,value:X,getInputRef:yn(n,J),onValueChange:ce,rightSection:f||V||!na(X)?v:v||we,classNames:re,styles:ie,unstyled:i,__staticSelector:"NumberInput",decimalScale:C?j:0,onKeyDown:de,onKeyDownCapture:Y,rightSectionPointerEvents:I??(k?"none":void 0),rightSectionWidth:B??`var(--ni-right-section-width-${L||"sm"})`,allowLeadingZeros:O,onBlur:A,isAllowed:U=>y==="strict"?x?x(U)&&Pi(U.floatValue,m,h):Pi(U.floatValue,m,h):x?x(U):!0})});Fr.classes={...Cn.classes,...Da};Fr.displayName="@mantine/core/NumberInput";const[gh,Mo]=es("Pagination.Root component was not found in tree");var Ms={root:"m_4addd315",control:"m_326d024a",dots:"m_4ad7767d"};const mh={withPadding:!0},Rs=ye((e,n)=>{const t=ge("PaginationControl",mh,e),{classNames:o,className:a,style:r,styles:i,vars:l,active:d,disabled:c,withPadding:u,mod:g,...h}=t,m=Mo(),p=c||m.disabled;return s.jsx(Pt,{ref:n,disabled:p,mod:[{active:d,disabled:p,"with-padding":u},g],...m.getStyles("control",{className:a,style:r,classNames:o,styles:i,active:!p}),...h})});Rs.classes=Ms;Rs.displayName="@mantine/core/PaginationControl";function Ns({style:e,children:n,path:t,...o}){return s.jsx("svg",{viewBox:"0 0 16 16",xmlns:"http://www.w3.org/2000/svg",style:{width:"calc(var(--pagination-control-size) / 1.8)",height:"calc(var(--pagination-control-size) / 1.8)",...e},...o,children:s.jsx("path",{d:t,fill:"currentColor"})})}const hh=e=>s.jsx(Ns,{...e,path:"M8.781 8l-3.3-3.3.943-.943L10.667 8l-4.243 4.243-.943-.943 3.3-3.3z"}),ph=e=>s.jsx(Ns,{...e,path:"M7.219 8l3.3 3.3-.943.943L5.333 8l4.243-4.243.943.943-3.3 3.3z"}),fh=e=>s.jsx(Ns,{...e,path:"M6.85355 3.85355C7.04882 3.65829 7.04882 3.34171 6.85355 3.14645C6.65829 2.95118 6.34171 2.95118 6.14645 3.14645L2.14645 7.14645C1.95118 7.34171 1.95118 7.65829 2.14645 7.85355L6.14645 11.8536C6.34171 12.0488 6.65829 12.0488 6.85355 11.8536C7.04882 11.6583 7.04882 11.3417 6.85355 11.1464L3.20711 7.5L6.85355 3.85355ZM12.8536 3.85355C13.0488 3.65829 13.0488 3.34171 12.8536 3.14645C12.6583 2.95118 12.3417 2.95118 12.1464 3.14645L8.14645 7.14645C7.95118 7.34171 7.95118 7.65829 8.14645 7.85355L12.1464 11.8536C12.3417 12.0488 12.6583 12.0488 12.8536 11.8536C13.0488 11.6583 13.0488 11.3417 12.8536 11.1464L9.20711 7.5L12.8536 3.85355Z"}),vh=e=>s.jsx(Ns,{...e,path:"M2.14645 11.1464C1.95118 11.3417 1.95118 11.6583 2.14645 11.8536C2.34171 12.0488 2.65829 12.0488 2.85355 11.8536L6.85355 7.85355C7.04882 7.65829 7.04882 7.34171 6.85355 7.14645L2.85355 3.14645C2.65829 2.95118 2.34171 2.95118 2.14645 3.14645C1.95118 3.34171 1.95118 3.65829 2.14645 3.85355L5.79289 7.5L2.14645 11.1464ZM8.14645 11.1464C7.95118 11.3417 7.95118 11.6583 8.14645 11.8536C8.34171 12.0488 8.65829 12.0488 8.85355 11.8536L12.8536 7.85355C13.0488 7.65829 13.0488 7.34171 12.8536 7.14645L8.85355 3.14645C8.65829 2.95118 8.34171 2.95118 8.14645 3.14645C7.95118 3.34171 7.95118 3.65829 8.14645 3.85355L11.7929 7.5L8.14645 11.1464Z"}),xh=e=>s.jsx(Ns,{...e,path:"M2 8c0-.733.6-1.333 1.333-1.333.734 0 1.334.6 1.334 1.333s-.6 1.333-1.334 1.333C2.6 9.333 2 8.733 2 8zm9.333 0c0-.733.6-1.333 1.334-1.333C13.4 6.667 14 7.267 14 8s-.6 1.333-1.333 1.333c-.734 0-1.334-.6-1.334-1.333zM6.667 8c0-.733.6-1.333 1.333-1.333s1.333.6 1.333 1.333S8.733 9.333 8 9.333 6.667 8.733 6.667 8z"}),bh={icon:xh},Ro=ye((e,n)=>{const t=ge("PaginationDots",bh,e),{classNames:o,className:a,style:r,styles:i,vars:l,icon:d,...c}=t,u=Mo(),g=d;return s.jsx(K,{ref:n,...u.getStyles("dots",{className:a,style:r,styles:i,classNames:o}),...c,children:s.jsx(g,{style:{width:"calc(var(--pagination-control-size) / 1.8)",height:"calc(var(--pagination-control-size) / 1.8)"}})})});Ro.classes=Ms;Ro.displayName="@mantine/core/PaginationDots";function No({icon:e,name:n,action:t,type:o}){const a={icon:e},r=b.forwardRef((i,l)=>{const{icon:d,...c}=ge(n,a,i),u=d,g=Mo(),h=o==="next"?g.active===g.total:g.active===1;return s.jsx(Rs,{disabled:g.disabled||h,ref:l,onClick:g[t],withPadding:!1,...c,children:s.jsx(u,{className:"mantine-rotate-rtl",style:{width:"calc(var(--pagination-control-size) / 1.8)",height:"calc(var(--pagination-control-size) / 1.8)"}})})});return r.displayName=`@mantine/core/${n}`,iu(r)}const nc=No({icon:hh,name:"PaginationNext",action:"onNext",type:"next"}),sc=No({icon:ph,name:"PaginationPrevious",action:"onPrevious",type:"previous"}),oc=No({icon:fh,name:"PaginationFirst",action:"onFirst",type:"previous"}),ac=No({icon:vh,name:"PaginationLast",action:"onLast",type:"next"});function Er({dotsIcon:e}){const n=Mo(),t=n.range.map((o,a)=>{var r,i,l;return o==="dots"?s.jsx(Ro,{icon:e},a):s.jsx(Rs,{active:o===n.active,"aria-current":o===n.active?"page":void 0,onClick:()=>n.onChange(o),disabled:n.disabled,...(r=n.getItemProps)==null?void 0:r.call(n,o),children:((l=(i=n.getItemProps)==null?void 0:i.call(n,o))==null?void 0:l.children)??o},a)});return s.jsx(s.Fragment,{children:t})}Er.displayName="@mantine/core/PaginationItems";const yh={siblings:1,boundaries:1},wh=Ke((e,{size:n,radius:t,color:o,autoContrast:a})=>({root:{"--pagination-control-radius":t===void 0?void 0:$t(t),"--pagination-control-size":Ye(n,"pagination-control-size"),"--pagination-control-fz":Rt(n),"--pagination-active-bg":o?Wt(o,e):void 0,"--pagination-active-color":sr(a,e)?Qa({color:o,theme:e,autoContrast:a}):void 0}})),ko=ye((e,n)=>{const t=ge("PaginationRoot",yh,e),{classNames:o,className:a,style:r,styles:i,unstyled:l,vars:d,total:c,value:u,defaultValue:g,onChange:h,disabled:m,siblings:p,boundaries:f,color:v,radius:x,onNextPage:y,onPreviousPage:w,onFirstPage:C,onLastPage:j,getItemProps:S,autoContrast:R,..._}=t,T=Le({name:"Pagination",classes:Ms,props:t,className:a,style:r,classNames:o,styles:i,unstyled:l,vars:d,varsResolver:wh}),{range:k,setPage:I,next:E,previous:V,active:L,first:B,last:M}=lg({page:u,initialPage:g,onChange:h,total:c,siblings:p,boundaries:f}),D=vt(y,E),O=vt(w,V),F=vt(C,B),$=vt(j,M);return s.jsx(gh,{value:{total:c,range:k,active:L,disabled:m,getItemProps:S,onChange:I,onNext:D,onPrevious:O,onFirst:F,onLast:$,getStyles:T},children:s.jsx(K,{ref:n,...T("root"),..._})})});ko.classes=Ms;ko.displayName="@mantine/core/PaginationRoot";const Ch={withControls:!0,withPages:!0,siblings:1,boundaries:1,gap:8},Bt=ye((e,n)=>{const t=ge("Pagination",Ch,e),{withEdges:o,withControls:a,getControlProps:r,nextIcon:i,previousIcon:l,lastIcon:d,firstIcon:c,dotsIcon:u,total:g,gap:h,hideWithOnePage:m,withPages:p,...f}=t;return g<=0||m&&g===1?null:s.jsx(ko,{ref:n,total:g,...f,children:s.jsxs(Pe,{gap:h,children:[o&&s.jsx(oc,{icon:c,...r==null?void 0:r("first")}),a&&s.jsx(sc,{icon:l,...r==null?void 0:r("previous")}),p&&s.jsx(Er,{dotsIcon:u}),a&&s.jsx(nc,{icon:i,...r==null?void 0:r("next")}),o&&s.jsx(ac,{icon:d,...r==null?void 0:r("last")})]})})});Bt.classes=Ms;Bt.displayName="@mantine/core/Pagination";Bt.Root=ko;Bt.Control=Rs;Bt.Dots=Ro;Bt.First=oc;Bt.Last=ac;Bt.Next=nc;Bt.Previous=sc;Bt.Items=Er;const[jh,rc]=es("Progress.Root component was not found in tree");var ks={root:"m_db6d6462",section:"m_2242eb65","stripes-animation":"m_81a374bd",label:"m_91e40b74"};const Sh={},Or=ye((e,n)=>{const{classNames:t,className:o,style:a,styles:r,vars:i,...l}=ge("ProgressLabel",Sh,e),d=rc();return s.jsx(K,{ref:n,...d.getStyles("label",{className:o,style:a,classNames:t,styles:r}),...l})});Or.classes=ks;Or.displayName="@mantine/core/ProgressLabel";const _h={},Mh=Ke((e,{size:n,radius:t,transitionDuration:o})=>({root:{"--progress-size":Ye(n,"progress-size"),"--progress-radius":t===void 0?void 0:$t(t),"--progress-transition-duration":typeof o=="number"?`${o}ms`:void 0}})),Do=ye((e,n)=>{const t=ge("ProgressRoot",_h,e),{classNames:o,className:a,style:r,styles:i,unstyled:l,vars:d,autoContrast:c,transitionDuration:u,...g}=t,h=Le({name:"Progress",classes:ks,props:t,className:a,style:r,classNames:o,styles:i,unstyled:l,vars:d,varsResolver:Mh});return s.jsx(jh,{value:{getStyles:h,autoContrast:c},children:s.jsx(K,{ref:n,...h("root"),...g})})});Do.classes=ks;Do.displayName="@mantine/core/ProgressRoot";const Rh={withAria:!0},To=ye((e,n)=>{const{classNames:t,className:o,style:a,styles:r,vars:i,value:l,withAria:d,color:c,striped:u,animated:g,mod:h,...m}=ge("ProgressSection",Rh,e),p=rc(),f=Fn(),v=d?{role:"progressbar","aria-valuemax":100,"aria-valuemin":0,"aria-valuenow":l,"aria-valuetext":`${l}%`}:{};return s.jsx(K,{ref:n,...p.getStyles("section",{className:o,classNames:t,styles:r,style:a}),...m,...v,mod:[{striped:u||g,animated:g},h],__vars:{"--progress-section-width":`${l}%`,"--progress-section-color":Wt(c,f),"--progress-label-color":sr(p.autoContrast,f)?Qa({color:c,theme:f,autoContrast:p.autoContrast}):void 0}})});To.classes=ks;To.displayName="@mantine/core/ProgressSection";const Nh={},as=ye((e,n)=>{const t=ge("Progress",Nh,e),{value:o,classNames:a,styles:r,vars:i,color:l,striped:d,animated:c,"aria-label":u,...g}=t,{resolvedClassNames:h,resolvedStyles:m}=wn({classNames:a,styles:r,props:t});return s.jsx(Do,{ref:n,classNames:h,styles:m,vars:i,...g,children:s.jsx(To,{value:o,color:l,striped:d,animated:c,"aria-label":u})})});as.classes=ks;as.displayName="@mantine/core/Progress";as.Section=To;as.Root=Do;as.Label=Or;const kh={searchable:!1,withCheckIcon:!0,allowDeselect:!0,checkIconPosition:"left"},Jt=ye((e,n)=>{const t=ge("Select",kh,e),{classNames:o,styles:a,unstyled:r,vars:i,dropdownOpened:l,defaultDropdownOpened:d,onDropdownClose:c,onDropdownOpen:u,onFocus:g,onBlur:h,onClick:m,onChange:p,data:f,value:v,defaultValue:x,selectFirstOptionOnChange:y,onOptionSubmit:w,comboboxProps:C,readOnly:j,disabled:S,filter:R,limit:_,withScrollArea:T,maxDropdownHeight:k,size:I,searchable:E,rightSection:V,checkIconPosition:L,withCheckIcon:B,nothingFoundMessage:M,name:D,form:O,searchValue:F,defaultSearchValue:$,onSearchChange:z,allowDeselect:H,error:re,rightSectionPointerEvents:ie,id:X,clearable:oe,clearButtonProps:ne,hiddenInputProps:J,renderOption:P,onClear:Q,autoComplete:ce,scrollAreaProps:te,__defaultRightSection:W,__clearSection:me,__clearable:le,chevronColor:de,...Y}=t,A=b.useMemo(()=>rr(f),[f]),se=b.useMemo(()=>wo(A),[A]),be=js(X),[ve,Se,we]=At({value:v,defaultValue:x,finalValue:null,onChange:p}),U=typeof ve=="string"?se[ve]:void 0,G=dg(U),[ae,Fe,pe]=At({value:F,defaultValue:$,finalValue:U?U.label:"",onChange:z}),Z=Co({opened:l,defaultOpened:d,onDropdownOpen:()=>{u==null||u(),Z.updateSelectedOptionIndex("active",{scrollIntoView:!0})},onDropdownClose:()=>{c==null||c(),Z.resetSelectedOption()}}),_e=ee=>{Fe(ee),Z.resetSelectedOption()},{resolvedClassNames:Ae,resolvedStyles:Qe}=wn({props:t,styles:a,classNames:o});b.useEffect(()=>{y&&Z.selectFirstOption()},[y,ae]),b.useEffect(()=>{v===null&&_e(""),typeof v=="string"&&U&&((G==null?void 0:G.value)!==U.value||(G==null?void 0:G.label)!==U.label)&&_e(U.label)},[v,U]),b.useEffect(()=>{var ee;!we&&!pe&&_e(typeof ve=="string"&&((ee=se[ve])==null?void 0:ee.label)||"")},[f,ve]);const nt=s.jsx($e.ClearButton,{...ne,onClear:()=>{Se(null,null),_e(""),Q==null||Q()}}),et=oe&&!!ve&&!S&&!j;return s.jsxs(s.Fragment,{children:[s.jsxs($e,{store:Z,__staticSelector:"Select",classNames:Ae,styles:Qe,unstyled:r,readOnly:j,onOptionSubmit:ee=>{w==null||w(ee);const q=H&&se[ee].value===ve?null:se[ee],Re=q?q.value:null;Re!==ve&&Se(Re,q),!we&&_e(typeof Re=="string"&&(q==null?void 0:q.label)||""),Z.closeDropdown()},size:I,...C,children:[s.jsx($e.Target,{targetType:E?"input":"button",autoComplete:ce,children:s.jsx(Cn,{id:be,ref:n,__defaultRightSection:s.jsx($e.Chevron,{size:I,error:re,unstyled:r,color:de}),__clearSection:nt,__clearable:et,rightSection:V,rightSectionPointerEvents:ie||(et?"all":"none"),...Y,size:I,__staticSelector:"Select",disabled:S,readOnly:j||!E,value:ae,onChange:ee=>{_e(ee.currentTarget.value),Z.openDropdown(),y&&Z.selectFirstOption()},onFocus:ee=>{E&&Z.openDropdown(),g==null||g(ee)},onBlur:ee=>{var q;E&&Z.closeDropdown(),_e(ve!=null&&((q=se[ve])==null?void 0:q.label)||""),h==null||h(ee)},onClick:ee=>{E?Z.openDropdown():Z.toggleDropdown(),m==null||m(ee)},classNames:Ae,styles:Qe,unstyled:r,pointer:!E,error:re})}),s.jsx(vr,{data:A,hidden:j||S,filter:R,search:ae,limit:_,hiddenWhenEmpty:!M,withScrollArea:T,maxDropdownHeight:k,filterOptions:E&&(U==null?void 0:U.label)!==ae,value:ve,checkIconPosition:L,withCheckIcon:B,nothingFoundMessage:M,unstyled:r,labelId:Y.label?`${be}-label`:void 0,"aria-label":Y.label?void 0:Y["aria-label"],renderOption:P,scrollAreaProps:te})]}),s.jsx($e.HiddenInput,{value:ve,name:D,form:O,disabled:S,...J})]})});Jt.classes={...Cn.classes,...$e.classes};Jt.displayName="@mantine/core/Select";function Dh({spacing:e,verticalSpacing:n,cols:t,selector:o}){var u;const a=Fn(),r=n===void 0?e:n,i=Ka({"--sg-spacing-x":ft(Gn(e)),"--sg-spacing-y":ft(Gn(r)),"--sg-cols":(u=Gn(t))==null?void 0:u.toString()}),l=Ws(a.breakpoints).reduce((g,h)=>(g[h]||(g[h]={}),typeof e=="object"&&e[h]!==void 0&&(g[h]["--sg-spacing-x"]=ft(e[h])),typeof r=="object"&&r[h]!==void 0&&(g[h]["--sg-spacing-y"]=ft(r[h])),typeof t=="object"&&t[h]!==void 0&&(g[h]["--sg-cols"]=t[h]),g),{}),c=sg(Ws(l),a.breakpoints).filter(g=>Ws(l[g.value]).length>0).map(g=>({query:`(min-width: ${a.breakpoints[g.value]})`,styles:l[g.value]}));return s.jsx(Wa,{styles:i,media:c,selector:o})}function sa(e){return typeof e=="object"&&e!==null?Ws(e):[]}function Th(e){return e.sort((n,t)=>Zs(n)-Zs(t))}function Ih({spacing:e,verticalSpacing:n,cols:t}){const o=Array.from(new Set([...sa(e),...sa(n),...sa(t)]));return Th(o)}function Ph({spacing:e,verticalSpacing:n,cols:t,selector:o}){var c;const a=n===void 0?e:n,r=Ka({"--sg-spacing-x":ft(Gn(e)),"--sg-spacing-y":ft(Gn(a)),"--sg-cols":(c=Gn(t))==null?void 0:c.toString()}),i=Ih({spacing:e,verticalSpacing:n,cols:t}),l=i.reduce((u,g)=>(u[g]||(u[g]={}),typeof e=="object"&&e[g]!==void 0&&(u[g]["--sg-spacing-x"]=ft(e[g])),typeof a=="object"&&a[g]!==void 0&&(u[g]["--sg-spacing-y"]=ft(a[g])),typeof t=="object"&&t[g]!==void 0&&(u[g]["--sg-cols"]=t[g]),u),{}),d=i.map(u=>({query:`simple-grid (min-width: ${u})`,styles:l[u]}));return s.jsx(Wa,{styles:r,container:d,selector:o})}var ic={container:"m_925c2d2c",root:"m_2415a157"};const Fh={cols:1,spacing:"md",type:"media"},Io=ye((e,n)=>{const t=ge("SimpleGrid",Fh,e),{classNames:o,className:a,style:r,styles:i,unstyled:l,vars:d,cols:c,verticalSpacing:u,spacing:g,type:h,...m}=t,p=Le({name:"SimpleGrid",classes:ic,props:t,className:a,style:r,classNames:o,styles:i,unstyled:l,vars:d}),f=ml();return h==="container"?s.jsxs(s.Fragment,{children:[s.jsx(Ph,{...t,selector:`.${f}`}),s.jsx("div",{...p("container"),children:s.jsx(K,{ref:n,...p("root",{className:f}),...m})})]}):s.jsxs(s.Fragment,{children:[s.jsx(Dh,{...t,selector:`.${f}`}),s.jsx(K,{ref:n,...p("root",{className:f}),...m})]})});Io.classes=ic;Io.displayName="@mantine/core/SimpleGrid";const[Eh,Po]=es("SliderProvider was not found in tree"),lc=b.forwardRef(({size:e,disabled:n,variant:t,color:o,thumbSize:a,radius:r,...i},l)=>{const{getStyles:d}=Po();return s.jsx(K,{tabIndex:-1,variant:t,size:e,ref:l,...d("root"),...i})});lc.displayName="@mantine/core/SliderRoot";const Ia=b.forwardRef(({max:e,min:n,value:t,position:o,label:a,dragging:r,onMouseDown:i,onKeyDownCapture:l,labelTransitionProps:d,labelAlwaysOn:c,thumbLabel:u,onFocus:g,onBlur:h,showLabelOnHover:m,isHovered:p,children:f=null,disabled:v},x)=>{const{getStyles:y}=Po(),[w,C]=b.useState(!1),j=c||r||w||m&&p;return s.jsxs(K,{tabIndex:0,role:"slider","aria-label":u,"aria-valuemax":e,"aria-valuemin":n,"aria-valuenow":t,ref:x,__vars:{"--slider-thumb-offset":`${o}%`},...y("thumb",{focusable:!0}),mod:{dragging:r,disabled:v},onFocus:S=>{C(!0),typeof g=="function"&&g(S)},onBlur:S=>{C(!1),typeof h=="function"&&h(S)},onTouchStart:i,onMouseDown:i,onKeyDownCapture:l,onClick:S=>S.stopPropagation(),children:[f,s.jsx(Jn,{mounted:a!=null&&!!j,transition:"fade",duration:0,...d,children:S=>s.jsx("div",{...y("label",{style:S}),children:a})})]})});Ia.displayName="@mantine/core/SliderThumb";function Pa({value:e,min:n,max:t}){const o=(e-n)/(t-n)*100;return Math.min(Math.max(o,0),100)}function Oh({mark:e,offset:n,value:t,inverted:o=!1}){return o?typeof n=="number"&&e.value<=n||e.value>=t:typeof n=="number"?e.value>=n&&e.value<=t:e.value<=t}function cc({marks:e,min:n,max:t,disabled:o,value:a,offset:r,inverted:i}){const{getStyles:l}=Po();if(!e)return null;const d=e.map((c,u)=>b.createElement(K,{...l("markWrapper"),__vars:{"--mark-offset":`${Pa({value:c.value,min:n,max:t})}%`},key:u},s.jsx(K,{...l("mark"),mod:{filled:Oh({mark:c,value:a,offset:r,inverted:i}),disabled:o}}),c.label&&s.jsx("div",{...l("markLabel"),children:c.label})));return s.jsx("div",{children:d})}cc.displayName="@mantine/core/SliderMarks";function dc({filled:e,children:n,offset:t,disabled:o,marksOffset:a,inverted:r,containerProps:i,...l}){const{getStyles:d}=Po();return s.jsx(K,{...d("trackContainer"),mod:{disabled:o},...i,children:s.jsxs(K,{...d("track"),mod:{inverted:r,disabled:o},children:[s.jsx(K,{mod:{inverted:r,disabled:o},__vars:{"--slider-bar-width":`calc(${e}% + var(--slider-size))`,"--slider-bar-offset":`calc(${t}% - var(--slider-size))`},...d("bar")}),n,s.jsx(cc,{...l,offset:a,disabled:o,inverted:r})]})})}dc.displayName="@mantine/core/SliderTrack";function Fi({value:e,containerWidth:n,min:t,max:o,step:a,precision:r}){const l=(n?Math.min(Math.max(e,0),n)/n:e)*(o-t),d=(l!==0?Math.round(l/a)*a:0)+t,c=Math.max(d,t);return r!==void 0?Number(c.toFixed(r)):c}function gn(e,n){return parseFloat(e.toFixed(n))}function Ah(e){if(!e)return 0;const n=e.toString().split(".");return n.length>1?n[1].length:0}function Fs(e,n){const o=[...n].sort((a,r)=>a.value-r.value).find(a=>a.value>e);return o?o.value:e}function Es(e,n){const o=[...n].sort((a,r)=>r.value-a.value).find(a=>a.value<e);return o?o.value:e}function zh(e){const n=[...e].sort((t,o)=>t.value-o.value);return n.length>0?n[0].value:0}function $h(e){const n=[...e].sort((t,o)=>t.value-o.value);return n.length>0?n[n.length-1].value:100}var uc={root:"m_dd36362e",label:"m_c9357328",thumb:"m_c9a9a60a",trackContainer:"m_a8645c2",track:"m_c9ade57f",bar:"m_38aeed47",markWrapper:"m_b7b0423a",mark:"m_dd33bc19",markLabel:"m_68c77a5b"};function Lh(e){return"TouchEvent"in window&&e instanceof window.TouchEvent?e.touches[0].clientX:e.clientX}const Vh=Ke((e,{size:n,color:t,thumbSize:o,radius:a})=>({root:{"--slider-size":Ye(n,"slider-size"),"--slider-color":t?Wt(t,e):void 0,"--slider-radius":a===void 0?void 0:$t(a),"--slider-thumb-size":o!==void 0?Et(o):"calc(var(--slider-size) * 2)"}})),Bh={min:0,max:100,minRange:10,step:1,marks:[],label:e=>e,labelTransitionProps:{transition:"fade",duration:0},labelAlwaysOn:!1,showLabelOnHover:!0,disabled:!1,scale:e=>e},Ar=ye((e,n)=>{const t=ge("RangeSlider",Bh,e),{classNames:o,styles:a,value:r,onChange:i,onChangeEnd:l,size:d,min:c,max:u,minRange:g,maxRange:h,step:m,precision:p,defaultValue:f,name:v,marks:x,label:y,labelTransitionProps:w,labelAlwaysOn:C,thumbFromLabel:j,thumbToLabel:S,showLabelOnHover:R,thumbChildren:_,disabled:T,unstyled:k,scale:I,inverted:E,className:V,style:L,vars:B,hiddenInputProps:M,restrictToMarks:D,thumbProps:O,...F}=t,$=Le({name:"Slider",props:t,classes:uc,classNames:o,className:V,styles:a,style:L,vars:B,varsResolver:Vh,unstyled:k}),{dir:z}=On(),[H,re]=b.useState(-1),[ie,X]=b.useState(!1),[oe,ne]=At({value:r,defaultValue:f,finalValue:[c,u],onChange:i}),J=b.useRef(oe),P=b.useRef([]),Q=b.useRef(null),ce=b.useRef(void 0),te=[Pa({value:oe[0],min:c,max:u}),Pa({value:oe[1],min:c,max:u})],W=p??Ah(m),me=G=>{ne(G),J.current=G};b.useEffect(()=>{Array.isArray(r)&&(J.current=r)},Array.isArray(r)?[r[0],r[1]]:[null,null]);const le=(G,ae,Fe)=>{if(ae===-1)return;const pe=[...J.current];if(D&&x){const Z=ug(G,x.map(et=>et.value)),_e=pe[ae];pe[ae]=Z;const Ae=ae===0?1:0,Qe=$h(x),nt=zh(x);Z===Qe&&pe[Ae]===Qe||Z===nt&&pe[Ae]===nt?pe[ae]=_e:Z===pe[Ae]&&(_e>pe[Ae]?pe[Ae]=Es(Z,x):pe[Ae]=Fs(Z,x))}else pe[ae]=G,ae===0&&(G>pe[1]-(g-1e-9)&&(pe[1]=Math.min(G+g,u)),G>(u-(g-1e-9)||c)&&(pe[ae]=J.current[ae]),pe[1]-G>h&&(pe[1]=G+h)),ae===1&&(G<pe[0]+g&&(pe[0]=Math.max(G-g,c)),G<pe[0]+g&&(pe[ae]=J.current[ae]),G-pe[0]>h&&(pe[0]=G-h));if(pe[0]=gn(pe[0],W),pe[1]=gn(pe[1],W),pe[0]>pe[1]){const Z=pe[0];pe[0]=pe[1],pe[1]=Z}me(pe),Fe&&(l==null||l(J.current))},de=G=>{if(!T){const ae=Fi({value:G,min:c,max:u,step:m,precision:W});le(ae,ce.current,!1)}},{ref:Y,active:A}=ig(({x:G})=>de(G),{onScrubEnd:()=>!T&&(l==null?void 0:l(J.current))},z);function se(G){ce.current=G}const be=G=>{Y.current.focus();const ae=Y.current.getBoundingClientRect(),Fe=Lh(G.nativeEvent),pe=Fi({value:Fe-ae.left,max:u,min:c,step:m,containerWidth:ae.width}),Z=Math.abs(oe[0]-pe)>Math.abs(oe[1]-pe)?1:0,_e=z==="ltr"?Z:Z===1?0:1;ce.current=_e},ve=()=>H!==1&&H!==0?(re(0),0):H,Se=G=>{if(!T)switch(G.key){case"ArrowUp":{G.preventDefault();const ae=ve();P.current[ae].focus();const Fe=D&&x?Fs(J.current[ae],x):Math.min(Math.max(J.current[ae]+m,c),u);le(gn(Fe,W),ae,!0);break}case"ArrowRight":{G.preventDefault();const ae=ve();P.current[ae].focus();const Fe=D&&x?(z==="rtl"?Es:Fs)(J.current[ae],x):Math.min(Math.max(z==="rtl"?J.current[ae]-m:J.current[ae]+m,c),u);le(gn(Fe,W),ae,!0);break}case"ArrowDown":{G.preventDefault();const ae=ve();P.current[ae].focus();const Fe=D&&x?Es(J.current[ae],x):Math.min(Math.max(J.current[ae]-m,c),u);le(gn(Fe,W),ae,!0);break}case"ArrowLeft":{G.preventDefault();const ae=ve();P.current[ae].focus();const Fe=D&&x?(z==="rtl"?Fs:Es)(J.current[ae],x):Math.min(Math.max(z==="rtl"?J.current[ae]+m:J.current[ae]-m,c),u);le(gn(Fe,W),ae,!0);break}}},we={max:u,min:c,size:d,labelTransitionProps:w,labelAlwaysOn:C,onBlur:()=>re(-1)},U=Array.isArray(_);return s.jsx(Eh,{value:{getStyles:$},children:s.jsxs(lc,{...F,size:d,ref:yn(n,Q),disabled:T,onMouseDownCapture:()=>{var G;return(G=Q.current)==null?void 0:G.focus()},onKeyDownCapture:()=>{var G,ae,Fe;(ae=(G=P.current[0])==null?void 0:G.parentElement)!=null&&ae.contains(document.activeElement)||(Fe=P.current[0])==null||Fe.focus()},children:[s.jsxs(dc,{offset:te[0],marksOffset:oe[0],filled:te[1]-te[0],marks:x,inverted:E,min:c,max:u,value:oe[1],disabled:T,containerProps:{ref:Y,onMouseEnter:R?()=>X(!0):void 0,onMouseLeave:R?()=>X(!1):void 0,onTouchStartCapture:be,onTouchEndCapture:()=>{ce.current=-1},onMouseDownCapture:be,onMouseUpCapture:()=>{ce.current=-1},onKeyDownCapture:Se},children:[s.jsx(Ia,{...we,value:I(oe[0]),position:te[0],dragging:A,label:typeof y=="function"?y(gn(I(oe[0]),W)):y,ref:G=>{P.current[0]=G},thumbLabel:j,onMouseDown:()=>se(0),onFocus:()=>re(0),showLabelOnHover:R,isHovered:ie,disabled:T,...O==null?void 0:O(0),children:U?_[0]:_}),s.jsx(Ia,{...we,thumbLabel:S,value:I(oe[1]),position:te[1],dragging:A,label:typeof y=="function"?y(gn(I(oe[1]),W)):y,ref:G=>{P.current[1]=G},onMouseDown:()=>se(1),onFocus:()=>re(1),showLabelOnHover:R,isHovered:ie,disabled:T,...O==null?void 0:O(1),children:U?_[1]:_})]}),s.jsx("input",{type:"hidden",name:`${v}_from`,value:oe[0],...M}),s.jsx("input",{type:"hidden",name:`${v}_to`,value:oe[1],...M})]})})});Ar.classes=uc;Ar.displayName="@mantine/core/RangeSlider";var gc={root:"m_6d731127"};const Uh={gap:"md",align:"stretch",justify:"flex-start"},Hh=Ke((e,{gap:n,align:t,justify:o})=>({root:{"--stack-gap":ft(n),"--stack-align":t,"--stack-justify":o}})),he=ye((e,n)=>{const t=ge("Stack",Uh,e),{classNames:o,className:a,style:r,styles:i,unstyled:l,vars:d,align:c,justify:u,gap:g,variant:h,...m}=t,p=Le({name:"Stack",props:t,classes:gc,className:a,style:r,classNames:o,styles:i,unstyled:l,vars:d,varsResolver:Hh});return s.jsx(K,{ref:n,...p("root"),variant:h,...m})});he.classes=gc;he.displayName="@mantine/core/Stack";const[Gh,qh]=es("Table component was not found in the tree");var Ds={table:"m_b23fa0ef",th:"m_4e7aa4f3",tr:"m_4e7aa4fd",td:"m_4e7aa4ef",tbody:"m_b2404537",thead:"m_b242d975",caption:"m_9e5a3ac7",scrollContainer:"m_a100c15",scrollContainerInner:"m_62259741"};function Wh(e,n){if(!n)return;const t={};return n.columnBorder&&e.withColumnBorders&&(t["data-with-column-border"]=!0),n.rowBorder&&e.withRowBorders&&(t["data-with-row-border"]=!0),n.striped&&e.striped&&(t["data-striped"]=e.striped),n.highlightOnHover&&e.highlightOnHover&&(t["data-hover"]=!0),n.captionSide&&e.captionSide&&(t["data-side"]=e.captionSide),n.stickyHeader&&e.stickyHeader&&(t["data-sticky"]=!0),t}function $n(e,n){const t=`Table${e.charAt(0).toUpperCase()}${e.slice(1)}`,o=ye((a,r)=>{const i=ge(t,{},a),{classNames:l,className:d,style:c,styles:u,...g}=i,h=qh();return s.jsx(K,{component:e,ref:r,...Wh(h,n),...h.getStyles(e,{className:d,classNames:l,style:c,styles:u,props:i}),...g})});return o.displayName=`@mantine/core/${t}`,o.classes=Ds,o}const Xn=$n("th",{columnBorder:!0}),Ts=$n("td",{columnBorder:!0}),sn=$n("tr",{rowBorder:!0,striped:!0,highlightOnHover:!0}),zr=$n("thead",{stickyHeader:!0}),hs=$n("tbody"),$r=$n("tfoot"),mc=$n("caption",{captionSide:!0});function Lr({data:e}){return s.jsxs(s.Fragment,{children:[e.caption&&s.jsx(mc,{children:e.caption}),e.head&&s.jsx(zr,{children:s.jsx(sn,{children:e.head.map((n,t)=>s.jsx(Xn,{children:n},t))})}),e.body&&s.jsx(hs,{children:e.body.map((n,t)=>s.jsx(sn,{children:n.map((o,a)=>s.jsx(Ts,{children:o},a))},t))}),e.foot&&s.jsx($r,{children:s.jsx(sn,{children:e.foot.map((n,t)=>s.jsx(Xn,{children:n},t))})})]})}Lr.displayName="@mantine/core/TableDataRenderer";const Kh={type:"scrollarea"},Yh=Ke((e,{minWidth:n,maxHeight:t,type:o})=>({scrollContainer:{"--table-min-width":Et(n),"--table-max-height":Et(t),"--table-overflow":o==="native"?"auto":void 0}})),Vr=ye((e,n)=>{const t=ge("TableScrollContainer",Kh,e),{classNames:o,className:a,style:r,styles:i,unstyled:l,vars:d,children:c,minWidth:u,maxHeight:g,type:h,scrollAreaProps:m,...p}=t,f=Le({name:"TableScrollContainer",classes:Ds,props:t,className:a,style:r,classNames:o,styles:i,unstyled:l,vars:d,varsResolver:Yh,rootSelector:"scrollContainer"});return s.jsx(K,{component:h==="scrollarea"?ao:"div",...h==="scrollarea"?g?{offsetScrollbars:"xy",...m}:{offsetScrollbars:"x",...m}:{},ref:n,...f("scrollContainer"),...p,children:s.jsx("div",{...f("scrollContainerInner"),children:c})})});Vr.classes=Ds;Vr.displayName="@mantine/core/TableScrollContainer";const Qh={withRowBorders:!0,verticalSpacing:7},Xh=Ke((e,{layout:n,captionSide:t,horizontalSpacing:o,verticalSpacing:a,borderColor:r,stripedColor:i,highlightOnHoverColor:l,striped:d,highlightOnHover:c,stickyHeaderOffset:u,stickyHeader:g})=>({table:{"--table-layout":n,"--table-caption-side":t,"--table-horizontal-spacing":ft(o),"--table-vertical-spacing":ft(a),"--table-border-color":r?Wt(r,e):void 0,"--table-striped-color":d&&i?Wt(i,e):void 0,"--table-highlight-on-hover-color":c&&l?Wt(l,e):void 0,"--table-sticky-header-offset":g?Et(u):void 0}})),Ut=ye((e,n)=>{const t=ge("Table",Qh,e),{classNames:o,className:a,style:r,styles:i,unstyled:l,vars:d,horizontalSpacing:c,verticalSpacing:u,captionSide:g,stripedColor:h,highlightOnHoverColor:m,striped:p,highlightOnHover:f,withColumnBorders:v,withRowBorders:x,withTableBorder:y,borderColor:w,layout:C,variant:j,data:S,children:R,stickyHeader:_,stickyHeaderOffset:T,mod:k,tabularNums:I,...E}=t,V=Le({name:"Table",props:t,className:a,style:r,classes:Ds,classNames:o,styles:i,unstyled:l,rootSelector:"table",vars:d,varsResolver:Xh});return s.jsx(Gh,{value:{getStyles:V,stickyHeader:_,striped:p===!0?"odd":p||void 0,highlightOnHover:f,withColumnBorders:v,withRowBorders:x,captionSide:g||"bottom"},children:s.jsx(K,{component:"table",variant:j,ref:n,mod:[{"data-with-table-border":y,"data-tabular-nums":I},k],...V("table"),...E,children:R||!!S&&s.jsx(Lr,{data:S})})})});Ut.classes=Ds;Ut.displayName="@mantine/core/Table";Ut.Td=Ts;Ut.Th=Xn;Ut.Tr=sn;Ut.Thead=zr;Ut.Tbody=hs;Ut.Tfoot=$r;Ut.Caption=mc;Ut.ScrollContainer=Vr;Ut.DataRenderer=Lr;var hc={root:"m_7341320d"};const Zh={},Jh=Ke((e,{size:n,radius:t,variant:o,gradient:a,color:r,autoContrast:i})=>{const l=e.variantColorResolver({color:r||e.primaryColor,theme:e,gradient:a,variant:o||"filled",autoContrast:i});return{root:{"--ti-size":Ye(n,"ti-size"),"--ti-radius":t===void 0?void 0:$t(t),"--ti-bg":r||o?l.background:void 0,"--ti-color":r||o?l.color:void 0,"--ti-bd":r||o?l.border:void 0}}}),Br=ye((e,n)=>{const t=ge("ThemeIcon",Zh,e),{classNames:o,className:a,style:r,styles:i,unstyled:l,vars:d,autoContrast:c,...u}=t,g=Le({name:"ThemeIcon",classes:hc,props:t,className:a,style:r,classNames:o,styles:i,unstyled:l,vars:d,varsResolver:Jh});return s.jsx(K,{ref:n,...g("root"),...u})});Br.classes=hc;Br.displayName="@mantine/core/ThemeIcon";const Ei=({selectedOrgId:e,onSelectOrganization:n,organizations:t=[],isLoading:o=!1,searchQuery:a="",onCreateUnit:r,canCreateUnitForOrg:i})=>{const l=Lt(),[d,c]=b.useState(null),u=t.filter(g=>a?l(g.name).toLowerCase().includes(a.toLowerCase()):!0);return s.jsx("div",{className:"flex flex-col gap-2 min-h-[400px]",children:o?s.jsx("div",{className:"flex justify-center items-center h-full",children:s.jsx("p",{children:N("organization.loading")})}):u.length>0?u.map(g=>{const h=i?i(g.id):!1;return s.jsxs("div",{className:vn("flex items-center justify-between p-2 rounded-md cursor-pointer group",g.id===e?"bg-primary-50 text-primary-700":"hover:bg-primary-50 hover:text-primary-700"),onClick:()=>n(g.id),children:[s.jsx("div",{className:"flex-1",children:s.jsx("span",{className:vn("text-sm",g.id===e?"font-medium":""),children:l(g.name)})}),r&&s.jsxs(ro,{open:d===g.id,onOpenChange:m=>c(m?g.id:null),children:[s.jsx(io,{asChild:!0,children:s.jsx(Be,{variant:"ghost",className:"h-8 w-8 p-0 opacity-0 group-hover:opacity-100 data-[state=open]:opacity-100",onClick:m=>m.stopPropagation(),children:s.jsx(er,{className:"h-4 w-4"})})}),s.jsxs(lo,{align:"end",className:"w-[180px]",onClick:m=>m.stopPropagation(),children:[s.jsx(Xa,{children:"Actions"}),s.jsxs(ct,{disabled:!h,onClick:()=>{c(null),r(g.id)},children:[s.jsx(bs,{className:"mr-2 h-4 w-4"}),N("contentManagement.createUnit","Create Unit")]})]})]})]},g.id)}):s.jsx("div",{className:"flex flex-col items-center justify-center h-full text-gray-400",children:s.jsx("p",{className:"text-sm",children:N("contentManagement.noOrg")})})})},ep=({unit:e,onAddDepartment:n,onEditUnit:t,onDeleteUnit:o,onAddFromSubCity:a,showAlways:r=!1})=>{var m;const{user:i}=Za(),l=(m=i==null?void 0:i.roles)==null?void 0:m.some(p=>p.key==="unit_admin"),[d,c]=b.useState(!1),u=Lt(),g=p=>{c(!1),p&&p(e.id)},h=p=>{if(c(!1),p){const f=u(e.name);p(e.id,f)}};return s.jsx("div",{className:r?"opacity-100":"opacity-0 group-hover:opacity-100",children:s.jsxs(ro,{open:d,onOpenChange:c,children:[s.jsx(io,{asChild:!0,children:s.jsx(Be,{variant:"ghost",className:"h-8 w-8 p-0",children:s.jsx(er,{className:"h-4 w-4"})})}),s.jsxs(lo,{align:"end",className:"w-[160px]",children:[s.jsx(Xa,{children:"Actions"}),s.jsxs(ct,{onClick:()=>g(n),children:[s.jsx(bs,{className:"mr-2 h-4 w-4"}),N("contentManagement.addDepartment")]}),s.jsxs(ct,{onClick:()=>g(t),children:[s.jsx(bs,{className:"mr-2 h-4 w-4"}),N("contentManagement.editUnit")]}),l&&a&&s.jsxs(ct,{onClick:()=>g(a),children:[s.jsx(lu,{className:"mr-2 h-4 w-4"}),N("contentManagement.addFromSubCity","Add From Sub City")]}),o&&s.jsxs(ct,{onClick:()=>h(o),className:"text-red-600 focus:text-red-700",children:[s.jsx(wl,{className:"mr-2 h-4 w-4"}),N("contentManagement.deleteUnit")]})]})]})})},Oi=({selectedUnitId:e,onSelectUnit:n,units:t=[],isLoading:o=!1,searchQuery:a="",onAddDepartment:r,onEditUnit:i,onDeleteUnit:l,onAddFromSubCity:d})=>{const[c,u]=b.useState(null),[g,h]=b.useState(null),m=b.useRef(null),p=Lt(),f=t.filter(x=>a?p(x.name).toLowerCase().includes(a.toLowerCase()):!0),v=(x,y)=>{if(x===e)return;g&&clearTimeout(g);const w=setTimeout(()=>{n(x,y)},200);h(w)};return s.jsxs("div",{className:"flex flex-col gap-2 h-[50vh] overflow-y-auto",ref:m,children:[o&&f.length===0?s.jsxs("div",{className:"flex justify-center items-center h-full gap-2 text-gray-500 dark:text-gray-400",children:[s.jsx(_t,{className:"w-4 h-4 animate-spin"}),s.jsx("p",{children:N("organization.loading")})]}):f.length>0?f.map(x=>s.jsxs("div",{className:vn("flex items-center justify-between p-2 rounded-md cursor-pointer group",x.id===e?"bg-primary-50 dark:bg-primary-900/30 text-primary-700 dark:text-primary-300":"hover:bg-primary-50 dark:hover:bg-primary-900/20 hover:text-primary-700 dark:hover:text-primary-300 text-gray-800 dark:text-gray-200"),onMouseEnter:()=>u(x.id),onMouseLeave:()=>u(null),onClick:()=>v(x.id,t),children:[s.jsx("div",{className:"flex-1",children:s.jsx("span",{className:vn("text-sm",x.id===e?"font-medium":""),children:p(x.name)})}),s.jsx(ep,{unit:x,onAddDepartment:r,onEditUnit:i,onDeleteUnit:x.isRelated?void 0:l,onAddFromSubCity:d,showAlways:c===x.id||x.id===e})]},x.id)):s.jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-2 text-gray-400 dark:text-gray-500",children:[s.jsx(Ml,{className:"w-6 h-6"}),s.jsx("p",{className:"text-sm",children:N("contentManagement.noUnit")})]}),o&&t.length>0&&s.jsxs("div",{className:"flex justify-center py-2 text-gray-500 dark:text-gray-400 text-sm",children:[s.jsx(_t,{className:"w-4 h-4 animate-spin mr-2"}),N("organization.loading")]})]})},tp=({department:e,positions:n,onAddUser:t,onAddPosition:o,onAddSubDepartment:a,onAssignUser:r,onEditDepartment:i,onDeleteDepartment:l,onArchiveDepartment:d,onMoveDepartment:c,showAlways:u=!1})=>{const[g,h]=b.useState(!1),m=Lt(),p=f=>{f&&f(e.id,m(e.name)),h(!1)};return s.jsx("div",{className:u?"opacity-100":"opacity-0 group-hover:opacity-100",children:s.jsxs(ro,{open:g,onOpenChange:h,children:[s.jsx(io,{asChild:!0,children:s.jsx(Be,{variant:"ghost",className:"h-8 w-8 p-0",children:s.jsx(er,{className:"h-4 w-4"})})}),s.jsxs(lo,{align:"end",children:[s.jsx(Xa,{children:"Actions"}),s.jsxs(ct,{onClick:()=>p(t),children:[s.jsx(Cl,{className:"mr-2 h-4 w-4"}),N("contentManagement.addUser")]}),s.jsxs(ct,{onClick:()=>p(r),children:[s.jsx(fl,{className:"mr-2 h-4 w-4"}),N("organization.assignUser")]}),s.jsxs(ct,{onClick:()=>p(a),children:[s.jsx(bs,{className:"mr-2 h-4 w-4"}),N("contentManagement.addSubdepartement")]}),s.jsxs(ct,{onClick:()=>p(i),children:[s.jsx(yu,{className:"mr-2 h-4 w-4"}),N("contentManagement.editDepartment")]}),s.jsxs(ct,{onClick:()=>p(c),className:"text-black-600 focus:black-red-700",children:[s.jsx(Xu,{className:"mr-2 h-4 w-4"}),N("contentManagement.moveDepartment")]}),d&&s.jsxs(ct,{onClick:()=>p(d),className:"text-amber-700 focus:text-amber-800",children:[s.jsx(cu,{className:"mr-2 h-4 w-4"}),N("contentManagement.archiveDepartment","Archive Department")]}),s.jsxs(ct,{onClick:()=>p(l),className:"text-red-600 focus:text-red-700",children:[s.jsx(wl,{className:"mr-2 h-4 w-4"}),N("contentManagement.deleteDepartment")]})]})]})})},Ai=({unitId:e,selectedDepartmentId:n,onSelectDepartment:t,departments:o=[],positions:a,isLoading:r=!1,searchQuery:i="",onAddUser:l,onViewUsers:d,onAddPosition:c,onAddSubDepartment:u,onEditDepartment:g,onDeleteDepartment:h,onArchiveDepartment:m,onDelegate:p,onAssignUser:f,onMoveDepartment:v})=>{const[x,y]=b.useState(null),[w,C]=b.useState({}),j=Lt(),S=k=>i?k.filter(I=>{const V=j(I.name).toLowerCase().includes(i.toLowerCase()),L=I.children&&I.children.length>0?S(I.children).length>0:!1;return V||L}).map(I=>({...I,children:I.children?S(I.children):void 0})):k,R=S(o),_=k=>{C(I=>({...I,[k]:!I[k]}))},T=(k,I=0)=>{var M,D,O,F;const E=k.id===n,V=x===k.id,L=w[k.id]??k.isExpanded,B=(((M=k.children)==null?void 0:M.length)??0)>0||(((D=k.positions)==null?void 0:D.length)??0)>0;return s.jsxs("div",{className:vn("flex flex-col gap-1 group",I>0&&"ml-4"),children:[s.jsxs("div",{className:vn("flex items-center gap-2 px-2 py-1.5 rounded-md cursor-pointer hover:bg-gray-100 dark:hover:bg-gray-700",E&&"bg-gray-100 dark:bg-gray-700",!E&&"text-gray-800 dark:text-gray-200"),onClick:()=>t(k.id,[]),children:[s.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[B?s.jsx("button",{onClick:$=>{$.stopPropagation(),_(k.id)},className:"w-4 h-4 flex items-center justify-center",children:L?s.jsx(du,{className:"w-4 h-4"}):s.jsx(Js,{className:"w-4 h-4"})}):s.jsx(bi,{className:"w-4 h-4"}),s.jsx("span",{children:j(k.name)})]}),s.jsx(tp,{department:k,positions:a,onAddUser:l,onViewUsers:d,onAddPosition:c,onAddSubDepartment:u,onDelegate:p,onAssignUser:f,onEditDepartment:g,onDeleteDepartment:h,onArchiveDepartment:m,onMoveDepartment:v})]}),L&&B&&s.jsxs("div",{children:[(O=k.children)==null?void 0:O.map($=>T($,I+1)),(F=k.positions)==null?void 0:F.map($=>s.jsxs("div",{className:vn("flex items-center gap-2 text-sm py-1 pl-8 border-l-2 border-primary-100 dark:border-primary-800 ml-4 text-gray-800 dark:text-gray-200",w[$.id]?"bg-blue-50 dark:bg-blue-900/20":"hover:bg-blue-50 dark:hover:bg-blue-900/20"),onClick:()=>_($.id),children:[s.jsx(bi,{className:"w-4 h-4 text-gray-400 dark:text-gray-500"}),s.jsx("span",{children:$.name.am||$.name.en}),s.jsx("div",{className:"flex-1"}),V&&s.jsxs("div",{className:"flex gap-2 pr-2",children:[s.jsx(Cl,{className:"w-4 h-4 text-gray-500 dark:text-gray-400 hover:text-primary-600 dark:hover:text-primary-400",onClick:z=>{z.stopPropagation(),l==null||l($.id,$.name.en)}}),s.jsx(Ku,{className:"w-4 h-4 text-gray-500 dark:text-gray-400 hover:text-blue-600 dark:hover:text-blue-400",onClick:z=>{z.stopPropagation(),c==null||c($.id,"sub")}}),s.jsx(fl,{className:"w-4 h-4 text-gray-500 dark:text-gray-400 hover:text-purple-600 dark:hover:text-purple-400",onClick:z=>{z.stopPropagation(),p==null||p($.id)}})]})]},$.id))]})]},k.id)};return s.jsx("div",{className:"flex flex-col gap-1 min-h-[400px]",children:r?s.jsxs("div",{className:"flex justify-center items-center h-full gap-2 text-gray-500 dark:text-gray-400",children:[s.jsx(_t,{className:"w-4 h-4 animate-spin"}),s.jsx("p",{children:N("organization.loading")})]}):R.length>0?R.map(k=>T(k)):s.jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-2 text-gray-400 dark:text-gray-500",children:[s.jsx(Ml,{className:"w-6 h-6"}),s.jsx("p",{className:"text-sm",children:i?N("search.noResults"):N("userIncoming.No Department")})]})})},np={accepted:{bg:"bg-primary-100 dark:bg-primary-900/40",text:"text-primary-800 dark:text-primary-300",icon:s.jsx(gu,{className:"h-3 w-3 mr-1"})},pending:{bg:"bg-yellow-100 dark:bg-yellow-900/40",text:"text-yellow-800 dark:text-yellow-300",icon:s.jsx(uu,{className:"h-3 w-3 mr-1"})},"Not Invited":{bg:"bg-gray-100 dark:bg-gray-700",text:"text-gray-800 dark:text-gray-300",icon:s.jsx(Ss,{className:"h-3 w-3 mr-1"})}},Fa=({departmentId:e,departmentName:n,employees:t=[],isLoading:o=!1,searchQuery:a="",onEditEmployee:r,onInviteEmployee:i,onDeleteEmployee:l,onDeactivateTeamMember:d})=>{const[c,u]=b.useState(null),[g,h]=b.useState(!1),[m,p]=b.useState(!1),[f,v]=b.useState(""),[x,y]=b.useState(""),[w,C]=b.useState(""),[j,S]=b.useState(""),[R,_]=b.useState(""),[T,k]=b.useState(!1),[I,E]=b.useState(""),[V,L]=b.useState(""),[B,M]=b.useState({}),D=Lt(),O=t.filter(P=>{if(!a)return!0;const Q=D(P.user.name),ce=P.user.email||"",te=P.user.username||"",W=P.user.phoneNumber||"",me=a.toLowerCase();return Q.toLowerCase().includes(me)||ce.toLowerCase().includes(me)||te.toLowerCase().includes(me)||W.toLowerCase().includes(me)}),F=P=>{const Q={bg:"bg-gray-100 dark:bg-gray-700",text:"text-gray-700 dark:text-gray-300",icon:null},ce=np[P]??Q;return s.jsxs(jl,{className:vn("text-xs flex items-center px-2 py-1",ce.bg,ce.text),children:[ce.icon,s.jsx("span",{children:P})]})},$=P=>P.user.hasSetPassword?"accepted":"pending",z=P=>{i&&i(P)},H=P=>{u(P),h(!0)},re=P=>{var Q;u(P),p(!0),L((Q=P==null?void 0:P.user)==null?void 0:Q.id)},ie=P=>{const Q=P.trim().split(" ");return Q.length===1?Q[0][0]:`${Q[0][0]}${Q[1][0]}`};b.useEffect(()=>{m&&c&&(v((c==null?void 0:c.user.username)??""),y((c==null?void 0:c.user.email)??""),C((c==null?void 0:c.user.name.en)??""),S((c==null?void 0:c.user.name.am)??""),_((c==null?void 0:c.user.phoneNumber)??""),M({}),E(""))},[m,c]);const X=async P=>{P.preventDefault();const Q={};if(x!=null&&x.trim()||(Q.email=N("profile.emailRequired")),f!=null&&f.trim()||(Q.userName=N("profile.usernameRequired")),R!=null&&R.trim()||(Q.phoneNumber=N("profile.phoneRequired")),w!=null&&w.trim()||(Q.englishName=N("profile.englishNameRequired")),j!=null&&j.trim()||(Q.amharicName=N("profile.amharicNameRequired")),M(Q),Object.keys(Q).length>0)return;if(!/^(\+2519\d{8}|09\d{8})$/.test(R??"")){E(N("profile.invalidPhoneFormat")),Ee.error(N("profile.invalidPhoneFormat"),{description:N("profile.validPhoneFormat")});return}if(!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(x??"")){E(N("profile.invalidEmailFormat")),Ee.error(N("profile.invalidEmailFormat"),{description:N("profile.validEmailFormat")});return}k(!0);try{await wu({email:x,username:f,phoneNumber:R,name:{am:j,en:w}},V),Ee.success(N("profile.profileUpdateSuccess"),{description:N("profile.profileUpdated")})}catch(W){const me=(W==null?void 0:W.message)||N("profile.profileUpdateFailed");E(me),Ee.error(N("profile.profileUpdateFailed"),{description:me})}finally{k(!1)}},oe=({employee:P})=>{const Q=$(P),ce=Q==="pending",te=Q==="Not Invited";return s.jsxs(ro,{children:[s.jsx(io,{asChild:!0,children:s.jsx(Be,{variant:"ghost",size:"icon",className:"h-8 w-8 hover:bg-gray-100 dark:hover:bg-gray-700",onClick:W=>W.stopPropagation(),children:s.jsx(_u,{className:"h-4 w-4"})})}),s.jsxs(lo,{align:"end",className:"w-48",children:[s.jsxs(ct,{onClick:W=>{W.stopPropagation(),H(P)},className:"cursor-pointer",children:[s.jsx(Mu,{className:"h-4 w-4 mr-2"}),N("viewDetail.viewDetail")]}),s.jsxs(ct,{onClick:W=>{W.stopPropagation(),re(P)},className:"cursor-pointer",children:[s.jsx(mu,{className:"h-4 w-4 mr-2"}),N("common.Edit")]}),i&&(ce||te)&&s.jsxs(ct,{onClick:W=>{W.stopPropagation(),z(P)},className:"cursor-pointer",children:[s.jsx(xi,{className:"h-4 w-4 mr-2"}),ce?N("Resend Invite"):N("Send Invite")]}),l&&s.jsxs(ct,{onClick:W=>{var le,de;W.stopPropagation();const me=typeof P.user.name=="string"?P.user.name:((le=P.user.name)==null?void 0:le.en)||((de=P.user.name)==null?void 0:de.am)||"User";l(e,n,P.id,me)},className:"cursor-pointer text-red-600 focus:text-red-600",children:[s.jsx(Ss,{className:"h-4 w-4 mr-2"}),N("signatureUpload.remove")]}),d&&s.jsxs(ct,{onClick:W=>{var le,de;W.stopPropagation();const me=typeof P.user.name=="string"?P.user.name:((le=P.user.name)==null?void 0:le.en)||((de=P.user.name)==null?void 0:de.am)||"User";d(P.id,me)},className:"cursor-pointer text-red-600 focus:text-red-600",children:[s.jsx(tg,{className:"h-4 w-4 mr-2"}),N("common.DeactivateUser")]})]})]})},ne=P=>{const Q=$(P);return s.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-gray-100 dark:border-gray-700 hover:bg-gray-50 dark:hover:bg-gray-700/50 transition-colors rounded-md gap-3 group",children:[s.jsxs("div",{className:"flex items-center gap-3 cursor-pointer flex-1 min-w-0",onClick:()=>H(P),children:[s.jsx(Zo,{className:"h-10 w-10 border border-gray-200 dark:border-gray-600 shrink-0",children:s.jsx(Jo,{className:"bg-gray-100 dark:bg-gray-700 text-gray-600 dark:text-gray-300",children:ie(D(P.user.name)).toUpperCase()})}),s.jsxs("div",{className:"flex flex-col min-w-0 flex-1",children:[s.jsx("span",{className:"text-sm font-medium text-gray-800 dark:text-gray-200 truncate",children:D(P.user.name)}),s.jsxs("div",{className:"flex items-center gap-4 text-xs text-gray-500 dark:text-gray-400 truncate",children:[s.jsxs("span",{className:"flex items-center gap-1 shrink-0",children:[s.jsx(Tt,{className:"h-3 w-3"}),P.user.userType||"Employee"]}),s.jsxs("span",{className:"flex items-center gap-1 shrink-0",children:[s.jsx(Su,{className:"h-3 w-3"}),P.user.phoneNumber||"Employee"]})]}),s.jsx("div",{className:"mt-1",children:F(Q)})]})]}),s.jsx("div",{className:"flex items-center gap-2",children:s.jsx(oe,{employee:P})})]},P.user.id)},J=()=>o?s.jsx("div",{className:"flex justify-center py-10",children:s.jsxs("div",{className:"flex flex-col items-center",children:[s.jsx("div",{className:"w-8 h-8 border-4 border-t-blue-500 border-blue-200 rounded-full animate-spin mb-2"}),s.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:"Loading team members..."})]})}):O.length>0?s.jsx("div",{className:"space-y-2",children:O.map(ne)}):t.length>0&&O.length===0?s.jsxs("div",{className:"text-center py-10 text-gray-500 dark:text-gray-400 bg-gray-50 dark:bg-gray-700/50 rounded-md",children:[s.jsx(Tt,{className:"h-12 w-12 mx-auto mb-2 text-gray-300 dark:text-gray-500"}),s.jsx("p",{className:"text-sm font-medium dark:text-gray-300",children:N("search.noResults")}),s.jsx("p",{className:"text-xs mt-1 text-gray-400 dark:text-gray-500",children:N("search.tryDifferentKeywords")})]}):s.jsxs("div",{className:"text-center py-10 text-gray-500 dark:text-gray-400 bg-gray-50 dark:bg-gray-700/50 rounded-md",children:[s.jsx(Tt,{className:"h-12 w-12 mx-auto mb-2 text-gray-300 dark:text-gray-500"}),s.jsx("p",{className:"text-sm font-medium dark:text-gray-300",children:e?N("contentManagement.msg1"):N("contentManagement.msg2")}),s.jsx("p",{className:"text-xs mt-1 text-gray-400 dark:text-gray-500",children:e?N("contentManagement.msg3"):N("contentManagement.msg4")})]});return s.jsxs("div",{className:"w-full",children:[J(),s.jsx(xt,{open:g,onOpenChange:P=>h(P),children:s.jsxs(bt,{className:"sm:max-w-md dark:bg-gray-800",children:[s.jsx(yt,{children:s.jsx(wt,{className:"text-center dark:text-white",children:N("contentManagement.userDetail")})}),c&&s.jsxs("div",{className:"flex flex-col items-center space-y-4 py-4",children:[s.jsx(Zo,{className:"w-20 h-20 border-2 border-gray-200 dark:border-gray-600",children:s.jsx(Jo,{className:"text-xl bg-blue-100 dark:bg-blue-900 text-blue-700 dark:text-blue-300",children:ie(D(c.user.name)).toUpperCase()})}),s.jsxs("div",{className:"text-center",children:[s.jsx("h2",{className:"text-xl font-semibold text-gray-800 dark:text-white",children:D(c.user.name)}),s.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:c.user.userType||"Employee"}),$(c)&&s.jsx("div",{className:"mt-2 flex justify-center",children:F($(c))})]}),s.jsxs("div",{className:"w-full space-y-3 mt-4",children:[s.jsxs("div",{className:"flex items-center gap-3 p-4 rounded-lg bg-gray-50 dark:bg-gray-700 border border-gray-200 dark:border-gray-600",children:[s.jsx("div",{className:"p-2 rounded-lg bg-primary-100 dark:bg-primary-900 text-primary-700 dark:text-primary-400",children:s.jsx(Tt,{className:"w-5 h-5"})}),s.jsxs("div",{children:[s.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:N("organization.username")}),s.jsx("p",{className:"font-medium text-gray-800 dark:text-gray-200",children:c.user.username||"Not provided"})]})]}),s.jsxs("div",{className:"flex items-center gap-3 p-4 rounded-lg bg-gray-50 dark:bg-gray-700 border border-gray-200 dark:border-gray-600",children:[s.jsx("div",{className:"p-2 rounded-lg bg-blue-100 dark:bg-blue-900 text-blue-700 dark:text-blue-400",children:s.jsx(ju,{className:"w-5 h-5"})}),s.jsxs("div",{children:[s.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:N("organization.email")}),s.jsx("p",{className:"font-medium text-gray-800 dark:text-gray-200",children:c.user.email||"Not provided"})]})]}),s.jsxs("div",{className:"flex items-center gap-3 p-4 rounded-lg bg-gray-50 dark:bg-gray-700 border border-gray-200 dark:border-gray-600",children:[s.jsx("div",{className:"p-2 rounded-lg bg-blue-100 dark:bg-blue-900 text-blue-700 dark:text-blue-400",children:s.jsx(Ju,{className:"w-5 h-5"})}),s.jsxs("div",{children:[s.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:N("organization.phoneNumber")}),s.jsx("p",{className:"font-medium text-gray-800 dark:text-gray-200",children:c.user.phoneNumber})]})]})]})]})]})}),s.jsx(xt,{open:m,onOpenChange:P=>p(P),children:s.jsxs(bt,{className:"sm:max-w-lg max-h-[80vh] overflow-y-auto [scrollbar-width:none] [-ms-overflow-style:none] [&::-webkit-scrollbar]:hidden dark:bg-gray-800",children:[s.jsx(yt,{children:s.jsx(wt,{className:"text-center dark:text-white",children:N("contentManagement.editEmployee")})}),c&&s.jsxs("div",{className:"flex flex-col items-center space-y-4 py-4",children:[s.jsx(Zo,{className:"w-20 h-20 border-2 border-gray-200 dark:border-gray-600",children:s.jsx(Jo,{className:"text-xl bg-blue-100 dark:bg-blue-900 text-blue-700 dark:text-blue-300",children:ie(D(c.user.name)).toUpperCase()})}),s.jsxs("div",{className:"text-center",children:[s.jsx("h2",{className:"text-xl font-semibold text-gray-800 dark:text-white",children:D(c.user.name)}),s.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:c.user.userType||"Employee"}),$(c)&&s.jsx("div",{className:"mt-2 flex justify-center",children:F($(c))})]}),s.jsxs(Cu.form,{initial:"hidden",animate:"show",className:"space-y-5 mt-6 w-full",onSubmit:X,children:[s.jsxs("div",{className:"relative flex items-center gap-3 p-4 rounded-lg bg-gray-50 dark:bg-gray-700 border border-gray-200 dark:border-gray-600",children:[s.jsx("div",{className:"p-2 rounded-lg bg-primary-100 dark:bg-primary-900 text-primary-700 dark:text-primary-400 shrink-0",children:s.jsx(Tt,{className:"w-5 h-5"})}),s.jsxs("div",{className:"flex-1",children:[s.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mb-1",children:N("organization.username")}),s.jsx(ze,{placeholder:N("profile.username"),value:f,onChange:P=>v(P.target.value),className:"w-full dark:bg-gray-600 dark:text-gray-200 dark:border-gray-500"}),B.userName&&s.jsx("p",{className:"text-sm text-red-600 mt-1",children:B.userName})]})]}),s.jsxs("div",{className:"relative flex items-center gap-3 p-4 rounded-lg bg-gray-50 dark:bg-gray-700 border border-gray-200 dark:border-gray-600",children:[s.jsx("div",{className:"p-2 rounded-lg bg-primary-100 dark:bg-primary-900 text-primary-700 dark:text-primary-400 shrink-0",children:s.jsx(Tt,{className:"w-5 h-5"})}),s.jsxs("div",{className:"flex-1",children:[s.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mb-1",children:N("profile.englishName")}),s.jsx(ze,{placeholder:N("profile.englishName"),value:w,onChange:P=>C(P.target.value),className:"w-full dark:bg-gray-600 dark:text-gray-200 dark:border-gray-500"}),B.englishName&&s.jsx("p",{className:"text-sm text-red-600 mt-1",children:B.englishName})]})]}),s.jsxs("div",{className:"relative flex items-center gap-3 p-4 rounded-lg bg-gray-50 dark:bg-gray-700 border border-gray-200 dark:border-gray-600",children:[s.jsx("div",{className:"p-2 rounded-lg bg-primary-100 dark:bg-primary-900 text-primary-700 dark:text-primary-400 shrink-0",children:s.jsx(Tt,{className:"w-5 h-5"})}),s.jsxs("div",{className:"flex-1",children:[s.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mb-1",children:N("profile.amharicName")}),s.jsx(ze,{placeholder:N("profile.amharicName"),value:j,onChange:P=>S(P.target.value),className:"w-full dark:bg-gray-600 dark:text-gray-200 dark:border-gray-500"}),B.amharicName&&s.jsx("p",{className:"text-sm text-red-600 mt-1",children:B.amharicName})]})]}),s.jsxs("div",{className:"relative flex items-center gap-3 p-4 rounded-lg bg-gray-50 dark:bg-gray-700 border border-gray-200 dark:border-gray-600",children:[s.jsx("div",{className:"p-2 rounded-lg bg-primary-100 dark:bg-primary-900 text-primary-700 dark:text-primary-400 shrink-0",children:s.jsx(Tt,{className:"w-5 h-5"})}),s.jsxs("div",{className:"flex-1",children:[s.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mb-1",children:N("organization.email")}),s.jsx(ze,{placeholder:N("profile.email"),value:x,onChange:P=>y(P.target.value),className:"w-full dark:bg-gray-600 dark:text-gray-200 dark:border-gray-500"}),B.email&&s.jsx("p",{className:"text-sm text-red-600 mt-1",children:B.email})]})]}),s.jsxs("div",{className:"relative flex items-center gap-3 p-4 rounded-lg bg-gray-50 dark:bg-gray-700 border border-gray-200 dark:border-gray-600",children:[s.jsx("div",{className:"p-2 rounded-lg bg-primary-100 dark:bg-primary-900 text-primary-700 dark:text-primary-400 shrink-0",children:s.jsx(Tt,{className:"w-5 h-5"})}),s.jsxs("div",{className:"flex-1",children:[s.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mb-1",children:N("organization.phoneNumber")}),s.jsx(ze,{placeholder:N("profile.phoneNumber"),value:R,onChange:P=>_(P.target.value),className:"w-full dark:bg-gray-600 dark:text-gray-200 dark:border-gray-500"}),B.phoneNumber&&s.jsx("p",{className:"text-sm text-red-600 mt-1",children:B.phoneNumber})]})]}),s.jsx(Be,{type:"submit",className:"w-full h-11 bg-primary hover:bg-primary-700 text-white font-medium text-sm shadow-md rounded-lg",disabled:T,children:T?s.jsxs("span",{className:"flex items-center justify-center",children:[s.jsx(xi,{className:"animate-spin h-5 w-5 mr-2"}),N("profile.updating"),"..."]}):N("profile.updateProfile")})]})]})]})})]})};function sp({unitId:e,organizationId:n,onSuccess:t,onCancel:o}){const{createPosition:a,isCreating:r}=An(),{commonPositionTypes:i,isLoading:l}=tr({unitId:e}),[d,c]=b.useState(""),[u,g]=b.useState(""),[h,m]=b.useState(""),[p,f]=b.useState(""),v=Xt.language,[x,y]=b.useState({}),w=()=>{const j={};return d.trim()||(j.nameEn=N("organization.englishNameRequired")),u.trim()||(j.nameAm=N("organization.amharicNameRequired")),h.trim()||(j.key=N("contentManagement.keyRequired")),p||(j.positionTypeId=N("contentManagement.selectPosType")),y(j),Object.keys(j).length===0},C=j=>{if(j.preventDefault(),!w()){Ee.error(N("contentManagement.invalidMsg"));return}const S={name:{en:d.trim(),am:u.trim()},key:h.trim().toLowerCase().replace(/\s+/g,"-"),unitId:e,organizationId:n,positionTypeId:p};a({payload:S,successCallback:()=>{Ee.success(N("contentManagement.success"),{description:`${N("userIncoming.Department")} "${v==="en"?d:u}" ${N("contentManagement.msg")}`}),t(v==="en"?d.trim():u.trim())}})};return s.jsxs("form",{onSubmit:C,className:"space-y-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(Ue,{htmlFor:"positionType",children:N("organization.positionTypes")}),s.jsxs(an,{onValueChange:j=>{f(j),y(S=>({...S,positionTypeId:""}))},value:p,disabled:l,children:[s.jsx(rn,{children:s.jsx(ln,{placeholder:N("contentManagement.selectPosType")})}),s.jsx(cn,{className:"max-h-60 overflow-y-auto",children:i.map(j=>s.jsx(Ft,{value:j.id,children:v==="en"?j.name.en:j.name.am},j.id))})]}),x.positionTypeId&&s.jsx("p",{className:"text-red-500 text-sm",children:x.positionTypeId})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Ue,{htmlFor:"nameEn",children:N("organization.enterEnglishName")}),s.jsx(ze,{id:"nameEn",placeholder:N("organization.enterEnglishName"),value:d,onChange:j=>{c(j.target.value),y(S=>({...S,nameEn:""}))}}),x.nameEn&&s.jsx("p",{className:"text-red-500 text-sm",children:x.nameEn})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Ue,{htmlFor:"nameAm",children:N("organization.enterAmharicName")}),s.jsx(ze,{id:"nameAm",placeholder:N("organization.enterAmharicName"),value:u,onChange:j=>{g(j.target.value),y(S=>({...S,nameAm:""}))}}),x.nameAm&&s.jsx("p",{className:"text-red-500 text-sm",children:x.nameAm})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Ue,{htmlFor:"key",children:N("contentManagement.key")}),s.jsx(ze,{id:"key",placeholder:"e.g. finance-department",value:h,onChange:j=>{m(j.target.value),y(S=>({...S,key:""}))}}),x.key&&s.jsx("p",{className:"text-red-500 text-sm",children:x.key})]}),s.jsxs("div",{className:"flex justify-end gap-2",children:[s.jsx(Be,{type:"button",variant:"outline",onClick:o,disabled:r,children:N("common.Cancel")}),s.jsx(Be,{type:"submit",disabled:r,children:r?N("organization.adding"):N("contentManagement.addDepartment")})]})]})}function op({isOpen:e,onClose:n,organizationId:t,unitId:o}){const a=r=>{n()};return s.jsx(xt,{open:e,onOpenChange:r=>!r&&n(),children:s.jsxs(bt,{className:"sm:max-w-[425px]",children:[s.jsx(yt,{children:s.jsx(wt,{children:N("contentManagement.addDepartment")})}),s.jsx(sp,{unitId:o,organizationId:t,onSuccess:a,onCancel:n})]})})}function ap({unitId:e,onSuccess:n,onCancel:t}){const[o,a]=b.useState({firstName:"",lastName:"",email:"",role:"member"}),[r,i]=b.useState(!1),{toast:l}=yl();Xt.language;const d=g=>{const{name:h,value:m}=g.target;a(p=>({...p,[h]:m}))},c=g=>{a(h=>({...h,role:g}))},u=async g=>{if(g.preventDefault(),!o.firstName.trim()||!o.lastName.trim()||!o.email.trim()){l({title:"Error",description:"All fields are required",variant:"destructive"});return}i(!0);try{await new Promise(h=>setTimeout(h,500)),l({title:N("contentManagement.success"),description:`${N("contentManagement.user")} ${o.firstName} ${o.lastName}${N("contentManagement.msg")}`}),n()}catch{l({title:"Error",description:"Failed to add user. Please try again.",variant:"destructive"})}finally{i(!1)}};return s.jsxs("form",{onSubmit:u,className:"space-y-4",children:[s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(Ue,{htmlFor:"firstName",children:N("contentManagement.firstName")}),s.jsx(ze,{id:"firstName",name:"firstName",placeholder:N("contentManagement.firstName"),value:o.firstName,onChange:d,required:!0})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Ue,{htmlFor:"lastName",children:N("contentManagement.lastName")}),s.jsx(ze,{id:"lastName",name:"lastName",placeholder:N("contentManagement.lastName"),value:o.lastName,onChange:d,required:!0})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Ue,{htmlFor:"email",children:N("organization.email")}),s.jsx(ze,{id:"email",name:"email",type:"email",placeholder:N("organization.email"),value:o.email,onChange:d,required:!0})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Ue,{htmlFor:"role",children:"Role"}),s.jsxs(an,{value:o.role,onValueChange:c,children:[s.jsx(rn,{children:s.jsx(ln,{placeholder:"Select a role"})}),s.jsxs(cn,{children:[s.jsx(Ft,{value:"Director",children:"Director"}),s.jsx(Ft,{value:"Teamleader",children:"Teamleader"}),s.jsx(Ft,{value:"deputy",children:"deputy"})]})]})]}),s.jsxs("div",{className:"flex justify-end gap-2",children:[s.jsx(Be,{type:"button",variant:"outline",onClick:t,disabled:r,children:N("common.Cancel")}),s.jsx(Be,{type:"submit",disabled:r,children:r?N("organization.adding"):N("organization.addUser")})]})]})}function rp({isOpen:e,onClose:n,unitId:t}){const o=()=>{n()};return s.jsx(xt,{open:e,onOpenChange:a=>!a&&n(),children:s.jsxs(bt,{className:"sm:max-w-[500px]",children:[s.jsx(yt,{children:s.jsx(wt,{children:"Add New User"})}),s.jsx(ap,{unitId:t,onSuccess:o,onCancel:n})]})})}function ip({unitId:e,onClose:n}){const[t,o]=b.useState([]),[a,r]=b.useState(!0),[i,l]=b.useState("");b.useEffect(()=>{(async()=>{r(!0);try{await new Promise(g=>setTimeout(g,800)),o([{id:"1",name:"Abebe Kebede",email:"abebe@example.com",role:"Admin",department:"Management"},{id:"2",name:"Tigist Haile",email:"tigist@example.com",role:"Manager",department:"Finance"},{id:"3",name:"Dawit Mekonnen",email:"dawit@example.com",role:"Member",department:"Operations"},{id:"4",name:"Hanna Girma",email:"hanna@example.com",role:"Member",department:"HR"}])}catch{o([])}finally{r(!1)}})()},[e]);const d=t.filter(u=>{if(!i)return!0;const g=i.toLowerCase();return u.name.toLowerCase().includes(g)||u.email.toLowerCase().includes(g)||u.role.toLowerCase().includes(g)||u.department&&u.department.toLowerCase().includes(g)}),c=u=>{switch(u.toLowerCase()){case"admin":return"bg-red-100 text-red-800";case"manager":return"bg-blue-100 text-blue-800";default:return"bg-primary-100 text-primary-800"}};return s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"relative",children:[s.jsx(St,{className:"absolute left-2.5 top-2.5 h-4 w-4 text-gray-500"}),s.jsx(ze,{placeholder:"Search users...",className:"pl-8",value:i,onChange:u=>l(u.target.value)})]}),s.jsx("div",{className:"border rounded-md overflow-hidden dark:border-gray-700",children:a?s.jsx("div",{className:"flex justify-center items-center p-8",children:s.jsx("p",{className:"text-gray-500 dark:text-gray-400",children:"Loading users..."})}):d.length>0?s.jsxs("table",{className:"w-full",children:[s.jsx("thead",{className:"bg-gray-50 dark:bg-gray-700",children:s.jsxs("tr",{children:[s.jsx("th",{className:"px-4 py-2 text-left text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:"Name"}),s.jsx("th",{className:"px-4 py-2 text-left text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:"Email"}),s.jsx("th",{className:"px-4 py-2 text-left text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:"Role"}),s.jsx("th",{className:"px-4 py-2 text-left text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:"Department"})]})}),s.jsx("tbody",{className:"bg-white dark:bg-gray-800 divide-y divide-gray-200 dark:divide-gray-700",children:d.map(u=>s.jsxs("tr",{className:"hover:bg-gray-50 dark:hover:bg-gray-700/50",children:[s.jsx("td",{className:"px-4 py-2 whitespace-nowrap text-gray-900 dark:text-gray-100",children:u.name}),s.jsx("td",{className:"px-4 py-2 whitespace-nowrap text-gray-500 dark:text-gray-400",children:u.email}),s.jsx("td",{className:"px-4 py-2 whitespace-nowrap",children:s.jsx(jl,{className:c(u.role),children:u.role})}),s.jsx("td",{className:"px-4 py-2 whitespace-nowrap text-gray-500 dark:text-gray-400",children:u.department||"-"})]},u.id))})]}):s.jsx("div",{className:"flex justify-center items-center p-8 text-gray-500",children:"No users found"})}),s.jsx("div",{className:"flex justify-end",children:s.jsx(Be,{onClick:n,children:"Close"})})]})}function lp({isOpen:e,onClose:n,unitId:t,unitName:o}){return s.jsx(xt,{open:e,onOpenChange:a=>!a&&n(),children:s.jsxs(bt,{className:"sm:max-w-[800px] max-h-[80vh] overflow-y-auto",children:[s.jsx(yt,{children:s.jsx(wt,{children:o?`Users in ${o}`:"Team Members"})}),s.jsx(ip,{unitId:t,onClose:n})]})})}function cp({departmentId:e,departmentName:n,organizationId:t,unitId:o,onSuccess:a,onCancel:r}){const{createPosition:i,isCreating:l}=An(),{commonPositionTypes:d,isLoading:c}=tr({unitId:o,params:{take:1e3,skip:0,orderBy:"createdAt:Desc"}}),[u,g]=b.useState(""),[h,m]=b.useState(""),[p,f]=b.useState(""),[v,x]=b.useState(""),y=Xt.language,[w,C]=b.useState({}),j=()=>{const _={};return u.trim()||(_.nameEn=N("organization.englishNameRequired")),h.trim()||(_.nameAm=N("organization.amharicNameRequired")),p.trim()||(_.key=N("contentManagement.keyRequired")),v||(_.positionTypeId=N("contentManagement.selectPosType")),C(_),Object.keys(_).length===0},S=_=>{if(_.preventDefault(),!j()){Ee.error(N("contentManagement.invalidMsg"));return}const T={name:{en:u.trim(),am:h.trim()},key:p.trim().toLowerCase().replace(/\s+/g,"-"),unitId:o,organizationId:t,parentPositionId:e,positionTypeId:v};i({payload:T,successCallback:()=>{a(u.trim()),Ee.success(N("contentManagement.success"),{description:`${N("contentManagement.subDep")} "${y==="en"?u:h}${N("contentManagement.msg")}`})}})},R=Lt();return s.jsxs("form",{onSubmit:S,className:"space-y-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(Ue,{htmlFor:"parentDepartment",children:N("contentManagement.parentDep")}),s.jsx(ze,{id:"parentDepartment",value:n,disabled:!0,className:"bg-gray-50"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Ue,{htmlFor:"positionType",children:N("organization.positionTypes")}),s.jsxs(an,{onValueChange:_=>{x(_),C(T=>({...T,positionTypeId:""}))},value:v,disabled:c,children:[s.jsx(rn,{children:s.jsx(ln,{placeholder:N("contentManagement.selectPosType")})}),s.jsx(cn,{className:"max-h-60 overflow-y-auto",children:d.map(_=>s.jsx(Ft,{value:_.id,children:R(_.name)},_.id))})]}),w.positionTypeId&&s.jsx("p",{className:"text-red-500 text-sm",children:w.positionTypeId})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Ue,{htmlFor:"nameEn",children:N("organization.enterEnglishName")}),s.jsx(ze,{id:"nameEn",placeholder:N("organization.enterEnglishName"),value:u,onChange:_=>{g(_.target.value),C(T=>({...T,nameEn:""}))}}),w.nameEn&&s.jsx("p",{className:"text-red-500 text-sm",children:w.nameEn})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Ue,{htmlFor:"nameAm",children:N("organization.enterAmharicName")}),s.jsx(ze,{id:"nameAm",placeholder:N("organization.enterAmharicName"),value:h,onChange:_=>{m(_.target.value),C(T=>({...T,nameAm:""}))}}),w.nameAm&&s.jsx("p",{className:"text-red-500 text-sm",children:w.nameAm})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Ue,{htmlFor:"key",children:N("contentManagement.key")}),s.jsx(ze,{id:"key",placeholder:N("contentManagement.key"),value:p,onChange:_=>{f(_.target.value),C(T=>({...T,key:""}))}}),w.key&&s.jsx("p",{className:"text-red-500 text-sm",children:w.key})]}),s.jsxs("div",{className:"flex justify-end gap-2",children:[s.jsx(Be,{type:"button",variant:"outline",onClick:r,disabled:l,children:N("common.Cancel")}),s.jsx(Be,{type:"submit",disabled:l,children:l?N("organization.adding"):N("contentManagement.addSubdepartement")})]})]})}function dp({isOpen:e,onClose:n,departmentId:t,organizationId:o,unitId:a,departmentName:r}){const i=l=>{n()};return s.jsx(xt,{open:e,onOpenChange:l=>!l&&n(),children:s.jsxs(bt,{className:"sm:max-w-[425px]",children:[s.jsx(yt,{children:s.jsx(wt,{children:"Add New Sub-Department"})}),s.jsx(cp,{departmentId:t,departmentName:r,organizationId:o,unitId:a,onSuccess:i,onCancel:n})]})})}function up({unitId:e,positionId:n,positionName:t,onSuccess:o,onCancel:a}){const{assignEmployee:r,isAssigning:i}=co(),{employeesResponse:l,isLoading:d}=Nu({unitId:e}),{handleError:c}=hu(N),[u,g]=b.useState(""),[h,m]=b.useState({}),[p,f]=b.useState(1),[v,x]=b.useState(""),y=20,w=(l==null?void 0:l.items)||[],C=Xt.language,j=b.useMemo(()=>v.trim()?w.filter(_=>{var I,E;const T=C==="en"?(I=_.name)==null?void 0:I.en:(E=_.name)==null?void 0:E.am,k=_.email||"";return(T==null?void 0:T.toLowerCase().includes(v.toLowerCase()))||k.toLowerCase().includes(v.toLowerCase())}):w,[w,v,C]),S=_=>{const{scrollTop:T,scrollHeight:k,clientHeight:I}=_.currentTarget;T+I>=k-5&&p*y<j.length&&f(E=>E+1)},R=async _=>{if(_.preventDefault(),!u){m({selectedUser:N("contentManagement.userRequired")}),Ee.error(N("contentManagement.userRequiredMsg"));return}const T=u;if(!T){Ee.error(N("contentManagement.userError"));return}r({positionId:n,employeeId:T},{onSuccess:()=>{Ee.success(N("contentManagement.userSuccess")),o()},onError:I=>{c(I)}})};return s.jsxs("form",{onSubmit:R,className:"space-y-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(Ue,{htmlFor:"user",children:N("contentManagement.selectUser")}),s.jsxs(an,{value:u,onValueChange:_=>{g(_),m(T=>({...T,selectedUser:""}))},disabled:d,children:[s.jsx(rn,{children:s.jsx(ln,{placeholder:N("contentManagement.selectUser")})}),s.jsxs(cn,{style:{maxHeight:"300px",overflowY:"auto"},onScroll:S,children:[s.jsx("div",{className:"sticky top-0 z-10 bg-background p-2 border-b",children:s.jsxs("div",{className:"relative",children:[s.jsx(St,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 text-gray-400 h-4 w-4"}),s.jsx(ze,{type:"text",placeholder:N("organization.searchUsers"),value:v,onChange:_=>{_.stopPropagation(),x(_.target.value),f(1)},onClick:_=>_.stopPropagation(),className:"pl-10 h-9 text-sm"})]})}),j.length>0?j.slice(0,p*y).map(_=>{var T,k;return s.jsx(Ft,{value:_==null?void 0:_.id,children:s.jsxs("div",{className:"flex flex-col",children:[s.jsx("span",{children:C==="en"?(T=_.name)==null?void 0:T.en:((k=_.name)==null?void 0:k.am)||_.email||"Unnamed User"}),_.email&&s.jsx("span",{className:"text-xs text-gray-500",children:_.email})]})},_.id)}):s.jsx("div",{className:"text-center py-4 text-sm text-muted-foreground",children:v?N("organization.noUsersFound"):N("organization.noUsersAvailable")}),d&&s.jsx("div",{className:"text-center py-2 text-sm text-muted-foreground",children:N("contentManagement.loading")})]})]}),h.selectedUser&&s.jsx("p",{className:"text-red-500 text-sm",children:h.selectedUser})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Ue,{children:N("organization.Position")}),s.jsx("div",{className:"px-3 py-2 border rounded text-sm text-muted-foreground bg-muted",children:t||"Unknown"})]}),s.jsxs("div",{className:"flex justify-end gap-2",children:[s.jsx(Be,{type:"button",variant:"outline",onClick:a,disabled:i,children:N("common.Cancel")}),s.jsx(Be,{type:"submit",disabled:i||d,children:i?"Assigning...":"Assign User"})]})]})}function gp({isOpen:e,onClose:n,departmentId:t,departmentName:o,unitId:a}){const r=()=>{n()};return s.jsx(xt,{open:e,onOpenChange:i=>!i&&n(),children:s.jsxs(bt,{className:"sm:max-w-[600px] max-h-[80vh] overflow-y-auto",children:[s.jsx(yt,{children:s.jsxs(wt,{children:["Assign User to ",o]})}),s.jsx("div",{className:"mt-4",children:s.jsx(up,{positionId:t,unitId:a,positionName:o,onSuccess:r,onCancel:n})})]})})}const mp=({currentOrgId:e})=>{const[n,t]=b.useState([]),[o,a]=b.useState(!0),{organizationsResponse:r}=Du("Org",{take:3e3});return b.useEffect(()=>{var i;if(r!=null&&r.items){const l=(i=r==null?void 0:r.items)==null?void 0:i.filter(c=>c.id===e),d=l==null?void 0:l.map(c=>({id:c.id,name:c.name}));t(d),a(!1)}},[r]),{organizations:n,isLoading:o}},hp=(e,n)=>{const[t,o]=b.useState([]),[a,r]=b.useState([]),{getList:i}=zn(),{data:l,isLoading:d}=i(e,n);return b.useEffect(()=>{var c,u,g;if((c=l==null?void 0:l.data)!=null&&c.items){r((u=l==null?void 0:l.data)==null?void 0:u.items);const h=(g=l==null?void 0:l.data)==null?void 0:g.items.map(m=>({id:m.id,name:m.name}));o(h)}},[l]),{units:t,isLoading:d,setUnits:o,fetchedUnits:a}},pc=e=>({id:e.id,name:e.name,parentId:e.parentPositionId,...e.subPositions.length>0&&{children:e.subPositions.map(pc)}}),pp=e=>{const[n,t]=b.useState([]),[o,a]=b.useState([]),{usePositionHierarchy:r}=An(),{data:i,isLoading:l}=r(e);return b.useEffect(()=>{if(i){const d=i,c=d.map(pc);a(d),t(c)}},[i]),{departments:n,isLoading:l,setDepartments:t,positions:o}},fp=e=>{const[n,t]=b.useState([]),{useEmployeesUnderPosition:o}=An(),{data:a,isLoading:r,refetch:i}=o(e);return b.useEffect(()=>{a&&t(a.data)},[a]),{employees:n,isLoading:r,setEmployees:t,refetch:async()=>{i&&await i()}}},vp=(e,n)=>{const t=kt(),[o,a]=b.useState(""),[r,i]=b.useState(""),[l,d]=b.useState(""),[c,u]=b.useState(""),[g,h]=b.useState([]);return{selectedOrgId:o,selectedUnitId:r,selectedDepartmentId:l,selectedDepartmentName:c,breadcrumb:g,handleSelectOrganization:v=>{t.invalidateQueries({queryKey:["unitList"]}),a(v),i(""),d("");const x=e.find(y=>y.id===v);x&&h([{id:x.id,name:x.name}])},handleSelectUnit:(v,x)=>{t.invalidateQueries({queryKey:["positionHierarchy"]}),i(v),d("");const y=x.find(C=>C.id===v),w=e.find(C=>C.id===o);y&&w&&h([{id:w.id,name:w.name},{id:y.id,name:y.name}])},handleSelectDepartment:(v,x)=>{t.invalidateQueries({queryKey:["positionEmployees"]}),d(v);const y=x.find(j=>j.id===v),w=g.find(j=>j.id===r),C=g.find(j=>j.id===o);y!=null&&y.name&&u(n(y==null?void 0:y.name)||""),y&&w&&C&&h([{id:C.id,name:C.name},{id:w.id,name:w.name},{id:y.id,name:y.name}])}}},xp=({selectedOrgId:e,selectedUnitId:n,toast:t})=>{const[o,a]=b.useState(!1),[r,i]=b.useState(!1),[l,d]=b.useState(!1),[c,u]=b.useState(!1),[g,h]=b.useState(!1),[m,p]=b.useState(!1),[f,v]=b.useState(!1),[x,y]=b.useState(!1),[w,C]=b.useState(!1),[j,S]=b.useState(!1),[R,_]=b.useState(!1),[T,k]=b.useState(!1),[I,E]=b.useState(!1),[V,L]=b.useState(""),[B,M]=b.useState(""),[D,O]=b.useState(""),[F,$]=b.useState(""),[z,H]=b.useState(!1),[re,ie]=b.useState(""),[X,oe]=b.useState(""),[ne,J]=b.useState(""),[P,Q]=b.useState(""),ce=te=>{t(te)};return{handleSelectOrganization:te=>{ie(te)},unit:{onAddDepartment:()=>{ie(re),oe(n),u(!0)},onEditUnit:te=>{oe(te||n),a(!0)},onDeleteUnit:(te,W)=>{oe(te),J(W),i(!0)},onAddFromSubCity:te=>{oe(te),d(!0)}},department:{onAddUserUnderDepartment:(te,W)=>{L(te),M(W),C(!0)},onEditDepartment:(te,W)=>{L(te),M(W),h(!0)},onDeleteDepartment:(te,W)=>{L(te),M(W),p(!0)},onMoveDepartment:(te,W)=>{L(te),M(W),v(!0)},onViewUsers:()=>ce({title:"View Users"}),onAddSubDepartment:(te,W)=>{L(te),ie(e),oe(n),M(W),y(!0)},onAssignUser:(te,W)=>{L(te),M(W),ie(e),oe(n),k(!0)},onDelegate:()=>ce({title:"Delegate"})},teamMember:{onDeleteTeamMember:(te,W,me,le)=>{L(te),M(W),E(!0),O(me),$(le)},onDeactivateTeamMember:(te,W)=>{Q(te),$(W),H(!0)}},dialogs:{editUnit:{isOpen:o,onClose:()=>a(!1),unitId:X},deleteUnit:{isOpen:r,onClose:()=>i(!1),unitId:X,unitName:ne},addFromSubCity:{isOpen:l,onClose:()=>d(!1),parentUnitId:X},department:{isOpen:c,onClose:()=>u(!1),organizationId:re,unitId:X},editDepartment:{isOpen:g,onClose:()=>h(!1),departmentId:V,departmentName:B},deleteDepartment:{isOpen:m,onClose:()=>p(!1),departmentId:V,departmentName:B},moveDepartment:{isOpen:f,onClose:()=>v(!1),departmentId:V,departmentName:B},userUnderDepartment:{isOpen:w,onClose:()=>C(!1),departmentId:V,departmentName:B},subDepartment:{isOpen:x,onClose:()=>y(!1),departmentId:V,departmentName:B,organizationId:re,unitId:X},user:{unitId:X,isOpen:j,onClose:()=>S(!1)},viewUsers:{unitId:X,isOpen:R,onClose:()=>_(!1)},assignUser:{isOpen:T,onClose:()=>k(!1),departmentId:V,departmentName:B,organizationId:re,unitId:X},deleteTeamMember:{isOpen:I,onClose:()=>E(!1),departmentId:V,departmentName:B,teamMemberId:D,teamMemberName:F},deactivateTeamMember:{isOpen:z,onClose:()=>H(!1),userId:P,teamMemberName:F}}}},bp=({breadcrumb:e,hasTeamMembers:n})=>{const t=Lt();return s.jsxs("div",{className:"flex items-center text-sm text-gray-500 mb-4 overflow-x-auto",children:[s.jsx("span",{className:"font-medium",children:"User Management"}),e.map((o,a)=>s.jsxs("div",{className:"flex items-center",children:[s.jsx(Js,{className:"h-4 w-4 mx-2 flex-shrink-0"}),s.jsx("span",{className:a===e.length-1?"font-medium text-gray-800":"",children:t(o.name)})]},o.id)),n&&s.jsxs("div",{className:"flex items-center",children:[s.jsx(Js,{className:"h-4 w-4 mx-2 flex-shrink-0"}),s.jsx("span",{className:"font-medium text-gray-800",children:"Team Members"})]})]})};function yp({departmentId:e,departmentName:n,onSuccess:t,onCancel:o}){const{invite:a,isInviting:r}=co(),i=Xt.language,[l,d]=b.useState({positionId:e,username:"",email:"",phoneNumber:"",name:{am:"",en:""}}),[c,u]=b.useState({username:"",email:"",phoneNumber:"",nameAm:"",nameEn:""}),g=(p,f,v)=>{p==="name"&&v?(d(x=>({...x,name:{...x.name,[v]:f}})),u(x=>({...x,[`name${v.toUpperCase()}`]:""}))):(d(x=>({...x,[p]:f})),u(x=>({...x,[p]:""})))},h=()=>{const p={username:"",email:"",phoneNumber:"",nameAm:"",nameEn:""};let f=!0;return l.username.trim()||(p.username=N("profile.usernameRequired"),f=!1),l.email.trim()?/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(l.email)||(p.email=N("profile.validEmailFormat"),f=!1):(p.email=N("profile.emailRequired"),f=!1),l.phoneNumber.trim()?Tu(l.phoneNumber)||(p.phoneNumber=N("profile.validPhoneFormat"),f=!1):(p.phoneNumber=N("profile.phoneRequired"),f=!1),l.name.am.trim()||(p.nameAm=N("profile.amharicNameRequired"),f=!1),l.name.en.trim()||(p.nameEn=N("profile.englishNameRequired"),f=!1),u(p),f},m=async p=>{p.preventDefault(),h()&&a({payload:l,successCallback:()=>{Ee.success("User invited",{description:`User "${i==="en"?l.name.en:l.name.am}" has been added to the department.`}),t()}})};return s.jsxs("form",{onSubmit:m,className:"space-y-4",children:[s.jsxs("div",{children:[s.jsx(Ue,{children:N("organization.Position")}),s.jsx(ze,{value:n,disabled:!0})]}),s.jsxs("div",{children:[s.jsxs(Ue,{children:[N("organization.username")," *"]}),s.jsx(ze,{value:l.username,onChange:p=>g("username",p.target.value)}),c.username&&s.jsx("p",{className:"text-red-500 text-sm",children:c.username})]}),s.jsxs("div",{children:[s.jsxs(Ue,{children:[N("organization.email")," *"]}),s.jsx(ze,{type:"email",value:l.email,onChange:p=>g("email",p.target.value)}),c.email&&s.jsx("p",{className:"text-red-500 text-sm",children:c.email})]}),s.jsxs("div",{children:[s.jsx(Ue,{children:N("auth.phoneNumber")}),s.jsx(ze,{type:"tel",placeholder:"0912345678 or +251912345678",value:l.phoneNumber,onChange:p=>g("phoneNumber",p.target.value)}),c.phoneNumber&&s.jsx("p",{className:"text-red-500 text-sm",children:c.phoneNumber})]}),s.jsxs("div",{children:[s.jsxs(Ue,{children:[N("organization.enterAmharicName"),"*"]}),s.jsx(ze,{value:l.name.am,onChange:p=>g("name",p.target.value,"am")}),c.nameAm&&s.jsx("p",{className:"text-red-500 text-sm",children:c.nameAm})]}),s.jsxs("div",{children:[s.jsxs(Ue,{children:[N("organization.enterEnglishName"),"*"]}),s.jsx(ze,{value:l.name.en,onChange:p=>g("name",p.target.value,"en")}),c.nameEn&&s.jsx("p",{className:"text-red-500 text-sm",children:c.nameEn})]}),s.jsxs("div",{className:"flex justify-end gap-2",children:[s.jsx(Be,{type:"button",variant:"outline",onClick:o,disabled:r,children:N("common.Cancel")}),s.jsx(Be,{type:"submit",disabled:r,children:r?N("organization.adding"):N("organization.addUser")})]})]})}function wp({isOpen:e,onClose:n,departmentId:t,departmentName:o}){const{t:a}=vl(),r=()=>{n()};return s.jsx(xt,{open:e,onOpenChange:i=>!i&&n(),children:s.jsxs(bt,{className:"sm:max-w-[525px]",children:[s.jsx(yt,{children:s.jsx(wt,{children:a("userRecord.Add User Under Department")})}),s.jsx(yp,{departmentId:t,departmentName:o,onSuccess:r,onCancel:n})]})})}function Cp({departmentId:e,onSuccess:n,onCancel:t}){const{updatePosition:o,isUpdating:a}=An(),[r,i]=b.useState(""),[l,d]=b.useState(""),[c,u]=b.useState(""),[g,h]=b.useState(""),[m,p]=b.useState(""),[f,v]=b.useState(""),{commonPositionTypes:x,isLoadingCommonTypes:y}=tr({unitId:g,params:{take:1e3,skip:0,orderBy:"createdAt:Desc"}}),[w,C]=b.useState({}),[j,S]=b.useState(!0),R=Xt.language,_=Lt();b.useEffect(()=>{(async()=>{try{const V=(await Iu(e)).data;i(V.name.en),d(V.name.am),u(V.key),h(V.unitId),p(V.organizationId),v(V.positionTypeId)}catch{Ee.error("Failed to fetch department")}finally{S(!1)}})()},[e]),b.useEffect(()=>{g&&x.length>0&&(x.find(E=>E.id===f)||v(""))},[g,x,f]);const T=()=>{const I={};return r.trim()||(I.nameEn=N("organization.englishNameRequired")),l.trim()||(I.nameAm=N("organization.amharicNameRequired")),f||(I.positionTypeId=N("contentManagement.selectPosType")),C(I),Object.keys(I).length===0},k=I=>{if(I.preventDefault(),!T()){Ee.error(N("contentManagement.invalidMsg"));return}const E={name:{en:r.trim(),am:l.trim()},key:c.trim().toLowerCase().replace(/\s+/g,"-"),unitId:g,organizationId:m,positionTypeId:f};o({id:e,payload:E,successCallback:()=>{Ee.success(N("contentManagement.success"),{description:`${N("contentManagement.department")} "${R==="en"?r:l}" ${N("contentManagement.updated")}`}),n(r.trim())}})};return j?s.jsxs("div",{className:"text-sm text-muted-foreground",children:[" ",N("contentManagement.loading")]}):s.jsxs("form",{onSubmit:k,className:"space-y-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(Ue,{htmlFor:"positionType",children:N("organization.positionTypes")}),s.jsxs(an,{onValueChange:I=>{v(I),C(E=>({...E,positionTypeId:""}))},value:f,disabled:y,children:[s.jsx(rn,{children:s.jsx(ln,{placeholder:N("contentManagement.selectPosType")})}),s.jsx(cn,{className:"max-h-60 overflow-y-auto",children:x.map(I=>s.jsx(Ft,{value:I.id,children:_(I.name)},I.id))})]}),w.positionTypeId&&s.jsx("p",{className:"text-red-500 text-sm",children:w.positionTypeId})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Ue,{htmlFor:"nameEn",children:N("organization.enterEnglishName")}),s.jsx(ze,{id:"nameEn",placeholder:N("organization.enterEnglishName"),value:r,onChange:I=>{i(I.target.value),C(E=>({...E,nameEn:""}))}}),w.nameEn&&s.jsx("p",{className:"text-red-500 text-sm",children:w.nameEn})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Ue,{htmlFor:"nameAm",children:N("organization.enterAmharicName")}),s.jsx(ze,{id:"nameAm",placeholder:N("organization.enterAmharicName"),value:l,onChange:I=>{d(I.target.value),C(E=>({...E,nameAm:""}))}}),w.nameAm&&s.jsx("p",{className:"text-red-500 text-sm",children:w.nameAm})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Ue,{htmlFor:"key",children:N("contentManagement.key")}),s.jsx(ze,{id:"key",placeholder:"e.g. finance-department",value:c,disabled:!0})]}),s.jsxs("div",{className:"flex justify-end gap-2",children:[s.jsx(Be,{type:"button",variant:"outline",onClick:t,disabled:a,children:N("common.Cancel")}),s.jsx(Be,{type:"submit",disabled:a,children:a?N("profile.updating"):N("delegation.update")})]})]})}function jp({isOpen:e,onClose:n,postions:t,departmentId:o,departmentName:a}){const r=i=>{n()};return s.jsx(xt,{open:e,onOpenChange:i=>!i&&n(),children:s.jsxs(bt,{className:"sm:max-w-[425px]",children:[s.jsx(yt,{children:s.jsxs(wt,{children:["Edit Department ",a]})}),s.jsx(Cp,{departmentId:o,onSuccess:r,onCancel:n})]})})}function Sp({unit:e,onSuccess:n,onCancel:t}){const[o,a]=b.useState(e.name.en),[r,i]=b.useState(e.name.am),[l,d]=b.useState({}),c=Xt.language,{updateUnit:u,isUpdating:g}=zn(),h=()=>{const p={};return o.trim()||(p.nameEn=N("organization.englishNameRequired")),r.trim()||(p.nameAm=N("organization.amharicNameRequired")),d(p),Object.keys(p).length===0},m=p=>{p.preventDefault();const{id:f,key:v,organizationId:x,parentUnitId:y}=e;if(!h()){Ee.error(N("contentManagement.invalidMsg"));return}const w={name:{en:o.trim(),am:r.trim()},key:v.trim().toLowerCase().replace(/\s+/g,"-"),organizationId:x,parentUnitId:y??void 0};u({id:f,payload:w,successCallback:()=>{Ee.success("Success",{description:`${N("contentManagement.unit")} "${c==="en"?o:r}" ${N("contentManagement.updated")}`}),n(o.trim())}})};return s.jsxs("form",{onSubmit:m,className:"space-y-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(Ue,{htmlFor:"nameEn",children:N("organization.enterEnglishName")}),s.jsx(ze,{id:"nameEn",placeholder:N("organization.enterEnglishName"),value:o,onChange:p=>{a(p.target.value),d(f=>({...f,nameEn:""}))}}),l.nameEn&&s.jsx("p",{className:"text-red-500 text-sm",children:l.nameEn})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Ue,{htmlFor:"nameAm",children:N("organization.enterEnglishName")}),s.jsx(ze,{id:"nameAm",placeholder:N("organization.enterEnglishName"),value:r,onChange:p=>{i(p.target.value),d(f=>({...f,nameAm:""}))}}),l.nameAm&&s.jsx("p",{className:"text-red-500 text-sm",children:l.nameAm})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Ue,{htmlFor:"key",children:N("contentManagement.key")}),s.jsx(ze,{id:"key",value:e.key})]}),s.jsxs("div",{className:"flex justify-end gap-2",children:[s.jsx(Be,{type:"button",variant:"outline",onClick:t,disabled:g,children:N("common.Cancel")}),s.jsx(Be,{type:"submit",disabled:g,children:g?N("profile.updating"):N("delegation.update")})]})]})}function _p({isOpen:e,onClose:n,units:t,unitId:o}){var g;const a=()=>{n()},r=t==null?void 0:t.find(h=>h.id===o),{getById:i}=zn(),{data:l,isLoading:d}=i(r?"":o),c=(l==null?void 0:l.data)??null,u=r??c;return s.jsx(xt,{open:e,onOpenChange:h=>!h&&n(),children:s.jsxs(bt,{className:"sm:max-w-[425px]",children:[s.jsx(yt,{children:s.jsxs(wt,{children:["Edit Unit ",(g=u==null?void 0:u.name)==null?void 0:g.en]})}),u?s.jsx(Sp,{unit:u,onSuccess:a,onCancel:n}):s.jsx("div",{className:"flex justify-center py-6",children:d?s.jsx(_t,{className:"h-5 w-5 animate-spin text-gray-500"}):s.jsx("span",{className:"text-sm text-gray-500",children:"Unit not found."})})]})})}const Mp=({unitName:e,unitId:n,isOpen:t,onClose:o})=>{const{removeUnit:a,isDeleting:r}=zn(),i=async()=>{try{await a(n),Ee.success("Unit deleted successfully."),o()}catch{}};return s.jsx(go,{open:t,onOpenChange:o,children:s.jsxs(mo,{children:[s.jsxs(ho,{children:[s.jsx(po,{children:"Are you sure you want to delete this unit?"}),s.jsxs(fo,{children:["This action will permanently delete the unit"," ",s.jsx("strong",{children:e})," and cannot be undone."]})]}),s.jsxs(vo,{children:[s.jsx(xo,{disabled:r,children:"Cancel"}),s.jsxs(Be,{variant:"destructive",onClick:i,disabled:r,children:[r&&s.jsx(_t,{className:"w-4 h-4 mr-2 animate-spin"}),"Delete"]})]})]})})},zi=e=>e?Array.isArray(e)?e:Array.isArray(e.items)?e.items:[]:[],fc=e=>{var d;const n=Ot({queryKey:["unitList",e,"capacity-total"],queryFn:()=>Sl(e,{take:1e3,skip:0}),enabled:!!e,staleTime:0}),t=zi((d=n.data)==null?void 0:d.data),o=t.map(c=>c==null?void 0:c.id).filter(Boolean),a=Eu({queries:o.map(c=>({queryKey:["unitChildren",c,"capacity-total"],queryFn:()=>Fu(c),enabled:!!c,staleTime:0}))}),r=a.reduce((c,u)=>{if(!u.data)return c;const g=zi(u.data.data);return c+g.length},0),i=t.length+r,l=n.isLoading||a.some(c=>c.isLoading||c.isFetching);return{total:i,isLoading:l}};function Rp({parentUnitId:e,onSuccess:n,onCancel:t}){const o=Lt(),{user:a}=Za(),r=a!=null&&a.employee&&a.employee.length>0?a.employee[0].organizationId:"",[i,l]=b.useState(""),[d,c]=b.useState(""),[u,g]=b.useState(""),{relateUnit:h,isRelating:m}=zn(),{data:p,isLoading:f}=Ot({queryKey:["organizationsFilter","subcity"],queryFn:()=>Pu({organizationTypeKey:"subcity",take:1e3,skip:0}),staleTime:6e4}),v=b.useMemo(()=>{var D;const M=((D=p==null?void 0:p.data)==null?void 0:D.items)??(p==null?void 0:p.data)??[];return Array.isArray(M)?M:[]},[p]),{data:x,isLoading:y}=Ot({queryKey:["unitList",i],queryFn:()=>Sl(i,{take:1e3,skip:0}),enabled:!!i,staleTime:0}),w=b.useMemo(()=>{var D;const M=((D=x==null?void 0:x.data)==null?void 0:D.items)??[];return Array.isArray(M)?M:[]},[x]),{data:C,isLoading:j}=nr(r),S=b.useMemo(()=>{var F;const M=((F=C==null?void 0:C.data)==null?void 0:F.items)??[];if(!Array.isArray(M)||M.length===0)return null;const D=M.find($=>($==null?void 0:$.organizationId)===r)??M[0],O=Number(D==null?void 0:D.maximumNumberOfUnits);return Number.isFinite(O)?O:null},[C,r]),{total:R,isLoading:_}=fc(r),T=S!==null&&S>=0&&R>=S,k=S!==null?Math.max(S-R,0):null;b.useEffect(()=>{c("")},[i]);const I=async M=>{if(M.preventDefault(),!i){g(N("contentManagement.subCityRequired","Please select a sub city"));return}if(!d){g(N("contentManagement.unitRequired","Please select a unit"));return}if(!e){g(N("contentManagement.parentUnitMissing","Parent unit is missing"));return}if(S===null){g(N("contentManagement.noCapacityConfigured","No unit capacity configured for this organization. Ask the super admin to configure it in Manage Organization Configuration."));return}if(T){g(N("contentManagement.capacityReached","Capacity limit reached. Configured maximum is {{max}}.",{max:S??0}));return}const D={unitId:d,newParentUnitId:e};try{await h({payload:D,successCallback:()=>{Ee.success(N("contentManagement.unitRelatedSuccess","Unit related successfully")),n()}})}catch{}},E=j||_,L=E||!E&&S===null||T,B=!i||!d||m||L;return s.jsxs("form",{onSubmit:I,className:"flex flex-col gap-4 w-full min-w-0",children:[s.jsx("div",{className:`rounded-md border px-3 py-2 text-sm ${E?"border-gray-200 bg-gray-50 text-gray-600 dark:border-gray-700 dark:bg-gray-800/50 dark:text-gray-300":S===null?"border-amber-200 bg-amber-50 text-amber-800 dark:border-amber-900/50 dark:bg-amber-950/30 dark:text-amber-300":T?"border-red-200 bg-red-50 text-red-700 dark:border-red-900/50 dark:bg-red-950/30 dark:text-red-300":"border-primary-200 bg-primary-50 text-primary-700 dark:border-primary-900/50 dark:bg-primary-950/30 dark:text-primary-300"}`,children:s.jsxs("div",{className:"flex items-start gap-2",children:[E?s.jsx(_t,{className:"h-4 w-4 mt-0.5 shrink-0 animate-spin"}):s.jsx(Ss,{className:"h-4 w-4 mt-0.5 shrink-0"}),s.jsx("div",{className:"min-w-0 break-words flex-1",children:E?s.jsx("span",{children:N("contentManagement.checkingCapacity","Checking configured capacity…")}):S===null?s.jsx("span",{children:N("contentManagement.noCapacityConfigured","No unit capacity configured for this organization. Ask the super admin to configure it in Manage Organization Configuration.")}):s.jsxs("div",{className:"space-y-1",children:[s.jsx("div",{className:"font-medium",children:N("contentManagement.configuredUnitLimit","Configured unit limit: {{max}}",{max:S})}),s.jsxs("div",{className:"flex flex-wrap gap-x-3 gap-y-0.5 text-xs opacity-90",children:[s.jsxs("span",{children:[N("contentManagement.linkedUnits","Linked"),": ",R]}),s.jsxs("span",{children:[N("contentManagement.remainingSlots","Remaining"),":"," ",k??0]})]}),T&&s.jsx("div",{className:"text-xs font-medium",children:N("contentManagement.capacityReachedShort","Limit reached — cannot relate more units.")})]})})]})}),s.jsxs("div",{className:"flex flex-col gap-2 min-w-0",children:[s.jsx(Ue,{htmlFor:"subCity",className:"text-sm",children:N("contentManagement.selectSubCity","Select Sub City")}),s.jsxs(an,{value:i,onValueChange:M=>{l(M),g("")},disabled:f||L,children:[s.jsx(rn,{id:"subCity",className:"w-full max-w-full",children:s.jsx(ln,{placeholder:f?N("organization.loading"):N("contentManagement.selectSubCity","Select Sub City")})}),s.jsx(cn,{className:"max-w-[var(--radix-select-trigger-width)]",children:f?s.jsxs("div",{className:"flex items-center justify-center px-2 py-3 text-sm text-gray-500",children:[s.jsx(_t,{className:"w-4 h-4 animate-spin mr-2"}),N("organization.loading")]}):v.length===0?s.jsx("div",{className:"px-2 py-3 text-sm text-gray-500",children:N("contentManagement.noSubCities","No sub cities found")}):v.map(M=>s.jsx(Ft,{value:M.id,children:s.jsx("span",{className:"block truncate",children:o(M.name)})},M.id))})]})]}),s.jsxs("div",{className:"flex flex-col gap-2 min-w-0",children:[s.jsx(Ue,{htmlFor:"subCityUnit",className:"text-sm",children:N("contentManagement.selectUnit","Select Unit")}),s.jsxs(an,{value:d,onValueChange:M=>{c(M),g("")},disabled:!i||y||L,children:[s.jsx(rn,{id:"subCityUnit",className:"w-full max-w-full",children:s.jsx(ln,{placeholder:i?y?N("organization.loading"):N("contentManagement.selectUnit","Select Unit"):N("contentManagement.selectSubCityFirst","Select a sub city first")})}),s.jsx(cn,{className:"max-w-[var(--radix-select-trigger-width)]",children:y?s.jsxs("div",{className:"flex items-center justify-center px-2 py-3 text-sm text-gray-500",children:[s.jsx(_t,{className:"w-4 h-4 animate-spin mr-2"}),N("organization.loading")]}):w.length===0?s.jsx("div",{className:"px-2 py-3 text-sm text-gray-500",children:N("contentManagement.noUnit")}):w.map(M=>s.jsx(Ft,{value:M.id,children:s.jsx("span",{className:"block truncate",children:o(M.name)})},M.id))})]})]}),u&&s.jsx("p",{className:"text-red-500 text-sm break-words",children:u}),s.jsxs("div",{className:"flex justify-end gap-2 pt-2",children:[s.jsx(Be,{type:"button",variant:"outline",onClick:t,disabled:m,children:N("common.Cancel")}),s.jsx(Be,{type:"submit",disabled:B,children:m?s.jsxs("span",{className:"flex items-center gap-2",children:[s.jsx(_t,{className:"h-4 w-4 animate-spin"}),N("organization.adding")]}):N("contentManagement.addFromSubCity","Add From Sub City")})]})]})}function Np({isOpen:e,onClose:n,parentUnitId:t}){return s.jsx(xt,{open:e,onOpenChange:o=>!o&&n(),children:s.jsxs(bt,{className:"sm:max-w-[480px] max-w-[calc(100vw-2rem)] overflow-hidden",children:[s.jsx(yt,{children:s.jsx(wt,{className:"truncate",children:N("contentManagement.addFromSubCity","Add From Sub City")})}),s.jsx("div",{className:"min-w-0",children:s.jsx(Rp,{parentUnitId:t,onSuccess:n,onCancel:n})})]})})}function kp({organizationId:e,onSuccess:n,onCancel:t}){const[o,a]=b.useState(""),[r,i]=b.useState(""),[l,d]=b.useState(""),[c,u]=b.useState({}),g=Xt.language,{createUnit:h,isCreating:m}=zn(),{data:p,isLoading:f}=nr(e||""),v=b.useMemo(()=>{var V;const k=((V=p==null?void 0:p.data)==null?void 0:V.items)??[];if(!Array.isArray(k)||k.length===0)return null;const I=k.find(L=>(L==null?void 0:L.organizationId)===e)??k[0],E=Number(I==null?void 0:I.maximumNumberOfUnits);return Number.isFinite(E)?E:null},[p,e]),{total:x,isLoading:y}=fc(e),w=f||y,C=v!==null&&v>=0&&x>=v,j=!w&&v===null,S=v!==null?Math.max(v-x,0):null,R=w||j||C,_=()=>{const k={};return o.trim()||(k.nameEn=N("organization.englishNameRequired")),r.trim()||(k.nameAm=N("organization.amharicNameRequired")),l.trim()||(k.key=N("contentManagement.keyRequired")),u(k),Object.keys(k).length===0},T=k=>{if(k.preventDefault(),w)return;if(j){Ee.error(N("contentManagement.noCapacityConfigured","No unit capacity configured for this organization. Ask the super admin to configure it in Manage Organization Configuration."));return}if(C){Ee.error(N("contentManagement.capacityReached","Capacity limit reached. Configured maximum is {{max}}.",{max:v??0}));return}if(!_()){Ee.error(N("contentManagement.invalidMsg"));return}const I={organizationId:e,key:l.trim().toLowerCase().replace(/\s+/g,"-"),name:{en:o.trim(),am:r.trim()}};h({payload:I,successCallback:()=>{Ee.success(N("contentManagement.success"),{description:`${N("contentManagement.unit")} "${g==="en"?o:r}" ${N("contentManagement.msg")}`}),n(o.trim())}})};return s.jsxs("form",{onSubmit:T,className:"space-y-4",children:[s.jsx("div",{className:`rounded-md border px-3 py-2 text-sm ${w?"border-gray-200 bg-gray-50 text-gray-600 dark:border-gray-700 dark:bg-gray-800/50 dark:text-gray-300":j?"border-amber-200 bg-amber-50 text-amber-800 dark:border-amber-900/50 dark:bg-amber-950/30 dark:text-amber-300":C?"border-red-200 bg-red-50 text-red-700 dark:border-red-900/50 dark:bg-red-950/30 dark:text-red-300":"border-primary-200 bg-primary-50 text-primary-700 dark:border-primary-900/50 dark:bg-primary-950/30 dark:text-primary-300"}`,children:s.jsxs("div",{className:"flex items-start gap-2",children:[w?s.jsx(_t,{className:"h-4 w-4 mt-0.5 shrink-0 animate-spin"}):s.jsx(Ss,{className:"h-4 w-4 mt-0.5 shrink-0"}),s.jsx("div",{className:"min-w-0 break-words flex-1",children:w?s.jsx("span",{children:N("contentManagement.checkingCapacity","Checking configured capacity…")}):j?s.jsx("span",{children:N("contentManagement.noCapacityConfigured","No unit capacity configured for this organization. Ask the super admin to configure it in Manage Organization Configuration.")}):s.jsxs("div",{className:"space-y-1",children:[s.jsx("div",{className:"font-medium",children:N("contentManagement.configuredUnitLimit","Configured unit limit: {{max}}",{max:v})}),s.jsxs("div",{className:"flex flex-wrap gap-x-3 gap-y-0.5 text-xs opacity-90",children:[s.jsxs("span",{children:[N("contentManagement.linkedUnits","Used"),": ",x]}),s.jsxs("span",{children:[N("contentManagement.remainingSlots","Remaining"),":"," ",S??0]})]}),C&&s.jsx("div",{className:"text-xs font-medium",children:N("contentManagement.capacityReachedShort","Limit reached — cannot create more units.")})]})})]})}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Ue,{htmlFor:"nameEn",children:N("organization.enterEnglishName")}),s.jsx(ze,{id:"nameEn",placeholder:N("organization.enterEnglishName"),value:o,disabled:R,onChange:k=>{a(k.target.value),u(I=>({...I,nameEn:""}))}}),c.nameEn&&s.jsx("p",{className:"text-red-500 text-sm",children:c.nameEn})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Ue,{htmlFor:"nameAm",children:N("organization.enterAmharicName")}),s.jsx(ze,{id:"nameAm",placeholder:N("organization.enterAmharicName"),value:r,disabled:R,onChange:k=>{i(k.target.value),u(I=>({...I,nameAm:""}))}}),c.nameAm&&s.jsx("p",{className:"text-red-500 text-sm",children:c.nameAm})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Ue,{htmlFor:"key",children:N("contentManagement.key")}),s.jsx(ze,{id:"key",placeholder:"e.g. finance-unit",value:l,disabled:R,onChange:k=>{d(k.target.value),u(I=>({...I,key:""}))}}),c.key&&s.jsx("p",{className:"text-red-500 text-sm",children:c.key})]}),s.jsxs("div",{className:"flex justify-end gap-2",children:[s.jsx(Be,{type:"button",variant:"outline",onClick:t,disabled:m,children:N("common.Cancel")}),s.jsx(Be,{type:"submit",disabled:m||R,children:m?N("organization.adding"):N("contentManagement.addUnit")})]})]})}function Dp({isOpen:e,onClose:n,organizationId:t}){const o=a=>{n()};return s.jsx(xt,{open:e,onOpenChange:a=>!a&&n(),children:s.jsxs(bt,{className:"sm:max-w-[425px]",children:[s.jsx(yt,{children:s.jsx(wt,{children:N("contentManagement.addNewUnit")})}),s.jsx(kp,{organizationId:t,onSuccess:o,onCancel:n})]})})}const Tp=({departmentName:e,departmentId:n,isOpen:t,onClose:o})=>{const{deletePosition:a,isDeleting:r}=An(),i=async()=>{a({id:n,successCallback:o})};return s.jsx(go,{open:t,onOpenChange:o,children:s.jsxs(mo,{children:[s.jsxs(ho,{children:[s.jsx(po,{children:"Are you sure you want to delete this department?"}),s.jsxs(fo,{children:["This will permanently delete ",s.jsx("strong",{children:e})," and all its sub-items. This action cannot be undone."]})]}),s.jsxs(vo,{children:[s.jsx(xo,{disabled:r,children:"Cancel"}),s.jsxs(Be,{variant:"destructive",onClick:i,disabled:r,children:[r&&s.jsx(_t,{className:"w-4 h-4 mr-2 animate-spin"}),"Delete"]})]})]})})},Ip=({departmentId:e,departmentName:n,isOpen:t,onClose:o,teamMemberId:a,teamMemberName:r})=>{if(!a)return null;const{setInactive:i,isDeActivatingUser:l}=co(),d={employeeId:a,positionId:e},c=()=>{i({payload:d,successCallback:o})};return s.jsx(go,{open:t,onOpenChange:o,children:s.jsxs(mo,{children:[s.jsxs(ho,{children:[s.jsx(po,{children:"Remove team member from this position?"}),s.jsxs(fo,{children:["This will mark ",s.jsx("strong",{children:r})," as inactive for this position. This action can be reversed only by reassigning."]})]}),s.jsxs(vo,{children:[s.jsx(xo,{disabled:l,children:"Cancel"}),s.jsxs(Be,{variant:"destructive",onClick:c,disabled:l,children:[l&&s.jsx(_t,{className:"h-4 w-4 mr-2 animate-spin"}),"Confirm"]})]})]})})};function Pp({unitId:e,departmentId:n,organizationId:t,onSuccess:o,onCancel:a}){const{usePositionListByUnitId:r}=An({take:1e3,skip:0}),[i,l]=b.useState(""),[d,c]=b.useState(""),[u,g]=b.useState(""),{data:h,isError:m,isLoading:p}=r(e,{take:1e3,skip:0}),f=Xt.language,{mutate:v,isPending:x}=Ru(),y=b.useMemo(()=>{if(!(h!=null&&h.items))return[];if(!d.trim())return h.items;const C=d.toLowerCase();return h.items.filter(j=>{var T,k,I,E,V;const S=((k=(T=j.name)==null?void 0:T.en)==null?void 0:k.toLowerCase())||"",R=((E=(I=j.name)==null?void 0:I.am)==null?void 0:E.toLowerCase())||"",_=((V=j.description)==null?void 0:V.toLowerCase())||"";return S.includes(C)||R.includes(C)||_.includes(C)})},[h==null?void 0:h.items,d]),w=C=>{if(C.preventDefault(),!i){g(N("addRecord.Select Department")),Ee.error(N("contentManagement.departmentRequired"));return}v({positionId:n,newParentId:i},{onSuccess:()=>{o(i)}}),o(i),Ee.success(N("contentManagement.departmentSuccess"))};return s.jsxs("form",{onSubmit:w,className:"space-y-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsxs(Ue,{htmlFor:"department",children:[" ",N("addRecord.Select Department")]}),s.jsxs(an,{onValueChange:C=>{l(C),g("")},value:i,children:[s.jsx(rn,{children:s.jsx(ln,{placeholder:N("addRecord.Select Department")})}),s.jsx(cn,{className:"p-0",children:s.jsxs("div",{className:"flex flex-col h-60",children:[s.jsx("div",{className:"flex-shrink-0 bg-white border-b p-2 z-10",children:s.jsxs("div",{className:"relative",children:[s.jsx(St,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-gray-400"}),s.jsx(ze,{placeholder:"Search departments...",value:d,onChange:C=>{c(C.target.value),l("")},className:"pl-10 pr-10 h-8"}),d&&s.jsx(Be,{type:"button",variant:"ghost",size:"sm",className:"absolute right-1 top-1/2 transform -translate-y-1/2 h-6 w-6 p-0",onClick:()=>{c(""),l("")},children:s.jsx(pu,{className:"h-3 w-3"})})]})}),s.jsx("div",{className:"flex-1 overflow-y-auto",children:p?s.jsx("div",{className:"px-2 py-2",children:s.jsx("p",{className:"text-gray-500",children:N("contentManagement.loading")})}):y.length===0?s.jsx("div",{className:"px-2 py-2",children:s.jsx("p",{className:"text-gray-500",children:d?"No departments found matching your search.":"No departments available."})}):y.map(C=>s.jsx(Ft,{value:C.id,children:s.jsxs("div",{className:"flex flex-col",children:[s.jsx("span",{className:"font-medium",children:f==="en"?C.name.en:C.name.am}),C.description&&s.jsx("span",{className:"text-xs text-gray-500",children:C.description})]})},C.id))}),d&&y.length>0&&s.jsx("div",{className:"flex-shrink-0 bg-gray-50 border-t px-2 py-1",children:s.jsxs("p",{className:"text-xs text-gray-500",children:["Found ",y.length," department(s)"]})})]})})]}),u&&s.jsx("p",{className:"text-red-500 text-sm",children:u})]}),s.jsxs("div",{className:"flex justify-end gap-2",children:[s.jsx(Be,{type:"button",variant:"outline",onClick:a,children:N("common.Cancel")}),s.jsx(Be,{type:"submit",disabled:!i||x,children:x?"Moving...":N("contentManagement.moveDepartement")})]})]})}function Fp({isOpen:e,onClose:n,departmentId:t,organizationId:o,unitId:a}){const r=i=>{n()};return s.jsx(xt,{open:e,onOpenChange:i=>!i&&n(),children:s.jsxs(bt,{className:"sm:max-w-[425px]",children:[s.jsx(yt,{children:s.jsx(wt,{children:"Move Department"})}),s.jsx(Pp,{unitId:a,organizationId:o,onSuccess:r,onCancel:n,departmentId:t})]})})}const $i={getUnitsList:async e=>{var n,t;try{return{success:!0,data:(await Ra.get(`/units/list/${e}`,{headers:vi()})).data}}catch(o){return{success:!1,message:((t=(n=o==null?void 0:o.response)==null?void 0:n.data)==null?void 0:t.message)||"Failed to fetch units",data:null}}},exportUserData:async(e,n="xlsx")=>{var t,o;try{const r=(await Ra.get(`/employees/export-user-data/${e}`,{headers:vi(),responseType:"json"})).data,i=ut.book_new();if(Array.isArray(r)){const f=ut.json_to_sheet(r);ut.book_append_sheet(i,f,"Data")}else if(r&&typeof r=="object"){if(r.positions&&Array.isArray(r.positions)){const f=ut.json_to_sheet(r.positions);ut.book_append_sheet(i,f,"Positions")}if(r.users&&Array.isArray(r.users)){const f=ut.json_to_sheet(r.users);ut.book_append_sheet(i,f,"Users")}if(!r.positions&&!r.users){const f=Object.values(r).find(v=>Array.isArray(v));if(f){const v=ut.json_to_sheet(f);ut.book_append_sheet(i,v,"Data")}else{const v=ut.json_to_sheet([r]);ut.book_append_sheet(i,v,"Data")}}}else{const f=ut.json_to_sheet([{data:r}]);ut.book_append_sheet(i,f,"Data")}let l,d,c;if(n==="csv"){let f="";if(r&&typeof r=="object"&&(r.positions||r.users)){const v=[];if(r.positions&&Array.isArray(r.positions)&&r.positions.forEach(x=>{v.push({...x,dataType:"Position"})}),r.users&&Array.isArray(r.users)&&r.users.forEach(x=>{v.push({...x,dataType:"User"})}),v.length>0){const x=ut.json_to_sheet(v);f=ut.sheet_to_csv(x)}}else{const v=i.SheetNames[0],x=i.Sheets[v];f=ut.sheet_to_csv(x)}l=new TextEncoder().encode(f),d="text/csv",c="csv"}else l=Ou(i,{bookType:"xlsx",type:"array"}),d="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",c="xlsx";const u=new Blob([l],{type:d}),g=window.URL.createObjectURL(u),h=document.createElement("a");h.href=g;const p=`user-data-export-${new Date().toISOString().split("T")[0]}.${c}`;return h.download=p,document.body.appendChild(h),h.click(),document.body.removeChild(h),window.URL.revokeObjectURL(g),{success:!0,message:"Export completed successfully",data:r}}catch(a){return{success:!1,message:((o=(t=a==null?void 0:a.response)==null?void 0:t.data)==null?void 0:o.message)||"Export failed. Please try again.",data:null}}}},Ep=()=>{const[e,n]=b.useState(!1),[t,o]=b.useState(!1),[a,r]=b.useState([]);return{exportUserData:async(d,c="xlsx")=>{if(!d){const u={success:!1,message:"Unit ID is required",data:null};return Ee.error(u.message),u}n(!0);try{const u=await $i.exportUserData(d,c);return u.success?Ee.success(`User data exported successfully as ${c.toUpperCase()}!`):Ee.error(u.message),u}catch(u){const g={success:!1,message:(u==null?void 0:u.message)||"Export failed. Please try again.",data:null};return Ee.error(g.message),g}finally{n(!1)}},getUnits:async d=>{var c,u;if(!d){Ee.error("Organization ID is required");return}o(!0);try{const g=await $i.getUnitsList(d);return g.success?(r(((c=g.data)==null?void 0:c.items)||[]),((u=g.data)==null?void 0:u.items)||[]):(Ee.error(g.message),[])}catch{return Ee.error("Failed to fetch units"),[]}finally{o(!1)}},isExporting:e,isLoadingUnits:t,units:a}},Op=({isOpen:e,onClose:n,userId:t,teamMemberName:o})=>{const{deactivateUser:a,isDeActivatingUser:r}=co(),i=kt(),l=async()=>{try{await a({payload:t,successCallback:()=>{i.invalidateQueries({queryKey:["positionEmployees"],exact:!0}),n()}})}catch{}};return s.jsx(go,{open:e,onOpenChange:n,children:s.jsxs(mo,{children:[s.jsxs(ho,{children:[s.jsx(po,{children:"Remove team member from this position?"}),s.jsxs(fo,{children:["This will mark ",s.jsx("strong",{children:o})," as Deactivate from this organization. This action can be reversed only by Activating From Archived User By Contacting the Administrator."]})]}),s.jsxs(vo,{children:[s.jsx(xo,{disabled:r,children:"Cancel"}),s.jsxs(Be,{variant:"destructive",onClick:l,disabled:r,children:[r&&s.jsx(_t,{className:"h-4 w-4 mr-2 animate-spin"}),"Confirm"]})]})]})})},Ap=(e,n)=>{const[t,o]=b.useState(""),[a,r]=b.useState({...n,take:3e3}),[i,l]=b.useState(!1),d=Lt(),{data:c,isLoading:u,error:g,refetch:h}=Ot({queryKey:["organizationEmployees",e,a],queryFn:async()=>{if(!e)throw new Error("Organization ID is required");return(await ku.getEmployeesWithOrganizationById(e,a)).data},enabled:!!e});b.useEffect(()=>{c!=null&&c.count&&!i&&(r(f=>({...f,take:c.count})),l(!0))},[c==null?void 0:c.count,i]);const m=b.useMemo(()=>{if(!(c!=null&&c.items))return[];const f=c.items.reduce((x,y)=>(x.find(w=>w.id===y.id)||x.push(y),x),[]);if(!t.trim())return f;const v=t.toLowerCase().trim();return f.filter(x=>{var I,E,V,L,B,M,D,O;const y=((I=x.user.name.am)==null?void 0:I.toLowerCase())||"",w=((E=x.user.name.en)==null?void 0:E.toLowerCase())||"",C=((V=d(x.user.name))==null?void 0:V.toLowerCase())||"",j=((L=x.name.am)==null?void 0:L.toLowerCase())||"",S=((B=x.name.en)==null?void 0:B.toLowerCase())||"",R=((M=d(x.name))==null?void 0:M.toLowerCase())||"",_=((D=x.user.email)==null?void 0:D.toLowerCase())||"",T=((O=x.user.phoneNumber)==null?void 0:O.toLowerCase())||"",k=x.employeePositions.map(F=>{var $;return(($=d(F.position.name))==null?void 0:$.toLowerCase())||""}).join(" ");return y.includes(v)||w.includes(v)||C.includes(v)||j.includes(v)||S.includes(v)||R.includes(v)||_.includes(v)||T.includes(v)||k.includes(v)})},[c==null?void 0:c.items,t,d]),p=b.useMemo(()=>c!=null&&c.items?c.items.reduce((f,v)=>(f.find(x=>x.id===v.id)||f.push(v),f),[]):[],[c==null?void 0:c.items]);return{employees:p,filteredEmployees:m,totalCount:p.length,filteredCount:m.length,searchQuery:t,setSearchQuery:o,isLoading:u,error:g,refetch:h}},zp=(e,n)=>{var r,i,l,d,c,u,g,h,m,p,f,v,x;const t=e.employeePositions[0],o=((i=(r=e==null?void 0:e.user)==null?void 0:r.name)==null?void 0:i.en)||((d=(l=e==null?void 0:e.user)==null?void 0:l.name)==null?void 0:d.am)||"",a=((u=(c=t==null?void 0:t.position)==null?void 0:c.name)==null?void 0:u.en)||((h=(g=t==null?void 0:t.position)==null?void 0:g.name)==null?void 0:h.am)||"";return{organizationId:n,status:"Active",id:e.id,isCurrent:!0,name:t?`${o} - ${a}`:null,user:{id:((m=e==null?void 0:e.user)==null?void 0:m.id)??"",name:((p=e==null?void 0:e.user)==null?void 0:p.name)??{en:"",am:""},username:((v=(f=e==null?void 0:e.user)==null?void 0:f.email)==null?void 0:v.split("@")[0])??"",email:((x=e==null?void 0:e.user)==null?void 0:x.email)??"",userType:"employee",sharepointId:null,status:"pending",phoneNumber:"",hasSetPassword:!1}}},$p=({organizationId:e,isOpen:n,onClose:t})=>{const{filteredEmployees:o,totalCount:a,filteredCount:r,searchQuery:i,setSearchQuery:l,isLoading:d,error:c}=Ap(e),u=b.useMemo(()=>e?o.map(p=>zp(p,e)):[],[o,e]),g=async p=>{const f=Xt.language;try{p.user.status==="pending"?Ee.loading(N("search.resendingVerification")):Ee.loading(N("search.sendingInvitation")),await xl({email:p.user.email,phoneNumber:p.user.phoneNumber});const v=f==="en"?p.user.name.en:p.user.name.am;p.user.status==="pending"?Ee.success(N("search.verificationCodeResent"),{description:N("search.verificationCodeSentTo",{name:v}),duration:4e3}):Ee.success(N("search.invitationSent"),{description:N("search.invitationSentTo",{name:v}),duration:4e3})}catch(v){const x=v instanceof Error?v.message:"Unknown error",y=p.user.status==="pending"?N("search.failedToResend"):N("search.failedToSendInvitation");Ee.error("Error",{description:`${y}: ${x}`,duration:4e3})}},h=(p,f,v,x)=>{window.confirm(N("search.confirmRemoveEmployee",{name:x}))&&Ee.info(N("search.removeFunctionalityNotImplemented"))},m=()=>d?s.jsx("div",{className:"flex justify-center py-12",children:s.jsxs("div",{className:"flex flex-col items-center",children:[s.jsx("div",{className:"w-8 h-8 border-4 border-t-blue-500 border-blue-200 rounded-full animate-spin mb-2"}),s.jsx("p",{className:"text-sm text-gray-500",children:N("search.searchingEmployees")})]})}):c?s.jsxs("div",{className:"text-center py-12 text-red-500",children:[s.jsx(Ss,{className:"h-12 w-12 mx-auto mb-2"}),s.jsx("p",{className:"text-sm font-medium",children:N("search.errorLoadingEmployees")}),s.jsx("p",{className:"text-xs mt-1",children:c instanceof Error?c.message:"Unknown error"})]}):o.length===0&&i.trim()?s.jsxs("div",{className:"text-center py-12 text-gray-500",children:[s.jsx(St,{className:"h-12 w-12 mx-auto mb-2 text-gray-300"}),s.jsx("p",{className:"text-sm font-medium",children:N("search.noEmployeesFound")}),s.jsx("p",{className:"text-xs mt-1 text-gray-400",children:N("search.tryDifferentKeywords")})]}):o.length===0?s.jsxs("div",{className:"text-center py-12 text-gray-500",children:[s.jsx(Tt,{className:"h-12 w-12 mx-auto mb-2 text-gray-300"}),s.jsx("p",{className:"text-sm font-medium",children:N("search.startTypingToSearch")}),s.jsx("p",{className:"text-xs mt-1 text-gray-400",children:N("search.searchByNameEmailPhone")})]}):s.jsx(Fa,{departmentId:"",departmentName:N("search.allEmployees"),employees:u,isLoading:!1,searchQuery:"",onInviteEmployee:g,onDeleteEmployee:h});return s.jsx(xt,{open:n,onOpenChange:t,children:s.jsxs(bt,{className:"max-w-4xl max-h-[80vh] overflow-hidden",children:[s.jsxs(yt,{className:"flex flex-row items-center justify-between",children:[s.jsxs(wt,{className:"flex items-center gap-2",children:[s.jsx(St,{className:"h-5 w-5"}),N("search.searchAllEmployees")]}),s.jsx(Be,{variant:"ghost",size:"icon",onClick:t,className:"h-6 w-6"})]}),s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"relative",children:[s.jsx(St,{className:"absolute left-3 top-3 h-4 w-4 text-gray-400"}),s.jsx(ze,{placeholder:N("search.searchByNameEmailPhonePosition"),className:"pl-10",value:i,onChange:p=>l(p.target.value),autoFocus:!0})]}),i.trim()&&s.jsx("div",{className:"text-sm text-gray-600",children:N("search.showingResults",{count:r,total:a,query:i})}),s.jsx("div",{className:"max-h-96 overflow-y-auto",children:m()})]})]})})},Lp=()=>{const{toast:e}=yl(),{softDeletePosition:n}=Au(),t=ee=>{n(ee)},[o,a]=b.useState(""),[r,i]=b.useState(""),[l,d]=b.useState(""),[c,u]=b.useState(""),{user:g}=Za(),h=b.useRef(null),m=Lt();Xt.language;const{exportUserData:p,getUnits:f,isExporting:v,isLoadingUnits:x,units:y}=Ep(),[w,C]=b.useState(""),[j,S]=b.useState(!1),[R,_]=b.useState("xlsx"),[T,k]=b.useState(!1),I=g!=null&&g.employee&&g.employee.length>0?g.employee[0].organizationId:void 0,{organizations:E,isLoading:V}=mp({currentOrgId:I}),{selectedOrgId:L,selectedUnitId:B,selectedDepartmentId:M,selectedDepartmentName:D,breadcrumb:O,handleSelectOrganization:F,handleSelectUnit:$,handleSelectDepartment:z}=vp(E,m),[H]=b.useState(100),[re,ie]=b.useState(0),{units:X,isLoading:oe,setUnits:ne,fetchedUnits:J}=hp(L,{take:H,skip:re}),{data:P}=nr(L||""),Q=(()=>{var He;const ee=((He=P==null?void 0:P.data)==null?void 0:He.items)??[];if(!Array.isArray(ee)||ee.length===0)return null;const q=ee.find(st=>(st==null?void 0:st.organizationId)===L)??ee[0],Re=Number(q==null?void 0:q.maximumNumberOfUnits);return Number.isFinite(Re)?Re:null})(),{getChildren:ce}=zn(),[te,W]=b.useState("");b.useEffect(()=>{if(!B)return;X.some(q=>q.id===B)&&W(B)},[B,X]),b.useEffect(()=>{W("")},[L]);const{data:me}=ce(te||""),le=(()=>{const ee=me==null?void 0:me.data;if(!ee)return[];const q=Array.isArray(ee)?ee:ee.items??[];return Array.isArray(q)?q.map(Re=>({id:Re.id,name:Re.name})):[]})(),de=new Set(le.map(ee=>ee.id)),Y=(()=>{const ee=new Set,q=[];return[...X,...le].forEach(Re=>{Re!=null&&Re.id&&!ee.has(Re.id)&&(ee.add(Re.id),q.push({...Re,isRelated:de.has(Re.id)}))}),q})(),[A,se]=b.useState(!1),be=Q!==null&&X.length<Q&&!!L,{departments:ve,isLoading:Se,setDepartments:we,positions:U}=pp(B),{employees:G,isLoading:ae,setEmployees:Fe,refetch:pe}=fp(M),Z=xp({selectedOrgId:L,selectedUnitId:B,toast:e}),_e=async ee=>{try{ee.status==="pending"?Ee.loading("Resending verification code..."):Ee.loading("Sending invitation..."),await xl({email:ee.user.email,phoneNumber:ee.user.phoneNumber});const q=typeof ee.user.name=="string"?m(ee.user.name):m(ee.user.name)||"User";ee.user.status==="pending"?Ee.success("Verification Code Resent",{description:`A new verification code has been sent to ${q}`,duration:4e3}):Ee.success("Invitation Sent",{description:`Invitation sent to ${q}`,duration:4e3}),pe&&await pe()}catch(q){const Re=q instanceof Error?q.message:"Unknown error";Ee.error("Error",{description:`Failed to ${ee.status==="pending"?"resend verification code":"send invitation"}: ${Re}`,duration:4e3})}setTimeout(()=>{Ee.dismiss()},4e3)},Ae=()=>{h.current&&h.current.scrollBy({left:-200,behavior:"smooth"})},Qe=()=>{h.current&&h.current.scrollBy({left:200,behavior:"smooth"})},nt=async()=>{if(!I){Ee.error(N("organizationIdRequired"));return}try{const ee=await f(I);ee&&ee.length>0?S(!0):Ee.error(N("noUnitsFound"))}catch{Ee.error(N("exportError"))}},et=async ee=>{C(ee),S(!1),await p(ee,R),C("")};return s.jsxs("div",{className:"h-full flex flex-col",children:[s.jsxs("div",{className:"p-4 border-b dark:border-gray-700",children:[s.jsxs("div",{className:"flex justify-between items-center mb-4",children:[s.jsx("h1",{className:"text-xl font-semibold text-gray-800 dark:text-gray-200",children:N("organization.userManagement")}),s.jsxs("div",{className:"flex gap-2",children:[s.jsxs(an,{value:R,onValueChange:ee=>_(ee),children:[s.jsx(rn,{className:"w-32 dark:bg-gray-700 dark:text-gray-200 dark:border-gray-600",children:s.jsx(ln,{})}),s.jsxs(cn,{className:"dark:bg-gray-700 dark:border-gray-600",children:[s.jsx(Ft,{value:"xlsx",className:"dark:text-gray-200 dark:hover:bg-gray-600",children:"XLSX"}),s.jsx(Ft,{value:"csv",className:"dark:text-gray-200 dark:hover:bg-gray-600",children:"CSV"})]})]}),s.jsxs(Be,{variant:"outline",size:"sm",onClick:nt,disabled:v||!I,className:"bg-primary-50 text-primary-700 border-primary-200 hover:bg-primary-100 dark:bg-primary-900/30 dark:text-primary-400 dark:border-primary-800 dark:hover:bg-primary-900/50",children:[s.jsx(zu,{className:`h-4 w-4 mr-2 ${v?"animate-pulse":""}`}),v?N("exporting"):N("exportUserData")]})]})]}),s.jsxs("div",{className:"flex gap-2",children:[s.jsxs("div",{className:"relative flex-1",children:[s.jsx(St,{className:"absolute left-2 top-2.5 h-4 w-4 text-gray-500 dark:text-gray-400"}),s.jsx(ze,{placeholder:"Search organizations, units, departments...",className:"pl-8 dark:bg-gray-700 dark:text-gray-200 dark:border-gray-600",value:o,onChange:ee=>a(ee.target.value)})]}),s.jsxs(Be,{variant:"outline",size:"sm",onClick:()=>k(!0),disabled:!I,className:"bg-blue-50 text-blue-700 border-blue-200 hover:bg-blue-100 whitespace-nowrap dark:bg-blue-900/30 dark:text-blue-400 dark:border-blue-800 dark:hover:bg-blue-900/50",children:[s.jsx(Tt,{className:"h-4 w-4 mr-2"}),N("search.searchAllEmployees")]})]}),s.jsx("div",{className:"mt-4",children:s.jsx(bp,{breadcrumb:O,hasTeamMembers:M!=""&&G.length>0})})]}),s.jsx("div",{className:"flex-1 p-2 md:hidden",children:s.jsxs("div",{className:"relative h-[calc(100vh-180px)]",children:[s.jsx("button",{onClick:Ae,className:"absolute left-0 top-1/2 -translate-y-1/2 z-10 bg-white dark:bg-gray-800 rounded-full shadow-md p-1","aria-label":"Scroll left",children:s.jsx($u,{className:"h-5 w-5 dark:text-gray-300"})}),s.jsxs("div",{ref:h,className:"flex overflow-x-auto gap-3 pb-4 snap-x snap-mandatory h-full scrollbar-hide",style:{scrollbarWidth:"none",msOverflowStyle:"none"},children:[s.jsxs("div",{className:"border rounded-md p-3 bg-white dark:bg-gray-800 shadow-sm min-w-[90%] max-w-[90%] flex-shrink-0 snap-center h-full flex flex-col dark:border-gray-700",children:[s.jsx("h3",{className:"font-medium text-gray-700 dark:text-gray-200 mb-3 border-b pb-2 dark:border-gray-700",children:N("organization.organizations")}),s.jsx("div",{className:"overflow-y-auto flex-1",children:s.jsx(Ei,{selectedOrgId:L,organizations:E,isLoading:V,searchQuery:o,onSelectOrganization:ee=>{ne([]),we([]),Fe([]),F(ee)},canCreateUnitForOrg:ee=>ee===L&&be,onCreateUnit:()=>se(!0)})})]}),s.jsxs("div",{className:"border rounded-md p-3 bg-white dark:bg-gray-800 shadow-sm min-w-[90%] max-w-[90%] flex-shrink-0 snap-center h-full flex flex-col dark:border-gray-700",children:[s.jsxs("h3",{className:"font-medium text-gray-700 dark:text-gray-200 mb-3 border-b pb-2 dark:border-gray-700 flex items-center justify-between gap-2",children:[s.jsx("span",{children:N("contentManagement.Units")}),s.jsxs("div",{className:"flex items-center gap-2",children:[Q!==null&&s.jsxs("span",{className:"text-xs font-normal px-2 py-0.5 rounded-full bg-primary-50 text-primary-700 dark:bg-primary-900/30 dark:text-primary-300 border border-primary-200 dark:border-primary-800",children:[Y.length,"/",Q]}),be&&s.jsxs(Be,{size:"sm",variant:"outline",onClick:()=>se(!0),className:"h-7 px-2 text-xs border-primary-500 text-primary-700 hover:bg-primary-50 dark:border-primary-700 dark:text-primary-300 dark:hover:bg-primary-900/30",children:[s.jsx(bs,{className:"h-3.5 w-3.5 mr-1"}),N("contentManagement.createUnit","Create Unit")]})]})]}),s.jsx("div",{className:"mb-3",children:s.jsxs("div",{className:"relative",children:[s.jsx(St,{className:"absolute left-2 top-2.5 h-4 w-4 text-gray-500 dark:text-gray-400"}),s.jsx(ze,{placeholder:N("search.searchUnits","Search units..."),className:"pl-8 text-sm dark:bg-gray-700 dark:text-gray-200 dark:border-gray-600",value:r,onChange:ee=>i(ee.target.value)})]})}),s.jsx("div",{className:"overflow-y-auto flex-1",children:s.jsx(Oi,{organizationId:L,selectedUnitId:B,onSelectUnit:ee=>{we([]),Fe([]),$(ee,Y)},units:Y,isLoading:oe,searchQuery:r,onAddDepartment:Z.unit.onAddDepartment,onEditUnit:Z.unit.onEditUnit,onDeleteUnit:Z.unit.onDeleteUnit,onAddFromSubCity:Z.unit.onAddFromSubCity})})]}),s.jsxs("div",{className:"border rounded-md p-3 bg-white dark:bg-gray-800 shadow-sm min-w-[90%] max-w-[90%] flex-shrink-0 snap-center h-full flex flex-col dark:border-gray-700",children:[s.jsx("h3",{className:"font-medium text-gray-700 dark:text-gray-200 mb-3 border-b pb-2 dark:border-gray-700",children:N("userIncoming.Departments")}),s.jsx("div",{className:"mb-3",children:s.jsxs("div",{className:"relative",children:[s.jsx(St,{className:"absolute left-2 top-2.5 h-4 w-4 text-gray-500 dark:text-gray-400"}),s.jsx(ze,{placeholder:N("search.searchDepartments","Search departments..."),className:"pl-8 text-sm dark:bg-gray-700 dark:text-gray-200 dark:border-gray-600",value:l,onChange:ee=>d(ee.target.value)})]})}),s.jsx("div",{className:"overflow-y-auto flex-1",children:s.jsx(Ai,{unitId:B,selectedDepartmentId:M,onSelectDepartment:ee=>{ee!==M&&(Fe([]),z(ee,ve))},departments:ve,positions:U,isLoading:Se,searchQuery:l,onAddUser:Z.department.onAddUserUnderDepartment,onViewUsers:Z.department.onViewUsers,onAddSubDepartment:Z.department.onAddSubDepartment,onEditDepartment:Z.department.onEditDepartment,onDeleteDepartment:Z.department.onDeleteDepartment,onArchiveDepartment:t,onDelegate:Z.department.onDelegate,onAssignUser:Z.department.onAssignUser,onMoveDepartment:Z.department.onMoveDepartment})})]}),s.jsxs("div",{className:"border rounded-md p-3 bg-white dark:bg-gray-800 shadow-sm min-w-[90%] max-w-[90%] flex-shrink-0 snap-center h-full flex flex-col dark:border-gray-700",children:[s.jsx("h3",{className:"font-medium text-gray-700 dark:text-gray-200 mb-3 border-b pb-2 dark:border-gray-700",children:N("contentManagement.teamMember")}),s.jsx("div",{className:"mb-3",children:s.jsxs("div",{className:"relative",children:[s.jsx(St,{className:"absolute left-2 top-2.5 h-4 w-4 text-gray-500 dark:text-gray-400"}),s.jsx(ze,{placeholder:N("search.searchEmployees","Search employees..."),className:"pl-8 text-sm dark:bg-gray-700 dark:text-gray-200 dark:border-gray-600",value:c,onChange:ee=>u(ee.target.value)})]})}),s.jsx("div",{className:"overflow-y-auto flex-1",children:s.jsx(Fa,{departmentId:M,departmentName:D,employees:G,isLoading:ae,searchQuery:c,onDeleteEmployee:Z.teamMember.onDeleteTeamMember,onInviteEmployee:_e,onDeactivateTeamMember:Z.teamMember.onDeactivateTeamMember})})]})]}),s.jsx("button",{onClick:Qe,className:"absolute right-0 top-1/2 -translate-y-1/2 z-10 bg-white dark:bg-gray-800 rounded-full shadow-md p-1","aria-label":"Scroll right",children:s.jsx(Js,{className:"h-5 w-5 dark:text-gray-300"})})]})}),s.jsxs("div",{className:"hidden md:flex flex-1 p-4 flex-col lg:grid lg:grid-cols-4 lg:gap-4",children:[s.jsxs("div",{className:"lg:col-span-3 grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4",children:[s.jsxs("div",{className:"border rounded-md p-3 bg-white dark:bg-gray-800 shadow-sm dark:border-gray-700",children:[s.jsx("h3",{className:"font-medium text-gray-700 dark:text-gray-200 mb-3 border-b pb-2 dark:border-gray-700",children:N("organization.organizations")}),s.jsx(Ei,{selectedOrgId:L,organizations:E,isLoading:V,searchQuery:o,onSelectOrganization:ee=>{ne([]),we([]),Fe([]),F(ee)},canCreateUnitForOrg:ee=>ee===L&&be,onCreateUnit:()=>se(!0)})]}),s.jsxs("div",{className:"border rounded-md p-3 bg-white dark:bg-gray-800 shadow-sm dark:border-gray-700",children:[s.jsxs("h3",{className:"font-medium text-gray-700 dark:text-gray-200 mb-3 border-b pb-2 dark:border-gray-700 flex items-center justify-between gap-2",children:[s.jsx("span",{children:N("contentManagement.Units")}),Q!==null&&s.jsxs("span",{className:"text-xs font-normal px-2 py-0.5 rounded-full bg-primary-50 text-primary-700 dark:bg-primary-900/30 dark:text-primary-300 border border-primary-200 dark:border-primary-800",children:[Y.length,"/",Q]})]}),s.jsx("div",{className:"mb-3",children:s.jsxs("div",{className:"relative",children:[s.jsx(St,{className:"absolute left-2 top-2.5 h-4 w-4 text-gray-500 dark:text-gray-400"}),s.jsx(ze,{placeholder:N("search.searchUnits","Search units..."),className:"pl-8 text-sm dark:bg-gray-700 dark:text-gray-200 dark:border-gray-600",value:r,onChange:ee=>i(ee.target.value)})]})}),s.jsx(Oi,{organizationId:L,selectedUnitId:B,onSelectUnit:ee=>{we([]),Fe([]),$(ee,Y)},units:Y,isLoading:oe,searchQuery:r,onAddDepartment:Z.unit.onAddDepartment,onEditUnit:Z.unit.onEditUnit,onDeleteUnit:Z.unit.onDeleteUnit,onAddFromSubCity:Z.unit.onAddFromSubCity})]}),s.jsxs("div",{className:"border rounded-md p-3 bg-white dark:bg-gray-800 shadow-sm dark:border-gray-700",children:[s.jsx("h3",{className:"font-medium text-gray-700 dark:text-gray-200 mb-3 border-b pb-2 dark:border-gray-700",children:N("userIncoming.Departments")}),s.jsx("div",{className:"mb-3",children:s.jsxs("div",{className:"relative",children:[s.jsx(St,{className:"absolute left-2 top-2.5 h-4 w-4 text-gray-500 dark:text-gray-400"}),s.jsx(ze,{placeholder:N("search.searchDepartments","Search departments..."),className:"pl-8 text-sm dark:bg-gray-700 dark:text-gray-200 dark:border-gray-600",value:l,onChange:ee=>d(ee.target.value)})]})}),s.jsx(Ai,{unitId:B,selectedDepartmentId:M,onSelectDepartment:ee=>{ee!==M&&(Fe([]),z(ee,ve))},departments:ve,positions:U,isLoading:Se,searchQuery:l,onAddUser:Z.department.onAddUserUnderDepartment,onViewUsers:Z.department.onViewUsers,onAddSubDepartment:Z.department.onAddSubDepartment,onEditDepartment:Z.department.onEditDepartment,onDeleteDepartment:Z.department.onDeleteDepartment,onArchiveDepartment:t,onDelegate:Z.department.onDelegate,onAssignUser:Z.department.onAssignUser,onMoveDepartment:Z.department.onMoveDepartment})]})]}),s.jsxs("div",{className:"mt-4 lg:mt-0 border rounded-md p-4 bg-white dark:bg-gray-800 shadow-sm dark:border-gray-700",children:[s.jsxs("h3",{className:"font-medium text-gray-700 dark:text-gray-200 mb-4 border-b pb-2 flex items-center dark:border-gray-700",children:[s.jsx(Tt,{className:"mr-2 h-4 w-4 text-gray-500 dark:text-gray-400"}),N("contentManagement.teamMember")]}),s.jsx("div",{className:"mb-4",children:s.jsxs("div",{className:"relative",children:[s.jsx(St,{className:"absolute left-2 top-2.5 h-4 w-4 text-gray-500 dark:text-gray-400"}),s.jsx(ze,{placeholder:N("search.searchEmployees","Search employees..."),className:"pl-8 text-sm dark:bg-gray-700 dark:text-gray-200 dark:border-gray-600",value:c,onChange:ee=>u(ee.target.value)})]})}),s.jsx(Fa,{departmentId:M,departmentName:D,employees:G,isLoading:ae,searchQuery:c,onDeleteEmployee:Z.teamMember.onDeleteTeamMember,onInviteEmployee:_e,onDeactivateTeamMember:Z.teamMember.onDeactivateTeamMember})]})]}),Z.dialogs.userUnderDepartment.isOpen&&s.jsx(wp,{...Z.dialogs.userUnderDepartment}),Z.dialogs.editUnit.isOpen&&s.jsx(_p,{...Z.dialogs.editUnit,units:J}),Z.dialogs.deleteUnit.isOpen&&s.jsx(Mp,{...Z.dialogs.deleteUnit}),Z.dialogs.addFromSubCity.isOpen&&s.jsx(Np,{...Z.dialogs.addFromSubCity}),A&&s.jsx(Dp,{isOpen:A,onClose:()=>se(!1),organizationId:L}),Z.dialogs.department.isOpen&&s.jsx(op,{...Z.dialogs.department,organizationId:L}),Z.dialogs.editDepartment.isOpen&&s.jsx(jp,{...Z.dialogs.editDepartment,postions:U}),Z.dialogs.deleteDepartment.isOpen&&s.jsx(Tp,{...Z.dialogs.deleteDepartment}),Z.dialogs.subDepartment.isOpen&&s.jsx(dp,{...Z.dialogs.subDepartment}),Z.dialogs.moveDepartment.isOpen&&s.jsx(Fp,{isOpen:Z.dialogs.moveDepartment.isOpen,onClose:Z.dialogs.moveDepartment.onClose,departmentId:Z.dialogs.moveDepartment.departmentId,organizationId:L,unitId:B}),Z.dialogs.user.isOpen&&s.jsx(rp,{...Z.dialogs.user}),Z.dialogs.viewUsers.isOpen&&s.jsx(lp,{...Z.dialogs.viewUsers}),Z.dialogs.assignUser.isOpen&&s.jsx(gp,{...Z.dialogs.assignUser}),Z.dialogs.deleteTeamMember.isOpen&&s.jsx(Ip,{...Z.dialogs.deleteTeamMember}),Z.dialogs.deactivateTeamMember.isOpen&&s.jsx(Op,{isOpen:Z.dialogs.deactivateTeamMember.isOpen,onClose:Z.dialogs.deactivateTeamMember.onClose,userId:Z.dialogs.deactivateTeamMember.userId,teamMemberName:Z.dialogs.deactivateTeamMember.teamMemberName}),j&&s.jsx("div",{className:"fixed inset-0 bg-black/40 dark:bg-black/60 flex items-center justify-center z-50",children:s.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg p-6 max-w-md w-full mx-4",children:[s.jsx("h3",{className:"text-lg font-semibold mb-4 dark:text-white",children:N("selectUnit")}),x?s.jsxs("div",{className:"text-center py-4",children:[s.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-blue-600 mx-auto"}),s.jsx("p",{className:"mt-2 dark:text-gray-400",children:N("loadingUnits")})]}):s.jsx("div",{className:"space-y-2 max-h-60 overflow-y-auto",children:y.map(ee=>{var q;if(typeof ee=="object"&&ee!==null&&"id"in ee&&"name"in ee){const Re=ee;return s.jsxs("button",{onClick:()=>et(Re.id),className:"w-full text-left p-3 rounded border border-gray-200 hover:bg-gray-100 hover:shadow-sm transition-colors focus:outline-none focus:ring-2 focus:ring-blue-500 cursor-pointer dark:border-gray-600 dark:hover:bg-gray-700 dark:focus:ring-blue-400",children:[s.jsx("div",{className:"font-medium dark:text-gray-200",children:((q=Re.name)==null?void 0:q.en)||Re.name}),Re.description&&s.jsx("div",{className:"text-sm text-gray-500 dark:text-gray-400",children:Re.description})]},Re.id)}return null})}),s.jsx("div",{className:"flex justify-end mt-4",children:s.jsx(Be,{variant:"outline",onClick:()=>S(!1),className:"dark:border-gray-600 dark:text-gray-200 dark:hover:bg-gray-700",children:N("common.cancel")})})]})}),s.jsx($p,{organizationId:I,isOpen:T,onClose:()=>k(!1)})]})};/**
|
||
* @license @tabler/icons-react v3.44.0 - MIT
|
||
*
|
||
* This source code is licensed under the MIT license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/var Vp={outline:{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"},filled:{xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"currentColor",stroke:"none"}};/**
|
||
* @license @tabler/icons-react v3.44.0 - MIT
|
||
*
|
||
* This source code is licensed under the MIT license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const Ne=(e,n,t,o)=>{const a=b.forwardRef(({color:r="currentColor",size:i=24,stroke:l=2,title:d,className:c,children:u,...g},h)=>b.createElement("svg",{ref:h,...Vp[e],width:i,height:i,className:["tabler-icon",`tabler-icon-${n}`,c].join(" "),...e==="filled"?{fill:r}:{strokeWidth:l,stroke:r},...g},[d&&b.createElement("title",{key:"svg-title"},d),...o.map(([m,p])=>b.createElement(m,p)),...Array.isArray(u)?u:[u]]));return a.displayName=`${t}`,a};/**
|
||
* @license @tabler/icons-react v3.44.0 - MIT
|
||
*
|
||
* This source code is licensed under the MIT license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const Bp=[["path",{d:"M6 4l-3 3l3 3",key:"svg-0"}],["path",{d:"M18 4l3 3l-3 3",key:"svg-1"}],["path",{d:"M4 16a2 2 0 0 1 2 -2h12a2 2 0 0 1 2 2v2a2 2 0 0 1 -2 2h-12a2 2 0 0 1 -2 -2l0 -2",key:"svg-2"}],["path",{d:"M10 7h-7",key:"svg-3"}],["path",{d:"M21 7h-7",key:"svg-4"}]],Up=Ne("outline","arrow-autofit-content","ArrowAutofitContent",Bp);/**
|
||
* @license @tabler/icons-react v3.44.0 - MIT
|
||
*
|
||
* This source code is licensed under the MIT license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const Hp=[["path",{d:"M18 9l3 3l-3 3",key:"svg-0"}],["path",{d:"M15 12h6",key:"svg-1"}],["path",{d:"M6 9l-3 3l3 3",key:"svg-2"}],["path",{d:"M3 12h6",key:"svg-3"}],["path",{d:"M9 18l3 3l3 -3",key:"svg-4"}],["path",{d:"M12 15v6",key:"svg-5"}],["path",{d:"M15 6l-3 -3l-3 3",key:"svg-6"}],["path",{d:"M12 3v6",key:"svg-7"}]],vc=Ne("outline","arrows-move","ArrowsMove",Hp);/**
|
||
* @license @tabler/icons-react v3.44.0 - MIT
|
||
*
|
||
* This source code is licensed under the MIT license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const Gp=[["path",{d:"M3 9l4 -4l4 4m-4 -4v14",key:"svg-0"}],["path",{d:"M21 15l-4 4l-4 -4m4 4v-14",key:"svg-1"}]],qp=Ne("outline","arrows-sort","ArrowsSort",Gp);/**
|
||
* @license @tabler/icons-react v3.44.0 - MIT
|
||
*
|
||
* This source code is licensed under the MIT license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const Wp=[["path",{d:"M4 4h16",key:"svg-0"}],["path",{d:"M4 20h16",key:"svg-1"}]],Kp=Ne("outline","baseline-density-large","BaselineDensityLarge",Wp);/**
|
||
* @license @tabler/icons-react v3.44.0 - MIT
|
||
*
|
||
* This source code is licensed under the MIT license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const Yp=[["path",{d:"M4 20h16",key:"svg-0"}],["path",{d:"M4 12h16",key:"svg-1"}],["path",{d:"M4 4h16",key:"svg-2"}]],Qp=Ne("outline","baseline-density-medium","BaselineDensityMedium",Yp);/**
|
||
* @license @tabler/icons-react v3.44.0 - MIT
|
||
*
|
||
* This source code is licensed under the MIT license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const Xp=[["path",{d:"M4 3h16",key:"svg-0"}],["path",{d:"M4 9h16",key:"svg-1"}],["path",{d:"M4 15h16",key:"svg-2"}],["path",{d:"M4 21h16",key:"svg-3"}]],Zp=Ne("outline","baseline-density-small","BaselineDensitySmall",Xp);/**
|
||
* @license @tabler/icons-react v3.44.0 - MIT
|
||
*
|
||
* This source code is licensed under the MIT license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const Jp=[["path",{d:"M7 5a2 2 0 0 1 2 -2h10a2 2 0 0 1 2 2v10a2 2 0 0 1 -2 2h-10a2 2 0 0 1 -2 -2l0 -10",key:"svg-0"}],["path",{d:"M17 17v2a2 2 0 0 1 -2 2h-10a2 2 0 0 1 -2 -2v-10a2 2 0 0 1 2 -2h2",key:"svg-1"}]],ef=Ne("outline","box-multiple","BoxMultiple",Jp);/**
|
||
* @license @tabler/icons-react v3.44.0 - MIT
|
||
*
|
||
* This source code is licensed under the MIT license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const tf=[["path",{d:"M3 9a2 2 0 0 1 2 -2h14a2 2 0 0 1 2 2v9a2 2 0 0 1 -2 2h-14a2 2 0 0 1 -2 -2v-9",key:"svg-0"}],["path",{d:"M8 7v-2a2 2 0 0 1 2 -2h4a2 2 0 0 1 2 2v2",key:"svg-1"}]],nf=Ne("outline","briefcase-2","Briefcase2",tf);/**
|
||
* @license @tabler/icons-react v3.44.0 - MIT
|
||
*
|
||
* This source code is licensed under the MIT license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const sf=[["path",{d:"M8 9l5 5v7h-5v-4m0 4h-5v-7l5 -5m1 1v-6a1 1 0 0 1 1 -1h10a1 1 0 0 1 1 1v17h-8",key:"svg-0"}],["path",{d:"M13 7l0 .01",key:"svg-1"}],["path",{d:"M17 7l0 .01",key:"svg-2"}],["path",{d:"M17 11l0 .01",key:"svg-3"}],["path",{d:"M17 15l0 .01",key:"svg-4"}]],of=Ne("outline","building-community","BuildingCommunity",sf);/**
|
||
* @license @tabler/icons-react v3.44.0 - MIT
|
||
*
|
||
* This source code is licensed under the MIT license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const af=[["path",{d:"M3 21l18 0",key:"svg-0"}],["path",{d:"M9 8l1 0",key:"svg-1"}],["path",{d:"M9 12l1 0",key:"svg-2"}],["path",{d:"M9 16l1 0",key:"svg-3"}],["path",{d:"M14 8l1 0",key:"svg-4"}],["path",{d:"M14 12l1 0",key:"svg-5"}],["path",{d:"M14 16l1 0",key:"svg-6"}],["path",{d:"M5 21v-16a2 2 0 0 1 2 -2h10a2 2 0 0 1 2 2v16",key:"svg-7"}]],Ea=Ne("outline","building","Building",af);/**
|
||
* @license @tabler/icons-react v3.44.0 - MIT
|
||
*
|
||
* This source code is licensed under the MIT license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const rf=[["path",{d:"M4 4h6v6h-6l0 -6",key:"svg-0"}],["path",{d:"M14 4h6v6h-6l0 -6",key:"svg-1"}],["path",{d:"M4 14h6v6h-6l0 -6",key:"svg-2"}],["path",{d:"M14 17a3 3 0 1 0 6 0a3 3 0 1 0 -6 0",key:"svg-3"}]],lf=Ne("outline","category","Category",rf);/**
|
||
* @license @tabler/icons-react v3.44.0 - MIT
|
||
*
|
||
* This source code is licensed under the MIT license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const cf=[["path",{d:"M6 9l6 6l6 -6",key:"svg-0"}]],df=Ne("outline","chevron-down","ChevronDown",cf);/**
|
||
* @license @tabler/icons-react v3.44.0 - MIT
|
||
*
|
||
* This source code is licensed under the MIT license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const uf=[["path",{d:"M7 6v12",key:"svg-0"}],["path",{d:"M18 6l-6 6l6 6",key:"svg-1"}]],gf=Ne("outline","chevron-left-pipe","ChevronLeftPipe",uf);/**
|
||
* @license @tabler/icons-react v3.44.0 - MIT
|
||
*
|
||
* This source code is licensed under the MIT license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const mf=[["path",{d:"M15 6l-6 6l6 6",key:"svg-0"}]],hf=Ne("outline","chevron-left","ChevronLeft",mf);/**
|
||
* @license @tabler/icons-react v3.44.0 - MIT
|
||
*
|
||
* This source code is licensed under the MIT license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const pf=[["path",{d:"M6 6l6 6l-6 6",key:"svg-0"}],["path",{d:"M17 5v13",key:"svg-1"}]],ff=Ne("outline","chevron-right-pipe","ChevronRightPipe",pf);/**
|
||
* @license @tabler/icons-react v3.44.0 - MIT
|
||
*
|
||
* This source code is licensed under the MIT license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const vf=[["path",{d:"M9 6l6 6l-6 6",key:"svg-0"}]],Ur=Ne("outline","chevron-right","ChevronRight",vf);/**
|
||
* @license @tabler/icons-react v3.44.0 - MIT
|
||
*
|
||
* This source code is licensed under the MIT license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const xf=[["path",{d:"M7 7l5 5l5 -5",key:"svg-0"}],["path",{d:"M7 13l5 5l5 -5",key:"svg-1"}]],bf=Ne("outline","chevrons-down","ChevronsDown",xf);/**
|
||
* @license @tabler/icons-react v3.44.0 - MIT
|
||
*
|
||
* This source code is licensed under the MIT license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const yf=[["path",{d:"M3 12a9 9 0 1 0 18 0a9 9 0 1 0 -18 0",key:"svg-0"}],["path",{d:"M10 10l4 4m0 -4l-4 4",key:"svg-1"}]],wf=Ne("outline","circle-x","CircleX",yf);/**
|
||
* @license @tabler/icons-react v3.44.0 - MIT
|
||
*
|
||
* This source code is licensed under the MIT license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const Cf=[["path",{d:"M8 6h12",key:"svg-0"}],["path",{d:"M6 12h12",key:"svg-1"}],["path",{d:"M4 18h12",key:"svg-2"}]],jf=Ne("outline","clear-all","ClearAll",Cf);/**
|
||
* @license @tabler/icons-react v3.44.0 - MIT
|
||
*
|
||
* This source code is licensed under the MIT license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const Sf=[["path",{d:"M4 6l5.5 0",key:"svg-0"}],["path",{d:"M4 10l5.5 0",key:"svg-1"}],["path",{d:"M4 14l5.5 0",key:"svg-2"}],["path",{d:"M4 18l5.5 0",key:"svg-3"}],["path",{d:"M14.5 6l5.5 0",key:"svg-4"}],["path",{d:"M14.5 10l5.5 0",key:"svg-5"}],["path",{d:"M14.5 14l5.5 0",key:"svg-6"}],["path",{d:"M14.5 18l5.5 0",key:"svg-7"}]],_f=Ne("outline","columns","Columns",Sf);/**
|
||
* @license @tabler/icons-react v3.44.0 - MIT
|
||
*
|
||
* This source code is licensed under the MIT license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const Mf=[["path",{d:"M6 4h10l4 4v10a2 2 0 0 1 -2 2h-12a2 2 0 0 1 -2 -2v-12a2 2 0 0 1 2 -2",key:"svg-0"}],["path",{d:"M10 14a2 2 0 1 0 4 0a2 2 0 1 0 -4 0",key:"svg-1"}],["path",{d:"M14 4l0 4l-6 0l0 -4",key:"svg-2"}]],Rf=Ne("outline","device-floppy","DeviceFloppy",Mf);/**
|
||
* @license @tabler/icons-react v3.44.0 - MIT
|
||
*
|
||
* This source code is licensed under the MIT license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const Nf=[["path",{d:"M11 12a1 1 0 1 0 2 0a1 1 0 1 0 -2 0",key:"svg-0"}],["path",{d:"M11 19a1 1 0 1 0 2 0a1 1 0 1 0 -2 0",key:"svg-1"}],["path",{d:"M11 5a1 1 0 1 0 2 0a1 1 0 1 0 -2 0",key:"svg-2"}]],kf=Ne("outline","dots-vertical","DotsVertical",Nf);/**
|
||
* @license @tabler/icons-react v3.44.0 - MIT
|
||
*
|
||
* This source code is licensed under the MIT license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const Df=[["path",{d:"M4 12a1 1 0 1 0 2 0a1 1 0 1 0 -2 0",key:"svg-0"}],["path",{d:"M11 12a1 1 0 1 0 2 0a1 1 0 1 0 -2 0",key:"svg-1"}],["path",{d:"M18 12a1 1 0 1 0 2 0a1 1 0 1 0 -2 0",key:"svg-2"}]],Hr=Ne("outline","dots","Dots",Df);/**
|
||
* @license @tabler/icons-react v3.44.0 - MIT
|
||
*
|
||
* This source code is licensed under the MIT license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const Tf=[["path",{d:"M7 7h-1a2 2 0 0 0 -2 2v9a2 2 0 0 0 2 2h9a2 2 0 0 0 2 -2v-1",key:"svg-0"}],["path",{d:"M20.385 6.585a2.1 2.1 0 0 0 -2.97 -2.97l-8.415 8.385v3h3l8.385 -8.415",key:"svg-1"}],["path",{d:"M16 5l3 3",key:"svg-2"}]],on=Ne("outline","edit","Edit",Tf);/**
|
||
* @license @tabler/icons-react v3.44.0 - MIT
|
||
*
|
||
* This source code is licensed under the MIT license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const If=[["path",{d:"M10.585 10.587a2 2 0 0 0 2.829 2.828",key:"svg-0"}],["path",{d:"M16.681 16.673a8.717 8.717 0 0 1 -4.681 1.327c-3.6 0 -6.6 -2 -9 -6c1.272 -2.12 2.712 -3.678 4.32 -4.674m2.86 -1.146a9.055 9.055 0 0 1 1.82 -.18c3.6 0 6.6 2 9 6c-.666 1.11 -1.379 2.067 -2.138 2.87",key:"svg-1"}],["path",{d:"M3 3l18 18",key:"svg-2"}]],Pf=Ne("outline","eye-off","EyeOff",If);/**
|
||
* @license @tabler/icons-react v3.44.0 - MIT
|
||
*
|
||
* This source code is licensed under the MIT license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const Ff=[["path",{d:"M12 20l-3 1v-8.5l-4.48 -4.928a2 2 0 0 1 -.52 -1.345v-2.227h16v2.172a2 2 0 0 1 -.586 1.414l-4.414 4.414v1.5",key:"svg-0"}],["path",{d:"M17.001 19a2 2 0 1 0 4 0a2 2 0 1 0 -4 0",key:"svg-1"}],["path",{d:"M19.001 15.5v1.5",key:"svg-2"}],["path",{d:"M19.001 21v1.5",key:"svg-3"}],["path",{d:"M22.032 17.25l-1.299 .75",key:"svg-4"}],["path",{d:"M17.27 20l-1.3 .75",key:"svg-5"}],["path",{d:"M15.97 17.25l1.3 .75",key:"svg-6"}],["path",{d:"M20.733 20l1.3 .75",key:"svg-7"}]],Ef=Ne("outline","filter-cog","FilterCog",Ff);/**
|
||
* @license @tabler/icons-react v3.44.0 - MIT
|
||
*
|
||
* This source code is licensed under the MIT license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const Of=[["path",{d:"M8 4h12v2.172a2 2 0 0 1 -.586 1.414l-3.914 3.914m-.5 3.5v4l-6 2v-8.5l-4.48 -4.928a2 2 0 0 1 -.52 -1.345v-2.227",key:"svg-0"}],["path",{d:"M3 3l18 18",key:"svg-1"}]],Af=Ne("outline","filter-off","FilterOff",Of);/**
|
||
* @license @tabler/icons-react v3.44.0 - MIT
|
||
*
|
||
* This source code is licensed under the MIT license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const zf=[["path",{d:"M4 4h16v2.172a2 2 0 0 1 -.586 1.414l-4.414 4.414v7l-6 2v-8.5l-4.48 -4.928a2 2 0 0 1 -.52 -1.345v-2.227",key:"svg-0"}]],$f=Ne("outline","filter","Filter",zf);/**
|
||
* @license @tabler/icons-react v3.44.0 - MIT
|
||
*
|
||
* This source code is licensed under the MIT license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const Lf=[["path",{d:"M4 9a1 1 0 1 0 2 0a1 1 0 1 0 -2 0",key:"svg-0"}],["path",{d:"M4 15a1 1 0 1 0 2 0a1 1 0 1 0 -2 0",key:"svg-1"}],["path",{d:"M11 9a1 1 0 1 0 2 0a1 1 0 1 0 -2 0",key:"svg-2"}],["path",{d:"M11 15a1 1 0 1 0 2 0a1 1 0 1 0 -2 0",key:"svg-3"}],["path",{d:"M18 9a1 1 0 1 0 2 0a1 1 0 1 0 -2 0",key:"svg-4"}],["path",{d:"M18 15a1 1 0 1 0 2 0a1 1 0 1 0 -2 0",key:"svg-5"}]],Vf=Ne("outline","grip-horizontal","GripHorizontal",Lf);/**
|
||
* @license @tabler/icons-react v3.44.0 - MIT
|
||
*
|
||
* This source code is licensed under the MIT license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const Bf=[["path",{d:"M8 5a1 1 0 1 0 2 0a1 1 0 1 0 -2 0",key:"svg-0"}],["path",{d:"M8 12a1 1 0 1 0 2 0a1 1 0 1 0 -2 0",key:"svg-1"}],["path",{d:"M8 19a1 1 0 1 0 2 0a1 1 0 1 0 -2 0",key:"svg-2"}],["path",{d:"M14 5a1 1 0 1 0 2 0a1 1 0 1 0 -2 0",key:"svg-3"}],["path",{d:"M14 12a1 1 0 1 0 2 0a1 1 0 1 0 -2 0",key:"svg-4"}],["path",{d:"M14 19a1 1 0 1 0 2 0a1 1 0 1 0 -2 0",key:"svg-5"}]],xc=Ne("outline","grip-vertical","GripVertical",Bf);/**
|
||
* @license @tabler/icons-react v3.44.0 - MIT
|
||
*
|
||
* This source code is licensed under the MIT license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const Uf=[["path",{d:"M3 12a9 9 0 1 0 18 0a9 9 0 0 0 -18 0",key:"svg-0"}],["path",{d:"M12 9h.01",key:"svg-1"}],["path",{d:"M11 12h1v4h1",key:"svg-2"}]],Hf=Ne("outline","info-circle","InfoCircle",Uf);/**
|
||
* @license @tabler/icons-react v3.44.0 - MIT
|
||
*
|
||
* This source code is licensed under the MIT license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const Gf=[["path",{d:"M4 5a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v4a1 1 0 0 1 -1 1h-4a1 1 0 0 1 -1 -1l0 -4",key:"svg-0"}],["path",{d:"M14 5a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v4a1 1 0 0 1 -1 1h-4a1 1 0 0 1 -1 -1l0 -4",key:"svg-1"}],["path",{d:"M4 15a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v4a1 1 0 0 1 -1 1h-4a1 1 0 0 1 -1 -1l0 -4",key:"svg-2"}],["path",{d:"M14 15a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v4a1 1 0 0 1 -1 1h-4a1 1 0 0 1 -1 -1l0 -4",key:"svg-3"}]],qf=Ne("outline","layout-grid","LayoutGrid",Gf);/**
|
||
* @license @tabler/icons-react v3.44.0 - MIT
|
||
*
|
||
* This source code is licensed under the MIT license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const Wf=[["path",{d:"M4 6a2 2 0 0 1 2 -2h12a2 2 0 0 1 2 2v12a2 2 0 0 1 -2 2h-12a2 2 0 0 1 -2 -2l0 -12",key:"svg-0"}],["path",{d:"M9 4v16",key:"svg-1"}],["path",{d:"M15 10l-2 2l2 2",key:"svg-2"}]],Kf=Ne("outline","layout-sidebar-left-collapse","LayoutSidebarLeftCollapse",Wf);/**
|
||
* @license @tabler/icons-react v3.44.0 - MIT
|
||
*
|
||
* This source code is licensed under the MIT license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const Yf=[["path",{d:"M4 6a2 2 0 0 1 2 -2h12a2 2 0 0 1 2 2v12a2 2 0 0 1 -2 2h-12a2 2 0 0 1 -2 -2l0 -12",key:"svg-0"}],["path",{d:"M9 4v16",key:"svg-1"}],["path",{d:"M14 10l2 2l-2 2",key:"svg-2"}]],Qf=Ne("outline","layout-sidebar-left-expand","LayoutSidebarLeftExpand",Yf);/**
|
||
* @license @tabler/icons-react v3.44.0 - MIT
|
||
*
|
||
* This source code is licensed under the MIT license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const Xf=[["path",{d:"M9 6l11 0",key:"svg-0"}],["path",{d:"M9 12l11 0",key:"svg-1"}],["path",{d:"M9 18l11 0",key:"svg-2"}],["path",{d:"M5 6l0 .01",key:"svg-3"}],["path",{d:"M5 12l0 .01",key:"svg-4"}],["path",{d:"M5 18l0 .01",key:"svg-5"}]],Zf=Ne("outline","list","List",Xf);/**
|
||
* @license @tabler/icons-react v3.44.0 - MIT
|
||
*
|
||
* This source code is licensed under the MIT license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const Jf=[["path",{d:"M3 7a2 2 0 0 1 2 -2h14a2 2 0 0 1 2 2v10a2 2 0 0 1 -2 2h-14a2 2 0 0 1 -2 -2v-10",key:"svg-0"}],["path",{d:"M3 7l9 6l9 -6",key:"svg-1"}]],e0=Ne("outline","mail","Mail",Jf);/**
|
||
* @license @tabler/icons-react v3.44.0 - MIT
|
||
*
|
||
* This source code is licensed under the MIT license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const t0=[["path",{d:"M4 8v-2a2 2 0 0 1 2 -2h2",key:"svg-0"}],["path",{d:"M4 16v2a2 2 0 0 0 2 2h2",key:"svg-1"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v2",key:"svg-2"}],["path",{d:"M16 20h2a2 2 0 0 0 2 -2v-2",key:"svg-3"}]],n0=Ne("outline","maximize","Maximize",t0);/**
|
||
* @license @tabler/icons-react v3.44.0 - MIT
|
||
*
|
||
* This source code is licensed under the MIT license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const s0=[["path",{d:"M15 19v-2a2 2 0 0 1 2 -2h2",key:"svg-0"}],["path",{d:"M15 5v2a2 2 0 0 0 2 2h2",key:"svg-1"}],["path",{d:"M5 15h2a2 2 0 0 1 2 2v2",key:"svg-2"}],["path",{d:"M5 9h2a2 2 0 0 0 2 -2v-2",key:"svg-3"}]],o0=Ne("outline","minimize","Minimize",s0);/**
|
||
* @license @tabler/icons-react v3.44.0 - MIT
|
||
*
|
||
* This source code is licensed under the MIT license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const a0=[["path",{d:"M5 4h4l2 5l-2.5 1.5a11 11 0 0 0 5 5l1.5 -2.5l5 2v4a2 2 0 0 1 -2 2a16 16 0 0 1 -15 -15a2 2 0 0 1 2 -2",key:"svg-0"}]],r0=Ne("outline","phone","Phone",a0);/**
|
||
* @license @tabler/icons-react v3.44.0 - MIT
|
||
*
|
||
* This source code is licensed under the MIT license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const i0=[["path",{d:"M15 8h.01",key:"svg-0"}],["path",{d:"M3 6a3 3 0 0 1 3 -3h12a3 3 0 0 1 3 3v12a3 3 0 0 1 -3 3h-12a3 3 0 0 1 -3 -3v-12",key:"svg-1"}],["path",{d:"M3 16l5 -5c.928 -.893 2.072 -.893 3 0l5 5",key:"svg-2"}],["path",{d:"M14 14l1 -1c.928 -.893 2.072 -.893 3 0l3 3",key:"svg-3"}]],Gr=Ne("outline","photo","Photo",i0);/**
|
||
* @license @tabler/icons-react v3.44.0 - MIT
|
||
*
|
||
* This source code is licensed under the MIT license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const l0=[["path",{d:"M3 3l18 18",key:"svg-0"}],["path",{d:"M15 4.5l-3.249 3.249m-2.57 1.433l-2.181 .818l-1.5 1.5l7 7l1.5 -1.5l.82 -2.186m1.43 -2.563l3.25 -3.251",key:"svg-1"}],["path",{d:"M9 15l-4.5 4.5",key:"svg-2"}],["path",{d:"M14.5 4l5.5 5.5",key:"svg-3"}]],c0=Ne("outline","pinned-off","PinnedOff",l0);/**
|
||
* @license @tabler/icons-react v3.44.0 - MIT
|
||
*
|
||
* This source code is licensed under the MIT license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const d0=[["path",{d:"M9 4v6l-2 4v2h10v-2l-2 -4v-6",key:"svg-0"}],["path",{d:"M12 16l0 5",key:"svg-1"}],["path",{d:"M8 4l8 0",key:"svg-2"}]],u0=Ne("outline","pinned","Pinned",d0);/**
|
||
* @license @tabler/icons-react v3.44.0 - MIT
|
||
*
|
||
* This source code is licensed under the MIT license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const g0=[["path",{d:"M12 5l0 14",key:"svg-0"}],["path",{d:"M5 12l14 0",key:"svg-1"}]],Tn=Ne("outline","plus","Plus",g0);/**
|
||
* @license @tabler/icons-react v3.44.0 - MIT
|
||
*
|
||
* This source code is licensed under the MIT license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const m0=[["path",{d:"M20 11a8.1 8.1 0 0 0 -15.5 -2m-.5 -4v4h4",key:"svg-0"}],["path",{d:"M4 13a8.1 8.1 0 0 0 15.5 2m.5 4v-4h-4",key:"svg-1"}]],bc=Ne("outline","refresh","Refresh",m0);/**
|
||
* @license @tabler/icons-react v3.44.0 - MIT
|
||
*
|
||
* This source code is licensed under the MIT license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const h0=[["path",{d:"M5.039 5.062a7 7 0 0 0 9.91 9.89m1.584 -2.434a7 7 0 0 0 -9.038 -9.057",key:"svg-0"}],["path",{d:"M3 3l18 18",key:"svg-1"}]],p0=Ne("outline","search-off","SearchOff",h0);/**
|
||
* @license @tabler/icons-react v3.44.0 - MIT
|
||
*
|
||
* This source code is licensed under the MIT license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const f0=[["path",{d:"M3 10a7 7 0 1 0 14 0a7 7 0 1 0 -14 0",key:"svg-0"}],["path",{d:"M21 21l-6 -6",key:"svg-1"}]],ps=Ne("outline","search","Search",f0);/**
|
||
* @license @tabler/icons-react v3.44.0 - MIT
|
||
*
|
||
* This source code is licensed under the MIT license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const v0=[["path",{d:"M4 6l7 0",key:"svg-0"}],["path",{d:"M4 12l7 0",key:"svg-1"}],["path",{d:"M4 18l9 0",key:"svg-2"}],["path",{d:"M15 9l3 -3l3 3",key:"svg-3"}],["path",{d:"M18 6l0 12",key:"svg-4"}]],x0=Ne("outline","sort-ascending","SortAscending",v0);/**
|
||
* @license @tabler/icons-react v3.44.0 - MIT
|
||
*
|
||
* This source code is licensed under the MIT license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const b0=[["path",{d:"M4 6l9 0",key:"svg-0"}],["path",{d:"M4 12l7 0",key:"svg-1"}],["path",{d:"M4 18l7 0",key:"svg-2"}],["path",{d:"M15 15l3 3l3 -3",key:"svg-3"}],["path",{d:"M18 6l0 12",key:"svg-4"}]],y0=Ne("outline","sort-descending","SortDescending",b0);/**
|
||
* @license @tabler/icons-react v3.44.0 - MIT
|
||
*
|
||
* This source code is licensed under the MIT license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const w0=[["path",{d:"M3 5a2 2 0 0 1 2 -2h14a2 2 0 0 1 2 2v14a2 2 0 0 1 -2 2h-14a2 2 0 0 1 -2 -2v-14",key:"svg-0"}],["path",{d:"M3 10h18",key:"svg-1"}],["path",{d:"M10 3v18",key:"svg-2"}]],C0=Ne("outline","table","Table",w0);/**
|
||
* @license @tabler/icons-react v3.44.0 - MIT
|
||
*
|
||
* This source code is licensed under the MIT license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const j0=[["path",{d:"M4 7l16 0",key:"svg-0"}],["path",{d:"M10 11l0 6",key:"svg-1"}],["path",{d:"M14 11l0 6",key:"svg-2"}],["path",{d:"M5 7l1 12a2 2 0 0 0 2 2h8a2 2 0 0 0 2 -2l1 -12",key:"svg-3"}],["path",{d:"M9 7v-3a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v3",key:"svg-4"}]],xn=Ne("outline","trash","Trash",j0);/**
|
||
* @license @tabler/icons-react v3.44.0 - MIT
|
||
*
|
||
* This source code is licensed under the MIT license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const S0=[["path",{d:"M3 12a9 9 0 1 0 18 0a9 9 0 1 0 -18 0",key:"svg-0"}],["path",{d:"M9 10a3 3 0 1 0 6 0a3 3 0 1 0 -6 0",key:"svg-1"}],["path",{d:"M6.168 18.849a4 4 0 0 1 3.832 -2.849h4a4 4 0 0 1 3.834 2.855",key:"svg-2"}]],_0=Ne("outline","user-circle","UserCircle",S0);/**
|
||
* @license @tabler/icons-react v3.44.0 - MIT
|
||
*
|
||
* This source code is licensed under the MIT license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const M0=[["path",{d:"M8 7a4 4 0 1 0 8 0a4 4 0 0 0 -8 0",key:"svg-0"}],["path",{d:"M16 19h6",key:"svg-1"}],["path",{d:"M19 16v6",key:"svg-2"}],["path",{d:"M6 21v-2a4 4 0 0 1 4 -4h4",key:"svg-3"}]],qr=Ne("outline","user-plus","UserPlus",M0);/**
|
||
* @license @tabler/icons-react v3.44.0 - MIT
|
||
*
|
||
* This source code is licensed under the MIT license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const R0=[["path",{d:"M8 7a4 4 0 1 0 8 0a4 4 0 0 0 -8 0",key:"svg-0"}],["path",{d:"M6 21v-2a4 4 0 0 1 4 -4h4a4 4 0 0 1 4 4v2",key:"svg-1"}]],N0=Ne("outline","user","User",R0);/**
|
||
* @license @tabler/icons-react v3.44.0 - MIT
|
||
*
|
||
* This source code is licensed under the MIT license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const k0=[["path",{d:"M5 7a4 4 0 1 0 8 0a4 4 0 1 0 -8 0",key:"svg-0"}],["path",{d:"M3 21v-2a4 4 0 0 1 4 -4h4a4 4 0 0 1 4 4v2",key:"svg-1"}],["path",{d:"M16 3.13a4 4 0 0 1 0 7.75",key:"svg-2"}],["path",{d:"M21 21v-2a4 4 0 0 0 -3 -3.85",key:"svg-3"}]],Fo=Ne("outline","users","Users",k0);/**
|
||
* @license @tabler/icons-react v3.44.0 - MIT
|
||
*
|
||
* This source code is licensed under the MIT license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const D0=[["path",{d:"M18 6l-12 12",key:"svg-0"}],["path",{d:"M6 6l12 12",key:"svg-1"}]],yc=Ne("outline","x","X",D0);/**
|
||
* @license @tabler/icons-react v3.44.0 - MIT
|
||
*
|
||
* This source code is licensed under the MIT license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const T0=[["path",{d:"M2 16.667a2.667 2.667 0 0 1 2.667 -2.667h2.666a2.667 2.667 0 0 1 2.667 2.667v2.666a2.667 2.667 0 0 1 -2.667 2.667h-2.666a2.667 2.667 0 0 1 -2.667 -2.667z",key:"svg-0"}],["path",{d:"M14 16.667a2.667 2.667 0 0 1 2.667 -2.667h2.666a2.667 2.667 0 0 1 2.667 2.667v2.666a2.667 2.667 0 0 1 -2.667 2.667h-2.666a2.667 2.667 0 0 1 -2.667 -2.667z",key:"svg-1"}],["path",{d:"M8 4.667a2.667 2.667 0 0 1 2.667 -2.667h2.666a2.667 2.667 0 0 1 2.667 2.667v2.666a2.667 2.667 0 0 1 -2.667 2.667h-2.666a2.667 2.667 0 0 1 -2.667 -2.667z",key:"svg-2"}],["path",{d:"M12 8a1 1 0 0 0 -1 1v2h-3c-1.645 0 -3 1.355 -3 3v1a1 1 0 0 0 1 1a1 1 0 0 0 1 -1v-1c0 -.564 .436 -1 1 -1h8c.564 0 1 .436 1 1v1a1 1 0 0 0 1 1a1 1 0 0 0 1 -1v-1c0 -1.645 -1.355 -3 -3 -3h-3v-2a1 1 0 0 0 -1 -1z",key:"svg-3"}]],I0=Ne("filled","sitemap-filled","SitemapFilled",T0);/**
|
||
* table-core
|
||
*
|
||
* Copyright (c) TanStack
|
||
*
|
||
* This source code is licensed under the MIT license found in the
|
||
* LICENSE.md file in the root directory of this source tree.
|
||
*
|
||
* @license MIT
|
||
*/function fn(e,n){return typeof e=="function"?e(n):e}function Nt(e,n){return t=>{n.setState(o=>({...o,[e]:fn(t,o[e])}))}}function Eo(e){return e instanceof Function}function P0(e){return Array.isArray(e)&&e.every(n=>typeof n=="number")}function wc(e,n){const t=[],o=a=>{a.forEach(r=>{t.push(r);const i=n(r);i!=null&&i.length&&o(i)})};return o(e),t}function ke(e,n,t){let o=[],a;return r=>{let i;t.key&&t.debug&&(i=Date.now());const l=e(r);if(!(l.length!==o.length||l.some((u,g)=>o[g]!==u)))return a;o=l;let c;if(t.key&&t.debug&&(c=Date.now()),a=n(...l),t==null||t.onChange==null||t.onChange(a),t.key&&t.debug&&t!=null&&t.debug()){const u=Math.round((Date.now()-i)*100)/100,h=Math.round((Date.now()-c)*100)/100/16,m=(p,f)=>{for(p=String(p);p.length<f;)p=" "+p;return p}}return a}}function De(e,n,t,o){return{debug:()=>{var a;return(a=e==null?void 0:e.debugAll)!=null?a:e[n]},key:!1,onChange:o}}function F0(e,n,t,o){const a=()=>{var i;return(i=r.getValue())!=null?i:e.options.renderFallbackValue},r={id:`${n.id}_${t.id}`,row:n,column:t,getValue:()=>n.getValue(o),renderValue:a,getContext:ke(()=>[e,t,n,r],(i,l,d,c)=>({table:i,column:l,row:d,cell:c,getValue:c.getValue,renderValue:c.renderValue}),De(e.options,"debugCells"))};return e._features.forEach(i=>{i.createCell==null||i.createCell(r,t,n,e)},{}),r}function E0(e,n,t,o){var a,r;const l={...e._getDefaultColumnDef(),...n},d=l.accessorKey;let c=(a=(r=l.id)!=null?r:d?typeof String.prototype.replaceAll=="function"?d.replaceAll(".","_"):d.replace(/\./g,"_"):void 0)!=null?a:typeof l.header=="string"?l.header:void 0,u;if(l.accessorFn?u=l.accessorFn:d&&(d.includes(".")?u=h=>{let m=h;for(const f of d.split(".")){var p;m=(p=m)==null?void 0:p[f]}return m}:u=h=>h[l.accessorKey]),!c)throw new Error;let g={id:`${String(c)}`,accessorFn:u,parent:o,depth:t,columnDef:l,columns:[],getFlatColumns:ke(()=>[!0],()=>{var h;return[g,...(h=g.columns)==null?void 0:h.flatMap(m=>m.getFlatColumns())]},De(e.options,"debugColumns")),getLeafColumns:ke(()=>[e._getOrderColumnsFn()],h=>{var m;if((m=g.columns)!=null&&m.length){let p=g.columns.flatMap(f=>f.getLeafColumns());return h(p)}return[g]},De(e.options,"debugColumns"))};for(const h of e._features)h.createColumn==null||h.createColumn(g,e);return g}const gt="debugHeaders";function Li(e,n,t){var o;let r={id:(o=t.id)!=null?o:n.id,column:n,index:t.index,isPlaceholder:!!t.isPlaceholder,placeholderId:t.placeholderId,depth:t.depth,subHeaders:[],colSpan:0,rowSpan:0,headerGroup:null,getLeafHeaders:()=>{const i=[],l=d=>{d.subHeaders&&d.subHeaders.length&&d.subHeaders.map(l),i.push(d)};return l(r),i},getContext:()=>({table:e,header:r,column:n})};return e._features.forEach(i=>{i.createHeader==null||i.createHeader(r,e)}),r}const O0={createTable:e=>{e.getHeaderGroups=ke(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(n,t,o,a)=>{var r,i;const l=(r=o==null?void 0:o.map(g=>t.find(h=>h.id===g)).filter(Boolean))!=null?r:[],d=(i=a==null?void 0:a.map(g=>t.find(h=>h.id===g)).filter(Boolean))!=null?i:[],c=t.filter(g=>!(o!=null&&o.includes(g.id))&&!(a!=null&&a.includes(g.id)));return Os(n,[...l,...c,...d],e)},De(e.options,gt)),e.getCenterHeaderGroups=ke(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(n,t,o,a)=>(t=t.filter(r=>!(o!=null&&o.includes(r.id))&&!(a!=null&&a.includes(r.id))),Os(n,t,e,"center")),De(e.options,gt)),e.getLeftHeaderGroups=ke(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left],(n,t,o)=>{var a;const r=(a=o==null?void 0:o.map(i=>t.find(l=>l.id===i)).filter(Boolean))!=null?a:[];return Os(n,r,e,"left")},De(e.options,gt)),e.getRightHeaderGroups=ke(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.right],(n,t,o)=>{var a;const r=(a=o==null?void 0:o.map(i=>t.find(l=>l.id===i)).filter(Boolean))!=null?a:[];return Os(n,r,e,"right")},De(e.options,gt)),e.getFooterGroups=ke(()=>[e.getHeaderGroups()],n=>[...n].reverse(),De(e.options,gt)),e.getLeftFooterGroups=ke(()=>[e.getLeftHeaderGroups()],n=>[...n].reverse(),De(e.options,gt)),e.getCenterFooterGroups=ke(()=>[e.getCenterHeaderGroups()],n=>[...n].reverse(),De(e.options,gt)),e.getRightFooterGroups=ke(()=>[e.getRightHeaderGroups()],n=>[...n].reverse(),De(e.options,gt)),e.getFlatHeaders=ke(()=>[e.getHeaderGroups()],n=>n.map(t=>t.headers).flat(),De(e.options,gt)),e.getLeftFlatHeaders=ke(()=>[e.getLeftHeaderGroups()],n=>n.map(t=>t.headers).flat(),De(e.options,gt)),e.getCenterFlatHeaders=ke(()=>[e.getCenterHeaderGroups()],n=>n.map(t=>t.headers).flat(),De(e.options,gt)),e.getRightFlatHeaders=ke(()=>[e.getRightHeaderGroups()],n=>n.map(t=>t.headers).flat(),De(e.options,gt)),e.getCenterLeafHeaders=ke(()=>[e.getCenterFlatHeaders()],n=>n.filter(t=>{var o;return!((o=t.subHeaders)!=null&&o.length)}),De(e.options,gt)),e.getLeftLeafHeaders=ke(()=>[e.getLeftFlatHeaders()],n=>n.filter(t=>{var o;return!((o=t.subHeaders)!=null&&o.length)}),De(e.options,gt)),e.getRightLeafHeaders=ke(()=>[e.getRightFlatHeaders()],n=>n.filter(t=>{var o;return!((o=t.subHeaders)!=null&&o.length)}),De(e.options,gt)),e.getLeafHeaders=ke(()=>[e.getLeftHeaderGroups(),e.getCenterHeaderGroups(),e.getRightHeaderGroups()],(n,t,o)=>{var a,r,i,l,d,c;return[...(a=(r=n[0])==null?void 0:r.headers)!=null?a:[],...(i=(l=t[0])==null?void 0:l.headers)!=null?i:[],...(d=(c=o[0])==null?void 0:c.headers)!=null?d:[]].map(u=>u.getLeafHeaders()).flat()},De(e.options,gt))}};function Os(e,n,t,o){var a,r;let i=0;const l=function(h,m){m===void 0&&(m=1),i=Math.max(i,m),h.filter(p=>p.getIsVisible()).forEach(p=>{var f;(f=p.columns)!=null&&f.length&&l(p.columns,m+1)},0)};l(e);let d=[];const c=(h,m)=>{const p={depth:m,id:[o,`${m}`].filter(Boolean).join("_"),headers:[]},f=[];h.forEach(v=>{const x=[...f].reverse()[0],y=v.column.depth===p.depth;let w,C=!1;if(y&&v.column.parent?w=v.column.parent:(w=v.column,C=!0),x&&(x==null?void 0:x.column)===w)x.subHeaders.push(v);else{const j=Li(t,w,{id:[o,m,w.id,v==null?void 0:v.id].filter(Boolean).join("_"),isPlaceholder:C,placeholderId:C?`${f.filter(S=>S.column===w).length}`:void 0,depth:m,index:f.length});j.subHeaders.push(v),f.push(j)}p.headers.push(v),v.headerGroup=p}),d.push(p),m>0&&c(f,m-1)},u=n.map((h,m)=>Li(t,h,{depth:i,index:m}));c(u,i-1),d.reverse();const g=h=>h.filter(p=>p.column.getIsVisible()).map(p=>{let f=0,v=0,x=[0];p.subHeaders&&p.subHeaders.length?(x=[],g(p.subHeaders).forEach(w=>{let{colSpan:C,rowSpan:j}=w;f+=C,x.push(j)})):f=1;const y=Math.min(...x);return v=v+y,p.colSpan=f,p.rowSpan=v,{colSpan:f,rowSpan:v}});return g((a=(r=d[0])==null?void 0:r.headers)!=null?a:[]),d}const rs=(e,n,t,o,a,r,i)=>{let l={id:n,index:o,original:t,depth:a,parentId:i,_valuesCache:{},_uniqueValuesCache:{},getValue:d=>{if(l._valuesCache.hasOwnProperty(d))return l._valuesCache[d];const c=e.getColumn(d);if(c!=null&&c.accessorFn)return l._valuesCache[d]=c.accessorFn(l.original,o),l._valuesCache[d]},getUniqueValues:d=>{if(l._uniqueValuesCache.hasOwnProperty(d))return l._uniqueValuesCache[d];const c=e.getColumn(d);if(c!=null&&c.accessorFn)return c.columnDef.getUniqueValues?(l._uniqueValuesCache[d]=c.columnDef.getUniqueValues(l.original,o),l._uniqueValuesCache[d]):(l._uniqueValuesCache[d]=[l.getValue(d)],l._uniqueValuesCache[d])},renderValue:d=>{var c;return(c=l.getValue(d))!=null?c:e.options.renderFallbackValue},subRows:r??[],getLeafRows:()=>wc(l.subRows,d=>d.subRows),getParentRow:()=>l.parentId?e.getRow(l.parentId,!0):void 0,getParentRows:()=>{let d=[],c=l;for(;;){const u=c.getParentRow();if(!u)break;d.push(u),c=u}return d.reverse()},getAllCells:ke(()=>[e.getAllLeafColumns()],d=>d.map(c=>F0(e,l,c,c.id)),De(e.options,"debugRows")),_getAllCellsByColumnId:ke(()=>[l.getAllCells()],d=>d.reduce((c,u)=>(c[u.column.id]=u,c),{}),De(e.options,"debugRows"))};for(let d=0;d<e._features.length;d++){const c=e._features[d];c==null||c.createRow==null||c.createRow(l,e)}return l},A0={createColumn:(e,n)=>{e._getFacetedRowModel=n.options.getFacetedRowModel&&n.options.getFacetedRowModel(n,e.id),e.getFacetedRowModel=()=>e._getFacetedRowModel?e._getFacetedRowModel():n.getPreFilteredRowModel(),e._getFacetedUniqueValues=n.options.getFacetedUniqueValues&&n.options.getFacetedUniqueValues(n,e.id),e.getFacetedUniqueValues=()=>e._getFacetedUniqueValues?e._getFacetedUniqueValues():new Map,e._getFacetedMinMaxValues=n.options.getFacetedMinMaxValues&&n.options.getFacetedMinMaxValues(n,e.id),e.getFacetedMinMaxValues=()=>{if(e._getFacetedMinMaxValues)return e._getFacetedMinMaxValues()}}},Cc=(e,n,t)=>{var o,a;const r=t==null||(o=t.toString())==null?void 0:o.toLowerCase();return!!(!((a=e.getValue(n))==null||(a=a.toString())==null||(a=a.toLowerCase())==null)&&a.includes(r))};Cc.autoRemove=e=>Kt(e);const jc=(e,n,t)=>{var o;return!!(!((o=e.getValue(n))==null||(o=o.toString())==null)&&o.includes(t))};jc.autoRemove=e=>Kt(e);const Sc=(e,n,t)=>{var o;return((o=e.getValue(n))==null||(o=o.toString())==null?void 0:o.toLowerCase())===(t==null?void 0:t.toLowerCase())};Sc.autoRemove=e=>Kt(e);const _c=(e,n,t)=>{var o;return(o=e.getValue(n))==null?void 0:o.includes(t)};_c.autoRemove=e=>Kt(e)||!(e!=null&&e.length);const Mc=(e,n,t)=>!t.some(o=>{var a;return!((a=e.getValue(n))!=null&&a.includes(o))});Mc.autoRemove=e=>Kt(e)||!(e!=null&&e.length);const Rc=(e,n,t)=>t.some(o=>{var a;return(a=e.getValue(n))==null?void 0:a.includes(o)});Rc.autoRemove=e=>Kt(e)||!(e!=null&&e.length);const Nc=(e,n,t)=>e.getValue(n)===t;Nc.autoRemove=e=>Kt(e);const kc=(e,n,t)=>e.getValue(n)==t;kc.autoRemove=e=>Kt(e);const Wr=(e,n,t)=>{let[o,a]=t;const r=e.getValue(n);return r>=o&&r<=a};Wr.resolveFilterValue=e=>{let[n,t]=e,o=typeof n!="number"?parseFloat(n):n,a=typeof t!="number"?parseFloat(t):t,r=n===null||Number.isNaN(o)?-1/0:o,i=t===null||Number.isNaN(a)?1/0:a;if(r>i){const l=r;r=i,i=l}return[r,i]};Wr.autoRemove=e=>Kt(e)||Kt(e[0])&&Kt(e[1]);const tn={includesString:Cc,includesStringSensitive:jc,equalsString:Sc,arrIncludes:_c,arrIncludesAll:Mc,arrIncludesSome:Rc,equals:Nc,weakEquals:kc,inNumberRange:Wr};function Kt(e){return e==null||e===""}const z0={getDefaultColumnDef:()=>({filterFn:"auto"}),getInitialState:e=>({columnFilters:[],...e}),getDefaultOptions:e=>({onColumnFiltersChange:Nt("columnFilters",e),filterFromLeafRows:!1,maxLeafRowFilterDepth:100}),createColumn:(e,n)=>{e.getAutoFilterFn=()=>{const t=n.getCoreRowModel().flatRows[0],o=t==null?void 0:t.getValue(e.id);return typeof o=="string"?tn.includesString:typeof o=="number"?tn.inNumberRange:typeof o=="boolean"||o!==null&&typeof o=="object"?tn.equals:Array.isArray(o)?tn.arrIncludes:tn.weakEquals},e.getFilterFn=()=>{var t,o;return Eo(e.columnDef.filterFn)?e.columnDef.filterFn:e.columnDef.filterFn==="auto"?e.getAutoFilterFn():(t=(o=n.options.filterFns)==null?void 0:o[e.columnDef.filterFn])!=null?t:tn[e.columnDef.filterFn]},e.getCanFilter=()=>{var t,o,a;return((t=e.columnDef.enableColumnFilter)!=null?t:!0)&&((o=n.options.enableColumnFilters)!=null?o:!0)&&((a=n.options.enableFilters)!=null?a:!0)&&!!e.accessorFn},e.getIsFiltered=()=>e.getFilterIndex()>-1,e.getFilterValue=()=>{var t;return(t=n.getState().columnFilters)==null||(t=t.find(o=>o.id===e.id))==null?void 0:t.value},e.getFilterIndex=()=>{var t,o;return(t=(o=n.getState().columnFilters)==null?void 0:o.findIndex(a=>a.id===e.id))!=null?t:-1},e.setFilterValue=t=>{n.setColumnFilters(o=>{const a=e.getFilterFn(),r=o==null?void 0:o.find(u=>u.id===e.id),i=fn(t,r?r.value:void 0);if(Vi(a,i,e)){var l;return(l=o==null?void 0:o.filter(u=>u.id!==e.id))!=null?l:[]}const d={id:e.id,value:i};if(r){var c;return(c=o==null?void 0:o.map(u=>u.id===e.id?d:u))!=null?c:[]}return o!=null&&o.length?[...o,d]:[d]})}},createRow:(e,n)=>{e.columnFilters={},e.columnFiltersMeta={}},createTable:e=>{e.setColumnFilters=n=>{const t=e.getAllLeafColumns(),o=a=>{var r;return(r=fn(n,a))==null?void 0:r.filter(i=>{const l=t.find(d=>d.id===i.id);if(l){const d=l.getFilterFn();if(Vi(d,i.value,l))return!1}return!0})};e.options.onColumnFiltersChange==null||e.options.onColumnFiltersChange(o)},e.resetColumnFilters=n=>{var t,o;e.setColumnFilters(n?[]:(t=(o=e.initialState)==null?void 0:o.columnFilters)!=null?t:[])},e.getPreFilteredRowModel=()=>e.getCoreRowModel(),e.getFilteredRowModel=()=>(!e._getFilteredRowModel&&e.options.getFilteredRowModel&&(e._getFilteredRowModel=e.options.getFilteredRowModel(e)),e.options.manualFiltering||!e._getFilteredRowModel?e.getPreFilteredRowModel():e._getFilteredRowModel())}};function Vi(e,n,t){return(e&&e.autoRemove?e.autoRemove(n,t):!1)||typeof n>"u"||typeof n=="string"&&!n}const $0=(e,n,t)=>t.reduce((o,a)=>{const r=a.getValue(e);return o+(typeof r=="number"?r:0)},0),L0=(e,n,t)=>{let o;return t.forEach(a=>{const r=a.getValue(e);r!=null&&(o>r||o===void 0&&r>=r)&&(o=r)}),o},V0=(e,n,t)=>{let o;return t.forEach(a=>{const r=a.getValue(e);r!=null&&(o<r||o===void 0&&r>=r)&&(o=r)}),o},B0=(e,n,t)=>{let o,a;return t.forEach(r=>{const i=r.getValue(e);i!=null&&(o===void 0?i>=i&&(o=a=i):(o>i&&(o=i),a<i&&(a=i)))}),[o,a]},U0=(e,n)=>{let t=0,o=0;if(n.forEach(a=>{let r=a.getValue(e);r!=null&&(r=+r)>=r&&(++t,o+=r)}),t)return o/t},H0=(e,n)=>{if(!n.length)return;const t=n.map(r=>r.getValue(e));if(!P0(t))return;if(t.length===1)return t[0];const o=Math.floor(t.length/2),a=t.sort((r,i)=>r-i);return t.length%2!==0?a[o]:(a[o-1]+a[o])/2},G0=(e,n)=>Array.from(new Set(n.map(t=>t.getValue(e))).values()),q0=(e,n)=>new Set(n.map(t=>t.getValue(e))).size,W0=(e,n)=>n.length,Ks={sum:$0,min:L0,max:V0,extent:B0,mean:U0,median:H0,unique:G0,uniqueCount:q0,count:W0},K0={getDefaultColumnDef:()=>({aggregatedCell:e=>{var n,t;return(n=(t=e.getValue())==null||t.toString==null?void 0:t.toString())!=null?n:null},aggregationFn:"auto"}),getInitialState:e=>({grouping:[],...e}),getDefaultOptions:e=>({onGroupingChange:Nt("grouping",e),groupedColumnMode:"reorder"}),createColumn:(e,n)=>{e.toggleGrouping=()=>{n.setGrouping(t=>t!=null&&t.includes(e.id)?t.filter(o=>o!==e.id):[...t??[],e.id])},e.getCanGroup=()=>{var t,o;return((t=e.columnDef.enableGrouping)!=null?t:!0)&&((o=n.options.enableGrouping)!=null?o:!0)&&(!!e.accessorFn||!!e.columnDef.getGroupingValue)},e.getIsGrouped=()=>{var t;return(t=n.getState().grouping)==null?void 0:t.includes(e.id)},e.getGroupedIndex=()=>{var t;return(t=n.getState().grouping)==null?void 0:t.indexOf(e.id)},e.getToggleGroupingHandler=()=>{const t=e.getCanGroup();return()=>{t&&e.toggleGrouping()}},e.getAutoAggregationFn=()=>{const t=n.getCoreRowModel().flatRows[0],o=t==null?void 0:t.getValue(e.id);if(typeof o=="number")return Ks.sum;if(Object.prototype.toString.call(o)==="[object Date]")return Ks.extent},e.getAggregationFn=()=>{var t,o;if(!e)throw new Error;return Eo(e.columnDef.aggregationFn)?e.columnDef.aggregationFn:e.columnDef.aggregationFn==="auto"?e.getAutoAggregationFn():(t=(o=n.options.aggregationFns)==null?void 0:o[e.columnDef.aggregationFn])!=null?t:Ks[e.columnDef.aggregationFn]}},createTable:e=>{e.setGrouping=n=>e.options.onGroupingChange==null?void 0:e.options.onGroupingChange(n),e.resetGrouping=n=>{var t,o;e.setGrouping(n?[]:(t=(o=e.initialState)==null?void 0:o.grouping)!=null?t:[])},e.getPreGroupedRowModel=()=>e.getFilteredRowModel(),e.getGroupedRowModel=()=>(!e._getGroupedRowModel&&e.options.getGroupedRowModel&&(e._getGroupedRowModel=e.options.getGroupedRowModel(e)),e.options.manualGrouping||!e._getGroupedRowModel?e.getPreGroupedRowModel():e._getGroupedRowModel())},createRow:(e,n)=>{e.getIsGrouped=()=>!!e.groupingColumnId,e.getGroupingValue=t=>{if(e._groupingValuesCache.hasOwnProperty(t))return e._groupingValuesCache[t];const o=n.getColumn(t);return o!=null&&o.columnDef.getGroupingValue?(e._groupingValuesCache[t]=o.columnDef.getGroupingValue(e.original),e._groupingValuesCache[t]):e.getValue(t)},e._groupingValuesCache={}},createCell:(e,n,t,o)=>{e.getIsGrouped=()=>n.getIsGrouped()&&n.id===t.groupingColumnId,e.getIsPlaceholder=()=>!e.getIsGrouped()&&n.getIsGrouped(),e.getIsAggregated=()=>{var a;return!e.getIsGrouped()&&!e.getIsPlaceholder()&&!!((a=t.subRows)!=null&&a.length)}}};function Y0(e,n,t){if(!(n!=null&&n.length)||!t)return e;const o=e.filter(r=>!n.includes(r.id));return t==="remove"?o:[...n.map(r=>e.find(i=>i.id===r)).filter(Boolean),...o]}const Q0={getInitialState:e=>({columnOrder:[],...e}),getDefaultOptions:e=>({onColumnOrderChange:Nt("columnOrder",e)}),createColumn:(e,n)=>{e.getIndex=ke(t=>[fs(n,t)],t=>t.findIndex(o=>o.id===e.id),De(n.options,"debugColumns")),e.getIsFirstColumn=t=>{var o;return((o=fs(n,t)[0])==null?void 0:o.id)===e.id},e.getIsLastColumn=t=>{var o;const a=fs(n,t);return((o=a[a.length-1])==null?void 0:o.id)===e.id}},createTable:e=>{e.setColumnOrder=n=>e.options.onColumnOrderChange==null?void 0:e.options.onColumnOrderChange(n),e.resetColumnOrder=n=>{var t;e.setColumnOrder(n?[]:(t=e.initialState.columnOrder)!=null?t:[])},e._getOrderColumnsFn=ke(()=>[e.getState().columnOrder,e.getState().grouping,e.options.groupedColumnMode],(n,t,o)=>a=>{let r=[];if(!(n!=null&&n.length))r=a;else{const i=[...n],l=[...a];for(;l.length&&i.length;){const d=i.shift(),c=l.findIndex(u=>u.id===d);c>-1&&r.push(l.splice(c,1)[0])}r=[...r,...l]}return Y0(r,t,o)},De(e.options,"debugTable"))}},oa=()=>({left:[],right:[]}),X0={getInitialState:e=>({columnPinning:oa(),...e}),getDefaultOptions:e=>({onColumnPinningChange:Nt("columnPinning",e)}),createColumn:(e,n)=>{e.pin=t=>{const o=e.getLeafColumns().map(a=>a.id).filter(Boolean);n.setColumnPinning(a=>{var r,i;if(t==="right"){var l,d;return{left:((l=a==null?void 0:a.left)!=null?l:[]).filter(g=>!(o!=null&&o.includes(g))),right:[...((d=a==null?void 0:a.right)!=null?d:[]).filter(g=>!(o!=null&&o.includes(g))),...o]}}if(t==="left"){var c,u;return{left:[...((c=a==null?void 0:a.left)!=null?c:[]).filter(g=>!(o!=null&&o.includes(g))),...o],right:((u=a==null?void 0:a.right)!=null?u:[]).filter(g=>!(o!=null&&o.includes(g)))}}return{left:((r=a==null?void 0:a.left)!=null?r:[]).filter(g=>!(o!=null&&o.includes(g))),right:((i=a==null?void 0:a.right)!=null?i:[]).filter(g=>!(o!=null&&o.includes(g)))}})},e.getCanPin=()=>e.getLeafColumns().some(o=>{var a,r,i;return((a=o.columnDef.enablePinning)!=null?a:!0)&&((r=(i=n.options.enableColumnPinning)!=null?i:n.options.enablePinning)!=null?r:!0)}),e.getIsPinned=()=>{const t=e.getLeafColumns().map(l=>l.id),{left:o,right:a}=n.getState().columnPinning,r=t.some(l=>o==null?void 0:o.includes(l)),i=t.some(l=>a==null?void 0:a.includes(l));return r?"left":i?"right":!1},e.getPinnedIndex=()=>{var t,o;const a=e.getIsPinned();return a?(t=(o=n.getState().columnPinning)==null||(o=o[a])==null?void 0:o.indexOf(e.id))!=null?t:-1:0}},createRow:(e,n)=>{e.getCenterVisibleCells=ke(()=>[e._getAllVisibleCells(),n.getState().columnPinning.left,n.getState().columnPinning.right],(t,o,a)=>{const r=[...o??[],...a??[]];return t.filter(i=>!r.includes(i.column.id))},De(n.options,"debugRows")),e.getLeftVisibleCells=ke(()=>[e._getAllVisibleCells(),n.getState().columnPinning.left],(t,o)=>(o??[]).map(r=>t.find(i=>i.column.id===r)).filter(Boolean).map(r=>({...r,position:"left"})),De(n.options,"debugRows")),e.getRightVisibleCells=ke(()=>[e._getAllVisibleCells(),n.getState().columnPinning.right],(t,o)=>(o??[]).map(r=>t.find(i=>i.column.id===r)).filter(Boolean).map(r=>({...r,position:"right"})),De(n.options,"debugRows"))},createTable:e=>{e.setColumnPinning=n=>e.options.onColumnPinningChange==null?void 0:e.options.onColumnPinningChange(n),e.resetColumnPinning=n=>{var t,o;return e.setColumnPinning(n?oa():(t=(o=e.initialState)==null?void 0:o.columnPinning)!=null?t:oa())},e.getIsSomeColumnsPinned=n=>{var t;const o=e.getState().columnPinning;if(!n){var a,r;return!!((a=o.left)!=null&&a.length||(r=o.right)!=null&&r.length)}return!!((t=o[n])!=null&&t.length)},e.getLeftLeafColumns=ke(()=>[e.getAllLeafColumns(),e.getState().columnPinning.left],(n,t)=>(t??[]).map(o=>n.find(a=>a.id===o)).filter(Boolean),De(e.options,"debugColumns")),e.getRightLeafColumns=ke(()=>[e.getAllLeafColumns(),e.getState().columnPinning.right],(n,t)=>(t??[]).map(o=>n.find(a=>a.id===o)).filter(Boolean),De(e.options,"debugColumns")),e.getCenterLeafColumns=ke(()=>[e.getAllLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(n,t,o)=>{const a=[...t??[],...o??[]];return n.filter(r=>!a.includes(r.id))},De(e.options,"debugColumns"))}},As={size:150,minSize:20,maxSize:Number.MAX_SAFE_INTEGER},aa=()=>({startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,isResizingColumn:!1,columnSizingStart:[]}),Z0={getDefaultColumnDef:()=>As,getInitialState:e=>({columnSizing:{},columnSizingInfo:aa(),...e}),getDefaultOptions:e=>({columnResizeMode:"onEnd",columnResizeDirection:"ltr",onColumnSizingChange:Nt("columnSizing",e),onColumnSizingInfoChange:Nt("columnSizingInfo",e)}),createColumn:(e,n)=>{e.getSize=()=>{var t,o,a;const r=n.getState().columnSizing[e.id];return Math.min(Math.max((t=e.columnDef.minSize)!=null?t:As.minSize,(o=r??e.columnDef.size)!=null?o:As.size),(a=e.columnDef.maxSize)!=null?a:As.maxSize)},e.getStart=ke(t=>[t,fs(n,t),n.getState().columnSizing],(t,o)=>o.slice(0,e.getIndex(t)).reduce((a,r)=>a+r.getSize(),0),De(n.options,"debugColumns")),e.getAfter=ke(t=>[t,fs(n,t),n.getState().columnSizing],(t,o)=>o.slice(e.getIndex(t)+1).reduce((a,r)=>a+r.getSize(),0),De(n.options,"debugColumns")),e.resetSize=()=>{n.setColumnSizing(t=>{let{[e.id]:o,...a}=t;return a})},e.getCanResize=()=>{var t,o;return((t=e.columnDef.enableResizing)!=null?t:!0)&&((o=n.options.enableColumnResizing)!=null?o:!0)},e.getIsResizing=()=>n.getState().columnSizingInfo.isResizingColumn===e.id},createHeader:(e,n)=>{e.getSize=()=>{let t=0;const o=a=>{if(a.subHeaders.length)a.subHeaders.forEach(o);else{var r;t+=(r=a.column.getSize())!=null?r:0}};return o(e),t},e.getStart=()=>{if(e.index>0){const t=e.headerGroup.headers[e.index-1];return t.getStart()+t.getSize()}return 0},e.getResizeHandler=t=>{const o=n.getColumn(e.column.id),a=o==null?void 0:o.getCanResize();return r=>{if(!o||!a||(r.persist==null||r.persist(),ra(r)&&r.touches&&r.touches.length>1))return;const i=e.getSize(),l=e?e.getLeafHeaders().map(x=>[x.column.id,x.column.getSize()]):[[o.id,o.getSize()]],d=ra(r)?Math.round(r.touches[0].clientX):r.clientX,c={},u=(x,y)=>{typeof y=="number"&&(n.setColumnSizingInfo(w=>{var C,j;const S=n.options.columnResizeDirection==="rtl"?-1:1,R=(y-((C=w==null?void 0:w.startOffset)!=null?C:0))*S,_=Math.max(R/((j=w==null?void 0:w.startSize)!=null?j:0),-.999999);return w.columnSizingStart.forEach(T=>{let[k,I]=T;c[k]=Math.round(Math.max(I+I*_,0)*100)/100}),{...w,deltaOffset:R,deltaPercentage:_}}),(n.options.columnResizeMode==="onChange"||x==="end")&&n.setColumnSizing(w=>({...w,...c})))},g=x=>u("move",x),h=x=>{u("end",x),n.setColumnSizingInfo(y=>({...y,isResizingColumn:!1,startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,columnSizingStart:[]}))},m=t||typeof document<"u"?document:null,p={moveHandler:x=>g(x.clientX),upHandler:x=>{m==null||m.removeEventListener("mousemove",p.moveHandler),m==null||m.removeEventListener("mouseup",p.upHandler),h(x.clientX)}},f={moveHandler:x=>(x.cancelable&&(x.preventDefault(),x.stopPropagation()),g(x.touches[0].clientX),!1),upHandler:x=>{var y;m==null||m.removeEventListener("touchmove",f.moveHandler),m==null||m.removeEventListener("touchend",f.upHandler),x.cancelable&&(x.preventDefault(),x.stopPropagation()),h((y=x.touches[0])==null?void 0:y.clientX)}},v=J0()?{passive:!1}:!1;ra(r)?(m==null||m.addEventListener("touchmove",f.moveHandler,v),m==null||m.addEventListener("touchend",f.upHandler,v)):(m==null||m.addEventListener("mousemove",p.moveHandler,v),m==null||m.addEventListener("mouseup",p.upHandler,v)),n.setColumnSizingInfo(x=>({...x,startOffset:d,startSize:i,deltaOffset:0,deltaPercentage:0,columnSizingStart:l,isResizingColumn:o.id}))}}},createTable:e=>{e.setColumnSizing=n=>e.options.onColumnSizingChange==null?void 0:e.options.onColumnSizingChange(n),e.setColumnSizingInfo=n=>e.options.onColumnSizingInfoChange==null?void 0:e.options.onColumnSizingInfoChange(n),e.resetColumnSizing=n=>{var t;e.setColumnSizing(n?{}:(t=e.initialState.columnSizing)!=null?t:{})},e.resetHeaderSizeInfo=n=>{var t;e.setColumnSizingInfo(n?aa():(t=e.initialState.columnSizingInfo)!=null?t:aa())},e.getTotalSize=()=>{var n,t;return(n=(t=e.getHeaderGroups()[0])==null?void 0:t.headers.reduce((o,a)=>o+a.getSize(),0))!=null?n:0},e.getLeftTotalSize=()=>{var n,t;return(n=(t=e.getLeftHeaderGroups()[0])==null?void 0:t.headers.reduce((o,a)=>o+a.getSize(),0))!=null?n:0},e.getCenterTotalSize=()=>{var n,t;return(n=(t=e.getCenterHeaderGroups()[0])==null?void 0:t.headers.reduce((o,a)=>o+a.getSize(),0))!=null?n:0},e.getRightTotalSize=()=>{var n,t;return(n=(t=e.getRightHeaderGroups()[0])==null?void 0:t.headers.reduce((o,a)=>o+a.getSize(),0))!=null?n:0}}};let zs=null;function J0(){if(typeof zs=="boolean")return zs;let e=!1;try{const n={get passive(){return e=!0,!1}},t=()=>{};window.addEventListener("test",t,n),window.removeEventListener("test",t)}catch{e=!1}return zs=e,zs}function ra(e){return e.type==="touchstart"}const ev={getInitialState:e=>({columnVisibility:{},...e}),getDefaultOptions:e=>({onColumnVisibilityChange:Nt("columnVisibility",e)}),createColumn:(e,n)=>{e.toggleVisibility=t=>{e.getCanHide()&&n.setColumnVisibility(o=>({...o,[e.id]:t??!e.getIsVisible()}))},e.getIsVisible=()=>{var t,o;const a=e.columns;return(t=a.length?a.some(r=>r.getIsVisible()):(o=n.getState().columnVisibility)==null?void 0:o[e.id])!=null?t:!0},e.getCanHide=()=>{var t,o;return((t=e.columnDef.enableHiding)!=null?t:!0)&&((o=n.options.enableHiding)!=null?o:!0)},e.getToggleVisibilityHandler=()=>t=>{e.toggleVisibility==null||e.toggleVisibility(t.target.checked)}},createRow:(e,n)=>{e._getAllVisibleCells=ke(()=>[e.getAllCells(),n.getState().columnVisibility],t=>t.filter(o=>o.column.getIsVisible()),De(n.options,"debugRows")),e.getVisibleCells=ke(()=>[e.getLeftVisibleCells(),e.getCenterVisibleCells(),e.getRightVisibleCells()],(t,o,a)=>[...t,...o,...a],De(n.options,"debugRows"))},createTable:e=>{const n=(t,o)=>ke(()=>[o(),o().filter(a=>a.getIsVisible()).map(a=>a.id).join("_")],a=>a.filter(r=>r.getIsVisible==null?void 0:r.getIsVisible()),De(e.options,"debugColumns"));e.getVisibleFlatColumns=n("getVisibleFlatColumns",()=>e.getAllFlatColumns()),e.getVisibleLeafColumns=n("getVisibleLeafColumns",()=>e.getAllLeafColumns()),e.getLeftVisibleLeafColumns=n("getLeftVisibleLeafColumns",()=>e.getLeftLeafColumns()),e.getRightVisibleLeafColumns=n("getRightVisibleLeafColumns",()=>e.getRightLeafColumns()),e.getCenterVisibleLeafColumns=n("getCenterVisibleLeafColumns",()=>e.getCenterLeafColumns()),e.setColumnVisibility=t=>e.options.onColumnVisibilityChange==null?void 0:e.options.onColumnVisibilityChange(t),e.resetColumnVisibility=t=>{var o;e.setColumnVisibility(t?{}:(o=e.initialState.columnVisibility)!=null?o:{})},e.toggleAllColumnsVisible=t=>{var o;t=(o=t)!=null?o:!e.getIsAllColumnsVisible(),e.setColumnVisibility(e.getAllLeafColumns().reduce((a,r)=>({...a,[r.id]:t||!(r.getCanHide!=null&&r.getCanHide())}),{}))},e.getIsAllColumnsVisible=()=>!e.getAllLeafColumns().some(t=>!(t.getIsVisible!=null&&t.getIsVisible())),e.getIsSomeColumnsVisible=()=>e.getAllLeafColumns().some(t=>t.getIsVisible==null?void 0:t.getIsVisible()),e.getToggleAllColumnsVisibilityHandler=()=>t=>{var o;e.toggleAllColumnsVisible((o=t.target)==null?void 0:o.checked)}}};function fs(e,n){return n?n==="center"?e.getCenterVisibleLeafColumns():n==="left"?e.getLeftVisibleLeafColumns():e.getRightVisibleLeafColumns():e.getVisibleLeafColumns()}const tv={createTable:e=>{e._getGlobalFacetedRowModel=e.options.getFacetedRowModel&&e.options.getFacetedRowModel(e,"__global__"),e.getGlobalFacetedRowModel=()=>e.options.manualFiltering||!e._getGlobalFacetedRowModel?e.getPreFilteredRowModel():e._getGlobalFacetedRowModel(),e._getGlobalFacetedUniqueValues=e.options.getFacetedUniqueValues&&e.options.getFacetedUniqueValues(e,"__global__"),e.getGlobalFacetedUniqueValues=()=>e._getGlobalFacetedUniqueValues?e._getGlobalFacetedUniqueValues():new Map,e._getGlobalFacetedMinMaxValues=e.options.getFacetedMinMaxValues&&e.options.getFacetedMinMaxValues(e,"__global__"),e.getGlobalFacetedMinMaxValues=()=>{if(e._getGlobalFacetedMinMaxValues)return e._getGlobalFacetedMinMaxValues()}}},nv={getInitialState:e=>({globalFilter:void 0,...e}),getDefaultOptions:e=>({onGlobalFilterChange:Nt("globalFilter",e),globalFilterFn:"auto",getColumnCanGlobalFilter:n=>{var t;const o=(t=e.getCoreRowModel().flatRows[0])==null||(t=t._getAllCellsByColumnId()[n.id])==null?void 0:t.getValue();return typeof o=="string"||typeof o=="number"}}),createColumn:(e,n)=>{e.getCanGlobalFilter=()=>{var t,o,a,r;return((t=e.columnDef.enableGlobalFilter)!=null?t:!0)&&((o=n.options.enableGlobalFilter)!=null?o:!0)&&((a=n.options.enableFilters)!=null?a:!0)&&((r=n.options.getColumnCanGlobalFilter==null?void 0:n.options.getColumnCanGlobalFilter(e))!=null?r:!0)&&!!e.accessorFn}},createTable:e=>{e.getGlobalAutoFilterFn=()=>tn.includesString,e.getGlobalFilterFn=()=>{var n,t;const{globalFilterFn:o}=e.options;return Eo(o)?o:o==="auto"?e.getGlobalAutoFilterFn():(n=(t=e.options.filterFns)==null?void 0:t[o])!=null?n:tn[o]},e.setGlobalFilter=n=>{e.options.onGlobalFilterChange==null||e.options.onGlobalFilterChange(n)},e.resetGlobalFilter=n=>{e.setGlobalFilter(n?void 0:e.initialState.globalFilter)}}},sv={getInitialState:e=>({expanded:{},...e}),getDefaultOptions:e=>({onExpandedChange:Nt("expanded",e),paginateExpandedRows:!0}),createTable:e=>{let n=!1,t=!1;e._autoResetExpanded=()=>{var o,a;if(!n){e._queue(()=>{n=!0});return}if((o=(a=e.options.autoResetAll)!=null?a:e.options.autoResetExpanded)!=null?o:!e.options.manualExpanding){if(t)return;t=!0,e._queue(()=>{e.resetExpanded(),t=!1})}},e.setExpanded=o=>e.options.onExpandedChange==null?void 0:e.options.onExpandedChange(o),e.toggleAllRowsExpanded=o=>{o??!e.getIsAllRowsExpanded()?e.setExpanded(!0):e.setExpanded({})},e.resetExpanded=o=>{var a,r;e.setExpanded(o?{}:(a=(r=e.initialState)==null?void 0:r.expanded)!=null?a:{})},e.getCanSomeRowsExpand=()=>e.getPrePaginationRowModel().flatRows.some(o=>o.getCanExpand()),e.getToggleAllRowsExpandedHandler=()=>o=>{o.persist==null||o.persist(),e.toggleAllRowsExpanded()},e.getIsSomeRowsExpanded=()=>{const o=e.getState().expanded;return o===!0||Object.values(o).some(Boolean)},e.getIsAllRowsExpanded=()=>{const o=e.getState().expanded;return typeof o=="boolean"?o===!0:!(!Object.keys(o).length||e.getRowModel().flatRows.some(a=>!a.getIsExpanded()))},e.getExpandedDepth=()=>{let o=0;return(e.getState().expanded===!0?Object.keys(e.getRowModel().rowsById):Object.keys(e.getState().expanded)).forEach(r=>{const i=r.split(".");o=Math.max(o,i.length)}),o},e.getPreExpandedRowModel=()=>e.getSortedRowModel(),e.getExpandedRowModel=()=>(!e._getExpandedRowModel&&e.options.getExpandedRowModel&&(e._getExpandedRowModel=e.options.getExpandedRowModel(e)),e.options.manualExpanding||!e._getExpandedRowModel?e.getPreExpandedRowModel():e._getExpandedRowModel())},createRow:(e,n)=>{e.toggleExpanded=t=>{n.setExpanded(o=>{var a;const r=o===!0?!0:!!(o!=null&&o[e.id]);let i={};if(o===!0?Object.keys(n.getRowModel().rowsById).forEach(l=>{i[l]=!0}):i=o,t=(a=t)!=null?a:!r,!r&&t)return{...i,[e.id]:!0};if(r&&!t){const{[e.id]:l,...d}=i;return d}return o})},e.getIsExpanded=()=>{var t;const o=n.getState().expanded;return!!((t=n.options.getIsRowExpanded==null?void 0:n.options.getIsRowExpanded(e))!=null?t:o===!0||o!=null&&o[e.id])},e.getCanExpand=()=>{var t,o,a;return(t=n.options.getRowCanExpand==null?void 0:n.options.getRowCanExpand(e))!=null?t:((o=n.options.enableExpanding)!=null?o:!0)&&!!((a=e.subRows)!=null&&a.length)},e.getIsAllParentsExpanded=()=>{let t=!0,o=e;for(;t&&o.parentId;)o=n.getRow(o.parentId,!0),t=o.getIsExpanded();return t},e.getToggleExpandedHandler=()=>{const t=e.getCanExpand();return()=>{t&&e.toggleExpanded()}}}},Oa=0,Aa=10,ia=()=>({pageIndex:Oa,pageSize:Aa}),ov={getInitialState:e=>({...e,pagination:{...ia(),...e==null?void 0:e.pagination}}),getDefaultOptions:e=>({onPaginationChange:Nt("pagination",e)}),createTable:e=>{let n=!1,t=!1;e._autoResetPageIndex=()=>{var o,a;if(!n){e._queue(()=>{n=!0});return}if((o=(a=e.options.autoResetAll)!=null?a:e.options.autoResetPageIndex)!=null?o:!e.options.manualPagination){if(t)return;t=!0,e._queue(()=>{e.resetPageIndex(),t=!1})}},e.setPagination=o=>{const a=r=>fn(o,r);return e.options.onPaginationChange==null?void 0:e.options.onPaginationChange(a)},e.resetPagination=o=>{var a;e.setPagination(o?ia():(a=e.initialState.pagination)!=null?a:ia())},e.setPageIndex=o=>{e.setPagination(a=>{let r=fn(o,a.pageIndex);const i=typeof e.options.pageCount>"u"||e.options.pageCount===-1?Number.MAX_SAFE_INTEGER:e.options.pageCount-1;return r=Math.max(0,Math.min(r,i)),{...a,pageIndex:r}})},e.resetPageIndex=o=>{var a,r;e.setPageIndex(o?Oa:(a=(r=e.initialState)==null||(r=r.pagination)==null?void 0:r.pageIndex)!=null?a:Oa)},e.resetPageSize=o=>{var a,r;e.setPageSize(o?Aa:(a=(r=e.initialState)==null||(r=r.pagination)==null?void 0:r.pageSize)!=null?a:Aa)},e.setPageSize=o=>{e.setPagination(a=>{const r=Math.max(1,fn(o,a.pageSize)),i=a.pageSize*a.pageIndex,l=Math.floor(i/r);return{...a,pageIndex:l,pageSize:r}})},e.setPageCount=o=>e.setPagination(a=>{var r;let i=fn(o,(r=e.options.pageCount)!=null?r:-1);return typeof i=="number"&&(i=Math.max(-1,i)),{...a,pageCount:i}}),e.getPageOptions=ke(()=>[e.getPageCount()],o=>{let a=[];return o&&o>0&&(a=[...new Array(o)].fill(null).map((r,i)=>i)),a},De(e.options,"debugTable")),e.getCanPreviousPage=()=>e.getState().pagination.pageIndex>0,e.getCanNextPage=()=>{const{pageIndex:o}=e.getState().pagination,a=e.getPageCount();return a===-1?!0:a===0?!1:o<a-1},e.previousPage=()=>e.setPageIndex(o=>o-1),e.nextPage=()=>e.setPageIndex(o=>o+1),e.firstPage=()=>e.setPageIndex(0),e.lastPage=()=>e.setPageIndex(e.getPageCount()-1),e.getPrePaginationRowModel=()=>e.getExpandedRowModel(),e.getPaginationRowModel=()=>(!e._getPaginationRowModel&&e.options.getPaginationRowModel&&(e._getPaginationRowModel=e.options.getPaginationRowModel(e)),e.options.manualPagination||!e._getPaginationRowModel?e.getPrePaginationRowModel():e._getPaginationRowModel()),e.getPageCount=()=>{var o;return(o=e.options.pageCount)!=null?o:Math.ceil(e.getRowCount()/e.getState().pagination.pageSize)},e.getRowCount=()=>{var o;return(o=e.options.rowCount)!=null?o:e.getPrePaginationRowModel().rows.length}}},la=()=>({top:[],bottom:[]}),av={getInitialState:e=>({rowPinning:la(),...e}),getDefaultOptions:e=>({onRowPinningChange:Nt("rowPinning",e)}),createRow:(e,n)=>{e.pin=(t,o,a)=>{const r=o?e.getLeafRows().map(d=>{let{id:c}=d;return c}):[],i=a?e.getParentRows().map(d=>{let{id:c}=d;return c}):[],l=new Set([...i,e.id,...r]);n.setRowPinning(d=>{var c,u;if(t==="bottom"){var g,h;return{top:((g=d==null?void 0:d.top)!=null?g:[]).filter(f=>!(l!=null&&l.has(f))),bottom:[...((h=d==null?void 0:d.bottom)!=null?h:[]).filter(f=>!(l!=null&&l.has(f))),...Array.from(l)]}}if(t==="top"){var m,p;return{top:[...((m=d==null?void 0:d.top)!=null?m:[]).filter(f=>!(l!=null&&l.has(f))),...Array.from(l)],bottom:((p=d==null?void 0:d.bottom)!=null?p:[]).filter(f=>!(l!=null&&l.has(f)))}}return{top:((c=d==null?void 0:d.top)!=null?c:[]).filter(f=>!(l!=null&&l.has(f))),bottom:((u=d==null?void 0:d.bottom)!=null?u:[]).filter(f=>!(l!=null&&l.has(f)))}})},e.getCanPin=()=>{var t;const{enableRowPinning:o,enablePinning:a}=n.options;return typeof o=="function"?o(e):(t=o??a)!=null?t:!0},e.getIsPinned=()=>{const t=[e.id],{top:o,bottom:a}=n.getState().rowPinning,r=t.some(l=>o==null?void 0:o.includes(l)),i=t.some(l=>a==null?void 0:a.includes(l));return r?"top":i?"bottom":!1},e.getPinnedIndex=()=>{var t,o;const a=e.getIsPinned();if(!a)return-1;const r=(t=a==="top"?n.getTopRows():n.getBottomRows())==null?void 0:t.map(i=>{let{id:l}=i;return l});return(o=r==null?void 0:r.indexOf(e.id))!=null?o:-1}},createTable:e=>{e.setRowPinning=n=>e.options.onRowPinningChange==null?void 0:e.options.onRowPinningChange(n),e.resetRowPinning=n=>{var t,o;return e.setRowPinning(n?la():(t=(o=e.initialState)==null?void 0:o.rowPinning)!=null?t:la())},e.getIsSomeRowsPinned=n=>{var t;const o=e.getState().rowPinning;if(!n){var a,r;return!!((a=o.top)!=null&&a.length||(r=o.bottom)!=null&&r.length)}return!!((t=o[n])!=null&&t.length)},e._getPinnedRows=(n,t,o)=>{var a;return((a=e.options.keepPinnedRows)==null||a?(t??[]).map(i=>{const l=e.getRow(i,!0);return l.getIsAllParentsExpanded()?l:null}):(t??[]).map(i=>n.find(l=>l.id===i))).filter(Boolean).map(i=>({...i,position:o}))},e.getTopRows=ke(()=>[e.getRowModel().rows,e.getState().rowPinning.top],(n,t)=>e._getPinnedRows(n,t,"top"),De(e.options,"debugRows")),e.getBottomRows=ke(()=>[e.getRowModel().rows,e.getState().rowPinning.bottom],(n,t)=>e._getPinnedRows(n,t,"bottom"),De(e.options,"debugRows")),e.getCenterRows=ke(()=>[e.getRowModel().rows,e.getState().rowPinning.top,e.getState().rowPinning.bottom],(n,t,o)=>{const a=new Set([...t??[],...o??[]]);return n.filter(r=>!a.has(r.id))},De(e.options,"debugRows"))}},rv={getInitialState:e=>({rowSelection:{},...e}),getDefaultOptions:e=>({onRowSelectionChange:Nt("rowSelection",e),enableRowSelection:!0,enableMultiRowSelection:!0,enableSubRowSelection:!0}),createTable:e=>{e.setRowSelection=n=>e.options.onRowSelectionChange==null?void 0:e.options.onRowSelectionChange(n),e.resetRowSelection=n=>{var t;return e.setRowSelection(n?{}:(t=e.initialState.rowSelection)!=null?t:{})},e.toggleAllRowsSelected=n=>{e.setRowSelection(t=>{n=typeof n<"u"?n:!e.getIsAllRowsSelected();const o={...t},a=e.getPreGroupedRowModel().flatRows;return n?a.forEach(r=>{r.getCanSelect()&&(o[r.id]=!0)}):a.forEach(r=>{delete o[r.id]}),o})},e.toggleAllPageRowsSelected=n=>e.setRowSelection(t=>{const o=typeof n<"u"?n:!e.getIsAllPageRowsSelected(),a={...t};return e.getRowModel().rows.forEach(r=>{za(a,r.id,o,!0,e)}),a}),e.getPreSelectedRowModel=()=>e.getCoreRowModel(),e.getSelectedRowModel=ke(()=>[e.getState().rowSelection,e.getCoreRowModel()],(n,t)=>Object.keys(n).length?ca(e,t):{rows:[],flatRows:[],rowsById:{}},De(e.options,"debugTable")),e.getFilteredSelectedRowModel=ke(()=>[e.getState().rowSelection,e.getFilteredRowModel()],(n,t)=>Object.keys(n).length?ca(e,t):{rows:[],flatRows:[],rowsById:{}},De(e.options,"debugTable")),e.getGroupedSelectedRowModel=ke(()=>[e.getState().rowSelection,e.getSortedRowModel()],(n,t)=>Object.keys(n).length?ca(e,t):{rows:[],flatRows:[],rowsById:{}},De(e.options,"debugTable")),e.getIsAllRowsSelected=()=>{const n=e.getFilteredRowModel().flatRows,{rowSelection:t}=e.getState();let o=!!(n.length&&Object.keys(t).length);return o&&n.some(a=>a.getCanSelect()&&!t[a.id])&&(o=!1),o},e.getIsAllPageRowsSelected=()=>{const n=e.getPaginationRowModel().flatRows.filter(a=>a.getCanSelect()),{rowSelection:t}=e.getState();let o=!!n.length;return o&&n.some(a=>!t[a.id])&&(o=!1),o},e.getIsSomeRowsSelected=()=>{var n;const t=Object.keys((n=e.getState().rowSelection)!=null?n:{}).length;return t>0&&t<e.getFilteredRowModel().flatRows.length},e.getIsSomePageRowsSelected=()=>{const n=e.getPaginationRowModel().flatRows;return e.getIsAllPageRowsSelected()?!1:n.filter(t=>t.getCanSelect()).some(t=>t.getIsSelected()||t.getIsSomeSelected())},e.getToggleAllRowsSelectedHandler=()=>n=>{e.toggleAllRowsSelected(n.target.checked)},e.getToggleAllPageRowsSelectedHandler=()=>n=>{e.toggleAllPageRowsSelected(n.target.checked)}},createRow:(e,n)=>{e.toggleSelected=(t,o)=>{const a=e.getIsSelected();n.setRowSelection(r=>{var i;if(t=typeof t<"u"?t:!a,e.getCanSelect()&&a===t)return r;const l={...r};return za(l,e.id,t,(i=o==null?void 0:o.selectChildren)!=null?i:!0,n),l})},e.getIsSelected=()=>{const{rowSelection:t}=n.getState();return Kr(e,t)},e.getIsSomeSelected=()=>{const{rowSelection:t}=n.getState();return $a(e,t)==="some"},e.getIsAllSubRowsSelected=()=>{const{rowSelection:t}=n.getState();return $a(e,t)==="all"},e.getCanSelect=()=>{var t;return typeof n.options.enableRowSelection=="function"?n.options.enableRowSelection(e):(t=n.options.enableRowSelection)!=null?t:!0},e.getCanSelectSubRows=()=>{var t;return typeof n.options.enableSubRowSelection=="function"?n.options.enableSubRowSelection(e):(t=n.options.enableSubRowSelection)!=null?t:!0},e.getCanMultiSelect=()=>{var t;return typeof n.options.enableMultiRowSelection=="function"?n.options.enableMultiRowSelection(e):(t=n.options.enableMultiRowSelection)!=null?t:!0},e.getToggleSelectedHandler=()=>{const t=e.getCanSelect();return o=>{var a;t&&e.toggleSelected((a=o.target)==null?void 0:a.checked)}}}},za=(e,n,t,o,a)=>{var r;const i=a.getRow(n,!0);t?(i.getCanMultiSelect()||Object.keys(e).forEach(l=>delete e[l]),i.getCanSelect()&&(e[n]=!0)):delete e[n],o&&(r=i.subRows)!=null&&r.length&&i.getCanSelectSubRows()&&i.subRows.forEach(l=>za(e,l.id,t,o,a))};function ca(e,n){const t=e.getState().rowSelection,o=[],a={},r=function(i,l){return i.map(d=>{var c;const u=Kr(d,t);if(u&&(o.push(d),a[d.id]=d),(c=d.subRows)!=null&&c.length&&(d={...d,subRows:r(d.subRows)}),u)return d}).filter(Boolean)};return{rows:r(n.rows),flatRows:o,rowsById:a}}function Kr(e,n){var t;return(t=n[e.id])!=null?t:!1}function $a(e,n,t){var o;if(!((o=e.subRows)!=null&&o.length))return!1;let a=!0,r=!1;return e.subRows.forEach(i=>{if(!(r&&!a)&&(i.getCanSelect()&&(Kr(i,n)?r=!0:a=!1),i.subRows&&i.subRows.length)){const l=$a(i,n);l==="all"?r=!0:(l==="some"&&(r=!0),a=!1)}}),a?"all":r?"some":!1}const La=/([0-9]+)/gm,iv=(e,n,t)=>Dc(bn(e.getValue(t)).toLowerCase(),bn(n.getValue(t)).toLowerCase()),lv=(e,n,t)=>Dc(bn(e.getValue(t)),bn(n.getValue(t))),cv=(e,n,t)=>Yr(bn(e.getValue(t)).toLowerCase(),bn(n.getValue(t)).toLowerCase()),dv=(e,n,t)=>Yr(bn(e.getValue(t)),bn(n.getValue(t))),uv=(e,n,t)=>{const o=e.getValue(t),a=n.getValue(t);return o>a?1:o<a?-1:0},gv=(e,n,t)=>Yr(e.getValue(t),n.getValue(t));function Yr(e,n){return e===n?0:e>n?1:-1}function bn(e){return typeof e=="number"?isNaN(e)||e===1/0||e===-1/0?"":String(e):typeof e=="string"?e:""}function Dc(e,n){const t=e.split(La).filter(Boolean),o=n.split(La).filter(Boolean);for(;t.length&&o.length;){const a=t.shift(),r=o.shift(),i=parseInt(a,10),l=parseInt(r,10),d=[i,l].sort();if(isNaN(d[0])){if(a>r)return 1;if(r>a)return-1;continue}if(isNaN(d[1]))return isNaN(i)?-1:1;if(i>l)return 1;if(l>i)return-1}return t.length-o.length}const Nn={alphanumeric:iv,alphanumericCaseSensitive:lv,text:cv,textCaseSensitive:dv,datetime:uv,basic:gv},mv={getInitialState:e=>({sorting:[],...e}),getDefaultColumnDef:()=>({sortingFn:"auto",sortUndefined:1}),getDefaultOptions:e=>({onSortingChange:Nt("sorting",e),isMultiSortEvent:n=>n.shiftKey}),createColumn:(e,n)=>{e.getAutoSortingFn=()=>{const t=n.getFilteredRowModel().flatRows.slice(10);let o=!1;for(const a of t){const r=a==null?void 0:a.getValue(e.id);if(Object.prototype.toString.call(r)==="[object Date]")return Nn.datetime;if(typeof r=="string"&&(o=!0,r.split(La).length>1))return Nn.alphanumeric}return o?Nn.text:Nn.basic},e.getAutoSortDir=()=>{const t=n.getFilteredRowModel().flatRows[0];return typeof(t==null?void 0:t.getValue(e.id))=="string"?"asc":"desc"},e.getSortingFn=()=>{var t,o;if(!e)throw new Error;return Eo(e.columnDef.sortingFn)?e.columnDef.sortingFn:e.columnDef.sortingFn==="auto"?e.getAutoSortingFn():(t=(o=n.options.sortingFns)==null?void 0:o[e.columnDef.sortingFn])!=null?t:Nn[e.columnDef.sortingFn]},e.toggleSorting=(t,o)=>{const a=e.getNextSortingOrder(),r=typeof t<"u"&&t!==null;n.setSorting(i=>{const l=i==null?void 0:i.find(m=>m.id===e.id),d=i==null?void 0:i.findIndex(m=>m.id===e.id);let c=[],u,g=r?t:a==="desc";if(i!=null&&i.length&&e.getCanMultiSort()&&o?l?u="toggle":u="add":i!=null&&i.length&&d!==i.length-1?u="replace":l?u="toggle":u="replace",u==="toggle"&&(r||a||(u="remove")),u==="add"){var h;c=[...i,{id:e.id,desc:g}],c.splice(0,c.length-((h=n.options.maxMultiSortColCount)!=null?h:Number.MAX_SAFE_INTEGER))}else u==="toggle"?c=i.map(m=>m.id===e.id?{...m,desc:g}:m):u==="remove"?c=i.filter(m=>m.id!==e.id):c=[{id:e.id,desc:g}];return c})},e.getFirstSortDir=()=>{var t,o;return((t=(o=e.columnDef.sortDescFirst)!=null?o:n.options.sortDescFirst)!=null?t:e.getAutoSortDir()==="desc")?"desc":"asc"},e.getNextSortingOrder=t=>{var o,a;const r=e.getFirstSortDir(),i=e.getIsSorted();return i?i!==r&&((o=n.options.enableSortingRemoval)==null||o)&&(!(t&&(a=n.options.enableMultiRemove)!=null)||a)?!1:i==="desc"?"asc":"desc":r},e.getCanSort=()=>{var t,o;return((t=e.columnDef.enableSorting)!=null?t:!0)&&((o=n.options.enableSorting)!=null?o:!0)&&!!e.accessorFn},e.getCanMultiSort=()=>{var t,o;return(t=(o=e.columnDef.enableMultiSort)!=null?o:n.options.enableMultiSort)!=null?t:!!e.accessorFn},e.getIsSorted=()=>{var t;const o=(t=n.getState().sorting)==null?void 0:t.find(a=>a.id===e.id);return o?o.desc?"desc":"asc":!1},e.getSortIndex=()=>{var t,o;return(t=(o=n.getState().sorting)==null?void 0:o.findIndex(a=>a.id===e.id))!=null?t:-1},e.clearSorting=()=>{n.setSorting(t=>t!=null&&t.length?t.filter(o=>o.id!==e.id):[])},e.getToggleSortingHandler=()=>{const t=e.getCanSort();return o=>{t&&(o.persist==null||o.persist(),e.toggleSorting==null||e.toggleSorting(void 0,e.getCanMultiSort()?n.options.isMultiSortEvent==null?void 0:n.options.isMultiSortEvent(o):!1))}}},createTable:e=>{e.setSorting=n=>e.options.onSortingChange==null?void 0:e.options.onSortingChange(n),e.resetSorting=n=>{var t,o;e.setSorting(n?[]:(t=(o=e.initialState)==null?void 0:o.sorting)!=null?t:[])},e.getPreSortedRowModel=()=>e.getGroupedRowModel(),e.getSortedRowModel=()=>(!e._getSortedRowModel&&e.options.getSortedRowModel&&(e._getSortedRowModel=e.options.getSortedRowModel(e)),e.options.manualSorting||!e._getSortedRowModel?e.getPreSortedRowModel():e._getSortedRowModel())}},hv=[O0,ev,Q0,X0,A0,z0,tv,nv,mv,K0,sv,ov,av,rv,Z0];function pv(e){var n,t;const o=[...hv,...(n=e._features)!=null?n:[]];let a={_features:o};const r=a._features.reduce((h,m)=>Object.assign(h,m.getDefaultOptions==null?void 0:m.getDefaultOptions(a)),{}),i=h=>a.options.mergeOptions?a.options.mergeOptions(r,h):{...r,...h};let d={...{},...(t=e.initialState)!=null?t:{}};a._features.forEach(h=>{var m;d=(m=h.getInitialState==null?void 0:h.getInitialState(d))!=null?m:d});const c=[];let u=!1;const g={_features:o,options:{...r,...e},initialState:d,_queue:h=>{c.push(h),u||(u=!0,Promise.resolve().then(()=>{for(;c.length;)c.shift()();u=!1}).catch(m=>setTimeout(()=>{throw m})))},reset:()=>{a.setState(a.initialState)},setOptions:h=>{const m=fn(h,a.options);a.options=i(m)},getState:()=>a.options.state,setState:h=>{a.options.onStateChange==null||a.options.onStateChange(h)},_getRowId:(h,m,p)=>{var f;return(f=a.options.getRowId==null?void 0:a.options.getRowId(h,m,p))!=null?f:`${p?[p.id,m].join("."):m}`},getCoreRowModel:()=>(a._getCoreRowModel||(a._getCoreRowModel=a.options.getCoreRowModel(a)),a._getCoreRowModel()),getRowModel:()=>a.getPaginationRowModel(),getRow:(h,m)=>{let p=(m?a.getPrePaginationRowModel():a.getRowModel()).rowsById[h];if(!p&&(p=a.getCoreRowModel().rowsById[h],!p))throw new Error;return p},_getDefaultColumnDef:ke(()=>[a.options.defaultColumn],h=>{var m;return h=(m=h)!=null?m:{},{header:p=>{const f=p.header.column.columnDef;return f.accessorKey?f.accessorKey:f.accessorFn?f.id:null},cell:p=>{var f,v;return(f=(v=p.renderValue())==null||v.toString==null?void 0:v.toString())!=null?f:null},...a._features.reduce((p,f)=>Object.assign(p,f.getDefaultColumnDef==null?void 0:f.getDefaultColumnDef()),{}),...h}},De(e,"debugColumns")),_getColumnDefs:()=>a.options.columns,getAllColumns:ke(()=>[a._getColumnDefs()],h=>{const m=function(p,f,v){return v===void 0&&(v=0),p.map(x=>{const y=E0(a,x,v,f),w=x;return y.columns=w.columns?m(w.columns,y,v+1):[],y})};return m(h)},De(e,"debugColumns")),getAllFlatColumns:ke(()=>[a.getAllColumns()],h=>h.flatMap(m=>m.getFlatColumns()),De(e,"debugColumns")),_getAllFlatColumnsById:ke(()=>[a.getAllFlatColumns()],h=>h.reduce((m,p)=>(m[p.id]=p,m),{}),De(e,"debugColumns")),getAllLeafColumns:ke(()=>[a.getAllColumns(),a._getOrderColumnsFn()],(h,m)=>{let p=h.flatMap(f=>f.getLeafColumns());return m(p)},De(e,"debugColumns")),getColumn:h=>a._getAllFlatColumnsById()[h]};Object.assign(a,g);for(let h=0;h<a._features.length;h++){const m=a._features[h];m==null||m.createTable==null||m.createTable(a)}return a}function fv(){return e=>ke(()=>[e.options.data],n=>{const t={rows:[],flatRows:[],rowsById:{}},o=function(a,r,i){r===void 0&&(r=0);const l=[];for(let c=0;c<a.length;c++){const u=rs(e,e._getRowId(a[c],c,i),a[c],c,r,void 0,i==null?void 0:i.id);if(t.flatRows.push(u),t.rowsById[u.id]=u,l.push(u),e.options.getSubRows){var d;u.originalSubRows=e.options.getSubRows(a[c],c),(d=u.originalSubRows)!=null&&d.length&&(u.subRows=o(u.originalSubRows,r+1,u))}}return l};return t.rows=o(n),t},De(e.options,"debugTable","getRowModel",()=>e._autoResetPageIndex()))}function vv(){return e=>ke(()=>[e.getState().expanded,e.getPreExpandedRowModel(),e.options.paginateExpandedRows],(n,t,o)=>!t.rows.length||n!==!0&&!Object.keys(n??{}).length||!o?t:Tc(t),De(e.options,"debugTable"))}function Tc(e){const n=[],t=o=>{var a;n.push(o),(a=o.subRows)!=null&&a.length&&o.getIsExpanded()&&o.subRows.forEach(t)};return e.rows.forEach(t),{rows:n,flatRows:e.flatRows,rowsById:e.rowsById}}function xv(){return(e,n)=>ke(()=>{var t;return[(t=e.getColumn(n))==null?void 0:t.getFacetedRowModel()]},t=>{if(!t)return;const o=t.flatRows.flatMap(i=>{var l;return(l=i.getUniqueValues(n))!=null?l:[]}).map(Number).filter(i=>!Number.isNaN(i));if(!o.length)return;let a=o[0],r=o[o.length-1];for(const i of o)i<a?a=i:i>r&&(r=i);return[a,r]},De(e.options,"debugTable"))}function Ic(e,n,t){return t.options.filterFromLeafRows?bv(e,n,t):yv(e,n,t)}function bv(e,n,t){var o;const a=[],r={},i=(o=t.options.maxLeafRowFilterDepth)!=null?o:100,l=function(d,c){c===void 0&&(c=0);const u=[];for(let h=0;h<d.length;h++){var g;let m=d[h];const p=rs(t,m.id,m.original,m.index,m.depth,void 0,m.parentId);if(p.columnFilters=m.columnFilters,(g=m.subRows)!=null&&g.length&&c<i){if(p.subRows=l(m.subRows,c+1),m=p,n(m)&&!p.subRows.length){u.push(m),r[m.id]=m,a.push(m);continue}if(n(m)||p.subRows.length){u.push(m),r[m.id]=m,a.push(m);continue}}else m=p,n(m)&&(u.push(m),r[m.id]=m,a.push(m))}return u};return{rows:l(e),flatRows:a,rowsById:r}}function yv(e,n,t){var o;const a=[],r={},i=(o=t.options.maxLeafRowFilterDepth)!=null?o:100,l=function(d,c){c===void 0&&(c=0);const u=[];for(let h=0;h<d.length;h++){let m=d[h];if(n(m)){var g;if((g=m.subRows)!=null&&g.length&&c<i){const f=rs(t,m.id,m.original,m.index,m.depth,void 0,m.parentId);f.subRows=l(m.subRows,c+1),m=f}u.push(m),a.push(m),r[m.id]=m}}return u};return{rows:l(e),flatRows:a,rowsById:r}}function wv(){return(e,n)=>ke(()=>[e.getPreFilteredRowModel(),e.getState().columnFilters,e.getState().globalFilter,e.getFilteredRowModel()],(t,o,a)=>{if(!t.rows.length||!(o!=null&&o.length)&&!a)return t;const r=[...o.map(l=>l.id).filter(l=>l!==n),a?"__global__":void 0].filter(Boolean),i=l=>{for(let d=0;d<r.length;d++)if(l.columnFilters[r[d]]===!1)return!1;return!0};return Ic(t.rows,i,e)},De(e.options,"debugTable"))}function Cv(){return(e,n)=>ke(()=>{var t;return[(t=e.getColumn(n))==null?void 0:t.getFacetedRowModel()]},t=>{if(!t)return new Map;let o=new Map;for(let r=0;r<t.flatRows.length;r++){const i=t.flatRows[r].getUniqueValues(n);for(let l=0;l<i.length;l++){const d=i[l];if(o.has(d)){var a;o.set(d,((a=o.get(d))!=null?a:0)+1)}else o.set(d,1)}}return o},De(e.options,"debugTable"))}function jv(){return e=>ke(()=>[e.getPreFilteredRowModel(),e.getState().columnFilters,e.getState().globalFilter],(n,t,o)=>{if(!n.rows.length||!(t!=null&&t.length)&&!o){for(let h=0;h<n.flatRows.length;h++)n.flatRows[h].columnFilters={},n.flatRows[h].columnFiltersMeta={};return n}const a=[],r=[];(t??[]).forEach(h=>{var m;const p=e.getColumn(h.id);if(!p)return;const f=p.getFilterFn();f&&a.push({id:h.id,filterFn:f,resolvedValue:(m=f.resolveFilterValue==null?void 0:f.resolveFilterValue(h.value))!=null?m:h.value})});const i=(t??[]).map(h=>h.id),l=e.getGlobalFilterFn(),d=e.getAllLeafColumns().filter(h=>h.getCanGlobalFilter());o&&l&&d.length&&(i.push("__global__"),d.forEach(h=>{var m;r.push({id:h.id,filterFn:l,resolvedValue:(m=l.resolveFilterValue==null?void 0:l.resolveFilterValue(o))!=null?m:o})}));let c,u;for(let h=0;h<n.flatRows.length;h++){const m=n.flatRows[h];if(m.columnFilters={},a.length)for(let p=0;p<a.length;p++){c=a[p];const f=c.id;m.columnFilters[f]=c.filterFn(m,f,c.resolvedValue,v=>{m.columnFiltersMeta[f]=v})}if(r.length){for(let p=0;p<r.length;p++){u=r[p];const f=u.id;if(u.filterFn(m,f,u.resolvedValue,v=>{m.columnFiltersMeta[f]=v})){m.columnFilters.__global__=!0;break}}m.columnFilters.__global__!==!0&&(m.columnFilters.__global__=!1)}}const g=h=>{for(let m=0;m<i.length;m++)if(h.columnFilters[i[m]]===!1)return!1;return!0};return Ic(n.rows,g,e)},De(e.options,"debugTable","getFilteredRowModel",()=>e._autoResetPageIndex()))}function Sv(){return e=>ke(()=>[e.getState().grouping,e.getPreGroupedRowModel()],(n,t)=>{if(!t.rows.length||!n.length)return t.rows.forEach(d=>{d.depth=0,d.parentId=void 0}),t;const o=n.filter(d=>e.getColumn(d)),a=[],r={},i=function(d,c,u){if(c===void 0&&(c=0),c>=o.length)return d.map(p=>(p.depth=c,a.push(p),r[p.id]=p,p.subRows&&(p.subRows=i(p.subRows,c+1,p.id)),p));const g=o[c],h=_v(d,g);return Array.from(h.entries()).map((p,f)=>{let[v,x]=p,y=`${g}:${v}`;y=u?`${u}>${y}`:y;const w=i(x,c+1,y);w.forEach(S=>{S.parentId=y});const C=c?wc(x,S=>S.subRows):x,j=rs(e,y,C[0].original,f,c,void 0,u);return Object.assign(j,{groupingColumnId:g,groupingValue:v,subRows:w,leafRows:C,getValue:S=>{if(o.includes(S)){if(j._valuesCache.hasOwnProperty(S))return j._valuesCache[S];if(x[0]){var R;j._valuesCache[S]=(R=x[0].getValue(S))!=null?R:void 0}return j._valuesCache[S]}if(j._groupingValuesCache.hasOwnProperty(S))return j._groupingValuesCache[S];const _=e.getColumn(S),T=_==null?void 0:_.getAggregationFn();if(T)return j._groupingValuesCache[S]=T(S,C,x),j._groupingValuesCache[S]}}),w.forEach(S=>{a.push(S),r[S.id]=S}),j})},l=i(t.rows,0);return l.forEach(d=>{a.push(d),r[d.id]=d}),{rows:l,flatRows:a,rowsById:r}},De(e.options,"debugTable","getGroupedRowModel",()=>{e._queue(()=>{e._autoResetExpanded(),e._autoResetPageIndex()})}))}function _v(e,n){const t=new Map;return e.reduce((o,a)=>{const r=`${a.getGroupingValue(n)}`,i=o.get(r);return i?i.push(a):o.set(r,[a]),o},t)}function Mv(e){return n=>ke(()=>[n.getState().pagination,n.getPrePaginationRowModel(),n.options.paginateExpandedRows?void 0:n.getState().expanded],(t,o)=>{if(!o.rows.length)return o;const{pageSize:a,pageIndex:r}=t;let{rows:i,flatRows:l,rowsById:d}=o;const c=a*r,u=c+a;i=i.slice(c,u);let g;n.options.paginateExpandedRows?g={rows:i,flatRows:l,rowsById:d}:g=Tc({rows:i,flatRows:l,rowsById:d}),g.flatRows=[];const h=m=>{g.flatRows.push(m),m.subRows.length&&m.subRows.forEach(h)};return g.rows.forEach(h),g},De(n.options,"debugTable"))}function Rv(){return e=>ke(()=>[e.getState().sorting,e.getPreSortedRowModel()],(n,t)=>{if(!t.rows.length||!(n!=null&&n.length))return t;const o=e.getState().sorting,a=[],r=o.filter(d=>{var c;return(c=e.getColumn(d.id))==null?void 0:c.getCanSort()}),i={};r.forEach(d=>{const c=e.getColumn(d.id);c&&(i[d.id]={sortUndefined:c.columnDef.sortUndefined,invertSorting:c.columnDef.invertSorting,sortingFn:c.getSortingFn()})});const l=d=>{const c=d.map(u=>({...u}));return c.sort((u,g)=>{for(let m=0;m<r.length;m+=1){var h;const p=r[m],f=i[p.id],v=f.sortUndefined,x=(h=p==null?void 0:p.desc)!=null?h:!1;let y=0;if(v){const w=u.getValue(p.id),C=g.getValue(p.id),j=w===void 0,S=C===void 0;if(j||S){if(v==="first")return j?-1:1;if(v==="last")return j?1:-1;y=j&&S?0:j?v:-v}}if(y===0&&(y=f.sortingFn(u,g,p.id)),y!==0)return x&&(y*=-1),f.invertSorting&&(y*=-1),y}return u.index-g.index}),c.forEach(u=>{var g;a.push(u),(g=u.subRows)!=null&&g.length&&(u.subRows=l(u.subRows))}),c};return{rows:l(t.rows),flatRows:a,rowsById:t.rowsById}},De(e.options,"debugTable","getSortedRowModel",()=>e._autoResetPageIndex()))}/**
|
||
* react-table
|
||
*
|
||
* Copyright (c) TanStack
|
||
*
|
||
* This source code is licensed under the MIT license found in the
|
||
* LICENSE.md file in the root directory of this source tree.
|
||
*
|
||
* @license MIT
|
||
*/function Nv(e){const n={state:{},onStateChange:()=>{},renderFallbackValue:null,...e},[t]=b.useState(()=>({current:pv(n)})),[o,a]=b.useState(()=>t.current.initialState);return t.current.setOptions(r=>({...r,...e,state:{...o,...e.state},onStateChange:i=>{a(i),e.onStateChange==null||e.onStateChange(i)}})),t.current}/**
|
||
* match-sorter-utils
|
||
*
|
||
* Copyright (c) TanStack
|
||
*
|
||
* This source code is licensed under the MIT license found in the
|
||
* LICENSE.md file in the root directory of this source tree.
|
||
*
|
||
* @license MIT
|
||
*/const Pc={À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",Ấ:"A",Ắ:"A",Ẳ:"A",Ẵ:"A",Ặ:"A",Æ:"AE",Ầ:"A",Ằ:"A",Ȃ:"A",Ç:"C",Ḉ:"C",È:"E",É:"E",Ê:"E",Ë:"E",Ế:"E",Ḗ:"E",Ề:"E",Ḕ:"E",Ḝ:"E",Ȇ:"E",Ì:"I",Í:"I",Î:"I",Ï:"I",Ḯ:"I",Ȋ:"I",Ð:"D",Ñ:"N",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",Ố:"O",Ṍ:"O",Ṓ:"O",Ȏ:"O",Ù:"U",Ú:"U",Û:"U",Ü:"U",Ý:"Y",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",ấ:"a",ắ:"a",ẳ:"a",ẵ:"a",ặ:"a",æ:"ae",ầ:"a",ằ:"a",ȃ:"a",ç:"c",ḉ:"c",è:"e",é:"e",ê:"e",ë:"e",ế:"e",ḗ:"e",ề:"e",ḕ:"e",ḝ:"e",ȇ:"e",ì:"i",í:"i",î:"i",ï:"i",ḯ:"i",ȋ:"i",ð:"d",ñ:"n",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",ố:"o",ṍ:"o",ṓ:"o",ȏ:"o",ù:"u",ú:"u",û:"u",ü:"u",ý:"y",ÿ:"y",Ā:"A",ā:"a",Ă:"A",ă:"a",Ą:"A",ą:"a",Ć:"C",ć:"c",Ĉ:"C",ĉ:"c",Ċ:"C",ċ:"c",Č:"C",č:"c",C̆:"C",c̆:"c",Ď:"D",ď:"d",Đ:"D",đ:"d",Ē:"E",ē:"e",Ĕ:"E",ĕ:"e",Ė:"E",ė:"e",Ę:"E",ę:"e",Ě:"E",ě:"e",Ĝ:"G",Ǵ:"G",ĝ:"g",ǵ:"g",Ğ:"G",ğ:"g",Ġ:"G",ġ:"g",Ģ:"G",ģ:"g",Ĥ:"H",ĥ:"h",Ħ:"H",ħ:"h",Ḫ:"H",ḫ:"h",Ĩ:"I",ĩ:"i",Ī:"I",ī:"i",Ĭ:"I",ĭ:"i",Į:"I",į:"i",İ:"I",ı:"i",IJ:"IJ",ij:"ij",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",Ḱ:"K",ḱ:"k",K̆:"K",k̆:"k",Ĺ:"L",ĺ:"l",Ļ:"L",ļ:"l",Ľ:"L",ľ:"l",Ŀ:"L",ŀ:"l",Ł:"l",ł:"l",Ḿ:"M",ḿ:"m",M̆:"M",m̆:"m",Ń:"N",ń:"n",Ņ:"N",ņ:"n",Ň:"N",ň:"n",ʼn:"n",N̆:"N",n̆:"n",Ō:"O",ō:"o",Ŏ:"O",ŏ:"o",Ő:"O",ő:"o",Œ:"OE",œ:"oe",P̆:"P",p̆:"p",Ŕ:"R",ŕ:"r",Ŗ:"R",ŗ:"r",Ř:"R",ř:"r",R̆:"R",r̆:"r",Ȓ:"R",ȓ:"r",Ś:"S",ś:"s",Ŝ:"S",ŝ:"s",Ş:"S",Ș:"S",ș:"s",ş:"s",Š:"S",š:"s",Ţ:"T",ţ:"t",ț:"t",Ț:"T",Ť:"T",ť:"t",Ŧ:"T",ŧ:"t",T̆:"T",t̆:"t",Ũ:"U",ũ:"u",Ū:"U",ū:"u",Ŭ:"U",ŭ:"u",Ů:"U",ů:"u",Ű:"U",ű:"u",Ų:"U",ų:"u",Ȗ:"U",ȗ:"u",V̆:"V",v̆:"v",Ŵ:"W",ŵ:"w",Ẃ:"W",ẃ:"w",X̆:"X",x̆:"x",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Y̆:"Y",y̆:"y",Ź:"Z",ź:"z",Ż:"Z",ż:"z",Ž:"Z",ž:"z",ſ:"s",ƒ:"f",Ơ:"O",ơ:"o",Ư:"U",ư:"u",Ǎ:"A",ǎ:"a",Ǐ:"I",ǐ:"i",Ǒ:"O",ǒ:"o",Ǔ:"U",ǔ:"u",Ǖ:"U",ǖ:"u",Ǘ:"U",ǘ:"u",Ǚ:"U",ǚ:"u",Ǜ:"U",ǜ:"u",Ứ:"U",ứ:"u",Ṹ:"U",ṹ:"u",Ǻ:"A",ǻ:"a",Ǽ:"AE",ǽ:"ae",Ǿ:"O",ǿ:"o",Þ:"TH",þ:"th",Ṕ:"P",ṕ:"p",Ṥ:"S",ṥ:"s",X́:"X",x́:"x",Ѓ:"Г",ѓ:"г",Ќ:"К",ќ:"к",A̋:"A",a̋:"a",E̋:"E",e̋:"e",I̋:"I",i̋:"i",Ǹ:"N",ǹ:"n",Ồ:"O",ồ:"o",Ṑ:"O",ṑ:"o",Ừ:"U",ừ:"u",Ẁ:"W",ẁ:"w",Ỳ:"Y",ỳ:"y",Ȁ:"A",ȁ:"a",Ȅ:"E",ȅ:"e",Ȉ:"I",ȉ:"i",Ȍ:"O",ȍ:"o",Ȑ:"R",ȑ:"r",Ȕ:"U",ȕ:"u",B̌:"B",b̌:"b",Č̣:"C",č̣:"c",Ê̌:"E",ê̌:"e",F̌:"F",f̌:"f",Ǧ:"G",ǧ:"g",Ȟ:"H",ȟ:"h",J̌:"J",ǰ:"j",Ǩ:"K",ǩ:"k",M̌:"M",m̌:"m",P̌:"P",p̌:"p",Q̌:"Q",q̌:"q",Ř̩:"R",ř̩:"r",Ṧ:"S",ṧ:"s",V̌:"V",v̌:"v",W̌:"W",w̌:"w",X̌:"X",x̌:"x",Y̌:"Y",y̌:"y",A̧:"A",a̧:"a",B̧:"B",b̧:"b",Ḑ:"D",ḑ:"d",Ȩ:"E",ȩ:"e",Ɛ̧:"E",ɛ̧:"e",Ḩ:"H",ḩ:"h",I̧:"I",i̧:"i",Ɨ̧:"I",ɨ̧:"i",M̧:"M",m̧:"m",O̧:"O",o̧:"o",Q̧:"Q",q̧:"q",U̧:"U",u̧:"u",X̧:"X",x̧:"x",Z̧:"Z",z̧:"z"},kv=Object.keys(Pc).join("|"),Dv=new RegExp(kv,"g");function Tv(e){return e.replace(Dv,n=>Pc[n])}/**
|
||
* @name match-sorter
|
||
* @license MIT license.
|
||
* @copyright (c) 2099 Kent C. Dodds
|
||
* @author Kent C. Dodds <me@kentcdodds.com> (https://kentcdodds.com)
|
||
*/const ht={CASE_SENSITIVE_EQUAL:7,EQUAL:6,STARTS_WITH:5,WORD_STARTS_WITH:4,CONTAINS:3,ACRONYM:2,MATCHES:1,NO_MATCH:0};function Iv(e,n,t){var o;if(t=t||{},t.threshold=(o=t.threshold)!=null?o:ht.MATCHES,!t.accessors){const i=Bi(e,n,t);return{rankedValue:e,rank:i,accessorIndex:-1,accessorThreshold:t.threshold,passed:i>=t.threshold}}const a=Av(e,t.accessors),r={rankedValue:e,rank:ht.NO_MATCH,accessorIndex:-1,accessorThreshold:t.threshold,passed:!1};for(let i=0;i<a.length;i++){const l=a[i];let d=Bi(l.itemValue,n,t);const{minRanking:c,maxRanking:u,threshold:g=t.threshold}=l.attributes;d<c&&d>=ht.MATCHES?d=c:d>u&&(d=u),d=Math.min(d,u),d>=g&&d>r.rank&&(r.rank=d,r.passed=!0,r.accessorIndex=i,r.accessorThreshold=g,r.rankedValue=l.itemValue)}return r}function Bi(e,n,t){return e=Ui(e,t),n=Ui(n,t),n.length>e.length?ht.NO_MATCH:e===n?ht.CASE_SENSITIVE_EQUAL:(e=e.toLowerCase(),n=n.toLowerCase(),e===n?ht.EQUAL:e.startsWith(n)?ht.STARTS_WITH:e.includes(` ${n}`)?ht.WORD_STARTS_WITH:e.includes(n)?ht.CONTAINS:n.length===1?ht.NO_MATCH:Pv(e).includes(n)?ht.ACRONYM:Fv(e,n))}function Pv(e){let n="";return e.split(" ").forEach(o=>{o.split("-").forEach(r=>{n+=r.substr(0,1)})}),n}function Fv(e,n){let t=0,o=0;function a(d,c,u){for(let g=u,h=c.length;g<h;g++)if(c[g]===d)return t+=1,g+1;return-1}function r(d){const c=1/d,u=t/n.length;return ht.MATCHES+u*c}const i=a(n[0],e,0);if(i<0)return ht.NO_MATCH;o=i;for(let d=1,c=n.length;d<c;d++){const u=n[d];if(o=a(u,e,o),!(o>-1))return ht.NO_MATCH}const l=o-i;return r(l)}function Ev(e,n){return e.rank===n.rank?0:e.rank>n.rank?-1:1}function Ui(e,n){let{keepDiacritics:t}=n;return e=`${e}`,t||(e=Tv(e)),e}function Ov(e,n){let t=n;typeof n=="object"&&(t=n.accessor);const o=t(e);return o==null?[]:Array.isArray(o)?o:[String(o)]}function Av(e,n){const t=[];for(let o=0,a=n.length;o<a;o++){const r=n[o],i=zv(r),l=Ov(e,r);for(let d=0,c=l.length;d<c;d++)t.push({itemValue:l[d],attributes:i})}return t}const Hi={maxRanking:1/0,minRanking:-1/0};function zv(e){return typeof e=="function"?Hi:{...Hi,...e}}function Bn(e,n,t){let o=t.initialDeps??[],a;return()=>{var r,i,l,d;let c;t.key&&((r=t.debug)!=null&&r.call(t))&&(c=Date.now());const u=e();if(!(u.length!==o.length||u.some((m,p)=>o[p]!==m)))return a;o=u;let h;if(t.key&&((i=t.debug)!=null&&i.call(t))&&(h=Date.now()),a=n(...u),t.key&&((l=t.debug)!=null&&l.call(t))){const m=Math.round((Date.now()-c)*100)/100,f=Math.round((Date.now()-h)*100)/100/16,v=(x,y)=>{for(x=String(x);x.length<y;)x=" "+x;return x}}return(d=t==null?void 0:t.onChange)==null||d.call(t,a),a}}function da(e,n){if(e===void 0)throw new Error("Unexpected undefined");return e}const $v=(e,n)=>Math.abs(e-n)<1,Lv=(e,n,t)=>{let o;return function(...a){e.clearTimeout(o),o=e.setTimeout(()=>n.apply(this,a),t)}},Vv=e=>e,Fc=e=>{const n=Math.max(e.startIndex-e.overscan,0),t=Math.min(e.endIndex+e.overscan,e.count-1),o=[];for(let a=n;a<=t;a++)o.push(a);return o},Bv=(e,n)=>{const t=e.scrollElement;if(!t)return;const o=e.targetWindow;if(!o)return;const a=i=>{const{width:l,height:d}=i;n({width:Math.round(l),height:Math.round(d)})};if(a(t.getBoundingClientRect()),!o.ResizeObserver)return()=>{};const r=new o.ResizeObserver(i=>{const l=i[0];if(l!=null&&l.borderBoxSize){const d=l.borderBoxSize[0];if(d){a({width:d.inlineSize,height:d.blockSize});return}}a(t.getBoundingClientRect())});return r.observe(t,{box:"border-box"}),()=>{r.unobserve(t)}},Gi={passive:!0},Uv=typeof window>"u"?!0:"onscrollend"in window,Hv=(e,n)=>{const t=e.scrollElement;if(!t)return;const o=e.targetWindow;if(!o)return;let a=0;const r=e.options.useScrollendEvent&&Uv?()=>{}:Lv(o,()=>{n(a,!1)},e.options.isScrollingResetDelay),i=c=>()=>{const{horizontal:u,isRtl:g}=e.options;a=u?t.scrollLeft*(g&&-1||1):t.scrollTop,r(),n(a,c)},l=i(!0),d=i(!1);return d(),t.addEventListener("scroll",l,Gi),t.addEventListener("scrollend",d,Gi),()=>{t.removeEventListener("scroll",l),t.removeEventListener("scrollend",d)}},Gv=(e,n,t)=>{if(n!=null&&n.borderBoxSize){const o=n.borderBoxSize[0];if(o)return Math.round(o[t.options.horizontal?"inlineSize":"blockSize"])}return Math.round(e.getBoundingClientRect()[t.options.horizontal?"width":"height"])},qv=(e,{adjustments:n=0,behavior:t},o)=>{var a,r;const i=e+n;(r=(a=o.scrollElement)==null?void 0:a.scrollTo)==null||r.call(a,{[o.options.horizontal?"left":"top"]:i,behavior:t})};class Wv{constructor(n){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.scrollToIndexTimeoutId=null,this.measurementsCache=[],this.itemSizeCache=new Map,this.pendingMeasuredCacheIndexes=[],this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this.elementsCache=new Map,this.observer=(()=>{let t=null;const o=()=>t||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:t=new this.targetWindow.ResizeObserver(a=>{a.forEach(r=>{this._measureElement(r.target,r)})}));return{disconnect:()=>{var a;(a=o())==null||a.disconnect(),t=null},observe:a=>{var r;return(r=o())==null?void 0:r.observe(a,{box:"border-box"})},unobserve:a=>{var r;return(r=o())==null?void 0:r.unobserve(a)}}})(),this.range=null,this.setOptions=t=>{Object.entries(t).forEach(([o,a])=>{typeof a>"u"&&delete t[o]}),this.options={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:Vv,rangeExtractor:Fc,onChange:()=>{},measureElement:Gv,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!0,...t}},this.notify=t=>{var o,a;(a=(o=this.options).onChange)==null||a.call(o,this,t)},this.maybeNotify=Bn(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),t=>{this.notify(t)},{key:!1,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(t=>t()),this.unsubs=[],this.observer.disconnect(),this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var t;const o=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==o){if(this.cleanup(),!o){this.maybeNotify();return}this.scrollElement=o,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=((t=this.scrollElement)==null?void 0:t.window)??null,this.elementsCache.forEach(a=>{this.observer.observe(a)}),this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0}),this.unsubs.push(this.options.observeElementRect(this,a=>{this.scrollRect=a,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(a,r)=>{this.scrollAdjustments=0,this.scrollDirection=r?this.getScrollOffset()<a?"forward":"backward":null,this.scrollOffset=a,this.isScrolling=r,this.maybeNotify()}))}},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=(t,o)=>{const a=new Map,r=new Map;for(let i=o-1;i>=0;i--){const l=t[i];if(a.has(l.lane))continue;const d=r.get(l.lane);if(d==null||l.end>d.end?r.set(l.lane,l):l.end<d.end&&a.set(l.lane,!0),a.size===this.options.lanes)break}return r.size===this.options.lanes?Array.from(r.values()).sort((i,l)=>i.end===l.end?i.index-l.index:i.end-l.end)[0]:void 0},this.getMeasurementOptions=Bn(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled],(t,o,a,r,i)=>(this.pendingMeasuredCacheIndexes=[],{count:t,paddingStart:o,scrollMargin:a,getItemKey:r,enabled:i}),{key:!1}),this.getMeasurements=Bn(()=>[this.getMeasurementOptions(),this.itemSizeCache],({count:t,paddingStart:o,scrollMargin:a,getItemKey:r,enabled:i},l)=>{if(!i)return this.measurementsCache=[],this.itemSizeCache.clear(),[];this.measurementsCache.length===0&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(u=>{this.itemSizeCache.set(u.key,u.size)}));const d=this.pendingMeasuredCacheIndexes.length>0?Math.min(...this.pendingMeasuredCacheIndexes):0;this.pendingMeasuredCacheIndexes=[];const c=this.measurementsCache.slice(0,d);for(let u=d;u<t;u++){const g=r(u),h=this.options.lanes===1?c[u-1]:this.getFurthestMeasurement(c,u),m=h?h.end+this.options.gap:o+a,p=l.get(g),f=typeof p=="number"?p:this.options.estimateSize(u),v=m+f,x=h?h.lane:u%this.options.lanes;c[u]={index:u,start:m,size:f,end:v,key:g,lane:x}}return this.measurementsCache=c,c},{key:!1,debug:()=>this.options.debug}),this.calculateRange=Bn(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset()],(t,o,a)=>this.range=t.length>0&&o>0?Kv({measurements:t,outerSize:o,scrollOffset:a}):null,{key:!1,debug:()=>this.options.debug}),this.getIndexes=Bn(()=>[this.options.rangeExtractor,this.calculateRange(),this.options.overscan,this.options.count],(t,o,a,r)=>o===null?[]:t({startIndex:o.startIndex,endIndex:o.endIndex,overscan:a,count:r}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=t=>{const o=this.options.indexAttribute,a=t.getAttribute(o);return a?parseInt(a,10):-1},this._measureElement=(t,o)=>{const a=this.indexFromElement(t),r=this.measurementsCache[a];if(!r)return;const i=r.key,l=this.elementsCache.get(i);l!==t&&(l&&this.observer.unobserve(l),this.observer.observe(t),this.elementsCache.set(i,t)),t.isConnected&&this.resizeItem(a,this.options.measureElement(t,o,this))},this.resizeItem=(t,o)=>{const a=this.measurementsCache[t];if(!a)return;const r=this.itemSizeCache.get(a.key)??a.size,i=o-r;i!==0&&((this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(a,i,this):a.start<this.getScrollOffset()+this.scrollAdjustments)&&this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=i,behavior:void 0}),this.pendingMeasuredCacheIndexes.push(a.index),this.itemSizeCache=new Map(this.itemSizeCache.set(a.key,o)),this.notify(!1))},this.measureElement=t=>{if(!t){this.elementsCache.forEach((o,a)=>{o.isConnected||(this.observer.unobserve(o),this.elementsCache.delete(a))});return}this._measureElement(t,void 0)},this.getVirtualItems=Bn(()=>[this.getIndexes(),this.getMeasurements()],(t,o)=>{const a=[];for(let r=0,i=t.length;r<i;r++){const l=t[r],d=o[l];a.push(d)}return a},{key:!1,debug:()=>this.options.debug}),this.getVirtualItemForOffset=t=>{const o=this.getMeasurements();if(o.length!==0)return da(o[Ec(0,o.length-1,a=>da(o[a]).start,t)])},this.getOffsetForAlignment=(t,o)=>{const a=this.getSize(),r=this.getScrollOffset();o==="auto"&&t>=r+a&&(o="end"),o==="end"&&(t-=a);const i=this.options.horizontal?"scrollWidth":"scrollHeight",d=(this.scrollElement?"document"in this.scrollElement?this.scrollElement.document.documentElement[i]:this.scrollElement[i]:0)-a;return Math.max(Math.min(d,t),0)},this.getOffsetForIndex=(t,o="auto")=>{t=Math.max(0,Math.min(t,this.options.count-1));const a=this.measurementsCache[t];if(!a)return;const r=this.getSize(),i=this.getScrollOffset();if(o==="auto")if(a.end>=i+r-this.options.scrollPaddingEnd)o="end";else if(a.start<=i+this.options.scrollPaddingStart)o="start";else return[i,o];const l=a.start-this.options.scrollPaddingStart+(a.size-r)/2;switch(o){case"center":return[this.getOffsetForAlignment(l,o),o];case"end":return[this.getOffsetForAlignment(a.end+this.options.scrollPaddingEnd,o),o];default:return[this.getOffsetForAlignment(a.start-this.options.scrollPaddingStart,o),o]}},this.isDynamicMode=()=>this.elementsCache.size>0,this.cancelScrollToIndex=()=>{this.scrollToIndexTimeoutId!==null&&this.targetWindow&&(this.targetWindow.clearTimeout(this.scrollToIndexTimeoutId),this.scrollToIndexTimeoutId=null)},this.scrollToOffset=(t,{align:o="start",behavior:a}={})=>{this.cancelScrollToIndex(),a==="smooth"&&this.isDynamicMode(),this._scrollToOffset(this.getOffsetForAlignment(t,o),{adjustments:void 0,behavior:a})},this.scrollToIndex=(t,{align:o="auto",behavior:a}={})=>{t=Math.max(0,Math.min(t,this.options.count-1)),this.cancelScrollToIndex(),a==="smooth"&&this.isDynamicMode();const r=this.getOffsetForIndex(t,o);if(!r)return;const[i,l]=r;this._scrollToOffset(i,{adjustments:void 0,behavior:a}),a!=="smooth"&&this.isDynamicMode()&&this.targetWindow&&(this.scrollToIndexTimeoutId=this.targetWindow.setTimeout(()=>{if(this.scrollToIndexTimeoutId=null,this.elementsCache.has(this.options.getItemKey(t))){const[c]=da(this.getOffsetForIndex(t,l));$v(c,this.getScrollOffset())||this.scrollToIndex(t,{align:l,behavior:a})}else this.scrollToIndex(t,{align:l,behavior:a})}))},this.scrollBy=(t,{behavior:o}={})=>{this.cancelScrollToIndex(),o==="smooth"&&this.isDynamicMode(),this._scrollToOffset(this.getScrollOffset()+t,{adjustments:void 0,behavior:o})},this.getTotalSize=()=>{var t;const o=this.getMeasurements();let a;return o.length===0?a=this.options.paddingStart:a=this.options.lanes===1?((t=o[o.length-1])==null?void 0:t.end)??0:Math.max(...o.slice(-this.options.lanes).map(r=>r.end)),Math.max(a-this.options.scrollMargin+this.options.paddingEnd,0)},this._scrollToOffset=(t,{adjustments:o,behavior:a})=>{this.options.scrollToFn(t,{behavior:a,adjustments:o},this)},this.measure=()=>{this.itemSizeCache=new Map,this.notify(!1)},this.setOptions(n)}}const Ec=(e,n,t,o)=>{for(;e<=n;){const a=(e+n)/2|0,r=t(a);if(r<o)e=a+1;else if(r>o)n=a-1;else return a}return e>0?e-1:0};function Kv({measurements:e,outerSize:n,scrollOffset:t}){const o=e.length-1,r=Ec(0,o,l=>e[l].start,t);let i=r;for(;i<o&&e[i].end<t+n;)i++;return{startIndex:r,endIndex:i}}const qi=typeof document<"u"?b.useLayoutEffect:b.useEffect;function Yv(e){const n=b.useReducer(()=>({}),{})[1],t={...e,onChange:(a,r)=>{var i;r?gl.flushSync(n):n(),(i=e.onChange)==null||i.call(e,a,r)}},[o]=b.useState(()=>new Wv(t));return o.setOptions(t),qi(()=>o._didMount(),[]),qi(()=>o._willUpdate()),o}function Oc(e){return Yv({observeElementRect:Bv,observeElementOffset:Hv,scrollToFn:qv,...e})}function Qv({direction:e,levelIndex:n,rowIndex:t,cellIndex:o,size:a}){switch(e){case"up":return n===0&&t===0?null:t===0?{levelIndex:n-1,rowIndex:o<=a[n-1][a[n-1].length-1]-1?a[n-1].length-1:a[n-1].length-2,cellIndex:o}:{levelIndex:n,rowIndex:t-1,cellIndex:o};case"down":return t===a[n].length-1?{levelIndex:n+1,rowIndex:0,cellIndex:o}:t===a[n].length-2&&o>=a[n][a[n].length-1]?{levelIndex:n+1,rowIndex:0,cellIndex:o}:{levelIndex:n,rowIndex:t+1,cellIndex:o};case"left":return n===0&&t===0&&o===0?null:t===0&&o===0?{levelIndex:n-1,rowIndex:a[n-1].length-1,cellIndex:a[n-1][a[n-1].length-1]-1}:o===0?{levelIndex:n,rowIndex:t-1,cellIndex:a[n][t-1]-1}:{levelIndex:n,rowIndex:t,cellIndex:o-1};case"right":return t===a[n].length-1&&o===a[n][t]-1?{levelIndex:n+1,rowIndex:0,cellIndex:0}:o===a[n][t]-1?{levelIndex:n,rowIndex:t+1,cellIndex:0}:{levelIndex:n,rowIndex:t,cellIndex:o+1};default:return{levelIndex:n,rowIndex:t,cellIndex:o}}}function Ac({controlsRef:e,direction:n,levelIndex:t,rowIndex:o,cellIndex:a,size:r}){var d,c,u;const i=Qv({direction:n,size:r,rowIndex:o,cellIndex:a,levelIndex:t});if(!i)return;const l=(u=(c=(d=e.current)==null?void 0:d[i.levelIndex])==null?void 0:c[i.rowIndex])==null?void 0:u[i.cellIndex];l&&(l.disabled||l.getAttribute("data-hidden")||l.getAttribute("data-outside")?Ac({controlsRef:e,direction:n,levelIndex:i.levelIndex,cellIndex:i.cellIndex,rowIndex:i.rowIndex,size:r}):l.focus())}function Xv(e){switch(e){case"ArrowDown":return"down";case"ArrowUp":return"up";case"ArrowRight":return"right";case"ArrowLeft":return"left";default:return null}}function Zv(e){var n;return(n=e.current)==null?void 0:n.map(t=>t.map(o=>o.length))}function Qr({controlsRef:e,levelIndex:n,rowIndex:t,cellIndex:o,event:a}){const r=Xv(a.key);if(r){a.preventDefault();const i=Zv(e);Ac({controlsRef:e,direction:r,levelIndex:n,rowIndex:t,cellIndex:o,size:i})}}function Jv(e,n){if(!e||!n)return n;const t=e.getHours(),o=e.getMinutes(),a=e.getSeconds(),r=e.getMilliseconds(),i=new Date(n);return i.setHours(t),i.setMinutes(o),i.setSeconds(a),i.setMilliseconds(r),i}var Ys={exports:{}},ex=Ys.exports,Wi;function tx(){return Wi||(Wi=1,(function(e,n){(function(t,o){e.exports=o()})(ex,(function(){var t={year:0,month:1,day:2,hour:3,minute:4,second:5},o={};return function(a,r,i){var l,d=function(h,m,p){p===void 0&&(p={});var f=new Date(h),v=(function(x,y){y===void 0&&(y={});var w=y.timeZoneName||"short",C=x+"|"+w,j=o[C];return j||(j=new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:x,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",timeZoneName:w}),o[C]=j),j})(m,p);return v.formatToParts(f)},c=function(h,m){for(var p=d(h,m),f=[],v=0;v<p.length;v+=1){var x=p[v],y=x.type,w=x.value,C=t[y];C>=0&&(f[C]=parseInt(w,10))}var j=f[3],S=j===24?0:j,R=f[0]+"-"+f[1]+"-"+f[2]+" "+S+":"+f[4]+":"+f[5]+":000",_=+h;return(i.utc(R).valueOf()-(_-=_%1e3))/6e4},u=r.prototype;u.tz=function(h,m){h===void 0&&(h=l);var p,f=this.utcOffset(),v=this.toDate(),x=v.toLocaleString("en-US",{timeZone:h}),y=Math.round((v-new Date(x))/1e3/60),w=15*-Math.round(v.getTimezoneOffset()/15)-y;if(!Number(w))p=this.utcOffset(0,m);else if(p=i(x,{locale:this.$L}).$set("millisecond",this.$ms).utcOffset(w,!0),m){var C=p.utcOffset();p=p.add(f-C,"minute")}return p.$x.$timezone=h,p},u.offsetName=function(h){var m=this.$x.$timezone||i.tz.guess(),p=d(this.valueOf(),m,{timeZoneName:h}).find((function(f){return f.type.toLowerCase()==="timezonename"}));return p&&p.value};var g=u.startOf;u.startOf=function(h,m){if(!this.$x||!this.$x.$timezone)return g.call(this,h,m);var p=i(this.format("YYYY-MM-DD HH:mm:ss:SSS"),{locale:this.$L});return g.call(p,h,m).tz(this.$x.$timezone,!0)},i.tz=function(h,m,p){var f=p&&m,v=p||m||l,x=c(+i(),v);if(typeof h!="string")return i(h).tz(v);var y=(function(S,R,_){var T=S-60*R*1e3,k=c(T,_);if(R===k)return[T,R];var I=c(T-=60*(k-R)*1e3,_);return k===I?[T,k]:[S-60*Math.min(k,I)*1e3,Math.max(k,I)]})(i.utc(h,f).valueOf(),x,v),w=y[0],C=y[1],j=i(w).utcOffset(C);return j.$x.$timezone=v,j},i.tz.guess=function(){return Intl.DateTimeFormat().resolvedOptions().timeZone},i.tz.setDefault=function(h){l=h}}}))})(Ys)),Ys.exports}var nx=tx();const sx=Ja(nx);var Qs={exports:{}},ox=Qs.exports,Ki;function ax(){return Ki||(Ki=1,(function(e,n){(function(t,o){e.exports=o()})(ox,(function(){var t="minute",o=/[+-]\d\d(?::?\d\d)?/g,a=/([+-]|\d\d)/g;return function(r,i,l){var d=i.prototype;l.utc=function(f){var v={date:f,utc:!0,args:arguments};return new i(v)},d.utc=function(f){var v=l(this.toDate(),{locale:this.$L,utc:!0});return f?v.add(this.utcOffset(),t):v},d.local=function(){return l(this.toDate(),{locale:this.$L,utc:!1})};var c=d.parse;d.parse=function(f){f.utc&&(this.$u=!0),this.$utils().u(f.$offset)||(this.$offset=f.$offset),c.call(this,f)};var u=d.init;d.init=function(){if(this.$u){var f=this.$d;this.$y=f.getUTCFullYear(),this.$M=f.getUTCMonth(),this.$D=f.getUTCDate(),this.$W=f.getUTCDay(),this.$H=f.getUTCHours(),this.$m=f.getUTCMinutes(),this.$s=f.getUTCSeconds(),this.$ms=f.getUTCMilliseconds()}else u.call(this)};var g=d.utcOffset;d.utcOffset=function(f,v){var x=this.$utils().u;if(x(f))return this.$u?0:x(this.$offset)?g.call(this):this.$offset;if(typeof f=="string"&&(f=(function(j){j===void 0&&(j="");var S=j.match(o);if(!S)return null;var R=(""+S[0]).match(a)||["-",0,0],_=R[0],T=60*+R[1]+ +R[2];return T===0?0:_==="+"?T:-T})(f),f===null))return this;var y=Math.abs(f)<=16?60*f:f;if(y===0)return this.utc(v);var w=this.clone();if(v)return w.$offset=y,w.$u=!1,w;var C=this.$u?this.toDate().getTimezoneOffset():-1*this.utcOffset();return(w=this.local().add(y+C,t)).$offset=y,w.$x.$localOffset=C,w};var h=d.format;d.format=function(f){var v=f||(this.$u?"YYYY-MM-DDTHH:mm:ss[Z]":"");return h.call(this,v)},d.valueOf=function(){var f=this.$utils().u(this.$offset)?0:this.$offset+(this.$x.$localOffset||this.$d.getTimezoneOffset());return this.$d.valueOf()-6e4*f},d.isUTC=function(){return!!this.$u},d.toISOString=function(){return this.toDate().toISOString()},d.toString=function(){return this.toDate().toUTCString()};var m=d.toDate;d.toDate=function(f){return f==="s"&&this.$offset?l(this.format("YYYY-MM-DD HH:mm:ss:SSS")).toDate():m.call(this)};var p=d.diff;d.diff=function(f,v,x){if(f&&this.$u===f.$u)return p.call(this,f,v,x);var y=this.local(),w=l(f).local();return p.call(y,w,v,x)}}}))})(Qs)),Qs.exports}var rx=ax();const ix=Ja(rx);je.extend(ix);je.extend(sx);function lx(e,n){return n?je(e).tz(n).utcOffset()+e.getTimezoneOffset():0}const Yi=(e,n,t)=>{if(!e)return null;if(!n)return e;let o=lx(e,n);return t==="remove"&&(o*=-1),je(e).add(o,"minutes").toDate()};function In(e,n,t,o){return o||!n?n:Array.isArray(n)?n.map(a=>Yi(a,t,e)):Yi(n,t,e)}const cx={locale:"en",timezone:null,firstDayOfWeek:1,weekendDays:[0,6],labelSeparator:"–",consistentWeeks:!1},dx=b.createContext(cx);function Ht(){const e=b.useContext(dx),n=b.useCallback(i=>i||e.locale,[e.locale]),t=b.useCallback(i=>i||e.timezone||void 0,[e.timezone]),o=b.useCallback(i=>typeof i=="number"?i:e.firstDayOfWeek,[e.firstDayOfWeek]),a=b.useCallback(i=>Array.isArray(i)?i:e.weekendDays,[e.weekendDays]),r=b.useCallback(i=>typeof i=="string"?i:e.labelSeparator,[e.labelSeparator]);return{...e,getLocale:n,getTimezone:t,getFirstDayOfWeek:o,getWeekendDays:a,getLabelSeparator:r}}function ux(e,n){const t=Ht(),o=a=>In("remove",a,t.getTimezone()).toISOString();if(n==="range"&&Array.isArray(e)){const[a,r]=e;return a?r?`${o(a)} – ${o(r)}`:`${o(a)} –`:""}return n==="multiple"&&Array.isArray(e)?e.map(a=>a&&o(a)).filter(Boolean).join(", "):!Array.isArray(e)&&e?o(e):""}function zc({value:e,type:n,name:t,form:o}){return s.jsx("input",{type:"hidden",value:ux(e,n),name:t,form:o})}zc.displayName="@mantine/dates/HiddenDatesInput";var $c={day:"m_396ce5cb"};const gx={},mx=Ke((e,{size:n})=>({day:{"--day-size":Ye(n,"day-size")}})),Xr=ye((e,n)=>{const t=ge("Day",gx,e),{classNames:o,className:a,style:r,styles:i,unstyled:l,vars:d,date:c,disabled:u,__staticSelector:g,weekend:h,outside:m,selected:p,renderDay:f,inRange:v,firstInRange:x,lastInRange:y,hidden:w,static:C,highlightToday:j,...S}=t,R=Le({name:g||"Day",classes:$c,props:t,className:a,style:r,classNames:o,styles:i,unstyled:l,vars:d,varsResolver:mx,rootSelector:"day"}),_=Ht();return s.jsx(Pt,{...R("day",{style:w?{display:"none"}:void 0}),component:C?"div":"button",ref:n,disabled:u,"data-today":je(c).isSame(In("add",new Date,_.getTimezone()),"day")||void 0,"data-hidden":w||void 0,"data-highlight-today":j||void 0,"data-disabled":u||void 0,"data-weekend":!u&&!m&&h||void 0,"data-outside":!u&&m||void 0,"data-selected":!u&&p||void 0,"data-in-range":v&&!u||void 0,"data-first-in-range":x&&!u||void 0,"data-last-in-range":y&&!u||void 0,"data-static":C||void 0,unstyled:l,...S,children:(f==null?void 0:f(c))||je(c).date()})});Xr.classes=$c;Xr.displayName="@mantine/dates/Day";function hx({locale:e,format:n="dd",firstDayOfWeek:t=1}){const o=je().day(t),a=[];for(let r=0;r<7;r+=1)typeof n=="string"?a.push(je(o).add(r,"days").locale(e).format(n)):a.push(n(je(o).add(r,"days").toDate()));return a}var Lc={weekday:"m_18a3eca"};const px={},fx=Ke((e,{size:n})=>({weekdaysRow:{"--wr-fz":Rt(n),"--wr-spacing":ft(n)}})),Zr=ye((e,n)=>{const t=ge("WeekdaysRow",px,e),{classNames:o,className:a,style:r,styles:i,unstyled:l,vars:d,locale:c,firstDayOfWeek:u,weekdayFormat:g,cellComponent:h="th",__staticSelector:m,withWeekNumbers:p,...f}=t,v=Le({name:m||"WeekdaysRow",classes:Lc,props:t,className:a,style:r,classNames:o,styles:i,unstyled:l,vars:d,varsResolver:fx,rootSelector:"weekdaysRow"}),x=Ht(),y=hx({locale:x.getLocale(c),format:g,firstDayOfWeek:x.getFirstDayOfWeek(u)}).map((w,C)=>s.jsx(h,{...v("weekday"),children:w},C));return s.jsxs(K,{component:"tr",ref:n,...v("weekdaysRow"),...f,children:[p&&s.jsx(h,{...v("weekday"),children:"#"}),y]})});Zr.classes=Lc;Zr.displayName="@mantine/dates/WeekdaysRow";function vx(e,n=1){let t=je(e);const o=n===0?6:n-1;for(;t.day()!==o;)t=t.add(1,"day");return t.toDate()}function xx(e,n=1){let t=je(e);for(;t.day()!==n;)t=t.subtract(1,"day");return t.toDate()}function bx({month:e,firstDayOfWeek:n=1,consistentWeeks:t}){const o=je(e).subtract(je(e).date()-1,"day"),a=je(o).startOf("day"),r=a.toDate(),i=a.add(+a.daysInMonth()-1,"day").toDate(),l=vx(i,n),d=xx(r,n),c=[];for(;d<=l;){const u=[];for(let g=0;g<7;g+=1)u.push(new Date(d)),d.setDate(d.getDate()+1);c.push(u)}if(t&&c.length<6){const u=c[c.length-1],g=u[u.length-1],h=new Date(g);for(h.setDate(h.getDate()+1);c.length<6;){const m=[];for(let p=0;p<7;p+=1)m.push(new Date(h)),h.setDate(h.getDate()+1);c.push(m)}}return c}function Vc(e,n){return je(e).format("YYYY-MM")===je(n).format("YYYY-MM")}function Bc(e,n){return n instanceof Date?je(e).isAfter(je(n).subtract(1,"day"),"day"):!0}function Uc(e,n){return n instanceof Date?je(e).isBefore(je(n).add(1,"day"),"day"):!0}function yx(e,n,t,o,a,r,i){const l=e.flat().filter(u=>{var g;return Uc(u,t)&&Bc(u,n)&&!(a!=null&&a(u))&&!((g=o==null?void 0:o(u))!=null&&g.disabled)&&(!r||Vc(u,i))}),d=l.find(u=>{var g;return(g=o==null?void 0:o(u))==null?void 0:g.selected});if(d)return d;const c=l.find(u=>je().isSame(u,"date"));return c||l[0]}var Xs={exports:{}},wx=Xs.exports,Qi;function Cx(){return Qi||(Qi=1,(function(e,n){(function(t,o){e.exports=o()})(wx,(function(){var t="day";return function(o,a,r){var i=function(c){return c.add(4-c.isoWeekday(),t)},l=a.prototype;l.isoWeekYear=function(){return i(this).year()},l.isoWeek=function(c){if(!this.$utils().u(c))return this.add(7*(c-this.isoWeek()),t);var u,g,h,m,p=i(this),f=(u=this.isoWeekYear(),g=this.$u,h=(g?r.utc:r)().year(u).startOf("year"),m=4-h.isoWeekday(),h.isoWeekday()>4&&(m+=7),h.add(m,t));return p.diff(f,"week")+1},l.isoWeekday=function(c){return this.$utils().u(c)?this.day()||7:this.day(this.day()%7?c:c-7)};var d=l.startOf;l.startOf=function(c,u){var g=this.$utils(),h=!!g.u(u)||u;return g.p(c)==="isoweek"?h?this.date(this.date()-(this.isoWeekday()-1)).startOf("day"):this.date(this.date()-1-(this.isoWeekday()-1)+7).endOf("day"):d.bind(this)(c,u)}}}))})(Xs)),Xs.exports}var jx=Cx();const Sx=Ja(jx);je.extend(Sx);function _x(e){const n=e.find(t=>je(t).day()===1);return je(n).isoWeek()}var Hc={month:"m_cc9820d3",monthCell:"m_8f457cd5",weekNumber:"m_6cff9dea"};const Mx={withCellSpacing:!0},Rx=Ke((e,{size:n})=>({weekNumber:{"--wn-fz":Rt(n),"--wn-size":Ye(n,"wn-size")}})),Oo=ye((e,n)=>{const t=ge("Month",Mx,e),{classNames:o,className:a,style:r,styles:i,unstyled:l,vars:d,__staticSelector:c,locale:u,firstDayOfWeek:g,weekdayFormat:h,month:m,weekendDays:p,getDayProps:f,excludeDate:v,minDate:x,maxDate:y,renderDay:w,hideOutsideDates:C,hideWeekdays:j,getDayAriaLabel:S,static:R,__getDayRef:_,__onDayKeyDown:T,__onDayClick:k,__onDayMouseEnter:I,__preventFocus:E,__stopPropagation:V,withCellSpacing:L,size:B,highlightToday:M,withWeekNumbers:D,...O}=t,F=Le({name:c||"Month",classes:Hc,props:t,className:a,style:r,classNames:o,styles:i,unstyled:l,vars:d,varsResolver:Rx,rootSelector:"month"}),$=Ht(),z=bx({month:m,firstDayOfWeek:$.getFirstDayOfWeek(g),consistentWeeks:$.consistentWeeks}),H=yx(z,x,y,f,v,C,m),{resolvedClassNames:re,resolvedStyles:ie}=wn({classNames:o,styles:i,props:t}),X=z.map((oe,ne)=>{const J=oe.map((P,Q)=>{const ce=!Vc(P,m),te=(S==null?void 0:S(P))||je(P).locale(u||$.locale).format("D MMMM YYYY"),W=f==null?void 0:f(P),me=je(P).isSame(H,"date");return s.jsx("td",{...F("monthCell"),"data-with-spacing":L||void 0,children:s.jsx(Xr,{__staticSelector:c||"Month",classNames:re,styles:ie,unstyled:l,"data-mantine-stop-propagation":V||void 0,highlightToday:M,renderDay:w,date:P,size:B,weekend:$.getWeekendDays(p).includes(P.getDay()),outside:ce,hidden:C?ce:!1,"aria-label":te,static:R,disabled:(v==null?void 0:v(P))||!Uc(P,y)||!Bc(P,x),ref:le=>_==null?void 0:_(ne,Q,le),...W,onKeyDown:le=>{var de;(de=W==null?void 0:W.onKeyDown)==null||de.call(W,le),T==null||T(le,{rowIndex:ne,cellIndex:Q,date:P})},onMouseEnter:le=>{var de;(de=W==null?void 0:W.onMouseEnter)==null||de.call(W,le),I==null||I(le,P)},onClick:le=>{var de;(de=W==null?void 0:W.onClick)==null||de.call(W,le),k==null||k(le,P)},onMouseDown:le=>{var de;(de=W==null?void 0:W.onMouseDown)==null||de.call(W,le),E&&le.preventDefault()},tabIndex:E||!me?-1:0})},P.toString())});return s.jsxs("tr",{...F("monthRow"),children:[D&&s.jsx("td",{...F("weekNumber"),children:_x(oe)}),J]},ne)});return s.jsxs(K,{component:"table",...F("month"),size:B,ref:n,...O,children:[!j&&s.jsx("thead",{...F("monthThead"),children:s.jsx(Zr,{__staticSelector:c||"Month",locale:u,firstDayOfWeek:g,weekdayFormat:h,size:B,classNames:re,styles:ie,unstyled:l,withWeekNumbers:D})}),s.jsx("tbody",{...F("monthTbody"),children:X})]})});Oo.classes=Hc;Oo.displayName="@mantine/dates/Month";var Gc={pickerControl:"m_dc6a3c71"};const Nx={},kx=Ke((e,{size:n})=>({pickerControl:{"--dpc-fz":Rt(n),"--dpc-size":Ye(n,"dpc-size")}})),Ao=ye((e,n)=>{const t=ge("PickerControl",Nx,e),{classNames:o,className:a,style:r,styles:i,unstyled:l,vars:d,firstInRange:c,lastInRange:u,inRange:g,__staticSelector:h,selected:m,disabled:p,...f}=t,v=Le({name:h||"PickerControl",classes:Gc,props:t,className:a,style:r,classNames:o,styles:i,unstyled:l,vars:d,varsResolver:kx,rootSelector:"pickerControl"});return s.jsx(Pt,{...v("pickerControl"),ref:n,unstyled:l,"data-picker-control":!0,"data-selected":m&&!p||void 0,"data-disabled":p||void 0,"data-in-range":g&&!p&&!m||void 0,"data-first-in-range":c&&!p||void 0,"data-last-in-range":u&&!p||void 0,disabled:p,...f})});Ao.classes=Gc;Ao.displayName="@mantine/dates/PickerControl";function qc(e,n,t){return!n&&!t?!1:!!(n&&je(e).isBefore(n,"year")||t&&je(e).isAfter(t,"year"))}function Dx(e,n,t,o){const a=e.flat().filter(l=>{var d;return!qc(l,n,t)&&!((d=o==null?void 0:o(l))!=null&&d.disabled)}),r=a.find(l=>{var d;return(d=o==null?void 0:o(l))==null?void 0:d.selected});if(r)return r;const i=a.find(l=>je().isSame(l,"year"));return i||a[0]}function Wc(e){const n=e.getFullYear(),t=n-n%10;let o=0;const a=[[],[],[],[]];for(let r=0;r<4;r+=1){const i=r===3?1:3;for(let l=0;l<i;l+=1)a[r].push(new Date(t+o,0)),o+=1}return a}var Kc={yearsList:"m_9206547b",yearsListCell:"m_c5a19c7d"};const Tx={yearsListFormat:"YYYY",withCellSpacing:!0},zo=ye((e,n)=>{const t=ge("YearsList",Tx,e),{classNames:o,className:a,style:r,styles:i,unstyled:l,vars:d,decade:c,yearsListFormat:u,locale:g,minDate:h,maxDate:m,getYearControlProps:p,__staticSelector:f,__getControlRef:v,__onControlKeyDown:x,__onControlClick:y,__onControlMouseEnter:w,__preventFocus:C,__stopPropagation:j,withCellSpacing:S,size:R,..._}=t,T=Le({name:f||"YearsList",classes:Kc,props:t,className:a,style:r,classNames:o,styles:i,unstyled:l,vars:d,rootSelector:"yearsList"}),k=Ht(),I=Wc(c),E=Dx(I,h,m,p),V=I.map((L,B)=>{const M=L.map((D,O)=>{const F=p==null?void 0:p(D),$=je(D).isSame(E,"year");return s.jsx("td",{...T("yearsListCell"),"data-with-spacing":S||void 0,children:s.jsx(Ao,{...T("yearsListControl"),size:R,unstyled:l,"data-mantine-stop-propagation":j||void 0,disabled:qc(D,h,m),ref:z=>v==null?void 0:v(B,O,z),...F,onKeyDown:z=>{var H;(H=F==null?void 0:F.onKeyDown)==null||H.call(F,z),x==null||x(z,{rowIndex:B,cellIndex:O,date:D})},onClick:z=>{var H;(H=F==null?void 0:F.onClick)==null||H.call(F,z),y==null||y(z,D)},onMouseEnter:z=>{var H;(H=F==null?void 0:F.onMouseEnter)==null||H.call(F,z),w==null||w(z,D)},onMouseDown:z=>{var H;(H=F==null?void 0:F.onMouseDown)==null||H.call(F,z),C&&z.preventDefault()},tabIndex:C||!$?-1:0,children:je(D).locale(k.getLocale(g)).format(u)})},O)});return s.jsx("tr",{...T("yearsListRow"),children:M},B)});return s.jsx(K,{component:"table",ref:n,size:R,...T("yearsList"),..._,children:s.jsx("tbody",{children:V})})});zo.classes=Kc;zo.displayName="@mantine/dates/YearsList";function Yc(e,n,t){return!n&&!t?!1:!!(n&&je(e).isBefore(n,"month")||t&&je(e).isAfter(t,"month"))}function Ix(e,n,t,o){const a=e.flat().filter(l=>{var d;return!Yc(l,n,t)&&!((d=o==null?void 0:o(l))!=null&&d.disabled)}),r=a.find(l=>{var d;return(d=o==null?void 0:o(l))==null?void 0:d.selected});if(r)return r;const i=a.find(l=>je().isSame(l,"month"));return i||a[0]}function Px(e){const n=je(e).startOf("year").toDate(),t=[[],[],[],[]];let o=0;for(let a=0;a<4;a+=1)for(let r=0;r<3;r+=1)t[a].push(je(n).add(o,"months").toDate()),o+=1;return t}var Qc={monthsList:"m_2a6c32d",monthsListCell:"m_fe27622f"};const Fx={monthsListFormat:"MMM",withCellSpacing:!0},$o=ye((e,n)=>{const t=ge("MonthsList",Fx,e),{classNames:o,className:a,style:r,styles:i,unstyled:l,vars:d,__staticSelector:c,year:u,monthsListFormat:g,locale:h,minDate:m,maxDate:p,getMonthControlProps:f,__getControlRef:v,__onControlKeyDown:x,__onControlClick:y,__onControlMouseEnter:w,__preventFocus:C,__stopPropagation:j,withCellSpacing:S,size:R,..._}=t,T=Le({name:c||"MonthsList",classes:Qc,props:t,className:a,style:r,classNames:o,styles:i,unstyled:l,vars:d,rootSelector:"monthsList"}),k=Ht(),I=Px(u),E=Ix(I,m,p,f),V=I.map((L,B)=>{const M=L.map((D,O)=>{const F=f==null?void 0:f(D),$=je(D).isSame(E,"month");return s.jsx("td",{...T("monthsListCell"),"data-with-spacing":S||void 0,children:s.jsx(Ao,{...T("monthsListControl"),size:R,unstyled:l,__staticSelector:c||"MonthsList","data-mantine-stop-propagation":j||void 0,disabled:Yc(D,m,p),ref:z=>v==null?void 0:v(B,O,z),...F,onKeyDown:z=>{var H;(H=F==null?void 0:F.onKeyDown)==null||H.call(F,z),x==null||x(z,{rowIndex:B,cellIndex:O,date:D})},onClick:z=>{var H;(H=F==null?void 0:F.onClick)==null||H.call(F,z),y==null||y(z,D)},onMouseEnter:z=>{var H;(H=F==null?void 0:F.onMouseEnter)==null||H.call(F,z),w==null||w(z,D)},onMouseDown:z=>{var H;(H=F==null?void 0:F.onMouseDown)==null||H.call(F,z),C&&z.preventDefault()},tabIndex:C||!$?-1:0,children:je(D).locale(k.getLocale(h)).format(g)})},O)});return s.jsx("tr",{...T("monthsListRow"),children:M},B)});return s.jsx(K,{component:"table",ref:n,size:R,...T("monthsList"),..._,children:s.jsx("tbody",{children:V})})});$o.classes=Qc;$o.displayName="@mantine/dates/MonthsList";var Xc={calendarHeader:"m_730a79ed",calendarHeaderLevel:"m_f6645d97",calendarHeaderControl:"m_2351eeb0",calendarHeaderControlIcon:"m_367dc749"};const Ex={nextDisabled:!1,previousDisabled:!1,hasNextLevel:!0,withNext:!0,withPrevious:!0},Ox=Ke((e,{size:n})=>({calendarHeader:{"--dch-control-size":Ye(n,"dch-control-size"),"--dch-fz":Rt(n)}})),jn=ye((e,n)=>{const t=ge("CalendarHeader",Ex,e),{classNames:o,className:a,style:r,styles:i,unstyled:l,vars:d,nextIcon:c,previousIcon:u,nextLabel:g,previousLabel:h,onNext:m,onPrevious:p,onLevelClick:f,label:v,nextDisabled:x,previousDisabled:y,hasNextLevel:w,levelControlAriaLabel:C,withNext:j,withPrevious:S,__staticSelector:R,__preventFocus:_,__stopPropagation:T,...k}=t,I=Le({name:R||"CalendarHeader",classes:Xc,props:t,className:a,style:r,classNames:o,styles:i,unstyled:l,vars:d,varsResolver:Ox,rootSelector:"calendarHeader"}),E=_?V=>V.preventDefault():void 0;return s.jsxs(K,{...I("calendarHeader"),ref:n,...k,children:[S&&s.jsx(Pt,{...I("calendarHeaderControl"),"data-direction":"previous","aria-label":h,onClick:p,unstyled:l,onMouseDown:E,disabled:y,"data-disabled":y||void 0,tabIndex:_||y?-1:0,"data-mantine-stop-propagation":T||void 0,children:u||s.jsx(ka,{...I("calendarHeaderControlIcon"),"data-direction":"previous",size:"45%"})}),s.jsx(Pt,{component:w?"button":"div",...I("calendarHeaderLevel"),onClick:w?f:void 0,unstyled:l,onMouseDown:w?E:void 0,disabled:!w,"data-static":!w||void 0,"aria-label":C,tabIndex:_||!w?-1:0,"data-mantine-stop-propagation":T||void 0,children:v}),j&&s.jsx(Pt,{...I("calendarHeaderControl"),"data-direction":"next","aria-label":g,onClick:m,unstyled:l,onMouseDown:E,disabled:x,"data-disabled":x||void 0,tabIndex:_||x?-1:0,"data-mantine-stop-propagation":T||void 0,children:c||s.jsx(ka,{...I("calendarHeaderControlIcon"),"data-direction":"next",size:"45%"})})]})});jn.classes=Xc;jn.displayName="@mantine/dates/CalendarHeader";function Ax(e){const n=Wc(e);return[n[0][0],n[3][0]]}const zx={decadeLabelFormat:"YYYY"},Lo=ye((e,n)=>{const t=ge("DecadeLevel",zx,e),{decade:o,locale:a,minDate:r,maxDate:i,yearsListFormat:l,getYearControlProps:d,__getControlRef:c,__onControlKeyDown:u,__onControlClick:g,__onControlMouseEnter:h,withCellSpacing:m,__preventFocus:p,nextIcon:f,previousIcon:v,nextLabel:x,previousLabel:y,onNext:w,onPrevious:C,nextDisabled:j,previousDisabled:S,levelControlAriaLabel:R,withNext:_,withPrevious:T,decadeLabelFormat:k,classNames:I,styles:E,unstyled:V,__staticSelector:L,__stopPropagation:B,size:M,...D}=t,O=Ht(),[F,$]=Ax(o),z={__staticSelector:L||"DecadeLevel",classNames:I,styles:E,unstyled:V,size:M},H=typeof j=="boolean"?j:i?!je($).endOf("year").isBefore(i):!1,re=typeof S=="boolean"?S:r?!je(F).startOf("year").isAfter(r):!1,ie=(X,oe)=>je(X).locale(a||O.locale).format(oe);return s.jsxs(K,{"data-decade-level":!0,size:M,ref:n,...D,children:[s.jsx(jn,{label:typeof k=="function"?k(F,$):`${ie(F,k)} – ${ie($,k)}`,__preventFocus:p,__stopPropagation:B,nextIcon:f,previousIcon:v,nextLabel:x,previousLabel:y,onNext:w,onPrevious:C,nextDisabled:H,previousDisabled:re,hasNextLevel:!1,levelControlAriaLabel:R,withNext:_,withPrevious:T,...z}),s.jsx(zo,{decade:o,locale:a,minDate:r,maxDate:i,yearsListFormat:l,getYearControlProps:d,__getControlRef:c,__onControlKeyDown:u,__onControlClick:g,__onControlMouseEnter:h,__preventFocus:p,__stopPropagation:B,withCellSpacing:m,...z})]})});Lo.classes={...zo.classes,...jn.classes};Lo.displayName="@mantine/dates/DecadeLevel";const $x={yearLabelFormat:"YYYY"},Vo=ye((e,n)=>{const t=ge("YearLevel",$x,e),{year:o,locale:a,minDate:r,maxDate:i,monthsListFormat:l,getMonthControlProps:d,__getControlRef:c,__onControlKeyDown:u,__onControlClick:g,__onControlMouseEnter:h,withCellSpacing:m,__preventFocus:p,nextIcon:f,previousIcon:v,nextLabel:x,previousLabel:y,onNext:w,onPrevious:C,onLevelClick:j,nextDisabled:S,previousDisabled:R,hasNextLevel:_,levelControlAriaLabel:T,withNext:k,withPrevious:I,yearLabelFormat:E,__staticSelector:V,__stopPropagation:L,size:B,classNames:M,styles:D,unstyled:O,...F}=t,$=Ht(),z={__staticSelector:V||"YearLevel",classNames:M,styles:D,unstyled:O,size:B},H=typeof S=="boolean"?S:i?!je(o).endOf("year").isBefore(i):!1,re=typeof R=="boolean"?R:r?!je(o).startOf("year").isAfter(r):!1;return s.jsxs(K,{"data-year-level":!0,size:B,ref:n,...F,children:[s.jsx(jn,{label:typeof E=="function"?E(o):je(o).locale(a||$.locale).format(E),__preventFocus:p,__stopPropagation:L,nextIcon:f,previousIcon:v,nextLabel:x,previousLabel:y,onNext:w,onPrevious:C,onLevelClick:j,nextDisabled:H,previousDisabled:re,hasNextLevel:_,levelControlAriaLabel:T,withNext:k,withPrevious:I,...z}),s.jsx($o,{year:o,locale:a,minDate:r,maxDate:i,monthsListFormat:l,getMonthControlProps:d,__getControlRef:c,__onControlKeyDown:u,__onControlClick:g,__onControlMouseEnter:h,__preventFocus:p,__stopPropagation:L,withCellSpacing:m,...z})]})});Vo.classes={...jn.classes,...$o.classes};Vo.displayName="@mantine/dates/YearLevel";const Lx={monthLabelFormat:"MMMM YYYY"},Bo=ye((e,n)=>{const t=ge("MonthLevel",Lx,e),{month:o,locale:a,firstDayOfWeek:r,weekdayFormat:i,weekendDays:l,getDayProps:d,excludeDate:c,minDate:u,maxDate:g,renderDay:h,hideOutsideDates:m,hideWeekdays:p,getDayAriaLabel:f,__getDayRef:v,__onDayKeyDown:x,__onDayClick:y,__onDayMouseEnter:w,withCellSpacing:C,highlightToday:j,withWeekNumbers:S,__preventFocus:R,__stopPropagation:_,nextIcon:T,previousIcon:k,nextLabel:I,previousLabel:E,onNext:V,onPrevious:L,onLevelClick:B,nextDisabled:M,previousDisabled:D,hasNextLevel:O,levelControlAriaLabel:F,withNext:$,withPrevious:z,monthLabelFormat:H,classNames:re,styles:ie,unstyled:X,__staticSelector:oe,size:ne,static:J,...P}=t,Q=Ht(),ce={__staticSelector:oe||"MonthLevel",classNames:re,styles:ie,unstyled:X,size:ne},te=typeof M=="boolean"?M:g?!je(o).endOf("month").isBefore(g):!1,W=typeof D=="boolean"?D:u?!je(o).startOf("month").isAfter(u):!1;return s.jsxs(K,{"data-month-level":!0,size:ne,ref:n,...P,children:[s.jsx(jn,{label:typeof H=="function"?H(o):je(o).locale(a||Q.locale).format(H),__preventFocus:R,__stopPropagation:_,nextIcon:T,previousIcon:k,nextLabel:I,previousLabel:E,onNext:V,onPrevious:L,onLevelClick:B,nextDisabled:te,previousDisabled:W,hasNextLevel:O,levelControlAriaLabel:F,withNext:$,withPrevious:z,...ce}),s.jsx(Oo,{month:o,locale:a,firstDayOfWeek:r,weekdayFormat:i,weekendDays:l,getDayProps:d,excludeDate:c,minDate:u,maxDate:g,renderDay:h,hideOutsideDates:m,hideWeekdays:p,getDayAriaLabel:f,__getDayRef:v,__onDayKeyDown:x,__onDayClick:y,__onDayMouseEnter:w,__preventFocus:R,__stopPropagation:_,static:J,withCellSpacing:C,highlightToday:j,withWeekNumbers:S,...ce})]})});Bo.classes={...Oo.classes,...jn.classes};Bo.displayName="@mantine/dates/MonthLevel";var Zc={levelsGroup:"m_30b26e33"};const Vx={},Sn=ye((e,n)=>{const t=ge("LevelsGroup",Vx,e),{classNames:o,className:a,style:r,styles:i,unstyled:l,vars:d,__staticSelector:c,...u}=t,g=Le({name:c||"LevelsGroup",classes:Zc,props:t,className:a,style:r,classNames:o,styles:i,unstyled:l,vars:d,rootSelector:"levelsGroup"});return s.jsx(K,{ref:n,...g("levelsGroup"),...u})});Sn.classes=Zc;Sn.displayName="@mantine/dates/LevelsGroup";const Bx={numberOfColumns:1},Uo=ye((e,n)=>{const t=ge("DecadeLevelGroup",Bx,e),{decade:o,locale:a,minDate:r,maxDate:i,yearsListFormat:l,getYearControlProps:d,__onControlClick:c,__onControlMouseEnter:u,withCellSpacing:g,__preventFocus:h,nextIcon:m,previousIcon:p,nextLabel:f,previousLabel:v,onNext:x,onPrevious:y,nextDisabled:w,previousDisabled:C,classNames:j,styles:S,unstyled:R,__staticSelector:_,__stopPropagation:T,numberOfColumns:k,levelControlAriaLabel:I,decadeLabelFormat:E,size:V,vars:L,...B}=t,M=b.useRef([]),D=Array(k).fill(0).map((O,F)=>{const $=je(o).add(F*10,"years").toDate();return s.jsx(Lo,{size:V,yearsListFormat:l,decade:$,withNext:F===k-1,withPrevious:F===0,decadeLabelFormat:E,__onControlClick:c,__onControlMouseEnter:u,__onControlKeyDown:(z,H)=>Qr({levelIndex:F,rowIndex:H.rowIndex,cellIndex:H.cellIndex,event:z,controlsRef:M}),__getControlRef:(z,H,re)=>{Array.isArray(M.current[F])||(M.current[F]=[]),Array.isArray(M.current[F][z])||(M.current[F][z]=[]),M.current[F][z][H]=re},levelControlAriaLabel:typeof I=="function"?I($):I,locale:a,minDate:r,maxDate:i,__preventFocus:h,__stopPropagation:T,nextIcon:m,previousIcon:p,nextLabel:f,previousLabel:v,onNext:x,onPrevious:y,nextDisabled:w,previousDisabled:C,getYearControlProps:d,__staticSelector:_||"DecadeLevelGroup",classNames:j,styles:S,unstyled:R,withCellSpacing:g},F)});return s.jsx(Sn,{classNames:j,styles:S,__staticSelector:_||"DecadeLevelGroup",ref:n,size:V,unstyled:R,...B,children:D})});Uo.classes={...Sn.classes,...Lo.classes};Uo.displayName="@mantine/dates/DecadeLevelGroup";const Ux={numberOfColumns:1},Ho=ye((e,n)=>{const t=ge("YearLevelGroup",Ux,e),{year:o,locale:a,minDate:r,maxDate:i,monthsListFormat:l,getMonthControlProps:d,__onControlClick:c,__onControlMouseEnter:u,withCellSpacing:g,__preventFocus:h,nextIcon:m,previousIcon:p,nextLabel:f,previousLabel:v,onNext:x,onPrevious:y,onLevelClick:w,nextDisabled:C,previousDisabled:j,hasNextLevel:S,classNames:R,styles:_,unstyled:T,__staticSelector:k,__stopPropagation:I,numberOfColumns:E,levelControlAriaLabel:V,yearLabelFormat:L,size:B,vars:M,...D}=t,O=b.useRef([]),F=Array(E).fill(0).map(($,z)=>{const H=je(o).add(z,"years").toDate();return s.jsx(Vo,{size:B,monthsListFormat:l,year:H,withNext:z===E-1,withPrevious:z===0,yearLabelFormat:L,__stopPropagation:I,__onControlClick:c,__onControlMouseEnter:u,__onControlKeyDown:(re,ie)=>Qr({levelIndex:z,rowIndex:ie.rowIndex,cellIndex:ie.cellIndex,event:re,controlsRef:O}),__getControlRef:(re,ie,X)=>{Array.isArray(O.current[z])||(O.current[z]=[]),Array.isArray(O.current[z][re])||(O.current[z][re]=[]),O.current[z][re][ie]=X},levelControlAriaLabel:typeof V=="function"?V(H):V,locale:a,minDate:r,maxDate:i,__preventFocus:h,nextIcon:m,previousIcon:p,nextLabel:f,previousLabel:v,onNext:x,onPrevious:y,onLevelClick:w,nextDisabled:C,previousDisabled:j,hasNextLevel:S,getMonthControlProps:d,classNames:R,styles:_,unstyled:T,__staticSelector:k||"YearLevelGroup",withCellSpacing:g},z)});return s.jsx(Sn,{classNames:R,styles:_,__staticSelector:k||"YearLevelGroup",ref:n,size:B,unstyled:T,...D,children:F})});Ho.classes={...Vo.classes,...Sn.classes};Ho.displayName="@mantine/dates/YearLevelGroup";const Hx={numberOfColumns:1},Go=ye((e,n)=>{const t=ge("MonthLevelGroup",Hx,e),{month:o,locale:a,firstDayOfWeek:r,weekdayFormat:i,weekendDays:l,getDayProps:d,excludeDate:c,minDate:u,maxDate:g,renderDay:h,hideOutsideDates:m,hideWeekdays:p,getDayAriaLabel:f,__onDayClick:v,__onDayMouseEnter:x,withCellSpacing:y,highlightToday:w,withWeekNumbers:C,__preventFocus:j,nextIcon:S,previousIcon:R,nextLabel:_,previousLabel:T,onNext:k,onPrevious:I,onLevelClick:E,nextDisabled:V,previousDisabled:L,hasNextLevel:B,classNames:M,styles:D,unstyled:O,numberOfColumns:F,levelControlAriaLabel:$,monthLabelFormat:z,__staticSelector:H,__stopPropagation:re,size:ie,static:X,vars:oe,...ne}=t,J=b.useRef([]),P=Array(F).fill(0).map((Q,ce)=>{const te=je(o).add(ce,"months").toDate();return s.jsx(Bo,{month:te,withNext:ce===F-1,withPrevious:ce===0,monthLabelFormat:z,__stopPropagation:re,__onDayClick:v,__onDayMouseEnter:x,__onDayKeyDown:(W,me)=>Qr({levelIndex:ce,rowIndex:me.rowIndex,cellIndex:me.cellIndex,event:W,controlsRef:J}),__getDayRef:(W,me,le)=>{Array.isArray(J.current[ce])||(J.current[ce]=[]),Array.isArray(J.current[ce][W])||(J.current[ce][W]=[]),J.current[ce][W][me]=le},levelControlAriaLabel:typeof $=="function"?$(te):$,locale:a,firstDayOfWeek:r,weekdayFormat:i,weekendDays:l,getDayProps:d,excludeDate:c,minDate:u,maxDate:g,renderDay:h,hideOutsideDates:m,hideWeekdays:p,getDayAriaLabel:f,__preventFocus:j,nextIcon:S,previousIcon:R,nextLabel:_,previousLabel:T,onNext:k,onPrevious:I,onLevelClick:E,nextDisabled:V,previousDisabled:L,hasNextLevel:B,classNames:M,styles:D,unstyled:O,__staticSelector:H||"MonthLevelGroup",size:ie,static:X,withCellSpacing:y,highlightToday:w,withWeekNumbers:C},ce)});return s.jsx(Sn,{classNames:M,styles:D,__staticSelector:H||"MonthLevelGroup",ref:n,size:ie,...ne,children:P})});Go.classes={...Sn.classes,...Bo.classes};Go.displayName="@mantine/dates/MonthLevelGroup";const Xi=e=>e==="range"?[null,null]:e==="multiple"?[]:null;function Va({type:e,value:n,defaultValue:t,onChange:o,applyTimezone:a=!0}){const r=b.useRef(e),i=Ht(),[l,d,c]=At({value:In("add",n,i.getTimezone(),!a),defaultValue:In("add",t,i.getTimezone(),!a),finalValue:Xi(e),onChange:g=>{o==null||o(In("remove",g,i.getTimezone(),!a))}});let u=l;return r.current!==e&&(r.current=e,n===void 0&&(u=t!==void 0?t:Xi(e),d(u))),[u,d,c]}function ua(e,n){return e?e==="month"?0:e==="year"?1:2:n||0}function Gx(e){return e===0?"month":e===1?"year":"decade"}function ds(e,n,t){return Gx(Dn(ua(e,0),ua(n,0),ua(t,2)))}const qx={maxLevel:"decade",minLevel:"month",__updateDateOnYearSelect:!0,__updateDateOnMonthSelect:!0},qo=ye((e,n)=>{const t=ge("Calendar",qx,e),{vars:o,maxLevel:a,minLevel:r,defaultLevel:i,level:l,onLevelChange:d,date:c,defaultDate:u,onDateChange:g,numberOfColumns:h,columnsToScroll:m,ariaLabels:p,nextLabel:f,previousLabel:v,onYearSelect:x,onMonthSelect:y,onYearMouseEnter:w,onMonthMouseEnter:C,__updateDateOnYearSelect:j,__updateDateOnMonthSelect:S,firstDayOfWeek:R,weekdayFormat:_,weekendDays:T,getDayProps:k,excludeDate:I,renderDay:E,hideOutsideDates:V,hideWeekdays:L,getDayAriaLabel:B,monthLabelFormat:M,nextIcon:D,previousIcon:O,__onDayClick:F,__onDayMouseEnter:$,withCellSpacing:z,highlightToday:H,withWeekNumbers:re,monthsListFormat:ie,getMonthControlProps:X,yearLabelFormat:oe,yearsListFormat:ne,getYearControlProps:J,decadeLabelFormat:P,classNames:Q,styles:ce,unstyled:te,minDate:W,maxDate:me,locale:le,__staticSelector:de,size:Y,__preventFocus:A,__stopPropagation:se,onNextDecade:be,onPreviousDecade:ve,onNextYear:Se,onPreviousYear:we,onNextMonth:U,onPreviousMonth:G,static:ae,__timezoneApplied:Fe,...pe}=t,{resolvedClassNames:Z,resolvedStyles:_e}=wn({classNames:Q,styles:ce,props:t}),[Ae,Qe]=At({value:l?ds(l,r,a):void 0,defaultValue:i?ds(i,r,a):void 0,finalValue:ds(void 0,r,a),onChange:d}),[nt,et]=Va({type:"default",value:c,defaultValue:u,onChange:g,applyTimezone:!Fe}),ee={__staticSelector:de||"Calendar",styles:_e,classNames:Z,unstyled:te,size:Y},q=Ht(),Re=m||h||1,He=new Date,st=W&&W>He?W:He,rt=nt||In("add",st,q.getTimezone()),nn=()=>{const Je=je(rt).add(Re,"month").toDate();U==null||U(Je),et(Je)},Dt=()=>{const Je=je(rt).subtract(Re,"month").toDate();G==null||G(Je),et(Je)},qe=()=>{const Je=je(rt).add(Re,"year").toDate();Se==null||Se(Je),et(Je)},is=()=>{const Je=je(rt).subtract(Re,"year").toDate();we==null||we(Je),et(Je)},Is=()=>{const Je=je(rt).add(10*Re,"year").toDate();be==null||be(Je),et(Je)},ls=()=>{const Je=je(rt).subtract(10*Re,"year").toDate();ve==null||ve(Je),et(Je)};return s.jsxs(K,{ref:n,size:Y,"data-calendar":!0,...pe,children:[Ae==="month"&&s.jsx(Go,{month:rt,minDate:W,maxDate:me,firstDayOfWeek:R,weekdayFormat:_,weekendDays:T,getDayProps:k,excludeDate:I,renderDay:E,hideOutsideDates:V,hideWeekdays:L,getDayAriaLabel:B,onNext:nn,onPrevious:Dt,hasNextLevel:a!=="month",onLevelClick:()=>Qe("year"),numberOfColumns:h,locale:le,levelControlAriaLabel:p==null?void 0:p.monthLevelControl,nextLabel:(p==null?void 0:p.nextMonth)??f,nextIcon:D,previousLabel:(p==null?void 0:p.previousMonth)??v,previousIcon:O,monthLabelFormat:M,__onDayClick:F,__onDayMouseEnter:$,__preventFocus:A,__stopPropagation:se,static:ae,withCellSpacing:z,highlightToday:H,withWeekNumbers:re,...ee}),Ae==="year"&&s.jsx(Ho,{year:rt,numberOfColumns:h,minDate:W,maxDate:me,monthsListFormat:ie,getMonthControlProps:X,locale:le,onNext:qe,onPrevious:is,hasNextLevel:a!=="month"&&a!=="year",onLevelClick:()=>Qe("decade"),levelControlAriaLabel:p==null?void 0:p.yearLevelControl,nextLabel:(p==null?void 0:p.nextYear)??f,nextIcon:D,previousLabel:(p==null?void 0:p.previousYear)??v,previousIcon:O,yearLabelFormat:oe,__onControlMouseEnter:C,__onControlClick:(Je,xe)=>{S&&et(xe),Qe(ds("month",r,a)),y==null||y(xe)},__preventFocus:A,__stopPropagation:se,withCellSpacing:z,...ee}),Ae==="decade"&&s.jsx(Uo,{decade:rt,minDate:W,maxDate:me,yearsListFormat:ne,getYearControlProps:J,locale:le,onNext:Is,onPrevious:ls,numberOfColumns:h,nextLabel:(p==null?void 0:p.nextDecade)??f,nextIcon:D,previousLabel:(p==null?void 0:p.previousDecade)??v,previousIcon:O,decadeLabelFormat:P,__onControlMouseEnter:w,__onControlClick:(Je,xe)=>{j&&et(xe),Qe(ds("year",r,a)),x==null||x(xe)},__preventFocus:A,__stopPropagation:se,withCellSpacing:z,...ee})]})});qo.classes={...Uo.classes,...Ho.classes,...Go.classes};qo.displayName="@mantine/dates/Calendar";function Wx(e){const{maxLevel:n,minLevel:t,defaultLevel:o,level:a,onLevelChange:r,nextIcon:i,previousIcon:l,date:d,defaultDate:c,onDateChange:u,numberOfColumns:g,columnsToScroll:h,ariaLabels:m,nextLabel:p,previousLabel:f,onYearSelect:v,onMonthSelect:x,onYearMouseEnter:y,onMonthMouseEnter:w,onNextMonth:C,onPreviousMonth:j,onNextYear:S,onPreviousYear:R,onNextDecade:_,onPreviousDecade:T,withCellSpacing:k,highlightToday:I,__updateDateOnYearSelect:E,__updateDateOnMonthSelect:V,withWeekNumbers:L,firstDayOfWeek:B,weekdayFormat:M,weekendDays:D,getDayProps:O,excludeDate:F,renderDay:$,hideOutsideDates:z,hideWeekdays:H,getDayAriaLabel:re,monthLabelFormat:ie,monthsListFormat:X,getMonthControlProps:oe,yearLabelFormat:ne,yearsListFormat:J,getYearControlProps:P,decadeLabelFormat:Q,allowSingleDateInRange:ce,allowDeselect:te,minDate:W,maxDate:me,locale:le,...de}=e;return{calendarProps:{maxLevel:n,minLevel:t,defaultLevel:o,level:a,onLevelChange:r,nextIcon:i,previousIcon:l,date:d,defaultDate:c,onDateChange:u,numberOfColumns:g,columnsToScroll:h,ariaLabels:m,nextLabel:p,previousLabel:f,onYearSelect:v,onMonthSelect:x,onYearMouseEnter:y,onMonthMouseEnter:w,onNextMonth:C,onPreviousMonth:j,onNextYear:S,onPreviousYear:R,onNextDecade:_,onPreviousDecade:T,withCellSpacing:k,highlightToday:I,__updateDateOnYearSelect:E,__updateDateOnMonthSelect:V,withWeekNumbers:L,firstDayOfWeek:B,weekdayFormat:M,weekendDays:D,getDayProps:O,excludeDate:F,renderDay:$,hideOutsideDates:z,hideWeekdays:H,getDayAriaLabel:re,monthLabelFormat:ie,monthsListFormat:X,getMonthControlProps:oe,yearLabelFormat:ne,yearsListFormat:J,getYearControlProps:P,decadeLabelFormat:Q,allowSingleDateInRange:ce,allowDeselect:te,minDate:W,maxDate:me,locale:le},others:de}}function Kx(e,n){if(e===null)return null;const t=In("add",new Date(e),n);return Number.isNaN(t.getTime())||!e?null:t}function Yx({date:e,maxDate:n,minDate:t}){return!(e==null||Number.isNaN(e.getTime())||n&&je(e).isAfter(n,"date")||t&&je(e).isBefore(t,"date"))}const Qx={valueFormat:"MMMM D, YYYY",fixOnBlur:!0,preserveTime:!0},Jr=ye((e,n)=>{const t=fu("DateInput",Qx,e),{inputProps:o,wrapperProps:a,value:r,defaultValue:i,onChange:l,clearable:d,clearButtonProps:c,popoverProps:u,getDayProps:g,locale:h,valueFormat:m,dateParser:p,minDate:f,maxDate:v,fixOnBlur:x,onFocus:y,onBlur:w,onClick:C,onKeyDown:j,readOnly:S,name:R,form:_,rightSection:T,unstyled:k,classNames:I,styles:E,allowDeselect:V,preserveTime:L,date:B,defaultDate:M,onDateChange:D,...O}=t,F=b.useRef(null),$=b.useRef(null),[z,H]=b.useState(!1),{calendarProps:re,others:ie}=Wx(O),X=Ht(),ne=p||(U=>{const G=je(U,m,X.getLocale(h)).toDate();return Number.isNaN(G.getTime())?Kx(U,X.getTimezone()):G}),J=V!==void 0?V:d,P=U=>U?je(U).locale(X.getLocale(h)).format(m):"",[Q,ce,te]=Va({type:"default",value:r,defaultValue:i,onChange:l}),[W,me]=Va({type:"default",value:B,defaultValue:i||M,onChange:D});b.useEffect(()=>{te&&r!==null&&me(r)},[te,r]);const[le,de]=b.useState(P(Q));b.useEffect(()=>{de(P(Q))},[X.getLocale(h)]);const Y=U=>{const G=U.currentTarget.value;if(de(G),H(!0),G.trim()===""&&d)ce(null);else{const ae=ne(G);Yx({date:ae,minDate:f,maxDate:v})&&(ce(ae),me(ae))}},A=U=>{w==null||w(U),H(!1),x&&de(P(Q))},se=U=>{y==null||y(U),H(!0)},be=U=>{C==null||C(U),H(!0)},ve=U=>{U.key==="Escape"&&H(!1),j==null||j(U)},Se=U=>({...g==null?void 0:g(U),selected:je(Q).isSame(U,"day"),onClick:G=>{var pe,Z;(Z=g==null?void 0:(pe=g(U)).onClick)==null||Z.call(pe,G);const ae=L?Jv(Q,U):U,Fe=d&&J&&je(Q).isSame(U,"day")?null:ae;ce(Fe),!te&&de(P(Fe)),H(!1)}}),we=T||(d&&Q&&!S?s.jsx(Ya,{variant:"transparent",onMouseDown:U=>U.preventDefault(),tabIndex:-1,onClick:()=>{ce(null),!te&&de(""),H(!1)},unstyled:k,size:o.size||"sm",...c}):null);return qa(()=>{Q!==void 0&&!z&&de(P(Q))},[Q]),Hu(()=>H(!1),void 0,[F.current,$.current]),s.jsxs(s.Fragment,{children:[s.jsx(xs.Wrapper,{...a,__staticSelector:"DateInput",ref:F,children:s.jsxs(Mt,{opened:z,trapFocus:!1,position:"bottom-start",disabled:S,withRoles:!1,unstyled:k,...u,children:[s.jsx(Mt.Target,{children:s.jsx(xs,{"data-dates-input":!0,"data-read-only":S||void 0,autoComplete:"off",ref:n,value:le,onChange:Y,onBlur:A,onFocus:se,onClick:be,onKeyDown:ve,readOnly:S,rightSection:we,...o,...ie,__staticSelector:"DateInput"})}),s.jsx(Mt.Dropdown,{onMouseDown:U=>U.preventDefault(),"data-dates-dropdown":!0,ref:$,children:s.jsx(qo,{__staticSelector:"DateInput",__timezoneApplied:!0,...re,classNames:I,styles:E,unstyled:k,__preventFocus:!0,minDate:f,maxDate:v,locale:h,getDayProps:Se,size:o.size,date:W,onDateChange:me})})]})}),s.jsx(zc,{name:R,form:_,value:Q,type:"default"})]})});Jr.classes={...xs.classes,...qo.classes};Jr.displayName="@mantine/dates/DateInput";function Ie(e,n){var t={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&n.indexOf(o)<0&&(t[o]=e[o]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var a=0,o=Object.getOwnPropertySymbols(e);a<o.length;a++)n.indexOf(o[a])<0&&Object.prototype.propertyIsEnumerable.call(e,o[a])&&(t[o[a]]=e[o[a]]);return t}var It={root:"MRT_TableBody-module_root__kGhRy","root-grid":"MRT_TableBody-module_root-grid__WdOGg","root-no-rows":"MRT_TableBody-module_root-no-rows__iyi9K","root-virtualized":"MRT_TableBody-module_root-virtualized__TxPAi","empty-row-tr-grid":"MRT_TableBody-module_empty-row-tr-grid__LTgxw","empty-row-td-grid":"MRT_TableBody-module_empty-row-td-grid__pzlgG","empty-row-td-content":"MRT_TableBody-module_empty-row-td-content__Cc2XW",pinned:"MRT_TableBody-module_pinned__XHpcs"},ga={root:"MRT_TableBodyRow-module_root__2c3D4","root-grid":"MRT_TableBodyRow-module_root-grid__AwXTe","root-virtualized":"MRT_TableBodyRow-module_root-virtualized__zYgxq"},en={root:"MRT_TableBodyCell-module_root__Wf-zi","root-grid":"MRT_TableBodyCell-module_root-grid__zIuC-","root-virtualized":"MRT_TableBodyCell-module_root-virtualized__jLl8R","root-data-col":"MRT_TableBodyCell-module_root-data-col__HHcxc","root-nowrap":"MRT_TableBodyCell-module_root-nowrap__-k1Jo","root-cursor-pointer":"MRT_TableBodyCell-module_root-cursor-pointer__4kw7J","root-editable-hover":"MRT_TableBodyCell-module_root-editable-hover__2DKSa","root-cell-hover-reveal":"MRT_TableBodyCell-module_root-cell-hover-reveal__T1fAH","cell-hover-reveal":"MRT_TableBodyCell-module_cell-hover-reveal__Q-1Xj",overflowing:"MRT_TableBodyCell-module_overflowing__QcXP4"};const fe=(e,n)=>e instanceof Function?e(n):e,ma=["string","number"],Xx=["text","autocomplete"],Zi=({cell:e,renderedColumnIndex:n=0,renderedRowIndex:t=0,table:o})=>{var a,r;const{getState:i,options:{enableFilterMatchHighlighting:l,mantineHighlightProps:d}}=o,{column:c,row:u}=e,{columnDef:g}=c,{globalFilter:h,globalFilterFn:m}=i(),p=c.getFilterValue(),f=fe(d,{cell:e,column:c,row:u,table:o});let v=e.getIsAggregated()&&g.AggregatedCell?g.AggregatedCell({cell:e,column:c,row:u,table:o}):u.getIsGrouped()&&!e.getIsGrouped()?null:e.getIsGrouped()&&g.GroupedCell?g.GroupedCell({cell:e,column:c,row:u,table:o}):void 0;const x=v!==void 0;if(x||(v=e.renderValue()),l&&g.enableFilterMatchHighlighting!==!1&&v&&ma.includes(typeof v)&&(p&&ma.includes(typeof p)&&Xx.includes(g.filterVariant)||h&&ma.includes(typeof h)&&c.getCanGlobalFilter())){let y=((r=(a=c.getFilterValue())!==null&&a!==void 0?a:h)!==null&&r!==void 0?r:"").toString();(p?g._filterFn:m)==="fuzzy"&&(y=y.split(" ")),v=s.jsx(jr,Object.assign({color:"yellow.3",highlight:y},f,{children:v==null?void 0:v.toString()}))}return g.Cell&&!x&&(v=g.Cell({cell:e,column:c,renderedCellValue:v,renderedColumnIndex:n,renderedRowIndex:t,row:u,table:o})),v},Yt=e=>e.replace(/[^a-zA-Z0-9]/g,"_"),Zx=e=>{var n,t;return typeof e.primaryShade=="number"?e.primaryShade:(t=(n=e.primaryShade)===null||n===void 0?void 0:n.dark)!==null&&t!==void 0?t:7},Jx=(e,n)=>e.colors[e.primaryColor][Zx(e)];function to(e,n){const t=`data-${e}`;switch(typeof n){case"boolean":return n?{[t]:""}:null;case"number":return{[t]:`${n}`};case"string":return{[t]:n};default:return null}}var eb={root:"MRT_CopyButton-module_root__mkXy4"};const tb=e=>{var{cell:n,children:t,table:o}=e,a=Ie(e,["cell","children","table"]);const{options:{localization:{clickToCopy:r,copiedToClipboard:i},mantineCopyButtonProps:l}}=o,{column:d,row:c}=n,{columnDef:u}=d,g={cell:n,column:d,row:c,table:o},h=Object.assign(Object.assign(Object.assign({},fe(l,g)),fe(u.mantineCopyButtonProps,g)),a);return s.jsx(Bl,{value:n.getValue(),children:({copied:m,copy:p})=>{var f;return s.jsx(We,{color:m?"green":void 0,label:(f=h==null?void 0:h.title)!==null&&f!==void 0?f:m?i:r,openDelay:1e3,withinPortal:!0,children:s.jsx(Pt,Object.assign({},h,{className:Ce("mrt-copy-button",eb.root,h==null?void 0:h.className),onClick:v=>{v.stopPropagation(),p()},role:"presentation",title:void 0,children:t}))})}})},Wo=e=>{var n,{cell:t,table:o}=e,a=Ie(e,["cell","table"]);const{getState:r,options:{createDisplayMode:i,editDisplayMode:l,mantineEditSelectProps:d,mantineEditTextInputProps:c},refs:{editInputRefs:u},setCreatingRow:g,setEditingCell:h,setEditingRow:m}=o,{column:p,row:f}=t,{columnDef:v}=p,{creatingRow:x,editingRow:y}=r(),w=(x==null?void 0:x.id)===f.id,C=(y==null?void 0:y.id)===f.id,j=v.editVariant==="select",S=v.editVariant==="multi-select",[R,_]=b.useState(()=>t.getValue()),T={cell:t,column:p,row:f,table:o},k=Object.assign(Object.assign(Object.assign({},fe(c,T)),fe(v.mantineEditTextInputProps,T)),a),I=Object.assign(Object.assign(Object.assign({},fe(d,T)),fe(v.mantineEditSelectProps,T)),a),E=M=>{f._valuesCache[p.id]=M,w?g(f):C&&m(f)},V=M=>{var D;(D=k.onBlur)===null||D===void 0||D.call(k,M),E(R),h(null)},L=M=>{var D,O;(D=k.onKeyDown)===null||D===void 0||D.call(k,M),M.key==="Enter"&&((O=u.current[t.id])===null||O===void 0||O.blur())};if(v.Edit)return(n=v.Edit)===null||n===void 0?void 0:n.call(v,{cell:t,column:p,row:f,table:o});const B={disabled:fe(v.enableEditing,f)===!1,label:["custom","modal"].includes(w?i:l)?p.columnDef.header:void 0,name:t.id,onClick:M=>{var D;M.stopPropagation(),(D=k==null?void 0:k.onClick)===null||D===void 0||D.call(k,M)},placeholder:["custom","modal"].includes(w?i:l)?void 0:v.header,value:R,variant:l==="table"?"unstyled":"default"};return j?s.jsx(Jt,Object.assign({},B,{searchable:!0,value:R},I,{onBlur:V,onChange:(M,D)=>{var O,F;(F=(O=I).onChange)===null||F===void 0||F.call(O,M,D),_(M)},onClick:M=>{var D;M.stopPropagation(),(D=I==null?void 0:I.onClick)===null||D===void 0||D.call(I,M)},ref:M=>{M&&(u.current[t.id]=M,I.ref&&(I.ref.current=M))}})):S?s.jsx(So,Object.assign({},B,{searchable:!0,value:R},I,{onBlur:V,onChange:M=>{var D,O;(O=(D=I).onChange)===null||O===void 0||O.call(D,R),_(M),document.activeElement!==u.current[t.id]&&E(M)},onClick:M=>{var D;M.stopPropagation(),(D=I==null?void 0:I.onClick)===null||D===void 0||D.call(I,M)},ref:M=>{M&&(u.current[t.id]=M,I.ref&&(I.ref.current=M))}})):s.jsx(Ge,Object.assign({},B,{onKeyDown:L,value:R??""},k,{onBlur:V,onChange:M=>{var D;(D=k.onChange)===null||D===void 0||D.call(k,M),_(M.target.value)},onClick:M=>{var D;M.stopPropagation(),(D=k==null?void 0:k.onClick)===null||D===void 0||D.call(k,M)},ref:M=>{M&&(u.current[t.id]=M,k.ref&&(k.ref.current=M))}}))},Jc=e=>{var n,t,o,a,r,{cell:i,numRows:l=1,renderedColumnIndex:d=0,renderedRowIndex:c=0,rowRef:u,table:g,virtualCell:h}=e,m=Ie(e,["cell","numRows","renderedColumnIndex","renderedRowIndex","rowRef","table","virtualCell"]);const p=On(),{getState:f,options:{columnResizeDirection:v,columnResizeMode:x,createDisplayMode:y,editDisplayMode:w,enableClickToCopy:C,enableColumnOrdering:j,enableColumnPinning:S,enableEditing:R,enableGrouping:_,layoutMode:T,mantineSkeletonProps:k,mantineTableBodyCellProps:I},refs:{editInputRefs:E},setEditingCell:V,setHoveredColumn:L}=g,{columnSizingInfo:B,creatingRow:M,density:D,draggingColumn:O,editingCell:F,editingRow:$,hoveredColumn:z,isLoading:H,showSkeletons:re}=f(),{column:ie,row:X}=i,{columnDef:oe}=ie,{columnDefType:ne}=oe,J={cell:i,column:ie,renderedColumnIndex:d,renderedRowIndex:c,row:X,table:g},P=Object.assign(Object.assign(Object.assign({},fe(I,J)),fe(oe.mantineTableBodyCellProps,J)),m),Q=fe(k,J),[ce,te]=b.useState(100);b.useEffect(()=>{if(!H&&!re||ce!==100)return;const _e=ie.getSize();te(ne==="display"?_e/2:Math.round(Math.random()*(_e-_e/3)+_e/3))},[H,re]);const W={minWidth:`max(calc(var(--col-${Yt(ie==null?void 0:ie.id)}-size) * 1px), ${(n=oe.minSize)!==null&&n!==void 0?n:30}px)`,width:`calc(var(--col-${Yt(ie.id)}-size) * 1px)`};T==="grid"?W.flex=`${[0,!1].includes(oe.grow)?0:`var(--col-${Yt(ie.id)}-size)`} 0 auto`:T==="grid-no-grow"&&(W.flex=`${+(oe.grow||0)} 0 auto`);const me=(O==null?void 0:O.id)===ie.id,le=(z==null?void 0:z.id)===ie.id,de=S&&oe.columnDefType!=="group"&&ie.getIsPinned(),Y=!i.getIsPlaceholder()&&fe(R,X)&&fe(oe.enableEditing,X)!==!1,A=Y&&!["custom","modal"].includes(w)&&(w==="table"||($==null?void 0:$.id)===X.id||(F==null?void 0:F.id)===i.id)&&!X.getIsGrouped(),se=Y&&y==="row"&&(M==null?void 0:M.id)===X.id,be=fe(C,i)||fe(oe.enableClickToCopy,i)&&fe(oe.enableClickToCopy,i)!==!1,ve=_e=>{var Ae;(Ae=P==null?void 0:P.onDoubleClick)===null||Ae===void 0||Ae.call(P,_e),Y&&w==="cell"&&(V(i),setTimeout(()=>{var Qe;const nt=E.current[i.id];nt&&(nt.focus(),(Qe=nt.select)===null||Qe===void 0||Qe.call(nt))},100))},Se=_e=>{var Ae;(Ae=P==null?void 0:P.onDragEnter)===null||Ae===void 0||Ae.call(P,_e),_&&(z==null?void 0:z.id)==="drop-zone"&&L(null),j&&O&&L(oe.enableColumnOrdering!==!1?ie:null)},we={cell:i,renderedColumnIndex:d,renderedRowIndex:c,table:g},U=b.useRef(null),[G,ae]=b.useState(!1),Fe=()=>{if(!oe.enableCellHoverReveal)return;const _e=U.current;if(_e){const Ae=_e.scrollWidth>_e.clientWidth;ae(Ae)}},pe=()=>{oe.enableCellHoverReveal&&ae(!1)},Z=()=>{var _e,Ae,Qe;return i.getIsPlaceholder()?(Ae=(_e=oe.PlaceholderCell)===null||_e===void 0?void 0:_e.call(oe,{cell:i,column:ie,row:X,table:g}))!==null&&Ae!==void 0?Ae:null:re!==!1&&(H||re)?s.jsx(Gu,Object.assign({height:20,width:ce},Q)):ne==="display"&&(["mrt-row-expand","mrt-row-numbers","mrt-row-select"].includes(ie.id)||!X.getIsGrouped())?(Qe=oe.Cell)===null||Qe===void 0?void 0:Qe.call(oe,Object.assign({column:ie,renderedCellValue:i.renderValue(),row:X,rowRef:u},we)):se||A?s.jsx(Wo,{cell:i,table:g}):be&&oe.enableClickToCopy!==!1?s.jsx(tb,{cell:i,table:g,children:s.jsx(Zi,Object.assign({},we))}):s.jsx(Zi,Object.assign({},we))};return s.jsx(Ts,Object.assign({"data-column-pinned":de||void 0,"data-dragging-column":me||void 0,"data-first-right-pinned":de==="right"&&ie.getIsFirstColumn(de)||void 0,"data-hovered-column-target":le||void 0,"data-index":d,"data-last-left-pinned":de==="left"&&ie.getIsLastColumn(de)||void 0,"data-last-row":c===l-1||void 0,"data-resizing":x==="onChange"&&(B==null?void 0:B.isResizingColumn)===ie.id&&v||void 0},P,{__vars:Object.assign({"--mrt-cell-align":(t=P.align)!==null&&t!==void 0?t:p.dir==="rtl"?"right":"left","--mrt-table-cell-left":de==="left"?`${ie.getStart(de)}`:void 0,"--mrt-table-cell-right":de==="right"?`${ie.getAfter(de)}`:void 0},P.__vars),className:Ce(en.root,(T==null?void 0:T.startsWith("grid"))&&en["root-grid"],h&&en["root-virtualized"],Y&&w==="cell"&&en["root-cursor-pointer"],Y&&["cell","table"].includes(w??"")&&ne!=="display"&&en["root-editable-hover"],ne==="data"&&en["root-data-col"],D==="xs"&&en["root-nowrap"],oe.enableCellHoverReveal&&en["root-cell-hover-reveal"],P==null?void 0:P.className),onDoubleClick:ve,onDragEnter:Se,onMouseEnter:Fe,onMouseLeave:pe,style:_e=>Object.assign(Object.assign({},W),fe(P.style,_e)),children:s.jsx(s.Fragment,{children:(o=P.children)!==null&&o!==void 0?o:oe.enableCellHoverReveal?s.jsxs("div",{className:Ce(oe.enableCellHoverReveal&&!(se||A)&&en["cell-hover-reveal"],G&&en.overflowing),ref:U,children:[Z(),i.getIsGrouped()&&!oe.GroupedCell&&s.jsxs(s.Fragment,{children:[" (",(a=X.subRows)===null||a===void 0?void 0:a.length,")"]})]}):s.jsxs(s.Fragment,{children:[Z(),i.getIsGrouped()&&!oe.GroupedCell&&s.jsxs(s.Fragment,{children:[" (",(r=X.subRows)===null||r===void 0?void 0:r.length,")"]})]})})}))},nb=b.memo(Jc,(e,n)=>n.cell===e.cell);var _n={root:"MRT_TableDetailPanel-module_root__vQAlM","root-grid":"MRT_TableDetailPanel-module_root-grid__7UMC6","root-virtual-row":"MRT_TableDetailPanel-module_root-virtual-row__r-X4Z",inner:"MRT_TableDetailPanel-module_inner__o-Fk-","inner-grid":"MRT_TableDetailPanel-module_inner-grid__WLZgF","inner-expanded":"MRT_TableDetailPanel-module_inner-expanded__6tg9T","inner-virtual":"MRT_TableDetailPanel-module_inner-virtual__TItRy"};const sb=e=>{var n,t,{parentRowRef:o,renderedRowIndex:a=0,row:r,rowVirtualizer:i,striped:l,table:d,virtualRow:c}=e,u=Ie(e,["parentRowRef","renderedRowIndex","row","rowVirtualizer","striped","table","virtualRow"]);const{getState:g,getVisibleLeafColumns:h,options:{layoutMode:m,mantineDetailPanelProps:p,mantineTableBodyRowProps:f,renderDetailPanel:v}}=d,{isLoading:x}=g(),y=fe(f,{isDetailPanel:!0,row:r,table:d}),w=Object.assign(Object.assign({},fe(p,{row:r,table:d})),u),C=r.getAllCells().filter(S=>S.column.columnDef.columnDefType==="data").map(S=>s.jsx(Wo,{cell:S,table:d},S.id)),j=!x&&r.getIsExpanded()&&(v==null?void 0:v({internalEditComponents:C,row:r,table:d}));return s.jsx(sn,Object.assign({"data-index":v?a*2+1:a,"data-striped":l,ref:S=>{var R;S&&((R=i==null?void 0:i.measureElement)===null||R===void 0||R.call(i,S))}},y,{__vars:Object.assign({"--mrt-parent-row-height":c?`${(t=(n=o.current)===null||n===void 0?void 0:n.getBoundingClientRect())===null||t===void 0?void 0:t.height}px`:void 0,"--mrt-virtual-row-start":c?`${c.start}px`:void 0},y==null?void 0:y.__vars),className:Ce("mantine-Table-tr-detail-panel",_n.root,(m==null?void 0:m.startsWith("grid"))&&_n["root-grid"],c&&_n["root-virtual-row"],y==null?void 0:y.className),children:s.jsx(Ts,Object.assign({colSpan:h().length,component:"td"},w,{__vars:{"--mrt-inner-width":`${d.getTotalSize()}px`},className:Ce("mantine-Table-td-detail-panel",_n.inner,(m==null?void 0:m.startsWith("grid"))&&_n["inner-grid"],r.getIsExpanded()&&_n["inner-expanded"],c&&_n["inner-virtual"]),p:r.getIsExpanded()&&j?"md":0,children:i?r.getIsExpanded()&&j:s.jsx(ts,{in:r.getIsExpanded(),children:j})}))}))},ob=(e,n,t)=>{let o=0;return e.columnFiltersMeta[t]&&(o=Ev(e.columnFiltersMeta[t],n.columnFiltersMeta[t])),o===0?Nn.alphanumeric(e,n,t):o},ab=Object.assign(Object.assign({},Nn),{fuzzy:ob}),rb=(e,n)=>Math.max(...Object.values(n.columnFiltersMeta).map(t=>t.rank))-Math.max(...Object.values(e.columnFiltersMeta).map(t=>t.rank)),ed=(e,n)=>{const{getCenterRows:t,getPrePaginationRowModel:o,getRowModel:a,getState:r,getTopRows:i,options:{createDisplayMode:l,enablePagination:d,enableRowPinning:c,manualPagination:u,positionCreatingRow:g,rowPinningDisplayMode:h}}=e,{creatingRow:m,pagination:p}=r(),f=ib(e);let v=[];if(!f)v=!c||h!=null&&h.includes("sticky")?n?o().rows:a().rows:t();else{if(v=o().rows.sort((x,y)=>rb(x,y)),d&&!u&&!n){const x=p.pageIndex*p.pageSize;v=v.slice(x,x+p.pageSize)}c&&!(h!=null&&h.includes("sticky"))&&(v=v.filter(x=>!x.getIsPinned()))}if(c&&(h!=null&&h.includes("sticky"))){const x=v.filter(y=>y.getIsPinned()).map(y=>y.id);v=[...i().filter(y=>!x.includes(y.id)),...v]}if(g!==void 0&&m&&l==="row"){const x=isNaN(+g)?g==="top"?0:v.length:+g;v=[...v.slice(0,x),m,...v.slice(x)]}return v},td=e=>{const{getState:n,options:{enableGlobalFilterRankedResults:t,manualExpanding:o,manualFiltering:a,manualGrouping:r,manualSorting:i}}=e,{expanded:l,globalFilterFn:d}=n();return!o&&!a&&!r&&!i&&t&&d==="fuzzy"&&l!==!0&&!Object.values(l).some(Boolean)},ib=e=>{const{globalFilter:n,sorting:t}=e.getState();return td(e)&&n&&!Object.values(t).some(Boolean)},no=({row:e,table:n})=>{const{options:{enableRowSelection:t}}=n;return e.getIsSelected()||fe(t,e)&&e.getCanSelectSubRows()&&e.getIsAllSubRowsSelected()},lb=({renderedRowIndex:e=0,row:n,table:t})=>(o,a)=>{var r;const{getState:i,options:{enableBatchRowSelection:l,enableMultiRowSelection:d,enableRowPinning:c,manualPagination:u,rowPinningDisplayMode:g},refs:{lastSelectedRowId:h}}=t,{pagination:{pageIndex:m,pageSize:p}}=i(),f=u?0:p*m,v=no({row:n,table:t});n.toggleSelected(a??!v);const x=new Set([n.id]);if(l&&d&&o.nativeEvent.shiftKey&&h.current!==null){const y=ed(t,!0),w=y.findIndex(C=>C.id===h.current);if(w!==-1){const C=no({row:y==null?void 0:y[w],table:t}),j=e+f,[S,R]=w<j?[w,j]:[j,w];if(v!==C)for(let _=S;_<=R;_++)y[_].toggleSelected(!v),x.add(y[_].id)}}h.current=n.id,n.getCanSelectSubRows()&&n.getIsAllSubRowsSelected()&&((r=n.subRows)===null||r===void 0||r.forEach(y=>y.toggleSelected(!1))),c&&(g!=null&&g.includes("select"))&&x.forEach(y=>{t.getRow(y).pin(v?!1:g!=null&&g.includes("bottom")?"bottom":"top")})},nd=({table:e})=>(n,t,o)=>{const{options:{enableRowPinning:a,rowPinningDisplayMode:r,selectAllMode:i},refs:{lastSelectedRowId:l}}=e;i==="all"||o?e.toggleAllRowsSelected(t??n.target.checked):e.toggleAllPageRowsSelected(t??n.target.checked),a&&(r!=null&&r.includes("select"))&&e.setRowPinning({bottom:[],top:[]}),l.current=null},vs=e=>{var n,t,o,{children:a,columnVirtualizer:r,numRows:i,pinnedRowIds:l,renderedRowIndex:d=0,row:c,rowVirtualizer:u,table:g,tableProps:h,virtualRow:m}=e,p=Ie(e,["children","columnVirtualizer","numRows","pinnedRowIds","renderedRowIndex","row","rowVirtualizer","table","tableProps","virtualRow"]);const{getState:f,options:{enableRowOrdering:v,enableRowPinning:x,enableStickyFooter:y,enableStickyHeader:w,layoutMode:C,mantineTableBodyRowProps:j,memoMode:S,renderDetailPanel:R,rowPinningDisplayMode:_},refs:{tableFooterRef:T,tableHeadRef:k},setHoveredRow:I}=g,{density:E,draggingColumn:V,draggingRow:L,editingCell:B,editingRow:M,hoveredRow:D,isFullScreen:O,rowPinning:F}=f(),$=c.getVisibleCells(),{virtualColumns:z,virtualPaddingLeft:H,virtualPaddingRight:re}=r??{},ie=no({row:c,table:g}),X=x&&c.getIsPinned(),oe=X&&(_==null?void 0:_.includes("sticky"))&&"sticky",ne=(L==null?void 0:L.id)===c.id,J=(D==null?void 0:D.id)===c.id,P=Object.assign(Object.assign({},fe(j,{renderedRowIndex:d,row:c,table:g})),p),[Q,ce]=b.useMemo(()=>!x||!oe||!l||!c.getIsPinned()?[]:[[...l].reverse().indexOf(c.id),l.indexOf(c.id)],[l,F]),te=(w||O)&&((n=k.current)===null||n===void 0?void 0:n.clientHeight)||0,W=y&&((t=T.current)===null||t===void 0?void 0:t.clientHeight)||0,me=parseInt((o=P==null?void 0:P.style)===null||o===void 0?void 0:o.height,10)||(E==="xs"?37:E==="md"?53:69),le=A=>{v&&L&&I(c)},de=b.useRef(null);let Y=h.striped;return Y&&(Y===!0&&(Y="odd"),Y==="odd"&&d%2!==0&&(Y=!1),Y==="even"&&d%2===0&&(Y=!1)),s.jsxs(s.Fragment,{children:[s.jsxs(sn,Object.assign({"data-dragging-row":ne||void 0,"data-hovered-row-target":J||void 0,"data-index":R?d*2:d,"data-row-pinned":oe||X||void 0,"data-selected":ie||void 0,"data-striped":Y,onDragEnter:le,ref:A=>{A&&(de.current=A,u==null||u.measureElement(A))}},P,{__vars:Object.assign(Object.assign({},P==null?void 0:P.__vars),{"--mrt-pinned-row-bottom":!m&&Q!==void 0&&X?`${Q*me+(y?W-1:0)}`:void 0,"--mrt-pinned-row-top":m?void 0:ce!==void 0&&X?`${ce*me+(w||O?te-1:0)}`:void 0,"--mrt-virtual-row-start":m?`${m.start}`:void 0}),className:Ce(ga.root,(C==null?void 0:C.startsWith("grid"))&&ga["root-grid"],m&&ga["root-virtualized"],P==null?void 0:P.className),children:[H?s.jsx(K,{component:"td",display:"flex",w:H}):null,a||(z??c.getVisibleCells()).map((A,se)=>{let be=A;r&&(se=A.index,be=$[se]);const ve={cell:be,numRows:i,renderedColumnIndex:se,renderedRowIndex:d,rowRef:de,table:g,virtualCell:r?A:void 0};return S==="cells"&&be.column.columnDef.columnDefType==="data"&&!V&&!L&&(B==null?void 0:B.id)!==be.id&&(M==null?void 0:M.id)!==c.id?s.jsx(nb,Object.assign({},ve),be.id):s.jsx(Jc,Object.assign({},ve),be.id)}),re?s.jsx(K,{component:"td",display:"flex",w:re}):null]})),R&&!c.getIsGrouped()&&s.jsx(sb,{parentRowRef:de,renderedRowIndex:d,row:c,rowVirtualizer:u,striped:Y,table:g,virtualRow:m})]})},ha=b.memo(vs,(e,n)=>e.row===n.row);var us={root:"MRT_ExpandButton-module_root__IFYio","root-ltr":"MRT_ExpandButton-module_root-ltr__FHNnp",chevron:"MRT_ExpandButton-module_chevron__XzC5P",right:"MRT_ExpandButton-module_right__-pC-A",up:"MRT_ExpandButton-module_up__TZGBo","root-rtl":"MRT_ExpandButton-module_root-rtl__zoudS"};const Ba=e=>{var n,t,{row:o,table:a}=e,r=Ie(e,["row","table"]);const i=On(),{options:{icons:{IconChevronDown:l},localization:d,mantineExpandButtonProps:c,positionExpandColumn:u,renderDetailPanel:g}}=a,h=Object.assign(Object.assign({},fe(c,{row:o,table:a})),r),m=o.getAllCells().filter(w=>w.column.columnDef.columnDefType==="data").map(w=>s.jsx(Wo,{cell:w,table:a},w.id)),p=o.getCanExpand(),f=o.getIsExpanded(),v=!!(g!=null&&g({internalEditComponents:m,row:o,table:a})),x=w=>{var C;w.stopPropagation(),o.toggleExpanded(),(C=h==null?void 0:h.onClick)===null||C===void 0||C.call(h,w)},y=i.dir==="rtl"||u==="last";return s.jsx(We,{disabled:!p&&!v,label:(n=h==null?void 0:h.title)!==null&&n!==void 0?n:f?d.collapse:d.expand,openDelay:1e3,withinPortal:!0,children:s.jsx(Oe,Object.assign({"aria-label":d.expand,color:"gray",disabled:!p&&!v,variant:"subtle"},h,{__vars:{"--mrt-row-depth":`${o.depth}`},className:Ce("mrt-expand-button",us.root,us[`root-${y?"rtl":"ltr"}`],h==null?void 0:h.className),onClick:x,title:void 0,children:(t=h==null?void 0:h.children)!==null&&t!==void 0?t:s.jsx(l,{className:Ce("mrt-expand-button-chevron",us.chevron,!p&&!g?us.right:f?us.up:void 0)})}))})},cb=e=>{var n,t,{table:o,tableProps:a}=e,r=Ie(e,["table","tableProps"]);const{getState:i,options:{layoutMode:l,localization:d,renderDetailPanel:c,renderEmptyRowsFallback:u},refs:{tablePaperRef:g}}=o,{columnFilters:h,globalFilter:m}=i(),p=b.useMemo(()=>rs(o,"mrt-row-empty",{},0,0),[]),f=Object.assign(Object.assign({},r),{renderedRowIndex:0,row:p,virtualRow:void 0});return s.jsxs(vs,Object.assign({className:Ce("mrt-table-body-row",(l==null?void 0:l.startsWith("grid"))&&It["empty-row-tr-grid"]),table:o,tableProps:a},f,{children:[c&&s.jsx(Ts,{className:Ce("mrt-table-body-cell",(l==null?void 0:l.startsWith("grid"))&&It["empty-row-td-grid"]),colSpan:1,children:s.jsx(Ba,{row:p,table:o})}),s.jsx("td",{className:Ce("mrt-table-body-cell",(l==null?void 0:l.startsWith("grid"))&&It["empty-row-td-grid"]),colSpan:o.getVisibleLeafColumns().length,children:(n=u==null?void 0:u({table:o}))!==null&&n!==void 0?n:s.jsx(ue,{__vars:{"--mrt-paper-width":`${(t=g.current)===null||t===void 0?void 0:t.clientWidth}`},className:Ce(It["empty-row-td-content"]),children:m||h.length?d.noResultsFound:d.noRecordsToDisplay})})]}))},db=e=>{const{getRowModel:n,getState:t,options:{data:o,enableGlobalFilterRankedResults:a,positionCreatingRow:r}}=e,{creatingRow:i,expanded:l,globalFilter:d,pagination:c,rowPinning:u,sorting:g}=t();return b.useMemo(()=>ed(e),[i,o,a,l,n().rows,d,c.pageIndex,c.pageSize,r,u,g])},sd=(e,n)=>{const t=Fc(e);return n===void 0||(n>=0&&n<Math.max(e.startIndex-e.overscan,0)&&t.unshift(n),n>=0&&n>e.endIndex+e.overscan&&t.push(n)),t},ub=(e,n)=>{var t;const{getRowModel:o,getState:a,options:{enableRowVirtualization:r,renderDetailPanel:i,rowVirtualizerInstanceRef:l,rowVirtualizerOptions:d},refs:{tableContainerRef:c}}=e,{density:u,draggingRow:g,expanded:h}=a();if(!r)return;const m=fe(d,{table:e}),p=(t=n==null?void 0:n.length)!==null&&t!==void 0?t:o().rows.length,f=u==="xs"?42.7:u==="md"?54.7:70.7,v=Oc(Object.assign({count:i?p*2:p,estimateSize:x=>i&&x%2===1?h===!0?100:0:f,getScrollElement:()=>c.current,measureElement:typeof window<"u"&&navigator.userAgent.indexOf("Firefox")===-1?x=>x==null?void 0:x.getBoundingClientRect().height:void 0,overscan:4,rangeExtractor:b.useCallback(x=>{var y;return sd(x,(y=g==null?void 0:g.index)!==null&&y!==void 0?y:0)},[g])},m));return v.virtualRows=v.getVirtualItems(),l&&(l.current=v),v},od=e=>{var n,t,o,{columnVirtualizer:a,table:r,tableProps:i}=e,l=Ie(e,["columnVirtualizer","table","tableProps"]);const{getBottomRows:d,getIsSomeRowsPinned:c,getRowModel:u,getState:g,getTopRows:h,options:{enableStickyFooter:m,enableStickyHeader:p,layoutMode:f,mantineTableBodyProps:v,memoMode:x,renderDetailPanel:y,rowPinningDisplayMode:w},refs:{tableFooterRef:C,tableHeadRef:j}}=r,{isFullScreen:S,rowPinning:R}=g(),_=Object.assign(Object.assign({},fe(v,{table:r})),l),T=(p||S)&&((n=j.current)===null||n===void 0?void 0:n.clientHeight)||0,k=m&&((t=C.current)===null||t===void 0?void 0:t.clientHeight)||0,I=b.useMemo(()=>{var M,D;return!(!((M=R.bottom)===null||M===void 0)&&M.length)&&!(!((D=R.top)===null||D===void 0)&&D.length)?[]:u().rows.filter(O=>O.getIsPinned()).map(O=>O.id)},[R,u().rows]),E=db(r),V=ub(r,E),{virtualRows:L}=V??{},B={columnVirtualizer:a,numRows:E.length,table:r,tableProps:i};return s.jsxs(s.Fragment,{children:[!(w!=null&&w.includes("sticky"))&&c("top")&&s.jsx(hs,Object.assign({},_,{__vars:Object.assign({"--mrt-table-head-height":`${T}`},_==null?void 0:_.__vars),className:Ce(It.pinned,(f==null?void 0:f.startsWith("grid"))&&It["root-grid"],_==null?void 0:_.className),children:h().map((M,D)=>{const O=Object.assign(Object.assign({},B),{renderedRowIndex:D,row:M});return x==="rows"?s.jsx(ha,Object.assign({},O),M.id):s.jsx(vs,Object.assign({},O),M.id)})})),s.jsx(hs,Object.assign({},_,{__vars:Object.assign({"--mrt-table-body-height":V?`${V.getTotalSize()}px`:void 0},_==null?void 0:_.__vars),className:Ce(It.root,(f==null?void 0:f.startsWith("grid"))&&It["root-grid"],!E.length&&It["root-no-rows"],V&&It["root-virtualized"],_==null?void 0:_.className),children:(o=_==null?void 0:_.children)!==null&&o!==void 0?o:E.length?s.jsx(s.Fragment,{children:(L??E).map((M,D)=>{if(V)if(y){if(M.index%2===1)return null;D=M.index/2}else D=M.index;const O=V?E[D]:M,F=Object.assign(Object.assign({},B),{pinnedRowIds:I,renderedRowIndex:D,row:O,rowVirtualizer:V,virtualRow:V?M:void 0}),$=`${O.id}-${O.index}`;return x==="rows"?s.jsx(ha,Object.assign({},F),$):s.jsx(vs,Object.assign({},F),$)})}):s.jsx(cb,Object.assign({},B))})),!(w!=null&&w.includes("sticky"))&&c("bottom")&&s.jsx(hs,Object.assign({},_,{__vars:Object.assign({"--mrt-table-footer-height":`${k}`},_==null?void 0:_.__vars),className:Ce(It.pinned,(f==null?void 0:f.startsWith("grid"))&&It["root-grid"],_==null?void 0:_.className),children:d().map((M,D)=>{const O=Object.assign(Object.assign({},B),{renderedRowIndex:D,row:M});return x==="rows"?s.jsx(ha,Object.assign({},O),M.id):s.jsx(vs,Object.assign({},O),M.id)})}))]})},gb=b.memo(od,(e,n)=>e.table.options.data===n.table.options.data);var mb={"grab-icon":"MRT_GrabHandleButton-module_grab-icon__mQimy"};const ei=({actionIconProps:e,onDragEnd:n,onDragStart:t,table:{options:{icons:{IconGripHorizontal:o},localization:{move:a}}}})=>{var r,i;return s.jsx(We,{label:(r=e==null?void 0:e.title)!==null&&r!==void 0?r:a,openDelay:1e3,withinPortal:!0,children:s.jsx(Oe,Object.assign({"aria-label":(i=e==null?void 0:e.title)!==null&&i!==void 0?i:a,draggable:!0},e,{className:Ce("mrt-grab-handle-button",mb["grab-icon"],e==null?void 0:e.className),color:"gray",onClick:l=>{var d;l.stopPropagation(),(d=e==null?void 0:e.onClick)===null||d===void 0||d.call(e,l)},onDragEnd:n,onDragStart:t,size:"sm",title:void 0,variant:"transparent",children:s.jsx(o,{size:"100%"})}))})},hb=e=>{var{row:n,rowRef:t,table:o}=e,a=Ie(e,["row","rowRef","table"]);const{options:{mantineRowDragHandleProps:r}}=o,i=Object.assign(Object.assign({},fe(r,{row:n,table:o})),a),l=c=>{var u;(u=i==null?void 0:i.onDragStart)===null||u===void 0||u.call(i,c),c.dataTransfer.setDragImage(t.current,0,0),o.setDraggingRow(n)},d=c=>{var u;(u=i==null?void 0:i.onDragEnd)===null||u===void 0||u.call(i,c),o.setDraggingRow(null),o.setHoveredRow(null)};return s.jsx(ei,{actionIconProps:i,onDragEnd:d,onDragStart:l,table:o})},pa=e=>{var{pinningPosition:n,row:t,table:o}=e,a=Ie(e,["pinningPosition","row","table"]);const{options:{icons:{IconPinned:r,IconX:i},localization:l,rowPinningDisplayMode:d}}=o,c=t.getIsPinned(),[u,g]=b.useState(!1),h=m=>{g(!1),m.stopPropagation(),t.pin(c?!1:n)};return s.jsx(We,{label:c?l.unpin:l.pin,openDelay:1e3,opened:u,children:s.jsx(Oe,Object.assign({"aria-label":l.pin,color:"gray",onClick:h,onMouseEnter:()=>g(!0),onMouseLeave:()=>g(!1),size:"xs",style:{height:"24px",width:"24px"},variant:"subtle"},a,{children:c?s.jsx(i,{}):s.jsx(r,{fontSize:"small",style:{transform:`rotate(${d==="sticky"?135:n==="top"?180:0}deg)`}})}))})},pb=e=>{var{row:n,table:t}=e,o=Ie(e,["row","table"]);const{getState:a,options:{enableRowPinning:r,rowPinningDisplayMode:i}}=t,{density:l}=a();if(!fe(r,n))return null;const c=Object.assign({row:n,table:t},o);return i==="top-and-bottom"&&!n.getIsPinned()?s.jsxs(K,{style:{display:"flex",flexDirection:l==="xs"?"row":"column"},children:[s.jsx(pa,Object.assign({pinningPosition:"top"},c)),s.jsx(pa,Object.assign({pinningPosition:"bottom"},c))]}):s.jsx(pa,Object.assign({pinningPosition:i==="bottom"?"bottom":"top"},c))};var fa={root:"MRT_ColumnPinningButtons-module_root__scTtW",left:"MRT_ColumnPinningButtons-module_left__W6Aog",right:"MRT_ColumnPinningButtons-module_right__7AJE3"};const fb=({column:e,table:n})=>{const{options:{icons:{IconPinned:t,IconPinnedOff:o},localization:a}}=n;return s.jsx(tt,{className:Ce("mrt-column-pinning-buttons",fa.root),children:e.getIsPinned()?s.jsx(We,{label:a.unpin,withinPortal:!0,children:s.jsx(Oe,{color:"gray",onClick:()=>e.pin(!1),size:"md",variant:"subtle",children:s.jsx(o,{})})}):s.jsxs(s.Fragment,{children:[s.jsx(We,{label:a.pinToLeft,withinPortal:!0,children:s.jsx(Oe,{color:"gray",onClick:()=>e.pin("left"),size:"md",variant:"subtle",children:s.jsx(t,{className:fa.left})})}),s.jsx(We,{label:a.pinToRight,withinPortal:!0,children:s.jsx(Oe,{color:"gray",onClick:()=>e.pin("right"),size:"md",variant:"subtle",children:s.jsx(t,{className:fa.right})})})]})})};var vb={root:"MRT_EditActionButtons-module_root__BfxVZ"};const ad=e=>{var{row:n,table:t,variant:o="icon"}=e,a=Ie(e,["row","table","variant"]);const{getState:r,options:{icons:{IconCircleX:i,IconDeviceFloppy:l},localization:d,onCreatingRowCancel:c,onCreatingRowSave:u,onEditingRowCancel:g,onEditingRowSave:h},refs:{editInputRefs:m},setCreatingRow:p,setEditingRow:f}=t,{creatingRow:v,editingRow:x,isSaving:y}=r(),w=(v==null?void 0:v.id)===n.id,C=(x==null?void 0:x.id)===n.id,j=()=>{w?(c==null||c({row:n,table:t}),p(null)):C&&(g==null||g({row:n,table:t}),f(null)),n._valuesCache={}},S=()=>{var R;(R=Object.values(m==null?void 0:m.current).filter(_=>{var T,k;return n.id===((k=(T=_==null?void 0:_.name)===null||T===void 0?void 0:T.split("_"))===null||k===void 0?void 0:k[0])}))===null||R===void 0||R.forEach(_=>{_.value!==void 0&&Object.hasOwn(n==null?void 0:n._valuesCache,_.name)&&(n._valuesCache[_.name]=_.value)}),w?u==null||u({exitCreatingMode:()=>p(null),row:n,table:t,values:n._valuesCache}):C&&(h==null||h({exitEditingMode:()=>f(null),row:n,table:t,values:n==null?void 0:n._valuesCache}))};return s.jsx(K,Object.assign({className:Ce("mrt-edit-action-buttons",vb.root),onClick:R=>R.stopPropagation()},a,{children:o==="icon"?s.jsxs(s.Fragment,{children:[s.jsx(We,{label:d.cancel,withinPortal:!0,children:s.jsx(Oe,{"aria-label":d.cancel,color:"red",onClick:j,variant:"subtle",children:s.jsx(i,{})})}),s.jsx(We,{label:d.save,withinPortal:!0,children:s.jsx(Oe,{"aria-label":d.save,color:"blue",loading:y,onClick:S,variant:"subtle",children:s.jsx(l,{})})})]}):s.jsxs(s.Fragment,{children:[s.jsx(pt,{onClick:j,variant:"subtle",children:d.cancel}),s.jsx(pt,{loading:y,onClick:S,variant:"filled",children:d.save})]})}))};var $s={root:"MRT_ExpandAllButton-module_root__gkBZD",chevron:"MRT_ExpandAllButton-module_chevron__Iep0j",up:"MRT_ExpandAllButton-module_up__Xth3U",right:"MRT_ExpandAllButton-module_right__bS4L-"};const xb=e=>{var n,t,{table:o}=e,a=Ie(e,["table"]);const{getCanSomeRowsExpand:r,getIsAllRowsExpanded:i,getIsSomeRowsExpanded:l,getState:d,options:{icons:{IconChevronsDown:c},localization:u,mantineExpandAllButtonProps:g,renderDetailPanel:h},toggleAllRowsExpanded:m}=o,{density:p,isLoading:f}=d(),v=Object.assign(Object.assign({},fe(g,{table:o})),a),x=i();return s.jsx(We,{label:((n=v==null?void 0:v.title)!==null&&n!==void 0?n:x)?u.collapseAll:u.expandAll,openDelay:1e3,withinPortal:!0,children:s.jsx(Oe,Object.assign({"aria-label":u.expandAll,color:"gray",variant:"subtle"},v,{className:Ce("mrt-expand-all-button",$s.root,v==null?void 0:v.className,p),disabled:f||!h&&!r(),onClick:()=>m(!x),title:void 0,children:(t=v==null?void 0:v.children)!==null&&t!==void 0?t:s.jsx(c,{className:Ce($s.chevron,x?$s.up:l()?$s.right:void 0)})}))})};var Ji={root:"MRT_ShowHideColumnsMenu-module_root__2UWak",content:"MRT_ShowHideColumnsMenu-module_content__ehkWQ"},Un={root:"MRT_ShowHideColumnsMenuItems-module_root__wYgv-",menu:"MRT_ShowHideColumnsMenuItems-module_menu__CeATR",grab:"MRT_ShowHideColumnsMenuItems-module_grab__a-d-y",pin:"MRT_ShowHideColumnsMenuItems-module_pin__P437b",switch:"MRT_ShowHideColumnsMenuItems-module_switch__tMsdt",header:"MRT_ShowHideColumnsMenuItems-module_header__xVkKb"};const qn=e=>{var n,t,o,a;return(a=(n=e.id)!==null&&n!==void 0?n:(o=(t=e.accessorKey)===null||t===void 0?void 0:t.toString)===null||o===void 0?void 0:o.call(t))!==null&&a!==void 0?a:e.header},so=e=>{const n=[],t=o=>{o.forEach(a=>{a.columns?t(a.columns):n.push(a)})};return t(e),n},rd=({columnDefs:e,tableOptions:n})=>{const{aggregationFns:t={},defaultDisplayColumn:o,filterFns:a={},sortingFns:r={},state:{columnFilterFns:i={}}={}}=n;return e.map(l=>{var d,c;if(l.id||(l.id=qn(l)),l.columnDefType||(l.columnDefType="data"),!((d=l.columns)===null||d===void 0)&&d.length)l.columnDefType="group",l.columns=rd({columnDefs:l.columns,tableOptions:n});else if(l.columnDefType==="data"){if(Array.isArray(l.aggregationFn)){const u=l.aggregationFn;l.aggregationFn=(g,h,m)=>u.map(p=>{var f;return(f=t[p])===null||f===void 0?void 0:f.call(t,g,h,m)})}Object.keys(a).includes(i[l.id])&&(l.filterFn=(c=a[i[l.id]])!==null&&c!==void 0?c:a.fuzzy,l._filterFn=i[l.id]),Object.keys(r).includes(l.sortingFn)&&(l.sortingFn=r[l.sortingFn])}else l.columnDefType==="display"&&(l=Object.assign(Object.assign({},o),l));return l})},id=(e,n,t)=>{e.getCanPin()&&e.pin(n.getIsPinned());const o=[...t];return o.splice(o.indexOf(n.id),0,o.splice(o.indexOf(e.id),1)[0]),o},bb=e=>{const{filterVariant:n}=e;return n==="multi-select"?"arrIncludesSome":n!=null&&n.includes("range")?"betweenInclusive":["checkbox","date","select"].includes(n||"")?"equals":"fuzzy"},ld=({allColumns:e,column:n,hoveredColumn:t,setHoveredColumn:o,table:a})=>{var r;const i=Fn(),{getState:l,options:{enableColumnOrdering:d,enableColumnPinning:c,enableHiding:u,localization:g},setColumnOrder:h}=a,{columnOrder:m}=l(),{columnDef:p}=n,{columnDefType:f}=p,v=f!=="group"&&n.getIsVisible()||f==="group"&&n.getLeafColumns().some(_=>_.getIsVisible()),x=_=>{var T,k;f==="group"?(k=(T=_==null?void 0:_.columns)===null||T===void 0?void 0:T.forEach)===null||k===void 0||k.call(T,I=>{I.toggleVisibility(!v)}):_.toggleVisibility()},y=b.useRef(null),[w,C]=b.useState(!1),j=_=>{C(!0),_.dataTransfer.setDragImage(y.current,0,0)},S=_=>{C(!1),o(null),t&&h(id(n,t,m))},R=_=>{!w&&p.enableColumnOrdering!==!1&&o(n)};return!p.header||p.visibleInShowHideMenu===!1?null:s.jsxs(s.Fragment,{children:[s.jsx(Te.Item,Object.assign({className:Un.root,component:"span",onDragEnter:R,ref:y,style:{"--_column-depth":`${(n.depth+.5)*2}rem`,"--_hover-color":Jx(i)}},to("dragging",w),to("order-hovered",(t==null?void 0:t.id)===n.id),{children:s.jsxs(K,{className:Un.menu,children:[f!=="group"&&d&&!e.some(_=>_.columnDef.columnDefType==="group")&&(p.enableColumnOrdering!==!1?s.jsx(ei,{onDragEnd:S,onDragStart:j,table:a}):s.jsx(K,{className:Un.grab})),c&&(n.getCanPin()?s.jsx(fb,{column:n,table:a}):s.jsx(K,{className:Un.pin})),u?s.jsx(We,{label:g.toggleVisibility,openDelay:1e3,withinPortal:!0,children:s.jsx(_l,{checked:v,className:Un.switch,disabled:!n.getCanHide(),label:p.header,onChange:()=>x(n)})}):s.jsx(ue,{className:Un.header,children:p.header})]})})),(r=n.columns)===null||r===void 0?void 0:r.map((_,T)=>s.jsx(ld,{allColumns:e,column:_,hoveredColumn:t,setHoveredColumn:o,table:a},`${T}-${_.id}`))]})};function Ln({header:e,id:n,size:t,tableOptions:o}){const{defaultDisplayColumn:a,displayColumnDefOptions:r,localization:i}=o;return Object.assign(Object.assign(Object.assign(Object.assign({},a),{header:e?i[e]:"",size:t}),r==null?void 0:r[n]),{id:n})}const cd=e=>{const{enableRowPinning:n,rowPinningDisplayMode:t}=e;return!!(n&&!(t!=null&&t.startsWith("select")))},dd=e=>{const{enableRowDragging:n,enableRowOrdering:t}=e;return!!(n||t)},ti=e=>{const{enableExpanding:n,enableGrouping:t,renderDetailPanel:o,state:{grouping:a}}=e;return!!(n||t&&(a!=null&&a.length)||o)},ni=e=>{const{createDisplayMode:n,editDisplayMode:t,enableEditing:o,enableRowActions:a,state:{creatingRow:r}}=e;return!!(a||r&&n==="row"||o&&["modal","row"].includes(t??""))},ud=e=>!!e.enableRowSelection,gd=e=>!!e.enableRowNumbers,md=e=>e.layoutMode==="grid-no-grow",yb=e=>[cd(e)&&"mrt-row-pin",dd(e)&&"mrt-row-drag",e.positionActionsColumn==="first"&&ni(e)&&"mrt-row-actions",e.positionExpandColumn==="first"&&ti(e)&&"mrt-row-expand",ud(e)&&"mrt-row-select",gd(e)&&"mrt-row-numbers"].filter(Boolean),wb=e=>[e.positionActionsColumn==="last"&&ni(e)&&"mrt-row-actions",e.positionExpandColumn==="last"&&ti(e)&&"mrt-row-expand",md(e)&&"mrt-row-spacer"].filter(Boolean),si=(e,n=!1)=>{const{state:{columnOrder:t=[]}}=e,o=yb(e),a=wb(e),r=so(e.columns).map(l=>qn(l));let i=n?r:Array.from(new Set([...t,...r]));return i=i.filter(l=>!o.includes(l)&&!a.includes(l)),[...o,...i,...a]},Cb=({table:e})=>{const{getAllColumns:n,getAllLeafColumns:t,getCenterLeafColumns:o,getIsAllColumnsVisible:a,getIsSomeColumnsPinned:r,getIsSomeColumnsVisible:i,getLeftLeafColumns:l,getRightLeafColumns:d,getState:c,options:{enableColumnOrdering:u,enableColumnPinning:g,enableHiding:h,localization:m}}=e,{columnOrder:p,columnPinning:f}=c(),v=C=>{t().filter(j=>j.columnDef.enableHiding!==!1).forEach(j=>j.toggleVisibility(C))},x=b.useMemo(()=>{const C=n();return p.length>0&&!C.some(j=>j.columnDef.columnDefType==="group")?[...l(),...Array.from(new Set(p)).map(j=>o().find(S=>(S==null?void 0:S.id)===j)),...d()].filter(Boolean):C},[p,f,n(),o(),l(),d()]),[y,w]=b.useState(null);return s.jsxs(Te.Dropdown,{className:Ce("mrt-show-hide-columns-menu",Ji.root),children:[s.jsxs(tt,{className:Ji.content,children:[h&&s.jsx(pt,{disabled:!i(),onClick:()=>v(!1),variant:"subtle",children:m.hideAll}),u&&s.jsx(pt,{onClick:()=>e.setColumnOrder(si(e.options,!0)),variant:"subtle",children:m.resetOrder}),g&&s.jsx(pt,{disabled:!r(),onClick:()=>e.resetColumnPinning(!0),variant:"subtle",children:m.unpinAll}),h&&s.jsx(pt,{disabled:a(),onClick:()=>v(!0),variant:"subtle",children:m.showAll})]}),s.jsx(Te.Divider,{}),x.map((C,j)=>s.jsx(ld,{allColumns:x,column:C,hoveredColumn:y,setHoveredColumn:w,table:e},`${j}-${C.id}`))]})},hd=e=>{var{table:n,title:t}=e,o=Ie(e,["table","title"]);const{icons:{IconColumns:a},localization:{showHideColumns:r}}=n.options;return s.jsxs(Te,{closeOnItemClick:!1,withinPortal:!0,children:[s.jsx(We,{label:t??r,withinPortal:!0,children:s.jsx(Te.Target,{children:s.jsx(Oe,Object.assign({"aria-label":t??r,color:"gray",size:"lg",variant:"subtle"},o,{children:s.jsx(a,{})}))})}),s.jsx(Cb,{table:n})]})},jb={md:"xs",xl:"md",xs:"xl"},pd=e=>{var{table:{getState:n,options:{icons:{IconBaselineDensityLarge:t,IconBaselineDensityMedium:o,IconBaselineDensitySmall:a},localization:{toggleDensity:r}},setDensity:i},title:l}=e,d=Ie(e,["table","title"]);const{density:c}=n();return s.jsx(We,{label:l??r,withinPortal:!0,children:s.jsx(Oe,Object.assign({"aria-label":l??r,color:"gray",onClick:()=>i(u=>jb[u]),size:"lg",variant:"subtle"},d,{children:c==="xs"?s.jsx(a,{}):c==="md"?s.jsx(o,{}):s.jsx(t,{})}))})},fd=e=>{var{table:{getState:n,options:{icons:{IconFilter:t,IconFilterOff:o},localization:{showHideFilters:a}},setShowColumnFilters:r},title:i}=e,l=Ie(e,["table","title"]);const{showColumnFilters:d}=n();return s.jsx(We,{label:i??a,withinPortal:!0,children:s.jsx(Oe,Object.assign({"aria-label":i??a,color:"gray",onClick:()=>r(c=>!c),size:"lg",variant:"subtle"},l,{children:d?s.jsx(o,{}):s.jsx(t,{})}))})},vd=e=>{var{table:{getState:n,options:{icons:{IconMaximize:t,IconMinimize:o},localization:{toggleFullScreen:a}},setIsFullScreen:r},title:i}=e,l=Ie(e,["table","title"]);const{isFullScreen:d}=n(),[c,u]=b.useState(!1),g=()=>{u(!1),r(h=>!h)};return s.jsx(We,{label:i??a,opened:c,withinPortal:!0,children:s.jsx(Oe,Object.assign({"aria-label":i??a,color:"gray",onClick:g,onMouseEnter:()=>u(!0),onMouseLeave:()=>u(!1),size:"lg",variant:"subtle"},l,{children:d?s.jsx(o,{}):s.jsx(t,{})}))})},xd=e=>{var{table:{getState:n,options:{icons:{IconSearch:t,IconSearchOff:o},localization:{showHideSearch:a}},refs:{searchInputRef:r},setShowGlobalFilter:i},title:l}=e,d=Ie(e,["table","title"]);const{globalFilter:c,showGlobalFilter:u}=n(),g=()=>{i(!u),setTimeout(()=>{var h;return(h=r.current)===null||h===void 0?void 0:h.focus()},100)};return s.jsx(We,{label:l??a,withinPortal:!0,children:s.jsx(Oe,Object.assign({"aria-label":l??a,color:"gray",disabled:!!c,onClick:g,size:"lg",variant:"subtle"},d,{children:u?s.jsx(o,{}):s.jsx(t,{})}))})},Sb=e=>{var{handleEdit:n,row:t,table:o}=e,a=Ie(e,["handleEdit","row","table"]);const{options:{editDisplayMode:r,enableEditing:i,icons:{IconDots:l,IconEdit:d},localization:c,positionActionsColumn:u,renderRowActionMenuItems:g}}=o;return s.jsxs(Te,{closeOnItemClick:!0,position:u==="first"?"bottom-start":u==="last"?"bottom-end":void 0,withinPortal:!0,children:[s.jsx(We,{label:c.rowActions,openDelay:1e3,withinPortal:!0,children:s.jsx(Te.Target,{children:s.jsx(Oe,Object.assign({"aria-label":c.rowActions,color:"gray",onClick:h=>h.stopPropagation(),size:"sm",variant:"subtle"},a,{children:s.jsx(l,{})}))})}),s.jsxs(Te.Dropdown,{onClick:h=>h.stopPropagation(),children:[i&&r!=="table"&&s.jsx(Te.Item,{leftSection:s.jsx(d,{}),onClick:n,children:c.edit}),g==null?void 0:g({row:t,table:o})]})]})},_b=({cell:e,row:n,table:t})=>{const{getState:o,options:{createDisplayMode:a,editDisplayMode:r,enableEditing:i,icons:{IconEdit:l},localization:{edit:d},renderRowActionMenuItems:c,renderRowActions:u},setEditingRow:g}=t,{creatingRow:h,editingRow:m}=o(),p=(h==null?void 0:h.id)===n.id,f=(m==null?void 0:m.id)===n.id,v=y=>{y.stopPropagation(),g(Object.assign({},n))},x=p&&a==="row"||f&&r==="row";return s.jsx(s.Fragment,{children:u&&!x?u({cell:e,row:n,table:t}):x?s.jsx(ad,{row:n,table:t}):!c&&fe(i,n)?s.jsx(We,{label:d,openDelay:1e3,position:"right",withinPortal:!0,children:s.jsx(Oe,{"aria-label":d,color:"gray",disabled:!!m&&m.id!==n.id,onClick:v,size:"md",variant:"subtle",children:s.jsx(l,{})})}):c?s.jsx(Sb,{handleEdit:v,row:n,table:t}):null})};var va={root:"MRT_TableFooter-module_root__-JXpw",grid:"MRT_TableFooter-module_grid__J3Ga-",sticky:"MRT_TableFooter-module_sticky__GcoK6"},el={root:"MRT_TableFooterRow-module_root__EuoPr","layout-mode-grid":"MRT_TableFooterRow-module_layout-mode-grid__dUEMF"},xa={root:"MRT_TableFooterCell-module_root__d8Scs",grid:"MRT_TableFooterCell-module_grid__H9jLk",group:"MRT_TableFooterCell-module_group__l3-p-"};const Mb=e=>{var n,t,o,a,r,{footer:i,renderedColumnIndex:l,table:d}=e,c=Ie(e,["footer","renderedColumnIndex","table"]);const u=On(),{options:{enableColumnPinning:g,layoutMode:h,mantineTableFooterCellProps:m}}=d,{column:p}=i,{columnDef:f}=p,{columnDefType:v}=f,x=g&&f.columnDefType!=="group"&&p.getIsPinned(),y={column:p,table:d},w=Object.assign(Object.assign(Object.assign({},fe(m,y)),fe(f.mantineTableFooterCellProps,y)),c),C={minWidth:`max(calc(var(--header-${Yt(i==null?void 0:i.id)}-size) * 1px), ${(n=f.minSize)!==null&&n!==void 0?n:30}px)`,width:`calc(var(--header-${Yt(i.id)}-size) * 1px)`};return h==="grid"?C.flex=`${[0,!1].includes(f.grow)?0:`var(--header-${Yt(i.id)}-size)`} 0 auto`:h==="grid-no-grow"&&(C.flex=`${+(f.grow||0)} 0 auto`),s.jsx(Xn,Object.assign({colSpan:i.colSpan,"data-column-pinned":x||void 0,"data-first-right-pinned":x==="right"&&p.getIsFirstColumn(x)||void 0,"data-index":l,"data-last-left-pinned":x==="left"&&p.getIsLastColumn(x)||void 0},w,{__vars:Object.assign({"--mrt-cell-align":(t=w.align)!==null&&t!==void 0?t:v==="group"?"center":u.dir==="rtl"?"right":"left","--mrt-table-cell-left":x==="left"?`${p.getStart(x)}`:void 0,"--mrt-table-cell-right":x==="right"?`${p.getAfter(x)}`:void 0},w==null?void 0:w.__vars),className:Ce(xa.root,(h==null?void 0:h.startsWith("grid"))&&xa.grid,v==="group"&&xa.group,w==null?void 0:w.className),style:j=>Object.assign(Object.assign({},C),fe(w.style,j)),children:(o=w.children)!==null&&o!==void 0?o:i.isPlaceholder?null:(r=(a=fe(f.Footer,{column:p,footer:i,table:d}))!==null&&a!==void 0?a:f.footer)!==null&&r!==void 0?r:null}))},Rb=e=>{var n,{columnVirtualizer:t,footerGroup:o,table:a}=e,r=Ie(e,["columnVirtualizer","footerGroup","table"]);const{options:{layoutMode:i,mantineTableFooterRowProps:l}}=a,{virtualColumns:d,virtualPaddingLeft:c,virtualPaddingRight:u}=t??{};if(!(!((n=o.headers)===null||n===void 0)&&n.some(h=>typeof h.column.columnDef.footer=="string"&&!!h.column.columnDef.footer||h.column.columnDef.Footer)))return null;const g=Object.assign(Object.assign({},fe(l,{footerGroup:o,table:a})),r);return s.jsxs(sn,Object.assign({className:Ce(el.root,(i==null?void 0:i.startsWith("grid"))&&el["layout-mode-grid"])},g,{children:[c?s.jsx(K,{component:"th",display:"flex",w:c}):null,(d??o.headers).map((h,m)=>{let p=h;return t&&(m=h.index,p=o.headers[m]),s.jsx(Mb,{footer:p,renderedColumnIndex:m,table:a},p.id)}),u?s.jsx(K,{component:"th",display:"flex",w:u}):null]}))},Nb=e=>{var{columnVirtualizer:n,table:t}=e,o=Ie(e,["columnVirtualizer","table"]);const{getFooterGroups:a,getState:r,options:{enableStickyFooter:i,layoutMode:l,mantineTableFooterProps:d},refs:{tableFooterRef:c}}=t,{isFullScreen:u}=r(),g=Object.assign(Object.assign({},fe(d,{table:t})),o),h=(u||i)&&i!==!1;return s.jsx($r,Object.assign({},g,{className:Ce(va.root,g==null?void 0:g.className,h&&va.sticky,(l==null?void 0:l.startsWith("grid"))&&va.grid),ref:m=>{c.current=m,g!=null&&g.ref&&(g.ref.current=m)},children:a().map(m=>s.jsx(Rb,{columnVirtualizer:n,footerGroup:m,table:t},m.id))}))};var mn={root:"MRT_TableHead-module_root__j9NkO","root-grid":"MRT_TableHead-module_root-grid__c3aGl","root-table-row-group":"MRT_TableHead-module_root-table-row-group__d9FO4","root-sticky":"MRT_TableHead-module_root-sticky__0kuDE","banner-tr":"MRT_TableHead-module_banner-tr__EhT-x","banner-th":"MRT_TableHead-module_banner-th__KwM5a",grid:"MRT_TableHead-module_grid__OJ-td"},ba={root:"MRT_TableHeadRow-module_root__hUKv4","layout-mode-grid":"MRT_TableHeadRow-module_layout-mode-grid__4ZGri",sticky:"MRT_TableHeadRow-module_sticky__Ej7Ax"},lt={root:"MRT_TableHeadCell-module_root__6y50a","root-grid":"MRT_TableHeadCell-module_root-grid__bAf1d","root-virtualized":"MRT_TableHeadCell-module_root-virtualized__CWLit","root-no-select":"MRT_TableHeadCell-module_root-no-select__BEOVU",content:"MRT_TableHeadCell-module_content__-pzSK","content-spaced":"MRT_TableHeadCell-module_content-spaced__S85Aa","content-center":"MRT_TableHeadCell-module_content-center__c-17L","content-right":"MRT_TableHeadCell-module_content-right__NSRZU","content-wrapper":"MRT_TableHeadCell-module_content-wrapper__py6aJ","content-wrapper-hidden-overflow":"MRT_TableHeadCell-module_content-wrapper-hidden-overflow__QY40r","content-wrapper-nowrap":"MRT_TableHeadCell-module_content-wrapper-nowrap__-4aIg",labels:"MRT_TableHeadCell-module_labels__oiMSr","labels-right":"MRT_TableHeadCell-module_labels-right__6ZJp-","labels-center":"MRT_TableHeadCell-module_labels-center__MM9q8","labels-sortable":"MRT_TableHeadCell-module_labels-sortable__tyuLr","labels-data":"MRT_TableHeadCell-module_labels-data__PvFGO","content-actions":"MRT_TableHeadCell-module_content-actions__utxbm"},kb={"filter-mode-label":"MRT_TableHeadCellFilterContainer-module_filter-mode-label__8reK-"};const bd=(e,n,t,o)=>{const a=Iv(e.getValue(n),t,{threshold:ht.MATCHES});return o(a),a.passed};bd.autoRemove=e=>!e;const yd=(e,n,t)=>{var o;return(o=e.getValue(n))===null||o===void 0?void 0:o.toString().toLowerCase().trim().includes(t.toString().toLowerCase().trim())};yd.autoRemove=e=>!e;const wd=(e,n,t)=>{var o;return(o=e.getValue(n))===null||o===void 0?void 0:o.toString().toLowerCase().trim().startsWith(t.toString().toLowerCase().trim())};wd.autoRemove=e=>!e;const Cd=(e,n,t)=>{var o;return(o=e.getValue(n))===null||o===void 0?void 0:o.toString().toLowerCase().trim().endsWith(t.toString().toLowerCase().trim())};Cd.autoRemove=e=>!e;const Ko=(e,n,t)=>{var o;return((o=e.getValue(n))===null||o===void 0?void 0:o.toString().toLowerCase().trim())===(t==null?void 0:t.toString().toLowerCase().trim())};Ko.autoRemove=e=>!e;const jd=(e,n,t)=>{var o;return((o=e.getValue(n))===null||o===void 0?void 0:o.toString().toLowerCase().trim())!==t.toString().toLowerCase().trim()};jd.autoRemove=e=>!e;const Yo=(e,n,t)=>{var o;return!isNaN(+t)&&!isNaN(+e.getValue(n))?+e.getValue(n)>+t:((o=e.getValue(n))===null||o===void 0?void 0:o.toString().toLowerCase().trim())>(t==null?void 0:t.toString().toLowerCase().trim())};Yo.autoRemove=e=>!e;const oi=(e,n,t)=>Ko(e,n,t)||Yo(e,n,t);oi.autoRemove=e=>!e;const Qo=(e,n,t)=>{var o;return!isNaN(+t)&&!isNaN(+e.getValue(n))?+e.getValue(n)<+t:((o=e.getValue(n))===null||o===void 0?void 0:o.toString().toLowerCase().trim())<(t==null?void 0:t.toString().toLowerCase().trim())};Qo.autoRemove=e=>!e;const ai=(e,n,t)=>Ko(e,n,t)||Qo(e,n,t);ai.autoRemove=e=>!e;const Sd=(e,n,t)=>(["",void 0].includes(t[0])||Yo(e,n,t[0]))&&(!isNaN(+t[0])&&!isNaN(+t[1])&&+t[0]>+t[1]||["",void 0].includes(t[1])||Qo(e,n,t[1]));Sd.autoRemove=e=>!e;const _d=(e,n,t)=>(["",void 0].includes(t[0])||oi(e,n,t[0]))&&(!isNaN(+t[0])&&!isNaN(+t[1])&&+t[0]>+t[1]||["",void 0].includes(t[1])||ai(e,n,t[1]));_d.autoRemove=e=>!e;const Md=(e,n,t)=>{var o;return!(!((o=e.getValue(n))===null||o===void 0)&&o.toString().trim())};Md.autoRemove=e=>!e;const Rd=(e,n,t)=>{var o;return!!(!((o=e.getValue(n))===null||o===void 0)&&o.toString().trim())};Rd.autoRemove=e=>!e;const Db=Object.assign(Object.assign({},tn),{between:Sd,betweenInclusive:_d,contains:yd,empty:Md,endsWith:Cd,equals:Ko,fuzzy:bd,greaterThan:Yo,greaterThanOrEqualTo:oi,lessThan:Qo,lessThanOrEqualTo:ai,notEmpty:Rd,notEquals:jd,startsWith:wd});function ri(e,n){var t;if(!n)return"";const o=`filter${n[0].toUpperCase()}${n.slice(1)}`;return(t=e[o])!==null&&t!==void 0?t:""}var Tb={root:"MRT_FilterCheckBox-module_root__59h9r"};const Ib=e=>{var n,t,o,{column:a,table:r}=e,i=Ie(e,["column","table"]);const{getState:l,options:{localization:d,mantineFilterCheckboxProps:c}}=r,{density:u}=l(),{columnDef:g}=a,h={column:a,table:r},m=Object.assign(Object.assign(Object.assign({},fe(c,h)),fe(g.mantineFilterCheckboxProps,h)),i),p=(n=d.filterByColumn)===null||n===void 0?void 0:n.replace("{column}",g.header),f=a.getFilterValue();return s.jsx(We,{label:(t=m==null?void 0:m.title)!==null&&t!==void 0?t:p,openDelay:1e3,withinPortal:!0,children:s.jsx(bo,Object.assign({checked:f==="true",className:Ce("mrt-filter-checkbox",Tb.root),indeterminate:f===void 0,label:(o=m.title)!==null&&o!==void 0?o:p,size:u==="xs"?"sm":"md"},m,{onChange:v=>{var x;a.setFilterValue(a.getFilterValue()===void 0?"true":a.getFilterValue()==="true"?"false":void 0),(x=m==null?void 0:m.onChange)===null||x===void 0||x.call(m,v)},onClick:v=>{var x;v.stopPropagation(),(x=m==null?void 0:m.onClick)===null||x===void 0||x.call(m,v)},title:void 0}))})};var Pb={root:"MRT_FilterRangeFields-module_root__KfCcg"},gs={root:"MRT_FilterTextInput-module_root__Ss8Ql","date-filter":"MRT_FilterTextInput-module_date-filter__jOBLB","range-filter":"MRT_FilterTextInput-module_range-filter__JQHAL","not-filter-chip":"MRT_FilterTextInput-module_not-filter-chip__u8b1y","filter-chip-badge":"MRT_FilterTextInput-module_filter-chip-badge__Sel2k"};const Ua=e=>{var n,t,o,a,r,i,l,d,{header:c,rangeFilterIndex:u,table:g}=e,h=Ie(e,["header","rangeFilterIndex","table"]);const{options:{columnFilterDisplayMode:m,columnFilterModeOptions:p,icons:{IconX:f},localization:v,mantineFilterAutocompleteProps:x,mantineFilterDateInputProps:y,mantineFilterMultiSelectProps:w={clearable:!0},mantineFilterSelectProps:C,mantineFilterTextInputProps:j,manualFiltering:S},refs:{filterInputRefs:R},setColumnFilterFns:_}=g,{column:T}=c,{columnDef:k}=T,I={column:T,rangeFilterIndex:u,table:g},E=Object.assign(Object.assign(Object.assign({},fe(j,I)),fe(k.mantineFilterTextInputProps,I)),h),V=Object.assign(Object.assign({},fe(C,I)),fe(k.mantineFilterSelectProps,I)),L=Object.assign(Object.assign({},fe(w,I)),fe(k.mantineFilterMultiSelectProps,I)),B=Object.assign(Object.assign({},fe(y,I)),fe(k.mantineFilterDateInputProps,I)),M=Object.assign(Object.assign({},fe(x,I)),fe(k.mantineFilterAutocompleteProps,I)),D=k.filterVariant==="range"||k.filterVariant==="date-range"||u!==void 0,O=k.filterVariant==="select",F=k.filterVariant==="multi-select",$=k.filterVariant==="date"||k.filterVariant==="date-range",z=k.filterVariant==="autocomplete",H=(n=k==null?void 0:k.columnFilterModeOptions)!==null&&n!==void 0?n:p,re=k._filterFn,ie=["empty","notEmpty"].includes(re)?ri(v,re):"",X=D?u===0?v.min:u===1?v.max:"":(t=E==null?void 0:E.placeholder)!==null&&t!==void 0?t:(o=v.filterByColumn)===null||o===void 0?void 0:o.replace("{column}",String(k.header)),oe=T.getFacetedUniqueValues(),ne=b.useMemo(()=>{var A,se,be;return((be=(se=(A=M==null?void 0:M.data)!==null&&A!==void 0?A:V==null?void 0:V.data)!==null&&se!==void 0?se:L==null?void 0:L.data)!==null&&be!==void 0?be:(z||O||F)&&oe?Array.from(oe.keys()).filter(ve=>ve!==null).sort((ve,Se)=>ve.localeCompare(Se)):[]).filter(ve=>ve!=null)},[M==null?void 0:M.data,oe,z,F,O,L==null?void 0:L.data,V==null?void 0:V.data]),J=b.useRef(!1),[P,Q]=b.useState(()=>{var A,se;return F?T.getFilterValue()||[]:D?((A=T.getFilterValue())===null||A===void 0?void 0:A[u])||"":(se=T.getFilterValue())!==null&&se!==void 0?se:""}),[ce]=Rl(P,S?400:200);b.useEffect(()=>{J.current&&(D?T.setFilterValue(A=>{const se=Array.isArray(A)?A:["",""];return se[u]=ce,se}):T.setFilterValue(ce??void 0))},[ce]),b.useEffect(()=>{if(!J.current){J.current=!0;return}const A=T.getFilterValue();A===void 0?te():Q(D&&u!==void 0?(A??["",""])[u]:A??"")},[T.getFilterValue()]);const te=()=>{F?(Q([]),T.setFilterValue([])):D?(Q(""),T.setFilterValue(A=>{const se=Array.isArray(A)?A:["",""];return se[u]=void 0,se})):O?(Q(null),T.setFilterValue(null)):(Q(""),T.setFilterValue(void 0))},W=()=>{F?(Q([]),T.setFilterValue([])):(Q(""),T.setFilterValue(void 0)),_(A=>{var se;return Object.assign(Object.assign({},A),{[c.id]:(se=H==null?void 0:H[0])!==null&&se!==void 0?se:"fuzzy"})})},me={"aria-label":X,className:Ce("mrt-filter-text-input",gs.root,$?gs["date-filter"]:D?gs["range-filter"]:!ie&&gs["not-filter-chip"]),disabled:!!ie,onChange:Q,onClick:A=>A.stopPropagation(),placeholder:X,style:Object.assign({},F?L==null?void 0:L.style:O?V==null?void 0:V.style:$?B==null?void 0:B.style:E==null?void 0:E.style),title:X,value:F&&!Array.isArray(P)?[]:P,variant:"unstyled"},{className:le}=me,de=Ie(me,["className"]),Y=P?s.jsx(Oe,{"aria-label":v.clearFilter,color:"var(--mantine-color-gray-7)",onClick:te,size:"sm",title:(a=v.clearFilter)!==null&&a!==void 0?a:"",variant:"transparent",children:s.jsx(f,{})}):null;return k.Filter?s.jsx(s.Fragment,{children:(r=k.Filter)===null||r===void 0?void 0:r.call(k,{column:T,header:c,rangeFilterIndex:u,table:g})}):ie?s.jsx(K,{style:de.style,children:s.jsx(ot,{className:gs["filter-chip-badge"],onClick:W,rightSection:Y,size:"lg",children:ie})}):F?s.jsx(So,Object.assign({},de,{searchable:!0},L,{className:Ce(le,L.className),data:ne,onChange:A=>Q(A),ref:A=>{A&&(R.current[`${T.id}-${u??0}`]=A,L.ref&&(L.ref.current=A))},rightSection:!((i=P==null?void 0:P.toString())===null||i===void 0)&&i.length&&(L!=null&&L.clearable)?Y:void 0,style:de.style})):O?s.jsx(Jt,Object.assign({},de,{clearable:!0,searchable:!0},V,{className:Ce(le,V.className),clearButtonProps:{size:"md"},data:ne,ref:A=>{A&&(R.current[`${T.id}-${u??0}`]=A,V.ref&&(V.ref.current=A))},style:de.style})):$?s.jsx(Jr,Object.assign({},de,{allowDeselect:!0,clearable:!0,popoverProps:{withinPortal:m!=="popover"}},B,{className:Ce(le,B.className),onChange:A=>de.onChange(A===null?"":A),ref:A=>{A&&(R.current[`${T.id}-${u??0}`]=A,B.ref&&(B.ref.current=A))},style:de.style})):z?s.jsx(xr,Object.assign({},de,{onChange:A=>Q(A),rightSection:!((l=P==null?void 0:P.toString())===null||l===void 0)&&l.length?Y:void 0},M,{className:Ce(le,M.className),data:ne,ref:A=>{A&&(R.current[`${T.id}-${u??0}`]=A,M.ref&&(M.ref.current=A))},style:de.style})):s.jsx(Ge,Object.assign({},de,{onChange:A=>Q(A.target.value),rightSection:!((d=P==null?void 0:P.toString())===null||d===void 0)&&d.length?Y:void 0},E,{className:Ce(le,E.className),mt:0,ref:A=>{A&&(R.current[`${T.id}-${u??0}`]=A,E.ref&&(E.ref.current=A))},style:de.style}))},Fb=e=>{var{header:n,table:t}=e,o=Ie(e,["header","table"]);return s.jsxs(K,Object.assign({},o,{className:Ce("mrt-filter-range-fields",Pb.root,o.className),children:[s.jsx(Ua,{header:n,rangeFilterIndex:0,table:t}),s.jsx(Ua,{header:n,rangeFilterIndex:1,table:t})]}))};var Eb={root:"MRT_FilterRangeSlider-module_root__uwYEk"};const Ob=e=>{var n,{header:t,table:o}=e,a=Ie(e,["header","table"]);const{options:{mantineFilterRangeSliderProps:r},refs:{filterInputRefs:i}}=o,{column:l}=t,{columnDef:d}=l,c={column:l,table:o},u=Object.assign(Object.assign(Object.assign({},fe(r,c)),fe(d.mantineFilterRangeSliderProps,c)),a);let[g,h]=u.min!==void 0&&u.max!==void 0?[u.min,u.max]:(n=l.getFacetedMinMaxValues())!==null&&n!==void 0?n:[0,1];Array.isArray(g)&&(g=g[0]),Array.isArray(h)&&(h=h[0]),g===null&&(g=0),h===null&&(h=1);const[m,p]=b.useState([g,h]),f=l.getFilterValue(),v=b.useRef(!1);return b.useEffect(()=>{v.current&&(f===void 0?p([g,h]):Array.isArray(f)&&p(f)),v.current=!0},[f,g,h]),s.jsx(Ar,Object.assign({className:Ce("mrt-filter-range-slider",Eb.root),max:h,min:g,onChange:x=>{p(x)},onChangeEnd:x=>{Array.isArray(x)&&(x[0]<=g&&x[1]>=h?l.setFilterValue(void 0):l.setFilterValue(x))},value:m},u,{ref:x=>{x&&(i.current[`${l.id}-0`]=x,u!=null&&u.ref&&(u.ref=x))}}))};var Ab={symbol:"MRT_FilterOptionMenu-module_symbol__a1Bsy"};const zb=e=>[{divider:!1,label:e.filterFuzzy,option:"fuzzy",symbol:"≈"},{divider:!1,label:e.filterContains,option:"contains",symbol:"*"},{divider:!1,label:e.filterStartsWith,option:"startsWith",symbol:"a"},{divider:!0,label:e.filterEndsWith,option:"endsWith",symbol:"z"},{divider:!1,label:e.filterEquals,option:"equals",symbol:"="},{divider:!0,label:e.filterNotEquals,option:"notEquals",symbol:"≠"},{divider:!1,label:e.filterBetween,option:"between",symbol:"⇿"},{divider:!0,label:e.filterBetweenInclusive,option:"betweenInclusive",symbol:"⬌"},{divider:!1,label:e.filterGreaterThan,option:"greaterThan",symbol:">"},{divider:!1,label:e.filterGreaterThanOrEqualTo,option:"greaterThanOrEqualTo",symbol:"≥"},{divider:!1,label:e.filterLessThan,option:"lessThan",symbol:"<"},{divider:!0,label:e.filterLessThanOrEqualTo,option:"lessThanOrEqualTo",symbol:"≤"},{divider:!1,label:e.filterEmpty,option:"empty",symbol:"∅"},{divider:!1,label:e.filterNotEmpty,option:"notEmpty",symbol:"!∅"}],Ls=["between","betweenInclusive","inNumberRange"],ya=["empty","notEmpty"],$b=["arrIncludesSome","arrIncludesAll","arrIncludes"],tl=["range-slider","date-range","range"],Nd=({header:e,onSelect:n,table:t})=>{var o,a,r,i;const{getState:l,options:{columnFilterModeOptions:d,globalFilterModeOptions:c,localization:u,renderColumnFilterModeMenuItems:g,renderGlobalFilterModeMenuItems:h},setColumnFilterFns:m,setGlobalFilterFn:p}=t,{globalFilterFn:f}=l(),{column:v}=e??{},{columnDef:x}=v??{},y=v==null?void 0:v.getFilterValue();let w=(o=x==null?void 0:x.columnFilterModeOptions)!==null&&o!==void 0?o:d;tl.includes(x==null?void 0:x.filterVariant)&&(w=[...Ls,...w??[]].filter(R=>Ls.includes(R)));const C=b.useMemo(()=>zb(u).filter(R=>x?w===void 0||(w==null?void 0:w.includes(R.option)):(!c||c.includes(R.option))&&["contains","fuzzy","startsWith"].includes(R.option)),[]),j=R=>{var _;const T=(_=x==null?void 0:x._filterFn)!==null&&_!==void 0?_:"";!e||!v?p(R):R!==T&&(m(k=>Object.assign(Object.assign({},k),{[e.id]:R})),ya.includes(R)?y!==" "&&!ya.includes(T)?v.setFilterValue(" "):y&&v.setFilterValue(y):(x==null?void 0:x.filterVariant)==="multi-select"||$b.includes(R)?y instanceof String||y!=null&&y.length?v.setFilterValue([]):y&&v.setFilterValue(y):tl.includes(x==null?void 0:x.filterVariant)||Ls.includes(R)?!Array.isArray(y)||!(y!=null&&y.every(k=>k===""))&&!Ls.includes(T)?v.setFilterValue(["",""]):v.setFilterValue(y):Array.isArray(y)?v.setFilterValue(""):y===" "&&ya.includes(T)?v.setFilterValue(void 0):v.setFilterValue(y)),n==null||n()},S=e&&x?x._filterFn:f;return s.jsx(Te.Dropdown,{children:(i=e&&v&&x?(r=(a=x.renderColumnFilterModeMenuItems)===null||a===void 0?void 0:a.call(x,{column:v,internalFilterOptions:C,onSelectFilterMode:j,table:t}))!==null&&r!==void 0?r:g==null?void 0:g({column:v,internalFilterOptions:C,onSelectFilterMode:j,table:t}):h==null?void 0:h({internalFilterOptions:C,onSelectFilterMode:j,table:t}))!==null&&i!==void 0?i:C.map(({divider:R,label:_,option:T,symbol:k},I)=>s.jsxs(b.Fragment,{children:[s.jsx(Te.Item,{color:T===S?"blue":void 0,leftSection:s.jsx("span",{className:Ab.symbol,children:k}),onClick:()=>j(T),value:T,children:_}),R&&s.jsx(Te.Divider,{})]},I))})},kd=e=>{var n,t,{header:o,table:a}=e,r=Ie(e,["header","table"]);const{getState:i,options:{columnFilterDisplayMode:l,columnFilterModeOptions:d,enableColumnFilterModes:c,icons:{IconFilterCog:u},localization:g},refs:{filterInputRefs:h}}=a,{showColumnFilters:m}=i(),{column:p}=o,{columnDef:f}=p,v=f._filterFn,x=(n=f==null?void 0:f.columnFilterModeOptions)!==null&&n!==void 0?n:d,y=c&&f.enableColumnFilterModes!==!1&&(x===void 0||!!(x!=null&&x.length));return s.jsx(ts,{in:m||l==="popover",children:s.jsxs(tt,Object.assign({direction:"column"},r,{children:[s.jsxs(tt,{align:"flex-end",children:[f.filterVariant==="checkbox"?s.jsx(Ib,{column:p,table:a}):f.filterVariant==="range-slider"?s.jsx(Ob,{header:o,table:a}):["date-range","range"].includes((t=f.filterVariant)!==null&&t!==void 0?t:"")||["between","betweenInclusive","inNumberRange"].includes(f._filterFn)?s.jsx(Fb,{header:o,table:a}):s.jsx(Ua,{header:o,table:a}),y&&s.jsxs(Te,{withinPortal:l!=="popover",children:[s.jsx(We,{label:g.changeFilterMode,position:"bottom-start",withinPortal:!0,children:s.jsx(Te.Target,{children:s.jsx(Oe,{"aria-label":g.changeFilterMode,color:"gray",size:"md",variant:"subtle",children:s.jsx(u,{})})})}),s.jsx(Nd,{header:o,onSelect:()=>setTimeout(()=>{var w;return(w=h.current[`${p.id}-0`])===null||w===void 0?void 0:w.focus()},100),table:a})]})]}),y?s.jsx(ue,{c:"dimmed",className:kb["filter-mode-label"],component:"label",children:g.filterMode.replace("{filterType}",ri(g,v))}):null]}))})};var Lb={root:"MRT_TableHeadCellFilterLabel-module_root__Rur2R"};const Vb=e=>{var n,t,o,{header:a,table:r}=e,i=Ie(e,["header","table"]);const{options:{columnFilterDisplayMode:l,icons:{IconFilter:d},localization:c},refs:{filterInputRefs:u},setShowColumnFilters:g}=r,{column:h}=a,{columnDef:m}=h,p=h.getFilterValue(),[f,v]=b.useState(!1),x=Array.isArray(p)&&p.some(Boolean)||!!p&&!Array.isArray(p),y=m.filterVariant==="range"||m.filterVariant==="date-range"||["between","betweenInclusive","inNumberRange"].includes(m._filterFn),w=m._filterFn,C=m.filterTooltipValueFn||(S=>S),j=l==="popover"&&!x?(n=c.filterByColumn)===null||n===void 0?void 0:n.replace("{column}",String(m.header)):c.filteringByColumn.replace("{column}",String(m.header)).replace("{filterType}",ri(c,w)).replace("{filterValue}",`"${Array.isArray(h.getFilterValue())?h.getFilterValue().map(S=>C(S)).join(`" ${y?c.and:c.or} "`):C(h.getFilterValue())}"`).replace('" "',"");return s.jsx(s.Fragment,{children:s.jsxs(Mt,{keepMounted:m.filterVariant==="range-slider",onChange:v,onClose:()=>v(!1),opened:f,position:"top",shadow:"xl",width:360,withinPortal:!0,children:[s.jsx(Jn,{mounted:l==="popover"||!!h.getFilterValue()&&!y||y&&(!!(!((t=h.getFilterValue())===null||t===void 0)&&t[0])||!!(!((o=h.getFilterValue())===null||o===void 0)&&o[1])),transition:"scale",children:()=>s.jsx(Mt.Target,{children:s.jsx(We,{disabled:f,label:j,multiline:!0,w:j.length>40?300:void 0,withinPortal:!0,children:s.jsx(Oe,Object.assign({className:Ce("mrt-table-head-cell-filter-label-icon",Lb.root),size:18},to("active",x),{onClick:S=>{S.stopPropagation(),l==="popover"?v(R=>!R):g(!0),setTimeout(()=>{const R=u.current[`${h.id}-0`];R==null||R.focus(),R==null||R.select()},100)}},i,{children:s.jsx(d,{size:"100%"})}))})})}),l==="popover"&&s.jsx(Mt.Dropdown,{onClick:S=>S.stopPropagation(),onKeyDown:S=>S.key==="Enter"&&v(!1),onMouseDown:S=>S.stopPropagation(),children:s.jsx(kd,{header:a,table:r})})]})})},Bb=e=>{var{column:n,table:t,tableHeadCellRef:o}=e,a=Ie(e,["column","table","tableHeadCellRef"]);const{getState:r,options:{enableColumnOrdering:i,mantineColumnDragHandleProps:l},setColumnOrder:d,setDraggingColumn:c,setHoveredColumn:u}=t,{columnDef:g}=n,{columnOrder:h,draggingColumn:m,hoveredColumn:p}=r(),f={column:n,table:t},v=Object.assign(Object.assign(Object.assign({},fe(l,f)),fe(g.mantineColumnDragHandleProps,f)),a),x=w=>{var C;(C=v==null?void 0:v.onDragStart)===null||C===void 0||C.call(v,w),c(n),w.dataTransfer.setDragImage(o.current,0,0)},y=w=>{var C;(C=v==null?void 0:v.onDragEnd)===null||C===void 0||C.call(v,w),(p==null?void 0:p.id)==="drop-zone"?n.toggleGrouping():i&&p&&(p==null?void 0:p.id)!==(m==null?void 0:m.id)&&d(id(n,p,h)),c(null),u(null)};return s.jsx(ei,{actionIconProps:v,onDragEnd:y,onDragStart:x,table:t})};var wa={root:"MRT_TableHeadCellResizeHandle-module_root__paufe","root-ltr":"MRT_TableHeadCellResizeHandle-module_root-ltr__652AZ","root-rtl":"MRT_TableHeadCellResizeHandle-module_root-rtl__5VlSo","root-hide":"MRT_TableHeadCellResizeHandle-module_root-hide__-ILlD"};const Ub=e=>{var n,{header:t,table:o}=e,a=Ie(e,["header","table"]);const{getState:r,options:{columnResizeDirection:i,columnResizeMode:l},setColumnSizingInfo:d}=o,{density:c}=r(),{column:u}=t,g=t.getResizeHandler(),h=u.getIsResizing()&&l==="onEnd"?`translateX(${(i==="rtl"?-1:1)*((n=r().columnSizingInfo.deltaOffset)!==null&&n!==void 0?n:0)}px)`:void 0;return s.jsx(K,Object.assign({onDoubleClick:()=>{d(m=>Object.assign(Object.assign({},m),{isResizingColumn:!1})),u.resetSize()},onMouseDown:g,onTouchStart:g,role:"separator"},a,{__vars:Object.assign({"--mrt-transform":h},a.__vars),className:Ce("mrt-table-head-cell-resize-handle",wa.root,wa[`root-${i}`],!t.subHeaders.length&&l==="onChange"&&wa["root-hide"],c,a.className)}))};var nl={"sort-icon":"MRT_TableHeadCellSortLabel-module_sort-icon__zs1xA","multi-sort-indicator":"MRT_TableHeadCellSortLabel-module_multi-sort-indicator__MGBj2"};const Hb=e=>{var{header:n,table:t}=e,o=Ie(e,["header","table"]);const{getState:a,options:{icons:{IconArrowsSort:r,IconSortAscending:i,IconSortDescending:l},localization:d}}=t,c=n.column,{columnDef:u}=c,{sorting:g}=a(),h=c.getIsSorted(),m=c.getSortIndex(),p=h?h==="desc"?d.sortedByColumnDesc.replace("{column}",u.header):d.sortedByColumnAsc.replace("{column}",u.header):c.getNextSortingOrder()==="desc"?d.sortByColumnDesc.replace("{column}",u.header):d.sortByColumnAsc.replace("{column}",u.header),f=s.jsx(Oe,Object.assign({"aria-label":p},to("sorted",h),o,{className:Ce("mrt-table-head-sort-button",nl["sort-icon"],o.className),children:h==="desc"?s.jsx(l,{size:"100%"}):h==="asc"?s.jsx(i,{size:"100%"}):s.jsx(r,{size:"100%"})}));return s.jsx(We,{label:p,openDelay:1e3,withinPortal:!0,children:g.length<2||m===-1?f:s.jsx(Sr,{className:Ce("mrt-table-head-multi-sort-indicator",nl["multi-sort-indicator"]),inline:!0,label:m+1,offset:4,children:f})})};var sl={left:"MRT_ColumnActionMenu-module_left__cfNmY",right:"MRT_ColumnActionMenu-module_right__-nK56"};const Gb=e=>{var n,t,o,a,r,i,l,d,c,u,{header:g,table:h}=e,m=Ie(e,["header","table"]);const{getState:p,options:{columnFilterDisplayMode:f,enableColumnFilters:v,enableColumnPinning:x,enableColumnResizing:y,enableGrouping:w,enableHiding:C,enableSorting:j,enableSortingRemoval:S,icons:{IconArrowAutofitContent:R,IconBoxMultiple:_,IconClearAll:T,IconColumns:k,IconDotsVertical:I,IconEyeOff:E,IconFilter:V,IconFilterOff:L,IconPinned:B,IconPinnedOff:M,IconSortAscending:D,IconSortDescending:O},localization:F,mantineColumnActionsButtonProps:$,renderColumnActionsMenuItems:z},refs:{filterInputRefs:H},setColumnOrder:re,setColumnSizingInfo:ie,setShowColumnFilters:X,toggleAllColumnsVisible:oe}=h,{column:ne}=g,{columnDef:J}=ne,{columnSizing:P,columnVisibility:Q}=p(),ce={column:ne,table:h},te=Object.assign(Object.assign({},fe($,ce)),fe(J.mantineColumnActionsButtonProps,ce)),W=()=>{ne.clearSorting()},me=()=>{ne.toggleSorting(!1)},le=()=>{ne.toggleSorting(!0)},de=()=>{ie(U=>Object.assign(Object.assign({},U),{isResizingColumn:!1})),ne.resetSize()},Y=()=>{ne.toggleVisibility(!1)},A=U=>{ne.pin(U)},se=()=>{ne.toggleGrouping(),re(U=>["mrt-row-expand",...U])},be=()=>{ne.setFilterValue("")},ve=()=>{X(!0),setTimeout(()=>{var U;return(U=H.current[`${ne.id}-0`])===null||U===void 0?void 0:U.focus()},100)},Se=()=>{oe(!0)},we=s.jsxs(s.Fragment,{children:[j&&ne.getCanSort()&&s.jsxs(s.Fragment,{children:[S!==!1&&s.jsx(Te.Item,{disabled:!ne.getIsSorted(),leftSection:s.jsx(T,{}),onClick:W,children:F.clearSort}),s.jsx(Te.Item,{disabled:ne.getIsSorted()==="asc",leftSection:s.jsx(D,{}),onClick:me,children:(n=F.sortByColumnAsc)===null||n===void 0?void 0:n.replace("{column}",String(J.header))}),s.jsx(Te.Item,{disabled:ne.getIsSorted()==="desc",leftSection:s.jsx(O,{}),onClick:le,children:(t=F.sortByColumnDesc)===null||t===void 0?void 0:t.replace("{column}",String(J.header))}),(v||w||C)&&s.jsx(Te.Divider,{},3)]}),v&&f!=="popover"&&ne.getCanFilter()&&s.jsxs(s.Fragment,{children:[s.jsx(Te.Item,{disabled:!ne.getFilterValue(),leftSection:s.jsx(L,{}),onClick:be,children:F.clearFilter}),s.jsx(Te.Item,{leftSection:s.jsx(V,{}),onClick:ve,children:(o=F.filterByColumn)===null||o===void 0?void 0:o.replace("{column}",String(J.header))}),(w||C)&&s.jsx(Te.Divider,{},2)]}),w&&ne.getCanGroup()&&s.jsxs(s.Fragment,{children:[s.jsx(Te.Item,{leftSection:s.jsx(_,{}),onClick:se,children:(a=F[ne.getIsGrouped()?"ungroupByColumn":"groupByColumn"])===null||a===void 0?void 0:a.replace("{column}",String(J.header))}),x&&s.jsx(Te.Divider,{})]}),x&&ne.getCanPin()&&s.jsxs(s.Fragment,{children:[s.jsx(Te.Item,{disabled:ne.getIsPinned()==="left"||!ne.getCanPin(),leftSection:s.jsx(B,{className:sl.left}),onClick:()=>A("left"),children:F.pinToLeft}),s.jsx(Te.Item,{disabled:ne.getIsPinned()==="right"||!ne.getCanPin(),leftSection:s.jsx(B,{className:sl.right}),onClick:()=>A("right"),children:F.pinToRight}),s.jsx(Te.Item,{disabled:!ne.getIsPinned(),leftSection:s.jsx(M,{}),onClick:()=>A(!1),children:F.unpin}),C&&s.jsx(Te.Divider,{})]}),y&&ne.getCanResize()&&s.jsx(Te.Item,{disabled:!P[ne.id],leftSection:s.jsx(R,{}),onClick:de,children:F.resetColumnSize},0),C&&s.jsxs(s.Fragment,{children:[s.jsx(Te.Item,{disabled:!ne.getCanHide(),leftSection:s.jsx(E,{}),onClick:Y,children:(r=F.hideColumn)===null||r===void 0?void 0:r.replace("{column}",String(J.header))},0),s.jsx(Te.Item,{disabled:!Object.values(Q).filter(U=>!U).length,leftSection:s.jsx(k,{}),onClick:Se,children:(i=F.showAllColumns)===null||i===void 0?void 0:i.replace("{column}",String(J.header))},1)]})]});return s.jsxs(Te,Object.assign({closeOnItemClick:!0,position:"bottom-start",withinPortal:!0},m,{children:[s.jsx(We,{label:(l=te==null?void 0:te.title)!==null&&l!==void 0?l:F.columnActions,openDelay:1e3,withinPortal:!0,children:s.jsx(Te.Target,{children:s.jsx(Oe,Object.assign({"aria-label":F.columnActions,color:"gray",size:"sm",variant:"subtle"},te,{children:s.jsx(I,{size:"100%"})}))})}),s.jsx(Te.Dropdown,{children:(u=(c=(d=J.renderColumnActionsMenuItems)===null||d===void 0?void 0:d.call(J,{column:ne,internalColumnMenuItems:we,table:h}))!==null&&c!==void 0?c:z==null?void 0:z({column:ne,internalColumnMenuItems:we,table:h}))!==null&&u!==void 0?u:we})]}))},qb=e=>{var n,t,o,a,r,i,{columnVirtualizer:l,header:d,renderedHeaderIndex:c=0,table:u}=e,g=Ie(e,["columnVirtualizer","header","renderedHeaderIndex","table"]);const h=On(),{getState:m,options:{columnFilterDisplayMode:p,columnResizeDirection:f,columnResizeMode:v,enableColumnActions:x,enableColumnDragging:y,enableColumnOrdering:w,enableColumnPinning:C,enableGrouping:j,enableHeaderActionsHoverReveal:S,enableMultiSort:R,layoutMode:_,mantineTableHeadCellProps:T},refs:{tableHeadCellRefs:k},setHoveredColumn:I}=u,{columnSizingInfo:E,draggingColumn:V,grouping:L,hoveredColumn:B}=m(),{column:M}=d,{columnDef:D}=M,{columnDefType:O}=D,F={column:M,table:u},$=Object.assign(Object.assign(Object.assign({},fe(T,F)),fe(D.mantineTableHeadCellProps,F)),g),z={minWidth:`max(calc(var(--header-${Yt(d==null?void 0:d.id)}-size) * 1px), ${(n=D.minSize)!==null&&n!==void 0?n:30}px)`,width:`calc(var(--header-${Yt(d.id)}-size) * 1px)`};_==="grid"?z.flex=`${[0,!1].includes(D.grow)?0:`var(--header-${Yt(d.id)}-size)`} 0 auto`:_==="grid-no-grow"&&(z.flex=`${+(D.grow||0)} 0 auto`);const H=C&&D.columnDefType!=="group"&&M.getIsPinned(),re=(V==null?void 0:V.id)===M.id,ie=(B==null?void 0:B.id)===M.id,{hovered:X,ref:oe}=cg(),[ne,J]=b.useState(!1),P=(x||D.enableColumnActions)&&D.enableColumnActions!==!1,Q=!S||ne||X&&!u.getVisibleFlatColumns().find(le=>le.getIsResizing()),ce=y!==!1&&D.enableColumnDragging!==!1&&(y||w&&D.enableColumnOrdering!==!1||j&&D.enableGrouping!==!1&&!L.includes(M.id))&&Q,te=b.useMemo(()=>{let le=0;return M.getCanSort()&&le++,Q&&(le+=1.75),ce&&(le+=1.25),le},[Q,ce]),W=le=>{j&&(B==null?void 0:B.id)==="drop-zone"&&I(null),w&&V&&O!=="group"&&I(D.enableColumnOrdering!==!1?M:null)},me=(D==null?void 0:D.Header)instanceof Function?(t=D==null?void 0:D.Header)===null||t===void 0?void 0:t.call(D,{column:M,header:d,table:u}):(o=D==null?void 0:D.Header)!==null&&o!==void 0?o:D.header;return s.jsxs(Xn,Object.assign({colSpan:d.colSpan,"data-column-pinned":H||void 0,"data-dragging-column":re||void 0,"data-first-right-pinned":H==="right"&&M.getIsFirstColumn(H)||void 0,"data-hovered-column-target":ie||void 0,"data-index":c,"data-last-left-pinned":H==="left"&&M.getIsLastColumn(H)||void 0,"data-resizing":v==="onChange"&&(E==null?void 0:E.isResizingColumn)===M.id&&f||void 0},$,{__vars:{"--mrt-table-cell-left":H==="left"?`${M.getStart(H)}`:void 0,"--mrt-table-cell-right":H==="right"?`${M.getAfter(H)}`:void 0},align:O==="group"?"center":h.dir==="rtl"?"right":"left",className:Ce(lt.root,(_==null?void 0:_.startsWith("grid"))&<["root-grid"],R&&M.getCanSort()&<["root-no-select"],l&<["root-virtualized"],$==null?void 0:$.className),onDragEnter:W,ref:le=>{var de;le&&(k.current[M.id]=le,oe.current=le,O!=="group"&&((de=l==null?void 0:l.measureElement)===null||de===void 0||de.call(l,le)))},style:le=>Object.assign(Object.assign({},z),fe($==null?void 0:$.style,le)),children:[d.isPlaceholder?null:(a=$.children)!==null&&a!==void 0?a:s.jsxs(tt,{className:Ce("mrt-table-head-cell-content",lt.content,(O==="group"||($==null?void 0:$.align)==="center")&<["content-center"],($==null?void 0:$.align)==="right"&<["content-right"],M.getCanResize()&<["content-spaced"]),children:[s.jsxs(tt,{__vars:{"--mrt-table-head-cell-labels-padding-left":`${te}`},className:Ce("mrt-table-head-cell-labels",lt.labels,M.getCanSort()&&O!=="group"&<["labels-sortable"],($==null?void 0:$.align)==="right"?lt["labels-right"]:($==null?void 0:$.align)==="center"&<["labels-center"],O==="data"&<["labels-data"]),onClick:M.getToggleSortingHandler(),children:[s.jsx(tt,{className:Ce("mrt-table-head-cell-content-wrapper",lt["content-wrapper"],O==="data"&<["content-wrapper-hidden-overflow"],((i=(r=D.header)===null||r===void 0?void 0:r.length)!==null&&i!==void 0?i:0)<20&<["content-wrapper-nowrap"]),children:me}),M.getCanFilter()&&(M.getIsFiltered()||Q)&&s.jsx(Vb,{header:d,table:u}),M.getCanSort()&&(M.getIsSorted()||Q)&&s.jsx(Hb,{header:d,table:u})]}),O!=="group"&&s.jsxs(tt,{className:Ce("mrt-table-head-cell-content-actions",lt["content-actions"]),children:[ce&&s.jsx(Bb,{column:M,table:u,tableHeadCellRef:{current:k.current[M.id]}}),P&&Q&&s.jsx(Gb,{header:d,onChange:J,opened:ne,table:u})]}),M.getCanResize()&&s.jsx(Ub,{header:d,table:u})]}),p==="subheader"&&M.getCanFilter()&&s.jsx(kd,{header:d,table:u})]}))},Wb=e=>{var{columnVirtualizer:n,headerGroup:t,table:o}=e,a=Ie(e,["columnVirtualizer","headerGroup","table"]);const{getState:r,options:{enableStickyHeader:i,layoutMode:l,mantineTableHeadRowProps:d}}=o,{isFullScreen:c}=r(),{virtualColumns:u,virtualPaddingLeft:g,virtualPaddingRight:h}=n??{},m=Object.assign(Object.assign({},fe(d,{headerGroup:t,table:o})),a);return s.jsxs(sn,Object.assign({},m,{className:Ce(ba.root,(i||c)&&ba.sticky,(l==null?void 0:l.startsWith("grid"))&&ba["layout-mode-grid"],m==null?void 0:m.className),children:[g?s.jsx(K,{component:"th",display:"flex",w:g}):null,(u??t.headers).map((p,f)=>{let v=p;return n&&(f=p.index,v=t.headers[f]),s.jsx(qb,{columnVirtualizer:n,header:v,renderedHeaderIndex:f,table:o},v.id)}),h?s.jsx(K,{component:"th",display:"flex",w:h}):null]}))};var Hn={alert:"MRT_ToolbarAlertBanner-module_alert__PAhUK","alert-stacked":"MRT_ToolbarAlertBanner-module_alert-stacked__HR7Nq","alert-bottom":"MRT_ToolbarAlertBanner-module_alert-bottom__u9L-S","alert-badge":"MRT_ToolbarAlertBanner-module_alert-badge__GwDmX","toolbar-alert":"MRT_ToolbarAlertBanner-module_toolbar-alert__3sJGU","head-overlay":"MRT_ToolbarAlertBanner-module_head-overlay__Hw7jK"};const Ha=e=>{var n,{renderedRowIndex:t=0,row:o,table:a}=e,r=Ie(e,["renderedRowIndex","row","table"]);const{getState:i,options:{enableMultiRowSelection:l,localization:d,mantineSelectAllCheckboxProps:c,mantineSelectCheckboxProps:u,selectAllMode:g,selectDisplayMode:h}}=a,{density:m,isLoading:p}=i(),f=!o,v=f?g==="page"?a.getIsAllPageRowsSelected():a.getIsAllRowsSelected():void 0,x=f?v:no({row:o,table:a}),y=Object.assign(Object.assign({},f?fe(c,{table:a}):fe(u,{row:o,table:a})),r),w=o?lb({renderedRowIndex:t,row:o,table:a}):void 0,C=nd({table:a}),j=Object.assign(Object.assign({"aria-label":f?d.toggleSelectAll:d.toggleSelectRow,checked:x,disabled:p||o&&!o.getCanSelect()||(o==null?void 0:o.id)==="mrt-row-create",onChange:S=>{S.stopPropagation(),f?C(S):w(S)},size:m==="xs"?"sm":"md"},y),{onClick:S=>{var R;S.stopPropagation(),(R=y==null?void 0:y.onClick)===null||R===void 0||R.call(y,S)},title:void 0});return s.jsx(We,{label:(n=y==null?void 0:y.title)!==null&&n!==void 0?n:f?d.toggleSelectAll:d.toggleSelectRow,openDelay:1e3,withinPortal:!0,children:s.jsx("span",{children:h==="switch"?s.jsx(_l,Object.assign({},j)):h==="radio"||l===!1?s.jsx(Lu,Object.assign({},j)):s.jsx(bo,Object.assign({indeterminate:!x&&f?a.getIsSomeRowsSelected():(o==null?void 0:o.getIsSomeSelected())&&o.getCanSelectSubRows()},j))})})},ii=e=>{var n,t,o,{stackAlertBanner:a,table:r}=e,i=Ie(e,["stackAlertBanner","table"]);const{getFilteredSelectedRowModel:l,getPrePaginationRowModel:d,getState:c,options:{enableRowSelection:u,enableSelectAll:g,icons:{IconX:h},localization:m,mantineToolbarAlertBannerBadgeProps:p,mantineToolbarAlertBannerProps:f,manualPagination:v,positionToolbarAlertBanner:x,renderToolbarAlertBannerContent:y,rowCount:w}}=r,{density:C,grouping:j,rowSelection:S,showAlertBanner:R}=c(),_=Object.assign(Object.assign({},fe(f,{table:r})),i),T=fe(p,{table:r}),k=w??d().flatRows.length,I=b.useMemo(()=>v?Object.values(S).filter(Boolean).length:l().rows.length,[S,k,v]),E=I?s.jsxs(tt,{align:"center",gap:"sm",children:[(t=(n=m.selectedCountOfRowCountRowsSelected)===null||n===void 0?void 0:n.replace("{selectedCount}",I.toString()))===null||t===void 0?void 0:t.replace("{rowCount}",k.toString()),s.jsx(pt,{onClick:L=>nd({table:r})(L,!1,!0),size:"compact-xs",variant:"subtle",children:m.clearSelection})]}):null,V=j.length>0?s.jsxs(tt,{children:[m.groupedBy," ",j.map((L,B)=>s.jsxs(b.Fragment,{children:[B>0?m.thenBy:"",s.jsxs(ot,Object.assign({className:Hn["alert-badge"],rightSection:s.jsx(Oe,{color:"white",onClick:()=>r.getColumn(L).toggleGrouping(),size:"xs",variant:"subtle",children:s.jsx(h,{style:{transform:"scale(0.8)"}})}),variant:"filled"},T,{children:[r.getColumn(L).columnDef.header," "]}))]},`${B}-${L}`))]}):null;return s.jsx(ts,{in:R||!!E||!!V,transitionDuration:a?200:0,children:s.jsx(yo,Object.assign({color:"blue",icon:!1},_,{className:Ce(Hn.alert,a&&!x&&Hn["alert-stacked"],!a&&x==="bottom"&&Hn["alert-bottom"],_==null?void 0:_.className),children:(o=y==null?void 0:y({groupedAlert:V,selectedAlert:E,table:r}))!==null&&o!==void 0?o:s.jsxs(tt,{className:Ce(Hn["toolbar-alert"],x==="head-overlay"&&Hn["head-overlay"],C),children:[u&&g&&x==="head-overlay"&&s.jsx(Ha,{table:r}),s.jsxs(he,{children:[_==null?void 0:_.children,E,V]})]})}))})},Kb=e=>{var{columnVirtualizer:n,table:t}=e,o=Ie(e,["columnVirtualizer","table"]);const{getHeaderGroups:a,getSelectedRowModel:r,getState:i,options:{enableStickyHeader:l,layoutMode:d,mantineTableHeadProps:c,positionToolbarAlertBanner:u},refs:{tableHeadRef:g}}=t,{isFullScreen:h,showAlertBanner:m}=i(),p=Object.assign(Object.assign({},fe(c,{table:t})),o),f=l||h;return s.jsx(zr,Object.assign({},p,{className:Ce(mn.root,d!=null&&d.startsWith("grid")?mn["root-grid"]:mn["root-table-row-group"],f&&mn["root-sticky"],p==null?void 0:p.className),pos:f&&(d!=null&&d.startsWith("grid"))?"sticky":"relative",ref:v=>{g.current=v,p!=null&&p.ref&&(p.ref.current=v)},children:u==="head-overlay"&&(m||r().rows.length>0)?s.jsx(sn,{className:Ce(mn["banner-tr"],(d==null?void 0:d.startsWith("grid"))&&mn.grid),children:s.jsx(Xn,{className:Ce(mn["banner-th"],(d==null?void 0:d.startsWith("grid"))&&mn.grid),colSpan:t.getVisibleLeafColumns().length,children:s.jsx(ii,{table:t})})}):a().map(v=>s.jsx(Wb,{columnVirtualizer:n,headerGroup:v,table:t},v.id))}))};var ol={root:"MRT_GlobalFilterTextInput-module_root__Xmcpv",collapse:"MRT_GlobalFilterTextInput-module_collapse__v311d"};const Ca=e=>{var{table:n}=e,t=Ie(e,["table"]);const{getState:o,options:{enableGlobalFilterModes:a,icons:{IconSearch:r,IconX:i},localization:l,mantineSearchTextInputProps:d,manualFiltering:c,positionGlobalFilter:u},refs:{searchInputRef:g},setGlobalFilter:h}=n,{globalFilter:m,showGlobalFilter:p}=o(),f=Object.assign(Object.assign({},fe(d,{table:n})),t),v=b.useRef(!1),[x,y]=b.useState(m??""),[w]=Rl(x,c?500:250);b.useEffect(()=>{h(w||void 0)},[w]);const C=()=>{y(""),h(void 0)};return b.useEffect(()=>{v.current&&(m===void 0?C():y(m)),v.current=!0},[m]),s.jsxs(ts,{className:ol.collapse,in:p,children:[a&&s.jsxs(Te,{withinPortal:!0,children:[s.jsx(Te.Target,{children:s.jsx(Oe,{"aria-label":l.changeSearchMode,color:"gray",size:"sm",variant:"transparent",children:s.jsx(r,{})})}),s.jsx(Nd,{onSelect:C,table:n})]}),s.jsx(Ge,Object.assign({leftSection:!a&&s.jsx(r,{}),mt:0,mx:u!=="left"?"mx":void 0,onChange:j=>y(j.target.value),placeholder:l.search,rightSection:x?s.jsx(Oe,{"aria-label":l.clearSearch,color:"gray",disabled:!(x!=null&&x.length),onClick:C,size:"sm",variant:"transparent",children:s.jsx(We,{label:l.clearSearch,withinPortal:!0,children:s.jsx(i,{})})}):null,value:x??"",variant:"filled"},f,{className:Ce("mrt-global-filter-text-input",ol.root,f==null?void 0:f.className),ref:j=>{j&&(g.current=j,f!=null&&f.ref&&(f.ref=j))}}))]})},Yb=(e,n,t=-1,o=0,a,r)=>rs(e,"mrt-row-create",Object.assign({},...so(e.options.columns).map(i=>({[qn(i)]:""}))),t,o,a,r),Qb=e=>Object.assign({Cell:({cell:n,row:t,table:o})=>s.jsx(_b,{cell:n,row:t,table:o})},Ln({header:"actions",id:"mrt-row-actions",size:70,tableOptions:e})),Xb=e=>Object.assign({Cell:({row:n,rowRef:t,table:o})=>s.jsx(hb,{row:n,rowRef:t,table:o}),grow:!1},Ln({header:"move",id:"mrt-row-drag",size:60,tableOptions:e})),Zb=e=>{var n;const{defaultColumn:t,enableExpandAll:o,groupedColumnMode:a,positionExpandColumn:r,renderDetailPanel:i,state:{grouping:l}}=e,d=r==="last"?{align:"right"}:void 0;return Object.assign({Cell:({cell:c,column:u,row:g,table:h})=>{var m,p,f;const v={row:g,table:h},x=(m=g.subRows)===null||m===void 0?void 0:m.length;return e.groupedColumnMode==="remove"&&g.groupingColumnId?s.jsxs(tt,{align:"center",gap:"0.25rem",children:[s.jsx(Ba,Object.assign({},v)),s.jsx(We,{label:h.getColumn(g.groupingColumnId).columnDef.header,openDelay:1e3,position:"right",children:s.jsx("span",{children:g.groupingValue})}),!!x&&s.jsxs("span",{children:["(",x,")"]})]}):s.jsxs(s.Fragment,{children:[s.jsx(Ba,Object.assign({},v)),(f=(p=u.columnDef).GroupedCell)===null||f===void 0?void 0:f.call(p,{cell:c,column:u,row:g,table:h})]})},Header:o?({table:c})=>{var u;return s.jsxs(tt,{align:"center",children:[s.jsx(xb,{table:c}),a==="remove"&&((u=l==null?void 0:l.map(g=>c.getColumn(g).columnDef.header))===null||u===void 0?void 0:u.join(", "))]})}:void 0,mantineTableBodyCellProps:d,mantineTableHeadCellProps:d},Ln({header:"expand",id:"mrt-row-expand",size:a==="remove"?(n=t==null?void 0:t.size)!==null&&n!==void 0?n:180:i?o?60:70:100,tableOptions:e}))},Jb=e=>{const{localization:n,rowNumberDisplayMode:t}=e,{pagination:{pageIndex:o,pageSize:a}}=e.state;return Object.assign({Cell:({renderedRowIndex:r=0,row:i})=>{var l;return((l=t==="static"?r+a*o:i.index)!==null&&l!==void 0?l:0)+1},grow:!1,Header:()=>n.rowNumber},Ln({header:"rowNumbers",id:"mrt-row-numbers",size:50,tableOptions:e}))},ey=e=>Object.assign({Cell:({row:n,table:t})=>s.jsx(pb,{row:n,table:t}),grow:!1},Ln({header:"pin",id:"mrt-row-pin",size:60,tableOptions:e})),ty=e=>{const{enableMultiRowSelection:n,enableSelectAll:t}=e;return Object.assign({Cell:({renderedRowIndex:o,row:a,table:r})=>s.jsx(Ha,{renderedRowIndex:o,row:a,table:r}),grow:!1,Header:t&&n?({table:o})=>s.jsx(Ha,{table:o}):void 0},Ln({header:"select",id:"mrt-row-select",size:t?60:70,tableOptions:e}))},ny=Object.assign({},Ks),sy={IconArrowAutofitContent:Up,IconArrowsSort:qp,IconBaselineDensityLarge:Kp,IconBaselineDensityMedium:Qp,IconBaselineDensitySmall:Zp,IconBoxMultiple:ef,IconChevronDown:df,IconChevronLeft:hf,IconChevronLeftPipe:gf,IconChevronRight:Ur,IconChevronRightPipe:ff,IconChevronsDown:bf,IconCircleX:wf,IconClearAll:jf,IconColumns:_f,IconDeviceFloppy:Rf,IconDots:Hr,IconDotsVertical:kf,IconEdit:on,IconEyeOff:Pf,IconFilter:$f,IconFilterCog:Ef,IconFilterOff:Af,IconGripHorizontal:Vf,IconMaximize:n0,IconMinimize:o0,IconPinned:u0,IconPinnedOff:c0,IconSearch:ps,IconSearchOff:p0,IconSortAscending:x0,IconSortDescending:y0,IconX:yc},oy={actions:"Actions",and:"and",cancel:"Cancel",changeFilterMode:"Change filter mode",changeSearchMode:"Change search mode",clearFilter:"Clear filter",clearSearch:"Clear search",clearSelection:"Clear selection",clearSort:"Clear sort",clickToCopy:"Click to copy",copy:"Copy",collapse:"Collapse",collapseAll:"Collapse all",columnActions:"Column Actions",copiedToClipboard:"Copied to clipboard",dropToGroupBy:"Drop to group by {column}",edit:"Edit",expand:"Expand",expandAll:"Expand all",filterArrIncludes:"Includes",filterArrIncludesAll:"Includes all",filterArrIncludesSome:"Includes",filterBetween:"Between",filterBetweenInclusive:"Between Inclusive",filterByColumn:"Filter by {column}",filterContains:"Contains",filterEmpty:"Empty",filterEndsWith:"Ends With",filterEquals:"Equals",filterEqualsString:"Equals",filterFuzzy:"Fuzzy",filterGreaterThan:"Greater Than",filterGreaterThanOrEqualTo:"Greater Than Or Equal To",filterInNumberRange:"Between",filterIncludesString:"Contains",filterIncludesStringSensitive:"Contains",filterLessThan:"Less Than",filterLessThanOrEqualTo:"Less Than Or Equal To",filterMode:"Filter Mode: {filterType}",filterNotEmpty:"Not Empty",filterNotEquals:"Not Equals",filterStartsWith:"Starts With",filterWeakEquals:"Equals",filteringByColumn:"Filtering by {column} - {filterType} {filterValue}",goToFirstPage:"Go to first page",goToLastPage:"Go to last page",goToNextPage:"Go to next page",goToPreviousPage:"Go to previous page",grab:"Grab",groupByColumn:"Group by {column}",groupedBy:"Grouped by ",hideAll:"Hide all",hideColumn:"Hide {column} column",max:"Max",min:"Min",move:"Move",noRecordsToDisplay:"No records to display",noResultsFound:"No results found",of:"of",or:"or",pin:"Pin",pinToLeft:"Pin to left",pinToRight:"Pin to right",resetColumnSize:"Reset column size",resetOrder:"Reset order",rowActions:"Row Actions",rowNumber:"#",rowNumbers:"Row Numbers",rowsPerPage:"Rows per page",save:"Save",search:"Search",selectedCountOfRowCountRowsSelected:"{selectedCount} of {rowCount} row(s) selected",select:"Select",showAll:"Show all",showAllColumns:"Show all columns",showHideColumns:"Show/Hide columns",showHideFilters:"Show/Hide filters",showHideSearch:"Show/Hide search",sortByColumnAsc:"Sort by {column} ascending",sortByColumnDesc:"Sort by {column} descending",sortedByColumnAsc:"Sorted by {column} ascending",sortedByColumnDesc:"Sorted by {column} descending",thenBy:", then by ",toggleDensity:"Toggle density",toggleFullScreen:"Toggle full screen",toggleSelectAll:"Toggle select all",toggleSelectRow:"Toggle select row",toggleVisibility:"Toggle visibility",ungroupByColumn:"Ungroup by {column}",unpin:"Unpin",unpinAll:"Unpin all"},ay={filterVariant:"text",maxSize:1e3,minSize:40,size:180},Dd={columnDefType:"display",enableClickToCopy:!1,enableColumnActions:!1,enableColumnDragging:!1,enableColumnFilter:!1,enableColumnOrdering:!1,enableEditing:!1,enableGlobalFilter:!1,enableGrouping:!1,enableHiding:!1,enableResizing:!1,enableSorting:!1},ry=e=>{var n,{aggregationFns:t,autoResetExpanded:o=!1,columnFilterDisplayMode:a="subheader",columnResizeDirection:r,columnResizeMode:i="onChange",createDisplayMode:l="modal",defaultColumn:d,defaultDisplayColumn:c,editDisplayMode:u="modal",enableBatchRowSelection:g=!0,enableBottomToolbar:h=!0,enableColumnActions:m=!0,enableColumnFilters:p=!0,enableColumnOrdering:f=!1,enableColumnPinning:v=!1,enableColumnResizing:x=!1,enableColumnVirtualization:y,enableDensityToggle:w=!0,enableExpandAll:C=!0,enableExpanding:j,enableFacetedValues:S=!1,enableFilterMatchHighlighting:R=!0,enableFilters:_=!0,enableFullScreenToggle:T=!0,enableGlobalFilter:k=!0,enableGlobalFilterRankedResults:I=!0,enableGrouping:E=!1,enableHeaderActionsHoverReveal:V=!1,enableHiding:L=!0,enableMultiRowSelection:B=!0,enableMultiSort:M=!0,enablePagination:D=!0,enableRowPinning:O=!1,enableRowSelection:F=!1,enableRowVirtualization:$,enableSelectAll:z=!0,enableSorting:H=!0,enableStickyHeader:re=!1,enableTableFooter:ie=!0,enableTableHead:X=!0,enableToolbarInternalActions:oe=!0,enableTopToolbar:ne=!0,filterFns:J,icons:P,layoutMode:Q,localization:ce,manualFiltering:te,manualGrouping:W,manualPagination:me,manualSorting:le,paginationDisplayMode:de="default",positionActionsColumn:Y="first",positionCreatingRow:A="top",positionExpandColumn:se="first",positionGlobalFilter:be="right",positionPagination:ve="bottom",positionToolbarAlertBanner:Se="top",positionToolbarDropZone:we="top",rowNumberDisplayMode:U="static",rowPinningDisplayMode:G="sticky",selectAllMode:ae="page",sortingFns:Fe}=e,pe=Ie(e,["aggregationFns","autoResetExpanded","columnFilterDisplayMode","columnResizeDirection","columnResizeMode","createDisplayMode","defaultColumn","defaultDisplayColumn","editDisplayMode","enableBatchRowSelection","enableBottomToolbar","enableColumnActions","enableColumnFilters","enableColumnOrdering","enableColumnPinning","enableColumnResizing","enableColumnVirtualization","enableDensityToggle","enableExpandAll","enableExpanding","enableFacetedValues","enableFilterMatchHighlighting","enableFilters","enableFullScreenToggle","enableGlobalFilter","enableGlobalFilterRankedResults","enableGrouping","enableHeaderActionsHoverReveal","enableHiding","enableMultiRowSelection","enableMultiSort","enablePagination","enableRowPinning","enableRowSelection","enableRowVirtualization","enableSelectAll","enableSorting","enableStickyHeader","enableTableFooter","enableTableHead","enableToolbarInternalActions","enableTopToolbar","filterFns","icons","layoutMode","localization","manualFiltering","manualGrouping","manualPagination","manualSorting","paginationDisplayMode","positionActionsColumn","positionCreatingRow","positionExpandColumn","positionGlobalFilter","positionPagination","positionToolbarAlertBanner","positionToolbarDropZone","rowNumberDisplayMode","rowPinningDisplayMode","selectAllMode","sortingFns"]);const Z=On();return P=b.useMemo(()=>Object.assign(Object.assign({},sy),P),[P]),ce=b.useMemo(()=>Object.assign(Object.assign({},oy),ce),[ce]),t=b.useMemo(()=>Object.assign(Object.assign({},ny),t),[]),J=b.useMemo(()=>Object.assign(Object.assign({},Db),J),[]),Fe=b.useMemo(()=>Object.assign(Object.assign({},ab),Fe),[]),d=b.useMemo(()=>Object.assign(Object.assign({},ay),d),[d]),c=b.useMemo(()=>Object.assign(Object.assign({},Dd),c),[c]),[y,$]=b.useMemo(()=>[y,$],[]),r||(r=Z.dir||"ltr"),Q=Q||(x?"grid-no-grow":"semantic"),Q==="semantic"&&($||y)&&(Q="grid"),$&&(re=!0),D===!1&&me===void 0&&(me=!0),!((n=pe.data)===null||n===void 0)&&n.length||(te=!0,W=!0,me=!0,le=!0),Object.assign({aggregationFns:t,autoResetExpanded:o,columnFilterDisplayMode:a,columnResizeDirection:r,columnResizeMode:i,createDisplayMode:l,defaultColumn:d,defaultDisplayColumn:c,editDisplayMode:u,enableBatchRowSelection:g,enableBottomToolbar:h,enableColumnActions:m,enableColumnFilters:p,enableColumnOrdering:f,enableColumnPinning:v,enableColumnResizing:x,enableColumnVirtualization:y,enableDensityToggle:w,enableExpandAll:C,enableExpanding:j,enableFacetedValues:S,enableFilterMatchHighlighting:R,enableFilters:_,enableFullScreenToggle:T,enableGlobalFilter:k,enableGlobalFilterRankedResults:I,enableGrouping:E,enableHeaderActionsHoverReveal:V,enableHiding:L,enableMultiRowSelection:B,enableMultiSort:M,enablePagination:D,enableRowPinning:O,enableRowSelection:F,enableRowVirtualization:$,enableSelectAll:z,enableSorting:H,enableStickyHeader:re,enableTableFooter:ie,enableTableHead:X,enableToolbarInternalActions:oe,enableTopToolbar:ne,filterFns:J,getCoreRowModel:fv(),getExpandedRowModel:j||E?vv():void 0,getFacetedMinMaxValues:S?xv():void 0,getFacetedRowModel:S?wv():void 0,getFacetedUniqueValues:S?Cv():void 0,getFilteredRowModel:p||k||_?jv():void 0,getGroupedRowModel:E?Sv():void 0,getPaginationRowModel:D?Mv():void 0,getSortedRowModel:H?Rv():void 0,getSubRows:_e=>_e==null?void 0:_e.subRows,icons:P,layoutMode:Q,localization:ce,manualFiltering:te,manualGrouping:W,manualPagination:me,manualSorting:le,paginationDisplayMode:de,positionActionsColumn:Y,positionCreatingRow:A,positionExpandColumn:se,positionGlobalFilter:be,positionPagination:ve,positionToolbarAlertBanner:Se,positionToolbarDropZone:we,rowNumberDisplayMode:U,rowPinningDisplayMode:G,selectAllMode:ae,sortingFns:Fe},pe)},ja={children:null,style:{minWidth:0,padding:0,width:0}},iy=e=>Object.assign(Object.assign(Object.assign(Object.assign({},Ln({id:"mrt-row-spacer",size:0,tableOptions:e})),{grow:!0}),Dd),{mantineTableBodyCellProps:ja,mantineTableFooterCellProps:ja,mantineTableHeadCellProps:ja}),ly=e=>{const{getIsSomeRowsPinned:n,getPrePaginationRowModel:t,getState:o,options:{enablePagination:a,enableRowPinning:r,rowCount:i}}=e,{columnOrder:l,density:d,globalFilter:c,isFullScreen:u,isLoading:g,pagination:h,showSkeletons:m,sorting:p}=o(),f=e.options.columns.length,v=i??t().rows.length,x=b.useReducer(()=>({}),{})[1],y=b.useRef(),w=b.useRef();b.useEffect(()=>{typeof window<"u"&&(y.current=document.body.style.height)},[]),b.useEffect(()=>{if(typeof window<"u")if(u)w.current=document.body.getBoundingClientRect().top,document.body.style.height="100dvh";else{if(document.body.style.height=y.current,!w.current)return;window.scrollTo({behavior:"instant",top:-1*w.current})}},[u]),b.useEffect(()=>{f!==l.length&&e.setColumnOrder(si(e.options))},[f]),b.useEffect(()=>{if(!a||g||m)return;const{pageIndex:j,pageSize:S}=h,R=j*S;R>=v&&R>0&&e.setPageIndex(Math.ceil(v/S)-1)},[v]);const C=b.useRef(p);b.useEffect(()=>{p.length&&(C.current=p)},[p]),b.useEffect(()=>{td(e)&&(c?e.setSorting([]):e.setSorting(()=>C.current||[]))},[c]),b.useEffect(()=>{r&&n()&&setTimeout(()=>{x()},150)},[d])},cy=e=>{var n,t,o,a,r,i,l,d,c,u,g,h,m,p,f,v,x,y,w,C,j,S,R,_,T,k,I,E,V,L,B,M,D;const O=b.useRef(null),F=b.useRef(null),$=b.useRef({}),z=b.useRef({}),H=b.useRef(null),re=b.useRef(null),ie=b.useRef({}),X=b.useRef(null),oe=b.useRef(null),ne=b.useRef(null),J=b.useRef(null),P=b.useMemo(()=>{var it,dt,Gt;const qt=(it=e.initialState)!==null&&it!==void 0?it:{};return qt.columnOrder=(dt=qt.columnOrder)!==null&&dt!==void 0?dt:si(Object.assign(Object.assign({},e),{state:Object.assign(Object.assign({},e.initialState),e.state)})),qt.globalFilterFn=(Gt=e.globalFilterFn)!==null&&Gt!==void 0?Gt:"fuzzy",qt},[]);e.initialState=P;const[Q,ce]=b.useState((n=P.creatingRow)!==null&&n!==void 0?n:null),[te,W]=b.useState(()=>Object.assign({},...so(e.columns).map(it=>{var dt,Gt,qt,Vn;return{[qn(it)]:it.filterFn instanceof Function?(dt=it.filterFn.name)!==null&&dt!==void 0?dt:"custom":(Vn=(Gt=it.filterFn)!==null&&Gt!==void 0?Gt:(qt=P==null?void 0:P.columnFilterFns)===null||qt===void 0?void 0:qt[qn(it)])!==null&&Vn!==void 0?Vn:bb(it)}}))),[me,le]=b.useState((t=P.columnOrder)!==null&&t!==void 0?t:[]),[de,Y]=b.useState((o=P.columnSizingInfo)!==null&&o!==void 0?o:{}),[A,se]=b.useState((a=P==null?void 0:P.density)!==null&&a!==void 0?a:"md"),[be,ve]=b.useState((r=P.draggingColumn)!==null&&r!==void 0?r:null),[Se,we]=b.useState((i=P.draggingRow)!==null&&i!==void 0?i:null),[U,G]=b.useState((l=P.editingCell)!==null&&l!==void 0?l:null),[ae,Fe]=b.useState((d=P.editingRow)!==null&&d!==void 0?d:null),[pe,Z]=b.useState((c=P.globalFilterFn)!==null&&c!==void 0?c:"fuzzy"),[_e,Ae]=b.useState((u=P.grouping)!==null&&u!==void 0?u:[]),[Qe,nt]=b.useState((g=P.hoveredColumn)!==null&&g!==void 0?g:null),[et,ee]=b.useState((h=P.hoveredRow)!==null&&h!==void 0?h:null),[q,Re]=b.useState((m=P==null?void 0:P.isFullScreen)!==null&&m!==void 0?m:!1),[He,st]=b.useState((p=P==null?void 0:P.pagination)!==null&&p!==void 0?p:{pageIndex:0,pageSize:10}),[rt,nn]=b.useState((f=P==null?void 0:P.showAlertBanner)!==null&&f!==void 0?f:!1),[Dt,qe]=b.useState((v=P==null?void 0:P.showColumnFilters)!==null&&v!==void 0?v:!1),[is,Is]=b.useState((x=P==null?void 0:P.showGlobalFilter)!==null&&x!==void 0?x:!1),[ls,Je]=b.useState((y=P==null?void 0:P.showToolbarDropZone)!==null&&y!==void 0?y:!1);e.state=Object.assign({columnFilterFns:te,columnOrder:me,columnSizingInfo:de,creatingRow:Q,density:A,draggingColumn:be,draggingRow:Se,editingCell:U,editingRow:ae,globalFilterFn:pe,grouping:_e,hoveredColumn:Qe,hoveredRow:et,isFullScreen:q,pagination:He,showAlertBanner:rt,showColumnFilters:Dt,showGlobalFilter:is,showToolbarDropZone:ls},e.state);const xe=e,dn=b.useRef([]);xe.columns=xe.state.columnSizingInfo.isResizingColumn||xe.state.draggingColumn||xe.state.draggingRow?dn.current:rd({columnDefs:[...[cd(xe)&&ey(xe),dd(xe)&&Xb(xe),ni(xe)&&Qb(xe),ti(xe)&&Zb(xe),ud(xe)&&ty(xe),gd(xe)&&Jb(xe)].filter(Boolean),...xe.columns,...[md(xe)&&iy(xe)].filter(Boolean)],tableOptions:xe}),dn.current=xe.columns,xe.data=b.useMemo(()=>(xe.state.isLoading||xe.state.showSkeletons)&&!xe.data.length?[...Array(Math.min(xe.state.pagination.pageSize,20)).fill(null)].map(()=>Object.assign({},...so(xe.columns).map(it=>({[qn(it)]:null})))):xe.data,[xe.data,xe.state.isLoading,xe.state.showSkeletons]);const Ze=Nv(Object.assign(Object.assign({onColumnOrderChange:le,onColumnSizingInfoChange:Y,onGroupingChange:Ae,onPaginationChange:st},xe),{globalFilterFn:(w=xe.filterFns)===null||w===void 0?void 0:w[pe??"fuzzy"]}));return Ze.refs={bottomToolbarRef:F,editInputRefs:$,filterInputRefs:z,lastSelectedRowId:O,searchInputRef:H,tableContainerRef:re,tableFooterRef:J,tableHeadCellRefs:ie,tableHeadRef:ne,tablePaperRef:X,topToolbarRef:oe},Ze.setCreatingRow=it=>{let dt=it;it===!0&&(dt=Yb(Ze)),xe!=null&&xe.onCreatingRowChange?xe.onCreatingRowChange(dt):ce(dt)},Ze.setColumnFilterFns=(C=xe.onColumnFilterFnsChange)!==null&&C!==void 0?C:W,Ze.setDensity=(j=xe.onDensityChange)!==null&&j!==void 0?j:se,Ze.setDraggingColumn=(S=xe.onDraggingColumnChange)!==null&&S!==void 0?S:ve,Ze.setDraggingRow=(R=xe.onDraggingRowChange)!==null&&R!==void 0?R:we,Ze.setEditingCell=(_=xe.onEditingCellChange)!==null&&_!==void 0?_:G,Ze.setEditingRow=(T=xe.onEditingRowChange)!==null&&T!==void 0?T:Fe,Ze.setGlobalFilterFn=(k=xe.onGlobalFilterFnChange)!==null&&k!==void 0?k:Z,Ze.setHoveredColumn=(I=xe.onHoveredColumnChange)!==null&&I!==void 0?I:nt,Ze.setHoveredRow=(E=xe.onHoveredRowChange)!==null&&E!==void 0?E:ee,Ze.setIsFullScreen=(V=xe.onIsFullScreenChange)!==null&&V!==void 0?V:Re,Ze.setShowAlertBanner=(L=xe.onShowAlertBannerChange)!==null&&L!==void 0?L:nn,Ze.setShowColumnFilters=(B=xe.onShowColumnFiltersChange)!==null&&B!==void 0?B:qe,Ze.setShowGlobalFilter=(M=xe.onShowGlobalFilterChange)!==null&&M!==void 0?M:Is,Ze.setShowToolbarDropZone=(D=xe.onShowToolbarDropZoneChange)!==null&&D!==void 0?D:Je,ly(Ze),Ze},Td=e=>cy(ry(e));var dy={root:"MRT_TablePaper-module_root__q0v5L"},Sa={root:"MRT_TableContainer-module_root__JIsGB","root-sticky":"MRT_TableContainer-module_root-sticky__uC4qx","root-fullscreen":"MRT_TableContainer-module_root-fullscreen__aM8Jg"},al={root:"MRT_Table-module_root__ms2uS","root-grid":"MRT_Table-module_root-grid__2Pynz"};const uy=e=>{var n,t,o,a;const{getLeftLeafColumns:r,getRightLeafColumns:i,getState:l,getVisibleLeafColumns:d,options:{columnVirtualizerInstanceRef:c,columnVirtualizerOptions:u,enableColumnPinning:g,enableColumnVirtualization:h},refs:{tableContainerRef:m}}=e,{columnPinning:p,draggingColumn:f}=l();if(!h)return;const v=fe(u,{table:e}),x=d(),[y,w]=b.useMemo(()=>g?[r().map(k=>k.getPinnedIndex()),i().map(k=>x.length-k.getPinnedIndex()-1).sort((k,I)=>k-I)]:[[],[]],[x.length,p,g]),C=y.length,j=w.length,S=b.useMemo(()=>f!=null&&f.id?x.findIndex(k=>k.id===(f==null?void 0:f.id)):void 0,[f==null?void 0:f.id]),R=Oc(Object.assign({count:x.length,estimateSize:k=>x[k].getSize(),getScrollElement:()=>m.current,horizontal:!0,overscan:3,rangeExtractor:b.useCallback(k=>{const I=sd(k,S);return!C&&!j?I:[...new Set([...y,...I,...w])]},[y,w,S])},v)),_=R.getVirtualItems();R.virtualColumns=_;const T=_.length;if(T){const k=R.getTotalSize(),I=((n=_[C])===null||n===void 0?void 0:n.start)||0,E=((t=_[y.length-1])===null||t===void 0?void 0:t.end)||0,V=((o=_[T-j])===null||o===void 0?void 0:o.start)||0,L=((a=_[T-j-1])===null||a===void 0?void 0:a.end)||0;R.virtualPaddingLeft=I-E,R.virtualPaddingRight=k-L-(j?k-V:0)}return c&&(c.current=R),R},gy=e=>{var{table:n}=e,t=Ie(e,["table"]);const{getFlatHeaders:o,getState:a,options:{columns:r,enableTableFooter:i,enableTableHead:l,layoutMode:d,mantineTableProps:c,memoMode:u}}=n,{columnSizing:g,columnSizingInfo:h,columnVisibility:m,density:p}=a(),f=Object.assign(Object.assign({highlightOnHover:!0,horizontalSpacing:p,verticalSpacing:p},fe(c,{table:n})),t),v=b.useMemo(()=>{const j=o(),S={};for(let R=0;R<j.length;R++){const _=j[R],T=_.getSize();S[`--header-${Yt(_.id)}-size`]=T,S[`--col-${Yt(_.column.id)}-size`]=T}return S},[r,g,h,m]),y={columnVirtualizer:uy(n),table:n},{colorScheme:w}=vu(),{stripedColor:C}=f;return s.jsxs(Ut,Object.assign({className:Ce("mrt-table",al.root,(d==null?void 0:d.startsWith("grid"))&&al["root-grid"],f.className)},f,{__vars:Object.assign(Object.assign(Object.assign({},v),{"--mrt-striped-row-background-color":C,"--mrt-striped-row-hover-background-color":C?w==="dark"?gg(C,.08):xu(C,.12):void 0}),f.__vars),children:[l&&s.jsx(Kb,Object.assign({},y)),u==="table-body"||h.isResizingColumn?s.jsx(gb,Object.assign({},y,{tableProps:f})):s.jsx(od,Object.assign({},y,{tableProps:f})),i&&s.jsx(Nb,Object.assign({},y))]}))},my=e=>{var n,{open:t,table:o}=e,a=Ie(e,["open","table"]);const{getState:r,options:{mantineCreateRowModalProps:i,mantineEditRowModalProps:l,onCreatingRowCancel:d,onEditingRowCancel:c,renderCreateRowModalContent:u,renderEditRowModalContent:g},setCreatingRow:h,setEditingRow:m}=o,{creatingRow:p,editingRow:f}=r(),v=p??f,x={row:v,table:o},y=Object.assign(Object.assign(Object.assign({},fe(l,x)),p&&fe(i,x)),a),w=v.getAllCells().filter(j=>j.column.columnDef.columnDefType==="data").map(j=>s.jsx(Wo,{cell:j,table:o},j.id)),C=()=>{var j;p?(d==null||d({row:v,table:o}),h(null)):(c==null||c({row:v,table:o}),m(null)),v._valuesCache={},(j=y.onClose)===null||j===void 0||j.call(y)};return b.createElement(bl,Object.assign({opened:t,withCloseButton:!1},y,{key:v.id,onClose:C}),(n=p&&(u==null?void 0:u({internalEditComponents:w,row:v,table:o}))||(g==null?void 0:g({internalEditComponents:w,row:v,table:o})))!==null&&n!==void 0?n:s.jsxs(s.Fragment,{children:[s.jsx("form",{onSubmit:j=>j.preventDefault(),children:s.jsx(he,{gap:"lg",pb:24,pt:16,children:w})}),s.jsx(tt,{justify:"flex-end",children:s.jsx(ad,{row:v,table:o,variant:"text"})})]}))},hy=typeof window<"u"?b.useLayoutEffect:b.useEffect,py=e=>{var{table:n}=e,t=Ie(e,["table"]);const{getState:o,options:{createDisplayMode:a,editDisplayMode:r,enableStickyHeader:i,mantineLoadingOverlayProps:l,mantineTableContainerProps:d},refs:{bottomToolbarRef:c,tableContainerRef:u,topToolbarRef:g}}=n,{creatingRow:h,editingRow:m,isFullScreen:p,isLoading:f,showLoadingOverlay:v}=o(),[x,y]=b.useState(0),w=Object.assign(Object.assign({},fe(d,{table:n})),t),C=fe(l,{table:n});hy(()=>{var R,_,T,k;const I=typeof document<"u"&&(_=(R=g.current)===null||R===void 0?void 0:R.offsetHeight)!==null&&_!==void 0?_:0,E=typeof document<"u"&&(k=(T=c==null?void 0:c.current)===null||T===void 0?void 0:T.offsetHeight)!==null&&k!==void 0?k:0;y(I+E)});const j=a==="modal"&&h,S=r==="modal"&&m;return s.jsxs(K,Object.assign({},w,{__vars:Object.assign({"--mrt-top-toolbar-height":`${x}`},w==null?void 0:w.__vars),className:Ce("mrt-table-container",Sa.root,i&&Sa["root-sticky"],p&&Sa["root-fullscreen"],w==null?void 0:w.className),ref:R=>{R&&(u.current=R,w!=null&&w.ref&&(w.ref.current=R))},children:[s.jsx(_r,Object.assign({visible:f||v,zIndex:2},C)),s.jsx(gy,{table:n}),(j||S)&&s.jsx(my,{open:!0,table:n})]}))};var Id={"common-toolbar-styles":"common-styles-module_common-toolbar-styles__DnjR8"},ms={root:"MRT_BottomToolbar-module_root__VDeWo","root-fullscreen":"MRT_BottomToolbar-module_root-fullscreen__esE15","custom-toolbar-container":"MRT_BottomToolbar-module_custom-toolbar-container__XcDRF","paginator-container":"MRT_BottomToolbar-module_paginator-container__A3eWY","paginator-container-alert-banner":"MRT_BottomToolbar-module_paginator-container-alert-banner__gyqtO"},rl={collapse:"MRT_ProgressBar-module_collapse__rOLJH","collapse-top":"MRT_ProgressBar-module_collapse-top__oCi0h"};const Pd=e=>{var{isTopToolbar:n,table:t}=e,o=Ie(e,["isTopToolbar","table"]);const{getState:a,options:{mantineProgressProps:r}}=t,{isSaving:i,showProgressBars:l}=a(),d=Object.assign(Object.assign({},fe(r,{isTopToolbar:n,table:t})),o);return s.jsx(ts,{className:Ce(rl.collapse,n&&rl["collapse-top"]),in:i||l,children:s.jsx(as,Object.assign({animated:!0,"aria-busy":"true","aria-label":"Loading",radius:0,value:100},d))})};var _a={root:"MRT_TablePagination-module_root__yZ8pm",pagesize:"MRT_TablePagination-module_pagesize__-vmTn","with-top-margin":"MRT_TablePagination-module_with-top-margin__aM5-m"};const il=[5,10,15,20,25,30,50,100].map(e=>e.toString()),Fd=e=>{var n,{position:t="bottom",table:o}=e,a=Ie(e,["position","table"]);const{getPrePaginationRowModel:r,getState:i,options:{enableToolbarInternalActions:l,icons:{IconChevronLeft:d,IconChevronLeftPipe:c,IconChevronRight:u,IconChevronRightPipe:g},localization:h,mantinePaginationProps:m,paginationDisplayMode:p,rowCount:f},setPageIndex:v,setPageSize:x}=o,{pagination:{pageIndex:y=0,pageSize:w=10},showGlobalFilter:C}=i(),j=Object.assign(Object.assign({},fe(m,{table:o})),a),S=f??r().rows.length,R=Math.ceil(S/w),_=R>2,T=y*w,k=Math.min(y*w+w,S),I=j??{},{rowsPerPageOptions:E=il,showRowsPerPage:V=!0,withEdges:L=_}=I,B=Ie(I,["rowsPerPageOptions","showRowsPerPage","withEdges"]),M=t==="top"&&l&&!C;return s.jsxs(K,{className:Ce("mrt-table-pagination",_a.root,M&&_a["with-top-margin"]),children:[(j==null?void 0:j.showRowsPerPage)!==!1&&s.jsxs(Pe,{gap:"xs",children:[s.jsx(ue,{id:"rpp-label",children:h.rowsPerPage}),s.jsx(Jt,{allowDeselect:!1,"aria-labelledby":"rpp-label",className:_a.pagesize,data:(n=j==null?void 0:j.rowsPerPageOptions)!==null&&n!==void 0?n:il,onChange:D=>x(+D),value:w.toString()})]}),p==="pages"?s.jsx(Bt,Object.assign({firstIcon:c,lastIcon:g,nextIcon:u,onChange:D=>v(D-1),previousIcon:d,total:R,value:y+1,withEdges:L},B)):p==="default"?s.jsxs(s.Fragment,{children:[s.jsx(ue,{children:`${k===0?0:(T+1).toLocaleString()}-${k.toLocaleString()} ${h.of} ${S.toLocaleString()}`}),s.jsxs(Pe,{gap:6,children:[L&&s.jsx(Oe,{"aria-label":h.goToFirstPage,color:"gray",disabled:y<=0,onClick:()=>v(0),variant:"subtle",children:s.jsx(c,{})}),s.jsx(Oe,{"aria-label":h.goToPreviousPage,color:"gray",disabled:y<=0,onClick:()=>v(y-1),variant:"subtle",children:s.jsx(d,{})}),s.jsx(Oe,{"aria-label":h.goToNextPage,color:"gray",disabled:k>=S,onClick:()=>v(y+1),variant:"subtle",children:s.jsx(u,{})}),L&&s.jsx(Oe,{"aria-label":h.goToLastPage,color:"gray",disabled:k>=S,onClick:()=>v(R-1),variant:"subtle",children:s.jsx(g,{})})]})]}):null]})};var ll={root:"MRT_ToolbarDropZone-module_root__eGTXb",hovered:"MRT_ToolbarDropZone-module_hovered__g7PeJ"};const Ed=e=>{var{table:n}=e,t=Ie(e,["table"]);const{getState:o,options:{enableGrouping:a,localization:r},setHoveredColumn:i,setShowToolbarDropZone:l}=n,{draggingColumn:d,grouping:c,hoveredColumn:u,showToolbarDropZone:g}=o(),h=m=>{i({id:"drop-zone"})};return b.useEffect(()=>{var m;((m=n.options.state)===null||m===void 0?void 0:m.showToolbarDropZone)!==void 0&&l(!!a&&!!d&&d.columnDef.enableGrouping!==!1&&!c.includes(d.id))},[a,d,c]),s.jsx(Jn,{mounted:g,transition:"fade",children:()=>{var m,p;return s.jsx(tt,Object.assign({className:Ce("mrt-toolbar-dropzone",ll.root,(u==null?void 0:u.id)==="drop-zone"&&ll.hovered),onDragEnter:h},t,{children:s.jsx(ue,{children:r.dropToGroupBy.replace("{column}",(p=(m=d==null?void 0:d.columnDef)===null||m===void 0?void 0:m.header)!==null&&p!==void 0?p:"")})}))}})},fy=e=>{var{table:n}=e,t=Ie(e,["table"]);const{getState:o,options:{enablePagination:a,mantineBottomToolbarProps:r,positionPagination:i,positionToolbarAlertBanner:l,positionToolbarDropZone:d,renderBottomToolbarCustomActions:c},refs:{bottomToolbarRef:u}}=n,{isFullScreen:g}=o(),h=Na("(max-width: 720px)"),m=Object.assign(Object.assign({},fe(r,{table:n})),t),p=h||!!c;return s.jsxs(K,Object.assign({},m,{className:Ce("mrt-bottom-toolbar",ms.root,Id["common-toolbar-styles"],g&&ms["root-fullscreen"],m==null?void 0:m.className),ref:f=>{f&&(u.current=f,m!=null&&m.ref&&(m.ref.current=f))},children:[s.jsx(Pd,{isTopToolbar:!1,table:n}),l==="bottom"&&s.jsx(ii,{stackAlertBanner:p,table:n}),["both","bottom"].includes(d??"")&&s.jsx(Ed,{table:n}),s.jsxs(K,{className:ms["custom-toolbar-container"],children:[c?c({table:n}):s.jsx("span",{}),s.jsx(K,{className:Ce(ms["paginator-container"],p&&ms["paginator-container-alert-banner"]),children:a&&["both","bottom"].includes(i??"")&&s.jsx(Fd,{position:"bottom",table:n})})]})]}))};var Vs={root:"MRT_TopToolbar-module_root__r4-V9","root-fullscreen":"MRT_TopToolbar-module_root-fullscreen__3itT8","actions-container":"MRT_TopToolbar-module_actions-container__-uL0u","actions-container-stack-alert":"MRT_TopToolbar-module_actions-container-stack-alert__OYDL6"},vy={root:"MRT_ToolbarInternalButtons-module_root__NKoUG"};const xy=e=>{var n,{table:t}=e,o=Ie(e,["table"]);const{options:{columnFilterDisplayMode:a,enableColumnFilters:r,enableColumnOrdering:i,enableColumnPinning:l,enableDensityToggle:d,enableFilters:c,enableFullScreenToggle:u,enableGlobalFilter:g,enableHiding:h,initialState:m,renderToolbarInternalActions:p}}=t;return s.jsx(tt,Object.assign({},o,{className:Ce("mrt-toolbar-internal-buttons",vy.root,o==null?void 0:o.className),children:(n=p==null?void 0:p({table:t}))!==null&&n!==void 0?n:s.jsxs(s.Fragment,{children:[c&&g&&!(m!=null&&m.showGlobalFilter)&&s.jsx(xd,{table:t}),c&&r&&a!=="popover"&&s.jsx(fd,{table:t}),(h||i||l)&&s.jsx(hd,{table:t}),d&&s.jsx(pd,{table:t}),u&&s.jsx(vd,{table:t})]})}))},by=e=>{var n,{table:t}=e,o=Ie(e,["table"]);const{getState:a,options:{enableGlobalFilter:r,enablePagination:i,enableToolbarInternalActions:l,mantineTopToolbarProps:d,positionGlobalFilter:c,positionPagination:u,positionToolbarAlertBanner:g,positionToolbarDropZone:h,renderTopToolbarCustomActions:m},refs:{topToolbarRef:p}}=t,{isFullScreen:f,showGlobalFilter:v}=a(),x=Na("(max-width:720px)"),y=Na("(max-width:1024px)"),w=Object.assign(Object.assign({},fe(d,{table:t})),o),C=x||!!m||v&&y,j={style:y?void 0:{zIndex:3},table:t};return s.jsxs(K,Object.assign({},w,{className:Ce(Id["common-toolbar-styles"],Vs.root,f&&Vs["root-fullscreen"],w==null?void 0:w.className),ref:S=>{S&&(p.current=S,w!=null&&w.ref&&(w.ref.current=S))},children:[g==="top"&&s.jsx(ii,{stackAlertBanner:C,table:t}),["both","top"].includes(h??"")&&s.jsx(Ed,{table:t}),s.jsxs(tt,{className:Ce(Vs["actions-container"],C&&Vs["actions-container-stack-alert"]),children:[r&&c==="left"&&s.jsx(Ca,Object.assign({},j)),(n=m==null?void 0:m({table:t}))!==null&&n!==void 0?n:s.jsx("span",{}),l?s.jsxs(tt,{justify:"end",wrap:"wrap-reverse",children:[r&&c==="right"&&s.jsx(Ca,Object.assign({},j)),s.jsx(xy,{table:t})]}):r&&c==="right"&&s.jsx(Ca,Object.assign({},j))]}),i&&["both","top"].includes(u??"")&&s.jsx(tt,{justify:"end",children:s.jsx(Fd,{position:"top",table:t})}),s.jsx(Pd,{isTopToolbar:!0,table:t})]}))},yy=e=>{var n,t,{table:o}=e,a=Ie(e,["table"]);const{getState:r,options:{enableBottomToolbar:i,enableTopToolbar:l,mantinePaperProps:d,renderBottomToolbar:c,renderTopToolbar:u},refs:{tablePaperRef:g}}=o,{isFullScreen:h}=r(),m=Object.assign(Object.assign({},fe(d,{table:o})),a);return s.jsxs(Qt,Object.assign({shadow:"xs",withBorder:!0},m,{className:Ce("mrt-table-paper",dy.root,h&&"mrt-table-paper-fullscreen",m==null?void 0:m.className),ref:p=>{g.current=p,m!=null&&m.ref&&(m.ref.current=p)},style:p=>Object.assign(Object.assign({zIndex:h?200:void 0},fe(m==null?void 0:m.style,p)),h?{border:0,borderRadius:0,bottom:0,height:"100vh",left:0,margin:0,maxHeight:"100vh",maxWidth:"100vw",padding:0,position:"fixed",right:0,top:0,width:"100vw"}:null),children:[l&&((n=fe(u,{table:o}))!==null&&n!==void 0?n:s.jsx(by,{table:o})),s.jsx(py,{table:o}),i&&((t=fe(c,{table:o}))!==null&&t!==void 0?t:s.jsx(fy,{table:o}))]}))},wy=e=>e.table!==void 0,Cy=e=>{let n;return wy(e)?n=e.table:n=Td(e),s.jsx(yy,{table:n})};function jy(){var t;const{i18n:e}=vl();return{language:(t=e.language)!=null&&t.startsWith("am")?"am":"en"}}function Sy(e){return e.language}function _y({columns:e,data:n,options:t={},loading:o=!1,emptyMessage:a="No records found",serverPagination:r,onRefresh:i,...l}){var D,O;const{language:d}=jy(),c=t,u=b.useMemo(()=>e.filter(F=>{const $=Sy(F);return!$||$===d}),[e,d]),g=(r==null?void 0:r.state)??((D=l.state)==null?void 0:D.pagination)??((O=l.initialState)==null?void 0:O.pagination)??{pageSize:10,pageIndex:0},[h,m]=b.useState(),p=1e3,[f,v]=b.useState(g),x=["5","10","20","50","100","200","500","1000","2000"],{mantineTableProps:y,mantinePaperProps:w,mantineTableContainerProps:C,mantineTopToolbarProps:j,mantineBottomToolbarProps:S,mantineSearchTextInputProps:R,mantinePaginationProps:_,mantineLoadingOverlayProps:T,mantineSelectAllCheckboxProps:k,mantineSelectCheckboxProps:I,...E}=l,V=E.renderTopToolbarCustomActions,L=({table:F})=>{var W;const $=(W=E.renderToolbarInternalActions)==null?void 0:W.call(E,{table:F}),z=c.withTableRefresher?s.jsx(Pe,{gap:"xs",align:"center",children:c.withTableRefresher&&s.jsx(We,{label:"Refresh table",children:s.jsx(pt,{"aria-label":"Refresh table",variant:"light",size:"compact-xs",leftSection:s.jsx(bc,{size:14}),onClick:()=>{var de;if(i){i();return}const me=r?r.state.pageIndex:f.pageIndex??g.pageIndex,le=r?r.state.pageSize:f.pageSize??g.pageSize;r?r.onChange({pageIndex:me,pageSize:le}):F.setPageSize&&(F.setPageSize(Number(le)),(de=F.setPageIndex)==null||de.call(F,me))},children:"Refresh"})})}):null,{options:{columnFilterDisplayMode:H,enableColumnFilters:re,enableColumnOrdering:ie,enableColumnPinning:X,enableDensityToggle:oe,enableFilters:ne,enableFullScreenToggle:J,enableGlobalFilter:P,enableHiding:Q,initialState:ce}}=F,te=s.jsxs(s.Fragment,{children:[ne&&P&&!(ce!=null&&ce.showGlobalFilter)&&s.jsx(xd,{table:F}),ne&&re&&H!=="popover"&&s.jsx(fd,{table:F}),(Q||ie||X)&&s.jsx(hd,{table:F}),oe&&s.jsx(pd,{table:F}),J&&s.jsx(vd,{table:F})]});if(!(!$&&!z))return s.jsxs(Pe,{gap:"xs",align:"center",children:[$,te,z]})},B=({table:F})=>{var X,oe;if(!c.allowCustomRowsPerPage)return(X=E.renderBottomToolbarCustomActions)==null?void 0:X.call(E,{table:F});const $=!!r,z=$?r.rowCount??0:Array.isArray(n)?n.length:0,{pageIndex:H=0,pageSize:re=g.pageSize}=$?r.state:f,ie=Math.max(1,Math.ceil(z/(re||g.pageSize)));return s.jsxs(Pe,{align:"center",gap:"xs",style:{display:"flex",width:"100%",justifyContent:"flex-end"},children:[s.jsx(ue,{children:`${Math.min(z,H*re+1)}-${Math.min(z,(H+1)*re)} of ${z}`}),s.jsxs(Pe,{gap:"xs",style:{alignItems:"center"},children:[s.jsx(ue,{id:"rpp-label",children:((oe=F.options.localization)==null?void 0:oe.rowsPerPage)??"Rows per page"}),(()=>{const ne=x.includes(String(re))?String(re):"Custom";return s.jsxs(Pe,{align:"center",gap:"xs",children:[s.jsx(Jt,{data:[...x,"Custom"],value:ne,onChange:J=>{if(J)if(J==="Custom"||J==="custom")m($?r.state.pageSize:f.pageSize??g.pageSize);else{const P=Number(J);v({pageIndex:0,pageSize:P}),m(void 0),r&&r.onChange({pageIndex:0,pageSize:P})}},size:"xs",comboboxProps:{withinPortal:!0},style:{width:96}}),(!x.includes(String(re))||h!==void 0)&&s.jsx(Fr,{size:"xs",value:h??re,onChange:J=>m(J===""||J==null?void 0:Number(J)),onBlur:()=>{const J=h??re??g.pageSize,P=Math.min(Math.max(1,Number(J)),p);r?r.onChange({pageIndex:0,pageSize:P}):v({pageIndex:0,pageSize:P}),m(void 0)},onKeyDown:J=>{if(J.key==="Enter"){J.preventDefault();const P=h??re??g.pageSize,Q=Math.min(Math.max(1,Number(P)),p);r?r.onChange({pageIndex:0,pageSize:Q}):v({pageIndex:0,pageSize:Q}),m(void 0)}},min:1,max:p,styles:{input:{width:88}},"aria-labelledby":"rpp-label",placeholder:`Max ${p}`})]})})()]}),s.jsx(Bt,{total:ie,value:H+1,onChange:ne=>{const J=ne-1;r?r.onChange({pageIndex:J,pageSize:re??g.pageSize}):v(P=>({...P,pageIndex:J}))},size:"sm"})]})},M=Td({...E,columns:u,data:c.allowCustomRowsPerPage&&!r&&Array.isArray(n)?n.slice((f.pageIndex??0)*(f.pageSize??10),(f.pageIndex??0)*(f.pageSize??10)+(f.pageSize??10)):n,state:{...E.state,...r?{pagination:g}:c.allowCustomRowsPerPage?{pagination:f}:{},isLoading:o},layoutMode:"grid",enablePagination:c.allowCustomRowsPerPage?!1:c.pagination??!0,manualPagination:r?!0:E.manualPagination,rowCount:(r==null?void 0:r.rowCount)??(c.allowCustomRowsPerPage&&Array.isArray(n)?n.length:E.rowCount),onPaginationChange:r?F=>{const $=typeof F=="function"?F(g):F;r.onChange($)}:E.onPaginationChange,paginationDisplayMode:"pages",initialState:{density:"xs",pagination:g,showGlobalFilter:!0,...E.initialState},enableFilters:c.filters??!0,enableGlobalFilter:c.globalFilter??!0,enableColumnFilters:c.columnFilters??!0,columnFilterDisplayMode:"popover",positionGlobalFilter:"left",enableSorting:c.sorting??!0,enableMultiSort:c.multiSort??!0,enableColumnActions:c.columnActions??!0,enableColumnOrdering:c.columnOrdering??!0,enableColumnResizing:c.columnResizing??!0,columnResizeMode:"onChange",enableRowSelection:c.rowSelection??!0,enableSelectAll:c.selectAll??!0,positionToolbarAlertBanner:"bottom",enableDensityToggle:c.densityToggle??!0,enableFullScreenToggle:c.fullScreenToggle??!0,enableHiding:c.hiding??!0,enableTopToolbar:c.topToolbar??!0,enableBottomToolbar:c.bottomToolbar??!0,positionPagination:"bottom",renderEmptyRowsFallback:()=>s.jsx("div",{style:{textAlign:"center",padding:"2rem",color:"var(--mantine-color-dimmed)"},children:a}),renderTopToolbarCustomActions:V,renderToolbarInternalActions:L,renderBottomToolbarCustomActions:B,mantineTableProps:{striped:"odd",highlightOnHover:!0,withTableBorder:!1,withColumnBorders:!1,fz:"sm",...y},mantinePaperProps:{shadow:"none",withBorder:!1,radius:0,...w,style:{height:"100%",display:"flex",flexDirection:"column",...w==null?void 0:w.style}},mantineTableContainerProps:{...C,style:{flex:1,minHeight:0,...C==null?void 0:C.style}},mantineTopToolbarProps:{...j,style:{paddingInline:"1rem",...j==null?void 0:j.style}},mantineBottomToolbarProps:{...S,style:{paddingInline:"1rem",...S==null?void 0:S.style}},mantineSearchTextInputProps:{placeholder:"Search all columns...",...R,style:{minWidth:240,...R==null?void 0:R.style}},mantinePaginationProps:{showRowsPerPage:!c.allowCustomRowsPerPage,rowsPerPageOptions:x,..._},mantineLoadingOverlayProps:{loaderProps:{type:"dots"},...T},mantineSelectAllCheckboxProps:{size:"sm",...k},mantineSelectCheckboxProps:{size:"sm",...I},getRowId:E.getRowId??((F,$)=>String((F==null?void 0:F.id)??$))});return s.jsx(Cy,{table:M})}const My="_content_1b0ut_1",Ry="_modalBody_1b0ut_17",Ny="_shell_1b0ut_35",ky="_header_1b0ut_53",Dy="_headerView_1b0ut_73",Ty="_headerEdit_1b0ut_81",Iy="_iconWrap_1b0ut_89",Py="_body_1b0ut_113",Fy="_footer_1b0ut_125",Ey="_status_1b0ut_145",Oy="_statusDot_1b0ut_159",Ay="_statusDotEdit_1b0ut_173",zy="_actions_1b0ut_181",$y="_bodyView_1b0ut_189",Ly="_bodyEdit_1b0ut_285",mt={content:My,modalBody:Ry,shell:Ny,header:ky,headerView:Dy,headerEdit:Ty,iconWrap:Iy,body:Py,footer:Fy,status:Ey,statusDot:Oy,statusDotEdit:Ay,actions:zy,bodyView:$y,bodyEdit:Ly};function Vy(e){return e.toLowerCase()==="edit"}function jt({opened:e,onClose:n,mode:t,headerIcon:o,title:a,referenceId:r,footerStatusLabel:i,actions:l,children:d,bodyClassName:c,footerLeftSection:u,size:g="lg",centered:h=!0,radius:m="md",padding:p=0,styles:f,classNames:v,transitionProps:x,...y}){const w=Vy(t);return s.jsx(bl,{opened:e,onClose:n,withCloseButton:!1,size:g,centered:h,radius:m,padding:p,classNames:{...v,content:[mt.content,v==null?void 0:v.content].filter(Boolean).join(" "),body:[mt.modalBody,v==null?void 0:v.body].filter(Boolean).join(" ")},styles:{content:{maxWidth:"calc(100vw - 1.5rem)"},...f},transitionProps:x??{transition:"pop",duration:250,timingFunction:"ease"},...y,children:s.jsxs(K,{className:mt.shell,children:[s.jsxs(Pe,{justify:"space-between",align:"center",gap:"md",px:"lg",py:"md",className:`${mt.header} ${w?mt.headerEdit:mt.headerView}`,children:[s.jsxs(Pe,{gap:"sm",align:"flex-start",wrap:"nowrap",children:[s.jsx(K,{className:mt.iconWrap,children:o}),s.jsxs(he,{gap:2,children:[s.jsx(ue,{fw:700,size:"md",style:{color:"light-dark(var(--um-modal-title, var(--mantine-color-fhcGray-9)), #f1f5f9)"},children:a}),r&&s.jsx(ue,{size:"xs",c:"dimmed",children:r})]})]}),s.jsx(Oe,{"aria-label":"Close modal",variant:"subtle",color:"gray",onClick:n,children:s.jsx(yc,{size:18})})]}),s.jsx(K,{className:[mt.body,w?mt.bodyEdit:mt.bodyView,c].filter(Boolean).join(" "),children:d}),s.jsxs(Pe,{justify:"space-between",px:"md",py:"sm",className:mt.footer,children:[s.jsxs(Pe,{gap:"xs",wrap:"nowrap",className:mt.status,children:[s.jsx(K,{className:`${mt.statusDot} ${w?mt.statusDotEdit:""}`}),s.jsx(ue,{size:"xs",fw:600,children:i}),u]}),s.jsx(Pe,{gap:"sm",justify:"flex-end",className:mt.actions,children:l.map(({label:C,key:j,onClick:S,dismiss:R,..._},T)=>s.jsx(pt,{type:_.type??"button",onClick:k=>{S==null||S(k),!k.defaultPrevented&&R&&n()},..._,children:C},j??T))})]})]})})}function Me(e){return e?typeof e=="string"?e:e.en||e.am||"Untitled":"Untitled"}function li(e,...n){const t=e.trim().toLowerCase();return t?n.some(o=>o==null?void 0:o.toLowerCase().includes(t)):!0}function zt(e){return e.trim().toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").replace(/-{2,}/g,"-")}function Od(e){var n;return{id:e.id,label:Me(e.name),kind:"department",count:((n=e.subPositions)==null?void 0:n.length)??0,parentId:e.parentPositionId??void 0,raw:e,children:(e.subPositions??[]).map(Od)}}function Ad(e){return e.reduce((n,t)=>n+1+Ad(t.subPositions??[]),0)}function By(e){const{organizations:n,units:t,positions:o,selectedOrganizationId:a,selectedUnitId:r}=e;return n.map(i=>({id:i.id,label:Me(i.name),kind:"organization",raw:i,count:i.id===a?t.length:void 0,children:i.id===a?t.filter(l=>l.organizationId===i.id).map(l=>({id:l.id,label:Me(l.name),kind:"unit",raw:l,parentId:i.id,count:l.id===r?Ad(o):void 0,children:l.id===r?o.map(Od):[]})):[]}))}function Bs({label:e,value:n}){return s.jsxs(he,{gap:4,children:[s.jsx(ue,{size:"xs",tt:"uppercase",fw:700,c:"fhcGray.5",children:e}),s.jsx(ue,{size:"sm",fw:600,c:"fhcGray.8",children:n})]})}function Uy({employee:e,opened:n,onClose:t}){const o=Me(e==null?void 0:e.user.name);return s.jsx(jt,{opened:n,onClose:t,mode:"View",title:"Team Member Details",headerIcon:s.jsx(N0,{size:18}),referenceId:e==null?void 0:e.id,footerStatusLabel:"Synced with user management",actions:[{label:"Close",variant:"light",dismiss:!0}],children:e?s.jsxs(he,{gap:"lg",p:"lg",children:[s.jsxs(Pe,{gap:"md",wrap:"nowrap",children:[s.jsx(uo,{radius:"xl",size:56,color:"fhcBlue",children:o.charAt(0).toUpperCase()}),s.jsxs(he,{gap:2,children:[s.jsx(ue,{size:"lg",fw:700,c:"fhcGray.9",children:o}),s.jsxs(Pe,{gap:"xs",children:[s.jsx(ot,{color:e.isCurrent?"green":"gray",children:e.isCurrent?"Current assignment":"Not current"}),s.jsx(ot,{variant:"light",color:"fhcBlue",children:e.status||e.user.status||"Unknown"})]})]})]}),s.jsxs(Io,{cols:{base:1,sm:2},spacing:"lg",children:[s.jsx(Bs,{label:"Email",value:e.user.email||"No email provided"}),s.jsx(Bs,{label:"Phone",value:e.user.phoneNumber||"No phone provided"}),s.jsx(Bs,{label:"Username",value:e.user.username||"No username provided"}),s.jsx(Bs,{label:"User Type",value:e.user.userType||"employee"})]}),s.jsxs(Pe,{gap:"xl",c:"fhcGray.6",children:[s.jsxs(Pe,{gap:6,children:[s.jsx(e0,{size:16}),s.jsx(ue,{size:"sm",children:"Primary contact"})]}),s.jsxs(Pe,{gap:6,children:[s.jsx(r0,{size:16}),s.jsx(ue,{size:"sm",children:"Phone enabled"})]}),s.jsxs(Pe,{gap:6,children:[s.jsx(nf,{size:16}),s.jsx(ue,{size:"sm",children:"Position-linked access"})]})]})]}):null})}(()=>{const e="".trim().replace(/\/+$/,"").replace(/\/docs$/,"");return e?e.endsWith("/api")?e:`${e}/api`:null})();class Hy extends Error{constructor(t,o){super(t);hi(this,"status");this.name="UserManagementApiError",this.status=o}}function Gy(e){var l,d,c,u;const n=e,t=((l=n==null?void 0:n.response)==null?void 0:l.status)??0,o=`Request failed with status ${t||"unknown"}`,a=(d=n==null?void 0:n.response)==null?void 0:d.data,r=(u=(c=a==null?void 0:a.exception)==null?void 0:c.response)==null?void 0:u.message,i=(Array.isArray(r)?r.join(", "):r)||(Array.isArray(a==null?void 0:a.message)?a.message.join(", "):a==null?void 0:a.message)||(n==null?void 0:n.message)||o;return new Hy(i,t)}async function qy(e,n){const t={url:e,method:(n==null?void 0:n.method)??"GET",headers:n==null?void 0:n.headers};(n==null?void 0:n.body)!==void 0&&(t.data=JSON.parse(n.body));try{return(await Ra.request(t)).data}catch(o){throw Gy(o)}}async function at(e,n){return qy(e,n)}async function Wy(){return at("/organizations/with-admin-flag?take=3000&skip=0")}async function Ky(e){return at(`/organizations/${e}`)}async function Yy(e,n){return at(`/organizations/${e}`,{method:"PUT",body:JSON.stringify(n)})}async function Qy(e){return at(`/organizations/${e}`,{method:"DELETE"})}async function Xy(e){return at(`/units/list/${e}?take=100&skip=0`)}async function Zy(e){return at("/units",{method:"POST",body:JSON.stringify(e)})}async function Jy(e,n){return at(`/units/${e}`,{method:"PUT",body:JSON.stringify(n)})}async function ew(e){return at(`/units/${e}`,{method:"DELETE"})}async function tw(e){return at(`/positions/hierarchy/${e}`)}async function nw(e){return at(`/position-types/list-with-commons/${e}?take=1000&skip=0&orderBy=createdAt:Desc`)}async function sw(e){return at(`/position-types/list/${e}?take=1000&skip=0&orderBy=createdAt:Desc`)}async function ow(e){return at("/positions",{method:"POST",body:JSON.stringify(e)})}async function aw(e,n){return at(`/positions/${e}`,{method:"PUT",body:JSON.stringify(n)})}async function rw(e){return at("/positions/change-parent",{method:"PATCH",body:JSON.stringify(e)})}async function iw(e){return at(`/positions/${e}`,{method:"DELETE"})}async function lw(e){return at("/employee-positions/invite",{method:"POST",body:JSON.stringify(e)})}async function cw(e){return at("/employee-positions/assign",{method:"POST",body:JSON.stringify(e)})}async function dw(e){const n=await at(`/employees/${e}/active-with-unit?take=3000&skip=0`);return{count:n.count,items:n.items.map(t=>{var o;return{id:t.id,name:t.name??{},email:t.email??void 0,employee:(o=t.employee)==null?void 0:o.map(a=>({id:a.id,name:a.name??{},employeePositions:a.employeePositions??[]}))}})}}async function uw(e){const n=await at(`/employees/${e}/by-organization?take=3000`);return{count:n.count,items:n.items.map(t=>({id:t.id,organizationId:e,isCurrent:!0,status:"Active",user:{id:t.user.id,name:t.user.name??t.name,email:t.user.email??void 0,phoneNumber:t.user.phoneNumber??void 0},employeePositions:t.employeePositions}))}}async function gw(e){return at(`/positions/current/${e}/employees`)}function mw(){return Ot({queryKey:["user-management","organizations"],queryFn:Wy,staleTime:300*1e3})}function hw(e,n){return Ot({queryKey:["user-management","organization",e],queryFn:()=>Ky(e),enabled:!!e&&!(n!=null&&n.skip),staleTime:60*1e3})}function pw(){const e=kt(),n=Zt({mutationFn:o=>Yy(o.id,o.body),onSuccess:(o,a)=>{e.invalidateQueries({queryKey:["user-management","organizations"]}),e.invalidateQueries({queryKey:["user-management","organization",a.id]})}});return[o=>({unwrap:()=>n.mutateAsync(o)}),{isLoading:n.isPending}]}function fw(){const e=kt(),n=Zt({mutationFn:o=>Qy(o),onSuccess:()=>{e.invalidateQueries({queryKey:["user-management","organizations"]})}});return[o=>({unwrap:()=>n.mutateAsync(o)}),{isLoading:n.isPending}]}function vw(e){return Ot({queryKey:["user-management","units",e],queryFn:()=>Xy(e),enabled:!!e,staleTime:300*1e3})}function xw(e){return Ot({queryKey:["user-management","positions",e],queryFn:()=>tw(e),enabled:!!e,staleTime:60*1e3})}function ci(e,n=!1){return Ot({queryKey:["user-management","position-types",e,n],queryFn:()=>n?sw(e):nw(e),enabled:!!e,staleTime:300*1e3})}function bw(e,n=!0){return Ot({queryKey:["user-management","organization-employees",e],queryFn:()=>uw(e),enabled:!!e&&n,staleTime:30*1e3})}function yw(e){return Ot({queryKey:["user-management","team-members",e],queryFn:()=>gw(e),enabled:!!e,staleTime:30*1e3})}function ww(e,n=!0){return Ot({queryKey:["user-management","assignable-users",e],queryFn:()=>dw(e),enabled:!!e&&n,staleTime:30*1e3})}function Cw(){const e=kt();return Zt({mutationFn:n=>Zy(n),onSuccess:(n,t)=>{e.invalidateQueries({queryKey:["user-management","organizations"]}),e.invalidateQueries({queryKey:["user-management","units",t.organizationId]})}})}function jw(){const e=kt();return Zt({mutationFn:({unitId:n,payload:t})=>Jy(n,t),onSuccess:(n,t)=>{e.invalidateQueries({queryKey:["user-management","organizations"]}),e.invalidateQueries({queryKey:["user-management","units",t.payload.organizationId]})}})}function Sw(){const e=kt();return Zt({mutationFn:({unitId:n,organizationId:t})=>ew(n),onSuccess:(n,t)=>{e.invalidateQueries({queryKey:["user-management","organizations"]}),e.invalidateQueries({queryKey:["user-management","units",t.organizationId]}),e.invalidateQueries({queryKey:["user-management","positions",t.unitId]})}})}function zd(){const e=kt();return Zt({mutationFn:n=>ow(n),onSuccess:(n,t)=>{e.invalidateQueries({queryKey:["user-management","positions",t.unitId]}),e.invalidateQueries({queryKey:["user-management","units",t.organizationId]})}})}function _w(){const e=kt();return Zt({mutationFn:({positionId:n,payload:t})=>aw(n,t),onSuccess:(n,t)=>{e.invalidateQueries({queryKey:["user-management","positions",t.payload.unitId]}),e.invalidateQueries({queryKey:["user-management","team-members",t.positionId]})}})}function Mw(){const e=kt();return Zt({mutationFn:({payload:n,unitId:t,positionId:o})=>rw(n),onSuccess:(n,t)=>{e.invalidateQueries({queryKey:["user-management","positions",t.unitId]}),e.invalidateQueries({queryKey:["user-management","team-members",t.positionId]})}})}function Rw(){const e=kt();return Zt({mutationFn:({positionId:n,unitId:t})=>iw(n),onSuccess:(n,t)=>{e.invalidateQueries({queryKey:["user-management","positions",t.unitId]}),e.invalidateQueries({queryKey:["user-management","team-members",t.positionId]})}})}function Nw(){const e=kt();return Zt({mutationFn:({payload:n,positionId:t,organizationId:o})=>lw(n),onSuccess:(n,t)=>{e.invalidateQueries({queryKey:["user-management","team-members",t.positionId]}),e.invalidateQueries({queryKey:["user-management","organization-employees",t.organizationId]})}})}function kw(){const e=kt();return Zt({mutationFn:({payload:n,unitId:t,positionId:o,organizationId:a})=>cw(n),onSuccess:(n,t)=>{e.invalidateQueries({queryKey:["user-management","assignable-users",t.unitId]}),e.invalidateQueries({queryKey:["user-management","team-members",t.positionId]}),e.invalidateQueries({queryKey:["user-management","organization-employees",t.organizationId]})}})}function Dw({opened:e,department:n,onClose:t}){const o=Nw(),[a,r]=b.useState(""),[i,l]=b.useState(""),[d,c]=b.useState(""),[u,g]=b.useState(""),[h,m]=b.useState("");b.useEffect(()=>{e&&(r(""),l(""),c(""),g(""),m(""))},[e]);const p=async()=>{if(n){if(!a.trim()||!i.trim()||!u.trim()||!h.trim()){Ve.show({title:"Missing fields",message:"Username, email, and both localized names are required.",color:"red"});return}if(!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(i.trim())){Ve.show({title:"Invalid email",message:"Please enter a valid email address.",color:"red"});return}try{await o.mutateAsync({positionId:n.id,organizationId:n.organizationId,payload:{positionId:n.id,username:a.trim(),email:i.trim(),phoneNumber:d.trim()||void 0,name:{am:u.trim(),en:h.trim()}}}),Ve.show({title:"User invited",message:`${h.trim()} was added to ${Me(n.name)}.`,color:"green"}),t()}catch(f){Ve.show({title:"Failed to add user",message:f instanceof Error?f.message:"Something went wrong.",color:"red"})}}};return s.jsx(jt,{opened:e,onClose:t,mode:"Edit",headerIcon:s.jsx(qr,{size:18}),title:"Add User",referenceId:n?Me(n.name):void 0,footerStatusLabel:"Inviting department user",actions:[{label:"Cancel",variant:"light",dismiss:!0},{label:o.isPending?"Adding...":"Add User",onClick:()=>void p(),loading:o.isPending}],size:"md",children:s.jsxs(he,{gap:"md",p:"lg",children:[s.jsxs(he,{gap:6,children:[s.jsx(ue,{fw:500,children:"Position"}),s.jsx(Ge,{value:n?Me(n.name):"",disabled:!0})]}),s.jsxs(he,{gap:6,children:[s.jsx(ue,{fw:500,children:"Username *"}),s.jsx(Ge,{value:a,onChange:f=>r(f.currentTarget.value),autoFocus:!0})]}),s.jsxs(he,{gap:6,children:[s.jsx(ue,{fw:500,children:"Email *"}),s.jsx(Ge,{value:i,onChange:f=>l(f.currentTarget.value),type:"email"})]}),s.jsxs(he,{gap:6,children:[s.jsx(ue,{fw:500,children:"Phone Number"}),s.jsx(Ge,{value:d,onChange:f=>c(f.currentTarget.value),placeholder:"0912345678 or +251912345678"})]}),s.jsxs(he,{gap:6,children:[s.jsx(ue,{fw:500,children:"Enter Amharic name *"}),s.jsx(Ge,{value:u,onChange:f=>g(f.currentTarget.value)})]}),s.jsxs(he,{gap:6,children:[s.jsx(ue,{fw:500,children:"Enter English name *"}),s.jsx(Ge,{value:h,onChange:f=>m(f.currentTarget.value)})]})]})})}function Tw({opened:e,onClose:n,organizationId:t,organizationLabel:o,onCreated:a}){const[r,i]=b.useState(""),[l,d]=b.useState(""),[c,u]=b.useState(""),[g,h]=b.useState(!1),m=Cw(),p=b.useMemo(()=>zt(r),[r]);b.useEffect(()=>{g||u(p)},[p,g]),b.useEffect(()=>{e||(i(""),d(""),u(""),h(!1))},[e]);const f=async()=>{if(!t){Ve.show({title:"Organization required",message:"Select an organization before adding a unit.",color:"red"});return}if(!r.trim()||!l.trim()||!c.trim()){Ve.show({title:"Missing fields",message:"English name, Amharic name, and key are all required.",color:"red"});return}try{await m.mutateAsync({name:{en:r.trim(),am:l.trim()},key:c.trim(),organizationId:t,parentUnitId:null}),Ve.show({title:"Unit created",message:`${r.trim()} was added successfully.`,color:"green"}),a==null||a(),n()}catch(v){Ve.show({title:"Failed to create unit",message:v instanceof Error?v.message:"Something went wrong.",color:"red"})}};return s.jsx(jt,{opened:e,onClose:n,mode:"Edit",headerIcon:s.jsx(of,{size:18}),title:"Add New Unit",referenceId:o,footerStatusLabel:"Creating organization unit",actions:[{label:"Cancel",variant:"light",dismiss:!0},{label:m.isPending?"Adding...":"Add Unit",onClick:()=>{f()},loading:m.isPending}],size:"md",children:s.jsxs(he,{gap:"md",p:"lg",children:[s.jsxs(he,{gap:6,children:[s.jsx(ue,{fw:500,children:"Enter English name"}),s.jsx(Ge,{placeholder:"Enter English name",value:r,onChange:v=>i(v.currentTarget.value),autoFocus:!0})]}),s.jsxs(he,{gap:6,children:[s.jsx(ue,{fw:500,children:"Enter Amharic name"}),s.jsx(Ge,{placeholder:"Enter Amharic name",value:l,onChange:v=>d(v.currentTarget.value)})]}),s.jsxs(he,{gap:6,children:[s.jsx(ue,{fw:500,children:"Key"}),s.jsx(Ge,{placeholder:"e.g. finance-unit",value:c,onChange:v=>{h(!0),u(zt(v.currentTarget.value))}})]})]})})}function Iw({opened:e,unit:n,onClose:t}){var w;const[o,a]=b.useState(null),[r,i]=b.useState(""),[l,d]=b.useState(""),[c,u]=b.useState(""),[g,h]=b.useState(!1),[m,p]=b.useState(!0),f=ci(n==null?void 0:n.id,m),v=zd(),x=b.useMemo(()=>zt(r),[r]);b.useEffect(()=>{e&&(a(null),i(""),d(""),u(""),h(!1),p(!0))},[e]),b.useEffect(()=>{g||u(x)},[x,g]),b.useEffect(()=>{a(null)},[m]);const y=async()=>{if(n){if(!o||!r.trim()||!l.trim()||!c.trim()){Ve.show({title:"Missing fields",message:"Position type, English name, Amharic name, and key are all required.",color:"red"});return}try{await v.mutateAsync({positionTypeId:o,unitId:n.id,organizationId:n.organizationId,name:{en:r.trim(),am:l.trim()},key:c.trim(),parentPositionId:null,projectId:null}),Ve.show({title:"Department created",message:`${r.trim()} was added successfully.`,color:"green"}),t()}catch(C){Ve.show({title:"Failed to create department",message:C instanceof Error?C.message:"Something went wrong.",color:"red"})}}};return s.jsx(jt,{opened:e,onClose:t,mode:"Edit",headerIcon:s.jsx(Tn,{size:18}),title:"Add Department",referenceId:n?Me(n.name):void 0,footerStatusLabel:"Creating department",actions:[{label:"Cancel",variant:"light",dismiss:!0},{label:v.isPending?"Adding...":"Add Department",onClick:()=>void y(),loading:v.isPending}],size:"md",children:s.jsxs(he,{gap:"md",p:"lg",children:[s.jsx(bo,{label:"Position in this unit",checked:m,onChange:C=>p(C.currentTarget.checked)}),s.jsxs(he,{gap:6,children:[s.jsx(ue,{fw:500,children:"Position Types"}),s.jsx(Jt,{placeholder:"Select a Position Type",value:o,onChange:a,searchable:!0,data:(((w=f.data)==null?void 0:w.items)??[]).map(C=>({value:C.id,label:Me(C.name)}))})]}),s.jsxs(he,{gap:6,children:[s.jsx(ue,{fw:500,children:"Enter English name"}),s.jsx(Ge,{value:r,onChange:C=>i(C.currentTarget.value),placeholder:"Enter English name",autoFocus:!0})]}),s.jsxs(he,{gap:6,children:[s.jsx(ue,{fw:500,children:"Enter Amharic name"}),s.jsx(Ge,{value:l,onChange:C=>d(C.currentTarget.value),placeholder:"Enter Amharic name"})]}),s.jsxs(he,{gap:6,children:[s.jsx(ue,{fw:500,children:"Key"}),s.jsx(Ge,{value:c,onChange:C=>{h(!0),u(zt(C.currentTarget.value))},placeholder:"e.g. finance-department"})]})]})})}function Pw({opened:e,department:n,onClose:t}){var w;const[o,a]=b.useState(null),[r,i]=b.useState(""),[l,d]=b.useState(""),[c,u]=b.useState(""),[g,h]=b.useState(!1),[m,p]=b.useState(!0),f=ci(n==null?void 0:n.unitId,m),v=zd(),x=b.useMemo(()=>zt(r),[r]);b.useEffect(()=>{e&&(a(null),i(""),d(""),u(""),h(!1),p(!0))},[e]),b.useEffect(()=>{g||u(x)},[x,g]),b.useEffect(()=>{a(null)},[m]);const y=async()=>{if(n){if(!o||!r.trim()||!l.trim()||!c.trim()){Ve.show({title:"Missing fields",message:"Position type, English name, Amharic name, and key are all required.",color:"red"});return}try{await v.mutateAsync({positionTypeId:o,unitId:n.unitId,organizationId:n.organizationId,name:{en:r.trim(),am:l.trim()},key:c.trim(),parentPositionId:n.id,projectId:null}),Ve.show({title:"Sub-department created",message:`${r.trim()} was added successfully.`,color:"green"}),t()}catch(C){Ve.show({title:"Failed to create sub-department",message:C instanceof Error?C.message:"Something went wrong.",color:"red"})}}};return s.jsx(jt,{opened:e,onClose:t,mode:"Edit",headerIcon:s.jsx(Tn,{size:18}),title:"Add New Sub-Department",referenceId:n?Me(n.name):void 0,footerStatusLabel:"Creating sub-department",actions:[{label:"Cancel",variant:"light",dismiss:!0},{label:v.isPending?"Adding...":"Add Sub-department",onClick:()=>void y(),loading:v.isPending}],size:"md",children:s.jsxs(he,{gap:"md",p:"lg",children:[s.jsx(bo,{label:"Position in this unit",checked:m,onChange:C=>p(C.currentTarget.checked)}),s.jsxs(he,{gap:6,children:[s.jsx(ue,{fw:500,children:"Parent Department"}),s.jsx(Ge,{value:n?Me(n.name):"",disabled:!0})]}),s.jsxs(he,{gap:6,children:[s.jsx(ue,{fw:500,children:"Position Types"}),s.jsx(Jt,{placeholder:"Select a Position Type",value:o,onChange:a,searchable:!0,data:(((w=f.data)==null?void 0:w.items)??[]).map(C=>({value:C.id,label:Me(C.name)}))})]}),s.jsxs(he,{gap:6,children:[s.jsx(ue,{fw:500,children:"Enter English name"}),s.jsx(Ge,{value:r,onChange:C=>i(C.currentTarget.value),autoFocus:!0})]}),s.jsxs(he,{gap:6,children:[s.jsx(ue,{fw:500,children:"Enter Amharic name"}),s.jsx(Ge,{value:l,onChange:C=>d(C.currentTarget.value)})]}),s.jsxs(he,{gap:6,children:[s.jsx(ue,{fw:500,children:"Key"}),s.jsx(Ge,{value:c,onChange:C=>{h(!0),u(zt(C.currentTarget.value))},placeholder:"Key"})]})]})})}function Fw({opened:e,department:n,onClose:t}){var c;const o=kw(),a=ww(n==null?void 0:n.unitId,e),[r,i]=b.useState(null);b.useEffect(()=>{e&&i(null)},[e]);const l=(((c=a.data)==null?void 0:c.items)??[]).map(u=>{var m,p;const g=((p=(m=u.employee)==null?void 0:m[0])==null?void 0:p.id)??u.id,h=`${Me(u.name)}${u.email?` (${u.email})`:""}`;return{value:g,label:h}}),d=async()=>{if(!n||!r){Ve.show({title:"Missing user",message:"Please choose a user to assign.",color:"red"});return}try{await o.mutateAsync({unitId:n.unitId,positionId:n.id,organizationId:n.organizationId,payload:{positionId:n.id,employeeId:r}}),Ve.show({title:"User assigned",message:`The user was assigned to ${Me(n.name)}.`,color:"green"}),t()}catch(u){Ve.show({title:"Failed to assign user",message:u instanceof Error?u.message:"Something went wrong.",color:"red"})}};return s.jsx(jt,{opened:e,onClose:t,mode:"Edit",headerIcon:s.jsx(Fo,{size:18}),title:n?`Assign User to ${Me(n.name)}`:"Assign User",footerStatusLabel:"Assigning department user",actions:[{label:"Cancel",variant:"light",dismiss:!0},{label:o.isPending?"Assigning...":"Assign User",onClick:()=>void d(),loading:o.isPending}],size:"md",children:s.jsxs(he,{gap:"md",p:"lg",children:[s.jsxs(he,{gap:6,children:[s.jsx(ue,{fw:500,children:"Select User"}),s.jsx(Jt,{value:r,onChange:i,data:l,searchable:!0,placeholder:"Select User",disabled:a.isLoading,nothingFoundMessage:"No users available"})]}),s.jsxs(he,{gap:6,children:[s.jsx(ue,{fw:500,children:"Positions"}),s.jsx(Ge,{value:n?Me(n.name):"",disabled:!0})]})]})})}function Ew({opened:e,organization:n,onClose:t,onDeleted:o}){const[a,r]=fw(),i=async()=>{if(n)try{await a(n.id).unwrap(),Ve.show({title:"Organization deleted",message:`${Me(n.name)} was deleted successfully.`,color:"green"}),o==null||o(),t()}catch(l){Ve.show({title:"Failed to delete organization",message:l instanceof Error?l.message:"Something went wrong.",color:"red"})}};return s.jsx(jt,{opened:e,onClose:t,mode:"Edit",headerIcon:s.jsx(xn,{size:18}),title:"Delete Organization",referenceId:n?Me(n.name):void 0,footerStatusLabel:"Removing organization",actions:[{label:"Cancel",variant:"light",dismiss:!0},{label:r.isLoading?"Deleting...":"Delete Organization",color:"red",onClick:()=>void i(),loading:r.isLoading}],size:"sm",children:s.jsxs(he,{gap:"sm",p:"lg",children:[s.jsx(ue,{fw:600,children:"Delete this organization?"}),s.jsx(ue,{size:"sm",c:"fhcGray.6",children:"This action cannot be undone. Make sure the organization does not have dependent units, departments, or employee records before deleting it."})]})})}function Ow({opened:e,department:n,onClose:t,onDeleted:o}){const a=Rw(),r=async()=>{if(n)try{await a.mutateAsync({positionId:n.id,unitId:n.unitId}),Ve.show({title:"Department deleted",message:`${Me(n.name)} was deleted successfully.`,color:"green"}),o==null||o(),t()}catch(i){Ve.show({title:"Failed to delete department",message:i instanceof Error?i.message:"Something went wrong.",color:"red"})}};return s.jsx(jt,{opened:e,onClose:t,mode:"Edit",headerIcon:s.jsx(xn,{size:18}),title:"Delete Department",referenceId:n?Me(n.name):void 0,footerStatusLabel:"Removing department",actions:[{label:"Cancel",variant:"light",dismiss:!0},{label:a.isPending?"Deleting...":"Delete Department",color:"red",onClick:()=>void r(),loading:a.isPending}],size:"md",children:s.jsxs(he,{gap:"sm",p:"lg",children:[s.jsx(ue,{fw:600,children:"Delete this department?"}),s.jsx(ue,{size:"sm",c:"fhcGray.6",children:"This removes the selected department from the unit tree. Make sure it is safe to remove before continuing."})]})})}function Aw({opened:e,unit:n,onClose:t,onDeleted:o}){const a=Sw(),r=async()=>{if(n)try{await a.mutateAsync({unitId:n.id,organizationId:n.organizationId}),Ve.show({title:"Unit deleted",message:`${Me(n.name)} was deleted successfully.`,color:"green"}),o==null||o(),t()}catch(i){Ve.show({title:"Failed to delete unit",message:i instanceof Error?i.message:"Something went wrong.",color:"red"})}};return s.jsx(jt,{opened:e,onClose:t,mode:"Edit",headerIcon:s.jsx(xn,{size:18}),title:"Delete Unit",referenceId:n?Me(n.name):void 0,footerStatusLabel:"Removing organization unit",actions:[{label:"Cancel",variant:"light",dismiss:!0},{label:a.isPending?"Deleting...":"Delete Unit",color:"red",onClick:()=>void r(),loading:a.isPending}],size:"sm",children:s.jsxs(he,{gap:"sm",p:"lg",children:[s.jsx(ue,{fw:600,children:"Delete this unit?"}),s.jsx(ue,{size:"sm",c:"fhcGray.6",children:"This action cannot be undone. Make sure the unit does not have dependent records before deleting it."})]})})}function zw({opened:e,organization:n,onClose:t,onUpdated:o}){const a=(n==null?void 0:n.id)??"",r=hw(a,{skip:!e||!a}),[i,l]=pw(),[d,c]=b.useState(""),[u,g]=b.useState(""),[h,m]=b.useState(""),[p,f]=b.useState(!1);b.useEffect(()=>{var w,C;const y=r.data;!e||!n||!y||(c(((w=y.name)==null?void 0:w.en)??n.name.en??""),g(((C=y.name)==null?void 0:C.am)??n.name.am??""),m(y.key??n.key??""),f(!1))},[e,n,r.data]);const v=b.useMemo(()=>zt(d),[d]);b.useEffect(()=>{!e||p||m(v)},[v,p,e]);const x=async()=>{const y=r.data;if(!n||!y){Ve.show({title:"Organization unavailable",message:"The selected organization could not be loaded.",color:"red"});return}if(!d.trim()||!u.trim()||!h.trim()){Ve.show({title:"Missing fields",message:"English name, Amharic name, and key are all required.",color:"red"});return}try{await i({id:n.id,body:{name:{en:d.trim(),am:u.trim()},key:h.trim(),organizationTypeId:y.organizationTypeId,isGovernmentOrganization:y.isGovernmentOrganization,parentId:y.parentId??null,isActive:y.isActive}}).unwrap(),Ve.show({title:"Organization updated",message:`${d.trim()} was updated successfully.`,color:"green"}),o==null||o(),t()}catch(w){Ve.show({title:"Failed to update organization",message:w instanceof Error?w.message:"Something went wrong.",color:"red"})}};return s.jsx(jt,{opened:e,onClose:t,mode:"Edit",headerIcon:s.jsx(on,{size:18}),title:"Edit Organization",referenceId:n?Me(n.name):void 0,footerStatusLabel:"Updating organization",actions:[{label:"Cancel",variant:"light",dismiss:!0},{label:l.isLoading?"Saving...":"Save Changes",onClick:()=>void x(),loading:l.isLoading||r.isFetching,disabled:r.isLoading}],size:"md",children:s.jsxs(he,{gap:"md",p:"lg",children:[s.jsxs(he,{gap:6,children:[s.jsx(ue,{fw:500,children:"Enter English name"}),s.jsx(Ge,{value:d,onChange:y=>c(y.currentTarget.value),placeholder:"Enter English name",autoFocus:!0,disabled:r.isLoading})]}),s.jsxs(he,{gap:6,children:[s.jsx(ue,{fw:500,children:"Enter Amharic name"}),s.jsx(Ge,{value:u,onChange:y=>g(y.currentTarget.value),placeholder:"Enter Amharic name",disabled:r.isLoading})]}),s.jsxs(he,{gap:6,children:[s.jsx(ue,{fw:500,children:"Key"}),s.jsx(Ge,{value:h,onChange:y=>{f(!0),m(zt(y.currentTarget.value))},placeholder:"e.g. federal-housing-corporation",disabled:r.isLoading})]})]})})}function $w({opened:e,department:n,onClose:t}){var x;const[o,a]=b.useState(null),[r,i]=b.useState(""),[l,d]=b.useState(""),[c,u]=b.useState(""),[g,h]=b.useState(!1),m=ci(n==null?void 0:n.unitId),p=_w();b.useEffect(()=>{e&&n&&(a(n.positionTypeId??null),i(n.name.en??""),d(n.name.am??""),u(n.key??""),h(!1))},[e,n]);const f=b.useMemo(()=>zt(r),[r]);b.useEffect(()=>{!g&&e&&u(f)},[f,g,e]);const v=async()=>{if(n){if(!o||!r.trim()||!l.trim()||!c.trim()){Ve.show({title:"Missing fields",message:"Position type, English name, Amharic name, and key are all required.",color:"red"});return}try{await p.mutateAsync({positionId:n.id,payload:{positionTypeId:o,unitId:n.unitId,organizationId:n.organizationId,name:{en:r.trim(),am:l.trim()},key:c.trim(),parentPositionId:n.parentPositionId??null,projectId:null}}),Ve.show({title:"Department updated",message:`${r.trim()} was updated successfully.`,color:"green"}),t()}catch(y){Ve.show({title:"Failed to update department",message:y instanceof Error?y.message:"Something went wrong.",color:"red"})}}};return s.jsx(jt,{opened:e,onClose:t,mode:"Edit",headerIcon:s.jsx(on,{size:18}),title:"Edit Department",referenceId:n?Me(n.name):void 0,footerStatusLabel:"Updating department",actions:[{label:"Cancel",variant:"light",dismiss:!0},{label:p.isPending?"Saving...":"Save Changes",onClick:()=>void v(),loading:p.isPending}],size:"md",children:s.jsxs(he,{gap:"md",p:"lg",children:[s.jsxs(he,{gap:6,children:[s.jsx(ue,{fw:500,children:"Position Types"}),s.jsx(Jt,{placeholder:"Select a Position Type",value:o,onChange:a,searchable:!0,data:(((x=m.data)==null?void 0:x.items)??[]).map(y=>({value:y.id,label:Me(y.name)}))})]}),s.jsxs(he,{gap:6,children:[s.jsx(ue,{fw:500,children:"Enter English name"}),s.jsx(Ge,{value:r,onChange:y=>i(y.currentTarget.value),autoFocus:!0})]}),s.jsxs(he,{gap:6,children:[s.jsx(ue,{fw:500,children:"Enter Amharic name"}),s.jsx(Ge,{value:l,onChange:y=>d(y.currentTarget.value)})]}),s.jsxs(he,{gap:6,children:[s.jsx(ue,{fw:500,children:"Key"}),s.jsx(Ge,{value:c,onChange:y=>{h(!0),u(zt(y.currentTarget.value))}})]})]})})}function Lw({opened:e,unit:n,onClose:t}){const[o,a]=b.useState(""),[r,i]=b.useState(""),[l,d]=b.useState(""),[c,u]=b.useState(!1),g=jw();b.useEffect(()=>{e&&n&&(a(n.name.en??""),i(n.name.am??""),d(n.key??""),u(!1))},[e,n]);const h=b.useMemo(()=>zt(o),[o]);b.useEffect(()=>{!c&&e&&d(h)},[h,c,e]);const m=async()=>{if(n){if(!o.trim()||!r.trim()||!l.trim()){Ve.show({title:"Missing fields",message:"English name, Amharic name, and key are all required.",color:"red"});return}try{await g.mutateAsync({unitId:n.id,payload:{name:{en:o.trim(),am:r.trim()},key:l.trim(),organizationId:n.organizationId,parentUnitId:n.parentUnitId??null}}),Ve.show({title:"Unit updated",message:`${o.trim()} was updated successfully.`,color:"green"}),t()}catch(p){Ve.show({title:"Failed to update unit",message:p instanceof Error?p.message:"Something went wrong.",color:"red"})}}};return s.jsx(jt,{opened:e,onClose:t,mode:"Edit",headerIcon:s.jsx(on,{size:18}),title:"Edit Unit",referenceId:n?Me(n.name):void 0,footerStatusLabel:"Updating organization unit",actions:[{label:"Cancel",variant:"light",dismiss:!0},{label:g.isPending?"Saving...":"Save Changes",onClick:()=>void m(),loading:g.isPending}],size:"md",children:s.jsxs(he,{gap:"md",p:"lg",children:[s.jsxs(he,{gap:6,children:[s.jsx(ue,{fw:500,children:"Enter English name"}),s.jsx(Ge,{value:o,onChange:p=>a(p.currentTarget.value),placeholder:"Enter English name",autoFocus:!0})]}),s.jsxs(he,{gap:6,children:[s.jsx(ue,{fw:500,children:"Enter Amharic name"}),s.jsx(Ge,{value:r,onChange:p=>i(p.currentTarget.value),placeholder:"Enter Amharic name"})]}),s.jsxs(he,{gap:6,children:[s.jsx(ue,{fw:500,children:"Key"}),s.jsx(Ge,{value:l,onChange:p=>{u(!0),d(zt(p.currentTarget.value))},placeholder:"e.g. finance-unit"})]})]})})}function $d(e){const n=new Set([e.id]);for(const t of e.subPositions??[])for(const o of $d(t))n.add(o);return n}function Ld(e,n,t=0){return e.flatMap(o=>{const a=`${" ".repeat(t)}${Me(o.name)}`;return[...n.has(o.id)?[]:[{value:o.id,label:a}],...Ld(o.subPositions??[],n,t+1)]})}function Vw({opened:e,department:n,positions:t,onClose:o}){const a=Mw(),[r,i]=b.useState(null);b.useEffect(()=>{e&&i(null)},[e]);const l=b.useMemo(()=>n?Ld(t,$d(n)):[],[n,t]),d=async()=>{if(!n||!r){Ve.show({title:"Missing department",message:"Please select the department to move under.",color:"red"});return}try{await a.mutateAsync({unitId:n.unitId,positionId:n.id,payload:{positionId:n.id,newParentId:r}}),Ve.show({title:"Department moved",message:`${Me(n.name)} was moved successfully.`,color:"green"}),o()}catch(c){Ve.show({title:"Failed to move department",message:c instanceof Error?c.message:"Something went wrong.",color:"red"})}};return s.jsx(jt,{opened:e,onClose:o,mode:"Edit",headerIcon:s.jsx(vc,{size:18}),title:"Move Department",referenceId:n?Me(n.name):void 0,footerStatusLabel:"Moving department",actions:[{label:"Cancel",variant:"light",dismiss:!0},{label:a.isPending?"Moving...":"Move Department",onClick:()=>void d(),loading:a.isPending}],size:"md",children:s.jsx(he,{gap:"md",p:"lg",children:s.jsxs(he,{gap:6,children:[s.jsx(ue,{fw:500,children:"Select Departments"}),s.jsx(Jt,{value:r,onChange:i,data:l,searchable:!0,placeholder:"Select Departments",nothingFoundMessage:"No departments available"})]})})})}function Bw({organizationId:e,organizationLabel:n,opened:t,onClose:o,onSelectEmployee:a}){var u;const[r,i]=b.useState(""),l=bw(e,t),d=((u=l.data)==null?void 0:u.items)??[],c=b.useMemo(()=>d.filter(g=>li(r,Me(g.user.name),g.user.email,g.user.phoneNumber,...g.employeePositions.map(h=>{var m;return Me((m=h.position)==null?void 0:m.name)}))),[d,r]);return s.jsx(jt,{opened:t,onClose:o,mode:"View",title:"Search All Employees",headerIcon:s.jsx(Fo,{size:18}),referenceId:n,footerStatusLabel:"Organization-level employee lookup",actions:[{label:"Close",variant:"light",dismiss:!0}],size:"xl",children:s.jsxs(he,{gap:"md",p:"lg",children:[s.jsx(Ge,{value:r,onChange:g=>i(g.currentTarget.value),placeholder:"Search employees in this organization...",leftSection:s.jsx(ps,{size:16}),radius:"md"}),l.isLoading?s.jsx(Pe,{justify:"center",py:"xl",children:s.jsx(Cs,{size:"sm"})}):s.jsx(ao,{h:420,children:s.jsxs(he,{gap:"sm",children:[c.map(g=>{const h=Me(g.user.name);return s.jsx(Qt,{withBorder:!0,radius:"md",p:"md",style:{cursor:"pointer"},onClick:()=>{a(g),o()},children:s.jsxs(Pe,{justify:"space-between",align:"flex-start",wrap:"nowrap",children:[s.jsxs(Pe,{gap:"md",wrap:"nowrap",children:[s.jsx(uo,{radius:"xl",color:"fhcBlue",children:h.charAt(0).toUpperCase()}),s.jsxs(he,{gap:3,children:[s.jsx(ue,{fw:700,children:h}),s.jsx(ue,{size:"sm",c:"fhcGray.6",children:g.user.email||"No email"}),s.jsx(ue,{size:"sm",c:"fhcGray.6",children:g.user.phoneNumber||"No phone"}),s.jsx(Pe,{gap:6,mt:4,children:g.employeePositions.length>0?g.employeePositions.map(m=>{var p;return s.jsx(ot,{variant:"light",color:"fhcGold",children:Me((p=m.position)==null?void 0:p.name)},m.id)}):s.jsx(ot,{variant:"light",color:"blue",children:"No department assignment"})})]})]}),s.jsx(ot,{variant:"light",color:"green",children:"Active"})]})},g.id)}),!l.isLoading&&c.length===0?s.jsx(Qt,{radius:"md",p:"xl",bg:"var(--mantine-color-gray-0)",children:s.jsxs(he,{align:"center",gap:"xs",children:[s.jsx(ue,{fw:700,children:"No employees found"}),s.jsx(ue,{size:"sm",c:"fhcGray.6",children:"Try another search, or check whether this user is assigned to the selected organization."})]})}):null]})})]})})}const Us="light-dark(#d9dfe7, #343a40)",Uw="light-dark(#d7ebff, #1f3a52)",cl="light-dark(#263445, #e6edf3)",dl="light-dark(#8a97a8, #9aa7b8)",Hw={organization:[{label:"Add Unit",icon:s.jsx(Tn,{size:14})},{label:"Edit Organization",icon:s.jsx(on,{size:14})},{label:"Delete Organization",icon:s.jsx(xn,{size:14}),color:"red"}],unit:[{label:"Add Department",icon:s.jsx(Tn,{size:14})},{label:"Edit Unit",icon:s.jsx(on,{size:14})},{label:"Delete Unit",icon:s.jsx(xn,{size:14}),color:"red"}],department:[{label:"Add User",icon:s.jsx(qr,{size:14})},{label:"Assign User",icon:s.jsx(Fo,{size:14})},{label:"Add Sub-department",icon:s.jsx(Tn,{size:14})},{label:"Edit Department",icon:s.jsx(on,{size:14})},{label:"Move Department",icon:s.jsx(vc,{size:14})},{label:"Delete Department",icon:s.jsx(xn,{size:14}),color:"red"}]};function Vd({node:e,depth:n,selectedNodeId:t,expandedIds:o,toggleExpand:a,onSelect:r,onAction:i,ancestorHasNextSiblings:l,isLast:d}){const c=t===e.id,u=e.children.length>0,g=o.has(e.id),h=c&&!!i,m=typeof e.count=="number";return s.jsxs(he,{gap:0,children:[s.jsxs(Pe,{gap:0,align:"stretch",wrap:"nowrap",children:[l.map((p,f)=>s.jsx(K,{style:{width:24,position:"relative",flex:"0 0 24px"},children:p?s.jsx(K,{style:{position:"absolute",left:12,top:0,bottom:0,width:1,background:Us}}):null},`${e.id}-ancestor-${f}`)),n>0?s.jsxs(K,{style:{width:22,position:"relative",flex:"0 0 22px"},children:[d?s.jsx(K,{style:{position:"absolute",left:11,top:0,height:"50%",width:1,background:Us}}):s.jsx(K,{style:{position:"absolute",left:11,top:0,bottom:0,width:1,background:Us}}),s.jsx(K,{style:{position:"absolute",left:11,top:"50%",width:14,height:1,background:Us}})]}):null,s.jsxs(Pe,{gap:0,wrap:"nowrap",style:{flex:1,minWidth:0,minHeight:34,paddingLeft:n===0?2:4,paddingRight:10,borderRadius:4,background:c?Uw:"transparent"},children:[s.jsx(Oe,{variant:"transparent",color:"gray",size:18,disabled:!u,onClick:()=>u&&a(e.id),"aria-label":g?"Collapse tree node":"Expand tree node",styles:{root:{minWidth:18,width:18,height:18,opacity:u?1:0}},children:s.jsx(K,{style:{width:0,height:0,borderTop:g?"7px solid light-dark(#1f2937, #e6edf3)":"6px solid transparent",borderBottom:g?"0 solid transparent":"6px solid transparent",borderLeft:g?"7px solid transparent":"9px solid light-dark(#1f2937, #e6edf3)",transform:g?"translateY(1px)":"translateX(1px)"}})}),s.jsx(We,{label:e.label,disabled:e.label.length<=20,withArrow:!0,children:s.jsx(K,{style:{flex:1,minWidth:0,cursor:"pointer",color:cl,marginLeft:6,paddingRight:8},onClick:()=>{r(e),u&&a(e.id)},children:s.jsx(ue,{size:"xs",fw:c?600:500,c:cl,style:{fontSize:"12px",display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical",overflow:"hidden",lineHeight:1.3,wordBreak:"break-word",overflowWrap:"break-word"},children:e.label})})}),m?s.jsx(ue,{size:"xs",fw:500,c:dl,style:{fontSize:"10px",marginLeft:8,flexShrink:0,minWidth:20,textAlign:"right"},children:e.count}):null,s.jsx(K,{style:{marginLeft:m?4:"auto",display:"flex",alignItems:"center"},children:h?s.jsxs(Te,{shadow:"md",width:200,withinPortal:!0,children:[s.jsx(Te.Target,{children:s.jsx(Oe,{variant:"transparent",color:"gray",size:18,"aria-label":"Open node actions",style:{color:dl},children:s.jsx(Hr,{size:14})})}),s.jsx(Te.Dropdown,{children:Hw[e.kind].map(p=>s.jsx(Te.Item,{color:p.color,leftSection:p.icon,onClick:()=>{if(i){i(e,p.label);return}Ve.show({title:p.label,message:`${p.label} for ${e.label} will be connected next.`,color:"fhcBlue"})},children:p.label},p.label))})]}):null})]})]}),u&&g?e.children.map((p,f)=>s.jsx(Vd,{node:p,depth:n+1,selectedNodeId:t,expandedIds:o,toggleExpand:a,onSelect:r,onAction:i,ancestorHasNextSiblings:[...l,n>0?!d:!1],isLast:f===e.children.length-1},p.id)):null]})}function Gw({tree:e,search:n="",embedded:t=!1,selectedNodeId:o,onSelect:a,onAction:r}){const[i,l]=b.useState(new Set(e.flatMap(u=>[u.id,...u.children.map(g=>g.id)]))),d=b.useMemo(()=>{const u=g=>g.map(h=>{const m=u(h.children);return!li(n,h.label)&&m.length===0?null:{...h,children:m}}).filter(h=>!!h);return u(e)},[n,e]);b.useEffect(()=>{const u=new Set;e.forEach(g=>{g.children.length>0&&u.add(g.id),g.children.forEach(h=>{h.children.length>0&&u.add(h.id)})}),l(u)},[e]);const c=u=>{l(g=>{const h=new Set(g);return h.has(u)?h.delete(u):h.add(u),h})};return s.jsx(Qt,{withBorder:!0,radius:t?0:"md",p:0,style:{height:"100%",background:"light-dark(#ffffff, #1a1b1e)",borderColor:t?"transparent":"light-dark(#d9e0e7, #2c2e33)",overflow:"hidden",boxShadow:t?"none":void 0},children:s.jsxs(he,{gap:0,h:"100%",children:[s.jsxs(Pe,{gap:8,px:"sm",py:10,wrap:"nowrap",style:{borderBottom:"1px solid light-dark(#edf1f5, #2c2e33)"},children:[s.jsx(K,{c:"light-dark(#2f6fa3, #6ea8d8)",children:s.jsx(Ea,{size:14,stroke:1.8})}),s.jsx(ue,{size:"sm",fw:700,c:"light-dark(#2f3d4a, #cbd5e1)",tt:"uppercase",children:"Department"})]}),s.jsx(K,{px:"sm",py:8,children:s.jsx(ue,{size:"sm",fw:700,c:"light-dark(#2f3d4a, #cbd5e1)",children:"All"})}),s.jsx(ao,{type:"scroll",offsetScrollbars:!1,scrollbarSize:10,style:{flex:1},children:s.jsx(he,{gap:2,px:"sm",pb:"md",children:d.map((u,g)=>s.jsx(Vd,{node:u,depth:0,selectedNodeId:o,expandedIds:i,toggleExpand:c,onSelect:a,onAction:r,ancestorHasNextSiblings:[],isLast:g===d.length-1},u.id))})})]})})}function qw({value:e,onChange:n,options:t}){return s.jsx(Qt,{withBorder:!0,radius:"md",p:4,style:{flexShrink:0,background:"light-dark(rgba(255,255,255,0.94), #1f2329)",borderColor:"light-dark(rgba(73, 106, 137, 0.12), rgba(255, 255, 255, 0.08))"},children:s.jsx(Pe,{gap:4,children:t.map(o=>{const a=o.value===e;return s.jsx(We,{label:o.label,children:s.jsx(Oe,{variant:a?"filled":"subtle",color:a?"fhcBlue":"gray",size:"lg",radius:"sm","aria-label":o.label,onClick:()=>n(o.value),styles:{root:{background:a?"light-dark(var(--mantine-color-fhcBlue-1), var(--mantine-color-fhcBlue-9))":"transparent",color:a?"light-dark(var(--mantine-color-fhcBlue-7), var(--mantine-color-fhcBlue-2))":"light-dark(var(--mantine-color-gray-6), var(--mantine-color-gray-4))"}},children:o.icon})},o.value)})})})}const Ww=[{value:"cards",label:"Cards",icon:s.jsx(qf,{size:16})},{value:"list",label:"List",icon:s.jsx(Zf,{size:16})},{value:"compact",label:"Compact",icon:s.jsx(xc,{size:16})},{value:"organogram",label:"Organogram",icon:s.jsx(I0,{size:16})},{value:"table",label:"Table",icon:s.jsx(C0,{size:16})}],Wn="light-dark(#ffffff, #1a1b1e)",Kw="light-dark(#f7f8fa, #141517)",ul="light-dark(#f8fafc, #1f2329)",Kn="light-dark(rgba(73, 106, 137, 0.12), rgba(255, 255, 255, 0.08))",Pn="light-dark(#0f172a, #f1f5f9)",kn="light-dark(#64748b, #9ca3af)",Hs={background:"linear-gradient(180deg, rgba(61, 83, 131, 0.18) 0%, rgba(61, 83, 131, 0.62) 50%, rgba(61, 83, 131, 0.18) 100%)"},Yw={background:"linear-gradient(90deg, rgba(61, 83, 131, 0) 0%, rgba(61, 83, 131, 0.55) 18%, rgba(61, 83, 131, 0.55) 82%, rgba(61, 83, 131, 0) 100%)"},Gs="#274c77";function qs({title:e,subtitle:n,accent:t="#3b82f6",meta:o,active:a=!1,icon:r,onClick:i,menuItems:l}){return s.jsxs(Qt,{withBorder:!0,radius:"lg",p:"md",onClick:i,style:{minWidth:0,cursor:i?"pointer":"default",position:"relative",overflow:"hidden",borderColor:a?"rgba(37, 99, 235, 0.34)":"rgba(45, 62, 111, 0.14)",background:"linear-gradient(180deg, rgba(255,255,255,0.98) 0%, rgba(248,250,252,0.96) 100%)",boxShadow:a?"0 22px 44px rgba(37, 99, 235, 0.16)":"0 14px 32px rgba(15, 23, 42, 0.07)",transition:"transform 150ms ease, box-shadow 150ms ease, border-color 150ms ease, background 150ms ease",transform:a?"translateY(-2px)":void 0},children:[s.jsx(K,{style:{position:"absolute",insetInline:0,top:0,height:4,background:`linear-gradient(90deg, ${t} 0%, rgba(255,255,255,0.92) 100%)`}}),s.jsxs(he,{gap:10,align:"center",children:[s.jsxs(Pe,{justify:"space-between",align:"flex-start",wrap:"nowrap",style:{minWidth:0,width:"100%"},children:[s.jsxs(Pe,{gap:"sm",wrap:"nowrap",style:{minWidth:0,flex:1,justifyContent:"center"},children:[r?s.jsx(K,{style:{width:52,height:52,borderRadius:r&&typeof r!="string"?999:12,display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0,background:`linear-gradient(135deg, ${t}14 0%, rgba(255,255,255,0.96) 100%)`,color:t,overflow:"hidden",border:`1px solid ${t}33`,boxShadow:`inset 0 0 0 1px ${t}12`},children:r}):null,s.jsxs(he,{gap:2,style:{minWidth:0,flex:1,alignItems:r?"flex-start":"center"},children:[s.jsx(ot,{variant:"light",radius:"xl",size:"xs",styles:{root:{background:`${t}14`,color:t,fontWeight:700,textTransform:"uppercase",letterSpacing:"0.04em",fontSize:"10px"}},children:n}),s.jsx(We,{label:e,disabled:e.length<=24,withArrow:!0,children:s.jsx(ue,{fw:600,c:Pn,ta:r?"left":"center",size:"xs",style:{fontSize:"12px",wordBreak:"break-word",overflowWrap:"break-word",display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical",overflow:"hidden"},children:e})})]})]}),s.jsx(Pe,{gap:8,wrap:"nowrap",style:{flexShrink:0},children:l!=null&&l.length?s.jsxs(Te,{shadow:"md",withinPortal:!0,position:"bottom-end",children:[s.jsx(Te.Target,{children:s.jsx(Oe,{variant:"subtle",color:"gray",size:"sm",onClick:d=>d.stopPropagation(),style:{background:"rgba(148, 163, 184, 0.1)",color:kn},children:s.jsx(Hr,{size:14})})}),s.jsx(Te.Dropdown,{children:l.map(d=>s.jsx(Te.Item,{color:d.color,leftSection:d.icon,onClick:c=>{c.stopPropagation(),d.onClick()},children:d.label},d.label))})]}):null})]}),o?s.jsx(ot,{variant:"light",radius:"xl",color:"gray",w:"fit-content",size:"xs",styles:{root:{background:"rgba(148, 163, 184, 0.12)",color:kn,fontWeight:600,fontSize:"11px"}},children:o}):null]})]})}function Qw({organization:e,units:n,unit:t,selectedPosition:o,positions:a,members:r,unitExpanded:i,departmentsExpanded:l,onSelectOrganization:d,onSelectUnit:c,onResetToRoot:u,onSelectDepartment:g,onSelectEmployee:h,onNodeAction:m}){if(!e)return s.jsx(Ga,{title:"Select an organization",description:"Choose an organization from the tree to generate the organogram view."});const p=(S,R)=>{if(!S)return[];if(S.id===R)return[S];for(const _ of S.subPositions??[]){const T=p(_,R);if(T.length>0)return[S,...T]}return[]},f=a.length>0?a[0]:null,v=b.useMemo(()=>{if(!f)return[];if(!o)return[f];const S=p(f,o.id);return S.length>0?S:[f]},[f,o]),x=v.length>0?v[v.length-1]:null,y=(x==null?void 0:x.subPositions)??[],w=o?r:[],C=b.useMemo(()=>{const S=[Me(e.name)];return t&&S.push(Me(t.name)),v.forEach((R,_)=>{if(_===0&&R.id===(f==null?void 0:f.id)){S.push(Me(R.name));return}S.push(Me(R.name))}),S},[e,t,v,f]),j={id:e.id,label:Me(e.name),kind:"organization",children:[],raw:e};return s.jsxs(he,{gap:"lg",style:{padding:"8px 12px 20px"},children:[s.jsx(Qt,{withBorder:!0,radius:"xl",p:"lg",style:{background:Wn,borderColor:Kn},children:s.jsxs(he,{gap:"sm",children:[s.jsxs(Pe,{justify:"space-between",align:"center",wrap:"wrap",children:[s.jsxs(he,{gap:2,children:[s.jsx(ue,{fw:600,size:"sm",c:Pn,children:"Organizational Chart"}),s.jsx(ue,{size:"xs",c:kn,style:{fontSize:"11px"},children:"Click a node to expand or collapse its branch."})]}),s.jsxs(Pe,{gap:"sm",wrap:"wrap",children:[s.jsxs(ot,{size:"sm",radius:"md",variant:"light",color:"gray",children:[y.length," direct report",y.length===1?"":"s"]}),s.jsxs(ot,{size:"sm",radius:"md",variant:"light",color:"gray",children:[r.length," active employee",r.length===1?"":"s"]})]})]}),s.jsx(Pe,{gap:8,wrap:"wrap",children:C.map((S,R)=>s.jsxs(Pe,{gap:8,wrap:"nowrap",children:[s.jsx(ue,{size:"xs",fw:R===C.length-1?600:500,c:R===C.length-1?Pn:kn,style:{fontSize:"11px"},children:S}),R<C.length-1?s.jsx(Ur,{size:14,color:"#94a3b8"}):null]},`${S}-${R}`))})]})}),s.jsxs(Qt,{withBorder:!0,radius:"xl",p:{base:"md",md:"xl"},style:{background:Wn,borderColor:Kn,position:"relative",overflow:"hidden"},children:[s.jsx(K,{style:{position:"absolute",inset:0,backgroundImage:"linear-gradient(rgba(148, 163, 184, 0.08) 1px, transparent 1px), linear-gradient(90deg, rgba(148, 163, 184, 0.08) 1px, transparent 1px)",backgroundSize:"28px 28px",pointerEvents:"none"}}),s.jsxs(he,{gap:"xl",align:"center",style:{position:"relative"},children:[s.jsxs(he,{gap:"sm",align:"center",style:{width:"100%"},children:[s.jsx(K,{style:{width:"100%",maxWidth:"100%",paddingInline:16},children:s.jsx(qs,{title:Me(e.name),subtitle:"Organization",meta:`${i?n.length:0} visible unit${n.length===1?"":"s"}`,accent:Gs,icon:s.jsx(Ea,{size:22}),active:i,onClick:()=>d(e),menuItems:[{label:"Add Unit",icon:s.jsx(Tn,{size:14}),onClick:()=>m(j,"Add Unit")},{label:"Edit Organization",icon:s.jsx(on,{size:14}),onClick:()=>m(j,"Edit Organization")},{label:"Delete Organization",icon:s.jsx(xn,{size:14}),color:"red",onClick:()=>m(j,"Delete Organization")}]})}),i&&n.length>0?s.jsx(K,{style:{width:2,height:42,...Hs}}):s.jsx(ue,{size:"sm",c:"dimmed",children:"Select a unit to expand the organization structure."})]}),i&&n.length>0?s.jsx(K,{style:{width:"100%",paddingInline:16},children:s.jsxs(he,{gap:"lg",align:"center",children:[v.length>0?s.jsx(he,{gap:0,align:"center",style:{width:"100%"},children:v.map((S,R)=>{var I;const _=R===v.length-1,T=R===0,k=((I=S.subPositions)==null?void 0:I.length)??0;return s.jsxs(he,{gap:0,align:"center",style:{width:"100%"},children:[s.jsx(K,{style:{width:"100%",maxWidth:360},children:s.jsx(qs,{title:Me(S.name),subtitle:T?"Head Position":`Position (Rank ${S.rank||0})`,meta:`${k} direct report${k===1?"":"s"}`,accent:Gs,icon:s.jsx(Ea,{size:22}),active:_,onClick:()=>{if(T){u();return}g(S)}})}),!_||y.length>0||w.length>0?s.jsx(K,{style:{width:2,height:42,...Hs}}):null]},S.id)})}):null,y.length>0?s.jsxs(he,{gap:"md",align:"center",style:{width:"100%"},children:[s.jsxs(ue,{size:"sm",fw:600,c:kn,children:["Direct reports under ",Me((x==null?void 0:x.name)??e.name)]}),s.jsx(Pe,{gap:"lg",style:{width:"100%",justifyContent:"center"},children:y.map(S=>{var _,T;const R={id:S.id,label:Me(S.name),kind:"department",children:[],parentId:S.parentPositionId,raw:S};return s.jsxs(he,{gap:0,align:"center",style:{flex:"1 1 calc(33.333% - 12px)",minWidth:220,maxWidth:300},children:[s.jsx(K,{style:{width:2,height:28,...Hs}}),s.jsx(K,{style:{width:"100%"},children:s.jsx(qs,{title:Me(S.name),subtitle:`Position (Rank ${S.rank||0})`,meta:`${((_=S.subPositions)==null?void 0:_.length)??0} direct report${(((T=S.subPositions)==null?void 0:T.length)??0)===1?"":"s"}`,accent:Gs,active:(o==null?void 0:o.id)===S.id,onClick:()=>g(S),menuItems:[{label:"Add User",icon:s.jsx(qr,{size:14}),onClick:()=>m(R,"Add User")},{label:"Assign User",icon:s.jsx(Fo,{size:14}),onClick:()=>m(R,"Assign User")},{label:"Edit Position",icon:s.jsx(on,{size:14}),onClick:()=>m(R,"Edit Department")},{label:"Delete Position",icon:s.jsx(xn,{size:14}),color:"red",onClick:()=>m(R,"Delete Department")}]})})]},S.id)})})]}):null,w.length>0?s.jsxs(he,{gap:"md",align:"center",style:{width:"100%"},children:[s.jsxs(ue,{size:"sm",fw:600,c:kn,children:["Employees in ",Me((x==null?void 0:x.name)??(o==null?void 0:o.name)??e.name)]}),w.length>1?s.jsx(K,{style:{width:"100%",maxWidth:720,height:2,...Yw}}):null,s.jsx(Pe,{gap:"lg",style:{width:"100%",justifyContent:"center"},children:w.map(S=>s.jsxs(he,{gap:0,align:"center",style:{flex:"1 1 calc(33.333% - 12px)",minWidth:200,maxWidth:280},children:[s.jsx(K,{style:{width:2,height:24,...Hs}}),s.jsx(K,{style:{width:"100%"},children:s.jsx(qs,{title:Me(S.user.name),subtitle:S.user.userType||"Employee",meta:S.user.email||"No email",accent:Gs,icon:s.jsx(uo,{size:44,radius:"xl",color:"fhcBlue",children:Me(S.user.name).charAt(0).toUpperCase()}),onClick:()=>h(S),menuItems:[{label:"View Details",icon:s.jsx(Gr,{size:14}),onClick:()=>h(S)}]})})]},S.id))})]}):null]})}):null]})]})]})}function Ga({title:e="No team members found",description:n="Add team members to this department"}){return s.jsx(Qt,{radius:"lg",p:"xl",style:{background:Kw,minHeight:220,display:"flex",alignItems:"center",justifyContent:"center"},children:s.jsxs(he,{align:"center",gap:"xs",children:[s.jsx(Br,{size:68,radius:"xl",variant:"light",color:"gray",children:s.jsx(_0,{size:34})}),s.jsx(ue,{fw:600,c:Pn,size:"sm",style:{fontSize:"12px"},children:e}),s.jsx(ue,{size:"xs",c:"dimmed",style:{fontSize:"11px"},children:n})]})})}function Ma({member:e,compact:n=!1,onOpen:t}){const o=Me(e.user.name);return s.jsx(Qt,{withBorder:!0,radius:"md",p:n?"sm":"md",style:{cursor:"pointer",borderColor:Kn,background:Wn},onClick:()=>t(e),children:s.jsxs(Pe,{align:"flex-start",justify:"space-between",wrap:"nowrap",style:{minWidth:0},children:[s.jsxs(Pe,{align:"flex-start",gap:"md",wrap:"nowrap",style:{minWidth:0,flex:1},children:[s.jsx(uo,{size:n?54:78,radius:"md",color:"gray",style:{flexShrink:0},styles:{placeholder:{fontSize:n?18:28}},children:o.charAt(0).toUpperCase()}),s.jsxs(he,{gap:n?2:5,style:{minWidth:0,flex:1},children:[s.jsx(ue,{fw:600,c:Pn,truncate:"end",size:"xs",style:{fontSize:"12px"},children:o}),s.jsx(ue,{size:"xs",c:"dimmed",truncate:"end",style:{fontSize:"11px"},children:e.user.username||"Employee"}),s.jsx(ue,{size:"xs",c:"dimmed",truncate:"end",style:{fontSize:"11px"},children:e.user.email||"No email"}),s.jsx(ue,{size:"xs",c:"dimmed",truncate:"end",style:{fontSize:"11px"},children:e.user.phoneNumber||"No phone"}),s.jsxs(Pe,{gap:6,mt:n?4:8,wrap:"wrap",children:[s.jsx(ot,{color:"pink",variant:"light",children:e.status||e.user.status||"Pending"}),e.user.userType?s.jsx(ot,{color:"yellow",variant:"light",children:e.user.userType}):null]})]})]}),s.jsx(Oe,{variant:"light",color:"fhcGold",radius:"sm",onClick:a=>{a.stopPropagation(),t(e)},"aria-label":"Open employee",children:s.jsx(Gr,{size:15})})]})})}function Xw(){var et,ee;const[e,n]=b.useState(""),[t,o]=b.useState(""),[a,r]=b.useState(""),[i,l]=b.useState(!1),[d,c]=b.useState(""),[u,g]=b.useState(""),[h,m]=b.useState(""),[p,f]=b.useState(""),[v,x]=b.useState(!1),[y,w]=b.useState(!0),[C,j]=b.useState(!0),[S,R]=b.useState(null),[_,T]=b.useState(!1),[k,I]=b.useState(null),[E,V]=b.useState(null),[L,B]=b.useState(null),[M,D]=b.useState(null),[O,F]=b.useState(null),[$,z]=b.useState(null),[H,re]=b.useState(null),[ie,X]=b.useState(null),[oe,ne]=b.useState(null),[J,P]=b.useState(null),[Q,ce]=b.useState(null),[te,W]=b.useState(null),[me,le]=b.useState("cards"),de=mw(),Y=((et=de.data)==null?void 0:et.items)??[],A=vw(d),se=((ee=A.data)==null?void 0:ee.items)??[],be=xw(u),ve=be.data??[],Se=yw(h),we=Se.data??[],U=Y.find(q=>q.id===d),G=se.find(q=>q.id===u),ae=b.useMemo(()=>{const q=Re=>{for(const He of Re){if(He.id===h)return He;const st=q(He.subPositions??[]);if(st)return st}};return q(ve)},[ve,h]),Fe=b.useMemo(()=>By({organizations:Y,units:se,positions:ve,selectedOrganizationId:d,selectedUnitId:u}),[Y,ve,d,u,se]),pe=b.useMemo(()=>we.filter(q=>li(e,Me(q.user.name),q.user.email,q.user.phoneNumber,q.user.username)),[we,e]),Z=b.useMemo(()=>pe.map(q=>({id:q.id,name:Me(q.user.name),username:q.user.username||"Employee",email:q.user.email||"No email",phoneNumber:q.user.phoneNumber||"No phone",status:q.status||q.user.status||"Pending",userType:q.user.userType||"-",raw:q})),[pe]),_e=b.useMemo(()=>[{accessorKey:"name",header:"Employee",size:240,Cell:({row:q})=>s.jsxs(he,{gap:2,py:4,children:[s.jsx(ue,{fw:600,c:Pn,size:"xs",style:{fontSize:"12px"},children:q.original.name}),s.jsx(ue,{size:"xs",c:"dimmed",style:{fontSize:"11px"},children:q.original.email})]})},{accessorKey:"username",header:"Username",size:160},{accessorKey:"phoneNumber",header:"Phone",size:170},{accessorKey:"userType",header:"Role",size:140,Cell:({row:q})=>s.jsx(ot,{color:"yellow",variant:"light",radius:"xl",children:q.original.userType})},{accessorKey:"status",header:"Status",size:130,Cell:({row:q})=>s.jsx(ot,{variant:"light",radius:"xl",color:q.original.status.toLowerCase()==="active"?"green":"pink",children:q.original.status})}],[]);["UserManagement",U?Me(U.name):null,G?Me(G.name):null,ae?Me(ae.name):null].filter(Boolean);const Ae=de.error||A.error||be.error||Se.error,Qe=q=>{if(f(q.id),R(null),q.kind==="organization"){const Re=q.raw;c(Re.id),g(""),m(""),w(!0),j(!0);return}if(q.kind==="unit"){const Re=q.raw;g(Re.id),m(""),w(!0),j(!0);return}w(!0),j(!0),m(q.id)},nt=(q,Re)=>{const He=Re.trim().toLowerCase(),st=q.raw,rt=q.kind==="organization"||"activeEmployeeCount"in st||"isSuperAdmin"in st,nn=q.kind==="unit"||"organizationId"in st&&"parentUnitId"in st,Dt=q.kind==="department"||"unitId"in st&&"subPositions"in st;if(rt){const qe=q.raw;if(He==="add unit"){I({organizationId:q.id,organizationLabel:q.label});return}if(He==="edit organization"){V(qe);return}if(He==="delete organization"){B(qe);return}}if(nn){const qe=q.raw;if(He==="add department"){z(qe);return}if(He==="edit unit"){D(qe);return}if(He==="delete unit"){F(qe);return}}if(Dt){const qe=q.raw;if(He==="add user"){re(qe);return}if(He==="assign user"){X(qe);return}if(He==="add sub-department"){ne(qe);return}if(He==="edit department"){P(qe);return}if(He==="move department"){ce(qe);return}if(He==="delete department"){W(qe);return}}Ve.show({title:Re,message:`${Re} for ${q.label} will be connected next.`,color:"fhcBlue"})};return pe.length,s.jsxs(s.Fragment,{children:[s.jsxs(he,{gap:"lg",children:[Ae?s.jsx(yo,{color:"red",variant:"light",icon:s.jsx(Hf,{size:16}),radius:"lg",children:Ae.message||"We could not load user-management data from the backend."}):null,s.jsx(Qt,{withBorder:!0,radius:"xl",p:0,style:{minHeight:"calc(100vh - 230px)",background:Wn,borderColor:Kn,overflow:"hidden"},children:s.jsxs(Pe,{align:"stretch",gap:0,wrap:"nowrap",style:{minHeight:"calc(100vh - 230px)"},children:[s.jsx(K,{style:{width:v?56:360,minWidth:v?56:360,transition:"width 180ms ease, min-width 180ms ease",overflow:"hidden",background:Wn},children:v?s.jsxs(he,{h:"100%",align:"center",justify:"flex-start",gap:"sm",py:"md",children:[s.jsx(Oe,{variant:"light",color:"gray",radius:"xl",onClick:()=>x(!1),"aria-label":"Expand department panel",children:s.jsx(Qf,{size:16})}),s.jsx(ue,{size:"xs",fw:700,c:"dimmed",tt:"uppercase",style:{writingMode:"vertical-rl",transform:"rotate(180deg)",letterSpacing:"0.08em"},children:"Department"})]}):s.jsx(K,{h:"100%",style:{minHeight:"calc(100vh - 230px)"},children:s.jsx(Gw,{tree:Fe,search:a,embedded:!0,selectedNodeId:p,onSelect:Qe,onAction:nt})})}),s.jsx(K,{style:{width:1,minWidth:1,background:Kn}}),s.jsx(K,{style:{flex:1,minWidth:0,minHeight:"calc(100vh - 230px)"},children:s.jsxs(he,{gap:"md",h:"100%",p:"md",children:[s.jsxs(Pe,{justify:"space-between",align:"flex-start",wrap:"wrap",gap:"md",children:[s.jsxs(Pe,{gap:"sm",wrap:"nowrap",style:{minWidth:0,flex:1},children:[v?null:s.jsx(Oe,{variant:"light",color:"gray",radius:"xl",onClick:()=>x(!0),"aria-label":"Collapse department panel",children:s.jsx(Kf,{size:16})}),s.jsx(pt,{leftSection:s.jsx(Tn,{size:16}),radius:"md",disabled:!h,onClick:()=>ae?re(ae):null,children:"New"}),me!=="organogram"?s.jsxs(Pe,{gap:8,wrap:"nowrap",style:{minWidth:0,overflow:"hidden"},children:[s.jsx(ot,{color:"fhcBlue",variant:"light",radius:"xl",children:ae?Me(ae.name):"No department selected"}),G?s.jsx(ot,{color:"fhcGold",variant:"light",radius:"xl",children:Me(G.name)}):null,U?s.jsx(ot,{color:"gray",variant:"light",radius:"xl",children:Me(U.name)}):null]}):null]}),s.jsxs(Pe,{gap:"sm",wrap:"wrap",justify:"flex-end",align:"center",style:{flex:"1 1 520px",minWidth:0,marginLeft:"auto"},children:[i?s.jsx(Ge,{value:t,onChange:q=>o(q.currentTarget.value),onKeyDown:q=>{q.key==="Enter"&&r(t.trim())},placeholder:"Search tree...",leftSection:s.jsx(ps,{size:14}),radius:"xl",size:"sm",autoFocus:!0,w:200,styles:{input:{height:38,borderColor:"rgba(73, 106, 137, 0.14)",background:ul,color:"var(--mantine-color-fhcGray-8)"}}}):null,s.jsx(We,{label:"Search department tree",children:s.jsx(Oe,{variant:i?"filled":"light",color:"fhcBlue",radius:"xl",size:"lg",onClick:()=>{if(i){t.trim().length===0?(r(""),l(!1)):r(t.trim());return}l(!0)},children:s.jsx(lf,{size:16})})}),s.jsx(pt,{variant:"light",leftSection:s.jsx(ps,{size:16}),color:"fhcBlue",size:"sm",radius:"xl",disabled:!d,onClick:()=>T(!0),children:"Search Employees"}),s.jsx(Oe,{variant:"light",color:"fhcBlue",size:"lg",radius:"xl",onClick:()=>{de.refetch(),A.refetch(),be.refetch(),Se.refetch()},children:s.jsx(bc,{size:18})}),s.jsx(Ge,{value:e,onChange:q=>n(q.currentTarget.value),placeholder:"Search...",leftSection:s.jsx(ps,{size:16}),radius:"md",style:{flex:"1 1 180px",minWidth:160,maxWidth:260},disabled:!h}),s.jsx(qw,{value:me,onChange:le,options:Ww})]})]}),me==="organogram"?s.jsx(Pe,{gap:8,wrap:"wrap",children:[U?Me(U.name):null,G?Me(G.name):null,ae?Me(ae.name):null].filter(Boolean).map((q,Re,He)=>s.jsxs(Pe,{gap:8,wrap:"nowrap",children:[s.jsx(ue,{size:"sm",fw:Re===He.length-1?700:600,c:Re===He.length-1?Pn:kn,children:q}),Re<He.length-1?s.jsx(Ur,{size:14,color:"#94a3b8"}):null]},`${q}-${Re}`))}):null,s.jsx(wr,{}),me!=="organogram"&&Se.isLoading&&h?s.jsx(Pe,{justify:"center",py:"xl",children:s.jsx(Cs,{size:"sm"})}):me!=="organogram"&&!h?s.jsx(Ga,{title:"Select a department",description:d?"Choose a department from the tree to load its related team members. For users like Super Admin without a department assignment, click Search All Employees.":"Choose an organization first, then a unit, then a department."}):me!=="organogram"&&pe.length===0?s.jsx(Ga,{title:"No team members found",description:"Add team members to this department."}):s.jsx(K,{style:{flex:1,minHeight:0,overflowY:"auto",overflowX:"hidden"},children:me==="organogram"?s.jsx(Qw,{organization:U,units:se,unit:G,selectedPosition:ae,positions:ve,members:pe,unitExpanded:y,departmentsExpanded:C,onSelectOrganization:q=>{d!==q.id?(f(q.id),c(q.id),g(""),m(""),w(!0),j(!0)):(w(Re=>{const He=!Re;return He||j(!1),He}),y||j(!0)),R(null)},onSelectUnit:q=>{u!==q.id?(f(q.id),g(q.id),m(""),w(!0),j(!0)):j(Re=>!Re),R(null)},onResetToRoot:()=>{m(""),R(null)},onSelectDepartment:q=>{f(q.id),w(!0),j(!0),m(Re=>Re===q.id?"":q.id),R(null)},onSelectEmployee:R,onNodeAction:nt}):me==="table"?s.jsx(_y,{columns:_e,data:Z,loading:Se.isLoading,emptyMessage:"No employees found",enableRowActions:!0,positionActionsColumn:"last",renderRowActions:({row:q})=>s.jsx(Oe,{variant:"light",color:"fhcGold",radius:"sm",onClick:()=>R(q.original.raw),"aria-label":"Open employee",children:s.jsx(Gr,{size:15})}),mantineTableBodyRowProps:({row:q})=>({onClick:()=>R(q.original.raw),style:{cursor:"pointer"}}),options:{rowSelection:!1,topToolbar:!1,bottomToolbar:!1,filters:!1,globalFilter:!1,columnFilters:!1,densityToggle:!1,fullScreenToggle:!1,columnActions:!1,columnOrdering:!1,columnResizing:!1,sorting:!1,hiding:!1,pagination:!1},mantinePaperProps:{radius:"lg",withBorder:!0,style:{borderColor:Kn,overflow:"hidden",background:Wn}},mantineTableContainerProps:{style:{overflowX:"hidden"}},mantineTableProps:{striped:"odd",highlightOnHover:!0,withTableBorder:!1,withColumnBorders:!1,fz:"sm",style:{tableLayout:"fixed",width:"100%"}},mantineTableHeadCellProps:{style:{background:ul,color:"#1f2937",fontWeight:700,borderBottom:"1px solid rgba(73, 106, 137, 0.12)"}},mantineTableBodyCellProps:{style:{borderTop:"1px solid rgba(73, 106, 137, 0.08)",verticalAlign:"middle"}}}):s.jsx(s.Fragment,{children:me==="cards"?s.jsx(Io,{cols:{base:1,xl:2},spacing:"md",children:pe.map(q=>s.jsx(Ma,{member:q,onOpen:R},q.id))}):s.jsx(he,{gap:"md",children:pe.map(q=>me==="compact"?s.jsxs(Pe,{wrap:"nowrap",gap:"sm",px:"xs",children:[s.jsx(xc,{size:16,color:"#94a3b8"}),s.jsx(K,{style:{flex:1,minWidth:0},children:s.jsx(Ma,{member:q,compact:!0,onOpen:R})})]},q.id):s.jsx(Ma,{member:q,compact:!0,onOpen:R},q.id))})})})]})})]})})]}),s.jsx(Uy,{employee:S,opened:!!S,onClose:()=>R(null)}),s.jsx(Bw,{organizationId:d,organizationLabel:U?Me(U.name):void 0,opened:_,onClose:()=>T(!1),onSelectEmployee:R}),s.jsx(Tw,{opened:!!k,organizationId:k==null?void 0:k.organizationId,organizationLabel:k==null?void 0:k.organizationLabel,onClose:()=>I(null),onCreated:()=>{de.refetch(),k!=null&&k.organizationId&&A.refetch()}}),s.jsx(zw,{opened:!!E,organization:E,onClose:()=>V(null),onUpdated:()=>{de.refetch()}}),s.jsx(Ew,{opened:!!L,organization:L,onClose:()=>B(null),onDeleted:()=>{const q=L==null?void 0:L.id;de.refetch(),q&&d===q&&(c(""),g(""),m(""),f(""),R(null))}}),s.jsx(Iw,{opened:!!$,unit:$,onClose:()=>z(null)}),s.jsx(Dw,{opened:!!H,department:H,onClose:()=>re(null)}),s.jsx(Fw,{opened:!!ie,department:ie,onClose:()=>X(null)}),s.jsx(Pw,{opened:!!oe,department:oe,onClose:()=>ne(null)}),s.jsx($w,{opened:!!J,department:J,onClose:()=>P(null)}),s.jsx(Vw,{opened:!!Q,department:Q,positions:ve,onClose:()=>ce(null)}),s.jsx(Ow,{opened:!!te,department:te,onClose:()=>W(null),onDeleted:()=>{te&&h===te.id&&(m(""),f(u))}}),s.jsx(Lw,{opened:!!M,unit:M,onClose:()=>D(null)}),s.jsx(Aw,{opened:!!O,unit:O,onClose:()=>F(null),onDeleted:()=>{O&&u===O.id&&(g(""),m(""),f(O.organizationId))}})]})}function G1(){return bu()==="classic"?s.jsx(Xw,{}):s.jsx("div",{className:"p-6",children:s.jsx(Lp,{})})}export{G1 as default};
|