import{i as e,n as t}from"./rolldown-runtime-BKYq3fBv.js";import{Bn as n,Cr as r,En as i,Gn as a,Nn as o,Rr as s,Tn as c,Xn as l,Xr as u,Zn as d,ar as f,er as p,ir as m,rr as h,sr as g,ui as _,zr as v}from"./vendor-primevue-D50rA9nL.js";import{ot as y,st as b}from"./vendor-other-BnH5nyVX.js";import{n as x,t as S}from"./Button-DzMg17Os.js";import{c as C,ca as w,s as T,sa as E}from"./dialogService-Cr3DyAja.js";var D,O,k,A,j,M,N,P,F,I,L,R,z,B,V,H=t((()=>{o(),c(),y(),x(),T(),E(),D={class:`flex w-full max-w-[512px] flex-col rounded-2xl border border-border-default bg-base-background`},O={class:`flex h-12 items-center justify-between border-b border-border-default px-4`},k={class:`m-0 text-sm font-normal text-base-foreground`},A=[`aria-label`],j={class:`flex flex-col gap-4 px-4 py-4`},M={class:`m-0 text-sm text-muted-foreground`},N=[`placeholder`],P={class:`flex items-center justify-end gap-4 px-4 py-4`},F={class:`flex flex-col gap-4 px-4 py-4`},I={class:`m-0 text-sm text-muted-foreground`},L={class:`m-0 text-sm font-medium text-base-foreground`},R={class:`relative`},z=[`value`],B={class:`flex items-center justify-end gap-4 px-4 py-4`},V=g({__name:`InviteMemberDialogContent`,setup(e){let t=w(),o=i(),{t:c}=b(),g=C(),y=u(!1),x=u(``),T=u(`email`),E=u(``),V=l(()=>/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(x.value));function onCancel(){t.closeDialog({key:`invite-member`})}async function onCreateLink(){if(V.value){y.value=!0;try{E.value=await g.createInviteLink(x.value),T.value=`link`}catch(e){o.add({severity:`error`,summary:c(`workspacePanel.inviteMemberDialog.linkCopyFailed`),detail:e instanceof Error?e.message:void 0,life:3e3})}finally{y.value=!1}}}async function onCopyLink(){try{await navigator.clipboard.writeText(E.value),o.add({severity:`success`,summary:c(`workspacePanel.inviteMemberDialog.linkCopied`),life:2e3})}catch{o.add({severity:`error`,summary:c(`workspacePanel.inviteMemberDialog.linkCopyFailed`),life:3e3})}}function onSelectLink(e){e.target.select()}return(e,t)=>(r(),p(`div`,D,[d(`div`,O,[d(`h2`,k,_(T.value===`email`?e.$t(`workspacePanel.inviteMemberDialog.title`):e.$t(`workspacePanel.inviteMemberDialog.linkStep.title`)),1),d(`button`,{class:`cursor-pointer rounded border-none bg-transparent p-0 text-muted-foreground transition-colors hover:text-base-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-secondary-foreground`,"aria-label":e.$t(`g.close`),onClick:onCancel},t[1]||=[d(`i`,{class:`pi pi-times size-4`},null,-1)],8,A)]),T.value===`email`?(r(),p(a,{key:0},[d(`div`,j,[d(`p`,M,_(e.$t(`workspacePanel.inviteMemberDialog.message`)),1),v(d(`input`,{"onUpdate:modelValue":t[0]||=e=>x.value=e,type:`email`,class:`w-full rounded-lg border border-border-default bg-transparent px-3 py-2 text-sm text-base-foreground placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-secondary-foreground`,placeholder:e.$t(`workspacePanel.inviteMemberDialog.placeholder`)},null,8,N),[[n,x.value]])]),d(`div`,P,[f(S,{variant:`muted-textonly`,onClick:onCancel},{default:s(()=>[m(_(e.$t(`g.cancel`)),1)]),_:1}),f(S,{variant:`primary`,size:`lg`,loading:y.value,disabled:!V.value,onClick:onCreateLink},{default:s(()=>[m(_(e.$t(`workspacePanel.inviteMemberDialog.createLink`)),1)]),_:1},8,[`loading`,`disabled`])])],64)):(r(),p(a,{key:1},[d(`div`,F,[d(`p`,I,_(e.$t(`workspacePanel.inviteMemberDialog.linkStep.message`)),1),d(`p`,L,_(x.value),1),d(`div`,R,[d(`input`,{value:E.value,readonly:``,class:`w-full cursor-pointer rounded-lg border border-border-default bg-transparent px-3 py-2 pr-10 text-sm text-base-foreground focus:outline-none`,onClick:onSelectLink},null,8,z),d(`div`,{class:`absolute right-4 top-2 cursor-pointer`,onClick:onCopyLink},t[2]||=[h(`<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16" fill="none"><g clip-path="url(#clip0_2127_14348)"><path d="M2.66634 10.6666C1.93301 10.6666 1.33301 10.0666 1.33301 9.33325V2.66659C1.33301 1.93325 1.93301 1.33325 2.66634 1.33325H9.33301C10.0663 1.33325 10.6663 1.93325 10.6663 2.66659M6.66634 5.33325H13.333C14.0694 5.33325 14.6663 5.93021 14.6663 6.66658V13.3333C14.6663 14.0696 14.0694 14.6666 13.333 14.6666H6.66634C5.92996 14.6666 5.33301 14.0696 5.33301 13.3333V6.66658C5.33301 5.93021 5.92996 5.33325 6.66634 5.33325Z" stroke="white" stroke-width="1.3" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_2127_14348"><rect width="16" height="16" fill="white"></rect></clipPath></defs></svg>`,1)])])]),d(`div`,B,[f(S,{variant:`muted-textonly`,onClick:onCancel},{default:s(()=>[m(_(e.$t(`g.cancel`)),1)]),_:1}),f(S,{variant:`primary`,size:`lg`,onClick:onCopyLink},{default:s(()=>[m(_(e.$t(`workspacePanel.inviteMemberDialog.linkStep.copyLink`)),1)]),_:1})])],64))]))}})})),U;t((()=>{H(),H(),U=V}))();export{U as default};
//# sourceMappingURL=InviteMemberDialogContent-DdEKCq5K.js.map