import d from "./index-responsivePropType.js";
import { handleBreakpoints as f } from "./index-breakpoints2.js";
import { getPath as l } from "./index-style.js";
import y from "./index-merge.js";
import h from "./index-memoize.js";
const v = {
  m: "margin",
  p: "padding"
}, E = {
  t: "Top",
  r: "Right",
  b: "Bottom",
  l: "Left",
  x: ["Left", "Right"],
  y: ["Top", "Bottom"]
}, p = {
  marginX: "mx",
  marginY: "my",
  paddingX: "px",
  paddingY: "py"
}, N = h((e) => {
  if (e.length > 2)
    if (p[e])
      e = p[e];
    else
      return [e];
  const [n, t] = e.split(""), r = v[n], a = E[t] || "";
  return Array.isArray(a) ? a.map((o) => r + o) : [r + a];
}), s = ["m", "mt", "mr", "mb", "ml", "mx", "my", "margin", "marginTop", "marginRight", "marginBottom", "marginLeft", "marginX", "marginY", "marginInline", "marginInlineStart", "marginInlineEnd", "marginBlock", "marginBlockStart", "marginBlockEnd"], m = ["p", "pt", "pr", "pb", "pl", "px", "py", "padding", "paddingTop", "paddingRight", "paddingBottom", "paddingLeft", "paddingX", "paddingY", "paddingInline", "paddingInlineStart", "paddingInlineEnd", "paddingBlock", "paddingBlockStart", "paddingBlockEnd"], b = [...s, ...m];
function I(e, n, t, r) {
  var a;
  const o = (a = l(e, n, !1)) != null ? a : t;
  return typeof o == "number" ? (i) => typeof i == "string" ? i : (process.env.NODE_ENV, o * i) : Array.isArray(o) ? (i) => typeof i == "string" ? i : (process.env.NODE_ENV !== "production" && Number.isInteger(i) && i > o.length - 1, o[i]) : typeof o == "function" ? o : (process.env.NODE_ENV, () => {
  });
}
function B(e) {
  return I(e, "spacing", 8, "spacing");
}
function S(e, n) {
  if (typeof n == "string" || n == null)
    return n;
  const t = Math.abs(n), r = e(t);
  return n >= 0 ? r : typeof r == "number" ? -r : `-${r}`;
}
function T(e, n) {
  return (t) => e.reduce((r, a) => (r[a] = S(n, t), r), {});
}
function $(e, n, t, r) {
  if (n.indexOf(t) === -1)
    return null;
  const a = N(t), o = T(a, r), i = e[t];
  return f(e, i, o);
}
function u(e, n) {
  const t = B(e.theme);
  return Object.keys(e).map((r) => $(e, n, r, t)).reduce(y, {});
}
function c(e) {
  return u(e, s);
}
c.propTypes = process.env.NODE_ENV !== "production" ? s.reduce((e, n) => (e[n] = d, e), {}) : {};
c.filterProps = s;
function g(e) {
  return u(e, m);
}
g.propTypes = process.env.NODE_ENV !== "production" ? m.reduce((e, n) => (e[n] = d, e), {}) : {};
g.filterProps = m;
process.env.NODE_ENV !== "production" && b.reduce((e, n) => (e[n] = d, e), {});
export {
  B as createUnarySpacing,
  I as createUnaryUnit,
  T as getStyleFromPropValue,
  S as getValue,
  c as margin,
  s as marginKeys,
  g as padding,
  m as paddingKeys
};
