import{r as e}from"./rolldown-runtime-DIIn1E2Q.js";import{dt as t}from"./vendor-primevue-CIZeDNer.js";import"./vendor-firebase-yTFzdAQf.js";import{D as n,F as r,Ht as i,I as a,O as o,Ot as s,R as c,_ as l,_t as u,et as d,j as f,vt as p,y as m}from"./vendor-vue-core-IZuWV8u3.js";import"./vendor-other-DOjudfJ1.js";import"./useFeatureFlags-CwpAZwBL.js";import"./api-pyyMp5An.js";import"./vendor-markdown-th9BvURy.js";import"./colorUtil-CaOYwqZT.js";import{n as h}from"./vendor-i18n-CpHGo1Sd.js";import"./i18n-qK6isbxx.js";import"./vendor-reka-ui-NsM8zEZd.js";import{t as g}from"./Button-BonqIZfE.js";import{Ji as _,Ti as v}from"./dialogService-Dz-57Tpg.js";import"./extensionStore-CGI8V8NM.js";import"./userStore-Db3V002h.js";import"./useErrorHandling-w2dl_Z1z.js";import"./useCopyToClipboard-DeXt33ef.js";import"./useExternalLink-C7QBjeHM.js";import"./vendor-tiptap-nOCIQysJ.js";import"./markdownRendererUtil-DO0bU-vH.js";import"./Popover-CTWL6O4Q.js";var y={class:`flex w-full min-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 p-4`},w={class:`flex flex-col gap-2`},T={class:`text-sm text-base-foreground`},E={class:`flex items-center justify-end gap-4 p-4`},D=c({__name:`EditWorkspaceDialogContent`,setup(e){let{t:c}=h(),D=t(),O=_(),k=v(),A=s(!1),j=s(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:c(`workspacePanel.toast.workspaceUpdated.title`),detail:c(`workspacePanel.toast.workspaceUpdated.message`),life:5e3})}catch(e){console.error(`[EditWorkspaceDialog] Failed to update workspace:`,e),D.add({severity:`error`,summary:c(`workspacePanel.toast.failedToUpdateWorkspace`),detail:e instanceof Error?e.message:c(`g.unknownError`)})}finally{A.value=!1}}}return(e,t)=>(d(),f(`div`,y,[o(`div`,b,[o(`h2`,x,i(e.$t(`workspacePanel.editWorkspaceDialog.title`)),1),o(`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},t[2]||=[o(`i`,{class:`pi pi-times size-4`},null,-1)],8,S)]),o(`div`,C,[o(`div`,w,[o(`label`,T,i(e.$t(`workspacePanel.editWorkspaceDialog.nameLabel`)),1),p(o(`input`,{"onUpdate:modelValue":t[0]||=e=>j.value=e,type:`text`,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`,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:u(()=>[r(i(e.$t(`g.cancel`)),1)]),_:1}),a(g,{variant:`primary`,size:`lg`,loading:A.value,disabled:!M.value,onClick:onSave},{default:u(()=>[r(i(e.$t(`workspacePanel.editWorkspaceDialog.save`)),1)]),_:1},8,[`loading`,`disabled`])])]))}});export{D as default};
//# sourceMappingURL=EditWorkspaceDialogContent-uBfOs52U.js.map