import{r as G,j as V}from"./BL9F-HQ1.js";import{p as F,q as H,u as I,G as J,f as Q,c as X,v as Y,w as Z,s as v,e as ee}from"./C-wObYiq.js";function ne(e,n){var t,o,r;return G.isValidElement(e)&&n.indexOf(e.type.muiName??((r=(o=(t=e.type)==null?void 0:t._payload)==null?void 0:o.value)==null?void 0:r.muiName))!==-1}const te=(e,n)=>e.filter(t=>n.includes(t)),S=(e,n,t)=>{const o=e.keys[0];Array.isArray(n)?n.forEach((r,s)=>{t((i,p)=>{s<=e.keys.length-1&&(s===0?Object.assign(i,p):i[e.up(e.keys[s])]=p)},r)}):n&&typeof n=="object"?(Object.keys(n).length>e.keys.length?e.keys:te(e.keys,Object.keys(n))).forEach(s=>{if(e.keys.includes(s)){const i=n[s];i!==void 0&&t((p,c)=>{o===s?Object.assign(p,c):p[e.up(s)]=c},i)}}):(typeof n=="number"||typeof n=="string")&&t((r,s)=>{Object.assign(r,s)},n)};function $(e){return`--Grid-${e}Spacing`}function b(e){return`--Grid-parent-${e}Spacing`}const E="--Grid-columns",y="--Grid-parent-columns",re=({theme:e,ownerState:n})=>{const t={};return S(e.breakpoints,n.size,(o,r)=>{let s={};r==="grow"&&(s={flexBasis:0,flexGrow:1,maxWidth:"100%"}),r==="auto"&&(s={flexBasis:"auto",flexGrow:0,flexShrink:0,maxWidth:"none",width:"auto"}),typeof r=="number"&&(s={flexGrow:0,flexBasis:"auto",width:`calc(100% * ${r} / var(${y}) - (var(${y}) - ${r}) * (var(${b("column")}) / var(${y})))`}),o(t,s)}),t},se=({theme:e,ownerState:n})=>{const t={};return S(e.breakpoints,n.offset,(o,r)=>{let s={};r==="auto"&&(s={marginLeft:"auto"}),typeof r=="number"&&(s={marginLeft:r===0?"0px":`calc(100% * ${r} / var(${y}) + var(${b("column")}) * ${r} / var(${y}))`}),o(t,s)}),t},oe=({theme:e,ownerState:n})=>{if(!n.container)return{};const t={[E]:12};return S(e.breakpoints,n.columns,(o,r)=>{const s=r??12;o(t,{[E]:s,"> *":{[y]:s}})}),t},ie=({theme:e,ownerState:n})=>{if(!n.container)return{};const t={};return S(e.breakpoints,n.rowSpacing,(o,r)=>{var i;const s=typeof r=="string"?r:(i=e.spacing)==null?void 0:i.call(e,r);o(t,{[$("row")]:s,"> *":{[b("row")]:s}})}),t},ce=({theme:e,ownerState:n})=>{if(!n.container)return{};const t={};return S(e.breakpoints,n.columnSpacing,(o,r)=>{var i;const s=typeof r=="string"?r:(i=e.spacing)==null?void 0:i.call(e,r);o(t,{[$("column")]:s,"> *":{[b("column")]:s}})}),t},ae=({theme:e,ownerState:n})=>{if(!n.container)return{};const t={};return S(e.breakpoints,n.direction,(o,r)=>{o(t,{flexDirection:r})}),t},fe=({ownerState:e})=>({minWidth:0,boxSizing:"border-box",...e.container&&{display:"flex",flexWrap:"wrap",...e.wrap&&e.wrap!=="wrap"&&{flexWrap:e.wrap},gap:`var(${$("row")}) var(${$("column")})`}}),le=e=>{const n=[];return Object.entries(e).forEach(([t,o])=>{o!==!1&&o!==void 0&&n.push(`grid-${t}-${String(o)}`)}),n},ue=(e,n="xs")=>{function t(o){return o===void 0?!1:typeof o=="string"&&!Number.isNaN(Number(o))||typeof o=="number"&&o>0}if(t(e))return[`spacing-${n}-${String(e)}`];if(typeof e=="object"&&!Array.isArray(e)){const o=[];return Object.entries(e).forEach(([r,s])=>{t(s)&&o.push(`spacing-${r}-${String(s)}`)}),o}return[]},pe=e=>e===void 0?[]:typeof e=="object"?Object.entries(e).map(([n,t])=>`direction-${n}-${t}`):[`direction-xs-${String(e)}`],me=F(),de=H("div",{name:"MuiGrid",slot:"Root",overridesResolver:(e,n)=>n.root});function ge(e){return X({props:e,name:"MuiGrid",defaultTheme:me})}function ye(e={}){const{createStyledComponent:n=de,useThemeProps:t=ge,componentName:o="MuiGrid"}=e,r=(c,a)=>{const{container:d,direction:l,spacing:u,wrap:f,size:x}=c,w={root:["root",d&&"container",f!=="wrap"&&`wrap-xs-${String(f)}`,...pe(l),...le(x),...d?ue(u,a.breakpoints.keys[0]):[]]};return Y(w,j=>Z(o,j),{})};function s(c,a,d=()=>!0){const l={};return c===null||(Array.isArray(c)?c.forEach((u,f)=>{u!==null&&d(u)&&a.keys[f]&&(l[a.keys[f]]=u)}):typeof c=="object"?Object.keys(c).forEach(u=>{const f=c[u];f!=null&&d(f)&&(l[u]=f)}):l[a.keys[0]]=c),l}const i=n(oe,ce,ie,re,ae,fe,se),p=G.forwardRef(function(a,d){const l=I(),u=t(a),f=J(u),{className:x,children:w,columns:j=12,container:C=!1,component:O="div",direction:P="row",wrap:R="wrap",size:z={},offset:M={},spacing:k=0,rowSpacing:T=k,columnSpacing:A=k,unstable_level:g=0,...B}=f,D=s(z,l.breakpoints,m=>m!==!1),W=s(M,l.breakpoints),_=a.columns??(g?void 0:j),L=a.spacing??(g?void 0:k),q=a.rowSpacing??a.spacing??(g?void 0:T),K=a.columnSpacing??a.spacing??(g?void 0:A),N={...f,level:g,columns:_,container:C,direction:P,wrap:R,spacing:L,rowSpacing:q,columnSpacing:K,size:D,offset:W},U=r(N,l);return V.jsx(i,{ref:d,as:O,ownerState:N,className:Q(U.root,x),...B,children:G.Children.map(w,m=>{var h;return G.isValidElement(m)&&ne(m,["Grid"])&&C&&m.props.container?G.cloneElement(m,{unstable_level:((h=m.props)==null?void 0:h.unstable_level)??g+1}):m})})});return p.muiName="Grid",p}const $e=ye({createStyledComponent:v("div",{name:"MuiGrid2",slot:"Root",overridesResolver:(e,n)=>n.root}),componentName:"MuiGrid2",useThemeProps:e=>ee({props:e,name:"MuiGrid2"})});export{$e as G};