"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.SingleResourceAlerts = void 0;
const tslib_1 = require("tslib");
const react_1 = tslib_1.__importDefault(require("react"));
const react_core_1 = require("@patternfly/react-core");
require("./ResourceAlerts.css");
const SingleResourceAlerts = ({ title, conditions }) => {
    if (!conditions.length) {
        return null;
    }
    return (react_1.default.createElement(react_core_1.Alert, { title: title, variant: react_core_1.AlertVariant.danger, isInline: true, className: "cim-resource-alerts cim-resource-alerts--noul" },
        react_1.default.createElement(react_core_1.Content, { component: react_core_1.ContentVariants.ul }, conditions.map((c) => {
            if (c.message) {
                const [title, ...messages] = c.message.split(/:|\.,/);
                return (react_1.default.createElement(react_1.default.Fragment, { key: c.type },
                    react_1.default.createElement(react_core_1.Content, { component: react_core_1.ContentVariants.li, className: "pf-v6-u-font-weight-bold" }, title),
                    messages.map((m) => (react_1.default.createElement(react_core_1.Content, { key: m, component: react_core_1.ContentVariants.li }, m)))));
            }
            else {
                return (react_1.default.createElement(react_1.default.Fragment, { key: c.type },
                    react_1.default.createElement(react_core_1.Content, { component: react_core_1.ContentVariants.li, className: "pf-v6-u-font-weight-bold" }, c.type),
                    react_1.default.createElement(react_core_1.Content, { component: react_core_1.ContentVariants.li }, c.reason || '')));
            }
        }))));
};
exports.SingleResourceAlerts = SingleResourceAlerts;
//# sourceMappingURL=ResourceAlerts.js.map