"use strict";
const React = require("react");
const classNames = require("../_util/classNames.js");
const usePrevious = require("../_util/hooks/usePrevious.js");
const emotionReactJsxRuntime_browser_esm = require("../../../../../../@emotion_react@11.10.4_3toe27fv7etiytxb5kxc7fxaw4/node_modules/@emotion/react/jsx-runtime/dist/emotion-react-jsx-runtime.browser.esm.js");
const CSSTransition = require("../../../../../../react-transition-group@4.4.5_biqbaboplfbrettd7655fr4n2y/node_modules/react-transition-group/esm/CSSTransition.js");
var __read = globalThis && globalThis.__read || function(o, n) {
  var m = typeof Symbol === "function" && o[Symbol.iterator];
  if (!m)
    return o;
  var i = m.call(o), r, ar = [], e;
  try {
    while ((n === void 0 || n-- > 0) && !(r = i.next()).done)
      ar.push(r.value);
  } catch (error) {
    e = {
      error
    };
  } finally {
    try {
      if (r && !r.done && (m = i["return"]))
        m.call(i);
    } finally {
      if (e)
        throw e.error;
    }
  }
  return ar;
};
function Count(_a) {
  var _b;
  var prefixCls = _a.prefixCls, maxCount = _a.maxCount, count = _a.count, className = _a.className, style = _a.style;
  var _c = __read(React.useState(false), 2), isEntered = _c[0], setIsEntered = _c[1];
  var oldCount = usePrevious(count);
  var isChanged = count !== oldCount;
  return /* @__PURE__ */ emotionReactJsxRuntime_browser_esm.jsx(CSSTransition, {
    classNames: "badge-zoom",
    in: count > 0,
    timeout: 300,
    appear: true,
    mountOnEnter: true,
    unmountOnExit: true,
    onEntered: function() {
      setIsEntered(true);
    },
    children: /* @__PURE__ */ emotionReactJsxRuntime_browser_esm.jsx("span", {
      className,
      style,
      children: /* @__PURE__ */ emotionReactJsxRuntime_browser_esm.jsx("span", {
        className: classNames((_b = {}, _b[prefixCls + "-number-text"] = isEntered && isChanged, _b)),
        children: maxCount && count > maxCount ? maxCount + "+" : count
      }, count)
    })
  });
}
module.exports = Count;
//# sourceMappingURL=count.js.map
