import{i as R,_ as k}from"./emotion-use-insertion-effect-with-fallbacks.browser.esm-6809063d.js";import{c as S,b as T,d as B,h,r as p,e as D,f as _,m as G,g as N,_ as M,a as O,i as U,k as A,l as E,n as v}from"./Tooltip-ae8d7992.js";const L=["component","direction","spacing","divider","children","className","useFlexGap"],d=await R("react"),$=S(),I=T("div",{name:"MuiStack",slot:"Root",overridesResolver:(e,s)=>s.root});function W(e){return B({props:e,name:"MuiStack",defaultTheme:$})}function q(e,s){const n=d.Children.toArray(e).filter(Boolean);return n.reduce((c,a,t)=>(c.push(a),t<n.length-1&&c.push(d.cloneElement(s,{key:`separator-${t}`})),c),[])}const z=e=>({row:"Left","row-reverse":"Right",column:"Top","column-reverse":"Bottom"})[e],H=({ownerState:e,theme:s})=>{let n=k({display:"flex",flexDirection:"column"},h({theme:s},p({values:e.direction,breakpoints:s.breakpoints.values}),c=>({flexDirection:c})));if(e.spacing){const c=D(s),a=Object.keys(s.breakpoints.values).reduce((o,r)=>((typeof e.spacing=="object"&&e.spacing[r]!=null||typeof e.direction=="object"&&e.direction[r]!=null)&&(o[r]=!0),o),{}),t=p({values:e.direction,base:a}),m=p({values:e.spacing,base:a});typeof t=="object"&&Object.keys(t).forEach((o,r,i)=>{if(!t[o]){const u=r>0?t[i[r-1]]:"column";t[o]=u}}),n=_(n,h({theme:s},m,(o,r)=>e.useFlexGap?{gap:v(c,o)}:{"& > :not(style):not(style)":{margin:0},"& > :not(style) ~ :not(style)":{[`margin${z(r?t[r]:e.direction)}`]:v(c,o)}}))}return n=G(s.breakpoints,n),n};function Q(e={}){const{createStyledComponent:s=I,useThemeProps:n=W,componentName:c="MuiStack"}=e,a=()=>A({root:["root"]},o=>E(c,o),{}),t=s(H);return d.forwardRef(function(o,r){const i=n(o),l=N(i),{component:u="div",direction:x="column",spacing:b=0,divider:y,children:g,className:j,useFlexGap:C=!1}=l,P=M(l,L),V={direction:x,spacing:b,useFlexGap:C},F=a();return O(t,k({as:u,ownerState:V,ref:r,className:U(F.root,j)},P,{children:y?q(g,y):g}))})}export{Q as c};
