"use strict";
exports.id = 7017;
exports.ids = [7017];
exports.modules = {

/***/ 28982:
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "ZP": () => (/* binding */ SoftwareInfo)
/* harmony export */ });
/* unused harmony exports VERSION_STYLE, VERSION_STYLE_PARENT */
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(920997);
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(545725);
/* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(antd__WEBPACK_IMPORTED_MODULE_1__);
/*
 *  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.


const { TabPane  } = antd__WEBPACK_IMPORTED_MODULE_1__.Tabs;
const VERSION_STYLE = {
    maxHeight: "8em",
    backgroundColor: "rgba(150, 150, 150, 0.1)",
    fontSize: "12px",
    padding: "10px",
    overflow: "auto",
    marginBottom: "20px"
};
const VERSION_STYLE_PARENT = {
    clear: "both"
};
function SoftwareInfo({ info , showHeader =true  }) {
    if (info == null) return null;
    function renderInfoTabs() {
        if (info == null) return null;
        return Object.entries(info).map(([k, v])=>{
            if (v == null) return null;
            return /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(TabPane, {
                tab: k,
                children: /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("div", {
                    style: VERSION_STYLE,
                    children: /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("pre", {
                        style: VERSION_STYLE_PARENT,
                        children: v
                    })
                })
            }, k);
        });
    }
    function renderInfo() {
        return /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(antd__WEBPACK_IMPORTED_MODULE_1__.Tabs, {
            children: renderInfoTabs()
        });
    }
    return /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("div", {
        style: VERSION_STYLE_PARENT,
        children: [
            showHeader && /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("h4", {
                children: "Executable information"
            }),
            renderInfo()
        ]
    });
}


/***/ }),

/***/ 370670:
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {


// EXPORTS
__webpack_require__.d(__webpack_exports__, {
  "Z": () => (/* binding */ SoftwareLibraries)
});

// UNUSED EXPORTS: renderName

// EXTERNAL MODULE: external "react/jsx-runtime"
var jsx_runtime_ = __webpack_require__(920997);
// EXTERNAL MODULE: external "react"
var external_react_ = __webpack_require__(616689);
// EXTERNAL MODULE: external "antd"
var external_antd_ = __webpack_require__(545725);
// EXTERNAL MODULE: external "lodash"
var external_lodash_ = __webpack_require__(546517);
// EXTERNAL MODULE: ./components/misc/A.tsx
var A = __webpack_require__(940981);
// EXTERNAL MODULE: ../util/dist/misc.js
var misc = __webpack_require__(477389);
;// CONCATENATED MODULE: ./lib/landing/get-libraries.ts

// client side processing, used to generate the data for the Antd tables
function getLibaries(spec, inventory, components) {
    const libs = [];
    for(const name in components){
        const { url , summary  } = components[name] ?? {};
        const item = {
            index: libs.length,
            name,
            key: name.toLowerCase(),
            summary: summary ?? "",
            // there may be multiple url's separated by commas in some cases
            // TODO show all URLs
            url: url?.split(",")[0],
            search: (name + (summary ?? "")).toLowerCase()
        };
        for(const env in spec){
            const envInfo = inventory[spec[env].cmd]?.[name];
            if (envInfo != null) item[env] = envInfo;
        }
        libs.push(item);
    }
    libs.sort((0,misc.field_cmp)("key"));
    return libs;
}

;// CONCATENATED MODULE: ./components/landing/software-libraries.tsx






// check if the string is a URL
function isURL(url) {
    return url && url.match(/^(http|https):\/\//);
}
function renderName(name, record) {
    const url = record.url;
    return /*#__PURE__*/ (0,jsx_runtime_.jsxs)("div", {
        children: [
            /*#__PURE__*/ jsx_runtime_.jsx("b", {
                children: isURL(url) ? /*#__PURE__*/ jsx_runtime_.jsx(A/* default */.Z, {
                    href: url,
                    children: name
                }) : name
            }),
            /*#__PURE__*/ jsx_runtime_.jsx("br", {}),
            record.summary
        ]
    });
}
function SoftwareLibraries(props) {
    const { spec , inventory , components , libWidthPct =60  } = props;
    const dataSource = getLibaries(spec, inventory, components);
    const { 0: search , 1: setSearch  } = (0,external_react_.useState)("");
    const onChange = (0,external_react_.useMemo)(()=>(0,external_lodash_.debounce)((e)=>{
            setSearch(e.target.value);
        }, 500), []);
    let data;
    if (!search) {
        data = dataSource;
    } else {
        const s = search.toLowerCase();
        data = [];
        for (const x of dataSource){
            if (x.search.includes(s)) {
                data.push(x);
            }
        }
    }
    const columns = (0,external_react_.useMemo)(()=>{
        const envs = Object.entries(spec);
        const width = (100 - libWidthPct) / envs.length;
        const columns = [
            {
                width: `${libWidthPct}%`,
                title: "Library",
                key: "library",
                dataIndex: "name",
                render: renderName
            }, 
        ];
        for (const [name, val] of envs){
            columns.push({
                width: `${width}%`,
                title: val.name,
                key: name,
                dataIndex: name
            });
        }
        return columns;
    }, [
        libWidthPct
    ]);
    return /*#__PURE__*/ (0,jsx_runtime_.jsxs)("div", {
        children: [
            /*#__PURE__*/ (0,jsx_runtime_.jsxs)("h2", {
                children: [
                    "Showing ",
                    data.length,
                    " libraries"
                ]
            }),
            /*#__PURE__*/ jsx_runtime_.jsx(external_antd_.Input.Search, {
                style: {
                    padding: "0 30px 15px 0",
                    width: "50%",
                    minWidth: "300px"
                },
                placeholder: "Search...",
                allowClear: true,
                onChange: onChange,
                onPressEnter: (e)=>setSearch(e.target.value)
            }),
            /*#__PURE__*/ jsx_runtime_.jsx("div", {
                style: {
                    overflowX: "auto",
                    width: "100%"
                },
                children: /*#__PURE__*/ jsx_runtime_.jsx(external_antd_.Table, {
                    columns: columns,
                    bordered: true,
                    pagination: false,
                    rowKey: "index",
                    dataSource: data
                })
            })
        ]
    });
}


/***/ })

};
;