import{l as A,w as I,x as T,y as u,z as d,r as p,B as m,C as f,E as x,p as b,F as N,j as s,G as v,S as E,H as P,J as S,K as w,M as L,N as z,O as C}from"./index-DTC0Ed21.js";import F from"./index-DqxMsBJA.js";import"./IconChevronLeft-DwnMQlxZ.js";const h=t=>x.dispatch(C.actions.setWithoutSidebar(t)),R=()=>{const{t}=A(),n=I(),[y]=T(),r=y.get("uid")||"",{data:a,isError:g}=u.useLinkInfoQuery({uid:r}),[o]=u.useApplyLinkMutation(),e=a==null?void 0:a.Entity,c=a==null?void 0:a.Link.AccessType,l=e==null?void 0:e.AccessType,i=d(c)&&d(l)&&c<=l,j=p.useCallback(()=>{if(i){n(m(f.folder,{folderId:(e==null?void 0:e.Id)||0}));return}o({uid:r}).unwrap().then(k=>{x.dispatch(b.util.invalidateTags(["Project"])),n(m(f.folder,{folderId:k.Id}))}).catch(()=>N({message:t("members.links.invalid")}))},[i,r,e==null?void 0:e.Id,o,n,t]);return p.useEffect(()=>(h(!0),()=>{h(!1)}),[]),g?s.jsx(F,{}):e?s.jsx(v,{justify:"center",flex:1,children:s.jsxs(E,{gap:40,align:"center",children:[s.jsxs(P,{children:[s.jsx(S,{name:e.Name,color:e.Color,icon:e.IconId,size:48}),s.jsx(w,{fz:32,fw:500,children:e.Name})]}),s.jsx(L,{maw:260,ta:"center",children:t(`members.links.${i?"alreadyInvited":"invite"}`,{project:e.Name})}),s.jsx(z,{size:"lg",radius:8,onClick:j,children:t(i?"members.action.goToProject":"members.action.join")})]})}):null};export{R as default};
