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

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

/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "Z": () => (/* binding */ Head)
/* harmony export */ });
/* 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 next_head__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(40968);
/* harmony import */ var next_head__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(next_head__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var lib_customize__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(400054);
/* harmony import */ var lib_base_path__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(348397);
/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(371017);
/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_3__);




const FAVICON = "/webapp/favicon-32x32.png";

function Head({ title  }) {
    const { siteName  } = (0,lib_customize__WEBPACK_IMPORTED_MODULE_2__/* .useCustomize */ .i)();
    return /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)((next_head__WEBPACK_IMPORTED_MODULE_1___default()), {
        children: [
            /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("title", {
                children: [
                    siteName,
                    " ",
                    siteName ? "–" : "",
                    " ",
                    title
                ]
            }),
            /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("meta", {
                name: "description",
                content: "CoCalc landing pages and documentation"
            }),
            /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("link", {
                rel: "icon",
                href: (0,path__WEBPACK_IMPORTED_MODULE_3__.join)(lib_base_path__WEBPACK_IMPORTED_MODULE_4__/* ["default"] */ .Z ?? "", FAVICON)
            })
        ]
    });
};


/***/ }),

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

/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "Z": () => (/* binding */ Main)
/* harmony export */ });
/* 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
 */ 

const { Content  } = antd__WEBPACK_IMPORTED_MODULE_1__.Layout;
const STYLE = {
    background: "white",
    minHeight: "75vh",
    maxWidth: "992px",
    width: "100%",
    margin: "0 auto",
    padding: "0 20px"
};
function Main(props) {
    const { nav , children  } = props;
    const style = {
        ...STYLE,
        ...props.style
    };
    function renderNav() {
        if (nav == null) return null;
        return /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(antd__WEBPACK_IMPORTED_MODULE_1__.Breadcrumb, {
            style: {
                margin: "50px 0 25px 0"
            },
            children: nav.map((entry, idx)=>/*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(antd__WEBPACK_IMPORTED_MODULE_1__.Breadcrumb.Item, {
                    children: entry
                }, idx))
        });
    }
    return /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(Content, {
        style: style,
        children: [
            renderNav(),
            children
        ]
    });
};


/***/ }),

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

/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "c": () => (/* binding */ ssoNav)
/* harmony export */ });
/* 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 next_link__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(741664);
/* harmony import */ var next_link__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(next_link__WEBPACK_IMPORTED_MODULE_1__);
/*
 *  This file is part of CoCalc: Copyright © 2022 Sagemath, Inc.
 *  License: AGPLv3 s.t. "Commons Clause" – see LICENSE.md for details
 */ 

function ssoNav() {
    return [
        /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx((next_link__WEBPACK_IMPORTED_MODULE_1___default()), {
            href: "/",
            children: "Home"
        }),
        /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx((next_link__WEBPACK_IMPORTED_MODULE_1___default()), {
            href: "/sso",
            children: "Single Sign On"
        }), 
    ];
}


/***/ }),

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

/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "A": () => (/* binding */ getSSO),
/* harmony export */   "e": () => (/* binding */ getOneSSO)
/* harmony export */ });
/* harmony import */ var _cocalc_database_pool__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(17763);
/* harmony import */ var _cocalc_database_pool__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_cocalc_database_pool__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _cocalc_server_auth_sso_get_strategies__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(825556);
/* harmony import */ var _cocalc_server_auth_sso_get_strategies__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_cocalc_server_auth_sso_get_strategies__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _cocalc_util_auth__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(5011);
/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(546517);
/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(lodash__WEBPACK_IMPORTED_MODULE_3__);
/*
 *  This file is part of CoCalc: Copyright © 2022 Sagemath, Inc.
 *  License: AGPLv3 s.t. "Commons Clause" – see LICENSE.md for details
 */ 



const SQL_SELECT = `SELECT strategy, info,
  COALESCE(info -> 'icon',              conf -> 'icon')              as icon,
  COALESCE(info -> 'display',           conf -> 'display')           as display,
  COALESCE(info -> 'exclusive_domains', conf -> 'exclusive_domains') as exclusive_domains`;
function parseRow(row) {
    const { strategy , exclusive_domains , display , info , icon  } = row;
    return {
        id: strategy,
        display: (0,_cocalc_util_auth__WEBPACK_IMPORTED_MODULE_2__.ssoDispayedName)({
            display,
            name: strategy
        }),
        domains: exclusive_domains ?? [],
        descr: info?.description ?? null,
        backgroundColor: _cocalc_server_auth_sso_get_strategies__WEBPACK_IMPORTED_MODULE_1__.COLORS[strategy] ?? "",
        icon
    };
}
async function getSSO() {
    const pool = _cocalc_database_pool__WEBPACK_IMPORTED_MODULE_0___default()("long");
    const { rows  } = await pool.query(`
    ${SQL_SELECT}
    FROM passport_settings
    WHERE coalesce(info -> 'public', conf -> 'public', 'true'::JSONB)::BOOL IS FALSE`);
    const data = rows.map((row)=>parseRow(row));
    return (0,lodash__WEBPACK_IMPORTED_MODULE_3__.sortBy)(data, (sso)=>sso.display);
}
async function getOneSSO(id) {
    const pool = _cocalc_database_pool__WEBPACK_IMPORTED_MODULE_0___default()("long");
    const { rows  } = await pool.query(`${SQL_SELECT}
     FROM passport_settings
     WHERE strategy=$1`, [
        id
    ]);
    if (rows.length === 0) return;
    return parseRow(rows[0]);
}


/***/ }),

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

__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "SSO_SUBTITLE": () => (/* binding */ SSO_SUBTITLE),
/* harmony export */   "default": () => (/* binding */ SignupIndex),
/* harmony export */   "getServerSideProps": () => (/* binding */ getServerSideProps)
/* harmony export */ });
/* 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 _cocalc_util_misc__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(477389);
/* harmony import */ var _cocalc_util_misc__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_cocalc_util_misc__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(545725);
/* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(antd__WEBPACK_IMPORTED_MODULE_2__);
/* harmony import */ var components_auth_sso__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(366009);
/* harmony import */ var components_landing_footer__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(831910);
/* harmony import */ var components_landing_head__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(373306);
/* harmony import */ var components_landing_header__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(131498);
/* harmony import */ var components_landing_main__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(777479);
/* harmony import */ var components_sso__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(769164);
/* harmony import */ var lib_customize__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(400054);
/* harmony import */ var lib_sso_sso__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(325325);
/* harmony import */ var lib_with_customize__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(601880);
/* harmony import */ var next_link__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(741664);
/* harmony import */ var next_link__WEBPACK_IMPORTED_MODULE_12___default = /*#__PURE__*/__webpack_require__.n(next_link__WEBPACK_IMPORTED_MODULE_12__);
/*
 *  This file is part of CoCalc: Copyright © 2022 Sagemath, Inc.
 *  License: AGPLv3 s.t. "Commons Clause" – see LICENSE.md for details
 */ 












const { Paragraph , Text  } = antd__WEBPACK_IMPORTED_MODULE_2__.Typography;
const SSO_SUBTITLE = "Single Sign On";
function SignupIndex(props) {
    const { customize , ssos  } = props;
    function renderDomains(domains) {
        if (domains == null || domains.length === 0) return;
        return /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(Text, {
            type: "secondary",
            children: (0,_cocalc_util_misc__WEBPACK_IMPORTED_MODULE_1__.to_human_list)(domains ?? [])
        });
    }
    function extra(sso) {
        return /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx((next_link__WEBPACK_IMPORTED_MODULE_12___default()), {
            href: `/sso/${sso.id}`,
            children: "more"
        });
    }
    function renderSSOs() {
        return ssos.map((sso)=>{
            const strategy = {
                name: sso.id,
                size: 64,
                backgroundColor: "",
                icon: sso.icon,
                display: sso.display
            };
            return /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(antd__WEBPACK_IMPORTED_MODULE_2__.Col, {
                xs: 12,
                md: 6,
                children: /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(antd__WEBPACK_IMPORTED_MODULE_2__.Card, {
                    size: "small",
                    title: /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(Text, {
                        strong: true,
                        children: sso.display
                    }),
                    extra: extra(sso),
                    children: [
                        /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(Paragraph, {
                            style: {
                                textAlign: "center"
                            },
                            children: /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(components_auth_sso__WEBPACK_IMPORTED_MODULE_3__/* .StrategyAvatar */ .xq, {
                                strategy: strategy,
                                size: 64
                            })
                        }),
                        /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(Paragraph, {
                            style: {
                                textAlign: "center",
                                marginBottom: 0
                            },
                            children: renderDomains(sso.domains)
                        })
                    ]
                })
            }, sso.id);
        });
    }
    function renderSSOList() {
        if (ssos.length === 0) {
            return /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(Text, {
                italic: true,
                type: "danger",
                children: "There are no 3rd party SSO providers available."
            });
        } else {
            return /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(antd__WEBPACK_IMPORTED_MODULE_2__.Row, {
                gutter: [
                    24,
                    24
                ],
                align: "top",
                wrap: true,
                children: renderSSOs()
            });
        }
    }
    function main() {
        return /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.Fragment, {
            children: [
                /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("h1", {
                    children: SSO_SUBTITLE
                }),
                /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(Paragraph, {
                    children: [
                        "Sign up at ",
                        customize.siteName,
                        " via one of these 3",
                        /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("sup", {
                            children: "rd"
                        }),
                        " party single-sign-on mechanisms. You need to have an account at the respective organization in order to complete the sign-up process. Usually, this will be the only way you can sign up using your organization specific email address."
                    ]
                }),
                /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(Paragraph, {
                    children: renderSSOList()
                })
            ]
        });
    }
    return /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(lib_customize__WEBPACK_IMPORTED_MODULE_9__/* .Customize */ .l, {
        value: customize,
        children: [
            /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(components_landing_head__WEBPACK_IMPORTED_MODULE_5__/* ["default"] */ .Z, {
                title: SSO_SUBTITLE
            }),
            /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(antd__WEBPACK_IMPORTED_MODULE_2__.Layout, {
                style: {
                    background: "white"
                },
                children: [
                    /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(components_landing_header__WEBPACK_IMPORTED_MODULE_6__/* ["default"] */ .Z, {}),
                    /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(components_landing_main__WEBPACK_IMPORTED_MODULE_7__/* ["default"] */ .Z, {
                        nav: (0,components_sso__WEBPACK_IMPORTED_MODULE_8__/* .ssoNav */ .c)(),
                        children: main()
                    }),
                    /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(components_landing_footer__WEBPACK_IMPORTED_MODULE_4__/* ["default"] */ .Z, {})
                ]
            })
        ]
    });
};
async function getServerSideProps(context) {
    const ssos = await (0,lib_sso_sso__WEBPACK_IMPORTED_MODULE_10__/* .getSSO */ .A)();
    return await (0,lib_with_customize__WEBPACK_IMPORTED_MODULE_11__/* ["default"] */ .Z)({
        context,
        props: {
            ssos
        }
    });
}


/***/ })

};
;