1import{r as o,j as e}from"./vendor-react-B-uJOWSj.js";import{D as J}from"./dashboard-layout-s1jIwS5B.js";import{B as N}from"./button-CozFm_86.js";import{I as q}from"./input-CY09TGwo.js";import{a as _,l as w,c as K,b as z,u as Y,k as W,L as V}from"./index-CeaQ1CvA.js";import{D as X,e as Z,a as ee,c as te,b as se,d as re}from"./dialog-DOMvuUoE.js";import{u as ae,a as ie,b as y}from"./vendor-query-kWhkqRot.js";import{T as le}from"./TierLimitDialog-a7cx9UO2.js";import{C as oe}from"./CreateGroupWizard-xJouL47b.js";import{d as ne}from"./timeFormat-BQRTnWEC.js";import{S as I}from"./search-Db8mSIIW.js";import{P as de}from"./plus-DUhw-ROU.js";import{L as ce}from"./loader-circle-D8JIEvg6.js";import{U as me}from"./user-dJW6tbED.js";import{U as pe}from"./users-DnZFc5WL.js";import{A}from"./arrow-right-TyoRsebT.js";import{C as P}from"./calendar-BgAJG2Mn.js";import{S as ue}from"./sparkles-B2970YSx.js";import{C as H}from"./clock-BTi01tXF.js";import{S as xe}from"./shield-check-DGRPXqOL.js";import"./FeedbackDialog-BJlz-XyN.js";import"./label-HYAAgob-.js";import"./textarea-by7FpCSY.js";import"./check-KfsUf5bc.js";import"./phone-CwZTiFlC.js";import"./feature-flags-DCXAz1VB.js";import"./index-CSAQBmOs.js";import"./index-y4u1e3Wx.js";import"./tslib.es6-CwyXKlH1.js";import"./chevron-right-BdxWxTMv.js";import"./menu-BuZ4pJkX.js";import"./house-DY1-RjaJ.js";import"./utensils-1haBW8tv.js";import"./settings-C-BPhE1q.js";import"./circle-question-mark-BGmUwagY.js";import"./tierConfig-CX3EhNbM.js";import"./upgradeFeatures-CuEwMGLw.js";import"./UpgradeOverlay-BE9VfK8H.js";import"./badge-c_BRNB6F.js";import"./analytics-BsPnnpqz.js";function he(){const m=ae(),r=ie({mutationFn:async p=>(await _("POST","/api/communities/join",{inviteCode:p})).json(),onSuccess:()=>{m.invalidateQueries({queryKey:["/api/communities"]})}});return{claimInvitationByCode:r.mutateAsync,claiming:r.isPending}}function ge(m=!1){const{data:r,isLoading:p,error:i,refetch:g}=y({queryKey:["/api/communities"],queryFn:w({on401:"returnNull"}),enabled:!m}),n=(r??[]).map(u=>({...u,userCommunityRoles:[{userId:"",role:u.role}]}));return{payload:r,communities:n,pageInfo:null,loading:p,error:i,refetch:g}}function at(){const[,m]=K(),[r,p]=o.useState(""),[i,g]=o.useState(""),[n,u]=o.useState("all");z();const{claiming:C}=he(),{user:S}=Y(),{communities:f,loading:k}
1=ge(),[F,D]=o.useState(!1),[d,L]=o.useState(null),{data:a}=y({queryKey:["/api/account/usage"],queryFn:w({on401:"returnNull"}),enabled:!!S}),{data:G}=y({queryKey:["/api/communities/next-events"],queryFn:w({on401:"returnNull"}),enabled:!!S&&f.length>0}),M=o.useCallback(()=>{if(a?.groupQuotaEnforced!==!1&&a?.groupLimit!=null&&a.groupsUsed>=a.groupLimit){L({limitType:"group_limit",tier:a.tier,limit:a.groupLimit,currentCount:a.groupsUsed,canUpgrade:a.tier!=="tier5"});return}D(!0)},[a]),$=async t=>{t.preventDefault();const s=r.trim();s&&m(`/join/${s}`)},U=o.useMemo(()=>{let t=f;if(i.trim()){const s=i.toLowerCase();t=t.filter(l=>l.displayName.toLowerCase().includes(s))}return n!=="all"&&(t=t.filter(s=>n==="host"?s.role==="HOST":s.role!=="HOST")),t},[f,i,n]);return e.jsxs(J,{headerColor:"#06262D",children:[e.jsx("div",{className:"min-h-screen bg-slate-50/50",children:e.jsxs("div",{className:"max-w-5xl mx-auto px-4 md:px-8 pt-6 pb-14 space-y-8",children:[e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsx("h1",{"data-testid":"text-my-groups-title",className:"text-3xl md:text-4xl font-serif font-medium text-slate-900",children:"My Groups"}),e.jsxs("div",{className:"flex items-center gap-3 shrink-0",children:[e.jsxs(X,{children:[e.jsx(Z,{asChild:!0,children:e.jsx(N,{"data-testid":"button-join-group",variant:"outline",className:"h-9 md:h-11 px-4 md:px-6 text-xs md:text-sm border-slate-200 hover:bg-white hover:border-slate-300 text-slate-600 rounded-full transition-all",children:"Help me find my people!"})}),e.jsxs(ee,{children:[e.jsxs(te,{children:[e.jsx(se,{children:"Join a Group"}),e.jsx(re,{children:"Enter the unique invite code provided by your group admin."})]}),e.jsxs("form",{onSubmit:$,className:"flex gap-2 mt-4",children:[e.jsxs("div",{className:"relative flex-1",children:[e.jsx(I,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-slate-400"}),e.jsx(q,{"data-testid":"input-join-code",placeholder:"Enter code (e.g. CC-123)",className:"pl-9 bg-slate-50 border-slate-200",value:r,onChange:t=>p(t.target.value),disabled:C})]}),e.jsx(N,{"data-testid":"button-submit-join",type:"submit",disabled:!r||C,className:"bg-[#D97706] hover:bg-[#B45309]",children:"Join"})]})]})]}),e.jsxs(N,{"data-testid":"button-new-group",onClick:()=>M(),className:"h-9 md:h-11 px-4 md:px-6 text-xs md:text-sm bg-[#1A4D58] hover:bg-[#11353E] text-white rounded-full transition-all flex items-center gap-2",children:[e.jsx(de,{className:"w-4 h-4"}),e.jsx("span",{className:"hidden sm:inline",children:"New Group"})]})]})]}),e.jsxs("div",{className:"flex flex-col sm:flex-row items-stretch sm:items-center gap-3",children:[e.jsxs("div",{className:"relative flex-1",children:[e.jsx(I,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-slate-400"}),e.jsx(q,{"data-testid":"input-search-groups",placeholder:"Search groups...",className:"pl-9 bg-white border-slate-200 h-10",value:i,onChange:t=>g(t.target.value)})]}),e.jsx("div",{className:"flex items-center gap-2",children:["all","host","member"].map(t=>e.jsx("button",{"data-testid":`filter-role-${t}`,onClick:()=>u(t),className:W("px-4 py-2 rounded-full text-sm font-medium transition-all border",n===t?"bg-[#06262D] text-white border-[#06262D]":"bg-white text-slate-500 border-slate-200 hover:border-slate-300"),children:t==="all"?"All":t==="host"?"Host":"Member"},t))})]})]}),k?e.jsx("div",{className:"flex justify-center py-20",children:e.jsx(ce,{className:"w-10 h-10 animate-spin text-[#1A4D58]/20"})}):e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[U.map(t=>{const s=t.role,l=t.memberStatus==="invited_only"||t.memberStatus==="invited"||t.memberStatus==="inactive",T=t.memberStatus==="pending_approval",E=t.memberStatus==="pending_payment",Q=T||E;let x="Member",h=me;l?(x="You're Invited",h=ue):E?(x="Payment due",h=H):T?(x="Pending",h=H):s==="HOST"&&(x="Host",h=xe);const c=(t.settings||{}).accentColor||"#D97706",R=t.brandColor||"#06262D",b=new Date,B=`${b.getFullYear()}-${String(b.getMonth()+1).padStart(2,"0")}-${String(b.getDate()).padStart(2,"0")}`,j=G?.[t.id]||null,v=j&&j.date>=B?j:null,O=s==="HOST"&&!Q;return e.jsxs(V,{href:l?`/join/${t.inviteCode}`:`/dashboard/community/${t.id}`,"data-testid":`card-group-${t.id}`,className:"group relative flex flex-col h-[480px] rounded-[2rem] overflow-hidden transition-all duration-300 hover:-translate-y-1 hover:shadow-xl focus:outline-none focus:ring-4 focus:ring-offset-2 focus:ring-[#1A4D58]/20",style:{backgroundColor:R},children:[e.jsx("div",{className:"absolute inset-0 opacity-[0.04] mix-blend-overlay pointer-events-none",style:{backgroundImage:"url('https://www.transparenttextures.com/patterns/stardust.png')"}}),e.jsx("div",{className:"absolute bottom-0 left-0 right-0 h-[5px]",style:{backgroundColor:c}}),e.jsxs("div",{className:"p-6 md:p-8 flex flex-col flex-1 relative z-10 text-white h-full",children:[e.jsxs("div",{className:"flex justify-between items-start mb-6",children:[e.jsx("div",{className:"w-28 h-28 rounded-xl bg-white/15 backdrop-blur-md border-[3px] border-white flex items-center justify-center overflow-hidden shadow-lg rotate-0 hover:rotate-[-3deg] transition-transform duration-300",children:t.logoUrl?e.jsx("img",{src:t.logoUrl,alt:t.displayName,className:"w-full h-full object-cover"}):e.jsx("span",{className:"text-4xl font-serif font-bold text-white",children:t.displayName.charAt(0)})}),e.jsxs("div",{className:"flex items-center gap-1.5 px-3 py-1.5 rounded-full text-xs font-bold uppercase tracking-wider shadow-sm border",style:{backgroundColor:O||l?c:"rgba(255,255,255,0.12)",color:"#fff",borderColor:O||l?c:"rgba(255,255,255,0.2)"},children:[e.jsx(h,{className:"w-3.5 h-3.5"}),e.jsx("span",{children:x})]})]}),e.jsxs("div",{className:"mt-auto",children:[e.jsx("h3",{className:"font-sans font-bold text-base md:text-lg leading-tight mb-3 text-white drop-shadow-sm uppercase tracking-wider",children:t.displayName}),e.jsxs("div",{className:"flex items-center gap-1.5 text-sm text-white/80 font-medium mb-3",children:[e.jsx(pe,{className:"w-4 h-4 opacity-70"}),t.memberCount," ",t.memberCount===1?"person":"people"]}),t.description&&e.jsx("p",{className:"text-sm text-white/60 leading-relaxed line-clamp-3 mb-4",children:t.description})]}),l&&e.jsxs("div",{className:"flex items-center gap-1.5 mb-3",children:[e.jsx("span",{className:"text-sm font-semibold text-white",children:"Join the group"}),e.jsx(A,{className:"w-4 h-4 text-white"})]}),v?e.jsxs("div",{className:"rounded-2xl p-4 flex items-center justify-between border border-white/10 bg-black/15 backdrop-blur-sm group-hover:bg-black/20 transition-colors mt-auto",children:[e.jsxs("div",{className:"flex items-center gap-3 min-w-0 flex-1 overflow-hidden",children:[e.jsx("div",{className:"w-10 h-10 rounded-xl flex items-center justify-center shadow-sm shrink-0",style:{backgroundColor:c},children:e.jsx(P,{className:"w-4 h-4 text-white"})}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"text-[11px] uppercase tracking-wider font-bold text-white/60 mb-0.5",children:"Next Up"}),e.jsxs("p",{className:"text-sm font-medium text-white truncate",children:[v.title," · ",ne(v.date)]})]})]}),e.jsx("div",{className:"w-8 h-8 rounded-full flex items-center justify-center opacity-0 -translate-x-2 group-hover:opacity-100 group-hover:translate-x-0 transition-all duration-300 shrink-0 bg-white/20",children:e.jsx(A,{className:"w-4 h-4 text-white"})})]}):e.jsx("div",{className:"rounded-2xl p-4 flex items-center border border-white/10 bg-black/10 backdrop-blur-sm mt-auto",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-10 h-10 rounded-xl flex items-center justify-center bg-white/10 shrink-0",children:e.jsx(P,{className:"w-4 h-4 text-white/50"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-[11px] uppercase tracking-wider font-bold text-white/40 mb-0.5",children:"Next Up"}),e.jsx("p",{className:"text-sm text-white/50",children:"No upcoming events"})]})]})})]})]},t.id)}),U.length===0&&!k&&f.length>0&&e.jsxs("div",{className:"col-span-full text-center py-12",children:[e.jsx("p",{className:"text-slate-400 text-lg",children:"No groups match your filters."}),e.jsx("button",{"data-testid":"button-clear-filters",onClick:()=>{g(""),u("all")},className:"text-sm text-[#1A4D58] hover:underline mt-2",children:"Clear filters"})]})]}),e.jsx(oe,{open:F,onOpenChange:D})]})}),e.jsx(le,{open:!!d,onClose:()=>L(null),limitType:d?.limitType||"group_limit",tier:d?.tier||"tier1",limit:d?.limit||0,currentCount:d?.currentCount||0,canUpgrade:d?.canUpgrade??!0})]})}export{at as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.