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

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


var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
    return new (P || (P = Promise))(function (resolve, reject) {
        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
        function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
        step((generator = generator.apply(thisArg, _arguments || [])).next());
    });
};
var __generator = (this && this.__generator) || function (thisArg, body) {
    var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
    return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
    function verb(n) { return function (v) { return step([n, v]); }; }
    function step(op) {
        if (f) throw new TypeError("Generator is already executing.");
        while (_) try {
            if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
            if (y = 0, t) op = [op[0] & 2, t.value];
            switch (op[0]) {
                case 0: case 1: t = op; break;
                case 4: _.label++; return { value: op[1], done: false };
                case 5: _.label++; y = op[1]; op = [0]; continue;
                case 7: op = _.ops.pop(); _.trys.pop(); continue;
                default:
                    if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
                    if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
                    if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
                    if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
                    if (t[2]) _.ops.pop();
                    _.trys.pop(); continue;
            }
            op = body.call(thisArg, _);
        } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
        if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
    }
};
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
var pool_1 = __importDefault(__webpack_require__(541808));
function isAccountAvailable(email_address) {
    return __awaiter(this, void 0, void 0, function () {
        var pool, rows;
        return __generator(this, function (_a) {
            switch (_a.label) {
                case 0:
                    pool = (0, pool_1.default)("medium");
                    return [4 /*yield*/, pool.query("SELECT account_id FROM accounts WHERE email_address=$1", [email_address])];
                case 1:
                    rows = (_a.sent()).rows;
                    return [2 /*return*/, rows.length == 0];
            }
        });
    });
}
exports["default"] = isAccountAvailable;
//# sourceMappingURL=is-account-available.js.map

/***/ }),

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


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 __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
    return new (P || (P = Promise))(function (resolve, reject) {
        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
        function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
        step((generator = generator.apply(thisArg, _arguments || [])).next());
    });
};
var __generator = (this && this.__generator) || function (thisArg, body) {
    var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
    return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
    function verb(n) { return function (v) { return step([n, v]); }; }
    function step(op) {
        if (f) throw new TypeError("Generator is already executing.");
        while (_) try {
            if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
            if (y = 0, t) op = [op[0] & 2, t.value];
            switch (op[0]) {
                case 0: case 1: t = op; break;
                case 4: _.label++; return { value: op[1], done: false };
                case 5: _.label++; y = op[1]; op = [0]; continue;
                case 7: op = _.ops.pop(); _.trys.pop(); continue;
                default:
                    if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
                    if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
                    if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
                    if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
                    if (t[2]) _.ops.pop();
                    _.trys.pop(); continue;
            }
            op = body.call(thisArg, _);
        } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
        if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
    }
};
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.getFooter = void 0;
var settings_1 = __webpack_require__(840336);
var site_url_1 = __importDefault(__webpack_require__(661348));
function getFooter() {
    return __awaiter(this, void 0, void 0, function () {
        var _a, help_email, site_name, organization_name, organization_url, _1, html, text;
        return __generator(this, function (_b) {
            switch (_b.label) {
                case 0: return [4 /*yield*/, (0, settings_1.getServerSettings)()];
                case 1:
                    _a = _b.sent(), help_email = _a.help_email, site_name = _a.site_name, organization_name = _a.organization_name, organization_url = _a.organization_url;
                    // Make sure everything is defined somehow...
                    if (!help_email) {
                        help_email = "help@cocalc.com";
                    }
                    if (!site_name) {
                        site_name = "OpenCoCalc";
                    }
                    if (!organization_name) {
                        organization_name = "Hosted CoCalc";
                    }
                    if (!!organization_url) return [3 /*break*/, 5];
                    _b.label = 2;
                case 2:
                    _b.trys.push([2, 4, , 5]);
                    return [4 /*yield*/, (0, site_url_1.default)()];
                case 3:
                    organization_url = _b.sent();
                    return [3 /*break*/, 5];
                case 4:
                    _1 = _b.sent();
                    organization_url = "https://example.com";
                    return [3 /*break*/, 5];
                case 5:
                    html = "\n<p style=\"margin-top:100px; padding-top:15px; border-top: 1px solid gray; color: gray; font-size:85%; text-align:center\">\nThis email was sent from <a href=\"".concat(organization_url, "\">").concat(site_name, "</a> by ").concat(organization_name, ".\nContact <a href=\"mailto:").concat(help_email, "\">").concat(help_email, "</a> if you have any questions.\n</p>");
                    text = "\n\n\n\n----------------------------------------------------------------------\nThis email was sent from ".concat(site_name, " by ").concat(organization_name, " (see ").concat(organization_url, ").\nContact ").concat(help_email, " if you have any questions.\n");
                    return [2 /*return*/, { html: html, text: text }];
            }
        });
    });
}
exports.getFooter = getFooter;
function appendFooter(message) {
    return __awaiter(this, void 0, void 0, function () {
        var footer, _2;
        return __generator(this, function (_a) {
            switch (_a.label) {
                case 0:
                    _a.trys.push([0, 2, , 3]);
                    return [4 /*yield*/, getFooter()];
                case 1:
                    footer = _a.sent();
                    return [3 /*break*/, 3];
                case 2:
                    _2 = _a.sent();
                    return [2 /*return*/, message];
                case 3: return [2 /*return*/, __assign(__assign({}, message), { html: message.html + "\n\n" + footer.html, text: message.text + "\n\n" + footer.text })];
            }
        });
    });
}
exports["default"] = appendFooter;
//# sourceMappingURL=footer.js.map

/***/ }),

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


/* Returns the configured help email address.
   Cached with "long" TTL so doesn't put load on database
   even if called frequently.
*/
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
    return new (P || (P = Promise))(function (resolve, reject) {
        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
        function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
        step((generator = generator.apply(thisArg, _arguments || [])).next());
    });
};
var __generator = (this && this.__generator) || function (thisArg, body) {
    var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
    return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
    function verb(n) { return function (v) { return step([n, v]); }; }
    function step(op) {
        if (f) throw new TypeError("Generator is already executing.");
        while (_) try {
            if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
            if (y = 0, t) op = [op[0] & 2, t.value];
            switch (op[0]) {
                case 0: case 1: t = op; break;
                case 4: _.label++; return { value: op[1], done: false };
                case 5: _.label++; y = op[1]; op = [0]; continue;
                case 7: op = _.ops.pop(); _.trys.pop(); continue;
                default:
                    if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
                    if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
                    if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
                    if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
                    if (t[2]) _.ops.pop();
                    _.trys.pop(); continue;
            }
            op = body.call(thisArg, _);
        } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
        if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
    }
};
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
var pool_1 = __importDefault(__webpack_require__(541808));
function getHelpEmail() {
    return __awaiter(this, void 0, void 0, function () {
        var pool, rows;
        return __generator(this, function (_a) {
            switch (_a.label) {
                case 0:
                    pool = (0, pool_1.default)("long");
                    return [4 /*yield*/, pool.query("SELECT value FROM server_settings WHERE name='help_email'")];
                case 1:
                    rows = (_a.sent()).rows;
                    if (rows.length == 0 || !rows[0].value) {
                        throw Error("no help email address set");
                    }
                    return [2 /*return*/, rows[0].value];
            }
        });
    });
}
exports["default"] = getHelpEmail;
//# sourceMappingURL=help.js.map

/***/ }),

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


/* We use the official V3 Sendgrid API:

https://www.npmjs.com/package/@sendgrid/mail

The cocalc ASM group numbers are at

https://app.sendgrid.com/suppressions/advanced_suppression_manager
*/
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
    return new (P || (P = Promise))(function (resolve, reject) {
        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
        function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
        step((generator = generator.apply(thisArg, _arguments || [])).next());
    });
};
var __generator = (this && this.__generator) || function (thisArg, body) {
    var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
    return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
    function verb(n) { return function (v) { return step([n, v]); }; }
    function step(op) {
        if (f) throw new TypeError("Generator is already executing.");
        while (_) try {
            if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
            if (y = 0, t) op = [op[0] & 2, t.value];
            switch (op[0]) {
                case 0: case 1: t = op; break;
                case 4: _.label++; return { value: op[1], done: false };
                case 5: _.label++; y = op[1]; op = [0]; continue;
                case 7: op = _.ops.pop(); _.trys.pop(); continue;
                default:
                    if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
                    if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
                    if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
                    if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
                    if (t[2]) _.ops.pop();
                    _.trys.pop(); continue;
            }
            op = body.call(thisArg, _);
        } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
        if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
    }
};
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.getSendgrid = void 0;
var pool_1 = __importDefault(__webpack_require__(541808));
var mail_1 = __importDefault(__webpack_require__(949571));
var help_1 = __importDefault(__webpack_require__(526577));
var footer_1 = __importDefault(__webpack_require__(74895));
var theme_1 = __webpack_require__(981975);
// Init throws error if we can't initialize Sendgrid right now.
// It also updates the key if it changes in at most one minute (?).
var initialized = 0;
function getSendgrid() {
    return __awaiter(this, void 0, void 0, function () {
        var now, pool, rows;
        return __generator(this, function (_a) {
            switch (_a.label) {
                case 0:
                    now = new Date().valueOf();
                    if (now - initialized < 1000 * 30) {
                        // initialized recently
                        return [2 /*return*/, mail_1.default];
                    }
                    pool = (0, pool_1.default)("long");
                    return [4 /*yield*/, pool.query("SELECT value FROM server_settings WHERE name='sendgrid_key'")];
                case 1:
                    rows = (_a.sent()).rows;
                    if (rows.length == 0 || !rows[0].value) {
                        if (initialized) {
                            // no key now, but there was a key before -- so clear it and error
                            mail_1.default.setApiKey("");
                            throw Error("no sendgrid key");
                        }
                    }
                    mail_1.default.setApiKey(rows[0].value);
                    initialized = new Date().valueOf();
                    return [2 /*return*/, mail_1.default];
            }
        });
    });
}
exports.getSendgrid = getSendgrid;
function sendEmail(message) {
    return __awaiter(this, void 0, void 0, function () {
        var sg, msg, _a;
        return __generator(this, function (_b) {
            switch (_b.label) {
                case 0: return [4 /*yield*/, getSendgrid()];
                case 1:
                    sg = _b.sent();
                    return [4 /*yield*/, (0, footer_1.default)(message)];
                case 2:
                    msg = _b.sent();
                    if (!!msg.from) return [3 /*break*/, 4];
                    _a = msg;
                    return [4 /*yield*/, (0, help_1.default)()];
                case 3:
                    _a.from = _b.sent(); // fallback
                    _b.label = 4;
                case 4:
                    if (msg.asm_group) {
                        msg.asm = { group_id: msg.asm_group };
                        delete msg.asm_group;
                    }
                    // plain template with a header (cocalc logo), a h1 title, and a footer
                    msg.template_id = theme_1.SENDGRID_TEMPLATE_ID;
                    // https://docs.sendgrid.com/api-reference/mail-send/mail-send
                    return [4 /*yield*/, sg.send(msg)];
                case 5:
                    // https://docs.sendgrid.com/api-reference/mail-send/mail-send
                    _b.sent();
                    return [2 /*return*/];
            }
        });
    });
}
exports["default"] = sendEmail;
//# sourceMappingURL=sendgrid.js.map

/***/ }),

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


/*
 *  This file is part of CoCalc: Copyright © 2021 Sagemath, Inc.
 *  License: AGPLv3 s.t. "Commons Clause" – see LICENSE.md for details
 */
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
    return new (P || (P = Promise))(function (resolve, reject) {
        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
        function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
        step((generator = generator.apply(thisArg, _arguments || [])).next());
    });
};
var __generator = (this && this.__generator) || function (thisArg, body) {
    var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
    return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
    function verb(n) { return function (v) { return step([n, v]); }; }
    function step(op) {
        if (f) throw new TypeError("Generator is already executing.");
        while (_) try {
            if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
            if (y = 0, t) op = [op[0] & 2, t.value];
            switch (op[0]) {
                case 0: case 1: t = op; break;
                case 4: _.label++; return { value: op[1], done: false };
                case 5: _.label++; y = op[1]; op = [0]; continue;
                case 7: op = _.ops.pop(); _.trys.pop(); continue;
                default:
                    if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
                    if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
                    if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
                    if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
                    if (t[2]) _.ops.pop();
                    _.trys.pop(); continue;
            }
            op = body.call(thisArg, _);
        } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
        if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
    }
};
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
var nodemailer_1 = __webpack_require__(765909);
var help_1 = __importDefault(__webpack_require__(526577));
var footer_1 = __importDefault(__webpack_require__(74895));
var server_settings_1 = __webpack_require__(526177);
function sendEmail(message, type) {
    if (type === void 0) { type = "email"; }
    return __awaiter(this, void 0, void 0, function () {
        var settings, err_1, _a, server, msg;
        return __generator(this, function (_b) {
            switch (_b.label) {
                case 0:
                    _b.trys.push([0, 2, , 3]);
                    return [4 /*yield*/, getSMTPSettings(type)];
                case 1:
                    settings = _b.sent();
                    return [3 /*break*/, 3];
                case 2:
                    err_1 = _b.sent();
                    throw Error("SMTP ".concat(type, " is not properly configured for this server. Contact the site administrator. -- ").concat(err_1));
                case 3:
                    if (!!message.from) return [3 /*break*/, 6];
                    if (!settings.from) return [3 /*break*/, 4];
                    message.from = settings.from;
                    return [3 /*break*/, 6];
                case 4:
                    _a = message;
                    return [4 /*yield*/, (0, help_1.default)()];
                case 5:
                    _a.from = _b.sent(); // fallback
                    _b.label = 6;
                case 6: return [4 /*yield*/, getServer(settings)];
                case 7:
                    server = _b.sent();
                    return [4 /*yield*/, (0, footer_1.default)(message)];
                case 8:
                    msg = _b.sent();
                    return [4 /*yield*/, server.sendMail(msg)];
                case 9:
                    _b.sent();
                    return [2 /*return*/];
            }
        });
    });
}
exports["default"] = sendEmail;
var server = undefined;
var cacheSettings = ""; // what settings were used to compute cached server.
function getServer(settings) {
    return __awaiter(this, void 0, void 0, function () {
        var s;
        return __generator(this, function (_a) {
            switch (_a.label) {
                case 0:
                    s = JSON.stringify(settings);
                    if (server !== undefined && s == cacheSettings)
                        return [2 /*return*/, server];
                    return [4 /*yield*/, (0, nodemailer_1.createTransport)({
                            host: settings.server,
                            port: settings.port,
                            secure: settings.secure,
                            auth: {
                                user: settings.login,
                                pass: settings.password,
                            },
                        })];
                case 1:
                    server = _a.sent();
                    cacheSettings = s;
                    return [2 /*return*/, server];
            }
        });
    });
}
/**
 * Depending on if this is for regular emails or password resets,
 * we return the SMTP settings depending on the server settings.
 * Usually, password reset and regular email settings are the same for SMTP.
 * Only exception is when that override entry is set to smtp, then use the
 * secondary SMTP configuartion.
 */
function getEmailServerSettings(type) {
    return __awaiter(this, void 0, void 0, function () {
        var settings, defaultSMTP;
        return __generator(this, function (_a) {
            switch (_a.label) {
                case 0: return [4 /*yield*/, (0, server_settings_1.getServerSettings)()];
                case 1:
                    settings = _a.sent();
                    defaultSMTP = {
                        server: settings.email_smtp_server,
                        login: settings.email_smtp_login,
                        password: settings.email_smtp_password,
                        secure: settings.email_smtp_secure,
                        from: settings.email_smtp_from,
                        port: settings.email_smtp_port,
                    };
                    if (type == "email") {
                        return [2 /*return*/, defaultSMTP];
                    }
                    switch (settings.password_reset_override) {
                        case "default":
                            return [2 /*return*/, defaultSMTP];
                        case "smtp":
                            return [2 /*return*/, {
                                    server: settings.password_reset_smtp_server,
                                    login: settings.password_reset_smtp_login,
                                    password: settings.password_reset_smtp_password,
                                    secure: settings.password_reset_smtp_secure,
                                    from: settings.password_reset_smtp_from,
                                    port: settings.password_reset_smtp_port,
                                }];
                    }
                    throw new Error("unexpected password_reset_override: ".concat(settings.password_reset_override));
            }
        });
    });
}
function getSMTPSettings(type) {
    return __awaiter(this, void 0, void 0, function () {
        var settings;
        return __generator(this, function (_a) {
            switch (_a.label) {
                case 0:
                    if (type != "email" && type != "password_reset") {
                        throw Error("type must be 'email' or 'password_reset'");
                    }
                    return [4 /*yield*/, getEmailServerSettings(type)];
                case 1:
                    settings = _a.sent();
                    if (!settings.server) {
                        throw Error("SMTP ".concat(type, " server must be configured"));
                    }
                    if (!settings.login) {
                        throw Error("SMTP ".concat(type, " username must be configured"));
                    }
                    if (!settings.password) {
                        throw Error("SMTP ".concat(type, " password must be configured"));
                    }
                    return [2 /*return*/, settings];
            }
        });
    });
}
//# sourceMappingURL=smtp.js.map

/***/ }),

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


Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.getServerSettings = void 0;
var server_settings_1 = __webpack_require__(526177);
Object.defineProperty(exports, "getServerSettings", ({ enumerable: true, get: function () { return server_settings_1.getServerSettings; } }));
//# sourceMappingURL=index.js.map

/***/ }),

/***/ 981975:
/***/ (function(__unused_webpack_module, exports) {


/*
 *  This file is part of CoCalc: Copyright © 2020 Sagemath, Inc.
 *  License: AGPLv3 s.t. "Commons Clause" – see LICENSE.md for details
 */
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);
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.COLORS = exports.DISCORD_INVITE = exports.SENDGRID_ASM_NEWSLETTER = exports.SENDGRID_ASM_INVITES = exports.SENDGRID_TEMPLATE_ID = exports.JUPYTER_CLASSIC_MODERN = exports.conversion_id = exports.sign_up_id = exports.gtag_id = exports.COPYRIGHT_AGENT_HTML = exports.BILLING_TAXID = exports.BILLING_ADDRESS = exports.BILLING_EMAIL = exports.TWITTER_HANDLE = exports.HELP_EMAIL = exports.LIVE_DEMO_REQUEST = exports.BLOG_URL = exports.DOC_URL = exports.DISCUSSION_GROUP = exports.DOMAIN_URL = exports.DNS = exports.APP_TAGLINE = exports.COMPANY_EMAIL = exports.COMPANY_NAME = exports.SITE_NAME = void 0;
/*
Theme configuration file for CoCalc

Copyright 2017, SageMath, Inc. -- ALL RIGHTS RESERVED

This file is not part of the open-source licensed release, because it contains information
specific to the company "SageMath, Inc." and the product "CoCalc".
Upon deployment, please replace this file with a suitable replacement (i.e. come up with your own name, etc.)

This is used mainly in the front-end, but some aspects are also used on the back-end
*/
exports.SITE_NAME = "CoCalc";
exports.COMPANY_NAME = "SageMath, Inc.";
exports.COMPANY_EMAIL = "office@sagemath.com";
exports.APP_TAGLINE = "Collaborative Calculation";
exports.DNS = "cocalc.com";
exports.DOMAIN_URL = "https://".concat(exports.DNS);
exports.DISCUSSION_GROUP = "https://groups.google.com/forum/#!forum/cocalc";
exports.DOC_URL = "https://doc.cocalc.com/";
exports.BLOG_URL = "https://blog.sagemath.com/";
exports.LIVE_DEMO_REQUEST = "https://docs.google.com/forms/d/e/1FAIpQLSesDZkGD2XVu8BHKd_sPwn5g7MrLAA8EYRTpB6daedGVMTpkA/viewform";
exports.HELP_EMAIL = "help@cocalc.com";
exports.TWITTER_HANDLE = "cocalc_com"; // without the @
exports.BILLING_EMAIL = "billing@sagemath.com";
exports.BILLING_ADDRESS = "17725 SE 123RD PL\nRenton, WA 98059-6621\nUSA";
exports.BILLING_TAXID = "TAX EIN: 47-3015407";
exports.COPYRIGHT_AGENT_HTML = "William Stein (Copyright Agent)<br>\nc/o SageMath, Inc.<br>\n17725 SE 123RD PL<br>\nRenton, WA 98059-6621<br>\nUSA<br>\n<a href='mailto:copyright@sagemath.com'>copyright@sagemath.com</a>";
// for conversion tracking (commercial only)
exports.gtag_id = "AW-943259268";
exports.sign_up_id = "44ZfCImosncQhP3jwQM";
exports.conversion_id = "zttYCNDZsXcQhP3jwQM";
// documentation
exports.JUPYTER_CLASSIC_MODERN = "https://doc.cocalc.com/jupyter.html#classical-versus-cocalc";
// this is used in packages/hub/email.coffee and hub.coffee to specify the template and ASM groups for sendgrid
exports.SENDGRID_TEMPLATE_ID = "0375d02c-945f-4415-a611-7dc3411e2a78";
// asm_group: 699 is for invites https://app.sendgrid.com/suppressions/advanced_suppression_manager
exports.SENDGRID_ASM_INVITES = 699;
exports.SENDGRID_ASM_NEWSLETTER = 698;
exports.DISCORD_INVITE = "https://discord.gg/nEHs2GK";
// This is the applications color scheme
var MAIN_COLORS = {
    BLUE_DDD: "#0E2B59",
    BLUE_DD: "#2A5AA6",
    BLUE_D: "#4474c0",
    BLUE: "#6690D2",
    BLUE_L: "#80afff",
    BLUE_LL: "#94B3E5",
    BLUE_LLL: "#c7d9f5",
    BLUE_DOC: "#4375c1",
    BRWN: "#593E05",
    YELL_D: "#bf7b00",
    YELL_L: "#fbb635",
    GRAY_DDD: "#dddddd",
    GRAY_DD: "#303030",
    GRAY_D: "#434343",
    GRAY_M: "#5f5f5f",
    GRAY: "#808080",
    GRAY_L: "#c0c0c0",
    GRAY_L0: "#e0e0e0",
    GRAY_LL: "#eeeeee",
    GRAY_LLL: "#f5f5f5",
    // bootstrap 3 colors
    BS_GREEN_BGRND: "rgb(92,184,92)",
    BS_BLUE_BGRND: "rgb(66, 139, 202)",
    BS_BLUE_TEXT: "rgb(33, 150, 243)",
    BS_GREEN_LL: "#E8F5E9",
    BS_GREEN: "#5CB85C",
    BS_GREEN_D: "#449d44",
    BS_GREEN_DD: "#398439",
    BS_RED: "#dc3545",
    // These were inexplicably in app-framework.ts, so I moved them here.
    BG_RED: "#d9534f",
    FG_RED: "#c9302c",
    FG_BLUE: "#428bca",
    ATND_BG_RED_M: "#ff7875",
    ATND_BG_RED_L: "#fff2f0",
    ANTD_BG_BLUE_L: "#e6f4ff",
    ANTD_RED_WARN: "#f5222d",
    ANTD_YELL_M: "#fadb14",
    ANTD_RED: "#f5222d",
    ANTD_ORANGE: "#ffbb96",
    ANTD_GREEN: "#87d068",
    ANTD_GREEN_D: "#237804",
    COCALC_BLUE: "#4474c0",
    COCALC_ORANGE: "#fcc861", // orange used for the logo
};
exports.COLORS = __assign(__assign({}, MAIN_COLORS), { 
    // The definitions below add semantic meaning by using the colors
    // navigation bar at the top
    TOP_BAR: {
        BG: MAIN_COLORS.GRAY_LL,
        HOVER: MAIN_COLORS.GRAY_LLL,
        ACTIVE: "white",
        TEXT: MAIN_COLORS.GRAY,
        TEXT_ACTIVE: MAIN_COLORS.GRAY_D,
        X: MAIN_COLORS.GRAY,
        X_HOVER: MAIN_COLORS.GRAY_L,
        SIGN_IN_BG: MAIN_COLORS.YELL_L,
    }, 
    // landing page
    LANDING: { LOGIN_BAR_BG: MAIN_COLORS.BLUE_D } });
//# sourceMappingURL=theme.js.map

/***/ })

};
;