import{j as n}from"./jsx-runtime-C5WNSv3b.js";import{r as i}from"./index-CqIc3cxq.js";import{u as U,a as Y,b as N,d as C,P as m,e as p,f as h,g as Z,h as J,D as Q,l as X}from"./tooltip-Tlsyx2YO.js";import{h as ee,R as te,u as oe,F as ae}from"./index-ynYvVAOK.js";import{c as f,I as ne}from"./misc-W4055b-0.js";var D="Dialog",[j]=Y(D),[re,d]=j(D),E=e=>{const{__scopeDialog:t,children:o,open:r,defaultOpen:s,onOpenChange:a,modal:c=!0}=e,l=i.useRef(null),g=i.useRef(null),[v,y]=U({prop:r,defaultProp:s??!1,onChange:a,caller:D});return n.jsx(re,{scope:t,triggerRef:l,contentRef:g,contentId:N(),titleId:N(),descriptionId:N(),open:v,onOpenChange:y,onOpenToggle:i.useCallback(()=>y(K=>!K),[y]),modal:c,children:o})};E.displayName=D;var P="DialogTrigger",I=i.forwardRef((e,t)=>{const{__scopeDialog:o,...r}=e,s=d(P,o),a=C(t,s.triggerRef);return n.jsx(m.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.contentId,"data-state":b(s.open),...r,ref:a,onClick:p(e.onClick,s.onOpenToggle)})});I.displayName=P;var R="DialogPortal",[se,O]=j(R,{forceMount:void 0}),T=e=>{const{__scopeDialog:t,forceMount:o,children:r,container:s}=e,a=d(R,t);return n.jsx(se,{scope:t,forceMount:o,children:i.Children.map(r,c=>n.jsx(h,{present:o||a.open,children:n.jsx(Z,{asChild:!0,container:s,children:c})}))})};T.displayName=R;var x="DialogOverlay",A=i.forwardRef((e,t)=>{const o=O(x,e.__scopeDialog),{forceMount:r=o.forceMount,...s}=e,a=d(x,e.__scopeDialog);return a.modal?n.jsx(h,{present:r||a.open,children:n.jsx(le,{...s,ref:t})}):null});A.displayName=x;var ie=J("DialogOverlay.RemoveScroll"),le=i.forwardRef((e,t)=>{const{__scopeDialog:o,...r}=e,s=d(x,o);return n.jsx(te,{as:ie,allowPinchZoom:!0,shards:[s.contentRef],children:n.jsx(m.div,{"data-state":b(s.open),...r,ref:t,style:{pointerEvents:"auto",...r.style}})})}),u="DialogContent",w=i.forwardRef((e,t)=>{const o=O(u,e.__scopeDialog),{forceMount:r=o.forceMount,...s}=e,a=d(u,e.__scopeDialog);return n.jsx(h,{present:r||a.open,children:a.modal?n.jsx(ce,{...s,ref:t}):n.jsx(de,{...s,ref:t})})});w.displayName=u;var ce=i.forwardRef((e,t)=>{const o=d(u,e.__scopeDialog),r=i.useRef(null),s=C(t,o.contentRef,r);return i.useEffect(()=>{const a=r.current;if(a)return ee(a)},[]),n.jsx(M,{...e,ref:s,trapFocus:o.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:p(e.onCloseAutoFocus,a=>{a.preventDefault(),o.triggerRef.current?.focus()}),onPointerDownOutside:p(e.onPointerDownOutside,a=>{const c=a.detail.originalEvent,l=c.button===0&&c.ctrlKey===!0;(c.button===2||l)&&a.preventDefault()}),onFocusOutside:p(e.onFocusOutside,a=>a.preventDefault())})}),de=i.forwardRef((e,t)=>{const o=d(u,e.__scopeDialog),r=i.useRef(!1),s=i.useRef(!1);return n.jsx(M,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:a=>{e.onCloseAutoFocus?.(a),a.defaultPrevented||(r.current||o.triggerRef.current?.focus(),a.preventDefault()),r.current=!1,s.current=!1},onInteractOutside:a=>{e.onInteractOutside?.(a),a.defaultPrevented||(r.current=!0,a.detail.originalEvent.type==="pointerdown"&&(s.current=!0));const c=a.target;o.triggerRef.current?.contains(c)&&a.preventDefault(),a.detail.originalEvent.type==="focusin"&&s.current&&a.preventDefault()}})}),M=i.forwardRef((e,t)=>{const{__scopeDialog:o,trapFocus:r,onOpenAutoFocus:s,onCloseAutoFocus:a,...c}=e,l=d(u,o),g=i.useRef(null),v=C(t,g);return oe(),n.jsxs(n.Fragment,{children:[n.jsx(ae,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:s,onUnmountAutoFocus:a,children:n.jsx(Q,{role:"dialog",id:l.contentId,"aria-describedby":l.descriptionId,"aria-labelledby":l.titleId,"data-state":b(l.open),...c,ref:v,onDismiss:()=>l.onOpenChange(!1)})}),n.jsxs(n.Fragment,{children:[n.jsx(ue,{titleId:l.titleId}),n.jsx(ge,{contentRef:g,descriptionId:l.descriptionId})]})]})}),_="DialogTitle",F=i.forwardRef((e,t)=>{const{__scopeDialog:o,...r}=e,s=d(_,o);return n.jsx(m.h2,{id:s.titleId,...r,ref:t})});F.displayName=_;var S="DialogDescription",k=i.forwardRef((e,t)=>{const{__scopeDialog:o,...r}=e,s=d(S,o);return n.jsx(m.p,{id:s.descriptionId,...r,ref:t})});k.displayName=S;var $="DialogClose",W=i.forwardRef((e,t)=>{const{__scopeDialog:o,...r}=e,s=d($,o);return n.jsx(m.button,{type:"button",...r,ref:t,onClick:p(e.onClick,()=>s.onOpenChange(!1))})});W.displayName=$;function b(e){return e?"open":"closed"}var G="DialogTitleWarning",[Ie,L]=X(G,{contentName:u,titleName:_,docsSlug:"dialog"}),ue=({titleId:e})=>{const t=L(G),o=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.

If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.

For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return i.useEffect(()=>{e&&(document.getElementById(e)||console.error(o))},[o,e]),null},fe="DialogDescriptionWarning",ge=({contentRef:e,descriptionId:t})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${L(fe).contentName}}.`;return i.useEffect(()=>{const s=e.current?.getAttribute("aria-describedby");t&&s&&(document.getElementById(t)||console.warn(r))},[r,e,t]),null},pe=E,me=I,xe=T,z=A,H=w,B=F,V=k,De=W;const Oe=pe,Te=me,ve=xe;function q({className:e,ref:t,...o}){return n.jsx(z,{ref:t,className:f("bg-background/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 backdrop-blur-sm",e),...o})}q.displayName=z.displayName;function ye({className:e,children:t,ref:o,...r}){return n.jsxs(ve,{children:[n.jsx(q,{}),n.jsxs(H,{ref:o,className:f("bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border p-6 shadow-lg duration-200 sm:rounded-lg md:w-full",e),...r,children:[t,n.jsxs(De,{className:"ring-offset-background data-[state=open]:bg-accent data-[state=open]:text-muted-foreground focus:ring-ring absolute top-4 right-4 rounded-sm opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-none disabled:pointer-events-none",children:[n.jsx(ne,{name:"Close"}),n.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}ye.displayName=H.displayName;function Ne({className:e,...t}){return n.jsx("div",{className:f("flex flex-col space-y-1.5 text-center sm:text-left",e),...t})}Ne.displayName="DialogHeader";function Ce({className:e,...t}){return n.jsx("div",{className:f("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t})}Ce.displayName="DialogFooter";function he({className:e,ref:t,...o}){return n.jsx(B,{ref:t,className:f("text-lg leading-none font-semibold tracking-tight",e),...o})}he.displayName=B.displayName;function Re({className:e,ref:t,...o}){return n.jsx(V,{ref:t,className:f("text-muted-foreground text-sm",e),...o})}Re.displayName=V.displayName;export{Oe as D,ye as a,Ne as b,he as c,Re as d,Ce as e,Te as f};
//# sourceMappingURL=dialog-CzO65Z5w.js.map
