import _extends from"babel-runtime/helpers/extends";import _defineProperty from"babel-runtime/helpers/defineProperty";import _classCallCheck from"babel-runtime/helpers/classCallCheck";import _createClass from"babel-runtime/helpers/createClass";import _possibleConstructorReturn from"babel-runtime/helpers/possibleConstructorReturn";import _inherits from"babel-runtime/helpers/inherits";var __rest=this&&this.__rest||function(e,t){var r={};for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&t.indexOf(s)<0&&(r[s]=e[s]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(s=Object.getOwnPropertySymbols(e);o<s.length;o++)t.indexOf(s[o])<0&&(r[s[o]]=e[s[o]])}return r};import*as React from"react";import*as PropTypes from"prop-types";import Animate from"rc-animate";import ScrollNumber from"./ScrollNumber";import classNames from"classnames";var Badge=function(e){function t(){return _classCallCheck(this,t),_possibleConstructorReturn(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return _inherits(t,e),_createClass(t,[{key:"render",value:function(){var e,t,r,s=this.props,o=s.count,a=s.showZero,n=s.prefixCls,l=s.scrollNumberPrefixCls,p=s.overflowCount,i=s.className,c=s.style,m=s.children,u=s.dot,f=s.status,d=s.text,y=s.offset,b=__rest(s,["count","showZero","prefixCls","scrollNumberPrefixCls","overflowCount","className","style","children","dot","status","text","offset"]),h=o>p?p+"+":o,_="0"===h||0===h,P=u&&!_||f;P&&(h="");var C=(null===h||void 0===h||""===h||_&&!a)&&!P,N=classNames((_defineProperty(e={},n+"-status-dot",!!f),_defineProperty(e,n+"-status-"+f,!!f),e)),x=classNames((_defineProperty(t={},n+"-dot",P),_defineProperty(t,n+"-count",!P),_defineProperty(t,n+"-multiple-words",!P&&o&&o.toString&&o.toString().length>1),_defineProperty(t,n+"-status-"+f,!!f),t)),w=classNames(i,n,(_defineProperty(r={},n+"-status",!!f),_defineProperty(r,n+"-not-a-wrapper",!m),r)),g=y?_extends({marginTop:y[0],marginLeft:y[1]},c):c;if(!m&&f)return React.createElement("span",{className:w,style:g},React.createElement("span",{className:N}),React.createElement("span",{className:n+"-status-text"},d));var v=C?null:React.createElement(ScrollNumber,{prefixCls:l,"data-show":!C,className:x,count:h,title:o,style:g}),R=C||!d?null:React.createElement("span",{className:n+"-status-text"},d);return React.createElement("span",_extends({},b,{className:w}),m,React.createElement(Animate,{component:"",showProp:"data-show",transitionName:m?n+"-zoom":"",transitionAppear:!0},v),R)}}]),t}(React.Component);export default Badge;Badge.defaultProps={prefixCls:"dt-badge",scrollNumberPrefixCls:"dt-scroll-number",count:null,showZero:!1,dot:!1,overflowCount:99},Badge.propTypes={count:PropTypes.oneOfType([PropTypes.string,PropTypes.number]),showZero:PropTypes.bool,dot:PropTypes.bool,overflowCount:PropTypes.number};