import{A as e,G as r,N as t,O as n,X as o,Z as i,_t as a,gt as s,lt as c,mt as p,pt as u,yt as l}from"./render-cqdoDfd9.js";import{t as m}from"./isMuiElement-DqyCXM2X.js";import{r as f,t as d}from"./useThemeProps-DLDn3aDr.js";var g=(e,r,t)=>{const n=e.keys[0];var o,i;Array.isArray(r)?r.forEach((r,n)=>{t((r,t)=>{n<=e.keys.length-1&&(0===n?Object.assign(r,t):r[e.up(e.keys[n])]=t)},r)}):r&&"object"==typeof r?(Object.keys(r).length>e.keys.length?e.keys:(o=e.keys,i=Object.keys(r),o.filter(e=>i.includes(e)))).forEach(o=>{if(e.keys.includes(o)){const i=r[o];void 0!==i&&t((r,t)=>{n===o?Object.assign(r,t):r[e.up(o)]=t},i)}}):"number"!=typeof r&&"string"!=typeof r||t((e,r)=>{Object.assign(e,r)},r)};function h(e){return`--Grid-${e}Spacing`}function y(e){return`--Grid-parent-${e}Spacing`}var b="--Grid-columns",w="--Grid-parent-columns",v=({theme:e,ownerState:r})=>{const t={};return g(e.breakpoints,r.size,(e,r)=>{let n={};"grow"===r&&(n={flexBasis:0,flexGrow:1,maxWidth:"100%"}),"auto"===r&&(n={flexBasis:"auto",flexGrow:0,flexShrink:0,maxWidth:"none",width:"auto"}),"number"==typeof r&&(n={flexGrow:0,flexBasis:"auto",width:`calc(100% * ${r} / var(${w}) - (var(${w}) - ${r}) * (var(${y("column")}) / var(${w})))`}),e(t,n)}),t},S=({theme:e,ownerState:r})=>{const t={};return g(e.breakpoints,r.offset,(e,r)=>{let n={};"auto"===r&&(n={marginLeft:"auto"}),"number"==typeof r&&(n={marginLeft:0===r?"0px":`calc(100% * ${r} / var(${w}) + var(${y("column")}) * ${r} / var(${w}))`}),e(t,n)}),t},k=({theme:e,ownerState:r})=>{if(!r.container)return{};const t={[b]:12};return g(e.breakpoints,r.columns,(e,r)=>{const n=r??12;e(t,{[b]:n,"> *":{[w]:n}})}),t},$=({theme:e,ownerState:r})=>{if(!r.container)return{};const t={};return g(e.breakpoints,r.rowSpacing,(r,n)=>{const o="string"==typeof n?n:e.spacing?.(n);r(t,{[h("row")]:o,"> *":{[y("row")]:o}})}),t},x=({theme:e,ownerState:r})=>{if(!r.container)return{};const t={};return g(e.breakpoints,r.columnSpacing,(r,n)=>{const o="string"==typeof n?n:e.spacing?.(n);r(t,{[h("column")]:o,"> *":{[y("column")]:o}})}),t},j=({theme:e,ownerState:r})=>{if(!r.container)return{};const t={};return g(e.breakpoints,r.direction,(e,r)=>{e(t,{flexDirection:r})}),t},G=({ownerState:e})=>({minWidth:0,boxSizing:"border-box",...e.container&&{display:"flex",flexWrap:"wrap",...e.wrap&&"wrap"!==e.wrap&&{flexWrap:e.wrap},gap:`var(${h("row")}) var(${h("column")})`}}),E=e=>{const r=[];return Object.entries(e).forEach(([e,t])=>{!1!==t&&void 0!==t&&r.push(`grid-${e}-${String(t)}`)}),r},M=(e,r="xs")=>{function t(e){return void 0!==e&&("string"==typeof e&&!Number.isNaN(Number(e))||"number"==typeof e&&e>0)}if(t(e))return[`spacing-${r}-${String(e)}`];if("object"==typeof e&&!Array.isArray(e)){const r=[];return Object.entries(e).forEach(([e,n])=>{t(n)&&r.push(`spacing-${e}-${String(n)}`)}),r}return[]},N=e=>void 0===e?[]:"object"==typeof e?Object.entries(e).map(([e,r])=>`direction-${e}-${r}`):[`direction-xs-${String(e)}`];var O=l(a()),z=c(),W=i(),A=f("div",{name:"MuiGrid",slot:"Root"});function T(e){return d({props:e,name:"MuiGrid",defaultTheme:W})}var R=function(e={}){const{createStyledComponent:t=A,useThemeProps:n=T,useTheme:i=r,componentName:a="MuiGrid"}=e,c=(e,r)=>{const{container:t,direction:n,spacing:o,wrap:i,size:s}=e;return u({root:["root",t&&"container","wrap"!==i&&`wrap-xs-${String(i)}`,...N(n),...E(s),...t?M(o,r.breakpoints.keys[0]):[]]},e=>p(a,e),{})};function l(e,r,t=()=>!0){const n={};return null===e||(Array.isArray(e)?e.forEach((e,o)=>{null!==e&&t(e)&&r.keys[o]&&(n[r.keys[o]]=e)}):"object"==typeof e?Object.keys(e).forEach(r=>{const o=e[r];null!=o&&t(o)&&(n[r]=o)}):n[r.keys[0]]=e),n}const f=t(k,x,$,v,j,G,S),d=O.forwardRef(function(e,r){const t=i(),a=o(n(e));!function(e,r){const t=[];void 0!==e.item&&(delete e.item,t.push("item")),void 0!==e.zeroMinWidth&&(delete e.zeroMinWidth,t.push("zeroMinWidth")),r.keys.forEach(r=>{void 0!==e[r]&&(t.push(r),delete e[r])})}(a,t.breakpoints);const{className:p,children:u,columns:d=12,container:g=!1,component:h="div",direction:y="row",wrap:b="wrap",size:w={},offset:v={},spacing:S=0,rowSpacing:k=S,columnSpacing:$=S,unstable_level:x=0,...j}=a,G=l(w,t.breakpoints,e=>!1!==e),E=l(v,t.breakpoints),M=e.columns??(x?void 0:d),N=e.spacing??(x?void 0:S),W=e.rowSpacing??e.spacing??(x?void 0:k),A=e.columnSpacing??e.spacing??(x?void 0:$),T={...a,level:x,columns:M,container:g,direction:y,wrap:b,spacing:N,rowSpacing:W,columnSpacing:A,size:G,offset:E};return(0,z.jsx)(f,{ref:r,as:h,ownerState:T,className:s(c(T,t).root,p),...j,children:O.Children.map(u,e=>O.isValidElement(e)&&m(e,["Grid"])&&g&&e.props.container?O.cloneElement(e,{unstable_level:e.props?.unstable_level??x+1}):e)})});return d.muiName="Grid",d}({createStyledComponent:e("div",{name:"MuiGrid",slot:"Root",overridesResolver:(e,r)=>{const{ownerState:t}=e;return[r.root,t.container&&r.container]}}),componentName:"MuiGrid",useThemeProps:e=>n({props:e,name:"MuiGrid"}),useTheme:t});export{R as t};