"use strict";
Object.defineProperty(exports, "__esModule", {
    value: true
});
Object.defineProperty(exports, "ResultPage", {
    enumerable: true,
    get: function() {
        return ResultPage;
    }
});
var _interop_require_default = require("@swc/helpers/_/_interop_require_default");
var _object_spread = require("@swc/helpers/_/_object_spread");
var _object_spread_props = require("@swc/helpers/_/_object_spread_props");
var _object_without_properties = require("@swc/helpers/_/_object_without_properties");
var _react = /*#__PURE__*/ _interop_require_default._(require("react"));
var _classnames = /*#__PURE__*/ _interop_require_default._(require("classnames"));
var _iconsreacttaro = require("@nutui/icons-react-taro");
var _components = require("@tarojs/components");
var _typings = require("../../utils/typings");
var _button = require("../button/button");
var defaultProps = (0, _object_spread_props._)((0, _object_spread._)({}, _typings.ComponentDefaults), {
    title: null,
    description: null,
    icon: '',
    status: 'info',
    actions: []
});
var ResultPage = function ResultPage(props) {
    var _$_object_spread = (0, _object_spread._)({}, defaultProps, props), className = _$_object_spread.className, style = _$_object_spread.style, title = _$_object_spread.title, description = _$_object_spread.description, icon = _$_object_spread.icon, status = _$_object_spread.status, actions = _$_object_spread.actions, children = _$_object_spread.children;
    var classPrefix = "nut-resultpage";
    var cls = (0, _classnames.default)(classPrefix, className);
    var defaultStatus = {
        success: /*#__PURE__*/ _react.default.createElement(_iconsreacttaro.Success, {
            color: "var(--nutui-color-success, #0acc2a)"
        }),
        error: /*#__PURE__*/ _react.default.createElement(_iconsreacttaro.Failure, {
            color: "var(--nutui-color-primary, #ff0f23)"
        }),
        warning: /*#__PURE__*/ _react.default.createElement(_iconsreacttaro.Warning, {
            color: "var(--nutui-color-warning, #ffaa00)"
        }),
        info: /*#__PURE__*/ _react.default.createElement(_iconsreacttaro.Tips, {
            color: "var(--nutui-color-info, #0c82f7)"
        }),
        waiting: /*#__PURE__*/ _react.default.createElement(_iconsreacttaro.Ask, {
            color: "var(--nutui-color-info, #0c82f7)"
        })
    };
    return /*#__PURE__*/ _react.default.createElement(_components.View, {
        className: cls,
        style: style
    }, /*#__PURE__*/ _react.default.createElement(_components.View, {
        className: "".concat(classPrefix, "-icon")
    }, icon || defaultStatus[status]), typeof title === 'string' && title ? /*#__PURE__*/ _react.default.createElement(_components.View, {
        className: "".concat(classPrefix, "-title")
    }, title) : title, typeof description === 'string' && description ? /*#__PURE__*/ _react.default.createElement(_components.Text, {
        numberOfLines: 2,
        className: "".concat(classPrefix, "-description")
    }, description) : description, actions.length ? /*#__PURE__*/ _react.default.createElement(_components.View, {
        className: "".concat(classPrefix, "-actions")
    }, actions.map(function(action, index) {
        var text = action.text, rest = (0, _object_without_properties._)(action, [
            "text"
        ]);
        return /*#__PURE__*/ _react.default.createElement(_components.View, {
            className: "".concat(classPrefix, "-action"),
            key: index
        }, /*#__PURE__*/ _react.default.createElement(_button.Button, (0, _object_spread_props._)((0, _object_spread._)({}, rest), {
            size: "large"
        }), action === null || action === void 0 ? void 0 : action.text));
    })) : null, children);
};
ResultPage.displayName = 'NutResultPage';
