import{Bt as e,Ct as t,D as n,H as r,L as i,Nt as a,Pt as o,R as s,X as c,bt as l,mt as u,pt as d,st as f,vt as p,z as m}from"./xY0c-UfG.js";import"./xihTtKlq.js";import{t as h}from"./Dl-kU-nL.js";import{E as g,M as _,N as v,O as y,P as b,j as x,k as S}from"./CcwhSY5o.js";import{t as C}from"./Cvnwo5OO2.js";import{t as w}from"./DU2630_A.js";import{t as T}from"./C4XhH1zO.js";var E=m(`<!> <!>`,1),D=m(`<!> <!>`,1),O=m(`<!> <!> <!>`,1);function k(m,k){o(k,!0);let A=t(()=>T.id!==null),j=l(``),M=l(null);f(()=>{T.id!==null&&p(j,T.title,!0)}),f(()=>{T.id!==null&&c(M)&&requestAnimationFrame(()=>{c(M)?.focus(),c(M)?.select()})});function N(){T.close()}function P(){let e=T.id;!e||!c(j).trim()||(h.renameSession(e,c(j)),N())}var F=s();n(d(F),()=>b,(a,o)=>{o(a,{get open(){return c(A)},onOpenChange:e=>{e||N()},children:(a,o)=>{var l=s();n(d(l),()=>v,(a,o)=>{o(a,{size:`sm`,children:(a,o)=>{var l=O(),f=d(l);n(f,()=>_,(e,t)=>{t(e,{class:`close-only-header`,children:(e,t)=>{var r=s();n(d(r),()=>g,(e,t)=>{t(e,{})}),i(e,r)},$$slots:{default:!0}})});var m=u(f,2);n(m,()=>S,(t,a)=>{a(t,{class:`dialog-body-lg`,children:(t,a)=>{var o=E(),s=d(o);n(s,()=>x,(t,n)=>{n(t,{children:(t,n)=>{e(),i(t,r(`Rename Chat`))},$$slots:{default:!0}})}),w(u(s,2),{type:`text`,placeholder:`Chat name`,onkeydown:e=>{e.key===`Enter`&&(e.preventDefault(),P())},get ref(){return c(M)},set ref(e){p(M,e,!0)},get value(){return c(j)},set value(e){p(j,e,!0)}}),i(t,o)},$$slots:{default:!0}})}),n(u(m,2),()=>y,(n,a)=>{a(n,{children:(n,a)=>{var o=D(),s=d(o);C(s,{variant:`ghost`,onclick:N,children:(t,n)=>{e(),i(t,r(`Cancel`))},$$slots:{default:!0}});var l=u(s,2);{let n=t(()=>!c(j).trim());C(l,{variant:`accent`,get disabled(){return c(n)},onclick:P,children:(t,n)=>{e(),i(t,r(`Rename`))},$$slots:{default:!0}})}i(n,o)},$$slots:{default:!0}})}),i(a,l)},$$slots:{default:!0}})}),i(a,l)},$$slots:{default:!0}})}),i(m,F),a()}export{k as default};