import{r as e}from"./rolldown-runtime-DIIn1E2Q.js";import{ft as t}from"./vendor-primevue-DOcVZxnt.js";import"./vendor-firebase-yTFzdAQf.js";import{D as n,Dt as r,F as i,I as a,O as o,R as s,Vt as c,_ as l,_t as u,et as d,gt as f,j as p,y as m}from"./vendor-vue-core-CvBSzfTV.js";import"./vendor-other-ZVm7XS8K.js";import"./useFeatureFlags-CMK9o9Rw.js";import"./api-OgmjiUkn.js";import"./colorUtil-C9tyO6rZ.js";import{n as h}from"./vendor-i18n-B2MApQxA.js";import"./i18n-S80A-Sy1.js";import"./vendor-reka-ui-EFkcZtPy.js";import{t as g}from"./Button-C-kbn1lh.js";import{Xn as _}from"./dialogService-Dp405gae.js";import"./systemStatsStore-BAnEcJS2.js";import"./useErrorHandling-DfKSzlg9.js";import{t as v}from"./dialogStore-BDXSs8Ic.js";import"./userStore-C5cqCkur.js";import"./useCopyToClipboard-_eFTtqIy.js";import"./vendor-tiptap-BZCaYoPl.js";import"./vendor-markdown-Gcn_JH9N.js";import"./markdownRendererUtil-BD0lrBqH.js";import"./useExternalLink-CZSEXO8Q.js";var y={class:`flex w-full max-w-[400px] flex-col rounded-2xl border border-border-default bg-base-background`},b={class:`flex h-12 items-center justify-between border-b border-border-default px-4`},x={class:`m-0 text-sm font-normal text-base-foreground`},S=[`aria-label`],C={class:`flex flex-col gap-4 px-4 py-4`},w={class:`flex flex-col gap-2`},T={class:`text-sm text-base-foreground`},E={class:`flex items-center justify-end gap-4 px-4 py-4`},D=s({__name:`EditWorkspaceDialogContent`,setup(e){let{t:s}=h(),D=t(),O=v(),k=_(),A=r(!1),j=r(k.workspaceName),M=n(()=>{let e=j.value.trim();return e.length>=1&&e.length<=50&&/^[a-zA-Z0-9][a-zA-Z0-9\s\-_'.,()&+]*$/.test(e)});function onCancel(){O.closeDialog({key:`edit-workspace`})}async function onSave(){if(M.value){A.value=!0;try{await k.updateWorkspaceName(j.value.trim()),O.closeDialog({key:`edit-workspace`}),D.add({severity:`success`,summary:s(`workspacePanel.toast.workspaceUpdated.title`),detail:s(`workspacePanel.toast.workspaceUpdated.message`),life:5e3})}catch(e){console.error(`[EditWorkspaceDialog] Failed to update workspace:`,e),D.add({severity:`error`,summary:s(`workspacePanel.toast.failedToUpdateWorkspace`),detail:e instanceof Error?e.message:s(`g.unknownError`),life:5e3})}finally{A.value=!1}}}return(e,t)=>(d(),p(`div`,y,[o(`div`,b,[o(`h2`,x,c(e.$t(`workspacePanel.editWorkspaceDialog.title`)),1),o(`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[2]||=[o(`i`,{class:`pi pi-times size-4`},null,-1)],8,S)]),o(`div`,C,[o(`div`,w,[o(`label`,T,c(e.$t(`workspacePanel.editWorkspaceDialog.nameLabel`)),1),u(o(`input`,{"onUpdate:modelValue":t[0]||=e=>j.value=e,type:`text`,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`,onKeydown:t[1]||=m(e=>M.value&&onSave(),[`enter`])},null,544),[[l,j.value]])])]),o(`div`,E,[a(g,{variant:`muted-textonly`,onClick:onCancel},{default:f(()=>[i(c(e.$t(`g.cancel`)),1)]),_:1}),a(g,{variant:`primary`,size:`lg`,loading:A.value,disabled:!M.value,onClick:onSave},{default:f(()=>[i(c(e.$t(`workspacePanel.editWorkspaceDialog.save`)),1)]),_:1},8,[`loading`,`disabled`])])]))}});export{D as default};
//# sourceMappingURL=EditWorkspaceDialogContent-BgJdEW_R.js.map