import{r as e}from"./rolldown-runtime-DCMCV6zW.js";import{pt as t}from"./vendor-primevue-DsBxnwSO.js";import"./vendor-firebase-CdLSXhbt.js";import{$ as n,A as r,Bt as i,D as a,E as o,Et as s,F as c,L as l,P as u,g as d,gt as f,ht as p,v as m}from"./vendor-vue-core-D3IvUUeM.js";import"./vendor-other-C_YjAAj3.js";import"./useFeatureFlags-Bfb3fghV.js";import"./api-Ckh8-1rW.js";import"./colorUtil-DCPbkdH3.js";import{n as h}from"./vendor-i18n-CHjQVoSH.js";import"./i18n-C2nvaQjh.js";import"./vendor-reka-ui-djAAohzU.js";import{t as g}from"./Button-CJj3KtkO.js";import{_n as _}from"./dialogService-Daa_oID7.js";import"./systemStatsStore-CSnXy46l.js";import"./useErrorHandling-BfFOVBcK.js";import{t as v}from"./dialogStore-CBXn_TDV.js";import"./useCopyToClipboard-DcMopO23.js";import"./vendor-tiptap-CjhX_1DY.js";import"./vendor-markdown-CyF8uRn7.js";import"./markdownRendererUtil-DU6rKHAL.js";import"./useExternalLink-C8tDmXU8.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:`m-0 text-sm text-muted-foreground`},T={class:`flex flex-col gap-2`},E={class:`text-sm text-base-foreground`},D=[`placeholder`],O={class:`flex items-center justify-end gap-4 px-4 py-4`},k=l({__name:`CreateWorkspaceDialogContent`,props:{onConfirm:{type:Function}},setup(e){let{t:l}=h(),k=v(),A=t(),j=_(),M=s(!1),N=s(``),P=o(()=>{let e=N.value.trim();return e.length>=1&&e.length<=50&&/^[a-zA-Z0-9][a-zA-Z0-9\s\-_'.,()&+]*$/.test(e)});function onCancel(){k.closeDialog({key:`create-workspace`})}async function onCreate(){if(P.value){M.value=!0;try{let t=N.value.trim();await e.onConfirm?.(t),k.closeDialog({key:`create-workspace`}),await j.createWorkspace(t)}catch(e){console.error(`[CreateWorkspaceDialog] Failed to create workspace:`,e),A.add({severity:`error`,summary:l(`workspacePanel.toast.failedToCreateWorkspace`),detail:e instanceof Error?e.message:l(`g.unknownError`),life:5e3})}finally{M.value=!1}}}return(e,t)=>(n(),r(`div`,y,[a(`div`,b,[a(`h2`,x,i(e.$t(`workspacePanel.createWorkspaceDialog.title`)),1),a(`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]||=[a(`i`,{class:`pi pi-times size-4`},null,-1)],8,S)]),a(`div`,C,[a(`p`,w,i(e.$t(`workspacePanel.createWorkspaceDialog.message`)),1),a(`div`,T,[a(`label`,E,i(e.$t(`workspacePanel.createWorkspaceDialog.nameLabel`)),1),f(a(`input`,{"onUpdate:modelValue":t[0]||=e=>N.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]||=m(e=>P.value&&onCreate(),[`enter`])},null,40,D),[[d,N.value]])])]),a(`div`,O,[c(g,{variant:`muted-textonly`,onClick:onCancel},{default:p(()=>[u(i(e.$t(`g.cancel`)),1)]),_:1}),c(g,{variant:`primary`,size:`lg`,loading:M.value,disabled:!P.value,onClick:onCreate},{default:p(()=>[u(i(e.$t(`workspacePanel.createWorkspaceDialog.create`)),1)]),_:1},8,[`loading`,`disabled`])])]))}});export{k as default};
//# sourceMappingURL=CreateWorkspaceDialogContent-6WnS95Hk.js.map