import{B as W,r as e,j as u,c as j}from"./iframe-B8FSoBNY.js";import{c as E}from"./factory-DAJZwK4o.js";function I(n){const{gap:r,direction:o}=n,t={column:{marginY:r,marginX:0,borderInlineStartWidth:0,borderTopWidth:"1px"},"column-reverse":{marginY:r,marginX:0,borderInlineStartWidth:0,borderTopWidth:"1px"},row:{marginX:r,marginY:0,borderInlineStartWidth:"1px",borderTopWidth:0},"row-reverse":{marginX:r,marginY:0,borderInlineStartWidth:"1px",borderTopWidth:0}};return{"&":W(o,i=>t[i])}}function v(n){return e.Children.toArray(n).filter(r=>e.isValidElement(r))}const w=e.forwardRef(function(r,o){const{direction:t="column",align:i,justify:g,gap:s="0.5rem",wrap:f,children:c,separator:a,className:h,...x}=r,d=e.useMemo(()=>I({gap:s,direction:t}),[s,t]),y=e.useMemo(()=>e.isValidElement(a)?v(c).map((l,p,S)=>{const b=typeof l.key<"u"?l.key:p,m=a,k=e.cloneElement(m,{css:[d,m.props.css]});return u.jsxs(e.Fragment,{children:[l,p===S.length-1?null:k]},b)}):c,[c,a,d]);return u.jsx(E.div,{ref:o,display:"flex",alignItems:i,justifyContent:g,flexDirection:t,flexWrap:f,gap:a?void 0:s,className:j("chakra-stack",h),...x,children:y})});w.displayName="Stack";export{w as S};
