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"./Bdz75Gen.js";import{A as g,E as _,O as v,T as y,j as b,k as x,w as S}from"./B7ikU8uG.js";import{t as C}from"./Cvnwo5OO.js";import{t as w}from"./DDbpVNi02.js";import{t as T}from"./Biaf5vxK.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),()=>g,(a,o)=>{o(a,{size:`sm`,children:(a,o)=>{var l=O(),f=d(l);n(f,()=>x,(e,t)=>{t(e,{class:`close-only-header`,children:(e,t)=>{var r=s();n(d(r),()=>S,(e,t)=>{t(e,{})}),i(e,r)},$$slots:{default:!0}})});var m=u(f,2);n(m,()=>_,(t,a)=>{a(t,{class:`dialog-body-lg`,children:(t,a)=>{var o=E(),s=d(o);n(s,()=>v,(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};