import{a as e,n as t}from"./preload-helper-DxX6f4wy.js";import{$ as n,E as r,F as i,G as a,H as o,I as s,J as c,R as l,W as u,X as d,Y as f,d as p,g as m,q as h}from"./Fade-Bj1YUcWe.js";import{n as g,t as _}from"./useThemeProps-Cb3a7a2t.js";var v=e(t()),y=n(),b=o(),x=g(`div`,{name:`MuiStack`,slot:`Root`,overridesResolver:(e,t)=>t.root});function S(e){return _({props:e,name:`MuiStack`,defaultTheme:b})}function C(e,t){let n=v.Children.toArray(e).filter(Boolean);return n.reduce((e,r,i)=>(e.push(r),i<n.length-1&&e.push(v.cloneElement(t,{key:`separator-${i}`})),e),[])}var w=e=>({row:`Left`,"row-reverse":`Right`,column:`Top`,"column-reverse":`Bottom`})[e],T=({ownerState:e,theme:t})=>{let n={display:`flex`,flexDirection:`column`,...h({theme:t},f({values:e.direction,breakpoints:t.breakpoints.values}),e=>({flexDirection:e}))};if(e.spacing){let r=u(t),i=Object.keys(t.breakpoints.values).reduce((t,n)=>((typeof e.spacing==`object`&&e.spacing[n]!=null||typeof e.direction==`object`&&e.direction[n]!=null)&&(t[n]=!0),t),{}),o=f({values:e.direction,base:i}),s=f({values:e.spacing,base:i});typeof o==`object`&&Object.keys(o).forEach((e,t,n)=>{if(!o[e]){let r=t>0?o[n[t-1]]:`column`;o[e]=r}}),n=d(n,h({theme:t},s,(t,n)=>e.useFlexGap?{gap:a(r,t)}:{"& > :not(style):not(style)":{margin:0},"& > :not(style) ~ :not(style)":{[`margin${w(n?o[n]:e.direction)}`]:a(r,t)}}))}return n=c(t.breakpoints,n),n};function E(e={}){let{createStyledComponent:t=x,useThemeProps:n=S,componentName:a=`MuiStack`}=e,o=()=>r({root:[`root`]},e=>i(a,e),{}),c=t(T);return v.forwardRef(function(e,t){let{component:r=`div`,direction:i=`column`,spacing:a=0,divider:u,children:d,className:f,useFlexGap:p=!1,...m}=l(n(e)),h={direction:i,spacing:a,useFlexGap:p},g=o();return(0,y.jsx)(c,{as:r,ownerState:h,ref:t,className:s(g.root,f),...m,children:u?C(d,u):d})})}var D=E({createStyledComponent:m(`div`,{name:`MuiStack`,slot:`Root`,overridesResolver:(e,t)=>t.root}),useThemeProps:e=>p({props:e,name:`MuiStack`})});export{D as t};