"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2295],{682295:function(e,t,n){n.r(t),n.d(t,{default:function(){return C},getMasonryUtilityClass:function(){return b},masonryClasses:function(){return y}});var r=n(263366),o=n(487462),i=n(794780),a=n(973935),s=n(690948),u=n(471657),l=n(495408),c=n(998700),f=n(259766),d=n(573546),m=n(33703),h=n(490512),p=n(667294),g=n(34867);function b(e){return(0,g.Z)("MuiMasonry",e)}var y=(0,n(1588).Z)("MuiMasonry",["root"]),N=n(785893);const w=["children","className","component","columns","spacing","defaultColumns","defaultHeight","defaultSpacing"],x=e=>Number(e.replace("px","")),Z={flexBasis:"100%",width:0,margin:0,padding:0},v=(0,s.ZP)("div",{name:"MuiMasonry",slot:"Root",overridesResolver:(e,t)=>[t.root]})((({ownerState:e,theme:t})=>{let n={width:"100%",display:"flex",flexFlow:"column wrap",alignContent:"flex-start",boxSizing:"border-box","& > *":{boxSizing:"border-box"}};const r={};if(e.isSSR){const i={},a=x(t.spacing(e.defaultSpacing));for(let t=1;t<=e.defaultColumns;t+=1)i[`&:nth-of-type(${e.defaultColumns}n+${t%e.defaultColumns})`]={order:t};return r.height=e.defaultHeight,r.margin=-a/2,r["& > *"]=(0,o.Z)({},n["& > *"],i,{margin:a/2,width:`calc(${(100/e.defaultColumns).toFixed(2)}% - ${a}px)`}),(0,o.Z)({},n,r)}const i=(0,l.P$)({values:e.spacing,breakpoints:t.breakpoints.values}),a=(0,c.hB)(t);n=(0,f.Z)(n,(0,l.k9)({theme:t},i,(t=>{let n;if("string"===typeof t&&!Number.isNaN(Number(t))||"number"===typeof t){const e=Number(t);n=(0,c.NA)(a,e)}else n=t;return(0,o.Z)({margin:`calc(0px - (${n} / 2))`,"& > *":{margin:`calc(${n} / 2)`}},e.maxColumnHeight&&{height:"number"===typeof n?Math.ceil(e.maxColumnHeight+x(n)):`calc(${e.maxColumnHeight}px + ${n})`})})));const s=(0,l.P$)({values:e.columns,breakpoints:t.breakpoints.values});return n=(0,f.Z)(n,(0,l.k9)({theme:t},s,(e=>({"& > *":{width:`calc(${`${(100/Number(e)).toFixed(2)}%`} - ${"string"===typeof i&&!Number.isNaN(Number(i))||"number"===typeof i?(0,c.NA)(a,Number(i)):"0px"})`}})))),"object"===typeof i&&(n=(0,f.Z)(n,(0,l.k9)({theme:t},i,((e,t)=>{if(t){const n=Number(e),r=Object.keys(s).pop(),o=(0,c.NA)(a,n);return{"& > *":{width:`calc(${`${(100/("object"===typeof s?s[t]||s[r]:s)).toFixed(2)}%`} - ${o})`}}}return null})))),n}));var C=p.forwardRef((function(e,t){const n=(0,u.Z)({props:e,name:"MuiMasonry"}),{children:s,className:l,component:c="div",columns:f=4,spacing:g=1,defaultColumns:y,defaultHeight:C,defaultSpacing:M}=n,S=(0,r.Z)(n,w),$=p.useRef(),[k,E]=p.useState(),H=!k&&C&&void 0!==y&&void 0!==M,[R,A]=p.useState(H?y-1:0),F=(0,o.Z)({},n,{spacing:g,columns:f,maxColumnHeight:k,defaultColumns:y,defaultHeight:C,defaultSpacing:M,isSSR:H}),j=(e=>{const{classes:t}=e;return(0,i.Z)({root:["root"]},b,t)})(F),O=e=>{if(!$.current||!e||0===e.length)return;const t=$.current,n=$.current.firstChild,r=t.clientWidth,o=n.clientWidth;if(0===r||0===o)return;const i=window.getComputedStyle(n),s=x(i.marginLeft),u=x(i.marginRight),l=Math.round(r/(o+s+u)),c=new Array(l).fill(0);let f=!1;t.childNodes.forEach((e=>{if(e.nodeType!==Node.ELEMENT_NODE||"line-break"===e.dataset.class||f)return;const t=window.getComputedStyle(e),n=x(t.marginTop),r=x(t.marginBottom),o=x(t.height)?Math.ceil(x(t.height))+n+r:0;if(0!==o){for(let t=0;t<e.childNodes.length;t+=1){const n=e.childNodes[t];if("IMG"===n.tagName&&0===n.clientHeight){f=!0;break}}if(!f){const t=c.indexOf(Math.min(...c));c[t]+=o;const n=t+1;e.style.order=n}}else f=!0})),f||a.flushSync((()=>{E(Math.max(...c)),A(l>0?l-1:0)}))};(0,d.Z)((()=>{if("undefined"===typeof ResizeObserver)return;let e;const t=new ResizeObserver((()=>{e=window.requestAnimationFrame(O)}));return $.current&&$.current.childNodes.forEach((e=>{t.observe(e)})),()=>{e&&window.cancelAnimationFrame(e),t&&t.disconnect()}}),[f,g,s]);const _=(0,m.Z)(t,$),z=new Array(R).fill("").map(((e,t)=>(0,N.jsx)("span",{"data-class":"line-break",style:(0,o.Z)({},Z,{order:t+1})},t)));return(0,N.jsxs)(v,(0,o.Z)({as:c,className:(0,h.Z)(j.root,l),ref:_,ownerState:F},S,{children:[s,z]}))}))},407960:function(e,t,n){function r(e,t){"function"===typeof e?e(t):e&&(e.current=t)}n.d(t,{Z:function(){return r}})},573546:function(e,t,n){var r=n(667294);const o="undefined"!==typeof window?r.useLayoutEffect:r.useEffect;t.Z=o},33703:function(e,t,n){n.d(t,{Z:function(){return i}});var r=n(667294),o=n(407960);function i(...e){return r.useMemo((()=>e.every((e=>null==e))?null:t=>{e.forEach((e=>{(0,o.Z)(e,t)}))}),e)}}}]);