import{Ct as e,L as t,N as n,Nt as r,O as i,Pt as a,R as o,V as s,Vt as c,Wt as l,X as u,c as d,ft as f,g as p,mt as m,o as h,pt as g,s as _,z as v}from"./BT3KAag_.js";import"./t62M88qj.js";import{A as y,Ct as b,a as x,i as S,k as C,o as w,r as T,t as E,yt as D}from"./B3wplzwT.js";import{a as O,c as k,o as A}from"./CSvuCeFa.js";function j(e,n){a(n,!0);let s=h(n,`open`,15,!1),c=h(n,`onOpenChange`,3,y),u=h(n,`onOpenChangeComplete`,3,y);k.create({variant:b(()=>`dialog`),open:b(()=>s(),e=>{s(e),c()(e)}),onOpenChangeComplete:b(()=>u())});var d=o();i(g(d),()=>n.children??l),t(e,d),r()}var M=v(`<button><!></button>`);function N(d,m){let v=s();a(m,!0);let y=h(m,`id`,19,()=>C(v)),x=h(m,`ref`,15,null),S=h(m,`disabled`,3,!1),w=_(m,[`$$slots`,`$$events`,`$$legacy`,`children`,`child`,`id`,`ref`,`disabled`]),T=O.create({variant:b(()=>`close`),id:b(()=>y()),ref:b(()=>x(),e=>x(e)),disabled:b(()=>!!S())}),E=e(()=>D(w,T.props));var k=o(),A=g(k),j=e=>{var n=o();i(g(n),()=>m.child,()=>({props:u(E)})),t(e,n)},N=e=>{var n=M();p(n,()=>({...u(E)})),i(f(n),()=>m.children??l),c(n),t(e,n)};n(A,e=>{m.child?e(j):e(N,-1)}),t(d,k),r()}var P=v(`<!> <!>`,1),F=v(`<!> <div><!></div>`,1);function I(v,O){let k=s();a(O,!0);let j=h(O,`id`,19,()=>C(k)),M=h(O,`ref`,15,null),N=h(O,`forceMount`,3,!1),I=h(O,`onCloseAutoFocus`,3,y),L=h(O,`onOpenAutoFocus`,3,y),R=h(O,`onEscapeKeydown`,3,y),z=h(O,`onInteractOutside`,3,y),B=h(O,`trapFocus`,3,!0),V=h(O,`preventScroll`,3,!0),H=h(O,`restoreScrollDelay`,3,null),U=_(O,[`$$slots`,`$$events`,`$$legacy`,`id`,`children`,`child`,`ref`,`forceMount`,`onCloseAutoFocus`,`onOpenAutoFocus`,`onEscapeKeydown`,`onInteractOutside`,`trapFocus`,`preventScroll`,`restoreScrollDelay`]),W=A.create({id:b(()=>j()),ref:b(()=>M(),e=>M(e))}),G=e(()=>D(U,W.props));var K=o(),q=g(K),J=r=>{S(r,{get ref(){return W.opts.ref},loop:!0,get trapFocus(){return B()},get enabled(){return W.root.opts.open.current},get onOpenAutoFocus(){return L()},get onCloseAutoFocus(){return I()},focusScope:(r,a)=>{let s=()=>a?.().props;x(r,d(()=>u(G),{get enabled(){return W.root.opts.open.current},get ref(){return W.opts.ref},onEscapeKeydown:e=>{R()(e),!e.defaultPrevented&&W.root.handleClose()},children:(r,a)=>{w(r,d(()=>u(G),{get ref(){return W.opts.ref},get enabled(){return W.root.opts.open.current},onInteractOutside:e=>{z()(e),!e.defaultPrevented&&W.root.handleClose()},children:(r,a)=>{T(r,d(()=>u(G),{get ref(){return W.opts.ref},get enabled(){return W.root.opts.open.current},children:(r,a)=>{var d=o(),h=g(d),_=r=>{var a=P(),o=g(a),c=e=>{E(e,{get preventScroll(){return V()},get restoreScrollDelay(){return H()}})};n(o,e=>{W.root.opts.open.current&&e(c)});var l=m(o,2);{let t=e(()=>({props:D(u(G),s()),...W.snippetProps}));i(l,()=>O.child,()=>u(t))}t(r,a)},v=e=>{var n=F(),r=g(n);E(r,{get preventScroll(){return V()}});var a=m(r,2);p(a,e=>({...e}),[()=>D(u(G),s())]),i(f(a),()=>O.children??l),c(a),t(e,n)};n(h,e=>{O.child?e(_):e(v,-1)}),t(r,d)},$$slots:{default:!0}}))},$$slots:{default:!0}}))},$$slots:{default:!0}}))},$$slots:{focusScope:!0}})};n(q,e=>{(W.shouldRender||N())&&e(J)}),t(v,K),r()}export{N as n,j as r,I as t};