master-degree-notes/.obsidian/plugins/mathlive-in-editor-mode/main.js

16116 lines
932 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/*
THIS IS A GENERATED/BUNDLED FILE BY ESBUILD
if you want to view the source, please visit the github repository of this plugin
*/
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to2, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to2, key) && key !== except)
__defProp(to2, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to2;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
// src/main.ts
var main_exports = {};
__export(main_exports, {
default: () => MathLiveInEditorMode
});
module.exports = __toCommonJS(main_exports);
var import_obsidian2 = require("obsidian");
// src/mathlive-plugin.ts
var import_language = require("@codemirror/language");
var import_state = require("@codemirror/state");
var import_view2 = require("@codemirror/view");
// src/mathlive-widget.ts
var import_view = require("@codemirror/view");
var MathLiveWidget = class extends import_view.WidgetType {
constructor(config, equation, settings, isInline) {
super();
this.config = config;
this.equation = equation;
this.settings = settings;
this.isInline = isInline;
}
toDOM(view) {
const div = document.createElement("div");
const mfe = document.createElement("math-field");
div.appendChild(mfe);
div.addClass("obsidian-mathlive-codemirror-wrapper");
mfe.addClass("obsidian-mathlive-codemirror-math-field");
mfe.setValue(this.equation);
mfe.dataset.from = `${this.config.from}`;
mfe.dataset.to = `${this.config.to}`;
this.style(mfe, div);
mfe.addEventListener("input", (ev) => {
const target = ev.target;
if (this.equation !== target.value) {
if (mfe.dataset.from !== void 0 && mfe.dataset.to !== void 0) {
view.dispatch({
changes: {
from: parseInt(mfe.dataset.from),
to: parseInt(mfe.dataset.to),
insert: mfe.value
}
});
this.equation = mfe.value;
}
}
});
return div;
}
updateDOM(dom, view) {
const mfe = dom.getElementsByTagName(
"math-field"
)[0];
this.style(mfe, dom);
mfe.dataset.from = `${this.config.from}`;
mfe.dataset.to = `${this.config.to}`;
mfe.setValue(this.equation);
return true;
}
destroy(dom) {
}
style(mfe, div) {
if (this.settings.display) {
div.removeClass("hidden");
if (this.isInline) {
div.addClass("inline");
this.changeCSSClass(this.settings.inlineDisplay, div, "hidden");
this.changeCSSClass(
this.settings.inlineKeyboardIcon,
mfe,
"hide-keyboard"
);
this.changeCSSClass(
this.settings.inlineMenuIcon,
mfe,
"hide-menu"
);
} else {
div.removeClass("inline");
this.changeCSSClass(this.settings.blockDisplay, div, "hidden");
this.changeCSSClass(
this.settings.blockKeyboardIcon,
mfe,
"hide-keyboard"
);
this.changeCSSClass(
this.settings.blockMenuIcon,
mfe,
"hide-menu"
);
}
} else {
div.addClass("hidden");
}
}
changeCSSClass(c, elem, className) {
if (c) {
elem.removeClass(className);
} else {
elem.addClass(className);
}
}
};
// src/mathlive-plugin.ts
var mathliveListFieldWrapper = (settings) => {
const mathliveListField = import_state.StateField.define({
create(state) {
return import_view2.Decoration.none;
},
update(oldState, transaction) {
const builder = new import_state.RangeSetBuilder();
let begin = -1, end = -1, isInline = false;
(0, import_language.syntaxTree)(transaction.state).iterate({
enter(node) {
if (node.type.name.contains("formatting-math-begin")) {
if (node.type.name.contains("math-block"))
begin = node.from + 2;
else {
begin = node.from + 1;
isInline = true;
}
}
if (node.type.name.contains("formatting-math-end") && begin !== -1) {
end = node.from;
if (!isInline) {
builder.add(
end + 2,
end + 2,
import_view2.Decoration.widget({
widget: new MathLiveWidget(
{ from: begin, to: end },
transaction.state.sliceDoc(begin, end),
settings,
isInline
),
block: true,
side: 10
})
);
} else {
if (settings.inlineDisplay)
builder.add(
end + 1,
end + 1,
import_view2.Decoration.replace({
widget: new MathLiveWidget(
{ from: begin, to: end },
transaction.state.sliceDoc(
begin,
end
),
settings,
isInline
)
})
);
}
begin = end = -1;
isInline = false;
}
}
});
return builder.finish();
},
provide(field) {
return import_view2.EditorView.decorations.from(field);
}
});
return mathliveListField;
};
// node_modules/mathlive/dist/mathlive.min.mjs
var jp = Object.defineProperty;
var Xp = Object.defineProperties;
var Zp = Object.getOwnPropertyDescriptors;
var fo = Object.getOwnPropertySymbols;
var Mc = Object.prototype.hasOwnProperty;
var wc = Object.prototype.propertyIsEnumerable;
var _c = (t37, e, r) => e in t37 ? jp(t37, e, { enumerable: true, configurable: true, writable: true, value: r }) : t37[e] = r;
var p = (t37, e) => {
for (var r in e || (e = {}))
Mc.call(e, r) && _c(t37, r, e[r]);
if (fo)
for (var r of fo(e))
wc.call(e, r) && _c(t37, r, e[r]);
return t37;
};
var g = (t37, e) => Xp(t37, Zp(e));
var bs = (t37) => typeof t37 == "symbol" ? t37 : t37 + "";
var fi = (t37, e) => {
var r = {};
for (var i in t37)
Mc.call(t37, i) && e.indexOf(i) < 0 && (r[i] = t37[i]);
if (t37 != null && fo)
for (var i of fo(t37))
e.indexOf(i) < 0 && wc.call(t37, i) && (r[i] = t37[i]);
return r;
};
function X(t37) {
return Array.isArray(t37);
}
var kc = { en: { "keyboard.tooltip.symbols": "Symbols", "keyboard.tooltip.greek": "Greek Letters", "keyboard.tooltip.numeric": "Numeric", "keyboard.tooltip.alphabetic": "Roman Letters", "tooltip.copy to clipboard": "Copy to Clipboard", "tooltip.cut to clipboard": "Cut to Clipboard", "tooltip.paste from clipboard": "Paste from Clipboard", "tooltip.redo": "Redo", "tooltip.toggle virtual keyboard": "Toggle Virtual Keyboard", "tooltip.menu": "Menu", "tooltip.undo": "Undo", "menu.borders": "Borders", "menu.insert matrix": "Insert Matrix", "menu.array.add row above": "Add Row Before", "menu.array.add row below": "Add Row After", "menu.array.add column after": "Add Column After", "menu.array.add column before": "Add Column Before", "menu.array.delete row": "Delete Row", "menu.array.delete rows": "Delete Selected Rows", "menu.array.delete column": "Delete Column", "menu.array.delete columns": "Delete Selected Columns", "menu.mode": "Mode", "menu.mode-math": "Math", "menu.mode-text": "Text", "menu.mode-latex": "LaTeX", "tooltip.blackboard": "Blackboard", "tooltip.bold": "Bold", "tooltip.italic": "Italic", "tooltip.fraktur": "Fraktur", "tooltip.script": "Script", "tooltip.caligraphic": "Caligraphic", "tooltip.typewriter": "Typewriter", "tooltip.roman-upright": "Roman Upright", "tooltip.row-by-col": "%@ \xD7 %@", "menu.font-style": "Font Style", "menu.accent": "Accent", "menu.decoration": "Decoration", "menu.color": "Color", "menu.background-color": "Background", "menu.evaluate": "Evaluate", "menu.simplify": "Simplify", "menu.solve": "Solve", "menu.solve-for": "Solve for %@", "menu.cut": "Cut", "menu.copy": "Copy", "menu.copy-as-latex": "Copy as LaTeX", "menu.copy-as-ascii-math": "Copy as ASCII Math", "menu.copy-as-mathml": "Copy as MathML", "menu.paste": "Paste", "menu.select-all": "Select All", "color.red": "Red", "color.orange": "Orange", "color.yellow": "Yellow", "color.lime": "Lime", "color.green": "Green", "color.teal": "Teal", "color.cyan": "Cyan", "color.blue": "Blue", "color.indigo": "Indigo", "color.purple": "Purple", "color.magenta": "Magenta", "color.black": "Black", "color.dark-grey": "Dark Grey", "color.grey": "Grey", "color.light-grey": "Light Grey", "color.white": "White" }, ar: { "keyboard.tooltip.symbols": "\u062D\u0631\u0641 \u0627\u0648 \u0631\u0645\u0632", "keyboard.tooltip.greek": "\u062D\u0631\u0648\u0641 \u064A\u0648\u0646\u0627\u0646\u064A\u0629", "keyboard.tooltip.numeric": "\u0627\u0644\u0631\u0642\u0645\u064A\u0629", "keyboard.tooltip.alphabetic": "\u0631\u0645\u0648\u0632 \u0627\u0644\u0627\u062D\u0631\u0641 \u0627\u0644\u0631\u0648\u0645\u0627\u0646\u064A\u0629", "tooltip.copy to clipboard": "\u0646\u0633\u062E \u0625\u0644\u0649 \u0627\u0644\u062D\u0627\u0641\u0638\u0629", "tooltip.cut to clipboard": "\u0642\u0635 \u0625\u0644\u0649 \u0627\u0644\u062D\u0627\u0641\u0638\u0629", "tooltip.paste from clipboard": "\u0644\u0635\u0642 \u0645\u0646 \u0627\u0644\u062D\u0627\u0641\u0638\u0629", "tooltip.redo": "\u0627\u0644\u0625\u0639\u0627\u062F\u0629", "tooltip.toggle virtual keyboard": "\u062A\u0628\u062F\u064A\u0644 \u0644\u0648\u062D\u0629 \u0627\u0644\u0645\u0641\u0627\u062A\u064A\u062D \u0627\u0644\u0625\u0641\u062A\u0631\u0627\u0636\u064A\u0629", "tooltip.undo": "\u0625\u0644\u063A\u0627\u0621", "menu.insert matrix": "\u0623\u062F\u062E\u0644 \u0627\u0644\u0645\u0635\u0641\u0648\u0641\u0629", "menu.borders": "\u0645\u062D\u062F\u062F\u0627\u062A \u0627\u0644\u0645\u0635\u0641\u0648\u0641\u0629", "menu.array.add row above": "\u0623\u0636\u0641 \u0635\u0641\u064B\u0627 \u0628\u0639\u062F \u0630\u0644\u0643", "menu.array.add row below": "\u0623\u0636\u0641 \u0627\u0644\u0635\u0641 \u0642\u0628\u0644", "menu.array.add column after": "\u0623\u0636\u0641 \u0627\u0644\u0639\u0645\u0648\u062F \u0628\u0639\u062F \u0630\u0644\u0643", "menu.array.add column before": "\u0623\u0636\u0641 \u0627\u0644\u0639\u0645\u0648\u062F \u0642\u0628\u0644", "menu.array.delete row": "\u0627\u062D\u0630\u0641 \u0635\u0641", "menu.array.delete rows": "\u062D\u0630\u0641 \u0627\u0644\u0635\u0641\u0648\u0641 \u0627\u0644\u0645\u062D\u062F\u062F\u0629", "menu.array.delete column": "\u062D\u0630\u0641 \u0627\u0644\u0639\u0645\u0648\u062F", "menu.array.delete columns": "\u062D\u0630\u0641 \u0627\u0644\u0623\u0639\u0645\u062F\u0629 \u0627\u0644\u0645\u062D\u062F\u062F\u0629", "menu.mode": "\u0648\u0636\u0639", "menu.mode-math": "\u0631\u064A\u0627\u0636\u064A\u0627\u062A", "menu.mode-text": "\u0646\u0635", "menu.mode-latex": "\u0644\u0627\u062A\u0643\u0633", "tooltip.blackboard": "\u0633\u0628\u0648\u0631\u0629", "tooltip.bold": "\u0639\u0631\u064A\u0636", "tooltip.italic": "\u0645\u0627\u0626\u0644", "tooltip.fraktur": "\u0641\u0631\u0627\u0643\u062A\u0648\u0631", "tooltip.script": "\u0633\u0643\u0631\u064A\u0628\u062A", "tooltip.caligraphic": "\u0643\u0627\u0644\u064A\u062C\u0631\u0627\u0641\u064A\u0643", "tooltip.typewriter": "\u0622\u0644\u0629 \u0643\u0627\u062A\u0628\u0629", "tooltip.roman-upright": "\u0631\u0648\u0645\u0627\u0646\u064A \u0645\u0633\u062A\u0642\u064A\u0645", "tooltip.row-by-col": "%@ \xD7 %@", "menu.font-style": "\u0646\u0645\u0637 \u0627\u0644\u062E\u0637", "menu.accent": "\u062A\u0634\u0643\u064A\u0644", "menu.decoration": "\u0632\u062E\u0631\u0641\u0629", "menu.color": "\u0644\u0648\u0646", "menu.background-color": "\u0627\u0644\u062E\u0644\u0641\u064A\u0629", "menu.evaluate": "\u062A\u0642\u064A\u064A\u0645", "menu.simplify": "\u062A\u0628\u0633\u064A\u0637", "menu.solve": "\u062D\u0644", "menu.solve-for": "\u062D\u0644 \u0644\u0640 %@", "menu.cut": "\u0642\u0635", "menu.copy": "\u0646\u0633\u062E", "menu.copy-as-latex": "\u0646\u0633\u062E \u0643\u0640 LaTeX", "menu.copy-as-ascii-math": "\u0646\u0633\u062E \u0643\u0640 ASCII Math", "menu.copy-as-mathml": "\u0646\u0633\u062E \u0643\u0640 MathML", "menu.paste": "\u0644\u0635\u0642", "menu.select-all": "\u062A\u062D\u062F\u064A\u062F \u0627\u0644\u0643\u0644", "color.red": "\u0623\u062D\u0645\u0631", "color.orange": "\u0628\u0631\u062A\u0642\u0627\u0644\u064A", "color.yellow": "\u0623\u0635\u0641\u0631", "color.lime": "\u0644\u064A\u0645\u0648\u0646\u064A", "color.green": "\u0623\u062E\u0636\u0631", "color.teal": "\u0633\u0645\u0627\u0648\u064A", "color.cyan": "\u0633\u0645\u0627\u0648\u064A \u0641\u0627\u062A\u062D", "color.blue": "\u0623\u0632\u0631\u0642", "color.indigo": "\u0646\u064A\u0644\u064A", "color.purple": "\u0628\u0646\u0641\u0633\u062C\u064A", "color.magenta": "\u0623\u0631\u062C\u0648\u0627\u0646\u064A", "color.black": "\u0623\u0633\u0648\u062F", "color.dark-grey": "\u0631\u0645\u0627\u062F\u064A \u063A\u0627\u0645\u0642", "color.grey": "\u0631\u0645\u0627\u062F\u064A", "color.light-grey": "\u0631\u0645\u0627\u062F\u064A \u0641\u0627\u062A\u062D", "color.white": "\u0623\u0628\u064A\u0636" }, de: { "keyboard.tooltip.symbols": "Symbole", "keyboard.tooltip.greek": "Griechische Buchstaben", "keyboard.tooltip.numeric": "Numerisch", "keyboard.tooltip.alphabetic": "R\xF6mische Buchstaben", "tooltip.copy to clipboard": "In die Zwischenablage kopieren", "tooltip.redo": "Wiederholen", "tooltip.toggle virtual keyboard": "Virtuelle Tastatur umschalten", "tooltip.undo": "Widerrufen", "menu.insert matrix": "Matrix einf\xFCgen", "menu.borders": "Matrixtrennzeichen", "menu.array.add row above": "Zeile hinzuf\xFCgen nach", "menu.array.add row below": "Zeile hinzuf\xFCgen vor", "menu.array.add column after": "Spalte hinzuf\xFCgen nach", "menu.array.add column before": "Spalte hinzuf\xFCgen vor", "menu.array.delete row": "Zeile l\xF6schen", "menu.array.delete rows": "Ausgew\xE4hlte Zeilen l\xF6schen", "menu.array.delete column": "Spalte l\xF6schen", "menu.array.delete columns": "Ausgew\xE4hlte Spalten l\xF6schen", "menu.mode": "Modus", "menu.mode-math": "Mathematik", "menu.mode-text": "Text", "menu.mode-latex": "LaTeX", "tooltip.blackboard": "Tafel", "tooltip.bold": "Fett", "tooltip.italic": "Kursiv", "tooltip.fraktur": "Fraktur", "tooltip.script": "Skript", "tooltip.caligraphic": "Kalligraphie", "tooltip.typewriter": "Schreibmaschine", "tooltip.roman-upright": "R\xF6misch aufrecht", "tooltip.row-by-col": "%@ \xD7 %@", "menu.font-style": "Schriftstil", "menu.accent": "Akzent", "menu.decoration": "Dekoration", "menu.color": "Farbe", "menu.background-color": "Hintergrund", "menu.evaluate": "Auswerten", "menu.simplify": "Vereinfachen", "menu.solve": "L\xF6sen", "menu.solve-for": "L\xF6sen f\xFCr %@", "menu.cut": "Ausschneiden", "menu.copy": "Kopieren", "menu.copy-as-latex": "Als LaTeX kopieren", "menu.copy-as-ascii-math": "Als ASCII Math kopieren", "menu.copy-as-mathml": "Als MathML kopieren", "menu.paste": "Einf\xFCgen", "menu.select-all": "Alles ausw\xE4hlen", "color.red": "Rot", "color.orange": "Orange", "color.yellow": "Gelb", "color.lime": "Limette", "color.green": "Gr\xFCn", "color.teal": "Blaugr\xFCn", "color.cyan": "Cyan", "color.blue": "Blau", "color.indigo": "Indigo", "color.purple": "Lila", "color.magenta": "Magenta", "color.black": "Schwarz", "color.dark-grey": "Dunkelgrau", "color.grey": "Grau", "color.light-grey": "Hellgrau", "color.white": "Wei\xDF" }, el: { "keyboard.tooltip.symbols": "\u03C3\u03CD\u03BC\u03B2\u03BF\u03BB\u03B1", "keyboard.tooltip.greek": "\u03B5\u03BB\u03BB\u03B7\u03BD\u03B9\u03BA\u03AC \u03B3\u03C1\u03AC\u03BC\u03BC\u03B1\u03C4\u03B1", "keyboard.tooltip.numeric": "\u0391\u03C1\u03B9\u03B8\u03BC\u03B7\u03C4\u03B9\u03BA\u03CC\u03C2", "keyboard.tooltip.alphabetic": "\u03A1\u03C9\u03BC\u03B1\u03CA\u03BA\u03AC \u03B3\u03C1\u03AC\u03BC\u03BC\u03B1\u03C4\u03B1", "tooltip.copy to clipboard": "\u0391\u03BD\u03C4\u03B9\u03B3\u03C1\u03B1\u03C6\u03AE \u03C3\u03C4\u03BF \u03C0\u03C1\u03CC\u03C7\u03B5\u03B9\u03C1\u03BF", "tooltip.redo": "\u039E\u03B1\u03BD\u03B1\u03BA\u03AC\u03BD\u03C9", "tooltip.toggle virtual keyboard": "\u0395\u03BD\u03B1\u03BB\u03BB\u03B1\u03B3\u03AE \u03B5\u03B9\u03BA\u03BF\u03BD\u03B9\u03BA\u03BF\u03CD \u03C0\u03BB\u03B7\u03BA\u03C4\u03C1\u03BF\u03BB\u03BF\u03B3\u03AF\u03BF\u03C5", "tooltip.undo": "\u039E\u03B5\u03BA\u03AC\u03BD\u03C9", "menu.insert matrix": "\u0395\u03B9\u03C3\u03B1\u03B3\u03C9\u03B3\u03AE \u03BC\u03AE\u03C4\u03C1\u03B1", "menu.borders": "\u039F\u03C1\u03B9\u03BF\u03B8\u03AD\u03C4\u03B5\u03C2 \u03BC\u03AE\u03C4\u03C1\u03B1", "menu.array.add row above": "\u03A0\u03C1\u03BF\u03C3\u03B8\u03AE\u03BA\u03B7 \u03C3\u03B5\u03B9\u03C1\u03AC\u03C2 \u03BC\u03B5\u03C4\u03AC", "menu.array.add row below": "\u03A0\u03C1\u03BF\u03C3\u03B8\u03AE\u03BA\u03B7 \u03C3\u03B5\u03B9\u03C1\u03AC\u03C2 \u03C0\u03C1\u03B9\u03BD", "menu.array.add column after": "\u03A0\u03C1\u03BF\u03C3\u03B8\u03AE\u03BA\u03B7 \u03C3\u03C4\u03AE\u03BB\u03B7\u03C2 \u03BC\u03B5\u03C4\u03AC", "menu.array.add column before": "\u03A0\u03C1\u03BF\u03C3\u03B8\u03AE\u03BA\u03B7 \u03C3\u03C4\u03AE\u03BB\u03B7\u03C2 \u03C0\u03C1\u03B9\u03BD", "menu.array.delete row": "\u0394\u03B9\u03B1\u03B3\u03C1\u03B1\u03C6\u03AE \u03C3\u03B5\u03B9\u03C1\u03AC\u03C2", "menu.array.delete rows": "\u0394\u03B9\u03B1\u03B3\u03C1\u03B1\u03C6\u03AE \u03B5\u03C0\u03B9\u03BB\u03B5\u03B3\u03BC\u03AD\u03BD\u03C9\u03BD \u03C3\u03B5\u03B9\u03C1\u03CE\u03BD", "menu.array.delete column": "\u0394\u03B9\u03B1\u03B3\u03C1\u03B1\u03C6\u03AE \u03C3\u03C4\u03AE\u03BB\u03B7\u03C2", "menu.array.delete columns": "\u0394\u03B9\u03B1\u03B3\u03C1\u03B1\u03C6\u03AE \u03B5\u03C0\u03B9\u03BB\u03B5\u03B3\u03BC\u03AD\u03BD\u03C9\u03BD \u03C3\u03C4\u03B7\u03BB\u03CE\u03BD", "menu.mode": "\u039B\u03B5\u03B9\u03C4\u03BF\u03C5\u03C1\u03B3\u03AF\u03B1", "menu.mode-math": "\u039C\u03B1\u03B8\u03B7\u03BC\u03B1\u03C4\u03B9\u03BA\u03AC", "menu.mode-text": "\u039A\u03B5\u03AF\u03BC\u03B5\u03BD\u03BF", "menu.mode-latex": "LaTeX", "tooltip.blackboard": "\u03A0\u03AF\u03BD\u03B1\u03BA\u03B1\u03C2", "tooltip.bold": "\u0388\u03BD\u03C4\u03BF\u03BD\u03B7", "tooltip.italic": "\u03A0\u03BB\u03AC\u03B3\u03B9\u03B1", "tooltip.fraktur": "\u03A6\u03C1\u03AC\u03BA\u03C4\u03BF\u03C5\u03C1", "tooltip.script": "\u03A3\u03B5\u03BD\u03AC\u03C1\u03B9\u03BF", "tooltip.caligraphic": "\u039A\u03B1\u03BB\u03BB\u03B9\u03B3\u03C1\u03B1\u03C6\u03B9\u03BA\u03AE", "tooltip.typewriter": "\u039C\u03B7\u03C7\u03B1\u03BD\u03AE \u03B3\u03C1\u03B1\u03C6\u03AE\u03C2", "tooltip.roman-upright": "\u03A1\u03C9\u03BC\u03B1\u03CA\u03BA\u03CC \u039A\u03B1\u03C4\u03B1\u03BA\u03CC\u03C1\u03C5\u03C6\u03BF", "tooltip.row-by-col": "%@ \xD7 %@", "menu.font-style": "\u03A3\u03C4\u03C5\u03BB \u03B3\u03C1\u03B1\u03BC\u03BC\u03B1\u03C4\u03BF\u03C3\u03B5\u03B9\u03C1\u03AC\u03C2", "menu.accent": "\u03A4\u03CC\u03BD\u03BF\u03C2", "menu.decoration": "\u0394\u03B9\u03B1\u03BA\u03CC\u03C3\u03BC\u03B7\u03C3\u03B7", "menu.color": "\u03A7\u03C1\u03CE\u03BC\u03B1", "menu.background-color": "\u03A7\u03C1\u03CE\u03BC\u03B1 \u03C6\u03CC\u03BD\u03C4\u03BF\u03C5", "menu.evaluate": "\u0391\u03BE\u03B9\u03BF\u03BB\u03CC\u03B3\u03B7\u03C3\u03B7", "menu.simplify": "\u0391\u03C0\u03BB\u03BF\u03C0\u03BF\u03AF\u03B7\u03C3\u03B7", "menu.solve": "\u039B\u03CD\u03C3\u03B7", "menu.solve-for": "\u039B\u03CD\u03C3\u03B7 \u03B3\u03B9\u03B1 %@", "menu.cut": "\u0391\u03C0\u03BF\u03BA\u03BF\u03C0\u03AE", "menu.copy": "\u0391\u03BD\u03C4\u03B9\u03B3\u03C1\u03B1\u03C6\u03AE", "menu.copy-as-latex": "\u0391\u03BD\u03C4\u03B9\u03B3\u03C1\u03B1\u03C6\u03AE \u03C9\u03C2 LaTeX", "menu.copy-as-ascii-math": "\u0391\u03BD\u03C4\u03B9\u03B3\u03C1\u03B1\u03C6\u03AE \u03C9\u03C2 ASCII Math", "menu.copy-as-mathml": "\u0391\u03BD\u03C4\u03B9\u03B3\u03C1\u03B1\u03C6\u03AE \u03C9\u03C2 MathML", "menu.paste": "\u0395\u03C0\u03B9\u03BA\u03CC\u03BB\u03BB\u03B7\u03C3\u03B7", "menu.select-all": "\u0395\u03C0\u03B9\u03BB\u03BF\u03B3\u03AE \u03CC\u03BB\u03C9\u03BD", "color.red": "\u039A\u03CC\u03BA\u03BA\u03B9\u03BD\u03BF", "color.orange": "\u03A0\u03BF\u03C1\u03C4\u03BF\u03BA\u03B1\u03BB\u03AF", "color.yellow": "\u039A\u03AF\u03C4\u03C1\u03B9\u03BD\u03BF", "color.lime": "\u039B\u03B1\u03C7\u03B1\u03BD\u03AF", "color.green": "\u03A0\u03C1\u03AC\u03C3\u03B9\u03BD\u03BF", "color.teal": "\u039A\u03C5\u03B1\u03BD\u03CC", "color.cyan": "\u0393\u03B1\u03BB\u03AC\u03B6\u03B9\u03BF", "color.blue": "\u039C\u03C0\u03BB\u03B5", "color.indigo": "\u0399\u03BD\u03B4\u03B9\u03BA\u03CC", "color.purple": "\u039C\u03C9\u03B2", "color.magenta": "\u039C\u03B1\u03C4\u03B6\u03AD\u03BD\u03C4\u03B1", "color.black": "\u039C\u03B1\u03CD\u03C1\u03BF", "color.dark-grey": "\u03A3\u03BA\u03BF\u03CD\u03C1\u03BF \u0393\u03BA\u03C1\u03B9", "color.grey": "\u0393\u03BA\u03C1\u03B9", "color.light-grey": "\u0391\u03BD\u03BF\u03B9\u03C7\u03C4\u03CC \u0393\u03BA\u03C1\u03B9", "color.white": "\u039B\u03B5\u03C5\u03BA\u03CC" }, es: { "keyboard.tooltip.symbols": "S\xEDmbolos", "keyboard.tooltip.greek": "Letras griegas", "keyboard.tooltip.numeric": "Num\xE9rico", "keyboard.tooltip.alphabetic": "Letras romanas", "tooltip.copy to clipboard": "Copiar al portapapeles", "tooltip.redo": "Rehacer", "tooltip.toggle virtual keyboard": "Alternar teclado virtual", "tooltip.undo": "Deshacer", "menu.insert matrix": "A\xF1adir Matriz", "menu.borders": "Delimitadores de Matriz", "menu.array.add row above": "A\xF1adir L\xEDnea Antes", "menu.array.add row below": "A\xF1adir L\xEDnea Despues", "menu.array.add column after": "A\xF1adir Columna Despues", "menu.array.add column before": "A\xF1adir Columna Antes", "menu.array.delete row": "Borrar L\xEDnea", "menu.array.delete rows": "Borrar L\xEDneas Seleccionadas", "menu.array.delete column": "Borrar Columna", "menu.array.delete columns": "Borrar Columnas Seleccionadas", "menu.mode": "Modo", "menu.mode-math": "Matem\xE1ticas", "menu.mode-text": "Texto", "menu.mode-latex": "LaTeX", "tooltip.blackboard": "Pizarra", "tooltip.bold": "Negrita", "tooltip.italic": "Cursiva", "tooltip.fraktur": "Fraktur", "tooltip.script": "Script", "tooltip.caligraphic": "Caligr\xE1fico", "tooltip.typewriter": "M\xE1quina de escribir", "tooltip.roman-upright": "Romano Vertical", "tooltip.row-by-col": "%@ \xD7 %@", "menu.font-style": "Estilo de fuente", "menu.accent": "Acento", "menu.decoration": "Decoraci\xF3n", "menu.color": "Color", "menu.background-color": "Fondo", "menu.evaluate": "Evaluar", "menu.simplify": "Simplificar", "menu.solve": "Resolver", "menu.solve-for": "Resolver para %@", "menu.cut": "Cortar", "menu.copy": "Copiar", "menu.copy-as-latex": "Copiar como LaTeX", "menu.copy-as-ascii-math": "Copiar como ASCII Math", "menu.copy-as-mathml": "Copiar como MathML", "menu.paste": "Pegar", "menu.select-all": "Seleccionar todo", "color.red": "Rojo", "color.orange": "Naranja", "color.yellow": "Amarillo", "color.lime": "Lima", "color.green": "Verde", "color.teal": "Verde azulado", "color.cyan": "Cian", "color.blue": "Azul", "color.indigo": "\xCDndigo", "color.purple": "Morado", "color.magenta": "Magenta", "color.black": "Negro", "color.dark-grey": "Gris oscuro", "color.grey": "Gris", "color.light-grey": "Gris claro", "color.white": "Blanco" }, fr: { "keyboard.tooltip.symbols": "Symboles", "keyboard.tooltip.greek": "Lettres grecques", "keyboard.tooltip.numeric": "Num\xE9rique", "keyboard.tooltip.alphabetic": "Lettres romaines", "tooltip.menu": "Menu", "tooltip.copy to clipboard": "Copier dans le presse-papiers", "tooltip.redo": "R\xE9tablir", "tooltip.toggle virtual keyboard": "Afficher/Masquer le clavier virtuel", "tooltip.undo": "Annuler", "menu.insert matrix": "Ins\xE9rer une Matrice", "menu.borders": "Bords", "menu.array.add row above": "Ajouter une Ligne Avant", "menu.array.add row below": "Ajouter une Ligne Apr\xE8s", "menu.array.add column before": "Ajouter une Colonne Avant", "menu.array.add column after": "Ajouter une Colonne Apr\xE8s", "menu.array.delete row": "Enlever une Ligne", "menu.array.delete rows": "Enlever les Lignes S\xE9lection\xE9es", "menu.array.delete column": "Enlever une Colone", "menu.array.delete columns": "Enlever les Colonnes S\xE9lection\xE9es", "menu.mode": "Mode", "menu.mode-math": "Math", "menu.mode-text": "Text", "menu.mode-latex": "LaTeX", "tooltip.blackboard": "Tableau noir", "tooltip.bold": "Gras", "tooltip.italic": "Italique", "tooltip.fraktur": "Fraktur", "tooltip.script": "Script", "tooltip.caligraphic": "Calligraphique", "tooltip.typewriter": "Machine \xE0 \xE9crire", "tooltip.roman-upright": "Romain droit", "tooltip.row-by-col": "%@ \xD7 %@", "menu.font-style": "Style de police", "menu.accent": "Accent", "menu.decoration": "D\xE9coration", "menu.color": "Couleur", "menu.background-color": "Arri\xE8re-plan", "menu.evaluate": "\xC9valuer", "menu.simplify": "Simplifier", "menu.solve": "R\xE9soudre", "menu.solve-for": "R\xE9soudre pour %@", "menu.cut": "Couper", "menu.copy": "Copier", "menu.copy-as-latex": "Copier en LaTeX", "menu.copy-as-ascii-math": "Copier en ASCII Math", "menu.copy-as-mathml": "Copier en MathML", "menu.paste": "Coller", "menu.select-all": "S\xE9lectionner tout", "color.red": "Rouge", "color.orange": "Orange", "color.yellow": "Jaune", "color.lime": "Citron vert", "color.green": "Vert", "color.teal": "Turquoise", "color.cyan": "Cyan", "color.blue": "Bleu", "color.indigo": "Indigo", "color.purple": "Violet", "color.magenta": "Magenta", "color.black": "Noir", "color.dark-grey": "Gris fonc\xE9", "color.grey": "Gris", "color.light-grey": "Gris clair", "color.white": "Blanc" }, he: { "keyboard.tooltip.symbols": "\u05E1\u05DE\u05DC\u05D9\u05DD", "keyboard.tooltip.greek": "\u05D0\u05D5\u05EA\u05D9\u05D5\u05EA \u05D9\u05D5\u05D5\u05E0\u05D9\u05D5\u05EA", "keyboard.tooltip.numeric": "\u05DE\u05E1\u05E4\u05E8\u05D9", "keyboard.tooltip.alphabetic": "\u05DE\u05DB\u05EA\u05D1\u05D9\u05DD \u05E8\u05D5\u05DE\u05D9\u05D9\u05DD", "tooltip.copy to clipboard": "\u05D4\u05E2\u05EA\u05E7 \u05DC\u05DC\u05D5\u05D7", "tooltip.redo": "\u05DC\u05B7\u05E2\u05B2\u05E9\u05C2\u05D5\u05B9\u05EA \u05E9\u05C1\u05D5\u05BC\u05D1", "tooltip.toggle virtual keyboard": "\u05D4\u05D7\u05DC\u05E3 \u05D0\u05EA \u05D4\u05DE\u05E7\u05DC\u05D3\u05EA \u05D4\u05D5\u05D5\u05D9\u05E8\u05D8\u05D5\u05D0\u05DC\u05D9\u05EA", "tooltip.undo": "\u05DC\u05D1\u05D8\u05DC", "menu.insert matrix": "\u05D4\u05DB\u05E0\u05E1 \u05DE\u05D8\u05E8\u05D9\u05E7\u05E1", "menu.borders": "\u05DE\u05E4\u05E8\u05D9\u05D3\u05D9 \u05DE\u05D8\u05E8\u05D9\u05E7\u05E1", "menu.array.add row above": "\u05D4\u05D5\u05E1\u05E3 \u05E9\u05D5\u05E8\u05D4 \u05D0\u05D7\u05E8\u05D9", "menu.array.add row below": "\u05D4\u05D5\u05E1\u05E3 \u05E9\u05D5\u05E8\u05D4 \u05DC\u05E4\u05E0\u05D9", "menu.array.add column after": "\u05D4\u05D5\u05E1\u05E3 \u05E2\u05DE\u05D5\u05D3\u05D4 \u05D0\u05D7\u05E8\u05D9", "menu.array.add column before": "\u05D4\u05D5\u05E1\u05E3 \u05E2\u05DE\u05D5\u05D3\u05D4 \u05DC\u05E4\u05E0\u05D9", "menu.array.delete row": "\u05DE\u05D7\u05E7 \u05E9\u05D5\u05E8\u05D4", "menu.array.delete rows": "\u05DE\u05D7\u05E7 \u05E9\u05D5\u05E8\u05D5\u05EA \u05E9\u05E0\u05D1\u05D7\u05E8\u05D5", "menu.array.delete column": "\u05DE\u05D7\u05E7 \u05E2\u05DE\u05D5\u05D3\u05D4", "menu.array.delete columns": "\u05DE\u05D7\u05E7 \u05E2\u05DE\u05D5\u05D3\u05D5\u05EA \u05E9\u05E0\u05D1\u05D7\u05E8\u05D5", "menu.mode": "\u05DE\u05E6\u05D1", "menu.mode-math": "\u05DE\u05EA\u05DE\u05D8\u05D9\u05E7\u05D4", "menu.mode-text": "\u05D8\u05E7\u05E1\u05D8", "menu.mode-latex": "LaTeX", "tooltip.blackboard": "\u05DC\u05D5\u05D7 \u05E9\u05D7\u05D5\u05E8", "tooltip.bold": "\u05DE\u05D5\u05D3\u05D2\u05E9", "tooltip.italic": "\u05E0\u05D8\u05D5\u05D9", "tooltip.fraktur": "\u05E4\u05E8\u05E7\u05D8\u05D5\u05E8", "tooltip.script": "\u05DB\u05EA\u05D1", "tooltip.caligraphic": "\u05E7\u05DC\u05D9\u05D2\u05E8\u05E4\u05D9", "tooltip.typewriter": "\u05DE\u05DB\u05D5\u05E0\u05EA \u05DB\u05EA\u05D9\u05D1\u05D4", "tooltip.roman-upright": "\u05E8\u05D5\u05DE\u05D9 \u05D9\u05E9\u05E8", "tooltip.row-by-col": "%@ \xD7 %@", "menu.font-style": "\u05E1\u05D2\u05E0\u05D5\u05DF \u05D2\u05D5\u05E4\u05DF", "menu.accent": "\u05E6\u05DC\u05D9\u05DC", "menu.decoration": "\u05E7\u05D9\u05E9\u05D5\u05D8", "menu.color": "\u05E6\u05D1\u05E2", "menu.background-color": "\u05E8\u05E7\u05E2", "menu.evaluate": "\u05D7\u05E9\u05D1", "menu.simplify": "\u05E4\u05E9\u05D8", "menu.solve": "\u05E4\u05EA\u05D5\u05E8", "menu.solve-for": "\u05E4\u05EA\u05D5\u05E8 \u05E2\u05D1\u05D5\u05E8 %@", "menu.cut": "\u05D2\u05D6\u05D5\u05E8", "menu.copy": "\u05D4\u05E2\u05EA\u05E7", "menu.copy-as-latex": "\u05D4\u05E2\u05EA\u05E7 \u05DB\u05BELaTeX", "menu.copy-as-ascii-math": "\u05D4\u05E2\u05EA\u05E7 \u05DB\u05BEASCII Math", "menu.copy-as-mathml": "\u05D4\u05E2\u05EA\u05E7 \u05DB\u05BEMathML", "menu.paste": "\u05D4\u05D3\u05D1\u05E7", "menu.select-all": "\u05D1\u05D7\u05E8 \u05D4\u05DB\u05DC", "color.red": "\u05D0\u05D3\u05D5\u05DD", "color.orange": "\u05DB\u05EA\u05D5\u05DD", "color.yellow": "\u05E6\u05D4\u05D5\u05D1", "color.lime": "\u05D9\u05E8\u05D5\u05E7 \u05DC\u05D9\u05D9\u05DD", "color.green": "\u05D9\u05E8\u05D5\u05E7", "color.teal": "\u05D8\u05D9\u05DC", "color.cyan": "\u05E6\u05D9\u05D0\u05DF", "color.blue": "\u05DB\u05D7\u05D5\u05DC", "color.indigo": "\u05D0\u05D9\u05E0\u05D3\u05D9\u05D2\u05D5", "color.purple": "\u05E1\u05D2\u05D5\u05DC", "color.magenta": "\u05DE\u05D2\u05E0\u05D8\u05D4", "color.black": "\u05E9\u05D7\u05D5\u05E8", "color.dark-grey": "\u05D0\u05E4\u05D5\u05E8 \u05DB\u05D4\u05D4", "color.grey": "\u05D0\u05E4\u05D5\u05E8", "color.light-grey": "\u05D0\u05E4\u05D5\u05E8 \u05D1\u05D4\u05D9\u05E8", "color.white": "\u05DC\u05D1\u05DF" }, it: { "keyboard.tooltip.symbols": "Simboli", "keyboard.tooltip.greek": "Lettere greche", "keyboard.tooltip.numeric": "Numerico", "keyboard.tooltip.alphabetic": "Lettere romane", "tooltip.copy to clipboard": "Copia negli appunti", "tooltip.redo": "Rifare", "tooltip.toggle virtual keyboard": "Attiva / disattiva la tastiera virtuale", "tooltip.undo": "Disfare", "menu.insert matrix": "Inserisci una Matrice", "menu.borders": "Delimitatori di Matrice", "menu.array.add row above": "Aggiungi una Riga Prima", "menu.array.add row below": "Aggiungi una Riga Dopo", "menu.array.add column before": "Aggiungi una Colonna Prima", "menu.array.add column after": "Aggiungi una Colonna Dopo", "menu.array.delete row": "Rimuovi una Riga", "menu.array.delete rows": "Rimuovi le Righe Selezionate", "menu.array.delete column": "Rimuovi una Colonna", "menu.array.delete columns": "Rimuovi le Colonne Selezionate", "menu.mode": "Modalit\xE0", "menu.mode-math": "Matematica", "menu.mode-text": "Testo", "menu.mode-latex": "LaTeX", "tooltip.blackboard": "Lavagna", "tooltip.bold": "Grassetto", "tooltip.italic": "Corsivo", "tooltip.fraktur": "Fraktur", "tooltip.script": "Script", "tooltip.caligraphic": "Caligrafico", "tooltip.typewriter": "Macchina da scrivere", "tooltip.roman-upright": "Romano dritto", "tooltip.row-by-col": "%@ \xD7 %@", "menu.font-style": "Stile del carattere", "menu.accent": "Accento", "menu.decoration": "Decorazione", "menu.color": "Colore", "menu.background-color": "Sfondo", "menu.evaluate": "Valuta", "menu.simplify": "Semplifica", "menu.solve": "Risolvi", "menu.solve-for": "Risolvi per %@", "menu.cut": "Taglia", "menu.copy": "Copia", "menu.copy-as-latex": "Copia come LaTeX", "menu.copy-as-ascii-math": "Copia come ASCII Math", "menu.copy-as-mathml": "Copia come MathML", "menu.paste": "Incolla", "menu.select-all": "Seleziona tutto", "color.red": "Rosso", "color.orange": "Arancione", "color.yellow": "Giallo", "color.lime": "Lime", "color.green": "Verde", "color.teal": "Verde acqua", "color.cyan": "Ciano", "color.blue": "Blu", "color.indigo": "Indaco", "color.purple": "Viola", "color.magenta": "Magenta", "color.black": "Nero", "color.dark-grey": "Grigio scuro", "color.grey": "Grigio", "color.light-grey": "Grigio chiaro", "color.white": "Bianco" }, ja: { "keyboard.tooltip.symbols": "\u30B7\u30F3\u30DC\u30EB", "keyboard.tooltip.greek": "\u30AE\u30EA\u30B7\u30E3\u6587\u5B57", "keyboard.tooltip.numeric": "\u6570\u5024", "keyboard.tooltip.alphabetic": "\u30ED\u30FC\u30DE\u5B57", "tooltip.menu": "\u30E1\u30CB\u30E5\u30FC", "tooltip.copy to clipboard": "\u30AF\u30EA\u30C3\u30D7\u30DC\u30FC\u30C9\u306B\u30B3\u30D4\u30FC", "tooltip.redo": "\u3084\u308A\u76F4\u3057", "tooltip.toggle virtual keyboard": "\u4EEE\u60F3\u30AD\u30FC\u30DC\u30FC\u30C9\u306E\u5207\u308A\u66FF\u3048", "tooltip.undo": "\u5143\u306B\u623B\u3059", "menu.insert matrix": "\u30DE\u30C8\u30EA\u30C3\u30AF\u30B9\u3092\u633F\u5165", "menu.borders": "\u884C\u5217\u533A\u5207\u308A\u6587\u5B57", "menu.array.add row above": "\u5F8C\u306B\u884C\u3092\u8FFD\u52A0", "menu.array.add row below": "\u524D\u306B\u884C\u3092\u8FFD\u52A0", "menu.array.add column after": "\u5F8C\u306B\u5217\u3092\u8FFD\u52A0", "menu.array.add column before": "\u524D\u306B\u5217\u3092\u8FFD\u52A0", "menu.array.delete row": "\u884C\u3092\u524A\u9664", "menu.array.delete rows": "\u9078\u629E\u3057\u305F\u884C\u3092\u524A\u9664\u3059\u308B", "menu.array.delete column": "\u5217\u3092\u524A\u9664", "menu.array.delete columns": "\u9078\u629E\u3057\u305F\u5217\u3092\u524A\u9664\u3059\u308B", "menu.mode": "\u30E2\u30FC\u30C9", "menu.mode-math": "\u6570\u5F0F", "menu.mode-text": "\u30C6\u30AD\u30B9\u30C8", "menu.mode-latex": "LaTeX", "tooltip.blackboard": "\u9ED2\u677F", "tooltip.bold": "\u592A\u5B57", "tooltip.italic": "\u30A4\u30BF\u30EA\u30C3\u30AF", "tooltip.fraktur": "\u30D5\u30E9\u30AF\u30C8\u30A5\u30FC\u30EB", "tooltip.script": "\u30B9\u30AF\u30EA\u30D7\u30C8", "tooltip.caligraphic": "\u30AB\u30EA\u30B0\u30E9\u30D5\u30A3\u30C3\u30AF", "tooltip.typewriter": "\u30BF\u30A4\u30D7\u30E9\u30A4\u30BF\u30FC", "tooltip.roman-upright": "\u30ED\u30FC\u30DE\u76F4\u7ACB", "tooltip.row-by-col": "%@ \xD7 %@", "menu.font-style": "\u30D5\u30A9\u30F3\u30C8\u30B9\u30BF\u30A4\u30EB", "menu.accent": "\u30A2\u30AF\u30BB\u30F3\u30C8", "menu.decoration": "\u88C5\u98FE", "menu.color": "\u8272", "menu.background-color": "\u80CC\u666F", "menu.evaluate": "\u8A55\u4FA1", "menu.simplify": "\u7C21\u7565\u5316", "menu.solve": "\u89E3\u304F", "menu.solve-for": "%@ \u3092\u89E3\u304F", "menu.cut": "\u5207\u308A\u53D6\u308A", "menu.copy": "\u30B3\u30D4\u30FC", "menu.copy-as-latex": "LaTeX\u3068\u3057\u3066\u30B3\u30D4\u30FC", "menu.copy-as-ascii-math": "ASCII Math\u3068\u3057\u3066\u30B3\u30D4\u30FC", "menu.copy-as-mathml": "MathML\u3068\u3057\u3066\u30B3\u30D4\u30FC", "menu.paste": "\u8CBC\u308A\u4ED8\u3051", "menu.select-all": "\u3059\u3079\u3066\u9078\u629E", "color.red": "\u8D64", "color.orange": "\u30AA\u30EC\u30F3\u30B8", "color.yellow": "\u9EC4\u8272", "color.lime": "\u30E9\u30A4\u30E0", "color.green": "\u7DD1", "color.teal": "\u30C6\u30A3\u30FC\u30EB", "color.cyan": "\u30B7\u30A2\u30F3", "color.blue": "\u9752", "color.indigo": "\u30A4\u30F3\u30C7\u30A3\u30B4", "color.purple": "\u7D2B", "color.magenta": "\u30DE\u30BC\u30F3\u30BF", "color.black": "\u9ED2", "color.dark-grey": "\u6FC3\u3044\u30B0\u30EC\u30FC", "color.grey": "\u30B0\u30EC\u30FC", "color.light-grey": "\u8584\u3044\u30B0\u30EC\u30FC", "color.white": "\u767D" }, ko: { "keyboard.tooltip.symbols": "\uAE30\uD638", "keyboard.tooltip.greek": "\uADF8\uB9AC\uC2A4 \uBB38\uC790", "keyboard.tooltip.numeric": "\uC22B\uC790", "keyboard.tooltip.alphabetic": "\uB85C\uB9C8 \uBB38\uC790", "tooltip.copy to clipboard": "\uD074\uB9BD \uBCF4\uB4DC\uC5D0 \uBCF5\uC0AC", "tooltip.redo": "\uB2E4\uC2DC \uD558\uB2E4", "tooltip.toggle virtual keyboard": "\uAC00\uC0C1 \uD0A4\uBCF4\uB4DC \uC804\uD658", "tooltip.undo": "\uC2E4\uD589 \uCDE8\uC18C", "menu.insert matrix": "\uB9E4\uD2B8\uB9AD\uC2A4 \uC0BD\uC785", "menu.borders": "\uD589\uB82C \uAD6C\uBD84 \uAE30\uD638", "menu.array.add row above": "\uB4A4\uC5D0 \uD589 \uCD94\uAC00", "menu.array.add row below": "\uC55E\uC5D0 \uD589 \uCD94\uAC00", "menu.array.add column after": "\uB4A4\uC5D0 \uC5F4 \uCD94\uAC00", "menu.array.add column before": "\uC55E\uC5D0 \uC5F4 \uCD94\uAC00", "menu.array.delete row": "\uD589 \uC0AD\uC81C", "menu.array.delete rows": "\uC120\uD0DD\uD55C \uD589 \uC0AD\uC81C", "menu.array.delete column": "\uC5F4 \uC0AD\uC81C", "menu.array.delete columns": "\uC120\uD0DD\uD55C \uC5F4 \uC0AD\uC81C", "menu.mode": "\u30E2\u30FC\u30C9", "menu.mode-math": "\u6570\u5F0F", "menu.mode-text": "\u30C6\u30AD\u30B9\u30C8", "menu.mode-latex": "LaTeX", "tooltip.blackboard": "\uCE60\uD310", "tooltip.bold": "\uAD75\uAC8C", "tooltip.italic": "\uC774\uD0E4\uB9AD", "tooltip.fraktur": "\uD504\uB799\uD22C\uC5B4", "tooltip.script": "\uC2A4\uD06C\uB9BD\uD2B8", "tooltip.caligraphic": "\uCE98\uB9AC\uADF8\uB798\uD53D", "tooltip.typewriter": "\uD0C0\uC790\uAE30", "tooltip.roman-upright": "\uB85C\uB9C8 \uC9C1\uB9BD", "tooltip.row-by-col": "%@ \xD7 %@", "menu.font-style": "\uAE00\uAF34 \uC2A4\uD0C0\uC77C", "menu.accent": "\uC545\uC13C\uD2B8", "menu.decoration": "\uC7A5\uC2DD", "menu.color": "\uC0C9\uC0C1", "menu.background-color": "\uBC30\uACBD", "menu.evaluate": "\uD3C9\uAC00", "menu.simplify": "\uAC04\uC18C\uD654", "menu.solve": "\uD574\uACB0", "menu.solve-for": "%@\uC5D0 \uB300\uD574 \uD574\uACB0", "menu.cut": "\uC798\uB77C\uB0B4\uAE30", "menu.copy": "\uBCF5\uC0AC", "menu.copy-as-latex": "LaTeX\uB85C \uBCF5\uC0AC", "menu.copy-as-ascii-math": "ASCII Math\uB85C \uBCF5\uC0AC", "menu.copy-as-mathml": "MathML\uB85C \uBCF5\uC0AC", "menu.paste": "\uBD99\uC5EC\uB123\uAE30", "menu.select-all": "\uBAA8\uB450 \uC120\uD0DD", "color.red": "\uBE68\uAC15", "color.orange": "\uC8FC\uD669", "color.yellow": "\uB178\uB791", "color.lime": "\uB77C\uC784", "color.green": "\uCD08\uB85D", "color.teal": "\uCCAD\uB85D", "color.cyan": "\uCCAD\uC0C9", "color.blue": "\uD30C\uB791", "color.indigo": "\uB0A8\uC0C9", "color.purple": "\uBCF4\uB77C", "color.magenta": "\uC790\uD64D", "color.black": "\uAC80\uC815", "color.dark-grey": "\uC9C4\uD55C \uD68C\uC0C9", "color.grey": "\uD68C\uC0C9", "color.light-grey": "\uC5F0\uD55C \uD68C\uC0C9", "color.white": "\uD770\uC0C9" }, pl: { "keyboard.tooltip.symbols": "Symbolika", "keyboard.tooltip.greek": "Litery greckie", "keyboard.tooltip.numeric": "Numeryczne", "keyboard.tooltip.alphabetic": "Litery rzymskie", "tooltip.copy to clipboard": "Kopiuj do Schowka", "tooltip.redo": "Przywr\xF3\u0107", "tooltip.toggle virtual keyboard": "Prze\u0142\u0105cz wirtualn\u0105 klawiatur\u0119", "tooltip.undo": "Cofnij", "menu.insert matrix": "Wstaw macierz", "menu.borders": "Ograniczniki macierzy", "menu.array.add row above": "Dodaj wiersz po", "menu.array.add row below": "Dodaj wiersz przed", "menu.array.add column after": "Dodaj kolumn\u0119 po", "menu.array.add column before": "Dodaj kolumn\u0119 przed", "menu.array.delete row": "Usu\u0144 wiersz", "menu.array.delete rows": "Usu\u0144 wybrane wiersze", "menu.array.delete column": "Usu\u0144 kolumn\u0119", "menu.array.delete columns": "Usu\u0144 wybrane kolumny", "menu.mode": "Tryb", "menu.mode-math": "Formu\u0142a", "menu.mode-text": "Tekst", "menu.mode-latex": "LaTeX", "tooltip.blackboard": "Tablica", "tooltip.bold": "Pogrubienie", "tooltip.italic": "Kursywa", "tooltip.fraktur": "Fraktura", "tooltip.script": "Skrypt", "tooltip.caligraphic": "Kaligraficzny", "tooltip.typewriter": "Maszynowy", "tooltip.roman-upright": "Rzymski prosto", "tooltip.row-by-col": "%@ \xD7 %@", "menu.font-style": "Styl czcionki", "menu.accent": "Akcent", "menu.decoration": "Dekoracja", "menu.color": "Kolor", "menu.background-color": "T\u0142o", "menu.evaluate": "Oblicz", "menu.simplify": "Upro\u015B\u0107", "menu.solve": "Rozwi\u0105\u017C", "menu.solve-for": "Rozwi\u0105\u017C dla %@", "menu.cut": "Wytnij", "menu.copy": "Kopiuj", "menu.copy-as-latex": "Kopiuj jako LaTeX", "menu.copy-as-ascii-math": "Kopiuj jako ASCII Math", "menu.copy-as-mathml": "Kopiuj jako MathML", "menu.paste": "Wklej", "menu.select-all": "Zaznacz wszystko", "color.red": "Czerwony", "color.orange": "Pomara\u0144czowy", "color.yellow": "\u017B\xF3\u0142ty", "color.lime": "Limetkowy", "color.green": "Zielony", "color.teal": "Turkusowy", "color.cyan": "Cyjan", "color.blue": "Niebieski", "color.indigo": "Indygo", "color.purple": "Fioletowy", "color.magenta": "Magenta", "color.black": "Czarny", "color.dark-grey": "Ciemnoszary", "color.grey": "Szary", "color.light-grey": "Jasnoszary", "color.white": "Bia\u0142y" }, pt: { "keyboard.tooltip.symbols": "S\xEDmbolos", "keyboard.tooltip.greek": "Letras gregas", "keyboard.tooltip.numeric": "Num\xE9rico", "keyboard.tooltip.alphabetic": "Letras romanas", "tooltip.copy to clipboard": "Copiar para \xE1rea de transfer\xEAncia", "tooltip.redo": "Refazer", "tooltip.toggle virtual keyboard": "Alternar teclado virtual", "tooltip.undo": "Desfazer", "menu.insert matrix": "Inserir Matriz", "menu.borders": "Delimitadores de matriz", "menu.array.add row above": "Adicionar linha depois", "menu.array.add row below": "Adicionar linha antes", "menu.array.add column after": "Adicionar coluna depois", "menu.array.add column before": "Adicionar coluna antes", "menu.array.delete row": "Excluir linha", "menu.array.delete rows": "Excluir linhas selecionadas", "menu.array.delete column": "Apagar Coluna", "menu.array.delete columns": "Excluir Colunas Selecionadas", "menu.mode": "Modo", "menu.mode-math": "F\xF3rmula", "menu.mode-text": "Texto", "menu.mode-latex": "LaTeX", "tooltip.blackboard": "Quadro Negro", "tooltip.bold": "Negrito", "tooltip.italic": "It\xE1lico", "tooltip.fraktur": "Fraktur", "tooltip.script": "Script", "tooltip.caligraphic": "Caligr\xE1fico", "tooltip.typewriter": "M\xE1quina de Escrever", "tooltip.roman-upright": "Romano Vertical", "tooltip.row-by-col": "%@ \xD7 %@", "menu.font-style": "Estilo da Fonte", "menu.accent": "Acento", "menu.decoration": "Decora\xE7\xE3o", "menu.color": "Cor", "menu.background-color": "Cor de Fundo", "menu.evaluate": "Avaliar", "menu.simplify": "Simplificar", "menu.solve": "Resolver", "menu.solve-for": "Resolver para %@", "menu.cut": "Recortar", "menu.copy": "Copiar", "menu.copy-as-latex": "Copiar como LaTeX", "menu.copy-as-ascii-math": "Copiar como ASCII Math", "menu.copy-as-mathml": "Copiar como MathML", "menu.paste": "Colar", "menu.select-all": "Selecionar Tudo", "color.red": "Vermelho", "color.orange": "Laranja", "color.yellow": "Amarelo", "color.lime": "Verde Lima", "color.green": "Verde", "color.teal": "Verde-azulado", "color.cyan": "Ciano", "color.blue": "Azul", "color.indigo": "\xCDndigo", "color.purple": "Roxo", "color.magenta": "Magenta", "color.black": "Preto", "color.dark-grey": "Cinza Escuro", "color.grey": "Cinza", "color.light-grey": "Cinza Claro", "color.white": "Branco" }, uk: { "keyboard.tooltip.symbols": "\u0421\u0438\u043C\u0432\u043E\u043B\u0438", "keyboard.tooltip.greek": "\u0413\u0440\u0435\u0446\u044C\u043A\u0456 \u043B\u0456\u0442\u0435\u0440\u0438", "keyboard.tooltip.numeric": "\u0427\u0438\u0441\u043B\u043E\u0432\u0438\u0439", "keyboard.tooltip.alphabetic": "\u0420\u0438\u043C\u0441\u044C\u043A\u0456 \u043B\u0456\u0442\u0435\u0440\u0438", "tooltip.copy to clipboard": "\u041A\u043E\u043F\u0456\u044E\u0432\u0430\u0442\u0438 \u0432 \u0431\u0443\u0444\u0435\u0440 \u043E\u0431\u043C\u0456\u043D\u0443", "tooltip.redo": "\u041F\u043E\u0432\u0442\u043E\u0440\u0438\u0442\u0438", "tooltip.toggle virtual keyboard": "\u041F\u0435\u0440\u0435\u043A\u043B\u044E\u0447\u0438\u0442\u0438 \u0432\u0456\u0440\u0442\u0443\u0430\u043B\u044C\u043D\u0443 \u043A\u043B\u0430\u0432\u0456\u0430\u0442\u0443\u0440\u0443", "tooltip.undo": "\u0421\u043A\u0430\u0441\u0443\u0432\u0430\u0442\u0438", "menu.insert matrix": "\u0412\u0441\u0442\u0430\u0432\u0438\u0442\u0438 \u043C\u0430\u0442\u0440\u0438\u0446\u044E", "menu.borders": "\u041C\u0430\u0442\u0440\u0438\u0447\u043D\u0456 \u0440\u043E\u0437\u0434\u0456\u043B\u044C\u043D\u0438\u043A\u0438", "menu.array.add row above": "\u0414\u043E\u0434\u0430\u0442\u0438 \u0440\u044F\u0434\u043E\u043A \u043F\u0456\u0441\u043B\u044F", "menu.array.add row below": "\u0414\u043E\u0434\u0430\u0442\u0438 \u0440\u044F\u0434\u043E\u043A \u0434\u043E", "menu.array.add column after": "\u0414\u043E\u0434\u0430\u0442\u0438 \u0441\u0442\u043E\u0432\u043F\u0435\u0446\u044C \u043F\u0456\u0441\u043B\u044F", "menu.array.add column before": "\u0414\u043E\u0434\u0430\u0442\u0438 \u0441\u0442\u043E\u0432\u043F\u0435\u0446\u044C \u043F\u0435\u0440\u0435\u0434", "menu.array.delete row": "\u0412\u0438\u0434\u0430\u043B\u0438\u0442\u0438 \u0440\u044F\u0434\u043E\u043A", "menu.array.delete rows": "\u0412\u0438\u0434\u0430\u043B\u0438\u0442\u0438 \u0432\u0438\u0431\u0440\u0430\u043D\u0456 \u0440\u044F\u0434\u043A\u0438", "menu.array.delete column": "\u0412\u0438\u0434\u0430\u043B\u0438\u0442\u0438 \u0441\u0442\u043E\u0432\u043F\u0435\u0446\u044C", "menu.array.delete columns": "\u0412\u0438\u0434\u0430\u043B\u0438\u0442\u0438 \u0432\u0438\u0431\u0440\u0430\u043D\u0456 \u0441\u0442\u043E\u0432\u043F\u0446\u0456", "menu.mode": "\u0420\u0435\u0436\u0438\u043C", "menu.mode-math": "\u041C\u0430\u0442\u0435\u043C\u0430\u0442\u0438\u043A\u0430", "menu.mode-text": "\u0422\u0435\u043A\u0441\u0442", "menu.mode-latex": "LaTeX", "tooltip.blackboard": "\u0427\u043E\u0440\u043D\u0430 \u0434\u043E\u0448\u043A\u0430", "tooltip.bold": "\u0416\u0438\u0440\u043D\u0438\u0439", "tooltip.italic": "\u041A\u0443\u0440\u0441\u0438\u0432", "tooltip.fraktur": "\u0424\u0440\u0430\u043A\u0442\u0443\u0440\u043D\u0438\u0439", "tooltip.script": "\u0421\u043A\u0440\u0438\u043F\u0442", "tooltip.caligraphic": "\u041A\u0430\u043B\u0456\u0433\u0440\u0430\u0444\u0456\u0447\u043D\u0438\u0439", "tooltip.typewriter": "\u041C\u0430\u0448\u0438\u043D\u043A\u0430 \u0434\u043B\u044F \u043F\u0438\u0441\u044C\u043C\u0430", "tooltip.roman-upright": "\u0420\u0438\u043C\u0441\u044C\u043A\u0438\u0439 \u043F\u0440\u044F\u043C\u0438\u0439", "tooltip.row-by-col": "%@ \xD7 %@", "menu.font-style": "\u0421\u0442\u0438\u043B\u044C \u0448\u0440\u0438\u0444\u0442\u0443", "menu.accent": "\u0410\u043A\u0446\u0435\u043D\u0442", "menu.decoration": "\u0414\u0435\u043A\u043E\u0440\u0430\u0446\u0456\u044F", "menu.color": "\u041A\u043E\u043B\u0456\u0440", "menu.background-color": "\u0424\u043E\u043D", "menu.evaluate": "\u041E\u0431\u0447\u0438\u0441\u043B\u0438\u0442\u0438", "menu.simplify": "\u0421\u043F\u0440\u043E\u0441\u0442\u0438\u0442\u0438", "menu.solve": "\u0412\u0438\u0440\u0456\u0448\u0438\u0442\u0438", "menu.solve-for": "\u0412\u0438\u0440\u0456\u0448\u0438\u0442\u0438 \u0434\u043B\u044F %@", "menu.cut": "\u0412\u0438\u0440\u0456\u0437\u0430\u0442\u0438", "menu.copy": "\u041A\u043E\u043F\u0456\u044E\u0432\u0430\u0442\u0438", "menu.copy-as-latex": "\u041A\u043E\u043F\u0456\u044E\u0432\u0430\u0442\u0438 \u044F\u043A LaTeX", "menu.copy-as-ascii-math": "\u041A\u043E\u043F\u0456\u044E\u0432\u0430\u0442\u0438 \u044F\u043A ASCII Math", "menu.copy-as-mathml": "\u041A\u043E\u043F\u0456\u044E\u0432\u0430\u0442\u0438 \u044F\u043A MathML", "menu.paste": "\u0412\u0441\u0442\u0430\u0432\u0438\u0442\u0438", "menu.select-all": "\u0412\u0438\u0431\u0440\u0430\u0442\u0438 \u0432\u0441\u0435", "color.red": "\u0427\u0435\u0440\u0432\u043E\u043D\u0438\u0439", "color.orange": "\u041F\u043E\u043C\u0430\u0440\u0430\u043D\u0447\u0435\u0432\u0438\u0439", "color.yellow": "\u0416\u043E\u0432\u0442\u0438\u0439", "color.lime": "\u041B\u0430\u0439\u043C", "color.green": "\u0417\u0435\u043B\u0435\u043D\u0438\u0439", "color.teal": "\u0411\u0456\u0440\u044E\u0437\u043E\u0432\u0438\u0439", "color.cyan": "\u0421\u0438\u043D\u044C\u043E-\u0437\u0435\u043B\u0435\u043D\u0438\u0439", "color.blue": "\u0421\u0438\u043D\u0456\u0439", "color.indigo": "\u0406\u043D\u0434\u0438\u0433\u043E", "color.purple": "\u0424\u0456\u043E\u043B\u0435\u0442\u043E\u0432\u0438\u0439", "color.magenta": "\u041F\u0443\u0440\u043F\u0443\u0440\u043D\u0438\u0439", "color.black": "\u0427\u043E\u0440\u043D\u0438\u0439", "color.dark-grey": "\u0422\u0435\u043C\u043D\u043E-\u0441\u0456\u0440\u0438\u0439", "color.grey": "\u0421\u0456\u0440\u0438\u0439", "color.light-grey": "\u0421\u0432\u0456\u0442\u043B\u043E-\u0441\u0456\u0440\u0438\u0439", "color.white": "\u0411\u0456\u043B\u0438\u0439" }, "zh-cn": { "keyboard.tooltip.symbols": "\u7B26\u53F7", "keyboard.tooltip.greek": "\u5E0C\u814A\u5B57\u6BCD", "keyboard.tooltip.numeric": "\u6570\u5B57", "keyboard.tooltip.alphabetic": "\u7F57\u9A6C\u5B57\u6BCD", "tooltip.copy to clipboard": "\u590D\u5236\u5230\u526A\u8D34\u677F", "tooltip.redo": "\u91CD\u505A", "tooltip.toggle virtual keyboard": "\u5207\u6362\u865A\u62DF\u952E\u76D8", "tooltip.undo": "\u64A4\u6D88", "menu.insert matrix": "\u63D2\u5165\u77E9\u9635", "menu.borders": "\u77E9\u9635\u5206\u9694\u7B26", "menu.array.add row above": "\u5728\u540E\u9762\u6DFB\u52A0\u884C", "menu.array.add row below": "\u5728\u524D\u9762\u6DFB\u52A0\u884C", "menu.array.add column after": "\u5728\u540E\u9762\u6DFB\u52A0\u5217r", "menu.array.add column before": "\u5728\u524D\u9762\u6DFB\u52A0\u5217", "menu.array.delete row": "\u5220\u9664\u884C", "menu.array.delete rows": "\u5220\u9664\u9009\u5B9A\u884C", "menu.array.delete column": "\u5220\u9664\u5217", "menu.array.delete columns": "\u5220\u9664\u9009\u5B9A\u7684\u5217", "menu.mode": "\u6A21\u5F0F", "menu.mode-math": "\u6570\u5B66", "menu.mode-text": "\u6587\u672C", "menu.mode-latex": "LaTeX", "tooltip.blackboard": "\u9ED1\u677F", "tooltip.bold": "\u7C97\u4F53", "tooltip.italic": "\u659C\u4F53", "tooltip.fraktur": "Fraktur", "tooltip.script": "\u811A\u672C", "tooltip.caligraphic": "\u8349\u4E66", "tooltip.typewriter": "\u6253\u5B57\u673A", "tooltip.roman-upright": "\u7F57\u9A6C\u76F4\u7ACB", "tooltip.row-by-col": "%@ \xD7 %@", "menu.font-style": "\u5B57\u4F53\u6837\u5F0F", "menu.accent": "\u91CD\u97F3", "menu.decoration": "\u88C5\u9970", "menu.color": "\u989C\u8272", "menu.background-color": "\u80CC\u666F", "menu.evaluate": "\u8BA1\u7B97", "menu.simplify": "\u7B80\u5316", "menu.solve": "\u6C42\u89E3", "menu.solve-for": "\u6C42\u89E3 %@", "menu.cut": "\u526A\u5207", "menu.copy": "\u590D\u5236", "menu.copy-as-latex": "\u590D\u5236\u4E3A LaTeX", "menu.copy-as-ascii-math": "\u590D\u5236\u4E3A ASCII Math", "menu.copy-as-mathml": "\u590D\u5236\u4E3A MathML", "menu.paste": "\u7C98\u8D34", "menu.select-all": "\u5168\u9009", "color.red": "\u7EA2\u8272", "color.orange": "\u6A59\u8272", "color.yellow": "\u9EC4\u8272", "color.lime": "\u7EFF\u9EC4\u8272", "color.green": "\u7EFF\u8272", "color.teal": "\u9752\u8272", "color.cyan": "\u84DD\u7EFF\u8272", "color.blue": "\u84DD\u8272", "color.indigo": "\u975B\u84DD\u8272", "color.purple": "\u7D2B\u8272", "color.magenta": "\u6D0B\u7EA2\u8272", "color.black": "\u9ED1\u8272", "color.dark-grey": "\u6DF1\u7070\u8272", "color.grey": "\u7070\u8272", "color.light-grey": "\u6D45\u7070\u8272", "color.white": "\u767D\u8272" }, "zh-tw": { "keyboard.tooltip.symbols": "\u7B26\u865F", "keyboard.tooltip.greek": "\u5E0C\u81D8\u5B57\u6BCD", "keyboard.tooltip.numeric": "\u6578\u5B57", "keyboard.tooltip.alphabetic": "\u7F85\u99AC\u5B57\u6BCD", "tooltip.copy to clipboard": "\u8907\u88FD\u5230\u526A\u8CBC\u677F", "tooltip.redo": "\u91CD\u505A", "tooltip.toggle virtual keyboard": "\u5207\u63DB\u865B\u64EC\u9375\u76E4", "tooltip.undo": "\u64A4\u6D88", "menu.insert matrix": "\u63D2\u5165\u77E9\u9663", "menu.borders": "\u77E9\u9663\u5206\u9694\u7B26", "menu.array.add row above": "\u5728\u5F8C\u9762\u6DFB\u52A0\u884C", "menu.array.add row below": "\u5728\u524D\u9762\u6DFB\u52A0\u884C", "menu.array.add column after": "\u5728\u5F8C\u9762\u6DFB\u52A0\u5217", "menu.array.add column before": "\u5728\u524D\u9762\u6DFB\u52A0\u5217", "menu.array.delete row": "\u522A\u9664\u884C", "menu.array.delete rows": "\u522A\u9664\u9078\u5B9A\u884C", "menu.array.delete column": "\u522A\u9664\u5217", "menu.array.delete columns": "\u522A\u9664\u9078\u5B9A\u7684\u5217", "menu.mode": "\u6A21\u5F0F", "menu.mode-math": "\u6578\u5B78", "menu.mode-text": "\u6587\u672C", "menu.mode-latex": "LaTeX", "tooltip.blackboard": "\u9ED1\u677F", "tooltip.bold": "\u7C97\u9AD4", "tooltip.italic": "\u659C\u9AD4", "tooltip.fraktur": "Fraktur", "tooltip.script": "\u8173\u672C", "tooltip.caligraphic": "\u8349\u66F8", "tooltip.typewriter": "\u6253\u5B57\u6A5F", "tooltip.roman-upright": "\u7F85\u99AC\u76F4\u7ACB", "tooltip.row-by-col": "%@ \xD7 %@", "menu.font-style": "\u5B57\u9AD4\u6A23\u5F0F", "menu.accent": "\u91CD\u97F3", "menu.decoration": "\u88DD\u98FE", "menu.color": "\u984F\u8272", "menu.background-color": "\u80CC\u666F", "menu.evaluate": "\u8A08\u7B97", "menu.simplify": "\u7C21\u5316", "menu.solve": "\u6C42\u89E3", "menu.solve-for": "\u6C42\u89E3 %@", "menu.cut": "\u526A\u4E0B", "menu.copy": "\u8907\u88FD", "menu.copy-as-latex": "\u8907\u88FD\u70BA LaTeX", "menu.copy-as-ascii-math": "\u8907\u88FD\u70BA ASCII Math", "menu.copy-as-mathml": "\u8907\u88FD\u70BA MathML", "menu.paste": "\u8CBC\u4E0A", "menu.select-all": "\u5168\u9078", "color.red": "\u7D05\u8272", "color.orange": "\u6A59\u8272", "color.yellow": "\u9EC3\u8272", "color.lime": "\u7DA0\u9EC3\u8272", "color.green": "\u7DA0\u8272", "color.teal": "\u9752\u8272", "color.cyan": "\u85CD\u7DA0\u8272", "color.blue": "\u85CD\u8272", "color.indigo": "\u975B\u85CD\u8272", "color.purple": "\u7D2B\u8272", "color.magenta": "\u6D0B\u7D05\u8272", "color.black": "\u9ED1\u8272", "color.dark-grey": "\u6DF1\u7070\u8272", "color.grey": "\u7070\u8272", "color.light-grey": "\u6DFA\u7070\u8272", "color.white": "\u767D\u8272" } };
function fe() {
return "window" in globalThis && "document" in globalThis;
}
function go() {
return "matchMedia" in window ? window.matchMedia("(pointer: coarse)").matches : "ontouchstart" in window || navigator.maxTouchPoints > 0;
}
function Sc() {
try {
return window.self !== window.top;
} catch (t37) {
return true;
}
}
function yo() {
return typeof navigator.vibrate == "function";
}
function yt() {
var e, r;
if (!fe())
return "other";
let t37 = (r = (e = navigator.userAgentData) == null ? void 0 : e.platform) != null ? r : navigator.platform;
return /^mac/i.test(t37) ? navigator.maxTouchPoints === 5 ? "ios" : "macos" : /^win/i.test(t37) ? "windows" : /android/i.test(navigator.userAgent) ? "android" : /iphone|ipod|ipad/i.test(navigator.userAgent) ? "ios" : /\bcros\b/i.test(navigator.userAgent) ? "chromeos" : "other";
}
function Lc() {
if (!fe())
return true;
if (/firefox/i.test(navigator.userAgent)) {
let t37 = navigator.userAgent.match(/firefox\/(\d+)/i);
return t37 ? parseInt(t37[1]) >= 78 : false;
}
if (/trident/i.test(navigator.userAgent))
return false;
if (/edge/i.test(navigator.userAgent)) {
let t37 = navigator.userAgent.match(/edg\/(\d+)/i);
return t37 ? parseInt(t37[1]) >= 79 : false;
}
return true;
}
function xs() {
return HTMLElement.prototype.hasOwnProperty("popover");
}
var O = { strings: kc, _locale: "", _dirty: false, _subscribers: [], _numberFormatter: void 0, get locale() {
return O._locale || (O._locale = fe() ? navigator.language.slice(0, 5) : "en-US"), O._locale;
}, set locale(t37) {
O._locale = t37, O._numberFormatter = void 0, O.dirty = true;
}, get numberFormatter() {
return O._numberFormatter || (O._numberFormatter = new Intl.NumberFormat(O.locale)), O._numberFormatter;
}, merge(t37, e) {
if (typeof t37 == "string" && e)
O.strings[t37] = p(p({}, O.strings[t37]), e), O.dirty = true;
else
for (let r of Object.keys(t37))
O.merge(r, t37[r]);
}, get dirty() {
return O._dirty;
}, set dirty(t37) {
O._dirty || O._dirty === t37 || (O._dirty = true, setTimeout(() => {
O._dirty = false, this._subscribers.forEach((e) => e == null ? void 0 : e());
}, 0));
}, subscribe(t37) {
return O._subscribers.push(t37), O._subscribers.length - 1;
}, unsubscribe(t37) {
t37 < 0 || t37 >= O._subscribers.length || (O._subscribers[t37] = void 0);
}, update(t37) {
let e = t37.querySelectorAll("[data-l10n-tooltip]");
for (let r of e) {
let i = r.getAttribute("data-l10n-tooltip");
if (i) {
let n = P(i);
n && r.setAttribute("data-tooltip", n);
}
}
e = t37.querySelectorAll("[data-l10n-arial-label]");
for (let r of e) {
let i = r.getAttribute("data-l10n-arial-label");
if (i) {
let n = P(i);
n && r.setAttribute("aria-label", n);
}
}
} };
function P(t37, ...e) {
if (t37 === void 0)
return;
let r = "", i = O.locale;
O.strings[i] && (r = O.strings[i][t37]);
let n = i.slice(0, 2);
if (!r && O.strings[n] && (r = O.strings[n][t37]), r || (r = O.strings.en[t37]), !r)
return;
let o = /(%@|%([0-9]+)\$@)/g, a = o.exec(r), s = 0;
for (; a; ) {
if (e[s++]) {
let c = a[2] ? parseInt(a[2], 10) - 1 : s - 1, u = e[c];
typeof u == "number" && (u = O.numberFormatter.format(u)), r = r.replace(a[1], u);
}
a = o.exec(r);
}
return r = r.replace(/%%/g, "%"), r;
}
var Yp = { m0: "#3F3D99", m1: "#993D71", m2: "#998B3D", m3: "#3D9956", m4: "#3D5A99", m5: "#993D90", m6: "#996D3D", m7: "#43993D", m8: "#3D7999", m9: "#843D99" };
var Qp = { blue: "#0072BD", orange: "#D95319", yellow: "#EDB120", purple: "#7E2F8E", green: "#77AC30", cyan: "#4DBEEE", red: "#A2142F" };
var It = { red: "#fbbbb6", orange: "#ffe0c2", yellow: "#fff1c2", lime: "#d0e8b9", green: "#bceac4", teal: "#b9f1f1", cyan: "#b8e5c9", blue: "#b6d9fb", indigo: "#d1c2f0", purple: "#e3baf8", magenta: "#f9c8e0", black: "#353535", "dark-grey": "#8C8C8C", grey: "#D0D0D0", "light-grey": "#F0F0F0", white: "#ffffff" };
var zt = { red: "#d7170b", orange: "#fe8a2b", yellow: "#ffc02b", lime: "#63b215", green: "#21ba3a", teal: "#17cfcf", cyan: "#13a7ec", blue: "#0d80f2", indigo: "#63c", purple: "#a219e6", magenta: "#eb4799", black: "#000", "dark-grey": "#666", grey: "#A6A6A6", "light-grey": "#d4d5d2", white: "#ffffff" };
var Ac = { Red: "red", Orange: "orange", Yellow: "yellow", LimeGreen: "lime", Green: "green", TealBlue: "teal", Blue: "blue", Violet: "indigo", Purple: "purple", Magenta: "magenta", Black: "black", Gray: "grey", White: "white" };
var eh = { Apricot: "#FBB982", Aquamarine: "#00B5BE", Bittersweet: "#C04F17", Black: "#221E1F", Blue: "#2D2F92", BlueGreen: "#00B3B8", BlueViolet: "#473992", BrickRed: "#B6321C", Brown: "#792500", BurntOrange: "#F7921D", CadetBlue: "#74729A", CarnationPink: "#F282B4", Cerulean: "#00A2E3", CornflowerBlue: "#41B0E4", Cyan: "#00AEEF", Dandelion: "#FDBC42", DarkOrchid: "#A4538A", Emerald: "#00A99D", ForestGreen: "#009B55", Fuchsia: "#8C368C", Goldenrod: "#FFDF42", Gray: "#949698", Green: "#00A64F", GreenYellow: "#DFE674", JungleGreen: "#00A99A", Lavender: "#F49EC4", Limegreen: "#8DC73E", Magenta: "#EC008C", Mahogany: "#A9341F", Maroon: "#AF3235", Melon: "#F89E7B", MidnightBlue: "#006795", Mulberry: "#A93C93", NavyBlue: "#006EB8", OliveGreen: "#3C8031", Orange: "#F58137", OrangeRed: "#ED135A", Orchid: "#AF72B0", Peach: "#F7965A", Periwinkle: "#7977B8", PineGreen: "#008B72", Plum: "#92268F", ProcessBlue: "#00B0F0", Purple: "#99479B", RawSienna: "#974006", Red: "#ED1B23", RedOrange: "#F26035", RedViolet: "#A1246B", Rhodamine: "#EF559F", RoyalBlue: "#0071BC", RoyalPurple: "#613F99", RubineRed: "#ED017D", Salmon: "#F69289", SeaGreen: "#3FBC9D", Sepia: "#671800", SkyBlue: "#46C5DD", SpringGreen: "#C6DC67", Tan: "#DA9D76", TealBlue: "#00AEB3", Thistle: "#D883B7", Turquoise: "#00B4CE", Violet: "#58429B", VioletRed: "#EF58A0", White: "#FFFFFF", WildStrawberry: "#EE2967", Yellow: "#FFF200", YellowGreen: "#98CC70", YellowOrange: "#FAA21A" };
function Tr(t37) {
var u, d, m, h, f, b;
let e = t37.split("!"), r, i, n, o = 255, a = 255, s = 255, l = -1, c = e.length > 0 && e[0].startsWith("-");
c && (e[0] = e[0].slice(1));
for (let S = 0; S < e.length; S++) {
r = o, i = a, n = s;
let M = (u = e[S].trim().match(/^([A-Za-z\d-]+)/)) == null ? void 0 : u[1], x = M == null ? void 0 : M.toLowerCase(), v = M && (b = (f = (h = (m = (d = zt[x]) != null ? d : zt[Ac[M]]) != null ? m : Qp[M]) != null ? h : eh[M]) != null ? f : Yp[M]) != null ? b : e[S].trim(), k = v.match(/^#([\da-f]{2})([\da-f]{2})([\da-f]{2})$/i);
if (k != null && k[1] && k[2] && k[3])
o = Math.max(0, Math.min(255, Number.parseInt(k[1], 16))), a = Math.max(0, Math.min(255, Number.parseInt(k[2], 16))), s = Math.max(0, Math.min(255, Number.parseInt(k[3], 16)));
else if (k = v.match(/^#([\da-f]{3})$/i), k != null && k[1]) {
let C = Number.parseInt(k[1][0], 16), q = Number.parseInt(k[1][1], 16), B = Number.parseInt(k[1][2], 16);
o = Math.max(0, Math.min(255, C * 16 + C)), a = Math.max(0, Math.min(255, q * 16 + q)), s = Math.max(0, Math.min(255, B * 16 + B));
} else if (k = v.match(/^rgb\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/i), k != null && k[1] && k[2] && k[3])
o = Math.max(0, Math.min(255, Number.parseInt(k[1]))), a = Math.max(0, Math.min(255, Number.parseInt(k[2]))), s = Math.max(0, Math.min(255, Number.parseInt(k[3])));
else
return;
l >= 0 && (o = (1 - l) * o + l * r, a = (1 - l) * a + l * i, s = (1 - l) * s + l * n, l = -1), S + 1 < e.length && (l = Math.max(0, Math.min(100, Number.parseInt(e[++S]))) / 100);
}
return l >= 0 && (o = l * o + (1 - l) * r, a = l * a + (1 - l) * i, s = l * s + (1 - l) * n), c && (o = 255 - o, a = 255 - a, s = 255 - s), "#" + ("00" + Math.round(o).toString(16)).slice(-2) + ("00" + Math.round(a).toString(16)).slice(-2) + ("00" + Math.round(s).toString(16)).slice(-2);
}
function gi(t37) {
var e, r;
return t37 = t37.trim(), (r = (e = It[t37.toLowerCase()]) != null ? e : It[Ac[t37]]) != null ? r : Tr(t37);
}
function th(t37) {
if (!t37 || t37[0] !== "#")
return;
t37 = t37.slice(1);
let e;
return t37.length <= 4 ? (e = { r: parseInt(t37[0] + t37[0], 16), g: parseInt(t37[1] + t37[1], 16), b: parseInt(t37[2] + t37[2], 16) }, t37.length === 4 && (e.a = parseInt(t37[3] + t37[3], 16) / 255)) : (e = { r: parseInt(t37[0] + t37[1], 16), g: parseInt(t37[2] + t37[3], 16), b: parseInt(t37[4] + t37[5], 16) }, t37.length === 8 && (e.a = parseInt(t37[6] + t37[7], 16) / 255)), e && e.a === void 0 && (e.a = 1), e;
}
function vs(t37, e, r) {
return r < 0 && (r += 6), r >= 6 && (r -= 6), r < 1 ? (e - t37) * r + t37 : r < 3 ? e : r < 4 ? (e - t37) * (4 - r) + t37 : t37;
}
function rh(t37) {
let [e, r, i] = [t37.h, t37.s, t37.l];
e = (e + 360) % 360 / 60, i = Math.max(0, Math.min(i, 1)), r = Math.max(0, Math.min(r, 1));
let n = i <= 0.5 ? i * (r + 1) : i + r - i * r, o = i * 2 - n;
return { r: Math.round(255 * vs(o, n, e + 2)), g: Math.round(255 * vs(o, n, e)), b: Math.round(255 * vs(o, n, e - 2)) };
}
function _s(t37) {
return t37 < 0 ? 0 : t37 > 255 ? 255 : Math.round(t37);
}
function ih(t37) {
let { r: e, g: r, b: i } = t37, n = ((1 << 24) + (_s(e) << 16) + (_s(r) << 8) + _s(i)).toString(16).slice(1);
return n[0] === n[1] && n[2] === n[3] && n[4] === n[5] && n[6] === n[7] && (n = n[0] + n[2] + n[4]), "#" + n;
}
function nh(t37) {
let { r: e, g: r, b: i } = t37;
e = e / 255, r = r / 255, i = i / 255;
let n = Math.min(e, r, i), o = Math.max(e, r, i), a = o - n, s, l;
o === n ? s = 0 : e === o ? s = (r - i) / a : r === o ? s = 2 + (i - e) / a : i === o && (s = 4 + (e - r) / a), s = Math.min(s * 60, 360), s < 0 && (s += 360);
let c = (n + o) / 2;
return o === n ? l = 0 : c <= 0.5 ? l = a / (o + n) : l = a / (2 - o - n), { h: s, s: l, l: c };
}
function Cc(t37) {
let e = th(t37);
if (!e)
return t37;
let { h: r, s: i, l: n } = nh(e);
return i += 0.1, n -= 0.1, ih(rh({ h: r, s: i, l: n }));
}
var ws = { 60: "\\lt", 62: "\\gt", 111: "o", 38: "\\&", 123: "\\lbrace", 125: "\\rbrace", 91: "\\lbrack", 93: "\\rbrack", 58: "\\colon", 160: "~", 172: "\\neg", 183: "\\cdot", 188: "\\frac{1}{4}", 189: "\\frac{1}{2}", 190: "\\frac{3}{4}", 8304: "^{0}", 8305: "^{i}", 185: "^{1}", 178: "^{2}", 179: "^{3}", 8224: "\\dagger", 8225: "\\ddagger", 8230: "\\ldots", 8308: "^{4}", 8309: "^{5}", 8310: "^{6}", 8311: "^{7}", 8312: "^{8}", 8313: "^{9}", 8314: "^{+}", 8315: "^{-}", 8316: "^{=}", 8319: "^{n}", 8320: "_{0}", 8321: "_{1}", 8322: "_{2}", 8323: "_{3}", 8324: "_{4}", 8325: "_{5}", 8326: "_{6}", 8327: "_{7}", 8328: "_{8}", 8329: "_{9}", 8330: "_{+}", 8331: "_{-}", 8332: "_{=}", 8336: "_{a}", 8337: "_{e}", 8338: "_{o}", 8339: "_{x}", 8242: "\\prime", 39: "\\prime", 8592: "\\gets", 8594: "\\to", 9651: "\\triangle", 9661: "\\triangledown", 8715: "\\owns", 8727: "\\ast", 8739: "\\vert", 8741: "\\Vert", 8743: "\\land", 8744: "\\lor", 8901: "\\cdot", 8904: "\\bowtie", 8800: "\\ne", 8804: "\\le", 8805: "\\ge", 8869: "\\bot", 10231: "\\biconditional", 10232: "\\impliedby", 10233: "\\implies", 10234: "\\iff", 8450: "\\mathbb{C}", 8469: "\\mathbb{N}", 8473: "\\mathbb{P}", 8474: "\\mathbb{Q}", 8477: "\\mathbb{R}", 8484: "\\mathbb{Z}", 8461: "\\mathbb{H}", 8476: "\\Re", 8465: "\\Im", 42: "\\ast", 11036: "\\square", 9633: "\\square", 8720: "\\coprod", 8716: "\\not\\ni", 9671: "\\diamond", 8846: "\\uplus", 8851: "\\sqcap", 8852: "\\sqcup", 8768: "\\wr", 8750: "\\oint", 8226: "\\textbullet", 8722: "-", 978: "\\Upsilon" };
var Ms = { 119893: 8462, 119965: 8492, 119968: 8496, 119969: 8497, 119971: 8459, 119972: 8464, 119975: 8466, 119976: 8499, 119981: 8475, 119994: 8495, 119996: 8458, 120004: 8500, 120070: 8493, 120075: 8460, 120076: 8465, 120085: 8476, 120093: 8488, 120122: 8450, 120127: 8461, 120133: 8469, 120135: 8473, 120136: 8474, 120137: 8477, 120145: 8484 };
var Ec = [{ start: 119808, len: 26, offset: 65, style: "bold" }, { start: 119834, len: 26, offset: 97, style: "bold" }, { start: 120488, len: 25, offset: 913, style: "bold" }, { start: 120514, len: 25, offset: 945, style: "bold" }, { start: 119860, len: 26, offset: 65, style: "italic" }, { start: 119886, len: 26, offset: 97, style: "italic" }, { start: 120546, len: 25, offset: 913, style: "italic" }, { start: 120572, len: 25, offset: 945, style: "italic" }, { start: 119912, len: 26, offset: 65, style: "bolditalic" }, { start: 119938, len: 26, offset: 97, style: "bolditalic" }, { start: 120604, len: 25, offset: 913, style: "bolditalic" }, { start: 120630, len: 25, offset: 945, style: "bolditalic" }, { start: 120782, len: 10, offset: 48, variant: "main", style: "bold" }, { start: 119964, len: 26, offset: 65, variant: "script" }, { start: 119990, len: 26, offset: 97, variant: "script" }, { start: 120016, len: 26, offset: 65, variant: "script", style: "bold" }, { start: 120042, len: 26, offset: 97, variant: "script", style: "bold" }, { start: 120068, len: 26, offset: 65, variant: "fraktur" }, { start: 120094, len: 26, offset: 97, variant: "fraktur" }, { start: 120172, len: 26, offset: 65, variant: "fraktur", style: "bold" }, { start: 120198, len: 26, offset: 97, variant: "fraktur", style: "bold" }, { start: 120120, len: 26, offset: 65, variant: "double-struck" }, { start: 120146, len: 26, offset: 97, variant: "double-struck" }, { start: 120792, len: 10, offset: 48, variant: "double-struck" }, { start: 120432, len: 26, offset: 65, variant: "monospace" }, { start: 120458, len: 26, offset: 97, variant: "monospace" }, { start: 120822, len: 10, offset: 48, variant: "monospace" }, { start: 120224, len: 26, offset: 65, variant: "sans-serif" }, { start: 120250, len: 26, offset: 97, variant: "sans-serif" }, { start: 120276, len: 26, offset: 65, variant: "sans-serif", style: "bold" }, { start: 120302, len: 26, offset: 97, variant: "sans-serif", style: "bold" }, { start: 120328, len: 26, offset: 65, variant: "sans-serif", style: "italic" }, { start: 120354, len: 26, offset: 97, variant: "sans-serif", style: "italic" }, { start: 120380, len: 26, offset: 65, variant: "sans-serif", style: "bolditalic" }, { start: 120406, len: 26, offset: 97, variant: "sans-serif", style: "bolditalic" }, { start: 120662, len: 25, offset: 913, variant: "sans-serif", style: "bold" }, { start: 120688, len: 25, offset: 945, variant: "sans-serif", style: "bold" }, { start: 120720, len: 25, offset: 913, variant: "sans-serif", style: "bolditalic" }, { start: 120746, len: 25, offset: 945, variant: "sans-serif", style: "bolditalic" }, { start: 120803, len: 10, offset: 48, variant: "sans-serif" }, { start: 120812, len: 10, offset: 48, variant: "sans-serif", style: "bold" }];
function gn(t37, e, r) {
if (!/[A-Za-z\d]/.test(t37) || (r === "up" && (r = void 0), !e && !r))
return;
let i = t37.codePointAt(0);
if (i === void 0)
return t37;
for (let n of Ec)
if ((!e || n.variant === e) && (!r || n.style === r) && i >= n.offset && i < n.offset + n.len) {
let o = n.start + i - n.offset;
return String.fromCodePoint(Ms[o] || o);
}
}
function oh(t37) {
var e;
if ((t37 < 119808 || t37 > 120831) && (t37 < 8448 || t37 > 8527))
return { char: String.fromCodePoint(t37) };
for (let r in Ms)
if (Ms[r] === t37) {
t37 = (e = r.codePointAt(0)) != null ? e : 0;
break;
}
for (let r of Ec)
if (t37 >= r.start && t37 < r.start + r.len)
return { char: String.fromCodePoint(t37 - r.start + r.offset), variant: r.variant, style: r.style };
return { char: String.fromCodePoint(t37) };
}
function Tc(t37) {
var a;
if ("{}<>[]$&*#^_%:'\u02DC".includes(t37) || t37.length > 1)
return;
let e = (a = t37.codePointAt(0)) != null ? a : 0, r = ws[e];
if (r)
return r;
let { char: i, variant: n, style: o } = oh(e);
if (!(!n && !o)) {
switch (r = i, n) {
case "double-struck":
r = `\\mathbb{${r}}`;
break;
case "fraktur":
r = `\\mathfrak{${r}}`;
break;
case "script":
r = `\\mathscr{${r}}`;
break;
case "sans-serif":
r = `\\mathsf{${r}}`;
break;
case "monospace":
r = `\\mathtt{${r}}`;
break;
case "calligraphic":
r = `\\mathcal{${r}}`;
break;
}
switch (o) {
case "bold":
r = `\\mathbf{${r}}`;
break;
case "italic":
r = `\\mathit{${r}}`;
break;
case "bolditalic":
r = `\\mathbfit{${r}}`;
break;
}
return r;
}
}
function A(t37) {
return t37 ? Array.isArray(t37) ? t37 : typeof t37 == "object" && "group" in t37 ? t37.group : [] : [];
}
var yn = {};
var xo = p({}, ws);
var bi = {};
var Ss = {};
var ah = { darr: "\\downarrow", dArr: "\\Downarrow", Darr: "\\Downarrow", lang: "\\langle", rang: "\\rangle", uarr: "\\uparrow", uArr: "\\Uparrow", Uarr: "\\Uparrow", N: "\\mathbb{N}", R: "\\mathbb{R}", Z: "\\mathbb{Z}", alef: "\\aleph", alefsym: "\\aleph", Alpha: "\\mathrm{A}", Beta: "\\mathrm{B}", bull: "\\bullet", Chi: "\\mathrm{X}", clubs: "\\clubsuit", cnums: "\\mathbb{C}", Complex: "\\mathbb{C}", Dagger: "\\ddagger", diamonds: "\\diamondsuit", empty: "\\emptyset", Epsilon: "\\mathrm{E}", Eta: "\\mathrm{H}", exist: "\\exists", harr: "\\leftrightarrow", hArr: "\\Leftrightarrow", Harr: "\\Leftrightarrow", hearts: "\\heartsuit", image: "\\Im", infin: "\\infty", Iota: "\\mathrm{I}", isin: "\\in", Kappa: "\\mathrm{K}", larr: "\\leftarrow", lArr: "\\Leftarrow", Larr: "\\Leftarrow", lrarr: "\\leftrightarrow", lrArr: "\\Leftrightarrow", Lrarr: "\\Leftrightarrow", Mu: "\\mathrm{M}", natnums: "\\mathbb{N}", Nu: "\\mathrm{N}", Omicron: "\\mathrm{O}", plusmn: "\\pm", rarr: "\\rightarrow", rArr: "\\Rightarrow", Rarr: "\\Rightarrow", real: "\\Re", reals: "\\mathbb{R}", Reals: "\\mathbb{R}", Rho: "\\mathrm{P}", sdot: "\\cdot", sect: "\\S", spades: "\\spadesuit", sub: "\\subset", sube: "\\subseteq", supe: "\\supseteq", Tau: "\\mathrm{T}", thetasym: "\\vartheta", weierp: "\\wp", Zeta: "\\mathrm{Z}" };
var sh = { varGamma: "\\mathit{\\Gamma}", varDelta: "\\mathit{\\Delta}", varTheta: "\\mathit{\\Theta}", varLambda: "\\mathit{\\Lambda}", varXi: "\\mathit{\\Xi}", varPi: "\\mathit{\\Pi}", varSigma: "\\mathit{\\Sigma}", varUpsilon: "\\mathit{\\Upsilon}", varPhi: "\\mathit{\\Phi}", varPsi: "\\mathit{\\Psi}", varOmega: "\\mathit{\\Omega}", pmod: { def: "\\quad(\\operatorname{mod}\\ #1)", args: 1, expand: false, captureSelection: false }, mod: { def: "\\quad\\operatorname{mod}\\,\\,#1", args: 1, expand: false }, bmod: { def: "\\;\\mathbin{\\operatorname{mod }}", expand: false } };
var lh = { bra: { def: "\\mathinner{\\langle{#1}|}", args: 1, captureSelection: false }, ket: { def: "\\mathinner{|{#1}\\rangle}", args: 1, captureSelection: false }, braket: { def: "\\mathinner{\\langle{#1}\\rangle}", args: 1, captureSelection: false }, set: { def: "\\mathinner{\\lbrace #1 \\rbrace}", args: 1, captureSelection: false }, Bra: { def: "\\left\\langle #1\\right|", args: 1, captureSelection: false }, Ket: { def: "\\left|#1\\right\\rangle", args: 1, captureSelection: false }, Braket: { def: "\\left\\langle{#1}\\right\\rangle", args: 1, captureSelection: false }, Set: { def: "\\left\\lbrace #1 \\right\\rbrace", args: 1, captureSelection: false } };
var ch = { iff: { primitive: true, captureSelection: true, def: '\\;\\char"27FA\\;' }, nicefrac: "^{#1}\\!\\!/\\!_{#2}", phase: { def: "\\enclose{phasorangle}{#1}", args: 1, captureSelection: false }, rd: "\\mathrm{d}", rD: "\\mathrm{D}", doubleStruckCapitalN: "\\mathbb{N}", doubleStruckCapitalR: "\\mathbb{R}", doubleStruckCapitalQ: "\\mathbb{Q}", doubleStruckCapitalZ: "\\mathbb{Z}", doubleStruckCapitalP: "\\mathbb{P}", scriptCapitalE: "\\mathscr{E}", scriptCapitalH: "\\mathscr{H}", scriptCapitalL: "\\mathscr{L}", gothicCapitalC: "\\mathfrak{C}", gothicCapitalH: "\\mathfrak{H}", gothicCapitalI: "\\mathfrak{I}", gothicCapitalR: "\\mathfrak{R}", imaginaryI: "\\mathrm{i}", imaginaryJ: "\\mathrm{j}", exponentialE: "\\mathrm{e}", differentialD: "\\mathrm{d}", capitalDifferentialD: "\\mathrm{D}", mathstrut: { def: "\\vphantom{(}", primitive: true }, angl: "\\enclose{actuarial}{#1}", angln: "\\enclose{actuarial}{n}", anglr: "\\enclose{actuarial}{r}", anglk: "\\enclose{actuarial}{k}", mathtools: { primitive: true, package: { ordinarycolon: ":", vcentcolon: "\\mathrel{\\mathop\\ordinarycolon}", dblcolon: '{\\mathop{\\char"2237}}', coloneqq: '{\\mathop{\\char"2254}}', Coloneqq: '{\\mathop{\\char"2237\\char"3D}}', coloneq: '{\\mathop{\\char"3A\\char"2212}}', Coloneq: '{\\mathop{\\char"2237\\char"2212}}', eqqcolon: '{\\mathop{\\char"2255}}', Eqqcolon: '{\\mathop{\\char"3D\\char"2237}}', eqcolon: '{\\mathop{\\char"2239}}', Eqcolon: '{\\mathop{\\char"2212\\char"2237}}', colonapprox: '{\\mathop{\\char"003A\\char"2248}}', Colonapprox: '{\\mathop{\\char"2237\\char"2248}}', colonsim: '{\\mathop{\\char"3A\\char"223C}}', Colonsim: '{\\mathop{\\char"2237\\char"223C}}', colondash: "\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}", Colondash: "\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}", dashcolon: "\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\vcentcolon}", Dashcolon: "\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\dblcolon}" } }, ratio: "\\vcentcolon", coloncolon: "\\dblcolon", colonequals: "\\coloneq", coloncolonequals: "\\Coloneq", equalscolon: "\\eqcolon", equalscoloncolon: "\\Eqcolon", colonminus: "\\colondash", coloncolonminus: "\\Colondash", minuscolon: "\\dashcolon", minuscoloncolon: "\\Dashcolon", coloncolonapprox: "\\Colonapprox", coloncolonsim: "\\Colonsim", simcolon: "\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\vcentcolon}", Simcolon: "\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\dblcolon}", simcoloncolon: "\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\dblcolon}", approxcolon: "\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\vcentcolon}", Approxcolon: "\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\dblcolon}", approxcoloncolon: "\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\dblcolon}", notni: "\\mathrel{\\char`\u220C}", limsup: "\\operatorname*{lim\\,sup}", liminf: "\\operatorname*{lim\\,inf}", injlim: "\\operatorname*{inj\\,lim}", projlim: "\\operatorname*{proj\\,lim}", varlimsup: "\\operatorname*{\\overline{lim}}", varliminf: "\\operatorname*{\\underline{lim}}", varinjlim: "\\operatorname*{\\underrightarrow{lim}}", varprojlim: "\\operatorname*{\\underleftarrow{lim}}", argmin: "\\operatorname*{arg\\,min}", argmax: "\\operatorname*{arg\\,max}", plim: "\\mathop{\\operatorname{plim}}\\limits", tripledash: { def: "\\vphantom{-}\\raise{4mu}{\\mkern1.5mu\\rule{2mu}{1.5mu}\\mkern{2.25mu}\\rule{2mu}{1.5mu}\\mkern{2.25mu}\\rule{2mu}{1.5mu}\\mkern{2mu}}", expand: true }, "braket.sty": { package: lh }, "amsmath.sty": { package: sh, primitive: true }, "texvc.sty": { package: ah, primitive: false } };
var yi = { " ": 32, "\\!": 33, "\\#": 35, "\\$": 36, "\\%": 37, "\\&": 38, "\\_": 95, "-": 45, "\\textunderscore": 95, "\\euro": 8364, "\\maltese": 10016, "\\{": 123, "\\}": 125, "\\textbraceleft": 123, "\\textbraceright": 125, "\\lbrace": 123, "\\rbrace": 125, "\\lbrack": 91, "\\rbrack": 93, "\\nobreakspace": 160, "\\ldots": 8230, "\\textellipsis": 8230, "\\backslash": 92, "`": 8216, "'": 8217, "``": 8220, "''": 8221, "\\degree": 176, "\\textasciicircum": 94, "\\textasciitilde": 126, "\\textasteriskcentered": 42, "\\textbackslash": 92, "\\textbullet": 8226, "\\textdollar": 36, "\\textsterling": 163, "\\textdagger": 8224, "\\textdaggerdbl": 8225, "\u2013": 8211, "\u2014": 8212, "\u2018": 8216, "\u2019": 8217, "\u201C": 8220, "\u201D": 8221, '"': 8221, "\\ss": 223, "\\ae": 230, "\\oe": 339, "\\AE": 198, "\\OE": 338, "\\O": 216, "\\i": 305, "\\j": 567, "\\aa": 229, "\\AA": 197 };
var Bc = /[\w!@*()-=+{}\[\]\\';:?/.,~<>`|$%#&^" ]/;
var vo;
var Dr;
Lc() ? (vo = new RegExp("\\p{Letter}", "u"), Dr = new RegExp("[0-9\\p{Letter}]", "u")) : (vo = /[a-zA-ZаАбБвВгГдДеЕёЁжЖзЗиИйЙкКлЛмМнНоОпПрРсСтТуУфФхХцЦчЧшШщЩъЪыЫьЬэЭюЮяĄąĆćĘꣳŃńÓóŚśŹźŻżàâäôéèëêïîçùûüÿæœÀÂÄÔÉÈËÊÏΟÇÙÛÜÆŒößÖẞìíòúÌÍÒÚáñÁÑ]/, Dr = /[\da-zA-ZаАбБвВгГдДеЕёЁжЖзЗиИйЙкКлЛмМнНоОпПрРсСтТуУфФхХцЦчЧшШщЩъЪыЫьЬэЭюЮяĄąĆćĘꣳŃńÓóŚśŹźŻżàâäôéèëêïîçùûüÿæœÀÂÄÔÉÈËÊÏΟÇÙÛÜÆŒößÖẞìíòúÌÍÒÚáñÁÑ]/);
function ks(t37, e, r = "mord", i) {
e !== void 0 && (yn[t37] = { definitionType: "symbol", type: r, variant: i, codepoint: e }, xo[e] || (xo[e] = t37));
}
function me(t37, e, r) {
if (typeof t37 == "string") {
for (let i = 0; i < t37.length; i++) {
let n = t37.charAt(i);
ks(n, n.codePointAt(0));
}
return;
}
for (let [i, n, o, a] of t37)
ks(i, n, o != null ? o : e, a != null ? a : r);
}
function Ls(t37, e) {
for (let r = t37; r <= e; r++)
ks(String.fromCodePoint(r), r);
}
function Oc(t37) {
var e;
return (e = Ss[t37]) != null ? e : null;
}
function Pc(t37, e) {
var n, o;
if (e.length === 0 || e === "\\" || !e.startsWith("\\"))
return [];
let r = [];
for (let a in bi)
a.startsWith(e) && !bi[a].infix && r.push({ match: a, frequency: (n = bi[a].frequency) != null ? n : 0 });
for (let a in yn)
a.startsWith(e) && r.push({ match: a, frequency: (o = yn[a].frequency) != null ? o : 0 });
let i = e.substring(1);
for (let a of Object.keys(t37.options.macros))
a.startsWith(i) && r.push({ match: "\\" + a, frequency: 0 });
return r.sort((a, s) => {
var l, c;
return a.frequency === s.frequency ? a.match.length === s.match.length ? a.match < s.match ? -1 : 1 : a.match.length - s.match.length : ((l = s.frequency) != null ? l : 0) - ((c = a.frequency) != null ? c : 0);
}), r.map((a) => a.match);
}
function Dc(t37) {
let e = "auto", r = t37.match(/:([^=]+)/);
return r && (e = r[1].trim()), e;
}
function _o(t37) {
if (!t37)
return [];
let e = [], r = t37.split("]");
if (r[0].startsWith("[")) {
e.push({ isOptional: true, type: Dc(r[0].slice(1)) });
for (let i = 1; i <= r.length; i++)
e.push(..._o(r[i]));
} else if (r = t37.split("}"), r[0].startsWith("{")) {
e.push({ isOptional: false, type: Dc(r[0].slice(1)) });
for (let i = 1; i <= r.length; i++)
e.push(..._o(r[i]));
}
return e;
}
function As(t37) {
if (!t37)
return "";
let e = "", r = true;
for (let i of t37)
typeof i.value == "string" ? e += i.value : r = false;
return r ? e : "";
}
function Cs(t37, e) {
typeof t37 == "string" && (t37 = [t37]);
let r = { tabular: false, params: [], createAtom: e };
for (let i of t37)
Ss[i] = r;
}
function bt(t37, e, r) {
typeof t37 == "string" && (t37 = [t37]);
let n = { tabular: true, params: _o(e), createAtom: r };
for (let o of t37)
Ss[o] = n;
}
function _(t37, e, r) {
var n, o;
r || (r = {});
let i = { definitionType: "function", params: _o(e), ifMode: r.ifMode, isFunction: (n = r.isFunction) != null ? n : false, applyMode: r.applyMode, infix: (o = r.infix) != null ? o : false, parse: r.parse, createAtom: r.createAtom, applyStyle: r.applyStyle, serialize: r.serialize, render: r.render };
if (typeof t37 == "string")
bi["\\" + t37] = i;
else
for (let a of t37)
bi["\\" + a] = i;
}
var bo;
function xi(t37) {
return bo || (bo = Mo(ch)), t37 ? Mo(p(p({}, bo), t37)) : bo;
}
function Kc(t37, e) {
var r, i, n, o;
if (typeof t37 == "string") {
let a = 0, s = t37;
return /(^|[^\\])#1/.test(s) && (a = 1), /(^|[^\\])#2/.test(s) && (a = 2), /(^|[^\\])#3/.test(s) && (a = 3), /(^|[^\\])#4/.test(s) && (a = 4), /(^|[^\\])#5/.test(s) && (a = 5), /(^|[^\\])#6/.test(s) && (a = 6), /(^|[^\\])#7/.test(s) && (a = 7), /(^|[^\\])#8/.test(s) && (a = 8), /(^|[^\\])#9/.test(s) && (a = 9), { expand: (r = e == null ? void 0 : e.expand) != null ? r : true, captureSelection: (i = e == null ? void 0 : e.captureSelection) != null ? i : true, args: a, def: s };
}
return p({ expand: (n = e == null ? void 0 : e.expand) != null ? n : true, captureSelection: (o = e == null ? void 0 : e.captureSelection) != null ? o : true, args: 0 }, t37);
}
function Mo(t37) {
if (!t37)
return {};
let e = {};
for (let r of Object.keys(t37)) {
let i = t37[r];
if (i == null)
delete e[r];
else if (typeof i == "object" && "package" in i)
for (let n of Object.keys(i.package))
e[n] = Kc(i.package[n], { expand: !i.primitive, captureSelection: i.captureSelection });
else
e[r] = Kc(i);
}
return e;
}
function ee(t37, e = "math") {
if (!t37 || t37.length === 0)
return null;
let r = null;
if (t37.startsWith("\\")) {
if (r = bi[t37], r)
return !r.ifMode || r.ifMode === e ? r : null;
e === "math" ? r = yn[t37] : yi[t37] && (r = { definitionType: "symbol", type: "mord", codepoint: yi[t37] });
} else if (e === "math") {
if (r = yn[t37], !r && t37.length === 1) {
let i = Es("math", t37.codePointAt(0));
return i.startsWith("\\") ? g(p({}, ee(i, "math")), { command: i }) : null;
}
} else
yi[t37] ? r = { definitionType: "symbol", type: "mord", codepoint: yi[t37] } : e === "text" && (r = { definitionType: "symbol", type: "mord", codepoint: t37.codePointAt(0) });
return r != null ? r : null;
}
function wo(t37, e) {
if (!t37.startsWith("\\"))
return null;
let r = t37.slice(1);
return e[r];
}
function Es(t37, e) {
if (e === void 0)
return "";
if (t37 === "math" && xo[e])
return xo[e];
if (t37 === "text") {
let r = Object.keys(yi).find((i) => yi[i] === e);
return r || String.fromCodePoint(e);
}
return String.fromCodePoint(e);
}
var Ie = [0, 0.68889, 0, 0, 0.72222];
var Kr = [0, 0.68889, 0, 0, 0.66667];
var Ts = [0, 0.68889, 0, 0, 0.77778];
var ko = [0, 0.68889, 0, 0, 0.61111];
var Rc = [0.16667, 0.68889, 0, 0, 0.77778];
var bn = [0, 0.68889, 0, 0, 0.55556];
var $ = [0, 0, 0, 0, 0.25];
var Ic = [0, 0.825, 0, 0, 2.33334];
var zc = [0, 0.9, 0, 0, 2.33334];
var So = [0, 0.68889, 0, 0, 0.54028];
var Ds = [-0.03598, 0.46402, 0, 0, 0.5];
var Me = [-0.13313, 0.36687, 0, 0, 1];
var Lo = [0.01354, 0.52239, 0, 0, 1];
var Nc = [0.01354, 0.52239, 0, 0, 1.11111];
var Fc = [0, 0.54986, 0, 0, 1];
var Ao = [0, 0.69224, 0, 0, 0.5];
var Ks = [0, 0.43056, 0, 0, 1];
var Yt = [0.08198, 0.58198, 0, 0, 0.77778];
var Co = [0.19444, 0.69224, 0, 0, 0.41667];
var Eo = [0.1808, 0.675, 0, 0, 1];
var $c = [0.19444, 0.69224, 0, 0, 0.83334];
var Vc = [0.13667, 0.63667, 0, 0, 1];
var qc = [-0.064, 0.437, 0, 0, 1.334];
var Qt = [0.08167, 0.58167, 0, 0, 0.77778];
var xn = [0, 0.69224, 0, 0, 0.72222];
var Bs = [0, 0.69224, 0, 0, 0.66667];
var To = [-0.13313, 0.36687, 0, 0, 0.77778];
var Hc = [0.06062, 0.54986, 0, 0, 0.77778];
var Do = [0, 0.69224, 0, 0, 0.77778];
var vi = [0.25583, 0.75583, 0, 0, 0.77778];
var xt = [0.25142, 0.75726, 0, 0, 0.77778];
var _i = [0.20576, 0.70576, 0, 0, 0.77778];
var je = [0.30274, 0.79383, 0, 0, 0.77778];
var vn = [0.22958, 0.72958, 0, 0, 0.77778];
var Wc = [0.1808, 0.675, 0, 0, 0.77778];
var vt = [0.13667, 0.63667, 0, 0, 0.77778];
var De = [0.13597, 0.63597, 0, 0, 0.77778];
var er = [0.03517, 0.54986, 0, 0, 0.77778];
var Mi = [0, 0.675, 0, 0, 0.77778];
var Uc = [0.19444, 0.69224, 0, 0, 0.61111];
var Jc = [0, 0.54986, 0, 0, 0.76042];
var Gc = [0, 0.54986, 0, 0, 0.66667];
var tr = [0.0391, 0.5391, 0, 0, 0.77778];
var jc = [0.03517, 0.54986, 0, 0, 1.33334];
var Xc = [0.38569, 0.88569, 0, 0, 0.77778];
var Ko = [0.23222, 0.74111, 0, 0, 0.77778];
var Zc = [0.19444, 0.69224, 0, 0, 0.77778];
var Yc = [0, 0.37788, 0, 0, 0.5];
var Bo = [0, 0.54986, 0, 0, 0.72222];
var Qc = [0, 0.69224, 0, 0, 0.83334];
var eu = [0.11111, 0.69224, 0, 0, 0.66667];
var wi = [0.26167, 0.75726, 0, 0, 0.77778];
var tu = [0.48256, 0.98256, 0, 0, 0.77778];
var ru = [0.28481, 0.79383, 0, 0, 0.77778];
var iu = [0.08167, 0.58167, 0, 0, 0.22222];
var nu = [0.08167, 0.58167, 0, 0, 0.38889];
var ou = [0, 0.43056, 0.04028, 0, 0.66667];
var au = [0.41951, 0.91951, 0, 0, 0.77778];
var su = [0.24982, 0.74947, 0, 0, 0.38865];
var lu = [0.08319, 0.58283, 0, 0, 0.75623];
var cu = [0, 0.10803, 0, 0, 0.27764];
var Os = [0, 0.47534, 0, 0, 0.50181];
var _n = [0.18906, 0.47534, 0, 0, 0.50181];
var uu = [0, 0.69141, 0, 0, 0.50181];
var du = [0.24982, 0.74947, 0, 0, 0.27764];
var Ps = [0, 0.69141, 0, 0, 0.21471];
var Oo = [0.25, 0.75, 0, 0, 0.44722];
var ze = [0, 0.64444, 0, 0, 0.575];
var ki = [0.08556, 0.58556, 0, 0, 0.89444];
var Po = [0, 0.69444, 0, 0, 0.89444];
var Ro = [0, 0.68611, 0, 0, 0.9];
var Rs = [0, 0.68611, 0, 0, 0.86944];
var rr = [0.25, 0.75, 0, 0, 0.575];
var Io = [0.25, 0.75, 0, 0, 0.31944];
var Br = [0, 0.69444, 0, 0, 0.63889];
var Si = [0, 0.69444, 0, 0, 0.31944];
var mu = [0, 0.44444, 0, 0, 0.63889];
var pu = [0, 0.44444, 0, 0, 0.51111];
var ir = [0, 0.69444, 0, 0, 0.575];
var Xe = [0.13333, 0.63333, 0, 0, 0.89444];
var hu = [0, 0.44444, 0, 0, 0.31944];
var fu = [0, 0.69444, 0, 0, 0.86944];
var gu = [0, 0.68611, 0, 0, 0.69166];
var zo = [0, 0.68611, 0, 0, 0.83055];
var Is = [0, 0.68611, 0, 0, 0.89444];
var zs = [0, 0.69444, 0, 0, 0.60278];
var yu = [0.19444, 0.69444, 0, 0, 0.51111];
var bu = [0, 0.69444, 0, 0, 0.83055];
var _t = [-0.10889, 0.39111, 0, 0, 1.14999];
var xu = [0.19444, 0.69444, 0, 0, 0.575];
var Mn = [0.19444, 0.69444, 0, 0, 1.14999];
var vu = [0.19444, 0.69444, 0, 0, 0.70277];
var _u = [0.05556, 0.75, 0, 0, 0.575];
var Ns = [0, 0.68611, 0, 0, 0.95833];
var Mu = [0.08556, 0.58556, 0, 0, 0.76666];
var Fs = [-0.02639, 0.47361, 0, 0, 0.575];
var wu = [0, 0.44444, 0, 0, 0.89444];
var Or = [0, 0.55556, 0, 0, 0.76666];
var ku = [-0.10889, 0.39111, 0, 0, 0.89444];
var $s = [222e-5, 0.50222, 0, 0, 0.89444];
var nr = [0.19667, 0.69667, 0, 0, 0.89444];
var Su = [0.08556, 0.58556, 0, 0, 1.14999];
var Vs = [0, 0.69444, 0, 0, 0.70277];
var No = [-0.02778, 0.47222, 0, 0, 0.575];
var Fo = [0.25, 0.75, 0, 0, 0.51111];
var Lu = [-0.13889, 0.36111, 0, 0, 1.14999];
var Au = [0.19444, 0.69444, 0, 0, 1.02222];
var $o = [0.12963, 0.69444, 0, 0, 0.89444];
var Cu = [0.19444, 0.69444, 0, 0, 0.44722];
var or = [0, 0.64444, 0.13167, 0, 0.59111];
var Eu = [0.19444, 0.64444, 0.13167, 0, 0.59111];
var qs = [0, 0.68611, 0.17208, 0, 0.8961];
var Tu = [0.19444, 0.44444, 0.105, 0, 0.53222];
var Du = [0, 0.44444, 0.085, 0, 0.82666];
var Ku = [0, 0.69444, 0.06709, 0, 0.59111];
var Vo = [0, 0.69444, 0.12945, 0, 0.35555];
var Bu = [0, 0.69444, 0, 0, 0.94888];
var Hs = [0, 0.69444, 0.11472, 0, 0.59111];
var Ou = [0, 0.68611, 0.10778, 0, 0.88555];
var Pu = [0, 0.69444, 0.07939, 0, 0.62055];
var qo = [0, 0.69444, 0.12417, 0, 0.30667];
var ar = [0, 0.64444, 0.13556, 0, 0.51111];
var Ru = [0.19444, 0.64444, 0.13556, 0, 0.51111];
var Ho = [0, 0.68333, 0.16389, 0, 0.74333];
var Iu = [0.19444, 0.43056, 0.08847, 0, 0.46];
var zu = [0, 0.43056, 0.07514, 0, 0.71555];
var Nu = [0, 0.69444, 0.06646, 0, 0.51111];
var Fu = [0, 0.69444, 0, 0, 0.83129];
var $u = [0, 0.69444, 0.1225, 0, 0.51111];
var Vu = [0, 0.68333, 0.09403, 0, 0.76666];
var qu = [0, 0.68333, 0.11111, 0, 0.76666];
var Hu = [0, 0.69444, 0.06961, 0, 0.51444];
var Nt = [0, 0.69444, 0, 0, 0.27778];
var Li = [0.25, 0.75, 0, 0, 0.38889];
var Ne = [0, 0.64444, 0, 0, 0.5];
var Pr = [0, 0.69444, 0, 0, 0.77778];
var Rr = [0, 0.68333, 0, 0, 0.75];
var wn = [0, 0.68333, 0, 0, 0.77778];
var Wu = [0, 0.68333, 0, 0, 0.68056];
var kn = [0, 0.68333, 0, 0, 0.72222];
var Ft = [0.25, 0.75, 0, 0, 0.5];
var Wo = [0.25, 0.75, 0, 0, 0.27778];
var pe = [0, 0.69444, 0, 0, 0.5];
var Ai = [0, 0.69444, 0, 0, 0.55556];
var Ws = [0, 0.43056, 0, 0, 0.44445];
var Sn = [0, 0.43056, 0, 0, 0.5];
var Uu = [0.19444, 0.43056, 0, 0, 0.55556];
var Ju = [0, 0.43056, 0, 0, 0.55556];
var Fe = [0.08333, 0.58333, 0, 0, 0.77778];
var Gu = [0, 0.43056, 0, 0, 0.27778];
var ju = [0, 0.66786, 0, 0, 0.27778];
var Xu = [0, 0.69444, 0, 0, 0.75];
var Zu = [0, 0.66786, 0, 0, 0.5];
var Yu = [0, 0.68333, 0, 0, 0.625];
var Us = [0.19444, 0.69444, 0, 0, 0.44445];
var Ln = [0, 0.69444, 0, 0, 0.72222];
var Qu = [0.19444, 0.69444, 0, 0, 0.5];
var An = [0.19444, 0.69444, 0, 0, 1];
var ed = [0.011, 0.511, 0, 0, 1.126];
var Js = [0.19444, 0.69444, 0, 0, 0.61111];
var Gs = [0.05556, 0.75, 0, 0, 0.5];
var td = [0, 0.68333, 0, 0, 0.83334];
var rd = [0.0391, 0.5391, 0, 0, 0.66667];
var js = [-0.05555, 0.44445, 0, 0, 0.5];
var id = [0, 0.43056, 0, 0, 0.77778];
var Ir = [0, 0.55556, 0, 0, 0.66667];
var Uo = [-0.03625, 0.46375, 0, 0, 0.77778];
var nd = [-0.01688, 0.48312, 0, 0, 0.77778];
var od = [0.0391, 0.5391, 0, 0, 1];
var sr = [0, 0.69444, 0, 0, 0.61111];
var Jo = [-0.03472, 0.46528, 0, 0, 0.5];
var Go = [0.25, 0.75, 0, 0, 0.44445];
var ad = [-0.14236, 0.35764, 0, 0, 1];
var jo = [0.244, 0.744, 0, 0, 0.412];
var sd = [0.19444, 0.69444, 0, 0, 0.88889];
var Xo = [0.12963, 0.69444, 0, 0, 0.77778];
var ld = [0.19444, 0.69444, 0, 0, 0.38889];
var cd = [0.011, 0.511, 0, 0, 1.638];
var ud = [0.19444, 0.69444, 0, 0, 0];
var Zo = [0, 0.44444, 0, 0, 0.575];
var Cn = [0.19444, 0.44444, 0, 0, 0.575];
var dd = [0, 0.68611, 0, 0, 0.75555];
var md = [0, 0.69444, 0, 0, 0.66759];
var pd = [0, 0.68611, 0, 0, 0.80555];
var hd = [0, 0.68611, 0.08229, 0, 0.98229];
var fd = [0, 0.68611, 0, 0, 0.76666];
var gd = [0, 0.44444, 0, 0, 0.58472];
var yd = [0.19444, 0.44444, 0, 0, 0.6118];
var En = [0.19444, 0.43056, 0, 0, 0.5];
var bd = [0, 0.68333, 0.02778, 0.08334, 0.76278];
var xd = [0, 0.68333, 0.08125, 0.05556, 0.83125];
var vd = [0, 0.43056, 0, 0.05556, 0.48472];
var _d = [0.19444, 0.43056, 0, 0.08334, 0.51702];
var Md = [0.25, 0.75, 0, 0, 0.42778];
var xe = [0, 0.69444, 0, 0, 0.55];
var $t = [0, 0.69444, 0, 0, 0.73334];
var lr = [0, 0.69444, 0, 0, 0.79445];
var wd = [0, 0.69444, 0, 0, 0.51945];
var Xs = [0, 0.69444, 0, 0, 0.70278];
var kd = [0, 0.69444, 0, 0, 0.76389];
var Sd = [0.25, 0.75, 0, 0, 0.34306];
var Zs = [0, 0.69444, 0, 0, 0.56111];
var Ld = [0, 0.69444, 0, 0, 0.25556];
var Ad = [0.19444, 0.45833, 0, 0, 0.56111];
var Cd = [0, 0.45833, 0, 0, 0.56111];
var Yo = [0, 0.69444, 0, 0, 0.30556];
var Ed = [0, 0.69444, 0, 0, 0.58056];
var Td = [0, 0.69444, 0, 0, 0.67223];
var Ys = [0, 0.69444, 0, 0, 0.85556];
var Qs = [0, 0.69444, 0, 0, 0.55834];
var Mt = [0, 0.65556, 0.11156, 0, 0.5];
var el = [0, 0.69444, 0.08094, 0, 0.70834];
var tl = [0.17014, 0, 0, 0, 0.44445];
var Dd = [0, 0.69444, 0.0799, 0, 0.5];
var Kd = [0, 0.69444, 0, 0, 0.73752];
var Bd = [0, 0.69444, 0.09205, 0, 0.5];
var Od = [0, 0.69444, 0.09031, 0, 0.77778];
var rl = [0, 0.69444, 0.07816, 0, 0.27778];
var Pd = [0, 0.69444, 316e-5, 0, 0.5];
var Rd = [0.19444, 0.69444, 0, 0, 0.83334];
var Id = [0.05556, 0.75, 0, 0, 0.83334];
var zd = [0, 0.75, 0, 0, 0.5];
var Nd = [0.125, 0.08333, 0, 0, 0.27778];
var Fd = [0, 0.08333, 0, 0, 0.27778];
var wt = [0, 0.65556, 0, 0, 0.5];
var il = [0, 0.69444, 0, 0, 0.47222];
var Vt = [0, 0.69444, 0, 0, 0.66667];
var $d = [0, 0.69444, 0, 0, 0.59722];
var nl = [0, 0.69444, 0, 0, 0.54167];
var ol = [0, 0.69444, 0, 0, 0.70834];
var Vd = [0.25, 0.75, 0, 0, 0.28889];
var al = [0, 0.69444, 0, 0, 0.51667];
var qd = [0, 0.44444, 0, 0, 0.44445];
var Hd = [0.19444, 0.44444, 0, 0, 0.51667];
var Wd = [0, 0.44444, 0, 0, 0.38333];
var Ud = [0, 0.44444, 0, 0, 0.51667];
var Jd = [0, 0.69444, 0, 0, 0.83334];
var Gd = [0.35001, 0.85, 0, 0, 0.45834];
var jd = [0.35001, 0.85, 0, 0, 0.57778];
var Xd = [0.35001, 0.85, 0, 0, 0.41667];
var Zd = [0.35001, 0.85, 0, 0, 0.58334];
var Qo = [0, 0.72222, 0, 0, 0.55556];
var Yd = [1e-5, 0.6, 0, 0, 0.66667];
var Qd = [1e-5, 0.6, 0, 0, 0.77778];
var e0 = [0.25001, 0.75, 0, 0, 0.94445];
var t0 = [0.306, 0.805, 0.19445, 0, 0.47222];
var r0 = [0.30612, 0.805, 0.19445, 0, 0.47222];
var Ci = [0.25001, 0.75, 0, 0, 0.83334];
var Ei = [0.35001, 0.85, 0, 0, 0.47222];
var sl = [0.25001, 0.75, 0, 0, 1.11111];
var i0 = [0.65002, 1.15, 0, 0, 0.59722];
var n0 = [0.65002, 1.15, 0, 0, 0.81111];
var o0 = [0.65002, 1.15, 0, 0, 0.47222];
var a0 = [0.65002, 1.15, 0, 0, 0.66667];
var ea = [0, 0.75, 0, 0, 1];
var s0 = [0.55001, 1.05, 0, 0, 1.27778];
var l0 = [0.862, 1.36, 0.44445, 0, 0.55556];
var c0 = [0.86225, 1.36, 0.44445, 0, 0.55556];
var Ti = [0.55001, 1.05, 0, 0, 1.11111];
var ta = [0.65002, 1.15, 0, 0, 0.52778];
var u0 = [0.65002, 1.15, 0, 0, 0.61111];
var ll = [0.55001, 1.05, 0, 0, 1.51112];
var d0 = [0.95003, 1.45, 0, 0, 0.73611];
var m0 = [0.95003, 1.45, 0, 0, 1.04445];
var p0 = [0.95003, 1.45, 0, 0, 0.52778];
var ra = [0.95003, 1.45, 0, 0, 0.75];
var ia = [0, 0.75, 0, 0, 1.44445];
var na = [0.95003, 1.45, 0, 0, 0.58334];
var h0 = [1.25003, 1.75, 0, 0, 0.79167];
var f0 = [1.25003, 1.75, 0, 0, 1.27778];
var g0 = [1.25003, 1.75, 0, 0, 0.58334];
var oa = [1.25003, 1.75, 0, 0, 0.80556];
var aa = [0, 0.825, 0, 0, 1.8889];
var sa = [1.25003, 1.75, 0, 0, 0.63889];
var la = [0.64502, 1.155, 0, 0, 0.875];
var y0 = [1e-5, 0.6, 0, 0, 0.875];
var cl = [-99e-5, 0.601, 0, 0, 0.66667];
var ca = [0.64502, 1.155, 0, 0, 0.66667];
var b0 = [1e-5, 0.9, 0, 0, 0.88889];
var x0 = [0.65002, 1.15, 0, 0, 0.88889];
var v0 = [0.90001, 0, 0, 0, 0.88889];
var _0 = [-499e-5, 0.605, 0, 0, 1.05556];
var ua = [0, 0.12, 0, 0, 0.45];
var E = [0, 0.61111, 0, 0, 0.525];
var Ze = [0.08333, 0.69444, 0, 0, 0.525];
var M0 = [-0.08056, 0.53055, 0, 0, 0.525];
var w0 = [-0.05556, 0.55556, 0, 0, 0.525];
var Le = [0, 0.43056, 0, 0, 0.525];
var Tn = [0.22222, 0.43056, 0, 0, 0.525];
var k0 = [0, 0, 0, 0, 0.525];
var S0 = { "AMS-Regular": { 32: $, 65: Ie, 66: Kr, 67: Ie, 68: Ie, 69: Kr, 70: ko, 71: Ts, 72: Ts, 73: [0, 0.68889, 0, 0, 0.38889], 74: [0.16667, 0.68889, 0, 0, 0.5], 75: Ts, 76: Kr, 77: [0, 0.68889, 0, 0, 0.94445], 78: Ie, 79: Rc, 80: ko, 81: Rc, 82: Ie, 83: bn, 84: Kr, 85: Ie, 86: Ie, 87: [0, 0.68889, 0, 0, 1], 88: Ie, 89: Ie, 90: Kr, 107: bn, 160: $, 165: [0, 0.675, 0.025, 0, 0.75], 174: [0.15559, 0.69224, 0, 0, 0.94666], 240: bn, 295: So, 710: Ic, 732: zc, 770: Ic, 771: zc, 989: Qt, 1008: ou, 8245: [0, 0.54986, 0, 0, 0.275], 8463: So, 8487: Ie, 8498: bn, 8502: Kr, 8503: [0, 0.68889, 0, 0, 0.44445], 8504: Kr, 8513: [0, 0.68889, 0, 0, 0.63889], 8592: Ds, 8594: Ds, 8602: Me, 8603: Me, 8606: Lo, 8608: Lo, 8610: Nc, 8611: Nc, 8619: Fc, 8620: Fc, 8621: [-0.13313, 0.37788, 0, 0, 1.38889], 8622: Me, 8624: Ao, 8625: Ao, 8630: Ks, 8631: Ks, 8634: Yt, 8635: Yt, 8638: Co, 8639: Co, 8642: Co, 8643: Co, 8644: Eo, 8646: Eo, 8647: Eo, 8648: $c, 8649: Eo, 8650: $c, 8651: Lo, 8652: Lo, 8653: Me, 8654: Me, 8655: Me, 8666: Vc, 8667: Vc, 8669: [-0.13313, 0.37788, 0, 0, 1], 8672: qc, 8674: qc, 8705: [0, 0.825, 0, 0, 0.5], 8708: bn, 8709: Qt, 8717: [0, 0.43056, 0, 0, 0.42917], 8722: Ds, 8724: [0.08198, 0.69224, 0, 0, 0.77778], 8726: Qt, 8733: Do, 8736: xn, 8737: xn, 8738: [0.03517, 0.52239, 0, 0, 0.72222], 8739: iu, 8740: [0.25142, 0.74111, 0, 0, 0.27778], 8741: nu, 8742: [0.25142, 0.74111, 0, 0, 0.5], 8756: Bs, 8757: Bs, 8764: To, 8765: [-0.13313, 0.37788, 0, 0, 0.77778], 8769: To, 8770: Uo, 8774: je, 8776: nd, 8778: Qt, 8782: Hc, 8783: Hc, 8785: Yt, 8786: Yt, 8787: Yt, 8790: Do, 8791: vn, 8796: [0.08198, 0.91667, 0, 0, 0.77778], 8806: vi, 8807: vi, 8808: xt, 8809: xt, 8812: [0.25583, 0.75583, 0, 0, 0.5], 8814: _i, 8815: _i, 8816: je, 8817: je, 8818: vn, 8819: vn, 8822: Wc, 8823: Wc, 8828: vt, 8829: vt, 8830: vn, 8831: vn, 8832: _i, 8833: _i, 8840: je, 8841: je, 8842: De, 8843: De, 8847: er, 8848: er, 8858: Yt, 8859: Yt, 8861: Yt, 8862: Mi, 8863: Mi, 8864: Mi, 8865: Mi, 8872: [0, 0.69224, 0, 0, 0.61111], 8873: xn, 8874: [0, 0.69224, 0, 0, 0.88889], 8876: ko, 8877: ko, 8878: Ie, 8879: Ie, 8882: er, 8883: er, 8884: vt, 8885: vt, 8888: [0, 0.54986, 0, 0, 1.11111], 8890: Uu, 8891: Uc, 8892: Uc, 8901: [0, 0.54986, 0, 0, 0.27778], 8903: Qt, 8905: Qt, 8906: Qt, 8907: Do, 8908: Do, 8909: [-0.03598, 0.46402, 0, 0, 0.77778], 8910: Jc, 8911: Jc, 8912: er, 8913: er, 8914: Gc, 8915: Gc, 8916: Bs, 8918: tr, 8919: tr, 8920: jc, 8921: jc, 8922: Xc, 8923: Xc, 8926: vt, 8927: vt, 8928: je, 8929: je, 8934: Ko, 8935: Ko, 8936: Ko, 8937: Ko, 8938: _i, 8939: _i, 8940: je, 8941: je, 8994: Zc, 8995: Zc, 9416: [0.15559, 0.69224, 0, 0, 0.90222], 9484: Ao, 9488: Ao, 9492: Yc, 9496: Yc, 9585: [0.19444, 0.68889, 0, 0, 0.88889], 9586: [0.19444, 0.74111, 0, 0, 0.88889], 9632: Mi, 9633: Mi, 9650: Bo, 9651: Bo, 9654: er, 9660: Bo, 9661: Bo, 9664: er, 9674: eu, 9733: [0.19444, 0.69224, 0, 0, 0.94445], 10003: Qc, 10016: Qc, 10731: eu, 10846: [0.19444, 0.75583, 0, 0, 0.61111], 10877: vt, 10878: vt, 10885: vi, 10886: vi, 10887: De, 10888: De, 10889: wi, 10890: wi, 10891: tu, 10892: tu, 10901: vt, 10902: vt, 10933: xt, 10934: xt, 10935: wi, 10936: wi, 10937: wi, 10938: wi, 10949: vi, 10950: vi, 10955: ru, 10956: ru, 57350: iu, 57351: nu, 57352: Qt, 57353: ou, 57356: xt, 57357: xt, 57358: au, 57359: je, 57360: je, 57361: au, 57366: xt, 57367: xt, 57368: xt, 57369: xt, 57370: De, 57371: De }, "Caligraphic-Regular": { 32: $, 65: [0, 0.68333, 0, 0.19445, 0.79847], 66: [0, 0.68333, 0.03041, 0.13889, 0.65681], 67: [0, 0.68333, 0.05834, 0.13889, 0.52653], 68: [0, 0.68333, 0.02778, 0.08334, 0.77139], 69: [0, 0.68333, 0.08944, 0.11111, 0.52778], 70: [0, 0.68333, 0.09931, 0.11111, 0.71875], 71: [0.09722, 0.68333, 0.0593, 0.11111, 0.59487], 72: [0, 0.68333, 965e-5, 0.11111, 0.84452], 73: [0, 0.68333, 0.07382, 0, 0.54452], 74: [0.09722, 0.68333, 0.18472, 0.16667, 0.67778], 75: [0, 0.68333, 0.01445, 0.05556, 0.76195], 76: [0, 0.68333, 0, 0.13889, 0.68972], 77: [0, 0.68333, 0, 0.13889, 1.2009], 78: [0, 0.68333, 0.14736, 0.08334, 0.82049], 79: [0, 0.68333, 0.02778, 0.11111, 0.79611], 80: [0, 0.68333, 0.08222, 0.08334, 0.69556], 81: [0.09722, 0.68333, 0, 0.11111, 0.81667], 82: [0, 0.68333, 0, 0.08334, 0.8475], 83: [0, 0.68333, 0.075, 0.13889, 0.60556], 84: [0, 0.68333, 0.25417, 0, 0.54464], 85: [0, 0.68333, 0.09931, 0.08334, 0.62583], 86: [0, 0.68333, 0.08222, 0, 0.61278], 87: [0, 0.68333, 0.08222, 0.08334, 0.98778], 88: [0, 0.68333, 0.14643, 0.13889, 0.7133], 89: [0.09722, 0.68333, 0.08222, 0.08334, 0.66834], 90: [0, 0.68333, 0.07944, 0.13889, 0.72473], 160: $ }, "Fraktur-Regular": { 32: $, 33: [0, 0.69141, 0, 0, 0.29574], 34: Ps, 38: [0, 0.69141, 0, 0, 0.73786], 39: [0, 0.69141, 0, 0, 0.21201], 40: su, 41: su, 42: [0, 0.62119, 0, 0, 0.27764], 43: lu, 44: cu, 45: lu, 46: cu, 47: [0.24982, 0.74947, 0, 0, 0.50181], 48: Os, 49: Os, 50: Os, 51: _n, 52: _n, 53: _n, 54: uu, 55: _n, 56: uu, 57: _n, 58: [0, 0.47534, 0, 0, 0.21606], 59: [0.12604, 0.47534, 0, 0, 0.21606], 61: [-0.13099, 0.36866, 0, 0, 0.75623], 63: [0, 0.69141, 0, 0, 0.36245], 65: [0, 0.69141, 0, 0, 0.7176], 66: [0, 0.69141, 0, 0, 0.88397], 67: [0, 0.69141, 0, 0, 0.61254], 68: [0, 0.69141, 0, 0, 0.83158], 69: [0, 0.69141, 0, 0, 0.66278], 70: [0.12604, 0.69141, 0, 0, 0.61119], 71: [0, 0.69141, 0, 0, 0.78539], 72: [0.06302, 0.69141, 0, 0, 0.7203], 73: [0, 0.69141, 0, 0, 0.55448], 74: [0.12604, 0.69141, 0, 0, 0.55231], 75: [0, 0.69141, 0, 0, 0.66845], 76: [0, 0.69141, 0, 0, 0.66602], 77: [0, 0.69141, 0, 0, 1.04953], 78: [0, 0.69141, 0, 0, 0.83212], 79: [0, 0.69141, 0, 0, 0.82699], 80: [0.18906, 0.69141, 0, 0, 0.82753], 81: [0.03781, 0.69141, 0, 0, 0.82699], 82: [0, 0.69141, 0, 0, 0.82807], 83: [0, 0.69141, 0, 0, 0.82861], 84: [0, 0.69141, 0, 0, 0.66899], 85: [0, 0.69141, 0, 0, 0.64576], 86: [0, 0.69141, 0, 0, 0.83131], 87: [0, 0.69141, 0, 0, 1.04602], 88: [0, 0.69141, 0, 0, 0.71922], 89: [0.18906, 0.69141, 0, 0, 0.83293], 90: [0.12604, 0.69141, 0, 0, 0.60201], 91: du, 93: du, 94: [0, 0.69141, 0, 0, 0.49965], 97: [0, 0.47534, 0, 0, 0.50046], 98: [0, 0.69141, 0, 0, 0.51315], 99: [0, 0.47534, 0, 0, 0.38946], 100: [0, 0.62119, 0, 0, 0.49857], 101: [0, 0.47534, 0, 0, 0.40053], 102: [0.18906, 0.69141, 0, 0, 0.32626], 103: [0.18906, 0.47534, 0, 0, 0.5037], 104: [0.18906, 0.69141, 0, 0, 0.52126], 105: [0, 0.69141, 0, 0, 0.27899], 106: [0, 0.69141, 0, 0, 0.28088], 107: [0, 0.69141, 0, 0, 0.38946], 108: [0, 0.69141, 0, 0, 0.27953], 109: [0, 0.47534, 0, 0, 0.76676], 110: [0, 0.47534, 0, 0, 0.52666], 111: [0, 0.47534, 0, 0, 0.48885], 112: [0.18906, 0.52396, 0, 0, 0.50046], 113: [0.18906, 0.47534, 0, 0, 0.48912], 114: [0, 0.47534, 0, 0, 0.38919], 115: [0, 0.47534, 0, 0, 0.44266], 116: [0, 0.62119, 0, 0, 0.33301], 117: [0, 0.47534, 0, 0, 0.5172], 118: [0, 0.52396, 0, 0, 0.5118], 119: [0, 0.52396, 0, 0, 0.77351], 120: [0.18906, 0.47534, 0, 0, 0.38865], 121: [0.18906, 0.47534, 0, 0, 0.49884], 122: [0.18906, 0.47534, 0, 0, 0.39054], 160: $, 8216: Ps, 8217: Ps, 58112: [0, 0.62119, 0, 0, 0.49749], 58113: [0, 0.62119, 0, 0, 0.4983], 58114: [0.18906, 0.69141, 0, 0, 0.33328], 58115: [0.18906, 0.69141, 0, 0, 0.32923], 58116: [0.18906, 0.47534, 0, 0, 0.50343], 58117: [0, 0.69141, 0, 0, 0.33301], 58118: [0, 0.62119, 0, 0, 0.33409], 58119: [0, 0.47534, 0, 0, 0.50073] }, "Main-Bold": { 32: $, 33: [0, 0.69444, 0, 0, 0.35], 34: zs, 35: [0.19444, 0.69444, 0, 0, 0.95833], 36: _u, 37: [0.05556, 0.75, 0, 0, 0.95833], 38: Po, 39: Si, 40: Oo, 41: Oo, 42: [0, 0.75, 0, 0, 0.575], 43: Xe, 44: [0.19444, 0.15556, 0, 0, 0.31944], 45: Wd, 46: [0, 0.15556, 0, 0, 0.31944], 47: rr, 48: ze, 49: ze, 50: ze, 51: ze, 52: ze, 53: ze, 54: ze, 55: ze, 56: ze, 57: ze, 58: hu, 59: [0.19444, 0.44444, 0, 0, 0.31944], 60: ki, 61: ku, 62: ki, 63: [0, 0.69444, 0, 0, 0.54305], 64: Po, 65: Rs, 66: [0, 0.68611, 0, 0, 0.81805], 67: zo, 68: [0, 0.68611, 0, 0, 0.88194], 69: dd, 70: [0, 0.68611, 0, 0, 0.72361], 71: [0, 0.68611, 0, 0, 0.90416], 72: Ro, 73: [0, 0.68611, 0, 0, 0.43611], 74: [0, 0.68611, 0, 0, 0.59444], 75: [0, 0.68611, 0, 0, 0.90138], 76: gu, 77: [0, 0.68611, 0, 0, 1.09166], 78: Ro, 79: [0, 0.68611, 0, 0, 0.86388], 80: [0, 0.68611, 0, 0, 0.78611], 81: [0.19444, 0.68611, 0, 0, 0.86388], 82: [0, 0.68611, 0, 0, 0.8625], 83: [0, 0.68611, 0, 0, 0.63889], 84: [0, 0.68611, 0, 0, 0.8], 85: [0, 0.68611, 0, 0, 0.88472], 86: [0, 0.68611, 0.01597, 0, 0.86944], 87: [0, 0.68611, 0.01597, 0, 1.18888], 88: Rs, 89: [0, 0.68611, 0.02875, 0, 0.86944], 90: [0, 0.68611, 0, 0, 0.70277], 91: Io, 92: rr, 93: Io, 94: ir, 95: [0.31, 0.13444, 0.03194, 0, 0.575], 97: [0, 0.44444, 0, 0, 0.55902], 98: Br, 99: pu, 100: Br, 101: [0, 0.44444, 0, 0, 0.52708], 102: [0, 0.69444, 0.10903, 0, 0.35139], 103: [0.19444, 0.44444, 0.01597, 0, 0.575], 104: Br, 105: Si, 106: [0.19444, 0.69444, 0, 0, 0.35139], 107: [0, 0.69444, 0, 0, 0.60694], 108: Si, 109: [0, 0.44444, 0, 0, 0.95833], 110: mu, 111: Zo, 112: [0.19444, 0.44444, 0, 0, 0.63889], 113: [0.19444, 0.44444, 0, 0, 0.60694], 114: [0, 0.44444, 0, 0, 0.47361], 115: [0, 0.44444, 0, 0, 0.45361], 116: [0, 0.63492, 0, 0, 0.44722], 117: mu, 118: [0, 0.44444, 0.01597, 0, 0.60694], 119: [0, 0.44444, 0.01597, 0, 0.83055], 120: [0, 0.44444, 0, 0, 0.60694], 121: [0.19444, 0.44444, 0.01597, 0, 0.60694], 122: pu, 123: rr, 124: Io, 125: rr, 126: [0.35, 0.34444, 0, 0, 0.575], 160: $, 163: [0, 0.69444, 0, 0, 0.86853], 168: ir, 172: [0, 0.44444, 0, 0, 0.76666], 176: fu, 177: Xe, 184: [0.17014, 0, 0, 0, 0.51111], 198: [0, 0.68611, 0, 0, 1.04166], 215: Xe, 216: [0.04861, 0.73472, 0, 0, 0.89444], 223: $d, 230: [0, 0.44444, 0, 0, 0.83055], 247: Xe, 248: [0.09722, 0.54167, 0, 0, 0.575], 305: hu, 338: [0, 0.68611, 0, 0, 1.16944], 339: wu, 567: [0.19444, 0.44444, 0, 0, 0.35139], 710: ir, 711: [0, 0.63194, 0, 0, 0.575], 713: [0, 0.59611, 0, 0, 0.575], 714: ir, 715: ir, 728: ir, 729: Si, 730: fu, 732: ir, 733: ir, 915: gu, 916: Ns, 920: Is, 923: pd, 926: fd, 928: Ro, 931: zo, 933: Is, 934: zo, 936: Is, 937: zo, 8211: [0, 0.44444, 0.03194, 0, 0.575], 8212: [0, 0.44444, 0.03194, 0, 1.14999], 8216: Si, 8217: Si, 8220: zs, 8221: zs, 8224: yu, 8225: yu, 8242: [0, 0.55556, 0, 0, 0.34444], 8407: [0, 0.72444, 0.15486, 0, 0.575], 8463: md, 8465: bu, 8467: [0, 0.69444, 0, 0, 0.47361], 8472: [0.19444, 0.44444, 0, 0, 0.74027], 8476: bu, 8501: Vs, 8592: _t, 8593: xu, 8594: _t, 8595: xu, 8596: _t, 8597: rr, 8598: Mn, 8599: Mn, 8600: Mn, 8601: Mn, 8636: _t, 8637: _t, 8640: _t, 8641: _t, 8656: _t, 8657: vu, 8658: _t, 8659: vu, 8660: _t, 8661: [0.25, 0.75, 0, 0, 0.70277], 8704: Br, 8706: [0, 0.69444, 0.06389, 0, 0.62847], 8707: Br, 8709: _u, 8711: Ns, 8712: Mu, 8715: Mu, 8722: Xe, 8723: Xe, 8725: rr, 8726: rr, 8727: No, 8728: Fs, 8729: Fs, 8730: [0.18, 0.82, 0, 0, 0.95833], 8733: wu, 8734: [0, 0.44444, 0, 0, 1.14999], 8736: xn, 8739: Io, 8741: rr, 8743: Or, 8744: Or, 8745: Or, 8746: Or, 8747: [0.19444, 0.69444, 0.12778, 0, 0.56875], 8764: ku, 8768: [0.19444, 0.69444, 0, 0, 0.31944], 8771: $s, 8776: [0.02444, 0.52444, 0, 0, 0.89444], 8781: $s, 8801: $s, 8804: nr, 8805: nr, 8810: Su, 8811: Su, 8826: ki, 8827: ki, 8834: ki, 8835: ki, 8838: nr, 8839: nr, 8846: Or, 8849: nr, 8850: nr, 8851: Or, 8852: Or, 8853: Xe, 8854: Xe, 8855: Xe, 8856: Xe, 8857: Xe, 8866: Vs, 8867: Vs, 8868: Po, 8869: Po, 8900: Fs, 8901: [-0.02639, 0.47361, 0, 0, 0.31944], 8902: No, 8968: Fo, 8969: Fo, 8970: Fo, 8971: Fo, 8994: Lu, 8995: Lu, 9651: Au, 9657: No, 9661: Au, 9667: No, 9711: Mn, 9824: $o, 9825: $o, 9826: $o, 9827: $o, 9837: [0, 0.75, 0, 0, 0.44722], 9838: Cu, 9839: Cu, 10216: Oo, 10217: Oo, 10815: Ro, 10927: nr, 10928: nr, 57376: ud }, "Main-BoldItalic": { 32: $, 33: [0, 0.69444, 0.11417, 0, 0.38611], 34: Pu, 35: [0.19444, 0.69444, 0.06833, 0, 0.94444], 37: [0.05556, 0.75, 0.12861, 0, 0.94444], 38: [0, 0.69444, 0.08528, 0, 0.88555], 39: Vo, 40: [0.25, 0.75, 0.15806, 0, 0.47333], 41: [0.25, 0.75, 0.03306, 0, 0.47333], 42: [0, 0.75, 0.14333, 0, 0.59111], 43: [0.10333, 0.60333, 0.03306, 0, 0.88555], 44: [0.19444, 0.14722, 0, 0, 0.35555], 45: [0, 0.44444, 0.02611, 0, 0.41444], 46: [0, 0.14722, 0, 0, 0.35555], 47: [0.25, 0.75, 0.15806, 0, 0.59111], 48: or, 49: or, 50: or, 51: or, 52: Eu, 53: or, 54: or, 55: Eu, 56: or, 57: or, 58: [0, 0.44444, 0.06695, 0, 0.35555], 59: [0.19444, 0.44444, 0.06695, 0, 0.35555], 61: [-0.10889, 0.39111, 0.06833, 0, 0.88555], 63: Hs, 64: [0, 0.69444, 0.09208, 0, 0.88555], 65: [0, 0.68611, 0, 0, 0.86555], 66: [0, 0.68611, 0.0992, 0, 0.81666], 67: [0, 0.68611, 0.14208, 0, 0.82666], 68: [0, 0.68611, 0.09062, 0, 0.87555], 69: [0, 0.68611, 0.11431, 0, 0.75666], 70: [0, 0.68611, 0.12903, 0, 0.72722], 71: [0, 0.68611, 0.07347, 0, 0.89527], 72: qs, 73: [0, 0.68611, 0.15681, 0, 0.47166], 74: [0, 0.68611, 0.145, 0, 0.61055], 75: [0, 0.68611, 0.14208, 0, 0.89499], 76: [0, 0.68611, 0, 0, 0.69777], 77: [0, 0.68611, 0.17208, 0, 1.07277], 78: qs, 79: [0, 0.68611, 0.09062, 0, 0.85499], 80: [0, 0.68611, 0.0992, 0, 0.78721], 81: [0.19444, 0.68611, 0.09062, 0, 0.85499], 82: [0, 0.68611, 0.02559, 0, 0.85944], 83: [0, 0.68611, 0.11264, 0, 0.64999], 84: [0, 0.68611, 0.12903, 0, 0.7961], 85: [0, 0.68611, 0.17208, 0, 0.88083], 86: [0, 0.68611, 0.18625, 0, 0.86555], 87: [0, 0.68611, 0.18625, 0, 1.15999], 88: [0, 0.68611, 0.15681, 0, 0.86555], 89: [0, 0.68611, 0.19803, 0, 0.86555], 90: [0, 0.68611, 0.14208, 0, 0.70888], 91: [0.25, 0.75, 0.1875, 0, 0.35611], 93: [0.25, 0.75, 0.09972, 0, 0.35611], 94: Ku, 95: [0.31, 0.13444, 0.09811, 0, 0.59111], 97: [0, 0.44444, 0.09426, 0, 0.59111], 98: [0, 0.69444, 0.07861, 0, 0.53222], 99: [0, 0.44444, 0.05222, 0, 0.53222], 100: [0, 0.69444, 0.10861, 0, 0.59111], 101: [0, 0.44444, 0.085, 0, 0.53222], 102: [0.19444, 0.69444, 0.21778, 0, 0.4], 103: Tu, 104: [0, 0.69444, 0.09426, 0, 0.59111], 105: [0, 0.69326, 0.11387, 0, 0.35555], 106: [0.19444, 0.69326, 0.1672, 0, 0.35555], 107: [0, 0.69444, 0.11111, 0, 0.53222], 108: [0, 0.69444, 0.10861, 0, 0.29666], 109: [0, 0.44444, 0.09426, 0, 0.94444], 110: [0, 0.44444, 0.09426, 0, 0.64999], 111: [0, 0.44444, 0.07861, 0, 0.59111], 112: [0.19444, 0.44444, 0.07861, 0, 0.59111], 113: Tu, 114: [0, 0.44444, 0.11111, 0, 0.50167], 115: [0, 0.44444, 0.08167, 0, 0.48694], 116: [0, 0.63492, 0.09639, 0, 0.385], 117: [0, 0.44444, 0.09426, 0, 0.62055], 118: [0, 0.44444, 0.11111, 0, 0.53222], 119: [0, 0.44444, 0.11111, 0, 0.76777], 120: [0, 0.44444, 0.12583, 0, 0.56055], 121: [0.19444, 0.44444, 0.105, 0, 0.56166], 122: [0, 0.44444, 0.13889, 0, 0.49055], 126: [0.35, 0.34444, 0.11472, 0, 0.59111], 160: $, 168: [0, 0.69444, 0.11473, 0, 0.59111], 176: Bu, 184: [0.17014, 0, 0, 0, 0.53222], 198: [0, 0.68611, 0.11431, 0, 1.02277], 216: [0.04861, 0.73472, 0.09062, 0, 0.88555], 223: [0.19444, 0.69444, 0.09736, 0, 0.665], 230: Du, 248: [0.09722, 0.54167, 0.09458, 0, 0.59111], 305: [0, 0.44444, 0.09426, 0, 0.35555], 338: [0, 0.68611, 0.11431, 0, 1.14054], 339: Du, 567: [0.19444, 0.44444, 0.04611, 0, 0.385], 710: Ku, 711: [0, 0.63194, 0.08271, 0, 0.59111], 713: [0, 0.59444, 0.10444, 0, 0.59111], 714: [0, 0.69444, 0.08528, 0, 0.59111], 715: [0, 0.69444, 0, 0, 0.59111], 728: [0, 0.69444, 0.10333, 0, 0.59111], 729: Vo, 730: Bu, 732: Hs, 733: Hs, 915: [0, 0.68611, 0.12903, 0, 0.69777], 916: [0, 0.68611, 0, 0, 0.94444], 920: [0, 0.68611, 0.09062, 0, 0.88555], 923: [0, 0.68611, 0, 0, 0.80666], 926: [0, 0.68611, 0.15092, 0, 0.76777], 928: qs, 931: [0, 0.68611, 0.11431, 0, 0.82666], 933: Ou, 934: [0, 0.68611, 0.05632, 0, 0.82666], 936: Ou, 937: [0, 0.68611, 0.0992, 0, 0.82666], 8211: [0, 0.44444, 0.09811, 0, 0.59111], 8212: [0, 0.44444, 0.09811, 0, 1.18221], 8216: Vo, 8217: Vo, 8220: [0, 0.69444, 0.16772, 0, 0.62055], 8221: Pu }, "Main-Italic": { 32: $, 33: qo, 34: Hu, 35: [0.19444, 0.69444, 0.06616, 0, 0.81777], 37: [0.05556, 0.75, 0.13639, 0, 0.81777], 38: [0, 0.69444, 0.09694, 0, 0.76666], 39: qo, 40: [0.25, 0.75, 0.16194, 0, 0.40889], 41: [0.25, 0.75, 0.03694, 0, 0.40889], 42: [0, 0.75, 0.14917, 0, 0.51111], 43: [0.05667, 0.56167, 0.03694, 0, 0.76666], 44: [0.19444, 0.10556, 0, 0, 0.30667], 45: [0, 0.43056, 0.02826, 0, 0.35778], 46: [0, 0.10556, 0, 0, 0.30667], 47: [0.25, 0.75, 0.16194, 0, 0.51111], 48: ar, 49: ar, 50: ar, 51: ar, 52: Ru, 53: ar, 54: ar, 55: Ru, 56: ar, 57: ar, 58: [0, 0.43056, 0.0582, 0, 0.30667], 59: [0.19444, 0.43056, 0.0582, 0, 0.30667], 61: [-0.13313, 0.36687, 0.06616, 0, 0.76666], 63: $u, 64: [0, 0.69444, 0.09597, 0, 0.76666], 65: [0, 0.68333, 0, 0, 0.74333], 66: [0, 0.68333, 0.10257, 0, 0.70389], 67: [0, 0.68333, 0.14528, 0, 0.71555], 68: [0, 0.68333, 0.09403, 0, 0.755], 69: [0, 0.68333, 0.12028, 0, 0.67833], 70: [0, 0.68333, 0.13305, 0, 0.65277], 71: [0, 0.68333, 0.08722, 0, 0.77361], 72: Ho, 73: [0, 0.68333, 0.15806, 0, 0.38555], 74: [0, 0.68333, 0.14028, 0, 0.525], 75: [0, 0.68333, 0.14528, 0, 0.76888], 76: [0, 0.68333, 0, 0, 0.62722], 77: [0, 0.68333, 0.16389, 0, 0.89666], 78: Ho, 79: Vu, 80: [0, 0.68333, 0.10257, 0, 0.67833], 81: [0.19444, 0.68333, 0.09403, 0, 0.76666], 82: [0, 0.68333, 0.03868, 0, 0.72944], 83: [0, 0.68333, 0.11972, 0, 0.56222], 84: [0, 0.68333, 0.13305, 0, 0.71555], 85: Ho, 86: [0, 0.68333, 0.18361, 0, 0.74333], 87: [0, 0.68333, 0.18361, 0, 0.99888], 88: [0, 0.68333, 0.15806, 0, 0.74333], 89: [0, 0.68333, 0.19383, 0, 0.74333], 90: [0, 0.68333, 0.14528, 0, 0.61333], 91: [0.25, 0.75, 0.1875, 0, 0.30667], 93: [0.25, 0.75, 0.10528, 0, 0.30667], 94: Nu, 95: [0.31, 0.12056, 0.09208, 0, 0.51111], 97: [0, 0.43056, 0.07671, 0, 0.51111], 98: [0, 0.69444, 0.06312, 0, 0.46], 99: [0, 0.43056, 0.05653, 0, 0.46], 100: [0, 0.69444, 0.10333, 0, 0.51111], 101: [0, 0.43056, 0.07514, 0, 0.46], 102: [0.19444, 0.69444, 0.21194, 0, 0.30667], 103: Iu, 104: [0, 0.69444, 0.07671, 0, 0.51111], 105: [0, 0.65536, 0.1019, 0, 0.30667], 106: [0.19444, 0.65536, 0.14467, 0, 0.30667], 107: [0, 0.69444, 0.10764, 0, 0.46], 108: [0, 0.69444, 0.10333, 0, 0.25555], 109: [0, 0.43056, 0.07671, 0, 0.81777], 110: [0, 0.43056, 0.07671, 0, 0.56222], 111: [0, 0.43056, 0.06312, 0, 0.51111], 112: [0.19444, 0.43056, 0.06312, 0, 0.51111], 113: Iu, 114: [0, 0.43056, 0.10764, 0, 0.42166], 115: [0, 0.43056, 0.08208, 0, 0.40889], 116: [0, 0.61508, 0.09486, 0, 0.33222], 117: [0, 0.43056, 0.07671, 0, 0.53666], 118: [0, 0.43056, 0.10764, 0, 0.46], 119: [0, 0.43056, 0.10764, 0, 0.66444], 120: [0, 0.43056, 0.12042, 0, 0.46389], 121: [0.19444, 0.43056, 0.08847, 0, 0.48555], 122: [0, 0.43056, 0.12292, 0, 0.40889], 126: [0.35, 0.31786, 0.11585, 0, 0.51111], 160: $, 168: [0, 0.66786, 0.10474, 0, 0.51111], 176: Fu, 184: [0.17014, 0, 0, 0, 0.46], 198: [0, 0.68333, 0.12028, 0, 0.88277], 216: [0.04861, 0.73194, 0.09403, 0, 0.76666], 223: [0.19444, 0.69444, 0.10514, 0, 0.53666], 230: zu, 248: [0.09722, 0.52778, 0.09194, 0, 0.51111], 338: [0, 0.68333, 0.12028, 0, 0.98499], 339: zu, 710: Nu, 711: [0, 0.62847, 0.08295, 0, 0.51111], 713: [0, 0.56167, 0.10333, 0, 0.51111], 714: [0, 0.69444, 0.09694, 0, 0.51111], 715: [0, 0.69444, 0, 0, 0.51111], 728: [0, 0.69444, 0.10806, 0, 0.51111], 729: [0, 0.66786, 0.11752, 0, 0.30667], 730: Fu, 732: [0, 0.66786, 0.11585, 0, 0.51111], 733: $u, 915: [0, 0.68333, 0.13305, 0, 0.62722], 916: [0, 0.68333, 0, 0, 0.81777], 920: Vu, 923: [0, 0.68333, 0, 0, 0.69222], 926: [0, 0.68333, 0.15294, 0, 0.66444], 928: Ho, 931: [0, 0.68333, 0.12028, 0, 0.71555], 933: qu, 934: [0, 0.68333, 0.05986, 0, 0.71555], 936: qu, 937: [0, 0.68333, 0.10257, 0, 0.71555], 8211: [0, 0.43056, 0.09208, 0, 0.51111], 8212: [0, 0.43056, 0.09208, 0, 1.02222], 8216: qo, 8217: qo, 8220: [0, 0.69444, 0.1685, 0, 0.51444], 8221: Hu, 8463: So }, "Main-Regular": { 32: $, 33: Nt, 34: pe, 35: Rd, 36: Gs, 37: Id, 38: Pr, 39: Nt, 40: Li, 41: Li, 42: zd, 43: Fe, 44: [0.19444, 0.10556, 0, 0, 0.27778], 45: [0, 0.43056, 0, 0, 0.33333], 46: [0, 0.10556, 0, 0, 0.27778], 47: Ft, 48: Ne, 49: Ne, 50: Ne, 51: Ne, 52: Ne, 53: Ne, 54: Ne, 55: Ne, 56: Ne, 57: Ne, 58: Gu, 59: [0.19444, 0.43056, 0, 0, 0.27778], 60: tr, 61: To, 62: tr, 63: il, 64: Pr, 65: Rr, 66: [0, 0.68333, 0, 0, 0.70834], 67: kn, 68: [0, 0.68333, 0, 0, 0.76389], 69: Wu, 70: [0, 0.68333, 0, 0, 0.65278], 71: [0, 0.68333, 0, 0, 0.78472], 72: Rr, 73: [0, 0.68333, 0, 0, 0.36111], 74: [0, 0.68333, 0, 0, 0.51389], 75: wn, 76: Yu, 77: [0, 0.68333, 0, 0, 0.91667], 78: Rr, 79: wn, 80: Wu, 81: [0.19444, 0.68333, 0, 0, 0.77778], 82: [0, 0.68333, 0, 0, 0.73611], 83: [0, 0.68333, 0, 0, 0.55556], 84: kn, 85: Rr, 86: [0, 0.68333, 0.01389, 0, 0.75], 87: [0, 0.68333, 0.01389, 0, 1.02778], 88: Rr, 89: [0, 0.68333, 0.025, 0, 0.75], 90: [0, 0.68333, 0, 0, 0.61111], 91: Wo, 92: Ft, 93: Wo, 94: pe, 95: [0.31, 0.12056, 0.02778, 0, 0.5], 97: Sn, 98: Ai, 99: Ws, 100: Ai, 101: Ws, 102: [0, 0.69444, 0.07778, 0, 0.30556], 103: [0.19444, 0.43056, 0.01389, 0, 0.5], 104: Ai, 105: ju, 106: [0.19444, 0.66786, 0, 0, 0.30556], 107: [0, 0.69444, 0, 0, 0.52778], 108: Nt, 109: [0, 0.43056, 0, 0, 0.83334], 110: Ju, 111: Sn, 112: Uu, 113: [0.19444, 0.43056, 0, 0, 0.52778], 114: [0, 0.43056, 0, 0, 0.39167], 115: [0, 0.43056, 0, 0, 0.39445], 116: [0, 0.61508, 0, 0, 0.38889], 117: Ju, 118: [0, 0.43056, 0.01389, 0, 0.52778], 119: [0, 0.43056, 0.01389, 0, 0.72222], 120: [0, 0.43056, 0, 0, 0.52778], 121: [0.19444, 0.43056, 0.01389, 0, 0.52778], 122: Ws, 123: Ft, 124: Wo, 125: Ft, 126: [0.35, 0.31786, 0, 0, 0.5], 160: $, 163: [0, 0.69444, 0, 0, 0.76909], 167: Us, 168: Zu, 172: [0, 0.43056, 0, 0, 0.66667], 176: Xu, 177: Fe, 182: Js, 184: tl, 198: [0, 0.68333, 0, 0, 0.90278], 215: Fe, 216: [0.04861, 0.73194, 0, 0, 0.77778], 223: pe, 230: [0, 0.43056, 0, 0, 0.72222], 247: Fe, 248: [0.09722, 0.52778, 0, 0, 0.5], 305: Gu, 338: [0, 0.68333, 0, 0, 1.01389], 339: id, 567: [0.19444, 0.43056, 0, 0, 0.30556], 710: pe, 711: [0, 0.62847, 0, 0, 0.5], 713: [0, 0.56778, 0, 0, 0.5], 714: pe, 715: pe, 728: pe, 729: ju, 730: Xu, 732: Zu, 733: pe, 915: Yu, 916: td, 920: wn, 923: [0, 0.68333, 0, 0, 0.69445], 926: [0, 0.68333, 0, 0, 0.66667], 928: Rr, 931: kn, 933: wn, 934: kn, 936: wn, 937: kn, 8211: [0, 0.43056, 0.02778, 0, 0.5], 8212: [0, 0.43056, 0.02778, 0, 1], 8216: Nt, 8217: Nt, 8220: pe, 8221: pe, 8224: Us, 8225: Us, 8230: [0, 0.12, 0, 0, 1.172], 8242: [0, 0.55556, 0, 0, 0.275], 8407: [0, 0.71444, 0.15382, 0, 0.5], 8463: So, 8465: Ln, 8467: [0, 0.69444, 0, 0.11111, 0.41667], 8472: [0.19444, 0.43056, 0, 0.11111, 0.63646], 8476: Ln, 8501: sr, 8592: Me, 8593: Qu, 8594: Me, 8595: Qu, 8596: Me, 8597: Ft, 8598: An, 8599: An, 8600: An, 8601: An, 8614: [0.011, 0.511, 0, 0, 1], 8617: ed, 8618: ed, 8636: Me, 8637: Me, 8640: Me, 8641: Me, 8652: [0.011, 0.671, 0, 0, 1], 8656: Me, 8657: Js, 8658: Me, 8659: Js, 8660: Me, 8661: [0.25, 0.75, 0, 0, 0.61111], 8704: Ai, 8706: [0, 0.69444, 0.05556, 0.08334, 0.5309], 8707: Ai, 8709: Gs, 8711: td, 8712: rd, 8715: rd, 8722: Fe, 8723: Fe, 8725: Ft, 8726: Ft, 8727: Jo, 8728: js, 8729: js, 8730: [0.2, 0.8, 0, 0, 0.83334], 8733: id, 8734: Ks, 8736: xn, 8739: Wo, 8741: Ft, 8743: Ir, 8744: Ir, 8745: Ir, 8746: Ir, 8747: [0.19444, 0.69444, 0.11111, 0, 0.41667], 8764: To, 8768: [0.19444, 0.69444, 0, 0, 0.27778], 8771: Uo, 8773: [-0.022, 0.589, 0, 0, 1], 8776: nd, 8781: Uo, 8784: [-0.133, 0.67, 0, 0, 0.778], 8801: Uo, 8804: De, 8805: De, 8810: od, 8811: od, 8826: tr, 8827: tr, 8834: tr, 8835: tr, 8838: De, 8839: De, 8846: Ir, 8849: De, 8850: De, 8851: Ir, 8852: Ir, 8853: Fe, 8854: Fe, 8855: Fe, 8856: Fe, 8857: Fe, 8866: sr, 8867: sr, 8868: Pr, 8869: Pr, 8872: [0.249, 0.75, 0, 0, 0.867], 8900: js, 8901: [-0.05555, 0.44445, 0, 0, 0.27778], 8902: Jo, 8904: [5e-3, 0.505, 0, 0, 0.9], 8942: [0.03, 0.9, 0, 0, 0.278], 8943: [-0.19, 0.31, 0, 0, 1.172], 8945: [-0.1, 0.82, 0, 0, 1.282], 8968: Go, 8969: Go, 8970: Go, 8971: Go, 8994: ad, 8995: ad, 9136: jo, 9137: jo, 9651: sd, 9657: Jo, 9661: sd, 9667: Jo, 9711: An, 9824: Xo, 9825: Xo, 9826: Xo, 9827: Xo, 9837: [0, 0.75, 0, 0, 0.38889], 9838: ld, 9839: ld, 10216: Li, 10217: Li, 10222: jo, 10223: jo, 10229: [0.011, 0.511, 0, 0, 1.609], 10230: cd, 10231: [0.011, 0.511, 0, 0, 1.859], 10232: [0.024, 0.525, 0, 0, 1.609], 10233: [0.024, 0.525, 0, 0, 1.638], 10234: [0.024, 0.525, 0, 0, 1.858], 10236: cd, 10815: Rr, 10927: De, 10928: De, 57376: ud }, "Math-BoldItalic": { 32: $, 48: Zo, 49: Zo, 50: Zo, 51: Cn, 52: Cn, 53: Cn, 54: ze, 55: Cn, 56: ze, 57: Cn, 65: Rs, 66: [0, 0.68611, 0.04835, 0, 0.8664], 67: [0, 0.68611, 0.06979, 0, 0.81694], 68: [0, 0.68611, 0.03194, 0, 0.93812], 69: [0, 0.68611, 0.05451, 0, 0.81007], 70: [0, 0.68611, 0.15972, 0, 0.68889], 71: [0, 0.68611, 0, 0, 0.88673], 72: hd, 73: [0, 0.68611, 0.07778, 0, 0.51111], 74: [0, 0.68611, 0.10069, 0, 0.63125], 75: [0, 0.68611, 0.06979, 0, 0.97118], 76: dd, 77: [0, 0.68611, 0.11424, 0, 1.14201], 78: [0, 0.68611, 0.11424, 0, 0.95034], 79: [0, 0.68611, 0.03194, 0, 0.83666], 80: [0, 0.68611, 0.15972, 0, 0.72309], 81: [0.19444, 0.68611, 0, 0, 0.86861], 82: [0, 0.68611, 421e-5, 0, 0.87235], 83: [0, 0.68611, 0.05382, 0, 0.69271], 84: [0, 0.68611, 0.15972, 0, 0.63663], 85: [0, 0.68611, 0.11424, 0, 0.80027], 86: [0, 0.68611, 0.25555, 0, 0.67778], 87: [0, 0.68611, 0.15972, 0, 1.09305], 88: [0, 0.68611, 0.07778, 0, 0.94722], 89: [0, 0.68611, 0.25555, 0, 0.67458], 90: [0, 0.68611, 0.06979, 0, 0.77257], 97: [0, 0.44444, 0, 0, 0.63287], 98: [0, 0.69444, 0, 0, 0.52083], 99: [0, 0.44444, 0, 0, 0.51342], 100: [0, 0.69444, 0, 0, 0.60972], 101: [0, 0.44444, 0, 0, 0.55361], 102: [0.19444, 0.69444, 0.11042, 0, 0.56806], 103: [0.19444, 0.44444, 0.03704, 0, 0.5449], 104: md, 105: [0, 0.69326, 0, 0, 0.4048], 106: [0.19444, 0.69326, 0.0622, 0, 0.47083], 107: [0, 0.69444, 0.01852, 0, 0.6037], 108: [0, 0.69444, 88e-4, 0, 0.34815], 109: [0, 0.44444, 0, 0, 1.0324], 110: [0, 0.44444, 0, 0, 0.71296], 111: gd, 112: [0.19444, 0.44444, 0, 0, 0.60092], 113: [0.19444, 0.44444, 0.03704, 0, 0.54213], 114: [0, 0.44444, 0.03194, 0, 0.5287], 115: [0, 0.44444, 0, 0, 0.53125], 116: [0, 0.63492, 0, 0, 0.41528], 117: [0, 0.44444, 0, 0, 0.68102], 118: [0, 0.44444, 0.03704, 0, 0.56666], 119: [0, 0.44444, 0.02778, 0, 0.83148], 120: [0, 0.44444, 0, 0, 0.65903], 121: [0.19444, 0.44444, 0.03704, 0, 0.59028], 122: [0, 0.44444, 0.04213, 0, 0.55509], 160: $, 915: [0, 0.68611, 0.15972, 0, 0.65694], 916: Ns, 920: [0, 0.68611, 0.03194, 0, 0.86722], 923: pd, 926: [0, 0.68611, 0.07458, 0, 0.84125], 928: hd, 931: [0, 0.68611, 0.05451, 0, 0.88507], 933: [0, 0.68611, 0.15972, 0, 0.67083], 934: fd, 936: [0, 0.68611, 0.11653, 0, 0.71402], 937: [0, 0.68611, 0.04835, 0, 0.8789], 945: [0, 0.44444, 0, 0, 0.76064], 946: [0.19444, 0.69444, 0.03403, 0, 0.65972], 947: [0.19444, 0.44444, 0.06389, 0, 0.59003], 948: [0, 0.69444, 0.03819, 0, 0.52222], 949: [0, 0.44444, 0, 0, 0.52882], 950: [0.19444, 0.69444, 0.06215, 0, 0.50833], 951: [0.19444, 0.44444, 0.03704, 0, 0.6], 952: [0, 0.69444, 0.03194, 0, 0.5618], 953: [0, 0.44444, 0, 0, 0.41204], 954: [0, 0.44444, 0, 0, 0.66759], 955: [0, 0.69444, 0, 0, 0.67083], 956: [0.19444, 0.44444, 0, 0, 0.70787], 957: [0, 0.44444, 0.06898, 0, 0.57685], 958: [0.19444, 0.69444, 0.03021, 0, 0.50833], 959: gd, 960: [0, 0.44444, 0.03704, 0, 0.68241], 961: yd, 962: [0.09722, 0.44444, 0.07917, 0, 0.42361], 963: [0, 0.44444, 0.03704, 0, 0.68588], 964: [0, 0.44444, 0.13472, 0, 0.52083], 965: [0, 0.44444, 0.03704, 0, 0.63055], 966: [0.19444, 0.44444, 0, 0, 0.74722], 967: [0.19444, 0.44444, 0, 0, 0.71805], 968: [0.19444, 0.69444, 0.03704, 0, 0.75833], 969: [0, 0.44444, 0.03704, 0, 0.71782], 977: [0, 0.69444, 0, 0, 0.69155], 981: [0.19444, 0.69444, 0, 0, 0.7125], 982: [0, 0.44444, 0.03194, 0, 0.975], 1009: yd, 1013: [0, 0.44444, 0, 0, 0.48333], 57649: [0, 0.44444, 0, 0, 0.39352], 57911: [0.19444, 0.44444, 0, 0, 0.43889] }, "Math-Italic": { 32: $, 48: Sn, 49: Sn, 50: Sn, 51: En, 52: En, 53: En, 54: Ne, 55: En, 56: Ne, 57: En, 65: [0, 0.68333, 0, 0.13889, 0.75], 66: [0, 0.68333, 0.05017, 0.08334, 0.75851], 67: [0, 0.68333, 0.07153, 0.08334, 0.71472], 68: [0, 0.68333, 0.02778, 0.05556, 0.82792], 69: [0, 0.68333, 0.05764, 0.08334, 0.7382], 70: [0, 0.68333, 0.13889, 0.08334, 0.64306], 71: [0, 0.68333, 0, 0.08334, 0.78625], 72: xd, 73: [0, 0.68333, 0.07847, 0.11111, 0.43958], 74: [0, 0.68333, 0.09618, 0.16667, 0.55451], 75: [0, 0.68333, 0.07153, 0.05556, 0.84931], 76: [0, 0.68333, 0, 0.02778, 0.68056], 77: [0, 0.68333, 0.10903, 0.08334, 0.97014], 78: [0, 0.68333, 0.10903, 0.08334, 0.80347], 79: bd, 80: [0, 0.68333, 0.13889, 0.08334, 0.64201], 81: [0.19444, 0.68333, 0, 0.08334, 0.79056], 82: [0, 0.68333, 773e-5, 0.08334, 0.75929], 83: [0, 0.68333, 0.05764, 0.08334, 0.6132], 84: [0, 0.68333, 0.13889, 0.08334, 0.58438], 85: [0, 0.68333, 0.10903, 0.02778, 0.68278], 86: [0, 0.68333, 0.22222, 0, 0.58333], 87: [0, 0.68333, 0.13889, 0, 0.94445], 88: [0, 0.68333, 0.07847, 0.08334, 0.82847], 89: [0, 0.68333, 0.22222, 0, 0.58056], 90: [0, 0.68333, 0.07153, 0.08334, 0.68264], 97: [0, 0.43056, 0, 0, 0.52859], 98: [0, 0.69444, 0, 0, 0.42917], 99: [0, 0.43056, 0, 0.05556, 0.43276], 100: [0, 0.69444, 0, 0.16667, 0.52049], 101: [0, 0.43056, 0, 0.05556, 0.46563], 102: [0.19444, 0.69444, 0.10764, 0.16667, 0.48959], 103: [0.19444, 0.43056, 0.03588, 0.02778, 0.47697], 104: [0, 0.69444, 0, 0, 0.57616], 105: [0, 0.65952, 0, 0, 0.34451], 106: [0.19444, 0.65952, 0.05724, 0, 0.41181], 107: [0, 0.69444, 0.03148, 0, 0.5206], 108: [0, 0.69444, 0.01968, 0.08334, 0.29838], 109: [0, 0.43056, 0, 0, 0.87801], 110: [0, 0.43056, 0, 0, 0.60023], 111: vd, 112: [0.19444, 0.43056, 0, 0.08334, 0.50313], 113: [0.19444, 0.43056, 0.03588, 0.08334, 0.44641], 114: [0, 0.43056, 0.02778, 0.05556, 0.45116], 115: [0, 0.43056, 0, 0.05556, 0.46875], 116: [0, 0.61508, 0, 0.08334, 0.36111], 117: [0, 0.43056, 0, 0.02778, 0.57246], 118: [0, 0.43056, 0.03588, 0.02778, 0.48472], 119: [0, 0.43056, 0.02691, 0.08334, 0.71592], 120: [0, 0.43056, 0, 0.02778, 0.57153], 121: [0.19444, 0.43056, 0.03588, 0.05556, 0.49028], 122: [0, 0.43056, 0.04398, 0.05556, 0.46505], 160: $, 915: [0, 0.68333, 0.13889, 0.08334, 0.61528], 916: [0, 0.68333, 0, 0.16667, 0.83334], 920: bd, 923: [0, 0.68333, 0, 0.16667, 0.69445], 926: [0, 0.68333, 0.07569, 0.08334, 0.74236], 928: xd, 931: [0, 0.68333, 0.05764, 0.08334, 0.77986], 933: [0, 0.68333, 0.13889, 0.05556, 0.58333], 934: [0, 0.68333, 0, 0.08334, 0.66667], 936: [0, 0.68333, 0.11, 0.05556, 0.61222], 937: [0, 0.68333, 0.05017, 0.08334, 0.7724], 945: [0, 0.43056, 37e-4, 0.02778, 0.6397], 946: [0.19444, 0.69444, 0.05278, 0.08334, 0.56563], 947: [0.19444, 0.43056, 0.05556, 0, 0.51773], 948: [0, 0.69444, 0.03785, 0.05556, 0.44444], 949: [0, 0.43056, 0, 0.08334, 0.46632], 950: [0.19444, 0.69444, 0.07378, 0.08334, 0.4375], 951: [0.19444, 0.43056, 0.03588, 0.05556, 0.49653], 952: [0, 0.69444, 0.02778, 0.08334, 0.46944], 953: [0, 0.43056, 0, 0.05556, 0.35394], 954: [0, 0.43056, 0, 0, 0.57616], 955: [0, 0.69444, 0, 0, 0.58334], 956: [0.19444, 0.43056, 0, 0.02778, 0.60255], 957: [0, 0.43056, 0.06366, 0.02778, 0.49398], 958: [0.19444, 0.69444, 0.04601, 0.11111, 0.4375], 959: vd, 960: [0, 0.43056, 0.03588, 0, 0.57003], 961: _d, 962: [0.09722, 0.43056, 0.07986, 0.08334, 0.36285], 963: [0, 0.43056, 0.03588, 0, 0.57141], 964: [0, 0.43056, 0.1132, 0.02778, 0.43715], 965: [0, 0.43056, 0.03588, 0.02778, 0.54028], 966: [0.19444, 0.43056, 0, 0.08334, 0.65417], 967: [0.19444, 0.43056, 0, 0.05556, 0.62569], 968: [0.19444, 0.69444, 0.03588, 0.11111, 0.65139], 969: [0, 0.43056, 0.03588, 0, 0.62245], 977: [0, 0.69444, 0, 0.08334, 0.59144], 981: [0.19444, 0.69444, 0, 0.08334, 0.59583], 982: [0, 0.43056, 0.02778, 0, 0.82813], 1009: _d, 1013: [0, 0.43056, 0, 0.05556, 0.4059], 57649: [0, 0.43056, 0, 0.02778, 0.32246], 57911: [0.19444, 0.43056, 0, 0.08334, 0.38403] }, "SansSerif-Bold": { 32: $, 33: [0, 0.69444, 0, 0, 0.36667], 34: Qs, 35: [0.19444, 0.69444, 0, 0, 0.91667], 36: [0.05556, 0.75, 0, 0, 0.55], 37: [0.05556, 0.75, 0, 0, 1.02912], 38: [0, 0.69444, 0, 0, 0.83056], 39: Yo, 40: Md, 41: Md, 42: [0, 0.75, 0, 0, 0.55], 43: [0.11667, 0.61667, 0, 0, 0.85556], 44: [0.10556, 0.13056, 0, 0, 0.30556], 45: [0, 0.45833, 0, 0, 0.36667], 46: [0, 0.13056, 0, 0, 0.30556], 47: [0.25, 0.75, 0, 0, 0.55], 48: xe, 49: xe, 50: xe, 51: xe, 52: xe, 53: xe, 54: xe, 55: xe, 56: xe, 57: xe, 58: [0, 0.45833, 0, 0, 0.30556], 59: [0.10556, 0.45833, 0, 0, 0.30556], 61: [-0.09375, 0.40625, 0, 0, 0.85556], 63: wd, 64: $t, 65: $t, 66: $t, 67: Xs, 68: lr, 69: [0, 0.69444, 0, 0, 0.64167], 70: sr, 71: $t, 72: lr, 73: [0, 0.69444, 0, 0, 0.33056], 74: wd, 75: kd, 76: Ed, 77: [0, 0.69444, 0, 0, 0.97778], 78: lr, 79: lr, 80: Xs, 81: [0.10556, 0.69444, 0, 0, 0.79445], 82: Xs, 83: sr, 84: $t, 85: kd, 86: [0, 0.69444, 0.01528, 0, 0.73334], 87: [0, 0.69444, 0.01528, 0, 1.03889], 88: $t, 89: [0, 0.69444, 0.0275, 0, 0.73334], 90: Td, 91: Sd, 93: Sd, 94: xe, 95: [0.35, 0.10833, 0.03056, 0, 0.55], 97: [0, 0.45833, 0, 0, 0.525], 98: Zs, 99: [0, 0.45833, 0, 0, 0.48889], 100: Zs, 101: [0, 0.45833, 0, 0, 0.51111], 102: [0, 0.69444, 0.07639, 0, 0.33611], 103: [0.19444, 0.45833, 0.01528, 0, 0.55], 104: Zs, 105: Ld, 106: [0.19444, 0.69444, 0, 0, 0.28611], 107: [0, 0.69444, 0, 0, 0.53056], 108: Ld, 109: [0, 0.45833, 0, 0, 0.86667], 110: Cd, 111: [0, 0.45833, 0, 0, 0.55], 112: Ad, 113: Ad, 114: [0, 0.45833, 0.01528, 0, 0.37222], 115: [0, 0.45833, 0, 0, 0.42167], 116: [0, 0.58929, 0, 0, 0.40417], 117: Cd, 118: [0, 0.45833, 0.01528, 0, 0.5], 119: [0, 0.45833, 0.01528, 0, 0.74445], 120: [0, 0.45833, 0, 0, 0.5], 121: [0.19444, 0.45833, 0.01528, 0, 0.5], 122: [0, 0.45833, 0, 0, 0.47639], 126: [0.35, 0.34444, 0, 0, 0.55], 160: $, 168: xe, 176: $t, 180: xe, 184: [0.17014, 0, 0, 0, 0.48889], 305: [0, 0.45833, 0, 0, 0.25556], 567: [0.19444, 0.45833, 0, 0, 0.28611], 710: xe, 711: [0, 0.63542, 0, 0, 0.55], 713: [0, 0.63778, 0, 0, 0.55], 728: xe, 729: Yo, 730: $t, 732: xe, 733: xe, 915: Ed, 916: [0, 0.69444, 0, 0, 0.91667], 920: Ys, 923: Td, 926: $t, 928: lr, 931: lr, 933: Ys, 934: lr, 936: Ys, 937: lr, 8211: [0, 0.45833, 0.03056, 0, 0.55], 8212: [0, 0.45833, 0.03056, 0, 1.10001], 8216: Yo, 8217: Yo, 8220: Qs, 8221: Qs }, "SansSerif-Italic": { 32: $, 33: [0, 0.69444, 0.05733, 0, 0.31945], 34: Pd, 35: [0.19444, 0.69444, 0.05087, 0, 0.83334], 36: [0.05556, 0.75, 0.11156, 0, 0.5], 37: [0.05556, 0.75, 0.03126, 0, 0.83334], 38: [0, 0.69444, 0.03058, 0, 0.75834], 39: rl, 40: [0.25, 0.75, 0.13164, 0, 0.38889], 41: [0.25, 0.75, 0.02536, 0, 0.38889], 42: [0, 0.75, 0.11775, 0, 0.5], 43: [0.08333, 0.58333, 0.02536, 0, 0.77778], 44: Nd, 45: [0, 0.44444, 0.01946, 0, 0.33333], 46: Fd, 47: [0.25, 0.75, 0.13164, 0, 0.5], 48: Mt, 49: Mt, 50: Mt, 51: Mt, 52: Mt, 53: Mt, 54: Mt, 55: Mt, 56: Mt, 57: Mt, 58: [0, 0.44444, 0.02502, 0, 0.27778], 59: [0.125, 0.44444, 0.02502, 0, 0.27778], 61: [-0.13, 0.37, 0.05087, 0, 0.77778], 63: [0, 0.69444, 0.11809, 0, 0.47222], 64: [0, 0.69444, 0.07555, 0, 0.66667], 65: Vt, 66: [0, 0.69444, 0.08293, 0, 0.66667], 67: [0, 0.69444, 0.11983, 0, 0.63889], 68: [0, 0.69444, 0.07555, 0, 0.72223], 69: [0, 0.69444, 0.11983, 0, 0.59722], 70: [0, 0.69444, 0.13372, 0, 0.56945], 71: [0, 0.69444, 0.11983, 0, 0.66667], 72: el, 73: [0, 0.69444, 0.13372, 0, 0.27778], 74: [0, 0.69444, 0.08094, 0, 0.47222], 75: [0, 0.69444, 0.11983, 0, 0.69445], 76: nl, 77: [0, 0.69444, 0.08094, 0, 0.875], 78: el, 79: [0, 0.69444, 0.07555, 0, 0.73611], 80: [0, 0.69444, 0.08293, 0, 0.63889], 81: [0.125, 0.69444, 0.07555, 0, 0.73611], 82: [0, 0.69444, 0.08293, 0, 0.64584], 83: [0, 0.69444, 0.09205, 0, 0.55556], 84: [0, 0.69444, 0.13372, 0, 0.68056], 85: [0, 0.69444, 0.08094, 0, 0.6875], 86: [0, 0.69444, 0.1615, 0, 0.66667], 87: [0, 0.69444, 0.1615, 0, 0.94445], 88: [0, 0.69444, 0.13372, 0, 0.66667], 89: [0, 0.69444, 0.17261, 0, 0.66667], 90: [0, 0.69444, 0.11983, 0, 0.61111], 91: [0.25, 0.75, 0.15942, 0, 0.28889], 93: [0.25, 0.75, 0.08719, 0, 0.28889], 94: Dd, 95: [0.35, 0.09444, 0.08616, 0, 0.5], 97: [0, 0.44444, 981e-5, 0, 0.48056], 98: [0, 0.69444, 0.03057, 0, 0.51667], 99: [0, 0.44444, 0.08336, 0, 0.44445], 100: [0, 0.69444, 0.09483, 0, 0.51667], 101: [0, 0.44444, 0.06778, 0, 0.44445], 102: [0, 0.69444, 0.21705, 0, 0.30556], 103: [0.19444, 0.44444, 0.10836, 0, 0.5], 104: [0, 0.69444, 0.01778, 0, 0.51667], 105: [0, 0.67937, 0.09718, 0, 0.23889], 106: [0.19444, 0.67937, 0.09162, 0, 0.26667], 107: [0, 0.69444, 0.08336, 0, 0.48889], 108: [0, 0.69444, 0.09483, 0, 0.23889], 109: [0, 0.44444, 0.01778, 0, 0.79445], 110: [0, 0.44444, 0.01778, 0, 0.51667], 111: [0, 0.44444, 0.06613, 0, 0.5], 112: [0.19444, 0.44444, 0.0389, 0, 0.51667], 113: [0.19444, 0.44444, 0.04169, 0, 0.51667], 114: [0, 0.44444, 0.10836, 0, 0.34167], 115: [0, 0.44444, 0.0778, 0, 0.38333], 116: [0, 0.57143, 0.07225, 0, 0.36111], 117: [0, 0.44444, 0.04169, 0, 0.51667], 118: [0, 0.44444, 0.10836, 0, 0.46111], 119: [0, 0.44444, 0.10836, 0, 0.68334], 120: [0, 0.44444, 0.09169, 0, 0.46111], 121: [0.19444, 0.44444, 0.10836, 0, 0.46111], 122: [0, 0.44444, 0.08752, 0, 0.43472], 126: [0.35, 0.32659, 0.08826, 0, 0.5], 160: $, 168: [0, 0.67937, 0.06385, 0, 0.5], 176: Kd, 184: tl, 305: [0, 0.44444, 0.04169, 0, 0.23889], 567: [0.19444, 0.44444, 0.04169, 0, 0.26667], 710: Dd, 711: [0, 0.63194, 0.08432, 0, 0.5], 713: [0, 0.60889, 0.08776, 0, 0.5], 714: Bd, 715: pe, 728: [0, 0.69444, 0.09483, 0, 0.5], 729: [0, 0.67937, 0.07774, 0, 0.27778], 730: Kd, 732: [0, 0.67659, 0.08826, 0, 0.5], 733: Bd, 915: [0, 0.69444, 0.13372, 0, 0.54167], 916: Jd, 920: [0, 0.69444, 0.07555, 0, 0.77778], 923: sr, 926: [0, 0.69444, 0.12816, 0, 0.66667], 928: el, 931: [0, 0.69444, 0.11983, 0, 0.72222], 933: Od, 934: [0, 0.69444, 0.04603, 0, 0.72222], 936: Od, 937: [0, 0.69444, 0.08293, 0, 0.72222], 8211: [0, 0.44444, 0.08616, 0, 0.5], 8212: [0, 0.44444, 0.08616, 0, 1], 8216: rl, 8217: rl, 8220: [0, 0.69444, 0.14205, 0, 0.5], 8221: Pd }, "SansSerif-Regular": { 32: $, 33: [0, 0.69444, 0, 0, 0.31945], 34: pe, 35: Rd, 36: Gs, 37: Id, 38: [0, 0.69444, 0, 0, 0.75834], 39: Nt, 40: Li, 41: Li, 42: zd, 43: Fe, 44: Nd, 45: [0, 0.44444, 0, 0, 0.33333], 46: Fd, 47: Ft, 48: wt, 49: wt, 50: wt, 51: wt, 52: wt, 53: wt, 54: wt, 55: wt, 56: wt, 57: wt, 58: [0, 0.44444, 0, 0, 0.27778], 59: [0.125, 0.44444, 0, 0, 0.27778], 61: [-0.13, 0.37, 0, 0, 0.77778], 63: il, 64: Vt, 65: Vt, 66: Vt, 67: Br, 68: [0, 0.69444, 0, 0, 0.72223], 69: $d, 70: [0, 0.69444, 0, 0, 0.56945], 71: Vt, 72: ol, 73: Nt, 74: il, 75: [0, 0.69444, 0, 0, 0.69445], 76: nl, 77: [0, 0.69444, 0, 0, 0.875], 78: ol, 79: [0, 0.69444, 0, 0, 0.73611], 80: Br, 81: [0.125, 0.69444, 0, 0, 0.73611], 82: [0, 0.69444, 0, 0, 0.64584], 83: Ai, 84: [0, 0.69444, 0, 0, 0.68056], 85: [0, 0.69444, 0, 0, 0.6875], 86: [0, 0.69444, 0.01389, 0, 0.66667], 87: [0, 0.69444, 0.01389, 0, 0.94445], 88: Vt, 89: [0, 0.69444, 0.025, 0, 0.66667], 90: sr, 91: Vd, 93: Vd, 94: pe, 95: [0.35, 0.09444, 0.02778, 0, 0.5], 97: [0, 0.44444, 0, 0, 0.48056], 98: al, 99: qd, 100: al, 101: qd, 102: [0, 0.69444, 0.06944, 0, 0.30556], 103: [0.19444, 0.44444, 0.01389, 0, 0.5], 104: al, 105: [0, 0.67937, 0, 0, 0.23889], 106: [0.19444, 0.67937, 0, 0, 0.26667], 107: [0, 0.69444, 0, 0, 0.48889], 108: [0, 0.69444, 0, 0, 0.23889], 109: [0, 0.44444, 0, 0, 0.79445], 110: Ud, 111: [0, 0.44444, 0, 0, 0.5], 112: Hd, 113: Hd, 114: [0, 0.44444, 0.01389, 0, 0.34167], 115: Wd, 116: [0, 0.57143, 0, 0, 0.36111], 117: Ud, 118: [0, 0.44444, 0.01389, 0, 0.46111], 119: [0, 0.44444, 0.01389, 0, 0.68334], 120: [0, 0.44444, 0, 0, 0.46111], 121: [0.19444, 0.44444, 0.01389, 0, 0.46111], 122: [0, 0.44444, 0, 0, 0.43472], 126: [0.35, 0.32659, 0, 0, 0.5], 160: $, 168: [0, 0.67937, 0, 0, 0.5], 176: Vt, 184: tl, 305: [0, 0.44444, 0, 0, 0.23889], 567: [0.19444, 0.44444, 0, 0, 0.26667], 710: pe, 711: [0, 0.63194, 0, 0, 0.5], 713: [0, 0.60889, 0, 0, 0.5], 714: pe, 715: pe, 728: pe, 729: [0, 0.67937, 0, 0, 0.27778], 730: Vt, 732: [0, 0.67659, 0, 0, 0.5], 733: pe, 915: nl, 916: Jd, 920: Pr, 923: sr, 926: Vt, 928: ol, 931: Ln, 933: Pr, 934: Ln, 936: Pr, 937: Ln, 8211: [0, 0.44444, 0.02778, 0, 0.5], 8212: [0, 0.44444, 0.02778, 0, 1], 8216: Nt, 8217: Nt, 8220: pe, 8221: pe }, "Script-Regular": { 32: $, 65: [0, 0.7, 0.22925, 0, 0.80253], 66: [0, 0.7, 0.04087, 0, 0.90757], 67: [0, 0.7, 0.1689, 0, 0.66619], 68: [0, 0.7, 0.09371, 0, 0.77443], 69: [0, 0.7, 0.18583, 0, 0.56162], 70: [0, 0.7, 0.13634, 0, 0.89544], 71: [0, 0.7, 0.17322, 0, 0.60961], 72: [0, 0.7, 0.29694, 0, 0.96919], 73: [0, 0.7, 0.19189, 0, 0.80907], 74: [0.27778, 0.7, 0.19189, 0, 1.05159], 75: [0, 0.7, 0.31259, 0, 0.91364], 76: [0, 0.7, 0.19189, 0, 0.87373], 77: [0, 0.7, 0.15981, 0, 1.08031], 78: [0, 0.7, 0.3525, 0, 0.9015], 79: [0, 0.7, 0.08078, 0, 0.73787], 80: [0, 0.7, 0.08078, 0, 1.01262], 81: [0, 0.7, 0.03305, 0, 0.88282], 82: [0, 0.7, 0.06259, 0, 0.85], 83: [0, 0.7, 0.19189, 0, 0.86767], 84: [0, 0.7, 0.29087, 0, 0.74697], 85: [0, 0.7, 0.25815, 0, 0.79996], 86: [0, 0.7, 0.27523, 0, 0.62204], 87: [0, 0.7, 0.27523, 0, 0.80532], 88: [0, 0.7, 0.26006, 0, 0.94445], 89: [0, 0.7, 0.2939, 0, 0.70961], 90: [0, 0.7, 0.24037, 0, 0.8212], 160: $ }, "Size1-Regular": { 32: $, 40: Gd, 41: Gd, 47: jd, 91: Xd, 92: jd, 93: Xd, 123: Zd, 125: Zd, 160: $, 710: Qo, 732: Qo, 770: Qo, 771: Qo, 8214: [-99e-5, 0.601, 0, 0, 0.77778], 8593: Yd, 8595: Yd, 8657: Qd, 8659: Qd, 8719: e0, 8720: e0, 8721: [0.25001, 0.75, 0, 0, 1.05556], 8730: [0.35001, 0.85, 0, 0, 1], 8739: [-599e-5, 0.606, 0, 0, 0.33333], 8741: [-599e-5, 0.606, 0, 0, 0.55556], 8747: r0, 8748: t0, 8749: t0, 8750: r0, 8896: Ci, 8897: Ci, 8898: Ci, 8899: Ci, 8968: Ei, 8969: Ei, 8970: Ei, 8971: Ei, 9168: cl, 10216: Ei, 10217: Ei, 10752: sl, 10753: sl, 10754: sl, 10756: Ci, 10758: Ci }, "Size2-Regular": { 32: $, 40: i0, 41: i0, 47: n0, 91: o0, 92: n0, 93: o0, 123: a0, 125: a0, 160: $, 710: ea, 732: ea, 770: ea, 771: ea, 8719: s0, 8720: s0, 8721: [0.55001, 1.05, 0, 0, 1.44445], 8730: [0.65002, 1.15, 0, 0, 1], 8747: c0, 8748: l0, 8749: l0, 8750: c0, 8896: Ti, 8897: Ti, 8898: Ti, 8899: Ti, 8968: ta, 8969: ta, 8970: ta, 8971: ta, 10216: u0, 10217: u0, 10752: ll, 10753: ll, 10754: ll, 10756: Ti, 10758: Ti }, "Size3-Regular": { 32: $, 40: d0, 41: d0, 47: m0, 91: p0, 92: m0, 93: p0, 123: ra, 125: ra, 160: $, 710: ia, 732: ia, 770: ia, 771: ia, 8730: [0.95003, 1.45, 0, 0, 1], 8968: na, 8969: na, 8970: na, 8971: na, 10216: ra, 10217: ra }, "Size4-Regular": { 32: $, 40: h0, 41: h0, 47: f0, 91: g0, 92: f0, 93: g0, 123: oa, 125: oa, 160: $, 710: aa, 732: aa, 770: aa, 771: aa, 8730: [1.25003, 1.75, 0, 0, 1], 8968: sa, 8969: sa, 8970: sa, 8971: sa, 9115: la, 9116: y0, 9117: la, 9118: la, 9119: y0, 9120: la, 9121: ca, 9122: cl, 9123: ca, 9124: ca, 9125: cl, 9126: ca, 9127: b0, 9128: x0, 9129: v0, 9130: [0, 0.3, 0, 0, 0.88889], 9131: b0, 9132: x0, 9133: v0, 9143: [0.88502, 0.915, 0, 0, 1.05556], 10216: oa, 10217: oa, 57344: _0, 57345: _0, 57680: ua, 57681: ua, 57682: ua, 57683: ua }, "Typewriter-Regular": { 32: k0, 33: E, 34: E, 35: E, 36: Ze, 37: Ze, 38: E, 39: E, 40: Ze, 41: Ze, 42: [0, 0.52083, 0, 0, 0.525], 43: M0, 44: [0.13889, 0.125, 0, 0, 0.525], 45: M0, 46: [0, 0.125, 0, 0, 0.525], 47: Ze, 48: E, 49: E, 50: E, 51: E, 52: E, 53: E, 54: E, 55: E, 56: E, 57: E, 58: Le, 59: [0.13889, 0.43056, 0, 0, 0.525], 60: w0, 61: [-0.19549, 0.41562, 0, 0, 0.525], 62: w0, 63: E, 64: E, 65: E, 66: E, 67: E, 68: E, 69: E, 70: E, 71: E, 72: E, 73: E, 74: E, 75: E, 76: E, 77: E, 78: E, 79: E, 80: E, 81: [0.13889, 0.61111, 0, 0, 0.525], 82: E, 83: E, 84: E, 85: E, 86: E, 87: E, 88: E, 89: E, 90: E, 91: Ze, 92: Ze, 93: Ze, 94: E, 95: [0.09514, 0, 0, 0, 0.525], 96: E, 97: Le, 98: E, 99: Le, 100: E, 101: Le, 102: E, 103: Tn, 104: E, 105: E, 106: [0.22222, 0.61111, 0, 0, 0.525], 107: E, 108: E, 109: Le, 110: Le, 111: Le, 112: Tn, 113: Tn, 114: Le, 115: Le, 116: [0, 0.55358, 0, 0, 0.525], 117: Le, 118: Le, 119: Le, 120: Le, 121: Tn, 122: Le, 123: Ze, 124: Ze, 125: Ze, 126: E, 127: E, 160: k0, 176: E, 184: [0.19445, 0, 0, 0, 0.525], 305: Le, 567: Tn, 711: [0, 0.56597, 0, 0, 0.525], 713: [0, 0.56555, 0, 0, 0.525], 714: E, 715: E, 728: E, 730: E, 770: E, 771: E, 776: E, 915: E, 916: E, 920: E, 923: E, 926: E, 928: E, 931: E, 933: E, 934: E, 936: E, 937: E, 8216: E, 8217: E, 8242: E, 9251: [0.11111, 0.21944, 0, 0, 0.525] } };
var uh = /[\u3040-\u309F]|[\u30A0-\u30FF]|[\u4E00-\u9FAF]|[\uAC00-\uD7AF]/;
var kt = 10;
var Ae = 0.25;
var A0 = 1.2;
var $e = 0.431;
var ul = { slant: [0.25, 0.25, 0.25], space: [0, 0, 0], stretch: [0, 0, 0], shrink: [0, 0, 0], xHeight: [$e, $e, $e], quad: [1, 1.171, 1.472], extraSpace: [0, 0, 0], num1: [0.5, 0.732, 0.925], num2: [0.394, 0.384, 0.5], num3: [0.444, 0.471, 0.504], denom1: [0.686, 0.752, 1.025], denom2: [0.345, 0.344, 0.532], sup1: [0.413, 0.503, 0.504], sup2: [0.363, 0.431, 0.404], sup3: [0.289, 0.286, 0.294], sub1: [0.15, 0.143, 0.2], sub2: [0.247, 0.286, 0.4], supDrop: [0.386, 0.353, 0.494], subDrop: [0.05, 0.071, 0.1], delim1: [2.39, 1.7, 1.98], delim2: [1.01, 1.157, 1.42], axisHeight: [Ae, Ae, Ae], defaultRuleThickness: [0.04, 0.049, 0.049], bigOpSpacing1: [0.111, 0.111, 0.111], bigOpSpacing2: [0.166, 0.166, 0.166], bigOpSpacing3: [0.2, 0.2, 0.2], bigOpSpacing4: [0.6, 0.611, 0.611], bigOpSpacing5: [0.1, 0.143, 0.143], sqrtRuleThickness: [0.04, 0.04, 0.04] };
var Dn = [0, 0.5, 0.7, 0.8, 0.9, 1, 1.2, 1.44, 1.728, 2.074, 2.488];
var Di = 5;
var L0 = { "\xA0": " ", "\u200B": " ", \u00C5: "A", \u00C7: "C", \u00D0: "D", \u00DE: "o", \u00E5: "a", \u00E7: "c", \u00F0: "d", \u00FE: "o", \u0410: "A", \u0411: "B", \u0412: "B", \u0413: "F", \u0414: "A", \u0415: "E", \u0416: "K", \u0417: "3", \u0418: "N", \u0419: "N", \u041A: "K", \u041B: "N", \u041C: "M", \u041D: "H", \u041E: "O", \u041F: "N", \u0420: "P", \u0421: "C", \u0422: "T", \u0423: "y", \u0424: "O", \u0425: "X", \u0426: "U", \u0427: "h", \u0428: "W", \u0429: "W", \u042A: "B", \u042B: "X", \u042C: "B", \u042D: "3", \u042E: "X", \u042F: "R", \u0430: "a", \u0431: "b", \u0432: "a", \u0433: "r", \u0434: "y", \u0435: "e", \u0436: "m", \u0437: "e", \u0438: "n", \u0439: "n", \u043A: "n", \u043B: "n", \u043C: "m", \u043D: "n", \u043E: "o", \u043F: "n", \u0440: "p", \u0441: "c", \u0442: "o", \u0443: "y", \u0444: "b", \u0445: "x", \u0446: "n", \u0447: "n", \u0448: "w", \u0449: "w", \u044A: "a", \u044B: "m", \u044C: "a", \u044D: "e", \u044E: "m", \u044F: "r" };
function cr(t37, e) {
t37 === void 0 && (t37 = 77);
let r = S0[e][t37];
if (r)
return { defaultMetrics: false, depth: r[0], height: r[1], italic: r[2], skew: r[3], width: r[4] };
if (t37 === 11034)
return { defaultMetrics: true, depth: 0.2, height: 0.8, italic: 0, skew: 0, width: 0.8 };
let i = String.fromCodePoint(t37);
if (i in L0)
t37 = L0[i].codePointAt(0);
else if (uh.test(i))
return t37 = 77, { defaultMetrics: true, depth: 0.2, height: 0.9, italic: 0, skew: 0, width: 1 };
return { defaultMetrics: true, depth: 0.2, height: 0.7, italic: 0, skew: 0, width: 0.8 };
}
var dl = { overrightarrow: [["rightarrow"], 0.888, 522, "xMaxYMin"], overleftarrow: [["leftarrow"], 0.888, 522, "xMinYMin"], underrightarrow: [["rightarrow"], 0.888, 522, "xMaxYMin"], underleftarrow: [["leftarrow"], 0.888, 522, "xMinYMin"], xrightarrow: [["rightarrow"], 1.469, 522, "xMaxYMin"], longrightarrow: [["rightarrow"], 1.469, 522, "xMaxYMin"], xleftarrow: [["leftarrow"], 1.469, 522, "xMinYMin"], longleftarrow: [["leftarrow"], 1.469, 522, "xMinYMin"], Overrightarrow: [["doublerightarrow"], 0.888, 560, "xMaxYMin"], xRightarrow: [["doublerightarrow"], 1.526, 560, "xMaxYMin"], xLeftarrow: [["doubleleftarrow"], 1.526, 560, "xMinYMin"], overleftharpoon: [["leftharpoon"], 0.888, 522, "xMinYMin"], xleftharpoonup: [["leftharpoon"], 0.888, 522, "xMinYMin"], xleftharpoondown: [["leftharpoondown"], 0.888, 522, "xMinYMin"], overrightharpoon: [["rightharpoon"], 0.888, 522, "xMaxYMin"], xrightharpoonup: [["rightharpoon"], 0.888, 522, "xMaxYMin"], xrightharpoondown: [["rightharpoondown"], 0.888, 522, "xMaxYMin"], xlongequal: [["longequal"], 0.888, 334, "xMinYMin"], xtwoheadleftarrow: [["twoheadleftarrow"], 0.888, 334, "xMinYMin"], xtwoheadrightarrow: [["twoheadrightarrow"], 0.888, 334, "xMaxYMin"], overleftrightarrow: [["leftarrow", "rightarrow"], 0.888, 522], overbrace: [["leftbrace", "midbrace", "rightbrace"], 1.6, 548], underbrace: [["leftbraceunder", "midbraceunder", "rightbraceunder"], 1.6, 548], underleftrightarrow: [["leftarrow", "rightarrow"], 0.888, 522], xleftrightarrow: [["leftarrow", "rightarrow"], 1.75, 522], longleftrightarrow: [["leftarrow", "rightarrow"], 1.75, 522], xLeftrightarrow: [["doubleleftarrow", "doublerightarrow"], 1.75, 560], xrightleftharpoons: [["leftharpoondownplus", "rightharpoonplus"], 1.75, 716], longrightleftharpoons: [["leftharpoondownplus", "rightharpoonplus"], 1.75, 716], xleftrightharpoons: [["leftharpoonplus", "rightharpoondownplus"], 1.75, 716], longleftrightharpoons: [["leftharpoonplus", "rightharpoondownplus"], 1.75, 716], xhookleftarrow: [["leftarrow", "righthook"], 1.08, 522], xhookrightarrow: [["lefthook", "rightarrow"], 1.08, 522], overlinesegment: [["leftlinesegment", "rightlinesegment"], 0.888, 522], underlinesegment: [["leftlinesegment", "rightlinesegment"], 0.888, 522], overgroup: [["leftgroup", "rightgroup"], 0.888, 342], undergroup: [["leftgroupunder", "rightgroupunder"], 0.888, 342], xmapsto: [["leftmapsto", "rightarrow"], 1.5, 522], xtofrom: [["leftToFrom", "rightToFrom"], 1.75, 528], xleftrightarrows: [["baraboveleftarrow", "rightarrowabovebar"], 1.75, 901], longleftrightarrows: [["baraboveleftarrow", "rightarrowabovebar"], 1.75, 901], xRightleftharpoons: [["baraboveshortleftharpoon", "rightharpoonaboveshortbar"], 1.75, 716], longRightleftharpoons: [["baraboveshortleftharpoon", "rightharpoonaboveshortbar"], 1.75, 716], xLeftrightharpoons: [["shortbaraboveleftharpoon", "shortrightharpoonabovebar"], 1.75, 716], longLeftrightharpoons: [["shortbaraboveleftharpoon", "shortrightharpoonabovebar"], 1.75, 716] };
var ml = { widehat1: [1062, 239, 0.24], widehat2: [2364, 300, 0.3], widehat3: [2364, 360, 0.36], widehat4: [2364, 420, 0.42], widecheck1: [1062, 239, 0.24], widecheck2: [2364, 300, 0.3], widecheck3: [2364, 360, 0.36], widecheck4: [2364, 420, 0.42], widetilde1: [600, 260, 0.26], widetilde2: [1033, 286, 0.286], widetilde3: [2339, 306, 0.306], widetilde4: [2340, 312, 0.34], overarc: [1061, 159, 0.3], underarc: [1061, 159, 0.3] };
var C0 = { doubleleftarrow: `M262 157
l10-10c34-36 62.7-77 86-123 3.3-8 5-13.3 5-16 0-5.3-6.7-8-20-8-7.3
0-12.2.5-14.5 1.5-2.3 1-4.8 4.5-7.5 10.5-49.3 97.3-121.7 169.3-217 216-28
14-57.3 25-88 33-6.7 2-11 3.8-13 5.5-2 1.7-3 4.2-3 7.5s1 5.8 3 7.5
c2 1.7 6.3 3.5 13 5.5 68 17.3 128.2 47.8 180.5 91.5 52.3 43.7 93.8 96.2 124.5
157.5 9.3 8 15.3 12.3 18 13h6c12-.7 18-4 18-10 0-2-1.7-7-5-15-23.3-46-52-87
-86-123l-10-10h399738v-40H218c328 0 0 0 0 0l-10-8c-26.7-20-65.7-43-117-69 2.7
-2 6-3.7 10-5 36.7-16 72.3-37.3 107-64l10-8h399782v-40z
m8 0v40h399730v-40zm0 194v40h399730v-40z`, doublerightarrow: `M399738 392l
-10 10c-34 36-62.7 77-86 123-3.3 8-5 13.3-5 16 0 5.3 6.7 8 20 8 7.3 0 12.2-.5
14.5-1.5 2.3-1 4.8-4.5 7.5-10.5 49.3-97.3 121.7-169.3 217-216 28-14 57.3-25 88
-33 6.7-2 11-3.8 13-5.5 2-1.7 3-4.2 3-7.5s-1-5.8-3-7.5c-2-1.7-6.3-3.5-13-5.5-68
-17.3-128.2-47.8-180.5-91.5-52.3-43.7-93.8-96.2-124.5-157.5-9.3-8-15.3-12.3-18
-13h-6c-12 .7-18 4-18 10 0 2 1.7 7 5 15 23.3 46 52 87 86 123l10 10H0v40h399782
c-328 0 0 0 0 0l10 8c26.7 20 65.7 43 117 69-2.7 2-6 3.7-10 5-36.7 16-72.3 37.3
-107 64l-10 8H0v40zM0 157v40h399730v-40zm0 194v40h399730v-40z`, leftarrow: `M400000 241H110l3-3c68.7-52.7 113.7-120
135-202 4-14.7 6-23 6-25 0-7.3-7-11-21-11-8 0-13.2.8-15.5 2.5-2.3 1.7-4.2 5.8
-5.5 12.5-1.3 4.7-2.7 10.3-4 17-12 48.7-34.8 92-68.5 130S65.3 228.3 18 247
c-10 4-16 7.7-18 11 0 8.7 6 14.3 18 17 47.3 18.7 87.8 47 121.5 85S196 441.3 208
490c.7 2 1.3 5 2 9s1.2 6.7 1.5 8c.3 1.3 1 3.3 2 6s2.2 4.5 3.5 5.5c1.3 1 3.3
1.8 6 2.5s6 1 10 1c14 0 21-3.7 21-11 0-2-2-10.3-6-25-20-79.3-65-146.7-135-202
l-3-3h399890zM100 241v40h399900v-40z`, leftbrace: `M6 548l-6-6v-35l6-11c56-104 135.3-181.3 238-232 57.3-28.7 117
-45 179-50h399577v120H403c-43.3 7-81 15-113 26-100.7 33-179.7 91-237 174-2.7
5-6 9-10 13-.7 1-7.3 1-20 1H6z`, leftbraceunder: `M0 6l6-6h17c12.688 0 19.313.3 20 1 4 4 7.313 8.3 10 13
35.313 51.3 80.813 93.8 136.5 127.5 55.688 33.7 117.188 55.8 184.5 66.5.688
0 2 .3 4 1 18.688 2.7 76 4.3 172 5h399450v120H429l-6-1c-124.688-8-235-61.7
-331-161C60.687 138.7 32.312 99.3 7 54L0 41V6z`, overarc: "M529 0c179 0 524 115 524 115 5 1 9 5 9 10 0 1-1 2-1 3l-4 22c-1 5-5 9-11 9h-2s-338-93-512-92c-174 0-513 92-513 92h-2c-5 0-9-4-11-9l-5-22c-1-6 2-12 8-13 0 0 342-115 520-115z", underarc: `m 529 160
c -179 0 -524 -115 -524 -115
c -5 -1 -9 -5 -9 -10
c 0 -1 1 -2 1 -3
l 4 -22
c 1 -5 5 -9 11 -9
h 2
s 338 93 512 92
c 174 0 513 -92 513 -92
h 2
c 5 0 9 4 11 9
l 5 22
c 1 6 -2 12 -8 13
c 0 0 -342 115 -520 115
z
`, leftgroup: `M400000 80
H435C64 80 168.3 229.4 21 260c-5.9 1.2-18 0-18 0-2 0-3-1-3-3v-38C76 61 257 0
435 0h399565z`, leftgroupunder: `M400000 262
H435C64 262 168.3 112.6 21 82c-5.9-1.2-18 0-18 0-2 0-3 1-3 3v38c76 158 257 219
435 219h399565z`, leftharpoon: `M0 267c.7 5.3 3 10 7 14h399993v-40H93c3.3
-3.3 10.2-9.5 20.5-18.5s17.8-15.8 22.5-20.5c50.7-52 88-110.3 112-175 4-11.3 5
-18.3 3-21-1.3-4-7.3-6-18-6-8 0-13 .7-15 2s-4.7 6.7-8 16c-42 98.7-107.3 174.7
-196 228-6.7 4.7-10.7 8-12 10-1.3 2-2 5.7-2 11zm100-26v40h399900v-40z`, leftharpoonplus: `M0 267c.7 5.3 3 10 7 14h399993v-40H93c3.3-3.3 10.2-9.5
20.5-18.5s17.8-15.8 22.5-20.5c50.7-52 88-110.3 112-175 4-11.3 5-18.3 3-21-1.3
-4-7.3-6-18-6-8 0-13 .7-15 2s-4.7 6.7-8 16c-42 98.7-107.3 174.7-196 228-6.7 4.7
-10.7 8-12 10-1.3 2-2 5.7-2 11zm100-26v40h399900v-40zM0 435v40h400000v-40z
m0 0v40h400000v-40z`, leftharpoondown: `M7 241c-4 4-6.333 8.667-7 14 0 5.333.667 9 2 11s5.333
5.333 12 10c90.667 54 156 130 196 228 3.333 10.667 6.333 16.333 9 17 2 .667 5
1 9 1h5c10.667 0 16.667-2 18-6 2-2.667 1-9.667-3-21-32-87.333-82.667-157.667
-152-211l-3-3h399907v-40zM93 281 H400000 v-40L7 241z`, leftharpoondownplus: `M7 435c-4 4-6.3 8.7-7 14 0 5.3.7 9 2 11s5.3 5.3 12
10c90.7 54 156 130 196 228 3.3 10.7 6.3 16.3 9 17 2 .7 5 1 9 1h5c10.7 0 16.7
-2 18-6 2-2.7 1-9.7-3-21-32-87.3-82.7-157.7-152-211l-3-3h399907v-40H7zm93 0
v40h399900v-40zM0 241v40h399900v-40zm0 0v40h399900v-40z`, lefthook: `M400000 281 H103s-33-11.2-61-33.5S0 197.3 0 164s14.2-61.2 42.5
-83.5C70.8 58.2 104 47 142 47 c16.7 0 25 6.7 25 20 0 12-8.7 18.7-26 20-40 3.3
-68.7 15.7-86 37-10 12-15 25.3-15 40 0 22.7 9.8 40.7 29.5 54 19.7 13.3 43.5 21
71.5 23h399859zM103 281v-40h399897v40z`, leftlinesegment: `M40 281 V428 H0 V94 H40 V241 H400000 v40z
M40 281 V428 H0 V94 H40 V241 H400000 v40z`, leftmapsto: `M40 281 V448H0V74H40V241H400000v40z
M40 281 V448H0V74H40V241H400000v40z`, leftToFrom: `M0 147h400000v40H0zm0 214c68 40 115.7 95.7 143 167h22c15.3 0 23
-.3 23-1 0-1.3-5.3-13.7-16-37-18-35.3-41.3-69-70-101l-7-8h399905v-40H95l7-8
c28.7-32 52-65.7 70-101 10.7-23.3 16-35.7 16-37 0-.7-7.7-1-23-1h-22C115.7 265.3
68 321 0 361zm0-174v-40h399900v40zm100 154v40h399900v-40z`, longequal: `M0 50 h400000 v40H0z m0 194h40000v40H0z
M0 50 h400000 v40H0z m0 194h40000v40H0z`, midbrace: `M200428 334
c-100.7-8.3-195.3-44-280-108-55.3-42-101.7-93-139-153l-9-14c-2.7 4-5.7 8.7-9 14
-53.3 86.7-123.7 153-211 199-66.7 36-137.3 56.3-212 62H0V214h199568c178.3-11.7
311.7-78.3 403-201 6-8 9.7-12 11-12 .7-.7 6.7-1 18-1s17.3.3 18 1c1.3 0 5 4 11
12 44.7 59.3 101.3 106.3 170 141s145.3 54.3 229 60h199572v120z`, midbraceunder: `M199572 214
c100.7 8.3 195.3 44 280 108 55.3 42 101.7 93 139 153l9 14c2.7-4 5.7-8.7 9-14
53.3-86.7 123.7-153 211-199 66.7-36 137.3-56.3 212-62h199568v120H200432c-178.3
11.7-311.7 78.3-403 201-6 8-9.7 12-11 12-.7.7-6.7 1-18 1s-17.3-.3-18-1c-1.3 0
-5-4-11-12-44.7-59.3-101.3-106.3-170-141s-145.3-54.3-229-60H0V214z`, oiintSize1: `M512.6 71.6c272.6 0 320.3 106.8 320.3 178.2 0 70.8-47.7 177.6
-320.3 177.6S193.1 320.6 193.1 249.8c0-71.4 46.9-178.2 319.5-178.2z
m368.1 178.2c0-86.4-60.9-215.4-368.1-215.4-306.4 0-367.3 129-367.3 215.4 0 85.8
60.9 214.8 367.3 214.8 307.2 0 368.1-129 368.1-214.8z`, oiintSize2: `M757.8 100.1c384.7 0 451.1 137.6 451.1 230 0 91.3-66.4 228.8
-451.1 228.8-386.3 0-452.7-137.5-452.7-228.8 0-92.4 66.4-230 452.7-230z
m502.4 230c0-111.2-82.4-277.2-502.4-277.2s-504 166-504 277.2
c0 110 84 276 504 276s502.4-166 502.4-276z`, oiiintSize1: `M681.4 71.6c408.9 0 480.5 106.8 480.5 178.2 0 70.8-71.6 177.6
-480.5 177.6S202.1 320.6 202.1 249.8c0-71.4 70.5-178.2 479.3-178.2z
m525.8 178.2c0-86.4-86.8-215.4-525.7-215.4-437.9 0-524.7 129-524.7 215.4 0
85.8 86.8 214.8 524.7 214.8 438.9 0 525.7-129 525.7-214.8z`, oiiintSize2: `M1021.2 53c603.6 0 707.8 165.8 707.8 277.2 0 110-104.2 275.8
-707.8 275.8-606 0-710.2-165.8-710.2-275.8C311 218.8 415.2 53 1021.2 53z
m770.4 277.1c0-131.2-126.4-327.6-770.5-327.6S248.4 198.9 248.4 330.1
c0 130 128.8 326.4 772.7 326.4s770.5-196.4 770.5-326.4z`, rightarrow: `M0 241v40h399891c-47.3 35.3-84 78-110 128
-16.7 32-27.7 63.7-33 95 0 1.3-.2 2.7-.5 4-.3 1.3-.5 2.3-.5 3 0 7.3 6.7 11 20
11 8 0 13.2-.8 15.5-2.5 2.3-1.7 4.2-5.5 5.5-11.5 2-13.3 5.7-27 11-41 14.7-44.7
39-84.5 73-119.5s73.7-60.2 119-75.5c6-2 9-5.7 9-11s-3-9-9-11c-45.3-15.3-85
-40.5-119-75.5s-58.3-74.8-73-119.5c-4.7-14-8.3-27.3-11-40-1.3-6.7-3.2-10.8-5.5
-12.5-2.3-1.7-7.5-2.5-15.5-2.5-14 0-21 3.7-21 11 0 2 2 10.3 6 25 20.7 83.3 67
151.7 139 205zm0 0v40h399900v-40z`, rightbrace: `M400000 542l
-6 6h-17c-12.7 0-19.3-.3-20-1-4-4-7.3-8.3-10-13-35.3-51.3-80.8-93.8-136.5-127.5
s-117.2-55.8-184.5-66.5c-.7 0-2-.3-4-1-18.7-2.7-76-4.3-172-5H0V214h399571l6 1
c124.7 8 235 61.7 331 161 31.3 33.3 59.7 72.7 85 118l7 13v35z`, rightbraceunder: `M399994 0l6 6v35l-6 11c-56 104-135.3 181.3-238 232-57.3
28.7-117 45-179 50H-300V214h399897c43.3-7 81-15 113-26 100.7-33 179.7-91 237
-174 2.7-5 6-9 10-13 .7-1 7.3-1 20-1h17z`, rightgroup: `M0 80h399565c371 0 266.7 149.4 414 180 5.9 1.2 18 0 18 0 2 0
3-1 3-3v-38c-76-158-257-219-435-219H0z`, rightgroupunder: `M0 262h399565c371 0 266.7-149.4 414-180 5.9-1.2 18 0 18
0 2 0 3 1 3 3v38c-76 158-257 219-435 219H0z`, rightharpoon: `M0 241v40h399993c4.7-4.7 7-9.3 7-14 0-9.3
-3.7-15.3-11-18-92.7-56.7-159-133.7-199-231-3.3-9.3-6-14.7-8-16-2-1.3-7-2-15-2
-10.7 0-16.7 2-18 6-2 2.7-1 9.7 3 21 15.3 42 36.7 81.8 64 119.5 27.3 37.7 58
69.2 92 94.5zm0 0v40h399900v-40z`, rightharpoonplus: `M0 241v40h399993c4.7-4.7 7-9.3 7-14 0-9.3-3.7-15.3-11
-18-92.7-56.7-159-133.7-199-231-3.3-9.3-6-14.7-8-16-2-1.3-7-2-15-2-10.7 0-16.7
2-18 6-2 2.7-1 9.7 3 21 15.3 42 36.7 81.8 64 119.5 27.3 37.7 58 69.2 92 94.5z
m0 0v40h399900v-40z m100 194v40h399900v-40zm0 0v40h399900v-40z`, rightharpoondown: `M399747 511c0 7.3 6.7 11 20 11 8 0 13-.8 15-2.5s4.7-6.8
8-15.5c40-94 99.3-166.3 178-217 13.3-8 20.3-12.3 21-13 5.3-3.3 8.5-5.8 9.5
-7.5 1-1.7 1.5-5.2 1.5-10.5s-2.3-10.3-7-15H0v40h399908c-34 25.3-64.7 57-92 95
-27.3 38-48.7 77.7-64 119-3.3 8.7-5 14-5 16zM0 241v40h399900v-40z`, rightharpoondownplus: `M399747 705c0 7.3 6.7 11 20 11 8 0 13-.8
15-2.5s4.7-6.8 8-15.5c40-94 99.3-166.3 178-217 13.3-8 20.3-12.3 21-13 5.3-3.3
8.5-5.8 9.5-7.5 1-1.7 1.5-5.2 1.5-10.5s-2.3-10.3-7-15H0v40h399908c-34 25.3
-64.7 57-92 95-27.3 38-48.7 77.7-64 119-3.3 8.7-5 14-5 16zM0 435v40h399900v-40z
m0-194v40h400000v-40zm0 0v40h400000v-40z`, righthook: `M399859 241c-764 0 0 0 0 0 40-3.3 68.7-15.7 86-37 10-12 15-25.3
15-40 0-22.7-9.8-40.7-29.5-54-19.7-13.3-43.5-21-71.5-23-17.3-1.3-26-8-26-20 0
-13.3 8.7-20 26-20 38 0 71 11.2 99 33.5 0 0 7 5.6 21 16.7 14 11.2 21 33.5 21
66.8s-14 61.2-42 83.5c-28 22.3-61 33.5-99 33.5L0 241z M0 281v-40h399859v40z`, rightlinesegment: `M399960 241 V94 h40 V428 h-40 V281 H0 v-40z
M399960 241 V94 h40 V428 h-40 V281 H0 v-40z`, rightToFrom: `M400000 167c-70.7-42-118-97.7-142-167h-23c-15.3 0-23 .3-23
1 0 1.3 5.3 13.7 16 37 18 35.3 41.3 69 70 101l7 8H0v40h399905l-7 8c-28.7 32
-52 65.7-70 101-10.7 23.3-16 35.7-16 37 0 .7 7.7 1 23 1h23c24-69.3 71.3-125 142
-167z M100 147v40h399900v-40zM0 341v40h399900v-40z`, twoheadleftarrow: `M0 167c68 40
115.7 95.7 143 167h22c15.3 0 23-.3 23-1 0-1.3-5.3-13.7-16-37-18-35.3-41.3-69
-70-101l-7-8h125l9 7c50.7 39.3 85 86 103 140h46c0-4.7-6.3-18.7-19-42-18-35.3
-40-67.3-66-96l-9-9h399716v-40H284l9-9c26-28.7 48-60.7 66-96 12.7-23.333 19
-37.333 19-42h-46c-18 54-52.3 100.7-103 140l-9 7H95l7-8c28.7-32 52-65.7 70-101
10.7-23.333 16-35.7 16-37 0-.7-7.7-1-23-1h-22C115.7 71.3 68 127 0 167z`, twoheadrightarrow: `M400000 167
c-68-40-115.7-95.7-143-167h-22c-15.3 0-23 .3-23 1 0 1.3 5.3 13.7 16 37 18 35.3
41.3 69 70 101l7 8h-125l-9-7c-50.7-39.3-85-86-103-140h-46c0 4.7 6.3 18.7 19 42
18 35.3 40 67.3 66 96l9 9H0v40h399716l-9 9c-26 28.7-48 60.7-66 96-12.7 23.333
-19 37.333-19 42h46c18-54 52.3-100.7 103-140l9-7h125l-7 8c-28.7 32-52 65.7-70
101-10.7 23.333-16 35.7-16 37 0 .7 7.7 1 23 1h22c27.3-71.3 75-127 143-167z`, widetilde1: `M200 55.538c-77 0-168 73.953-177 73.953-3 0-7
-2.175-9-5.437L2 97c-1-2-2-4-2-6 0-4 2-7 5-9l20-12C116 12 171 0 207 0c86 0
114 68 191 68 78 0 168-68 177-68 4 0 7 2 9 5l12 19c1 2.175 2 4.35 2 6.525 0
4.35-2 7.613-5 9.788l-19 13.05c-92 63.077-116.937 75.308-183 76.128
-68.267.847-113-73.952-191-73.952z`, widetilde2: `M344 55.266c-142 0-300.638 81.316-311.5 86.418
-8.01 3.762-22.5 10.91-23.5 5.562L1 120c-1-2-1-3-1-4 0-5 3-9 8-10l18.4-9C160.9
31.9 283 0 358 0c148 0 188 122 331 122s314-97 326-97c4 0 8 2 10 7l7 21.114
c1 2.14 1 3.21 1 4.28 0 5.347-3 9.626-7 10.696l-22.3 12.622C852.6 158.372 751
181.476 676 181.476c-149 0-189-126.21-332-126.21z`, widetilde3: `M786 59C457 59 32 175.242 13 175.242c-6 0-10-3.457
-11-10.37L.15 138c-1-7 3-12 10-13l19.2-6.4C378.4 40.7 634.3 0 804.3 0c337 0
411.8 157 746.8 157 328 0 754-112 773-112 5 0 10 3 11 9l1 14.075c1 8.066-.697
16.595-6.697 17.492l-21.052 7.31c-367.9 98.146-609.15 122.696-778.15 122.696
-338 0-409-156.573-744-156.573z`, widetilde4: `M786 58C457 58 32 177.487 13 177.487c-6 0-10-3.345
-11-10.035L.15 143c-1-7 3-12 10-13l22-6.7C381.2 35 637.15 0 807.15 0c337 0 409
177 744 177 328 0 754-127 773-127 5 0 10 3 11 9l1 14.794c1 7.805-3 13.38-9
14.495l-20.7 5.574c-366.85 99.79-607.3 139.372-776.3 139.372-338 0-409
-175.236-744-175.236z`, vec: `M377 20c0-5.333 1.833-10 5.5-14S391 0 397 0c4.667 0 8.667 1.667 12 5
3.333 2.667 6.667 9 10 19 6.667 24.667 20.333 43.667 41 57 7.333 4.667 11
10.667 11 18 0 6-1 10-3 12s-6.667 5-14 9c-28.667 14.667-53.667 35.667-75 63
-1.333 1.333-3.167 3.5-5.5 6.5s-4 4.833-5 5.5c-1 .667-2.5 1.333-4.5 2s-4.333 1
-7 1c-4.667 0-9.167-1.833-13.5-5.5S337 184 337 178c0-12.667 15.667-32.333 47-59
H213l-171-1c-8.667-6-13-12.333-13-19 0-4.667 4.333-11.333 13-20h359
c-16-25.333-24-45-24-59z`, widehat1: `M529 0h5l519 115c5 1 9 5 9 10 0 1-1 2-1 3l-4 22
c-1 5-5 9-11 9h-2L532 67 19 159h-2c-5 0-9-4-11-9l-5-22c-1-6 2-12 8-13z`, widehat2: `M1181 0h2l1171 176c6 0 10 5 10 11l-2 23c-1 6-5 10
-11 10h-1L1182 67 15 220h-1c-6 0-10-4-11-10l-2-23c-1-6 4-11 10-11z`, widehat3: `M1181 0h2l1171 236c6 0 10 5 10 11l-2 23c-1 6-5 10
-11 10h-1L1182 67 15 280h-1c-6 0-10-4-11-10l-2-23c-1-6 4-11 10-11z`, widehat4: `M1181 0h2l1171 296c6 0 10 5 10 11l-2 23c-1 6-5 10
-11 10h-1L1182 67 15 340h-1c-6 0-10-4-11-10l-2-23c-1-6 4-11 10-11z`, widecheck1: `M529,159h5l519,-115c5,-1,9,-5,9,-10c0,-1,-1,-2,-1,-3l-4,-22c-1,
-5,-5,-9,-11,-9h-2l-512,92l-513,-92h-2c-5,0,-9,4,-11,9l-5,22c-1,6,2,12,8,13z`, widecheck2: `M1181,220h2l1171,-176c6,0,10,-5,10,-11l-2,-23c-1,-6,-5,-10,
-11,-10h-1l-1168,153l-1167,-153h-1c-6,0,-10,4,-11,10l-2,23c-1,6,4,11,10,11z`, widecheck3: `M1181,280h2l1171,-236c6,0,10,-5,10,-11l-2,-23c-1,-6,-5,-10,
-11,-10h-1l-1168,213l-1167,-213h-1c-6,0,-10,4,-11,10l-2,23c-1,6,4,11,10,11z`, widecheck4: `M1181,340h2l1171,-296c6,0,10,-5,10,-11l-2,-23c-1,-6,-5,-10,
-11,-10h-1l-1168,273l-1167,-273h-1c-6,0,-10,4,-11,10l-2,23c-1,6,4,11,10,11z`, baraboveleftarrow: `M400000 620h-399890l3 -3c68.7 -52.7 113.7 -120 135 -202
c4 -14.7 6 -23 6 -25c0 -7.3 -7 -11 -21 -11c-8 0 -13.2 0.8 -15.5 2.5
c-2.3 1.7 -4.2 5.8 -5.5 12.5c-1.3 4.7 -2.7 10.3 -4 17c-12 48.7 -34.8 92 -68.5 130
s-74.2 66.3 -121.5 85c-10 4 -16 7.7 -18 11c0 8.7 6 14.3 18 17c47.3 18.7 87.8 47
121.5 85s56.5 81.3 68.5 130c0.7 2 1.3 5 2 9s1.2 6.7 1.5 8c0.3 1.3 1 3.3 2 6
s2.2 4.5 3.5 5.5c1.3 1 3.3 1.8 6 2.5s6 1 10 1c14 0 21 -3.7 21 -11
c0 -2 -2 -10.3 -6 -25c-20 -79.3 -65 -146.7 -135 -202l-3 -3h399890z
M100 620v40h399900v-40z M0 241v40h399900v-40zM0 241v40h399900v-40z`, rightarrowabovebar: `M0 241v40h399891c-47.3 35.3-84 78-110 128-16.7 32
-27.7 63.7-33 95 0 1.3-.2 2.7-.5 4-.3 1.3-.5 2.3-.5 3 0 7.3 6.7 11 20 11 8 0
13.2-.8 15.5-2.5 2.3-1.7 4.2-5.5 5.5-11.5 2-13.3 5.7-27 11-41 14.7-44.7 39
-84.5 73-119.5s73.7-60.2 119-75.5c6-2 9-5.7 9-11s-3-9-9-11c-45.3-15.3-85-40.5
-119-75.5s-58.3-74.8-73-119.5c-4.7-14-8.3-27.3-11-40-1.3-6.7-3.2-10.8-5.5
-12.5-2.3-1.7-7.5-2.5-15.5-2.5-14 0-21 3.7-21 11 0 2 2 10.3 6 25 20.7 83.3 67
151.7 139 205zm96 379h399894v40H0zm0 0h399904v40H0z`, baraboveshortleftharpoon: `M507,435c-4,4,-6.3,8.7,-7,14c0,5.3,0.7,9,2,11
c1.3,2,5.3,5.3,12,10c90.7,54,156,130,196,228c3.3,10.7,6.3,16.3,9,17
c2,0.7,5,1,9,1c0,0,5,0,5,0c10.7,0,16.7,-2,18,-6c2,-2.7,1,-9.7,-3,-21
c-32,-87.3,-82.7,-157.7,-152,-211c0,0,-3,-3,-3,-3l399351,0l0,-40
c-398570,0,-399437,0,-399437,0z M593 435 v40 H399500 v-40z
M0 281 v-40 H399908 v40z M0 281 v-40 H399908 v40z`, rightharpoonaboveshortbar: `M0,241 l0,40c399126,0,399993,0,399993,0
c4.7,-4.7,7,-9.3,7,-14c0,-9.3,-3.7,-15.3,-11,-18c-92.7,-56.7,-159,-133.7,-199,
-231c-3.3,-9.3,-6,-14.7,-8,-16c-2,-1.3,-7,-2,-15,-2c-10.7,0,-16.7,2,-18,6
c-2,2.7,-1,9.7,3,21c15.3,42,36.7,81.8,64,119.5c27.3,37.7,58,69.2,92,94.5z
M0 241 v40 H399908 v-40z M0 475 v-40 H399500 v40z M0 475 v-40 H399500 v40z`, shortbaraboveleftharpoon: `M7,435c-4,4,-6.3,8.7,-7,14c0,5.3,0.7,9,2,11
c1.3,2,5.3,5.3,12,10c90.7,54,156,130,196,228c3.3,10.7,6.3,16.3,9,17c2,0.7,5,1,9,
1c0,0,5,0,5,0c10.7,0,16.7,-2,18,-6c2,-2.7,1,-9.7,-3,-21c-32,-87.3,-82.7,-157.7,
-152,-211c0,0,-3,-3,-3,-3l399907,0l0,-40c-399126,0,-399993,0,-399993,0z
M93 435 v40 H400000 v-40z M500 241 v40 H400000 v-40z M500 241 v40 H400000 v-40z`, shortrightharpoonabovebar: `M53,241l0,40c398570,0,399437,0,399437,0
c4.7,-4.7,7,-9.3,7,-14c0,-9.3,-3.7,-15.3,-11,-18c-92.7,-56.7,-159,-133.7,-199,
-231c-3.3,-9.3,-6,-14.7,-8,-16c-2,-1.3,-7,-2,-15,-2c-10.7,0,-16.7,2,-18,6
c-2,2.7,-1,9.7,3,21c15.3,42,36.7,81.8,64,119.5c27.3,37.7,58,69.2,92,94.5z
M500 241 v40 H399408 v-40z M500 435 v40 H400000 v-40z` };
function E0(t37) {
if (ml[t37]) {
let [c, u, d] = ml[t37], m = `<span class="ML__stretchy" style="height:${d}em"><svg width="100%" height="${d}em" viewBox="0 0 ${c} ${u}" preserveAspectRatio="none" ><path fill="currentcolor" d="${C0[t37]}"></path></svg></span>`;
return `<span style="display:inline-block;height:${Math.floor(100 * d / 2) / 100}em;min-width:0">${m}</span>`;
}
let [e, r, i, n] = dl[t37], o, a, s = i / 1e3;
e.length === 3 ? (o = ["slice-1-of-3", "slice-2-of-3", "slice-3-of-3"], a = ["xMinYMin", "xMidYMin", "xMaxYMin"]) : e.length === 2 ? (o = ["slice-1-of-2", "slice-2-of-2"], a = ["xMinYMin", "xMaxYMin"]) : (o = ["slice-1-of-1"], a = [n]);
let l = e.map((c, u) => `<span class="${o[u]}" style=height:${s}em><svg width=400em height=${s}em viewBox="0 0 400000 ${i}" preserveAspectRatio="${a[u]} slice"><path fill="currentcolor" d="${C0[c]}"></path></svg></span>`).join("");
return `<span style="display:inline-block;height:${s}em;min-width:${r}em;">${l}</span>`;
}
function T0(t37) {
return dl[t37] ? dl[t37][2] / 1e3 : ml[t37][2];
}
function dh(t37) {
let e = [];
for (let r = 0; r < t37.length; r++) {
let i = t37.charCodeAt(r);
if (i === 13 && t37.charCodeAt(r + 1) === 10 && (i = 10, r++), (i === 13 || i === 12) && (i = 10), i === 0 && (i = 65533), i >= 55296 && i <= 56319) {
let n = t37.charCodeAt(r + 1);
if (n >= 56320 && n <= 57343) {
let o = i - 55296, a = n - 56320;
i = 2 ** 16 + o * 2 ** 10 + a, r++;
}
}
e.push(i);
}
return e;
}
var ma = 8205;
var mh = [[ma, 1], [65038, 2], [127995, 5], [129456, 4], [917536, 96]];
var da;
var D0 = [127462, 127487];
function K0(t37) {
var e;
if (da === void 0) {
da = {};
for (let r of mh)
for (let i = r[0]; i <= r[0] + r[1] - 1; i++)
da[i] = true;
}
return (e = da[t37]) != null ? e : false;
}
function ph(t37) {
return t37 >= D0[0] && t37 <= D0[1];
}
function pa(t37) {
if (/^[\u0020-\u00FF]*$/.test(t37))
return t37;
let e = [], r = dh(t37), i = 0;
for (; i < r.length; ) {
let n = r[i++], o = r[i];
if (o === ma) {
let a = i - 1;
for (i += 2; r[i] === ma; )
i += 2;
e.push(String.fromCodePoint(...r.slice(a, i - a + 1)));
} else if (K0(o)) {
let a = i - 1;
for (; K0(r[i]); )
i += r[i] === ma ? 2 : 1;
e.push(String.fromCodePoint(...r.slice(a, 2 * i - a - 1)));
} else
ph(n) ? (i += 1, e.push(String.fromCodePoint(...r.slice(i - 2, 2)))) : e.push(String.fromCodePoint(n));
}
return e;
}
var pl = class {
constructor(e) {
this.obeyspaces = false;
this.pos = 0;
this.s = pa(e);
}
end() {
return this.pos >= this.s.length;
}
get() {
return this.pos < this.s.length ? this.s[this.pos++] : "";
}
peek() {
return this.s[this.pos];
}
match(e) {
let r = typeof this.s == "string" ? e.exec(this.s.slice(this.pos)) : e.exec(this.s.slice(this.pos).join(""));
return r != null && r[0] ? (this.pos += r[0].length, r[0]) : "";
}
next() {
if (this.end())
return null;
if (!this.obeyspaces && this.match(/^[ \f\n\r\t\v\u00A0\u2028\u2029]+/) || this.obeyspaces && this.match(/^[ \f\n\r\t\v\u00A0\u2028\u2029]/))
return "<space>";
let e = this.get();
if (e === "\\") {
if (!this.end()) {
let r = this.match(/^[a-zA-Z\*]+/);
return r ? this.match(/^[ \f\n\r\t\v\u00A0\u2028\u2029]*/) : r = this.get(), "\\" + r;
}
} else {
if (e === "{")
return "<{>";
if (e === "}")
return "<}>";
if (e === "^") {
if (this.peek() === "^") {
this.get();
let r = this.match(/^(\^(\^(\^(\^[\da-f])?[\da-f])?[\da-f])?[\da-f])?[\da-f]{2}/);
if (r)
return String.fromCodePoint(Number.parseInt(r.slice(r.lastIndexOf("^") + 1), 16));
}
return e;
} else if (e === "#") {
if (!this.end()) {
let r = false;
if (/[\d?@]/.test(this.peek()) && (r = true, this.pos + 1 < this.s.length)) {
let i = this.s[this.pos + 1];
r = /[^\dA-Za-z]/.test(i);
}
return r ? "#" + this.get() : "#";
}
} else if (e === "$")
return this.peek() === "$" ? (this.get(), "<$$>") : "<$>";
}
return e;
}
};
function hh(t37, e) {
var n, o, a, s;
let r = [], i = t37.next();
if (i && i !== "\\relax") {
if (i === "\\noexpand")
i = t37.next(), i && r.push(i);
else if (i === "\\obeyspaces")
t37.obeyspaces = true;
else if (i === "\\bgroup")
r.push("<{>");
else if (i === "\\egroup")
r.push("<}>");
else if (i === "\\string") {
if (i = t37.next(), i)
if (i.startsWith("\\"))
for (let l of i)
r.push(l === "\\" ? "\\backslash" : l);
else
i === "<{>" ? r.push("\\{") : i === "<space>" ? r.push("~") : i === "<}>" && r.push("\\}");
} else if (i === "\\csname") {
for (; t37.peek() === "<space>"; )
t37.next();
let l = "", c = false, u = [];
do {
if (u.length === 0)
if (/^#[\d?@]$/.test(t37.peek())) {
let d = t37.get().slice(1);
u = Ki((o = (n = e == null ? void 0 : e(d)) != null ? n : e == null ? void 0 : e("?")) != null ? o : "\\placeholder{}", e), i = u[0];
} else
i = t37.next(), u = i ? [i] : [];
c = u.length === 0, !c && i === "\\endcsname" && (c = true, u.shift()), c || (c = i === "<$>" || i === "<$$>" || i === "<{>" || i === "<}>" || typeof i == "string" && i.length > 1 && i.startsWith("\\")), c || (l += u.shift());
} while (!c);
l && r.push("\\" + l), r.push(...u);
} else if (i !== "\\endcsname")
if (i.length > 1 && i.startsWith("#")) {
let l = i.slice(1);
r.push(...Ki((s = (a = e == null ? void 0 : e(l)) != null ? a : e == null ? void 0 : e("?")) != null ? s : "\\placeholder{}", e));
} else
r.push(i);
}
return r;
}
function Ki(t37, e = null) {
let r = [], i = "";
for (let a of t37.toString().split(/\r?\n/)) {
i && r.push(i), i = " ";
let s = a.match(/((?:\\%)|[^%])*/);
s !== null && r.push(s[0]);
}
let n = new pl(r.join("")), o = [];
do
o.push(...hh(n, e));
while (!n.end());
return o;
}
function K(t37) {
let e = "", r = [];
for (let i of t37)
i && (e && /^[a-zA-Z\*]/.test(i) && r.push(e), r.push(i), /^\\[a-zA-Z]+\*?[\"\'][^\ ]+$/.test(i) && r.push(" "), e = /\\[a-zA-Z]+\*?$/.test(i) ? " " : "");
return r.join("");
}
function I(t37, ...e) {
return t37.startsWith("\\"), e.length === 0 ? t37 : K([t37, ...e.map((r) => `{${r}}`)]);
}
function ur(t37) {
return K(t37.map((e) => {
var r;
return (r = { "<space>": " ", "<$$>": "$$", "<$>": "$", "<{>": "{", "<}>": "}" }[e]) != null ? r : e;
}));
}
var zr = class zr2 {
constructor(e) {
zr2._registry[e] = this;
}
static createAtom(e, r, i) {
return zr2._registry[e].createAtom(r, ee(r, e), i);
}
static serialize(e, r) {
var i;
if (!e || e.length === 0)
return "";
if ((i = r.skipStyles) != null && i) {
let n = [];
for (let o of O0(e)) {
let a = zr2._registry[o[0].mode];
n.push(...a.serialize(o, r));
}
return K(n);
}
return K(gh(e, r));
}
static getFont(e, r, i) {
return zr2._registry[e].getFont(r, i);
}
};
zr._registry = {};
var ce = zr;
function O0(t37) {
let e = [], r = [], i = "NONE";
for (let n of t37)
n.type !== "first" && (n.mode !== i ? (r.length > 0 && e.push(r), r = [n], i = n.mode) : r.push(n));
return r.length > 0 && e.push(r), e;
}
function ha(t37) {
if (!t37 || t37.mode !== "math")
return "";
let { style: e } = t37;
return !e || !e.variantStyle ? "" : e.variantStyle === "bold" || e.variantStyle === "bolditalic" ? "bold" : "";
}
function fa(t37) {
if (!t37)
return "";
let { style: e } = t37;
if (!e)
return "";
let r = e.variant;
return r === void 0 ? "normal" : (!["calligraphic", "fraktur", "double-struck", "script", "monospace", "sans-serif"].includes(r) && e.variantStyle && (r += "-" + e.variantStyle), r);
}
function Ye(t37, e) {
let r = [], i = [], n;
for (let o of t37) {
if (o.type === "first")
continue;
let a;
e === "variant" ? a = fa(o) : e === "bold" ? a = ha(o) : a = o.style[e], a === n ? i.push(o) : (i.length > 0 && r.push(i), i = [o], n = a);
}
return i.length > 0 && r.push(i), r;
}
function B0(t37, e) {
var o;
let { parent: r } = t37[0], i = r == null ? void 0 : r.style.color, n = [];
for (let a of O0(t37)) {
let s = e.defaultMode;
for (let l of Ye(a, "color")) {
let c = l[0].style, u = ce._registry[l[0].mode].serialize(l, g(p({}, e), { defaultMode: s === "text" ? "text" : "math" }));
!e.skipStyles && c.color && c.color !== "none" && (!r || i !== c.color) ? n.push(I("\\textcolor", (o = c.verbatimColor) != null ? o : c.color, K(u))) : n.push(K(u));
}
}
return n;
}
function fh(t37, e) {
let { parent: r } = t37[0], i = r == null ? void 0 : r.style.backgroundColor;
return Ye(t37, "backgroundColor").map((n) => {
var o;
if (n.length > 0 || n[0].type !== "box") {
let a = n[0].style;
if (a.backgroundColor && a.backgroundColor !== "none" && (!r || i !== a.backgroundColor))
return I("\\colorbox", (o = a.verbatimBackgroundColor) != null ? o : a.backgroundColor, K(B0(n, g(p({}, e), { defaultMode: "text" }))));
}
return K(B0(n, e));
});
}
function gh(t37, e) {
if (t37.length === 0)
return [];
let { parent: r } = t37[0], i = r == null ? void 0 : r.style.fontSize, n = [];
for (let o of Ye(t37, "fontSize")) {
let a = o[0].style.fontSize, s = fh(o, e);
s && (a && a !== "auto" && (!r || i !== a) ? n.push(["", "\\tiny", "\\scriptsize", "\\footnotesize", "\\small", "\\normalsize", "\\large", "\\Large", "\\LARGE", "\\huge", "\\Huge"][a], ...s) : n.push(...s));
}
return n;
}
function ga(t37) {
return t37 ? { mord: "ord", mbin: "bin", mop: "op", mrel: "rel", mopen: "open", mclose: "close", mpunct: "punct", minner: "inner", spacing: "ignore", latex: "latex", composition: "inner", error: "inner", placeholder: "ord", supsub: "ignore" }[t37] : void 0;
}
function Nr(t37) {
if (t37.length === 0)
return "ord";
let e = ga(t37[0].type), r = ga(t37[t37.length - 1].type);
return e && e === r ? e : "ord";
}
function Kn(t37, e) {
if (typeof t37 == "string")
return t37;
if (typeof t37 == "number") {
Number.isFinite(t37);
let r = Math.ceil(100 * t37) / 100;
return r === 0 ? "0" : r.toString() + (e != null ? e : "");
}
return "";
}
var w = class t {
constructor(e, r) {
var n, o, a, s, l;
if (typeof e == "number" ? this.value = String.fromCodePoint(e) : typeof e == "string" ? this.value = e : X(e) ? this.children = e.filter((c) => c !== null) : e && e instanceof t && (this.children = [e]), this.children)
for (let c of this.children)
c.parent = this;
this.type = (n = r == null ? void 0 : r.type) != null ? n : "ignore", this.isSelected = (r == null ? void 0 : r.isSelected) === true, r != null && r.caret && (this.caret = r.caret), this.classes = (o = r == null ? void 0 : r.classes) != null ? o : "", this.isTight = (a = r == null ? void 0 : r.isTight) != null ? a : false, r != null && r.attributes && (this.attributes = r.attributes);
let i = r == null ? void 0 : r.fontFamily;
r != null && r.style && this.value && (i = (l = ce.getFont((s = r.mode) != null ? s : "math", this, g(p({ variant: "normal" }, r.style), { letterShapeStyle: r.letterShapeStyle }))) != null ? l : void 0), i || (i = "Main-Regular"), this._height = 0, this._depth = 0, this._width = 0, this.hasExplicitWidth = false, this.skew = 0, this.italic = 0, this.maxFontSize = 0, this.scale = 1, (r == null ? void 0 : r.maxFontSize) !== void 0 && (this.maxFontSize = r.maxFontSize), yh(this, i);
}
set atomID(e) {
e === void 0 || e.length === 0 || (this.id = e);
}
selected(e) {
if (this.isSelected !== e && (this.isSelected = e, this.children))
for (let r of this.children)
r.selected(e);
}
setStyle(e, r, i) {
if (r === void 0)
return;
let n = Kn(r, i);
n.length > 0 && (this.cssProperties || (this.cssProperties = {}), this.cssProperties[e] = n);
}
setTop(e) {
Number.isFinite(e) && Math.abs(e) > 0.01 && (this.cssProperties || (this.cssProperties = {}), this.cssProperties.top = Kn(e, "em"), this.height -= e, this.depth += e);
}
get left() {
var e;
return (e = this.cssProperties) != null && e["margin-left"] ? Number.parseFloat(this.cssProperties["margin-left"]) : 0;
}
set left(e) {
Number.isFinite(e) && (e === 0 ? this.cssProperties && delete this.cssProperties["margin-left"] : (this.cssProperties || (this.cssProperties = {}), this.cssProperties["margin-left"] = Kn(e, "em")));
}
set right(e) {
Number.isFinite(e) && (e === 0 ? this.cssProperties && delete this.cssProperties["margin-right"] : (this.cssProperties || (this.cssProperties = {}), this.cssProperties["margin-right"] = Kn(e, "em")));
}
set bottom(e) {
Number.isFinite(e) && (e === 0 ? this.cssProperties && delete this.cssProperties["margin-bottom"] : (this.cssProperties || (this.cssProperties = {}), this.cssProperties["margin-bottom"] = Kn(e, "em")));
}
get width() {
return this._width * this.scale;
}
set width(e) {
this._width = e, this.hasExplicitWidth = true;
}
set softWidth(e) {
}
get height() {
return this._height * this.scale;
}
set height(e) {
this._height = e;
}
get depth() {
return this._depth * this.scale;
}
set depth(e) {
this._depth = e;
}
wrap(e) {
let r = e.parent;
if (!r)
return this;
e.isPhantom && this.setStyle("opacity", 0);
let i = e.color;
i && i !== r.color && this.setStyle("color", i);
let n = e.backgroundColor;
this.isSelected && (n = Cc(n)), n && n !== r.backgroundColor && (this.setStyle("background-color", n), this.setStyle("display", "inline-block"));
let o = e.scalingFactor;
return this.scale = o, this.skew *= o, this.italic *= o, this;
}
toMarkup() {
var c, u, d, m;
let e = (c = this.value) != null ? c : "";
if (this.children)
for (let h of this.children)
e += h.toMarkup();
let r = "";
if (this.svgBody)
r = E0(this.svgBody);
else if (this.svgOverlay) {
r = '<span style="', r += "display: inline-block;", r += `height:${Math.floor(100 * (this.height + this.depth)) / 100}em;`, r += `vertical-align:${Math.floor(100 * this.depth) / 100}em;`, r += '">', r += e, r += "</span>", r += '<svg style="position:absolute;overflow:visible;', r += `height:${Math.floor(100 * (this.height + this.depth)) / 100}em;`;
let h = (u = this.cssProperties) == null ? void 0 : u.padding;
h ? (r += `top:${h};`, r += `left:${h};`, r += `width:calc(100% - 2 * ${h} );`) : r += "top:0;left:0;width:100%;", r += "z-index:2;", r += '"', this.svgStyle && (r += this.svgStyle), r += ` viewBox="0 0 ${Math.floor(100 * this.width) / 100} ${Math.floor(100 * (this.height + this.depth)) / 100}"`, r += `>${this.svgOverlay}</svg>`;
}
let i = "", n = this.classes.split(" ");
n.push((d = { latex: "ML__raw-latex", placeholder: "ML__placeholder", error: "ML__error" }[this.type]) != null ? d : ""), this.caret === "latex" && n.push("ML__latex-caret"), this.isSelected && n.push("ML__selected");
let o = n.length === 1 ? n[0] : n.filter((h, f, b) => h.length > 0 && b.indexOf(h) === f).join(" ");
if (o.length > 0 && (i += ` class="${o}"`), this.id && (i += ` data-atom-id=${this.id}`), this.cssId && (i += ` id="${this.cssId.replace(/ /g, "-")}" `), this.attributes && (i += " " + Object.keys(this.attributes).map((h) => `${h}="${this.attributes[h]}"`).join(" ")), this.htmlData) {
let h = this.htmlData.split(",");
for (let f of h) {
let b = f.match(/([^=]+)=(.+$)/);
if (b) {
let S = b[1].trim().replace(/ /g, "-");
S && (i += ` data-${S}="${b[2]}" `);
} else {
let S = f.trim().replace(/ /g, "-");
S && (i += ` data-${S} `);
}
}
}
let a = (m = this.cssProperties) != null ? m : {};
this.hasExplicitWidth && a.width === void 0 && (a.width = `${Math.ceil(this._width * 100) / 100}em`);
let s = Object.keys(a).map((h) => `${h}:${a[h]}`);
if (this.scale !== void 0 && this.scale !== 1 && (e.length > 0 || r.length > 0) && s.push(`font-size: ${Math.ceil(this.scale * 1e4) / 100}%`), this.htmlStyle) {
let h = this.htmlStyle.split(";"), f = "";
for (let b of h) {
let S = b.match(/([^=]+):(.+$)/);
if (S) {
let M = S[1].trim().replace(/ /g, "-");
M && (f += `${M}:${S[2]};`);
}
}
f && (i += ` style="${f}"`);
}
s.length > 0 && (i += ` style="${s.join(";")}"`);
let l = "";
return i.length > 0 || r.length > 0 ? l = `<span${i}>${e}${r}</span>` : l = e, this.caret === "text" ? l += '<span class="ML__text-caret"></span>' : this.caret === "math" && (l += '<span class="ML__caret"></span>'), l;
}
tryCoalesceWith(e) {
if (this.svgBody || !this.value || e.svgBody || !e.value)
return false;
let r = this.children && this.children.length > 0, i = e.children && e.children.length > 0;
if (r || i)
return false;
if (e.cssProperties || this.cssProperties) {
for (let l of ["border", "border-left", "border-right", "border-right-width", "left", "margin", "margin-left", "margin-right", "padding", "position", "width"])
if (e.cssProperties && l in e.cssProperties || this.cssProperties && l in this.cssProperties)
return false;
}
let n = this.cssProperties ? Object.keys(this.cssProperties).length : 0, o = e.cssProperties ? Object.keys(e.cssProperties).length : 0;
if (n !== o)
return false;
if (n > 0) {
for (let l of Object.keys(this.cssProperties))
if (this.cssProperties[l] !== e.cssProperties[l])
return false;
}
let a = this.classes.trim().replace(/\s+/g, " ").split(" "), s = e.classes.trim().replace(/\s+/g, " ").split(" ");
if (a.length !== s.length)
return false;
a.sort(), s.sort();
for (let [l, c] of a.entries())
if (c === "ML__vertical-separator" || c !== s[l])
return false;
return this.value += e.value, this.height = Math.max(this.height, e.height), this.depth = Math.max(this.depth, e.depth), this._width = this._width + e._width, this.maxFontSize = Math.max(this.maxFontSize, e.maxFontSize), this.italic = e.italic, true;
}
};
function hl(t37) {
if (!t37 || t37.length === 0)
return [];
t37[0].children = hl(t37[0].children);
let e = [t37[0]];
for (let r = 1; r < t37.length; r++)
e[e.length - 1].tryCoalesceWith(t37[r]) || (t37[r].children = hl(t37[r].children), e.push(t37[r]));
return e;
}
function dr(t37) {
return t37.children && (t37.children = hl(t37.children)), t37;
}
function mr(t37, e) {
if (!t37)
return new w(null, e);
let r = new w(null, { classes: "ML__strut", type: "ignore" });
r.setStyle("height", Math.max(0, t37.height), "em");
let i = [r];
if (t37.depth !== 0) {
let n = new w(null, { classes: "ML__strut--bottom", type: "ignore" });
n.setStyle("height", t37.height + t37.depth, "em"), n.setStyle("vertical-align", -t37.depth, "em"), i.push(n);
}
return i.push(t37), new w(i, g(p({}, e), { type: "lift" }));
}
function Bi(t37) {
let e = T0(t37) / 2, r = new w(null, { maxFontSize: 0 });
return r.height = e + 0.166, r.depth = e - 0.166, r.svgBody = t37, r;
}
function yh(t37, e) {
var r;
if (t37.type === "latex") {
t37.height = 0.9, t37.depth = 0.2, t37._width = 1;
return;
}
if (t37.value) {
t37.height = -1 / 0, t37.depth = -1 / 0, t37._width = 0, t37.skew = -1 / 0, t37.italic = -1 / 0;
for (let i = 0; i < t37.value.length; i++) {
let n = cr(t37.value.codePointAt(i), e);
t37.height = Math.max(t37.height, n.height), t37.depth = Math.max(t37.depth, n.depth), t37._width += n.width, t37.skew = n.skew, t37.italic = n.italic;
}
return;
}
if (t37.children && t37.children.length > 0) {
let i = -1 / 0, n = -1 / 0, o = 0;
for (let a of t37.children)
a.height > i && (i = a.height), a.depth > n && (n = a.depth), o = Math.max(o, (r = a.maxFontSize) != null ? r : 0);
t37.height = i, t37.depth = n, t37._width = t37.children.reduce((a, s) => a + s.width, 0), t37.maxFontSize = o;
}
}
function bh(t37) {
if ("individualShift" in t37) {
let e = t37.individualShift, r = e[0];
if (r == null)
return [null, 0];
let i = [r], n = -r.shift - r.box.depth, o = n;
for (let a = 1; a < e.length; a++) {
let s = e[a], l = -s.shift - o - s.box.depth, c = l - (r.box.height + r.box.depth);
o = o + l, i.push(c), i.push(s), r = s;
}
return [i, n];
}
if ("top" in t37) {
let e = t37.top;
for (let r of t37.children)
e -= typeof r == "number" ? r : r.box.height + r.box.depth;
return [t37.children, e];
} else {
if ("bottom" in t37)
return [t37.children, -t37.bottom];
if ("firstBaseline" in t37) {
let e = t37.firstBaseline[0];
if (typeof e == "number")
throw new Error("First child must be an element.");
return [t37.firstBaseline, -e.box.depth];
} else if ("shift" in t37) {
let e = t37.children[0];
if (typeof e == "number")
throw new Error("First child must be an element.");
return [t37.children, -e.box.depth - t37.shift];
}
}
return [null, 0];
}
function xh(t37) {
var h;
let [e, r] = bh(t37);
if (!e)
return [[], 0, 0];
let i = new w(null, { classes: "ML__pstrut" }), n = 0;
for (let f of e)
if (typeof f != "number") {
let b = f.box;
n = Math.max(n, b.maxFontSize, b.height);
}
n += 2, i.height = n, i.setStyle("height", n, "em");
let o = [], a = r, s = r, l = r, c = 0;
for (let f of e) {
if (typeof f == "number")
l += f;
else {
let b = f.box, S = (h = f.classes) != null ? h : [], M = new w([i, b], { classes: S.join(" "), style: f.style });
b.setStyle("height", b.height + b.depth, "em"), b.setStyle("display", "inline-block"), M.setStyle("top", -n - l - b.depth, "em"), f.marginLeft && M.setStyle("margin-left", f.marginLeft, "em"), f.marginRight && M.setStyle("margin-right", f.marginRight, "em"), o.push(M), l += b.height + b.depth, c = Math.max(c, M.width);
}
a = Math.min(a, l), s = Math.max(s, l);
}
o.forEach((f) => {
f.softWidth = c;
});
let u = new w(o, { classes: "ML__vlist" });
if (u.softWidth = c, u.height = s, u.setStyle("height", s, "em"), a >= 0)
return [[new w(u, { classes: "ML__vlist-r" })], s, -a];
let d = new w(new w(null), { classes: "ML__vlist" });
d.height = -a, d.setStyle("height", -a, "em");
let m = new w(8203, { classes: "ML__vlist-s", maxFontSize: 0 });
return m.softWidth = 0, m.height = 0, m.depth = 0, [[new w([u, m], { classes: "ML__vlist-r" }), new w(d, { classes: "ML__vlist-r" })], s, -a];
}
var U = class extends w {
constructor(e, r) {
var a;
let [i, n, o] = xh(e);
super(i.length === 1 ? i[0] : i, { type: r == null ? void 0 : r.type, classes: ((a = r == null ? void 0 : r.classes) != null ? a : "") + " ML__vlist-t" + (i.length === 2 ? " ML__vlist-t2" : "") }), this.height = n, this.depth = o, this.softWidth = i.reduce((s, l) => Math.max(s, l.width), 0);
}
};
function P0(t37, e) {
var c, u, d, m, h;
let r = t37.metrics, i = new w(e.base), n = (c = e.baseShift) != null ? c : 0, o = (u = e.slant) != null ? u : 0, a = 0, s = 0;
e.above && (a = (d = e.aboveShift) != null ? d : Math.max(r.bigOpSpacing1, r.bigOpSpacing3 - e.above.depth)), e.below && (s = (m = e.belowShift) != null ? m : Math.max(r.bigOpSpacing2, r.bigOpSpacing4 - e.below.height));
let l = null;
if (e.below && e.above) {
let f = r.bigOpSpacing5 + e.below.height + e.below.depth + s + i.depth + n;
l = new U({ bottom: f, children: [r.bigOpSpacing5, { box: e.below, marginLeft: -o, classes: ["ML__center"] }, s, { box: i, classes: ["ML__center"] }, a, { box: e.above, marginLeft: o, classes: ["ML__center"] }, r.bigOpSpacing5] }).wrap(t37);
} else if (e.below && !e.above)
l = new U({ top: i.height - n, children: [r.bigOpSpacing5, { box: e.below, marginLeft: -o, classes: ["ML__center"] }, s, { box: i, classes: ["ML__center"] }] }).wrap(t37);
else if (!e.below && e.above) {
let f = i.depth + n;
l = new U({ bottom: f, children: [{ box: i, classes: ["ML__center"] }, a, { box: e.above, marginLeft: o, classes: ["ML__center"] }, r.bigOpSpacing5] }).wrap(t37);
} else {
let f = i.depth + n;
l = new U({ bottom: f, children: [{ box: i }, r.bigOpSpacing5] }).wrap(t37);
}
return new w(l, { type: (h = e.type) != null ? h : "op" });
}
var ya = 7;
var On = 6;
var Pn = 5;
var pr = 4;
var Fr = 3;
var Ke = 2;
var hr = 1;
var ve = 0;
var St = class {
constructor(e, r, i) {
this.id = e, this.sizeDelta = r, this.cramped = i;
let n = { "-4": 2, "-3": 1, 0: 0 }[r];
this.metrics = Object.keys(ul).reduce((o, a) => g(p({}, o), { [a]: ul[a][n] }), {});
}
getFontSize(e) {
return Math.max(1, e + this.sizeDelta);
}
get sup() {
return Qe[[ve, hr, ve, hr, Ke, Fr, Ke, Fr][this.id]];
}
get sub() {
return Qe[[ve, ve, ve, ve, Ke, Ke, Ke, Ke][this.id]];
}
get fracNum() {
return Qe[[ve, hr, ve, hr, Ke, Fr, pr, Pn][this.id]];
}
get fracDen() {
return Qe[[ve, ve, ve, ve, Ke, Ke, pr, pr][this.id]];
}
get cramp() {
return Qe[[ve, ve, Ke, Ke, pr, pr, On, On][this.id]];
}
get isTight() {
return this.sizeDelta < 0;
}
};
var Bn = { 7: new St(ya, 0, false), 6: new St(On, 0, true), 5: new St(Pn, 0, false), 4: new St(pr, 0, true), 3: new St(Fr, -3, false), 2: new St(Ke, -3, true), 1: new St(hr, -4, false), 0: new St(ve, -4, true) };
var Qe = g(p({}, Bn), { displaystyle: Bn[ya], textstyle: Bn[Pn], scriptstyle: Bn[Fr], scriptscriptstyle: Bn[hr] });
function gl(t37, e) {
var i;
if (!t37)
return 0;
let r = { pt: 1, mm: 7227 / 2540, cm: 7227 / 254, ex: 35271 / 8192, px: 3 / 4, em: kt, bp: 803 / 800, dd: 1238 / 1157, pc: 12, in: 72.27, mu: 10 / 18 }[(i = t37.unit) != null ? i : "pt"];
if (Number.isFinite(e)) {
let n = 10 ** e;
return Math.round(t37.dimension / kt * r * n) / n;
}
return t37.dimension * r;
}
function ba(t37, e) {
if (t37 === null)
return 0;
let r = gl(t37) / kt;
if (Number.isFinite(e)) {
let i = 10 ** e;
return Math.round(r * i) / i;
}
return r;
}
function fl(t37) {
var e;
return `${t37.dimension}${(e = t37.unit) != null ? e : "pt"}`;
}
function vh(t37) {
let e = fl(t37.glue);
return t37.grow && t37.grow.dimension !== 0 && (e += ` plus ${fl(t37.grow)}`), t37.shrink && t37.shrink.dimension !== 0 && (e += ` minus ${fl(t37.shrink)}`), e;
}
function ue(t37) {
var r, i;
if (t37 == null)
return null;
let e = "";
if ("dimension" in t37 && (e = `${t37.dimension}${(r = t37.unit) != null ? r : "pt"}`), "glue" in t37 && (e = vh(t37)), "number" in t37)
if (!("base" in t37) || t37.base === "decimal")
e = Number(t37.number).toString();
else if (t37.base === "alpha")
e = `\`${String.fromCodePoint(t37.number)}`;
else {
let n = Math.round(t37.number) >>> 0;
t37.base === "hexadecimal" ? (e = Number(n).toString(16).toUpperCase(), n <= 255 ? e = e.padStart(2, "0") : n <= 65535 ? e = e.padStart(4, "0") : n <= 16777215 ? e = e.padStart(6, "0") : e = e.padStart(8, "0"), e = `"${e}`) : t37.base === "octal" && (e = Number(n).toString(8), n <= 63 ? e = e.padStart(2, "0") : n <= 30583 ? e = e.padStart(4, "0") : e = e.padStart(8, "0"), e = `'${e}`);
}
return "register" in t37 && ("factor" in t37 && (t37.factor === -1 ? e = "-" : t37.factor !== 1 && (e = Number(t37.factor).toString())), "global" in t37 && t37.global && (e += "\\global"), e += `\\${t37.register}`), "string" in t37 && (e = t37.string), (i = t37.relax) != null && i && (e += "\\relax"), e;
}
function et(t37, e) {
return t37 == null ? null : "number" in t37 ? g(p({}, t37), { number: t37.number * e }) : "register" in t37 ? "factor" in t37 && t37.factor ? g(p({}, t37), { factor: t37.factor * e }) : g(p({}, t37), { factor: e }) : "dimension" in t37 ? g(p({}, t37), { dimension: t37.dimension * e }) : "glue" in t37 ? t37.shrink && t37.grow ? { glue: et(t37.glue, e), shrink: et(t37.shrink, e), grow: et(t37.grow, e) } : t37.shrink ? { glue: et(t37.glue, e), shrink: et(t37.shrink, e) } : t37.grow ? { glue: et(t37.glue, e), grow: et(t37.grow, e) } : { glue: et(t37.glue, e) } : null;
}
var _h = { "p@": { dimension: 1 }, "z@": { dimension: 0 }, maxdimen: { dimension: 16383.99999 }, hfuzz: { dimension: 0.1 }, vfuzz: { dimension: 0.1 }, overfullrule: { dimension: 5 }, hsize: { dimension: 6.5, unit: "in" }, vsize: { dimension: 8.9, unit: "in" }, parindent: { dimension: 20 }, maxdepth: { dimension: 4 }, splitmaxdepth: { register: "maxdimen" }, boxmaxdepth: { register: "maxdimen" }, delimitershortfall: { dimension: 5 }, nulldelimiterspace: { dimension: 1.2, unit: "pt" }, scriptspace: { dimension: 0.5 }, topskip: { dimension: 10 }, splittopskip: { dimension: 10 }, normalbaselineskip: { dimension: 12 }, normallineskip: { dimension: 1 }, normallineskiplimit: { dimension: 0 }, jot: { dimension: 3 }, doublerulesep: { dimension: 2 }, arrayrulewidth: { dimension: 0.4 }, arraycolsep: { dimension: 5 }, fboxsep: { dimension: 3 }, fboxrule: { dimension: 0.4 }, "z@skip": { glue: { dimension: 0 }, shrink: { dimension: 0 }, grow: { dimension: 0 } }, hideskip: { glue: { dimension: -1e3 }, grow: { dimension: 1, unit: "fill" } }, "@flushglue": { glue: { dimension: 0 }, grow: { dimension: 1, unit: "fill" } }, parskip: { glue: { dimension: 0 }, grow: { dimension: 1 } }, abovedisplayskip: { glue: { dimension: 12 }, grow: { dimension: 3 }, shrink: { dimension: 9 } }, abovedisplayshortskip: { glue: { dimension: 0 }, grow: { dimension: 3 } }, belowdisplayskip: { glue: { dimension: 12 }, grow: { dimension: 3 }, shrink: { dimension: 9 } }, belowdisplayshortskip: { glue: { dimension: 7 }, grow: { dimension: 3 }, shrink: { dimension: 4 } }, parfillskip: { glue: { dimension: 0 }, grow: { dimension: 1, unit: "fil" } }, thinmuskip: { glue: { dimension: 3, unit: "mu" } }, medmuskip: { glue: { dimension: 4, unit: "mu" }, grow: { dimension: 2, unit: "mu" }, shrink: { dimension: 4, unit: "mu" } }, thickmuskip: { glue: { dimension: 5, unit: "mu" }, grow: { dimension: 5, unit: "mu" } }, smallskipamount: { glue: { dimension: 3 }, grow: { dimension: 1 }, shrink: { dimension: 1 } }, medskipamount: { glue: { dimension: 6 }, grow: { dimension: 2 }, shrink: { dimension: 3 } }, bigskipamount: { glue: { dimension: 12 }, grow: { dimension: 2 }, shrink: { dimension: 4 } }, pretolerance: 100, tolerance: 200, hbadness: 1e3, vbadness: 1e3, linepenalty: 10, hyphenpenalty: 50, exhyphenpenalty: 50, binoppenalty: 700, relpenalty: 500, clubpenalty: 150, widowpenalty: 150, displaywidowpenalty: 50, brokenpenalty: 100, predisplaypenalty: 1e4, doublehyphendemerits: 1e4, finalhyphendemerits: 5e3, adjdemerits: 1e4, tracinglostchars: 1, uchyph: 1, delimiterfactor: 901, defaulthyphenchar: "\\-", defaultskewchar: -1, newlinechar: -1, showboxbreadth: 5, showboxdepth: 3, errorcontextlines: 5, interdisplaylinepenalty: 100, interfootnotelinepenalty: 100, baselineSkip: 1.2, arraystretch: 1, month: new Date().getMonth() + 1, day: new Date().getDate(), year: new Date().getFullYear() };
function xa() {
return p({}, _h);
}
function Rn() {
return { registers: xa(), smartFence: false, renderPlaceholder: void 0, placeholderSymbol: "\u25A2", letterShapeStyle: O.locale.startsWith("fr") ? "french" : "tex", minFontScale: 0, maxMatrixCols: 10, colorMap: Tr, backgroundColorMap: gi, getMacro: (t37) => wo(t37, xi()) };
}
var T = class t2 {
constructor(e, r) {
var o, a, s, l, c, u, d, m, h, f, b, S, M, x, v;
let i;
e != null && e.parent ? (this.parent = e.parent, i = e.parent, this.registers = {}) : (i = p(p({}, Rn()), (o = e == null ? void 0 : e.from) != null ? o : {}), this.registers = i.registers), i.atomIdsSettings && (this.atomIdsSettings = p({}, i.atomIdsSettings)), this.renderPlaceholder = i.renderPlaceholder, this.isPhantom = (l = (s = e == null ? void 0 : e.isPhantom) != null ? s : (a = this.parent) == null ? void 0 : a.isPhantom) != null ? l : false, this.letterShapeStyle = i.letterShapeStyle, this.minFontScale = i.minFontScale, this.maxMatrixCols = i.maxMatrixCols, r != null && r.color && r.color !== "none" ? this.color = r.color : this.color = (u = (c = this.parent) == null ? void 0 : c.color) != null ? u : "", r != null && r.backgroundColor && r.backgroundColor !== "none" ? this.backgroundColor = r.backgroundColor : this.backgroundColor = (m = (d = this.parent) == null ? void 0 : d.backgroundColor) != null ? m : "", r != null && r.fontSize && r.fontSize !== "auto" && r.fontSize !== ((h = this.parent) == null ? void 0 : h.size) ? this.size = r.fontSize : this.size = (b = (f = this.parent) == null ? void 0 : f.size) != null ? b : Di;
let n = (M = (S = this.parent) == null ? void 0 : S.mathstyle) != null ? M : Qe.displaystyle;
if (typeof (e == null ? void 0 : e.mathstyle) == "string") {
if (i instanceof t2)
switch (e.mathstyle) {
case "cramp":
n = n.cramp;
break;
case "superscript":
n = n.sup;
break;
case "subscript":
n = n.sub;
break;
case "numerator":
n = n.fracNum;
break;
case "denominator":
n = n.fracDen;
break;
}
switch (e.mathstyle) {
case "textstyle":
n = Qe.textstyle;
break;
case "displaystyle":
n = Qe.displaystyle;
break;
case "scriptstyle":
n = Qe.scriptstyle;
break;
case "scriptscriptstyle":
n = Qe.scriptscriptstyle;
break;
case "":
case "auto":
break;
}
}
this.mathstyle = n, this.smartFence = i.smartFence, this.placeholderSymbol = i.placeholderSymbol, this.colorMap = (x = i.colorMap) != null ? x : (k) => k, this.backgroundColorMap = (v = i.backgroundColorMap) != null ? v : (k) => k, this.getMacro = i.getMacro, this.parent !== void 0 || this.registers;
}
makeID() {
if (!this.atomIdsSettings)
return;
if (this.atomIdsSettings.overrideID)
return this.atomIdsSettings.overrideID;
if (typeof this.atomIdsSettings.seed != "number")
return `${Date.now().toString(36).slice(-2)}${Math.floor(Math.random() * 1e5).toString(36)}`;
let e = this.atomIdsSettings.seed.toString(36);
return this.atomIdsSettings.seed += 1, e;
}
scale(e) {
return e * this.effectiveFontSize;
}
get scalingFactor() {
return this.parent ? this.effectiveFontSize / this.parent.effectiveFontSize : 1;
}
get isDisplayStyle() {
return this.mathstyle.id === ya || this.mathstyle.id === On;
}
get isCramped() {
return this.mathstyle.cramped;
}
get isTight() {
return this.mathstyle.isTight;
}
get metrics() {
return this.mathstyle.metrics;
}
get effectiveFontSize() {
return Math.max(Dn[Math.max(1, this.size + this.mathstyle.sizeDelta)], this.minFontScale);
}
getRegister(e) {
var r;
if ((r = this.registers) != null && r[e])
return this.registers[e];
if (this.parent)
return this.parent.getRegister(e);
}
getRegisterAsNumber(e) {
let r = this.getRegister(e);
if (typeof r == "number")
return r;
if (typeof r == "string")
return Number(r);
}
getRegisterAsGlue(e) {
var r;
if ((r = this.registers) != null && r[e]) {
let i = this.registers[e];
return typeof i == "object" && "glue" in i ? i : typeof i == "object" && "dimension" in i ? { glue: { dimension: i.dimension } } : typeof i == "number" ? { glue: { dimension: i } } : void 0;
}
if (this.parent)
return this.parent.getRegisterAsGlue(e);
}
getRegisterAsEm(e, r) {
return ba(this.getRegisterAsDimension(e), r);
}
getRegisterAsDimension(e) {
var r;
if ((r = this.registers) != null && r[e]) {
let i = this.registers[e];
return typeof i == "object" && "glue" in i ? i.glue : typeof i == "object" && "dimension" in i ? i : typeof i == "number" ? { dimension: i } : void 0;
}
if (this.parent)
return this.parent.getRegisterAsDimension(e);
}
setRegister(e, r) {
if (r === void 0) {
delete this.registers[e];
return;
}
this.registers[e] = r;
}
evaluate(e) {
if (!e || !("register" in e))
return e;
let r = this;
if ("global" in e && e.global)
for (; r.parent; )
r = r.parent;
let i = 1;
"factor" in e && e.factor !== 1 && e.factor !== void 0 && (i = e.factor);
let n = r.getRegister(e.register);
if (n === void 0)
return;
if (typeof n == "string")
return { string: Number(n).toString() + n };
if (typeof n == "number")
return { number: i * n };
let o = r.evaluate(n);
if (o !== void 0)
return "string" in o ? { string: Number(n).toString() + o.string } : "number" in o ? { number: i * o.number } : "dimension" in o ? g(p({}, o), { dimension: i * o.dimension }) : "glue" in o ? g(p({}, o), { glue: g(p({}, o.glue), { dimension: i * o.glue.dimension }), shrink: o.shrink ? g(p({}, o.shrink), { dimension: i * o.shrink.dimension }) : void 0, grow: o.grow ? g(p({}, o.grow), { dimension: i * o.grow.dimension }) : void 0 }) : e;
}
toDimension(e) {
let r = this.evaluate(e);
return r === void 0 ? null : "dimension" in r ? r : "glue" in r ? r.glue : "number" in r ? { dimension: r.number } : null;
}
toEm(e, r) {
if (e === null)
return 0;
let i = this.toDimension(e);
return i === null ? 0 : gl(i, r) / kt;
}
toNumber(e) {
if (e === null)
return null;
let r = this.evaluate(e);
return r === void 0 ? null : "number" in r ? r.number : "dimension" in r ? r.dimension : "glue" in r ? r.glue.dimension : "string" in r ? Number(r.string) : null;
}
toColor(e) {
var i, n;
if (e === null)
return null;
let r = this.evaluate(e);
return r === void 0 ? null : "string" in r ? (n = (i = this.colorMap) == null ? void 0 : i.call(this, r.string)) != null ? n : r.string : null;
}
toBackgroundColor(e) {
var i, n;
if (e === null)
return null;
let r = this.evaluate(e);
return r === void 0 ? null : "string" in r ? (n = (i = this.backgroundColorMap) == null ? void 0 : i.call(this, r.string)) != null ? n : r.string : null;
}
};
var gr = ["body", "above", "below", "superscript", "subscript"];
function fr(t37) {
return typeof t37 == "string" && gr.includes(t37);
}
function In(t37) {
return t37 !== void 0 && Array.isArray(t37) && t37.length === 2;
}
var y = class t3 {
constructor(e) {
var r, i, n, o, a, s, l;
this.type = e.type, typeof e.value == "string" && (this.value = e.value), this.command = (i = (r = e.command) != null ? r : this.value) != null ? i : "", this.mode = (n = e.mode) != null ? n : "math", e.isFunction && (this.isFunction = true), e.limits && (this.subsupPlacement = e.limits), this.style = p({}, (o = e.style) != null ? o : {}), this.displayContainsHighlight = (a = e.displayContainsHighlight) != null ? a : false, this.captureSelection = (s = e.captureSelection) != null ? s : false, this.skipBoundary = (l = e.skipBoundary) != null ? l : false, e.verbatimLatex !== void 0 && e.verbatimLatex !== null && (this.verbatimLatex = e.verbatimLatex), e.args && (this.args = e.args), e.body && (this.body = e.body), this._changeCounter = 0;
}
static createBox(e, r, i) {
var s;
if (!r)
return null;
let n = Mh(r), o = [];
for (let l of n) {
let c = l[0].style, u = wh(e, l, { style: { color: c.color, backgroundColor: c.backgroundColor, fontSize: c.fontSize } });
u && o.push(u);
}
if (o.length === 0)
return null;
let a = ((s = i == null ? void 0 : i.classes) != null ? s : "").trim();
return o.length === 1 && !a && !(i != null && i.type) ? o[0].wrap(e) : new w(o, { classes: a, type: i == null ? void 0 : i.type }).wrap(e);
}
static serialize(e, r) {
return ce.serialize(e, r);
}
static commonAncestor(e, r) {
if (e === r || e.parent === r.parent)
return e.parent;
let i = /* @__PURE__ */ new WeakSet(), { parent: n } = e;
for (; n; )
i.add(n), n = n.parent;
for (n = r.parent; n; ) {
if (i.has(n))
return n;
n = n.parent;
}
}
static fromJson(e) {
return typeof e == "string" ? new t3({ type: "mord", value: e, mode: "math" }) : new t3(e);
}
toJson() {
if (this._json)
return this._json;
let e = {};
if (this.type && (e.type = this.type), this.mode !== "math" && (e.mode = this.mode), this.command && this.command !== this.value && (e.command = this.command), this.value !== void 0 && (e.value = this.value), this.style && Object.keys(this.style).length > 0 && (e.style = p({}, this.style)), this.verbatimLatex !== void 0 && (e.verbatimLatex = this.verbatimLatex), this.subsupPlacement && (e.subsupPlacement = this.subsupPlacement), this.explicitSubsupPlacement && (e.explicitSubsupPlacement = true), this.isFunction && (e.isFunction = true), this.displayContainsHighlight && (e.displayContainsHighlight = true), this.skipBoundary && (e.skipBoundary = true), this.captureSelection && (e.captureSelection = true), this.args && (e.args = kh(this.args)), this._branches)
for (let r of Object.keys(this._branches))
this._branches[r] && (e[r] = this._branches[r].filter((i) => i.type !== "first").map((i) => i.toJson()));
return e.type === "mord" && Object.keys(e).length === 2 && "value" in e ? e.value : (this._json = e, e);
}
get changeCounter() {
return this.parent ? this.parent.changeCounter : this._changeCounter;
}
set isDirty(e) {
e && (this._json = void 0, this.parent || this._changeCounter++, "verbatimLatex" in this && (this.verbatimLatex = void 0), this._children = void 0, this.parent && (this.parent.isDirty = true));
}
_serialize(e) {
if (!(e.expandMacro || e.skipStyles || e.skipPlaceholders) && typeof this.verbatimLatex == "string")
return this.verbatimLatex;
let r = ee(this.command, this.mode);
return r != null && r.serialize ? r.serialize(this, e) : this.body && this.command ? K([I(this.command, this.bodyToLatex(e)), this.supsubToLatex(e)]) : this.body ? K([this.bodyToLatex(e), this.supsubToLatex(e)]) : !this.value || this.value === "\u200B" ? "" : this.command;
}
bodyToLatex(e) {
var i;
let r = (i = e.defaultMode) != null ? i : this.mode === "math" ? "math" : "text";
return ce.serialize(this.body, g(p({}, e), { defaultMode: r }));
}
aboveToLatex(e) {
return ce.serialize(this.above, e);
}
belowToLatex(e) {
return ce.serialize(this.below, e);
}
supsubToLatex(e) {
let r = "";
if (e = g(p({}, e), { defaultMode: "math" }), this.branch("subscript") !== void 0) {
let i = ce.serialize(this.subscript, e);
i.length === 0 ? r += "_{}" : i.length === 1 ? /^[0-9]$/.test(i) ? r += `_${i}` : r += `_{${i}}` : r += `_{${i}}`;
}
if (this.branch("superscript") !== void 0) {
let i = ce.serialize(this.superscript, e);
i.length === 0 ? r += "^{}" : i.length === 1 ? i === "\u2032" ? r += "^\\prime " : i === "\u2033" ? r += "^\\doubleprime " : /^[0-9]$/.test(i) ? r += `^${i}` : r += `^{${i}}` : r += `^{${i}}`;
}
return r;
}
get treeDepth() {
let e = 1, r = this.parent;
for (; r; )
r = r.parent, e += 1;
return e;
}
get inCaptureSelection() {
let e = this;
for (; e; ) {
if (e.captureSelection)
return true;
e = e.parent;
}
return false;
}
get parentPrompt() {
let e = this.parent;
for (; e; ) {
if (e.type === "prompt" && !e.captureSelection)
return e;
e = e.parent;
}
return null;
}
branch(e) {
if (fr(e) && this._branches)
return this._branches[e];
}
get branches() {
if (!this._branches)
return [];
let e = [];
for (let r of gr)
this._branches[r] && e.push(r);
return e;
}
createBranch(e) {
return fr(e), fr(e) ? (this._branches ? this._branches[e] || (this._branches[e] = [this.makeFirstAtom(e)]) : this._branches = { [e]: [this.makeFirstAtom(e)] }, this.isDirty = true, this._branches[e]) : [];
}
get row() {
return In(this.parentBranch) ? this.parentBranch[0] : -1;
}
get col() {
return In(this.parentBranch) ? this.parentBranch[1] : -1;
}
get body() {
var e;
return (e = this._branches) == null ? void 0 : e.body;
}
set body(e) {
this.setChildren(e, "body");
}
get superscript() {
var e;
return (e = this._branches) == null ? void 0 : e.superscript;
}
set superscript(e) {
this.setChildren(e, "superscript");
}
get subscript() {
var e;
return (e = this._branches) == null ? void 0 : e.subscript;
}
set subscript(e) {
this.setChildren(e, "subscript");
}
get above() {
var e;
return (e = this._branches) == null ? void 0 : e.above;
}
set above(e) {
this.setChildren(e, "above");
}
get below() {
var e;
return (e = this._branches) == null ? void 0 : e.below;
}
set below(e) {
this.setChildren(e, "below");
}
applyStyle(e) {
this.isDirty = true, this.style = p(p({}, this.style), e), this.style.fontFamily === "none" && delete this.style.fontFamily, this.style.fontShape === "auto" && delete this.style.fontShape, this.style.fontSeries === "auto" && delete this.style.fontSeries, this.style.color === "none" && (delete this.style.color, delete this.style.verbatimColor), this.style.backgroundColor === "none" && (delete this.style.backgroundColor, delete this.style.verbatimBackgroundColor), this.style.fontSize === "auto" && delete this.style.fontSize;
for (let r of this.children)
r.applyStyle(e);
}
getInitialBaseElement() {
var e, r, i;
return this.hasEmptyBranch("body") ? this : ((e = this.body) == null || e[0].type, (i = (r = this.body[1]) == null ? void 0 : r.getInitialBaseElement()) != null ? i : this);
}
getFinalBaseElement() {
return this.hasEmptyBranch("body") ? this : this.body[this.body.length - 1].getFinalBaseElement();
}
isCharacterBox() {
return this.type === "leftright" || this.type === "genfrac" || this.type === "subsup" || this.type === "delim" || this.type === "array" || this.type === "surd" ? false : this.getFinalBaseElement().type === "mord";
}
hasEmptyBranch(e) {
let r = this.branch(e);
return r ? (r.length > 0, r[0].type, r.length === 1) : true;
}
setChildren(e, r) {
var n;
if (!e || (fr(r), !fr(r)))
return;
let i = ((n = e[0]) == null ? void 0 : n.type) === "first" ? [...e] : [this.makeFirstAtom(r), ...e];
this._branches ? this._branches[r] = i : this._branches = { [r]: i };
for (let o of e)
o.parent = this, o.parentBranch = r;
this.isDirty = true;
}
makeFirstAtom(e) {
let r = new t3({ type: "first", mode: this.mode });
return r.parent = this, r.parentBranch = e, r;
}
addChild(e, r) {
e.type, this.createBranch(r).push(e), this.isDirty = true, e.parent = this, e.parentBranch = r;
}
addChildBefore(e, r) {
r.parentBranch;
let i = this.createBranch(r.parentBranch);
i.splice(i.indexOf(r), 0, e), this.isDirty = true, e.parent = this, e.parentBranch = r.parentBranch;
}
addChildAfter(e, r) {
r.parentBranch;
let i = this.createBranch(r.parentBranch);
i.splice(i.indexOf(r) + 1, 0, e), this.isDirty = true, e.parent = this, e.parentBranch = r.parentBranch;
}
addChildren(e, r) {
let i = this.createBranch(r);
for (let n of e)
n.parent = this, n.parentBranch = r, i.push(n);
this.isDirty = true;
}
addChildrenAfter(e, r) {
e.length === 0 || e[0].type, r.parentBranch;
let i = this.createBranch(r.parentBranch);
i.splice(i.indexOf(r) + 1, 0, ...e), this.isDirty = true;
for (let n of e)
n.parent = this, n.parentBranch = r.parentBranch;
return e[e.length - 1];
}
removeBranch(e) {
let r = this.branch(e);
if (fr(e) && (this._branches[e] = void 0), !r)
return [];
for (let o of r)
o.parent = void 0, o.parentBranch = void 0;
r[0].type;
let [i, ...n] = r;
return this.isDirty = true, n;
}
removeChild(e) {
if (e.parent, e.type === "first")
return;
let r = this.branch(e.parentBranch), i = r.indexOf(e);
i >= 0, r.splice(i, 1), this.isDirty = true, e.parent = void 0, e.parentBranch = void 0;
}
get siblings() {
return this.parent ? this.parent.branch(this.parentBranch) : [];
}
get firstSibling() {
return this.siblings[0];
}
get lastSibling() {
let { siblings: e } = this;
return e[e.length - 1];
}
get isFirstSibling() {
return this === this.firstSibling;
}
get isLastSibling() {
return this === this.lastSibling;
}
get hasNoSiblings() {
return this.siblings.length === 1;
}
get leftSibling() {
this.parent;
let e = this.parent.branch(this.parentBranch);
return e[e.indexOf(this) - 1];
}
get rightSibling() {
this.parent;
let e = this.parent.branch(this.parentBranch);
return e[e.indexOf(this) + 1];
}
get hasChildren() {
return !!(this._branches && this.children.length > 0);
}
get firstChild() {
return this.hasChildren, this.children[0];
}
get lastChild() {
this.hasChildren;
let { children: e } = this;
return e[e.length - 1];
}
get children() {
if (this._children)
return this._children;
if (!this._branches)
return [];
let e = [];
for (let r of gr)
if (this._branches[r])
for (let i of this._branches[r])
e.push(...i.children), e.push(i);
return this._children = e, e;
}
render(e) {
if (this.type === "first" && !e.atomIdsSettings)
return null;
let r = ee(this.command, this.mode);
if (r != null && r.render)
return r.render(this, e);
let i = new T({ parent: e }, this.style), n = this.createBox(i, { classes: this.parent ? "" : "ML__base" });
return n ? (!this.subsupPlacement && (this.superscript || this.subscript) && (n = this.attachSupsub(i, { base: n })), n.wrap(i)) : null;
}
attachSupsub(e, r) {
var f;
let i = r.base, n = this.superscript, o = this.subscript;
if (!n && !o)
return i;
let a = null, s = null, l = (f = r.isCharacterBox) != null ? f : this.isCharacterBox(), c = 0;
if (n) {
let b = new T({ parent: e, mathstyle: "superscript" });
a = t3.createBox(b, n), l || (c = i.height - e.metrics.supDrop * b.scalingFactor);
}
let u = 0;
if (o) {
let b = new T({ parent: e, mathstyle: "subscript" });
s = t3.createBox(b, o), l || (u = i.depth + e.metrics.subDrop * b.scalingFactor);
}
let d;
e.isDisplayStyle ? d = e.metrics.sup1 : e.isCramped ? d = e.metrics.sup3 : d = e.metrics.sup2;
let m = 0.5 / kt / e.scalingFactor, h = null;
if (s && a) {
c = Math.max(c, d, a.depth + 0.25 * e.metrics.xHeight), u = Math.max(u, e.metrics.sub2);
let b = e.metrics.defaultRuleThickness;
if (c - a.depth - (s.height - u) < 4 * b) {
u = 4 * b - (c - a.depth) + s.height;
let M = 0.8 * e.metrics.xHeight - (c - a.depth);
M > 0 && (c += M, u -= M);
}
let S = this.type === "extensible-symbol" && i.italic ? -i.italic : 0;
h = new U({ individualShift: [{ box: s, shift: u, marginLeft: S }, { box: a, shift: -c }] }).wrap(e);
} else
s && !a ? (u = Math.max(u, e.metrics.sub1, s.height - 0.8 * $e), h = new U({ shift: u, children: [{ box: s, marginRight: m, marginLeft: this.isCharacterBox() ? -i.italic : 0 }] })) : !s && a && (c = Math.max(c, d, a.depth + 0.25 * $e), h = new U({ shift: -c, children: [{ box: a, marginRight: m }] }));
return new w([i, new w(h, { caret: this.caret, isSelected: this.isSelected, classes: "ML__msubsup" })], { type: r.type });
}
attachLimits(e, r) {
let i = this.superscript ? t3.createBox(new T({ parent: e, mathstyle: "superscript" }, this.style), this.superscript) : null, n = this.subscript ? t3.createBox(new T({ parent: e, mathstyle: "subscript" }, this.style), this.subscript) : null;
return !i && !n ? r.base.wrap(e) : P0(e, g(p({}, r), { above: i, below: n }));
}
bind(e, r) {
if (!r || e.isPhantom || this.value === "\u200B")
return r;
let i = this.parent;
for (; i && !i.captureSelection; )
i = i.parent;
return i != null && i.captureSelection || (this.id || (this.id = e.makeID()), r.atomID = this.id), r;
}
createBox(e, r) {
var s, l, c, u;
let i = (s = this.value) != null ? s : this.body, n = (l = r == null ? void 0 : r.boxType) != null ? l : ga(this.type), o = (c = r == null ? void 0 : r.classes) != null ? c : "";
this.mode === "text" && (o += " ML__text");
let a = typeof i == "string" || i === void 0 ? new w(i != null ? i : null, { type: n, isSelected: this.isSelected, mode: this.mode, maxFontSize: e.scalingFactor, style: g(p({ variant: "normal" }, this.style), { fontSize: Math.max(1, e.size + e.mathstyle.sizeDelta) }), letterShapeStyle: e.letterShapeStyle, classes: o }) : (u = t3.createBox(e, i, { type: n, classes: o })) != null ? u : new w(null);
return e.isTight && (a.isTight = true), (this.mode !== "math" || this.style.variant === "main") && (a.italic = 0), a.right = a.italic, this.bind(e, a), this.caret && !this.superscript && !this.subscript && (a.caret = this.caret), a;
}
isDigit() {
var e;
return this.type === "mord" && this.value ? /^[\d,\.]$/.test(this.value) : this.type === "group" && ((e = this.body) == null ? void 0 : e.length) === 2 ? this.body[0].type === "first" && this.body[1].value === "," : false;
}
asDigit() {
var e;
return this.type === "mord" && this.value && /^[\d,\.]$/.test(this.value) ? this.value : this.type === "group" && ((e = this.body) == null ? void 0 : e.length) === 2 && this.body[0].type === "first" && this.body[1].value === "," ? "." : "";
}
};
function Mh(t37) {
let e, r = [], i = [];
for (let n of t37)
if (n.type === "first" && i.push(n), !e && !n.style)
i.push(n);
else {
let o = n.style;
e && o.color === e.color && o.backgroundColor === e.backgroundColor && o.fontSize === e.fontSize ? i.push(n) : (i.length > 0 && r.push(i), i = [n], e = o);
}
return i.length > 0 && r.push(i), r;
}
function wh(t37, e, r) {
var s, l, c, u, d;
if (!e || e.length === 0)
return null;
let i = new T({ parent: t37 }, r.style), n = !((s = i.atomIdsSettings) != null && s.groupNumbers), o = [];
if (e.length === 1) {
let m = e[0], h = m.render(i);
h && (n && m.isSelected && h.selected(true), o = [h]);
} else {
let m = "", h = true;
for (let f of e) {
(l = i.atomIdsSettings) != null && l.groupNumbers && m && (h && f.isDigit() || !h && yl(f)) && (i.atomIdsSettings.overrideID = m);
let b = f.render(i);
i.atomIdsSettings && (i.atomIdsSettings.overrideID = void 0), b && ((c = i.atomIdsSettings) != null && c.groupNumbers && ((f.isDigit() || yl(f)) && (!m || h !== f.isDigit()) && (h = f.isDigit(), m = (u = f.id) != null ? u : ""), m && (!(f.isDigit() || yl(f)) || !f.hasEmptyBranch("superscript") || !f.hasEmptyBranch("subscript")) && (m = "")), n && f.isSelected && b.selected(true), o.push(b));
}
}
if (o.length === 0)
return null;
let a = new w(o, g(p({ isTight: i.isTight }, r), { type: (d = r.type) != null ? d : "lift" }));
return a.isSelected = o.every((m) => m.isSelected), a.wrap(i);
}
function yl(t37) {
return t37.mode === "text";
}
function kh(t37) {
return t37.map((e) => e === null ? "<null>" : Array.isArray(e) && e[0] instanceof y ? { atoms: e.map((r) => r.toJson()) } : typeof e == "object" && "group" in e ? { group: e.group.map((r) => r.toJson()) } : e);
}
var Be = class t4 extends y {
constructor(e, r, i) {
super({ type: "text", command: e, mode: "text", displayContainsHighlight: true }), this.value = r, this.verbatimLatex = r, this.applyStyle(i);
}
static fromJson(e) {
return new t4(e.command, e.value, e.style);
}
render(e) {
let r = this.createBox(e);
return this.caret && (r.caret = this.caret), r;
}
_serialize(e) {
var r;
return (r = this.verbatimLatex) != null ? r : Es("text", this.value.codePointAt(0));
}
};
function R0(t37, e) {
if (t37.direction === e.direction) {
let r = t37.ranges.length;
if (e.ranges.length === r) {
let i = 0;
for (; i < r && Sh(t37.ranges[i], e.ranges[i]) === "equal"; )
i++;
return i === r ? "equal" : "different";
}
}
return "different";
}
function Sh(t37, e) {
return t37[0] === e[0] && t37[1] === e[1] ? "equal" : "different";
}
function te(t37) {
let e = 1 / 0, r = -1 / 0;
for (let i of t37.ranges)
e = Math.min(e, i[0], i[1]), r = Math.max(r, i[0], i[1]);
return [e, r];
}
function Lt(t37) {
return typeof t37 == "number" && !Number.isNaN(t37);
}
function $r(t37) {
return Array.isArray(t37) && t37.length === 2;
}
function Oi(t37) {
return t37 != null && typeof t37 == "object" && "ranges" in t37 && Array.isArray(t37.ranges);
}
function I0(t37, e) {
let r = t37.at(e), i;
if (r) {
i = r.mode;
let n = r.parent;
for (; !i && n; )
n && (i = n.mode), n = n.parent;
}
return i;
}
function Lh(t37, e) {
if (!e)
return "";
if (typeof e == "string")
return e;
if (!t37 || e.after === void 0)
return e.value;
let r = false, i = false, n = false, o = false, a = false, s = false, l = false, c = false, u = false, d = false, m = false, h = false, f = false, b = false, S = false, M = t37[0], x = 0;
for (; M != null && M.type && /^(subsup|placeholder)$/.test(M.type); )
x += 1, M = t37[x];
return r = !M || M.type === "first", M && (b = M.mode === "text", i = !b && M.type === "mord" && vo.test(M.value), n = !b && M.type === "mord" && /\d+$/.test(M.value), o = !b && M.isFunction, a = M.type === "genfrac", s = M.type === "surd", l = M.type === "mbin", c = M.type === "mrel", u = M.type === "mop" || M.type === "operator" || M.type === "extensible-symbol", d = M.type === "mpunct" || M.type === "minner", m = M.type === "array", h = M.type === "mopen", f = M.type === "mclose" || M.type === "leftright", S = M.type === "space"), e.after.includes("nothing") && r || e.after.includes("letter") && i || e.after.includes("digit") && n || e.after.includes("function") && o || e.after.includes("frac") && a || e.after.includes("surd") && s || e.after.includes("binop") && l || e.after.includes("relop") && c || e.after.includes("operator") && u || e.after.includes("punct") && d || e.after.includes("array") && m || e.after.includes("openfence") && h || e.after.includes("closefence") && f || e.after.includes("text") && b || e.after.includes("space") && S ? e.value : "";
}
function zn(t37, e, r) {
return r ? Lh(t37, r[e]) : "";
}
var va = { "&": "\\&", "%": "\\%", $: "\\$", "''": "^{\\doubleprime}", "'''": "^{\\prime\\prime\\prime}", "''''": "^{\\prime\\prime\\prime\\prime}", alpha: "\\alpha", delta: "\\delta", Delta: "\\Delta", pi: "\\pi", Pi: "\\Pi", theta: "\\theta", Theta: "\\Theta", ii: { after: "nothing+digit+function+frac+surd+binop+relop+punct+array+openfence+closefence+space+text", value: "\\imaginaryI" }, jj: { after: "nothing+digit+function+frac+surd+binop+relop+punct+array+openfence+closefence+space+text", value: "\\imaginaryJ" }, ee: { after: "nothing+digit+function+frac+surd+binop+relop+punct+array+openfence+closefence+space+text", value: "\\exponentialE" }, nabla: "\\nabla", grad: "\\nabla", del: "\\partial", deg: { after: "digit+space", value: "\\degree" }, infty: "\\infty", "\u221E": "\\infty", oo: { after: "nothing+digit+frac+surd+binop+relop+punct+array+openfence+closefence+space", value: "\\infty" }, "\u2211": "\\sum", sum: "\\sum_{#?}^{#?}", int: "\\int_{#?}^{#?}", prod: "\\prod_{#?}^{#?}", sqrt: "\\sqrt{#?}", "\u2206": "\\differentialD", "\u2202": "\\differentialD", arcsin: "\\arcsin", arccos: "\\arccos", arctan: "\\arctan", arcsec: "\\arcsec", arccsc: "\\arccsc", arsinh: "\\arsinh", arcosh: "\\arcosh", artanh: "\\artanh", arcsech: "\\arcsech", arccsch: "\\arccsch", arg: "\\arg", ch: "\\ch", cosec: "\\cosec", cosh: "\\cosh", cot: "\\cot", cotg: "\\cotg", coth: "\\coth", csc: "\\csc", ctg: "\\ctg", cth: "\\cth", sec: "\\sec", sinh: "\\sinh", sh: "\\sh", tanh: "\\tanh", tg: "\\tg", th: "\\th", sin: "\\sin", cos: "\\cos", tan: "\\tan", lg: "\\lg", lb: "\\lb", log: "\\log", ln: "\\ln", exp: "\\exp", lim: "\\lim_{#?}", dx: { after: "nothing+digit+function+frac+surd+binop+relop+punct+array+openfence+closefence+space+text", value: "\\differentialD x" }, dy: { after: "nothing+digit+function+frac+surd+binop+relop+punct+array+openfence+closefence+space+text", value: "\\differentialD y" }, dt: { after: "nothing+digit+function+frac+surd+binop+relop+punct+array+openfence+closefence+space+text", value: "\\differentialD t" }, AA: "\\forall", EE: "\\exists", "!EE": "\\nexists", "&&": "\\land", xin: { after: "nothing+text+relop+punct+openfence+space", value: "x \\in" }, sint: { after: "nothing+digit+function+frac+surd+binop+relop+punct+array+openfence+closefence+space+text", value: "\\sin t" }, in: { after: "nothing+letter+closefence", value: "\\in" }, "!in": "\\notin", NN: "\\mathbb{N}", ZZ: "\\Z", QQ: "\\Q", RR: "\\R", CC: "\\C", xx: "\\times", "+-": "\\pm", "\u2260": "\\ne", "!=": "\\ne", "\u2265": "\\ge", ">=": "\\ge", "\u2264": "\\le", "<=": "\\le", "<<": "\\ll", ">>": "\\gg", "~~": "\\approx", "\u2248": "\\approx", "?=": "\\questeq", "\xF7": "\\div", "\xAC": "\\neg", ":=": "\\coloneq", "::": "\\Colon", "(:": "\\langle", ":)": "\\rangle", beta: "\\beta", chi: "\\chi", epsilon: "\\epsilon", varepsilon: "\\varepsilon", eta: { after: "nothing+digit+function+frac+surd+binop+relop+punct+array+openfence+closefence+space+text", value: "\\eta" }, gamma: "\\gamma", Gamma: "\\Gamma", iota: "\\iota", kappa: "\\kappa", lambda: "\\lambda", Lambda: "\\Lambda", mu: { after: "nothing+digit+function+frac+surd+binop+relop+punct+array+openfence+closefence+space+text", value: "\\mu" }, nu: { after: "nothing+digit+function+frac+surd+binop+relop+punct+array+openfence+closefence+space+text", value: "\\nu" }, \u00B5: "\\mu", phi: { after: "nothing+digit+function+frac+surd+binop+relop+punct+array+openfence+closefence+space+text", value: "\\phi" }, Phi: { after: "nothing+digit+function+frac+surd+binop+relop+punct+array+openfence+closefence+space+text", value: "\\Phi" }, varphi: "\\varphi", psi: { after: "nothing+digit+function+frac+surd+binop+relop+punct+array+openfence+closefence+space+text", value: "\\psi" }, Psi: { after: "nothing+digit+function+frac+surd+binop+relop+punct+array+openfence+closefence+space+text", value: "\\Psi" }, rho: { after: "nothing+digit+function+frac+surd+binop+relop+punct+array+openfence+closefence+space+text", value: "\\rho" }, sigma: "\\sigma", Sigma: "\\Sigma", tau: { after: "nothing+digit+function+frac+surd+binop+relop+punct+array+openfence+closefence+space+text", value: "\\tau" }, vartheta: "\\vartheta", upsilon: "\\upsilon", xi: { after: "nothing+digit+function+frac+surd+binop+relop+punct+array+openfence+closefence+space", value: "\\xi" }, Xi: { after: "nothing+digit+function+frac+surd+binop+relop+punct+array+openfence+closefence+space+text", value: "\\Xi" }, zeta: "\\zeta", omega: "\\omega", Omega: "\\Omega", \u03A9: "\\omega", forall: "\\forall", exists: "\\exists", "!exists": "\\nexists", ":.": "\\therefore", liminf: "\\liminf_{#?}", limsup: "\\limsup_{#?}", argmin: "\\operatorname*{arg~min}_{#?}", argmax: "\\operatorname*{arg~max}_{#?}", det: "\\det", mod: "\\bmod{#?}", "(mod": "\\pmod{#?}", max: "\\max", min: "\\min", erf: "\\operatorname{erf}", erfc: "\\operatorname{erfc}", bessel: "\\operatorname{bessel}", mean: "\\operatorname{mean}", median: "\\operatorname{median}", fft: "\\operatorname{fft}", lcm: "\\operatorname{lcm}", gcd: "\\operatorname{gcd}", randomReal: "\\operatorname{randomReal}", randomInteger: "\\operatorname{randomInteger}", Re: "\\operatorname{Re}", Im: "\\operatorname{Im}", mm: { after: "nothing+digit+operator", value: "\\operatorname{mm}" }, cm: { after: "nothing+digit+operator", value: "\\operatorname{cm}" }, km: { after: "nothing+digit+operator", value: "\\operatorname{km}" }, kg: { after: "nothing+digit+operator", value: "\\operatorname{kg}" }, "...": "\\ldots", "+...": "+\\cdots", "-...": "-\\cdots", "->...": "\\to\\cdots", "-->...": "\\longrightarrow\\cdots", "->": "\\to", "|->": "\\mapsto", "-->": "\\longrightarrow", "<--": "\\longleftarrow", "=>": "\\Rightarrow", "==>": "\\Longrightarrow", "<=>": "\\Leftrightarrow", "<->": "\\leftrightarrow", "(.)": "\\odot", "(+)": "\\oplus", "(/)": "\\oslash", "(*)": "\\otimes", "(-)": "\\ominus", "||": "\\Vert", "*": "\\cdot", "**": "\\star", "***": "\\ast", "//": "\\slash", "\\\\": "\\backslash", setminus: "\\backslash", "|><": "\\ltimes", "><|": "\\rtimes", "|><|": "\\bowtie", "-:": "\\div", divide: "\\div", "@": "\\circ", "^^": "\\wedge", "^^^": "\\bigwedge", vv: "\\vee", vvv: "\\bigvee", nn: "\\cap", nnn: "\\bigcap", uu: "\\cup", uuu: "\\bigcup", "-=": "\\equiv", "~=": "\\cong", lt: "<", "lt=": "\\leq", gt: ">", "gt=": "\\geq", "-<": "\\prec", "-lt": "\\prec", "-<=": "\\preceq", ">-=": "\\succeq", prop: "\\propto", diamond: "\\diamond", square: "\\square", iff: "\\iff", sub: "\\subset", sup: "\\supset", sube: "\\subseteq", supe: "\\supseteq", uarr: "\\uparrow", darr: "\\downarrow", rarr: "\\rightarrow", rArr: "\\Rightarrow", larr: "\\leftarrow", lArr: "\\Leftarrow", harr: "\\leftrightarrow", hArr: "\\Leftrightarrow", aleph: "\\aleph", and: "\\land", or: "\\lor", not: "\\neg", "_|_": "\\bot", TT: "\\top", "|--": "\\vdash", "|==": "\\models", "|__": "\\lfloor", "__|": "\\rfloor", "|~": "\\lceil", "~|": "\\rceil", ">->": "\\rightarrowtail", "->>": "\\twoheadrightarrow", ">->>": "\\twoheadrightarrowtail", frac: "\\frac{#?}{#?}", cbrt: "\\sqrt[3]{#?}", nthroot: "\\sqrt[#?]{#?}" };
function qt(t37, e) {
var i;
let r = (i = e == null ? void 0 : e.format) != null ? i : "auto";
return r === "auto" && ([r, t37] = Ah(t37)), r === "ascii-math" ? (t37 = t37.replace(/\u2061/gu, ""), t37 = t37.replace(/\u3016/gu, "{"), t37 = t37.replace(/\u3017/gu, "}"), t37 = t37.replace(/([^\\])sinx/g, "$1\\sin x"), t37 = t37.replace(/([^\\])cosx/g, "$1\\cos x "), t37 = t37.replace(/\u2013/g, "-"), ["ascii-math", Ce(t37, { inlineShortcuts: e == null ? void 0 : e.inlineShortcuts })]) : ["latex", t37];
}
function Ce(t37, e) {
var a;
if (t37 = t37.trim(), !t37)
return "";
let r = (a = e.inlineShortcuts) != null ? a : va;
if (t37.startsWith("^") || t37.startsWith("_")) {
let { match: s, rest: l } = Vr(t37.slice(1), { inlineShortcuts: r, noWrap: true });
return `${t37[0]}{${s}}${Ce(l, e)}`;
}
let i = t37.match(/^(sqrt|\u221A)(.*)/);
if (i) {
let { match: s, rest: l } = Vr(i[2], { inlineShortcuts: r, noWrap: true });
return `\\sqrt{${s != null ? s : "\\placeholder{}"}}${Ce(l, e)}`;
}
if (i = t37.match(/^(\\cbrt|\u221B)(.*)/), i) {
let { match: s, rest: l } = Vr(i[2], { inlineShortcuts: r, noWrap: true });
return `\\sqrt[3]{${s != null ? s : "\\placeholder{}"}}${Ce(l, e)}`;
}
if (i = t37.match(/^abs(.*)/), i) {
let { match: s, rest: l } = Vr(i[1], { inlineShortcuts: r, noWrap: true });
return `\\left|${s != null ? s : "\\placeholder{}"}\\right|${Ce(l, e)}`;
}
if (i = t37.match(/^["”“](.*?)["”“](.*)/), i)
return `\\text{${i[1]}}${Ce(i[2], e)}`;
if (i = t37.match(/^([^a-zA-Z\(\{\[\_\^\\\s"]+)(.*)/), i)
return `${z0(i[1], r)}${Ce(i[2], e)}`;
if (/^([fgh])[^a-zA-Z]/.test(t37)) {
let { rest: s, match: l } = Vr(t37.slice(1), { inlineShortcuts: r, noWrap: true }), c = "";
return t37[1] === "(" ? c = `${t37[0]}\\left(${l}\\right)` : c = t37[0] + l, c + Ce(s, e);
}
if (i = t37.match(/^([a-zA-Z]+)(.*)/), i)
return z0(i[1], r) + Ce(i[2], e);
let { match: n, rest: o } = Vr(t37, { inlineShortcuts: r, noWrap: true });
if (n && o[0] === "/") {
let s = Vr(o.slice(1), { inlineShortcuts: r, noWrap: true });
if (s.match)
return `\\frac{${n}}{${s.match}}${Ce(s.rest, e)}`;
} else if (n)
return t37.startsWith("(") ? "\\left(" + n + "\\right)" + Ce(o, e) : n + Ce(o, e);
return i = t37.match(/^(\s+)(.*)$/), i ? " " + Ce(i[2], e) : t37;
}
function Vr(t37, e) {
let r = "";
t37 = t37.trim();
let i = t37, n = t37.charAt(0), o = { "(": ")", "{": "}", "[": "]" }[n];
if (o) {
let a = 1, s = 1;
for (; s < t37.length && a > 0; )
t37[s] === n && a++, t37[s] === o && a--, s++;
a === 0 ? (e.noWrap && n === "(" ? r = Ce(t37.substring(1, s - 1), e) : (n === "{" && o === "}" && (n = "\\{", o = "\\}"), r = "\\left" + n + Ce(t37.substring(1, s - 1), e) + "\\right" + o), i = t37.slice(Math.max(0, s))) : (r = t37.substring(1, s), i = "");
} else {
let a = t37.match(/^([a-zA-Z]+)/);
if (a) {
let s = zn(null, t37, e.inlineShortcuts);
if (s)
return s = s.replace("_{#?}", ""), s = s.replace("^{#?}", ""), { match: s, rest: t37.slice(s.length) };
}
if (a = t37.match(/^([a-zA-Z])/), a)
return { match: a[1], rest: t37.slice(1) };
if (a = t37.match(/^(-)?\d+(\.\d*)?/), a)
return { match: a[0], rest: t37.slice(a[0].length) };
/^\\(left|right)/.test(t37) || (a = t37.match(/^(\\[a-zA-Z]+)/), a && (i = t37.slice(a[1].length), r = a[1]));
}
return { match: r, rest: i };
}
function z0(t37, e) {
let r = zn(null, t37, e);
return r ? (r = r.replace("_{#?}", ""), r = r.replace("^{#?}", ""), r += " ") : r = t37, r;
}
var bl = [["\\[", "\\]"], ["\\(", "\\)"], ["$$", "$$"], ["$", "$"], ["\\begin{math}", "\\end{math}"], ["\\begin{displaymath}", "\\end{displaymath}"], ["\\begin{equation}", "\\end{equation}"], ["\\begin{equation*}", "\\end{equation*}"]];
function _a(t37) {
let e = t37.trim();
for (let r of bl)
if (e.startsWith(r[0]) && e.endsWith(r[1]))
return [true, e.substring(r[0].length, e.length - r[1].length)];
return [false, t37];
}
function Ah(t37) {
if (t37 = t37.trim(), t37.length <= 1)
return ["latex", t37];
let e;
return [e, t37] = _a(t37), e ? ["latex", t37] : t37.startsWith("`") && t37.endsWith("`") ? (t37 = t37.substring(1, t37.length - 1), ["ascii-math", t37]) : t37.includes("\\") ? ["latex", t37] : /\$.+\$/.test(t37) ? ["latex", `\\text{${t37}}`] : [void 0, t37];
}
var Ch = "$$";
var Eh = "$$";
var N0 = (t37, e, r) => (bl.some((i) => e.startsWith(i[0]) && e.endsWith(i[1])) || (e = `${Ch} ${e} ${Eh}`), e);
var Pi = class Pi2 {
constructor(e) {
Pi2._modes[e] = this;
}
static onPaste(e, r, i) {
var o;
if (!r.contentEditable && r.userSelect === "none")
return r.model.announce("plonk"), false;
if (typeof i == "string") {
let a = new DataTransfer();
a.setData("text/plain", i), i = a;
}
let n = new ClipboardEvent("paste", { clipboardData: i, cancelable: true });
return (o = r.host) != null && o.dispatchEvent(n) ? Pi2._modes[e].onPaste(r, i) : false;
}
static copyToClipboard(e, r) {
if (!e.contentEditable && e.userSelect === "none") {
e.model.announce("plonk");
return;
}
let i = e.model, n = i.selectionIsCollapsed ? [0, i.lastOffset] : te(i.selection), o = i.getValue(n, r);
navigator.clipboard.writeText(o).then(() => {
}, () => e.model.announce("plonk"));
}
static onCopy(e, r) {
var a;
if (!r.clipboardData)
return;
if (!e.contentEditable && e.userSelect === "none") {
e.model.announce("plonk");
return;
}
let i = e.model, n = i.selectionIsCollapsed ? [0, i.lastOffset] : te(i.selection), o = i.getAtoms(n);
if (o.every((s) => s.mode === "text" || !s.mode))
r.clipboardData.setData("text/plain", o.filter((s) => s instanceof Be).map((s) => s.value).join(""));
else if (o.every((s) => s.mode === "latex"))
r.clipboardData.setData("text/plain", i.getAtoms(n, { includeChildren: true }).map((s) => {
var l;
return (l = s.value) != null ? l : "";
}).join(""));
else {
let s;
o.length === 1 && o[0].verbatimLatex !== void 0 ? s = o[0].verbatimLatex : s = i.getValue(n, "latex-expanded"), r.clipboardData.setData("application/x-latex", s);
try {
r.clipboardData.setData("text/plain", e.options.onExport(e, s, n));
} catch (l) {
}
if (o.length === 1) {
let l = o[0];
(l.type === "root" || l.type === "group") && (o = l.body.filter((c) => c.type !== "first"));
}
try {
r.clipboardData.setData("application/json+mathlive", JSON.stringify(o.map((l) => l.toJson())));
} catch (l) {
}
if ((a = window[Symbol.for("io.cortexjs.compute-engine")]) != null && a.ComputeEngine) {
let l = globalThis.MathfieldElement.computeEngine;
if (l)
try {
let c = l.jsonSerializationOptions;
l.jsonSerializationOptions = { metadata: ["latex"] };
let u = l.parse(i.getValue(n, "latex-unstyled"));
l.jsonSerializationOptions = c;
let d = JSON.stringify(u.json);
d && r.clipboardData.setData("application/json", d);
} catch (c) {
}
}
}
r.preventDefault();
}
static insert(e, r, i = {}) {
var o;
let n = i.mode === "auto" ? e.mode : (o = i.mode) != null ? o : e.mode;
return Pi2._modes[n].insert(e, r, i);
}
onPaste(e, r) {
return false;
}
insert(e, r, i) {
return false;
}
};
Pi._modes = {};
var z = Pi;
var F0 = [{ key: "left", command: "moveToPreviousChar" }, { key: "right", command: "moveToNextChar" }, { key: "up", command: "moveUp" }, { key: "down", command: "moveDown" }, { key: "shift+[ArrowLeft]", command: "extendSelectionBackward" }, { key: "shift+[ArrowRight]", command: "extendSelectionForward" }, { key: "shift+[ArrowUp]", command: "extendSelectionUpward" }, { key: "shift+[ArrowDown]", command: "extendSelectionDownward" }, { key: "[Backspace]", command: "deleteBackward" }, { key: "alt+[Delete]", command: "deleteBackward" }, { key: "[Delete]", command: "deleteForward" }, { key: "alt+[Backspace]", command: "deleteForward" }, { key: "alt+[ArrowLeft]", command: "moveToPreviousWord" }, { key: "alt+[ArrowRight]", command: "moveToNextWord" }, { key: "shift+alt+[ArrowLeft]", command: "extendToPreviousWord" }, { key: "shift+alt+[ArrowRight]", command: "extendToNextWord" }, { key: "ctrl+[ArrowLeft]", command: "moveToGroupStart" }, { key: "ctrl+[ArrowRight]", command: "moveToGroupEnd" }, { key: "shift+ctrl+[ArrowLeft]", command: "extendToGroupStart" }, { key: "shift+ctrl+[ArrowRight]", command: "extendToGroupEnd" }, { key: "[Home]", command: "moveToMathfieldStart" }, { key: "cmd+[ArrowLeft]", command: "moveToMathfieldStart" }, { key: "shift+[Home]", command: "extendToMathFieldStart" }, { key: "shift+cmd+[ArrowLeft]", command: "extendToMathFieldStart" }, { key: "[End]", command: "moveToMathfieldEnd" }, { key: "cmd+[ArrowRight]", command: "moveToMathfieldEnd" }, { key: "shift+[End]", command: "extendToMathFieldEnd" }, { key: "shift+cmd+[ArrowRight]", command: "extendToMathFieldEnd" }, { key: "[Pageup]", command: "moveToGroupStart" }, { key: "[Pagedown]", command: "moveToGroupEnd" }, { key: "[Tab]", command: "moveToNextGroup" }, { key: "shift+[Tab]", command: "moveToPreviousGroup" }, { key: "[Escape]", ifMode: "math", command: ["switchMode", "latex"] }, { key: "[Escape]", ifMode: "text", command: ["switchMode", "latex"] }, { key: "[Escape]", ifMode: "latex", command: ["complete", "complete", { selectItem: "true" }] }, { key: "\\", ifMode: "math", command: ["switchMode", "latex", "", "\\"] }, { key: "[IntlBackslash]", ifMode: "math", command: ["switchMode", "latex", "", "\\"] }, { key: "[Tab]", ifMode: "latex", command: ["complete", "accept-suggestion"] }, { key: "[Return]", ifMode: "latex", command: "complete" }, { key: "[Enter]", ifMode: "latex", command: "complete" }, { key: "shift+[Escape]", ifMode: "latex", command: ["complete", "reject"] }, { key: "[ArrowDown]", ifMode: "latex", command: "nextSuggestion" }, { key: "[ArrowUp]", ifMode: "latex", command: "previousSuggestion" }, { key: "ctrl+a", ifPlatform: "!macos", command: "selectAll" }, { key: "cmd+a", command: "selectAll" }, { key: "[Cut]", command: "cutToClipboard" }, { key: "[Copy]", command: "copyToClipboard" }, { key: "[Paste]", command: "pasteFromClipboard" }, { key: "[Clear]", command: "deleteBackward" }, { key: "[Undo]", command: "undo" }, { key: "[Redo]", command: "redo" }, { key: "[EraseEof]", command: "deleteToGroupEnd" }, { key: "ctrl+x", ifPlatform: "ios", command: "cutToClipboard" }, { key: "cmd+x", ifPlatform: "ios", command: "cutToClipboard" }, { key: "ctrl+c", ifPlatform: "ios", command: "copyToClipboard" }, { key: "cmd+c", ifPlatform: "ios", command: "copyToClipboard" }, { key: "ctrl+v", ifPlatform: "ios", command: "pasteFromClipboard" }, { key: "cmd+v", ifPlatform: "ios", command: "pasteFromClipboard" }, { key: "ctrl+z", ifPlatform: "!macos", command: "undo" }, { key: "cmd+z", command: "undo" }, { key: "ctrl+y", ifPlatform: "!macos", command: "redo" }, { key: "shift+cmd+y", command: "redo" }, { key: "shift+ctrl+z", ifPlatform: "!macos", command: "redo" }, { key: "shift+cmd+z", command: "redo" }, { key: "ctrl+b", ifPlatform: "macos", command: "moveToPreviousChar" }, { key: "ctrl+f", ifPlatform: "macos", command: "moveToNextChar" }, { key: "ctrl+p", ifPlatform: "macos", command: "moveUp" }, { key: "ctrl+n", ifPlatform: "macos", command: "moveDown" }, { key: "ctrl+a", ifPlatform: "macos", command: "moveToMathfieldStart" }, { key: "ctrl+e", ifPlatform: "macos", command: "moveToMathfieldEnd" }, { key: "shift+ctrl+b", ifPlatform: "macos", command: "extendSelectionBackward" }, { key: "shift+ctrl+f", ifPlatform: "macos", command: "extendSelectionForward" }, { key: "shift+ctrl+p", ifPlatform: "macos", command: "extendSelectionUpward" }, { key: "shift+ctrl+n", ifPlatform: "macos", command: "extendSelectionDownward" }, { key: "shift+ctrl+a", ifPlatform: "macos", command: "extendToMathFieldStart" }, { key: "shift+ctrl+e", ifPlatform: "macos", command: "extendToMathFieldEnd" }, { key: "alt+ctrl+b", ifPlatform: "macos", command: "moveToPreviousWord" }, { key: "alt+ctrl+f", ifPlatform: "macos", command: "moveToNextWord" }, { key: "shift+alt+ctrl+b", ifPlatform: "macos", command: "extendToPreviousWord" }, { key: "shift+alt+ctrl+f", ifPlatform: "macos", command: "extendToNextWord" }, { key: "ctrl+h", ifPlatform: "macos", command: "deleteBackward" }, { key: "ctrl+d", ifPlatform: "macos", command: "deleteForward" }, { key: "ctrl+l", ifPlatform: "macos", command: "scrollIntoView" }, { key: "ctrl+[Digit2]", ifMode: "math", command: ["insert", "\\sqrt{#0}"] }, { key: "ctrl+[Digit5]", ifMode: "math", command: "moveToOpposite" }, { key: "ctrl+[Digit6]", ifMode: "math", command: "moveToSuperscript" }, { key: "ctrl+[Return]", ifMode: "math", command: "addRowAfter" }, { key: "ctrl+[Enter]", ifMode: "math", command: "addRowAfter" }, { key: "cmd+[Return]", ifMode: "math", command: "addRowAfter" }, { key: "cmd+[Enter]", ifMode: "math", command: "addRowAfter" }, { key: "alt+p", ifMode: "math", command: ["insert", "\\pi"] }, { key: "alt+v", ifMode: "math", command: ["insert", "\\sqrt{#0}"] }, { key: "alt+o", ifMode: "math", command: ["insert", "\\emptyset"] }, { key: "alt+d", ifMode: "math", command: ["insert", "\\differentialD"] }, { key: "shift+alt+o", ifMode: "math", command: ["insert", "\\varnothing"] }, { key: "shift+alt+d", ifMode: "math", command: ["insert", "\\partial"] }, { key: "alt+[Backslash]", ifMode: "math", command: ["insert", "\\backslash"] }, { key: "[NumpadDivide]", ifMode: "math", command: ["insert", "\\frac{#@}{#?}"] }, { key: "alt+[NumpadDivide]", ifMode: "math", command: ["insert", "\\frac{#?}{#@}"] }, { key: "shift+alt+k", command: "toggleKeystrokeCaption" }, { key: "alt+[Space]", command: "toggleContextMenu" }, { key: "alt+shift+[Space]", command: "toggleVirtualKeyboard" }, { key: "alt+ctrl+[ArrowUp]", command: ["speak", "all", { withHighlighting: false }] }, { key: "alt+ctrl+[ArrowDown]", command: ["speak", "selection", { withHighlighting: false }] }, { key: "shift+[Quote]", ifLayout: ["apple.en-intl", "windows.en-intl", "linux.en"], ifMode: "math", command: ["switchMode", "text", "", ""] }, { key: "shift+[Quote]", ifLayout: ["apple.en-intl", "windows.en-intl", "linux.en"], ifMode: "text", command: ["switchMode", "math", "", ""] }, { key: "shift+alt+[KeyT]", ifMode: "math", command: ["switchMode", "text"] }, { key: "shift+alt+[KeyT]", ifMode: "text", command: ["switchMode", "math"] }, { key: "/", ifMode: "math", command: ["insert", "\\frac{#@}{#?}"] }, { key: "alt+/", ifLayout: ["apple.en-intl", "windows.en-intl", "linux.en"], ifMode: "math", command: ["insert", "/"] }, { key: "alt+shift+/", ifLayout: ["apple.en-intl", "windows.en-intl", "linux.en"], ifMode: "math", command: ["insert", "/"] }, { key: "alt+[BracketLeft]", ifLayout: ["apple.en-intl", "windows.en-intl", "linux.en"], ifMode: "math", command: ["insert", "\\left\\lbrack #0 \\right\\rbrack"] }, { key: "ctrl+[Minus]", ifLayout: ["apple.en-intl", "windows.en-intl", "linux.en"], ifMode: "math", command: "moveToSubscript" }, { key: "shift+alt+[BracketLeft]", ifLayout: ["apple.en-intl", "windows.en-intl", "linux.en"], ifMode: "math", command: ["insert", "\\left\\lbrace #0 \\right\\rbrace"] }, { key: "ctrl+;", ifLayout: ["apple.en-intl", "windows.en-intl", "linux.en"], ifMode: "math", command: "addRowAfter" }, { key: "cmd+;", ifLayout: ["apple.en-intl", "windows.en-intl", "linux.en"], ifMode: "math", command: "addRowAfter" }, { key: "shift+ctrl+;", ifLayout: ["apple.en-intl", "windows.en-intl", "linux.en"], ifMode: "math", command: "addRowBefore" }, { key: "shift+cmd+;", ifLayout: ["apple.en-intl", "windows.en-intl", "linux.en"], ifMode: "math", command: "addRowBefore" }, { key: "ctrl+[Backspace]", ifMode: "math", command: "removeRow" }, { key: "cmd+[Backspace]", ifMode: "math", command: "removeRow" }, { key: "alt+[Tab]", ifMode: "math", command: "addColumnAfter" }, { key: "shift+alt+[Tab]", ifMode: "math", command: "addColumnBefore" }, { key: "alt+[Enter]", ifMode: "math", command: "addRowAfter" }, { key: "shift+alt+[Enter]", ifMode: "math", command: "addRowBefore" }, { key: "alt+[Return]", ifMode: "math", command: "addRowAfter" }, { key: "shift+alt+[Return]", ifMode: "math", command: "addRowBefore" }, { key: "shift+[Backspace]", ifMode: "math", command: "removeColumn" }, { key: "alt+[Digit5]", ifLayout: ["apple.en-intl", "windows.en-intl", "linux.en"], ifMode: "math", command: ["insert", "$\\infty"] }, { key: "alt+[Digit9]", ifLayout: ["apple.en-intl", "windows.en-intl", "linux.en"], ifMode: "math", command: ["insert", "("] }, { key: "alt+[Digit0]", ifLayout: ["apple.en-intl", "windows.en-intl", "linux.en"], ifMode: "math", command: ["insert", ")"] }, { key: "alt+|", ifLayout: ["apple.en-intl", "windows.en-intl", "linux.en"], ifMode: "math", command: ["insert", "|"] }, { key: "shift+[Backquote]", ifLayout: ["apple.en-intl", "windows.en-intl", "linux.en"], ifMode: "math", command: ["insert", "\\~"] }, { key: "[Backquote]", ifLayout: ["windows.french", "linux.french"], ifMode: "math", command: ["insert", "^2"] }, { key: "[Backquote]", ifLayout: ["windows.german", "linux.german"], ifMode: "math", command: ["insert", "^"] }, { key: "[IntlBackslash]", ifLayout: ["apple.german"], ifMode: "math", command: ["insert", "^"] }];
var $0 = { "\\sqrt": ["alt+v", "ctrl+[Digit2]"], "\\pi": "alt+p", "\\infty": "alt+[Digit5]", "\\differentialD": "alt+d", "\\partial": "shift+alt+d", "\\frac": "Slash", "\\emptyset": "alt+o", "\\varnothing": "shift+alt+o", "\\~": "~" };
function tt(t37) {
var e;
return ((e = t37.element) == null ? void 0 : e.mathfield) === t37;
}
function Th(t37) {
var e, r;
return (r = (e = t37.querySelector(".ML__caret")) != null ? e : t37.querySelector(".ML__text-caret")) != null ? r : t37.querySelector(".ML__latex-caret");
}
function Ri(t37) {
let e = Th(t37);
if (!e)
return null;
let r = e.getBoundingClientRect();
return { x: r.right, y: r.bottom, height: r.height };
}
function Dh(t37) {
var r;
if (!t37.parent)
return "root";
let e = (r = t37.parent.id) != null ? r : "";
return e += typeof t37.parentBranch == "string" ? "-" + t37.parentBranch : `-${t37.parentBranch[0]}/${t37.parentBranch[0]}`, e;
}
function xl(t37, e, r) {
if (!e)
return null;
let i = t37.field.getBoundingClientRect(), n = e.right - e.left, o = e.bottom - e.top, a = Math.ceil(e.left - i.left + t37.field.scrollLeft * r), s = Math.ceil(e.top - i.top);
return { left: a, right: a + n, top: s, bottom: s + o };
}
function V0(t37) {
let e = t37.getBoundingClientRect(), r = parseInt(getComputedStyle(t37).marginRight), i = { top: e.top - 1, bottom: e.bottom, left: e.left, right: e.right - 1 + r };
if (t37.children.length === 0 || t37.tagName.toUpperCase() === "SVG")
return i;
for (let n of t37.children)
if (n.nodeType === 1 && "atomId" in n.dataset && !n.classList.contains("ML__pstrut")) {
let o = V0(n);
i.left = Math.min(i.left, o.left), i.right = Math.max(i.right, o.right), i.top = Math.min(i.top, o.top), i.bottom = Math.max(i.bottom, o.bottom);
}
return i;
}
function qr(t37, e) {
var n, o;
if (!e.id)
return null;
let r = (o = (n = t37.atomBoundsCache) == null ? void 0 : n.get(e.id)) != null ? o : null;
if (r !== null)
return r;
let i = t37.field.querySelector(`[data-atom-id="${e.id}"]`);
return r = i ? V0(i) : null, t37.atomBoundsCache && (r ? t37.atomBoundsCache.set(e.id, r) : t37.atomBoundsCache.delete(e.id)), r != null ? r : null;
}
function Kh(t37, e, r) {
let i = /* @__PURE__ */ new Map();
for (let n of t37.model.getAtoms(e, { includeChildren: true })) {
if (r != null && r.excludeAtomsWithBackground && n.style.backgroundColor)
continue;
let o = t37.field, a = o.offsetWidth, l = Math.floor(o.getBoundingClientRect().width) / a;
l = isNaN(l) ? 1 : l;
let c = xl(t37, qr(t37, n), l);
if (c) {
let u = Dh(n);
if (i.has(u)) {
let d = i.get(u);
i.set(u, { left: Math.min(d.left, c.left), right: Math.max(d.right, c.right), top: Math.min(d.top, c.top), bottom: Math.max(d.bottom, c.bottom) });
} else
i.set(u, c);
}
}
return [...i.values()];
}
function Ma(t37, e) {
return t37.model.selection.ranges.reduce((r, i) => r.concat(...Kh(t37, i, e)), []);
}
function Ii(t37, e) {
return t37 === "*" || e === "none" ? true : e === "same-origin" ? !window.origin || t37 === window.origin : typeof e == "function" ? e(t37) : false;
}
function vl(t37) {
let e = 0, r = 0, i = t37.offsetWidth, n = t37.offsetHeight;
for (; t37 instanceof HTMLElement; )
e += t37.offsetTop, r += t37.offsetLeft, t37 = t37.offsetParent;
return new DOMRect(r, e, i, n);
}
function wa(t37, e) {
if (!t37)
return;
let r = t37.model.at(e);
if (!r)
return;
let i = {}, n = qr(t37, r);
n && (i.bounds = new DOMRect(n.left, n.top, n.right - n.left, n.bottom - n.top)), i.depth = r.treeDepth - 2, i.style = r.style;
let o = r;
for (; o; ) {
if (o.command === "\\htmlData" && o.args && typeof o.args[0] == "string") {
let a = o.args[0].split(",");
for (let s of a) {
let l = s.match(/([^=]+)=(.+$)/);
if (l) {
let c = l[1].trim().replace(/ /g, "-");
c && (i.data || (i.data = {}), i.data[c] = l[2]);
} else {
let c = s.trim().replace(/ /g, "-");
c && (i.data || (i.data = {}), i.data[c] = void 0);
}
}
}
(o.command === "\\htmlId" || o.command === "\\cssId") && !i.id && o.args && typeof o.args[0] == "string" && (i.id = o.args[0]), o = o.parent;
}
return (r.mode === "math" || r.mode === "text") && (i.latex = y.serialize([r], { defaultMode: "math" })), i;
}
function q0(t37, e) {
let r = t37.model.at(e);
for (; r; ) {
if (r.command === "\\href") {
let i = r.args[0];
if (typeof i == "string")
return i;
}
r = r.parent;
}
return "";
}
var H0 = `@keyframes ML__caret-blink {
0%,
100% {
opacity: 1;
}
50% {
opacity: 0;
}
}
.ML__container {
display: inline-flex;
flex-flow: row;
justify-content: space-between;
align-items: flex-end;
min-height: 39px;
/* Need some room for the virtual keyboard toggle */
width: 100%;
/* This attribute is necessary to work around a Firefox issue where
where clicking multiple times on the border leads to a focused mathfield that cannot be edited until focus is lost and regained (also fixes the multiple cursor issue on firefox that can occur with the same sequence of events).
*/
pointer-events: auto;
/* Prevent the browser from trying to interpret touch gestures in the field */
/* "Disabling double-tap to zoom removes the need for browsers to
delay the generation of click events when the user taps the screen." */
touch-action: none;
--_caret-color: var(--caret-color, hsl(var(--_hue), 40%, 49%));
--_selection-color: var(--selection-color, #000);
--_selection-background-color: var(--selection-background-color, hsl(var(--_hue), 70%, 85%));
--_text-highlight-background-color: var(--highlight-text, hsla(var(--_hue), 40%, 50%, 0.1));
--_contains-highlight-background-color: var(--contains-highlight-background-color, hsl(var(--_hue), 40%, 95%));
--_smart-fence-color: var(--smart-fence-color, currentColor);
--_smart-fence-opacity: var(--smart-fence-opacity, 0.5);
--_latex-color: var(--latex-color, hsl(var(--_hue), 80%, 40%));
--_correct-color: var(--correct-color, #10a000);
--_incorrect-color: var(--incorrect-color, #a01b00);
--_composition-background-color: var(--composition-background-color, #fff1c2);
--_composition-text-color: var(--composition-text-color, black);
--_composition-underline-color: var(--composition-underline-color, transparent);
--_tooltip-border: var(--tooltip-border, 1px solid transparent);
--_tooltip-border-radius: var(--tooltip-border-radius, 8px);
--_tooltip-background-color: var(--tooltip-background-color, #616161);
--_tooltip-color: var(--tooltip-color, #fff);
--_tooltip-box-shadow: var(--tooltip-box-shadow, 0 2px 2px 0 rgba(0, 0, 0, 0.14), 0 1px 5px 0 rgba(0, 0, 0, 0.12), 0 3px 1px -2px rgba(0, 0, 0, 0.2));
}
/* This is the actual field content (formula) */
.ML__content {
display: flex;
align-items: center;
align-self: center;
position: relative;
overflow: hidden;
padding: 2px 3px 2px 1px;
width: 100%;
/* Encourage the browser to use the GPU to render the field.
Weirdly, this is required for prompts to be rendered correctly.
*/
isolation: isolate;
}
.ML__virtual-keyboard-toggle,
.ML__menu-toggle {
box-sizing: border-box;
display: flex;
align-self: center;
align-items: center;
flex-shrink: 0;
flex-direction: column;
justify-content: center;
width: 34px;
height: 34px;
padding: 0;
margin-right: 4px;
cursor: pointer;
/* Avoid some weird blinking with :hover */
border-radius: 8px;
border: 1px solid transparent;
transition: background 0.2s cubic-bezier(0.64, 0.09, 0.08, 1);
color: hsl(var(--_hue), 40%, 50%);
fill: currentColor;
background: transparent;
}
.ML__virtual-keyboard-toggle:hover,
.ML__menu-toggle:hover {
background: hsla(0, 0%, 70%, 0.3);
color: #333;
fill: currentColor;
}
.ML__virtual-keyboard-toggle > span,
.ML__menu-toggle > span {
display: flex;
align-self: center;
align-items: center;
}
@media (pointer: coarse) {
.ML__virtual-keyboard-toggle,
.ML__menu-toggle {
min-width: 60px;
min-height: 60px;
}
}
/* The invisible element used to capture keyboard events. We're just trying
really hard to make sure it doesn't show. */
.ML__keyboard-sink {
display: inline-block;
resize: none;
outline: none;
border: none;
/* Need these for Microsoft Edge */
position: fixed;
clip: rect(0 0 0 0);
/* Need this to prevent iOS Safari from auto-zooming */
font-size: 1em;
font-family: KaTeX_Main;
line-height: 0.5;
/* On Chromium, if this is 0, no keyboard events are received */
}
[part='placeholder'] {
color: var(--neutral-400);
}
.ML__composition {
background: var(--_composition-background-color);
color: var(--_composition-text-color);
text-decoration: underline var(--_composition-underline-color);
}
.ML__caret::after {
content: '';
visibility: hidden;
width: 0;
display: inline-block;
height: 0.76em;
--_caret-width: clamp(2px, 0.08em, 10px);
border: none;
border-radius: calc(var(--_caret-width) / 2);
border-right: var(--_caret-width) solid var(--_caret-color);
margin-right: calc(-1 * var(--_caret-width));
position: relative;
left: -0.045em;
bottom: -0.05em;
animation: ML__caret-blink 1.05s step-end forwards infinite;
}
.ML__text-caret::after {
content: '';
visibility: hidden;
width: 0;
display: inline-block;
height: 0.76em;
--_caret-width: clamp(2px, 0.08em, 10px);
border: none;
border-radius: calc(var(--_caret-width) / 2);
border-right: var(--_caret-width) solid var(--_caret-color);
margin-right: calc(-1 * var(--_caret-width));
position: relative;
left: -0.045em;
bottom: -0.05em;
animation: ML__caret-blink 1.05s step-end forwards infinite;
}
.ML__latex-caret::after {
content: '';
visibility: hidden;
--_caret-width: clamp(2px, 0.08em, 10px);
border: none;
border-radius: calc(var(--_caret-width) / 2);
border-right: var(--_caret-width) solid var(--_latex-color);
margin-right: calc(-1 * var(--_caret-width));
position: relative;
left: -0.019em;
animation: ML__caret-blink 1.05s step-end forwards infinite;
}
.ML__focused .ML__latex-caret::after,
.ML__focused .ML__text-caret::after,
.ML__focused .ML__caret::after {
visibility: visible;
}
.ML__focused .ML__text {
background: var(--_text-highlight-background-color);
}
/* When using smartFence, the anticipated closing fence is displayed
with this style */
.ML__smart-fence__close {
opacity: var(--_smart-fence-opacity);
color: var(--_smart-fence-color);
}
.ML__selected,
.ML__focused .ML__selected .ML__contains-caret,
.ML__focused .ML__selected .ML__smart-fence__close,
.ML__focused .ML__selected .ML__placeholder {
color: var(--_selection-color);
opacity: 1;
}
.ML__selection {
box-sizing: border-box;
background: transparent;
}
:host(:focus) .ML__selection {
background: var(--_selection-background-color) !important;
}
:host {
pointer-events: none;
}
.ML__contains-caret.ML__close,
.ML__contains-caret.ML__open,
.ML__contains-caret > .ML__close,
.ML__contains-caret > .ML__open,
.ML__contains-caret .ML__sqrt-sign,
.ML__contains-caret .ML__sqrt-line {
color: var(--_caret-color);
}
.ML__contains-highlight {
box-sizing: border-box;
background: transparent;
}
.ML__focused .ML__contains-highlight {
background: var(--_contains-highlight-background-color);
}
.ML__raw-latex {
font-family: 'Berkeley Mono', 'IBM Plex Mono', 'Source Code Pro', Consolas, 'Roboto Mono', Menlo, 'Bitstream Vera Sans Mono', 'DejaVu Sans Mono', Monaco, Courier, monospace;
font-weight: 400;
font-size: 0.8em;
letter-spacing: -0.05em;
color: var(--_latex-color);
}
.ML__suggestion {
color: var(--neutral-500);
}
.ML__virtual-keyboard-toggle.is-visible.is-pressed:hover {
background: hsl(var(--_hue), 25%, 35%);
color: #fafafa;
fill: currentColor;
}
.ML__virtual-keyboard-toggle.is-pressed,
.ML__virtual-keyboard-toggle.is-active:hover,
.ML__virtual-keyboard-toggle.is-active {
background: hsl(var(--_hue), 25%, 35%);
color: #fafafa;
fill: currentColor;
}
/* Add an attribute 'data-tooltip' to automatically show a
tooltip over a element on hover.
*/
[data-tooltip] {
position: relative;
}
[data-tooltip]::after {
content: attr(data-tooltip);
position: absolute;
display: block;
z-index: 2;
pointer-events: none;
right: auto;
top: calc(-100% - 4px);
width: max-content;
max-width: 200px;
padding: 8px 8px;
border-radius: 4px;
background: #616161;
color: #fff;
box-shadow: 0 2px 2px 0 rgba(0, 0, 0, 0.14), 0 1px 5px 0 rgba(0, 0, 0, 0.12), 0 3px 1px -2px rgba(0, 0, 0, 0.2);
text-align: center;
font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
font-style: normal;
font-weight: 400;
font-size: 13px;
/* Phone */
opacity: 0;
transform: scale(0.5);
}
@media only screen and (max-width: 767px) {
[data-tooltip]::after {
padding: 8px 16px;
font-size: 16px;
}
}
menu [data-tooltip]::after {
left: 100%;
top: 0%;
}
menu .ML__base {
cursor: default;
}
/** Don't display if we're tracking, i.e. have the pointer down */
.tracking [data-tooltip]:hover::after {
/* Use visibility, not display. Display will remove the after from the DOM, and the override below will not work */
visibility: hidden;
}
/** But do display if tracking and inside a menu */
.tracking menu li[data-tooltip]:hover::after,
[data-tooltip]:hover::after {
visibility: visible;
opacity: 1;
transform: scale(1);
transition-property: opacity, scale;
transition-duration: 0.15s;
transition-delay: 1s;
transition-timing-function: cubic-bezier(0.4, 0, 1, 1);
}
.ML__prompt {
border-radius: 2px;
}
.ML__editablePromptBox {
outline: 1px solid #acacac;
border-radius: 2px;
z-index: -1;
}
.ML__focusedPromptBox {
outline: highlight auto 1px;
}
.ML__lockedPromptBox {
background-color: rgba(142, 142, 141, 0.4);
z-index: -1;
}
.ML__correctPromptBox {
outline: 1px solid var(--_correct-color);
box-shadow: 0 0 5px var(--_correct-color);
}
.ML__incorrectPromptBox {
outline: 1px solid var(--_incorrect-color);
box-shadow: 0 0 5px var(--_incorrect-color);
}
.variant-submenu {
display: flex;
flex-direction: column;
padding: 8px;
}
.variant-submenu [part='menu-item'].ML__xl {
font-size: 2rem;
text-align: center;
margin: 0;
}
.ML__center-menu .label {
text-align: center;
}
.insert-matrix-submenu {
/* Grid doesn't work on Safari */
--_menu-item-size: 25px;
width: calc(5 * var(--_menu-item-size));
display: flex;
flex-wrap: wrap;
padding: 8px;
align-content: center;
justify-content: center;
}
.insert-matrix-submenu [part='menu-item'] {
width: var(--_menu-item-size);
height: var(--_menu-item-size);
font-size: 21px;
border: none;
border-radius: 0;
line-height: 21px;
text-align: center;
padding: 0;
margin: 0;
}
.border-submenu [part='menu-item'] {
font-size: 2rem;
line-height: 1.2;
text-align: center;
}
.swatches-submenu {
--_swatch-size: 2rem;
--_columns: 4;
display: flex;
flex-flow: wrap;
padding: 8px;
max-width: calc(var(--_columns) * (var(--_swatch-size) + 18px) + 16px);
box-sizing: border-box;
}
.menu-swatch {
display: flex;
align-items: center;
justify-content: center;
box-sizing: border-box;
width: fit-content;
height: fit-content;
margin: 2px;
padding: 0;
background: var(--neutral-200);
}
.menu-swatch > .label {
padding: 0;
margin: 0;
line-height: 0;
}
.menu-swatch > .label > span {
display: inline-block;
margin: 6px;
min-width: var(--_swatch-size);
min-height: var(--_swatch-size);
border-radius: 50%;
}
.menu-swatch.active {
background: var(--neutral-100);
scale: 1.4;
}
.menu-swatch.active > .label > span {
border-radius: 2px;
}
.menu-swatch .ui-checkmark,
.menu-swatch .ui-mixedmark {
position: absolute;
margin: 0;
padding: 0;
color: white;
}
.menu-swatch.dark-contrast .ui-checkmark,
.menu-swatch.dark-contrast .ui-mixedmark {
color: #000;
}
`;
var W0 = `.ML__container {
min-height: auto !important;
--_hue: var(--hue, 212);
--_placeholder-color: var(--placeholder-color, hsl(var(--_hue), 40%, 49%));
--_placeholder-opacity: var(--placeholder-opacity, 0.4);
--_text-font-family: var(--text-font-family, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif);
}
.ML__sr-only {
position: absolute;
width: 1px;
height: 1px;
margin: -1px;
padding: 0;
overflow: hidden;
clip: rect(0, 0, 0, 0);
clip-path: inset(50%);
white-space: nowrap;
border: 0;
}
.ML__is-inline {
display: inline-block;
}
.ML__base {
visibility: inherit;
display: inline-block;
position: relative;
cursor: text;
padding: 0;
margin: 0;
box-sizing: content-box;
border: 0;
outline: 0;
vertical-align: baseline;
font-weight: inherit;
font-family: inherit;
font-style: inherit;
text-decoration: none;
width: min-content;
}
.ML__strut,
.ML__strut--bottom {
display: inline-block;
min-height: 0.5em;
}
.ML__small-delim {
font-family: KaTeX_Main;
}
/* Text mode */
.ML__text {
font-family: var(--_text-font-family);
white-space: pre;
}
/* Use cmr for 'math upright' */
.ML__cmr {
font-family: KaTeX_Main;
font-style: normal;
}
.ML__mathit {
font-family: KaTeX_Math;
/* The KaTeX_Math font is italic by default, so the font-style below is only
useful when a fallback font is used
*/
font-style: italic;
}
.ML__mathbf {
font-family: KaTeX_Main;
font-weight: bold;
}
/* Lowercase greek symbols should stick to math font when \\mathbf is applied
to match TeX idiosyncratic behavior */
.lcGreek.ML__mathbf {
font-family: KaTeX_Math;
font-weight: normal;
}
.ML__mathbfit {
font-family: KaTeX_Math;
font-weight: bold;
font-style: italic;
}
.ML__ams {
font-family: KaTeX_AMS;
}
/* Blackboard */
.ML__bb {
font-family: KaTeX_AMS;
}
.ML__cal {
font-family: KaTeX_Caligraphic;
}
.ML__frak {
font-family: KaTeX_Fraktur;
}
.ML__tt {
font-family: KaTeX_Typewriter;
}
.ML__script {
font-family: KaTeX_Script;
}
.ML__sans {
font-family: KaTeX_SansSerif;
}
.ML__series_ul {
font-weight: 100;
}
.ML__series_el {
font-weight: 100;
}
.ML__series_l {
font-weight: 200;
}
.ML__series_sl {
font-weight: 300;
}
.ML__series_sb {
font-weight: 500;
}
.ML__bold {
font-weight: 700;
}
.ML__series_eb {
font-weight: 800;
}
.ML__series_ub {
font-weight: 900;
}
.ML__series_uc {
font-stretch: ultra-condensed;
}
.ML__series_ec {
font-stretch: extra-condensed;
}
.ML__series_c {
font-stretch: condensed;
}
.ML__series_sc {
font-stretch: semi-condensed;
}
.ML__series_sx {
font-stretch: semi-expanded;
}
.ML__series_x {
font-stretch: expanded;
}
.ML__series_ex {
font-stretch: extra-expanded;
}
.ML__series_ux {
font-stretch: ultra-expanded;
}
.ML__it {
font-style: italic;
}
.ML__shape_ol {
-webkit-text-stroke: 1px black;
text-stroke: 1px black;
color: transparent;
}
.ML__shape_sc {
font-variant: small-caps;
}
.ML__shape_sl {
font-style: oblique;
}
/* First level emphasis */
.ML__emph {
color: #bc2612;
}
/* Second level emphasis */
.ML__emph .ML__emph {
color: #0c7f99;
}
.ML__highlight {
color: #007cb2;
background: #edd1b0;
}
.ML__center {
text-align: center;
}
.ML__left {
text-align: left;
}
.ML__right {
text-align: right;
}
.ML__label_padding {
padding: 0 0.5em;
}
.ML__frac-line {
width: 100%;
min-height: 1px;
}
.ML__frac-line:after {
content: '';
display: block;
margin-top: max(-1px, -0.04em);
min-height: max(1px, 0.04em);
/* Ensure the line is visible when printing even if "turn off background images" is on*/
-webkit-print-color-adjust: exact;
print-color-adjust: exact;
/* There's a bug since Chrome 62 where
sub-pixel border lines don't draw at some zoom
levels (110%, 90%).
Setting the min-height used to work around it, but that workaround
broke in Chrome 84 or so.
Setting the background (and the min-height) seems to work for now.
*/
background: currentColor;
box-sizing: content-box;
/* Vuetify sets the box-sizing to inherit
causes the fraction line to not draw at all sizes (see #26) */
/* On some versions of Firefox on Windows, the line fails to
draw at some zoom levels, but setting the transform triggers
the hardware accelerated path, which works */
transform: translate(0, 0);
}
.ML__sqrt {
display: inline-block;
}
.ML__sqrt-sign {
display: inline-block;
position: relative;
}
.ML__sqrt-line {
display: inline-block;
height: max(1px, 0.04em);
width: 100%;
}
.ML__sqrt-line:before {
content: '';
display: block;
margin-top: min(-1px, -0.04em);
min-height: max(1px, 0.04em);
/* Ensure the line is visible when printing even if "turn off background images" is on*/
-webkit-print-color-adjust: exact;
print-color-adjust: exact;
background: currentColor;
/* On some versions of Firefox on Windows, the line fails to
draw at some zoom levels, but setting the transform triggers
the hardware accelerated path, which works */
transform: translate(0, 0);
}
.ML__sqrt-line:after {
border-bottom-width: 1px;
content: ' ';
display: block;
margin-top: -0.1em;
}
.ML__sqrt-index {
margin-left: 0.27777778em;
margin-right: -0.55555556em;
}
.ML__delim-size1 {
font-family: KaTeX_Size1;
}
.ML__delim-size2 {
font-family: KaTeX_Size2;
}
.ML__delim-size3 {
font-family: KaTeX_Size3;
}
.ML__delim-size4 {
font-family: KaTeX_Size4;
}
.ML__delim-mult .delim-size1 > span {
font-family: KaTeX_Size1;
}
.ML__delim-mult .delim-size4 > span {
font-family: KaTeX_Size4;
}
.ML__accent-body > span {
font-family: KaTeX_Main;
width: 0;
}
.ML__accent-vec {
position: relative;
left: 0.24em;
}
/** The markup for a LaTeX formula, either in an editable mathfield or
in a static display.
*/
.ML__latex {
display: inline-block;
direction: ltr;
text-align: left;
text-indent: 0;
text-rendering: auto;
font-family: KaTeX_Main, 'Times New Roman', serif;
font-style: normal;
font-size-adjust: none;
font-stretch: normal;
font-variant-caps: normal;
letter-spacing: normal;
line-height: 1.2;
word-wrap: normal;
word-spacing: normal;
white-space: nowrap;
text-shadow: none;
-webkit-user-select: none;
user-select: none;
width: min-content;
}
.ML__latex .style-wrap {
position: relative;
}
.ML__latex .ML__mfrac {
display: inline-block;
}
.ML__latex .ML__left-right {
display: inline-block;
}
.ML__latex .ML__vlist-t {
display: inline-table;
table-layout: fixed;
border-collapse: collapse;
}
.ML__latex .ML__vlist-r {
display: table-row;
}
.ML__latex .ML__vlist {
display: table-cell;
vertical-align: bottom;
position: relative;
}
.ML__latex .ML__vlist > span {
display: block;
height: 0;
position: relative;
}
.ML__latex .ML__vlist > span > span {
display: inline-block;
}
.ML__latex .ML__vlist > span > .ML__pstrut {
overflow: hidden;
width: 0;
}
.ML__latex .ML__vlist-t2 {
margin-right: -2px;
}
.ML__latex .ML__vlist-s {
display: table-cell;
vertical-align: bottom;
font-size: 1px;
width: 2px;
min-width: 2px;
}
.ML__latex .ML__msubsup {
text-align: left;
}
.ML__latex .ML__negativethinspace {
display: inline-block;
margin-left: -0.16667em;
height: 0.71em;
}
.ML__latex .ML__thinspace {
display: inline-block;
width: 0.16667em;
height: 0.71em;
}
.ML__latex .ML__mediumspace {
display: inline-block;
width: 0.22222em;
height: 0.71em;
}
.ML__latex .ML__thickspace {
display: inline-block;
width: 0.27778em;
height: 0.71em;
}
.ML__latex .ML__enspace {
display: inline-block;
width: 0.5em;
height: 0.71em;
}
.ML__latex .ML__quad {
display: inline-block;
width: 1em;
height: 0.71em;
}
.ML__latex .ML__qquad {
display: inline-block;
width: 2em;
height: 0.71em;
}
.ML__latex .ML__llap,
.ML__latex .ML__rlap {
width: 0;
position: relative;
display: inline-block;
}
.ML__latex .ML__llap > .ML__inner,
.ML__latex .ML__rlap > .ML__inner {
position: absolute;
}
.ML__latex .ML__llap > .ML__fix,
.ML__latex .ML__rlap > .ML__fix {
display: inline-block;
}
.ML__latex .ML__llap > .ML__inner {
right: 0;
}
.ML__latex .ML__rlap > .ML__inner {
left: 0;
}
.ML__latex .ML__rule {
display: inline-block;
border: solid 0;
position: relative;
box-sizing: border-box;
}
.ML__latex .overline .overline-line,
.ML__latex .underline .underline-line {
width: 100%;
}
.ML__latex .overline .overline-line:before,
.ML__latex .underline .underline-line:before {
content: '';
border-bottom-style: solid;
border-bottom-width: max(1px, 0.04em);
-webkit-print-color-adjust: exact;
print-color-adjust: exact;
display: block;
}
.ML__latex .overline .overline-line:after,
.ML__latex .underline .underline-line:after {
border-bottom-style: solid;
border-bottom-width: max(1px, 0.04em);
-webkit-print-color-adjust: exact;
print-color-adjust: exact;
content: '';
display: block;
margin-top: -1px;
}
.ML__latex .ML__stretchy {
display: block;
position: absolute;
width: 100%;
left: 0;
overflow: hidden;
}
.ML__latex .ML__stretchy:before,
.ML__latex .ML__stretchy:after {
content: '';
}
.ML__latex .ML__stretchy svg {
display: block;
position: absolute;
width: 100%;
height: inherit;
fill: currentColor;
stroke: currentColor;
fill-rule: nonzero;
fill-opacity: 1;
stroke-width: 1;
stroke-linecap: butt;
stroke-linejoin: miter;
stroke-miterlimit: 4;
stroke-dasharray: none;
stroke-dashoffset: 0;
stroke-opacity: 1;
}
.ML__latex .slice-1-of-2 {
display: inline-flex;
position: absolute;
left: 0;
width: 50.2%;
overflow: hidden;
}
.ML__latex .slice-2-of-2 {
display: inline-flex;
position: absolute;
right: 0;
width: 50.2%;
overflow: hidden;
}
.ML__latex .slice-1-of-3 {
display: inline-flex;
position: absolute;
left: 0;
width: 25.1%;
overflow: hidden;
}
.ML__latex .slice-2-of-3 {
display: inline-flex;
position: absolute;
left: 25%;
width: 50%;
overflow: hidden;
}
.ML__latex .slice-3-of-3 {
display: inline-flex;
position: absolute;
right: 0;
width: 25.1%;
overflow: hidden;
}
.ML__latex .slice-1-of-1 {
display: inline-flex;
position: absolute;
width: 100%;
left: 0;
overflow: hidden;
}
.ML__latex .ML__nulldelimiter {
display: inline-block;
}
.ML__latex .ML__op-group {
display: inline-block;
}
.ML__latex .ML__op-symbol {
position: relative;
}
.ML__latex .ML__op-symbol.ML__small-op {
font-family: KaTeX_Size1;
}
.ML__latex .ML__op-symbol.ML__large-op {
font-family: KaTeX_Size2;
}
.ML__latex .ML__mtable .ML__vertical-separator {
display: inline-block;
min-width: 1px;
box-sizing: border-box;
}
.ML__latex .ML__mtable .ML__arraycolsep {
display: inline-block;
}
.ML__latex .ML__mtable .col-align-m > .ML__vlist-t {
text-align: center;
}
.ML__latex .ML__mtable .col-align-c > .ML__vlist-t {
text-align: center;
}
.ML__latex .ML__mtable .col-align-l > .ML__vlist-t {
text-align: left;
}
.ML__latex .ML__mtable .col-align-r > .ML__vlist-t {
text-align: right;
}
[data-href] {
cursor: pointer;
}
.ML__error {
display: inline-block;
background-image: radial-gradient(ellipse at center, hsl(341, 100%, 40%), rgba(0, 0, 0, 0) 70%);
background-color: hsla(341, 100%, 40%, 0.1);
background-repeat: repeat-x;
background-size: 3px 3px;
padding-bottom: 3px;
background-position: 0 100%;
}
.ML__error > .ML__error {
background: transparent;
padding: 0;
}
.ML__placeholder {
color: var(--_placeholder-color);
opacity: var(--_placeholder-opacity);
padding-left: 0.4ex;
padding-right: 0.4ex;
font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
}
.ML__notation {
position: absolute;
box-sizing: border-box;
line-height: 0;
}
/* This class is used to implement the \`\\mathtip\` and \`\\texttip\` commands
For UI elements, see \`[data-ML__tooltip]\`
*/
.ML__tooltip-container {
position: relative;
transform: scale(0);
}
.ML__tooltip-container .ML__tooltip-content {
position: fixed;
display: inline-table;
visibility: hidden;
z-index: 2;
width: max-content;
max-width: 400px;
padding: 12px 12px;
border: var(--tooltip-border);
border-radius: var(--tooltip-border-radius);
background: var(--tooltip-background-color);
--_selection-color: var(--tooltip-color);
color: var(--tooltip-color);
box-shadow: var(--tooltip-box-shadow);
opacity: 0;
transition: opacity 0.15s cubic-bezier(0.4, 0, 1, 1);
}
.ML__tooltip-container .ML__tooltip-content .ML__text {
white-space: normal;
}
.ML__tooltip-container .ML__tooltip-content .ML__base {
display: contents;
}
.ML__tooltip-container:hover .ML__tooltip-content {
visibility: visible;
opacity: 1;
font-size: 0.75em;
transform: scale(1) translate(0, 3em);
}
`;
var U0 = `#mathlive-environment-popover.is-visible {
visibility: visible;
}
#mathlive-environment-popover {
--_environment-panel-height: var(--environment-panel-height, 70px);
--_accent-color: var(--accent-color, #aaa);
--_background: var(--environment-panel-background, #fff);
--_button-background: var(--environment-panel-button-background, white);
--_button-background-hover: var(--environment-panel-button-background-hover, #f5f5f7);
--_button-background-active: var(--environment-panel-button-background-active, #f5f5f7);
--_button-text: var(--environment-panel-button-text, #e3e4e8);
position: absolute;
width: calc(var(--_environment-panel-height) * 2);
height: var(--_environment-panel-height);
border-radius: 4px;
border: 1.5px solid var(--_accent-color);
background-color: var(--_background);
box-shadow: 0 0 30px 0 var(--environment-shadow, rgba(0, 0, 0, 0.4));
pointer-events: all;
visibility: hidden;
}
#mathlive-environment-popover .MLEP__array-buttons {
height: calc(var(--_environment-panel-height) * 5/4);
width: calc(var(--_environment-panel-height) * 5/4);
margin-left: calc(0px - var(--_environment-panel-height) * 0.16);
margin-top: calc(0px - var(--_environment-panel-height) * 0.19);
}
#mathlive-environment-popover .MLEP__array-buttons .font {
fill: white;
}
#mathlive-environment-popover .MLEP__array-buttons circle {
fill: #7f7f7f;
transition: fill 300ms;
}
#mathlive-environment-popover .MLEP__array-buttons .MLEP__array-insert-background {
fill-opacity: 1;
fill: var(--_background);
stroke: var(--_accent-color);
stroke-width: 3px;
}
#mathlive-environment-popover .MLEP__array-buttons line {
stroke: var(--_accent-color);
stroke-opacity: 0;
stroke-width: 40;
pointer-events: none;
transition: stroke-opacity 300ms;
stroke-linecap: round;
}
#mathlive-environment-popover .MLEP__array-buttons g[data-command]:hover circle {
fill: var(--_accent-color);
}
#mathlive-environment-popover .MLEP__array-buttons g[data-command]:hover line {
stroke-opacity: 1;
}
#mathlive-environment-popover .MLEP__environment-delimiter-controls {
height: 100%;
width: 50%;
}
#mathlive-environment-popover .MLEP__environment-delimiter-controls .MLEP__array-delimiter-options {
width: var(--_environment-panel-height);
height: var(--_environment-panel-height);
display: flex;
flex-wrap: wrap;
flex-direction: row;
justify-content: space-around;
}
#mathlive-environment-popover .MLEP__environment-delimiter-controls .MLEP__array-delimiter-options svg {
pointer-events: all;
margin-top: 2px;
width: calc(var(--_environment-panel-height) / 3 * 28 / 24);
height: calc(var(--_environment-panel-height) / 3 - 2px);
border-radius: calc(var(--_environment-panel-height) / 25);
background-color: var(--_button-background);
}
#mathlive-environment-popover .MLEP__environment-delimiter-controls .MLEP__array-delimiter-options svg:hover {
background-color: var(--_button-background-hover);
}
#mathlive-environment-popover .MLEP__environment-delimiter-controls .MLEP__array-delimiter-options svg path,
#mathlive-environment-popover .MLEP__environment-delimiter-controls .MLEP__array-delimiter-options svg line {
stroke: var(--_button-text);
stroke-width: 2;
stroke-linecap: round;
}
#mathlive-environment-popover .MLEP__environment-delimiter-controls .MLEP__array-delimiter-options svg rect,
#mathlive-environment-popover .MLEP__environment-delimiter-controls .MLEP__array-delimiter-options svg path {
fill-opacity: 0;
}
#mathlive-environment-popover .MLEP__environment-delimiter-controls .MLEP__array-delimiter-options svg.active {
pointer-events: none;
background-color: var(--_button-background-active);
}
#mathlive-environment-popover .MLEP__environment-delimiter-controls .MLEP__array-delimiter-options svg.active path,
#mathlive-environment-popover .MLEP__environment-delimiter-controls .MLEP__array-delimiter-options svg.active line {
stroke: var(--_accent-color);
}
#mathlive-environment-popover .MLEP__environment-delimiter-controls .MLEP__array-delimiter-options svg.active circle {
fill: var(--_accent-color);
}
`;
var J0 = `/* The element that display info while in latex mode */
#mathlive-suggestion-popover {
background-color: rgba(97, 97, 97);
color: #fff;
text-align: center;
border-radius: 8px;
position: fixed;
z-index: 1;
display: none;
flex-direction: column;
justify-content: center;
box-shadow: 0 14px 28px rgba(0, 0, 0, 0.25), 0 10px 10px rgba(0, 0, 0, 0.22);
}
#mathlive-suggestion-popover.top-tip::after {
content: '';
position: absolute;
top: -15px;
left: calc(50% - 15px);
width: 0;
height: 0;
border-left: 15px solid transparent;
border-right: 15px solid transparent;
border-bottom: 15px solid rgba(97, 97, 97);
font-size: 1rem;
}
#mathlive-suggestion-popover.bottom-tip::after {
content: '';
position: absolute;
bottom: -15px;
left: calc(50% - 15px);
width: 0;
height: 0;
border-left: 15px solid transparent;
border-right: 15px solid transparent;
border-top: 15px solid rgba(97, 97, 97);
font-size: 1rem;
}
#mathlive-suggestion-popover.is-animated {
transition: all 0.2s cubic-bezier(0.64, 0.09, 0.08, 1);
animation: ML__fade-in cubic-bezier(0, 0, 0.2, 1) 0.15s;
}
#mathlive-suggestion-popover.is-visible {
display: flex;
}
@keyframes ML__fade-in {
from {
opacity: 0;
}
to {
opacity: 1;
}
}
/* The wrapper class for the entire content of the popover panel */
#mathlive-suggestion-popover ul {
display: flex;
flex-flow: column;
list-style: none;
margin: 0;
padding: 0;
align-items: flex-start;
max-height: 400px;
overflow-y: auto;
}
#mathlive-suggestion-popover li {
display: flex;
flex-direction: row;
justify-content: space-between;
margin: 8px;
padding: 8px;
width: calc(100% - 16px - 16px);
column-gap: 1em;
border-radius: 8px;
cursor: pointer;
/* Since the content can be clicked on, provide feedback on hover */
}
#mathlive-suggestion-popover li a {
color: #5ea6fd;
padding-top: 0.3em;
margin-top: 0.4em;
display: block;
}
#mathlive-suggestion-popover li a:hover {
color: #5ea6fd;
text-decoration: underline;
}
#mathlive-suggestion-popover li:hover,
#mathlive-suggestion-popover li.is-pressed,
#mathlive-suggestion-popover li.is-active {
background: rgba(255, 255, 255, 0.1);
}
/* The command inside a popover (inside a #mathlive-suggestion-popover) */
.ML__popover__command {
font-size: 1.6rem;
font-family: KaTeX_Main;
}
.ML__popover__current {
background: #5ea6fd;
color: #fff;
}
.ML__popover__latex {
font-family: 'IBM Plex Mono', 'Source Code Pro', Consolas, 'Roboto Mono', Menlo, 'Bitstream Vera Sans Mono', 'DejaVu Sans Mono', Monaco, Courier, monospace;
align-self: center;
}
/* The keyboard shortcuts for a symbol as displayed in the popover */
.ML__popover__keybinding {
font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
font-size: 0.8em;
opacity: 0.7;
}
/* Style for the character that joins the modifiers of a keyboard shortcut
(usually a "+" sign)*/
.ML__shortcut-join {
opacity: 0.5;
}
`;
var G0 = `/* The element that displays the keys as the user type them */
#mathlive-keystroke-caption-panel {
visibility: hidden;
/*min-width: 160px;*/
/*background-color: rgba(97, 97, 200, .95);*/
background: var(--secondary, hsl(var(--_hue), 19%, 26%));
border-color: var(--secondary-border, hsl(0, 0%, 91%));
box-shadow: 0 3px 6px rgba(0, 0, 0, 0.16), 0 3px 6px rgba(0, 0, 0, 0.23);
text-align: center;
border-radius: 6px;
padding: 16px;
position: absolute;
z-index: 1;
display: flex;
flex-direction: row-reverse;
justify-content: center;
--keystroke: white;
--on-keystroke: #555;
--keystroke-border: #f7f7f7;
}
@media (prefers-color-scheme: dark) {
body:not([theme='light']) #mathlive-keystroke-caption-panel {
--keystroke: hsl(var(--_hue), 50%, 30%);
--on-keystroke: hsl(0, 0%, 98%);
--keystroke-border: hsl(var(--_hue), 50%, 25%);
}
}
body[theme='dark'] #mathlive-keystroke-caption-panel {
--keystroke: hsl(var(--_hue), 50%, 30%);
--on-keystroke: hsl(0, 0%, 98%);
--keystroke-border: hsl(var(--_hue), 50%, 25%);
}
#mathlive-keystroke-caption-panel > span {
min-width: 14px;
/*height: 8px;*/
margin: 0 8px 0 0;
padding: 4px;
background-color: var(--keystroke);
color: var(--on-keystroke);
fill: currentColor;
font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
font-size: 1em;
border-radius: 6px;
border: 2px solid var(--keystroke-border);
/*box-shadow: 0 7px 14px rgba(0,0,0,0.25), 0 5px 5px rgba(0,0,0,0.22);*/
}
`;
var j0 = `.ML__keyboard {
--_keyboard-height: 0;
--_keyboard-zindex: var(--keyboard-zindex, 105);
--_accent-color: var(--keyboard-accent-color, #0c75d8);
--_background: var(--keyboard-background, #cacfd7);
--_border: var(--keyboard-border, #ddd);
--_padding-horizontal: var(--keyboard-padding-horizontal, 0px);
--_padding-top: var(--keyboard-padding-top, 5px);
--_padding-bottom: var(--keyboard-padding-bottom, 0px);
--_row-padding-left: var(--keyboard-row-padding-left, 0px);
--_row-padding-right: var(--keyboard-row-padding-right, 0px);
--_toolbar-text: var(--keyboard-toolbar-text, #2c2e2f);
--_toolbar-text-active: var(--keyboard-toolbar-text-active, var(--_accent-color));
--_toolbar-background: var(--keyboard-toolbar-background, transparent);
--_toolbar-background-hover: var(--keyboard-toolbar-background-hover, #eee);
--_toolbar-background-selected: var(--keyboard-toolbar-background-selected, transparent);
--_toolbar-font-size: var(--keyboard-toolbar-font-size, '135%');
--_horizontal-rule: var(--keyboard-horizontal-rule, 1px solid #fff);
--_keycap-background: var(--keycap-background, #f0f0f0);
--_keycap-background-hover: var(--keycap-background-hover, #f5f5f7);
--_keycap-background-active: var(--keycap-background-active, var(--_accent-color));
--_keycap-background-pressed: var(--keycap-background-pressed, var(--_accent-color));
--_keycap-border: var(--keycap-border, #e5e6e9);
--_keycap-border-bottom: var(--keycap-border-bottom, #8d8f92);
--_keycap-text: var(--keycap-text, #000);
--_keycap-text-active: var(--keycap-text-active, #fff);
--_keycap-text-hover: var(--keycap-text-hover, var(--_keycap-text));
--_keycap-text-pressed: var(--keycap-text-pressed, #fff);
--_keycap-shift-text: var(--keycap-shift-text, var(--_accent-color));
--_keycap-primary-background: var(--keycap-primary-background, var(--_accent-color));
--_keycap-primary-text: var(--keycap-primary-text, #ddd);
--_keycap-primary-background-hover: var(--keycap-primary-background-hover, #0d80f2);
--_keycap-secondary-background: var(--keycap-secondary-background, #a0a9b8);
--_keycap-secondary-background-hover: var(--keycap-secondary-background-hover, #7d8795);
--_keycap-secondary-text: var(--keycap-secondary-text, #060707);
--_keycap-secondary-border: var(--keycap-secondary-border, #c5c9d0);
--_keycap-secondary-border-bottom: var(--keycap-secondary-border-bottom, #989da6);
--_keycap-height: var(--keycap-height, 60px);
/* Keycap width (incl. margin) */
--_keycap-max-width: var(--keycap-max-width, 100px);
--_keycap-gap: var(--keycap-gap, 8px);
--_keycap-font-size: var(--keycap-font-size, clamp(16px, 4cqw, 24px));
--_keycap-small-font-size: var(--keycap-small-font-size, calc(var(--keycap-font-size) * 0.8));
--_keycap-extra-small-font-size: var(--keycap-extra-small-font-size, calc(var(--keycap-font-size) / 1.42));
--_variant-panel-background: var(--variant-panel-background, f0f0f0);
--_variant-keycap-text: var(--variant-keycap-text, var(--_keycap-text));
--_variant-keycap-text-active: var(--variant-keycap-text-active, var(--_keycap-text-active));
--_variant-keycap-background-active: var(--variant-keycap-background-active, var(--_accent-color));
--_variant-keycap-length: var(--variant-keycap-length, 70px);
--_variant-keycap-font-size: var(--variant-keycap-font-size, 30px);
--_variant-keycap-aside-font-size: var(--variant-keycap-aside-font-size, 12px);
--_keycap-shift-font-size: var(--keycap-shift-font-size, 16px);
--_keycap-shift-color: var(--keycap-shift-color, var(--_accent-color));
--_box-placeholder-color: var(--box-placeholder-color, var(--_accent-color));
--_box-placeholder-pressed-color: var(--box-placeholder-pressed-color, var(--keycap-text-pressed));
}
.is-math-mode .MLK__rows .if-text-mode,
.is-text-mode .MLK__rows .if-math-mode {
display: none;
}
.if-can-undo,
.if-can-redo,
.if-can-copy,
.if-can-cut,
.if-can-paste {
opacity: 0.4;
pointer-events: none;
}
.can-undo .if-can-undo,
.can-redo .if-can-redo,
.can-copy .if-can-copy,
.can-cut .if-can-cut,
.can-paste .if-can-paste {
opacity: 1;
pointer-events: all;
}
body > .ML__keyboard {
position: fixed;
--_padding-bottom: calc(var(--keyboard-padding-bottom, 0px) + env(safe-area-inset-bottom, 0));
}
body > .ML__keyboard.is-visible > .MLK__backdrop {
box-shadow: 0 -5px 6px rgba(0, 0, 0, 0.08);
border-top: 1px solid var(--_border);
}
body > .ML__keyboard.backdrop-is-transparent.is-visible > .MLK__backdrop {
box-shadow: none;
border: none;
}
body > .ML__keyboard.is-visible.animate > .MLK__backdrop {
transition: 0.28s cubic-bezier(0, 0, 0.2, 1);
transition-property: transform, opacity;
transition-timing-function: cubic-bezier(0.4, 0, 1, 1);
}
.ML__keyboard {
position: relative;
overflow: hidden;
top: 0;
left: 0;
height: 100%;
width: 100%;
z-index: var(--_keyboard-zindex);
box-sizing: border-box;
outline: none;
border: none;
margin: 0;
padding: 0;
line-height: 1;
overflow-wrap: unset;
text-align: left;
vertical-align: baseline;
cursor: auto;
white-space: pre;
box-shadow: none;
opacity: 1;
transform: none;
pointer-events: none;
}
.ML__keyboard :where(div) {
box-sizing: border-box;
outline: none;
border: none;
margin: 0;
padding: 0;
line-height: 1;
overflow-wrap: unset;
text-align: left;
vertical-align: baseline;
cursor: auto;
white-space: pre;
box-shadow: none;
transform: none;
}
.MLK__backdrop {
position: absolute;
bottom: calc(-1 * var(--_keyboard-height));
width: 100%;
height: var(--_keyboard-height);
box-sizing: border-box;
padding-top: var(--_padding-top);
padding-bottom: var(--_padding-bottom);
padding-left: var(--_padding-horizontal);
padding-right: var(--_padding-horizontal);
opacity: 0;
visibility: hidden;
transform: translate(0, 0);
background: var(--_background);
}
.backdrop-is-transparent .MLK__backdrop {
background: transparent;
}
/* If a custom layout has a custom container/backdrop
(backdrop-is-transparent), make sure to let pointer event go through. */
.backdrop-is-transparent .MLK__plate {
background: transparent;
pointer-events: none;
}
/* If a custom layout has a custom container/backdrop, make sure to
allow pointer events on it. */
.backdrop-is-transparent .MLK__layer > div > div {
pointer-events: all;
}
.ML__keyboard.is-visible > .MLK__backdrop {
transform: translate(0, calc(-1 * var(--_keyboard-height)));
opacity: 1;
visibility: visible;
}
.caps-lock-indicator {
display: none;
width: 8px;
height: 8px;
background: #0cbc0c;
box-shadow: inset 0 0 4px 0 #13ca13, 0 0 4px 0 #a9ef48;
border-radius: 8px;
right: 8px;
top: 8px;
position: absolute;
}
.ML__keyboard.is-caps-lock .caps-lock-indicator {
display: block;
}
.ML__keyboard.is-caps-lock .shift {
background: var(--_keycap-background-active);
color: var(--_keycap-text-active);
}
.MLK__plate {
position: absolute;
top: var(--_padding-top);
left: var(--_padding-horizontal);
width: calc(100% - 2 * var(--_padding-horizontal));
margin: 0;
padding: 0;
box-sizing: border-box;
container-type: inline-size;
touch-action: none;
-webkit-user-select: none;
user-select: none;
pointer-events: all;
font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
font-size: 16px;
/* Size of toolbar labels */
font-weight: 400;
text-shadow: none;
}
.ML__box-placeholder {
color: var(--_box-placeholder-color);
}
.MLK__tex {
font-family: KaTeX_Main, KaTeX_Math, 'Cambria Math', 'Asana Math', OpenSymbol, Symbola, STIX, Times, serif !important;
}
.MLK__tex-math {
font-family: KaTeX_Math, KaTeX_Main, 'Cambria Math', 'Asana Math', OpenSymbol, Symbola, STIX, Times, serif !important;
font-style: italic;
}
.MLK__layer {
display: none;
outline: none;
}
.MLK__layer.is-visible {
display: flex;
flex-flow: column;
}
/* Keyboard layouts are made or rows of keys... */
.MLK__rows {
--_keycap-width: var(--keycap-width, min(var(--_keycap-max-width), 10cqw));
display: flex;
flex-flow: column;
align-items: center;
border-collapse: separate;
clear: both;
border: 0;
margin: 0;
margin-bottom: var(--_keycap-gap);
gap: var(--_keycap-gap);
/* If the styling include, e.g., some shadows, they will be
cut off by the overflow. In that case, set the padding to
compensate. */
padding-left: var(--_row-padding-left);
padding-right: var(--_row-padding-right);
overflow: visible;
touch-action: none;
}
.MLK__rows > .MLK__row {
display: flex;
flex-flow: row;
justify-content: center;
width: 100%;
gap: var(--_keycap-gap);
margin: 0;
padding: 0;
/* For the alignment of the text on some modifiers (e.g. shift) */
/* Extra spacing between two adjacent keys */
}
.MLK__rows > .MLK__row .tex {
font-family: KaTeX_Math, KaTeX_Main, 'Cambria Math', 'Asana Math', OpenSymbol, Symbola, STIX, Times, serif !important;
}
.MLK__rows > .MLK__row .tex-math {
font-family: KaTeX_Math, 'Cambria Math', 'Asana Math', OpenSymbol, Symbola, STIX, Times, serif !important;
}
.MLK__rows > .MLK__row .big-op {
font-size: calc(1.25 * var(--_keycap-font-size));
}
.MLK__rows > .MLK__row .small {
font-size: var(--_keycap-small-font-size);
}
.MLK__rows > .MLK__row .bottom {
justify-content: flex-end;
}
.MLK__rows > .MLK__row .left {
align-items: flex-start;
padding-left: 12px;
}
.MLK__rows > .MLK__row .right {
align-items: flex-end;
padding-right: 12px;
}
.MLK__rows > .MLK__row .w0 {
width: 0;
}
.MLK__rows > .MLK__row .w5 {
width: calc(0.5 * var(--_keycap-width) - var(--_keycap-gap));
}
.MLK__rows > .MLK__row .w15 {
width: calc(1.5 * var(--_keycap-width) - var(--_keycap-gap));
}
.MLK__rows > .MLK__row .w20 {
width: calc(2 * var(--_keycap-width) - var(--_keycap-gap));
}
.MLK__rows > .MLK__row .w40 {
width: calc(4 * var(--_keycap-width) - var(--_keycap-gap));
}
.MLK__rows > .MLK__row .w50 {
width: calc(5 * var(--_keycap-width) - var(--_keycap-gap));
}
.MLK__rows > .MLK__row .MLK__keycap.w50 {
font-size: 80%;
padding-top: 10px;
font-weight: 100;
}
.MLK__rows > .MLK__row .separator {
background: transparent;
border: none;
pointer-events: none;
}
.MLK__rows > .MLK__row .horizontal-rule {
height: 6px;
margin-top: 3px;
margin-bottom: 0;
width: 100%;
border-radius: 0;
border-top: var(--_horizontal-rule);
}
.MLK__rows > .MLK__row .ghost {
background: var(--_toolbar-background);
border: none;
color: var(--_toolbar-text);
}
.MLK__rows > .MLK__row .ghost:hover {
background: var(--_toolbar-background-hover);
}
.MLK__rows > .MLK__row .bigfnbutton {
font-size: var(--_keycap-extra-small-font-size);
}
.MLK__rows > .MLK__row .shift,
.MLK__rows > .MLK__row .action {
color: var(--_keycap-secondary-text);
background: var(--_keycap-secondary-background);
border-color: var(--_keycap-secondary-border);
border-bottom-color: var(--_keycap-secondary-border-bottom);
line-height: 0.8;
font-size: min(1rem, var(--_keycap-small-font-size));
font-weight: 600;
padding: 8px 12px 8px 12px;
}
.MLK__rows > .MLK__row .shift:hover,
.MLK__rows > .MLK__row .action:hover {
background: var(--_keycap-secondary-background-hover);
}
.MLK__rows > .MLK__row .action.primary {
background: var(--_keycap-primary-background);
color: var(--_keycap-primary-text);
}
.MLK__rows > .MLK__row .action.primary:hover {
background: var(--_keycap-primary-background-hover);
color: var(--_keycap-primary-text);
}
.MLK__rows > .MLK__row .shift.selected,
.MLK__rows > .MLK__row .action.selected {
color: var(--_toolbar-text-active);
}
.MLK__rows > .MLK__row .shift.selected.is-pressed,
.MLK__rows > .MLK__row .action.selected.is-pressed,
.MLK__rows > .MLK__row .shift.selected.is-active,
.MLK__rows > .MLK__row .action.selected.is-active {
color: white;
}
.MLK__rows > .MLK__row .warning {
background: #cd0030;
color: white;
}
.MLK__rows > .MLK__row .warning svg.svg-glyph {
width: 24px;
height: 24px;
min-height: 24px;
}
/** A regular keycap
* Use the :where() pseudo-class to give it a very low specifity,
* so that it can be overriden by custom style.
*/
:where(.MLK__rows > .MLK__row div) {
display: flex;
flex-flow: column;
align-items: center;
justify-content: space-evenly;
width: calc(var(--_keycap-width) - var(--_keycap-gap));
height: var(--_keycap-height);
box-sizing: border-box;
padding: 0;
vertical-align: top;
text-align: center;
float: left;
color: var(--_keycap-text);
fill: currentColor;
font-size: var(--_keycap-font-size);
background: var(--_keycap-background);
border: 1px solid var(--_keycap-border);
border-bottom-color: var(--_keycap-border-bottom);
border-radius: 6px;
cursor: pointer;
touch-action: none;
/* Keys with a variants panel */
position: relative;
overflow: hidden;
-webkit-user-select: none;
user-select: none;
-webkit-tap-highlight-color: transparent;
}
:where(.MLK__rows > .MLK__row div):hover {
overflow: visible;
background: var(--_keycap-background-hover);
}
:where(.MLK__rows > .MLK__row div) .ML__latex {
pointer-events: none;
touch-action: none;
}
:where(.MLK__rows > .MLK__row div) svg.svg-glyph {
margin: 8px 0;
width: 20px;
height: 20px;
min-height: 20px;
}
:where(.MLK__rows > .MLK__row div) svg.svg-glyph-lg {
margin: 8px 0;
width: 24px;
height: 24px;
min-height: 24px;
}
:where(.MLK__rows > .MLK__row div).MLK__tex-math {
font-size: 25px;
}
:where(.MLK__rows > .MLK__row div).is-pressed {
background: var(--_keycap-background-pressed);
color: var(--_keycap-text-pressed);
--_box-placeholder-color: var(--_box-placeholder-pressed-color);
}
:where(.MLK__rows > .MLK__row div).MLK__keycap.is-active,
:where(.MLK__rows > .MLK__row div).action.is-active,
:where(.MLK__rows > .MLK__row div).MLK__keycap.is-pressed,
:where(.MLK__rows > .MLK__row div).action.is-pressed {
z-index: calc(var(--_keyboard-zindex) - 5);
}
:where(.MLK__rows > .MLK__row div).MLK__keycap.is-active aside,
:where(.MLK__rows > .MLK__row div).action.is-active aside,
:where(.MLK__rows > .MLK__row div).MLK__keycap.is-pressed aside,
:where(.MLK__rows > .MLK__row div).action.is-pressed aside {
display: none;
}
:where(.MLK__rows > .MLK__row div).MLK__keycap.is-active .MLK__shift,
:where(.MLK__rows > .MLK__row div).action.is-active .MLK__shift,
:where(.MLK__rows > .MLK__row div).MLK__keycap.is-pressed .MLK__shift,
:where(.MLK__rows > .MLK__row div).action.is-pressed .MLK__shift {
display: none;
}
:where(.MLK__rows > .MLK__row div).shift.is-pressed,
:where(.MLK__rows > .MLK__row div).MLK__keycap.is-pressed,
:where(.MLK__rows > .MLK__row div).action.is-pressed {
background: var(--_keycap-background-pressed);
color: var(--_keycap-text-pressed);
}
:where(.MLK__rows > .MLK__row div).shift.is-active,
:where(.MLK__rows > .MLK__row div).MLK__keycap.is-active,
:where(.MLK__rows > .MLK__row div).action.is-active {
background: var(--_keycap-background-active);
color: var(--_keycap-text-active);
--_box-placeholder-color: var(--_box-placeholder-pressed-color);
}
:where(.MLK__rows > .MLK__row div) small {
color: var(--_keycap-secondary-text);
}
:where(.MLK__rows > .MLK__row div) aside {
font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
font-size: 10px;
line-height: 10px;
color: var(--_keycap-secondary-text);
}
/* Add an attribute 'data-tooltip' to display a tooltip on hover.
Note there are a different set of tooltip rules for the keyboard toggle
(it's in a different CSS tree) */
.ML__keyboard [data-tooltip] {
position: relative;
}
.ML__keyboard [data-tooltip]::after {
position: absolute;
display: inline-table;
content: attr(data-tooltip);
top: inherit;
bottom: 100%;
width: max-content;
max-width: 200px;
padding: 8px 8px;
background: #616161;
color: #fff;
text-align: center;
z-index: 2;
box-shadow: 0 2px 2px 0 rgba(0, 0, 0, 0.14), 0 1px 5px 0 rgba(0, 0, 0, 0.12), 0 3px 1px -2px rgba(0, 0, 0, 0.2);
border-radius: 2px;
font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
font-weight: 400;
font-size: 12px;
transition: all 0.15s cubic-bezier(0.4, 0, 1, 1) 1s;
opacity: 0;
transform: scale(0.5);
}
.ML__keyboard [data-tooltip]:hover {
position: relative;
}
.ML__keyboard [data-tooltip]:hover::after {
opacity: 1;
transform: scale(1);
}
.MLK__toolbar {
align-self: center;
display: flex;
flex-flow: row;
justify-content: space-between;
width: 100%;
max-width: 996px;
min-height: 32px;
/* Icons for undo/redo, etc. */
}
.MLK__toolbar svg {
height: 20px;
width: 20px;
}
.MLK__toolbar > .left {
position: relative;
display: flex;
justify-content: flex-start;
flex-flow: row;
}
.MLK__toolbar > .right {
display: flex;
justify-content: flex-end;
flex-flow: row;
}
.MLK__toolbar > div > div {
/* "button" in the toolbar */
display: flex;
align-items: center;
justify-content: center;
color: var(--_toolbar-text);
fill: currentColor;
background: var(--_toolbar-background);
font-size: var(--_toolbar-font-size);
padding: 4px 15px;
cursor: pointer;
width: max-content;
min-width: 42px;
min-height: 34px;
border: none;
padding-left: 10px;
padding-right: 10px;
padding-bottom: 8px;
padding-top: 8px;
margin-top: 0;
margin-bottom: 4px;
margin-left: 4px;
margin-right: 4px;
border-radius: 8px;
box-shadow: none;
border-bottom: 2px solid transparent;
}
.MLK__toolbar > div > div:not(.disabled):not(.selected):hover {
background: var(--_toolbar-background-hover);
}
.MLK__toolbar > div > div.disabled svg,
.MLK__toolbar > div > div.disabled:hover svg,
.MLK__toolbar > div > div.disabled.is-pressed svg {
color: var(--_toolbar-text);
opacity: 0.2;
}
.MLK__toolbar > div > div:hover,
.MLK__toolbar > div > div:active,
.MLK__toolbar > div > div.is-pressed,
.MLK__toolbar > div > div.is-active {
color: var(--_toolbar-text-active);
}
.MLK__toolbar > div > div.selected {
color: var(--_toolbar-text-active);
background: var(--_toolbar-background-selected);
border-radius: 0;
border-bottom-color: var(--_toolbar-text-active);
padding-bottom: 4px;
margin-bottom: 8px;
}
/* This is the element that displays variants on press+hold */
.MLK__variant-panel {
visibility: hidden;
position: fixed;
display: flex;
flex-flow: row wrap-reverse;
justify-content: center;
align-content: center;
margin: 0;
padding: 0;
bottom: auto;
top: 0;
box-sizing: content-box;
transform: none;
z-index: calc(var(--_keyboard-zindex) + 1);
touch-action: none;
max-width: 350px;
background: var(--_variant-panel-background);
text-align: center;
border-radius: 6px;
padding: 6px;
box-shadow: 0 14px 28px rgba(0, 0, 0, 0.25), 0 10px 10px rgba(0, 0, 0, 0.22);
transition: none;
}
.MLK__variant-panel.is-visible {
visibility: visible;
}
.MLK__variant-panel.compact {
--_variant-keycap-length: var(--variant-keycap-length, 50px);
--_variant-keycap-font-size: var(--variant-keycap-font-size, 24px);
--_variant-keycap-aside-font-size: var(--variant-keycap-aside-font-size, 10px);
}
.MLK__variant-panel .item {
display: flex;
flex-flow: column;
align-items: center;
justify-content: center;
font-size: var(--_variant-keycap-font-size);
height: var(--_variant-keycap-length);
width: var(--_variant-keycap-length);
margin: 0;
box-sizing: border-box;
border-radius: 5px;
border: 1px solid transparent;
background: transparent;
pointer-events: all;
cursor: pointer;
color: var(--_variant-keycap-text);
fill: currentColor;
}
@media (max-height: 412px) {
.MLK__variant-panel .item {
--_variant-keycap-font-size: var(--variant-keycap-font-size, 24px);
--_variant-keycap-length: var(--variant-keycap-length, 50px);
}
}
.MLK__variant-panel .item .ML__latex {
pointer-events: none;
}
.MLK__variant-panel .item.is-active {
background: var(--_variant-keycap-background-active);
color: var(--_variant-keycap-text-active);
}
.MLK__variant-panel .item.is-pressed {
background: var(--_variant-keycap-background-pressed);
color: var(--_variant-keycap-text-pressed);
}
.MLK__variant-panel .item.small {
font-size: var(--_keycap-small-font-size);
}
.MLK__variant-panel .item.swatch-button {
box-sizing: border-box;
background: #fbfbfb;
}
.MLK__variant-panel .item.swatch-button > span {
display: inline-block;
margin: 6px;
width: calc(100% - 12px);
height: calc(100% - 12px);
border-radius: 50%;
}
.MLK__variant-panel .item.swatch-button:hover {
background: #f0f0f0;
}
.MLK__variant-panel .item.swatch-button:hover > span {
border-radius: 2px;
}
.MLK__variant-panel .item.box > div,
.MLK__variant-panel .item.box > span {
border: 1px dashed rgba(0, 0, 0, 0.24);
}
.MLK__variant-panel .item .warning {
min-height: 60px;
min-width: 60px;
background: #cd0030;
color: white;
padding: 5px;
display: flex;
align-items: center;
justify-content: center;
border-radius: 5px;
}
.MLK__variant-panel .item .warning.is-pressed,
.MLK__variant-panel .item .warning.is-active {
background: red;
}
.MLK__variant-panel .item .warning svg.svg-glyph {
width: 50px;
height: 50px;
}
.MLK__variant-panel .item aside {
font-size: var(--_variant-keycap-aside-font-size);
line-height: 12px;
opacity: 0.78;
padding-top: 2px;
}
.MLK__keycap {
position: relative;
}
.MLK__shift {
display: block;
position: absolute;
right: 4px;
top: 4px;
font-size: var(--_keycap-shift-font-size);
color: var(--_keycap-shift-color);
}
.hide-shift .MLK__shift {
display: none;
}
@media (max-width: 414px) {
.MLK__variant-panel {
max-width: 350px;
--_variant-keycap-font-size: var(--variant-keycap-font-size, 24px);
--_variant-keycap-length: var(--variant-keycap-length, 50px);
}
}
/* @xs breakpoint: iPhone 5 */
@container (max-width: 414px) {
.MLK__rows {
--_keycap-gap: max(var(--_keycap-gap, 2px), 2px);
--_keycap-height: max(var(--_keycap-height), 42px);
--_keycap-width: var(--keycap-width, min(min(var(--_keycap-max-width)), 10cqw), 62px));
}
.MLK__toolbar > div > div {
font-size: 100%;
margin-left: 2px;
margin-right: 2px;
}
.MLK__rows .shift,
.MLK__rows .action {
font-size: 65%;
}
.MLK__rows .warning svg.svg-glyph {
width: 14px;
height: 14px;
min-height: 14px;
}
}
@container (max-width: 744px) {
.MLK__rows {
--_keycap-gap: max(var(--keycap-gap, 2px), 2px);
--_keycap-height: max(var(--keycap-height, 52px), 52px);
--_keycap-width: var(--keycap-width, min(min(var(--_keycap-max-width), 10cqw), 62px));
}
.MLK__toolbar > div > div {
padding-left: 0;
padding-right: 0;
}
.MLK__tooltip::after {
padding: 8px 16px;
font-size: 16px;
}
.MLK__rows > .MLK__row > div.fnbutton {
font-size: 16px;
}
.MLK__rows > .MLK__row > div.bigfnbutton {
font-size: calc(var(--_keycap-extra-small-font-size) / 1.55);
}
.MLK__rows > .MLK__row > div.small {
font-size: 13px;
}
.MLK__rows > .MLK__row > div > aside {
display: none;
}
.MLK__shift {
display: none;
}
}
/* Medium breakpoint: larger phones */
@container (max-width: 768px) {
.MLK__rows {
--_keycap-height: max(var(--keycap-height, 42px), 42px);
}
.MLK__rows > .MLK__row > div > small {
font-size: 14px;
}
}
@media (max-height: 768px) {
.MLK__rows {
--_keycap-height: max(var(--keycap-height, 42px), 42px);
}
.MLK__rows > .MLK__row > div > small {
font-size: 14px;
}
}
@container (max-width: 1444px) {
.MLK__rows .if-wide {
display: none;
}
}
@media (prefers-color-scheme: dark) {
.ML__keyboard {
--_accent-color: var(--keyboard-accent-color, #0b5c9c);
--_background: var(--keyboard-background, #151515);
--_border: var(--keyboard-border, transparent);
--_toolbar-text: var(--keyboard-toolbar-text, #e3e4e8);
--_toolbar-background-hover: var(--keyboard-toolbar-background-hover, #303030);
--keyboard-toolbar-background-hover: #303030;
--_horizontal-rule: var(--keyboard-horizontal-rule, 1px solid #303030);
--_keycap-background: var(--keycap-background, #1f2022);
--_keycap-background-hover: var(--keycap-background-hover, #2f3032);
--_keycap-border: var(--_keycap-border, transparent);
--_keycap-border-bottom: var(--_keycap-border-bottom, transparent);
--_keycap-text: var(--keycap-text, #e3e4e8);
--_keycap-secondary-background: var(--keycap-secondary-background, #3d4144);
--_keycap-secondary-background-hover: var(--keycap-secondary-background-hover, #4d5154);
--_keycap-secondary-text: var(--keycap-secondary-text, #e7ebee);
--keycap-secondary-border: transparent;
--keycap-secondary-border-bottom: transparent;
--_keycap-secondary-border: var(--keycap-secondary-border, transparent);
--_keycap-secondary-border-bottom: var(--keycap-secondary-border-bottom, transparent);
--_variant-panel-background: var(--variant-panel-background, #303030);
--_variant-keycap-text-active: var(--variant-keycap-text-active, #fff);
}
}
/* Same as the media query, but with a class */
[theme='dark'] .ML__keyboard {
--_accent-color: var(--keyboard-accent-color, #0b5c9c);
--_background: var(--keyboard-background, #151515);
--_border: var(--keyboard-border, transparent);
--_toolbar-text: var(--keyboard-toolbar-text, #e3e4e8);
--_toolbar-background-hover: var(--keyboard-toolbar-background-hover, #303030);
--keyboard-toolbar-background-hover: #303030;
--_horizontal-rule: var(--keyboard-horizontal-rule, 1px solid #303030);
--_keycap-background: var(--keycap-background, #1f2022);
--_keycap-background-hover: var(--keycap-background-hover, #2f3032);
--_keycap-border: var(--_keycap-border, transparent);
--_keycap-border-bottom: var(--_keycap-border-bottom, transparent);
--_keycap-text: var(--keycap-text, #e3e4e8);
--_keycap-secondary-background: var(--keycap-secondary-background, #3d4144);
--_keycap-secondary-background-hover: var(--keycap-secondary-background-hover, #4d5154);
--_keycap-secondary-text: var(--keycap-secondary-text, #e7ebee);
--keycap-secondary-border: transparent;
--keycap-secondary-border-bottom: transparent;
--_keycap-secondary-border: var(--keycap-secondary-border, transparent);
--_keycap-secondary-border-bottom: var(--keycap-secondary-border-bottom, transparent);
--_variant-panel-background: var(--variant-panel-background, #303030);
--_variant-keycap-text-active: var(--variant-keycap-text-active, #fff);
}
[theme='light'] .ML__keyboard {
--_accent-color: var(--keyboard-accent-color, #0c75d8);
--_background: var(--keyboard-background, #cacfd7);
--_border: var(--keyboard-border, #ddd);
--_toolbar-text: var(--keyboard-toolbar-text, #2c2e2f);
--_toolbar-background: var(--keyboard-toolbar-background, transparent);
--_toolbar-background-hover: var(--keyboard-toolbar-background-hover, #eee);
--_toolbar-background-selected: var(--keyboard-toolbar-background-selected, transparent);
--_horizontal-rule: var(--keyboard-horizontal-rule, 1px solid #fff);
--_keycap-background: var(--keycap-background, white);
--_keycap-background-hover: var(--keycap-background-hover, #f5f5f7);
--_keycap-background-active: var(--keycap-background-active, var(--_accent-color));
--_keycap-background-pressed: var(--keycap-background-pressed, var(--_accent-color));
--_keycap-border: var(--_keycap-border, #e5e6e9);
--_keycap-border-bottom: var(--_keycap-border-bottom, #8d8f92);
--_keycap-text: var(--keycap-text, #000);
--_keycap-text-active: var(--keycap-text-active, #fff);
--_keycap-text-hover: var(--keycap-text-hover, var(--_keycap-text));
--_keycap-text-pressed: var(--keycap-text-pressed, #fff);
--_keycap-shift-text: var(--keycap-shift-text, var(--_accent-color));
--_keycap-secondary-background: var(--keycap-secondary-background, #a0a9b8);
--_keycap-secondary-background-hover: var(--keycap-secondary-background-hover, #7d8795);
--_keycap-secondary-text: var(--keycap-secondary-text, #060707);
--_keycap-secondary-border: var(--keycap-secondary-border, #c5c9d0);
--_keycap-secondary-border-bottom: var(--keycap-secondary-border-bottom, #989da6);
--_variant-panel-background: var(--variant-panel-background, #fff);
--_variant-keycap-text: var(--variant-keycap-textvar, var(--_keycap-text));
--_variant-keycap-text-active: var(--variant-keycap-text-active, var(--_keycap-text-active));
--_variant-keycap-background-active: var(--variant-keycap-background-active, var(--_accent-color));
}
`;
var X0 = `:host {
--primary-color: #5898ff;
--primary-color-dimmed: #c0c0f0;
--primary-color-dark: var(--blue-500);
--primary-color-light: var(--blue-100);
--primary-color-reverse: #ffffff;
--secondary-color: #ff8a65;
--secondary-color-dimmed: #f0d5c5;
--secondary-color-dark: var(--orange-500);
--secondary-color-light: var(--orange-100);
--secondary-color-reverse: #ffffff;
--link-color: #5898ff;
--link-color-dimmed: #c5c5c5;
--link-color-dark: #121212;
--link-color-light: #e2e2e2;
--link-color-reverse: #ffffff;
--semantic-blue: var(--blue-700);
--semantic-red: var(--red-400);
--semantic-orange: var(--orange-400);
--semantic-green: var(--green-700);
--neutral-100: #f5f5f5;
--neutral-200: #eeeeee;
--neutral-300: #e0e0e0;
--neutral-400: #bdbdbd;
--neutral-500: #9e9e9e;
--neutral-600: #757575;
--neutral-700: #616161;
--neutral-800: #424242;
--neutral-900: #212121;
--red-25: #fff8f7;
--red-50: #fff1ef;
--red-100: #ffeae6;
--red-200: #ffcac1;
--red-300: #ffa495;
--red-400: #ff7865;
--red-500: #f21c0d;
--red-600: #e50018;
--red-700: #d30024;
--red-800: #bd002c;
--red-900: #a1002f;
--orange-25: #fffbf8;
--orange-50: #fff7f1;
--orange-100: #fff3ea;
--orange-200: #ffe1c9;
--orange-300: #ffcca2;
--orange-400: #ffb677;
--orange-500: #fe9310;
--orange-600: #f58700;
--orange-700: #ea7c00;
--orange-800: #dc6d00;
--orange-900: #ca5b00;
--brown-25: #fff8ef;
--brown-50: #fff1df;
--brown-100: #ffe9ce;
--brown-200: #ebcca6;
--brown-300: #cdaf8a;
--brown-400: #af936f;
--brown-500: #856a47;
--brown-600: #7f5e34;
--brown-700: #78511f;
--brown-800: #6e4200;
--brown-900: #593200;
--yellow-25: #fffdf9;
--yellow-50: #fffcf2;
--yellow-100: #fffaec;
--yellow-200: #fff2ce;
--yellow-300: #ffe8ab;
--yellow-400: #ffdf85;
--yellow-500: #ffcf33;
--yellow-600: #f1c000;
--yellow-700: #dfb200;
--yellow-800: #c9a000;
--yellow-900: #ad8a00;
--lime-25: #f4ffee;
--lime-50: #e9ffdd;
--lime-100: #ddffca;
--lime-200: #a8fb6f;
--lime-300: #94e659;
--lime-400: #80d142;
--lime-500: #63b215;
--lime-600: #45a000;
--lime-700: #268e00;
--lime-800: #007417;
--lime-900: #005321;
--green-25: #f5fff5;
--green-50: #ebffea;
--green-100: #e0ffdf;
--green-200: #a7ffa7;
--green-300: #5afa65;
--green-400: #45e953;
--green-500: #17cf36;
--green-600: #00b944;
--green-700: #00a34a;
--green-800: #008749;
--green-900: #00653e;
--teal-25: #f3ffff;
--teal-50: #e6fffe;
--teal-100: #d9fffe;
--teal-200: #8dfffe;
--teal-300: #57f4f4;
--teal-400: #43e5e5;
--teal-500: #17cfcf;
--teal-600: #00c2c0;
--teal-700: #00b5b1;
--teal-800: #00a49e;
--teal-900: #009087;
--cyan-25: #f7fcff;
--cyan-50: #eff8ff;
--cyan-100: #e7f5ff;
--cyan-200: #c2e6ff;
--cyan-300: #95d5ff;
--cyan-400: #61c4ff;
--cyan-500: #13a7ec;
--cyan-600: #069eda;
--cyan-700: #0095c9;
--cyan-800: #0088b2;
--cyan-900: #0a7897;
--blue-25: #f7faff;
--blue-50: #eef5ff;
--blue-100: #e5f1ff;
--blue-200: #bfdbff;
--blue-300: #92c2ff;
--blue-400: #63a8ff;
--blue-500: #0d80f2;
--blue-600: #0077db;
--blue-700: #006dc4;
--blue-800: #0060a7;
--blue-900: #005086;
--indigo-25: #f8f7ff;
--indigo-50: #f1efff;
--indigo-100: #eae7ff;
--indigo-200: #ccc3ff;
--indigo-300: #ac99ff;
--indigo-400: #916aff;
--indigo-500: #63c;
--indigo-600: #5a21b2;
--indigo-700: #4e0b99;
--indigo-800: #3b0071;
--indigo-900: #220040;
--purple-25: #fbf7ff;
--purple-50: #f8f0ff;
--purple-100: #f4e8ff;
--purple-200: #e4c4ff;
--purple-300: #d49aff;
--purple-400: #c36aff;
--purple-500: #a219e6;
--purple-600: #9000c4;
--purple-700: #7c009f;
--purple-800: #600073;
--purple-900: #3d0043;
--magenta-25: #fff8fb;
--magenta-50: #fff2f6;
--magenta-100: #ffebf2;
--magenta-200: #ffcddf;
--magenta-300: #ffa8cb;
--magenta-400: #ff7fb7;
--magenta-500: #eb4799;
--magenta-600: #da3689;
--magenta-700: #c82179;
--magenta-800: #b00065;
--magenta-900: #8a004c;
}
@media (prefers-color-scheme: dark) {
:host {
--semantic-blue: var(--blue-700);
--semantic-red: var(--red-400);
--semantic-orange: var(--orange-400);
--semantic-green: var(--green-700);
--semantic-bg-blue: var(--blue-25);
--semantic-bg-red: var(--red-25);
--semantic-bg-orange: var(--orange-25);
--semantic-bg-green: var(--green-25);
--neutral-100: #121212;
--neutral-200: #424242;
--neutral-300: #616161;
--neutral-400: #757575;
--neutral-500: #9e9e9e;
--neutral-600: #bdbdbd;
--neutral-700: #e0e0e0;
--neutral-800: #eeeeee;
--neutral-900: #f5f5f5;
}
}
:host([theme='dark']) {
--semantic-blue: var(--blue-700);
--semantic-red: var(--red-400);
--semantic-orange: var(--orange-400);
--semantic-green: var(--green-700);
--semantic-bg-blue: var(--blue-25);
--semantic-bg-red: var(--red-25);
--semantic-bg-orange: var(--orange-25);
--semantic-bg-green: var(--green-25);
--neutral-100: #121212;
--neutral-200: #424242;
--neutral-300: #616161;
--neutral-400: #757575;
--neutral-500: #9e9e9e;
--neutral-600: #bdbdbd;
--neutral-700: #e0e0e0;
--neutral-800: #eeeeee;
--neutral-900: #f5f5f5;
}
/* @media (prefers-color-scheme: dark) {
:host {
--label-color: #fff;
--active-label-color: #000;
--menu-bg: #525252;
--active-bg: #5898ff;
--active-bg-dimmed: #5c5c5c;
}
} */
:host {
--ui-font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont,
'Segoe UI', Helvetica, Arial, sans-serif, 'Apple Color Emoji',
'Segoe UI Emoji', 'Segoe UI Symbol';
--ui-font-size: 14px;
--ui-line-height: 1.5;
--ui-letter-spacing: 0.007em;
--mono-font-family: 'Berkeley Mono', 'JetBrains Mono', 'IBM Plex Mono',
'Source Code Pro', Menlo, Monaco, 'Courier New', monospace;
--ui-layer-1: var(--neutral-100);
--ui-layer-2: var(--neutral-200);
--ui-layer-3: var(--neutral-300);
--ui-layer-4: var(--neutral-400);
--ui-layer-5: var(--neutral-500);
--ui-layer-6: var(--neutral-600);
--ui-border-color: var(--primary-color);
--ui-border-radius: 4px;
--ui-text: var(--neutral-900);
--ui-text-secondary: var(--neutral-700);
--ui-text-placeholder: var(--neutral-500);
--ui-text-muted: var(--neutral-300);
/** A field is a UI element in which a user can type data, for
* example an input or textarea element.
*/
--ui-field-bg: var(--neutral-100);
--ui-field-bg-hover: var(--neutral-100);
--ui-field-bg-disabled: var(--neutral-300);
--ui-field-bg-invalid: var(--red-100);
--ui-field-bg-focus: var(--neutral-100);
--ui-field-border: 0.5px solid var(--border-color);
--ui-field-border-hover: 0.5px solid var(--border-color);
--ui-field-border-disabled: 0.5px solid var(--border-color);
--ui-field-border-invalid: 0.5px solid var(--border-color);
--ui-field-border-focus: 0.5px solid var(--border-color);
--ui-menu-bg: var(--neutral-100);
--ui-menu-text: var(--neutral-900);
--ui-menu-bg-hover: var(--neutral-200);
--ui-menu-text-hover: var(--neutral-900);
/** The \`active\` state is used for the state of menu items
* when they are selected.
*/
--ui-menu-bg-active: var(--primary-color);
--ui-menu-text-active: var(--primary-color-reverse);
/** The \`active-muted\` set is used for the state of
* submenus when they are open.
*/
--ui-menu-bg-active-muted: var(--neutral-300);
--ui-menu-text-active-muted: var(--neutral-900);
/* --ui-menu-shadow: 0 1px 2px 0 rgba(60, 64, 67, 0.302),
0 2px 6px 2px rgba(60, 64, 67, 0.149); */
--ui-menu-shadow: 0 0 2px rgba(0, 0, 0, 0.5), 0 0 20px rgba(0, 0, 0, 0.2);
--ui-menu-divider: 0.5px solid #c7c7c7;
/* var(--neutral-300); */
--ui-menu-z-index: 10000;
--page-bg: var(--neutral-100);
--content-bg: var(--neutral-200);
}
@media (prefers-color-scheme: dark) {
:host {
--ui-menu-bg: var(--neutral-200);
}
}
:host([theme='dark']) {
--ui-menu-bg: var(--neutral-200);
}
/* PingFang SC is a macOS font. Microsoft Yahei is a Windows font.
Noto is a Linux/Android font.
*/
:lang(zh-cn),
:lang(zh-sg),
:lang(zh-my),
:lang(zh) {
--ui-font-family: -apple-system, system-ui, 'PingFang SC', 'Hiragino Sans GB',
'Noto Sans CJK SC', 'Noto Sans SC', 'Noto Sans', 'Microsoft Yahei UI',
'Microsoft YaHei New', 'Microsoft Yahei', '\u5FAE\u8F6F\u96C5\u9ED1', SimSun, '\u5B8B\u4F53',
STXihei, '\u534E\u6587\u7EC6\u9ED1', sans-serif;
}
:lang(zh-tw),
:lang(zh-hk),
:lang(zh-mo) {
--ui-font-family: -apple-system, system-ui, 'Noto Sans',
'Microsoft JhengHei UI', 'Microsoft JhengHei', '\u5FAE\u8EDF\u6B63\u9ED1\u9AD4', '\u65B0\u7D30\u660E\u9AD4',
'PMingLiU', '\u7D30\u660E\u9AD4', 'MingLiU', sans-serif;
}
:lang(ja),
:lang(ja-jp),
:lang(ja-jp-mac) {
--ui-font-family: -apple-system, system-ui, 'Hiragino Sans',
'Hiragino Kaku Gothic ProN', 'Noto Sans CJK JP', 'Noto Sans JP', 'Noto Sans',
'\u6E38\u30B4\u30B7\u30C3\u30AF', '\u6E38\u30B4\u30B7\u30C3\u30AF\u4F53', YuGothic, 'Yu Gothic', '\u30E1\u30A4\u30EA\u30AA', Meiryo,
'\uFF2D\uFF33 \uFF30\u30B4\u30B7\u30C3\u30AF', 'MS PGothic', sans-serif;
}
:lang(ko),
:lang(ko-kr),
:lang(ko-kr-std) {
--ui-font-family: -apple-system, system-ui, 'Noto Sans CJK KR', 'Noto Sans KR',
'Noto Sans', 'Malgun Gothic', '\uB9D1\uC740 \uACE0\uB515', 'Apple SD Gothic Neo',
'\uC560\uD50C SD \uC0B0\uB3CC\uACE0\uB515 Neo', 'Apple SD \uC0B0\uB3CC\uACE0\uB515 Neo', '\uB3CB\uC6C0', Dotum, sans-serif;
}
:lang(ko-kr-apple) {
--ui-font-family: -apple-system, system-ui, 'Noto Sans CJK KR', 'Noto Sans KR',
'Noto Sans', 'Apple SD Gothic Neo', '\uC560\uD50C SD \uC0B0\uB3CC\uACE0\uB515 Neo',
'Apple SD \uC0B0\uB3CC\uACE0\uB515 Neo', '\uB3CB\uC6C0', Dotum, sans-serif;
}
:lang(zh-cn),
:lang(zh-sg),
:lang(zh-my),
:lang(zh),
:lang(zh-tw),
:lang(zh-hk),
:lang(zh-mo),
:lang(ja),
:lang(ja-jp),
:lang(ja-jp-mac),
:lang(ko),
:lang(ko-kr),
:lang(ko-kr-std),
:lang(ko-kr-apple) {
--ui-font-size: 1rem;
--ui-line-height: 1.7;
--ui-letter-spacing: 0;
}
:dir(rtl) {
--ui-line-height: auto;
--ui-letter-spacing: 0;
}
`;
var Z0 = `.ui-menu *,
.ui-menu ::before,
.ui-menu ::after {
box-sizing: border-box;
}
.ui-menu {
display: none;
color-scheme: light dark;
-webkit-user-select: none;
/* Important: Safari iOS doesn't respect user-select */
user-select: none;
cursor: default;
-webkit-touch-callout: none;
-webkit-tap-highlight-color: rgba(0 0 0 0);
--active-label-color: #fff;
/* ui-menu-text-active */
--label-color: #121212;
/* ui-menu-text */
--menu-bg: #e2e2e2;
/* ui-menu-background */
--active-bg: #5898ff;
/* ui-menu-background-active */
--active-bg-dimmed: #c5c5c5;
/* ui-menu-background-active-muted */
}
/** Use the :where pseudo selector to make the specificity of the
* selector 0, so that it can be overridden by the user.
*/
:where(.ui-menu-container) {
position: absolute;
overflow: visible;
width: auto;
height: auto;
z-index: 10000;
border-radius: 8px;
background: var(--ui-menu-bg);
box-shadow: var(--ui-menu-shadow);
list-style: none;
padding: 6px 0 6px 0;
margin: 0;
user-select: none;
cursor: default;
color: var(--ui-menu-text);
font-weight: normal;
font-style: normal;
text-shadow: none;
text-transform: none;
letter-spacing: 0;
outline: none;
opacity: 1;
/* The [popover] elements have a 1px solid black border. Ugh. */
border: none;
width: fit-content;
height: fit-content;
}
:where(.ui-menu-container > li) {
display: flex;
flex-flow: row;
align-items: center;
padding: 1px 7px 1px 7px;
margin-top: 0;
margin-left: 6px;
margin-right: 6px;
border-radius: 4px;
white-space: nowrap;
position: relative;
outline: none;
fill: currentColor;
user-select: none;
cursor: default;
text-align: left;
color: inherit;
font-family: var(--ui-font-family);
font-size: var(--ui-font-size);
line-height: var(--ui-line-height);
letter-spacing: var(--ui-letter-spacing);
}
:where(.ui-menu-container > li > .label) {
appearance: none;
background: none;
outline: none;
width: 100%;
margin: 0;
padding: 1px 2px 1px 1px;
overflow: visible;
border: 1px solid transparent;
white-space: nowrap;
text-align: start;
}
:where(.ui-menu-container > li:has(.heading)) {
margin-top: 0.5em;
}
:where(.ui-menu-container > li > .label.heading) {
font-weight: bold;
opacity: 0.4;
}
:where(.ui-menu-container > li.indent > .label) {
margin-inline-start: 12px;
}
:where(.ui-menu-container > li > .label.indent) {
margin-inline-start: 12px;
}
:where(.ui-menu-container > li[role='divider']) {
border-bottom: 1px solid var(--ui-menu-divider);
border-radius: 0;
padding: 0;
margin-left: 15px;
margin-right: 15px;
padding-top: 5px;
margin-bottom: 5px;
width: calc(100% - 30px);
/** 100% - (margin-left + margin-right) */
}
:where(.ui-menu-container > li[aria-disabled='true']) {
opacity: 0.5;
}
:where(.ui-menu-container > li.active) {
background: var(--ui-menu-bg-active);
background: -apple-system-control-accent;
color: var(--ui-menu-text-active);
}
:where(.ui-menu-container > li.active.is-submenu-open) {
background: var(--ui-menu-bg-active-muted);
color: inherit;
}
:where(.ui-menu-container > li[aria-haspopup='true'] > .label) {
padding-inline-end: 0;
}
:where(.ui-menu-container > li[aria-haspopup='true'].active::after) {
color: var(--ui-menu-text-active);
}
/** Keyboard shortcut */
:where(.ui-menu-container > li > kbd) {
font-family: var(--ui-font-family);
margin-inline-start: 12px;
opacity: 0.4;
}
:where(.ui-menu-container > li.active > kbd) {
opacity: 0.85;
}
.ui-trailing-chevron {
display: flex;
margin-inline-start: 24px;
width: 10px;
height: 10px;
margin-bottom: 4px;
}
.ui-trailing-chevron:dir(rtl) {
transform: scaleX(-1);
}
.ui-checkmark {
display: flex;
margin-inline-end: -11px;
margin-inline-start: -4px;
margin-top: 2px;
width: 16px;
height: 16px;
}
.ui-mixedmark {
display: flex;
margin-inline-end: -11px;
margin-inline-start: -4px;
margin-top: 2px;
width: 16px;
height: 16px;
}
`;
var yr;
function br(t37) {
let e = "";
switch (t37) {
case "mathfield-element":
e = `
:host { display: inline-block; background-color: field; color: fieldtext; border-width: 1px; border-style: solid; border-color: #acacac; border-radius: 2px; padding:4px;}
:host([hidden]) { display: none; }
:host([disabled]), :host([disabled]:focus), :host([disabled]:focus-within) { outline: none; opacity: .5; }
:host(:focus), :host(:focus-within) {
outline: Highlight auto 1px; /* For Firefox */
outline: -webkit-focus-ring-color auto 1px;
}
:host([readonly]:focus), :host([readonly]:focus-within),
:host([read-only]:focus), :host([read-only]:focus-within) {
outline: none;
}
@media (hover: none) and (pointer: coarse) {
:host(:not(:focus)) :first-child { pointer-events: none !important; }
}`;
break;
case "core":
e = W0;
break;
case "mathfield":
e = H0;
break;
case "environment-popover":
e = U0;
break;
case "suggestion-popover":
e = J0;
break;
case "keystroke-caption":
e = G0;
break;
case "virtual-keyboard":
e = j0;
break;
case "ui":
e = X0;
break;
case "menu":
e = Z0;
break;
default:
}
return e;
}
function Hr(t37) {
return yr || (yr = {}), yr[t37] || (yr[t37] = new CSSStyleSheet(), yr[t37].replaceSync(br(t37))), yr[t37];
}
var At;
function Oe(t37) {
var e;
if (!("adoptedStyleSheets" in document)) {
if (window.document.getElementById(`mathlive-style-${t37}`))
return;
let r = window.document.createElement("style");
r.id = `mathlive-style-${t37}`, r.append(window.document.createTextNode(br(t37))), window.document.head.appendChild(r);
return;
}
if (At || (At = {}), ((e = At[t37]) != null ? e : 0) !== 0)
At[t37] += 1;
else {
let r = Hr(t37);
document.adoptedStyleSheets = [...document.adoptedStyleSheets, r], At[t37] = 1;
}
}
function Ve(t37) {
if ("adoptedStyleSheets" in document && At != null && At[t37] && (At[t37] -= 1, At[t37] <= 0)) {
let e = yr[t37];
document.adoptedStyleSheets = document.adoptedStyleSheets.filter((r) => r !== e);
}
}
var xr = class t5 extends y {
constructor(e) {
var r;
super(g(p({}, e), { type: "accent", body: (r = e.body) != null ? r : void 0 })), e.accentChar ? this.accent = e.accentChar : this.svgAccent = e == null ? void 0 : e.svgAccent, this.skipBoundary = true, this.captureSelection = true;
}
static fromJson(e) {
return new t5(e);
}
toJson() {
return g(p({}, super.toJson()), { accentChar: this.accent, svgAccent: this.svgAccent });
}
render(e) {
var l;
let r = new T({ parent: e, mathstyle: "cramp" }, this.style), i = (l = y.createBox(r, this.body)) != null ? l : new w("\u25A2", { style: this.style }), n = 0;
!this.hasEmptyBranch("body") && this.body.length === 2 && this.body[1].isCharacterBox() && (n = i.skew);
let o = Math.min(i.height, $e), a;
if (this.svgAccent)
a = Bi(this.svgAccent), o = r.metrics.bigOpSpacing1 - o;
else if (this.accent) {
let c = new w(this.accent, { fontFamily: "Main-Regular" });
c.italic = 0;
let u = this.accent === 8407 ? " ML__accent-vec" : "";
a = new w(new w(c), { classes: "ML__accent-body" + u });
}
a = new U({ shift: 0, children: [{ box: new w(i) }, -o, { box: a, marginLeft: i.left + 2 * n, classes: ["ML__center"] }] });
let s = new w(a, { type: "lift" });
return this.caret && (s.caret = this.caret), this.bind(r, s.wrap(r)), this.attachSupsub(r, { base: s });
}
};
var zi = { "(": ")", "{": "}", "[": "]", "|": "|", "\\lbrace": "\\rbrace", "\\lparen": "\\rparen", "\\{": "\\}", "\\langle": "\\rangle", "\\lfloor": "\\rfloor", "\\lceil": "\\rceil", "\\vert": "\\vert", "\\lvert": "\\rvert", "\\Vert": "\\Vert", "\\lVert": "\\rVert", "\\lbrack": "\\rbrack", "\\ulcorner": "\\urcorner", "\\llcorner": "\\lrcorner", "\\lgroup": "\\rgroup", "\\lmoustache": "\\rmoustache" };
var Ni = Object.fromEntries(Object.entries(zi).map(([t37, e]) => [e, t37]));
function ka(t37) {
var e;
return (e = { "[": 91, "]": 93, "(": 40, ")": 41, "\\mid": 8739, "|": 8739, "\u2223": 8739, "\u2225": 8741, "\\|": 8739, "\\{": 123, "\\}": 125, "\\lbrace": 123, "\\rbrace": 125, "\\lparen": 40, "\\rparen": 41, "\\lbrack": 91, "\\rbrack": 93, "\\vert": 8739, "\\lvert": 8739, "\\mvert": 8739, "\\rvert": 8739, "\\Vert": 8741, "\\lVert": 8741, "\\mVert": 8741, "\\rVert": 8741, "\\parallel": 8741, "\\shortparallel": 8741, "\\langle": 10216, "\\rangle": 10217, "\\lfloor": 8970, "\\rfloor": 8971, "\\lceil": 8968, "\\rceil": 8969, "\\ulcorner": 9484, "\\urcorner": 9488, "\\llcorner": 9492, "\\lrcorner": 9496, "\\lgroup": 10222, "\\rgroup": 10223, "\\lmoustache": 9136, "\\rmoustache": 9137, "\\surd": 8730 }[t37]) != null ? e : t37.codePointAt(0);
}
function $h(t37, e, r, i) {
var a;
let o = new w(ka(t37), { fontFamily: "Main-Regular", isSelected: i.isSelected, classes: "ML__small-delim " + ((a = i.classes) != null ? a : "") }).wrap(e);
return r && o.setTop((1 - e.scalingFactor) * Ae), o;
}
function Y0(t37, e, r, i, n) {
var s, l;
let o = new T({ parent: i, mathstyle: "textstyle" }, n == null ? void 0 : n.style), a = new w(ka(t37), { fontFamily: `Size${e}-Regular`, isSelected: n.isSelected, classes: ((s = n.classes) != null ? s : "") + ` ML__delim-size${e}`, type: (l = n.type) != null ? l : "ignore" }).wrap(o);
return r && a.setTop((1 - o.scalingFactor) * Ae), a;
}
function Q0(t37, e, r, i, n) {
var pt;
let o, a, s, l;
o = s = l = ka(t37), a = null;
let c = "Size1-Regular";
t37 === "\\vert" || t37 === "\\lvert" || t37 === "\\rvert" || t37 === "\\mvert" || t37 === "\\mid" ? s = o = l = 8739 : t37 === "\\Vert" || t37 === "\\lVert" || t37 === "\\rVert" || t37 === "\\mVert" || t37 === "\\|" ? s = o = l = 8741 : t37 === "\\uparrow" ? s = l = 9168 : t37 === "\\Uparrow" ? s = l = 8214 : t37 === "\\downarrow" ? o = s = 9168 : t37 === "\\Downarrow" ? o = s = 8214 : t37 === "\\updownarrow" ? (o = 8593, s = 9168, l = 8595) : t37 === "\\Updownarrow" ? (o = 8657, s = 8214, l = 8659) : t37 === "[" || t37 === "\\lbrack" ? (o = 9121, s = 9122, l = 9123, c = "Size4-Regular") : t37 === "]" || t37 === "\\rbrack" ? (o = 9124, s = 9125, l = 9126, c = "Size4-Regular") : t37 === "\\lfloor" || t37 === "\u230A" ? (s = o = 9122, l = 9123, c = "Size4-Regular") : t37 === "\\lceil" || t37 === "\u2308" ? (o = 9121, s = l = 9122, c = "Size4-Regular") : t37 === "\\rfloor" || t37 === "\u230B" ? (s = o = 9125, l = 9126, c = "Size4-Regular") : t37 === "\\rceil" || t37 === "\u2309" ? (o = 9124, s = l = 9125, c = "Size4-Regular") : t37 === "(" || t37 === "\\lparen" ? (o = 9115, s = 9116, l = 9117, c = "Size4-Regular") : t37 === ")" || t37 === "\\rparen" ? (o = 9118, s = 9119, l = 9120, c = "Size4-Regular") : t37 === "\\{" || t37 === "\\lbrace" ? (o = 9127, a = 9128, l = 9129, s = 9130, c = "Size4-Regular") : t37 === "\\}" || t37 === "\\rbrace" ? (o = 9131, a = 9132, l = 9133, s = 9130, c = "Size4-Regular") : t37 === "\\lgroup" || t37 === "\u27EE" ? (o = 9127, l = 9129, s = 9130, c = "Size4-Regular") : t37 === "\\rgroup" || t37 === "\u27EF" ? (o = 9131, l = 9133, s = 9130, c = "Size4-Regular") : t37 === "\\lmoustache" || t37 === "\u23B0" ? (o = 9127, l = 9133, s = 9130, c = "Size4-Regular") : t37 === "\\rmoustache" || t37 === "\u23B1" ? (o = 9131, l = 9129, s = 9130, c = "Size4-Regular") : t37 === "\\surd" ? (o = 57345, l = 9143, s = 57344, c = "Size4-Regular") : t37 === "\\ulcorner" ? (o = 9484, s = l = 32) : t37 === "\\urcorner" ? (o = 9488, s = l = 32) : t37 === "\\llcorner" ? (l = 9492, s = o = 32) : t37 === "\\lrcorner" && (o = 9496, s = o = 32);
let u = cr(o, c), d = u.height + u.depth, m = cr(s, c), h = m.height + m.depth, f = cr(l, c), b = f.height + f.depth, S = 0, M = 1;
if (a !== null) {
let be = cr(a, c);
S = be.height + be.depth, M = 2;
}
let x = d + b + S, v = Math.max(0, Math.ceil((e - x) / (M * h))), k = x + v * M * h, C = Ae;
r && (C = C * i.scalingFactor);
let q = k / 2 - C, B = 8e-3, D = [];
D.push({ box: new w(l, { fontFamily: c }) }), D.push(-B);
let J = new w(s, { fontFamily: c });
if (a === null)
for (let be = 0; be < v; be++)
D.push({ box: J });
else {
for (let be = 0; be < v; be++)
D.push({ box: J });
D.push(-B), D.push({ box: new w(a, { fontFamily: c }) }), D.push(-B);
for (let be = 0; be < v; be++)
D.push({ box: J });
}
D.push(-B), D.push({ box: new w(o, { fontFamily: c }) });
let de = "";
c === "Size1-Regular" ? de = " delim-size1" : c === "Size4-Regular" && (de = " delim-size4");
let Rt = new U({ bottom: q, children: D }, { classes: de });
return new w(Rt, g(p({}, n != null ? n : {}), { classes: ((pt = n == null ? void 0 : n.classes) != null ? pt : "") + " ML__delim-mult" }));
}
var em = /* @__PURE__ */ new Set(["(", ")", "\\lparen", "\\rparen", "[", "]", "\\lbrack", "\\rbrack", "\\{", "\\}", "\\lbrace", "\\rbrace", "\\lfloor", "\\rfloor", "\\lceil", "\\rceil", "\\surd", "\u230A", "\u230B", "\u2308", "\u2309"]);
var Vh = /* @__PURE__ */ new Set(["\\uparrow", "\\downarrow", "\\updownarrow", "\\Uparrow", "\\Downarrow", "\\Updownarrow", "|", "\\|", "\\vert", "\\Vert", "\\lvert", "\\rvert", "\\lVert", "\\rVert", "\\mvert", "\\mid", "\\lgroup", "\\rgroup", "\\lmoustache", "\\rmoustache", "\u27EE", "\u27EF", "\u23B0", "\u23B1"]);
var tm = /* @__PURE__ */ new Set(["<", ">", "\\langle", "\\rangle", "/", "\\backslash", "\\lt", "\\gt"]);
var qh = [0, 1.2, 1.8, 2.4, 3];
function rm(t37, e, r, i) {
return t37 === void 0 || t37 === "." ? Ht(r, i.classes) : (t37 === "<" || t37 === "\\lt" || t37 === "\u27E8" ? t37 = "\\langle" : (t37 === ">" || t37 === "\\gt" || t37 === "\u27E9") && (t37 = "\\rangle"), em.has(t37) || tm.has(t37) ? Y0(t37, e, false, r, i) : Vh.has(t37) ? Q0(t37, qh[e], false, r, i) : ("" + t37, null));
}
var Hh = [{ type: "small", mathstyle: "scriptscriptstyle" }, { type: "small", mathstyle: "scriptstyle" }, { type: "small", mathstyle: "textstyle" }, { type: "large", size: 1 }, { type: "large", size: 2 }, { type: "large", size: 3 }, { type: "large", size: 4 }];
var Wh = [{ type: "small", mathstyle: "scriptscriptstyle" }, { type: "small", mathstyle: "scriptscriptstyle" }, { type: "small", mathstyle: "textstyle" }, { type: "stack" }];
var Uh = [{ type: "small", mathstyle: "scriptscriptstyle" }, { type: "small", mathstyle: "scriptstyle" }, { type: "small", mathstyle: "textstyle" }, { type: "large", size: 1 }, { type: "large", size: 2 }, { type: "large", size: 3 }, { type: "large", size: 4 }, { type: "stack" }];
function Jh(t37) {
return t37.type === "small" ? "Main-Regular" : t37.type === "large" ? "Size" + t37.size + "-Regular" : (t37.type, "Size4-Regular");
}
function Gh(t37, e, r, i) {
let n = { "-4": 0, "-3": 1, 0: 2 }[i.mathstyle.sizeDelta];
for (let o = n; o < r.length && r[o].type !== "stack"; o++) {
let a = cr(t37, Jh(r[o]));
if (a.defaultMetrics)
return { type: "small", mathstyle: "scriptstyle" };
let s = a.height + a.depth;
if (r[o].type === "small" && (r[o].mathstyle === "scriptscriptstyle" ? s *= Math.max(Dn[Math.max(1, i.size - 2)], i.minFontScale) : r[o].mathstyle === "scriptstyle" && (s *= Math.max(Dn[Math.max(1, i.size - 1)], i.minFontScale))), s > e)
return r[o];
}
return r[r.length - 1];
}
function Fi(t37, e, r, i, n, o) {
if (!e || e.length === 0 || e === ".")
return Ht(n);
e === "<" || e === "\\lt" ? e = "\\langle" : (e === ">" || e === "\\gt") && (e = "\\rangle");
let a;
tm.has(e) ? a = Hh : em.has(e) ? a = Uh : a = Wh;
let s = Gh(ka(e), r, a, n), l = new T({ parent: n, mathstyle: s.mathstyle }, o == null ? void 0 : o.style);
return s.type === "small" ? $h(e, l, i, g(p({}, o), { type: t37 })) : s.type === "large" ? Y0(e, s.size, i, l, g(p({}, o), { type: t37 })) : (s.type, Q0(e, r, i, l, g(p({}, o), { type: t37 })));
}
function Wr(t37, e, r, i, n, o) {
if (e === ".")
return Ht(n, o == null ? void 0 : o.classes);
let a = Ae * n.scalingFactor, s = 901, l = 5 / kt, c = Math.max(r - a, i + a), u = Math.max(c / 500 * s, 2 * c - l);
return Fi(t37, e, u, true, n, o);
}
function Ht(t37, e) {
let r = new w(null, { classes: " ML__nulldelimiter " + (e != null ? e : ""), type: "ignore" });
return r.width = t37.getRegisterAsEm("nulldelimiterspace"), r.wrap(new T({ parent: t37, mathstyle: "textstyle" }));
}
var ge = class t6 extends y {
constructor(e) {
var r;
super({ type: "placeholder", command: "\\placeholder", mode: (r = e == null ? void 0 : e.mode) != null ? r : "math", style: e == null ? void 0 : e.style }), this.captureSelection = true;
}
static fromJson(e) {
return new t6(e);
}
toJson() {
return super.toJson();
}
render(e) {
let r;
return this.value = e.placeholderSymbol, typeof e.renderPlaceholder == "function" ? r = e.renderPlaceholder(e) : r = this.createBox(e), this.caret && (r.classes += " ML__placeholder-selected"), r;
}
_serialize(e) {
return e.skipPlaceholders ? "" : "\\placeholder{}";
}
};
var im = ["matrix", "matrix*", "pmatrix", "pmatrix*", "bmatrix", "bmatrix*", "Bmatrix", "Bmatrix*", "vmatrix", "vmatrix*", "Vmatrix", "Vmatrix*"];
var nm = ["cases", "dcases", "rcases"];
var om = ["align", "align*", "aligned", "gather", "gather*", "gathered", "split"];
var jh = ["array", "subequations", "eqnarray"];
function am(t37) {
return jh.concat(om).concat(nm).concat(im).includes(t37);
}
function Sa(t37) {
return im.includes(t37);
}
function sm(t37) {
return nm.includes(t37);
}
function lm(t37) {
return om.includes(t37);
}
function Xh(t37, e, r) {
let i = 0;
for (let c of r)
"align" in c && (i += 1);
let n = 0, o = [];
for (let c of e) {
let u = 0;
for (n = Math.max(n, Math.min(c.length, i)); u < c.length; ) {
let d = [], m = Math.min(c.length, u + i);
for (; u < m; ) {
let h = c[u];
h.length === 0 ? d.push([new y({ type: "first", mode: t37.mode })]) : h[0].type !== "first" ? d.push([new y({ type: "first", mode: t37.mode }), ...h]) : (h.slice(1).some((f) => f.type === "first"), d.push(h)), u += 1;
}
o.push(d);
}
}
o.length > 0 && o[o.length - 1].length === 1 && o[o.length - 1][0].length === 1 && o[o.length - 1][0][0].type === "first" && o.pop();
let a = [];
for (let c of o) {
if (c.length !== n)
for (let u = c.length; u < n; u++)
c.push([new y({ type: "first", mode: t37.mode }), new ge()]);
a.push(c);
}
let s = 0, l = 0;
for (let c of a) {
l = 0;
for (let u of c) {
for (let d of u)
d.parent = t37, d.parentBranch = [s, l];
l += 1;
}
s += 1;
}
return t37.isDirty = true, a;
}
var N = class t7 extends y {
constructor(e, r, i, n = {}) {
var o;
super({ type: "array" }), this.environmentName = e, this.rowGaps = i, n.mathstyleName && (this.mathstyleName = n.mathstyleName), n.columns && (n.columns.length === 0 ? this.colFormat = [{ align: "l" }] : this.colFormat = n.columns), this.colFormat || (this.colFormat = [{ align: "l" }, { align: "l" }, { align: "l" }, { align: "l" }, { align: "l" }, { align: "l" }, { align: "l" }, { align: "l" }, { align: "l" }, { align: "l" }]), this.array = Xh(this, r, this.colFormat), n.leftDelim && (this.leftDelim = n.leftDelim), n.rightDelim && (this.rightDelim = n.rightDelim), n.arraycolsep !== void 0 && (this.arraycolsep = n.arraycolsep), this.colSeparationType = n.colSeparationType, n.arraystretch !== void 0 && (this.arraystretch = n.arraystretch), this.minColumns = (o = n.minColumns) != null ? o : 1;
}
static fromJson(e) {
return new t7(e.environmentName, e.array, e.rowGaps, e);
}
toJson() {
let e = g(p({}, super.toJson()), { environmentName: this.environmentName, array: this.array.map((r) => r.map((i) => i.map((n) => n.toJson()))), rowGaps: this.rowGaps, columns: this.colFormat, colSeparationType: this.colSeparationType });
return this.arraystretch !== void 0 && (e.arraystretch = this.arraystretch), this.arraycolsep !== void 0 && (e.arraycolsep = this.arraycolsep), this.leftDelim && (e.leftDelim = this.leftDelim), this.rightDelim && (e.rightDelim = this.rightDelim), e;
}
branch(e) {
var r;
if (In(e))
return (r = this.array[e[0]][e[1]]) != null ? r : void 0;
}
createBranch(e) {
var r;
return In(e) ? (this.isDirty = true, (r = this.branch(e)) != null ? r : []) : [];
}
get rowCount() {
return this.array.length;
}
get colCount() {
return this.array[0].length;
}
get maxColumns() {
return this.colFormat.filter((e) => !!e.align).length;
}
removeBranch(e) {
if (fr(e))
return super.removeBranch(e);
let [r, ...i] = this.branch(e);
return r.type, this.array[e[0]][e[1]] = void 0, i.forEach((n) => {
n.parent = void 0, n.parentBranch = void 0;
}), this.isDirty = true, i;
}
get hasChildren() {
return this.children.length > 0;
}
get children() {
let e = [];
for (let r of this.array)
for (let i of r)
if (i)
for (let n of i)
e.push(...n.children), e.push(n);
return [...e, ...super.children];
}
render(e) {
var Rt, Zt, pt, be, hn, fn;
let r = new T({ parent: e, mathstyle: this.mathstyleName }, this.style), i = r.getRegisterAsEm("arrayrulewidth"), n = r.getRegisterAsEm("arraycolsep"), o = r.getRegisterAsEm("doublerulesep"), a = (Zt = (Rt = this.arraystretch) != null ? Rt : r.getRegisterAsNumber("arraystretch")) != null ? Zt : 1, s = typeof this.arraycolsep == "number" ? this.arraycolsep : n;
this.colSeparationType === "small" && (s = 0.2778 * (new T({ parent: e, mathstyle: "scriptstyle" }).scalingFactor / e.scalingFactor));
let l = a * A0, c = 0.7 * l, u = 0.3 * l, d = 0, m = [], h = 0, f = this.array.length;
for (let ne = 0; ne < f; ++ne) {
let he = this.array[ne];
h = Math.max(h, he.length);
let Se = new T({ parent: r, mathstyle: this.mathstyleName }, this.style), Je = c / Se.scalingFactor, ht = u / Se.scalingFactor, ft = { cells: [], height: 0, depth: 0, pos: 0 };
for (let Ge of he) {
let ys = (pt = y.createBox(Se, Ge, { type: "ignore" })) != null ? pt : new w(null, { type: "ignore" });
ht = Math.max(ht, ys.depth), Je = Math.max(Je, ys.height), ft.cells.push(ys);
}
let gt = (be = ba(this.rowGaps[ne])) != null ? be : 0;
gt > 0 && (gt += u, ht = Math.max(ht, gt), gt = 0), ne < f - 1 && !Sa(this.environmentName) && this.environmentName !== "cases" && this.environmentName !== "array" && (ht += r.getRegisterAsEm("jot")), ft.height = Je, ft.depth = ht, d += Je, ft.pos = d, d += ht + gt, m.push(ft);
}
let b = d / 2 + Ae, S = [];
for (let ne = 0; ne < h; ne++) {
let he = [];
for (let Se of m) {
let Je = Se.cells[ne];
Je.depth = Se.depth, Je.height = Se.height, he.push({ box: Je, shift: Se.pos - b });
}
he.length > 0 && S.push(new U({ individualShift: he }));
}
let M = [], x = false, v = false, k = 0, C = !this.leftDelim, { colFormat: q } = this;
for (let ne of q) {
if ("align" in ne && k >= S.length)
break;
if ("align" in ne)
x ? M.push(Aa(2 * s)) : (v || C) && M.push(Aa(s)), M.push(new w(S[k], { classes: "col-align-" + ne.align })), k++, x = true, v = false, C = false;
else if ("gap" in ne) {
if (typeof ne.gap == "number")
M.push(Aa(ne.gap));
else {
let he = Zh(e, m, b, ne.gap);
he && M.push(he);
}
x = false, v = false, C = false;
} else if ("separator" in ne) {
let he = new w(null, { classes: "ML__vertical-separator" });
he.height = d, he.setStyle("height", d, "em"), he.setStyle("border-right", `${i}em ${ne.separator} currentColor`), he.setStyle("vertical-align", -(d - b), "em");
let Se = 0;
v ? Se = o - i : x && (Se = s - i), he.left = Se, M.push(he), x = false, v = true, C = false;
}
}
x && !this.rightDelim && M.push(Aa(s));
let B = new w(M, { classes: "ML__mtable" });
if ((!this.leftDelim || this.leftDelim === ".") && (!this.rightDelim || this.rightDelim === "."))
return this.caret && (B.caret = this.caret), this.bind(e, B);
let D = B.height, J = B.depth, de = this.bind(e, new w([this.bind(e, Wr("open", (hn = this.leftDelim) != null ? hn : ".", D, J, r, { isSelected: this.isSelected })), B, this.bind(e, Wr("close", (fn = this.rightDelim) != null ? fn : ".", D, J, r, { isSelected: this.isSelected }))], { type: "ord" }));
return de ? (de.setStyle("display", "inline-block"), this.caret && (de.caret = this.caret), this.bind(e, this.attachSupsub(e, { base: de }))) : null;
}
_serialize(e) {
var i;
let r = [];
if (this.environmentName === "lines" ? r.push("{\\displaylines") : r.push(`\\begin{${this.environmentName}}`), this.environmentName === "array") {
if (r.push("{"), this.colFormat !== void 0)
for (let n of this.colFormat)
"align" in n && typeof n.align == "string" ? r.push(n.align) : "separator" in n && n.separator === "solid" ? r.push("|") : "separator" in n && n.separator === "dashed" && r.push(":");
r.push("}");
}
for (let n = 0; n < this.array.length; n++) {
for (let o = 0; o < this.array[n].length; o++)
o > 0 && r.push(" & "), r.push(y.serialize(this.array[n][o], e));
if (n < this.array.length - 1) {
let o = this.rowGaps[n];
o != null && o.dimension ? r.push(`\\\\[${o.dimension} ${(i = o.unit) != null ? i : "pt"}] `) : r.push("\\\\ ");
}
}
return this.environmentName === "lines" ? r.push("}") : r.push(`\\end{${this.environmentName}}`), K(r);
}
forEachCell(e) {
for (let r = 0; r < this.rowCount; r++)
for (let i = 0; i < this.colCount; i++)
e(this.array[r][i], r, i);
}
getCell(e, r) {
return this.array[e][r];
}
setCell(e, r, i) {
this.type === "array" && Array.isArray(this.array) && this.array[e][r];
for (let o of this.array[e][r])
o.parent = void 0, o.parentBranch = void 0;
let n = i;
(i.length === 0 || i[0].type !== "first") && (n = [new y({ type: "first", mode: this.mode }), ...i]), this.array[e][r] = n;
for (let o of n)
o.parent = this, o.parentBranch = [e, r];
this.isDirty = true;
}
addRowBefore(e) {
this.type === "array" && Array.isArray(this.array);
let r = [];
for (let i = 0; i < this.colCount; i++)
r.push(La(this));
this.array.splice(e, 0, r);
for (let i = e; i < this.rowCount; i++)
for (let n = 0; n < this.colCount; n++) {
let o = this.array[i][n];
if (o)
for (let a of o)
a.parentBranch = [i, n];
}
this.isDirty = true;
}
addRowAfter(e) {
this.type === "array" && Array.isArray(this.array);
let r = [];
for (let i = 0; i < this.colCount; i++)
r.push(La(this));
this.array.splice(e + 1, 0, r);
for (let i = e + 1; i < this.rowCount; i++)
for (let n = 0; n < this.colCount; n++) {
let o = this.array[i][n];
if (o)
for (let a of o)
a.parentBranch = [i, n];
}
this.isDirty = true;
}
removeRow(e) {
this.type === "array" && Array.isArray(this.array) && this.rowCount > e;
let r = this.array.splice(e, 1);
for (let i of r)
for (let n of i)
if (n)
for (let o of n)
o.parent = void 0, o.parentBranch = void 0;
for (let i = e; i < this.rowCount; i++)
for (let n = 0; n < this.colCount; n++) {
let o = this.array[i][n];
if (o)
for (let a of o)
a.parentBranch = [i, n];
}
this.isDirty = true;
}
addColumnBefore(e) {
this.type === "array" && Array.isArray(this.array);
for (let r of this.array)
r.splice(e, 0, La(this));
for (let r = 0; r < this.rowCount; r++)
for (let i = e; i < this.colCount; i++) {
let n = this.array[r][i];
if (n)
for (let o of n)
o.parentBranch = [r, i];
}
this.isDirty = true;
}
addColumnAfter(e) {
this.type === "array" && Array.isArray(this.array);
for (let r of this.array)
r.splice(e + 1, 0, La(this));
for (let r = 0; r < this.rowCount; r++)
for (let i = e + 1; i < this.colCount; i++) {
let n = this.array[r][i];
if (n)
for (let o of n)
o.parentBranch = [r, i];
}
this.isDirty = true;
}
addColumn() {
this.addColumnAfter(this.colCount - 1);
}
removeColumn(e) {
this.type === "array" && Array.isArray(this.array) && this.colCount > e;
for (let r of this.array) {
let i = r.splice(e, 1);
for (let n of i)
if (n)
for (let o of n)
o.parent = void 0, o.parentBranch = void 0;
}
for (let r = 0; r < this.rowCount; r++)
for (let i = e; i < this.colCount; i++) {
let n = this.array[r][i];
if (n)
for (let o of n)
o.parentBranch = [r, i];
}
this.isDirty = true;
}
get cells() {
let e = [];
for (let r of this.array)
for (let i of r)
i && e.push(i.filter((n) => n.type !== "first"));
return e;
}
};
function La(t37) {
let e = new y({ type: "first", mode: t37.mode });
e.parent = t37;
let r = new ge();
return r.parent = t37, [e, r];
}
function Aa(t37) {
let e = new w(null, { classes: "ML__arraycolsep" });
return e.width = t37, e;
}
function Zh(t37, e, r, i) {
if (!i)
return null;
let n = [];
for (let o of e) {
let a = y.createBox(t37, i, { type: "ignore" });
a && (a.depth = o.depth, a.height = o.height, n.push({ box: a, shift: o.pos - r }));
}
return new U({ individualShift: n }).wrap(t37);
}
var qe = class t8 extends y {
constructor(e) {
super({ mode: e.mode, command: e.command, style: e.style, body: e.body, type: "box" }), this.framecolor = e.framecolor, this.backgroundcolor = e.backgroundcolor, this.padding = e.padding, this.offset = e.offset, this.border = e.border;
}
static fromJson(e) {
return new t8(e);
}
toJson() {
return g(p({}, super.toJson()), { framecolor: this.framecolor, backgroundcolor: this.backgroundcolor, padding: this.padding, offset: this.offset, border: this.border });
}
render(e) {
var l, c, u, d;
let r = y.createBox(e, this.body, { type: "lift" });
if (!r)
return null;
let i = e.toEm((l = this.offset) != null ? l : { dimension: 0 });
r.depth += i, r.setStyle("display", "inline-block"), r.setStyle("position", "relative"), r.setStyle("height", Math.floor(100 * r.height + r.depth) / 100, "em"), r.setStyle("vertical-align", -Math.floor(100 * r.height) / 100, "em");
let n = new T({ parent: e }, this.style), o = n.toEm((c = this.padding) != null ? c : { register: "fboxsep" }), a = new w(null, { classes: "ML__box" });
a.height = r.height + o, a.depth = r.depth + o, a.setStyle("box-sizing", "border-box"), a.setStyle("position", "absolute"), a.setStyle("top", -o + 0.3, "em"), a.setStyle("left", 0), a.setStyle("height", a.height + a.depth, "em"), a.setStyle("width", "100%"), this.backgroundcolor && a.setStyle("background-color", (u = n.toColor(this.backgroundcolor)) != null ? u : "transparent"), this.framecolor && a.setStyle("border", `${n.getRegisterAsEm("fboxrule", 2)}em solid ${(d = n.toColor(this.framecolor)) != null ? d : "black"}`), this.border && a.setStyle("border", this.border);
let s = new w([a, r], { type: "lift" });
return s.setStyle("display", "inline-block"), s.setStyle("position", "relative"), s.setStyle("line-height", 0), s.height = r.height + o + (i > 0 ? i : 0), s.depth = r.depth + o + (i < 0 ? -i : 0), s.setStyle("padding-left", o, "em"), s.setStyle("padding-right", o, "em"), s.setStyle("height", Math.floor(100 * (r.height + r.depth + 2 * o + Math.abs(i))) / 100, "em"), s.setStyle("margin-top", -o, "em"), s.setStyle("top", Math.floor(100 * (r.depth - r.height + 2 * o - i)) / 100, "em"), s.setStyle("vertical-align", Math.floor(100 * (r.depth + 2 * o)) / 100, "em"), this.caret && (s.caret = this.caret), this.attachSupsub(e, { base: s });
}
_serialize(e) {
return e.skipStyles ? K([this.bodyToLatex(e), this.supsubToLatex(e)]) : super._serialize(e);
}
};
var $i = class t9 extends y {
constructor(e, r) {
var i;
super({ type: "composition", mode: (i = r == null ? void 0 : r.mode) != null ? i : "math", value: e });
}
static fromJson(e) {
return new t9(e.value, e);
}
toJson() {
return super.toJson();
}
render(e) {
let r = new w(this.value, { classes: "ML__composition", type: "composition" });
return this.bind(e, r), this.caret && (r.caret = this.caret), r;
}
_serialize(e) {
return "";
}
};
var rt = class t10 extends y {
constructor(e) {
super({ type: "error", value: e, command: e, mode: "math" }), this.verbatimLatex = e;
}
static fromJson(e) {
return new t10(e.command);
}
toJson() {
return super.toJson();
}
render(e) {
let r = this.createBox(e, { classes: "ML__error" });
return this.caret && (r.caret = this.caret), r;
}
};
var Vi = class t11 extends y {
constructor(e, r) {
super({ type: "group", mode: r }), this.body = e, this.boxType = e.length > 1 ? "ord" : "ignore", this.skipBoundary = true, this.displayContainsHighlight = false, e && e.length === 1 && e[0].command === "," && (this.captureSelection = true);
}
static fromJson(e) {
return new t11(e.body, e.mode);
}
render(e) {
let r = y.createBox(e, this.body, { type: this.boxType });
return r ? (this.caret && (r.caret = this.caret), this.bind(e, r)) : null;
}
_serialize(e) {
if (!(e.expandMacro || e.skipStyles || e.skipPlaceholders) && typeof this.verbatimLatex == "string")
return this.verbatimLatex;
let r = ee(this.command, this.mode);
return r != null && r.serialize ? r.serialize(this, e) : `{${this.bodyToLatex(e)}}`;
}
};
var H = class t12 extends y {
constructor(e, r, i) {
super({ type: "leftright", style: i.style, displayContainsHighlight: true }), this.variant = e, this.body = r, this.leftDelim = i.leftDelim, this.rightDelim = i.rightDelim;
}
static fromJson(e) {
var r;
return new t12((r = e.variant) != null ? r : "", e.body, e);
}
toJson() {
let e = super.toJson();
return this.variant && (e.variant = this.variant), this.leftDelim && (e.leftDelim = this.leftDelim), this.rightDelim && (e.rightDelim = this.rightDelim), e;
}
_serialize(e) {
var i, n;
let r = this.matchingRightDelim();
return this.variant === "left...right" ? K(["\\left", (i = this.leftDelim) != null ? i : ".", this.bodyToLatex(e), "\\right", r]) : this.variant === "mleft...mright" ? K(["\\mleft", (n = this.leftDelim) != null ? n : ".", this.bodyToLatex(e), "\\mright", r]) : K([!this.leftDelim || this.leftDelim === "." ? "" : this.leftDelim, this.bodyToLatex(e), r]);
}
matchingRightDelim() {
var r, i;
if (this.rightDelim && this.rightDelim !== "?")
return this.rightDelim;
let e = (r = this.leftDelim) != null ? r : ".";
return (i = zi[e]) != null ? i : e;
}
render(e) {
var d, m;
let r = new T({ parent: e }, this.style);
this.body;
let i = new T({ parent: e, mathstyle: "textstyle" }, this.style), n = (d = y.createBox(r, this.body, { type: "inner" })) != null ? d : new w(null, { type: "inner" }), o = n.height / i.scalingFactor, a = n.depth / i.scalingFactor, s = [];
if (this.leftDelim && s.push(this.bind(i, Wr("open", this.leftDelim, o, a, i, { isSelected: this.isSelected, classes: "ML__open" + (this.containsCaret ? " ML__contains-caret" : ""), mode: this.mode, style: this.style }))), n && (cm(n.children, this, r, o, a), s.push(n)), this.rightDelim) {
let h = this.containsCaret ? " ML__contains-caret" : "", f = this.rightDelim;
f === "?" && (r.smartFence ? (f = this.matchingRightDelim(), h += " ML__smart-fence__close") : f = "."), s.push(this.bind(i, Wr("close", f, o, a, i, { isSelected: this.isSelected, classes: h + " ML__close", mode: this.mode, style: this.style })));
}
let l = this.variant === "mleft...mright", c = this.leftSibling;
c && (!l && c.isFunction && (l = true), !l && c.type === "subsup" && ((m = c.leftSibling) != null && m.isFunction) && (l = true));
let u = new w(s, { type: l ? "close" : "inner", classes: "ML__left-right" });
return u.setStyle("margin-top", `${-n.depth}em`), u.setStyle("height", `${n.height + n.depth}em`), this.caret && (u.caret = this.caret), this.bind(r, u.wrap(r));
}
};
function cm(t37, e, r, i, n) {
if (t37)
for (let o = 0; o < t37.length; o++) {
let a = t37[o];
a.type === "middle" ? (t37[o] = e.bind(r, Wr("inner", a.value, i, n, r, { isSelected: e.isSelected })), t37[o].caret = a.caret, t37[o].isSelected = a.isSelected, t37[o].cssId = a.cssId, t37[o].htmlData = a.htmlData, t37[o].htmlStyle = a.htmlStyle, t37[o].attributes = a.attributes, t37[o].cssProperties = a.cssProperties) : a.children && cm(a.children, e, r, i, n);
}
}
var qi = class t13 extends y {
constructor(e, r) {
var i;
super({ type: "macro", command: e, style: r.style }), this.body = r.body, r.captureSelection === void 0 ? r.args ? this.captureSelection = false : this.captureSelection = true : this.captureSelection = r.captureSelection, this.macroArgs = r.args, this.expand = (i = r.expand) != null ? i : false;
}
static fromJson(e) {
return new t13(e.command, e);
}
toJson() {
let e = super.toJson();
return this.expand && (e.expand = true), this.captureSelection !== void 0 && (e.captureSelection = this.captureSelection), this.macroArgs && (e.args = this.macroArgs), e;
}
_serialize(e) {
var r;
return e.expandMacro && this.expand ? this.bodyToLatex(e) : this.command + ((r = this.macroArgs) != null ? r : "");
}
render(e) {
let r = y.createBox(e, this.body, { type: "lift" });
return r ? (this.caret && (r.caret = this.caret), this.bind(e, r)) : null;
}
};
var Ca = class t14 extends y {
constructor() {
super({ type: "macro-argument" });
}
static fromJson(e) {
return new t14();
}
toJson() {
return super.toJson();
}
_serialize(e) {
return "";
}
render(e) {
return null;
}
};
var Hi = class t15 extends y {
constructor(e, r, i = false, n, o) {
var a;
super({ type: "prompt", mode: (a = o == null ? void 0 : o.mode) != null ? a : "math", style: o == null ? void 0 : o.style, command: "\\placeholder" }), this.body = n, this.correctness = r, this.placeholderId = e, this.locked = i, this.captureSelection = this.locked;
}
static fromJson(e) {
return new t15(e.placeholderId, e.correctness, e.locked, e.body, e);
}
toJson() {
let e = super.toJson();
return this.placeholderId && (e.placeholderId = this.placeholderId), this.body || delete e.body, this.body && (e.body = this.body.filter((r) => r.type !== "first").map((r) => r.toJson())), this.correctness && (e.correctness = this.correctness), e.locked = this.locked, e;
}
render(e) {
let r = new T({ parent: e }), i = r.getRegisterAsEm("fboxsep"), n = i, o = i, a = y.createBox(e, this.body);
if (!a)
return null;
a.height || (a.height = r.metrics.xHeight), a.setStyle("vertical-align", -a.height, "em"), this.correctness === "correct" ? a.setStyle("color", "var(--correct-color, var(--ML__correct-color))") : this.correctness === "incorrect" && a.setStyle("color", "var(--incorrect-color, var(--ML__incorrect-color))");
let s = new w(a, { type: "ord" });
s.setStyle("display", "inline-block"), s.setStyle("height", a.height + a.depth, "em"), s.setStyle("vertical-align", -o, "em");
let l = "ML__prompt ";
this.locked ? l += " ML__lockedPromptBox " : l += " ML__editablePromptBox ", this.correctness === "correct" ? l += " ML__correctPromptBox " : this.correctness === "incorrect" && (l += " ML__incorrectPromptBox "), this.containsCaret && (l += " ML__focusedPromptBox ");
let c = new w(null, { classes: l, attributes: { part: "prompt" } });
c.height = s.height + o, c.depth = s.depth + o, c.width = s.width + 2 * n, c.setStyle("position", "absolute"), c.setStyle("height", `calc(${s.height + s.depth + 2 * o}em - 2px)`), n === 0 && c.setStyle("width", "100%"), n !== 0 && (c.setStyle("width", `calc(100% + ${2 * n}em)`), c.setStyle("top", i, "em"), c.setStyle("left", -n, "em")), (!this.body || this.body.length === 1) && (c.width = 3 * n, c.setStyle("width", `calc(100% + ${3 * n}em)`), c.setStyle("left", -1.5 * n, "em"));
let u = "";
this.correctness === "incorrect" && (u += '<line x1="3%" y1="97%" x2="97%" y2="3%" stroke-width="0.5" stroke="var(--incorrect-color, var(--ML__incorrect-color))" stroke-linecap="round" />'), u && (c.svgOverlay = u);
let d = new w([c, s], { classes: "ML__prompt-atom" });
return s.setStyle("line-height", 1), d.setStyle("position", "relative"), d.setStyle("display", "inline-block"), d.setStyle("line-height", 0), d.height = s.height + o + 0.2, d.depth = s.depth + o, d.left = n, d.right = n, d.setStyle("height", s.height + o, "em"), d.setStyle("top", s.depth - s.height, "em"), d.setStyle("vertical-align", s.depth + o, "em"), d.setStyle("margin-left", 0.5, "em"), d.setStyle("margin-right", 0.5, "em"), this.caret && (d.caret = this.caret), this.bind(r, this.attachSupsub(e, { base: d }));
}
_serialize(e) {
var n;
let r = (n = this.bodyToLatex(e)) != null ? n : "";
if (e.skipPlaceholders)
return r;
let i = "\\placeholder";
return this.placeholderId && (i += `[${this.placeholderId}]`), this.correctness === "correct" ? i += "[correct]" : this.correctness === "incorrect" && (i += "[incorrect]"), this.locked && (i += "[locked]"), I(i, r);
}
};
var Wt = class t16 extends y {
constructor(e) {
super({ type: "subsup", style: e == null ? void 0 : e.style }), this.subsupPlacement = "auto";
}
static fromJson(e) {
let r = new t16(e);
for (let i of gr)
e[i] && r.setChildren(e[i], i);
return r;
}
render(e) {
var a;
let r = new T({ parent: e, isPhantom: true }), i = this.leftSibling, n = (a = i.render(r)) != null ? a : new w(null), o = new w(null);
return o.height = n.height, o.depth = n.depth, this.attachSupsub(e, { base: o, isCharacterBox: i.isCharacterBox(), type: "ignore" });
}
_serialize(e) {
return this.supsubToLatex(e);
}
};
function Wi(t37) {
return t37 ? !/^(<$$>|<$>|<space>|<{>|<}>|#[0-9\?]|\\.+)$/.test(t37) : false;
}
var Ea = class {
constructor(e, r, i) {
this.errors = [];
this.index = 0;
this.endCount = 0;
var n, o, a, s;
i != null || (i = {}), this.tokens = e, this.context = r instanceof T && !(i != null && i.parseMode) && !i.mathstyle ? r : new T({ from: r, mathstyle: i.mathstyle }, i.style), this.args = (n = i.args) != null ? n : void 0, this.smartFence = this.context.smartFence, this.parsingContext = { parent: void 0, mathlist: [], style: (o = i.style) != null ? o : {}, parseMode: (a = i.parseMode) != null ? a : "math", mathstyle: (s = i.mathstyle) != null ? s : "displaystyle", tabular: false };
}
beginContext(e) {
var n, o, a;
let r = this.parsingContext, i = { parent: r, mathlist: [], style: p({}, r.style), parseMode: (n = e == null ? void 0 : e.mode) != null ? n : r.parseMode, mathstyle: (o = e == null ? void 0 : e.mathstyle) != null ? o : r.mathstyle, tabular: (a = e == null ? void 0 : e.tabular) != null ? a : false };
this.parsingContext = i;
}
endContext() {
this.parsingContext = this.parsingContext.parent;
}
onError(e) {
this.errors.push(p({ before: ur(this.tokens.slice(this.index, this.index + 10)), after: ur(this.tokens.slice(Math.max(0, this.index - 10), this.index)) }, e));
}
get mathlist() {
return this.parsingContext.mathlist;
}
set mathlist(e) {
this.parsingContext.mathlist = e;
}
get parseMode() {
return this.parsingContext.parseMode;
}
set parseMode(e) {
this.parsingContext.parseMode = e;
}
get tabularMode() {
return this.parsingContext.tabular;
}
get style() {
let e = this.parsingContext;
for (; e; ) {
if (e.style)
return p({}, e.style);
e = e.parent;
}
return {};
}
set style(e) {
this.parsingContext.style = e;
}
end() {
return this.endCount++, this.index >= this.tokens.length || this.endCount > 1e3;
}
next() {
this.index += 1;
}
get() {
return this.endCount = 0, this.index < this.tokens.length ? this.tokens[this.index++] : "";
}
peek() {
return this.tokens[this.index];
}
expandUnicode() {
if (!this.peek() || this.parseMode !== "math")
return;
let e = Tc(this.peek());
e && this.tokens.splice(this.index, 1, ...Ki(e));
}
match(e) {
return this.tokens[this.index] === e ? (this.index++, true) : false;
}
lastSubsupAtom() {
let e;
return this.mathlist.length > 0 && (e = this.mathlist[this.mathlist.length - 1], e.type === "subsup" || e.subsupPlacement !== void 0) || (e = new Wt({ style: this.style }), this.mathlist.push(e)), e;
}
hasPattern(e) {
return e.test(this.tokens[this.index]);
}
hasInfixCommand() {
var r;
let { index: e } = this;
if (e < this.tokens.length && this.tokens[e].startsWith("\\")) {
let i = ee(this.tokens[e], this.parseMode);
return !i || i.definitionType === "symbol" || i.ifMode && !i.ifMode.includes(this.parseMode) ? false : (r = i.infix) != null ? r : false;
}
return false;
}
matchColumnSeparator() {
return !this.tabularMode || this.peek() !== "&" ? false : (this.index++, true);
}
matchRowSeparator() {
if (!this.tabularMode)
return false;
let e = this.peek();
return e !== "\\\\" && e !== "\\cr" && e !== "\\tabularnewline" ? false : (this.index++, true);
}
placeholder() {
var r;
let e = (r = this.args) == null ? void 0 : r.call(this, "?");
return e ? se(e, { parseMode: this.parseMode, mathstyle: "textstyle" }) : [new ge({ mode: this.parseMode, style: this.style })];
}
skipWhitespace() {
for (; this.match("<space>"); )
;
}
skipUntilToken(e) {
let r = this.tokens[this.index];
for (; r && r !== e; )
r = this.tokens[++this.index];
r === e && this.index++;
}
skipFiller() {
for (; this.match("\\relax") || this.match("<space>"); )
;
}
matchKeyword(e) {
let r = this.index, i = this.end(), n = "";
for (; !i; ) {
let a = this.get();
Wi(a) ? (n += a, i = this.end() || n.length >= e.length) : i = true;
}
let o = e.toUpperCase() === n.toUpperCase();
return o || (this.index = r), o;
}
scanString() {
let e = "";
for (; !this.end(); ) {
let r = this.peek();
if (r === "]")
return e;
if (r === "<space>")
e += " ";
else if (r.startsWith("\\"))
this.onError({ code: "unexpected-command-in-string" }), e += r.substring(1);
else if (Wi(r))
e += r;
else
return e;
this.next();
}
return e;
}
scanBalancedString() {
let e = "", r = this.end(), i = 1;
for (; !r; ) {
let n = this.get();
n === "<space>" ? e += " " : n === "<{>" ? (e += "{", i += 1) : n === "<}>" ? (i -= 1, i > 0 ? e += "}" : this.index -= 1) : n === "<$>" ? e += "$" : n === "<$$>" ? e += "$$" : e += n, r = i === 0 || this.end();
}
return e;
}
scanLiteralGroup() {
var i;
if (!this.match("<{>"))
return "";
let e = "", r = 1;
for (; r > 0 && !this.end(); ) {
let n = this.get();
n === "<}>" ? (r -= 1, r > 0 && (e += "}")) : n === "<{>" ? (r += 1, e += "{") : (/\\[a-zA-Z]+$/.test(e) && /^[a-zA-Z]/.test(n) && (e += " "), e += (i = { "<space>": " ", "<$$>": "$$", "<$>": "$" }[n]) != null ? i : n);
}
return e;
}
scanNumber(e = true) {
var l, c;
let r = false, i = this.peek();
for (; i === "<space>" || i === "+" || i === "-"; )
this.get(), i === "-" && (r = !r), i = this.peek();
e = !!e;
let n = 10, o = /\d/;
if (this.match("'"))
n = 8, o = /[0-7]/, e = true;
else if (this.match('"'))
n = 16, o = /[\dA-F]/, e = true;
else if (this.match("x"))
n = 16, o = /[\dA-Fa-f]/, e = true;
else if (this.match("`"))
return i = this.get(), i ? i.length === 2 && i.startsWith("\\") ? { number: (r ? -1 : 1) * ((l = i.codePointAt(1)) != null ? l : 0), base: "alpha" } : { number: (r ? -1 : 1) * ((c = i.codePointAt(0)) != null ? c : 0), base: "alpha" } : null;
let a = "";
for (; this.hasPattern(o); )
a += this.get();
if (!e && (this.match(".") || this.match(",")))
for (a += "."; this.hasPattern(o); )
a += this.get();
let s = e ? Number.parseInt(a, n) : Number.parseFloat(a);
return Number.isNaN(s) ? null : { number: r ? -s : s, base: n === 16 ? "hexadecimal" : n === 8 ? "octal" : "decimal" };
}
scanRegister() {
var o;
let e = this.index, r = this.scanNumber(false);
if (this.skipWhitespace(), this.match("\\relax"))
return r;
let i = false;
if (r === null)
for (; ; ) {
let a = this.peek();
if (a === "-")
i = !i;
else if (a !== "+")
break;
this.next(), this.skipWhitespace();
}
if (this.match("\\global")) {
this.skipWhitespace();
let a = this.get();
return a.startsWith("\\") ? r ? { register: a, global: true, factor: (i ? -1 : 1) * r.number } : i ? { register: a, global: true, factor: -1 } : { register: a, global: true } : (this.index = e, null);
}
let n = this.get();
return n != null && n.startsWith("\\") ? (n = n.substring(1), this.context.registers[n] ? !i || r !== null ? { register: n, factor: (i ? -1 : 1) * ((o = r == null ? void 0 : r.number) != null ? o : 1) } : { register: n } : (this.index = e, null)) : (this.index = e, null);
}
scanValue() {
let e = this.scanRegister();
if (e)
return e;
let r = this.index, i = this.scanGlueOrDimen();
if (i && ("unit" in i || "glue" in i && "unit" in i.glue))
return i;
this.index = r;
let n = this.scanNumber();
if (n)
return n;
if (this.end() || !Wi(this.peek()))
return null;
let o = this.scanString();
return o.length > 0 ? { string: o } : null;
}
scanDimen() {
let e = this.scanNumber(false);
if (e === null)
return null;
let r = e.number;
this.skipWhitespace(), this.matchKeyword("true"), this.skipWhitespace();
let i;
return this.matchKeyword("pt") ? i = "pt" : this.matchKeyword("mm") ? i = "mm" : this.matchKeyword("cm") ? i = "cm" : this.matchKeyword("ex") ? i = "ex" : this.matchKeyword("px") ? i = "px" : this.matchKeyword("em") ? i = "em" : this.matchKeyword("bp") ? i = "bp" : this.matchKeyword("dd") ? i = "dd" : this.matchKeyword("pc") ? i = "pc" : this.matchKeyword("in") ? i = "in" : this.matchKeyword("mu") && (i = "mu"), i ? { dimension: r, unit: i } : { dimension: r };
}
scanGlueOrDimen() {
let e = this.scanDimen();
if (e === null)
return null;
if (this.skipWhitespace(), this.match("\\relax"))
return e;
let r = { glue: e };
if (this.matchKeyword("plus")) {
let i = this.scanDimen();
if (i)
r.grow = i;
else
return r;
}
if (this.skipWhitespace(), this.match("\\relax"))
return r;
if (this.skipWhitespace(), this.matchKeyword("minus")) {
let i = this.scanDimen();
if (i)
r.shrink = i;
else
return r;
}
return !r.grow && !r.shrink ? e : r;
}
scanColspec() {
this.skipWhitespace();
let e = [];
for (; !this.end() && !(this.peek() === "<}>" || this.peek() === "]"); ) {
let r = this.get();
r === "c" || r === "r" || r === "l" ? e.push({ align: r }) : r === "|" ? e.push({ separator: "solid" }) : r === ":" ? e.push({ separator: "dashed" }) : r === "@" && (this.match("<{>") && (this.beginContext({ mode: "math" }), e.push({ gap: this.scan((i) => i === "<}>") }), this.endContext()), this.match("<}>") || this.onError({ code: "unbalanced-braces" }));
}
return e;
}
scanModeSet() {
let e;
if (this.match("\\(") && (e = "textstyle"), !e && this.match("\\[") && (e = "displaystyle"), !e)
return null;
this.beginContext({ mode: "math", mathstyle: e });
let r = this.scan((i) => i === (e === "displaystyle" ? "\\]" : "\\)"));
return this.match(e === "displaystyle" ? "\\]" : "\\)") || this.onError({ code: "unbalanced-mode-shift" }), this.endContext(), r;
}
scanModeShift() {
let e = "";
if (this.match("<$>") && (e = "<$>"), !e && this.match("<$$>") && (e = "<$$>"), !e)
return null;
this.beginContext({ mode: "math", mathstyle: "textstyle" });
let r = this.scan((i) => i === e);
return this.match(e) || this.onError({ code: "unbalanced-mode-shift" }), this.endContext(), r;
}
scanEnvironment() {
if (!this.match("\\begin"))
return null;
let e = this.scanArgument("string");
if (!e)
return null;
let r = Oc(e);
if (!r)
return this.onError({ code: "unknown-environment", arg: e }), null;
let i = [];
if (r.params)
for (let l of r.params)
if (l.isOptional)
i.push(this.scanOptionalArgument(l.type));
else {
let c = this.scanArgument(l.type);
c || this.onError({ code: "missing-argument", arg: e }), i.push(c);
}
this.beginContext({ tabular: r.tabular });
let n = [], o = [], a = [], s = false;
do
if (this.end() && (this.onError({ code: "unbalanced-environment", arg: e }), s = true), !s && this.match("\\end") && (this.scanArgument("string") !== e && this.onError({ code: "unbalanced-environment", arg: e }), s = true), !s)
if (this.matchColumnSeparator())
a.push(this.mathlist), this.mathlist = [];
else if (this.matchRowSeparator()) {
a.push(this.mathlist), this.mathlist = [];
let l = null;
this.skipWhitespace(), this.match("[") && (l = this.scanDimen(), this.skipWhitespace(), this.match("]")), o.push(l != null ? l : { dimension: 0 }), n.push(a), a = [];
} else
this.mathlist.push(...this.scan((l) => ["<}>", "&", "\\end", "\\cr", "\\\\", "\\tabularnewline"].includes(l)));
while (!s);
return a.push(this.mathlist), a.length > 0 && n.push(a), this.endContext(), r.createAtom(e, n, o, i, this.context.maxMatrixCols);
}
scanExpression() {
let e = this.mathlist;
if (this.mathlist = [], this.parseExpression()) {
let r = this.mathlist;
return this.mathlist = e, r;
}
return this.mathlist = e, null;
}
scan(e) {
this.beginContext(), e || (e = (s) => s === "<}>");
let r = "", i = null, n = [], o = null;
for (; !this.end() && !e(this.peek()); )
this.hasInfixCommand() && !r ? (r = this.get(), i = ee(r, "math"), i && (n = this.scanArguments(i)[1]), o = this.mathlist, this.mathlist = []) : this.parseExpression();
let a;
return r ? (n.unshift(this.mathlist), o && n.unshift(o), a = [i.createAtom({ command: r, args: n, style: this.style, mode: this.parseMode })]) : a = this.mathlist, this.endContext(), a;
}
scanGroup() {
let e = this.index;
if (!this.match("<{>"))
return null;
let r = this.scan((n) => n === "<}>");
this.match("<}>") || this.onError({ code: "unbalanced-braces" });
let i = new Vi(r, this.parseMode);
return i.verbatimLatex = ur(this.tokens.slice(e, this.index)), i;
}
scanSmartFence() {
if (this.skipWhitespace(), !this.match("("))
return null;
this.beginContext();
let e = 1;
for (; !this.end() && e !== 0; )
this.match("(") && (e += 1), this.match(")") && (e -= 1), e !== 0 && this.parseExpression();
let r = new H("", this.mathlist, { leftDelim: "(", rightDelim: e === 0 ? ")" : "?" });
return this.endContext(), r;
}
scanDelim() {
this.skipWhitespace();
let e = this.peek();
if (!e)
return this.onError({ code: "unexpected-end-of-string" }), null;
if (!Wi(e) && !e.startsWith("\\"))
return null;
this.next();
let r = ee(e, "math");
return r ? r.definitionType === "function" && r.ifMode && !r.ifMode.includes(this.parseMode) ? (this.onError({ code: "unexpected-delimiter", arg: e }), null) : r.definitionType === "symbol" && (r.type === "mopen" || r.type === "mclose") || /^(\.|\?|\||<|>|\\vert|\\Vert|\\\||\\surd|\\uparrow|\\downarrow|\\Uparrow|\\Downarrow|\\updownarrow|\\Updownarrow|\\mid|\\mvert|\\mVert)$/.test(e) ? e : (this.onError({ code: "unexpected-delimiter", arg: e }), null) : (this.onError({ code: "unknown-command", arg: e }), null);
}
scanLeftRight() {
var o;
if (this.match("\\right"))
return this.onError({ code: "unbalanced-braces" }), new rt("\\right");
if (this.match("\\mright"))
return this.onError({ code: "unbalanced-braces" }), new rt("\\mright");
let e = "\\right";
if (!this.match("\\left")) {
if (!this.match("\\mleft"))
return null;
e = "\\mright";
}
let r = this.scanDelim();
if (!r)
return this.onError({ code: "unexpected-delimiter" }), new rt(e === "\\right" ? "\\left" : "\\mleft");
for (this.beginContext(); !this.end() && !this.match(e); )
this.parseExpression();
let i = this.mathlist;
this.endContext();
let n = (o = this.scanDelim()) != null ? o : ".";
return new H(e === "\\right" ? "left...right" : "mleft...mright", i, { leftDelim: r, rightDelim: n, style: this.style });
}
parseSupSub() {
if (this.parseMode !== "math")
return false;
let e = this.peek();
if (e !== "^" && e !== "_" && e !== "'")
return false;
let r = this.lastSubsupAtom();
for (; e === "^" || e === "_" || e === "'"; )
this.match("'") ? this.match("'") ? r.addChild(new y({ type: "mord", command: "\\doubleprime", mode: "math", value: "\u2032\u2032" }), "superscript") : r.addChild(new y({ type: "mord", command: "\\prime", mode: "math", value: "\u2032" }), "superscript") : (this.match("^") || this.match("_")) && r.addChildren(A(this.scanArgument("expression")), e === "_" ? "subscript" : "superscript"), e = this.peek();
return true;
}
parseLimits() {
if (this.parseMode !== "math")
return false;
let e = this.match("\\limits"), r = !e && this.match("\\nolimits"), i = !r && !e && this.match("\\displaylimits");
if (!e && !r && !i)
return false;
let n = this.mathlist.length > 0 ? this.mathlist[this.mathlist.length - 1] : null;
return n === null ? false : (n.explicitSubsupPlacement = true, e && (n.subsupPlacement = "over-under"), r && (n.subsupPlacement = "adjacent"), i && (n.subsupPlacement = "auto"), true);
}
scanArguments(e) {
if (!(e != null && e.params))
return [void 0, []];
let r, i = [], n = e.infix ? 2 : 0;
for (; n < e.params.length; ) {
let o = e.params[n];
o.type === "rest" ? i.push(this.scan((a) => ["<}>", "&", "\\end", "\\cr", "\\\\", "\\tabularnewline", "\\right"].includes(a))) : o.isOptional ? i.push(this.scanOptionalArgument(o.type)) : o.type.endsWith("*") ? r = o.type.slice(0, -1) : i.push(this.scanArgument(o.type)), n += 1;
}
return [r, i];
}
scanSymbolOrLiteral() {
let e = this.peek();
if (!e)
return null;
this.next();
let r;
if (Wi(e)) {
let i = ce.createAtom(this.parseMode, e, p({}, this.style));
return i ? [i] : null;
}
if (r = this.scanMacro(e), r)
return [r];
if (e.startsWith("\\")) {
let i = ee(e, this.parseMode);
if (!i)
return this.onError({ code: "unknown-command", arg: e }), [new rt(e)];
if (i.definitionType === "symbol") {
let n = p({}, this.style);
i.variant && (n.variant = i.variant), r = new y({ type: i.type, command: e, style: n, value: String.fromCodePoint(i.codepoint), mode: this.parseMode, verbatimLatex: e });
} else {
if (i.applyMode || i.applyStyle || i.infix)
return this.onError({ code: "invalid-command", arg: e }), [new rt(e)];
i.createAtom && (r = i.createAtom({ command: e, args: [], style: this.style, mode: this.parseMode }));
}
}
return r ? [r] : null;
}
scanArgument(e) {
var n;
this.skipFiller();
let r = this.parseMode;
if (e === "auto" && (e = r), !this.match("<{>")) {
if (e === "string")
return this.scanString();
if (e === "value")
return this.scanValue();
if (e === "delim")
return (n = this.scanDelim()) != null ? n : ".";
if (e === "expression")
return this.scanExpression();
if (e === "math") {
e !== r && this.beginContext({ mode: "math" });
let o = this.scanSymbolOrLiteral();
return e !== r && this.endContext(), o;
}
if (e === "text") {
e !== r && this.beginContext({ mode: "text" });
let o = this.scanSymbolOrLiteral();
return e !== r && this.endContext(), o;
}
return e === "balanced-string" ? null : e === "rest" ? this.scan((o) => ["<}>", "&", "\\end", "\\cr", "\\\\", "\\tabularnewline", "\\right"].includes(o)) : null;
}
if (e === "text") {
this.beginContext({ mode: "text" });
do
this.mathlist.push(...this.scan());
while (!this.match("<}>") && !this.end());
let o = this.mathlist;
return this.endContext(), { group: o };
}
if (e === "math") {
this.beginContext({ mode: "math" });
do
this.mathlist.push(...this.scan());
while (!this.match("<}>") && !this.end());
let o = this.mathlist;
return this.endContext(), { group: o };
}
let i = null;
if (e === "expression") {
this.beginContext({ mode: "math" });
do
this.mathlist.push(...this.scan());
while (!this.match("<}>") && !this.end());
let o = this.mathlist;
return this.endContext(), { group: o };
}
return e === "string" ? i = this.scanString() : e === "balanced-string" ? i = this.scanBalancedString() : e === "colspec" ? i = this.scanColspec() : e === "value" && (i = this.scanValue()), this.skipUntilToken("<}>"), i;
}
scanOptionalArgument(e) {
if (e = e === "auto" ? this.parseMode : e, this.skipFiller(), !this.match("["))
return null;
let r = null;
for (; !this.end() && !this.match("]"); )
if (e === "string")
r = this.scanString();
else if (e === "value")
r = this.scanValue();
else if (e === "colspec")
r = this.scanColspec();
else if (e === "bbox") {
let i = {}, n = this.scanString().toLowerCase().trim().split(/,(?![^(]*\)(?:(?:[^(]*\)){2})*[^"]*$)/);
for (let o of n) {
let a = o.match(/^\s*([\d.]+)\s*([a-z]{2})/);
if (a)
i.padding = { dimension: parseInt(a[1]), unit: a[2] };
else {
let s = o.match(/^\s*border\s*:\s*(.*)/);
s ? i.border = s[1] : i.backgroundcolor = { string: o };
}
}
r = i;
} else
e === "math" && (this.beginContext({ mode: "math" }), r = this.mathlist.concat(this.scan((i) => i === "]")), this.endContext());
return r;
}
scanSymbolOrCommand(e) {
var o, a, s;
if (e === "\\placeholder") {
let l = this.scanOptionalArgument("string"), c = this.scanOptionalArgument("math"), u = y.serialize(c, { defaultMode: "math" }), d = [], m;
!m && u === "correct" ? m = "correct" : !m && u === "incorrect" ? m = "incorrect" : u !== "" && (d = c);
let h = this.scanOptionalArgument("string") === "locked", f = this.scanArgument("auto"), b;
return f && Array.isArray(f) && f.length > 0 ? b = f : f && typeof f == "object" && "group" in f ? b = f.group : b = d, l ? [new Hi(l, m, h, b != null ? b : d, { mode: this.parseMode, style: this.style })] : [new ge({ mode: this.parseMode, style: this.style })];
}
if (e === "\\renewcommand" || e === "\\newcommand" || e === "\\providecommand" || e === "\\def") {
let l = this.index, c = this.scanLiteralGroup() || this.next();
if (!c)
return null;
if (this.context.registers[c.substring(1)]) {
let u = this.scanArgument("string");
u !== null && (this.context.registers[c.substring(1)] = u);
let d = K([e, ur(this.tokens.slice(l, this.index))]);
return [new y({ type: "text", value: "", verbatimLatex: d })];
}
}
let r = this.scanMacro(e);
if (r)
return [r];
let i = ee(e, this.parseMode);
if (!i)
return this.parseMode === "text" ? (/[a-zA-Z]/.test((o = this.peek()) != null ? o : "") && (e += " "), [...e].map((l) => new y({ type: "text", value: l, mode: "text", style: this.style }))) : (this.onError({ code: "unknown-command", arg: e }), [new rt(e)]);
let n = this.index;
if (i.definitionType === "symbol") {
let l = p({}, this.style);
i.variant && (l.variant = i.variant), r = new y({ type: i.type, command: e, style: l, value: String.fromCodePoint(i.codepoint), mode: this.parseMode });
} else {
if (i.ifMode && !i.ifMode.includes(this.parseMode))
return [];
let l = this.parseMode;
i.applyMode && (this.parseMode = i.applyMode);
let c, u = [];
if (i.parse ? u = i.parse(this) : [c, u] = this.scanArguments(i), this.parseMode = l, i.applyMode && !i.applyStyle && !i.createAtom)
return A(u[0]);
if (i.infix)
return this.onError({ code: "too-many-infix-commands", arg: e }), null;
if (typeof i.createAtom == "function")
r = i.createAtom({ command: e, args: u, style: this.style, mode: this.parseMode }), c && (r.body = A(this.scanArgument(c)));
else if (typeof i.applyStyle == "function") {
let d = i.applyStyle(this.style, e, u, this.context), m = this.parseMode;
if (i.applyMode && (this.parseMode = i.applyMode), c) {
let h = this.style;
this.style = d;
let f = this.scanArgument(c);
return this.style = h, this.parseMode = m, A(f);
}
this.style = d;
} else
r = new y({ type: "mord", command: (a = i.command) != null ? a : e, style: p({}, this.style), value: e, mode: (s = i.applyMode) != null ? s : this.parseMode });
}
if (!r)
return null;
if (r instanceof y && r.verbatimLatex === void 0 && !/^\\(llap|rlap|class|cssId|htmlData)$/.test(e)) {
let l = K([e, ur(this.tokens.slice(n, this.index))]);
l && (r.verbatimLatex = l);
}
if (r.verbatimLatex === null && (r.verbatimLatex = void 0), r.isFunction && this.smartFence) {
let l = this.scanSmartFence();
if (l)
return [r, l];
}
return [r];
}
scanSymbolCommandOrLiteral() {
this.expandUnicode();
let e = this.get();
if (!e)
return null;
if (Wi(e)) {
let r = ce.createAtom(this.parseMode, e, p({}, this.style));
if (!r)
return null;
if (r.isFunction && this.smartFence) {
let i = this.scanSmartFence();
if (i)
return [r, i];
}
return [r];
}
return e.startsWith("\\") ? this.scanSymbolOrCommand(e) : e === "<space>" ? this.parseMode === "text" ? [new Be(" ", " ", this.style)] : null : (e === "<}>" ? this.onError({ latex: "", code: "unbalanced-braces" }) : this.onError({ latex: "", code: "unexpected-token", arg: e }), null);
}
scanMacro(e) {
var a;
let r = this.context.getMacro(e);
if (!r)
return null;
let i = this.index, n = r.args, o = { "?": (a = this.args) == null ? void 0 : a.call(this, "?") };
for (let s = 1; s <= n; s++) {
let l = this.scanLiteralGroup();
if (!l) {
let c = this.index;
this.scanExpression(), l = ur(this.tokens.slice(c, this.index));
}
o[s] = l;
}
return new qi(e, { expand: r.expand, captureSelection: r.captureSelection, args: i === this.index ? null : ur(this.tokens.slice(i, this.index)), style: this.parsingContext.style, body: se(r.def, { context: this.context, parseMode: this.parseMode, args: (s) => o[s], mathstyle: this.parsingContext.mathstyle, style: this.parsingContext.style }) });
}
parseExpression() {
var r, i, n, o;
let e = (o = (n = (i = (r = this.scanEnvironment()) != null ? r : this.scanModeShift()) != null ? i : this.scanModeSet()) != null ? n : this.scanGroup()) != null ? o : this.scanLeftRight();
if (e === null) {
if (this.parseSupSub() || this.parseLimits())
return true;
e = this.scanSymbolCommandOrLiteral();
}
return e ? (X(e) ? this.mathlist.push(...e) : this.mathlist.push(e), true) : false;
}
};
function se(t37, e) {
var o, a, s, l;
let r = (o = e == null ? void 0 : e.args) != null ? o : void 0, i = new Ea(Ki(t37, r), e == null ? void 0 : e.context, { args: r, mathstyle: (a = e == null ? void 0 : e.mathstyle) != null ? a : "displaystyle", parseMode: (s = e == null ? void 0 : e.parseMode) != null ? s : "math", style: (l = e == null ? void 0 : e.style) != null ? l : {} }), n = [];
for (; !i.end(); )
n.push(...i.scan(() => false));
return n;
}
function Ta(t37, e) {
var i;
let r = new Ea(Ki(t37, null), e == null ? void 0 : e.context, { mathstyle: "displaystyle", parseMode: (i = e == null ? void 0 : e.parseMode) != null ? i : "math" });
for (; !r.end(); )
r.scan();
return r.errors;
}
var Nn = class t17 extends y {
constructor(e, r) {
super({ type: "chem" }, { command: e, mode: "math" });
let i = re.go(L.go(r, e === "\\pu" ? "pu" : "ce"), false);
this.body = se(i), this._verbatimLatex = e + "{" + r + "}", this.arg = r, this.captureSelection = true;
}
static fromJson(e) {
return new t17(e.command, e.arg);
}
set verbatimLatex(e) {
}
get verbatimLatex() {
return this._verbatimLatex;
}
toJson() {
return g(p({}, super.toJson()), { arg: this.arg });
}
render(e) {
let r = y.createBox(e, this.body, { type: "inner" });
return this.caret && (r.caret = this.caret), this.bind(e, r);
}
_serialize(e) {
return this.verbatimLatex, this.verbatimLatex;
}
};
_(["ce", "pu"], "{chemformula:balanced-string}", { createAtom: (t37) => {
var e;
return new Nn(t37.command, (e = t37.args[0]) != null ? e : "");
} });
var L = { go: function(t37, e) {
if (!t37)
return [];
e === void 0 && (e = "ce");
var r = "0", i = {};
i.parenthesisLevel = 0, t37 = t37.replace(/\n/g, " "), t37 = t37.replace(/[\u2212\u2013\u2014\u2010]/g, "-"), t37 = t37.replace(/[\u2026]/g, "...");
for (var n, o = 10, a = []; ; ) {
n !== t37 ? (o = 10, n = t37) : o--;
var s = L.stateMachines[e], l = s.transitions[r] || s.transitions["*"];
e:
for (var c = 0; c < l.length; c++) {
var u = L.patterns.match_(l[c].pattern, t37);
if (u) {
for (var d = l[c].task, m = 0; m < d.action_.length; m++) {
var h;
if (s.actions[d.action_[m].type_])
h = s.actions[d.action_[m].type_](i, u.match_, d.action_[m].option);
else if (L.actions[d.action_[m].type_])
h = L.actions[d.action_[m].type_](i, u.match_, d.action_[m].option);
else
throw ["MhchemBugA", "mhchem bug A. Please report. (" + d.action_[m].type_ + ")"];
L.concatArray(a, h);
}
if (r = d.nextState || r, t37.length > 0) {
if (d.revisit || (t37 = u.remainder), !d.toContinue)
break e;
} else
return a;
}
}
if (o <= 0)
throw ["MhchemBugU", "mhchem bug U. Please report."];
}
}, concatArray: function(t37, e) {
if (e)
if (Object.prototype.toString.call(e) === "[object Array]")
for (var r = 0; r < e.length; r++)
t37.push(e[r]);
else
t37.push(e);
}, patterns: { patterns: { empty: /^$/, else: /^./, else2: /^./, space: /^\s/, "space A": /^\s(?=[A-Z\\$])/, space$: /^\s$/, "a-z": /^[a-z]/, x: /^x/, x$: /^x$/, i$: /^i$/, letters: /^(?:[a-zA-Z\u03B1-\u03C9\u0391-\u03A9?@]|(?:\\(?:alpha|beta|gamma|delta|epsilon|zeta|eta|theta|iota|kappa|lambda|mu|nu|xi|omicron|pi|rho|sigma|tau|upsilon|phi|chi|psi|omega|Gamma|Delta|Theta|Lambda|Xi|Pi|Sigma|Upsilon|Phi|Psi|Omega)(?:\s+|\{\}|(?![a-zA-Z]))))+/, "\\greek": /^\\(?:alpha|beta|gamma|delta|epsilon|zeta|eta|theta|iota|kappa|lambda|mu|nu|xi|omicron|pi|rho|sigma|tau|upsilon|phi|chi|psi|omega|Gamma|Delta|Theta|Lambda|Xi|Pi|Sigma|Upsilon|Phi|Psi|Omega)(?:\s+|\{\}|(?![a-zA-Z]))/, "one lowercase latin letter $": /^(?:([a-z])(?:$|[^a-zA-Z]))$/, "$one lowercase latin letter$ $": /^\$(?:([a-z])(?:$|[^a-zA-Z]))\$$/, "one lowercase greek letter $": /^(?:\$?[\u03B1-\u03C9]\$?|\$?\\(?:alpha|beta|gamma|delta|epsilon|zeta|eta|theta|iota|kappa|lambda|mu|nu|xi|omicron|pi|rho|sigma|tau|upsilon|phi|chi|psi|omega)\s*\$?)(?:\s+|\{\}|(?![a-zA-Z]))$/, digits: /^[0-9]+/, "-9.,9": /^[+\-]?(?:[0-9]+(?:[,.][0-9]+)?|[0-9]*(?:\.[0-9]+))/, "-9.,9 no missing 0": /^[+\-]?[0-9]+(?:[.,][0-9]+)?/, "(-)(9.,9)(e)(99)": function(t37) {
var e = t37.match(/^(\+\-|\+\/\-|\+|\-|\\pm\s?)?([0-9]+(?:[,.][0-9]+)?|[0-9]*(?:\.[0-9]+))?(\((?:[0-9]+(?:[,.][0-9]+)?|[0-9]*(?:\.[0-9]+))\))?(?:(?:([eE])|\s*(\*|x|\\times|\u00D7)\s*10\^)([+\-]?[0-9]+|\{[+\-]?[0-9]+\}))?/);
return e && e[0] ? { match_: e.slice(1), remainder: t37.substr(e[0].length) } : null;
}, "(-)(9)^(-9)": function(t37) {
var e = t37.match(/^(\+\-|\+\/\-|\+|\-|\\pm\s?)?([0-9]+(?:[,.][0-9]+)?|[0-9]*(?:\.[0-9]+)?)\^([+\-]?[0-9]+|\{[+\-]?[0-9]+\})/);
return e && e[0] ? { match_: e.slice(1), remainder: t37.substr(e[0].length) } : null;
}, "state of aggregation $": function(t37) {
var e = L.patterns.findObserveGroups(t37, "", /^\([a-z]{1,3}(?=[\),])/, ")", "");
if (e && e.remainder.match(/^($|[\s,;\)\]\}])/))
return e;
var r = t37.match(/^(?:\((?:\\ca\s?)?\$[amothc]\$\))/);
return r ? { match_: r[0], remainder: t37.substr(r[0].length) } : null;
}, "_{(state of aggregation)}$": /^_\{(\([a-z]{1,3}\))\}/, "{[(": /^(?:\\\{|\[|\()/, ")]}": /^(?:\)|\]|\\\})/, ", ": /^[,;]\s*/, ",": /^[,;]/, ".": /^[.]/, ". ": /^([.\u22C5\u00B7\u2022])\s*/, "...": /^\.\.\.(?=$|[^.])/, "* ": /^([*])\s*/, "^{(...)}": function(t37) {
return L.patterns.findObserveGroups(t37, "^{", "", "", "}");
}, "^($...$)": function(t37) {
return L.patterns.findObserveGroups(t37, "^", "$", "$", "");
}, "^a": /^\^([0-9]+|[^\\_])/, "^\\x{}{}": function(t37) {
return L.patterns.findObserveGroups(t37, "^", /^\\[a-zA-Z]+\{/, "}", "", "", "{", "}", "", true);
}, "^\\x{}": function(t37) {
return L.patterns.findObserveGroups(t37, "^", /^\\[a-zA-Z]+\{/, "}", "");
}, "^\\x": /^\^(\\[a-zA-Z]+)\s*/, "^(-1)": /^\^(-?\d+)/, "'": /^'/, "_{(...)}": function(t37) {
return L.patterns.findObserveGroups(t37, "_{", "", "", "}");
}, "_($...$)": function(t37) {
return L.patterns.findObserveGroups(t37, "_", "$", "$", "");
}, _9: /^_([+\-]?[0-9]+|[^\\])/, "_\\x{}{}": function(t37) {
return L.patterns.findObserveGroups(t37, "_", /^\\[a-zA-Z]+\{/, "}", "", "", "{", "}", "", true);
}, "_\\x{}": function(t37) {
return L.patterns.findObserveGroups(t37, "_", /^\\[a-zA-Z]+\{/, "}", "");
}, "_\\x": /^_(\\[a-zA-Z]+)\s*/, "^_": /^(?:\^(?=_)|\_(?=\^)|[\^_]$)/, "{}": /^\{\}/, "{...}": function(t37) {
return L.patterns.findObserveGroups(t37, "", "{", "}", "");
}, "{(...)}": function(t37) {
return L.patterns.findObserveGroups(t37, "{", "", "", "}");
}, "$...$": function(t37) {
return L.patterns.findObserveGroups(t37, "", "$", "$", "");
}, "${(...)}$": function(t37) {
return L.patterns.findObserveGroups(t37, "${", "", "", "}$");
}, "$(...)$": function(t37) {
return L.patterns.findObserveGroups(t37, "$", "", "", "$");
}, "=<>": /^[=<>]/, "#": /^[#\u2261]/, "+": /^\+/, "-$": /^-(?=[\s_},;\]/]|$|\([a-z]+\))/, "-9": /^-(?=[0-9])/, "- orbital overlap": /^-(?=(?:[spd]|sp)(?:$|[\s,;\)\]\}]))/, "-": /^-/, "pm-operator": /^(?:\\pm|\$\\pm\$|\+-|\+\/-)/, operator: /^(?:\+|(?:[\-=<>]|<<|>>|\\approx|\$\\approx\$)(?=\s|$|-?[0-9]))/, arrowUpDown: /^(?:v|\(v\)|\^|\(\^\))(?=$|[\s,;\)\]\}])/, "\\bond{(...)}": function(t37) {
return L.patterns.findObserveGroups(t37, "\\bond{", "", "", "}");
}, "->": /^(?:<->|<-->|->|<-|<=>>|<<=>|<=>|[\u2192\u27F6\u21CC])/, CMT: /^[CMT](?=\[)/, "[(...)]": function(t37) {
return L.patterns.findObserveGroups(t37, "[", "", "", "]");
}, "1st-level escape": /^(&|\\\\|\\hline)\s*/, "\\,": /^(?:\\[,\ ;:])/, "\\x{}{}": function(t37) {
return L.patterns.findObserveGroups(t37, "", /^\\[a-zA-Z]+\{/, "}", "", "", "{", "}", "", true);
}, "\\x{}": function(t37) {
return L.patterns.findObserveGroups(t37, "", /^\\[a-zA-Z]+\{/, "}", "");
}, "\\ca": /^\\ca(?:\s+|(?![a-zA-Z]))/, "\\x": /^(?:\\[a-zA-Z]+\s*|\\[_&{}%])/, orbital: /^(?:[0-9]{1,2}[spdfgh]|[0-9]{0,2}sp)(?=$|[^a-zA-Z])/, others: /^[\/~|]/, "\\frac{(...)}": function(t37) {
return L.patterns.findObserveGroups(t37, "\\frac{", "", "", "}", "{", "", "", "}");
}, "\\overset{(...)}": function(t37) {
return L.patterns.findObserveGroups(t37, "\\overset{", "", "", "}", "{", "", "", "}");
}, "\\underset{(...)}": function(t37) {
return L.patterns.findObserveGroups(t37, "\\underset{", "", "", "}", "{", "", "", "}");
}, "\\underbrace{(...)}": function(t37) {
return L.patterns.findObserveGroups(t37, "\\underbrace{", "", "", "}_", "{", "", "", "}");
}, "\\color{(...)}0": function(t37) {
return L.patterns.findObserveGroups(t37, "\\color{", "", "", "}");
}, "\\color{(...)}{(...)}1": function(t37) {
return L.patterns.findObserveGroups(t37, "\\color{", "", "", "}", "{", "", "", "}");
}, "\\color(...){(...)}2": function(t37) {
return L.patterns.findObserveGroups(t37, "\\color", "\\", "", /^(?=\{)/, "{", "", "", "}");
}, "\\ce{(...)}": function(t37) {
return L.patterns.findObserveGroups(t37, "\\ce{", "", "", "}");
}, oxidation$: /^(?:[+-][IVX]+|\\pm\s*0|\$\\pm\$\s*0)$/, "d-oxidation$": /^(?:[+-]?\s?[IVX]+|\\pm\s*0|\$\\pm\$\s*0)$/, "roman numeral": /^[IVX]+/, "1/2$": /^[+\-]?(?:[0-9]+|\$[a-z]\$|[a-z])\/[0-9]+(?:\$[a-z]\$|[a-z])?$/, amount: function(t37) {
var e;
if (e = t37.match(/^(?:(?:(?:\([+\-]?[0-9]+\/[0-9]+\)|[+\-]?(?:[0-9]+|\$[a-z]\$|[a-z])\/[0-9]+|[+\-]?[0-9]+[.,][0-9]+|[+\-]?\.[0-9]+|[+\-]?[0-9]+)(?:[a-z](?=\s*[A-Z]))?)|[+\-]?[a-z](?=\s*[A-Z])|\+(?!\s))/), e)
return { match_: e[0], remainder: t37.substr(e[0].length) };
var r = L.patterns.findObserveGroups(t37, "", "$", "$", "");
return r && (e = r.match_.match(/^\$(?:\(?[+\-]?(?:[0-9]*[a-z]?[+\-])?[0-9]*[a-z](?:[+\-][0-9]*[a-z]?)?\)?|\+|-)\$$/), e) ? { match_: e[0], remainder: t37.substr(e[0].length) } : null;
}, amount2: function(t37) {
return this.amount(t37);
}, "(KV letters),": /^(?:[A-Z][a-z]{0,2}|i)(?=,)/, formula$: function(t37) {
if (t37.match(/^\([a-z]+\)$/))
return null;
var e = t37.match(/^(?:[a-z]|(?:[0-9\ \+\-\,\.\(\)]+[a-z])+[0-9\ \+\-\,\.\(\)]*|(?:[a-z][0-9\ \+\-\,\.\(\)]+)+[a-z]?)$/);
return e ? { match_: e[0], remainder: t37.substr(e[0].length) } : null;
}, uprightEntities: /^(?:pH|pOH|pC|pK|iPr|iBu)(?=$|[^a-zA-Z])/, "/": /^\s*(\/)\s*/, "//": /^\s*(\/\/)\s*/, "*": /^\s*[*.]\s*/ }, findObserveGroups: function(t37, e, r, i, n, o, a, s, l, c) {
var u = function(M, x) {
if (typeof x == "string")
return M.indexOf(x) !== 0 ? null : x;
var v = M.match(x);
return v ? v[0] : null;
}, d = function(M, x, v) {
for (var k = 0; x < M.length; ) {
var C = M.charAt(x), q = u(M.substr(x), v);
if (q !== null && k === 0)
return { endMatchBegin: x, endMatchEnd: x + q.length };
if (C === "{")
k++;
else if (C === "}") {
if (k === 0)
throw ["ExtraCloseMissingOpen", "Extra close brace or missing open brace"];
k--;
}
x++;
}
return k > 0, null;
}, m = u(t37, e);
if (m === null || (t37 = t37.substr(m.length), m = u(t37, r), m === null))
return null;
var h = d(t37, m.length, i || n);
if (h === null)
return null;
var f = t37.substring(0, i ? h.endMatchEnd : h.endMatchBegin);
if (o || a) {
var b = this.findObserveGroups(t37.substr(h.endMatchEnd), o, a, s, l);
if (b === null)
return null;
var S = [f, b.match_];
return { match_: c ? S.join("") : S, remainder: b.remainder };
} else
return { match_: f, remainder: t37.substr(h.endMatchEnd) };
}, match_: function(t37, e) {
var r = L.patterns.patterns[t37];
if (r === void 0)
throw ["MhchemBugP", "mhchem bug P. Please report. (" + t37 + ")"];
if (typeof r == "function")
return L.patterns.patterns[t37](e);
var i = e.match(r);
if (i) {
var n;
return i[2] ? n = [i[1], i[2]] : i[1] ? n = i[1] : n = i[0], { match_: n, remainder: e.substr(i[0].length) };
}
return null;
} }, actions: { "a=": function(t37, e) {
t37.a = (t37.a || "") + e;
}, "b=": function(t37, e) {
t37.b = (t37.b || "") + e;
}, "p=": function(t37, e) {
t37.p = (t37.p || "") + e;
}, "o=": function(t37, e) {
t37.o = (t37.o || "") + e;
}, "q=": function(t37, e) {
t37.q = (t37.q || "") + e;
}, "d=": function(t37, e) {
t37.d = (t37.d || "") + e;
}, "rm=": function(t37, e) {
t37.rm = (t37.rm || "") + e;
}, "text=": function(t37, e) {
t37.text_ = (t37.text_ || "") + e;
}, insert: function(t37, e, r) {
return { type_: r };
}, "insert+p1": function(t37, e, r) {
return { type_: r, p1: e };
}, "insert+p1+p2": function(t37, e, r) {
return { type_: r, p1: e[0], p2: e[1] };
}, copy: function(t37, e) {
return e;
}, rm: function(t37, e) {
return { type_: "rm", p1: e || "" };
}, text: function(t37, e) {
return L.go(e, "text");
}, "{text}": function(t37, e) {
var r = ["{"];
return L.concatArray(r, L.go(e, "text")), r.push("}"), r;
}, "tex-math": function(t37, e) {
return L.go(e, "tex-math");
}, "tex-math tight": function(t37, e) {
return L.go(e, "tex-math tight");
}, bond: function(t37, e, r) {
return { type_: "bond", kind_: r || e };
}, "color0-output": function(t37, e) {
return { type_: "color0", color: e[0] };
}, ce: function(t37, e) {
return L.go(e);
}, "1/2": function(t37, e) {
var r = [];
e.match(/^[+\-]/) && (r.push(e.substr(0, 1)), e = e.substr(1));
var i = e.match(/^([0-9]+|\$[a-z]\$|[a-z])\/([0-9]+)(\$[a-z]\$|[a-z])?$/);
return i[1] = i[1].replace(/\$/g, ""), r.push({ type_: "frac", p1: i[1], p2: i[2] }), i[3] && (i[3] = i[3].replace(/\$/g, ""), r.push({ type_: "tex-math", p1: i[3] })), r;
}, "9,9": function(t37, e) {
return L.go(e, "9,9");
} }, createTransitions: function(t37) {
var e, r, i, n, o = {};
for (e in t37)
for (r in t37[e])
for (i = r.split("|"), t37[e][r].stateArray = i, n = 0; n < i.length; n++)
o[i[n]] = [];
for (e in t37)
for (r in t37[e])
for (i = t37[e][r].stateArray || [], n = 0; n < i.length; n++) {
var a = t37[e][r];
if (a.action_) {
a.action_ = [].concat(a.action_);
for (var s = 0; s < a.action_.length; s++)
typeof a.action_[s] == "string" && (a.action_[s] = { type_: a.action_[s] });
} else
a.action_ = [];
for (var l = e.split("|"), c = 0; c < l.length; c++)
if (i[n] === "*")
for (var u in o)
o[u].push({ pattern: l[c], task: a });
else
o[i[n]].push({ pattern: l[c], task: a });
}
return o;
}, stateMachines: {} };
L.stateMachines = { ce: { transitions: L.createTransitions({ empty: { "*": { action_: "output" } }, else: { "0|1|2": { action_: "beginsWithBond=false", revisit: true, toContinue: true } }, oxidation$: { 0: { action_: "oxidation-output" } }, CMT: { r: { action_: "rdt=", nextState: "rt" }, rd: { action_: "rqt=", nextState: "rdt" } }, arrowUpDown: { "0|1|2|as": { action_: ["sb=false", "output", "operator"], nextState: "1" } }, uprightEntities: { "0|1|2": { action_: ["o=", "output"], nextState: "1" } }, orbital: { "0|1|2|3": { action_: "o=", nextState: "o" } }, "->": { "0|1|2|3": { action_: "r=", nextState: "r" }, "a|as": { action_: ["output", "r="], nextState: "r" }, "*": { action_: ["output", "r="], nextState: "r" } }, "+": { o: { action_: "d= kv", nextState: "d" }, "d|D": { action_: "d=", nextState: "d" }, q: { action_: "d=", nextState: "qd" }, "qd|qD": { action_: "d=", nextState: "qd" }, dq: { action_: ["output", "d="], nextState: "d" }, 3: { action_: ["sb=false", "output", "operator"], nextState: "0" } }, amount: { "0|2": { action_: "a=", nextState: "a" } }, "pm-operator": { "0|1|2|a|as": { action_: ["sb=false", "output", { type_: "operator", option: "\\pm" }], nextState: "0" } }, operator: { "0|1|2|a|as": { action_: ["sb=false", "output", "operator"], nextState: "0" } }, "-$": { "o|q": { action_: ["charge or bond", "output"], nextState: "qd" }, d: { action_: "d=", nextState: "d" }, D: { action_: ["output", { type_: "bond", option: "-" }], nextState: "3" }, q: { action_: "d=", nextState: "qd" }, qd: { action_: "d=", nextState: "qd" }, "qD|dq": { action_: ["output", { type_: "bond", option: "-" }], nextState: "3" } }, "-9": { "3|o": { action_: ["output", { type_: "insert", option: "hyphen" }], nextState: "3" } }, "- orbital overlap": { o: { action_: ["output", { type_: "insert", option: "hyphen" }], nextState: "2" }, d: { action_: ["output", { type_: "insert", option: "hyphen" }], nextState: "2" } }, "-": { "0|1|2": { action_: [{ type_: "output", option: 1 }, "beginsWithBond=true", { type_: "bond", option: "-" }], nextState: "3" }, 3: { action_: { type_: "bond", option: "-" } }, a: { action_: ["output", { type_: "insert", option: "hyphen" }], nextState: "2" }, as: { action_: [{ type_: "output", option: 2 }, { type_: "bond", option: "-" }], nextState: "3" }, b: { action_: "b=" }, o: { action_: { type_: "- after o/d", option: false }, nextState: "2" }, q: { action_: { type_: "- after o/d", option: false }, nextState: "2" }, "d|qd|dq": { action_: { type_: "- after o/d", option: true }, nextState: "2" }, "D|qD|p": { action_: ["output", { type_: "bond", option: "-" }], nextState: "3" } }, amount2: { "1|3": { action_: "a=", nextState: "a" } }, letters: { "0|1|2|3|a|as|b|p|bp|o": { action_: "o=", nextState: "o" }, "q|dq": { action_: ["output", "o="], nextState: "o" }, "d|D|qd|qD": { action_: "o after d", nextState: "o" } }, digits: { o: { action_: "q=", nextState: "q" }, "d|D": { action_: "q=", nextState: "dq" }, q: { action_: ["output", "o="], nextState: "o" }, a: { action_: "o=", nextState: "o" } }, "space A": { "b|p|bp": {} }, space: { a: { nextState: "as" }, 0: { action_: "sb=false" }, "1|2": { action_: "sb=true" }, "r|rt|rd|rdt|rdq": { action_: "output", nextState: "0" }, "*": { action_: ["output", "sb=true"], nextState: "1" } }, "1st-level escape": { "1|2": { action_: ["output", { type_: "insert+p1", option: "1st-level escape" }] }, "*": { action_: ["output", { type_: "insert+p1", option: "1st-level escape" }], nextState: "0" } }, "[(...)]": { "r|rt": { action_: "rd=", nextState: "rd" }, "rd|rdt": { action_: "rq=", nextState: "rdq" } }, "...": { "o|d|D|dq|qd|qD": { action_: ["output", { type_: "bond", option: "..." }], nextState: "3" }, "*": { action_: [{ type_: "output", option: 1 }, { type_: "insert", option: "ellipsis" }], nextState: "1" } }, ". |* ": { "*": { action_: ["output", { type_: "insert", option: "addition compound" }], nextState: "1" } }, "state of aggregation $": { "*": { action_: ["output", "state of aggregation"], nextState: "1" } }, "{[(": { "a|as|o": { action_: ["o=", "output", "parenthesisLevel++"], nextState: "2" }, "0|1|2|3": { action_: ["o=", "output", "parenthesisLevel++"], nextState: "2" }, "*": { action_: ["output", "o=", "output", "parenthesisLevel++"], nextState: "2" } }, ")]}": { "0|1|2|3|b|p|bp|o": { action_: ["o=", "parenthesisLevel--"], nextState: "o" }, "a|as|d|D|q|qd|qD|dq": { action_: ["output", "o=", "parenthesisLevel--"], nextState: "o" } }, ", ": { "*": { action_: ["output", "comma"], nextState: "0" } }, "^_": { "*": {} }, "^{(...)}|^($...$)": { "0|1|2|as": { action_: "b=", nextState: "b" }, p: { action_: "b=", nextState: "bp" }, "3|o": { action_: "d= kv", nextState: "D" }, q: { action_: "d=", nextState: "qD" }, "d|D|qd|qD|dq": { action_: ["output", "d="], nextState: "D" } }, "^a|^\\x{}{}|^\\x{}|^\\x|'": { "0|1|2|as": { action_: "b=", nextState: "b" }, p: { action_: "b=", nextState: "bp" }, "3|o": { action_: "d= kv", nextState: "d" }, q: { action_: "d=", nextState: "qd" }, "d|qd|D|qD": { action_: "d=" }, dq: { action_: ["output", "d="], nextState: "d" } }, "_{(state of aggregation)}$": { "d|D|q|qd|qD|dq": { action_: ["output", "q="], nextState: "q" } }, "_{(...)}|_($...$)|_9|_\\x{}{}|_\\x{}|_\\x": { "0|1|2|as": { action_: "p=", nextState: "p" }, b: { action_: "p=", nextState: "bp" }, "3|o": { action_: "q=", nextState: "q" }, "d|D": { action_: "q=", nextState: "dq" }, "q|qd|qD|dq": { action_: ["output", "q="], nextState: "q" } }, "=<>": { "0|1|2|3|a|as|o|q|d|D|qd|qD|dq": { action_: [{ type_: "output", option: 2 }, "bond"], nextState: "3" } }, "#": { "0|1|2|3|a|as|o": { action_: [{ type_: "output", option: 2 }, { type_: "bond", option: "#" }], nextState: "3" } }, "{}": { "*": { action_: { type_: "output", option: 1 }, nextState: "1" } }, "{...}": { "0|1|2|3|a|as|b|p|bp": { action_: "o=", nextState: "o" }, "o|d|D|q|qd|qD|dq": { action_: ["output", "o="], nextState: "o" } }, "$...$": { a: { action_: "a=" }, "0|1|2|3|as|b|p|bp|o": { action_: "o=", nextState: "o" }, "as|o": { action_: "o=" }, "q|d|D|qd|qD|dq": { action_: ["output", "o="], nextState: "o" } }, "\\bond{(...)}": { "*": { action_: [{ type_: "output", option: 2 }, "bond"], nextState: "3" } }, "\\frac{(...)}": { "*": { action_: [{ type_: "output", option: 1 }, "frac-output"], nextState: "3" } }, "\\overset{(...)}": { "*": { action_: [{ type_: "output", option: 2 }, "overset-output"], nextState: "3" } }, "\\underset{(...)}": { "*": { action_: [{ type_: "output", option: 2 }, "underset-output"], nextState: "3" } }, "\\underbrace{(...)}": { "*": { action_: [{ type_: "output", option: 2 }, "underbrace-output"], nextState: "3" } }, "\\color{(...)}{(...)}1|\\color(...){(...)}2": { "*": { action_: [{ type_: "output", option: 2 }, "color-output"], nextState: "3" } }, "\\color{(...)}0": { "*": { action_: [{ type_: "output", option: 2 }, "color0-output"] } }, "\\ce{(...)}": { "*": { action_: [{ type_: "output", option: 2 }, "ce"], nextState: "3" } }, "\\,": { "*": { action_: [{ type_: "output", option: 1 }, "copy"], nextState: "1" } }, "\\x{}{}|\\x{}|\\x": { "0|1|2|3|a|as|b|p|bp|o|c0": { action_: ["o=", "output"], nextState: "3" }, "*": { action_: ["output", "o=", "output"], nextState: "3" } }, others: { "*": { action_: [{ type_: "output", option: 1 }, "copy"], nextState: "3" } }, else2: { a: { action_: "a to o", nextState: "o", revisit: true }, as: { action_: ["output", "sb=true"], nextState: "1", revisit: true }, "r|rt|rd|rdt|rdq": { action_: ["output"], nextState: "0", revisit: true }, "*": { action_: ["output", "copy"], nextState: "3" } } }), actions: { "o after d": function(t37, e) {
var r;
if ((t37.d || "").match(/^[0-9]+$/)) {
var i = t37.d;
t37.d = void 0, r = this.output(t37), t37.b = i;
} else
r = this.output(t37);
return L.actions["o="](t37, e), r;
}, "d= kv": function(t37, e) {
t37.d = e, t37.dType = "kv";
}, "charge or bond": function(t37, e) {
if (t37.beginsWithBond) {
var r = [];
return L.concatArray(r, this.output(t37)), L.concatArray(r, L.actions.bond(t37, e, "-")), r;
} else
t37.d = e;
}, "- after o/d": function(t37, e, r) {
var i = L.patterns.match_("orbital", t37.o || ""), n = L.patterns.match_("one lowercase greek letter $", t37.o || ""), o = L.patterns.match_("one lowercase latin letter $", t37.o || ""), a = L.patterns.match_("$one lowercase latin letter$ $", t37.o || ""), s = e === "-" && (i && i.remainder === "" || n || o || a);
s && !t37.a && !t37.b && !t37.p && !t37.d && !t37.q && !i && o && (t37.o = "$" + t37.o + "$");
var l = [];
return s ? (L.concatArray(l, this.output(t37)), l.push({ type_: "hyphen" })) : (i = L.patterns.match_("digits", t37.d || ""), r && i && i.remainder === "" ? (L.concatArray(l, L.actions["d="](t37, e)), L.concatArray(l, this.output(t37))) : (L.concatArray(l, this.output(t37)), L.concatArray(l, L.actions.bond(t37, e, "-")))), l;
}, "a to o": function(t37) {
t37.o = t37.a, t37.a = void 0;
}, "sb=true": function(t37) {
t37.sb = true;
}, "sb=false": function(t37) {
t37.sb = false;
}, "beginsWithBond=true": function(t37) {
t37.beginsWithBond = true;
}, "beginsWithBond=false": function(t37) {
t37.beginsWithBond = false;
}, "parenthesisLevel++": function(t37) {
t37.parenthesisLevel++;
}, "parenthesisLevel--": function(t37) {
t37.parenthesisLevel--;
}, "state of aggregation": function(t37, e) {
return { type_: "state of aggregation", p1: L.go(e, "o") };
}, comma: function(t37, e) {
var r = e.replace(/\s*$/, ""), i = r !== e;
return i && t37.parenthesisLevel === 0 ? { type_: "comma enumeration L", p1: r } : { type_: "comma enumeration M", p1: r };
}, output: function(t37, e, r) {
var i;
if (!t37.r)
i = [], !t37.a && !t37.b && !t37.p && !t37.o && !t37.q && !t37.d && !r || (t37.sb && i.push({ type_: "entitySkip" }), !t37.o && !t37.q && !t37.d && !t37.b && !t37.p && r !== 2 ? (t37.o = t37.a, t37.a = void 0) : !t37.o && !t37.q && !t37.d && (t37.b || t37.p) ? (t37.o = t37.a, t37.d = t37.b, t37.q = t37.p, t37.a = t37.b = t37.p = void 0) : t37.o && t37.dType === "kv" && L.patterns.match_("d-oxidation$", t37.d || "") ? t37.dType = "oxidation" : t37.o && t37.dType === "kv" && !t37.q && (t37.dType = void 0), i.push({ type_: "chemfive", a: L.go(t37.a, "a"), b: L.go(t37.b, "bd"), p: L.go(t37.p, "pq"), o: L.go(t37.o, "o"), q: L.go(t37.q, "pq"), d: L.go(t37.d, t37.dType === "oxidation" ? "oxidation" : "bd"), dType: t37.dType }));
else {
var n;
t37.rdt === "M" ? n = L.go(t37.rd, "tex-math") : t37.rdt === "T" ? n = [{ type_: "text", p1: t37.rd || "" }] : n = L.go(t37.rd);
var o;
t37.rqt === "M" ? o = L.go(t37.rq, "tex-math") : t37.rqt === "T" ? o = [{ type_: "text", p1: t37.rq || "" }] : o = L.go(t37.rq), i = { type_: "arrow", r: t37.r, rd: n, rq: o };
}
for (var a in t37)
a !== "parenthesisLevel" && a !== "beginsWithBond" && delete t37[a];
return i;
}, "oxidation-output": function(t37, e) {
var r = ["{"];
return L.concatArray(r, L.go(e, "oxidation")), r.push("}"), r;
}, "frac-output": function(t37, e) {
return { type_: "frac-ce", p1: L.go(e[0]), p2: L.go(e[1]) };
}, "overset-output": function(t37, e) {
return { type_: "overset", p1: L.go(e[0]), p2: L.go(e[1]) };
}, "underset-output": function(t37, e) {
return { type_: "underset", p1: L.go(e[0]), p2: L.go(e[1]) };
}, "underbrace-output": function(t37, e) {
return { type_: "underbrace", p1: L.go(e[0]), p2: L.go(e[1]) };
}, "color-output": function(t37, e) {
return { type_: "color", color1: e[0], color2: L.go(e[1]) };
}, "r=": function(t37, e) {
t37.r = e;
}, "rdt=": function(t37, e) {
t37.rdt = e;
}, "rd=": function(t37, e) {
t37.rd = e;
}, "rqt=": function(t37, e) {
t37.rqt = e;
}, "rq=": function(t37, e) {
t37.rq = e;
}, operator: function(t37, e, r) {
return { type_: "operator", kind_: r || e };
} } }, a: { transitions: L.createTransitions({ empty: { "*": {} }, "1/2$": { 0: { action_: "1/2" } }, else: { 0: { nextState: "1", revisit: true } }, "$(...)$": { "*": { action_: "tex-math tight", nextState: "1" } }, ",": { "*": { action_: { type_: "insert", option: "commaDecimal" } } }, else2: { "*": { action_: "copy" } } }), actions: {} }, o: { transitions: L.createTransitions({ empty: { "*": {} }, "1/2$": { 0: { action_: "1/2" } }, else: { 0: { nextState: "1", revisit: true } }, letters: { "*": { action_: "rm" } }, "\\ca": { "*": { action_: { type_: "insert", option: "circa" } } }, "\\x{}{}|\\x{}|\\x": { "*": { action_: "copy" } }, "${(...)}$|$(...)$": { "*": { action_: "tex-math" } }, "{(...)}": { "*": { action_: "{text}" } }, else2: { "*": { action_: "copy" } } }), actions: {} }, text: { transitions: L.createTransitions({ empty: { "*": { action_: "output" } }, "{...}": { "*": { action_: "text=" } }, "${(...)}$|$(...)$": { "*": { action_: "tex-math" } }, "\\greek": { "*": { action_: ["output", "rm"] } }, "\\,|\\x{}{}|\\x{}|\\x": { "*": { action_: ["output", "copy"] } }, else: { "*": { action_: "text=" } } }), actions: { output: function(t37) {
if (t37.text_) {
var e = { type_: "text", p1: t37.text_ };
for (var r in t37)
delete t37[r];
return e;
}
} } }, pq: { transitions: L.createTransitions({ empty: { "*": {} }, "state of aggregation $": { "*": { action_: "state of aggregation" } }, i$: { 0: { nextState: "!f", revisit: true } }, "(KV letters),": { 0: { action_: "rm", nextState: "0" } }, formula$: { 0: { nextState: "f", revisit: true } }, "1/2$": { 0: { action_: "1/2" } }, else: { 0: { nextState: "!f", revisit: true } }, "${(...)}$|$(...)$": { "*": { action_: "tex-math" } }, "{(...)}": { "*": { action_: "text" } }, "a-z": { f: { action_: "tex-math" } }, letters: { "*": { action_: "rm" } }, "-9.,9": { "*": { action_: "9,9" } }, ",": { "*": { action_: { type_: "insert+p1", option: "comma enumeration S" } } }, "\\color{(...)}{(...)}1|\\color(...){(...)}2": { "*": { action_: "color-output" } }, "\\color{(...)}0": { "*": { action_: "color0-output" } }, "\\ce{(...)}": { "*": { action_: "ce" } }, "\\,|\\x{}{}|\\x{}|\\x": { "*": { action_: "copy" } }, else2: { "*": { action_: "copy" } } }), actions: { "state of aggregation": function(t37, e) {
return { type_: "state of aggregation subscript", p1: L.go(e, "o") };
}, "color-output": function(t37, e) {
return { type_: "color", color1: e[0], color2: L.go(e[1], "pq") };
} } }, bd: { transitions: L.createTransitions({ empty: { "*": {} }, x$: { 0: { nextState: "!f", revisit: true } }, formula$: { 0: { nextState: "f", revisit: true } }, else: { 0: { nextState: "!f", revisit: true } }, "-9.,9 no missing 0": { "*": { action_: "9,9" } }, ".": { "*": { action_: { type_: "insert", option: "electron dot" } } }, "a-z": { f: { action_: "tex-math" } }, x: { "*": { action_: { type_: "insert", option: "KV x" } } }, letters: { "*": { action_: "rm" } }, "'": { "*": { action_: { type_: "insert", option: "prime" } } }, "${(...)}$|$(...)$": { "*": { action_: "tex-math" } }, "{(...)}": { "*": { action_: "text" } }, "\\color{(...)}{(...)}1|\\color(...){(...)}2": { "*": { action_: "color-output" } }, "\\color{(...)}0": { "*": { action_: "color0-output" } }, "\\ce{(...)}": { "*": { action_: "ce" } }, "\\,|\\x{}{}|\\x{}|\\x": { "*": { action_: "copy" } }, else2: { "*": { action_: "copy" } } }), actions: { "color-output": function(t37, e) {
return { type_: "color", color1: e[0], color2: L.go(e[1], "bd") };
} } }, oxidation: { transitions: L.createTransitions({ empty: { "*": {} }, "roman numeral": { "*": { action_: "roman-numeral" } }, "${(...)}$|$(...)$": { "*": { action_: "tex-math" } }, else: { "*": { action_: "copy" } } }), actions: { "roman-numeral": function(t37, e) {
return { type_: "roman numeral", p1: e || "" };
} } }, "tex-math": { transitions: L.createTransitions({ empty: { "*": { action_: "output" } }, "\\ce{(...)}": { "*": { action_: ["output", "ce"] } }, "{...}|\\,|\\x{}{}|\\x{}|\\x": { "*": { action_: "o=" } }, else: { "*": { action_: "o=" } } }), actions: { output: function(t37) {
if (t37.o) {
var e = { type_: "tex-math", p1: t37.o };
for (var r in t37)
delete t37[r];
return e;
}
} } }, "tex-math tight": { transitions: L.createTransitions({ empty: { "*": { action_: "output" } }, "\\ce{(...)}": { "*": { action_: ["output", "ce"] } }, "{...}|\\,|\\x{}{}|\\x{}|\\x": { "*": { action_: "o=" } }, "-|+": { "*": { action_: "tight operator" } }, else: { "*": { action_: "o=" } } }), actions: { "tight operator": function(t37, e) {
t37.o = (t37.o || "") + "{" + e + "}";
}, output: function(t37) {
if (t37.o) {
var e = { type_: "tex-math", p1: t37.o };
for (var r in t37)
delete t37[r];
return e;
}
} } }, "9,9": { transitions: L.createTransitions({ empty: { "*": {} }, ",": { "*": { action_: "comma" } }, else: { "*": { action_: "copy" } } }), actions: { comma: function() {
return { type_: "commaDecimal" };
} } }, pu: { transitions: L.createTransitions({ empty: { "*": { action_: "output" } }, space$: { "*": { action_: ["output", "space"] } }, "{[(|)]}": { "0|a": { action_: "copy" } }, "(-)(9)^(-9)": { 0: { action_: "number^", nextState: "a" } }, "(-)(9.,9)(e)(99)": { 0: { action_: "enumber", nextState: "a" } }, space: { "0|a": {} }, "pm-operator": { "0|a": { action_: { type_: "operator", option: "\\pm" }, nextState: "0" } }, operator: { "0|a": { action_: "copy", nextState: "0" } }, "//": { d: { action_: "o=", nextState: "/" } }, "/": { d: { action_: "o=", nextState: "/" } }, "{...}|else": { "0|d": { action_: "d=", nextState: "d" }, a: { action_: ["space", "d="], nextState: "d" }, "/|q": { action_: "q=", nextState: "q" } } }), actions: { enumber: function(t37, e) {
var r = [];
return e[0] === "+-" || e[0] === "+/-" ? r.push("\\pm ") : e[0] && r.push(e[0]), e[1] && (L.concatArray(r, L.go(e[1], "pu-9,9")), e[2] && (e[2].match(/[,.]/) ? L.concatArray(r, L.go(e[2], "pu-9,9")) : r.push(e[2])), (e[3] || e[4]) && (e[3] === "e" || e[4] === "*" ? r.push({ type_: "cdot" }) : r.push({ type_: "times" }))), e[5] && r.push("10^{" + e[5] + "}"), r;
}, "number^": function(t37, e) {
var r = [];
return e[0] === "+-" || e[0] === "+/-" ? r.push("\\pm ") : e[0] && r.push(e[0]), L.concatArray(r, L.go(e[1], "pu-9,9")), r.push("^{" + e[2] + "}"), r;
}, operator: function(t37, e, r) {
return { type_: "operator", kind_: r || e };
}, space: function() {
return { type_: "pu-space-1" };
}, output: function(t37) {
var e, r = L.patterns.match_("{(...)}", t37.d || "");
r && r.remainder === "" && (t37.d = r.match_);
var i = L.patterns.match_("{(...)}", t37.q || "");
if (i && i.remainder === "" && (t37.q = i.match_), t37.d && (t37.d = t37.d.replace(/\u00B0C|\^oC|\^{o}C/g, "{}^{\\circ}C"), t37.d = t37.d.replace(/\u00B0F|\^oF|\^{o}F/g, "{}^{\\circ}F")), t37.q) {
t37.q = t37.q.replace(/\u00B0C|\^oC|\^{o}C/g, "{}^{\\circ}C"), t37.q = t37.q.replace(/\u00B0F|\^oF|\^{o}F/g, "{}^{\\circ}F");
var n = { d: L.go(t37.d, "pu"), q: L.go(t37.q, "pu") };
t37.o === "//" ? e = { type_: "pu-frac", p1: n.d, p2: n.q } : (e = n.d, n.d.length > 1 || n.q.length > 1 ? e.push({ type_: " / " }) : e.push({ type_: "/" }), L.concatArray(e, n.q));
} else
e = L.go(t37.d, "pu-2");
for (var o in t37)
delete t37[o];
return e;
} } }, "pu-2": { transitions: L.createTransitions({ empty: { "*": { action_: "output" } }, "*": { "*": { action_: ["output", "cdot"], nextState: "0" } }, "\\x": { "*": { action_: "rm=" } }, space: { "*": { action_: ["output", "space"], nextState: "0" } }, "^{(...)}|^(-1)": { 1: { action_: "^(-1)" } }, "-9.,9": { 0: { action_: "rm=", nextState: "0" }, 1: { action_: "^(-1)", nextState: "0" } }, "{...}|else": { "*": { action_: "rm=", nextState: "1" } } }), actions: { cdot: function() {
return { type_: "tight cdot" };
}, "^(-1)": function(t37, e) {
t37.rm += "^{" + e + "}";
}, space: function() {
return { type_: "pu-space-2" };
}, output: function(t37) {
var e = [];
if (t37.rm) {
var r = L.patterns.match_("{(...)}", t37.rm || "");
r && r.remainder === "" ? e = L.go(r.match_, "pu") : e = { type_: "rm", p1: t37.rm };
}
for (var i in t37)
delete t37[i];
return e;
} } }, "pu-9,9": { transitions: L.createTransitions({ empty: { 0: { action_: "output-0" }, o: { action_: "output-o" } }, ",": { 0: { action_: ["output-0", "comma"], nextState: "o" } }, ".": { 0: { action_: ["output-0", "copy"], nextState: "o" } }, else: { "*": { action_: "text=" } } }), actions: { comma: function() {
return { type_: "commaDecimal" };
}, "output-0": function(t37) {
var e = [];
if (t37.text_ = t37.text_ || "", t37.text_.length > 4) {
var r = t37.text_.length % 3;
r === 0 && (r = 3);
for (var i = t37.text_.length - 3; i > 0; i -= 3)
e.push(t37.text_.substr(i, 3)), e.push({ type_: "1000 separator" });
e.push(t37.text_.substr(0, r)), e.reverse();
} else
e.push(t37.text_);
for (var n in t37)
delete t37[n];
return e;
}, "output-o": function(t37) {
var e = [];
if (t37.text_ = t37.text_ || "", t37.text_.length > 4) {
for (var r = t37.text_.length - 3, i = 0; i < r; i += 3)
e.push(t37.text_.substr(i, 3)), e.push({ type_: "1000 separator" });
e.push(t37.text_.substr(i));
} else
e.push(t37.text_);
for (var n in t37)
delete t37[n];
return e;
} } } };
var re = { go: function(t37, e) {
if (!t37)
return "";
for (var r = "", i = false, n = 0; n < t37.length; n++) {
var o = t37[n];
typeof o == "string" ? r += o : (r += re._go2(o), o.type_ === "1st-level escape" && (i = true));
}
return !e && !i && r && (r = "{" + r + "}"), r;
}, _goInner: function(t37) {
return t37 && re.go(t37, true);
}, _go2: function(t37) {
var e;
switch (t37.type_) {
case "chemfive":
e = "";
var r = { a: re._goInner(t37.a), b: re._goInner(t37.b), p: re._goInner(t37.p), o: re._goInner(t37.o), q: re._goInner(t37.q), d: re._goInner(t37.d) };
r.a && (r.a.match(/^[+\-]/) && (r.a = "{" + r.a + "}"), e += r.a + "\\,"), (r.b || r.p) && (e += "{\\vphantom{X}}", e += "^{\\hphantom{" + (r.b || "") + "}}_{\\hphantom{" + (r.p || "") + "}}", e += "{\\vphantom{X}}", e += "^{\\smash[t]{\\vphantom{2}}\\llap{" + (r.b || "") + "}}", e += "_{\\vphantom{2}\\llap{\\smash[t]{" + (r.p || "") + "}}}"), r.o && (r.o.match(/^[+\-]/) && (r.o = "{" + r.o + "}"), e += r.o), t37.dType === "kv" ? ((r.d || r.q) && (e += "{\\vphantom{X}}"), r.d && (e += "^{" + r.d + "}"), r.q && (e += "_{\\smash[t]{" + r.q + "}}")) : t37.dType === "oxidation" ? (r.d && (e += "{\\vphantom{X}}", e += "^{" + r.d + "}"), r.q && (e += "{\\vphantom{X}}", e += "_{\\smash[t]{" + r.q + "}}")) : (r.q && (e += "{\\vphantom{X}}", e += "_{\\smash[t]{" + r.q + "}}"), r.d && (e += "{\\vphantom{X}}", e += "^{" + r.d + "}"));
break;
case "rm":
e = "\\mathrm{" + t37.p1 + "}";
break;
case "text":
t37.p1.match(/[\^_]/) ? (t37.p1 = t37.p1.replace(" ", "~").replace("-", "\\text{-}"), e = "\\mathrm{" + t37.p1 + "}") : e = "\\text{" + t37.p1 + "}";
break;
case "roman numeral":
e = "\\mathrm{" + t37.p1 + "}";
break;
case "state of aggregation":
e = "\\mskip2mu " + re._goInner(t37.p1);
break;
case "state of aggregation subscript":
e = "\\mskip1mu " + re._goInner(t37.p1);
break;
case "bond":
if (e = re._getBond(t37.kind_), !e)
throw ["MhchemErrorBond", "mhchem Error. Unknown bond type (" + t37.kind_ + ")"];
break;
case "frac":
var i = "\\frac{" + t37.p1 + "}{" + t37.p2 + "}";
e = "\\mathchoice{\\textstyle" + i + "}{" + i + "}{" + i + "}{" + i + "}";
break;
case "pu-frac":
var n = "\\frac{" + re._goInner(t37.p1) + "}{" + re._goInner(t37.p2) + "}";
e = "\\mathchoice{\\textstyle" + n + "}{" + n + "}{" + n + "}{" + n + "}";
break;
case "tex-math":
e = t37.p1 + " ";
break;
case "frac-ce":
e = "\\frac{" + re._goInner(t37.p1) + "}{" + re._goInner(t37.p2) + "}";
break;
case "overset":
e = "\\overset{" + re._goInner(t37.p1) + "}{" + re._goInner(t37.p2) + "}";
break;
case "underset":
e = "\\underset{" + re._goInner(t37.p1) + "}{" + re._goInner(t37.p2) + "}";
break;
case "underbrace":
e = "\\underbrace{" + re._goInner(t37.p1) + "}_{" + re._goInner(t37.p2) + "}";
break;
case "color":
e = "{\\color{" + t37.color1 + "}{" + re._goInner(t37.color2) + "}}";
break;
case "color0":
e = "\\color{" + t37.color + "}";
break;
case "arrow":
var o = { rd: re._goInner(t37.rd), rq: re._goInner(t37.rq) }, a = re._getArrow(t37.r);
o.rd || o.rq ? t37.r === "<=>" || t37.r === "<=>>" || t37.r === "<<=>" || t37.r === "<-->" ? (a = "\\long" + a, o.rd && (a = "\\overset{" + o.rd + "}{" + a + "}"), o.rq && (t37.r === "<-->" ? a = "\\underset{\\lower2mu{" + o.rq + "}}{" + a + "}" : a = "\\underset{\\lower6mu{" + o.rq + "}}{" + a + "}"), a = " {}\\mathrel{" + a + "}{} ") : (o.rq && (a += "[{" + o.rq + "}]"), a += "{" + o.rd + "}", a = " {}\\mathrel{\\x" + a + "}{} ") : a = " {}\\mathrel{\\long" + a + "}{} ", e = a;
break;
case "operator":
e = re._getOperator(t37.kind_);
break;
case "1st-level escape":
e = t37.p1 + " ";
break;
case "space":
e = " ";
break;
case "entitySkip":
e = "~";
break;
case "pu-space-1":
e = "~";
break;
case "pu-space-2":
e = "\\mkern3mu ";
break;
case "1000 separator":
e = "\\mkern2mu ";
break;
case "commaDecimal":
e = "{,}";
break;
case "comma enumeration L":
e = "{" + t37.p1 + "}\\mkern6mu ";
break;
case "comma enumeration M":
e = "{" + t37.p1 + "}\\mkern3mu ";
break;
case "comma enumeration S":
e = "{" + t37.p1 + "}\\mkern1mu ";
break;
case "hyphen":
e = "\\text{-}";
break;
case "addition compound":
e = "\\,{\\cdot}\\,";
break;
case "electron dot":
e = "\\mkern1mu \\bullet\\mkern1mu ";
break;
case "KV x":
e = "{\\times}";
break;
case "prime":
e = "\\prime ";
break;
case "cdot":
e = "\\cdot ";
break;
case "tight cdot":
e = "\\mkern1mu{\\cdot}\\mkern1mu ";
break;
case "times":
e = "\\times ";
break;
case "circa":
e = "{\\sim}";
break;
case "^":
e = "uparrow";
break;
case "v":
e = "downarrow";
break;
case "ellipsis":
e = "\\ldots ";
break;
case "/":
e = "/";
break;
case " / ":
e = "\\,/\\,";
break;
default:
throw ["MhchemBugT", "mhchem bug T. Please report."];
}
return e;
}, _getArrow: function(t37) {
switch (t37) {
case "->":
return "rightarrow";
case "\u2192":
return "rightarrow";
case "\u27F6":
return "rightarrow";
case "<-":
return "leftarrow";
case "<->":
return "leftrightarrow";
case "<-->":
return "leftrightarrows";
case "<=>":
return "rightleftharpoons";
case "\u21CC":
return "rightleftharpoons";
case "<=>>":
return "Rightleftharpoons";
case "<<=>":
return "Leftrightharpoons";
default:
throw ["MhchemBugT", "mhchem bug T. Please report."];
}
}, _getBond: function(t37) {
switch (t37) {
case "-":
return "{-}";
case "1":
return "{-}";
case "=":
return "{=}";
case "2":
return "{=}";
case "#":
return "{\\equiv}";
case "3":
return "{\\equiv}";
case "~":
return "{\\tripledash}";
case "~-":
return "{\\rlap{\\lower.1em{-}}\\raise.1em{\\tripledash}}";
case "~=":
return "{\\rlap{\\lower.2em{-}}\\rlap{\\raise.2em{\\tripledash}}-}";
case "~--":
return "{\\rlap{\\lower.2em{-}}\\rlap{\\raise.2em{\\tripledash}}-}";
case "-~-":
return "{\\rlap{\\lower.2em{-}}\\rlap{\\raise.2em{-}}\\tripledash}";
case "...":
return "{{\\cdot}{\\cdot}{\\cdot}}";
case "....":
return "{{\\cdot}{\\cdot}{\\cdot}{\\cdot}}";
case "->":
return "{\\rightarrow}";
case "<-":
return "{\\leftarrow}";
case "<":
return "{<}";
case ">":
return "{>}";
default:
throw ["MhchemBugT", "mhchem bug T. Please report."];
}
}, _getOperator: function(t37) {
switch (t37) {
case "+":
return " {}+{} ";
case "-":
return " {}-{} ";
case "=":
return " {}={} ";
case "<":
return " {}<{} ";
case ">":
return " {}>{} ";
case "<<":
return " {}\\ll{} ";
case ">>":
return " {}\\gg{} ";
case "\\pm":
return " {}\\pm{} ";
case "\\approx":
return " {}\\approx{} ";
case "$\\approx$":
return " {}\\approx{} ";
case "v":
return " \\downarrow{} ";
case "(v)":
return " \\downarrow{} ";
case "^":
return " \\uparrow{} ";
case "(^)":
return " \\uparrow{} ";
default:
throw ["MhchemBugT", "mhchem bug T. Please report."];
}
} };
var Ui = class t18 extends y {
constructor(e) {
super(g(p({}, e), { type: "delim" })), this.value = e.delim, this.size = e.size;
}
static fromJson(e) {
return new t18(e);
}
toJson() {
return g(p({}, super.toJson()), { delim: this.value, size: this.size });
}
render(e) {
return new w(this.value, { type: "middle" });
}
_serialize(e) {
if (!(e.expandMacro || e.skipStyles || e.skipPlaceholders) && typeof this.verbatimLatex == "string")
return this.verbatimLatex;
let r = ee(this.command, this.mode);
return r != null && r.serialize ? r.serialize(this, e) : I(this.command, this.value);
}
};
var Ji = class t19 extends y {
constructor(e) {
super(g(p({}, e), { type: "sizeddelim", value: e.delim })), this.delimType = e.delimType, this.size = e.size;
}
static fromJson(e) {
return new t19(e);
}
toJson() {
return g(p({}, super.toJson()), { delim: this.value, size: this.size, delimType: this.delimType });
}
render(e) {
let r = rm(this.value, this.size, e, { classes: { open: "ML__open", close: "ML__close" }[this.delimType], type: this.delimType, isSelected: this.isSelected });
return r ? (r = this.bind(e, r), this.caret && (r.caret = this.caret), r) : null;
}
_serialize(e) {
if (!(e.expandMacro || e.skipStyles || e.skipPlaceholders) && typeof this.verbatimLatex == "string")
return this.verbatimLatex;
let r = ee(this.command, this.mode);
return r != null && r.serialize ? r.serialize(this, e) : I(this.command, this.value);
}
};
var Ut = class t20 extends y {
constructor(e, r, i, n) {
var o, a;
super({ type: "enclose", command: e, style: n.style }), this.body = r, this.backgroundcolor = n.backgroundcolor, i.updiagonalarrow && (i.updiagonalstrike = false), i.box && (i.left = false, i.right = false, i.bottom = false, i.top = false), this.notation = i, this.shadow = (o = n.shadow) != null ? o : "none", this.strokeWidth = (a = n.strokeWidth) != null ? a : "0.06em", this.strokeWidth || (this.strokeWidth = "0.06em"), this.strokeStyle = n.strokeStyle, this.svgStrokeStyle = n.svgStrokeStyle, this.strokeColor = n.strokeColor, this.borderStyle = n.borderStyle, this.padding = n.padding, this.captureSelection = false;
}
static fromJson(e) {
return new t20(e.command, e.body, e.notation, e);
}
toJson() {
return g(p({}, super.toJson()), { notation: this.notation, shadow: this.shadow, strokeWidth: this.strokeWidth, strokeStyle: this.strokeStyle, svgStrokeStyle: this.svgStrokeStyle, strokeColor: this.strokeColor, borderStyle: this.borderStyle, padding: this.padding });
}
_serialize(e) {
var n;
if (!(e.expandMacro || e.skipStyles || e.skipPlaceholders) && typeof this.verbatimLatex == "string")
return this.verbatimLatex;
let r = ee(this.command, this.mode);
if (r != null && r.serialize)
return r.serialize(this, e);
let i = (n = this.command) != null ? n : "";
if (this.command === "\\enclose") {
i += "{" + Object.keys(this.notation).join(" ") + "}";
let o = "", a = "";
this.backgroundcolor && this.backgroundcolor !== "transparent" && (o += a + 'mathbackground="' + this.backgroundcolor + '"', a = ","), this.shadow && this.shadow !== "auto" && (o += a + 'shadow="' + this.shadow + '"', a = ","), this.strokeWidth || this.strokeStyle !== "solid" ? (o += a + this.borderStyle, a = ",") : this.strokeColor && this.strokeColor !== "currentColor" && (o += a + 'mathcolor="' + this.strokeColor + '"', a = ","), o && (i += `[${o}]`);
}
return I(i, this.bodyToLatex(e));
}
render(e) {
let r = new T({ parent: e }, this.style), i = y.createBox(r, this.body);
if (!i)
return null;
let n = Yh(this.borderStyle), o = r.toEm(!this.padding || this.padding === "auto" ? { register: "fboxsep" } : { string: this.padding });
i.setStyle("position", "relative"), i.setStyle("display", "inline-block"), i.setStyle("top", o, "em"), i.setStyle("height", i.height + i.depth, "em"), i.setStyle("width", i.width, "em");
let a = new w(null, { classes: "ML__notation" }), s = i.height + i.depth + 2 * o, l = i.width + 2 * o, c = "";
if (this.notation.horizontalstrike && (c += this.line(3, 50, 97, 50)), this.notation.verticalstrike && (c += this.line(50, 3, 50, 97)), this.notation.updiagonalstrike && (c += this.line(3, 97, 97, 3)), this.notation.downdiagonalstrike && (c += this.line(3, 3, 97, 97)), this.notation.updiagonalarrow) {
c += this.line(o.toString(), (o + i.depth + i.height).toString(), (o + i.width).toString(), o.toString());
let f = 0.03 * Math.sqrt(l * l + s * s) * 1, b = i.width * f, S = (i.depth + i.height) * f, M = o + i.width, x = o;
x + S - 0.4 * b < 0 && (x = 0.4 * b - S), c += '<polygon points="', c += `${M},${x} ${M - b - 0.4 * S},${x + S - 0.4 * b} `, c += `${M - 0.7 * b},${x + 0.7 * S} ${M - b + 0.4 * S},${x + S + 0.4 * b} `, c += `${M},${x}`, c += `" stroke='none' fill="${this.strokeColor}"`, c += "/>";
}
let u = 0;
if (this.notation.phasorangle) {
let m = um(r), h = (i.height + i.depth + 2 * m + o).toString(), f = (i.height + i.depth) / 2;
c += this.line(o.toString(), h, (o + f + i.width).toString(), h), c += this.line(o.toString(), h, (o + f).toString(), (o - m).toString()), s += m, u = f, i.left += s / 2 - o;
}
if (this.notation.longdiv) {
let m = um(r);
s += m, c += this.line(o.toString(), o.toString(), (o + i.width).toString(), o.toString());
let h = 0.3;
u = h + m, i.left += h + m, i.setTop(o + m), c += '<path d="', c += `M ${o} ${o} a${h} ${(i.depth + i.height + 2 * m) / 2}, 0, 1, 1, 0 ${i.depth + i.height + 2 * m} "`, c += ` stroke-width="${Qh(r)}" stroke="${this.strokeColor}" fill="none"`, c += "/>";
}
if (a.width = i.width + 2 * o + u, a.height = i.height + o, a.depth = i.depth + o, a.setStyle("box-sizing", "border-box"), a.setStyle("left", `calc(-${n} / 2 )`), a.setStyle("height", `${Math.floor(100 * s) / 100}em`), a.setStyle("top", `calc(${n} / 2 )`), this.backgroundcolor && a.setStyle("background-color", this.backgroundcolor), this.notation.box && a.setStyle("border", "1px solid red"), this.notation.actuarial && (a.setStyle("border-top", this.borderStyle), a.setStyle("border-right", this.borderStyle)), this.notation.madruwb && (a.setStyle("border-bottom", this.borderStyle), a.setStyle("border-right", this.borderStyle)), this.notation.roundedbox && (a.setStyle("border-radius", "8px"), a.setStyle("border", this.borderStyle)), this.notation.circle && (a.setStyle("border-radius", "50%"), a.setStyle("border", this.borderStyle)), this.notation.top && a.setStyle("border-top", this.borderStyle), this.notation.left && a.setStyle("border-left", this.borderStyle), this.notation.right && a.setStyle("border-right", this.borderStyle), this.notation.bottom && a.setStyle("border-bottom", this.borderStyle), c) {
let m = "";
this.shadow === "auto" && (m += "filter: drop-shadow(0 0 .5px rgba(255, 255, 255, .7)) drop-shadow(1px 1px 2px #333)"), this.shadow !== "none" && (m += `filter: drop-shadow(${this.shadow})`), m += ` stroke-width="${this.strokeWidth}" stroke="${this.strokeColor}"`, m += ' stroke-linecap="round"', this.svgStrokeStyle && (m += ` stroke-dasharray="${this.svgStrokeStyle}"`), a.svgStyle = m, a.svgOverlay = c;
}
let d = new w([a, i]);
return d.setStyle("position", "relative"), d.setStyle("vertical-align", o, "em"), d.setStyle("height", `${Math.floor(100 * (i.height + i.depth + 2 * o)) / 100}em`), d.setStyle("display", "inline-block"), d.height = a.height, d.depth = a.depth, d.width = a.width - 2 * o, d.left = o, d.right = o, this.caret && (d.caret = this.caret), d.wrap(r);
}
line(e, r, i, n) {
return `<line x1="${Da(e)}" y1="${Da(r)}" x2="${Da(i)}" y2="${Da(n)}" vector-effect="non-scaling-stroke"></line>`;
}
};
function Da(t37) {
return typeof t37 == "number" ? `${Math.floor(100 * t37) / 100}%` : t37;
}
function Yh(t37) {
if (!t37)
return "1px";
let e = t37.match(/([0-9][a-zA-Z\%]+)/);
return e === null ? "1px" : e[1];
}
function Qh(t37) {
return (Math.floor(100 * t37.metrics.sqrtRuleThickness / t37.scalingFactor) / 100 / 10).toString() + "em";
}
function um(t37) {
let e = t37.isDisplayStyle ? $e : t37.metrics.defaultRuleThickness;
return t37.metrics.defaultRuleThickness + t37.scalingFactor * e / 4;
}
var it = class t21 extends y {
constructor(e, r, i) {
var n, o, a;
super(g(p({}, i), { type: "genfrac", displayContainsHighlight: true })), this.above = e, this.below = r, this.hasBarLine = (n = i == null ? void 0 : i.hasBarLine) != null ? n : true, this.continuousFraction = (o = i == null ? void 0 : i.continuousFraction) != null ? o : false, this.align = (a = i == null ? void 0 : i.align) != null ? a : "center", this.numerPrefix = i == null ? void 0 : i.numerPrefix, this.denomPrefix = i == null ? void 0 : i.denomPrefix, this.mathstyleName = i == null ? void 0 : i.mathstyleName, this.leftDelim = i == null ? void 0 : i.leftDelim, this.rightDelim = i == null ? void 0 : i.rightDelim, this.fractionNavigationOrder = i == null ? void 0 : i.fractionNavigationOrder;
}
static fromJson(e) {
return new t21(e.above, e.below, e);
}
toJson() {
let e = {};
return this.continuousFraction && (e.continuousFraction = true), this.align !== "center" && (e.align = this.align), this.numerPrefix && (e.numerPrefix = this.numerPrefix), this.denomPrefix && (e.denomPrefix = this.denomPrefix), this.leftDelim && (e.leftDelim = this.leftDelim), this.rightDelim && (e.rightDelim = this.rightDelim), this.hasBarLine || (e.hasBarLine = false), this.mathstyleName && (e.mathstyleName = this.mathstyleName), this.fractionNavigationOrder && (e.fractionNavigationOrder = this.fractionNavigationOrder), p(p({}, super.toJson()), e);
}
get children() {
if (this._children)
return this._children;
let e = [];
if (this.fractionNavigationOrder === "denominator-numerator") {
for (let r of this.below)
e.push(...r.children), e.push(r);
for (let r of this.above)
e.push(...r.children), e.push(r);
} else {
for (let r of this.above)
e.push(...r.children), e.push(r);
for (let r of this.below)
e.push(...r.children), e.push(r);
}
return this._children = e, e;
}
render(e) {
var C, q;
let r = new T({ parent: e, mathstyle: this.mathstyleName }, this.style), i = r.metrics, n = new T({ parent: r, mathstyle: this.continuousFraction ? "" : "numerator" }, this.style), o = this.numerPrefix ? new w([new w(this.numerPrefix), y.createBox(n, this.above)], { isTight: n.isTight, type: "ignore" }) : (C = y.createBox(n, this.above, { type: "ignore" })) != null ? C : new w(null, { type: "ignore" }), a = new T({ parent: r, mathstyle: this.continuousFraction ? "" : "denominator" }, this.style), s = this.denomPrefix ? new w([new w(this.denomPrefix), y.createBox(a, this.below, { type: "ignore" })]) : (q = y.createBox(a, this.below, { type: "ignore" })) != null ? q : new w(null, { type: "ignore" }), l = this.hasBarLine ? i.defaultRuleThickness : 0, c, u = 0, d;
r.isDisplayStyle ? (c = n.metrics.num1, u = l > 0 ? 3 * l : 7 * l, d = a.metrics.denom1) : (l > 0 ? (c = n.metrics.num2, u = l) : (c = n.metrics.num3, u = 3 * i.defaultRuleThickness), d = a.metrics.denom2);
let m = [];
this.isSelected && m.push("ML__selected");
let h = o.depth, f = s.height, b;
if (l <= 0) {
let B = c - h - (f - d);
B < u && (c += (u - B) / 2, d += (u - B) / 2), b = new U({ individualShift: [{ box: o, shift: -c, classes: [...m, Ka(this.align)] }, { box: s, shift: d, classes: [...m, Ka(this.align)] }] }).wrap(r);
} else {
let B = new w(null, { classes: "ML__frac-line", mode: this.mode, style: this.style });
B.softWidth = Math.max(o.width, s.width), B.height = l / 2, B.depth = l / 2;
let D = Ae + l / 2;
c < u + h + D && (c = u + h + D);
let J = Ae - l / 2;
d < u + f - J && (d = u + f - J), b = new U({ individualShift: [{ box: s, shift: d, classes: [...m, Ka(this.align)] }, { box: B, shift: -J, classes: m }, { box: o, shift: -c, classes: [...m, Ka(this.align)] }] }).wrap(r);
}
let S = r.isDisplayStyle ? i.delim1 : i.delim2, M = this.leftDelim ? this.bind(e, Fi("open", this.leftDelim, S, true, e, { style: this.style, mode: this.mode, isSelected: this.isSelected })) : Ht(r, "ML__open"), x = null;
this.continuousFraction ? x = new w(null, { type: "close" }) : this.rightDelim ? x = this.bind(e, Fi("close", this.rightDelim, S, true, e, { style: this.style, mode: this.mode, isSelected: this.isSelected })) : x = Ht(r, "ML__close");
let v = new w([M, b, x], { isTight: r.isTight, type: "inner", classes: "ML__mfrac" }), k = this.bind(e, v);
return this.caret && (k.caret = this.caret), this.attachSupsub(e, { base: k });
}
};
function Ka(t37) {
var e;
return (e = { left: "ML__left", right: "ML__right", center: "ML__center" }[t37]) != null ? e : "ML__center";
}
var ie = class t22 extends y {
constructor(e, r) {
var i;
super({ type: "latex", value: e, mode: "latex" }), this.isSuggestion = (i = r == null ? void 0 : r.isSuggestion) != null ? i : false, this.isError = false;
}
static fromJson(e) {
let r = new t22(e.value);
return e.isSuggestion && (r.isSuggestion = true), e.isError && (r.isError = true), r;
}
toJson() {
let e = {};
return this.isSuggestion && (e.isSuggestion = true), this.isError && (e.isError = true), p({ type: "latex", value: this.value }, e);
}
render(e) {
let r = new w(this.value, { classes: this.isSuggestion ? "ML__suggestion" : this.isError ? "ML__error" : "", type: "latex", maxFontSize: 1 });
return r ? (this.caret && (r.caret = this.caret), this.bind(e, r)) : null;
}
};
var Ct = class t23 extends y {
constructor(e = "") {
super({ type: "latexgroup", mode: "latex" }), this.body = [...e].map((r) => new ie(r)), this.skipBoundary = true;
}
static fromJson(e) {
return new t23();
}
toJson() {
return super.toJson();
}
render(e) {
let r = y.createBox(e, this.body);
return r ? (this.caret && (r.caret = this.caret), this.bind(e, r)) : null;
}
_serialize(e) {
var r, i;
return (i = (r = this.body) == null ? void 0 : r.map((n) => n.value).join("")) != null ? i : "";
}
};
var Ur = class t24 extends y {
constructor(e, r) {
super(g(p({}, r), { type: "extensible-symbol", isFunction: r == null ? void 0 : r.isFunction })), this.value = e, this.variant = r == null ? void 0 : r.variant, this.subsupPlacement = r == null ? void 0 : r.limits;
}
static fromJson(e) {
return new t24(e.symbol, e);
}
toJson() {
let e = super.toJson();
return this.variant && (e.variant = this.variant), this.subsupPlacement && (e.limits = this.subsupPlacement), this.value && (e.symbol = this.value), e;
}
render(e) {
var s;
let r = e.isDisplayStyle && this.value !== "\\smallint", i = new w(this.value, { fontFamily: r ? "Size2-Regular" : "Size1-Regular", classes: "ML__op-symbol " + (r ? "ML__large-op" : "ML__small-op"), type: "op", maxFontSize: e.scalingFactor, isSelected: this.isSelected });
if (!i)
return null;
i.right = i.italic;
let n = (i.height - i.depth) / 2 - Ae * e.scalingFactor, o = i.italic;
i.setTop(n);
let a = i;
if (this.superscript || this.subscript) {
let l = (s = this.subsupPlacement) != null ? s : "auto";
l === "auto" && e.isDisplayStyle && (l = "over-under"), a = l === "over-under" ? this.attachLimits(e, { base: i, baseShift: n, slant: o }) : this.attachSupsub(e, { base: i });
}
return new w(this.bind(e, a), { type: "op", caret: this.caret, isSelected: this.isSelected, classes: "ML__op-group" }).wrap(e);
}
_serialize(e) {
if (!(e.expandMacro || e.skipStyles || e.skipPlaceholders) && typeof this.verbatimLatex == "string")
return this.verbatimLatex;
let r = ee(this.command, this.mode);
if (r != null && r.serialize)
return r.serialize(this, e);
let i = [];
return i.push(this.command), this.explicitSubsupPlacement && (this.subsupPlacement === "over-under" && i.push("\\limits"), this.subsupPlacement === "adjacent" && i.push("\\nolimits"), this.subsupPlacement === "auto" && i.push("\\displaylimits")), i.push(this.supsubToLatex(e)), K(i);
}
};
var nt = class t25 extends y {
constructor(e) {
let r = e.body;
super(g(p({}, e), { type: "overlap", body: typeof r == "string" ? [new y({ value: r })] : r, style: e == null ? void 0 : e.style })), this.skipBoundary = true, this.align = e == null ? void 0 : e.align, this.boxType = e == null ? void 0 : e.boxType;
}
static fromJson(e) {
return new t25(e);
}
toJson() {
let e = {};
return this.align && (e.align = this.align), this.boxType && (e.boxType = this.boxType), p(p({}, super.toJson()), e);
}
render(e) {
let r = y.createBox(e, this.body, { classes: "ML__inner" });
return r ? (this.caret && (r.caret = this.caret), this.bind(e, new w([r, new w(null, { classes: "ML__fix" })], { classes: this.align === "right" ? "ML__rlap" : "ML__llap", type: this.boxType }))) : null;
}
};
var ye = class t26 extends y {
constructor(e) {
var r, i, n, o;
super({ type: "overunder", command: e.command, style: e.style, mode: e.mode, body: e.body, skipBoundary: (r = e.skipBoundary) != null ? r : true }), this.subsupPlacement = e.supsubPlacement, this.svgAbove = e.svgAbove, this.svgBelow = e.svgBelow, this.svgBody = e.svgBody, this.above = e.above, this.below = e.below, this.boxType = (i = e.boxType) != null ? i : "ord", this.paddedBody = (n = e.paddedBody) != null ? n : false, this.paddedLabels = (o = e.paddedLabels) != null ? o : false;
}
static fromJson(e) {
return new t26(e);
}
toJson() {
let e = super.toJson();
return this.skipBoundary || (e.skipBoundary = false), this.subsupPlacement && (e.subsupPlacement = this.subsupPlacement), this.svgAbove && (e.svgAbove = this.svgAbove), this.svgBelow && (e.svgBelow = this.svgBelow), this.svgBody && (e.svgBody = this.svgBody), this.boxType !== "ord" && (e.boxType = this.boxType), this.paddedBody && (e.paddedBody = true), this.paddedLabels && (e.paddedLabels = true), e;
}
render(e) {
let r = this.svgBody ? Bi(this.svgBody) : y.createBox(e, this.body, { type: "ignore" }), i = new T({ parent: e, mathstyle: "scriptstyle" }, this.style), n = null;
this.svgAbove ? n = Bi(this.svgAbove) : this.above && (n = y.createBox(i, this.above, { type: "ignore" }));
let o = null;
this.svgBelow ? o = Bi(this.svgBelow) : this.below && (o = y.createBox(i, this.below, { type: "ignore" })), this.paddedBody && (r = new w([Ht(e, "ML__open"), r, Ht(e, "ML__close")], { type: "ignore" }));
let a = ef(e, { base: r, above: n, below: o, type: this.boxType === "bin" || this.boxType === "rel" ? this.boxType : "ord", paddedAboveBelow: this.paddedLabels });
return a ? (this.subsupPlacement === "over-under" ? a = this.attachLimits(e, { base: a, type: a.type }) : a = this.attachSupsub(e, { base: a }), this.caret && (a.caret = this.caret), this.bind(e, a)) : null;
}
};
function ef(t37, e) {
if (!e.base)
return null;
if (!e.above && !e.below) {
let s = new w(e.base, { type: e.type });
return s.setStyle("position", "relative"), s;
}
let r = 0;
e.above && (r = t37.metrics.bigOpSpacing5);
let i = null, n = e.base, o = 0, a = ["ML__center"];
if (e.paddedAboveBelow && a.push("ML__label_padding"), e.below && e.above) {
let s = t37.metrics.bigOpSpacing5 + e.below.height + e.below.depth + n.depth + o;
i = new U({ bottom: s, children: [t37.metrics.bigOpSpacing5, { box: e.below, classes: a }, { box: n, classes: ["ML__center"] }, r, { box: e.above, classes: a }, t37.metrics.bigOpSpacing5] });
} else
e.below ? i = new U({ top: n.height - o, children: [t37.metrics.bigOpSpacing5, { box: e.below, classes: a }, { box: n, classes: ["ML__center"] }] }) : e.above && (i = new U({ bottom: n.depth + o, children: [{ box: n, classes: ["ML__center"] }, r, { box: e.above, classes: a }, t37.metrics.bigOpSpacing5] }));
return new w(i, { type: e.type });
}
var Jt = class t27 extends y {
constructor(e) {
var r, i, n, o;
super(g(p({}, e), { type: "phantom" })), this.captureSelection = true, this.isInvisible = (r = e.isInvisible) != null ? r : false, this.smashDepth = (i = e.smashDepth) != null ? i : false, this.smashHeight = (n = e.smashHeight) != null ? n : false, this.smashWidth = (o = e.smashWidth) != null ? o : false;
}
static fromJson(e) {
return new t27(e);
}
toJson() {
let e = {};
return this.isInvisible && (e.isInvisible = true), this.smashDepth && (e.smashDepth = true), this.smashHeight && (e.smashHeight = true), this.smashWidth && (e.smashWidth = true), p(p({}, super.toJson()), e);
}
render(e) {
let r = new T({ parent: e, isPhantom: true });
if (!this.smashDepth && !this.smashHeight && !this.smashWidth)
return this.isInvisible, y.createBox(r, this.body, { classes: "ML__inner" });
let i = y.createBox(this.isInvisible ? r : e, this.body);
if (!i)
return null;
if (this.smashWidth) {
let n = new w(null, { classes: "ML__fix" });
return new w([i, n], { classes: "ML__rlap" }).wrap(e);
}
if (!this.smashHeight && !this.smashDepth)
return i;
if (this.smashHeight && (i.height = 0), this.smashDepth && (i.depth = 0), i.children)
for (let n of i.children)
this.smashHeight && (n.height = 0), this.smashDepth && (n.depth = 0);
return new U({ firstBaseline: [{ box: i }] }, { type: i.type }).wrap(e);
}
};
var Et = class t28 extends y {
constructor(e) {
var r;
super(p({ type: "spacing" }, e)), this.width = e == null ? void 0 : e.width, this._braced = (r = e == null ? void 0 : e.braced) != null ? r : false;
}
static fromJson(e) {
return new t28(e);
}
toJson() {
let e = super.toJson();
return this.width !== void 0 && (e.width = this.width), this._braced && (e.braced = true), e;
}
render(e) {
var i;
if (this.command === "space")
return new w(this.mode === "math" ? null : " ");
let r;
if (this.width !== void 0)
r = new w(null, { classes: "ML__mspace" }), r.left = e.toEm(this.width);
else {
let n = (i = { "\\qquad": "ML__qquad", "\\quad": "ML__quad", "\\enspace": "ML__enspace", "\\;": "ML__thickspace", "\\:": "ML__mediumspace", "\\>": "ML__mediumspace", "\\,": "ML__thinspace", "\\!": "ML__negativethinspace" }[this.command]) != null ? i : "ML__mediumspace";
r = new w(null, { classes: n });
}
return r = this.bind(e, r), this.caret && (r.caret = this.caret), r;
}
_serialize(e) {
var n;
if (!e.expandMacro && typeof this.verbatimLatex == "string")
return this.verbatimLatex;
let r = ee(this.command, this.mode);
if (r != null && r.serialize)
return r.serialize(this, e);
let i = (n = this.command) != null ? n : "";
return this.width === void 0 ? i : this._braced && !("register" in this.width) ? `${i}{${ue(this.width)}}` : `${i}${ue(this.width)}`;
}
};
var Gi = class t29 extends y {
constructor(e) {
var r;
super(g(p({}, e), { type: "surd", mode: (r = e.mode) != null ? r : "math", style: e.style, displayContainsHighlight: true, body: e.body })), this.above = e.index;
}
static fromJson(e) {
return new t29(g(p({}, e), { index: e.above }));
}
_serialize(e) {
if (!(e.expandMacro || e.skipStyles || e.skipPlaceholders) && typeof this.verbatimLatex == "string")
return this.verbatimLatex;
let r = ee(this.command, this.mode);
if (r != null && r.serialize)
return r.serialize(this, e);
let i = this.command, n = this.bodyToLatex(e);
return this.above && !this.hasEmptyBranch("above") ? I(`${i}[${this.aboveToLatex(e)}]`, n) : /^[0-9]$/.test(n) ? `${i}${n}` : I(i, n);
}
get children() {
if (this._children)
return this._children;
let e = [];
if (this.above)
for (let r of this.above)
e.push(...r.children), e.push(r);
if (this.body)
for (let r of this.body)
e.push(...r.children), e.push(r);
return this._children = e, e;
}
render(e) {
var x;
let r = new T({ parent: e, mathstyle: "cramp" }, this.style), i = (x = y.createBox(r, this.body, { type: "inner" })) != null ? x : new w(null), n = r.scalingFactor, o = r.metrics.defaultRuleThickness / n, a = e.isDisplayStyle ? $e : o, s = new w(null, { classes: "ML__sqrt-line", style: this.style });
s.height = o, s.softWidth = i.width;
let l = n * (o + a / 4), u = Math.max(n * 2 * a, i.height + i.depth) + l + o, d = new T({ parent: e }, this.style), m = this.bind(d, new w(Fi("inner", "\\surd", u, false, d, { isSelected: this.isSelected }), { isSelected: this.isSelected, classes: "ML__sqrt-sign", style: this.style }));
if (!m)
return null;
let h = m.height + m.depth - o;
h > i.height + i.depth + l && (l = (l + h - (i.height + i.depth)) / 2), m.setTop(m.height - i.height - l);
let f = this.bind(e, new U({ firstBaseline: [{ box: new w(i) }, l - 2 * o, { box: s }, o] })), b = y.createBox(new T({ parent: e, mathstyle: "scriptscriptstyle" }), this.above, { type: "ignore" });
if (!b) {
let v = new w([m, f], { classes: this.containsCaret ? "ML__contains-caret" : "", type: "inner" });
return v.setStyle("display", "inline-block"), v.setStyle("height", v.height + v.depth, "em"), this.caret && (v.caret = this.caret), this.bind(e, v);
}
let S = new U({ shift: -0.6 * (Math.max(m.height, f.height) - Math.max(m.depth, f.depth)), children: [{ box: b }] }), M = new w([new w(S, { classes: "ML__sqrt-index", type: "ignore" }), m, f], { type: "inner", classes: this.containsCaret ? "ML__contains-caret" : "" });
return M.height = m.height, M.depth = m.depth, this.caret && (M.caret = this.caret), this.bind(e, M);
}
};
var _l = class extends w {
constructor(e) {
super(null, { type: "skip" }), this._width = e;
}
toMarkup() {
return `<span style="display:inline-block;width:${Math.ceil(this.width * 100) / 100}em"></span>`;
}
};
function Fn(t37, e) {
if (!t37.parent)
return;
let r = t37.parent.children, i = r.indexOf(t37), n = i - 1;
for (; n >= 0 && r[n].type === "ignore"; )
n -= 1;
if (n < 0 && t37.parent.parent && t37.parent.type === "lift") {
Fn(t37.parent, e);
return;
}
i > 0 && r[i - 1].type === "skip" ? r[i - 1].width += e : r.splice(i, 0, new _l(e));
}
var tf = { ord: { op: 3, bin: 4, rel: 5, inner: 3 }, op: { ord: 3, op: 3, rel: 5, inner: 3 }, bin: { ord: 4, op: 4, open: 4, inner: 4 }, rel: { ord: 5, op: 5, open: 5, inner: 5 }, close: { op: 3, bin: 4, rel: 5, inner: 3 }, punct: { ord: 3, op: 3, rel: 3, open: 3, punct: 3, inner: 3 }, inner: { ord: 3, op: 3, bin: 4, rel: 5, open: 3, punct: 3, inner: 3 } };
var rf = { ord: { op: 3 }, op: { ord: 3, op: 3 }, close: { op: 3 }, inner: { op: 3 } };
function nf(t37) {
$n(t37, (e, r) => {
r.type === "bin" && (!e || /^(middle|bin|op|rel|open|punct)$/.test(e.type)) && (r.type = "ord"), (e == null ? void 0 : e.type) === "bin" && /^(rel|close|punct)$/.test(r.type) && (e.type = "ord"), r.type !== "ignore" && (e = r);
});
}
function Tt(t37, e) {
if (!t37.children)
return t37;
let r = t37.children;
nf(r);
let i = e.getRegisterAsEm("thinmuskip"), n = e.getRegisterAsEm("medmuskip"), o = e.getRegisterAsEm("thickmuskip");
return $n(r, (a, s) => {
var d, m, h;
if (!a)
return;
let l = a.type, c = s.isTight ? (d = rf[l]) != null ? d : null : (m = tf[l]) != null ? m : null, u = (h = c == null ? void 0 : c[s.type]) != null ? h : null;
u === 3 && Fn(s, i), u === 4 && Fn(s, n), u === 5 && Fn(s, o);
}), t37;
}
function $n(t37, e, r = void 0) {
if (!t37)
return r;
t37 = [...t37];
for (let i of t37)
i.type === "lift" ? r = $n(i.children, e, r) : i.type === "ignore" ? $n(i.children, e) : (e(r, i), $n(i.children, e), r = i);
return r;
}
var Jr = class t30 extends y {
constructor(e) {
super({ type: "tooltip", command: e.command, mode: e.mode, style: e.style, body: e.body, displayContainsHighlight: true }), this.tooltip = new y({ type: "root", mode: e.content, body: e.tooltip, style: {} }), this.skipBoundary = true, this.captureSelection = false;
}
static fromJson(e) {
return new t30(g(p({}, e), { tooltip: ot(e.tooltip) }));
}
toJson() {
var r;
let e = (r = this.tooltip.body) == null ? void 0 : r.filter((i) => i.type !== "first").map((i) => i.toJson());
return g(p({}, super.toJson()), { tooltip: e });
}
render(e) {
let r = y.createBox(new T(), this.body);
if (!r)
return null;
let i = new T({ parent: e, mathstyle: "displaystyle" }, { fontSize: Di }), n = dr(Tt(new w(this.tooltip.render(i), { classes: "ML__tooltip-content" }), i)), o = new w([n, r], { classes: "ML__tooltip-container" });
return this.caret && (o.caret = this.caret), this.bind(e, o);
}
};
var at = class t31 extends y {
constructor(e, r) {
super(g(p({}, r), { type: "operator", isFunction: r == null ? void 0 : r.isFunction })), this.value = e, this.variant = r == null ? void 0 : r.variant, this.variantStyle = r == null ? void 0 : r.variantStyle, this.subsupPlacement = r == null ? void 0 : r.limits;
}
static fromJson(e) {
return new t31(e.symbol, e);
}
toJson() {
let e = super.toJson();
return this.variant && (e.variant = this.variant), this.variantStyle && (e.variantStyle = this.variantStyle), this.subsupPlacement && (e.limits = this.subsupPlacement), this.value && (e.symbol = this.value), e;
}
render(e) {
var n;
let r = new w(this.value, { type: "op", mode: "math", maxFontSize: e.scalingFactor, style: { variant: this.variant, variantStyle: this.variantStyle }, isSelected: this.isSelected, letterShapeStyle: e.letterShapeStyle }), i = r;
if (this.superscript || this.subscript) {
let o = (n = this.subsupPlacement) != null ? n : "auto";
i = o === "over-under" || o === "auto" && e.isDisplayStyle ? this.attachLimits(e, { base: r }) : this.attachSupsub(e, { base: r });
}
return new w(this.bind(e, i), { type: "op", caret: this.caret, isSelected: this.isSelected, classes: "ML__op-group" }).wrap(e);
}
_serialize(e) {
if (!(e.expandMacro || e.skipStyles || e.skipPlaceholders) && typeof this.verbatimLatex == "string")
return this.verbatimLatex;
let r = ee(this.command, this.mode);
if (r != null && r.serialize)
return r.serialize(this, e);
let i = [this.command];
return this.explicitSubsupPlacement && (this.subsupPlacement === "over-under" && i.push("\\limits"), this.subsupPlacement === "adjacent" && i.push("\\nolimits"), this.subsupPlacement === "auto" && i.push("\\displaylimits")), i.push(this.supsubToLatex(e)), K(i);
}
};
function ot(t37) {
if (X(t37))
return t37.map((i) => ot(i));
if (typeof t37 == "string")
return y.fromJson(t37);
t37 = p({}, t37);
for (let i of gr)
t37[i] && (t37[i] = ot(t37[i]));
t37.args && (t37.args = of(t37.args)), t37.array && (t37.array = ot(t37.array));
let e = t37.type, r;
e === "accent" && (r = xr.fromJson(t37)), e === "array" && (r = N.fromJson(t37)), e === "box" && (r = qe.fromJson(t37)), e === "chem" && (r = Nn.fromJson(t37)), e === "composition" && (r = $i.fromJson(t37)), e === "delim" && (r = Ui.fromJson(t37)), e === "enclose" && (r = Ut.fromJson(t37)), e === "error" && (r = rt.fromJson(t37)), e === "extensible-symbol" && (r = Ur.fromJson(t37)), e === "genfrac" && (r = it.fromJson(t37)), e === "group" && (r = Vi.fromJson(t37)), e === "latex" && (r = ie.fromJson(t37)), e === "latexgroup" && (r = Ct.fromJson(t37)), e === "leftright" && (r = H.fromJson(t37)), e === "macro" && (r = qi.fromJson(t37)), e === "macro-argument" && (r = Ca.fromJson(t37)), e === "operator" && (r = at.fromJson(t37)), e === "overlap" && (r = nt.fromJson(t37)), e === "overunder" && (r = ye.fromJson(t37)), e === "placeholder" && (r = ge.fromJson(t37)), e === "prompt" && (r = Hi.fromJson(t37)), e === "phantom" && (r = Jt.fromJson(t37)), e === "sizeddelim" && (r = Ji.fromJson(t37)), e === "spacing" && (r = Et.fromJson(t37)), e === "subsup" && (r = Wt.fromJson(t37)), e === "surd" && (r = Gi.fromJson(t37)), e === "text" && (r = Be.fromJson(t37)), e === "tooltip" && (r = Jr.fromJson(t37)), r || (!e || ["first", "mbin", "mrel", "mclose", "minner", "mop", "mopen", "mord", "mpunct", "root", "space"].includes(e), `${e}`, r = y.fromJson(t37));
for (let i of gr)
t37[i] && r.setChildren(t37[i], i);
return t37.verbatimLatex !== void 0 && (r.verbatimLatex = t37.verbatimLatex), t37.subsupPlacement && (r.subsupPlacement = t37.subsupPlacement), t37.explicitSubsupPlacement && (r.explicitSubsupPlacement = true), t37.isFunction && (r.isFunction = true), t37.skipBoundary && (r.skipBoundary = true), t37.captureSelection && (r.captureSelection = true), r;
}
function of(t37) {
if (t37 && Array.isArray(t37))
return t37.map((e) => e === "<null>" ? null : typeof e == "object" && "group" in e ? { group: e.group.map((r) => ot(r)) } : typeof e == "object" && "atoms" in e ? e.atoms.map((r) => ot(r)) : e);
}
function Dt(t37, e) {
!t37 || !e || (X(t37) ? t37.forEach((r) => Dt(r, e)) : typeof t37 == "object" && !t37.style.color && !t37.style.backgroundColor && !t37.style.fontFamily && !t37.style.fontShape && !t37.style.fontSeries && !t37.style.fontSize && !t37.style.variant && !t37.style.variantStyle && (t37.applyStyle(e), Dt(t37.body, e), Dt(t37.above, e), Dt(t37.below, e), Dt(t37.subscript, e), Dt(t37.superscript, e)));
}
function Vn(t37, e, r, i) {
function n(a, s) {
for (let l of o)
if (l.style[a] !== s)
return false;
return true;
}
if (e = t37.normalizeRange(e), e[0] === e[1])
return false;
let o = t37.getAtoms(e, { includeChildren: true });
i.operation === "toggle" && (r.color && n("color", r.color) && (r.color = "none", delete r.verbatimColor), r.backgroundColor && n("backgroundColor", r.backgroundColor) && (r.backgroundColor = "none", delete r.verbatimBackgroundColor), r.fontFamily && n("fontFamily", r.fontFamily) && (r.fontFamily = "none"), r.fontSeries && n("fontSeries", r.fontSeries) && (r.fontSeries = "auto"), r.fontShape && n("fontShape", r.fontShape) && (r.fontShape = "auto"), r.fontSize && n("fontSize", r.fontSize) && (r.fontSize = Di), r.variant && n("variant", r.variant) && (r.variant = "normal"), r.variantStyle && n("variantStyle", r.variantStyle) && (r.variantStyle = ""));
for (let a of o)
a.applyStyle(r);
return true;
}
function dm(t37) {
return { up: "italic", bold: "bolditalic", italic: "italic", bolditalic: "bolditalic", "": "italic" }[t37 != null ? t37 : ""];
}
function qn(t37) {
return { up: "up", bold: "bold", italic: void 0, bolditalic: "bold", "": void 0 }[t37 != null ? t37 : ""];
}
var Ml = { main: ["Main-Regular", "ML__cmr"], "main-italic": ["Main-Italic", "ML__cmr ML__it"], "main-bold": ["Main-Bold", "ML__cmr ML__bold"], "main-bolditalic": ["Main-BoldItalic", "ML__cmr ML__bold ML__it"], normal: ["Main-Regular", "ML__cmr"], "normal-bold": ["Main-Bold", "ML__mathbf"], "normal-italic": ["Math-Italic", "ML__mathit"], "normal-bolditalic": ["Math-BoldItalic", "ML__mathbfit"], ams: ["AMS-Regular", "ML__ams"], "ams-bold": ["AMS-Regular", "ML__ams ML__bold"], "ams-italic": ["AMS-Regular", "ML__ams ML__it"], "ams-bolditalic": ["AMS-Regular", "ML__ams ML__bold ML__it"], "sans-serif": ["SansSerif-Regular", "ML__sans"], "sans-serif-bold": ["SansSerif-Regular", "ML__sans ML__bold"], "sans-serif-italic": ["SansSerif-Regular", "ML__sans ML__it"], "sans-serif-bolditalic": ["SansSerif-Regular", "ML__sans ML__bold ML__it"], calligraphic: ["Caligraphic-Regular", "ML__cal"], "calligraphic-bold": ["Caligraphic-Regular", "ML__cal ML__bold"], "calligraphic-italic": ["Caligraphic-Regular", "ML__cal ML__it"], "calligraphic-bolditalic": ["Caligraphic-Regular", "ML__cal ML__bold ML__it"], script: ["Script-Regular", "ML__script"], "script-bold": ["Script-Regular", "ML__script ML__bold"], "script-italic": ["Script-Regular", "ML__script ML__it"], "script-bolditalic": ["Script-Regular", "ML__script ML__bold ML__it"], fraktur: ["Fraktur-Regular", "ML__frak"], "fraktur-bold": ["Fraktur-Regular", "ML__frak ML__bold"], "fraktur-italic": ["Fraktur-Regular", "ML__frak ML__it"], "fraktur-bolditalic": ["Fraktur-Regular", "ML__frak ML__bold ML__it"], monospace: ["Typewriter-Regular", "ML__tt"], "monospace-bold": ["Typewriter-Regular", "ML__tt ML__bold"], "monospace-italic": ["Typewriter-Regular", "ML__tt ML__it"], "monospace-bolditalic": ["Typewriter-Regular", "ML__tt ML__bold ML__it"], "double-struck": ["AMS-Regular", "ML__bb"], "double-struck-bold": ["AMS-Regular", "ML__bb ML__bold"], "double-struck-italic": ["AMS-Regular", "ML__bb ML_italic"], "double-struck-bolditalic": ["AMS-Regular", "ML__bb ML_bolditalic"] };
var Oa = { "double-struck": /^[A-Z ]$/, script: /^[A-Z ]$/, calligraphic: /^[\dA-Z ]$/, fraktur: /^[\dA-Za-z ]$|^[!"#$%&'()*+,\-./:;=?[]^]$/, monospace: /^[\dA-Za-z ]$|^[!"&'()*+,\-./:;=?@[\]^_~\u0131\u0237\u0393\u0394\u0398\u039B\u039E\u03A0\u03A3\u03A5\u03A8\u03A9]$/, "sans-serif": /^[\dA-Za-z ]$|^[!"&'()*+,\-./:;=?@[\]^_~\u0131\u0237\u0393\u0394\u0398\u039B\u039E\u03A0\u03A3\u03A5\u03A8\u03A9]$/ };
var mm = /^[\u03B1-\u03C9]|\u03D1|\u03D5|\u03D6|\u03F1|\u03F5]$/;
var af = /^[\u0393|\u0394\u0398\u039B\u039E\u03A0\u03A3\u03A5\u03A6\u03A8\u03A9]$/;
var sf = [/^[a-z]$/, /^[A-Z]$/, mm, af];
var lf = { iso: ["it", "it", "it", "it"], tex: ["it", "it", "it", "up"], french: ["it", "up", "up", "up"], upright: ["up", "up", "up", "up"] };
var wl = class extends ce {
constructor() {
super("math");
}
createAtom(e, r, i) {
var a, s, l, c, u, d;
if (r === null)
return new y({ type: "mord", mode: "math", command: e, value: e, style: i });
let n = (l = (s = globalThis.MathfieldElement) == null ? void 0 : s.isFunction((a = r.command) != null ? a : e)) != null ? l : false;
if (r.definitionType === "symbol") {
let m = new y({ type: (c = r.type) != null ? c : "mord", mode: "math", command: (u = r.command) != null ? u : e, value: String.fromCodePoint(r.codepoint), style: i });
return n && (m.isFunction = true), e.startsWith("\\") && (m.verbatimLatex = e), m;
}
let o = new y({ type: "mord", mode: "math", command: (d = r.command) != null ? d : e, value: e, style: i });
return n && (o.isFunction = true), e.startsWith("\\") && (o.verbatimLatex = e), o;
}
serialize(e, r) {
let i = cf(e, g(p({}, r), { defaultMode: "math" }));
return i.length === 0 || r.defaultMode !== "text" ? i : ["$ ", ...i, " $"];
}
getFont(e, r) {
var l, c;
if (r.variant, r.fontFamily) {
let [u, d] = Ml[r.fontFamily];
return d && (e.classes += " " + d), u;
}
let { variant: i } = r, { variantStyle: n } = r;
if (i === "normal" && !n && /[\u00A3\u0131\u0237]/.test(e.value) && (i = "main", n = "italic"), i === "normal" && !n && e.value.length === 1) {
let u = false;
sf.forEach((d, m) => {
var h;
d.test(e.value) && lf[(h = r.letterShapeStyle) != null ? h : "tex"][m] === "it" && (u = true);
}), u && (n = dm(n));
}
n === "up" && (n = void 0);
let o = n ? i + "-" + n : i;
Ml[o];
let [a, s] = Ml[o];
if (Oa[i] && !Oa[i].test(e.value)) {
let u = gn(e.value, i, n);
return u || (u = (l = gn(e.value, i)) != null ? l : e.value, e.classes += (c = { bold: " ML__bold", italic: " ML__it", "bold-italic": " ML__bold ML__it" }[n != null ? n : ""]) != null ? c : ""), e.value = u, null;
}
return mm.test(e.value) && (e.classes += " lcGreek"), s && (e.classes += " " + s), a;
}
};
function cf(t37, e) {
return Ye(t37, "bold").map((r) => {
if (ha(r[0]) !== "bold")
return Ba(r, e).join("");
if (ha(r[0].parent) === "bold")
return K(Ba(r, e));
let n = r.map((o) => {
var a;
return (a = o.value) != null ? a : "";
}).join("");
return /^[a-zA-Z0-9]+$/.test(n) ? I("\\mathbf", K(Ba(r, e))) : I("\\bm", K(Ba(r, e)));
});
}
function Ba(t37, e) {
let { parent: r } = t37[0], i = fa(r);
return Ye(t37, "variant").map((n) => {
let o = fa(n[0]), a = "";
o && o !== i && (a = { calligraphic: "\\mathcal", "calligraphic-uo": "\\mathcal", fraktur: "\\mathfrak", "fraktur-uo": "\\mathfrak", "double-struck": "\\mathbb", "double-struck-uo": "\\mathbb", script: "\\mathscr", "script-uo": "\\mathscr", monospace: "\\mathtt", "monospace-uo": "\\mathtt", "sans-serif": "\\mathsf", "sans-serif-uo": "\\mathsf", normal: "", "normal-up": "\\mathrm", "normal-italic": "\\mathnormal", "normal-bold": "", "normal-bolditalic": "\\mathbfit", ams: "", "ams-up": "\\mathrm", "ams-italic": "\\mathit", "ams-bold": "", "ams-bolditalic": "\\mathbfit", main: "", "main-up": "\\mathrm", "main-italic": "\\mathit", "main-bold": "", "main-bolditalic": "\\mathbfit" }[o]);
let s = K(n.map((l) => l._serialize(e)));
return a ? I(a, s) : s;
});
}
new wl();
function uf(t37, e) {
return t37.map((r) => r._serialize(e));
}
function df(t37, e) {
return Ye(t37, "fontShape").map((r) => {
let i = uf(r, e), { fontShape: n } = r[0].style, o = "";
return n === "it" && (o = "\\textit"), n === "sl" && (o = "\\textsl"), n === "sc" && (o = "\\textsc"), n === "n" && (o = "\\textup"), !o && n ? `{${I("\\fontshape", n)}${K(i)}}` : o ? I(o, K(i)) : K(i);
});
}
function mf(t37, e) {
return Ye(t37, "fontSeries").map((r) => {
let i = df(r, e), { fontSeries: n } = r[0].style, o = "";
return n === "b" && (o = "\\textbf"), n === "l" && (o = "\\textlf"), n === "m" && (o = "\\textmd"), n && !o ? `{${I("\\fontseries", n)}${K(i)}}` : o ? I(o, K(i)) : K(i);
});
}
function pf(t37, e) {
return Ye(t37, "fontSize").map((r) => {
var o, a;
let i = mf(r, e), n = (a = ["", "\\tiny", "\\scriptsize", "\\footnotesize", "\\small", "\\normalsize", "\\large", "\\Large", "\\LARGE", "\\huge", "\\Huge"][(o = r[0].style.fontSize) != null ? o : ""]) != null ? a : "";
return n ? `${n} ${K(i)}` : K(i);
});
}
function hf(t37, e, r) {
return Ye(t37, "fontFamily").map((i) => {
var s;
r = r && !i.every((l) => l.style.fontFamily || l.style.fontShape || l.style.fontSeries || l.style.fontSize);
let n = pf(i, e), { fontFamily: o } = i[0].style, a = (s = { roman: "textrm", monospace: "texttt", "sans-serif": "textsf" }[o != null ? o : ""]) != null ? s : "";
return a ? `\\${a}{${K(n)}}` : o ? `{\\fontfamily{${i[0].style.fontFamily}} ${K(n)}}` : r ? `\\text{${K(n)}}` : K(n);
});
}
var pm = { roman: "", "sans-serif": "ML__sans", monospace: "ML__tt" };
var kl = class extends ce {
constructor() {
super("text");
}
createAtom(e, r, i) {
return r && r.definitionType === "symbol" ? new Be(e, String.fromCodePoint(r.codepoint), i != null ? i : {}) : null;
}
serialize(e, r) {
return hf(e, g(p({}, r), { defaultMode: "text" }), r.defaultMode !== "text");
}
getFont(e, r) {
var n, o, a, s, l;
let { fontFamily: i } = r;
if (pm[i] ? e.classes += " " + pm[i] : i && e.setStyle("font-family", i), r.fontShape && (e.classes += " ", e.classes += (n = { it: "ML__it", sl: "ML__shape_sl", sc: "ML__shape_sc", ol: "ML__shape_ol" }[r.fontShape]) != null ? n : ""), r.fontSeries) {
let c = r.fontSeries.match(/(.?[lbm])?(.?[cx])?/);
c && (e.classes += " ", e.classes += (a = { ul: "ML__series_ul", el: "ML__series_el", l: "ML__series_l", sl: "ML__series_sl", m: "", sb: "ML__series_sb", b: "ML__bold", eb: "ML__series_eb", ub: "ML__series_ub" }[(o = c[1]) != null ? o : ""]) != null ? a : "", e.classes += " ", e.classes += (l = { uc: "ML__series_uc", ec: "ML__series_ec", c: "ML__series_c", sc: "ML__series_sc", n: "", sx: "ML__series_sx", x: "ML__series_x", ex: "ML__series_ex", ux: "ML__series_ux" }[(s = c[2]) != null ? s : ""]) != null ? l : "");
}
return "Main-Regular";
}
};
new kl();
var Sl = class extends ce {
constructor() {
super("latex");
}
createAtom(e) {
return new ie(e);
}
serialize(e, r) {
return e.filter((i) => i instanceof ie && !i.isSuggestion).map((i) => i.value);
}
getFont() {
return null;
}
};
new Sl();
var hm = { id: "dvorak", locale: "en", displayName: "Dvorak", virtualLayout: "dvorak", platform: "", score: 0, mapping: { KeyA: ["a", "A", "\xE5", "\xC5"], KeyB: ["x", "X", "\u2248", "\u02DB"], KeyC: ["j", "J", "\u2206", "\xD4"], KeyD: ["e", "E", "\xB4", "\xB4"], KeyE: [".", ">", "\u2265", "\u02D8"], KeyF: ["u", "U", "\xA8", "\xA8"], KeyG: ["i", "I", "\u02C6", "\u02C6"], KeyH: ["d", "D", "\u2202", "\xCE"], KeyI: ["c", "C", "\xE7", "\xC7"], KeyJ: ["h", "H", "\u02D9", "\xD3"], KeyK: ["t", "T", "\u2020", "\u02C7"], KeyL: ["n", "N", "\u02DC", "\u02DC"], KeyM: ["m", "M", "\xB5", "\xC2"], KeyN: ["b", "B", "\u222B", "\u0131"], KeyO: ["r", "R", "\xAE", "\u2030"], KeyP: ["l", "L", "\xAC", "\xD2"], KeyQ: ["'", '"', "\xE6", "\xC6"], KeyR: ["p", "P", "\u03C0", "\u220F"], KeyS: ["o", "O", "\xF8", "\xD8"], KeyT: ["y", "Y", "\xA5", "\xC1"], KeyU: ["g", "G", "\xA9", "\u02DD"], KeyV: ["k", "K", "\u02DA", "\uF8FF"], KeyW: [",", "<", "\u2264", "\xAF"], KeyX: ["q", "Q", "\u0153", "\u0152"], KeyY: ["f", "F", "\u0192", "\xCF"], KeyZ: [";", ":", "\u2026", "\xDA"], Digit1: ["1", "!", "\xA1", "\u2044"], Digit2: ["2", "@", "\u2122", "\u20AC"], Digit3: ["3", "#", "\xA3", "\u2039"], Digit4: ["4", "$", "\xA2", "\u203A"], Digit5: ["5", "%", "\u221E", "\uFB01"], Digit6: ["6", "^", "\xA7", "\uFB02"], Digit7: ["7", "&", "\xB6", "\u2021"], Digit8: ["8", "*", "\u2022", "\xB0"], Digit9: ["9", "(", "\xAA", "\xB7"], Digit0: ["0", ")", "\xBA", "\u201A"], Space: [" ", " ", " ", " "], Minus: ["[", "{", "\u201C", "\u201D"], Equal: ["]", "}", "\u2018", "\u2019"], BracketLeft: ["/", "?", "\xF7", "\xBF"], BracketRight: ["=", "+", "\u2260", "\xB1"], Backslash: ["\\", "|", "\xAB", "\xBB"], Semicolon: ["s", "S", "\xDF", "\xCD"], Quote: ["-", "_", "\u2013", "\u2014"], Backquote: ["`", "~", "`", "`"], Comma: ["w", "W", "\u2211", "\u201E"], Period: ["v", "V", "\u221A", "\u25CA"], Slash: ["z", "Z", "\u03A9", "\xB8"], NumpadDivide: ["/", "/", "/", "/"], NumpadMultiply: ["*", "*", "*", "*"], NumpadSubtract: ["-", "-", "-", "-"], NumpadAdd: ["+", "+", "+", "+"], Numpad1: ["1", "1", "1", "1"], Numpad2: ["2", "2", "2", "2"], Numpad3: ["3", "3", "3", "3"], Numpad4: ["4", "4", "4", "4"], Numpad5: ["5", "5", "5", "5"], Numpad6: ["6", "6", "6", "6"], Numpad7: ["7", "7", "7", "7"], Numpad8: ["8", "8", "8", "8"], Numpad9: ["9", "9", "9", "9"], Numpad0: ["0", "0", "0", "0"], NumpadDecimal: [".", ".", ".", "."], IntlBackslash: ["\xA7", "\xB1", "\xA7", "\xB1"], NumpadEqual: ["=", "=", "=", "="], AudioVolumeUp: ["", "=", "", "="] } };
var Pa = { id: "apple.en-intl", displayName: "English (international)", virtualLayout: "qwerty", platform: "apple", locale: "en", score: 0, mapping: { KeyA: ["a", "A", "\xE5", "\xC5"], KeyB: ["b", "B", "\u222B", "\u0131"], KeyC: ["c", "C", "\xE7", "\xC7"], KeyD: ["d", "D", "\u2202", "\xCE"], KeyE: ["e", "E", "\xB4", "\xB4"], KeyF: ["f", "F", "\u0192", "\xCF"], KeyG: ["g", "G", "\xA9", "\u02DD"], KeyH: ["h", "H", "\u02D9", "\xD3"], KeyI: ["i", "I", "\u02C6", "\u02C6"], KeyJ: ["j", "J", "\u2206", "\xD4"], KeyK: ["k", "K", "\u02DA", "\uF8FF"], KeyL: ["l", "L", "\xAC", "\xD2"], KeyM: ["m", "M", "\xB5", "\xC2"], KeyN: ["n", "N", "\u02DC", "\u02DC"], KeyO: ["o", "O", "\xF8", "\xD8"], KeyP: ["p", "P", "\u03C0", "\u220F"], KeyQ: ["q", "Q", "\u0153", "\u0152"], KeyR: ["r", "R", "\xAE", "\u2030"], KeyS: ["s", "S", "\xDF", "\xCD"], KeyT: ["t", "T", "\u2020", "\u02C7"], KeyU: ["u", "U", "\xA8", "\xA8"], KeyV: ["v", "V", "\u221A", "\u25CA"], KeyW: ["w", "W", "\u2211", "\u201E"], KeyX: ["x", "X", "\u2248", "\u02DB"], KeyY: ["y", "Y", "\xA5", "\xC1"], KeyZ: ["z", "Z", "\u03A9", "\xB8"], Digit1: ["1", "!", "\xA1", "\u2044"], Digit2: ["2", "@", "\u2122", "\u20AC"], Digit3: ["3", "#", "\xA3", "\u2039"], Digit4: ["4", "$", "\xA2", "\u203A"], Digit5: ["5", "%", "\u221E", "\uFB01"], Digit6: ["6", "^", "\xA7", "\uFB02"], Digit7: ["7", "&", "\xB6", "\u2021"], Digit8: ["8", "*", "\u2022", "\xB0"], Digit9: ["9", "(", "\xAA", "\xB7"], Digit0: ["0", ")", "\xBA", "\u201A"], Space: [" ", " ", " ", " "], Minus: ["-", "_", "\u2013", "\u2014"], Equal: ["=", "+", "\u2260", "\xB1"], BracketLeft: ["[", "{", "\u201C", "\u201D"], BracketRight: ["]", "}", "\u2018", "\u2019"], Backslash: ["\\", "|", "\xAB", "\xBB"], Semicolon: [";", ":", "\u2026", "\xDA"], Quote: ["'", '"', "\xE6", "\xC6"], Backquote: ["`", "\u02DC", "`", "`"], Comma: [",", "<", "\u2264", "\xAF"], Period: [".", ">", "\u2265", "\u02D8"], Slash: ["/", "?", "\xF7", "\xBF"], NumpadDivide: ["/", "/", "/", "/"], NumpadMultiply: ["*", "*", "*", "*"], NumpadSubtract: ["-", "-", "-", "-"], NumpadAdd: ["+", "+", "+", "+"], Numpad1: ["1", "1", "1", "1"], Numpad2: ["2", "2", "2", "2"], Numpad3: ["3", "3", "3", "3"], Numpad4: ["4", "4", "4", "4"], Numpad5: ["5", "5", "5", "5"], Numpad6: ["6", "6", "6", "6"], Numpad7: ["7", "7", "7", "7"], Numpad8: ["8", "8", "8", "8"], Numpad9: ["9", "9", "9", "9"], Numpad0: ["0", "0", "0", "0"], NumpadDecimal: [".", ".", ".", "."], IntlBackslash: ["\xA7", "\xB1", "\xA7", "\xB1"], NumpadEqual: ["=", "=", "=", "="], AudioVolumeUp: ["", "=", "", "="] } };
var Ll = { id: "windows.en-intl", displayName: "English (international)", platform: "windows", virtualLayout: "qwerty", locale: "en", score: 0, mapping: { KeyA: ["a", "A", "\xE1", "\xC1"], KeyB: ["b", "B", "", ""], KeyC: ["c", "C", "\xA9", "\xA2"], KeyD: ["d", "D", "\xF0", "\xD0"], KeyE: ["e", "E", "\xE9", "\xC9"], KeyF: ["f", "F", "", ""], KeyG: ["g", "G", "", ""], KeyH: ["h", "H", "", ""], KeyI: ["i", "I", "\xED", "\xCD"], KeyJ: ["j", "J", "", ""], KeyK: ["k", "K", "", ""], KeyL: ["l", "L", "\xF8", "\xD8"], KeyM: ["m", "M", "\xB5", ""], KeyN: ["n", "N", "\xF1", "\xD1"], KeyO: ["o", "O", "\xF3", "\xD3"], KeyP: ["p", "P", "\xF6", "\xD6"], KeyQ: ["q", "Q", "\xE4", "\xC4"], KeyR: ["r", "R", "\xAE", ""], KeyS: ["s", "S", "\xDF", "\xA7"], KeyT: ["t", "T", "\xFE", "\xDE"], KeyU: ["u", "U", "\xFA", "\xDA"], KeyV: ["v", "V", "", ""], KeyW: ["w", "W", "\xE5", "\xC5"], KeyX: ["x", "X", "", ""], KeyY: ["y", "Y", "\xFC", "\xDC"], KeyZ: ["z", "Z", "\xE6", "\xC6"], Digit1: ["1", "!", "\xA1", "\xB9"], Digit2: ["2", "@", "\xB2", ""], Digit3: ["3", "#", "\xB3", ""], Digit4: ["4", "$", "\xA4", "\xA3"], Digit5: ["5", "%", "\u20AC", ""], Digit6: ["6", "^", "\xBC", ""], Digit7: ["7", "&", "\xBD", ""], Digit8: ["8", "*", "\xBE", ""], Digit9: ["9", "(", "\u2018", ""], Digit0: ["0", ")", "\u2019", ""], Space: [" ", " ", "", ""], Minus: ["-", "_", "\xA5", ""], Equal: ["=", "+", "\xD7", "\xF7"], BracketLeft: ["[", "{", "\xAB", ""], BracketRight: ["]", "}", "\xBB", ""], Backslash: ["\\", "|", "\xAC", "\xA6"], Semicolon: [";", ":", "\xB6", "\xB0"], Quote: ["'", '"', "\xB4", "\xA8"], Backquote: ["`", "~", "", ""], Comma: [",", "<", "\xE7", "\xC7"], Period: [".", ">", "", ""], Slash: ["/", "?", "\xBF", ""], NumpadDivide: ["/", "/", "", ""], NumpadMultiply: ["*", "*", "", ""], NumpadSubtract: ["-", "-", "", ""], NumpadAdd: ["+", "+", "", ""], IntlBackslash: ["\\", "|", "", ""] } };
var Al = { id: "linux.en", displayName: "English", platform: "linux", virtualLayout: "qwerty", locale: "en", score: 0, mapping: { KeyA: ["a", "A", "a", "A"], KeyB: ["b", "B", "b", "B"], KeyC: ["c", "C", "c", "C"], KeyD: ["d", "D", "d", "D"], KeyE: ["e", "E", "e", "E"], KeyF: ["f", "F", "f", "F"], KeyG: ["g", "G", "g", "G"], KeyH: ["h", "H", "h", "H"], KeyI: ["i", "I", "i", "I"], KeyJ: ["j", "J", "j", "J"], KeyK: ["k", "K", "k", "K"], KeyL: ["l", "L", "l", "L"], KeyM: ["m", "M", "m", "M"], KeyN: ["n", "N", "n", "N"], KeyO: ["o", "O", "o", "O"], KeyP: ["p", "P", "p", "P"], KeyQ: ["q", "Q", "q", "Q"], KeyR: ["r", "R", "r", "R"], KeyS: ["s", "S", "s", "S"], KeyT: ["t", "T", "t", "T"], KeyU: ["u", "U", "u", "U"], KeyV: ["v", "V", "v", "V"], KeyW: ["w", "W", "w", "W"], KeyX: ["x", "X", "x", "X"], KeyY: ["y", "Y", "y", "Y"], KeyZ: ["z", "Z", "z", "Z"], Digit1: ["1", "!", "1", "!"], Digit2: ["2", "@", "2", "@"], Digit3: ["3", "#", "3", "#"], Digit4: ["4", "$", "4", "$"], Digit5: ["5", "%", "5", "%"], Digit6: ["6", "^", "6", "^"], Digit7: ["7", "&", "7", "&"], Digit8: ["8", "*", "8", "*"], Digit9: ["9", "(", "9", "("], Digit0: ["0", ")", "0", ")"], Space: [" ", " ", " ", " "], Minus: ["-", "_", "-", "_"], Equal: ["=", "+", "=", "+"], BracketLeft: ["[", "{", "[", "{"], BracketRight: ["]", "}", "]", "}"], Backslash: ["\\", "|", "\\", "|"], Semicolon: [";", ":", ";", ":"], Quote: ["'", '"', "'", '"'], Backquote: ["`", "~", "`", "~"], Comma: [",", "<", ",", "<"], Period: [".", ">", ".", ">"], Slash: ["/", "?", "/", "?"], NumpadDivide: ["/", "/", "/", "/"], NumpadMultiply: ["*", "*", "*", "*"], NumpadSubtract: ["-", "-", "-", "-"], NumpadAdd: ["+", "+", "+", "+"], Numpad1: ["1", "1", "1", "1"], Numpad2: ["2", "2", "2", "2"], Numpad3: ["3", "3", "3", "3"], Numpad4: ["4", "4", "4", "4"], Numpad5: ["5", "5", "5", "5"], Numpad6: ["6", "6", "6", "6"], Numpad7: ["7", "7", "7", "7"], Numpad8: ["8", "8", "8", "8"], Numpad9: ["9", "9", "9", "9"], Numpad0: ["0", "0", "0", "0"], NumpadDecimal: ["", ".", "", "."], IntlBackslash: ["<", ">", "|", "\xA6"], NumpadEqual: ["=", "=", "=", "="], NumpadComma: [".", ".", ".", "."], NumpadParenLeft: ["(", "(", "(", "("], NumpadParenRight: [")", ")", ")", ")"] } };
var fm = { id: "apple.french", locale: "fr", displayName: "French", platform: "apple", virtualLayout: "azerty", score: 0, mapping: { KeyA: ["q", "Q", "\u2021", "\u03A9"], KeyB: ["b", "B", "\xDF", "\u222B"], KeyC: ["c", "C", "\xA9", "\xA2"], KeyD: ["d", "D", "\u2202", "\u2206"], KeyE: ["e", "E", "\xEA", "\xCA"], KeyF: ["f", "F", "\u0192", "\xB7"], KeyG: ["g", "G", "\uFB01", "\uFB02"], KeyH: ["h", "H", "\xCC", "\xCE"], KeyI: ["i", "I", "\xEE", "\xEF"], KeyJ: ["j", "J", "\xCF", "\xCD"], KeyK: ["k", "K", "\xC8", "\xCB"], KeyL: ["l", "L", "\xAC", "|"], KeyM: [",", "?", "\u221E", "\xBF"], KeyN: ["n", "N", "~", "\u0131"], KeyO: ["o", "O", "\u0153", "\u0152"], KeyP: ["p", "P", "\u03C0", "\u220F"], KeyQ: ["a", "A", "\xE6", "\xC6"], KeyR: ["r", "R", "\xAE", "\u201A"], KeyS: ["s", "S", "\xD2", "\u2211"], KeyT: ["t", "T", "\u2020", "\u2122"], KeyU: ["u", "U", "\xBA", "\xAA"], KeyV: ["v", "V", "\u25CA", "\u221A"], KeyW: ["z", "Z", "\xC2", "\xC5"], KeyX: ["x", "X", "\u2248", "\u2044"], KeyY: ["y", "Y", "\xDA", "\u0178"], KeyZ: ["w", "W", "\u2039", "\u203A"], Digit1: ["&", "1", "\uF8FF", "\xB4"], Digit2: ["\xE9", "2", "\xEB", "\u201E"], Digit3: ['"', "3", "\u201C", "\u201D"], Digit4: ["'", "4", "\u2018", "\u2019"], Digit5: ["(", "5", "{", "["], Digit6: ["\xA7", "6", "\xB6", "\xE5"], Digit7: ["\xE8", "7", "\xAB", "\xBB"], Digit8: ["!", "8", "\xA1", "\xDB"], Digit9: ["\xE7", "9", "\xC7", "\xC1"], Digit0: ["\xE0", "0", "\xF8", "\xD8"], Space: [" ", " ", " ", " "], Minus: [")", "\xB0", "}", "]"], Equal: ["-", "_", "\u2014", "\u2013"], BracketLeft: ["^", "\xA8", "\xF4", "\xD4"], BracketRight: ["$", "*", "\u20AC", "\xA5"], Backslash: ["`", "\xA3", "@", "#"], Semicolon: ["m", "M", "\xB5", "\xD3"], Quote: ["\xF9", "%", "\xD9", "\u2030"], Backquote: ["<", ">", "\u2264", "\u2265"], Comma: [";", ".", "\u2026", "\u2022"], Period: [":", "/", "\xF7", "\\"], Slash: ["=", "+", "\u2260", "\xB1"], NumpadDivide: ["/", "/", "/", "/"], NumpadMultiply: ["*", "*", "*", "*"], NumpadSubtract: ["-", "-", "-", "-"], NumpadAdd: ["+", "+", "+", "+"], NumpadDecimal: [",", ".", ",", "."], IntlBackslash: ["@", "#", "\u2022", "\u0178"], NumpadEqual: ["=", "=", "=", "="] } };
var gm = { id: "windows.french", locale: "fr", displayName: "French", virtualLayout: "azerty", platform: "windows", score: 0, mapping: { KeyA: ["q", "Q", "", ""], KeyB: ["b", "B", "", ""], KeyC: ["c", "C", "", ""], KeyD: ["d", "D", "", ""], KeyE: ["e", "E", "\u20AC", ""], KeyF: ["f", "F", "", ""], KeyG: ["g", "G", "", ""], KeyH: ["h", "H", "", ""], KeyI: ["i", "I", "", ""], KeyJ: ["j", "J", "", ""], KeyK: ["k", "K", "", ""], KeyL: ["l", "L", "", ""], KeyM: [",", "?", "", ""], KeyN: ["n", "N", "", ""], KeyO: ["o", "O", "", ""], KeyP: ["p", "P", "", ""], KeyQ: ["a", "A", "", ""], KeyR: ["r", "R", "", ""], KeyS: ["s", "S", "", ""], KeyT: ["t", "T", "", ""], KeyU: ["u", "U", "", ""], KeyV: ["v", "V", "", ""], KeyW: ["z", "Z", "", ""], KeyX: ["x", "X", "", ""], KeyY: ["y", "Y", "", ""], KeyZ: ["w", "W", "", ""], Digit1: ["&", "1", "", ""], Digit2: ["\xE9", "2", "~", ""], Digit3: ['"', "3", "#", ""], Digit4: ["'", "4", "{", ""], Digit5: ["(", "5", "[", ""], Digit6: ["-", "6", "|", ""], Digit7: ["\xE8", "7", "`", ""], Digit8: ["_", "8", "\\", ""], Digit9: ["\xE7", "9", "^", ""], Digit0: ["\xE0", "0", "@", ""], Space: [" ", " ", "", ""], Minus: [")", "\xB0", "]", ""], Equal: ["=", "+", "}", ""], BracketLeft: ["^", "\xA8", "", ""], BracketRight: ["$", "\xA3", "\xA4", ""], Backslash: ["*", "\xB5", "", ""], Semicolon: ["m", "M", "", ""], Quote: ["\xF9", "%", "", ""], Backquote: ["\xB2", "", "", ""], Comma: [";", ".", "", ""], Period: [":", "/", "", ""], Slash: ["!", "\xA7", "", ""], NumpadDivide: ["/", "/", "", ""], NumpadMultiply: ["*", "*", "", ""], NumpadSubtract: ["-", "-", "", ""], NumpadAdd: ["+", "+", "", ""], IntlBackslash: ["<", ">", "", ""] } };
var ym = { id: "linux.french", locale: "fr", displayName: "French", virtualLayout: "azerty", platform: "linux", score: 0, mapping: { KeyA: ["q", "Q", "@", "\u03A9"], KeyB: ["b", "B", "\u201D", "\u2019"], KeyC: ["c", "C", "\xA2", "\xA9"], KeyD: ["d", "D", "\xF0", "\xD0"], KeyE: ["e", "E", "\u20AC", "\xA2"], KeyF: ["f", "F", "\u0111", "\xAA"], KeyG: ["g", "G", "\u014B", "\u014A"], KeyH: ["h", "H", "\u0127", "\u0126"], KeyI: ["i", "I", "\u2192", "\u0131"], KeyJ: ["j", "J", "\u0309", "\u031B"], KeyK: ["k", "K", "\u0138", "&"], KeyL: ["l", "L", "\u0142", "\u0141"], KeyM: [",", "?", "\u0301", "\u030B"], KeyN: ["n", "N", "n", "N"], KeyO: ["o", "O", "\xF8", "\xD8"], KeyP: ["p", "P", "\xFE", "\xDE"], KeyQ: ["a", "A", "\xE6", "\xC6"], KeyR: ["r", "R", "\xB6", "\xAE"], KeyS: ["s", "S", "\xDF", "\xA7"], KeyT: ["t", "T", "\u0167", "\u0166"], KeyU: ["u", "U", "\u2193", "\u2191"], KeyV: ["v", "V", "\u201C", "\u2018"], KeyW: ["z", "Z", "\xAB", "<"], KeyX: ["x", "X", "\xBB", ">"], KeyY: ["y", "Y", "\u2190", "\xA5"], KeyZ: ["w", "W", "\u0142", "\u0141"], Digit1: ["&", "1", "\xB9", "\xA1"], Digit2: ["\xE9", "2", "~", "\u215B"], Digit3: ['"', "3", "#", "\xA3"], Digit4: ["'", "4", "{", "$"], Digit5: ["(", "5", "[", "\u215C"], Digit6: ["-", "6", "|", "\u215D"], Digit7: ["\xE8", "7", "`", "\u215E"], Digit8: ["_", "8", "\\", "\u2122"], Digit9: ["\xE7", "9", "^", "\xB1"], Digit0: ["\xE0", "0", "@", "\xB0"], Enter: ["\r", "\r", "\r", "\r"], Escape: ["\x1B", "\x1B", "\x1B", "\x1B"], Backspace: ["\b", "\b", "\b", "\b"], Tab: [" ", "", " ", ""], Space: [" ", " ", " ", " "], Minus: [")", "\xB0", "]", "\xBF"], Equal: ["=", "+", "}", "\u0328"], BracketLeft: ["\u0302", "\u0308", "\u0308", "\u030A"], BracketRight: ["$", "\xA3", "\xA4", "\u0304"], Backslash: ["*", "\xB5", "\u0300", "\u0306"], Semicolon: ["m", "M", "\xB5", "\xBA"], Quote: ["\xF9", "%", "\u0302", "\u030C"], Backquote: ["\xB2", "~", "\xAC", "\xAC"], Comma: [";", ".", "\u2500", "\xD7"], Period: [":", "/", "\xB7", "\xF7"], Slash: ["!", "\xA7", "\u0323", "\u0307"], NumpadMultiply: ["*", "*", "*", "*"], NumpadSubtract: ["-", "-", "-", "-"], NumpadAdd: ["+", "+", "+", "+"], NumpadDecimal: ["", ".", "", "."], IntlBackslash: ["<", ">", "|", "\xA6"] } };
var bm = { id: "apple.german", locale: "de", displayName: "German", virtualLayout: "qwertz", platform: "apple", score: 0, mapping: { KeyA: ["a", "A", "\xE5", "\xC5"], KeyB: ["b", "B", "\u222B", "\u2039"], KeyC: ["c", "C", "\xE7", "\xC7"], KeyD: ["d", "D", "\u2202", "\u2122"], KeyE: ["e", "E", "\u20AC", "\u2030"], KeyF: ["f", "F", "\u0192", "\xCF"], KeyG: ["g", "G", "\xA9", "\xCC"], KeyH: ["h", "H", "\xAA", "\xD3"], KeyI: ["i", "I", "\u2044", "\xDB"], KeyJ: ["j", "J", "\xBA", "\u0131"], KeyK: ["k", "K", "\u2206", "\u02C6"], KeyL: ["l", "L", "@", "\uFB02"], KeyM: ["m", "M", "\xB5", "\u02D8"], KeyN: ["n", "N", "~", "\u203A"], KeyO: ["o", "O", "\xF8", "\xD8"], KeyP: ["p", "P", "\u03C0", "\u220F"], KeyQ: ["q", "Q", "\xAB", "\xBB"], KeyR: ["r", "R", "\xAE", "\xB8"], KeyS: ["s", "S", "\u201A", "\xCD"], KeyT: ["t", "T", "\u2020", "\u02DD"], KeyU: ["u", "U", "\xA8", "\xC1"], KeyV: ["v", "V", "\u221A", "\u25CA"], KeyW: ["w", "W", "\u2211", "\u201E"], KeyX: ["x", "X", "\u2248", "\xD9"], KeyY: ["z", "Z", "\u03A9", "\u02C7"], KeyZ: ["y", "Y", "\xA5", "\u2021"], Digit1: ["1", "!", "\xA1", "\xAC"], Digit2: ["2", '"', "\u201C", "\u201D"], Digit3: ["3", "\xA7", "\xB6", "#"], Digit4: ["4", "$", "\xA2", "\xA3"], Digit5: ["5", "%", "[", "\uFB01"], Digit6: ["6", "&", "]", "^"], Digit7: ["7", "/", "|", "\\"], Digit8: ["8", "(", "{", "\u02DC"], Digit9: ["9", ")", "}", "\xB7"], Digit0: ["0", "=", "\u2260", "\xAF"], Space: [" ", " ", " ", " "], Minus: ["\xDF", "?", "\xBF", "\u02D9"], Equal: ["\xB4", "`", "'", "\u02DA"], BracketLeft: ["\xFC", "\xDC", "\u2022", "\xB0"], BracketRight: ["+", "*", "\xB1", "\uF8FF"], Backslash: ["#", "'", "\u2018", "\u2019"], Semicolon: ["\xF6", "\xD6", "\u0153", "\u0152"], Quote: ["\xE4", "\xC4", "\xE6", "\xC6"], Backquote: ["<", ">", "\u2264", "\u2265"], Comma: [",", ";", "\u221E", "\u02DB"], Period: [".", ":", "\u2026", "\xF7"], Slash: ["-", "_", "\u2013", "\u2014"], NumpadDivide: ["/", "/", "/", "/"], NumpadMultiply: ["*", "*", "*", "*"], NumpadSubtract: ["-", "-", "-", "-"], NumpadAdd: ["+", "+", "+", "+"], NumpadDecimal: [",", ",", ".", "."], IntlBackslash: ["^", "\xB0", "\u201E", "\u201C"], NumpadEqual: ["=", "=", "=", "="] } };
var xm = { id: "windows.german", locale: "de", displayName: "German", platform: "windows", virtualLayout: "qwertz", score: 0, mapping: { KeyA: ["a", "A", "", ""], KeyB: ["b", "B", "", ""], KeyC: ["c", "C", "", ""], KeyD: ["d", "D", "", ""], KeyE: ["e", "E", "\u20AC", ""], KeyF: ["f", "F", "", ""], KeyG: ["g", "G", "", ""], KeyH: ["h", "H", "", ""], KeyI: ["i", "I", "", ""], KeyJ: ["j", "J", "", ""], KeyK: ["k", "K", "", ""], KeyL: ["l", "L", "", ""], KeyM: ["m", "M", "\xB5", ""], KeyN: ["n", "N", "", ""], KeyO: ["o", "O", "", ""], KeyP: ["p", "P", "", ""], KeyQ: ["q", "Q", "@", ""], KeyR: ["r", "R", "", ""], KeyS: ["s", "S", "", ""], KeyT: ["t", "T", "", ""], KeyU: ["u", "U", "", ""], KeyV: ["v", "V", "", ""], KeyW: ["w", "W", "", ""], KeyX: ["x", "X", "", ""], KeyY: ["z", "Z", "", ""], KeyZ: ["y", "Y", "", ""], Digit1: ["1", "!", "", ""], Digit2: ["2", '"', "\xB2", ""], Digit3: ["3", "\xA7", "\xB3", ""], Digit4: ["4", "$", "", ""], Digit5: ["5", "%", "", ""], Digit6: ["6", "&", "", ""], Digit7: ["7", "/", "{", ""], Digit8: ["8", "(", "[", ""], Digit9: ["9", ")", "]", ""], Digit0: ["0", "=", "}", ""], Space: [" ", " ", "", ""], Minus: ["\xDF", "?", "\\", "\u1E9E"], Equal: ["\xB4", "`", "", ""], BracketLeft: ["\xFC", "\xDC", "", ""], BracketRight: ["+", "*", "~", ""], Backslash: ["#", "'", "", ""], Semicolon: ["\xF6", "\xD6", "", ""], Quote: ["\xE4", "\xC4", "", ""], Backquote: ["^", "\xB0", "", ""], Comma: [",", ";", "", ""], Period: [".", ":", "", ""], Slash: ["-", "_", "", ""], NumpadDivide: ["/", "/", "", ""], NumpadMultiply: ["*", "*", "", ""], NumpadSubtract: ["-", "-", "", ""], NumpadAdd: ["+", "+", "", ""], IntlBackslash: ["<", ">", "|", ""] } };
var vm = { id: "linux.german", locale: "de", displayName: "German", platform: "windows", virtualLayout: "qwertz", score: 0, mapping: { KeyA: ["a", "A", "\xE6", "\xC6"], KeyB: ["b", "B", "\u201C", "\u2018"], KeyC: ["c", "C", "\xA2", "\xA9"], KeyD: ["d", "D", "\xF0", "\xD0"], KeyE: ["e", "E", "\u20AC", "\u20AC"], KeyF: ["f", "F", "\u0111", "\xAA"], KeyG: ["g", "G", "\u014B", "\u014A"], KeyH: ["h", "H", "\u0127", "\u0126"], KeyI: ["i", "I", "\u2192", "\u0131"], KeyJ: ["j", "J", "\u0323", "\u0307"], KeyK: ["k", "K", "\u0138", "&"], KeyL: ["l", "L", "\u0142", "\u0141"], KeyM: ["m", "M", "\xB5", "\xBA"], KeyN: ["n", "N", "\u201D", "\u2019"], KeyO: ["o", "O", "\xF8", "\xD8"], KeyP: ["p", "P", "\xFE", "\xDE"], KeyQ: ["q", "Q", "@", "\u03A9"], KeyR: ["r", "R", "\xB6", "\xAE"], KeyS: ["s", "S", "\u017F", "\u1E9E"], KeyT: ["t", "T", "\u0167", "\u0166"], KeyU: ["u", "U", "\u2193", "\u2191"], KeyV: ["v", "V", "\u201E", "\u201A"], KeyW: ["w", "W", "\u0142", "\u0141"], KeyX: ["x", "X", "\xAB", "\u2039"], KeyY: ["z", "Z", "\u2190", "\xA5"], KeyZ: ["y", "Y", "\xBB", "\u203A"], Digit1: ["1", "!", "\xB9", "\xA1"], Digit2: ["2", '"', "\xB2", "\u215B"], Digit3: ["3", "\xA7", "\xB3", "\xA3"], Digit4: ["4", "$", "\xBC", "\xA4"], Digit5: ["5", "%", "\xBD", "\u215C"], Digit6: ["6", "&", "\xAC", "\u215D"], Digit7: ["7", "/", "{", "\u215E"], Digit8: ["8", "(", "[", "\u2122"], Digit9: ["9", ")", "]", "\xB1"], Digit0: ["0", "=", "}", "\xB0"], Enter: ["\r", "\r", "\r", "\r"], Escape: ["\x1B", "\x1B", "\x1B", "\x1B"], Backspace: ["\b", "\b", "\b", "\b"], Tab: [" ", "", " ", ""], Space: [" ", " ", " ", " "], Minus: ["\xDF", "?", "\\", "\xBF"], Equal: ["\u0301", "\u0300", "\u0327", "\u0328"], BracketLeft: ["\xFC", "\xDC", "\u0308", "\u030A"], BracketRight: ["+", "*", "~", "\xAF"], Backslash: ["#", "'", "\u2019", "\u0306"], Semicolon: ["\xF6", "\xD6", "\u030B", "\u0323"], Quote: ["\xE4", "\xC4", "\u0302", "\u030C"], Backquote: ["\u0302", "\xB0", "\u2032", "\u2033"], Comma: [",", ";", "\xB7", "\xD7"], Period: [".", ":", "\u2026", "\xF7"], Slash: ["-", "_", "\u2013", "\u2014"], PrintScreen: ["", "", "", ""], PageUp: ["/", "/", "/", "/"], NumpadMultiply: ["*", "*", "*", "*"], NumpadSubtract: ["-", "-", "-", "-"], NumpadAdd: ["+", "+", "+", "+"], Numpad1: ["", "1", "", "1"], Numpad2: ["", "2", "", "2"], Numpad3: ["", "3", "", "3"], Numpad4: ["", "4", "", "4"], Numpad5: ["", "5", "", "5"], Numpad6: ["", "6", "", "6"], Numpad7: ["", "7", "", "7"], Numpad8: ["", "8", "", "8"], Numpad9: ["", "9", "", "9"], Numpad0: ["", "0", "", "0"], NumpadDecimal: ["", ",", "", ","], IntlBackslash: ["<", ">", "|", "\u0331"], AltRight: ["\r", "\r", "\r", "\r"], MetaRight: [".", ".", ".", "."] } };
var _m = { id: "apple.spanish", locale: "es", displayName: "Spanish ISO", platform: "apple", virtualLayout: "qwerty", score: 0, mapping: { KeyA: ["a", "A", "\xE5", "\xC5"], KeyB: ["b", "B", "\xDF", ""], KeyC: ["c", "C", "\xA9", " "], KeyD: ["d", "D", "\u2202", "\u2206"], KeyE: ["e", "E", "\u20AC", "\u20AC"], KeyF: ["f", "F", "\u0192", "\uFB01"], KeyG: ["g", "G", "\uF8FF", "\uFB02"], KeyH: ["h", "H", "\u2122", " "], KeyI: ["i", "I", " ", " "], KeyJ: ["j", "J", "\xB6", "\xAF"], KeyK: ["k", "K", "\xA7", "\u02C7"], KeyL: ["l", "L", " ", "\u02D8"], KeyM: ["m", "M", "\xB5", "\u02DA"], KeyN: ["n", "N", " ", "\u02D9"], KeyO: ["o", "O", "\xF8", "\xD8"], KeyP: ["p", "P", "\u03C0", "\u220F"], KeyQ: ["q", "Q", "\u0153", "\u0152"], KeyR: ["r", "R", "\xAE", " "], KeyS: ["s", "S", "\u222B", " "], KeyT: ["t", "T", "\u2020", "\u2021"], KeyU: ["u", "U", " ", " "], KeyV: ["v", "V", "\u221A", "\u25CA"], KeyW: ["w", "W", "\xE6", "\xC6"], KeyX: ["x", "X", "\u2211", "\u203A"], KeyY: ["y", "Y", "\xA5", " "], KeyZ: ["z", "Z", "\u03A9", "\u2039"], Digit1: ["1", "!", "|", "\u0131"], Digit2: ["2", '"', "@", "\u02DD"], Digit3: ["3", "\xB7", "#", "\u2022"], Digit4: ["4", "$", "\xA2", "\xA3"], Digit5: ["5", "%", "\u221E", "\u2030"], Digit6: ["6", "&", "\xAC", " "], Digit7: ["7", "/", "\xF7", "\u2044"], Digit8: ["8", "(", "\u201C", "\u2018"], Digit9: ["9", ")", "\u201D", "\u2019"], Digit0: ["0", "=", "\u2260", "\u2248"], Space: [" ", " ", " ", " "], Minus: ["'", "?", "\xB4", "\xB8"], Equal: ["\xA1", "\xBF", "\u201A", "\u02DB"], BracketLeft: ["`", "^", "[", "\u02C6"], BracketRight: ["+", "*", "]", "\xB1"], Backslash: ["\xE7", "\xC7", "}", "\xBB"], Semicolon: ["\xF1", "\xD1", "~", "\u02DC"], Quote: ["\xB4", "\xA8", "{", "\xAB"], Backquote: ["<", ">", "\u2264", "\u2265"], Comma: [",", ";", "\u201E", ""], Period: [".", ":", "\u2026", "\u2026"], Slash: ["-", "_", "\u2013", "\u2014"], NumpadDivide: ["/", "/", "/", "/"], NumpadMultiply: ["*", "*", "*", "*"], NumpadSubtract: ["-", "-", "-", "-"], NumpadAdd: ["+", "+", "+", "+"], Numpad1: ["1", "1", "1", "1"], Numpad2: ["2", "2", "2", "2"], Numpad3: ["3", "3", "3", "3"], Numpad4: ["4", "4", "4", "4"], Numpad5: ["5", "5", "5", "5"], Numpad6: ["6", "6", "6", "6"], Numpad7: ["7", "7", "7", "7"], Numpad8: ["8", "8", "8", "8"], Numpad9: ["9", "9", "9", "9"], Numpad0: ["0", "0", "0", "0"], NumpadDecimal: [",", ",", ",", ","], IntlBackslash: ["\xBA", "\xAA", "\\", "\xB0"] } };
var Mm = { id: "windows.spanish", locale: "es", displayName: "Spanish", platform: "windows", virtualLayout: "qwerty", score: 0, mapping: { KeyA: ["a", "A", "", ""], KeyB: ["b", "B", "", ""], KeyC: ["c", "C", "", ""], KeyD: ["d", "D", "", ""], KeyE: ["e", "E", "\u20AC", ""], KeyF: ["f", "F", "", ""], KeyG: ["g", "G", "", ""], KeyH: ["h", "H", "", ""], KeyI: ["i", "I", "", ""], KeyJ: ["j", "J", "", ""], KeyK: ["k", "K", "", ""], KeyL: ["l", "L", "", ""], KeyM: ["m", "M", "", ""], KeyN: ["n", "N", "", ""], KeyO: ["o", "O", "", ""], KeyP: ["p", "P", "", ""], KeyQ: ["q", "Q", "", ""], KeyR: ["r", "R", "", ""], KeyS: ["s", "S", "", ""], KeyT: ["t", "T", "", ""], KeyU: ["u", "U", "", ""], KeyV: ["v", "V", "", ""], KeyW: ["w", "W", "", ""], KeyX: ["x", "X", "", ""], KeyY: ["y", "Y", "", ""], KeyZ: ["z", "Z", "", ""], Digit1: ["1", "!", "|", ""], Digit2: ["2", '"', "@", ""], Digit3: ["3", "\xB7", "#", ""], Digit4: ["4", "$", "~", ""], Digit5: ["5", "%", "\u20AC", ""], Digit6: ["6", "&", "\xAC", ""], Digit7: ["7", "/", "", ""], Digit8: ["8", "(", "", ""], Digit9: ["9", ")", "", ""], Digit0: ["0", "=", "", ""], Space: [" ", " ", "", ""], Minus: ["'", "?", "", ""], Equal: ["\xA1", "\xBF", "", ""], BracketLeft: ["`", "^", "[", ""], BracketRight: ["+", "*", "]", ""], Backslash: ["\xE7", "\xC7", "}", ""], Semicolon: ["\xF1", "\xD1", "", ""], Quote: ["\xB4", "\xA8", "{", ""], Backquote: ["\xBA", "\xAA", "\\", ""], Comma: [",", ";", "", ""], Period: [".", ":", "", ""], Slash: ["-", "_", "", ""], NumpadDivide: ["/", "/", "", ""], NumpadMultiply: ["*", "*", "", ""], NumpadSubtract: ["-", "-", "", ""], NumpadAdd: ["+", "+", "", ""], IntlBackslash: ["<", ">", "", ""] } };
var wm = { id: "linux.spanish", locale: "es", displayName: "Spanish", platform: "linux", virtualLayout: "qwerty", score: 0, mapping: { KeyA: ["a", "A", "\xE6", "\xC6"], KeyB: ["b", "B", "\u201D", "\u2019"], KeyC: ["c", "C", "\xA2", "\xA9"], KeyD: ["d", "D", "\xF0", "\xD0"], KeyE: ["e", "E", "\u20AC", "\xA2"], KeyF: ["f", "F", "\u0111", "\xAA"], KeyG: ["g", "G", "\u014B", "\u014A"], KeyH: ["h", "H", "\u0127", "\u0126"], KeyI: ["i", "I", "\u2192", "\u0131"], KeyJ: ["j", "J", "\u0309", "\u031B"], KeyK: ["k", "K", "\u0138", "&"], KeyL: ["l", "L", "\u0142", "\u0141"], KeyM: ["m", "M", "\xB5", "\xBA"], KeyN: ["n", "N", "n", "N"], KeyO: ["o", "O", "\xF8", "\xD8"], KeyP: ["p", "P", "\xFE", "\xDE"], KeyQ: ["q", "Q", "@", "\u03A9"], KeyR: ["r", "R", "\xB6", "\xAE"], KeyS: ["s", "S", "\xDF", "\xA7"], KeyT: ["t", "T", "\u0167", "\u0166"], KeyU: ["u", "U", "\u2193", "\u2191"], KeyV: ["v", "V", "\u201C", "\u2018"], KeyW: ["w", "W", "\u0142", "\u0141"], KeyX: ["x", "X", "\xBB", ">"], KeyY: ["y", "Y", "\u2190", "\xA5"], KeyZ: ["z", "Z", "\xAB", "<"], Digit1: ["1", "!", "|", "\xA1"], Digit2: ["2", '"', "@", "\u215B"], Digit3: ["3", "\xB7", "#", "\xA3"], Digit4: ["4", "$", "~", "$"], Digit5: ["5", "%", "\xBD", "\u215C"], Digit6: ["6", "&", "\xAC", "\u215D"], Digit7: ["7", "/", "{", "\u215E"], Digit8: ["8", "(", "[", "\u2122"], Digit9: ["9", ")", "]", "\xB1"], Digit0: ["0", "=", "}", "\xB0"], Enter: ["\r", "\r", "\r", "\r"], Escape: ["\x1B", "\x1B", "\x1B", "\x1B"], Backspace: ["\b", "\b", "\b", "\b"], Tab: [" ", "", " ", ""], Space: [" ", " ", " ", " "], Minus: ["'", "?", "\\", "\xBF"], Equal: ["\xA1", "\xBF", "\u0303", "~"], BracketLeft: ["\u0300", "\u0302", "[", "\u030A"], BracketRight: ["+", "*", "]", "\u0304"], Backslash: ["\xE7", "\xC7", "}", "\u0306"], Semicolon: ["\xF1", "\xD1", "~", "\u030B"], Quote: ["\u0301", "\u0308", "{", "{"], Backquote: ["\xBA", "\xAA", "\\", "\\"], Comma: [",", ";", "\u2500", "\xD7"], Period: [".", ":", "\xB7", "\xF7"], Slash: ["-", "_", "\u0323", "\u0307"], NumpadDivide: ["/", "/", "/", "/"], NumpadMultiply: ["*", "*", "*", "*"], NumpadSubtract: ["-", "-", "-", "-"], NumpadAdd: ["+", "+", "+", "+"], NumpadEnter: ["\r", "\r", "\r", "\r"], Numpad1: ["", "1", "", "1"], Numpad2: ["", "2", "", "2"], Numpad3: ["", "3", "", "3"], Numpad4: ["", "4", "", "4"], Numpad5: ["", "5", "", "5"], Numpad6: ["", "6", "", "6"], Numpad7: ["", "7", "", "7"], Numpad8: ["", "8", "", "8"], Numpad9: ["", "9", "", "9"], Numpad0: ["", "0", "", "0"], NumpadDecimal: ["", ".", "", "."], IntlBackslash: ["<", ">", "|", "\xA6"], NumpadEqual: ["=", "=", "=", "="], NumpadComma: [".", ".", ".", "."], NumpadParenLeft: ["(", "(", "(", "("], NumpadParenRight: [")", ")", ")", ")"] } };
function Cl(t37) {
let e = t37.split("+"), r = { shift: false, alt: false, cmd: false, win: false, meta: false, ctrl: false, key: e.pop() };
return e.includes("shift") && (r.shift = true), e.includes("alt") && (r.alt = true), e.includes("ctrl") && (r.ctrl = true), e.includes("cmd") && (r.cmd = true), e.includes("win") && (r.win = true), e.includes("meta") && (r.meta = true), r;
}
function jr(t37) {
let e = "";
return t37.shift && (e += "shift+"), t37.alt && (e += "alt+"), t37.ctrl && (e += "ctrl+"), t37.cmd && (e += "cmd+"), t37.win && (e += "win+"), t37.meta && (e += "meta+"), e + t37.key;
}
var ff = { enter: "[Enter]", escape: "[Escape]", backspace: "[Backspace]", tab: "[Tab]", space: "[Space]", pausebreak: "[Pause]", insert: "[Insert]", home: "[Home]", pageup: "[PageUp]", delete: "[Delete]", end: "[End]", pagedown: "[PageDown]", right: "[ArrowRight]", left: "[ArrowLeft]", down: "[ArrowDown]", up: "[ArrowUp]", numpad0: "[Numpad0]", numpad1: "[Numpad1]", numpad2: "[Numpad2]", numpad3: "[Numpad3]", numpad4: "[Numpad4]", numpad5: "[Numpad5]", numpad6: "[Numpad6]", numpad7: "[Numpad7]", numpad8: "[Numpad8]", numpad9: "[Numpad9]", numpad_divide: "[NumpadDivide]", numpad_multiply: "[NumpadMultiply]", numpad_subtract: "[NumpadSubtract]", numpad_add: "[NumpadAdd]", numpad_decimal: "[NumpadDecimal]", numpad_separator: "[NumpadComma]", capslock: "[Capslock]", f1: "[F1]", f2: "[F2]", f3: "[F3]", f4: "[F4]", f5: "[F5]", f6: "[F6]", f7: "[F7]", f8: "[F8]", f9: "[F9]", f10: "[F10]", f11: "[F11]", f12: "[F12]", f13: "[F13]", f14: "[F14]", f15: "[F15]", f16: "[F16]", f17: "[F17]", f18: "[F18]", f19: "[F19]" };
var Hn = [];
var Gr;
function El() {
switch (yt()) {
case "macos":
case "ios":
return "apple";
case "windows":
return "windows";
}
return "linux";
}
function Pe(t37) {
(!t37.platform || t37.platform === El()) && Hn.push(t37);
}
function km(t37, e) {
var i;
let r = { shift: false, alt: false, cmd: false, win: false, meta: false, ctrl: false, key: "" };
if (!t37)
return r;
for (let [n, o] of Object.entries(e.mapping)) {
if (o[0] === t37)
return r.key = `[${n}]`, r;
if (o[1] === t37)
return r.shift = true, r.key = `[${n}]`, r;
if (o[2] === t37)
return r.alt = true, r.key = `[${n}]`, r;
if (o[3] === t37)
return r.shift = true, r.alt = true, r.key = `[${n}]`, r;
}
return r.key = (i = ff[t37]) != null ? i : "", r;
}
function Sm(t37) {
if (t37.code)
return t37;
let e = Object.entries(vr().mapping), r = false, i = false, n = "";
for (let o = 0; o < 4; o++) {
for (let [a, s] of e)
if (s[o] === t37.key) {
n = a, o === 3 ? (r = true, i = true) : o === 2 ? r = true : o === 1 && (i = true);
break;
}
if (n)
break;
}
return new KeyboardEvent(t37.type, g(p({}, t37), { altKey: r, shiftKey: i, code: n }));
}
function Lm(t37) {
var r, i;
if (!t37 || t37.key === "Unidentified" || t37.key === "Dead")
return;
let e = t37.shiftKey && t37.altKey ? 3 : t37.altKey ? 2 : t37.shiftKey ? 1 : 0;
for (let n of Hn)
((r = n.mapping[t37.code]) == null ? void 0 : r[e]) === t37.key ? n.score += 1 : (i = n.mapping[t37.code]) != null && i[e] && (n.score = 0);
Hn.sort((n, o) => o.score - n.score);
}
function Am(t37) {
Gr = Hn.find((e) => t37.startsWith(e.locale));
}
function vr() {
return Gr != null ? Gr : Hn[0];
}
function Cm() {
switch (El()) {
case "apple":
return Pa;
case "windows":
return Ll;
case "linux":
return Al;
}
return Pa;
}
switch (El()) {
case "apple":
Pe(Pa), Pe(fm), Pe(_m), Pe(bm);
break;
case "windows":
Pe(Ll), Pe(gm), Pe(Mm), Pe(xm);
break;
case "linux":
Pe(Al), Pe(ym), Pe(wm), Pe(vm);
break;
}
Pe(hm);
function ji(t37) {
var n;
let e = /macos|ios/.test(yt()), r = t37.split("+"), i = "";
for (let o of r)
i && (i += e ? "\u2009" : '<span class="ML__shortcut-join">+</span>'), o.startsWith("[Key") ? i += o.slice(4, 5) : o.startsWith("Key") ? i += o.slice(3, 4) : o.startsWith("[Digit") ? i += o.slice(6, 7) : o.startsWith("Digit") ? i += o.slice(5, 6) : i += (n = { cmd: "\u2318", meta: e ? "\u2318" : "Ctrl", shift: e ? "\u21E7" : "Shift", alt: e ? "\u2325" : "Alt", ctrl: e ? "\u2303" : "Ctrl", "\n": e ? "\u23CE" : "Return", "[return]": e ? "\u23CE" : "Return", "[enter]": e ? "\u2324" : "Enter", "[tab]": e ? "\u21E5" : "Tab", "[escape]": "Esc", "[backspace]": e ? "\u232B" : "Backspace", "[delete]": e ? "\u2326" : "Del", "[pageup]": e ? "\u21DE" : "Page Up", "[pagedown]": e ? "\u21DF" : "Page Down", "[home]": e ? "\u2912" : "Home", "[end]": e ? "\u2913" : "End", "[space]": "Space", "[equal]": "=", "[minus]": "-", "[comma]": ",", "[slash]": "/", "[backslash]": "\\", "[bracketleft]": "[", "[bracketright]": "]", semicolon: ";", period: ".", comma: ",", minus: "-", equal: "=", quote: "'", backslash: "\\", intlbackslash: "\\", backquote: "`", slash: "/", numpadmultiply: "* &#128290;", numpaddivide: "/ &#128290;", numpadsubtract: "- &#128290;", numpadadd: "+ &#128290;", numpaddecimal: ". &#128290;", numpadcomma: ", &#128290;", help: "help", left: "\u21E0", up: "\u21E1", right: "\u21E2", down: "\u21E3", "[arrowleft]": "\u21E0", "[arrowup]": "\u21E1", "[arrowright]": "\u21E2", "[arrowdown]": "\u21E3" }[o.toLowerCase()]) != null ? n : o.toUpperCase();
return i;
}
function Xi(t37) {
if (t37 instanceof MouseEvent || t37 instanceof PointerEvent)
return { x: t37.clientX, y: t37.clientY };
if (typeof TouchEvent != "undefined" && t37 instanceof TouchEvent) {
let e = [...t37.touches].reduce((i, n) => ({ x: i.x + n.clientX, y: i.y + n.clientY }), { x: 0, y: 0 }), r = t37.touches.length;
return { x: e.x / r, y: e.y / r };
}
}
function Kt(t37) {
let e = { alt: false, control: false, shift: false, meta: false };
return (t37 instanceof MouseEvent || t37 instanceof PointerEvent || typeof TouchEvent != "undefined" && t37 instanceof TouchEvent || t37 instanceof KeyboardEvent) && (t37.altKey && (e.alt = true), t37.ctrlKey && (e.control = true), t37.metaKey && (e.meta = true), t37.shiftKey && (e.shift = true)), e;
}
function Em(t37, e) {
return !t37 && e || t37 && !e ? false : !t37 || !e ? true : t37.alt === e.alt && t37.control === e.control && t37.shift === e.shift && t37.meta === e.meta;
}
var gf = /* @__PURE__ */ new Set(["Backquote", "Digit0", "Digit1", "Digit2", "Digit3", "Digit4", "Digit5", "Digit6", "Digit7", "Digit8", "Digit9", "Minus", "Equal", "IntlYen", "KeyQ", "KeyW", "KeyE", "KeyR", "KeyT", "KeyY", "KeyU", "KeyI", "KeyO", "KeyP", "BracketLeft", "BracketRight", "Backslash", "KeyA", "KeyS", "KeyD", "KeyF", "KeyG", "KeyH", "KeyJ", "KeyK", "KeyL", "Semicolon", "Quote", "IntlBackslash", "KeyZ", "KeyX", "KeyC", "KeyV", "KeyB", "KeyN", "KeyM", "Comma", "Period", "Slash", "IntlRo", "Space", "Numpad0", "Numpad1", "Numpad2", "Numpad3", "Numpad4", "Numpad5", "Numpad6", "Numpad7", "Numpad8", "Numpad9", "NumpadAdd", "NumpadComma", "NumpadDecimal", "NumpadDivide", "NumpadEqual", "NumpadHash", "NumpadMultiply", "NumpadParenLeft", "NumpadParenRight", "NumpadStar", "NumpadSubstract"]);
function _r(t37) {
return t37.ctrlKey || t37.metaKey || ["Dead", "Process"].includes(t37.key) ? false : t37.code === "" ? true : gf.has(t37.code);
}
function Xr() {
var e;
let t37 = document.activeElement;
for (; (e = t37 == null ? void 0 : t37.shadowRoot) != null && e.activeElement; )
t37 = t37.shadowRoot.activeElement;
return t37;
}
var _e = class t32 {
static get scrim() {
return t32._scrim || (t32._scrim = new t32()), t32._scrim;
}
static open(e) {
t32.scrim.open(e);
}
static close() {
t32.scrim.close();
}
static get state() {
return t32.scrim.state;
}
static get element() {
return t32.scrim.element;
}
constructor(e) {
var r, i;
this.lightDismiss = (r = e == null ? void 0 : e.lightDismiss) != null ? r : true, this.translucent = (i = e == null ? void 0 : e.translucent) != null ? i : false, this.state = "closed";
}
get element() {
if (this._element)
return this._element;
let e = document.createElement("div");
return e.setAttribute("role", "presentation"), e.style.position = "fixed", e.style.contain = "content", e.style.top = "0", e.style.left = "0", e.style.right = "0", e.style.bottom = "0", e.style.zIndex = "var(--scrim-zindex, 10099)", e.style.outline = "none", this.translucent ? (e.style.background = "rgba(255, 255, 255, .2)", e.style.backdropFilter = "contrast(40%)") : e.style.background = "transparent", this._element = e, e;
}
open(e) {
var o;
if (this.state !== "closed")
return;
this.state = "opening", this.onDismiss = e == null ? void 0 : e.onDismiss, this.savedActiveElement = Xr();
let { element: r } = this;
((o = e == null ? void 0 : e.root) != null ? o : document.body).appendChild(r), r.addEventListener("click", this), document.addEventListener("touchmove", this, false), document.addEventListener("scroll", this, false);
let i = window.innerWidth - document.documentElement.clientWidth;
this.savedMarginRight = document.body.style.marginRight, this.savedOverflow = document.body.style.overflow, document.body.style.overflow = "hidden";
let n = Number.parseFloat(getComputedStyle(document.body).marginRight);
document.body.style.marginRight = `${n + i}px`, e != null && e.child && r.append(e.child), this.state = "open";
}
close() {
var r, i, n, o;
if (this.state !== "open") {
this.element.parentElement;
return;
}
this.state = "closing", typeof this.onDismiss == "function" && this.onDismiss(), this.onDismiss = void 0;
let { element: e } = this;
e.removeEventListener("click", this), document.removeEventListener("touchmove", this, false), document.removeEventListener("scroll", this, false), e.remove(), document.body.style.overflow = (r = this.savedOverflow) != null ? r : "", document.body.style.marginRight = (i = this.savedMarginRight) != null ? i : "", Xr() !== this.savedActiveElement && ((o = (n = this.savedActiveElement) == null ? void 0 : n.focus) == null || o.call(n)), e.innerHTML = "", this.state = "closed";
}
handleEvent(e) {
this.lightDismiss && (e.target === this._element && e.type === "click" ? (this.close(), e.preventDefault(), e.stopPropagation()) : e.target === document && (e.type === "touchmove" || e.type === "scroll") && (this.close(), e.preventDefault(), e.stopPropagation()));
}
};
function Tm(t37, e, r) {
let i = null, n = null, o = false, a = false, s = false, l = new AbortController(), c = l.signal;
return t37.addEventListener("keydown", (u) => {
if (o || u.key === "Process" || u.code === "CapsLock" || /(Control|Meta|Alt|Shift)(Left|Right)/.test(u.code)) {
i = null;
return;
}
i = u, n = null, r.onKeystroke(u) ? t37.textContent = "" : i = null;
}, { capture: true, signal: c }), t37.addEventListener("keypress", (u) => {
o || (i && n && r.onKeystroke(i), n = u);
}, { capture: true, signal: c }), t37.addEventListener("compositionstart", (u) => {
t37.textContent = "", o = true, r.onCompositionStart(u.data);
}, { capture: true, signal: c }), t37.addEventListener("compositionupdate", (u) => {
o && r.onCompositionUpdate(u.data);
}, { capture: true, signal: c }), t37.addEventListener("compositionend", (u) => {
t37.textContent = "", o && (o = false, r.onCompositionEnd(u.data));
}, { capture: true, signal: c }), t37.addEventListener("beforeinput", (u) => u.stopImmediatePropagation(), { signal: c }), t37.addEventListener("input", (u) => {
var d;
if (!o && (t37.textContent = "", u.inputType !== "insertCompositionText")) {
if (u.inputType === "insertFromPaste") {
u.preventDefault(), u.stopPropagation();
return;
}
r.onInput((d = u.data) != null ? d : ""), u.preventDefault(), u.stopPropagation();
}
}, { signal: c }), t37.addEventListener("paste", (u) => {
t37.focus({ preventScroll: true }), t37.textContent = "", r.onPaste(u) || u.preventDefault(), u.stopImmediatePropagation();
}, { signal: c }), t37.addEventListener("cut", (u) => r.onCut(u), { capture: true, signal: c }), t37.addEventListener("copy", (u) => r.onCopy(u), { capture: true, signal: c }), t37.addEventListener("blur", (u) => {
var f, b;
if (((b = (f = u.relatedTarget) == null ? void 0 : f._mathfield) == null ? void 0 : b.element) === e) {
t37.focus({ preventScroll: true }), u.preventDefault(), u.stopPropagation();
return;
}
let d = false, m = u.relatedTarget;
for (; m; ) {
if (m.classList.contains("ML__keyboard")) {
d = true;
break;
}
m = m.parentElement;
}
if (d) {
t37.focus({ preventScroll: true }), u.preventDefault(), u.stopPropagation();
return;
}
let h = _e.state;
if (h === "open" || h === "opening") {
u.preventDefault(), u.stopPropagation();
return;
}
if (u.relatedTarget === u.target.getRootNode().host) {
u.preventDefault(), u.stopPropagation();
return;
}
s || a || (s = true, i = null, n = null, r.onBlur(), s = false);
}, { capture: true, signal: c }), t37.addEventListener("focus", (u) => {
s || a || (a = true, r.onFocus(), a = false);
}, { capture: true, signal: c }), { dispose: () => l.abort(), cancelComposition: () => {
o && (t37.blur(), requestAnimationFrame(() => t37.focus({ preventScroll: true })));
}, blur: () => {
typeof t37.blur == "function" && t37.blur();
}, focus: () => {
!a && typeof t37.focus == "function" && t37.focus({ preventScroll: true });
}, hasFocus: () => Xr() === t37, setAriaLabel: (u) => t37.setAttribute("aria-label", u), setValue: (u) => {
var d;
t37.textContent = u, t37.style.left = "-1000px", (d = window.getSelection()) == null || d.selectAllChildren(t37);
}, moveTo: (u, d) => {
t37.style.top = `${d}px`, t37.style.left = `${u}px`;
} };
}
function Mr(t37) {
var r;
if (!t37 || !_r(t37))
return "";
let e;
return t37.key === "Unidentified" && t37.target && (e = t37.target.value), e = (r = e != null ? e : t37.key) != null ? r : t37.code, /^(Dead|Return|Enter|Tab|Escape|Delete|PageUp|PageDown|Home|End|Help|ArrowLeft|ArrowRight|ArrowUp|ArrowDown)$/.test(e) && (e = ""), e;
}
function Ra(t37) {
t37 = Sm(t37);
let e = [];
return t37.ctrlKey && e.push("ctrl"), t37.metaKey && e.push("meta"), t37.altKey && e.push("alt"), t37.shiftKey && e.push("shift"), e.length === 0 ? `[${t37.code}]` : (e.push(`[${t37.code}]`), e.join("+"));
}
function yf(t37) {
if (fe()) {
let e = yt(), r = t37.startsWith("!"), i = t37.endsWith(e);
if (r && !i || !r && i)
return true;
}
return t37 === "!other" ? false : t37 === "other";
}
function Km(t37, e, r) {
if (t37.length === 0)
return "";
let i = jr(Cl(Ra(r))), n = jr({ key: r.key, shift: r.shiftKey, alt: r.altKey, ctrl: r.ctrlKey, meta: r.metaKey || r.ctrlKey && /macos|ios/.test(yt()), cmd: false, win: false });
for (let o = t37.length - 1; o >= 0; o--)
if ((t37[o].key === i || t37[o].key === n) && (!t37[o].ifMode || t37[o].ifMode === e))
return t37[o].command;
return "";
}
function Dm(t37) {
let e = t37;
return X(e) && (e = e.length > 0 ? e[0] + "(" + e.slice(1).join("") + ")" : ""), e;
}
function Bm(t37, e) {
let r = [];
if (typeof e == "string") {
let o = $0[e];
X(o) ? r = o.slice() : o && r.push(o);
}
let i = Dm(e), n = new RegExp("^" + i.replace("\\", "\\\\").replace("|", "\\|").replace("*", "\\*").replace("$", "\\$").replace("^", "\\^") + "([^*a-zA-Z]|$)");
for (let o of t37)
n.test(Dm(o.command)) && r.push(o.key);
return r.map(ji);
}
function bf(t37, e) {
if (t37.ifPlatform && !/^!?(macos|windows|android|ios|chromeos|other)$/.test(t37.ifPlatform))
throw new Error(`Unexpected platform "${t37.ifPlatform}" for keybinding ${t37.key}`);
if (t37.ifLayout !== void 0 && (e.score === 0 || !t37.ifLayout.includes(e.id)))
return;
let r = Cl(t37.key), i = t37.ifPlatform;
if (r.cmd) {
if (i && i !== "macos" && i !== "ios")
throw new Error('Unexpected "cmd" modifier with platform "' + i + `"
"cmd" modifier can only be used with macOS or iOS platform.`);
i || (i = yt() === "ios" ? "ios" : "macos"), r.win = false, r.cmd = false, r.meta = true;
}
if (r.win) {
if (i && i !== "windows")
throw new Error('Unexpected "win" modifier with platform "' + i + `"
"win" modifier can only be used with Windows platform.`);
i = "windows", r.win = false, r.cmd = false, r.meta = true;
}
if (i && !yf(i))
return;
if (/^\[.+\]$/.test(r.key))
return g(p({}, t37), { key: jr(r) });
let n = km(r.key, e);
if (!n)
return g(p({}, t37), { key: jr(r) });
if (n.shift && r.shift || n.alt && r.alt)
throw new Error(`The keybinding ${t37.key} (${Tl(t37.command)}) is conflicting with the key combination ${jr(n)} using the ${e.displayName} keyboard layout`);
return n.shift = n.shift || r.shift, n.alt = n.alt || r.alt, n.meta = r.meta, n.ctrl = r.ctrl, g(p({}, t37), { key: jr(n) });
}
function Tl(t37) {
if (Array.isArray(t37)) {
let e = [...t37];
return e.shift() + "(" + e.map((r) => typeof r == "string" ? `"${r}"` : r.toString()).join(", ") + ")";
}
return t37;
}
function Om(t37, e) {
let r = [], i = [];
for (let n of t37)
try {
let o = bf(n, e);
if (!o)
continue;
let a = i.find((s) => s.key === o.key && s.ifMode === o.ifMode);
if (a)
throw new Error(`Ambiguous key binding ${n.key} (${Tl(n.command)}) matches ${a.key} (${Tl(a.command)}) with the ${e.displayName} keyboard layout`);
i.push(o);
} catch (o) {
o instanceof Error && r.push(o.message);
}
return [i, r];
}
var Dl = class extends z {
constructor() {
super("latex");
}
createAtom(e) {
return new ie(e);
}
onPaste(e, r) {
if (!r)
return false;
let i = typeof r == "string" ? r : r.getData("application/x-latex") || r.getData("text/plain");
return i && e.model.contentWillChange({ inputType: "insertFromPaste", data: i }) ? (e.stopCoalescingUndo(), e.stopRecording(), this.insert(e.model, i) && (e.startRecording(), e.snapshot("paste"), e.model.contentDidChange({ inputType: "insertFromPaste" }), V(e)), e.startRecording(), true) : false;
}
insert(e, r, i) {
if (!e.contentWillChange({ data: r, inputType: "insertText" }))
return false;
i || (i = {}), i.insertionMode || (i.insertionMode = "replaceSelection"), i.selectionMode || (i.selectionMode = "placeholder");
let { silenceNotifications: n } = e;
i.silenceNotifications && (e.silenceNotifications = true);
let o = e.silenceNotifications;
e.silenceNotifications = true, i.insertionMode === "replaceSelection" && !e.selectionIsCollapsed ? e.deleteAtoms(te(e.selection)) : i.insertionMode === "replaceAll" ? (e.root.setChildren([], "body"), e.position = 0) : i.insertionMode === "insertBefore" ? e.collapseSelection("backward") : i.insertionMode === "insertAfter" && e.collapseSelection("forward");
let a = [];
for (let c of r)
Bc.test(c) && a.push(new ie(c));
let s = e.at(e.position);
if (s instanceof Ct && (s = s.lastChild), !(s.parent instanceof Ct)) {
let c = new Ct();
s.parent.addChildAfter(c, s), s = c.firstChild;
}
let l = s.parent.addChildrenAfter(a, s);
return e.silenceNotifications = o, i.selectionMode === "before" || (i.selectionMode === "item" ? e.setSelection(e.anchor, e.offsetOf(l)) : l && (e.position = e.offsetOf(l))), e.contentDidChange({ data: r, inputType: "insertText" }), e.silenceNotifications = n, true;
}
};
function Wn(t37) {
return t37.atoms.find((e) => e.type === "latexgroup");
}
function Un(t37) {
var r, i;
let e = Wn(t37);
return (i = (r = e == null ? void 0 : e.body) == null ? void 0 : r.filter((n) => n.type === "latex")) != null ? i : [];
}
function Ia(t37, e) {
var s;
let r = 0, i = false, n = Number.isFinite(e == null ? void 0 : e.before) ? (s = e == null ? void 0 : e.before) != null ? s : 0 : t37.lastOffset;
for (; r <= n && !i; ) {
let l = t37.at(r);
i = l instanceof ie && l.isSuggestion, i || r++;
}
if (!i)
return [void 0, void 0];
let o = r, a = false;
for (; o <= n && !a; ) {
let l = t37.at(o);
a = !(l instanceof ie && l.isSuggestion), a || o++;
}
return [r - 1, o - 1];
}
new Dl();
function Zr(t37) {
let e = Un(t37.model).filter((r) => r.isSuggestion);
if (e.length !== 0) {
t37.model.position = t37.model.offsetOf(e[0].leftSibling);
for (let r of e)
r.parent.removeChild(r);
}
}
function kr(t37, e) {
var c;
let { model: r } = t37;
Zr(t37);
for (let u of Un(r))
u.isError = false;
if (!r.selectionIsCollapsed || t37.options.popoverPolicy === "off") {
wr(t37);
return;
}
let i = [], n = r.at(r.position);
for (; n && n instanceof ie && /^[a-zA-Z\*]$/.test(n.value); )
n = n.leftSibling;
if (n && n instanceof ie && n.value === "\\")
for (i.push(n), n = n.rightSibling; n && n instanceof ie && /^[a-zA-Z\*]$/.test(n.value); )
i.push(n), n = n.rightSibling;
let o = i.map((u) => u.value).join(""), a = Pc(t37, o);
if (a.length === 0) {
if (/^\\[a-zA-Z\*]+$/.test(o))
for (let u of i)
u.isError = true;
wr(t37);
return;
}
let s = (c = e == null ? void 0 : e.atIndex) != null ? c : 0;
t37.suggestionIndex = s < 0 ? a.length - 1 : s % a.length;
let l = a[t37.suggestionIndex];
if (l !== o) {
let u = i[i.length - 1];
u.parent.addChildrenAfter([...l.slice(o.length - l.length)].map((d) => new ie(d, { isSuggestion: true })), u), st(t37, { interactive: true });
}
Pm(t37, a);
}
function Kl(t37) {
let [e, r] = Ia(t37, { before: t37.position });
if (e === void 0 || r === void 0)
return false;
let i = false;
return t37.getAtoms([e, r]).forEach((n) => {
n.isSuggestion && (n.isSuggestion = false, i = true);
}), i;
}
function Bt(t37, e = "accept", r) {
var s, l;
wr(t37);
let i = Wn(t37.model);
if (!i)
return false;
if (e === "accept-suggestion" || e === "accept-all") {
let c = Un(t37.model).filter((u) => u.isSuggestion);
if (c.length !== 0) {
for (let u of c)
u.isSuggestion = false;
t37.model.position = t37.model.offsetOf(c[c.length - 1]);
}
if (e === "accept-suggestion")
return c.length !== 0;
}
let o = Un(t37.model).filter((c) => !c.isSuggestion).map((c) => c.value).join(""), a = i.leftSibling;
return i.parent.removeChild(i), t37.model.position = t37.model.offsetOf(a), t37.switchMode((s = r == null ? void 0 : r.mode) != null ? s : "math"), e === "reject" || (z.insert(t37.model, o, { selectionMode: (l = r == null ? void 0 : r.selectItem) != null && l ? "item" : "placeholder", format: "latex", mode: "math" }), t37.snapshot(), t37.model.announce("replacement"), t37.switchMode("math")), true;
}
function Yr(t37) {
var r;
let e = document.getElementById(t37);
return e ? e.dataset.refcount = Number(Number.parseInt((r = e.dataset.refcount) != null ? r : "0") + 1).toString() : (e = document.createElement("div"), e.setAttribute("aria-hidden", "true"), e.dataset.refcount = "1", e.id = t37, document.body.append(e)), e;
}
function Zi(t37) {
var i;
let e = document.getElementById(t37);
if (!e)
return;
let r = Number.parseInt((i = e.getAttribute("data-refcount")) != null ? i : "0");
r <= 1 ? e.remove() : e.dataset.refcount = Number(r - 1).toString();
}
function xf(t37, e) {
let r = new T({ from: t37.context }), i = new y({ mode: "math", type: "root", body: se(e, { context: r }) }), n = dr(Tt(new w(i.render(r), { classes: "ML__base" }), r));
return mr(n, { classes: "ML__latex" }).toMarkup();
}
function Pm(t37, e) {
var n;
if (e.length === 0) {
wr(t37);
return;
}
let r = "";
for (let [o, a] of e.entries()) {
let s = a, l = xf(t37, a), c = Bm(t37.keybindings, s).join("<br>");
r += `<li role="button" data-command="${s}" ${o === t37.suggestionIndex ? "class=ML__popover__current" : ""}><span class="ML__popover__latex">${s}</span><span class="ML__popover__command">${l}</span>`, c && (r += `<span class="ML__popover__keybinding">${c}</span>`), r += "</li>";
}
let i = vf(t37, `<ul>${r}</ul>`);
Bl() && ((n = i.querySelector(".ML__popover__current")) == null || n.scrollIntoView({ block: "nearest", inline: "nearest" })), setTimeout(() => {
var o;
i && !Bl() && (i.classList.add("is-visible"), Yi(t37), (o = i.querySelector(".ML__popover__current")) == null || o.scrollIntoView({ block: "nearest", inline: "nearest" }));
}, 32);
}
function Bl() {
let t37 = document.getElementById("mathlive-suggestion-popover");
return t37 ? t37.classList.contains("is-visible") : false;
}
function Yi(t37, e) {
var d, m, h;
if (!t37.element || t37.element.mathfield !== t37 || !Bl())
return;
if (((d = t37.model.at(t37.model.position)) == null ? void 0 : d.type) !== "latex") {
wr(t37);
return;
}
if (e != null && e.deferred) {
setTimeout(() => Yi(t37), 32);
return;
}
let r = Ri(t37.field);
if (!r)
return;
let i = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight, n = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth, o = window.innerWidth - document.documentElement.clientWidth, a = window.innerHeight - document.documentElement.clientHeight, s = (h = (m = window.mathVirtualKeyboard) == null ? void 0 : m.boundingRect.height) != null ? h : 0, l = document.getElementById("mathlive-suggestion-popover");
r.x + l.offsetWidth / 2 > n - o ? l.style.left = `${n - l.offsetWidth - o}px` : r.x - l.offsetWidth / 2 < 0 ? l.style.left = "0" : l.style.left = `${r.x - l.offsetWidth / 2}px`;
let c = r.y - r.height;
i - a - s - r.y < c ? (l.classList.add("ML__popover--reverse-direction"), l.classList.remove("top-tip"), l.classList.add("bottom-tip"), l.style.top = `${r.y - r.height - l.offsetHeight - 15}px`) : (l.classList.remove("ML__popover--reverse-direction"), l.classList.add("top-tip"), l.classList.remove("bottom-tip"), l.style.top = `${r.y + 15}px`);
}
function wr(t37) {
t37.suggestionIndex = 0;
let e = document.getElementById("mathlive-suggestion-popover");
e && (e.classList.remove("is-visible"), e.innerHTML = "");
}
function vf(t37, e) {
let r = document.getElementById("mathlive-suggestion-popover");
return r || (r = Yr("mathlive-suggestion-popover"), Oe("suggestion-popover"), Oe("core"), r.addEventListener("pointerdown", (i) => i.preventDefault()), r.addEventListener("click", (i) => {
let n = i.target;
for (; n && !n.dataset.command; )
n = n.parentElement;
n && (Bt(t37, "reject"), z.insert(t37.model, n.dataset.command, { selectionMode: "placeholder", format: "latex", mode: "math" }), t37.dirty = true, t37.focus());
})), r.innerHTML = globalThis.MathfieldElement.createHTML(e), r;
}
function Rm() {
document.getElementById("mathlive-suggestion-popover") && (Zi("mathlive-suggestion-popover"), Ve("suggestion-popover"), Ve("core"));
}
function _f() {
let t37 = String(new Error().stack).replace(/^Error.*\n/, "").split(`
`);
if (t37.length === 0)
return console.error(`Can't use relative paths to specify assets location because the sourcefile location could not be determined (unexpected stack trace format "${new Error().stack}").`), "";
let e = t37[1], r = e.match(/http.*\.ts[\?:]/);
return r && (e = t37[2]), r = e.match(/(https?:.*):[0-9]+:[0-9]+/), r || (r = e.match(/at (.*(\.ts))[\?:]/), r || (r = e.match(/at (.*(\.mjs|\.js))[\?:]/))), r ? r[1] : (console.error(t37), console.error(`Can't use relative paths to specify assets location because the source file location could not be determined (unexpected location "${e}").`), "");
}
var Jn = null;
var Im;
var zm;
var Ol = ((zm = (Im = globalThis == null ? void 0 : globalThis.document) == null ? void 0 : Im.currentScript) == null ? void 0 : zm.src) || _f();
async function za(t37) {
if (/^(?:[a-z+]+:)?\/\//i.test(t37)) {
try {
return new URL(t37).href;
} catch (e) {
}
if (t37.startsWith("//"))
try {
return new URL(`${window.location.protocol}${t37}`).href;
} catch (e) {
}
return t37;
}
if (Jn === null)
try {
let e = await fetch(Ol, { method: "HEAD" });
e.status === 200 && (Jn = e.url);
} catch (e) {
console.error(`Invalid URL "${t37}" (relative to "${Ol}")`);
}
return new URL(t37, Jn != null ? Jn : Ol).href;
}
function Mf(t37, e, r = {}) {
return new FontFace(t37, `url(${e}.woff2) format('woff2')`, r);
}
var Ee = "not-loaded";
async function Nm() {
return Ee = "not-loaded", Qr();
}
async function Qr() {
var e;
if (Ee !== "not-loaded")
return;
if (Ee = "loading", (e = getComputedStyle(document.documentElement).getPropertyValue("--ML__static-fonts")) != null ? e : false) {
Ee = "ready";
return;
}
if (document.body.classList.remove("ML__fonts-did-not-load"), "fonts" in document) {
let r = ["KaTeX_Main", "KaTeX_Math", "KaTeX_AMS", "KaTeX_Caligraphic", "KaTeX_Fraktur", "KaTeX_SansSerif", "KaTeX_Script", "KaTeX_Typewriter", "KaTeX_Size1", "KaTeX_Size2", "KaTeX_Size3", "KaTeX_Size4"], i = Array.from(document.fonts).map((a) => a.family);
if (r.every((a) => i.includes(a))) {
Ee = "ready";
return;
}
if (!globalThis.MathfieldElement.fontsDirectory) {
Ee = "not-loaded";
return;
}
let n = await za(globalThis.MathfieldElement.fontsDirectory);
if (!n) {
document.body.classList.add("ML__fonts-did-not-load"), Ee = "error";
return;
}
let o = [["KaTeX_Main-Regular"], ["KaTeX_Main-BoldItalic", { style: "italic", weight: "bold" }], ["KaTeX_Main-Bold", { weight: "bold" }], ["KaTeX_Main-Italic", { style: "italic" }], ["KaTeX_Math-Italic", { style: "italic" }], ["KaTeX_Math-BoldItalic", { style: "italic", weight: "bold" }], ["KaTeX_AMS-Regular"], ["KaTeX_Caligraphic-Regular"], ["KaTeX_Caligraphic-Bold", { weight: "bold" }], ["KaTeX_Fraktur-Regular"], ["KaTeX_Fraktur-Bold", { weight: "bold" }], ["KaTeX_SansSerif-Regular"], ["KaTeX_SansSerif-Bold", { weight: "bold" }], ["KaTeX_SansSerif-Italic", { style: "italic" }], ["KaTeX_Script-Regular"], ["KaTeX_Typewriter-Regular"], ["KaTeX_Size1-Regular"], ["KaTeX_Size2-Regular"], ["KaTeX_Size3-Regular"], ["KaTeX_Size4-Regular"]].map((a) => Mf(a[0].replace(/-[a-zA-Z]+$/, ""), `${n}/${a[0]}`, a[1]));
try {
(await Promise.all(o.map((s) => {
try {
return s.load();
} catch (l) {
}
}))).forEach((s) => document.fonts.add(s)), Ee = "ready";
return;
} catch (a) {
console.error(`MathLive 0.100.0: The math fonts could not be loaded from "${n}"`, { cause: a }), document.body.classList.add("ML__fonts-did-not-load");
}
Ee = "error";
}
}
function Fm(t37, e = 0) {
let r = 3735928559 ^ e, i = 1103547991 ^ e;
for (let n = 0; n < t37.length; n++) {
let o = t37.charCodeAt(n);
r = Math.imul(r ^ o, 2654435761), i = Math.imul(i ^ o, 1597334677);
}
return r = Math.imul(r ^ r >>> 16, 2246822507), r ^= Math.imul(i ^ i >>> 13, 3266489909), i = Math.imul(i ^ i >>> 16, 2246822507), i ^= Math.imul(r ^ r >>> 13, 3266489909), 4294967296 * (2097151 & i) + (r >>> 0);
}
function V(t37, e) {
t37 && (t37.dirty || (t37.dirty = true, requestAnimationFrame(() => {
tt(t37) && t37.dirty && (t37.atomBoundsCache = /* @__PURE__ */ new Map(), st(t37, e), t37.atomBoundsCache = void 0);
})));
}
function wf(t37, e) {
var o;
e = e != null ? e : {};
let r = new T({ from: g(p({}, t37.context), { atomIdsSettings: { seed: e.forHighlighting ? Fm(y.serialize([t37.model.root], { expandMacro: false, defaultMode: t37.options.defaultMode })) : "random", groupNumbers: (o = e.forHighlighting) != null ? o : false }, letterShapeStyle: t37.options.letterShapeStyle }), mathstyle: t37.options.defaultMode === "inline-math" ? "textstyle" : "displaystyle" }), i = t37.model.root.render(r);
return mr(Tt(i, r), { classes: t37.hasEditablePrompts ? "ML__latex ML__prompting" : "ML__latex", attributes: { translate: "no", "aria-hidden": "true" } });
}
function Pl(t37, e) {
let { model: r } = t37;
r.root.caret = void 0, r.root.isSelected = false, r.root.containsCaret = true;
for (let n of r.atoms)
n.caret = void 0, n.isSelected = false, n.containsCaret = false;
if (r.selectionIsCollapsed) {
let n = r.at(r.position);
n.caret = t37.model.mode;
let o = n.parent;
for (; o; )
o.containsCaret = true, o = o.parent;
} else {
let n = r.getAtoms(r.selection, { includeChildren: true });
for (let o of n)
o.isSelected = true;
}
return wf(t37, e).toMarkup();
}
function st(t37, e) {
if (!tt(t37))
return;
e != null || (e = {});
let r = t37.element.querySelector("[part=virtual-keyboard-toggle]");
r && (r.style.display = t37.hasEditableContent ? "" : "none");
let i = t37.field;
if (!i)
return;
let n = t37.isSelectionEditable && t37.hasFocus(), o = i.classList.contains("ML__focused");
o && !n ? i.classList.remove("ML__focused") : !o && n && i.classList.add("ML__focused");
let a = Pl(t37, e), s = t37.element.querySelector("[part=menu-toggle]");
if (s) {
let l = false;
(t37.disabled || t37.readOnly && !t37.hasEditableContent || t37.userSelect === "none") && (l = true), !l && i.offsetWidth < 50 && (l = true), s.style.display = l ? "none" : "";
}
if (t37.model.atoms.length <= 1) {
let l = t37.options.contentPlaceholder;
l && (a += `<span part=placeholder class="ML__content-placeholder">${oe(l)}</span>`);
}
i.innerHTML = globalThis.MathfieldElement.createHTML(a), Gn(t37, e.interactive), t37.dirty = false;
}
function Gn(t37, e) {
let r = t37.field;
if (!r)
return;
for (let s of r.querySelectorAll(".ML__selection, .ML__contains-highlight"))
s.remove();
!(e != null && e) && Ee !== "error" && Ee !== "ready" && setTimeout(() => {
Ee === "ready" ? Gn(t37) : setTimeout(() => Gn(t37), 128);
}, 32);
let i = t37.model, n = r.offsetWidth, o = r.getBoundingClientRect().width, a = Math.floor(o) / n;
if (a = isNaN(a) ? 1 : a, i.selectionIsCollapsed) {
Yi(t37, { deferred: true });
let s = i.at(i.position);
for (; s && s.type !== "prompt" && !(s.containsCaret && s.displayContainsHighlight); )
s = s.parent;
if (s != null && s.containsCaret && s.displayContainsHighlight) {
let l = xl(t37, qr(t37, s), a);
if (l) {
l.left /= a, l.right /= a, l.top /= a, l.bottom /= a;
let c = document.createElement("div");
c.classList.add("ML__contains-highlight"), c.style.position = "absolute", c.style.left = `${l.left + 1}px`, c.style.top = `${Math.ceil(l.top)}px`, c.style.width = `${Math.ceil(l.right - l.left)}px`, c.style.height = `${Math.ceil(l.bottom - l.top)}px`, r.insertBefore(c, r.childNodes[0]);
}
}
return;
}
for (let s of kf(Ma(t37, { excludeAtomsWithBackground: true }))) {
s.left /= a, s.right /= a, s.top /= a, s.bottom /= a;
let l = document.createElement("div");
l.classList.add("ML__selection"), l.style.position = "absolute", l.style.left = `${s.left}px`, l.style.top = `${s.top}px`, l.style.width = `${Math.ceil(s.right - s.left)}px`, l.style.height = `${Math.ceil(s.bottom - s.top - 1)}px`, r.insertBefore(l, r.childNodes[0]);
}
}
function kf(t37) {
let e = [];
for (let r of t37) {
let i = false;
for (let n of e)
if (r.left === n.left && r.right === n.right && r.top === n.top && r.bottom === n.bottom) {
i = true;
break;
}
i || e.push(r);
}
t37 = e, e = [];
for (let r of t37) {
let i = 0;
for (let n of t37)
if (r.left >= n.left && r.right <= n.right && r.top >= n.top && r.bottom <= n.bottom && (i += 1, i > 1))
break;
i === 1 && e.push(r);
}
return e;
}
var Rl = 3;
var lt;
function ae(t37, e) {
e = p({ target: "mathfield", canUndo: false, audioFeedback: void 0, changeContent: false, changeSelection: false }, e != null ? e : {}), lt || (lt = {});
for (let r of Object.keys(t37))
lt[r], lt[r] = g(p({}, e), { fn: t37[r] });
}
function Il(t37) {
let e;
if (Array.isArray(t37)) {
if (t37[0] === "performWithFeedback")
return Il(t37[1]);
e = t37[0];
} else
e = t37;
return lt[e];
}
function Gt(t37) {
var e;
return (e = Il(t37)) == null ? void 0 : e.target;
}
function $m(t37, e) {
var l, c;
if (e = ei(e), !e)
return false;
let r, i = [], n = false, o = false;
X(e) ? (r = e[0], i = e.slice(1)) : r = e;
let a = lt[r], s = a == null ? void 0 : a.target;
if (s === "model") {
if (!t37.isSelectionEditable && (a != null && a.changeContent))
return t37.model.announce("plonk"), false;
/^(delete|add)/.test(r) && (r !== "deleteBackward" && t37.flushInlineShortcutBuffer(), t37.snapshot(r)), /^complete/.test(r) || Zr(t37), lt[r].fn(t37.model, ...i), kr(t37), o = true, n = true;
} else if (s === "virtual-keyboard")
o = (c = (l = window.mathVirtualKeyboard) == null ? void 0 : l.executeCommand(e)) != null ? c : false, n = true;
else if (lt[r]) {
if (!t37.isSelectionEditable && (a != null && a.changeContent))
return t37.model.announce("plonk"), false;
/^(undo|redo)/.test(r) && t37.flushInlineShortcutBuffer(), o = lt[r].fn(t37, ...i), n = true;
} else
throw new Error(`Unknown command "${r}"`);
return s !== "virtual-keyboard" && (!t37.model.selectionIsCollapsed || a != null && a.changeSelection && r !== "deleteBackward") && (t37.flushInlineShortcutBuffer(), a != null && a.changeContent || t37.stopCoalescingUndo(), t37.defaultStyle = {}), o && V(t37), n;
}
function Sf(t37, e) {
var n;
if (!t37)
return false;
t37.focus(), Qi.keypressVibration && yo() && navigator.vibrate(Rl);
let r = Il(e);
globalThis.MathfieldElement.playSound((n = r == null ? void 0 : r.audioFeedback) != null ? n : "keypress");
let i = t37.executeCommand(e);
return t37.scrollIntoView(), i;
}
ae({ performWithFeedback: (t37, e) => Sf(t37, e) });
function Lf(t37) {
return kr(t37, { atIndex: t37.suggestionIndex + 1 }), false;
}
function Af(t37) {
return kr(t37, { atIndex: t37.suggestionIndex - 1 }), false;
}
ae({ complete: Bt }, { target: "mathfield", audioFeedback: "return", canUndo: true, changeContent: true, changeSelection: true });
ae({ dispatchEvent: (t37, e, r) => {
var i, n;
return (n = (i = t37.host) == null ? void 0 : i.dispatchEvent(new CustomEvent(e, { detail: r }))) != null ? n : false;
} }, { target: "mathfield" });
ae({ nextSuggestion: Lf, previousSuggestion: Af }, { target: "mathfield", audioFeedback: "keypress", changeSelection: true });
function ei(t37) {
if (!t37)
return;
if (X(t37) && t37.length > 0) {
let i = t37[0];
return i.replace(/-\w/g, (n) => n[1].toUpperCase()), i === "performWithFeedback" && t37.length === 2 ? [i, ei(t37[1])] : [i, ...t37.slice(1)];
}
if (typeof t37 != "string")
return;
let e = t37.trim().match(/^([a-zA-Z0-9-]+)\((.*)\)$/);
if (e) {
let i = e[1];
i.replace(/-\w/g, (o) => o[1].toUpperCase());
let n = e[2].split(",").map((o) => o.trim());
return [i, ...n.map((o) => {
if (/"[^"]*"/.test(o) || /'[^']*'/.test(o))
return o.slice(1, -1);
if (/^true$/.test(o))
return true;
if (/^false$/.test(o))
return false;
if (/^[-]?\d+$/.test(o))
return parseInt(o, 10);
if (/^\{.*\}$/.test(o))
try {
return JSON.parse(o);
} catch (a) {
return console.error("Invalid argument:", o), o;
}
return ei(o);
})];
}
let r = t37;
return r.replace(/-\w/g, (i) => i[1].toUpperCase()), r;
}
var Xn = "mathlive#virtual-keyboard-message";
function Zn(t37) {
var r;
return t37.type !== "message" ? false : ((r = t37.data) == null ? void 0 : r.type) === Xn;
}
var jn = class t33 {
constructor() {
this.targetOrigin = window.origin;
this.originValidator = "none";
this._boundingRect = new DOMRect(0, 0, 0, 0);
this._isShifted = false;
window.addEventListener("message", this), this.sendMessage("proxy-created"), this.listeners = {};
}
static get singleton() {
return this._singleton || (this._singleton = new t33()), this._singleton;
}
set alphabeticLayout(e) {
this.sendMessage("update-setting", { alphabeticLayout: e });
}
set layouts(e) {
this.sendMessage("update-setting", { layouts: e });
}
get normalizedLayouts() {
return [];
}
set editToolbar(e) {
this.sendMessage("update-setting", { editToolbar: e });
}
set actionKeycap(e) {
this.sendMessage("update-setting", { actionKeycap: e });
}
set shiftKeycap(e) {
this.sendMessage("update-setting", { shiftKeycap: e });
}
set backspaceKeycap(e) {
this.sendMessage("update-setting", { backspaceKeycap: e });
}
set tabKeycap(e) {
this.sendMessage("update-setting", { tabKeycap: e });
}
set container(e) {
throw new Error("Container inside an iframe cannot be changed");
}
show(e) {
this.dispatchEvent(new CustomEvent("before-virtual-keyboard-toggle", { detail: { visible: true }, bubbles: true, cancelable: true, composed: true })) && (this.sendMessage("show", e), this.dispatchEvent(new Event("virtual-keyboard-toggle")));
}
hide(e) {
this.dispatchEvent(new CustomEvent("before-virtual-keyboard-toggle", { detail: { visible: false }, bubbles: true, cancelable: true, composed: true })) && (this.sendMessage("hide", e), this.dispatchEvent(new Event("virtual-keyboard-toggle")));
}
get isShifted() {
return this._isShifted;
}
get visible() {
return this._boundingRect.height > 0;
}
set visible(e) {
e ? this.show() : this.hide();
}
get boundingRect() {
return this._boundingRect;
}
executeCommand(e) {
return this.sendMessage("execute-command", { command: e }), true;
}
updateToolbar(e) {
this.sendMessage("update-toolbar", e);
}
update(e) {
this.sendMessage("update-setting", e);
}
connect() {
this.sendMessage("connect");
}
disconnect() {
this.sendMessage("disconnect");
}
addEventListener(e, r, i) {
this.listeners[e] || (this.listeners[e] = /* @__PURE__ */ new Set()), this.listeners[e].has(r) || this.listeners[e].add(r);
}
dispatchEvent(e) {
return !this.listeners[e.type] || this.listeners[e.type].size === 0 ? true : (this.listeners[e.type].forEach((r) => {
typeof r == "function" ? r(e) : r == null || r.handleEvent(e);
}), !e.defaultPrevented);
}
removeEventListener(e, r, i) {
this.listeners[e] && this.listeners[e].delete(r);
}
handleEvent(e) {
if (Zn(e)) {
if (!Ii(e.origin, this.originValidator))
throw new DOMException(`Message from unknown origin (${e.origin}) cannot be handled`, "SecurityError");
this.handleMessage(e.data);
}
}
handleMessage(e) {
let { action: r } = e;
if (r === "execute-command") {
let { command: i } = e;
Gt(i) === "virtual-keyboard" && this.executeCommand(i);
return;
}
if (r === "synchronize-proxy") {
this._boundingRect = e.boundingRect, this._isShifted = e.isShifted;
return;
}
if (r === "geometry-changed") {
this._boundingRect = e.boundingRect, this.dispatchEvent(new Event("geometrychange"));
return;
}
}
sendMessage(e, r = {}) {
if (!window.top)
throw new DOMException("A frame does not have access to the top window and can\u2018t communicate with the keyboard. Review virtualKeyboardTargetOrigin and originValidator on mathfields embedded in an iframe", "SecurityError");
window.top.postMessage(p({ type: Xn, action: e }, r), this.targetOrigin);
}
};
var zl = { numeric: { label: "123", labelClass: "MLK__tex-math", tooltip: "keyboard.tooltip.numeric", rows: [[{ latex: "x", shift: "y", variants: ["y", "z", "t", "r", "x^2", "x^n", "x^{#?}", "x_n", "x_i", "x_{#?}", { latex: "f(#?)", class: "small" }, { latex: "g(#?)", class: "small" }] }, { latex: "n", shift: "a", variants: ["i", "j", "p", "k", "a", "u"] }, "[separator-5]", "[7]", "[8]", "[9]", "[/]", "[separator-5]", { latex: "\\exponentialE", shift: "\\ln", variants: ["\\exp", "\\times 10^{#?}", "\\ln", "\\log_{10}", "\\log"] }, { latex: "\\imaginaryI", variants: ["\\Re", "\\Im", "\\imaginaryJ", "\\Vert #0 \\Vert"] }, { latex: "\\pi", shift: "\\sin", variants: ["\\prod", { latex: "\\theta", aside: "theta" }, { latex: "\\rho", aside: "rho" }, { latex: "\\tau", aside: "tau" }, "\\sin", "\\cos", "\\tan"] }], [{ label: "<", latex: "<", class: "hide-shift", shift: { latex: "\\le", label: "\u2264" } }, { label: ">", latex: ">", class: "hide-shift", shift: { latex: "\\ge", label: "\u2265" } }, "[separator-5]", "[4]", "[5]", "[6]", "[*]", "[separator-5]", { class: "hide-shift", latex: "#@^2}", shift: "#@^{\\prime}}" }, { latex: "#@^{#0}}", class: "hide-shift", shift: "#@_{#?}" }, { class: "hide-shift", latex: "\\sqrt{#0}", shift: { latex: "\\sqrt[#0]{#?}}" } }], ["[(]", "[)]", "[separator-5]", "[1]", "[2]", "[3]", "[-]", "[separator-5]", { latex: "\\int^{\\infty}_{0}\\!#?\\,\\mathrm{d}x", class: "small hide-shift", shift: "\\int", variants: [{ latex: "\\int_{#?}^{#?}", class: "small" }, { latex: "\\int", class: "small" }, { latex: "\\iint", class: "small" }, { latex: "\\iiint", class: "small" }, { latex: "\\oint", class: "small" }, "\\mathrm{d}x", { latex: "\\dfrac{\\mathrm{d}}{\\mathrm{d} x}", class: "small" }, { latex: "\\frac{\\partial}{\\partial x}", class: "small" }, "\\partial"] }, { class: "hide-shift", latex: "\\forall", shift: "\\exists" }, { label: "[backspace]", width: 1 }], [{ label: "[shift]", width: 2 }, "[separator-5]", "[0]", "[.]", "[=]", "[+]", "[separator-5]", "[left]", "[right]", { label: "[action]", width: 1 }]] }, greek: { label: "&alpha;&beta;&gamma;", labelClass: "MLK__tex-math", tooltip: "keyboard.tooltip.greek", rows: [[{ label: "<i>&#x03c6;</i>", class: "MLK__tex hide-shift", insert: "\\varphi", aside: "phi var.", shift: "\\Phi" }, { label: "<i>&#x03c2;</i>", class: "MLK__tex hide-shift", insert: "\\varsigma", aside: "sigma var.", shift: "\\Sigma" }, { label: "<i>&#x03f5;</i>", class: "MLK__tex hide-shift", insert: "\\epsilon", aside: "epsilon", shift: '\\char"0190' }, { label: "<i>&rho;</i>", class: "MLK__tex hide-shift", insert: "\\rho", aside: "rho", shift: '\\char"3A1' }, { label: "<i>&tau;</i>", class: "MLK__tex hide-shift", insert: "\\tau", aside: "tau", shift: '\\char"3A4' }, { label: "<i>&upsilon;</i>", class: "MLK__tex hide-shift", insert: "\\upsilon", aside: "upsilon", shift: "\\Upsilon" }, { label: "<i>&theta;</i>", class: "MLK__tex hide-shift", insert: "\\theta", aside: "theta", shift: "\\Theta" }, { label: "<i>&iota;</i>", class: "MLK__tex hide-shift", insert: "\\iota", aside: "iota", shift: '\\char"399' }, { label: "<i>&omicron;</i>", class: "MLK__tex hide-shift", insert: "\\omicron", aside: "omicron", shift: '\\char"39F' }, { label: "<i>&pi;</i>", class: "MLK__tex hide-shift", insert: "\\pi", aside: "pi", shift: "\\Pi" }], ["[separator-5]", { label: "<i>&alpha;</i>", class: "MLK__tex hide-shift", insert: "\\alpha", aside: "alpha", shift: '\\char"391' }, { label: "<i>&sigma;</i>", class: "MLK__tex hide-shift", insert: "\\sigma", aside: "sigma", shift: "\\Sigma" }, { label: "<i>&delta;</i>", class: "MLK__tex hide-shift", insert: "\\delta", aside: "delta", shift: "\\Delta" }, { latex: "\\phi", class: "MLK__tex hide-shift", insert: "\\phi", aside: "phi", shift: "\\Phi" }, { label: "<i>&gamma;</i>", class: "MLK__tex hide-shift", insert: "\\gamma", aside: "gamma", shift: "\\Gamma" }, { label: "<i>&eta;</i>", class: "MLK__tex hide-shift", insert: "\\eta", aside: "eta", shift: '\\char"397' }, { label: "<i>&xi;</i>", class: "MLK__tex hide-shift", insert: "\\xi", aside: "xi", shift: "\\Xi" }, { label: "<i>&kappa;</i>", class: "MLK__tex hide-shift", insert: "\\kappa", aside: "kappa", shift: "\\Kappa" }, { label: "<i>&lambda;</i>", class: "MLK__tex hide-shift", insert: "\\lambda", aside: "lambda", shift: "\\Lambda" }, "[separator-5]"], ["[shift]", { label: "<i>&zeta;</i>", class: "MLK__tex hide-shift", insert: "\\zeta", aside: "zeta", shift: '\\char"396' }, { label: "<i>&chi;</i>", class: "MLK__tex hide-shift", insert: "\\chi", aside: "chi", shift: '\\char"3A7' }, { label: "<i>&psi;</i>", class: "MLK__tex hide-shift", insert: "\\psi", aside: "zeta", shift: "\\Psi" }, { label: "<i>&omega;</i>", class: "MLK__tex hide-shift", insert: "\\omega", aside: "omega", shift: "\\Omega" }, { label: "<i>&beta;</i>", class: "MLK__tex hide-shift", insert: "\\beta", aside: "beta", shift: '\\char"392' }, { label: "<i>&nu;</i>", class: "MLK__tex hide-shift", insert: "\\nu", aside: "nu", shift: '\\char"39D' }, { label: "<i>&mu;</i>", class: "MLK__tex hide-shift", insert: "\\mu", aside: "mu", shift: '\\char"39C' }, "[backspace]"], ["[separator]", { label: "<i>&#x03b5;</i>", class: "MLK__tex", insert: "\\varepsilon", aside: "epsilon var." }, { label: "<i>&#x03d1;</i>", class: "MLK__tex", insert: "\\vartheta", aside: "theta var." }, { label: "<i>&#x3f0;</i>", class: "MLK__tex", insert: "\\varkappa", aside: "kappa var." }, { label: "<i>&#x03d6;</i>", class: "MLK__tex", insert: "\\varpi", aside: "pi var." }, { label: "<i>&#x03f1;</i>", class: "MLK__tex", insert: "\\varrho", aside: "rho var." }, "[left]", "[right]", "[action]"]] }, symbols: { label: "&infin;\u2260\u2208", labelClass: "MLK__tex", tooltip: "keyboard.tooltip.symbols", rows: [[{ latex: "\\sin", shift: "\\sin^{-1}", variants: [{ class: "small", latex: "\\sinh" }, { class: "small", latex: "\\sin^{-1}" }, { class: "small", latex: "\\arsinh" }] }, "\\ln", { latex: "\\mathrm{abs}", insert: "\\mathrm{abs}\\left(#0\\right)" }, { latex: "\\rarr", shift: "\\rArr", variants: [{ latex: "\\implies", aside: "implies" }, { latex: "\\to", aside: "to" }, "\\dashv", { latex: "\\roundimplies", aside: "round implies" }] }, { latex: "\\exists", variants: ["\\nexists"], shift: "\\nexists" }, { latex: "\\in", shift: "\\notin", variants: ["\\notin", "\\owns"] }, "\\cup", { latex: "\\overrightarrow{#@}", shift: "\\overleftarrow{#@}", variants: ["\\overleftarrow{#@}", "\\bar{#@}", "\\vec{#@}", "\\hat{#@}", "\\check{#@}", "\\dot{#@}", "\\ddot{#@}", "\\mathring{#@}", "\\breve{#@}", "\\acute{#@}", "\\tilde{#@}", "\\grave{#@}"] }, { class: "small hide-shift", latex: "\\lim_{#?}", shift: "\\lim_{x\\to\\infty}", variants: [{ class: "small", latex: "\\liminf_{#?}" }, { class: "small", latex: "\\limsup_{#?}" }] }, "\\exponentialE"], [{ latex: "\\cos", shift: "\\cos^{-1}", variants: [{ class: "small", latex: "\\cosh" }, { class: "small", latex: "\\cos^{-1}" }, { class: "small", latex: "\\arcosh" }] }, { latex: "\\log", shift: "\\log_{10}", variants: ["\\log_{#0}", "\\log_{10}"] }, "\\left\\vert#0\\right\\vert", { latex: "\\larr", shift: "\\lArr", variants: [{ latex: "\\impliedby", aside: "implied by" }, { latex: "\\gets", aside: "gets" }, "\\lArr", "\\vdash", { latex: "\\models", aside: "models" }] }, { latex: "\\forall", shift: "\\lnot", variants: [{ latex: "\\land", aside: "and" }, { latex: "\\lor", aside: "or" }, { latex: "\\oplus", aside: "xor" }, { latex: "\\lnot", aside: "not" }, { latex: "\\downarrow", aside: "nor" }, { latex: "\\uparrow", aside: "nand" }, { latex: "\\curlywedge", aside: "nor" }, { latex: "\\bar\\curlywedge", aside: "nand" }] }, { latex: "\\ni", shift: "\\not\\owns" }, "\\cap", { latex: "\\overline{#@}", shift: "\\underline{#@}", variants: ["\\overbrace{#@}", "\\overlinesegment{#@}", "\\overleftrightarrow{#@}", "\\overrightarrow{#@}", "\\overleftarrow{#@}", "\\overgroup{#@}", "\\underbrace{#@}", "\\underlinesegment{#@}", "\\underleftrightarrow{#@}", "\\underrightarrow{#@}", "\\underleftarrow{#@}", "\\undergroup{#@}"] }, { class: "hide-shift small", latex: "\\int", shift: "\\iint", variants: [{ latex: "\\int_{#?}^{#?}", class: "small" }, { latex: "\\int", class: "small" }, { latex: "\\smallint", class: "small" }, { latex: "\\iint", class: "small" }, { latex: "\\iiint", class: "small" }, { latex: "\\oint", class: "small" }, "\\intop", "\\iiint", "\\oiint", "\\oiiint", "\\intclockwise", "\\varointclockwise", "\\ointctrclockwise", "\\intctrclockwise"] }, { latex: "\\pi", shift: "\\tau", variants: ["\\tau"] }], [{ latex: "\\tan", shift: "\\tan^{-1}", variants: [{ class: "small", latex: "\\tanh" }, { class: "small", latex: "\\tan^{-1}" }, { class: "small", latex: "\\artanh" }, { class: "small", latex: "\\arctan" }, { class: "small", latex: "\\arctg" }, { class: "small", latex: "\\tg" }] }, { latex: "\\exp", insert: "\\exp\\left(#0\\right)", variants: ["\\exponentialE^{#0}"] }, "\\left\\Vert#0\\right\\Vert", { latex: "\\lrArr", shift: "\\leftrightarrow", variants: [{ latex: "\\iff", aside: "if and only if" }, "\\leftrightarrow", "\\leftrightarrows", "\\Leftrightarrow", { latex: "^\\biconditional", aside: "biconditional" }] }, { latex: "\\vert", shift: "!" }, { latex: "#@^{\\complement}", aside: "complement", variants: [{ latex: "\\setminus", aside: "set minus" }, { latex: "\\smallsetminus", aside: "small set minus" }] }, { latex: "\\subset", shift: "\\subseteq", variants: ["\\subset", "\\subseteq", "\\subsetneq", "\\varsubsetneq", "\\subsetneqq", "\\nsubset", "\\nsubseteq", "\\supset", "\\supseteq", "\\supsetneq", "\\supsetneqq", "\\nsupset", "\\nsupseteq"] }, { latex: "#@^{\\prime}", shift: "#@^{\\doubleprime}", variants: ["#@^{\\doubleprime}", "#@\\degree"] }, { latex: "\\mathrm{d}", shift: "\\partial", variants: ["\\mathrm{d}x", { latex: "\\dfrac{\\mathrm{d}}{\\mathrm{d} x}", class: "small" }, { latex: "\\frac{\\partial}{\\partial x}", class: "small" }, "\\partial"] }, { latex: "\\infty", variants: ["\\aleph_0", "\\aleph_1", "\\omega", "\\mathfrak{m}"] }], [{ label: "[shift]", width: 2 }, { class: "box", latex: ",", shift: ";", variants: [";", "?"] }, { class: "box", latex: "\\colon", shift: "\\Colon", variants: [{ latex: "\\Colon", aside: "such that", class: "box" }, { latex: ":", aside: "ratio", class: "box" }, { latex: "\\vdots", aside: "", class: "box" }, { latex: "\\ddots", aside: "", class: "box" }, { latex: "\\ldotp", aside: "low dot", class: "box" }, { latex: "\\cdotp", aside: "center dot", class: "box" }, { latex: "\\ldots", aside: "low ellipsis", class: "box" }, { latex: "\\cdots", aside: "center ellipsis", class: "box" }, { latex: "\\therefore", aside: "therefore", class: "box" }, { latex: "\\because", aside: "because", class: "box" }] }, { class: "box", latex: "\\cdot", aside: "centered dot", shift: "\\ast", variants: ["\\circ", "\\bigcirc", "\\bullet", "\\odot", "\\oslash", "\\circledcirc", "\\ast", "\\star", "\\times", "\\doteq", "\\doteqdot"] }, "[separator]", "[left]", "[right]", { label: "[backspace]", width: 1, class: "action hide-shift" }, { label: "[action]", width: 1 }]] }, compact: { label: "compact", rows: [["[+]", "[-]", "[*]", "[/]", "[=]", "[.]", "[(]", "[)]", "\\sqrt{#0}", "#@^{#?}"], ["[1]", "[2]", "[3]", "[4]", "[5]", "[6]", "[7]", "[8]", "[9]", "[0]"], ["[hr]"], ["[undo]", "[redo]", "[separator]", "[separator]", "[separator]", "[left]", "[right]", { label: "[backspace]", class: "action hide-shift" }, "[hide-keyboard]"]] }, minimalist: { label: "minimalist", layers: [{ style: `
.minimalist-backdrop {
display: flex;
justify-content: center;
}
.minimalist-container {
--keycap-height: 40px;
--keycap-max-width: 53px;
--keycap-small-font-size: 12px;
background: var(--keyboard-background);
padding: 20px;
border-top-left-radius: 8px;
border-top-right-radius: 8px;
border: 1px solid var(--keyboard-border);
box-shadow: 0 0 32px rgb(0 0 0 / 30%);
}
`, backdrop: "minimalist-backdrop", container: "minimalist-container", rows: [["+", "-", "\\times", { latex: "\\frac{#@}{#0}", class: "small" }, "=", "[.]", "(", ")", { latex: "\\sqrt{#0}", class: "small" }, { latex: "#@^{#?}", class: "small" }], ["1", "2", "3", "4", "5", "6", "7", "8", "9", "0"], ["[hr]"], ["[undo]", "[redo]", "[separator]", "[separator]", "[separator]", "[left]", "[right]", { label: "[backspace]", class: "action hide-shift" }, "[hide-keyboard]"]] }] }, "numeric-only": { label: "123", labelClass: "MLK__tex-math", tooltip: "keyboard.tooltip.numeric", id: "numeric-only", rows: [["7", "8", "9", "[separator]", { label: "[backspace]", width: 2 }], ["4", "5", "6", "[separator]", "[separator]", "[separator]"], ["1", "2", "3", "[separator]", "[separator]", "[separator]"], ["0", { label: "[.]", variants: [] }, "-", "[separator]", "[left]", "[right]"]] } };
var Na = { 0: ["\\varnothing", "\\infty"], 1: ["\\frac{1}{#@}", "#@^{-1}", "\\times 10^{#?}", "\\phi", "\\imaginaryI"], 2: ["\\frac{1}{2}", "#@^2", "\\sqrt2", "\\exponentialE"], 3: ["\\frac{1}{3}", "#@^3", "\\sqrt3", "\\pi"], 4: ["\\frac{1}{4}", "#@^4"], 5: ["\\frac{1}{5}", "#@^5", "\\sqrt5"], 6: ["\\frac{1}{6}", "#@^6"], 7: ["\\frac{1}{7}", "#@^7"], 8: ["\\frac{1}{8}", "#@^8"], 9: ["\\frac{1}{9}", "#@^9"], ".": [".", ",", ";", "\\colon"], ",": ["{,}", ".", ";", "\\colon"], a: [{ latex: "\\aleph", aside: "aleph" }, { latex: "\\forall", aside: "for all" }, "\xE5", "\xE0", "\xE1", "\xE2", "\xE4", "\xE6"], A: [{ latex: "\\aleph", aside: "aleph" }, { latex: "\\forall", aside: "for all" }, "\xC5", "\xC0", "\xC1", "\xC2", "\xC4", "\xC6"], b: [{ latex: "\\beth", aside: "beth" }], c: [{ latex: "\\C", aside: "set of complex numbers" }, "\xE7"], d: [{ latex: "\\daleth", aside: "daleth" }], e: [{ latex: "\\exponentialE", aside: "exponential e" }, { latex: "\\exists", aside: "there is" }, { latex: "\\nexists", aside: "there isn\u2019t" }, "\xE8", "\xE9", "\xEA", "\xEB"], E: [{ latex: "\\exponentialE", aside: "exponential e" }, { latex: "\\exists", aside: "there is" }, { latex: "\\nexists", aside: "there isn\u2019t" }, "\xC8", "\xC9", "\xCA", "\xCB"], g: [{ latex: "\\gimel", aside: "gimel" }], h: [{ latex: "\\hbar", aside: "h bar" }, { latex: "\\hslash", aside: "h slash" }], i: [{ latex: "\\imaginaryI", aside: "imaginary i" }, "\xEC", "\xED", "\xEE", "\xEF"], I: [{ latex: "\\imaginaryI", aside: "imaginary i" }, "\xCC", "\xCD", "\xCE", "\xCF"], j: [{ latex: "\\imaginaryJ", aside: "imaginary j" }], l: [{ latex: "\\ell", aside: "ell" }], n: [{ latex: "\\mathbb{N}", aside: "set of natural numbers" }, "\xF1"], o: ["\xF8", "\u0153", "\xF2", "\xF3", "\xF4", "\xF6"], O: ["\xF8", "\u0152", "\xD2", "\xD3", "\xD4", "\xD6"], p: [{ latex: "\\mathbb{P}", aside: "set of primes" }], q: [{ latex: "\\mathbb{Q}", aside: "set of rational numbers" }], r: [{ latex: "\\mathbb{R}", aside: "set of real numbers" }], u: ["\xF9", "\xFA", "\xFB", "\xFC"], U: ["\xD9", "\xDA", "\xDB", "\xDC"], z: [{ latex: "\\mathbb{Z}", aside: "set of integers" }], y: ["\xFD", "\xFF"], Y: ["\u0178"], space: [{ latex: '\\char"203A\\!\\char"2039', insert: "\\!", aside: "negative thin space<br>\u207B\xB3\u29F8\u2081\u2088 em" }, { latex: '\\char"203A\\,\\char"2039', insert: "\\,", aside: "thin space<br>\xB3\u29F8\u2081\u2088 em" }, { latex: '\\char"203A\\:\\char"2039', insert: "\\:", aside: "medium space<br>\u2074\u29F8\u2081\u2088 em" }, { latex: '\\char"203A\\;\\char"2039', insert: "\\;", aside: "thick space<br>\u2075\u29F8\u2081\u2088 em" }, { latex: '\\char"203A\\ \\char"2039', insert: "\\ ", aside: "\u2153 em" }, { latex: '\\char"203A\\enspace\\char"2039', insert: "\\enspace", aside: "\xBD em" }, { latex: '\\char"203A\\quad\\char"2039', insert: "\\quad", aside: "1 em" }, { latex: '\\char"203A\\qquad\\char"2039', insert: "\\qquad", aside: "2 em" }] };
var en;
function Fa(t37, e) {
var m, h, f, b, S;
let r = we.singleton;
if (!r)
return;
let i = ti(t37), n = "";
if (window.mathVirtualKeyboard.isShifted) {
let M = (m = r.getKeycap(i == null ? void 0 : i.id)) == null ? void 0 : m.shift;
typeof M == "object" && "variants" in M && (n = (h = M.variants) != null ? h : "");
} else
n = (b = (f = r.getKeycap(i == null ? void 0 : i.id)) == null ? void 0 : f.variants) != null ? b : "";
if (typeof n == "string" && !$a(n) || Array.isArray(n) && n.length === 0) {
e == null || e();
return;
}
let o = {}, a = "";
for (let M of Ef(n)) {
let x = Nl(M), v = Date.now().toString(36).slice(-2) + Math.floor(Math.random() * 1e5).toString(36);
o[v] = x;
let [k, C] = tn(x);
a += `<div id=${v} class="item ${C}">${k}</div>`;
}
let s = document.createElement("div");
s.setAttribute("aria-hidden", "true"), s.className = "MLK__variant-panel", s.style.height = "auto";
let l = Object.keys(o).length, c = 5;
l === 1 ? c = 1 : l === 2 || l === 4 ? c = 2 : l === 3 || l === 5 || l === 6 ? c = 3 : l >= 7 && l < 14 && (c = 4), s.style.width = `calc(var(--variant-keycap-length) * ${c} + 12px)`, s.innerHTML = Qi.createHTML(a), _e.open({ root: (S = r == null ? void 0 : r.container) == null ? void 0 : S.querySelector(".ML__keyboard"), child: s }), en = new AbortController();
let { signal: u } = en, d = t37 == null ? void 0 : t37.getBoundingClientRect();
if (d) {
d.top - s.clientHeight < 0 && (s.style.width = "auto", l <= 6 ? s.style.height = "56px" : l <= 12 ? s.style.height = "108px" : l <= 18 ? s.style.height = "205px" : s.classList.add("compact"));
let M = Math.max(0, Math.min(window.innerWidth - s.offsetWidth, (d.left + d.right - s.offsetWidth) / 2)), x = d.top - s.clientHeight + 5;
s.style.transform = `translate(${M}px, ${x}px)`, s.classList.add("is-visible"), requestAnimationFrame(() => {
s.addEventListener("pointerup", (v) => {
let k = ti(v.target);
!(k != null && k.id) || !o[k.id] || (Va(o[k.id]), ri(), e == null || e(), v.preventDefault());
}, { capture: true, passive: false, signal: u }), s.addEventListener("pointerenter", (v) => {
let k = ti(v.target);
!(k != null && k.id) || !o[k.id] || k.classList.add("is-active");
}, { capture: true, signal: u }), s.addEventListener("pointerleave", (v) => {
let k = ti(v.target);
!(k != null && k.id) || !o[k.id] || k.classList.remove("is-active");
}, { capture: true, signal: u }), window.addEventListener("pointercancel", () => {
ri(), e == null || e();
}, { signal: u }), window.addEventListener("pointerup", () => {
ri(), e == null || e();
}, { signal: u });
});
}
}
function ri() {
en == null || en.abort(), en = null, _e.state === "open" && _e.close();
}
function Cf(t37) {
if (t37 === "foreground-color") {
let e = [];
for (let r of Object.keys(zt))
e.push({ class: "swatch-button", label: '<span style="border: 3px solid ' + zt[r] + '"></span>', command: ["applyStyle", { color: r }] });
return e;
}
if (t37 === "background-color") {
let e = [];
for (let r of Object.keys(It))
e.push({ class: "swatch-button", label: '<span style="background:' + It[r] + '"></span>', command: ["applyStyle", { backgroundColor: r }] });
return e;
}
}
function $a(t37) {
return Na[t37] !== void 0;
}
function Ef(t37) {
var e;
return typeof t37 != "string" ? t37 : (Na[t37] || (Na[t37] = (e = Cf(t37)) != null ? e : []), Na[t37]);
}
function Tf(t37) {
return typeof t37 == "string" ? t37 : Object.entries(t37).map(([e, r]) => `${e}:${r} !important`).join(";");
}
function Df(t37) {
return Object.keys(t37).map((e) => `${e} {${Tf(t37[e])}}`).join("");
}
function Yn(t37) {
if (!t37)
return "";
let e = new T(), r = new y({ mode: "math", type: "root", body: se(t37, { context: e, args: (n) => n === "@" ? "{\\class{ML__box-placeholder}{\\blacksquare}}" : "\\placeholder{}" }) }), i = dr(Tt(new w(r.render(e), { classes: "ML__base" }), e));
return mr(i, { classes: "ML__latex" }).toMarkup();
}
function Qn(t37) {
var r;
if (Array.isArray(t37))
return t37.map((i) => Qn(i)).flat();
let e = typeof t37 == "string" ? { markup: t37 } : t37;
return "rows" in e && Array.isArray(e.rows) && (e.rows = e.rows.map((i) => i.map((n) => Nl(n)))), (r = e.id) != null || (e.id = "ML__layer_" + Date.now().toString(36).slice(-2) + Math.floor(Math.random() * 1e5).toString(36)), [e];
}
function Kf() {
var o, a;
let e = window.mathVirtualKeyboard.alphabeticLayout;
if (e === "auto") {
let s = vr();
s && (e = s.virtualLayout), (!e || e === "auto") && (e = (o = { fr: "azerty", be: "azerty", al: "qwertz", ba: "qwertz", cz: "qwertz", de: "qwertz", hu: "qwertz", sk: "qwertz", ch: "qwertz" }[O.locale.slice(0, 2)]) != null ? o : "qwerty");
}
let r = { qwerty: ["qwertyuiop", " asdfghjkl ", "^zxcvbnm~"], azerty: ["azertyuiop", "qsdfghjklm", "^ wxcvbn ~"], qwertz: ["qwertzuiop", " asdfghjkl ", "^yxcvbnm~"], dvorak: ["^ pyfgcrl ", "aoeuidhtns", "qjkxbmwvz~"], colemak: [" qwfpgjluy ", "arstdhneio", "^zxcvbkm~"] }, i = (a = r[e]) != null ? a : r.qwerty, n = e === "azerty" ? [[{ label: "1", variants: "1" }, { label: "2", shift: { latex: "\xE9" }, variants: "2" }, { label: "3", shift: { latex: "\xF9" }, variants: "3" }, { label: "4", variants: "4" }, { label: "5", shift: { label: "(", latex: "(" }, variants: "5" }, { label: "6", shift: { label: ")", latex: ")" }, variants: "6" }, { label: "7", shift: { latex: "\xE8" }, variants: "7" }, { label: "8", shift: { latex: "\xEA" }, variants: "8" }, { label: "9", shift: { latex: "\xE7" }, variants: "9" }, { label: "0", shift: { latex: "\xE0" }, variants: "0" }]] : [[{ label: "1", variants: "1" }, { label: "2", variants: "2" }, { label: "3", variants: "3" }, { label: "4", variants: "4" }, { label: "5", shift: { latex: "\\frac{#@}{#?}" }, variants: "5" }, { label: "6", shift: { latex: "#@^#?" }, variants: "6" }, { label: "7", variants: "7" }, { label: "8", shift: { latex: "\\times" }, variants: "8" }, { label: "9", shift: { label: "(", latex: "(" }, variants: "9" }, { label: "0", shift: { label: ")", latex: ")" }, variants: "0" }]];
for (let s of i) {
let l = [];
for (let c of s)
/[a-z]/.test(c) ? l.push({ label: c, class: "hide-shift", shift: { label: c.toUpperCase(), variants: $a(c.toUpperCase()) ? c.toUpperCase() : void 0 }, variants: $a(c) ? c : void 0 }) : c === "~" ? e !== "dvorak" ? l.push("[backspace]") : l.push({ label: "[backspace]", width: 1 }) : c === "^" ? l.push("[shift]") : c === " " && l.push("[separator-5]");
n.push(l);
}
return n.push(["[-]", "[+]", "[=]", { label: " ", width: 1.5 }, { label: ",", shift: ";", variants: ".", class: "hide-shift" }, "[.]", "[left]", "[right]", { label: "[action]", width: 1.5 }]), { label: "abc", labelClass: "MLK__tex-math", tooltip: "keyboard.tooltip.alphabetic", layers: Qn({ rows: n }) };
}
function Fl(t37) {
if (t37 === "alphabetic")
return Kf();
if (typeof t37 == "string")
return zl[t37], `${t37}`, Fl(zl[t37]);
let e;
if ("rows" in t37 && Array.isArray(t37.rows)) {
"layers" in t37 || "markup" in t37;
let n = t37, { rows: a } = n, s = fi(n, ["rows"]);
e = g(p({}, s), { layers: Qn({ rows: t37.rows }) });
} else if ("markup" in t37 && typeof t37.markup == "string") {
let o = t37, { markup: a } = o, s = fi(o, ["markup"]);
e = g(p({}, s), { layers: Qn(t37.markup) });
} else
e = p({}, t37), "layers" in t37 ? e.layers = Qn(t37.layers) : console.error('MathLive 0.100.0: provide either a "rows", "markup" or "layers" property');
let r = false, i = false;
for (let a of e.layers)
if (a.rows)
for (let s of a.rows.flat()) {
rn(s) && (r = true);
let l = s.command;
typeof l == "string" && ["undo", "redo", "cut", "copy", "paste"].includes(l) && (i = true);
}
return (!("displayShiftedKeycaps" in t37) || t37.displayShiftedKeycaps === void 0) && (e.displayShiftedKeycaps = r), (!("displayEditToolbar" in t37) || t37.displayEditToolbar === void 0) && (e.displayEditToolbar = !i), e;
}
function Bf(t37, e) {
var i, n;
let r = '<div class="left">';
if (t37.normalizedLayouts.length > 1)
for (let [o, a] of t37.normalizedLayouts.entries()) {
let s = a, l = [o === e ? "selected" : "layer-switch"];
s.tooltip && l.push("MLK__tooltip"), s.labelClass && l.push(...s.labelClass.split(" ")), r += `<div class="${l.join(" ")}"`, s.tooltip && (r += " data-tooltip='" + ((i = P(s.tooltip)) != null ? i : s.tooltip) + "' "), o !== e && (r += `data-layer="${s.layers[0].id}"`), r += `>${(n = s.label) != null ? n : "untitled"}</div>`;
}
return r += "</div>", r;
}
function Vm(t37, e) {
let r = "";
if (t37.editToolbar === "none")
return "";
let n = [];
e.selectionIsCollapsed ? n.push("undo", "redo", "pasteFromClipboard") : n.push("cutToClipboard", "copyToClipboard", "pasteFromClipboard");
let o = { undo: `<div class='action ${e.canUndo === false ? "disabled" : ""}'
data-command='"undo"'
data-tooltip='${P("tooltip.undo")}'>
<svg><use xlink:href='#svg-undo' /></svg>
</div>`, redo: `<div class='action ${e.canRedo === false ? "disabled" : ""}'
data-command='"redo"'
data-tooltip='${P("tooltip.redo")}'>
<svg><use xlink:href='#svg-redo' /></svg>
</div>`, cutToClipboard: `
<div class='action'
data-command='"cutToClipboard"'
data-tooltip='${P("tooltip.cut to clipboard")}'>
<svg><use xlink:href='#svg-cut' /></svg>
</div>
`, copyToClipboard: `
<div class='action'
data-command='"copyToClipboard"'
data-tooltip='${P("tooltip.copy to clipboard")}'>
<svg><use xlink:href='#svg-copy' /></svg>
</div>
`, pasteFromClipboard: `
<div class='action'
data-command='"pasteFromClipboard"'
data-tooltip='${P("tooltip.paste from clipboard")}'>
<svg><use xlink:href='#svg-paste' /></svg>
</div>
` };
return r += n.map((a) => o[a]).join(""), r;
}
function Of(t37) {
for (let e of t37)
Pf(e);
}
function Pf(t37) {
let e = we.singleton;
if (!e)
return;
let r = {};
if (!t37.id) {
if (t37.hasAttribute("data-label") && (r.label = t37.dataset.label), t37.hasAttribute("data-latex") && (r.latex = t37.dataset.latex), t37.hasAttribute("data-key") && (r.key = t37.dataset.key), t37.hasAttribute("data-insert") && (r.insert = t37.dataset.insert), t37.hasAttribute("data-variants") && (r.variants = t37.dataset.variants), t37.hasAttribute("data-aside") && (r.aside = t37.dataset.aside), t37.className && (r.class = t37.className), !r.label && !r.latex && !r.key && !r.insert && (r.latex = t37.innerText, r.label = t37.innerHTML), t37.hasAttribute("data-command"))
try {
r.command = JSON.parse(t37.dataset.command);
} catch (i) {
}
t37.id = e.registerKeycap(r);
}
if (!t37.innerHTML) {
let [i, n] = tn(r);
t37.innerHTML = globalThis.MathfieldElement.createHTML(i);
}
}
function Rf() {
Oe("virtual-keyboard"), Oe("core"), Qr();
}
function qm() {
Ve("core"), Ve("virtual-keyboard");
}
var If = `<svg xmlns="http://www.w3.org/2000/svg" style="display: none;">
<symbol id="svg-delete-backward" viewBox="0 0 576 512">
<path d="M432.1 208.1L385.9 256L432.1 303C442.3 312.4 442.3 327.6 432.1 336.1C423.6 346.3 408.4 346.3 399 336.1L352 289.9L304.1 336.1C295.6 346.3 280.4 346.3 271 336.1C261.7 327.6 261.7 312.4 271 303L318.1 256L271 208.1C261.7 199.6 261.7 184.4 271 175C280.4 165.7 295.6 165.7 304.1 175L352 222.1L399 175C408.4 165.7 423.6 165.7 432.1 175C442.3 184.4 442.3 199.6 432.1 208.1V208.1zM512 64C547.3 64 576 92.65 576 128V384C576 419.3 547.3 448 512 448H205.3C188.3 448 172 441.3 160 429.3L9.372 278.6C3.371 272.6 0 264.5 0 256C0 247.5 3.372 239.4 9.372 233.4L160 82.75C172 70.74 188.3 64 205.3 64L512 64zM528 128C528 119.2 520.8 112 512 112H205.3C201 112 196.9 113.7 193.9 116.7L54.63 256L193.9 395.3C196.9 398.3 201 400 205.3 400H512C520.8 400 528 392.8 528 384V128z"/>
</symbol>
<symbol id="svg-shift" viewBox="0 0 384 512">
<path d="M2.438 252.3C7.391 264.2 19.06 272 32 272h80v160c0 26.51 21.49 48 48 48h64C250.5 480 272 458.5 272 432v-160H352c12.94 0 24.61-7.797 29.56-19.75c4.953-11.97 2.219-25.72-6.938-34.88l-160-176C208.4 35.13 200.2 32 192 32S175.6 35.13 169.4 41.38l-160 176C.2188 226.5-2.516 240.3 2.438 252.3zM192 86.63L313.4 224H224v208H160V224H70.63L192 86.63z"/>
</symbol>
<symbol id="svg-commit" viewBox="0 0 512 512">
<path d="M135 432.1l-128-128C2.344 300.3 0 294.2 0 288s2.344-12.28 7.031-16.97l128-128c9.375-9.375 24.56-9.375 33.94 0s9.375 24.56 0 33.94L81.94 264H464v-208C464 42.75 474.8 32 488 32S512 42.75 512 56V288c0 13.25-10.75 24-24 24H81.94l87.03 87.03c9.375 9.375 9.375 24.56 0 33.94S144.4 442.3 135 432.1z"/>
</symbol>
<symbol id="circle-plus" viewBox="0 0 512 512"><path d="M256 48a208 208 0 1 1 0 416 208 208 0 1 1 0-416zm0 464A256 256 0 1 0 256 0a256 256 0 1 0 0 512zM232 344c0 13.3 10.7 24 24 24s24-10.7 24-24V280h64c13.3 0 24-10.7 24-24s-10.7-24-24-24H280V168c0-13.3-10.7-24-24-24s-24 10.7-24 24v64H168c-13.3 0-24 10.7-24 24s10.7 24 24 24h64v64z"/></symbol>
<symbol id="svg-command" viewBox="0 0 640 512">
<path d="M34.495 36.465l211.051 211.05c4.686 4.686 4.686 12.284 0 16.971L34.495 475.535c-4.686 4.686-12.284 4.686-16.97 0l-7.071-7.07c-4.686-4.686-4.686-12.284 0-16.971L205.947 256 10.454 60.506c-4.686-4.686-4.686-12.284 0-16.971l7.071-7.07c4.686-4.687 12.284-4.687 16.97 0zM640 468v-10c0-6.627-5.373-12-12-12H300c-6.627 0-12 5.373-12 12v10c0 6.627 5.373 12 12 12h328c6.627 0 12-5.373 12-12z"/>
</symbol>
<symbol id="svg-undo" viewBox="0 0 512 512">
<path d="M20 8h10c6.627 0 12 5.373 12 12v110.625C85.196 57.047 165.239 7.715 256.793 8.001 393.18 8.428 504.213 120.009 504 256.396 503.786 393.181 392.834 504 256 504c-63.926 0-122.202-24.187-166.178-63.908-5.113-4.618-5.354-12.561-.482-17.433l7.069-7.069c4.503-4.503 11.749-4.714 16.482-.454C150.782 449.238 200.935 470 256 470c117.744 0 214-95.331 214-214 0-117.744-95.331-214-214-214-82.862 0-154.737 47.077-190.289 116H180c6.627 0 12 5.373 12 12v10c0 6.627-5.373 12-12 12H20c-6.627 0-12-5.373-12-12V20c0-6.627 5.373-12 12-12z"/>
</symbol>
<symbol id="svg-redo" viewBox="0 0 512 512">
<path d="M492 8h-10c-6.627 0-12 5.373-12 12v110.625C426.804 57.047 346.761 7.715 255.207 8.001 118.82 8.428 7.787 120.009 8 256.396 8.214 393.181 119.166 504 256 504c63.926 0 122.202-24.187 166.178-63.908 5.113-4.618 5.354-12.561.482-17.433l-7.069-7.069c-4.503-4.503-11.749-4.714-16.482-.454C361.218 449.238 311.065 470 256 470c-117.744 0-214-95.331-214-214 0-117.744 95.331-214 214-214 82.862 0 154.737 47.077 190.289 116H332c-6.627 0-12 5.373-12 12v10c0 6.627 5.373 12 12 12h160c6.627 0 12-5.373 12-12V20c0-6.627-5.373-12-12-12z"/>
</symbol>
<symbol id="svg-arrow-left" viewBox="0 0 320 512">
<path d="M206.7 464.6l-183.1-191.1C18.22 267.1 16 261.1 16 256s2.219-11.97 6.688-16.59l183.1-191.1c9.152-9.594 24.34-9.906 33.9-.7187c9.625 9.125 9.938 24.37 .7187 33.91L73.24 256l168 175.4c9.219 9.5 8.906 24.78-.7187 33.91C231 474.5 215.8 474.2 206.7 464.6z"/>
</symbol>
<symbol id="svg-arrow-right" viewBox="0 0 320 512">
<path d="M113.3 47.41l183.1 191.1c4.469 4.625 6.688 10.62 6.688 16.59s-2.219 11.97-6.688 16.59l-183.1 191.1c-9.152 9.594-24.34 9.906-33.9 .7187c-9.625-9.125-9.938-24.38-.7187-33.91l168-175.4L78.71 80.6c-9.219-9.5-8.906-24.78 .7187-33.91C88.99 37.5 104.2 37.82 113.3 47.41z"/>
</symbol>
<symbol id="svg-tab" viewBox="0 0 448 512">
<path d="M32 217.1c0-8.8 7.2-16 16-16h144v-93.9c0-7.1 8.6-10.7 13.6-5.7l143.5 143.1c6.3 6.3 6.3 16.4 0 22.7L205.6 410.4c-5 5-13.6 1.5-13.6-5.7v-93.9H48c-8.8 0-16-7.2-16-16v-77.7m-32 0v77.7c0 26.5 21.5 48 48 48h112v61.9c0 35.5 43 53.5 68.2 28.3l143.6-143c18.8-18.8 18.8-49.2 0-68L228.2 78.9c-25.1-25.1-68.2-7.3-68.2 28.3v61.9H48c-26.5 0-48 21.6-48 48zM436 64h-8c-6.6 0-12 5.4-12 12v360c0 6.6 5.4 12 12 12h8c6.6 0 12-5.4 12-12V76c0-6.6-5.4-12-12-12z"/>
</symbol>
<symbol id="svg-paste" viewBox="0 0 512 512"><path d="M160 32c11.6 0 21.3 8.2 23.5 19.2C185 58.6 191.6 64 199.2 64H208c8.8 0 16 7.2 16 16V96H96V80c0-8.8 7.2-16 16-16h8.8c7.6 0 14.2-5.4 15.7-12.8C138.7 40.2 148.4 32 160 32zM64 64h2.7C65 69 64 74.4 64 80V96c0 17.7 14.3 32 32 32H224c17.7 0 32-14.3 32-32V80c0-5.6-1-11-2.7-16H256c17.7 0 32 14.3 32 32h32c0-35.3-28.7-64-64-64H210.6c-9-18.9-28.3-32-50.6-32s-41.6 13.1-50.6 32H64C28.7 32 0 60.7 0 96V384c0 35.3 28.7 64 64 64H192V416H64c-17.7 0-32-14.3-32-32V96c0-17.7 14.3-32 32-32zM288 480c-17.7 0-32-14.3-32-32V192c0-17.7 14.3-32 32-32h96v56c0 22.1 17.9 40 40 40h56V448c0 17.7-14.3 32-32 32H288zM416 165.3L474.7 224H424c-4.4 0-8-3.6-8-8V165.3zM448 512c35.3 0 64-28.7 64-64V235.9c0-12.7-5.1-24.9-14.1-33.9l-59.9-59.9c-9-9-21.2-14.1-33.9-14.1H288c-35.3 0-64 28.7-64 64V448c0 35.3 28.7 64 64 64H448z"/></symbol>
<symbol id="svg-cut" viewBox="0 0 512 512"><path d="M485.6 444.2L333.6 314.9C326.9 309.2 326.1 299.1 331.8 292.4C337.5 285.6 347.6 284.8 354.4 290.5L506.4 419.8C513.1 425.5 513.9 435.6 508.2 442.4C502.5 449.1 492.4 449.9 485.6 444.2zM485.7 67.76C492.5 62.07 502.5 62.94 508.2 69.69C513.9 76.45 513.1 86.55 506.3 92.24L208.5 343.1C218.3 359.7 224 379.2 224 400C224 461.9 173.9 512 112 512C50.14 512 0 461.9 0 400C0 338.1 50.14 288 112 288C141.5 288 168.4 299.4 188.4 318.1L262.2 256L188.4 193.9C168.4 212.6 141.5 224 112 224C50.14 224 0 173.9 0 112C0 50.14 50.14 0 112 0C173.9 0 224 50.14 224 112C224 132.8 218.3 152.3 208.5 168.9L287 235.1L485.7 67.76zM32 112C32 156.2 67.82 192 112 192C156.2 192 192 156.2 192 112C192 67.82 156.2 32 112 32C67.82 32 32 67.82 32 112zM112 480C156.2 480 192 444.2 192 400C192 355.8 156.2 320 112 320C67.82 320 32 355.8 32 400C32 444.2 67.82 480 112 480z"/></symbol>
<symbol id="svg-copy" viewBox="0 0 512 512"><path d="M272 416C263.2 416 256 423.2 256 432V448c0 17.67-14.33 32-32 32H64c-17.67 0-32-14.33-32-32V192c0-17.67 14.33-32 32-32h112C184.8 160 192 152.8 192 144C192 135.2 184.8 128 176 128H63.99c-35.35 0-64 28.65-64 64l.0098 256C0 483.3 28.65 512 64 512h160c35.35 0 64-28.65 64-64v-16C288 423.2 280.8 416 272 416zM502.6 86.63l-77.25-77.25C419.4 3.371 411.2 0 402.7 0H288C252.7 0 224 28.65 224 64v256c0 35.35 28.65 64 64 64h160c35.35 0 64-28.65 64-64V109.3C512 100.8 508.6 92.63 502.6 86.63zM416 45.25L466.7 96H416V45.25zM480 320c0 17.67-14.33 32-32 32h-160c-17.67 0-32-14.33-32-32V64c0-17.67 14.33-32 32-32h96l.0026 64c0 17.67 14.33 32 32 32H480V320z"/>
</symbol>
<symbol id="svg-angle-double-right" viewBox="0 0 512 512"><path d="M470.6 278.6c12.5-12.5 12.5-32.8 0-45.3l-160-160c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3L402.7 256 265.4 393.4c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0l160-160zm-352 160l160-160c12.5-12.5 12.5-32.8 0-45.3l-160-160c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3L210.7 256 73.4 393.4c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0z"/>
</symbol>
<symbol id="svg-angle-double-left" viewBox="0 0 512 512"><path d="M41.4 233.4c-12.5 12.5-12.5 32.8 0 45.3l160 160c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L109.3 256 246.6 118.6c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0l-160 160zm352-160l-160 160c-12.5 12.5-12.5 32.8 0 45.3l160 160c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L301.3 256 438.6 118.6c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0z"/>
</symbol>
<symbol id="svg-trash" viewBox="0 0 448 512">
<path d="M336 64l-33.6-44.8C293.3 7.1 279.1 0 264 0h-80c-15.1 0-29.3 7.1-38.4 19.2L112 64H24C10.7 64 0 74.7 0 88v2c0 3.3 2.7 6 6 6h26v368c0 26.5 21.5 48 48 48h288c26.5 0 48-21.5 48-48V96h26c3.3 0 6-2.7 6-6v-2c0-13.3-10.7-24-24-24h-88zM184 32h80c5 0 9.8 2.4 12.8 6.4L296 64H152l19.2-25.6c3-4 7.8-6.4 12.8-6.4zm200 432c0 8.8-7.2 16-16 16H80c-8.8 0-16-7.2-16-16V96h320v368zm-176-44V156c0-6.6 5.4-12 12-12h8c6.6 0 12 5.4 12 12v264c0 6.6-5.4 12-12 12h-8c-6.6 0-12-5.4-12-12zm-80 0V156c0-6.6 5.4-12 12-12h8c6.6 0 12 5.4 12 12v264c0 6.6-5.4 12-12 12h-8c-6.6 0-12-5.4-12-12zm160 0V156c0-6.6 5.4-12 12-12h8c6.6 0 12 5.4 12 12v264c0 6.6-5.4 12-12 12h-8c-6.6 0-12-5.4-12-12z"/>
</symbol>
<symbol id="svg-keyboard-down" viewBox="0 0 576 512"><path d="M64 48c-8.8 0-16 7.2-16 16V240c0 8.8 7.2 16 16 16H512c8.8 0 16-7.2 16-16V64c0-8.8-7.2-16-16-16H64zM0 64C0 28.7 28.7 0 64 0H512c35.3 0 64 28.7 64 64V240c0 35.3-28.7 64-64 64H64c-35.3 0-64-28.7-64-64V64zM159 359c9.4-9.4 24.6-9.4 33.9 0l95 95 95-95c9.4-9.4 24.6-9.4 33.9 0s9.4 24.6 0 33.9L305 505c-4.5 4.5-10.6 7-17 7s-12.5-2.5-17-7L159 393c-9.4-9.4-9.4-24.6 0-33.9zm1-167c0-8.8 7.2-16 16-16H400c8.8 0 16 7.2 16 16v16c0 8.8-7.2 16-16 16H176c-8.8 0-16-7.2-16-16V192zM120 88h16c8.8 0 16 7.2 16 16v16c0 8.8-7.2 16-16 16H120c-8.8 0-16-7.2-16-16V104c0-8.8 7.2-16 16-16zm64 16c0-8.8 7.2-16 16-16h16c8.8 0 16 7.2 16 16v16c0 8.8-7.2 16-16 16H200c-8.8 0-16-7.2-16-16V104zm96-16h16c8.8 0 16 7.2 16 16v16c0 8.8-7.2 16-16 16H280c-8.8 0-16-7.2-16-16V104c0-8.8 7.2-16 16-16zm64 16c0-8.8 7.2-16 16-16h16c8.8 0 16 7.2 16 16v16c0 8.8-7.2 16-16 16H360c-8.8 0-16-7.2-16-16V104zm96-16h16c8.8 0 16 7.2 16 16v16c0 8.8-7.2 16-16 16H440c-8.8 0-16-7.2-16-16V104c0-8.8 7.2-16 16-16z"/></symbol>
</svg>`;
function Hm(t37) {
t37.resetKeycapRegistry(), Rf();
let e = document.createElement("div");
e.className = "ML__keyboard";
let r = document.createElement("div");
r.className = "MLK__plate", r.innerHTML = globalThis.MathfieldElement.createHTML(If + t37.normalizedLayouts.map((a, s) => zf(t37, a, s)).join(""));
let i = document.createElement("div");
i.className = "MLK__backdrop", i.appendChild(r), e.appendChild(i), e.addEventListener("pointerdown", Ff, { passive: false });
let n = e.querySelectorAll(".ML__edit-toolbar");
if (n)
for (let a of n)
a.addEventListener("click", (s) => {
var u, d;
let l = s.target, c = "";
for (; l && !c; )
c = (u = l == null ? void 0 : l.getAttribute("data-command")) != null ? u : "", l = (d = l == null ? void 0 : l.parentElement) != null ? d : null;
c && t37.executeCommand(JSON.parse(c));
});
Of(e.querySelectorAll(".MLK__keycap, .action, .fnbutton, .bigfnbutton"));
let o = e.querySelectorAll(".MLK__layer");
o.length > 0;
for (let a of o)
a.addEventListener("pointerdown", (s) => s.preventDefault());
return t37.currentLayer = t37.latentLayer, e;
}
function zf(t37, e, r) {
let i = [];
if (!("layers" in e))
return "";
for (let n of e.layers)
i.push(`<div tabindex="-1" class="MLK__layer" id="${n.id}">`), (t37.normalizedLayouts.length > 1 || e.displayEditToolbar) && (i.push("<div class='MLK__toolbar' role='toolbar'>"), i.push(Bf(t37, r)), e.displayEditToolbar && i.push('<div class="ML__edit-toolbar right"></div>'), i.push("</div>")), i.push(Nf(t37, n)), i.push("</div>");
return i.join("");
}
function Nf(t37, e) {
if (typeof e == "string")
return e;
let r = "";
if (typeof e.style == "string" ? r += `<style>${e.style}</style>` : typeof e.style == "object" && (r += `<style>${Df(e.style)}</style>`), e.backdrop && (r += `<div class='${e.backdrop}'>`), e.container && (r += `<div class='${e.container}'>`), e.rows) {
r += "<div class=MLK__rows>";
for (let i of e.rows) {
r += '<div dir="ltr" class=MLK__row>';
for (let n of i)
if (n) {
let o = t37.registerKeycap(n), [a, s] = tn(n);
/(^|\s)separator/.test(s) ? r += `<div class="${s}"` : r += `<div tabindex="-1" id="${o}" class="${s}"`, n.tooltip && (r += ` data-tooltip="${n.tooltip}"`), r += `>${a}</div>`;
}
r += "</div>";
}
r += "</div>";
} else
e.markup && (r += e.markup);
return e.container && (r += "</div>"), e.backdrop && (r += "</div>"), r;
}
function tn(t37, e = { shifted: false }) {
var n, o, a, s, l, c, u;
let r = "", i = (n = t37.class) != null ? n : "";
if (e.shifted && rn(t37) && (i += " is-active"), e.shifted && "shift" in t37)
typeof t37.shift == "string" ? r = Yn(t37.shift) : typeof t37.shift == "object" && (r = t37.shift.label ? t37.shift.label : (o = Yn(t37.shift.latex || t37.shift.insert || "") || t37.shift.key) != null ? o : ""), typeof t37.shift == "object" && (i = (s = (a = t37.shift.class) != null ? a : t37.class) != null ? s : "");
else {
if (r = t37.label ? t37.label : (l = Yn(t37.latex || t37.insert || "") || t37.key) != null ? l : "", t37.shift) {
let d;
typeof t37.shift == "string" ? d = Yn(t37.shift) : t37.shift.label ? d = t37.shift.label : d = (c = Yn(t37.shift.latex || t37.shift.insert || "") || t37.shift.key) != null ? c : "", r += `<span class="MLK__shift">${d}</span>`;
}
t37.aside && (r += `<aside>${t37.aside}</aside>`);
}
return t37.layer && !/layer-switch/.test(i) && (i += " layer-switch"), /(^|\s)(separator|action|shift|fnbutton|bigfnbutton)($|\s)/.test(i) || (i += " MLK__keycap"), !/\bw[0-9]+\b/.test(i) && t37.width && (i += (u = { 0: " w0", 0.5: " w5", 1.5: " w15", 2: " w20", 5: " w50" }[t37.width]) != null ? u : ""), [r, i || "MLK__keycap"];
}
var ii = { "[left]": { class: "action hide-shift", label: "<svg class=svg-glyph><use xlink:href=#svg-arrow-left /></svg>", command: "performWithFeedback(moveToPreviousChar)", shift: { label: "<svg class=svg-glyph><use xlink:href=#svg-angle-double-left /></svg>", command: "performWithFeedback(extendSelectionBackward)" } }, "[right]": { class: "action hide-shift", label: "<svg class=svg-glyph><use xlink:href=#svg-arrow-right /></svg>", command: "performWithFeedback(moveToNextChar)", shift: { label: "<svg class=svg-glyph><use xlink:href=#svg-angle-double-right /></svg>", command: "performWithFeedback(extendSelectionForward)" } }, "[up]": { class: "action hide-shift", label: "\u2191", command: "performWithFeedback(moveUp)", shift: { label: "\u219F", command: "performWithFeedback(extendSelectionUpward)" } }, "[down]": { class: "action hide-shift", label: "\u2193", command: "performWithFeedback(moveDown)", shift: { label: "\u21A1", command: "performWithFeedback(extendSelectionDownward)" } }, "[return]": { class: "action hide-shift", command: "performWithFeedback(commit)", shift: { command: "performWithFeedback(addRowAfter)" }, width: 1.5, label: "<svg class=svg-glyph><use xlink:href=#svg-commit /></svg>" }, "[action]": { class: "action hide-shift", command: "performWithFeedback(commit)", shift: { label: "<svg class=svg-glyph><use xlink:href=#circle-plus /></svg>", command: "performWithFeedback(addRowAfter)" }, width: 1.5, label: "<svg class=svg-glyph><use xlink:href=#svg-commit /></svg>" }, "[hr]": { class: "separator horizontal-rule" }, "[hide-keyboard]": { class: "action", command: ["hideVirtualKeyboard"], width: 1.5, label: "<svg class=svg-glyph-lg><use xlink:href=#svg-keyboard-down /></svg>" }, "[.]": { variants: ".", command: "performWithFeedback(insertDecimalSeparator)", shift: ",", class: "big-op hide-shift", label: "." }, "[,]": { variants: ",", command: "performWithFeedback(insertDecimalSeparator)", shift: ".", class: "big-op hide-shift", label: "," }, "[+]": { variants: [{ latex: "\\sum_{#0}^{#0}", class: "small" }, "\\oplus"], latex: "+", label: "+", class: "big-op hide-shift", shift: { latex: "\\sum", insert: "\\sum", class: "small" } }, "[-]": { variants: ["\\pm", "\\ominus"], latex: "-", label: "&#x2212;", shift: "\\pm", class: "big-op hide-shift" }, "[/]": { class: "big-op hide-shift", shift: { class: "", latex: "\\frac{1}{#@}" }, variants: ["/", "\\div", "\\%", "\\oslash"], latex: "\\frac{#@}{#?}", label: "&divide;" }, "[*]": { variants: [{ latex: "\\prod_{#0}^{#0}", class: "small" }, "\\otimes", "\\cdot"], latex: "\\cdot", label: "&times;", shift: { latex: "\\times" }, class: "big-op hide-shift" }, "[=]": { variants: ["\\neq", "\\equiv", "\\varpropto", "\\thickapprox", "\\lt", "\\gt", "\\le", "\\ge"], latex: "=", label: "=", shift: { label: "\u2260", latex: "\\ne" }, class: "big-op hide-shift" }, "[backspace]": { class: "action bottom right hide-shift", width: 1.5, command: "performWithFeedback(deleteBackward)", label: "<svg class=svg-glyph><use xlink:href=#svg-delete-backward /></svg>", shift: { class: "action warning", label: "<svg class=svg-glyph><use xlink:href=#svg-trash /></svg>", command: "deleteAll" } }, "[undo]": { class: "ghost if-can-undo", command: "undo", label: "<svg class=svg-glyph><use xlink:href=#svg-undo /></svg>", tooltip: "tooltip.undo" }, "[redo]": { class: "ghost if-can-redo", command: "redo", label: "<svg class=svg-glyph><use xlink:href=#svg-redo /></svg>", tooltip: "tooltip.redo" }, "[(]": { variants: [{ latex: "\\lbrack", key: "[" }, "\\langle", "\\lfloor", "\\lceil", { latex: "\\lbrace", key: "{" }], key: "(", label: "(", shift: { label: "[", key: "[" }, class: "hide-shift" }, "[)]": { variants: [{ latex: "\\rbrack", key: "]" }, "\\rangle", "\\rfloor", "\\rceil", { latex: "\\rbrace", key: "]" }], key: ")", label: ")", shift: { label: "]", latex: "\\rbrack" }, class: "hide-shift" }, "[0]": { variants: "0", latex: "0", label: "0", shift: "\\infty", class: "hide-shift" }, "[1]": { variants: "1", latex: "1", label: "1", shift: "#@^{-1}", class: "hide-shift" }, "[2]": { variants: "2", latex: "2", label: "2", shift: "#@^2", class: "hide-shift" }, "[3]": { variants: "3", latex: "3", label: "3", shift: "#@^3", class: "hide-shift" }, "[4]": { variants: "4", latex: "4", label: "4", shift: "#@^4", class: "hide-shift" }, "[5]": { variants: "5", latex: "5", label: "5", shift: "#@^5", class: "hide-shift" }, "[6]": { variants: "6", latex: "6", label: "6", shift: "#@^6", class: "hide-shift" }, "[7]": { variants: "7", latex: "7", label: "7", shift: "#@^7", class: "hide-shift" }, "[8]": { variants: "8", latex: "8", label: "8", shift: "#@^8", class: "hide-shift" }, "[9]": { variants: "9", latex: "9", label: "9", shift: "#@^9", class: "hide-shift" }, "[separator-5]": { class: "separator", width: 0.5 }, "[separator]": { class: "separator" }, "[separator-10]": { class: "separator" }, "[separator-15]": { class: "separator", width: 1.5 }, "[separator-20]": { class: "separator", width: 2 }, "[separator-50]": { class: "separator", width: 5 }, "[shift]": { class: "shift bottom left", width: 1.5, label: "<span class=caps-lock-indicator></span><svg class=svg-glyph><use xlink:href=#svg-shift /></svg>" }, "[foreground-color]": { variants: "foreground-color", command: ["applyStyle", { color: "red" }], label: "<span style='border-radius: 50%;width:22px;height:22px; border: 3px solid #cc2428; box-sizing: border-box'>" }, "[background-color]": { variants: "background-color", command: ["applyStyle", { backgroundColor: "yellow" }], label: "<span style='border-radius: 50%;width:22px;height:22px; background:#fff590; box-sizing: border-box'></span>" } };
function Nl(t37) {
var r;
if (typeof t37 == "string") {
if (t37 === "[.]" && globalThis.MathfieldElement.decimalSeparator === "," && (t37 = "[,]"), !ii[t37])
return { latex: t37 };
t37 = { label: t37 };
}
let e;
return "label" in t37 && t37.label && ii[t37.label] && (e = g(p(p({}, ii[t37.label]), t37), { label: ii[t37.label].label })), "key" in t37 && t37.key && ii[t37.key] && (e = g(p(p({}, ii[t37.key]), t37), { key: ii[t37.key].key })), e ? (e.command === "insertDecimalSeparator" && (e.label = (r = globalThis.MathfieldElement.decimalSeparator) != null ? r : "."), t37.label === "[action]" && (e = p(p({}, e), window.mathVirtualKeyboard.actionKeycap)), t37.label === "[shift]" && (e = p(p({}, e), window.mathVirtualKeyboard.shiftKeycap)), t37.label === "[backspace]" && (e = p(p({}, e), window.mathVirtualKeyboard.backspaceKeycap)), t37.label === "[tab]" && (e = p(p({}, e), window.mathVirtualKeyboard.tabKeycap)), (e.tooltip === void 0 || e.tooltip === null || e.tooltip === false) && delete e.tooltip, (e.tooltip === void 0 || e.tooltip === null || e.tooltip === false) && delete e.tooltip, (e.aside === void 0 || e.aside === null || e.aside === false) && delete e.aside, (e.variants === void 0 || e.variants === null || e.variants === false) && delete e.variants, (e.shift === void 0 || e.shift === null || e.shift === false) && delete e.shift, e) : t37;
}
var eo;
function Ff(t37) {
var s;
if (t37.button !== 0)
return;
let e = we.singleton;
if (!e)
return;
let r = t37.target;
for (; r && !r.getAttribute("data-layer"); )
r = r.parentElement;
if (r) {
e.currentLayer = (s = r.getAttribute("data-layer")) != null ? s : "", t37.preventDefault();
return;
}
let i = ti(t37.target);
if (!(i != null && i.id))
return;
let n = e.getKeycap(i.id);
if (!n)
return;
t37.type;
let o = new AbortController(), a = o.signal;
i.classList.add("is-pressed"), i.addEventListener("pointerenter", qa(o), { capture: true, signal: a }), i.addEventListener("pointerleave", qa(o), { capture: true, signal: a }), i.addEventListener("pointercancel", qa(o), { signal: a }), i.addEventListener("pointerup", qa(o), { signal: a }), rn(n) && (i.classList.add("is-active"), e.shiftPressCount++), n.variants && (eo && clearTimeout(eo), eo = setTimeout(() => {
i.classList.contains("is-pressed") && (i.classList.remove("is-pressed"), i.classList.add("is-active"), t37.target && "releasePointerCapture" in t37.target && t37.target.releasePointerCapture(t37.pointerId), Fa(i, () => {
o.abort(), i == null || i.classList.remove("is-active");
}));
}, 300)), t37.preventDefault();
}
function qa(t37) {
return (e) => {
let r = ti(e.target);
if (!(r != null && r.id))
return;
let i = we.singleton;
if (!i)
return;
let n = i.getKeycap(r.id);
if (n) {
if (e.type === "pointerenter" && e.target === r && e.isPrimary && r.classList.add("is-pressed"), e.type === "pointercancel") {
r.classList.remove("is-pressed"), rn(n) && (i.shiftPressCount--, r.classList.toggle("is-active", i.isShifted)), t37.abort();
return;
}
if (e.type === "pointerleave" && e.target === r) {
r.classList.remove("is-pressed"), rn(n) && (i.shiftPressCount--, r.classList.toggle("is-active", i.isShifted));
return;
}
if (e.type === "pointerup") {
eo && clearTimeout(eo), rn(n) ? r.classList.toggle("is-active", i.isShifted) : r.classList.contains("is-pressed") && (r.classList.remove("is-pressed"), i.isShifted && n.shift ? typeof n.shift == "string" ? i.executeCommand(["insert", n.shift, { focus: true, feedback: true, scrollIntoView: true, mode: "math", format: "latex" }]) : Va(n.shift) : Va(n), i.shiftPressCount === 1 && !e.shiftKey && (i.shiftPressCount = 0)), t37.abort(), e.preventDefault();
return;
}
}
};
}
function Va(t37) {
var r;
let e = t37.command;
!e && t37.insert && (e = ["insert", t37.insert, { focus: true, feedback: true, scrollIntoView: true, mode: "math", format: "latex" }]), !e && t37.key && (e = ["typedText", t37.key, { focus: true, feedback: true, simulateKeystroke: true }]), !e && t37.latex && (e = ["insert", t37.latex, { focus: true, feedback: true, scrollIntoView: true, mode: "math", format: "latex" }]), e || (e = ["typedText", t37.label, { focus: true, feedback: true, simulateKeystroke: true }]), (r = we.singleton) == null || r.executeCommand(e);
}
function $f(t37) {
if (t37.nodeType !== 1)
return false;
let e = t37.classList;
return e.contains("MLK__keycap") || e.contains("shift") || e.contains("action") || e.contains("fnbutton") || e.contains("bigfnbutton");
}
function ti(t37) {
if (!t37)
return;
let e = t37;
for (; e && !$f(e); )
e = e.parentElement;
return e != null ? e : void 0;
}
function rn(t37) {
return !!t37.class && /(^|\s)shift($|\s)/.test(t37.class);
}
var we = class t34 {
constructor() {
this.originalContainerBottomPadding = null;
this.keycapRegistry = {};
this._shiftPressCount = 0;
var e;
this.targetOrigin = window.origin, this.originValidator = "none", this._alphabeticLayout = "auto", this._layouts = Object.freeze(["default"]), this._editToolbar = "default", this._container = void 0, this._visible = false, this._rebuilding = false, this.observer = new ResizeObserver((r) => {
this.adjustBoundingRect(), this.dispatchEvent(new Event("geometrychange")), this.sendMessage("geometry-changed", { boundingRect: this.boundingRect });
}), this.listeners = {};
try {
(e = window.top) == null || e.addEventListener("message", this);
} catch (r) {
window.addEventListener("message", this);
}
document.addEventListener("focusin", (r) => {
let i = r.target;
i != null && i.isConnected && setTimeout(() => {
let n = Wm();
n && !n.readOnly && n.mathVirtualKeyboardPolicy === "auto" && go() && this.show({ animate: true });
}, 300);
}), document.addEventListener("focusout", (r) => {
r.target instanceof ct && r.target.mathVirtualKeyboardPolicy !== "manual" && setTimeout(() => {
Wm() || this.hide();
}, 300);
});
}
get currentLayer() {
var e, r, i;
return (i = (r = (e = this._element) == null ? void 0 : e.querySelector(".MLK__layer.is-visible")) == null ? void 0 : r.id) != null ? i : "";
}
set currentLayer(e) {
var i;
if (!this._element) {
this.latentLayer = e;
return;
}
let r = e ? this._element.querySelector(`#${e}.MLK__layer`) : null;
r || (r = this._element.querySelector(".MLK__layer")), r && ((i = this._element.querySelector(".MLK__layer.is-visible")) == null || i.classList.remove("is-visible"), r.classList.add("is-visible")), this.render();
}
get shiftPressCount() {
return this._shiftPressCount;
}
set shiftPressCount(e) {
var r;
this._shiftPressCount = e > 2 || e < 0 ? 0 : e, (r = this._element) == null || r.classList.toggle("is-caps-lock", this.shiftPressCount === 2), this.render();
}
get isShifted() {
return this._shiftPressCount > 0;
}
resetKeycapRegistry() {
this.keycapRegistry = {};
}
registerKeycap(e) {
let r = "ML__k" + Date.now().toString(36).slice(-2) + Math.floor(Math.random() * 1e5).toString(36);
return this.keycapRegistry[r] = e, r;
}
getKeycap(e) {
return e ? this.keycapRegistry[e] : void 0;
}
getLayer(e) {
let r = this.normalizedLayouts;
for (let i of r)
for (let n of i.layers)
if (n.id === e)
return n;
}
get alphabeticLayout() {
return this._alphabeticLayout;
}
set alphabeticLayout(e) {
this._alphabeticLayout = e, this.rebuild();
}
get actionKeycap() {
return this._actionKeycap;
}
set actionKeycap(e) {
this._actionKeycap = typeof e == "string" ? { label: e } : e;
}
get shiftKeycap() {
return this._shiftKeycap;
}
set shiftKeycap(e) {
this._shiftKeycap = typeof e == "string" ? { label: e } : e;
}
get backspaceKeycap() {
return this._backspaceKeycap;
}
set backspaceKeycap(e) {
this._backspaceKeycap = typeof e == "string" ? { label: e } : e;
}
get tabKeycap() {
return this._tabKeycap;
}
set tabKeycap(e) {
this._tabKeycap = typeof e == "string" ? { label: e } : e;
}
get layouts() {
return this._layouts;
}
set layouts(e) {
this.updateNormalizedLayouts(e), this.rebuild();
}
updateNormalizedLayouts(e) {
let r = Array.isArray(e) ? [...e] : [e], i = r.findIndex((n) => n === "default");
i >= 0 && r.splice(i, 1, "numeric", "symbols", "alphabetic", "greek"), this._layouts = Object.freeze(r), this._normalizedLayouts = r.map((n) => Fl(n));
}
get normalizedLayouts() {
return this._normalizedLayouts || this.updateNormalizedLayouts(this._layouts), this._normalizedLayouts;
}
get editToolbar() {
return this._editToolbar;
}
set editToolbar(e) {
this._editToolbar = e, this.rebuild();
}
get container() {
return this._container === void 0 ? window.document.body : this._container;
}
set container(e) {
this._container = e, this.rebuild();
}
static get singleton() {
if (this._singleton === void 0)
try {
this._singleton = new t34();
} catch (e) {
this._singleton = null;
}
return this._singleton;
}
get style() {
return this._style;
}
addEventListener(e, r, i) {
this.listeners[e] || (this.listeners[e] = /* @__PURE__ */ new Set()), this.listeners[e].has(r) || this.listeners[e].add(r);
}
dispatchEvent(e) {
return !this.listeners[e.type] || this.listeners[e.type].size === 0 ? true : (this.listeners[e.type].forEach((r) => {
typeof r == "function" ? r(e) : r == null || r.handleEvent(e);
}), !e.defaultPrevented);
}
removeEventListener(e, r, i) {
this.listeners[e] && this.listeners[e].delete(r);
}
get element() {
return this._element;
}
set element(e) {
var r;
this._element !== e && ((r = this._element) == null || r.remove(), this._element = e);
}
get visible() {
return this._visible;
}
set visible(e) {
e ? this.show() : this.hide();
}
get boundingRect() {
var r;
if (!this._visible)
return new DOMRect();
let e = (r = this._element) == null ? void 0 : r.getElementsByClassName("MLK__plate")[0];
return e ? e.getBoundingClientRect() : new DOMRect();
}
adjustBoundingRect() {
var r, i;
let e = this.boundingRect.height;
if (this.container === document.body) {
(r = this._element) == null || r.style.setProperty("--_keyboard-height", `calc(${e}px + var(--_padding-top) + var(--_padding-bottom) + env(safe-area-inset-bottom, 0))`);
let n = e - 1;
this.container.style.paddingBottom = this.originalContainerBottomPadding ? `calc(${this.originalContainerBottomPadding} + ${n}px)` : `${n}px`;
} else
(i = this._element) == null || i.style.setProperty("--_keyboard-height", `${e}px`);
}
rebuild() {
if (this._rebuilding || !this._element)
return;
this._rebuilding = true;
let e = this.currentLayer;
requestAnimationFrame(() => {
this._rebuilding = false, this._element && (this._element.remove(), this._element = void 0), this.visible && (this.buildAndAttachElement(), this.currentLayer = e, this.render(), this.adjustBoundingRect(), this._element.classList.add("is-visible"));
});
}
render() {
var n;
if (!this._element)
return;
let e = this.getLayer(this.currentLayer);
this._element.classList.toggle("backdrop-is-transparent", !!(e && (e.backdrop || e.container)));
let r = this._element.querySelectorAll(".MLK__layer.is-visible .MLK__keycap, .MLK__layer.is-visible .action, .fnbutton, .MLK__layer.is-visible .bigfnbutton, .MLK__layer.is-visible .shift");
if (!r)
return;
let i = this.isShifted;
for (let o of r) {
let a = this.getKeycap(o.id);
if (a) {
let [s, l] = tn(a, { shifted: i });
o.innerHTML = globalThis.MathfieldElement.createHTML(s), o.className = l, i && typeof a.shift == "object" && ((n = a.shift) != null && n.tooltip) ? o.dataset.tooltip = a.shift.tooltip : !i && a.tooltip && (o.dataset.tooltip = a.tooltip);
}
}
}
show(e) {
var i;
if (this._visible)
return;
let r = this.container;
if (r && window.mathVirtualKeyboard && this.stateWillChange(true)) {
if (this._element || (this.buildAndAttachElement(), this.adjustBoundingRect()), !this._visible) {
let n = this._element.getElementsByClassName("MLK__plate")[0];
if (n && this.observer.observe(n), r === window.document.body) {
let o = r.style.paddingBottom;
this.originalContainerBottomPadding = o;
let a = n.offsetHeight - 1;
r.style.paddingBottom = o ? `calc(${o} + ${a}px)` : `${a}px`;
}
window.addEventListener("mouseup", this), window.addEventListener("blur", this), window.addEventListener("keydown", this, { capture: true }), window.addEventListener("keyup", this, { capture: true }), (i = this._element) == null || i.classList.toggle("is-caps-lock", this.shiftPressCount === 2), this.currentLayer = this.latentLayer;
}
this._visible = true, e != null && e.animate ? requestAnimationFrame(() => {
this._element && (this._element.classList.add("animate"), this._element.addEventListener("transitionend", () => {
var n;
return (n = this._element) == null ? void 0 : n.classList.remove("animate");
}, { once: true }), this._element.classList.add("is-visible"), this.stateChanged());
}) : (this._element.classList.add("is-visible"), this.stateChanged());
}
}
hide(e) {
var i;
let r = this.container;
if (r && this._visible && this.stateWillChange(false)) {
if (this._visible = false, this._element) {
this.latentLayer = this.currentLayer;
let n = this._element.getElementsByClassName("MLK__plate")[0];
n && this.observer.unobserve(n), window.removeEventListener("mouseup", this), window.removeEventListener("blur", this), window.removeEventListener("keydown", this, { capture: true }), window.removeEventListener("keyup", this, { capture: true }), window.removeEventListener("contextmenu", this, { capture: true }), ri(), qm(), (i = this._element) == null || i.remove(), this._element = void 0, this.originalContainerBottomPadding !== null && (r.style.paddingBottom = this.originalContainerBottomPadding);
}
this.stateChanged();
}
}
get height() {
var e, r;
return (r = (e = this.element) == null ? void 0 : e.offsetHeight) != null ? r : 0;
}
buildAndAttachElement() {
var e;
this.element, this.element = Hm(this), window.addEventListener("contextmenu", this, { capture: true }), this.element.addEventListener("contextmenu", (r) => {
r.shiftKey || ((r.ctrlKey || r.button === 2) && Fa(r.target), r.preventDefault(), r.stopPropagation());
}, { capture: true }), (e = this.container) == null || e.appendChild(this.element);
}
handleEvent(e) {
if (Zn(e)) {
if (!Ii(e.origin, this.originValidator))
throw new DOMException(`Message from unknown origin (${e.origin}) cannot be handled`, "SecurityError");
e.data.action === "disconnect" ? this.connectedMathfieldWindow = void 0 : e.data.action !== "update-setting" && e.data.action !== "proxy-created" && e.data.action !== "execute-command" && (e.source, this.connectedMathfieldWindow = e.source), this.handleMessage(e.data, e.source);
}
if (this._element)
switch (e.type) {
case "mouseup":
case "blur":
document.body.style.userSelect = "", this.shiftPressCount = 0;
break;
case "contextmenu":
e.button !== 2 && e.preventDefault();
break;
case "keydown": {
e.key === "Shift" && !e.repeat && (this.shiftPressCount = 1);
break;
}
case "keyup": {
(e.key === "Shift" || !e.getModifierState("Shift") && this.shiftPressCount !== 2) && (this.shiftPressCount = 0);
break;
}
}
}
handleMessage(e, r) {
let { action: i } = e;
if (i === "execute-command") {
let { command: n } = e, o = Gt(n);
if (window.top !== void 0 && o !== "virtual-keyboard")
return;
this.executeCommand(n);
return;
}
if ((i === "connect" || i === "show") && this.sendMessage("synchronize-proxy", { boundingRect: this.boundingRect, alphabeticLayout: this._alphabeticLayout, layouts: this._layouts, editToolbar: this._editToolbar }, r), i !== "disconnect" && window === window.top) {
if (i === "show") {
typeof e.animate != "undefined" ? this.show({ animate: e.animate }) : this.show();
return;
}
if (i === "hide") {
typeof e.animate != "undefined" ? this.hide({ animate: e.animate }) : this.hide();
return;
}
if (i === "update-setting") {
e.alphabeticLayout && (this.alphabeticLayout = e.alphabeticLayout), e.layouts && (this.layouts = e.layouts), e.editToolbar && (this.editToolbar = e.editToolbar);
return;
}
if (i === "proxy-created") {
this.sendMessage("synchronize-proxy", { boundingRect: this.boundingRect, alphabeticLayout: this._alphabeticLayout, layouts: this._layouts, editToolbar: this._editToolbar }, r);
return;
}
}
}
sendMessage(e, r, i) {
if (i || (i = this.connectedMathfieldWindow), this.targetOrigin === null || this.targetOrigin === "null" || i === window) {
window.dispatchEvent(new MessageEvent("message", { source: window, data: p({ type: Xn, action: e }, r) }));
return;
}
if (i)
i.postMessage(p({ type: Xn, action: e }, r), { targetOrigin: this.targetOrigin });
else if (r.command && this.dispatchEvent(new CustomEvent("math-virtual-keyboard-command", { detail: r.command })), e === "execute-command" && Array.isArray(r.command) && r.command[0] === "insert") {
let n = r.command[1].split("");
for (let o of n)
this.dispatchEvent(new KeyboardEvent("keydown", { key: o, bubbles: true })), this.dispatchEvent(new KeyboardEvent("keyup", { key: o, bubbles: true }));
}
}
stateWillChange(e) {
return this.dispatchEvent(new CustomEvent("before-virtual-keyboard-toggle", { detail: { visible: e }, bubbles: true, cancelable: true, composed: true }));
}
stateChanged() {
this.dispatchEvent(new Event("virtual-keyboard-toggle")), this._visible || (this.dispatchEvent(new Event("geometrychange")), this.sendMessage("geometry-changed", { boundingRect: this.boundingRect }));
}
focus() {
this.sendMessage("focus", {});
}
blur() {
this.sendMessage("blur", {});
}
updateToolbar(e) {
let r = this._element;
if (!r)
return;
r.classList.toggle("is-math-mode", e.mode === "math"), r.classList.toggle("is-text-mode", e.mode === "text"), r.classList.toggle("can-undo", e.canUndo), r.classList.toggle("can-redo", e.canRedo), r.classList.toggle("can-copy", !e.selectionIsCollapsed), r.classList.toggle("can-copy", !e.selectionIsCollapsed), r.classList.toggle("can-paste", true);
let i = r.querySelectorAll(".ML__edit-toolbar");
if (i)
for (let n of i)
n.innerHTML = Vm(this, e);
}
update(e) {
this._style = e.style, this.updateToolbar(e);
}
connect() {
this.connectedMathfieldWindow = window;
}
disconnect() {
this.connectedMathfieldWindow = void 0;
}
executeCommand(e) {
if (e = ei(e), !e)
return false;
let r, i = [], n = Gt(e);
return X(e) ? (r = e[0], r === "performWithFeedback" && (n = Gt(e.slice(1))), i = e.slice(1)) : r = e, n === "virtual-keyboard" ? lt[r].fn(void 0, ...i) : (this.sendMessage("execute-command", { command: e }), false);
}
dispose() {
window.removeEventListener("mouseup", this), window.removeEventListener("blur", this), window.removeEventListener("message", this);
}
};
function Wm() {
let t37 = Xr(), e = null;
for (; t37; ) {
if ("host" in t37 && t37.host instanceof ct) {
e = t37.host;
break;
}
t37 = t37.parentNode;
}
return e;
}
if (fe() && !("mathVirtualKeyboard" in window))
if (window === window.top) {
let t37 = we.singleton;
Object.defineProperty(window, "mathVirtualKeyboard", { get: () => t37 });
} else
Object.defineProperty(window, "mathVirtualKeyboard", { get: () => jn.singleton, configurable: true });
function Vf(t37, e) {
t37.flushInlineShortcutBuffer(), t37.stopCoalescingUndo();
let r = Ha(t37, e), { model: i } = t37;
return i.selectionIsCollapsed ? (t37.defaultStyle.fontSeries && r.fontSeries === t37.defaultStyle.fontSeries && (r.fontSeries = "auto"), r.fontShape && r.fontShape === t37.defaultStyle.fontShape && (r.fontShape = "auto"), r.color && r.color === t37.defaultStyle.color && (r.color = "none"), r.backgroundColor && r.backgroundColor === t37.defaultStyle.backgroundColor && (r.backgroundColor = "none"), r.fontSize && r.fontSize === t37.defaultStyle.fontSize && (r.fontSize = "auto"), t37.defaultStyle = p(p({}, t37.defaultStyle), r)) : t37.model.deferNotifications({ content: true, type: "insertText" }, () => {
i.selection.ranges.forEach((n) => Vn(i, n, r, { operation: "toggle" })), t37.snapshot("style-change");
}), true;
}
ae({ applyStyle: Vf }, { target: "mathfield", canUndo: true, changeContent: true });
function Ha(t37, e) {
var n, o, a, s, l, c, u, d, m, h;
let r = {};
if (typeof e.color == "string") {
let f = (o = t37.colorMap((n = e.color) != null ? n : e.verbatimColor)) != null ? o : "none";
f !== e.color && (r.verbatimColor = (a = e.verbatimColor) != null ? a : e.color), r.color = f;
}
if (typeof e.backgroundColor == "string") {
let f = (l = t37.backgroundColorMap((s = e.backgroundColor) != null ? s : e.verbatimBackgroundColor)) != null ? l : "none";
f !== e.backgroundColor && (r.verbatimBackgroundColor = (c = e.verbatimBackgroundColor) != null ? c : e.backgroundColor), r.backgroundColor = f;
}
typeof e.fontFamily == "string" && (r.fontFamily = e.fontFamily), typeof e.series == "string" && (r.fontSeries = e.series), typeof e.fontSeries == "string" && (r.fontSeries = e.fontSeries.toLowerCase()), r.fontSeries && (r.fontSeries = (u = { bold: "b", medium: "m", normal: "m" }[r.fontSeries]) != null ? u : r.fontSeries), typeof e.shape == "string" && (r.fontShape = e.shape), typeof e.fontShape == "string" && (r.fontShape = e.fontShape.toLowerCase()), r.fontShape && (r.fontShape = (d = { italic: "it", up: "n", upright: "n", normal: "n" }[r.fontShape]) != null ? d : r.fontShape), e.variant && (r.variant = e.variant.toLowerCase()), e.variantStyle && (r.variantStyle = e.variantStyle.toLowerCase());
let i = (m = e.size) != null ? m : e.fontSize;
return typeof i == "number" ? r.fontSize = Math.max(1, Math.min(10, i)) : typeof i == "string" && (r.fontSize = (h = { size1: 1, size2: 2, size3: 3, size4: 4, size5: 5, size6: 6, size7: 7, size8: 8, size9: 9, size10: 10 }[i.toLowerCase()]) != null ? h : { tiny: 1, scriptsize: 2, footnotesize: 3, small: 4, normal: 5, normalsize: 5, large: 6, Large: 7, LARGE: 8, huge: 9, Huge: 10 }[i]), r;
}
function to(t37, e, r) {
let i = t37.model;
if (i.mode === "latex")
return {};
if (i.mode === "math") {
if (t37.styleBias === "none")
return t37.defaultStyle;
let n = i.at(e), o = t37.styleBias === "right" ? n.rightSibling : n;
if (!o)
return t37.defaultStyle;
if (o.type === "group") {
let a = o.branch("body");
return !a || a.length < 2 ? {} : t37.styleBias === "right" ? a[1].style : a[a.length - 1].style;
}
return o.style;
}
if (i.mode === "text") {
let n = i.at(r.before);
if (n)
return n.style;
}
return {};
}
function nn(t37) {
let e = t37.options.onInsertStyle;
if (e === null)
return {};
e === void 0 && (e = to);
let r = t37.model, i = r.at(r.position), n = i.type === "first" ? -1 : r.position, o = i ? r.offsetOf(i.rightSibling) : -1;
return e(t37, r.position, { before: n, after: o });
}
function on(t37) {
let e = {};
for (let r of Object.keys(t37))
switch (r) {
case "scriptDepth":
let i = t37.scriptDepth;
if (X(i))
e.scriptDepth = [i[0], i[1]];
else if (typeof i == "number")
e.scriptDepth = [i, i];
else if (typeof i == "string") {
let [o, a] = i.split(",").map((s) => parseInt(s.trim()));
e.scriptDepth = [o, a];
} else
throw new TypeError("Unexpected value for scriptDepth");
break;
case "mathVirtualKeyboardPolicy":
let n = t37.mathVirtualKeyboardPolicy.toLowerCase();
if (n === "sandboxed") {
if (window !== window.top) {
let o = we.singleton;
Object.defineProperty(window, "mathVirtualKeyboard", { get: () => o });
}
n = "manual";
}
e.mathVirtualKeyboardPolicy = n;
break;
case "letterShapeStyle":
t37.letterShapeStyle === "auto" ? O.locale.startsWith("fr") ? e.letterShapeStyle = "french" : e.letterShapeStyle = "tex" : e.letterShapeStyle = t37.letterShapeStyle;
break;
case "defaultMode":
["text", "math", "inline-math"].includes(t37.defaultMode) ? e.defaultMode = t37.defaultMode : (console.error('MathLive 0.100.0: valid values for defaultMode are "text", "math" or "inline-math"'), e.defaultMode = "math");
break;
case "macros":
e.macros = Mo(t37.macros);
break;
default:
X(t37[r]) ? e[r] = [...t37[r]] : typeof t37[r] == "object" && !(t37[r] instanceof Element) && r !== "computeEngine" ? e[r] = p({}, t37[r]) : e[r] = t37[r];
}
return e;
}
function jt(t37, e) {
let r;
typeof e == "string" ? r = [e] : e === void 0 ? r = Object.keys(t37) : r = e;
let i = {};
for (let n of r)
t37[n] === null ? i[n] = null : X(t37[n]) ? i[n] = [...t37[n]] : typeof t37[n] == "object" && !(t37[n] instanceof Element) && n !== "computeEngine" ? i[n] = p({}, t37[n]) : i[n] = t37[n];
return typeof e == "string" ? i[e] : i;
}
function an() {
return { readOnly: false, defaultMode: "math", macros: {}, registers: {}, colorMap: Tr, backgroundColorMap: gi, letterShapeStyle: O.locale.startsWith("fr") ? "french" : "tex", minFontScale: 0, maxMatrixCols: 10, smartMode: false, smartFence: true, smartSuperscript: true, scriptDepth: [1 / 0, 1 / 0], removeExtraneousParentheses: true, isImplicitFunction: (t37) => ["\\sin", "\\cos", "\\tan", "\\arcsin", "\\arccos", "\\arctan", "\\arcsec", "\\arccsc", "\\arsinh", "\\arcosh", "\\artanh", "\\arcsech", "\\arccsch", "\\arg", "\\ch", "\\cosec", "\\cosh", "\\cot", "\\cotg", "\\coth", "\\csc", "\\ctg", "\\cth", "\\sec", "\\sinh", "\\sh", "\\tanh", "\\tg", "\\th", "\\lg", "\\lb", "\\log", "\\ln"].includes(t37), mathModeSpace: "", placeholderSymbol: "\u25A2", contentPlaceholder: "", popoverPolicy: "auto", environmentPopoverPolicy: "off", keybindings: F0, inlineShortcuts: va, inlineShortcutTimeout: 0, mathVirtualKeyboardPolicy: "auto", virtualKeyboardTargetOrigin: window == null ? void 0 : window.origin, originValidator: "none", onInsertStyle: to, onInlineShortcut: () => "", onScrollIntoView: null, onExport: N0, value: "" };
}
function $l(t37) {
return t37.defaultMode === "inline-math" ? "math" : t37.defaultMode;
}
function Um(t37, e) {
let r = t37.at(t37.position);
if (r.type === "composition")
r.value = e;
else {
let { caret: i } = r;
r.caret = void 0;
let n = new $i(e, { mode: r.mode });
n.caret = i, r.parent.addChildAfter(n, r), t37.position += 1;
}
}
function Jm(t37) {
let e = t37.at(t37.position);
e.type === "composition" && (e.parent.removeChild(e), t37.position -= 1);
}
Cs(["math", "displaymath"], Re);
Cs("center", Re);
_("displaylines", "", { parse: (t37) => {
let e = [], r = [];
t37.beginContext({ tabular: true });
do {
if (t37.end() || t37.match("<}>"))
break;
t37.matchColumnSeparator() || t37.matchRowSeparator() ? (e.push([r]), r = []) : r.push(...t37.scan((i) => ["<}>", "&", "\\cr", "\\\\", "\\tabularnewline"].includes(i)));
} while (true);
return t37.endContext(), e.push([r]), e;
}, createAtom: (t37) => new N("lines", t37.args, [], { leftDelim: ".", rightDelim: ".", columns: [{ align: "l" }] }) });
bt("array", "{columns:colspec}", (t37, e, r, i) => new N(t37, Vl(e), r, { columns: i[0], mathstyleName: "textstyle" }));
bt(["equation", "equation*", "subequations"], "", (t37, e, r) => new N(t37, Vl(e), r, { columns: [{ align: "c" }] }));
bt(["multline", "multline*"], "", Re);
bt(["align", "align*", "aligned", "eqnarray"], "", Re);
bt("split", "", Re);
bt(["gather", "gather*", "gathered"], "", Re);
bt(["matrix", "pmatrix", "bmatrix", "Bmatrix", "vmatrix", "Vmatrix", "matrix*", "pmatrix*", "bmatrix*", "Bmatrix*", "vmatrix*", "Vmatrix*"], "[columns:colspec]", Re);
bt(["smallmatrix", "smallmatrix*"], "[columns:colspec]", Re);
bt(["cases", "dcases", "rcases"], "", Re);
function qf(t37) {
for (let e of t37)
for (let r of e)
if (r.length > 0)
return false;
return true;
}
function Vl(t37, e = 1) {
return qf(t37) ? Array(e).fill([[new y({ type: "first" }), new ge()]]) : t37.map((r) => r.length === 0 ? [[new y({ type: "first" })]] : r.map((i) => i.length === 0 ? [new y({ type: "first" })] : i[0].type === "first" ? i : [new y({ type: "first" }), ...i]));
}
function Re(t37, e = [[[]]], r = [], i = [], n) {
switch (e = Vl(e, ["split", "align", "align*", "aligned", "eqnarray"].includes(t37) ? 2 : 1), t37) {
case "math":
return new N(t37, e, r, { mathstyleName: "textstyle" });
case "displaymath":
return new N(t37, e, r, { mathstyleName: "textstyle" });
case "center":
return new N(t37, e, r, { columns: [{ align: "c" }] });
case "multline":
case "multline*":
return new N(t37, e, r, { columns: [{ align: "m" }], leftDelim: ".", rightDelim: "." });
case "split":
return new N(t37, e, r, { columns: [{ align: "r" }, { align: "l" }], minColumns: 2 });
case "gather":
case "gathered":
return new N(t37, e, r, { columns: [{ gap: 0.25 }, { align: "c" }, { gap: 0 }] });
case "pmatrix":
case "pmatrix*":
return new N(t37, e, r, { mathstyleName: "textstyle", leftDelim: "(", rightDelim: ")", columns: ni(i[0], n) });
case "bmatrix":
case "bmatrix*":
return new N(t37, e, r, { mathstyleName: "textstyle", leftDelim: "[", rightDelim: "]", columns: ni(i[0], n) });
case "Bmatrix":
case "Bmatrix*":
return new N(t37, e, r, { mathstyleName: "textstyle", leftDelim: "\\lbrace", rightDelim: "\\rbrace", columns: ni(i[0], n) });
case "vmatrix":
case "vmatrix*":
return new N(t37, e, r, { mathstyleName: "textstyle", leftDelim: "\\vert", rightDelim: "\\vert", columns: ni(i[0], n) });
case "Vmatrix":
case "Vmatrix*":
return new N(t37, e, r, { mathstyleName: "textstyle", leftDelim: "\\Vert", rightDelim: "\\Vert", columns: ni(i[0], n) });
case "matrix":
case "matrix*":
return new N(t37, e, r, { mathstyleName: "textstyle", leftDelim: ".", rightDelim: ".", columns: ni(i == null ? void 0 : i[0], n) });
case "smallmatrix":
case "smallmatrix*":
return new N(t37, e, r, { mathstyleName: "scriptstyle", columns: ni(i == null ? void 0 : i[0], n), colSeparationType: "small", arraystretch: 0.5 });
case "cases":
case "dcases":
return new N(t37, e, r, { mathstyleName: t37 === "dcases" ? "displaystyle" : "textstyle", arraystretch: 1.2, leftDelim: "\\lbrace", rightDelim: ".", columns: [{ align: "l" }, { gap: 1 }, { align: "l" }] });
case "rcases":
return new N(t37, e, r, { arraystretch: 1.2, leftDelim: ".", rightDelim: "\\rbrace", columns: [{ align: "l" }, { gap: 1 }, { align: "l" }] });
case "lines":
return new N(t37, e, r, { leftDelim: ".", rightDelim: ".", columns: [{ align: "l" }] });
case "align":
case "align*":
case "aligned":
case "eqnarray": {
let o = 0;
for (let l of e)
o = Math.max(o, l.length);
let a = [{ gap: 0 }, { align: "r" }, { gap: 0.25 }, { align: "l" }], s = 2;
for (; s < o; )
a.push({ gap: 1 }, { align: "r" }, { gap: 0.25 }, { align: "l" }), s += 2;
return a.push({ gap: 0 }), new N(t37, e, r, { arraycolsep: 0, columns: a, minColumns: 2 });
}
}
return new N(t37, e, r, { mathstyleName: "textstyle" });
}
function ni(t37, e = 10) {
return t37 != null ? t37 : Array(e).fill({ align: "c" });
}
function Hf(t37, e) {
let r = t37.at(t37.position);
for (; r && !(r.parent instanceof N); )
r = r.parent;
if (r && r.type === "array" && r.environmentName, !r || !(r.parent instanceof N)) {
let i = t37.at(t37.position);
if (r = i, !r.parent.parent) {
let n = t37.extractAtoms([t37.position, t37.lastOffset]), o = t37.extractAtoms([0, t37.position]);
o.length === 0 && (o = Ua()), n.length === 0 && (n = Ua());
let a;
return e.endsWith("column") ? (a = Re("split", [[o, n]]), t37.root = a, oi(a, 0, 0) ? ai(t37, a, 0, 0) : oi(a, 0, 1) ? ai(t37, a, 0, 1) : t37.position = t37.offsetOf(i)) : (a = Re("lines", [[o], [n]]), t37.root = a, oi(a, 0, 0) ? ai(t37, a, 0, 0) : oi(a, 1, 0) ? ai(t37, a, 1, 0) : t37.position = t37.offsetOf(i)), [void 0, [0, 0]];
}
if (r.parent instanceof H) {
let n = r.parent, o = t37.extractAtoms([t37.position, t37.offsetOf(n.lastChild)]), a = t37.extractAtoms([t37.offsetOf(n.firstChild), t37.position]);
a.length === 0 && (a = Ua()), o.length === 0 && (o = Ua());
let s = "pmatrix", l = n.leftDelim, c = n.rightDelim;
l === "(" && (c === ")" || c === "?") ? s = "pmatrix" : (l === "[" || l === "\\lbrack") && (c === "]" || c === "\\rbrack" || c === "?") ? s = "bmatrix" : l === "\\vert" && c === "\\vert" ? s = "vmatrix" : l === "\\Vert" && c === "\\Vert" ? s = "Vmatrix" : (l === "{" || l === "\\lbrace") && (c === "." || c === "?") && (s = "cases");
let u = Re(s, e.endsWith("column") ? [[a, o]] : [[a], [o]]);
return n.parent.addChildBefore(u, n), n.parent.removeChild(n), oi(u, 0, 0) ? ai(t37, u, 0, 0) : e.endsWith("column") ? oi(u, 0, 1) ? ai(t37, u, 0, 1) : t37.position = t37.offsetOf(r) : oi(u, 1, 0) ? ai(t37, u, 1, 0) : t37.position = t37.offsetOf(r), [void 0, [0, 0]];
}
}
return r && r.parent instanceof N ? [r.parent, r.parentBranch] : [void 0, [0, 0]];
}
function oi(t37, e, r) {
let i = t37.getCell(e, r);
return !i || i.length !== 2 ? false : i[1].type === "placeholder";
}
function Wf(t37, e, r, i) {
let n = e.getCell(r, i);
return n ? [t37.offsetOf(n[0]), t37.offsetOf(n[n.length - 1])] : -1;
}
function ai(t37, e, r, i) {
let n = Wf(t37, e, r, i);
typeof n != "number" && t37.setSelection(n);
}
function Wa(t37, e, r, i, n) {
let o = e.getCell(r, i);
o && t37.setPositionHandlingPlaceholder(t37.offsetOf(o[n === "start" ? 0 : o.length - 1]));
}
function Ja(t37, e) {
let [r, [i, n]] = Hf(t37, e);
if (r)
switch (e) {
case "after row":
r.addRowAfter(i), Wa(t37, r, i + 1, 0, "end");
break;
case "after column":
if (r.maxColumns <= r.colCount) {
t37.announce("plonk");
return;
}
r.addColumnAfter(n), Wa(t37, r, i, n + 1, "end");
break;
case "before row":
r.addRowBefore(i), Wa(t37, r, i, 0, "start");
break;
case "before column":
if (r.maxColumns <= r.colCount) {
t37.announce("plonk");
return;
}
r.addColumnBefore(n), Wa(t37, r, i, n, "start");
break;
}
}
function ql(t37) {
return t37.contentWillChange({ inputType: "insertText" }) ? (Ja(t37, "after row"), t37.contentDidChange({ inputType: "insertText" }), true) : false;
}
function Uf(t37) {
return t37.contentWillChange({ inputType: "insertText" }) ? (Ja(t37, "before row"), t37.contentDidChange({ inputType: "insertText" }), true) : false;
}
function Hl(t37) {
return t37.contentWillChange({ inputType: "insertText" }) ? (Ja(t37, "after column"), t37.contentDidChange({ inputType: "insertText" }), true) : false;
}
function Jf(t37) {
return t37.contentWillChange({ inputType: "insertText" }) ? (Ja(t37, "before column"), t37.contentDidChange({ inputType: "insertText" }), true) : false;
}
function Wl(t37, e) {
if (!t37.contentWillChange({}))
return false;
t37.mathfield.snapshot();
let r = ".", i = ".";
switch (e) {
case "pmatrix":
case "pmatrix*":
r = "(", i = ")";
break;
case "bmatrix":
case "bmatrix*":
r = "[", i = "]";
break;
case "Bmatrix":
case "Bmatrix*":
r = "\\lbrace", i = "\\rbrace";
break;
case "vmatrix":
case "vmatrix*":
r = "\\vert", i = "\\vert";
break;
case "Vmatrix":
case "Vmatrix*":
r = "\\Vert", i = "\\Vert";
break;
case "matrix":
case "matrix*":
r = ".", i = ".";
break;
case "cases":
case "dcases":
r = "\\lbrace";
break;
case "rcases":
i = "\\rbrace";
break;
}
let n = t37.at(t37.position), o = n.type === "array" ? n : t37.parentEnvironment;
return o.environmentName = e, o.leftDelim = r, o.rightDelim = i, t37.contentDidChange({}), true;
}
function Gm(t37, e) {
let r = t37.at(t37.position);
for (; r && !(Array.isArray(r.parentBranch) && r.parent instanceof N); )
r = r.parent;
if (Array.isArray(r == null ? void 0 : r.parentBranch) && (r == null ? void 0 : r.parent) instanceof N) {
let i = r.parent, n = r.parentBranch, o;
switch (e) {
case "row":
if (i.rowCount > 1) {
i.removeRow(n[0]);
let a = i.getCell(Math.max(0, n[0] - 1), n[1]);
o = t37.offsetOf(a[a.length - 1]);
}
break;
case "column":
if (i.colCount > i.minColumns) {
i.removeColumn(n[1]);
let a = i.getCell(n[0], Math.max(0, n[1] - 1));
o = t37.offsetOf(a[a.length - 1]);
}
break;
}
o && t37.setPositionHandlingPlaceholder(o);
}
}
function Gf(t37) {
return t37.contentWillChange({ inputType: "deleteContent" }) ? (Gm(t37, "row"), t37.contentDidChange({ inputType: "deleteContent" }), true) : false;
}
function jf(t37) {
return t37.contentWillChange({ inputType: "deleteContent" }) ? (Gm(t37, "column"), t37.contentDidChange({ inputType: "deleteContent" }), true) : false;
}
ae({ addRowAfter: ql, addColumnAfter: Hl, addRowBefore: Uf, addColumnBefore: Jf, removeRow: Gf, removeColumn: jf, setEnvironment: Wl }, { target: "model", canUndo: true, changeContent: true, changeSelection: true });
function Ua() {
return [new ge()];
}
var ja = class ja2 {
constructor(e) {
this.recording = false;
this.model = e, this.reset();
}
reset() {
this.stack = [], this.index = -1, this.lastOp = "";
}
startRecording() {
this.recording = true;
}
stopRecording() {
this.recording = false;
}
canUndo() {
return this.index - 1 >= 0;
}
canRedo() {
return this.stack.length - 1 > this.index;
}
stopCoalescing(e) {
e && this.index >= 0 && (this.stack[this.index].selection = e), this.lastOp = "";
}
undo() {
return this.canUndo() ? (this.model.setState(this.stack[this.index - 1], { silenceNotifications: false, type: "undo" }), this.index -= 1, this.lastOp = "", true) : false;
}
redo() {
return this.canRedo() ? (this.index += 1, this.model.setState(this.stack[this.index], { silenceNotifications: false, type: "redo" }), this.lastOp = "", true) : false;
}
pop() {
this.canUndo() && (this.stack.splice(this.index, this.stack.length - this.index), this.index -= 1);
}
snapshot(e) {
return this.recording ? (e && e === this.lastOp && this.pop(), this.stack.splice(this.index + 1, this.stack.length - this.index - 1), this.stack.push(this.model.getState()), this.index += 1, this.stack.length > ja2.maximumDepth && (this.stack.shift(), this.index -= 1), this.lastOp = e != null ? e : "", true) : false;
}
};
ja.maximumDepth = 1e3;
var Ga = ja;
function Ya(t37, e, r) {
if (t37.at(e).mode !== "text")
return e;
let i = r === "backward" ? -1 : 1, n;
if (Dr.test(t37.at(e).value)) {
let o = e, a;
do
a = t37.at(o).mode === "text" && Dr.test(t37.at(o).value), o += i;
while (t37.at(o) && a);
n = t37.at(o) ? o - 2 * i : o - i;
} else if (/\s/.test(t37.at(e).value)) {
let o = e;
for (; t37.at(o) && t37.at(o).mode === "text" && /\s/.test(t37.at(o).value); )
o += i;
if (!t37.at(o))
n = o - i;
else {
let a = true;
do
a = t37.at(o).mode === "text" && !/\s/.test(t37.at(o).value), o += i;
while (t37.at(o) && a);
n = t37.at(o) ? o - 2 * i : o - i;
}
} else {
let o = e;
for (; t37.at(o) && t37.at(o).mode === "text" && !/\s/.test(t37.at(o).value); )
o += i;
n = t37.at(o) ? o : o - i;
let a = true;
for (; t37.at(o) && a; )
a = t37.at(o).mode === "text" && /\s/.test(t37.at(o).value), a && (n = o), o += i;
n = t37.at(o) ? o - 2 * i : o - i;
}
return n - (i > 0 ? 0 : 1);
}
function Sr(t37, e, r) {
var a, s, l, c, u, d, m;
let i = t37.position;
(a = r == null ? void 0 : r.extend) != null && a || t37.collapseSelection(e);
let n = t37.at(t37.position);
if (e === "forward" && (n.type === "subsup" ? (n = n.rightSibling, n || (n = t37.at(t37.position + 1))) : n = t37.at(t37.position + 1)), !n)
return t37.announce("plonk"), false;
let o = t37.offsetOf(n);
if (n instanceof Be)
o = Ya(t37, o, e);
else if (n instanceof ie)
if (n.isSuggestion)
for (; n && n instanceof ie; )
n.isSuggestion = false, o = t37.offsetOf(n), n = n.rightSibling;
else if (e === "forward") {
if (n = n.rightSibling, !n || !(n instanceof ie))
return t37.announce("plonk"), false;
for (; n && n instanceof ie && /[a-zA-Z\*]/.test(n.value); )
o = t37.offsetOf(n), n = n.rightSibling;
} else {
if (n = n.leftSibling, !n || !(n instanceof ie))
return t37.announce("plonk"), false;
for (; n && n instanceof ie && /[a-zA-Z\*]/.test(n.value); )
o = t37.offsetOf(n), n = n.leftSibling;
}
else if (e === "forward" && n.type === "mopen") {
let h = 0;
do
n.type === "mopen" ? h += 1 : n.type === "mclose" && (h -= 1), n = n.rightSibling;
while (!n.isLastSibling && h !== 0);
o = t37.offsetOf(n.leftSibling);
} else if (e === "backward" && n.type === "mclose") {
let h = 0;
do
n.type === "mopen" ? h += 1 : n.type === "mclose" && (h -= 1), n = n.leftSibling;
while (!n.isFirstSibling && h !== 0);
o = t37.offsetOf(n);
} else if (e === "backward")
if (n.type === "first")
for (; o > 0 && n.type === "first"; )
o -= 1, n = t37.at(o);
else {
let h = n.type;
n.type === "subsup" && (o = t37.offsetOf(t37.at(o).leftSibling)), o -= 1;
let f = (s = t37.at(o)) == null ? void 0 : s.type;
for (; o >= 0 && f === h; )
((l = t37.at(o)) == null ? void 0 : l.type) === "subsup" ? o = t37.offsetOf(t37.at(o).leftSibling) : o -= 1, f = t37.at(o).type;
}
else {
let { type: h } = n, f = (c = t37.at(o)) == null ? void 0 : c.type, { lastOffset: b } = t37;
for (; o <= b && (f === h || f === "subsup"); ) {
for (; ((u = t37.at(o).rightSibling) == null ? void 0 : u.type) === "subsup"; )
o = t37.offsetOf(t37.at(o).rightSibling);
o += 1, f = (d = t37.at(o)) == null ? void 0 : d.type;
}
o -= 1;
}
if ((m = r == null ? void 0 : r.extend) != null && m) {
if (!t37.setSelection(t37.anchor, o))
return t37.announce("plonk"), false;
} else {
if (o === t37.position)
return t37.announce("plonk"), false;
t37.position = o;
}
return t37.announce("move", i), t37.mathfield.stopCoalescingUndo(), true;
}
function He(t37, e, r) {
var o, a;
if (r = r != null ? r : { extend: false }, t37.mathfield.styleBias = e === "backward" ? "right" : "left", e !== "forward") {
let [s, l] = Ia(t37);
s !== void 0 && l !== void 0 && t37.deleteAtoms([s, l]);
}
if (e === "upward")
return Zf(t37, r);
if (e === "downward")
return Yf(t37, r);
if (r.extend) {
let s = Xa(t37, t37.position, e);
s < 0 && (s = 0), s > t37.lastOffset && (s = t37.lastOffset);
let l = t37.setSelection(t37.anchor, s);
return t37.mathfield.stopCoalescingUndo(), l;
}
if (t37.selectionIsPlaceholder) {
t37.collapseSelection(e);
let s = He(t37, e);
return t37.mathfield.stopCoalescingUndo(), s;
}
let i = t37.position, n = i;
if (t37.collapseSelection(e) ? (i = t37.position, jm(t37, i) || (i = Xa(t37, i, e))) : i = Xa(t37, i, e), i < 0 || i > t37.lastOffset) {
let s = true;
return t37.silenceNotifications || (s = (a = (o = t37.mathfield.host) == null ? void 0 : o.dispatchEvent(new CustomEvent("move-out", { detail: { direction: e }, cancelable: true, bubbles: true, composed: true }))) != null ? a : true), s && t37.announce("plonk"), s;
}
return t37.setPositionHandlingPlaceholder(i), t37.mathfield.stopCoalescingUndo(), t37.announce("move", n), true;
}
function Xa(t37, e, r) {
return e = e + (r === "forward" ? 1 : -1), e < 0 || e > t37.lastOffset || jm(t37, e) ? e : Xa(t37, e, r);
}
function jm(t37, e) {
var n;
let r = t37.at(e), i = r.parent;
for (; i && !i.inCaptureSelection; )
i = i.parent;
return !(i != null && i.inCaptureSelection || (n = r.parent) != null && n.skipBoundary && (!r.isFirstSibling && r.isLastSibling || r.type === "first") || t37.mathfield.hasEditablePrompts && !r.parentPrompt);
}
function Xf(t37, e, r) {
let i = 1 / 0, n = 0;
for (; n < e.length; n++) {
let o = e[n], a = t37.getHTMLElement(o);
if (!a)
continue;
let s = vl(a).right, l = Math.abs(r - s);
if (l <= i)
i = l;
else
break;
}
return e[n - 1];
}
function Za(t37, e, r, i, n) {
let o = t37.mathfield.hasEditablePrompts, a = o ? r.filter((c) => c.type === "prompt" && !c.captureSelection) : r, s = vl(t37.mathfield.getHTMLElement(e)).right, l = t37.offsetOf(Xf(t37.mathfield, a, s)) - (o ? 1 : 0);
if (i) {
let [c, u] = t37.selection.ranges[0], d;
l < (n === "up" ? c : u) ? d = { ranges: [[l, u]], direction: "backward" } : d = { ranges: [[c, l]], direction: "forward" }, t37.setSelection(d);
} else
t37.setPositionHandlingPlaceholder(l);
t37.announce(`move ${n}`);
}
function Zf(t37, e) {
var a, s;
let r = (a = e == null ? void 0 : e.extend) != null ? a : false;
r || t37.collapseSelection("backward");
let i = () => {
var c, u;
let l = true;
return t37.silenceNotifications || (l = (u = (c = t37.mathfield.host) == null ? void 0 : c.dispatchEvent(new CustomEvent("move-out", { detail: { direction: "upward" }, cancelable: true, bubbles: true, composed: true }))) != null ? u : true), t37.announce(l ? "line" : "plonk"), l;
}, n = t37.at(t37.position), o = n;
for (; o && o.parentBranch !== "below" && !(Array.isArray(o.parentBranch) && o.parent instanceof N); )
o = o.parent;
if (Array.isArray(o == null ? void 0 : o.parentBranch) && o.parent instanceof N) {
let l = o.parent;
if (o.parentBranch[0] < 1)
return i();
let c = o.parentBranch[0] - 1, u = l.array[c][o.parentBranch[1]];
if (!u.some((m) => m.type === "prompt" && !m.captureSelection) && t37.mathfield.hasEditablePrompts)
return i();
Za(t37, n, u, r, "up");
} else if (o) {
let l = (s = o.parent.branch("above")) != null ? s : o.parent.createBranch("above");
if (!l.some((u) => u.type === "prompt" && u.placeholderId) && t37.mathfield.hasEditablePrompts)
return i();
Za(t37, n, l, r, "up");
} else
return i();
return t37.mathfield.stopCoalescingUndo(), true;
}
function Yf(t37, e) {
var a, s;
let r = (a = e == null ? void 0 : e.extend) != null ? a : false;
r || t37.collapseSelection("forward");
let i = () => {
var c, u;
let l = true;
return t37.silenceNotifications || (l = (u = (c = t37.mathfield.host) == null ? void 0 : c.dispatchEvent(new CustomEvent("move-out", { detail: { direction: "downward" }, cancelable: true, bubbles: true, composed: true }))) != null ? u : true), t37.announce(l ? "line" : "plonk"), l;
}, n = t37.at(t37.position), o = n;
for (; o && o.parentBranch !== "above" && !(Array.isArray(o.parentBranch) && o.parent instanceof N); )
o = o.parent;
if (Array.isArray(o == null ? void 0 : o.parentBranch) && o.parent instanceof N) {
let l = o.parent;
if (o.parentBranch[0] + 1 > l.array.length - 1)
return i();
let c = o.parentBranch[0] + 1, u = l.array[c][o.parentBranch[1]];
if (!u.some((m) => m.type === "prompt" && !m.captureSelection) && t37.mathfield.hasEditablePrompts)
return i();
Za(t37, n, u, r, "down");
} else if (o) {
let l = (s = o.parent.branch("below")) != null ? s : o.parent.createBranch("below");
if (!l.some((u) => u.type === "prompt") && t37.mathfield.hasEditablePrompts)
return i();
Za(t37, n, l, r, "down");
} else
return i();
return true;
}
function Jl(t37) {
let e = t37.position, r = t37.at(e).parent;
return r != null && r.parent ? (t37.position = t37.offsetOf(r), t37.mathfield.stopCoalescingUndo(), t37.announce("move", e), true) : (t37.announce("plonk"), false);
}
function Qf(t37) {
let e = 0, r = t37.at(t37.position), i = false;
for (; r; )
(!r.hasEmptyBranch("superscript") || !r.hasEmptyBranch("subscript")) && (e += 1), r.hasEmptyBranch("superscript") ? r.hasEmptyBranch("subscript") || (i = false) : i = true, r = r.parent;
return i ? e : 0;
}
function eg(t37) {
let e = 0, r = t37.at(t37.position), i = false;
for (; r; )
(!r.hasEmptyBranch("superscript") || !r.hasEmptyBranch("subscript")) && (e += 1), r.hasEmptyBranch("superscript") ? r.hasEmptyBranch("subscript") || (i = true) : i = false, r = r.parent;
return i ? e : 0;
}
function Xm(t37) {
var r;
if (t37.collapseSelection(), Qf(t37) >= t37.mathfield.options.scriptDepth[1])
return t37.announce("plonk"), false;
let e = t37.at(t37.position);
return e.subsupPlacement === void 0 && (((r = e.rightSibling) == null ? void 0 : r.type) !== "subsup" && e.parent.addChildAfter(new Wt({ style: e.style }), e), e = e.rightSibling), e.createBranch("superscript"), t37.setSelection(t37.getSiblingsRange(t37.offsetOf(e.superscript[0]))), true;
}
function Zm(t37) {
var r;
if (t37.collapseSelection(), eg(t37) >= t37.mathfield.options.scriptDepth[0])
return t37.announce("plonk"), false;
let e = t37.at(t37.position);
return e.subsupPlacement === void 0 && (((r = t37.at(t37.position + 1)) == null ? void 0 : r.type) !== "subsup" && e.parent.addChildAfter(new Wt({ style: t37.at(t37.position).style }), e), e = t37.at(t37.position + 1)), e.createBranch("subscript"), t37.setSelection(t37.getSiblingsRange(t37.offsetOf(e.subscript[0]))), true;
}
function tg() {
function t37(l) {
let c = [], u = [];
return [...l.querySelectorAll(`input, select, textarea, a[href], button,
[tabindex], audio[controls], video[controls],
[contenteditable]:not([contenteditable="false"]), details>summary`)].filter(e).forEach((m, h) => {
let f = i(m);
f === 0 ? c.push(m) : u.push({ documentOrder: h, tabIndex: f, node: m });
}), u.sort((m, h) => m.tabIndex === h.tabIndex ? m.documentOrder - h.documentOrder : m.tabIndex - h.tabIndex).map((m) => m.node).concat(c);
}
function e(l) {
return !(!r(l) || n(l) || i(l) < 0);
}
function r(l) {
return !(l.disabled || l.type === "hidden" && l.tagName.toUpperCase() === "INPUT" || s(l));
}
function i(l) {
var u;
let c = Number.parseInt((u = l.getAttribute("tabindex")) != null ? u : "NaN", 10);
return Number.isNaN(c) ? l.contentEditable === "true" || (l.nodeName === "AUDIO" || l.nodeName === "VIDEO") && l.getAttribute("tabindex") === null ? 0 : l.tabIndex : c;
}
function n(l) {
return l.tagName.toUpperCase() === "INPUT" && l.type === "radio" && !a(l);
}
function o(l, c) {
for (let u of l)
if (u.checked && u.form === c)
return u;
return null;
}
function a(l) {
var m;
if (!l.name)
return true;
let u = ((m = l.form) != null ? m : l.ownerDocument).querySelectorAll('input[type="radio"][name="' + l.name + '"]'), d = o(u, l.form);
return !d || d === l;
}
function s(l) {
if (!fe() || l === document.activeElement || l.contains(document.activeElement))
return false;
if (getComputedStyle(l).visibility === "hidden")
return true;
let c = l.getBoundingClientRect();
if (c.width === 0 || c.height === 0)
return true;
for (; l; ) {
if (getComputedStyle(l).display === "none")
return true;
l = l.parentElement;
}
return false;
}
return fe() ? t37(document.body) : [];
}
function ke(t37, e, r = "forward") {
let i = t37.position;
if (X(e)) {
let n = t37.offsetOf(e[0]), o = t37.offsetOf(e[e.length - 1]);
return r === "forward" ? t37.setSelection(n, o) : t37.setSelection(o, n), t37.announce("move", i), t37.mathfield.stopCoalescingUndo(), true;
}
return r === "forward" ? ke(t37, [e.leftSibling, e]) : ke(t37, [e, e.leftSibling]);
}
function ut(t37, e) {
let r = t37.position;
if (typeof e == "number" && (e = t37.at(e)), e.type === "prompt")
t37.setSelection(t37.offsetOf(e.firstChild), t37.offsetOf(e.lastChild));
else {
let i = t37.offsetOf(e);
e.type === "placeholder" ? t37.setSelection(i - 1, i) : t37.position = i;
}
return t37.announce("move", r), t37.mathfield.stopCoalescingUndo(), true;
}
function sn(t37, e) {
var a, s;
let r = e === "forward" ? 1 : -1;
t37.at(t37.anchor).type === "placeholder" && He(t37, e);
let i, n = t37.at(t37.anchor).parentPrompt;
n ? e === "forward" ? i = t37.offsetOf(n) + 1 : i = t37.offsetOf(n.leftSibling) : i = Math.max(t37.position + r, 0);
let o = Ul(t37, i, e);
if (!o || e === "forward" && t37.offsetOf(o) < i || e === "backward" && t37.offsetOf(o) > i) {
if (!((s = (a = t37.mathfield.host) == null ? void 0 : a.dispatchEvent(new CustomEvent("move-out", { detail: { direction: e }, cancelable: true, bubbles: true, composed: true }))) != null ? s : true))
return t37.announce("plonk"), false;
let c = tg();
if (!document.activeElement || c.length <= 1)
return t37.announce("plonk"), false;
let u = c.indexOf(document.activeElement) + r;
return u < 0 && (u = c.length - 1), u >= c.length && (u = 0), c[u].focus(), t37.mathfield.stopCoalescingUndo(), true;
}
return ut(t37, o), true;
}
function Ul(t37, e = 0, r = "forward") {
return t37.findAtom((i) => i.type === "placeholder" || i.type === "prompt" || !t37.mathfield.readOnly && i.treeDepth > 2 && i.isFirstSibling && i.isLastSibling, e, r);
}
ae({ moveToOpposite: (t37) => {
let e = { superscript: "subscript", subscript: "superscript", above: "below", below: "above" }, r = t37.at(t37.position), { parent: i } = r;
if (!i)
return t37.announce("plonk"), false;
let n = r.parentBranch, o;
if (typeof n == "string" && (o = e[n]), !o) {
let s = r.subsupPlacement ? Zm(t37) : Xm(t37);
return t37.mathfield.stopCoalescingUndo(), s;
}
i.branch(o) || i.createBranch(o);
let a = t37.setSelection(t37.getBranchRange(t37.offsetOf(i), o));
return t37.mathfield.stopCoalescingUndo(), a;
}, moveBeforeParent: (t37) => {
let { parent: e } = t37.at(t37.position);
return e ? (t37.position = t37.offsetOf(e), t37.mathfield.stopCoalescingUndo(), true) : (t37.announce("plonk"), false);
}, moveAfterParent: (t37) => Jl(t37), moveToNextChar: (t37) => He(t37, "forward"), moveToPreviousChar: (t37) => He(t37, "backward"), moveUp: (t37) => He(t37, "upward"), moveDown: (t37) => He(t37, "downward"), moveToNextWord: (t37) => Sr(t37, "forward"), moveToPreviousWord: (t37) => Sr(t37, "backward"), moveToGroupStart: (t37) => {
let e = t37.offsetOf(t37.at(t37.position).firstSibling);
return e === t37.position ? (t37.announce("plonk"), false) : (t37.position = e, t37.mathfield.stopCoalescingUndo(), true);
}, moveToGroupEnd: (t37) => {
let e = t37.offsetOf(t37.at(t37.position).lastSibling);
return e === t37.position ? (t37.announce("plonk"), false) : (t37.position = e, t37.mathfield.stopCoalescingUndo(), true);
}, moveToNextGroup: (t37) => {
var l, c, u, d;
if (t37.position === t37.lastOffset && t37.anchor === t37.lastOffset)
return sn(t37, "forward");
let e = t37.at(t37.position);
if (e.mode === "text") {
if (t37.selectionIsCollapsed) {
let m = e;
for (; m && m.mode === "text"; )
m = m.leftSibling;
let h = e;
for (; ((l = h.rightSibling) == null ? void 0 : l.mode) === "text"; )
h = h.rightSibling;
if (m && h)
return ke(t37, [m, h]);
}
if (e.rightSibling.mode === "text") {
let m = e;
for (; m && m.mode === "text"; )
m = m.rightSibling;
return m ? (ut(t37, (c = m.leftSibling) != null ? c : m), t37.mathfield.switchMode("math"), true) : ut(t37, t37.lastOffset);
}
}
let i = t37.at(t37.anchor).parentPrompt, n = i ? t37.offsetOf(i) + 1 : Math.max(t37.position + 1, 0), o = Ul(t37, n, "forward");
if (o && t37.offsetOf(o) < n)
return sn(t37, "forward");
if (o)
return ut(t37, o);
let a = Ym(t37, e, (m) => m.type === "leftright" || m.type === "text", "forward");
if (a) {
if (a.mode === "text") {
let m = a;
for (; m && m.mode === "text"; )
m = m.rightSibling;
return ke(t37, [(u = a.leftSibling) != null ? u : a, (d = m.leftSibling) != null ? d : m]);
}
return ke(t37, a);
}
let s = e.parent;
if (s) {
if (s.type === "leftright" || s.type === "surd")
return ke(t37, s);
if (e.parentBranch === "superscript" && s.subscript)
return ke(t37, s.subscript);
if (e.parentBranch === "above" && s.below)
return ke(t37, s.below);
if (e.parentBranch === "superscript" || e.parentBranch === "subscript")
return ut(t37, s);
if (e.parentBranch === "above" || e.parentBranch === "below")
return ke(t37, s);
}
return ut(t37, t37.lastOffset);
}, moveToPreviousGroup: (t37) => {
var a;
if (t37.position === 0 && t37.anchor === 0)
return sn(t37, "backward");
let e = t37.at(t37.position), r = e.mode;
if (r === "text") {
if (t37.selectionIsCollapsed) {
let s = e;
for (; s && s.mode === "text"; )
s = s.leftSibling;
let l = e;
for (; ((a = l.rightSibling) == null ? void 0 : a.mode) === "text"; )
l = l.rightSibling;
if (s && l)
return ke(t37, [s, l]);
}
for (; e && e.mode === "text"; )
e = e.leftSibling;
return e ? ut(t37, e) : ut(t37, 0);
}
let i = t37.at(t37.anchor).parentPrompt, n = i ? t37.offsetOf(i.leftSibling) : Math.max(t37.position - 1, 0), o = Ul(t37, n, "backward");
if (o && t37.offsetOf(o) > n)
return sn(t37, "backward");
if (o)
return ut(t37, o);
if (r === "math") {
let s = Ym(t37, e, (c) => c.type === "leftright" || c.type === "text", "backward");
if (s) {
if (s.mode === "text") {
let c = s;
for (; c && c.mode === "text"; )
c = c.leftSibling;
return ke(t37, [s, c]);
}
return ke(t37, s);
}
let l = e.parent;
if (l) {
if (l.type === "leftright" || l.type === "surd")
return ke(t37, l);
if (e.parentBranch === "subscript" && l.superscript)
return ke(t37, l.superscript);
if (e.parentBranch === "below" && l.above)
return ke(t37, l.above);
if (e.parentBranch === "superscript" || e.parentBranch === "subscript")
return ut(t37, l);
if (e.parentBranch === "above" || e.parentBranch === "below")
return ke(t37, l);
}
return ut(t37, 0);
}
return false;
}, moveToMathfieldStart: (t37) => t37.selectionIsCollapsed && t37.position === 0 ? (t37.announce("plonk"), false) : (t37.position = 0, t37.mathfield.stopCoalescingUndo(), true), moveToMathfieldEnd: (t37) => t37.selectionIsCollapsed && t37.position === t37.lastOffset ? (t37.announce("plonk"), false) : (t37.position = t37.lastOffset, t37.mathfield.stopCoalescingUndo(), true), moveToSuperscript: Xm, moveToSubscript: Zm }, { target: "model", changeSelection: true });
ae({ moveToNextPlaceholder: (t37) => sn(t37, "forward"), moveToPreviousPlaceholder: (t37) => sn(t37, "backward") }, { target: "model", changeSelection: true, audioFeedback: "return" });
function Ym(t37, e, r, i) {
if (i === "forward") {
let o = e.rightSibling;
for (; o && !r(o); )
o = o.rightSibling;
return o;
}
let n = e.leftSibling;
for (; n && !r(n); )
n = n.leftSibling;
return n;
}
function Qa(t37, e, r) {
typeof e == "function" && (r = e, e = 1 / 0), e === void 0 && (e = 1 / 0);
let i = t37.position, n = false, o = "";
for (; !n; ) {
let a = t37.at(i);
n = e === 0 || a === void 0 || a.type === "first" || a.mode !== "math" || !(a.type && /mord|mpunct|operator/.test(a.type) || a.type === "mop" && /[a-zA-Z ]+/.test(a.value)) || !a.hasEmptyBranch("superscript") || !a.hasEmptyBranch("subscript") || typeof r == "function" && !r(a), n || (a.mode = "text", a.command = a.value, a.verbatimLatex = void 0, o += a.value), i -= 1, e -= 1;
}
t37.contentDidChange({ data: o, inputType: "insertText" });
}
function si(t37, e, r) {
typeof e == "function" && (r = e, e = 1 / 0), e === void 0 && (e = 1 / 0);
let i = t37.position, n = false, o = [];
for (; !n; ) {
let a = t37.at(i);
n = e === 0 || !a || a.type === "first" || a.isFirstSibling || a.mode !== "text" || a.value === " " || typeof r == "function" && !r(a), n || (o.push(y.serialize([a], { defaultMode: "math" })), a.mode = "math"), i -= 1, e -= 1;
}
es(t37), t37.contentDidChange({ data: K(o), inputType: "insertText" });
}
function es(t37) {
var r;
let e = t37.position - 1;
for (; e >= 0 && ((r = t37.at(e)) == null ? void 0 : r.mode) === "math"; )
e -= 1;
if (!(e < 0) && t37.at(e).mode === "text" && t37.at(e).value === " " && t37.at(e - 1).mode === "math") {
t37.at(e - 1).parent.removeChild(t37.at(e - 1));
let i = t37.silenceNotifications;
t37.silenceNotifications = true, t37.position -= 1, t37.silenceNotifications = i, t37.contentDidChange({ inputType: "deleteContent" });
}
}
function rg(t37) {
let e = "", r = t37.position, i = false;
for (; !i; ) {
let n = t37.at(r);
i = !(n && (n.mode === "text" || n.mode === "math" && n.type && /mord|mpunct/.test(n.type))), i || (e = n.value + e), r -= 1;
}
return e;
}
function Qm(t37, e, r) {
let { model: i } = t37;
if (i.mode === "latex" || !i.at(i.position).isLastSibling || !r || !_r(r))
return false;
let n = Mr(r);
if (!i.selectionIsCollapsed)
return !!(t37.model.mode === "text" && /[/_^]/.test(n));
let o = rg(i) + n;
if (t37.model.mode === "text") {
if (e === "Esc" || /[/\\]/.test(n))
return true;
if (/[\^_]/.test(n))
return /(^|\s)[a-zA-Z][^_]$/.test(o) && si(i, 1), true;
let a = { ")": "(", "}": "{", "]": "[" }[n], { parent: s } = i.at(i.position);
if (a && s instanceof H && s.leftDelim === a)
return true;
if (/(^|[^a-zA-Z])(a|I) $/.test(o))
return false;
if (/[$€£₤₺¥¤฿¢₡₧₨₹₩₱]/u.test(n))
return true;
if (/(^|[^a-zA-Z'])[a-zA-Z] $/.test(o))
return si(i, 1), false;
if (/\D\.[^\d\s]$/.test(o)) {
si(i, 1);
let l = i.at(i.position);
return l.value = "\u22C5", l.style.variant = "normal", l.command = "\\cdot", l.verbatimLatex = void 0, i.contentDidChange({ data: "\\cdot", inputType: "insertText" }), true;
}
if (/(^|\s)[a-zA-Z][^a-zA-Z]$/.test(o) || /\.\d$/.test(o) || /\([\d+\-.]$/.test(o))
return si(i, 1), true;
if (/\([a-z][,;]$/.test(o))
return si(i, 2), true;
if (/[\d+\-=><*|]$/.test(n))
return es(i), true;
} else {
if (e === "[Space]")
return Qa(i, void 0, (a) => /[a-z][:,;.]$/.test(a.value)), true;
if (/[a-zA-Z]{3,}$/.test(o) && !/(dxd|abc|xyz|uvw)$/.test(o))
return Qa(i, void 0, (a) => /[a-zA-Z]/.test(a.value)), true;
if (/(^|\W)(if)$/i.test(o))
return Qa(i, 1), true;
if (/(\u0393|\u0394|\u0398|\u039B|\u039E|\u03A0|\u03A3|\u03A5|\u03A6|\u03A8|\u03A9|[\u03B1-\u03C9]|\u03D1|\u03D5|\u03D6|\u03F1|\u03F5){3,}$/u.test(o) && !/(αβγ)$/.test(o))
return Qa(i, void 0, (a) => /(:|,|;|.|\u0393|\u0394|\u0398|\u039B|\u039E|\u03A0|\u03A3|\u03A5|\u03A6|\u03A8|\u03A9|[\u03B1-\u03C9]|\u03D1|\u03D5|\u03D6|\u03F1|\u03F5)/u.test(a.value)), true;
if (n === "?" || n === "." && !/[\d-+]\.$/.test(o))
return true;
}
return false;
}
function ep(t37, e) {
if (!t37.isSelectionEditable || !t37.keystrokeCaptionVisible)
return;
let r = rp(), i = t37.element.getBoundingClientRect();
r.style.left = `${i.left}px`, r.style.top = `${i.top - 64}px`, r.innerHTML = globalThis.MathfieldElement.createHTML("<span>" + (ji(e) || e) + "</span>" + r.innerHTML), r.style.visibility = "visible", setTimeout(() => {
r.childNodes.length > 0 && r.childNodes[r.childNodes.length - 1].remove(), r.childNodes.length === 0 && (r.style.visibility = "hidden");
}, 3e3);
}
function tp(t37) {
if (t37.keystrokeCaptionVisible = !t37.keystrokeCaptionVisible, t37.keystrokeCaptionVisible) {
let e = rp();
e.innerHTML = "";
} else {
let e = Yr("mathlive-keystroke-caption-panel");
e.style.visibility = "hidden";
}
return false;
}
function rp() {
let t37 = document.getElementById("mathlive-keystroke-caption-panel");
return t37 || (Oe("keystroke-caption"), Oe("core"), Yr("mathlive-keystroke-caption-panel"));
}
function ip() {
document.getElementById("mathlive-keystroke-caption-panel") && (Zi("mathlive-keystroke-caption-panel"), Ve("core"), Ve("keystroke-caption"));
}
function Xl(t37, e) {
var d, m, h;
let { model: r } = t37, i = Ra(e);
if (e.isTrusted) {
Lm(e);
let f = vr();
t37.keyboardLayout !== f.id && (t37.keyboardLayout = f.id, t37._keybindings = void 0);
}
if (clearTimeout(t37.inlineShortcutBufferFlushTimer), t37.inlineShortcutBufferFlushTimer = 0, ep(t37, i), e.isTrusted && e.defaultPrevented)
return t37.flushInlineShortcutBuffer(), false;
let n, o = 0, a = "", s = 0, l = t37.inlineShortcutBuffer;
if (t37.isSelectionEditable) {
if (r.mode === "math")
if (i === "[Backspace]")
t37.undoManager.lastOp === "insert-shortcut" ? a = "undo" : l.pop();
else if (!_r(e))
t37.flushInlineShortcutBuffer();
else {
let f = Mr(e), b = [...(m = (d = l[l.length - 1]) == null ? void 0 : d.keystrokes) != null ? m : [], f];
l.push({ state: r.getState(), keystrokes: b, leftSiblings: ig(t37) }), o = 0;
let S = "";
for (; !n && o < b.length; )
s = l.length - (b.length - o), S = b.slice(o).join(""), n = zn(l[s].leftSiblings, S, t37.options.inlineShortcuts), !n && /^[a-zA-Z][a-zA-Z0-9]+?([_\^][a-zA-Z0-9\*\+\-]+?)?$/.test(S) && (n = t37.options.onInlineShortcut(t37, S)), o += 1;
t37.flushInlineShortcutBuffer({ defer: true });
}
t37.options.smartMode && (n ? t37.switchMode("math") : Qm(t37, i, e) && (t37.switchMode({ math: "text", text: "math" }[r.mode]), a = ""));
}
if (!n) {
if (a || (a = Km(t37.keybindings, r.mode, e)), !a && (i === "[Enter]" || i === "[Return]")) {
let f = true;
return r.contentWillChange({ inputType: "insertLineBreak" }) && (t37.host && (f = t37.host.dispatchEvent(new Event("change", { bubbles: true, composed: true }))), !f && e.preventDefault ? (e.preventDefault(), e.stopPropagation()) : r.contentDidChange({ inputType: "insertLineBreak" })), f;
}
if ((!a || i === "[Space]") && r.mode === "math") {
if (i === "[Space]") {
if (t37.styleBias = "none", t37.flushInlineShortcutBuffer(), t37.options.mathModeSpace)
return z.insert(r, t37.options.mathModeSpace, { format: "latex", mode: "math" }), t37.snapshot("insert-space"), a = "", t37.dirty = true, t37.scrollIntoView(), e.preventDefault && (e.preventDefault(), e.stopPropagation()), false;
let f = r.at(r.position + 1), b = r.at(r.position - 1);
if ((f == null ? void 0 : f.mode) === "text" || (b == null ? void 0 : b.mode) === "text")
return z.insert(r, " ", { mode: "text" }), t37.snapshot("insert-space"), t37.dirty = true, t37.scrollIntoView(), false;
}
(h = r.at(r.position)) != null && h.isDigit() && globalThis.MathfieldElement.decimalSeparator === "," && Mr(e) === "," && (a = "insertDecimalSeparator");
}
}
if (!n && !a) {
if (r.mathfield.smartFence) {
if (jl(r, Mr(e), nn(t37)))
return t37.dirty = true, t37.scrollIntoView(), e.preventDefault && e.preventDefault(), false;
} else {
let { parent: f } = r.at(r.position);
if (f instanceof H && f.rightDelim === "?" && r.at(r.position).isLastSibling && /^[)}\]|]$/.test(i))
return t37.snapshot(), f.isDirty = true, f.rightDelim = i, r.position += 1, r.selectionDidChange(), r.contentDidChange({ data: Mr(e), inputType: "insertText" }), t37.snapshot("insert-fence"), t37.dirty = true, t37.scrollIntoView(), e.preventDefault && e.preventDefault(), false;
if (!r.selectionIsCollapsed) {
let b = Mr(e);
if (b === "(" || b === "{" || b === "[") {
let S = { "(": "(", "{": "\\lbrace", "[": "\\lbrack" }[b], M = { "(": ")", "{": "\\rbrace", "[": "\\rbrack" }[b], [x, v] = te(r.selection);
return t37.snapshot(), r.position = v, z.insert(r, M, { format: "latex" }), r.position = x, z.insert(r, S, { format: "latex" }), r.setSelection(x + 1, v + 1), r.contentDidChange({ data: b, inputType: "insertText" }), t37.snapshot("insert-fence"), t37.dirty = true, t37.scrollIntoView(), e.preventDefault && e.preventDefault(), false;
}
}
}
return true;
}
let c = r.at(Math.max(r.position, r.anchor)), { parent: u } = c;
if (a === "moveAfterParent" && (u == null ? void 0 : u.type) === "leftright" && c.isLastSibling && t37.options.smartFence && jl(r, ".", t37.defaultStyle) && (a = "", V(t37)), t37.keyboardDelegate.cancelComposition(), a)
t37.executeCommand(a);
else if (n) {
let f = nn(t37);
r.setState(l[s].state);
let b = l[l.length - 1].keystrokes;
b = b.slice(o - 1);
for (let S of b)
z.insert(r, S, { silenceNotifications: true, style: f });
t37.snapshot("insert-shortcut"), r.setState(l[s].state), r.deferNotifications({ content: true, selection: true, data: n, type: "insertText" }, () => (z.insert(r, n, { format: "latex", style: f }), es(t37.model), n.endsWith(" ") && (t37.switchMode("text"), z.insert(r, " ", { style: f, mode: "text" })), t37.snapshot(), r.selectionIsCollapsed || t37.flushInlineShortcutBuffer(), true)), t37.dirty = true, r.announce("replacement");
}
return t37.scrollIntoView(), e.preventDefault && e.preventDefault(), false;
}
function ro(t37, e, r) {
let { model: i } = t37;
if (!t37.isSelectionEditable) {
i.announce("plonk");
return;
}
r != null || (r = {}), r.focus && t37.focus(), r.feedback && globalThis.MathfieldElement.playSound("keypress"), typeof r.mode == "string" && (t37.switchMode(r.mode), t37.snapshot());
let n = pa(e), o = window.mathVirtualKeyboard;
if (o != null && o.isShifted && (n = typeof n == "string" ? n.toUpperCase() : n.map((a) => a.toUpperCase())), r.simulateKeystroke) {
let a = true;
for (let s of n)
Xl(t37, new KeyboardEvent("keypress", { key: s })) && (a = false);
if (a)
return;
}
if (i.selectionIsCollapsed || i.deleteAtoms(te(i.selection)), i.mode === "latex")
i.deferNotifications({ content: true, selection: true, data: e, type: "insertText" }, () => {
Zr(t37);
for (let a of n)
z.insert(i, a);
t37.snapshot("insert-latex"), kr(t37);
});
else if (i.mode === "text") {
let a = p(p({}, ag(i)), t37.defaultStyle);
for (let s of n)
z.insert(i, s, { style: a });
t37.snapshot("insert-text");
} else if (i.mode === "math")
for (let a of n)
ng(t37, a);
t37.dirty = true, t37.scrollIntoView();
}
function ig(t37) {
let e = t37.model, r = [], i = e.at(Math.min(e.position, e.anchor));
for (; i.type !== "first"; )
r.push(i), i = i.leftSibling;
return r;
}
function ng(t37, e) {
let r = t37.model, i = { "^": "moveToSuperscript", _: "moveToSubscript", " ": t37.options.mathModeSpace ? ["insert", t37.options.mathModeSpace] : "moveAfterParent" }[e];
if (i) {
t37.executeCommand(i);
return;
}
let n = p({}, nn(t37)), o = r.at(r.position);
if (/\d/.test(e) && t37.options.smartSuperscript && o.parentBranch === "superscript" && o.parent.type !== "mop" && o.parent.type !== "operator" && o.parent.type !== "extensible-symbol" && o.hasNoSiblings) {
og(r), z.insert(r, e, { style: n }), t37.snapshot(), Jl(r), t37.snapshot();
return;
}
if (/[a-zA-Z0-9]/.test(e) && t37.styleBias !== "none") {
let s = t37.styleBias === "left" ? o : o.parent ? o.rightSibling : null;
(s == null ? void 0 : s.type) === "mord" && /[a-zA-Z0-9]/.test(s.value) && s.style.variantStyle && (n.variantStyle = s.style.variantStyle);
}
let a = e;
a === "{" ? a = "\\lbrace" : a === "}" ? a = "\\rbrace" : a === "&" ? a = "\\&" : a === "#" ? a = "\\#" : a === "$" ? a = "\\$" : a === "%" ? a = "\\%" : a === "~" ? a = "\\~" : a === "\\" && (a = "\\backslash"), z.insert(r, a, { style: n }), t37.snapshot(`insert-${r.at(r.position).type}`);
}
function og(t37) {
t37.selectionIsCollapsed || (t37.deleteAtoms(te(t37.selection)), t37.mathfield.snapshot("delete"));
}
function ag(t37) {
var r, i, n, o;
if (t37.selectionIsCollapsed)
return (i = (r = t37.at(t37.position)) == null ? void 0 : r.style) != null ? i : {};
let e = te(t37.selection)[0];
return (o = (n = t37.at(e + 1)) == null ? void 0 : n.style) != null ? o : {};
}
function jl(t37, e, r) {
var l;
if (!e || t37.mode !== "math")
return false;
let i = t37.at(t37.position), { parent: n } = i, o = { "(": "(", ")": ")", "{": "\\lbrace", "}": "\\rbrace", "[": "\\lbrack", "]": "\\rbrack", "|": "|" }[e];
if (!o)
return false;
let a = Ni[o], s = zi[o];
if (!t37.selectionIsCollapsed) {
t37.mathfield.snapshot();
let [c, u] = te(t37.selection), d = t37.extractAtoms([c, u]), m = n.addChildrenAfter([new H("left...right", d, { leftDelim: o, rightDelim: s })], t37.at(c));
return t37.setSelection(t37.offsetOf(m.firstChild), t37.offsetOf(m.lastChild)), t37.mathfield.snapshot("insert-fence"), t37.contentDidChange({ data: o, inputType: "insertText" }), true;
}
if (o === "|") {
let c = n instanceof H ? n.leftDelim + n.rightDelim : "";
if (c === "\\lbrace\\rbrace" || c === "\\{\\}" || c === "\\lbrace?")
return t37.mathfield.snapshot(), z.insert(t37, "\\,\\middle\\vert\\,", { format: "latex", style: r }), t37.mathfield.snapshot("insert-fence"), t37.contentDidChange({ data: o, inputType: "insertText" }), true;
}
if (s) {
if (n instanceof H && n.firstChild === i && (n.leftDelim === "?" || n.leftDelim === "."))
return n.leftDelim = o, n.isDirty = true, t37.mathfield.snapshot(), t37.contentDidChange({ data: o, inputType: "insertText" }), t37.mathfield.snapshot("insert-fence"), true;
if (!(n instanceof H)) {
let m = i;
for (; m && !(m.type === "mclose" && m.value === s); )
m = m.rightSibling;
if (m) {
t37.mathfield.snapshot();
let h = t37.extractAtoms([t37.offsetOf(i), t37.offsetOf(m)]);
return h.pop(), n.addChildrenAfter([new H("left...right", h, { leftDelim: o, rightDelim: s })], i), t37.position = t37.offsetOf(n.firstChild) + 1, t37.contentDidChange({ data: o, inputType: "insertText" }), t37.mathfield.snapshot("insert-fence"), true;
}
}
let c = t37.offsetOf(i.lastSibling), u;
for (u = t37.position; u <= c; u++) {
let m = t37.at(u);
if (m instanceof H && (m.leftDelim === "?" || m.leftDelim === ".") && np(o, m.rightDelim))
break;
}
let d = t37.at(u);
if (u <= c && d instanceof H) {
d.leftDelim = o, t37.mathfield.snapshot();
let m = t37.extractAtoms([t37.position, u - 1]);
return m = m.filter((h) => h.type !== "first"), d.addChildren(m, d.parentBranch), t37.position += 1, t37.contentDidChange({ data: o, inputType: "insertText" }), t37.mathfield.snapshot("insert-fence"), true;
}
if (n instanceof H && (n.leftDelim === "?" || n.leftDelim === ".") && np(o, n.rightDelim)) {
n.isDirty = true, n.leftDelim = o, t37.mathfield.snapshot();
let m = t37.extractAtoms([t37.offsetOf(i.firstSibling), t37.position]);
for (let h of m)
n.parent.addChildBefore(h, n);
return t37.contentDidChange({ data: o, inputType: "insertText" }), t37.mathfield.snapshot("insert-fence"), true;
}
if (!(n instanceof H && n.leftDelim === "|")) {
if (o === "(") {
let m = t37.position - 1, h = false;
for (; m >= 0; ) {
let f = t37.at(m);
if (f.type === "first")
break;
if (f.type === "mord" && f.value && /^[\d]$/.test(f.value)) {
m -= 1;
continue;
}
if (f.type === "group" && ((l = f.body) == null ? void 0 : l.length) === 2 && f.body[0].type === "first" && f.body[1].value === ",") {
h = true;
break;
}
if (f.type === "mord" && (f.value === "," || f.value === ".")) {
h = true;
break;
}
break;
}
if (h)
return false;
}
if (t37.mathfield.snapshot(), z.insert(t37, `\\left${o}\\right?`, { format: "latex", style: r }), i.lastSibling.type !== "first") {
let m = t37.offsetOf(i.lastSibling), h = t37.extractAtoms([t37.position, m]);
t37.at(t37.position).body = h, t37.position -= 1;
}
return t37.mathfield.snapshot("insert-fence"), true;
}
}
if (a) {
if (o === ")") {
let f = t37.position - 1, b = false;
for (; f >= 0; ) {
let S = t37.at(f);
if (S.type === "first")
break;
if (S.type === "mord" && S.value && /^[\d]$/.test(S.value)) {
b = true, f -= 1;
continue;
}
break;
}
if (b && t37.at(f).type === "mopen" && t37.at(f).value === "(")
return false;
}
let c = i;
for (; c; ) {
if (c.type === "mopen" && c.value === a) {
t37.mathfield.snapshot();
let f = c.leftSibling, b = t37.extractAtoms([t37.offsetOf(c.leftSibling), t37.offsetOf(i)]);
[, ...b] = b;
let S = new H("left...right", b, { leftDelim: a, rightDelim: o });
return n.addChildrenAfter([S], f), t37.position = t37.offsetOf(S), t37.contentDidChange({ data: o, inputType: "insertText" }), t37.mathfield.snapshot("insert-fence"), true;
}
c = c.leftSibling;
}
if (n instanceof H && i.isLastSibling && Gl(n.leftDelim, o))
return t37.mathfield.snapshot(), n.isDirty = true, n.rightDelim = o, t37.position += 1, t37.contentDidChange({ data: o, inputType: "insertText" }), t37.mathfield.snapshot("insert-fence"), true;
let u = t37.offsetOf(i.firstSibling), d;
for (d = t37.position; d >= u; d--) {
let f = t37.at(d);
if (f instanceof H && (f.rightDelim === "?" || f.rightDelim === ".") && Gl(f.leftDelim, o))
break;
}
let m = t37.at(d);
if (d >= u && m instanceof H)
return t37.mathfield.snapshot(), m.rightDelim = o, m.addChildren(t37.extractAtoms([d, t37.position]), m.parentBranch), t37.contentDidChange({ data: o, inputType: "insertText" }), t37.mathfield.snapshot("insert-fence"), true;
if (n instanceof H && (n.rightDelim === "?" || n.rightDelim === ".") && Gl(n.leftDelim, o))
return t37.mathfield.snapshot(), n.isDirty = true, n.rightDelim = o, n.parent.addChildren(t37.extractAtoms([t37.position, t37.offsetOf(i.lastSibling)]), n.parentBranch), t37.position = t37.offsetOf(n), t37.contentDidChange({ data: o, inputType: "insertText" }), t37.mathfield.snapshot("insert-fence"), true;
let h = n.parent;
return h instanceof H && (h.rightDelim === "?" || h.rightDelim === ".") && t37.at(t37.position).isLastSibling ? (t37.position = t37.offsetOf(h), jl(t37, o, r)) : false;
}
return false;
}
function Gl(t37, e) {
return t37 ? ["(", "\\lparen", "{", "\\{", "\\lbrace", "[", "\\lbrack"].includes(t37) ? [")", "\\rparen", "}", "\\}", "\\rbrace", "]", "\\rbrack"].includes(e) : zi[t37] === e : true;
}
function np(t37, e) {
return e ? [")", "\\rparen", "}", "\\}", "\\rbrace", "]", "\\rbrack"].includes(e) ? ["(", "\\lparen", "{", "\\{", "\\lbrace", "[", "\\lbrack"].includes(t37) : Ni[e] === t37 : true;
}
ae({ undo: (t37) => (t37.undo(), true), redo: (t37) => (t37.redo(), true), scrollIntoView: (t37) => (t37.scrollIntoView(), true), scrollToStart: (t37) => (t37.field.scroll(0, 0), true), scrollToEnd: (t37) => {
let e = t37.field.getBoundingClientRect();
return t37.field.scroll(e.left - window.scrollX, 0), true;
}, toggleKeystrokeCaption: tp, toggleContextMenu: (t37) => {
let e = t37.toggleContextMenu();
return e || t37.model.announce("plonk"), e;
}, plonk: (t37) => (t37.model.announce("plonk"), true), switchMode: (t37, e, r, i) => (t37.switchMode(e, r, i), true), insert: (t37, e, r) => t37.insert(e, r), typedText: (t37, e, r) => (ro(t37, e, r), true), insertDecimalSeparator: (t37) => {
let e = t37.model;
return e.mode === "math" && globalThis.MathfieldElement.decimalSeparator === "," && e.at(Math.max(e.position, e.anchor)).isDigit() ? (t37.insert("{,}", { format: "latex" }), t37.snapshot("insert-mord"), true) : (t37.insert("."), true);
}, commit: (t37) => {
var e;
return t37.model.contentWillChange({ inputType: "insertLineBreak" }) && ((e = t37.host) == null || e.dispatchEvent(new Event("change", { bubbles: true, composed: true })), t37.model.contentDidChange({ inputType: "insertLineBreak" })), true;
}, insertPrompt: (t37, e, r) => {
let i = t37.getPrompts(), n = "prompt-" + Date.now().toString(36).slice(-2) + Math.floor(Math.random() * 1e5).toString(36), o = 0;
for (; i.includes(n) && o < 100; ) {
if (o === 99)
return console.error("could not find a unique ID after 100 tries"), false;
n = "prompt-" + Date.now().toString(36).slice(-2) + Math.floor(Math.random() * 1e5).toString(36), o++;
}
return t37.insert(`\\placeholder[${e != null ? e : n}]{}`, r), true;
} });
ae({ copyToClipboard: (t37) => (t37.focus(), t37.model.selectionIsCollapsed && t37.select(), "queryCommandSupported" in document && document.queryCommandSupported("copy") && document.execCommand("copy") || t37.element.querySelector(".ML__keyboard-sink").dispatchEvent(new ClipboardEvent("copy", { bubbles: true, composed: true })), false) }, { target: "mathfield" });
ae({ cutToClipboard: (t37) => (t37.focus(), "queryCommandSupported" in document && document.queryCommandSupported("cut") && document.execCommand("cut") || t37.element.querySelector(".ML__keyboard-sink").dispatchEvent(new ClipboardEvent("cut", { bubbles: true, composed: true })), true), pasteFromClipboard: (t37) => (t37.focus(), "queryCommandSupported" in document && document.queryCommandSupported("paste") ? (document.execCommand("paste"), true) : (navigator.clipboard.readText().then((e) => {
e && t37.model.contentWillChange({ inputType: "insertFromPaste", data: e }) ? (t37.stopCoalescingUndo(), t37.stopRecording(), t37.insert(e, { mode: t37.model.mode }) && (kr(t37), t37.startRecording(), t37.snapshot("paste"), t37.model.contentDidChange({ inputType: "insertFromPaste" }), V(t37))) : t37.model.announce("plonk"), t37.startRecording();
}), true)) }, { target: "mathfield", canUndo: true, changeContent: true, changeSelection: true });
function ts(t37) {
let [e, r] = te(t37.selection);
if (e = op(t37, e, "backward"), r = op(t37, r, "forward"), e === r) {
let i = t37.at(e);
if (i.type === "leftright")
return t37.setSelection(t37.offsetOf(i.firstChild) - 1, r);
if (i.type === "first" && (i.parent.type === "leftright" || i.parent.type === "surd"))
return t37.setSelection(e - 1, t37.offsetOf(i.parent.lastChild) + 1);
t37.setSelection(e - 1, r);
} else
t37.setSelection(e, r);
return true;
}
function op(t37, e, r) {
var o, a, s;
let i = t37.at(e);
if (!i)
return e;
let n = r === "forward" ? 1 : -1;
if (i.mode === "text") {
for (; i && !(i.mode !== "text" || !Dr.test(i.value)); )
e += n, i = t37.at(e);
return r === "backward" ? e - 1 : e;
}
if (i.mode === "latex") {
if (/[a-zA-Z\*]/.test(i.value))
if (r === "backward")
for (; i && i.mode === "latex" && i.value !== "\\" && /[a-zA-Z]/.test(i.value); )
e += n, i = t37.at(e);
else
for (; i && i.mode === "latex" && /[a-zA-Z\*]/.test(i.value); )
e += n, i = t37.at(e);
else if (i.value === "{") {
if (r === "forward") {
for (; i && i.mode === "latex" && i.value !== "}"; )
e += n, i = t37.at(e);
return e;
}
return e - 1;
} else if (i.value === "}") {
if (r === "backward") {
for (; i && i.mode === "latex" && i.value !== "{"; )
e += n, i = t37.at(e);
return e - 1;
}
return e;
}
return e - 1;
}
if (i.mode === "math") {
if (i.isDigit()) {
for (; (o = t37.at(e + n)) != null && o.isDigit(); )
e += n;
return r === "backward" ? e - 1 : e;
}
if (i.style.variant || i.style.variantStyle) {
let l = (a = t37.at(e)) == null ? void 0 : a.style;
for (; l && l.variant === i.style.variant && l.variantStyle === i.style.variantStyle; )
l = (s = t37.at(e + n)) == null ? void 0 : s.style, e += n;
return r === "backward" ? e - 1 : e;
}
return e;
}
return e;
}
ae({ selectGroup: (t37) => {
let e = ts(t37);
return e || t37.announce("plonk"), e;
}, selectAll: (t37) => t37.setSelection(0, t37.lastOffset), extendSelectionForward: (t37) => He(t37, "forward", { extend: true }), extendSelectionBackward: (t37) => He(t37, "backward", { extend: true }), extendToNextWord: (t37) => Sr(t37, "forward", { extend: true }), extendToPreviousWord: (t37) => Sr(t37, "backward", { extend: true }), extendSelectionUpward: (t37) => He(t37, "upward", { extend: true }), extendSelectionDownward: (t37) => He(t37, "downward", { extend: true }), extendToNextBoundary: (t37) => Sr(t37, "forward", { extend: true }), extendToPreviousBoundary: (t37) => Sr(t37, "backward", { extend: true }), extendToGroupStart: (t37) => {
let e = t37.setSelection(t37.anchor, t37.offsetOf(t37.at(t37.position).firstSibling));
return e || t37.announce("plonk"), e;
}, extendToGroupEnd: (t37) => {
let e = t37.setSelection(t37.anchor, t37.offsetOf(t37.at(t37.position).lastSibling));
return e || t37.announce("plonk"), e;
}, extendToMathFieldStart: (t37) => {
let e = t37.setSelection(t37.anchor, 0);
return e || t37.announce("plonk"), e;
}, extendToMathFieldEnd: (t37) => {
let e = t37.setSelection(t37.anchor, t37.lastOffset);
return e || t37.announce("plonk"), e;
} }, { target: "model", changeSelection: true });
var li = null;
var io = 0;
var ci = class t35 {
static start(e, r, i, n) {
var a;
t35.element = e, (a = t35.controller) == null || a.abort(), t35.controller = new AbortController();
let o = { signal: t35.controller.signal };
"PointerEvent" in window ? (e.addEventListener("pointermove", i, o), e.addEventListener("pointerup", n, o), e.addEventListener("pointercancel", n, o), Zl(r) && (t35.pointerId = r.pointerId, e.setPointerCapture(r.pointerId))) : (window.addEventListener("mousemove", i, o), window.addEventListener("blur", n, o), window.addEventListener("mouseup", n, o));
}
static stop() {
var e;
(e = t35.controller) == null || e.abort(), t35.controller = void 0, typeof t35.pointerId == "number" && (t35.element.releasePointerCapture(t35.pointerId), t35.pointerId = void 0);
}
};
function Zl(t37) {
return t37 !== null && globalThis.PointerEvent !== void 0 && t37 instanceof PointerEvent;
}
function Yl(t37, e) {
var M;
if (e.buttons > 1)
return;
t37.atomBoundsCache = /* @__PURE__ */ new Map();
let r = t37, i, n = false, o = false, a = "none", s = false, l = false, c = e.clientX, u = e.clientY, d = Date.now(), m = r.field, h = setInterval(() => {
s ? m.scroll({ top: 0, left: m.scrollLeft - 16 }) : l && m.scroll({ top: 0, left: m.scrollLeft + 16 });
}, 32);
function f() {
ci.stop(), n = false, clearInterval(h), t37.element.classList.remove("tracking"), e && e.preventDefault();
}
function b(x) {
if (!r.hasFocus()) {
f();
return;
}
let v = x.clientX, k = x.clientY, C = Zl(x) && x.pointerType === "touch" ? 20 : 5;
if (Date.now() < d + 500 && Math.abs(c - v) < C && Math.abs(u - k) < C) {
x.preventDefault(), x.stopPropagation();
return;
}
let q = m.getBoundingClientRect();
l = v > q.right, s = v < q.left;
let B = i;
Zl(x) && (x.isPrimary || (B = no(r, x.clientX, x.clientY, { bias: 0 })));
let D = no(r, v, k, { bias: v <= c ? v === c ? 0 : -1 : 1 });
B >= 0 && D >= 0 && (r.model.extendSelectionTo(B, D), V(t37)), o && ts(r.model);
}
li && Math.abs(li.x - c) < 5 && Math.abs(li.y - u) < 5 && Date.now() < li.time + 500 ? (io += 1, li.time = d) : (li = { x: c, y: u, time: d }, io = 1);
let S = m.getBoundingClientRect();
if (c >= S.left && c <= S.right && u >= S.top && u <= S.bottom) {
if (t37.flushInlineShortcutBuffer(), i = no(t37, c, u, { bias: 0 }), i !== t37.model.anchor && (t37.defaultStyle = {}, t37.styleBias = "left"), i >= 0) {
if (t37.element.classList.add("tracking"), e.shiftKey) {
let x = t37.model.selectionIsCollapsed;
t37.model.extendSelectionTo(t37.model.anchor, i), Kl(t37.model) || x ? a = "all" : a = "selection";
} else
t37.model.at(i).type === "placeholder" ? (t37.model.setSelection(i - 1, i), a = "selection") : ((M = t37.model.at(i).rightSibling) == null ? void 0 : M.type) === "placeholder" ? (t37.model.setSelection(i, i + 1), a = "selection") : (t37.model.position = i, Kl(t37.model) ? a = "all" : a = "selection");
e.detail === 3 || io > 2 ? (f(), (e.detail === 3 || io === 3) && (t37.model.selection = { ranges: [[0, t37.model.lastOffset]] }, a = "all")) : n || (n = true, ci.start(m, e, b, f), (e.detail === 2 || io === 2) && (o = true, ts(t37.model), a = "all"));
}
t37.hasFocus() || (a = "none", t37.focus({ preventScroll: true }));
} else
li = null;
t37.stopCoalescingUndo(), a !== "none" && (t37.model.selectionIsCollapsed && (a = "all"), V(t37)), e.preventDefault();
}
function sg(t37, e, r) {
if (t37 >= r.left && t37 <= r.right && e >= r.top && e <= r.bottom)
return 0;
let i = t37 - (r.left + r.right) / 2, n = e - (r.top + r.bottom) / 2;
return i * i + n * n;
}
function ap(t37, e, r, i, n) {
if (!r.id)
return [1 / 0, null];
if (e.has(r.id))
return e.get(r.id);
let o = qr(t37, r);
if (!o)
return [1 / 0, null];
let a = [1 / 0, null];
if (r.hasChildren && !r.captureSelection && i >= o.left && i <= o.right)
for (let s of r.children) {
let l = ap(t37, e, s, i, n);
l[0] <= a[0] && (a = l);
}
return a[1] || (a = [sg(i, n, o), r]), e.set(r.id, a), a;
}
function lg(t37, e, r) {
let [, i] = ap(t37, /* @__PURE__ */ new Map(), t37.model.root, e, r);
return i;
}
function no(t37, e, r, i) {
var c;
let n = t37.field.querySelector(".ML__latex").getBoundingClientRect();
if (!n)
return 0;
if (e > n.right || r > n.bottom + 8)
return t37.model.lastOffset;
if (e < n.left || r < n.top - 8)
return 0;
i = i != null ? i : {}, i.bias = (c = i.bias) != null ? c : 0;
let o = lg(t37, e, r), a = [], s = o;
for (; s; )
a.unshift(s), s = s.parent;
for (let u of a)
if (u.captureSelection) {
o = u;
break;
}
let l = t37.model.offsetOf(o);
if (l < 0)
return -1;
if (o.leftSibling)
if (i.bias === 0 && o.type !== "placeholder") {
let u = qr(t37, o);
u && e < (u.left + u.right) / 2 && (l = t37.model.offsetOf(o.leftSibling));
} else
i.bias < 0 && (l = t37.model.offsetOf(o.leftSibling));
return l;
}
var Ql = class extends z {
constructor() {
super("math");
}
onPaste(e, r) {
if (!r || !e.model.contentWillChange({ data: typeof r == "string" ? r : null, dataTransfer: typeof r == "string" ? null : r, inputType: "insertFromPaste" }))
return false;
let i = "", n = "auto", o = typeof r != "string" ? r.getData("application/json+mathlive") : "";
if (o)
try {
let a = JSON.parse(o);
if (a && Array.isArray(a)) {
e.snapshot();
let s = ot(a), { model: l } = e;
l.selectionIsCollapsed || l.deleteAtoms(te(l.selection));
let c = l.at(l.position);
if (c.parent instanceof N) {
c.parentBranch;
let u = [], d = [];
s[0].type === "first" && s.shift(), s[s.length - 1].type === "first" && s.pop();
for (let b of s)
b.type === "first" && d.length > 0 ? (u.push(d), d = [b]) : d.push(b);
d.length > 0 && u.push(d);
let m = Number(c.parentBranch[0]), h = Number(c.parentBranch[1]), f = c.parent.maxColumns;
for (; c.parent.colCount - h < u.length && c.parent.colCount < f; )
c.parent.addColumn();
c.parent.addChildrenAfter(u[0], c);
for (let b = 1; b < u.length; b++)
h++, h >= f && (h = 0, c.parent.addRowAfter(m), m++), c.parent.setCell(m, h, u[b]);
} else
c.parent.addChildrenAfter(s.filter((u) => u.type !== "first"), c);
return l.position = l.offsetOf(s[s.length - 1]), l.contentDidChange({ inputType: "insertFromPaste" }), V(e), true;
}
} catch (a) {
}
if (o = typeof r != "string" ? r.getData("application/json") : "", o && globalThis.MathfieldElement.computeEngine)
try {
let a = JSON.parse(o);
if (typeof a == "object" && "latex" in a && a.latex && (i = a.latex), !i) {
let s = globalThis.MathfieldElement.computeEngine.box(a);
s && !s.has("Error") && (i = s.latex);
}
i || (n = "latex");
} catch (a) {
}
if (!i && typeof r != "string" && (i = r.getData("application/x-latex"), i && (n = "latex")), i || (i = typeof r == "string" ? r : r.getData("text/plain")), i) {
let a;
return [a, i] = _a(i), n === "auto" && a && (n = "latex"), e.stopCoalescingUndo(), e.stopRecording(), this.insert(e.model, i, { format: n }) && (e.startRecording(), e.snapshot("paste"), V(e)), e.startRecording(), true;
}
return false;
}
insert(e, r, i) {
var x, v;
let n = typeof r == "string" ? r : (v = (x = globalThis.MathfieldElement.computeEngine) == null ? void 0 : x.box(r).latex) != null ? v : "";
if (!i.silenceNotifications && !e.contentWillChange({ data: n, inputType: "insertText" }))
return false;
i.insertionMode || (i.insertionMode = "replaceSelection"), i.selectionMode || (i.selectionMode = "placeholder"), i.format || (i.format = "auto");
let { silenceNotifications: o } = e;
i.silenceNotifications && (e.silenceNotifications = true);
let a = e.silenceNotifications;
e.silenceNotifications = true;
let s = { "?": "\\placeholder{}", "@": "\\placeholder{}" };
s[0] = i.insertionMode === "replaceAll" ? "" : e.getValue(e.selection, "latex-unstyled"), i.insertionMode === "replaceSelection" && !e.selectionIsCollapsed ? e.deleteAtoms(te(e.selection)) : i.insertionMode === "replaceAll" ? e.deleteAtoms() : i.insertionMode === "insertBefore" ? e.collapseSelection("backward") : i.insertionMode === "insertAfter" && e.collapseSelection("forward"), !e.at(e.position).isLastSibling && e.at(e.position + 1).type === "placeholder" ? e.deleteAtoms([e.position, e.position + 1]) : e.at(e.position).type === "placeholder" && e.deleteAtoms([e.position - 1, e.position]);
let l = -1;
s[0] ? s["@"] = s[0] : typeof r == "string" && /(^|[^\\])#@/.test(r) && (l = cg(e), l >= 0 && (s["@"] = e.getValue(l, e.position, "latex"))), s[0] || (s[0] = s["?"]);
let c = false, u = (k) => (c = true, s[k]), [d, m] = sp(e, r, u, i);
if (!m)
return false;
let h = m.length === 1 && m[0].type === "genfrac";
h && l >= 0 && typeof e.mathfield.options.isImplicitFunction == "function" && e.mathfield.options.isImplicitFunction(e.at(e.position).command) ? (s["@"] = s["?"], c = false, [d, m] = sp(e, r, u, i)) : l >= 0 && e.deleteAtoms([l, e.position]);
let { parent: f } = e.at(e.position), b = f.hasEmptyBranch("body");
if (h && d !== "latex" && e.mathfield.options.removeExtraneousParentheses && f instanceof H && f.leftDelim === "(" && b) {
let k = f.parent, C = f.parentBranch;
k.removeChild(f), k.setChildren(m, C);
}
let S = e.at(e.position);
S.parent.addChildrenAfter(m, S), d === "latex" && typeof r == "string" && (f == null ? void 0 : f.type) === "root" && b && !c && (f.verbatimLatex = r), e.silenceNotifications = a;
let M = m[m.length - 1];
if (i.selectionMode === "placeholder") {
let k = m.flatMap((C) => [C, ...C.children]).find((C) => C.type === "placeholder");
if (k) {
let C = e.offsetOf(k);
e.setSelection(C - 1, C), e.announce("move");
} else
M && (e.position = e.offsetOf(M));
} else
i.selectionMode === "before" || (i.selectionMode === "after" ? M && (e.position = e.offsetOf(M)) : i.selectionMode === "item" && e.setSelection(e.anchor, e.offsetOf(M)));
return e.contentDidChange({ data: n, inputType: "insertText" }), e.silenceNotifications = o, true;
}
};
function sp(t37, e, r, i) {
var a;
let n, o = [];
if (typeof e != "string" || i.format === "math-json") {
let s = globalThis.MathfieldElement.computeEngine;
if (!s)
return ["math-json", []];
[n, e] = ["latex", s.box(e).latex], o = se(e, { context: t37.mathfield.context });
} else
typeof e == "string" && i.format === "ascii-math" ? ([n, e] = qt(e, { format: "ascii-math", inlineShortcuts: t37.mathfield.options.inlineShortcuts }), o = se(e, { context: t37.mathfield.context }), n !== "latex" && t37.mathfield.options.removeExtraneousParentheses && (o = o.map((s) => rs(s)))) : (i.format === "auto" || (a = i.format) != null && a.startsWith("latex")) && (i.format === "auto" && ([n, e] = qt(e, { format: "auto", inlineShortcuts: t37.mathfield.options.inlineShortcuts })), i.format === "latex" && ([, e] = _a(e)), o = se(e, { context: t37.mathfield.context, args: r }), i.format !== "latex" && t37.mathfield.options.removeExtraneousParentheses && (o = o.map((s) => rs(s))));
return Dt(o, i.style), [n != null ? n : "latex", o];
}
function rs(t37) {
var e;
if (t37 instanceof H && t37.leftDelim !== "(" && t37.rightDelim === ")") {
let r = (e = t37.body) == null ? void 0 : e.filter((i) => i.type !== "first");
if ((r == null ? void 0 : r.length) === 1 && r[0].type === "genfrac")
return r[0];
}
for (let r of t37.branches)
t37.hasEmptyBranch(r) || t37.setChildren(t37.branch(r).map((i) => rs(i)), r);
return t37 instanceof N && t37.forEachCell((r, i, n) => {
t37.setCell(i, n, r.map((o) => rs(o)));
}), t37;
}
function cg(t37) {
let e = t37.at(t37.position);
if (e.mode === "text") {
for (; !e.isFirstSibling && e.mode === "text"; )
e = e.leftSibling;
return t37.offsetOf(e);
}
let r = e, i = false;
if (e.type === "mclose") {
let n = Ni[e.value];
for (; !e.isFirstSibling && !(e.type === "mopen" && e.value === n); )
e = e.leftSibling;
e.isFirstSibling || (e = e.leftSibling), i = true;
} else
e.type === "leftright" && (e = e.leftSibling, i = true);
if (i)
for (; !e.isFirstSibling && (e.isFunction || lp(e)); )
e = e.leftSibling;
else {
let n = [];
for (; !e.isFirstSibling && (lp(e) || n.length > 0); )
e.type === "mclose" && n.unshift(e.value), e.type === "mopen" && n.length > 0 && e.value === Ni[n[0]] && n.shift(), e = e.leftSibling;
}
return r === e ? -1 : t37.offsetOf(e);
}
function lp(t37) {
return t37.isDigit() ? true : t37.type && /^(mord|surd|subsup|leftright|mop|mclose)$/.test(t37.type) ? t37.type !== "extensible-symbol" : false;
}
new Ql();
var ec = class extends z {
constructor() {
super("text");
}
onPaste(e, r) {
if (!r)
return false;
let i = typeof r == "string" ? r : r.getData("text/plain");
return i && e.model.contentWillChange({ inputType: "insertFromPaste", data: i }) ? (e.stopCoalescingUndo(), e.stopRecording(), this.insert(e.model, i) && (e.model.contentDidChange({ inputType: "insertFromPaste" }), e.startRecording(), e.snapshot("paste"), V(e)), e.startRecording(), true) : false;
}
insert(e, r, i = {}) {
if (!e.contentWillChange({ data: r, inputType: "insertText" }))
return false;
i.insertionMode || (i.insertionMode = "replaceSelection"), i.selectionMode || (i.selectionMode = "placeholder"), i.format || (i.format = "auto");
let { silenceNotifications: n } = e;
i.silenceNotifications && (e.silenceNotifications = true);
let o = e.silenceNotifications;
e.silenceNotifications = true, i.insertionMode === "replaceSelection" && !e.selectionIsCollapsed ? e.deleteAtoms(te(e.selection)) : i.insertionMode === "replaceAll" ? (e.root.setChildren([], "body"), e.position = 0) : i.insertionMode === "insertBefore" ? e.collapseSelection("backward") : i.insertionMode === "insertAfter" && e.collapseSelection("forward");
let a = ug(r, e.mathfield.context);
if (Dt(a, i.style), !a)
return false;
let s = e.at(e.position), l = s.parent.addChildrenAfter(a, s);
return e.silenceNotifications = o, i.selectionMode === "before" || (i.selectionMode === "item" ? e.setSelection(e.anchor, e.offsetOf(l)) : l && (e.position = e.offsetOf(l))), e.contentDidChange({ data: r, inputType: "insertText" }), e.silenceNotifications = n, true;
}
};
function ug(t37, e) {
return t37 = t37.replace(/\\/g, "\\textbackslash "), t37 = t37.replace(/#/g, "\\#"), t37 = t37.replace(/\$/g, "\\$"), t37 = t37.replace(/%/g, "\\%"), t37 = t37.replace(/&/g, "\\&"), t37 = t37.replace(/_/g, "\\_"), t37 = t37.replace(/{/g, "\\textbraceleft "), t37 = t37.replace(/}/g, "\\textbraceright "), t37 = t37.replace(/lbrace/g, "\\textbraceleft "), t37 = t37.replace(/rbrace/g, "\\textbraceright "), t37 = t37.replace(/\^/g, "\\textasciicircum "), t37 = t37.replace(/~/g, "\\textasciitilde "), t37 = t37.replace(/£/g, "\\textsterling "), se(t37, { context: e, parseMode: "text" });
}
new ec();
function We(t37) {
return { value: t37.model.getValue(), selectionIsCollapsed: t37.model.selectionIsCollapsed, canUndo: t37.canUndo(), canRedo: t37.canRedo(), style: dg(t37.model), mode: t37.model.mode };
}
function dg(t37) {
var i;
if (t37.selectionIsCollapsed)
return (i = t37.at(t37.position)) == null ? void 0 : i.style;
let e = t37.getAtoms(t37.selection);
if (e.length === 0)
return {};
let r = p({}, e[0].style);
for (let n of e)
for (let [o, a] of Object.entries(n.style))
r[o] !== a && delete r[o];
return r;
}
var Y = 4;
var Te = 20;
var le = 2 * (Te + Y);
var is = (t37, e) => `
<line x1="${t37 + Te}" y1="${e + Te}"
x2="${t37 > e ? t37 + Te : 7 * Te + 10 * Y}"
y2="${t37 < e ? e + Te : 7 * Te + 10 * Y}"/>
<svg id="plus" viewBox="0 0 40 40" x="${t37}" y="${e}" width="40" height="40">
<circle class="cls-2" cx="20" cy="20" r="20"/>
<path class="font" d="m33.33,20c0,1.84-1.49,3.34-3.33,3.34h-6.67v6.66c0,1.84-1.49,3.34-3.33,3.34s-3.34-1.5-3.34-3.34v-6.66h-6.66c-1.84,0-3.34-1.5-3.34-3.34s1.5-3.33,3.34-3.33h6.66v-6.67c0-1.84,1.5-3.33,3.34-3.33s3.33,1.49,3.33,3.33v6.67h6.67c1.84,0,3.33,1.49,3.33,3.33Z"/>
</svg>`;
var cp = (t37, e) => `
<line x1="${t37 + Te}" y1="${e + Te}"
x2="${t37 > e ? t37 + Te : 7 * Te + 10 * Y}"
y2="${t37 < e ? e + Te : 7 * Te + 10 * Y}"/>
<svg id="minus" viewBox="0 0 40 40" x="${t37}" y="${e}" width="40" height="40">
<circle class="cls-2" cx="20" cy="20" r="20"/>
<path class="font" d="m33.33,20c0,1.84-1.49,3.33-3.33,3.33H10c-1.84,0-3.34-1.49-3.34-3.33s1.5-3.34,3.34-3.34h20c1.84,0,3.33,1.5,3.33,3.34Z"/>
</svg>`;
var ns = (t37, e, r) => `
<svg id="arrow" viewBox="0 0 40 40" x="${t37}" y="${e}" width="40" height="40">
<circle class="cls-2" cx="20" cy="20" r="20"/>
<g transform="rotate(${r})" transform-origin="20 20">
<path class="font" d="m17.7,7.23h4.6c.52,0,.94.42.94.94v13.82c0,.52.42.94.94.94h3.39c.83,0,1.25,1.01.66,1.6l-7.56,7.56c-.37.37-.96.37-1.32,0l-7.56-7.56c-.59-.59-.17-1.6.66-1.6h3.39c.52,0,.94-.42.94-.94v-13.82c0-.52.42-.94.94-.94Z"/>
</g>
</svg>`;
var mg = `
<svg class="MLEP__array-buttons" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
viewBox=
"-2 -2 ${8 * Te + 10 * Y + 5} ${8 * Te + 10 * Y + 5}">
<rect
class="MLEP__array-insert-background rows"
x="0"
y="${le + Y}"
height="${3 * le}"
width="${le}"
rx="${le / 2}"/>
<rect
class="MLEP__array-insert-background columns"
x="${le + Y}"
y="0"
height="${le}"
width="${3 * le}"
rx="${le / 2}"/>
<g data-command='"moveDown"'>
${ns(2 * (Y + le), 2 * Y + 3 * le, 0)}
</g>
<g data-command='"moveUp"'>
${ns(2 * (Y + le), 2 * Y + le, 180)}
</g>
<g data-command='"moveToNextWord"'>
${ns(2 * Y + 3 * le, 2 * (Y + le), -90)}
</g>
<g data-command='"moveToPreviousWord"'>
${ns(2 * Y + le, 2 * (Y + le), 90)}
</g>
<g>
<g data-command='"addColumnBefore"'>
${is(2 * Y + le, Y)}
</g>
<g data-command='"removeColumn"'>
${cp(2 * Y + 2 * le, Y)}
</g>
<g data-command='"addColumnAfter"'>
${is(2 * Y + 3 * le, Y)}
</g>
<g data-command='"addRowBefore"'>
${is(Y, 2 * Y + le)}
</g>
<g data-command='"removeRow"'>
${cp(Y, 2 * Y + 2 * le)}
</g>
<g data-command='"addRowAfter"'>
${is(Y, 2 * Y + 3 * le)}
</g>
</svg>`;
var pg = (t37) => `
<svg id="matrix" class="${t37}" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 28 24"
data-command='["setEnvironment","matrix"]'>
<rect class="cls-1" width="28" height="24"/>
<circle cx="10" cy="8" r="1"/>
<circle cx="14" cy="12" r="1"/>
<circle cx="18" cy="16" r="1"/></svg>`;
var hg = (t37) => `
<svg id="pmatrix" class="${t37}" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 28 24"
data-command='["setEnvironment","pmatrix"]'>
<rect class="cls-1" width="28" height="24"/>
<path class="cls-2" d="m6,4c-3.96,4.6-3.96,11.4,0,16"/>
<path class="cls-2" d="m22,4c3.96,4.6,3.96,11.4,0,16"/>
<circle cx="10" cy="8" r="1"/>
<circle cx="14" cy="12" r="1"/>
<circle cx="18" cy="16" r="1"/></svg>`;
var up = (t37) => `
<svg id="Bmatrix" class="${t37}" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 28 24"
data-command='["setEnvironment","Bmatrix"]'>
<rect class="cls-1" width="28" height="24"/>
<path class="cls-2" d="m6,4c-1.1,0-2,.9-2,2v3c0,1.66-.9,3-2,3,1.1,0,2,1.34,2,3v3c0,1.1.9,2,2,2"/>
<path class="cls-2" d="m22,4c1.1,0,2,.9,2,2v3c0,1.66.9,3,2,3-1.1,0-2,1.34-2,3v3c0,1.1-.9,2-2,2"/>
<circle cx="10" cy="8" r="1"/>
<circle cx="14" cy="12" r="1"/>
<circle cx="18" cy="16" r="1"/>
</svg>`;
var fg = (t37) => `
<svg id="bmatrix" class="${t37}" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 28 24"
data-command='["setEnvironment","bmatrix"]'>
<rect class="cls-1" width="28" height="24"/>
<path class="cls-2" d="m6,4h-3v16h3"/>
<path class="cls-2" d="m22,4h3v16h-3"/>
<circle cx="10" cy="8" r="1"/>
<circle cx="14" cy="12" r="1"/>
<circle cx="18" cy="16" r="1"/>
</svg>`;
var gg = (t37) => `
<svg id="vmatrix" class="${t37}" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 28 24"
data-command='["setEnvironment","vmatrix"]'>
<rect class="cls-1" width="28" height="24"/>
<circle cx="10" cy="8" r="1"/>
<circle cx="14" cy="12" r="1"/>
<circle cx="18" cy="16" r="1"/>
<line class="cls-2" x1="4" y1="4" x2="4" y2="20"/>
<line class="cls-2" x1="24" y1="4" x2="24" y2="20"/>
</svg>`;
var yg = (t37) => `
<svg id="Vmatrix" class="${t37}" xmlns="http://www.w3.org/2000/svg" viewBox="-3.5 -3 35 30"
data-command='["setEnvironment","Vmatrix"]'>
<rect class="cls-1" width="28" height="24"/>
<circle cx="10" cy="8" r="1"/>
<circle cx="14" cy="12" r="1"/>
<circle cx="18" cy="16" r="1"/>
<line class="cls-2" x1="6" y1="4" x2="6" y2="20"/>
<line class="cls-2" x1="22" y1="4" x2="22" y2="20"/>
<line class="cls-2" x1="2" y1="4" x2="2" y2="20"/>
<line class="cls-2" x1="26" y1="4" x2="26" y2="20"/>
</svg>`;
var bg = (t37) => `
<svg id="cases" class="${t37}" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 28 24"
data-command='["setEnvironment","cases"]'>
<rect class="cls-1" width="28" height="24"/>
<path class="cls-2" d="m10,4c-1.1,0-2,.9-2,2v3c0,1.66-.9,3-2,3,1.1,0,2,1.34,2,3v3c0,1.1.9,2,2,2"/>
<circle cx="13" cy="8" r="1"/>
<circle cx="13" cy="16" r="1"/>
<circle cx="21" cy="8" r="1"/>
<circle cx="21" cy="16" r="1"/>
</svg>`;
var xg = (t37) => `
<svg id="rcases" class="${t37}" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 28 24"
data-command='["setEnvironment","rcases"]'>
<rect class="cls-1" width="28" height="24"/>
<path class="cls-2" d="m18,20c1.1,0,2-.9,2-2v-3c0-1.66.9-3,2-3-1.1,0-2-1.34-2-3v-3c0-1.1-.9-2-2-2"/>
<circle cx="15" cy="8" r="1"/>
<circle cx="15" cy="16" r="1"/>
<circle cx="7" cy="8" r="1"/>
<circle cx="7" cy="16" r="1"/>
</svg>`;
var tc = { matrix: pg, pmatrix: hg, bmatrix: fg, Bmatrix: up, vmatrix: gg, Vmatrix: yg };
var rc = { cases: bg, rcases: xg, Bmatrix: up };
function vg(t37) {
var m, b;
let e = (m = t37.model.parentEnvironment) == null ? void 0 : m.array;
if (!e)
return;
let r = 0;
e.forEach((S) => {
(!r || S.length > r) && (r = S.length);
});
let i = document.getElementById("mathlive-environment-popover");
i || (i = Yr("mathlive-environment-popover"), Oe("environment-popover"), Oe("core"), i.setAttribute("aria-hidden", "true"));
let n, o = i.querySelector(".MLEP__environment-controls");
o ? n = o : (n = document.createElement("div"), i.innerHTML = "", i.appendChild(n)), n.className = "MLEP__environment-controls", n.style.display = "flex", n.style.width = "100%", n.style.height = "100%", n.style.boxSizing = "border-box", n.innerHTML = mg;
let a = [], s = "", l = t37.model.parentEnvironment.environmentName;
if (Sa(l)) {
let S = _g(l);
s = tc[S]("active");
let h = tc, { [S]: M } = h, x = fi(h, [bs(S)]);
a = Object.values(x).map((v) => v("inactive"));
} else if (sm(l)) {
let S = Mg(l);
s = rc[S]("active");
let f = rc, { [S]: M } = f, x = fi(f, [bs(S)]);
a = Object.values(x).map((v) => v("inactive"));
} else
lm(l) && (s = tc.matrix("active"), a = Object.values(rc).map((S) => S("inactive")));
let c = document.createElement("div");
c.className = "MLEP__environment-delimiter-controls", c.style.display = "flex", c.style.flexDirection = "column", c.innerHTML = `
<div class='MLEP__array-delimiter-options'>
${s}
${a.join("")}
</div>`, s && n.appendChild(c), n.querySelectorAll("[data-command]").forEach((S) => {
let M = S.dataset.command, x = M;
try {
x = JSON.parse(M);
} catch (v) {
}
S.addEventListener("mousedown", (v) => v.preventDefault()), x && S.addEventListener("click", () => t37.executeCommand(x));
});
let d = (b = t37.field) == null ? void 0 : b.getBoundingClientRect();
d && (i.style.top = `${window.scrollY + (d.top - i.clientHeight - 15)}px`, i.style.left = `${d.left + 20}px`, i.classList.add("is-visible"));
}
function os() {
let t37 = document.getElementById("mathlive-environment-popover");
t37 == null || t37.classList.remove("is-visible");
}
function dp() {
document.getElementById("mathlive-environment-popover") && (Zi("mathlive-environment-popover"), Ve("environment-popover"), Ve("core"));
}
function oo(t37) {
if (!t37.hasFocus())
return;
let e = false;
if (t37.model.mode === "math") {
let r = t37.model.parentEnvironment;
if (r != null && r.array && am(r.environmentName)) {
let i = t37.options.environmentPopoverPolicy;
e = i === "auto" || i === "on";
}
}
e ? vg(t37) : os();
}
function _g(t37) {
return t37.replace("*", "");
}
function Mg(t37) {
return t37 === "dcases" ? "cases" : t37;
}
function as(t37) {
let e = getComputedStyle(t37).direction;
return e === "ltr" || e === "rtl" ? e : "ltr";
}
function nc(t37, e, r) {
return e === "left" || e === "leading" && r === "ltr" || e === "trailing" && r === "rtl" ? t37.left : t37.right;
}
function ic(t37, e, r, i) {
return r === "middle" ? t37 - e / 2 : r === "start" && i === "rtl" || r === "end" && i === "ltr" || r === "top" || r === "right" ? Math.max(0, t37 - e) : t37;
}
function wg(t37, e, r, i) {
return r === "middle" ? t37 - e / 2 : r === "start" && i === "ltr" || r === "end" && i === "rtl" || r === "top" || r === "right" ? t37 : t37 - e;
}
function mp(t37, e) {
var u, d, m;
let r = (u = as(t37)) != null ? u : "ltr";
t37.style.position = "fixed", t37.style.left = "", t37.style.top = "", t37.style.right = "", t37.style.bottom = "", t37.style.height = "", t37.style.width = "";
let i = t37.getBoundingClientRect(), n = Number.isFinite(e.maxHeight) ? Math.min(e.maxHeight, window.innerHeight) : window.innerHeight, o = Math.min(n, (d = e.height) != null ? d : i.height), a = ic(e.location.y, o, e.verticalPos, r);
a + o > window.innerHeight - 8 && (e.alternateLocation ? (a = ic(e.alternateLocation.y, o, e.verticalPos, r), a + o > window.innerHeight - 8 && (a = void 0)) : a = void 0), Number.isFinite(a) || (a = Math.max(8, window.innerHeight - 8 - o), 8 + o > window.innerHeight - 8 && (t37.style.bottom = "8px")), o = Math.min(a + o, window.innerHeight - 8) - a;
let s = Number.isFinite(e.maxWidth) ? Math.min(e.maxWidth, window.innerWidth) : window.innerWidth, l = Math.min(s, (m = e.width) != null ? m : i.width), c = ic(e.location.x, l, e.horizontalPos, r);
c + l > window.innerWidth - 8 && (e.alternateLocation ? (c = wg(e.alternateLocation.x, l, e.verticalPos, r), c + l > window.innerWidth - 8 && (c = void 0)) : c = void 0), Number.isFinite(c) || (c = Math.max(8, window.innerWidth - 8 - l), 8 + l > window.innerWidth - 8 && (t37.style.right = "8px")), l = Math.min(c + l, window.innerWidth - 8) - c, r === "rtl" ? t37.style.right = `${Math.ceil(window.innerWidth - c - l).toString()}px` : t37.style.left = `${Math.ceil(c).toString()}px`, t37.style.top = `${Math.ceil(a).toString()}px`, o !== i.height && (t37.style.height = `${Math.ceil(o).toString()}px`), l !== i.width && (t37.style.width = `${Math.ceil(l).toString()}px`);
}
function pp(t37, e) {
return Math.hypot(e.x - t37.x, e.y - t37.y);
}
function Lr(t37) {
return "submenu" in t37;
}
function dt(t37) {
return "type" in t37 && t37.type === "command" || "onMenuSelect" in t37 || "id" in t37;
}
function ao(t37) {
return "type" in t37 && t37.type === "divider";
}
function ss(t37) {
return "type" in t37 && t37.type === "heading";
}
var hp = {};
function ls(t37) {
let e = hp[t37];
if (!e) {
let r;
switch (t37) {
case "checkmark":
r = `<span aria-hidden="true" class="ui-checkmark"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="currentColor" d="M435.848 83.466L172.804 346.51l-96.652-96.652c-4.686-4.686-12.284-4.686-16.971 0l-28.284 28.284c-4.686 4.686-4.686 12.284 0 16.971l133.421 133.421c4.686 4.686 12.284 4.686 16.971 0l299.813-299.813c4.686-4.686 4.686-12.284 0-16.971l-28.284-28.284c-4.686-4.686-12.284-4.686-16.97 0z"></path></svg>
</span>`;
break;
case "trailing-chevron":
r = '<span aria-hidden="true" class="ui-trailing-chevron"><svg focusable="false" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 512"><path fill="currentColor" d="M285.476 272.971L91.132 467.314c-9.373 9.373-24.569 9.373-33.941 0l-22.667-22.667c-9.357-9.357-9.375-24.522-.04-33.901L188.505 256 34.484 101.255c-9.335-9.379-9.317-24.544.04-33.901l22.667-22.667c9.373-9.373 24.569-9.373 33.941 0L285.475 239.03c9.373 9.372 9.373 24.568.001 33.941z"></path></svg></span>';
break;
case "mixedmark":
r = '<span aria-hidden="true" class="ui-mixedmark"><svg xmlns="http://www.w3.org/2000/svg" width="16" viewBox="0 0 512 512"><path fill="currentColor" d="M0 256c0-13.3 10.7-24 24-24H488c13.3 0 24 10.7 24 24s-10.7 24-24 24H24c-13.3 0-24-10.7-24-24z"/></svg></span>';
}
if (r) {
let i = document.createElement("template");
i.innerHTML = r, hp[t37] = i, e = i;
}
}
if (e) {
if ("content" in e)
return e.content.cloneNode(true);
let r = document.createElement("svg");
return r.innerHTML = e.innerHTML, r;
}
}
var fp = 80;
var ln = class {
constructor(e, r) {
this._className = "";
this._element = null;
var i;
this.parentMenu = r, this._declaration = e, Object.freeze(this._declaration), Lr(e) ? (this.type = "submenu", this.submenu = new cn(e.submenu, { parentMenu: r, submenuClass: e.submenuClass, columnCount: e.columnCount })) : this.type = (i = e.type) != null ? i : "command", this.hasCheck = dt(e) && e.checked !== void 0;
}
get rootMenu() {
return this.parentMenu.rootMenu;
}
get abortController() {
return this._abortController || (this._abortController = new AbortController()), this._abortController;
}
dispose() {
var e, r;
(e = this._abortController) == null || e.abort(), this._abortController = void 0, (r = this._element) == null || r.remove(), this._element = null, this.submenu && this.submenu.dispose(), this.submenu = void 0;
}
get menuItem() {
return this._declaration;
}
get label() {
var e;
return (e = this._label) != null ? e : "";
}
set label(e) {
e === void 0 && (e = ""), e !== this._label && (this._label = e, this.dirty = true);
}
get visible() {
return this._visible;
}
set visible(e) {
e !== this._visible && (this._visible = e, this.dirty = true);
}
get enabled() {
return this._enabled;
}
set enabled(e) {
this._enabled = e, this.element && (e ? this.element.removeAttribute("aria-disabled") : this.element.setAttribute("aria-disabled", "true")), this.dirty = true;
}
get checked() {
return this._checked;
}
set checked(e) {
this._checked = e, this.dirty = true;
}
get tooltip() {
return this._tooltip;
}
set tooltip(e) {
e !== this._tooltip && (this._tooltip = e, this.dirty = true);
}
get ariaLabel() {
return this._ariaLabel;
}
set ariaLabel(e) {
e !== this._ariaLabel && (this._ariaLabel = e, this.dirty = true);
}
get active() {
var e, r;
return (r = (e = this.element) == null ? void 0 : e.classList.contains("active")) != null ? r : false;
}
set active(e) {
this.element && this.element.classList.toggle("active", e);
}
updateState(e) {
var i, n, o;
let r = this._declaration;
if (ao(r)) {
this.enabled = false, this.checked = false;
return;
}
ss(r) && (this.enabled = false, this.checked = false, this.visible = true), dt(r) && (this.checked = (i = ui(r.checked, e)) != null ? i : false), (dt(r) || Lr(r)) && (this.enabled = (n = ui(r.enabled, e)) != null ? n : true, this.visible = (o = ui(r.visible, e)) != null ? o : true, this.visible && this.enabled && this.submenu && (this.submenu.updateState(e), this.submenu.visible || (this.visible = false))), (dt(r) || ss(r) || Lr(r)) && (this.label = ui(r.label, e), this._className = ui(r.class, e), this.tooltip = ui(r.tooltip, e), this.ariaLabel = ui(r.ariaLabel, e)), this._element && this.updateElement();
}
set dirty(e) {
e && this.parentMenu && (this.parentMenu.dirty = true);
}
updateElement() {
var i;
if (!this.visible || !this.element)
return;
let e = this.element;
e.textContent = "", e.className = "", e.className = (i = this._className) != null ? i : "", this.enabled ? e.removeAttribute("aria-disabled") : e.setAttribute("aria-disabled", "true"), this.checked === true ? (e.setAttribute("aria-checked", "true"), e.append(ls("checkmark"))) : this.checked === "mixed" ? (e.setAttribute("aria-checked", "mixed"), e.append(ls("mixedmark"))) : e.removeAttribute("aria-checked"), this.ariaLabel && e.setAttribute("aria-label", this.ariaLabel);
let r = document.createElement("span");
if (r.className = this.parentMenu.hasCheck ? "label indent" : "label", this.type === "heading" && r.classList.add("heading"), r.innerHTML = this.label, e.append(r), this._tooltip && e.setAttribute("data-tooltip", this._tooltip), dt(this._declaration) && this._declaration.keyboardShortcut) {
let n = document.createElement("kbd");
n.innerHTML = ji(this._declaration.keyboardShortcut), e.append(n);
}
this.type === "submenu" && e.append(ls("trailing-chevron"));
}
get element() {
if (this._element)
return this._element;
if (ao(this._declaration)) {
let i = document.createElement("li");
return i.setAttribute("part", "menu-divider"), i.setAttribute("role", "divider"), this._element = i, i;
}
let e = document.createElement("li");
this._element = e, (dt(this._declaration) || ss(this._declaration) || Lr(this._declaration)) && e.setAttribute("part", "menu-item"), e.setAttribute("tabindex", "-1"), this.hasCheck ? e.setAttribute("role", "menuitemcheckbox") : e.setAttribute("role", "menuitem"), this.type === "submenu" && (e.setAttribute("aria-haspopup", "true"), e.setAttribute("aria-expanded", "false"));
let r = this.abortController.signal;
return e.addEventListener("pointerenter", this, { signal: r }), e.addEventListener("pointerleave", this, { signal: r }), e.addEventListener("pointerup", this, { signal: r }), e.addEventListener("click", this, { signal: r }), this._element;
}
dispatchSelect() {
var i;
if (!dt(this._declaration))
return;
let e = new CustomEvent("menu-select", { cancelable: true, bubbles: true, detail: { modifiers: this.rootMenu.modifiers, id: this._declaration.id, data: this._declaration.data } });
this.parentMenu.dispatchEvent(e) && typeof this._declaration.onMenuSelect == "function" && this._declaration.onMenuSelect({ target: (i = this.parentMenu.host) != null ? i : void 0, modifiers: this.rootMenu.modifiers, id: this._declaration.id, data: this._declaration.data });
}
handleEvent(e) {
var r;
if (!(!this.visible || !this.enabled)) {
if (e.type === "click") {
this.rootMenu.state === "modal" && this.select(), e.stopPropagation(), e.preventDefault();
return;
}
if (e.type === "pointerenter") {
let i = e;
this.rootMenu.cancelDelayedOperation(), this.parentMenu.isSubmenuOpen && ((r = this.parentMenu.activeMenuItem) != null && r.movingTowardSubmenu(i)) ? this.rootMenu.scheduleOperation(() => {
this.parentMenu.activeMenuItem = this, this.openSubmenu();
}) : (this.parentMenu.activeMenuItem = this, this.openSubmenu({ withDelay: true }));
return;
}
if (e.type === "pointerleave") {
this.rootMenu.activeSubmenu === this.parentMenu && (this.parentMenu.activeMenuItem = null);
return;
}
if (e.type === "pointerup") {
this.rootMenu.state !== "modal" && this.select(), e.stopPropagation(), e.preventDefault();
return;
}
}
}
select() {
if (this.rootMenu.cancelDelayedOperation(), this.type === "submenu") {
this.openSubmenu();
return;
}
this.active = false, setTimeout(() => {
this.active = true, setTimeout(() => {
this.active = false, this.rootMenu.hide(), this.dispatchSelect();
}, fp);
}, fp);
}
openSubmenu(e) {
var n;
if (this.type !== "submenu" || !this.element)
return;
if ((n = e == null ? void 0 : e.withDelay) != null && n) {
this.rootMenu.scheduleOperation(() => this.openSubmenu());
return;
}
let r = this.element.getBoundingClientRect(), i = as(this.element);
this.submenu.show({ container: this.rootMenu.element.parentNode, location: { x: nc(r, "trailing", i), y: r.top - 4 }, alternateLocation: { x: nc(r, "leading", i), y: r.top - 4 } });
}
movingTowardSubmenu(e) {
if (!this.element || this.type !== "submenu")
return false;
let r = this.rootMenu.lastMoveEvent;
if (!r)
return false;
let i = e.timeStamp - r.timeStamp;
if (i > 500)
return false;
let n = e.clientX - r.clientX;
if (kg(n, r.clientY - e.clientY, i) <= 0.2)
return false;
let a = "right";
if (this.submenu.element) {
let s = this.submenu.element.getBoundingClientRect(), l = this.element.getBoundingClientRect();
s.left < l.left + l.width / 2 && (a = "left");
}
return a === "right" ? n > 0 : n < 0;
}
};
function kg(t37, e, r) {
return Math.hypot(t37, e) / r;
}
function ui(t37, e) {
return t37 === void 0 || typeof t37 != "function" ? t37 : (e != null || (e = { alt: false, control: false, shift: false, meta: false }), t37(e));
}
var cn = class t36 {
constructor(e, r) {
this._element = null;
this._activeMenuItem = null;
this._dirty = true;
var i, n;
this.parentMenu = (i = r == null ? void 0 : r.parentMenu) != null ? i : null, this._submenuClass = r == null ? void 0 : r.submenuClass, this.columnCount = (n = r == null ? void 0 : r.columnCount) != null ? n : 1, this.isSubmenuOpen = false, this.menuItems = e;
}
get children() {
return Object.freeze([...this._menuItems]);
}
set menuItems(e) {
let r = this.parentMenu;
this.dispose(), this.parentMenu = r, e = [...e], this._menuItems = e.map((i) => i.onCreate ? i.onCreate(i, this) : new ln(i, this)), this.hasCheck = void 0, this.dirty = true;
}
dispose() {
var e;
this.hide(), this._element && this._element.remove(), this._abortController && this._abortController.abort(), (e = this._menuItems) == null || e.forEach((r) => r.dispose()), this._menuItems = [], this._activeMenuItem = null, this.parentMenu = null;
}
handleEvent(e) {
if (e.type === "wheel" && this._element) {
let r = e;
this._element.scrollBy(0, r.deltaY), e.stopPropagation();
}
}
dispatchEvent(e) {
return this.rootMenu.dispatchEvent(e);
}
get host() {
return this.rootMenu.host;
}
get rootMenu() {
return this.parentMenu.rootMenu;
}
updateState(e) {
var a, s, l;
this._menuItems.forEach((c) => c.updateState(e));
let r = this.hasCheck;
this.hasCheck = this._menuItems.some((c) => c.visible && c.hasCheck), this.hasCheck !== r && this._menuItems.forEach((c) => c.updateState(e));
let i, n = 0;
for (let c of this._menuItems)
c.type === "heading" ? (i && n === 0 && (i.visible = false), i = c, n = 0) : c.type === "divider" && i ? (i.visible = n > 0, i = void 0, n = 0) : i && c.visible && (n += 1);
i && (i.visible = n > 0);
let o = true;
for (let c of this._menuItems)
c.type === "divider" ? (c.visible = !o, o = true) : c.visible && (o = false);
(a = this.activeMenuItem) != null && a.visible || (this.activeMenuItem = null), !((s = this.activeMenuItem) != null && s.enabled) && ((l = this.activeMenuItem) == null ? void 0 : l.type) === "submenu" && this._activeMenuItem.submenu.hide(), this._dirty = false;
}
get enabled() {
return this.updateIfDirty(), this._menuItems.some((e) => e.type !== "divider" && e.visible && e.enabled);
}
get visible() {
return this.updateIfDirty(), this._menuItems.some((e) => e.type !== "divider" && e.visible);
}
set dirty(e) {
this._dirty !== e && e && this.parentMenu && (this._dirty = true, this.parentMenu.dirty = true);
}
updateIfDirty() {
this._dirty && this.updateState(this.rootMenu.modifiers);
}
updateElement() {
var e;
if (this._element) {
this._element.textContent = "";
for (let { element: r, visible: i } of this._menuItems)
r && i && this._element.append(r);
(e = this._element.querySelector("li:first-of-type")) == null || e.setAttribute("tabindex", "0");
}
}
get element() {
if (this._element)
return this._element;
let e = document.createElement("menu");
e.setAttribute("role", "menu"), e.setAttribute("tabindex", "-1"), e.setAttribute("aria-orientation", "vertical"), e.setAttribute("part", "ui-menu-container"), this._submenuClass && e.classList.add(this._submenuClass), e.classList.add("ui-menu-container"), this._abortController || (this._abortController = new AbortController());
let r = this._abortController.signal;
return e.addEventListener("focus", this, { signal: r }), e.addEventListener("wheel", this, { passive: true, signal: r }), this._element = e, this.updateElement(), e;
}
get activeMenuItem() {
return this._activeMenuItem;
}
set activeMenuItem(e) {
var r, i, n, o;
if (this.rootMenu.cancelDelayedOperation(), e !== this._activeMenuItem) {
if (this.activeMenuItem) {
let a = this.activeMenuItem;
a.active = false, (r = a.submenu) == null || r.hide();
}
if (!((i = e == null ? void 0 : e.visible) == null || i)) {
this._activeMenuItem = null;
return;
}
this._activeMenuItem = e, e && (e.active = true);
}
e ? (n = e.element) == null || n.focus({ preventScroll: true }) : (o = this._element) == null || o.focus({ preventScroll: true });
}
get firstMenuItem() {
this.updateIfDirty();
let e = 0, r = false, i = this._menuItems;
for (; !r && e <= i.length - 1; ) {
let n = i[e];
r = n.type !== "divider" && n.visible && n.enabled, e += 1;
}
return r ? i[e - 1] : null;
}
get lastMenuItem() {
this.updateIfDirty();
let e = this._menuItems, r = e.length - 1, i = false;
for (; !i && r >= 0; ) {
let n = e[r];
i = n.type !== "divider" && n.visible && n.enabled, r -= 1;
}
return i ? e[r + 1] : null;
}
nextMenuItem(e) {
if (e === 0)
return this._activeMenuItem;
if (!this._activeMenuItem)
return e > 0 ? this.firstMenuItem : this.lastMenuItem;
if (!this.firstMenuItem || !this.lastMenuItem || !this._activeMenuItem)
return null;
this.updateIfDirty();
let r = this._menuItems.indexOf(this.firstMenuItem), i = this._menuItems.indexOf(this.lastMenuItem), n = this._menuItems.indexOf(this._activeMenuItem), o = 1;
for (; n >= r && n <= i; ) {
n += e > 0 ? 1 : -1;
let a = this._menuItems[n];
if (!a)
break;
if (a.visible && a.enabled) {
if (o === Math.abs(e))
return this._menuItems[n];
o += 1;
}
}
return e > 0 ? this.lastMenuItem : this.firstMenuItem;
}
getMenuItemColumn(e) {
this.updateIfDirty();
let i = this._menuItems.filter((n) => n.visible && n.enabled).indexOf(e);
return i < 0 ? -1 : i % this.columnCount;
}
static get collator() {
return t36._collator || (t36._collator = new Intl.Collator(void 0, { usage: "search", sensitivity: "base" })), t36._collator;
}
findMenuItem(e) {
var a;
this.updateIfDirty();
let r = this._menuItems.filter((s) => s.type !== "divider" && s.visible && s.enabled);
if (r.length === 0)
return null;
let i = Math.max(...r.map((s) => s.label.length)) - e.length;
if (i < 0)
return null;
let n = null, o = 0;
for (; o < i && !n; )
n = (a = r.find((s) => t36.collator.compare(e, s.label.substring(o, e.length)) === 0)) != null ? a : null, o++;
return n;
}
show(e) {
return !this.visible || !e.container ? false : (this.updateElement(), e.container.appendChild(this.element), xs() && (this.element.popover = "manual", this.element.showPopover()), e.location && mp(this.element, { location: e.location, alternateLocation: e.alternateLocation, verticalPos: "bottom", horizontalPos: "start" }), gp(), this.element.focus({ preventScroll: true }), yp(), this.parentMenu && (this.parentMenu.openSubmenu = this), true);
}
hide() {
var e, r, i, n, o;
this.openSubmenu = null, this.activeMenuItem = null, this.parentMenu && (this.parentMenu.openSubmenu = null), xs() && ((e = this._element) != null && e.popover) && this.element.hidePopover(), gp(), (i = (r = this.parentMenu) == null ? void 0 : r.element) == null || i.focus(), (o = (n = this._element) == null ? void 0 : n.parentNode) == null || o.removeChild(this._element), yp();
}
set openSubmenu(e) {
var i, n, o, a;
let r = e !== null;
((i = this.activeMenuItem) == null ? void 0 : i.type) === "submenu" && ((n = this.activeMenuItem.element) == null || n.setAttribute("aria-expanded", r.toString())), (a = (o = this.activeMenuItem) == null ? void 0 : o.element) == null || a.classList.toggle("is-submenu-open", r), this.isSubmenuOpen = r;
}
};
function gp() {
document.addEventListener("focusin", Ar, true), document.addEventListener("focusout", Ar, true), document.addEventListener("focus", Ar, true), document.addEventListener("blur", Ar, true);
}
function Ar(t37) {
t37.stopImmediatePropagation(), t37.preventDefault();
}
function yp() {
document.removeEventListener("focusin", Ar, true), document.removeEventListener("focusout", Ar, true), document.removeEventListener("focus", Ar, true), document.removeEventListener("blur", Ar, true);
}
var us = class us2 extends cn {
constructor(r, i) {
var n;
super(r);
this.state = "closed";
this.typingBufferResetTimer = 0;
this.hysteresisTimer = 0;
this._updating = false;
this._host = (n = i == null ? void 0 : i.host) != null ? n : null, this.isDynamic = r.some(bp), this._modifiers = { shift: false, control: false, alt: false, meta: false }, this.typingBuffer = "", this.state = "closed";
}
get modifiers() {
return this._modifiers;
}
set modifiers(r) {
Em(this._modifiers, r) || (this._modifiers = r, this.dirty = true);
}
get activeSubmenu() {
let r = this;
for (; r.isSubmenuOpen; )
r = r.activeMenuItem.submenu;
return r;
}
set dirty(r) {
this._updating || this._dirty !== r && (this._dirty = true, r && setTimeout(() => {
this.updateState(this.modifiers), this.updateElement();
}));
}
updateState(r) {
this._updating = true, this.modifiers = r != null ? r : this.modifiers, super.updateState(this.modifiers), this._updating = false;
}
handleKeyupEvent(r) {
this.isDynamic && (this.modifiers = Kt(r)), r.stopImmediatePropagation();
}
handleKeydownEvent(r) {
var a, s, l;
if (r.key === "Tab" || r.key === "Escape") {
this.hide();
return;
}
this.isDynamic && (this.modifiers = Kt(r));
let i = true, n = this.activeSubmenu, o = n.activeMenuItem;
switch (r.key) {
case " ":
case "Space":
case "Return":
case "Enter":
o == null || o.select(Kt(r));
break;
case "ArrowRight":
if ((o == null ? void 0 : o.type) === "submenu")
o.select(Kt(r)), this.activeSubmenu.activeMenuItem = this.activeSubmenu.firstMenuItem;
else if (!o)
n.activeMenuItem = n.firstMenuItem;
else {
let c = (a = n.getMenuItemColumn(o)) != null ? a : -1;
if (c >= 0 && c < ((s = n.columnCount) != null ? s : 1) - 1) {
let u = n.nextMenuItem(1);
u && (n.activeMenuItem = u);
}
}
break;
case "ArrowLeft":
if (n === this.rootMenu)
o || (n.activeMenuItem = n.firstMenuItem);
else if ((o && (l = n.getMenuItemColumn(o)) != null ? l : -1) <= 0 || !o) {
n.hide();
let u = n.parentMenu.activeMenuItem;
if (u) {
let { element: d } = u;
d == null || d.focus(), d == null || d.classList.remove("is-submenu-open");
}
} else {
let u = n.nextMenuItem(-1);
u && (n.activeMenuItem = u);
}
break;
case "ArrowDown":
n.activeMenuItem = n.nextMenuItem(n.columnCount);
break;
case "ArrowUp":
n.activeMenuItem = n.nextMenuItem(-n.columnCount);
break;
case "Home":
case "PageUp":
n.activeMenuItem = n.firstMenuItem;
break;
case "End":
case "PageDown":
n.activeMenuItem = n.lastMenuItem;
break;
case "Backspace":
if (this.typingBuffer && (this.typingBuffer = this.typingBuffer.slice(0, -1), this.typingBuffer)) {
clearTimeout(this.typingBufferResetTimer);
let c = n.findMenuItem(this.typingBuffer);
c && (n.activeMenuItem = c), this.typingBufferResetTimer = setTimeout(() => {
this.typingBuffer = "";
}, 500);
}
break;
default:
if (_r(r)) {
isFinite(this.typingBufferResetTimer) && clearTimeout(this.typingBufferResetTimer), this.typingBuffer += r.key;
let c = n.findMenuItem(this.typingBuffer);
c && (n.activeMenuItem = c), this.typingBufferResetTimer = setTimeout(() => {
this.typingBuffer = "";
}, 500);
} else
i = false;
}
i && (r.preventDefault(), r.stopPropagation());
}
handleEvent(r) {
if (r.type === "keydown")
this.handleKeydownEvent(r);
else if (r.type === "keyup")
this.handleKeyupEvent(r);
else if (r.type === "pointermove")
this.lastMoveEvent = r;
else if (r.type === "pointerup" && r.target === this.scrim)
Number.isFinite(this.rootMenu._openTimestamp) && Date.now() - this.rootMenu._openTimestamp < 120 ? this.state = "modal" : this.state === "modal" && this.hide();
else if (r.type === "contextmenu") {
r.preventDefault(), r.stopPropagation();
return;
}
super.handleEvent(r);
}
dispatchEvent(r) {
return this._host ? this._host.dispatchEvent(r) : true;
}
get host() {
return this._host;
}
get scrim() {
return _e.element;
}
connectScrim(r) {
let i = this.scrim;
i.addEventListener("pointerup", this), i.addEventListener("contextmenu", this), i.addEventListener("keydown", this), i.addEventListener("keyup", this), i.addEventListener("pointermove", this), _e.open({ root: r, onDismiss: () => this.hide() });
}
disconnectScrim() {
let r = this.scrim;
r.removeEventListener("pointerup", this), r.removeEventListener("contextmenu", this), r.removeEventListener("keydown", this), r.removeEventListener("keyup", this), r.removeEventListener("pointermove", this), _e.state === "open" && _e.scrim.close();
}
get rootMenu() {
return this;
}
show(r) {
return this._onDismiss = r == null ? void 0 : r.onDismiss, r != null && r.modifiers && (this.modifiers = r.modifiers), this.updateState(), this.connectScrim(r == null ? void 0 : r.target), super.show(g(p({}, r), { container: this.scrim })) ? (this._openTimestamp = Date.now(), this.state = "open", true) : (this.disconnectScrim(), false);
}
hide() {
this.cancelDelayedOperation(), this.state !== void 0 && (this.state !== "closed" && (this.activeMenuItem = null, _e.element.parentElement.focus(), super.hide(), this.state = "closed", this.disconnectScrim()), this._onDismiss && (this._onDismiss(), this._onDismiss = void 0));
}
scheduleOperation(r) {
this.cancelDelayedOperation();
let i = us2.SUBMENU_DELAY;
if (i <= 0) {
r();
return;
}
this.hysteresisTimer = setTimeout(() => {
this.hysteresisTimer = 0, r();
}, i);
}
cancelDelayedOperation() {
this.hysteresisTimer && (clearTimeout(this.hysteresisTimer), this.hysteresisTimer = 0);
}
};
us.SUBMENU_DELAY = 120;
var cs = us;
function bp(t37) {
return ao(t37) ? false : typeof t37.label == "function" || typeof t37.ariaLabel == "function" || typeof t37.tooltip == "function" || (dt(t37) || Lr(t37)) && (typeof t37.enabled == "function" || typeof t37.visible == "function") || dt(t37) && typeof t37.checked == "function" ? true : Lr(t37) ? t37.submenu.some(bp) : false;
}
var un = class {
};
un.DELAY = 300, un.MAX_DISTANCE = 10;
function xp(t37) {
return new Promise((e, r) => {
let i = Xi(t37);
i || e(false);
let n = i, o = setTimeout(() => {
a.abort(), e(pp(n, i) < un.MAX_DISTANCE);
}, un.DELAY), a = new AbortController(), s = a.signal;
for (let l of ["pointermove", "pointerup", "pointercancel"])
window.addEventListener(l, (c) => {
if (c.type === "pointerup" || c.type === "pointercancel")
clearTimeout(o), a.abort(), e(false);
else if (c.type === "pointermove") {
let u = Xi(c);
u && (n = u);
}
}, { passive: true, signal: s });
});
}
async function oc(t37, e, r) {
if (t37.type === "contextmenu") {
let i = t37;
if (r.show({ target: e, location: Xi(i), modifiers: Kt(i) }))
return t37.preventDefault(), t37.stopPropagation(), true;
}
if (t37.type === "keydown") {
let i = t37;
if (i.code === "ContextMenu" || i.code === "F10" && i.shiftKey) {
let n = e == null ? void 0 : e.getBoundingClientRect();
if (n && r.show({ target: e, location: { x: Math.ceil(n.left + n.width / 2), y: Math.ceil(n.top + n.height / 2) }, modifiers: Kt(i) }))
return t37.preventDefault(), t37.stopPropagation(), true;
}
}
if (t37.type === "pointerdown" && t37.pointerType !== "mouse" && t37.button === 0) {
let i = t37.target;
for (; i && e !== i; )
i = i.parentNode;
if (!i || !r.visible)
return false;
let n = Xi(t37);
if (await xp(t37))
return r.state !== "closed" ? false : (r.show({ target: e, location: n }), true);
}
return false;
}
var vp = { acute: 714, grave: 715, dot: 729, ddot: 168, mathring: 730, tilde: 126, bar: 713, breve: 728, check: 711, hat: 94, vec: 8407 };
_(Object.keys(vp), "{body:auto}", { createAtom: (t37) => new xr(g(p({}, t37), { body: A(t37.args[0]), accentChar: vp[t37.command.slice(1)] })) });
_(["widehat", "widecheck", "widetilde"], "{body:auto}", { createAtom: (t37) => {
let e = As(A(t37.args[0]));
return new xr(g(p({}, t37), { body: A(t37.args[0]), svgAccent: t37.command.slice(1) + (e.length > 5 ? "4" : ["1", "1", "2", "2", "3", "3"][e.length]) }));
} });
_(["overarc", "overparen", "wideparen"], "{body:auto}", { createAtom: (t37) => new xr(g(p({}, t37), { body: A(t37.args[0]), svgAccent: "overarc" })) });
_(["underarc", "underparen"], "{body:auto}", { createAtom: (t37) => new ye(g(p({}, t37), { body: A(t37.args[0]), svgBelow: "underarc" })) });
_("utilde", "{body:auto}", { createAtom: (t37) => {
let e = A(t37.args[0]), r = As(e), i = "widetilde" + (r.length > 5 ? "4" : ["1", "1", "2", "2", "3", "3"][r.length]);
return new ye(g(p({}, t37), { body: e, svgBelow: i, boxType: Nr(e) }));
} });
_("^", "{:string}", { createAtom: (t37) => {
var e;
return new y(g(p({}, t37), { type: "mord", isFunction: false, limits: "adjacent", value: t37.args[0] && (e = { a: "\xE2", e: "\xEA", i: "\xEE", o: "\xF4", u: "\xFB", A: "\xC2", E: "\xCA", I: "\xCE", O: "\xD4", U: "\xDB" }[t37.args[0]]) != null ? e : "^" }));
} });
_("`", "{:string}", { createAtom: (t37) => {
var e;
return new y(g(p({}, t37), { type: "mord", isFunction: false, limits: "adjacent", value: t37.args[0] && (e = { a: "\xE0", e: "\xE8", i: "\xEC", o: "\xF2", u: "\xF9", A: "\xC0", E: "\xC8", I: "\xCC", O: "\xD2", U: "\xD9" }[t37.args[0]]) != null ? e : "`" }));
} });
_("'", "{:string}", { createAtom: (t37) => {
var e;
return new y(g(p({}, t37), { type: "mord", isFunction: false, limits: "adjacent", value: t37.args[0] && (e = { a: "\xE1", e: "\xE9", i: "\xED", o: "\xF3", u: "\xFA", A: "\xC1", E: "\xC9", I: "\xCD", O: "\xD3", U: "\xDA" }[t37.args[0]]) != null ? e : "'" }));
} });
_('"', "{:string}", { createAtom: (t37) => {
var e, r;
return new y(g(p({}, t37), { type: "mord", isFunction: false, limits: "adjacent", value: (e = t37.args) != null && e[0] ? (r = { a: "\xE4", e: "\xEB", i: "\xEF", o: "\xF6", u: "\xFC", A: "\xC4", E: "\xCB", I: "\xCB", O: "\xD6", U: "\xDC" }[t37.args[0]]) != null ? r : '"' + t37.args[0] : '"' }));
} });
_(".", "{:string}", { createAtom: (t37) => {
var e, r;
return new y(g(p({}, t37), { type: "mord", isFunction: false, limits: "adjacent", value: (e = t37.args) != null && e[0] ? (r = { a: "\u0227", e: "\u0117", i: "\u0307i", o: "\u022F", u: "\u0307u", A: "\u0226", E: "\u0116", I: "\u0130", O: "\u022E", U: "\u0307U" }[t37.args[0]]) != null ? r : "." + t37.args[0] : "." }));
} });
_("=", "{:string}", { createAtom: (t37) => {
var e, r;
return new y(g(p({}, t37), { type: "mord", isFunction: false, limits: "adjacent", value: (e = t37.args) != null && e[0] ? (r = { a: "\u0101", e: "\u0113", i: "\u012B", o: "\u014D", u: "\u016B", A: "\u0100", E: "\u0112", I: "\u012A", O: "\u014C", U: "\u016A" }[t37.args[0]]) != null ? r : "=" + t37.args[0] : "=" }));
} });
_("~", "{:string}", { createAtom: (t37) => {
var e;
return new y(g(p({ type: "mord" }, t37), { isFunction: false, limits: "adjacent", value: t37.args[0] && (e = { n: "\xF1", N: "\xD1", a: "\xE3", o: "\xF5", A: "\xC3", O: "\xD5" }[t37.args[0]]) != null ? e : "\xB4" }));
} });
_("c", "{:string}", { createAtom: (t37) => {
var e;
return new y(g(p({}, t37), { type: "mord", isFunction: false, limits: "adjacent", value: t37.args[0] && (e = { c: "\xE7", C: "\xC7" }[t37.args[0]]) != null ? e : "" }));
} });
_("enclose", "{notation:string}[style:string]{body:auto}", { createAtom: (t37) => {
var n, o;
let e = t37.args, r = { strokeColor: "currentColor", strokeWidth: "", strokeStyle: "solid", backgroundcolor: "transparent", padding: "auto", shadow: "none", svgStrokeStyle: void 0, borderStyle: void 0, style: (n = t37.style) != null ? n : {} };
if (e[1]) {
let a = e[1].split(/,(?![^(]*\)(?:(?:[^(]*\)){2})*[^"]*$)/);
for (let s of a) {
let l = s.match(/\s*(\S+)\s+(\S+)\s+(.*)/);
if (l)
r.strokeWidth = l[1], r.strokeStyle = l[2], r.strokeColor = l[3];
else {
let c = s.match(/\s*([a-z]*)\s*=\s*"(.*)"/);
c && (c[1] === "mathbackground" ? r.backgroundcolor = c[2] : c[1] === "mathcolor" ? r.strokeColor = c[2] : c[1] === "padding" ? r.padding = c[2] : c[1] === "shadow" && (r.shadow = c[2]));
}
}
r.strokeStyle === "dashed" ? r.svgStrokeStyle = "5,5" : r.strokeStyle === "dotted" && (r.svgStrokeStyle = "1,5");
}
r.borderStyle = `${r.strokeWidth} ${r.strokeStyle} ${r.strokeColor}`;
let i = {};
return ((o = e[0]) != null ? o : "").split(/[, ]/).filter((a) => a.length > 0).forEach((a) => {
i[a.toLowerCase()] = true;
}), new Ut(t37.command, A(e[2]), i, r);
} });
_("cancel", "{body:auto}", { createAtom: (t37) => {
var e;
return new Ut(t37.command, A(t37.args[0]), { updiagonalstrike: true }, { strokeColor: "currentColor", strokeWidth: "", strokeStyle: "solid", borderStyle: "1px solid currentColor", backgroundcolor: "transparent", padding: "auto", shadow: "none", style: (e = t37.style) != null ? e : {} });
} });
_("bcancel", "{body:auto}", { createAtom: (t37) => {
var e;
return new Ut(t37.command, A(t37.args[0]), { downdiagonalstrike: true }, { strokeColor: "currentColor", strokeWidth: "", strokeStyle: "solid", borderStyle: "1px solid currentColor", backgroundcolor: "transparent", padding: "auto", shadow: "none", style: (e = t37.style) != null ? e : {} });
} });
_("xcancel", "{body:auto}", { createAtom: (t37) => {
var e;
return new Ut(t37.command, A(t37.args[0]), { updiagonalstrike: true, downdiagonalstrike: true }, { strokeColor: "currentColor", strokeWidth: "", strokeStyle: "solid", borderStyle: "1px solid currentColor", backgroundcolor: "transparent", padding: "auto", shadow: "none", style: (e = t37.style) != null ? e : {} });
} });
_(["overrightarrow", "overleftarrow", "Overrightarrow", "overleftharpoon", "overrightharpoon", "overleftrightarrow", "overlinesegment", "overgroup"], "{:auto}", { createAtom: (t37) => {
var e;
return new ye(g(p({}, t37), { body: A((e = t37.args) == null ? void 0 : e[0]), skipBoundary: false, supsubPlacement: "over-under", paddedBody: true, boxType: "rel", svgAbove: t37.command.slice(1) }));
} });
_("overbrace", "{:auto}", { createAtom: (t37) => new ye(g(p({}, t37), { body: A(t37.args[0]), skipBoundary: false, supsubPlacement: "over-under", paddedBody: true, boxType: "ord", svgAbove: t37.command.slice(1) })) });
_(["underrightarrow", "underleftarrow", "underleftrightarrow", "underlinesegment", "undergroup"], "{:auto}", { createAtom: (t37) => new ye(g(p({}, t37), { body: A(t37.args[0]), skipBoundary: false, supsubPlacement: "over-under", paddedBody: true, boxType: "rel", svgBelow: t37.command.slice(1) })) });
_(["underbrace"], "{:auto}", { createAtom: (t37) => new ye(g(p({}, t37), { body: A(t37.args[0]), skipBoundary: false, supsubPlacement: "over-under", paddedBody: true, boxType: "ord", svgBelow: t37.command.slice(1) })) });
_(["xrightarrow", "longrightarrow", "xleftarrow", "longleftarrow", "xRightarrow", "xLeftarrow", "xleftharpoonup", "xleftharpoondown", "xrightharpoonup", "xrightharpoondown", "xlongequal", "xtwoheadleftarrow", "xtwoheadrightarrow", "xleftrightarrow", "longleftrightarrow", "xLeftrightarrow", "xrightleftharpoons", "longrightleftharpoons", "xleftrightharpoons", "xhookleftarrow", "xhookrightarrow", "xmapsto", "xtofrom", "xleftrightarrows", "longleftrightarrows", "xRightleftharpoons", "longRightleftharpoons", "xLeftrightharpoons", "longLeftrightharpoons"], "[:auto]{:auto}", { createAtom: (t37) => {
var e, r, i, n, o;
return new ye(g(p({}, t37), { svgBody: t37.command.slice(1), above: ((r = A((e = t37.args) == null ? void 0 : e[1])) == null ? void 0 : r.length) === 0 ? void 0 : A((i = t37.args) == null ? void 0 : i[1]), below: (o = A((n = t37.args) == null ? void 0 : n[0])) != null ? o : null, skipBoundary: false, supsubPlacement: "over-under", paddedBody: true, paddedLabels: true, boxType: "rel" }));
}, serialize: (t37, e) => t37.command + (t37.hasEmptyBranch("below") ? "" : `[${t37.belowToLatex(e)}]`) + `{${t37.aboveToLatex(e)}}${t37.supsubToLatex(e)}` });
_(["arccos", "arcsin", "arctan", "arctg", "arcctg", "arg", "ch", "cos", "cosh", "cot", "cotg", "coth", "ctg", "cth", "csc", "cosec", "deg", "dim", "exp", "gcd", "hom", "inf", "ker", "lb", "lg", "ln", "log", "Pr", "sec", "sh", "sin", "sinh", "sup", "tan", "tanh", "tg", "th", "arcsec", "arccsc", "arsinh", "arcosh", "artanh", "arcsech", "arccsch"], "", { isFunction: true, ifMode: "math", createAtom: (t37) => new at(t37.command.slice(1), g(p({}, t37), { limits: "adjacent", isFunction: true, variant: "main", variantStyle: "up" })) });
_(["liminf", "limsup"], "", { ifMode: "math", createAtom: (t37) => new at({ "\\liminf": "lim inf", "\\limsup": "lim sup" }[t37.command], g(p({}, t37), { limits: "over-under", variant: "main" })) });
_(["lim", "mod"], "", { ifMode: "math", createAtom: (t37) => new at(t37.command.slice(1), g(p({}, t37), { limits: "over-under", variant: "main" })) });
_(["det", "max", "min"], "", { ifMode: "math", isFunction: true, createAtom: (t37) => new at(t37.command.slice(1), g(p({}, t37), { limits: "over-under", isFunction: true, variant: "main" })) });
_(["ang"], "{:math}", { ifMode: "math", createAtom: (t37) => new y(g(p({}, t37), { body: A(t37.args[0]) })), serialize: (t37, e) => `\\ang{${t37.bodyToLatex(e)}}`, render: (t37, e) => {
let r = t37.createBox(e), i = r.caret;
r.caret = void 0;
let n = new w("\xB0", { style: g(p({}, t37.style), { variant: "normal", variantStyle: "up" }) });
return new w([r, n], { type: "inner", isSelected: t37.isSelected, caret: i });
} });
_("sqrt", "[index:auto]{radicand:expression}", { ifMode: "math", createAtom: (t37) => new Gi(g(p({}, t37), { body: A(t37.args[1]), index: t37.args[0] ? A(t37.args[0]) : void 0 })) });
_(["frac", "dfrac", "tfrac", "binom", "dbinom", "tbinom"], "{:expression}{:expression}", { ifMode: "math", createAtom: (t37) => {
let e = p({}, t37), r = t37.command, i = t37.args;
switch (r) {
case "\\dfrac":
case "\\frac":
case "\\tfrac":
e.hasBarLine = true;
break;
case "\\atopfrac":
e.hasBarLine = false;
break;
case "\\dbinom":
case "\\binom":
case "\\tbinom":
e.hasBarLine = false, e.leftDelim = "(", e.rightDelim = ")";
break;
case "\\cfrac":
e.hasBarLine = true, e.continuousFraction = true;
break;
default:
}
switch (r) {
case "\\dfrac":
case "\\dbinom":
e.mathstyleName = "displaystyle";
break;
case "\\tfrac":
case "\\tbinom":
e.mathstyleName = "textstyle";
break;
default:
}
return new it(i[0] ? A(i[0]) : [new ge()], i[1] ? A(i[1]) : [new ge()], e);
}, serialize: (t37, e) => {
let r = t37.aboveToLatex(e), i = t37.belowToLatex(e);
return /^[0-9]$/.test(r) && /^[0-9]$/.test(i) ? `${t37.command}${r}${i}` : I(t37.command, r, i);
} });
_(["cfrac"], "[:string]{:expression}{:expression}", { ifMode: "math", createAtom: (t37) => {
let e = p({}, t37), r = t37.args;
return e.hasBarLine = true, e.continuousFraction = true, r[0] === "r" && (e.align = "right"), r[0] === "l" && (e.align = "left"), new it(r[1] ? A(r[1]) : [new ge()], r[2] ? A(r[2]) : [new ge()], e);
}, serialize: (t37, e) => {
let r = t37.aboveToLatex(e), i = t37.belowToLatex(e);
return I(t37.command, r, i);
} });
_(["brace", "brack"], "", { infix: true, createAtom: (t37) => new it(A(t37.args[0]), A(t37.args[1]), g(p({}, t37), { hasBarLine: false, leftDelim: t37.command === "\\brace" ? "\\lbrace" : "\\lbrack", rightDelim: t37.command === "\\brace" ? "\\rbrace" : "\\rbrack" })), serialize: (t37, e) => K([t37.aboveToLatex(e), t37.command, t37.belowToLatex(e)]) });
_(["over", "atop", "choose"], "", { infix: true, createAtom: (t37) => {
let e, r, i = t37.args;
return t37.command === "\\choose" && (e = "(", r = ")"), new it(A(i[0]), A(i[1]), g(p({}, t37), { hasBarLine: t37.command === "\\over", leftDelim: e, rightDelim: r }));
}, serialize: (t37, e) => K([t37.aboveToLatex(e), t37.command, t37.belowToLatex(e)]) });
_(["overwithdelims", "atopwithdelims"], "{numer:auto}{denom:auto}{left-delim:delim}{right-delim:delim}", { infix: true, createAtom: (t37) => {
var r, i;
let e = t37.args;
return new it(A(e[0]), A(e[1]), g(p({}, t37), { leftDelim: (r = e[2]) != null ? r : ".", rightDelim: (i = e[3]) != null ? i : ".", hasBarLine: false }));
}, serialize: (t37, e) => `${t37.aboveToLatex(e)} ${t37.command}${t37.leftDelim}${t37.rightDelim}${t37.belowToLatex(e)}` });
_("pdiff", "{numerator}{denominator}", { ifMode: "math", createAtom: (t37) => new it(A(t37.args[0]), A(t37.args[1]), g(p({}, t37), { hasBarLine: true, numerPrefix: "\u2202", denomPrefix: "\u2202" })) });
_(["sum", "prod", "bigcup", "bigcap", "coprod", "bigvee", "bigwedge", "biguplus", "bigotimes", "bigoplus", "bigodot", "bigsqcup", "intop"], "", { ifMode: "math", createAtom: (t37) => new Ur({ coprod: "\u2210", bigvee: "\u22C1", bigwedge: "\u22C0", biguplus: "\u2A04", bigcap: "\u22C2", bigcup: "\u22C3", intop: "\u222B", prod: "\u220F", sum: "\u2211", bigotimes: "\u2A02", bigoplus: "\u2A01", bigodot: "\u2A00", bigsqcup: "\u2A06", smallint: "\u222B" }[t37.command.slice(1)], g(p({}, t37), { limits: "auto", variant: "main" })) });
_("smallint", "", { ifMode: "math", createAtom: (t37) => new at("\u222B", g(p({}, t37), { limits: "adjacent", variant: "main" })) });
var _p = { int: "\u222B", iint: "\u222C", iiint: "\u222D", oint: "\u222E", oiint: "\u222F", oiiint: "\u2230", intclockwise: "\u2231", varointclockwise: "\u2232", ointctrclockwise: "\u2233", intctrclockwise: "\u2A11", sqcup: "\u2294", sqcap: "\u2293", uplus: "\u228E", wr: "\u2240", amalg: "\u2A3F", Cap: "\u22D2", Cup: "\u22D3", doublecap: "\u22D2", doublecup: "\u22D3" };
_(Object.keys(_p), "", { ifMode: "math", createAtom: (t37) => {
let e = t37.command, r = _p[e.slice(1)];
return new Ur(r, g(p({}, t37), { limits: "adjacent", variant: { "\u22D2": "ams", "\u22D3": "ams" }[r] }));
} });
_(["Re", "Im"], "", { ifMode: "math", createAtom: (t37) => new at({ "\\Re": "\u211C", "\\Im": "\u2111" }[t37.command], g(p({}, t37), { limits: "adjacent", isFunction: true, variant: "fraktur" })) });
_("middle", "{:delim}", { ifMode: "math", createAtom: (t37) => {
var e;
return new Ui(g(p({}, t37), { delim: (e = t37.args[0]) != null ? e : "|", size: 1 }));
} });
_("the", "{:value}", { createAtom: (t37) => new y(g(p({}, t37), { captureSelection: true, verbatimLatex: null })), render: (t37, e) => {
var o;
let r = new T({ parent: e }, t37.style), i = "";
t37.isSelected && (i += " ML__selected");
let n = r.evaluate(t37.args[0]);
return new w(((o = ue(n)) != null ? o : "").split("").map((a) => new w(a, { type: "ord", classes: i, mode: t37.mode, isSelected: t37.isSelected, style: p({ variant: "main" }, t37.style) })), { type: "lift", style: t37.style, caret: t37.caret, isSelected: t37.isSelected, classes: i }).wrap(r);
}, serialize: (t37) => {
var e;
return `\\the${(e = ue(t37.args[0])) != null ? e : "\\relax"}`;
} });
_("mathtip", "{:auto}{:math}", { createAtom: (t37) => new Jr(g(p({}, t37), { body: A(t37.args[0]), tooltip: A(t37.args[1]), content: "math" })), serialize: (t37, e) => e.skipStyles ? t37.bodyToLatex(e) : `\\texttip{${t37.bodyToLatex(e)}}{${y.serialize([t37.tooltip], g(p({}, e), { defaultMode: "math" }))}}` });
_("texttip", "{:auto}{:text}", { createAtom: (t37) => new Jr(g(p({}, t37), { body: A(t37.args[0]), tooltip: A(t37.args[1]), content: "text" })), serialize: (t37, e) => e.skipStyles ? t37.bodyToLatex(e) : `\\texttip{${t37.bodyToLatex(e)}}{${y.serialize([t37.tooltip], g(p({}, e), { defaultMode: "text" }))}}` });
_("error", "{:math}", { createAtom: (t37) => new y(g(p({}, t37), { body: A(t37.args[0]) })), serialize: (t37, e) => `\\error{${t37.bodyToLatex(e)}}`, render: (t37, e) => t37.createBox(e, { classes: "ML__error" }) });
_("ensuremath", "{:math}", { createAtom: (t37) => new y(g(p({}, t37), { body: A(t37.args[0]) })), serialize: (t37, e) => `${t37.command}{${t37.bodyToLatex(g(p({}, e), { defaultMode: "math" }))}}` });
_("color", "{:value}", { applyStyle: (t37, e, r, i) => {
var n, o;
return g(p({}, t37), { verbatimColor: (n = ue(r[0])) != null ? n : void 0, color: i.toColor((o = r[0]) != null ? o : { string: "red" }) });
} });
_("textcolor", "{:value}{content:auto*}", { applyStyle: (t37, e, r, i) => {
var n, o;
return g(p({}, t37), { verbatimColor: (n = ue(r[0])) != null ? n : void 0, color: i.toColor((o = r[0]) != null ? o : { string: "red" }) });
} });
_("boxed", "{content:math}", { createAtom: (t37) => new qe(g(p({}, t37), { body: A(t37.args[0]), framecolor: { string: "black" } })) });
_("colorbox", "{:value}{:text*}", { applyStyle: (t37, e, r, i) => {
var n, o;
return g(p({}, t37), { verbatimBackgroundColor: (n = ue(r[0])) != null ? n : void 0, backgroundColor: i.toBackgroundColor((o = r[0]) != null ? o : { string: "yellow" }) });
} });
_("fcolorbox", "{frame-color:value}{background-color:value}{content:text}", { applyMode: "text", createAtom: (t37) => {
var e, r;
return new qe(g(p({}, t37), { body: A(t37.args[2]), framecolor: (e = t37.args[0]) != null ? e : { string: "blue" }, backgroundcolor: (r = t37.args[1]) != null ? r : { string: "yellow" } }));
}, serialize: (t37, e) => {
var r, i;
return e.skipStyles ? t37.bodyToLatex(g(p({}, e), { defaultMode: "text" })) : I(t37.command, (r = ue(t37.framecolor)) != null ? r : "", (i = ue(t37.backgroundcolor)) != null ? i : "", t37.bodyToLatex(g(p({}, e), { defaultMode: "text" })));
} });
_("bbox", "[:bbox]{body:auto}", { createAtom: (t37) => {
var i;
let e = t37.args[0], r = A(t37.args[1]);
return e ? new qe(g(p({}, t37), { body: r, padding: e.padding, border: e.border, backgroundcolor: (i = e.backgroundcolor) != null ? i : void 0 })) : new qe(g(p({}, t37), { body: r }));
}, serialize: (t37, e) => {
var i, n;
if (e.skipStyles)
return t37.bodyToLatex(e);
let r = t37.command;
if (Number.isFinite(t37.padding) || t37.border !== void 0 || t37.backgroundcolor !== void 0) {
let o = [];
t37.padding && o.push((i = ue(t37.padding)) != null ? i : ""), t37.border && o.push(`border: ${t37.border}`), t37.backgroundcolor && o.push((n = ue(t37.backgroundcolor)) != null ? n : ""), r += `[${o.join(",")}]`;
}
return I(r, t37.bodyToLatex(e));
} });
_(["displaystyle", "textstyle", "scriptstyle", "scriptscriptstyle"], "{:rest}", { createAtom: (t37) => new y(g(p({}, t37), { body: A(t37.args[0]) })), render: (t37, e) => {
let r = new T({ parent: e, mathstyle: t37.command.slice(1) }, t37.style), i = y.createBox(r, t37.body, { type: "lift" });
return t37.caret && (i.caret = t37.caret), t37.bind(e, i);
}, serialize: (t37, e) => e.skipStyles ? t37.bodyToLatex(e) : `{${K([t37.command, t37.bodyToLatex(e)])}}` });
_(["tiny", "scriptsize", "footnotesize", "small", "normalsize", "large", "Large", "LARGE", "huge", "Huge"], "", { applyStyle: (t37, e) => g(p({}, t37), { fontSize: { "\\tiny": 1, "\\scriptsize": 2, "\\footnotesize": 3, "\\small": 4, "\\normalsize": 5, "\\large": 6, "\\Large": 7, "\\LARGE": 8, "\\huge": 9, "\\Huge": 10 }[e] }) });
_("fontseries", "{:string}", { ifMode: "text", applyStyle: (t37, e, r) => {
var i;
return g(p({}, t37), { fontSeries: (i = r[0]) != null ? i : "auto" });
} });
_("fontshape", "{:string}", { ifMode: "text", applyStyle: (t37, e, r) => {
var i;
return g(p({}, t37), { fontShape: (i = r[0]) != null ? i : "auto" });
} });
_("fontfamily", "{:string}", { ifMode: "text", applyStyle: (t37, e, r) => {
var i;
return g(p({}, t37), { fontFamily: (i = r[0]) != null ? i : "roman" });
} });
_("selectfont", "", { ifMode: "text", applyStyle: (t37) => t37 });
_("bf", "{:rest*}", { applyStyle: (t37) => g(p({}, t37), { fontSeries: "b", fontShape: "n", fontFamily: "roman" }) });
_(["boldsymbol", "bm", "bold"], "{:math*}", { applyMode: "math", applyStyle: (t37) => g(p({}, t37), { variantStyle: "bold" }) });
_("bfseries", "{:rest*}", { applyMode: "text", applyStyle: (t37) => g(p({}, t37), { fontSeries: "b" }) });
_("mdseries", "{:rest*}", { applyMode: "text", applyStyle: (t37) => g(p({}, t37), { fontSeries: "m" }) });
_("upshape", "{:rest*}", { applyMode: "text", applyStyle: (t37) => g(p({}, t37), { fontShape: "n" }) });
_("slshape", "{:rest*}", { applyMode: "text", applyStyle: (t37) => g(p({}, t37), { fontShape: "sl" }) });
_("scshape", "{:rest*}", { applyMode: "text", applyStyle: (t37) => g(p({}, t37), { fontShape: "sc" }) });
_("textbf", "{:text*}", { applyMode: "text", applyStyle: (t37) => g(p({}, t37), { fontSeries: "b" }) });
_("textmd", "{:text*}", { applyMode: "text", applyStyle: (t37) => g(p({}, t37), { fontSeries: "m" }) });
_("textup", "{:text*}", { applyMode: "text", applyStyle: (t37) => g(p({}, t37), { fontShape: "n" }) });
_("textnormal", "{:text*}", { applyMode: "text", applyStyle: (t37) => g(p({}, t37), { fontShape: "n", fontSeries: "m" }) });
_("textsl", "{:text*}", { applyMode: "text", applyStyle: (t37) => g(p({}, t37), { fontShape: "sl" }) });
_("textit", "{:text*}", { applyMode: "text", applyStyle: (t37) => g(p({}, t37), { fontShape: "it" }) });
_("textsc", "{:text*}", { applyMode: "text", applyStyle: (t37) => g(p({}, t37), { fontShape: "sc" }) });
_("textrm", "{:text*}", { applyMode: "text", applyStyle: (t37) => g(p({}, t37), { fontFamily: "roman" }) });
_("textsf", "{:text*}", { applyMode: "text", applyStyle: (t37) => g(p({}, t37), { fontFamily: "sans-serif" }) });
_("texttt", "{:text*}", { applyMode: "text", applyStyle: (t37) => g(p({}, t37), { fontFamily: "monospace" }) });
_("mathbf", "{:math*}", { applyMode: "math", applyStyle: (t37) => g(p({}, t37), { variant: "normal", variantStyle: "bold" }) });
_("mathit", "{:math*}", { applyMode: "math", applyStyle: (t37) => g(p({}, t37), { variant: "main", variantStyle: "italic" }) });
_("mathnormal", "{:math*}", { applyMode: "math", applyStyle: (t37) => g(p({}, t37), { variant: "normal", variantStyle: "italic" }) });
_("mathbfit", "{:math*}", { applyMode: "math", applyStyle: (t37) => g(p({}, t37), { variant: "main", variantStyle: "bolditalic" }) });
_("mathrm", "{:math*}", { applyMode: "math", applyStyle: (t37) => g(p({}, t37), { variant: "normal", variantStyle: "up" }) });
_("mathsf", "{:math*}", { applyMode: "math", applyStyle: (t37) => g(p({}, t37), { variant: "sans-serif", variantStyle: "up" }) });
_("mathtt", "{:math*}", { applyMode: "math", applyStyle: (t37) => g(p({}, t37), { variant: "monospace", variantStyle: "up" }) });
_("it", "{:rest*}", { applyStyle: (t37) => g(p({}, t37), { fontSeries: "m", fontShape: "it", fontFamily: "roman", variantStyle: "italic" }) });
_("rmfamily", "{:rest*}", { applyStyle: (t37) => g(p({}, t37), { fontFamily: "roman" }) });
_("sffamily", "{:rest*}", { applyStyle: (t37) => g(p({}, t37), { fontFamily: "sans-serif" }) });
_("ttfamily", "{:rest*}", { applyStyle: (t37) => g(p({}, t37), { fontFamily: "monospace" }) });
_(["Bbb", "mathbb"], "{:math*}", { applyStyle: (t37) => ({ variant: "double-struck", variantStyle: qn(t37.variantStyle) }) });
_(["frak", "mathfrak"], "{:math*}", { applyStyle: (t37) => ({ variant: "fraktur", variantStyle: qn(t37.variantStyle) }) });
_("mathcal", "{:math*}", { applyStyle: (t37) => ({ variant: "calligraphic", variantStyle: qn(t37.variantStyle) }) });
_("mathscr", "{:math*}", { applyStyle: (t37) => ({ variant: "script", variantStyle: qn(t37.variantStyle) }) });
_("mbox", "{:text}", { ifMode: "math", createAtom: (t37) => new y(g(p({}, t37), { type: "mord", body: A(t37.args[0]), mode: "math" })), serialize: (t37, e) => I("\\mbox", t37.bodyToLatex(g(p({}, e), { defaultMode: "text" }))) });
_("text", "{:text}", { ifMode: "math", applyMode: "text" });
_(["class", "htmlClass"], "{name:string}{content:auto}", { createAtom: (t37) => new y(g(p({}, t37), { body: A(t37.args[1]) })), serialize: (t37, e) => !t37.args[0] || e.skipStyles ? t37.bodyToLatex(e) : `${t37.command}{${t37.args[0]}}{${t37.bodyToLatex(e)}}`, render: (t37, e) => {
var r;
return t37.createBox(e, { classes: (r = t37.args[0]) != null ? r : "" });
} });
_(["cssId", "htmlId"], "{id:string}{content:auto}", { createAtom: (t37) => new y(g(p({}, t37), { body: A(t37.args[1]) })), serialize: (t37, e) => {
var r;
return !((r = t37.args) != null && r[0]) || e.skipStyles ? t37.bodyToLatex(e) : `${t37.command}{${t37.args[0]}}{${t37.bodyToLatex(e)}}`;
}, render: (t37, e) => {
var i;
let r = t37.createBox(e);
return r.cssId = (i = t37.args[0]) != null ? i : "", r;
} });
_("htmlData", "{data:string}{content:auto}", { createAtom: (t37) => new y(g(p({}, t37), { body: A(t37.args[1]) })), serialize: (t37, e) => {
var r;
return !((r = t37.args) != null && r[0]) || e.skipStyles ? t37.bodyToLatex(e) : `\\htmlData{${t37.args[0]}}{${t37.bodyToLatex(e)}}`;
}, render: (t37, e) => {
var i;
let r = t37.createBox(e);
return r.htmlData = (i = t37.args[0]) != null ? i : "", r;
} });
_(["style", "htmlStyle"], "{data:string}{content:auto}", { createAtom: (t37) => new y(g(p({}, t37), { body: A(t37.args[1]) })), serialize: (t37, e) => {
var r;
return !((r = t37.args) != null && r[0]) || e.skipStyles ? t37.bodyToLatex(e) : `${t37.command}{${t37.args[0]}}{${t37.bodyToLatex(e)}}`;
}, render: (t37, e) => {
var i;
let r = t37.createBox(e);
return r.htmlStyle = (i = t37.args[0]) != null ? i : "", r;
} });
_("href", "{url:string}{content:auto}", { createAtom: (t37) => new y(g(p({}, t37), { body: A(t37.args[1]) })), render: (t37, e) => {
var n;
let r = t37.createBox(e), i = (n = t37.args[0]) != null ? n : "";
return i && (r.htmlData = `href=${i}`), r;
} });
_("em", "{:rest}", { createAtom: (t37) => new y(g(p({}, t37), { body: A(t37.args[0]) })), serialize: (t37, e) => e.skipStyles ? t37.bodyToLatex(e) : `{\\em ${t37.bodyToLatex(e)}}`, render: (t37, e) => t37.createBox(e, { classes: "ML__emph", boxType: "lift" }) });
_("emph", "{:auto}", { createAtom: (t37) => new y(g(p({}, t37), { body: A(t37.args[1]) })), serialize: (t37, e) => e.skipStyles ? t37.bodyToLatex(e) : `\\emph{${t37.bodyToLatex(e)}}`, render: (t37, e) => t37.createBox(e, { classes: "ML__emph", boxType: "lift" }) });
var Mp = { "\\bigl": { mclass: "mopen", size: 1 }, "\\Bigl": { mclass: "mopen", size: 2 }, "\\biggl": { mclass: "mopen", size: 3 }, "\\Biggl": { mclass: "mopen", size: 4 }, "\\bigr": { mclass: "mclose", size: 1 }, "\\Bigr": { mclass: "mclose", size: 2 }, "\\biggr": { mclass: "mclose", size: 3 }, "\\Biggr": { mclass: "mclose", size: 4 }, "\\bigm": { mclass: "mrel", size: 1 }, "\\Bigm": { mclass: "mrel", size: 2 }, "\\biggm": { mclass: "mrel", size: 3 }, "\\Biggm": { mclass: "mrel", size: 4 }, "\\big": { mclass: "mord", size: 1 }, "\\Big": { mclass: "mord", size: 2 }, "\\bigg": { mclass: "mord", size: 3 }, "\\Bigg": { mclass: "mord", size: 4 } };
_(["bigl", "Bigl", "biggl", "Biggl", "bigr", "Bigr", "biggr", "Biggr", "bigm", "Bigm", "biggm", "Biggm", "big", "Big", "bigg", "Bigg"], "{:delim}", { createAtom: (t37) => {
var e;
return new Ji(g(p({}, t37), { delim: (e = t37.args[0]) != null ? e : ".", size: Mp[t37.command].size, delimType: Mp[t37.command].mclass }));
} });
_(["hspace", "hspace*"], "{width:value}", { createAtom: (t37) => {
var e;
return new Et(g(p({}, t37), { width: (e = t37.args[0]) != null ? e : { dimension: 0 } }));
} });
_(["mkern", "kern", "mskip", "hskip", "mspace"], "{width:value}", { createAtom: (t37) => {
var e;
return new Et(g(p({}, t37), { width: (e = t37.args[0]) != null ? e : { dimension: 0 } }));
} });
_("mathchoice", "{:math}{:math}{:math}{:math}", { createAtom: (t37) => new y(t37), render: (t37, e) => {
let r = 0, i = e.mathstyle.id;
(i === Pn || i === pr) && (r = 1), (i === Fr || i === Ke) && (r = 2), (i === hr || i === ve) && (r = 3);
let n = A(t37.args[r]);
return y.createBox(e, n);
}, serialize: (t37, e) => `\\mathchoice{${y.serialize(t37.args[0], e)}}{${y.serialize(t37.args[1], e)}}{${y.serialize(t37.args[2], e)}}{${y.serialize(t37.args[3], e)}}` });
_("mathop", "{:auto}", { createAtom: (t37) => new y(g(p({}, t37), { type: "mop", body: A(t37.args[0]), limits: "over-under", isFunction: true, captureSelection: true })), render: (t37, e) => {
var i;
let r = y.createBox(e, t37.body);
if (t37.superscript || t37.subscript) {
let n = (i = t37.subsupPlacement) != null ? i : "auto";
r = n === "over-under" || n === "auto" && e.isDisplayStyle ? t37.attachLimits(e, { base: r }) : t37.attachSupsub(e, { base: r });
}
return new w(t37.bind(e, r), { type: "op", isSelected: t37.isSelected, classes: "ML__op-group" });
}, serialize: (t37, e) => {
let r = [I(t37.command, t37.bodyToLatex(e))];
return t37.explicitSubsupPlacement && (t37.subsupPlacement === "over-under" && r.push("\\limits"), t37.subsupPlacement === "adjacent" && r.push("\\nolimits"), t37.subsupPlacement === "auto" && r.push("\\displaylimits")), r.push(t37.supsubToLatex(e)), K(r);
} });
_(["mathbin", "mathrel", "mathopen", "mathclose", "mathpunct", "mathord", "mathinner"], "{:auto}", { createAtom: (t37) => new y(g(p({}, t37), { type: { "\\mathbin": "mbin", "\\mathrel": "mrel", "\\mathopen": "mopen", "\\mathclose": "mclose", "\\mathpunct": "mpunct", "\\mathord": "mord", "\\mathinner": "minner" }[t37.command], body: A(t37.args[0]) })) });
_(["operatorname", "operatorname*"], "{operator:math}", { createAtom: (t37) => {
let e = A(t37.args[0]).map((r) => {
var i;
return r.type !== "first" && (r.type = "mord", r.value = (i = { "\u2217": "*", "\u2212": "-" }[r.value]) != null ? i : r.value, r.isFunction = false, !r.style.variant && !r.style.variantStyle && (r.style.variant = "main", r.style.variantStyle = "up")), r;
});
return new y(g(p({}, t37), { type: "mop", body: e, isFunction: true, limits: t37.command === "\\operatorname" ? "adjacent" : "over-under" }));
}, render: (t37, e) => {
var i;
let r = y.createBox(e, t37.body);
if (t37.superscript || t37.subscript) {
let n = (i = t37.subsupPlacement) != null ? i : "auto";
r = n === "over-under" || n === "auto" && e.isDisplayStyle ? t37.attachLimits(e, { base: r }) : t37.attachSupsub(e, { base: r });
}
return t37.caret && (r.caret = t37.caret), new w(t37.bind(e, r), { type: "op", isSelected: t37.isSelected, classes: "ML__op-group" });
}, serialize: (t37, e) => {
let r = [I(t37.command, t37.bodyToLatex(e))];
return t37.explicitSubsupPlacement && (t37.subsupPlacement === "over-under" && r.push("\\limits"), t37.subsupPlacement === "adjacent" && r.push("\\nolimits"), t37.subsupPlacement === "auto" && r.push("\\displaylimits")), r.push(t37.supsubToLatex(e)), K(r);
} });
_(["char", "unicode"], "{charcode:value}", { createAtom: (t37) => new y(g(p({}, t37), { type: t37.mode === "text" ? "text" : "mord" })), serialize: (t37) => {
var e;
return `${t37.command}${ue((e = t37.args[0]) != null ? e : { number: 10067, base: "hexadecimal" })}`;
}, render: (t37, e) => {
let r = e.evaluate(t37.args[0]);
return (!r || !("number" in r)) && (r = { number: 10067, base: "hexadecimal" }), t37.value = String.fromCodePoint(r.number), t37.createBox(e);
} });
_("rule", "[raise:value]{width:value}{thickness:value}", { createAtom: (t37) => new y(t37), render: (t37, e) => {
var s, l, c;
let r = new T({ parent: e, mathstyle: "textstyle" }, t37.style), i = r.toEm((s = t37.args[0]) != null ? s : { dimension: 0 }), n = r.toEm((l = t37.args[1]) != null ? l : { dimension: 10 }), o = r.toEm((c = t37.args[2]) != null ? c : { dimension: 10 }), a = new w(null, { classes: "ML__rule", type: "ord" });
return a.width = n, a.height = o + i, a.depth = -i, a.setStyle("border-right-width", n, "em"), a.setStyle("border-top-width", o, "em"), a.setStyle("border-color", t37.style.color), a.setStyle("vertical-align", i, "em"), t37.isSelected && a.setStyle("opacity", "50%"), t37.bind(r, a), t37.caret && (a.caret = t37.caret), a.wrap(e);
}, serialize: (t37) => `\\rule${t37.args[0] ? `[${ue(t37.args[0])}]` : ""}{${ue(t37.args[1])}}{${ue(t37.args[2])}}` });
_(["overline", "underline"], "{:auto}", { createAtom: (t37) => new y(g(p({}, t37), { body: A(t37.args[0]) })), render: (t37, e) => {
let r = t37.command.substring(1), i = new T({ parent: e, mathstyle: "cramp" }, t37.style), n = y.createBox(i, t37.body);
if (!n)
return null;
let o = i.metrics.defaultRuleThickness / i.scalingFactor, a = new w(null, { classes: r + "-line" });
a.height = o, a.maxFontSize = o * 1.125 * i.scalingFactor;
let s;
return r === "overline" ? s = new U({ shift: 0, children: [{ box: n }, 3 * o, { box: a }, o] }) : s = new U({ top: n.height, children: [o, { box: a }, 3 * o, { box: n }] }), t37.caret && (s.caret = t37.caret), new w(s, { classes: r, type: "ignore" });
} });
_("overset", "{:auto}{base:auto}", { createAtom: (t37) => {
let e = A(t37.args[1]);
return new ye(g(p({}, t37), { above: A(t37.args[0]), body: e, skipBoundary: false, boxType: Nr(e) }));
}, serialize: (t37, e) => I(t37.command, t37.aboveToLatex(e), t37.bodyToLatex(e)) });
_("underset", "{:auto}{base:auto}", { createAtom: (t37) => {
let e = A(t37.args[1]);
return new ye(g(p({}, t37), { below: A(t37.args[0]), body: e, skipBoundary: false, boxType: Nr(e) }));
}, serialize: (t37, e) => I(t37.command, t37.belowToLatex(e), t37.bodyToLatex(e)) });
_("overunderset", "{above:auto}{below:auto}{base:auto}", { createAtom: (t37) => {
let e = A(t37.args[2]);
return new ye(g(p({}, t37), { above: A(t37.args[0]), below: A(t37.args[1]), body: e, skipBoundary: false, boxType: Nr(e) }));
}, serialize: (t37, e) => I(t37.command, t37.belowToLatex(e), t37.bodyToLatex(e)) });
_(["stackrel", "stackbin"], "[below:auto]{above:auto}{base:auto}", { createAtom: (t37) => new ye(g(p({}, t37), { body: A(t37.args[2]), above: A(t37.args[1]), below: A(t37.args[0]), skipBoundary: false, boxType: t37.command === "\\stackrel" ? "rel" : "bin" })), serialize: (t37, e) => I(t37.command, t37.aboveToLatex(e), t37.bodyToLatex(e)) });
_("smash", "[:string]{:auto}", { createAtom: (t37) => {
var e, r, i, n;
return new Jt(g(p({}, t37), { body: A(t37.args[1]), smashHeight: (r = (e = t37.args[0]) == null ? void 0 : e.includes("t")) != null ? r : true, smashDepth: (n = (i = t37.args[0]) == null ? void 0 : i.includes("b")) != null ? n : true }));
} });
_(["vphantom"], "{:auto}", { createAtom: (t37) => new Jt(g(p({}, t37), { body: A(t37.args[0]), isInvisible: true, smashWidth: true })) });
_(["hphantom"], "{:auto}", { createAtom: (t37) => new Jt(g(p({}, t37), { body: A(t37.args[0]), isInvisible: true, smashHeight: true, smashDepth: true })) });
_(["phantom"], "{:auto}", { createAtom: (t37) => new Jt(g(p({}, t37), { body: A(t37.args[0]), isInvisible: true })) });
_("not", "{:math}", { createAtom: (t37) => {
let e = A(t37.args[0]);
return e.length === 0 ? new y(g(p({}, t37), { type: "mrel", value: "\uE020" })) : new y(g(p({}, t37), { body: [new nt(g(p({}, t37), { body: "\uE020", align: "right" })), ...e], captureSelection: true }));
}, serialize: (t37, e) => {
let r = t37.args[0], i = r && typeof r == "object" && "group" in r;
return t37.value !== "\uE020" ? i ? `\\not{${y.serialize(r.group, e)}}` : `\\not${y.serialize(r, e)}` : i ? "\\not{}" : "\\not";
}, render: (t37, e) => {
if (t37.value)
return t37.createBox(e);
let i = t37.args[0] && typeof t37.args[0] == "object" && "group" in t37.args[0] ? "ord" : Nr(A(t37.args[0])), n = y.createBox(e, t37.body, { type: i });
return t37.caret && (n.caret = t37.caret), t37.bind(e, n);
} });
_(["ne", "neq"], "", { createAtom: (t37) => new y(g(p({}, t37), { type: "mrel", body: [new nt(g(p({}, t37), { body: "\uE020", align: "right", boxType: "rel" })), new y(g(p({}, t37), { value: "=" }))], captureSelection: true })), serialize: (t37) => t37.command });
_("rlap", "{:auto}", { createAtom: (t37) => new nt(g(p({}, t37), { body: A(t37.args[0]), align: "right" })) });
_("llap", "{:auto}", { createAtom: (t37) => new nt(g(p({}, t37), { body: A(t37.args[0]), align: "left" })) });
_("mathrlap", "{:math}", { createAtom: (t37) => new nt(g(p({}, t37), { body: A(t37.args[0]), align: "right" })) });
_("mathllap", "{:math}", { createAtom: (t37) => new nt(g(p({}, t37), { body: A(t37.args[0]), align: "left" })) });
_("raisebox", "{:value}{:text}", { createAtom: (t37) => {
var e;
return new qe(g(p({}, t37), { body: A(t37.args[1]), padding: { dimension: 0 }, offset: (e = t37.args[0]) != null ? e : { dimension: 0 } }));
}, serialize: (t37, e) => {
var r;
return I("\\raisebox", (r = ue(t37.offset)) != null ? r : "0pt", t37.bodyToLatex(e));
} });
_("raise", "{:value}{:auto}", { createAtom: (t37) => {
var e;
return new qe(g(p({}, t37), { body: A(t37.args[1]), padding: { dimension: 0 }, offset: (e = t37.args[0]) != null ? e : { dimension: 0 } }));
}, serialize: (t37, e) => {
var r;
return I("\\raise", (r = ue(t37.offset)) != null ? r : "0pt", t37.bodyToLatex(e));
} });
_("lower", "{:value}{:auto}", { createAtom: (t37) => {
var e;
return new qe(g(p({}, t37), { body: A(t37.args[1]), padding: { dimension: 0 }, offset: (e = et(t37.args[0], -1)) != null ? e : { dimension: 0 } }));
}, serialize: (t37, e) => {
var r, i;
return I("\\lower", (i = ue(et((r = t37.offset) != null ? r : { dimension: 0 }, -1))) != null ? i : "0pt", t37.bodyToLatex(e));
} });
me("0123456789/@.?!");
Ls(65, 90);
Ls(97, 122);
me([["\\forall", 8704], ["\\exists", 8707], ["\\nexists", 8708, "mord", "ams"], ["\\mid", 8739, "mrel"], ["\\top", 8868], ["\\bot", 8869]]);
me([["\\#", 35], ["\\&", 38], ["\\parallelogram", 9649], ["\\spadesuit", 9824], ["\\heartsuit", 9825], ["\\diamondsuit", 9826], ["\\clubsuit", 9827], ["\\flat", 9837], ["\\natural", 9838], ["\\sharp", 9839]]);
me([["\\backslash", 92], ["\\nabla", 8711], ["\\partial", 8706], ["\\ell", 8467], ["\\hbar", 8463], ["\\Q", 81, "mord", "double-struck"], ["\\C", 67, "mord", "double-struck"], ["\\P", 80, "mord", "double-struck"], ["\\pounds", 163], ["\\euro", 8364]]);
me([["\\rightarrow", 8594], ["\\to", 8594], ["\\leftarrow", 8592], ["\\gets", 8592], ["\\Rightarrow", 8658], ["\\Leftarrow", 8656], ["\\longrightarrow", 10230], ["\\longleftarrow", 10229], ["\\Longrightarrow", 10233], ["\\implies", 10233], ["\\Longleftarrow", 10232], ["\\impliedby", 10232], ["\\longleftrightarrow", 10231], ["\\biconditional", 10231], ["\\Longleftrightarrow", 10234], ["\\mapsto", 8614], ["\\longmapsto", 10236], ["\\uparrow", 8593], ["\\downarrow", 8595], ["\\Uparrow", 8657], ["\\Downarrow", 8659], ["\\updownarrow", 8597], ["\\Updownarrow", 8661], ["\\hookrightarrow", 8618], ["\\hookleftarrow", 8617], ["\\rightharpoonup", 8640], ["\\leftharpoonup", 8636], ["\\rightharpoondown", 8641], ["\\leftharpoondown", 8637], ["\\searrow", 8600], ["\\nearrow", 8599], ["\\swarrow", 8601], ["\\nwarrow", 8598], ["\\originalof", 8886], ["\\laplace", 8886], ["\\imageof", 8887], ["\\Laplace", 8887]], "mrel");
me([["\\mapsfrom", 8612, "mrel"], ["\\Mapsfrom", 10502, "mrel"], ["\\MapsTo", 10503, "mrel"], ["\\Yup", 8516, "mord"], ["\\lightning", 8623, "mrel"], ["\\leftarrowtriangle", 8701, "mrel"], ["\\rightarrowtriangle", 8702, "mrel"], ["\\leftrightarrowtriangle", 8703, "mrel"], ["\\boxdot", 8865, "mbin"], ["\\bigtriangleup", 9651, "mbin"], ["\\bigtriangledown", 9661, "mbin"], ["\\boxbar", 9707, "mbin"], ["\\Lbag", 10181, "mopen"], ["\\Rbag", 10182, "mclose"], ["\\llbracket", 10214, "mopen"], ["\\rrbracket", 10215, "mclose"], ["\\longmapsfrom", 10235, "mrel"], ["\\Longmapsfrom", 10237, "mrel"], ["\\Longmapsto", 10238, "mrel"], ["\\boxslash", 10692, "mbin"], ["\\boxbslash", 10693, "mbin"], ["\\boxast", 10694, "mbin"], ["\\boxcircle", 10695, "mbin"], ["\\boxbox", 10696, "mbin"], ["\\fatsemi", 10783, "mop"], ["\\leftslice", 10918, "mrel"], ["\\rightslice", 10919, "mrel"], ["\\interleave", 10996, "mbin"], ["\\biginterleave", 11004, "mop"], ["\\sslash", 11005, "mbin"], ["\\talloblong", 11006, "mbin"]]);
me([["\\lbrace", 123, "mopen"], ["\\rbrace", 125, "mclose"], ["\\lparen", 40, "mopen"], ["\\rparen", 41, "mclose"], ["\\langle", 10216, "mopen"], ["\\rangle", 10217, "mclose"], ["\\lfloor", 8970, "mopen"], ["\\rfloor", 8971, "mclose"], ["\\lceil", 8968, "mopen"], ["\\rceil", 8969, "mclose"], ["\\vert", 8739], ["\\lvert", 8739, "mopen"], ["\\rvert", 8739, "mclose"], ["\\|", 8741], ["\\Vert", 8741], ["\\mVert", 8741], ["\\lVert", 8741, "mopen"], ["\\rVert", 8741, "mclose"], ["\\lbrack", 91, "mopen"], ["\\rbrack", 93, "mclose"], ["\\{", 123, "mopen"], ["\\}", 125, "mclose"], ["(", 40, "mopen"], [")", 41, "mclose"], ["[", 91, "mopen"], ["]", 93, "mclose"], ["\\ulcorner", 9484, "mopen", "ams"], ["\\urcorner", 9488, "mclose", "ams"], ["\\llcorner", 9492, "mopen", "ams"], ["\\lrcorner", 9496, "mclose", "ams"], ["\\lgroup", 10222, "mopen"], ["\\rgroup", 10223, "mclose"], ["\\lmoustache", 9136, "mopen"], ["\\rmoustache", 9137, "mclose"]]);
me([["\\dashrightarrow", 8674], ["\\dashleftarrow", 8672], ["\\Rrightarrow", 8667], ["\\Lleftarrow", 8666], ["\\leftrightarrows", 8646], ["\\rightleftarrows", 8644], ["\\curvearrowright", 8631], ["\\curvearrowleft", 8630], ["\\rightrightarrows", 8649], ["\\leftleftarrows", 8647], ["\\upuparrows", 8648], ["\\downdownarrows", 8650], ["\\vartriangle", 9651], ["\\triangleq", 8796], ["\\vartriangleleft", 8882], ["\\trianglelefteq", 8884], ["\\ntriangleleft", 8938], ["\\ntrianglelefteq", 8940], ["\\vartriangleright", 8883], ["\\trianglerighteq", 8885], ["\\ntriangleright", 8939], ["\\ntrianglerighteq", 8941], ["\\blacktriangleleft", 9664], ["\\blacktriangleright", 9654], ["\\leftarrowtail", 8610], ["\\rightarrowtail", 8611], ["\\looparrowright", 8620], ["\\looparrowleft", 8619], ["\\twoheadleftarrow", 8606], ["\\twoheadrightarrow", 8608], ["\\twoheadrightarrowtail", 10518], ["\\rightleftharpoons", 8652], ["\\leftrightharpoons", 8651], ["\\Rsh", 8625], ["\\Lsh", 8624], ["\\circlearrowright", 8635], ["\\circlearrowleft", 8634], ["\\restriction", 8638], ["\\upharpoonright", 8638], ["\\upharpoonleft", 8639], ["\\downharpoonright", 8642], ["\\downharpoonleft", 8643], ["\\rightsquigarrow", 8669], ["\\leadsto", 8669], ["\\leftrightsquigarrow", 8621], ["\\multimap", 8888], ["\\nleftarrow", 8602], ["\\nrightarrow", 8603], ["\\nRightarrow", 8655], ["\\nLeftarrow", 8653], ["\\nleftrightarrow", 8622], ["\\nLeftrightarrow", 8654], ["\\nvrightarrow", 8696], ["\\nvtwoheadrightarrow", 10496], ["\\nvrightarrowtail", 10516], ["\\nvtwoheadrightarrowtail", 10519], ["\\shortparallel", 8741], ["\\nless", 8814], ["\\nleqslant", 57360], ["\\lneq", 10887], ["\\lneqq", 8808], ["\\nleqq", 57361], ["\\lvertneqq", 57356], ["\\lnsim", 8934], ["\\lnapprox", 10889], ["\\nprec", 8832], ["\\npreceq", 8928], ["\\precnsim", 8936], ["\\precnapprox", 10937], ["\\nsim", 8769], ["\\nshortmid", 57350], ["\\nmid", 8740], ["\\nvdash", 8876], ["\\nvDash", 8877], ["\\ngtr", 8815], ["\\ngeqslant", 57359], ["\\ngeqq", 57358], ["\\gneq", 10888], ["\\gneqq", 8809], ["\\gvertneqq", 57357], ["\\gnsim", 8935], ["\\gnapprox", 10890], ["\\nsucc", 8833], ["\\nsucceq", 8929], ["\\succnsim", 8937], ["\\succnapprox", 10938], ["\\ncong", 8774], ["\\nshortparallel", 57351], ["\\nparallel", 8742], ["\\nVDash", 8879], ["\\nsupseteqq", 57368], ["\\supsetneq", 8843], ["\\varsupsetneq", 57371], ["\\supsetneqq", 10956], ["\\varsupsetneqq", 57369], ["\\nVdash", 8878], ["\\precneqq", 10933], ["\\succneqq", 10934], ["\\nsubseteqq", 57366], ["\\leqslant", 10877], ["\\geqslant", 10878], ["\\gtrsim", 8819], ["\\approxeq", 8778], ["\\thickapprox", 8776], ["\\lessapprox", 10885], ["\\gtrapprox", 10886], ["\\precapprox", 10935], ["\\succapprox", 10936], ["\\thicksim", 8764], ["\\succsim", 8831], ["\\precsim", 8830], ["\\backsim", 8765], ["\\eqsim", 8770], ["\\backsimeq", 8909], ["\\lesssim", 8818], ["\\nleq", 8816], ["\\ngeq", 8817], ["\\smallsmile", 8995], ["\\smallfrown", 8994], ["\\leqq", 8806], ["\\eqslantless", 10901], ["\\lll", 8920], ["\\lessgtr", 8822], ["\\lesseqgtr", 8922], ["\\lesseqqgtr", 10891], ["\\risingdotseq", 8787], ["\\fallingdotseq", 8786], ["\\subseteqq", 10949], ["\\Subset", 8912], ["\\sqsubset", 8847], ["\\preccurlyeq", 8828], ["\\curlyeqprec", 8926], ["\\vDash", 8872], ["\\Vvdash", 8874], ["\\bumpeq", 8783], ["\\Bumpeq", 8782], ["\\geqq", 8807], ["\\eqslantgtr", 10902], ["\\ggg", 8921], ["\\gtrless", 8823], ["\\gtreqless", 8923], ["\\gtreqqless", 10892], ["\\supseteqq", 10950], ["\\Supset", 8913], ["\\sqsupset", 8848], ["\\succcurlyeq", 8829], ["\\curlyeqsucc", 8927], ["\\Vdash", 8873], ["\\shortmid", 8739], ["\\between", 8812], ["\\pitchfork", 8916], ["\\varpropto", 8733], ["\\backepsilon", 8717], ["\\llless", 8920], ["\\gggtr", 8921], ["\\doteqdot", 8785], ["\\Doteq", 8785], ["\\eqcirc", 8790], ["\\circeq", 8791], ["\\therefore", 8756], ["\\because", 8757]], "mrel", "ams");
me([["+", 43], ["-", 8722], ["\u2212", 8722], ["\\pm", 177], ["\\mp", 8723], ["*", 8727], ["\\times", 215], ["\\div", 247], ["\\divides", 8739], ["\\cdot", 8901], ["\\cap", 8745], ["\\cup", 8746], ["\\setminus", 8726], ["\\land", 8743], ["\\wedge", 8743], ["\\lor", 8744], ["\\vee", 8744], ["\\circ", 8728], ["\\bigcirc", 9711], ["\\bullet", 8729], ["\\oplus", 8853], ["\\ominus", 8854], ["\\otimes", 8855], ["\\odot", 8857], ["\\oslash", 8856], ["\\bigtriangleup", 9651], ["\\bigtriangledown", 9661], ["\\triangleleft", 9667], ["\\triangleright", 9657], ["\\And", 38], ["\\dagger", 8224], ["\\dag", 8224], ["\\ddag", 8225], ["\\ddagger", 8225], ["\\ast", 8727], ["\\star", 8902], ["\\bigstar", 9733], ["\\diamond", 8900]], "mbin");
me([["\\lhd", 8882], ["\\rhd", 8883], ["\\lessdot", 8918], ["\\gtrdot", 8919], ["\\ltimes", 8905], ["\\rtimes", 8906], ["\\leftthreetimes", 8907], ["\\rightthreetimes", 8908], ["\\intercal", 8890], ["\\dotplus", 8724], ["\\doublebarwedge", 10846], ["\\divideontimes", 8903], ["\\centerdot", 8901], ["\\smallsetminus", 8726], ["\\barwedge", 8892], ["\\veebar", 8891], ["\\nor", 8891], ["\\curlywedge", 8911], ["\\curlyvee", 8910], ["\\boxminus", 8863], ["\\boxplus", 8862], ["\\boxtimes", 8864], ["\\boxdot", 8865], ["\\circleddash", 8861], ["\\circledast", 8859], ["\\circledcirc", 8858], ["\\unlhd", 8884], ["\\unrhd", 8885]], "mbin", "ams");
me([["\\surd", 8730], ["\\infty", 8734], ["\\prime", 8242], ["\\doubleprime", 8243], ["\\angle", 8736], ["`", 8216], ["\\$", 36], ["\\%", 37], ["\\_", 95], ["\\alpha", 945], ["\\beta", 946], ["\\gamma", 947], ["\\delta", 948], ["\\epsilon", 1013], ["\\varepsilon", 949], ["\\zeta", 950], ["\\eta", 951], ["\\theta", 952], ["\\vartheta", 977], ["\\iota", 953], ["\\kappa", 954], ["\\varkappa", 1008, "mord", "ams"], ["\\lambda", 955], ["\\mu", 956], ["\\nu", 957], ["\\xi", 958], ["\\omicron", 111], ["\\pi", 960], ["\\varpi", 982], ["\\rho", 961], ["\\varrho", 1009], ["\\sigma", 963], ["\\varsigma", 962], ["\\tau", 964], ["\\phi", 981], ["\\varphi", 966], ["\\upsilon", 965], ["\\chi", 967], ["\\psi", 968], ["\\omega", 969], ["\\Gamma", 915], ["\\Delta", 916], ["\\Theta", 920], ["\\Lambda", 923], ["\\Xi", 926], ["\\Pi", 928], ["\\Sigma", 931], ["\\Upsilon", 933], ["\\Phi", 934], ["\\Psi", 936], ["\\Omega", 937], ["\\digamma", 989, "mord", "ams"], ["\\emptyset", 8709]]);
me([["=", 61], ["<", 60], ["\\lt", 60], [">", 62], ["\\gt", 62], ["\\le", 8804], ["\\leq", 8804], ["\\ge", 8805], ["\\geq", 8805], ["\\ll", 8810], ["\\gg", 8811], ["\\coloneq", 8788], ["\\coloneqq", 8788], ["\\colonequals", 8788], ["\\measeq", 8797], ["\\eqdef", 8798], ["\\questeq", 8799], [":", 58], ["\\cong", 8773], ["\\equiv", 8801], ["\\prec", 8826], ["\\preceq", 10927], ["\\succ", 8827], ["\\succeq", 10928], ["\\perp", 8869], ["\\propto", 8733], ["\\Colon", 8759], ["\\smile", 8995], ["\\frown", 8994], ["\\sim", 8764], ["\\doteq", 8784], ["\\bowtie", 8904], ["\\Join", 8904], ["\\asymp", 8781], ["\\sqsubseteq", 8849], ["\\sqsupseteq", 8850], ["\\approx", 8776], ["\\~", 126], ["\\leftrightarrow", 8596], ["\\Leftrightarrow", 8660], ["\\models", 8872], ["\\vdash", 8866], ["\\dashv", 8867], ["\\roundimplies", 10608], ["\\in", 8712], ["\\notin", 8713], ["\\ni", 8715], ["\\owns", 8715], ["\\subset", 8834], ["\\supset", 8835], ["\\subseteq", 8838], ["\\supseteq", 8839], ["\\differencedelta", 8710], ["\\mvert", 8739], ["\\parallel", 8741], ["\\simeq", 8771]], "mrel");
me([["\\lnot", 172], ["\\neg", 172], ["\\triangle", 9651], ["\\subsetneq", 8842], ["\\varsubsetneq", 57370], ["\\subsetneqq", 10955], ["\\varsubsetneqq", 57367], ["\\nsubset", 8836], ["\\nsupset", 8837], ["\\nsubseteq", 8840], ["\\nsupseteq", 8841]], "mrel", "ams");
me([["\\wp", 8472], ["\\aleph", 8501]]);
me([["\\blacktriangle", 9650], ["\\hslash", 8463], ["\\Finv", 8498], ["\\Game", 8513], ["\\eth", 240], ["\\mho", 8487], ["\\Bbbk", 107], ["\\yen", 165], ["\\square", 9633], ["\\Box", 9633], ["\\blacksquare", 9632], ["\\circledS", 9416], ["\\circledR", 174], ["\\triangledown", 9661], ["\\blacktriangledown", 9660], ["\\checkmark", 10003], ["\\diagup", 9585], ["\\measuredangle", 8737], ["\\sphericalangle", 8738], ["\\backprime", 8245], ["\\backdoubleprime", 8246], ["\\Diamond", 9674], ["\\lozenge", 9674], ["\\blacklozenge", 10731], ["\\varnothing", 8709], ["\\complement", 8705], ["\\maltese", 10016], ["\\beth", 8502], ["\\daleth", 8504], ["\\gimel", 8503]], "mord", "ams");
me([["\\ ", 160], ["~", 160]], "space");
_(["!", ",", ":", ";", ">", "enskip", "enspace", "quad", "qquad"], "", { createAtom: (t37) => new Et(t37) });
_("space", "", { createAtom: (t37) => new Et(t37) });
me([["\\colon", 58], ["\\cdotp", 8901], ["\\vdots", 8942, "mord"], ["\\ldotp", 46], [",", 44], [";", 59]], "mpunct");
me([["\\cdots", 8943], ["\\ddots", 8945], ["\\ldots", 8230], ["\\mathellipsis", 8230]], "minner");
me([["\\/", 47], ["|", 8739, "mord"], ["\\imath", 305], ["\\jmath", 567], ["\\degree", 176], ["'", 8242], ['"', 8221]]);
var wp = "<mo>&#x2061;</mo>";
var ms = "<mo>&#8290;</mo>";
function ds(t37) {
return t37.replace(/"/g, "&quot;").replace(/'/g, "&#39;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
}
function G(t37, e) {
return !t37 || !e.generateID ? "" : ` extid="${t37}"`;
}
function Sg(t37, e, r) {
var d, m, h, f, b, S, M, x;
let i = false;
e = e != null ? e : t37.atoms.length;
let n = "", o = "", a = t37.atoms[t37.index], s = (d = a.style) == null ? void 0 : d.variant, l = (m = a.style) == null ? void 0 : m.variantStyle, c = "";
if (a.value && (s || l)) {
let v = (h = gn(a.value, s, l)) != null ? h : a.value;
if (v !== a.value)
return t37.index += 1, n = `<mi${G(a.id, r)}>${v}</mi>`, Ot(n, t37, r) || (t37.mathML += n, t37.lastType = "mi"), true;
c = (f = { upnormal: "normal", boldnormal: "bold", italicmain: "italic", bolditalicmain: "bold-italic", "updouble-struck": "double-struck", "double-struck": "double-struck", boldfraktur: "bold-fraktur", calligraphic: "script", upcalligraphic: "script", script: "script", boldscript: "bold-script", boldcalligraphic: "bold-script", fraktur: "fraktur", "upsans-serif": "sans-serif", "boldsans-serif": "bold-sans-serif", "italicsans-serif": "sans-serif-italic", "bolditalicsans-serif": "sans-serif-bold-italic", monospace: "monospace" }[(l != null ? l : "") + (s != null ? s : "")]) != null ? f : "", c && (c = ` mathvariant="${c}"`);
}
let u = { "\\exponentialE": "&#x02147;", "\\imaginaryI": "&#x2148;", "\\differentialD": "&#x2146;", "\\capitalDifferentialD": "&#x2145;", "\\alpha": "&#x03b1;", "\\pi": "&#x03c0;", "\\infty": "&#x221e;", "\\forall": "&#x2200;", "\\nexists": "&#x2204;", "\\exists": "&#x2203;", "\\hbar": "\u210F", "\\cdotp": "\u22C5", "\\ldots": "\u2026", "\\cdots": "\u22EF", "\\ddots": "\u22F1", "\\vdots": "\u22EE", "\\ldotp": "." };
if (a.command === "!")
return t37.index += 1, n = "<mo>!</mo>", Ot(n, t37, r) || (t37.mathML += n, t37.lastType = "mo"), true;
if (u[a.command]) {
t37.index += 1;
let v = `<mi${G(a.id, r)}${c}>${u[a.command]}</mi>`;
return (t37.lastType === "mi" || t37.lastType === "mn" || t37.lastType === "mtext" || t37.lastType === "fence") && (v = ms + v), Ot(v, t37, r) || (t37.mathML += v, t37.lastType = "mi"), true;
}
if (a.command === "\\operatorname")
o = dn(a.body), t37.index += 1;
else if (s || l)
for (; t37.index < e && (a.type === "mord" || a.type === "macro") && !a.isDigit() && s === ((S = (b = a.style) == null ? void 0 : b.variant) != null ? S : "") && l === ((x = (M = a.style) == null ? void 0 : M.variantStyle) != null ? x : ""); )
o += dn([a]), t37.index += 1, a = t37.atoms[t37.index];
else
(a.type === "mord" || a.type === "macro") && !a.isDigit() && (o += dn([a]), t37.index += 1);
if (o.length > 0) {
i = true, n = `<mi${c}>${o}</mi>`;
let v = t37.lastType;
n.endsWith(">f</mi>") || n.endsWith(">g</mi>") ? (n += wp, t37.lastType = "applyfunction") : t37.lastType = /^<mo>(.*)<\/mo>$/.test(n) ? "mo" : "mi", Ot(n, t37, r) || ((v === "mi" || v === "mn" || v === "mtext" || v === "fence") && (n = ms + n), t37.mathML += n);
}
return i;
}
function kp(t37) {
return t37.index < t37.atoms.length && t37.atoms[t37.index].superscript && t37.atoms[t37.index].type === "subsup";
}
function Sp(t37) {
let e = -1, r = t37.index, i = false, n = false;
for (; r < t37.atoms.length && !i && !n; ) {
let o = t37.atoms[r];
i = !o.isDigit(), n = !i && o.superscript !== void 0, r++;
}
return n && (e = r - 1), e;
}
function Ot(t37, e, r) {
var l;
let i = e.atoms[e.index - 1];
if (!i)
return false;
if (!i.superscript && !i.subscript)
if (((l = e.atoms[e.index]) == null ? void 0 : l.type) === "subsup")
i = e.atoms[e.index], e.index += 1;
else
return false;
let n = e.lastType;
e.lastType = "";
let o = F(i.superscript, r);
e.lastType = "";
let a = F(i.subscript, r);
if (e.lastType = n, !o && !a)
return false;
let s = "";
return o && a ? s = `<msubsup>${t37}${a}${o}</msubsup>` : o ? s = `<msup>${t37}${o}</msup>` : a && (s = `<msub>${t37}${a}</msub>`), e.mathML += s, e.lastType = "", true;
}
function Lg(t37, e, r) {
e = e != null ? e : t37.atoms.length;
let i = t37.index, n = "", o = Sp(t37);
for (o >= 0 && o < e && (e = o); t37.index < e && t37.atoms[t37.index].mode === "text"; )
n += t37.atoms[t37.index].value ? t37.atoms[t37.index].value : " ", t37.index += 1;
return n.length > 0 ? (n = `<mtext ${G(t37.atoms[i].id, r)}>${n}</mtext>`, o < 0 && kp(t37) && (o = t37.index, t37.index += 1), Ot(n, t37, r) || (t37.mathML += n, t37.lastType = "mtext"), true) : false;
}
function Ag(t37, e, r) {
e = e != null ? e : t37.atoms.length;
let i = t37.index, n = "", o = Sp(t37);
for (o >= 0 && o < e && (e = o); t37.index < e && t37.atoms[t37.index].isDigit(); )
n += t37.atoms[t37.index].asDigit(), t37.index += 1;
return n.length <= 0 ? false : (n = "<mn" + G(t37.atoms[i].id, r) + ">" + n + "</mn>", o < 0 && kp(t37) && (o = t37.index, t37.index += 1), Ot(n, t37, r) || (t37.mathML += n, t37.lastType = "mn"), true);
}
function Cg(t37, e, r) {
let i = false;
e = e != null ? e : t37.atoms.length;
let n = "", o = "";
if (t37.index < e && t37.atoms[t37.index].type === "mopen") {
let a = false, s = 0, l = t37.index, c = -1, u = l + 1;
for (; u < e && !a; )
t37.atoms[u].type === "mopen" ? s += 1 : t37.atoms[u].type === "mclose" && (s -= 1), s === -1 && (a = true, c = u), u += 1;
a && (n = "<mrow>", n += di(t37.atoms[l], r), n += F(t37.atoms, r, l + 1, c), n += di(t37.atoms[c], r), n += "</mrow>", t37.index = c + 1, (t37.lastType === "mi" || t37.lastType === "mn" || t37.lastType === "mfrac" || t37.lastType === "fence") && (t37.mathML += ms), Ot(n, t37, r) && (i = true, t37.lastType = "", n = ""), o = "fence");
}
return n.length > 0 && (i = true, t37.mathML += n, t37.lastType = o), i;
}
function Eg(t37, e, r) {
let i = false;
e = e != null ? e : t37.atoms.length;
let n = "", o = "", a = t37.atoms[t37.index];
if (!a)
return false;
let s = { "\\ne": "&ne;", "\\neq": "&ne;", "\\pm": "&#177;", "\\times": "&#215;", "\\colon": ":", "\\vert": "|", "\\Vert": "\u2225", "\\mid": "\u2223", "\\{": "{", "\\}": "}", "\\lbrace": "{", "\\rbrace": "}", "\\lbrack": "[", "\\rbrack": "]", "\\lparen": "(", "\\rparen": ")", "\\langle": "\u27E8", "\\rangle": "\u27E9", "\\lfloor": "\u230A", "\\rfloor": "\u230B", "\\lceil": "\u2308", "\\rceil": "\u2309" };
if (s[a.command]) {
t37.index += 1;
let l = `<mo${G(a.id, r)}>${s[a.command]}</mo>`;
return Ot(l, t37, r) || (t37.mathML += l, t37.lastType = "mo"), true;
}
if (t37.index < e && (a.type === "mbin" || a.type === "mrel"))
n += ac(t37.atoms[t37.index], r), t37.index += 1, o = "mo";
else if (t37.index < e && (a.type === "mop" || a.type === "operator" || a.type === "extensible-symbol")) {
if (a.subsupPlacement === "over-under" && (a.superscript || a.subscript)) {
let l = di(a, r);
return a.superscript && a.subscript ? (n += "<munderover>" + l, n += F(a.subscript, r), n += F(a.superscript, r), n += "</munderover>") : a.superscript ? (n += "<mover>" + l, n += F(a.superscript, r), n += "</mover>") : a.subscript && (n += "<munder>" + l, n += F(a.subscript, r), n += "</munder>"), t37.mathML += n, t37.lastType = "mo", t37.index += 1, true;
}
{
let l = t37.atoms[t37.index], c = l.value === "\\operatorname", u = c ? '<mi class="MathML-Unit"' + G(l.id, r) + ">" + dn(l.value) + "</mi>" : di(l, r);
n += u, !c && !/^<mo>(.*)<\/mo>$/.test(u) ? (n += wp, o = "applyfunction") : o = c ? "mi" : "mo";
}
(t37.lastType === "mi" || t37.lastType === "mn") && !/^<mo>(.*)<\/mo>$/.test(n) && (n = ms + n), t37.index += 1;
}
return n.length > 0 && (i = true, Ot(n, t37, r) || (t37.mathML += n, t37.lastType = o)), i;
}
function F(t37, e, r, i) {
e != null || (e = {});
let n = { atoms: [], index: r != null ? r : 0, mathML: "", lastType: "" };
if (typeof t37 == "number" || typeof t37 == "boolean")
n.mathML = t37.toString();
else if (typeof t37 == "string")
n.mathML = t37;
else if (t37 instanceof y)
n.mathML = ac(t37, e);
else if (Array.isArray(t37)) {
n.atoms = t37;
let o = 0;
for (i = i || (t37 ? t37.length : 0); n.index < i; )
if (Lg(n, i, e) || Ag(n, i, e) || Sg(n, i, e) || Eg(n, i, e) || Cg(n, i, e))
o += 1;
else if (n.index < i) {
let a = ac(n.atoms[n.index], e);
n.lastType === "mn" && a.length > 0 && n.atoms[n.index].type === "genfrac" && (a = "<mo>&#x2064;</mo>" + a), n.atoms[n.index].type === "genfrac" ? n.lastType = "mfrac" : n.lastType = "", n.index += 1, Ot(a, n, e) ? o += 1 : a.length > 0 && (n.mathML += a, o += 1);
}
o > 1 && (n.mathML = "<mrow>" + n.mathML + "</mrow>");
}
return n.mathML;
}
function di(t37, e) {
let r = "", i = dn(t37.value);
return i && (r = "<mo" + G(t37.id, e) + ">" + i + "</mo>"), r;
}
function dn(t37) {
if (!t37)
return "";
if (typeof t37 == "string")
return ds(t37);
if (!Array.isArray(t37) && typeof t37.body == "string")
return ds(t37.body);
let e = "";
for (let r of t37)
typeof r.value == "string" && (e += r.value);
return ds(e);
}
function ac(t37, e) {
var b, S, M, x, v, k, C, q, B, D, J, de, Rt, Zt, pt, be, hn, fn, ne, he, Se, Je;
if (t37.mode === "text")
return `<mi${G(t37.id, e)}>${t37.value}</mi>`;
let r = { widehat: "^", widecheck: "\u02C7", widetilde: "~", utilde: "~", overleftarrow: "\u2190", underleftarrow: "\u2190", xleftarrow: "\u2190", longleftarrow: "\u2190", overrightarrow: "\u2192", underrightarrow: "\u2192", xrightarrow: "\u2192", longrightarrow: "\u2192", underbrace: "\u23DF", overbrace: "\u23DE", overgroup: "\u23E0", undergroup: "\u23E1", overleftrightarrow: "\u2194", underleftrightarrow: "\u2194", xleftrightarrow: "\u2194", Overrightarrow: "\u21D2", xRightarrow: "\u21D2", overleftharpoon: "\u21BC", xleftharpoonup: "\u21BC", overrightharpoon: "\u21C0", xrightharpoonup: "\u21C0", xLeftarrow: "\u21D0", xLeftrightarrow: "\u21D4", xhookleftarrow: "\u21A9", xhookrightarrow: "\u21AA", xmapsto: "\u21A6", xrightharpoondown: "\u21C1", xleftharpoondown: "\u21BD", xrightleftharpoons: "\u21CC", longrightleftharpoons: "\u21CC", xleftrightharpoons: "\u21CB", xtwoheadleftarrow: "\u219E", xtwoheadrightarrow: "\u21A0", xlongequal: "=", xtofrom: "\u21C4", xleftrightarrows: "\u21C4", xRightleftharpoons: "\u21CC", longRightleftharpoons: "\u21CC", xLeftrightharpoons: "\u21CB", longLeftrightharpoons: "\u21CB" }, i = { "\\!": -3 / 18, "\\ ": 6 / 18, "\\,": 3 / 18, "\\:": 4 / 18, "\\>": 4 / 18, "\\;": 5 / 18, "\\enspace": 0.5, "\\quad": 1, "\\qquad": 2, "\\enskip": 0.5 }, n = "", o = "", a, s, l, c, u, d, { command: m } = t37;
if (t37.command === "\\error")
return `<merror${G(t37.id, e)}>${F(t37.body, e)}</merror>`;
let h = { "\\vert": "|", "\\Vert": "\u2225", "\\mid": "\u2223", "\\lbrack": "[", "\\rbrack": "]", "\\{": "{", "\\}": "}", "\\lbrace": "{", "\\rbrace": "}", "\\lparen": "(", "\\rparen": ")", "\\langle": "\u27E8", "\\rangle": "\u27E9", "\\lfloor": "\u230A", "\\rfloor": "\u230B", "\\lceil": "\u2308", "\\rceil": "\u2309" }, f = { "\\vec": "&#x20d7;", "\\acute": "&#x00b4;", "\\grave": "&#x0060;", "\\dot": "&#x02d9;", "\\ddot": "&#x00a8;", "\\tilde": "&#x007e;", "\\bar": "&#x00af;", "\\breve": "&#x02d8;", "\\check": "&#x02c7;", "\\hat": "&#x005e;" };
switch (t37.type) {
case "first":
break;
case "group":
case "root":
n = F(t37.body, e);
break;
case "array":
if ((t37.leftDelim && t37.leftDelim !== "." || t37.rightDelim && t37.rightDelim !== ".") && (n += "<mrow>", t37.leftDelim && t37.leftDelim !== "." && (n += "<mo>" + (h[t37.leftDelim] || t37.leftDelim) + "</mo>")), n += "<mtable", t37.colFormat) {
for (n += ' columnalign="', l = 0; l < t37.colFormat.length; l++)
t37.colFormat[l].align && (n += { l: "left", c: "center", r: "right" }[t37.colFormat[l].align] + " ");
n += '"';
}
for (n += ">", s = 0; s < t37.array.length; s++) {
for (n += "<mtr>", a = 0; a < t37.array[s].length; a++)
n += "<mtd>" + F(t37.array[s][a], e) + "</mtd>";
n += "</mtr>";
}
n += "</mtable>", (t37.leftDelim && t37.leftDelim !== "." || t37.rightDelim && t37.rightDelim !== ".") && (t37.rightDelim && t37.rightDelim !== "." && (n += "<mo>" + (h[t37.leftDelim] || t37.rightDelim) + "</mo>"), n += "</mrow>");
break;
case "genfrac":
(t37.leftDelim || t37.rightDelim) && (n += "<mrow>"), t37.leftDelim && t37.leftDelim !== "." && (n += "<mo" + G(t37.id, e) + ">" + (h[t37.leftDelim] || t37.leftDelim) + "</mo>"), t37.hasBarLine ? (n += "<mfrac>", n += F(t37.above, e) || "<mi>&nbsp;</mi>", n += F(t37.below, e) || "<mi>&nbsp;</mi>", n += "</mfrac>") : (n += "<mtable" + G(t37.id, e) + ">", n += "<mtr>" + F(t37.above, e) + "</mtr>", n += "<mtr>" + F(t37.below, e) + "</mtr>", n += "</mtable>"), t37.rightDelim && t37.rightDelim !== "." && (n += "<mo" + G(t37.id, e) + ">" + (h[t37.rightDelim] || t37.rightDelim) + "</mo>"), (t37.leftDelim || t37.rightDelim) && (n += "</mrow>");
break;
case "surd":
t37.hasEmptyBranch("above") ? (n += "<msqrt" + G(t37.id, e) + ">", n += F(t37.body, e), n += "</msqrt>") : (n += "<mroot" + G(t37.id, e) + ">", n += F(t37.body, e), n += F(t37.above, e), n += "</mroot>");
break;
case "leftright":
let ht = t37, ft = ht.leftDelim;
n = "<mrow>", ft && ft !== "." && (n += `<mo${G(t37.id, e)}>${(b = h[ft]) != null ? b : ft}</mo>`), t37.body && (n += F(t37.body, e));
let gt = ht.matchingRightDelim();
gt && gt !== "." && (n += `<mo${G(t37.id, e)}>${(S = h[gt]) != null ? S : gt}</mo>`), n += "</mrow>";
break;
case "sizeddelim":
case "delim":
n += `<mo${G(t37.id, e)}>${h[t37.value] || t37.value}</mo>`;
break;
case "accent":
n += '<mover accent="true"' + G(t37.id, e) + ">", n += F(t37.body, e), n += "<mo>" + (f[m] || t37.accent) + "</mo>", n += "</mover>";
break;
case "line":
case "overlap":
break;
case "overunder":
u = t37.above, c = t37.below, (t37.svgAbove || u) && (t37.svgBelow || c) ? d = t37.body : u && u.length > 0 ? (d = t37.body, (x = (M = t37.body) == null ? void 0 : M[0]) != null && x.below ? (c = t37.body[0].below, d = t37.body[0].body) : ((k = (v = t37.body) == null ? void 0 : v[0]) == null ? void 0 : k.type) === "first" && ((q = (C = t37.body) == null ? void 0 : C[1]) != null && q.below) && (c = t37.body[1].below, d = t37.body[1].body)) : c && c.length > 0 && (d = t37.body, (D = (B = t37.body) == null ? void 0 : B[0]) != null && D.above ? (u = t37.body[0].above, d = t37.body[0].body) : ((de = (J = t37.body) == null ? void 0 : J[0]) == null ? void 0 : de.type) === "first" && ((Zt = (Rt = t37.body) == null ? void 0 : Rt[1]) != null && Zt.above) && (u = t37.body[1].overscript, d = t37.body[1].body)), (t37.svgAbove || u) && (t37.svgBelow || c) ? (n += `<munderover ${G(t37.id, e)}>`, n += (pt = r[t37.svgBody]) != null ? pt : F(d, e), n += (be = r[t37.svgBelow]) != null ? be : F(c, e), n += (hn = r[t37.svgAbove]) != null ? hn : F(u, e), n += "</munderover>") : t37.svgAbove || u ? (n += `<mover ${G(t37.id, e)}>` + ((fn = r[t37.svgBody]) != null ? fn : F(d, e)), n += (ne = r[t37.svgAbove]) != null ? ne : F(u, e), n += "</mover>") : (t37.svgBelow || c) && (n += `<munder ${G(t37.id, e)}>` + ((he = r[t37.svgBody]) != null ? he : F(d, e)), n += (Se = r[t37.svgBelow]) != null ? Se : F(c, e), n += "</munder>");
break;
case "placeholder":
n += "?";
break;
case "mord": {
n = typeof t37.value == "string" ? t37.value : m, m === "\\char" ? n = "&#x" + ("000000" + t37.args[0].number.toString(16)).slice(-4) + ";" : n.length > 0 && n.startsWith("\\") && (typeof t37.value == "string" && t37.value.charCodeAt(0) > 255 ? n = "&#x" + ("000000" + t37.value.charCodeAt(0).toString(16)).slice(-4) + ";" : typeof t37.value == "string" ? n = t37.value.charAt(0) : (console.error("Did not expect this"), n = ""));
let Ge = /\d/.test(n) ? "mn" : "mi";
n = `<${Ge}${G(t37.id, e)}>${ds(n)}</${Ge}>`;
break;
}
case "mbin":
case "mrel":
case "minner":
n = di(t37, e);
break;
case "mpunct":
n = '<mo separator="true"' + G(t37.id, e) + ">" + m + "</mo>";
break;
case "mop":
case "operator":
case "extensible-symbol":
t37.body !== "\u200B" && (n = "<mo" + G(t37.id, e) + ">", n += m === "\\operatorname" ? t37.body : m || t37.body, n += "</mo>");
break;
case "box":
n = '<menclose notation="box"', t37.backgroundcolor && (n += ' mathbackground="' + t37.backgroundcolor + '"'), n += G(t37.id, e) + ">" + F(t37.body, e) + "</menclose>";
break;
case "spacing":
n += '<mspace width="' + ((Je = i[m]) != null ? Je : 0) + 'em"/>';
break;
case "enclose":
n = '<menclose notation="';
for (let Ge in t37.notation)
Object.prototype.hasOwnProperty.call(t37.notation, Ge) && t37.notation[Ge] && (n += o + Ge, o = " ");
n += G(t37.id, e) + '">' + F(t37.body, e) + "</menclose>";
break;
case "prompt":
n = '<menclose notation="roundexbox""">' + F(t37.body, e) + "</menclose>";
break;
case "space":
n += "&nbsp;";
break;
case "subsup":
break;
case "phantom":
break;
case "composition":
break;
case "rule":
break;
case "chem":
break;
case "mopen":
n += di(t37, e);
break;
case "mclose":
n += di(t37, e);
break;
case "macro":
{
let Ge = t37.command + dn(t37.macroArgs);
Ge && (n += `<mo ${G(t37.id, e)}>${Ge}</mo>`);
}
break;
case "latexgroup":
n += F(t37.body, e);
break;
case "latex":
n += "<mtext" + G(t37.id, e) + ">" + t37.value + "</mtext>";
break;
case "tooltip":
n += F(t37.body, e);
break;
case "text":
n += `<mtext ${G(t37.id, e)}x>${t37.value}</mtext>`;
break;
default:
if (t37.command === "\\displaystyle")
return `<mrow ${G(t37.id, e)} displaystyle="true">${F(t37.body, e)}</mrow>`;
if (t37.command === "\\textstyle")
return `<mrow ${G(t37.id, e)} displaystyle="false">${F(t37.body, e)}</mrow>`;
console.info("Unexpected element in conversion to MathML:", t37);
}
return n;
}
var mn = { "\\alpha": "alpha ", "\\mu": "mew ", "\\sigma": "sigma ", "\\pi": "pie ", "\\imaginaryI": "imaginary eye ", "\\imaginaryJ": "imaginary jay ", "\\sum": "Summation ", "\\prod": "Product ", "+": "plus ", "-": "minus ", ";": '<break time="150ms"/> semi-colon <break time="150ms"/>', ",": '<break time="150ms"/> comma <break time="150ms"/>', "|": '<break time="150ms"/>Vertical bar<break time="150ms"/>', "(": '<break time="150ms"/>Open paren. <break time="150ms"/>', ")": '<break time="150ms"/> Close paren. <break time="150ms"/>', "=": "equals ", "<": "is less than ", "\\lt": "is less than ", "<=": "is less than or equal to ", "\\le": "is less than or equal to ", "\\gt": "is greater than ", ">": "is greater than ", "\\pm": "plus or minus", "\\mp": "minus or plus", "\\ge": "is greater than or equal to ", "\\geq": "is greater than or equal to ", "\\leq": "is less than or equal to ", "\\ne": "is not equal to ", "\\neq": "is not equal to ", "!": "factorial ", "\\sin": "sine ", "\\cos": "cosine ", "\u200B": "", "\u2212": "minus ", ":": '<break time="150ms"/> such that <break time="200ms"/> ', "\\colon": '<break time="150ms"/> such that <break time="200ms"/> ', "\\hbar": "etch bar ", "\\iff": '<break time="200ms"/>if, and only if, <break time="200ms"/>', "\\Longleftrightarrow": '<break time="200ms"/>if, and only if, <break time="200ms"/>', "\\land": "and ", "\\lor": "or ", "\\neg": "not ", "\\div": "divided by ", "\\forall": "for all ", "\\exists": "there exists ", "\\nexists": "there does not exists ", "\\in": "element of ", "\\N": 'the set <break time="150ms"/><say-as interpret-as="character">n</say-as>', "\\C": 'the set <break time="150ms"/><say-as interpret-as="character">c</say-as>', "\\Z": 'the set <break time="150ms"/><say-as interpret-as="character">z</say-as>', "\\Q": 'the set <break time="150ms"/><say-as interpret-as="character">q</say-as>', "\\infty": "infinity ", "\\nabla": "nabla ", "\\partial": "partial derivative of ", "\\cdot": "times ", "\\cdots": "dot dot dot ", "\\Rightarrow": "implies ", "\\lparen": '<break time="150ms"/>open paren<break time="150ms"/>', "\\rparen": '<break time="150ms"/>close paren<break time="150ms"/>', "\\lbrace": '<break time="150ms"/>open brace<break time="150ms"/>', "\\{": '<break time="150ms"/>open brace<break time="150ms"/>', "\\rbrace": '<break time="150ms"/>close brace<break time="150ms"/>', "\\}": '<break time="150ms"/>close brace<break time="150ms"/>', "\\langle": '<break time="150ms"/>left angle bracket<break time="150ms"/>', "\\rangle": '<break time="150ms"/>right angle bracket<break time="150ms"/>', "\\lfloor": '<break time="150ms"/>open floor<break time="150ms"/>', "\\rfloor": '<break time="150ms"/>close floor<break time="150ms"/>', "\\lceil": '<break time="150ms"/>open ceiling<break time="150ms"/>', "\\rceil": '<break time="150ms"/>close ceiling<break time="150ms"/>', "\\vert": '<break time="150ms"/>vertical bar<break time="150ms"/>', "\\mvert": '<break time="150ms"/>divides<break time="150ms"/>', "\\lvert": '<break time="150ms"/>left vertical bar<break time="150ms"/>', "\\rvert": '<break time="150ms"/>right vertical bar<break time="150ms"/>', "\\lbrack": '<break time="150ms"/> open square bracket <break time="150ms"/>', "\\rbrack": '<break time="150ms"/> close square bracket <break time="150ms"/>', mm: "millimeters", cm: "centimeters", km: "kilometers", kg: "kilograms" };
var sc = { array: "array", matrix: "matrix", pmatrix: "parenthesis matrix", bmatrix: "square brackets matrix", Bmatrix: "braces matrix", vmatrix: "bars matrix", Vmatrix: "double bars matrix", "matrix*": "matrix", smallmatrix: "small matrix" };
function Tg(t37) {
let e = "";
return t37.startsWith("\\") && (e = " " + t37.replace("\\", "") + " "), e;
}
function so(t37) {
let e = 0;
if (X(t37))
for (let r of t37)
r.type !== "first" && (e += 1);
return e === 1;
}
function Dg(t37) {
if (X(t37)) {
for (let e of t37)
if (e.type !== "first" && e.id)
return e.id.toString();
}
return "";
}
function Lp(t37) {
let e = "";
if (X(t37))
for (let r of t37)
r.type !== "first" && typeof r.value == "string" && (e += r.value);
return e;
}
function Kg(t37) {
return t37 ? t37.map((e) => e.value).join("") : "";
}
function lc(t37) {
return `<emphasis>${t37}</emphasis>`;
}
function Bg(t37, e) {
var o;
let r = "", i = false, n = false;
for (let a = 0; a < e.length; a++)
e[a].type !== "first" && (e[a].mode !== "text" && (n = false), a < e.length - 2 && e[a].type === "mopen" && e[a + 2].type === "mclose" && e[a + 1].type === "mord" ? (r += " of ", r += lc(R(t37, e[a + 1])), a += 2) : e[a].mode === "text" ? n ? r += (o = e[a].value) != null ? o : " " : (n = true, r += R("text", e[a])) : e[a].isDigit() ? i ? r += e[a].asDigit() : (i = true, r += R(t37, e[a])) : (i = false, r += R(t37, e[a])));
return r;
}
function R(t37, e) {
var c, u, d, m;
function r(h) {
return globalThis.MathfieldElement.textToSpeechMarkup ? /[a-z]/.test(h) ? ` <say-as interpret-as="character">${h}</say-as>` : /[A-Z]/.test(h) ? `capital <say-as interpret-as="character">${h.toLowerCase()}</say-as>` : h : /[a-z]/.test(h) ? " '" + h.toUpperCase() + "'" : /[A-Z]/.test(h) ? " 'capital " + h.toUpperCase() + "'" : h;
}
if (!e)
return "";
if (X(e))
return Bg(t37, e);
let i = "";
if (e.id && t37 === "math" && (i += '<mark name="' + e.id.toString() + '"/>'), e.mode === "text")
return i + e.value;
let n = "", o = "", a = "", s = false, { command: l } = e;
switch (l) {
case "\\vec":
return "vector " + R(t37, e.body);
case "\\acute":
return R(t37, e.body) + " acute";
case "\\grave":
return R(t37, e.body) + " grave";
case "\\dot":
return "dot over" + R(t37, e.body);
case "\\ddot":
return "double dot over" + R(t37, e.body);
case "\\mathring":
return "ring over" + R(t37, e.body);
case "\\tilde":
case "\\widetilde":
return "tilde over" + R(t37, e.body);
case "\\bar":
return R(t37, e.body) + " bar";
case "\\breve":
return R(t37, e.body) + " breve";
case "\\check":
case "\\widecheck":
return "check over " + R(t37, e.body);
case "\\hat":
case "\\widehat":
return "hat over" + R(t37, e.body);
case "\\overarc":
case "\\overparen":
case "\\wideparen":
return "arc over " + R(t37, e.body);
case "\\underarc":
case "\\underparen":
return "arc under " + R(t37, e.body);
}
switch (e.type) {
case "prompt":
let h = e.body.length > 1 ? 'start input . <break time="500ms"/> ' + R(t37, e.body) + '. <break time="500ms"/> end input' : "blank";
i += ' <break time="300ms"/> ' + h + '. <break time="700ms"/>' + ((c = e.correctness) != null ? c : "") + ' . <break time="700ms"/> ';
break;
case "array":
let f = e.array, b = e.environmentName;
if (Object.keys(sc).includes(b)) {
i += ` begin ${sc[b]} `;
for (let x = 0; x < f.length; x++) {
x > 0 && (i += ","), i += ` row ${x + 1} `;
for (let v = 0; v < f[x].length; v++)
v > 0 && (i += ","), i += ` column ${v + 1}: `, i += R("math", f[x][v]);
}
i += ` end ${sc[b]} `;
}
break;
case "group":
l === "\\ne" ? i += " not equal " : (l === "\\not" && (i += " not "), i += R("math", e.body));
break;
case "root":
i += R("math", e.body);
break;
case "genfrac":
if (n = R("math", e.above), o = R("math", e.below), so(e.above) && so(e.below)) {
let v = { "1/2": " half ", "1/3": " one third ", "2/3": " two third", "1/4": " one quarter ", "3/4": " three quarter ", "1/5": " one fifth ", "2/5": " two fifths ", "3/5": " three fifths ", "4/5": " four fifths ", "1/6": " one sixth ", "5/6": " five sixths ", "1/8": " one eight ", "3/8": " three eights ", "5/8": " five eights ", "7/8": " seven eights ", "1/9": " one ninth ", "2/9": " two ninths ", "4/9": " four ninths ", "5/9": " five ninths ", "7/9": " seven ninths ", "8/9": " eight ninths " }[Lp(e.above) + "/" + Lp(e.below)];
v ? i = v : i += n + " over " + o;
} else
i += ' the fraction <break time="150ms"/>' + n + ' over <break time="150ms"/>' + o + '.<break time="150ms"/> End fraction.<break time="150ms"/>';
break;
case "surd":
if (a = R("math", e.body), e.hasEmptyBranch("above"))
i += so(e.body) ? " the square root of " + a + " , " : ' the square root of <break time="200ms"/>' + a + '. <break time="200ms"/> End square root';
else {
let x = R("math", e.above);
x = x.trim();
let v = x.replace(/<mark([^/]*)\/>/g, "");
v === "3" ? i += ' the cube root of <break time="200ms"/>' + a + '. <break time="200ms"/> End cube root' : v === "n" ? i += ' the nth root of <break time="200ms"/>' + a + '. <break time="200ms"/> End root' : i += ' the root with index: <break time="200ms"/>' + x + ', of <break time="200ms"/>' + a + '. <break time="200ms"/> End root';
}
break;
case "leftright":
{
let x = e;
i += (u = x.leftDelim ? mn[x.leftDelim] : void 0) != null ? u : x.leftDelim, i += R("math", e.body), i += (d = x.rightDelim ? mn[x.rightDelim] : void 0) != null ? d : x.rightDelim;
}
break;
case "rule":
break;
case "overunder":
break;
case "overlap":
break;
case "macro":
let S = l.replace(/^\\/g, ""), M = xi()[S];
M && (M != null && M.expand ? i += R("math", e.body) : i += `${S} `);
break;
case "placeholder":
i += "placeholder ";
break;
case "delim":
case "sizeddelim":
case "mord":
case "minner":
case "mbin":
case "mrel":
case "mpunct":
case "mopen":
case "mclose": {
if (l === "\\mathbin" || l === "\\mathrel" || l === "\\mathopen" || l === "\\mathclose" || l === "\\mathpunct" || l === "\\mathord" || l === "\\mathinner") {
i = R(t37, e.body);
break;
}
let x = e.isDigit() ? e.asDigit() : e.value, v = e.command;
if ((e.type === "delim" || e.type === "sizeddelim") && (v = e.value, x = v), t37 === "text")
i += x;
else {
if (e.type === "mbin" && (i += '<break time="150ms"/>'), x) {
let k = mn[x] || (v ? mn[v.trim()] : "");
if (k)
i += " " + k;
else {
let C = v ? Tg(v.trim()) : "";
i += C || r(x);
}
} else
i += R("math", e.body);
e.type === "mbin" && (i += '<break time="150ms"/>');
}
break;
}
case "mop":
case "operator":
case "extensible-symbol":
if (e.value !== "\u200B") {
let x = e.command;
if (x === "\\sum")
if (!e.hasEmptyBranch("superscript") && !e.hasEmptyBranch("subscript")) {
let v = R("math", e.superscript);
v = v.trim();
let k = R("math", e.subscript);
k = k.trim(), i += ' the summation from <break time="200ms"/>' + k + '<break time="200ms"/> to <break time="200ms"/>' + v + '<break time="200ms"/> of <break time="150ms"/>', s = true;
} else if (e.hasEmptyBranch("subscript"))
i += " the summation of";
else {
let v = R("math", e.subscript);
v = v.trim(), i += ' the summation from <break time="200ms"/>' + v + '<break time="200ms"/> of <break time="150ms"/>', s = true;
}
else if (x === "\\prod")
if (!e.hasEmptyBranch("superscript") && !e.hasEmptyBranch("subscript")) {
let v = R("math", e.superscript);
v = v.trim();
let k = R("math", e.subscript);
k = k.trim(), i += ' the product from <break time="200ms"/>' + k + '<break time="200ms"/> to <break time="200ms"/>' + v + '<break time="200ms"/> of <break time="150ms"/>', s = true;
} else if (e.hasEmptyBranch("subscript"))
i += " the product of ";
else {
let v = R("math", e.subscript);
v = v.trim(), i += ' the product from <break time="200ms"/>' + v + '<break time="200ms"/> of <break time="150ms"/>', s = true;
}
else if (x === "\\int")
if (!e.hasEmptyBranch("superscript") && !e.hasEmptyBranch("subscript")) {
let v = R("math", e.superscript);
v = v.trim();
let k = R("math", e.subscript);
k = k.trim(), i += ' the integral from <break time="200ms"/>' + lc(k) + '<break time="200ms"/> to <break time="200ms"/>' + lc(v) + ' <break time="200ms"/> of ', s = true;
} else
i += ' the integral of <break time="200ms"/> ';
else if (x === "\\operatorname" || x === "\\operatorname*")
i += Kg(e.body) + " ";
else if (typeof e.value == "string") {
let v = (m = mn[e.value]) != null ? m : e.command ? mn[e.command] : void 0;
i += v || " " + e.value;
} else
e.command && (e.command === "\\mathop" ? i += R("math", e.body) : i += e.command.startsWith("\\") ? " " + e.command.slice(1) : " " + e.command);
}
break;
case "enclose":
a = R("math", e.body), i += " crossed out " + a + ". End crossed out.";
break;
case "space":
case "spacing":
break;
}
if (!s && !e.hasEmptyBranch("superscript")) {
let h = R(t37, e.superscript);
h = h.trim();
let f = h.replace(/<[^>]*>/g, "");
if (so(e.superscript)) {
if (t37 === "math") {
let b = Dg(e.superscript);
b && (i += '<mark name="' + b + '"/>');
}
f === "\u2032" ? i += " prime " : f === "2" ? i += " squared " : f === "3" ? i += " cubed " : Number.isNaN(Number.parseInt(f)) ? i += " to the " + h + "; " : i += ' to the <say-as interpret-as="ordinal">' + f + "</say-as> power; ";
} else
Number.isNaN(Number.parseInt(f)) ? i += " raised to the " + h + "; " : i += ' raised to the <say-as interpret-as="ordinal">' + f + "</say-as> power; ";
}
if (!s && !e.hasEmptyBranch("subscript")) {
let h = R("math", e.subscript);
h = h.trim(), i += so(e.subscript) ? " sub " + h : " subscript " + h + ". End subscript. ";
}
return i;
}
function mt(t37) {
var i, n;
let e = globalThis.MathfieldElement;
if (e.textToSpeechRules === "sre" && ("sre" in window || "SRE" in window)) {
let o = F(t37);
if (o) {
e.textToSpeechMarkup && (e.textToSpeechRulesOptions = (i = e.textToSpeechRulesOptions) != null ? i : {}, e.textToSpeechRulesOptions = g(p({}, e.textToSpeechRulesOptions), { markup: e.textToSpeechMarkup }), e.textToSpeechRulesOptions.markup === "ssml" && (e.textToSpeechRulesOptions = g(p({}, e.textToSpeechRulesOptions), { markup: "ssml_step" })), e.textToSpeechRulesOptions = g(p({}, e.textToSpeechRulesOptions), { rate: e.speechEngineRate }));
let a = (n = window.SRE) != null ? n : globalThis.sre.System.getInstance();
e.textToSpeechRulesOptions && a.setupEngine(e.textToSpeechRulesOptions);
let s = "";
try {
s = a.toSpeech(o);
} catch (l) {
console.error("MathLive 0.100.0: `SRE.toSpeech()` runtime error", l);
}
return s;
}
return "";
}
let r = R("math", t37);
if (e.textToSpeechMarkup === "ssml") {
let o = "";
e.speechEngineRate && (o = '<prosody rate="' + e.speechEngineRate + '">'), r = '<?xml version="1.0"?><speak version="1.1" xmlns="http://www.w3.org/2001/10/synthesis" xml:lang="en-US"><amazon:auto-breaths>' + o + "<p><s>" + r + "</s></p>" + (o ? "</prosody>" : "") + "</amazon:auto-breaths></speak>";
} else
e.textToSpeechMarkup === "mac" && yt() === "macos" ? r = r.replace(/<mark([^/]*)\/>/g, "").replace(/<emphasis>/g, "[[emph+]]").replace(/<\/emphasis>/g, "").replace(/<break time="(\d*)ms"\/>/g, "[[slc $1]]").replace(/<say-as[^>]*>/g, "").replace(/<\/say-as>/g, "") : r = r.replace(/<[^>]*>/g, "").replace(/\s{2,}/g, " ");
return r;
}
var lo = { "\\ne": "\u2260", "\\neq": "\u2260", "\u2212": "-", "-": "-", "\\alpha": "alpha", "\\beta": "beta", "\\gamma": "gamma", "\\delta": "delta", "\\epsilon": "epsilon", "\\varepsilon": "varepsilon", "\\zeta": "zeta", "\\eta": "eta", "\\theta": "theta", "\\vartheta": "vartheta", "\\iota": "iota", "\\kappa": "kappa", "\\lambda": "lambda", "\\mu": "mu", "\\nu": "nu", "\\xi": "xi", "\\pi": "pi", "\\rho": "rho", "\\sigma": "sigma", "\\tau": "tau", "\\upsilon": "upsilon", "\\phi": "phi", "\\varphi": "varphi", "\\chi": "chi", "\\psi": "psi", "\\omega": "omega", "\\Gamma": "Gamma", "\\Delta": "Delta", "\\Theta": "Theta", "\\Lambda": "Lambda", "\\Xi": "Xi", "\\Pi": "Pi", "\\Sigma": "Sigma", "\\Phi": "Phi", "\\Psi": "Psi", "\\Omega": "Omega", "\\exponentialE": "e", "\\imaginaryI": "i", "\\imaginaryJ": "j", "\\!": " ", "\\,": " ", "\\:": " ", "\\>": " ", "\\;": " ", "\\enskip": " ", "\\enspace": " ", "\\qquad": " ", "\\quad": " ", "\\infty": "oo", "\\R": "RR", "\\N": "NN", "\\Z": "ZZ", "\\Q": "QQ", "\\C": "CC", "\\emptyset": "O/", "\\varnothing": "O/", "\\varDelta": "Delta", "\\varTheta": "Theta", "\\varLambda": "Lambda", "\\varXi": "Xi", "\\varPi": "Pi", "\\varSigma": "Sigma", "\\varUpsilon": "Upsilon", "\\varPhi": "Phi", "\\varPsi": "Psi", "\\varOmega": "Omega" };
var co = { "\\pm": "+-", "\\colon": ":", "\\vert": "|", "\\Vert": "||", "\\mid": "|", "\\lbrack": "[", "\\rbrack": "]", "\\lbrace": "{", "\\rbrace": "}", "\\lparen": "(", "\\rparen": ")", "\\langle": "(:", "\\rangle": ":)", "\\sum": " sum ", "\\prod": " prod ", "\\bigcap": " nnn ", "\\bigcup": " uuu ", "\\int": " int ", "\\oint": " oint ", "\\ge": ">=", "\\le": "<=", "\\ne": "!=", "\\neq": "!=", "\\lt": "<", "\\gt": ">", "\\gets": "<-", "\\to": "->", "\\land": " and ", "\\lor": " or ", "\\lnot": " not ", "\\forall": " AA ", "\\exists": " EE ", "\\in": " in ", "\\notin": " !in ", "\\mapsto": "|->", "\\implies": "=>", "\\iff": "<=>", "\\cdot": "*", "\\ast": "**", "\\star": "***", "\\times": "xx", "\\div": "-:", "\\ltimes": "|><", "\\rtimes": "><|", "\\bowtie": "|><|", "\\circ": "@" };
function Og(t37) {
let e = "";
for (let r of t37) {
let i = e[e.length - 1];
i !== void 0 && /\d/.test(i) && /^\d/.test(r) && (e += " "), e += r;
}
return e;
}
function Q(t37, e) {
var o, a, s, l, c, u, d, m, h, f, b, S, M;
if (!t37)
return "";
if (X(t37)) {
if (t37.length === 0)
return "";
if (t37[0].mode === "latex")
return t37.map((k) => Q(k)).join("");
if (t37[0].mode === "text") {
let k = 0, C = "";
for (; ((o = t37[k]) == null ? void 0 : o.mode) === "text"; )
C += t37[k].body ? Q(t37[k].body, e) : t37[k].value, k++;
return e != null && e.plain ? C + Q(t37.slice(k), e) : `"${C}" ${Q(t37.slice(k))}`;
}
let x = 0, v = [];
for (; t37[x] && t37[x].mode === "math"; ) {
let k = "";
for (; t37[x] && t37[x].type === "mord" && /\d/.test(t37[x].value); )
k += t37[x++].value;
k ? v.push(k) : v.push(Q(t37[x++], e));
}
return v.push(Q(t37.slice(x), e)), Og(v);
}
if (t37.mode === "text")
return e != null && e.plain ? t37.value : `"${t37.value}"`;
let r = "", { command: i } = t37, n;
if (i === "\\placeholder")
return `(${Q(t37.body, e)})`;
switch (t37.type) {
case "accent":
let x = { "\\vec": "vec", "\\dot": "dot", "\\ddot": "ddot", "\\bar": "bar", "\\hat": "hat", "\\acute": "acute;", "\\grave": "grave", "\\tilde": "tilde", "\\breve": "breave", "\\check": "check" }[i];
r = `${x != null ? x : ""} ${Q(t37.body, e)} `;
break;
case "first":
return "";
case "latexgroup":
return t37.body.map((D) => D.value).join("");
case "group":
case "root":
r = (a = lo[i]) != null ? a : Q(t37.body, e);
break;
case "genfrac":
{
let D = t37;
(D.leftDelim || D.rightDelim) && (r = D.leftDelim === "." || !D.leftDelim ? "{:" : D.leftDelim), D.hasBarLine ? (r += "(", r += Q(D.above, e), r += ")/(", r += Q(D.below, e), r += ")") : (r += "(" + Q(D.above, e) + "),", r += "(" + Q(D.below, e) + ")"), (D.leftDelim || D.rightDelim) && (r += D.rightDelim === "." || !D.rightDelim ? "{:" : D.rightDelim);
}
break;
case "surd":
r += t37.hasEmptyBranch("above") ? "sqrt(" + Q(t37.body, e) + ")" : "root(" + Q(t37.above, e) + ")(" + Q(t37.body, e) + ")";
break;
case "latex":
r = t37.value;
break;
case "leftright":
{
let D = t37, J = D.leftDelim;
r += J === "." || !J ? "{:" : J, r += Q(D.body, e);
let de = D.matchingRightDelim();
r += de === "." || !de ? ":}" : de;
}
break;
case "sizeddelim":
case "delim":
r = t37.value;
break;
case "overlap":
break;
case "overunder":
break;
case "mord":
r = (l = (s = lo[i]) != null ? s : i) != null ? l : typeof t37.value == "string" ? t37.value : "", r.startsWith("\\") && (r += " "), n = i ? i.match(/{?\\char"([\dabcdefABCDEF]+)}?/) : null, n ? r = String.fromCodePoint(Number.parseInt("0x" + n[1])) : r.length > 0 && r.startsWith("\\") && (r = typeof t37.value == "string" ? t37.value.charAt(0) : t37.command), r = Pg(r, t37.style);
break;
case "mbin":
case "mrel":
case "minner":
r = (u = (c = lo[i]) != null ? c : co[i]) != null ? u : t37.value;
break;
case "mopen":
case "mclose":
r = t37.value;
break;
case "mpunct":
r = (d = co[i]) != null ? d : i;
break;
case "mop":
case "operator":
case "extensible-symbol":
t37.value !== "\u200B" && (co[i] ? r = co[i] : r = i === "\\operatorname" ? Q(t37.body, e) : (m = t37.value) != null ? m : i, r += " ");
break;
case "array":
let v = t37.array, k = t37.environmentName, C = (h = { bmatrix: ["[", "]"], "bmatrix*": ["[", "]"] }[k]) != null ? h : ["(", ")"], q = [];
for (let D of v) {
let J = [];
for (let de of D)
J.push(C[0] + Q(de, e) + C[1]);
q.push(J.join(","));
}
let B = (f = { bmatrix: ["[", "]"], "bmatrix*": ["[", "]"], cases: ["{", ":}"] }[k]) != null ? f : ["(", ")"];
r = B[0] + q.join(",") + B[1];
break;
case "box":
break;
case "spacing":
r = (b = lo[i]) != null ? b : " ";
break;
case "enclose":
r = "(" + Q(t37.body, e) + ")";
break;
case "space":
r = " ";
break;
case "subsup":
r = "";
break;
case "macro":
r = (M = (S = lo[i]) != null ? S : co[i]) != null ? M : Q(t37.body, e);
break;
}
if (!t37.hasEmptyBranch("subscript")) {
r += "_";
let x = Q(t37.subscript, e);
r += x.length !== 1 ? `(${x})` : x;
}
if (!t37.hasEmptyBranch("superscript")) {
r += "^";
let x = Q(t37.superscript, e);
r += x.length !== 1 ? `(${x})` : x;
}
return r;
}
function Pg(t37, e) {
if (!e)
return t37;
let r = t37;
return e.variant === "double-struck" && (r = `bbb "${r}"`), e.variant === "script" && (r = `cc "${r}"`), e.variant === "fraktur" && (r = `fr "${r}"`), e.variant === "sans-serif" && (r = `sf "${r}"`), e.variant === "monospace" && (r = `tt "${r}"`), e.variantStyle === "bold" && (r = `bb "${r}"`), e.color ? `color({${e.color}})(${r})` : r;
}
function oe(t37, e) {
var c;
e != null || (e = {}), e.mathstyle = (c = e.mathstyle) != null ? c : "displaystyle";
let { mathstyle: r, letterShapeStyle: i, context: n } = e != null ? e : {};
r = r != null ? r : "displaystyle", i = i != null ? i : "tex", n != null || (n = {});
let o = new T({ from: p(g(p({}, Rn()), { renderPlaceholder: () => new w(160, { maxFontSize: 1 }), letterShapeStyle: i }), n), mathstyle: r }), s = new y({ mode: "math", type: "root", body: se(t37, { context: o, parseMode: "math", mathstyle: r }) }).render(o);
return s ? (dr(Tt(s, o)), mr(s, { classes: "ML__latex" }).toMarkup()) : "";
}
function mo(t37) {
if (typeof t37 == "string") {
let e = Rg(t37);
if (!e)
throw new Error(`Invalid color: ${t37}`);
return e;
}
return "C" in t37 ? zg(t37) : "a" in t37 ? Tp(t37) : t37;
}
function mi(t37) {
return t37 < 0 ? 0 : t37 > 255 ? 255 : Math.round(t37);
}
function Rg(t37) {
if (!t37 || t37[0] !== "#")
return;
t37 = t37.slice(1);
let e;
return t37.length <= 4 ? (e = { r: parseInt(t37[0] + t37[0], 16), g: parseInt(t37[1] + t37[1], 16), b: parseInt(t37[2] + t37[2], 16) }, t37.length === 4 && (e.a = parseInt(t37[3] + t37[3], 16) / 255)) : (e = { r: parseInt(t37[0] + t37[1], 16), g: parseInt(t37[2] + t37[3], 16), b: parseInt(t37[4] + t37[5], 16) }, t37.length === 8 && (e.a = parseInt(t37[6] + t37[7], 16) / 255)), e && typeof e.a == "undefined" && (e.a = 1), e;
}
function mc(t37) {
let [e, r, i] = [t37.L, t37.C, t37.H], n = i * Math.PI / 180, o = { L: e, a: r * Math.cos(n), b: r * Math.sin(n) };
return t37.alpha !== void 0 && (o.alpha = t37.alpha), o;
}
function Ig(t37) {
let [e, r, i] = [t37.L, t37.a, t37.b], n = Math.sqrt(r * r + i * i), a = Math.atan2(i, r) * 180 / Math.PI, s = { L: e, C: n, H: a };
return t37.alpha !== void 0 && (s.alpha = t37.alpha), s;
}
function cc(t37) {
let [e, r, i] = [t37.L, t37.a, t37.b], n = Math.pow(0.9999999984505198 * e + 0.39633779217376786 * r + 0.2158037580607588 * i, 3), o = Math.pow(1.00000000888176 * e - 0.10556134232365635 * r - 0.0638541747717059 * i, 3), a = Math.pow(e * 1.000000054672411 - 0.0894841820949657 * r - 1.2914855378640917 * i, 3), s = 4.076741661347994 * n - 3.307711590408193 * o + 0.230969928729428 * a, l = -1.2684380040921763 * n + 2.6097574006633715 * o - 0.3413193963102197 * a, c = -0.004196086541837188 * n - 0.7034186144594493 * o + 1.7076147009309444 * a, u = (d) => {
let m = Math.abs(d);
return m <= 31308e-7 ? d * 12.92 : (Math.sign(d) || 1) * (1.055 * Math.pow(m, 1 / 2.4) - 0.055);
};
return [u(s), u(l), u(c)];
}
function uc(t37) {
let [e, r, i] = t37;
return e >= 0 && e <= 1 && r >= 0 && r <= 1 && i >= 0 && i <= 1;
}
function dc(t37, e) {
let [r, i, n] = t37;
return r = mi(r * 255), i = mi(i * 255), n = mi(n * 255), e !== void 0 ? { r, g: i, b: n, alpha: e } : { r, g: i, b: n };
}
function Tp(t37) {
let [e, r, i] = cc(t37);
if (uc([e, r, i]))
return dc([e, r, i], t37.alpha);
let n = Ig(t37);
if (n.C = 0, [e, r, i] = cc(mc(n)), !uc([e, r, i]))
return dc([e, r, i], t37.alpha);
let o = 0, a = t37.L, s = (o + a) / 2;
n.C = s;
let l = 0.36 / Math.pow(2, 12);
for (; a - o > l; )
s = (o + a) / 2, n.C = s, [e, r, i] = cc(mc(n)), uc([e, r, i]) ? o = s : a = s;
return dc([e, r, i], t37.alpha);
}
function zg(t37) {
return Tp(mc(t37));
}
function Dp(t37, e) {
let r = mo(t37), i = mo(e), n = 0.56, o = 0.57, a = 0.62, s = 0.65, l = 0.022, c = 1.414, u = 0.1, d = 5e-4, m = 1.14, h = 0.027, f = 1.14, b = 0.027;
function S(B) {
return B >= l ? B : B + (l - B) ** c;
}
function M(B) {
return (B < 0 ? -1 : 1) * Math.pow(Math.abs(B), 2.4);
}
let x = S(M(i.r / 255) * 0.2126729 + M(i.g / 255) * 0.7151522 + M(i.b / 255) * 0.072175), v = S(M(r.r / 255) * 0.2126729 + M(r.g / 255) * 0.7151522 + M(r.b / 255) * 0.072175), k, C, q;
return Math.abs(v - x) < d ? C = 0 : v > x ? (k = v ** n - x ** o, C = k * m) : (k = v ** s - x ** a, C = k * f), Math.abs(C) < u ? q = 0 : C > 0 ? q = C - b : q = C + h, q * 100;
}
function pc(t37, e, r) {
r != null || (r = "#fff"), e != null || (e = "#000");
let i = Dp(t37, r), n = Dp(t37, e);
return Math.abs(i) > Math.abs(n) ? r : e;
}
function Kp(t37) {
let e = mo(t37), r = ((1 << 24) + (mi(e.r) << 16) + (mi(e.g) << 8) + mi(e.b)).toString(16).slice(1);
return e.alpha !== void 0 && e.alpha < 1 && (r += ("00" + Math.round(e.alpha * 255).toString(16)).slice(-2)), r[0] === r[1] && r[2] === r[3] && r[4] === r[5] && r[6] === r[7] && (r = r[0] + r[2] + r[4] + (e.alpha !== void 0 && e.alpha < 1 ? r[6] : "")), "#" + r;
}
function j(t37) {
let e = Bp(t37), r = "";
for (let i of e) {
if (typeof i.value != "string")
return "";
r += i.value;
}
return r;
}
function Bp(t37) {
let r = t37.model.selection.ranges;
if (r.length !== 1)
return [];
let i = t37.model.getAtoms(r[0]);
return i.length === 1 && i[0].type === "root" && (i = i[0].children), i.filter((n) => n.type !== "first");
}
function Ng(t37, e) {
let r = Bp(t37);
if (r.length !== 1)
return false;
let i = Oa[e];
return i ? !!i.test(r[0].value) : false;
}
function Fg(t37) {
return j(t37).length > 0;
}
function $g(t37) {
return [hc(t37, "double-struck", "mathbb", "tooltip.blackboard"), hc(t37, "fraktur", "mathfrak", "tooltip.fraktur"), hc(t37, "calligraphic", "mathcal", "tooltip.caligraphic"), fc(t37, "up", "mathrm", "tooltip.roman-upright"), fc(t37, "bold", "bm", "tooltip.bold"), fc(t37, "italic", "mathit", "tooltip.italic")];
}
function Vg(t37) {
return [{ id: "accent-vec", class: "ML__center-menu", label: () => oe(`\\vec{${j(t37)}}`), visible: () => j(t37).length === 1, onMenuSelect: () => t37.insert("\\vec{#@}", { selectionMode: "item" }) }, { id: "accent-overrightarrow", class: "ML__center-menu", label: () => oe(`\\overrightarrow{${j(t37)}}`), visible: () => j(t37).length > 0, onMenuSelect: () => t37.insert("\\overrightarrow{#@}", { selectionMode: "item" }) }, { id: "accent-overleftarrow", class: "ML__center-menu", label: () => oe(`\\overleftarrow{${j(t37)}}`), visible: () => j(t37).length > 0, onMenuSelect: () => t37.insert("\\overleftarrow{#@}", { selectionMode: "item" }) }, { id: "accent-dot", class: "ML__center-menu", label: () => oe(`\\dot{${j(t37)}}`), visible: () => j(t37).length === 1, onMenuSelect: () => t37.insert("\\dot{#@}", { selectionMode: "item" }) }, { id: "accent-ddot", class: "ML__center-menu", label: () => oe(`\\ddot{${j(t37)}}`), visible: () => j(t37).length === 1, onMenuSelect: () => t37.insert("\\ddot{#@}", { selectionMode: "item" }) }, { id: "accent-bar", class: "ML__center-menu", label: () => oe(`\\bar{${j(t37)}}`), visible: () => j(t37).length === 1, onMenuSelect: () => t37.insert("\\bar{#@}", { selectionMode: "item" }) }, { id: "accent-overline", class: "ML__center-menu", label: () => oe(`\\overline{${j(t37)}}`), visible: () => j(t37).length > 0, onMenuSelect: () => t37.insert("\\overline{#@}", { selectionMode: "item" }) }, { id: "accent-overgroup", class: "ML__center-menu", label: () => oe(`\\overgroup{${j(t37)}}`), visible: () => j(t37).length > 0, onMenuSelect: () => t37.insert("\\overgroup{#@}", { selectionMode: "item" }) }, { id: "accent-overbrace", class: "ML__center-menu", label: () => oe(`\\overbrace{${j(t37)}}`), visible: () => j(t37).length > 0, onMenuSelect: () => t37.insert("\\overbrace{#@}", { selectionMode: "item" }) }, { id: "accent-underline", class: "ML__center-menu", label: () => oe(`\\underline{${j(t37)}}`), visible: () => j(t37).length > 0, onMenuSelect: () => t37.insert("\\underline{#@}", { selectionMode: "item" }) }, { id: "accent-undergroup", class: "ML__center-menu", label: () => oe(`\\undergroup{${j(t37)}}`), visible: () => j(t37).length > 0, onMenuSelect: () => t37.insert("\\undergroup{#@}", { selectionMode: "item" }) }, { id: "accent-underbrace", class: "ML__center-menu", label: () => oe(`\\underbrace{${j(t37)}}`), visible: () => j(t37).length > 0, onMenuSelect: () => t37.insert("\\underbrace{#@}", { selectionMode: "item" }) }];
}
function qg(t37) {
return [{ id: "decoration-boxed", label: () => oe(`\\boxed{${t37.getValue(t37.model.selection)}}}`), onMenuSelect: () => t37.insert("\\boxed{#@}", { selectionMode: "item" }) }, { id: "decoration-red-box", label: () => oe(`\\bbox[5px, border: 2px solid red]{${t37.getValue(t37.model.selection)}}`), onMenuSelect: () => t37.insert("\\bbox[5px, border: 2px solid red]{#@}", { selectionMode: "item" }) }, { id: "decoration-dashed-black-box", label: () => oe(`\\bbox[5px, border: 2px dashed black]{${t37.getValue(t37.model.selection)}}`), onMenuSelect: () => t37.insert("\\bbox[5px, border: 2px dashed black]{#@}", { selectionMode: "item" }) }];
}
function Hg(t37) {
let e = [];
for (let r of Object.keys(It))
e.push({ id: `background-color-${r}`, class: (Kp(pc(It[r])) === "#000" ? "dark-contrast" : "light-contrast") + " menu-swatch", label: `<span style="background:${It[r]} "></span>`, ariaLabel: () => {
var i;
return (i = P(r)) != null ? i : r;
}, checked: () => {
var i;
return (i = { some: "mixed", all: true }[t37.queryStyle({ backgroundColor: r })]) != null ? i : false;
}, onMenuSelect: () => t37.applyStyle({ backgroundColor: r }, { operation: "toggle" }) });
return e;
}
function Wg(t37) {
let e = [];
for (let r of Object.keys(zt))
e.push({ id: `color-${r}`, class: (pc(zt[r]) === "#000" ? "dark-contrast" : "light-contrast") + " menu-swatch", label: `<span style="background:${zt[r]} "></span>`, ariaLabel: () => {
var i;
return (i = P(r)) != null ? i : r;
}, checked: () => {
var i;
return (i = { some: "mixed", all: true }[t37.queryStyle({ color: r })]) != null ? i : false;
}, onMenuSelect: () => t37.applyStyle({ color: r }, { operation: "toggle" }) });
return e;
}
var gc = class extends ln {
constructor(e, r, i, n) {
super(e, r), this.row = i, this.col = n;
}
set active(e) {
let r = this.parentMenu.children;
if (e)
for (let i of r)
i.element.classList.toggle("active", i.row <= this.row && i.col <= this.col);
else
for (let i of r)
i.element.classList.remove("active");
}
};
function Ug(t37) {
let e = [];
for (let r = 1; r <= 5; r++)
for (let i = 1; i <= 5; i++)
e.push({ id: `insert-matrix-${r}x${i}`, onCreate: (n, o) => new gc(n, o, r, i), label: "\u2610", tooltip: () => P("tooltip.row-by-col", r, i), data: { row: r, col: i }, onMenuSelect: () => {
t37.insert(`\\begin{pmatrix}${Array(r).fill(Array(i).fill("#?").join(" & ")).join("\\\\")}\\end{pmatrix}`, { selectionMode: "item" });
} });
return e;
}
function Op(t37) {
return [{ label: () => P("menu.array.add row above"), id: "add-row-above", onMenuSelect: () => t37.executeCommand("addRowBefore"), keyboardShortcut: "shift+alt+[Return]", visible: () => pi(t37) }, { label: () => P("menu.array.add row below"), id: "add-row-below", onMenuSelect: () => t37.executeCommand("addRowAfter"), keyboardShortcut: "alt+[Return]", visible: () => pi(t37) }, { label: () => P("menu.array.add column before"), id: "add-column-before", onMenuSelect: () => t37.executeCommand("addColumnBefore"), visible: () => pi(t37), keyboardShortcut: "shift+alt+[Tab]", enabled: () => {
let e = t37.model.parentEnvironment;
if (!e)
return false;
let [r, i] = Gg(t37);
return r < e.maxColumns;
} }, { label: () => P("menu.array.add column after"), id: "add-column-after", onMenuSelect: () => t37.executeCommand("addColumnAfter"), keyboardShortcut: "alt+[Tab]", visible: () => pi(t37) }, { type: "divider" }, { label: () => P("menu.array.delete row"), id: "delete-row", onMenuSelect: () => t37.executeCommand("removeRow"), visible: () => pi(t37) }, { label: () => P("menu.array.delete column"), id: "delete-column", onMenuSelect: () => t37.executeCommand("removeColumn"), visible: () => pi(t37) }, { type: "divider" }, { label: () => P("menu.borders"), visible: () => (Jg(t37) || pi(t37)) && t37.isSelectionEditable, submenu: [{ label: " \u22F1 ", id: "environment-no-border", onMenuSelect: () => po(t37, "matrix") }, { label: "(\u22F1)", id: "environment-parentheses", onMenuSelect: () => po(t37, "pmatrix") }, { label: "[\u22F1]", id: "environment-brackets", onMenuSelect: () => po(t37, "bmatrix") }, { label: "|\u22F1|", id: "environment-bar", onMenuSelect: () => po(t37, "vmatrix") }, { label: "{\u22F1}", id: "environment-braces", onMenuSelect: () => po(t37, "Bmatrix") }], submenuClass: "border-submenu" }, { type: "divider" }, { label: () => P("menu.insert matrix"), id: "insert-matrix", visible: () => t37.isSelectionEditable, submenu: Ug(t37), submenuClass: "insert-matrix-submenu", columnCount: 5 }, { label: () => P("menu.mode"), id: "mode", visible: () => t37.isSelectionEditable && t37.model.selectionIsCollapsed, submenu: [{ label: () => P("menu.mode-math"), id: "mode-math", onMenuSelect: () => {
Bt(t37, "accept-all"), t37.executeCommand(["switchMode", "math"]);
}, checked: () => t37.model.mode === "math" }, { label: () => P("menu.mode-text"), id: "mode-text", onMenuSelect: () => {
Bt(t37, "accept-all"), t37.executeCommand(["switchMode", "text"]);
}, checked: () => t37.model.mode === "text" }, { label: () => P("menu.mode-latex"), id: "mode-latex", onMenuSelect: () => t37.executeCommand(["switchMode", "latex"]), checked: () => t37.model.mode === "latex" }] }, { type: "divider" }, { label: () => P("menu.font-style"), id: "variant", visible: () => t37.isSelectionEditable, submenu: $g(t37), submenuClass: "variant-submenu" }, { label: () => P("menu.color"), id: "color", visible: () => t37.isSelectionEditable, submenu: Wg(t37), columnCount: 4, submenuClass: "swatches-submenu" }, { label: () => P("menu.background-color"), id: "background-color", visible: () => t37.isSelectionEditable, submenu: Hg(t37), columnCount: 4, submenuClass: "swatches-submenu" }, { label: () => P("menu.accent"), id: "accent", visible: () => t37.isSelectionEditable, submenu: Vg(t37), submenuClass: "variant-submenu" }, { label: () => P("menu.decoration"), id: "decoration", visible: () => t37.isSelectionEditable && j(t37).length > 0, submenu: qg(t37), submenuClass: "variant-submenu" }, { type: "divider" }, { label: () => P("menu.evaluate"), id: "ce-evaluate", visible: () => t37.isSelectionEditable && globalThis.MathfieldElement.computeEngine !== null, onMenuSelect: () => {
let e = jg(t37);
if (!e) {
t37.model.announce("plonk");
return;
}
t37.model.selectionIsCollapsed ? (t37.model.position = t37.model.lastOffset, t37.insert(`=${e}`, { insertionMode: "insertAfter", selectionMode: "item" })) : t37.insert(e, { insertionMode: "replaceSelection", selectionMode: "item" });
} }, { label: () => P("menu.simplify"), id: "ce-simplify", visible: () => t37.isSelectionEditable && globalThis.MathfieldElement.computeEngine !== null, onMenuSelect: () => {
var e, r;
if (t37.model.selectionIsCollapsed) {
let i = (e = t37.expression) == null ? void 0 : e.simplify();
if (t37.model.position = t37.model.lastOffset, !i) {
t37.model.announce("plonk");
return;
}
t37.insert(`=${i.latex}`, { insertionMode: "insertAfter", selectionMode: "item" });
} else {
let i = (r = globalThis.MathfieldElement.computeEngine) == null ? void 0 : r.parse(t37.getValue(t37.model.selection)).simplify();
if (!i) {
t37.model.announce("plonk");
return;
}
t37.insert(i.latex, { insertionMode: "replaceSelection", selectionMode: "item" });
}
} }, { label: () => {
var i;
let e = globalThis.MathfieldElement.computeEngine;
if (e === null)
return "";
let r = (i = t37.expression) == null ? void 0 : i.unknowns[0];
if (r) {
let n = e.box(r).latex;
return P("menu.solve-for", oe(n));
}
return P("menu.solve");
}, id: "ce-solve", visible: () => {
var e;
return t37.isSelectionEditable && globalThis.MathfieldElement.computeEngine !== null && ((e = t37.expression) == null ? void 0 : e.unknowns.length) === 1 && t37.expression.unknowns[0] !== "Nothing";
}, onMenuSelect: () => {
var n;
let e = t37.expression, r = e == null ? void 0 : e.unknowns[0], i = (n = e.solve(r)) == null ? void 0 : n.map((o) => {
var a;
return (a = o.simplify().latex) != null ? a : "";
});
if (!i) {
t37.model.announce("plonk");
return;
}
t37.insert(`${r}=${i.length === 1 ? i[0] : "\\left\\lbrace" + (i == null ? void 0 : i.join(", ")) + "\\right\\rbrace"}`, { insertionMode: "replaceAll", selectionMode: "item" });
} }, { type: "divider" }, { label: () => P("menu.cut"), id: "cut", onMenuSelect: () => t37.executeCommand("cutToClipboard"), visible: () => !t37.options.readOnly && t37.isSelectionEditable, keyboardShortcut: "meta+X" }, { label: () => P("menu.copy"), id: "copy", submenu: [{ label: () => P("menu.copy-as-latex"), id: "copy-latex", onMenuSelect: () => z.copyToClipboard(t37, "latex"), keyboardShortcut: "meta+C" }, { label: () => P("menu.copy-as-ascii-math"), id: "copy-ascii-math", onMenuSelect: () => z.copyToClipboard(t37, "ascii-math") }, { label: () => P("menu.copy-as-mathml"), id: "copy-math-ml", onMenuSelect: () => z.copyToClipboard(t37, "math-ml") }] }, { label: () => P("menu.paste"), id: "paste", onMenuSelect: () => t37.executeCommand("pasteFromClipboard"), visible: () => t37.hasEditableContent, keyboardShortcut: "meta+V" }, { label: () => P("menu.select-all"), id: "select-all", keyboardShortcut: "meta+A", onMenuSelect: () => t37.executeCommand("selectAll") }];
}
function pi(t37) {
var e;
return !!((e = t37.model.parentEnvironment) != null && e.array);
}
function Jg(t37) {
return t37.model.at(t37.model.position).type === "array";
}
function Gg(t37) {
var r;
let e = (r = t37.model.parentEnvironment) == null ? void 0 : r.array;
return e ? [e.length, e.reduce((i, n) => Math.max(i, n.length), 0)] : [0, 0];
}
function po(t37, e) {
Zr(t37), t37.flushInlineShortcutBuffer(), Wl(t37.model, e), V(t37);
}
function jg(t37) {
var i, n;
let e;
if (t37.model.selectionIsCollapsed ? e = (i = globalThis.MathfieldElement.computeEngine) == null ? void 0 : i.parse(t37.getValue(), { canonical: false }) : e = (n = globalThis.MathfieldElement.computeEngine) == null ? void 0 : n.parse(t37.getValue(t37.model.selection), { canonical: false }), !e)
return "";
let r = e.evaluate();
return r.isSame(e) && (r = e.N()), r.latex;
}
function hc(t37, e, r, i) {
return { id: `variant-${e}`, label: () => {
var o;
return j(t37).length < 12 ? oe(`\\${r}{${j(t37)}}`) : (o = P(i)) != null ? o : i;
}, class: "ML__xl", tooltip: () => {
var n;
return (n = P(i)) != null ? n : i;
}, visible: () => Ng(t37, e), checked: () => {
var n;
return (n = { some: "mixed", all: true }[t37.queryStyle({ variant: e })]) != null ? n : false;
}, onMenuSelect: () => t37.applyStyle({ variant: e }, { operation: "toggle" }) };
}
function fc(t37, e, r, i) {
return { id: `variant-style-${e}`, label: () => {
var o;
let n = j(t37);
return n.length > 0 && n.length < 12 ? oe(`\\${r}{${j(t37)}}`) : (o = P(i)) != null ? o : i;
}, class: () => {
let n = j(t37);
return n.length > 0 && n.length < 12 ? "ML__xl" : "";
}, tooltip: () => {
var n;
return (n = P(i)) != null ? n : i;
}, visible: e === "bold" ? true : () => Fg(t37), checked: () => {
var n;
return (n = { some: "mixed", all: true }[t37.queryStyle({ variantStyle: e })]) != null ? n : false;
}, onMenuSelect: () => t37.applyStyle({ variantStyle: e }, { operation: "toggle" }) };
}
function Cr(t37, e) {
return typeof t37 == "string" ? t37 + mt(e) : mt(t37);
}
function yc(t37) {
var r;
let e;
if (t37.parent.type === "prompt")
t37.parentBranch === "body" && (e = "prompt");
else if (t37.parentBranch === "body") {
if (t37.type === "first" && (t37.parent.type === "root" ? e = "mathfield" : t37.parent.type === "surd" ? e = "radicand" : t37.parent.type === "genfrac" ? e = "fraction" : t37.parent.type === "sizeddelim" && (e = "delimiter"), e))
return e;
t37.type === "subsup" ? t37.superscript && t37.subscript ? e = "superscript and subscript" : t37.superscript ? e = "superscript" : t37.subscript && (e = "subscript") : t37.type && (e = (r = { accent: "accented", array: "array", box: "box", chem: "chemical formula", delim: "delimiter", enclose: "cross out", "extensible-symbol": "extensible symbol", error: "error", first: "first", genfrac: "fraction", group: "group", latex: "LaTeX", leftright: "delimiter", line: "line", subsup: "subscript-superscript", operator: "operator", overunder: "over-under", placeholder: "placeholder", rule: "rule", sizeddelim: "delimiter", space: "space", spacing: "spacing", surd: "square root", text: "text", prompt: "prompt", root: "math field", mop: "operator" }[t37.type]) != null ? r : "parent");
} else if (t37.parent.type === "genfrac") {
if (t37.parentBranch === "above")
return "numerator";
if (t37.parentBranch === "below")
return "denominator";
} else
t37.parent.type === "surd" ? t37.parentBranch === "above" && (e = "index") : t37.parentBranch === "superscript" ? e = "superscript" : t37.parentBranch === "subscript" && (e = "subscript");
return e != null ? e : "parent";
}
function Pp(t37, e, r, i) {
let n = "";
if (e === "plonk") {
globalThis.MathfieldElement.playSound("plonk"), t37.flushInlineShortcutBuffer();
return;
}
if (e === "delete")
n = Cr("deleted: ", i);
else if (e === "focus" || e.includes("move"))
n = Xg(t37.model, r), n += Zg(t37.model);
else if (e === "replacement")
n = Cr(t37.model.at(t37.model.position));
else if (e === "line") {
let o = Cr(t37.model.root);
t37.keyboardDelegate.setAriaLabel(o);
} else
n = i ? Cr(e + " ", i) : e;
if (n) {
let o = t37.ariaLiveText.textContent.includes("\xA0") ? " \u202F " : " \xA0 ";
t37.ariaLiveText.textContent = n + o;
}
}
function Xg(t37, e) {
if (Number.isNaN(e))
return "";
let r = t37.at(e);
if (!r || r.treeDepth <= t37.at(t37.position).treeDepth)
return "";
let i = "", n = r.parent, o = t37.at(t37.position).parent;
for (; n !== t37.root && n !== o; )
i += `out of ${yc(n)};`, n = n.parent;
return i;
}
function Zg(t37) {
if (!t37.selectionIsCollapsed)
return `selected: ${Cr(t37.getAtoms(t37.selection))}`;
let e = "", r = t37.at(t37.position);
if (r.isFirstSibling && (e = `start of ${yc(r)}: `), r.isLastSibling) {
if (!r.isFirstSibling) {
if (!r.parent.parent)
return `${Cr(r)}; end of mathfield`;
e = `${Cr(r)}; end of ${yc(r)}`;
}
} else
e += Cr(r);
return e;
}
var ps = class {
constructor(e, r, i) {
this.mathfield = e, this.mode = r, this.silenceNotifications = false, this._selection = { ranges: [[0, 0]], direction: "none" }, this._anchor = 0, this._position = 0, this.root = i;
}
dispose() {
this.mathfield = void 0;
}
getState() {
let e = { ranges: [...this._selection.ranges] };
return this.selection.direction && this.selection.direction !== "none" && (e.direction = this.selection.direction), { content: this.root.toJson(), selection: e, mode: this.mode };
}
setState(e, r) {
var o;
let i = this.silenceNotifications;
this.silenceNotifications = (o = r == null ? void 0 : r.silenceNotifications) != null ? o : true;
let n = {};
if ((r == null ? void 0 : r.type) === "undo" && (n = { inputType: "historyUndo" }), (r == null ? void 0 : r.type) === "redo" && (n = { inputType: "historyRedo" }), this.contentWillChange(n)) {
let a = this.silenceNotifications;
this.silenceNotifications = true, this.mode = e.mode, this.root = ot(e.content), this.selection = e.selection, this.silenceNotifications = a, this.contentDidChange(n);
}
this.silenceNotifications = i;
}
get atoms() {
return this.root.children;
}
get selection() {
return this._selection;
}
set selection(e) {
this.setSelection(e);
}
setSelection(e, r) {
return !this.mathfield.contentEditable && this.mathfield.userSelect === "none" ? false : this.deferNotifications({ selection: true }, () => {
var l, c, u;
let i = this.normalizeSelection(e, r);
if (i === void 0)
throw new TypeError("Invalid selection");
if (i.ranges.length === 1 && i.ranges[0][0] === i.ranges[0][1]) {
let d = i.ranges[0][0];
if (!this.mathfield.dirty && !((l = this.at(d)) != null && l.parentPrompt) && this.mathfield.hasEditablePrompts) {
if ((c = this.at(d - 1)) != null && c.parentPrompt) {
this._anchor = this.normalizeOffset(d - 1), this._position = this._anchor, this._selection = this.normalizeSelection(this._anchor);
return;
}
if ((u = this.at(d + 1)) != null && u.parentPrompt) {
this._anchor = this.normalizeOffset(d + 1), this._position = this._anchor, this._selection = this.normalizeSelection(this._anchor);
return;
}
this._anchor = 0, this._position = 0, this._selection = { ranges: [[0, 0]] };
return;
}
this._anchor = d, this._position = d, this._selection = i;
return;
}
let n = te(i);
i.direction === "backward" ? [this._position, this._anchor] = n : [this._anchor, this._position] = n;
let o = this.at(n[0] + 1), a = this.at(n[1]), s = y.commonAncestor(o, a);
(s == null ? void 0 : s.type) === "array" && o.parent === s && a.parent === s ? this._selection = { ranges: [n], direction: i.direction } : this._selection = { ranges: [n], direction: i.direction }, this._position >= 0 && this._position <= this.lastOffset;
});
}
setPositionHandlingPlaceholder(e) {
var i;
let r = this.at(e);
(r == null ? void 0 : r.type) === "placeholder" ? this.setSelection(e - 1, e) : ((i = r == null ? void 0 : r.rightSibling) == null ? void 0 : i.type) === "placeholder" ? this.setSelection(e, e + 1) : this.position = e, r instanceof ie && r.isSuggestion && (r.isSuggestion = false), this.mathfield.stopCoalescingUndo();
}
get position() {
return this._position;
}
set position(e) {
this.setSelection(e, e);
}
get anchor() {
return this._anchor;
}
get selectionIsCollapsed() {
return this._anchor === this._position;
}
get selectionIsPlaceholder() {
return Math.abs(this._anchor - this._position) === 1 ? this.at(Math.max(this._anchor, this._position)).type === "placeholder" : false;
}
collapseSelection(e = "forward") {
return this._anchor === this._position ? false : (e === "backward" ? this.position = Math.min(this._anchor, this._position) : this.position = Math.max(this._anchor, this._position), true);
}
get lastOffset() {
return this.atoms.length - 1;
}
at(e) {
return this.atoms[e];
}
offsetOf(e) {
return this.atoms.indexOf(e);
}
getSiblingsRange(e) {
let r = this.at(e), { parent: i } = r;
if (!i)
return [0, this.lastOffset];
let n = r.parent.branch(r.parentBranch);
return [this.offsetOf(n[0]), this.offsetOf(n[n.length - 1])];
}
getBranchRange(e, r) {
let i = this.at(e).branch(r);
return [this.offsetOf(i[0]), this.offsetOf(i[i.length - 1])];
}
getAtoms(e, r, i) {
let n = i != null ? i : {};
if (Oi(e)) {
if (n = r != null ? r : {}, e.ranges.length > 1)
return e.ranges.reduce((u, d) => [...u, ...this.getAtoms(d, n)], []);
e = e.ranges[0];
}
let o, a;
if (Lt(e)) {
if (o = e, !Lt(r))
return [];
a = r;
} else
[o, a] = e, n = r != null ? r : {};
if (!Number.isFinite(o))
return [];
n.includeChildren === void 0 && (n.includeChildren = false), o < 0 && (o = this.lastOffset - o + 1), a < 0 && (a = this.lastOffset + a + 1);
let s = Math.min(o, a) + 1, l = Math.max(o, a);
if (!n.includeChildren && s === 1 && l === this.lastOffset)
return [this.root];
let c = [];
for (let u = s; u <= l; u++) {
let d = this.atoms[u];
Rp(this, d, s, l) && c.push(d);
}
return n.includeChildren || (c = c.filter((u) => {
let d = false, { parent: m } = u;
for (; m && !d; )
d = Rp(this, m, s, l), m = m.parent;
return !d;
})), c;
}
getAllAtoms(e = 0) {
let r = [], i = this.lastOffset;
for (let n = e; n <= i; n++)
r.push(this.atoms[n]);
for (let n = 0; n < e; n++)
r.push(this.atoms[n]);
return r;
}
findAtom(e, r = 0, i = "forward") {
let n, o = this.lastOffset;
if (i === "forward") {
for (let a = r; a <= o; a++)
if (n = this.atoms[a], e(n))
return n;
for (let a = 0; a < r; a++)
if (n = this.atoms[a], e(n))
return n;
return;
}
for (let a = r; a >= 0; a--)
if (n = this.atoms[a], e(n))
return n;
for (let a = o; a > r; a--)
if (n = this.atoms[a], e(n))
return n;
}
extractAtoms(e) {
let r = this.getAtoms(e);
if (r.length === 1 && !r[0].parent)
if (r[0].type === "root")
r = [...r[0].body], r.shift();
else
return r = this.root.cells.flat(), this.root = new y({ type: "root", body: [] }), r;
for (let i of r)
i.parent.removeChild(i);
return r;
}
deleteAtoms(e) {
e != null || (e = [0, -1]), this.extractAtoms(e), this.position = e[0];
}
atomToString(e, r) {
let i = r != null ? r : "latex";
if (i.startsWith("latex"))
return y.serialize([e], { expandMacro: i === "latex-expanded", skipStyles: i === "latex-unstyled", skipPlaceholders: i === "latex-without-placeholders", defaultMode: this.mathfield.options.defaultMode });
if (i === "math-ml")
return F(e);
if (i === "spoken")
return mt(e);
if (i === "spoken-text") {
let n = globalThis.MathfieldElement.textToSpeechMarkup;
globalThis.MathfieldElement.textToSpeechMarkup = "";
let o = mt(e);
return globalThis.MathfieldElement.textToSpeechMarkup = n, o;
}
if (i === "spoken-ssml" || i === "spoken-ssml-with-highlighting") {
let n = globalThis.MathfieldElement.textToSpeechMarkup;
globalThis.MathfieldElement.textToSpeechMarkup = "ssml";
let o = mt(e);
return globalThis.MathfieldElement.textToSpeechMarkup = n, o;
}
return i === "plain-text" ? Q(e, { plain: true }) : i === "ascii-math" ? Q(e) : (console.error(`MathLive 0.100.0: Unexpected format "${i}`), "");
}
getValue(e, r, i) {
if (e === void 0)
return this.atomToString(this.root, "latex");
if (typeof e == "string" && e !== "math-json")
return this.atomToString(this.root, e);
let n, o;
if (Lt(e) && Lt(r) ? (n = [this.normalizeRange([e, r])], o = i) : $r(e) ? (n = [this.normalizeRange(e)], o = r) : Oi(e) ? (n = e.ranges, o = r) : (n = [this.normalizeRange([0, -1])], o = e), o != null || (o = "latex"), o === "math-json") {
if (!globalThis.MathfieldElement.computeEngine)
return window[Symbol.for("io.cortexjs.compute-engine")] || console.error(`The CortexJS Compute Engine library is not available.
Load the library, for example with:
import "https://unpkg.com/@cortex-js/compute-engine?module"`), '["Error", "compute-engine-not-available"]';
let a = this.getValue({ ranges: n }, "latex-unstyled");
try {
let s = globalThis.MathfieldElement.computeEngine.parse(a);
return JSON.stringify(s.json);
} catch (s) {
return JSON.stringify(["Error", `'${s.toString()}'`]);
}
}
if (o.startsWith("latex")) {
let a = { expandMacro: o === "latex-expanded", skipStyles: o === "latex-unstyled", skipPlaceholders: o === "latex-without-placeholders", defaultMode: this.mathfield.options.defaultMode };
return K(n.map((s) => y.serialize(this.getAtoms(s), a)));
}
return n.map((a) => this.getAtoms(a).map((s) => this.atomToString(s, o)).join("")).join("");
}
extendSelectionTo(e, r) {
return !this.mathfield.contentEditable && this.mathfield.userSelect === "none" ? false : this.deferNotifications({ selection: true }, () => {
let i = this.normalizeRange([e, r]), [n, o] = i, { parent: a } = this.at(o);
if (a && (a.type === "genfrac" || a.type === "subsup"))
for (; a !== this.root && bc(this, a, [n, o]); )
o = this.offsetOf(a), a = a.parent;
for (a = this.at(n).parent; a !== this.root && bc(this, a, [n, o]); )
n = this.offsetOf(a.leftSibling), a = a.parent;
if (a = this.at(o).parent, (a == null ? void 0 : a.type) === "genfrac")
for (; a !== this.root && bc(this, a, [n, o]); )
o = this.offsetOf(a), o >= 0, a = a.parent;
this._position = this.normalizeOffset(r), this._selection = { ranges: [[n, o]], direction: "none" };
});
}
announce(e, r, i = []) {
var o, a;
((a = (o = this.mathfield.host) == null ? void 0 : o.dispatchEvent(new CustomEvent("announce", { detail: { command: e, previousPosition: r, atoms: i }, cancelable: true, bubbles: true, composed: true }))) != null ? a : true) && Pp(this.mathfield, e, r, i);
}
deferNotifications(e, r) {
let i = this._selection, n = this._anchor, o = this._position, a = this.silenceNotifications;
this.silenceNotifications = true;
let s = this.root.changeCounter;
r();
let l = this.root.changeCounter !== s, c = n !== this._anchor || o !== this._position || R0(this._selection, i) === "different";
return this.silenceNotifications = a, e.content && l && this.contentDidChange({ inputType: e.type }), e.selection && c && this.selectionDidChange(), l || c;
}
normalizeOffset(e) {
return e > 0 ? e = Math.min(e, this.lastOffset) : e < 0 && (e = this.lastOffset + e + 1), e;
}
normalizeRange(e) {
let [r, i] = e;
return r = this.normalizeOffset(r), i = this.normalizeOffset(i), r < i ? [r, i] : [i, r];
}
normalizeSelection(e, r) {
var n;
let i;
if (Lt(e)) {
let o = this.normalizeOffset(e);
if (Lt(r)) {
let a = this.normalizeOffset(r);
i = o <= a ? { ranges: [[o, a]], direction: "none" } : { ranges: [[a, o]], direction: "backward" };
} else
i = { ranges: [[o, o]], direction: "none" };
} else if ($r(e)) {
let o = this.normalizeOffset(e[0]), a = this.normalizeOffset(e[1]);
i = o <= a ? { ranges: [[o, a]], direction: "none" } : { ranges: [[a, o]], direction: "backward" };
} else
Oi(e) && (i = { ranges: e.ranges.map((o) => this.normalizeRange(o)), direction: (n = e.direction) != null ? n : "none" });
return i;
}
get parentEnvironment() {
let e = this.at(this.position).parent;
if (e) {
for (; e.parent && e.type !== "array"; )
e = e.parent;
if (e.type === "array")
return e;
}
}
get cell() {
var r;
let e = this.at(this.position);
if (e) {
for (; e && ((r = e.parent) == null ? void 0 : r.type) !== "array"; )
e = e.parent;
if (!(!(e != null && e.parent) || e.parent.type !== "array"))
return e.parentBranch;
}
}
contentWillChange(e = {}) {
if (this.silenceNotifications || !this.mathfield)
return true;
let r = this.silenceNotifications;
this.silenceNotifications = true;
let i = this.mathfield.onContentWillChange(e);
return this.silenceNotifications = r, i;
}
contentDidChange(e) {
if (window.mathVirtualKeyboard.visible && window.mathVirtualKeyboard.update(We(this.mathfield)), this.silenceNotifications || !this.mathfield.host || !this.mathfield)
return;
let r = this.silenceNotifications;
this.silenceNotifications = true, setTimeout(() => {
var i;
!this.mathfield || !tt(this.mathfield) || !this.mathfield.host || (this.mathfield.host.dispatchEvent(new InputEvent("input", g(p({}, e), { data: e.data ? e.data : (i = e.inputType) != null ? i : "", bubbles: true, composed: true }))), this.silenceNotifications = r);
}, 0);
}
selectionDidChange() {
if (!this.mathfield || (window.mathVirtualKeyboard.visible && window.mathVirtualKeyboard.update(We(this.mathfield)), this.silenceNotifications))
return;
let e = this.silenceNotifications;
this.silenceNotifications = true, this.mathfield.onSelectionDidChange(), this.silenceNotifications = e;
}
};
function Rp(t37, e, r, i) {
let n = t37.offsetOf(e);
if (n < r || n > i)
return false;
if (!e.hasChildren)
return true;
let o = t37.offsetOf(e.firstChild);
if (o >= r && o <= i) {
let a = t37.offsetOf(e.lastChild);
if (a >= r && a <= i)
return true;
}
return false;
}
function bc(t37, e, r) {
if (!(e != null && e.hasChildren))
return false;
let [i, n] = r, o = t37.offsetOf(e.firstChild), a = t37.offsetOf(e.lastChild);
return o >= i && o <= n && a >= o && a <= n;
}
function ho(t37, e, r, i) {
var o, a, s, l, c, u;
let n = r.parent;
if (n && r instanceof H) {
let d = !i && e === "forward" || i === "body" && e === "backward", m = d ? t37.offsetOf(r.firstChild) : t37.offsetOf(r.lastChild);
return d ? r.rightDelim !== "?" && r.rightDelim !== "." ? (r.leftDelim = ".", r.isDirty = true) : (n.addChildrenAfter(r.removeBranch("body"), r), n.removeChild(r), m--) : r.leftDelim !== "?" && r.leftDelim !== "." ? (r.rightDelim = ".", r.isDirty = true) : (n.addChildrenAfter(r.removeBranch("body"), r), n.removeChild(r), m--), t37.position = m, true;
}
if (n && r.type === "surd") {
if (e === "forward" && !i || e === "backward" && i === "body") {
let d = r.leftSibling;
r.hasChildren && n.addChildrenAfter(r.removeBranch("body"), r), n.removeChild(r), t37.position = t37.offsetOf(d);
} else
e === "forward" && i === "body" ? t37.position = t37.offsetOf(r) : !i && e === "backward" ? r.hasChildren ? t37.position = t37.offsetOf(r.lastChild) : (t37.position = Math.max(0, t37.offsetOf(r) - 1), n.removeChild(r)) : i === "above" && (r.hasEmptyBranch("above") && r.removeBranch("above"), e === "backward" ? t37.position = t37.offsetOf(r.leftSibling) : t37.position = t37.offsetOf(r.body[0]));
return true;
}
if (n && (r.type === "box" || r.type === "enclose")) {
let d = i && e === "backward" || !i && e === "forward" ? r.leftSibling : r.lastChild;
return n.addChildrenAfter(r.removeBranch("body"), r), n.removeChild(r), t37.position = t37.offsetOf(d), true;
}
if (r.type === "genfrac" || r.type === "overunder") {
if (!i)
return r.type === "overunder" && r.hasEmptyBranch("body") || r.type === "genfrac" && r.hasEmptyBranch("below") && r.hasEmptyBranch("above") ? false : (t37.position = t37.offsetOf(e === "forward" ? r.firstChild : r.lastChild), true);
let d = ct.fractionNavigationOrder === "numerator-denominator" ? "above" : "below", m = d === "above" ? "below" : "above";
if (n && (e === "forward" && i === d || e === "backward" && i === m)) {
let h = r.removeBranch(d), f = r.removeBranch(m);
return n.addChildrenAfter([...h, ...f], r), n.removeChild(r), t37.position = t37.offsetOf(h.length > 0 ? h[h.length - 1] : f[0]), true;
}
return e === "backward" ? t37.position = t37.offsetOf(r.leftSibling) : t37.position = t37.offsetOf(r), true;
}
if (r.type === "extensible-symbol" || r.type === "subsup") {
if (!i && e === "forward")
return false;
if (!i) {
if (r.subscript || r.superscript) {
let d = e === "forward" ? (s = (o = r.superscript) == null ? void 0 : o[0]) != null ? s : (a = r.subscript) == null ? void 0 : a[0] : (u = (l = r.subscript) == null ? void 0 : l[0].lastSibling) != null ? u : (c = r.superscript) == null ? void 0 : c[0].lastSibling;
return d && (t37.position = t37.offsetOf(d)), true;
}
return false;
}
if (!r.hasChildren && r.type === "subsup") {
let d = e === "forward" ? t37.offsetOf(r) : Math.max(0, t37.offsetOf(r) - 1);
return r.parent.removeChild(r), t37.position = d, true;
}
if (i === "superscript")
if (e === "backward") {
let d = t37.offsetOf(r.firstChild) - 1;
d >= 0, t37.position = d;
} else
r.subscript ? t37.position = t37.offsetOf(r.subscript[0]) : t37.position = t37.offsetOf(r);
else
i === "subscript" && (e === "backward" && r.superscript ? t37.position = t37.offsetOf(r.superscript[0].lastSibling) : e === "backward" ? t37.position = t37.offsetOf(r.firstChild) - 1 : t37.position = t37.offsetOf(r));
if (i && r.hasEmptyBranch(i) && (r.removeBranch(i), r.type === "subsup" && !r.subscript && !r.superscript)) {
let d = e === "forward" ? t37.offsetOf(r) : Math.max(0, t37.offsetOf(r) - 1);
r.parent.removeChild(r), t37.position = d;
}
return true;
}
if ((n == null ? void 0 : n.type) === "genfrac" && !i && r.type !== "first") {
let d = t37.offsetOf(r.leftSibling);
return n.removeChild(r), n.hasEmptyBranch("above") && n.hasEmptyBranch("below") ? (d = t37.offsetOf(n.leftSibling), n.parent.removeChild(n), t37.announce("delete", void 0, [n]), t37.position = d, true) : (t37.announce("delete", void 0, [r]), t37.position = d, true);
}
if (e === "backward" && ((n == null ? void 0 : n.command) === "\\ln" || (n == null ? void 0 : n.command) === "\\log") && r.parentBranch !== "body") {
let d = t37.offsetOf(n.leftSibling);
return n.parent.removeChild(n), t37.announce("delete", void 0, [n]), t37.position = d, true;
}
return false;
}
function Ip(t37) {
return !t37.mathfield.isSelectionEditable || !t37.contentWillChange({ inputType: "deleteContentBackward" }) ? false : t37.selectionIsCollapsed ? t37.deferNotifications({ content: true, selection: true, type: "deleteContentBackward" }, () => {
let e = t37.at(t37.position);
if (!(e && ho(t37, "backward", e))) {
if (e != null && e.isFirstSibling) {
if (ho(t37, "backward", e.parent, e.parentBranch))
return;
e = null;
}
if (!e) {
t37.announce("plonk");
return;
}
t37.position = t37.offsetOf(e.leftSibling), e.parent.removeChild(e), t37.announce("delete", void 0, [e]);
}
}) : Ue(t37, te(t37.selection), "deleteContentBackward");
}
function zp(t37) {
return !t37.mathfield.isSelectionEditable || !t37.contentWillChange({ inputType: "deleteContentForward" }) ? false : t37.selectionIsCollapsed ? t37.deferNotifications({ content: true, selection: true, type: "deleteContentForward" }, () => {
var i, n;
let e = t37.at(t37.position).rightSibling;
if (e && ho(t37, "forward", e))
return;
if (e) {
if (t37.at(t37.position).isLastSibling && ho(t37, "forward", e.parent, e.parentBranch))
return;
} else {
if (e = t37.at(t37.position), e.isLastSibling && ho(t37, "forward", e.parent, e.parentBranch))
return;
e = void 0;
}
if (t37.position === t37.lastOffset || !e) {
t37.announce("plonk");
return;
}
e.parent.removeChild(e);
let r = (i = t37.at(t37.position)) == null ? void 0 : i.rightSibling;
for (; (r == null ? void 0 : r.type) === "subsup"; )
r.parent.removeChild(r), r = (n = t37.at(t37.position)) == null ? void 0 : n.rightSibling;
t37.announce("delete", void 0, [e]);
}) : Ue(t37, te(t37.selection), "deleteContentForward");
}
function Ue(t37, e, r) {
let i = t37.getAtoms(e);
if (i.length > 0 && i[0].parent) {
let n = i[0].parent.firstChild;
n.type === "first" && (n = n.rightSibling);
let o = i[i.length - 1].parent.lastChild, a = i[0];
a.type === "first" && (a = a.rightSibling);
let s = i[i.length - 1];
if (a === n && s === o) {
let l = i[0].parent;
l.parent && l.type !== "prompt" && (e = [t37.offsetOf(l.leftSibling), t37.offsetOf(l)]);
}
if (i.length === 1 && i[0].type === "placeholder" && i[0].parent.type === "genfrac") {
let l = i[0].parent, c = i[0].parentBranch === "below" ? "above" : "below", u = t37.offsetOf(l.leftSibling);
return t37.deferNotifications({ content: true, selection: true, type: r }, () => {
var m, h;
let d = l.removeBranch(c);
if (d.length === 1 && d[0].type === "placeholder")
(h = l.parent) == null || h.removeChild(l), t37.position = Math.max(0, u);
else {
let f = l.parent.addChildrenAfter(d, l);
(m = l.parent) == null || m.removeChild(l), t37.position = t37.offsetOf(f);
}
});
}
}
return t37.deferNotifications({ content: true, selection: true, type: r }, () => t37.deleteAtoms(e));
}
ae({ deleteAll: (t37) => t37.contentWillChange({ inputType: "deleteContent" }) && Ue(t37, [0, -1], "deleteContent"), deleteForward: (t37) => zp(t37), deleteBackward: (t37) => Ip(t37), deleteNextWord: (t37) => t37.contentWillChange({ inputType: "deleteWordForward" }) && Ue(t37, [t37.anchor, Ya(t37, t37.position, "forward")], "deleteWordForward"), deletePreviousWord: (t37) => t37.contentWillChange({ inputType: "deleteWordBackward" }) && Ue(t37, [t37.anchor, Ya(t37, t37.position, "backward")], "deleteWordBackward"), deleteToGroupStart: (t37) => t37.contentWillChange({ inputType: "deleteSoftLineBackward" }) && Ue(t37, [t37.anchor, t37.offsetOf(t37.at(t37.position).firstSibling)], "deleteSoftLineBackward"), deleteToGroupEnd: (t37) => t37.contentWillChange({ inputType: "deleteSoftLineForward" }) && Ue(t37, [t37.anchor, t37.offsetOf(t37.at(t37.position).lastSibling)], "deleteSoftLineForward"), deleteToMathFieldStart: (t37) => t37.contentWillChange({ inputType: "deleteHardLineBackward" }) && Ue(t37, [t37.anchor, 0], "deleteHardLineBackward"), deleteToMathFieldEnd: (t37) => t37.contentWillChange({ inputType: "deleteHardLineForward" }) && Ue(t37, [t37.anchor, -1], "deleteHardLineForward") }, { target: "model", audioFeedback: "delete", canUndo: true, changeContent: true, changeSelection: true });
var Yg = `<svg xmlns="http://www.w3.org/2000/svg" style="width: 21px;" viewBox="0 0 576 512" role="img" aria-label="${P("tooltip.toggle virtual keyboard")}"><path d="M528 64H48C21.49 64 0 85.49 0 112v288c0 26.51 21.49 48 48 48h480c26.51 0 48-21.49 48-48V112c0-26.51-21.49-48-48-48zm16 336c0 8.823-7.177 16-16 16H48c-8.823 0-16-7.177-16-16V112c0-8.823 7.177-16 16-16h480c8.823 0 16 7.177 16 16v288zM168 268v-24c0-6.627-5.373-12-12-12h-24c-6.627 0-12 5.373-12 12v24c0 6.627 5.373 12 12 12h24c6.627 0 12-5.373 12-12zm96 0v-24c0-6.627-5.373-12-12-12h-24c-6.627 0-12 5.373-12 12v24c0 6.627 5.373 12 12 12h24c6.627 0 12-5.373 12-12zm96 0v-24c0-6.627-5.373-12-12-12h-24c-6.627 0-12 5.373-12 12v24c0 6.627 5.373 12 12 12h24c6.627 0 12-5.373 12-12zm96 0v-24c0-6.627-5.373-12-12-12h-24c-6.627 0-12 5.373-12 12v24c0 6.627 5.373 12 12 12h24c6.627 0 12-5.373 12-12zm-336 80v-24c0-6.627-5.373-12-12-12H84c-6.627 0-12 5.373-12 12v24c0 6.627 5.373 12 12 12h24c6.627 0 12-5.373 12-12zm384 0v-24c0-6.627-5.373-12-12-12h-24c-6.627 0-12 5.373-12 12v24c0 6.627 5.373 12 12 12h24c6.627 0 12-5.373 12-12zM120 188v-24c0-6.627-5.373-12-12-12H84c-6.627 0-12 5.373-12 12v24c0 6.627 5.373 12 12 12h24c6.627 0 12-5.373 12-12zm96 0v-24c0-6.627-5.373-12-12-12h-24c-6.627 0-12 5.373-12 12v24c0 6.627 5.373 12 12 12h24c6.627 0 12-5.373 12-12zm96 0v-24c0-6.627-5.373-12-12-12h-24c-6.627 0-12 5.373-12 12v24c0 6.627 5.373 12 12 12h24c6.627 0 12-5.373 12-12zm96 0v-24c0-6.627-5.373-12-12-12h-24c-6.627 0-12 5.373-12 12v24c0 6.627 5.373 12 12 12h24c6.627 0 12-5.373 12-12zm96 0v-24c0-6.627-5.373-12-12-12h-24c-6.627 0-12 5.373-12 12v24c0 6.627 5.373 12 12 12h24c6.627 0 12-5.373 12-12zm-96 152v-8c0-6.627-5.373-12-12-12H180c-6.627 0-12 5.373-12 12v8c0 6.627 5.373 12 12 12h216c6.627 0 12-5.373 12-12z"/></svg>`;
var Qg = `<svg xmlns="http://www.w3.org/2000/svg" style="height: 18px;" viewBox="0 0 448 512" role="img" aria-label="${P("tooltip.menu")}"><path d="M0 96C0 78.3 14.3 64 32 64H416c17.7 0 32 14.3 32 32s-14.3 32-32 32H32C14.3 128 0 113.7 0 96zM0 256c0-17.7 14.3-32 32-32H416c17.7 0 32 14.3 32 32s-14.3 32-32 32H32c-17.7 0-32-14.3-32-32zM448 416c0 17.7-14.3 32-32 32H32c-17.7 0-32-14.3-32-32s14.3-32 32-32H416c17.7 0 32 14.3 32 32z"/></svg>`;
var hs = class {
constructor(e, r) {
this.focusBlurInProgress = false;
var c, u, d;
this.options = p(g(p({}, an()), { macros: xi(), registers: xa() }), on(r)), this.eventController = new AbortController();
let i = this.eventController.signal;
r.eventSink && (this.host = r.eventSink), this.element = e, e.mathfield = this, this.blurred = true, this.keystrokeCaptionVisible = false, this.suggestionIndex = 0, this.inlineShortcutBuffer = [], this.inlineShortcutBufferFlushTimer = 0, this.defaultStyle = {}, this.styleBias = "left", this.options.defaultMode === "inline-math" ? this.element.classList.add("ML__is-inline") : this.element.classList.remove("ML__is-inline"), this.dirty = false;
let n = (u = (c = r.value) != null ? c : this.element.textContent) != null ? u : "";
n = n.trim();
let o = $l(this.options), a = new y({ type: "root", mode: o, body: se(n, { context: this.context }) });
this.model = new ps(this, o, a), this.undoManager = new Ga(this.model);
let s = [];
if (s.push("<span contenteditable=true role=textbox aria-autocomplete=none aria-multiline=false part=keyboard-sink class=ML__keyboard-sink autocapitalize=off autocomplete=off autocorrect=off spellcheck=false inputmode=none tabindex=0></span>"), s.push('<span part=container class=ML__container aria-hidden=true style="visibility:hidden">'), s.push("<span part=content class=ML__content>"), s.push(Pl(this)), s.push("</span>"), window.mathVirtualKeyboard && (s.push(`<div part=virtual-keyboard-toggle class=ML__virtual-keyboard-toggle role=button ${this.hasEditableContent ? "" : 'style="display:none;"'} data-l10n-tooltip="tooltip.toggle virtual keyboard">`), s.push(Yg), s.push("</div>")), s.push('<div part=menu-toggle class=ML__menu-toggle role=button data-l10n-tooltip="tooltip.menu">'), s.push(Qg), s.push("</div>"), s.push("</span>"), s.push("<span class=ML__sr-only>"), s.push("<span role=status aria-live=assertive aria-atomic=true></span>"), s.push("</span>"), this.element.innerHTML = globalThis.MathfieldElement.createHTML(s.join("")), !this.element.children) {
console.error("%cMathLive 0.100.0: Something went wrong and the mathfield could not be created.%c\nIf you are using Vue, this may be because you are using the runtime-only build of Vue. Make sure to include `runtimeCompiler: true` in your Vue configuration. There may a warning from Vue in the log above.", "color:red;font-family:system-ui;font-size:1.2rem;font-weight:bold", "color:inherit;font-family:system-ui;font-size:inherit;font-weight:inherit");
return;
}
this._l10Subscription = O.subscribe(() => O.update(this.element)), O.update(this.element), this.field = this.element.querySelector("[part=content]"), this.field.addEventListener("click", (m) => m.stopImmediatePropagation(), { capture: false, signal: i }), this.field.addEventListener("wheel", this, { passive: false, signal: i }), "PointerEvent" in window ? this.field.addEventListener("pointerdown", this, { signal: i }) : this.field.addEventListener("mousedown", this, { signal: i }), (d = this.element.querySelector("[part=virtual-keyboard-toggle]")) == null || d.addEventListener("click", () => {
window.mathVirtualKeyboard.visible ? window.mathVirtualKeyboard.hide() : (window.mathVirtualKeyboard.show({ animate: true }), window.mathVirtualKeyboard.update(We(this)));
}, { signal: i }), this._menu = new cs(Op(this), { host: this.host }), this.field.addEventListener("contextmenu", this, { signal: i });
let l = this.element.querySelector("[part=menu-toggle]");
l == null || l.addEventListener("pointerdown", (m) => {
if (m.currentTarget !== l || this._menu.state !== "closed")
return;
this.element.classList.add("tracking");
let h = l.getBoundingClientRect();
this._menu.modifiers = Kt(m), this._menu.show({ target: l, location: { x: h.left, y: h.bottom }, onDismiss: () => this.element.classList.remove("tracking") }), m.preventDefault(), m.stopPropagation();
}, { signal: i }), (this.model.atoms.length <= 1 || this.disabled || this.readOnly && !this.hasEditableContent || this.userSelect === "none") && (l.style.display = "none"), this.ariaLiveText = this.element.querySelector("[role=status]"), this.keyboardDelegate = Tm(this.element.querySelector(".ML__keyboard-sink"), this.element, this), window.addEventListener("resize", this, { signal: i }), document.addEventListener("scroll", this, { signal: i }), this.resizeObserver = new ResizeObserver(() => V(this)), this.resizeObserver.observe(this.field), window.mathVirtualKeyboard.addEventListener("virtual-keyboard-toggle", this, { signal: i }), Gr && !O.locale.startsWith(Gr.locale) && Am(O.locale), Ee !== "ready" && document.fonts.ready.then(() => Gn(this)), e.querySelector("[part=container]").style.removeProperty("visibility"), this.undoManager.startRecording(), this.undoManager.snapshot("set-value");
}
connectToVirtualKeyboard() {
this.connectedToVirtualKeyboard || (this.connectedToVirtualKeyboard = true, window.addEventListener("message", this, { signal: this.eventController.signal }), window.mathVirtualKeyboard.connect(), window.mathVirtualKeyboard.visible && window.mathVirtualKeyboard.update(We(this)), oo(this));
}
disconnectFromVirtualKeyboard() {
this.connectedToVirtualKeyboard && (window.removeEventListener("message", this), window.mathVirtualKeyboard.disconnect(), this.connectedToVirtualKeyboard = false, os());
}
showMenu(e) {
var o, a;
let r = (a = (o = e == null ? void 0 : e.location) != null ? o : Ri(this.field)) != null ? a : void 0, i = e == null ? void 0 : e.modifiers, n = this.element.querySelector("[part=container]");
return this._menu.show({ target: n, location: r, modifiers: i });
}
get colorMap() {
return (e) => {
var r, i, n;
return (n = (i = (r = this.options).colorMap) == null ? void 0 : i.call(r, e)) != null ? n : Tr(e);
};
}
get backgroundColorMap() {
return (e) => {
var r, i, n, o, a, s;
return (s = (a = (i = (r = this.options).backgroundColorMap) == null ? void 0 : i.call(r, e)) != null ? a : (o = (n = this.options).colorMap) == null ? void 0 : o.call(n, e)) != null ? s : gi(e);
};
}
get smartFence() {
var e;
return (e = this.options.smartFence) != null ? e : false;
}
get readOnly() {
var e;
return (e = this.options.readOnly) != null ? e : false;
}
get disabled() {
var e, r;
return (r = (e = this.host) == null ? void 0 : e.disabled) != null ? r : false;
}
get contentEditable() {
return this.host ? this.host.getAttribute("contenteditable") !== "false" : false;
}
get userSelect() {
if (!this.host)
return "";
let e = getComputedStyle(this.host);
return e.getPropertyValue("user-select") || e.getPropertyValue("-webkit-user-select");
}
get hasEditableContent() {
return this.disabled || !this.contentEditable ? false : !this.readOnly || this.hasEditablePrompts;
}
get hasEditablePrompts() {
return this.readOnly && !this.disabled && this.contentEditable && this.model.findAtom((e) => e.type === "prompt" && !e.locked) !== void 0;
}
get isSelectionEditable() {
if (this.disabled || !this.contentEditable)
return false;
if (!this.readOnly)
return true;
let e = this.model.at(this.model.anchor), r = this.model.at(this.model.position), i = y.commonAncestor(e, r);
return !!((i == null ? void 0 : i.type) === "prompt" || i != null && i.parentPrompt);
}
get letterShapeStyle() {
var e;
return (e = this.options.letterShapeStyle) != null ? e : "tex";
}
get minFontScale() {
return this.options.minFontScale;
}
get maxMatrixCols() {
return this.options.maxMatrixCols;
}
queryStyle(e) {
let r = Ha(this, e);
"verbatimColor" in r && delete r.verbatimColor, "verbatimBackgroundColor" in r && delete r.verbatimBackgroundColor;
let i = Object.keys(r).length;
if (i === 0)
return "all";
if (i > 1) {
for (let c of Object.keys(r)) {
let u = this.queryStyle({ [c]: r[c] });
if (u === "none")
return "none";
if (u === "some")
return "some";
}
return "all";
}
let n = Object.keys(r)[0], o = r[n];
if (this.model.selectionIsCollapsed)
return nn(this)[n] === o ? "all" : "none";
let a = this.model.getAtoms(this.model.selection, { includeChildren: true }), s = a.length;
if (s === 0)
return "none";
let l = 0;
for (let c of a) {
if (c.type === "first") {
s -= 1;
continue;
}
c.style[n] === o && (l += 1);
}
return l === 0 ? "none" : l === s ? "all" : "some";
}
get keybindings() {
var i, n;
if (this._keybindings)
return this._keybindings;
let [e, r] = Om(this.options.keybindings, (i = vr()) != null ? i : Cm());
return ((n = vr()) == null ? void 0 : n.score) > 0 && (this._keybindings = e, r.length > 0 && console.error("MathLive 0.100.0: Invalid keybindings for current keyboard layout", r)), e;
}
get menu() {
return this._menu;
}
setOptions(e) {
var n;
this.options = p(p({}, this.options), on(e)), this._keybindings = void 0, this.options.defaultMode === "inline-math" ? this.element.classList.add("ML__is-inline") : this.element.classList.remove("ML__is-inline");
let r = this.options.defaultMode;
r === "inline-math" && (r = "math"), ((n = this.model.root.firstChild) == null ? void 0 : n.mode) !== r && (this.model.root.firstChild.mode = r), this.options.readOnly && this.hasFocus() && window.mathVirtualKeyboard.visible && this.executeCommand("hideVirtualKeyboard");
let i = y.serialize([this.model.root], { expandMacro: false, defaultMode: this.options.defaultMode });
if ("macros" in e || this.model.getValue() !== i) {
let o = this.model.selection;
z.insert(this.model, i, { insertionMode: "replaceAll", selectionMode: "after", format: "latex", silenceNotifications: true, mode: "math" }), this.model.selection = o;
}
("value" in e || "macros" in e || "registers" in e || "colorMap" in e || "backgroundColorMap" in e || "letterShapeStyle" in e || "minFontScale" in e || "maxMatrixCols" in e || "readOnly" in e || "placeholderSymbol" in e) && V(this);
}
getOptions(e) {
return jt(this.options, e);
}
getOption(e) {
return jt(this.options, e);
}
async handleEvent(e) {
var r;
if (tt(this)) {
if (Zn(e)) {
if (!Ii(e.origin, (r = this.options.originValidator) != null ? r : "none"))
throw new DOMException(`Message from unknown origin (${e.origin}) cannot be handled`, "SecurityError");
let { action: i } = e.data;
if (i === "execute-command") {
let n = ei(e.data.command);
if (!n || Gt(n) === "virtual-keyboard")
return;
this.executeCommand(n);
} else
i === "update-state" || (i === "focus" ? this.focus({ preventScroll: true }) : i === "blur" && this.blur());
return;
}
switch (e.type) {
case "focus":
this.onFocus();
break;
case "blur":
this.onBlur();
break;
case "mousedown":
this.userSelect !== "none" && Yl(this, e);
break;
case "pointerdown":
this.userSelect !== "none" && (Yl(this, e), e.shiftKey === false && await oc(e, this.element.querySelector("[part=container]"), this._menu) && ci.stop());
break;
case "contextmenu":
this.userSelect !== "none" && e.shiftKey === false && await oc(e, this.element.querySelector("[part=container]"), this._menu) && ci.stop();
break;
case "virtual-keyboard-toggle":
this.hasFocus() && oo(this);
break;
case "resize":
this.geometryChangeTimer && cancelAnimationFrame(this.geometryChangeTimer), this.geometryChangeTimer = requestAnimationFrame(() => tt(this) && this.onGeometryChange());
break;
case "scroll":
this.geometryChangeTimer && cancelAnimationFrame(this.geometryChangeTimer), this.geometryChangeTimer = requestAnimationFrame(() => tt(this) && this.onGeometryChange());
break;
case "wheel":
this.onWheel(e);
break;
case "message":
break;
default:
console.warn("Unexpected event type", e.type);
}
}
}
dispose() {
if (!tt(this))
return;
O.unsubscribe(this._l10Subscription), this.keyboardDelegate.dispose(), this.keyboardDelegate = void 0, this.eventController.abort(), this.eventController = void 0, this.resizeObserver.disconnect(), window.mathVirtualKeyboard.removeEventListener("virtual-keyboard-toggle", this), this.disconnectFromVirtualKeyboard(), this.model.dispose();
let e = this.element;
delete e.mathfield, this.element = void 0, this.host = void 0, this.field = void 0, this.ariaLiveText = void 0, ip(), Rm(), dp();
}
flushInlineShortcutBuffer(e) {
if (e != null || (e = { defer: false }), !e.defer) {
this.inlineShortcutBuffer = [], clearTimeout(this.inlineShortcutBufferFlushTimer), this.inlineShortcutBufferFlushTimer = 0;
return;
}
this.options.inlineShortcutTimeout > 0 && (clearTimeout(this.inlineShortcutBufferFlushTimer), this.inlineShortcutBufferFlushTimer = setTimeout(() => this.flushInlineShortcutBuffer(), this.options.inlineShortcutTimeout));
}
executeCommand(e) {
return Gt(e) === "virtual-keyboard" ? (this.focus({ preventScroll: true }), window.mathVirtualKeyboard.executeCommand(e), requestAnimationFrame(() => window.mathVirtualKeyboard.update(We(this))), false) : $m(this, e);
}
get errors() {
return Ta(this.model.getValue(), { context: this.context });
}
getValue(e, r, i) {
return this.model.getValue(e, r, i);
}
setValue(e, r) {
var n;
r = r != null ? r : { mode: "math" }, r.insertionMode === void 0 && (r.insertionMode = "replaceAll"), (r.format === void 0 || r.format === "auto") && (r.format = "latex"), (r.mode === void 0 || r.mode === "auto") && (r.mode = (n = I0(this.model, this.model.position)) != null ? n : "math");
let i = this.undoManager.canUndo();
z.insert(this.model, e, r) && (V(this), i || this.undoManager.reset(), this.undoManager.snapshot("set-value"));
}
get expression() {
let e = globalThis.MathfieldElement.computeEngine;
return e ? e.box(e.parse(this.model.getValue("latex-unstyled"))) : (console.error("MathLive 0.100.0: no compute engine available. Make sure the Compute Engine library is loaded."), null);
}
scrollIntoView() {
var i;
if (!this.element)
return;
if (this.host) {
if (this.options.onScrollIntoView)
this.options.onScrollIntoView(this);
else if (this.host.scrollIntoView({ block: "nearest", inline: "nearest" }), window.mathVirtualKeyboard.visible && window.mathVirtualKeyboard.container === window.document.body) {
let n = window.mathVirtualKeyboard.boundingRect, o = this.host.getBoundingClientRect();
o.bottom > n.top && ((i = window.document.scrollingElement) == null || i.scrollBy(0, o.bottom - n.top + 8));
}
}
this.dirty && st(this, { interactive: true });
let e = this.field.getBoundingClientRect(), r = null;
if (this.model.selectionIsCollapsed)
r = Ri(this.field);
else {
let n = Ma(this);
if (n.length > 0) {
let o = -1 / 0, a = -1 / 0;
for (let s of n)
s.right > o && (o = s.right), s.top < a && (a = s.top);
r = { x: o + e.left - this.field.scrollLeft, y: a + e.top - this.field.scrollTop, height: 0 };
}
}
if (this.host && r) {
let n = this.host.getBoundingClientRect(), o = r.y, a = this.host.scrollTop;
o < n.top ? a = o - n.top + this.host.scrollTop : o > n.bottom && (a = o - n.bottom + this.host.scrollTop + r.height), this.host.scroll({ top: a, left: 0 });
}
if (r) {
let n = r.x - window.scrollX, o = this.field.scrollLeft;
n < e.left ? o = n - e.left + this.field.scrollLeft - 20 : n > e.right && (o = n - e.right + this.field.scrollLeft + 20), this.field.scroll({ top: this.field.scrollTop, left: o });
}
}
insert(e, r) {
return typeof e != "string" || e.length === 0 && ((r == null ? void 0 : r.insertionMode) === "insertBefore" || (r == null ? void 0 : r.insertionMode) === "insertAfter") || e.length === 0 && this.model.selectionIsCollapsed ? false : (this.flushInlineShortcutBuffer(), r = r != null ? r : { mode: "math" }, r.focus && this.focus(), r.feedback && (globalThis.MathfieldElement.keypressVibration && yo() && navigator.vibrate(Rl), globalThis.MathfieldElement.playSound("keypress")), e === "\\\\" ? ql(this.model) : e === "&" ? Hl(this.model) : this.model.selectionIsCollapsed ? z.insert(this.model, e, p({ style: this.model.at(this.model.position).style }, r)) : z.insert(this.model, e, r), this.snapshot(`insert-${this.model.at(this.model.position).type}`), V(this), r.scrollIntoView && this.scrollIntoView(), true);
}
switchMode(e, r = "", i = "") {
if (this.model.mode === e || !this.hasEditableContent || !this.contentEditable || this.disabled)
return;
let { model: n } = this, o = n.mode;
if (n.mode = e, this.host && !this.host.dispatchEvent(new Event("mode-change", { bubbles: true, composed: true, cancelable: true }))) {
n.mode = o;
return;
}
n.mode = o, n.deferNotifications({ content: !!i || !!r, selection: true, type: "insertText" }, () => {
let a = n.at(n.position), s = (d, m) => {
if (!d)
return;
let h = n.mode === "math" ? se(qt(d, { format: "ascii-math" })[1], { context: this.context }) : [...d].map((f) => new Be(f, f, {}));
if (m.select) {
let f = a.parent.addChildrenAfter(h, a);
n.setSelection(n.offsetOf(h[0].leftSibling), n.offsetOf(f));
} else
n.position = n.offsetOf(a.parent.addChildrenAfter(h, a));
u = true;
}, l = (d, m) => {
let h = new Ct(d);
a.parent.addChildAfter(h, a), m.select ? n.setSelection(n.offsetOf(h.firstChild), n.offsetOf(h.lastChild)) : n.position = n.offsetOf(h.lastChild), u = true;
}, c = () => {
let d = e === "latex" ? "latex" : e === "math" ? "plain-text" : "ascii-math", m = te(n.selection), h = this.model.getValue(m, d), f = this.model.extractAtoms(m);
return f.length === 1 && f[0].type === "placeholder" && (h = i), a = n.at(m[0]), h;
}, u = false;
if (this.flushInlineShortcutBuffer(), this.stopCoalescingUndo(), Bt(this, "accept"), n.selectionIsCollapsed)
s(r, { select: false }), n.mode = e, e === "latex" ? l(i, { select: false }) : s(i, { select: false });
else {
let d = c();
n.mode = e, e === "latex" ? l(d, { select: true }) : s(d, { select: true });
}
return V(this), this.undoManager.snapshot(e === "latex" ? "insert-latex" : "insert"), u;
}), n.mode = e, window.mathVirtualKeyboard.update(We(this));
}
hasFocus() {
return !this.blurred;
}
focus(e) {
var r;
this.hasFocus() || (this.keyboardDelegate.focus(), this.connectToVirtualKeyboard(), this.onFocus(), this.model.announce("line")), (r = e == null ? void 0 : e.preventScroll) != null && r || this.scrollIntoView();
}
blur() {
this.disconnectFromVirtualKeyboard(), this.hasFocus() && this.keyboardDelegate.blur();
}
select() {
this.model.selection = { ranges: [[0, this.model.lastOffset]] }, this.focus();
}
applyStyle(e, r = {}) {
var s;
let i, n = "set", o = false;
$r(r) ? i = r : (r.operation === "toggle" && (n = "toggle"), i = r.range, o = (s = r.silenceNotifications) != null ? s : false), i && (i = this.model.normalizeRange(i)), i && i[0] === i[1] && (i = void 0);
let a = Ha(this, e);
if (i === void 0 && this.model.selectionIsCollapsed) {
if (n === "set") {
let c = p({}, this.defaultStyle);
"color" in a && delete c.verbatimColor, "backgroundColor" in a && delete c.verbatimBackgroundColor, this.defaultStyle = p(p({}, c), a), this.styleBias = "none";
return;
}
let l = p({}, this.defaultStyle);
for (let c of Object.keys(a))
l[c] === a[c] ? (c === "color" && delete l.verbatimColor, c === "backgroundColor" && delete l.verbatimBackgroundColor, delete l[c]) : l[c] = a[c];
this.defaultStyle = l, this.styleBias = "none";
return;
}
this.model.deferNotifications({ content: !o, type: "insertText" }, () => {
if (i === void 0)
for (let l of this.model.selection.ranges)
Vn(this.model, l, a, { operation: n });
else
Vn(this.model, i, a, { operation: n });
}), V(this);
}
toggleContextMenu() {
var i;
if (!this._menu.visible)
return false;
if (this._menu.state === "open")
return this._menu.hide(), true;
let e = (i = wa(this, this.model.position)) == null ? void 0 : i.bounds;
if (!e)
return false;
let r = { x: e.right, y: e.bottom };
return this._menu.show({ target: this.element.querySelector("[part=container]"), location: r, onDismiss: () => {
var n;
return (n = this.element) == null ? void 0 : n.focus();
} }), true;
}
getPrompt(e) {
let r = this.model.findAtom((i) => i.type === "prompt" && i.placeholderId === e);
return r;
}
getPromptValue(e, r) {
let i = this.getPrompt(e);
if (!i)
return "";
let n = this.model.offsetOf(i.firstChild), o = this.model.offsetOf(i.lastChild);
return this.model.getValue(n, o, r);
}
getPrompts(e) {
return this.model.getAllAtoms().filter((r) => r.type !== "prompt" ? false : e ? !(e.id && r.placeholderId !== e.id || e.locked && r.locked !== e.locked || e.correctness === "undefined" && r.correctness || e.correctness && r.correctness !== e.correctness) : true).map((r) => r.placeholderId);
}
setPromptValue(e, r, i) {
if (r !== void 0) {
let n = this.getPrompt(e);
if (!n) {
console.error(`MathLive 0.100.0: unknown prompt ${e}`);
return;
}
let o = this.model.getBranchRange(this.model.offsetOf(n), "body");
this.model.setSelection(o), this.insert(r, g(p({}, i), { insertionMode: "replaceSelection" }));
}
i != null && i.silenceNotifications && (this.valueOnFocus = this.getValue()), V(this);
}
setPromptState(e, r, i) {
let n = this.getPrompt(e);
if (!n) {
console.error(`MathLive 0.100.0: unknown prompt ${e}`);
return;
}
r === "undefined" ? n.correctness = void 0 : typeof r == "string" && (n.correctness = r), typeof i == "boolean" && (n.locked = i, n.captureSelection = i), V(this);
}
getPromptState(e) {
let r = this.getPrompt(e);
return r ? [r.correctness, r.locked] : (console.error(`MathLive 0.100.0: unknown prompt ${e}`), [void 0, true]);
}
getPromptRange(e) {
let r = this.getPrompt(e);
return r ? this.model.getBranchRange(this.model.offsetOf(r), "body") : (console.error(`MathLive 0.100.0: unknown prompt ${e}`), [0, 0]);
}
canUndo() {
return this.undoManager.canUndo();
}
canRedo() {
return this.undoManager.canRedo();
}
popUndoStack() {
this.undoManager.pop();
}
snapshot(e) {
var r;
this.undoManager.snapshot(e) && (window.mathVirtualKeyboard.visible && window.mathVirtualKeyboard.update(We(this)), (r = this.host) == null || r.dispatchEvent(new CustomEvent("undo-state-change", { bubbles: true, composed: true, detail: { type: "snapshot" } })));
}
stopCoalescingUndo() {
this.undoManager.stopCoalescing(this.model.selection);
}
stopRecording() {
this.undoManager.stopRecording();
}
startRecording() {
this.undoManager.startRecording();
}
undo() {
var e;
this.undoManager.undo() && (window.mathVirtualKeyboard.visible && window.mathVirtualKeyboard.update(We(this)), (e = this.host) == null || e.dispatchEvent(new CustomEvent("undo-state-change", { bubbles: true, composed: true, detail: { type: "undo" } })));
}
redo() {
var e;
this.undoManager.redo() && (window.mathVirtualKeyboard.visible && window.mathVirtualKeyboard.update(We(this)), (e = this.host) == null || e.dispatchEvent(new CustomEvent("undo-state-change", { bubbles: true, composed: true, detail: { type: "undo" } })));
}
resetUndo() {
var e;
(e = this.undoManager) == null || e.reset();
}
onSelectionDidChange() {
var r, i;
let e = this.model;
if (this.keyboardDelegate.setValue(e.getValue(e.selection, "latex-expanded")), e.selectionIsCollapsed) {
let n = Wn(e), o = e.position, a = e.at(o), s = (r = a.mode) != null ? r : $l(this.options);
if (n && (o < e.offsetOf(n.firstChild) - 1 || o > e.offsetOf(n.lastChild) + 1))
Bt(this, "accept", { mode: s }), e.position = e.offsetOf(a);
else {
let l = e.at(o + 1);
(l == null ? void 0 : l.type) === "first" && l.mode === "latex" ? e.position = o + 1 : n && (l == null ? void 0 : l.mode) !== "latex" ? e.position = o - 1 : this.switchMode(s);
}
}
(i = this.host) == null || i.dispatchEvent(new Event("selection-change", { bubbles: true, composed: true })), window.mathVirtualKeyboard.visible && window.mathVirtualKeyboard.update(We(this)), oo(this);
}
onContentWillChange(e) {
var r, i, n;
return (n = (i = this.host) == null ? void 0 : i.dispatchEvent(new InputEvent("beforeinput", g(p({}, e), { data: e.data ? e.data : (r = e.inputType) != null ? r : "", cancelable: true, bubbles: true, composed: true })))) != null ? n : true;
}
onFocus() {
this.focusBlurInProgress || !this.blurred || (this.focusBlurInProgress = true, this.blurred = false, this.keyboardDelegate.focus(), this.stopCoalescingUndo(), st(this, { interactive: true }), this.valueOnFocus = this.model.getValue(), this.hasEditablePrompts && !this.model.at(this.model.anchor).parentPrompt && this.executeCommand("moveToNextPlaceholder"), this.focusBlurInProgress = false);
}
onBlur() {
var e, r, i;
if (!(this.focusBlurInProgress || this.blurred) && (this.focusBlurInProgress = true, this.stopCoalescingUndo(), this.blurred = true, this.ariaLiveText.textContent = "", wr(this), this.model.getValue() !== this.valueOnFocus && ((e = this.host) == null || e.dispatchEvent(new Event("change", { bubbles: true, composed: true }))), this.disconnectFromVirtualKeyboard(), (r = this.host) == null || r.dispatchEvent(new Event("blur", { bubbles: false, composed: true })), (i = this.host) == null || i.dispatchEvent(new UIEvent("focusout", { bubbles: true, composed: true })), V(this), this.focusBlurInProgress = false, os(), Qi.restoreFocusWhenDocumentFocused)) {
let n = new AbortController(), o = n.signal;
document.addEventListener("visibilitychange", () => {
document.visibilityState === "hidden" && document.addEventListener("visibilitychange", () => {
tt(this) && document.visibilityState === "visible" && this.focus({ preventScroll: true });
}, { once: true, signal: o });
}, { once: true, signal: o }), document.addEventListener("focusin", () => n.abort(), { once: true });
}
}
onInput(e) {
ro(this, e);
}
onKeystroke(e) {
return Xl(this, e);
}
onCompositionStart(e) {
this.model.deleteAtoms(te(this.model.selection));
let r = Ri(this.field);
r && requestAnimationFrame(() => {
st(this), this.keyboardDelegate.moveTo(r.x, r.y - r.height);
});
}
onCompositionUpdate(e) {
Um(this.model, e), V(this);
}
onCompositionEnd(e) {
Jm(this.model), ro(this, e, { simulateKeystroke: true });
}
onCut(e) {
if (!this.isSelectionEditable) {
this.model.announce("plonk");
return;
}
this.model.contentWillChange({ inputType: "deleteByCut" }) && (this.stopCoalescingUndo(), e.clipboardData ? z.onCopy(this, e) : z.copyToClipboard(this, "latex"), Ue(this.model, te(this.model.selection), "deleteByCut"), this.snapshot("cut"), V(this));
}
onCopy(e) {
e.clipboardData ? z.onCopy(this, e) : z.copyToClipboard(this, "latex");
}
onPaste(e) {
let r = this.isSelectionEditable;
return r && (r = z.onPaste(this.model.at(this.model.position).mode, this, e.clipboardData)), r || this.model.announce("plonk"), e.preventDefault(), e.stopPropagation(), r;
}
onGeometryChange() {
this._menu.hide(), Yi(this), oo(this);
}
onWheel(e) {
let r = 5 * e.deltaX;
if (!Number.isFinite(r) || r === 0)
return;
let i = this.field;
r < 0 && i.scrollLeft === 0 || r > 0 && i.offsetWidth + i.scrollLeft >= i.scrollWidth || (i.scrollBy({ top: 0, left: r }), e.preventDefault(), e.stopPropagation());
}
getHTMLElement(e) {
let r = e;
for (; !r.id && r.hasChildren; )
r = e.children[0];
return this.field.querySelector(`[data-atom-id="${r.id}"]`);
}
get context() {
var e, r;
return { registers: (e = this.options.registers) != null ? e : {}, smartFence: this.smartFence, letterShapeStyle: this.letterShapeStyle, minFontScale: this.minFontScale, maxMatrixCols: this.maxMatrixCols, placeholderSymbol: (r = this.options.placeholderSymbol) != null ? r : "\u25A2", colorMap: (i) => this.colorMap(i), backgroundColorMap: (i) => this.backgroundColorMap(i), getMacro: (i) => wo(i, this.options.macros), atomIdsSettings: { seed: "random", groupNumbers: false } };
}
};
ae({ speak: (t37, e, r) => e1(t37, e, r) }, { target: "mathfield" });
function e1(t37, e, r) {
var c;
r = r != null ? r : { withHighlighting: false };
let { model: i } = t37;
function n(u) {
let d = null;
switch (u) {
case "all":
d = i.root;
break;
case "selection":
d = i.getAtoms(i.selection);
break;
case "left": {
d = i.getAtoms(i.offsetOf(i.at(i.position).leftSibling), i.position);
break;
}
case "right": {
d = i.getAtoms(i.position, i.offsetOf(i.at(i.position).rightSibling));
break;
}
case "group":
d = i.getAtoms(i.getSiblingsRange(i.position));
break;
case "parent": {
let { parent: m } = i.at(i.position);
m != null && m.parent ? d = m : d = i.root;
break;
}
default:
d = i.root;
}
return d;
}
function o(u) {
let d = "";
switch (u) {
case "all":
console.error("Internal failure: speak all failed");
break;
case "selection":
d = "no selection";
break;
case "left":
d = "at start";
break;
case "right":
d = "at end";
break;
case "group":
console.error("Internal failure: speak group failed");
break;
case "parent":
d = "no parent";
break;
default:
console.error('unknown speak_ param value: "' + u + '"');
break;
}
return d;
}
let a = globalThis.MathfieldElement, s = n(e);
if (s === null)
return (c = a.speakHook) == null || c.call(a, o(e)), false;
(r.withHighlighting || a.speechEngine === "amazon") && (a.textToSpeechMarkup = globalThis.sre && a.textToSpeechRules === "sre" ? "ssml_step" : "ssml");
let l = mt(s);
return fe() && r.withHighlighting ? (Pt().readAloudMathfield = t37, st(t37, { forHighlighting: true }), a.readAloudHook && a.readAloudHook(t37.field, l)) : a.speakHook && a.speakHook(l), false;
}
function Np(t37) {
var r, i;
if (!fe())
return;
let e = globalThis.MathfieldElement;
if (!e.speechEngine || e.speechEngine === "local") {
let n = new SpeechSynthesisUtterance(t37);
globalThis.speechSynthesis.speak(n);
} else if (e.speechEngine === "amazon")
if (!("AWS" in window))
console.error("MathLive 0.100.0: AWS SDK not loaded. See https://www.npmjs.com/package/aws-sdk");
else {
let n = new globalThis.AWS.Polly({ apiVersion: "2016-06-10" }), o = { OutputFormat: "mp3", VoiceId: (r = e.speechEngineVoice) != null ? r : "Joanna", Engine: ["Amy", "Emma", "Brian", "Ivy", "Joanna", "Kendra", "Kimberly", "Salli", "Joey", "Justin", "Matthew"].includes((i = e.speechEngineVoice) != null ? i : "Joanna") ? "neural" : "standard", Text: t37, TextType: "ssml" };
n.synthesizeSpeech(o, (a, s) => {
if (a)
console.trace(`MathLive 0.100.0: \`polly.synthesizeSpeech()\` error: ${a}`);
else if (s != null && s.AudioStream) {
let l = new Uint8Array(s.AudioStream), c = new Blob([l.buffer], { type: "audio/mpeg" }), u = URL.createObjectURL(c);
new Audio(u).play().catch((m) => console.error(m));
}
});
}
else
e.speechEngine === "google" && console.error("MathLive 0.100.0: The Google speech engine is not supported yet. Please come again.");
}
function Fp(t37) {
if (t37 && (t37.classList.remove("ML__highlight"), t37.children))
for (let e of t37.children)
Fp(e);
}
function xc(t37, e) {
var r;
t37 && (!e || ((r = t37.dataset) == null ? void 0 : r.atomId) === e ? (t37.classList.add("ML__highlight"), t37.children && t37.children.length > 0 && [...t37.children].forEach((i) => {
i instanceof HTMLElement && xc(i);
})) : (t37.classList.remove("ML__highlight"), t37.children && t37.children.length > 0 && [...t37.children].forEach((i) => {
i instanceof HTMLElement && xc(i, e);
})));
}
function $p(t37, e) {
var n;
if (!fe())
return;
if (globalThis.MathfieldElement.speechEngine !== "amazon") {
console.error("MathLive 0.100.0: Use Amazon TTS Engine for synchronized highlighting"), typeof globalThis.MathfieldElement.speakHook == "function" && globalThis.MathfieldElement.speakHook(e);
return;
}
if (!globalThis.AWS) {
console.error("MathLive 0.100.0: AWS SDK not loaded. See https://www.npmjs.com/package/aws-sdk");
return;
}
let r = new globalThis.AWS.Polly({ apiVersion: "2016-06-10" }), i = { OutputFormat: "json", VoiceId: (n = globalThis.MathfieldElement.speechEngineVoice) != null ? n : "Joanna", Engine: "standard", Text: e, TextType: "ssml", SpeechMarkTypes: ["ssml"] };
Pt().readAloudElement = t37, r.synthesizeSpeech(i, (o, a) => {
if (o) {
console.trace(`MathLive 0.100.0: \`polly.synthesizeSpeech()\` error: ${o}`);
return;
}
if (!(a != null && a.AudioStream))
return;
let s = new TextDecoder("utf-8").decode(new Uint8Array(a.AudioStream));
Pt().readAloudMarks = s.split(`
`).map((l) => l ? JSON.parse(l) : {}), Pt().readAloudTokens = [];
for (let l of Pt().readAloudMarks)
l.value && Pt().readAloudTokens.push(l.value);
Pt().readAloudCurrentMark = "", i.OutputFormat = "mp3", i.SpeechMarkTypes = [], r.synthesizeSpeech(i, (l, c) => {
if (l) {
console.trace(`MathLive 0.100.0: \`polly.synthesizeSpeech("${e}") error:${l}`);
return;
}
if (!(c != null && c.AudioStream))
return;
let u = new Uint8Array(c.AudioStream), d = new Blob([u.buffer], { type: "audio/mpeg" }), m = URL.createObjectURL(d), h = Pt();
h.readAloudAudio ? h.readAloudAudio.pause() : (h.readAloudAudio = new Audio(), h.readAloudAudio.addEventListener("ended", () => {
let f = h.readAloudMathfield;
h.readAloudStatus = "ended", document.body.dispatchEvent(new Event("read-aloud-status-change", { bubbles: true, composed: true })), f ? (st(f), h.readAloudElement = null, h.readAloudMathfield = null, h.readAloudTokens = [], h.readAloudMarks = [], h.readAloudCurrentMark = "") : Fp(h.readAloudElement);
}), h.readAloudAudio.addEventListener("timeupdate", () => {
let f = "", b = h.readAloudAudio.currentTime * 1e3 + 100;
for (let S of h.readAloudMarks)
S.time < b && (f = S.value);
h.readAloudCurrentMark !== f && (h.readAloudCurrentToken = f, f && f === h.readAloudFinalToken ? h.readAloudAudio.pause() : (h.readAloudCurrentMark = f, xc(h.readAloudElement, h.readAloudCurrentMark)));
})), h.readAloudAudio.src = m, h.readAloudStatus = "playing", document.body.dispatchEvent(new Event("read-aloud-status-change", { bubbles: true, composed: true })), h.readAloudAudio.play();
});
});
}
fe() || console.error('MathLive 0.100.0: this version of the MathLive library is for use in the browser. A subset of the API is available on the server side in the "mathlive-ssr" library. If using server side rendering (with React for example) you may want to do a dynamic import of the MathLive library inside a `useEffect()` call.');
var W = /* @__PURE__ */ new WeakMap();
var t1 = 0.5;
var Er = { letterShapeStyle: "mf.letterShapeStyle = ...", horizontalSpacingScale: 'Removed. Use `"thinmuskip"`, `"medmuskip"`, and `"thickmuskip"` registers ', macros: "mf.macros = ...", registers: "mf.registers = ...", backgroundColorMap: "mf.backgroundColorMap = ...", colorMap: "mf.colorMap = ...", enablePopover: "mf.popoverPolicy = ...", mathModeSpace: "mf.mathModeSpace = ...", placeholderSymbol: "mf.placeholderSymbol = ...", readOnly: "mf.readOnly = ...", removeExtraneousParentheses: "mf.removeExtraneousParentheses = ...", scriptDepth: "mf.scriptDepth = ...", smartFence: "mf.smartFence = ...", smartMode: "mf.smartMode = ...", smartSuperscript: "mf.smartSuperscript = ...", inlineShortcutTimeout: "mf.inlineShortcutTimeout = ...", inlineShortcuts: "mf.inlineShortcuts = ...", keybindings: "mf.keybindings = ...", virtualKeyboardMode: "mf.mathVirtualKeyboardPolicy = ...", customVirtualKeyboardLayers: "mathVirtualKeyboard.layers = ...", customVirtualKeyboards: "mathVirtualKeyboard.layouts = ...", keypressSound: "mathVirtualKeyboard.keypressSound = ...", keypressVibration: "mathVirtualKeyboard.keypressVibration = ...", plonkSound: "mathVirtualKeyboard.plonkSound = ...", virtualKeyboardContainer: "mathVirtualKeyboard.container = ...", virtualKeyboardLayout: "mathVirtualKeyboard.alphabeticLayout = ...", virtualKeyboardTheme: "No longer supported", virtualKeyboardToggleGlyph: "No longer supported", virtualKeyboardToolbar: "mathVirtualKeyboard.editToolbar = ...", virtualKeyboards: "Use `mathVirtualKeyboard.layouts`", speechEngine: "`MathfieldElement.speechEngine`", speechEngineRate: "`MathfieldElement.speechEngineRate`", speechEngineVoice: "`MathfieldElement.speechEngineVoice`", textToSpeechMarkup: "`MathfieldElement.textToSpeechMarkup`", textToSpeechRules: "`MathfieldElement.textToSpeechRules`", textToSpeechRulesOptions: "`MathfieldElement.textToSpeechRulesOptions`", readAloudHook: "`MathfieldElement.readAloudHook`", speakHook: "`MathfieldElement.speakHook`", computeEngine: "`MathfieldElement.computeEngine`", fontsDirectory: "`MathfieldElement.fontsDirectory`", soundsDirectory: "`MathfieldElement.soundsDirectory`", createHTML: "`MathfieldElement.createHTML`", onExport: "`mf.onExport`", onInlineShortcut: "`mf.onInlineShortcut`", onScrollIntoView: "`mf.onScrollIntoView`", locale: "MathfieldElement.locale = ...", strings: "MathfieldElement.strings = ...", decimalSeparator: "MathfieldElement.decimalSeparator = ...", fractionNavigationOrder: "MathfieldElement.fractionNavigationOrder = ..." };
var Z = class Z2 extends HTMLElement {
constructor(r) {
super();
this._observer = null;
if (r) {
let i = [];
for (let n of Object.keys(r))
if (Er[n])
if (Er[n].startsWith("mf."))
if (Er[n].startsWith(`mf.${n}`))
i.push(`Option \`${n}\` cannot be used as a constructor option. Use ${Er[n]}`);
else {
let o = Er[n].match(/([a-zA-Z]+) =/);
i.push(`Option \`${n}\` has been renamed \`${o[1]}\``);
}
else
i.push(`Option \`${n}\` cannot be used as a constructor option. Use ${Er[n]}`);
if (i.length > 0) {
console.group("%cMathLive 0.100.0: %cInvalid Options", "color:#12b; font-size: 1.1rem", "color:#db1111; font-size: 1.1rem"), console.warn("Some of the options passed to `new MathfieldElement(...)` are invalid. \n See mathfield/changelog/ for details.");
for (let n of i)
console.warn(n);
console.groupEnd();
}
}
if (pn() && (this._internals = this.attachInternals(), this._internals.role = "math", this._internals.ariaLabel = "math input field", this._internals.ariaMultiLine = "false"), this.attachShadow({ mode: "open", delegatesFocus: true }), this.shadowRoot && "adoptedStyleSheets" in this.shadowRoot) {
this.shadowRoot.adoptedStyleSheets = [Hr("core"), Hr("mathfield"), Hr("mathfield-element"), Hr("ui"), Hr("menu")], this.shadowRoot.appendChild(document.createElement("span"));
let i = document.createElement("slot");
i.style.display = "none", this.shadowRoot.appendChild(i);
} else
this.shadowRoot.innerHTML = "<style>" + br("core") + br("mathfield") + br("mathfield-element") + br("ui") + br("menu") + '</style><span></span><slot style="display:none"></slot>';
r && this._setOptions(r);
}
static get formAssociated() {
return pn();
}
static get optionsAttributes() {
return { "default-mode": "string", "letter-shape-style": "string", "min-font-scale": "number", "max-matrix-cols": "number", "popover-policy": "string", "math-mode-space": "string", "read-only": "boolean", "remove-extraneous-parentheses": "on/off", "smart-fence": "on/off", "smart-mode": "on/off", "smart-superscript": "on/off", "inline-shortcut-timeout": "string", "script-depth": "string", placeholder: "string", "virtual-keyboard-target-origin": "string", "math-virtual-keyboard-policy": "string" };
}
static get observedAttributes() {
return [...Object.keys(this.optionsAttributes), "contenteditable", "disabled", "readonly", "read-only"];
}
static get fontsDirectory() {
return this._fontsDirectory;
}
static set fontsDirectory(r) {
r !== this._fontsDirectory && (this._fontsDirectory = r, Nm());
}
get fontsDirectory() {
throw new Error("Use MathfieldElement.fontsDirectory instead");
}
set fontsDirectory(r) {
throw new Error("Use MathfieldElement.fontsDirectory instead");
}
static get soundsDirectory() {
return this._soundsDirectory;
}
static set soundsDirectory(r) {
this._soundsDirectory = r, this.audioBuffers = {};
}
get soundsDirectory() {
throw new Error("Use MathfieldElement.soundsDirectory instead");
}
set soundsDirectory(r) {
throw new Error("Use MathfieldElement.soundsDirectory instead");
}
static get keypressSound() {
return this._keypressSound;
}
static set keypressSound(r) {
var i, n, o;
this.audioBuffers = {}, r === null ? this._keypressSound = { spacebar: null, return: null, delete: null, default: null } : typeof r == "string" ? this._keypressSound = { spacebar: r, return: r, delete: r, default: r } : typeof r == "object" && "default" in r && (this._keypressSound = { spacebar: (i = r.spacebar) != null ? i : r.default, return: (n = r.return) != null ? n : r.default, delete: (o = r.delete) != null ? o : r.default, default: r.default });
}
static get plonkSound() {
return this._plonkSound;
}
static set plonkSound(r) {
this.audioBuffers = {}, this._plonkSound = r;
}
static get audioContext() {
return this._audioContext || (this._audioContext = new AudioContext()), this._audioContext;
}
static get speechEngine() {
return this._speechEngine;
}
static set speechEngine(r) {
this._speechEngine = r;
}
static get speechEngineRate() {
return this._speechEngineRate;
}
static set speechEngineRate(r) {
this._speechEngineRate = r;
}
static get speechEngineVoice() {
return this._speechEngineVoice;
}
static set speechEngineVoice(r) {
this._speechEngineVoice = r;
}
static get textToSpeechMarkup() {
return this._textToSpeechMarkup;
}
static set textToSpeechMarkup(r) {
this._textToSpeechMarkup = r;
}
static get textToSpeechRules() {
return this._textToSpeechRules;
}
static set textToSpeechRules(r) {
this._textToSpeechRules = r;
}
static get textToSpeechRulesOptions() {
return this._textToSpeechRulesOptions;
}
static set textToSpeechRulesOptions(r) {
this._textToSpeechRulesOptions = r;
}
static get locale() {
return O.locale;
}
static set locale(r) {
r === "auto" && (r = navigator.language.slice(0, 5)), O.locale = r;
}
get locale() {
throw new Error("Use MathfieldElement.locale instead");
}
set locale(r) {
throw new Error("Use MathfieldElement.locale instead");
}
static get strings() {
return O.strings;
}
static set strings(r) {
O.merge(r);
}
get strings() {
throw new Error("Use MathfieldElement.strings instead");
}
set strings(r) {
throw new Error("Use MathfieldElement.strings instead");
}
static get decimalSeparator() {
return this._decimalSeparator;
}
static set decimalSeparator(r) {
this._decimalSeparator = r, this._computeEngine && (this._computeEngine.latexOptions.decimalMarker = this.decimalSeparator === "," ? "{,}" : ".");
}
get decimalSeparator() {
throw new Error("Use MathfieldElement.decimalSeparator instead");
}
set decimalSeparator(r) {
throw new Error("Use MathfieldElement.decimalSeparator instead");
}
static get computeEngine() {
var r, i;
if (this._computeEngine === void 0) {
let n = (r = window[Symbol.for("io.cortexjs.compute-engine")]) == null ? void 0 : r.ComputeEngine;
if (!n)
return null;
this._computeEngine = new n(), this._computeEngine && this.decimalSeparator === "," && (this._computeEngine.latexOptions.decimalMarker = "{,}");
}
return (i = this._computeEngine) != null ? i : null;
}
static set computeEngine(r) {
this._computeEngine = r;
}
get computeEngine() {
throw new Error("Use MathfieldElement.computeEngine instead");
}
set computeEngine(r) {
throw new Error("Use MathfieldElement.computeEngine instead");
}
static get isFunction() {
return typeof this._isFunction != "function" ? () => false : this._isFunction;
}
static set isFunction(r) {
this._isFunction = r;
}
static async loadSound(r) {
delete this.audioBuffers[r];
let i = "";
switch (r) {
case "keypress":
i = this._keypressSound.default;
break;
case "return":
i = this._keypressSound.return;
break;
case "spacebar":
i = this._keypressSound.spacebar;
break;
case "delete":
i = this._keypressSound.delete;
break;
case "plonk":
i = this.plonkSound;
break;
}
if (typeof i != "string")
return;
i = i.trim();
let n = this.soundsDirectory;
if (!(n == null || n === "null" || i === "none" || i === "null"))
try {
let a = await (await fetch(await za(`${n}/${i}`))).arrayBuffer(), s = await this.audioContext.decodeAudioData(a);
this.audioBuffers[r] = s;
} catch (o) {
}
}
static async playSound(r) {
if ((this.audioContext.state === "suspended" || this.audioContext.state === "interrupted") && await this.audioContext.resume(), this.audioBuffers[r] || await this.loadSound(r), !this.audioBuffers[r])
return;
let i = this.audioContext.createBufferSource();
i.buffer = this.audioBuffers[r];
let n = this.audioContext.createGain();
n.gain.value = t1, i.connect(n).connect(this.audioContext.destination), i.start();
}
showMenu(r) {
var i, n;
return (n = (i = this._mathfield) == null ? void 0 : i.showMenu(r)) != null ? n : false;
}
get mathVirtualKeyboard() {
throw new Error("The `mathVirtualKeyboard` property is not available on the MathfieldElement. Use `window.mathVirtualKeyboard` instead.");
}
onPointerDown() {
window.addEventListener("pointerup", (r) => {
let i = this._mathfield;
if (i && r.target === this && !i.disabled) {
this.dispatchEvent(new MouseEvent("click", { altKey: r.altKey, button: r.button, buttons: r.buttons, clientX: r.clientX, clientY: r.clientY, ctrlKey: r.ctrlKey, metaKey: r.metaKey, movementX: r.movementX, movementY: r.movementY, relatedTarget: r.relatedTarget, screenX: r.screenX, screenY: r.screenY, shiftKey: r.shiftKey }));
let n = this.getOffsetFromPoint(r.clientX, r.clientY);
n >= 0 && Z2.openUrl(q0(i, n));
}
}, { once: true });
}
getPromptValue(r, i) {
var n, o;
return (o = (n = this._mathfield) == null ? void 0 : n.getPromptValue(r, i)) != null ? o : "";
}
setPromptValue(r, i, n) {
var o;
(o = this._mathfield) == null || o.setPromptValue(r, i, n);
}
getPromptRange(r) {
var i, n;
return (n = (i = this._mathfield) == null ? void 0 : i.getPromptRange(r)) != null ? n : null;
}
getPrompts(r) {
var i, n;
return (n = (i = this._mathfield) == null ? void 0 : i.getPrompts(r)) != null ? n : [];
}
get form() {
var r;
return (r = this._internals) == null ? void 0 : r.form;
}
get name() {
var r;
return (r = this.getAttribute("name")) != null ? r : "";
}
get type() {
return this.localName;
}
get mode() {
var r, i;
return (i = (r = this._mathfield) == null ? void 0 : r.model.mode) != null ? i : this.defaultMode === "text" ? "text" : "math";
}
set mode(r) {
var i;
(i = this._mathfield) == null || i.switchMode(r);
}
get expression() {
if (this._mathfield)
return window[Symbol.for("io.cortexjs.compute-engine")] ? this._mathfield.expression : (console.error(`MathLive 0.100.0: The CortexJS Compute Engine library is not available.
Load the library, for example with:
import "https://unpkg.com/@cortex-js/compute-engine?module"`), null);
}
set expression(r) {
var n, o;
if (!this._mathfield)
return;
let i = (o = (n = Z2.computeEngine) == null ? void 0 : n.box(r).latex) != null ? o : null;
i !== null && this._mathfield.setValue(i), window[Symbol.for("io.cortexjs.compute-engine")] || console.error(`MathLive 0.100.0: The Compute Engine library is not available.
Load the library, for example with:
import "https://unpkg.com/@cortex-js/compute-engine?module"`);
}
get errors() {
var r, i;
return (i = (r = this._mathfield) == null ? void 0 : r.errors) != null ? i : [];
}
_getOptions(r) {
return this._mathfield ? jt(this._mathfield.options, r) : W.has(this) ? p({}, jt(p(p({}, an()), on(W.get(this).options)), r)) : null;
}
getOptions(r) {
return console.warn("%cMathLive 0.100.0: %cDeprecated Usage%c\n `mf.getOptions()` is deprecated. Read the property directly on the mathfield instead.\n See mathfield/changelog/ for details.", "color:#12b; font-size: 1.1rem", "color:#db1111; font-size: 1.1rem", "color: inherit, font-size: 1rem"), this._mathfield ? jt(this._mathfield.options, r) : W.has(this) ? jt(p(p({}, an()), on(W.get(this).options)), r) : null;
}
reflectAttributes() {
let r = an(), i = this._getOptions();
Object.keys(Z2.optionsAttributes).forEach((n) => {
let o = Xt(n);
Z2.optionsAttributes[n] === "on/off" ? r[o] !== i[o] ? this.setAttribute(n, i[o] ? "on" : "off") : this.removeAttribute(n) : r[o] !== i[o] && (Z2.optionsAttributes[n] === "boolean" ? i[o] ? this.setAttribute(n, "") : this.removeAttribute(n) : (typeof i[o] == "string" || typeof i[o] == "number") && this.setAttribute(n, i[o].toString()));
});
}
getOption(r) {
return console.warn("%cMathLive 0.100.0: %cDeprecated Usage%c\n `mf.getOption()` is deprecated. Read the property directly on the mathfield instead.\n See mathfield/changelog/ for details.", "color:#12b; font-size: 1.1rem", "color:#db1111; font-size: 1.1rem", "color: inherit, font-size: 1rem"), this._getOptions([r])[r];
}
_getOption(r) {
return this._getOptions([r])[r];
}
_setOptions(r) {
if (this._mathfield)
this._mathfield.setOptions(r);
else if (W.has(this)) {
let i = p(p({}, W.get(this).options), r);
W.set(this, g(p({}, W.get(this)), { selection: { ranges: i.readOnly ? [[0, 0]] : [[0, -1]] }, options: i }));
} else
W.set(this, { value: void 0, selection: { ranges: [[0, 0]] }, options: r, menuItems: void 0 });
this.reflectAttributes();
}
setOptions(r) {
console.group("%cMathLive 0.100.0: %cDeprecated Usage", "color:#12b; font-size: 1.1rem", "color:#db1111; font-size: 1.1rem"), console.warn(" `mf.setOptions()` is deprecated. Set the property directly on the mathfield instead.\n See mathfield/changelog/ for details.");
for (let i of Object.keys(r))
Er[i] && console.warn(`\`mf.setOptions({${i}:...})\` -> ${Er[i]}`);
console.groupEnd(), this._setOptions(r);
}
executeCommand(...r) {
var n, o;
let i;
if (r.length === 1 ? i = r[0] : i = [r[0], ...r.slice(1)], i)
return (o = (n = this._mathfield) == null ? void 0 : n.executeCommand(i)) != null ? o : false;
throw new Error("Invalid selector");
}
getValue(r, i, n) {
var o, a;
if (this._mathfield)
return this._mathfield.model.getValue(r, i, n);
if (W.has(this)) {
let s, l, c;
if (Oi(r) ? ([s, l] = r.ranges[0], c = i) : $r(r) ? ([s, l] = r, c = i) : Lt(r) && Lt(i) ? (s = r, l = i, c = n) : (s = 0, l = -1, c = r), (c === void 0 || c === "latex") && s === 0 && l === -1)
return (a = (o = W.get(this).value) != null ? o : this.textContent) != null ? a : "";
}
return "";
}
setValue(r, i) {
if (this._mathfield && r !== void 0) {
if (this._mathfield.model.getValue() === r)
return;
i != null || (i = { silenceNotifications: true, mode: "math" }), this._mathfield.setValue(r, i);
return;
}
if (W.has(this)) {
let o = W.get(this).options;
W.set(this, { value: r, selection: { ranges: [[-1, -1]], direction: "forward" }, options: o, menuItems: void 0 });
return;
}
let n = fs(this);
W.set(this, { value: r, selection: { ranges: [[-1, -1]], direction: "forward" }, options: n, menuItems: void 0 });
}
hasFocus() {
var r, i;
return (i = (r = this._mathfield) == null ? void 0 : r.hasFocus()) != null ? i : false;
}
focus() {
var r;
(r = this._mathfield) == null || r.focus();
}
blur() {
var r;
(r = this._mathfield) == null || r.blur();
}
select() {
var r;
(r = this._mathfield) == null || r.select();
}
insert(r, i) {
var n, o;
return (o = (n = this._mathfield) == null ? void 0 : n.insert(r, i)) != null ? o : false;
}
applyStyle(r, i) {
var n;
return (n = this._mathfield) == null ? void 0 : n.applyStyle(r, i);
}
queryStyle(r) {
var i, n;
return (n = (i = this._mathfield) == null ? void 0 : i.queryStyle(r)) != null ? n : "none";
}
getOffsetFromPoint(r, i, n) {
return this._mathfield ? no(this._mathfield, r, i, n) : -1;
}
getElementInfo(r) {
return wa(this._mathfield, r);
}
resetUndo() {
var r;
(r = this._mathfield) == null || r.resetUndo();
}
canUndo() {
return this._mathfield ? this._mathfield.canUndo() : false;
}
canRedo() {
return this._mathfield ? this._mathfield.canRedo() : false;
}
handleEvent(r) {
var i, n, o, a, s;
_e.state === "closed" && ((n = (i = this._mathfield) == null ? void 0 : i.menu) == null ? void 0 : n.state) === "closed" && (r.type === "pointerdown" && this.onPointerDown(), r.type === "focus" && ((o = this._mathfield) == null || o.focus()), r.type === "blur" && ((a = _e.scrim) == null ? void 0 : a.state) === "closed" && !(go() && Sc()) && ((s = this._mathfield) == null || s.blur()));
}
connectedCallback() {
var l, c, u, d;
let r = this.shadowRoot, i = r.host, o = window.getComputedStyle(this).userSelect !== "none";
if (o)
i.addEventListener("pointerdown", this, true);
else {
let m = r.querySelector("span");
m.style.pointerEvents = "none";
}
i.addEventListener("focus", this, true), i.addEventListener("blur", this, true), this._observer = new MutationObserver(() => {
var m;
this.value = (m = this.textContent) != null ? m : "";
}), this._observer.observe(this, { childList: true, characterData: true, subtree: true }), pn() || (this.hasAttribute("role") || this.setAttribute("role", "math"), this.hasAttribute("aria-label") || this.setAttribute("aria-label", "math input field"), this.setAttribute("aria-multiline", "false")), o && !this.hasAttribute("contenteditable") && this.setAttribute("contenteditable", "true"), this.hasAttribute("tabindex") || this.setAttribute("tabindex", "0");
let a = r.querySelector("slot:not([name])");
if (a)
try {
this._style = a.assignedElements().filter((m) => m.tagName.toLowerCase() === "style").map((m) => m.textContent).join("");
} catch (m) {
console.error(m);
}
if (this._style) {
let m = document.createElement("style");
m.textContent = this._style, r.appendChild(m);
}
let s = "";
if (this.hasAttribute("value") ? s = this.getAttribute("value") : s = (l = a == null ? void 0 : a.assignedNodes().map((m) => m.nodeType === 3 ? m.textContent : "").join("").trim()) != null ? l : "", this._mathfield = new hs(r.querySelector(":host > span"), g(p({}, (u = (c = W.get(this)) == null ? void 0 : c.options) != null ? u : fs(this)), { eventSink: this, value: s })), !W.has(this)) {
this.upgradeProperty("disabled"), this.upgradeProperty("readonly");
for (let m of Object.keys(Z2.optionsAttributes))
this.upgradeProperty(Xt(m));
}
if (!((d = this._mathfield) != null && d.model)) {
this._mathfield = null;
return;
}
if (W.has(this)) {
let m = this._mathfield, h = W.get(this), f = h.menuItems;
m.model.deferNotifications({ content: false, selection: false }, () => {
let b = h.value;
b !== void 0 && m.setValue(b), m.model.selection = h.selection, W.delete(this);
}), f && (this.menuItems = f);
}
window.queueMicrotask(() => {
this.isConnected && this.dispatchEvent(new Event("mount", { cancelable: false, bubbles: true, composed: true }));
}), Qr();
}
disconnectedCallback() {
var i, n, o;
if (this.shadowRoot.host.removeEventListener("pointerdown", this, true), !this._mathfield)
return;
(i = this._observer) == null || i.disconnect(), this._observer = null, window.queueMicrotask(() => this.dispatchEvent(new Event("unmount", { cancelable: false, bubbles: true, composed: true })));
let r = jt(this._mathfield.options, Object.keys(Z2.optionsAttributes).map((a) => Xt(a)));
W.set(this, { value: this._mathfield.getValue(), selection: this._mathfield.model.selection, menuItems: (o = (n = this._mathfield.menu) == null ? void 0 : n.menuItems) != null ? o : void 0, options: r }), this._mathfield.dispose(), this._mathfield = null;
}
upgradeProperty(r) {
if (this.hasOwnProperty(r)) {
let i = this[r];
delete this[r], (r === "readonly" || r === "read-only") && (r = "readOnly"), this[r] = i;
}
}
attributeChangedCallback(r, i, n) {
if (i === n)
return;
let o = n !== null;
switch (r) {
case "contenteditable":
V(this._mathfield);
break;
case "disabled":
this.disabled = o;
break;
case "read-only":
case "readonly":
this.readOnly = o;
break;
default:
}
}
get readonly() {
return this.hasAttribute("readonly") || this.hasAttribute("read-only");
}
set readonly(r) {
let i = !!r;
i ? (this.setAttribute("readonly", ""), pn() ? this._internals.ariaReadOnly = "true" : this.setAttribute("aria-readonly", "true"), this.setAttribute("aria-readonly", "true")) : (pn() ? this._internals.ariaReadOnly = "false" : this.removeAttribute("aria-readonly"), this.removeAttribute("readonly"), this.removeAttribute("read-only")), this._setOptions({ readOnly: i });
}
get disabled() {
return this.hasAttribute("disabled");
}
set disabled(r) {
var n;
let i = !!r;
i ? this.setAttribute("disabled", "") : this.removeAttribute("disabled"), pn() ? this._internals.ariaDisabled = i ? "true" : "false" : this.setAttribute("aria-disabled", i ? "true" : "false"), i && ((n = this._mathfield) != null && n.hasFocus) && window.mathVirtualKeyboard.visible && this._mathfield.executeCommand("hideVirtualKeyboard");
}
get value() {
return this.getValue();
}
set value(r) {
this.setValue(r);
}
get defaultMode() {
return this._getOption("defaultMode");
}
set defaultMode(r) {
this._setOptions({ defaultMode: r });
}
get macros() {
if (!this._mathfield)
throw new Error("Mathfield not mounted");
return this._getOption("macros");
}
set macros(r) {
this._setOptions({ macros: r });
}
get registers() {
if (!this._mathfield)
throw new Error("Mathfield not mounted");
let r = this;
return new Proxy({}, { get: (i, n) => {
if (typeof n == "string")
return r._getOption("registers")[n];
}, set(i, n, o) {
return typeof n != "string" ? false : (r._setOptions({ registers: g(p({}, r._getOption("registers")), { [n]: o }) }), true);
} });
}
set registers(r) {
this._setOptions({ registers: r });
}
get colorMap() {
return this._getOption("colorMap");
}
set colorMap(r) {
this._setOptions({ colorMap: r });
}
get backgroundColorMap() {
return this._getOption("backgroundColorMap");
}
set backgroundColorMap(r) {
this._setOptions({ backgroundColorMap: r });
}
get letterShapeStyle() {
return this._getOption("letterShapeStyle");
}
set letterShapeStyle(r) {
this._setOptions({ letterShapeStyle: r });
}
get minFontScale() {
return this._getOption("minFontScale");
}
set minFontScale(r) {
this._setOptions({ minFontScale: r });
}
get maxMatrixCols() {
return this._getOption("maxMatrixCols");
}
set maxMatrixCols(r) {
this._setOptions({ maxMatrixCols: r });
}
get smartMode() {
return this._getOption("smartMode");
}
set smartMode(r) {
this._setOptions({ smartMode: r });
}
get smartFence() {
return this._getOption("smartFence");
}
set smartFence(r) {
this._setOptions({ smartFence: r });
}
get smartSuperscript() {
return this._getOption("smartSuperscript");
}
set smartSuperscript(r) {
this._setOptions({ smartSuperscript: r });
}
get scriptDepth() {
return this._getOption("scriptDepth");
}
set scriptDepth(r) {
this._setOptions({ scriptDepth: r });
}
get removeExtraneousParentheses() {
return this._getOption("removeExtraneousParentheses");
}
set removeExtraneousParentheses(r) {
this._setOptions({ removeExtraneousParentheses: r });
}
get mathModeSpace() {
return this._getOption("mathModeSpace");
}
set mathModeSpace(r) {
this._setOptions({ mathModeSpace: r });
}
get placeholderSymbol() {
return this._getOption("placeholderSymbol");
}
set placeholderSymbol(r) {
this._setOptions({ placeholderSymbol: r });
}
get popoverPolicy() {
return this._getOption("popoverPolicy");
}
set popoverPolicy(r) {
this._setOptions({ popoverPolicy: r });
}
get environmentPopoverPolicy() {
return this._getOption("environmentPopoverPolicy");
}
set environmentPopoverPolicy(r) {
this._setOptions({ environmentPopoverPolicy: r });
}
get menuItems() {
var r;
if (!this._mathfield)
throw new Error("Mathfield not mounted");
return (r = this._mathfield.menu._menuItems.map((i) => i.menuItem)) != null ? r : [];
}
set menuItems(r) {
var i;
if (!this._mathfield)
throw new Error("Mathfield not mounted");
if (this._mathfield) {
let n = (i = this._mathfield.element) == null ? void 0 : i.querySelector("[part=menu-toggle]");
n && (n.style.display = r.length === 0 ? "none" : ""), this._mathfield.menu.menuItems = r;
}
}
get mathVirtualKeyboardPolicy() {
return this._getOption("mathVirtualKeyboardPolicy");
}
set mathVirtualKeyboardPolicy(r) {
this._setOptions({ mathVirtualKeyboardPolicy: r });
}
get inlineShortcuts() {
if (!this._mathfield)
throw new Error("Mathfield not mounted");
return this._getOption("inlineShortcuts");
}
set inlineShortcuts(r) {
if (!this._mathfield)
throw new Error("Mathfield not mounted");
this._setOptions({ inlineShortcuts: r });
}
get inlineShortcutTimeout() {
return this._getOption("inlineShortcutTimeout");
}
set inlineShortcutTimeout(r) {
this._setOptions({ inlineShortcutTimeout: r });
}
get keybindings() {
if (!this._mathfield)
throw new Error("Mathfield not mounted");
return this._getOption("keybindings");
}
set keybindings(r) {
if (!this._mathfield)
throw new Error("Mathfield not mounted");
this._setOptions({ keybindings: r });
}
get onInsertStyle() {
let r = this._getOption("onInsertStyle");
return r === void 0 ? to : r;
}
set onInsertStyle(r) {
this._setOptions({ onInsertStyle: r });
}
get onInlineShortcut() {
return this._getOption("onInlineShortcut");
}
set onInlineShortcut(r) {
this._setOptions({ onInlineShortcut: r });
}
get onScrollIntoView() {
return this._getOption("onScrollIntoView");
}
set onScrollIntoView(r) {
this._setOptions({ onScrollIntoView: r });
}
get onExport() {
return this._getOption("onExport");
}
set onExport(r) {
this._setOptions({ onExport: r });
}
get readOnly() {
return this._getOption("readOnly");
}
set readOnly(r) {
this._setOptions({ readOnly: r });
}
get isSelectionEditable() {
var r, i;
return (i = (r = this._mathfield) == null ? void 0 : r.isSelectionEditable) != null ? i : false;
}
setPromptState(r, i, n) {
var o;
(o = this._mathfield) == null || o.setPromptState(r, i, n);
}
getPromptState(r) {
var i, n;
return (n = (i = this._mathfield) == null ? void 0 : i.getPromptState(r)) != null ? n : [void 0, true];
}
get virtualKeyboardTargetOrigin() {
return this._getOption("virtualKeyboardTargetOrigin");
}
set virtualKeyboardTargetOrigin(r) {
this._setOptions({ virtualKeyboardTargetOrigin: r });
}
get selection() {
return this._mathfield ? this._mathfield.model.selection : W.has(this) ? W.get(this).selection : { ranges: [[0, 0]], direction: "forward" };
}
set selection(r) {
if (typeof r == "number" && (r = { ranges: [[r, r]] }), this._mathfield) {
this._mathfield.model.selection = r, V(this._mathfield);
return;
}
if (W.has(this)) {
W.set(this, g(p({}, W.get(this)), { selection: r }));
return;
}
W.set(this, { value: void 0, selection: r, options: fs(this), menuItems: void 0 });
}
get selectionIsCollapsed() {
let r = this.selection;
return r.ranges.length === 1 && r.ranges[0][0] === r.ranges[0][1];
}
get position() {
return this._mathfield ? this._mathfield.model.position : W.has(this) ? W.get(this).selection.ranges[0][0] : 0;
}
set position(r) {
if (this._mathfield && (this._mathfield.model.position = r, V(this._mathfield)), W.has(this)) {
W.set(this, g(p({}, W.get(this)), { selection: { ranges: [[r, r]] } }));
return;
}
W.set(this, { value: void 0, selection: { ranges: [[r, r]] }, options: fs(this), menuItems: void 0 });
}
get lastOffset() {
var r, i;
return (i = (r = this._mathfield) == null ? void 0 : r.model.lastOffset) != null ? i : -1;
}
};
Z.version = "0.100.0", Z.openUrl = (r) => {
if (!r)
return;
let i = new URL(r);
if (!["http:", "https:", "file:"].includes(i.protocol.toLowerCase())) {
Z.playSound("plonk");
return;
}
window.open(i, "_blank");
}, Z._fontsDirectory = "./fonts", Z._soundsDirectory = "./sounds", Z.keypressVibration = true, Z._keypressSound = { spacebar: "keypress-spacebar.wav", return: "keypress-return.wav", delete: "keypress-delete.wav", default: "keypress-standard.wav" }, Z._plonkSound = "plonk.wav", Z.audioBuffers = {}, Z.createHTML = (r) => r, Z._speechEngineRate = "100%", Z._speechEngineVoice = "Joanna", Z._textToSpeechMarkup = "", Z._textToSpeechRules = "mathlive", Z._textToSpeechRulesOptions = {}, Z.speakHook = Np, Z.readAloudHook = $p, Z.restoreFocusWhenDocumentFocused = true, Z._decimalSeparator = ".", Z.fractionNavigationOrder = "numerator-denominator", Z._isFunction = (r) => {
var n, o;
let i = globalThis.MathfieldElement.computeEngine;
return (o = (n = i == null ? void 0 : i.parse(r).domain) == null ? void 0 : n.isFunction) != null ? o : false;
};
var ct = Z;
function Xt(t37) {
return t37.replace(/[^a-zA-Z\d]+(.)/g, (e, r) => r.toUpperCase());
}
function fs(t37) {
let e = { readOnly: false }, r = ct.optionsAttributes;
return Object.keys(r).forEach((i) => {
var n;
if (t37.hasAttribute(i)) {
let o = t37.getAttribute(i);
i === "placeholder" ? e.contentPlaceholder = o != null ? o : "" : r[i] === "boolean" ? e[Xt(i)] = true : r[i] === "on/off" ? (o = (n = o == null ? void 0 : o.toLowerCase()) != null ? n : "", o === "on" || o === "true" ? e[Xt(i)] = true : o === "off" || o === "false" ? e[Xt(i)] = false : e[Xt(i)] = void 0) : r[i] === "number" ? e[Xt(i)] = Number.parseFloat(o != null ? o : "0") : e[Xt(i)] = o;
}
}), e;
}
function pn() {
return !(!("ElementInternals" in window) || !HTMLElement.prototype.attachInternals || !("role" in window.ElementInternals.prototype));
}
var Qi = ct;
var Vp;
var qp;
var Hp;
var Wp;
if (fe() && !((Vp = window.customElements) != null && Vp.get("math-field"))) {
(Hp = window[qp = Symbol.for("io.cortexjs.mathlive")]) != null || (window[qp] = {});
let t37 = window[Symbol.for("io.cortexjs.mathlive")];
t37.version = "0.100.0", globalThis.MathfieldElement = ct, (Wp = window.customElements) == null || Wp.define("math-field", ct);
}
function s1(t37, e) {
let r = we.singleton;
return r ? (r.show(), ri(), r.currentLayer = e, r.render(), r.focus(), true) : false;
}
function l1() {
let t37 = window.mathVirtualKeyboard;
return t37.visible ? t37.hide({ animate: true }) : t37.show({ animate: true }), false;
}
ae({ switchKeyboardLayer: s1, toggleVirtualKeyboard: l1, hideVirtualKeyboard: () => (window.mathVirtualKeyboard.hide({ animate: true }), false), showVirtualKeyboard: () => (window.mathVirtualKeyboard.show({ animate: true }), false) }, { target: "virtual-keyboard" });
function Pt() {
var t37, e;
return (e = globalThis[t37 = Symbol.for("io.cortexjs.mathlive")]) != null || (globalThis[t37] = {}), globalThis[Symbol.for("io.cortexjs.mathlive")];
}
// src/setting.ts
var import_obsidian = require("obsidian");
var DEFAULT_SETTINGS = {
display: true,
blockDisplay: true,
blockMenuIcon: true,
blockKeyboardIcon: true,
inlineDisplay: false,
inlineMenuIcon: false,
inlineKeyboardIcon: false
};
var MathLiveEditorModeSettingsTab = class extends import_obsidian.PluginSettingTab {
constructor(app, plugin) {
super(app, plugin);
this.plugin = plugin;
}
display() {
this.containerEl.empty();
new import_obsidian.Setting(this.containerEl).setName("Display MathLive block").setDesc("Toggle display state of MathLive").addToggle((cb) => {
cb.setValue(this.plugin.settings.display);
cb.onChange(async (ev) => {
this.plugin.settings.display = ev;
await this.plugin.saveSettings();
this.display();
new import_obsidian.Notice("Toggle visibility successfully!");
});
}).addButton((cb) => {
cb.setButtonText("Set hotkey").setTooltip(`Set toggle hotkey`).onClick(() => {
this.app.setting.openTabById("hotkeys");
const tab = this.app.setting.activeTab;
tab.headerComponent.components[1].inputEl.value = `Toggle MathLive block`;
tab.updateHotkeyVisibility();
});
});
if (this.plugin.settings.display) {
new import_obsidian.Setting(this.containerEl).setName("Block").setHeading();
new import_obsidian.Setting(this.containerEl).setName("Display block equation").setDesc("Enable MathLive for block equation").addToggle((cb) => {
cb.setValue(this.plugin.settings.blockDisplay);
cb.onChange(async (ev) => {
this.plugin.settings.blockDisplay = ev;
await this.plugin.saveSettings();
new import_obsidian.Notice(
"Toggle inline equation display successfully!"
);
});
});
new import_obsidian.Setting(this.containerEl).setName("Display block menu icon").addToggle((cb) => {
cb.setValue(this.plugin.settings.blockMenuIcon);
cb.onChange(async (ev) => {
this.plugin.settings.blockMenuIcon = ev;
await this.plugin.saveSettings();
new import_obsidian.Notice("Toggle block menu icon successfully!");
});
});
new import_obsidian.Setting(this.containerEl).setName("Display block keyboard icon").addToggle((cb) => {
cb.setValue(this.plugin.settings.blockKeyboardIcon);
cb.onChange(async (ev) => {
this.plugin.settings.blockKeyboardIcon = ev;
await this.plugin.saveSettings();
new import_obsidian.Notice("Toggle block keyboard icon successfully!");
});
});
new import_obsidian.Setting(this.containerEl).setName("Inline").setHeading();
new import_obsidian.Setting(this.containerEl).setName("Display inline equation").setDesc("Enable MathLive for inline equation").addToggle((cb) => {
cb.setValue(this.plugin.settings.inlineDisplay);
cb.onChange(async (ev) => {
this.plugin.settings.inlineDisplay = ev;
await this.plugin.saveSettings();
new import_obsidian.Notice(
"Toggle inline equation display successfully!"
);
});
});
new import_obsidian.Setting(this.containerEl).setName("Display inline menu icon").addToggle((cb) => {
cb.setValue(this.plugin.settings.inlineMenuIcon);
cb.onChange(async (ev) => {
this.plugin.settings.inlineMenuIcon = ev;
await this.plugin.saveSettings();
new import_obsidian.Notice("Toggle inline menu icon successfully!");
});
});
new import_obsidian.Setting(this.containerEl).setName("Display inline keyboard icon").addToggle((cb) => {
cb.setValue(this.plugin.settings.inlineKeyboardIcon);
cb.onChange(async (ev) => {
this.plugin.settings.inlineKeyboardIcon = ev;
await this.plugin.saveSettings();
new import_obsidian.Notice("Toggle inline keyboard icon successfully!");
});
});
}
}
};
// src/main.ts
var MathLiveInEditorMode = class extends import_obsidian2.Plugin {
async onload() {
await this.loadSettings();
if (customElements.get("math-field") === void 0)
customElements.define("math-field", ct);
this.addSettingTab(new MathLiveEditorModeSettingsTab(this.app, this));
this.registerEditorExtension(mathliveListFieldWrapper(this.settings));
this.addCommand({
id: "toggle-mathfield",
name: "Toggle MathLive block",
editorCallback: async (editor, view) => {
this.settings.display = !this.settings.display;
await this.saveSettings();
const curser = editor.getCursor();
editor.setCursor(curser);
}
});
}
onunload() {
}
async loadSettings() {
this.settings = Object.assign(
{},
DEFAULT_SETTINGS,
await this.loadData()
);
}
async saveSettings() {
await this.saveData(this.settings);
}
};