import { __assign, __rest } from "tslib";
import React, { useContext } from 'react';
import classNames from 'classnames';
import { ConfigContext } from '../config-provider/config-context';
import { getPrefixCls } from '../_utils/general';
var tagGenerator = function (isRequired, tag, element) {
    if (!isRequired)
        return element;
    return React.createElement(tag, {}, element);
};
var Text = function (props) {
    var _a = props.code, code = _a === void 0 ? false : _a, _b = props.del, del = _b === void 0 ? false : _b, _c = props.underline, underline = _c === void 0 ? false : _c, _d = props.strong, strong = _d === void 0 ? false : _d, _e = props.italic, italic = _e === void 0 ? false : _e, _f = props.mark, mark = _f === void 0 ? false : _f, _g = props.sub, sub = _g === void 0 ? false : _g, _h = props.sup, sup = _h === void 0 ? false : _h, className = props.className, children = props.children, customisedCls = props.prefixCls, otherProps = __rest(props, ["code", "del", "underline", "strong", "italic", "mark", "sub", "sup", "className", "children", "prefixCls"]);
    var Node = tagGenerator(code, 'code', children);
    Node = tagGenerator(del, 'del', Node);
    Node = tagGenerator(underline, 'u', Node);
    Node = tagGenerator(strong, 'strong', Node);
    Node = tagGenerator(italic, 'i', Node);
    Node = tagGenerator(mark, 'mark', Node);
    Node = tagGenerator(sub, 'sub', Node);
    Node = tagGenerator(sup, 'sup', Node);
    var configContext = useContext(ConfigContext);
    var prefixCls = getPrefixCls('typography', configContext.prefixCls, customisedCls);
    var cls = classNames(className, prefixCls);
    return (React.createElement("span", __assign({}, otherProps, { className: cls }), Node));
};
export default Text;
//# sourceMappingURL=text.js.map