"use strict";const r=require("react/jsx-runtime"),f=require("react"),S=require("./Dialog-CSr6lHSd.cjs.js"),D=require("@chakra-ui/react/styled-system"),R=require("./index-CVXB9mwf.cjs.js"),q=require("./Button-DLCecw8f.cjs.js"),P=require("./extract-style-props-B4hqila-.cjs.js"),j=require("./Modal-u97jKK9t.cjs.js"),N=require("./heading-DWweWKGQ.cjs.js"),O=require("@commercetools/nimbus-icons"),c=require("./normalize-messages-CaDzkuUm.cjs.js"),B=require("./icon-button-CeB8_Yyr.cjs.js"),{withProvider:F,withContext:n}=D.createSlotRecipeContext({recipe:R.drawerSlotRecipe}),z=F("div","root"),H=n("button","trigger"),_=n("div","modalOverlay"),I=n("div","modal"),E=n("div","content"),L=n("header","header"),V=n("div","body"),k=n("footer","footer"),A=n("h2","title"),K=n("div","closeTrigger"),$=f.createContext(void 0),G=()=>{const e=f.useContext($);if(!e)throw new Error("useDrawerContext must be used within Drawer.Root");return e},J=({children:e,value:t})=>r.jsx($,{value:t,children:e}),p=e=>{const t=D.useSlotRecipe({recipe:R.drawerSlotRecipe}),[o]=t.splitVariantProps(e),{children:s,isOpen:a,onOpenChange:i,defaultOpen:g=!1}=e,l=r.jsx(z,{...o,children:s}),w=f.Children.toArray(s).some(d=>{if(f.isValidElement(d)&&typeof d.type=="function"){const u=d.type?.displayName;return u==="DrawerTrigger"||u==="Drawer.Trigger"}return!1});return r.jsx(J,{value:{...e,hasDrawerTrigger:w},children:w?r.jsx(S.$de32f1b87079253c$export$2e1e1122cf0cba88,{isOpen:a,onOpenChange:i,defaultOpen:g,children:l}):l})};p.displayName="Drawer.Root";const x=({ref:e,children:t,asChild:o,...s})=>{if(o)return r.jsx(D.chakra.button,{ref:e,asChild:!0,...s,children:t});const[a,i]=P.extractStyleProps(s);return r.jsx(H,{...a,asChild:!0,children:r.jsx(q.$d2b4bc8c273e7be6$export$353f5b6fc5456de1,{ref:e,...i,children:t})})};x.displayName="Drawer.Trigger";const h=e=>{const{ref:t,children:o,...s}=e,{hasDrawerTrigger:a,isDismissable:i=!0,isKeyboardDismissDisabled:g,shouldCloseOnInteractOutside:l,isOpen:w,onOpenChange:d,defaultOpen:u}=G(),v=a?{isDismissable:i,isKeyboardDismissDisabled:g,shouldCloseOnInteractOutside:l}:{isDismissable:i,isKeyboardDismissDisabled:g,shouldCloseOnInteractOutside:l,isOpen:w,onOpenChange:d,defaultOpen:u},[M]=P.extractStyleProps(s);return r.jsx(_,{asChild:!0,children:r.jsx(j.$f3f84453ead64de5$export$8948f78d83984c69,{...v,children:r.jsx(I,{asChild:!0,children:r.jsx(j.$f3f84453ead64de5$export$2b77a92f1a5ad772,{children:r.jsx(E,{asChild:!0,...M,children:r.jsx(S.$de32f1b87079253c$export$3ddf2d174ce01153,{ref:t,children:o})})})})})})};h.displayName="Drawer.Content";const m=e=>{const{ref:t,children:o,...s}=e;return r.jsx(L,{ref:t,...s,children:o})};m.displayName="Drawer.Header";const y=e=>{const{ref:t,children:o,...s}=e,a={tabIndex:0};return r.jsx(V,{ref:t,...a,...s,children:o})};y.displayName="Drawer.Body";const C=e=>{const{ref:t,children:o,...s}=e;return r.jsx(k,{ref:t,...s,children:o})};C.displayName="Drawer.Footer";const T=e=>{const{ref:t,children:o,...s}=e;return r.jsx(A,{asChild:!0,...s,children:r.jsx(N.Heading,{ref:t,slot:"title",as:"h2",textStyle:"lg",children:o})})};T.displayName="Drawer.Title";const Q={closeTrigger:"Close drawer"},U={closeTrigger:"Schublade schließen"},W={closeTrigger:"Cerrar bandeja"},X={closeTrigger:"Fermer le volet"},Y={closeTrigger:"Fechar gaveta"},Z={en:c.normalizeMessages(Q),de:c.normalizeMessages(U),es:c.normalizeMessages(W),"fr-FR":c.normalizeMessages(X),"pt-BR":c.normalizeMessages(Y)},b=e=>{const t=c.useLocalizedStringFormatter(Z),{ref:o,"aria-label":s,...a}=e;return r.jsx(K,{children:r.jsx(B.IconButton,{ref:o,slot:"close",size:"xs",variant:"ghost","aria-label":s||t.format("closeTrigger"),...a,children:r.jsx(O.Close,{})})})};b.displayName="Drawer.CloseTrigger";const ee={Root:p,Trigger:x,Content:h,Header:m,Body:y,Footer:C,Title:T,CloseTrigger:b};exports.Drawer=ee;exports.DrawerBody=y;exports.DrawerCloseTrigger=b;exports.DrawerContent=h;exports.DrawerFooter=C;exports.DrawerHeader=m;exports.DrawerRoot=p;exports.DrawerTitle=T;exports.DrawerTrigger=x;
//# sourceMappingURL=drawer-DbSJSCl_.cjs.js.map
