"use strict";
var __assign = (this && this.__assign) || function () {
    __assign = Object.assign || function(t) {
        for (var s, i = 1, n = arguments.length; i < n; i++) {
            s = arguments[i];
            for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
                t[p] = s[p];
        }
        return t;
    };
    return __assign.apply(this, arguments);
};
var __read = (this && this.__read) || function (o, n) {
    var m = typeof Symbol === "function" && o[Symbol.iterator];
    if (!m) return o;
    var i = m.call(o), r, ar = [], e;
    try {
        while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
    }
    catch (error) { e = { error: error }; }
    finally {
        try {
            if (r && !r.done && (m = i["return"])) m.call(i);
        }
        finally { if (e) throw e.error; }
    }
    return ar;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.VERSION_STYLE_PARENT = exports.VERSION_STYLE = void 0;
var jsx_runtime_1 = require("react/jsx-runtime");
/*
 *  This file is part of CoCalc: Copyright © 2021 Sagemath, Inc.
 *  License: AGPLv3 s.t. "Commons Clause" – see LICENSE.md for details
 */
// A small banner on top of the list of packages, surfacing information about the executable.
var antd_1 = require("antd");
var TabPane = antd_1.Tabs.TabPane;
exports.VERSION_STYLE = {
    maxHeight: "8em",
    backgroundColor: "rgba(150, 150, 150, 0.1)",
    fontSize: "12px",
    padding: "10px",
    overflow: "auto",
    marginBottom: "20px",
};
exports.VERSION_STYLE_PARENT = {
    clear: "both",
};
function SoftwareInfo(_a) {
    var info = _a.info, _b = _a.showHeader, showHeader = _b === void 0 ? true : _b;
    if (info == null)
        return null;
    function renderInfoTabs() {
        if (info == null)
            return null;
        return Object.entries(info).map(function (_a) {
            var _b = __read(_a, 2), k = _b[0], v = _b[1];
            if (v == null)
                return null;
            return ((0, jsx_runtime_1.jsx)(TabPane, __assign({ tab: k }, { children: (0, jsx_runtime_1.jsx)("div", __assign({ style: exports.VERSION_STYLE }, { children: (0, jsx_runtime_1.jsx)("pre", __assign({ style: exports.VERSION_STYLE_PARENT }, { children: v })) })) }), k));
        });
    }
    function renderInfo() {
        return (0, jsx_runtime_1.jsx)(antd_1.Tabs, { children: renderInfoTabs() });
    }
    return ((0, jsx_runtime_1.jsxs)("div", __assign({ style: exports.VERSION_STYLE_PARENT }, { children: [showHeader && (0, jsx_runtime_1.jsx)("h4", { children: "Executable information" }), renderInfo()] })));
}
exports.default = SoftwareInfo;
//# sourceMappingURL=software-info.js.map