"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.getServerSideProps = void 0;
const jsx_runtime_1 = require("react/jsx-runtime");
const antd_1 = require("antd");
const footer_1 = __importDefault(require("components/landing/footer"));
const head_1 = __importDefault(require("components/landing/head"));
const header_1 = __importDefault(require("components/landing/header"));
const image_1 = __importDefault(require("components/landing/image"));
const software_info_1 = __importDefault(require("components/landing/software-info"));
const software_libraries_1 = __importDefault(require("components/landing/software-libraries"));
const A_1 = __importDefault(require("components/misc/A"));
const customize_1 = require("lib/customize");
const software_specs_1 = require("lib/landing/software-specs");
const _1 = require(".");
const frame_editor_python_png_1 = __importDefault(require("/public/features/frame-editor-python.png"));
function Software(props) {
    const { customize, spec, inventory, components, execInfo } = props;
    function renderEnvs() {
        const envs = [];
        for (const [key, info] of Object.entries(spec)) {
            envs.push((0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsxs)("b", { children: [(0, jsx_runtime_1.jsx)(A_1.default, { href: info.url, children: info.name }), ":"] }), " ", info.doc] }, key));
        }
        return envs;
    }
    function renderBox() {
        return ((0, jsx_runtime_1.jsx)(antd_1.Alert, { style: { margin: "15px 0" }, message: "Learn More", description: (0, jsx_runtime_1.jsxs)("span", { style: { fontSize: "10pt" }, children: ["Learn more about", " ", (0, jsx_runtime_1.jsx)("strong", { children: (0, jsx_runtime_1.jsx)(A_1.default, { href: "/features/python", children: "Python in CoCalc" }) }), " ", "and", " ", (0, jsx_runtime_1.jsx)("strong", { children: (0, jsx_runtime_1.jsx)(A_1.default, { href: "/features/jupyter-notebook", children: "Jupyter Notebook support" }) }), "."] }), type: "info", showIcon: true }));
    }
    function renderIntro() {
        return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("h1", { style: { textAlign: "center", fontSize: "32pt", color: "#444" }, children: "Installed Python Libraries" }), (0, jsx_runtime_1.jsx)("div", { style: { width: "50%", float: "right", padding: "0 0 15px 15px" }, children: (0, jsx_runtime_1.jsx)(image_1.default, { src: frame_editor_python_png_1.default, alt: "Writing and running a Python program" }) }), (0, jsx_runtime_1.jsxs)("p", { children: ["The table below lists available Python libraries for each supported environment. If something is missing, you can", " ", (0, jsx_runtime_1.jsx)(A_1.default, { href: "https://doc.cocalc.com/howto/install-python-lib.html", children: "install it yourself" }), ", or request that we install it."] })] }));
    }
    // top part has the same with, the table is wider
    function renderTop() {
        return ((0, jsx_runtime_1.jsxs)("div", { style: { maxWidth: _1.STYLE_PAGE.maxWidth, margin: "0 auto" }, children: [renderIntro(), renderBox(), (0, jsx_runtime_1.jsx)("h2", { children: (0, jsx_runtime_1.jsx)(A_1.default, { href: "/features/python", children: "Python Environments" }) }), (0, jsx_runtime_1.jsx)("ul", { children: renderEnvs() }), (0, jsx_runtime_1.jsx)(software_info_1.default, { info: execInfo, showHeader: false })] }));
    }
    return ((0, jsx_runtime_1.jsxs)(customize_1.Customize, { value: customize, children: [(0, jsx_runtime_1.jsx)(head_1.default, { title: "Python Libraries in CoCalc" }), (0, jsx_runtime_1.jsxs)(antd_1.Layout, { children: [(0, jsx_runtime_1.jsx)(header_1.default, { page: "software", subPage: "python" }), (0, jsx_runtime_1.jsxs)(antd_1.Layout.Content, { style: {
                            backgroundColor: "white",
                        }, children: [(0, jsx_runtime_1.jsxs)("div", { style: _1.STYLE_PAGE_WIDE, children: [renderTop(), (0, jsx_runtime_1.jsx)(software_libraries_1.default, { spec: spec, inventory: inventory, components: components, libWidthPct: 40 })] }), (0, jsx_runtime_1.jsx)(footer_1.default, {})] })] })] }));
}
exports.default = Software;
async function getServerSideProps(context) {
    return await (0, software_specs_1.withCustomizedAndSoftwareSpec)(context, "python", [
        "/usr/bin/python3",
        "/ext/anaconda2020.02/bin/python",
        "/ext/anaconda2021.11/bin/python",
        "/ext/bin/python3-sage",
        "/usr/bin/python2",
    ]);
}
exports.getServerSideProps = getServerSideProps;
//# sourceMappingURL=python.js.map