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

/***/ 838176:
/***/ ((__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
 */
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.macros = void 0;
// get these from sage/misc/latex.py
// This same info is **also** embedded in packages/util/mathjax-config.js
exports.macros = {
    "\\Bold": "\\mathbb{#1}",
    "\\ZZ": "\\Bold{Z}",
    "\\NN": "\\Bold{N}",
    "\\RR": "\\Bold{R}",
    "\\CC": "\\Bold{C}",
    "\\FF": "\\Bold{F}",
    "\\QQ": "\\Bold{Q}",
    "\\QQbar": "\\overline{\\QQ}",
    "\\CDF": "\\Bold{C}",
    "\\CIF": "\\Bold{C}",
    "\\CLF": "\\Bold{C}",
    "\\RDF": "\\Bold{R}",
    "\\RIF": "\\Bold{I} \\Bold{R}",
    "\\RLF": "\\Bold{R}",
    "\\CFF": "\\Bold{CFF}",
    "\\GF": "\\Bold{F}_{#1}",
    "\\Zp": "\\ZZ_{#1}",
    "\\Qp": "\\QQ_{#1}",
    "\\Zmod": "\\ZZ/#1\\ZZ",
};
//# sourceMappingURL=math-katex.js.map

/***/ }),

/***/ 749924:
/***/ (function(__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
 */
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.latexMathToHtmlOrError = exports.latexMathToHtml = void 0;
var math_katex_1 = __webpack_require__(838176);
var katex_1 = __importDefault(__webpack_require__(775654));
function mathToHtml(math, // latex expression
isInline, _ignore // used internally to avoid infinite recursion.
) {
    if (_ignore === void 0) { _ignore = undefined; }
    if (!math.trim()) {
        // don't let it be empty, since then it is not possible to see/select.
        math = "\\LaTeX";
    }
    var err = undefined;
    var html = undefined;
    try {
        html = katex_1.default.renderToString(math, {
            displayMode: !isInline,
            macros: math_katex_1.macros,
            globalGroup: true, // See https://github.com/sagemathinc/cocalc/issues/5750
        });
    }
    catch (error) {
        // If you are working interactively, e.g., in a notebook or md file, you might change a macro
        // you have already defined.  Unfortunately, katex/latex assumes you're processing the whole document
        // top to bottom from a clean slate every time.  For iterative work that makes no sense.  Thus we
        // automate changing newcommand into renewcommand, as needed, with an escape hatch to avoid an
        // infinite loop.  NOTE: if you redefine a macro, all other formulas that depend on it do not automatically
        // get rerendered, so you do have to edit them slightly or close/open the document to see the changes.
        // But at least this is a good first step.  Also, with this approach you still do see an error if
        // try to define something like \lt that is built in!  There you should use \renewcommand explicitly.
        // Parsing this also helps with opening files in separate tabs, where the same macros get defined.
        err = error.toString();
        if (err === null || err === void 0 ? void 0 : err.endsWith("use \\renewcommand")) {
            var i = err.indexOf("redefine ");
            var j = err.lastIndexOf(";");
            var name_1 = err.slice(i + "redefine ".length, j);
            if (!(_ignore === null || _ignore === void 0 ? void 0 : _ignore.has(name_1)) && math_katex_1.macros[name_1] != null) {
                math = math.replace("\\newcommand{" + name_1, "\\renewcommand{" + name_1);
                return mathToHtml(math, isInline, _ignore != null ? _ignore.add(name_1) : new Set([name_1]));
            }
        }
    }
    return { __html: html !== null && html !== void 0 ? html : "", err: err };
}
exports["default"] = mathToHtml;
function latexMathToHtml(s) {
    var _a = s.startsWith("$$")
        ? mathToHtml(s.slice(2, s.length - 2), false)
        : s.startsWith("$")
            ? mathToHtml(s.slice(1, s.length - 1), true)
            : mathToHtml(s, false), __html = _a.__html, err = _a.err;
    if (err) {
        return "<span style=\"color:#ff6666\">".concat(err, "</span>");
    }
    else {
        return __html;
    }
}
exports.latexMathToHtml = latexMathToHtml;
function latexMathToHtmlOrError(s) {
    return s.startsWith("$$")
        ? mathToHtml(s.slice(2, s.length - 2), false)
        : s.startsWith("$")
            ? mathToHtml(s.slice(1, s.length - 1), true)
            : mathToHtml(s, false);
}
exports.latexMathToHtmlOrError = latexMathToHtmlOrError;
//# sourceMappingURL=math-to-html.js.map

/***/ })

};
;