obeyaka-ui 0.1.38 → 0.1.39

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";var dn=Object.create;var ot=Object.defineProperty;var un=Object.getOwnPropertyDescriptor;var fn=Object.getOwnPropertyNames;var hn=Object.getPrototypeOf,xn=Object.prototype.hasOwnProperty;var pn=(n,s,o,r)=>{if(s&&typeof s=="object"||typeof s=="function")for(let a of fn(s))!xn.call(n,a)&&a!==o&&ot(n,a,{get:()=>s[a],enumerable:!(r=un(s,a))||r.enumerable});return n};var _e=(n,s,o)=>(o=n!=null?dn(hn(n)):{},pn(s||!n||!n.__esModule?ot(o,"default",{value:n,enumerable:!0}):o,n));Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),u=require("react"),t=require("@mantine/core"),T=require("@tabler/icons-react"),Te=require("@emoji-mart/data"),lt=require("emoji-mart"),ye=require("@mantine/hooks"),mn=require("@mantine/notifications"),gn=require("@mantine/modals"),In=require("@mantine/dates"),ee=u.memo(({onClick:n,icon:s,changeIconOnHover:o=!1,iconHovered:r,iconColor:a="var(--mantine-color-gray-7)",size:i="md",variant:c="transparent",bg:l,disabled:d=!1,loading:f=!1,tooltip:h,"aria-label":m,className:x,style:I,onMouseEnter:p,onMouseLeave:y,...g})=>{const[b,j]=u.useState(!1),C=u.useCallback(()=>{d||f||(n==null||n(),console.log("Clicked"))},[d,f,n]),S=u.useMemo(()=>({xs:14,sm:16,md:20,lg:24,xl:28})[i]||20,[i]),B=u.useMemo(()=>({xs:2,sm:2,md:2,lg:2,xl:2.5})[i]||2,[i]),k=u.useCallback(E=>{j(!0),p==null||p(E)},[p]),w=u.useCallback(E=>{j(!1),y==null||y(E)},[y]),v=u.useMemo(()=>{if(l)return l;if(c==="transparent")return b?"var(--mantine-color-gray-2)":"transparent"},[l,c,b]),O=u.useMemo(()=>o&&r&&b?r:s,[o,r,b,s]),M=u.useMemo(()=>e.jsx(O,{size:S,strokeWidth:B,color:a}),[O,S,B,a]),z=e.jsx(t.ActionIcon,{onClick:C,bg:v,color:a,radius:"md",variant:c==="transparent"?"transparent":c,size:i,disabled:d||f,loading:f,onMouseEnter:k,onMouseLeave:w,"aria-label":m||h,className:x,style:I,...g,children:M});return h&&!d&&!f?e.jsx(t.Tooltip,{label:h,position:"top",withArrow:!0,children:z}):z});ee.displayName="ActionButton";const yn=n=>{const s={xs:{width:28,height:28,fontSize:16},sm:{width:32,height:32,fontSize:24},md:{width:36,height:36,fontSize:32},lg:{width:40,height:40,fontSize:40},xl:{width:44,height:44,fontSize:44},xxl:{width:48,height:48,fontSize:48}};return typeof n=="number"?{width:n,height:n,fontSize:n-8}:s[n]},dt=({emoji:n,size:s="lg",editable:o=!1,onClick:r,className:a,style:i})=>{const c=yn(s),l=o&&r;return e.jsx(t.Box,{className:a,style:{...c,borderRadius:"var(--mantine-radius-md)",overflow:"hidden",cursor:l?"pointer":"default",position:"relative",display:"flex",alignItems:"center",justifyContent:"center",transition:"background-color 0.2s ease",backgroundColor:"transparent",...i},onClick:l?r:void 0,onMouseEnter:d=>{l&&(d.currentTarget.style.backgroundColor="var(--mantine-color-gray-0)")},onMouseLeave:d=>{l&&(d.currentTarget.style.backgroundColor="transparent")},children:e.jsx(t.Box,{style:{fontSize:c.fontSize,lineHeight:1,display:"flex",alignItems:"center",justifyContent:"center"},children:n})})},xe=n=>{if(typeof n=="number")return n;switch(n){case"xs":return 24;case"sm":return 32;case"md":return 48;case"lg":return 64;case"xl":return 80;default:return 64}},le=new Map,vn=["IconUser","IconHeart","IconStar","IconSmile","IconSun","IconMoon","IconCamera","IconMusic","IconCode","IconBriefcase","IconHome","IconSearch","IconSettings","IconMail","IconPhone","IconBell","IconBookmark","IconCalendar","IconClock","IconDownload","IconEdit","IconEye","IconFile","IconFolder","IconImage","IconLink","IconLock","IconMessage","IconPlus","IconShare","IconThumbUp","IconTrash"],jn=async()=>{try{const n=await import("@tabler/icons-react");vn.forEach(s=>{if(!le.has(s)){const o=n[s];o&&le.set(s,o)}})}catch(n){console.warn("Error preloading common icons:",n)}};jn();const bn=async n=>{if(le.has(n))return le.get(n);try{const r=(await import("@tabler/icons-react"))[n]||T.IconQuestionMark;return le.set(n,r),r}catch{return le.set(n,T.IconQuestionMark),T.IconQuestionMark}},wn=n=>n.replace(/^Icon/,"").replace(/([A-Z])/g," $1").trim().toLowerCase().replace(/^./,o=>o.toUpperCase()),ut=u.memo(({iconName:n,onClick:s,size:o=20})=>{const[r,a]=u.useState(null),[i,c]=u.useState(!0),l=u.useRef(null),d=u.useRef(!0);u.useEffect(()=>(d.current=!0,(async()=>{try{const x=(await import("@tabler/icons-react"))[n];d.current&&(a(x?()=>x:T.IconQuestionMark),c(!1))}catch{d.current&&(a(()=>T.IconQuestionMark),c(!1))}})(),()=>{d.current=!1}),[n]);const f=()=>{i||s()};return i?e.jsx(t.Box,{ref:l,style:{width:"40px",height:"40px",display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"transparent",border:"none",borderRadius:"var(--mantine-radius-sm)"},children:e.jsx(t.Skeleton,{width:o,height:o})}):e.jsx(t.Tooltip,{label:wn(n),position:"top",withArrow:!0,openDelay:300,withinPortal:!0,zIndex:1e3,color:"dark",children:e.jsx(t.Box,{ref:l,onClick:f,style:{width:"40px",height:"40px",fontSize:`${o}px`,display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"transparent",border:"none",transition:"all 0.2s ease",cursor:i?"not-allowed":"pointer",borderRadius:"var(--mantine-radius-md)"},onMouseEnter:h=>{i||(h.currentTarget.style.backgroundColor="var(--mantine-color-gray-1)",h.currentTarget.style.transform="scale(1.05)")},onMouseLeave:h=>{i||(h.currentTarget.style.backgroundColor="transparent",h.currentTarget.style.transform="scale(1)")},onMouseDown:h=>{i||(h.currentTarget.style.backgroundColor="var(--mantine-color-gray-2)",h.currentTarget.style.transform="scale(0.95)")},onMouseUp:h=>{i||(h.currentTarget.style.backgroundColor="var(--mantine-color-gray-1)",h.currentTarget.style.transform="scale(1.05)")},children:r&&e.jsx(r,{size:o,color:"var(--mantine-color-gray-7)"})})})});ut.displayName="IconButton";const ft=u.memo(({iconName:n,size:s="lg",style:o,withBorder:r=!1,radius:a="md",onClick:i,onMouseEnter:c,onMouseLeave:l})=>{const[d,f]=u.useState(!1),[h,m]=u.useState(()=>le.get(n)||null),x=xe(s),I=Math.round(x*.9);u.useEffect(()=>{if(le.has(n)){m(()=>le.get(n));return}let y=!0;return bn(n).then(g=>{y&&m(()=>g)}),()=>{y=!1}},[n]);const p=()=>typeof a=="number"?a:`var(--mantine-radius-${a})`;return h?e.jsx(t.Box,{style:{width:`${x}px !important`,height:`${x}px !important`,minWidth:`${x}px`,minHeight:`${x}px`,maxWidth:`${x}px`,maxHeight:`${x}px`,display:"flex",alignItems:"center",justifyContent:"center",borderRadius:p(),cursor:i?"pointer":"default",border:r?"1px solid var(--mantine-color-gray-4)":"none",backgroundColor:d?"var(--mantine-color-gray-0)":"transparent",flexShrink:0,boxSizing:"border-box",transition:"background-color 0.2s ease",...o},onClick:i,onMouseEnter:y=>{f(!0),c==null||c(y)},onMouseLeave:y=>{f(!1),l==null||l(y)},children:e.jsx(h,{size:I,color:"var(--mantine-color-gray-8)"})}):e.jsx(t.Box,{style:{width:`${x}px !important`,height:`${x}px !important`,minWidth:`${x}px`,minHeight:`${x}px`,maxWidth:`${x}px`,maxHeight:`${x}px`,display:"flex",alignItems:"center",justifyContent:"center",borderRadius:p(),cursor:i?"pointer":"default",border:r?"1px solid var(--mantine-color-gray-4)":"none",backgroundColor:d?"var(--mantine-color-gray-0)":"transparent",flexShrink:0,boxSizing:"border-box",transition:"background-color 0.2s ease",...o},onClick:i,onMouseEnter:y=>{f(!0),c==null||c(y)},onMouseLeave:y=>{f(!1),l==null||l(y)}})});ft.displayName="IconAvatar";const Sn=n=>{const s={xs:{width:28,height:28},sm:{width:32,height:32},md:{width:36,height:36},lg:{width:40,height:40},xl:{width:44,height:44},xxl:{width:48,height:48}};return typeof n=="number"?{width:n,height:n}:s[n]},ht=({iconName:n,size:s="lg",editable:o=!1,onClick:r,className:a,style:i})=>{const c=Sn(s),l=o&&r;return e.jsx(t.Box,{className:a,style:{...c,borderRadius:"var(--mantine-radius-md)",overflow:"hidden",cursor:l?"pointer":"default",position:"relative",display:"flex",alignItems:"center",justifyContent:"center",transition:"background-color 0.2s ease",backgroundColor:"transparent",...i},onClick:l?r:void 0,onMouseEnter:d=>{l&&(d.currentTarget.style.backgroundColor="var(--mantine-color-gray-0)")},onMouseLeave:d=>{l&&(d.currentTarget.style.backgroundColor="transparent")},children:e.jsx(t.Box,{style:{width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center",pointerEvents:"none"},children:e.jsx(ft,{iconName:n,size:c.width,onClick:void 0})})})},kn=n=>{const s={xs:{width:28,height:28},sm:{width:32,height:32},md:{width:36,height:36},lg:{width:40,height:40},xl:{width:44,height:44},xxl:{width:48,height:48}};return typeof n=="number"?{width:n,height:n}:s[n]},xt=({src:n,size:s="lg",editable:o=!1,onClick:r,className:a,style:i,loading:c=!1,alt:l="Avatar"})=>{const[d,f]=u.useState(!1),h=kn(s),m=o&&r,x=()=>{f(!0)},I=()=>{f(!1)};return e.jsx(t.Box,{className:a,style:{...h,borderRadius:"var(--mantine-radius-md)",overflow:"hidden",cursor:m?"pointer":"default",position:"relative",display:"flex",alignItems:"center",justifyContent:"center",transition:"background-color 0.2s ease",backgroundColor:"transparent",...i},onClick:m?r:void 0,onMouseEnter:p=>{m&&(p.currentTarget.style.backgroundColor="var(--mantine-color-gray-0)")},onMouseLeave:p=>{m&&(p.currentTarget.style.backgroundColor="transparent")},children:c?e.jsx(t.Loader,{size:"sm",color:"var(--mantine-color-gray-6)",style:{position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)"}}):!d&&e.jsx("img",{src:n,alt:l,style:{width:"100%",height:"100%",objectFit:"cover"},onError:x,onLoad:I})})},Cn=n=>{const s={xs:{width:28,height:28,fontSize:14},sm:{width:32,height:32,fontSize:16},md:{width:36,height:36,fontSize:20},lg:{width:40,height:40,fontSize:24},xl:{width:44,height:44,fontSize:32},xxl:{width:48,height:48,fontSize:36}};return typeof n=="number"?{width:n,height:n,fontSize:n*.5}:s[n]},Oe=({text:n="?",size:s="lg",editable:o=!1,onClick:r,className:a,style:i,loading:c=!1})=>{const l=Cn(s),d=o&&r;return e.jsx(t.Box,{className:a,style:{...l,borderRadius:"var(--mantine-radius-md)",overflow:"hidden",cursor:d?"pointer":"default",position:"relative",display:"flex",alignItems:"center",justifyContent:"center",transition:"background-color 0.2s ease",backgroundColor:"var(--mantine-color-gray-1)",...i},onClick:d?r:void 0,onMouseEnter:f=>{d&&(f.currentTarget.style.backgroundColor="var(--mantine-color-gray-3)")},onMouseLeave:f=>{d&&(f.currentTarget.style.backgroundColor="var(--mantine-color-gray-2)")},children:c?e.jsx(t.Loader,{size:"sm",color:"var(--mantine-color-gray-6)",style:{position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)"}}):e.jsx(t.Box,{style:{fontSize:l.fontSize,lineHeight:1,display:"flex",alignItems:"center",justifyContent:"center",fontWeight:650,color:"var(--mantine-color-gray-7)"},children:n})})},pt=n=>{if(!n)return"";const s=["de","del","la","las","los","y","el","en","con"],r=n.trim().split(/\s+/).filter(a=>!s.includes(a.toLowerCase())).map(a=>{var i;return((i=a[0])==null?void 0:i.toUpperCase())||""}).filter(Boolean).slice(0,2).join("");return r.length===1?r+r:r.length===0?n.slice(0,2).toUpperCase():r},se=({avatar:n,size:s="lg",loading:o=!1,onClick:r,className:a,style:i,showPlaceholder:c=!0,placeholder:l,editable:d=!1})=>{const f=()=>{if(n)switch(n.type){case"emoji":return e.jsx(dt,{emoji:n.value,size:s,editable:d,onClick:r});case"icon":return e.jsx(ht,{iconName:n.value,size:s,editable:d,onClick:r});case"image":return e.jsx(xt,{src:n.value,size:s,editable:d,onClick:r})}if(c){const m=l?pt(l):"?";return e.jsx(Oe,{text:m,size:s,editable:d,onClick:r})}return null};if(o)return e.jsx(Oe,{size:s,loading:!0,className:a,style:i});const h=f();return h?e.jsx("div",{className:a,style:i,children:h}):null},ze=({label:n,onClick:s,isActive:o=!1})=>{const[r,a]=u.useState(!1);return e.jsx(t.Box,{onClick:s,bg:r||o?"var(--mantine-color-gray-0)":"transparent",onMouseEnter:()=>a(!0),onMouseLeave:()=>a(!1),h:28,style:{display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"var(--mantine-radius-md)",padding:"0px 10px",cursor:"pointer"},children:e.jsx(t.Text,{fw:500,fz:"sm",truncate:"end",c:"var(--mantine-color-gray-9)",children:n})})},Mn=new URL("data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTUiIGhlaWdodD0iNTYiIHZpZXdCb3g9IjAgMCA1NSA1NiIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZD0iTTAgMC43NUg1NVY1NS43NUgwVjAuNzVaIiBmaWxsPSIjRjZGNUY0Ii8+CjxwYXRoIGQ9Ik04LjgwMDI5IDM0LjYzQzguODAwMjkgMzQuMTQ0IDkuMTk0MjggMzMuNzUgOS42ODAyOSAzMy43NUgxOC45MjAzQzE5LjQwNjMgMzMuNzUgMTkuODAwMyAzNC4xNDQgMTkuODAwMyAzNC42M1Y0My44N0MxOS44MDAzIDQ0LjM1NiAxOS40MDYzIDQ0Ljc1IDE4LjkyMDMgNDQuNzVIOS42ODAyOUM5LjE5NDI4IDQ0Ljc1IDguODAwMjkgNDQuMzU2IDguODAwMjkgNDMuODdWMzQuNjNaIiBmaWxsPSIjRkZDQTAwIi8+CjxwYXRoIGQ9Ik0yMi4wMDAyIDIzLjYzQzIyLjAwMDIgMjMuMTQ0IDIyLjM5NDIgMjIuNzUgMjIuODgwMiAyMi43NUgzMi4xMjAyQzMyLjYwNjMgMjIuNzUgMzMuMDAwMiAyMy4xNDQgMzMuMDAwMiAyMy42M1Y0My44N0MzMy4wMDAyIDQ0LjM1NiAzMi42MDYzIDQ0Ljc1IDMyLjEyMDIgNDQuNzVIMjIuODgwMkMyMi4zOTQyIDQ0Ljc1IDIyLjAwMDIgNDQuMzU2IDIyLjAwMDIgNDMuODdWMjMuNjNaIiBmaWxsPSIjMzdDRTkxIi8+CjxwYXRoIGQ9Ik0zNS4yMDAyIDEyLjYzQzM1LjIwMDIgMTIuMTQ0IDM1LjU5NDIgMTEuNzUgMzYuMDgwMiAxMS43NUg0NS4zMjAyQzQ1LjgwNjIgMTEuNzUgNDYuMjAwMiAxMi4xNDQgNDYuMjAwMiAxMi42M1Y0My44N0M0Ni4yMDAyIDQ0LjM1NiA0NS44MDYyIDQ0Ljc1IDQ1LjMyMDIgNDQuNzVIMzYuMDgwMkMzNS41OTQyIDQ0Ljc1IDM1LjIwMDIgNDQuMzU2IDM1LjIwMDIgNDMuODdWMTIuNjNaIiBmaWxsPSIjRkIzNzU3Ii8+CjxwYXRoIGQ9Ik04LjgwMDA1IDE3LjI1QzguODAwMDUgMTQuMjEyNCAxMS4yNjI1IDExLjc1IDE0LjMgMTEuNzVDMTcuMzM3NiAxMS43NSAxOS44IDE0LjIxMjQgMTkuOCAxNy4yNUMxOS44IDIwLjI4NzYgMTcuMzM3NiAyMi43NSAxNC4zIDIyLjc1QzExLjI2MjUgMjIuNzUgOC44MDAwNSAyMC4yODc2IDguODAwMDUgMTcuMjVaIiBmaWxsPSIjMDA3MkZGIi8+Cjwvc3ZnPgo=",self.location).href,mt=({appName:n="Obeyaka",size:s="md",showText:o=!0,color:r="var(--mantine-color-dark-6)",radius:a})=>{const i=()=>{switch(s){case"xs":return{icon:24,text:"xs"};case"sm":return{icon:24,text:"md"};case"md":return{icon:28,text:"lg"};case"lg":return{icon:32,text:"xl"};default:return{icon:36,text:"lg"}}},c=()=>{switch(a){case"full":return"9999px";case"xs":return"var(--mantine-radius-xs)";case"sm":return"var(--mantine-radius-sm)";case"md":return"var(--mantine-radius-md)";case"lg":return"var(--mantine-radius-lg)";case"xl":return"var(--mantine-radius-xl)";default:return 0}},{icon:l,text:d}=i(),f=()=>{const h=l*56/55;return e.jsx("img",{src:Mn,alt:`${n} Logo`,width:l,height:h,style:{display:"block",flexShrink:0,borderRadius:c()}})};return e.jsxs(t.Group,{gap:"xs",align:"center",wrap:"nowrap",children:[f(),o&&e.jsx(t.Text,{size:d,fw:700,c:r==="white"?"white":r,style:{fontFamily:"Inter, -apple-system, BlinkMacSystemFont, sans-serif"},children:n})]})},be=({value:n,label:s,onChange:o,onDraftChange:r,placeholder:a="Click to edit...",disabled:i=!1,bgColor:c="gray",size:l="md",radius:d="sm",className:f="",style:h,showEditBorder:m=!0,editBorderColor:x="#228be6",selectOnFocus:I=!1,pageTitle:p=!1,onHover:y=b=>{},...g})=>{const[b,j]=u.useState(!1),[C,S]=u.useState(n),[B,k]=u.useState(!1);u.useEffect(()=>{y(B)},[B,y]);const w=u.useRef(null),v={fontSize:"40px",fontWeight:700,color:"var(--mantine-color-gray-9)",border:"none",outline:"none",backgroundColor:"transparent",padding:"0",minHeight:"5rem"};u.useEffect(()=>{S(n)},[n]);const O=()=>{i||(j(!0),I&&w.current&&w.current.select())},M=()=>{j(!1),C!==n&&o(C)},z=L=>{S(L.target.value),r==null||r(L.target.value)},E=L=>{var _,N;L.key==="Enter"?(j(!1),o(C),(_=w.current)==null||_.blur()):L.key==="Escape"&&(S(n),j(!1),(N=w.current)==null||N.blur())},W={cursor:i?"not-allowed":"text"},P={backgroundColor:c==="gray"?"var(--mantine-color-gray-0)":c==="white"?"var(--mantine-color-white)":void 0,borderColor:b&&m?x:void 0,borderWidth:b&&m?"2px":void 0,transition:"border-color 0.2s ease-in-out, border-width 0.2s ease-in-out",color:"var(--mantine-color-gray-9)"},H=()=>p?{...P,...v}:P;return e.jsx(t.InputWrapper,{label:s,size:l,children:e.jsx(t.Input,{ref:w,value:C,onChange:z,onMouseEnter:()=>k(!0),onMouseLeave:()=>k(!1),onFocus:O,onBlur:M,onKeyDown:E,placeholder:a,disabled:i,size:l,fw:500,radius:d,className:f,style:{...W,...h},styles:{input:{...H()}},...g})})},gt=({value:n,label:s,onChange:o,onDraftChange:r,placeholder:a="Click to edit...",disabled:i=!1,bgColor:c="gray",size:l="md",radius:d="md",className:f="",style:h,showEditBorder:m=!0,editBorderColor:x="#228be6",selectOnFocus:I=!1,minRows:p=1,maxRows:y,autosize:g=!0,onHover:b=S=>{},pageTitle:j=!1,...C})=>{const[S,B]=u.useState(!1),[k,w]=u.useState(n),[v,O]=u.useState(!1);u.useEffect(()=>{b(v)},[v,b]);const M=u.useRef(null);u.useEffect(()=>{w(n)},[n]);const z=()=>{const F=M.current;F&&(F.style.height="0px",F.style.minHeight="0px",F.style.overflowY="hidden",F.style.height=`${F.scrollHeight}px`)};u.useEffect(()=>{g&&z()},[g]),u.useEffect(()=>{g&&z()},[k,g]);const E=()=>{i||(B(!0),g&&requestAnimationFrame(()=>z()),I&&M.current&&M.current.select())},W=()=>{B(!1),k!==n&&o(k)},P=F=>{w(F.target.value),r==null||r(F.target.value)},H=F=>{var G;F.key==="Escape"&&(w(n),B(!1),(G=M.current)==null||G.blur())},L={cursor:i?"not-allowed":"text"},_={borderRadius:"var(--mantine-radius-md)",backgroundColor:c==="gray"?"var(--mantine-color-gray-0)":c==="white"?"transparent":void 0,borderColor:S&&m?x:void 0,borderWidth:S&&m?"1px":void 0,color:"var(--mantine-color-gray-9)",width:"100%",fontWeight:450},N={fontSize:"40px",fontWeight:750,color:"var(--mantine-color-gray-9)",border:"none",outline:"none",backgroundColor:"transparent",padding:"0",lineHeight:"3rem"},Z=()=>j?{..._,...N}:_;return e.jsx(t.InputWrapper,{label:s,c:"var(--mantine-color-gray-9)",size:l,children:e.jsx(t.Textarea,{w:"100%",radius:"var(--mantine-radius-md)",ref:M,value:k,onChange:P,onMouseEnter:()=>O(!0),onMouseLeave:()=>O(!1),onFocus:E,onBlur:W,onKeyDown:H,placeholder:a,disabled:i,size:l,fw:450,className:f,style:{...L,...h},styles:{input:{...Z(),overflowY:g?"hidden":void 0,resize:g?"none":void 0}},autosize:g,minRows:p,maxRows:y,...C})})},fe=u.memo(({icon:n,iconOnHover:s,size:o="md",color:r="var(--mantine-color-gray-9)",grayScaleBaseColor:a,disabled:i=!1,tooltip:c,...l})=>{const d=()=>a||a===0?`var(--mantine-color-gray-${a})`:"transparent",f=()=>a||a===0?`var(--mantine-color-gray-${a+1})`:"var(--mantine-color-gray-0)",h=p=>p==="md"?{height:28,iconSize:20}:p==="sm"?{height:24,iconSize:16}:{height:28,iconSize:20},[m,x]=u.useState(!1),I=m&&s&&!i?e.jsx(s,{size:h(o).iconSize,strokeWidth:2,color:r}):e.jsx(n,{size:h(o).iconSize,strokeWidth:2,color:r,opacity:i?.5:1});return e.jsxs(t.ActionIcon,{size:h(o).height,radius:"md",onMouseEnter:()=>x(!0),onMouseLeave:()=>x(!1),bg:m&&!i?f():d(),disabled:i,...l,children:[c&&!i&&e.jsx(t.Tooltip,{label:c,position:"top",withArrow:!0,openDelay:300,children:I}),!c&&I]})}),It=({expandDirection:n="right",placeholder:s="Type to search",value:o="",onChange:r,onSearch:a,onClear:i,size:c="md",disabled:l=!1,className:d})=>{const[f,h]=u.useState(!1),[m,x]=u.useState(!1),[I,p]=u.useState(o),y=u.useRef(null),g=u.useRef(null);u.useEffect(()=>{p(o)},[o]),u.useEffect(()=>{f&&y.current&&y.current.focus()},[f]),u.useEffect(()=>{const v=O=>{g.current&&!g.current.contains(O.target)&&b()};if(f)return document.addEventListener("mousedown",v),()=>{document.removeEventListener("mousedown",v)}},[f]);const b=()=>{x(!0),setTimeout(()=>{h(!1),x(!1)},200)},j=()=>{l||h(!0)},C=v=>{const O=v.target.value;p(O),r==null||r(O)},S=v=>{v.key==="Enter"&&(a==null||a(I)),v.key==="Escape"&&b()},B=()=>{p(""),r==null||r(""),i==null||i(),b()},w=(()=>{switch(c){case"sm":return{iconSize:20,inputHeight:32,fontSize:"var(--mantine-font-size-sm)"};case"lg":return{iconSize:20,inputHeight:32,fontSize:"var(--mantine-font-size-md)"};default:return{iconSize:20,inputHeight:32,fontSize:"var(--mantine-font-size-sm)"}}})();return e.jsxs(t.Box,{ref:g,className:d,style:{position:"relative",display:"inline-flex",alignItems:"center"},children:[e.jsxs(t.Group,{gap:0,style:{position:"relative",transition:"all 0.2s ease",borderRadius:"var(--mantine-radius-md)"},children:[e.jsx(t.Box,{onClick:j,style:{display:"flex",alignItems:"center",justifyContent:"center",width:w.inputHeight,height:w.inputHeight,cursor:l?"not-allowed":"pointer",borderRadius:"var(--mantine-radius-md)",transition:"background-color 0.2s ease",opacity:l?.5:1},onMouseEnter:v=>{l||(v.currentTarget.style.backgroundColor="var(--mantine-color-gray-0)")},onMouseLeave:v=>{v.currentTarget.style.backgroundColor="transparent"},children:e.jsx(T.IconSearch,{size:w.iconSize,color:"var(--mantine-color-gray-6)",strokeWidth:2.3})}),f&&e.jsx(t.TextInput,{ref:y,value:I,onChange:C,onKeyDown:S,placeholder:s,disabled:l,height:w.inputHeight,fw:500,styles:{root:{position:"relative",animation:m?`shrink${n==="right"?"Right":"Left"} 0.2s ease forwards`:`expand${n==="right"?"Right":"Left"} 0.2s ease forwards`},input:{border:"none",outline:"none",backgroundColor:"transparent",padding:"0 8px",height:w.inputHeight,minHeight:w.inputHeight,fontSize:w.fontSize,color:"var(--mantine-color-gray-8)",borderRadius:"var(--mantine-radius-md)",transition:"background-color 0.2s ease",display:"flex",alignItems:"center","&:hover":{backgroundColor:"var(--mantine-color-gray-1)"},"&:focus":{backgroundColor:"var(--mantine-color-gray-1)"},"&::placeholder":{color:"var(--mantine-color-gray-5)"}}},rightSection:I&&e.jsx(t.Box,{onClick:B,style:{display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",padding:"4px",borderRadius:"var(--mantine-radius-xl)",transition:"background-color 0.2s ease"},onMouseEnter:v=>{v.currentTarget.style.backgroundColor="var(--mantine-color-gray-2)"},onMouseLeave:v=>{v.currentTarget.style.backgroundColor="transparent"},children:e.jsx(T.IconX,{size:14,color:"var(--mantine-color-gray-6)",strokeWidth:2.3})}),rightSectionWidth:I?24:0})]}),e.jsx("style",{children:`
1
+ "use strict";var un=Object.create;var ot=Object.defineProperty;var fn=Object.getOwnPropertyDescriptor;var hn=Object.getOwnPropertyNames;var xn=Object.getPrototypeOf,pn=Object.prototype.hasOwnProperty;var mn=(n,s,o,r)=>{if(s&&typeof s=="object"||typeof s=="function")for(let a of hn(s))!pn.call(n,a)&&a!==o&&ot(n,a,{get:()=>s[a],enumerable:!(r=fn(s,a))||r.enumerable});return n};var _e=(n,s,o)=>(o=n!=null?un(xn(n)):{},mn(s||!n||!n.__esModule?ot(o,"default",{value:n,enumerable:!0}):o,n));Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),u=require("react"),t=require("@mantine/core"),T=require("@tabler/icons-react"),Oe=require("@emoji-mart/data"),lt=require("emoji-mart"),ve=require("@mantine/hooks"),gn=require("@mantine/notifications"),In=require("@mantine/modals"),yn=require("@mantine/dates"),ee=u.memo(({onClick:n,icon:s,changeIconOnHover:o=!1,iconHovered:r,iconColor:a="var(--mantine-color-gray-7)",size:i="md",variant:l="transparent",bg:c,disabled:d=!1,loading:f=!1,tooltip:x,"aria-label":m,className:h,style:I,onMouseEnter:p,onMouseLeave:y,...g})=>{const[b,v]=u.useState(!1),C=u.useCallback(()=>{d||f||(n==null||n(),console.log("Clicked"))},[d,f,n]),w=u.useMemo(()=>({xs:14,sm:16,md:20,lg:24,xl:28})[i]||20,[i]),O=u.useMemo(()=>({xs:2,sm:2,md:2,lg:2,xl:2.5})[i]||2,[i]),B=u.useCallback(D=>{v(!0),p==null||p(D)},[p]),k=u.useCallback(D=>{v(!1),y==null||y(D)},[y]),j=u.useMemo(()=>{if(c)return c;if(l==="transparent")return b?"var(--mantine-color-gray-2)":"transparent"},[c,l,b]),M=u.useMemo(()=>o&&r&&b?r:s,[o,r,b,s]),S=u.useMemo(()=>e.jsx(M,{size:w,strokeWidth:O,color:a}),[M,w,O,a]),z=e.jsx(t.ActionIcon,{onClick:C,bg:j,color:a,radius:"md",variant:l==="transparent"?"transparent":l,size:i,disabled:d||f,loading:f,onMouseEnter:B,onMouseLeave:k,"aria-label":m||x,className:h,style:I,...g,children:S});return x&&!d&&!f?e.jsx(t.Tooltip,{label:x,position:"top",withArrow:!0,children:z}):z});ee.displayName="ActionButton";const vn=n=>{const s={xs:{width:28,height:28,fontSize:16},sm:{width:32,height:32,fontSize:24},md:{width:36,height:36,fontSize:32},lg:{width:40,height:40,fontSize:40},xl:{width:44,height:44,fontSize:44},xxl:{width:48,height:48,fontSize:48}};return typeof n=="number"?{width:n,height:n,fontSize:n-8}:s[n]},dt=({emoji:n,size:s="lg",editable:o=!1,onClick:r,className:a,style:i})=>{const l=vn(s),c=o&&r;return e.jsx(t.Box,{className:a,style:{...l,borderRadius:"var(--mantine-radius-md)",overflow:"hidden",cursor:c?"pointer":"default",position:"relative",display:"flex",alignItems:"center",justifyContent:"center",transition:"background-color 0.2s ease",backgroundColor:"transparent",...i},onClick:c?r:void 0,onMouseEnter:d=>{c&&(d.currentTarget.style.backgroundColor="var(--mantine-color-gray-0)")},onMouseLeave:d=>{c&&(d.currentTarget.style.backgroundColor="transparent")},children:e.jsx(t.Box,{style:{fontSize:l.fontSize,lineHeight:1,display:"flex",alignItems:"center",justifyContent:"center"},children:n})})},xe=n=>{if(typeof n=="number")return n;switch(n){case"xs":return 24;case"sm":return 32;case"md":return 48;case"lg":return 64;case"xl":return 80;default:return 64}},le=new Map,jn=["IconUser","IconHeart","IconStar","IconSmile","IconSun","IconMoon","IconCamera","IconMusic","IconCode","IconBriefcase","IconHome","IconSearch","IconSettings","IconMail","IconPhone","IconBell","IconBookmark","IconCalendar","IconClock","IconDownload","IconEdit","IconEye","IconFile","IconFolder","IconImage","IconLink","IconLock","IconMessage","IconPlus","IconShare","IconThumbUp","IconTrash"],bn=async()=>{try{const n=await import("@tabler/icons-react");jn.forEach(s=>{if(!le.has(s)){const o=n[s];o&&le.set(s,o)}})}catch(n){console.warn("Error preloading common icons:",n)}};bn();const wn=async n=>{if(le.has(n))return le.get(n);try{const r=(await import("@tabler/icons-react"))[n]||T.IconQuestionMark;return le.set(n,r),r}catch{return le.set(n,T.IconQuestionMark),T.IconQuestionMark}},Sn=n=>n.replace(/^Icon/,"").replace(/([A-Z])/g," $1").trim().toLowerCase().replace(/^./,o=>o.toUpperCase()),ut=u.memo(({iconName:n,onClick:s,size:o=20})=>{const[r,a]=u.useState(null),[i,l]=u.useState(!0),c=u.useRef(null),d=u.useRef(!0);u.useEffect(()=>(d.current=!0,(async()=>{try{const h=(await import("@tabler/icons-react"))[n];d.current&&(a(h?()=>h:T.IconQuestionMark),l(!1))}catch{d.current&&(a(()=>T.IconQuestionMark),l(!1))}})(),()=>{d.current=!1}),[n]);const f=()=>{i||s()};return i?e.jsx(t.Box,{ref:c,style:{width:"40px",height:"40px",display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"transparent",border:"none",borderRadius:"var(--mantine-radius-sm)"},children:e.jsx(t.Skeleton,{width:o,height:o})}):e.jsx(t.Tooltip,{label:Sn(n),position:"top",withArrow:!0,openDelay:300,withinPortal:!0,zIndex:1e3,color:"dark",children:e.jsx(t.Box,{ref:c,onClick:f,style:{width:"40px",height:"40px",fontSize:`${o}px`,display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"transparent",border:"none",transition:"all 0.2s ease",cursor:i?"not-allowed":"pointer",borderRadius:"var(--mantine-radius-md)"},onMouseEnter:x=>{i||(x.currentTarget.style.backgroundColor="var(--mantine-color-gray-1)",x.currentTarget.style.transform="scale(1.05)")},onMouseLeave:x=>{i||(x.currentTarget.style.backgroundColor="transparent",x.currentTarget.style.transform="scale(1)")},onMouseDown:x=>{i||(x.currentTarget.style.backgroundColor="var(--mantine-color-gray-2)",x.currentTarget.style.transform="scale(0.95)")},onMouseUp:x=>{i||(x.currentTarget.style.backgroundColor="var(--mantine-color-gray-1)",x.currentTarget.style.transform="scale(1.05)")},children:r&&e.jsx(r,{size:o,color:"var(--mantine-color-gray-7)"})})})});ut.displayName="IconButton";const ft=u.memo(({iconName:n,size:s="lg",style:o,withBorder:r=!1,radius:a="md",onClick:i,onMouseEnter:l,onMouseLeave:c})=>{const[d,f]=u.useState(!1),[x,m]=u.useState(()=>le.get(n)||null),h=xe(s),I=Math.round(h*.9);u.useEffect(()=>{if(le.has(n)){m(()=>le.get(n));return}let y=!0;return wn(n).then(g=>{y&&m(()=>g)}),()=>{y=!1}},[n]);const p=()=>typeof a=="number"?a:`var(--mantine-radius-${a})`;return x?e.jsx(t.Box,{style:{width:`${h}px !important`,height:`${h}px !important`,minWidth:`${h}px`,minHeight:`${h}px`,maxWidth:`${h}px`,maxHeight:`${h}px`,display:"flex",alignItems:"center",justifyContent:"center",borderRadius:p(),cursor:i?"pointer":"default",border:r?"1px solid var(--mantine-color-gray-4)":"none",backgroundColor:d?"var(--mantine-color-gray-0)":"transparent",flexShrink:0,boxSizing:"border-box",transition:"background-color 0.2s ease",...o},onClick:i,onMouseEnter:y=>{f(!0),l==null||l(y)},onMouseLeave:y=>{f(!1),c==null||c(y)},children:e.jsx(x,{size:I,color:"var(--mantine-color-gray-8)"})}):e.jsx(t.Box,{style:{width:`${h}px !important`,height:`${h}px !important`,minWidth:`${h}px`,minHeight:`${h}px`,maxWidth:`${h}px`,maxHeight:`${h}px`,display:"flex",alignItems:"center",justifyContent:"center",borderRadius:p(),cursor:i?"pointer":"default",border:r?"1px solid var(--mantine-color-gray-4)":"none",backgroundColor:d?"var(--mantine-color-gray-0)":"transparent",flexShrink:0,boxSizing:"border-box",transition:"background-color 0.2s ease",...o},onClick:i,onMouseEnter:y=>{f(!0),l==null||l(y)},onMouseLeave:y=>{f(!1),c==null||c(y)}})});ft.displayName="IconAvatar";const kn=n=>{const s={xs:{width:28,height:28},sm:{width:32,height:32},md:{width:36,height:36},lg:{width:40,height:40},xl:{width:44,height:44},xxl:{width:48,height:48}};return typeof n=="number"?{width:n,height:n}:s[n]},ht=({iconName:n,size:s="lg",editable:o=!1,onClick:r,className:a,style:i})=>{const l=kn(s),c=o&&r;return e.jsx(t.Box,{className:a,style:{...l,borderRadius:"var(--mantine-radius-md)",overflow:"hidden",cursor:c?"pointer":"default",position:"relative",display:"flex",alignItems:"center",justifyContent:"center",transition:"background-color 0.2s ease",backgroundColor:"transparent",...i},onClick:c?r:void 0,onMouseEnter:d=>{c&&(d.currentTarget.style.backgroundColor="var(--mantine-color-gray-0)")},onMouseLeave:d=>{c&&(d.currentTarget.style.backgroundColor="transparent")},children:e.jsx(t.Box,{style:{width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center",pointerEvents:"none"},children:e.jsx(ft,{iconName:n,size:l.width,onClick:void 0})})})},Cn=n=>{const s={xs:{width:28,height:28},sm:{width:32,height:32},md:{width:36,height:36},lg:{width:40,height:40},xl:{width:44,height:44},xxl:{width:48,height:48}};return typeof n=="number"?{width:n,height:n}:s[n]},xt=({src:n,size:s="lg",editable:o=!1,onClick:r,className:a,style:i,loading:l=!1,alt:c="Avatar"})=>{const[d,f]=u.useState(!1),x=Cn(s),m=o&&r,h=()=>{f(!0)},I=()=>{f(!1)};return e.jsx(t.Box,{className:a,style:{...x,borderRadius:"var(--mantine-radius-md)",overflow:"hidden",cursor:m?"pointer":"default",position:"relative",display:"flex",alignItems:"center",justifyContent:"center",transition:"background-color 0.2s ease",backgroundColor:"transparent",...i},onClick:m?r:void 0,onMouseEnter:p=>{m&&(p.currentTarget.style.backgroundColor="var(--mantine-color-gray-0)")},onMouseLeave:p=>{m&&(p.currentTarget.style.backgroundColor="transparent")},children:l?e.jsx(t.Loader,{size:"sm",color:"var(--mantine-color-gray-6)",style:{position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)"}}):!d&&e.jsx("img",{src:n,alt:c,style:{width:"100%",height:"100%",objectFit:"cover"},onError:h,onLoad:I})})},Mn=n=>{const s={xs:{width:28,height:28,fontSize:14},sm:{width:32,height:32,fontSize:16},md:{width:36,height:36,fontSize:20},lg:{width:40,height:40,fontSize:24},xl:{width:44,height:44,fontSize:32},xxl:{width:48,height:48,fontSize:36}};return typeof n=="number"?{width:n,height:n,fontSize:n*.5}:s[n]},ze=({text:n="?",size:s="lg",editable:o=!1,onClick:r,className:a,style:i,loading:l=!1})=>{const c=Mn(s),d=o&&r;return e.jsx(t.Box,{className:a,style:{...c,borderRadius:"var(--mantine-radius-md)",overflow:"hidden",cursor:d?"pointer":"default",position:"relative",display:"flex",alignItems:"center",justifyContent:"center",transition:"background-color 0.2s ease",backgroundColor:"var(--mantine-color-gray-1)",...i},onClick:d?r:void 0,onMouseEnter:f=>{d&&(f.currentTarget.style.backgroundColor="var(--mantine-color-gray-3)")},onMouseLeave:f=>{d&&(f.currentTarget.style.backgroundColor="var(--mantine-color-gray-2)")},children:l?e.jsx(t.Loader,{size:"sm",color:"var(--mantine-color-gray-6)",style:{position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)"}}):e.jsx(t.Box,{style:{fontSize:c.fontSize,lineHeight:1,display:"flex",alignItems:"center",justifyContent:"center",fontWeight:650,color:"var(--mantine-color-gray-7)"},children:n})})},pt=n=>{if(!n)return"";const s=["de","del","la","las","los","y","el","en","con"],r=n.trim().split(/\s+/).filter(a=>!s.includes(a.toLowerCase())).map(a=>{var i;return((i=a[0])==null?void 0:i.toUpperCase())||""}).filter(Boolean).slice(0,2).join("");return r.length===1?r+r:r.length===0?n.slice(0,2).toUpperCase():r},se=({avatar:n,size:s="lg",loading:o=!1,onClick:r,className:a,style:i,showPlaceholder:l=!0,placeholder:c,editable:d=!1})=>{const f=()=>{if(n)switch(n.type){case"emoji":return e.jsx(dt,{emoji:n.value,size:s,editable:d,onClick:r});case"icon":return e.jsx(ht,{iconName:n.value,size:s,editable:d,onClick:r});case"image":return e.jsx(xt,{src:n.value,size:s,editable:d,onClick:r})}if(l){const m=c?pt(c):"?";return e.jsx(ze,{text:m,size:s,editable:d,onClick:r})}return null};if(o)return e.jsx(ze,{size:s,loading:!0,className:a,style:i});const x=f();return x?e.jsx("div",{className:a,style:i,children:x}):null},Re=({label:n,onClick:s,isActive:o=!1})=>{const[r,a]=u.useState(!1);return e.jsx(t.Box,{onClick:s,bg:r||o?"var(--mantine-color-gray-0)":"transparent",onMouseEnter:()=>a(!0),onMouseLeave:()=>a(!1),h:28,style:{display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"var(--mantine-radius-md)",padding:"0px 10px",cursor:"pointer"},children:e.jsx(t.Text,{fw:500,fz:"sm",truncate:"end",c:"var(--mantine-color-gray-9)",children:n})})},Bn=new URL("data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTUiIGhlaWdodD0iNTYiIHZpZXdCb3g9IjAgMCA1NSA1NiIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZD0iTTAgMC43NUg1NVY1NS43NUgwVjAuNzVaIiBmaWxsPSIjRjZGNUY0Ii8+CjxwYXRoIGQ9Ik04LjgwMDI5IDM0LjYzQzguODAwMjkgMzQuMTQ0IDkuMTk0MjggMzMuNzUgOS42ODAyOSAzMy43NUgxOC45MjAzQzE5LjQwNjMgMzMuNzUgMTkuODAwMyAzNC4xNDQgMTkuODAwMyAzNC42M1Y0My44N0MxOS44MDAzIDQ0LjM1NiAxOS40MDYzIDQ0Ljc1IDE4LjkyMDMgNDQuNzVIOS42ODAyOUM5LjE5NDI4IDQ0Ljc1IDguODAwMjkgNDQuMzU2IDguODAwMjkgNDMuODdWMzQuNjNaIiBmaWxsPSIjRkZDQTAwIi8+CjxwYXRoIGQ9Ik0yMi4wMDAyIDIzLjYzQzIyLjAwMDIgMjMuMTQ0IDIyLjM5NDIgMjIuNzUgMjIuODgwMiAyMi43NUgzMi4xMjAyQzMyLjYwNjMgMjIuNzUgMzMuMDAwMiAyMy4xNDQgMzMuMDAwMiAyMy42M1Y0My44N0MzMy4wMDAyIDQ0LjM1NiAzMi42MDYzIDQ0Ljc1IDMyLjEyMDIgNDQuNzVIMjIuODgwMkMyMi4zOTQyIDQ0Ljc1IDIyLjAwMDIgNDQuMzU2IDIyLjAwMDIgNDMuODdWMjMuNjNaIiBmaWxsPSIjMzdDRTkxIi8+CjxwYXRoIGQ9Ik0zNS4yMDAyIDEyLjYzQzM1LjIwMDIgMTIuMTQ0IDM1LjU5NDIgMTEuNzUgMzYuMDgwMiAxMS43NUg0NS4zMjAyQzQ1LjgwNjIgMTEuNzUgNDYuMjAwMiAxMi4xNDQgNDYuMjAwMiAxMi42M1Y0My44N0M0Ni4yMDAyIDQ0LjM1NiA0NS44MDYyIDQ0Ljc1IDQ1LjMyMDIgNDQuNzVIMzYuMDgwMkMzNS41OTQyIDQ0Ljc1IDM1LjIwMDIgNDQuMzU2IDM1LjIwMDIgNDMuODdWMTIuNjNaIiBmaWxsPSIjRkIzNzU3Ii8+CjxwYXRoIGQ9Ik04LjgwMDA1IDE3LjI1QzguODAwMDUgMTQuMjEyNCAxMS4yNjI1IDExLjc1IDE0LjMgMTEuNzVDMTcuMzM3NiAxMS43NSAxOS44IDE0LjIxMjQgMTkuOCAxNy4yNUMxOS44IDIwLjI4NzYgMTcuMzM3NiAyMi43NSAxNC4zIDIyLjc1QzExLjI2MjUgMjIuNzUgOC44MDAwNSAyMC4yODc2IDguODAwMDUgMTcuMjVaIiBmaWxsPSIjMDA3MkZGIi8+Cjwvc3ZnPgo=",self.location).href,mt=({appName:n="Obeyaka",size:s="md",showText:o=!0,color:r="var(--mantine-color-dark-6)",radius:a})=>{const i=()=>{switch(s){case"xs":return{icon:24,text:"xs"};case"sm":return{icon:24,text:"md"};case"md":return{icon:28,text:"lg"};case"lg":return{icon:32,text:"xl"};default:return{icon:36,text:"lg"}}},l=()=>{switch(a){case"full":return"9999px";case"xs":return"var(--mantine-radius-xs)";case"sm":return"var(--mantine-radius-sm)";case"md":return"var(--mantine-radius-md)";case"lg":return"var(--mantine-radius-lg)";case"xl":return"var(--mantine-radius-xl)";default:return 0}},{icon:c,text:d}=i(),f=()=>{const x=c*56/55;return e.jsx("img",{src:Bn,alt:`${n} Logo`,width:c,height:x,style:{display:"block",flexShrink:0,borderRadius:l()}})};return e.jsxs(t.Group,{gap:"xs",align:"center",wrap:"nowrap",children:[f(),o&&e.jsx(t.Text,{size:d,fw:700,c:r==="white"?"white":r,style:{fontFamily:"Inter, -apple-system, BlinkMacSystemFont, sans-serif"},children:n})]})},we=({value:n,label:s,onChange:o,onDraftChange:r,placeholder:a="Click to edit...",disabled:i=!1,bgColor:l="gray",size:c="md",radius:d="sm",className:f="",style:x,showEditBorder:m=!0,editBorderColor:h="#228be6",selectOnFocus:I=!1,pageTitle:p=!1,onHover:y=b=>{},...g})=>{const[b,v]=u.useState(!1),[C,w]=u.useState(n),[O,B]=u.useState(!1);u.useEffect(()=>{y(O)},[O,y]);const k=u.useRef(null),j={fontSize:"40px",fontWeight:700,color:"var(--mantine-color-gray-9)",border:"none",outline:"none",backgroundColor:"transparent",padding:"0",minHeight:"5rem"};u.useEffect(()=>{w(n)},[n]);const M=()=>{i||(v(!0),I&&k.current&&k.current.select())},S=()=>{v(!1),C!==n&&o(C)},z=L=>{w(L.target.value),r==null||r(L.target.value)},D=L=>{var _,N;L.key==="Enter"?(v(!1),o(C),(_=k.current)==null||_.blur()):L.key==="Escape"&&(w(n),v(!1),(N=k.current)==null||N.blur())},F={cursor:i?"not-allowed":"text"},H={backgroundColor:l==="gray"?"var(--mantine-color-gray-0)":l==="white"?"var(--mantine-color-white)":void 0,borderColor:b&&m?h:void 0,borderWidth:b&&m?"2px":void 0,transition:"border-color 0.2s ease-in-out, border-width 0.2s ease-in-out",color:"var(--mantine-color-gray-9)"},P=()=>p?{...H,...j}:H;return e.jsx(t.InputWrapper,{label:s,size:c,children:e.jsx(t.Input,{ref:k,value:C,onChange:z,onMouseEnter:()=>B(!0),onMouseLeave:()=>B(!1),onFocus:M,onBlur:S,onKeyDown:D,placeholder:a,disabled:i,size:c,fw:500,radius:d,className:f,style:{...F,...x},styles:{input:{...P()}},...g})})},gt=({value:n,label:s,onChange:o,onDraftChange:r,placeholder:a="Click to edit...",disabled:i=!1,bgColor:l="gray",size:c="md",radius:d="md",className:f="",style:x,showEditBorder:m=!0,editBorderColor:h="#228be6",selectOnFocus:I=!1,minRows:p=1,maxRows:y,autosize:g=!0,onHover:b=w=>{},pageTitle:v=!1,...C})=>{const[w,O]=u.useState(!1),[B,k]=u.useState(n),[j,M]=u.useState(!1);u.useEffect(()=>{b(j)},[j,b]);const S=u.useRef(null);u.useEffect(()=>{k(n)},[n]);const z=()=>{const V=S.current;V&&(V.style.height="0px",V.style.minHeight="0px",V.style.overflowY="hidden",V.style.height=`${V.scrollHeight}px`)};u.useEffect(()=>{g&&z()},[g]),u.useEffect(()=>{g&&z()},[B,g]);const D=()=>{i||(O(!0),g&&requestAnimationFrame(()=>z()),I&&S.current&&S.current.select())},F=()=>{O(!1),B!==n&&o(B)},H=V=>{k(V.target.value),r==null||r(V.target.value)},P=V=>{var G;V.key==="Escape"&&(k(n),O(!1),(G=S.current)==null||G.blur())},L={cursor:i?"not-allowed":"text"},_={borderRadius:"var(--mantine-radius-md)",backgroundColor:l==="gray"?"var(--mantine-color-gray-0)":l==="white"?"transparent":void 0,borderColor:w&&m?h:void 0,borderWidth:w&&m?"1px":void 0,color:"var(--mantine-color-gray-9)",width:"100%",fontWeight:450},N={fontSize:"40px",fontWeight:750,color:"var(--mantine-color-gray-9)",border:"none",outline:"none",backgroundColor:"transparent",padding:"0",lineHeight:"3rem"},U=()=>v?{..._,...N}:_;return e.jsx(t.InputWrapper,{label:s,c:"var(--mantine-color-gray-9)",size:c,children:e.jsx(t.Textarea,{w:"100%",radius:"var(--mantine-radius-md)",ref:S,value:B,onChange:H,onMouseEnter:()=>M(!0),onMouseLeave:()=>M(!1),onFocus:D,onBlur:F,onKeyDown:P,placeholder:a,disabled:i,size:c,fw:450,className:f,style:{...L,...x},styles:{input:{...U(),overflowY:g?"hidden":void 0,resize:g?"none":void 0}},autosize:g,minRows:p,maxRows:y,...C})})},fe=u.memo(({icon:n,iconOnHover:s,size:o="md",color:r="var(--mantine-color-gray-9)",grayScaleBaseColor:a,disabled:i=!1,tooltip:l,...c})=>{const d=()=>a||a===0?`var(--mantine-color-gray-${a})`:"transparent",f=()=>a||a===0?`var(--mantine-color-gray-${a+1})`:"var(--mantine-color-gray-0)",x=p=>p==="md"?{height:28,iconSize:20}:p==="sm"?{height:24,iconSize:16}:{height:28,iconSize:20},[m,h]=u.useState(!1),I=m&&s&&!i?e.jsx(s,{size:x(o).iconSize,strokeWidth:2,color:r}):e.jsx(n,{size:x(o).iconSize,strokeWidth:2,color:r,opacity:i?.5:1});return e.jsxs(t.ActionIcon,{size:x(o).height,radius:"md",onMouseEnter:()=>h(!0),onMouseLeave:()=>h(!1),bg:m&&!i?f():d(),disabled:i,...c,children:[l&&!i&&e.jsx(t.Tooltip,{label:l,position:"top",withArrow:!0,openDelay:300,children:I}),!l&&I]})}),It=({expandDirection:n="right",placeholder:s="Type to search",value:o="",onChange:r,onSearch:a,onClear:i,size:l="md",disabled:c=!1,className:d})=>{const[f,x]=u.useState(!1),[m,h]=u.useState(!1),[I,p]=u.useState(o),y=u.useRef(null),g=u.useRef(null);u.useEffect(()=>{p(o)},[o]),u.useEffect(()=>{f&&y.current&&y.current.focus()},[f]),u.useEffect(()=>{const j=M=>{g.current&&!g.current.contains(M.target)&&b()};if(f)return document.addEventListener("mousedown",j),()=>{document.removeEventListener("mousedown",j)}},[f]);const b=()=>{h(!0),setTimeout(()=>{x(!1),h(!1)},200)},v=()=>{c||x(!0)},C=j=>{const M=j.target.value;p(M),r==null||r(M)},w=j=>{j.key==="Enter"&&(a==null||a(I)),j.key==="Escape"&&b()},O=()=>{p(""),r==null||r(""),i==null||i(),b()},k=(()=>{switch(l){case"sm":return{iconSize:20,inputHeight:32,fontSize:"var(--mantine-font-size-sm)"};case"lg":return{iconSize:20,inputHeight:32,fontSize:"var(--mantine-font-size-md)"};default:return{iconSize:20,inputHeight:32,fontSize:"var(--mantine-font-size-sm)"}}})();return e.jsxs(t.Box,{ref:g,className:d,style:{position:"relative",display:"inline-flex",alignItems:"center"},children:[e.jsxs(t.Group,{gap:0,style:{position:"relative",transition:"all 0.2s ease",borderRadius:"var(--mantine-radius-md)"},children:[e.jsx(t.Box,{onClick:v,style:{display:"flex",alignItems:"center",justifyContent:"center",width:k.inputHeight,height:k.inputHeight,cursor:c?"not-allowed":"pointer",borderRadius:"var(--mantine-radius-md)",transition:"background-color 0.2s ease",opacity:c?.5:1},onMouseEnter:j=>{c||(j.currentTarget.style.backgroundColor="var(--mantine-color-gray-0)")},onMouseLeave:j=>{j.currentTarget.style.backgroundColor="transparent"},children:e.jsx(T.IconSearch,{size:k.iconSize,color:"var(--mantine-color-gray-6)",strokeWidth:2.3})}),f&&e.jsx(t.TextInput,{ref:y,value:I,onChange:C,onKeyDown:w,placeholder:s,disabled:c,height:k.inputHeight,fw:500,styles:{root:{position:"relative",animation:m?`shrink${n==="right"?"Right":"Left"} 0.2s ease forwards`:`expand${n==="right"?"Right":"Left"} 0.2s ease forwards`},input:{border:"none",outline:"none",backgroundColor:"transparent",padding:"0 8px",height:k.inputHeight,minHeight:k.inputHeight,fontSize:k.fontSize,color:"var(--mantine-color-gray-8)",borderRadius:"var(--mantine-radius-md)",transition:"background-color 0.2s ease",display:"flex",alignItems:"center","&:hover":{backgroundColor:"var(--mantine-color-gray-1)"},"&:focus":{backgroundColor:"var(--mantine-color-gray-1)"},"&::placeholder":{color:"var(--mantine-color-gray-5)"}}},rightSection:I&&e.jsx(t.Box,{onClick:O,style:{display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",padding:"4px",borderRadius:"var(--mantine-radius-xl)",transition:"background-color 0.2s ease"},onMouseEnter:j=>{j.currentTarget.style.backgroundColor="var(--mantine-color-gray-2)"},onMouseLeave:j=>{j.currentTarget.style.backgroundColor="transparent"},children:e.jsx(T.IconX,{size:14,color:"var(--mantine-color-gray-6)",strokeWidth:2.3})}),rightSectionWidth:I?24:0})]}),e.jsx("style",{children:`
2
2
  @keyframes expandRight {
3
3
  from { width: 0; opacity: 0; }
4
4
  to { width: 200px; opacity: 1; }
@@ -15,4 +15,4 @@
15
15
  from { width: 200px; opacity: 1; }
16
16
  to { width: 0; opacity: 0; }
17
17
  }
18
- `})]})},Re=({activeFilters:n,onFiltersChange:s,availableFilters:o,size:r="md",filterButtonDropdownPosition:a="bottom-end"})=>{const i=t.useCombobox({onDropdownClose:()=>i.resetSelectedOption(),onDropdownOpen:()=>i.updateSelectedOptionIndex("active")}),[c,l]=u.useState(!1),d=n.length>0,f=y=>{if(y==="remove-filters")s([]);else{const g=o==null?void 0:o.find(b=>b.value===y);if(g){const b={id:`${g.value}-${Date.now()}`,filterOption:g};s([...n,b])}}i.closeDropdown()},h=(o||[]).filter(y=>!n.some(g=>g.filterOption.value===y.value)),m={borderRadius:"var(--mantine-radius-md)",fontSize:"var(--mantine-font-size-sm)",color:"var(--mantine-color-gray-7)",fontWeight:"500"},I=(()=>{switch(r){case"sm":return{height:"32px",width:"32px",iconSize:20};case"md":return{height:"32px",width:"32px",iconSize:20};default:return{height:"32px",width:"32px",iconSize:20}}})(),p=e.jsx(t.Box,{style:{display:"inline-flex",alignItems:"center",justifyContent:"center",backgroundColor:d||c?"var(--mantine-color-gray-0)":"transparent",color:"var(--mantine-color-gray-6)",borderRadius:"var(--mantine-radius-md)",cursor:"pointer",transition:"all 0.2s ease",...I},onMouseEnter:()=>l(!0),onMouseLeave:()=>l(!1),onClick:()=>i.toggleDropdown(),children:e.jsx(T.IconFilter,{size:20,stroke:2.3})});return e.jsxs(t.Combobox,{store:i,onOptionSubmit:f,withinPortal:!1,offset:4,position:a,children:[e.jsx(t.Combobox.Target,{children:d?e.jsx(t.Indicator,{offset:2,position:"top-end",color:"var(--mantine-color-yellow-7)",children:p}):p}),e.jsx(t.Combobox.Dropdown,{styles:{dropdown:{borderRadius:"var(--mantine-radius-md)",border:"1px solid var(--mantine-color-gray-2)",boxShadow:"var(--mantine-shadow-md)",padding:"4px",width:"auto",minWidth:"160px"}},children:e.jsxs(t.Combobox.Options,{children:[h.map(y=>e.jsx(t.Combobox.Option,{value:y.value,style:{...m},children:e.jsxs(t.Box,{style:{display:"flex",alignItems:"center",gap:"8px"},children:[y.icon,y.label]})},y.value)),d&&e.jsx(t.Combobox.Option,{value:"remove-filters",style:{borderRadius:"var(--mantine-radius-md)",fontSize:"var(--mantine-font-size-sm)",fontWeight:"500",color:"var(--mantine-color-red-6)"},children:e.jsxs(t.Box,{style:{display:"flex",alignItems:"center",gap:"8px"},children:[e.jsx(T.IconFilterOff,{size:16,stroke:2}),"Remove filters"]})})]})})]})},Bn=({filterTag:n,onUpdate:s,onRemove:o,options:r=[],filterTagDropdownPosition:a="bottom-start"})=>{var x;const i=t.useCombobox({onDropdownClose:()=>i.resetSelectedOption(),onDropdownOpen:()=>i.updateSelectedOptionIndex("active")}),c=!!n.selectedOption,l=c?`${n.filterOption.label}: ${(x=n.selectedOption)==null?void 0:x.label}`:n.filterOption.label,d=r&&r.length>0?r:[{value:"option-a",label:"TagFilterOptionA"},{value:"option-b",label:"TagFilterOptionB"},{value:"option-c",label:"TagFilterOptionC"}],f=I=>{if(I==="remove")o();else{const p=d.find(y=>y.value===I);p&&s({...n,selectedOption:p})}i.closeDropdown()},h={borderRadius:"var(--mantine-radius-md)",fontSize:"var(--mantine-font-size-sm)",color:"var(--mantine-color-gray-7)",fontWeight:"500"},m={display:"inline-flex",alignItems:"center",gap:"4px",backgroundColor:c?"var(--mantine-color-blue-0)":"var(--mantine-color-gray-0)",color:c?"var(--mantine-color-blue-7)":"var(--mantine-color-gray-6)",borderRadius:"var(--mantine-radius-xl)",cursor:"pointer",transition:"all 0.2s ease",height:"32px",fontSize:"var(--mantine-font-size-sm)",padding:"0 12px"};return e.jsxs(t.Combobox,{store:i,onOptionSubmit:f,withinPortal:!1,offset:4,position:a,middlewares:{flip:!1,shift:!0},children:[e.jsx(t.Combobox.Target,{children:e.jsxs(t.Box,{style:{...m},onClick:()=>i.toggleDropdown(),fw:500,pl:"sm",children:[e.jsxs(t.Box,{style:{display:"flex",alignItems:"center",gap:"4px"},children:[n.filterOption.icon,l]}),e.jsx(T.IconChevronDown,{size:16,strokeWidth:2,color:"var(--mantine-color-gray-5)"})]})}),e.jsx(t.Combobox.Dropdown,{styles:{dropdown:{borderRadius:"var(--mantine-radius-md)",border:"1px solid var(--mantine-color-gray-2)",boxShadow:"var(--mantine-shadow-md)",padding:"4px",minWidth:"150px"}},children:e.jsxs(t.Combobox.Options,{children:[d.map(I=>{var p;return e.jsx(t.Combobox.Option,{value:I.value,active:((p=n.selectedOption)==null?void 0:p.value)===I.value,style:{...h},children:I.label},I.value)}),e.jsx(t.Combobox.Option,{value:"remove",style:{borderRadius:"var(--mantine-radius-md)",fontSize:"var(--mantine-font-size-sm)",fontWeight:"500",color:"var(--mantine-color-red-6)"},children:"Or remove filter"})]})})]})},Tn=({activeFilters:n,onFiltersChange:s,availableFilters:o,addFilterButtonDropdownPosition:r="bottom-start"})=>{const a=t.useCombobox({onDropdownClose:()=>a.resetSelectedOption(),onDropdownOpen:()=>a.updateSelectedOptionIndex("active")}),[i,c]=u.useState(!1),l=x=>{const I=o==null?void 0:o.find(p=>p.value===x);if(I){const p={id:`${I.value}-${Date.now()}`,filterOption:I};s([...n,p])}a.closeDropdown()},d=(o||[]).filter(x=>!n.some(I=>I.filterOption.value===x.value)),f={display:"inline-flex",alignItems:"center",backgroundColor:i?"var(--mantine-color-gray-0)":"transparent",borderRadius:"var(--mantine-radius-xl)",cursor:"pointer",transition:"all 0.2s ease",border:"1px solid transparent",height:"32px",fontSize:"var(--mantine-font-size-sm)",padding:"0 12px"},h={dropdown:{borderRadius:"var(--mantine-radius-md)",border:"1px solid var(--mantine-color-gray-2)",boxShadow:"var(--mantine-shadow-md)",padding:"4px",width:"auto",minWidth:"120px"}},m={borderRadius:"var(--mantine-radius-md)",fontSize:"var(--mantine-font-size-sm)",color:"var(--mantine-color-gray-7)",fontWeight:"500"};return e.jsxs(t.Combobox,{store:a,onOptionSubmit:l,withinPortal:!1,offset:4,position:r,children:[e.jsx(t.Combobox.Target,{children:e.jsx(t.Box,{style:{...f},onMouseEnter:()=>c(!0),onMouseLeave:()=>c(!1),onClick:()=>a.toggleDropdown(),children:e.jsx(t.Box,{style:{fontWeight:"500",color:"var(--mantine-color-blue-6)"},children:"Add filter"})})}),e.jsx(t.Combobox.Dropdown,{styles:{...h},children:e.jsx(t.Combobox.Options,{children:d.map(x=>e.jsx(t.Combobox.Option,{value:x.value,style:{...m},children:e.jsxs(t.Box,{style:{display:"flex",alignItems:"center",gap:"8px"},children:[x.icon,x.label]})},x.value))})})]})},De=({activeFilters:n,onFiltersChange:s,availableFilters:o,size:r="sm",getFilterOptions:a,filterTagDropdownPosition:i="bottom-start"})=>{const c=f=>{const h=(n||[]).map(m=>m.id===f.id?f:m);s(h)},l=f=>{const h=(n||[]).filter(m=>m.id!==f);s(h)},d=(o||[]).filter(f=>!n.some(h=>h.filterOption.value===f.value));return!n||n.length===0?null:e.jsx("div",{style:{width:"100%"},children:e.jsxs(t.Group,{gap:"sm",align:"center",wrap:"wrap",children:[(n||[]).map(f=>{const h=a?a(f.filterOption.value)||[]:[];return e.jsx(Bn,{filterTag:f,onUpdate:c,onRemove:()=>l(f.id),size:r,options:h,filterTagDropdownPosition:i},f.id)}),d.length>0&&e.jsx(Tn,{activeFilters:n,onFiltersChange:s,availableFilters:d,size:r})]})})},On=({activeFilters:n,onFiltersChange:s,availableFilters:o,size:r="md",getFilterOptions:a,filterTagDropdownPosition:i="bottom-start"})=>e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"12px"},children:[e.jsx(Re,{activeFilters:n,onFiltersChange:s,availableFilters:o,size:r}),e.jsx(De,{activeFilters:n,onFiltersChange:s,availableFilters:o,size:"sm",getFilterOptions:a,filterTagDropdownPosition:i})]}),zn=Object.assign(On,{Button:Re,Filters:De}),Rn=({children:n,danger:s,active:o,...r})=>{const[a,i]=u.useState(!1);return e.jsx(t.MenuItem,{...r,onMouseEnter:()=>i(!0),onMouseLeave:()=>i(!1),style:{borderRadius:"8px",color:o?"var(--mantine-color-blue-7)":s?"var(--mantine-color-red-9)":"var(--mantine-color-gray-9)",backgroundColor:a||o?"var(--mantine-color-gray-1)":"transparent",...r.style},children:n})},ve=({trigger:n,menuItems:s,children:o,...r})=>{const a=u.useRef(null),[i,c]=u.useState(0);return u.useEffect(()=>{a.current&&c(a.current.offsetWidth)},[n]),e.jsxs(t.Menu,{...r,children:[e.jsx(t.Menu.Target,{children:e.jsx("div",{ref:a,onClick:l=>l.stopPropagation(),style:{cursor:"pointer",outline:"none",boxShadow:"none",display:"flex",alignItems:"center"},children:n})}),e.jsxs(t.Menu.Dropdown,{styles:{dropdown:{cursor:"pointer",borderRadius:"8px",minWidth:`${i}px`}},children:[o,s==null?void 0:s.map((l,d)=>e.jsx(Rn,{...l},d))]})]})},Dn="floatingIndicator-module__wrapper___oBPtC",En="floatingIndicator-module__control___5GZIX",An="floatingIndicator-module__label___Qmy1z",Ln="floatingIndicator-module__icon___sjrda",Fn="floatingIndicator-module__indicator___p7zco",Nn="floatingIndicator-module__content___UXG3x",ge={wrapper:Dn,control:En,label:An,icon:Ln,indicator:Fn,content:Nn},yt=u.createContext(null),qe=()=>{const n=u.useContext(yt);if(!n)throw new Error("FloatingIndicator components must be used within FloatingIndicator.Provider");return n},Ze=({items:n,activeId:s,defaultActiveId:o,onChange:r,indicatorProps:a,showIcons:i=!0,children:c})=>{var w;const[l,d]=u.useState(null),[f,h]=u.useState({}),[m,x]=u.useState(o??((w=n[0])==null?void 0:w.id)),I=s!==void 0,p=u.useRef(new Map),y=u.useCallback((v,O)=>{h(M=>{if(O)return M[v]===O?M:{...M,[v]:O};if(!(v in M))return M;const z={...M};return delete z[v],z})},[]),g=u.useCallback(v=>(p.current.has(v)||p.current.set(v,O=>{y(v,O)}),p.current.get(v)),[y]);u.useEffect(()=>{const v=new Set(n.map(O=>O.id));p.current.forEach((O,M)=>{v.has(M)||p.current.delete(M)}),h(O=>{if(!Object.keys(O).some(E=>!v.has(E)))return O;const z={};return Object.entries(O).forEach(([E,W])=>{v.has(E)&&(z[E]=W)}),z})},[n]),u.useEffect(()=>{var O;if(I)return;const v=o&&n.some(M=>M.id===o)&&o||((O=n[0])==null?void 0:O.id);x(M=>M&&n.some(z=>z.id===M)?M:v)},[n,o,I]);const b=(I?s:m)??null,j=u.useMemo(()=>n.find(v=>v.id===b),[n,b]),C=u.useCallback((v,O)=>()=>{O||(I||x(v),r==null||r(v))},[I,r]),S=u.useMemo(()=>{const v=[ge.indicator];return a!=null&&a.className&&v.push(a.className),v.filter(Boolean).join(" ")||void 0},[a==null?void 0:a.className]),B=u.useMemo(()=>{if(!a)return{};const{className:v,...O}=a;return O},[a]),k=u.useMemo(()=>({items:n,currentActiveId:b,showIcons:i,handleItemClick:C,getControlRefCallback:g,setParentRef:d,parentRef:l,indicatorClassName:S,indicatorProps:B,activeItem:j,controlsRefs:f}),[n,b,i,C,g,l,S,B,j,f]);return e.jsx(yt.Provider,{value:k,children:c})},Xe=({className:n,style:s})=>{const{items:o,currentActiveId:r,showIcons:a,handleItemClick:i,getControlRefCallback:c,setParentRef:l,parentRef:d,indicatorClassName:f,indicatorProps:h,controlsRefs:m}=qe(),x=[ge.wrapper,n].filter(Boolean).join(" ")||void 0;return e.jsxs(t.Box,{className:x,style:s,ref:l,children:[o.map(I=>{const p=I.icon,y=I.id===r,g=!!(p&&a);return e.jsxs(t.UnstyledButton,{ref:c(I.id),onClick:i(I.id,I.disabled),"data-active":y,className:ge.control,disabled:I.disabled,children:[g&&p&&e.jsx("span",{className:ge.icon,children:e.jsx(p,{size:16})}),e.jsx("span",{className:ge.label,children:I.label})]},I.id)}),e.jsx(t.FloatingIndicator,{target:r?m[r]??null:null,parent:d,className:f,...h})]})},Ke=({className:n,style:s,renderContent:o})=>{const{activeItem:r}=qe(),a=o?o(r):r==null?void 0:r.content;if(!a)return null;const i=[ge.content,n].filter(Boolean).join(" ")||void 0;return e.jsx(t.Box,{className:i,style:s,children:a})},Un=({className:n,style:s,...o})=>e.jsx(Ze,{...o,children:e.jsxs(t.Stack,{gap:"sm",className:n,style:s,children:[e.jsx(Xe,{}),e.jsx(Ke,{})]})}),Wn=qe,Hn=Object.assign(Un,{Provider:Ze,Triggers:Xe,Content:Ke}),Je=({label:n,icon:s,onClick:o,color:r="gray",disabled:a=!1,"aria-label":i,indicator:c,fullWidth:l,isActive:d=!1,...f})=>{const[h,m]=u.useState(!1),x=()=>{a||o==null||o()};return e.jsx(t.Box,{style:{cursor:a?"not-allowed":"pointer",borderRadius:"var(--mantine-radius-md)"},variant:"transparent",justify:"flex-start",display:"flex",color:r,radius:"md",w:l?"100%":"auto",px:6,h:40,onMouseEnter:()=>!a&&m(!0),onMouseLeave:()=>m(!1),onClick:x,bg:h||d?"gray.1":"transparent","aria-label":i||`${n} navigation button`,...f,children:e.jsxs(t.Group,{w:"100%",wrap:"nowrap",gap:8,justify:"left",align:"center",children:[e.jsx(t.Box,{style:{display:"flex",alignItems:"center",justifyContent:"center",width:"28px",height:"28px"},children:s}),e.jsx(t.Text,{ta:"left",size:"sm",fw:600,c:"var(--mantine-color-gray-8)",truncate:!0,style:{flex:1,opacity:a?.5:1},children:n}),c&&e.jsx(t.Box,{style:{cursor:"pointer",backgroundColor:"var(--mantine-color-red-7)",color:"var(--mantine-color-white)",borderRadius:"var(--mantine-radius-lg)",padding:"0px 4px",fontSize:"12px",fontWeight:600,height:"20px",minWidth:"20px",display:"flex",alignItems:"center",justifyContent:"center"},children:c})]})})},$n="navlink-module__navlink___nc4pR",Pn={navlink:$n},Qe=({label:n,rightLabel:s,children:o,onAddChild:r,onMenuAction:a,menuItems:i,color:c="var(--mantine-color-gray-7)",defaultText:l="No items",level:d=0,disabled:f=!1,noChild:h=!1,isActive:m=!1,showAvatar:x=!0,avatar:I,placeholder:p,onClick:y,"aria-label":g,...b})=>{const[j,C]=u.useState(!1),[S,B]=u.useState(!1),[k,w]=u.useState(!1),v=S||k,O=u.Children.count(o)>0,M=!h&&O&&(x?v:!0),z=u.useCallback(()=>{f||y==null||y()},[y,f]),E=u.useCallback(F=>{F.stopPropagation(),!f&&(h||C(!0),r==null||r())},[r,f,h]),W=u.useCallback(F=>{F==null||F.stopPropagation(),!f&&O&&!h&&C(G=>!G)},[f,O,h]),P=u.useCallback(()=>{f||(h||C(!0),r==null||r())},[r,f,h]),H=u.useCallback(F=>{f||a==null||a(F)},[a,f,n]),L=u.useCallback(()=>O?u.Children.map(o,F=>u.isValidElement(F)?u.cloneElement(F,{...F.props,level:d+1}):F):null,[o,O,d]),_=(i==null?void 0:i.map(F=>({children:e.jsxs(t.Group,{gap:"xs",wrap:"nowrap",children:[F.icon&&e.jsx(F.icon,{size:16}),e.jsx(t.Text,{size:"sm",children:F.label})]}),onClick:()=>H(F.action)})))||[],N=[{children:e.jsxs(t.Group,{gap:"xs",wrap:"nowrap",children:[e.jsx(T.IconPlus,{size:16}),e.jsx(t.Text,{size:"sm",children:"Add child"})]}),onClick:E}],Z=_.length>0?_:N;return e.jsxs(t.Stack,{gap:0,children:[e.jsx(t.Box,{className:Pn.navlink,"data-disabled":f,"data-active":m,variant:"transparent",justify:"space-between",display:"flex",color:c,size:"md",radius:"md",w:"100%",px:6,h:40,onMouseEnter:()=>!f&&B(!0),onMouseLeave:()=>{k||B(!1)},onClick:z,bg:m||v?"var(--mantine-color-gray-1)":"transparent","aria-expanded":j,"aria-label":g||`${n} navigation link`,...b,children:e.jsxs(t.Group,{w:"100%",wrap:"nowrap",gap:8,onClick:z,style:{paddingLeft:h&&!M?`${(d+1)*32}px`:d>0?`${d*32}px`:"0px"},children:[M?e.jsx(fe,{icon:j?T.IconChevronDown:T.IconChevronRight,iconOnHover:j?T.IconChevronDown:T.IconChevronRight,grayScaleBaseColor:v?1:0,color:"var(--mantine-color-gray-7)",onClick:W,disabled:f}):x?e.jsx(se,{size:"xs",avatar:I,showPlaceholder:!0,placeholder:p}):null,e.jsx(t.Text,{size:"sm",fw:600,c,truncate:!0,w:"100%",style:{opacity:f?.5:1},children:n}),e.jsxs(t.Group,{gap:"xs",align:"center",children:[s&&e.jsx(t.Text,{size:"xs",c:"dimmed",children:s}),v&&!f&&e.jsxs(t.Group,{gap:4,wrap:"nowrap",children:[r&&e.jsx(fe,{icon:T.IconPlus,grayScaleBaseColor:v?1:0,onClick:P,color:"var(--mantine-color-gray-7)"}),(i&&i.length>0||r)&&e.jsx("div",{onClick:F=>F.stopPropagation(),children:e.jsx(ve,{menuItems:Z,trigger:e.jsx(fe,{icon:T.IconDots,grayScaleBaseColor:1,color:"var(--mantine-color-gray-7)"}),position:"bottom-end",shadow:"md",onOpen:()=>{w(!0),B(!0)},onClose:()=>{w(!1)}})})]})]})]})}),j&&!h&&e.jsx(t.Stack,{gap:0,style:{width:"100%"},children:O?L():e.jsx(t.Box,{style:{marginLeft:d>0?`${d*16}px`:"0px"},children:e.jsx(t.Text,{size:"sm",c:"dimmed",ta:"left",p:"sm",fw:500,children:l})})})]})},Gn="userChip-module__pill___DgFME",_n={pill:Gn},Be=({avatar:n,name:s,withRemoveButton:o=!1,onRemove:r})=>e.jsx(t.Pill,{withRemoveButton:o,onRemove:r,radius:"md",p:"0px",size:"md",className:_n.pill,bg:"transparent",children:e.jsxs(t.Group,{gap:4,wrap:"nowrap",style:{alignItems:"center"},children:[e.jsx(se,{avatar:n,size:24,placeholder:s,showPlaceholder:!0}),e.jsx(t.Text,{size:"sm",fw:500,c:"var(--mantine-color-gray-9)",children:s})]})}),Vn="200px",Qn="4px 8px",Yn=40,qn="var(--mantine-radius-md)",Zn=16,vt=({item:n,withAvatars:s,disabled:o=!1,onClick:r,selected:a=!1})=>{const[i,c]=u.useState(!1);return e.jsx(t.Box,{onMouseEnter:()=>!o&&c(!0),onMouseLeave:()=>!o&&c(!1),onClick:l=>{l.preventDefault(),l.stopPropagation(),o||r==null||r(n.value)},onMouseDown:l=>{l.stopPropagation()},style:{minWidth:Vn,backgroundColor:o?"transparent":i?"var(--mantine-color-gray-0)":"transparent",cursor:o?"default":"pointer",borderRadius:qn,padding:Qn,transition:"background-color 0.2s ease",opacity:o?.5:1},children:e.jsxs(t.Group,{gap:"sm",wrap:"nowrap",align:"flex-start",style:{alignItems:"center"},h:Yn,children:[s&&n.avatar&&e.jsx("img",{src:n.avatar,alt:n.label,style:{width:"24px",height:"24px",borderRadius:"var(--mantine-radius-sm)",objectFit:"cover"}}),e.jsxs(t.Stack,{gap:0,style:{flex:1},children:[e.jsx(t.Text,{size:"sm",fw:500,lh:-1,c:o?"var(--mantine-color-gray-5)":"var(--mantine-color-gray-9)",children:n.label}),e.jsx(t.Text,{size:"xs",c:o?"var(--mantine-color-gray-4)":"dimmed",children:n.description})]}),a&&e.jsx(T.IconCheck,{size:Zn,color:"var(--mantine-color-gray-9)"})]})})},Xn="bottom-end",Kn=1e4,Jn="24px",eo="0 8px",to="6px",rt="var(--mantine-radius-md)",no="46px",Ee=({value:n,onChange:s,data:o,withRemove:r=!1,withAvatars:a=!1,onRemove:i,disabledOptions:c=[],disabled:l=!1,defaultOption:d,popoverStyles:f,dropdownStyles:h,triggerStyles:m,textStyles:x,counter:I})=>{const[p,y]=u.useState(!1),g=(o||[]).find(M=>M.value===n)||d,[b,j]=u.useState(!1),[C,S]=u.useState(!1),[B,k]=u.useState(!1),w=r?e.jsx(t.Group,{p:"sm",onClick:M=>{M.stopPropagation(),i==null||i(n)},style:{cursor:"pointer",height:no,display:"flex",alignItems:"center",borderRadius:rt,backgroundColor:C?"var(--mantine-color-red-0)":"transparent",transition:"background-color 0.2s ease"},onMouseEnter:()=>S(!0),onMouseLeave:()=>S(!1),children:e.jsx(t.Text,{size:"sm",c:"var(--mantine-color-red-6)",fw:500,children:"Remove user"})}):null,v=M=>M>0?e.jsx(t.Text,{size:"sm",c:"var(--mantine-color-gray-7)",fw:600,children:M}):null,O=e.jsxs(t.Box,{onMouseEnter:()=>!l&&j(!0),onMouseLeave:()=>!l&&j(!1),onClick:()=>{l||(y(!0),k(!0))},style:{height:Jn,cursor:l?"not-allowed":"pointer",display:"inline-flex",alignItems:"center",borderRadius:rt,backgroundColor:l?"transparent":b||B?"var(--mantine-color-gray-1)":"transparent",transition:"background-color 0.2s ease",padding:eo,gap:to,width:"auto",opacity:l?.6:1,...m},children:[e.jsx(t.Text,{size:"sm",fw:x!=null&&x.fontWeight?void 0:500,c:l?"var(--mantine-color-gray-4)":"var(--mantine-color-gray-6)",style:{color:l?"var(--mantine-color-gray-4)":"var(--mantine-color-gray-6)",lineHeight:"24px",whiteSpace:"nowrap",...x},children:(g==null?void 0:g.label)||"Select option"}),v(I??0),e.jsx(T.IconChevronDown,{size:16,style:{color:l?"var(--mantine-color-gray-3)":"var(--mantine-color-gray-6)"}})]});return e.jsxs(t.Popover,{opened:p,onChange:M=>{y(M),M||k(!1)},position:Xn,shadow:"md",withinPortal:!0,zIndex:Kn,styles:f,children:[e.jsx(t.Popover.Target,{children:O}),e.jsx(t.Popover.Dropdown,{onClick:M=>M.stopPropagation(),onMouseDown:M=>M.stopPropagation(),styles:{dropdown:{borderRadius:"var(--mantine-radius-md)",padding:"4px",...h}},children:e.jsxs(t.Stack,{gap:0,onClick:M=>M.stopPropagation(),onMouseDown:M=>M.stopPropagation(),children:[(o||[]).map(M=>{const z=c.includes(M.value),E=M.value===n;return e.jsx(vt,{item:M,withAvatars:a,disabled:z,selected:E,onClick:W=>{s==null||s(W),y(!1),k(!1)}},M.value)}),w]})})]})},oo=(n,s,o,r)=>{const a=u.useRef(null),i=u.useRef(null),c=u.useCallback(d=>{d[0].isIntersecting&&o&&!r&&s&&s()},[o,r,s]),l=u.useCallback(()=>{if(!(!a.current||!n||!s)){i.current&&(i.current.disconnect(),i.current=null);try{const d=new IntersectionObserver(c,{threshold:.1,rootMargin:"50px"});d.observe(a.current),i.current=d}catch(d){console.error("Failed to setup intersection observer:",d)}}},[n,s,c]);return u.useEffect(()=>(l(),()=>{i.current&&(i.current.disconnect(),i.current=null)}),[l]),u.useEffect(()=>()=>{i.current&&(i.current.disconnect(),i.current=null)},[]),{loadMoreRef:a}},jt=({tableName:n,data:s,columns:o,onAddItem:r,addItemComponent:a,addItemLabel:i="Add item",loading:c=!1,emptyMessage:l="No data found",searchPlaceholder:d="Search...",enableAutoFilters:f=!0,customFilters:h=[],onCustomFilter:m,onSort:x,sortColumn:I,sortDirection:p,onSearch:y,onRowClick:g,size:b="md",striped:j=!1,highlightOnHover:C=!0,enableInfiniteScroll:S=!1,isLoadingMore:B=!1,hasMore:k=!1,onLoadMore:w})=>{const[v,O]=u.useState(""),[M,z]=u.useState([]),{loadMoreRef:E}=oo(S,w||(()=>{}),k,B),W=u.useMemo(()=>[...f?o.filter(D=>D.type==="select"&&D.options).map(D=>({value:D.key,label:D.label})):[],...h],[o,f,h]),P=u.useMemo(()=>{let R=s||[];if(v){const D=v.toLowerCase();R=R.filter(A=>o.some(U=>{if(!U.searchable)return!1;const V=A[U.key];return V==null?!1:String(V).toLowerCase().includes(D)}))}return M.forEach(D=>{if(D.filterTag.selectedOption){const A=o.find(U=>U.key===D.filterTag.filterOption.value);A&&(R=R.filter(U=>{var te;const V=U[A.key];return String(V)===((te=D.filterTag.selectedOption)==null?void 0:te.value)}))}}),R},[s,v,M,o]),H=R=>{O(R),y==null||y(R)},L=R=>{const D=o.find(U=>U.key===R);if(!(D!=null&&D.sortable))return;const A=I===R&&p==="asc"?"desc":"asc";x==null||x(R,A)},_=R=>{const D=o.find(A=>A.key===R);return(D==null?void 0:D.type)==="select"&&D.options?D.options.map(A=>({value:A.value,label:A.label})):(D==null?void 0:D.type)==="badge"?[...new Set(s.map(U=>U[D.key]).filter(Boolean))].map(U=>({value:String(U),label:String(U).charAt(0).toUpperCase()+String(U).slice(1)})):D?[...new Set(s.map(U=>U[D.key]).filter(Boolean))].map(U=>({value:String(U),label:String(U).charAt(0).toUpperCase()+String(U).slice(1)})):[]},N=(R,D)=>{var U,V,te,$,oe;const A=D[R.key];switch(R.type){case"text":return e.jsx(t.Text,{size:"sm",c:A?void 0:"dimmed",children:A||"—"});case"date":if(!A)return e.jsx(t.Text,{size:"sm",c:"dimmed",children:"—"});const X=new Date(A),de=R.format?X.toLocaleDateString("en-US",{year:"numeric",month:"2-digit",day:"2-digit"}):X.toLocaleDateString();return e.jsx(t.Text,{size:"sm",c:"dimmed",children:de});case"select":return R.options?e.jsx(Ee,{value:A,data:R.options,placeholder:R.label,onChange:re=>{var me;return(me=R.onSelectChange)==null?void 0:me.call(R,re,D)},disabled:(U=R.disabled)==null?void 0:U.call(R,D)}):e.jsx(t.Text,{size:"sm",c:"dimmed",children:"—"});case"badge":const Le=((V=R.badgeColors)==null?void 0:V[A])||"gray";return e.jsx(t.Badge,{color:Le,variant:"light",size:"sm",radius:"md",fw:600,children:A||"Unknown"});case"avatar":const Fe=((te=R.fallbackText)==null?void 0:te.call(R,D))||String(A).charAt(0).toUpperCase();return e.jsx(se,{avatar:A,size:"xs",placeholder:Fe,showPlaceholder:!0});case"custom":return(($=R.render)==null?void 0:$.call(R,A,D))||e.jsx(t.Text,{size:"sm",c:"dimmed",children:"—"});case"actions":return(oe=R.actions)!=null&&oe.length?e.jsxs(t.Menu,{shadow:"md",width:200,position:"bottom-end",styles:{dropdown:{borderRadius:"var(--mantine-radius-md)"}},children:[e.jsx(t.Menu.Target,{children:e.jsx(t.ActionIcon,{variant:"subtle",size:"md",color:"gray",radius:"md",children:e.jsx(T.IconDots,{size:16})})}),e.jsx(t.Menu.Dropdown,{children:R.actions.map((re,me)=>{var we;return e.jsx(t.Menu.Item,{color:re.color,leftSection:re.icon,disabled:(we=re.disabled)==null?void 0:we.call(re,D),onClick:()=>re.onClick(D),styles:{item:{borderRadius:"var(--mantine-radius-md)"}},children:re.label},me)})})]}):null;default:return e.jsx(t.Text,{size:"sm",c:"dimmed",children:"—"})}},Z=R=>{var D;return(D=o.find(A=>A.key===R))!=null&&D.sortable?I===R?p==="asc"?e.jsx(T.IconChevronUp,{size:14}):e.jsx(T.IconChevronDown,{size:14}):e.jsx(T.IconChevronUp,{size:14,style:{opacity:.3}}):null},G=(()=>{switch(b){case"sm":return{buttonSize:"xs",textSize:"sm"};case"lg":return{buttonSize:"md",textSize:"md"};default:return{buttonSize:"sm",textSize:"sm"}}})();return e.jsxs(t.Box,{pos:"relative",children:[e.jsx(t.LoadingOverlay,{visible:c}),e.jsxs(t.Stack,{gap:"sm",w:"100%",children:[e.jsxs(t.Group,{gap:"sm",wrap:"nowrap",justify:"space-between",children:[e.jsx(t.Text,{fw:600,c:"var(--mantine-color-gray-8)",children:n}),e.jsxs(t.Group,{gap:"xs",wrap:"nowrap",children:[e.jsxs(t.Group,{gap:4,wrap:"nowrap",children:[e.jsx(It,{placeholder:d,value:v,onChange:H,onSearch:H,expandDirection:"right",size:G.buttonSize}),W.length>0&&e.jsx(Re,{activeFilters:M.map(R=>R.filterTag),onFiltersChange:R=>{z(R.map(D=>({filterTag:D,onUpdate:()=>{},onRemove:()=>{}}))),m==null||m(R)},availableFilters:W,size:G.buttonSize})]}),r&&e.jsx(t.Button,{size:"compact-md",h:32,style:{fontSize:`var(--mantine-font-size-${G.textSize})`,border:"none"},radius:"md",onClick:r,children:i})]})]}),W.length>0&&e.jsx(De,{activeFilters:M.map(R=>R.filterTag),onFiltersChange:R=>{z(R.map(D=>({filterTag:D,onUpdate:()=>{},onRemove:()=>{}}))),m==null||m(R)},availableFilters:W,size:"md",getFilterOptions:_})]}),a,e.jsxs(t.Table,{striped:j,highlightOnHover:C,highlightOnHoverColor:"var(--mantine-color-gray-0)",mt:"xs",children:[e.jsx(t.Table.Thead,{children:e.jsx(t.Table.Tr,{children:o.map(R=>e.jsx(t.Table.Th,{c:"var(--mantine-color-gray-6)",style:{width:R.width,textAlign:R.align||"left",cursor:R.sortable?"pointer":"default"},onClick:()=>R.sortable&&L(R.key),children:e.jsxs(t.Group,{gap:"xs",wrap:"nowrap",children:[R.icon&&e.jsx(t.Box,{style:{display:"flex",alignItems:"center"},children:R.icon}),e.jsx(t.Text,{size:G.textSize,fw:500,children:R.label}),Z(R.key)]})},String(R.key)))})}),e.jsx(t.Table.Tbody,{children:P.length===0?e.jsx(t.Table.Tr,{children:e.jsx(t.Table.Td,{colSpan:o.length,ta:"center",py:"xl",children:e.jsx(t.Text,{c:"dimmed",children:l})})}):P.map((R,D)=>e.jsx(t.Table.Tr,{style:{cursor:g?"pointer":"default"},onClick:()=>g==null?void 0:g(R),children:o.map(A=>e.jsx(t.Table.Td,{style:{textAlign:A.align||"left"},children:N(A,R)},String(A.key)))},R.id||D))})]}),S&&e.jsx(t.Box,{ref:E,style:{padding:"16px",display:"flex",justifyContent:"center",alignItems:"center",minHeight:"60px"},children:B&&e.jsxs(t.Group,{display:"flex",ta:"center",gap:"xs",children:[e.jsx(t.Loader,{size:"sm",color:"gray.5"}),e.jsx(t.Text,{size:"sm",c:"dimmed",fw:500,children:"Loading more..."})]})})]})};Object.assign(jt,{});const ro=({onAvatarSelect:n,onEmojiSelect:s,onImageSelect:o,onIconSelect:r}={})=>{const[a,i]=u.useState("emoji"),[c,l]=u.useState(null),[d,f]=u.useState(null),[h,m]=u.useState(null),[x,I]=u.useState(null),[p,y]=u.useState(null),g=u.useCallback(v=>{i(v)},[]),b=u.useCallback(v=>{l(v)},[]),j=u.useCallback(v=>{y(v);const O=new FileReader;O.onload=M=>{var E;const z=(E=M.target)==null?void 0:E.result;f(z)},O.readAsDataURL(v)},[]),C=u.useCallback(v=>{m(v),f(null),y(null),I(null),n==null||n({type:"emoji",value:v}),s==null||s(v)},[n,s]),S=u.useCallback(v=>{I(v),f(null),y(null),m(null),n==null||n({type:"icon",value:v}),r==null||r(v)},[n,r]),B=u.useCallback(()=>{if(p&&d){const v=URL.createObjectURL(p);n==null||n({type:"image",value:v}),o==null||o(p)}},[p,d,n,o]),k=u.useCallback(()=>{f(null),y(null),m(null),I(null)},[]),w=u.useCallback(()=>{f(null),m(null),I(null),y(null),i("emoji"),l(null)},[]);return{selectedTab:a,tabHovered:c,previewImage:d,selectedEmoji:h,selectedIcon:x,selectedFile:p,handleTabChange:g,handleTabHover:b,handleImagePreview:j,handleImageAccept:B,handleEmojiSelect:C,handleIconSelect:S,clearImagePreview:k,resetState:w}},so=({opened:n,onClose:s,popoverRef:o})=>{const r=u.useCallback(i=>{n&&o.current&&!o.current.contains(i.target)&&(console.log("Click outside detected, closing popover"),s())},[n,s,o]),a=u.useCallback(i=>{i.key==="Escape"&&n&&(console.log("Escape key pressed, closing popover"),s())},[n,s]);return u.useEffect(()=>{if(n)return document.addEventListener("mousedown",r),document.addEventListener("keydown",a),()=>{document.removeEventListener("mousedown",r),document.removeEventListener("keydown",a)}},[n,r,a]),{handleClickOutside:r,handleEscape:a}},ao=({selectedTab:n,tabHovered:s,onTabChange:o,onTabHover:r,onRemove:a,hasAvatar:i=!1,children:c})=>{const[l,d]=u.useState(!1);return e.jsxs(t.Tabs,{color:"black",value:n,styles:{tab:{backgroundColor:"transparent"}},children:[e.jsxs(t.Tabs.List,{px:"var(--mantine-spacing-sm)",pt:"xs",w:"100%",children:[e.jsx(t.Tabs.Tab,{value:"emoji",p:0,pb:"xs",onClick:()=>o("emoji"),onMouseEnter:()=>r("emoji"),onMouseLeave:()=>r(null),style:{backgroundColor:"transparent"},children:e.jsx(t.Box,{style:{borderRadius:"var(--mantine-radius-md)",height:"24px",display:"flex",alignItems:"center",justifyContent:"center",padding:"0 8px",border:"none",backgroundColor:s==="emoji"?"var(--mantine-color-gray-1)":"transparent",color:n==="emoji"?"var(--mantine-color-gray-9)":"var(--mantine-color-gray-6)",cursor:"pointer"},fw:500,fz:"var(--mantine-font-size-sm)",children:e.jsx(t.Group,{gap:4,children:"Emoji"})})}),e.jsx(t.Tabs.Tab,{value:"icons",p:0,pb:"xs",onClick:()=>o("icons"),onMouseEnter:()=>r("icons"),onMouseLeave:()=>r(null),style:{backgroundColor:"transparent"},children:e.jsx(t.Box,{style:{height:"24px",display:"flex",alignItems:"center",justifyContent:"center",padding:"0 8px",borderRadius:"var(--mantine-radius-md)",border:"none",backgroundColor:s==="icons"?"var(--mantine-color-gray-1)":"transparent",color:n==="icons"?"var(--mantine-color-gray-9)":"var(--mantine-color-gray-6)",cursor:"pointer"},fw:500,fz:"var(--mantine-font-size-sm)",children:e.jsx(t.Group,{gap:4,children:"Icons"})})}),e.jsx(t.Tabs.Tab,{value:"image",p:0,pb:"xs",onClick:()=>o("image"),onMouseEnter:()=>r("image"),onMouseLeave:()=>r(null),style:{backgroundColor:"transparent"},children:e.jsx(t.Box,{style:{height:"24px",display:"flex",alignItems:"center",justifyContent:"center",padding:"0 8px",borderRadius:"var(--mantine-radius-md)",border:"none",backgroundColor:s==="image"?"var(--mantine-color-gray-1)":"transparent",color:n==="image"?"var(--mantine-color-gray-9)":"var(--mantine-color-gray-6)",cursor:"pointer"},fw:500,fz:"var(--mantine-font-size-sm)",children:e.jsx(t.Group,{gap:4,children:"Image"})})}),a&&i&&e.jsx(t.Group,{justify:"flex-end",display:"flex",flex:1,pb:"xs",children:e.jsx(t.Box,{style:{height:"24px",display:"flex",alignItems:"center",justifyContent:"center",padding:"0 8px",borderRadius:"var(--mantine-radius-md)",border:"none",backgroundColor:l?"var(--mantine-color-red-0)":"transparent",color:l?"var(--mantine-color-red-6)":"var(--mantine-color-gray-6)",cursor:"pointer",transition:"all 0.1s ease"},fw:500,fz:"var(--mantine-font-size-sm)",onClick:a,onMouseEnter:()=>d(!0),onMouseLeave:()=>d(!1),children:"Remove"})})]}),e.jsx(t.Tabs.Panel,{value:"emoji",children:n==="emoji"?c:null}),e.jsx(t.Tabs.Panel,{value:"icons",children:n==="icons"?c:null}),e.jsx(t.Tabs.Panel,{value:"image",children:n==="image"?c:null})]})};let st=!1;st||(lt.init({data:Te}),st=!0);const io=()=>{const n=[{id:"frequent",name:"Frequently Used",icon:e.jsx(T.IconClock,{size:20,strokeWidth:2.5})}];return Te.categories.forEach(s=>{if(s.emojis&&s.emojis.length>0){let o=e.jsx(T.IconMoodSmile,{size:20,strokeWidth:2}),r=s.name;switch(s.id){case"people":o=e.jsx(T.IconMoodSmile,{size:20,strokeWidth:2}),r="Smileys & People";break;case"nature":o=e.jsx(T.IconTrees,{size:20,strokeWidth:2}),r="Animals & Nature";break;case"foods":o=e.jsx(T.IconApple,{size:20,strokeWidth:2}),r="Food & Drink";break;case"activity":o=e.jsx(T.IconBallBasketball,{size:20,strokeWidth:2}),r="Activities";break;case"travel":o=e.jsx(T.IconPlane,{size:20,strokeWidth:2}),r="Travel & Places";break;case"places":o=e.jsx(T.IconPlane,{size:20,strokeWidth:2}),r="Travel & Places";break;case"objects":o=e.jsx(T.IconBulb,{size:20,strokeWidth:2}),r="Objects";break;case"symbols":o=e.jsx(T.IconHeart,{size:20,strokeWidth:2}),r="Symbols";break;case"flags":o=e.jsx(T.IconFlag,{size:20,strokeWidth:2}),r="Flags";break;case"frequent":return;default:o=e.jsx(T.IconMoodSmile,{size:20,strokeWidth:2}),r=`Category: ${s.id}`;break}n.push({id:s.id,name:r,icon:o})}}),n},co=({onEmojiSelect:n,height:s=200})=>{const[o,r]=u.useState(""),[a,i]=u.useState("people"),[c,l]=u.useState(()=>{if(typeof window<"u"){const g=localStorage.getItem("emoji-frequent");return g?JSON.parse(g):[]}return[]}),[d,f]=u.useState([]),[h,m]=u.useState(!1),x=io();u.useEffect(()=>{o.trim()?(m(!0),lt.SearchIndex.search(o).then(g=>{f(g.map(b=>({id:b.id,native:b.skins[0].native,name:b.name,keywords:b.keywords}))),m(!1)})):f([])},[o]);const I=u.useMemo(()=>{if(o.trim())return d;if(a==="frequent")return c.map(b=>({id:b,native:b,name:"",keywords:[]}));const g=Te.categories.find(b=>b.id===a);return g?g.emojis.map(b=>{const j=Te.emojis[b];return{id:j.id,native:j.skins[0].native,name:j.name,keywords:j.keywords}}):[]},[o,a,c,d]),p=g=>{n(g),l(b=>{const j=b.filter(S=>S!==g),C=[g,...j].slice(0,20);return typeof window<"u"&&localStorage.setItem("emoji-frequent",JSON.stringify(C)),C})},y=g=>{if(o.trim())return"Results";const b=x.find(j=>j.id===g);return b?b.name:g.charAt(0).toUpperCase()+g.slice(1)};return e.jsxs(t.Stack,{gap:0,style:{height:s,width:"100%"},children:[e.jsx(t.Box,{p:"sm",pb:"xs",children:e.jsxs(t.Stack,{gap:"xs",children:[e.jsx(t.TextInput,{placeholder:"Search emojis...",value:o,onChange:g=>r(g.target.value),leftSection:e.jsx(T.IconSearch,{size:16,strokeWidth:2.5}),fw:500,size:"sm",radius:"md",styles:{input:{backgroundColor:"var(--mantine-color-gray-0)",color:"var(--mantine-color-gray-9)"}}}),e.jsx(t.Text,{size:"sm",c:"var(--mantine-color-gray-6)",ta:"left",fw:500,children:y(a)})]})}),e.jsx(t.Box,{style:{flex:1,overflow:"hidden"},children:e.jsx(t.ScrollArea,{h:"100%",type:"hover",offsetScrollbars:!1,children:e.jsx(t.Box,{style:{display:"grid",gridTemplateColumns:"repeat(9, 1fr)",gap:"0px",padding:"0px 12px 12px 12px"},children:h?e.jsx(t.Text,{size:"sm",c:"dimmed",ta:"center",py:"xl",style:{gridColumn:"1 / -1"},children:"Searching..."}):I.length>0?I.map(g=>e.jsx(t.Tooltip,{label:g.name||g.id,position:"top",withArrow:!0,openDelay:300,withinPortal:!0,zIndex:1e3,color:"dark",children:e.jsx(t.Button,{variant:"subtle",size:"sm",p:0,onClick:()=>p(g.native),style:{width:"40px",height:"40px",fontSize:"22px",border:"none",backgroundColor:"transparent",borderRadius:"var(--mantine-radius-md)",display:"flex",alignItems:"center",justifyContent:"center"},onMouseEnter:b=>{b.currentTarget.style.backgroundColor="var(--mantine-color-gray-1)"},onMouseLeave:b=>{b.currentTarget.style.backgroundColor="transparent"},children:g.native})},g.id)):e.jsx(t.Text,{size:"sm",c:"dimmed",ta:"center",py:"xl",style:{gridColumn:"1 / -1"},children:"No emojis found"})})})}),e.jsx(t.Box,{px:"sm",py:"xs",style:{borderTop:"1px solid var(--mantine-color-gray-3)"},children:e.jsx(t.Flex,{gap:"0px",justify:"center",wrap:"wrap",children:x.map(g=>e.jsx(t.Tooltip,{label:g.name,position:"top",withArrow:!0,openDelay:500,withinPortal:!0,zIndex:1e3,color:"dark",children:e.jsx(t.Box,{onClick:()=>{i(g.id),r("")},style:{width:"40px",height:"40px",display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"var(--mantine-radius-md)",cursor:"pointer","&:hover":{backgroundColor:"var(--mantine-color-gray-0)"},backgroundColor:a===g.id?"var(--mantine-color-gray-0)":"transparent",color:a===g.id?"var(--mantine-color-blue-6)":"var(--mantine-color-gray-6)",transition:"all 0.1s ease"},onMouseEnter:b=>{b.currentTarget.style.backgroundColor="var(--mantine-color-gray-1)"},onMouseLeave:b=>{b.currentTarget.style.backgroundColor="transparent"},children:g.icon})},g.id))})})]})},bt=["IconUser","IconUserCircle","IconUserCheck","IconUserX","IconUserPlus","IconUserMinus","IconUserEdit","IconUserCog","IconUserShield","IconUserStar","IconUserSearch","IconUserQuestion","IconUserOff","IconUsers","IconUserBolt","IconUserCode","IconUserDollar","IconUserExclamation","IconUserFilled","IconUserHexagon","IconUserKey","IconUserPause","IconUserPin","IconUserPlay","IconUserScan","IconUserShare","IconUserSquare","IconUserUp","IconUserVoice","IconUserWrench"],wt=["IconBriefcase","IconBuilding","IconBuildingStore","IconBuildingBank","IconBuildingWarehouse","IconBuildingSkyscraper","IconBuildingBridge","IconBuildingCar","IconBuildingFactory","IconBuildingHospital","IconBuildingMonument","IconBuildingPavilon","IconBuildingTunnel","IconBuildingWindmill","IconChartBar","IconChartLine","IconChartPie","IconChartDots","IconChartArea","IconChartArcs","IconChartCandle","IconChartDonut","IconChartRadar","IconTrendingUp","IconTrendingDown","IconTarget","IconFlag","IconTrophy","IconAward","IconMedal","IconCertificate","IconBadge","IconCrown","IconStar","IconStarFilled","IconStarHalf","IconStarOff","IconFileText","IconFile","IconFileAlert","IconFileAnalytics","IconFileBarcode","IconFileBroken","IconFileCertificate","IconFileChart","IconFileCheck","IconFileCode","IconFileDatabase","IconFileDollar","IconFileDownload","IconFileEuro","IconFileExport","IconFileFunction","IconFileImport","IconFileInfo","IconFileInvoice","IconFileLambda","IconFileLike","IconFileMinus","IconFileMusic","IconFileOff","IconFilePencil","IconFilePhone","IconFilePlus","IconFileReport","IconFileRss","IconFileScissors","IconFileSearch","IconFileSettings","IconFileShredder","IconFileSignal","IconFileSpreadsheet","IconFileStar","IconFileSymlink","IconFileTime","IconFileType","IconFileTypography","IconFileUnknown","IconFileUpload","IconFileVector","IconFileX","IconFileZip","IconFolder","IconFolderOpen","IconFolderPlus","IconFolderMinus","IconFolderX","IconFolderCheck","IconFolderCog","IconFolderDown","IconFolderHeart","IconFolderOff","IconFolderPause","IconFolderPin","IconFolderQuestion","IconFolderSearch","IconFolderShare","IconFolderStar","IconFolderUp","IconFolderWrench","IconArchive","IconArchiveOff","IconBox","IconBoxMultiple","IconBoxOff","IconBoxPadding","IconBoxSeam","IconBriefcaseOff","IconClipboard","IconClipboardCheck","IconClipboardCopy","IconClipboardData","IconClipboardHeart","IconClipboardList","IconClipboardOff","IconClipboardPaste","IconClipboardText","IconClipboardTypography","IconClipboardX","IconCopy","IconCut","IconPaste","IconDuplicate","IconEdit","IconEditCircle","IconEditCircleOff"],St=["IconDeviceDesktop","IconDeviceLaptop","IconDeviceMobile","IconDeviceTablet","IconDeviceWatch","IconDeviceTv","IconDeviceGamepad","IconDeviceAirpods","IconDeviceImac","IconDeviceIpad","IconDeviceIphone","IconDeviceMacbook","IconDeviceNintendo","IconDevicePlaystation","IconDeviceXbox","IconCode","IconTerminal","IconDatabase","IconServer","IconWifi","IconBluetooth","IconCpu","IconKeyboard","IconMouse","IconCamera","IconVideo","IconMicrophone","IconSpeaker","IconHeadphones","IconPrinter","IconScanner","IconRouter","IconModem","IconAntenna","IconSatellite","IconRadar","IconRadar2","IconBroadcast","IconBroadcastOff","IconRadio","IconRadioactive","IconRadioactiveOff","IconSignal","IconSignal4G","IconSignal5G","IconSignalOff","IconBattery","IconBattery1","IconBattery2","IconBattery3","IconBattery4","IconBatteryOff","IconBatteryCharging","IconBatteryAutomotive","IconBatteryEco","IconBatteryFilled","IconPlug","IconPlugConnected","IconPlugConnectedX","IconPlugOff","IconPlugX","IconPower","IconPowerOff","IconOutlet","IconCable","IconCableOff","IconCircuitAmmeter","IconCircuitBattery","IconCircuitBulb","IconCircuitCapacitor","IconCircuitCell","IconCircuitCellPlus","IconCircuitChangeover","IconCircuitDiode","IconCircuitDiodeZener","IconCircuitGround","IconCircuitGroundDigital","IconCircuitInductor","IconCircuitMotor","IconCircuitPushbutton","IconCircuitResistor","IconCircuitSwitchClosed","IconCircuitSwitchOpen","IconCircuitVoltmeter","IconCpu2","IconCpuOff","IconMemory","IconMemoryCard","IconMemoryStick","IconHardDrive","IconHardDrive2","IconDisk","IconDiskOff","IconCd","IconCdOff","IconDvd","IconDvdOff","IconFloppyDisk","IconFloppyDiskOff","IconUsb","IconUsbOff","IconSdCard","IconSdCardOff","IconCloud","IconCloudComputing","IconCloudDataConnection","IconCloudDownload","IconCloudLock","IconCloudOff","IconCloudRain","IconCloudSnow","IconCloudStorm","IconCloudUpload","IconCloudCheck","IconCloudCode","IconCloudCog","IconCloudDollar","IconCloudDown","IconCloudExclamation","IconCloudHeart","IconCloudMinus","IconCloudPause","IconCloudPin","IconCloudPlus","IconCloudQuestion","IconCloudSearch","IconCloudShare","IconCloudStar","IconCloudUp","IconCloudX"],kt=["IconMoodSmile","IconMoodHappy","IconMoodWink","IconMoodSad","IconMoodConfused","IconMoodAnnoyed","IconMoodAngry","IconMoodCry","IconMoodTongue","IconMoodKiss","IconMoodHeart","IconMoodLove","IconMoodEmpty","IconMoodNervous","IconMoodSuprised","IconMoodSilence","IconMoodSick","IconMoodTongueWink","IconMoodTongueWink2","IconMoodWink2","IconHeart","IconHeartFilled","IconHeartBroken","IconHeartHandshake","IconHeartMinus","IconHeartOff","IconHeartPlus","IconHeartRateMonitor","IconThumbUp","IconThumbDown","IconSmile","IconFrown","IconMeh","IconLaugh","IconWink","IconKiss","IconTongue","IconGrin","IconSmirk"],Ct=["IconTrees","IconLeaf","IconFlower","IconPlant","IconSun","IconMoon","IconStar","IconCloud","IconCloudRain","IconCloudSnow","IconSnowflake","IconDroplet","IconFlame","IconMountain","IconTree","IconPineTree","IconBug","IconButterfly","IconFish","IconBird","IconCat","IconDog","IconRabbit","IconPaw","IconPawprint","IconFeather","IconSeeding","IconSeedingOff","IconPlant2","IconPlantOff","IconLeafOff","IconFlower2","IconFlowerOff","IconTreesOff","IconTreeOff","IconPineTreeOff","IconPalmTree","IconPalmTreeOff","IconSunOff","IconSunHigh","IconSunLow","IconMoonOff","IconMoonStars","IconMoon2","IconMoonFilled","IconStars","IconStarsOff","IconStarFilled","IconStarHalf","IconStarOff","IconCloudOff","IconCloudStorm","IconCloudFog","IconCloudWind","IconSnowflakeOff","IconDropletOff","IconDropletFilled","IconDropletHalf","IconDropletHalf2","IconDropletHalfFilled","IconFlameOff","IconFire","IconFireExtinguisher","IconMountainOff","IconMountain2","IconHills","IconHillsOff","IconValley","IconValleyOff","IconBugOff","IconButterflyOff","IconBee","IconBeeOff","IconSpider","IconSpiderOff","IconAnt","IconAntOff","IconLadybug","IconLadybugOff","IconGrasshopper","IconGrasshopperOff","IconCricket","IconCricketOff","IconFishOff","IconFishBone","IconFishBoneOff","IconShark","IconSharkOff","IconWhale","IconWhaleOff","IconDolphin","IconDolphinOff","IconOctopus","IconOctopusOff","IconSeahorse","IconSeahorseOff","IconBirdOff","IconEagle","IconEagleOff","IconOwl","IconOwlOff","IconParrot","IconParrotOff","IconPeacock","IconPeacockOff","IconPenguin","IconPenguinOff","IconSwan","IconSwanOff","IconCatOff","IconDogOff","IconRabbitOff","IconFeatherOff","IconWing","IconWingOff","IconEgg","IconEggOff","IconEggCracked","IconEggCrackedOff","IconEggFilled","IconEggFilledOff","IconEggFried","IconEggFriedOff","IconNest","IconNestOff","IconNestEggs","IconNestEggsOff"],Mt=["IconCircle","IconSquare","IconTriangle","IconDiamond","IconHexagon","IconPentagon","IconOctagon","IconCross","IconPlus","IconMinus","IconCheck","IconX","IconArrowUp","IconArrowDown","IconArrowLeft","IconArrowRight","IconArrowUpLeft","IconArrowUpRight","IconArrowDownLeft","IconArrowDownRight","IconArrowLeftUp","IconArrowLeftDown","IconArrowRightUp","IconArrowRightDown","IconPlay","IconPause","IconStop","IconRecord","IconSkipBack","IconSkipForward","IconRewind","IconFastForward","IconCircleDot","IconCircleFilled","IconCircleHalf","IconCircleHalf2","IconCircleHalfFilled","IconCircleOff","IconCircleX","IconSquareDot","IconSquareFilled","IconSquareHalf","IconSquareHalfFilled","IconSquareOff","IconSquareRounded","IconSquareRoundedDot","IconSquareRoundedFilled","IconSquareRoundedHalf","IconSquareRoundedHalfFilled","IconSquareRoundedOff","IconSquareRoundedX","IconSquareX","IconTriangleFilled","IconTriangleInverted","IconTriangleInvertedFilled","IconTriangleOff","IconTriangleSquare","IconTriangleSquareCircle","IconDiamondFilled","IconDiamondOff","IconHexagonFilled","IconHexagonOff","IconPentagonFilled","IconPentagonOff","IconOctagonFilled","IconOctagonOff","IconCrossOff","IconPlusMinus","IconMinusMinus","IconCheckbox","IconCheckboxOff","IconChecks","IconXbox","IconXboxOff","IconYinYang","IconYinYangOff","IconYoga","IconYogaOff","IconZodiac","IconZodiacOff","IconZoom","IconZoomCancel","IconZoomCode","IconZoomExclamation","IconZoomFilled","IconZoomIn","IconZoomInArea","IconZoomInAreaFilled","IconZoomInFilled","IconZoomMoney","IconZoomPan","IconZoomQuestion","IconZoomReplace","IconZoomReset","IconZoomScan","IconZoomScanFilled","IconZoomX"],Bt=["IconEdit","IconDelete","IconSave","IconOpen","IconClose","IconAdd","IconRemove","IconSearch","IconFilter","IconSort","IconRefresh","IconReload","IconUndo","IconRedo","IconCut","IconCopy","IconPaste","IconDuplicate","IconMove","IconRotate","IconFlip","IconResize","IconScale","IconCrop","IconTransform","IconWrench","IconHammer","IconScrewdriver","IconTool","IconTools","IconSaw","IconDrill","IconDrillOff","IconAxe","IconAxeOff","IconPickaxe","IconPickaxeOff","IconShovel","IconShovelOff","IconRake","IconRakeOff","IconHoe","IconHoeOff","IconScythe","IconScytheOff","IconPitchfork","IconPitchforkOff","IconFork","IconForkOff","IconKnife","IconKnifeOff","IconSword","IconSwordOff","IconDagger","IconDaggerOff","IconSpear","IconSpearOff","IconBow","IconBowOff","IconArrow","IconArrowOff","IconCrossbow","IconCrossbowOff","IconGun","IconGunOff","IconPistol","IconPistolOff","IconRifle","IconRifleOff","IconShotgun","IconShotgunOff","IconBomb","IconBombOff","IconGrenade","IconGrenadeOff","IconDynamite","IconDynamiteOff","IconMine","IconMineOff","IconTorpedo","IconTorpedoOff","IconMissile","IconMissileOff","IconRocket","IconRocketOff","IconBazooka","IconBazookaOff","IconCannon","IconCannonOff","IconTank","IconTankOff","IconHelicopter","IconHelicopterOff","IconPlane","IconPlaneOff","IconJet","IconJetOff","IconSatellite","IconSatelliteOff","IconSpace","IconSpaceOff","IconGalaxy","IconGalaxyOff","IconPlanet","IconPlanetOff","IconEarth","IconEarthOff","IconMoon","IconMoonOff","IconSun","IconSunOff","IconStar","IconStarOff","IconAsteroid","IconAsteroidOff","IconComet","IconCometOff","IconMeteor","IconMeteorOff","IconUfo","IconUfoOff","IconAlien","IconAlienOff","IconRobot","IconRobotOff","IconAndroid","IconAndroidOff","IconIos","IconIosOff","IconWindows","IconWindowsOff","IconLinux","IconLinuxOff","IconMac","IconMacOff","IconUbuntu","IconUbuntuOff","IconDebian","IconDebianOff","IconRedhat","IconRedhatOff","IconCentos","IconCentosOff","IconFedora","IconFedoraOff","IconSuse","IconSuseOff","IconArch","IconArchOff","IconGentoo","IconGentooOff","IconSlackware","IconSlackwareOff","IconMint","IconMintOff","IconKali","IconKaliOff","IconParrot","IconParrotOff","IconBacktrack","IconBacktrackOff","IconBlackarch","IconBlackarchOff","IconPentoo","IconPentooOff","IconMatriux","IconMatriuxOff","IconNodezero","IconNodezeroOff","IconBugtraq","IconBugtraqOff","IconCyborg","IconCyborgOff","IconDefensive","IconDefensiveOff","IconDracos","IconDracosOff","IconFembuntu","IconFembuntuOff","IconGnacktrack","IconGnacktrackOff","IconHackintosh","IconHackintoshOff","IconHak5","IconHak5Off","IconHavij","IconHavijOff","IconJackal","IconJackalOff","IconKnoppix","IconKnoppixOff","IconKodachi","IconKodachiOff","IconLion","IconLionOff","IconMandriva","IconMandrivaOff","IconMobily","IconMobilyOff","IconMuslim","IconMuslimOff","IconNetrunner","IconNetrunnerOff","IconPardus","IconPardusOff","IconQubes","IconQubesOff","IconSabayon","IconSabayonOff","IconScientific","IconScientificOff","IconSemplice","IconSempliceOff","IconSiduction","IconSiductionOff","IconSlax","IconSlaxOff","IconSli","IconSliOff","IconTails","IconTailsOff","IconVector","IconVectorOff","IconVoid","IconVoidOff","IconWhonix","IconWhonixOff","IconZorin","IconZorinOff","IconAlpine","IconAlpineOff","IconElementary","IconElementaryOff","IconManjaro","IconManjaroOff","IconOpenbsd","IconOpenbsdOff","IconOpenSuse","IconOpenSuseOff","IconPop","IconPopOff","IconSolus","IconSolusOff"],Tt=["IconMessage","IconMessageCircle","IconMessageDots","IconMessagePlus","IconMessageReport","IconMessageShare","IconMessageText","IconMessages","IconMessagesOff","IconMail","IconMailOpened","IconMailFast","IconMailOff","IconMailPause","IconMailPin","IconMailPlus","IconMailQuestion","IconMailSearch","IconMailShare","IconMailStar","IconMailUp","IconMailX","IconPhone","IconPhoneCall","IconPhoneIncoming","IconPhoneOff","IconPhoneOutgoing","IconPhonePause","IconPhonePlus","IconPhoneX","IconVideo","IconVideoOff","IconVideoPlus","IconCamera","IconCameraOff","IconCameraPlus","IconMicrophone","IconMicrophoneOff","IconMicrophone2","IconMicrophone2Off","IconHeadphones","IconHeadphonesOff","IconSpeaker","IconSpeakerOff","IconBroadcast","IconBroadcastOff","IconRadio","IconRadioactive","IconRadioactiveOff","IconAntenna","IconAntennaBars1","IconAntennaBars2","IconAntennaBars3","IconAntennaBars4","IconAntennaBars5","IconAntennaOff","IconSatellite","IconSatelliteOff","IconWifi","IconWifi0","IconWifi1","IconWifi2","IconWifiOff","IconBluetooth","IconBluetoothConnected","IconBluetoothOff","IconBluetoothX","IconShare","IconShareOff","IconShare2","IconShare3","IconAt","IconHash","IconLink","IconLinkOff","IconExternalLink","IconExternalLinkOff","IconSend","IconSendOff","IconSend2","IconReceipt","IconReceiptOff","IconReceipt2","IconReceiptRefund","IconReceiptTax","IconReceiptEuro","IconReceiptDollar","IconReceiptPound","IconReceiptYen","IconReceiptYuan","IconReceiptWon","IconReceiptRupee","IconReceiptBaht","IconReceiptLira","IconReceiptRuble","IconReceiptShekel","IconReceiptTaka","IconReceiptHryvnia","IconReceiptKrone","IconReceiptKrona","IconReceiptZloty","IconReceiptForint","IconReceiptLeu","IconReceiptLev","IconReceiptKuna","IconReceiptDinar","IconReceiptDirham","IconReceiptRial","IconReceiptRiyal","IconReceiptAfghani","IconReceiptAriary","IconReceiptCedi","IconReceiptDalasi","IconReceiptFranc","IconReceiptGourde","IconReceiptKina","IconReceiptKip","IconReceiptKwacha","IconReceiptKwanza","IconReceiptLari","IconReceiptLek","IconReceiptLilangeni","IconReceiptLoti","IconReceiptManat","IconReceiptMetical","IconReceiptNaira","IconReceiptPeso","IconReceiptPula","IconReceiptRand","IconReceiptRupiah","IconReceiptShilling","IconReceiptSom","IconReceiptSomoni","IconReceiptTenge","IconReceiptVatu","IconReceiptWon","IconReceiptXof","IconReceiptYuan","IconReceiptZloty"];[...bt,...wt,...St,...kt,...Ct,...Mt,...Bt,...Tt];const Ie=[{id:"recent",name:"Recently Used",icons:[],isDynamic:!0},{id:"user",name:"User & Profile",icons:bt},{id:"business",name:"Business & Work",icons:wt},{id:"tech",name:"Technology",icons:St},{id:"expressions",name:"Expressions",icons:kt},{id:"nature",name:"Nature & Animals",icons:Ct},{id:"shapes",name:"Shapes & Symbols",icons:Mt},{id:"actions",name:"Actions & Tools",icons:Bt},{id:"communication",name:"Communication",icons:Tt}],lo={recent:e.jsx(T.IconClock,{size:20,strokeWidth:2.5}),user:e.jsx(T.IconUser,{size:20,strokeWidth:2.5}),business:e.jsx(T.IconBriefcase,{size:20,strokeWidth:2.5}),tech:e.jsx(T.IconDeviceDesktop,{size:20,strokeWidth:2.5}),expressions:e.jsx(T.IconMoodSmile,{size:20,strokeWidth:2.5}),nature:e.jsx(T.IconTrees,{size:20,strokeWidth:2.5}),shapes:e.jsx(T.IconCircle,{size:20,strokeWidth:2.5}),actions:e.jsx(T.IconTool,{size:20,strokeWidth:2.5}),communication:e.jsx(T.IconMessage,{size:20,strokeWidth:2.5})},uo=({selectedCategory:n,onCategoryChange:s})=>e.jsx(t.Flex,{gap:"0px",justify:"center",wrap:"wrap",children:Ie.map(o=>{const r=lo[o.id];return e.jsx(t.Tooltip,{label:o.name,position:"top",withArrow:!0,openDelay:500,withinPortal:!0,zIndex:1e3,color:"dark",children:e.jsx(t.Box,{onClick:()=>s(o.id),style:{width:"40px",height:"40px",display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"var(--mantine-radius-md)",cursor:"pointer",backgroundColor:n===o.id?"var(--mantine-color-gray-0)":"transparent",color:n===o.id?"var(--mantine-color-blue-6)":"var(--mantine-color-gray-6)",transition:"all 0.2s ease"},onMouseEnter:a=>{a.currentTarget.style.backgroundColor="var(--mantine-color-gray-1)"},onMouseLeave:a=>{a.currentTarget.style.backgroundColor=n===o.id?"var(--mantine-color-gray-0)":"transparent"},children:r})},o.id)})}),Ot=u.memo(({onIconSelect:n,height:s=358})=>{var g,b;const[o,r]=u.useState(""),[a,i]=u.useState("recent"),[c,l]=u.useState(!1),[d,f]=u.useState([]);u.useLayoutEffect(()=>{if(typeof window<"u"){const j=localStorage.getItem("avatar-icon-recent");if(j)try{f(JSON.parse(j))}catch(C){console.warn("Error parsing recent icons from localStorage:",C)}}},[]);const h=u.useMemo(()=>Ie.filter(j=>j.id!=="recent"&&!("isDynamic"in j)).flatMap(j=>j.icons),[]),m=u.useMemo(()=>{if(a==="recent"){const C=new Set(h);return d.filter(S=>C.has(S))}const j=Ie.find(C=>C.id===a);return(j==null?void 0:j.icons)||[]},[a,d,h]),x=u.useCallback((j,C)=>{if(!j.trim())return C;const S=j.toLowerCase().trim(),B=S.split(/\s+/);return C.filter(k=>{const v=k.replace(/^Icon/,"").split(/(?=[A-Z])/).map(O=>O.toLowerCase().trim()).filter(O=>O.length>0);return!!(v.some(O=>B.some(M=>O===M))||S.length>2&&v.some(O=>B.some(M=>O.startsWith(M)))||S.length<=2&&v.some(O=>B.some(M=>O.includes(M)))||B.length>1&&B.every(O=>v.some(M=>M===O||M.startsWith(O))))})},[]),I=u.useMemo(()=>o.trim()?x(o,h):m,[o,m,h,x]),p=u.useCallback(j=>{h.includes(j)&&f(S=>{const B=[j,...S.filter(k=>k!==j)].slice(0,20);return typeof window<"u"&&localStorage.setItem("avatar-icon-recent",JSON.stringify(B)),B}),n(j)},[n,h]),y=u.useCallback(j=>{a!==j&&(r(""),i(j),requestAnimationFrame(()=>{l(!0),setTimeout(()=>l(!1),100)}))},[a]);return e.jsxs(t.Stack,{gap:0,style:{height:s,width:"100%"},children:[e.jsx(t.Box,{p:"sm",pb:"xs",children:e.jsxs(t.Stack,{gap:"xs",children:[e.jsx(t.TextInput,{placeholder:o.trim()?"Search all icons...":`Search in ${(g=Ie.find(j=>j.id===a))==null?void 0:g.name}...`,value:o,onChange:j=>r(j.target.value),leftSection:e.jsx(T.IconSearch,{size:16}),fw:500,size:"sm",radius:"md",styles:{input:{backgroundColor:"var(--mantine-color-gray-0)",color:"var(--mantine-color-gray-9)"}}}),e.jsx(t.Text,{size:"sm",c:"var(--mantine-color-gray-6)",ta:"left",fw:500,children:o.trim()?"Results":(b=Ie.find(j=>j.id===a))==null?void 0:b.name})]})}),e.jsx(t.Box,{style:{flex:1,overflow:"hidden"},children:e.jsx(t.ScrollArea,{h:"100%",type:"hover",children:e.jsx(t.Box,{style:{display:"grid",gridTemplateColumns:"repeat(8, 1fr)",gap:"4px",padding:"0 12px 12px 12px",opacity:c?.7:1,transition:"opacity 0.05s ease"},children:I.map(j=>e.jsx(ut,{iconName:j,onClick:()=>p(j),size:20},o.trim()?`search-${j}`:`${a}-${j}`))},`${a}-${o}`)})}),e.jsx(t.Box,{px:"sm",py:"xs",style:{borderTop:"1px solid var(--mantine-color-gray-3)"},children:e.jsx(uo,{selectedCategory:a,onCategoryChange:y})})]})});Ot.displayName="IconGrid";const fo=({previewImage:n,fileInputRef:s,selectedEmoji:o,size:r,loading:a,onFileInputClick:i,onImageChange:c,onImageAccept:l,onClearImagePreview:d})=>e.jsx(t.Box,{p:"sm",style:{width:"384px"},children:e.jsxs(t.Stack,{gap:"md",align:"center",children:[n||o?e.jsxs(t.Box,{children:[e.jsx(t.Text,{size:"sm",fw:500,mb:"xs",children:"Preview"}),e.jsx(t.Avatar,{src:n,radius:"md",style:{width:`${xe(r)}px !important`,height:`${xe(r)}px !important`,minWidth:`${xe(r)}px`,minHeight:`${xe(r)}px`,maxWidth:`${xe(r)}px`,maxHeight:`${xe(r)}px`,border:"1px solid var(--mantine-color-gray-4)",objectFit:"cover",boxSizing:"border-box"},children:o})]}):e.jsx(t.Button,{variant:"subtle",bg:"gray.0",styles:{root:{height:"64px"}},leftSection:e.jsx(T.IconPhoto,{size:20}),onClick:i,loading:a,disabled:a,fullWidth:!0,children:"Choose Image"}),n||o?e.jsx(t.Button,{variant:"outline",leftSection:e.jsx(T.IconPhoto,{size:16}),onClick:i,loading:a,disabled:a,fullWidth:!0,children:n||o?"Change Image":"Choose Image"}):null,e.jsx("input",{ref:s,type:"file",accept:"image/jpeg,image/jpg,image/png,image/gif,image/webp",onChange:f=>{var h;return c(((h=f.target.files)==null?void 0:h[0])||null)},style:{display:"none"},disabled:a}),(n||o)&&e.jsxs(t.Group,{gap:"sm",w:"100%",children:[e.jsx(t.Button,{variant:"outline",color:"gray",onClick:d,fullWidth:!0,children:"Back"}),e.jsx(t.Button,{color:"blue",onClick:l,loading:a,disabled:a,fullWidth:!0,children:"Accept"})]}),e.jsx(t.Text,{size:"xs",c:"var(--mantine-color-gray-6)",ta:"center",children:"Supported formats: JPG, PNG, GIF, WebP"})]})}),ho=({onEmojiSelect:n})=>e.jsx(co,{onEmojiSelect:n,height:358}),xo=({onIconSelect:n})=>e.jsx(Ot,{onIconSelect:n,height:358}),po=({previewImage:n,selectedEmoji:s,size:o,loading:r,onFileInputClick:a,onImageChange:i,onImageAccept:c,onClearImagePreview:l,fileInputRef:d})=>e.jsx(fo,{previewImage:n,fileInputRef:d,selectedEmoji:s,size:o,loading:r,onFileInputClick:a,onImageChange:i,onImageAccept:c,onClearImagePreview:l}),mo=()=>e.jsx(t.Box,{style:{width:400,height:358,display:"flex",alignItems:"center",justifyContent:"center"},children:e.jsxs(t.Stack,{align:"center",gap:"sm",children:[e.jsx(t.Loader,{size:"sm"}),e.jsx(t.Text,{size:"sm",c:"gray.6",children:"Loading avatar options..."})]})}),Ae=({editable:n=!0,opened:s,onOpen:o,onClose:r,avatar:a,onAvatarSelect:i,onRemove:c,size:l="lg",loading:d=!1,placeholder:f,showPlaceholder:h=!0,position:m="bottom-start",withinPortal:x=!0,zIndex:I=1e3})=>{const p=u.useRef(null),y=u.useRef(null),g=u.useRef(null),{selectedTab:b,tabHovered:j,previewImage:C,selectedEmoji:S,selectedIcon:B,selectedFile:k,handleTabChange:w,handleTabHover:v,handleImagePreview:O,handleImageAccept:M,handleEmojiSelect:z,handleIconSelect:E,clearImagePreview:W,resetState:P}=ro({onAvatarSelect:i});so({opened:s,onClose:r,popoverRef:y}),u.useEffect(()=>{s||P()},[s,P]);const H=X=>{console.log("Emoji clicked:",X),z(X),r()},L=X=>{console.log("Icon clicked:",X),E(X),r()},_=X=>{X&&O(X)},N=()=>{k?(M(),r()):(S||B)&&r()},Z=()=>{p.current&&p.current.click()},F=()=>{W()},G=()=>{console.log("Avatar removed"),c==null||c(),r()},R=()=>!!a,D=()=>d?e.jsx(Oe,{size:l,loading:!0}):e.jsx(se,{avatar:a,size:l,placeholder:f,showPlaceholder:h,editable:!0,onClick:()=>{!d&&!s&&o()}}),A=e.jsx(ho,{onEmojiSelect:H}),U=e.jsx(xo,{onIconSelect:L}),V=e.jsx(po,{previewImage:C,selectedEmoji:S,size:l,loading:d,onFileInputClick:Z,onImageChange:_,onImageAccept:N,onClearImagePreview:F,fileInputRef:p}),te=e.jsx(t.Box,{children:e.jsx(ao,{selectedTab:b,tabHovered:j,onTabChange:w,onTabHover:v,onRemove:G,hasAvatar:R(),children:b==="emoji"?A:b==="icons"?U:V})}),$=e.jsx("div",{style:{position:"relative",display:"inline-block"},children:e.jsxs(t.Popover,{opened:s,onClose:()=>{console.log("Popover onClose called"),r()},position:m,withinPortal:x,withArrow:!0,shadow:"md",radius:"md",closeOnClickOutside:!1,closeOnEscape:!1,offset:8,children:[e.jsx(t.Popover.Target,{children:e.jsx("div",{ref:g,style:{position:"relative"},children:D()})}),e.jsx(t.Popover.Dropdown,{ref:y,p:0,style:{width:"auto",overflow:"hidden",zIndex:I},children:e.jsx(u.Suspense,{fallback:e.jsx(mo,{}),children:te})})]})}),oe=e.jsx(se,{avatar:a,size:l,placeholder:f,showPlaceholder:h});return e.jsx(e.Fragment,{children:n?$:oe})},go=n=>{if(!n||typeof n!="string")return!1;const s=/^[^\s@]+@[^\s@]+\.[^\s@]+$/;return n.length<5||n.length>254?!1:s.test(n.trim())},Io=n=>{const s=[];return n.forEach(o=>{go(o)||s.push({email:o,error:"Please enter a valid email address"})}),{isValid:s.length===0,errors:s}},yo=n=>{const s=[],o=new Set;return n.forEach(r=>{const a=r.toLowerCase().trim();o.has(a)?s.push({email:r,error:"This email has already been added"}):o.add(a)}),s},vo=n=>{const s=Io(n),o=yo(n),r=[...s.errors,...o];return{isValid:r.length===0,errors:r}},jo=({value:n,onChange:s,onInputChange:o,suggestedUsers:r=[],tagDisplayMap:a={}})=>{const[i,c]=u.useState(""),[l,d]=u.useState([]),f=u.useRef(null),h=n.map(y=>{if(a[y])return a[y];const g=r.find(b=>b.email===y);return g&&g.name?g.name:y});u.useEffect(()=>{o&&o(i)},[i,o]),u.useEffect(()=>{if(n.length>0){const y=vo(n);d(y.errors)}else d([])},[n]),u.useEffect(()=>{const y=f.current;if(!y)return;let g;const b=j=>{const S=j.target.value||"";clearTimeout(g),g=setTimeout(()=>{c(S)},150)};return y.addEventListener("input",b),()=>{y.removeEventListener("input",b),clearTimeout(g)}},[]);const m=u.useCallback(y=>{const g=r.map(j=>({name:j.name||j.email,email:j.email})),b=y.map(j=>{const C=g.find(S=>S.name.toLowerCase()===j.toLowerCase());return C?C.email:j}).filter(j=>j.includes("@")?!0:!g.some(S=>{const B=S.name.toLowerCase(),k=j.toLowerCase();return B.startsWith(k)&&k!==B}));s(b),c("")},[s,r]),x=u.useCallback(()=>{f.current&&(f.current.value="",c(""))},[]),I=l.length===0&&n.length>0,p=u.useCallback((y,g,b)=>{y&&n.length>0&&g&&(y(n,g,b),c(""))},[n]);return{inputText:i,tagsInputRef:f,displayValue:h,validationErrors:l,isValid:I,handleEmailChange:m,clearInput:x,handleInvite:p}},zt=({onInvite:n,onUpdateRole:s,onRemoveUser:o,invitedUsers:r=[],suggestedUsers:a=[],roleOptions:i=[]})=>{const[c,l]=u.useState([]),[d,f]=u.useState([]),[h,m]=u.useState(""),[x,I]=u.useState({}),p=i.length>0?i[0].value:void 0,[y,g]=u.useState(p);u.useEffect(()=>{i.length>0&&!y&&g(i[0].value)},[i.length,y]),u.useEffect(()=>{const z=a.filter(E=>c.includes(E.email)).map(E=>E.id);f(E=>E.filter(W=>z.includes(W)))},[c,a.length]);const[b,j]=u.useState("invite"),[C,S]=u.useState(null),B=(z,E,W)=>{n&&n(z,E,W),l([]),m("")},k=(z,E)=>{s&&s(z,E)},w=z=>{o&&o(z)},v=z=>{f(E=>E.includes(z)?E.filter(W=>W!==z):[...E,z])},O=z=>{c.includes(z.email)||(l([...c,z.email]),I(E=>({...E,[z.email]:z.name||z.email})),d.includes(z.id)||f([...d,z.id]),m(""))},M=h.trim()?a.filter(z=>{var W;const E=h.toLowerCase();return z.email.toLowerCase().includes(E)||((W=z.name)==null?void 0:W.toLowerCase().includes(E))}):[];return{emails:c,setEmails:l,selectedUsers:d,setSelectedUsers:f,inputText:h,setInputText:m,tagDisplayMap:x,setTagDisplayMap:I,selectedRole:y,setSelectedRole:g,selectedTab:b,setSelectedTab:j,tabHovered:C,setTabHovered:S,filteredUsers:M,handleInvite:B,handleUpdateRole:k,handleRemoveUser:w,handleToggleUser:v,handleAddSuggestedUser:O}},Rt=u.forwardRef(({value:n,onChange:s,placeholder:o="Add one or more emails",onInvite:r,roleOptions:a=[],selectedRole:i,onRoleChange:c,onInputChange:l,suggestedUsers:d=[],tagDisplayMap:f={}},h)=>{const[m,x]=u.useState("Hello, I would like to invite you to join my workspace"),{tagsInputRef:I,displayValue:p,validationErrors:y,isValid:g,handleEmailChange:b,clearInput:j,handleInvite:C}=jo({value:n,onChange:s,onInputChange:l,suggestedUsers:d,tagDisplayMap:f}),S=()=>{C(r,i,m),x("")};u.useImperativeHandle(h,()=>({clearInput:j}),[j]);const B=p.length>0,k=c&&a.length>0,w=y.length>0;return e.jsxs(t.Stack,{gap:"md",children:[e.jsxs(t.Box,{children:[e.jsx(t.Box,{style:{maxHeight:"120px",overflowY:"auto",overflowX:"hidden",paddingRight:"8px",marginRight:"-8px"},children:e.jsx(t.TagsInput,{ref:I,value:p,onChange:b,placeholder:B?"":o,radius:"md",rightSection:k?e.jsx(t.Box,{style:{position:"absolute",right:"8px",top:"17px",transform:"translateY(-50%)",height:"24px",display:"flex",alignItems:"center"},children:e.jsx(Ee,{value:i||"",onChange:v=>c(v),data:a,placeholder:"Select role",defaultOption:a[a.length-1],disabledOptions:["owner"]})}):null,rightSectionProps:{style:{width:k?"120px":"0px",position:"absolute",height:"32px",right:"8px"}},styles:{input:{paddingRight:k?"130px":"12px",minHeight:"36px",display:"flex",flexWrap:"wrap",alignItems:"center",gap:"4px",borderRadius:"var(--mantine-radius-md)",border:w?"2px solid var(--mantine-color-red-6)":"2px solid var(--mantine-color-blue-7)",backgroundColor:"var(--mantine-color-gray-0)"},pillsList:{height:"24px !important",borderRadius:"var(--mantine-radius-md) !important"},pill:{height:"24px !important",borderRadius:"var(--mantine-radius-md) !important",backgroundColor:w?"var(--mantine-color-red-1) !important":"var(--mantine-color-orange-1) !important",color:w?"var(--mantine-color-red-7) !important":"var(--mantine-color-gray-7) !important",fontSize:"var(--mantine-font-size-sm)"}}})}),w&&e.jsx(t.Stack,{gap:"xs",mt:"xs",children:y.map((v,O)=>e.jsxs(t.Text,{size:"xs",c:"red",children:[v.email,": ",v.error]},O))})]}),B&&e.jsxs(t.Stack,{gap:"sm",children:[e.jsx(t.Textarea,{size:"sm",value:m,onChange:v=>x(v.currentTarget.value),minRows:2,maxRows:4,radius:"md"}),e.jsx(t.Button,{variant:"filled",color:"blue",onClick:S,fullWidth:!0,radius:"md",disabled:!g,children:"Send invitations"})]})]})}),bo=n=>{switch(n){case"member":return"green";case"invited":return"orange";case"declined":return"red";case"revoked":return"red";case"expired":return"red";default:return"gray"}},wo=n=>{switch(n){case"member":return"Member";case"invited":return"Invited";case"declined":return"Declined";case"revoked":return"Revoked";case"expired":return"Expired";default:return"Unknown"}},So=n=>{if(n){if(typeof n=="object"&&"type"in n)return n;if(typeof n=="string")return{type:"image",value:n}}},je=({user:n,isSelected:s=!1,onToggle:o,onUpdateRole:r,onRemoveUser:a,roleOptions:i=[],variant:c="invited",onClick:l})=>{var g;const d=((g=n.name)==null?void 0:g.trim())||n.email,f=()=>{o&&o(n.id)},h=b=>{if(r){const j=b;r(n.id,j)}},m=c==="suggested"||c==="read-only",x=c==="invited"&&i.length>0,[I,p]=u.useState(!1),y=()=>{l==null||l()};return e.jsxs(t.Group,{justify:"space-between",align:"center",wrap:"nowrap",w:"100%",style:{cursor:"pointer",borderRadius:"var(--mantine-radius-md)",padding:"6px"},onClick:y,bg:I?"var(--mantine-color-gray-0)":"transparent",onMouseEnter:()=>p(!0),onMouseLeave:()=>p(!1),children:[e.jsxs(t.Group,{gap:"sm",w:"100%",align:"flex-start",wrap:"nowrap",children:[e.jsx(se,{avatar:So(n.avatar),size:"md",placeholder:d,showPlaceholder:!0}),e.jsxs(t.Stack,{gap:0,w:"100%",justify:"flex-start",align:"flex-start",children:[e.jsxs(t.Group,{gap:"sm",align:"flex-start",wrap:"nowrap",children:[e.jsxs(t.Group,{gap:"sm",align:"flex-start",wrap:"nowrap",children:[e.jsx(t.Text,{size:"sm",fw:500,lineClamp:1,mb:-2,children:d}),n.isCurrentUser&&e.jsx(t.Badge,{size:"xs",variant:"light",color:"gray",radius:"sm",children:"Owner"})]}),n.status!=="member"&&e.jsx(t.Badge,{size:"xs",variant:"light",color:bo(n.status),radius:"sm",children:wo(n.status)})]}),e.jsx(t.Text,{size:"xs",c:"dimmed",lineClamp:1,children:n.email})]})]}),e.jsxs(t.Group,{gap:"sm",align:"center",children:[m&&c!=="read-only"&&e.jsx(t.Radio,{checked:s,onChange:f,size:"sm",onClick:b=>b.stopPropagation(),pr:4}),x&&!n.isCurrentUser&&e.jsx(Ee,{value:n.role,onChange:h,data:i,placeholder:"Select role",defaultOption:i.find(b=>b.value===n.role),withRemove:!0,onRemove:()=>a==null?void 0:a(n.id)})]})]})},Dt=({opened:n,onClose:s,onInvite:o,onUpdateRole:r,onRemoveUser:a,invitedUsers:i=[],children:c,roleOptions:l=[],suggestedUsers:d=[]})=>{const f=u.useRef(null),{emails:h,setEmails:m,selectedUsers:x,inputText:I,setInputText:p,tagDisplayMap:y,selectedRole:g,setSelectedRole:b,selectedTab:j,setSelectedTab:C,tabHovered:S,setTabHovered:B,filteredUsers:k,handleInvite:w,handleUpdateRole:v,handleRemoveUser:O,handleToggleUser:M,handleAddSuggestedUser:z}=zt({onInvite:o,onUpdateRole:r,onRemoveUser:a,invitedUsers:i,suggestedUsers:d,roleOptions:l}),E=L=>{z(L),f.current&&f.current.clearInput()},W=e.jsxs(e.Fragment,{children:[e.jsx(Rt,{ref:f,value:h,onChange:m,onInvite:w,roleOptions:l,selectedRole:g,onRoleChange:b,onInputChange:p,suggestedUsers:d,tagDisplayMap:y}),e.jsx(t.Space,{h:"sm"}),e.jsx(t.ScrollArea,{mah:200,type:"auto",style:{overflow:"visible"},children:e.jsx(t.Box,{children:i.length>0&&e.jsxs(e.Fragment,{children:[e.jsx(t.Text,{size:"sm",fw:500,children:"Already members"}),e.jsx(t.Space,{h:"sm"}),e.jsx(t.Stack,{gap:"sm",children:i.map(L=>e.jsx(je,{user:L,isSelected:x.includes(L.id),onToggle:M,onUpdateRole:v,onRemoveUser:O,roleOptions:l,variant:"invited"},L.id))})]})})}),k.length>0&&e.jsx(t.ScrollArea,{pt:"sm",mah:200,type:"auto",style:{overflow:"visible"},children:e.jsx(t.Box,{children:k.length>0?e.jsxs(e.Fragment,{children:[e.jsxs(t.Text,{size:"sm",fw:500,children:["Suggested ",I.trim()&&`(filtered by "${I}")`]}),e.jsx(t.Space,{h:"sm"}),e.jsx(t.Stack,{gap:"sm",children:k.map(L=>e.jsx(je,{user:L,isSelected:x.includes(L.id),onToggle:M,onUpdateRole:v,onRemoveUser:O,roleOptions:l,variant:"suggested",onClick:()=>E(L)},L.id))})]}):null})})]}),P=e.jsx(e.Fragment,{children:e.jsxs(t.Stack,{gap:"md",p:"sm",children:[e.jsxs(t.Stack,{gap:4,align:"center",children:[e.jsx(t.Text,{size:"sm",fw:500,ta:"center",children:"Publish to the web"}),e.jsx(t.Text,{size:"sm",fw:500,color:"var(--mantine-color-gray-6)",ta:"center",children:"Anyone with the link can view this page"})]}),e.jsx(t.Button,{variant:"filled",size:"xs",radius:"md",fw:500,fz:"var(--mantine-font-size-sm)",ta:"center",children:"Publish"})]})}),H=e.jsx(t.Box,{style:{width:"400px",maxHeight:"600px",overflow:"visible"},children:e.jsx(t.Stack,{gap:"lg",children:e.jsxs(t.Tabs,{color:"black",defaultValue:"invite",styles:{tab:{backgroundColor:"transparent"}},children:[e.jsxs(t.Tabs.List,{px:"var(--mantine-spacing-sm)",pt:"xs",children:[e.jsx(t.Tabs.Tab,{value:"invite",p:0,pb:6,onClick:()=>{C("invite")},onMouseEnter:()=>B("invite"),onMouseLeave:()=>B(null),style:{backgroundColor:"transparent"},children:e.jsx(t.Box,{style:{borderRadius:"var(--mantine-radius-md)",height:"24px",display:"flex",alignItems:"center",justifyContent:"center",padding:"0 8px",border:"none",backgroundColor:S==="invite"?"var(--mantine-color-gray-1)":"transparent",color:j==="invite"?"var(--mantine-color-gray-9)":"var(--mantine-color-gray-6)",cursor:"pointer"},fw:500,fz:"var(--mantine-font-size-sm)",children:"Invite"})}),e.jsx(t.Tabs.Tab,{value:"publish",p:0,pb:6,onClick:()=>{C("publish")},onMouseEnter:()=>B("publish"),onMouseLeave:()=>B(null),style:{backgroundColor:"transparent"},children:e.jsx(t.Box,{style:{height:"24px",display:"flex",alignItems:"center",justifyContent:"center",padding:"0 8px",borderRadius:"var(--mantine-radius-md)",border:"none",backgroundColor:S==="publish"?"var(--mantine-color-gray-1)":"transparent",color:j==="publish"?"var(--mantine-color-gray-9)":"var(--mantine-color-gray-6)",cursor:"pointer"},fw:500,fz:"var(--mantine-font-size-sm)",children:"Publish"})})]}),e.jsx(t.Tabs.Panel,{value:"invite",children:e.jsx(t.Box,{p:"sm",children:W})}),e.jsx(t.Tabs.Panel,{value:"publish",children:e.jsx(t.Box,{p:"sm",children:P})})]})})});return e.jsx(ve,{trigger:c,menuItems:[],opened:n,onClose:s,styles:{dropdown:{padding:"0",borderRadius:"var(--mantine-radius-md)"}},children:H})},ko=({onInvite:n,onUpdateRole:s,onRemoveUser:o,invitedUsers:r,currentUser:a,roleOptions:i,suggestedUsers:c,label:l="Share"})=>{const[d,f]=u.useState(!1),h=()=>f(!1),m=e.jsx(ze,{label:l,onClick:()=>f(!0),isActive:d});return e.jsx(Dt,{opened:d,onClose:h,onInvite:n,onUpdateRole:s,onRemoveUser:o,invitedUsers:r,currentUser:a,roleOptions:i,suggestedUsers:c,children:m})},Co=({opened:n,onClose:s,onInvite:o,onUpdateRole:r,onRemoveUser:a,invitedUsers:i=[],roleOptions:c=[],suggestedUsers:l=[]})=>{const d=u.useRef(null),{emails:f,setEmails:h,selectedUsers:m,inputText:x,setInputText:I,tagDisplayMap:p,selectedRole:y,setSelectedRole:g,filteredUsers:b,handleInvite:j,handleUpdateRole:C,handleRemoveUser:S,handleToggleUser:B,handleAddSuggestedUser:k}=zt({onInvite:o,onUpdateRole:r,onRemoveUser:a,invitedUsers:i,suggestedUsers:l,roleOptions:c}),w=v=>{k(v),d.current&&d.current.clearInput()};return e.jsx(t.Modal,{opened:n,onClose:s,size:"md",withCloseButton:!1,radius:"md",centered:!0,closeOnClickOutside:!1,closeOnEscape:!0,trapFocus:!1,zIndex:300,children:e.jsxs(t.Stack,{gap:"lg",children:[e.jsxs(t.Group,{justify:"space-between",wrap:"nowrap",children:[e.jsx(t.Text,{size:"md",fw:500,c:"var(--mantine-color-gray-8)",children:"Share"}),e.jsx(ee,{icon:T.IconX,size:"md",onClick:s,color:"var(--mantine-color-gray-8)"})]}),e.jsx(Rt,{ref:d,value:f,onChange:h,onInvite:j,roleOptions:c,selectedRole:y,onRoleChange:g,onInputChange:I,suggestedUsers:l,tagDisplayMap:p}),i.length>0&&e.jsxs(t.Box,{children:[e.jsx(t.Text,{size:"sm",fw:500,children:"Already members"}),e.jsx(t.Space,{h:"sm"}),e.jsx(t.Box,{style:{maxHeight:"200px",minHeight:"60px",overflowY:"auto",overflowX:"hidden",paddingRight:"8px",marginRight:"-8px"},children:e.jsx(t.Stack,{gap:"sm",children:i.map(v=>e.jsx(je,{user:v,isSelected:m.includes(v.id),onToggle:B,onUpdateRole:C,onRemoveUser:S,roleOptions:c,variant:"invited"},v.id))})})]}),b.length>0&&e.jsxs(t.Box,{children:[e.jsxs(t.Text,{size:"sm",fw:500,children:["Suggested ",x.trim()&&`(filtered by "${x}")`]}),e.jsx(t.Space,{h:"sm"}),e.jsx(t.Box,{style:{maxHeight:"200px",minHeight:"60px",overflowY:"auto",overflowX:"hidden",paddingRight:"8px",marginRight:"-8px"},children:e.jsx(t.Stack,{gap:"sm",children:b.map(v=>e.jsx(je,{user:v,isSelected:m.includes(v.id),onToggle:B,onUpdateRole:C,onRemoveUser:S,roleOptions:c,variant:"suggested",onClick:()=>w(v)},v.id))})})]})]})})},Mo=({opened:n,onClose:s,options:o=[],onSave:r,onCancel:a,groups:i=[],styles:c})=>{const[l,d]=u.useState("");u.useEffect(()=>{n&&o.length>0?d(o[0].id):n||d("")},[n,o]);const f=()=>{r&&r(),s()},h=()=>{a&&a(),s()},m=()=>{s()},x=o.find(I=>I.id===l);return e.jsxs(t.Modal,{opened:n,onClose:m,size:"90%",centered:!0,closeOnClickOutside:!0,closeOnEscape:!0,withCloseButton:!1,p:"none",styles:{body:{...c==null?void 0:c.body,padding:0,height:"80vh"}},radius:"md",children:[e.jsx(t.FocusTrap.InitialFocus,{}),e.jsxs(t.Box,{style:{display:"flex",height:"100%",...c==null?void 0:c.body},children:[e.jsx(t.Box,{style:{width:"240px",backgroundColor:"var(--mantine-color-gray-0)"},children:e.jsx(t.ScrollArea,{h:"100%",children:e.jsx(t.Stack,{gap:0,p:"sm",children:i.map(I=>e.jsx(t.Box,{mb:"md",children:e.jsxs(u.Fragment,{children:[e.jsx(t.Text,{size:"xs",fw:600,c:"dimmed",m:4,children:I}),o.filter(p=>p.group===I).map(p=>e.jsx(Je,{label:p.label,icon:p.icon,onClick:()=>d(p.id),isActive:l===p.id},p.id))]},I)}))})})}),e.jsxs(t.Box,{style:{flex:1,display:"flex",flexDirection:"column"},children:[x?e.jsxs(e.Fragment,{children:[e.jsx(t.Box,{p:"md",children:e.jsx(t.Group,{gap:"md",wrap:"nowrap",children:e.jsxs(t.Stack,{gap:4,children:[e.jsx(t.Text,{size:"md",fw:600,children:x.alternateLabel||x.label}),x.description&&e.jsx(t.Text,{size:"sm",c:"var(--mantine-color-gray-6)",children:x.description})]})})}),e.jsx(t.ScrollArea,{style:{flex:1},children:e.jsx(t.Box,{px:"md",children:x.content})})]}):e.jsx(t.Box,{style:{display:"flex",alignItems:"center",justifyContent:"center",height:"100%"},children:e.jsx(t.Text,{c:"var(--mantine-color-gray-6)",size:"lg",children:"Select an option from the sidebar"})}),(x==null?void 0:x.saveButton)&&e.jsx(t.Box,{p:"md",children:e.jsxs(t.Group,{justify:"flex-end",gap:"md",children:[e.jsx(t.Button,{variant:"subtle",onClick:h,color:"gray",children:"Cancel"}),e.jsx(t.Button,{onClick:f,color:"blue",children:"Save Changes"})]})})]})]})]})},Bo=(n,s="es")=>{const o=new Date,r=typeof n=="string"?new Date(n):n,a=Math.floor((o.getTime()-r.getTime())/1e3),i={es:{now:"ahora",seconds:"segundos",second:"segundo",minutes:"minutos",minute:"minuto",hours:"horas",hour:"hora",days:"días",day:"día",weeks:"semanas",week:"semana",months:"meses",month:"mes",years:"años",year:"año",ago:"hace"},en:{now:"now",seconds:"seconds",second:"second",minutes:"minutes",minute:"minute",hours:"hours",hour:"hour",days:"days",day:"day",weeks:"weeks",week:"week",months:"months",month:"month",years:"years",year:"year",ago:"ago"}},c=i[s]||i.en;if(a<5)return c.now;if(a<60)return s==="es"?`${c.ago} ${a} ${a===1?c.second:c.seconds}`:`${a} ${a===1?c.second:c.seconds} ${c.ago}`;const l=Math.floor(a/60);if(l<60)return s==="es"?`${c.ago} ${l} ${l===1?c.minute:c.minutes}`:`${l} ${l===1?c.minute:c.minutes} ${c.ago}`;const d=Math.floor(l/60);if(d<24)return s==="es"?`${c.ago} ${d} ${d===1?c.hour:c.hours}`:`${d} ${d===1?c.hour:c.hours} ${c.ago}`;const f=Math.floor(d/24);if(f<7)return s==="es"?`${c.ago} ${f} ${f===1?c.day:c.days}`:`${f} ${f===1?c.day:c.days} ${c.ago}`;const h=Math.floor(f/7);if(h<4)return s==="es"?`${c.ago} ${h} ${h===1?c.week:c.weeks}`:`${h} ${h===1?c.week:c.weeks} ${c.ago}`;const m=Math.floor(f/30);if(m<12)return s==="es"?`${c.ago} ${m} ${m===1?c.month:c.months}`:`${m} ${m===1?c.month:c.months} ${c.ago}`;const x=Math.floor(f/365);return s==="es"?`${c.ago} ${x} ${x===1?c.year:c.years}`:`${x} ${x===1?c.year:c.years} ${c.ago}`},To=(n,s="es")=>{const o=typeof n=="string"?new Date(n):n,r={es:["Ene","Feb","Mar","Abr","May","Jun","Jul","Ago","Sep","Oct","Nov","Dic"],en:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]},i=(r[s]||r.en)[o.getMonth()],c=o.getDate();return s==="es"?`${c} ${i}`:`${i} ${c}`},Oo=n=>{const s=typeof n=="string"?new Date(n):n,o=new Date;return s.toDateString()===o.toDateString()},zo=n=>{const s=typeof n=="string"?new Date(n):n,o=new Date;return o.setDate(o.getDate()-1),s.toDateString()===o.toDateString()},Ro=(n,s="es")=>Oo(n)?s==="es"?"Hoy":"Today":zo(n)?s==="es"?"Ayer":"Yesterday":Bo(n,s),Do=({notification:n,message:s,markAsRead:o,archiveNotification:r,children:a,actions:i})=>{var h,m,x,I,p;const c=new Date().getTime()-new Date(n.timestamp).getTime()<6048e5?Ro(n.timestamp,"en"):To(n.timestamp,"en"),[l,d]=u.useState(!1),f=e.jsxs(t.Group,{bg:"var(--mantine-color-gray-1)",p:4,style:{borderRadius:"var(--mantine-radius-md)"},w:"auto",wrap:"nowrap",gap:0,children:[!n.isRead&&e.jsx(ee,{onClick:()=>o(n.id),icon:T.IconCheck}),!n.isArchived&&e.jsx(ee,{onClick:()=>r(n.id),icon:T.IconArchive})]});return e.jsxs(t.Box,{p:"sm",bg:l?"var(--mantine-color-gray-0)":"white",style:{cursor:"pointer",borderTop:"1px solid var(--mantine-color-gray-2)"},onMouseEnter:()=>d(!0),onMouseLeave:()=>d(!1),children:[e.jsxs(t.Group,{justify:"space-between",align:"flex-start",gap:"sm",wrap:"nowrap",style:{margin:0},children:[(h=n.metadata)!=null&&h.avatar_url?e.jsx(t.Avatar,{name:(m=n.metadata)==null?void 0:m.fullname,size:"sm",radius:"md",src:(x=n.metadata)==null?void 0:x.avatar_url}):e.jsx(mt,{size:"xs",showText:!1,radius:"xs"}),e.jsxs(t.Stack,{gap:"xs",justify:"flex-start",w:"100%",children:[e.jsx(t.Box,{fz:"sm",m:0,style:{display:"-webkit-box",WebkitBoxOrient:"vertical",WebkitLineClamp:2,overflow:"hidden",textOverflow:"ellipsis",minHeight:"unset",height:"auto",whiteSpace:"normal",wordBreak:"break-word"},children:s}),e.jsxs(t.Text,{size:"xs",c:"dimmed",fw:500,style:{whiteSpace:"nowrap"},children:[n.category?((I=n.category)==null?void 0:I.charAt(0).toUpperCase())+((p=n.category)==null?void 0:p.slice(1)):""," ","• ",c]})]}),l?f:!n.isRead&&e.jsx(t.Indicator,{color:"var(--mantine-color-blue-6)",size:10,position:"top-end"})]}),a,i&&e.jsx(t.Group,{justify:"flex-start",align:"flex-start",gap:"xs",wrap:"nowrap",pl:36,pt:8,children:i})]})},Eo=(n,s,o,r,a)=>{const[i,c]=u.useState(!1),l=u.useRef(null),d=u.useRef(null),f=u.useRef(null);u.useEffect(()=>{c(n)},[n]);const h=u.useCallback(x=>{x[0].isIntersecting&&r&&!a&&o&&o()},[r,a,o]),m=u.useCallback(()=>{if(!(!l.current||!n||!s||!o)){d.current&&(d.current.disconnect(),d.current=null);try{const x=new IntersectionObserver(h,{threshold:.1,rootMargin:"50px"});x.observe(l.current),d.current=x}catch(x){console.error("Failed to setup intersection observer:",x)}}},[n,s,o,h]);return u.useEffect(()=>{if(f.current&&(clearTimeout(f.current),f.current=null),!n||!s||!o){d.current&&(d.current.disconnect(),d.current=null);return}if(!l.current){f.current=setTimeout(()=>m(),50);return}return m(),()=>{f.current&&(clearTimeout(f.current),f.current=null),d.current&&(d.current.disconnect(),d.current=null)}},[n,s,o,m]),u.useEffect(()=>()=>{f.current&&clearTimeout(f.current),d.current&&d.current.disconnect()},[]),{isActive:i,loadMoreRef:l}},Ao=({notifications:n,isLoading:s=!1,isLoadingMore:o=!1,hasMore:r=!1,unreadCount:a=0,markAllAsRead:i,archiveAllNotifications:c,markAsRead:l,archiveNotification:d,loadMore:f,onFilterChange:h,currentFilter:m="all",customRenderer:x,opened:I=!1,onOpen:p=()=>{},onClose:y=()=>{},enableInfiniteScroll:g=!0})=>{const b=[{children:"Mark all as read",leftSection:e.jsx(T.IconChecklist,{size:16}),onClick:()=>i()},{children:"Archive all",leftSection:e.jsx(T.IconArchive,{size:16}),onClick:()=>c()}],j=[{children:"All",leftSection:e.jsx(T.IconChecklist,{size:16}),onClick:()=>h==null?void 0:h("all"),active:m==="all"},{children:"Unread",leftSection:e.jsx(T.IconChecklist,{size:16}),onClick:()=>h==null?void 0:h("unread"),active:m==="unread"},{children:"Archived",leftSection:e.jsx(T.IconArchive,{size:16}),onClick:()=>h==null?void 0:h("archived"),active:m==="archived"}],C=k=>x&&k.category&&["welcome","upgrade"].includes(k.category)?x(k,l,d):e.jsx(Do,{notification:k,markAsRead:l,archiveNotification:d,message:k.message,actions:k.actions},k.id),{isActive:S,loadMoreRef:B}=Eo(I,g,f||(()=>{}),r,o);return e.jsxs(e.Fragment,{children:[e.jsx(Je,{isActive:S,icon:e.jsx(T.IconBell,{strokeWidth:2,size:24,color:"var(--mantine-color-gray-7)"}),onClick:()=>{I?y():p()},disabled:!1,variant:"subtle",color:"gray",fullWidth:!0,style:{borderRadius:"var(--mantine-radius-md)",cursor:"pointer"},label:"Inbox",indicator:a>0?a>99?"99+":a:void 0}),e.jsxs(t.Drawer,{opened:I,onClose:y,position:"left",size:400,style:{position:"relative",left:300,zIndex:0,borderLeft:"1px solid var(--mantine-color-gray-2)"},withCloseButton:!1,padding:0,withOverlay:!0,closeOnClickOutside:!0,closeOnEscape:!0,overlayProps:{backgroundOpacity:0,blur:0},children:[e.jsx(t.FocusTrap.InitialFocus,{}),e.jsxs(t.Box,{p:0,h:"100%",style:{display:"flex",flexDirection:"column"},children:[e.jsx(t.Box,{style:{position:"sticky",top:0,zIndex:10,backgroundColor:"var(--mantine-color-white)"},children:e.jsxs(t.Group,{justify:"space-between",align:"center",gap:"xs",style:{borderRadius:"var(--mantine-radius-md)"},px:"sm",py:"md",children:[e.jsx(t.Text,{size:"sm",fw:500,children:"Inbox"}),e.jsxs(t.Group,{gap:"xs",children:[e.jsx(ve,{position:"bottom-end",menuItems:j,trigger:e.jsx(ee,{icon:T.IconFilter})}),e.jsx(ve,{position:"bottom-end",menuItems:b,trigger:e.jsx(ee,{onClick:()=>{},icon:T.IconDots,changeIconOnHover:!0,iconHovered:T.IconDots})})]})]})}),e.jsxs(t.Box,{style:{flex:1,overflow:"auto"},children:[s&&n.length===0?e.jsx(t.Stack,{gap:0,w:"100%",h:"100%",justify:"center",align:"center",py:"xl",children:e.jsx(t.Loader,{})}):n.length>0?e.jsx(t.Stack,{gap:0,children:n.map(k=>C(k))}):e.jsxs(t.Stack,{gap:0,w:"100%",h:"100%",justify:"center",align:"center",py:"xl",children:[e.jsx(T.IconInbox,{size:24,color:"var(--mantine-color-gray-6)"}),e.jsx(t.Text,{size:"sm",fw:500,c:"dimmed",ta:"center",mt:"sm",children:"No new updates"})]}),e.jsx(t.Box,{ref:B,style:{padding:"16px",display:g?"flex":"none",justifyContent:"center",alignItems:"center",minHeight:"60px"},children:o&&e.jsxs(t.Group,{display:"flex",ta:"center",gap:"xs",children:[e.jsx(t.Loader,{size:"sm",color:"gray.5"}),e.jsx(t.Text,{size:"sm",c:"dimmed",fw:500,children:"Loading more ..."})]})}),o&&!g&&e.jsxs(t.Group,{display:"flex",ta:"center",gap:"xs",children:[e.jsx(t.Loader,{size:"sm",color:"gray.5"}),e.jsx(t.Text,{size:"sm",c:"dimmed",fw:500,children:"Loading more ..."})]}),!g&&r&&f&&e.jsx(t.Button,{color:"var(--mantine-color-gray-3)",variant:"subtle",onClick:f,loading:o,disabled:o,style:{alignSelf:"center"},children:o?"Loading...":"Load More"})]})]})]})]})},Ye=({header:n,body:s,footer:o,withBorder:r=!0,position:a="left",bg:i="var(--mantine-color-gray-0)"})=>{const[c,l]=u.useState(!1),d=()=>{if(!r)return{};const f="var(--mantine-color-gray-3)",h="1px";return a==="left"?{borderRight:`${h} solid ${f}`}:a==="right"?{borderLeft:`${h} solid ${f}`}:{}};return e.jsxs(t.Stack,{gap:"sm",h:"100%",p:"sm",bg:i,style:d(),onMouseEnter:()=>l(!0),onMouseLeave:()=>l(!1),children:[n&&e.jsx(t.Box,{children:typeof n=="function"?n({hovered:c}):n}),s&&e.jsx(t.Box,{style:{flex:1,minHeight:0,width:"100%",overflow:"hidden"},children:typeof s=="function"?s({hovered:c}):s}),o&&e.jsx(t.Box,{children:typeof o=="function"?o({hovered:c}):o})]})},Et=u.createContext(void 0),Lo=({children:n})=>{const[s,{open:o,close:r}]=ye.useDisclosure(!1),a={openedNotificationSidebar:s,openNotificationSidebar:o,closeNotificationSidebar:r};return e.jsx(Et.Provider,{value:a,children:n})},Fo=()=>{const n=u.useContext(Et);if(n===void 0)throw new Error("useNavbar must be used within an NavbarProvider");return n},At=({workspace:n,currentUserId:s,currentWorkspaceId:o,onClick:r})=>{const a=o===n.id,i=s&&n.ownerId===s;return e.jsxs(t.Box,{onClick:r,style:{display:"flex",alignItems:"center",padding:"6px",borderRadius:"var(--mantine-radius-md)",cursor:"pointer",gap:"8px",width:"100%",boxSizing:"border-box"},onMouseEnter:c=>{c.currentTarget.style.backgroundColor="var(--mantine-color-gray-0)"},onMouseLeave:c=>{c.currentTarget.style.backgroundColor="transparent"},children:[e.jsx(se,{size:"xs",avatar:typeof n.avatar=="string"?{type:"image",value:n.avatar}:n.avatar,placeholder:n.name,showPlaceholder:!0,style:{flexShrink:0}}),e.jsx(t.Text,{size:"sm",fw:500,c:"gray.9",truncate:!0,style:{flex:1,minWidth:0},children:n.name}),e.jsxs(t.Box,{style:{display:"flex",alignItems:"center",gap:"4px",flexShrink:0,paddingLeft:"8px"},children:[a&&e.jsx(T.IconCheck,{size:16,color:"var(--mantine-color-blue-6)"}),i&&e.jsx(t.Badge,{size:"xs",variant:"light",color:"yellow",radius:"sm",children:"Owner"})]})]})},No="workspace-selector-module__menuItem___FSB6P",Uo="workspace-selector-module__workspaceButton___-P6kp",Wo="workspace-selector-module__workspaceText___YDAlj",Ho="workspace-selector-module__scrollWrapper___MzrJY",Ve={menuItem:No,workspaceButton:Uo,workspaceText:Wo,scrollWrapper:Ho},$o=({workspaces:n=[],currentWorkspace:s,currentUserId:o,isLoading:r=!1,error:a=null,onWorkspaceSelect:i,onCreateWorkspace:c,emptyMessage:l="No workspaces found",loadingMessage:d="Loading workspaces...",errorMessage:f="Failed to load workspaces",className:h,onCloseSidebar:m,sidebarHovered:x=!1,children:I,menuItems:p})=>{const[y,g]=u.useState(!1),[b,j]=u.useState(""),C=u.useMemo(()=>b?n.filter(w=>{var v;return w.name.toLowerCase().includes(b.toLowerCase())||((v=w.ownerEmail)==null?void 0:v.toLowerCase().includes(b.toLowerCase()))}):n,[n,b]),S=w=>{i==null||i(w.id),g(!1),j("")};if(r)return e.jsxs(t.Group,{gap:"xs",children:[e.jsx(t.Loader,{size:"sm"}),e.jsx(t.Text,{size:"sm",c:"dimmed",children:d})]});if(a)return e.jsx(t.Alert,{color:"red",title:"Error",children:f});const[B,k]=u.useState(x);return n.length===0&&!r&&!a?e.jsx(t.Box,{children:e.jsx(t.Text,{size:"sm",c:"dimmed",children:l})}):e.jsxs(t.Menu,{opened:y,onOpen:()=>g(!0),onClose:()=>g(!1),position:"bottom-start",styles:{dropdown:{width:"350px",overflow:"hidden"}},withinPortal:!0,children:[e.jsx(t.Menu.Target,{children:e.jsx(t.Box,{w:"100%",onClick:()=>g(!y),style:{padding:"6px",display:"flex",alignItems:"center",borderRadius:"var(--mantine-radius-md)",cursor:"pointer"},className:`${Ve.workspaceButton} ${h||""}`,bg:B||y?"var(--mantine-color-gray-1)":"transparent",onMouseEnter:()=>k(!0),onMouseLeave:()=>k(!1),children:e.jsx(t.Group,{gap:"xs",wrap:"nowrap",style:{width:"100%",overflow:"hidden"},children:s?e.jsxs(e.Fragment,{children:[e.jsx(se,{size:"xs",avatar:typeof s.avatar=="string"?{type:"image",value:s.avatar}:s.avatar,placeholder:s.name,showPlaceholder:!0,style:{flexShrink:0}}),e.jsx(t.Text,{size:"sm",fw:550,c:"var(--mantine-color-gray-9)",truncate:!0,style:{flex:1,minWidth:0},children:s.name}),e.jsxs(t.Group,{gap:4,wrap:"nowrap",style:{flexShrink:0},children:[e.jsx(fe,{icon:T.IconChevronDown,size:"md",onClick:()=>g(!y),grayScaleBaseColor:B?1:0}),(B||x)&&e.jsx(fe,{icon:T.IconChevronsLeft,size:"md",onClick:()=>{m==null||m()},grayScaleBaseColor:B?1:0})]})]}):e.jsx(t.Text,{size:"sm",c:"dimmed",children:"Select workspace"})})})}),e.jsx(t.Menu.Dropdown,{style:{borderRadius:"var(--mantine-radius-md)",boxShadow:"var(--mantine-shadow-md)"},p:0,children:e.jsxs(t.Stack,{gap:0,children:[I,e.jsx(t.Menu.Divider,{style:{margin:"1px 0px"}}),e.jsx(t.Stack,{gap:0,px:4,children:C.length===0?e.jsx(t.Menu.Item,{disabled:!0,children:e.jsx(t.Text,{size:"sm",c:"dimmed",children:l})}):e.jsxs(e.Fragment,{children:[e.jsxs(t.Group,{justify:"space-between",align:"center",p:4,children:[e.jsx(t.Text,{size:"xs",c:"dimmed",fw:500,p:4,truncate:!0,children:"Workspaces"}),c&&e.jsx(t.Anchor,{onClick:()=>{c(),g(!1)},size:"xs",underline:"never",fw:500,p:4,truncate:!0,style:{display:"flex",alignItems:"center",gap:"4px"},children:"Add"})]}),e.jsx("div",{className:Ve.scrollWrapper,children:e.jsx(t.ScrollArea,{mah:150,scrollbarSize:6,scrollHideDelay:0,children:e.jsx(t.Stack,{gap:0,mb:6,children:C.map(w=>e.jsx(t.Box,{onClick:()=>S(w),className:Ve.menuItem,style:{padding:0,borderRadius:"var(--mantine-radius-md)",cursor:"pointer",overflow:"hidden"},onMouseEnter:v=>{v.currentTarget.style.backgroundColor="var(--mantine-color-gray-1)"},onMouseLeave:v=>{v.currentTarget.style.backgroundColor="transparent"},children:e.jsx(At,{workspace:w,currentUserId:o,currentWorkspaceId:s==null?void 0:s.id,onClick:()=>S(w)})},w.id))})})})]})}),p&&e.jsx(t.Menu.Divider,{style:{margin:"1px 0px"}}),p&&e.jsx(t.Box,{p:4,children:p==null?void 0:p.map(w=>e.jsx(t.MenuItem,{onClick:w.onClick,leftSection:w.icon,children:w.label,color:w.color,"data-danger":w.color,fw:500,style:{height:"40px",borderRadius:"var(--mantine-radius-md)",padding:"6px"}},w.label))})]})})]})},Lt=({children:n,style:s,...o})=>e.jsx(t.Box,{style:{backgroundColor:"var(--mantine-color-gray-1)",borderRadius:"var(--mantine-radius-md)",minHeight:"20vh",width:"100%",flex:"1 1 0%",minWidth:0,maxWidth:"none",boxSizing:"border-box",display:"flex",alignItems:"center",justifyContent:"center",...s},...o,children:n});Lt.displayName="MatrixCenter";const Ft=({children:n,style:s,size:o="50px",state:r="empty",onStateChange:a,interactive:i=!0,...c})=>{const[l,d]=u.useState(r),[f,h]=u.useState(!1),m=a?r:i?l:r,x=()=>{if(!i)return;const y=["empty","outline","filled"],b=(y.indexOf(m)+1)%y.length,j=y[b];a?a(j):d(j)},I=()=>{switch(m){case"empty":return null;case"outline":return e.jsx(T.IconPoint,{size:16,color:"var(--mantine-color-gray-8)",stroke:2.5});case"filled":return e.jsx(T.IconPointFilled,{size:16,color:"var(--mantine-color-gray-8)",stroke:2.5});default:return null}},p=()=>{switch(m){case"empty":return"var(--mantine-color-gray-2)";case"outline":return"var(--mantine-color-blue-0)";case"filled":return"var(--mantine-color-green-0)";default:return"var(--mantine-color-gray-2)"}};return e.jsx(t.Box,{style:{width:o,height:o,backgroundColor:p(),borderRadius:"var(--mantine-radius-md)",display:"flex",alignItems:"center",justifyContent:"center",cursor:i?"pointer":"default",transition:"all 0.2s ease",boxShadow:f&&i?"0 2px 8px rgba(0, 0, 0, 0.15)":"none",transform:f&&i?"translateY(-1px)":"translateY(0)",border:m==="outline"?"2px solid var(--mantine-color-gray-0)":"2px solid transparent",...s},onClick:x,onMouseEnter:()=>h(!0),onMouseLeave:()=>h(!1),...c,children:n||I()})};Ft.displayName="MatrixCell";const Nt=({children:n,style:s,size:o="50px",blockId:r,isVisible:a=!0,isDimmed:i=!1,shouldShowBlueBorder:c=!1,onBlockClick:l,onBlockPress:d,...f})=>{const[h,m]=u.useState(!1),x=u.useRef(null),I=u.useRef(!1),p=()=>{!r||!d||(m(!0),I.current=!1,x.current=setTimeout(()=>{I.current=!0,d(r)},500))},y=()=>{r&&(m(!1),x.current&&(clearTimeout(x.current),x.current=null),!I.current&&l&&l(r),I.current=!1)},g=()=>{m(!1),x.current&&(clearTimeout(x.current),x.current=null),I.current=!1};return e.jsx(t.Box,{style:{width:o,height:"100%",minWidth:o,minHeight:o,backgroundColor:"var(--mantine-color-gray-1)",borderRadius:"var(--mantine-radius-md)",overflow:"hidden",display:"flex",alignItems:"stretch",justifyContent:"stretch",border:c?"2px solid var(--mantine-color-blue-5)":"2px solid transparent",opacity:h?.8:i?.3:1,transition:"all 0.2s ease",cursor:r?"pointer":"default",...s},onMouseDown:p,onMouseUp:y,onMouseLeave:g,...f,children:n})};Nt.displayName="MatrixBlockLeft";const Ut=({children:n,style:s,size:o="50px",blockId:r,isVisible:a=!0,isDimmed:i=!1,shouldShowBlueBorder:c=!1,onBlockClick:l,onBlockPress:d,...f})=>{const[h,m]=u.useState(!1),x=u.useRef(null),I=u.useRef(!1),p=()=>{!r||!d||(m(!0),I.current=!1,x.current=setTimeout(()=>{I.current=!0,d(r)},500))},y=()=>{r&&(m(!1),x.current&&(clearTimeout(x.current),x.current=null),!I.current&&l&&l(r),I.current=!1)},g=()=>{m(!1),x.current&&(clearTimeout(x.current),x.current=null),I.current=!1};return e.jsx(t.Box,{style:{width:o,height:"100%",minWidth:o,minHeight:o,backgroundColor:"var(--mantine-color-gray-1)",borderRadius:"var(--mantine-radius-md)",overflow:"hidden",display:"flex",alignItems:"stretch",justifyContent:"stretch",border:c?"2px solid var(--mantine-color-blue-5)":"2px solid transparent",opacity:h?.8:i?.3:1,transition:"all 0.2s ease",cursor:r?"pointer":"default",...s},onMouseDown:p,onMouseUp:y,onMouseLeave:g,...f,children:n})};Ut.displayName="MatrixBlockRight";const Wt=({children:n,style:s,size:o="50px",blockId:r,isVisible:a=!0,isDimmed:i=!1,shouldShowBlueBorder:c=!1,onBlockClick:l,onBlockPress:d,...f})=>{const[h,m]=u.useState(!1),x=u.useRef(null),I=u.useRef(!1),p=()=>{!r||!d||(m(!0),I.current=!1,x.current=setTimeout(()=>{I.current=!0,d(r)},500))},y=()=>{r&&(m(!1),x.current&&(clearTimeout(x.current),x.current=null),!I.current&&l&&l(r),I.current=!1)},g=()=>{m(!1),x.current&&(clearTimeout(x.current),x.current=null),I.current=!1};return e.jsx(t.Box,{style:{width:"100%",height:o,minWidth:o,minHeight:o,backgroundColor:"var(--mantine-color-gray-1)",borderRadius:"var(--mantine-radius-md)",overflow:"hidden",display:"flex",alignItems:"stretch",justifyContent:"stretch",border:c?"2px solid var(--mantine-color-blue-5)":"2px solid transparent",opacity:h?.8:i?.3:1,transition:"all 0.2s ease",cursor:r?"pointer":"default",...s},onMouseDown:p,onMouseUp:y,onMouseLeave:g,...f,children:n})};Wt.displayName="MatrixBlockUp";const Ht=({children:n,style:s,size:o="50px",blockId:r,isVisible:a=!0,isDimmed:i=!1,shouldShowBlueBorder:c=!1,onBlockClick:l,onBlockPress:d,...f})=>{const[h,m]=u.useState(!1),x=u.useRef(null),I=u.useRef(!1),p=()=>{!r||!d||(m(!0),I.current=!1,x.current=setTimeout(()=>{I.current=!0,d(r)},500))},y=()=>{r&&(m(!1),x.current&&(clearTimeout(x.current),x.current=null),!I.current&&l&&l(r),I.current=!1)},g=()=>{m(!1),x.current&&(clearTimeout(x.current),x.current=null),I.current=!1};return e.jsx(t.Box,{style:{width:"100%",height:o,minWidth:o,minHeight:o,backgroundColor:"var(--mantine-color-gray-1)",borderRadius:"var(--mantine-radius-md)",overflow:"hidden",display:"flex",alignItems:"stretch",justifyContent:"stretch",border:c?"2px solid var(--mantine-color-blue-5)":"2px solid transparent",opacity:h?.8:i?.3:1,transition:"all 0.2s ease",cursor:r?"pointer":"default",...s},onMouseDown:p,onMouseUp:y,onMouseLeave:g,...f,children:n})};Ht.displayName="MatrixBlockDown";const $t=({onLeftHover:n,onRightHover:s,onUpHover:o,onDownHover:r,showLeftControls:a=!1,showRightControls:i=!1,showUpControls:c=!1,showDownControls:l=!1})=>{const[d,f]=u.useState(!1),[h,m]=u.useState(!1),[x,I]=u.useState(!1),[p,y]=u.useState(!1),g=S=>{f(S),n==null||n(S)},b=S=>{m(S),s==null||s(S)},j=S=>{I(S),o==null||o(S)},C=S=>{y(S),r==null||r(S)};return e.jsxs(e.Fragment,{children:[a&&e.jsx(t.Box,{style:{position:"absolute",left:0,top:0,bottom:0,width:"80px",zIndex:5,pointerEvents:"auto",background:"transparent"},onMouseEnter:()=>g(!0),onMouseLeave:()=>g(!1)}),i&&e.jsx(t.Box,{style:{position:"absolute",right:0,top:0,bottom:0,width:"80px",zIndex:5,pointerEvents:"auto",background:"transparent"},onMouseEnter:()=>b(!0),onMouseLeave:()=>b(!1)}),c&&e.jsx(t.Box,{style:{position:"absolute",top:0,left:0,right:0,height:"80px",zIndex:5,pointerEvents:"auto",background:"transparent"},onMouseEnter:()=>j(!0),onMouseLeave:()=>j(!1)}),l&&e.jsx(t.Box,{style:{position:"absolute",bottom:0,left:0,right:0,height:"80px",zIndex:5,pointerEvents:"auto",background:"transparent"},onMouseEnter:()=>C(!0),onMouseLeave:()=>C(!1)})]})};$t.displayName="HoverZones";const Pt=({onLeftPrevious:n,onLeftNext:s,leftCurrentPage:o=1,leftTotalPages:r=1,leftDisabled:a=!1,leftVisible:i=!1,onLeftHover:c,onRightPrevious:l,onRightNext:d,rightCurrentPage:f=1,rightTotalPages:h=1,rightDisabled:m=!1,rightVisible:x=!1,onRightHover:I,onUpPrevious:p,onUpNext:y,upCurrentPage:g=1,upTotalPages:b=1,upDisabled:j=!1,upVisible:C=!1,onUpHover:S,onDownPrevious:B,onDownNext:k,downCurrentPage:w=1,downTotalPages:v=1,downDisabled:O=!1,downVisible:M=!1,onDownHover:z,onLeftAdd:E,onRightAdd:W,onUpAdd:P,onDownAdd:H,size:L="md",inline:_=!1})=>{const N=()=>r<=1||a?null:e.jsxs(t.Stack,{gap:"xs",align:"center",children:[e.jsx(t.ActionIcon,{size:L,variant:"subtle",onClick:()=>n==null?void 0:n(),disabled:o<=1,color:"gray",radius:"md","aria-label":"Previous left blocks",children:e.jsx(T.IconChevronRight,{size:16,stroke:2})}),e.jsx(t.ActionIcon,{size:L,variant:"subtle",onClick:E,color:"blue",radius:"md","aria-label":"Add left blocks",children:e.jsx(T.IconPlus,{size:16,stroke:2})}),e.jsx(t.ActionIcon,{size:L,variant:"subtle",onClick:s,disabled:o>=r,color:"gray",radius:"md","aria-label":"Next left blocks",children:e.jsx(T.IconChevronLeft,{size:16,stroke:2})})]}),Z=()=>h<=1||m?null:e.jsxs(t.Stack,{gap:"xs",align:"center",children:[e.jsx(t.ActionIcon,{size:L,variant:"subtle",onClick:l,disabled:f<=1,color:"gray",radius:"md","aria-label":"Previous right blocks",children:e.jsx(T.IconChevronLeft,{size:16,stroke:2})}),e.jsx(t.ActionIcon,{size:L,variant:"subtle",onClick:W,color:"blue",radius:"md","aria-label":"Add right blocks",children:e.jsx(T.IconPlus,{size:16,stroke:2})}),e.jsx(t.ActionIcon,{size:L,variant:"subtle",onClick:d,disabled:f>=h,color:"gray",radius:"md","aria-label":"Next right blocks",children:e.jsx(T.IconChevronRight,{size:16,stroke:2})})]}),F=()=>b<=1||j?null:e.jsxs(t.Group,{gap:"xs",align:"center",wrap:"nowrap",children:[e.jsx(t.ActionIcon,{size:L,variant:"subtle",onClick:p,disabled:g<=1,color:"gray",radius:"md","aria-label":"Previous up blocks",children:e.jsx(T.IconChevronDown,{size:16,stroke:2})}),e.jsx(t.ActionIcon,{size:L,variant:"subtle",onClick:P,color:"blue",radius:"md","aria-label":"Add up blocks",children:e.jsx(T.IconPlus,{size:16,stroke:2})}),e.jsx(t.ActionIcon,{size:L,variant:"subtle",onClick:y,disabled:g>=b,color:"gray",radius:"md","aria-label":"Next up blocks",children:e.jsx(T.IconChevronUp,{size:16,stroke:2})})]}),G=()=>v<=1||O?null:e.jsxs(t.Group,{gap:"xs",align:"center",wrap:"nowrap",children:[e.jsx(t.ActionIcon,{size:L,variant:"subtle",onClick:B,disabled:w<=1,color:"gray",radius:"md","aria-label":"Previous down blocks",children:e.jsx(T.IconChevronDown,{size:16,stroke:2})}),e.jsx(t.ActionIcon,{size:L,variant:"subtle",onClick:H,color:"blue",radius:"md","aria-label":"Add down blocks",children:e.jsx(T.IconPlus,{size:16,stroke:2})}),e.jsx(t.ActionIcon,{size:L,variant:"subtle",onClick:k,disabled:w>=v,color:"gray",radius:"md","aria-label":"Next down blocks",children:e.jsx(T.IconChevronUp,{size:16,stroke:2})})]}),R=r>1&&!a,D=h>1&&!m,A=b>1&&!j,U=v>1&&!O;return!R&&!D&&!A&&!U?null:_?e.jsxs(e.Fragment,{children:[R&&i&&n&&s&&e.jsx("div",{onMouseEnter:()=>c==null?void 0:c(!0),onMouseLeave:()=>c==null?void 0:c(!1),children:N()}),D&&x&&l&&d&&e.jsx("div",{onMouseEnter:()=>I==null?void 0:I(!0),onMouseLeave:()=>I==null?void 0:I(!1),children:Z()}),A&&C&&p&&y&&e.jsx("div",{onMouseEnter:()=>S==null?void 0:S(!0),onMouseLeave:()=>S==null?void 0:S(!1),children:F()}),U&&M&&B&&k&&e.jsx("div",{onMouseEnter:()=>z==null?void 0:z(!0),onMouseLeave:()=>z==null?void 0:z(!1),children:G()})]}):e.jsxs(e.Fragment,{children:[R&&i&&n&&s&&e.jsx(t.Box,{style:{position:"absolute",left:"20px",top:"50%",transform:"translateY(-50%)",zIndex:10,pointerEvents:"auto",opacity:i?1:0,transition:"opacity 0.2s ease"},onMouseEnter:()=>c==null?void 0:c(!0),onMouseLeave:()=>c==null?void 0:c(!1),children:N()}),D&&x&&l&&d&&e.jsx(t.Box,{style:{position:"absolute",right:"20px",top:"50%",transform:"translateY(-50%)",zIndex:10,pointerEvents:"auto",opacity:x?1:0,transition:"opacity 0.2s ease"},onMouseEnter:()=>I==null?void 0:I(!0),onMouseLeave:()=>I==null?void 0:I(!1),children:Z()}),A&&C&&p&&y&&e.jsx(t.Box,{style:{position:"absolute",top:"20px",left:"50%",transform:"translateX(-50%)",zIndex:10,pointerEvents:"auto",opacity:C?1:0,transition:"opacity 0.2s ease"},onMouseEnter:()=>S==null?void 0:S(!0),onMouseLeave:()=>S==null?void 0:S(!1),children:F()}),e.jsx(t.Box,{style:{position:"absolute",bottom:"20px",left:"50%",transform:"translateX(-50%)",zIndex:10,pointerEvents:"auto",opacity:M?1:0,transition:"opacity 0.2s ease"},onMouseEnter:()=>z==null?void 0:z(!0),onMouseLeave:()=>z==null?void 0:z(!1),children:U&&M&&B&&k&&G()})]})};Pt.displayName="NavigationControls";const Me=({direction:n,text:s,show:o,actions:r,currentPage:a,totalPages:i,disabled:c,hoverState:l,onHover:d})=>{if(!s)return null;const f={left:{position:"absolute",left:"20px",top:"50%",transform:"translateY(-50%)"},right:{position:"absolute",right:"20px",top:"50%",transform:"translateY(-50%)"},up:{position:"absolute",top:"20px",left:"50%",transform:"translateX(-50%)"},down:{position:"absolute",bottom:"20px",left:"50%",transform:"translateX(-50%)"}},h={left:{onLeftPrevious:r.prev,onLeftNext:r.next,leftCurrentPage:a,leftTotalPages:i,leftDisabled:c,leftVisible:!0},right:{onRightPrevious:r.prev,onRightNext:r.next,rightCurrentPage:a,rightTotalPages:i,rightDisabled:c,rightVisible:!0},up:{onUpPrevious:r.prev,onUpNext:r.next,upCurrentPage:a,upTotalPages:i,upDisabled:c,upVisible:!0},down:{onDownPrevious:r.prev,onDownNext:r.next,downCurrentPage:a,downTotalPages:i,downDisabled:c,downVisible:!0}};return e.jsxs("div",{style:{...f[n],zIndex:10,display:"flex",alignItems:"center",justifyContent:"center",width:"80px",height:"60px"},children:[e.jsx("div",{style:{color:"var(--mantine-color-gray-6)",fontSize:"14px",fontWeight:"500",opacity:l?0:1,transition:"opacity 0.2s ease",position:"absolute"},children:s}),o&&e.jsx("div",{style:{opacity:l?1:0,transition:"opacity 0.2s ease",position:"absolute"},onMouseEnter:()=>d(!0),onMouseLeave:()=>d(!1),children:e.jsx(Pt,{...h[n],size:"sm",showLabels:!0,inline:!0})})]})},Po=n=>{const{totalBlocksLeft:s=0,totalBlocksRight:o=0,totalBlocksUp:r=0,totalBlocksDown:a=0,visibleBlocksLeft:i=1,visibleBlocksRight:c=1,visibleBlocksUp:l=1,visibleBlocksDown:d=1}=n,f=u.useMemo(()=>{const p=Math.max(1,Math.ceil(s/i)),y=Math.max(1,Math.ceil(o/c)),g=Math.max(1,Math.ceil(r/l)),b=Math.max(1,Math.ceil(a/d));return{leftTotalPages:p,rightTotalPages:y,upTotalPages:g,downTotalPages:b,leftStartIndex:0,leftEndIndex:0,rightStartIndex:0,rightEndIndex:0,upStartIndex:0,upEndIndex:0,downStartIndex:0,downEndIndex:0}},[s,o,r,a,i,c,l,d]),[h,m]=u.useState({leftStartIndex:0,rightStartIndex:0,upStartIndex:0,downStartIndex:0}),x=u.useMemo(()=>{const{leftTotalPages:p,rightTotalPages:y,upTotalPages:g,downTotalPages:b}=f,j=Math.min(h.leftStartIndex,Math.max(0,s-i)),C=Math.min(j+i,s),S=Math.min(h.rightStartIndex,Math.max(0,o-c)),B=Math.min(S+c,o),k=Math.min(h.upStartIndex,Math.max(0,r-l)),w=Math.min(k+l,r),v=Math.min(h.downStartIndex,Math.max(0,a-d)),O=Math.min(v+d,a);return{leftTotalPages:p,rightTotalPages:y,upTotalPages:g,downTotalPages:b,leftStartIndex:j,leftEndIndex:C,rightStartIndex:S,rightEndIndex:B,upStartIndex:k,upEndIndex:w,downStartIndex:v,downEndIndex:O}},[h,f,i,c,l,d,s,o,r,a]),I={goToLeftPage:u.useCallback(p=>{const y=Math.max(0,(p-1)*i);m(g=>({...g,leftStartIndex:Math.min(y,Math.max(0,s-i))}))},[i,s]),goToRightPage:u.useCallback(p=>{const y=Math.max(0,(p-1)*c);m(g=>({...g,rightStartIndex:Math.min(y,Math.max(0,o-c))}))},[c,o]),goToUpPage:u.useCallback(p=>{const y=Math.max(0,(p-1)*l);m(g=>({...g,upStartIndex:Math.min(y,Math.max(0,r-l))}))},[l,r]),goToDownPage:u.useCallback(p=>{const y=Math.max(0,(p-1)*d);m(g=>({...g,downStartIndex:Math.min(y,Math.max(0,a-d))}))},[d,a]),nextLeftPage:u.useCallback(()=>{m(p=>({...p,leftStartIndex:Math.min(p.leftStartIndex+1,Math.max(0,s-i))}))},[s,i]),previousLeftPage:u.useCallback(()=>{m(p=>({...p,leftStartIndex:Math.max(p.leftStartIndex-1,0)}))},[]),nextRightPage:u.useCallback(()=>{m(p=>({...p,rightStartIndex:Math.min(p.rightStartIndex+1,Math.max(0,o-c))}))},[o,c]),previousRightPage:u.useCallback(()=>{m(p=>({...p,rightStartIndex:Math.max(p.rightStartIndex-1,0)}))},[]),nextUpPage:u.useCallback(()=>{m(p=>({...p,upStartIndex:Math.min(p.upStartIndex+1,Math.max(0,r-l))}))},[r,l]),previousUpPage:u.useCallback(()=>{m(p=>({...p,upStartIndex:Math.max(p.upStartIndex-1,0)}))},[]),nextDownPage:u.useCallback(()=>{m(p=>({...p,downStartIndex:Math.min(p.downStartIndex+1,Math.max(0,a-d))}))},[a,d]),previousDownPage:u.useCallback(()=>{m(p=>({...p,downStartIndex:Math.max(p.downStartIndex-1,0)}))},[])};return[h,I,x]},Go=(n,s=0,o=0,r=0,a=0)=>{const[i,c]=u.useState({width:typeof window<"u"?window.innerWidth:1920,height:typeof window<"u"?window.innerHeight:1080});return u.useEffect(()=>{if(typeof window>"u")return;const d=()=>{c({width:window.innerWidth,height:window.innerHeight})};return window.addEventListener("resize",d),()=>window.removeEventListener("resize",d)},[]),u.useMemo(()=>{const{gap:d,cellSize:f,minBlocksPerSide:h=2,maxBlocksPerSide:m=15,minBlocksLeft:x=1,maxBlocksLeft:I=8,minBlocksRight:p=1,maxBlocksRight:y=8,minBlocksUp:g=1,maxBlocksUp:b=8,minBlocksDown:j=1,maxBlocksDown:C=8,responsiveCellSize:S=!1,minCellSize:B="30px",maxCellSize:k="80px"}=n,w=parseFloat(d.replace("px","")),v=parseFloat(f.replace("px","")),O=i.width-w*4,M=i.height-w*4,z=v+w,E=Math.floor(O/(2*z)),W=v+w,P=Math.floor(M/W)+2,H=Math.min(E,P),L=Math.max(h,Math.min(m,H)),_=Math.max(x,Math.min(I,Math.floor(H/2))),N=Math.max(p,Math.min(y,Math.floor(H/2)));let Z=f;if(S){const A=parseFloat(B.replace("px","")),U=parseFloat(k.replace("px","")),V=Math.min(O/(i.width*.8),M/(i.height*.8));Z=`${Math.max(A,Math.min(U,v*V))}px`}const F=Math.min(i.width/1920,i.height/1080);let G,R;if(r>0&&a>0){const A=Math.max(r,a);G=Math.max(g,Math.min(b,A)),R=G}else{const A=Math.max(g,j),U=Math.min(b,C),V=Math.max(A,Math.min(U,Math.ceil(A+(U-A)*F)));G=V,R=V}if(G+R+1>P){const A=Math.max(2,P-1);if(Math.max(g,j)*2>A){const V=Math.max(1,Math.floor(A/2));G=V,R=V}else{const V=Math.max(g,j);G=V,R=V}}return console.log("Responsive Matrix Debug:",{windowSize:i,screenSizeRatio:F,minBlocksUp:g,minBlocksDown:j,maxBlocksUp:b,maxBlocksDown:C,blocksUp:r,blocksDown:a,calculatedBlocksUp:G,calculatedBlocksDown:R,totalVerticalBlocks:G+R+1,isSymmetric:G===R,availableHeight:M,maxBlocksVertical:P}),{blocksPerSide:L,blocksLeft:_,blocksRight:N,cellSize:Z,blocksUp:G,blocksDown:R}},[i,n,s,o,r,a])},_o=({gap:n,cellSize:s,blocksLeft:o,blocksRight:r,blocksUp:a,blocksDown:i,totalBlocksLeft:c,totalBlocksRight:l,totalBlocksUp:d,totalBlocksDown:f,responsive:h,minBlocksPerSide:m,maxBlocksPerSide:x,minBlocksLeft:I,maxBlocksLeft:p,minBlocksRight:y,maxBlocksRight:g,minBlocksUp:b,maxBlocksUp:j,minBlocksDown:C,maxBlocksDown:S,responsiveCellSize:B,minCellSize:k,maxCellSize:w})=>{const v=u.useMemo(()=>c!==void 0||l!==void 0||d!==void 0||f!==void 0,[c,l,d,f]),O=Go({gap:n,cellSize:s,minBlocksPerSide:m,maxBlocksPerSide:x,minBlocksLeft:I,maxBlocksLeft:p,minBlocksRight:y,maxBlocksRight:g,minBlocksUp:b,maxBlocksUp:j,minBlocksDown:C,maxBlocksDown:S,responsiveCellSize:B,minCellSize:k,maxCellSize:w},o??0,r??0,a,i),M=u.useMemo(()=>{let P=h?O.blocksLeft:o??0,H=h?O.blocksRight:r??0,L=h?O.blocksUp:a??0,_=h?O.blocksDown:i??0;if(!h){const N=parseFloat(n.replace("px","")),Z=parseFloat(s.replace("px","")),F=typeof window<"u"?window.innerWidth-N*4:1920,G=typeof window<"u"?window.innerHeight-N*4:1080,R=Z+N,D=Math.floor(F/(2*R)),A=Math.floor(G/(2*R));P=Math.min(P,D),H=Math.min(H,D),L=Math.min(L,A),_=Math.min(_,A)}return{left:P,right:H,up:L,down:_}},[h,O,o,r,a,i,n,s]),z=u.useMemo(()=>{const P=v&&c?Math.min(M.left,c):M.left,H=v&&l?Math.min(M.right,l):M.right,L=v&&d?Math.min(M.up,d):M.up,_=v&&f?Math.min(M.down,f):M.down;return{left:P,right:H,up:L,down:_}},[v,M,c,l,d,f]),E=h?O.cellSize:s,W=u.useMemo(()=>{const P=(z.left>0?z.left:0)+1+(z.right>0?z.right:0),H=z.up>0||z.down>0?z.up+1+z.down:1,L=`${E} `.repeat(z.left)+"1fr "+`${E} `.repeat(z.right),_=z.up>0||z.down>0?`${E} `.repeat(z.up)+"1fr "+`${E} `.repeat(z.down):"1fr";return{totalColumns:P,totalRows:H,gridTemplateColumns:L.trim(),gridTemplateRows:_.trim()}},[z,E]);return{usePagination:v,visibleBlocks:M,finalBlocks:z,finalCellSize:E,gridDimensions:W}},Vo=({blockItems:n})=>{const s=u.useMemo(()=>n.reduce((a,i)=>(a[i.id]=i,a),{}),[n]);return{getBlockContent:(a,i)=>{const c=`${a}-${i}`,l=s[c];return l?l.content:u.createElement("div",{style:{padding:"4px",textAlign:"center",fontSize:"10px",writingMode:a==="left"||a==="right"?"vertical-rl":"horizontal-tb",textOrientation:"mixed",width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center",overflow:"hidden"}})},getIntersectionText:(a,i,c,l)=>{const d=[];if(a!==null){const f=s[`left-${a}`];d.push(f?`left-${a}`:`left${a+1}`)}if(i!==null){const f=s[`right-${i}`];d.push(f?`right-${i}`:`right${i+1}`)}if(c!==null){const f=s[`up-${c}`];d.push(f?`up-${c}`:`up${c+1}`)}if(l!==null){const f=s[`down-${l}`];d.push(f?`down-${l}`:`down${l+1}`)}return d.join(", ")}}},Qo=({blockConnections:n})=>{const s=u.useMemo(()=>{const r=new Map;return n.forEach(a=>{const i=`${a.source}-${a.target}`,c=`${a.target}-${a.source}`;r.set(i,a),r.set(c,a)}),r},[n]);return{getConnectionStateFromText:r=>{const a=r.split(", ").map(i=>i.trim());for(let i=0;i<a.length;i++)for(let c=i+1;c<a.length;c++){const l=a[i],d=a[c],f=`${l}-${d}`,h=s.get(f);if(h)return h.type}return"empty"}}},Yo=({usePagination:n,totalBlocksLeft:s,totalBlocksRight:o,totalBlocksUp:r,totalBlocksDown:a,paginationActions:i,paginationState:c,paginationInfo:l})=>{const[d,f]=u.useState({left:!1,right:!1,up:!1,down:!1}),h=(x,I)=>{f(p=>({...p,[x]:I}))};return{hoverStates:d,handleHover:h,getNavigationControlProps:x=>{const I={left:s,right:o,up:r,down:a}[x],p={left:{prev:i.previousLeftPage,next:i.nextLeftPage},right:{prev:i.previousRightPage,next:i.nextRightPage},up:{prev:i.previousUpPage,next:i.nextUpPage},down:{prev:i.previousDownPage,next:i.nextDownPage}}[x],y={left:c.leftStartIndex,right:c.rightStartIndex,up:c.upStartIndex,down:c.downStartIndex}[x],g={left:l.leftTotalPages,right:l.rightTotalPages,up:l.upTotalPages,down:l.downTotalPages}[x];return{show:n&&!!I,totalBlocks:I,actions:p,currentPage:y+1,totalPages:g,disabled:!I,hoverState:d[x],onHover:b=>h(x,b)}}}},qo=({blockItems:n,blockConnections:s})=>{const[o,r]=u.useState(null),[a,i]=u.useState(!1),c=u.useMemo(()=>{const y=new Map;return s.forEach(g=>{const b=`${g.source}-${g.target}`,j=`${g.target}-${g.source}`;y.set(b,g),y.set(j,g)}),y},[s]),l=u.useCallback(y=>{const g=[];return n.forEach(b=>{if(b.id!==y){const j=`${y}-${b.id}`;c.has(j)&&g.push(b.id)}}),g},[n,c]),d=u.useCallback(y=>{const g=n.find(C=>C.id===y);if(!g)return[];const b=l(y),j=[y];switch(g.type){case"up":b.forEach(C=>{const S=n.find(B=>B.id===C);S&&(S.type==="left"||S.type==="right")&&(j.push(C),l(C).forEach(k=>{const w=n.find(v=>v.id===k);w&&w.type==="down"&&j.push(k)}))});break;case"down":b.forEach(C=>{const S=n.find(B=>B.id===C);S&&(S.type==="left"||S.type==="right")&&(j.push(C),l(C).forEach(k=>{const w=n.find(v=>v.id===k);w&&w.type==="up"&&j.push(k)}))});break;case"left":b.forEach(C=>{const S=n.find(B=>B.id===C);S&&(S.type==="up"||S.type==="down")&&(j.push(C),l(C).forEach(k=>{const w=n.find(v=>v.id===k);w&&w.type==="right"&&j.push(k)}))});break;case"right":b.forEach(C=>{const S=n.find(B=>B.id===C);S&&(S.type==="up"||S.type==="down")&&(j.push(C),l(C).forEach(k=>{const w=n.find(v=>v.id===k);w&&w.type==="left"&&j.push(k)}))});break}return[...new Set(j)]},[n,l]),f=u.useCallback(y=>!0,[]),h=u.useCallback(y=>!a||!o?!1:!d(o).includes(y),[a,o,d]),m=u.useCallback(y=>!a||!o?!1:d(o).includes(y),[a,o,d]),x=u.useCallback(y=>{a&&o===y?(i(!1),r(null)):(r(y),i(!0))},[a,o]),I=u.useCallback(y=>{console.log(`Block clicked: ${y}`)},[]),p=u.useCallback(()=>{i(!1),r(null)},[]);return{selectedBlockId:o,isFiltering:a,isBlockVisible:f,isBlockDimmed:h,shouldShowBlueBorder:m,handleBlockPress:x,handleBlockClick:I,clearFiltering:p,getFilteredBlockIds:d}},at=n=>parseInt(n.replace(/[^\d]/g,""),10)||0,Zo=(n,s)=>{const[o,r]=u.useState({width:0,height:0}),a=u.useCallback(()=>{const{width:i,height:c}=o;if(i===0||c===0)return{blocksUp:s.minVerticalBlocks/2,blocksDown:s.minVerticalBlocks/2,blocksLeft:s.minHorizontalBlocks/2,blocksRight:s.minHorizontalBlocks/2,containerWidth:i,containerHeight:c};const l=at(s.cellSize),d=at(s.gap),f=l+d,h=i-d*2,m=c-d*2,x=Math.floor(m*s.verticalMaxPercent/100/f),I=Math.floor(h*s.horizontalMaxPercent/100/f),p=Math.floor(m*s.verticalMinPercent/100/f),y=Math.floor(h*s.horizontalMinPercent/100/f),g=Math.max(s.minVerticalBlocks,p),b=Math.max(s.minHorizontalBlocks,y),j=Math.max(g,x),C=Math.max(b,I),S=Math.floor(j/2),B=Math.floor(j/2),k=Math.floor(C/2),w=Math.floor(C/2);return{blocksUp:S,blocksDown:B,blocksLeft:k,blocksRight:w,containerWidth:i,containerHeight:c}},[o,s]);return u.useEffect(()=>{const i=()=>{if(n.current){const l=n.current.getBoundingClientRect();r({width:l.width,height:l.height})}};i();const c=new ResizeObserver(i);return n.current&&c.observe(n.current),()=>{c.disconnect()}},[n]),a()},Xo={verticalMinPercent:20,verticalMaxPercent:50,horizontalMinPercent:30,horizontalMaxPercent:50,minVerticalBlocks:2,minHorizontalBlocks:4,cellSize:"50px",gap:"8px"},Gt=({children:n,style:s,gap:o="8px",cellSize:r="50px",verticalBlocks:a,horizontalBlocks:i,responsiveConfig:c,enableResponsive:l=!1,blocksLeft:d,blocksRight:f,blocksUp:h=0,blocksDown:m=0,blockItems:x=[],blockConnections:I=[],enableFiltering:p=!1,onBlockClick:y,totalBlocksLeft:g,totalBlocksRight:b,totalBlocksUp:j,totalBlocksDown:C,usePagination:S=!1,responsive:B=!1,minBlocksPerSide:k=2,maxBlocksPerSide:w=15,minBlocksHorizontal:v=2,maxBlocksHorizontal:O=16,minBlocksVertical:M=2,maxBlocksVertical:z=16,minBlocksLeft:E=1,maxBlocksLeft:W=8,minBlocksRight:P=1,maxBlocksRight:H=8,minBlocksUp:L=1,maxBlocksUp:_=8,minBlocksDown:N=1,maxBlocksDown:Z=8,responsiveCellSize:F=!1,minCellSize:G="30px",maxCellSize:R="80px",directionTexts:D,...A})=>{const U=u.useRef(null),V=Zo(U,{...Xo,cellSize:r,gap:o,...c});let te=d,$=f,oe=h,X=m;l?(te=Math.floor(V.blocksLeft),$=Math.floor(V.blocksRight),oe=Math.floor(V.blocksUp),X=Math.floor(V.blocksDown)):(a!==void 0||i!==void 0)&&(a!==void 0&&(oe=Math.floor(a/2),X=Math.floor(a/2)),i!==void 0&&(te=Math.floor(i/2),$=Math.floor(i/2)));const de=E!==1?E:Math.floor(v/2),Le=W!==8?W:Math.floor(O/2),Fe=P!==1?P:Math.ceil(v/2),re=H!==8?H:Math.ceil(O/2),me=L!==1?L:Math.floor(M/2),we=_!==8?_:Math.floor(z/2),Kt=N!==1?N:Math.ceil(M/2),Jt=Z!==8?Z:Math.ceil(z/2),{usePagination:en,finalBlocks:Q,finalCellSize:ae,gridDimensions:Se}=_o({gap:o,cellSize:r,blocksLeft:te,blocksRight:$,blocksUp:oe,blocksDown:X,totalBlocksLeft:g,totalBlocksRight:b,totalBlocksUp:j,totalBlocksDown:C,responsive:B,minBlocksPerSide:k,maxBlocksPerSide:w,minBlocksLeft:de,maxBlocksLeft:Le,minBlocksRight:Fe,maxBlocksRight:re,minBlocksUp:me,maxBlocksUp:we,minBlocksDown:Kt,maxBlocksDown:Jt,responsiveCellSize:F,minCellSize:G,maxCellSize:R}),{getBlockContent:ke,getIntersectionText:tn}=Vo({blockItems:x}),{getConnectionStateFromText:nn}=Qo({blockConnections:I}),Y=qo({blockItems:x,blockConnections:I});u.useEffect(()=>{if(!p)return;const Ne=K=>{K.key==="Escape"&&Y.clearFiltering()};return window.addEventListener("keydown",Ne),()=>window.removeEventListener("keydown",Ne)},[p,Y]);const[ie,on,rn]=Po({totalBlocksLeft:g??0,totalBlocksRight:b??0,totalBlocksUp:j??0,totalBlocksDown:C??0,visibleBlocksLeft:Q.left,visibleBlocksRight:Q.right,visibleBlocksUp:Q.up,visibleBlocksDown:Q.down}),{getNavigationControlProps:ue}=Yo({usePagination:en,totalBlocksLeft:g,totalBlocksRight:b,totalBlocksUp:j,totalBlocksDown:C,paginationActions:on,paginationState:ie,paginationInfo:rn});return e.jsxs(t.Box,{ref:U,style:{display:"grid",gridTemplateColumns:Se.gridTemplateColumns,gridTemplateRows:Se.gridTemplateRows,width:"100vw",height:"100vh",maxWidth:"100vw",maxHeight:"100vh",padding:o,boxSizing:"border-box",gap:o,overflow:"hidden",...s},...A,children:[Array.from({length:Se.totalRows},(Ne,K)=>Array.from({length:Se.totalColumns},(wr,ne)=>{const Ue=Q.up>0?K===Q.up:K===0,We=ne===Q.left;if(Ue&&We)return e.jsxs(Lt,{style:{width:"100%",height:"100%",maxWidth:"none",maxHeight:"none",position:"relative"},children:[n,e.jsx(Me,{direction:"left",text:D==null?void 0:D.left,...ue("left")}),e.jsx(Me,{direction:"right",text:D==null?void 0:D.right,...ue("right")}),e.jsx(Me,{direction:"up",text:D==null?void 0:D.up,...ue("up")}),e.jsx(Me,{direction:"down",text:D==null?void 0:D.down,...ue("down")}),S&&e.jsx($t,{showLeftControls:!!g,showRightControls:!!b,showUpControls:!!j,showDownControls:!!C,onLeftHover:q=>ue("left").onHover(q),onRightHover:q=>ue("right").onHover(q),onUpHover:q=>ue("up").onHover(q),onDownHover:q=>ue("down").onHover(q)})]},`center-${K}-${ne}`);if(Ue&&ne<Q.left){const q=S&&g?ie.leftStartIndex+ne:ne,J=`left-${q}`;return e.jsx(Nt,{size:ae,blockId:p?J:void 0,isVisible:p?Y.isBlockVisible(J):!0,isDimmed:p?Y.isBlockDimmed(J):!1,shouldShowBlueBorder:p?Y.shouldShowBlueBorder(J):!1,onBlockClick:p?Y.handleBlockClick:y,onBlockPress:p?Y.handleBlockPress:void 0,children:ke("left",q)},`left-${ne}`)}if(Ue&&ne>Q.left){const q=ne-Q.left-1,J=S&&b?ie.rightStartIndex+(Q.right-1-q):Q.right-1-q,ce=`right-${J}`;return e.jsx(Ut,{size:ae,blockId:p?ce:void 0,isVisible:p?Y.isBlockVisible(ce):!0,isDimmed:p?Y.isBlockDimmed(ce):!1,shouldShowBlueBorder:p?Y.shouldShowBlueBorder(ce):!1,onBlockClick:p?Y.handleBlockClick:y,onBlockPress:p?Y.handleBlockPress:void 0,children:ke("right",J)},`right-${q}`)}if(We&&K<Q.up){const q=S&&j?ie.upStartIndex+K:K,J=`up-${q}`;return e.jsx(Wt,{size:ae,blockId:p?J:void 0,isVisible:p?Y.isBlockVisible(J):!0,isDimmed:p?Y.isBlockDimmed(J):!1,shouldShowBlueBorder:p?Y.shouldShowBlueBorder(J):!1,onBlockClick:p?Y.handleBlockClick:y,onBlockPress:p?Y.handleBlockPress:void 0,children:ke("up",q)},`up-${K}`)}if(We&&K>Q.up){const q=K-Q.up-1,J=S&&C?ie.downStartIndex+q:q,ce=`down-${J}`;return e.jsx(Ht,{size:ae,blockId:p?ce:void 0,isVisible:p?Y.isBlockVisible(ce):!0,isDimmed:p?Y.isBlockDimmed(ce):!1,shouldShowBlueBorder:p?Y.shouldShowBlueBorder(ce):!1,onBlockClick:p?Y.handleBlockClick:y,onBlockPress:p?Y.handleBlockPress:void 0,children:ke("down",J)},`down-${q}`)}const He=ne<Q.left?ne:null,Ce=ne>Q.left?ne-Q.left-1:null,$e=K<Q.up?K:null,Pe=K>Q.up?K-Q.up-1:null,sn=S&&g&&He!==null?ie.leftStartIndex+He:He,an=S&&b&&Ce!==null?ie.rightStartIndex+(Q.right-1-Ce):Ce!==null?Q.right-1-Ce:null,cn=S&&j&&$e!==null?ie.upStartIndex+$e:$e,ln=S&&C&&Pe!==null?ie.downStartIndex+Pe:Pe,Ge=tn(sn,an,cn,ln);if(Ge&&Ge.length>0){const q=nn(Ge);return e.jsx(Ft,{size:ae,state:q,interactive:!1},`intersection-${K}-${ne}`)}return e.jsx("div",{style:{width:ae,height:ae,minWidth:ae,minHeight:ae}},`empty-${K}-${ne}`)})).flat(),p&&Y.isFiltering&&e.jsx(t.Box,{style:{position:"fixed",top:12,right:12,background:"rgba(255, 255, 255, 0.9)",color:"var(--mantine-color-dark-7)",padding:"8px 12px",borderRadius:"8px",boxShadow:"0 2px 10px rgba(0,0,0,0.12)",fontSize:12,fontWeight:600,pointerEvents:"none",zIndex:1e3},children:"Press Esc to clear filter"})]})};Gt.displayName="Matrix";const he=({editable:n=!1,children:s,label:o,icon:r,value:a,className:i,style:c,...l})=>{const d={className:i,style:c};return ye.useMediaQuery("(max-width: 550px)",!1,{getInitialValueInEffect:!0})?e.jsxs(t.Stack,{gap:0,w:"100%",...d,children:[e.jsxs(t.Box,{style:{display:"flex",alignItems:"center",gap:8},h:"auto",children:[r&&e.jsx(r,{size:20,style:{flexShrink:0},color:"var(--mantine-color-gray-6)",strokeWidth:2}),e.jsx(t.Text,{size:"sm",fw:500,c:"gray.6",children:o})]}),e.jsx(t.Box,{style:{display:"flex",alignItems:"flex-start"},w:"100%",children:n&&s?s:a})]}):e.jsxs(t.Group,{align:"flex-start",gap:0,w:"100%",...l,...d,children:[e.jsxs(t.Box,{w:"30%",style:{display:"flex",alignItems:"center",gap:8},h:"40px",children:[r&&e.jsx(r,{size:20,style:{flexShrink:0},color:"var(--mantine-color-gray-6)",strokeWidth:2}),e.jsx(t.Text,{size:"sm",fw:500,truncate:!0,c:"gray.6",children:o})]}),e.jsx(t.Box,{w:"70%",style:{display:"flex",alignItems:"flex-start"},mih:40,children:n&&s?s:a})]})},Ko=({label:n,icon:s,value:o,onChange:r,editable:a=!1,placeholder:i,disabled:c=!1})=>a&&r?e.jsx(he,{label:n,icon:s,value:e.jsx(be,{value:o,onChange:r,placeholder:i,disabled:c,size:"sm"})}):e.jsx(he,{label:n,icon:s,value:e.jsx(t.Text,{size:"sm",c:o?void 0:"dimmed",fw:500,truncate:!0,children:o||i||"—"})}),Jo=({label:n,icon:s,href:o,text:r,target:a="_blank"})=>{const i=r||o;return e.jsx(he,{label:n,icon:s,value:e.jsx(t.Anchor,{href:o,target:a,size:"sm",underline:"hover",children:i})})},er=({label:n,icon:s,value:o,onChange:r,editable:a=!1,format:i,placeholder:c})=>{const l=o??null,d=l!==null&&i?i(l):l!==null?l.toString():null,f=h=>{if(!r)return;const m=h.trim();if(m===""){r(null);return}const x=Number(m);isNaN(x)||r(x)};return a&&r?e.jsx(he,{label:n,icon:s,value:e.jsx(be,{value:d||"",onChange:f,placeholder:c||"Enter number",size:"sm"})}):e.jsx(he,{label:n,icon:s,value:e.jsx(t.Text,{size:"sm",c:l!==null?void 0:"dimmed",children:d||c||"—"})})},tr=300,nr=({users:n,onSearch:s,debounceSearch:o=!0,debounceDelay:r=tr})=>{const[a,i]=u.useState(""),[c,l]=u.useState(n),[d,f]=u.useState(!1),h=u.useRef(null);return u.useEffect(()=>{if(!s){l(n);return}if(h.current&&clearTimeout(h.current),a.trim()){const m=async()=>{f(!0);try{const x=await s(a);l(x)}catch(x){console.error("Search error:",x)}finally{f(!1)}};o?h.current=setTimeout(m,r):m()}else l(n),f(!1);return()=>{h.current&&clearTimeout(h.current)}},[a,s,o,r,n]),u.useEffect(()=>{(!a.trim()||!s)&&l(n)},[n,a,s]),{searchQuery:a,setSearchQuery:i,displayedUsers:c,setDisplayedUsers:l,isSearching:d}},or=({value:n,multiple:s,users:o,displayedUsers:r,searchQuery:a,onSearch:i})=>{const c=u.useMemo(()=>s?Array.isArray(n)?n:[]:n?[n]:[],[n,s]),l=u.useMemo(()=>o.filter(h=>c.includes(h.id)),[o,c]),d=u.useMemo(()=>{if(!a.trim()||i)return r;const h=a.toLowerCase();return r.filter(m=>m.name.toLowerCase().includes(h)||m.email.toLowerCase().includes(h))},[r,a,i]),f=u.useMemo(()=>{const h=d.filter(I=>c.includes(I.id)),m=d.filter(I=>!c.includes(I.id)),x=l.filter(I=>!d.some(p=>p.id===I.id));return[...h,...x,...m]},[d,c,l]);return{selectedIds:c,selectedUsers:l,sortedUsers:f}},rr=({isFocused:n,dropdownRef:s})=>{const[o,r]=u.useState("bottom"),a=u.useCallback(i=>{if(s.current=i,i){const c=i.dataset.position;c==="top"||c==="bottom"?r(c):requestAnimationFrame(()=>{if(i.dataset.position){const l=i.dataset.position;(l==="top"||l==="bottom")&&r(l)}})}},[s]);return u.useLayoutEffect(()=>{if(!n||!s.current)return;const i=()=>{if(s.current){const d=s.current.dataset.position;(d==="top"||d==="bottom")&&r(d)}};i();const c=requestAnimationFrame(i),l=new MutationObserver(()=>{i()});return s.current&&l.observe(s.current,{attributes:!0,attributeFilter:["data-position"]}),()=>{cancelAnimationFrame(c),l.disconnect()}},[n,s]),{placement:o,dropdownRefCallback:a}},sr=({onLoadMore:n,hasMore:s,loading:o,setDisplayedUsers:r})=>{const a=u.useRef(null);return u.useEffect(()=>{if(!n||!s||o)return;const i=new IntersectionObserver(c=>{c[0].isIntersecting&&s&&!o&&n().then(l=>{r(d=>[...d,...l])})},{threshold:.1});return a.current&&i.observe(a.current),()=>{i.disconnect()}},[n,s,o,r]),{loadMoreRef:a}},ar=({combobox:n,dropdownRef:s})=>{const[o,r]=u.useState(!1),[a,i]=u.useState(!1),c=u.useCallback(()=>{r(!0),n.openDropdown()},[n]),l=u.useCallback(h=>{setTimeout(()=>{const m=h==null?void 0:h.relatedTarget;m&&s.current&&s.current.contains(m)||n.dropdownOpened||r(!1)},0)},[n,s]),d=u.useCallback(()=>{i(!0)},[]),f=u.useCallback(()=>{i(!1)},[]);return{isFocused:o,setIsFocused:r,isHovered:a,handleFocus:c,handleBlur:l,handleMouseEnter:d,handleMouseLeave:f}},ir=({multiple:n,value:s,onChange:o,combobox:r})=>{const a=u.useCallback(c=>{if(n){const l=Array.isArray(s)?s:[],d=l.includes(c)?l.filter(f=>f!==c):[...l,c];o==null||o(d)}else o==null||o(c),r.closeDropdown()},[n,s,o,r]),i=u.useCallback(c=>{if(n){const l=Array.isArray(s)?s:[];o==null||o(l.filter(d=>d!==c))}else o==null||o("")},[n,s,o]);return{handleSelect:a,handleRemove:i}},cr="40px",lr=300,pe=({editable:n=!1,label:s,icon:o,value:r,users:a=[],onChange:i,placeholder:c="Select users",multiple:l=!1,disabled:d=!1,onSearch:f,debounceSearch:h=!0,debounceDelay:m=lr,onLoadMore:x,hasMore:I=!1,loading:p=!1})=>{const y=u.useRef(null),g=u.useRef(null),b=u.useRef(null),{searchQuery:j,setSearchQuery:C,displayedUsers:S,setDisplayedUsers:B,isSearching:k}=nr({users:a,onSearch:f,debounceSearch:h,debounceDelay:m}),w=t.useCombobox({onDropdownClose:()=>{w.resetSelectedOption(),C(""),O(!1)},onDropdownOpen:()=>{w.updateSelectedOptionIndex("active"),O(!0)}}),{isFocused:v,setIsFocused:O,isHovered:M,handleFocus:z,handleBlur:E,handleMouseEnter:W,handleMouseLeave:P}=ar({combobox:w,dropdownRef:b}),{placement:H,dropdownRefCallback:L}=rr({isFocused:v,dropdownRef:b}),{selectedIds:_,selectedUsers:N,sortedUsers:Z}=or({value:r,multiple:l,users:a,displayedUsers:S,searchQuery:j,onSearch:f}),{loadMoreRef:F}=sr({onLoadMore:x,hasMore:I,loading:p,setDisplayedUsers:B}),{handleSelect:G,handleRemove:R}=ir({multiple:l,value:r,onChange:i,combobox:w}),D=()=>{if(!l)return null;const $=5,oe=N.slice(0,$),X=N.length-$;return e.jsxs(t.Group,{gap:"xs",children:[oe.map(de=>e.jsx(Be,{avatar:de.avatar,name:de.name,withRemoveButton:v,onRemove:()=>R(de.id)},de.id)),X>0&&e.jsx(t.Pill,{ml:"xs",radius:"md",size:"md",bg:"transparent",children:e.jsxs(t.Group,{gap:"2px",wrap:"nowrap",style:{alignItems:"center",display:"flex"},h:"24px",children:[e.jsx(T.IconPlus,{size:16,style:{color:"var(--mantine-color-blue-5)"}}),e.jsxs(t.Text,{size:"sm",fw:400,c:"var(--mantine-color-blue-5)",children:[X," more"]})]})})]})},A=()=>{if(l)return null;const $=N[0];return $?e.jsx(Be,{avatar:$.avatar,name:$.name}):null},U=()=>v?"var(--mantine-color-gray-2)":"var(--mantine-color-gray-0)",V=()=>({input:{position:v?"absolute":"relative",zIndex:v?1e3:1,fontWeight:"400",color:"var(--mantine-color-gray-9)",cursor:d?"not-allowed":"pointer",backgroundColor:v||M?"var(--mantine-color-gray-0)":"transparent",border:v?"1px solid var(--mantine-color-gray-2)":"1px solid transparent",borderRadius:v&&H==="bottom"?"var(--mantine-radius-md) var(--mantine-radius-md) 0 0":v&&H==="top"?"0 0 var(--mantine-radius-md) var(--mantine-radius-md)":"var(--mantine-radius-md)",paddingY:"6px",display:"flex",alignItems:"center",padding:"6px 14px",minHeight:"40px",flexWrap:l?"wrap":"nowrap",boxShadow:v&&H==="bottom"?"0 -4px 10px 0 rgba(0, 0, 0, 0.1)":v&&H==="top"?"0 4px 10px 0 rgba(0, 0, 0, 0.1)":"none"}}),te={group:{alignItems:"center",gap:"4px",minHeight:"0",lineHeight:"normal"}};return e.jsx(he,{editable:n,label:s,icon:o,value:e.jsx(t.Group,{gap:"sm",wrap:"nowrap",style:{alignItems:"center"},w:"100%",h:40,p:"14px",children:N.map($=>e.jsx(Be,{avatar:$.avatar,name:$.name,withRemoveButton:v,onRemove:()=>R($.id)},$.id))}),children:e.jsxs(t.Combobox,{store:w,onOptionSubmit:G,withinPortal:!1,offset:-2,children:[e.jsx(t.Combobox.DropdownTarget,{children:e.jsx(t.PillsInput,{onClick:()=>!d&&w.openDropdown(),radius:"md",disabled:d,styles:V,onFocus:z,onBlur:E,onMouseEnter:()=>!d&&W(),onMouseLeave:P,w:"100%",children:e.jsxs(t.Pill.Group,{styles:te,children:[l?D():A(),e.jsx(t.Combobox.EventsTarget,{children:e.jsx(t.PillsInput.Field,{ref:y,onFocus:z,onBlur:E,placeholder:N.length===0||v||j.length>0?c:"",value:j,onChange:$=>{w.updateSelectedOptionIndex(),C($.currentTarget.value)},onMouseDown:$=>{$.stopPropagation()},onKeyDown:$=>{$.key==="Backspace"&&j.length===0&&($.preventDefault(),l&&N.length>0?R(N[N.length-1].id):!l&&N.length>0&&R(N[0].id))},pointer:!0,disabled:d,styles:{field:{minWidth:v||j.length>0||N.length===0?"60px":"0px",width:v||j.length>0||N.length===0?"auto":"0px",flex:v||j.length>0||N.length===0?"1":"0",border:"none",outline:"none",background:"transparent",fontSize:"inherit",fontFamily:"inherit",padding:"0",margin:"0",overflow:"hidden",lineHeight:"24px",display:"flex",alignItems:"center",height:v||j.length>0||N.length===0?"auto":"0px",minHeight:v||j.length>0||N.length===0?"auto":"0px","&::placeholder":{opacity:N.length===0||v||j.length>0?1:0,display:N.length===0||v||j.length>0?"block":"none",color:"var(--mantine-color-gray-9)",lineHeight:"24px"}}}})})]})})}),e.jsx(t.Combobox.Dropdown,{styles:{dropdown:{borderRadius:H==="bottom"?"0 0 var(--mantine-radius-md) var(--mantine-radius-md)":"var(--mantine-radius-md) var(--mantine-radius-md) 0 0",borderTop:"none",border:`1px solid ${U()}`,marginTop:"0",padding:"4px",boxShadow:H==="bottom"?"0 4px 10px 0 rgba(0, 0, 0, 0.1)":"0 -4px 10px 0 rgba(0, 0, 0, 0.1)"}},ref:L,children:e.jsx(t.Combobox.Options,{children:e.jsx(t.ScrollArea,{ref:g,h:Math.min(Z.length*parseFloat(cr),300),scrollbarSize:6,children:e.jsxs(t.Stack,{gap:2,children:[Z.map($=>{const oe=_.includes($.id);return e.jsx(t.Combobox.Option,{value:$.id,active:oe,onMouseDown:X=>{X.preventDefault(),G($.id)},style:{borderRadius:"var(--mantine-radius-md)",height:"40px"},children:e.jsxs(t.Group,{gap:"sm",wrap:"nowrap",style:{display:"flex",alignItems:"center"},h:"28px",children:[e.jsx(se,{avatar:$.avatar,size:24,placeholder:$.name,showPlaceholder:!0}),e.jsx(t.Text,{size:"sm",fw:400,truncate:!0,children:$.name}),oe&&e.jsx(T.IconCheck,{size:16,color:"var(--mantine-color-blue-6)"})]})},$.id)}),(k||p)&&e.jsx(t.Box,{style:{padding:"12px",display:"flex",justifyContent:"center"},children:e.jsx(t.Loader,{size:"sm"})}),x&&I&&!p&&e.jsx("div",{ref:F,style:{height:"20px"}}),Z.length===0&&!k&&!p&&e.jsx(t.Box,{style:{padding:"24px",textAlign:"center"},children:e.jsx(t.Text,{size:"sm",c:"dimmed",children:"No users found"})})]})})})})]})})},et=({label:n,icon:s,value:o,onChange:r,onDraftChange:a,onFocusChange:i,editable:c=!1,placeholder:l,disabled:d=!1,minRows:f=1,maxRows:h,autosize:m=!0})=>{const[x,I]=u.useState(!1),[p,y]=u.useState(!1),g={wrapper:{...!m&&{height:"40px",minHeight:"40px",boxSizing:"border-box"},borderRadius:"var(--mantine-radius-md)"},input:{backgroundColor:x||p?"var(--mantine-color-gray-0)":"transparent",color:"var(--mantine-color-gray-9)",border:x?"1px solid var(--mantine-color-gray-2)":"1px solid transparent",borderRadius:"var(--mantine-radius-md)",width:"100%",cursor:"pointer",...!m&&{height:"40px",minHeight:"40px",boxSizing:"border-box"},padding:"8px 14px",lineHeight:m?"1.5":"24px",fontWeight:450}},b=()=>{I(!0),i==null||i(!0)},j=S=>{I(!1),i==null||i(!1),r==null||r(S.target.value)},C=S=>{const B=S.target.value;if(a){a(B);return}r==null||r(B)};return e.jsx(he,{editable:c,label:n,icon:s,value:e.jsx(t.Box,{w:"100%",style:{display:"flex",alignItems:"flex-start",minHeight:40},p:"xs",h:40,children:e.jsx(t.Text,{size:"sm",c:o?void 0:"dimmed",fw:400,style:{whiteSpace:"pre-wrap",wordBreak:"break-word"},children:o||l||"—"})}),children:e.jsx(t.Box,{w:"100%",style:{boxShadow:x?"var(--mantine-shadow-sm)":"none",borderRadius:"var(--mantine-radius-md)"},children:e.jsx(t.Textarea,{value:o,onChange:C,onFocus:b,onBlur:j,onMouseEnter:()=>y(!0),onMouseLeave:()=>y(!1),placeholder:l,disabled:d,size:"sm",radius:"md",fw:400,minRows:x?1:f,maxRows:h,autosize:m,styles:{...g}})})})},dr=({opened:n,onClose:s,children:o,...r})=>e.jsxs(t.Modal,{withCloseButton:!1,opened:n,onClose:s,size:"70%",centered:!0,overlayProps:{backgroundOpacity:.55},styles:{content:{minHeight:"100%"}},padding:"md",...r,children:[e.jsxs(t.Group,{justify:"space-between",wrap:"nowrap",children:[e.jsx(t.Group,{justify:"space-between",wrap:"nowrap",gap:"xs",children:e.jsx(ee,{icon:T.IconMaximize,size:"md",onClick:()=>{}})}),e.jsxs(t.Group,{justify:"space-between",gap:"xs",children:[e.jsx(ee,{icon:T.IconStar,size:"md",onClick:()=>{}}),e.jsx(ee,{icon:T.IconDots,size:"md",onClick:()=>{}})]})]}),o]}),_t=({opened:n,onClose:s,editable:o,content:r,position:a="right",size:i="xl",onMaximize:c,rightCornerActions:l,headerProps:d,propertiesProps:f})=>{var S,B;const[h,m]=u.useState(!1),x=(f==null?void 0:f.hiddenProperties)&&f.hiddenProperties.length>0,[I,p]=u.useState(!1),[y,g]=u.useState(d==null?void 0:d.avatar),[b,j]=u.useState(!1);u.useEffect(()=>{g(d==null?void 0:d.avatar)},[d==null?void 0:d.avatar]);const C=e.jsx(t.Button,{size:"xs",radius:"md",w:"fit-content",variant:"subtle",px:"var(--mantine-spacing-sm)",color:"gray",mb:"md",onClick:()=>{var w;const k={type:"emoji",value:"😊"};g(k),(w=d==null?void 0:d.onAvatarChange)==null||w.call(d,k)},children:e.jsxs(t.Box,{style:{display:"flex",alignItems:"center",justifyContent:"center",gap:6},children:[e.jsx(T.IconMoodSmileFilled,{size:16}),e.jsx(t.Text,{size:"sm",fw:500,children:"Add avatar"})]})});return e.jsxs(t.Drawer,{opened:n,onClose:s,position:a,size:i,padding:"md",withCloseButton:!1,overlayProps:{backgroundOpacity:0},shadow:"none",children:[e.jsxs(t.Group,{justify:"space-between",wrap:"nowrap",children:[e.jsxs(t.Group,{justify:"space-between",wrap:"nowrap",gap:"xs",children:[e.jsx(ee,{icon:T.IconChevronsRight,size:"md",onClick:s}),e.jsx(ee,{icon:T.IconMaximize,size:"md",onClick:()=>c()})]}),e.jsx(t.Group,{justify:"space-between",gap:"xs",children:l})]}),e.jsxs(t.Box,{p:"3rem",children:[d&&e.jsxs(t.Box,{children:[e.jsx(t.Box,{onMouseEnter:()=>p(!0),onMouseLeave:()=>p(!1),children:y?e.jsx(Ae,{editable:o,avatar:y,size:"xl",opened:b,onOpen:()=>j(!0),onClose:()=>j(!1),onAvatarSelect:k=>{var w;g(k),(w=d==null?void 0:d.onAvatarChange)==null||w.call(d,k)},onRemove:()=>{g(void 0)}}):e.jsx(t.Box,{h:24,children:I&&C})}),o?e.jsx(be,{value:d.title||"",onChange:k=>{var w;return(w=d.onTitleChange)==null?void 0:w.call(d,k)},onDraftChange:d.onTitleDraftChange,pageTitle:!0,placeholder:d.placeholder}):e.jsx(t.Box,{h:80,style:{display:"flex",alignItems:"center"},children:e.jsx(t.Text,{size:"2.5rem",fw:700,children:d.title})})]}),e.jsx(t.Stack,{gap:"sm",children:(S=f==null?void 0:f.visibleProperties)==null?void 0:S.map((k,w)=>e.jsx(t.Box,{children:k},w))}),x&&!h&&e.jsx(t.Box,{w:"100%",style:{display:"flex",justifyContent:"center"},children:e.jsx(t.Button,{size:"xs",radius:"md",w:"fit-content",variant:"subtle",px:"var(--mantine-spacing-sm)",color:"gray.4",onClick:()=>m(!0),children:e.jsxs(t.Box,{style:{display:"flex",alignItems:"center",justifyContent:"center",gap:6},children:[e.jsx(t.Text,{size:"sm",fw:500,c:"var(--mantine-color-blue-5)",children:"Show"}),e.jsx(T.IconChevronDown,{size:16,color:"var(--mantine-color-blue-5)"})]})})}),e.jsx(t.Collapse,{in:h,children:e.jsx(t.Stack,{gap:"sm",mt:"sm",children:(B=f==null?void 0:f.hiddenProperties)==null?void 0:B.map((k,w)=>e.jsx(t.Box,{children:k},w))})}),x&&h&&e.jsx(t.Box,{w:"100%",style:{display:"flex",justifyContent:"center"},mt:"sm",children:e.jsx(t.Button,{size:"xs",radius:"md",w:"fit-content",variant:"subtle",px:"var(--mantine-spacing-sm)",color:"gray.4",onClick:()=>m(!1),children:e.jsxs(t.Box,{style:{display:"flex",alignItems:"center",justifyContent:"center",gap:6},children:[e.jsx(t.Text,{size:"sm",fw:500,c:"var(--mantine-color-blue-5)",children:"Hide"}),e.jsx(T.IconChevronUp,{size:16,color:"var(--mantine-color-blue-5)"})]})})}),r]})]})},ur=({children:n})=>e.jsx(t.Box,{style:{minHeight:"100vh",width:"100%",maxWidth:"100%",margin:"0 auto"},id:"full-page",children:n}),Vt=u.createContext(void 0),Qt=({children:n})=>{const[s,{toggle:o,open:r,close:a}]=ye.useDisclosure(!0),[i,{toggle:c,open:l,close:d}]=ye.useDisclosure(!1),[f,{open:h,close:m}]=ye.useDisclosure(!1),[x,I]=u.useState(300),[p,y]=u.useState(500),g={opened:s,toggle:o,open:r,close:a,asideOpened:i,toggleAside:c,openAside:l,closeAside:d,sidebarWidth:x,setSidebarWidth:I,asideWidth:p,setAsideWidth:y,openedNotificationSidebar:f,openNotificationSidebar:h,closeNotificationSidebar:m};return e.jsx(Vt.Provider,{value:g,children:n})},tt=()=>{const n=u.useContext(Vt);if(n===void 0)throw new Error("useAppLayout must be used within an AppLayoutProvider");return n},Yt=({header:n,navbar:s,aside:o,children:r,...a})=>{const{opened:i,asideOpened:c,sidebarWidth:l,asideWidth:d}=tt();return e.jsxs(t.AppShell,{header:{height:n?60:0},navbar:{width:i?l:0,breakpoint:"sm",collapsed:{mobile:!0}},aside:{width:c?d:0,breakpoint:"sm",collapsed:{mobile:!0}},padding:0,...a,children:[n&&e.jsx(t.AppShell.Header,{children:n}),e.jsx(t.AppShell.Navbar,{style:{display:i?"block":"none",width:i?l:0,border:"none"},children:s}),e.jsx(t.AppShell.Aside,{style:{display:c?"block":"none",width:c?d:0},children:o}),e.jsx(t.AppShell.Main,{children:r})]})},fr=({items:n,selectedId:s,onSelect:o})=>e.jsx(t.Stack,{gap:0,children:n.map(r=>{var a;return e.jsx(Qe,{label:r.label,isActive:s===r.id,noChild:!r.children||r.children.length===0,onClick:()=>(!r.children||r.children.length===0)&&(o==null?void 0:o(r.id)),children:(a=r.children)==null?void 0:a.map(i=>e.jsx(Qe,{label:i.label,noChild:!0,level:4,isActive:s===i.id,onClick:()=>o==null?void 0:o(i.id)},i.id))},r.id)})}),hr=({items:n,selectedId:s,onSelect:o,headerLeft:r,headerRight:a,renderPreview:i,renderAside:c,sidebarTitle:l="Documentation",topNavItems:d,selectedTopNavId:f,onTopNavSelect:h})=>{const{opened:m,toggle:x}=tt(),[I,p]=u.useState(s),y=s??I,g=b=>{o==null||o(b),s===void 0&&p(b)};return e.jsx(Yt,{header:d?e.jsx(Ye,{withBorder:!0,bg:"transparent",position:"left",header:e.jsx(t.Group,{h:40,w:"100%",justify:"space-between",wrap:"nowrap",children:e.jsx(t.Group,{gap:"xs",wrap:"nowrap",children:m&&e.jsx(t.Text,{fw:600,size:"sm",children:l})})})}):void 0,navbar:e.jsx(Ye,{withBorder:!0,bg:"transparent",position:"left",header:e.jsxs(t.Group,{h:40,w:"100%",justify:"space-between",wrap:"nowrap",children:[e.jsx(t.Group,{gap:"xs",wrap:"nowrap",children:m&&e.jsx(t.Text,{fw:600,size:"sm",children:l})}),e.jsx(ee,{icon:m?T.IconChevronsLeft:T.IconChevronsRight,size:"md",onClick:x})]}),body:m&&e.jsx(t.ScrollArea,{h:"100%",type:"hover",scrollbarSize:10,styles:{scrollbar:{'&[data-state="visible"]':{background:"transparent"}},thumb:{backgroundColor:"var(--mantine-color-gray-4)",opacity:.3,"&:hover":{backgroundColor:"var(--mantine-color-gray-4)",opacity:.3}}},children:e.jsx(fr,{items:n,selectedId:y,onSelect:g})}),footer:e.jsx(e.Fragment,{})}),aside:e.jsx(t.Box,{p:"md",h:"100%",children:c==null?void 0:c(y)}),children:e.jsxs(t.Box,{style:{height:"100vh",display:"flex",flexDirection:"column",background:"var(--mantine-color-body)"},children:[e.jsxs(t.Group,{p:"md",justify:"space-between",align:"center",children:[e.jsxs(t.Group,{gap:"xs",wrap:"nowrap",children:[!m&&e.jsx(ee,{icon:T.IconChevronsRight,size:"md",variant:"subtle",tooltip:"Open sidebar",onClick:x}),r??e.jsx(ze,{label:y||"Select a topic",onClick:()=>{}})]}),!d&&a]}),e.jsx(t.Box,{style:{flex:1,display:"flex",alignItems:"center",justifyContent:"center",padding:"40px"},children:e.jsx(t.Box,{p:"xl",style:{borderRadius:"var(--mantine-radius-md)",width:"100%"},children:i(y)})})]})})},xr=n=>e.jsx(Qt,{children:e.jsx(hr,{...n})}),nt=(n,s)=>{const o=u.useCallback(i=>{const c=Array.isArray(i)?i:[i];n.onUserIdsChange(c)},[n]),r=u.useCallback(i=>{const c=Array.isArray(i)?i:[i],l=s.members.filter(I=>c.includes(I.id)),d=l.map(I=>I.id),f=c.filter(I=>!d.includes(I)),m=[...s.members,...n.users].filter(I=>f.includes(I.id)),x=[...l,...m];s.onMembersChange(x)},[s,n]);return{availableMembersUsers:u.useMemo(()=>{const i=[...s.members];return n.users.forEach(c=>{i.find(l=>l.id===c.id)||i.push(c)}),i},[s.members,n.users]),handleResponsibleChange:o,handleMembersChange:r}},pr=({opened:n,onClose:s,onMaximize:o,editable:r,name:a,onNameChange:i,avatar:c,onAvatarChange:l,owner:d,responsibleProps:f,membersProps:h,descriptionProps:m})=>{const{availableMembersUsers:x,handleResponsibleChange:I,handleMembersChange:p}=nt(f,h),y=u.useMemo(()=>[e.jsx(et,{label:"Description",icon:T.IconAlignLeft,value:m.description,onChange:m.onDescriptionChange,editable:r},"description"),e.jsx(pe,{editable:!1,label:"Team Owner",icon:T.IconUserCircle,value:d.id,users:[d]},"owner"),e.jsx(pe,{multiple:!1,editable:r,label:"Team Leader",icon:T.IconUser,value:f.userIds.length>0?f.userIds[0]:void 0,users:f.users,onChange:I,onSearch:f.handleSearch,onLoadMore:f.handleLoadMore,hasMore:f.hasMore},"leader"),e.jsx(pe,{multiple:!0,editable:r,label:"Team Members",icon:T.IconUsers,value:h.members.map(g=>g.id),users:x,onChange:p,onSearch:h.handleSearch,onLoadMore:h.handleLoadMore,hasMore:h.hasMore},"members")],[m.description,m.onDescriptionChange,r,d,f.handleLoadMore,f.handleSearch,f.hasMore,f.userIds,f.users,I,h.handleLoadMore,h.handleSearch,h.hasMore,h.members,x,p]);return e.jsx(_t,{opened:n,onClose:s,onMaximize:o,editable:r,headerProps:{avatar:c,onAvatarChange:g=>l==null?void 0:l(g),title:a,onTitleChange:i,placeholder:"Team name"},propertiesProps:{visibleProperties:y}})},qt=({isSidebarOpen:n,fullWidth:s=!1,editable:o,rightNavigation:r,headerProps:a,properties:i,children:c,footer:l})=>{const[d,f]=u.useState(a==null?void 0:a.avatar),[h,m]=u.useState(!1),[x,I]=u.useState(!1),p=s?"0":{base:"1rem",sm:"2rem",md:"4rem",lg:"8rem",xl:"10rem"},[y,g]=u.useState(n);u.useEffect(()=>{g(n)},[n]);const b=()=>{g(j=>!j)};return e.jsxs(t.Stack,{gap:"md",p:"md",children:[e.jsxs(t.Group,{justify:"space-between",children:[e.jsxs(t.Group,{gap:4,wrap:"nowrap",children:[e.jsx(ee,{icon:y?T.IconChevronsRight:T.IconMenu2,size:"md",color:"gray",changeIconOnHover:!0,iconHovered:y?T.IconMenu2:T.IconChevronsRight,variant:"subtle",onClick:b,"aria-pressed":y}),e.jsx(ze,{label:a.title,onClick:()=>{}})]}),e.jsx(t.Box,{children:r})]}),e.jsx(t.Box,{px:p,w:"100%",maw:{base:"100%",md:"80vw"},mx:"auto",children:e.jsxs(t.Stack,{gap:"md",children:[a&&e.jsxs(t.Stack,{gap:"md",children:[e.jsx(t.Box,{onMouseEnter:()=>I(!0),onMouseLeave:()=>I(!1),h:d?64:24,children:d?e.jsx(Ae,{editable:o,avatar:d,size:64,opened:h,onOpen:()=>m(!0),onClose:()=>m(!1),onAvatarSelect:j=>{var C;f(j),(C=a==null?void 0:a.onAvatarChange)==null||C.call(a,j)},onRemove:()=>{f(void 0)}}):e.jsx(t.Box,{h:24,children:x&&e.jsx(t.Button,{size:"xs",radius:"md",w:"fit-content",variant:"subtle",px:"var(--mantine-spacing-sm)",color:"gray",mb:"md",onClick:()=>{var C;const j={type:"emoji",value:"😊"};f(j),(C=a==null?void 0:a.onAvatarChange)==null||C.call(a,j)},children:e.jsxs(t.Box,{style:{display:"flex",alignItems:"center",justifyContent:"center",gap:6},children:[e.jsx(T.IconMoodSmileFilled,{size:16}),e.jsx(t.Text,{size:"sm",fw:500,children:"Add avatar"})]})})})}),e.jsx(t.Box,{children:o?e.jsx(gt,{value:a.title||"",onChange:j=>{var C;return(C=a.onTitleChange)==null?void 0:C.call(a,j)},placeholder:a.placeholder,pageTitle:!0}):e.jsx(t.Box,{h:80,style:{display:"flex",alignItems:"center"},children:e.jsx(t.Text,{size:"2.5rem",fw:700,children:a.title})})})]}),i,c,l]})})]})},Zt=({editable:n,owner:s,descriptionProps:o,responsibleProps:r,membersProps:a})=>{const{availableMembersUsers:i,handleResponsibleChange:c,handleMembersChange:l}=nt(r,a);return e.jsxs(t.Stack,{gap:"sm",children:[e.jsx(et,{label:"Description",icon:T.IconAlignLeft,value:o.description,onChange:o.onDescriptionChange,editable:n},"description"),e.jsx(pe,{editable:!1,label:"Team Owner",icon:T.IconUserCircle,value:s.id,users:[s]},"owner"),e.jsx(pe,{multiple:!1,editable:n,label:"Team Leader",icon:T.IconUser,value:r.userIds.length>0?r.userIds[0]:void 0,users:r.users,onChange:c,onSearch:r.handleSearch,onLoadMore:r.handleLoadMore,hasMore:r.hasMore},"leader"),e.jsx(pe,{multiple:!0,editable:n,label:"Team Members",icon:T.IconUsers,value:a.members.map(d=>d.id),users:i,onChange:l,onSearch:a.handleSearch,onLoadMore:a.handleLoadMore,hasMore:a.hasMore},"members")]})},mr=({editable:n,headerProps:s,rightNavigation:o,properties:r,children:a,footer:i})=>e.jsx(qt,{isSidebarOpen:!0,editable:n,rightNavigation:o,headerProps:s,properties:e.jsx(Zt,{...r}),children:a,footer:i}),gr=({title:n,properties:s,children:o})=>e.jsxs(t.Stack,{gap:"sm",p:"3rem",children:[e.jsx(t.Text,{size:"2.5rem",fw:600,children:n}),e.jsx(t.Space,{h:"md"}),e.jsx(t.Stack,{gap:"xs",children:s}),e.jsx(t.Space,{h:"md"}),e.jsx(t.Box,{children:o})]}),Ir=({opened:n,onClose:s,position:o,size:r,onMaximize:a,editable:i,rightNavigation:c,headerProps:l,properties:d,children:f,footer:h})=>{var C,S;const[m,x]=u.useState(l==null?void 0:l.avatar),[I,p]=u.useState(!1),[y,g]=u.useState(!1);u.useEffect(()=>{x(l==null?void 0:l.avatar)},[l==null?void 0:l.avatar]);const b=(C=l==null?void 0:l.loading)==null?void 0:C.avatar,j=(S=l==null?void 0:l.loading)==null?void 0:S.title;return e.jsx(t.Drawer,{opened:n,onClose:s,position:o,size:r,padding:"md",withCloseButton:!1,overlayProps:{backgroundOpacity:0},shadow:"none",trapFocus:!1,children:e.jsxs(t.Stack,{gap:"md",children:[e.jsxs(t.Group,{justify:"space-between",children:[e.jsxs(t.Group,{gap:"xs",wrap:"nowrap",children:[e.jsx(fe,{icon:T.IconChevronsRight,onClick:s}),e.jsx(fe,{icon:T.IconMaximize,onClick:()=>a()})]})," ",e.jsx(t.Box,{children:c})]}),e.jsx(t.Box,{p:"3rem",w:"100%",children:e.jsxs(t.Stack,{gap:"md",children:[l&&e.jsxs(t.Box,{children:[" ",e.jsx(t.Box,{onMouseEnter:()=>g(!0),onMouseLeave:()=>g(!1),h:b||m?64:24,children:b?e.jsx(t.Skeleton,{height:64,width:64,radius:"md"}):m?e.jsx(Ae,{editable:i,avatar:m,size:64,opened:I,onOpen:()=>p(!0),onClose:()=>p(!1),onAvatarSelect:B=>{var k;x(B),(k=l==null?void 0:l.onAvatarChange)==null||k.call(l,B)},onRemove:()=>{x(void 0)}}):e.jsx(t.Box,{h:24,children:y&&e.jsx(t.Button,{size:"xs",radius:"md",w:"fit-content",variant:"subtle",px:"var(--mantine-spacing-sm)",color:"gray",mb:"md",onClick:()=>{var k;const B={type:"emoji",value:"😊"};x(B),(k=l==null?void 0:l.onAvatarChange)==null||k.call(l,B)},children:e.jsxs(t.Box,{style:{display:"flex",alignItems:"center",justifyContent:"center",gap:6},children:[e.jsx(T.IconMoodSmileFilled,{size:16}),e.jsx(t.Text,{size:"sm",fw:500,children:"Add avatar"})]})})})}),j?e.jsx(t.Skeleton,{height:64,width:"100%",radius:"md",mt:"md"}):i?e.jsx(be,{value:l.title||"",onChange:B=>{var k;return(k=l.onTitleChange)==null?void 0:k.call(l,B)},onDraftChange:l.onTitleDraftChange,pageTitle:!0,placeholder:l.placeholder}):e.jsx(t.Box,{h:80,style:{display:"flex",alignItems:"center"},children:e.jsx(t.Text,{size:"2.5rem",fw:700,children:l.title})})]}),d,f,h]})})]})})},yr=({userName:n,avatar:s,title:o,status:r})=>{const a=i=>{const c=i==="green"?"var(--mantine-color-green-7)":i==="yellow"?"var(--mantine-color-yellow-7)":"var(--mantine-color-red-7)";return e.jsx(t.Box,{style:{width:10,height:10,borderRadius:999,backgroundColor:c}})};return e.jsxs(e.Fragment,{children:[e.jsx(t.Box,{style:{writingMode:"sideways-lr",textOrientation:"mixed"},children:e.jsx(se,{avatar:s,size:"xs",showPlaceholder:!0,placeholder:n})}),e.jsx(t.Text,{size:"sm",fw:500,truncate:!0,c:"var(--mantine-color-gray-9)",children:o}),e.jsx(t.Box,{w:"10px",h:"10px",mt:"xs",children:a(r)})]})},it=n=>typeof n=="number"?`${n}px`:n,ct=({height:n,minHeight:s,gridTemplateColumns:o,columnGap:r,cellStyle:a,rowHeaderContent:i,planContent:c,doContent:l,checkContent:d,actContent:f})=>{const h=it(n),m=it(s),x={display:"grid",gridTemplateColumns:o,columnGap:r,rowGap:r,width:"100%",minHeight:m,height:h},I={...a,minHeight:m,height:h,minWidth:0,overflow:"hidden",boxSizing:"border-box"},p={display:"flex",width:"100%",height:"100%",alignItems:"center",justifyContent:"left",writingMode:"sideways-lr",textOrientation:"mixed",gap:"var(--mantine-spacing-xs)"};return e.jsxs(t.Box,{style:x,children:[e.jsx(t.Box,{style:I,p:"xs",children:e.jsx(t.Box,{style:p,children:e.jsx(yr,{...i})})},"goal"),e.jsx(t.Box,{style:I,children:c},"plan"),e.jsx(t.Box,{style:I,children:l},"do"),e.jsx(t.Box,{style:I,children:d},"check"),e.jsx(t.Box,{style:I,children:f},"act")]})},vr=({gutter:n,onPointerDown:s,onPointerMove:o,onPointerUp:r,onDoubleClick:a})=>{const[i,c]=u.useState(!1);return e.jsx(t.Box,{onPointerEnter:()=>c(!0),onPointerLeave:()=>c(!1),onPointerDown:l=>{c(!0),s(l)},onPointerMove:o,onPointerUp:l=>{r(l),c(!1)},onPointerCancel:l=>{r(l),c(!1)},onDoubleClick:l=>{l.preventDefault(),l.stopPropagation(),a==null||a(l)},style:{height:n,cursor:"row-resize",display:"flex",alignItems:"center",justifyContent:"center"},children:e.jsx(t.Box,{style:{height:"4px",width:"40%",borderRadius:"999px",backgroundColor:"var(--mantine-color-gray-4)",opacity:i?1:0,transition:"opacity 120ms ease, background-color 120ms ease"}})})},jr=({cellSize:n,gutter:s,rowsLength:o,weeksContent:r,rows:a})=>{const i=u.useMemo(()=>s==="xs"?"4px":s==="sm"?"8px":s==="md"?"16px":s==="lg"?"24px":"32px",[s]),c=u.useMemo(()=>`${n}px repeat(4, 1fr)`,[n]),l=u.useMemo(()=>({backgroundColor:"var(--mantine-color-gray-0)",borderRadius:"var(--mantine-radius-md)",display:"flex",alignItems:"center",justifyContent:"flex-start",padding:"var(--mantine-spacing-sm)",height:"100%"}),[]),d=u.useRef(null),[f,h]=u.useState(n),m=u.useCallback(()=>Array.from({length:o},()=>f),[f,o]),[x,I]=u.useState(m),p=u.useRef(x),y=u.useRef(null);u.useEffect(()=>{p.current=x},[x]),u.useEffect(()=>{I(k=>Array.from({length:o},(v,O)=>{const M=k[O];return M===void 0?f:Math.max(M,f)}))},[o,f]);const g=u.useCallback(k=>w=>{w.preventDefault(),w.stopPropagation();const v=w.pointerId,O=p.current[k]??f;y.current={index:k,pointerId:v,startY:w.clientY,startHeight:O},w.currentTarget.setPointerCapture(v)},[f]),b=u.useCallback(k=>{const w=y.current;if(!w||k.pointerId!==w.pointerId)return;k.preventDefault();const v=k.clientY-w.startY,O=Math.max(f,w.startHeight+v);I(M=>{if(M[w.index]===O)return M;const E=[...M];return E[w.index]=O,E})},[f]),j=u.useCallback(k=>{const w=y.current;!w||k.pointerId!==w.pointerId||(k.preventDefault(),k.stopPropagation(),k.currentTarget.releasePointerCapture(k.pointerId),y.current=null)},[]),C=u.useCallback(k=>w=>{w.preventDefault(),w.stopPropagation(),I(v=>{const O=f,M=v[k]??O,z=[...v];return M===O?z[k]=window.innerHeight:z[k]=O,z})},[f]);u.useEffect(()=>{const k=d.current;if(!k)return;const w=()=>h(k.clientWidth||n);w();const v=new ResizeObserver(w);return v.observe(k),()=>{v.disconnect()}},[n]);const S=o===1,B={...l,height:n,fontSize:"var(--mantine-font-size-sm)",fontWeight:600,color:"var(--mantine-color-gray-9)"};return e.jsxs(t.Box,{style:{width:"100%",height:S?"100%":"auto",display:S?"flex":"block",flexDirection:S?"column":void 0,gap:S?i:void 0},children:[e.jsxs(t.Box,{style:{display:"grid",gridTemplateColumns:c,columnGap:i,rowGap:i,marginBottom:S?0:i},children:[e.jsx(t.Box,{style:B,children:r}),e.jsx(t.Box,{style:B,ref:d,children:"Plan"}),e.jsx(t.Box,{style:B,children:"Do"}),e.jsx(t.Box,{style:B,children:"Check"}),e.jsx(t.Box,{style:B,children:"Act"})]}),S?e.jsx(t.Box,{style:{flex:1,minHeight:`${f}px`,height:"100%"},children:e.jsx(ct,{height:"100%",minHeight:f,gridTemplateColumns:c,columnGap:i,cellStyle:l,rowHeaderContent:{userName:"John Doe",avatar:void 0,title:"This is a super long goal title in more than one line and it should be truncated",status:"yellow"},planContent:a[0].planContent,doContent:a[0].doContent,checkContent:a[0].checkContent,actContent:a[0].actContent})}):e.jsx(t.Box,{children:x.map((k,w)=>e.jsxs(t.Box,{children:[e.jsx(t.Box,{style:{minHeight:`${f}px`,height:`${k}px`},children:e.jsx(ct,{height:k,minHeight:f,gridTemplateColumns:c,columnGap:i,cellStyle:l,rowHeaderContent:{avatar:void 0,userName:`John Doe ${w+1}`,title:"This is a super long goal title in more than one line and it should be truncated",status:"green"},planContent:a[w].planContent,doContent:a[w].doContent,checkContent:a[w].checkContent,actContent:a[w].actContent})}),w<x.length-1&&e.jsx(vr,{gutter:i,onPointerDown:g(w),onPointerMove:b,onPointerUp:j,onDoubleClick:C(w)})]},`row-wrapper-${w}`))})]})},Xt=t.createTheme({primaryColor:"blue",fontFamily:'"Inter Variable", Inter, system-ui, Avenir, Helvetica, Arial, sans-serif',fontFamilyMonospace:"Monaco, Courier, monospace",headings:{fontFamily:'"Inter Variable", Inter, system-ui, Avenir, Helvetica, Arial, sans-serif'},colors:{gray:["#f9f8f7","#f1f0ef","#dfdedd","#b5b5b5","#9f9e9d","#91908c","#8b8983","#787670","#6b6962","#37352f"]},components:{}});function br({children:n,theme:s}){return e.jsxs(t.MantineProvider,{theme:s||Xt,children:[e.jsx(mn.Notifications,{}),e.jsx(gn.ModalsProvider,{children:e.jsx(In.DatesProvider,{settings:{firstDayOfWeek:0},children:n})})]})}exports.ActionButton=ee;exports.ActionIcon=fe;exports.AppLayout=Yt;exports.AppLayoutProvider=Qt;exports.AvatarSelector=Ae;exports.BaseLayout=gr;exports.BoardLayout=jr;exports.BoxAvatar=se;exports.CenterPeek=dr;exports.DocsTemplate=xr;exports.EditableText=be;exports.EditableTextarea=gt;exports.EmojiAvatar=dt;exports.ExpandableSearch=It;exports.FilterDropdown=zn;exports.FilterDropdownButton=Re;exports.FilterDropdownFilters=De;exports.FloatingIndicator=Hn;exports.FloatingIndicatorContent=Ke;exports.FloatingIndicatorProvider=Ze;exports.FloatingIndicatorTriggers=Xe;exports.FullPage=ur;exports.GenericTable=jt;exports.IconAvatar=ht;exports.ImageAvatar=xt;exports.InvitedUserCard=je;exports.LinkProperty=Jo;exports.Logo=mt;exports.Matrix=Gt;exports.Menu=ve;exports.ModalSettings=Mo;exports.NavButton=Je;exports.NavLink=Qe;exports.Navbar=Ye;exports.NavbarProvider=Lo;exports.NotificationSidebar=Ao;exports.NumberProperty=er;exports.PageLayout=qt;exports.PageProperty=he;exports.PlaceholderAvatar=Oe;exports.PopoverItem=vt;exports.PopoverSelector=Ee;exports.SelectUserProperty=pe;exports.ShareButton=ko;exports.ShareMenu=Dt;exports.ShareModal=Co;exports.SidePeek=_t;exports.SidePeekLayout=Ir;exports.TeamPage=mr;exports.TeamProperties=Zt;exports.TeamSidePeek=pr;exports.TextButton=ze;exports.TextProperty=Ko;exports.TextareaProperty=et;exports.ThemeProvider=br;exports.UserChip=Be;exports.WorkspaceSelector=$o;exports.WorkspaceSelectorItem=At;exports.getInitialsFromName=pt;exports.theme=Xt;exports.useAppLayout=tt;exports.useFloatingIndicator=Wn;exports.useNavbar=Fo;exports.useTeamProperties=nt;
18
+ `})]})},De=({activeFilters:n,onFiltersChange:s,availableFilters:o,size:r="md",filterButtonDropdownPosition:a="bottom-end"})=>{const i=t.useCombobox({onDropdownClose:()=>i.resetSelectedOption(),onDropdownOpen:()=>i.updateSelectedOptionIndex("active")}),[l,c]=u.useState(!1),d=n.length>0,f=y=>{if(y==="remove-filters")s([]);else{const g=o==null?void 0:o.find(b=>b.value===y);if(g){const b={id:`${g.value}-${Date.now()}`,filterOption:g};s([...n,b])}}i.closeDropdown()},x=(o||[]).filter(y=>!n.some(g=>g.filterOption.value===y.value)),m={borderRadius:"var(--mantine-radius-md)",fontSize:"var(--mantine-font-size-sm)",color:"var(--mantine-color-gray-7)",fontWeight:"500"},I=(()=>{switch(r){case"sm":return{height:"32px",width:"32px",iconSize:20};case"md":return{height:"32px",width:"32px",iconSize:20};default:return{height:"32px",width:"32px",iconSize:20}}})(),p=e.jsx(t.Box,{style:{display:"inline-flex",alignItems:"center",justifyContent:"center",backgroundColor:d||l?"var(--mantine-color-gray-0)":"transparent",color:"var(--mantine-color-gray-6)",borderRadius:"var(--mantine-radius-md)",cursor:"pointer",transition:"all 0.2s ease",...I},onMouseEnter:()=>c(!0),onMouseLeave:()=>c(!1),onClick:()=>i.toggleDropdown(),children:e.jsx(T.IconFilter,{size:20,stroke:2.3})});return e.jsxs(t.Combobox,{store:i,onOptionSubmit:f,withinPortal:!1,offset:4,position:a,children:[e.jsx(t.Combobox.Target,{children:d?e.jsx(t.Indicator,{offset:2,position:"top-end",color:"var(--mantine-color-yellow-7)",children:p}):p}),e.jsx(t.Combobox.Dropdown,{styles:{dropdown:{borderRadius:"var(--mantine-radius-md)",border:"1px solid var(--mantine-color-gray-2)",boxShadow:"var(--mantine-shadow-md)",padding:"4px",width:"auto",minWidth:"160px"}},children:e.jsxs(t.Combobox.Options,{children:[x.map(y=>e.jsx(t.Combobox.Option,{value:y.value,style:{...m},children:e.jsxs(t.Box,{style:{display:"flex",alignItems:"center",gap:"8px"},children:[y.icon,y.label]})},y.value)),d&&e.jsx(t.Combobox.Option,{value:"remove-filters",style:{borderRadius:"var(--mantine-radius-md)",fontSize:"var(--mantine-font-size-sm)",fontWeight:"500",color:"var(--mantine-color-red-6)"},children:e.jsxs(t.Box,{style:{display:"flex",alignItems:"center",gap:"8px"},children:[e.jsx(T.IconFilterOff,{size:16,stroke:2}),"Remove filters"]})})]})})]})},Tn=({filterTag:n,onUpdate:s,onRemove:o,options:r=[],filterTagDropdownPosition:a="bottom-start"})=>{var h;const i=t.useCombobox({onDropdownClose:()=>i.resetSelectedOption(),onDropdownOpen:()=>i.updateSelectedOptionIndex("active")}),l=!!n.selectedOption,c=l?`${n.filterOption.label}: ${(h=n.selectedOption)==null?void 0:h.label}`:n.filterOption.label,d=r&&r.length>0?r:[{value:"option-a",label:"TagFilterOptionA"},{value:"option-b",label:"TagFilterOptionB"},{value:"option-c",label:"TagFilterOptionC"}],f=I=>{if(I==="remove")o();else{const p=d.find(y=>y.value===I);p&&s({...n,selectedOption:p})}i.closeDropdown()},x={borderRadius:"var(--mantine-radius-md)",fontSize:"var(--mantine-font-size-sm)",color:"var(--mantine-color-gray-7)",fontWeight:"500"},m={display:"inline-flex",alignItems:"center",gap:"4px",backgroundColor:l?"var(--mantine-color-blue-0)":"var(--mantine-color-gray-0)",color:l?"var(--mantine-color-blue-7)":"var(--mantine-color-gray-6)",borderRadius:"var(--mantine-radius-xl)",cursor:"pointer",transition:"all 0.2s ease",height:"32px",fontSize:"var(--mantine-font-size-sm)",padding:"0 12px"};return e.jsxs(t.Combobox,{store:i,onOptionSubmit:f,withinPortal:!1,offset:4,position:a,middlewares:{flip:!1,shift:!0},children:[e.jsx(t.Combobox.Target,{children:e.jsxs(t.Box,{style:{...m},onClick:()=>i.toggleDropdown(),fw:500,pl:"sm",children:[e.jsxs(t.Box,{style:{display:"flex",alignItems:"center",gap:"4px"},children:[n.filterOption.icon,c]}),e.jsx(T.IconChevronDown,{size:16,strokeWidth:2,color:"var(--mantine-color-gray-5)"})]})}),e.jsx(t.Combobox.Dropdown,{styles:{dropdown:{borderRadius:"var(--mantine-radius-md)",border:"1px solid var(--mantine-color-gray-2)",boxShadow:"var(--mantine-shadow-md)",padding:"4px",minWidth:"150px"}},children:e.jsxs(t.Combobox.Options,{children:[d.map(I=>{var p;return e.jsx(t.Combobox.Option,{value:I.value,active:((p=n.selectedOption)==null?void 0:p.value)===I.value,style:{...x},children:I.label},I.value)}),e.jsx(t.Combobox.Option,{value:"remove",style:{borderRadius:"var(--mantine-radius-md)",fontSize:"var(--mantine-font-size-sm)",fontWeight:"500",color:"var(--mantine-color-red-6)"},children:"Or remove filter"})]})})]})},On=({activeFilters:n,onFiltersChange:s,availableFilters:o,addFilterButtonDropdownPosition:r="bottom-start"})=>{const a=t.useCombobox({onDropdownClose:()=>a.resetSelectedOption(),onDropdownOpen:()=>a.updateSelectedOptionIndex("active")}),[i,l]=u.useState(!1),c=h=>{const I=o==null?void 0:o.find(p=>p.value===h);if(I){const p={id:`${I.value}-${Date.now()}`,filterOption:I};s([...n,p])}a.closeDropdown()},d=(o||[]).filter(h=>!n.some(I=>I.filterOption.value===h.value)),f={display:"inline-flex",alignItems:"center",backgroundColor:i?"var(--mantine-color-gray-0)":"transparent",borderRadius:"var(--mantine-radius-xl)",cursor:"pointer",transition:"all 0.2s ease",border:"1px solid transparent",height:"32px",fontSize:"var(--mantine-font-size-sm)",padding:"0 12px"},x={dropdown:{borderRadius:"var(--mantine-radius-md)",border:"1px solid var(--mantine-color-gray-2)",boxShadow:"var(--mantine-shadow-md)",padding:"4px",width:"auto",minWidth:"120px"}},m={borderRadius:"var(--mantine-radius-md)",fontSize:"var(--mantine-font-size-sm)",color:"var(--mantine-color-gray-7)",fontWeight:"500"};return e.jsxs(t.Combobox,{store:a,onOptionSubmit:c,withinPortal:!1,offset:4,position:r,children:[e.jsx(t.Combobox.Target,{children:e.jsx(t.Box,{style:{...f},onMouseEnter:()=>l(!0),onMouseLeave:()=>l(!1),onClick:()=>a.toggleDropdown(),children:e.jsx(t.Box,{style:{fontWeight:"500",color:"var(--mantine-color-blue-6)"},children:"Add filter"})})}),e.jsx(t.Combobox.Dropdown,{styles:{...x},children:e.jsx(t.Combobox.Options,{children:d.map(h=>e.jsx(t.Combobox.Option,{value:h.value,style:{...m},children:e.jsxs(t.Box,{style:{display:"flex",alignItems:"center",gap:"8px"},children:[h.icon,h.label]})},h.value))})})]})},Ee=({activeFilters:n,onFiltersChange:s,availableFilters:o,size:r="sm",getFilterOptions:a,filterTagDropdownPosition:i="bottom-start"})=>{const l=f=>{const x=(n||[]).map(m=>m.id===f.id?f:m);s(x)},c=f=>{const x=(n||[]).filter(m=>m.id!==f);s(x)},d=(o||[]).filter(f=>!n.some(x=>x.filterOption.value===f.value));return!n||n.length===0?null:e.jsx("div",{style:{width:"100%"},children:e.jsxs(t.Group,{gap:"sm",align:"center",wrap:"wrap",children:[(n||[]).map(f=>{const x=a?a(f.filterOption.value)||[]:[];return e.jsx(Tn,{filterTag:f,onUpdate:l,onRemove:()=>c(f.id),size:r,options:x,filterTagDropdownPosition:i},f.id)}),d.length>0&&e.jsx(On,{activeFilters:n,onFiltersChange:s,availableFilters:d,size:r})]})})},zn=({activeFilters:n,onFiltersChange:s,availableFilters:o,size:r="md",getFilterOptions:a,filterTagDropdownPosition:i="bottom-start"})=>e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"12px"},children:[e.jsx(De,{activeFilters:n,onFiltersChange:s,availableFilters:o,size:r}),e.jsx(Ee,{activeFilters:n,onFiltersChange:s,availableFilters:o,size:"sm",getFilterOptions:a,filterTagDropdownPosition:i})]}),Rn=Object.assign(zn,{Button:De,Filters:Ee}),Dn=({children:n,danger:s,active:o,...r})=>{const[a,i]=u.useState(!1);return e.jsx(t.MenuItem,{...r,onMouseEnter:()=>i(!0),onMouseLeave:()=>i(!1),style:{borderRadius:"8px",color:o?"var(--mantine-color-blue-7)":s?"var(--mantine-color-red-9)":"var(--mantine-color-gray-9)",backgroundColor:a||o?"var(--mantine-color-gray-1)":"transparent",...r.style},children:n})},je=({trigger:n,menuItems:s,children:o,...r})=>{const a=u.useRef(null),[i,l]=u.useState(0);return u.useEffect(()=>{a.current&&l(a.current.offsetWidth)},[n]),e.jsxs(t.Menu,{...r,children:[e.jsx(t.Menu.Target,{children:e.jsx("div",{ref:a,onClick:c=>c.stopPropagation(),style:{cursor:"pointer",outline:"none",boxShadow:"none",display:"flex",alignItems:"center"},children:n})}),e.jsxs(t.Menu.Dropdown,{styles:{dropdown:{cursor:"pointer",borderRadius:"8px",minWidth:`${i}px`}},children:[o,s==null?void 0:s.map((c,d)=>e.jsx(Dn,{...c},d))]})]})},En="floatingIndicator-module__wrapper___oBPtC",An="floatingIndicator-module__control___5GZIX",Ln="floatingIndicator-module__label___Qmy1z",Fn="floatingIndicator-module__icon___sjrda",Nn="floatingIndicator-module__indicator___p7zco",Un="floatingIndicator-module__content___UXG3x",ge={wrapper:En,control:An,label:Ln,icon:Fn,indicator:Nn,content:Un},yt=u.createContext(null),qe=()=>{const n=u.useContext(yt);if(!n)throw new Error("FloatingIndicator components must be used within FloatingIndicator.Provider");return n},Ze=({items:n,activeId:s,defaultActiveId:o,onChange:r,indicatorProps:a,showIcons:i=!0,children:l})=>{var k;const[c,d]=u.useState(null),[f,x]=u.useState({}),[m,h]=u.useState(o??((k=n[0])==null?void 0:k.id)),I=s!==void 0,p=u.useRef(new Map),y=u.useCallback((j,M)=>{x(S=>{if(M)return S[j]===M?S:{...S,[j]:M};if(!(j in S))return S;const z={...S};return delete z[j],z})},[]),g=u.useCallback(j=>(p.current.has(j)||p.current.set(j,M=>{y(j,M)}),p.current.get(j)),[y]);u.useEffect(()=>{const j=new Set(n.map(M=>M.id));p.current.forEach((M,S)=>{j.has(S)||p.current.delete(S)}),x(M=>{if(!Object.keys(M).some(D=>!j.has(D)))return M;const z={};return Object.entries(M).forEach(([D,F])=>{j.has(D)&&(z[D]=F)}),z})},[n]),u.useEffect(()=>{var M;if(I)return;const j=o&&n.some(S=>S.id===o)&&o||((M=n[0])==null?void 0:M.id);h(S=>S&&n.some(z=>z.id===S)?S:j)},[n,o,I]);const b=(I?s:m)??null,v=u.useMemo(()=>n.find(j=>j.id===b),[n,b]),C=u.useCallback((j,M)=>()=>{M||(I||h(j),r==null||r(j))},[I,r]),w=u.useMemo(()=>{const j=[ge.indicator];return a!=null&&a.className&&j.push(a.className),j.filter(Boolean).join(" ")||void 0},[a==null?void 0:a.className]),O=u.useMemo(()=>{if(!a)return{};const{className:j,...M}=a;return M},[a]),B=u.useMemo(()=>({items:n,currentActiveId:b,showIcons:i,handleItemClick:C,getControlRefCallback:g,setParentRef:d,parentRef:c,indicatorClassName:w,indicatorProps:O,activeItem:v,controlsRefs:f}),[n,b,i,C,g,c,w,O,v,f]);return e.jsx(yt.Provider,{value:B,children:l})},Xe=({className:n,style:s})=>{const{items:o,currentActiveId:r,showIcons:a,handleItemClick:i,getControlRefCallback:l,setParentRef:c,parentRef:d,indicatorClassName:f,indicatorProps:x,controlsRefs:m}=qe(),h=[ge.wrapper,n].filter(Boolean).join(" ")||void 0;return e.jsxs(t.Box,{className:h,style:s,ref:c,children:[o.map(I=>{const p=I.icon,y=I.id===r,g=!!(p&&a);return e.jsxs(t.UnstyledButton,{ref:l(I.id),onClick:i(I.id,I.disabled),"data-active":y,className:ge.control,disabled:I.disabled,children:[g&&p&&e.jsx("span",{className:ge.icon,children:e.jsx(p,{size:16})}),e.jsx("span",{className:ge.label,children:I.label})]},I.id)}),e.jsx(t.FloatingIndicator,{target:r?m[r]??null:null,parent:d,className:f,...x})]})},Ke=({className:n,style:s,renderContent:o})=>{const{activeItem:r}=qe(),a=o?o(r):r==null?void 0:r.content;if(!a)return null;const i=[ge.content,n].filter(Boolean).join(" ")||void 0;return e.jsx(t.Box,{className:i,style:s,children:a})},Wn=({className:n,style:s,...o})=>e.jsx(Ze,{...o,children:e.jsxs(t.Stack,{gap:"sm",className:n,style:s,children:[e.jsx(Xe,{}),e.jsx(Ke,{})]})}),Hn=qe,Pn=Object.assign(Wn,{Provider:Ze,Triggers:Xe,Content:Ke}),Je=({label:n,icon:s,onClick:o,color:r="gray",disabled:a=!1,"aria-label":i,indicator:l,fullWidth:c,isActive:d=!1,...f})=>{const[x,m]=u.useState(!1),h=()=>{a||o==null||o()};return e.jsx(t.Box,{style:{cursor:a?"not-allowed":"pointer",borderRadius:"var(--mantine-radius-md)"},variant:"transparent",justify:"flex-start",display:"flex",color:r,radius:"md",w:c?"100%":"auto",px:6,h:40,onMouseEnter:()=>!a&&m(!0),onMouseLeave:()=>m(!1),onClick:h,bg:x||d?"gray.1":"transparent","aria-label":i||`${n} navigation button`,...f,children:e.jsxs(t.Group,{w:"100%",wrap:"nowrap",gap:8,justify:"left",align:"center",children:[e.jsx(t.Box,{style:{display:"flex",alignItems:"center",justifyContent:"center",width:"28px",height:"28px"},children:s}),e.jsx(t.Text,{ta:"left",size:"sm",fw:600,c:"var(--mantine-color-gray-8)",truncate:!0,style:{flex:1,opacity:a?.5:1},children:n}),l&&e.jsx(t.Box,{style:{cursor:"pointer",backgroundColor:"var(--mantine-color-red-7)",color:"var(--mantine-color-white)",borderRadius:"var(--mantine-radius-lg)",padding:"0px 4px",fontSize:"12px",fontWeight:600,height:"20px",minWidth:"20px",display:"flex",alignItems:"center",justifyContent:"center"},children:l})]})})},$n="navlink-module__navlink___nc4pR",Gn={navlink:$n},Qe=({label:n,rightLabel:s,children:o,onAddChild:r,onMenuAction:a,menuItems:i,color:l="var(--mantine-color-gray-7)",level:c=0,disabled:d=!1,noChild:f=!1,isActive:x=!1,showAvatar:m=!0,avatar:h,placeholder:I,onClick:p,"aria-label":y,...g})=>{const[b,v]=u.useState(!1),[C,w]=u.useState(!1),[O,B]=u.useState(!1),k=C||O,j=u.Children.count(o)>0,M=!f&&j&&(m?k:!0),S=u.useCallback(()=>{d||p==null||p()},[p,d]),z=u.useCallback(U=>{U.stopPropagation(),!d&&(f||v(!0),r==null||r())},[r,d,f]),D=u.useCallback(U=>{U==null||U.stopPropagation(),!d&&j&&!f&&v(V=>!V)},[d,j,f]),F=u.useCallback(()=>{d||(f||v(!0),r==null||r())},[r,d,f]),H=u.useCallback(U=>{d||a==null||a(U)},[a,d,n]),P=u.useCallback(()=>j?u.Children.map(o,U=>u.isValidElement(U)?u.cloneElement(U,{...U.props,level:c+1}):U):null,[o,j,c]),L=(i==null?void 0:i.map(U=>({children:e.jsxs(t.Group,{gap:"xs",wrap:"nowrap",children:[U.icon&&e.jsx(U.icon,{size:16}),e.jsx(t.Text,{size:"sm",children:U.label})]}),onClick:()=>H(U.action)})))||[],_=[{children:e.jsxs(t.Group,{gap:"xs",wrap:"nowrap",children:[e.jsx(T.IconPlus,{size:16}),e.jsx(t.Text,{size:"sm",children:"Add child"})]}),onClick:z}],N=L.length>0?L:_;return e.jsxs(t.Stack,{gap:0,children:[e.jsx(t.Box,{className:Gn.navlink,"data-disabled":d,"data-active":x,variant:"transparent",justify:"space-between",display:"flex",color:l,size:"md",radius:"md",w:"100%",px:6,h:40,onMouseEnter:()=>!d&&w(!0),onMouseLeave:()=>{O||w(!1)},onClick:S,bg:x||k?"var(--mantine-color-gray-1)":"transparent","aria-expanded":b,"aria-label":y||`${n} navigation link`,...g,children:e.jsxs(t.Group,{w:"100%",wrap:"nowrap",gap:8,onClick:S,style:{paddingLeft:f&&!M?`${(c+1)*32}px`:c>0?`${c*32}px`:"0px"},children:[M?e.jsx(fe,{icon:b?T.IconChevronDown:T.IconChevronRight,iconOnHover:b?T.IconChevronDown:T.IconChevronRight,grayScaleBaseColor:k?1:0,color:"var(--mantine-color-gray-7)",onClick:D,disabled:d}):m?e.jsx(se,{size:"xs",avatar:h,showPlaceholder:!0,placeholder:I}):null,e.jsx(t.Text,{size:"sm",fw:600,c:l,truncate:!0,w:"100%",style:{opacity:d?.5:1},children:n}),e.jsxs(t.Group,{gap:"xs",align:"center",children:[s&&e.jsx(t.Text,{size:"xs",c:"dimmed",children:s}),k&&!d&&e.jsxs(t.Group,{gap:4,wrap:"nowrap",children:[r&&e.jsx(fe,{icon:T.IconPlus,grayScaleBaseColor:k?1:0,onClick:F,color:"var(--mantine-color-gray-7)"}),(i&&i.length>0||r)&&e.jsx("div",{onClick:U=>U.stopPropagation(),children:e.jsx(je,{menuItems:N,trigger:e.jsx(fe,{icon:T.IconDots,grayScaleBaseColor:1,color:"var(--mantine-color-gray-7)"}),position:"bottom-end",shadow:"md",onOpen:()=>{B(!0),w(!0)},onClose:()=>{B(!1)}})})]})]})]})}),b&&!f&&j&&e.jsx(t.Stack,{gap:0,style:{width:"100%"},children:P()})]})},_n="userChip-module__pill___DgFME",Vn={pill:_n},Te=({avatar:n,name:s,withRemoveButton:o=!1,onRemove:r})=>e.jsx(t.Pill,{withRemoveButton:o,onRemove:r,radius:"md",p:"0px",size:"md",className:Vn.pill,bg:"transparent",children:e.jsxs(t.Group,{gap:4,wrap:"nowrap",style:{alignItems:"center"},children:[e.jsx(se,{avatar:n,size:24,placeholder:s,showPlaceholder:!0}),e.jsx(t.Text,{size:"sm",fw:500,c:"var(--mantine-color-gray-9)",children:s})]})}),Qn="200px",Yn="4px 8px",qn=40,Zn="var(--mantine-radius-md)",Xn=16,vt=({item:n,withAvatars:s,disabled:o=!1,onClick:r,selected:a=!1})=>{const[i,l]=u.useState(!1);return e.jsx(t.Box,{onMouseEnter:()=>!o&&l(!0),onMouseLeave:()=>!o&&l(!1),onClick:c=>{c.preventDefault(),c.stopPropagation(),o||r==null||r(n.value)},onMouseDown:c=>{c.stopPropagation()},style:{minWidth:Qn,backgroundColor:o?"transparent":i?"var(--mantine-color-gray-0)":"transparent",cursor:o?"default":"pointer",borderRadius:Zn,padding:Yn,transition:"background-color 0.2s ease",opacity:o?.5:1},children:e.jsxs(t.Group,{gap:"sm",wrap:"nowrap",align:"flex-start",style:{alignItems:"center"},h:qn,children:[s&&n.avatar&&e.jsx("img",{src:n.avatar,alt:n.label,style:{width:"24px",height:"24px",borderRadius:"var(--mantine-radius-sm)",objectFit:"cover"}}),e.jsxs(t.Stack,{gap:0,style:{flex:1},children:[e.jsx(t.Text,{size:"sm",fw:500,lh:-1,c:o?"var(--mantine-color-gray-5)":"var(--mantine-color-gray-9)",children:n.label}),e.jsx(t.Text,{size:"xs",c:o?"var(--mantine-color-gray-4)":"dimmed",children:n.description})]}),a&&e.jsx(T.IconCheck,{size:Xn,color:"var(--mantine-color-gray-9)"})]})})},Kn="bottom-end",Jn=1e4,eo="24px",to="0 8px",no="6px",rt="var(--mantine-radius-md)",oo="46px",Ae=({value:n,onChange:s,data:o,withRemove:r=!1,withAvatars:a=!1,onRemove:i,disabledOptions:l=[],disabled:c=!1,defaultOption:d,popoverStyles:f,dropdownStyles:x,triggerStyles:m,textStyles:h,counter:I})=>{const[p,y]=u.useState(!1),g=(o||[]).find(S=>S.value===n)||d,[b,v]=u.useState(!1),[C,w]=u.useState(!1),[O,B]=u.useState(!1),k=r?e.jsx(t.Group,{p:"sm",onClick:S=>{S.stopPropagation(),i==null||i(n)},style:{cursor:"pointer",height:oo,display:"flex",alignItems:"center",borderRadius:rt,backgroundColor:C?"var(--mantine-color-red-0)":"transparent",transition:"background-color 0.2s ease"},onMouseEnter:()=>w(!0),onMouseLeave:()=>w(!1),children:e.jsx(t.Text,{size:"sm",c:"var(--mantine-color-red-6)",fw:500,children:"Remove user"})}):null,j=S=>S>0?e.jsx(t.Text,{size:"sm",c:"var(--mantine-color-gray-7)",fw:600,children:S}):null,M=e.jsxs(t.Box,{onMouseEnter:()=>!c&&v(!0),onMouseLeave:()=>!c&&v(!1),onClick:()=>{c||(y(!0),B(!0))},style:{height:eo,cursor:c?"not-allowed":"pointer",display:"inline-flex",alignItems:"center",borderRadius:rt,backgroundColor:c?"transparent":b||O?"var(--mantine-color-gray-1)":"transparent",transition:"background-color 0.2s ease",padding:to,gap:no,width:"auto",opacity:c?.6:1,...m},children:[e.jsx(t.Text,{size:"sm",fw:h!=null&&h.fontWeight?void 0:500,c:c?"var(--mantine-color-gray-4)":"var(--mantine-color-gray-6)",style:{color:c?"var(--mantine-color-gray-4)":"var(--mantine-color-gray-6)",lineHeight:"24px",whiteSpace:"nowrap",...h},children:(g==null?void 0:g.label)||"Select option"}),j(I??0),e.jsx(T.IconChevronDown,{size:16,style:{color:c?"var(--mantine-color-gray-3)":"var(--mantine-color-gray-6)"}})]});return e.jsxs(t.Popover,{opened:p,onChange:S=>{y(S),S||B(!1)},position:Kn,shadow:"md",withinPortal:!0,zIndex:Jn,styles:f,children:[e.jsx(t.Popover.Target,{children:M}),e.jsx(t.Popover.Dropdown,{onClick:S=>S.stopPropagation(),onMouseDown:S=>S.stopPropagation(),styles:{dropdown:{borderRadius:"var(--mantine-radius-md)",padding:"4px",...x}},children:e.jsxs(t.Stack,{gap:0,onClick:S=>S.stopPropagation(),onMouseDown:S=>S.stopPropagation(),children:[(o||[]).map(S=>{const z=l.includes(S.value),D=S.value===n;return e.jsx(vt,{item:S,withAvatars:a,disabled:z,selected:D,onClick:F=>{s==null||s(F),y(!1),B(!1)}},S.value)}),k]})})]})},ro=(n,s,o,r)=>{const a=u.useRef(null),i=u.useRef(null),l=u.useCallback(d=>{d[0].isIntersecting&&o&&!r&&s&&s()},[o,r,s]),c=u.useCallback(()=>{if(!(!a.current||!n||!s)){i.current&&(i.current.disconnect(),i.current=null);try{const d=new IntersectionObserver(l,{threshold:.1,rootMargin:"50px"});d.observe(a.current),i.current=d}catch(d){console.error("Failed to setup intersection observer:",d)}}},[n,s,l]);return u.useEffect(()=>(c(),()=>{i.current&&(i.current.disconnect(),i.current=null)}),[c]),u.useEffect(()=>()=>{i.current&&(i.current.disconnect(),i.current=null)},[]),{loadMoreRef:a}},jt=({tableName:n,data:s,columns:o,onAddItem:r,addItemComponent:a,addItemLabel:i="Add item",loading:l=!1,emptyMessage:c="No data found",searchPlaceholder:d="Search...",enableAutoFilters:f=!0,customFilters:x=[],onCustomFilter:m,onSort:h,sortColumn:I,sortDirection:p,onSearch:y,onRowClick:g,size:b="md",striped:v=!1,highlightOnHover:C=!0,enableInfiniteScroll:w=!1,isLoadingMore:O=!1,hasMore:B=!1,onLoadMore:k})=>{const[j,M]=u.useState(""),[S,z]=u.useState([]),{loadMoreRef:D}=ro(w,k||(()=>{}),B,O),F=u.useMemo(()=>[...f?o.filter(E=>E.type==="select"&&E.options).map(E=>({value:E.key,label:E.label})):[],...x],[o,f,x]),H=u.useMemo(()=>{let R=s||[];if(j){const E=j.toLowerCase();R=R.filter(A=>o.some(W=>{if(!W.searchable)return!1;const Q=A[W.key];return Q==null?!1:String(Q).toLowerCase().includes(E)}))}return S.forEach(E=>{if(E.filterTag.selectedOption){const A=o.find(W=>W.key===E.filterTag.filterOption.value);A&&(R=R.filter(W=>{var te;const Q=W[A.key];return String(Q)===((te=E.filterTag.selectedOption)==null?void 0:te.value)}))}}),R},[s,j,S,o]),P=R=>{M(R),y==null||y(R)},L=R=>{const E=o.find(W=>W.key===R);if(!(E!=null&&E.sortable))return;const A=I===R&&p==="asc"?"desc":"asc";h==null||h(R,A)},_=R=>{const E=o.find(A=>A.key===R);return(E==null?void 0:E.type)==="select"&&E.options?E.options.map(A=>({value:A.value,label:A.label})):(E==null?void 0:E.type)==="badge"?[...new Set(s.map(W=>W[E.key]).filter(Boolean))].map(W=>({value:String(W),label:String(W).charAt(0).toUpperCase()+String(W).slice(1)})):E?[...new Set(s.map(W=>W[E.key]).filter(Boolean))].map(W=>({value:String(W),label:String(W).charAt(0).toUpperCase()+String(W).slice(1)})):[]},N=(R,E)=>{var W,Q,te,$,oe;const A=E[R.key];switch(R.type){case"text":return e.jsx(t.Text,{size:"sm",c:A?void 0:"dimmed",children:A||"—"});case"date":if(!A)return e.jsx(t.Text,{size:"sm",c:"dimmed",children:"—"});const X=new Date(A),de=R.format?X.toLocaleDateString("en-US",{year:"numeric",month:"2-digit",day:"2-digit"}):X.toLocaleDateString();return e.jsx(t.Text,{size:"sm",c:"dimmed",children:de});case"select":return R.options?e.jsx(Ae,{value:A,data:R.options,placeholder:R.label,onChange:re=>{var me;return(me=R.onSelectChange)==null?void 0:me.call(R,re,E)},disabled:(W=R.disabled)==null?void 0:W.call(R,E)}):e.jsx(t.Text,{size:"sm",c:"dimmed",children:"—"});case"badge":const Fe=((Q=R.badgeColors)==null?void 0:Q[A])||"gray";return e.jsx(t.Badge,{color:Fe,variant:"light",size:"sm",radius:"md",fw:600,children:A||"Unknown"});case"avatar":const Ne=((te=R.fallbackText)==null?void 0:te.call(R,E))||String(A).charAt(0).toUpperCase();return e.jsx(se,{avatar:A,size:"xs",placeholder:Ne,showPlaceholder:!0});case"custom":return(($=R.render)==null?void 0:$.call(R,A,E))||e.jsx(t.Text,{size:"sm",c:"dimmed",children:"—"});case"actions":return(oe=R.actions)!=null&&oe.length?e.jsxs(t.Menu,{shadow:"md",width:200,position:"bottom-end",styles:{dropdown:{borderRadius:"var(--mantine-radius-md)"}},children:[e.jsx(t.Menu.Target,{children:e.jsx(t.ActionIcon,{variant:"subtle",size:"md",color:"gray",radius:"md",children:e.jsx(T.IconDots,{size:16})})}),e.jsx(t.Menu.Dropdown,{children:R.actions.map((re,me)=>{var Se;return e.jsx(t.Menu.Item,{color:re.color,leftSection:re.icon,disabled:(Se=re.disabled)==null?void 0:Se.call(re,E),onClick:()=>re.onClick(E),styles:{item:{borderRadius:"var(--mantine-radius-md)"}},children:re.label},me)})})]}):null;default:return e.jsx(t.Text,{size:"sm",c:"dimmed",children:"—"})}},U=R=>{var E;return(E=o.find(A=>A.key===R))!=null&&E.sortable?I===R?p==="asc"?e.jsx(T.IconChevronUp,{size:14}):e.jsx(T.IconChevronDown,{size:14}):e.jsx(T.IconChevronUp,{size:14,style:{opacity:.3}}):null},G=(()=>{switch(b){case"sm":return{buttonSize:"xs",textSize:"sm"};case"lg":return{buttonSize:"md",textSize:"md"};default:return{buttonSize:"sm",textSize:"sm"}}})();return e.jsxs(t.Box,{pos:"relative",children:[e.jsx(t.LoadingOverlay,{visible:l}),e.jsxs(t.Stack,{gap:"sm",w:"100%",children:[e.jsxs(t.Group,{gap:"sm",wrap:"nowrap",justify:"space-between",children:[e.jsx(t.Text,{fw:600,c:"var(--mantine-color-gray-8)",children:n}),e.jsxs(t.Group,{gap:"xs",wrap:"nowrap",children:[e.jsxs(t.Group,{gap:4,wrap:"nowrap",children:[e.jsx(It,{placeholder:d,value:j,onChange:P,onSearch:P,expandDirection:"right",size:G.buttonSize}),F.length>0&&e.jsx(De,{activeFilters:S.map(R=>R.filterTag),onFiltersChange:R=>{z(R.map(E=>({filterTag:E,onUpdate:()=>{},onRemove:()=>{}}))),m==null||m(R)},availableFilters:F,size:G.buttonSize})]}),r&&e.jsx(t.Button,{size:"compact-md",h:32,style:{fontSize:`var(--mantine-font-size-${G.textSize})`,border:"none"},radius:"md",onClick:r,children:i})]})]}),F.length>0&&e.jsx(Ee,{activeFilters:S.map(R=>R.filterTag),onFiltersChange:R=>{z(R.map(E=>({filterTag:E,onUpdate:()=>{},onRemove:()=>{}}))),m==null||m(R)},availableFilters:F,size:"md",getFilterOptions:_})]}),a,e.jsxs(t.Table,{striped:v,highlightOnHover:C,highlightOnHoverColor:"var(--mantine-color-gray-0)",mt:"xs",children:[e.jsx(t.Table.Thead,{children:e.jsx(t.Table.Tr,{children:o.map(R=>e.jsx(t.Table.Th,{c:"var(--mantine-color-gray-6)",style:{width:R.width,textAlign:R.align||"left",cursor:R.sortable?"pointer":"default"},onClick:()=>R.sortable&&L(R.key),children:e.jsxs(t.Group,{gap:"xs",wrap:"nowrap",children:[R.icon&&e.jsx(t.Box,{style:{display:"flex",alignItems:"center"},children:R.icon}),e.jsx(t.Text,{size:G.textSize,fw:500,children:R.label}),U(R.key)]})},String(R.key)))})}),e.jsx(t.Table.Tbody,{children:H.length===0?e.jsx(t.Table.Tr,{children:e.jsx(t.Table.Td,{colSpan:o.length,ta:"center",py:"xl",children:e.jsx(t.Text,{c:"dimmed",children:c})})}):H.map((R,E)=>e.jsx(t.Table.Tr,{style:{cursor:g?"pointer":"default"},onClick:()=>g==null?void 0:g(R),children:o.map(A=>e.jsx(t.Table.Td,{style:{textAlign:A.align||"left"},children:N(A,R)},String(A.key)))},R.id||E))})]}),w&&e.jsx(t.Box,{ref:D,style:{padding:"16px",display:"flex",justifyContent:"center",alignItems:"center",minHeight:"60px"},children:O&&e.jsxs(t.Group,{display:"flex",ta:"center",gap:"xs",children:[e.jsx(t.Loader,{size:"sm",color:"gray.5"}),e.jsx(t.Text,{size:"sm",c:"dimmed",fw:500,children:"Loading more..."})]})})]})};Object.assign(jt,{});const so=({onAvatarSelect:n,onEmojiSelect:s,onImageSelect:o,onIconSelect:r}={})=>{const[a,i]=u.useState("emoji"),[l,c]=u.useState(null),[d,f]=u.useState(null),[x,m]=u.useState(null),[h,I]=u.useState(null),[p,y]=u.useState(null),g=u.useCallback(j=>{i(j)},[]),b=u.useCallback(j=>{c(j)},[]),v=u.useCallback(j=>{y(j);const M=new FileReader;M.onload=S=>{var D;const z=(D=S.target)==null?void 0:D.result;f(z)},M.readAsDataURL(j)},[]),C=u.useCallback(j=>{m(j),f(null),y(null),I(null),n==null||n({type:"emoji",value:j}),s==null||s(j)},[n,s]),w=u.useCallback(j=>{I(j),f(null),y(null),m(null),n==null||n({type:"icon",value:j}),r==null||r(j)},[n,r]),O=u.useCallback(()=>{if(p&&d){const j=URL.createObjectURL(p);n==null||n({type:"image",value:j}),o==null||o(p)}},[p,d,n,o]),B=u.useCallback(()=>{f(null),y(null),m(null),I(null)},[]),k=u.useCallback(()=>{f(null),m(null),I(null),y(null),i("emoji"),c(null)},[]);return{selectedTab:a,tabHovered:l,previewImage:d,selectedEmoji:x,selectedIcon:h,selectedFile:p,handleTabChange:g,handleTabHover:b,handleImagePreview:v,handleImageAccept:O,handleEmojiSelect:C,handleIconSelect:w,clearImagePreview:B,resetState:k}},ao=({opened:n,onClose:s,popoverRef:o})=>{const r=u.useCallback(i=>{n&&o.current&&!o.current.contains(i.target)&&(console.log("Click outside detected, closing popover"),s())},[n,s,o]),a=u.useCallback(i=>{i.key==="Escape"&&n&&(console.log("Escape key pressed, closing popover"),s())},[n,s]);return u.useEffect(()=>{if(n)return document.addEventListener("mousedown",r),document.addEventListener("keydown",a),()=>{document.removeEventListener("mousedown",r),document.removeEventListener("keydown",a)}},[n,r,a]),{handleClickOutside:r,handleEscape:a}},io=({selectedTab:n,tabHovered:s,onTabChange:o,onTabHover:r,onRemove:a,hasAvatar:i=!1,children:l})=>{const[c,d]=u.useState(!1);return e.jsxs(t.Tabs,{color:"black",value:n,styles:{tab:{backgroundColor:"transparent"}},children:[e.jsxs(t.Tabs.List,{px:"var(--mantine-spacing-sm)",pt:"xs",w:"100%",children:[e.jsx(t.Tabs.Tab,{value:"emoji",p:0,pb:"xs",onClick:()=>o("emoji"),onMouseEnter:()=>r("emoji"),onMouseLeave:()=>r(null),style:{backgroundColor:"transparent"},children:e.jsx(t.Box,{style:{borderRadius:"var(--mantine-radius-md)",height:"24px",display:"flex",alignItems:"center",justifyContent:"center",padding:"0 8px",border:"none",backgroundColor:s==="emoji"?"var(--mantine-color-gray-1)":"transparent",color:n==="emoji"?"var(--mantine-color-gray-9)":"var(--mantine-color-gray-6)",cursor:"pointer"},fw:500,fz:"var(--mantine-font-size-sm)",children:e.jsx(t.Group,{gap:4,children:"Emoji"})})}),e.jsx(t.Tabs.Tab,{value:"icons",p:0,pb:"xs",onClick:()=>o("icons"),onMouseEnter:()=>r("icons"),onMouseLeave:()=>r(null),style:{backgroundColor:"transparent"},children:e.jsx(t.Box,{style:{height:"24px",display:"flex",alignItems:"center",justifyContent:"center",padding:"0 8px",borderRadius:"var(--mantine-radius-md)",border:"none",backgroundColor:s==="icons"?"var(--mantine-color-gray-1)":"transparent",color:n==="icons"?"var(--mantine-color-gray-9)":"var(--mantine-color-gray-6)",cursor:"pointer"},fw:500,fz:"var(--mantine-font-size-sm)",children:e.jsx(t.Group,{gap:4,children:"Icons"})})}),e.jsx(t.Tabs.Tab,{value:"image",p:0,pb:"xs",onClick:()=>o("image"),onMouseEnter:()=>r("image"),onMouseLeave:()=>r(null),style:{backgroundColor:"transparent"},children:e.jsx(t.Box,{style:{height:"24px",display:"flex",alignItems:"center",justifyContent:"center",padding:"0 8px",borderRadius:"var(--mantine-radius-md)",border:"none",backgroundColor:s==="image"?"var(--mantine-color-gray-1)":"transparent",color:n==="image"?"var(--mantine-color-gray-9)":"var(--mantine-color-gray-6)",cursor:"pointer"},fw:500,fz:"var(--mantine-font-size-sm)",children:e.jsx(t.Group,{gap:4,children:"Image"})})}),a&&i&&e.jsx(t.Group,{justify:"flex-end",display:"flex",flex:1,pb:"xs",children:e.jsx(t.Box,{style:{height:"24px",display:"flex",alignItems:"center",justifyContent:"center",padding:"0 8px",borderRadius:"var(--mantine-radius-md)",border:"none",backgroundColor:c?"var(--mantine-color-red-0)":"transparent",color:c?"var(--mantine-color-red-6)":"var(--mantine-color-gray-6)",cursor:"pointer",transition:"all 0.1s ease"},fw:500,fz:"var(--mantine-font-size-sm)",onClick:a,onMouseEnter:()=>d(!0),onMouseLeave:()=>d(!1),children:"Remove"})})]}),e.jsx(t.Tabs.Panel,{value:"emoji",children:n==="emoji"?l:null}),e.jsx(t.Tabs.Panel,{value:"icons",children:n==="icons"?l:null}),e.jsx(t.Tabs.Panel,{value:"image",children:n==="image"?l:null})]})};let st=!1;st||(lt.init({data:Oe}),st=!0);const co=()=>{const n=[{id:"frequent",name:"Frequently Used",icon:e.jsx(T.IconClock,{size:20,strokeWidth:2.5})}];return Oe.categories.forEach(s=>{if(s.emojis&&s.emojis.length>0){let o=e.jsx(T.IconMoodSmile,{size:20,strokeWidth:2}),r=s.name;switch(s.id){case"people":o=e.jsx(T.IconMoodSmile,{size:20,strokeWidth:2}),r="Smileys & People";break;case"nature":o=e.jsx(T.IconTrees,{size:20,strokeWidth:2}),r="Animals & Nature";break;case"foods":o=e.jsx(T.IconApple,{size:20,strokeWidth:2}),r="Food & Drink";break;case"activity":o=e.jsx(T.IconBallBasketball,{size:20,strokeWidth:2}),r="Activities";break;case"travel":o=e.jsx(T.IconPlane,{size:20,strokeWidth:2}),r="Travel & Places";break;case"places":o=e.jsx(T.IconPlane,{size:20,strokeWidth:2}),r="Travel & Places";break;case"objects":o=e.jsx(T.IconBulb,{size:20,strokeWidth:2}),r="Objects";break;case"symbols":o=e.jsx(T.IconHeart,{size:20,strokeWidth:2}),r="Symbols";break;case"flags":o=e.jsx(T.IconFlag,{size:20,strokeWidth:2}),r="Flags";break;case"frequent":return;default:o=e.jsx(T.IconMoodSmile,{size:20,strokeWidth:2}),r=`Category: ${s.id}`;break}n.push({id:s.id,name:r,icon:o})}}),n},lo=({onEmojiSelect:n,height:s=200})=>{const[o,r]=u.useState(""),[a,i]=u.useState("people"),[l,c]=u.useState(()=>{if(typeof window<"u"){const g=localStorage.getItem("emoji-frequent");return g?JSON.parse(g):[]}return[]}),[d,f]=u.useState([]),[x,m]=u.useState(!1),h=co();u.useEffect(()=>{o.trim()?(m(!0),lt.SearchIndex.search(o).then(g=>{f(g.map(b=>({id:b.id,native:b.skins[0].native,name:b.name,keywords:b.keywords}))),m(!1)})):f([])},[o]);const I=u.useMemo(()=>{if(o.trim())return d;if(a==="frequent")return l.map(b=>({id:b,native:b,name:"",keywords:[]}));const g=Oe.categories.find(b=>b.id===a);return g?g.emojis.map(b=>{const v=Oe.emojis[b];return{id:v.id,native:v.skins[0].native,name:v.name,keywords:v.keywords}}):[]},[o,a,l,d]),p=g=>{n(g),c(b=>{const v=b.filter(w=>w!==g),C=[g,...v].slice(0,20);return typeof window<"u"&&localStorage.setItem("emoji-frequent",JSON.stringify(C)),C})},y=g=>{if(o.trim())return"Results";const b=h.find(v=>v.id===g);return b?b.name:g.charAt(0).toUpperCase()+g.slice(1)};return e.jsxs(t.Stack,{gap:0,style:{height:s,width:"100%"},children:[e.jsx(t.Box,{p:"sm",pb:"xs",children:e.jsxs(t.Stack,{gap:"xs",children:[e.jsx(t.TextInput,{placeholder:"Search emojis...",value:o,onChange:g=>r(g.target.value),leftSection:e.jsx(T.IconSearch,{size:16,strokeWidth:2.5}),fw:500,size:"sm",radius:"md",styles:{input:{backgroundColor:"var(--mantine-color-gray-0)",color:"var(--mantine-color-gray-9)"}}}),e.jsx(t.Text,{size:"sm",c:"var(--mantine-color-gray-6)",ta:"left",fw:500,children:y(a)})]})}),e.jsx(t.Box,{style:{flex:1,overflow:"hidden"},children:e.jsx(t.ScrollArea,{h:"100%",type:"hover",offsetScrollbars:!1,children:e.jsx(t.Box,{style:{display:"grid",gridTemplateColumns:"repeat(9, 1fr)",gap:"0px",padding:"0px 12px 12px 12px"},children:x?e.jsx(t.Text,{size:"sm",c:"dimmed",ta:"center",py:"xl",style:{gridColumn:"1 / -1"},children:"Searching..."}):I.length>0?I.map(g=>e.jsx(t.Tooltip,{label:g.name||g.id,position:"top",withArrow:!0,openDelay:300,withinPortal:!0,zIndex:1e3,color:"dark",children:e.jsx(t.Button,{variant:"subtle",size:"sm",p:0,onClick:()=>p(g.native),style:{width:"40px",height:"40px",fontSize:"22px",border:"none",backgroundColor:"transparent",borderRadius:"var(--mantine-radius-md)",display:"flex",alignItems:"center",justifyContent:"center"},onMouseEnter:b=>{b.currentTarget.style.backgroundColor="var(--mantine-color-gray-1)"},onMouseLeave:b=>{b.currentTarget.style.backgroundColor="transparent"},children:g.native})},g.id)):e.jsx(t.Text,{size:"sm",c:"dimmed",ta:"center",py:"xl",style:{gridColumn:"1 / -1"},children:"No emojis found"})})})}),e.jsx(t.Box,{px:"sm",py:"xs",style:{borderTop:"1px solid var(--mantine-color-gray-3)"},children:e.jsx(t.Flex,{gap:"0px",justify:"center",wrap:"wrap",children:h.map(g=>e.jsx(t.Tooltip,{label:g.name,position:"top",withArrow:!0,openDelay:500,withinPortal:!0,zIndex:1e3,color:"dark",children:e.jsx(t.Box,{onClick:()=>{i(g.id),r("")},style:{width:"40px",height:"40px",display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"var(--mantine-radius-md)",cursor:"pointer","&:hover":{backgroundColor:"var(--mantine-color-gray-0)"},backgroundColor:a===g.id?"var(--mantine-color-gray-0)":"transparent",color:a===g.id?"var(--mantine-color-blue-6)":"var(--mantine-color-gray-6)",transition:"all 0.1s ease"},onMouseEnter:b=>{b.currentTarget.style.backgroundColor="var(--mantine-color-gray-1)"},onMouseLeave:b=>{b.currentTarget.style.backgroundColor="transparent"},children:g.icon})},g.id))})})]})},bt=["IconUser","IconUserCircle","IconUserCheck","IconUserX","IconUserPlus","IconUserMinus","IconUserEdit","IconUserCog","IconUserShield","IconUserStar","IconUserSearch","IconUserQuestion","IconUserOff","IconUsers","IconUserBolt","IconUserCode","IconUserDollar","IconUserExclamation","IconUserFilled","IconUserHexagon","IconUserKey","IconUserPause","IconUserPin","IconUserPlay","IconUserScan","IconUserShare","IconUserSquare","IconUserUp","IconUserVoice","IconUserWrench"],wt=["IconBriefcase","IconBuilding","IconBuildingStore","IconBuildingBank","IconBuildingWarehouse","IconBuildingSkyscraper","IconBuildingBridge","IconBuildingCar","IconBuildingFactory","IconBuildingHospital","IconBuildingMonument","IconBuildingPavilon","IconBuildingTunnel","IconBuildingWindmill","IconChartBar","IconChartLine","IconChartPie","IconChartDots","IconChartArea","IconChartArcs","IconChartCandle","IconChartDonut","IconChartRadar","IconTrendingUp","IconTrendingDown","IconTarget","IconFlag","IconTrophy","IconAward","IconMedal","IconCertificate","IconBadge","IconCrown","IconStar","IconStarFilled","IconStarHalf","IconStarOff","IconFileText","IconFile","IconFileAlert","IconFileAnalytics","IconFileBarcode","IconFileBroken","IconFileCertificate","IconFileChart","IconFileCheck","IconFileCode","IconFileDatabase","IconFileDollar","IconFileDownload","IconFileEuro","IconFileExport","IconFileFunction","IconFileImport","IconFileInfo","IconFileInvoice","IconFileLambda","IconFileLike","IconFileMinus","IconFileMusic","IconFileOff","IconFilePencil","IconFilePhone","IconFilePlus","IconFileReport","IconFileRss","IconFileScissors","IconFileSearch","IconFileSettings","IconFileShredder","IconFileSignal","IconFileSpreadsheet","IconFileStar","IconFileSymlink","IconFileTime","IconFileType","IconFileTypography","IconFileUnknown","IconFileUpload","IconFileVector","IconFileX","IconFileZip","IconFolder","IconFolderOpen","IconFolderPlus","IconFolderMinus","IconFolderX","IconFolderCheck","IconFolderCog","IconFolderDown","IconFolderHeart","IconFolderOff","IconFolderPause","IconFolderPin","IconFolderQuestion","IconFolderSearch","IconFolderShare","IconFolderStar","IconFolderUp","IconFolderWrench","IconArchive","IconArchiveOff","IconBox","IconBoxMultiple","IconBoxOff","IconBoxPadding","IconBoxSeam","IconBriefcaseOff","IconClipboard","IconClipboardCheck","IconClipboardCopy","IconClipboardData","IconClipboardHeart","IconClipboardList","IconClipboardOff","IconClipboardPaste","IconClipboardText","IconClipboardTypography","IconClipboardX","IconCopy","IconCut","IconPaste","IconDuplicate","IconEdit","IconEditCircle","IconEditCircleOff"],St=["IconDeviceDesktop","IconDeviceLaptop","IconDeviceMobile","IconDeviceTablet","IconDeviceWatch","IconDeviceTv","IconDeviceGamepad","IconDeviceAirpods","IconDeviceImac","IconDeviceIpad","IconDeviceIphone","IconDeviceMacbook","IconDeviceNintendo","IconDevicePlaystation","IconDeviceXbox","IconCode","IconTerminal","IconDatabase","IconServer","IconWifi","IconBluetooth","IconCpu","IconKeyboard","IconMouse","IconCamera","IconVideo","IconMicrophone","IconSpeaker","IconHeadphones","IconPrinter","IconScanner","IconRouter","IconModem","IconAntenna","IconSatellite","IconRadar","IconRadar2","IconBroadcast","IconBroadcastOff","IconRadio","IconRadioactive","IconRadioactiveOff","IconSignal","IconSignal4G","IconSignal5G","IconSignalOff","IconBattery","IconBattery1","IconBattery2","IconBattery3","IconBattery4","IconBatteryOff","IconBatteryCharging","IconBatteryAutomotive","IconBatteryEco","IconBatteryFilled","IconPlug","IconPlugConnected","IconPlugConnectedX","IconPlugOff","IconPlugX","IconPower","IconPowerOff","IconOutlet","IconCable","IconCableOff","IconCircuitAmmeter","IconCircuitBattery","IconCircuitBulb","IconCircuitCapacitor","IconCircuitCell","IconCircuitCellPlus","IconCircuitChangeover","IconCircuitDiode","IconCircuitDiodeZener","IconCircuitGround","IconCircuitGroundDigital","IconCircuitInductor","IconCircuitMotor","IconCircuitPushbutton","IconCircuitResistor","IconCircuitSwitchClosed","IconCircuitSwitchOpen","IconCircuitVoltmeter","IconCpu2","IconCpuOff","IconMemory","IconMemoryCard","IconMemoryStick","IconHardDrive","IconHardDrive2","IconDisk","IconDiskOff","IconCd","IconCdOff","IconDvd","IconDvdOff","IconFloppyDisk","IconFloppyDiskOff","IconUsb","IconUsbOff","IconSdCard","IconSdCardOff","IconCloud","IconCloudComputing","IconCloudDataConnection","IconCloudDownload","IconCloudLock","IconCloudOff","IconCloudRain","IconCloudSnow","IconCloudStorm","IconCloudUpload","IconCloudCheck","IconCloudCode","IconCloudCog","IconCloudDollar","IconCloudDown","IconCloudExclamation","IconCloudHeart","IconCloudMinus","IconCloudPause","IconCloudPin","IconCloudPlus","IconCloudQuestion","IconCloudSearch","IconCloudShare","IconCloudStar","IconCloudUp","IconCloudX"],kt=["IconMoodSmile","IconMoodHappy","IconMoodWink","IconMoodSad","IconMoodConfused","IconMoodAnnoyed","IconMoodAngry","IconMoodCry","IconMoodTongue","IconMoodKiss","IconMoodHeart","IconMoodLove","IconMoodEmpty","IconMoodNervous","IconMoodSuprised","IconMoodSilence","IconMoodSick","IconMoodTongueWink","IconMoodTongueWink2","IconMoodWink2","IconHeart","IconHeartFilled","IconHeartBroken","IconHeartHandshake","IconHeartMinus","IconHeartOff","IconHeartPlus","IconHeartRateMonitor","IconThumbUp","IconThumbDown","IconSmile","IconFrown","IconMeh","IconLaugh","IconWink","IconKiss","IconTongue","IconGrin","IconSmirk"],Ct=["IconTrees","IconLeaf","IconFlower","IconPlant","IconSun","IconMoon","IconStar","IconCloud","IconCloudRain","IconCloudSnow","IconSnowflake","IconDroplet","IconFlame","IconMountain","IconTree","IconPineTree","IconBug","IconButterfly","IconFish","IconBird","IconCat","IconDog","IconRabbit","IconPaw","IconPawprint","IconFeather","IconSeeding","IconSeedingOff","IconPlant2","IconPlantOff","IconLeafOff","IconFlower2","IconFlowerOff","IconTreesOff","IconTreeOff","IconPineTreeOff","IconPalmTree","IconPalmTreeOff","IconSunOff","IconSunHigh","IconSunLow","IconMoonOff","IconMoonStars","IconMoon2","IconMoonFilled","IconStars","IconStarsOff","IconStarFilled","IconStarHalf","IconStarOff","IconCloudOff","IconCloudStorm","IconCloudFog","IconCloudWind","IconSnowflakeOff","IconDropletOff","IconDropletFilled","IconDropletHalf","IconDropletHalf2","IconDropletHalfFilled","IconFlameOff","IconFire","IconFireExtinguisher","IconMountainOff","IconMountain2","IconHills","IconHillsOff","IconValley","IconValleyOff","IconBugOff","IconButterflyOff","IconBee","IconBeeOff","IconSpider","IconSpiderOff","IconAnt","IconAntOff","IconLadybug","IconLadybugOff","IconGrasshopper","IconGrasshopperOff","IconCricket","IconCricketOff","IconFishOff","IconFishBone","IconFishBoneOff","IconShark","IconSharkOff","IconWhale","IconWhaleOff","IconDolphin","IconDolphinOff","IconOctopus","IconOctopusOff","IconSeahorse","IconSeahorseOff","IconBirdOff","IconEagle","IconEagleOff","IconOwl","IconOwlOff","IconParrot","IconParrotOff","IconPeacock","IconPeacockOff","IconPenguin","IconPenguinOff","IconSwan","IconSwanOff","IconCatOff","IconDogOff","IconRabbitOff","IconFeatherOff","IconWing","IconWingOff","IconEgg","IconEggOff","IconEggCracked","IconEggCrackedOff","IconEggFilled","IconEggFilledOff","IconEggFried","IconEggFriedOff","IconNest","IconNestOff","IconNestEggs","IconNestEggsOff"],Mt=["IconCircle","IconSquare","IconTriangle","IconDiamond","IconHexagon","IconPentagon","IconOctagon","IconCross","IconPlus","IconMinus","IconCheck","IconX","IconArrowUp","IconArrowDown","IconArrowLeft","IconArrowRight","IconArrowUpLeft","IconArrowUpRight","IconArrowDownLeft","IconArrowDownRight","IconArrowLeftUp","IconArrowLeftDown","IconArrowRightUp","IconArrowRightDown","IconPlay","IconPause","IconStop","IconRecord","IconSkipBack","IconSkipForward","IconRewind","IconFastForward","IconCircleDot","IconCircleFilled","IconCircleHalf","IconCircleHalf2","IconCircleHalfFilled","IconCircleOff","IconCircleX","IconSquareDot","IconSquareFilled","IconSquareHalf","IconSquareHalfFilled","IconSquareOff","IconSquareRounded","IconSquareRoundedDot","IconSquareRoundedFilled","IconSquareRoundedHalf","IconSquareRoundedHalfFilled","IconSquareRoundedOff","IconSquareRoundedX","IconSquareX","IconTriangleFilled","IconTriangleInverted","IconTriangleInvertedFilled","IconTriangleOff","IconTriangleSquare","IconTriangleSquareCircle","IconDiamondFilled","IconDiamondOff","IconHexagonFilled","IconHexagonOff","IconPentagonFilled","IconPentagonOff","IconOctagonFilled","IconOctagonOff","IconCrossOff","IconPlusMinus","IconMinusMinus","IconCheckbox","IconCheckboxOff","IconChecks","IconXbox","IconXboxOff","IconYinYang","IconYinYangOff","IconYoga","IconYogaOff","IconZodiac","IconZodiacOff","IconZoom","IconZoomCancel","IconZoomCode","IconZoomExclamation","IconZoomFilled","IconZoomIn","IconZoomInArea","IconZoomInAreaFilled","IconZoomInFilled","IconZoomMoney","IconZoomPan","IconZoomQuestion","IconZoomReplace","IconZoomReset","IconZoomScan","IconZoomScanFilled","IconZoomX"],Bt=["IconEdit","IconDelete","IconSave","IconOpen","IconClose","IconAdd","IconRemove","IconSearch","IconFilter","IconSort","IconRefresh","IconReload","IconUndo","IconRedo","IconCut","IconCopy","IconPaste","IconDuplicate","IconMove","IconRotate","IconFlip","IconResize","IconScale","IconCrop","IconTransform","IconWrench","IconHammer","IconScrewdriver","IconTool","IconTools","IconSaw","IconDrill","IconDrillOff","IconAxe","IconAxeOff","IconPickaxe","IconPickaxeOff","IconShovel","IconShovelOff","IconRake","IconRakeOff","IconHoe","IconHoeOff","IconScythe","IconScytheOff","IconPitchfork","IconPitchforkOff","IconFork","IconForkOff","IconKnife","IconKnifeOff","IconSword","IconSwordOff","IconDagger","IconDaggerOff","IconSpear","IconSpearOff","IconBow","IconBowOff","IconArrow","IconArrowOff","IconCrossbow","IconCrossbowOff","IconGun","IconGunOff","IconPistol","IconPistolOff","IconRifle","IconRifleOff","IconShotgun","IconShotgunOff","IconBomb","IconBombOff","IconGrenade","IconGrenadeOff","IconDynamite","IconDynamiteOff","IconMine","IconMineOff","IconTorpedo","IconTorpedoOff","IconMissile","IconMissileOff","IconRocket","IconRocketOff","IconBazooka","IconBazookaOff","IconCannon","IconCannonOff","IconTank","IconTankOff","IconHelicopter","IconHelicopterOff","IconPlane","IconPlaneOff","IconJet","IconJetOff","IconSatellite","IconSatelliteOff","IconSpace","IconSpaceOff","IconGalaxy","IconGalaxyOff","IconPlanet","IconPlanetOff","IconEarth","IconEarthOff","IconMoon","IconMoonOff","IconSun","IconSunOff","IconStar","IconStarOff","IconAsteroid","IconAsteroidOff","IconComet","IconCometOff","IconMeteor","IconMeteorOff","IconUfo","IconUfoOff","IconAlien","IconAlienOff","IconRobot","IconRobotOff","IconAndroid","IconAndroidOff","IconIos","IconIosOff","IconWindows","IconWindowsOff","IconLinux","IconLinuxOff","IconMac","IconMacOff","IconUbuntu","IconUbuntuOff","IconDebian","IconDebianOff","IconRedhat","IconRedhatOff","IconCentos","IconCentosOff","IconFedora","IconFedoraOff","IconSuse","IconSuseOff","IconArch","IconArchOff","IconGentoo","IconGentooOff","IconSlackware","IconSlackwareOff","IconMint","IconMintOff","IconKali","IconKaliOff","IconParrot","IconParrotOff","IconBacktrack","IconBacktrackOff","IconBlackarch","IconBlackarchOff","IconPentoo","IconPentooOff","IconMatriux","IconMatriuxOff","IconNodezero","IconNodezeroOff","IconBugtraq","IconBugtraqOff","IconCyborg","IconCyborgOff","IconDefensive","IconDefensiveOff","IconDracos","IconDracosOff","IconFembuntu","IconFembuntuOff","IconGnacktrack","IconGnacktrackOff","IconHackintosh","IconHackintoshOff","IconHak5","IconHak5Off","IconHavij","IconHavijOff","IconJackal","IconJackalOff","IconKnoppix","IconKnoppixOff","IconKodachi","IconKodachiOff","IconLion","IconLionOff","IconMandriva","IconMandrivaOff","IconMobily","IconMobilyOff","IconMuslim","IconMuslimOff","IconNetrunner","IconNetrunnerOff","IconPardus","IconPardusOff","IconQubes","IconQubesOff","IconSabayon","IconSabayonOff","IconScientific","IconScientificOff","IconSemplice","IconSempliceOff","IconSiduction","IconSiductionOff","IconSlax","IconSlaxOff","IconSli","IconSliOff","IconTails","IconTailsOff","IconVector","IconVectorOff","IconVoid","IconVoidOff","IconWhonix","IconWhonixOff","IconZorin","IconZorinOff","IconAlpine","IconAlpineOff","IconElementary","IconElementaryOff","IconManjaro","IconManjaroOff","IconOpenbsd","IconOpenbsdOff","IconOpenSuse","IconOpenSuseOff","IconPop","IconPopOff","IconSolus","IconSolusOff"],Tt=["IconMessage","IconMessageCircle","IconMessageDots","IconMessagePlus","IconMessageReport","IconMessageShare","IconMessageText","IconMessages","IconMessagesOff","IconMail","IconMailOpened","IconMailFast","IconMailOff","IconMailPause","IconMailPin","IconMailPlus","IconMailQuestion","IconMailSearch","IconMailShare","IconMailStar","IconMailUp","IconMailX","IconPhone","IconPhoneCall","IconPhoneIncoming","IconPhoneOff","IconPhoneOutgoing","IconPhonePause","IconPhonePlus","IconPhoneX","IconVideo","IconVideoOff","IconVideoPlus","IconCamera","IconCameraOff","IconCameraPlus","IconMicrophone","IconMicrophoneOff","IconMicrophone2","IconMicrophone2Off","IconHeadphones","IconHeadphonesOff","IconSpeaker","IconSpeakerOff","IconBroadcast","IconBroadcastOff","IconRadio","IconRadioactive","IconRadioactiveOff","IconAntenna","IconAntennaBars1","IconAntennaBars2","IconAntennaBars3","IconAntennaBars4","IconAntennaBars5","IconAntennaOff","IconSatellite","IconSatelliteOff","IconWifi","IconWifi0","IconWifi1","IconWifi2","IconWifiOff","IconBluetooth","IconBluetoothConnected","IconBluetoothOff","IconBluetoothX","IconShare","IconShareOff","IconShare2","IconShare3","IconAt","IconHash","IconLink","IconLinkOff","IconExternalLink","IconExternalLinkOff","IconSend","IconSendOff","IconSend2","IconReceipt","IconReceiptOff","IconReceipt2","IconReceiptRefund","IconReceiptTax","IconReceiptEuro","IconReceiptDollar","IconReceiptPound","IconReceiptYen","IconReceiptYuan","IconReceiptWon","IconReceiptRupee","IconReceiptBaht","IconReceiptLira","IconReceiptRuble","IconReceiptShekel","IconReceiptTaka","IconReceiptHryvnia","IconReceiptKrone","IconReceiptKrona","IconReceiptZloty","IconReceiptForint","IconReceiptLeu","IconReceiptLev","IconReceiptKuna","IconReceiptDinar","IconReceiptDirham","IconReceiptRial","IconReceiptRiyal","IconReceiptAfghani","IconReceiptAriary","IconReceiptCedi","IconReceiptDalasi","IconReceiptFranc","IconReceiptGourde","IconReceiptKina","IconReceiptKip","IconReceiptKwacha","IconReceiptKwanza","IconReceiptLari","IconReceiptLek","IconReceiptLilangeni","IconReceiptLoti","IconReceiptManat","IconReceiptMetical","IconReceiptNaira","IconReceiptPeso","IconReceiptPula","IconReceiptRand","IconReceiptRupiah","IconReceiptShilling","IconReceiptSom","IconReceiptSomoni","IconReceiptTenge","IconReceiptVatu","IconReceiptWon","IconReceiptXof","IconReceiptYuan","IconReceiptZloty"];[...bt,...wt,...St,...kt,...Ct,...Mt,...Bt,...Tt];const ye=[{id:"recent",name:"Recently Used",icons:[],isDynamic:!0},{id:"user",name:"User & Profile",icons:bt},{id:"business",name:"Business & Work",icons:wt},{id:"tech",name:"Technology",icons:St},{id:"expressions",name:"Expressions",icons:kt},{id:"nature",name:"Nature & Animals",icons:Ct},{id:"shapes",name:"Shapes & Symbols",icons:Mt},{id:"actions",name:"Actions & Tools",icons:Bt},{id:"communication",name:"Communication",icons:Tt}],uo={recent:e.jsx(T.IconClock,{size:20,strokeWidth:2.5}),user:e.jsx(T.IconUser,{size:20,strokeWidth:2.5}),business:e.jsx(T.IconBriefcase,{size:20,strokeWidth:2.5}),tech:e.jsx(T.IconDeviceDesktop,{size:20,strokeWidth:2.5}),expressions:e.jsx(T.IconMoodSmile,{size:20,strokeWidth:2.5}),nature:e.jsx(T.IconTrees,{size:20,strokeWidth:2.5}),shapes:e.jsx(T.IconCircle,{size:20,strokeWidth:2.5}),actions:e.jsx(T.IconTool,{size:20,strokeWidth:2.5}),communication:e.jsx(T.IconMessage,{size:20,strokeWidth:2.5})},fo=({selectedCategory:n,onCategoryChange:s})=>e.jsx(t.Flex,{gap:"0px",justify:"center",wrap:"wrap",children:ye.map(o=>{const r=uo[o.id];return e.jsx(t.Tooltip,{label:o.name,position:"top",withArrow:!0,openDelay:500,withinPortal:!0,zIndex:1e3,color:"dark",children:e.jsx(t.Box,{onClick:()=>s(o.id),style:{width:"40px",height:"40px",display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"var(--mantine-radius-md)",cursor:"pointer",backgroundColor:n===o.id?"var(--mantine-color-gray-0)":"transparent",color:n===o.id?"var(--mantine-color-blue-6)":"var(--mantine-color-gray-6)",transition:"all 0.2s ease"},onMouseEnter:a=>{a.currentTarget.style.backgroundColor="var(--mantine-color-gray-1)"},onMouseLeave:a=>{a.currentTarget.style.backgroundColor=n===o.id?"var(--mantine-color-gray-0)":"transparent"},children:r})},o.id)})}),Ot=u.memo(({onIconSelect:n,height:s=358})=>{var g,b;const[o,r]=u.useState(""),[a,i]=u.useState("recent"),[l,c]=u.useState(!1),[d,f]=u.useState([]);u.useLayoutEffect(()=>{if(typeof window<"u"){const v=localStorage.getItem("avatar-icon-recent");if(v)try{f(JSON.parse(v))}catch(C){console.warn("Error parsing recent icons from localStorage:",C)}}},[]);const x=u.useMemo(()=>ye.filter(v=>v.id!=="recent"&&!("isDynamic"in v)).flatMap(v=>v.icons),[]),m=u.useMemo(()=>{if(a==="recent"){const C=new Set(x);return d.filter(w=>C.has(w))}const v=ye.find(C=>C.id===a);return(v==null?void 0:v.icons)||[]},[a,d,x]),h=u.useCallback((v,C)=>{if(!v.trim())return C;const w=v.toLowerCase().trim(),O=w.split(/\s+/);return C.filter(B=>{const j=B.replace(/^Icon/,"").split(/(?=[A-Z])/).map(M=>M.toLowerCase().trim()).filter(M=>M.length>0);return!!(j.some(M=>O.some(S=>M===S))||w.length>2&&j.some(M=>O.some(S=>M.startsWith(S)))||w.length<=2&&j.some(M=>O.some(S=>M.includes(S)))||O.length>1&&O.every(M=>j.some(S=>S===M||S.startsWith(M))))})},[]),I=u.useMemo(()=>o.trim()?h(o,x):m,[o,m,x,h]),p=u.useCallback(v=>{x.includes(v)&&f(w=>{const O=[v,...w.filter(B=>B!==v)].slice(0,20);return typeof window<"u"&&localStorage.setItem("avatar-icon-recent",JSON.stringify(O)),O}),n(v)},[n,x]),y=u.useCallback(v=>{a!==v&&(r(""),i(v),requestAnimationFrame(()=>{c(!0),setTimeout(()=>c(!1),100)}))},[a]);return e.jsxs(t.Stack,{gap:0,style:{height:s,width:"100%"},children:[e.jsx(t.Box,{p:"sm",pb:"xs",children:e.jsxs(t.Stack,{gap:"xs",children:[e.jsx(t.TextInput,{placeholder:o.trim()?"Search all icons...":`Search in ${(g=ye.find(v=>v.id===a))==null?void 0:g.name}...`,value:o,onChange:v=>r(v.target.value),leftSection:e.jsx(T.IconSearch,{size:16}),fw:500,size:"sm",radius:"md",styles:{input:{backgroundColor:"var(--mantine-color-gray-0)",color:"var(--mantine-color-gray-9)"}}}),e.jsx(t.Text,{size:"sm",c:"var(--mantine-color-gray-6)",ta:"left",fw:500,children:o.trim()?"Results":(b=ye.find(v=>v.id===a))==null?void 0:b.name})]})}),e.jsx(t.Box,{style:{flex:1,overflow:"hidden"},children:e.jsx(t.ScrollArea,{h:"100%",type:"hover",children:e.jsx(t.Box,{style:{display:"grid",gridTemplateColumns:"repeat(8, 1fr)",gap:"4px",padding:"0 12px 12px 12px",opacity:l?.7:1,transition:"opacity 0.05s ease"},children:I.map(v=>e.jsx(ut,{iconName:v,onClick:()=>p(v),size:20},o.trim()?`search-${v}`:`${a}-${v}`))},`${a}-${o}`)})}),e.jsx(t.Box,{px:"sm",py:"xs",style:{borderTop:"1px solid var(--mantine-color-gray-3)"},children:e.jsx(fo,{selectedCategory:a,onCategoryChange:y})})]})});Ot.displayName="IconGrid";const ho=({previewImage:n,fileInputRef:s,selectedEmoji:o,size:r,loading:a,onFileInputClick:i,onImageChange:l,onImageAccept:c,onClearImagePreview:d})=>e.jsx(t.Box,{p:"sm",style:{width:"384px"},children:e.jsxs(t.Stack,{gap:"md",align:"center",children:[n||o?e.jsxs(t.Box,{children:[e.jsx(t.Text,{size:"sm",fw:500,mb:"xs",children:"Preview"}),e.jsx(t.Avatar,{src:n,radius:"md",style:{width:`${xe(r)}px !important`,height:`${xe(r)}px !important`,minWidth:`${xe(r)}px`,minHeight:`${xe(r)}px`,maxWidth:`${xe(r)}px`,maxHeight:`${xe(r)}px`,border:"1px solid var(--mantine-color-gray-4)",objectFit:"cover",boxSizing:"border-box"},children:o})]}):e.jsx(t.Button,{variant:"subtle",bg:"gray.0",styles:{root:{height:"64px"}},leftSection:e.jsx(T.IconPhoto,{size:20}),onClick:i,loading:a,disabled:a,fullWidth:!0,children:"Choose Image"}),n||o?e.jsx(t.Button,{variant:"outline",leftSection:e.jsx(T.IconPhoto,{size:16}),onClick:i,loading:a,disabled:a,fullWidth:!0,children:n||o?"Change Image":"Choose Image"}):null,e.jsx("input",{ref:s,type:"file",accept:"image/jpeg,image/jpg,image/png,image/gif,image/webp",onChange:f=>{var x;return l(((x=f.target.files)==null?void 0:x[0])||null)},style:{display:"none"},disabled:a}),(n||o)&&e.jsxs(t.Group,{gap:"sm",w:"100%",children:[e.jsx(t.Button,{variant:"outline",color:"gray",onClick:d,fullWidth:!0,children:"Back"}),e.jsx(t.Button,{color:"blue",onClick:c,loading:a,disabled:a,fullWidth:!0,children:"Accept"})]}),e.jsx(t.Text,{size:"xs",c:"var(--mantine-color-gray-6)",ta:"center",children:"Supported formats: JPG, PNG, GIF, WebP"})]})}),xo=({onEmojiSelect:n})=>e.jsx(lo,{onEmojiSelect:n,height:358}),po=({onIconSelect:n})=>e.jsx(Ot,{onIconSelect:n,height:358}),mo=({previewImage:n,selectedEmoji:s,size:o,loading:r,onFileInputClick:a,onImageChange:i,onImageAccept:l,onClearImagePreview:c,fileInputRef:d})=>e.jsx(ho,{previewImage:n,fileInputRef:d,selectedEmoji:s,size:o,loading:r,onFileInputClick:a,onImageChange:i,onImageAccept:l,onClearImagePreview:c}),go=()=>e.jsx(t.Box,{style:{width:400,height:358,display:"flex",alignItems:"center",justifyContent:"center"},children:e.jsxs(t.Stack,{align:"center",gap:"sm",children:[e.jsx(t.Loader,{size:"sm"}),e.jsx(t.Text,{size:"sm",c:"gray.6",children:"Loading avatar options..."})]})}),Le=({editable:n=!0,opened:s,onOpen:o,onClose:r,avatar:a,onAvatarSelect:i,onRemove:l,size:c="lg",loading:d=!1,placeholder:f,showPlaceholder:x=!0,position:m="bottom-start",withinPortal:h=!0,zIndex:I=1e3})=>{const p=u.useRef(null),y=u.useRef(null),g=u.useRef(null),{selectedTab:b,tabHovered:v,previewImage:C,selectedEmoji:w,selectedIcon:O,selectedFile:B,handleTabChange:k,handleTabHover:j,handleImagePreview:M,handleImageAccept:S,handleEmojiSelect:z,handleIconSelect:D,clearImagePreview:F,resetState:H}=so({onAvatarSelect:i});ao({opened:s,onClose:r,popoverRef:y}),u.useEffect(()=>{s||H()},[s,H]);const P=X=>{console.log("Emoji clicked:",X),z(X),r()},L=X=>{console.log("Icon clicked:",X),D(X),r()},_=X=>{X&&M(X)},N=()=>{B?(S(),r()):(w||O)&&r()},U=()=>{p.current&&p.current.click()},V=()=>{F()},G=()=>{console.log("Avatar removed"),l==null||l(),r()},R=()=>!!a,E=()=>d?e.jsx(ze,{size:c,loading:!0}):e.jsx(se,{avatar:a,size:c,placeholder:f,showPlaceholder:x,editable:!0,onClick:()=>{!d&&!s&&o()}}),A=e.jsx(xo,{onEmojiSelect:P}),W=e.jsx(po,{onIconSelect:L}),Q=e.jsx(mo,{previewImage:C,selectedEmoji:w,size:c,loading:d,onFileInputClick:U,onImageChange:_,onImageAccept:N,onClearImagePreview:V,fileInputRef:p}),te=e.jsx(t.Box,{children:e.jsx(io,{selectedTab:b,tabHovered:v,onTabChange:k,onTabHover:j,onRemove:G,hasAvatar:R(),children:b==="emoji"?A:b==="icons"?W:Q})}),$=e.jsx("div",{style:{position:"relative",display:"inline-block"},children:e.jsxs(t.Popover,{opened:s,onClose:()=>{console.log("Popover onClose called"),r()},position:m,withinPortal:h,withArrow:!0,shadow:"md",radius:"md",closeOnClickOutside:!1,closeOnEscape:!1,offset:8,children:[e.jsx(t.Popover.Target,{children:e.jsx("div",{ref:g,style:{position:"relative"},children:E()})}),e.jsx(t.Popover.Dropdown,{ref:y,p:0,style:{width:"auto",overflow:"hidden",zIndex:I},children:e.jsx(u.Suspense,{fallback:e.jsx(go,{}),children:te})})]})}),oe=e.jsx(se,{avatar:a,size:c,placeholder:f,showPlaceholder:x});return e.jsx(e.Fragment,{children:n?$:oe})},Io=n=>{if(!n||typeof n!="string")return!1;const s=/^[^\s@]+@[^\s@]+\.[^\s@]+$/;return n.length<5||n.length>254?!1:s.test(n.trim())},yo=n=>{const s=[];return n.forEach(o=>{Io(o)||s.push({email:o,error:"Please enter a valid email address"})}),{isValid:s.length===0,errors:s}},vo=n=>{const s=[],o=new Set;return n.forEach(r=>{const a=r.toLowerCase().trim();o.has(a)?s.push({email:r,error:"This email has already been added"}):o.add(a)}),s},jo=n=>{const s=yo(n),o=vo(n),r=[...s.errors,...o];return{isValid:r.length===0,errors:r}},bo=({value:n,onChange:s,onInputChange:o,suggestedUsers:r=[],tagDisplayMap:a={}})=>{const[i,l]=u.useState(""),[c,d]=u.useState([]),f=u.useRef(null),x=n.map(y=>{if(a[y])return a[y];const g=r.find(b=>b.email===y);return g&&g.name?g.name:y});u.useEffect(()=>{o&&o(i)},[i,o]),u.useEffect(()=>{if(n.length>0){const y=jo(n);d(y.errors)}else d([])},[n]),u.useEffect(()=>{const y=f.current;if(!y)return;let g;const b=v=>{const w=v.target.value||"";clearTimeout(g),g=setTimeout(()=>{l(w)},150)};return y.addEventListener("input",b),()=>{y.removeEventListener("input",b),clearTimeout(g)}},[]);const m=u.useCallback(y=>{const g=r.map(v=>({name:v.name||v.email,email:v.email})),b=y.map(v=>{const C=g.find(w=>w.name.toLowerCase()===v.toLowerCase());return C?C.email:v}).filter(v=>v.includes("@")?!0:!g.some(w=>{const O=w.name.toLowerCase(),B=v.toLowerCase();return O.startsWith(B)&&B!==O}));s(b),l("")},[s,r]),h=u.useCallback(()=>{f.current&&(f.current.value="",l(""))},[]),I=c.length===0&&n.length>0,p=u.useCallback((y,g,b)=>{y&&n.length>0&&g&&(y(n,g,b),l(""))},[n]);return{inputText:i,tagsInputRef:f,displayValue:x,validationErrors:c,isValid:I,handleEmailChange:m,clearInput:h,handleInvite:p}},zt=({onInvite:n,onUpdateRole:s,onRemoveUser:o,invitedUsers:r=[],suggestedUsers:a=[],roleOptions:i=[]})=>{const[l,c]=u.useState([]),[d,f]=u.useState([]),[x,m]=u.useState(""),[h,I]=u.useState({}),p=i.length>0?i[0].value:void 0,[y,g]=u.useState(p);u.useEffect(()=>{i.length>0&&!y&&g(i[0].value)},[i.length,y]),u.useEffect(()=>{const z=a.filter(D=>l.includes(D.email)).map(D=>D.id);f(D=>D.filter(F=>z.includes(F)))},[l,a.length]);const[b,v]=u.useState("invite"),[C,w]=u.useState(null),O=(z,D,F)=>{n&&n(z,D,F),c([]),m("")},B=(z,D)=>{s&&s(z,D)},k=z=>{o&&o(z)},j=z=>{f(D=>D.includes(z)?D.filter(F=>F!==z):[...D,z])},M=z=>{l.includes(z.email)||(c([...l,z.email]),I(D=>({...D,[z.email]:z.name||z.email})),d.includes(z.id)||f([...d,z.id]),m(""))},S=x.trim()?a.filter(z=>{var F;const D=x.toLowerCase();return z.email.toLowerCase().includes(D)||((F=z.name)==null?void 0:F.toLowerCase().includes(D))}):[];return{emails:l,setEmails:c,selectedUsers:d,setSelectedUsers:f,inputText:x,setInputText:m,tagDisplayMap:h,setTagDisplayMap:I,selectedRole:y,setSelectedRole:g,selectedTab:b,setSelectedTab:v,tabHovered:C,setTabHovered:w,filteredUsers:S,handleInvite:O,handleUpdateRole:B,handleRemoveUser:k,handleToggleUser:j,handleAddSuggestedUser:M}},Rt=u.forwardRef(({value:n,onChange:s,placeholder:o="Add one or more emails",onInvite:r,roleOptions:a=[],selectedRole:i,onRoleChange:l,onInputChange:c,suggestedUsers:d=[],tagDisplayMap:f={}},x)=>{const[m,h]=u.useState("Hello, I would like to invite you to join my workspace"),{tagsInputRef:I,displayValue:p,validationErrors:y,isValid:g,handleEmailChange:b,clearInput:v,handleInvite:C}=bo({value:n,onChange:s,onInputChange:c,suggestedUsers:d,tagDisplayMap:f}),w=()=>{C(r,i,m),h("")};u.useImperativeHandle(x,()=>({clearInput:v}),[v]);const O=p.length>0,B=l&&a.length>0,k=y.length>0;return e.jsxs(t.Stack,{gap:"md",children:[e.jsxs(t.Box,{children:[e.jsx(t.Box,{style:{maxHeight:"120px",overflowY:"auto",overflowX:"hidden",paddingRight:"8px",marginRight:"-8px"},children:e.jsx(t.TagsInput,{ref:I,value:p,onChange:b,placeholder:O?"":o,radius:"md",rightSection:B?e.jsx(t.Box,{style:{position:"absolute",right:"8px",top:"17px",transform:"translateY(-50%)",height:"24px",display:"flex",alignItems:"center"},children:e.jsx(Ae,{value:i||"",onChange:j=>l(j),data:a,placeholder:"Select role",defaultOption:a[a.length-1],disabledOptions:["owner"]})}):null,rightSectionProps:{style:{width:B?"120px":"0px",position:"absolute",height:"32px",right:"8px"}},styles:{input:{paddingRight:B?"130px":"12px",minHeight:"36px",display:"flex",flexWrap:"wrap",alignItems:"center",gap:"4px",borderRadius:"var(--mantine-radius-md)",border:k?"2px solid var(--mantine-color-red-6)":"2px solid var(--mantine-color-blue-7)",backgroundColor:"var(--mantine-color-gray-0)"},pillsList:{height:"24px !important",borderRadius:"var(--mantine-radius-md) !important"},pill:{height:"24px !important",borderRadius:"var(--mantine-radius-md) !important",backgroundColor:k?"var(--mantine-color-red-1) !important":"var(--mantine-color-orange-1) !important",color:k?"var(--mantine-color-red-7) !important":"var(--mantine-color-gray-7) !important",fontSize:"var(--mantine-font-size-sm)"}}})}),k&&e.jsx(t.Stack,{gap:"xs",mt:"xs",children:y.map((j,M)=>e.jsxs(t.Text,{size:"xs",c:"red",children:[j.email,": ",j.error]},M))})]}),O&&e.jsxs(t.Stack,{gap:"sm",children:[e.jsx(t.Textarea,{size:"sm",value:m,onChange:j=>h(j.currentTarget.value),minRows:2,maxRows:4,radius:"md"}),e.jsx(t.Button,{variant:"filled",color:"blue",onClick:w,fullWidth:!0,radius:"md",disabled:!g,children:"Send invitations"})]})]})}),wo=n=>{switch(n){case"member":return"green";case"invited":return"orange";case"declined":return"red";case"revoked":return"red";case"expired":return"red";default:return"gray"}},So=n=>{switch(n){case"member":return"Member";case"invited":return"Invited";case"declined":return"Declined";case"revoked":return"Revoked";case"expired":return"Expired";default:return"Unknown"}},ko=n=>{if(n){if(typeof n=="object"&&"type"in n)return n;if(typeof n=="string")return{type:"image",value:n}}},be=({user:n,isSelected:s=!1,onToggle:o,onUpdateRole:r,onRemoveUser:a,roleOptions:i=[],variant:l="invited",onClick:c})=>{var g;const d=((g=n.name)==null?void 0:g.trim())||n.email,f=()=>{o&&o(n.id)},x=b=>{if(r){const v=b;r(n.id,v)}},m=l==="suggested"||l==="read-only",h=l==="invited"&&i.length>0,[I,p]=u.useState(!1),y=()=>{c==null||c()};return e.jsxs(t.Group,{justify:"space-between",align:"center",wrap:"nowrap",w:"100%",style:{cursor:"pointer",borderRadius:"var(--mantine-radius-md)",padding:"6px"},onClick:y,bg:I?"var(--mantine-color-gray-0)":"transparent",onMouseEnter:()=>p(!0),onMouseLeave:()=>p(!1),children:[e.jsxs(t.Group,{gap:"sm",w:"100%",align:"flex-start",wrap:"nowrap",children:[e.jsx(se,{avatar:ko(n.avatar),size:"md",placeholder:d,showPlaceholder:!0}),e.jsxs(t.Stack,{gap:0,w:"100%",justify:"flex-start",align:"flex-start",children:[e.jsxs(t.Group,{gap:"sm",align:"flex-start",wrap:"nowrap",children:[e.jsxs(t.Group,{gap:"sm",align:"flex-start",wrap:"nowrap",children:[e.jsx(t.Text,{size:"sm",fw:500,lineClamp:1,mb:-2,children:d}),n.isCurrentUser&&e.jsx(t.Badge,{size:"xs",variant:"light",color:"gray",radius:"sm",children:"Owner"})]}),n.status!=="member"&&e.jsx(t.Badge,{size:"xs",variant:"light",color:wo(n.status),radius:"sm",children:So(n.status)})]}),e.jsx(t.Text,{size:"xs",c:"dimmed",lineClamp:1,children:n.email})]})]}),e.jsxs(t.Group,{gap:"sm",align:"center",children:[m&&l!=="read-only"&&e.jsx(t.Radio,{checked:s,onChange:f,size:"sm",onClick:b=>b.stopPropagation(),pr:4}),h&&!n.isCurrentUser&&e.jsx(Ae,{value:n.role,onChange:x,data:i,placeholder:"Select role",defaultOption:i.find(b=>b.value===n.role),withRemove:!0,onRemove:()=>a==null?void 0:a(n.id)})]})]})},Dt=({opened:n,onClose:s,onInvite:o,onUpdateRole:r,onRemoveUser:a,invitedUsers:i=[],children:l,roleOptions:c=[],suggestedUsers:d=[]})=>{const f=u.useRef(null),{emails:x,setEmails:m,selectedUsers:h,inputText:I,setInputText:p,tagDisplayMap:y,selectedRole:g,setSelectedRole:b,selectedTab:v,setSelectedTab:C,tabHovered:w,setTabHovered:O,filteredUsers:B,handleInvite:k,handleUpdateRole:j,handleRemoveUser:M,handleToggleUser:S,handleAddSuggestedUser:z}=zt({onInvite:o,onUpdateRole:r,onRemoveUser:a,invitedUsers:i,suggestedUsers:d,roleOptions:c}),D=L=>{z(L),f.current&&f.current.clearInput()},F=e.jsxs(e.Fragment,{children:[e.jsx(Rt,{ref:f,value:x,onChange:m,onInvite:k,roleOptions:c,selectedRole:g,onRoleChange:b,onInputChange:p,suggestedUsers:d,tagDisplayMap:y}),e.jsx(t.Space,{h:"sm"}),e.jsx(t.ScrollArea,{mah:200,type:"auto",style:{overflow:"visible"},children:e.jsx(t.Box,{children:i.length>0&&e.jsxs(e.Fragment,{children:[e.jsx(t.Text,{size:"sm",fw:500,children:"Already members"}),e.jsx(t.Space,{h:"sm"}),e.jsx(t.Stack,{gap:"sm",children:i.map(L=>e.jsx(be,{user:L,isSelected:h.includes(L.id),onToggle:S,onUpdateRole:j,onRemoveUser:M,roleOptions:c,variant:"invited"},L.id))})]})})}),B.length>0&&e.jsx(t.ScrollArea,{pt:"sm",mah:200,type:"auto",style:{overflow:"visible"},children:e.jsx(t.Box,{children:B.length>0?e.jsxs(e.Fragment,{children:[e.jsxs(t.Text,{size:"sm",fw:500,children:["Suggested ",I.trim()&&`(filtered by "${I}")`]}),e.jsx(t.Space,{h:"sm"}),e.jsx(t.Stack,{gap:"sm",children:B.map(L=>e.jsx(be,{user:L,isSelected:h.includes(L.id),onToggle:S,onUpdateRole:j,onRemoveUser:M,roleOptions:c,variant:"suggested",onClick:()=>D(L)},L.id))})]}):null})})]}),H=e.jsx(e.Fragment,{children:e.jsxs(t.Stack,{gap:"md",p:"sm",children:[e.jsxs(t.Stack,{gap:4,align:"center",children:[e.jsx(t.Text,{size:"sm",fw:500,ta:"center",children:"Publish to the web"}),e.jsx(t.Text,{size:"sm",fw:500,color:"var(--mantine-color-gray-6)",ta:"center",children:"Anyone with the link can view this page"})]}),e.jsx(t.Button,{variant:"filled",size:"xs",radius:"md",fw:500,fz:"var(--mantine-font-size-sm)",ta:"center",children:"Publish"})]})}),P=e.jsx(t.Box,{style:{width:"400px",maxHeight:"600px",overflow:"visible"},children:e.jsx(t.Stack,{gap:"lg",children:e.jsxs(t.Tabs,{color:"black",defaultValue:"invite",styles:{tab:{backgroundColor:"transparent"}},children:[e.jsxs(t.Tabs.List,{px:"var(--mantine-spacing-sm)",pt:"xs",children:[e.jsx(t.Tabs.Tab,{value:"invite",p:0,pb:6,onClick:()=>{C("invite")},onMouseEnter:()=>O("invite"),onMouseLeave:()=>O(null),style:{backgroundColor:"transparent"},children:e.jsx(t.Box,{style:{borderRadius:"var(--mantine-radius-md)",height:"24px",display:"flex",alignItems:"center",justifyContent:"center",padding:"0 8px",border:"none",backgroundColor:w==="invite"?"var(--mantine-color-gray-1)":"transparent",color:v==="invite"?"var(--mantine-color-gray-9)":"var(--mantine-color-gray-6)",cursor:"pointer"},fw:500,fz:"var(--mantine-font-size-sm)",children:"Invite"})}),e.jsx(t.Tabs.Tab,{value:"publish",p:0,pb:6,onClick:()=>{C("publish")},onMouseEnter:()=>O("publish"),onMouseLeave:()=>O(null),style:{backgroundColor:"transparent"},children:e.jsx(t.Box,{style:{height:"24px",display:"flex",alignItems:"center",justifyContent:"center",padding:"0 8px",borderRadius:"var(--mantine-radius-md)",border:"none",backgroundColor:w==="publish"?"var(--mantine-color-gray-1)":"transparent",color:v==="publish"?"var(--mantine-color-gray-9)":"var(--mantine-color-gray-6)",cursor:"pointer"},fw:500,fz:"var(--mantine-font-size-sm)",children:"Publish"})})]}),e.jsx(t.Tabs.Panel,{value:"invite",children:e.jsx(t.Box,{p:"sm",children:F})}),e.jsx(t.Tabs.Panel,{value:"publish",children:e.jsx(t.Box,{p:"sm",children:H})})]})})});return e.jsx(je,{trigger:l,menuItems:[],opened:n,onClose:s,styles:{dropdown:{padding:"0",borderRadius:"var(--mantine-radius-md)"}},children:P})},Co=({onInvite:n,onUpdateRole:s,onRemoveUser:o,invitedUsers:r,currentUser:a,roleOptions:i,suggestedUsers:l,label:c="Share"})=>{const[d,f]=u.useState(!1),x=()=>f(!1),m=e.jsx(Re,{label:c,onClick:()=>f(!0),isActive:d});return e.jsx(Dt,{opened:d,onClose:x,onInvite:n,onUpdateRole:s,onRemoveUser:o,invitedUsers:r,currentUser:a,roleOptions:i,suggestedUsers:l,children:m})},Mo=({opened:n,onClose:s,onInvite:o,onUpdateRole:r,onRemoveUser:a,invitedUsers:i=[],roleOptions:l=[],suggestedUsers:c=[]})=>{const d=u.useRef(null),{emails:f,setEmails:x,selectedUsers:m,inputText:h,setInputText:I,tagDisplayMap:p,selectedRole:y,setSelectedRole:g,filteredUsers:b,handleInvite:v,handleUpdateRole:C,handleRemoveUser:w,handleToggleUser:O,handleAddSuggestedUser:B}=zt({onInvite:o,onUpdateRole:r,onRemoveUser:a,invitedUsers:i,suggestedUsers:c,roleOptions:l}),k=j=>{B(j),d.current&&d.current.clearInput()};return e.jsx(t.Modal,{opened:n,onClose:s,size:"md",withCloseButton:!1,radius:"md",centered:!0,closeOnClickOutside:!1,closeOnEscape:!0,trapFocus:!1,zIndex:300,children:e.jsxs(t.Stack,{gap:"lg",children:[e.jsxs(t.Group,{justify:"space-between",wrap:"nowrap",children:[e.jsx(t.Text,{size:"md",fw:500,c:"var(--mantine-color-gray-8)",children:"Share"}),e.jsx(ee,{icon:T.IconX,size:"md",onClick:s,color:"var(--mantine-color-gray-8)"})]}),e.jsx(Rt,{ref:d,value:f,onChange:x,onInvite:v,roleOptions:l,selectedRole:y,onRoleChange:g,onInputChange:I,suggestedUsers:c,tagDisplayMap:p}),i.length>0&&e.jsxs(t.Box,{children:[e.jsx(t.Text,{size:"sm",fw:500,children:"Already members"}),e.jsx(t.Space,{h:"sm"}),e.jsx(t.Box,{style:{maxHeight:"200px",minHeight:"60px",overflowY:"auto",overflowX:"hidden",paddingRight:"8px",marginRight:"-8px"},children:e.jsx(t.Stack,{gap:"sm",children:i.map(j=>e.jsx(be,{user:j,isSelected:m.includes(j.id),onToggle:O,onUpdateRole:C,onRemoveUser:w,roleOptions:l,variant:"invited"},j.id))})})]}),b.length>0&&e.jsxs(t.Box,{children:[e.jsxs(t.Text,{size:"sm",fw:500,children:["Suggested ",h.trim()&&`(filtered by "${h}")`]}),e.jsx(t.Space,{h:"sm"}),e.jsx(t.Box,{style:{maxHeight:"200px",minHeight:"60px",overflowY:"auto",overflowX:"hidden",paddingRight:"8px",marginRight:"-8px"},children:e.jsx(t.Stack,{gap:"sm",children:b.map(j=>e.jsx(be,{user:j,isSelected:m.includes(j.id),onToggle:O,onUpdateRole:C,onRemoveUser:w,roleOptions:l,variant:"suggested",onClick:()=>k(j)},j.id))})})]})]})})},Bo=({opened:n,onClose:s,options:o=[],onSave:r,onCancel:a,groups:i=[],styles:l})=>{const[c,d]=u.useState("");u.useEffect(()=>{n&&o.length>0?d(o[0].id):n||d("")},[n,o]);const f=()=>{r&&r(),s()},x=()=>{a&&a(),s()},m=()=>{s()},h=o.find(I=>I.id===c);return e.jsxs(t.Modal,{opened:n,onClose:m,size:"90%",centered:!0,closeOnClickOutside:!0,closeOnEscape:!0,withCloseButton:!1,p:"none",styles:{body:{...l==null?void 0:l.body,padding:0,height:"80vh"}},radius:"md",children:[e.jsx(t.FocusTrap.InitialFocus,{}),e.jsxs(t.Box,{style:{display:"flex",height:"100%",...l==null?void 0:l.body},children:[e.jsx(t.Box,{style:{width:"240px",backgroundColor:"var(--mantine-color-gray-0)"},children:e.jsx(t.ScrollArea,{h:"100%",children:e.jsx(t.Stack,{gap:0,p:"sm",children:i.map(I=>e.jsx(t.Box,{mb:"md",children:e.jsxs(u.Fragment,{children:[e.jsx(t.Text,{size:"xs",fw:600,c:"dimmed",m:4,children:I}),o.filter(p=>p.group===I).map(p=>e.jsx(Je,{label:p.label,icon:p.icon,onClick:()=>d(p.id),isActive:c===p.id},p.id))]},I)}))})})}),e.jsxs(t.Box,{style:{flex:1,display:"flex",flexDirection:"column"},children:[h?e.jsxs(e.Fragment,{children:[e.jsx(t.Box,{p:"md",children:e.jsx(t.Group,{gap:"md",wrap:"nowrap",children:e.jsxs(t.Stack,{gap:4,children:[e.jsx(t.Text,{size:"md",fw:600,children:h.alternateLabel||h.label}),h.description&&e.jsx(t.Text,{size:"sm",c:"var(--mantine-color-gray-6)",children:h.description})]})})}),e.jsx(t.ScrollArea,{style:{flex:1},children:e.jsx(t.Box,{px:"md",children:h.content})})]}):e.jsx(t.Box,{style:{display:"flex",alignItems:"center",justifyContent:"center",height:"100%"},children:e.jsx(t.Text,{c:"var(--mantine-color-gray-6)",size:"lg",children:"Select an option from the sidebar"})}),(h==null?void 0:h.saveButton)&&e.jsx(t.Box,{p:"md",children:e.jsxs(t.Group,{justify:"flex-end",gap:"md",children:[e.jsx(t.Button,{variant:"subtle",onClick:x,color:"gray",children:"Cancel"}),e.jsx(t.Button,{onClick:f,color:"blue",children:"Save Changes"})]})})]})]})]})},To=(n,s="es")=>{const o=new Date,r=typeof n=="string"?new Date(n):n,a=Math.floor((o.getTime()-r.getTime())/1e3),i={es:{now:"ahora",seconds:"segundos",second:"segundo",minutes:"minutos",minute:"minuto",hours:"horas",hour:"hora",days:"días",day:"día",weeks:"semanas",week:"semana",months:"meses",month:"mes",years:"años",year:"año",ago:"hace"},en:{now:"now",seconds:"seconds",second:"second",minutes:"minutes",minute:"minute",hours:"hours",hour:"hour",days:"days",day:"day",weeks:"weeks",week:"week",months:"months",month:"month",years:"years",year:"year",ago:"ago"}},l=i[s]||i.en;if(a<5)return l.now;if(a<60)return s==="es"?`${l.ago} ${a} ${a===1?l.second:l.seconds}`:`${a} ${a===1?l.second:l.seconds} ${l.ago}`;const c=Math.floor(a/60);if(c<60)return s==="es"?`${l.ago} ${c} ${c===1?l.minute:l.minutes}`:`${c} ${c===1?l.minute:l.minutes} ${l.ago}`;const d=Math.floor(c/60);if(d<24)return s==="es"?`${l.ago} ${d} ${d===1?l.hour:l.hours}`:`${d} ${d===1?l.hour:l.hours} ${l.ago}`;const f=Math.floor(d/24);if(f<7)return s==="es"?`${l.ago} ${f} ${f===1?l.day:l.days}`:`${f} ${f===1?l.day:l.days} ${l.ago}`;const x=Math.floor(f/7);if(x<4)return s==="es"?`${l.ago} ${x} ${x===1?l.week:l.weeks}`:`${x} ${x===1?l.week:l.weeks} ${l.ago}`;const m=Math.floor(f/30);if(m<12)return s==="es"?`${l.ago} ${m} ${m===1?l.month:l.months}`:`${m} ${m===1?l.month:l.months} ${l.ago}`;const h=Math.floor(f/365);return s==="es"?`${l.ago} ${h} ${h===1?l.year:l.years}`:`${h} ${h===1?l.year:l.years} ${l.ago}`},Oo=(n,s="es")=>{const o=typeof n=="string"?new Date(n):n,r={es:["Ene","Feb","Mar","Abr","May","Jun","Jul","Ago","Sep","Oct","Nov","Dic"],en:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]},i=(r[s]||r.en)[o.getMonth()],l=o.getDate();return s==="es"?`${l} ${i}`:`${i} ${l}`},zo=n=>{const s=typeof n=="string"?new Date(n):n,o=new Date;return s.toDateString()===o.toDateString()},Ro=n=>{const s=typeof n=="string"?new Date(n):n,o=new Date;return o.setDate(o.getDate()-1),s.toDateString()===o.toDateString()},Do=(n,s="es")=>zo(n)?s==="es"?"Hoy":"Today":Ro(n)?s==="es"?"Ayer":"Yesterday":To(n,s),Eo=({notification:n,message:s,markAsRead:o,archiveNotification:r,children:a,actions:i})=>{var x,m,h,I,p;const l=new Date().getTime()-new Date(n.timestamp).getTime()<6048e5?Do(n.timestamp,"en"):Oo(n.timestamp,"en"),[c,d]=u.useState(!1),f=e.jsxs(t.Group,{bg:"var(--mantine-color-gray-1)",p:4,style:{borderRadius:"var(--mantine-radius-md)"},w:"auto",wrap:"nowrap",gap:0,children:[!n.isRead&&e.jsx(ee,{onClick:()=>o(n.id),icon:T.IconCheck}),!n.isArchived&&e.jsx(ee,{onClick:()=>r(n.id),icon:T.IconArchive})]});return e.jsxs(t.Box,{p:"sm",bg:c?"var(--mantine-color-gray-0)":"white",style:{cursor:"pointer",borderTop:"1px solid var(--mantine-color-gray-2)"},onMouseEnter:()=>d(!0),onMouseLeave:()=>d(!1),children:[e.jsxs(t.Group,{justify:"space-between",align:"flex-start",gap:"sm",wrap:"nowrap",style:{margin:0},children:[(x=n.metadata)!=null&&x.avatar_url?e.jsx(t.Avatar,{name:(m=n.metadata)==null?void 0:m.fullname,size:"sm",radius:"md",src:(h=n.metadata)==null?void 0:h.avatar_url}):e.jsx(mt,{size:"xs",showText:!1,radius:"xs"}),e.jsxs(t.Stack,{gap:"xs",justify:"flex-start",w:"100%",children:[e.jsx(t.Box,{fz:"sm",m:0,style:{display:"-webkit-box",WebkitBoxOrient:"vertical",WebkitLineClamp:2,overflow:"hidden",textOverflow:"ellipsis",minHeight:"unset",height:"auto",whiteSpace:"normal",wordBreak:"break-word"},children:s}),e.jsxs(t.Text,{size:"xs",c:"dimmed",fw:500,style:{whiteSpace:"nowrap"},children:[n.category?((I=n.category)==null?void 0:I.charAt(0).toUpperCase())+((p=n.category)==null?void 0:p.slice(1)):""," ","• ",l]})]}),c?f:!n.isRead&&e.jsx(t.Indicator,{color:"var(--mantine-color-blue-6)",size:10,position:"top-end"})]}),a,i&&e.jsx(t.Group,{justify:"flex-start",align:"flex-start",gap:"xs",wrap:"nowrap",pl:36,pt:8,children:i})]})},Ao=(n,s,o,r,a)=>{const[i,l]=u.useState(!1),c=u.useRef(null),d=u.useRef(null),f=u.useRef(null);u.useEffect(()=>{l(n)},[n]);const x=u.useCallback(h=>{h[0].isIntersecting&&r&&!a&&o&&o()},[r,a,o]),m=u.useCallback(()=>{if(!(!c.current||!n||!s||!o)){d.current&&(d.current.disconnect(),d.current=null);try{const h=new IntersectionObserver(x,{threshold:.1,rootMargin:"50px"});h.observe(c.current),d.current=h}catch(h){console.error("Failed to setup intersection observer:",h)}}},[n,s,o,x]);return u.useEffect(()=>{if(f.current&&(clearTimeout(f.current),f.current=null),!n||!s||!o){d.current&&(d.current.disconnect(),d.current=null);return}if(!c.current){f.current=setTimeout(()=>m(),50);return}return m(),()=>{f.current&&(clearTimeout(f.current),f.current=null),d.current&&(d.current.disconnect(),d.current=null)}},[n,s,o,m]),u.useEffect(()=>()=>{f.current&&clearTimeout(f.current),d.current&&d.current.disconnect()},[]),{isActive:i,loadMoreRef:c}},Lo=({notifications:n,isLoading:s=!1,isLoadingMore:o=!1,hasMore:r=!1,unreadCount:a=0,markAllAsRead:i,archiveAllNotifications:l,markAsRead:c,archiveNotification:d,loadMore:f,onFilterChange:x,currentFilter:m="all",customRenderer:h,opened:I=!1,onOpen:p=()=>{},onClose:y=()=>{},enableInfiniteScroll:g=!0})=>{const b=[{children:"Mark all as read",leftSection:e.jsx(T.IconChecklist,{size:16}),onClick:()=>i()},{children:"Archive all",leftSection:e.jsx(T.IconArchive,{size:16}),onClick:()=>l()}],v=[{children:"All",leftSection:e.jsx(T.IconChecklist,{size:16}),onClick:()=>x==null?void 0:x("all"),active:m==="all"},{children:"Unread",leftSection:e.jsx(T.IconChecklist,{size:16}),onClick:()=>x==null?void 0:x("unread"),active:m==="unread"},{children:"Archived",leftSection:e.jsx(T.IconArchive,{size:16}),onClick:()=>x==null?void 0:x("archived"),active:m==="archived"}],C=B=>h&&B.category&&["welcome","upgrade"].includes(B.category)?h(B,c,d):e.jsx(Eo,{notification:B,markAsRead:c,archiveNotification:d,message:B.message,actions:B.actions},B.id),{isActive:w,loadMoreRef:O}=Ao(I,g,f||(()=>{}),r,o);return e.jsxs(e.Fragment,{children:[e.jsx(Je,{isActive:w,icon:e.jsx(T.IconBell,{strokeWidth:2,size:24,color:"var(--mantine-color-gray-7)"}),onClick:()=>{I?y():p()},disabled:!1,variant:"subtle",color:"gray",fullWidth:!0,style:{borderRadius:"var(--mantine-radius-md)",cursor:"pointer"},label:"Inbox",indicator:a>0?a>99?"99+":a:void 0}),e.jsxs(t.Drawer,{opened:I,onClose:y,position:"left",size:400,style:{position:"relative",left:300,zIndex:0,borderLeft:"1px solid var(--mantine-color-gray-2)"},withCloseButton:!1,padding:0,withOverlay:!0,closeOnClickOutside:!0,closeOnEscape:!0,overlayProps:{backgroundOpacity:0,blur:0},children:[e.jsx(t.FocusTrap.InitialFocus,{}),e.jsxs(t.Box,{p:0,h:"100%",style:{display:"flex",flexDirection:"column"},children:[e.jsx(t.Box,{style:{position:"sticky",top:0,zIndex:10,backgroundColor:"var(--mantine-color-white)"},children:e.jsxs(t.Group,{justify:"space-between",align:"center",gap:"xs",style:{borderRadius:"var(--mantine-radius-md)"},px:"sm",py:"md",children:[e.jsx(t.Text,{size:"sm",fw:500,children:"Inbox"}),e.jsxs(t.Group,{gap:"xs",children:[e.jsx(je,{position:"bottom-end",menuItems:v,trigger:e.jsx(ee,{icon:T.IconFilter})}),e.jsx(je,{position:"bottom-end",menuItems:b,trigger:e.jsx(ee,{onClick:()=>{},icon:T.IconDots,changeIconOnHover:!0,iconHovered:T.IconDots})})]})]})}),e.jsxs(t.Box,{style:{flex:1,overflow:"auto"},children:[s&&n.length===0?e.jsx(t.Stack,{gap:0,w:"100%",h:"100%",justify:"center",align:"center",py:"xl",children:e.jsx(t.Loader,{})}):n.length>0?e.jsx(t.Stack,{gap:0,children:n.map(B=>C(B))}):e.jsxs(t.Stack,{gap:0,w:"100%",h:"100%",justify:"center",align:"center",py:"xl",children:[e.jsx(T.IconInbox,{size:24,color:"var(--mantine-color-gray-6)"}),e.jsx(t.Text,{size:"sm",fw:500,c:"dimmed",ta:"center",mt:"sm",children:"No new updates"})]}),e.jsx(t.Box,{ref:O,style:{padding:"16px",display:g?"flex":"none",justifyContent:"center",alignItems:"center",minHeight:"60px"},children:o&&e.jsxs(t.Group,{display:"flex",ta:"center",gap:"xs",children:[e.jsx(t.Loader,{size:"sm",color:"gray.5"}),e.jsx(t.Text,{size:"sm",c:"dimmed",fw:500,children:"Loading more ..."})]})}),o&&!g&&e.jsxs(t.Group,{display:"flex",ta:"center",gap:"xs",children:[e.jsx(t.Loader,{size:"sm",color:"gray.5"}),e.jsx(t.Text,{size:"sm",c:"dimmed",fw:500,children:"Loading more ..."})]}),!g&&r&&f&&e.jsx(t.Button,{color:"var(--mantine-color-gray-3)",variant:"subtle",onClick:f,loading:o,disabled:o,style:{alignSelf:"center"},children:o?"Loading...":"Load More"})]})]})]})]})},Ye=({header:n,body:s,footer:o,withBorder:r=!0,position:a="left",bg:i="var(--mantine-color-gray-0)"})=>{const[l,c]=u.useState(!1),d=()=>{if(!r)return{};const f="var(--mantine-color-gray-3)",x="1px";return a==="left"?{borderRight:`${x} solid ${f}`}:a==="right"?{borderLeft:`${x} solid ${f}`}:{}};return e.jsxs(t.Stack,{gap:"sm",h:"100%",p:"sm",bg:i,style:d(),onMouseEnter:()=>c(!0),onMouseLeave:()=>c(!1),children:[n&&e.jsx(t.Box,{children:typeof n=="function"?n({hovered:l}):n}),s&&e.jsx(t.Box,{style:{flex:1,minHeight:0,width:"100%",overflow:"hidden"},children:typeof s=="function"?s({hovered:l}):s}),o&&e.jsx(t.Box,{children:typeof o=="function"?o({hovered:l}):o})]})},Et=u.createContext(void 0),Fo=({children:n})=>{const[s,{open:o,close:r}]=ve.useDisclosure(!1),a={openedNotificationSidebar:s,openNotificationSidebar:o,closeNotificationSidebar:r};return e.jsx(Et.Provider,{value:a,children:n})},No=()=>{const n=u.useContext(Et);if(n===void 0)throw new Error("useNavbar must be used within an NavbarProvider");return n},At=({workspace:n,currentUserId:s,currentWorkspaceId:o,onClick:r})=>{const a=o===n.id,i=s&&n.ownerId===s;return e.jsxs(t.Box,{onClick:r,style:{display:"flex",alignItems:"center",padding:"6px",borderRadius:"var(--mantine-radius-md)",cursor:"pointer",gap:"8px",width:"100%",boxSizing:"border-box"},onMouseEnter:l=>{l.currentTarget.style.backgroundColor="var(--mantine-color-gray-0)"},onMouseLeave:l=>{l.currentTarget.style.backgroundColor="transparent"},children:[e.jsx(se,{size:"xs",avatar:typeof n.avatar=="string"?{type:"image",value:n.avatar}:n.avatar,placeholder:n.name,showPlaceholder:!0,style:{flexShrink:0}}),e.jsx(t.Text,{size:"sm",fw:500,c:"gray.9",truncate:!0,style:{flex:1,minWidth:0},children:n.name}),e.jsxs(t.Box,{style:{display:"flex",alignItems:"center",gap:"4px",flexShrink:0,paddingLeft:"8px"},children:[a&&e.jsx(T.IconCheck,{size:16,color:"var(--mantine-color-blue-6)"}),i&&e.jsx(t.Badge,{size:"xs",variant:"light",color:"yellow",radius:"sm",children:"Owner"})]})]})},Uo="workspace-selector-module__menuItem___FSB6P",Wo="workspace-selector-module__workspaceButton___-P6kp",Ho="workspace-selector-module__workspaceText___YDAlj",Po="workspace-selector-module__scrollWrapper___MzrJY",Ve={menuItem:Uo,workspaceButton:Wo,workspaceText:Ho,scrollWrapper:Po},$o=({workspaces:n=[],currentWorkspace:s,currentUserId:o,isLoading:r=!1,error:a=null,onWorkspaceSelect:i,onCreateWorkspace:l,emptyMessage:c="No workspaces found",loadingMessage:d="Loading workspaces...",errorMessage:f="Failed to load workspaces",className:x,onCloseSidebar:m,sidebarHovered:h=!1,children:I,menuItems:p})=>{const[y,g]=u.useState(!1),[b,v]=u.useState(""),C=u.useMemo(()=>b?n.filter(k=>{var j;return k.name.toLowerCase().includes(b.toLowerCase())||((j=k.ownerEmail)==null?void 0:j.toLowerCase().includes(b.toLowerCase()))}):n,[n,b]),w=k=>{i==null||i(k.id),g(!1),v("")};if(r)return e.jsxs(t.Group,{gap:"xs",children:[e.jsx(t.Loader,{size:"sm"}),e.jsx(t.Text,{size:"sm",c:"dimmed",children:d})]});if(a)return e.jsx(t.Alert,{color:"red",title:"Error",children:f});const[O,B]=u.useState(h);return n.length===0&&!r&&!a?e.jsx(t.Box,{children:e.jsx(t.Text,{size:"sm",c:"dimmed",children:c})}):e.jsxs(t.Menu,{opened:y,onOpen:()=>g(!0),onClose:()=>g(!1),position:"bottom-start",styles:{dropdown:{width:"350px",overflow:"hidden"}},withinPortal:!0,children:[e.jsx(t.Menu.Target,{children:e.jsx(t.Box,{w:"100%",onClick:()=>g(!y),style:{padding:"6px",display:"flex",alignItems:"center",borderRadius:"var(--mantine-radius-md)",cursor:"pointer"},className:`${Ve.workspaceButton} ${x||""}`,bg:O||y?"var(--mantine-color-gray-1)":"transparent",onMouseEnter:()=>B(!0),onMouseLeave:()=>B(!1),children:e.jsx(t.Group,{gap:"xs",wrap:"nowrap",style:{width:"100%",overflow:"hidden"},children:s?e.jsxs(e.Fragment,{children:[e.jsx(se,{size:"xs",avatar:typeof s.avatar=="string"?{type:"image",value:s.avatar}:s.avatar,placeholder:s.name,showPlaceholder:!0,style:{flexShrink:0}}),e.jsx(t.Text,{size:"sm",fw:550,c:"var(--mantine-color-gray-9)",truncate:!0,style:{flex:1,minWidth:0},children:s.name}),e.jsxs(t.Group,{gap:4,wrap:"nowrap",style:{flexShrink:0},children:[e.jsx(fe,{icon:T.IconChevronDown,size:"md",onClick:()=>g(!y),grayScaleBaseColor:O?1:0}),(O||h)&&e.jsx(fe,{icon:T.IconChevronsLeft,size:"md",onClick:()=>{m==null||m()},grayScaleBaseColor:O?1:0})]})]}):e.jsx(t.Text,{size:"sm",c:"dimmed",children:"Select workspace"})})})}),e.jsx(t.Menu.Dropdown,{style:{borderRadius:"var(--mantine-radius-md)",boxShadow:"var(--mantine-shadow-md)"},p:0,children:e.jsxs(t.Stack,{gap:0,children:[I,e.jsx(t.Menu.Divider,{style:{margin:"1px 0px"}}),e.jsx(t.Stack,{gap:0,px:4,children:C.length===0?e.jsx(t.Menu.Item,{disabled:!0,children:e.jsx(t.Text,{size:"sm",c:"dimmed",children:c})}):e.jsxs(e.Fragment,{children:[e.jsxs(t.Group,{justify:"space-between",align:"center",p:4,children:[e.jsx(t.Text,{size:"xs",c:"dimmed",fw:500,p:4,truncate:!0,children:"Workspaces"}),l&&e.jsx(t.Anchor,{onClick:()=>{l(),g(!1)},size:"xs",underline:"never",fw:500,p:4,truncate:!0,style:{display:"flex",alignItems:"center",gap:"4px"},children:"Add"})]}),e.jsx("div",{className:Ve.scrollWrapper,children:e.jsx(t.ScrollArea,{mah:150,scrollbarSize:6,scrollHideDelay:0,children:e.jsx(t.Stack,{gap:0,mb:6,children:C.map(k=>e.jsx(t.Box,{onClick:()=>w(k),className:Ve.menuItem,style:{padding:0,borderRadius:"var(--mantine-radius-md)",cursor:"pointer",overflow:"hidden"},onMouseEnter:j=>{j.currentTarget.style.backgroundColor="var(--mantine-color-gray-1)"},onMouseLeave:j=>{j.currentTarget.style.backgroundColor="transparent"},children:e.jsx(At,{workspace:k,currentUserId:o,currentWorkspaceId:s==null?void 0:s.id,onClick:()=>w(k)})},k.id))})})})]})}),p&&e.jsx(t.Menu.Divider,{style:{margin:"1px 0px"}}),p&&e.jsx(t.Box,{p:4,children:p==null?void 0:p.map(k=>e.jsx(t.MenuItem,{onClick:k.onClick,leftSection:k.icon,children:k.label,color:k.color,"data-danger":k.color,fw:500,style:{height:"40px",borderRadius:"var(--mantine-radius-md)",padding:"6px"}},k.label))})]})})]})},Lt=({children:n,style:s,...o})=>e.jsx(t.Box,{style:{backgroundColor:"var(--mantine-color-gray-0)",borderRadius:"var(--mantine-radius-md)",minHeight:"20vh",width:"100%",flex:"1 1 0%",minWidth:0,maxWidth:"none",boxSizing:"border-box",display:"flex",alignItems:"center",justifyContent:"center",...s},...o,children:n});Lt.displayName="MatrixCenter";const Ft=({children:n,style:s,size:o="50px",state:r="empty",onStateChange:a,interactive:i=!0,...l})=>{const[c,d]=u.useState(r),[f,x]=u.useState(!1),m=a?r:i?c:r,h=()=>{if(!i)return;const y=["empty","outline","filled"],b=(y.indexOf(m)+1)%y.length,v=y[b];a?a(v):d(v)},I=()=>{switch(m){case"empty":return null;case"outline":return e.jsx(T.IconPoint,{size:16,color:"var(--mantine-color-gray-8)",stroke:2.5});case"filled":return e.jsx(T.IconPointFilled,{size:16,color:"var(--mantine-color-gray-8)",stroke:2.5});default:return null}},p=()=>{switch(m){case"empty":return"var(--mantine-color-gray-0)";case"outline":return"var(--mantine-color-blue-0)";case"filled":return"var(--mantine-color-green-0)";default:return"var(--mantine-color-gray-0)"}};return e.jsx(t.Box,{style:{width:o,height:o,backgroundColor:p(),borderRadius:"var(--mantine-radius-md)",display:"flex",alignItems:"center",justifyContent:"center",cursor:i?"pointer":"default",transition:"all 0.2s ease",boxShadow:f&&i?"0 2px 8px rgba(0, 0, 0, 0.15)":"none",transform:f&&i?"translateY(-1px)":"translateY(0)",border:m==="outline"?"2px solid var(--mantine-color-gray-0)":"2px solid transparent",...s},onClick:h,onMouseEnter:()=>x(!0),onMouseLeave:()=>x(!1),...l,children:n||I()})};Ft.displayName="MatrixCell";const Nt=({children:n,style:s,size:o="50px",blockId:r,isVisible:a=!0,isDimmed:i=!1,shouldShowBlueBorder:l=!1,onBlockClick:c,onBlockPress:d,...f})=>{const[x,m]=u.useState(!1),h=u.useRef(null),I=u.useRef(!1),p=()=>{!r||!d||(m(!0),I.current=!1,h.current=setTimeout(()=>{I.current=!0,d(r)},500))},y=()=>{r&&(m(!1),h.current&&(clearTimeout(h.current),h.current=null),!I.current&&c&&c(r),I.current=!1)},g=()=>{m(!1),h.current&&(clearTimeout(h.current),h.current=null),I.current=!1};return e.jsx(t.Box,{style:{width:o,height:"100%",minWidth:o,minHeight:o,backgroundColor:"var(--mantine-color-gray-0)",borderRadius:"var(--mantine-radius-md)",overflow:"hidden",display:"flex",alignItems:"stretch",justifyContent:"stretch",border:l?"2px solid var(--mantine-color-blue-5)":"2px solid transparent",opacity:x?.8:i?.3:1,transition:"all 0.2s ease",cursor:r?"pointer":"default",...s},onMouseDown:p,onMouseUp:y,onMouseLeave:g,...f,children:n})};Nt.displayName="MatrixBlockLeft";const Ut=({children:n,style:s,size:o="50px",blockId:r,isVisible:a=!0,isDimmed:i=!1,shouldShowBlueBorder:l=!1,onBlockClick:c,onBlockPress:d,...f})=>{const[x,m]=u.useState(!1),h=u.useRef(null),I=u.useRef(!1),p=()=>{!r||!d||(m(!0),I.current=!1,h.current=setTimeout(()=>{I.current=!0,d(r)},500))},y=()=>{r&&(m(!1),h.current&&(clearTimeout(h.current),h.current=null),!I.current&&c&&c(r),I.current=!1)},g=()=>{m(!1),h.current&&(clearTimeout(h.current),h.current=null),I.current=!1};return e.jsx(t.Box,{style:{width:o,height:"100%",minWidth:o,minHeight:o,backgroundColor:"var(--mantine-color-gray-0)",borderRadius:"var(--mantine-radius-md)",overflow:"hidden",display:"flex",alignItems:"stretch",justifyContent:"stretch",border:l?"2px solid var(--mantine-color-blue-5)":"2px solid transparent",opacity:x?.8:i?.3:1,transition:"all 0.2s ease",cursor:r?"pointer":"default",...s},onMouseDown:p,onMouseUp:y,onMouseLeave:g,...f,children:n})};Ut.displayName="MatrixBlockRight";const Wt=({children:n,style:s,size:o="50px",blockId:r,isVisible:a=!0,isDimmed:i=!1,shouldShowBlueBorder:l=!1,onBlockClick:c,onBlockPress:d,...f})=>{const[x,m]=u.useState(!1),h=u.useRef(null),I=u.useRef(!1),p=()=>{!r||!d||(m(!0),I.current=!1,h.current=setTimeout(()=>{I.current=!0,d(r)},500))},y=()=>{r&&(m(!1),h.current&&(clearTimeout(h.current),h.current=null),!I.current&&c&&c(r),I.current=!1)},g=()=>{m(!1),h.current&&(clearTimeout(h.current),h.current=null),I.current=!1};return e.jsx(t.Box,{style:{width:"100%",height:o,minWidth:o,minHeight:o,backgroundColor:"var(--mantine-color-gray-0)",borderRadius:"var(--mantine-radius-md)",overflow:"hidden",display:"flex",alignItems:"stretch",justifyContent:"stretch",border:l?"2px solid var(--mantine-color-blue-5)":"2px solid transparent",opacity:x?.8:i?.3:1,transition:"all 0.2s ease",cursor:r?"pointer":"default",...s},onMouseDown:p,onMouseUp:y,onMouseLeave:g,...f,children:n})};Wt.displayName="MatrixBlockUp";const Ht=({children:n,style:s,size:o="50px",blockId:r,isVisible:a=!0,isDimmed:i=!1,shouldShowBlueBorder:l=!1,onBlockClick:c,onBlockPress:d,...f})=>{const[x,m]=u.useState(!1),h=u.useRef(null),I=u.useRef(!1),p=()=>{!r||!d||(m(!0),I.current=!1,h.current=setTimeout(()=>{I.current=!0,d(r)},500))},y=()=>{r&&(m(!1),h.current&&(clearTimeout(h.current),h.current=null),!I.current&&c&&c(r),I.current=!1)},g=()=>{m(!1),h.current&&(clearTimeout(h.current),h.current=null),I.current=!1};return e.jsx(t.Box,{style:{width:"100%",height:o,minWidth:o,minHeight:o,backgroundColor:"var(--mantine-color-gray-0)",borderRadius:"var(--mantine-radius-md)",overflow:"hidden",display:"flex",alignItems:"stretch",justifyContent:"stretch",border:l?"2px solid var(--mantine-color-blue-5)":"2px solid transparent",opacity:x?.8:i?.3:1,transition:"all 0.2s ease",cursor:r?"pointer":"default",...s},onMouseDown:p,onMouseUp:y,onMouseLeave:g,...f,children:n})};Ht.displayName="MatrixBlockDown";const Pt=({onLeftHover:n,onRightHover:s,onUpHover:o,onDownHover:r,showLeftControls:a=!1,showRightControls:i=!1,showUpControls:l=!1,showDownControls:c=!1})=>{const[d,f]=u.useState(!1),[x,m]=u.useState(!1),[h,I]=u.useState(!1),[p,y]=u.useState(!1),g=w=>{f(w),n==null||n(w)},b=w=>{m(w),s==null||s(w)},v=w=>{I(w),o==null||o(w)},C=w=>{y(w),r==null||r(w)};return e.jsxs(e.Fragment,{children:[a&&e.jsx(t.Box,{style:{position:"absolute",left:0,top:0,bottom:0,width:"80px",zIndex:5,pointerEvents:"auto",background:"transparent"},onMouseEnter:()=>g(!0),onMouseLeave:()=>g(!1)}),i&&e.jsx(t.Box,{style:{position:"absolute",right:0,top:0,bottom:0,width:"80px",zIndex:5,pointerEvents:"auto",background:"transparent"},onMouseEnter:()=>b(!0),onMouseLeave:()=>b(!1)}),l&&e.jsx(t.Box,{style:{position:"absolute",top:0,left:0,right:0,height:"80px",zIndex:5,pointerEvents:"auto",background:"transparent"},onMouseEnter:()=>v(!0),onMouseLeave:()=>v(!1)}),c&&e.jsx(t.Box,{style:{position:"absolute",bottom:0,left:0,right:0,height:"80px",zIndex:5,pointerEvents:"auto",background:"transparent"},onMouseEnter:()=>C(!0),onMouseLeave:()=>C(!1)})]})};Pt.displayName="HoverZones";const $t=({onLeftPrevious:n,onLeftNext:s,leftCurrentPage:o=1,leftTotalPages:r=1,leftDisabled:a=!1,leftVisible:i=!1,onLeftHover:l,onRightPrevious:c,onRightNext:d,rightCurrentPage:f=1,rightTotalPages:x=1,rightDisabled:m=!1,rightVisible:h=!1,onRightHover:I,onUpPrevious:p,onUpNext:y,upCurrentPage:g=1,upTotalPages:b=1,upDisabled:v=!1,upVisible:C=!1,onUpHover:w,onDownPrevious:O,onDownNext:B,downCurrentPage:k=1,downTotalPages:j=1,downDisabled:M=!1,downVisible:S=!1,onDownHover:z,onLeftAdd:D,onRightAdd:F,onUpAdd:H,onDownAdd:P,size:L="md",inline:_=!1})=>{const N=()=>r<=1||a?null:e.jsxs(t.Stack,{gap:"xs",align:"center",children:[e.jsx(t.ActionIcon,{size:L,variant:"subtle",onClick:()=>n==null?void 0:n(),disabled:o<=1,color:"gray",radius:"md","aria-label":"Previous left blocks",children:e.jsx(T.IconChevronRight,{size:16,stroke:2})}),e.jsx(t.ActionIcon,{size:L,variant:"subtle",onClick:D,color:"blue",radius:"md","aria-label":"Add left blocks",children:e.jsx(T.IconPlus,{size:16,stroke:2})}),e.jsx(t.ActionIcon,{size:L,variant:"subtle",onClick:s,disabled:o>=r,color:"gray",radius:"md","aria-label":"Next left blocks",children:e.jsx(T.IconChevronLeft,{size:16,stroke:2})})]}),U=()=>x<=1||m?null:e.jsxs(t.Stack,{gap:"xs",align:"center",children:[e.jsx(t.ActionIcon,{size:L,variant:"subtle",onClick:c,disabled:f<=1,color:"gray",radius:"md","aria-label":"Previous right blocks",children:e.jsx(T.IconChevronLeft,{size:16,stroke:2})}),e.jsx(t.ActionIcon,{size:L,variant:"subtle",onClick:F,color:"blue",radius:"md","aria-label":"Add right blocks",children:e.jsx(T.IconPlus,{size:16,stroke:2})}),e.jsx(t.ActionIcon,{size:L,variant:"subtle",onClick:d,disabled:f>=x,color:"gray",radius:"md","aria-label":"Next right blocks",children:e.jsx(T.IconChevronRight,{size:16,stroke:2})})]}),V=()=>b<=1||v?null:e.jsxs(t.Group,{gap:"xs",align:"center",wrap:"nowrap",children:[e.jsx(t.ActionIcon,{size:L,variant:"subtle",onClick:p,disabled:g<=1,color:"gray",radius:"md","aria-label":"Previous up blocks",children:e.jsx(T.IconChevronDown,{size:16,stroke:2})}),e.jsx(t.ActionIcon,{size:L,variant:"subtle",onClick:H,color:"blue",radius:"md","aria-label":"Add up blocks",children:e.jsx(T.IconPlus,{size:16,stroke:2})}),e.jsx(t.ActionIcon,{size:L,variant:"subtle",onClick:y,disabled:g>=b,color:"gray",radius:"md","aria-label":"Next up blocks",children:e.jsx(T.IconChevronUp,{size:16,stroke:2})})]}),G=()=>j<=1||M?null:e.jsxs(t.Group,{gap:"xs",align:"center",wrap:"nowrap",children:[e.jsx(t.ActionIcon,{size:L,variant:"subtle",onClick:O,disabled:k<=1,color:"gray",radius:"md","aria-label":"Previous down blocks",children:e.jsx(T.IconChevronDown,{size:16,stroke:2})}),e.jsx(t.ActionIcon,{size:L,variant:"subtle",onClick:P,color:"blue",radius:"md","aria-label":"Add down blocks",children:e.jsx(T.IconPlus,{size:16,stroke:2})}),e.jsx(t.ActionIcon,{size:L,variant:"subtle",onClick:B,disabled:k>=j,color:"gray",radius:"md","aria-label":"Next down blocks",children:e.jsx(T.IconChevronUp,{size:16,stroke:2})})]}),R=r>1&&!a,E=x>1&&!m,A=b>1&&!v,W=j>1&&!M;return!R&&!E&&!A&&!W?null:_?e.jsxs(e.Fragment,{children:[R&&i&&n&&s&&e.jsx("div",{onMouseEnter:()=>l==null?void 0:l(!0),onMouseLeave:()=>l==null?void 0:l(!1),children:N()}),E&&h&&c&&d&&e.jsx("div",{onMouseEnter:()=>I==null?void 0:I(!0),onMouseLeave:()=>I==null?void 0:I(!1),children:U()}),A&&C&&p&&y&&e.jsx("div",{onMouseEnter:()=>w==null?void 0:w(!0),onMouseLeave:()=>w==null?void 0:w(!1),children:V()}),W&&S&&O&&B&&e.jsx("div",{onMouseEnter:()=>z==null?void 0:z(!0),onMouseLeave:()=>z==null?void 0:z(!1),children:G()})]}):e.jsxs(e.Fragment,{children:[R&&i&&n&&s&&e.jsx(t.Box,{style:{position:"absolute",left:"20px",top:"50%",transform:"translateY(-50%)",zIndex:10,pointerEvents:"auto",opacity:i?1:0,transition:"opacity 0.2s ease"},onMouseEnter:()=>l==null?void 0:l(!0),onMouseLeave:()=>l==null?void 0:l(!1),children:N()}),E&&h&&c&&d&&e.jsx(t.Box,{style:{position:"absolute",right:"20px",top:"50%",transform:"translateY(-50%)",zIndex:10,pointerEvents:"auto",opacity:h?1:0,transition:"opacity 0.2s ease"},onMouseEnter:()=>I==null?void 0:I(!0),onMouseLeave:()=>I==null?void 0:I(!1),children:U()}),A&&C&&p&&y&&e.jsx(t.Box,{style:{position:"absolute",top:"20px",left:"50%",transform:"translateX(-50%)",zIndex:10,pointerEvents:"auto",opacity:C?1:0,transition:"opacity 0.2s ease"},onMouseEnter:()=>w==null?void 0:w(!0),onMouseLeave:()=>w==null?void 0:w(!1),children:V()}),e.jsx(t.Box,{style:{position:"absolute",bottom:"20px",left:"50%",transform:"translateX(-50%)",zIndex:10,pointerEvents:"auto",opacity:S?1:0,transition:"opacity 0.2s ease"},onMouseEnter:()=>z==null?void 0:z(!0),onMouseLeave:()=>z==null?void 0:z(!1),children:W&&S&&O&&B&&G()})]})};$t.displayName="NavigationControls";const Be=({direction:n,text:s,show:o,actions:r,currentPage:a,totalPages:i,disabled:l,hoverState:c,onHover:d})=>{if(!s)return null;const f={left:{position:"absolute",left:"20px",top:"50%",transform:"translateY(-50%)"},right:{position:"absolute",right:"20px",top:"50%",transform:"translateY(-50%)"},up:{position:"absolute",top:"20px",left:"50%",transform:"translateX(-50%)"},down:{position:"absolute",bottom:"20px",left:"50%",transform:"translateX(-50%)"}},x={left:{onLeftPrevious:r.prev,onLeftNext:r.next,leftCurrentPage:a,leftTotalPages:i,leftDisabled:l,leftVisible:!0},right:{onRightPrevious:r.prev,onRightNext:r.next,rightCurrentPage:a,rightTotalPages:i,rightDisabled:l,rightVisible:!0},up:{onUpPrevious:r.prev,onUpNext:r.next,upCurrentPage:a,upTotalPages:i,upDisabled:l,upVisible:!0},down:{onDownPrevious:r.prev,onDownNext:r.next,downCurrentPage:a,downTotalPages:i,downDisabled:l,downVisible:!0}};return e.jsxs("div",{style:{...f[n],zIndex:10,display:"flex",alignItems:"center",justifyContent:"center",width:"80px",height:"60px"},children:[e.jsx("div",{style:{color:"var(--mantine-color-gray-6)",fontSize:"14px",fontWeight:"500",opacity:c?0:1,transition:"opacity 0.2s ease",position:"absolute"},children:s}),o&&e.jsx("div",{style:{opacity:c?1:0,transition:"opacity 0.2s ease",position:"absolute"},onMouseEnter:()=>d(!0),onMouseLeave:()=>d(!1),children:e.jsx($t,{...x[n],size:"sm",showLabels:!0,inline:!0})})]})},Go=n=>{const{totalBlocksLeft:s=0,totalBlocksRight:o=0,totalBlocksUp:r=0,totalBlocksDown:a=0,visibleBlocksLeft:i=1,visibleBlocksRight:l=1,visibleBlocksUp:c=1,visibleBlocksDown:d=1}=n,f=u.useMemo(()=>{const p=Math.max(1,Math.ceil(s/i)),y=Math.max(1,Math.ceil(o/l)),g=Math.max(1,Math.ceil(r/c)),b=Math.max(1,Math.ceil(a/d));return{leftTotalPages:p,rightTotalPages:y,upTotalPages:g,downTotalPages:b,leftStartIndex:0,leftEndIndex:0,rightStartIndex:0,rightEndIndex:0,upStartIndex:0,upEndIndex:0,downStartIndex:0,downEndIndex:0}},[s,o,r,a,i,l,c,d]),[x,m]=u.useState({leftStartIndex:0,rightStartIndex:0,upStartIndex:0,downStartIndex:0}),h=u.useMemo(()=>{const{leftTotalPages:p,rightTotalPages:y,upTotalPages:g,downTotalPages:b}=f,v=Math.min(x.leftStartIndex,Math.max(0,s-i)),C=Math.min(v+i,s),w=Math.min(x.rightStartIndex,Math.max(0,o-l)),O=Math.min(w+l,o),B=Math.min(x.upStartIndex,Math.max(0,r-c)),k=Math.min(B+c,r),j=Math.min(x.downStartIndex,Math.max(0,a-d)),M=Math.min(j+d,a);return{leftTotalPages:p,rightTotalPages:y,upTotalPages:g,downTotalPages:b,leftStartIndex:v,leftEndIndex:C,rightStartIndex:w,rightEndIndex:O,upStartIndex:B,upEndIndex:k,downStartIndex:j,downEndIndex:M}},[x,f,i,l,c,d,s,o,r,a]),I={goToLeftPage:u.useCallback(p=>{const y=Math.max(0,(p-1)*i);m(g=>({...g,leftStartIndex:Math.min(y,Math.max(0,s-i))}))},[i,s]),goToRightPage:u.useCallback(p=>{const y=Math.max(0,(p-1)*l);m(g=>({...g,rightStartIndex:Math.min(y,Math.max(0,o-l))}))},[l,o]),goToUpPage:u.useCallback(p=>{const y=Math.max(0,(p-1)*c);m(g=>({...g,upStartIndex:Math.min(y,Math.max(0,r-c))}))},[c,r]),goToDownPage:u.useCallback(p=>{const y=Math.max(0,(p-1)*d);m(g=>({...g,downStartIndex:Math.min(y,Math.max(0,a-d))}))},[d,a]),nextLeftPage:u.useCallback(()=>{m(p=>({...p,leftStartIndex:Math.min(p.leftStartIndex+1,Math.max(0,s-i))}))},[s,i]),previousLeftPage:u.useCallback(()=>{m(p=>({...p,leftStartIndex:Math.max(p.leftStartIndex-1,0)}))},[]),nextRightPage:u.useCallback(()=>{m(p=>({...p,rightStartIndex:Math.min(p.rightStartIndex+1,Math.max(0,o-l))}))},[o,l]),previousRightPage:u.useCallback(()=>{m(p=>({...p,rightStartIndex:Math.max(p.rightStartIndex-1,0)}))},[]),nextUpPage:u.useCallback(()=>{m(p=>({...p,upStartIndex:Math.min(p.upStartIndex+1,Math.max(0,r-c))}))},[r,c]),previousUpPage:u.useCallback(()=>{m(p=>({...p,upStartIndex:Math.max(p.upStartIndex-1,0)}))},[]),nextDownPage:u.useCallback(()=>{m(p=>({...p,downStartIndex:Math.min(p.downStartIndex+1,Math.max(0,a-d))}))},[a,d]),previousDownPage:u.useCallback(()=>{m(p=>({...p,downStartIndex:Math.max(p.downStartIndex-1,0)}))},[])};return[x,I,h]},_o=(n,s=0,o=0,r=0,a=0)=>{const[i,l]=u.useState({width:typeof window<"u"?window.innerWidth:1920,height:typeof window<"u"?window.innerHeight:1080});return u.useEffect(()=>{if(typeof window>"u")return;const d=()=>{l({width:window.innerWidth,height:window.innerHeight})};return window.addEventListener("resize",d),()=>window.removeEventListener("resize",d)},[]),u.useMemo(()=>{const{gap:d,cellSize:f,minBlocksPerSide:x=2,maxBlocksPerSide:m=15,minBlocksLeft:h=1,maxBlocksLeft:I=8,minBlocksRight:p=1,maxBlocksRight:y=8,minBlocksUp:g=1,maxBlocksUp:b=8,minBlocksDown:v=1,maxBlocksDown:C=8,responsiveCellSize:w=!1,minCellSize:O="30px",maxCellSize:B="80px"}=n,k=parseFloat(d.replace("px","")),j=parseFloat(f.replace("px","")),M=i.width-k*4,S=i.height-k*4,z=j+k,D=Math.floor(M/(2*z)),F=j+k,H=Math.floor(S/F)+2,P=Math.min(D,H),L=Math.max(x,Math.min(m,P)),_=Math.max(h,Math.min(I,Math.floor(P/2))),N=Math.max(p,Math.min(y,Math.floor(P/2)));let U=f;if(w){const A=parseFloat(O.replace("px","")),W=parseFloat(B.replace("px","")),Q=Math.min(M/(i.width*.8),S/(i.height*.8));U=`${Math.max(A,Math.min(W,j*Q))}px`}const V=Math.min(i.width/1920,i.height/1080);let G,R;if(r>0&&a>0){const A=Math.max(r,a);G=Math.max(g,Math.min(b,A)),R=G}else{const A=Math.max(g,v),W=Math.min(b,C),Q=Math.max(A,Math.min(W,Math.ceil(A+(W-A)*V)));G=Q,R=Q}if(G+R+1>H){const A=Math.max(2,H-1);if(Math.max(g,v)*2>A){const Q=Math.max(1,Math.floor(A/2));G=Q,R=Q}else{const Q=Math.max(g,v);G=Q,R=Q}}return console.log("Responsive Matrix Debug:",{windowSize:i,screenSizeRatio:V,minBlocksUp:g,minBlocksDown:v,maxBlocksUp:b,maxBlocksDown:C,blocksUp:r,blocksDown:a,calculatedBlocksUp:G,calculatedBlocksDown:R,totalVerticalBlocks:G+R+1,isSymmetric:G===R,availableHeight:S,maxBlocksVertical:H}),{blocksPerSide:L,blocksLeft:_,blocksRight:N,cellSize:U,blocksUp:G,blocksDown:R}},[i,n,s,o,r,a])},Vo=({gap:n,cellSize:s,blocksLeft:o,blocksRight:r,blocksUp:a,blocksDown:i,totalBlocksLeft:l,totalBlocksRight:c,totalBlocksUp:d,totalBlocksDown:f,responsive:x,minBlocksPerSide:m,maxBlocksPerSide:h,minBlocksLeft:I,maxBlocksLeft:p,minBlocksRight:y,maxBlocksRight:g,minBlocksUp:b,maxBlocksUp:v,minBlocksDown:C,maxBlocksDown:w,responsiveCellSize:O,minCellSize:B,maxCellSize:k})=>{const j=u.useMemo(()=>l!==void 0||c!==void 0||d!==void 0||f!==void 0,[l,c,d,f]),M=_o({gap:n,cellSize:s,minBlocksPerSide:m,maxBlocksPerSide:h,minBlocksLeft:I,maxBlocksLeft:p,minBlocksRight:y,maxBlocksRight:g,minBlocksUp:b,maxBlocksUp:v,minBlocksDown:C,maxBlocksDown:w,responsiveCellSize:O,minCellSize:B,maxCellSize:k},o??0,r??0,a,i),S=u.useMemo(()=>{let H=x?M.blocksLeft:o??0,P=x?M.blocksRight:r??0,L=x?M.blocksUp:a??0,_=x?M.blocksDown:i??0;if(!x){const N=parseFloat(n.replace("px","")),U=parseFloat(s.replace("px","")),V=typeof window<"u"?window.innerWidth-N*4:1920,G=typeof window<"u"?window.innerHeight-N*4:1080,R=U+N,E=Math.floor(V/(2*R)),A=Math.floor(G/(2*R));H=Math.min(H,E),P=Math.min(P,E),L=Math.min(L,A),_=Math.min(_,A)}return{left:H,right:P,up:L,down:_}},[x,M,o,r,a,i,n,s]),z=u.useMemo(()=>{const H=j&&l?Math.min(S.left,l):S.left,P=j&&c?Math.min(S.right,c):S.right,L=j&&d?Math.min(S.up,d):S.up,_=j&&f?Math.min(S.down,f):S.down;return{left:H,right:P,up:L,down:_}},[j,S,l,c,d,f]),D=x?M.cellSize:s,F=u.useMemo(()=>{const H=(z.left>0?z.left:0)+1+(z.right>0?z.right:0),P=z.up>0||z.down>0?z.up+1+z.down:1,L=`${D} `.repeat(z.left)+"1fr "+`${D} `.repeat(z.right),_=z.up>0||z.down>0?`${D} `.repeat(z.up)+"1fr "+`${D} `.repeat(z.down):"1fr";return{totalColumns:H,totalRows:P,gridTemplateColumns:L.trim(),gridTemplateRows:_.trim()}},[z,D]);return{usePagination:j,visibleBlocks:S,finalBlocks:z,finalCellSize:D,gridDimensions:F}},Qo=({blockItems:n})=>{const s=u.useMemo(()=>n.reduce((a,i)=>(a[i.id]=i,a),{}),[n]);return{getBlockContent:(a,i)=>{const l=`${a}-${i}`,c=s[l];return c?c.content:u.createElement("div",{style:{padding:"4px",textAlign:"center",fontSize:"10px",writingMode:a==="left"||a==="right"?"vertical-rl":"horizontal-tb",textOrientation:"mixed",width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center",overflow:"hidden"}})},getIntersectionText:(a,i,l,c)=>{const d=[];if(a!==null){const f=s[`left-${a}`];d.push(f?`left-${a}`:`left${a+1}`)}if(i!==null){const f=s[`right-${i}`];d.push(f?`right-${i}`:`right${i+1}`)}if(l!==null){const f=s[`up-${l}`];d.push(f?`up-${l}`:`up${l+1}`)}if(c!==null){const f=s[`down-${c}`];d.push(f?`down-${c}`:`down${c+1}`)}return d.join(", ")}}},Yo=({blockConnections:n})=>{const s=u.useMemo(()=>{const r=new Map;return n.forEach(a=>{const i=`${a.source}-${a.target}`,l=`${a.target}-${a.source}`;r.set(i,a),r.set(l,a)}),r},[n]);return{getConnectionStateFromText:r=>{const a=r.split(", ").map(i=>i.trim());for(let i=0;i<a.length;i++)for(let l=i+1;l<a.length;l++){const c=a[i],d=a[l],f=`${c}-${d}`,x=s.get(f);if(x)return x.type}return"empty"}}},qo=({usePagination:n,totalBlocksLeft:s,totalBlocksRight:o,totalBlocksUp:r,totalBlocksDown:a,paginationActions:i,paginationState:l,paginationInfo:c})=>{const[d,f]=u.useState({left:!1,right:!1,up:!1,down:!1}),x=(h,I)=>{f(p=>({...p,[h]:I}))};return{hoverStates:d,handleHover:x,getNavigationControlProps:h=>{const I={left:s,right:o,up:r,down:a}[h],p={left:{prev:i.previousLeftPage,next:i.nextLeftPage},right:{prev:i.previousRightPage,next:i.nextRightPage},up:{prev:i.previousUpPage,next:i.nextUpPage},down:{prev:i.previousDownPage,next:i.nextDownPage}}[h],y={left:l.leftStartIndex,right:l.rightStartIndex,up:l.upStartIndex,down:l.downStartIndex}[h],g={left:c.leftTotalPages,right:c.rightTotalPages,up:c.upTotalPages,down:c.downTotalPages}[h];return{show:n&&!!I,totalBlocks:I,actions:p,currentPage:y+1,totalPages:g,disabled:!I,hoverState:d[h],onHover:b=>x(h,b)}}}},Zo=({blockItems:n,blockConnections:s})=>{const[o,r]=u.useState(null),[a,i]=u.useState(!1),l=u.useMemo(()=>{const y=new Map;return s.forEach(g=>{const b=`${g.source}-${g.target}`,v=`${g.target}-${g.source}`;y.set(b,g),y.set(v,g)}),y},[s]),c=u.useCallback(y=>{const g=[];return n.forEach(b=>{if(b.id!==y){const v=`${y}-${b.id}`;l.has(v)&&g.push(b.id)}}),g},[n,l]),d=u.useCallback(y=>{const g=n.find(C=>C.id===y);if(!g)return[];const b=c(y),v=[y];switch(g.type){case"up":b.forEach(C=>{const w=n.find(O=>O.id===C);w&&(w.type==="left"||w.type==="right")&&(v.push(C),c(C).forEach(B=>{const k=n.find(j=>j.id===B);k&&k.type==="down"&&v.push(B)}))});break;case"down":b.forEach(C=>{const w=n.find(O=>O.id===C);w&&(w.type==="left"||w.type==="right")&&(v.push(C),c(C).forEach(B=>{const k=n.find(j=>j.id===B);k&&k.type==="up"&&v.push(B)}))});break;case"left":b.forEach(C=>{const w=n.find(O=>O.id===C);w&&(w.type==="up"||w.type==="down")&&(v.push(C),c(C).forEach(B=>{const k=n.find(j=>j.id===B);k&&k.type==="right"&&v.push(B)}))});break;case"right":b.forEach(C=>{const w=n.find(O=>O.id===C);w&&(w.type==="up"||w.type==="down")&&(v.push(C),c(C).forEach(B=>{const k=n.find(j=>j.id===B);k&&k.type==="left"&&v.push(B)}))});break}return[...new Set(v)]},[n,c]),f=u.useCallback(y=>!0,[]),x=u.useCallback(y=>!a||!o?!1:!d(o).includes(y),[a,o,d]),m=u.useCallback(y=>!a||!o?!1:d(o).includes(y),[a,o,d]),h=u.useCallback(y=>{a&&o===y?(i(!1),r(null)):(r(y),i(!0))},[a,o]),I=u.useCallback(y=>{console.log(`Block clicked: ${y}`)},[]),p=u.useCallback(()=>{i(!1),r(null)},[]);return{selectedBlockId:o,isFiltering:a,isBlockVisible:f,isBlockDimmed:x,shouldShowBlueBorder:m,handleBlockPress:h,handleBlockClick:I,clearFiltering:p,getFilteredBlockIds:d}},at=n=>parseInt(n.replace(/[^\d]/g,""),10)||0,Xo=(n,s)=>{const[o,r]=u.useState({width:0,height:0}),a=u.useCallback(()=>{const{width:i,height:l}=o;if(i===0||l===0)return{blocksUp:s.minVerticalBlocks/2,blocksDown:s.minVerticalBlocks/2,blocksLeft:s.minHorizontalBlocks/2,blocksRight:s.minHorizontalBlocks/2,containerWidth:i,containerHeight:l};const c=at(s.cellSize),d=at(s.gap),f=c+d,x=i-d*2,m=l-d*2,h=Math.floor(m*s.verticalMaxPercent/100/f),I=Math.floor(x*s.horizontalMaxPercent/100/f),p=Math.floor(m*s.verticalMinPercent/100/f),y=Math.floor(x*s.horizontalMinPercent/100/f),g=Math.max(s.minVerticalBlocks,p),b=Math.max(s.minHorizontalBlocks,y),v=Math.max(g,h),C=Math.max(b,I),w=Math.floor(v/2),O=Math.floor(v/2),B=Math.floor(C/2),k=Math.floor(C/2);return{blocksUp:w,blocksDown:O,blocksLeft:B,blocksRight:k,containerWidth:i,containerHeight:l}},[o,s]);return u.useEffect(()=>{const i=()=>{if(n.current){const c=n.current.getBoundingClientRect();r({width:c.width,height:c.height})}};i();const l=new ResizeObserver(i);return n.current&&l.observe(n.current),()=>{l.disconnect()}},[n]),a()},Ko={verticalMinPercent:20,verticalMaxPercent:50,horizontalMinPercent:30,horizontalMaxPercent:50,minVerticalBlocks:2,minHorizontalBlocks:4,cellSize:"50px",gap:"8px"},Gt=({children:n,style:s,gap:o="8px",cellSize:r="50px",verticalBlocks:a,horizontalBlocks:i,responsiveConfig:l,enableResponsive:c=!1,blocksLeft:d,blocksRight:f,blocksUp:x=0,blocksDown:m=0,blockItems:h=[],blockConnections:I=[],enableFiltering:p=!1,onBlockClick:y,totalBlocksLeft:g,totalBlocksRight:b,totalBlocksUp:v,totalBlocksDown:C,usePagination:w=!1,responsive:O=!1,minBlocksPerSide:B=2,maxBlocksPerSide:k=15,minBlocksHorizontal:j=2,maxBlocksHorizontal:M=16,minBlocksVertical:S=2,maxBlocksVertical:z=16,minBlocksLeft:D=1,maxBlocksLeft:F=8,minBlocksRight:H=1,maxBlocksRight:P=8,minBlocksUp:L=1,maxBlocksUp:_=8,minBlocksDown:N=1,maxBlocksDown:U=8,responsiveCellSize:V=!1,minCellSize:G="30px",maxCellSize:R="80px",directionTexts:E,...A})=>{const W=u.useRef(null),Q=Xo(W,{...Ko,cellSize:r,gap:o,...l});let te=d,$=f,oe=x,X=m;c?(te=Math.floor(Q.blocksLeft),$=Math.floor(Q.blocksRight),oe=Math.floor(Q.blocksUp),X=Math.floor(Q.blocksDown)):(a!==void 0||i!==void 0)&&(a!==void 0&&(oe=Math.floor(a/2),X=Math.floor(a/2)),i!==void 0&&(te=Math.floor(i/2),$=Math.floor(i/2)));const de=D!==1?D:Math.floor(j/2),Fe=F!==8?F:Math.floor(M/2),Ne=H!==1?H:Math.ceil(j/2),re=P!==8?P:Math.ceil(M/2),me=L!==1?L:Math.floor(S/2),Se=_!==8?_:Math.floor(z/2),Kt=N!==1?N:Math.ceil(S/2),Jt=U!==8?U:Math.ceil(z/2),{usePagination:en,finalBlocks:Y,finalCellSize:ae,gridDimensions:ke}=Vo({gap:o,cellSize:r,blocksLeft:te,blocksRight:$,blocksUp:oe,blocksDown:X,totalBlocksLeft:g,totalBlocksRight:b,totalBlocksUp:v,totalBlocksDown:C,responsive:O,minBlocksPerSide:B,maxBlocksPerSide:k,minBlocksLeft:de,maxBlocksLeft:Fe,minBlocksRight:Ne,maxBlocksRight:re,minBlocksUp:me,maxBlocksUp:Se,minBlocksDown:Kt,maxBlocksDown:Jt,responsiveCellSize:V,minCellSize:G,maxCellSize:R}),{getBlockContent:Ce,getIntersectionText:tn}=Qo({blockItems:h}),{getConnectionStateFromText:nn}=Yo({blockConnections:I}),q=Zo({blockItems:h,blockConnections:I});u.useEffect(()=>{if(!p)return;const Ie=K=>{K.key==="Escape"&&q.clearFiltering()};return window.addEventListener("keydown",Ie),()=>window.removeEventListener("keydown",Ie)},[p,q]);const[ie,on,rn]=Go({totalBlocksLeft:g??0,totalBlocksRight:b??0,totalBlocksUp:v??0,totalBlocksDown:C??0,visibleBlocksLeft:Y.left,visibleBlocksRight:Y.right,visibleBlocksUp:Y.up,visibleBlocksDown:Y.down}),{getNavigationControlProps:ue}=qo({usePagination:en,totalBlocksLeft:g,totalBlocksRight:b,totalBlocksUp:v,totalBlocksDown:C,paginationActions:on,paginationState:ie,paginationInfo:rn}),sn=s?Object.fromEntries(Object.entries(s).filter(([Ie])=>!["width","height","maxWidth","maxHeight"].includes(Ie))):void 0;return e.jsxs(t.Box,{ref:W,style:{display:"grid",gridTemplateColumns:ke.gridTemplateColumns,gridTemplateRows:ke.gridTemplateRows,width:"100%",height:"100%",maxWidth:"100%",maxHeight:"100%",padding:o,boxSizing:"border-box",gap:o,overflow:"hidden",...sn},...A,children:[Array.from({length:ke.totalRows},(Ie,K)=>Array.from({length:ke.totalColumns},(Sr,ne)=>{const Ue=Y.up>0?K===Y.up:K===0,We=ne===Y.left;if(Ue&&We)return e.jsxs(Lt,{style:{width:"100%",height:"100%",maxWidth:"none",maxHeight:"none",position:"relative"},children:[n,e.jsx(Be,{direction:"left",text:E==null?void 0:E.left,...ue("left")}),e.jsx(Be,{direction:"right",text:E==null?void 0:E.right,...ue("right")}),e.jsx(Be,{direction:"up",text:E==null?void 0:E.up,...ue("up")}),e.jsx(Be,{direction:"down",text:E==null?void 0:E.down,...ue("down")}),w&&e.jsx(Pt,{showLeftControls:!!g,showRightControls:!!b,showUpControls:!!v,showDownControls:!!C,onLeftHover:Z=>ue("left").onHover(Z),onRightHover:Z=>ue("right").onHover(Z),onUpHover:Z=>ue("up").onHover(Z),onDownHover:Z=>ue("down").onHover(Z)})]},`center-${K}-${ne}`);if(Ue&&ne<Y.left){const Z=w&&g?ie.leftStartIndex+ne:ne,J=`left-${Z}`;return e.jsx(Nt,{size:ae,blockId:p?J:void 0,isVisible:p?q.isBlockVisible(J):!0,isDimmed:p?q.isBlockDimmed(J):!1,shouldShowBlueBorder:p?q.shouldShowBlueBorder(J):!1,onBlockClick:p?q.handleBlockClick:y,onBlockPress:p?q.handleBlockPress:void 0,children:Ce("left",Z)},`left-${ne}`)}if(Ue&&ne>Y.left){const Z=ne-Y.left-1,J=w&&b?ie.rightStartIndex+(Y.right-1-Z):Y.right-1-Z,ce=`right-${J}`;return e.jsx(Ut,{size:ae,blockId:p?ce:void 0,isVisible:p?q.isBlockVisible(ce):!0,isDimmed:p?q.isBlockDimmed(ce):!1,shouldShowBlueBorder:p?q.shouldShowBlueBorder(ce):!1,onBlockClick:p?q.handleBlockClick:y,onBlockPress:p?q.handleBlockPress:void 0,children:Ce("right",J)},`right-${Z}`)}if(We&&K<Y.up){const Z=w&&v?ie.upStartIndex+K:K,J=`up-${Z}`;return e.jsx(Wt,{size:ae,blockId:p?J:void 0,isVisible:p?q.isBlockVisible(J):!0,isDimmed:p?q.isBlockDimmed(J):!1,shouldShowBlueBorder:p?q.shouldShowBlueBorder(J):!1,onBlockClick:p?q.handleBlockClick:y,onBlockPress:p?q.handleBlockPress:void 0,children:Ce("up",Z)},`up-${K}`)}if(We&&K>Y.up){const Z=K-Y.up-1,J=w&&C?ie.downStartIndex+Z:Z,ce=`down-${J}`;return e.jsx(Ht,{size:ae,blockId:p?ce:void 0,isVisible:p?q.isBlockVisible(ce):!0,isDimmed:p?q.isBlockDimmed(ce):!1,shouldShowBlueBorder:p?q.shouldShowBlueBorder(ce):!1,onBlockClick:p?q.handleBlockClick:y,onBlockPress:p?q.handleBlockPress:void 0,children:Ce("down",J)},`down-${Z}`)}const He=ne<Y.left?ne:null,Me=ne>Y.left?ne-Y.left-1:null,Pe=K<Y.up?K:null,$e=K>Y.up?K-Y.up-1:null,an=w&&g&&He!==null?ie.leftStartIndex+He:He,cn=w&&b&&Me!==null?ie.rightStartIndex+(Y.right-1-Me):Me!==null?Y.right-1-Me:null,ln=w&&v&&Pe!==null?ie.upStartIndex+Pe:Pe,dn=w&&C&&$e!==null?ie.downStartIndex+$e:$e,Ge=tn(an,cn,ln,dn);if(Ge&&Ge.length>0){const Z=nn(Ge);return e.jsx(Ft,{size:ae,state:Z,interactive:!1},`intersection-${K}-${ne}`)}return e.jsx("div",{style:{width:ae,height:ae,minWidth:ae,minHeight:ae}},`empty-${K}-${ne}`)})).flat(),p&&q.isFiltering&&e.jsx(t.Box,{style:{position:"fixed",top:12,right:12,background:"rgba(255, 255, 255, 0.9)",color:"var(--mantine-color-dark-7)",padding:"8px 12px",borderRadius:"8px",boxShadow:"0 2px 10px rgba(0,0,0,0.12)",fontSize:12,fontWeight:600,pointerEvents:"none",zIndex:1e3},children:"Press Esc to clear filter"})]})};Gt.displayName="Matrix";const he=({editable:n=!1,children:s,label:o,icon:r,value:a,className:i,style:l,...c})=>{const d={className:i,style:l};return ve.useMediaQuery("(max-width: 550px)",!1,{getInitialValueInEffect:!0})?e.jsxs(t.Stack,{gap:0,w:"100%",...d,children:[e.jsxs(t.Box,{style:{display:"flex",alignItems:"center",gap:8},h:"auto",children:[r&&e.jsx(r,{size:20,style:{flexShrink:0},color:"var(--mantine-color-gray-6)",strokeWidth:2}),e.jsx(t.Text,{size:"sm",fw:500,c:"gray.6",children:o})]}),e.jsx(t.Box,{style:{display:"flex",alignItems:"flex-start"},w:"100%",children:n&&s?s:a})]}):e.jsxs(t.Group,{align:"flex-start",gap:0,w:"100%",...c,...d,children:[e.jsxs(t.Box,{w:"30%",style:{display:"flex",alignItems:"center",gap:8},h:"40px",children:[r&&e.jsx(r,{size:20,style:{flexShrink:0},color:"var(--mantine-color-gray-6)",strokeWidth:2}),e.jsx(t.Text,{size:"sm",fw:500,truncate:!0,c:"gray.6",children:o})]}),e.jsx(t.Box,{w:"70%",style:{display:"flex",alignItems:"flex-start"},mih:40,children:n&&s?s:a})]})},Jo=({label:n,icon:s,value:o,onChange:r,editable:a=!1,placeholder:i,disabled:l=!1})=>a&&r?e.jsx(he,{label:n,icon:s,value:e.jsx(we,{value:o,onChange:r,placeholder:i,disabled:l,size:"sm"})}):e.jsx(he,{label:n,icon:s,value:e.jsx(t.Text,{size:"sm",c:o?void 0:"dimmed",fw:500,truncate:!0,children:o||i||"—"})}),er=({label:n,icon:s,href:o,text:r,target:a="_blank"})=>{const i=r||o;return e.jsx(he,{label:n,icon:s,value:e.jsx(t.Anchor,{href:o,target:a,size:"sm",underline:"hover",children:i})})},tr=({label:n,icon:s,value:o,onChange:r,editable:a=!1,format:i,placeholder:l})=>{const c=o??null,d=c!==null&&i?i(c):c!==null?c.toString():null,f=x=>{if(!r)return;const m=x.trim();if(m===""){r(null);return}const h=Number(m);isNaN(h)||r(h)};return a&&r?e.jsx(he,{label:n,icon:s,value:e.jsx(we,{value:d||"",onChange:f,placeholder:l||"Enter number",size:"sm"})}):e.jsx(he,{label:n,icon:s,value:e.jsx(t.Text,{size:"sm",c:c!==null?void 0:"dimmed",children:d||l||"—"})})},nr=300,or=({users:n,onSearch:s,debounceSearch:o=!0,debounceDelay:r=nr})=>{const[a,i]=u.useState(""),[l,c]=u.useState(n),[d,f]=u.useState(!1),x=u.useRef(null);return u.useEffect(()=>{if(!s){c(n);return}if(x.current&&clearTimeout(x.current),a.trim()){const m=async()=>{f(!0);try{const h=await s(a);c(h)}catch(h){console.error("Search error:",h)}finally{f(!1)}};o?x.current=setTimeout(m,r):m()}else c(n),f(!1);return()=>{x.current&&clearTimeout(x.current)}},[a,s,o,r,n]),u.useEffect(()=>{(!a.trim()||!s)&&c(n)},[n,a,s]),{searchQuery:a,setSearchQuery:i,displayedUsers:l,setDisplayedUsers:c,isSearching:d}},rr=({value:n,multiple:s,users:o,displayedUsers:r,searchQuery:a,onSearch:i})=>{const l=u.useMemo(()=>s?Array.isArray(n)?n:[]:n?[n]:[],[n,s]),c=u.useMemo(()=>o.filter(x=>l.includes(x.id)),[o,l]),d=u.useMemo(()=>{if(!a.trim()||i)return r;const x=a.toLowerCase();return r.filter(m=>m.name.toLowerCase().includes(x)||m.email.toLowerCase().includes(x))},[r,a,i]),f=u.useMemo(()=>{const x=d.filter(I=>l.includes(I.id)),m=d.filter(I=>!l.includes(I.id)),h=c.filter(I=>!d.some(p=>p.id===I.id));return[...x,...h,...m]},[d,l,c]);return{selectedIds:l,selectedUsers:c,sortedUsers:f}},sr=({isFocused:n,dropdownRef:s})=>{const[o,r]=u.useState("bottom"),a=u.useCallback(i=>{if(s.current=i,i){const l=i.dataset.position;l==="top"||l==="bottom"?r(l):requestAnimationFrame(()=>{if(i.dataset.position){const c=i.dataset.position;(c==="top"||c==="bottom")&&r(c)}})}},[s]);return u.useLayoutEffect(()=>{if(!n||!s.current)return;const i=()=>{if(s.current){const d=s.current.dataset.position;(d==="top"||d==="bottom")&&r(d)}};i();const l=requestAnimationFrame(i),c=new MutationObserver(()=>{i()});return s.current&&c.observe(s.current,{attributes:!0,attributeFilter:["data-position"]}),()=>{cancelAnimationFrame(l),c.disconnect()}},[n,s]),{placement:o,dropdownRefCallback:a}},ar=({onLoadMore:n,hasMore:s,loading:o,setDisplayedUsers:r})=>{const a=u.useRef(null);return u.useEffect(()=>{if(!n||!s||o)return;const i=new IntersectionObserver(l=>{l[0].isIntersecting&&s&&!o&&n().then(c=>{r(d=>[...d,...c])})},{threshold:.1});return a.current&&i.observe(a.current),()=>{i.disconnect()}},[n,s,o,r]),{loadMoreRef:a}},ir=({combobox:n,dropdownRef:s})=>{const[o,r]=u.useState(!1),[a,i]=u.useState(!1),l=u.useCallback(()=>{r(!0),n.openDropdown()},[n]),c=u.useCallback(x=>{setTimeout(()=>{const m=x==null?void 0:x.relatedTarget;m&&s.current&&s.current.contains(m)||n.dropdownOpened||r(!1)},0)},[n,s]),d=u.useCallback(()=>{i(!0)},[]),f=u.useCallback(()=>{i(!1)},[]);return{isFocused:o,setIsFocused:r,isHovered:a,handleFocus:l,handleBlur:c,handleMouseEnter:d,handleMouseLeave:f}},cr=({multiple:n,value:s,onChange:o,combobox:r})=>{const a=u.useCallback(l=>{if(n){const c=Array.isArray(s)?s:[],d=c.includes(l)?c.filter(f=>f!==l):[...c,l];o==null||o(d)}else o==null||o(l),r.closeDropdown()},[n,s,o,r]),i=u.useCallback(l=>{if(n){const c=Array.isArray(s)?s:[];o==null||o(c.filter(d=>d!==l))}else o==null||o("")},[n,s,o]);return{handleSelect:a,handleRemove:i}},lr="40px",dr=300,pe=({editable:n=!1,label:s,icon:o,value:r,users:a=[],onChange:i,placeholder:l="Select users",multiple:c=!1,disabled:d=!1,onSearch:f,debounceSearch:x=!0,debounceDelay:m=dr,onLoadMore:h,hasMore:I=!1,loading:p=!1})=>{const y=u.useRef(null),g=u.useRef(null),b=u.useRef(null),{searchQuery:v,setSearchQuery:C,displayedUsers:w,setDisplayedUsers:O,isSearching:B}=or({users:a,onSearch:f,debounceSearch:x,debounceDelay:m}),k=t.useCombobox({onDropdownClose:()=>{k.resetSelectedOption(),C(""),M(!1)},onDropdownOpen:()=>{k.updateSelectedOptionIndex("active"),M(!0)}}),{isFocused:j,setIsFocused:M,isHovered:S,handleFocus:z,handleBlur:D,handleMouseEnter:F,handleMouseLeave:H}=ir({combobox:k,dropdownRef:b}),{placement:P,dropdownRefCallback:L}=sr({isFocused:j,dropdownRef:b}),{selectedIds:_,selectedUsers:N,sortedUsers:U}=rr({value:r,multiple:c,users:a,displayedUsers:w,searchQuery:v,onSearch:f}),{loadMoreRef:V}=ar({onLoadMore:h,hasMore:I,loading:p,setDisplayedUsers:O}),{handleSelect:G,handleRemove:R}=cr({multiple:c,value:r,onChange:i,combobox:k}),E=()=>{if(!c)return null;const $=5,oe=N.slice(0,$),X=N.length-$;return e.jsxs(t.Group,{gap:"xs",children:[oe.map(de=>e.jsx(Te,{avatar:de.avatar,name:de.name,withRemoveButton:j,onRemove:()=>R(de.id)},de.id)),X>0&&e.jsx(t.Pill,{ml:"xs",radius:"md",size:"md",bg:"transparent",children:e.jsxs(t.Group,{gap:"2px",wrap:"nowrap",style:{alignItems:"center",display:"flex"},h:"24px",children:[e.jsx(T.IconPlus,{size:16,style:{color:"var(--mantine-color-blue-5)"}}),e.jsxs(t.Text,{size:"sm",fw:400,c:"var(--mantine-color-blue-5)",children:[X," more"]})]})})]})},A=()=>{if(c)return null;const $=N[0];return $?e.jsx(Te,{avatar:$.avatar,name:$.name}):null},W=()=>j?"var(--mantine-color-gray-2)":"var(--mantine-color-gray-0)",Q=()=>({input:{position:j?"absolute":"relative",zIndex:j?1e3:1,fontWeight:"400",color:"var(--mantine-color-gray-9)",cursor:d?"not-allowed":"pointer",backgroundColor:j||S?"var(--mantine-color-gray-0)":"transparent",border:j?"1px solid var(--mantine-color-gray-2)":"1px solid transparent",borderRadius:j&&P==="bottom"?"var(--mantine-radius-md) var(--mantine-radius-md) 0 0":j&&P==="top"?"0 0 var(--mantine-radius-md) var(--mantine-radius-md)":"var(--mantine-radius-md)",paddingY:"6px",display:"flex",alignItems:"center",padding:"6px 14px",minHeight:"40px",flexWrap:c?"wrap":"nowrap",boxShadow:j&&P==="bottom"?"0 -4px 10px 0 rgba(0, 0, 0, 0.1)":j&&P==="top"?"0 4px 10px 0 rgba(0, 0, 0, 0.1)":"none"}}),te={group:{alignItems:"center",gap:"4px",minHeight:"0",lineHeight:"normal"}};return e.jsx(he,{editable:n,label:s,icon:o,value:e.jsx(t.Group,{gap:"sm",wrap:"nowrap",style:{alignItems:"center"},w:"100%",h:40,p:"14px",children:N.map($=>e.jsx(Te,{avatar:$.avatar,name:$.name,withRemoveButton:j,onRemove:()=>R($.id)},$.id))}),children:e.jsxs(t.Combobox,{store:k,onOptionSubmit:G,withinPortal:!1,offset:-2,children:[e.jsx(t.Combobox.DropdownTarget,{children:e.jsx(t.PillsInput,{onClick:()=>!d&&k.openDropdown(),radius:"md",disabled:d,styles:Q,onFocus:z,onBlur:D,onMouseEnter:()=>!d&&F(),onMouseLeave:H,w:"100%",children:e.jsxs(t.Pill.Group,{styles:te,children:[c?E():A(),e.jsx(t.Combobox.EventsTarget,{children:e.jsx(t.PillsInput.Field,{ref:y,onFocus:z,onBlur:D,placeholder:N.length===0||j||v.length>0?l:"",value:v,onChange:$=>{k.updateSelectedOptionIndex(),C($.currentTarget.value)},onMouseDown:$=>{$.stopPropagation()},onKeyDown:$=>{$.key==="Backspace"&&v.length===0&&($.preventDefault(),c&&N.length>0?R(N[N.length-1].id):!c&&N.length>0&&R(N[0].id))},pointer:!0,disabled:d,styles:{field:{minWidth:j||v.length>0||N.length===0?"60px":"0px",width:j||v.length>0||N.length===0?"auto":"0px",flex:j||v.length>0||N.length===0?"1":"0",border:"none",outline:"none",background:"transparent",fontSize:"inherit",fontFamily:"inherit",padding:"0",margin:"0",overflow:"hidden",lineHeight:"24px",display:"flex",alignItems:"center",height:j||v.length>0||N.length===0?"auto":"0px",minHeight:j||v.length>0||N.length===0?"auto":"0px","&::placeholder":{opacity:N.length===0||j||v.length>0?1:0,display:N.length===0||j||v.length>0?"block":"none",color:"var(--mantine-color-gray-9)",lineHeight:"24px"}}}})})]})})}),e.jsx(t.Combobox.Dropdown,{styles:{dropdown:{borderRadius:P==="bottom"?"0 0 var(--mantine-radius-md) var(--mantine-radius-md)":"var(--mantine-radius-md) var(--mantine-radius-md) 0 0",borderTop:"none",border:`1px solid ${W()}`,marginTop:"0",padding:"4px",boxShadow:P==="bottom"?"0 4px 10px 0 rgba(0, 0, 0, 0.1)":"0 -4px 10px 0 rgba(0, 0, 0, 0.1)"}},ref:L,children:e.jsx(t.Combobox.Options,{children:e.jsx(t.ScrollArea,{ref:g,h:Math.min(U.length*parseFloat(lr),300),scrollbarSize:6,children:e.jsxs(t.Stack,{gap:2,children:[U.map($=>{const oe=_.includes($.id);return e.jsx(t.Combobox.Option,{value:$.id,active:oe,onMouseDown:X=>{X.preventDefault(),G($.id)},style:{borderRadius:"var(--mantine-radius-md)",height:"40px"},children:e.jsxs(t.Group,{gap:"sm",wrap:"nowrap",style:{display:"flex",alignItems:"center"},h:"28px",children:[e.jsx(se,{avatar:$.avatar,size:24,placeholder:$.name,showPlaceholder:!0}),e.jsx(t.Text,{size:"sm",fw:400,truncate:!0,children:$.name}),oe&&e.jsx(T.IconCheck,{size:16,color:"var(--mantine-color-blue-6)"})]})},$.id)}),(B||p)&&e.jsx(t.Box,{style:{padding:"12px",display:"flex",justifyContent:"center"},children:e.jsx(t.Loader,{size:"sm"})}),h&&I&&!p&&e.jsx("div",{ref:V,style:{height:"20px"}}),U.length===0&&!B&&!p&&e.jsx(t.Box,{style:{padding:"24px",textAlign:"center"},children:e.jsx(t.Text,{size:"sm",c:"dimmed",children:"No users found"})})]})})})})]})})},et=({label:n,icon:s,value:o,onChange:r,onDraftChange:a,onFocusChange:i,editable:l=!1,placeholder:c,disabled:d=!1,minRows:f=1,maxRows:x,autosize:m=!0})=>{const[h,I]=u.useState(!1),[p,y]=u.useState(!1),g={wrapper:{...!m&&{height:"40px",minHeight:"40px",boxSizing:"border-box"},borderRadius:"var(--mantine-radius-md)"},input:{backgroundColor:h||p?"var(--mantine-color-gray-0)":"transparent",color:"var(--mantine-color-gray-9)",border:h?"1px solid var(--mantine-color-gray-2)":"1px solid transparent",borderRadius:"var(--mantine-radius-md)",width:"100%",cursor:"pointer",...!m&&{height:"40px",minHeight:"40px",boxSizing:"border-box"},padding:"8px 14px",lineHeight:m?"1.5":"24px",fontWeight:450}},b=()=>{I(!0),i==null||i(!0)},v=w=>{I(!1),i==null||i(!1),r==null||r(w.target.value)},C=w=>{const O=w.target.value;if(a){a(O);return}r==null||r(O)};return e.jsx(he,{editable:l,label:n,icon:s,value:e.jsx(t.Box,{w:"100%",style:{display:"flex",alignItems:"flex-start",minHeight:40},p:"xs",h:40,children:e.jsx(t.Text,{size:"sm",c:o?void 0:"dimmed",fw:400,style:{whiteSpace:"pre-wrap",wordBreak:"break-word"},children:o||c||"—"})}),children:e.jsx(t.Box,{w:"100%",style:{boxShadow:h?"var(--mantine-shadow-sm)":"none",borderRadius:"var(--mantine-radius-md)"},children:e.jsx(t.Textarea,{value:o,onChange:C,onFocus:b,onBlur:v,onMouseEnter:()=>y(!0),onMouseLeave:()=>y(!1),placeholder:c,disabled:d,size:"sm",radius:"md",fw:400,minRows:h?1:f,maxRows:x,autosize:m,styles:{...g}})})})},ur=({opened:n,onClose:s,children:o,...r})=>e.jsxs(t.Modal,{withCloseButton:!1,opened:n,onClose:s,size:"70%",centered:!0,overlayProps:{backgroundOpacity:.55},styles:{content:{minHeight:"100%"}},padding:"md",...r,children:[e.jsxs(t.Group,{justify:"space-between",wrap:"nowrap",children:[e.jsx(t.Group,{justify:"space-between",wrap:"nowrap",gap:"xs",children:e.jsx(ee,{icon:T.IconMaximize,size:"md",onClick:()=>{}})}),e.jsxs(t.Group,{justify:"space-between",gap:"xs",children:[e.jsx(ee,{icon:T.IconStar,size:"md",onClick:()=>{}}),e.jsx(ee,{icon:T.IconDots,size:"md",onClick:()=>{}})]})]}),o]}),_t=({opened:n,onClose:s,editable:o,content:r,position:a="right",size:i="xl",onMaximize:l,rightCornerActions:c,headerProps:d,propertiesProps:f})=>{var w,O;const[x,m]=u.useState(!1),h=(f==null?void 0:f.hiddenProperties)&&f.hiddenProperties.length>0,[I,p]=u.useState(!1),[y,g]=u.useState(d==null?void 0:d.avatar),[b,v]=u.useState(!1);u.useEffect(()=>{g(d==null?void 0:d.avatar)},[d==null?void 0:d.avatar]);const C=e.jsx(t.Button,{size:"xs",radius:"md",w:"fit-content",variant:"subtle",px:"var(--mantine-spacing-sm)",color:"gray",mb:"md",onClick:()=>{var k;const B={type:"emoji",value:"😊"};g(B),(k=d==null?void 0:d.onAvatarChange)==null||k.call(d,B)},children:e.jsxs(t.Box,{style:{display:"flex",alignItems:"center",justifyContent:"center",gap:6},children:[e.jsx(T.IconMoodSmileFilled,{size:16}),e.jsx(t.Text,{size:"sm",fw:500,children:"Add avatar"})]})});return e.jsxs(t.Drawer,{opened:n,onClose:s,position:a,size:i,padding:"md",withCloseButton:!1,overlayProps:{backgroundOpacity:0},shadow:"none",children:[e.jsxs(t.Group,{justify:"space-between",wrap:"nowrap",children:[e.jsxs(t.Group,{justify:"space-between",wrap:"nowrap",gap:"xs",children:[e.jsx(ee,{icon:T.IconChevronsRight,size:"md",onClick:s}),e.jsx(ee,{icon:T.IconMaximize,size:"md",onClick:()=>l()})]}),e.jsx(t.Group,{justify:"space-between",gap:"xs",children:c})]}),e.jsxs(t.Box,{p:"3rem",children:[d&&e.jsxs(t.Box,{children:[e.jsx(t.Box,{onMouseEnter:()=>p(!0),onMouseLeave:()=>p(!1),children:y?e.jsx(Le,{editable:o,avatar:y,size:"xl",opened:b,onOpen:()=>v(!0),onClose:()=>v(!1),onAvatarSelect:B=>{var k;g(B),(k=d==null?void 0:d.onAvatarChange)==null||k.call(d,B)},onRemove:()=>{g(void 0)}}):e.jsx(t.Box,{h:24,children:I&&C})}),o?e.jsx(we,{value:d.title||"",onChange:B=>{var k;return(k=d.onTitleChange)==null?void 0:k.call(d,B)},onDraftChange:d.onTitleDraftChange,pageTitle:!0,placeholder:d.placeholder}):e.jsx(t.Box,{h:80,style:{display:"flex",alignItems:"center"},children:e.jsx(t.Text,{size:"2.5rem",fw:700,children:d.title})})]}),e.jsx(t.Stack,{gap:"sm",children:(w=f==null?void 0:f.visibleProperties)==null?void 0:w.map((B,k)=>e.jsx(t.Box,{children:B},k))}),h&&!x&&e.jsx(t.Box,{w:"100%",style:{display:"flex",justifyContent:"center"},children:e.jsx(t.Button,{size:"xs",radius:"md",w:"fit-content",variant:"subtle",px:"var(--mantine-spacing-sm)",color:"gray.4",onClick:()=>m(!0),children:e.jsxs(t.Box,{style:{display:"flex",alignItems:"center",justifyContent:"center",gap:6},children:[e.jsx(t.Text,{size:"sm",fw:500,c:"var(--mantine-color-blue-5)",children:"Show"}),e.jsx(T.IconChevronDown,{size:16,color:"var(--mantine-color-blue-5)"})]})})}),e.jsx(t.Collapse,{in:x,children:e.jsx(t.Stack,{gap:"sm",mt:"sm",children:(O=f==null?void 0:f.hiddenProperties)==null?void 0:O.map((B,k)=>e.jsx(t.Box,{children:B},k))})}),h&&x&&e.jsx(t.Box,{w:"100%",style:{display:"flex",justifyContent:"center"},mt:"sm",children:e.jsx(t.Button,{size:"xs",radius:"md",w:"fit-content",variant:"subtle",px:"var(--mantine-spacing-sm)",color:"gray.4",onClick:()=>m(!1),children:e.jsxs(t.Box,{style:{display:"flex",alignItems:"center",justifyContent:"center",gap:6},children:[e.jsx(t.Text,{size:"sm",fw:500,c:"var(--mantine-color-blue-5)",children:"Hide"}),e.jsx(T.IconChevronUp,{size:16,color:"var(--mantine-color-blue-5)"})]})})}),r]})]})},fr=({children:n})=>e.jsx(t.Box,{style:{minHeight:"100vh",width:"100%",maxWidth:"100%",margin:"0 auto"},id:"full-page",children:n}),Vt=u.createContext(void 0),Qt=({children:n})=>{const[s,{toggle:o,open:r,close:a}]=ve.useDisclosure(!0),[i,{toggle:l,open:c,close:d}]=ve.useDisclosure(!1),[f,{open:x,close:m}]=ve.useDisclosure(!1),[h,I]=u.useState(300),[p,y]=u.useState(500),g={opened:s,toggle:o,open:r,close:a,asideOpened:i,toggleAside:l,openAside:c,closeAside:d,sidebarWidth:h,setSidebarWidth:I,asideWidth:p,setAsideWidth:y,openedNotificationSidebar:f,openNotificationSidebar:x,closeNotificationSidebar:m};return e.jsx(Vt.Provider,{value:g,children:n})},tt=()=>{const n=u.useContext(Vt);if(n===void 0)throw new Error("useAppLayout must be used within an AppLayoutProvider");return n},Yt=({header:n,navbar:s,aside:o,children:r,...a})=>{const{opened:i,asideOpened:l,sidebarWidth:c,asideWidth:d}=tt();return e.jsxs(t.AppShell,{header:{height:n?60:0},navbar:{width:i?c:0,breakpoint:"sm",collapsed:{mobile:!0}},aside:{width:l?d:0,breakpoint:"sm",collapsed:{mobile:!0}},padding:0,...a,children:[n&&e.jsx(t.AppShell.Header,{children:n}),e.jsx(t.AppShell.Navbar,{style:{display:i?"block":"none",width:i?c:0,border:"none"},children:s}),e.jsx(t.AppShell.Aside,{style:{display:l?"block":"none",width:l?d:0},children:o}),e.jsx(t.AppShell.Main,{children:r})]})},hr=({items:n,selectedId:s,onSelect:o})=>e.jsx(t.Stack,{gap:0,children:n.map(r=>{var a;return e.jsx(Qe,{label:r.label,isActive:s===r.id,noChild:!r.children||r.children.length===0,onClick:()=>(!r.children||r.children.length===0)&&(o==null?void 0:o(r.id)),children:(a=r.children)==null?void 0:a.map(i=>e.jsx(Qe,{label:i.label,noChild:!0,level:4,isActive:s===i.id,onClick:()=>o==null?void 0:o(i.id)},i.id))},r.id)})}),xr=({items:n,selectedId:s,onSelect:o,headerLeft:r,headerRight:a,renderPreview:i,renderAside:l,sidebarTitle:c="Documentation",topNavItems:d,selectedTopNavId:f,onTopNavSelect:x})=>{const{opened:m,toggle:h}=tt(),[I,p]=u.useState(s),y=s??I,g=b=>{o==null||o(b),s===void 0&&p(b)};return e.jsx(Yt,{header:d?e.jsx(Ye,{withBorder:!0,bg:"transparent",position:"left",header:e.jsx(t.Group,{h:40,w:"100%",justify:"space-between",wrap:"nowrap",children:e.jsx(t.Group,{gap:"xs",wrap:"nowrap",children:m&&e.jsx(t.Text,{fw:600,size:"sm",children:c})})})}):void 0,navbar:e.jsx(Ye,{withBorder:!0,bg:"transparent",position:"left",header:e.jsxs(t.Group,{h:40,w:"100%",justify:"space-between",wrap:"nowrap",children:[e.jsx(t.Group,{gap:"xs",wrap:"nowrap",children:m&&e.jsx(t.Text,{fw:600,size:"sm",children:c})}),e.jsx(ee,{icon:m?T.IconChevronsLeft:T.IconChevronsRight,size:"md",onClick:h})]}),body:m&&e.jsx(t.ScrollArea,{h:"100%",type:"hover",scrollbarSize:10,styles:{scrollbar:{'&[data-state="visible"]':{background:"transparent"}},thumb:{backgroundColor:"var(--mantine-color-gray-4)",opacity:.3,"&:hover":{backgroundColor:"var(--mantine-color-gray-4)",opacity:.3}}},children:e.jsx(hr,{items:n,selectedId:y,onSelect:g})}),footer:e.jsx(e.Fragment,{})}),aside:e.jsx(t.Box,{p:"md",h:"100%",children:l==null?void 0:l(y)}),children:e.jsxs(t.Box,{style:{height:"100vh",display:"flex",flexDirection:"column",background:"var(--mantine-color-body)"},children:[e.jsxs(t.Group,{p:"md",justify:"space-between",align:"center",children:[e.jsxs(t.Group,{gap:"xs",wrap:"nowrap",children:[!m&&e.jsx(ee,{icon:T.IconChevronsRight,size:"md",variant:"subtle",tooltip:"Open sidebar",onClick:h}),r??e.jsx(Re,{label:y||"Select a topic",onClick:()=>{}})]}),!d&&a]}),e.jsx(t.Box,{style:{flex:1,display:"flex",alignItems:"center",justifyContent:"center",padding:"40px"},children:e.jsx(t.Box,{p:"xl",style:{borderRadius:"var(--mantine-radius-md)",width:"100%"},children:i(y)})})]})})},pr=n=>e.jsx(Qt,{children:e.jsx(xr,{...n})}),nt=(n,s)=>{const o=u.useCallback(i=>{const l=Array.isArray(i)?i:[i];n.onUserIdsChange(l)},[n]),r=u.useCallback(i=>{const l=Array.isArray(i)?i:[i],c=s.members.filter(I=>l.includes(I.id)),d=c.map(I=>I.id),f=l.filter(I=>!d.includes(I)),m=[...s.members,...n.users].filter(I=>f.includes(I.id)),h=[...c,...m];s.onMembersChange(h)},[s,n]);return{availableMembersUsers:u.useMemo(()=>{const i=[...s.members];return n.users.forEach(l=>{i.find(c=>c.id===l.id)||i.push(l)}),i},[s.members,n.users]),handleResponsibleChange:o,handleMembersChange:r}},mr=({opened:n,onClose:s,onMaximize:o,editable:r,name:a,onNameChange:i,avatar:l,onAvatarChange:c,owner:d,responsibleProps:f,membersProps:x,descriptionProps:m})=>{const{availableMembersUsers:h,handleResponsibleChange:I,handleMembersChange:p}=nt(f,x),y=u.useMemo(()=>[e.jsx(et,{label:"Description",icon:T.IconAlignLeft,value:m.description,onChange:m.onDescriptionChange,editable:r},"description"),e.jsx(pe,{editable:!1,label:"Team Owner",icon:T.IconUserCircle,value:d.id,users:[d]},"owner"),e.jsx(pe,{multiple:!1,editable:r,label:"Team Leader",icon:T.IconUser,value:f.userIds.length>0?f.userIds[0]:void 0,users:f.users,onChange:I,onSearch:f.handleSearch,onLoadMore:f.handleLoadMore,hasMore:f.hasMore},"leader"),e.jsx(pe,{multiple:!0,editable:r,label:"Team Members",icon:T.IconUsers,value:x.members.map(g=>g.id),users:h,onChange:p,onSearch:x.handleSearch,onLoadMore:x.handleLoadMore,hasMore:x.hasMore},"members")],[m.description,m.onDescriptionChange,r,d,f.handleLoadMore,f.handleSearch,f.hasMore,f.userIds,f.users,I,x.handleLoadMore,x.handleSearch,x.hasMore,x.members,h,p]);return e.jsx(_t,{opened:n,onClose:s,onMaximize:o,editable:r,headerProps:{avatar:l,onAvatarChange:g=>c==null?void 0:c(g),title:a,onTitleChange:i,placeholder:"Team name"},propertiesProps:{visibleProperties:y}})},qt=({isSidebarOpen:n,fullWidth:s=!1,editable:o,rightNavigation:r,headerProps:a,properties:i,children:l,footer:c})=>{const[d,f]=u.useState(a==null?void 0:a.avatar),[x,m]=u.useState(!1),[h,I]=u.useState(!1),p=s?"0":{base:"1rem",sm:"2rem",md:"4rem",lg:"8rem",xl:"10rem"},[y,g]=u.useState(n);u.useEffect(()=>{g(n)},[n]);const b=()=>{g(v=>!v)};return e.jsxs(t.Stack,{gap:"md",p:"md",children:[e.jsxs(t.Group,{justify:"space-between",children:[e.jsxs(t.Group,{gap:4,wrap:"nowrap",children:[e.jsx(ee,{icon:y?T.IconChevronsRight:T.IconMenu2,size:"md",color:"gray",changeIconOnHover:!0,iconHovered:y?T.IconMenu2:T.IconChevronsRight,variant:"subtle",onClick:b,"aria-pressed":y}),e.jsx(Re,{label:a.title,onClick:()=>{}})]}),e.jsx(t.Box,{children:r})]}),e.jsx(t.Box,{px:p,w:"100%",maw:{base:"100%",md:"80vw"},mx:"auto",children:e.jsxs(t.Stack,{gap:"md",children:[a&&e.jsxs(t.Stack,{gap:"md",children:[e.jsx(t.Box,{onMouseEnter:()=>I(!0),onMouseLeave:()=>I(!1),h:d?64:24,children:d?e.jsx(Le,{editable:o,avatar:d,size:64,opened:x,onOpen:()=>m(!0),onClose:()=>m(!1),onAvatarSelect:v=>{var C;f(v),(C=a==null?void 0:a.onAvatarChange)==null||C.call(a,v)},onRemove:()=>{f(void 0)}}):e.jsx(t.Box,{h:24,children:h&&e.jsx(t.Button,{size:"xs",radius:"md",w:"fit-content",variant:"subtle",px:"var(--mantine-spacing-sm)",color:"gray",mb:"md",onClick:()=>{var C;const v={type:"emoji",value:"😊"};f(v),(C=a==null?void 0:a.onAvatarChange)==null||C.call(a,v)},children:e.jsxs(t.Box,{style:{display:"flex",alignItems:"center",justifyContent:"center",gap:6},children:[e.jsx(T.IconMoodSmileFilled,{size:16}),e.jsx(t.Text,{size:"sm",fw:500,children:"Add avatar"})]})})})}),e.jsx(t.Box,{children:o?e.jsx(gt,{value:a.title||"",onChange:v=>{var C;return(C=a.onTitleChange)==null?void 0:C.call(a,v)},placeholder:a.placeholder,pageTitle:!0}):e.jsx(t.Box,{h:80,style:{display:"flex",alignItems:"center"},children:e.jsx(t.Text,{size:"2.5rem",fw:700,children:a.title})})})]}),i,l,c]})})]})},Zt=({editable:n,owner:s,descriptionProps:o,responsibleProps:r,membersProps:a})=>{const{availableMembersUsers:i,handleResponsibleChange:l,handleMembersChange:c}=nt(r,a);return e.jsxs(t.Stack,{gap:"sm",children:[e.jsx(et,{label:"Description",icon:T.IconAlignLeft,value:o.description,onChange:o.onDescriptionChange,editable:n},"description"),e.jsx(pe,{editable:!1,label:"Team Owner",icon:T.IconUserCircle,value:s.id,users:[s]},"owner"),e.jsx(pe,{multiple:!1,editable:n,label:"Team Leader",icon:T.IconUser,value:r.userIds.length>0?r.userIds[0]:void 0,users:r.users,onChange:l,onSearch:r.handleSearch,onLoadMore:r.handleLoadMore,hasMore:r.hasMore},"leader"),e.jsx(pe,{multiple:!0,editable:n,label:"Team Members",icon:T.IconUsers,value:a.members.map(d=>d.id),users:i,onChange:c,onSearch:a.handleSearch,onLoadMore:a.handleLoadMore,hasMore:a.hasMore},"members")]})},gr=({editable:n,headerProps:s,rightNavigation:o,properties:r,children:a,footer:i})=>e.jsx(qt,{isSidebarOpen:!0,editable:n,rightNavigation:o,headerProps:s,properties:e.jsx(Zt,{...r}),children:a,footer:i}),Ir=({title:n,properties:s,children:o})=>e.jsxs(t.Stack,{gap:"sm",p:"3rem",children:[e.jsx(t.Text,{size:"2.5rem",fw:600,children:n}),e.jsx(t.Space,{h:"md"}),e.jsx(t.Stack,{gap:"xs",children:s}),e.jsx(t.Space,{h:"md"}),e.jsx(t.Box,{children:o})]}),yr=({opened:n,onClose:s,position:o,size:r,onMaximize:a,editable:i,rightNavigation:l,headerProps:c,properties:d,children:f,footer:x})=>{var C,w;const[m,h]=u.useState(c==null?void 0:c.avatar),[I,p]=u.useState(!1),[y,g]=u.useState(!1);u.useEffect(()=>{h(c==null?void 0:c.avatar)},[c==null?void 0:c.avatar]);const b=(C=c==null?void 0:c.loading)==null?void 0:C.avatar,v=(w=c==null?void 0:c.loading)==null?void 0:w.title;return e.jsx(t.Drawer,{opened:n,onClose:s,position:o,size:r,padding:"md",withCloseButton:!1,overlayProps:{backgroundOpacity:0},shadow:"none",trapFocus:!1,children:e.jsxs(t.Stack,{gap:"md",children:[e.jsxs(t.Group,{justify:"space-between",children:[e.jsxs(t.Group,{gap:"xs",wrap:"nowrap",children:[e.jsx(fe,{icon:T.IconChevronsRight,onClick:s}),e.jsx(fe,{icon:T.IconMaximize,onClick:()=>a()})]})," ",e.jsx(t.Box,{children:l})]}),e.jsx(t.Box,{p:"3rem",w:"100%",children:e.jsxs(t.Stack,{gap:"md",children:[c&&e.jsxs(t.Box,{children:[" ",e.jsx(t.Box,{onMouseEnter:()=>g(!0),onMouseLeave:()=>g(!1),h:b||m?64:24,children:b?e.jsx(t.Skeleton,{height:64,width:64,radius:"md"}):m?e.jsx(Le,{editable:i,avatar:m,size:64,opened:I,onOpen:()=>p(!0),onClose:()=>p(!1),onAvatarSelect:O=>{var B;h(O),(B=c==null?void 0:c.onAvatarChange)==null||B.call(c,O)},onRemove:()=>{h(void 0)}}):e.jsx(t.Box,{h:24,children:y&&e.jsx(t.Button,{size:"xs",radius:"md",w:"fit-content",variant:"subtle",px:"var(--mantine-spacing-sm)",color:"gray",mb:"md",onClick:()=>{var B;const O={type:"emoji",value:"😊"};h(O),(B=c==null?void 0:c.onAvatarChange)==null||B.call(c,O)},children:e.jsxs(t.Box,{style:{display:"flex",alignItems:"center",justifyContent:"center",gap:6},children:[e.jsx(T.IconMoodSmileFilled,{size:16}),e.jsx(t.Text,{size:"sm",fw:500,children:"Add avatar"})]})})})}),v?e.jsx(t.Skeleton,{height:64,width:"100%",radius:"md",mt:"md"}):i?e.jsx(we,{value:c.title||"",onChange:O=>{var B;return(B=c.onTitleChange)==null?void 0:B.call(c,O)},onDraftChange:c.onTitleDraftChange,pageTitle:!0,placeholder:c.placeholder}):e.jsx(t.Box,{h:80,style:{display:"flex",alignItems:"center"},children:e.jsx(t.Text,{size:"2.5rem",fw:700,children:c.title})})]}),d,f,x]})})]})})},vr=({userName:n,avatar:s,title:o,status:r})=>{const a=i=>{const l=i==="green"?"var(--mantine-color-green-7)":i==="yellow"?"var(--mantine-color-yellow-7)":"var(--mantine-color-red-7)";return e.jsx(t.Box,{style:{width:10,height:10,borderRadius:999,backgroundColor:l}})};return e.jsxs(e.Fragment,{children:[e.jsx(t.Box,{style:{writingMode:"sideways-lr",textOrientation:"mixed"},children:e.jsx(se,{avatar:s,size:"xs",showPlaceholder:!0,placeholder:n})}),e.jsx(t.Text,{size:"sm",fw:500,truncate:!0,c:"var(--mantine-color-gray-9)",children:o}),e.jsx(t.Box,{w:"10px",h:"10px",mt:"xs",children:a(r)})]})},it=n=>typeof n=="number"?`${n}px`:n,ct=({height:n,minHeight:s,gridTemplateColumns:o,columnGap:r,cellStyle:a,rowHeaderContent:i,planContent:l,doContent:c,checkContent:d,actContent:f})=>{const x=it(n),m=it(s),h={display:"grid",gridTemplateColumns:o,columnGap:r,rowGap:r,width:"100%",minHeight:m,height:x},I={...a,minHeight:m,height:x,minWidth:0,overflow:"hidden",boxSizing:"border-box"},p={display:"flex",width:"100%",height:"100%",alignItems:"center",justifyContent:"left",writingMode:"sideways-lr",textOrientation:"mixed",gap:"var(--mantine-spacing-xs)"};return e.jsxs(t.Box,{style:h,children:[e.jsx(t.Box,{style:I,p:"xs",children:e.jsx(t.Box,{style:p,children:e.jsx(vr,{...i})})},"goal"),e.jsx(t.Box,{style:I,children:l},"plan"),e.jsx(t.Box,{style:I,children:c},"do"),e.jsx(t.Box,{style:I,children:d},"check"),e.jsx(t.Box,{style:I,children:f},"act")]})},jr=({gutter:n,onPointerDown:s,onPointerMove:o,onPointerUp:r,onDoubleClick:a})=>{const[i,l]=u.useState(!1);return e.jsx(t.Box,{onPointerEnter:()=>l(!0),onPointerLeave:()=>l(!1),onPointerDown:c=>{l(!0),s(c)},onPointerMove:o,onPointerUp:c=>{r(c),l(!1)},onPointerCancel:c=>{r(c),l(!1)},onDoubleClick:c=>{c.preventDefault(),c.stopPropagation(),a==null||a(c)},style:{height:n,cursor:"row-resize",display:"flex",alignItems:"center",justifyContent:"center"},children:e.jsx(t.Box,{style:{height:"4px",width:"40%",borderRadius:"999px",backgroundColor:"var(--mantine-color-gray-4)",opacity:i?1:0,transition:"opacity 120ms ease, background-color 120ms ease"}})})},br=({cellSize:n,gutter:s,rowsLength:o,weeksContent:r,planContent:a,doContent:i,checkContent:l,actContent:c})=>{const d=u.useMemo(()=>s==="xs"?"4px":s==="sm"?"8px":s==="md"?"16px":s==="lg"?"24px":"32px",[s]),f=u.useMemo(()=>`${n}px repeat(4, 1fr)`,[n]),x=u.useMemo(()=>({backgroundColor:"var(--mantine-color-gray-0)",borderRadius:"var(--mantine-radius-md)",display:"flex",alignItems:"center",justifyContent:"flex-start",padding:"var(--mantine-spacing-sm)",height:"100%"}),[]),m=u.useRef(null),[h,I]=u.useState(n),p=u.useCallback(()=>Array.from({length:o},()=>h),[h,o]),[y,g]=u.useState(p),b=u.useRef(y),v=u.useRef(null);u.useEffect(()=>{b.current=y},[y]),u.useEffect(()=>{g(M=>Array.from({length:o},(z,D)=>{const F=M[D];return F===void 0?h:Math.max(F,h)}))},[o,h]);const C=u.useCallback(M=>S=>{S.preventDefault(),S.stopPropagation();const z=S.pointerId,D=b.current[M]??h;v.current={index:M,pointerId:z,startY:S.clientY,startHeight:D},S.currentTarget.setPointerCapture(z)},[h]),w=u.useCallback(M=>{const S=v.current;if(!S||M.pointerId!==S.pointerId)return;M.preventDefault();const z=M.clientY-S.startY,D=Math.max(h,S.startHeight+z);g(F=>{if(F[S.index]===D)return F;const P=[...F];return P[S.index]=D,P})},[h]),O=u.useCallback(M=>{const S=v.current;!S||M.pointerId!==S.pointerId||(M.preventDefault(),M.stopPropagation(),M.currentTarget.releasePointerCapture(M.pointerId),v.current=null)},[]),B=u.useCallback(M=>S=>{S.preventDefault(),S.stopPropagation(),g(z=>{const D=h,F=z[M]??D,H=[...z];return F===D?H[M]=window.innerHeight:H[M]=D,H})},[h]);u.useEffect(()=>{const M=m.current;if(!M)return;const S=()=>I(M.clientWidth||n);S();const z=new ResizeObserver(S);return z.observe(M),()=>{z.disconnect()}},[n]);const k=o===1,j={...x,height:n,fontSize:"var(--mantine-font-size-sm)",fontWeight:600,color:"var(--mantine-color-gray-9)"};return e.jsxs(t.Box,{style:{width:"100%",height:k?"100%":"auto",display:k?"flex":"block",flexDirection:k?"column":void 0,gap:k?d:void 0},children:[e.jsxs(t.Box,{style:{display:"grid",gridTemplateColumns:f,columnGap:d,rowGap:d,marginBottom:k?0:d},children:[e.jsx(t.Box,{style:j,children:r}),e.jsx(t.Box,{style:j,ref:m,children:"Plan"}),e.jsx(t.Box,{style:j,children:"Do"}),e.jsx(t.Box,{style:j,children:"Check"}),e.jsx(t.Box,{style:j,children:"Act"})]}),k?e.jsx(t.Box,{style:{flex:1,minHeight:`${h}px`,height:"100%"},children:e.jsx(ct,{height:"100%",minHeight:h,gridTemplateColumns:f,columnGap:d,cellStyle:x,rowHeaderContent:{userName:"John Doe",avatar:void 0,title:"This is a super long goal title in more than one line and it should be truncated",status:"yellow"},planContent:a,doContent:i,checkContent:l,actContent:c})}):e.jsx(t.Box,{children:y.map((M,S)=>e.jsxs(t.Box,{children:[e.jsx(t.Box,{style:{minHeight:`${h}px`,height:`${M}px`},children:e.jsx(ct,{height:M,minHeight:h,gridTemplateColumns:f,columnGap:d,cellStyle:x,rowHeaderContent:{avatar:void 0,userName:`John Doe ${S+1}`,title:"This is a super long goal title in more than one line and it should be truncated",status:"green"},planContent:a,doContent:i,checkContent:l,actContent:c})}),S<y.length-1&&e.jsx(jr,{gutter:d,onPointerDown:C(S),onPointerMove:w,onPointerUp:O,onDoubleClick:B(S)})]},`row-wrapper-${S}`))})]})},Xt=t.createTheme({primaryColor:"blue",fontFamily:'"Inter Variable", Inter, system-ui, Avenir, Helvetica, Arial, sans-serif',fontFamilyMonospace:"Monaco, Courier, monospace",headings:{fontFamily:'"Inter Variable", Inter, system-ui, Avenir, Helvetica, Arial, sans-serif'},colors:{gray:["#f9f8f7","#f1f0ef","#dfdedd","#b5b5b5","#9f9e9d","#91908c","#8b8983","#787670","#6b6962","#37352f"]},components:{}});function wr({children:n,theme:s}){return e.jsxs(t.MantineProvider,{theme:s||Xt,children:[e.jsx(gn.Notifications,{}),e.jsx(In.ModalsProvider,{children:e.jsx(yn.DatesProvider,{settings:{firstDayOfWeek:0},children:n})})]})}exports.ActionButton=ee;exports.ActionIcon=fe;exports.AppLayout=Yt;exports.AppLayoutProvider=Qt;exports.AvatarSelector=Le;exports.BaseLayout=Ir;exports.BoardLayout=br;exports.BoxAvatar=se;exports.CenterPeek=ur;exports.DocsTemplate=pr;exports.EditableText=we;exports.EditableTextarea=gt;exports.EmojiAvatar=dt;exports.ExpandableSearch=It;exports.FilterDropdown=Rn;exports.FilterDropdownButton=De;exports.FilterDropdownFilters=Ee;exports.FloatingIndicator=Pn;exports.FloatingIndicatorContent=Ke;exports.FloatingIndicatorProvider=Ze;exports.FloatingIndicatorTriggers=Xe;exports.FullPage=fr;exports.GenericTable=jt;exports.IconAvatar=ht;exports.ImageAvatar=xt;exports.InvitedUserCard=be;exports.LinkProperty=er;exports.Logo=mt;exports.Matrix=Gt;exports.Menu=je;exports.ModalSettings=Bo;exports.NavButton=Je;exports.NavLink=Qe;exports.Navbar=Ye;exports.NavbarProvider=Fo;exports.NotificationSidebar=Lo;exports.NumberProperty=tr;exports.PageLayout=qt;exports.PageProperty=he;exports.PlaceholderAvatar=ze;exports.PopoverItem=vt;exports.PopoverSelector=Ae;exports.SelectUserProperty=pe;exports.ShareButton=Co;exports.ShareMenu=Dt;exports.ShareModal=Mo;exports.SidePeek=_t;exports.SidePeekLayout=yr;exports.TeamPage=gr;exports.TeamProperties=Zt;exports.TeamSidePeek=mr;exports.TextButton=Re;exports.TextProperty=Jo;exports.TextareaProperty=et;exports.ThemeProvider=wr;exports.UserChip=Te;exports.WorkspaceSelector=$o;exports.WorkspaceSelectorItem=At;exports.getInitialsFromName=pt;exports.theme=Xt;exports.useAppLayout=tt;exports.useFloatingIndicator=Hn;exports.useNavbar=No;exports.useTeamProperties=nt;