import r from"../../../@babel/runtime/helpers/esm/slicedToArray.js";import n from"./responsivePropType.js";import{handleBreakpoints as e}from"./breakpoints.js";import t from"./merge.js";import o from"./memoize.js";var i={m:"margin",p:"padding"},a={t:"Top",r:"Right",b:"Bottom",l:"Left",x:["Left","Right"],y:["Top","Bottom"]},p={marginX:"mx",marginY:"my",paddingX:"px",paddingY:"py"},u=o((function(n){if(n.length>2){if(!p[n])return[n];n=p[n]}var e=n.split(""),t=r(e,2),o=t[0],u=t[1],m=i[o],c=a[u]||"";return Array.isArray(c)?c.map((function(r){return m+r})):[m+c]})),m=["m","mt","mr","mb","ml","mx","my","p","pt","pr","pb","pl","px","py","margin","marginTop","marginRight","marginBottom","marginLeft","marginX","marginY","padding","paddingTop","paddingRight","paddingBottom","paddingLeft","paddingX","paddingY"];function c(r){var n=r.spacing||8;return"number"==typeof n?function(r){return"production"!==process.env.NODE_ENV&&"number"!=typeof r&&console.error("Material-UI: Expected spacing argument to be a number, got ".concat(r,".")),n*r}:Array.isArray(n)?function(r){return"production"!==process.env.NODE_ENV&&r>n.length-1&&console.error(["Material-UI: The value provided (".concat(r,") overflows."),"The supported values are: ".concat(JSON.stringify(n),"."),"".concat(r," > ").concat(n.length-1,", you need to add the missing values.")].join("\n")),n[r]}:"function"==typeof n?n:("production"!==process.env.NODE_ENV&&console.error(["Material-UI: The `theme.spacing` value (".concat(n,") is invalid."),"It should be a number, an array or a function."].join("\n")),function(){})}function s(r,n){return function(e){return r.reduce((function(r,t){return r[t]=function(r,n){if("string"==typeof n||null==n)return n;var e=r(Math.abs(n));return n>=0?e:"number"==typeof e?-e:"-".concat(e)}(n,e),r}),{})}}function d(r){var n=c(r.theme);return Object.keys(r).map((function(t){if(-1===m.indexOf(t))return null;var o=s(u(t),n),i=r[t];return e(r,i,o)})).reduce(t,{})}d.propTypes="production"!==process.env.NODE_ENV?m.reduce((function(r,e){return r[e]=n,r}),{}):{},d.filterProps=m;export default d;export{c as createUnarySpacing};
//# sourceMappingURL=spacing.js.map
