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

/***/ 728351:
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {


/*
 *  This file is part of CoCalc: Copyright © 2022 Sagemath, Inc.
 *  License: AGPLv3 s.t. "Commons Clause" – see LICENSE.md for details
 */
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.COLORS = void 0;
const pool_1 = __importDefault(__webpack_require__(541808));
const auth_1 = __webpack_require__(440253);
/** Returns an array of public info about strategies.
 * Cached a bit so safe to call a lot.
 */
async function getStrategies() {
    const pool = (0, pool_1.default)("long");
    // entries in "conf" were used before the "info" col existed. this is only for backwards compatibility.
    const { rows } = await pool.query(`
    SELECT strategy,
           COALESCE(info -> 'icon',              conf -> 'icon')              as icon,
           COALESCE(info -> 'display',           conf -> 'display')           as display,
           COALESCE(info -> 'public',            conf -> 'public')            as public,
           COALESCE(info -> 'exclusive_domains', conf -> 'exclusive_domains') as exclusive_domains,
           COALESCE(info -> 'do_not_hide',      'false'::JSONB)               as do_not_hide

    FROM passport_settings
    WHERE strategy != 'site_conf'
      AND COALESCE(info ->> 'disabled', conf ->> 'disabled', 'false') != 'true'`);
    return rows.map((row) => {
        const display = (0, auth_1.ssoDispayedName)({
            display: row.display,
            name: row.strategy,
        });
        return {
            name: row.strategy,
            display,
            icon: row.icon,
            backgroundColor: exports.COLORS[row.strategy] ?? "",
            public: row.public ?? true,
            exclusiveDomains: row.exclusive_domains ?? [],
            doNotHide: row.do_not_hide ?? false,
        };
    });
}
exports["default"] = getStrategies;
exports.COLORS = {
    github: "#000000",
    facebook: "#428bca",
    google: "#dc4857",
    twitter: "#55acee",
};
//# sourceMappingURL=get-strategies.js.map

/***/ }),

/***/ 440253:
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {


/*
 *  This file is part of CoCalc: Copyright © 2020 Sagemath, Inc.
 *  License: AGPLv3 s.t. "Commons Clause" – see LICENSE.md for details
 */
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.ssoDispayedName = void 0;
// Authentication and SSO related utility functions or data shared between all packages
const misc_1 = __webpack_require__(854006);
function ssoDispayedName({ display, name, // name of strategy
 }) {
    return display ?? (name === "github" ? "GitHub" : (0, misc_1.capitalize)(name));
}
exports.ssoDispayedName = ssoDispayedName;
//# sourceMappingURL=auth.js.map

/***/ })

};
;