import { j as i } from "./jsx-runtime-B6kdoens.js";
import { forwardRef as p, createElement as h } from "react";
import { g as k, C as t } from "./css-CiSR0WsA.js";
const M = ({ el: e, children: a, ...r }, s) => h(e, { ...r, ref: s }, a), C = p(M), R = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  __proto__: null,
  Element: C
}, Symbol.toStringTag, { value: "Module" })), _ = ["start", "center", "end", "stretch"], D = [
  "start",
  "center",
  "end",
  "spaceBetween",
  "spaceAround",
  "spaceEvenly"
], g = (e, a) => a ?? (e === "right" || e === "bottom"), S = ({
  style: e,
  align: a,
  className: r,
  grow: s,
  shrink: c,
  empty: f = !1,
  size: n = "medium",
  justify: m = "start",
  reverse: o,
  direction: l = "y",
  wrap: u = !1,
  bordered: B = !1,
  rounded: N = !1,
  el: w = "div",
  background: x,
  ...y
}, E) => {
  const b = k.construct(l);
  o = g(l, o);
  let d;
  return f ? [n, d] = [0, 0] : typeof n == "number" && (d = `${n}rem`), e = {
    gap: d,
    flexDirection: v(b, o),
    justifyContent: A[m],
    alignItems: a,
    flexWrap: u ? "wrap" : "nowrap",
    ...e
  }, s != null && (e.flexGrow = Number(s)), c != null && (e.flexShrink = Number(c)), x != null && (e.backgroundColor = t.shadeVar(x)), // @ts-expect-error - TODO: fix generic element props
  /* @__PURE__ */ i.jsx(
    C,
    {
      el: w,
      ref: E,
      className: t(
        t.B("space"),
        t.dir(b),
        t.bordered(B),
        t.rounded(N),
        typeof n == "string" && t.BM("space", n),
        r
      ),
      style: e,
      ...y
    }
  );
};
S.displayName = "Space";
const j = p(S), v = (e, a) => {
  const r = e === "x" ? "row" : "column";
  return a ? r + "-reverse" : r;
}, A = {
  start: "flex-start",
  center: "center",
  end: "flex-end",
  spaceBetween: "space-between",
  spaceAround: "space-around",
  spaceEvenly: "space-evenly"
}, I = ({ className: e, justify: a = "center", align: r = "center", ...s }, c) => (
  // @ts-expect-error - generic element issues
  /* @__PURE__ */ i.jsx(
    j,
    {
      ref: c,
      justify: a,
      align: r,
      className: t(t.BM("space", "centered"), e),
      ...s
    }
  )
), J = p(I), G = ({
  className: e,
  size: a = "medium",
  reverse: r = !1,
  direction: s = "x",
  bordered: c = !0,
  borderShade: f = 3,
  rounded: n = !0,
  shadow: m = !1,
  style: o,
  ...l
}, u) => (
  // @ts-expect-error - generic element issues
  /* @__PURE__ */ i.jsx(
    j,
    {
      ref: u,
      direction: s,
      reverse: r,
      className: t(
        t.B("pack"),
        m && t.BM("pack", "shadow"),
        t.dir(s),
        typeof a != "number" && t.BM("pack", a),
        r && t.BM("pack", "reverse"),
        e
      ),
      style: {
        ...o,
        [t.var("pack-border-shade")]: t.shadeVar(f)
      },
      bordered: c,
      rounded: n,
      ...l,
      empty: !0
    }
  )
), V = p(
  G
);
export {
  _ as A,
  J as C,
  C as E,
  R as G,
  D as J,
  V as P,
  j as S,
  I as a,
  g as s
};
