import{r as e}from"./rolldown-runtime-CpWojdLp.js";import{n as t,t as n}from"./jsx-runtime-B6e-FjZo.js";import{t as r}from"./copy-9HXxktsI.js";import{Ar as i,Ht as a,Sr as o,Tr as s,Xn as c,a as l,ct as u,hr as d,on as f}from"./app-figJB8d1.js";import{t as p}from"./card-GiWUhIM5.js";import{t as m}from"./input-error-DWmiXKn_.js";var h=i(),g=e(t(),1),_=n();function v(e){let t=(0,h.c)(21),{label:n,value:i}=e,{t:o}=a(),[s,l]=(0,g.useState)(!1),p;t[0]===i?p=t[1]:(p=async()=>{try{await navigator.clipboard.writeText(i),l(!0),window.setTimeout(()=>l(!1),1500)}catch{}},t[0]=i,t[1]=p);let m=p,v;t[2]===n?v=t[3]:(v=(0,_.jsx)(u,{children:n}),t[2]=n,t[3]=v);let y;t[4]===i?y=t[5]:(y=(0,_.jsx)(f,{value:i,readOnly:!0,className:`font-mono text-xs`}),t[4]=i,t[5]=y);let b;t[6]===o?b=t[7]:(b=o(`Copy`),t[6]=o,t[7]=b);let x;t[8]!==s||t[9]!==o?(x=s?(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(c,{className:`size-4`}),(0,_.jsx)(`span`,{className:`ms-1.5`,children:o(`Copied`)})]}):(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(r,{className:`size-4`}),(0,_.jsx)(`span`,{className:`ms-1.5`,children:o(`Copy`)})]}),t[8]=s,t[9]=o,t[10]=x):x=t[10];let S;t[11]!==m||t[12]!==b||t[13]!==x?(S=(0,_.jsx)(d,{type:`button`,variant:`outline`,onClick:m,"aria-label":b,className:`shrink-0`,children:x}),t[11]=m,t[12]=b,t[13]=x,t[14]=S):S=t[14];let C;t[15]!==y||t[16]!==S?(C=(0,_.jsxs)(`div`,{className:`flex items-stretch gap-2`,children:[y,S]}),t[15]=y,t[16]=S,t[17]=C):C=t[17];let w;return t[18]!==v||t[19]!==C?(w=(0,_.jsxs)(`div`,{className:`grid gap-1.5`,children:[v,C]}),t[18]=v,t[19]=C,t[20]=w):w=t[20],w}function y(e){let t=(0,h.c)(58),{workspace:n}=e,{t:r}=a(),i;t[0]===n.name?i=t[1]:(i={name:n.name},t[0]=n.name,t[1]=i);let c=s(i),g;t[2]===c?g=t[3]:(g=e=>{e.preventDefault(),c.patch(`/settings/workspace`,{preserveScroll:!0})},t[2]=c,t[3]=g);let y=g,b;t[4]===r?b=t[5]:(b=r(`Workspace settings`),t[4]=r,t[5]=b);let x;t[6]===b?x=t[7]:(x=(0,_.jsx)(o,{title:b}),t[6]=b,t[7]=x);let S;t[8]===r?S=t[9]:(S=r(`Workspace settings`),t[8]=r,t[9]=S);let C;t[10]===S?C=t[11]:(C=(0,_.jsx)(`h1`,{className:`sr-only`,children:S}),t[10]=S,t[11]=C);let w;t[12]===r?w=t[13]:(w=r(`Workspace`),t[12]=r,t[13]=w);let T;t[14]===r?T=t[15]:(T=r(`Rename the workspace your team sees in the sidebar and on outgoing emails.`),t[14]=r,t[15]=T);let E;t[16]!==w||t[17]!==T?(E=(0,_.jsx)(l,{variant:`small`,title:w,description:T}),t[16]=w,t[17]=T,t[18]=E):E=t[18];let D;t[19]===r?D=t[20]:(D=r(`Workspace name`),t[19]=r,t[20]=D);let O;t[21]===D?O=t[22]:(O=(0,_.jsx)(u,{htmlFor:`name`,children:D}),t[21]=D,t[22]=O);let k=c.data.name,A;t[23]===c?A=t[24]:(A=e=>c.setData(`name`,e.target.value),t[23]=c,t[24]=A);let j;t[25]===r?j=t[26]:(j=r(`Acme, Inc.`),t[25]=r,t[26]=j);let M;t[27]!==c.data.name||t[28]!==A||t[29]!==j?(M=(0,_.jsx)(f,{id:`name`,value:k,onChange:A,required:!0,placeholder:j,autoComplete:`organization`,"data-test":`workspace-name`}),t[27]=c.data.name,t[28]=A,t[29]=j,t[30]=M):M=t[30];let N;t[31]===c.errors.name?N=t[32]:(N=(0,_.jsx)(m,{message:c.errors.name}),t[31]=c.errors.name,t[32]=N);let P;t[33]!==O||t[34]!==M||t[35]!==N?(P=(0,_.jsxs)(`div`,{className:`grid gap-1.5`,children:[O,M,N]}),t[33]=O,t[34]=M,t[35]=N,t[36]=P):P=t[36];let F=c.processing,I;t[37]===r?I=t[38]:(I=r(`Save`),t[37]=r,t[38]=I);let L;t[39]!==c.processing||t[40]!==I?(L=(0,_.jsx)(`div`,{className:`flex items-center justify-end gap-4 border-t pt-4`,children:(0,_.jsx)(d,{type:`submit`,disabled:F,"data-test":`update-workspace-button`,children:I})}),t[39]=c.processing,t[40]=I,t[41]=L):L=t[41];let R;t[42]!==y||t[43]!==P||t[44]!==L?(R=(0,_.jsx)(p,{className:`border-border/80 p-5`,children:(0,_.jsxs)(`form`,{onSubmit:y,className:`grid gap-4`,children:[P,L]})}),t[42]=y,t[43]=P,t[44]=L,t[45]=R):R=t[45];let z;t[46]!==r||t[47]!==n.public_kb_url||t[48]!==n.slug?(z=(n.slug||n.public_kb_url)&&(0,_.jsx)(p,{className:`border-border/80 p-5`,children:(0,_.jsxs)(`div`,{className:`grid gap-4`,children:[(0,_.jsxs)(`div`,{children:[(0,_.jsx)(`h2`,{className:`text-base font-semibold`,children:r(`Workspace identity`)}),(0,_.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:r(`These identifiers belong to your workspace. The slug is used in public URLs (knowledge base, share links). The URL below is your public knowledge-base page — share it with customers who want to read your published answers.`)})]}),n.slug&&(0,_.jsx)(v,{label:r(`Workspace slug`),value:n.slug}),n.public_kb_url&&(0,_.jsx)(v,{label:r(`Public knowledge-base URL`),value:n.public_kb_url})]})}),t[46]=r,t[47]=n.public_kb_url,t[48]=n.slug,t[49]=z):z=t[49];let B;t[50]!==R||t[51]!==z||t[52]!==E?(B=(0,_.jsxs)(`div`,{className:`space-y-6`,children:[E,R,z]}),t[50]=R,t[51]=z,t[52]=E,t[53]=B):B=t[53];let V;return t[54]!==B||t[55]!==x||t[56]!==C?(V=(0,_.jsxs)(_.Fragment,{children:[x,C,B]}),t[54]=B,t[55]=x,t[56]=C,t[57]=V):V=t[57],V}y.layout={breadcrumbs:[{title:`Workspace settings`,href:`/settings/workspace`}]};export{y as default};