obeyaka-ui 0.1.15 → 0.1.16
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
CHANGED
|
@@ -1790,8 +1790,8 @@ const zr = (n) => {
|
|
|
1790
1790
|
{
|
|
1791
1791
|
ta: "left",
|
|
1792
1792
|
size: "sm",
|
|
1793
|
-
fw:
|
|
1794
|
-
c:
|
|
1793
|
+
fw: 600,
|
|
1794
|
+
c: "var(--mantine-color-gray-8)",
|
|
1795
1795
|
truncate: !0,
|
|
1796
1796
|
style: { flex: 1, opacity: s ? 0.5 : 1 },
|
|
1797
1797
|
children: n
|
|
@@ -5824,7 +5824,14 @@ const fo = ({
|
|
|
5824
5824
|
tt,
|
|
5825
5825
|
{
|
|
5826
5826
|
isActive: M,
|
|
5827
|
-
icon: /* @__PURE__ */ e(
|
|
5827
|
+
icon: /* @__PURE__ */ e(
|
|
5828
|
+
sr,
|
|
5829
|
+
{
|
|
5830
|
+
strokeWidth: 2,
|
|
5831
|
+
size: 20,
|
|
5832
|
+
color: "var(--mantine-color-gray-7)"
|
|
5833
|
+
}
|
|
5834
|
+
),
|
|
5828
5835
|
onClick: () => {
|
|
5829
5836
|
I ? p() : f();
|
|
5830
5837
|
},
|
package/dist/index.js
CHANGED
|
@@ -15,4 +15,4 @@
|
|
|
15
15
|
from { width: 200px; opacity: 1; }
|
|
16
16
|
to { width: 0; opacity: 0; }
|
|
17
17
|
}
|
|
18
|
-
`})]})},Ce=({activeFilters:n,onFiltersChange:r,availableFilters:o,size:s="md",filterButtonDropdownPosition:c="bottom-end"})=>{const i=t.useCombobox({onDropdownClose:()=>i.resetSelectedOption(),onDropdownOpen:()=>i.updateSelectedOptionIndex("active")}),[a,d]=u.useState(!1),l=n.length>0,f=m=>{if(m==="remove-filters")r([]);else{const I=o==null?void 0:o.find(b=>b.value===m);if(I){const b={id:`${I.value}-${Date.now()}`,filterOption:I};r([...n,b])}}i.closeDropdown()},h=(o||[]).filter(m=>!n.some(I=>I.filterOption.value===m.value)),g={borderRadius:"var(--mantine-radius-md)",fontSize:"var(--mantine-font-size-sm)",color:"var(--mantine-color-gray-7)",fontWeight:"500"},y=(()=>{switch(s){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:l||a?"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:()=>d(!0),onMouseLeave:()=>d(!1),onClick:()=>i.toggleDropdown(),children:e.jsx(M.IconFilter,{size:20,stroke:2.3})});return e.jsxs(t.Combobox,{store:i,onOptionSubmit:f,withinPortal:!1,offset:4,position:c,children:[e.jsx(t.Combobox.Target,{children:l?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(m=>e.jsx(t.Combobox.Option,{value:m.value,style:{...g},children:e.jsxs(t.Box,{style:{display:"flex",alignItems:"center",gap:"8px"},children:[m.icon,m.label]})},m.value)),l&&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(M.IconFilterOff,{size:16,stroke:2}),"Remove filters"]})})]})})]})},xt=({filterTag:n,onUpdate:r,onRemove:o,options:s=[],filterTagDropdownPosition:c="bottom-start"})=>{var x;const i=t.useCombobox({onDropdownClose:()=>i.resetSelectedOption(),onDropdownOpen:()=>i.updateSelectedOptionIndex("active")}),a=!!n.selectedOption,d=a?`${n.filterOption.label}: ${(x=n.selectedOption)==null?void 0:x.label}`:n.filterOption.label,l=s&&s.length>0?s:[{value:"option-a",label:"TagFilterOptionA"},{value:"option-b",label:"TagFilterOptionB"},{value:"option-c",label:"TagFilterOptionC"}],f=y=>{if(y==="remove")o();else{const p=l.find(m=>m.value===y);p&&r({...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"},g={display:"inline-flex",alignItems:"center",gap:"4px",backgroundColor:a?"var(--mantine-color-blue-0)":"var(--mantine-color-gray-0)",color:a?"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:c,middlewares:{flip:!1,shift:!0},children:[e.jsx(t.Combobox.Target,{children:e.jsxs(t.Box,{style:{...g},onClick:()=>i.toggleDropdown(),fw:500,pl:"sm",children:[e.jsxs(t.Box,{style:{display:"flex",alignItems:"center",gap:"4px"},children:[n.filterOption.icon,d]}),e.jsx(M.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:[l.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:r,availableFilters:o,addFilterButtonDropdownPosition:s="bottom-start"})=>{const c=t.useCombobox({onDropdownClose:()=>c.resetSelectedOption(),onDropdownOpen:()=>c.updateSelectedOptionIndex("active")}),[i,a]=u.useState(!1),d=x=>{const y=o==null?void 0:o.find(p=>p.value===x);if(y){const p={id:`${y.value}-${Date.now()}`,filterOption:y};r([...n,p])}c.closeDropdown()},l=(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"}},g={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:c,onOptionSubmit:d,withinPortal:!1,offset:4,position:s,children:[e.jsx(t.Combobox.Target,{children:e.jsx(t.Box,{style:{...f},onMouseEnter:()=>a(!0),onMouseLeave:()=>a(!1),onClick:()=>c.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:l.map(x=>e.jsx(t.Combobox.Option,{value:x.value,style:{...g},children:e.jsxs(t.Box,{style:{display:"flex",alignItems:"center",gap:"8px"},children:[x.icon,x.label]})},x.value))})})]})},Me=({activeFilters:n,onFiltersChange:r,availableFilters:o,size:s="sm",getFilterOptions:c,filterTagDropdownPosition:i="bottom-start"})=>{const a=f=>{const h=(n||[]).map(g=>g.id===f.id?f:g);r(h)},d=f=>{const h=(n||[]).filter(g=>g.id!==f);r(h)},l=(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=c?c(f.filterOption.value)||[]:[];return e.jsx(xt,{filterTag:f,onUpdate:a,onRemove:()=>d(f.id),size:s,options:h,filterTagDropdownPosition:i},f.id)}),l.length>0&&e.jsx(mt,{activeFilters:n,onFiltersChange:r,availableFilters:l,size:s})]})})},gt=({activeFilters:n,onFiltersChange:r,availableFilters:o,size:s="md",getFilterOptions:c,filterTagDropdownPosition:i="bottom-start"})=>e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"12px"},children:[e.jsx(Ce,{activeFilters:n,onFiltersChange:r,availableFilters:o,size:s}),e.jsx(Me,{activeFilters:n,onFiltersChange:r,availableFilters:o,size:"sm",getFilterOptions:c,filterTagDropdownPosition:i})]}),It=Object.assign(gt,{Button:Ce,Filters:Me}),yt=({children:n,danger:r,active:o,...s})=>e.jsx(t.MenuItem,{...s,style:{borderRadius:"8px",color:o?"var(--mantine-color-blue-7)":r?"var(--mantine-color-red-9)":"var(--mantine-color-gray-9)",backgroundColor:o?"var(--mantine-color-blue-0)":"transparent",...s.style},children:n}),me=({trigger:n,menuItems:r,children:o,...s})=>{const c=u.useRef(null),[i,a]=u.useState(0);return u.useEffect(()=>{c.current&&a(c.current.offsetWidth)},[n]),e.jsxs(t.Menu,{...s,children:[e.jsx(t.Menu.Target,{children:e.jsx("div",{ref:c,onClick:d=>d.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,r==null?void 0:r.map((d,l)=>e.jsx(yt,{...d},l))]})]})},Ge=({label:n,icon:r,onClick:o,color:s="gray",disabled:c=!1,"aria-label":i,indicator:a,fullWidth:d,isActive:l=!1,...f})=>{const[h,g]=u.useState(!1),x=()=>{c||o==null||o()};return e.jsx(t.Box,{style:{cursor:c?"not-allowed":"pointer",borderRadius:"var(--mantine-radius-md)"},variant:"transparent",justify:"flex-start",display:"flex",color:s,radius:"md",w:d?"100%":"auto",px:6,h:40,onMouseEnter:()=>!c&&g(!0),onMouseLeave:()=>g(!1),onClick:x,bg:h||l?"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:[r,e.jsx(t.Text,{ta:"left",size:"sm",fw:500,c:h?"gray.8":"gray.7",truncate:!0,style:{flex:1,opacity:c?.5:1},children:n}),a&&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:a})]})})},We=({label:n,rightLabel:r,children:o,onAddChild:s,onMenuAction:c,menuItems:i,color:a="gray",defaultText:d="No items",level:l=0,disabled:f=!1,noChild:h=!1,isActive:g=!1,showAvatar:x=!1,avatar:y,placeholder:p,onClick:m,"aria-label":I,...b})=>{const[j,S]=u.useState(!1),[w,O]=u.useState(!1),[C,k]=u.useState(!1),v=u.Children.count(o)>0,R=C?M.IconChevronDown:M.IconChevronRight,D=!h&&v&&(x?w:!0),B=u.useCallback($=>{f||(console.log("NavLink clicked",{hasChildren:v,noChild:h,isExpanded:j}),v&&!h&&(console.log("Toggling expansion"),S(!j)),m==null||m())},[m,f,v,h,j]),E=u.useCallback($=>{$.stopPropagation(),!f&&(s==null||s())},[s,f]),N=u.useCallback(()=>{f||(v&&!h&&S(!j),m==null||m())},[f,v,h,j,m]),H=u.useCallback(()=>{f||s==null||s()},[s,f]),F=u.useCallback($=>{f||c==null||c($)},[c,f,n]),P=u.useCallback(()=>v?u.Children.map(o,$=>u.isValidElement($)?u.cloneElement($,{...$.props,level:l+1}):$):null,[o,v,l]),V=(i==null?void 0:i.map($=>({children:e.jsxs(t.Group,{gap:"xs",wrap:"nowrap",children:[$.icon&&e.jsx($.icon,{size:16}),e.jsx(t.Text,{size:"sm",children:$.label})]}),onClick:()=>F($.action)})))||[],U=[{children:e.jsxs(t.Group,{gap:"xs",wrap:"nowrap",children:[e.jsx(M.IconPlus,{size:16}),e.jsx(t.Text,{size:"sm",children:"Add child"})]}),onClick:E}],G=V.length>0?V:U;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:a,size:"md",radius:"md",w:"100%",px:6,h:40,onMouseEnter:()=>!f&&O(!0),onMouseLeave:()=>O(!1),onClick:B,bg:g||w?"var(--mantine-color-gray-1)":"transparent","aria-expanded":j,"aria-label":I||`${n} navigation link`,...b,children:e.jsxs(t.Group,{w:"100%",wrap:"nowrap",gap:8,onClick:B,style:{paddingLeft:h&&!D?`${(l+1)*16}px`:l>0?`${l*16}px`:"0px"},children:[D?e.jsx(K,{icon:R,size:"md",color:a,onClick:N,disabled:f,onMouseEnter:()=>k(!0),onMouseLeave:()=>k(!1),"aria-label":v?`${j?"Collapse":"Expand"} ${n}`:void 0}):x?e.jsx(se,{size:"xs",avatar:y,showPlaceholder:!0,placeholder:p}):null,e.jsx(t.Text,{size:"sm",fw:500,c:g?"black":w?"gray.9":"gray.8",truncate:!0,w:"100%",style:{opacity:f?.5:1},children:n}),e.jsxs(t.Group,{gap:"xs",align:"center",children:[r&&e.jsx(t.Text,{size:"xs",c:"dimmed",children:r}),w&&!f&&e.jsxs(t.Group,{gap:4,wrap:"nowrap",children:[s&&e.jsx(K,{icon:M.IconPlus,onClick:H,"aria-label":`Add child to ${n}`}),(i&&i.length>0||s)&&e.jsx("div",{onClick:$=>$.stopPropagation(),children:e.jsx(me,{menuItems:G,trigger:e.jsx(K,{icon:M.IconDots,"aria-label":`More options for ${n}`,size:"md"}),position:"bottom-end",shadow:"md"})})]})]})]})}),j&&!h&&e.jsx(t.Stack,{gap:0,style:{width:"100%"},children:v?P():e.jsx(t.Box,{style:{marginLeft:l>0?`${l*16}px`:"0px"},children:e.jsx(t.Text,{size:"sm",c:"dimmed",ta:"left",p:"sm",fw:500,children:d})})})]})},vt="userChip-module__pill___DgFME",jt={pill:vt},we=({avatar:n,name:r,withRemoveButton:o=!1,onRemove:s})=>e.jsx(t.Pill,{withRemoveButton:o,onRemove:s,radius:"md",p:"0px",size:"md",className:jt.pill,bg:"transparent",children:e.jsxs(t.Group,{gap:4,wrap:"nowrap",style:{alignItems:"center"},children:[e.jsx(se,{avatar:n,size:24,placeholder:r,showPlaceholder:!0}),e.jsx(t.Text,{size:"sm",fw:450,c:"var(--mantine-color-gray-9)",children:r})]})}),bt="200px",wt="4px 8px",St=40,kt="var(--mantine-radius-md)",Ct=16,an=({item:n,withAvatars:r,disabled:o=!1,onClick:s,selected:c=!1})=>{const[i,a]=u.useState(!1);return e.jsx(t.Box,{onMouseEnter:()=>!o&&a(!0),onMouseLeave:()=>!o&&a(!1),onClick:d=>{d.preventDefault(),d.stopPropagation(),o||s==null||s(n.value)},onMouseDown:d=>{d.stopPropagation()},style:{minWidth:bt,backgroundColor:o?"transparent":i?"var(--mantine-color-gray-1)":"transparent",cursor:o?"default":"pointer",borderRadius:kt,padding:wt,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:St,children:[r&&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})]}),c&&e.jsx(M.IconCheck,{size:Ct,color:"var(--mantine-color-gray-9)"})]})})},Mt="bottom-end",Tt=1e4,Ot="24px",Bt="0 8px",zt="6px",Qe="var(--mantine-radius-md)",Rt="46px",Te=({value:n,onChange:r,data:o,withRemove:s=!1,withAvatars:c=!1,onRemove:i,disabledOptions:a=[],disabled:d=!1,defaultOption:l,popoverStyles:f,dropdownStyles:h,triggerStyles:g,textStyles:x})=>{const[y,p]=u.useState(!1),m=(o||[]).find(v=>v.value===n)||l,[I,b]=u.useState(!1),[j,S]=u.useState(!1),[w,O]=u.useState(!1),C=s?e.jsx(t.Group,{p:"sm",onClick:v=>{v.stopPropagation(),i==null||i(n)},style:{cursor:"pointer",height:Rt,display:"flex",alignItems:"center",borderRadius:Qe,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:()=>!d&&b(!0),onMouseLeave:()=>!d&&b(!1),onClick:()=>{d||(p(!0),O(!0))},style:{height:Ot,cursor:d?"not-allowed":"pointer",display:"inline-flex",alignItems:"center",borderRadius:Qe,backgroundColor:d?"transparent":I||w?"var(--mantine-color-gray-1)":"transparent",transition:"background-color 0.2s ease",padding:Bt,gap:zt,width:"auto",opacity:d?.6:1,...g},children:[e.jsx(t.Text,{size:"sm",fw:x!=null&&x.fontWeight?void 0:500,c:d?"var(--mantine-color-gray-4)":"var(--mantine-color-gray-6)",style:{color:d?"var(--mantine-color-gray-4)":"var(--mantine-color-gray-6)",lineHeight:"24px",whiteSpace:"nowrap",...x},children:(m==null?void 0:m.label)||"Select option"}),e.jsx(M.IconChevronDown,{size:16,style:{color:d?"var(--mantine-color-gray-3)":"var(--mantine-color-gray-6)"}})]});return e.jsxs(t.Popover,{opened:y,onChange:v=>{p(v),v||O(!1)},position:Mt,shadow:"md",withinPortal:!0,zIndex:Tt,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 R=a.includes(v.value),D=v.value===n;return e.jsx(an,{item:v,withAvatars:c,disabled:R,selected:D,onClick:B=>{r==null||r(B),p(!1),O(!1)}},v.value)}),C]})})]})},Dt=(n,r,o,s)=>{const c=u.useRef(null),i=u.useRef(null),a=u.useCallback(l=>{l[0].isIntersecting&&o&&!s&&r&&r()},[o,s,r]),d=u.useCallback(()=>{if(!(!c.current||!n||!r)){i.current&&(i.current.disconnect(),i.current=null);try{const l=new IntersectionObserver(a,{threshold:.1,rootMargin:"50px"});l.observe(c.current),i.current=l}catch(l){console.error("Failed to setup intersection observer:",l)}}},[n,r,a]);return u.useEffect(()=>(d(),()=>{i.current&&(i.current.disconnect(),i.current=null)}),[d]),u.useEffect(()=>()=>{i.current&&(i.current.disconnect(),i.current=null)},[]),{loadMoreRef:c}},cn=({tableName:n,data:r,columns:o,onAddItem:s,addItemComponent:c,addItemLabel:i="Add item",loading:a=!1,emptyMessage:d="No data found",searchPlaceholder:l="Search...",enableAutoFilters:f=!0,customFilters:h=[],onCustomFilter:g,onSort:x,sortColumn:y,sortDirection:p,onSearch:m,onRowClick:I,size:b="md",striped:j=!1,highlightOnHover:S=!0,enableInfiniteScroll:w=!1,isLoadingMore:O=!1,hasMore:C=!1,onLoadMore:k})=>{const[v,R]=u.useState(""),[D,B]=u.useState([]),{loadMoreRef:E}=Dt(w,k||(()=>{}),C,O),N=u.useMemo(()=>[...f?o.filter(z=>z.type==="select"&&z.options).map(z=>({value:z.key,label:z.label})):[],...h],[o,f,h]),H=u.useMemo(()=>{let T=r||[];if(v){const z=v.toLowerCase();T=T.filter(A=>o.some(L=>{if(!L.searchable)return!1;const _=A[L.key];return _==null?!1:String(_).toLowerCase().includes(z)}))}return D.forEach(z=>{if(z.filterTag.selectedOption){const A=o.find(L=>L.key===z.filterTag.filterOption.value);A&&(T=T.filter(L=>{var ne;const _=L[A.key];return String(_)===((ne=z.filterTag.selectedOption)==null?void 0:ne.value)}))}}),T},[r,v,D,o]),F=T=>{R(T),m==null||m(T)},P=T=>{const z=o.find(L=>L.key===T);if(!(z!=null&&z.sortable))return;const A=y===T&&p==="asc"?"desc":"asc";x==null||x(T,A)},V=T=>{const z=o.find(A=>A.key===T);return(z==null?void 0:z.type)==="select"&&z.options?z.options.map(A=>({value:A.value,label:A.label})):(z==null?void 0:z.type)==="badge"?[...new Set(r.map(L=>L[z.key]).filter(Boolean))].map(L=>({value:String(L),label:String(L).charAt(0).toUpperCase()+String(L).slice(1)})):z?[...new Set(r.map(L=>L[z.key]).filter(Boolean))].map(L=>({value:String(L),label:String(L).charAt(0).toUpperCase()+String(L).slice(1)})):[]},U=(T,z)=>{var L,_,ne,W,oe;const A=z[T.key];switch(T.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=T.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 T.options?e.jsx(Te,{value:A,data:T.options,placeholder:T.label,onChange:re=>{var he;return(he=T.onSelectChange)==null?void 0:he.call(T,re,z)},disabled:(L=T.disabled)==null?void 0:L.call(T,z)}):e.jsx(t.Text,{size:"sm",c:"dimmed",children:"—"});case"badge":const Oe=((_=T.badgeColors)==null?void 0:_[A])||"gray";return e.jsx(t.Badge,{color:Oe,variant:"light",size:"sm",radius:"md",fw:600,children:A||"Unknown"});case"avatar":const Be=((ne=T.fallbackText)==null?void 0:ne.call(T,z))||String(A).charAt(0).toUpperCase();return e.jsx(se,{avatar:A,size:"xs",placeholder:Be,showPlaceholder:!0});case"custom":return((W=T.render)==null?void 0:W.call(T,A,z))||e.jsx(t.Text,{size:"sm",c:"dimmed",children:"—"});case"actions":return(oe=T.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(M.IconDots,{size:16})})}),e.jsx(t.Menu.Dropdown,{children:T.actions.map((re,he)=>{var Ie;return e.jsx(t.Menu.Item,{color:re.color,leftSection:re.icon,disabled:(Ie=re.disabled)==null?void 0:Ie.call(re,z),onClick:()=>re.onClick(z),styles:{item:{borderRadius:"var(--mantine-radius-md)"}},children:re.label},he)})})]}):null;default:return e.jsx(t.Text,{size:"sm",c:"dimmed",children:"—"})}},G=T=>{var z;return(z=o.find(A=>A.key===T))!=null&&z.sortable?y===T?p==="asc"?e.jsx(M.IconChevronUp,{size:14}):e.jsx(M.IconChevronDown,{size:14}):e.jsx(M.IconChevronUp,{size:14,style:{opacity:.3}}):null},Q=(()=>{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:a}),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(sn,{placeholder:l,value:v,onChange:F,onSearch:F,expandDirection:"right",size:Q.buttonSize}),N.length>0&&e.jsx(Ce,{activeFilters:D.map(T=>T.filterTag),onFiltersChange:T=>{B(T.map(z=>({filterTag:z,onUpdate:()=>{},onRemove:()=>{}}))),g==null||g(T)},availableFilters:N,size:Q.buttonSize})]}),s&&e.jsx(t.Button,{size:"compact-md",h:32,style:{fontSize:`var(--mantine-font-size-${Q.textSize})`,border:"none"},radius:"md",onClick:s,children:i})]})]}),N.length>0&&e.jsx(Me,{activeFilters:D.map(T=>T.filterTag),onFiltersChange:T=>{B(T.map(z=>({filterTag:z,onUpdate:()=>{},onRemove:()=>{}}))),g==null||g(T)},availableFilters:N,size:"md",getFilterOptions:V})]}),c,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(T=>e.jsx(t.Table.Th,{c:"var(--mantine-color-gray-6)",style:{width:T.width,textAlign:T.align||"left",cursor:T.sortable?"pointer":"default"},onClick:()=>T.sortable&&P(T.key),children:e.jsxs(t.Group,{gap:"xs",wrap:"nowrap",children:[T.icon&&e.jsx(t.Box,{style:{display:"flex",alignItems:"center"},children:T.icon}),e.jsx(t.Text,{size:Q.textSize,fw:500,children:T.label}),G(T.key)]})},String(T.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:d})})}):H.map((T,z)=>e.jsx(t.Table.Tr,{style:{cursor:I?"pointer":"default"},onClick:()=>I==null?void 0:I(T),children:o.map(A=>e.jsx(t.Table.Td,{style:{textAlign:A.align||"left"},children:U(A,T)},String(A.key)))},T.id||z))})]}),w&&e.jsx(t.Box,{ref:E,style:{padding:"16px",display:"flex",justifyContent:"center",alignItems:"center",minHeight:"60px"},children:O&&e.jsxs(t.Group,{display:"flex",ta:"center",gap:"xs",children:[e.jsx(t.Loader,{size:"sm",color:"gray.5"}),e.jsx(t.Text,{size:"sm",c:"dimmed",fw:500,children:"Loading more..."})]})})]})};Object.assign(cn,{});const Et=({onAvatarSelect:n,onEmojiSelect:r,onImageSelect:o,onIconSelect:s}={})=>{const[c,i]=u.useState("emoji"),[a,d]=u.useState(null),[l,f]=u.useState(null),[h,g]=u.useState(null),[x,y]=u.useState(null),[p,m]=u.useState(null),I=u.useCallback(v=>{i(v)},[]),b=u.useCallback(v=>{d(v)},[]),j=u.useCallback(v=>{m(v);const R=new FileReader;R.onload=D=>{var E;const B=(E=D.target)==null?void 0:E.result;f(B)},R.readAsDataURL(v)},[]),S=u.useCallback(v=>{g(v),f(null),m(null),y(null),n==null||n({type:"emoji",value:v}),r==null||r(v)},[n,r]),w=u.useCallback(v=>{y(v),f(null),m(null),g(null),n==null||n({type:"icon",value:v}),s==null||s(v)},[n,s]),O=u.useCallback(()=>{if(p&&l){const v=URL.createObjectURL(p);n==null||n({type:"image",value:v}),o==null||o(p)}},[p,l,n,o]),C=u.useCallback(()=>{f(null),m(null),g(null),y(null)},[]),k=u.useCallback(()=>{f(null),g(null),y(null),m(null),i("emoji"),d(null)},[]);return{selectedTab:c,tabHovered:a,previewImage:l,selectedEmoji:h,selectedIcon:x,selectedFile:p,handleTabChange:I,handleTabHover:b,handleImagePreview:j,handleImageAccept:O,handleEmojiSelect:S,handleIconSelect:w,clearImagePreview:C,resetState:k}},At=({opened:n,onClose:r,popoverRef:o})=>{const s=u.useCallback(i=>{n&&o.current&&!o.current.contains(i.target)&&(console.log("Click outside detected, closing popover"),r())},[n,r,o]),c=u.useCallback(i=>{i.key==="Escape"&&n&&(console.log("Escape key pressed, closing popover"),r())},[n,r]);return u.useEffect(()=>{if(n)return document.addEventListener("mousedown",s),document.addEventListener("keydown",c),()=>{document.removeEventListener("mousedown",s),document.removeEventListener("keydown",c)}},[n,s,c]),{handleClickOutside:s,handleEscape:c}},Pt=({selectedTab:n,tabHovered:r,onTabChange:o,onTabHover:s,onRemove:c,hasAvatar:i=!1,children:a})=>{const[d,l]=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:()=>s("emoji"),onMouseLeave:()=>s(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:r==="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:()=>s("icons"),onMouseLeave:()=>s(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:r==="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:()=>s("image"),onMouseLeave:()=>s(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:r==="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"})})}),c&&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:d?"var(--mantine-color-red-0)":"transparent",color:d?"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:c,onMouseEnter:()=>l(!0),onMouseLeave:()=>l(!1),children:"Remove"})})]}),e.jsx(t.Tabs.Panel,{value:"emoji",children:n==="emoji"?a:null}),e.jsx(t.Tabs.Panel,{value:"icons",children:n==="icons"?a:null}),e.jsx(t.Tabs.Panel,{value:"image",children:n==="image"?a:null})]})};let Ye=!1;Ye||(Ze.init({data:Se}),Ye=!0);const Lt=()=>{const n=[{id:"frequent",name:"Frequently Used",icon:e.jsx(M.IconClock,{size:20,strokeWidth:2.5})}];return Se.categories.forEach(r=>{if(r.emojis&&r.emojis.length>0){let o=e.jsx(M.IconMoodSmile,{size:20,strokeWidth:2}),s=r.name;switch(r.id){case"people":o=e.jsx(M.IconMoodSmile,{size:20,strokeWidth:2}),s="Smileys & People";break;case"nature":o=e.jsx(M.IconTrees,{size:20,strokeWidth:2}),s="Animals & Nature";break;case"foods":o=e.jsx(M.IconApple,{size:20,strokeWidth:2}),s="Food & Drink";break;case"activity":o=e.jsx(M.IconBallBasketball,{size:20,strokeWidth:2}),s="Activities";break;case"travel":o=e.jsx(M.IconPlane,{size:20,strokeWidth:2}),s="Travel & Places";break;case"places":o=e.jsx(M.IconPlane,{size:20,strokeWidth:2}),s="Travel & Places";break;case"objects":o=e.jsx(M.IconBulb,{size:20,strokeWidth:2}),s="Objects";break;case"symbols":o=e.jsx(M.IconHeart,{size:20,strokeWidth:2}),s="Symbols";break;case"flags":o=e.jsx(M.IconFlag,{size:20,strokeWidth:2}),s="Flags";break;case"frequent":return;default:o=e.jsx(M.IconMoodSmile,{size:20,strokeWidth:2}),s=`Category: ${r.id}`;break}n.push({id:r.id,name:s,icon:o})}}),n},Ft=({onEmojiSelect:n,height:r=200})=>{const[o,s]=u.useState(""),[c,i]=u.useState("people"),[a,d]=u.useState(()=>{if(typeof window<"u"){const I=localStorage.getItem("emoji-frequent");return I?JSON.parse(I):[]}return[]}),[l,f]=u.useState([]),[h,g]=u.useState(!1),x=Lt();u.useEffect(()=>{o.trim()?(g(!0),Ze.SearchIndex.search(o).then(I=>{f(I.map(b=>({id:b.id,native:b.skins[0].native,name:b.name,keywords:b.keywords}))),g(!1)})):f([])},[o]);const y=u.useMemo(()=>{if(o.trim())return l;if(c==="frequent")return a.map(b=>({id:b,native:b,name:"",keywords:[]}));const I=Se.categories.find(b=>b.id===c);return I?I.emojis.map(b=>{const j=Se.emojis[b];return{id:j.id,native:j.skins[0].native,name:j.name,keywords:j.keywords}}):[]},[o,c,a,l]),p=I=>{n(I),d(b=>{const j=b.filter(w=>w!==I),S=[I,...j].slice(0,20);return typeof window<"u"&&localStorage.setItem("emoji-frequent",JSON.stringify(S)),S})},m=I=>{if(o.trim())return"Results";const b=x.find(j=>j.id===I);return b?b.name:I.charAt(0).toUpperCase()+I.slice(1)};return e.jsxs(t.Stack,{gap:0,style:{height:r,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:I=>s(I.target.value),leftSection:e.jsx(M.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:m(c)})]})}),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(I=>e.jsx(t.Tooltip,{label:I.name||I.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(I.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:I.native})},I.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(I=>e.jsx(t.Tooltip,{label:I.name,position:"top",withArrow:!0,openDelay:500,withinPortal:!0,zIndex:1e3,color:"dark",children:e.jsx(t.Box,{onClick:()=>{i(I.id),s("")},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:c===I.id?"var(--mantine-color-gray-0)":"transparent",color:c===I.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:I.icon})},I.id))})})]})},ln=["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"],dn=["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"],un=["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"],fn=["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"],hn=["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"],pn=["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"],xn=["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"],mn=["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"];[...ln,...dn,...un,...fn,...hn,...pn,...xn,...mn];const pe=[{id:"recent",name:"Recently Used",icons:[],isDynamic:!0},{id:"user",name:"User & Profile",icons:ln},{id:"business",name:"Business & Work",icons:dn},{id:"tech",name:"Technology",icons:un},{id:"expressions",name:"Expressions",icons:fn},{id:"nature",name:"Nature & Animals",icons:hn},{id:"shapes",name:"Shapes & Symbols",icons:pn},{id:"actions",name:"Actions & Tools",icons:xn},{id:"communication",name:"Communication",icons:mn}],Ut={recent:e.jsx(M.IconClock,{size:20,strokeWidth:2.5}),user:e.jsx(M.IconUser,{size:20,strokeWidth:2.5}),business:e.jsx(M.IconBriefcase,{size:20,strokeWidth:2.5}),tech:e.jsx(M.IconDeviceDesktop,{size:20,strokeWidth:2.5}),expressions:e.jsx(M.IconMoodSmile,{size:20,strokeWidth:2.5}),nature:e.jsx(M.IconTrees,{size:20,strokeWidth:2.5}),shapes:e.jsx(M.IconCircle,{size:20,strokeWidth:2.5}),actions:e.jsx(M.IconTool,{size:20,strokeWidth:2.5}),communication:e.jsx(M.IconMessage,{size:20,strokeWidth:2.5})},Nt=({selectedCategory:n,onCategoryChange:r})=>e.jsx(t.Flex,{gap:"0px",justify:"center",wrap:"wrap",children:pe.map(o=>{const s=Ut[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:()=>r(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:c=>{c.currentTarget.style.backgroundColor="var(--mantine-color-gray-1)"},onMouseLeave:c=>{c.currentTarget.style.backgroundColor=n===o.id?"var(--mantine-color-gray-0)":"transparent"},children:s})},o.id)})}),gn=u.memo(({onIconSelect:n,height:r=358})=>{var I,b;const[o,s]=u.useState(""),[c,i]=u.useState("recent"),[a,d]=u.useState(!1),[l,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(()=>pe.filter(j=>j.id!=="recent"&&!("isDynamic"in j)).flatMap(j=>j.icons),[]),g=u.useMemo(()=>{if(c==="recent"){const S=new Set(h);return l.filter(w=>S.has(w))}const j=pe.find(S=>S.id===c);return(j==null?void 0:j.icons)||[]},[c,l,h]),x=u.useCallback((j,S)=>{if(!j.trim())return S;const w=j.toLowerCase().trim(),O=w.split(/\s+/);return S.filter(C=>{const v=C.replace(/^Icon/,"").split(/(?=[A-Z])/).map(R=>R.toLowerCase().trim()).filter(R=>R.length>0);return!!(v.some(R=>O.some(D=>R===D))||w.length>2&&v.some(R=>O.some(D=>R.startsWith(D)))||w.length<=2&&v.some(R=>O.some(D=>R.includes(D)))||O.length>1&&O.every(R=>v.some(D=>D===R||D.startsWith(R))))})},[]),y=u.useMemo(()=>o.trim()?x(o,h):g,[o,g,h,x]),p=u.useCallback(j=>{h.includes(j)&&f(w=>{const O=[j,...w.filter(C=>C!==j)].slice(0,20);return typeof window<"u"&&localStorage.setItem("avatar-icon-recent",JSON.stringify(O)),O}),n(j)},[n,h]),m=u.useCallback(j=>{c!==j&&(s(""),i(j),requestAnimationFrame(()=>{d(!0),setTimeout(()=>d(!1),100)}))},[c]);return e.jsxs(t.Stack,{gap:0,style:{height:r,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 ${(I=pe.find(j=>j.id===c))==null?void 0:I.name}...`,value:o,onChange:j=>s(j.target.value),leftSection:e.jsx(M.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=pe.find(j=>j.id===c))==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:a?.7:1,transition:"opacity 0.05s ease"},children:y.map(j=>e.jsx(Ke,{iconName:j,onClick:()=>p(j),size:20},o.trim()?`search-${j}`:`${c}-${j}`))},`${c}-${o}`)})}),e.jsx(t.Box,{px:"sm",py:"xs",style:{borderTop:"1px solid var(--mantine-color-gray-3)"},children:e.jsx(Nt,{selectedCategory:c,onCategoryChange:m})})]})});gn.displayName="IconGrid";const Wt=({previewImage:n,fileInputRef:r,selectedEmoji:o,size:s,loading:c,onFileInputClick:i,onImageChange:a,onImageAccept:d,onClearImagePreview:l})=>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:`${fe(s)}px !important`,height:`${fe(s)}px !important`,minWidth:`${fe(s)}px`,minHeight:`${fe(s)}px`,maxWidth:`${fe(s)}px`,maxHeight:`${fe(s)}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(M.IconPhoto,{size:20}),onClick:i,loading:c,disabled:c,fullWidth:!0,children:"Choose Image"}),n||o?e.jsx(t.Button,{variant:"outline",leftSection:e.jsx(M.IconPhoto,{size:16}),onClick:i,loading:c,disabled:c,fullWidth:!0,children:n||o?"Change Image":"Choose Image"}):null,e.jsx("input",{ref:r,type:"file",accept:"image/jpeg,image/jpg,image/png,image/gif,image/webp",onChange:f=>{var h;return a(((h=f.target.files)==null?void 0:h[0])||null)},style:{display:"none"},disabled:c}),(n||o)&&e.jsxs(t.Group,{gap:"sm",w:"100%",children:[e.jsx(t.Button,{variant:"outline",color:"gray",onClick:l,fullWidth:!0,children:"Back"}),e.jsx(t.Button,{color:"blue",onClick:d,loading:c,disabled:c,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"})]})}),$t=({onEmojiSelect:n})=>e.jsx(Ft,{onEmojiSelect:n,height:358}),Ht=({onIconSelect:n})=>e.jsx(gn,{onIconSelect:n,height:358}),Gt=({previewImage:n,selectedEmoji:r,size:o,loading:s,onFileInputClick:c,onImageChange:i,onImageAccept:a,onClearImagePreview:d,fileInputRef:l})=>e.jsx(Wt,{previewImage:n,fileInputRef:l,selectedEmoji:r,size:o,loading:s,onFileInputClick:c,onImageChange:i,onImageAccept:a,onClearImagePreview:d}),Vt=()=>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..."})]})}),In=({editable:n=!0,opened:r,onOpen:o,onClose:s,avatar:c,onAvatarSelect:i,onRemove:a,size:d="lg",loading:l=!1,placeholder:f,showPlaceholder:h=!0,position:g="bottom-start",withinPortal:x=!0,zIndex:y=1e3})=>{const p=u.useRef(null),m=u.useRef(null),I=u.useRef(null),{selectedTab:b,tabHovered:j,previewImage:S,selectedEmoji:w,selectedIcon:O,selectedFile:C,handleTabChange:k,handleTabHover:v,handleImagePreview:R,handleImageAccept:D,handleEmojiSelect:B,handleIconSelect:E,clearImagePreview:N,resetState:H}=Et({onAvatarSelect:i});At({opened:r,onClose:s,popoverRef:m}),u.useEffect(()=>{r||H()},[r,H]);const F=X=>{console.log("Emoji clicked:",X),B(X),s()},P=X=>{console.log("Icon clicked:",X),E(X),s()},V=X=>{X&&R(X)},U=()=>{C?(D(),s()):(w||O)&&s()},G=()=>{p.current&&p.current.click()},$=()=>{N()},Q=()=>{console.log("Avatar removed"),a==null||a(),s()},T=()=>!!c,z=()=>l?e.jsx(ke,{size:d,loading:!0}):e.jsx(se,{avatar:c,size:d,placeholder:f,showPlaceholder:h,editable:!0,onClick:()=>{!l&&!r&&o()}}),A=e.jsx($t,{onEmojiSelect:F}),L=e.jsx(Ht,{onIconSelect:P}),_=e.jsx(Gt,{previewImage:S,selectedEmoji:w,size:d,loading:l,onFileInputClick:G,onImageChange:V,onImageAccept:U,onClearImagePreview:$,fileInputRef:p}),ne=e.jsx(t.Box,{children:e.jsx(Pt,{selectedTab:b,tabHovered:j,onTabChange:k,onTabHover:v,onRemove:Q,hasAvatar:T(),children:b==="emoji"?A:b==="icons"?L:_})}),W=e.jsx("div",{style:{position:"relative",display:"inline-block"},children:e.jsxs(t.Popover,{opened:r,onClose:()=>{console.log("Popover onClose called"),s()},position:g,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:I,style:{position:"relative"},children:z()})}),e.jsx(t.Popover.Dropdown,{ref:m,p:0,style:{width:"auto",overflow:"hidden",zIndex:y},children:e.jsx(u.Suspense,{fallback:e.jsx(Vt,{}),children:ne})})]})}),oe=e.jsx(se,{avatar:c,size:d,placeholder:f,showPlaceholder:h});return e.jsx(e.Fragment,{children:n?W:oe})},_t=n=>{if(!n||typeof n!="string")return!1;const r=/^[^\s@]+@[^\s@]+\.[^\s@]+$/;return n.length<5||n.length>254?!1:r.test(n.trim())},Qt=n=>{const r=[];return n.forEach(o=>{_t(o)||r.push({email:o,error:"Please enter a valid email address"})}),{isValid:r.length===0,errors:r}},Yt=n=>{const r=[],o=new Set;return n.forEach(s=>{const c=s.toLowerCase().trim();o.has(c)?r.push({email:s,error:"This email has already been added"}):o.add(c)}),r},qt=n=>{const r=Qt(n),o=Yt(n),s=[...r.errors,...o];return{isValid:s.length===0,errors:s}},Zt=({value:n,onChange:r,onInputChange:o,suggestedUsers:s=[],tagDisplayMap:c={}})=>{const[i,a]=u.useState(""),[d,l]=u.useState([]),f=u.useRef(null),h=n.map(m=>{if(c[m])return c[m];const I=s.find(b=>b.email===m);return I&&I.name?I.name:m});u.useEffect(()=>{o&&o(i)},[i,o]),u.useEffect(()=>{if(n.length>0){const m=qt(n);l(m.errors)}else l([])},[n]),u.useEffect(()=>{const m=f.current;if(!m)return;let I;const b=j=>{const w=j.target.value||"";clearTimeout(I),I=setTimeout(()=>{a(w)},150)};return m.addEventListener("input",b),()=>{m.removeEventListener("input",b),clearTimeout(I)}},[]);const g=u.useCallback(m=>{const I=s.map(j=>({name:j.name||j.email,email:j.email})),b=m.map(j=>{const S=I.find(w=>w.name.toLowerCase()===j.toLowerCase());return S?S.email:j}).filter(j=>j.includes("@")?!0:!I.some(w=>{const O=w.name.toLowerCase(),C=j.toLowerCase();return O.startsWith(C)&&C!==O}));r(b),a("")},[r,s]),x=u.useCallback(()=>{f.current&&(f.current.value="",a(""))},[]),y=d.length===0&&n.length>0,p=u.useCallback((m,I,b)=>{m&&n.length>0&&I&&(m(n,I,b),a(""))},[n]);return{inputText:i,tagsInputRef:f,displayValue:h,validationErrors:d,isValid:y,handleEmailChange:g,clearInput:x,handleInvite:p}},yn=({onInvite:n,onUpdateRole:r,onRemoveUser:o,invitedUsers:s=[],suggestedUsers:c=[],roleOptions:i=[]})=>{const[a,d]=u.useState([]),[l,f]=u.useState([]),[h,g]=u.useState(""),[x,y]=u.useState({}),p=i.length>0?i[0].value:void 0,[m,I]=u.useState(p);u.useEffect(()=>{i.length>0&&!m&&I(i[0].value)},[i.length,m]),u.useEffect(()=>{const B=c.filter(E=>a.includes(E.email)).map(E=>E.id);f(E=>E.filter(N=>B.includes(N)))},[a,c.length]);const[b,j]=u.useState("invite"),[S,w]=u.useState(null),O=(B,E,N)=>{n&&n(B,E,N),d([]),g("")},C=(B,E)=>{r&&r(B,E)},k=B=>{o&&o(B)},v=B=>{f(E=>E.includes(B)?E.filter(N=>N!==B):[...E,B])},R=B=>{a.includes(B.email)||(d([...a,B.email]),y(E=>({...E,[B.email]:B.name||B.email})),l.includes(B.id)||f([...l,B.id]),g(""))},D=h.trim()?c.filter(B=>{var N;const E=h.toLowerCase();return B.email.toLowerCase().includes(E)||((N=B.name)==null?void 0:N.toLowerCase().includes(E))}):[];return{emails:a,setEmails:d,selectedUsers:l,setSelectedUsers:f,inputText:h,setInputText:g,tagDisplayMap:x,setTagDisplayMap:y,selectedRole:m,setSelectedRole:I,selectedTab:b,setSelectedTab:j,tabHovered:S,setTabHovered:w,filteredUsers:D,handleInvite:O,handleUpdateRole:C,handleRemoveUser:k,handleToggleUser:v,handleAddSuggestedUser:R}},vn=u.forwardRef(({value:n,onChange:r,placeholder:o="Add one or more emails",onInvite:s,roleOptions:c=[],selectedRole:i,onRoleChange:a,onInputChange:d,suggestedUsers:l=[],tagDisplayMap:f={}},h)=>{const[g,x]=u.useState("Hello, I would like to invite you to join my workspace"),{tagsInputRef:y,displayValue:p,validationErrors:m,isValid:I,handleEmailChange:b,clearInput:j,handleInvite:S}=Zt({value:n,onChange:r,onInputChange:d,suggestedUsers:l,tagDisplayMap:f}),w=()=>{S(s,i,g),x("")};u.useImperativeHandle(h,()=>({clearInput:j}),[j]);const O=p.length>0,C=a&&c.length>0,k=m.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:O?"":o,radius:"md",rightSection:C?e.jsx(t.Box,{style:{position:"absolute",right:"8px",top:"17px",transform:"translateY(-50%)",height:"24px",display:"flex",alignItems:"center"},children:e.jsx(Te,{value:i||"",onChange:v=>a(v),data:c,placeholder:"Select role",defaultOption:c[c.length-1],disabledOptions:["owner"]})}):null,rightSectionProps:{style:{width:C?"120px":"0px",position:"absolute",height:"32px",right:"8px"}},styles:{input:{paddingRight:C?"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:m.map((v,R)=>e.jsxs(t.Text,{size:"xs",c:"red",children:[v.email,": ",v.error]},R))})]}),O&&e.jsxs(t.Stack,{gap:"sm",children:[e.jsx(t.Textarea,{size:"sm",value:g,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:!I,children:"Send invitations"})]})]})}),Xt=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"}},Kt=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"}},Jt=n=>{if(n){if(typeof n=="object"&&"type"in n)return n;if(typeof n=="string")return{type:"image",value:n}}},ge=({user:n,isSelected:r=!1,onToggle:o,onUpdateRole:s,onRemoveUser:c,roleOptions:i=[],variant:a="invited",onClick:d})=>{var I;const l=((I=n.name)==null?void 0:I.trim())||n.email,f=()=>{o&&o(n.id)},h=b=>{if(s){const j=b;s(n.id,j)}},g=a==="suggested"||a==="read-only",x=a==="invited"&&i.length>0,[y,p]=u.useState(!1),m=()=>{d==null||d()};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:m,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:Jt(n.avatar),size:"md",placeholder:l,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:l}),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:Xt(n.status),radius:"sm",children:Kt(n.status)})]}),e.jsx(t.Text,{size:"xs",c:"dimmed",lineClamp:1,children:n.email})]})]}),e.jsxs(t.Group,{gap:"sm",align:"center",children:[g&&a!=="read-only"&&e.jsx(t.Radio,{checked:r,onChange:f,size:"sm",onClick:b=>b.stopPropagation(),pr:4}),x&&!n.isCurrentUser&&e.jsx(Te,{value:n.role,onChange:h,data:i,placeholder:"Select role",defaultOption:i.find(b=>b.value===n.role),withRemove:!0,onRemove:()=>c==null?void 0:c(n.id)})]})]})},jn=({opened:n,onClose:r,onInvite:o,onUpdateRole:s,onRemoveUser:c,invitedUsers:i=[],children:a,roleOptions:d=[],suggestedUsers:l=[]})=>{const f=u.useRef(null),{emails:h,setEmails:g,selectedUsers:x,inputText:y,setInputText:p,tagDisplayMap:m,selectedRole:I,setSelectedRole:b,selectedTab:j,setSelectedTab:S,tabHovered:w,setTabHovered:O,filteredUsers:C,handleInvite:k,handleUpdateRole:v,handleRemoveUser:R,handleToggleUser:D,handleAddSuggestedUser:B}=yn({onInvite:o,onUpdateRole:s,onRemoveUser:c,invitedUsers:i,suggestedUsers:l,roleOptions:d}),E=P=>{B(P),f.current&&f.current.clearInput()},N=e.jsxs(e.Fragment,{children:[e.jsx(vn,{ref:f,value:h,onChange:g,onInvite:k,roleOptions:d,selectedRole:I,onRoleChange:b,onInputChange:p,suggestedUsers:l,tagDisplayMap:m}),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(P=>e.jsx(ge,{user:P,isSelected:x.includes(P.id),onToggle:D,onUpdateRole:v,onRemoveUser:R,roleOptions:d,variant:"invited"},P.id))})]})})}),C.length>0&&e.jsx(t.ScrollArea,{pt:"sm",mah:200,type:"auto",style:{overflow:"visible"},children:e.jsx(t.Box,{children:C.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:C.map(P=>e.jsx(ge,{user:P,isSelected:x.includes(P.id),onToggle:D,onUpdateRole:v,onRemoveUser:R,roleOptions:d,variant:"suggested",onClick:()=>E(P)},P.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"})]})}),F=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:()=>O("invite"),onMouseLeave:()=>O(null),style:{backgroundColor:"transparent"},children:e.jsx(t.Box,{style:{borderRadius:"var(--mantine-radius-md)",height:"24px",display:"flex",alignItems:"center",justifyContent:"center",padding:"0 8px",border:"none",backgroundColor:w==="invite"?"var(--mantine-color-gray-1)":"transparent",color: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:()=>O("publish"),onMouseLeave:()=>O(null),style:{backgroundColor:"transparent"},children:e.jsx(t.Box,{style:{height:"24px",display:"flex",alignItems:"center",justifyContent:"center",padding:"0 8px",borderRadius:"var(--mantine-radius-md)",border:"none",backgroundColor:w==="publish"?"var(--mantine-color-gray-1)":"transparent",color: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:N})}),e.jsx(t.Tabs.Panel,{value:"publish",children:e.jsx(t.Box,{p:"sm",children:H})})]})})});return e.jsx(me,{trigger:a,menuItems:[],opened:n,onClose:r,styles:{dropdown:{padding:"0",borderRadius:"var(--mantine-radius-md)"}},children:F})},eo=({onInvite:n,onUpdateRole:r,onRemoveUser:o,invitedUsers:s,currentUser:c,roleOptions:i,suggestedUsers:a,label:d="Share"})=>{const[l,f]=u.useState(!1),h=()=>f(!1),g=e.jsx(He,{label:d,onClick:()=>f(!0),isActive:l});return e.jsx(jn,{opened:l,onClose:h,onInvite:n,onUpdateRole:r,onRemoveUser:o,invitedUsers:s,currentUser:c,roleOptions:i,suggestedUsers:a,children:g})},no=({opened:n,onClose:r,onInvite:o,onUpdateRole:s,onRemoveUser:c,invitedUsers:i=[],roleOptions:a=[],suggestedUsers:d=[]})=>{const l=u.useRef(null),{emails:f,setEmails:h,selectedUsers:g,inputText:x,setInputText:y,tagDisplayMap:p,selectedRole:m,setSelectedRole:I,filteredUsers:b,handleInvite:j,handleUpdateRole:S,handleRemoveUser:w,handleToggleUser:O,handleAddSuggestedUser:C}=yn({onInvite:o,onUpdateRole:s,onRemoveUser:c,invitedUsers:i,suggestedUsers:d,roleOptions:a}),k=v=>{C(v),l.current&&l.current.clearInput()};return e.jsx(t.Modal,{opened:n,onClose:r,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(K,{icon:M.IconX,size:"md",onClick:r,color:"var(--mantine-color-gray-8)"})]}),e.jsx(vn,{ref:l,value:f,onChange:h,onInvite:j,roleOptions:a,selectedRole:m,onRoleChange:I,onInputChange:y,suggestedUsers:d,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(ge,{user:v,isSelected:g.includes(v.id),onToggle:O,onUpdateRole:S,onRemoveUser:w,roleOptions:a,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(ge,{user:v,isSelected:g.includes(v.id),onToggle:O,onUpdateRole:S,onRemoveUser:w,roleOptions:a,variant:"suggested",onClick:()=>k(v)},v.id))})})]})]})})},to=({opened:n,onClose:r,options:o=[],onSave:s,onCancel:c,groups:i=[],styles:a})=>{const[d,l]=u.useState("");u.useEffect(()=>{n&&o.length>0?l(o[0].id):n||l("")},[n,o]);const f=()=>{s&&s(),r()},h=()=>{c&&c(),r()},g=()=>{r()},x=o.find(y=>y.id===d);return e.jsxs(t.Modal,{opened:n,onClose:g,size:"90%",centered:!0,closeOnClickOutside:!0,closeOnEscape:!0,withCloseButton:!1,p:"none",styles:{body:{...a==null?void 0:a.body,padding:0,height:"80vh"}},radius:"md",children:[e.jsx(t.FocusTrap.InitialFocus,{}),e.jsxs(t.Box,{style:{display:"flex",height:"100%",...a==null?void 0:a.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(Ge,{label:p.label,icon:p.icon,onClick:()=>l(p.id),isActive:d===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"})]})})]})]})]})},oo=(n,r="es")=>{const o=new Date,s=typeof n=="string"?new Date(n):n,c=Math.floor((o.getTime()-s.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"}},a=i[r]||i.en;if(c<5)return a.now;if(c<60)return r==="es"?`${a.ago} ${c} ${c===1?a.second:a.seconds}`:`${c} ${c===1?a.second:a.seconds} ${a.ago}`;const d=Math.floor(c/60);if(d<60)return r==="es"?`${a.ago} ${d} ${d===1?a.minute:a.minutes}`:`${d} ${d===1?a.minute:a.minutes} ${a.ago}`;const l=Math.floor(d/60);if(l<24)return r==="es"?`${a.ago} ${l} ${l===1?a.hour:a.hours}`:`${l} ${l===1?a.hour:a.hours} ${a.ago}`;const f=Math.floor(l/24);if(f<7)return r==="es"?`${a.ago} ${f} ${f===1?a.day:a.days}`:`${f} ${f===1?a.day:a.days} ${a.ago}`;const h=Math.floor(f/7);if(h<4)return r==="es"?`${a.ago} ${h} ${h===1?a.week:a.weeks}`:`${h} ${h===1?a.week:a.weeks} ${a.ago}`;const g=Math.floor(f/30);if(g<12)return r==="es"?`${a.ago} ${g} ${g===1?a.month:a.months}`:`${g} ${g===1?a.month:a.months} ${a.ago}`;const x=Math.floor(f/365);return r==="es"?`${a.ago} ${x} ${x===1?a.year:a.years}`:`${x} ${x===1?a.year:a.years} ${a.ago}`},ro=(n,r="es")=>{const o=typeof n=="string"?new Date(n):n,s={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=(s[r]||s.en)[o.getMonth()],a=o.getDate();return r==="es"?`${a} ${i}`:`${i} ${a}`},so=n=>{const r=typeof n=="string"?new Date(n):n,o=new Date;return r.toDateString()===o.toDateString()},ao=n=>{const r=typeof n=="string"?new Date(n):n,o=new Date;return o.setDate(o.getDate()-1),r.toDateString()===o.toDateString()},io=(n,r="es")=>so(n)?r==="es"?"Hoy":"Today":ao(n)?r==="es"?"Ayer":"Yesterday":oo(n,r),co=({notification:n,message:r,markAsRead:o,archiveNotification:s,children:c,actions:i})=>{var h,g,x,y,p;const a=new Date().getTime()-new Date(n.timestamp).getTime()<6048e5?io(n.timestamp,"en"):ro(n.timestamp,"en"),[d,l]=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(K,{onClick:()=>o(n.id),icon:M.IconCheck}),!n.isArchived&&e.jsx(K,{onClick:()=>s(n.id),icon:M.IconArchive})]});return e.jsxs(t.Box,{p:"sm",bg:d?"var(--mantine-color-gray-0)":"white",style:{cursor:"pointer",borderTop:"1px solid var(--mantine-color-gray-2)"},onMouseEnter:()=>l(!0),onMouseLeave:()=>l(!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:(g=n.metadata)==null?void 0:g.fullname,size:"sm",radius:"md",src:(x=n.metadata)==null?void 0:x.avatar_url}):e.jsx(on,{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:r}),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)):""," ","• ",a]})]}),d?f:!n.isRead&&e.jsx(t.Indicator,{color:"var(--mantine-color-blue-6)",size:10,position:"top-end"})]}),c,i&&e.jsx(t.Group,{justify:"flex-start",align:"flex-start",gap:"xs",wrap:"nowrap",pl:36,pt:8,children:i})]})},lo=(n,r,o,s,c)=>{const[i,a]=u.useState(!1),d=u.useRef(null),l=u.useRef(null),f=u.useRef(null);u.useEffect(()=>{a(n)},[n]);const h=u.useCallback(x=>{x[0].isIntersecting&&s&&!c&&o&&o()},[s,c,o]),g=u.useCallback(()=>{if(!(!d.current||!n||!r||!o)){l.current&&(l.current.disconnect(),l.current=null);try{const x=new IntersectionObserver(h,{threshold:.1,rootMargin:"50px"});x.observe(d.current),l.current=x}catch(x){console.error("Failed to setup intersection observer:",x)}}},[n,r,o,h]);return u.useEffect(()=>{if(f.current&&(clearTimeout(f.current),f.current=null),!n||!r||!o){l.current&&(l.current.disconnect(),l.current=null);return}if(!d.current){f.current=setTimeout(()=>g(),50);return}return g(),()=>{f.current&&(clearTimeout(f.current),f.current=null),l.current&&(l.current.disconnect(),l.current=null)}},[n,r,o,g]),u.useEffect(()=>()=>{f.current&&clearTimeout(f.current),l.current&&l.current.disconnect()},[]),{isActive:i,loadMoreRef:d}},uo=({notifications:n,isLoading:r=!1,isLoadingMore:o=!1,hasMore:s=!1,unreadCount:c=0,markAllAsRead:i,archiveAllNotifications:a,markAsRead:d,archiveNotification:l,loadMore:f,onFilterChange:h,currentFilter:g="all",customRenderer:x,opened:y=!1,onOpen:p=()=>{},onClose:m=()=>{},enableInfiniteScroll:I=!0})=>{const b=[{children:"Mark all as read",leftSection:e.jsx(M.IconChecklist,{size:16}),onClick:()=>i()},{children:"Archive all",leftSection:e.jsx(M.IconArchive,{size:16}),onClick:()=>a()}],j=[{children:"All",leftSection:e.jsx(M.IconChecklist,{size:16}),onClick:()=>h==null?void 0:h("all"),active:g==="all"},{children:"Unread",leftSection:e.jsx(M.IconChecklist,{size:16}),onClick:()=>h==null?void 0:h("unread"),active:g==="unread"},{children:"Archived",leftSection:e.jsx(M.IconArchive,{size:16}),onClick:()=>h==null?void 0:h("archived"),active:g==="archived"}],S=C=>x&&C.category&&["welcome","upgrade"].includes(C.category)?x(C,d,l):e.jsx(co,{notification:C,markAsRead:d,archiveNotification:l,message:C.message,actions:C.actions},C.id),{isActive:w,loadMoreRef:O}=lo(y,I,f||(()=>{}),s,o);return e.jsxs(e.Fragment,{children:[e.jsx(Ge,{isActive:w,icon:e.jsx(M.IconBell,{strokeWidth:2,color:"var(--mantine-color-gray-7)"}),onClick:()=>{y?m():p()},disabled:!1,variant:"subtle",color:"gray",fullWidth:!0,style:{borderRadius:"var(--mantine-radius-md)",cursor:"pointer"},label:"Inbox",indicator:c>0?c>99?"99+":c:void 0}),e.jsxs(t.Drawer,{opened:y,onClose:m,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(me,{position:"bottom-end",menuItems:j,trigger:e.jsx(K,{icon:M.IconFilter})}),e.jsx(me,{position:"bottom-end",menuItems:b,trigger:e.jsx(K,{onClick:()=>{},icon:M.IconDots,changeIconOnHover:!0,iconHovered:M.IconDots})})]})]})}),e.jsxs(t.Box,{style:{flex:1,overflow:"auto"},children:[r&&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(C=>S(C))}):e.jsxs(t.Stack,{gap:0,w:"100%",h:"100%",justify:"center",align:"center",py:"xl",children:[e.jsx(M.IconInbox,{size:24,color:"var(--mantine-color-gray-6)"}),e.jsx(t.Text,{size:"sm",fw:500,c:"dimmed",ta:"center",mt:"sm",children:"No new updates"})]}),e.jsx(t.Box,{ref:O,style:{padding:"16px",display:I?"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&&!I&&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 ..."})]}),!I&&s&&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"})]})]})]})]})},$e=({header:n,body:r,footer:o,withBorder:s=!0,position:c="left",bg:i="var(--mantine-color-gray-0)"})=>{const[a,d]=u.useState(!1),l=()=>{if(!s)return{};const f="var(--mantine-color-gray-3)",h="1px";return c==="left"?{borderRight:`${h} solid ${f}`}:c==="right"?{borderLeft:`${h} solid ${f}`}:{}};return e.jsxs(t.Stack,{gap:"sm",h:"100%",p:"sm",bg:i,style:l(),onMouseEnter:()=>d(!0),onMouseLeave:()=>d(!1),children:[n&&e.jsx(t.Box,{children:typeof n=="function"?n({hovered:a}):n}),r&&e.jsx(t.Box,{style:{flex:1,minHeight:0,width:"100%",overflow:"hidden"},children:typeof r=="function"?r({hovered:a}):r}),o&&e.jsx(t.Box,{children:typeof o=="function"?o({hovered:a}):o})]})},bn=u.createContext(void 0),fo=({children:n})=>{const[r,{open:o,close:s}]=xe.useDisclosure(!1),c={openedNotificationSidebar:r,openNotificationSidebar:o,closeNotificationSidebar:s};return e.jsx(bn.Provider,{value:c,children:n})},ho=()=>{const n=u.useContext(bn);if(n===void 0)throw new Error("useNavbar must be used within an NavbarProvider");return n},wn=({workspace:n,currentUserId:r,currentWorkspaceId:o,onClick:s})=>{const c=o===n.id,i=r&&n.ownerId===r;return e.jsxs(t.Box,{onClick:s,style:{display:"flex",alignItems:"center",padding:"6px",borderRadius:"var(--mantine-radius-md)",cursor:"pointer",gap:"8px",width:"100%",boxSizing:"border-box"},onMouseEnter:a=>{a.currentTarget.style.backgroundColor="var(--mantine-color-gray-0)"},onMouseLeave:a=>{a.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:[c&&e.jsx(M.IconCheck,{size:16,color:"var(--mantine-color-blue-6)"}),i&&e.jsx(t.Badge,{size:"xs",variant:"light",color:"yellow",radius:"sm",children:"Owner"})]})]})},po="workspace-selector-module__menuItem___FSB6P",xo="workspace-selector-module__workspaceButton___-P6kp",mo="workspace-selector-module__workspaceText___YDAlj",go="workspace-selector-module__scrollWrapper___MzrJY",Ue={menuItem:po,workspaceButton:xo,workspaceText:mo,scrollWrapper:go},Io=({workspaces:n=[],currentWorkspace:r,currentUserId:o,isLoading:s=!1,error:c=null,onWorkspaceSelect:i,onCreateWorkspace:a,emptyMessage:d="No workspaces found",loadingMessage:l="Loading workspaces...",errorMessage:f="Failed to load workspaces",className:h,onCloseSidebar:g,sidebarHovered:x=!1,children:y,menuItems:p})=>{const[m,I]=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),I(!1),j("")};if(s)return e.jsxs(t.Group,{gap:"xs",children:[e.jsx(t.Loader,{size:"sm"}),e.jsx(t.Text,{size:"sm",c:"dimmed",children:l})]});if(c)return e.jsx(t.Alert,{color:"red",title:"Error",children:f});const[O,C]=u.useState(x);return n.length===0&&!s&&!c?e.jsx(t.Box,{children:e.jsx(t.Text,{size:"sm",c:"dimmed",children:d})}):e.jsxs(t.Menu,{opened:m,onOpen:()=>I(!0),onClose:()=>I(!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:()=>I(!m),style:{padding:"6px",display:"flex",alignItems:"center",borderRadius:"var(--mantine-radius-md)",cursor:"pointer"},className:`${Ue.workspaceButton} ${h||""}`,bg:O||m?"var(--mantine-color-gray-1)":"transparent",onMouseEnter:()=>C(!0),onMouseLeave:()=>C(!1),children:e.jsx(t.Group,{gap:"xs",wrap:"nowrap",style:{width:"100%",overflow:"hidden"},children:r?e.jsxs(e.Fragment,{children:[e.jsx(se,{size:"xs",avatar:typeof r.avatar=="string"?{type:"image",value:r.avatar}:r.avatar,placeholder:r.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:r.name}),e.jsxs(t.Group,{gap:4,wrap:"nowrap",style:{flexShrink:0},children:[e.jsx(t.ActionIcon,{radius:"md",size:"md",color:"gray",variant:"subtle",onClick:()=>I(!m),children:e.jsx(M.IconChevronDown,{size:20,strokeWidth:2,color:"var(--mantine-color-gray-7)"})}),(O||x)&&e.jsx(K,{icon:M.IconChevronsLeft,size:"md",color:"gray",variant:"subtle",onClick:()=>{g==null||g()}})]})]}):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:d})}):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"}),a&&e.jsx(t.Anchor,{onClick:()=>{a(),I(!1)},size:"xs",underline:"never",fw:500,p:4,truncate:!0,style:{display:"flex",alignItems:"center",gap:"4px"},children:"Add"})]}),e.jsx("div",{className:Ue.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:Ue.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(wn,{workspace:k,currentUserId:o,currentWorkspaceId:r==null?void 0:r.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))})]})})]})},Sn=({children:n,style:r,...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",...r},...o,children:n});Sn.displayName="MatrixCenter";const kn=({children:n,style:r,size:o="50px",state:s="empty",onStateChange:c,interactive:i=!0,...a})=>{const[d,l]=u.useState(s),[f,h]=u.useState(!1),g=c?s:i?d:s,x=()=>{if(!i)return;const m=["empty","outline","filled"],b=(m.indexOf(g)+1)%m.length,j=m[b];c?c(j):l(j)},y=()=>{switch(g){case"empty":return null;case"outline":return e.jsx(M.IconPoint,{size:16,color:"var(--mantine-color-gray-8)",stroke:2.5});case"filled":return e.jsx(M.IconPointFilled,{size:16,color:"var(--mantine-color-gray-8)",stroke:2.5});default:return null}},p=()=>{switch(g){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:g==="outline"?"2px solid var(--mantine-color-gray-0)":"2px solid transparent",...r},onClick:x,onMouseEnter:()=>h(!0),onMouseLeave:()=>h(!1),...a,children:n||y()})};kn.displayName="MatrixCell";const Cn=({children:n,style:r,size:o="50px",blockId:s,isVisible:c=!0,isDimmed:i=!1,shouldShowBlueBorder:a=!1,onBlockClick:d,onBlockPress:l,...f})=>{const[h,g]=u.useState(!1),x=u.useRef(null),y=u.useRef(!1),p=()=>{!s||!l||(g(!0),y.current=!1,x.current=setTimeout(()=>{y.current=!0,l(s)},500))},m=()=>{s&&(g(!1),x.current&&(clearTimeout(x.current),x.current=null),!y.current&&d&&d(s),y.current=!1)},I=()=>{g(!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:a?"2px solid var(--mantine-color-blue-5)":"2px solid transparent",opacity:h?.8:i?.3:1,transition:"all 0.2s ease",cursor:s?"pointer":"default",...r},onMouseDown:p,onMouseUp:m,onMouseLeave:I,...f,children:n})};Cn.displayName="MatrixBlockLeft";const Mn=({children:n,style:r,size:o="50px",blockId:s,isVisible:c=!0,isDimmed:i=!1,shouldShowBlueBorder:a=!1,onBlockClick:d,onBlockPress:l,...f})=>{const[h,g]=u.useState(!1),x=u.useRef(null),y=u.useRef(!1),p=()=>{!s||!l||(g(!0),y.current=!1,x.current=setTimeout(()=>{y.current=!0,l(s)},500))},m=()=>{s&&(g(!1),x.current&&(clearTimeout(x.current),x.current=null),!y.current&&d&&d(s),y.current=!1)},I=()=>{g(!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:a?"2px solid var(--mantine-color-blue-5)":"2px solid transparent",opacity:h?.8:i?.3:1,transition:"all 0.2s ease",cursor:s?"pointer":"default",...r},onMouseDown:p,onMouseUp:m,onMouseLeave:I,...f,children:n})};Mn.displayName="MatrixBlockRight";const Tn=({children:n,style:r,size:o="50px",blockId:s,isVisible:c=!0,isDimmed:i=!1,shouldShowBlueBorder:a=!1,onBlockClick:d,onBlockPress:l,...f})=>{const[h,g]=u.useState(!1),x=u.useRef(null),y=u.useRef(!1),p=()=>{!s||!l||(g(!0),y.current=!1,x.current=setTimeout(()=>{y.current=!0,l(s)},500))},m=()=>{s&&(g(!1),x.current&&(clearTimeout(x.current),x.current=null),!y.current&&d&&d(s),y.current=!1)},I=()=>{g(!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:a?"2px solid var(--mantine-color-blue-5)":"2px solid transparent",opacity:h?.8:i?.3:1,transition:"all 0.2s ease",cursor:s?"pointer":"default",...r},onMouseDown:p,onMouseUp:m,onMouseLeave:I,...f,children:n})};Tn.displayName="MatrixBlockUp";const On=({children:n,style:r,size:o="50px",blockId:s,isVisible:c=!0,isDimmed:i=!1,shouldShowBlueBorder:a=!1,onBlockClick:d,onBlockPress:l,...f})=>{const[h,g]=u.useState(!1),x=u.useRef(null),y=u.useRef(!1),p=()=>{!s||!l||(g(!0),y.current=!1,x.current=setTimeout(()=>{y.current=!0,l(s)},500))},m=()=>{s&&(g(!1),x.current&&(clearTimeout(x.current),x.current=null),!y.current&&d&&d(s),y.current=!1)},I=()=>{g(!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:a?"2px solid var(--mantine-color-blue-5)":"2px solid transparent",opacity:h?.8:i?.3:1,transition:"all 0.2s ease",cursor:s?"pointer":"default",...r},onMouseDown:p,onMouseUp:m,onMouseLeave:I,...f,children:n})};On.displayName="MatrixBlockDown";const Bn=({onLeftHover:n,onRightHover:r,onUpHover:o,onDownHover:s,showLeftControls:c=!1,showRightControls:i=!1,showUpControls:a=!1,showDownControls:d=!1})=>{const[l,f]=u.useState(!1),[h,g]=u.useState(!1),[x,y]=u.useState(!1),[p,m]=u.useState(!1),I=w=>{f(w),n==null||n(w)},b=w=>{g(w),r==null||r(w)},j=w=>{y(w),o==null||o(w)},S=w=>{m(w),s==null||s(w)};return e.jsxs(e.Fragment,{children:[c&&e.jsx(t.Box,{style:{position:"absolute",left:0,top:0,bottom:0,width:"80px",zIndex:5,pointerEvents:"auto",background:"transparent"},onMouseEnter:()=>I(!0),onMouseLeave:()=>I(!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)}),a&&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)}),d&&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)})]})};Bn.displayName="HoverZones";const zn=({onLeftPrevious:n,onLeftNext:r,leftCurrentPage:o=1,leftTotalPages:s=1,leftDisabled:c=!1,leftVisible:i=!1,onLeftHover:a,onRightPrevious:d,onRightNext:l,rightCurrentPage:f=1,rightTotalPages:h=1,rightDisabled:g=!1,rightVisible:x=!1,onRightHover:y,onUpPrevious:p,onUpNext:m,upCurrentPage:I=1,upTotalPages:b=1,upDisabled:j=!1,upVisible:S=!1,onUpHover:w,onDownPrevious:O,onDownNext:C,downCurrentPage:k=1,downTotalPages:v=1,downDisabled:R=!1,downVisible:D=!1,onDownHover:B,onLeftAdd:E,onRightAdd:N,onUpAdd:H,onDownAdd:F,size:P="md",inline:V=!1})=>{const U=()=>s<=1||c?null:e.jsxs(t.Stack,{gap:"xs",align:"center",children:[e.jsx(t.ActionIcon,{size:P,variant:"subtle",onClick:()=>n==null?void 0:n(),disabled:o<=1,color:"gray",radius:"md","aria-label":"Previous left blocks",children:e.jsx(M.IconChevronRight,{size:16,stroke:2})}),e.jsx(t.ActionIcon,{size:P,variant:"subtle",onClick:E,color:"blue",radius:"md","aria-label":"Add left blocks",children:e.jsx(M.IconPlus,{size:16,stroke:2})}),e.jsx(t.ActionIcon,{size:P,variant:"subtle",onClick:r,disabled:o>=s,color:"gray",radius:"md","aria-label":"Next left blocks",children:e.jsx(M.IconChevronLeft,{size:16,stroke:2})})]}),G=()=>h<=1||g?null:e.jsxs(t.Stack,{gap:"xs",align:"center",children:[e.jsx(t.ActionIcon,{size:P,variant:"subtle",onClick:d,disabled:f<=1,color:"gray",radius:"md","aria-label":"Previous right blocks",children:e.jsx(M.IconChevronLeft,{size:16,stroke:2})}),e.jsx(t.ActionIcon,{size:P,variant:"subtle",onClick:N,color:"blue",radius:"md","aria-label":"Add right blocks",children:e.jsx(M.IconPlus,{size:16,stroke:2})}),e.jsx(t.ActionIcon,{size:P,variant:"subtle",onClick:l,disabled:f>=h,color:"gray",radius:"md","aria-label":"Next right blocks",children:e.jsx(M.IconChevronRight,{size:16,stroke:2})})]}),$=()=>b<=1||j?null:e.jsxs(t.Group,{gap:"xs",align:"center",wrap:"nowrap",children:[e.jsx(t.ActionIcon,{size:P,variant:"subtle",onClick:p,disabled:I<=1,color:"gray",radius:"md","aria-label":"Previous up blocks",children:e.jsx(M.IconChevronDown,{size:16,stroke:2})}),e.jsx(t.ActionIcon,{size:P,variant:"subtle",onClick:H,color:"blue",radius:"md","aria-label":"Add up blocks",children:e.jsx(M.IconPlus,{size:16,stroke:2})}),e.jsx(t.ActionIcon,{size:P,variant:"subtle",onClick:m,disabled:I>=b,color:"gray",radius:"md","aria-label":"Next up blocks",children:e.jsx(M.IconChevronUp,{size:16,stroke:2})})]}),Q=()=>v<=1||R?null:e.jsxs(t.Group,{gap:"xs",align:"center",wrap:"nowrap",children:[e.jsx(t.ActionIcon,{size:P,variant:"subtle",onClick:O,disabled:k<=1,color:"gray",radius:"md","aria-label":"Previous down blocks",children:e.jsx(M.IconChevronDown,{size:16,stroke:2})}),e.jsx(t.ActionIcon,{size:P,variant:"subtle",onClick:F,color:"blue",radius:"md","aria-label":"Add down blocks",children:e.jsx(M.IconPlus,{size:16,stroke:2})}),e.jsx(t.ActionIcon,{size:P,variant:"subtle",onClick:C,disabled:k>=v,color:"gray",radius:"md","aria-label":"Next down blocks",children:e.jsx(M.IconChevronUp,{size:16,stroke:2})})]}),T=s>1&&!c,z=h>1&&!g,A=b>1&&!j,L=v>1&&!R;return!T&&!z&&!A&&!L?null:V?e.jsxs(e.Fragment,{children:[T&&i&&n&&r&&e.jsx("div",{onMouseEnter:()=>a==null?void 0:a(!0),onMouseLeave:()=>a==null?void 0:a(!1),children:U()}),z&&x&&d&&l&&e.jsx("div",{onMouseEnter:()=>y==null?void 0:y(!0),onMouseLeave:()=>y==null?void 0:y(!1),children:G()}),A&&S&&p&&m&&e.jsx("div",{onMouseEnter:()=>w==null?void 0:w(!0),onMouseLeave:()=>w==null?void 0:w(!1),children:$()}),L&&D&&O&&C&&e.jsx("div",{onMouseEnter:()=>B==null?void 0:B(!0),onMouseLeave:()=>B==null?void 0:B(!1),children:Q()})]}):e.jsxs(e.Fragment,{children:[T&&i&&n&&r&&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:()=>a==null?void 0:a(!0),onMouseLeave:()=>a==null?void 0:a(!1),children:U()}),z&&x&&d&&l&&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:G()}),A&&S&&p&&m&&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:$()}),e.jsx(t.Box,{style:{position:"absolute",bottom:"20px",left:"50%",transform:"translateX(-50%)",zIndex:10,pointerEvents:"auto",opacity:D?1:0,transition:"opacity 0.2s ease"},onMouseEnter:()=>B==null?void 0:B(!0),onMouseLeave:()=>B==null?void 0:B(!1),children:L&&D&&O&&C&&Q()})]})};zn.displayName="NavigationControls";const be=({direction:n,text:r,show:o,actions:s,currentPage:c,totalPages:i,disabled:a,hoverState:d,onHover:l})=>{if(!r)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:s.prev,onLeftNext:s.next,leftCurrentPage:c,leftTotalPages:i,leftDisabled:a,leftVisible:!0},right:{onRightPrevious:s.prev,onRightNext:s.next,rightCurrentPage:c,rightTotalPages:i,rightDisabled:a,rightVisible:!0},up:{onUpPrevious:s.prev,onUpNext:s.next,upCurrentPage:c,upTotalPages:i,upDisabled:a,upVisible:!0},down:{onDownPrevious:s.prev,onDownNext:s.next,downCurrentPage:c,downTotalPages:i,downDisabled:a,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:d?0:1,transition:"opacity 0.2s ease",position:"absolute"},children:r}),o&&e.jsx("div",{style:{opacity:d?1:0,transition:"opacity 0.2s ease",position:"absolute"},onMouseEnter:()=>l(!0),onMouseLeave:()=>l(!1),children:e.jsx(zn,{...h[n],size:"sm",showLabels:!0,inline:!0})})]})},yo=n=>{const{totalBlocksLeft:r=0,totalBlocksRight:o=0,totalBlocksUp:s=0,totalBlocksDown:c=0,visibleBlocksLeft:i=1,visibleBlocksRight:a=1,visibleBlocksUp:d=1,visibleBlocksDown:l=1}=n,f=u.useMemo(()=>{const p=Math.max(1,Math.ceil(r/i)),m=Math.max(1,Math.ceil(o/a)),I=Math.max(1,Math.ceil(s/d)),b=Math.max(1,Math.ceil(c/l));return{leftTotalPages:p,rightTotalPages:m,upTotalPages:I,downTotalPages:b,leftStartIndex:0,leftEndIndex:0,rightStartIndex:0,rightEndIndex:0,upStartIndex:0,upEndIndex:0,downStartIndex:0,downEndIndex:0}},[r,o,s,c,i,a,d,l]),[h,g]=u.useState({leftStartIndex:0,rightStartIndex:0,upStartIndex:0,downStartIndex:0}),x=u.useMemo(()=>{const{leftTotalPages:p,rightTotalPages:m,upTotalPages:I,downTotalPages:b}=f,j=Math.min(h.leftStartIndex,Math.max(0,r-i)),S=Math.min(j+i,r),w=Math.min(h.rightStartIndex,Math.max(0,o-a)),O=Math.min(w+a,o),C=Math.min(h.upStartIndex,Math.max(0,s-d)),k=Math.min(C+d,s),v=Math.min(h.downStartIndex,Math.max(0,c-l)),R=Math.min(v+l,c);return{leftTotalPages:p,rightTotalPages:m,upTotalPages:I,downTotalPages:b,leftStartIndex:j,leftEndIndex:S,rightStartIndex:w,rightEndIndex:O,upStartIndex:C,upEndIndex:k,downStartIndex:v,downEndIndex:R}},[h,f,i,a,d,l,r,o,s,c]),y={goToLeftPage:u.useCallback(p=>{const m=Math.max(0,(p-1)*i);g(I=>({...I,leftStartIndex:Math.min(m,Math.max(0,r-i))}))},[i,r]),goToRightPage:u.useCallback(p=>{const m=Math.max(0,(p-1)*a);g(I=>({...I,rightStartIndex:Math.min(m,Math.max(0,o-a))}))},[a,o]),goToUpPage:u.useCallback(p=>{const m=Math.max(0,(p-1)*d);g(I=>({...I,upStartIndex:Math.min(m,Math.max(0,s-d))}))},[d,s]),goToDownPage:u.useCallback(p=>{const m=Math.max(0,(p-1)*l);g(I=>({...I,downStartIndex:Math.min(m,Math.max(0,c-l))}))},[l,c]),nextLeftPage:u.useCallback(()=>{g(p=>({...p,leftStartIndex:Math.min(p.leftStartIndex+1,Math.max(0,r-i))}))},[r,i]),previousLeftPage:u.useCallback(()=>{g(p=>({...p,leftStartIndex:Math.max(p.leftStartIndex-1,0)}))},[]),nextRightPage:u.useCallback(()=>{g(p=>({...p,rightStartIndex:Math.min(p.rightStartIndex+1,Math.max(0,o-a))}))},[o,a]),previousRightPage:u.useCallback(()=>{g(p=>({...p,rightStartIndex:Math.max(p.rightStartIndex-1,0)}))},[]),nextUpPage:u.useCallback(()=>{g(p=>({...p,upStartIndex:Math.min(p.upStartIndex+1,Math.max(0,s-d))}))},[s,d]),previousUpPage:u.useCallback(()=>{g(p=>({...p,upStartIndex:Math.max(p.upStartIndex-1,0)}))},[]),nextDownPage:u.useCallback(()=>{g(p=>({...p,downStartIndex:Math.min(p.downStartIndex+1,Math.max(0,c-l))}))},[c,l]),previousDownPage:u.useCallback(()=>{g(p=>({...p,downStartIndex:Math.max(p.downStartIndex-1,0)}))},[])};return[h,y,x]},vo=(n,r=0,o=0,s=0,c=0)=>{const[i,a]=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 l=()=>{a({width:window.innerWidth,height:window.innerHeight})};return window.addEventListener("resize",l),()=>window.removeEventListener("resize",l)},[]),u.useMemo(()=>{const{gap:l,cellSize:f,minBlocksPerSide:h=2,maxBlocksPerSide:g=15,minBlocksLeft:x=1,maxBlocksLeft:y=8,minBlocksRight:p=1,maxBlocksRight:m=8,minBlocksUp:I=1,maxBlocksUp:b=8,minBlocksDown:j=1,maxBlocksDown:S=8,responsiveCellSize:w=!1,minCellSize:O="30px",maxCellSize:C="80px"}=n,k=parseFloat(l.replace("px","")),v=parseFloat(f.replace("px","")),R=i.width-k*4,D=i.height-k*4,B=v+k,E=Math.floor(R/(2*B)),N=v+k,H=Math.floor(D/N)+2,F=Math.min(E,H),P=Math.max(h,Math.min(g,F)),V=Math.max(x,Math.min(y,Math.floor(F/2))),U=Math.max(p,Math.min(m,Math.floor(F/2)));let G=f;if(w){const A=parseFloat(O.replace("px","")),L=parseFloat(C.replace("px","")),_=Math.min(R/(i.width*.8),D/(i.height*.8));G=`${Math.max(A,Math.min(L,v*_))}px`}const $=Math.min(i.width/1920,i.height/1080);let Q,T;if(s>0&&c>0){const A=Math.max(s,c);Q=Math.max(I,Math.min(b,A)),T=Q}else{const A=Math.max(I,j),L=Math.min(b,S),_=Math.max(A,Math.min(L,Math.ceil(A+(L-A)*$)));Q=_,T=_}if(Q+T+1>H){const A=Math.max(2,H-1);if(Math.max(I,j)*2>A){const _=Math.max(1,Math.floor(A/2));Q=_,T=_}else{const _=Math.max(I,j);Q=_,T=_}}return console.log("Responsive Matrix Debug:",{windowSize:i,screenSizeRatio:$,minBlocksUp:I,minBlocksDown:j,maxBlocksUp:b,maxBlocksDown:S,blocksUp:s,blocksDown:c,calculatedBlocksUp:Q,calculatedBlocksDown:T,totalVerticalBlocks:Q+T+1,isSymmetric:Q===T,availableHeight:D,maxBlocksVertical:H}),{blocksPerSide:P,blocksLeft:V,blocksRight:U,cellSize:G,blocksUp:Q,blocksDown:T}},[i,n,r,o,s,c])},jo=({gap:n,cellSize:r,blocksLeft:o,blocksRight:s,blocksUp:c,blocksDown:i,totalBlocksLeft:a,totalBlocksRight:d,totalBlocksUp:l,totalBlocksDown:f,responsive:h,minBlocksPerSide:g,maxBlocksPerSide:x,minBlocksLeft:y,maxBlocksLeft:p,minBlocksRight:m,maxBlocksRight:I,minBlocksUp:b,maxBlocksUp:j,minBlocksDown:S,maxBlocksDown:w,responsiveCellSize:O,minCellSize:C,maxCellSize:k})=>{const v=u.useMemo(()=>a!==void 0||d!==void 0||l!==void 0||f!==void 0,[a,d,l,f]),R=vo({gap:n,cellSize:r,minBlocksPerSide:g,maxBlocksPerSide:x,minBlocksLeft:y,maxBlocksLeft:p,minBlocksRight:m,maxBlocksRight:I,minBlocksUp:b,maxBlocksUp:j,minBlocksDown:S,maxBlocksDown:w,responsiveCellSize:O,minCellSize:C,maxCellSize:k},o??0,s??0,c,i),D=u.useMemo(()=>{let H=h?R.blocksLeft:o??0,F=h?R.blocksRight:s??0,P=h?R.blocksUp:c??0,V=h?R.blocksDown:i??0;if(!h){const U=parseFloat(n.replace("px","")),G=parseFloat(r.replace("px","")),$=typeof window<"u"?window.innerWidth-U*4:1920,Q=typeof window<"u"?window.innerHeight-U*4:1080,T=G+U,z=Math.floor($/(2*T)),A=Math.floor(Q/(2*T));H=Math.min(H,z),F=Math.min(F,z),P=Math.min(P,A),V=Math.min(V,A)}return{left:H,right:F,up:P,down:V}},[h,R,o,s,c,i,n,r]),B=u.useMemo(()=>{const H=v&&a?Math.min(D.left,a):D.left,F=v&&d?Math.min(D.right,d):D.right,P=v&&l?Math.min(D.up,l):D.up,V=v&&f?Math.min(D.down,f):D.down;return{left:H,right:F,up:P,down:V}},[v,D,a,d,l,f]),E=h?R.cellSize:r,N=u.useMemo(()=>{const H=(B.left>0?B.left:0)+1+(B.right>0?B.right:0),F=B.up>0||B.down>0?B.up+1+B.down:1,P=`${E} `.repeat(B.left)+"1fr "+`${E} `.repeat(B.right),V=B.up>0||B.down>0?`${E} `.repeat(B.up)+"1fr "+`${E} `.repeat(B.down):"1fr";return{totalColumns:H,totalRows:F,gridTemplateColumns:P.trim(),gridTemplateRows:V.trim()}},[B,E]);return{usePagination:v,visibleBlocks:D,finalBlocks:B,finalCellSize:E,gridDimensions:N}},bo=({blockItems:n})=>{const r=u.useMemo(()=>n.reduce((c,i)=>(c[i.id]=i,c),{}),[n]);return{getBlockContent:(c,i)=>{const a=`${c}-${i}`,d=r[a];return d?d.content:u.createElement("div",{style:{padding:"4px",textAlign:"center",fontSize:"10px",writingMode:c==="left"||c==="right"?"vertical-rl":"horizontal-tb",textOrientation:"mixed",width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center",overflow:"hidden"}})},getIntersectionText:(c,i,a,d)=>{const l=[];if(c!==null){const f=r[`left-${c}`];l.push(f?`left-${c}`:`left${c+1}`)}if(i!==null){const f=r[`right-${i}`];l.push(f?`right-${i}`:`right${i+1}`)}if(a!==null){const f=r[`up-${a}`];l.push(f?`up-${a}`:`up${a+1}`)}if(d!==null){const f=r[`down-${d}`];l.push(f?`down-${d}`:`down${d+1}`)}return l.join(", ")}}},wo=({blockConnections:n})=>{const r=u.useMemo(()=>{const s=new Map;return n.forEach(c=>{const i=`${c.source}-${c.target}`,a=`${c.target}-${c.source}`;s.set(i,c),s.set(a,c)}),s},[n]);return{getConnectionStateFromText:s=>{const c=s.split(", ").map(i=>i.trim());for(let i=0;i<c.length;i++)for(let a=i+1;a<c.length;a++){const d=c[i],l=c[a],f=`${d}-${l}`,h=r.get(f);if(h)return h.type}return"empty"}}},So=({usePagination:n,totalBlocksLeft:r,totalBlocksRight:o,totalBlocksUp:s,totalBlocksDown:c,paginationActions:i,paginationState:a,paginationInfo:d})=>{const[l,f]=u.useState({left:!1,right:!1,up:!1,down:!1}),h=(x,y)=>{f(p=>({...p,[x]:y}))};return{hoverStates:l,handleHover:h,getNavigationControlProps:x=>{const y={left:r,right:o,up:s,down:c}[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],m={left:a.leftStartIndex,right:a.rightStartIndex,up:a.upStartIndex,down:a.downStartIndex}[x],I={left:d.leftTotalPages,right:d.rightTotalPages,up:d.upTotalPages,down:d.downTotalPages}[x];return{show:n&&!!y,totalBlocks:y,actions:p,currentPage:m+1,totalPages:I,disabled:!y,hoverState:l[x],onHover:b=>h(x,b)}}}},ko=({blockItems:n,blockConnections:r})=>{const[o,s]=u.useState(null),[c,i]=u.useState(!1),a=u.useMemo(()=>{const m=new Map;return r.forEach(I=>{const b=`${I.source}-${I.target}`,j=`${I.target}-${I.source}`;m.set(b,I),m.set(j,I)}),m},[r]),d=u.useCallback(m=>{const I=[];return n.forEach(b=>{if(b.id!==m){const j=`${m}-${b.id}`;a.has(j)&&I.push(b.id)}}),I},[n,a]),l=u.useCallback(m=>{const I=n.find(S=>S.id===m);if(!I)return[];const b=d(m),j=[m];switch(I.type){case"up":b.forEach(S=>{const w=n.find(O=>O.id===S);w&&(w.type==="left"||w.type==="right")&&(j.push(S),d(S).forEach(C=>{const k=n.find(v=>v.id===C);k&&k.type==="down"&&j.push(C)}))});break;case"down":b.forEach(S=>{const w=n.find(O=>O.id===S);w&&(w.type==="left"||w.type==="right")&&(j.push(S),d(S).forEach(C=>{const k=n.find(v=>v.id===C);k&&k.type==="up"&&j.push(C)}))});break;case"left":b.forEach(S=>{const w=n.find(O=>O.id===S);w&&(w.type==="up"||w.type==="down")&&(j.push(S),d(S).forEach(C=>{const k=n.find(v=>v.id===C);k&&k.type==="right"&&j.push(C)}))});break;case"right":b.forEach(S=>{const w=n.find(O=>O.id===S);w&&(w.type==="up"||w.type==="down")&&(j.push(S),d(S).forEach(C=>{const k=n.find(v=>v.id===C);k&&k.type==="left"&&j.push(C)}))});break}return[...new Set(j)]},[n,d]),f=u.useCallback(m=>!0,[]),h=u.useCallback(m=>!c||!o?!1:!l(o).includes(m),[c,o,l]),g=u.useCallback(m=>!c||!o?!1:l(o).includes(m),[c,o,l]),x=u.useCallback(m=>{c&&o===m?(i(!1),s(null)):(s(m),i(!0))},[c,o]),y=u.useCallback(m=>{console.log(`Block clicked: ${m}`)},[]),p=u.useCallback(()=>{i(!1),s(null)},[]);return{selectedBlockId:o,isFiltering:c,isBlockVisible:f,isBlockDimmed:h,shouldShowBlueBorder:g,handleBlockPress:x,handleBlockClick:y,clearFiltering:p,getFilteredBlockIds:l}},qe=n=>parseInt(n.replace(/[^\d]/g,""),10)||0,Co=(n,r)=>{const[o,s]=u.useState({width:0,height:0}),c=u.useCallback(()=>{const{width:i,height:a}=o;if(i===0||a===0)return{blocksUp:r.minVerticalBlocks/2,blocksDown:r.minVerticalBlocks/2,blocksLeft:r.minHorizontalBlocks/2,blocksRight:r.minHorizontalBlocks/2,containerWidth:i,containerHeight:a};const d=qe(r.cellSize),l=qe(r.gap),f=d+l,h=i-l*2,g=a-l*2,x=Math.floor(g*r.verticalMaxPercent/100/f),y=Math.floor(h*r.horizontalMaxPercent/100/f),p=Math.floor(g*r.verticalMinPercent/100/f),m=Math.floor(h*r.horizontalMinPercent/100/f),I=Math.max(r.minVerticalBlocks,p),b=Math.max(r.minHorizontalBlocks,m),j=Math.max(I,x),S=Math.max(b,y),w=Math.floor(j/2),O=Math.floor(j/2),C=Math.floor(S/2),k=Math.floor(S/2);return{blocksUp:w,blocksDown:O,blocksLeft:C,blocksRight:k,containerWidth:i,containerHeight:a}},[o,r]);return u.useEffect(()=>{const i=()=>{if(n.current){const d=n.current.getBoundingClientRect();s({width:d.width,height:d.height})}};i();const a=new ResizeObserver(i);return n.current&&a.observe(n.current),()=>{a.disconnect()}},[n]),c()},Mo={verticalMinPercent:20,verticalMaxPercent:50,horizontalMinPercent:30,horizontalMaxPercent:50,minVerticalBlocks:2,minHorizontalBlocks:4,cellSize:"50px",gap:"8px"},Rn=({children:n,style:r,gap:o="8px",cellSize:s="50px",verticalBlocks:c,horizontalBlocks:i,responsiveConfig:a,enableResponsive:d=!1,blocksLeft:l,blocksRight:f,blocksUp:h=0,blocksDown:g=0,blockItems:x=[],blockConnections:y=[],enableFiltering:p=!1,onBlockClick:m,totalBlocksLeft:I,totalBlocksRight:b,totalBlocksUp:j,totalBlocksDown:S,usePagination:w=!1,responsive:O=!1,minBlocksPerSide:C=2,maxBlocksPerSide:k=15,minBlocksHorizontal:v=2,maxBlocksHorizontal:R=16,minBlocksVertical:D=2,maxBlocksVertical:B=16,minBlocksLeft:E=1,maxBlocksLeft:N=8,minBlocksRight:H=1,maxBlocksRight:F=8,minBlocksUp:P=1,maxBlocksUp:V=8,minBlocksDown:U=1,maxBlocksDown:G=8,responsiveCellSize:$=!1,minCellSize:Q="30px",maxCellSize:T="80px",directionTexts:z,...A})=>{const L=u.useRef(null),_=Co(L,{...Mo,cellSize:s,gap:o,...a});let ne=l,W=f,oe=h,X=g;d?(ne=Math.floor(_.blocksLeft),W=Math.floor(_.blocksRight),oe=Math.floor(_.blocksUp),X=Math.floor(_.blocksDown)):(c!==void 0||i!==void 0)&&(c!==void 0&&(oe=Math.floor(c/2),X=Math.floor(c/2)),i!==void 0&&(ne=Math.floor(i/2),W=Math.floor(i/2)));const de=E!==1?E:Math.floor(v/2),Oe=N!==8?N:Math.floor(R/2),Be=H!==1?H:Math.ceil(v/2),re=F!==8?F:Math.ceil(R/2),he=P!==1?P:Math.floor(D/2),Ie=V!==8?V:Math.floor(B/2),Un=U!==1?U:Math.ceil(D/2),Nn=G!==8?G:Math.ceil(B/2),{usePagination:Wn,finalBlocks:Y,finalCellSize:ae,gridDimensions:ye}=jo({gap:o,cellSize:s,blocksLeft:ne,blocksRight:W,blocksUp:oe,blocksDown:X,totalBlocksLeft:I,totalBlocksRight:b,totalBlocksUp:j,totalBlocksDown:S,responsive:O,minBlocksPerSide:C,maxBlocksPerSide:k,minBlocksLeft:de,maxBlocksLeft:Oe,minBlocksRight:Be,maxBlocksRight:re,minBlocksUp:he,maxBlocksUp:Ie,minBlocksDown:Un,maxBlocksDown:Nn,responsiveCellSize:$,minCellSize:Q,maxCellSize:T}),{getBlockContent:ve,getIntersectionText:$n}=bo({blockItems:x}),{getConnectionStateFromText:Hn}=wo({blockConnections:y}),q=ko({blockItems:x,blockConnections:y});u.useEffect(()=>{if(!p)return;const ze=J=>{J.key==="Escape"&&q.clearFiltering()};return window.addEventListener("keydown",ze),()=>window.removeEventListener("keydown",ze)},[p,q]);const[ie,Gn,Vn]=yo({totalBlocksLeft:I??0,totalBlocksRight:b??0,totalBlocksUp:j??0,totalBlocksDown:S??0,visibleBlocksLeft:Y.left,visibleBlocksRight:Y.right,visibleBlocksUp:Y.up,visibleBlocksDown:Y.down}),{getNavigationControlProps:ue}=So({usePagination:Wn,totalBlocksLeft:I,totalBlocksRight:b,totalBlocksUp:j,totalBlocksDown:S,paginationActions:Gn,paginationState:ie,paginationInfo:Vn});return e.jsxs(t.Box,{ref:L,style:{display:"grid",gridTemplateColumns:ye.gridTemplateColumns,gridTemplateRows:ye.gridTemplateRows,width:"100vw",height:"100vh",maxWidth:"100vw",maxHeight:"100vh",padding:o,boxSizing:"border-box",gap:o,overflow:"hidden",...r},...A,children:[Array.from({length:ye.totalRows},(ze,J)=>Array.from({length:ye.totalColumns},(Qo,te)=>{const Re=Y.up>0?J===Y.up:J===0,De=te===Y.left;if(Re&&De)return e.jsxs(Sn,{style:{width:"100%",height:"100%",maxWidth:"none",maxHeight:"none",position:"relative"},children:[n,e.jsx(be,{direction:"left",text:z==null?void 0:z.left,...ue("left")}),e.jsx(be,{direction:"right",text:z==null?void 0:z.right,...ue("right")}),e.jsx(be,{direction:"up",text:z==null?void 0:z.up,...ue("up")}),e.jsx(be,{direction:"down",text:z==null?void 0:z.down,...ue("down")}),w&&e.jsx(Bn,{showLeftControls:!!I,showRightControls:!!b,showUpControls:!!j,showDownControls:!!S,onLeftHover:Z=>ue("left").onHover(Z),onRightHover:Z=>ue("right").onHover(Z),onUpHover:Z=>ue("up").onHover(Z),onDownHover:Z=>ue("down").onHover(Z)})]},`center-${J}-${te}`);if(Re&&te<Y.left){const Z=w&&I?ie.leftStartIndex+te:te,ee=`left-${Z}`;return e.jsx(Cn,{size:ae,blockId:p?ee:void 0,isVisible:p?q.isBlockVisible(ee):!0,isDimmed:p?q.isBlockDimmed(ee):!1,shouldShowBlueBorder:p?q.shouldShowBlueBorder(ee):!1,onBlockClick:p?q.handleBlockClick:m,onBlockPress:p?q.handleBlockPress:void 0,children:ve("left",Z)},`left-${te}`)}if(Re&&te>Y.left){const Z=te-Y.left-1,ee=w&&b?ie.rightStartIndex+(Y.right-1-Z):Y.right-1-Z,ce=`right-${ee}`;return e.jsx(Mn,{size:ae,blockId:p?ce:void 0,isVisible:p?q.isBlockVisible(ce):!0,isDimmed:p?q.isBlockDimmed(ce):!1,shouldShowBlueBorder:p?q.shouldShowBlueBorder(ce):!1,onBlockClick:p?q.handleBlockClick:m,onBlockPress:p?q.handleBlockPress:void 0,children:ve("right",ee)},`right-${Z}`)}if(De&&J<Y.up){const Z=w&&j?ie.upStartIndex+J:J,ee=`up-${Z}`;return e.jsx(Tn,{size:ae,blockId:p?ee:void 0,isVisible:p?q.isBlockVisible(ee):!0,isDimmed:p?q.isBlockDimmed(ee):!1,shouldShowBlueBorder:p?q.shouldShowBlueBorder(ee):!1,onBlockClick:p?q.handleBlockClick:m,onBlockPress:p?q.handleBlockPress:void 0,children:ve("up",Z)},`up-${J}`)}if(De&&J>Y.up){const Z=J-Y.up-1,ee=w&&S?ie.downStartIndex+Z:Z,ce=`down-${ee}`;return e.jsx(On,{size:ae,blockId:p?ce:void 0,isVisible:p?q.isBlockVisible(ce):!0,isDimmed:p?q.isBlockDimmed(ce):!1,shouldShowBlueBorder:p?q.shouldShowBlueBorder(ce):!1,onBlockClick:p?q.handleBlockClick:m,onBlockPress:p?q.handleBlockPress:void 0,children:ve("down",ee)},`down-${Z}`)}const Ee=te<Y.left?te:null,je=te>Y.left?te-Y.left-1:null,Ae=J<Y.up?J:null,Pe=J>Y.up?J-Y.up-1:null,_n=w&&I&&Ee!==null?ie.leftStartIndex+Ee:Ee,Qn=w&&b&&je!==null?ie.rightStartIndex+(Y.right-1-je):je!==null?Y.right-1-je:null,Yn=w&&j&&Ae!==null?ie.upStartIndex+Ae:Ae,qn=w&&S&&Pe!==null?ie.downStartIndex+Pe:Pe,Le=$n(_n,Qn,Yn,qn);if(Le&&Le.length>0){const Z=Hn(Le);return e.jsx(kn,{size:ae,state:Z,interactive:!1},`intersection-${J}-${te}`)}return e.jsx("div",{style:{width:ae,height:ae,minWidth:ae,minHeight:ae}},`empty-${J}-${te}`)})).flat(),p&&q.isFiltering&&e.jsx(t.Box,{style:{position:"fixed",top:12,right:12,background:"rgba(255, 255, 255, 0.9)",color:"var(--mantine-color-dark-7)",padding:"8px 12px",borderRadius:"8px",boxShadow:"0 2px 10px rgba(0,0,0,0.12)",fontSize:12,fontWeight:600,pointerEvents:"none",zIndex:1e3},children:"Press Esc to clear filter"})]})};Rn.displayName="Matrix";const To=({opened:n,onClose:r,children:o,...s})=>e.jsxs(t.Modal,{withCloseButton:!1,opened:n,onClose:r,size:"70%",centered:!0,overlayProps:{backgroundOpacity:.55},styles:{content:{minHeight:"100%"}},padding:"md",...s,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(K,{icon:M.IconMaximize,size:"md",onClick:()=>{}})}),e.jsxs(t.Group,{justify:"space-between",gap:"xs",children:[e.jsx(K,{icon:M.IconStar,size:"md",onClick:()=>{}}),e.jsx(K,{icon:M.IconDots,size:"md",onClick:()=>{}})]})]}),o]}),Dn=({opened:n,onClose:r,editable:o,content:s,position:c="right",size:i="xl",onMaximize:a,rightCornerActions:d,headerProps:l,propertiesProps:f})=>{var w,O;const[h,g]=u.useState(!1),x=(f==null?void 0:f.hiddenProperties)&&f.hiddenProperties.length>0,[y,p]=u.useState(!1),[m,I]=u.useState(l==null?void 0:l.avatar),[b,j]=u.useState(!1);u.useEffect(()=>{I(l==null?void 0:l.avatar)},[l==null?void 0:l.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 C={type:"emoji",value:"😊"};I(C),(k=l==null?void 0:l.onAvatarChange)==null||k.call(l,C)},children:e.jsxs(t.Box,{style:{display:"flex",alignItems:"center",justifyContent:"center",gap:6},children:[e.jsx(M.IconMoodSmileFilled,{size:16}),e.jsx(t.Text,{size:"sm",fw:500,children:"Add avatar"})]})});return e.jsxs(t.Drawer,{opened:n,onClose:r,position:c,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(K,{icon:M.IconChevronsRight,size:"md",onClick:r}),e.jsx(K,{icon:M.IconMaximize,size:"md",onClick:()=>a()})]}),e.jsx(t.Group,{justify:"space-between",gap:"xs",children:d})]}),e.jsxs(t.Box,{p:"3rem",children:[l&&e.jsxs(t.Box,{children:[e.jsx(t.Box,{onMouseEnter:()=>p(!0),onMouseLeave:()=>p(!1),children:m?e.jsx(In,{editable:o,avatar:m,size:"xl",opened:b,onOpen:()=>j(!0),onClose:()=>j(!1),onAvatarSelect:C=>{var k;I(C),(k=l==null?void 0:l.onAvatarChange)==null||k.call(l,C)},onRemove:()=>{I(void 0)}}):e.jsx(t.Box,{h:24,children:y&&S})}),o?e.jsx(rn,{value:l.title||"",onChange:C=>{var k;return(k=l.onTitleChange)==null?void 0:k.call(l,C)},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})})]}),e.jsx(t.Stack,{gap:"sm",children:(w=f==null?void 0:f.visibleProperties)==null?void 0:w.map((C,k)=>e.jsx(t.Box,{children:C},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:()=>g(!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(M.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:(O=f==null?void 0:f.hiddenProperties)==null?void 0:O.map((C,k)=>e.jsx(t.Box,{children:C},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:()=>g(!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(M.IconChevronUp,{size:16,color:"var(--mantine-color-blue-5)"})]})})}),s]})]})},Oo=({children:n})=>e.jsx(t.Box,{style:{minHeight:"100vh",width:"100%",maxWidth:"100%",margin:"0 auto"},id:"full-page",children:n}),En=u.createContext(void 0),An=({children:n})=>{const[r,{toggle:o,open:s,close:c}]=xe.useDisclosure(!0),[i,{toggle:a,open:d,close:l}]=xe.useDisclosure(!1),[f,{open:h,close:g}]=xe.useDisclosure(!1),[x,y]=u.useState(300),[p,m]=u.useState(500),I={opened:r,toggle:o,open:s,close:c,asideOpened:i,toggleAside:a,openAside:d,closeAside:l,sidebarWidth:x,setSidebarWidth:y,asideWidth:p,setAsideWidth:m,openedNotificationSidebar:f,openNotificationSidebar:h,closeNotificationSidebar:g};return e.jsx(En.Provider,{value:I,children:n})},Ve=()=>{const n=u.useContext(En);if(n===void 0)throw new Error("useAppLayout must be used within an AppLayoutProvider");return n},Pn=({header:n,navbar:r,aside:o,children:s,...c})=>{const{opened:i,asideOpened:a,sidebarWidth:d,asideWidth:l}=Ve();return e.jsxs(t.AppShell,{header:{height:n?60:0},navbar:{width:i?d:0,breakpoint:"sm",collapsed:{mobile:!0}},aside:{width:a?l:0,breakpoint:"sm",collapsed:{mobile:!0}},padding:0,...c,children:[n&&e.jsx(t.AppShell.Header,{children:n}),e.jsx(t.AppShell.Navbar,{style:{display:i?"block":"none",width:i?d:0,border:"none"},children:r}),e.jsx(t.AppShell.Aside,{style:{display:a?"block":"none",width:a?l:0},children:o}),e.jsx(t.AppShell.Main,{children:s})]})},Bo=({items:n,selectedId:r,onSelect:o})=>e.jsx(t.Stack,{gap:0,children:n.map(s=>{var c;return e.jsx(We,{label:s.label,isActive:r===s.id,noChild:!s.children||s.children.length===0,onClick:()=>(!s.children||s.children.length===0)&&(o==null?void 0:o(s.id)),children:(c=s.children)==null?void 0:c.map(i=>e.jsx(We,{label:i.label,noChild:!0,level:4,isActive:r===i.id,onClick:()=>o==null?void 0:o(i.id)},i.id))},s.id)})}),zo=({items:n,selectedId:r,onSelect:o,headerLeft:s,headerRight:c,renderPreview:i,renderAside:a,sidebarTitle:d="Documentation",topNavItems:l,selectedTopNavId:f,onTopNavSelect:h})=>{const{opened:g,toggle:x}=Ve(),[y,p]=u.useState(r),m=r??y,I=b=>{o==null||o(b),r===void 0&&p(b)};return e.jsx(Pn,{header:l?e.jsx($e,{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:g&&e.jsx(t.Text,{fw:600,size:"sm",children:d})})})}):void 0,navbar:e.jsx($e,{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:g&&e.jsx(t.Text,{fw:600,size:"sm",children:d})}),e.jsx(K,{icon:g?M.IconChevronsLeft:M.IconChevronsRight,size:"md",onClick:x})]}),body:g&&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(Bo,{items:n,selectedId:m,onSelect:I})}),footer:e.jsx(e.Fragment,{})}),aside:e.jsx(t.Box,{p:"md",h:"100%",children:a==null?void 0:a(m)}),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:[!g&&e.jsx(K,{icon:M.IconChevronsRight,size:"md",variant:"subtle",tooltip:"Open sidebar",onClick:x}),s??e.jsx(He,{label:m||"Select a topic",onClick:()=>{}})]}),!l&&c]}),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(m)})})]})})},Ro=n=>e.jsx(An,{children:e.jsx(zo,{...n})}),Ln=({editable:n=!1,children:r,label:o,icon:s,value:c,className:i,style:a,...d})=>{const l={className:i,style:a};return xe.useMediaQuery("(max-width: 550px)",!1,{getInitialValueInEffect:!0})?e.jsxs(t.Stack,{gap:0,w:"100%",...l,children:[e.jsxs(t.Box,{style:{display:"flex",alignItems:"center",gap:8},h:"auto",children:[s&&e.jsx(s,{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&&r?r:c})]}):e.jsxs(t.Group,{align:"flex-start",gap:0,w:"100%",...d,...l,children:[e.jsxs(t.Box,{w:"30%",style:{display:"flex",alignItems:"center",gap:8},h:"40px",children:[s&&e.jsx(s,{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&&r?r:c})]})},Do=300,Eo=({users:n,onSearch:r,debounceSearch:o=!0,debounceDelay:s=Do})=>{const[c,i]=u.useState(""),[a,d]=u.useState(n),[l,f]=u.useState(!1),h=u.useRef(null);return u.useEffect(()=>{if(!r){d(n);return}if(h.current&&clearTimeout(h.current),c.trim()){const g=async()=>{f(!0);try{const x=await r(c);d(x)}catch(x){console.error("Search error:",x)}finally{f(!1)}};o?h.current=setTimeout(g,s):g()}else d(n),f(!1);return()=>{h.current&&clearTimeout(h.current)}},[c,r,o,s,n]),u.useEffect(()=>{(!c.trim()||!r)&&d(n)},[n,c,r]),{searchQuery:c,setSearchQuery:i,displayedUsers:a,setDisplayedUsers:d,isSearching:l}},Ao=({value:n,multiple:r,users:o,displayedUsers:s,searchQuery:c,onSearch:i})=>{const a=u.useMemo(()=>r?Array.isArray(n)?n:[]:n?[n]:[],[n,r]),d=u.useMemo(()=>o.filter(h=>a.includes(h.id)),[o,a]),l=u.useMemo(()=>{if(!c.trim()||i)return s;const h=c.toLowerCase();return s.filter(g=>g.name.toLowerCase().includes(h)||g.email.toLowerCase().includes(h))},[s,c,i]),f=u.useMemo(()=>{const h=l.filter(y=>a.includes(y.id)),g=l.filter(y=>!a.includes(y.id)),x=d.filter(y=>!l.some(p=>p.id===y.id));return[...h,...x,...g]},[l,a,d]);return{selectedIds:a,selectedUsers:d,sortedUsers:f}},Po=({isFocused:n,dropdownRef:r})=>{const[o,s]=u.useState("bottom"),c=u.useCallback(i=>{if(r.current=i,i){const a=i.dataset.position;a==="top"||a==="bottom"?s(a):requestAnimationFrame(()=>{if(i.dataset.position){const d=i.dataset.position;(d==="top"||d==="bottom")&&s(d)}})}},[r]);return u.useLayoutEffect(()=>{if(!n||!r.current)return;const i=()=>{if(r.current){const l=r.current.dataset.position;(l==="top"||l==="bottom")&&s(l)}};i();const a=requestAnimationFrame(i),d=new MutationObserver(()=>{i()});return r.current&&d.observe(r.current,{attributes:!0,attributeFilter:["data-position"]}),()=>{cancelAnimationFrame(a),d.disconnect()}},[n,r]),{placement:o,dropdownRefCallback:c}},Lo=({onLoadMore:n,hasMore:r,loading:o,setDisplayedUsers:s})=>{const c=u.useRef(null);return u.useEffect(()=>{if(!n||!r||o)return;const i=new IntersectionObserver(a=>{a[0].isIntersecting&&r&&!o&&n().then(d=>{s(l=>[...l,...d])})},{threshold:.1});return c.current&&i.observe(c.current),()=>{i.disconnect()}},[n,r,o,s]),{loadMoreRef:c}},Fo=({combobox:n,dropdownRef:r})=>{const[o,s]=u.useState(!1),[c,i]=u.useState(!1),a=u.useCallback(()=>{s(!0),n.openDropdown()},[n]),d=u.useCallback(h=>{setTimeout(()=>{const g=h==null?void 0:h.relatedTarget;g&&r.current&&r.current.contains(g)||n.dropdownOpened||s(!1)},0)},[n,r]),l=u.useCallback(()=>{i(!0)},[]),f=u.useCallback(()=>{i(!1)},[]);return{isFocused:o,setIsFocused:s,isHovered:c,handleFocus:a,handleBlur:d,handleMouseEnter:l,handleMouseLeave:f}},Uo=({multiple:n,value:r,onChange:o,combobox:s})=>{const c=u.useCallback(a=>{if(n){const d=Array.isArray(r)?r:[],l=d.includes(a)?d.filter(f=>f!==a):[...d,a];o==null||o(l)}else o==null||o(a),s.closeDropdown()},[n,r,o,s]),i=u.useCallback(a=>{if(n){const d=Array.isArray(r)?r:[];o==null||o(d.filter(l=>l!==a))}else o==null||o("")},[n,r,o]);return{handleSelect:c,handleRemove:i}},No="40px",Wo=300,Ne=({editable:n=!1,label:r,icon:o,value:s,users:c=[],onChange:i,placeholder:a="Select users",multiple:d=!1,disabled:l=!1,onSearch:f,debounceSearch:h=!0,debounceDelay:g=Wo,onLoadMore:x,hasMore:y=!1,loading:p=!1})=>{const m=u.useRef(null),I=u.useRef(null),b=u.useRef(null),{searchQuery:j,setSearchQuery:S,displayedUsers:w,setDisplayedUsers:O,isSearching:C}=Eo({users:c,onSearch:f,debounceSearch:h,debounceDelay:g}),k=t.useCombobox({onDropdownClose:()=>{k.resetSelectedOption(),S(""),R(!1)},onDropdownOpen:()=>{k.updateSelectedOptionIndex("active"),R(!0)}}),{isFocused:v,setIsFocused:R,isHovered:D,handleFocus:B,handleBlur:E,handleMouseEnter:N,handleMouseLeave:H}=Fo({combobox:k,dropdownRef:b}),{placement:F,dropdownRefCallback:P}=Po({isFocused:v,dropdownRef:b}),{selectedIds:V,selectedUsers:U,sortedUsers:G}=Ao({value:s,multiple:d,users:c,displayedUsers:w,searchQuery:j,onSearch:f}),{loadMoreRef:$}=Lo({onLoadMore:x,hasMore:y,loading:p,setDisplayedUsers:O}),{handleSelect:Q,handleRemove:T}=Uo({multiple:d,value:s,onChange:i,combobox:k}),z=()=>{if(!d)return null;const W=5,oe=U.slice(0,W),X=U.length-W;return e.jsxs(t.Group,{gap:"xs",children:[oe.map(de=>e.jsx(we,{avatar:de.avatar,name:de.name,withRemoveButton:v,onRemove:()=>T(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(M.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(d)return null;const W=U[0];return W?e.jsx(we,{avatar:W.avatar,name:W.name}):null},L=()=>v?"var(--mantine-color-gray-2)":"var(--mantine-color-gray-0)",_=()=>({input:{position:v?"absolute":"relative",zIndex:v?1e3:1,fontWeight:"400",color:"var(--mantine-color-gray-9)",cursor:l?"not-allowed":"pointer",backgroundColor:v||D?"var(--mantine-color-gray-0)":"transparent",border:v?"1px solid var(--mantine-color-gray-2)":"1px solid transparent",borderRadius:v&&F==="bottom"?"var(--mantine-radius-md) var(--mantine-radius-md) 0 0":v&&F==="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:d?"wrap":"nowrap",boxShadow:v&&F==="bottom"?"0 -4px 10px 0 rgba(0, 0, 0, 0.1)":v&&F==="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(Ln,{editable:n,label:r,icon:o,value:e.jsx(t.Group,{gap:"sm",wrap:"nowrap",style:{alignItems:"center"},w:"100%",h:40,p:"14px",children:U.map(W=>e.jsx(we,{avatar:W.avatar,name:W.name,withRemoveButton:v,onRemove:()=>T(W.id)},W.id))}),children:e.jsxs(t.Combobox,{store:k,onOptionSubmit:Q,withinPortal:!1,offset:-2,children:[e.jsx(t.Combobox.DropdownTarget,{children:e.jsx(t.PillsInput,{onClick:()=>!l&&k.openDropdown(),radius:"md",disabled:l,styles:_,onFocus:B,onBlur:E,onMouseEnter:()=>!l&&N(),onMouseLeave:H,w:"100%",children:e.jsxs(t.Pill.Group,{styles:ne,children:[d?z():A(),e.jsx(t.Combobox.EventsTarget,{children:e.jsx(t.PillsInput.Field,{ref:m,onFocus:B,onBlur:E,placeholder:U.length===0||v||j.length>0?a:"",value:j,onChange:W=>{k.updateSelectedOptionIndex(),S(W.currentTarget.value)},onMouseDown:W=>{W.stopPropagation()},onKeyDown:W=>{W.key==="Backspace"&&j.length===0&&(W.preventDefault(),d&&U.length>0?T(U[U.length-1].id):!d&&U.length>0&&T(U[0].id))},pointer:!0,disabled:l,styles:{field:{minWidth:v||j.length>0||U.length===0?"60px":"0px",width:v||j.length>0||U.length===0?"auto":"0px",flex:v||j.length>0||U.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||U.length===0?"auto":"0px",minHeight:v||j.length>0||U.length===0?"auto":"0px","&::placeholder":{opacity:U.length===0||v||j.length>0?1:0,display:U.length===0||v||j.length>0?"block":"none",color:"var(--mantine-color-gray-9)",lineHeight:"24px"}}}})})]})})}),e.jsx(t.Combobox.Dropdown,{styles:{dropdown:{borderRadius:F==="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 ${L()}`,marginTop:"0",padding:"4px",boxShadow:F==="bottom"?"0 4px 10px 0 rgba(0, 0, 0, 0.1)":"0 -4px 10px 0 rgba(0, 0, 0, 0.1)"}},ref:P,children:e.jsx(t.Combobox.Options,{children:e.jsx(t.ScrollArea,{ref:I,h:Math.min(G.length*parseFloat(No),300),scrollbarSize:6,children:e.jsxs(t.Stack,{gap:2,children:[G.map(W=>{const oe=V.includes(W.id);return e.jsx(t.Combobox.Option,{value:W.id,active:oe,onMouseDown:X=>{X.preventDefault(),Q(W.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:W.avatar,size:24,placeholder:W.name,showPlaceholder:!0}),e.jsx(t.Text,{size:"sm",fw:400,truncate:!0,children:W.name}),oe&&e.jsx(M.IconCheck,{size:16,color:"var(--mantine-color-blue-6)"})]})},W.id)}),(C||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:$,style:{height:"20px"}}),G.length===0&&!C&&!p&&e.jsx(t.Box,{style:{padding:"24px",textAlign:"center"},children:e.jsx(t.Text,{size:"sm",c:"dimmed",children:"No users found"})})]})})})})]})})},$o=({label:n,icon:r,value:o,onChange:s,editable:c=!1,placeholder:i,disabled:a=!1,minRows:d=1,maxRows:l,autosize:f=!0})=>{const[h,g]=u.useState(!1),[x,y]=u.useState(!1),p={wrapper:{...!f&&{height:"40px",minHeight:"40px",boxSizing:"border-box"},borderRadius:"var(--mantine-radius-md)"},input:{backgroundColor:h||x?"var(--mantine-color-gray-0)":"transparent",color:"var(--mantine-color-gray-9)",border:h?"1px solid var(--mantine-color-gray-2)":"1px solid transparent",borderRadius:"var(--mantine-radius-md)",width:"100%",cursor:"pointer",...!f&&{height:"40px",minHeight:"40px",boxSizing:"border-box"},padding:"8px 14px",lineHeight:f?"1.5":"24px",fontWeight:450}};return e.jsx(Ln,{editable:c,label:n,icon:r,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||i||"—"})}),children:e.jsx(t.Box,{w:"100%",style:{boxShadow:h?"var(--mantine-shadow-sm)":"none",borderRadius:"var(--mantine-radius-md)"},children:e.jsx(t.Textarea,{value:o,onChange:m=>s==null?void 0:s(m.target.value),onFocus:()=>g(!0),onBlur:()=>g(!1),onMouseEnter:()=>y(!0),onMouseLeave:()=>y(!1),placeholder:i,disabled:a,size:"sm",radius:"md",fw:400,minRows:h?1:d,maxRows:l,autosize:f,styles:{...p}})})})},Ho=(n,r)=>{const o=u.useCallback(i=>{const a=Array.isArray(i)?i:[i];n.onUserIdsChange(a)},[n]),s=u.useCallback(i=>{const a=Array.isArray(i)?i:[i],d=r.members.filter(y=>a.includes(y.id)),l=d.map(y=>y.id),f=a.filter(y=>!l.includes(y)),g=[...r.members,...n.users].filter(y=>f.includes(y.id)),x=[...d,...g];r.onMembersChange(x)},[r,n]);return{availableMembersUsers:u.useMemo(()=>{const i=[...r.members];return n.users.forEach(a=>{i.find(d=>d.id===a.id)||i.push(a)}),i},[r.members,n.users]),handleResponsibleChange:o,handleMembersChange:s}},Go=({opened:n,onClose:r,onMaximize:o,editable:s,name:c,onNameChange:i,avatar:a,onAvatarChange:d,owner:l,responsibleProps:f,membersProps:h,descriptionProps:g})=>{const{availableMembersUsers:x,handleResponsibleChange:y,handleMembersChange:p}=Ho(f,h),m=u.useMemo(()=>[e.jsx($o,{label:"Description",icon:M.IconAlignLeft,value:g.description,onChange:g.onDescriptionChange,editable:s},"description"),e.jsx(Ne,{editable:!1,label:"Team Owner",icon:M.IconUserCircle,value:l.id,users:[l]},"owner"),e.jsx(Ne,{multiple:!1,editable:s,label:"Team Leader",icon:M.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(Ne,{multiple:!0,editable:s,label:"Team Members",icon:M.IconUsers,value:h.members.map(I=>I.id),users:x,onChange:p,onSearch:h.handleSearch,onLoadMore:h.handleLoadMore,hasMore:h.hasMore},"members")],[g.description,g.onDescriptionChange,s,l,f.handleLoadMore,f.handleSearch,f.hasMore,f.userIds,f.users,y,h.handleLoadMore,h.handleSearch,h.hasMore,h.members,x,p]);return e.jsx(Dn,{opened:n,onClose:r,onMaximize:o,editable:s,headerProps:{avatar:a,onAvatarChange:I=>d==null?void 0:d(I),title:c,onTitleChange:i,placeholder:"Team name"},propertiesProps:{visibleProperties:m}})},Vo=({title:n,properties:r,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:r}),e.jsx(t.Space,{h:"md"}),e.jsx(t.Box,{children:o})]}),Fn=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:{gray:["#f6f5f4","#e8e8e8","#cfcfcf","#b5b5b5","#9f9e9d","#91908c","#8b8983","#787670","#6b6962","#37352f"]},components:{}});function _o({children:n,theme:r}){return e.jsxs(t.MantineProvider,{theme:r||Fn,children:[e.jsx(tt.Notifications,{}),e.jsx(ot.ModalsProvider,{children:e.jsx(rt.DatesProvider,{settings:{firstDayOfWeek:0},children:n})})]})}exports.ActionButton=K;exports.AppLayout=Pn;exports.AppLayoutProvider=An;exports.AvatarSelector=In;exports.BaseLayout=Vo;exports.BoxAvatar=se;exports.CenterPeek=To;exports.DocsTemplate=Ro;exports.EditableText=rn;exports.EditableTextarea=pt;exports.EmojiAvatar=Xe;exports.ExpandableSearch=sn;exports.FilterDropdown=It;exports.FilterDropdownButton=Ce;exports.FilterDropdownFilters=Me;exports.FullPage=Oo;exports.GenericTable=cn;exports.IconAvatar=en;exports.ImageAvatar=nn;exports.InvitedUserCard=ge;exports.Logo=on;exports.Matrix=Rn;exports.Menu=me;exports.ModalSettings=to;exports.NavButton=Ge;exports.NavLink=We;exports.Navbar=$e;exports.NavbarProvider=fo;exports.NotificationSidebar=uo;exports.PlaceholderAvatar=ke;exports.PopoverItem=an;exports.PopoverSelector=Te;exports.ShareButton=eo;exports.ShareMenu=jn;exports.ShareModal=no;exports.SidePeek=Dn;exports.TeamSidePeek=Go;exports.TextButton=He;exports.ThemeProvider=_o;exports.UserChip=we;exports.WorkspaceSelector=Io;exports.WorkspaceSelectorItem=wn;exports.getInitialsFromName=tn;exports.theme=Fn;exports.useAppLayout=Ve;exports.useNavbar=ho;
|
|
18
|
+
`})]})},Ce=({activeFilters:n,onFiltersChange:r,availableFilters:o,size:s="md",filterButtonDropdownPosition:c="bottom-end"})=>{const i=t.useCombobox({onDropdownClose:()=>i.resetSelectedOption(),onDropdownOpen:()=>i.updateSelectedOptionIndex("active")}),[a,d]=u.useState(!1),l=n.length>0,f=m=>{if(m==="remove-filters")r([]);else{const I=o==null?void 0:o.find(b=>b.value===m);if(I){const b={id:`${I.value}-${Date.now()}`,filterOption:I};r([...n,b])}}i.closeDropdown()},h=(o||[]).filter(m=>!n.some(I=>I.filterOption.value===m.value)),g={borderRadius:"var(--mantine-radius-md)",fontSize:"var(--mantine-font-size-sm)",color:"var(--mantine-color-gray-7)",fontWeight:"500"},y=(()=>{switch(s){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:l||a?"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:()=>d(!0),onMouseLeave:()=>d(!1),onClick:()=>i.toggleDropdown(),children:e.jsx(M.IconFilter,{size:20,stroke:2.3})});return e.jsxs(t.Combobox,{store:i,onOptionSubmit:f,withinPortal:!1,offset:4,position:c,children:[e.jsx(t.Combobox.Target,{children:l?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(m=>e.jsx(t.Combobox.Option,{value:m.value,style:{...g},children:e.jsxs(t.Box,{style:{display:"flex",alignItems:"center",gap:"8px"},children:[m.icon,m.label]})},m.value)),l&&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(M.IconFilterOff,{size:16,stroke:2}),"Remove filters"]})})]})})]})},xt=({filterTag:n,onUpdate:r,onRemove:o,options:s=[],filterTagDropdownPosition:c="bottom-start"})=>{var x;const i=t.useCombobox({onDropdownClose:()=>i.resetSelectedOption(),onDropdownOpen:()=>i.updateSelectedOptionIndex("active")}),a=!!n.selectedOption,d=a?`${n.filterOption.label}: ${(x=n.selectedOption)==null?void 0:x.label}`:n.filterOption.label,l=s&&s.length>0?s:[{value:"option-a",label:"TagFilterOptionA"},{value:"option-b",label:"TagFilterOptionB"},{value:"option-c",label:"TagFilterOptionC"}],f=y=>{if(y==="remove")o();else{const p=l.find(m=>m.value===y);p&&r({...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"},g={display:"inline-flex",alignItems:"center",gap:"4px",backgroundColor:a?"var(--mantine-color-blue-0)":"var(--mantine-color-gray-0)",color:a?"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:c,middlewares:{flip:!1,shift:!0},children:[e.jsx(t.Combobox.Target,{children:e.jsxs(t.Box,{style:{...g},onClick:()=>i.toggleDropdown(),fw:500,pl:"sm",children:[e.jsxs(t.Box,{style:{display:"flex",alignItems:"center",gap:"4px"},children:[n.filterOption.icon,d]}),e.jsx(M.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:[l.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:r,availableFilters:o,addFilterButtonDropdownPosition:s="bottom-start"})=>{const c=t.useCombobox({onDropdownClose:()=>c.resetSelectedOption(),onDropdownOpen:()=>c.updateSelectedOptionIndex("active")}),[i,a]=u.useState(!1),d=x=>{const y=o==null?void 0:o.find(p=>p.value===x);if(y){const p={id:`${y.value}-${Date.now()}`,filterOption:y};r([...n,p])}c.closeDropdown()},l=(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"}},g={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:c,onOptionSubmit:d,withinPortal:!1,offset:4,position:s,children:[e.jsx(t.Combobox.Target,{children:e.jsx(t.Box,{style:{...f},onMouseEnter:()=>a(!0),onMouseLeave:()=>a(!1),onClick:()=>c.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:l.map(x=>e.jsx(t.Combobox.Option,{value:x.value,style:{...g},children:e.jsxs(t.Box,{style:{display:"flex",alignItems:"center",gap:"8px"},children:[x.icon,x.label]})},x.value))})})]})},Me=({activeFilters:n,onFiltersChange:r,availableFilters:o,size:s="sm",getFilterOptions:c,filterTagDropdownPosition:i="bottom-start"})=>{const a=f=>{const h=(n||[]).map(g=>g.id===f.id?f:g);r(h)},d=f=>{const h=(n||[]).filter(g=>g.id!==f);r(h)},l=(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=c?c(f.filterOption.value)||[]:[];return e.jsx(xt,{filterTag:f,onUpdate:a,onRemove:()=>d(f.id),size:s,options:h,filterTagDropdownPosition:i},f.id)}),l.length>0&&e.jsx(mt,{activeFilters:n,onFiltersChange:r,availableFilters:l,size:s})]})})},gt=({activeFilters:n,onFiltersChange:r,availableFilters:o,size:s="md",getFilterOptions:c,filterTagDropdownPosition:i="bottom-start"})=>e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"12px"},children:[e.jsx(Ce,{activeFilters:n,onFiltersChange:r,availableFilters:o,size:s}),e.jsx(Me,{activeFilters:n,onFiltersChange:r,availableFilters:o,size:"sm",getFilterOptions:c,filterTagDropdownPosition:i})]}),It=Object.assign(gt,{Button:Ce,Filters:Me}),yt=({children:n,danger:r,active:o,...s})=>e.jsx(t.MenuItem,{...s,style:{borderRadius:"8px",color:o?"var(--mantine-color-blue-7)":r?"var(--mantine-color-red-9)":"var(--mantine-color-gray-9)",backgroundColor:o?"var(--mantine-color-blue-0)":"transparent",...s.style},children:n}),me=({trigger:n,menuItems:r,children:o,...s})=>{const c=u.useRef(null),[i,a]=u.useState(0);return u.useEffect(()=>{c.current&&a(c.current.offsetWidth)},[n]),e.jsxs(t.Menu,{...s,children:[e.jsx(t.Menu.Target,{children:e.jsx("div",{ref:c,onClick:d=>d.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,r==null?void 0:r.map((d,l)=>e.jsx(yt,{...d},l))]})]})},Ge=({label:n,icon:r,onClick:o,color:s="gray",disabled:c=!1,"aria-label":i,indicator:a,fullWidth:d,isActive:l=!1,...f})=>{const[h,g]=u.useState(!1),x=()=>{c||o==null||o()};return e.jsx(t.Box,{style:{cursor:c?"not-allowed":"pointer",borderRadius:"var(--mantine-radius-md)"},variant:"transparent",justify:"flex-start",display:"flex",color:s,radius:"md",w:d?"100%":"auto",px:6,h:40,onMouseEnter:()=>!c&&g(!0),onMouseLeave:()=>g(!1),onClick:x,bg:h||l?"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:[r,e.jsx(t.Text,{ta:"left",size:"sm",fw:600,c:"var(--mantine-color-gray-8)",truncate:!0,style:{flex:1,opacity:c?.5:1},children:n}),a&&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:a})]})})},We=({label:n,rightLabel:r,children:o,onAddChild:s,onMenuAction:c,menuItems:i,color:a="gray",defaultText:d="No items",level:l=0,disabled:f=!1,noChild:h=!1,isActive:g=!1,showAvatar:x=!1,avatar:y,placeholder:p,onClick:m,"aria-label":I,...b})=>{const[j,S]=u.useState(!1),[w,O]=u.useState(!1),[C,k]=u.useState(!1),v=u.Children.count(o)>0,R=C?M.IconChevronDown:M.IconChevronRight,D=!h&&v&&(x?w:!0),B=u.useCallback($=>{f||(console.log("NavLink clicked",{hasChildren:v,noChild:h,isExpanded:j}),v&&!h&&(console.log("Toggling expansion"),S(!j)),m==null||m())},[m,f,v,h,j]),E=u.useCallback($=>{$.stopPropagation(),!f&&(s==null||s())},[s,f]),N=u.useCallback(()=>{f||(v&&!h&&S(!j),m==null||m())},[f,v,h,j,m]),H=u.useCallback(()=>{f||s==null||s()},[s,f]),F=u.useCallback($=>{f||c==null||c($)},[c,f,n]),P=u.useCallback(()=>v?u.Children.map(o,$=>u.isValidElement($)?u.cloneElement($,{...$.props,level:l+1}):$):null,[o,v,l]),V=(i==null?void 0:i.map($=>({children:e.jsxs(t.Group,{gap:"xs",wrap:"nowrap",children:[$.icon&&e.jsx($.icon,{size:16}),e.jsx(t.Text,{size:"sm",children:$.label})]}),onClick:()=>F($.action)})))||[],U=[{children:e.jsxs(t.Group,{gap:"xs",wrap:"nowrap",children:[e.jsx(M.IconPlus,{size:16}),e.jsx(t.Text,{size:"sm",children:"Add child"})]}),onClick:E}],G=V.length>0?V:U;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:a,size:"md",radius:"md",w:"100%",px:6,h:40,onMouseEnter:()=>!f&&O(!0),onMouseLeave:()=>O(!1),onClick:B,bg:g||w?"var(--mantine-color-gray-1)":"transparent","aria-expanded":j,"aria-label":I||`${n} navigation link`,...b,children:e.jsxs(t.Group,{w:"100%",wrap:"nowrap",gap:8,onClick:B,style:{paddingLeft:h&&!D?`${(l+1)*16}px`:l>0?`${l*16}px`:"0px"},children:[D?e.jsx(K,{icon:R,size:"md",color:a,onClick:N,disabled:f,onMouseEnter:()=>k(!0),onMouseLeave:()=>k(!1),"aria-label":v?`${j?"Collapse":"Expand"} ${n}`:void 0}):x?e.jsx(se,{size:"xs",avatar:y,showPlaceholder:!0,placeholder:p}):null,e.jsx(t.Text,{size:"sm",fw:500,c:g?"black":w?"gray.9":"gray.8",truncate:!0,w:"100%",style:{opacity:f?.5:1},children:n}),e.jsxs(t.Group,{gap:"xs",align:"center",children:[r&&e.jsx(t.Text,{size:"xs",c:"dimmed",children:r}),w&&!f&&e.jsxs(t.Group,{gap:4,wrap:"nowrap",children:[s&&e.jsx(K,{icon:M.IconPlus,onClick:H,"aria-label":`Add child to ${n}`}),(i&&i.length>0||s)&&e.jsx("div",{onClick:$=>$.stopPropagation(),children:e.jsx(me,{menuItems:G,trigger:e.jsx(K,{icon:M.IconDots,"aria-label":`More options for ${n}`,size:"md"}),position:"bottom-end",shadow:"md"})})]})]})]})}),j&&!h&&e.jsx(t.Stack,{gap:0,style:{width:"100%"},children:v?P():e.jsx(t.Box,{style:{marginLeft:l>0?`${l*16}px`:"0px"},children:e.jsx(t.Text,{size:"sm",c:"dimmed",ta:"left",p:"sm",fw:500,children:d})})})]})},vt="userChip-module__pill___DgFME",jt={pill:vt},we=({avatar:n,name:r,withRemoveButton:o=!1,onRemove:s})=>e.jsx(t.Pill,{withRemoveButton:o,onRemove:s,radius:"md",p:"0px",size:"md",className:jt.pill,bg:"transparent",children:e.jsxs(t.Group,{gap:4,wrap:"nowrap",style:{alignItems:"center"},children:[e.jsx(se,{avatar:n,size:24,placeholder:r,showPlaceholder:!0}),e.jsx(t.Text,{size:"sm",fw:450,c:"var(--mantine-color-gray-9)",children:r})]})}),bt="200px",wt="4px 8px",St=40,kt="var(--mantine-radius-md)",Ct=16,an=({item:n,withAvatars:r,disabled:o=!1,onClick:s,selected:c=!1})=>{const[i,a]=u.useState(!1);return e.jsx(t.Box,{onMouseEnter:()=>!o&&a(!0),onMouseLeave:()=>!o&&a(!1),onClick:d=>{d.preventDefault(),d.stopPropagation(),o||s==null||s(n.value)},onMouseDown:d=>{d.stopPropagation()},style:{minWidth:bt,backgroundColor:o?"transparent":i?"var(--mantine-color-gray-1)":"transparent",cursor:o?"default":"pointer",borderRadius:kt,padding:wt,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:St,children:[r&&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})]}),c&&e.jsx(M.IconCheck,{size:Ct,color:"var(--mantine-color-gray-9)"})]})})},Mt="bottom-end",Tt=1e4,Ot="24px",Bt="0 8px",zt="6px",Qe="var(--mantine-radius-md)",Rt="46px",Te=({value:n,onChange:r,data:o,withRemove:s=!1,withAvatars:c=!1,onRemove:i,disabledOptions:a=[],disabled:d=!1,defaultOption:l,popoverStyles:f,dropdownStyles:h,triggerStyles:g,textStyles:x})=>{const[y,p]=u.useState(!1),m=(o||[]).find(v=>v.value===n)||l,[I,b]=u.useState(!1),[j,S]=u.useState(!1),[w,O]=u.useState(!1),C=s?e.jsx(t.Group,{p:"sm",onClick:v=>{v.stopPropagation(),i==null||i(n)},style:{cursor:"pointer",height:Rt,display:"flex",alignItems:"center",borderRadius:Qe,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:()=>!d&&b(!0),onMouseLeave:()=>!d&&b(!1),onClick:()=>{d||(p(!0),O(!0))},style:{height:Ot,cursor:d?"not-allowed":"pointer",display:"inline-flex",alignItems:"center",borderRadius:Qe,backgroundColor:d?"transparent":I||w?"var(--mantine-color-gray-1)":"transparent",transition:"background-color 0.2s ease",padding:Bt,gap:zt,width:"auto",opacity:d?.6:1,...g},children:[e.jsx(t.Text,{size:"sm",fw:x!=null&&x.fontWeight?void 0:500,c:d?"var(--mantine-color-gray-4)":"var(--mantine-color-gray-6)",style:{color:d?"var(--mantine-color-gray-4)":"var(--mantine-color-gray-6)",lineHeight:"24px",whiteSpace:"nowrap",...x},children:(m==null?void 0:m.label)||"Select option"}),e.jsx(M.IconChevronDown,{size:16,style:{color:d?"var(--mantine-color-gray-3)":"var(--mantine-color-gray-6)"}})]});return e.jsxs(t.Popover,{opened:y,onChange:v=>{p(v),v||O(!1)},position:Mt,shadow:"md",withinPortal:!0,zIndex:Tt,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 R=a.includes(v.value),D=v.value===n;return e.jsx(an,{item:v,withAvatars:c,disabled:R,selected:D,onClick:B=>{r==null||r(B),p(!1),O(!1)}},v.value)}),C]})})]})},Dt=(n,r,o,s)=>{const c=u.useRef(null),i=u.useRef(null),a=u.useCallback(l=>{l[0].isIntersecting&&o&&!s&&r&&r()},[o,s,r]),d=u.useCallback(()=>{if(!(!c.current||!n||!r)){i.current&&(i.current.disconnect(),i.current=null);try{const l=new IntersectionObserver(a,{threshold:.1,rootMargin:"50px"});l.observe(c.current),i.current=l}catch(l){console.error("Failed to setup intersection observer:",l)}}},[n,r,a]);return u.useEffect(()=>(d(),()=>{i.current&&(i.current.disconnect(),i.current=null)}),[d]),u.useEffect(()=>()=>{i.current&&(i.current.disconnect(),i.current=null)},[]),{loadMoreRef:c}},cn=({tableName:n,data:r,columns:o,onAddItem:s,addItemComponent:c,addItemLabel:i="Add item",loading:a=!1,emptyMessage:d="No data found",searchPlaceholder:l="Search...",enableAutoFilters:f=!0,customFilters:h=[],onCustomFilter:g,onSort:x,sortColumn:y,sortDirection:p,onSearch:m,onRowClick:I,size:b="md",striped:j=!1,highlightOnHover:S=!0,enableInfiniteScroll:w=!1,isLoadingMore:O=!1,hasMore:C=!1,onLoadMore:k})=>{const[v,R]=u.useState(""),[D,B]=u.useState([]),{loadMoreRef:E}=Dt(w,k||(()=>{}),C,O),N=u.useMemo(()=>[...f?o.filter(z=>z.type==="select"&&z.options).map(z=>({value:z.key,label:z.label})):[],...h],[o,f,h]),H=u.useMemo(()=>{let T=r||[];if(v){const z=v.toLowerCase();T=T.filter(A=>o.some(L=>{if(!L.searchable)return!1;const _=A[L.key];return _==null?!1:String(_).toLowerCase().includes(z)}))}return D.forEach(z=>{if(z.filterTag.selectedOption){const A=o.find(L=>L.key===z.filterTag.filterOption.value);A&&(T=T.filter(L=>{var ne;const _=L[A.key];return String(_)===((ne=z.filterTag.selectedOption)==null?void 0:ne.value)}))}}),T},[r,v,D,o]),F=T=>{R(T),m==null||m(T)},P=T=>{const z=o.find(L=>L.key===T);if(!(z!=null&&z.sortable))return;const A=y===T&&p==="asc"?"desc":"asc";x==null||x(T,A)},V=T=>{const z=o.find(A=>A.key===T);return(z==null?void 0:z.type)==="select"&&z.options?z.options.map(A=>({value:A.value,label:A.label})):(z==null?void 0:z.type)==="badge"?[...new Set(r.map(L=>L[z.key]).filter(Boolean))].map(L=>({value:String(L),label:String(L).charAt(0).toUpperCase()+String(L).slice(1)})):z?[...new Set(r.map(L=>L[z.key]).filter(Boolean))].map(L=>({value:String(L),label:String(L).charAt(0).toUpperCase()+String(L).slice(1)})):[]},U=(T,z)=>{var L,_,ne,W,oe;const A=z[T.key];switch(T.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=T.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 T.options?e.jsx(Te,{value:A,data:T.options,placeholder:T.label,onChange:re=>{var he;return(he=T.onSelectChange)==null?void 0:he.call(T,re,z)},disabled:(L=T.disabled)==null?void 0:L.call(T,z)}):e.jsx(t.Text,{size:"sm",c:"dimmed",children:"—"});case"badge":const Oe=((_=T.badgeColors)==null?void 0:_[A])||"gray";return e.jsx(t.Badge,{color:Oe,variant:"light",size:"sm",radius:"md",fw:600,children:A||"Unknown"});case"avatar":const Be=((ne=T.fallbackText)==null?void 0:ne.call(T,z))||String(A).charAt(0).toUpperCase();return e.jsx(se,{avatar:A,size:"xs",placeholder:Be,showPlaceholder:!0});case"custom":return((W=T.render)==null?void 0:W.call(T,A,z))||e.jsx(t.Text,{size:"sm",c:"dimmed",children:"—"});case"actions":return(oe=T.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(M.IconDots,{size:16})})}),e.jsx(t.Menu.Dropdown,{children:T.actions.map((re,he)=>{var Ie;return e.jsx(t.Menu.Item,{color:re.color,leftSection:re.icon,disabled:(Ie=re.disabled)==null?void 0:Ie.call(re,z),onClick:()=>re.onClick(z),styles:{item:{borderRadius:"var(--mantine-radius-md)"}},children:re.label},he)})})]}):null;default:return e.jsx(t.Text,{size:"sm",c:"dimmed",children:"—"})}},G=T=>{var z;return(z=o.find(A=>A.key===T))!=null&&z.sortable?y===T?p==="asc"?e.jsx(M.IconChevronUp,{size:14}):e.jsx(M.IconChevronDown,{size:14}):e.jsx(M.IconChevronUp,{size:14,style:{opacity:.3}}):null},Q=(()=>{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:a}),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(sn,{placeholder:l,value:v,onChange:F,onSearch:F,expandDirection:"right",size:Q.buttonSize}),N.length>0&&e.jsx(Ce,{activeFilters:D.map(T=>T.filterTag),onFiltersChange:T=>{B(T.map(z=>({filterTag:z,onUpdate:()=>{},onRemove:()=>{}}))),g==null||g(T)},availableFilters:N,size:Q.buttonSize})]}),s&&e.jsx(t.Button,{size:"compact-md",h:32,style:{fontSize:`var(--mantine-font-size-${Q.textSize})`,border:"none"},radius:"md",onClick:s,children:i})]})]}),N.length>0&&e.jsx(Me,{activeFilters:D.map(T=>T.filterTag),onFiltersChange:T=>{B(T.map(z=>({filterTag:z,onUpdate:()=>{},onRemove:()=>{}}))),g==null||g(T)},availableFilters:N,size:"md",getFilterOptions:V})]}),c,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(T=>e.jsx(t.Table.Th,{c:"var(--mantine-color-gray-6)",style:{width:T.width,textAlign:T.align||"left",cursor:T.sortable?"pointer":"default"},onClick:()=>T.sortable&&P(T.key),children:e.jsxs(t.Group,{gap:"xs",wrap:"nowrap",children:[T.icon&&e.jsx(t.Box,{style:{display:"flex",alignItems:"center"},children:T.icon}),e.jsx(t.Text,{size:Q.textSize,fw:500,children:T.label}),G(T.key)]})},String(T.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:d})})}):H.map((T,z)=>e.jsx(t.Table.Tr,{style:{cursor:I?"pointer":"default"},onClick:()=>I==null?void 0:I(T),children:o.map(A=>e.jsx(t.Table.Td,{style:{textAlign:A.align||"left"},children:U(A,T)},String(A.key)))},T.id||z))})]}),w&&e.jsx(t.Box,{ref:E,style:{padding:"16px",display:"flex",justifyContent:"center",alignItems:"center",minHeight:"60px"},children:O&&e.jsxs(t.Group,{display:"flex",ta:"center",gap:"xs",children:[e.jsx(t.Loader,{size:"sm",color:"gray.5"}),e.jsx(t.Text,{size:"sm",c:"dimmed",fw:500,children:"Loading more..."})]})})]})};Object.assign(cn,{});const Et=({onAvatarSelect:n,onEmojiSelect:r,onImageSelect:o,onIconSelect:s}={})=>{const[c,i]=u.useState("emoji"),[a,d]=u.useState(null),[l,f]=u.useState(null),[h,g]=u.useState(null),[x,y]=u.useState(null),[p,m]=u.useState(null),I=u.useCallback(v=>{i(v)},[]),b=u.useCallback(v=>{d(v)},[]),j=u.useCallback(v=>{m(v);const R=new FileReader;R.onload=D=>{var E;const B=(E=D.target)==null?void 0:E.result;f(B)},R.readAsDataURL(v)},[]),S=u.useCallback(v=>{g(v),f(null),m(null),y(null),n==null||n({type:"emoji",value:v}),r==null||r(v)},[n,r]),w=u.useCallback(v=>{y(v),f(null),m(null),g(null),n==null||n({type:"icon",value:v}),s==null||s(v)},[n,s]),O=u.useCallback(()=>{if(p&&l){const v=URL.createObjectURL(p);n==null||n({type:"image",value:v}),o==null||o(p)}},[p,l,n,o]),C=u.useCallback(()=>{f(null),m(null),g(null),y(null)},[]),k=u.useCallback(()=>{f(null),g(null),y(null),m(null),i("emoji"),d(null)},[]);return{selectedTab:c,tabHovered:a,previewImage:l,selectedEmoji:h,selectedIcon:x,selectedFile:p,handleTabChange:I,handleTabHover:b,handleImagePreview:j,handleImageAccept:O,handleEmojiSelect:S,handleIconSelect:w,clearImagePreview:C,resetState:k}},At=({opened:n,onClose:r,popoverRef:o})=>{const s=u.useCallback(i=>{n&&o.current&&!o.current.contains(i.target)&&(console.log("Click outside detected, closing popover"),r())},[n,r,o]),c=u.useCallback(i=>{i.key==="Escape"&&n&&(console.log("Escape key pressed, closing popover"),r())},[n,r]);return u.useEffect(()=>{if(n)return document.addEventListener("mousedown",s),document.addEventListener("keydown",c),()=>{document.removeEventListener("mousedown",s),document.removeEventListener("keydown",c)}},[n,s,c]),{handleClickOutside:s,handleEscape:c}},Pt=({selectedTab:n,tabHovered:r,onTabChange:o,onTabHover:s,onRemove:c,hasAvatar:i=!1,children:a})=>{const[d,l]=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:()=>s("emoji"),onMouseLeave:()=>s(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:r==="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:()=>s("icons"),onMouseLeave:()=>s(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:r==="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:()=>s("image"),onMouseLeave:()=>s(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:r==="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"})})}),c&&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:d?"var(--mantine-color-red-0)":"transparent",color:d?"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:c,onMouseEnter:()=>l(!0),onMouseLeave:()=>l(!1),children:"Remove"})})]}),e.jsx(t.Tabs.Panel,{value:"emoji",children:n==="emoji"?a:null}),e.jsx(t.Tabs.Panel,{value:"icons",children:n==="icons"?a:null}),e.jsx(t.Tabs.Panel,{value:"image",children:n==="image"?a:null})]})};let Ye=!1;Ye||(Ze.init({data:Se}),Ye=!0);const Lt=()=>{const n=[{id:"frequent",name:"Frequently Used",icon:e.jsx(M.IconClock,{size:20,strokeWidth:2.5})}];return Se.categories.forEach(r=>{if(r.emojis&&r.emojis.length>0){let o=e.jsx(M.IconMoodSmile,{size:20,strokeWidth:2}),s=r.name;switch(r.id){case"people":o=e.jsx(M.IconMoodSmile,{size:20,strokeWidth:2}),s="Smileys & People";break;case"nature":o=e.jsx(M.IconTrees,{size:20,strokeWidth:2}),s="Animals & Nature";break;case"foods":o=e.jsx(M.IconApple,{size:20,strokeWidth:2}),s="Food & Drink";break;case"activity":o=e.jsx(M.IconBallBasketball,{size:20,strokeWidth:2}),s="Activities";break;case"travel":o=e.jsx(M.IconPlane,{size:20,strokeWidth:2}),s="Travel & Places";break;case"places":o=e.jsx(M.IconPlane,{size:20,strokeWidth:2}),s="Travel & Places";break;case"objects":o=e.jsx(M.IconBulb,{size:20,strokeWidth:2}),s="Objects";break;case"symbols":o=e.jsx(M.IconHeart,{size:20,strokeWidth:2}),s="Symbols";break;case"flags":o=e.jsx(M.IconFlag,{size:20,strokeWidth:2}),s="Flags";break;case"frequent":return;default:o=e.jsx(M.IconMoodSmile,{size:20,strokeWidth:2}),s=`Category: ${r.id}`;break}n.push({id:r.id,name:s,icon:o})}}),n},Ft=({onEmojiSelect:n,height:r=200})=>{const[o,s]=u.useState(""),[c,i]=u.useState("people"),[a,d]=u.useState(()=>{if(typeof window<"u"){const I=localStorage.getItem("emoji-frequent");return I?JSON.parse(I):[]}return[]}),[l,f]=u.useState([]),[h,g]=u.useState(!1),x=Lt();u.useEffect(()=>{o.trim()?(g(!0),Ze.SearchIndex.search(o).then(I=>{f(I.map(b=>({id:b.id,native:b.skins[0].native,name:b.name,keywords:b.keywords}))),g(!1)})):f([])},[o]);const y=u.useMemo(()=>{if(o.trim())return l;if(c==="frequent")return a.map(b=>({id:b,native:b,name:"",keywords:[]}));const I=Se.categories.find(b=>b.id===c);return I?I.emojis.map(b=>{const j=Se.emojis[b];return{id:j.id,native:j.skins[0].native,name:j.name,keywords:j.keywords}}):[]},[o,c,a,l]),p=I=>{n(I),d(b=>{const j=b.filter(w=>w!==I),S=[I,...j].slice(0,20);return typeof window<"u"&&localStorage.setItem("emoji-frequent",JSON.stringify(S)),S})},m=I=>{if(o.trim())return"Results";const b=x.find(j=>j.id===I);return b?b.name:I.charAt(0).toUpperCase()+I.slice(1)};return e.jsxs(t.Stack,{gap:0,style:{height:r,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:I=>s(I.target.value),leftSection:e.jsx(M.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:m(c)})]})}),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(I=>e.jsx(t.Tooltip,{label:I.name||I.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(I.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:I.native})},I.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(I=>e.jsx(t.Tooltip,{label:I.name,position:"top",withArrow:!0,openDelay:500,withinPortal:!0,zIndex:1e3,color:"dark",children:e.jsx(t.Box,{onClick:()=>{i(I.id),s("")},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:c===I.id?"var(--mantine-color-gray-0)":"transparent",color:c===I.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:I.icon})},I.id))})})]})},ln=["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"],dn=["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"],un=["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"],fn=["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"],hn=["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"],pn=["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"],xn=["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"],mn=["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"];[...ln,...dn,...un,...fn,...hn,...pn,...xn,...mn];const pe=[{id:"recent",name:"Recently Used",icons:[],isDynamic:!0},{id:"user",name:"User & Profile",icons:ln},{id:"business",name:"Business & Work",icons:dn},{id:"tech",name:"Technology",icons:un},{id:"expressions",name:"Expressions",icons:fn},{id:"nature",name:"Nature & Animals",icons:hn},{id:"shapes",name:"Shapes & Symbols",icons:pn},{id:"actions",name:"Actions & Tools",icons:xn},{id:"communication",name:"Communication",icons:mn}],Ut={recent:e.jsx(M.IconClock,{size:20,strokeWidth:2.5}),user:e.jsx(M.IconUser,{size:20,strokeWidth:2.5}),business:e.jsx(M.IconBriefcase,{size:20,strokeWidth:2.5}),tech:e.jsx(M.IconDeviceDesktop,{size:20,strokeWidth:2.5}),expressions:e.jsx(M.IconMoodSmile,{size:20,strokeWidth:2.5}),nature:e.jsx(M.IconTrees,{size:20,strokeWidth:2.5}),shapes:e.jsx(M.IconCircle,{size:20,strokeWidth:2.5}),actions:e.jsx(M.IconTool,{size:20,strokeWidth:2.5}),communication:e.jsx(M.IconMessage,{size:20,strokeWidth:2.5})},Nt=({selectedCategory:n,onCategoryChange:r})=>e.jsx(t.Flex,{gap:"0px",justify:"center",wrap:"wrap",children:pe.map(o=>{const s=Ut[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:()=>r(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:c=>{c.currentTarget.style.backgroundColor="var(--mantine-color-gray-1)"},onMouseLeave:c=>{c.currentTarget.style.backgroundColor=n===o.id?"var(--mantine-color-gray-0)":"transparent"},children:s})},o.id)})}),gn=u.memo(({onIconSelect:n,height:r=358})=>{var I,b;const[o,s]=u.useState(""),[c,i]=u.useState("recent"),[a,d]=u.useState(!1),[l,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(()=>pe.filter(j=>j.id!=="recent"&&!("isDynamic"in j)).flatMap(j=>j.icons),[]),g=u.useMemo(()=>{if(c==="recent"){const S=new Set(h);return l.filter(w=>S.has(w))}const j=pe.find(S=>S.id===c);return(j==null?void 0:j.icons)||[]},[c,l,h]),x=u.useCallback((j,S)=>{if(!j.trim())return S;const w=j.toLowerCase().trim(),O=w.split(/\s+/);return S.filter(C=>{const v=C.replace(/^Icon/,"").split(/(?=[A-Z])/).map(R=>R.toLowerCase().trim()).filter(R=>R.length>0);return!!(v.some(R=>O.some(D=>R===D))||w.length>2&&v.some(R=>O.some(D=>R.startsWith(D)))||w.length<=2&&v.some(R=>O.some(D=>R.includes(D)))||O.length>1&&O.every(R=>v.some(D=>D===R||D.startsWith(R))))})},[]),y=u.useMemo(()=>o.trim()?x(o,h):g,[o,g,h,x]),p=u.useCallback(j=>{h.includes(j)&&f(w=>{const O=[j,...w.filter(C=>C!==j)].slice(0,20);return typeof window<"u"&&localStorage.setItem("avatar-icon-recent",JSON.stringify(O)),O}),n(j)},[n,h]),m=u.useCallback(j=>{c!==j&&(s(""),i(j),requestAnimationFrame(()=>{d(!0),setTimeout(()=>d(!1),100)}))},[c]);return e.jsxs(t.Stack,{gap:0,style:{height:r,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 ${(I=pe.find(j=>j.id===c))==null?void 0:I.name}...`,value:o,onChange:j=>s(j.target.value),leftSection:e.jsx(M.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=pe.find(j=>j.id===c))==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:a?.7:1,transition:"opacity 0.05s ease"},children:y.map(j=>e.jsx(Ke,{iconName:j,onClick:()=>p(j),size:20},o.trim()?`search-${j}`:`${c}-${j}`))},`${c}-${o}`)})}),e.jsx(t.Box,{px:"sm",py:"xs",style:{borderTop:"1px solid var(--mantine-color-gray-3)"},children:e.jsx(Nt,{selectedCategory:c,onCategoryChange:m})})]})});gn.displayName="IconGrid";const Wt=({previewImage:n,fileInputRef:r,selectedEmoji:o,size:s,loading:c,onFileInputClick:i,onImageChange:a,onImageAccept:d,onClearImagePreview:l})=>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:`${fe(s)}px !important`,height:`${fe(s)}px !important`,minWidth:`${fe(s)}px`,minHeight:`${fe(s)}px`,maxWidth:`${fe(s)}px`,maxHeight:`${fe(s)}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(M.IconPhoto,{size:20}),onClick:i,loading:c,disabled:c,fullWidth:!0,children:"Choose Image"}),n||o?e.jsx(t.Button,{variant:"outline",leftSection:e.jsx(M.IconPhoto,{size:16}),onClick:i,loading:c,disabled:c,fullWidth:!0,children:n||o?"Change Image":"Choose Image"}):null,e.jsx("input",{ref:r,type:"file",accept:"image/jpeg,image/jpg,image/png,image/gif,image/webp",onChange:f=>{var h;return a(((h=f.target.files)==null?void 0:h[0])||null)},style:{display:"none"},disabled:c}),(n||o)&&e.jsxs(t.Group,{gap:"sm",w:"100%",children:[e.jsx(t.Button,{variant:"outline",color:"gray",onClick:l,fullWidth:!0,children:"Back"}),e.jsx(t.Button,{color:"blue",onClick:d,loading:c,disabled:c,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"})]})}),$t=({onEmojiSelect:n})=>e.jsx(Ft,{onEmojiSelect:n,height:358}),Ht=({onIconSelect:n})=>e.jsx(gn,{onIconSelect:n,height:358}),Gt=({previewImage:n,selectedEmoji:r,size:o,loading:s,onFileInputClick:c,onImageChange:i,onImageAccept:a,onClearImagePreview:d,fileInputRef:l})=>e.jsx(Wt,{previewImage:n,fileInputRef:l,selectedEmoji:r,size:o,loading:s,onFileInputClick:c,onImageChange:i,onImageAccept:a,onClearImagePreview:d}),Vt=()=>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..."})]})}),In=({editable:n=!0,opened:r,onOpen:o,onClose:s,avatar:c,onAvatarSelect:i,onRemove:a,size:d="lg",loading:l=!1,placeholder:f,showPlaceholder:h=!0,position:g="bottom-start",withinPortal:x=!0,zIndex:y=1e3})=>{const p=u.useRef(null),m=u.useRef(null),I=u.useRef(null),{selectedTab:b,tabHovered:j,previewImage:S,selectedEmoji:w,selectedIcon:O,selectedFile:C,handleTabChange:k,handleTabHover:v,handleImagePreview:R,handleImageAccept:D,handleEmojiSelect:B,handleIconSelect:E,clearImagePreview:N,resetState:H}=Et({onAvatarSelect:i});At({opened:r,onClose:s,popoverRef:m}),u.useEffect(()=>{r||H()},[r,H]);const F=X=>{console.log("Emoji clicked:",X),B(X),s()},P=X=>{console.log("Icon clicked:",X),E(X),s()},V=X=>{X&&R(X)},U=()=>{C?(D(),s()):(w||O)&&s()},G=()=>{p.current&&p.current.click()},$=()=>{N()},Q=()=>{console.log("Avatar removed"),a==null||a(),s()},T=()=>!!c,z=()=>l?e.jsx(ke,{size:d,loading:!0}):e.jsx(se,{avatar:c,size:d,placeholder:f,showPlaceholder:h,editable:!0,onClick:()=>{!l&&!r&&o()}}),A=e.jsx($t,{onEmojiSelect:F}),L=e.jsx(Ht,{onIconSelect:P}),_=e.jsx(Gt,{previewImage:S,selectedEmoji:w,size:d,loading:l,onFileInputClick:G,onImageChange:V,onImageAccept:U,onClearImagePreview:$,fileInputRef:p}),ne=e.jsx(t.Box,{children:e.jsx(Pt,{selectedTab:b,tabHovered:j,onTabChange:k,onTabHover:v,onRemove:Q,hasAvatar:T(),children:b==="emoji"?A:b==="icons"?L:_})}),W=e.jsx("div",{style:{position:"relative",display:"inline-block"},children:e.jsxs(t.Popover,{opened:r,onClose:()=>{console.log("Popover onClose called"),s()},position:g,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:I,style:{position:"relative"},children:z()})}),e.jsx(t.Popover.Dropdown,{ref:m,p:0,style:{width:"auto",overflow:"hidden",zIndex:y},children:e.jsx(u.Suspense,{fallback:e.jsx(Vt,{}),children:ne})})]})}),oe=e.jsx(se,{avatar:c,size:d,placeholder:f,showPlaceholder:h});return e.jsx(e.Fragment,{children:n?W:oe})},_t=n=>{if(!n||typeof n!="string")return!1;const r=/^[^\s@]+@[^\s@]+\.[^\s@]+$/;return n.length<5||n.length>254?!1:r.test(n.trim())},Qt=n=>{const r=[];return n.forEach(o=>{_t(o)||r.push({email:o,error:"Please enter a valid email address"})}),{isValid:r.length===0,errors:r}},Yt=n=>{const r=[],o=new Set;return n.forEach(s=>{const c=s.toLowerCase().trim();o.has(c)?r.push({email:s,error:"This email has already been added"}):o.add(c)}),r},qt=n=>{const r=Qt(n),o=Yt(n),s=[...r.errors,...o];return{isValid:s.length===0,errors:s}},Zt=({value:n,onChange:r,onInputChange:o,suggestedUsers:s=[],tagDisplayMap:c={}})=>{const[i,a]=u.useState(""),[d,l]=u.useState([]),f=u.useRef(null),h=n.map(m=>{if(c[m])return c[m];const I=s.find(b=>b.email===m);return I&&I.name?I.name:m});u.useEffect(()=>{o&&o(i)},[i,o]),u.useEffect(()=>{if(n.length>0){const m=qt(n);l(m.errors)}else l([])},[n]),u.useEffect(()=>{const m=f.current;if(!m)return;let I;const b=j=>{const w=j.target.value||"";clearTimeout(I),I=setTimeout(()=>{a(w)},150)};return m.addEventListener("input",b),()=>{m.removeEventListener("input",b),clearTimeout(I)}},[]);const g=u.useCallback(m=>{const I=s.map(j=>({name:j.name||j.email,email:j.email})),b=m.map(j=>{const S=I.find(w=>w.name.toLowerCase()===j.toLowerCase());return S?S.email:j}).filter(j=>j.includes("@")?!0:!I.some(w=>{const O=w.name.toLowerCase(),C=j.toLowerCase();return O.startsWith(C)&&C!==O}));r(b),a("")},[r,s]),x=u.useCallback(()=>{f.current&&(f.current.value="",a(""))},[]),y=d.length===0&&n.length>0,p=u.useCallback((m,I,b)=>{m&&n.length>0&&I&&(m(n,I,b),a(""))},[n]);return{inputText:i,tagsInputRef:f,displayValue:h,validationErrors:d,isValid:y,handleEmailChange:g,clearInput:x,handleInvite:p}},yn=({onInvite:n,onUpdateRole:r,onRemoveUser:o,invitedUsers:s=[],suggestedUsers:c=[],roleOptions:i=[]})=>{const[a,d]=u.useState([]),[l,f]=u.useState([]),[h,g]=u.useState(""),[x,y]=u.useState({}),p=i.length>0?i[0].value:void 0,[m,I]=u.useState(p);u.useEffect(()=>{i.length>0&&!m&&I(i[0].value)},[i.length,m]),u.useEffect(()=>{const B=c.filter(E=>a.includes(E.email)).map(E=>E.id);f(E=>E.filter(N=>B.includes(N)))},[a,c.length]);const[b,j]=u.useState("invite"),[S,w]=u.useState(null),O=(B,E,N)=>{n&&n(B,E,N),d([]),g("")},C=(B,E)=>{r&&r(B,E)},k=B=>{o&&o(B)},v=B=>{f(E=>E.includes(B)?E.filter(N=>N!==B):[...E,B])},R=B=>{a.includes(B.email)||(d([...a,B.email]),y(E=>({...E,[B.email]:B.name||B.email})),l.includes(B.id)||f([...l,B.id]),g(""))},D=h.trim()?c.filter(B=>{var N;const E=h.toLowerCase();return B.email.toLowerCase().includes(E)||((N=B.name)==null?void 0:N.toLowerCase().includes(E))}):[];return{emails:a,setEmails:d,selectedUsers:l,setSelectedUsers:f,inputText:h,setInputText:g,tagDisplayMap:x,setTagDisplayMap:y,selectedRole:m,setSelectedRole:I,selectedTab:b,setSelectedTab:j,tabHovered:S,setTabHovered:w,filteredUsers:D,handleInvite:O,handleUpdateRole:C,handleRemoveUser:k,handleToggleUser:v,handleAddSuggestedUser:R}},vn=u.forwardRef(({value:n,onChange:r,placeholder:o="Add one or more emails",onInvite:s,roleOptions:c=[],selectedRole:i,onRoleChange:a,onInputChange:d,suggestedUsers:l=[],tagDisplayMap:f={}},h)=>{const[g,x]=u.useState("Hello, I would like to invite you to join my workspace"),{tagsInputRef:y,displayValue:p,validationErrors:m,isValid:I,handleEmailChange:b,clearInput:j,handleInvite:S}=Zt({value:n,onChange:r,onInputChange:d,suggestedUsers:l,tagDisplayMap:f}),w=()=>{S(s,i,g),x("")};u.useImperativeHandle(h,()=>({clearInput:j}),[j]);const O=p.length>0,C=a&&c.length>0,k=m.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:O?"":o,radius:"md",rightSection:C?e.jsx(t.Box,{style:{position:"absolute",right:"8px",top:"17px",transform:"translateY(-50%)",height:"24px",display:"flex",alignItems:"center"},children:e.jsx(Te,{value:i||"",onChange:v=>a(v),data:c,placeholder:"Select role",defaultOption:c[c.length-1],disabledOptions:["owner"]})}):null,rightSectionProps:{style:{width:C?"120px":"0px",position:"absolute",height:"32px",right:"8px"}},styles:{input:{paddingRight:C?"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:m.map((v,R)=>e.jsxs(t.Text,{size:"xs",c:"red",children:[v.email,": ",v.error]},R))})]}),O&&e.jsxs(t.Stack,{gap:"sm",children:[e.jsx(t.Textarea,{size:"sm",value:g,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:!I,children:"Send invitations"})]})]})}),Xt=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"}},Kt=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"}},Jt=n=>{if(n){if(typeof n=="object"&&"type"in n)return n;if(typeof n=="string")return{type:"image",value:n}}},ge=({user:n,isSelected:r=!1,onToggle:o,onUpdateRole:s,onRemoveUser:c,roleOptions:i=[],variant:a="invited",onClick:d})=>{var I;const l=((I=n.name)==null?void 0:I.trim())||n.email,f=()=>{o&&o(n.id)},h=b=>{if(s){const j=b;s(n.id,j)}},g=a==="suggested"||a==="read-only",x=a==="invited"&&i.length>0,[y,p]=u.useState(!1),m=()=>{d==null||d()};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:m,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:Jt(n.avatar),size:"md",placeholder:l,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:l}),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:Xt(n.status),radius:"sm",children:Kt(n.status)})]}),e.jsx(t.Text,{size:"xs",c:"dimmed",lineClamp:1,children:n.email})]})]}),e.jsxs(t.Group,{gap:"sm",align:"center",children:[g&&a!=="read-only"&&e.jsx(t.Radio,{checked:r,onChange:f,size:"sm",onClick:b=>b.stopPropagation(),pr:4}),x&&!n.isCurrentUser&&e.jsx(Te,{value:n.role,onChange:h,data:i,placeholder:"Select role",defaultOption:i.find(b=>b.value===n.role),withRemove:!0,onRemove:()=>c==null?void 0:c(n.id)})]})]})},jn=({opened:n,onClose:r,onInvite:o,onUpdateRole:s,onRemoveUser:c,invitedUsers:i=[],children:a,roleOptions:d=[],suggestedUsers:l=[]})=>{const f=u.useRef(null),{emails:h,setEmails:g,selectedUsers:x,inputText:y,setInputText:p,tagDisplayMap:m,selectedRole:I,setSelectedRole:b,selectedTab:j,setSelectedTab:S,tabHovered:w,setTabHovered:O,filteredUsers:C,handleInvite:k,handleUpdateRole:v,handleRemoveUser:R,handleToggleUser:D,handleAddSuggestedUser:B}=yn({onInvite:o,onUpdateRole:s,onRemoveUser:c,invitedUsers:i,suggestedUsers:l,roleOptions:d}),E=P=>{B(P),f.current&&f.current.clearInput()},N=e.jsxs(e.Fragment,{children:[e.jsx(vn,{ref:f,value:h,onChange:g,onInvite:k,roleOptions:d,selectedRole:I,onRoleChange:b,onInputChange:p,suggestedUsers:l,tagDisplayMap:m}),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(P=>e.jsx(ge,{user:P,isSelected:x.includes(P.id),onToggle:D,onUpdateRole:v,onRemoveUser:R,roleOptions:d,variant:"invited"},P.id))})]})})}),C.length>0&&e.jsx(t.ScrollArea,{pt:"sm",mah:200,type:"auto",style:{overflow:"visible"},children:e.jsx(t.Box,{children:C.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:C.map(P=>e.jsx(ge,{user:P,isSelected:x.includes(P.id),onToggle:D,onUpdateRole:v,onRemoveUser:R,roleOptions:d,variant:"suggested",onClick:()=>E(P)},P.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"})]})}),F=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:()=>O("invite"),onMouseLeave:()=>O(null),style:{backgroundColor:"transparent"},children:e.jsx(t.Box,{style:{borderRadius:"var(--mantine-radius-md)",height:"24px",display:"flex",alignItems:"center",justifyContent:"center",padding:"0 8px",border:"none",backgroundColor:w==="invite"?"var(--mantine-color-gray-1)":"transparent",color: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:()=>O("publish"),onMouseLeave:()=>O(null),style:{backgroundColor:"transparent"},children:e.jsx(t.Box,{style:{height:"24px",display:"flex",alignItems:"center",justifyContent:"center",padding:"0 8px",borderRadius:"var(--mantine-radius-md)",border:"none",backgroundColor:w==="publish"?"var(--mantine-color-gray-1)":"transparent",color: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:N})}),e.jsx(t.Tabs.Panel,{value:"publish",children:e.jsx(t.Box,{p:"sm",children:H})})]})})});return e.jsx(me,{trigger:a,menuItems:[],opened:n,onClose:r,styles:{dropdown:{padding:"0",borderRadius:"var(--mantine-radius-md)"}},children:F})},eo=({onInvite:n,onUpdateRole:r,onRemoveUser:o,invitedUsers:s,currentUser:c,roleOptions:i,suggestedUsers:a,label:d="Share"})=>{const[l,f]=u.useState(!1),h=()=>f(!1),g=e.jsx(He,{label:d,onClick:()=>f(!0),isActive:l});return e.jsx(jn,{opened:l,onClose:h,onInvite:n,onUpdateRole:r,onRemoveUser:o,invitedUsers:s,currentUser:c,roleOptions:i,suggestedUsers:a,children:g})},no=({opened:n,onClose:r,onInvite:o,onUpdateRole:s,onRemoveUser:c,invitedUsers:i=[],roleOptions:a=[],suggestedUsers:d=[]})=>{const l=u.useRef(null),{emails:f,setEmails:h,selectedUsers:g,inputText:x,setInputText:y,tagDisplayMap:p,selectedRole:m,setSelectedRole:I,filteredUsers:b,handleInvite:j,handleUpdateRole:S,handleRemoveUser:w,handleToggleUser:O,handleAddSuggestedUser:C}=yn({onInvite:o,onUpdateRole:s,onRemoveUser:c,invitedUsers:i,suggestedUsers:d,roleOptions:a}),k=v=>{C(v),l.current&&l.current.clearInput()};return e.jsx(t.Modal,{opened:n,onClose:r,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(K,{icon:M.IconX,size:"md",onClick:r,color:"var(--mantine-color-gray-8)"})]}),e.jsx(vn,{ref:l,value:f,onChange:h,onInvite:j,roleOptions:a,selectedRole:m,onRoleChange:I,onInputChange:y,suggestedUsers:d,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(ge,{user:v,isSelected:g.includes(v.id),onToggle:O,onUpdateRole:S,onRemoveUser:w,roleOptions:a,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(ge,{user:v,isSelected:g.includes(v.id),onToggle:O,onUpdateRole:S,onRemoveUser:w,roleOptions:a,variant:"suggested",onClick:()=>k(v)},v.id))})})]})]})})},to=({opened:n,onClose:r,options:o=[],onSave:s,onCancel:c,groups:i=[],styles:a})=>{const[d,l]=u.useState("");u.useEffect(()=>{n&&o.length>0?l(o[0].id):n||l("")},[n,o]);const f=()=>{s&&s(),r()},h=()=>{c&&c(),r()},g=()=>{r()},x=o.find(y=>y.id===d);return e.jsxs(t.Modal,{opened:n,onClose:g,size:"90%",centered:!0,closeOnClickOutside:!0,closeOnEscape:!0,withCloseButton:!1,p:"none",styles:{body:{...a==null?void 0:a.body,padding:0,height:"80vh"}},radius:"md",children:[e.jsx(t.FocusTrap.InitialFocus,{}),e.jsxs(t.Box,{style:{display:"flex",height:"100%",...a==null?void 0:a.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(Ge,{label:p.label,icon:p.icon,onClick:()=>l(p.id),isActive:d===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"})]})})]})]})]})},oo=(n,r="es")=>{const o=new Date,s=typeof n=="string"?new Date(n):n,c=Math.floor((o.getTime()-s.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"}},a=i[r]||i.en;if(c<5)return a.now;if(c<60)return r==="es"?`${a.ago} ${c} ${c===1?a.second:a.seconds}`:`${c} ${c===1?a.second:a.seconds} ${a.ago}`;const d=Math.floor(c/60);if(d<60)return r==="es"?`${a.ago} ${d} ${d===1?a.minute:a.minutes}`:`${d} ${d===1?a.minute:a.minutes} ${a.ago}`;const l=Math.floor(d/60);if(l<24)return r==="es"?`${a.ago} ${l} ${l===1?a.hour:a.hours}`:`${l} ${l===1?a.hour:a.hours} ${a.ago}`;const f=Math.floor(l/24);if(f<7)return r==="es"?`${a.ago} ${f} ${f===1?a.day:a.days}`:`${f} ${f===1?a.day:a.days} ${a.ago}`;const h=Math.floor(f/7);if(h<4)return r==="es"?`${a.ago} ${h} ${h===1?a.week:a.weeks}`:`${h} ${h===1?a.week:a.weeks} ${a.ago}`;const g=Math.floor(f/30);if(g<12)return r==="es"?`${a.ago} ${g} ${g===1?a.month:a.months}`:`${g} ${g===1?a.month:a.months} ${a.ago}`;const x=Math.floor(f/365);return r==="es"?`${a.ago} ${x} ${x===1?a.year:a.years}`:`${x} ${x===1?a.year:a.years} ${a.ago}`},ro=(n,r="es")=>{const o=typeof n=="string"?new Date(n):n,s={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=(s[r]||s.en)[o.getMonth()],a=o.getDate();return r==="es"?`${a} ${i}`:`${i} ${a}`},so=n=>{const r=typeof n=="string"?new Date(n):n,o=new Date;return r.toDateString()===o.toDateString()},ao=n=>{const r=typeof n=="string"?new Date(n):n,o=new Date;return o.setDate(o.getDate()-1),r.toDateString()===o.toDateString()},io=(n,r="es")=>so(n)?r==="es"?"Hoy":"Today":ao(n)?r==="es"?"Ayer":"Yesterday":oo(n,r),co=({notification:n,message:r,markAsRead:o,archiveNotification:s,children:c,actions:i})=>{var h,g,x,y,p;const a=new Date().getTime()-new Date(n.timestamp).getTime()<6048e5?io(n.timestamp,"en"):ro(n.timestamp,"en"),[d,l]=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(K,{onClick:()=>o(n.id),icon:M.IconCheck}),!n.isArchived&&e.jsx(K,{onClick:()=>s(n.id),icon:M.IconArchive})]});return e.jsxs(t.Box,{p:"sm",bg:d?"var(--mantine-color-gray-0)":"white",style:{cursor:"pointer",borderTop:"1px solid var(--mantine-color-gray-2)"},onMouseEnter:()=>l(!0),onMouseLeave:()=>l(!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:(g=n.metadata)==null?void 0:g.fullname,size:"sm",radius:"md",src:(x=n.metadata)==null?void 0:x.avatar_url}):e.jsx(on,{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:r}),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)):""," ","• ",a]})]}),d?f:!n.isRead&&e.jsx(t.Indicator,{color:"var(--mantine-color-blue-6)",size:10,position:"top-end"})]}),c,i&&e.jsx(t.Group,{justify:"flex-start",align:"flex-start",gap:"xs",wrap:"nowrap",pl:36,pt:8,children:i})]})},lo=(n,r,o,s,c)=>{const[i,a]=u.useState(!1),d=u.useRef(null),l=u.useRef(null),f=u.useRef(null);u.useEffect(()=>{a(n)},[n]);const h=u.useCallback(x=>{x[0].isIntersecting&&s&&!c&&o&&o()},[s,c,o]),g=u.useCallback(()=>{if(!(!d.current||!n||!r||!o)){l.current&&(l.current.disconnect(),l.current=null);try{const x=new IntersectionObserver(h,{threshold:.1,rootMargin:"50px"});x.observe(d.current),l.current=x}catch(x){console.error("Failed to setup intersection observer:",x)}}},[n,r,o,h]);return u.useEffect(()=>{if(f.current&&(clearTimeout(f.current),f.current=null),!n||!r||!o){l.current&&(l.current.disconnect(),l.current=null);return}if(!d.current){f.current=setTimeout(()=>g(),50);return}return g(),()=>{f.current&&(clearTimeout(f.current),f.current=null),l.current&&(l.current.disconnect(),l.current=null)}},[n,r,o,g]),u.useEffect(()=>()=>{f.current&&clearTimeout(f.current),l.current&&l.current.disconnect()},[]),{isActive:i,loadMoreRef:d}},uo=({notifications:n,isLoading:r=!1,isLoadingMore:o=!1,hasMore:s=!1,unreadCount:c=0,markAllAsRead:i,archiveAllNotifications:a,markAsRead:d,archiveNotification:l,loadMore:f,onFilterChange:h,currentFilter:g="all",customRenderer:x,opened:y=!1,onOpen:p=()=>{},onClose:m=()=>{},enableInfiniteScroll:I=!0})=>{const b=[{children:"Mark all as read",leftSection:e.jsx(M.IconChecklist,{size:16}),onClick:()=>i()},{children:"Archive all",leftSection:e.jsx(M.IconArchive,{size:16}),onClick:()=>a()}],j=[{children:"All",leftSection:e.jsx(M.IconChecklist,{size:16}),onClick:()=>h==null?void 0:h("all"),active:g==="all"},{children:"Unread",leftSection:e.jsx(M.IconChecklist,{size:16}),onClick:()=>h==null?void 0:h("unread"),active:g==="unread"},{children:"Archived",leftSection:e.jsx(M.IconArchive,{size:16}),onClick:()=>h==null?void 0:h("archived"),active:g==="archived"}],S=C=>x&&C.category&&["welcome","upgrade"].includes(C.category)?x(C,d,l):e.jsx(co,{notification:C,markAsRead:d,archiveNotification:l,message:C.message,actions:C.actions},C.id),{isActive:w,loadMoreRef:O}=lo(y,I,f||(()=>{}),s,o);return e.jsxs(e.Fragment,{children:[e.jsx(Ge,{isActive:w,icon:e.jsx(M.IconBell,{strokeWidth:2,size:20,color:"var(--mantine-color-gray-7)"}),onClick:()=>{y?m():p()},disabled:!1,variant:"subtle",color:"gray",fullWidth:!0,style:{borderRadius:"var(--mantine-radius-md)",cursor:"pointer"},label:"Inbox",indicator:c>0?c>99?"99+":c:void 0}),e.jsxs(t.Drawer,{opened:y,onClose:m,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(me,{position:"bottom-end",menuItems:j,trigger:e.jsx(K,{icon:M.IconFilter})}),e.jsx(me,{position:"bottom-end",menuItems:b,trigger:e.jsx(K,{onClick:()=>{},icon:M.IconDots,changeIconOnHover:!0,iconHovered:M.IconDots})})]})]})}),e.jsxs(t.Box,{style:{flex:1,overflow:"auto"},children:[r&&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(C=>S(C))}):e.jsxs(t.Stack,{gap:0,w:"100%",h:"100%",justify:"center",align:"center",py:"xl",children:[e.jsx(M.IconInbox,{size:24,color:"var(--mantine-color-gray-6)"}),e.jsx(t.Text,{size:"sm",fw:500,c:"dimmed",ta:"center",mt:"sm",children:"No new updates"})]}),e.jsx(t.Box,{ref:O,style:{padding:"16px",display:I?"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&&!I&&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 ..."})]}),!I&&s&&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"})]})]})]})]})},$e=({header:n,body:r,footer:o,withBorder:s=!0,position:c="left",bg:i="var(--mantine-color-gray-0)"})=>{const[a,d]=u.useState(!1),l=()=>{if(!s)return{};const f="var(--mantine-color-gray-3)",h="1px";return c==="left"?{borderRight:`${h} solid ${f}`}:c==="right"?{borderLeft:`${h} solid ${f}`}:{}};return e.jsxs(t.Stack,{gap:"sm",h:"100%",p:"sm",bg:i,style:l(),onMouseEnter:()=>d(!0),onMouseLeave:()=>d(!1),children:[n&&e.jsx(t.Box,{children:typeof n=="function"?n({hovered:a}):n}),r&&e.jsx(t.Box,{style:{flex:1,minHeight:0,width:"100%",overflow:"hidden"},children:typeof r=="function"?r({hovered:a}):r}),o&&e.jsx(t.Box,{children:typeof o=="function"?o({hovered:a}):o})]})},bn=u.createContext(void 0),fo=({children:n})=>{const[r,{open:o,close:s}]=xe.useDisclosure(!1),c={openedNotificationSidebar:r,openNotificationSidebar:o,closeNotificationSidebar:s};return e.jsx(bn.Provider,{value:c,children:n})},ho=()=>{const n=u.useContext(bn);if(n===void 0)throw new Error("useNavbar must be used within an NavbarProvider");return n},wn=({workspace:n,currentUserId:r,currentWorkspaceId:o,onClick:s})=>{const c=o===n.id,i=r&&n.ownerId===r;return e.jsxs(t.Box,{onClick:s,style:{display:"flex",alignItems:"center",padding:"6px",borderRadius:"var(--mantine-radius-md)",cursor:"pointer",gap:"8px",width:"100%",boxSizing:"border-box"},onMouseEnter:a=>{a.currentTarget.style.backgroundColor="var(--mantine-color-gray-0)"},onMouseLeave:a=>{a.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:[c&&e.jsx(M.IconCheck,{size:16,color:"var(--mantine-color-blue-6)"}),i&&e.jsx(t.Badge,{size:"xs",variant:"light",color:"yellow",radius:"sm",children:"Owner"})]})]})},po="workspace-selector-module__menuItem___FSB6P",xo="workspace-selector-module__workspaceButton___-P6kp",mo="workspace-selector-module__workspaceText___YDAlj",go="workspace-selector-module__scrollWrapper___MzrJY",Ue={menuItem:po,workspaceButton:xo,workspaceText:mo,scrollWrapper:go},Io=({workspaces:n=[],currentWorkspace:r,currentUserId:o,isLoading:s=!1,error:c=null,onWorkspaceSelect:i,onCreateWorkspace:a,emptyMessage:d="No workspaces found",loadingMessage:l="Loading workspaces...",errorMessage:f="Failed to load workspaces",className:h,onCloseSidebar:g,sidebarHovered:x=!1,children:y,menuItems:p})=>{const[m,I]=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),I(!1),j("")};if(s)return e.jsxs(t.Group,{gap:"xs",children:[e.jsx(t.Loader,{size:"sm"}),e.jsx(t.Text,{size:"sm",c:"dimmed",children:l})]});if(c)return e.jsx(t.Alert,{color:"red",title:"Error",children:f});const[O,C]=u.useState(x);return n.length===0&&!s&&!c?e.jsx(t.Box,{children:e.jsx(t.Text,{size:"sm",c:"dimmed",children:d})}):e.jsxs(t.Menu,{opened:m,onOpen:()=>I(!0),onClose:()=>I(!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:()=>I(!m),style:{padding:"6px",display:"flex",alignItems:"center",borderRadius:"var(--mantine-radius-md)",cursor:"pointer"},className:`${Ue.workspaceButton} ${h||""}`,bg:O||m?"var(--mantine-color-gray-1)":"transparent",onMouseEnter:()=>C(!0),onMouseLeave:()=>C(!1),children:e.jsx(t.Group,{gap:"xs",wrap:"nowrap",style:{width:"100%",overflow:"hidden"},children:r?e.jsxs(e.Fragment,{children:[e.jsx(se,{size:"xs",avatar:typeof r.avatar=="string"?{type:"image",value:r.avatar}:r.avatar,placeholder:r.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:r.name}),e.jsxs(t.Group,{gap:4,wrap:"nowrap",style:{flexShrink:0},children:[e.jsx(t.ActionIcon,{radius:"md",size:"md",color:"gray",variant:"subtle",onClick:()=>I(!m),children:e.jsx(M.IconChevronDown,{size:20,strokeWidth:2,color:"var(--mantine-color-gray-7)"})}),(O||x)&&e.jsx(K,{icon:M.IconChevronsLeft,size:"md",color:"gray",variant:"subtle",onClick:()=>{g==null||g()}})]})]}):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:d})}):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"}),a&&e.jsx(t.Anchor,{onClick:()=>{a(),I(!1)},size:"xs",underline:"never",fw:500,p:4,truncate:!0,style:{display:"flex",alignItems:"center",gap:"4px"},children:"Add"})]}),e.jsx("div",{className:Ue.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:Ue.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(wn,{workspace:k,currentUserId:o,currentWorkspaceId:r==null?void 0:r.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))})]})})]})},Sn=({children:n,style:r,...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",...r},...o,children:n});Sn.displayName="MatrixCenter";const kn=({children:n,style:r,size:o="50px",state:s="empty",onStateChange:c,interactive:i=!0,...a})=>{const[d,l]=u.useState(s),[f,h]=u.useState(!1),g=c?s:i?d:s,x=()=>{if(!i)return;const m=["empty","outline","filled"],b=(m.indexOf(g)+1)%m.length,j=m[b];c?c(j):l(j)},y=()=>{switch(g){case"empty":return null;case"outline":return e.jsx(M.IconPoint,{size:16,color:"var(--mantine-color-gray-8)",stroke:2.5});case"filled":return e.jsx(M.IconPointFilled,{size:16,color:"var(--mantine-color-gray-8)",stroke:2.5});default:return null}},p=()=>{switch(g){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:g==="outline"?"2px solid var(--mantine-color-gray-0)":"2px solid transparent",...r},onClick:x,onMouseEnter:()=>h(!0),onMouseLeave:()=>h(!1),...a,children:n||y()})};kn.displayName="MatrixCell";const Cn=({children:n,style:r,size:o="50px",blockId:s,isVisible:c=!0,isDimmed:i=!1,shouldShowBlueBorder:a=!1,onBlockClick:d,onBlockPress:l,...f})=>{const[h,g]=u.useState(!1),x=u.useRef(null),y=u.useRef(!1),p=()=>{!s||!l||(g(!0),y.current=!1,x.current=setTimeout(()=>{y.current=!0,l(s)},500))},m=()=>{s&&(g(!1),x.current&&(clearTimeout(x.current),x.current=null),!y.current&&d&&d(s),y.current=!1)},I=()=>{g(!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:a?"2px solid var(--mantine-color-blue-5)":"2px solid transparent",opacity:h?.8:i?.3:1,transition:"all 0.2s ease",cursor:s?"pointer":"default",...r},onMouseDown:p,onMouseUp:m,onMouseLeave:I,...f,children:n})};Cn.displayName="MatrixBlockLeft";const Mn=({children:n,style:r,size:o="50px",blockId:s,isVisible:c=!0,isDimmed:i=!1,shouldShowBlueBorder:a=!1,onBlockClick:d,onBlockPress:l,...f})=>{const[h,g]=u.useState(!1),x=u.useRef(null),y=u.useRef(!1),p=()=>{!s||!l||(g(!0),y.current=!1,x.current=setTimeout(()=>{y.current=!0,l(s)},500))},m=()=>{s&&(g(!1),x.current&&(clearTimeout(x.current),x.current=null),!y.current&&d&&d(s),y.current=!1)},I=()=>{g(!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:a?"2px solid var(--mantine-color-blue-5)":"2px solid transparent",opacity:h?.8:i?.3:1,transition:"all 0.2s ease",cursor:s?"pointer":"default",...r},onMouseDown:p,onMouseUp:m,onMouseLeave:I,...f,children:n})};Mn.displayName="MatrixBlockRight";const Tn=({children:n,style:r,size:o="50px",blockId:s,isVisible:c=!0,isDimmed:i=!1,shouldShowBlueBorder:a=!1,onBlockClick:d,onBlockPress:l,...f})=>{const[h,g]=u.useState(!1),x=u.useRef(null),y=u.useRef(!1),p=()=>{!s||!l||(g(!0),y.current=!1,x.current=setTimeout(()=>{y.current=!0,l(s)},500))},m=()=>{s&&(g(!1),x.current&&(clearTimeout(x.current),x.current=null),!y.current&&d&&d(s),y.current=!1)},I=()=>{g(!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:a?"2px solid var(--mantine-color-blue-5)":"2px solid transparent",opacity:h?.8:i?.3:1,transition:"all 0.2s ease",cursor:s?"pointer":"default",...r},onMouseDown:p,onMouseUp:m,onMouseLeave:I,...f,children:n})};Tn.displayName="MatrixBlockUp";const On=({children:n,style:r,size:o="50px",blockId:s,isVisible:c=!0,isDimmed:i=!1,shouldShowBlueBorder:a=!1,onBlockClick:d,onBlockPress:l,...f})=>{const[h,g]=u.useState(!1),x=u.useRef(null),y=u.useRef(!1),p=()=>{!s||!l||(g(!0),y.current=!1,x.current=setTimeout(()=>{y.current=!0,l(s)},500))},m=()=>{s&&(g(!1),x.current&&(clearTimeout(x.current),x.current=null),!y.current&&d&&d(s),y.current=!1)},I=()=>{g(!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:a?"2px solid var(--mantine-color-blue-5)":"2px solid transparent",opacity:h?.8:i?.3:1,transition:"all 0.2s ease",cursor:s?"pointer":"default",...r},onMouseDown:p,onMouseUp:m,onMouseLeave:I,...f,children:n})};On.displayName="MatrixBlockDown";const Bn=({onLeftHover:n,onRightHover:r,onUpHover:o,onDownHover:s,showLeftControls:c=!1,showRightControls:i=!1,showUpControls:a=!1,showDownControls:d=!1})=>{const[l,f]=u.useState(!1),[h,g]=u.useState(!1),[x,y]=u.useState(!1),[p,m]=u.useState(!1),I=w=>{f(w),n==null||n(w)},b=w=>{g(w),r==null||r(w)},j=w=>{y(w),o==null||o(w)},S=w=>{m(w),s==null||s(w)};return e.jsxs(e.Fragment,{children:[c&&e.jsx(t.Box,{style:{position:"absolute",left:0,top:0,bottom:0,width:"80px",zIndex:5,pointerEvents:"auto",background:"transparent"},onMouseEnter:()=>I(!0),onMouseLeave:()=>I(!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)}),a&&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)}),d&&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)})]})};Bn.displayName="HoverZones";const zn=({onLeftPrevious:n,onLeftNext:r,leftCurrentPage:o=1,leftTotalPages:s=1,leftDisabled:c=!1,leftVisible:i=!1,onLeftHover:a,onRightPrevious:d,onRightNext:l,rightCurrentPage:f=1,rightTotalPages:h=1,rightDisabled:g=!1,rightVisible:x=!1,onRightHover:y,onUpPrevious:p,onUpNext:m,upCurrentPage:I=1,upTotalPages:b=1,upDisabled:j=!1,upVisible:S=!1,onUpHover:w,onDownPrevious:O,onDownNext:C,downCurrentPage:k=1,downTotalPages:v=1,downDisabled:R=!1,downVisible:D=!1,onDownHover:B,onLeftAdd:E,onRightAdd:N,onUpAdd:H,onDownAdd:F,size:P="md",inline:V=!1})=>{const U=()=>s<=1||c?null:e.jsxs(t.Stack,{gap:"xs",align:"center",children:[e.jsx(t.ActionIcon,{size:P,variant:"subtle",onClick:()=>n==null?void 0:n(),disabled:o<=1,color:"gray",radius:"md","aria-label":"Previous left blocks",children:e.jsx(M.IconChevronRight,{size:16,stroke:2})}),e.jsx(t.ActionIcon,{size:P,variant:"subtle",onClick:E,color:"blue",radius:"md","aria-label":"Add left blocks",children:e.jsx(M.IconPlus,{size:16,stroke:2})}),e.jsx(t.ActionIcon,{size:P,variant:"subtle",onClick:r,disabled:o>=s,color:"gray",radius:"md","aria-label":"Next left blocks",children:e.jsx(M.IconChevronLeft,{size:16,stroke:2})})]}),G=()=>h<=1||g?null:e.jsxs(t.Stack,{gap:"xs",align:"center",children:[e.jsx(t.ActionIcon,{size:P,variant:"subtle",onClick:d,disabled:f<=1,color:"gray",radius:"md","aria-label":"Previous right blocks",children:e.jsx(M.IconChevronLeft,{size:16,stroke:2})}),e.jsx(t.ActionIcon,{size:P,variant:"subtle",onClick:N,color:"blue",radius:"md","aria-label":"Add right blocks",children:e.jsx(M.IconPlus,{size:16,stroke:2})}),e.jsx(t.ActionIcon,{size:P,variant:"subtle",onClick:l,disabled:f>=h,color:"gray",radius:"md","aria-label":"Next right blocks",children:e.jsx(M.IconChevronRight,{size:16,stroke:2})})]}),$=()=>b<=1||j?null:e.jsxs(t.Group,{gap:"xs",align:"center",wrap:"nowrap",children:[e.jsx(t.ActionIcon,{size:P,variant:"subtle",onClick:p,disabled:I<=1,color:"gray",radius:"md","aria-label":"Previous up blocks",children:e.jsx(M.IconChevronDown,{size:16,stroke:2})}),e.jsx(t.ActionIcon,{size:P,variant:"subtle",onClick:H,color:"blue",radius:"md","aria-label":"Add up blocks",children:e.jsx(M.IconPlus,{size:16,stroke:2})}),e.jsx(t.ActionIcon,{size:P,variant:"subtle",onClick:m,disabled:I>=b,color:"gray",radius:"md","aria-label":"Next up blocks",children:e.jsx(M.IconChevronUp,{size:16,stroke:2})})]}),Q=()=>v<=1||R?null:e.jsxs(t.Group,{gap:"xs",align:"center",wrap:"nowrap",children:[e.jsx(t.ActionIcon,{size:P,variant:"subtle",onClick:O,disabled:k<=1,color:"gray",radius:"md","aria-label":"Previous down blocks",children:e.jsx(M.IconChevronDown,{size:16,stroke:2})}),e.jsx(t.ActionIcon,{size:P,variant:"subtle",onClick:F,color:"blue",radius:"md","aria-label":"Add down blocks",children:e.jsx(M.IconPlus,{size:16,stroke:2})}),e.jsx(t.ActionIcon,{size:P,variant:"subtle",onClick:C,disabled:k>=v,color:"gray",radius:"md","aria-label":"Next down blocks",children:e.jsx(M.IconChevronUp,{size:16,stroke:2})})]}),T=s>1&&!c,z=h>1&&!g,A=b>1&&!j,L=v>1&&!R;return!T&&!z&&!A&&!L?null:V?e.jsxs(e.Fragment,{children:[T&&i&&n&&r&&e.jsx("div",{onMouseEnter:()=>a==null?void 0:a(!0),onMouseLeave:()=>a==null?void 0:a(!1),children:U()}),z&&x&&d&&l&&e.jsx("div",{onMouseEnter:()=>y==null?void 0:y(!0),onMouseLeave:()=>y==null?void 0:y(!1),children:G()}),A&&S&&p&&m&&e.jsx("div",{onMouseEnter:()=>w==null?void 0:w(!0),onMouseLeave:()=>w==null?void 0:w(!1),children:$()}),L&&D&&O&&C&&e.jsx("div",{onMouseEnter:()=>B==null?void 0:B(!0),onMouseLeave:()=>B==null?void 0:B(!1),children:Q()})]}):e.jsxs(e.Fragment,{children:[T&&i&&n&&r&&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:()=>a==null?void 0:a(!0),onMouseLeave:()=>a==null?void 0:a(!1),children:U()}),z&&x&&d&&l&&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:G()}),A&&S&&p&&m&&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:$()}),e.jsx(t.Box,{style:{position:"absolute",bottom:"20px",left:"50%",transform:"translateX(-50%)",zIndex:10,pointerEvents:"auto",opacity:D?1:0,transition:"opacity 0.2s ease"},onMouseEnter:()=>B==null?void 0:B(!0),onMouseLeave:()=>B==null?void 0:B(!1),children:L&&D&&O&&C&&Q()})]})};zn.displayName="NavigationControls";const be=({direction:n,text:r,show:o,actions:s,currentPage:c,totalPages:i,disabled:a,hoverState:d,onHover:l})=>{if(!r)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:s.prev,onLeftNext:s.next,leftCurrentPage:c,leftTotalPages:i,leftDisabled:a,leftVisible:!0},right:{onRightPrevious:s.prev,onRightNext:s.next,rightCurrentPage:c,rightTotalPages:i,rightDisabled:a,rightVisible:!0},up:{onUpPrevious:s.prev,onUpNext:s.next,upCurrentPage:c,upTotalPages:i,upDisabled:a,upVisible:!0},down:{onDownPrevious:s.prev,onDownNext:s.next,downCurrentPage:c,downTotalPages:i,downDisabled:a,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:d?0:1,transition:"opacity 0.2s ease",position:"absolute"},children:r}),o&&e.jsx("div",{style:{opacity:d?1:0,transition:"opacity 0.2s ease",position:"absolute"},onMouseEnter:()=>l(!0),onMouseLeave:()=>l(!1),children:e.jsx(zn,{...h[n],size:"sm",showLabels:!0,inline:!0})})]})},yo=n=>{const{totalBlocksLeft:r=0,totalBlocksRight:o=0,totalBlocksUp:s=0,totalBlocksDown:c=0,visibleBlocksLeft:i=1,visibleBlocksRight:a=1,visibleBlocksUp:d=1,visibleBlocksDown:l=1}=n,f=u.useMemo(()=>{const p=Math.max(1,Math.ceil(r/i)),m=Math.max(1,Math.ceil(o/a)),I=Math.max(1,Math.ceil(s/d)),b=Math.max(1,Math.ceil(c/l));return{leftTotalPages:p,rightTotalPages:m,upTotalPages:I,downTotalPages:b,leftStartIndex:0,leftEndIndex:0,rightStartIndex:0,rightEndIndex:0,upStartIndex:0,upEndIndex:0,downStartIndex:0,downEndIndex:0}},[r,o,s,c,i,a,d,l]),[h,g]=u.useState({leftStartIndex:0,rightStartIndex:0,upStartIndex:0,downStartIndex:0}),x=u.useMemo(()=>{const{leftTotalPages:p,rightTotalPages:m,upTotalPages:I,downTotalPages:b}=f,j=Math.min(h.leftStartIndex,Math.max(0,r-i)),S=Math.min(j+i,r),w=Math.min(h.rightStartIndex,Math.max(0,o-a)),O=Math.min(w+a,o),C=Math.min(h.upStartIndex,Math.max(0,s-d)),k=Math.min(C+d,s),v=Math.min(h.downStartIndex,Math.max(0,c-l)),R=Math.min(v+l,c);return{leftTotalPages:p,rightTotalPages:m,upTotalPages:I,downTotalPages:b,leftStartIndex:j,leftEndIndex:S,rightStartIndex:w,rightEndIndex:O,upStartIndex:C,upEndIndex:k,downStartIndex:v,downEndIndex:R}},[h,f,i,a,d,l,r,o,s,c]),y={goToLeftPage:u.useCallback(p=>{const m=Math.max(0,(p-1)*i);g(I=>({...I,leftStartIndex:Math.min(m,Math.max(0,r-i))}))},[i,r]),goToRightPage:u.useCallback(p=>{const m=Math.max(0,(p-1)*a);g(I=>({...I,rightStartIndex:Math.min(m,Math.max(0,o-a))}))},[a,o]),goToUpPage:u.useCallback(p=>{const m=Math.max(0,(p-1)*d);g(I=>({...I,upStartIndex:Math.min(m,Math.max(0,s-d))}))},[d,s]),goToDownPage:u.useCallback(p=>{const m=Math.max(0,(p-1)*l);g(I=>({...I,downStartIndex:Math.min(m,Math.max(0,c-l))}))},[l,c]),nextLeftPage:u.useCallback(()=>{g(p=>({...p,leftStartIndex:Math.min(p.leftStartIndex+1,Math.max(0,r-i))}))},[r,i]),previousLeftPage:u.useCallback(()=>{g(p=>({...p,leftStartIndex:Math.max(p.leftStartIndex-1,0)}))},[]),nextRightPage:u.useCallback(()=>{g(p=>({...p,rightStartIndex:Math.min(p.rightStartIndex+1,Math.max(0,o-a))}))},[o,a]),previousRightPage:u.useCallback(()=>{g(p=>({...p,rightStartIndex:Math.max(p.rightStartIndex-1,0)}))},[]),nextUpPage:u.useCallback(()=>{g(p=>({...p,upStartIndex:Math.min(p.upStartIndex+1,Math.max(0,s-d))}))},[s,d]),previousUpPage:u.useCallback(()=>{g(p=>({...p,upStartIndex:Math.max(p.upStartIndex-1,0)}))},[]),nextDownPage:u.useCallback(()=>{g(p=>({...p,downStartIndex:Math.min(p.downStartIndex+1,Math.max(0,c-l))}))},[c,l]),previousDownPage:u.useCallback(()=>{g(p=>({...p,downStartIndex:Math.max(p.downStartIndex-1,0)}))},[])};return[h,y,x]},vo=(n,r=0,o=0,s=0,c=0)=>{const[i,a]=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 l=()=>{a({width:window.innerWidth,height:window.innerHeight})};return window.addEventListener("resize",l),()=>window.removeEventListener("resize",l)},[]),u.useMemo(()=>{const{gap:l,cellSize:f,minBlocksPerSide:h=2,maxBlocksPerSide:g=15,minBlocksLeft:x=1,maxBlocksLeft:y=8,minBlocksRight:p=1,maxBlocksRight:m=8,minBlocksUp:I=1,maxBlocksUp:b=8,minBlocksDown:j=1,maxBlocksDown:S=8,responsiveCellSize:w=!1,minCellSize:O="30px",maxCellSize:C="80px"}=n,k=parseFloat(l.replace("px","")),v=parseFloat(f.replace("px","")),R=i.width-k*4,D=i.height-k*4,B=v+k,E=Math.floor(R/(2*B)),N=v+k,H=Math.floor(D/N)+2,F=Math.min(E,H),P=Math.max(h,Math.min(g,F)),V=Math.max(x,Math.min(y,Math.floor(F/2))),U=Math.max(p,Math.min(m,Math.floor(F/2)));let G=f;if(w){const A=parseFloat(O.replace("px","")),L=parseFloat(C.replace("px","")),_=Math.min(R/(i.width*.8),D/(i.height*.8));G=`${Math.max(A,Math.min(L,v*_))}px`}const $=Math.min(i.width/1920,i.height/1080);let Q,T;if(s>0&&c>0){const A=Math.max(s,c);Q=Math.max(I,Math.min(b,A)),T=Q}else{const A=Math.max(I,j),L=Math.min(b,S),_=Math.max(A,Math.min(L,Math.ceil(A+(L-A)*$)));Q=_,T=_}if(Q+T+1>H){const A=Math.max(2,H-1);if(Math.max(I,j)*2>A){const _=Math.max(1,Math.floor(A/2));Q=_,T=_}else{const _=Math.max(I,j);Q=_,T=_}}return console.log("Responsive Matrix Debug:",{windowSize:i,screenSizeRatio:$,minBlocksUp:I,minBlocksDown:j,maxBlocksUp:b,maxBlocksDown:S,blocksUp:s,blocksDown:c,calculatedBlocksUp:Q,calculatedBlocksDown:T,totalVerticalBlocks:Q+T+1,isSymmetric:Q===T,availableHeight:D,maxBlocksVertical:H}),{blocksPerSide:P,blocksLeft:V,blocksRight:U,cellSize:G,blocksUp:Q,blocksDown:T}},[i,n,r,o,s,c])},jo=({gap:n,cellSize:r,blocksLeft:o,blocksRight:s,blocksUp:c,blocksDown:i,totalBlocksLeft:a,totalBlocksRight:d,totalBlocksUp:l,totalBlocksDown:f,responsive:h,minBlocksPerSide:g,maxBlocksPerSide:x,minBlocksLeft:y,maxBlocksLeft:p,minBlocksRight:m,maxBlocksRight:I,minBlocksUp:b,maxBlocksUp:j,minBlocksDown:S,maxBlocksDown:w,responsiveCellSize:O,minCellSize:C,maxCellSize:k})=>{const v=u.useMemo(()=>a!==void 0||d!==void 0||l!==void 0||f!==void 0,[a,d,l,f]),R=vo({gap:n,cellSize:r,minBlocksPerSide:g,maxBlocksPerSide:x,minBlocksLeft:y,maxBlocksLeft:p,minBlocksRight:m,maxBlocksRight:I,minBlocksUp:b,maxBlocksUp:j,minBlocksDown:S,maxBlocksDown:w,responsiveCellSize:O,minCellSize:C,maxCellSize:k},o??0,s??0,c,i),D=u.useMemo(()=>{let H=h?R.blocksLeft:o??0,F=h?R.blocksRight:s??0,P=h?R.blocksUp:c??0,V=h?R.blocksDown:i??0;if(!h){const U=parseFloat(n.replace("px","")),G=parseFloat(r.replace("px","")),$=typeof window<"u"?window.innerWidth-U*4:1920,Q=typeof window<"u"?window.innerHeight-U*4:1080,T=G+U,z=Math.floor($/(2*T)),A=Math.floor(Q/(2*T));H=Math.min(H,z),F=Math.min(F,z),P=Math.min(P,A),V=Math.min(V,A)}return{left:H,right:F,up:P,down:V}},[h,R,o,s,c,i,n,r]),B=u.useMemo(()=>{const H=v&&a?Math.min(D.left,a):D.left,F=v&&d?Math.min(D.right,d):D.right,P=v&&l?Math.min(D.up,l):D.up,V=v&&f?Math.min(D.down,f):D.down;return{left:H,right:F,up:P,down:V}},[v,D,a,d,l,f]),E=h?R.cellSize:r,N=u.useMemo(()=>{const H=(B.left>0?B.left:0)+1+(B.right>0?B.right:0),F=B.up>0||B.down>0?B.up+1+B.down:1,P=`${E} `.repeat(B.left)+"1fr "+`${E} `.repeat(B.right),V=B.up>0||B.down>0?`${E} `.repeat(B.up)+"1fr "+`${E} `.repeat(B.down):"1fr";return{totalColumns:H,totalRows:F,gridTemplateColumns:P.trim(),gridTemplateRows:V.trim()}},[B,E]);return{usePagination:v,visibleBlocks:D,finalBlocks:B,finalCellSize:E,gridDimensions:N}},bo=({blockItems:n})=>{const r=u.useMemo(()=>n.reduce((c,i)=>(c[i.id]=i,c),{}),[n]);return{getBlockContent:(c,i)=>{const a=`${c}-${i}`,d=r[a];return d?d.content:u.createElement("div",{style:{padding:"4px",textAlign:"center",fontSize:"10px",writingMode:c==="left"||c==="right"?"vertical-rl":"horizontal-tb",textOrientation:"mixed",width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center",overflow:"hidden"}})},getIntersectionText:(c,i,a,d)=>{const l=[];if(c!==null){const f=r[`left-${c}`];l.push(f?`left-${c}`:`left${c+1}`)}if(i!==null){const f=r[`right-${i}`];l.push(f?`right-${i}`:`right${i+1}`)}if(a!==null){const f=r[`up-${a}`];l.push(f?`up-${a}`:`up${a+1}`)}if(d!==null){const f=r[`down-${d}`];l.push(f?`down-${d}`:`down${d+1}`)}return l.join(", ")}}},wo=({blockConnections:n})=>{const r=u.useMemo(()=>{const s=new Map;return n.forEach(c=>{const i=`${c.source}-${c.target}`,a=`${c.target}-${c.source}`;s.set(i,c),s.set(a,c)}),s},[n]);return{getConnectionStateFromText:s=>{const c=s.split(", ").map(i=>i.trim());for(let i=0;i<c.length;i++)for(let a=i+1;a<c.length;a++){const d=c[i],l=c[a],f=`${d}-${l}`,h=r.get(f);if(h)return h.type}return"empty"}}},So=({usePagination:n,totalBlocksLeft:r,totalBlocksRight:o,totalBlocksUp:s,totalBlocksDown:c,paginationActions:i,paginationState:a,paginationInfo:d})=>{const[l,f]=u.useState({left:!1,right:!1,up:!1,down:!1}),h=(x,y)=>{f(p=>({...p,[x]:y}))};return{hoverStates:l,handleHover:h,getNavigationControlProps:x=>{const y={left:r,right:o,up:s,down:c}[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],m={left:a.leftStartIndex,right:a.rightStartIndex,up:a.upStartIndex,down:a.downStartIndex}[x],I={left:d.leftTotalPages,right:d.rightTotalPages,up:d.upTotalPages,down:d.downTotalPages}[x];return{show:n&&!!y,totalBlocks:y,actions:p,currentPage:m+1,totalPages:I,disabled:!y,hoverState:l[x],onHover:b=>h(x,b)}}}},ko=({blockItems:n,blockConnections:r})=>{const[o,s]=u.useState(null),[c,i]=u.useState(!1),a=u.useMemo(()=>{const m=new Map;return r.forEach(I=>{const b=`${I.source}-${I.target}`,j=`${I.target}-${I.source}`;m.set(b,I),m.set(j,I)}),m},[r]),d=u.useCallback(m=>{const I=[];return n.forEach(b=>{if(b.id!==m){const j=`${m}-${b.id}`;a.has(j)&&I.push(b.id)}}),I},[n,a]),l=u.useCallback(m=>{const I=n.find(S=>S.id===m);if(!I)return[];const b=d(m),j=[m];switch(I.type){case"up":b.forEach(S=>{const w=n.find(O=>O.id===S);w&&(w.type==="left"||w.type==="right")&&(j.push(S),d(S).forEach(C=>{const k=n.find(v=>v.id===C);k&&k.type==="down"&&j.push(C)}))});break;case"down":b.forEach(S=>{const w=n.find(O=>O.id===S);w&&(w.type==="left"||w.type==="right")&&(j.push(S),d(S).forEach(C=>{const k=n.find(v=>v.id===C);k&&k.type==="up"&&j.push(C)}))});break;case"left":b.forEach(S=>{const w=n.find(O=>O.id===S);w&&(w.type==="up"||w.type==="down")&&(j.push(S),d(S).forEach(C=>{const k=n.find(v=>v.id===C);k&&k.type==="right"&&j.push(C)}))});break;case"right":b.forEach(S=>{const w=n.find(O=>O.id===S);w&&(w.type==="up"||w.type==="down")&&(j.push(S),d(S).forEach(C=>{const k=n.find(v=>v.id===C);k&&k.type==="left"&&j.push(C)}))});break}return[...new Set(j)]},[n,d]),f=u.useCallback(m=>!0,[]),h=u.useCallback(m=>!c||!o?!1:!l(o).includes(m),[c,o,l]),g=u.useCallback(m=>!c||!o?!1:l(o).includes(m),[c,o,l]),x=u.useCallback(m=>{c&&o===m?(i(!1),s(null)):(s(m),i(!0))},[c,o]),y=u.useCallback(m=>{console.log(`Block clicked: ${m}`)},[]),p=u.useCallback(()=>{i(!1),s(null)},[]);return{selectedBlockId:o,isFiltering:c,isBlockVisible:f,isBlockDimmed:h,shouldShowBlueBorder:g,handleBlockPress:x,handleBlockClick:y,clearFiltering:p,getFilteredBlockIds:l}},qe=n=>parseInt(n.replace(/[^\d]/g,""),10)||0,Co=(n,r)=>{const[o,s]=u.useState({width:0,height:0}),c=u.useCallback(()=>{const{width:i,height:a}=o;if(i===0||a===0)return{blocksUp:r.minVerticalBlocks/2,blocksDown:r.minVerticalBlocks/2,blocksLeft:r.minHorizontalBlocks/2,blocksRight:r.minHorizontalBlocks/2,containerWidth:i,containerHeight:a};const d=qe(r.cellSize),l=qe(r.gap),f=d+l,h=i-l*2,g=a-l*2,x=Math.floor(g*r.verticalMaxPercent/100/f),y=Math.floor(h*r.horizontalMaxPercent/100/f),p=Math.floor(g*r.verticalMinPercent/100/f),m=Math.floor(h*r.horizontalMinPercent/100/f),I=Math.max(r.minVerticalBlocks,p),b=Math.max(r.minHorizontalBlocks,m),j=Math.max(I,x),S=Math.max(b,y),w=Math.floor(j/2),O=Math.floor(j/2),C=Math.floor(S/2),k=Math.floor(S/2);return{blocksUp:w,blocksDown:O,blocksLeft:C,blocksRight:k,containerWidth:i,containerHeight:a}},[o,r]);return u.useEffect(()=>{const i=()=>{if(n.current){const d=n.current.getBoundingClientRect();s({width:d.width,height:d.height})}};i();const a=new ResizeObserver(i);return n.current&&a.observe(n.current),()=>{a.disconnect()}},[n]),c()},Mo={verticalMinPercent:20,verticalMaxPercent:50,horizontalMinPercent:30,horizontalMaxPercent:50,minVerticalBlocks:2,minHorizontalBlocks:4,cellSize:"50px",gap:"8px"},Rn=({children:n,style:r,gap:o="8px",cellSize:s="50px",verticalBlocks:c,horizontalBlocks:i,responsiveConfig:a,enableResponsive:d=!1,blocksLeft:l,blocksRight:f,blocksUp:h=0,blocksDown:g=0,blockItems:x=[],blockConnections:y=[],enableFiltering:p=!1,onBlockClick:m,totalBlocksLeft:I,totalBlocksRight:b,totalBlocksUp:j,totalBlocksDown:S,usePagination:w=!1,responsive:O=!1,minBlocksPerSide:C=2,maxBlocksPerSide:k=15,minBlocksHorizontal:v=2,maxBlocksHorizontal:R=16,minBlocksVertical:D=2,maxBlocksVertical:B=16,minBlocksLeft:E=1,maxBlocksLeft:N=8,minBlocksRight:H=1,maxBlocksRight:F=8,minBlocksUp:P=1,maxBlocksUp:V=8,minBlocksDown:U=1,maxBlocksDown:G=8,responsiveCellSize:$=!1,minCellSize:Q="30px",maxCellSize:T="80px",directionTexts:z,...A})=>{const L=u.useRef(null),_=Co(L,{...Mo,cellSize:s,gap:o,...a});let ne=l,W=f,oe=h,X=g;d?(ne=Math.floor(_.blocksLeft),W=Math.floor(_.blocksRight),oe=Math.floor(_.blocksUp),X=Math.floor(_.blocksDown)):(c!==void 0||i!==void 0)&&(c!==void 0&&(oe=Math.floor(c/2),X=Math.floor(c/2)),i!==void 0&&(ne=Math.floor(i/2),W=Math.floor(i/2)));const de=E!==1?E:Math.floor(v/2),Oe=N!==8?N:Math.floor(R/2),Be=H!==1?H:Math.ceil(v/2),re=F!==8?F:Math.ceil(R/2),he=P!==1?P:Math.floor(D/2),Ie=V!==8?V:Math.floor(B/2),Un=U!==1?U:Math.ceil(D/2),Nn=G!==8?G:Math.ceil(B/2),{usePagination:Wn,finalBlocks:Y,finalCellSize:ae,gridDimensions:ye}=jo({gap:o,cellSize:s,blocksLeft:ne,blocksRight:W,blocksUp:oe,blocksDown:X,totalBlocksLeft:I,totalBlocksRight:b,totalBlocksUp:j,totalBlocksDown:S,responsive:O,minBlocksPerSide:C,maxBlocksPerSide:k,minBlocksLeft:de,maxBlocksLeft:Oe,minBlocksRight:Be,maxBlocksRight:re,minBlocksUp:he,maxBlocksUp:Ie,minBlocksDown:Un,maxBlocksDown:Nn,responsiveCellSize:$,minCellSize:Q,maxCellSize:T}),{getBlockContent:ve,getIntersectionText:$n}=bo({blockItems:x}),{getConnectionStateFromText:Hn}=wo({blockConnections:y}),q=ko({blockItems:x,blockConnections:y});u.useEffect(()=>{if(!p)return;const ze=J=>{J.key==="Escape"&&q.clearFiltering()};return window.addEventListener("keydown",ze),()=>window.removeEventListener("keydown",ze)},[p,q]);const[ie,Gn,Vn]=yo({totalBlocksLeft:I??0,totalBlocksRight:b??0,totalBlocksUp:j??0,totalBlocksDown:S??0,visibleBlocksLeft:Y.left,visibleBlocksRight:Y.right,visibleBlocksUp:Y.up,visibleBlocksDown:Y.down}),{getNavigationControlProps:ue}=So({usePagination:Wn,totalBlocksLeft:I,totalBlocksRight:b,totalBlocksUp:j,totalBlocksDown:S,paginationActions:Gn,paginationState:ie,paginationInfo:Vn});return e.jsxs(t.Box,{ref:L,style:{display:"grid",gridTemplateColumns:ye.gridTemplateColumns,gridTemplateRows:ye.gridTemplateRows,width:"100vw",height:"100vh",maxWidth:"100vw",maxHeight:"100vh",padding:o,boxSizing:"border-box",gap:o,overflow:"hidden",...r},...A,children:[Array.from({length:ye.totalRows},(ze,J)=>Array.from({length:ye.totalColumns},(Qo,te)=>{const Re=Y.up>0?J===Y.up:J===0,De=te===Y.left;if(Re&&De)return e.jsxs(Sn,{style:{width:"100%",height:"100%",maxWidth:"none",maxHeight:"none",position:"relative"},children:[n,e.jsx(be,{direction:"left",text:z==null?void 0:z.left,...ue("left")}),e.jsx(be,{direction:"right",text:z==null?void 0:z.right,...ue("right")}),e.jsx(be,{direction:"up",text:z==null?void 0:z.up,...ue("up")}),e.jsx(be,{direction:"down",text:z==null?void 0:z.down,...ue("down")}),w&&e.jsx(Bn,{showLeftControls:!!I,showRightControls:!!b,showUpControls:!!j,showDownControls:!!S,onLeftHover:Z=>ue("left").onHover(Z),onRightHover:Z=>ue("right").onHover(Z),onUpHover:Z=>ue("up").onHover(Z),onDownHover:Z=>ue("down").onHover(Z)})]},`center-${J}-${te}`);if(Re&&te<Y.left){const Z=w&&I?ie.leftStartIndex+te:te,ee=`left-${Z}`;return e.jsx(Cn,{size:ae,blockId:p?ee:void 0,isVisible:p?q.isBlockVisible(ee):!0,isDimmed:p?q.isBlockDimmed(ee):!1,shouldShowBlueBorder:p?q.shouldShowBlueBorder(ee):!1,onBlockClick:p?q.handleBlockClick:m,onBlockPress:p?q.handleBlockPress:void 0,children:ve("left",Z)},`left-${te}`)}if(Re&&te>Y.left){const Z=te-Y.left-1,ee=w&&b?ie.rightStartIndex+(Y.right-1-Z):Y.right-1-Z,ce=`right-${ee}`;return e.jsx(Mn,{size:ae,blockId:p?ce:void 0,isVisible:p?q.isBlockVisible(ce):!0,isDimmed:p?q.isBlockDimmed(ce):!1,shouldShowBlueBorder:p?q.shouldShowBlueBorder(ce):!1,onBlockClick:p?q.handleBlockClick:m,onBlockPress:p?q.handleBlockPress:void 0,children:ve("right",ee)},`right-${Z}`)}if(De&&J<Y.up){const Z=w&&j?ie.upStartIndex+J:J,ee=`up-${Z}`;return e.jsx(Tn,{size:ae,blockId:p?ee:void 0,isVisible:p?q.isBlockVisible(ee):!0,isDimmed:p?q.isBlockDimmed(ee):!1,shouldShowBlueBorder:p?q.shouldShowBlueBorder(ee):!1,onBlockClick:p?q.handleBlockClick:m,onBlockPress:p?q.handleBlockPress:void 0,children:ve("up",Z)},`up-${J}`)}if(De&&J>Y.up){const Z=J-Y.up-1,ee=w&&S?ie.downStartIndex+Z:Z,ce=`down-${ee}`;return e.jsx(On,{size:ae,blockId:p?ce:void 0,isVisible:p?q.isBlockVisible(ce):!0,isDimmed:p?q.isBlockDimmed(ce):!1,shouldShowBlueBorder:p?q.shouldShowBlueBorder(ce):!1,onBlockClick:p?q.handleBlockClick:m,onBlockPress:p?q.handleBlockPress:void 0,children:ve("down",ee)},`down-${Z}`)}const Ee=te<Y.left?te:null,je=te>Y.left?te-Y.left-1:null,Ae=J<Y.up?J:null,Pe=J>Y.up?J-Y.up-1:null,_n=w&&I&&Ee!==null?ie.leftStartIndex+Ee:Ee,Qn=w&&b&&je!==null?ie.rightStartIndex+(Y.right-1-je):je!==null?Y.right-1-je:null,Yn=w&&j&&Ae!==null?ie.upStartIndex+Ae:Ae,qn=w&&S&&Pe!==null?ie.downStartIndex+Pe:Pe,Le=$n(_n,Qn,Yn,qn);if(Le&&Le.length>0){const Z=Hn(Le);return e.jsx(kn,{size:ae,state:Z,interactive:!1},`intersection-${J}-${te}`)}return e.jsx("div",{style:{width:ae,height:ae,minWidth:ae,minHeight:ae}},`empty-${J}-${te}`)})).flat(),p&&q.isFiltering&&e.jsx(t.Box,{style:{position:"fixed",top:12,right:12,background:"rgba(255, 255, 255, 0.9)",color:"var(--mantine-color-dark-7)",padding:"8px 12px",borderRadius:"8px",boxShadow:"0 2px 10px rgba(0,0,0,0.12)",fontSize:12,fontWeight:600,pointerEvents:"none",zIndex:1e3},children:"Press Esc to clear filter"})]})};Rn.displayName="Matrix";const To=({opened:n,onClose:r,children:o,...s})=>e.jsxs(t.Modal,{withCloseButton:!1,opened:n,onClose:r,size:"70%",centered:!0,overlayProps:{backgroundOpacity:.55},styles:{content:{minHeight:"100%"}},padding:"md",...s,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(K,{icon:M.IconMaximize,size:"md",onClick:()=>{}})}),e.jsxs(t.Group,{justify:"space-between",gap:"xs",children:[e.jsx(K,{icon:M.IconStar,size:"md",onClick:()=>{}}),e.jsx(K,{icon:M.IconDots,size:"md",onClick:()=>{}})]})]}),o]}),Dn=({opened:n,onClose:r,editable:o,content:s,position:c="right",size:i="xl",onMaximize:a,rightCornerActions:d,headerProps:l,propertiesProps:f})=>{var w,O;const[h,g]=u.useState(!1),x=(f==null?void 0:f.hiddenProperties)&&f.hiddenProperties.length>0,[y,p]=u.useState(!1),[m,I]=u.useState(l==null?void 0:l.avatar),[b,j]=u.useState(!1);u.useEffect(()=>{I(l==null?void 0:l.avatar)},[l==null?void 0:l.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 C={type:"emoji",value:"😊"};I(C),(k=l==null?void 0:l.onAvatarChange)==null||k.call(l,C)},children:e.jsxs(t.Box,{style:{display:"flex",alignItems:"center",justifyContent:"center",gap:6},children:[e.jsx(M.IconMoodSmileFilled,{size:16}),e.jsx(t.Text,{size:"sm",fw:500,children:"Add avatar"})]})});return e.jsxs(t.Drawer,{opened:n,onClose:r,position:c,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(K,{icon:M.IconChevronsRight,size:"md",onClick:r}),e.jsx(K,{icon:M.IconMaximize,size:"md",onClick:()=>a()})]}),e.jsx(t.Group,{justify:"space-between",gap:"xs",children:d})]}),e.jsxs(t.Box,{p:"3rem",children:[l&&e.jsxs(t.Box,{children:[e.jsx(t.Box,{onMouseEnter:()=>p(!0),onMouseLeave:()=>p(!1),children:m?e.jsx(In,{editable:o,avatar:m,size:"xl",opened:b,onOpen:()=>j(!0),onClose:()=>j(!1),onAvatarSelect:C=>{var k;I(C),(k=l==null?void 0:l.onAvatarChange)==null||k.call(l,C)},onRemove:()=>{I(void 0)}}):e.jsx(t.Box,{h:24,children:y&&S})}),o?e.jsx(rn,{value:l.title||"",onChange:C=>{var k;return(k=l.onTitleChange)==null?void 0:k.call(l,C)},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})})]}),e.jsx(t.Stack,{gap:"sm",children:(w=f==null?void 0:f.visibleProperties)==null?void 0:w.map((C,k)=>e.jsx(t.Box,{children:C},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:()=>g(!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(M.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:(O=f==null?void 0:f.hiddenProperties)==null?void 0:O.map((C,k)=>e.jsx(t.Box,{children:C},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:()=>g(!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(M.IconChevronUp,{size:16,color:"var(--mantine-color-blue-5)"})]})})}),s]})]})},Oo=({children:n})=>e.jsx(t.Box,{style:{minHeight:"100vh",width:"100%",maxWidth:"100%",margin:"0 auto"},id:"full-page",children:n}),En=u.createContext(void 0),An=({children:n})=>{const[r,{toggle:o,open:s,close:c}]=xe.useDisclosure(!0),[i,{toggle:a,open:d,close:l}]=xe.useDisclosure(!1),[f,{open:h,close:g}]=xe.useDisclosure(!1),[x,y]=u.useState(300),[p,m]=u.useState(500),I={opened:r,toggle:o,open:s,close:c,asideOpened:i,toggleAside:a,openAside:d,closeAside:l,sidebarWidth:x,setSidebarWidth:y,asideWidth:p,setAsideWidth:m,openedNotificationSidebar:f,openNotificationSidebar:h,closeNotificationSidebar:g};return e.jsx(En.Provider,{value:I,children:n})},Ve=()=>{const n=u.useContext(En);if(n===void 0)throw new Error("useAppLayout must be used within an AppLayoutProvider");return n},Pn=({header:n,navbar:r,aside:o,children:s,...c})=>{const{opened:i,asideOpened:a,sidebarWidth:d,asideWidth:l}=Ve();return e.jsxs(t.AppShell,{header:{height:n?60:0},navbar:{width:i?d:0,breakpoint:"sm",collapsed:{mobile:!0}},aside:{width:a?l:0,breakpoint:"sm",collapsed:{mobile:!0}},padding:0,...c,children:[n&&e.jsx(t.AppShell.Header,{children:n}),e.jsx(t.AppShell.Navbar,{style:{display:i?"block":"none",width:i?d:0,border:"none"},children:r}),e.jsx(t.AppShell.Aside,{style:{display:a?"block":"none",width:a?l:0},children:o}),e.jsx(t.AppShell.Main,{children:s})]})},Bo=({items:n,selectedId:r,onSelect:o})=>e.jsx(t.Stack,{gap:0,children:n.map(s=>{var c;return e.jsx(We,{label:s.label,isActive:r===s.id,noChild:!s.children||s.children.length===0,onClick:()=>(!s.children||s.children.length===0)&&(o==null?void 0:o(s.id)),children:(c=s.children)==null?void 0:c.map(i=>e.jsx(We,{label:i.label,noChild:!0,level:4,isActive:r===i.id,onClick:()=>o==null?void 0:o(i.id)},i.id))},s.id)})}),zo=({items:n,selectedId:r,onSelect:o,headerLeft:s,headerRight:c,renderPreview:i,renderAside:a,sidebarTitle:d="Documentation",topNavItems:l,selectedTopNavId:f,onTopNavSelect:h})=>{const{opened:g,toggle:x}=Ve(),[y,p]=u.useState(r),m=r??y,I=b=>{o==null||o(b),r===void 0&&p(b)};return e.jsx(Pn,{header:l?e.jsx($e,{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:g&&e.jsx(t.Text,{fw:600,size:"sm",children:d})})})}):void 0,navbar:e.jsx($e,{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:g&&e.jsx(t.Text,{fw:600,size:"sm",children:d})}),e.jsx(K,{icon:g?M.IconChevronsLeft:M.IconChevronsRight,size:"md",onClick:x})]}),body:g&&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(Bo,{items:n,selectedId:m,onSelect:I})}),footer:e.jsx(e.Fragment,{})}),aside:e.jsx(t.Box,{p:"md",h:"100%",children:a==null?void 0:a(m)}),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:[!g&&e.jsx(K,{icon:M.IconChevronsRight,size:"md",variant:"subtle",tooltip:"Open sidebar",onClick:x}),s??e.jsx(He,{label:m||"Select a topic",onClick:()=>{}})]}),!l&&c]}),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(m)})})]})})},Ro=n=>e.jsx(An,{children:e.jsx(zo,{...n})}),Ln=({editable:n=!1,children:r,label:o,icon:s,value:c,className:i,style:a,...d})=>{const l={className:i,style:a};return xe.useMediaQuery("(max-width: 550px)",!1,{getInitialValueInEffect:!0})?e.jsxs(t.Stack,{gap:0,w:"100%",...l,children:[e.jsxs(t.Box,{style:{display:"flex",alignItems:"center",gap:8},h:"auto",children:[s&&e.jsx(s,{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&&r?r:c})]}):e.jsxs(t.Group,{align:"flex-start",gap:0,w:"100%",...d,...l,children:[e.jsxs(t.Box,{w:"30%",style:{display:"flex",alignItems:"center",gap:8},h:"40px",children:[s&&e.jsx(s,{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&&r?r:c})]})},Do=300,Eo=({users:n,onSearch:r,debounceSearch:o=!0,debounceDelay:s=Do})=>{const[c,i]=u.useState(""),[a,d]=u.useState(n),[l,f]=u.useState(!1),h=u.useRef(null);return u.useEffect(()=>{if(!r){d(n);return}if(h.current&&clearTimeout(h.current),c.trim()){const g=async()=>{f(!0);try{const x=await r(c);d(x)}catch(x){console.error("Search error:",x)}finally{f(!1)}};o?h.current=setTimeout(g,s):g()}else d(n),f(!1);return()=>{h.current&&clearTimeout(h.current)}},[c,r,o,s,n]),u.useEffect(()=>{(!c.trim()||!r)&&d(n)},[n,c,r]),{searchQuery:c,setSearchQuery:i,displayedUsers:a,setDisplayedUsers:d,isSearching:l}},Ao=({value:n,multiple:r,users:o,displayedUsers:s,searchQuery:c,onSearch:i})=>{const a=u.useMemo(()=>r?Array.isArray(n)?n:[]:n?[n]:[],[n,r]),d=u.useMemo(()=>o.filter(h=>a.includes(h.id)),[o,a]),l=u.useMemo(()=>{if(!c.trim()||i)return s;const h=c.toLowerCase();return s.filter(g=>g.name.toLowerCase().includes(h)||g.email.toLowerCase().includes(h))},[s,c,i]),f=u.useMemo(()=>{const h=l.filter(y=>a.includes(y.id)),g=l.filter(y=>!a.includes(y.id)),x=d.filter(y=>!l.some(p=>p.id===y.id));return[...h,...x,...g]},[l,a,d]);return{selectedIds:a,selectedUsers:d,sortedUsers:f}},Po=({isFocused:n,dropdownRef:r})=>{const[o,s]=u.useState("bottom"),c=u.useCallback(i=>{if(r.current=i,i){const a=i.dataset.position;a==="top"||a==="bottom"?s(a):requestAnimationFrame(()=>{if(i.dataset.position){const d=i.dataset.position;(d==="top"||d==="bottom")&&s(d)}})}},[r]);return u.useLayoutEffect(()=>{if(!n||!r.current)return;const i=()=>{if(r.current){const l=r.current.dataset.position;(l==="top"||l==="bottom")&&s(l)}};i();const a=requestAnimationFrame(i),d=new MutationObserver(()=>{i()});return r.current&&d.observe(r.current,{attributes:!0,attributeFilter:["data-position"]}),()=>{cancelAnimationFrame(a),d.disconnect()}},[n,r]),{placement:o,dropdownRefCallback:c}},Lo=({onLoadMore:n,hasMore:r,loading:o,setDisplayedUsers:s})=>{const c=u.useRef(null);return u.useEffect(()=>{if(!n||!r||o)return;const i=new IntersectionObserver(a=>{a[0].isIntersecting&&r&&!o&&n().then(d=>{s(l=>[...l,...d])})},{threshold:.1});return c.current&&i.observe(c.current),()=>{i.disconnect()}},[n,r,o,s]),{loadMoreRef:c}},Fo=({combobox:n,dropdownRef:r})=>{const[o,s]=u.useState(!1),[c,i]=u.useState(!1),a=u.useCallback(()=>{s(!0),n.openDropdown()},[n]),d=u.useCallback(h=>{setTimeout(()=>{const g=h==null?void 0:h.relatedTarget;g&&r.current&&r.current.contains(g)||n.dropdownOpened||s(!1)},0)},[n,r]),l=u.useCallback(()=>{i(!0)},[]),f=u.useCallback(()=>{i(!1)},[]);return{isFocused:o,setIsFocused:s,isHovered:c,handleFocus:a,handleBlur:d,handleMouseEnter:l,handleMouseLeave:f}},Uo=({multiple:n,value:r,onChange:o,combobox:s})=>{const c=u.useCallback(a=>{if(n){const d=Array.isArray(r)?r:[],l=d.includes(a)?d.filter(f=>f!==a):[...d,a];o==null||o(l)}else o==null||o(a),s.closeDropdown()},[n,r,o,s]),i=u.useCallback(a=>{if(n){const d=Array.isArray(r)?r:[];o==null||o(d.filter(l=>l!==a))}else o==null||o("")},[n,r,o]);return{handleSelect:c,handleRemove:i}},No="40px",Wo=300,Ne=({editable:n=!1,label:r,icon:o,value:s,users:c=[],onChange:i,placeholder:a="Select users",multiple:d=!1,disabled:l=!1,onSearch:f,debounceSearch:h=!0,debounceDelay:g=Wo,onLoadMore:x,hasMore:y=!1,loading:p=!1})=>{const m=u.useRef(null),I=u.useRef(null),b=u.useRef(null),{searchQuery:j,setSearchQuery:S,displayedUsers:w,setDisplayedUsers:O,isSearching:C}=Eo({users:c,onSearch:f,debounceSearch:h,debounceDelay:g}),k=t.useCombobox({onDropdownClose:()=>{k.resetSelectedOption(),S(""),R(!1)},onDropdownOpen:()=>{k.updateSelectedOptionIndex("active"),R(!0)}}),{isFocused:v,setIsFocused:R,isHovered:D,handleFocus:B,handleBlur:E,handleMouseEnter:N,handleMouseLeave:H}=Fo({combobox:k,dropdownRef:b}),{placement:F,dropdownRefCallback:P}=Po({isFocused:v,dropdownRef:b}),{selectedIds:V,selectedUsers:U,sortedUsers:G}=Ao({value:s,multiple:d,users:c,displayedUsers:w,searchQuery:j,onSearch:f}),{loadMoreRef:$}=Lo({onLoadMore:x,hasMore:y,loading:p,setDisplayedUsers:O}),{handleSelect:Q,handleRemove:T}=Uo({multiple:d,value:s,onChange:i,combobox:k}),z=()=>{if(!d)return null;const W=5,oe=U.slice(0,W),X=U.length-W;return e.jsxs(t.Group,{gap:"xs",children:[oe.map(de=>e.jsx(we,{avatar:de.avatar,name:de.name,withRemoveButton:v,onRemove:()=>T(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(M.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(d)return null;const W=U[0];return W?e.jsx(we,{avatar:W.avatar,name:W.name}):null},L=()=>v?"var(--mantine-color-gray-2)":"var(--mantine-color-gray-0)",_=()=>({input:{position:v?"absolute":"relative",zIndex:v?1e3:1,fontWeight:"400",color:"var(--mantine-color-gray-9)",cursor:l?"not-allowed":"pointer",backgroundColor:v||D?"var(--mantine-color-gray-0)":"transparent",border:v?"1px solid var(--mantine-color-gray-2)":"1px solid transparent",borderRadius:v&&F==="bottom"?"var(--mantine-radius-md) var(--mantine-radius-md) 0 0":v&&F==="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:d?"wrap":"nowrap",boxShadow:v&&F==="bottom"?"0 -4px 10px 0 rgba(0, 0, 0, 0.1)":v&&F==="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(Ln,{editable:n,label:r,icon:o,value:e.jsx(t.Group,{gap:"sm",wrap:"nowrap",style:{alignItems:"center"},w:"100%",h:40,p:"14px",children:U.map(W=>e.jsx(we,{avatar:W.avatar,name:W.name,withRemoveButton:v,onRemove:()=>T(W.id)},W.id))}),children:e.jsxs(t.Combobox,{store:k,onOptionSubmit:Q,withinPortal:!1,offset:-2,children:[e.jsx(t.Combobox.DropdownTarget,{children:e.jsx(t.PillsInput,{onClick:()=>!l&&k.openDropdown(),radius:"md",disabled:l,styles:_,onFocus:B,onBlur:E,onMouseEnter:()=>!l&&N(),onMouseLeave:H,w:"100%",children:e.jsxs(t.Pill.Group,{styles:ne,children:[d?z():A(),e.jsx(t.Combobox.EventsTarget,{children:e.jsx(t.PillsInput.Field,{ref:m,onFocus:B,onBlur:E,placeholder:U.length===0||v||j.length>0?a:"",value:j,onChange:W=>{k.updateSelectedOptionIndex(),S(W.currentTarget.value)},onMouseDown:W=>{W.stopPropagation()},onKeyDown:W=>{W.key==="Backspace"&&j.length===0&&(W.preventDefault(),d&&U.length>0?T(U[U.length-1].id):!d&&U.length>0&&T(U[0].id))},pointer:!0,disabled:l,styles:{field:{minWidth:v||j.length>0||U.length===0?"60px":"0px",width:v||j.length>0||U.length===0?"auto":"0px",flex:v||j.length>0||U.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||U.length===0?"auto":"0px",minHeight:v||j.length>0||U.length===0?"auto":"0px","&::placeholder":{opacity:U.length===0||v||j.length>0?1:0,display:U.length===0||v||j.length>0?"block":"none",color:"var(--mantine-color-gray-9)",lineHeight:"24px"}}}})})]})})}),e.jsx(t.Combobox.Dropdown,{styles:{dropdown:{borderRadius:F==="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 ${L()}`,marginTop:"0",padding:"4px",boxShadow:F==="bottom"?"0 4px 10px 0 rgba(0, 0, 0, 0.1)":"0 -4px 10px 0 rgba(0, 0, 0, 0.1)"}},ref:P,children:e.jsx(t.Combobox.Options,{children:e.jsx(t.ScrollArea,{ref:I,h:Math.min(G.length*parseFloat(No),300),scrollbarSize:6,children:e.jsxs(t.Stack,{gap:2,children:[G.map(W=>{const oe=V.includes(W.id);return e.jsx(t.Combobox.Option,{value:W.id,active:oe,onMouseDown:X=>{X.preventDefault(),Q(W.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:W.avatar,size:24,placeholder:W.name,showPlaceholder:!0}),e.jsx(t.Text,{size:"sm",fw:400,truncate:!0,children:W.name}),oe&&e.jsx(M.IconCheck,{size:16,color:"var(--mantine-color-blue-6)"})]})},W.id)}),(C||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:$,style:{height:"20px"}}),G.length===0&&!C&&!p&&e.jsx(t.Box,{style:{padding:"24px",textAlign:"center"},children:e.jsx(t.Text,{size:"sm",c:"dimmed",children:"No users found"})})]})})})})]})})},$o=({label:n,icon:r,value:o,onChange:s,editable:c=!1,placeholder:i,disabled:a=!1,minRows:d=1,maxRows:l,autosize:f=!0})=>{const[h,g]=u.useState(!1),[x,y]=u.useState(!1),p={wrapper:{...!f&&{height:"40px",minHeight:"40px",boxSizing:"border-box"},borderRadius:"var(--mantine-radius-md)"},input:{backgroundColor:h||x?"var(--mantine-color-gray-0)":"transparent",color:"var(--mantine-color-gray-9)",border:h?"1px solid var(--mantine-color-gray-2)":"1px solid transparent",borderRadius:"var(--mantine-radius-md)",width:"100%",cursor:"pointer",...!f&&{height:"40px",minHeight:"40px",boxSizing:"border-box"},padding:"8px 14px",lineHeight:f?"1.5":"24px",fontWeight:450}};return e.jsx(Ln,{editable:c,label:n,icon:r,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||i||"—"})}),children:e.jsx(t.Box,{w:"100%",style:{boxShadow:h?"var(--mantine-shadow-sm)":"none",borderRadius:"var(--mantine-radius-md)"},children:e.jsx(t.Textarea,{value:o,onChange:m=>s==null?void 0:s(m.target.value),onFocus:()=>g(!0),onBlur:()=>g(!1),onMouseEnter:()=>y(!0),onMouseLeave:()=>y(!1),placeholder:i,disabled:a,size:"sm",radius:"md",fw:400,minRows:h?1:d,maxRows:l,autosize:f,styles:{...p}})})})},Ho=(n,r)=>{const o=u.useCallback(i=>{const a=Array.isArray(i)?i:[i];n.onUserIdsChange(a)},[n]),s=u.useCallback(i=>{const a=Array.isArray(i)?i:[i],d=r.members.filter(y=>a.includes(y.id)),l=d.map(y=>y.id),f=a.filter(y=>!l.includes(y)),g=[...r.members,...n.users].filter(y=>f.includes(y.id)),x=[...d,...g];r.onMembersChange(x)},[r,n]);return{availableMembersUsers:u.useMemo(()=>{const i=[...r.members];return n.users.forEach(a=>{i.find(d=>d.id===a.id)||i.push(a)}),i},[r.members,n.users]),handleResponsibleChange:o,handleMembersChange:s}},Go=({opened:n,onClose:r,onMaximize:o,editable:s,name:c,onNameChange:i,avatar:a,onAvatarChange:d,owner:l,responsibleProps:f,membersProps:h,descriptionProps:g})=>{const{availableMembersUsers:x,handleResponsibleChange:y,handleMembersChange:p}=Ho(f,h),m=u.useMemo(()=>[e.jsx($o,{label:"Description",icon:M.IconAlignLeft,value:g.description,onChange:g.onDescriptionChange,editable:s},"description"),e.jsx(Ne,{editable:!1,label:"Team Owner",icon:M.IconUserCircle,value:l.id,users:[l]},"owner"),e.jsx(Ne,{multiple:!1,editable:s,label:"Team Leader",icon:M.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(Ne,{multiple:!0,editable:s,label:"Team Members",icon:M.IconUsers,value:h.members.map(I=>I.id),users:x,onChange:p,onSearch:h.handleSearch,onLoadMore:h.handleLoadMore,hasMore:h.hasMore},"members")],[g.description,g.onDescriptionChange,s,l,f.handleLoadMore,f.handleSearch,f.hasMore,f.userIds,f.users,y,h.handleLoadMore,h.handleSearch,h.hasMore,h.members,x,p]);return e.jsx(Dn,{opened:n,onClose:r,onMaximize:o,editable:s,headerProps:{avatar:a,onAvatarChange:I=>d==null?void 0:d(I),title:c,onTitleChange:i,placeholder:"Team name"},propertiesProps:{visibleProperties:m}})},Vo=({title:n,properties:r,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:r}),e.jsx(t.Space,{h:"md"}),e.jsx(t.Box,{children:o})]}),Fn=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:{gray:["#f6f5f4","#e8e8e8","#cfcfcf","#b5b5b5","#9f9e9d","#91908c","#8b8983","#787670","#6b6962","#37352f"]},components:{}});function _o({children:n,theme:r}){return e.jsxs(t.MantineProvider,{theme:r||Fn,children:[e.jsx(tt.Notifications,{}),e.jsx(ot.ModalsProvider,{children:e.jsx(rt.DatesProvider,{settings:{firstDayOfWeek:0},children:n})})]})}exports.ActionButton=K;exports.AppLayout=Pn;exports.AppLayoutProvider=An;exports.AvatarSelector=In;exports.BaseLayout=Vo;exports.BoxAvatar=se;exports.CenterPeek=To;exports.DocsTemplate=Ro;exports.EditableText=rn;exports.EditableTextarea=pt;exports.EmojiAvatar=Xe;exports.ExpandableSearch=sn;exports.FilterDropdown=It;exports.FilterDropdownButton=Ce;exports.FilterDropdownFilters=Me;exports.FullPage=Oo;exports.GenericTable=cn;exports.IconAvatar=en;exports.ImageAvatar=nn;exports.InvitedUserCard=ge;exports.Logo=on;exports.Matrix=Rn;exports.Menu=me;exports.ModalSettings=to;exports.NavButton=Ge;exports.NavLink=We;exports.Navbar=$e;exports.NavbarProvider=fo;exports.NotificationSidebar=uo;exports.PlaceholderAvatar=ke;exports.PopoverItem=an;exports.PopoverSelector=Te;exports.ShareButton=eo;exports.ShareMenu=jn;exports.ShareModal=no;exports.SidePeek=Dn;exports.TeamSidePeek=Go;exports.TextButton=He;exports.ThemeProvider=_o;exports.UserChip=we;exports.WorkspaceSelector=Io;exports.WorkspaceSelectorItem=wn;exports.getInitialsFromName=tn;exports.theme=Fn;exports.useAppLayout=Ve;exports.useNavbar=ho;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NotificationSidebar.d.ts","sourceRoot":"","sources":["../../../../../src/components/organisms/NotificationSidebar/NotificationSidebar.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EACL,wBAAwB,EAEzB,MAAM,6BAA6B,CAAC;AAiBrC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,eAAO,MAAM,mBAAmB,EAAE,KAAK,CAAC,EAAE,CAAC,wBAAwB,
|
|
1
|
+
{"version":3,"file":"NotificationSidebar.d.ts","sourceRoot":"","sources":["../../../../../src/components/organisms/NotificationSidebar/NotificationSidebar.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EACL,wBAAwB,EAEzB,MAAM,6BAA6B,CAAC;AAiBrC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,eAAO,MAAM,mBAAmB,EAAE,KAAK,CAAC,EAAE,CAAC,wBAAwB,CAiRlE,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "obeyaka-ui",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.16",
|
|
4
4
|
"description": "Professional UI component library with React, TypeScript, Storybook, and Mantine",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.es.js",
|
|
7
|
-
"types": "dist/index.d.ts",
|
|
7
|
+
"types": "dist/types/index.d.ts",
|
|
8
8
|
"files": [
|
|
9
9
|
"dist"
|
|
10
10
|
],
|