import*as e from"react";import{getStackStyles as r,getDividerStyles as t,selector as i}from"./stack.utils.js";import{forwardRef as s}from"../../../system/dist/esm/forward-ref.js";import{getValidChildren as a}from"../../../react-utils/dist/esm/children.js";import{cx as n}from"../../../utils/dist/esm/dom.js";import{chakra as l}from"../../../system/dist/esm/system.js";import{__DEV__ as c}from"../../../utils/dist/esm/assertion.js";function m(){return(m=Object.assign||function(e){for(var r=1;r<arguments.length;r++){var t=arguments[r];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])}return e}).apply(this,arguments)}var o=r=>e.createElement(l.div,m({className:"chakra-stack__item"},r,{__css:m({display:"inline-block",flex:"0 0 auto",minWidth:0},r.__css)})),d=s(((s,c)=>{var{isInline:d,direction:f,align:p,justify:u,spacing:y="0.5rem",wrap:h,children:g,divider:v,className:j,shouldWrapChildren:k}=s,_=function(e,r){if(null==e)return{};var t,i,s={},a=Object.keys(e);for(i=0;i<a.length;i++)t=a[i],r.indexOf(t)>=0||(s[t]=e[t]);return s}(s,["isInline","direction","align","justify","spacing","wrap","children","divider","className","shouldWrapChildren"]),x=d?"row":null!=f?f:"column",E=e.useMemo((()=>r({direction:x,spacing:y})),[x,y]),N=e.useMemo((()=>t({spacing:y,direction:x})),[y,x]),w=!!v,O=!k&&!w,b=a(g),W=O?b:b.map(((r,t)=>{var i=t+1===b.length,s=k?e.createElement(o,{key:t},r):r;if(!w)return s;var a=i?null:e.cloneElement(v,{__css:N});return e.createElement(e.Fragment,{key:t},s,a)})),C=n("chakra-stack",j);return e.createElement(l.div,m({ref:c,display:"flex",alignItems:p,justifyContent:u,flexDirection:E.flexDirection,flexWrap:h,className:C,__css:w?{}:{[i]:E[i]}},_),W)}));c&&(d.displayName="Stack");var f=s(((r,t)=>e.createElement(d,m({align:"center"},r,{direction:"row",ref:t}))));c&&(f.displayName="HStack");var p=s(((r,t)=>e.createElement(d,m({align:"center"},r,{direction:"column",ref:t}))));c&&(p.displayName="VStack");export{f as HStack,d as Stack,o as StackItem,p as VStack};
//# sourceMappingURL=stack.js.map
