"use strict";const o=require("react/jsx-runtime"),u=require("react"),p=require("./Dialog-B64GoQlm.cjs.js"),h=require("@chakra-ui/react/styled-system"),q=require("@chakra-ui/react"),w=require("./Button-C92vyQPT.cjs.js"),m=require("./extract-style-props-DVhOcGEi.cjs.js"),x=require("./Modal-vGTvonTS.cjs.js"),N=require("./heading-BvgQ2YkR.cjs.js"),O=require("@commercetools/nimbus-icons"),n=require("./normalize-messages-DtVffO09.cjs.js"),B=require("./icon-button-CVdz2C9L.cjs.js"),{withProvider:z,withContext:a}=q.createSlotRecipeContext({key:"nimbusDialog"}),F=z("div","root"),H=a("button","trigger"),_=a("div","modalOverlay"),I=a("div","modal"),k=a("div","content"),E=a("header","header"),L=a("div","body"),V=a("footer","footer"),A=a("h2","title"),K=a("div","closeTrigger"),y=u.createContext(void 0),C=()=>{const e=u.useContext(y);if(!e)throw new Error("useDialogContext must be used within Dialog.Root");return e},G=({children:e,value:r})=>o.jsx(y,{value:r,children:e}),b=e=>{const r=h.useSlotRecipe({key:"nimbusDialog"}),[t]=r.splitVariantProps(e),{children:s,isOpen:i,onOpenChange:l,defaultOpen:f=!1}=e,d=o.jsx(F,{...t,children:s}),D=u.Children.toArray(s).some(c=>{if(u.isValidElement(c)&&typeof c.type=="function"){const g=c.type?.displayName;return g==="DialogTrigger"||g==="Dialog.Trigger"}return!1});return o.jsx(G,{value:e,children:D?o.jsx(p.$de32f1b87079253c$export$2e1e1122cf0cba88,{isOpen:i,onOpenChange:l,defaultOpen:f,children:d}):d})};b.displayName="Dialog.Root";const j=({ref:e,children:r,asChild:t,...s})=>{if(t)return o.jsx(h.chakra.button,{ref:e,asChild:!0,...s,children:r});const[i,l]=m.extractStyleProps(s);return o.jsx(H,{...i,asChild:!0,children:o.jsx(w.$d2b4bc8c273e7be6$export$353f5b6fc5456de1,{ref:e,...l,children:r})})};j.displayName="Dialog.Trigger";const T=e=>{const{ref:r,children:t,...s}=e,{defaultOpen:i,isDismissable:l,isKeyboardDismissDisabled:f,shouldCloseOnInteractOutside:d,isOpen:D,onOpenChange:c}=C(),g={defaultOpen:i,isDismissable:l,isKeyboardDismissDisabled:f,shouldCloseOnInteractOutside:d,isOpen:D,onOpenChange:c},[M]=m.extractStyleProps(s);return o.jsx(_,{asChild:!0,children:o.jsx(x.$f3f84453ead64de5$export$8948f78d83984c69,{...g,children:o.jsx(I,{asChild:!0,children:o.jsx(x.$f3f84453ead64de5$export$2b77a92f1a5ad772,{children:o.jsx(k,{asChild:!0,...M,children:o.jsx(p.$de32f1b87079253c$export$3ddf2d174ce01153,{ref:r,children:t})})})})})})};T.displayName="Dialog.Content";const S=e=>{const{ref:r,children:t,...s}=e;return o.jsx(E,{ref:r,...s,children:t})};S.displayName="Dialog.Header";const P=e=>{const{ref:r,children:t,...s}=e,{scrollBehavior:i}=C(),l={tabIndex:i==="inside"?0:void 0};return o.jsx(L,{ref:r,...l,...s,children:t})};P.displayName="Dialog.Body";const $=e=>{const{ref:r,children:t,...s}=e;return o.jsx(V,{ref:r,...s,children:t})};$.displayName="Dialog.Footer";const R=e=>{const{ref:r,children:t,...s}=e;return o.jsx(A,{asChild:!0,...s,children:o.jsx(N.Heading,{ref:r,slot:"title",as:"h2",textStyle:"lg",children:t})})};R.displayName="Dialog.Title";const J={closeTrigger:"Close dialog"},Q={closeTrigger:"Dialog schließen"},U={closeTrigger:"Cerrar diálogo"},W={closeTrigger:"Fermer la boîte de dialogue"},X={closeTrigger:"Fechar caixa de diálogo"},Y={en:n.normalizeMessages(J),de:n.normalizeMessages(Q),es:n.normalizeMessages(U),"fr-FR":n.normalizeMessages(W),"pt-BR":n.normalizeMessages(X)},v=e=>{const r=n.useLocalizedStringFormatter(Y),{ref:t,"aria-label":s,...i}=e;return o.jsx(K,{children:o.jsx(B.IconButton,{ref:t,slot:"close",size:"xs",variant:"ghost","aria-label":s||r.format("closeTrigger"),...i,children:o.jsx(O.Close,{})})})};v.displayName="Dialog.CloseTrigger";const Z={Root:b,Trigger:j,Content:T,Header:S,Body:P,Footer:$,Title:R,CloseTrigger:v};exports.Dialog=Z;
//# sourceMappingURL=dialog-Czqg8k3n.cjs.js.map
