obeyaka-ui 0.1.32 → 0.1.34
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.es.js +206 -202
- package/dist/index.js +2 -2
- package/dist/style.css +1 -1
- package/dist/types/components/molecules/NavLink/NavLink.d.ts.map +1 -1
- package/dist/types/components/organisms/Matrix/index.d.ts +21 -20
- package/dist/types/components/organisms/Matrix/index.d.ts.map +1 -1
- package/dist/types/components/organisms/WorkspaceSelector/WorkspaceSelector.d.ts.map +1 -1
- package/dist/types/theme/ThemeProvider.d.ts +1 -0
- package/dist/types/theme/ThemeProvider.d.ts.map +1 -1
- package/dist/types/theme/index.d.ts.map +1 -1
- package/package.json +2 -1
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var ct=Object.create;var on=Object.defineProperty;var lt=Object.getOwnPropertyDescriptor;var dt=Object.getOwnPropertyNames;var ut=Object.getPrototypeOf,ft=Object.prototype.hasOwnProperty;var ht=(n,s,o,r)=>{if(s&&typeof s=="object"||typeof s=="function")for(let a of dt(s))!ft.call(n,a)&&a!==o&&on(n,a,{get:()=>s[a],enumerable:!(r=lt(s,a))||r.enumerable});return n};var _e=(n,s,o)=>(o=n!=null?ct(ut(n)):{},ht(s||!n||!n.__esModule?on(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"),C=require("@tabler/icons-react"),Be=require("@emoji-mart/data"),cn=require("emoji-mart"),ye=require("@mantine/hooks"),xt=require("@mantine/notifications"),pt=require("@mantine/modals"),mt=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:y,onMouseEnter:p,onMouseLeave:I,...g})=>{const[b,j]=u.useState(!1),S=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]),T=u.useMemo(()=>({xs:2,sm:2,md:2,lg:2,xl:2.5})[i]||2,[i]),M=u.useCallback(E=>{j(!0),p==null||p(E)},[p]),k=u.useCallback(E=>{j(!1),I==null||I(E)},[I]),v=u.useMemo(()=>{if(l)return l;if(c==="transparent")return b?"var(--mantine-color-gray-2)":"transparent"},[l,c,b]),z=u.useMemo(()=>o&&r&&b?r:s,[o,r,b,s]),R=u.useMemo(()=>e.jsx(z,{size:w,strokeWidth:T,color:a}),[z,w,T,a]),B=e.jsx(t.ActionIcon,{onClick:S,bg:v,color:a,radius:"md",variant:c==="transparent"?"transparent":c,size:i,disabled:d||f,loading:f,onMouseEnter:M,onMouseLeave:k,"aria-label":m||h,className:x,style:y,...g,children:R});return h&&!d&&!f?e.jsx(t.Tooltip,{label:h,position:"top",withArrow:!0,children:B}):B});ee.displayName="ActionButton";const gt=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]},ln=({emoji:n,size:s="lg",editable:o=!1,onClick:r,className:a,style:i})=>{const c=gt(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,It=["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"],yt=async()=>{try{const n=await import("@tabler/icons-react");It.forEach(s=>{if(!le.has(s)){const o=n[s];o&&le.set(s,o)}})}catch(n){console.warn("Error preloading common icons:",n)}};yt();const vt=async n=>{if(le.has(n))return le.get(n);try{const r=(await import("@tabler/icons-react"))[n]||C.IconQuestionMark;return le.set(n,r),r}catch{return le.set(n,C.IconQuestionMark),C.IconQuestionMark}},jt=n=>n.replace(/^Icon/,"").replace(/([A-Z])/g," $1").trim().toLowerCase().replace(/^./,o=>o.toUpperCase()),dn=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:C.IconQuestionMark),c(!1))}catch{d.current&&(a(()=>C.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:jt(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)"})})})});dn.displayName="IconButton";const un=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),y=Math.round(x*.9);u.useEffect(()=>{if(le.has(n)){m(()=>le.get(n));return}let I=!0;return vt(n).then(g=>{I&&m(()=>g)}),()=>{I=!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:I=>{f(!0),c==null||c(I)},onMouseLeave:I=>{f(!1),l==null||l(I)},children:e.jsx(h,{size:y,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:I=>{f(!0),c==null||c(I)},onMouseLeave:I=>{f(!1),l==null||l(I)}})});un.displayName="IconAvatar";const bt=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]},fn=({iconName:n,size:s="lg",editable:o=!1,onClick:r,className:a,style:i})=>{const c=bt(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(un,{iconName:n,size:c.width,onClick:void 0})})})},wt=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]},hn=({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=wt(s),m=o&&r,x=()=>{f(!0)},y=()=>{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:y})})},St=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=St(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})})},xn=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(ln,{emoji:n.value,size:s,editable:d,onClick:r});case"icon":return e.jsx(fn,{iconName:n.value,size:s,editable:d,onClick:r});case"image":return e.jsx(hn,{src:n.value,size:s,editable:d,onClick:r})}if(c){const m=l?xn(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})})},kt=new URL("data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTUiIGhlaWdodD0iNTYiIHZpZXdCb3g9IjAgMCA1NSA1NiIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZD0iTTAgMC43NUg1NVY1NS43NUgwVjAuNzVaIiBmaWxsPSIjRjZGNUY0Ii8+CjxwYXRoIGQ9Ik04LjgwMDI5IDM0LjYzQzguODAwMjkgMzQuMTQ0IDkuMTk0MjggMzMuNzUgOS42ODAyOSAzMy43NUgxOC45MjAzQzE5LjQwNjMgMzMuNzUgMTkuODAwMyAzNC4xNDQgMTkuODAwMyAzNC42M1Y0My44N0MxOS44MDAzIDQ0LjM1NiAxOS40MDYzIDQ0Ljc1IDE4LjkyMDMgNDQuNzVIOS42ODAyOUM5LjE5NDI4IDQ0Ljc1IDguODAwMjkgNDQuMzU2IDguODAwMjkgNDMuODdWMzQuNjNaIiBmaWxsPSIjRkZDQTAwIi8+CjxwYXRoIGQ9Ik0yMi4wMDAyIDIzLjYzQzIyLjAwMDIgMjMuMTQ0IDIyLjM5NDIgMjIuNzUgMjIuODgwMiAyMi43NUgzMi4xMjAyQzMyLjYwNjMgMjIuNzUgMzMuMDAwMiAyMy4xNDQgMzMuMDAwMiAyMy42M1Y0My44N0MzMy4wMDAyIDQ0LjM1NiAzMi42MDYzIDQ0Ljc1IDMyLjEyMDIgNDQuNzVIMjIuODgwMkMyMi4zOTQyIDQ0Ljc1IDIyLjAwMDIgNDQuMzU2IDIyLjAwMDIgNDMuODdWMjMuNjNaIiBmaWxsPSIjMzdDRTkxIi8+CjxwYXRoIGQ9Ik0zNS4yMDAyIDEyLjYzQzM1LjIwMDIgMTIuMTQ0IDM1LjU5NDIgMTEuNzUgMzYuMDgwMiAxMS43NUg0NS4zMjAyQzQ1LjgwNjIgMTEuNzUgNDYuMjAwMiAxMi4xNDQgNDYuMjAwMiAxMi42M1Y0My44N0M0Ni4yMDAyIDQ0LjM1NiA0NS44MDYyIDQ0Ljc1IDQ1LjMyMDIgNDQuNzVIMzYuMDgwMkMzNS41OTQyIDQ0Ljc1IDM1LjIwMDIgNDQuMzU2IDM1LjIwMDIgNDMuODdWMTIuNjNaIiBmaWxsPSIjRkIzNzU3Ii8+CjxwYXRoIGQ9Ik04LjgwMDA1IDE3LjI1QzguODAwMDUgMTQuMjEyNCAxMS4yNjI1IDExLjc1IDE0LjMgMTEuNzVDMTcuMzM3NiAxMS43NSAxOS44IDE0LjIxMjQgMTkuOCAxNy4yNUMxOS44IDIwLjI4NzYgMTcuMzM3NiAyMi43NSAxNC4zIDIyLjc1QzExLjI2MjUgMjIuNzUgOC44MDAwNSAyMC4yODc2IDguODAwMDUgMTcuMjVaIiBmaWxsPSIjMDA3MkZGIi8+Cjwvc3ZnPgo=",self.location).href,pn=({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:kt,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:y=!1,pageTitle:p=!1,onHover:I=b=>{},...g})=>{const[b,j]=u.useState(!1),[S,w]=u.useState(n),[T,M]=u.useState(!1);u.useEffect(()=>{I(T)},[T,I]);const k=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(()=>{w(n)},[n]);const z=()=>{i||(j(!0),y&&k.current&&k.current.select())},R=()=>{j(!1),S!==n&&o(S)},B=L=>{w(L.target.value),r==null||r(L.target.value)},E=L=>{var _,N;L.key==="Enter"?(j(!1),o(S),(_=k.current)==null||_.blur()):L.key==="Escape"&&(w(n),j(!1),(N=k.current)==null||N.blur())},W={cursor:i?"not-allowed":"text"},H={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)"},$=()=>p?{...H,...v}:H;return e.jsx(t.InputWrapper,{label:s,size:l,children:e.jsx(t.Input,{ref:k,value:S,onChange:B,onMouseEnter:()=>M(!0),onMouseLeave:()=>M(!1),onFocus:z,onBlur:R,onKeyDown:E,placeholder:a,disabled:i,size:l,fw:500,radius:d,className:f,style:{...W,...h},styles:{input:{...$()}},...g})})},mn=({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:y=!1,minRows:p=1,maxRows:I,autosize:g=!0,onHover:b=w=>{},pageTitle:j=!1,...S})=>{const[w,T]=u.useState(!1),[M,k]=u.useState(n),[v,z]=u.useState(!1);u.useEffect(()=>{b(v)},[v,b]);const R=u.useRef(null);u.useEffect(()=>{k(n)},[n]);const B=()=>{const F=R.current;F&&(F.style.height="0px",F.style.minHeight="0px",F.style.overflowY="hidden",F.style.height=`${F.scrollHeight}px`)};u.useEffect(()=>{g&&B()},[g]),u.useEffect(()=>{g&&B()},[M,g]);const E=()=>{i||(T(!0),g&&requestAnimationFrame(()=>B()),y&&R.current&&R.current.select())},W=()=>{T(!1),M!==n&&o(M)},H=F=>{k(F.target.value),r==null||r(F.target.value)},$=F=>{var G;F.key==="Escape"&&(k(n),T(!1),(G=R.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:w&&m?x:void 0,borderWidth:w&&m?"1px":void 0,color:"var(--mantine-color-gray-9)",width:"100%",fontWeight:450},N={fontSize:"40px",fontWeight:700,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:R,value:M,onChange:H,onMouseEnter:()=>z(!0),onMouseLeave:()=>z(!1),onFocus:E,onBlur:W,onKeyDown:$,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:I,...S})})},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),y=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:y}),!c&&y]})}),gn=({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),[y,p]=u.useState(o),I=u.useRef(null),g=u.useRef(null);u.useEffect(()=>{p(o)},[o]),u.useEffect(()=>{f&&I.current&&I.current.focus()},[f]),u.useEffect(()=>{const v=z=>{g.current&&!g.current.contains(z.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)},S=v=>{const z=v.target.value;p(z),r==null||r(z)},w=v=>{v.key==="Enter"&&(a==null||a(y)),v.key==="Escape"&&b()},T=()=>{p(""),r==null||r(""),i==null||i(),b()},k=(()=>{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:k.inputHeight,height:k.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(C.IconSearch,{size:k.iconSize,color:"var(--mantine-color-gray-6)",strokeWidth:2.3})}),f&&e.jsx(t.TextInput,{ref:I,value:y,onChange:S,onKeyDown:w,placeholder:s,disabled:l,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:y&&e.jsx(t.Box,{onClick:T,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(C.IconX,{size:14,color:"var(--mantine-color-gray-6)",strokeWidth:2.3})}),rightSectionWidth:y?24:0})]}),e.jsx("style",{children:`
|
|
1
|
+
"use strict";var ct=Object.create;var on=Object.defineProperty;var lt=Object.getOwnPropertyDescriptor;var dt=Object.getOwnPropertyNames;var ut=Object.getPrototypeOf,ft=Object.prototype.hasOwnProperty;var ht=(n,s,o,r)=>{if(s&&typeof s=="object"||typeof s=="function")for(let a of dt(s))!ft.call(n,a)&&a!==o&&on(n,a,{get:()=>s[a],enumerable:!(r=lt(s,a))||r.enumerable});return n};var _e=(n,s,o)=>(o=n!=null?ct(ut(n)):{},ht(s||!n||!n.__esModule?on(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"),C=require("@tabler/icons-react"),Be=require("@emoji-mart/data"),cn=require("emoji-mart"),ye=require("@mantine/hooks"),xt=require("@mantine/notifications"),pt=require("@mantine/modals"),mt=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:y,onMouseEnter:p,onMouseLeave:I,...g})=>{const[b,j]=u.useState(!1),S=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]),T=u.useMemo(()=>({xs:2,sm:2,md:2,lg:2,xl:2.5})[i]||2,[i]),M=u.useCallback(E=>{j(!0),p==null||p(E)},[p]),k=u.useCallback(E=>{j(!1),I==null||I(E)},[I]),v=u.useMemo(()=>{if(l)return l;if(c==="transparent")return b?"var(--mantine-color-gray-2)":"transparent"},[l,c,b]),z=u.useMemo(()=>o&&r&&b?r:s,[o,r,b,s]),R=u.useMemo(()=>e.jsx(z,{size:w,strokeWidth:T,color:a}),[z,w,T,a]),B=e.jsx(t.ActionIcon,{onClick:S,bg:v,color:a,radius:"md",variant:c==="transparent"?"transparent":c,size:i,disabled:d||f,loading:f,onMouseEnter:M,onMouseLeave:k,"aria-label":m||h,className:x,style:y,...g,children:R});return h&&!d&&!f?e.jsx(t.Tooltip,{label:h,position:"top",withArrow:!0,children:B}):B});ee.displayName="ActionButton";const gt=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]},ln=({emoji:n,size:s="lg",editable:o=!1,onClick:r,className:a,style:i})=>{const c=gt(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,It=["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"],yt=async()=>{try{const n=await import("@tabler/icons-react");It.forEach(s=>{if(!le.has(s)){const o=n[s];o&&le.set(s,o)}})}catch(n){console.warn("Error preloading common icons:",n)}};yt();const vt=async n=>{if(le.has(n))return le.get(n);try{const r=(await import("@tabler/icons-react"))[n]||C.IconQuestionMark;return le.set(n,r),r}catch{return le.set(n,C.IconQuestionMark),C.IconQuestionMark}},jt=n=>n.replace(/^Icon/,"").replace(/([A-Z])/g," $1").trim().toLowerCase().replace(/^./,o=>o.toUpperCase()),dn=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:C.IconQuestionMark),c(!1))}catch{d.current&&(a(()=>C.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:jt(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)"})})})});dn.displayName="IconButton";const un=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),y=Math.round(x*.9);u.useEffect(()=>{if(le.has(n)){m(()=>le.get(n));return}let I=!0;return vt(n).then(g=>{I&&m(()=>g)}),()=>{I=!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:I=>{f(!0),c==null||c(I)},onMouseLeave:I=>{f(!1),l==null||l(I)},children:e.jsx(h,{size:y,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:I=>{f(!0),c==null||c(I)},onMouseLeave:I=>{f(!1),l==null||l(I)}})});un.displayName="IconAvatar";const bt=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]},fn=({iconName:n,size:s="lg",editable:o=!1,onClick:r,className:a,style:i})=>{const c=bt(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(un,{iconName:n,size:c.width,onClick:void 0})})})},wt=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]},hn=({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=wt(s),m=o&&r,x=()=>{f(!0)},y=()=>{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:y})})},St=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=St(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})})},xn=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(ln,{emoji:n.value,size:s,editable:d,onClick:r});case"icon":return e.jsx(fn,{iconName:n.value,size:s,editable:d,onClick:r});case"image":return e.jsx(hn,{src:n.value,size:s,editable:d,onClick:r})}if(c){const m=l?xn(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})})},kt=new URL("data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTUiIGhlaWdodD0iNTYiIHZpZXdCb3g9IjAgMCA1NSA1NiIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZD0iTTAgMC43NUg1NVY1NS43NUgwVjAuNzVaIiBmaWxsPSIjRjZGNUY0Ii8+CjxwYXRoIGQ9Ik04LjgwMDI5IDM0LjYzQzguODAwMjkgMzQuMTQ0IDkuMTk0MjggMzMuNzUgOS42ODAyOSAzMy43NUgxOC45MjAzQzE5LjQwNjMgMzMuNzUgMTkuODAwMyAzNC4xNDQgMTkuODAwMyAzNC42M1Y0My44N0MxOS44MDAzIDQ0LjM1NiAxOS40MDYzIDQ0Ljc1IDE4LjkyMDMgNDQuNzVIOS42ODAyOUM5LjE5NDI4IDQ0Ljc1IDguODAwMjkgNDQuMzU2IDguODAwMjkgNDMuODdWMzQuNjNaIiBmaWxsPSIjRkZDQTAwIi8+CjxwYXRoIGQ9Ik0yMi4wMDAyIDIzLjYzQzIyLjAwMDIgMjMuMTQ0IDIyLjM5NDIgMjIuNzUgMjIuODgwMiAyMi43NUgzMi4xMjAyQzMyLjYwNjMgMjIuNzUgMzMuMDAwMiAyMy4xNDQgMzMuMDAwMiAyMy42M1Y0My44N0MzMy4wMDAyIDQ0LjM1NiAzMi42MDYzIDQ0Ljc1IDMyLjEyMDIgNDQuNzVIMjIuODgwMkMyMi4zOTQyIDQ0Ljc1IDIyLjAwMDIgNDQuMzU2IDIyLjAwMDIgNDMuODdWMjMuNjNaIiBmaWxsPSIjMzdDRTkxIi8+CjxwYXRoIGQ9Ik0zNS4yMDAyIDEyLjYzQzM1LjIwMDIgMTIuMTQ0IDM1LjU5NDIgMTEuNzUgMzYuMDgwMiAxMS43NUg0NS4zMjAyQzQ1LjgwNjIgMTEuNzUgNDYuMjAwMiAxMi4xNDQgNDYuMjAwMiAxMi42M1Y0My44N0M0Ni4yMDAyIDQ0LjM1NiA0NS44MDYyIDQ0Ljc1IDQ1LjMyMDIgNDQuNzVIMzYuMDgwMkMzNS41OTQyIDQ0Ljc1IDM1LjIwMDIgNDQuMzU2IDM1LjIwMDIgNDMuODdWMTIuNjNaIiBmaWxsPSIjRkIzNzU3Ii8+CjxwYXRoIGQ9Ik04LjgwMDA1IDE3LjI1QzguODAwMDUgMTQuMjEyNCAxMS4yNjI1IDExLjc1IDE0LjMgMTEuNzVDMTcuMzM3NiAxMS43NSAxOS44IDE0LjIxMjQgMTkuOCAxNy4yNUMxOS44IDIwLjI4NzYgMTcuMzM3NiAyMi43NSAxNC4zIDIyLjc1QzExLjI2MjUgMjIuNzUgOC44MDAwNSAyMC4yODc2IDguODAwMDUgMTcuMjVaIiBmaWxsPSIjMDA3MkZGIi8+Cjwvc3ZnPgo=",self.location).href,pn=({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:kt,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:y=!1,pageTitle:p=!1,onHover:I=b=>{},...g})=>{const[b,j]=u.useState(!1),[S,w]=u.useState(n),[T,M]=u.useState(!1);u.useEffect(()=>{I(T)},[T,I]);const k=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(()=>{w(n)},[n]);const z=()=>{i||(j(!0),y&&k.current&&k.current.select())},R=()=>{j(!1),S!==n&&o(S)},B=L=>{w(L.target.value),r==null||r(L.target.value)},E=L=>{var _,N;L.key==="Enter"?(j(!1),o(S),(_=k.current)==null||_.blur()):L.key==="Escape"&&(w(n),j(!1),(N=k.current)==null||N.blur())},W={cursor:i?"not-allowed":"text"},H={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)"},$=()=>p?{...H,...v}:H;return e.jsx(t.InputWrapper,{label:s,size:l,children:e.jsx(t.Input,{ref:k,value:S,onChange:B,onMouseEnter:()=>M(!0),onMouseLeave:()=>M(!1),onFocus:z,onBlur:R,onKeyDown:E,placeholder:a,disabled:i,size:l,fw:500,radius:d,className:f,style:{...W,...h},styles:{input:{...$()}},...g})})},mn=({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:y=!1,minRows:p=1,maxRows:I,autosize:g=!0,onHover:b=w=>{},pageTitle:j=!1,...S})=>{const[w,T]=u.useState(!1),[M,k]=u.useState(n),[v,z]=u.useState(!1);u.useEffect(()=>{b(v)},[v,b]);const R=u.useRef(null);u.useEffect(()=>{k(n)},[n]);const B=()=>{const F=R.current;F&&(F.style.height="0px",F.style.minHeight="0px",F.style.overflowY="hidden",F.style.height=`${F.scrollHeight}px`)};u.useEffect(()=>{g&&B()},[g]),u.useEffect(()=>{g&&B()},[M,g]);const E=()=>{i||(T(!0),g&&requestAnimationFrame(()=>B()),y&&R.current&&R.current.select())},W=()=>{T(!1),M!==n&&o(M)},H=F=>{k(F.target.value),r==null||r(F.target.value)},$=F=>{var G;F.key==="Escape"&&(k(n),T(!1),(G=R.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:w&&m?x: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"},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:R,value:M,onChange:H,onMouseEnter:()=>z(!0),onMouseLeave:()=>z(!1),onFocus:E,onBlur:W,onKeyDown:$,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:I,...S})})},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),y=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:y}),!c&&y]})}),gn=({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),[y,p]=u.useState(o),I=u.useRef(null),g=u.useRef(null);u.useEffect(()=>{p(o)},[o]),u.useEffect(()=>{f&&I.current&&I.current.focus()},[f]),u.useEffect(()=>{const v=z=>{g.current&&!g.current.contains(z.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)},S=v=>{const z=v.target.value;p(z),r==null||r(z)},w=v=>{v.key==="Enter"&&(a==null||a(y)),v.key==="Escape"&&b()},T=()=>{p(""),r==null||r(""),i==null||i(),b()},k=(()=>{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:k.inputHeight,height:k.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(C.IconSearch,{size:k.iconSize,color:"var(--mantine-color-gray-6)",strokeWidth:2.3})}),f&&e.jsx(t.TextInput,{ref:I,value:y,onChange:S,onKeyDown:w,placeholder:s,disabled:l,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:y&&e.jsx(t.Box,{onClick:T,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(C.IconX,{size:14,color:"var(--mantine-color-gray-6)",strokeWidth:2.3})}),rightSectionWidth:y?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=I=>{if(I==="remove-filters")s([]);else{const g=o==null?void 0:o.find(b=>b.value===I);if(g){const b={id:`${g.value}-${Date.now()}`,filterOption:g};s([...n,b])}}i.closeDropdown()},h=(o||[]).filter(I=>!n.some(g=>g.filterOption.value===I.value)),m={borderRadius:"var(--mantine-radius-md)",fontSize:"var(--mantine-font-size-sm)",color:"var(--mantine-color-gray-7)",fontWeight:"500"},y=(()=>{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",...y},onMouseEnter:()=>l(!0),onMouseLeave:()=>l(!1),onClick:()=>i.toggleDropdown(),children:e.jsx(C.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(I=>e.jsx(t.Combobox.Option,{value:I.value,style:{...m},children:e.jsxs(t.Box,{style:{display:"flex",alignItems:"center",gap:"8px"},children:[I.icon,I.label]})},I.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(C.IconFilterOff,{size:16,stroke:2}),"Remove filters"]})})]})})]})},Ct=({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=y=>{if(y==="remove")o();else{const p=d.find(I=>I.value===y);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(C.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(y=>{var p;return e.jsx(t.Combobox.Option,{value:y.value,active:((p=n.selectedOption)==null?void 0:p.value)===y.value,style:{...h},children:y.label},y.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"})]})})]})},Mt=({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 y=o==null?void 0:o.find(p=>p.value===x);if(y){const p={id:`${y.value}-${Date.now()}`,filterOption:y};s([...n,p])}a.closeDropdown()},d=(o||[]).filter(x=>!n.some(y=>y.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(Ct,{filterTag:f,onUpdate:c,onRemove:()=>l(f.id),size:r,options:h,filterTagDropdownPosition:i},f.id)}),d.length>0&&e.jsx(Mt,{activeFilters:n,onFiltersChange:s,availableFilters:d,size:r})]})})},Tt=({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})]}),Bt=Object.assign(Tt,{Button:Re,Filters:De}),Ot=({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(Ot,{...l},d))]})]})},zt="floatingIndicator-module__wrapper___oBPtC",Rt="floatingIndicator-module__control___5GZIX",Dt="floatingIndicator-module__label___Qmy1z",Et="floatingIndicator-module__icon___sjrda",At="floatingIndicator-module__indicator___p7zco",Lt="floatingIndicator-module__content___UXG3x",ge={wrapper:zt,control:Rt,label:Dt,icon:Et,indicator:At,content:Lt},In=u.createContext(null),qe=()=>{const n=u.useContext(In);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 k;const[l,d]=u.useState(null),[f,h]=u.useState({}),[m,x]=u.useState(o??((k=n[0])==null?void 0:k.id)),y=s!==void 0,p=u.useRef(new Map),I=u.useCallback((v,z)=>{h(R=>{if(z)return R[v]===z?R:{...R,[v]:z};if(!(v in R))return R;const B={...R};return delete B[v],B})},[]),g=u.useCallback(v=>(p.current.has(v)||p.current.set(v,z=>{I(v,z)}),p.current.get(v)),[I]);u.useEffect(()=>{const v=new Set(n.map(z=>z.id));p.current.forEach((z,R)=>{v.has(R)||p.current.delete(R)}),h(z=>{if(!Object.keys(z).some(E=>!v.has(E)))return z;const B={};return Object.entries(z).forEach(([E,W])=>{v.has(E)&&(B[E]=W)}),B})},[n]),u.useEffect(()=>{var z;if(y)return;const v=o&&n.some(R=>R.id===o)&&o||((z=n[0])==null?void 0:z.id);x(R=>R&&n.some(B=>B.id===R)?R:v)},[n,o,y]);const b=(y?s:m)??null,j=u.useMemo(()=>n.find(v=>v.id===b),[n,b]),S=u.useCallback((v,z)=>()=>{z||(y||x(v),r==null||r(v))},[y,r]),w=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]),T=u.useMemo(()=>{if(!a)return{};const{className:v,...z}=a;return z},[a]),M=u.useMemo(()=>({items:n,currentActiveId:b,showIcons:i,handleItemClick:S,getControlRefCallback:g,setParentRef:d,parentRef:l,indicatorClassName:w,indicatorProps:T,activeItem:j,controlsRefs:f}),[n,b,i,S,g,l,w,T,j,f]);return e.jsx(In.Provider,{value:M,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(y=>{const p=y.icon,I=y.id===r,g=!!(p&&a);return e.jsxs(t.UnstyledButton,{ref:c(y.id),onClick:i(y.id,y.disabled),"data-active":I,className:ge.control,disabled:y.disabled,children:[g&&p&&e.jsx("span",{className:ge.icon,children:e.jsx(p,{size:16})}),e.jsx("span",{className:ge.label,children:y.label})]},y.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})},Ft=({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,{})]})}),Nt=qe,Ut=Object.assign(Ft,{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})]})})},Qe=({label:n,rightLabel:s,children:o,onAddChild:r,onMenuAction:a,menuItems:i,color:c="gray",defaultText:l="No items",level:d=0,disabled:f=!1,noChild:h=!1,isActive:m=!1,showAvatar:x=!0,avatar:y,placeholder:p,onClick:I,"aria-label":g,...b})=>{const[j,S]=u.useState(!1),[w,T]=u.useState(!1),[M,k]=u.useState(!1),v=w||M,z=u.Children.count(o)>0,R=!h&&z&&(x?v:!0),B=u.useCallback(()=>{f||I==null||I()},[I,f]),E=u.useCallback(F=>{F.stopPropagation(),!f&&(r==null||r())},[r,f]),W=u.useCallback(F=>{F==null||F.stopPropagation(),!f&&z&&!h&&S(G=>!G)},[f,z,h]),H=u.useCallback(()=>{f||r==null||r()},[r,f]),$=u.useCallback(F=>{f||a==null||a(F)},[a,f,n]),L=u.useCallback(()=>z?u.Children.map(o,F=>u.isValidElement(F)?u.cloneElement(F,{...F.props,level:d+1}):F):null,[o,z,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:()=>$(F.action)})))||[],N=[{children:e.jsxs(t.Group,{gap:"xs",wrap:"nowrap",children:[e.jsx(C.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,{style:{cursor:f?"not-allowed":"pointer",borderRadius:"8px"},variant:"transparent",justify:"space-between",display:"flex",color:c,size:"md",radius:"md",w:"100%",px:6,h:40,onMouseEnter:()=>!f&&T(!0),onMouseLeave:()=>{M||T(!1)},onClick:B,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:B,style:{paddingLeft:h&&!R?`${(d+1)*32}px`:d>0?`${d*32}px`:"0px"},children:[R?e.jsx(fe,{icon:j?C.IconChevronDown:C.IconChevronRight,iconOnHover:j?C.IconChevronDown:C.IconChevronRight,grayScaleBaseColor:v?1:0,color:"var(--mantine-color-gray-7)",onClick:W,disabled:f}):x?e.jsx(se,{size:"xs",avatar:y,showPlaceholder:!0,placeholder:p}):null,e.jsx(t.Text,{size:"sm",fw:600,c:"var(--mantine-color-gray-7)",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:C.IconPlus,grayScaleBaseColor:v?1:0,onClick:H,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:C.IconDots,grayScaleBaseColor:1,color:"var(--mantine-color-gray-7)"}),position:"bottom-end",shadow:"md",onOpen:()=>{k(!0),T(!0)},onClose:()=>{k(!1)}})})]})]})]})}),j&&!h&&e.jsx(t.Stack,{gap:0,style:{width:"100%"},children:z?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})})})]})},Wt="userChip-module__pill___DgFME",$t={pill:Wt},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:$t.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:450,c:"var(--mantine-color-gray-9)",children:s})]})}),Pt="200px",Ht="4px 8px",Gt=40,_t="var(--mantine-radius-md)",Vt=16,yn=({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:Pt,backgroundColor:o?"transparent":i?"var(--mantine-color-gray-1)":"transparent",cursor:o?"default":"pointer",borderRadius:_t,padding:Ht,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:Gt,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(C.IconCheck,{size:Vt,color:"var(--mantine-color-gray-9)"})]})})},Qt="bottom-end",Yt=1e4,qt="24px",Zt="0 8px",Xt="6px",rn="var(--mantine-radius-md)",Kt="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})=>{const[y,p]=u.useState(!1),I=(o||[]).find(v=>v.value===n)||d,[g,b]=u.useState(!1),[j,S]=u.useState(!1),[w,T]=u.useState(!1),M=r?e.jsx(t.Group,{p:"sm",onClick:v=>{v.stopPropagation(),i==null||i(n)},style:{cursor:"pointer",height:Kt,display:"flex",alignItems:"center",borderRadius:rn,backgroundColor:j?"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,k=e.jsxs(t.Box,{onMouseEnter:()=>!l&&b(!0),onMouseLeave:()=>!l&&b(!1),onClick:()=>{l||(p(!0),T(!0))},style:{height:qt,cursor:l?"not-allowed":"pointer",display:"inline-flex",alignItems:"center",borderRadius:rn,backgroundColor:l?"transparent":g||w?"var(--mantine-color-gray-1)":"transparent",transition:"background-color 0.2s ease",padding:Zt,gap:Xt,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:(I==null?void 0:I.label)||"Select option"}),e.jsx(C.IconChevronDown,{size:16,style:{color:l?"var(--mantine-color-gray-3)":"var(--mantine-color-gray-6)"}})]});return e.jsxs(t.Popover,{opened:y,onChange:v=>{p(v),v||T(!1)},position:Qt,shadow:"md",withinPortal:!0,zIndex:Yt,styles:f,children:[e.jsx(t.Popover.Target,{children:k}),e.jsx(t.Popover.Dropdown,{onClick:v=>v.stopPropagation(),onMouseDown:v=>v.stopPropagation(),styles:{dropdown:{borderRadius:"var(--mantine-radius-md)",padding:"4px",...h}},children:e.jsxs(t.Stack,{gap:0,onClick:v=>v.stopPropagation(),onMouseDown:v=>v.stopPropagation(),children:[(o||[]).map(v=>{const z=c.includes(v.value),R=v.value===n;return e.jsx(yn,{item:v,withAvatars:a,disabled:z,selected:R,onClick:B=>{s==null||s(B),p(!1),T(!1)}},v.value)}),M]})})]})},Jt=(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}},vn=({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:y,sortDirection:p,onSearch:I,onRowClick:g,size:b="md",striped:j=!1,highlightOnHover:S=!0,enableInfiniteScroll:w=!1,isLoadingMore:T=!1,hasMore:M=!1,onLoadMore:k})=>{const[v,z]=u.useState(""),[R,B]=u.useState([]),{loadMoreRef:E}=Jt(w,k||(()=>{}),M,T),W=u.useMemo(()=>[...f?o.filter(D=>D.type==="select"&&D.options).map(D=>({value:D.key,label:D.label})):[],...h],[o,f,h]),H=u.useMemo(()=>{let O=s||[];if(v){const D=v.toLowerCase();O=O.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 R.forEach(D=>{if(D.filterTag.selectedOption){const A=o.find(U=>U.key===D.filterTag.filterOption.value);A&&(O=O.filter(U=>{var ne;const V=U[A.key];return String(V)===((ne=D.filterTag.selectedOption)==null?void 0:ne.value)}))}}),O},[s,v,R,o]),$=O=>{z(O),I==null||I(O)},L=O=>{const D=o.find(U=>U.key===O);if(!(D!=null&&D.sortable))return;const A=y===O&&p==="asc"?"desc":"asc";x==null||x(O,A)},_=O=>{const D=o.find(A=>A.key===O);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=(O,D)=>{var U,V,ne,P,oe;const A=D[O.key];switch(O.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=O.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 O.options?e.jsx(Ee,{value:A,data:O.options,placeholder:O.label,onChange:re=>{var me;return(me=O.onSelectChange)==null?void 0:me.call(O,re,D)},disabled:(U=O.disabled)==null?void 0:U.call(O,D)}):e.jsx(t.Text,{size:"sm",c:"dimmed",children:"—"});case"badge":const Le=((V=O.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=((ne=O.fallbackText)==null?void 0:ne.call(O,D))||String(A).charAt(0).toUpperCase();return e.jsx(se,{avatar:A,size:"xs",placeholder:Fe,showPlaceholder:!0});case"custom":return((P=O.render)==null?void 0:P.call(O,A,D))||e.jsx(t.Text,{size:"sm",c:"dimmed",children:"—"});case"actions":return(oe=O.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(C.IconDots,{size:16})})}),e.jsx(t.Menu.Dropdown,{children:O.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=O=>{var D;return(D=o.find(A=>A.key===O))!=null&&D.sortable?y===O?p==="asc"?e.jsx(C.IconChevronUp,{size:14}):e.jsx(C.IconChevronDown,{size:14}):e.jsx(C.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(gn,{placeholder:d,value:v,onChange:$,onSearch:$,expandDirection:"right",size:G.buttonSize}),W.length>0&&e.jsx(Re,{activeFilters:R.map(O=>O.filterTag),onFiltersChange:O=>{B(O.map(D=>({filterTag:D,onUpdate:()=>{},onRemove:()=>{}}))),m==null||m(O)},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:R.map(O=>O.filterTag),onFiltersChange:O=>{B(O.map(D=>({filterTag:D,onUpdate:()=>{},onRemove:()=>{}}))),m==null||m(O)},availableFilters:W,size:"md",getFilterOptions:_})]}),a,e.jsxs(t.Table,{striped:j,highlightOnHover:S,highlightOnHoverColor:"var(--mantine-color-gray-0)",mt:"xs",children:[e.jsx(t.Table.Thead,{children:e.jsx(t.Table.Tr,{children:o.map(O=>e.jsx(t.Table.Th,{c:"var(--mantine-color-gray-6)",style:{width:O.width,textAlign:O.align||"left",cursor:O.sortable?"pointer":"default"},onClick:()=>O.sortable&&L(O.key),children:e.jsxs(t.Group,{gap:"xs",wrap:"nowrap",children:[O.icon&&e.jsx(t.Box,{style:{display:"flex",alignItems:"center"},children:O.icon}),e.jsx(t.Text,{size:G.textSize,fw:500,children:O.label}),Z(O.key)]})},String(O.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:l})})}):H.map((O,D)=>e.jsx(t.Table.Tr,{style:{cursor:g?"pointer":"default"},onClick:()=>g==null?void 0:g(O),children:o.map(A=>e.jsx(t.Table.Td,{style:{textAlign:A.align||"left"},children:N(A,O)},String(A.key)))},O.id||D))})]}),w&&e.jsx(t.Box,{ref:E,style:{padding:"16px",display:"flex",justifyContent:"center",alignItems:"center",minHeight:"60px"},children:T&&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(vn,{});const eo=({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,y]=u.useState(null),[p,I]=u.useState(null),g=u.useCallback(v=>{i(v)},[]),b=u.useCallback(v=>{l(v)},[]),j=u.useCallback(v=>{I(v);const z=new FileReader;z.onload=R=>{var E;const B=(E=R.target)==null?void 0:E.result;f(B)},z.readAsDataURL(v)},[]),S=u.useCallback(v=>{m(v),f(null),I(null),y(null),n==null||n({type:"emoji",value:v}),s==null||s(v)},[n,s]),w=u.useCallback(v=>{y(v),f(null),I(null),m(null),n==null||n({type:"icon",value:v}),r==null||r(v)},[n,r]),T=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]),M=u.useCallback(()=>{f(null),I(null),m(null),y(null)},[]),k=u.useCallback(()=>{f(null),m(null),y(null),I(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:T,handleEmojiSelect:S,handleIconSelect:w,clearImagePreview:M,resetState:k}},no=({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}},to=({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 sn=!1;sn||(cn.init({data:Be}),sn=!0);const oo=()=>{const n=[{id:"frequent",name:"Frequently Used",icon:e.jsx(C.IconClock,{size:20,strokeWidth:2.5})}];return Be.categories.forEach(s=>{if(s.emojis&&s.emojis.length>0){let o=e.jsx(C.IconMoodSmile,{size:20,strokeWidth:2}),r=s.name;switch(s.id){case"people":o=e.jsx(C.IconMoodSmile,{size:20,strokeWidth:2}),r="Smileys & People";break;case"nature":o=e.jsx(C.IconTrees,{size:20,strokeWidth:2}),r="Animals & Nature";break;case"foods":o=e.jsx(C.IconApple,{size:20,strokeWidth:2}),r="Food & Drink";break;case"activity":o=e.jsx(C.IconBallBasketball,{size:20,strokeWidth:2}),r="Activities";break;case"travel":o=e.jsx(C.IconPlane,{size:20,strokeWidth:2}),r="Travel & Places";break;case"places":o=e.jsx(C.IconPlane,{size:20,strokeWidth:2}),r="Travel & Places";break;case"objects":o=e.jsx(C.IconBulb,{size:20,strokeWidth:2}),r="Objects";break;case"symbols":o=e.jsx(C.IconHeart,{size:20,strokeWidth:2}),r="Symbols";break;case"flags":o=e.jsx(C.IconFlag,{size:20,strokeWidth:2}),r="Flags";break;case"frequent":return;default:o=e.jsx(C.IconMoodSmile,{size:20,strokeWidth:2}),r=`Category: ${s.id}`;break}n.push({id:s.id,name:r,icon:o})}}),n},ro=({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=oo();u.useEffect(()=>{o.trim()?(m(!0),cn.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 y=u.useMemo(()=>{if(o.trim())return d;if(a==="frequent")return c.map(b=>({id:b,native:b,name:"",keywords:[]}));const g=Be.categories.find(b=>b.id===a);return g?g.emojis.map(b=>{const j=Be.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(w=>w!==g),S=[g,...j].slice(0,20);return typeof window<"u"&&localStorage.setItem("emoji-frequent",JSON.stringify(S)),S})},I=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(C.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:I(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..."}):y.length>0?y.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))})})]})},jn=["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"],bn=["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"],wn=["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"],Sn=["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"],kn=["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"],Cn=["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"],Mn=["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"],Tn=["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"];[...jn,...bn,...wn,...Sn,...kn,...Cn,...Mn,...Tn];const Ie=[{id:"recent",name:"Recently Used",icons:[],isDynamic:!0},{id:"user",name:"User & Profile",icons:jn},{id:"business",name:"Business & Work",icons:bn},{id:"tech",name:"Technology",icons:wn},{id:"expressions",name:"Expressions",icons:Sn},{id:"nature",name:"Nature & Animals",icons:kn},{id:"shapes",name:"Shapes & Symbols",icons:Cn},{id:"actions",name:"Actions & Tools",icons:Mn},{id:"communication",name:"Communication",icons:Tn}],so={recent:e.jsx(C.IconClock,{size:20,strokeWidth:2.5}),user:e.jsx(C.IconUser,{size:20,strokeWidth:2.5}),business:e.jsx(C.IconBriefcase,{size:20,strokeWidth:2.5}),tech:e.jsx(C.IconDeviceDesktop,{size:20,strokeWidth:2.5}),expressions:e.jsx(C.IconMoodSmile,{size:20,strokeWidth:2.5}),nature:e.jsx(C.IconTrees,{size:20,strokeWidth:2.5}),shapes:e.jsx(C.IconCircle,{size:20,strokeWidth:2.5}),actions:e.jsx(C.IconTool,{size:20,strokeWidth:2.5}),communication:e.jsx(C.IconMessage,{size:20,strokeWidth:2.5})},ao=({selectedCategory:n,onCategoryChange:s})=>e.jsx(t.Flex,{gap:"0px",justify:"center",wrap:"wrap",children:Ie.map(o=>{const r=so[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)})}),Bn=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(S){console.warn("Error parsing recent icons from localStorage:",S)}}},[]);const h=u.useMemo(()=>Ie.filter(j=>j.id!=="recent"&&!("isDynamic"in j)).flatMap(j=>j.icons),[]),m=u.useMemo(()=>{if(a==="recent"){const S=new Set(h);return d.filter(w=>S.has(w))}const j=Ie.find(S=>S.id===a);return(j==null?void 0:j.icons)||[]},[a,d,h]),x=u.useCallback((j,S)=>{if(!j.trim())return S;const w=j.toLowerCase().trim(),T=w.split(/\s+/);return S.filter(M=>{const v=M.replace(/^Icon/,"").split(/(?=[A-Z])/).map(z=>z.toLowerCase().trim()).filter(z=>z.length>0);return!!(v.some(z=>T.some(R=>z===R))||w.length>2&&v.some(z=>T.some(R=>z.startsWith(R)))||w.length<=2&&v.some(z=>T.some(R=>z.includes(R)))||T.length>1&&T.every(z=>v.some(R=>R===z||R.startsWith(z))))})},[]),y=u.useMemo(()=>o.trim()?x(o,h):m,[o,m,h,x]),p=u.useCallback(j=>{h.includes(j)&&f(w=>{const T=[j,...w.filter(M=>M!==j)].slice(0,20);return typeof window<"u"&&localStorage.setItem("avatar-icon-recent",JSON.stringify(T)),T}),n(j)},[n,h]),I=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(C.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:y.map(j=>e.jsx(dn,{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(ao,{selectedCategory:a,onCategoryChange:I})})]})});Bn.displayName="IconGrid";const io=({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(C.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(C.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"})]})}),co=({onEmojiSelect:n})=>e.jsx(ro,{onEmojiSelect:n,height:358}),lo=({onIconSelect:n})=>e.jsx(Bn,{onIconSelect:n,height:358}),uo=({previewImage:n,selectedEmoji:s,size:o,loading:r,onFileInputClick:a,onImageChange:i,onImageAccept:c,onClearImagePreview:l,fileInputRef:d})=>e.jsx(io,{previewImage:n,fileInputRef:d,selectedEmoji:s,size:o,loading:r,onFileInputClick:a,onImageChange:i,onImageAccept:c,onClearImagePreview:l}),fo=()=>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:y=1e3})=>{const p=u.useRef(null),I=u.useRef(null),g=u.useRef(null),{selectedTab:b,tabHovered:j,previewImage:S,selectedEmoji:w,selectedIcon:T,selectedFile:M,handleTabChange:k,handleTabHover:v,handleImagePreview:z,handleImageAccept:R,handleEmojiSelect:B,handleIconSelect:E,clearImagePreview:W,resetState:H}=eo({onAvatarSelect:i});no({opened:s,onClose:r,popoverRef:I}),u.useEffect(()=>{s||H()},[s,H]);const $=X=>{console.log("Emoji clicked:",X),B(X),r()},L=X=>{console.log("Icon clicked:",X),E(X),r()},_=X=>{X&&z(X)},N=()=>{M?(R(),r()):(w||T)&&r()},Z=()=>{p.current&&p.current.click()},F=()=>{W()},G=()=>{console.log("Avatar removed"),c==null||c(),r()},O=()=>!!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(co,{onEmojiSelect:$}),U=e.jsx(lo,{onIconSelect:L}),V=e.jsx(uo,{previewImage:S,selectedEmoji:w,size:l,loading:d,onFileInputClick:Z,onImageChange:_,onImageAccept:N,onClearImagePreview:F,fileInputRef:p}),ne=e.jsx(t.Box,{children:e.jsx(to,{selectedTab:b,tabHovered:j,onTabChange:k,onTabHover:v,onRemove:G,hasAvatar:O(),children:b==="emoji"?A:b==="icons"?U:V})}),P=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:I,p:0,style:{width:"auto",overflow:"hidden",zIndex:y},children:e.jsx(u.Suspense,{fallback:e.jsx(fo,{}),children:ne})})]})}),oe=e.jsx(se,{avatar:a,size:l,placeholder:f,showPlaceholder:h});return e.jsx(e.Fragment,{children:n?P:oe})},ho=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())},xo=n=>{const s=[];return n.forEach(o=>{ho(o)||s.push({email:o,error:"Please enter a valid email address"})}),{isValid:s.length===0,errors:s}},po=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},mo=n=>{const s=xo(n),o=po(n),r=[...s.errors,...o];return{isValid:r.length===0,errors:r}},go=({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(I=>{if(a[I])return a[I];const g=r.find(b=>b.email===I);return g&&g.name?g.name:I});u.useEffect(()=>{o&&o(i)},[i,o]),u.useEffect(()=>{if(n.length>0){const I=mo(n);d(I.errors)}else d([])},[n]),u.useEffect(()=>{const I=f.current;if(!I)return;let g;const b=j=>{const w=j.target.value||"";clearTimeout(g),g=setTimeout(()=>{c(w)},150)};return I.addEventListener("input",b),()=>{I.removeEventListener("input",b),clearTimeout(g)}},[]);const m=u.useCallback(I=>{const g=r.map(j=>({name:j.name||j.email,email:j.email})),b=I.map(j=>{const S=g.find(w=>w.name.toLowerCase()===j.toLowerCase());return S?S.email:j}).filter(j=>j.includes("@")?!0:!g.some(w=>{const T=w.name.toLowerCase(),M=j.toLowerCase();return T.startsWith(M)&&M!==T}));s(b),c("")},[s,r]),x=u.useCallback(()=>{f.current&&(f.current.value="",c(""))},[]),y=l.length===0&&n.length>0,p=u.useCallback((I,g,b)=>{I&&n.length>0&&g&&(I(n,g,b),c(""))},[n]);return{inputText:i,tagsInputRef:f,displayValue:h,validationErrors:l,isValid:y,handleEmailChange:m,clearInput:x,handleInvite:p}},On=({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,y]=u.useState({}),p=i.length>0?i[0].value:void 0,[I,g]=u.useState(p);u.useEffect(()=>{i.length>0&&!I&&g(i[0].value)},[i.length,I]),u.useEffect(()=>{const B=a.filter(E=>c.includes(E.email)).map(E=>E.id);f(E=>E.filter(W=>B.includes(W)))},[c,a.length]);const[b,j]=u.useState("invite"),[S,w]=u.useState(null),T=(B,E,W)=>{n&&n(B,E,W),l([]),m("")},M=(B,E)=>{s&&s(B,E)},k=B=>{o&&o(B)},v=B=>{f(E=>E.includes(B)?E.filter(W=>W!==B):[...E,B])},z=B=>{c.includes(B.email)||(l([...c,B.email]),y(E=>({...E,[B.email]:B.name||B.email})),d.includes(B.id)||f([...d,B.id]),m(""))},R=h.trim()?a.filter(B=>{var W;const E=h.toLowerCase();return B.email.toLowerCase().includes(E)||((W=B.name)==null?void 0:W.toLowerCase().includes(E))}):[];return{emails:c,setEmails:l,selectedUsers:d,setSelectedUsers:f,inputText:h,setInputText:m,tagDisplayMap:x,setTagDisplayMap:y,selectedRole:I,setSelectedRole:g,selectedTab:b,setSelectedTab:j,tabHovered:S,setTabHovered:w,filteredUsers:R,handleInvite:T,handleUpdateRole:M,handleRemoveUser:k,handleToggleUser:v,handleAddSuggestedUser:z}},zn=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:y,displayValue:p,validationErrors:I,isValid:g,handleEmailChange:b,clearInput:j,handleInvite:S}=go({value:n,onChange:s,onInputChange:l,suggestedUsers:d,tagDisplayMap:f}),w=()=>{S(r,i,m),x("")};u.useImperativeHandle(h,()=>({clearInput:j}),[j]);const T=p.length>0,M=c&&a.length>0,k=I.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:y,value:p,onChange:b,placeholder:T?"":o,radius:"md",rightSection:M?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:M?"120px":"0px",position:"absolute",height:"32px",right:"8px"}},styles:{input:{paddingRight:M?"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:I.map((v,z)=>e.jsxs(t.Text,{size:"xs",c:"red",children:[v.email,": ",v.error]},z))})]}),T&&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:w,fullWidth:!0,radius:"md",disabled:!g,children:"Send invitations"})]})]})}),Io=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"}},yo=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"}},vo=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,[y,p]=u.useState(!1),I=()=>{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:I,bg:y?"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:vo(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:Io(n.status),radius:"sm",children:yo(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)})]})]})},Rn=({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:y,setInputText:p,tagDisplayMap:I,selectedRole:g,setSelectedRole:b,selectedTab:j,setSelectedTab:S,tabHovered:w,setTabHovered:T,filteredUsers:M,handleInvite:k,handleUpdateRole:v,handleRemoveUser:z,handleToggleUser:R,handleAddSuggestedUser:B}=On({onInvite:o,onUpdateRole:r,onRemoveUser:a,invitedUsers:i,suggestedUsers:d,roleOptions:l}),E=L=>{B(L),f.current&&f.current.clearInput()},W=e.jsxs(e.Fragment,{children:[e.jsx(zn,{ref:f,value:h,onChange:m,onInvite:k,roleOptions:l,selectedRole:g,onRoleChange:b,onInputChange:p,suggestedUsers:d,tagDisplayMap:I}),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:R,onUpdateRole:v,onRemoveUser:z,roleOptions:l,variant:"invited"},L.id))})]})})}),M.length>0&&e.jsx(t.ScrollArea,{pt:"sm",mah:200,type:"auto",style:{overflow:"visible"},children:e.jsx(t.Box,{children:M.length>0?e.jsxs(e.Fragment,{children:[e.jsxs(t.Text,{size:"sm",fw:500,children:["Suggested ",y.trim()&&`(filtered by "${y}")`]}),e.jsx(t.Space,{h:"sm"}),e.jsx(t.Stack,{gap:"sm",children:M.map(L=>e.jsx(je,{user:L,isSelected:x.includes(L.id),onToggle:R,onUpdateRole:v,onRemoveUser:z,roleOptions:l,variant:"suggested",onClick:()=>E(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"})]})}),$=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:()=>{S("invite")},onMouseEnter:()=>T("invite"),onMouseLeave:()=>T(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: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:()=>{S("publish")},onMouseEnter:()=>T("publish"),onMouseLeave:()=>T(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: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:H})})]})})});return e.jsx(ve,{trigger:c,menuItems:[],opened:n,onClose:s,styles:{dropdown:{padding:"0",borderRadius:"var(--mantine-radius-md)"}},children:$})},jo=({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(Rn,{opened:d,onClose:h,onInvite:n,onUpdateRole:s,onRemoveUser:o,invitedUsers:r,currentUser:a,roleOptions:i,suggestedUsers:c,children:m})},bo=({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:y,tagDisplayMap:p,selectedRole:I,setSelectedRole:g,filteredUsers:b,handleInvite:j,handleUpdateRole:S,handleRemoveUser:w,handleToggleUser:T,handleAddSuggestedUser:M}=On({onInvite:o,onUpdateRole:r,onRemoveUser:a,invitedUsers:i,suggestedUsers:l,roleOptions:c}),k=v=>{M(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:C.IconX,size:"md",onClick:s,color:"var(--mantine-color-gray-8)"})]}),e.jsx(zn,{ref:d,value:f,onChange:h,onInvite:j,roleOptions:c,selectedRole:I,onRoleChange:g,onInputChange:y,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:T,onUpdateRole:S,onRemoveUser:w,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:T,onUpdateRole:S,onRemoveUser:w,roleOptions:c,variant:"suggested",onClick:()=>k(v)},v.id))})})]})]})})},wo=({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(y=>y.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(y=>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:y}),o.filter(p=>p.group===y).map(p=>e.jsx(Je,{label:p.label,icon:p.icon,onClick:()=>d(p.id),isActive:l===p.id},p.id))]},y)}))})})}),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"})]})})]})]})]})},So=(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}`},ko=(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}`},Co=n=>{const s=typeof n=="string"?new Date(n):n,o=new Date;return s.toDateString()===o.toDateString()},Mo=n=>{const s=typeof n=="string"?new Date(n):n,o=new Date;return o.setDate(o.getDate()-1),s.toDateString()===o.toDateString()},To=(n,s="es")=>Co(n)?s==="es"?"Hoy":"Today":Mo(n)?s==="es"?"Ayer":"Yesterday":So(n,s),Bo=({notification:n,message:s,markAsRead:o,archiveNotification:r,children:a,actions:i})=>{var h,m,x,y,p;const c=new Date().getTime()-new Date(n.timestamp).getTime()<6048e5?To(n.timestamp,"en"):ko(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:C.IconCheck}),!n.isArchived&&e.jsx(ee,{onClick:()=>r(n.id),icon:C.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(pn,{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?((y=n.category)==null?void 0:y.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})]})},Oo=(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}},zo=({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:y=!1,onOpen:p=()=>{},onClose:I=()=>{},enableInfiniteScroll:g=!0})=>{const b=[{children:"Mark all as read",leftSection:e.jsx(C.IconChecklist,{size:16}),onClick:()=>i()},{children:"Archive all",leftSection:e.jsx(C.IconArchive,{size:16}),onClick:()=>c()}],j=[{children:"All",leftSection:e.jsx(C.IconChecklist,{size:16}),onClick:()=>h==null?void 0:h("all"),active:m==="all"},{children:"Unread",leftSection:e.jsx(C.IconChecklist,{size:16}),onClick:()=>h==null?void 0:h("unread"),active:m==="unread"},{children:"Archived",leftSection:e.jsx(C.IconArchive,{size:16}),onClick:()=>h==null?void 0:h("archived"),active:m==="archived"}],S=M=>x&&M.category&&["welcome","upgrade"].includes(M.category)?x(M,l,d):e.jsx(Bo,{notification:M,markAsRead:l,archiveNotification:d,message:M.message,actions:M.actions},M.id),{isActive:w,loadMoreRef:T}=Oo(y,g,f||(()=>{}),r,o);return e.jsxs(e.Fragment,{children:[e.jsx(Je,{isActive:w,icon:e.jsx(C.IconBell,{strokeWidth:2,size:20,color:"var(--mantine-color-gray-7)"}),onClick:()=>{y?I():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:y,onClose:I,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:C.IconFilter})}),e.jsx(ve,{position:"bottom-end",menuItems:b,trigger:e.jsx(ee,{onClick:()=>{},icon:C.IconDots,changeIconOnHover:!0,iconHovered:C.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(M=>S(M))}):e.jsxs(t.Stack,{gap:0,w:"100%",h:"100%",justify:"center",align:"center",py:"xl",children:[e.jsx(C.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:T,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})]})},Dn=u.createContext(void 0),Ro=({children:n})=>{const[s,{open:o,close:r}]=ye.useDisclosure(!1),a={openedNotificationSidebar:s,openNotificationSidebar:o,closeNotificationSidebar:r};return e.jsx(Dn.Provider,{value:a,children:n})},Do=()=>{const n=u.useContext(Dn);if(n===void 0)throw new Error("useNavbar must be used within an NavbarProvider");return n},En=({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(C.IconCheck,{size:16,color:"var(--mantine-color-blue-6)"}),i&&e.jsx(t.Badge,{size:"xs",variant:"light",color:"yellow",radius:"sm",children:"Owner"})]})]})},Eo="workspace-selector-module__menuItem___FSB6P",Ao="workspace-selector-module__workspaceButton___-P6kp",Lo="workspace-selector-module__workspaceText___YDAlj",Fo="workspace-selector-module__scrollWrapper___MzrJY",Ve={menuItem:Eo,workspaceButton:Ao,workspaceText:Lo,scrollWrapper:Fo},No=({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:y,menuItems:p})=>{const[I,g]=u.useState(!1),[b,j]=u.useState(""),S=u.useMemo(()=>b?n.filter(k=>{var v;return k.name.toLowerCase().includes(b.toLowerCase())||((v=k.ownerEmail)==null?void 0:v.toLowerCase().includes(b.toLowerCase()))}):n,[n,b]),w=k=>{i==null||i(k.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[T,M]=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:I,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(!I),style:{padding:"6px",display:"flex",alignItems:"center",borderRadius:"var(--mantine-radius-md)",cursor:"pointer"},className:`${Ve.workspaceButton} ${h||""}`,bg:T||I?"var(--mantine-color-gray-1)":"transparent",onMouseEnter:()=>M(!0),onMouseLeave:()=>M(!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:500,c:"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:C.IconChevronDown,size:"md",onClick:()=>g(!I),grayScaleBaseColor:T?1:0}),(T||x)&&e.jsx(fe,{icon:C.IconChevronsLeft,size:"md",onClick:()=>{m==null||m()},grayScaleBaseColor:T?1:0})]})]}):e.jsx(t.Text,{size:"sm",c:"dimmed",children:"Select workspace"})})})}),e.jsx(t.Menu.Dropdown,{style:{borderRadius:"var(--mantine-radius-md)"},p:0,children:e.jsxs(t.Stack,{gap:0,children:[y,e.jsx(t.Menu.Divider,{style:{margin:"1px 0px"}}),e.jsx(t.Stack,{gap:0,px:4,children:S.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:S.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:v=>{v.currentTarget.style.backgroundColor="var(--mantine-color-gray-1)"},onMouseLeave:v=>{v.currentTarget.style.backgroundColor="transparent"},children:e.jsx(En,{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))})]})})]})},An=({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});An.displayName="MatrixCenter";const Ln=({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 I=["empty","outline","filled"],b=(I.indexOf(m)+1)%I.length,j=I[b];a?a(j):d(j)},y=()=>{switch(m){case"empty":return null;case"outline":return e.jsx(C.IconPoint,{size:16,color:"var(--mantine-color-gray-8)",stroke:2.5});case"filled":return e.jsx(C.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||y()})};Ln.displayName="MatrixCell";const Fn=({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),y=u.useRef(!1),p=()=>{!r||!d||(m(!0),y.current=!1,x.current=setTimeout(()=>{y.current=!0,d(r)},500))},I=()=>{r&&(m(!1),x.current&&(clearTimeout(x.current),x.current=null),!y.current&&l&&l(r),y.current=!1)},g=()=>{m(!1),x.current&&(clearTimeout(x.current),x.current=null),y.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:I,onMouseLeave:g,...f,children:n})};Fn.displayName="MatrixBlockLeft";const Nn=({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),y=u.useRef(!1),p=()=>{!r||!d||(m(!0),y.current=!1,x.current=setTimeout(()=>{y.current=!0,d(r)},500))},I=()=>{r&&(m(!1),x.current&&(clearTimeout(x.current),x.current=null),!y.current&&l&&l(r),y.current=!1)},g=()=>{m(!1),x.current&&(clearTimeout(x.current),x.current=null),y.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:I,onMouseLeave:g,...f,children:n})};Nn.displayName="MatrixBlockRight";const Un=({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),y=u.useRef(!1),p=()=>{!r||!d||(m(!0),y.current=!1,x.current=setTimeout(()=>{y.current=!0,d(r)},500))},I=()=>{r&&(m(!1),x.current&&(clearTimeout(x.current),x.current=null),!y.current&&l&&l(r),y.current=!1)},g=()=>{m(!1),x.current&&(clearTimeout(x.current),x.current=null),y.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:I,onMouseLeave:g,...f,children:n})};Un.displayName="MatrixBlockUp";const Wn=({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),y=u.useRef(!1),p=()=>{!r||!d||(m(!0),y.current=!1,x.current=setTimeout(()=>{y.current=!0,d(r)},500))},I=()=>{r&&(m(!1),x.current&&(clearTimeout(x.current),x.current=null),!y.current&&l&&l(r),y.current=!1)},g=()=>{m(!1),x.current&&(clearTimeout(x.current),x.current=null),y.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:I,onMouseLeave:g,...f,children:n})};Wn.displayName="MatrixBlockDown";const $n=({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,y]=u.useState(!1),[p,I]=u.useState(!1),g=w=>{f(w),n==null||n(w)},b=w=>{m(w),s==null||s(w)},j=w=>{y(w),o==null||o(w)},S=w=>{I(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)}),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:()=>S(!0),onMouseLeave:()=>S(!1)})]})};$n.displayName="HoverZones";const Pn=({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:y,onUpPrevious:p,onUpNext:I,upCurrentPage:g=1,upTotalPages:b=1,upDisabled:j=!1,upVisible:S=!1,onUpHover:w,onDownPrevious:T,onDownNext:M,downCurrentPage:k=1,downTotalPages:v=1,downDisabled:z=!1,downVisible:R=!1,onDownHover:B,onLeftAdd:E,onRightAdd:W,onUpAdd:H,onDownAdd:$,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(C.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(C.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(C.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(C.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(C.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(C.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(C.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(C.IconPlus,{size:16,stroke:2})}),e.jsx(t.ActionIcon,{size:L,variant:"subtle",onClick:I,disabled:g>=b,color:"gray",radius:"md","aria-label":"Next up blocks",children:e.jsx(C.IconChevronUp,{size:16,stroke:2})})]}),G=()=>v<=1||z?null:e.jsxs(t.Group,{gap:"xs",align:"center",wrap:"nowrap",children:[e.jsx(t.ActionIcon,{size:L,variant:"subtle",onClick:T,disabled:k<=1,color:"gray",radius:"md","aria-label":"Previous down blocks",children:e.jsx(C.IconChevronDown,{size:16,stroke:2})}),e.jsx(t.ActionIcon,{size:L,variant:"subtle",onClick:$,color:"blue",radius:"md","aria-label":"Add down blocks",children:e.jsx(C.IconPlus,{size:16,stroke:2})}),e.jsx(t.ActionIcon,{size:L,variant:"subtle",onClick:M,disabled:k>=v,color:"gray",radius:"md","aria-label":"Next down blocks",children:e.jsx(C.IconChevronUp,{size:16,stroke:2})})]}),O=r>1&&!a,D=h>1&&!m,A=b>1&&!j,U=v>1&&!z;return!O&&!D&&!A&&!U?null:_?e.jsxs(e.Fragment,{children:[O&&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:()=>y==null?void 0:y(!0),onMouseLeave:()=>y==null?void 0:y(!1),children:Z()}),A&&S&&p&&I&&e.jsx("div",{onMouseEnter:()=>w==null?void 0:w(!0),onMouseLeave:()=>w==null?void 0:w(!1),children:F()}),U&&R&&T&&M&&e.jsx("div",{onMouseEnter:()=>B==null?void 0:B(!0),onMouseLeave:()=>B==null?void 0:B(!1),children:G()})]}):e.jsxs(e.Fragment,{children:[O&&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:()=>y==null?void 0:y(!0),onMouseLeave:()=>y==null?void 0:y(!1),children:Z()}),A&&S&&p&&I&&e.jsx(t.Box,{style:{position:"absolute",top:"20px",left:"50%",transform:"translateX(-50%)",zIndex:10,pointerEvents:"auto",opacity:S?1:0,transition:"opacity 0.2s ease"},onMouseEnter:()=>w==null?void 0:w(!0),onMouseLeave:()=>w==null?void 0:w(!1),children:F()}),e.jsx(t.Box,{style:{position:"absolute",bottom:"20px",left:"50%",transform:"translateX(-50%)",zIndex:10,pointerEvents:"auto",opacity:R?1:0,transition:"opacity 0.2s ease"},onMouseEnter:()=>B==null?void 0:B(!0),onMouseLeave:()=>B==null?void 0:B(!1),children:U&&R&&T&&M&&G()})]})};Pn.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(Pn,{...h[n],size:"sm",showLabels:!0,inline:!0})})]})},Uo=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)),I=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:I,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:I,upTotalPages:g,downTotalPages:b}=f,j=Math.min(h.leftStartIndex,Math.max(0,s-i)),S=Math.min(j+i,s),w=Math.min(h.rightStartIndex,Math.max(0,o-c)),T=Math.min(w+c,o),M=Math.min(h.upStartIndex,Math.max(0,r-l)),k=Math.min(M+l,r),v=Math.min(h.downStartIndex,Math.max(0,a-d)),z=Math.min(v+d,a);return{leftTotalPages:p,rightTotalPages:I,upTotalPages:g,downTotalPages:b,leftStartIndex:j,leftEndIndex:S,rightStartIndex:w,rightEndIndex:T,upStartIndex:M,upEndIndex:k,downStartIndex:v,downEndIndex:z}},[h,f,i,c,l,d,s,o,r,a]),y={goToLeftPage:u.useCallback(p=>{const I=Math.max(0,(p-1)*i);m(g=>({...g,leftStartIndex:Math.min(I,Math.max(0,s-i))}))},[i,s]),goToRightPage:u.useCallback(p=>{const I=Math.max(0,(p-1)*c);m(g=>({...g,rightStartIndex:Math.min(I,Math.max(0,o-c))}))},[c,o]),goToUpPage:u.useCallback(p=>{const I=Math.max(0,(p-1)*l);m(g=>({...g,upStartIndex:Math.min(I,Math.max(0,r-l))}))},[l,r]),goToDownPage:u.useCallback(p=>{const I=Math.max(0,(p-1)*d);m(g=>({...g,downStartIndex:Math.min(I,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,y,x]},Wo=(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:y=8,minBlocksRight:p=1,maxBlocksRight:I=8,minBlocksUp:g=1,maxBlocksUp:b=8,minBlocksDown:j=1,maxBlocksDown:S=8,responsiveCellSize:w=!1,minCellSize:T="30px",maxCellSize:M="80px"}=n,k=parseFloat(d.replace("px","")),v=parseFloat(f.replace("px","")),z=i.width-k*4,R=i.height-k*4,B=v+k,E=Math.floor(z/(2*B)),W=v+k,H=Math.floor(R/W)+2,$=Math.min(E,H),L=Math.max(h,Math.min(m,$)),_=Math.max(x,Math.min(y,Math.floor($/2))),N=Math.max(p,Math.min(I,Math.floor($/2)));let Z=f;if(w){const A=parseFloat(T.replace("px","")),U=parseFloat(M.replace("px","")),V=Math.min(z/(i.width*.8),R/(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,O;if(r>0&&a>0){const A=Math.max(r,a);G=Math.max(g,Math.min(b,A)),O=G}else{const A=Math.max(g,j),U=Math.min(b,S),V=Math.max(A,Math.min(U,Math.ceil(A+(U-A)*F)));G=V,O=V}if(G+O+1>H){const A=Math.max(2,H-1);if(Math.max(g,j)*2>A){const V=Math.max(1,Math.floor(A/2));G=V,O=V}else{const V=Math.max(g,j);G=V,O=V}}return console.log("Responsive Matrix Debug:",{windowSize:i,screenSizeRatio:F,minBlocksUp:g,minBlocksDown:j,maxBlocksUp:b,maxBlocksDown:S,blocksUp:r,blocksDown:a,calculatedBlocksUp:G,calculatedBlocksDown:O,totalVerticalBlocks:G+O+1,isSymmetric:G===O,availableHeight:R,maxBlocksVertical:H}),{blocksPerSide:L,blocksLeft:_,blocksRight:N,cellSize:Z,blocksUp:G,blocksDown:O}},[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:y,maxBlocksLeft:p,minBlocksRight:I,maxBlocksRight:g,minBlocksUp:b,maxBlocksUp:j,minBlocksDown:S,maxBlocksDown:w,responsiveCellSize:T,minCellSize:M,maxCellSize:k})=>{const v=u.useMemo(()=>c!==void 0||l!==void 0||d!==void 0||f!==void 0,[c,l,d,f]),z=Wo({gap:n,cellSize:s,minBlocksPerSide:m,maxBlocksPerSide:x,minBlocksLeft:y,maxBlocksLeft:p,minBlocksRight:I,maxBlocksRight:g,minBlocksUp:b,maxBlocksUp:j,minBlocksDown:S,maxBlocksDown:w,responsiveCellSize:T,minCellSize:M,maxCellSize:k},o??0,r??0,a,i),R=u.useMemo(()=>{let H=h?z.blocksLeft:o??0,$=h?z.blocksRight:r??0,L=h?z.blocksUp:a??0,_=h?z.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,O=Z+N,D=Math.floor(F/(2*O)),A=Math.floor(G/(2*O));H=Math.min(H,D),$=Math.min($,D),L=Math.min(L,A),_=Math.min(_,A)}return{left:H,right:$,up:L,down:_}},[h,z,o,r,a,i,n,s]),B=u.useMemo(()=>{const H=v&&c?Math.min(R.left,c):R.left,$=v&&l?Math.min(R.right,l):R.right,L=v&&d?Math.min(R.up,d):R.up,_=v&&f?Math.min(R.down,f):R.down;return{left:H,right:$,up:L,down:_}},[v,R,c,l,d,f]),E=h?z.cellSize:s,W=u.useMemo(()=>{const H=(B.left>0?B.left:0)+1+(B.right>0?B.right:0),$=B.up>0||B.down>0?B.up+1+B.down:1,L=`${E} `.repeat(B.left)+"1fr "+`${E} `.repeat(B.right),_=B.up>0||B.down>0?`${E} `.repeat(B.up)+"1fr "+`${E} `.repeat(B.down):"1fr";return{totalColumns:H,totalRows:$,gridTemplateColumns:L.trim(),gridTemplateRows:_.trim()}},[B,E]);return{usePagination:v,visibleBlocks:R,finalBlocks:B,finalCellSize:E,gridDimensions:W}},Po=({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(", ")}}},Ho=({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"}}},Go=({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,y)=>{f(p=>({...p,[x]:y}))};return{hoverStates:d,handleHover:h,getNavigationControlProps:x=>{const y={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],I={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&&!!y,totalBlocks:y,actions:p,currentPage:I+1,totalPages:g,disabled:!y,hoverState:d[x],onHover:b=>h(x,b)}}}},_o=({blockItems:n,blockConnections:s})=>{const[o,r]=u.useState(null),[a,i]=u.useState(!1),c=u.useMemo(()=>{const I=new Map;return s.forEach(g=>{const b=`${g.source}-${g.target}`,j=`${g.target}-${g.source}`;I.set(b,g),I.set(j,g)}),I},[s]),l=u.useCallback(I=>{const g=[];return n.forEach(b=>{if(b.id!==I){const j=`${I}-${b.id}`;c.has(j)&&g.push(b.id)}}),g},[n,c]),d=u.useCallback(I=>{const g=n.find(S=>S.id===I);if(!g)return[];const b=l(I),j=[I];switch(g.type){case"up":b.forEach(S=>{const w=n.find(T=>T.id===S);w&&(w.type==="left"||w.type==="right")&&(j.push(S),l(S).forEach(M=>{const k=n.find(v=>v.id===M);k&&k.type==="down"&&j.push(M)}))});break;case"down":b.forEach(S=>{const w=n.find(T=>T.id===S);w&&(w.type==="left"||w.type==="right")&&(j.push(S),l(S).forEach(M=>{const k=n.find(v=>v.id===M);k&&k.type==="up"&&j.push(M)}))});break;case"left":b.forEach(S=>{const w=n.find(T=>T.id===S);w&&(w.type==="up"||w.type==="down")&&(j.push(S),l(S).forEach(M=>{const k=n.find(v=>v.id===M);k&&k.type==="right"&&j.push(M)}))});break;case"right":b.forEach(S=>{const w=n.find(T=>T.id===S);w&&(w.type==="up"||w.type==="down")&&(j.push(S),l(S).forEach(M=>{const k=n.find(v=>v.id===M);k&&k.type==="left"&&j.push(M)}))});break}return[...new Set(j)]},[n,l]),f=u.useCallback(I=>!0,[]),h=u.useCallback(I=>!a||!o?!1:!d(o).includes(I),[a,o,d]),m=u.useCallback(I=>!a||!o?!1:d(o).includes(I),[a,o,d]),x=u.useCallback(I=>{a&&o===I?(i(!1),r(null)):(r(I),i(!0))},[a,o]),y=u.useCallback(I=>{console.log(`Block clicked: ${I}`)},[]),p=u.useCallback(()=>{i(!1),r(null)},[]);return{selectedBlockId:o,isFiltering:a,isBlockVisible:f,isBlockDimmed:h,shouldShowBlueBorder:m,handleBlockPress:x,handleBlockClick:y,clearFiltering:p,getFilteredBlockIds:d}},an=n=>parseInt(n.replace(/[^\d]/g,""),10)||0,Vo=(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=an(s.cellSize),d=an(s.gap),f=l+d,h=i-d*2,m=c-d*2,x=Math.floor(m*s.verticalMaxPercent/100/f),y=Math.floor(h*s.horizontalMaxPercent/100/f),p=Math.floor(m*s.verticalMinPercent/100/f),I=Math.floor(h*s.horizontalMinPercent/100/f),g=Math.max(s.minVerticalBlocks,p),b=Math.max(s.minHorizontalBlocks,I),j=Math.max(g,x),S=Math.max(b,y),w=Math.floor(j/2),T=Math.floor(j/2),M=Math.floor(S/2),k=Math.floor(S/2);return{blocksUp:w,blocksDown:T,blocksLeft:M,blocksRight:k,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()},Qo={verticalMinPercent:20,verticalMaxPercent:50,horizontalMinPercent:30,horizontalMaxPercent:50,minVerticalBlocks:2,minHorizontalBlocks:4,cellSize:"50px",gap:"8px"},Hn=({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:y=[],enableFiltering:p=!1,onBlockClick:I,totalBlocksLeft:g,totalBlocksRight:b,totalBlocksUp:j,totalBlocksDown:S,usePagination:w=!1,responsive:T=!1,minBlocksPerSide:M=2,maxBlocksPerSide:k=15,minBlocksHorizontal:v=2,maxBlocksHorizontal:z=16,minBlocksVertical:R=2,maxBlocksVertical:B=16,minBlocksLeft:E=1,maxBlocksLeft:W=8,minBlocksRight:H=1,maxBlocksRight:$=8,minBlocksUp:L=1,maxBlocksUp:_=8,minBlocksDown:N=1,maxBlocksDown:Z=8,responsiveCellSize:F=!1,minCellSize:G="30px",maxCellSize:O="80px",directionTexts:D,...A})=>{const U=u.useRef(null),V=Vo(U,{...Qo,cellSize:r,gap:o,...c});let ne=d,P=f,oe=h,X=m;l?(ne=Math.floor(V.blocksLeft),P=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&&(ne=Math.floor(i/2),P=Math.floor(i/2)));const de=E!==1?E:Math.floor(v/2),Le=W!==8?W:Math.floor(z/2),Fe=H!==1?H:Math.ceil(v/2),re=$!==8?$:Math.ceil(z/2),me=L!==1?L:Math.floor(R/2),we=_!==8?_:Math.floor(B/2),Xn=N!==1?N:Math.ceil(R/2),Kn=Z!==8?Z:Math.ceil(B/2),{usePagination:Jn,finalBlocks:Q,finalCellSize:ae,gridDimensions:Se}=$o({gap:o,cellSize:r,blocksLeft:ne,blocksRight:P,blocksUp:oe,blocksDown:X,totalBlocksLeft:g,totalBlocksRight:b,totalBlocksUp:j,totalBlocksDown:S,responsive:T,minBlocksPerSide:M,maxBlocksPerSide:k,minBlocksLeft:de,maxBlocksLeft:Le,minBlocksRight:Fe,maxBlocksRight:re,minBlocksUp:me,maxBlocksUp:we,minBlocksDown:Xn,maxBlocksDown:Kn,responsiveCellSize:F,minCellSize:G,maxCellSize:O}),{getBlockContent:ke,getIntersectionText:et}=Po({blockItems:x}),{getConnectionStateFromText:nt}=Ho({blockConnections:y}),Y=_o({blockItems:x,blockConnections:y});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,tt,ot]=Uo({totalBlocksLeft:g??0,totalBlocksRight:b??0,totalBlocksUp:j??0,totalBlocksDown:S??0,visibleBlocksLeft:Q.left,visibleBlocksRight:Q.right,visibleBlocksUp:Q.up,visibleBlocksDown:Q.down}),{getNavigationControlProps:ue}=Go({usePagination:Jn,totalBlocksLeft:g,totalBlocksRight:b,totalBlocksUp:j,totalBlocksDown:S,paginationActions:tt,paginationState:ie,paginationInfo:ot});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},(mr,te)=>{const Ue=Q.up>0?K===Q.up:K===0,We=te===Q.left;if(Ue&&We)return e.jsxs(An,{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")}),w&&e.jsx($n,{showLeftControls:!!g,showRightControls:!!b,showUpControls:!!j,showDownControls:!!S,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}-${te}`);if(Ue&&te<Q.left){const q=w&&g?ie.leftStartIndex+te:te,J=`left-${q}`;return e.jsx(Fn,{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:I,onBlockPress:p?Y.handleBlockPress:void 0,children:ke("left",q)},`left-${te}`)}if(Ue&&te>Q.left){const q=te-Q.left-1,J=w&&b?ie.rightStartIndex+(Q.right-1-q):Q.right-1-q,ce=`right-${J}`;return e.jsx(Nn,{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:I,onBlockPress:p?Y.handleBlockPress:void 0,children:ke("right",J)},`right-${q}`)}if(We&&K<Q.up){const q=w&&j?ie.upStartIndex+K:K,J=`up-${q}`;return e.jsx(Un,{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:I,onBlockPress:p?Y.handleBlockPress:void 0,children:ke("up",q)},`up-${K}`)}if(We&&K>Q.up){const q=K-Q.up-1,J=w&&S?ie.downStartIndex+q:q,ce=`down-${J}`;return e.jsx(Wn,{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:I,onBlockPress:p?Y.handleBlockPress:void 0,children:ke("down",J)},`down-${q}`)}const $e=te<Q.left?te:null,Ce=te>Q.left?te-Q.left-1:null,Pe=K<Q.up?K:null,He=K>Q.up?K-Q.up-1:null,rt=w&&g&&$e!==null?ie.leftStartIndex+$e:$e,st=w&&b&&Ce!==null?ie.rightStartIndex+(Q.right-1-Ce):Ce!==null?Q.right-1-Ce:null,at=w&&j&&Pe!==null?ie.upStartIndex+Pe:Pe,it=w&&S&&He!==null?ie.downStartIndex+He:He,Ge=et(rt,st,at,it);if(Ge&&Ge.length>0){const q=nt(Ge);return e.jsx(Ln,{size:ae,state:q,interactive:!1},`intersection-${K}-${te}`)}return e.jsx("div",{style:{width:ae,height:ae,minWidth:ae,minHeight:ae}},`empty-${K}-${te}`)})).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"})]})};Hn.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})]})},Yo=({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||"—"})}),qo=({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})})},Zo=({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||"—"})})},Xo=300,Ko=({users:n,onSearch:s,debounceSearch:o=!0,debounceDelay:r=Xo})=>{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}},Jo=({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(y=>c.includes(y.id)),m=d.filter(y=>!c.includes(y.id)),x=l.filter(y=>!d.some(p=>p.id===y.id));return[...h,...x,...m]},[d,c,l]);return{selectedIds:c,selectedUsers:l,sortedUsers:f}},er=({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}},nr=({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}},tr=({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}},or=({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}},rr="40px",sr=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=sr,onLoadMore:x,hasMore:y=!1,loading:p=!1})=>{const I=u.useRef(null),g=u.useRef(null),b=u.useRef(null),{searchQuery:j,setSearchQuery:S,displayedUsers:w,setDisplayedUsers:T,isSearching:M}=Ko({users:a,onSearch:f,debounceSearch:h,debounceDelay:m}),k=t.useCombobox({onDropdownClose:()=>{k.resetSelectedOption(),S(""),z(!1)},onDropdownOpen:()=>{k.updateSelectedOptionIndex("active"),z(!0)}}),{isFocused:v,setIsFocused:z,isHovered:R,handleFocus:B,handleBlur:E,handleMouseEnter:W,handleMouseLeave:H}=tr({combobox:k,dropdownRef:b}),{placement:$,dropdownRefCallback:L}=er({isFocused:v,dropdownRef:b}),{selectedIds:_,selectedUsers:N,sortedUsers:Z}=Jo({value:r,multiple:l,users:a,displayedUsers:w,searchQuery:j,onSearch:f}),{loadMoreRef:F}=nr({onLoadMore:x,hasMore:y,loading:p,setDisplayedUsers:T}),{handleSelect:G,handleRemove:O}=or({multiple:l,value:r,onChange:i,combobox:k}),D=()=>{if(!l)return null;const P=5,oe=N.slice(0,P),X=N.length-P;return e.jsxs(t.Group,{gap:"xs",children:[oe.map(de=>e.jsx(Te,{avatar:de.avatar,name:de.name,withRemoveButton:v,onRemove:()=>O(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(C.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 P=N[0];return P?e.jsx(Te,{avatar:P.avatar,name:P.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||R?"var(--mantine-color-gray-0)":"transparent",border:v?"1px solid var(--mantine-color-gray-2)":"1px solid transparent",borderRadius:v&&$==="bottom"?"var(--mantine-radius-md) var(--mantine-radius-md) 0 0":v&&$==="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&&$==="bottom"?"0 -4px 10px 0 rgba(0, 0, 0, 0.1)":v&&$==="top"?"0 4px 10px 0 rgba(0, 0, 0, 0.1)":"none"}}),ne={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(P=>e.jsx(Te,{avatar:P.avatar,name:P.name,withRemoveButton:v,onRemove:()=>O(P.id)},P.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:V,onFocus:B,onBlur:E,onMouseEnter:()=>!d&&W(),onMouseLeave:H,w:"100%",children:e.jsxs(t.Pill.Group,{styles:ne,children:[l?D():A(),e.jsx(t.Combobox.EventsTarget,{children:e.jsx(t.PillsInput.Field,{ref:I,onFocus:B,onBlur:E,placeholder:N.length===0||v||j.length>0?c:"",value:j,onChange:P=>{k.updateSelectedOptionIndex(),S(P.currentTarget.value)},onMouseDown:P=>{P.stopPropagation()},onKeyDown:P=>{P.key==="Backspace"&&j.length===0&&(P.preventDefault(),l&&N.length>0?O(N[N.length-1].id):!l&&N.length>0&&O(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:$==="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:$==="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(rr),300),scrollbarSize:6,children:e.jsxs(t.Stack,{gap:2,children:[Z.map(P=>{const oe=_.includes(P.id);return e.jsx(t.Combobox.Option,{value:P.id,active:oe,onMouseDown:X=>{X.preventDefault(),G(P.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:P.avatar,size:24,placeholder:P.name,showPlaceholder:!0}),e.jsx(t.Text,{size:"sm",fw:400,truncate:!0,children:P.name}),oe&&e.jsx(C.IconCheck,{size:16,color:"var(--mantine-color-blue-6)"})]})},P.id)}),(M||p)&&e.jsx(t.Box,{style:{padding:"12px",display:"flex",justifyContent:"center"},children:e.jsx(t.Loader,{size:"sm"})}),x&&y&&!p&&e.jsx("div",{ref:F,style:{height:"20px"}}),Z.length===0&&!M&&!p&&e.jsx(t.Box,{style:{padding:"24px",textAlign:"center"},children:e.jsx(t.Text,{size:"sm",c:"dimmed",children:"No users found"})})]})})})})]})})},en=({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,y]=u.useState(!1),[p,I]=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=()=>{y(!0),i==null||i(!0)},j=w=>{y(!1),i==null||i(!1),r==null||r(w.target.value)},S=w=>{const T=w.target.value;if(a){a(T);return}r==null||r(T)};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:S,onFocus:b,onBlur:j,onMouseEnter:()=>I(!0),onMouseLeave:()=>I(!1),placeholder:l,disabled:d,size:"sm",radius:"md",fw:400,minRows:x?1:f,maxRows:h,autosize:m,styles:{...g}})})})},ar=({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:C.IconMaximize,size:"md",onClick:()=>{}})}),e.jsxs(t.Group,{justify:"space-between",gap:"xs",children:[e.jsx(ee,{icon:C.IconStar,size:"md",onClick:()=>{}}),e.jsx(ee,{icon:C.IconDots,size:"md",onClick:()=>{}})]})]}),o]}),Gn=({opened:n,onClose:s,editable:o,content:r,position:a="right",size:i="xl",onMaximize:c,rightCornerActions:l,headerProps:d,propertiesProps:f})=>{var w,T;const[h,m]=u.useState(!1),x=(f==null?void 0:f.hiddenProperties)&&f.hiddenProperties.length>0,[y,p]=u.useState(!1),[I,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 S=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 M={type:"emoji",value:"😊"};g(M),(k=d==null?void 0:d.onAvatarChange)==null||k.call(d,M)},children:e.jsxs(t.Box,{style:{display:"flex",alignItems:"center",justifyContent:"center",gap:6},children:[e.jsx(C.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:C.IconChevronsRight,size:"md",onClick:s}),e.jsx(ee,{icon:C.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:I?e.jsx(Ae,{editable:o,avatar:I,size:"xl",opened:b,onOpen:()=>j(!0),onClose:()=>j(!1),onAvatarSelect:M=>{var k;g(M),(k=d==null?void 0:d.onAvatarChange)==null||k.call(d,M)},onRemove:()=>{g(void 0)}}):e.jsx(t.Box,{h:24,children:y&&S})}),o?e.jsx(be,{value:d.title||"",onChange:M=>{var k;return(k=d.onTitleChange)==null?void 0:k.call(d,M)},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((M,k)=>e.jsx(t.Box,{children:M},k))}),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(C.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:(T=f==null?void 0:f.hiddenProperties)==null?void 0:T.map((M,k)=>e.jsx(t.Box,{children:M},k))})}),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(C.IconChevronUp,{size:16,color:"var(--mantine-color-blue-5)"})]})})}),r]})]})},ir=({children:n})=>e.jsx(t.Box,{style:{minHeight:"100vh",width:"100%",maxWidth:"100%",margin:"0 auto"},id:"full-page",children:n}),_n=u.createContext(void 0),Vn=({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,y]=u.useState(300),[p,I]=u.useState(500),g={opened:s,toggle:o,open:r,close:a,asideOpened:i,toggleAside:c,openAside:l,closeAside:d,sidebarWidth:x,setSidebarWidth:y,asideWidth:p,setAsideWidth:I,openedNotificationSidebar:f,openNotificationSidebar:h,closeNotificationSidebar:m};return e.jsx(_n.Provider,{value:g,children:n})},nn=()=>{const n=u.useContext(_n);if(n===void 0)throw new Error("useAppLayout must be used within an AppLayoutProvider");return n},Qn=({header:n,navbar:s,aside:o,children:r,...a})=>{const{opened:i,asideOpened:c,sidebarWidth:l,asideWidth:d}=nn();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})]})},cr=({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)})}),lr=({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}=nn(),[y,p]=u.useState(s),I=s??y,g=b=>{o==null||o(b),s===void 0&&p(b)};return e.jsx(Qn,{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?C.IconChevronsLeft:C.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(cr,{items:n,selectedId:I,onSelect:g})}),footer:e.jsx(e.Fragment,{})}),aside:e.jsx(t.Box,{p:"md",h:"100%",children:c==null?void 0:c(I)}),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:C.IconChevronsRight,size:"md",variant:"subtle",tooltip:"Open sidebar",onClick:x}),r??e.jsx(ze,{label:I||"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(I)})})]})})},dr=n=>e.jsx(Vn,{children:e.jsx(lr,{...n})}),tn=(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(y=>c.includes(y.id)),d=l.map(y=>y.id),f=c.filter(y=>!d.includes(y)),m=[...s.members,...n.users].filter(y=>f.includes(y.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}},ur=({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:y,handleMembersChange:p}=tn(f,h),I=u.useMemo(()=>[e.jsx(en,{label:"Description",icon:C.IconAlignLeft,value:m.description,onChange:m.onDescriptionChange,editable:r},"description"),e.jsx(pe,{editable:!1,label:"Team Owner",icon:C.IconUserCircle,value:d.id,users:[d]},"owner"),e.jsx(pe,{multiple:!1,editable:r,label:"Team Leader",icon:C.IconUser,value:f.userIds.length>0?f.userIds[0]:void 0,users:f.users,onChange:y,onSearch:f.handleSearch,onLoadMore:f.handleLoadMore,hasMore:f.hasMore},"leader"),e.jsx(pe,{multiple:!0,editable:r,label:"Team Members",icon:C.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,y,h.handleLoadMore,h.handleSearch,h.hasMore,h.members,x,p]);return e.jsx(Gn,{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:I}})},Yn=({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,y]=u.useState(!1),p=s?"0":{base:"1rem",sm:"2rem",md:"4rem",lg:"8rem",xl:"10rem"},[I,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:I?C.IconChevronsRight:C.IconMenu2,size:"md",color:"gray",changeIconOnHover:!0,iconHovered:I?C.IconMenu2:C.IconChevronsRight,variant:"subtle",onClick:b,"aria-pressed":I}),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:()=>y(!0),onMouseLeave:()=>y(!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 S;f(j),(S=a==null?void 0:a.onAvatarChange)==null||S.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 S;const j={type:"emoji",value:"😊"};f(j),(S=a==null?void 0:a.onAvatarChange)==null||S.call(a,j)},children:e.jsxs(t.Box,{style:{display:"flex",alignItems:"center",justifyContent:"center",gap:6},children:[e.jsx(C.IconMoodSmileFilled,{size:16}),e.jsx(t.Text,{size:"sm",fw:500,children:"Add avatar"})]})})})}),e.jsx(t.Box,{children:o?e.jsx(mn,{value:a.title||"",onChange:j=>{var S;return(S=a.onTitleChange)==null?void 0:S.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]})})]})},qn=({editable:n,owner:s,descriptionProps:o,responsibleProps:r,membersProps:a})=>{const{availableMembersUsers:i,handleResponsibleChange:c,handleMembersChange:l}=tn(r,a);return e.jsxs(t.Stack,{gap:"sm",children:[e.jsx(en,{label:"Description",icon:C.IconAlignLeft,value:o.description,onChange:o.onDescriptionChange,editable:n},"description"),e.jsx(pe,{editable:!1,label:"Team Owner",icon:C.IconUserCircle,value:s.id,users:[s]},"owner"),e.jsx(pe,{multiple:!1,editable:n,label:"Team Leader",icon:C.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:C.IconUsers,value:a.members.map(d=>d.id),users:i,onChange:l,onSearch:a.handleSearch,onLoadMore:a.handleLoadMore,hasMore:a.hasMore},"members")]})},fr=({editable:n,headerProps:s,rightNavigation:o,properties:r,children:a,footer:i})=>e.jsx(Yn,{isSidebarOpen:!0,editable:n,rightNavigation:o,headerProps:s,properties:e.jsx(qn,{...r}),children:a,footer:i}),hr=({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})]}),xr=({opened:n,onClose:s,position:o,size:r,onMaximize:a,editable:i,rightNavigation:c,headerProps:l,properties:d,children:f,footer:h})=>{var S,w;const[m,x]=u.useState(l==null?void 0:l.avatar),[y,p]=u.useState(!1),[I,g]=u.useState(!1);u.useEffect(()=>{x(l==null?void 0:l.avatar)},[l==null?void 0:l.avatar]);const b=(S=l==null?void 0:l.loading)==null?void 0:S.avatar,j=(w=l==null?void 0:l.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:C.IconChevronsRight,onClick:s}),e.jsx(fe,{icon:C.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:y,onOpen:()=>p(!0),onClose:()=>p(!1),onAvatarSelect:T=>{var M;x(T),(M=l==null?void 0:l.onAvatarChange)==null||M.call(l,T)},onRemove:()=>{x(void 0)}}):e.jsx(t.Box,{h:24,children:I&&e.jsx(t.Button,{size:"xs",radius:"md",w:"fit-content",variant:"subtle",px:"var(--mantine-spacing-sm)",color:"gray",mb:"md",onClick:()=>{var M;const T={type:"emoji",value:"😊"};x(T),(M=l==null?void 0:l.onAvatarChange)==null||M.call(l,T)},children:e.jsxs(t.Box,{style:{display:"flex",alignItems:"center",justifyContent:"center",gap:6},children:[e.jsx(C.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:T=>{var M;return(M=l.onTitleChange)==null?void 0:M.call(l,T)},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]})})]})})},Zn=t.createTheme({primaryColor:"blue",fontFamily:"Inter, system-ui, Avenir, Helvetica, Arial, sans-serif",fontFamilyMonospace:"Monaco, Courier, monospace",headings:{fontFamily:"Inter, system-ui, Avenir, Helvetica, Arial, sans-serif"},colors:{},components:{}});function pr({children:n,theme:s}){return e.jsxs(t.MantineProvider,{theme:s||Zn,children:[e.jsx(xt.Notifications,{}),e.jsx(pt.ModalsProvider,{children:e.jsx(mt.DatesProvider,{settings:{firstDayOfWeek:0},children:n})})]})}exports.ActionButton=ee;exports.ActionIcon=fe;exports.AppLayout=Qn;exports.AppLayoutProvider=Vn;exports.AvatarSelector=Ae;exports.BaseLayout=hr;exports.BoxAvatar=se;exports.CenterPeek=ar;exports.DocsTemplate=dr;exports.EditableText=be;exports.EditableTextarea=mn;exports.EmojiAvatar=ln;exports.ExpandableSearch=gn;exports.FilterDropdown=Bt;exports.FilterDropdownButton=Re;exports.FilterDropdownFilters=De;exports.FloatingIndicator=Ut;exports.FloatingIndicatorContent=Ke;exports.FloatingIndicatorProvider=Ze;exports.FloatingIndicatorTriggers=Xe;exports.FullPage=ir;exports.GenericTable=vn;exports.IconAvatar=fn;exports.ImageAvatar=hn;exports.InvitedUserCard=je;exports.LinkProperty=qo;exports.Logo=pn;exports.Matrix=Hn;exports.Menu=ve;exports.ModalSettings=wo;exports.NavButton=Je;exports.NavLink=Qe;exports.Navbar=Ye;exports.NavbarProvider=Ro;exports.NotificationSidebar=zo;exports.NumberProperty=Zo;exports.PageLayout=Yn;exports.PageProperty=he;exports.PlaceholderAvatar=Oe;exports.PopoverItem=yn;exports.PopoverSelector=Ee;exports.SelectUserProperty=pe;exports.ShareButton=jo;exports.ShareMenu=Rn;exports.ShareModal=bo;exports.SidePeek=Gn;exports.SidePeekLayout=xr;exports.TeamPage=fr;exports.TeamProperties=qn;exports.TeamSidePeek=ur;exports.TextButton=ze;exports.TextProperty=Yo;exports.TextareaProperty=en;exports.ThemeProvider=pr;exports.UserChip=Te;exports.WorkspaceSelector=No;exports.WorkspaceSelectorItem=En;exports.getInitialsFromName=xn;exports.theme=Zn;exports.useAppLayout=nn;exports.useFloatingIndicator=Nt;exports.useNavbar=Do;exports.useTeamProperties=tn;
|
|
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=I=>{if(I==="remove-filters")s([]);else{const g=o==null?void 0:o.find(b=>b.value===I);if(g){const b={id:`${g.value}-${Date.now()}`,filterOption:g};s([...n,b])}}i.closeDropdown()},h=(o||[]).filter(I=>!n.some(g=>g.filterOption.value===I.value)),m={borderRadius:"var(--mantine-radius-md)",fontSize:"var(--mantine-font-size-sm)",color:"var(--mantine-color-gray-7)",fontWeight:"500"},y=(()=>{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",...y},onMouseEnter:()=>l(!0),onMouseLeave:()=>l(!1),onClick:()=>i.toggleDropdown(),children:e.jsx(C.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(I=>e.jsx(t.Combobox.Option,{value:I.value,style:{...m},children:e.jsxs(t.Box,{style:{display:"flex",alignItems:"center",gap:"8px"},children:[I.icon,I.label]})},I.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(C.IconFilterOff,{size:16,stroke:2}),"Remove filters"]})})]})})]})},Ct=({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=y=>{if(y==="remove")o();else{const p=d.find(I=>I.value===y);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(C.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(y=>{var p;return e.jsx(t.Combobox.Option,{value:y.value,active:((p=n.selectedOption)==null?void 0:p.value)===y.value,style:{...h},children:y.label},y.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"})]})})]})},Mt=({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 y=o==null?void 0:o.find(p=>p.value===x);if(y){const p={id:`${y.value}-${Date.now()}`,filterOption:y};s([...n,p])}a.closeDropdown()},d=(o||[]).filter(x=>!n.some(y=>y.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(Ct,{filterTag:f,onUpdate:c,onRemove:()=>l(f.id),size:r,options:h,filterTagDropdownPosition:i},f.id)}),d.length>0&&e.jsx(Mt,{activeFilters:n,onFiltersChange:s,availableFilters:d,size:r})]})})},Tt=({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})]}),Bt=Object.assign(Tt,{Button:Re,Filters:De}),Ot=({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(Ot,{...l},d))]})]})},zt="floatingIndicator-module__wrapper___oBPtC",Rt="floatingIndicator-module__control___5GZIX",Dt="floatingIndicator-module__label___Qmy1z",Et="floatingIndicator-module__icon___sjrda",At="floatingIndicator-module__indicator___p7zco",Lt="floatingIndicator-module__content___UXG3x",ge={wrapper:zt,control:Rt,label:Dt,icon:Et,indicator:At,content:Lt},In=u.createContext(null),qe=()=>{const n=u.useContext(In);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 k;const[l,d]=u.useState(null),[f,h]=u.useState({}),[m,x]=u.useState(o??((k=n[0])==null?void 0:k.id)),y=s!==void 0,p=u.useRef(new Map),I=u.useCallback((v,z)=>{h(R=>{if(z)return R[v]===z?R:{...R,[v]:z};if(!(v in R))return R;const B={...R};return delete B[v],B})},[]),g=u.useCallback(v=>(p.current.has(v)||p.current.set(v,z=>{I(v,z)}),p.current.get(v)),[I]);u.useEffect(()=>{const v=new Set(n.map(z=>z.id));p.current.forEach((z,R)=>{v.has(R)||p.current.delete(R)}),h(z=>{if(!Object.keys(z).some(E=>!v.has(E)))return z;const B={};return Object.entries(z).forEach(([E,W])=>{v.has(E)&&(B[E]=W)}),B})},[n]),u.useEffect(()=>{var z;if(y)return;const v=o&&n.some(R=>R.id===o)&&o||((z=n[0])==null?void 0:z.id);x(R=>R&&n.some(B=>B.id===R)?R:v)},[n,o,y]);const b=(y?s:m)??null,j=u.useMemo(()=>n.find(v=>v.id===b),[n,b]),S=u.useCallback((v,z)=>()=>{z||(y||x(v),r==null||r(v))},[y,r]),w=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]),T=u.useMemo(()=>{if(!a)return{};const{className:v,...z}=a;return z},[a]),M=u.useMemo(()=>({items:n,currentActiveId:b,showIcons:i,handleItemClick:S,getControlRefCallback:g,setParentRef:d,parentRef:l,indicatorClassName:w,indicatorProps:T,activeItem:j,controlsRefs:f}),[n,b,i,S,g,l,w,T,j,f]);return e.jsx(In.Provider,{value:M,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(y=>{const p=y.icon,I=y.id===r,g=!!(p&&a);return e.jsxs(t.UnstyledButton,{ref:c(y.id),onClick:i(y.id,y.disabled),"data-active":I,className:ge.control,disabled:y.disabled,children:[g&&p&&e.jsx("span",{className:ge.icon,children:e.jsx(p,{size:16})}),e.jsx("span",{className:ge.label,children:y.label})]},y.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})},Ft=({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,{})]})}),Nt=qe,Ut=Object.assign(Ft,{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})]})})},Wt="navlink-module__navlink___nc4pR",$t={navlink:Wt},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:y,placeholder:p,onClick:I,"aria-label":g,...b})=>{const[j,S]=u.useState(!1),[w,T]=u.useState(!1),[M,k]=u.useState(!1),v=w||M,z=u.Children.count(o)>0,R=!h&&z&&(x?v:!0),B=u.useCallback(()=>{f||I==null||I()},[I,f]),E=u.useCallback(F=>{F.stopPropagation(),!f&&(r==null||r())},[r,f]),W=u.useCallback(F=>{F==null||F.stopPropagation(),!f&&z&&!h&&S(G=>!G)},[f,z,h]),H=u.useCallback(()=>{f||r==null||r()},[r,f]),$=u.useCallback(F=>{f||a==null||a(F)},[a,f,n]),L=u.useCallback(()=>z?u.Children.map(o,F=>u.isValidElement(F)?u.cloneElement(F,{...F.props,level:d+1}):F):null,[o,z,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:()=>$(F.action)})))||[],N=[{children:e.jsxs(t.Group,{gap:"xs",wrap:"nowrap",children:[e.jsx(C.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:$t.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&&T(!0),onMouseLeave:()=>{M||T(!1)},onClick:B,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:B,style:{paddingLeft:h&&!R?`${(d+1)*32}px`:d>0?`${d*32}px`:"0px"},children:[R?e.jsx(fe,{icon:j?C.IconChevronDown:C.IconChevronRight,iconOnHover:j?C.IconChevronDown:C.IconChevronRight,grayScaleBaseColor:v?1:0,color:"var(--mantine-color-gray-7)",onClick:W,disabled:f}):x?e.jsx(se,{size:"xs",avatar:y,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:C.IconPlus,grayScaleBaseColor:v?1:0,onClick:H,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:C.IconDots,grayScaleBaseColor:1,color:"var(--mantine-color-gray-7)"}),position:"bottom-end",shadow:"md",onOpen:()=>{k(!0),T(!0)},onClose:()=>{k(!1)}})})]})]})]})}),j&&!h&&e.jsx(t.Stack,{gap:0,style:{width:"100%"},children:z?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})})})]})},Pt="userChip-module__pill___DgFME",Ht={pill:Pt},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:Ht.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:450,c:"var(--mantine-color-gray-9)",children:s})]})}),Gt="200px",_t="4px 8px",Vt=40,Qt="var(--mantine-radius-md)",Yt=16,yn=({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:Gt,backgroundColor:o?"transparent":i?"var(--mantine-color-gray-1)":"transparent",cursor:o?"default":"pointer",borderRadius:Qt,padding:_t,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:Vt,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(C.IconCheck,{size:Yt,color:"var(--mantine-color-gray-9)"})]})})},qt="bottom-end",Zt=1e4,Xt="24px",Kt="0 8px",Jt="6px",rn="var(--mantine-radius-md)",eo="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})=>{const[y,p]=u.useState(!1),I=(o||[]).find(v=>v.value===n)||d,[g,b]=u.useState(!1),[j,S]=u.useState(!1),[w,T]=u.useState(!1),M=r?e.jsx(t.Group,{p:"sm",onClick:v=>{v.stopPropagation(),i==null||i(n)},style:{cursor:"pointer",height:eo,display:"flex",alignItems:"center",borderRadius:rn,backgroundColor:j?"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,k=e.jsxs(t.Box,{onMouseEnter:()=>!l&&b(!0),onMouseLeave:()=>!l&&b(!1),onClick:()=>{l||(p(!0),T(!0))},style:{height:Xt,cursor:l?"not-allowed":"pointer",display:"inline-flex",alignItems:"center",borderRadius:rn,backgroundColor:l?"transparent":g||w?"var(--mantine-color-gray-1)":"transparent",transition:"background-color 0.2s ease",padding:Kt,gap:Jt,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:(I==null?void 0:I.label)||"Select option"}),e.jsx(C.IconChevronDown,{size:16,style:{color:l?"var(--mantine-color-gray-3)":"var(--mantine-color-gray-6)"}})]});return e.jsxs(t.Popover,{opened:y,onChange:v=>{p(v),v||T(!1)},position:qt,shadow:"md",withinPortal:!0,zIndex:Zt,styles:f,children:[e.jsx(t.Popover.Target,{children:k}),e.jsx(t.Popover.Dropdown,{onClick:v=>v.stopPropagation(),onMouseDown:v=>v.stopPropagation(),styles:{dropdown:{borderRadius:"var(--mantine-radius-md)",padding:"4px",...h}},children:e.jsxs(t.Stack,{gap:0,onClick:v=>v.stopPropagation(),onMouseDown:v=>v.stopPropagation(),children:[(o||[]).map(v=>{const z=c.includes(v.value),R=v.value===n;return e.jsx(yn,{item:v,withAvatars:a,disabled:z,selected:R,onClick:B=>{s==null||s(B),p(!1),T(!1)}},v.value)}),M]})})]})},no=(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}},vn=({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:y,sortDirection:p,onSearch:I,onRowClick:g,size:b="md",striped:j=!1,highlightOnHover:S=!0,enableInfiniteScroll:w=!1,isLoadingMore:T=!1,hasMore:M=!1,onLoadMore:k})=>{const[v,z]=u.useState(""),[R,B]=u.useState([]),{loadMoreRef:E}=no(w,k||(()=>{}),M,T),W=u.useMemo(()=>[...f?o.filter(D=>D.type==="select"&&D.options).map(D=>({value:D.key,label:D.label})):[],...h],[o,f,h]),H=u.useMemo(()=>{let O=s||[];if(v){const D=v.toLowerCase();O=O.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 R.forEach(D=>{if(D.filterTag.selectedOption){const A=o.find(U=>U.key===D.filterTag.filterOption.value);A&&(O=O.filter(U=>{var ne;const V=U[A.key];return String(V)===((ne=D.filterTag.selectedOption)==null?void 0:ne.value)}))}}),O},[s,v,R,o]),$=O=>{z(O),I==null||I(O)},L=O=>{const D=o.find(U=>U.key===O);if(!(D!=null&&D.sortable))return;const A=y===O&&p==="asc"?"desc":"asc";x==null||x(O,A)},_=O=>{const D=o.find(A=>A.key===O);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=(O,D)=>{var U,V,ne,P,oe;const A=D[O.key];switch(O.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=O.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 O.options?e.jsx(Ee,{value:A,data:O.options,placeholder:O.label,onChange:re=>{var me;return(me=O.onSelectChange)==null?void 0:me.call(O,re,D)},disabled:(U=O.disabled)==null?void 0:U.call(O,D)}):e.jsx(t.Text,{size:"sm",c:"dimmed",children:"—"});case"badge":const Le=((V=O.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=((ne=O.fallbackText)==null?void 0:ne.call(O,D))||String(A).charAt(0).toUpperCase();return e.jsx(se,{avatar:A,size:"xs",placeholder:Fe,showPlaceholder:!0});case"custom":return((P=O.render)==null?void 0:P.call(O,A,D))||e.jsx(t.Text,{size:"sm",c:"dimmed",children:"—"});case"actions":return(oe=O.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(C.IconDots,{size:16})})}),e.jsx(t.Menu.Dropdown,{children:O.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=O=>{var D;return(D=o.find(A=>A.key===O))!=null&&D.sortable?y===O?p==="asc"?e.jsx(C.IconChevronUp,{size:14}):e.jsx(C.IconChevronDown,{size:14}):e.jsx(C.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(gn,{placeholder:d,value:v,onChange:$,onSearch:$,expandDirection:"right",size:G.buttonSize}),W.length>0&&e.jsx(Re,{activeFilters:R.map(O=>O.filterTag),onFiltersChange:O=>{B(O.map(D=>({filterTag:D,onUpdate:()=>{},onRemove:()=>{}}))),m==null||m(O)},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:R.map(O=>O.filterTag),onFiltersChange:O=>{B(O.map(D=>({filterTag:D,onUpdate:()=>{},onRemove:()=>{}}))),m==null||m(O)},availableFilters:W,size:"md",getFilterOptions:_})]}),a,e.jsxs(t.Table,{striped:j,highlightOnHover:S,highlightOnHoverColor:"var(--mantine-color-gray-0)",mt:"xs",children:[e.jsx(t.Table.Thead,{children:e.jsx(t.Table.Tr,{children:o.map(O=>e.jsx(t.Table.Th,{c:"var(--mantine-color-gray-6)",style:{width:O.width,textAlign:O.align||"left",cursor:O.sortable?"pointer":"default"},onClick:()=>O.sortable&&L(O.key),children:e.jsxs(t.Group,{gap:"xs",wrap:"nowrap",children:[O.icon&&e.jsx(t.Box,{style:{display:"flex",alignItems:"center"},children:O.icon}),e.jsx(t.Text,{size:G.textSize,fw:500,children:O.label}),Z(O.key)]})},String(O.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:l})})}):H.map((O,D)=>e.jsx(t.Table.Tr,{style:{cursor:g?"pointer":"default"},onClick:()=>g==null?void 0:g(O),children:o.map(A=>e.jsx(t.Table.Td,{style:{textAlign:A.align||"left"},children:N(A,O)},String(A.key)))},O.id||D))})]}),w&&e.jsx(t.Box,{ref:E,style:{padding:"16px",display:"flex",justifyContent:"center",alignItems:"center",minHeight:"60px"},children:T&&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(vn,{});const to=({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,y]=u.useState(null),[p,I]=u.useState(null),g=u.useCallback(v=>{i(v)},[]),b=u.useCallback(v=>{l(v)},[]),j=u.useCallback(v=>{I(v);const z=new FileReader;z.onload=R=>{var E;const B=(E=R.target)==null?void 0:E.result;f(B)},z.readAsDataURL(v)},[]),S=u.useCallback(v=>{m(v),f(null),I(null),y(null),n==null||n({type:"emoji",value:v}),s==null||s(v)},[n,s]),w=u.useCallback(v=>{y(v),f(null),I(null),m(null),n==null||n({type:"icon",value:v}),r==null||r(v)},[n,r]),T=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]),M=u.useCallback(()=>{f(null),I(null),m(null),y(null)},[]),k=u.useCallback(()=>{f(null),m(null),y(null),I(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:T,handleEmojiSelect:S,handleIconSelect:w,clearImagePreview:M,resetState:k}},oo=({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}},ro=({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 sn=!1;sn||(cn.init({data:Be}),sn=!0);const so=()=>{const n=[{id:"frequent",name:"Frequently Used",icon:e.jsx(C.IconClock,{size:20,strokeWidth:2.5})}];return Be.categories.forEach(s=>{if(s.emojis&&s.emojis.length>0){let o=e.jsx(C.IconMoodSmile,{size:20,strokeWidth:2}),r=s.name;switch(s.id){case"people":o=e.jsx(C.IconMoodSmile,{size:20,strokeWidth:2}),r="Smileys & People";break;case"nature":o=e.jsx(C.IconTrees,{size:20,strokeWidth:2}),r="Animals & Nature";break;case"foods":o=e.jsx(C.IconApple,{size:20,strokeWidth:2}),r="Food & Drink";break;case"activity":o=e.jsx(C.IconBallBasketball,{size:20,strokeWidth:2}),r="Activities";break;case"travel":o=e.jsx(C.IconPlane,{size:20,strokeWidth:2}),r="Travel & Places";break;case"places":o=e.jsx(C.IconPlane,{size:20,strokeWidth:2}),r="Travel & Places";break;case"objects":o=e.jsx(C.IconBulb,{size:20,strokeWidth:2}),r="Objects";break;case"symbols":o=e.jsx(C.IconHeart,{size:20,strokeWidth:2}),r="Symbols";break;case"flags":o=e.jsx(C.IconFlag,{size:20,strokeWidth:2}),r="Flags";break;case"frequent":return;default:o=e.jsx(C.IconMoodSmile,{size:20,strokeWidth:2}),r=`Category: ${s.id}`;break}n.push({id:s.id,name:r,icon:o})}}),n},ao=({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=so();u.useEffect(()=>{o.trim()?(m(!0),cn.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 y=u.useMemo(()=>{if(o.trim())return d;if(a==="frequent")return c.map(b=>({id:b,native:b,name:"",keywords:[]}));const g=Be.categories.find(b=>b.id===a);return g?g.emojis.map(b=>{const j=Be.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(w=>w!==g),S=[g,...j].slice(0,20);return typeof window<"u"&&localStorage.setItem("emoji-frequent",JSON.stringify(S)),S})},I=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(C.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:I(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..."}):y.length>0?y.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))})})]})},jn=["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"],bn=["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"],wn=["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"],Sn=["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"],kn=["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"],Cn=["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"],Mn=["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"],Tn=["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"];[...jn,...bn,...wn,...Sn,...kn,...Cn,...Mn,...Tn];const Ie=[{id:"recent",name:"Recently Used",icons:[],isDynamic:!0},{id:"user",name:"User & Profile",icons:jn},{id:"business",name:"Business & Work",icons:bn},{id:"tech",name:"Technology",icons:wn},{id:"expressions",name:"Expressions",icons:Sn},{id:"nature",name:"Nature & Animals",icons:kn},{id:"shapes",name:"Shapes & Symbols",icons:Cn},{id:"actions",name:"Actions & Tools",icons:Mn},{id:"communication",name:"Communication",icons:Tn}],io={recent:e.jsx(C.IconClock,{size:20,strokeWidth:2.5}),user:e.jsx(C.IconUser,{size:20,strokeWidth:2.5}),business:e.jsx(C.IconBriefcase,{size:20,strokeWidth:2.5}),tech:e.jsx(C.IconDeviceDesktop,{size:20,strokeWidth:2.5}),expressions:e.jsx(C.IconMoodSmile,{size:20,strokeWidth:2.5}),nature:e.jsx(C.IconTrees,{size:20,strokeWidth:2.5}),shapes:e.jsx(C.IconCircle,{size:20,strokeWidth:2.5}),actions:e.jsx(C.IconTool,{size:20,strokeWidth:2.5}),communication:e.jsx(C.IconMessage,{size:20,strokeWidth:2.5})},co=({selectedCategory:n,onCategoryChange:s})=>e.jsx(t.Flex,{gap:"0px",justify:"center",wrap:"wrap",children:Ie.map(o=>{const r=io[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)})}),Bn=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(S){console.warn("Error parsing recent icons from localStorage:",S)}}},[]);const h=u.useMemo(()=>Ie.filter(j=>j.id!=="recent"&&!("isDynamic"in j)).flatMap(j=>j.icons),[]),m=u.useMemo(()=>{if(a==="recent"){const S=new Set(h);return d.filter(w=>S.has(w))}const j=Ie.find(S=>S.id===a);return(j==null?void 0:j.icons)||[]},[a,d,h]),x=u.useCallback((j,S)=>{if(!j.trim())return S;const w=j.toLowerCase().trim(),T=w.split(/\s+/);return S.filter(M=>{const v=M.replace(/^Icon/,"").split(/(?=[A-Z])/).map(z=>z.toLowerCase().trim()).filter(z=>z.length>0);return!!(v.some(z=>T.some(R=>z===R))||w.length>2&&v.some(z=>T.some(R=>z.startsWith(R)))||w.length<=2&&v.some(z=>T.some(R=>z.includes(R)))||T.length>1&&T.every(z=>v.some(R=>R===z||R.startsWith(z))))})},[]),y=u.useMemo(()=>o.trim()?x(o,h):m,[o,m,h,x]),p=u.useCallback(j=>{h.includes(j)&&f(w=>{const T=[j,...w.filter(M=>M!==j)].slice(0,20);return typeof window<"u"&&localStorage.setItem("avatar-icon-recent",JSON.stringify(T)),T}),n(j)},[n,h]),I=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(C.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:y.map(j=>e.jsx(dn,{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(co,{selectedCategory:a,onCategoryChange:I})})]})});Bn.displayName="IconGrid";const lo=({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(C.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(C.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"})]})}),uo=({onEmojiSelect:n})=>e.jsx(ao,{onEmojiSelect:n,height:358}),fo=({onIconSelect:n})=>e.jsx(Bn,{onIconSelect:n,height:358}),ho=({previewImage:n,selectedEmoji:s,size:o,loading:r,onFileInputClick:a,onImageChange:i,onImageAccept:c,onClearImagePreview:l,fileInputRef:d})=>e.jsx(lo,{previewImage:n,fileInputRef:d,selectedEmoji:s,size:o,loading:r,onFileInputClick:a,onImageChange:i,onImageAccept:c,onClearImagePreview:l}),xo=()=>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:y=1e3})=>{const p=u.useRef(null),I=u.useRef(null),g=u.useRef(null),{selectedTab:b,tabHovered:j,previewImage:S,selectedEmoji:w,selectedIcon:T,selectedFile:M,handleTabChange:k,handleTabHover:v,handleImagePreview:z,handleImageAccept:R,handleEmojiSelect:B,handleIconSelect:E,clearImagePreview:W,resetState:H}=to({onAvatarSelect:i});oo({opened:s,onClose:r,popoverRef:I}),u.useEffect(()=>{s||H()},[s,H]);const $=X=>{console.log("Emoji clicked:",X),B(X),r()},L=X=>{console.log("Icon clicked:",X),E(X),r()},_=X=>{X&&z(X)},N=()=>{M?(R(),r()):(w||T)&&r()},Z=()=>{p.current&&p.current.click()},F=()=>{W()},G=()=>{console.log("Avatar removed"),c==null||c(),r()},O=()=>!!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(uo,{onEmojiSelect:$}),U=e.jsx(fo,{onIconSelect:L}),V=e.jsx(ho,{previewImage:S,selectedEmoji:w,size:l,loading:d,onFileInputClick:Z,onImageChange:_,onImageAccept:N,onClearImagePreview:F,fileInputRef:p}),ne=e.jsx(t.Box,{children:e.jsx(ro,{selectedTab:b,tabHovered:j,onTabChange:k,onTabHover:v,onRemove:G,hasAvatar:O(),children:b==="emoji"?A:b==="icons"?U:V})}),P=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:I,p:0,style:{width:"auto",overflow:"hidden",zIndex:y},children:e.jsx(u.Suspense,{fallback:e.jsx(xo,{}),children:ne})})]})}),oe=e.jsx(se,{avatar:a,size:l,placeholder:f,showPlaceholder:h});return e.jsx(e.Fragment,{children:n?P:oe})},po=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())},mo=n=>{const s=[];return n.forEach(o=>{po(o)||s.push({email:o,error:"Please enter a valid email address"})}),{isValid:s.length===0,errors:s}},go=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},Io=n=>{const s=mo(n),o=go(n),r=[...s.errors,...o];return{isValid:r.length===0,errors:r}},yo=({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(I=>{if(a[I])return a[I];const g=r.find(b=>b.email===I);return g&&g.name?g.name:I});u.useEffect(()=>{o&&o(i)},[i,o]),u.useEffect(()=>{if(n.length>0){const I=Io(n);d(I.errors)}else d([])},[n]),u.useEffect(()=>{const I=f.current;if(!I)return;let g;const b=j=>{const w=j.target.value||"";clearTimeout(g),g=setTimeout(()=>{c(w)},150)};return I.addEventListener("input",b),()=>{I.removeEventListener("input",b),clearTimeout(g)}},[]);const m=u.useCallback(I=>{const g=r.map(j=>({name:j.name||j.email,email:j.email})),b=I.map(j=>{const S=g.find(w=>w.name.toLowerCase()===j.toLowerCase());return S?S.email:j}).filter(j=>j.includes("@")?!0:!g.some(w=>{const T=w.name.toLowerCase(),M=j.toLowerCase();return T.startsWith(M)&&M!==T}));s(b),c("")},[s,r]),x=u.useCallback(()=>{f.current&&(f.current.value="",c(""))},[]),y=l.length===0&&n.length>0,p=u.useCallback((I,g,b)=>{I&&n.length>0&&g&&(I(n,g,b),c(""))},[n]);return{inputText:i,tagsInputRef:f,displayValue:h,validationErrors:l,isValid:y,handleEmailChange:m,clearInput:x,handleInvite:p}},On=({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,y]=u.useState({}),p=i.length>0?i[0].value:void 0,[I,g]=u.useState(p);u.useEffect(()=>{i.length>0&&!I&&g(i[0].value)},[i.length,I]),u.useEffect(()=>{const B=a.filter(E=>c.includes(E.email)).map(E=>E.id);f(E=>E.filter(W=>B.includes(W)))},[c,a.length]);const[b,j]=u.useState("invite"),[S,w]=u.useState(null),T=(B,E,W)=>{n&&n(B,E,W),l([]),m("")},M=(B,E)=>{s&&s(B,E)},k=B=>{o&&o(B)},v=B=>{f(E=>E.includes(B)?E.filter(W=>W!==B):[...E,B])},z=B=>{c.includes(B.email)||(l([...c,B.email]),y(E=>({...E,[B.email]:B.name||B.email})),d.includes(B.id)||f([...d,B.id]),m(""))},R=h.trim()?a.filter(B=>{var W;const E=h.toLowerCase();return B.email.toLowerCase().includes(E)||((W=B.name)==null?void 0:W.toLowerCase().includes(E))}):[];return{emails:c,setEmails:l,selectedUsers:d,setSelectedUsers:f,inputText:h,setInputText:m,tagDisplayMap:x,setTagDisplayMap:y,selectedRole:I,setSelectedRole:g,selectedTab:b,setSelectedTab:j,tabHovered:S,setTabHovered:w,filteredUsers:R,handleInvite:T,handleUpdateRole:M,handleRemoveUser:k,handleToggleUser:v,handleAddSuggestedUser:z}},zn=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:y,displayValue:p,validationErrors:I,isValid:g,handleEmailChange:b,clearInput:j,handleInvite:S}=yo({value:n,onChange:s,onInputChange:l,suggestedUsers:d,tagDisplayMap:f}),w=()=>{S(r,i,m),x("")};u.useImperativeHandle(h,()=>({clearInput:j}),[j]);const T=p.length>0,M=c&&a.length>0,k=I.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:y,value:p,onChange:b,placeholder:T?"":o,radius:"md",rightSection:M?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:M?"120px":"0px",position:"absolute",height:"32px",right:"8px"}},styles:{input:{paddingRight:M?"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:I.map((v,z)=>e.jsxs(t.Text,{size:"xs",c:"red",children:[v.email,": ",v.error]},z))})]}),T&&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:w,fullWidth:!0,radius:"md",disabled:!g,children:"Send invitations"})]})]})}),vo=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"}},jo=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"}},bo=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,[y,p]=u.useState(!1),I=()=>{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:I,bg:y?"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:bo(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:vo(n.status),radius:"sm",children:jo(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)})]})]})},Rn=({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:y,setInputText:p,tagDisplayMap:I,selectedRole:g,setSelectedRole:b,selectedTab:j,setSelectedTab:S,tabHovered:w,setTabHovered:T,filteredUsers:M,handleInvite:k,handleUpdateRole:v,handleRemoveUser:z,handleToggleUser:R,handleAddSuggestedUser:B}=On({onInvite:o,onUpdateRole:r,onRemoveUser:a,invitedUsers:i,suggestedUsers:d,roleOptions:l}),E=L=>{B(L),f.current&&f.current.clearInput()},W=e.jsxs(e.Fragment,{children:[e.jsx(zn,{ref:f,value:h,onChange:m,onInvite:k,roleOptions:l,selectedRole:g,onRoleChange:b,onInputChange:p,suggestedUsers:d,tagDisplayMap:I}),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:R,onUpdateRole:v,onRemoveUser:z,roleOptions:l,variant:"invited"},L.id))})]})})}),M.length>0&&e.jsx(t.ScrollArea,{pt:"sm",mah:200,type:"auto",style:{overflow:"visible"},children:e.jsx(t.Box,{children:M.length>0?e.jsxs(e.Fragment,{children:[e.jsxs(t.Text,{size:"sm",fw:500,children:["Suggested ",y.trim()&&`(filtered by "${y}")`]}),e.jsx(t.Space,{h:"sm"}),e.jsx(t.Stack,{gap:"sm",children:M.map(L=>e.jsx(je,{user:L,isSelected:x.includes(L.id),onToggle:R,onUpdateRole:v,onRemoveUser:z,roleOptions:l,variant:"suggested",onClick:()=>E(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"})]})}),$=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:()=>{S("invite")},onMouseEnter:()=>T("invite"),onMouseLeave:()=>T(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: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:()=>{S("publish")},onMouseEnter:()=>T("publish"),onMouseLeave:()=>T(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: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:H})})]})})});return e.jsx(ve,{trigger:c,menuItems:[],opened:n,onClose:s,styles:{dropdown:{padding:"0",borderRadius:"var(--mantine-radius-md)"}},children:$})},wo=({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(Rn,{opened:d,onClose:h,onInvite:n,onUpdateRole:s,onRemoveUser:o,invitedUsers:r,currentUser:a,roleOptions:i,suggestedUsers:c,children:m})},So=({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:y,tagDisplayMap:p,selectedRole:I,setSelectedRole:g,filteredUsers:b,handleInvite:j,handleUpdateRole:S,handleRemoveUser:w,handleToggleUser:T,handleAddSuggestedUser:M}=On({onInvite:o,onUpdateRole:r,onRemoveUser:a,invitedUsers:i,suggestedUsers:l,roleOptions:c}),k=v=>{M(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:C.IconX,size:"md",onClick:s,color:"var(--mantine-color-gray-8)"})]}),e.jsx(zn,{ref:d,value:f,onChange:h,onInvite:j,roleOptions:c,selectedRole:I,onRoleChange:g,onInputChange:y,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:T,onUpdateRole:S,onRemoveUser:w,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:T,onUpdateRole:S,onRemoveUser:w,roleOptions:c,variant:"suggested",onClick:()=>k(v)},v.id))})})]})]})})},ko=({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(y=>y.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(y=>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:y}),o.filter(p=>p.group===y).map(p=>e.jsx(Je,{label:p.label,icon:p.icon,onClick:()=>d(p.id),isActive:l===p.id},p.id))]},y)}))})})}),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"})]})})]})]})]})},Co=(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}`},Mo=(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}`},To=n=>{const s=typeof n=="string"?new Date(n):n,o=new Date;return s.toDateString()===o.toDateString()},Bo=n=>{const s=typeof n=="string"?new Date(n):n,o=new Date;return o.setDate(o.getDate()-1),s.toDateString()===o.toDateString()},Oo=(n,s="es")=>To(n)?s==="es"?"Hoy":"Today":Bo(n)?s==="es"?"Ayer":"Yesterday":Co(n,s),zo=({notification:n,message:s,markAsRead:o,archiveNotification:r,children:a,actions:i})=>{var h,m,x,y,p;const c=new Date().getTime()-new Date(n.timestamp).getTime()<6048e5?Oo(n.timestamp,"en"):Mo(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:C.IconCheck}),!n.isArchived&&e.jsx(ee,{onClick:()=>r(n.id),icon:C.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(pn,{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?((y=n.category)==null?void 0:y.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})]})},Ro=(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}},Do=({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:y=!1,onOpen:p=()=>{},onClose:I=()=>{},enableInfiniteScroll:g=!0})=>{const b=[{children:"Mark all as read",leftSection:e.jsx(C.IconChecklist,{size:16}),onClick:()=>i()},{children:"Archive all",leftSection:e.jsx(C.IconArchive,{size:16}),onClick:()=>c()}],j=[{children:"All",leftSection:e.jsx(C.IconChecklist,{size:16}),onClick:()=>h==null?void 0:h("all"),active:m==="all"},{children:"Unread",leftSection:e.jsx(C.IconChecklist,{size:16}),onClick:()=>h==null?void 0:h("unread"),active:m==="unread"},{children:"Archived",leftSection:e.jsx(C.IconArchive,{size:16}),onClick:()=>h==null?void 0:h("archived"),active:m==="archived"}],S=M=>x&&M.category&&["welcome","upgrade"].includes(M.category)?x(M,l,d):e.jsx(zo,{notification:M,markAsRead:l,archiveNotification:d,message:M.message,actions:M.actions},M.id),{isActive:w,loadMoreRef:T}=Ro(y,g,f||(()=>{}),r,o);return e.jsxs(e.Fragment,{children:[e.jsx(Je,{isActive:w,icon:e.jsx(C.IconBell,{strokeWidth:2,size:24,color:"var(--mantine-color-gray-7)"}),onClick:()=>{y?I():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:y,onClose:I,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:C.IconFilter})}),e.jsx(ve,{position:"bottom-end",menuItems:b,trigger:e.jsx(ee,{onClick:()=>{},icon:C.IconDots,changeIconOnHover:!0,iconHovered:C.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(M=>S(M))}):e.jsxs(t.Stack,{gap:0,w:"100%",h:"100%",justify:"center",align:"center",py:"xl",children:[e.jsx(C.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:T,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})]})},Dn=u.createContext(void 0),Eo=({children:n})=>{const[s,{open:o,close:r}]=ye.useDisclosure(!1),a={openedNotificationSidebar:s,openNotificationSidebar:o,closeNotificationSidebar:r};return e.jsx(Dn.Provider,{value:a,children:n})},Ao=()=>{const n=u.useContext(Dn);if(n===void 0)throw new Error("useNavbar must be used within an NavbarProvider");return n},En=({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(C.IconCheck,{size:16,color:"var(--mantine-color-blue-6)"}),i&&e.jsx(t.Badge,{size:"xs",variant:"light",color:"yellow",radius:"sm",children:"Owner"})]})]})},Lo="workspace-selector-module__menuItem___FSB6P",Fo="workspace-selector-module__workspaceButton___-P6kp",No="workspace-selector-module__workspaceText___YDAlj",Uo="workspace-selector-module__scrollWrapper___MzrJY",Ve={menuItem:Lo,workspaceButton:Fo,workspaceText:No,scrollWrapper:Uo},Wo=({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:y,menuItems:p})=>{const[I,g]=u.useState(!1),[b,j]=u.useState(""),S=u.useMemo(()=>b?n.filter(k=>{var v;return k.name.toLowerCase().includes(b.toLowerCase())||((v=k.ownerEmail)==null?void 0:v.toLowerCase().includes(b.toLowerCase()))}):n,[n,b]),w=k=>{i==null||i(k.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[T,M]=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:I,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(!I),style:{padding:"6px",display:"flex",alignItems:"center",borderRadius:"var(--mantine-radius-md)",cursor:"pointer"},className:`${Ve.workspaceButton} ${h||""}`,bg:T||I?"var(--mantine-color-gray-1)":"transparent",onMouseEnter:()=>M(!0),onMouseLeave:()=>M(!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:C.IconChevronDown,size:"md",onClick:()=>g(!I),grayScaleBaseColor:T?1:0}),(T||x)&&e.jsx(fe,{icon:C.IconChevronsLeft,size:"md",onClick:()=>{m==null||m()},grayScaleBaseColor:T?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:[y,e.jsx(t.Menu.Divider,{style:{margin:"1px 0px"}}),e.jsx(t.Stack,{gap:0,px:4,children:S.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:S.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:v=>{v.currentTarget.style.backgroundColor="var(--mantine-color-gray-1)"},onMouseLeave:v=>{v.currentTarget.style.backgroundColor="transparent"},children:e.jsx(En,{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))})]})})]})},An=({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});An.displayName="MatrixCenter";const Ln=({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 I=["empty","outline","filled"],b=(I.indexOf(m)+1)%I.length,j=I[b];a?a(j):d(j)},y=()=>{switch(m){case"empty":return null;case"outline":return e.jsx(C.IconPoint,{size:16,color:"var(--mantine-color-gray-8)",stroke:2.5});case"filled":return e.jsx(C.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||y()})};Ln.displayName="MatrixCell";const Fn=({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),y=u.useRef(!1),p=()=>{!r||!d||(m(!0),y.current=!1,x.current=setTimeout(()=>{y.current=!0,d(r)},500))},I=()=>{r&&(m(!1),x.current&&(clearTimeout(x.current),x.current=null),!y.current&&l&&l(r),y.current=!1)},g=()=>{m(!1),x.current&&(clearTimeout(x.current),x.current=null),y.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:I,onMouseLeave:g,...f,children:n})};Fn.displayName="MatrixBlockLeft";const Nn=({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),y=u.useRef(!1),p=()=>{!r||!d||(m(!0),y.current=!1,x.current=setTimeout(()=>{y.current=!0,d(r)},500))},I=()=>{r&&(m(!1),x.current&&(clearTimeout(x.current),x.current=null),!y.current&&l&&l(r),y.current=!1)},g=()=>{m(!1),x.current&&(clearTimeout(x.current),x.current=null),y.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:I,onMouseLeave:g,...f,children:n})};Nn.displayName="MatrixBlockRight";const Un=({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),y=u.useRef(!1),p=()=>{!r||!d||(m(!0),y.current=!1,x.current=setTimeout(()=>{y.current=!0,d(r)},500))},I=()=>{r&&(m(!1),x.current&&(clearTimeout(x.current),x.current=null),!y.current&&l&&l(r),y.current=!1)},g=()=>{m(!1),x.current&&(clearTimeout(x.current),x.current=null),y.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:I,onMouseLeave:g,...f,children:n})};Un.displayName="MatrixBlockUp";const Wn=({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),y=u.useRef(!1),p=()=>{!r||!d||(m(!0),y.current=!1,x.current=setTimeout(()=>{y.current=!0,d(r)},500))},I=()=>{r&&(m(!1),x.current&&(clearTimeout(x.current),x.current=null),!y.current&&l&&l(r),y.current=!1)},g=()=>{m(!1),x.current&&(clearTimeout(x.current),x.current=null),y.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:I,onMouseLeave:g,...f,children:n})};Wn.displayName="MatrixBlockDown";const $n=({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,y]=u.useState(!1),[p,I]=u.useState(!1),g=w=>{f(w),n==null||n(w)},b=w=>{m(w),s==null||s(w)},j=w=>{y(w),o==null||o(w)},S=w=>{I(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)}),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:()=>S(!0),onMouseLeave:()=>S(!1)})]})};$n.displayName="HoverZones";const Pn=({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:y,onUpPrevious:p,onUpNext:I,upCurrentPage:g=1,upTotalPages:b=1,upDisabled:j=!1,upVisible:S=!1,onUpHover:w,onDownPrevious:T,onDownNext:M,downCurrentPage:k=1,downTotalPages:v=1,downDisabled:z=!1,downVisible:R=!1,onDownHover:B,onLeftAdd:E,onRightAdd:W,onUpAdd:H,onDownAdd:$,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(C.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(C.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(C.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(C.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(C.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(C.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(C.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(C.IconPlus,{size:16,stroke:2})}),e.jsx(t.ActionIcon,{size:L,variant:"subtle",onClick:I,disabled:g>=b,color:"gray",radius:"md","aria-label":"Next up blocks",children:e.jsx(C.IconChevronUp,{size:16,stroke:2})})]}),G=()=>v<=1||z?null:e.jsxs(t.Group,{gap:"xs",align:"center",wrap:"nowrap",children:[e.jsx(t.ActionIcon,{size:L,variant:"subtle",onClick:T,disabled:k<=1,color:"gray",radius:"md","aria-label":"Previous down blocks",children:e.jsx(C.IconChevronDown,{size:16,stroke:2})}),e.jsx(t.ActionIcon,{size:L,variant:"subtle",onClick:$,color:"blue",radius:"md","aria-label":"Add down blocks",children:e.jsx(C.IconPlus,{size:16,stroke:2})}),e.jsx(t.ActionIcon,{size:L,variant:"subtle",onClick:M,disabled:k>=v,color:"gray",radius:"md","aria-label":"Next down blocks",children:e.jsx(C.IconChevronUp,{size:16,stroke:2})})]}),O=r>1&&!a,D=h>1&&!m,A=b>1&&!j,U=v>1&&!z;return!O&&!D&&!A&&!U?null:_?e.jsxs(e.Fragment,{children:[O&&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:()=>y==null?void 0:y(!0),onMouseLeave:()=>y==null?void 0:y(!1),children:Z()}),A&&S&&p&&I&&e.jsx("div",{onMouseEnter:()=>w==null?void 0:w(!0),onMouseLeave:()=>w==null?void 0:w(!1),children:F()}),U&&R&&T&&M&&e.jsx("div",{onMouseEnter:()=>B==null?void 0:B(!0),onMouseLeave:()=>B==null?void 0:B(!1),children:G()})]}):e.jsxs(e.Fragment,{children:[O&&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:()=>y==null?void 0:y(!0),onMouseLeave:()=>y==null?void 0:y(!1),children:Z()}),A&&S&&p&&I&&e.jsx(t.Box,{style:{position:"absolute",top:"20px",left:"50%",transform:"translateX(-50%)",zIndex:10,pointerEvents:"auto",opacity:S?1:0,transition:"opacity 0.2s ease"},onMouseEnter:()=>w==null?void 0:w(!0),onMouseLeave:()=>w==null?void 0:w(!1),children:F()}),e.jsx(t.Box,{style:{position:"absolute",bottom:"20px",left:"50%",transform:"translateX(-50%)",zIndex:10,pointerEvents:"auto",opacity:R?1:0,transition:"opacity 0.2s ease"},onMouseEnter:()=>B==null?void 0:B(!0),onMouseLeave:()=>B==null?void 0:B(!1),children:U&&R&&T&&M&&G()})]})};Pn.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(Pn,{...h[n],size:"sm",showLabels:!0,inline:!0})})]})},$o=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)),I=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:I,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:I,upTotalPages:g,downTotalPages:b}=f,j=Math.min(h.leftStartIndex,Math.max(0,s-i)),S=Math.min(j+i,s),w=Math.min(h.rightStartIndex,Math.max(0,o-c)),T=Math.min(w+c,o),M=Math.min(h.upStartIndex,Math.max(0,r-l)),k=Math.min(M+l,r),v=Math.min(h.downStartIndex,Math.max(0,a-d)),z=Math.min(v+d,a);return{leftTotalPages:p,rightTotalPages:I,upTotalPages:g,downTotalPages:b,leftStartIndex:j,leftEndIndex:S,rightStartIndex:w,rightEndIndex:T,upStartIndex:M,upEndIndex:k,downStartIndex:v,downEndIndex:z}},[h,f,i,c,l,d,s,o,r,a]),y={goToLeftPage:u.useCallback(p=>{const I=Math.max(0,(p-1)*i);m(g=>({...g,leftStartIndex:Math.min(I,Math.max(0,s-i))}))},[i,s]),goToRightPage:u.useCallback(p=>{const I=Math.max(0,(p-1)*c);m(g=>({...g,rightStartIndex:Math.min(I,Math.max(0,o-c))}))},[c,o]),goToUpPage:u.useCallback(p=>{const I=Math.max(0,(p-1)*l);m(g=>({...g,upStartIndex:Math.min(I,Math.max(0,r-l))}))},[l,r]),goToDownPage:u.useCallback(p=>{const I=Math.max(0,(p-1)*d);m(g=>({...g,downStartIndex:Math.min(I,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,y,x]},Po=(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:y=8,minBlocksRight:p=1,maxBlocksRight:I=8,minBlocksUp:g=1,maxBlocksUp:b=8,minBlocksDown:j=1,maxBlocksDown:S=8,responsiveCellSize:w=!1,minCellSize:T="30px",maxCellSize:M="80px"}=n,k=parseFloat(d.replace("px","")),v=parseFloat(f.replace("px","")),z=i.width-k*4,R=i.height-k*4,B=v+k,E=Math.floor(z/(2*B)),W=v+k,H=Math.floor(R/W)+2,$=Math.min(E,H),L=Math.max(h,Math.min(m,$)),_=Math.max(x,Math.min(y,Math.floor($/2))),N=Math.max(p,Math.min(I,Math.floor($/2)));let Z=f;if(w){const A=parseFloat(T.replace("px","")),U=parseFloat(M.replace("px","")),V=Math.min(z/(i.width*.8),R/(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,O;if(r>0&&a>0){const A=Math.max(r,a);G=Math.max(g,Math.min(b,A)),O=G}else{const A=Math.max(g,j),U=Math.min(b,S),V=Math.max(A,Math.min(U,Math.ceil(A+(U-A)*F)));G=V,O=V}if(G+O+1>H){const A=Math.max(2,H-1);if(Math.max(g,j)*2>A){const V=Math.max(1,Math.floor(A/2));G=V,O=V}else{const V=Math.max(g,j);G=V,O=V}}return console.log("Responsive Matrix Debug:",{windowSize:i,screenSizeRatio:F,minBlocksUp:g,minBlocksDown:j,maxBlocksUp:b,maxBlocksDown:S,blocksUp:r,blocksDown:a,calculatedBlocksUp:G,calculatedBlocksDown:O,totalVerticalBlocks:G+O+1,isSymmetric:G===O,availableHeight:R,maxBlocksVertical:H}),{blocksPerSide:L,blocksLeft:_,blocksRight:N,cellSize:Z,blocksUp:G,blocksDown:O}},[i,n,s,o,r,a])},Ho=({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:y,maxBlocksLeft:p,minBlocksRight:I,maxBlocksRight:g,minBlocksUp:b,maxBlocksUp:j,minBlocksDown:S,maxBlocksDown:w,responsiveCellSize:T,minCellSize:M,maxCellSize:k})=>{const v=u.useMemo(()=>c!==void 0||l!==void 0||d!==void 0||f!==void 0,[c,l,d,f]),z=Po({gap:n,cellSize:s,minBlocksPerSide:m,maxBlocksPerSide:x,minBlocksLeft:y,maxBlocksLeft:p,minBlocksRight:I,maxBlocksRight:g,minBlocksUp:b,maxBlocksUp:j,minBlocksDown:S,maxBlocksDown:w,responsiveCellSize:T,minCellSize:M,maxCellSize:k},o??0,r??0,a,i),R=u.useMemo(()=>{let H=h?z.blocksLeft:o??0,$=h?z.blocksRight:r??0,L=h?z.blocksUp:a??0,_=h?z.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,O=Z+N,D=Math.floor(F/(2*O)),A=Math.floor(G/(2*O));H=Math.min(H,D),$=Math.min($,D),L=Math.min(L,A),_=Math.min(_,A)}return{left:H,right:$,up:L,down:_}},[h,z,o,r,a,i,n,s]),B=u.useMemo(()=>{const H=v&&c?Math.min(R.left,c):R.left,$=v&&l?Math.min(R.right,l):R.right,L=v&&d?Math.min(R.up,d):R.up,_=v&&f?Math.min(R.down,f):R.down;return{left:H,right:$,up:L,down:_}},[v,R,c,l,d,f]),E=h?z.cellSize:s,W=u.useMemo(()=>{const H=(B.left>0?B.left:0)+1+(B.right>0?B.right:0),$=B.up>0||B.down>0?B.up+1+B.down:1,L=`${E} `.repeat(B.left)+"1fr "+`${E} `.repeat(B.right),_=B.up>0||B.down>0?`${E} `.repeat(B.up)+"1fr "+`${E} `.repeat(B.down):"1fr";return{totalColumns:H,totalRows:$,gridTemplateColumns:L.trim(),gridTemplateRows:_.trim()}},[B,E]);return{usePagination:v,visibleBlocks:R,finalBlocks:B,finalCellSize:E,gridDimensions:W}},Go=({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(", ")}}},_o=({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"}}},Vo=({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,y)=>{f(p=>({...p,[x]:y}))};return{hoverStates:d,handleHover:h,getNavigationControlProps:x=>{const y={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],I={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&&!!y,totalBlocks:y,actions:p,currentPage:I+1,totalPages:g,disabled:!y,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 I=new Map;return s.forEach(g=>{const b=`${g.source}-${g.target}`,j=`${g.target}-${g.source}`;I.set(b,g),I.set(j,g)}),I},[s]),l=u.useCallback(I=>{const g=[];return n.forEach(b=>{if(b.id!==I){const j=`${I}-${b.id}`;c.has(j)&&g.push(b.id)}}),g},[n,c]),d=u.useCallback(I=>{const g=n.find(S=>S.id===I);if(!g)return[];const b=l(I),j=[I];switch(g.type){case"up":b.forEach(S=>{const w=n.find(T=>T.id===S);w&&(w.type==="left"||w.type==="right")&&(j.push(S),l(S).forEach(M=>{const k=n.find(v=>v.id===M);k&&k.type==="down"&&j.push(M)}))});break;case"down":b.forEach(S=>{const w=n.find(T=>T.id===S);w&&(w.type==="left"||w.type==="right")&&(j.push(S),l(S).forEach(M=>{const k=n.find(v=>v.id===M);k&&k.type==="up"&&j.push(M)}))});break;case"left":b.forEach(S=>{const w=n.find(T=>T.id===S);w&&(w.type==="up"||w.type==="down")&&(j.push(S),l(S).forEach(M=>{const k=n.find(v=>v.id===M);k&&k.type==="right"&&j.push(M)}))});break;case"right":b.forEach(S=>{const w=n.find(T=>T.id===S);w&&(w.type==="up"||w.type==="down")&&(j.push(S),l(S).forEach(M=>{const k=n.find(v=>v.id===M);k&&k.type==="left"&&j.push(M)}))});break}return[...new Set(j)]},[n,l]),f=u.useCallback(I=>!0,[]),h=u.useCallback(I=>!a||!o?!1:!d(o).includes(I),[a,o,d]),m=u.useCallback(I=>!a||!o?!1:d(o).includes(I),[a,o,d]),x=u.useCallback(I=>{a&&o===I?(i(!1),r(null)):(r(I),i(!0))},[a,o]),y=u.useCallback(I=>{console.log(`Block clicked: ${I}`)},[]),p=u.useCallback(()=>{i(!1),r(null)},[]);return{selectedBlockId:o,isFiltering:a,isBlockVisible:f,isBlockDimmed:h,shouldShowBlueBorder:m,handleBlockPress:x,handleBlockClick:y,clearFiltering:p,getFilteredBlockIds:d}},an=n=>parseInt(n.replace(/[^\d]/g,""),10)||0,Yo=(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=an(s.cellSize),d=an(s.gap),f=l+d,h=i-d*2,m=c-d*2,x=Math.floor(m*s.verticalMaxPercent/100/f),y=Math.floor(h*s.horizontalMaxPercent/100/f),p=Math.floor(m*s.verticalMinPercent/100/f),I=Math.floor(h*s.horizontalMinPercent/100/f),g=Math.max(s.minVerticalBlocks,p),b=Math.max(s.minHorizontalBlocks,I),j=Math.max(g,x),S=Math.max(b,y),w=Math.floor(j/2),T=Math.floor(j/2),M=Math.floor(S/2),k=Math.floor(S/2);return{blocksUp:w,blocksDown:T,blocksLeft:M,blocksRight:k,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()},qo={verticalMinPercent:20,verticalMaxPercent:50,horizontalMinPercent:30,horizontalMaxPercent:50,minVerticalBlocks:2,minHorizontalBlocks:4,cellSize:"50px",gap:"8px"},Hn=({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:y=[],enableFiltering:p=!1,onBlockClick:I,totalBlocksLeft:g,totalBlocksRight:b,totalBlocksUp:j,totalBlocksDown:S,usePagination:w=!1,responsive:T=!1,minBlocksPerSide:M=2,maxBlocksPerSide:k=15,minBlocksHorizontal:v=2,maxBlocksHorizontal:z=16,minBlocksVertical:R=2,maxBlocksVertical:B=16,minBlocksLeft:E=1,maxBlocksLeft:W=8,minBlocksRight:H=1,maxBlocksRight:$=8,minBlocksUp:L=1,maxBlocksUp:_=8,minBlocksDown:N=1,maxBlocksDown:Z=8,responsiveCellSize:F=!1,minCellSize:G="30px",maxCellSize:O="80px",directionTexts:D,...A})=>{const U=u.useRef(null),V=Yo(U,{...qo,cellSize:r,gap:o,...c});let ne=d,P=f,oe=h,X=m;l?(ne=Math.floor(V.blocksLeft),P=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&&(ne=Math.floor(i/2),P=Math.floor(i/2)));const de=E!==1?E:Math.floor(v/2),Le=W!==8?W:Math.floor(z/2),Fe=H!==1?H:Math.ceil(v/2),re=$!==8?$:Math.ceil(z/2),me=L!==1?L:Math.floor(R/2),we=_!==8?_:Math.floor(B/2),Xn=N!==1?N:Math.ceil(R/2),Kn=Z!==8?Z:Math.ceil(B/2),{usePagination:Jn,finalBlocks:Q,finalCellSize:ae,gridDimensions:Se}=Ho({gap:o,cellSize:r,blocksLeft:ne,blocksRight:P,blocksUp:oe,blocksDown:X,totalBlocksLeft:g,totalBlocksRight:b,totalBlocksUp:j,totalBlocksDown:S,responsive:T,minBlocksPerSide:M,maxBlocksPerSide:k,minBlocksLeft:de,maxBlocksLeft:Le,minBlocksRight:Fe,maxBlocksRight:re,minBlocksUp:me,maxBlocksUp:we,minBlocksDown:Xn,maxBlocksDown:Kn,responsiveCellSize:F,minCellSize:G,maxCellSize:O}),{getBlockContent:ke,getIntersectionText:et}=Go({blockItems:x}),{getConnectionStateFromText:nt}=_o({blockConnections:y}),Y=Qo({blockItems:x,blockConnections:y});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,tt,ot]=$o({totalBlocksLeft:g??0,totalBlocksRight:b??0,totalBlocksUp:j??0,totalBlocksDown:S??0,visibleBlocksLeft:Q.left,visibleBlocksRight:Q.right,visibleBlocksUp:Q.up,visibleBlocksDown:Q.down}),{getNavigationControlProps:ue}=Vo({usePagination:Jn,totalBlocksLeft:g,totalBlocksRight:b,totalBlocksUp:j,totalBlocksDown:S,paginationActions:tt,paginationState:ie,paginationInfo:ot});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},(Ir,te)=>{const Ue=Q.up>0?K===Q.up:K===0,We=te===Q.left;if(Ue&&We)return e.jsxs(An,{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")}),w&&e.jsx($n,{showLeftControls:!!g,showRightControls:!!b,showUpControls:!!j,showDownControls:!!S,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}-${te}`);if(Ue&&te<Q.left){const q=w&&g?ie.leftStartIndex+te:te,J=`left-${q}`;return e.jsx(Fn,{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:I,onBlockPress:p?Y.handleBlockPress:void 0,children:ke("left",q)},`left-${te}`)}if(Ue&&te>Q.left){const q=te-Q.left-1,J=w&&b?ie.rightStartIndex+(Q.right-1-q):Q.right-1-q,ce=`right-${J}`;return e.jsx(Nn,{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:I,onBlockPress:p?Y.handleBlockPress:void 0,children:ke("right",J)},`right-${q}`)}if(We&&K<Q.up){const q=w&&j?ie.upStartIndex+K:K,J=`up-${q}`;return e.jsx(Un,{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:I,onBlockPress:p?Y.handleBlockPress:void 0,children:ke("up",q)},`up-${K}`)}if(We&&K>Q.up){const q=K-Q.up-1,J=w&&S?ie.downStartIndex+q:q,ce=`down-${J}`;return e.jsx(Wn,{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:I,onBlockPress:p?Y.handleBlockPress:void 0,children:ke("down",J)},`down-${q}`)}const $e=te<Q.left?te:null,Ce=te>Q.left?te-Q.left-1:null,Pe=K<Q.up?K:null,He=K>Q.up?K-Q.up-1:null,rt=w&&g&&$e!==null?ie.leftStartIndex+$e:$e,st=w&&b&&Ce!==null?ie.rightStartIndex+(Q.right-1-Ce):Ce!==null?Q.right-1-Ce:null,at=w&&j&&Pe!==null?ie.upStartIndex+Pe:Pe,it=w&&S&&He!==null?ie.downStartIndex+He:He,Ge=et(rt,st,at,it);if(Ge&&Ge.length>0){const q=nt(Ge);return e.jsx(Ln,{size:ae,state:q,interactive:!1},`intersection-${K}-${te}`)}return e.jsx("div",{style:{width:ae,height:ae,minWidth:ae,minHeight:ae}},`empty-${K}-${te}`)})).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"})]})};Hn.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})]})},Zo=({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||"—"})}),Xo=({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})})},Ko=({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||"—"})})},Jo=300,er=({users:n,onSearch:s,debounceSearch:o=!0,debounceDelay:r=Jo})=>{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}},nr=({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(y=>c.includes(y.id)),m=d.filter(y=>!c.includes(y.id)),x=l.filter(y=>!d.some(p=>p.id===y.id));return[...h,...x,...m]},[d,c,l]);return{selectedIds:c,selectedUsers:l,sortedUsers:f}},tr=({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}},or=({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}},rr=({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}},sr=({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}},ar="40px",ir=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=ir,onLoadMore:x,hasMore:y=!1,loading:p=!1})=>{const I=u.useRef(null),g=u.useRef(null),b=u.useRef(null),{searchQuery:j,setSearchQuery:S,displayedUsers:w,setDisplayedUsers:T,isSearching:M}=er({users:a,onSearch:f,debounceSearch:h,debounceDelay:m}),k=t.useCombobox({onDropdownClose:()=>{k.resetSelectedOption(),S(""),z(!1)},onDropdownOpen:()=>{k.updateSelectedOptionIndex("active"),z(!0)}}),{isFocused:v,setIsFocused:z,isHovered:R,handleFocus:B,handleBlur:E,handleMouseEnter:W,handleMouseLeave:H}=rr({combobox:k,dropdownRef:b}),{placement:$,dropdownRefCallback:L}=tr({isFocused:v,dropdownRef:b}),{selectedIds:_,selectedUsers:N,sortedUsers:Z}=nr({value:r,multiple:l,users:a,displayedUsers:w,searchQuery:j,onSearch:f}),{loadMoreRef:F}=or({onLoadMore:x,hasMore:y,loading:p,setDisplayedUsers:T}),{handleSelect:G,handleRemove:O}=sr({multiple:l,value:r,onChange:i,combobox:k}),D=()=>{if(!l)return null;const P=5,oe=N.slice(0,P),X=N.length-P;return e.jsxs(t.Group,{gap:"xs",children:[oe.map(de=>e.jsx(Te,{avatar:de.avatar,name:de.name,withRemoveButton:v,onRemove:()=>O(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(C.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 P=N[0];return P?e.jsx(Te,{avatar:P.avatar,name:P.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||R?"var(--mantine-color-gray-0)":"transparent",border:v?"1px solid var(--mantine-color-gray-2)":"1px solid transparent",borderRadius:v&&$==="bottom"?"var(--mantine-radius-md) var(--mantine-radius-md) 0 0":v&&$==="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&&$==="bottom"?"0 -4px 10px 0 rgba(0, 0, 0, 0.1)":v&&$==="top"?"0 4px 10px 0 rgba(0, 0, 0, 0.1)":"none"}}),ne={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(P=>e.jsx(Te,{avatar:P.avatar,name:P.name,withRemoveButton:v,onRemove:()=>O(P.id)},P.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:V,onFocus:B,onBlur:E,onMouseEnter:()=>!d&&W(),onMouseLeave:H,w:"100%",children:e.jsxs(t.Pill.Group,{styles:ne,children:[l?D():A(),e.jsx(t.Combobox.EventsTarget,{children:e.jsx(t.PillsInput.Field,{ref:I,onFocus:B,onBlur:E,placeholder:N.length===0||v||j.length>0?c:"",value:j,onChange:P=>{k.updateSelectedOptionIndex(),S(P.currentTarget.value)},onMouseDown:P=>{P.stopPropagation()},onKeyDown:P=>{P.key==="Backspace"&&j.length===0&&(P.preventDefault(),l&&N.length>0?O(N[N.length-1].id):!l&&N.length>0&&O(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:$==="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:$==="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(ar),300),scrollbarSize:6,children:e.jsxs(t.Stack,{gap:2,children:[Z.map(P=>{const oe=_.includes(P.id);return e.jsx(t.Combobox.Option,{value:P.id,active:oe,onMouseDown:X=>{X.preventDefault(),G(P.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:P.avatar,size:24,placeholder:P.name,showPlaceholder:!0}),e.jsx(t.Text,{size:"sm",fw:400,truncate:!0,children:P.name}),oe&&e.jsx(C.IconCheck,{size:16,color:"var(--mantine-color-blue-6)"})]})},P.id)}),(M||p)&&e.jsx(t.Box,{style:{padding:"12px",display:"flex",justifyContent:"center"},children:e.jsx(t.Loader,{size:"sm"})}),x&&y&&!p&&e.jsx("div",{ref:F,style:{height:"20px"}}),Z.length===0&&!M&&!p&&e.jsx(t.Box,{style:{padding:"24px",textAlign:"center"},children:e.jsx(t.Text,{size:"sm",c:"dimmed",children:"No users found"})})]})})})})]})})},en=({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,y]=u.useState(!1),[p,I]=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=()=>{y(!0),i==null||i(!0)},j=w=>{y(!1),i==null||i(!1),r==null||r(w.target.value)},S=w=>{const T=w.target.value;if(a){a(T);return}r==null||r(T)};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:S,onFocus:b,onBlur:j,onMouseEnter:()=>I(!0),onMouseLeave:()=>I(!1),placeholder:l,disabled:d,size:"sm",radius:"md",fw:400,minRows:x?1:f,maxRows:h,autosize:m,styles:{...g}})})})},cr=({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:C.IconMaximize,size:"md",onClick:()=>{}})}),e.jsxs(t.Group,{justify:"space-between",gap:"xs",children:[e.jsx(ee,{icon:C.IconStar,size:"md",onClick:()=>{}}),e.jsx(ee,{icon:C.IconDots,size:"md",onClick:()=>{}})]})]}),o]}),Gn=({opened:n,onClose:s,editable:o,content:r,position:a="right",size:i="xl",onMaximize:c,rightCornerActions:l,headerProps:d,propertiesProps:f})=>{var w,T;const[h,m]=u.useState(!1),x=(f==null?void 0:f.hiddenProperties)&&f.hiddenProperties.length>0,[y,p]=u.useState(!1),[I,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 S=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 M={type:"emoji",value:"😊"};g(M),(k=d==null?void 0:d.onAvatarChange)==null||k.call(d,M)},children:e.jsxs(t.Box,{style:{display:"flex",alignItems:"center",justifyContent:"center",gap:6},children:[e.jsx(C.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:C.IconChevronsRight,size:"md",onClick:s}),e.jsx(ee,{icon:C.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:I?e.jsx(Ae,{editable:o,avatar:I,size:"xl",opened:b,onOpen:()=>j(!0),onClose:()=>j(!1),onAvatarSelect:M=>{var k;g(M),(k=d==null?void 0:d.onAvatarChange)==null||k.call(d,M)},onRemove:()=>{g(void 0)}}):e.jsx(t.Box,{h:24,children:y&&S})}),o?e.jsx(be,{value:d.title||"",onChange:M=>{var k;return(k=d.onTitleChange)==null?void 0:k.call(d,M)},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((M,k)=>e.jsx(t.Box,{children:M},k))}),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(C.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:(T=f==null?void 0:f.hiddenProperties)==null?void 0:T.map((M,k)=>e.jsx(t.Box,{children:M},k))})}),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(C.IconChevronUp,{size:16,color:"var(--mantine-color-blue-5)"})]})})}),r]})]})},lr=({children:n})=>e.jsx(t.Box,{style:{minHeight:"100vh",width:"100%",maxWidth:"100%",margin:"0 auto"},id:"full-page",children:n}),_n=u.createContext(void 0),Vn=({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,y]=u.useState(300),[p,I]=u.useState(500),g={opened:s,toggle:o,open:r,close:a,asideOpened:i,toggleAside:c,openAside:l,closeAside:d,sidebarWidth:x,setSidebarWidth:y,asideWidth:p,setAsideWidth:I,openedNotificationSidebar:f,openNotificationSidebar:h,closeNotificationSidebar:m};return e.jsx(_n.Provider,{value:g,children:n})},nn=()=>{const n=u.useContext(_n);if(n===void 0)throw new Error("useAppLayout must be used within an AppLayoutProvider");return n},Qn=({header:n,navbar:s,aside:o,children:r,...a})=>{const{opened:i,asideOpened:c,sidebarWidth:l,asideWidth:d}=nn();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})]})},dr=({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)})}),ur=({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}=nn(),[y,p]=u.useState(s),I=s??y,g=b=>{o==null||o(b),s===void 0&&p(b)};return e.jsx(Qn,{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?C.IconChevronsLeft:C.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(dr,{items:n,selectedId:I,onSelect:g})}),footer:e.jsx(e.Fragment,{})}),aside:e.jsx(t.Box,{p:"md",h:"100%",children:c==null?void 0:c(I)}),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:C.IconChevronsRight,size:"md",variant:"subtle",tooltip:"Open sidebar",onClick:x}),r??e.jsx(ze,{label:I||"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(I)})})]})})},fr=n=>e.jsx(Vn,{children:e.jsx(ur,{...n})}),tn=(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(y=>c.includes(y.id)),d=l.map(y=>y.id),f=c.filter(y=>!d.includes(y)),m=[...s.members,...n.users].filter(y=>f.includes(y.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}},hr=({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:y,handleMembersChange:p}=tn(f,h),I=u.useMemo(()=>[e.jsx(en,{label:"Description",icon:C.IconAlignLeft,value:m.description,onChange:m.onDescriptionChange,editable:r},"description"),e.jsx(pe,{editable:!1,label:"Team Owner",icon:C.IconUserCircle,value:d.id,users:[d]},"owner"),e.jsx(pe,{multiple:!1,editable:r,label:"Team Leader",icon:C.IconUser,value:f.userIds.length>0?f.userIds[0]:void 0,users:f.users,onChange:y,onSearch:f.handleSearch,onLoadMore:f.handleLoadMore,hasMore:f.hasMore},"leader"),e.jsx(pe,{multiple:!0,editable:r,label:"Team Members",icon:C.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,y,h.handleLoadMore,h.handleSearch,h.hasMore,h.members,x,p]);return e.jsx(Gn,{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:I}})},Yn=({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,y]=u.useState(!1),p=s?"0":{base:"1rem",sm:"2rem",md:"4rem",lg:"8rem",xl:"10rem"},[I,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:I?C.IconChevronsRight:C.IconMenu2,size:"md",color:"gray",changeIconOnHover:!0,iconHovered:I?C.IconMenu2:C.IconChevronsRight,variant:"subtle",onClick:b,"aria-pressed":I}),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:()=>y(!0),onMouseLeave:()=>y(!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 S;f(j),(S=a==null?void 0:a.onAvatarChange)==null||S.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 S;const j={type:"emoji",value:"😊"};f(j),(S=a==null?void 0:a.onAvatarChange)==null||S.call(a,j)},children:e.jsxs(t.Box,{style:{display:"flex",alignItems:"center",justifyContent:"center",gap:6},children:[e.jsx(C.IconMoodSmileFilled,{size:16}),e.jsx(t.Text,{size:"sm",fw:500,children:"Add avatar"})]})})})}),e.jsx(t.Box,{children:o?e.jsx(mn,{value:a.title||"",onChange:j=>{var S;return(S=a.onTitleChange)==null?void 0:S.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]})})]})},qn=({editable:n,owner:s,descriptionProps:o,responsibleProps:r,membersProps:a})=>{const{availableMembersUsers:i,handleResponsibleChange:c,handleMembersChange:l}=tn(r,a);return e.jsxs(t.Stack,{gap:"sm",children:[e.jsx(en,{label:"Description",icon:C.IconAlignLeft,value:o.description,onChange:o.onDescriptionChange,editable:n},"description"),e.jsx(pe,{editable:!1,label:"Team Owner",icon:C.IconUserCircle,value:s.id,users:[s]},"owner"),e.jsx(pe,{multiple:!1,editable:n,label:"Team Leader",icon:C.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:C.IconUsers,value:a.members.map(d=>d.id),users:i,onChange:l,onSearch:a.handleSearch,onLoadMore:a.handleLoadMore,hasMore:a.hasMore},"members")]})},xr=({editable:n,headerProps:s,rightNavigation:o,properties:r,children:a,footer:i})=>e.jsx(Yn,{isSidebarOpen:!0,editable:n,rightNavigation:o,headerProps:s,properties:e.jsx(qn,{...r}),children:a,footer:i}),pr=({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})]}),mr=({opened:n,onClose:s,position:o,size:r,onMaximize:a,editable:i,rightNavigation:c,headerProps:l,properties:d,children:f,footer:h})=>{var S,w;const[m,x]=u.useState(l==null?void 0:l.avatar),[y,p]=u.useState(!1),[I,g]=u.useState(!1);u.useEffect(()=>{x(l==null?void 0:l.avatar)},[l==null?void 0:l.avatar]);const b=(S=l==null?void 0:l.loading)==null?void 0:S.avatar,j=(w=l==null?void 0:l.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:C.IconChevronsRight,onClick:s}),e.jsx(fe,{icon:C.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:y,onOpen:()=>p(!0),onClose:()=>p(!1),onAvatarSelect:T=>{var M;x(T),(M=l==null?void 0:l.onAvatarChange)==null||M.call(l,T)},onRemove:()=>{x(void 0)}}):e.jsx(t.Box,{h:24,children:I&&e.jsx(t.Button,{size:"xs",radius:"md",w:"fit-content",variant:"subtle",px:"var(--mantine-spacing-sm)",color:"gray",mb:"md",onClick:()=>{var M;const T={type:"emoji",value:"😊"};x(T),(M=l==null?void 0:l.onAvatarChange)==null||M.call(l,T)},children:e.jsxs(t.Box,{style:{display:"flex",alignItems:"center",justifyContent:"center",gap:6},children:[e.jsx(C.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:T=>{var M;return(M=l.onTitleChange)==null?void 0:M.call(l,T)},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]})})]})})},Zn=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 gr({children:n,theme:s}){return e.jsxs(t.MantineProvider,{theme:s||Zn,children:[e.jsx(xt.Notifications,{}),e.jsx(pt.ModalsProvider,{children:e.jsx(mt.DatesProvider,{settings:{firstDayOfWeek:0},children:n})})]})}exports.ActionButton=ee;exports.ActionIcon=fe;exports.AppLayout=Qn;exports.AppLayoutProvider=Vn;exports.AvatarSelector=Ae;exports.BaseLayout=pr;exports.BoxAvatar=se;exports.CenterPeek=cr;exports.DocsTemplate=fr;exports.EditableText=be;exports.EditableTextarea=mn;exports.EmojiAvatar=ln;exports.ExpandableSearch=gn;exports.FilterDropdown=Bt;exports.FilterDropdownButton=Re;exports.FilterDropdownFilters=De;exports.FloatingIndicator=Ut;exports.FloatingIndicatorContent=Ke;exports.FloatingIndicatorProvider=Ze;exports.FloatingIndicatorTriggers=Xe;exports.FullPage=lr;exports.GenericTable=vn;exports.IconAvatar=fn;exports.ImageAvatar=hn;exports.InvitedUserCard=je;exports.LinkProperty=Xo;exports.Logo=pn;exports.Matrix=Hn;exports.Menu=ve;exports.ModalSettings=ko;exports.NavButton=Je;exports.NavLink=Qe;exports.Navbar=Ye;exports.NavbarProvider=Eo;exports.NotificationSidebar=Do;exports.NumberProperty=Ko;exports.PageLayout=Yn;exports.PageProperty=he;exports.PlaceholderAvatar=Oe;exports.PopoverItem=yn;exports.PopoverSelector=Ee;exports.SelectUserProperty=pe;exports.ShareButton=wo;exports.ShareMenu=Rn;exports.ShareModal=So;exports.SidePeek=Gn;exports.SidePeekLayout=mr;exports.TeamPage=xr;exports.TeamProperties=qn;exports.TeamSidePeek=hr;exports.TextButton=ze;exports.TextProperty=Zo;exports.TextareaProperty=en;exports.ThemeProvider=gr;exports.UserChip=Te;exports.WorkspaceSelector=Wo;exports.WorkspaceSelectorItem=En;exports.getInitialsFromName=xn;exports.theme=Zn;exports.useAppLayout=nn;exports.useFloatingIndicator=Nt;exports.useNavbar=Ao;exports.useTeamProperties=tn;
|