import{i as e,n as t}from"./rolldown-runtime-BKYq3fBv.js";import{Bn as n,Cr as r,En as i,Hn 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,sr as h,ui as g,zr as _}from"./vendor-primevue-D50rA9nL.js";import{ot as v,st as y}from"./vendor-other-BnH5nyVX.js";import{n as b,t as x}from"./Button-DzMg17Os.js";import{c as S,ca as C,s as w,sa as T}from"./dialogService-Cr3DyAja.js";var E,D,O,k,A,j,M,N,P,F,I,L=t((()=>{o(),c(),v(),b(),w(),T(),E={class:`flex w-full max-w-[400px] flex-col rounded-2xl border border-border-default bg-base-background`},D={class:`flex h-12 items-center justify-between border-b border-border-default px-4`},O={class:`m-0 text-sm font-normal text-base-foreground`},k=[`aria-label`],A={class:`flex flex-col gap-4 px-4 py-4`},j={class:`m-0 text-sm text-muted-foreground`},M={class:`flex flex-col gap-2`},N={class:`text-sm text-base-foreground`},P=[`placeholder`],F={class:`flex items-center justify-end gap-4 px-4 py-4`},I=h({__name:`CreateWorkspaceDialogContent`,props:{onConfirm:{type:Function}},setup(e){let{t}=y(),o=C(),c=i(),h=S(),v=u(!1),b=u(``),w=l(()=>{let e=b.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:`create-workspace`})}async function onCreate(){if(w.value){v.value=!0;try{let t=b.value.trim();await e.onConfirm?.(t),o.closeDialog({key:`create-workspace`}),await h.createWorkspace(t)}catch(e){console.error(`[CreateWorkspaceDialog] Failed to create workspace:`,e),c.add({severity:`error`,summary:t(`workspacePanel.toast.failedToCreateWorkspace`),detail:e instanceof Error?e.message:t(`g.unknownError`),life:5e3})}finally{v.value=!1}}}return(e,t)=>(r(),p(`div`,E,[d(`div`,D,[d(`h2`,O,g(e.$t(`workspacePanel.createWorkspaceDialog.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[2]||=[d(`i`,{class:`pi pi-times size-4`},null,-1)],8,k)]),d(`div`,A,[d(`p`,j,g(e.$t(`workspacePanel.createWorkspaceDialog.message`)),1),d(`div`,M,[d(`label`,N,g(e.$t(`workspacePanel.createWorkspaceDialog.nameLabel`)),1),_(d(`input`,{"onUpdate:modelValue":t[0]||=e=>b.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`,placeholder:e.$t(`workspacePanel.createWorkspaceDialog.namePlaceholder`),onKeydown:t[1]||=a(e=>w.value&&onCreate(),[`enter`])},null,40,P),[[n,b.value]])])]),d(`div`,F,[f(x,{variant:`muted-textonly`,onClick:onCancel},{default:s(()=>[m(g(e.$t(`g.cancel`)),1)]),_:1}),f(x,{variant:`primary`,size:`lg`,loading:v.value,disabled:!w.value,onClick:onCreate},{default:s(()=>[m(g(e.$t(`workspacePanel.createWorkspaceDialog.create`)),1)]),_:1},8,[`loading`,`disabled`])])]))}})})),R;t((()=>{L(),L(),R=I}))();export{R as default};
//# sourceMappingURL=CreateWorkspaceDialogContent-Bk76oLXN.js.map