import"./rolldown-runtime-DIIn1E2Q.js";import{dt as e}from"./vendor-primevue-BDZ_jj__.js";import"./vendor-firebase-D7u00oy9.js";import{Bt as t,D as n,F as r,I as i,O as a,R as o,Rt as s,S as c,Ut as l,_ as u,_t as d,et as f,j as p,kt as m,vt as h}from"./vendor-vue-core-DO0afONr.js";import"./vendor-other-CiPV8GBG.js";import"./useFeatureFlags-CeS8LuDc.js";import"./api-Cw7jP9TY.js";import"./vendor-markdown-Da9QPS2x.js";import"./colorUtil-Bsa2N3Sq.js";import{n as g}from"./vendor-i18n-JbyM4Qz7.js";import"./i18n-CF_88JEG.js";import"./vendor-reka-ui-B53kLmAc.js";import{t as _}from"./src-NuWuoO1R.js";import{t as v}from"./Button-Ca3rDegY.js";import{Ri as y}from"./dialogService-CfgsFapJ.js";import"./formatUtil-CeKPWstn.js";import{t as b}from"./dialogStore-G2juoay4.js";import"./userStore-Czt6jT20.js";import"./useErrorHandling-DXaBpHI1.js";import"./extensionStore-MnMxnUwx.js";import"./useExternalLink-BItqlDxr.js";import"./vendor-tiptap-Bk1lVUYZ.js";import"./markdownRendererUtil-_EbNpPBW.js";import"./Popover-CXKWNrM3.js";import"./electronDownloadStore-DudKQmD7.js";var x={class:`flex w-full max-w-[512px] flex-col rounded-2xl border border-border-default bg-base-background`},S={class:`flex h-12 items-center justify-between border-b border-border-default px-4`},C={class:`m-0 text-sm font-normal text-base-foreground`},w=[`aria-label`],T={class:`flex flex-col gap-4 p-4`},E={class:`m-0 text-sm text-muted-foreground`},D=[`placeholder`],O={class:`flex items-center justify-end gap-4 p-4`},k={class:`flex flex-col gap-4 p-4`},A={class:`m-0 text-sm text-muted-foreground`},j={class:`m-0 text-sm font-medium text-base-foreground`},M={class:`relative`},N=[`value`],P={class:`flex items-center justify-end gap-4 p-4`},F=o({__name:`InviteMemberDialogContent`,setup(o){let F=b(),I=e(),{t:L}=g(),R=y(),z=m(!1),B=m(``),V=m(`email`),H=m(``),U=m(!1),W=n(()=>/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(B.value));function onCancel(){F.closeDialog({key:`invite-member`})}async function onCreateLink(){if(W.value){z.value=!0;try{H.value=await R.createInviteLink(B.value),V.value=`link`}catch(e){I.add({severity:`error`,summary:L(`workspacePanel.inviteMemberDialog.linkCopyFailed`),detail:e instanceof Error?e.message:void 0})}finally{z.value=!1}}}async function onCopyLink(){try{await navigator.clipboard.writeText(H.value),U.value=!0,setTimeout(()=>{U.value=!1},759),I.add({severity:`success`,summary:L(`workspacePanel.inviteMemberDialog.linkCopied`),life:2e3})}catch{I.add({severity:`error`,summary:L(`workspacePanel.inviteMemberDialog.linkCopyFailed`)})}}function onSelectLink(e){e.target.select()}return(e,n)=>(f(),p(`div`,x,[a(`div`,S,[a(`h2`,C,l(V.value===`email`?e.$t(`workspacePanel.inviteMemberDialog.title`):e.$t(`workspacePanel.inviteMemberDialog.linkStep.title`)),1),a(`button`,{class:`focus-visible:ring-secondary-foreground cursor-pointer rounded-sm border-none bg-transparent p-0 text-muted-foreground transition-colors hover:text-base-foreground focus-visible:ring-1 focus-visible:outline-none`,"aria-label":e.$t(`g.close`),onClick:onCancel},n[1]||=[a(`i`,{class:`pi pi-times size-4`},null,-1)],8,w)]),V.value===`email`?(f(),p(c,{key:0},[a(`div`,T,[a(`p`,E,l(e.$t(`workspacePanel.inviteMemberDialog.message`)),1),h(a(`input`,{"onUpdate:modelValue":n[0]||=e=>B.value=e,type:`email`,class:`focus:ring-secondary-foreground w-full rounded-lg border border-border-default bg-transparent px-3 py-2 text-sm text-base-foreground placeholder:text-muted-foreground focus:ring-1 focus:outline-none`,placeholder:e.$t(`workspacePanel.inviteMemberDialog.placeholder`)},null,8,D),[[u,B.value]])]),a(`div`,O,[i(v,{variant:`muted-textonly`,onClick:onCancel},{default:d(()=>[r(l(e.$t(`g.cancel`)),1)]),_:1}),i(v,{variant:`primary`,size:`lg`,loading:z.value,disabled:!W.value,onClick:onCreateLink},{default:d(()=>[r(l(e.$t(`workspacePanel.inviteMemberDialog.createLink`)),1)]),_:1},8,[`loading`,`disabled`])])],64)):(f(),p(c,{key:1},[a(`div`,k,[a(`p`,A,l(e.$t(`workspacePanel.inviteMemberDialog.linkStep.message`)),1),a(`p`,j,l(B.value),1),a(`div`,M,[a(`input`,{value:H.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,N),a(`div`,{class:`absolute top-2.5 right-3 cursor-pointer`,onClick:onCopyLink},[a(`i`,{class:t(s(_)(`pi size-4`,U.value?`pi-check text-green-500`:`pi-copy`))},null,2)])])]),a(`div`,P,[i(v,{variant:`muted-textonly`,onClick:onCancel},{default:d(()=>[r(l(e.$t(`g.cancel`)),1)]),_:1}),i(v,{variant:`primary`,size:`lg`,onClick:onCopyLink},{default:d(()=>[r(l(e.$t(`workspacePanel.inviteMemberDialog.linkStep.copyLink`)),1)]),_:1})])],64))]))}});export{F as default};
//# sourceMappingURL=InviteMemberDialogContent-clIBRhda.js.map