import u from "../../../classnames/index.mjs";
import * as s from "react";
import { cloneElement as y } from "../_util/reactNode.mjs";
import "../config-provider/index.mjs";
import h from "./SingleNumber.mjs";
import { ConfigContext as j } from "../config-provider/context.mjs";
var w = globalThis && globalThis.__rest || function(t, a) {
  var n = {};
  for (var e in t)
    Object.prototype.hasOwnProperty.call(t, e) && a.indexOf(e) < 0 && (n[e] = t[e]);
  if (t != null && typeof Object.getOwnPropertySymbols == "function")
    for (var o = 0, e = Object.getOwnPropertySymbols(t); o < e.length; o++)
      a.indexOf(e[o]) < 0 && Object.prototype.propertyIsEnumerable.call(t, e[o]) && (n[e[o]] = t[e[o]]);
  return n;
};
const v = /* @__PURE__ */ s.forwardRef((t, a) => {
  const {
    prefixCls: n,
    count: e,
    className: o,
    motionClassName: m,
    style: l,
    title: p,
    show: g,
    component: d = "sup",
    children: i
  } = t, C = w(t, ["prefixCls", "count", "className", "motionClassName", "style", "title", "show", "component", "children"]), {
    getPrefixCls: N
  } = s.useContext(j), c = N("scroll-number", n), f = Object.assign(Object.assign({}, C), {
    "data-show": g,
    style: l,
    className: u(c, o, m),
    title: p
  });
  let b = e;
  if (e && Number(e) % 1 === 0) {
    const r = String(e).split("");
    b = /* @__PURE__ */ s.createElement("bdi", null, r.map((O, x) => /* @__PURE__ */ s.createElement(h, {
      prefixCls: c,
      count: Number(e),
      value: O,
      // eslint-disable-next-line react/no-array-index-key
      key: r.length - x
    })));
  }
  return l && l.borderColor && (f.style = Object.assign(Object.assign({}, l), {
    boxShadow: `0 0 0 1px ${l.borderColor} inset`
  })), i ? y(i, (r) => ({
    className: u(`${c}-custom-component`, r == null ? void 0 : r.className, m)
  })) : /* @__PURE__ */ s.createElement(d, Object.assign({}, f, {
    ref: a
  }), b);
}), R = v;
export {
  R as default
};
