import"./rolldown-runtime-DIIn1E2Q.js";import{dt as e}from"./vendor-primevue-BDZ_jj__.js";import"./vendor-firebase-D7u00oy9.js";import{D as t,F as n,I as r,O as i,R as a,Ut as o,_ as s,_t as c,et as l,j as u,kt as d,vt as f,y as p}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 m}from"./vendor-i18n-JbyM4Qz7.js";import"./i18n-CF_88JEG.js";import"./vendor-reka-ui-B53kLmAc.js";import{t as h}from"./Button-Ca3rDegY.js";import{Ri as g}from"./dialogService-CfgsFapJ.js";import"./formatUtil-CeKPWstn.js";import{t as _}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 v={class:`flex w-full min-w-[400px] flex-col rounded-2xl border border-border-default bg-base-background`},y={class:`flex h-12 items-center justify-between border-b border-border-default px-4`},b={class:`m-0 text-sm font-normal text-base-foreground`},x=[`aria-label`],S={class:`flex flex-col gap-4 p-4`},C={class:`flex flex-col gap-2`},w={class:`text-sm text-base-foreground`},T={class:`flex items-center justify-end gap-4 p-4`},E=a({__name:`EditWorkspaceDialogContent`,setup(a){let{t:E}=m(),D=e(),O=_(),k=g(),A=d(!1),j=d(k.workspaceName),M=t(()=>{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:E(`workspacePanel.toast.workspaceUpdated.title`),detail:E(`workspacePanel.toast.workspaceUpdated.message`),life:5e3})}catch(e){console.error(`[EditWorkspaceDialog] Failed to update workspace:`,e),D.add({severity:`error`,summary:E(`workspacePanel.toast.failedToUpdateWorkspace`),detail:e instanceof Error?e.message:E(`g.unknownError`)})}finally{A.value=!1}}}return(e,t)=>(l(),u(`div`,v,[i(`div`,y,[i(`h2`,b,o(e.$t(`workspacePanel.editWorkspaceDialog.title`)),1),i(`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]||=[i(`i`,{class:`pi pi-times size-4`},null,-1)],8,x)]),i(`div`,S,[i(`div`,C,[i(`label`,w,o(e.$t(`workspacePanel.editWorkspaceDialog.nameLabel`)),1),f(i(`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]||=p(e=>M.value&&onSave(),[`enter`])},null,544),[[s,j.value]])])]),i(`div`,T,[r(h,{variant:`muted-textonly`,onClick:onCancel},{default:c(()=>[n(o(e.$t(`g.cancel`)),1)]),_:1}),r(h,{variant:`primary`,size:`lg`,loading:A.value,disabled:!M.value,onClick:onSave},{default:c(()=>[n(o(e.$t(`workspacePanel.editWorkspaceDialog.save`)),1)]),_:1},8,[`loading`,`disabled`])])]))}});export{E as default};
//# sourceMappingURL=EditWorkspaceDialogContent-D0Qg9PyP.js.map