import { jsx as l, jsxs as m } from "react/jsx-runtime";
import { useState as I, useMemo as T, useCallback as V } from "react";
import { t as r } from "../global.module.js";
import { c as _, s as q, b as e, a as z } from "../tools/tools.js";
const A = (N = []) => N.map((C, h) => ({
  ...C,
  id: C.id ?? h
})), c = (N, C, h, H, f = "button") => {
  const u = {
    complete: f === "progress" ? "bg-success" : f === "text" ? "text-success" : "btn-success",
    current: f === "progress" ? "bg-primary" : f === "text" ? "text-primary" : "btn-primary",
    error: f === "progress" ? "bg-danger" : f === "text" ? "text-danger" : "btn-danger",
    upcoming: f === "progress" ? "bg-secondary bg-opacity-10" : f === "text" ? "text-secondary" : "btn-secondary"
  };
  return N && u[N] ? e(null, H, u[N]) : e(
    null,
    H,
    C ? u.complete : h ? u.current : u.upcoming
  );
}, E = function(C) {
  const {
    as: h = "div",
    center: H = !1,
    className: f,
    current: u = 0,
    dropOldClass: P,
    onClick: $,
    options: D,
    style: j,
    variables: L,
    vertical: n = !1,
    ...w
  } = C, [g] = I(A(D)), [O, x] = I(0), [k, y] = I(0), M = !H && g.some((s) => s.title || s.description), B = !M && g.every((s) => !s.icon && !s.title && !s.description && !s.status), W = g.length, p = typeof $ == "function", S = T(() => {
    const s = _(!P && "row", n && "flex-column", f), t = q((a, o) => ({ tKey: z(o) }), L, j);
    return {
      className: s,
      style: t
    };
  }, [f, P, j, L, n]), d = V(
    (s) => {
      $ == null || $(s);
    },
    [$]
  );
  return B ? /* @__PURE__ */ l(h, { ...w, ...S, children: g.map((s, t) => {
    const a = t === u, o = t < u, b = t !== W - 1;
    return /* @__PURE__ */ l("div", { className: e(null, "px-0", b ? "col" : "col-auto"), children: /* @__PURE__ */ m(
      "div",
      {
        className: c(
          s.status,
          o,
          a,
          n ? "d-inline-flex flex-column" : "d-flex align-items-center",
          "text"
        ),
        children: [
          s.icon ? /* @__PURE__ */ l(
            "div",
            {
              className: e(
                null,
                c(
                  s.status,
                  o,
                  a,
                  "d-flex align-items-center justify-content-center"
                ),
                p && r.brlCursorPointer
              ),
              onClick: () => d(t),
              ref: (i) => {
                i && (x(i.offsetHeight), y(i.offsetWidth));
              },
              children: s.icon
            }
          ) : /* @__PURE__ */ l(
            "button",
            {
              className: e(
                null,
                c(
                  s.status,
                  o,
                  a,
                  `btn btn-sm rounded-pill ${r.brlW8} ${r.brlH8}`
                ),
                !p && r.brlCursorDefaultImp
              ),
              onClick: () => d(t),
              ref: (i) => {
                i && (x(i.offsetHeight), y(i.offsetWidth));
              },
              type: "button",
              children: t + 1
            }
          ),
          b && /* @__PURE__ */ l(
            "div",
            {
              className: e(
                null,
                "flex-grow-1 position-relative",
                n ? `my-2 ${r.brlMinH8}` : "mx-2"
              ),
              children: /* @__PURE__ */ l(
                "div",
                {
                  className: e(
                    null,
                    "progress",
                    n ? `flex-column position-absolute top-0 start-50 translate-middle-x h-100 ${r.brlW05}` : `position-absolute top-50 start-0 w-100 ${r.brlH05}`
                  ),
                  role: "progressbar",
                  children: /* @__PURE__ */ l(
                    "div",
                    {
                      className: c(
                        s.status,
                        o,
                        a,
                        `progress-bar ${n ? "h-100" : "w-100"}`,
                        "progress"
                      )
                    }
                  )
                }
              )
            }
          )
        ]
      }
    ) }, s.id);
  }) }) : M ? /* @__PURE__ */ l(h, { ...w, ...S, children: g.map((s, t) => {
    const a = t === u, o = t < u, b = t !== W - 1;
    return /* @__PURE__ */ m("div", { className: e(null, "px-0", b ? "col" : "col-auto"), children: [
      /* @__PURE__ */ m(
        "div",
        {
          className: c(
            s.status,
            o,
            a,
            n ? "d-inline-flex flex-column" : "d-flex align-items-center",
            "text"
          ),
          children: [
            /* @__PURE__ */ m("div", { className: "d-inline-flex", children: [
              /* @__PURE__ */ m("div", { children: [
                s.icon ? /* @__PURE__ */ l(
                  "div",
                  {
                    className: e(
                      null,
                      c(
                        s.status,
                        o,
                        a,
                        "d-flex align-items-center justify-content-center"
                      ),
                      p && r.brlCursorPointer
                    ),
                    onClick: () => d(t),
                    ref: (i) => {
                      i && (x(i.offsetHeight), y(i.offsetWidth));
                    },
                    children: s.icon
                  }
                ) : /* @__PURE__ */ l(
                  "button",
                  {
                    className: e(
                      null,
                      c(
                        s.status,
                        o,
                        a,
                        `btn btn-sm rounded-pill ${r.brlW8} ${r.brlH8}`
                      ),
                      !p && r.brlCursorDefaultImp
                    ),
                    onClick: () => d(t),
                    ref: (i) => {
                      i && (x(i.offsetHeight), y(i.offsetWidth));
                    },
                    type: "button",
                    children: t + 1
                  }
                ),
                n && b && /* @__PURE__ */ l(
                  "div",
                  {
                    className: e(
                      null,
                      "flex-grow-1 position-relative",
                      n ? `my-2 ${r.brlMinH8}` : "mx-2"
                    ),
                    children: /* @__PURE__ */ l(
                      "div",
                      {
                        className: e(
                          null,
                          "progress",
                          n ? `flex-column position-absolute top-0 start-50 translate-middle-x h-100 ${r.brlW05}` : `position-absolute top-50 start-0 w-100 ${r.brlH05}`
                        ),
                        role: "progressbar",
                        children: /* @__PURE__ */ l(
                          "div",
                          {
                            className: c(
                              s.status,
                              o,
                              a,
                              `progress-bar ${n ? "h-100" : "w-100"}`,
                              "progress"
                            )
                          }
                        )
                      }
                    )
                  }
                )
              ] }),
              n && /* @__PURE__ */ m("div", { className: "ms-2", children: [
                s.title && /* @__PURE__ */ l(
                  "div",
                  {
                    className: e(null, p && r.brlCursorPointer),
                    onClick: () => d(t),
                    style: {
                      lineHeight: `${O / 16}rem`
                    },
                    children: s.title
                  }
                ),
                s.description && /* @__PURE__ */ l(
                  "div",
                  {
                    className: e(
                      null,
                      c(s.status, o, a, "", "text"),
                      p && r.brlCursorDefault
                    ),
                    onClick: () => d(t),
                    style: { marginLeft: n ? 0 : `${k / 16 + 0.5}rem` },
                    children: s.description
                  }
                )
              ] })
            ] }),
            !n && s.title && /* @__PURE__ */ l(
              "div",
              {
                className: e(null, "ms-2", p && r.brlCursorPointer),
                onClick: () => d(t),
                children: s.title
              }
            ),
            !n && b && /* @__PURE__ */ l(
              "div",
              {
                className: e(
                  null,
                  "flex-grow-1 position-relative",
                  n ? `my-2 ${r.brlMinH8}` : "mx-2"
                ),
                children: /* @__PURE__ */ l(
                  "div",
                  {
                    className: e(
                      null,
                      "progress",
                      n ? `flex-column position-absolute top-0 start-50 translate-middle-x h-100 ${r.brlW05}` : `position-absolute top-50 start-0 w-100 ${r.brlH05}`
                    ),
                    role: "progressbar",
                    children: /* @__PURE__ */ l(
                      "div",
                      {
                        className: c(
                          s.status,
                          o,
                          a,
                          `progress-bar ${n ? "h-100" : "w-100"}`,
                          "progress"
                        )
                      }
                    )
                  }
                )
              }
            )
          ]
        }
      ),
      !n && s.description && /* @__PURE__ */ l(
        "div",
        {
          className: e(
            null,
            c(s.status, o, a, "", "text"),
            p && r.brlCursorDefault
          ),
          onClick: () => d(t),
          style: { marginLeft: n ? 0 : `${k / 16 + 0.5}rem` },
          children: s.description
        }
      )
    ] }, s.id);
  }) }) : /* @__PURE__ */ l(h, { ...w, ...S, children: g.map((s, t) => {
    const a = t === u, o = t < u, b = t !== W - 1, i = t > 0 ? g[t - 1].status : null, K = t > 0 ? t - 1 < u : !1, R = t - 1 === u;
    return /* @__PURE__ */ l("div", { className: "px-0 col", children: /* @__PURE__ */ m(
      "div",
      {
        className: c(
          s.status,
          o,
          a,
          "d-flex flex-column align-items-center",
          "text"
        ),
        children: [
          /* @__PURE__ */ m("div", { className: "w-100 d-flex justify-content-center position-relative", children: [
            t !== 0 && /* @__PURE__ */ l(
              "div",
              {
                className: e(
                  null,
                  `progress position-absolute top-50 start-0 ${r.brlH05}`
                ),
                role: "progressbar",
                style: { width: `calc(50% - ${k / 2}px - 0.5rem)` },
                children: /* @__PURE__ */ l(
                  "div",
                  {
                    className: c(
                      i,
                      K,
                      R,
                      "progress-bar w-100",
                      "progress"
                    )
                  }
                )
              }
            ),
            s.icon ? /* @__PURE__ */ l(
              "div",
              {
                className: e(
                  null,
                  c(
                    s.status,
                    o,
                    a,
                    "d-flex align-items-center justify-content-center"
                  ),
                  p && r.brlCursorPointer
                ),
                onClick: () => d(t),
                ref: (v) => {
                  v && (x(v.offsetHeight), y(v.offsetWidth));
                },
                children: s.icon
              }
            ) : /* @__PURE__ */ l(
              "button",
              {
                className: e(
                  null,
                  c(
                    s.status,
                    o,
                    a,
                    `btn btn-sm rounded-pill ${r.brlW8} ${r.brlH8}`
                  ),
                  !p && r.brlCursorDefaultImp
                ),
                onClick: () => d(t),
                ref: (v) => {
                  v && (x(v.offsetHeight), y(v.offsetWidth));
                },
                type: "button",
                children: t + 1
              }
            ),
            b && /* @__PURE__ */ l(
              "div",
              {
                className: e(null, `progress position-absolute top-50 w-50 ${r.brlH05}`),
                role: "progressbar",
                style: { left: `calc(50% + ${k / 2}px + 0.5rem)` },
                children: /* @__PURE__ */ l(
                  "div",
                  {
                    className: c(
                      s.status,
                      o,
                      a,
                      "progress-bar w-100",
                      "progress"
                    )
                  }
                )
              }
            )
          ] }),
          s.title && /* @__PURE__ */ l(
            "div",
            {
              className: e(
                null,
                c(s.status, o, a, "", "text"),
                p && r.brlCursorPointer
              ),
              onClick: () => d(t),
              children: s.title
            }
          ),
          s.description && /* @__PURE__ */ l(
            "div",
            {
              className: e(
                null,
                c(s.status, o, a, "", "text"),
                p && r.brlCursorPointer
              ),
              onClick: () => d(t),
              children: s.description
            }
          )
        ]
      }
    ) }, s.id);
  }) });
};
E.displayName = "BRL.Steps";
export {
  E as S
};
//# sourceMappingURL=steps.js.map
