var __rest = (this && this.__rest) || function (s, e) {
    var t = {};
    for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
        t[p] = s[p];
    if (s != null && typeof Object.getOwnPropertySymbols === "function")
        for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
            if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
                t[p[i]] = s[p[i]];
        }
    return t;
};
import Button from '../button';
import ConfigProvider from '../config-provider';
import React, { Component } from 'react';
import cls from 'classnames';
import hoistNonReactStatics from 'hoist-non-react-statics';
import { Balloon as NextBalloon } from '@alifd/next';
class Balloon extends Component {
    render() {
        const _a = this.props, { prefix = 'next-', type = 'normal', title, children, closable, linkProps, buttonProps, onButtonClick } = _a, otherProps = __rest(_a, ["prefix", "type", "title", "children", "closable", "linkProps", "buttonProps", "onButtonClick"]);
        if (!linkProps && !buttonProps && !onButtonClick) {
            return (React.createElement(NextBalloon, Object.assign({ type: type, title: title, children: children }, otherProps, { className: cls(this.props.className, {
                    [`${prefix}balloon-with-title`]: title,
                    [`${prefix}add-closable`]: closable,
                }), closable: closable ? closable : false })));
        }
        return (React.createElement("div", null,
            React.createElement(NextBalloon, Object.assign({ type: type, title: title }, otherProps, { className: cls(this.props.className, {
                    [`${prefix}balloon-with-title`]: title,
                    [`${prefix}add-closable`]: closable,
                    [`${prefix}balloon-with-action`]: linkProps || buttonProps || onButtonClick,
                }), closable: closable ? closable : false }),
                children,
                React.createElement("div", { className: `${prefix}balloon-action` },
                    React.createElement("a", { className: linkProps ? `${prefix}has-action-link` : `${prefix}action-hidden`, href: linkProps ? linkProps[0] : undefined }, linkProps ? linkProps[1] : undefined),
                    React.createElement(Button, { onClick: onButtonClick ? onButtonClick : undefined, className: buttonProps ? `${prefix}has-action-button` : `${prefix}action-hidden`, type: "primary", size: "xs" }, buttonProps ? buttonProps : undefined)))));
    }
}
Balloon.Tooltip = NextBalloon.Tooltip;
hoistNonReactStatics(Balloon, NextBalloon);
export default ConfigProvider.config(Balloon);
