From de384242ecf33f288e8d8a57beb31336d167107b Mon Sep 17 00:00:00 2001 From: luginf Date: Sat, 11 Apr 2026 23:21:47 +0200 Subject: [PATCH 01/16] adding txt2tags-it: support to txt2tags syntax in addition to the markdown one --- txt2tags-it/README.md | 8 + txt2tags-it/info.json | 15 + txt2tags-it/markdown-it-deflist.js | 342 + txt2tags-it/markdown-it-katex.js | 15759 ++++++++++++++++++++++++++ txt2tags-it/markdown-it-txt2tags.js | 271 + txt2tags-it/markdown-it.js | 11385 +++++++++++++++++++ txt2tags-it/txt2tags-it.qml | 177 + 7 files changed, 27957 insertions(+) create mode 100644 txt2tags-it/README.md create mode 100644 txt2tags-it/info.json create mode 100644 txt2tags-it/markdown-it-deflist.js create mode 100644 txt2tags-it/markdown-it-katex.js create mode 100644 txt2tags-it/markdown-it-txt2tags.js create mode 100644 txt2tags-it/markdown-it.js create mode 100644 txt2tags-it/txt2tags-it.qml diff --git a/txt2tags-it/README.md b/txt2tags-it/README.md new file mode 100644 index 0000000..3ea1f50 --- /dev/null +++ b/txt2tags-it/README.md @@ -0,0 +1,8 @@ +# txt2tags-it + +This script for QOwnNotes is based on https://github.com/qownnotes/scripts/tree/main/markdown-it + +It allows the use of the txt2tags syntax, in addition to the markdown one, in both the editor and in the preview windows of QOwnNotes. + +Made with the help of some LLM. + diff --git a/txt2tags-it/info.json b/txt2tags-it/info.json new file mode 100644 index 0000000..cd8b516 --- /dev/null +++ b/txt2tags-it/info.json @@ -0,0 +1,15 @@ +{ + "name": "txt2tags-it", + "identifier": "txt2tags-it", + "script": "txt2tags-it.qml", + "resources": [ + "markdown-it.js", + "markdown-it-deflist.js", + "markdown-it-katex.js", + "markdown-it-txt2tags.js" + ], + "authors": ["@milan-rusev", "@bessw", "@cjendantix"], + "version": "1.5", + "minAppVersion": "20.6.0", + "description": "This script replaces the default markdown renderer with markdown-it and allows for optional LaTeX rendering support with the Markdown-It KaTeX plugin. (NOTE: LaTeX defaults to rendering with MathML ONLY). \n\nDependencies\nmarkdown-it.js (v8.4.2 bundled with the script)\nMarkdown-It KaTeX plugin (v0.18.0 bundled with the script)\n\nUsage\nFor the possible configuration options check here.\n\nImportant\nThis script currently only works with legacy media links. You can turn them on in the General Settings.\n\nImportant note: You need to use legacy image linking with this script, otherwise there will be no images shown in the preview!" +} diff --git a/txt2tags-it/markdown-it-deflist.js b/txt2tags-it/markdown-it-deflist.js new file mode 100644 index 0000000..13f63e5 --- /dev/null +++ b/txt2tags-it/markdown-it-deflist.js @@ -0,0 +1,342 @@ +/*! markdown-it-deflist 2.0.3 https://github.com//markdown-it/markdown-it-deflist @license MIT */ (function ( + f, +) { + if (typeof exports === "object" && typeof module !== "undefined") { + module.exports = f(); + } else if (typeof define === "function" && define.amd) { + define([], f); + } else { + var g; + if (typeof window !== "undefined") { + g = window; + } else if (typeof global !== "undefined") { + g = global; + } else if (typeof self !== "undefined") { + g = self; + } else { + g = this; + } + g.markdownitDeflist = f(); + } +})(function () { + var define, module, exports; + return (function e(t, n, r) { + function s(o, u) { + if (!n[o]) { + if (!t[o]) { + var a = typeof require == "function" && require; + if (!u && a) return a(o, !0); + if (i) return i(o, !0); + var f = new Error("Cannot find module '" + o + "'"); + throw ((f.code = "MODULE_NOT_FOUND"), f); + } + var l = (n[o] = { exports: {} }); + t[o][0].call( + l.exports, + function (e) { + var n = t[o][1][e]; + return s(n ? n : e); + }, + l, + l.exports, + e, + t, + n, + r, + ); + } + return n[o].exports; + } + var i = typeof require == "function" && require; + for (var o = 0; o < r.length; o++) s(r[o]); + return s; + })( + { + 1: [ + function (require, module, exports) { + // Process definition lists + // + "use strict"; + + module.exports = function deflist_plugin(md) { + var isSpace = md.utils.isSpace; + + // Search `[:~][\n ]`, returns next pos after marker on success + // or -1 on fail. + function skipMarker(state, line) { + var pos, + marker, + start = state.bMarks[line] + state.tShift[line], + max = state.eMarks[line]; + + if (start >= max) { + return -1; + } + + // Check bullet + marker = state.src.charCodeAt(start++); + if (marker !== 0x7e /* ~ */ && marker !== 0x3a /* : */) { + return -1; + } + + pos = state.skipSpaces(start); + + // require space after ":" + if (start === pos) { + return -1; + } + + // no empty definitions, e.g. " : " + if (pos >= max) { + return -1; + } + + return start; + } + + function markTightParagraphs(state, idx) { + var i, + l, + level = state.level + 2; + + for (i = idx + 2, l = state.tokens.length - 2; i < l; i++) { + if ( + state.tokens[i].level === level && + state.tokens[i].type === "paragraph_open" + ) { + state.tokens[i + 2].hidden = true; + state.tokens[i].hidden = true; + i += 2; + } + } + } + + function deflist(state, startLine, endLine, silent) { + var ch, + contentStart, + ddLine, + dtLine, + itemLines, + listLines, + listTokIdx, + max, + nextLine, + offset, + oldDDIndent, + oldIndent, + oldParentType, + oldSCount, + oldTShift, + oldTight, + pos, + prevEmptyEnd, + tight, + token; + + if (silent) { + // quirk: validation mode validates a dd block only, not a whole deflist + if (state.ddIndent < 0) { + return false; + } + return skipMarker(state, startLine) >= 0; + } + + nextLine = startLine + 1; + if (nextLine >= endLine) { + return false; + } + + if (state.isEmpty(nextLine)) { + nextLine++; + if (nextLine >= endLine) { + return false; + } + } + + if (state.sCount[nextLine] < state.blkIndent) { + return false; + } + contentStart = skipMarker(state, nextLine); + if (contentStart < 0) { + return false; + } + + // Start list + listTokIdx = state.tokens.length; + tight = true; + + token = state.push("dl_open", "dl", 1); + token.map = listLines = [startLine, 0]; + + // + // Iterate list items + // + + dtLine = startLine; + ddLine = nextLine; + + // One definition list can contain multiple DTs, + // and one DT can be followed by multiple DDs. + // + // Thus, there is two loops here, and label is + // needed to break out of the second one + // + /*eslint no-labels:0,block-scoped-var:0*/ + OUTER: for (;;) { + prevEmptyEnd = false; + + token = state.push("dt_open", "dt", 1); + token.map = [dtLine, dtLine]; + + token = state.push("inline", "", 0); + token.map = [dtLine, dtLine]; + token.content = state + .getLines(dtLine, dtLine + 1, state.blkIndent, false) + .trim(); + token.children = []; + + token = state.push("dt_close", "dt", -1); + + for (;;) { + token = state.push("dd_open", "dd", 1); + token.map = itemLines = [nextLine, 0]; + + pos = contentStart; + max = state.eMarks[ddLine]; + offset = + state.sCount[ddLine] + + contentStart - + (state.bMarks[ddLine] + state.tShift[ddLine]); + + while (pos < max) { + ch = state.src.charCodeAt(pos); + + if (isSpace(ch)) { + if (ch === 0x09) { + offset += 4 - (offset % 4); + } else { + offset++; + } + } else { + break; + } + + pos++; + } + + contentStart = pos; + + oldTight = state.tight; + oldDDIndent = state.ddIndent; + oldIndent = state.blkIndent; + oldTShift = state.tShift[ddLine]; + oldSCount = state.sCount[ddLine]; + oldParentType = state.parentType; + state.blkIndent = state.ddIndent = state.sCount[ddLine] + 2; + state.tShift[ddLine] = contentStart - state.bMarks[ddLine]; + state.sCount[ddLine] = offset; + state.tight = true; + state.parentType = "deflist"; + + state.md.block.tokenize(state, ddLine, endLine, true); + + // If any of list item is tight, mark list as tight + if (!state.tight || prevEmptyEnd) { + tight = false; + } + // Item become loose if finish with empty line, + // but we should filter last element, because it means list finish + prevEmptyEnd = + state.line - ddLine > 1 && state.isEmpty(state.line - 1); + + state.tShift[ddLine] = oldTShift; + state.sCount[ddLine] = oldSCount; + state.tight = oldTight; + state.parentType = oldParentType; + state.blkIndent = oldIndent; + state.ddIndent = oldDDIndent; + + token = state.push("dd_close", "dd", -1); + + itemLines[1] = nextLine = state.line; + + if (nextLine >= endLine) { + break OUTER; + } + + if (state.sCount[nextLine] < state.blkIndent) { + break OUTER; + } + contentStart = skipMarker(state, nextLine); + if (contentStart < 0) { + break; + } + + ddLine = nextLine; + + // go to the next loop iteration: + // insert DD tag and repeat checking + } + + if (nextLine >= endLine) { + break; + } + dtLine = nextLine; + + if (state.isEmpty(dtLine)) { + break; + } + if (state.sCount[dtLine] < state.blkIndent) { + break; + } + + ddLine = dtLine + 1; + if (ddLine >= endLine) { + break; + } + if (state.isEmpty(ddLine)) { + ddLine++; + } + if (ddLine >= endLine) { + break; + } + + if (state.sCount[ddLine] < state.blkIndent) { + break; + } + contentStart = skipMarker(state, ddLine); + if (contentStart < 0) { + break; + } + + // go to the next loop iteration: + // insert DT and DD tags and repeat checking + } + + // Finilize list + token = state.push("dl_close", "dl", -1); + + listLines[1] = nextLine; + + state.line = nextLine; + + // mark paragraphs tight if needed + if (tight) { + markTightParagraphs(state, listTokIdx); + } + + return true; + } + + md.block.ruler.before("paragraph", "deflist", deflist, { + alt: ["paragraph", "reference"], + }); + }; + }, + {}, + ], + }, + {}, + [1], + )(1); +}); diff --git a/txt2tags-it/markdown-it-katex.js b/txt2tags-it/markdown-it-katex.js new file mode 100644 index 0000000..fe6f70d --- /dev/null +++ b/txt2tags-it/markdown-it-katex.js @@ -0,0 +1,15759 @@ +var _excluded = [ + "allowInlineWithSpace", + "mathFence", + "logger", + "macros", + "transformer", +]; +function _typeof(o) { + "@babel/helpers - typeof"; + return ( + (_typeof = + "function" == typeof Symbol && "symbol" == typeof Symbol.iterator + ? function (o) { + return typeof o; + } + : function (o) { + return o && + "function" == typeof Symbol && + o.constructor === Symbol && + o !== Symbol.prototype + ? "symbol" + : typeof o; + }), + _typeof(o) + ); +} +function _objectWithoutProperties(e, t) { + if (null == e) return {}; + var o, + r, + i = _objectWithoutPropertiesLoose(e, t); + if (Object.getOwnPropertySymbols) { + var n = Object.getOwnPropertySymbols(e); + for (r = 0; r < n.length; r++) + ((o = n[r]), + -1 === t.indexOf(o) && + {}.propertyIsEnumerable.call(e, o) && + (i[o] = e[o])); + } + return i; +} +function _objectWithoutPropertiesLoose(r, e) { + if (null == r) return {}; + var t = {}; + for (var n in r) + if ({}.hasOwnProperty.call(r, n)) { + if (-1 !== e.indexOf(n)) continue; + t[n] = r[n]; + } + return t; +} +function ownKeys(e, r) { + var t = Object.keys(e); + if (Object.getOwnPropertySymbols) { + var o = Object.getOwnPropertySymbols(e); + (r && + (o = o.filter(function (r) { + return Object.getOwnPropertyDescriptor(e, r).enumerable; + })), + t.push.apply(t, o)); + } + return t; +} +function _objectSpread(e) { + for (var r = 1; r < arguments.length; r++) { + var t = null != arguments[r] ? arguments[r] : {}; + r % 2 + ? ownKeys(Object(t), !0).forEach(function (r) { + _defineProperty(e, r, t[r]); + }) + : Object.getOwnPropertyDescriptors + ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) + : ownKeys(Object(t)).forEach(function (r) { + Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); + }); + } + return e; +} +function _defineProperty(e, r, t) { + return ( + (r = _toPropertyKey(r)) in e + ? Object.defineProperty(e, r, { + value: t, + enumerable: !0, + configurable: !0, + writable: !0, + }) + : (e[r] = t), + e + ); +} +function _slicedToArray(r, e) { + return ( + _arrayWithHoles(r) || + _iterableToArrayLimit(r, e) || + _unsupportedIterableToArray(r, e) || + _nonIterableRest() + ); +} +function _nonIterableRest() { + throw new TypeError( + "Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.", + ); +} +function _iterableToArrayLimit(r, l) { + var t = + null == r + ? null + : ("undefined" != typeof Symbol && r[Symbol.iterator]) || r["@@iterator"]; + if (null != t) { + var e, + n, + i, + u, + a = [], + f = !0, + o = !1; + try { + if (((i = (t = t.call(r)).next), 0 === l)) { + if (Object(t) !== t) return; + f = !1; + } else + for ( + ; + !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); + f = !0 + ); + } catch (r) { + ((o = !0), (n = r)); + } finally { + try { + if (!f && null != t["return"] && ((u = t["return"]()), Object(u) !== u)) + return; + } finally { + if (o) throw n; + } + } + return a; + } +} +function _arrayWithHoles(r) { + if (Array.isArray(r)) return r; +} +function _toConsumableArray(r) { + return ( + _arrayWithoutHoles(r) || + _iterableToArray(r) || + _unsupportedIterableToArray(r) || + _nonIterableSpread() + ); +} +function _nonIterableSpread() { + throw new TypeError( + "Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.", + ); +} +function _unsupportedIterableToArray(r, a) { + if (r) { + if ("string" == typeof r) return _arrayLikeToArray(r, a); + var t = {}.toString.call(r).slice(8, -1); + return ( + "Object" === t && r.constructor && (t = r.constructor.name), + "Map" === t || "Set" === t + ? Array.from(r) + : "Arguments" === t || + /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) + ? _arrayLikeToArray(r, a) + : void 0 + ); + } +} +function _iterableToArray(r) { + if ( + ("undefined" != typeof Symbol && null != r[Symbol.iterator]) || + null != r["@@iterator"] + ) + return Array.from(r); +} +function _arrayWithoutHoles(r) { + if (Array.isArray(r)) return _arrayLikeToArray(r); +} +function _arrayLikeToArray(r, a) { + (null == a || a > r.length) && (a = r.length); + for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; + return n; +} +function _classCallCheck(a, n) { + if (!(a instanceof n)) + throw new TypeError("Cannot call a class as a function"); +} +function _defineProperties(e, r) { + for (var t = 0; t < r.length; t++) { + var o = r[t]; + ((o.enumerable = o.enumerable || !1), + (o.configurable = !0), + "value" in o && (o.writable = !0), + Object.defineProperty(e, _toPropertyKey(o.key), o)); + } +} +function _createClass(e, r, t) { + return ( + r && _defineProperties(e.prototype, r), + t && _defineProperties(e, t), + Object.defineProperty(e, "prototype", { writable: !1 }), + e + ); +} +function _toPropertyKey(t) { + var i = _toPrimitive(t, "string"); + return "symbol" == _typeof(i) ? i : i + ""; +} +function _toPrimitive(t, r) { + if ("object" != _typeof(t) || !t) return t; + var e = t[Symbol.toPrimitive]; + if (void 0 !== e) { + var i = e.call(t, r || "default"); + if ("object" != _typeof(i)) return i; + throw new TypeError("@@toPrimitive must return a primitive value."); + } + return ("string" === r ? String : Number)(t); +} +(function (factory) { + this.markdownItKatex = factory(); +})(function () { + var escapeHtml = function escapeHtml(unsafeHTML) { + return unsafeHTML + .replace(/&/g, "&") + .replace(//g, ">") + .replace(/"/g, """) + .replace(/'/g, "'"); + }; + var isValidDelim = function isValidDelim(state, pos, allowInlineWithSpace) { + var prevChar = state.src.charAt(pos - 1); + var nextChar = state.src.charAt(pos + 1); + return { + canOpen: allowInlineWithSpace || (nextChar !== " " && nextChar !== "\t"), + canClose: + !/[0-9]/.exec(nextChar) && + (allowInlineWithSpace || (prevChar !== " " && prevChar !== "\t")), + }; + }; + var getInlineTex = function getInlineTex(allowInlineWithSpace) { + return function (state, silent) { + if (state.src[state.pos] !== "$") return false; + var delimState = isValidDelim(state, state.pos, allowInlineWithSpace); + if (!delimState.canOpen) { + if (!silent) state.pending += "$"; + state.pos++; + return true; + } + var start = state.pos + 1; + var match = start; + var pos; + while ((match = state.src.indexOf("$", match)) !== -1) { + pos = match - 1; + while (state.src[pos] === "\\") pos--; + if ((match - pos) % 2 === 1) break; + match++; + } + if (match === -1) { + if (!silent) state.pending += "$"; + state.pos = start; + return true; + } + if (match - start === 0) { + if (!silent) state.pending += "$$"; + state.pos = start + 1; + return true; + } + delimState = isValidDelim(state, match, allowInlineWithSpace); + if (!delimState.canClose) { + if (!silent) state.pending += "$"; + state.pos = start; + return true; + } + if (!silent) { + var token = state.push("math_inline", "math", 0); + token.markup = "$"; + token.content = state.src.slice(start, match); + } + state.pos = match + 1; + return true; + }; + }; + var blockTex = function blockTex(state, start, end, silent) { + var pos = state.bMarks[start] + state.tShift[start]; + var max = state.eMarks[start]; + if (pos + 2 > max) return false; + if (state.src.slice(pos, pos + 2) !== "$$") return false; + pos += 2; + var firstLine = state.src.slice(pos, max).trim(); + if (silent) return true; + var found = false; + if (firstLine.endsWith("$$")) { + firstLine = firstLine.slice(0, -2); + found = true; + } + var current = start; + var lastLine = ""; + while (!found) { + current++; + if (current >= end) break; + pos = state.bMarks[current] + state.tShift[current]; + max = state.eMarks[current]; + if (pos < max && state.tShift[current] < state.blkIndent) break; + if (state.src.slice(pos, max).trim().endsWith("$$")) { + lastLine = state.src + .slice(pos, state.src.slice(0, max).lastIndexOf("$$")) + .trim(); + found = true; + } + } + state.line = found ? current + 1 : current; + var token = state.push("math_block", "math", 0); + token.block = true; + token.content = + (firstLine ? "".concat(firstLine, "\n") : "") + + state.getLines(start + 1, current, state.tShift[start], true) + + (lastLine ? "".concat(lastLine, "\n") : ""); + token.map = [start, state.line]; + token.markup = "$$"; + return true; + }; + var tex = function tex(md, options) { + if ( + typeof (options === null || options === void 0 + ? void 0 + : options.render) !== "function" + ) + throw new Error( + '[@mdit/plugin-tex]: "render" option should be a function', + ); + var _options$allowInlineW = options.allowInlineWithSpace, + allowInlineWithSpace = + _options$allowInlineW === void 0 ? false : _options$allowInlineW, + _options$mathFence = options.mathFence, + mathFence = _options$mathFence === void 0 ? false : _options$mathFence, + render = options.render; + if (mathFence) { + var fence = md.renderer.rules.fence; + md.renderer.rules.fence = function () { + for ( + var _len = arguments.length, args = new Array(_len), _key = 0; + _key < _len; + _key++ + ) { + args[_key] = arguments[_key]; + } + var tokens = args[0], + index = args[1], + env = args[3]; + var _tokens$index = tokens[index], + content = _tokens$index.content, + info = _tokens$index.info; + if (info.trim() === "math") return render(content, true, env); + return fence.apply(void 0, args); + }; + } + md.inline.ruler.after( + "escape", + "math_inline", + getInlineTex(allowInlineWithSpace), + ); + md.block.ruler.after("blockquote", "math_block", blockTex, { + alt: ["paragraph", "reference", "blockquote", "list"], + }); + md.renderer.rules.math_inline = function (tokens, index, _options, env) { + return render(tokens[index].content, false, env); + }; + md.renderer.rules.math_block = function (tokens, index, _options, env) { + return render(tokens[index].content, true, env); + }; + }; + var SourceLocation = (function () { + function SourceLocation(lexer, start, end) { + _classCallCheck(this, SourceLocation); + this.lexer = void 0; + this.start = void 0; + this.end = void 0; + this.lexer = lexer; + this.start = start; + this.end = end; + } + return _createClass(SourceLocation, null, [ + { + key: "range", + value: function range(first, second) { + if (!second) { + return first && first.loc; + } else if ( + !first || + !first.loc || + !second.loc || + first.loc.lexer !== second.loc.lexer + ) { + return null; + } else { + return new SourceLocation( + first.loc.lexer, + first.loc.start, + second.loc.end, + ); + } + }, + }, + ]); + })(); + var Token = (function () { + function Token(text, loc) { + _classCallCheck(this, Token); + this.text = void 0; + this.loc = void 0; + this.noexpand = void 0; + this.treatAsRelax = void 0; + this.text = text; + this.loc = loc; + } + return _createClass(Token, [ + { + key: "range", + value: function range(endToken, text) { + return new Token(text, SourceLocation.range(this, endToken)); + }, + }, + ]); + })(); + var ParseError = _createClass(function ParseError(message, token) { + _classCallCheck(this, ParseError); + this.name = void 0; + this.position = void 0; + this.length = void 0; + this.rawMessage = void 0; + var error = "KaTeX parse error: " + message; + var start; + var end; + var loc = token && token.loc; + if (loc && loc.start <= loc.end) { + var input = loc.lexer.input; + start = loc.start; + end = loc.end; + if (start === input.length) { + error += " at end of input: "; + } else { + error += " at position " + (start + 1) + ": "; + } + var underlined = input.slice(start, end).replace(/[^]/g, "$&\u0332"); + var left; + if (start > 15) { + left = "\u2026" + input.slice(start - 15, start); + } else { + left = input.slice(0, start); + } + var right; + if (end + 15 < input.length) { + right = input.slice(end, end + 15) + "\u2026"; + } else { + right = input.slice(end); + } + error += left + underlined + right; + } + var self = new Error(error); + self.name = "ParseError"; + self.__proto__ = ParseError.prototype; + self.position = start; + if (start != null && end != null) { + self.length = end - start; + } + self.rawMessage = message; + return self; + }); + ParseError.prototype.__proto__ = Error.prototype; + var contains = function contains(list, elem) { + return list.indexOf(elem) !== -1; + }; + var deflt = function deflt(setting, defaultIfUndefined) { + return setting === undefined ? defaultIfUndefined : setting; + }; + var uppercase = /([A-Z])/g; + var hyphenate = function hyphenate(str) { + return str.replace(uppercase, "-$1").toLowerCase(); + }; + var ESCAPE_LOOKUP = { + "&": "&", + ">": ">", + "<": "<", + '"': """, + "'": "'", + }; + var ESCAPE_REGEX = /[&><"']/g; + function escape(text) { + return String(text).replace(ESCAPE_REGEX, function (match) { + return ESCAPE_LOOKUP[match]; + }); + } + var getBaseElem = function getBaseElem(group) { + if (group.type === "ordgroup") { + if (group.body.length === 1) { + return getBaseElem(group.body[0]); + } else { + return group; + } + } else if (group.type === "color") { + if (group.body.length === 1) { + return getBaseElem(group.body[0]); + } else { + return group; + } + } else if (group.type === "font") { + return getBaseElem(group.body); + } else { + return group; + } + }; + var isCharacterBox = function isCharacterBox(group) { + var baseElem = getBaseElem(group); + return ( + baseElem.type === "mathord" || + baseElem.type === "textord" || + baseElem.type === "atom" + ); + }; + var assert = function assert(value) { + if (!value) { + throw new Error("Expected non-null, but got " + String(value)); + } + return value; + }; + var protocolFromUrl = function protocolFromUrl(url) { + var protocol = /^[\x00-\x20]*([^\\/#?]*?)(:|�*58|�*3a|&colon)/i.exec( + url, + ); + if (!protocol) { + return "_relative"; + } + if (protocol[2] !== ":") { + return null; + } + if (!/^[a-zA-Z][a-zA-Z0-9+\-.]*$/.test(protocol[1])) { + return null; + } + return protocol[1].toLowerCase(); + }; + var utils = { + contains: contains, + deflt: deflt, + escape: escape, + hyphenate: hyphenate, + getBaseElem: getBaseElem, + isCharacterBox: isCharacterBox, + protocolFromUrl: protocolFromUrl, + }; + var SETTINGS_SCHEMA = { + displayMode: { + type: "boolean", + description: + "Render math in display mode, which puts the math in " + + "display style (so \\int and \\sum are large, for example), and " + + "centers the math on the page on its own line.", + cli: "-d, --display-mode", + }, + output: { + type: { enum: ["htmlAndMathml", "html", "mathml"] }, + description: "Determines the markup language of the output.", + cli: "-F, --format ", + }, + leqno: { + type: "boolean", + description: "Render display math in leqno style (left-justified tags).", + }, + fleqn: { type: "boolean", description: "Render display math flush left." }, + throwOnError: { + type: "boolean", + default: true, + cli: "-t, --no-throw-on-error", + cliDescription: + "Render errors (in the color given by --error-color) ins" + + "tead of throwing a ParseError exception when encountering an error.", + }, + errorColor: { + type: "string", + default: "#cc0000", + cli: "-c, --error-color ", + cliDescription: + "A color string given in the format 'rgb' or 'rrggbb' " + + "(no #). This option determines the color of errors rendered by the " + + "-t option.", + cliProcessor: function cliProcessor(color) { + return "#" + color; + }, + }, + macros: { + type: "object", + cli: "-m, --macro ", + cliDescription: + "Define custom macro of the form '\\foo:expansion' (use " + + "multiple -m arguments for multiple macros).", + cliDefault: [], + cliProcessor: function cliProcessor(def, defs) { + defs.push(def); + return defs; + }, + }, + minRuleThickness: { + type: "number", + description: + "Specifies a minimum thickness, in ems, for fraction lines," + + " `\\sqrt` top lines, `{array}` vertical lines, `\\hline`, " + + "`\\hdashline`, `\\underline`, `\\overline`, and the borders of " + + "`\\fbox`, `\\boxed`, and `\\fcolorbox`.", + processor: function processor(t) { + return Math.max(0, t); + }, + cli: "--min-rule-thickness ", + cliProcessor: parseFloat, + }, + colorIsTextColor: { + type: "boolean", + description: + "Makes \\color behave like LaTeX's 2-argument \\textcolor, " + + "instead of LaTeX's one-argument \\color mode change.", + cli: "-b, --color-is-text-color", + }, + strict: { + type: [{ enum: ["warn", "ignore", "error"] }, "boolean", "function"], + description: + "Turn on strict / LaTeX faithfulness mode, which throws an " + + "error if the input uses features that are not supported by LaTeX.", + cli: "-S, --strict", + cliDefault: false, + }, + trust: { + type: ["boolean", "function"], + description: "Trust the input, enabling all HTML features such as \\url.", + cli: "-T, --trust", + }, + maxSize: { + type: "number", + default: Infinity, + description: + "If non-zero, all user-specified sizes, e.g. in " + + "\\rule{500em}{500em}, will be capped to maxSize ems. Otherwise, " + + "elements and spaces can be arbitrarily large", + processor: function processor(s) { + return Math.max(0, s); + }, + cli: "-s, --max-size ", + cliProcessor: parseInt, + }, + maxExpand: { + type: "number", + default: 1000, + description: + "Limit the number of macro expansions to the specified " + + "number, to prevent e.g. infinite macro loops. If set to Infinity, " + + "the macro expander will try to fully expand as in LaTeX.", + processor: function processor(n) { + return Math.max(0, n); + }, + cli: "-e, --max-expand ", + cliProcessor: function cliProcessor(n) { + return n === "Infinity" ? Infinity : parseInt(n); + }, + }, + globalGroup: { type: "boolean", cli: false }, + }; + function getDefaultValue(schema) { + if (schema["default"]) { + return schema["default"]; + } + var type = schema.type; + var defaultType = Array.isArray(type) ? type[0] : type; + if (typeof defaultType !== "string") { + return defaultType["enum"][0]; + } + switch (defaultType) { + case "boolean": + return false; + case "string": + return ""; + case "number": + return 0; + case "object": + return {}; + } + } + var Settings = (function () { + function Settings(options) { + _classCallCheck(this, Settings); + this.displayMode = void 0; + this.output = void 0; + this.leqno = void 0; + this.fleqn = void 0; + this.throwOnError = void 0; + this.errorColor = void 0; + this.macros = void 0; + this.minRuleThickness = void 0; + this.colorIsTextColor = void 0; + this.strict = void 0; + this.trust = void 0; + this.maxSize = void 0; + this.maxExpand = void 0; + this.globalGroup = void 0; + options = options || {}; + for (var prop in SETTINGS_SCHEMA) { + if (SETTINGS_SCHEMA.hasOwnProperty(prop)) { + var schema = SETTINGS_SCHEMA[prop]; + this[prop] = + options[prop] !== undefined + ? schema.processor + ? schema.processor(options[prop]) + : options[prop] + : getDefaultValue(schema); + } + } + } + return _createClass(Settings, [ + { + key: "reportNonstrict", + value: function reportNonstrict(errorCode, errorMsg, token) { + var strict = this.strict; + if (typeof strict === "function") { + strict = strict(errorCode, errorMsg, token); + } + if (!strict || strict === "ignore") { + return; + } else if (strict === true || strict === "error") { + throw new ParseError( + "LaTeX-incompatible input and strict mode is set to 'error': " + + (errorMsg + " [" + errorCode + "]"), + token, + ); + } else if (strict === "warn") { + typeof console !== "undefined" && + console.warn( + "LaTeX-incompatible input and strict mode is set to 'warn': " + + (errorMsg + " [" + errorCode + "]"), + ); + } else { + typeof console !== "undefined" && + console.warn( + "LaTeX-incompatible input and strict mode is set to " + + ("unrecognized '" + + strict + + "': " + + errorMsg + + " [" + + errorCode + + "]"), + ); + } + }, + }, + { + key: "useStrictBehavior", + value: function useStrictBehavior(errorCode, errorMsg, token) { + var strict = this.strict; + if (typeof strict === "function") { + try { + strict = strict(errorCode, errorMsg, token); + } catch (error) { + strict = "error"; + } + } + if (!strict || strict === "ignore") { + return false; + } else if (strict === true || strict === "error") { + return true; + } else if (strict === "warn") { + typeof console !== "undefined" && + console.warn( + "LaTeX-incompatible input and strict mode is set to 'warn': " + + (errorMsg + " [" + errorCode + "]"), + ); + return false; + } else { + typeof console !== "undefined" && + console.warn( + "LaTeX-incompatible input and strict mode is set to " + + ("unrecognized '" + + strict + + "': " + + errorMsg + + " [" + + errorCode + + "]"), + ); + return false; + } + }, + }, + { + key: "isTrusted", + value: function isTrusted(context) { + if (context.url && !context.protocol) { + var protocol = utils.protocolFromUrl(context.url); + if (protocol == null) { + return false; + } + context.protocol = protocol; + } + var trust = + typeof this.trust === "function" ? this.trust(context) : this.trust; + return Boolean(trust); + }, + }, + ]); + })(); + var Style = (function () { + function Style(id, size, cramped) { + _classCallCheck(this, Style); + this.id = void 0; + this.size = void 0; + this.cramped = void 0; + this.id = id; + this.size = size; + this.cramped = cramped; + } + return _createClass(Style, [ + { + key: "sup", + value: function sup() { + return styles[_sup[this.id]]; + }, + }, + { + key: "sub", + value: function sub() { + return styles[_sub[this.id]]; + }, + }, + { + key: "fracNum", + value: function fracNum() { + return styles[_fracNum[this.id]]; + }, + }, + { + key: "fracDen", + value: function fracDen() { + return styles[_fracDen[this.id]]; + }, + }, + { + key: "cramp", + value: function cramp() { + return styles[_cramp[this.id]]; + }, + }, + { + key: "text", + value: function text() { + return styles[text$1[this.id]]; + }, + }, + { + key: "isTight", + value: function isTight() { + return this.size >= 2; + }, + }, + ]); + })(); + var D = 0; + var Dc = 1; + var T = 2; + var Tc = 3; + var S = 4; + var Sc = 5; + var SS = 6; + var SSc = 7; + var styles = [ + new Style(D, 0, false), + new Style(Dc, 0, true), + new Style(T, 1, false), + new Style(Tc, 1, true), + new Style(S, 2, false), + new Style(Sc, 2, true), + new Style(SS, 3, false), + new Style(SSc, 3, true), + ]; + var _sup = [S, Sc, S, Sc, SS, SSc, SS, SSc]; + var _sub = [Sc, Sc, Sc, Sc, SSc, SSc, SSc, SSc]; + var _fracNum = [T, Tc, S, Sc, SS, SSc, SS, SSc]; + var _fracDen = [Tc, Tc, Sc, Sc, SSc, SSc, SSc, SSc]; + var _cramp = [Dc, Dc, Tc, Tc, Sc, Sc, SSc, SSc]; + var text$1 = [D, Dc, T, Tc, T, Tc, T, Tc]; + var Style$1 = { + DISPLAY: styles[D], + TEXT: styles[T], + SCRIPT: styles[S], + SCRIPTSCRIPT: styles[SS], + }; + var scriptData = [ + { + name: "latin", + blocks: [ + [256, 591], + [768, 879], + ], + }, + { name: "cyrillic", blocks: [[1024, 1279]] }, + { name: "armenian", blocks: [[1328, 1423]] }, + { name: "brahmic", blocks: [[2304, 4255]] }, + { name: "georgian", blocks: [[4256, 4351]] }, + { + name: "cjk", + blocks: [ + [12288, 12543], + [19968, 40879], + [65280, 65376], + ], + }, + { name: "hangul", blocks: [[44032, 55215]] }, + ]; + function scriptFromCodepoint(codepoint) { + for (var i = 0; i < scriptData.length; i++) { + var script = scriptData[i]; + for (var _i = 0; _i < script.blocks.length; _i++) { + var block = script.blocks[_i]; + if (codepoint >= block[0] && codepoint <= block[1]) { + return script.name; + } + } + } + return null; + } + var allBlocks = []; + scriptData.forEach(function (s) { + return s.blocks.forEach(function (b) { + return allBlocks.push.apply(allBlocks, _toConsumableArray(b)); + }); + }); + function supportedCodepoint(codepoint) { + for (var i = 0; i < allBlocks.length; i += 2) { + if (codepoint >= allBlocks[i] && codepoint <= allBlocks[i + 1]) { + return true; + } + } + return false; + } + var hLinePad = 80; + var sqrtMain = function sqrtMain(extraVinculum, hLinePad) { + return ( + "M95," + + (622 + extraVinculum + hLinePad) + + "\nc-2.7,0,-7.17,-2.7,-13.5,-8c-5.8,-5.3,-9.5,-10,-9.5,-14\nc0,-2,0.3,-3.3,1,-4c1.3,-2.7,23.83,-20.7,67.5,-54\nc44.2,-33.3,65.8,-50.3,66.5,-51c1.3,-1.3,3,-2,5,-2c4.7,0,8.7,3.3,12,10\ns173,378,173,378c0.7,0,35.3,-71,104,-213c68.7,-142,137.5,-285,206.5,-429\nc69,-144,104.5,-217.7,106.5,-221\nl" + + extraVinculum / 2.075 + + " -" + + extraVinculum + + "\nc5.3,-9.3,12,-14,20,-14\nH400000v" + + (40 + extraVinculum) + + "H845.2724\ns-225.272,467,-225.272,467s-235,486,-235,486c-2.7,4.7,-9,7,-19,7\nc-6,0,-10,-1,-12,-3s-194,-422,-194,-422s-65,47,-65,47z\nM" + + (834 + extraVinculum) + + " " + + hLinePad + + "h400000v" + + (40 + extraVinculum) + + "h-400000z" + ); + }; + var sqrtSize1 = function sqrtSize1(extraVinculum, hLinePad) { + return ( + "M263," + + (601 + extraVinculum + hLinePad) + + "c0.7,0,18,39.7,52,119\nc34,79.3,68.167,158.7,102.5,238c34.3,79.3,51.8,119.3,52.5,120\nc340,-704.7,510.7,-1060.3,512,-1067\nl" + + extraVinculum / 2.084 + + " -" + + extraVinculum + + "\nc4.7,-7.3,11,-11,19,-11\nH40000v" + + (40 + extraVinculum) + + "H1012.3\ns-271.3,567,-271.3,567c-38.7,80.7,-84,175,-136,283c-52,108,-89.167,185.3,-111.5,232\nc-22.3,46.7,-33.8,70.3,-34.5,71c-4.7,4.7,-12.3,7,-23,7s-12,-1,-12,-1\ns-109,-253,-109,-253c-72.7,-168,-109.3,-252,-110,-252c-10.7,8,-22,16.7,-34,26\nc-22,17.3,-33.3,26,-34,26s-26,-26,-26,-26s76,-59,76,-59s76,-60,76,-60z\nM" + + (1001 + extraVinculum) + + " " + + hLinePad + + "h400000v" + + (40 + extraVinculum) + + "h-400000z" + ); + }; + var sqrtSize2 = function sqrtSize2(extraVinculum, hLinePad) { + return ( + "M983 " + + (10 + extraVinculum + hLinePad) + + "\nl" + + extraVinculum / 3.13 + + " -" + + extraVinculum + + "\nc4,-6.7,10,-10,18,-10 H400000v" + + (40 + extraVinculum) + + "\nH1013.1s-83.4,268,-264.1,840c-180.7,572,-277,876.3,-289,913c-4.7,4.7,-12.7,7,-24,7\ns-12,0,-12,0c-1.3,-3.3,-3.7,-11.7,-7,-25c-35.3,-125.3,-106.7,-373.3,-214,-744\nc-10,12,-21,25,-33,39s-32,39,-32,39c-6,-5.3,-15,-14,-27,-26s25,-30,25,-30\nc26.7,-32.7,52,-63,76,-91s52,-60,52,-60s208,722,208,722\nc56,-175.3,126.3,-397.3,211,-666c84.7,-268.7,153.8,-488.2,207.5,-658.5\nc53.7,-170.3,84.5,-266.8,92.5,-289.5z\nM" + + (1001 + extraVinculum) + + " " + + hLinePad + + "h400000v" + + (40 + extraVinculum) + + "h-400000z" + ); + }; + var sqrtSize3 = function sqrtSize3(extraVinculum, hLinePad) { + return ( + "M424," + + (2398 + extraVinculum + hLinePad) + + "\nc-1.3,-0.7,-38.5,-172,-111.5,-514c-73,-342,-109.8,-513.3,-110.5,-514\nc0,-2,-10.7,14.3,-32,49c-4.7,7.3,-9.8,15.7,-15.5,25c-5.7,9.3,-9.8,16,-12.5,20\ns-5,7,-5,7c-4,-3.3,-8.3,-7.7,-13,-13s-13,-13,-13,-13s76,-122,76,-122s77,-121,77,-121\ns209,968,209,968c0,-2,84.7,-361.7,254,-1079c169.3,-717.3,254.7,-1077.7,256,-1081\nl" + + extraVinculum / 4.223 + + " -" + + extraVinculum + + "c4,-6.7,10,-10,18,-10 H400000\nv" + + (40 + extraVinculum) + + "H1014.6\ns-87.3,378.7,-272.6,1166c-185.3,787.3,-279.3,1182.3,-282,1185\nc-2,6,-10,9,-24,9\nc-8,0,-12,-0.7,-12,-2z M" + + (1001 + extraVinculum) + + " " + + hLinePad + + "\nh400000v" + + (40 + extraVinculum) + + "h-400000z" + ); + }; + var sqrtSize4 = function sqrtSize4(extraVinculum, hLinePad) { + return ( + "M473," + + (2713 + extraVinculum + hLinePad) + + "\nc339.3,-1799.3,509.3,-2700,510,-2702 l" + + extraVinculum / 5.298 + + " -" + + extraVinculum + + "\nc3.3,-7.3,9.3,-11,18,-11 H400000v" + + (40 + extraVinculum) + + "H1017.7\ns-90.5,478,-276.2,1466c-185.7,988,-279.5,1483,-281.5,1485c-2,6,-10,9,-24,9\nc-8,0,-12,-0.7,-12,-2c0,-1.3,-5.3,-32,-16,-92c-50.7,-293.3,-119.7,-693.3,-207,-1200\nc0,-1.3,-5.3,8.7,-16,30c-10.7,21.3,-21.3,42.7,-32,64s-16,33,-16,33s-26,-26,-26,-26\ns76,-153,76,-153s77,-151,77,-151c0.7,0.7,35.7,202,105,604c67.3,400.7,102,602.7,104,\n606zM" + + (1001 + extraVinculum) + + " " + + hLinePad + + "h400000v" + + (40 + extraVinculum) + + "H1017.7z" + ); + }; + var phasePath = function phasePath(y) { + var x = y / 2; + return ( + "M400000 " + y + " H0 L" + x + " 0 l65 45 L145 " + (y - 80) + " H400000z" + ); + }; + var sqrtTall = function sqrtTall(extraVinculum, hLinePad, viewBoxHeight) { + var vertSegment = viewBoxHeight - 54 - hLinePad - extraVinculum; + return ( + "M702 " + + (extraVinculum + hLinePad) + + "H400000" + + (40 + extraVinculum) + + "\nH742v" + + vertSegment + + "l-4 4-4 4c-.667.7 -2 1.5-4 2.5s-4.167 1.833-6.5 2.5-5.5 1-9.5 1\nh-12l-28-84c-16.667-52-96.667 -294.333-240-727l-212 -643 -85 170\nc-4-3.333-8.333-7.667-13 -13l-13-13l77-155 77-156c66 199.333 139 419.667\n219 661 l218 661zM702 " + + hLinePad + + "H400000v" + + (40 + extraVinculum) + + "H742z" + ); + }; + var sqrtPath = function sqrtPath(size, extraVinculum, viewBoxHeight) { + extraVinculum = 1000 * extraVinculum; + var path = ""; + switch (size) { + case "sqrtMain": + path = sqrtMain(extraVinculum, hLinePad); + break; + case "sqrtSize1": + path = sqrtSize1(extraVinculum, hLinePad); + break; + case "sqrtSize2": + path = sqrtSize2(extraVinculum, hLinePad); + break; + case "sqrtSize3": + path = sqrtSize3(extraVinculum, hLinePad); + break; + case "sqrtSize4": + path = sqrtSize4(extraVinculum, hLinePad); + break; + case "sqrtTall": + path = sqrtTall(extraVinculum, hLinePad, viewBoxHeight); + } + return path; + }; + var innerPath = function innerPath(name, height) { + switch (name) { + case "\u239C": + return ( + "M291 0 H417 V" + height + " H291z M291 0 H417 V" + height + " H291z" + ); + case "\u2223": + return ( + "M145 0 H188 V" + height + " H145z M145 0 H188 V" + height + " H145z" + ); + case "\u2225": + return ( + "M145 0 H188 V" + + height + + " H145z M145 0 H188 V" + + height + + " H145z" + + ("M367 0 H410 V" + + height + + " H367z M367 0 H410 V" + + height + + " H367z") + ); + case "\u239F": + return ( + "M457 0 H583 V" + height + " H457z M457 0 H583 V" + height + " H457z" + ); + case "\u23A2": + return ( + "M319 0 H403 V" + height + " H319z M319 0 H403 V" + height + " H319z" + ); + case "\u23A5": + return ( + "M263 0 H347 V" + height + " H263z M263 0 H347 V" + height + " H263z" + ); + case "\u23AA": + return ( + "M384 0 H504 V" + height + " H384z M384 0 H504 V" + height + " H384z" + ); + case "\u23D0": + return ( + "M312 0 H355 V" + height + " H312z M312 0 H355 V" + height + " H312z" + ); + case "\u2016": + return ( + "M257 0 H300 V" + + height + + " H257z M257 0 H300 V" + + height + + " H257z" + + ("M478 0 H521 V" + + height + + " H478z M478 0 H521 V" + + height + + " H478z") + ); + default: + return ""; + } + }; + var path = { + doubleleftarrow: + "M262 157\nl10-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\n 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\n 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\nc2 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\n 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\n-86-123l-10-10h399738v-40H218c328 0 0 0 0 0l-10-8c-26.7-20-65.7-43-117-69 2.7\n-2 6-3.7 10-5 36.7-16 72.3-37.3 107-64l10-8h399782v-40z\nm8 0v40h399730v-40zm0 194v40h399730v-40z", + doublerightarrow: + "M399738 392l\n-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\n 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\n-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\n-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\n-13h-6c-12 .7-18 4-18 10 0 2 1.7 7 5 15 23.3 46 52 87 86 123l10 10H0v40h399782\nc-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\n-107 64l-10 8H0v40zM0 157v40h399730v-40zm0 194v40h399730v-40z", + leftarrow: + "M400000 241H110l3-3c68.7-52.7 113.7-120\n 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\n-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\nc-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\n 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\n 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\n l-3-3h399890zM100 241v40h399900v-40z", + leftbrace: + "M6 548l-6-6v-35l6-11c56-104 135.3-181.3 238-232 57.3-28.7 117\n-45 179-50h399577v120H403c-43.3 7-81 15-113 26-100.7 33-179.7 91-237 174-2.7\n 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\n 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\n 0 2 .3 4 1 18.688 2.7 76 4.3 172 5h399450v120H429l-6-1c-124.688-8-235-61.7\n-331-161C60.687 138.7 32.312 99.3 7 54L0 41V6z", + leftgroup: + "M400000 80\nH435C64 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\n 435 0h399565z", + leftgroupunder: + "M400000 262\nH435C64 262 168.3 112.6 21 82c-5.9-1.2-18 0-18 0-2 0-3 1-3 3v38c76 158 257 219\n 435 219h399565z", + leftharpoon: + "M0 267c.7 5.3 3 10 7 14h399993v-40H93c3.3\n-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\n-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\n-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\n 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\n-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\n-10.7 8-12 10-1.3 2-2 5.7-2 11zm100-26v40h399900v-40zM0 435v40h400000v-40z\nm0 0v40h400000v-40z", + leftharpoondown: + "M7 241c-4 4-6.333 8.667-7 14 0 5.333.667 9 2 11s5.333\n 5.333 12 10c90.667 54 156 130 196 228 3.333 10.667 6.333 16.333 9 17 2 .667 5\n 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\n-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\n 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\n-2 18-6 2-2.7 1-9.7-3-21-32-87.3-82.7-157.7-152-211l-3-3h399907v-40H7zm93 0\nv40h399900v-40zM0 241v40h399900v-40zm0 0v40h399900v-40z", + lefthook: + "M400000 281 H103s-33-11.2-61-33.5S0 197.3 0 164s14.2-61.2 42.5\n-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\n-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\n 71.5 23h399859zM103 281v-40h399897v40z", + leftlinesegment: + "M40 281 V428 H0 V94 H40 V241 H400000 v40z\nM40 281 V428 H0 V94 H40 V241 H400000 v40z", + leftmapsto: + "M40 281 V448H0V74H40V241H400000v40z\nM40 281 V448H0V74H40V241H400000v40z", + leftToFrom: + "M0 147h400000v40H0zm0 214c68 40 115.7 95.7 143 167h22c15.3 0 23\n-.3 23-1 0-1.3-5.3-13.7-16-37-18-35.3-41.3-69-70-101l-7-8h399905v-40H95l7-8\nc28.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\n 68 321 0 361zm0-174v-40h399900v40zm100 154v40h399900v-40z", + longequal: + "M0 50 h400000 v40H0z m0 194h40000v40H0z\nM0 50 h400000 v40H0z m0 194h40000v40H0z", + midbrace: + "M200428 334\nc-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\n-53.3 86.7-123.7 153-211 199-66.7 36-137.3 56.3-212 62H0V214h199568c178.3-11.7\n 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\n 12 44.7 59.3 101.3 106.3 170 141s145.3 54.3 229 60h199572v120z", + midbraceunder: + "M199572 214\nc100.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\n 53.3-86.7 123.7-153 211-199 66.7-36 137.3-56.3 212-62h199568v120H200432c-178.3\n 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\n-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\n-320.3 177.6S193.1 320.6 193.1 249.8c0-71.4 46.9-178.2 319.5-178.2z\nm368.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\n60.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\n-451.1 228.8-386.3 0-452.7-137.5-452.7-228.8 0-92.4 66.4-230 452.7-230z\nm502.4 230c0-111.2-82.4-277.2-502.4-277.2s-504 166-504 277.2\nc0 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\n-480.5 177.6S202.1 320.6 202.1 249.8c0-71.4 70.5-178.2 479.3-178.2z\nm525.8 178.2c0-86.4-86.8-215.4-525.7-215.4-437.9 0-524.7 129-524.7 215.4 0\n85.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\n-707.8 275.8-606 0-710.2-165.8-710.2-275.8C311 218.8 415.2 53 1021.2 53z\nm770.4 277.1c0-131.2-126.4-327.6-770.5-327.6S248.4 198.9 248.4 330.1\nc0 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\n-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\n 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\n 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\n-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\n-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\n 151.7 139 205zm0 0v40h399900v-40z", + rightbrace: + "M400000 542l\n-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\ns-117.2-55.8-184.5-66.5c-.7 0-2-.3-4-1-18.7-2.7-76-4.3-172-5H0V214h399571l6 1\nc124.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\n 28.7-117 45-179 50H-300V214h399897c43.3-7 81-15 113-26 100.7-33 179.7-91 237\n-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\n 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\n 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\n-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\n-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\n 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\n-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\n 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\nm0 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\n 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\n-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\n-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\n 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\n 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\n-64.7 57-92 95-27.3 38-48.7 77.7-64 119-3.3 8.7-5 14-5 16zM0 435v40h399900v-40z\nm0-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\n 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\n-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\n 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\nM399960 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\n 1 0 1.3 5.3 13.7 16 37 18 35.3 41.3 69 70 101l7 8H0v40h399905l-7 8c-28.7 32\n-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\n-167z M100 147v40h399900v-40zM0 341v40h399900v-40z", + twoheadleftarrow: + "M0 167c68 40\n 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\n-70-101l-7-8h125l9 7c50.7 39.3 85 86 103 140h46c0-4.7-6.3-18.7-19-42-18-35.3\n-40-67.3-66-96l-9-9h399716v-40H284l9-9c26-28.7 48-60.7 66-96 12.7-23.333 19\n-37.333 19-42h-46c-18 54-52.3 100.7-103 140l-9 7H95l7-8c28.7-32 52-65.7 70-101\n 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\nc-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\n 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\n 18 35.3 40 67.3 66 96l9 9H0v40h399716l-9 9c-26 28.7-48 60.7-66 96-12.7 23.333\n-19 37.333-19 42h46c18-54 52.3-100.7 103-140l9-7h125l-7 8c-28.7 32-52 65.7-70\n 101-10.7 23.333-16 35.7-16 37 0 .7 7.7 1 23 1h22c27.3-71.3 75-127 143-167z", + tilde1: + "M200 55.538c-77 0-168 73.953-177 73.953-3 0-7\n-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\n 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\n 4.35-2 7.613-5 9.788l-19 13.05c-92 63.077-116.937 75.308-183 76.128\n-68.267.847-113-73.952-191-73.952z", + tilde2: + "M344 55.266c-142 0-300.638 81.316-311.5 86.418\n-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\n 31.9 283 0 358 0c148 0 188 122 331 122s314-97 326-97c4 0 8 2 10 7l7 21.114\nc1 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\n 181.476 676 181.476c-149 0-189-126.21-332-126.21z", + tilde3: + "M786 59C457 59 32 175.242 13 175.242c-6 0-10-3.457\n-11-10.37L.15 138c-1-7 3-12 10-13l19.2-6.4C378.4 40.7 634.3 0 804.3 0c337 0\n 411.8 157 746.8 157 328 0 754-112 773-112 5 0 10 3 11 9l1 14.075c1 8.066-.697\n 16.595-6.697 17.492l-21.052 7.31c-367.9 98.146-609.15 122.696-778.15 122.696\n -338 0-409-156.573-744-156.573z", + tilde4: + "M786 58C457 58 32 177.487 13 177.487c-6 0-10-3.345\n-11-10.035L.15 143c-1-7 3-12 10-13l22-6.7C381.2 35 637.15 0 807.15 0c337 0 409\n 177 744 177 328 0 754-127 773-127 5 0 10 3 11 9l1 14.794c1 7.805-3 13.38-9\n 14.495l-20.7 5.574c-366.85 99.79-607.3 139.372-776.3 139.372-338 0-409\n -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\n3.333 2.667 6.667 9 10 19 6.667 24.667 20.333 43.667 41 57 7.333 4.667 11\n10.667 11 18 0 6-1 10-3 12s-6.667 5-14 9c-28.667 14.667-53.667 35.667-75 63\n-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\n-7 1c-4.667 0-9.167-1.833-13.5-5.5S337 184 337 178c0-12.667 15.667-32.333 47-59\nH213l-171-1c-8.667-6-13-12.333-13-19 0-4.667 4.333-11.333 13-20h359\nc-16-25.333-24-45-24-59z", + widehat1: + "M529 0h5l519 115c5 1 9 5 9 10 0 1-1 2-1 3l-4 22\nc-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\n-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\n-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\n-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,\n-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,\n-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,\n-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,\n-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\nc4 -14.7 6 -23 6 -25c0 -7.3 -7 -11 -21 -11c-8 0 -13.2 0.8 -15.5 2.5\nc-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\ns-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\n121.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\ns2.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\nc0 -2 -2 -10.3 -6 -25c-20 -79.3 -65 -146.7 -135 -202l-3 -3h399890z\nM100 620v40h399900v-40z M0 241v40h399900v-40zM0 241v40h399900v-40z", + rightarrowabovebar: + "M0 241v40h399891c-47.3 35.3-84 78-110 128-16.7 32\n-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\n13.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\n-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\n-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\n-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\n151.7 139 205zm96 379h399894v40H0zm0 0h399904v40H0z", + baraboveshortleftharpoon: + "M507,435c-4,4,-6.3,8.7,-7,14c0,5.3,0.7,9,2,11\nc1.3,2,5.3,5.3,12,10c90.7,54,156,130,196,228c3.3,10.7,6.3,16.3,9,17\nc2,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\nc-32,-87.3,-82.7,-157.7,-152,-211c0,0,-3,-3,-3,-3l399351,0l0,-40\nc-398570,0,-399437,0,-399437,0z M593 435 v40 H399500 v-40z\nM0 281 v-40 H399908 v40z M0 281 v-40 H399908 v40z", + rightharpoonaboveshortbar: + "M0,241 l0,40c399126,0,399993,0,399993,0\nc4.7,-4.7,7,-9.3,7,-14c0,-9.3,-3.7,-15.3,-11,-18c-92.7,-56.7,-159,-133.7,-199,\n-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\nc-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\nM0 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\nc1.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,\n1c0,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,\n-152,-211c0,0,-3,-3,-3,-3l399907,0l0,-40c-399126,0,-399993,0,-399993,0z\nM93 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\nc4.7,-4.7,7,-9.3,7,-14c0,-9.3,-3.7,-15.3,-11,-18c-92.7,-56.7,-159,-133.7,-199,\n-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\nc-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\nM500 241 v40 H399408 v-40z M500 435 v40 H400000 v-40z", + }; + var tallDelim = function tallDelim(label, midHeight) { + switch (label) { + case "lbrack": + return ( + "M403 1759 V84 H666 V0 H319 V1759 v" + + midHeight + + " v1759 h347 v-84\nH403z M403 1759 V0 H319 V1759 v" + + midHeight + + " v1759 h84z" + ); + case "rbrack": + return ( + "M347 1759 V0 H0 V84 H263 V1759 v" + + midHeight + + " v1759 H0 v84 H347z\nM347 1759 V0 H263 V1759 v" + + midHeight + + " v1759 h84z" + ); + case "vert": + return ( + "M145 15 v585 v" + + midHeight + + " v585 c2.667,10,9.667,15,21,15\nc10,0,16.667,-5,20,-15 v-585 v" + + -midHeight + + " v-585 c-2.667,-10,-9.667,-15,-21,-15\nc-10,0,-16.667,5,-20,15z M188 15 H145 v585 v" + + midHeight + + " v585 h43z" + ); + case "doublevert": + return ( + "M145 15 v585 v" + + midHeight + + " v585 c2.667,10,9.667,15,21,15\nc10,0,16.667,-5,20,-15 v-585 v" + + -midHeight + + " v-585 c-2.667,-10,-9.667,-15,-21,-15\nc-10,0,-16.667,5,-20,15z M188 15 H145 v585 v" + + midHeight + + " v585 h43z\nM367 15 v585 v" + + midHeight + + " v585 c2.667,10,9.667,15,21,15\nc10,0,16.667,-5,20,-15 v-585 v" + + -midHeight + + " v-585 c-2.667,-10,-9.667,-15,-21,-15\nc-10,0,-16.667,5,-20,15z M410 15 H367 v585 v" + + midHeight + + " v585 h43z" + ); + case "lfloor": + return ( + "M319 602 V0 H403 V602 v" + + midHeight + + " v1715 h263 v84 H319z\nMM319 602 V0 H403 V602 v" + + midHeight + + " v1715 H319z" + ); + case "rfloor": + return ( + "M319 602 V0 H403 V602 v" + + midHeight + + " v1799 H0 v-84 H319z\nMM319 602 V0 H403 V602 v" + + midHeight + + " v1715 H319z" + ); + case "lceil": + return ( + "M403 1759 V84 H666 V0 H319 V1759 v" + + midHeight + + " v602 h84z\nM403 1759 V0 H319 V1759 v" + + midHeight + + " v602 h84z" + ); + case "rceil": + return ( + "M347 1759 V0 H0 V84 H263 V1759 v" + + midHeight + + " v602 h84z\nM347 1759 V0 h-84 V1759 v" + + midHeight + + " v602 h84z" + ); + case "lparen": + return ( + "M863,9c0,-2,-2,-5,-6,-9c0,0,-17,0,-17,0c-12.7,0,-19.3,0.3,-20,1\nc-5.3,5.3,-10.3,11,-15,17c-242.7,294.7,-395.3,682,-458,1162c-21.3,163.3,-33.3,349,\n-36,557 l0," + + (midHeight + 84) + + "c0.2,6,0,26,0,60c2,159.3,10,310.7,24,454c53.3,528,210,\n949.7,470,1265c4.7,6,9.7,11.7,15,17c0.7,0.7,7,1,19,1c0,0,18,0,18,0c4,-4,6,-7,6,-9\nc0,-2.7,-3.3,-8.7,-10,-18c-135.3,-192.7,-235.5,-414.3,-300.5,-665c-65,-250.7,-102.5,\n-544.7,-112.5,-882c-2,-104,-3,-167,-3,-189\nl0,-" + + (midHeight + 92) + + "c0,-162.7,5.7,-314,17,-454c20.7,-272,63.7,-513,129,-723c65.3,\n-210,155.3,-396.3,270,-559c6.7,-9.3,10,-15.3,10,-18z" + ); + case "rparen": + return ( + "M76,0c-16.7,0,-25,3,-25,9c0,2,2,6.3,6,13c21.3,28.7,42.3,60.3,\n63,95c96.7,156.7,172.8,332.5,228.5,527.5c55.7,195,92.8,416.5,111.5,664.5\nc11.3,139.3,17,290.7,17,454c0,28,1.7,43,3.3,45l0," + + (midHeight + 9) + + "\nc-3,4,-3.3,16.7,-3.3,38c0,162,-5.7,313.7,-17,455c-18.7,248,-55.8,469.3,-111.5,664\nc-55.7,194.7,-131.8,370.3,-228.5,527c-20.7,34.7,-41.7,66.3,-63,95c-2,3.3,-4,7,-6,11\nc0,7.3,5.7,11,17,11c0,0,11,0,11,0c9.3,0,14.3,-0.3,15,-1c5.3,-5.3,10.3,-11,15,-17\nc242.7,-294.7,395.3,-681.7,458,-1161c21.3,-164.7,33.3,-350.7,36,-558\nl0,-" + + (midHeight + 144) + + "c-2,-159.3,-10,-310.7,-24,-454c-53.3,-528,-210,-949.7,\n-470,-1265c-4.7,-6,-9.7,-11.7,-15,-17c-0.7,-0.7,-6.7,-1,-18,-1z" + ); + default: + throw new Error("Unknown stretchy delimiter."); + } + }; + var DocumentFragment = (function () { + function DocumentFragment(children) { + _classCallCheck(this, DocumentFragment); + this.children = void 0; + this.classes = void 0; + this.height = void 0; + this.depth = void 0; + this.maxFontSize = void 0; + this.style = void 0; + this.children = children; + this.classes = []; + this.height = 0; + this.depth = 0; + this.maxFontSize = 0; + this.style = {}; + } + return _createClass(DocumentFragment, [ + { + key: "hasClass", + value: function hasClass(className) { + return utils.contains(this.classes, className); + }, + }, + { + key: "toNode", + value: function toNode() { + var frag = document.createDocumentFragment(); + for (var i = 0; i < this.children.length; i++) { + frag.appendChild(this.children[i].toNode()); + } + return frag; + }, + }, + { + key: "toMarkup", + value: function toMarkup() { + var markup = ""; + for (var i = 0; i < this.children.length; i++) { + markup += this.children[i].toMarkup(); + } + return markup; + }, + }, + { + key: "toText", + value: function toText() { + var toText = function toText(child) { + return child.toText(); + }; + return this.children.map(toText).join(""); + }, + }, + ]); + })(); + var fontMetricsData = { + "AMS-Regular": { + 32: [0, 0, 0, 0, 0.25], + 65: [0, 0.68889, 0, 0, 0.72222], + 66: [0, 0.68889, 0, 0, 0.66667], + 67: [0, 0.68889, 0, 0, 0.72222], + 68: [0, 0.68889, 0, 0, 0.72222], + 69: [0, 0.68889, 0, 0, 0.66667], + 70: [0, 0.68889, 0, 0, 0.61111], + 71: [0, 0.68889, 0, 0, 0.77778], + 72: [0, 0.68889, 0, 0, 0.77778], + 73: [0, 0.68889, 0, 0, 0.38889], + 74: [0.16667, 0.68889, 0, 0, 0.5], + 75: [0, 0.68889, 0, 0, 0.77778], + 76: [0, 0.68889, 0, 0, 0.66667], + 77: [0, 0.68889, 0, 0, 0.94445], + 78: [0, 0.68889, 0, 0, 0.72222], + 79: [0.16667, 0.68889, 0, 0, 0.77778], + 80: [0, 0.68889, 0, 0, 0.61111], + 81: [0.16667, 0.68889, 0, 0, 0.77778], + 82: [0, 0.68889, 0, 0, 0.72222], + 83: [0, 0.68889, 0, 0, 0.55556], + 84: [0, 0.68889, 0, 0, 0.66667], + 85: [0, 0.68889, 0, 0, 0.72222], + 86: [0, 0.68889, 0, 0, 0.72222], + 87: [0, 0.68889, 0, 0, 1], + 88: [0, 0.68889, 0, 0, 0.72222], + 89: [0, 0.68889, 0, 0, 0.72222], + 90: [0, 0.68889, 0, 0, 0.66667], + 107: [0, 0.68889, 0, 0, 0.55556], + 160: [0, 0, 0, 0, 0.25], + 165: [0, 0.675, 0.025, 0, 0.75], + 174: [0.15559, 0.69224, 0, 0, 0.94666], + 240: [0, 0.68889, 0, 0, 0.55556], + 295: [0, 0.68889, 0, 0, 0.54028], + 710: [0, 0.825, 0, 0, 2.33334], + 732: [0, 0.9, 0, 0, 2.33334], + 770: [0, 0.825, 0, 0, 2.33334], + 771: [0, 0.9, 0, 0, 2.33334], + 989: [0.08167, 0.58167, 0, 0, 0.77778], + 1008: [0, 0.43056, 0.04028, 0, 0.66667], + 8245: [0, 0.54986, 0, 0, 0.275], + 8463: [0, 0.68889, 0, 0, 0.54028], + 8487: [0, 0.68889, 0, 0, 0.72222], + 8498: [0, 0.68889, 0, 0, 0.55556], + 8502: [0, 0.68889, 0, 0, 0.66667], + 8503: [0, 0.68889, 0, 0, 0.44445], + 8504: [0, 0.68889, 0, 0, 0.66667], + 8513: [0, 0.68889, 0, 0, 0.63889], + 8592: [-0.03598, 0.46402, 0, 0, 0.5], + 8594: [-0.03598, 0.46402, 0, 0, 0.5], + 8602: [-0.13313, 0.36687, 0, 0, 1], + 8603: [-0.13313, 0.36687, 0, 0, 1], + 8606: [0.01354, 0.52239, 0, 0, 1], + 8608: [0.01354, 0.52239, 0, 0, 1], + 8610: [0.01354, 0.52239, 0, 0, 1.11111], + 8611: [0.01354, 0.52239, 0, 0, 1.11111], + 8619: [0, 0.54986, 0, 0, 1], + 8620: [0, 0.54986, 0, 0, 1], + 8621: [-0.13313, 0.37788, 0, 0, 1.38889], + 8622: [-0.13313, 0.36687, 0, 0, 1], + 8624: [0, 0.69224, 0, 0, 0.5], + 8625: [0, 0.69224, 0, 0, 0.5], + 8630: [0, 0.43056, 0, 0, 1], + 8631: [0, 0.43056, 0, 0, 1], + 8634: [0.08198, 0.58198, 0, 0, 0.77778], + 8635: [0.08198, 0.58198, 0, 0, 0.77778], + 8638: [0.19444, 0.69224, 0, 0, 0.41667], + 8639: [0.19444, 0.69224, 0, 0, 0.41667], + 8642: [0.19444, 0.69224, 0, 0, 0.41667], + 8643: [0.19444, 0.69224, 0, 0, 0.41667], + 8644: [0.1808, 0.675, 0, 0, 1], + 8646: [0.1808, 0.675, 0, 0, 1], + 8647: [0.1808, 0.675, 0, 0, 1], + 8648: [0.19444, 0.69224, 0, 0, 0.83334], + 8649: [0.1808, 0.675, 0, 0, 1], + 8650: [0.19444, 0.69224, 0, 0, 0.83334], + 8651: [0.01354, 0.52239, 0, 0, 1], + 8652: [0.01354, 0.52239, 0, 0, 1], + 8653: [-0.13313, 0.36687, 0, 0, 1], + 8654: [-0.13313, 0.36687, 0, 0, 1], + 8655: [-0.13313, 0.36687, 0, 0, 1], + 8666: [0.13667, 0.63667, 0, 0, 1], + 8667: [0.13667, 0.63667, 0, 0, 1], + 8669: [-0.13313, 0.37788, 0, 0, 1], + 8672: [-0.064, 0.437, 0, 0, 1.334], + 8674: [-0.064, 0.437, 0, 0, 1.334], + 8705: [0, 0.825, 0, 0, 0.5], + 8708: [0, 0.68889, 0, 0, 0.55556], + 8709: [0.08167, 0.58167, 0, 0, 0.77778], + 8717: [0, 0.43056, 0, 0, 0.42917], + 8722: [-0.03598, 0.46402, 0, 0, 0.5], + 8724: [0.08198, 0.69224, 0, 0, 0.77778], + 8726: [0.08167, 0.58167, 0, 0, 0.77778], + 8733: [0, 0.69224, 0, 0, 0.77778], + 8736: [0, 0.69224, 0, 0, 0.72222], + 8737: [0, 0.69224, 0, 0, 0.72222], + 8738: [0.03517, 0.52239, 0, 0, 0.72222], + 8739: [0.08167, 0.58167, 0, 0, 0.22222], + 8740: [0.25142, 0.74111, 0, 0, 0.27778], + 8741: [0.08167, 0.58167, 0, 0, 0.38889], + 8742: [0.25142, 0.74111, 0, 0, 0.5], + 8756: [0, 0.69224, 0, 0, 0.66667], + 8757: [0, 0.69224, 0, 0, 0.66667], + 8764: [-0.13313, 0.36687, 0, 0, 0.77778], + 8765: [-0.13313, 0.37788, 0, 0, 0.77778], + 8769: [-0.13313, 0.36687, 0, 0, 0.77778], + 8770: [-0.03625, 0.46375, 0, 0, 0.77778], + 8774: [0.30274, 0.79383, 0, 0, 0.77778], + 8776: [-0.01688, 0.48312, 0, 0, 0.77778], + 8778: [0.08167, 0.58167, 0, 0, 0.77778], + 8782: [0.06062, 0.54986, 0, 0, 0.77778], + 8783: [0.06062, 0.54986, 0, 0, 0.77778], + 8785: [0.08198, 0.58198, 0, 0, 0.77778], + 8786: [0.08198, 0.58198, 0, 0, 0.77778], + 8787: [0.08198, 0.58198, 0, 0, 0.77778], + 8790: [0, 0.69224, 0, 0, 0.77778], + 8791: [0.22958, 0.72958, 0, 0, 0.77778], + 8796: [0.08198, 0.91667, 0, 0, 0.77778], + 8806: [0.25583, 0.75583, 0, 0, 0.77778], + 8807: [0.25583, 0.75583, 0, 0, 0.77778], + 8808: [0.25142, 0.75726, 0, 0, 0.77778], + 8809: [0.25142, 0.75726, 0, 0, 0.77778], + 8812: [0.25583, 0.75583, 0, 0, 0.5], + 8814: [0.20576, 0.70576, 0, 0, 0.77778], + 8815: [0.20576, 0.70576, 0, 0, 0.77778], + 8816: [0.30274, 0.79383, 0, 0, 0.77778], + 8817: [0.30274, 0.79383, 0, 0, 0.77778], + 8818: [0.22958, 0.72958, 0, 0, 0.77778], + 8819: [0.22958, 0.72958, 0, 0, 0.77778], + 8822: [0.1808, 0.675, 0, 0, 0.77778], + 8823: [0.1808, 0.675, 0, 0, 0.77778], + 8828: [0.13667, 0.63667, 0, 0, 0.77778], + 8829: [0.13667, 0.63667, 0, 0, 0.77778], + 8830: [0.22958, 0.72958, 0, 0, 0.77778], + 8831: [0.22958, 0.72958, 0, 0, 0.77778], + 8832: [0.20576, 0.70576, 0, 0, 0.77778], + 8833: [0.20576, 0.70576, 0, 0, 0.77778], + 8840: [0.30274, 0.79383, 0, 0, 0.77778], + 8841: [0.30274, 0.79383, 0, 0, 0.77778], + 8842: [0.13597, 0.63597, 0, 0, 0.77778], + 8843: [0.13597, 0.63597, 0, 0, 0.77778], + 8847: [0.03517, 0.54986, 0, 0, 0.77778], + 8848: [0.03517, 0.54986, 0, 0, 0.77778], + 8858: [0.08198, 0.58198, 0, 0, 0.77778], + 8859: [0.08198, 0.58198, 0, 0, 0.77778], + 8861: [0.08198, 0.58198, 0, 0, 0.77778], + 8862: [0, 0.675, 0, 0, 0.77778], + 8863: [0, 0.675, 0, 0, 0.77778], + 8864: [0, 0.675, 0, 0, 0.77778], + 8865: [0, 0.675, 0, 0, 0.77778], + 8872: [0, 0.69224, 0, 0, 0.61111], + 8873: [0, 0.69224, 0, 0, 0.72222], + 8874: [0, 0.69224, 0, 0, 0.88889], + 8876: [0, 0.68889, 0, 0, 0.61111], + 8877: [0, 0.68889, 0, 0, 0.61111], + 8878: [0, 0.68889, 0, 0, 0.72222], + 8879: [0, 0.68889, 0, 0, 0.72222], + 8882: [0.03517, 0.54986, 0, 0, 0.77778], + 8883: [0.03517, 0.54986, 0, 0, 0.77778], + 8884: [0.13667, 0.63667, 0, 0, 0.77778], + 8885: [0.13667, 0.63667, 0, 0, 0.77778], + 8888: [0, 0.54986, 0, 0, 1.11111], + 8890: [0.19444, 0.43056, 0, 0, 0.55556], + 8891: [0.19444, 0.69224, 0, 0, 0.61111], + 8892: [0.19444, 0.69224, 0, 0, 0.61111], + 8901: [0, 0.54986, 0, 0, 0.27778], + 8903: [0.08167, 0.58167, 0, 0, 0.77778], + 8905: [0.08167, 0.58167, 0, 0, 0.77778], + 8906: [0.08167, 0.58167, 0, 0, 0.77778], + 8907: [0, 0.69224, 0, 0, 0.77778], + 8908: [0, 0.69224, 0, 0, 0.77778], + 8909: [-0.03598, 0.46402, 0, 0, 0.77778], + 8910: [0, 0.54986, 0, 0, 0.76042], + 8911: [0, 0.54986, 0, 0, 0.76042], + 8912: [0.03517, 0.54986, 0, 0, 0.77778], + 8913: [0.03517, 0.54986, 0, 0, 0.77778], + 8914: [0, 0.54986, 0, 0, 0.66667], + 8915: [0, 0.54986, 0, 0, 0.66667], + 8916: [0, 0.69224, 0, 0, 0.66667], + 8918: [0.0391, 0.5391, 0, 0, 0.77778], + 8919: [0.0391, 0.5391, 0, 0, 0.77778], + 8920: [0.03517, 0.54986, 0, 0, 1.33334], + 8921: [0.03517, 0.54986, 0, 0, 1.33334], + 8922: [0.38569, 0.88569, 0, 0, 0.77778], + 8923: [0.38569, 0.88569, 0, 0, 0.77778], + 8926: [0.13667, 0.63667, 0, 0, 0.77778], + 8927: [0.13667, 0.63667, 0, 0, 0.77778], + 8928: [0.30274, 0.79383, 0, 0, 0.77778], + 8929: [0.30274, 0.79383, 0, 0, 0.77778], + 8934: [0.23222, 0.74111, 0, 0, 0.77778], + 8935: [0.23222, 0.74111, 0, 0, 0.77778], + 8936: [0.23222, 0.74111, 0, 0, 0.77778], + 8937: [0.23222, 0.74111, 0, 0, 0.77778], + 8938: [0.20576, 0.70576, 0, 0, 0.77778], + 8939: [0.20576, 0.70576, 0, 0, 0.77778], + 8940: [0.30274, 0.79383, 0, 0, 0.77778], + 8941: [0.30274, 0.79383, 0, 0, 0.77778], + 8994: [0.19444, 0.69224, 0, 0, 0.77778], + 8995: [0.19444, 0.69224, 0, 0, 0.77778], + 9416: [0.15559, 0.69224, 0, 0, 0.90222], + 9484: [0, 0.69224, 0, 0, 0.5], + 9488: [0, 0.69224, 0, 0, 0.5], + 9492: [0, 0.37788, 0, 0, 0.5], + 9496: [0, 0.37788, 0, 0, 0.5], + 9585: [0.19444, 0.68889, 0, 0, 0.88889], + 9586: [0.19444, 0.74111, 0, 0, 0.88889], + 9632: [0, 0.675, 0, 0, 0.77778], + 9633: [0, 0.675, 0, 0, 0.77778], + 9650: [0, 0.54986, 0, 0, 0.72222], + 9651: [0, 0.54986, 0, 0, 0.72222], + 9654: [0.03517, 0.54986, 0, 0, 0.77778], + 9660: [0, 0.54986, 0, 0, 0.72222], + 9661: [0, 0.54986, 0, 0, 0.72222], + 9664: [0.03517, 0.54986, 0, 0, 0.77778], + 9674: [0.11111, 0.69224, 0, 0, 0.66667], + 9733: [0.19444, 0.69224, 0, 0, 0.94445], + 10003: [0, 0.69224, 0, 0, 0.83334], + 10016: [0, 0.69224, 0, 0, 0.83334], + 10731: [0.11111, 0.69224, 0, 0, 0.66667], + 10846: [0.19444, 0.75583, 0, 0, 0.61111], + 10877: [0.13667, 0.63667, 0, 0, 0.77778], + 10878: [0.13667, 0.63667, 0, 0, 0.77778], + 10885: [0.25583, 0.75583, 0, 0, 0.77778], + 10886: [0.25583, 0.75583, 0, 0, 0.77778], + 10887: [0.13597, 0.63597, 0, 0, 0.77778], + 10888: [0.13597, 0.63597, 0, 0, 0.77778], + 10889: [0.26167, 0.75726, 0, 0, 0.77778], + 10890: [0.26167, 0.75726, 0, 0, 0.77778], + 10891: [0.48256, 0.98256, 0, 0, 0.77778], + 10892: [0.48256, 0.98256, 0, 0, 0.77778], + 10901: [0.13667, 0.63667, 0, 0, 0.77778], + 10902: [0.13667, 0.63667, 0, 0, 0.77778], + 10933: [0.25142, 0.75726, 0, 0, 0.77778], + 10934: [0.25142, 0.75726, 0, 0, 0.77778], + 10935: [0.26167, 0.75726, 0, 0, 0.77778], + 10936: [0.26167, 0.75726, 0, 0, 0.77778], + 10937: [0.26167, 0.75726, 0, 0, 0.77778], + 10938: [0.26167, 0.75726, 0, 0, 0.77778], + 10949: [0.25583, 0.75583, 0, 0, 0.77778], + 10950: [0.25583, 0.75583, 0, 0, 0.77778], + 10955: [0.28481, 0.79383, 0, 0, 0.77778], + 10956: [0.28481, 0.79383, 0, 0, 0.77778], + 57350: [0.08167, 0.58167, 0, 0, 0.22222], + 57351: [0.08167, 0.58167, 0, 0, 0.38889], + 57352: [0.08167, 0.58167, 0, 0, 0.77778], + 57353: [0, 0.43056, 0.04028, 0, 0.66667], + 57356: [0.25142, 0.75726, 0, 0, 0.77778], + 57357: [0.25142, 0.75726, 0, 0, 0.77778], + 57358: [0.41951, 0.91951, 0, 0, 0.77778], + 57359: [0.30274, 0.79383, 0, 0, 0.77778], + 57360: [0.30274, 0.79383, 0, 0, 0.77778], + 57361: [0.41951, 0.91951, 0, 0, 0.77778], + 57366: [0.25142, 0.75726, 0, 0, 0.77778], + 57367: [0.25142, 0.75726, 0, 0, 0.77778], + 57368: [0.25142, 0.75726, 0, 0, 0.77778], + 57369: [0.25142, 0.75726, 0, 0, 0.77778], + 57370: [0.13597, 0.63597, 0, 0, 0.77778], + 57371: [0.13597, 0.63597, 0, 0, 0.77778], + }, + "Caligraphic-Regular": { + 32: [0, 0, 0, 0, 0.25], + 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, 0.00965, 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: [0, 0, 0, 0, 0.25], + }, + "Fraktur-Regular": { + 32: [0, 0, 0, 0, 0.25], + 33: [0, 0.69141, 0, 0, 0.29574], + 34: [0, 0.69141, 0, 0, 0.21471], + 38: [0, 0.69141, 0, 0, 0.73786], + 39: [0, 0.69141, 0, 0, 0.21201], + 40: [0.24982, 0.74947, 0, 0, 0.38865], + 41: [0.24982, 0.74947, 0, 0, 0.38865], + 42: [0, 0.62119, 0, 0, 0.27764], + 43: [0.08319, 0.58283, 0, 0, 0.75623], + 44: [0, 0.10803, 0, 0, 0.27764], + 45: [0.08319, 0.58283, 0, 0, 0.75623], + 46: [0, 0.10803, 0, 0, 0.27764], + 47: [0.24982, 0.74947, 0, 0, 0.50181], + 48: [0, 0.47534, 0, 0, 0.50181], + 49: [0, 0.47534, 0, 0, 0.50181], + 50: [0, 0.47534, 0, 0, 0.50181], + 51: [0.18906, 0.47534, 0, 0, 0.50181], + 52: [0.18906, 0.47534, 0, 0, 0.50181], + 53: [0.18906, 0.47534, 0, 0, 0.50181], + 54: [0, 0.69141, 0, 0, 0.50181], + 55: [0.18906, 0.47534, 0, 0, 0.50181], + 56: [0, 0.69141, 0, 0, 0.50181], + 57: [0.18906, 0.47534, 0, 0, 0.50181], + 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: [0.24982, 0.74947, 0, 0, 0.27764], + 93: [0.24982, 0.74947, 0, 0, 0.27764], + 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: [0, 0, 0, 0, 0.25], + 8216: [0, 0.69141, 0, 0, 0.21471], + 8217: [0, 0.69141, 0, 0, 0.21471], + 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: [0, 0, 0, 0, 0.25], + 33: [0, 0.69444, 0, 0, 0.35], + 34: [0, 0.69444, 0, 0, 0.60278], + 35: [0.19444, 0.69444, 0, 0, 0.95833], + 36: [0.05556, 0.75, 0, 0, 0.575], + 37: [0.05556, 0.75, 0, 0, 0.95833], + 38: [0, 0.69444, 0, 0, 0.89444], + 39: [0, 0.69444, 0, 0, 0.31944], + 40: [0.25, 0.75, 0, 0, 0.44722], + 41: [0.25, 0.75, 0, 0, 0.44722], + 42: [0, 0.75, 0, 0, 0.575], + 43: [0.13333, 0.63333, 0, 0, 0.89444], + 44: [0.19444, 0.15556, 0, 0, 0.31944], + 45: [0, 0.44444, 0, 0, 0.38333], + 46: [0, 0.15556, 0, 0, 0.31944], + 47: [0.25, 0.75, 0, 0, 0.575], + 48: [0, 0.64444, 0, 0, 0.575], + 49: [0, 0.64444, 0, 0, 0.575], + 50: [0, 0.64444, 0, 0, 0.575], + 51: [0, 0.64444, 0, 0, 0.575], + 52: [0, 0.64444, 0, 0, 0.575], + 53: [0, 0.64444, 0, 0, 0.575], + 54: [0, 0.64444, 0, 0, 0.575], + 55: [0, 0.64444, 0, 0, 0.575], + 56: [0, 0.64444, 0, 0, 0.575], + 57: [0, 0.64444, 0, 0, 0.575], + 58: [0, 0.44444, 0, 0, 0.31944], + 59: [0.19444, 0.44444, 0, 0, 0.31944], + 60: [0.08556, 0.58556, 0, 0, 0.89444], + 61: [-0.10889, 0.39111, 0, 0, 0.89444], + 62: [0.08556, 0.58556, 0, 0, 0.89444], + 63: [0, 0.69444, 0, 0, 0.54305], + 64: [0, 0.69444, 0, 0, 0.89444], + 65: [0, 0.68611, 0, 0, 0.86944], + 66: [0, 0.68611, 0, 0, 0.81805], + 67: [0, 0.68611, 0, 0, 0.83055], + 68: [0, 0.68611, 0, 0, 0.88194], + 69: [0, 0.68611, 0, 0, 0.75555], + 70: [0, 0.68611, 0, 0, 0.72361], + 71: [0, 0.68611, 0, 0, 0.90416], + 72: [0, 0.68611, 0, 0, 0.9], + 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: [0, 0.68611, 0, 0, 0.69166], + 77: [0, 0.68611, 0, 0, 1.09166], + 78: [0, 0.68611, 0, 0, 0.9], + 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: [0, 0.68611, 0, 0, 0.86944], + 89: [0, 0.68611, 0.02875, 0, 0.86944], + 90: [0, 0.68611, 0, 0, 0.70277], + 91: [0.25, 0.75, 0, 0, 0.31944], + 92: [0.25, 0.75, 0, 0, 0.575], + 93: [0.25, 0.75, 0, 0, 0.31944], + 94: [0, 0.69444, 0, 0, 0.575], + 95: [0.31, 0.13444, 0.03194, 0, 0.575], + 97: [0, 0.44444, 0, 0, 0.55902], + 98: [0, 0.69444, 0, 0, 0.63889], + 99: [0, 0.44444, 0, 0, 0.51111], + 100: [0, 0.69444, 0, 0, 0.63889], + 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: [0, 0.69444, 0, 0, 0.63889], + 105: [0, 0.69444, 0, 0, 0.31944], + 106: [0.19444, 0.69444, 0, 0, 0.35139], + 107: [0, 0.69444, 0, 0, 0.60694], + 108: [0, 0.69444, 0, 0, 0.31944], + 109: [0, 0.44444, 0, 0, 0.95833], + 110: [0, 0.44444, 0, 0, 0.63889], + 111: [0, 0.44444, 0, 0, 0.575], + 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: [0, 0.44444, 0, 0, 0.63889], + 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: [0, 0.44444, 0, 0, 0.51111], + 123: [0.25, 0.75, 0, 0, 0.575], + 124: [0.25, 0.75, 0, 0, 0.31944], + 125: [0.25, 0.75, 0, 0, 0.575], + 126: [0.35, 0.34444, 0, 0, 0.575], + 160: [0, 0, 0, 0, 0.25], + 163: [0, 0.69444, 0, 0, 0.86853], + 168: [0, 0.69444, 0, 0, 0.575], + 172: [0, 0.44444, 0, 0, 0.76666], + 176: [0, 0.69444, 0, 0, 0.86944], + 177: [0.13333, 0.63333, 0, 0, 0.89444], + 184: [0.17014, 0, 0, 0, 0.51111], + 198: [0, 0.68611, 0, 0, 1.04166], + 215: [0.13333, 0.63333, 0, 0, 0.89444], + 216: [0.04861, 0.73472, 0, 0, 0.89444], + 223: [0, 0.69444, 0, 0, 0.59722], + 230: [0, 0.44444, 0, 0, 0.83055], + 247: [0.13333, 0.63333, 0, 0, 0.89444], + 248: [0.09722, 0.54167, 0, 0, 0.575], + 305: [0, 0.44444, 0, 0, 0.31944], + 338: [0, 0.68611, 0, 0, 1.16944], + 339: [0, 0.44444, 0, 0, 0.89444], + 567: [0.19444, 0.44444, 0, 0, 0.35139], + 710: [0, 0.69444, 0, 0, 0.575], + 711: [0, 0.63194, 0, 0, 0.575], + 713: [0, 0.59611, 0, 0, 0.575], + 714: [0, 0.69444, 0, 0, 0.575], + 715: [0, 0.69444, 0, 0, 0.575], + 728: [0, 0.69444, 0, 0, 0.575], + 729: [0, 0.69444, 0, 0, 0.31944], + 730: [0, 0.69444, 0, 0, 0.86944], + 732: [0, 0.69444, 0, 0, 0.575], + 733: [0, 0.69444, 0, 0, 0.575], + 915: [0, 0.68611, 0, 0, 0.69166], + 916: [0, 0.68611, 0, 0, 0.95833], + 920: [0, 0.68611, 0, 0, 0.89444], + 923: [0, 0.68611, 0, 0, 0.80555], + 926: [0, 0.68611, 0, 0, 0.76666], + 928: [0, 0.68611, 0, 0, 0.9], + 931: [0, 0.68611, 0, 0, 0.83055], + 933: [0, 0.68611, 0, 0, 0.89444], + 934: [0, 0.68611, 0, 0, 0.83055], + 936: [0, 0.68611, 0, 0, 0.89444], + 937: [0, 0.68611, 0, 0, 0.83055], + 8211: [0, 0.44444, 0.03194, 0, 0.575], + 8212: [0, 0.44444, 0.03194, 0, 1.14999], + 8216: [0, 0.69444, 0, 0, 0.31944], + 8217: [0, 0.69444, 0, 0, 0.31944], + 8220: [0, 0.69444, 0, 0, 0.60278], + 8221: [0, 0.69444, 0, 0, 0.60278], + 8224: [0.19444, 0.69444, 0, 0, 0.51111], + 8225: [0.19444, 0.69444, 0, 0, 0.51111], + 8242: [0, 0.55556, 0, 0, 0.34444], + 8407: [0, 0.72444, 0.15486, 0, 0.575], + 8463: [0, 0.69444, 0, 0, 0.66759], + 8465: [0, 0.69444, 0, 0, 0.83055], + 8467: [0, 0.69444, 0, 0, 0.47361], + 8472: [0.19444, 0.44444, 0, 0, 0.74027], + 8476: [0, 0.69444, 0, 0, 0.83055], + 8501: [0, 0.69444, 0, 0, 0.70277], + 8592: [-0.10889, 0.39111, 0, 0, 1.14999], + 8593: [0.19444, 0.69444, 0, 0, 0.575], + 8594: [-0.10889, 0.39111, 0, 0, 1.14999], + 8595: [0.19444, 0.69444, 0, 0, 0.575], + 8596: [-0.10889, 0.39111, 0, 0, 1.14999], + 8597: [0.25, 0.75, 0, 0, 0.575], + 8598: [0.19444, 0.69444, 0, 0, 1.14999], + 8599: [0.19444, 0.69444, 0, 0, 1.14999], + 8600: [0.19444, 0.69444, 0, 0, 1.14999], + 8601: [0.19444, 0.69444, 0, 0, 1.14999], + 8636: [-0.10889, 0.39111, 0, 0, 1.14999], + 8637: [-0.10889, 0.39111, 0, 0, 1.14999], + 8640: [-0.10889, 0.39111, 0, 0, 1.14999], + 8641: [-0.10889, 0.39111, 0, 0, 1.14999], + 8656: [-0.10889, 0.39111, 0, 0, 1.14999], + 8657: [0.19444, 0.69444, 0, 0, 0.70277], + 8658: [-0.10889, 0.39111, 0, 0, 1.14999], + 8659: [0.19444, 0.69444, 0, 0, 0.70277], + 8660: [-0.10889, 0.39111, 0, 0, 1.14999], + 8661: [0.25, 0.75, 0, 0, 0.70277], + 8704: [0, 0.69444, 0, 0, 0.63889], + 8706: [0, 0.69444, 0.06389, 0, 0.62847], + 8707: [0, 0.69444, 0, 0, 0.63889], + 8709: [0.05556, 0.75, 0, 0, 0.575], + 8711: [0, 0.68611, 0, 0, 0.95833], + 8712: [0.08556, 0.58556, 0, 0, 0.76666], + 8715: [0.08556, 0.58556, 0, 0, 0.76666], + 8722: [0.13333, 0.63333, 0, 0, 0.89444], + 8723: [0.13333, 0.63333, 0, 0, 0.89444], + 8725: [0.25, 0.75, 0, 0, 0.575], + 8726: [0.25, 0.75, 0, 0, 0.575], + 8727: [-0.02778, 0.47222, 0, 0, 0.575], + 8728: [-0.02639, 0.47361, 0, 0, 0.575], + 8729: [-0.02639, 0.47361, 0, 0, 0.575], + 8730: [0.18, 0.82, 0, 0, 0.95833], + 8733: [0, 0.44444, 0, 0, 0.89444], + 8734: [0, 0.44444, 0, 0, 1.14999], + 8736: [0, 0.69224, 0, 0, 0.72222], + 8739: [0.25, 0.75, 0, 0, 0.31944], + 8741: [0.25, 0.75, 0, 0, 0.575], + 8743: [0, 0.55556, 0, 0, 0.76666], + 8744: [0, 0.55556, 0, 0, 0.76666], + 8745: [0, 0.55556, 0, 0, 0.76666], + 8746: [0, 0.55556, 0, 0, 0.76666], + 8747: [0.19444, 0.69444, 0.12778, 0, 0.56875], + 8764: [-0.10889, 0.39111, 0, 0, 0.89444], + 8768: [0.19444, 0.69444, 0, 0, 0.31944], + 8771: [0.00222, 0.50222, 0, 0, 0.89444], + 8773: [0.027, 0.638, 0, 0, 0.894], + 8776: [0.02444, 0.52444, 0, 0, 0.89444], + 8781: [0.00222, 0.50222, 0, 0, 0.89444], + 8801: [0.00222, 0.50222, 0, 0, 0.89444], + 8804: [0.19667, 0.69667, 0, 0, 0.89444], + 8805: [0.19667, 0.69667, 0, 0, 0.89444], + 8810: [0.08556, 0.58556, 0, 0, 1.14999], + 8811: [0.08556, 0.58556, 0, 0, 1.14999], + 8826: [0.08556, 0.58556, 0, 0, 0.89444], + 8827: [0.08556, 0.58556, 0, 0, 0.89444], + 8834: [0.08556, 0.58556, 0, 0, 0.89444], + 8835: [0.08556, 0.58556, 0, 0, 0.89444], + 8838: [0.19667, 0.69667, 0, 0, 0.89444], + 8839: [0.19667, 0.69667, 0, 0, 0.89444], + 8846: [0, 0.55556, 0, 0, 0.76666], + 8849: [0.19667, 0.69667, 0, 0, 0.89444], + 8850: [0.19667, 0.69667, 0, 0, 0.89444], + 8851: [0, 0.55556, 0, 0, 0.76666], + 8852: [0, 0.55556, 0, 0, 0.76666], + 8853: [0.13333, 0.63333, 0, 0, 0.89444], + 8854: [0.13333, 0.63333, 0, 0, 0.89444], + 8855: [0.13333, 0.63333, 0, 0, 0.89444], + 8856: [0.13333, 0.63333, 0, 0, 0.89444], + 8857: [0.13333, 0.63333, 0, 0, 0.89444], + 8866: [0, 0.69444, 0, 0, 0.70277], + 8867: [0, 0.69444, 0, 0, 0.70277], + 8868: [0, 0.69444, 0, 0, 0.89444], + 8869: [0, 0.69444, 0, 0, 0.89444], + 8900: [-0.02639, 0.47361, 0, 0, 0.575], + 8901: [-0.02639, 0.47361, 0, 0, 0.31944], + 8902: [-0.02778, 0.47222, 0, 0, 0.575], + 8968: [0.25, 0.75, 0, 0, 0.51111], + 8969: [0.25, 0.75, 0, 0, 0.51111], + 8970: [0.25, 0.75, 0, 0, 0.51111], + 8971: [0.25, 0.75, 0, 0, 0.51111], + 8994: [-0.13889, 0.36111, 0, 0, 1.14999], + 8995: [-0.13889, 0.36111, 0, 0, 1.14999], + 9651: [0.19444, 0.69444, 0, 0, 1.02222], + 9657: [-0.02778, 0.47222, 0, 0, 0.575], + 9661: [0.19444, 0.69444, 0, 0, 1.02222], + 9667: [-0.02778, 0.47222, 0, 0, 0.575], + 9711: [0.19444, 0.69444, 0, 0, 1.14999], + 9824: [0.12963, 0.69444, 0, 0, 0.89444], + 9825: [0.12963, 0.69444, 0, 0, 0.89444], + 9826: [0.12963, 0.69444, 0, 0, 0.89444], + 9827: [0.12963, 0.69444, 0, 0, 0.89444], + 9837: [0, 0.75, 0, 0, 0.44722], + 9838: [0.19444, 0.69444, 0, 0, 0.44722], + 9839: [0.19444, 0.69444, 0, 0, 0.44722], + 10216: [0.25, 0.75, 0, 0, 0.44722], + 10217: [0.25, 0.75, 0, 0, 0.44722], + 10815: [0, 0.68611, 0, 0, 0.9], + 10927: [0.19667, 0.69667, 0, 0, 0.89444], + 10928: [0.19667, 0.69667, 0, 0, 0.89444], + 57376: [0.19444, 0.69444, 0, 0, 0], + }, + "Main-BoldItalic": { + 32: [0, 0, 0, 0, 0.25], + 33: [0, 0.69444, 0.11417, 0, 0.38611], + 34: [0, 0.69444, 0.07939, 0, 0.62055], + 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: [0, 0.69444, 0.12945, 0, 0.35555], + 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: [0, 0.64444, 0.13167, 0, 0.59111], + 49: [0, 0.64444, 0.13167, 0, 0.59111], + 50: [0, 0.64444, 0.13167, 0, 0.59111], + 51: [0, 0.64444, 0.13167, 0, 0.59111], + 52: [0.19444, 0.64444, 0.13167, 0, 0.59111], + 53: [0, 0.64444, 0.13167, 0, 0.59111], + 54: [0, 0.64444, 0.13167, 0, 0.59111], + 55: [0.19444, 0.64444, 0.13167, 0, 0.59111], + 56: [0, 0.64444, 0.13167, 0, 0.59111], + 57: [0, 0.64444, 0.13167, 0, 0.59111], + 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: [0, 0.69444, 0.11472, 0, 0.59111], + 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: [0, 0.68611, 0.17208, 0, 0.8961], + 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: [0, 0.68611, 0.17208, 0, 0.8961], + 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: [0, 0.69444, 0.06709, 0, 0.59111], + 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: [0.19444, 0.44444, 0.105, 0, 0.53222], + 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: [0.19444, 0.44444, 0.105, 0, 0.53222], + 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: [0, 0, 0, 0, 0.25], + 168: [0, 0.69444, 0.11473, 0, 0.59111], + 176: [0, 0.69444, 0, 0, 0.94888], + 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: [0, 0.44444, 0.085, 0, 0.82666], + 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: [0, 0.44444, 0.085, 0, 0.82666], + 567: [0.19444, 0.44444, 0.04611, 0, 0.385], + 710: [0, 0.69444, 0.06709, 0, 0.59111], + 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: [0, 0.69444, 0.12945, 0, 0.35555], + 730: [0, 0.69444, 0, 0, 0.94888], + 732: [0, 0.69444, 0.11472, 0, 0.59111], + 733: [0, 0.69444, 0.11472, 0, 0.59111], + 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: [0, 0.68611, 0.17208, 0, 0.8961], + 931: [0, 0.68611, 0.11431, 0, 0.82666], + 933: [0, 0.68611, 0.10778, 0, 0.88555], + 934: [0, 0.68611, 0.05632, 0, 0.82666], + 936: [0, 0.68611, 0.10778, 0, 0.88555], + 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: [0, 0.69444, 0.12945, 0, 0.35555], + 8217: [0, 0.69444, 0.12945, 0, 0.35555], + 8220: [0, 0.69444, 0.16772, 0, 0.62055], + 8221: [0, 0.69444, 0.07939, 0, 0.62055], + }, + "Main-Italic": { + 32: [0, 0, 0, 0, 0.25], + 33: [0, 0.69444, 0.12417, 0, 0.30667], + 34: [0, 0.69444, 0.06961, 0, 0.51444], + 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: [0, 0.69444, 0.12417, 0, 0.30667], + 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: [0, 0.64444, 0.13556, 0, 0.51111], + 49: [0, 0.64444, 0.13556, 0, 0.51111], + 50: [0, 0.64444, 0.13556, 0, 0.51111], + 51: [0, 0.64444, 0.13556, 0, 0.51111], + 52: [0.19444, 0.64444, 0.13556, 0, 0.51111], + 53: [0, 0.64444, 0.13556, 0, 0.51111], + 54: [0, 0.64444, 0.13556, 0, 0.51111], + 55: [0.19444, 0.64444, 0.13556, 0, 0.51111], + 56: [0, 0.64444, 0.13556, 0, 0.51111], + 57: [0, 0.64444, 0.13556, 0, 0.51111], + 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: [0, 0.69444, 0.1225, 0, 0.51111], + 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: [0, 0.68333, 0.16389, 0, 0.74333], + 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: [0, 0.68333, 0.16389, 0, 0.74333], + 79: [0, 0.68333, 0.09403, 0, 0.76666], + 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: [0, 0.68333, 0.16389, 0, 0.74333], + 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: [0, 0.69444, 0.06646, 0, 0.51111], + 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: [0.19444, 0.43056, 0.08847, 0, 0.46], + 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: [0.19444, 0.43056, 0.08847, 0, 0.46], + 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: [0, 0, 0, 0, 0.25], + 168: [0, 0.66786, 0.10474, 0, 0.51111], + 176: [0, 0.69444, 0, 0, 0.83129], + 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: [0, 0.43056, 0.07514, 0, 0.71555], + 248: [0.09722, 0.52778, 0.09194, 0, 0.51111], + 338: [0, 0.68333, 0.12028, 0, 0.98499], + 339: [0, 0.43056, 0.07514, 0, 0.71555], + 710: [0, 0.69444, 0.06646, 0, 0.51111], + 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: [0, 0.69444, 0, 0, 0.83129], + 732: [0, 0.66786, 0.11585, 0, 0.51111], + 733: [0, 0.69444, 0.1225, 0, 0.51111], + 915: [0, 0.68333, 0.13305, 0, 0.62722], + 916: [0, 0.68333, 0, 0, 0.81777], + 920: [0, 0.68333, 0.09403, 0, 0.76666], + 923: [0, 0.68333, 0, 0, 0.69222], + 926: [0, 0.68333, 0.15294, 0, 0.66444], + 928: [0, 0.68333, 0.16389, 0, 0.74333], + 931: [0, 0.68333, 0.12028, 0, 0.71555], + 933: [0, 0.68333, 0.11111, 0, 0.76666], + 934: [0, 0.68333, 0.05986, 0, 0.71555], + 936: [0, 0.68333, 0.11111, 0, 0.76666], + 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: [0, 0.69444, 0.12417, 0, 0.30667], + 8217: [0, 0.69444, 0.12417, 0, 0.30667], + 8220: [0, 0.69444, 0.1685, 0, 0.51444], + 8221: [0, 0.69444, 0.06961, 0, 0.51444], + 8463: [0, 0.68889, 0, 0, 0.54028], + }, + "Main-Regular": { + 32: [0, 0, 0, 0, 0.25], + 33: [0, 0.69444, 0, 0, 0.27778], + 34: [0, 0.69444, 0, 0, 0.5], + 35: [0.19444, 0.69444, 0, 0, 0.83334], + 36: [0.05556, 0.75, 0, 0, 0.5], + 37: [0.05556, 0.75, 0, 0, 0.83334], + 38: [0, 0.69444, 0, 0, 0.77778], + 39: [0, 0.69444, 0, 0, 0.27778], + 40: [0.25, 0.75, 0, 0, 0.38889], + 41: [0.25, 0.75, 0, 0, 0.38889], + 42: [0, 0.75, 0, 0, 0.5], + 43: [0.08333, 0.58333, 0, 0, 0.77778], + 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: [0.25, 0.75, 0, 0, 0.5], + 48: [0, 0.64444, 0, 0, 0.5], + 49: [0, 0.64444, 0, 0, 0.5], + 50: [0, 0.64444, 0, 0, 0.5], + 51: [0, 0.64444, 0, 0, 0.5], + 52: [0, 0.64444, 0, 0, 0.5], + 53: [0, 0.64444, 0, 0, 0.5], + 54: [0, 0.64444, 0, 0, 0.5], + 55: [0, 0.64444, 0, 0, 0.5], + 56: [0, 0.64444, 0, 0, 0.5], + 57: [0, 0.64444, 0, 0, 0.5], + 58: [0, 0.43056, 0, 0, 0.27778], + 59: [0.19444, 0.43056, 0, 0, 0.27778], + 60: [0.0391, 0.5391, 0, 0, 0.77778], + 61: [-0.13313, 0.36687, 0, 0, 0.77778], + 62: [0.0391, 0.5391, 0, 0, 0.77778], + 63: [0, 0.69444, 0, 0, 0.47222], + 64: [0, 0.69444, 0, 0, 0.77778], + 65: [0, 0.68333, 0, 0, 0.75], + 66: [0, 0.68333, 0, 0, 0.70834], + 67: [0, 0.68333, 0, 0, 0.72222], + 68: [0, 0.68333, 0, 0, 0.76389], + 69: [0, 0.68333, 0, 0, 0.68056], + 70: [0, 0.68333, 0, 0, 0.65278], + 71: [0, 0.68333, 0, 0, 0.78472], + 72: [0, 0.68333, 0, 0, 0.75], + 73: [0, 0.68333, 0, 0, 0.36111], + 74: [0, 0.68333, 0, 0, 0.51389], + 75: [0, 0.68333, 0, 0, 0.77778], + 76: [0, 0.68333, 0, 0, 0.625], + 77: [0, 0.68333, 0, 0, 0.91667], + 78: [0, 0.68333, 0, 0, 0.75], + 79: [0, 0.68333, 0, 0, 0.77778], + 80: [0, 0.68333, 0, 0, 0.68056], + 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: [0, 0.68333, 0, 0, 0.72222], + 85: [0, 0.68333, 0, 0, 0.75], + 86: [0, 0.68333, 0.01389, 0, 0.75], + 87: [0, 0.68333, 0.01389, 0, 1.02778], + 88: [0, 0.68333, 0, 0, 0.75], + 89: [0, 0.68333, 0.025, 0, 0.75], + 90: [0, 0.68333, 0, 0, 0.61111], + 91: [0.25, 0.75, 0, 0, 0.27778], + 92: [0.25, 0.75, 0, 0, 0.5], + 93: [0.25, 0.75, 0, 0, 0.27778], + 94: [0, 0.69444, 0, 0, 0.5], + 95: [0.31, 0.12056, 0.02778, 0, 0.5], + 97: [0, 0.43056, 0, 0, 0.5], + 98: [0, 0.69444, 0, 0, 0.55556], + 99: [0, 0.43056, 0, 0, 0.44445], + 100: [0, 0.69444, 0, 0, 0.55556], + 101: [0, 0.43056, 0, 0, 0.44445], + 102: [0, 0.69444, 0.07778, 0, 0.30556], + 103: [0.19444, 0.43056, 0.01389, 0, 0.5], + 104: [0, 0.69444, 0, 0, 0.55556], + 105: [0, 0.66786, 0, 0, 0.27778], + 106: [0.19444, 0.66786, 0, 0, 0.30556], + 107: [0, 0.69444, 0, 0, 0.52778], + 108: [0, 0.69444, 0, 0, 0.27778], + 109: [0, 0.43056, 0, 0, 0.83334], + 110: [0, 0.43056, 0, 0, 0.55556], + 111: [0, 0.43056, 0, 0, 0.5], + 112: [0.19444, 0.43056, 0, 0, 0.55556], + 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: [0, 0.43056, 0, 0, 0.55556], + 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: [0, 0.43056, 0, 0, 0.44445], + 123: [0.25, 0.75, 0, 0, 0.5], + 124: [0.25, 0.75, 0, 0, 0.27778], + 125: [0.25, 0.75, 0, 0, 0.5], + 126: [0.35, 0.31786, 0, 0, 0.5], + 160: [0, 0, 0, 0, 0.25], + 163: [0, 0.69444, 0, 0, 0.76909], + 167: [0.19444, 0.69444, 0, 0, 0.44445], + 168: [0, 0.66786, 0, 0, 0.5], + 172: [0, 0.43056, 0, 0, 0.66667], + 176: [0, 0.69444, 0, 0, 0.75], + 177: [0.08333, 0.58333, 0, 0, 0.77778], + 182: [0.19444, 0.69444, 0, 0, 0.61111], + 184: [0.17014, 0, 0, 0, 0.44445], + 198: [0, 0.68333, 0, 0, 0.90278], + 215: [0.08333, 0.58333, 0, 0, 0.77778], + 216: [0.04861, 0.73194, 0, 0, 0.77778], + 223: [0, 0.69444, 0, 0, 0.5], + 230: [0, 0.43056, 0, 0, 0.72222], + 247: [0.08333, 0.58333, 0, 0, 0.77778], + 248: [0.09722, 0.52778, 0, 0, 0.5], + 305: [0, 0.43056, 0, 0, 0.27778], + 338: [0, 0.68333, 0, 0, 1.01389], + 339: [0, 0.43056, 0, 0, 0.77778], + 567: [0.19444, 0.43056, 0, 0, 0.30556], + 710: [0, 0.69444, 0, 0, 0.5], + 711: [0, 0.62847, 0, 0, 0.5], + 713: [0, 0.56778, 0, 0, 0.5], + 714: [0, 0.69444, 0, 0, 0.5], + 715: [0, 0.69444, 0, 0, 0.5], + 728: [0, 0.69444, 0, 0, 0.5], + 729: [0, 0.66786, 0, 0, 0.27778], + 730: [0, 0.69444, 0, 0, 0.75], + 732: [0, 0.66786, 0, 0, 0.5], + 733: [0, 0.69444, 0, 0, 0.5], + 915: [0, 0.68333, 0, 0, 0.625], + 916: [0, 0.68333, 0, 0, 0.83334], + 920: [0, 0.68333, 0, 0, 0.77778], + 923: [0, 0.68333, 0, 0, 0.69445], + 926: [0, 0.68333, 0, 0, 0.66667], + 928: [0, 0.68333, 0, 0, 0.75], + 931: [0, 0.68333, 0, 0, 0.72222], + 933: [0, 0.68333, 0, 0, 0.77778], + 934: [0, 0.68333, 0, 0, 0.72222], + 936: [0, 0.68333, 0, 0, 0.77778], + 937: [0, 0.68333, 0, 0, 0.72222], + 8211: [0, 0.43056, 0.02778, 0, 0.5], + 8212: [0, 0.43056, 0.02778, 0, 1], + 8216: [0, 0.69444, 0, 0, 0.27778], + 8217: [0, 0.69444, 0, 0, 0.27778], + 8220: [0, 0.69444, 0, 0, 0.5], + 8221: [0, 0.69444, 0, 0, 0.5], + 8224: [0.19444, 0.69444, 0, 0, 0.44445], + 8225: [0.19444, 0.69444, 0, 0, 0.44445], + 8230: [0, 0.123, 0, 0, 1.172], + 8242: [0, 0.55556, 0, 0, 0.275], + 8407: [0, 0.71444, 0.15382, 0, 0.5], + 8463: [0, 0.68889, 0, 0, 0.54028], + 8465: [0, 0.69444, 0, 0, 0.72222], + 8467: [0, 0.69444, 0, 0.11111, 0.41667], + 8472: [0.19444, 0.43056, 0, 0.11111, 0.63646], + 8476: [0, 0.69444, 0, 0, 0.72222], + 8501: [0, 0.69444, 0, 0, 0.61111], + 8592: [-0.13313, 0.36687, 0, 0, 1], + 8593: [0.19444, 0.69444, 0, 0, 0.5], + 8594: [-0.13313, 0.36687, 0, 0, 1], + 8595: [0.19444, 0.69444, 0, 0, 0.5], + 8596: [-0.13313, 0.36687, 0, 0, 1], + 8597: [0.25, 0.75, 0, 0, 0.5], + 8598: [0.19444, 0.69444, 0, 0, 1], + 8599: [0.19444, 0.69444, 0, 0, 1], + 8600: [0.19444, 0.69444, 0, 0, 1], + 8601: [0.19444, 0.69444, 0, 0, 1], + 8614: [0.011, 0.511, 0, 0, 1], + 8617: [0.011, 0.511, 0, 0, 1.126], + 8618: [0.011, 0.511, 0, 0, 1.126], + 8636: [-0.13313, 0.36687, 0, 0, 1], + 8637: [-0.13313, 0.36687, 0, 0, 1], + 8640: [-0.13313, 0.36687, 0, 0, 1], + 8641: [-0.13313, 0.36687, 0, 0, 1], + 8652: [0.011, 0.671, 0, 0, 1], + 8656: [-0.13313, 0.36687, 0, 0, 1], + 8657: [0.19444, 0.69444, 0, 0, 0.61111], + 8658: [-0.13313, 0.36687, 0, 0, 1], + 8659: [0.19444, 0.69444, 0, 0, 0.61111], + 8660: [-0.13313, 0.36687, 0, 0, 1], + 8661: [0.25, 0.75, 0, 0, 0.61111], + 8704: [0, 0.69444, 0, 0, 0.55556], + 8706: [0, 0.69444, 0.05556, 0.08334, 0.5309], + 8707: [0, 0.69444, 0, 0, 0.55556], + 8709: [0.05556, 0.75, 0, 0, 0.5], + 8711: [0, 0.68333, 0, 0, 0.83334], + 8712: [0.0391, 0.5391, 0, 0, 0.66667], + 8715: [0.0391, 0.5391, 0, 0, 0.66667], + 8722: [0.08333, 0.58333, 0, 0, 0.77778], + 8723: [0.08333, 0.58333, 0, 0, 0.77778], + 8725: [0.25, 0.75, 0, 0, 0.5], + 8726: [0.25, 0.75, 0, 0, 0.5], + 8727: [-0.03472, 0.46528, 0, 0, 0.5], + 8728: [-0.05555, 0.44445, 0, 0, 0.5], + 8729: [-0.05555, 0.44445, 0, 0, 0.5], + 8730: [0.2, 0.8, 0, 0, 0.83334], + 8733: [0, 0.43056, 0, 0, 0.77778], + 8734: [0, 0.43056, 0, 0, 1], + 8736: [0, 0.69224, 0, 0, 0.72222], + 8739: [0.25, 0.75, 0, 0, 0.27778], + 8741: [0.25, 0.75, 0, 0, 0.5], + 8743: [0, 0.55556, 0, 0, 0.66667], + 8744: [0, 0.55556, 0, 0, 0.66667], + 8745: [0, 0.55556, 0, 0, 0.66667], + 8746: [0, 0.55556, 0, 0, 0.66667], + 8747: [0.19444, 0.69444, 0.11111, 0, 0.41667], + 8764: [-0.13313, 0.36687, 0, 0, 0.77778], + 8768: [0.19444, 0.69444, 0, 0, 0.27778], + 8771: [-0.03625, 0.46375, 0, 0, 0.77778], + 8773: [-0.022, 0.589, 0, 0, 0.778], + 8776: [-0.01688, 0.48312, 0, 0, 0.77778], + 8781: [-0.03625, 0.46375, 0, 0, 0.77778], + 8784: [-0.133, 0.673, 0, 0, 0.778], + 8801: [-0.03625, 0.46375, 0, 0, 0.77778], + 8804: [0.13597, 0.63597, 0, 0, 0.77778], + 8805: [0.13597, 0.63597, 0, 0, 0.77778], + 8810: [0.0391, 0.5391, 0, 0, 1], + 8811: [0.0391, 0.5391, 0, 0, 1], + 8826: [0.0391, 0.5391, 0, 0, 0.77778], + 8827: [0.0391, 0.5391, 0, 0, 0.77778], + 8834: [0.0391, 0.5391, 0, 0, 0.77778], + 8835: [0.0391, 0.5391, 0, 0, 0.77778], + 8838: [0.13597, 0.63597, 0, 0, 0.77778], + 8839: [0.13597, 0.63597, 0, 0, 0.77778], + 8846: [0, 0.55556, 0, 0, 0.66667], + 8849: [0.13597, 0.63597, 0, 0, 0.77778], + 8850: [0.13597, 0.63597, 0, 0, 0.77778], + 8851: [0, 0.55556, 0, 0, 0.66667], + 8852: [0, 0.55556, 0, 0, 0.66667], + 8853: [0.08333, 0.58333, 0, 0, 0.77778], + 8854: [0.08333, 0.58333, 0, 0, 0.77778], + 8855: [0.08333, 0.58333, 0, 0, 0.77778], + 8856: [0.08333, 0.58333, 0, 0, 0.77778], + 8857: [0.08333, 0.58333, 0, 0, 0.77778], + 8866: [0, 0.69444, 0, 0, 0.61111], + 8867: [0, 0.69444, 0, 0, 0.61111], + 8868: [0, 0.69444, 0, 0, 0.77778], + 8869: [0, 0.69444, 0, 0, 0.77778], + 8872: [0.249, 0.75, 0, 0, 0.867], + 8900: [-0.05555, 0.44445, 0, 0, 0.5], + 8901: [-0.05555, 0.44445, 0, 0, 0.27778], + 8902: [-0.03472, 0.46528, 0, 0, 0.5], + 8904: [0.005, 0.505, 0, 0, 0.9], + 8942: [0.03, 0.903, 0, 0, 0.278], + 8943: [-0.19, 0.313, 0, 0, 1.172], + 8945: [-0.1, 0.823, 0, 0, 1.282], + 8968: [0.25, 0.75, 0, 0, 0.44445], + 8969: [0.25, 0.75, 0, 0, 0.44445], + 8970: [0.25, 0.75, 0, 0, 0.44445], + 8971: [0.25, 0.75, 0, 0, 0.44445], + 8994: [-0.14236, 0.35764, 0, 0, 1], + 8995: [-0.14236, 0.35764, 0, 0, 1], + 9136: [0.244, 0.744, 0, 0, 0.412], + 9137: [0.244, 0.745, 0, 0, 0.412], + 9651: [0.19444, 0.69444, 0, 0, 0.88889], + 9657: [-0.03472, 0.46528, 0, 0, 0.5], + 9661: [0.19444, 0.69444, 0, 0, 0.88889], + 9667: [-0.03472, 0.46528, 0, 0, 0.5], + 9711: [0.19444, 0.69444, 0, 0, 1], + 9824: [0.12963, 0.69444, 0, 0, 0.77778], + 9825: [0.12963, 0.69444, 0, 0, 0.77778], + 9826: [0.12963, 0.69444, 0, 0, 0.77778], + 9827: [0.12963, 0.69444, 0, 0, 0.77778], + 9837: [0, 0.75, 0, 0, 0.38889], + 9838: [0.19444, 0.69444, 0, 0, 0.38889], + 9839: [0.19444, 0.69444, 0, 0, 0.38889], + 10216: [0.25, 0.75, 0, 0, 0.38889], + 10217: [0.25, 0.75, 0, 0, 0.38889], + 10222: [0.244, 0.744, 0, 0, 0.412], + 10223: [0.244, 0.745, 0, 0, 0.412], + 10229: [0.011, 0.511, 0, 0, 1.609], + 10230: [0.011, 0.511, 0, 0, 1.638], + 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: [0.011, 0.511, 0, 0, 1.638], + 10815: [0, 0.68333, 0, 0, 0.75], + 10927: [0.13597, 0.63597, 0, 0, 0.77778], + 10928: [0.13597, 0.63597, 0, 0, 0.77778], + 57376: [0.19444, 0.69444, 0, 0, 0], + }, + "Math-BoldItalic": { + 32: [0, 0, 0, 0, 0.25], + 48: [0, 0.44444, 0, 0, 0.575], + 49: [0, 0.44444, 0, 0, 0.575], + 50: [0, 0.44444, 0, 0, 0.575], + 51: [0.19444, 0.44444, 0, 0, 0.575], + 52: [0.19444, 0.44444, 0, 0, 0.575], + 53: [0.19444, 0.44444, 0, 0, 0.575], + 54: [0, 0.64444, 0, 0, 0.575], + 55: [0.19444, 0.44444, 0, 0, 0.575], + 56: [0, 0.64444, 0, 0, 0.575], + 57: [0.19444, 0.44444, 0, 0, 0.575], + 65: [0, 0.68611, 0, 0, 0.86944], + 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: [0, 0.68611, 0.08229, 0, 0.98229], + 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: [0, 0.68611, 0, 0, 0.75555], + 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, 0.00421, 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: [0, 0.69444, 0, 0, 0.66759], + 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, 0.0088, 0, 0.34815], + 109: [0, 0.44444, 0, 0, 1.0324], + 110: [0, 0.44444, 0, 0, 0.71296], + 111: [0, 0.44444, 0, 0, 0.58472], + 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: [0, 0, 0, 0, 0.25], + 915: [0, 0.68611, 0.15972, 0, 0.65694], + 916: [0, 0.68611, 0, 0, 0.95833], + 920: [0, 0.68611, 0.03194, 0, 0.86722], + 923: [0, 0.68611, 0, 0, 0.80555], + 926: [0, 0.68611, 0.07458, 0, 0.84125], + 928: [0, 0.68611, 0.08229, 0, 0.98229], + 931: [0, 0.68611, 0.05451, 0, 0.88507], + 933: [0, 0.68611, 0.15972, 0, 0.67083], + 934: [0, 0.68611, 0, 0, 0.76666], + 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: [0, 0.44444, 0, 0, 0.58472], + 960: [0, 0.44444, 0.03704, 0, 0.68241], + 961: [0.19444, 0.44444, 0, 0, 0.6118], + 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: [0.19444, 0.44444, 0, 0, 0.6118], + 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: [0, 0, 0, 0, 0.25], + 48: [0, 0.43056, 0, 0, 0.5], + 49: [0, 0.43056, 0, 0, 0.5], + 50: [0, 0.43056, 0, 0, 0.5], + 51: [0.19444, 0.43056, 0, 0, 0.5], + 52: [0.19444, 0.43056, 0, 0, 0.5], + 53: [0.19444, 0.43056, 0, 0, 0.5], + 54: [0, 0.64444, 0, 0, 0.5], + 55: [0.19444, 0.43056, 0, 0, 0.5], + 56: [0, 0.64444, 0, 0, 0.5], + 57: [0.19444, 0.43056, 0, 0, 0.5], + 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: [0, 0.68333, 0.08125, 0.05556, 0.83125], + 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: [0, 0.68333, 0.02778, 0.08334, 0.76278], + 80: [0, 0.68333, 0.13889, 0.08334, 0.64201], + 81: [0.19444, 0.68333, 0, 0.08334, 0.79056], + 82: [0, 0.68333, 0.00773, 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: [0, 0.43056, 0, 0.05556, 0.48472], + 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: [0, 0, 0, 0, 0.25], + 915: [0, 0.68333, 0.13889, 0.08334, 0.61528], + 916: [0, 0.68333, 0, 0.16667, 0.83334], + 920: [0, 0.68333, 0.02778, 0.08334, 0.76278], + 923: [0, 0.68333, 0, 0.16667, 0.69445], + 926: [0, 0.68333, 0.07569, 0.08334, 0.74236], + 928: [0, 0.68333, 0.08125, 0.05556, 0.83125], + 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, 0.0037, 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: [0, 0.43056, 0, 0.05556, 0.48472], + 960: [0, 0.43056, 0.03588, 0, 0.57003], + 961: [0.19444, 0.43056, 0, 0.08334, 0.51702], + 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: [0.19444, 0.43056, 0, 0.08334, 0.51702], + 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: [0, 0, 0, 0, 0.25], + 33: [0, 0.69444, 0, 0, 0.36667], + 34: [0, 0.69444, 0, 0, 0.55834], + 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: [0, 0.69444, 0, 0, 0.30556], + 40: [0.25, 0.75, 0, 0, 0.42778], + 41: [0.25, 0.75, 0, 0, 0.42778], + 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: [0, 0.69444, 0, 0, 0.55], + 49: [0, 0.69444, 0, 0, 0.55], + 50: [0, 0.69444, 0, 0, 0.55], + 51: [0, 0.69444, 0, 0, 0.55], + 52: [0, 0.69444, 0, 0, 0.55], + 53: [0, 0.69444, 0, 0, 0.55], + 54: [0, 0.69444, 0, 0, 0.55], + 55: [0, 0.69444, 0, 0, 0.55], + 56: [0, 0.69444, 0, 0, 0.55], + 57: [0, 0.69444, 0, 0, 0.55], + 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: [0, 0.69444, 0, 0, 0.51945], + 64: [0, 0.69444, 0, 0, 0.73334], + 65: [0, 0.69444, 0, 0, 0.73334], + 66: [0, 0.69444, 0, 0, 0.73334], + 67: [0, 0.69444, 0, 0, 0.70278], + 68: [0, 0.69444, 0, 0, 0.79445], + 69: [0, 0.69444, 0, 0, 0.64167], + 70: [0, 0.69444, 0, 0, 0.61111], + 71: [0, 0.69444, 0, 0, 0.73334], + 72: [0, 0.69444, 0, 0, 0.79445], + 73: [0, 0.69444, 0, 0, 0.33056], + 74: [0, 0.69444, 0, 0, 0.51945], + 75: [0, 0.69444, 0, 0, 0.76389], + 76: [0, 0.69444, 0, 0, 0.58056], + 77: [0, 0.69444, 0, 0, 0.97778], + 78: [0, 0.69444, 0, 0, 0.79445], + 79: [0, 0.69444, 0, 0, 0.79445], + 80: [0, 0.69444, 0, 0, 0.70278], + 81: [0.10556, 0.69444, 0, 0, 0.79445], + 82: [0, 0.69444, 0, 0, 0.70278], + 83: [0, 0.69444, 0, 0, 0.61111], + 84: [0, 0.69444, 0, 0, 0.73334], + 85: [0, 0.69444, 0, 0, 0.76389], + 86: [0, 0.69444, 0.01528, 0, 0.73334], + 87: [0, 0.69444, 0.01528, 0, 1.03889], + 88: [0, 0.69444, 0, 0, 0.73334], + 89: [0, 0.69444, 0.0275, 0, 0.73334], + 90: [0, 0.69444, 0, 0, 0.67223], + 91: [0.25, 0.75, 0, 0, 0.34306], + 93: [0.25, 0.75, 0, 0, 0.34306], + 94: [0, 0.69444, 0, 0, 0.55], + 95: [0.35, 0.10833, 0.03056, 0, 0.55], + 97: [0, 0.45833, 0, 0, 0.525], + 98: [0, 0.69444, 0, 0, 0.56111], + 99: [0, 0.45833, 0, 0, 0.48889], + 100: [0, 0.69444, 0, 0, 0.56111], + 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: [0, 0.69444, 0, 0, 0.56111], + 105: [0, 0.69444, 0, 0, 0.25556], + 106: [0.19444, 0.69444, 0, 0, 0.28611], + 107: [0, 0.69444, 0, 0, 0.53056], + 108: [0, 0.69444, 0, 0, 0.25556], + 109: [0, 0.45833, 0, 0, 0.86667], + 110: [0, 0.45833, 0, 0, 0.56111], + 111: [0, 0.45833, 0, 0, 0.55], + 112: [0.19444, 0.45833, 0, 0, 0.56111], + 113: [0.19444, 0.45833, 0, 0, 0.56111], + 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: [0, 0.45833, 0, 0, 0.56111], + 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: [0, 0, 0, 0, 0.25], + 168: [0, 0.69444, 0, 0, 0.55], + 176: [0, 0.69444, 0, 0, 0.73334], + 180: [0, 0.69444, 0, 0, 0.55], + 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: [0, 0.69444, 0, 0, 0.55], + 711: [0, 0.63542, 0, 0, 0.55], + 713: [0, 0.63778, 0, 0, 0.55], + 728: [0, 0.69444, 0, 0, 0.55], + 729: [0, 0.69444, 0, 0, 0.30556], + 730: [0, 0.69444, 0, 0, 0.73334], + 732: [0, 0.69444, 0, 0, 0.55], + 733: [0, 0.69444, 0, 0, 0.55], + 915: [0, 0.69444, 0, 0, 0.58056], + 916: [0, 0.69444, 0, 0, 0.91667], + 920: [0, 0.69444, 0, 0, 0.85556], + 923: [0, 0.69444, 0, 0, 0.67223], + 926: [0, 0.69444, 0, 0, 0.73334], + 928: [0, 0.69444, 0, 0, 0.79445], + 931: [0, 0.69444, 0, 0, 0.79445], + 933: [0, 0.69444, 0, 0, 0.85556], + 934: [0, 0.69444, 0, 0, 0.79445], + 936: [0, 0.69444, 0, 0, 0.85556], + 937: [0, 0.69444, 0, 0, 0.79445], + 8211: [0, 0.45833, 0.03056, 0, 0.55], + 8212: [0, 0.45833, 0.03056, 0, 1.10001], + 8216: [0, 0.69444, 0, 0, 0.30556], + 8217: [0, 0.69444, 0, 0, 0.30556], + 8220: [0, 0.69444, 0, 0, 0.55834], + 8221: [0, 0.69444, 0, 0, 0.55834], + }, + "SansSerif-Italic": { + 32: [0, 0, 0, 0, 0.25], + 33: [0, 0.69444, 0.05733, 0, 0.31945], + 34: [0, 0.69444, 0.00316, 0, 0.5], + 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: [0, 0.69444, 0.07816, 0, 0.27778], + 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: [0.125, 0.08333, 0, 0, 0.27778], + 45: [0, 0.44444, 0.01946, 0, 0.33333], + 46: [0, 0.08333, 0, 0, 0.27778], + 47: [0.25, 0.75, 0.13164, 0, 0.5], + 48: [0, 0.65556, 0.11156, 0, 0.5], + 49: [0, 0.65556, 0.11156, 0, 0.5], + 50: [0, 0.65556, 0.11156, 0, 0.5], + 51: [0, 0.65556, 0.11156, 0, 0.5], + 52: [0, 0.65556, 0.11156, 0, 0.5], + 53: [0, 0.65556, 0.11156, 0, 0.5], + 54: [0, 0.65556, 0.11156, 0, 0.5], + 55: [0, 0.65556, 0.11156, 0, 0.5], + 56: [0, 0.65556, 0.11156, 0, 0.5], + 57: [0, 0.65556, 0.11156, 0, 0.5], + 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: [0, 0.69444, 0, 0, 0.66667], + 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: [0, 0.69444, 0.08094, 0, 0.70834], + 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: [0, 0.69444, 0, 0, 0.54167], + 77: [0, 0.69444, 0.08094, 0, 0.875], + 78: [0, 0.69444, 0.08094, 0, 0.70834], + 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: [0, 0.69444, 0.0799, 0, 0.5], + 95: [0.35, 0.09444, 0.08616, 0, 0.5], + 97: [0, 0.44444, 0.00981, 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: [0, 0, 0, 0, 0.25], + 168: [0, 0.67937, 0.06385, 0, 0.5], + 176: [0, 0.69444, 0, 0, 0.73752], + 184: [0.17014, 0, 0, 0, 0.44445], + 305: [0, 0.44444, 0.04169, 0, 0.23889], + 567: [0.19444, 0.44444, 0.04169, 0, 0.26667], + 710: [0, 0.69444, 0.0799, 0, 0.5], + 711: [0, 0.63194, 0.08432, 0, 0.5], + 713: [0, 0.60889, 0.08776, 0, 0.5], + 714: [0, 0.69444, 0.09205, 0, 0.5], + 715: [0, 0.69444, 0, 0, 0.5], + 728: [0, 0.69444, 0.09483, 0, 0.5], + 729: [0, 0.67937, 0.07774, 0, 0.27778], + 730: [0, 0.69444, 0, 0, 0.73752], + 732: [0, 0.67659, 0.08826, 0, 0.5], + 733: [0, 0.69444, 0.09205, 0, 0.5], + 915: [0, 0.69444, 0.13372, 0, 0.54167], + 916: [0, 0.69444, 0, 0, 0.83334], + 920: [0, 0.69444, 0.07555, 0, 0.77778], + 923: [0, 0.69444, 0, 0, 0.61111], + 926: [0, 0.69444, 0.12816, 0, 0.66667], + 928: [0, 0.69444, 0.08094, 0, 0.70834], + 931: [0, 0.69444, 0.11983, 0, 0.72222], + 933: [0, 0.69444, 0.09031, 0, 0.77778], + 934: [0, 0.69444, 0.04603, 0, 0.72222], + 936: [0, 0.69444, 0.09031, 0, 0.77778], + 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: [0, 0.69444, 0.07816, 0, 0.27778], + 8217: [0, 0.69444, 0.07816, 0, 0.27778], + 8220: [0, 0.69444, 0.14205, 0, 0.5], + 8221: [0, 0.69444, 0.00316, 0, 0.5], + }, + "SansSerif-Regular": { + 32: [0, 0, 0, 0, 0.25], + 33: [0, 0.69444, 0, 0, 0.31945], + 34: [0, 0.69444, 0, 0, 0.5], + 35: [0.19444, 0.69444, 0, 0, 0.83334], + 36: [0.05556, 0.75, 0, 0, 0.5], + 37: [0.05556, 0.75, 0, 0, 0.83334], + 38: [0, 0.69444, 0, 0, 0.75834], + 39: [0, 0.69444, 0, 0, 0.27778], + 40: [0.25, 0.75, 0, 0, 0.38889], + 41: [0.25, 0.75, 0, 0, 0.38889], + 42: [0, 0.75, 0, 0, 0.5], + 43: [0.08333, 0.58333, 0, 0, 0.77778], + 44: [0.125, 0.08333, 0, 0, 0.27778], + 45: [0, 0.44444, 0, 0, 0.33333], + 46: [0, 0.08333, 0, 0, 0.27778], + 47: [0.25, 0.75, 0, 0, 0.5], + 48: [0, 0.65556, 0, 0, 0.5], + 49: [0, 0.65556, 0, 0, 0.5], + 50: [0, 0.65556, 0, 0, 0.5], + 51: [0, 0.65556, 0, 0, 0.5], + 52: [0, 0.65556, 0, 0, 0.5], + 53: [0, 0.65556, 0, 0, 0.5], + 54: [0, 0.65556, 0, 0, 0.5], + 55: [0, 0.65556, 0, 0, 0.5], + 56: [0, 0.65556, 0, 0, 0.5], + 57: [0, 0.65556, 0, 0, 0.5], + 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: [0, 0.69444, 0, 0, 0.47222], + 64: [0, 0.69444, 0, 0, 0.66667], + 65: [0, 0.69444, 0, 0, 0.66667], + 66: [0, 0.69444, 0, 0, 0.66667], + 67: [0, 0.69444, 0, 0, 0.63889], + 68: [0, 0.69444, 0, 0, 0.72223], + 69: [0, 0.69444, 0, 0, 0.59722], + 70: [0, 0.69444, 0, 0, 0.56945], + 71: [0, 0.69444, 0, 0, 0.66667], + 72: [0, 0.69444, 0, 0, 0.70834], + 73: [0, 0.69444, 0, 0, 0.27778], + 74: [0, 0.69444, 0, 0, 0.47222], + 75: [0, 0.69444, 0, 0, 0.69445], + 76: [0, 0.69444, 0, 0, 0.54167], + 77: [0, 0.69444, 0, 0, 0.875], + 78: [0, 0.69444, 0, 0, 0.70834], + 79: [0, 0.69444, 0, 0, 0.73611], + 80: [0, 0.69444, 0, 0, 0.63889], + 81: [0.125, 0.69444, 0, 0, 0.73611], + 82: [0, 0.69444, 0, 0, 0.64584], + 83: [0, 0.69444, 0, 0, 0.55556], + 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: [0, 0.69444, 0, 0, 0.66667], + 89: [0, 0.69444, 0.025, 0, 0.66667], + 90: [0, 0.69444, 0, 0, 0.61111], + 91: [0.25, 0.75, 0, 0, 0.28889], + 93: [0.25, 0.75, 0, 0, 0.28889], + 94: [0, 0.69444, 0, 0, 0.5], + 95: [0.35, 0.09444, 0.02778, 0, 0.5], + 97: [0, 0.44444, 0, 0, 0.48056], + 98: [0, 0.69444, 0, 0, 0.51667], + 99: [0, 0.44444, 0, 0, 0.44445], + 100: [0, 0.69444, 0, 0, 0.51667], + 101: [0, 0.44444, 0, 0, 0.44445], + 102: [0, 0.69444, 0.06944, 0, 0.30556], + 103: [0.19444, 0.44444, 0.01389, 0, 0.5], + 104: [0, 0.69444, 0, 0, 0.51667], + 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: [0, 0.44444, 0, 0, 0.51667], + 111: [0, 0.44444, 0, 0, 0.5], + 112: [0.19444, 0.44444, 0, 0, 0.51667], + 113: [0.19444, 0.44444, 0, 0, 0.51667], + 114: [0, 0.44444, 0.01389, 0, 0.34167], + 115: [0, 0.44444, 0, 0, 0.38333], + 116: [0, 0.57143, 0, 0, 0.36111], + 117: [0, 0.44444, 0, 0, 0.51667], + 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: [0, 0, 0, 0, 0.25], + 168: [0, 0.67937, 0, 0, 0.5], + 176: [0, 0.69444, 0, 0, 0.66667], + 184: [0.17014, 0, 0, 0, 0.44445], + 305: [0, 0.44444, 0, 0, 0.23889], + 567: [0.19444, 0.44444, 0, 0, 0.26667], + 710: [0, 0.69444, 0, 0, 0.5], + 711: [0, 0.63194, 0, 0, 0.5], + 713: [0, 0.60889, 0, 0, 0.5], + 714: [0, 0.69444, 0, 0, 0.5], + 715: [0, 0.69444, 0, 0, 0.5], + 728: [0, 0.69444, 0, 0, 0.5], + 729: [0, 0.67937, 0, 0, 0.27778], + 730: [0, 0.69444, 0, 0, 0.66667], + 732: [0, 0.67659, 0, 0, 0.5], + 733: [0, 0.69444, 0, 0, 0.5], + 915: [0, 0.69444, 0, 0, 0.54167], + 916: [0, 0.69444, 0, 0, 0.83334], + 920: [0, 0.69444, 0, 0, 0.77778], + 923: [0, 0.69444, 0, 0, 0.61111], + 926: [0, 0.69444, 0, 0, 0.66667], + 928: [0, 0.69444, 0, 0, 0.70834], + 931: [0, 0.69444, 0, 0, 0.72222], + 933: [0, 0.69444, 0, 0, 0.77778], + 934: [0, 0.69444, 0, 0, 0.72222], + 936: [0, 0.69444, 0, 0, 0.77778], + 937: [0, 0.69444, 0, 0, 0.72222], + 8211: [0, 0.44444, 0.02778, 0, 0.5], + 8212: [0, 0.44444, 0.02778, 0, 1], + 8216: [0, 0.69444, 0, 0, 0.27778], + 8217: [0, 0.69444, 0, 0, 0.27778], + 8220: [0, 0.69444, 0, 0, 0.5], + 8221: [0, 0.69444, 0, 0, 0.5], + }, + "Script-Regular": { + 32: [0, 0, 0, 0, 0.25], + 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: [0, 0, 0, 0, 0.25], + }, + "Size1-Regular": { + 32: [0, 0, 0, 0, 0.25], + 40: [0.35001, 0.85, 0, 0, 0.45834], + 41: [0.35001, 0.85, 0, 0, 0.45834], + 47: [0.35001, 0.85, 0, 0, 0.57778], + 91: [0.35001, 0.85, 0, 0, 0.41667], + 92: [0.35001, 0.85, 0, 0, 0.57778], + 93: [0.35001, 0.85, 0, 0, 0.41667], + 123: [0.35001, 0.85, 0, 0, 0.58334], + 125: [0.35001, 0.85, 0, 0, 0.58334], + 160: [0, 0, 0, 0, 0.25], + 710: [0, 0.72222, 0, 0, 0.55556], + 732: [0, 0.72222, 0, 0, 0.55556], + 770: [0, 0.72222, 0, 0, 0.55556], + 771: [0, 0.72222, 0, 0, 0.55556], + 8214: [-99e-5, 0.601, 0, 0, 0.77778], + 8593: [1e-5, 0.6, 0, 0, 0.66667], + 8595: [1e-5, 0.6, 0, 0, 0.66667], + 8657: [1e-5, 0.6, 0, 0, 0.77778], + 8659: [1e-5, 0.6, 0, 0, 0.77778], + 8719: [0.25001, 0.75, 0, 0, 0.94445], + 8720: [0.25001, 0.75, 0, 0, 0.94445], + 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: [0.30612, 0.805, 0.19445, 0, 0.47222], + 8748: [0.306, 0.805, 0.19445, 0, 0.47222], + 8749: [0.306, 0.805, 0.19445, 0, 0.47222], + 8750: [0.30612, 0.805, 0.19445, 0, 0.47222], + 8896: [0.25001, 0.75, 0, 0, 0.83334], + 8897: [0.25001, 0.75, 0, 0, 0.83334], + 8898: [0.25001, 0.75, 0, 0, 0.83334], + 8899: [0.25001, 0.75, 0, 0, 0.83334], + 8968: [0.35001, 0.85, 0, 0, 0.47222], + 8969: [0.35001, 0.85, 0, 0, 0.47222], + 8970: [0.35001, 0.85, 0, 0, 0.47222], + 8971: [0.35001, 0.85, 0, 0, 0.47222], + 9168: [-99e-5, 0.601, 0, 0, 0.66667], + 10216: [0.35001, 0.85, 0, 0, 0.47222], + 10217: [0.35001, 0.85, 0, 0, 0.47222], + 10752: [0.25001, 0.75, 0, 0, 1.11111], + 10753: [0.25001, 0.75, 0, 0, 1.11111], + 10754: [0.25001, 0.75, 0, 0, 1.11111], + 10756: [0.25001, 0.75, 0, 0, 0.83334], + 10758: [0.25001, 0.75, 0, 0, 0.83334], + }, + "Size2-Regular": { + 32: [0, 0, 0, 0, 0.25], + 40: [0.65002, 1.15, 0, 0, 0.59722], + 41: [0.65002, 1.15, 0, 0, 0.59722], + 47: [0.65002, 1.15, 0, 0, 0.81111], + 91: [0.65002, 1.15, 0, 0, 0.47222], + 92: [0.65002, 1.15, 0, 0, 0.81111], + 93: [0.65002, 1.15, 0, 0, 0.47222], + 123: [0.65002, 1.15, 0, 0, 0.66667], + 125: [0.65002, 1.15, 0, 0, 0.66667], + 160: [0, 0, 0, 0, 0.25], + 710: [0, 0.75, 0, 0, 1], + 732: [0, 0.75, 0, 0, 1], + 770: [0, 0.75, 0, 0, 1], + 771: [0, 0.75, 0, 0, 1], + 8719: [0.55001, 1.05, 0, 0, 1.27778], + 8720: [0.55001, 1.05, 0, 0, 1.27778], + 8721: [0.55001, 1.05, 0, 0, 1.44445], + 8730: [0.65002, 1.15, 0, 0, 1], + 8747: [0.86225, 1.36, 0.44445, 0, 0.55556], + 8748: [0.862, 1.36, 0.44445, 0, 0.55556], + 8749: [0.862, 1.36, 0.44445, 0, 0.55556], + 8750: [0.86225, 1.36, 0.44445, 0, 0.55556], + 8896: [0.55001, 1.05, 0, 0, 1.11111], + 8897: [0.55001, 1.05, 0, 0, 1.11111], + 8898: [0.55001, 1.05, 0, 0, 1.11111], + 8899: [0.55001, 1.05, 0, 0, 1.11111], + 8968: [0.65002, 1.15, 0, 0, 0.52778], + 8969: [0.65002, 1.15, 0, 0, 0.52778], + 8970: [0.65002, 1.15, 0, 0, 0.52778], + 8971: [0.65002, 1.15, 0, 0, 0.52778], + 10216: [0.65002, 1.15, 0, 0, 0.61111], + 10217: [0.65002, 1.15, 0, 0, 0.61111], + 10752: [0.55001, 1.05, 0, 0, 1.51112], + 10753: [0.55001, 1.05, 0, 0, 1.51112], + 10754: [0.55001, 1.05, 0, 0, 1.51112], + 10756: [0.55001, 1.05, 0, 0, 1.11111], + 10758: [0.55001, 1.05, 0, 0, 1.11111], + }, + "Size3-Regular": { + 32: [0, 0, 0, 0, 0.25], + 40: [0.95003, 1.45, 0, 0, 0.73611], + 41: [0.95003, 1.45, 0, 0, 0.73611], + 47: [0.95003, 1.45, 0, 0, 1.04445], + 91: [0.95003, 1.45, 0, 0, 0.52778], + 92: [0.95003, 1.45, 0, 0, 1.04445], + 93: [0.95003, 1.45, 0, 0, 0.52778], + 123: [0.95003, 1.45, 0, 0, 0.75], + 125: [0.95003, 1.45, 0, 0, 0.75], + 160: [0, 0, 0, 0, 0.25], + 710: [0, 0.75, 0, 0, 1.44445], + 732: [0, 0.75, 0, 0, 1.44445], + 770: [0, 0.75, 0, 0, 1.44445], + 771: [0, 0.75, 0, 0, 1.44445], + 8730: [0.95003, 1.45, 0, 0, 1], + 8968: [0.95003, 1.45, 0, 0, 0.58334], + 8969: [0.95003, 1.45, 0, 0, 0.58334], + 8970: [0.95003, 1.45, 0, 0, 0.58334], + 8971: [0.95003, 1.45, 0, 0, 0.58334], + 10216: [0.95003, 1.45, 0, 0, 0.75], + 10217: [0.95003, 1.45, 0, 0, 0.75], + }, + "Size4-Regular": { + 32: [0, 0, 0, 0, 0.25], + 40: [1.25003, 1.75, 0, 0, 0.79167], + 41: [1.25003, 1.75, 0, 0, 0.79167], + 47: [1.25003, 1.75, 0, 0, 1.27778], + 91: [1.25003, 1.75, 0, 0, 0.58334], + 92: [1.25003, 1.75, 0, 0, 1.27778], + 93: [1.25003, 1.75, 0, 0, 0.58334], + 123: [1.25003, 1.75, 0, 0, 0.80556], + 125: [1.25003, 1.75, 0, 0, 0.80556], + 160: [0, 0, 0, 0, 0.25], + 710: [0, 0.825, 0, 0, 1.8889], + 732: [0, 0.825, 0, 0, 1.8889], + 770: [0, 0.825, 0, 0, 1.8889], + 771: [0, 0.825, 0, 0, 1.8889], + 8730: [1.25003, 1.75, 0, 0, 1], + 8968: [1.25003, 1.75, 0, 0, 0.63889], + 8969: [1.25003, 1.75, 0, 0, 0.63889], + 8970: [1.25003, 1.75, 0, 0, 0.63889], + 8971: [1.25003, 1.75, 0, 0, 0.63889], + 9115: [0.64502, 1.155, 0, 0, 0.875], + 9116: [1e-5, 0.6, 0, 0, 0.875], + 9117: [0.64502, 1.155, 0, 0, 0.875], + 9118: [0.64502, 1.155, 0, 0, 0.875], + 9119: [1e-5, 0.6, 0, 0, 0.875], + 9120: [0.64502, 1.155, 0, 0, 0.875], + 9121: [0.64502, 1.155, 0, 0, 0.66667], + 9122: [-99e-5, 0.601, 0, 0, 0.66667], + 9123: [0.64502, 1.155, 0, 0, 0.66667], + 9124: [0.64502, 1.155, 0, 0, 0.66667], + 9125: [-99e-5, 0.601, 0, 0, 0.66667], + 9126: [0.64502, 1.155, 0, 0, 0.66667], + 9127: [1e-5, 0.9, 0, 0, 0.88889], + 9128: [0.65002, 1.15, 0, 0, 0.88889], + 9129: [0.90001, 0, 0, 0, 0.88889], + 9130: [0, 0.3, 0, 0, 0.88889], + 9131: [1e-5, 0.9, 0, 0, 0.88889], + 9132: [0.65002, 1.15, 0, 0, 0.88889], + 9133: [0.90001, 0, 0, 0, 0.88889], + 9143: [0.88502, 0.915, 0, 0, 1.05556], + 10216: [1.25003, 1.75, 0, 0, 0.80556], + 10217: [1.25003, 1.75, 0, 0, 0.80556], + 57344: [-499e-5, 0.605, 0, 0, 1.05556], + 57345: [-499e-5, 0.605, 0, 0, 1.05556], + 57680: [0, 0.12, 0, 0, 0.45], + 57681: [0, 0.12, 0, 0, 0.45], + 57682: [0, 0.12, 0, 0, 0.45], + 57683: [0, 0.12, 0, 0, 0.45], + }, + "Typewriter-Regular": { + 32: [0, 0, 0, 0, 0.525], + 33: [0, 0.61111, 0, 0, 0.525], + 34: [0, 0.61111, 0, 0, 0.525], + 35: [0, 0.61111, 0, 0, 0.525], + 36: [0.08333, 0.69444, 0, 0, 0.525], + 37: [0.08333, 0.69444, 0, 0, 0.525], + 38: [0, 0.61111, 0, 0, 0.525], + 39: [0, 0.61111, 0, 0, 0.525], + 40: [0.08333, 0.69444, 0, 0, 0.525], + 41: [0.08333, 0.69444, 0, 0, 0.525], + 42: [0, 0.52083, 0, 0, 0.525], + 43: [-0.08056, 0.53055, 0, 0, 0.525], + 44: [0.13889, 0.125, 0, 0, 0.525], + 45: [-0.08056, 0.53055, 0, 0, 0.525], + 46: [0, 0.125, 0, 0, 0.525], + 47: [0.08333, 0.69444, 0, 0, 0.525], + 48: [0, 0.61111, 0, 0, 0.525], + 49: [0, 0.61111, 0, 0, 0.525], + 50: [0, 0.61111, 0, 0, 0.525], + 51: [0, 0.61111, 0, 0, 0.525], + 52: [0, 0.61111, 0, 0, 0.525], + 53: [0, 0.61111, 0, 0, 0.525], + 54: [0, 0.61111, 0, 0, 0.525], + 55: [0, 0.61111, 0, 0, 0.525], + 56: [0, 0.61111, 0, 0, 0.525], + 57: [0, 0.61111, 0, 0, 0.525], + 58: [0, 0.43056, 0, 0, 0.525], + 59: [0.13889, 0.43056, 0, 0, 0.525], + 60: [-0.05556, 0.55556, 0, 0, 0.525], + 61: [-0.19549, 0.41562, 0, 0, 0.525], + 62: [-0.05556, 0.55556, 0, 0, 0.525], + 63: [0, 0.61111, 0, 0, 0.525], + 64: [0, 0.61111, 0, 0, 0.525], + 65: [0, 0.61111, 0, 0, 0.525], + 66: [0, 0.61111, 0, 0, 0.525], + 67: [0, 0.61111, 0, 0, 0.525], + 68: [0, 0.61111, 0, 0, 0.525], + 69: [0, 0.61111, 0, 0, 0.525], + 70: [0, 0.61111, 0, 0, 0.525], + 71: [0, 0.61111, 0, 0, 0.525], + 72: [0, 0.61111, 0, 0, 0.525], + 73: [0, 0.61111, 0, 0, 0.525], + 74: [0, 0.61111, 0, 0, 0.525], + 75: [0, 0.61111, 0, 0, 0.525], + 76: [0, 0.61111, 0, 0, 0.525], + 77: [0, 0.61111, 0, 0, 0.525], + 78: [0, 0.61111, 0, 0, 0.525], + 79: [0, 0.61111, 0, 0, 0.525], + 80: [0, 0.61111, 0, 0, 0.525], + 81: [0.13889, 0.61111, 0, 0, 0.525], + 82: [0, 0.61111, 0, 0, 0.525], + 83: [0, 0.61111, 0, 0, 0.525], + 84: [0, 0.61111, 0, 0, 0.525], + 85: [0, 0.61111, 0, 0, 0.525], + 86: [0, 0.61111, 0, 0, 0.525], + 87: [0, 0.61111, 0, 0, 0.525], + 88: [0, 0.61111, 0, 0, 0.525], + 89: [0, 0.61111, 0, 0, 0.525], + 90: [0, 0.61111, 0, 0, 0.525], + 91: [0.08333, 0.69444, 0, 0, 0.525], + 92: [0.08333, 0.69444, 0, 0, 0.525], + 93: [0.08333, 0.69444, 0, 0, 0.525], + 94: [0, 0.61111, 0, 0, 0.525], + 95: [0.09514, 0, 0, 0, 0.525], + 96: [0, 0.61111, 0, 0, 0.525], + 97: [0, 0.43056, 0, 0, 0.525], + 98: [0, 0.61111, 0, 0, 0.525], + 99: [0, 0.43056, 0, 0, 0.525], + 100: [0, 0.61111, 0, 0, 0.525], + 101: [0, 0.43056, 0, 0, 0.525], + 102: [0, 0.61111, 0, 0, 0.525], + 103: [0.22222, 0.43056, 0, 0, 0.525], + 104: [0, 0.61111, 0, 0, 0.525], + 105: [0, 0.61111, 0, 0, 0.525], + 106: [0.22222, 0.61111, 0, 0, 0.525], + 107: [0, 0.61111, 0, 0, 0.525], + 108: [0, 0.61111, 0, 0, 0.525], + 109: [0, 0.43056, 0, 0, 0.525], + 110: [0, 0.43056, 0, 0, 0.525], + 111: [0, 0.43056, 0, 0, 0.525], + 112: [0.22222, 0.43056, 0, 0, 0.525], + 113: [0.22222, 0.43056, 0, 0, 0.525], + 114: [0, 0.43056, 0, 0, 0.525], + 115: [0, 0.43056, 0, 0, 0.525], + 116: [0, 0.55358, 0, 0, 0.525], + 117: [0, 0.43056, 0, 0, 0.525], + 118: [0, 0.43056, 0, 0, 0.525], + 119: [0, 0.43056, 0, 0, 0.525], + 120: [0, 0.43056, 0, 0, 0.525], + 121: [0.22222, 0.43056, 0, 0, 0.525], + 122: [0, 0.43056, 0, 0, 0.525], + 123: [0.08333, 0.69444, 0, 0, 0.525], + 124: [0.08333, 0.69444, 0, 0, 0.525], + 125: [0.08333, 0.69444, 0, 0, 0.525], + 126: [0, 0.61111, 0, 0, 0.525], + 127: [0, 0.61111, 0, 0, 0.525], + 160: [0, 0, 0, 0, 0.525], + 176: [0, 0.61111, 0, 0, 0.525], + 184: [0.19445, 0, 0, 0, 0.525], + 305: [0, 0.43056, 0, 0, 0.525], + 567: [0.22222, 0.43056, 0, 0, 0.525], + 711: [0, 0.56597, 0, 0, 0.525], + 713: [0, 0.56555, 0, 0, 0.525], + 714: [0, 0.61111, 0, 0, 0.525], + 715: [0, 0.61111, 0, 0, 0.525], + 728: [0, 0.61111, 0, 0, 0.525], + 730: [0, 0.61111, 0, 0, 0.525], + 770: [0, 0.61111, 0, 0, 0.525], + 771: [0, 0.61111, 0, 0, 0.525], + 776: [0, 0.61111, 0, 0, 0.525], + 915: [0, 0.61111, 0, 0, 0.525], + 916: [0, 0.61111, 0, 0, 0.525], + 920: [0, 0.61111, 0, 0, 0.525], + 923: [0, 0.61111, 0, 0, 0.525], + 926: [0, 0.61111, 0, 0, 0.525], + 928: [0, 0.61111, 0, 0, 0.525], + 931: [0, 0.61111, 0, 0, 0.525], + 933: [0, 0.61111, 0, 0, 0.525], + 934: [0, 0.61111, 0, 0, 0.525], + 936: [0, 0.61111, 0, 0, 0.525], + 937: [0, 0.61111, 0, 0, 0.525], + 8216: [0, 0.61111, 0, 0, 0.525], + 8217: [0, 0.61111, 0, 0, 0.525], + 8242: [0, 0.61111, 0, 0, 0.525], + 9251: [0.11111, 0.21944, 0, 0, 0.525], + }, + }; + var sigmasAndXis = { + slant: [0.25, 0.25, 0.25], + space: [0, 0, 0], + stretch: [0, 0, 0], + shrink: [0, 0, 0], + xHeight: [0.431, 0.431, 0.431], + quad: [1, 1.171, 1.472], + extraSpace: [0, 0, 0], + num1: [0.677, 0.732, 0.925], + num2: [0.394, 0.384, 0.387], + 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: [0.25, 0.25, 0.25], + 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], + ptPerEm: [10, 10, 10], + doubleRuleSep: [0.2, 0.2, 0.2], + arrayRuleWidth: [0.04, 0.04, 0.04], + fboxsep: [0.3, 0.3, 0.3], + fboxrule: [0.04, 0.04, 0.04], + }; + var extraCharacterMap = { + "\xC5": "A", + "\xD0": "D", + "\xDE": "o", + "\xE5": "a", + "\xF0": "d", + "\xFE": "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 getCharacterMetrics(character, font, mode) { + if (!fontMetricsData[font]) { + throw new Error("Font metrics not found for font: " + font + "."); + } + var ch = character.charCodeAt(0); + var metrics = fontMetricsData[font][ch]; + if (!metrics && character[0] in extraCharacterMap) { + ch = extraCharacterMap[character[0]].charCodeAt(0); + metrics = fontMetricsData[font][ch]; + } + if (!metrics && mode === "text") { + if (supportedCodepoint(ch)) { + metrics = fontMetricsData[font][77]; + } + } + if (metrics) { + return { + depth: metrics[0], + height: metrics[1], + italic: metrics[2], + skew: metrics[3], + width: metrics[4], + }; + } + } + var fontMetricsBySizeIndex = {}; + function getGlobalMetrics(size) { + var sizeIndex; + if (size >= 5) { + sizeIndex = 0; + } else if (size >= 3) { + sizeIndex = 1; + } else { + sizeIndex = 2; + } + if (!fontMetricsBySizeIndex[sizeIndex]) { + var metrics = (fontMetricsBySizeIndex[sizeIndex] = { + cssEmPerMu: sigmasAndXis.quad[sizeIndex] / 18, + }); + for (var key in sigmasAndXis) { + if (sigmasAndXis.hasOwnProperty(key)) { + metrics[key] = sigmasAndXis[key][sizeIndex]; + } + } + } + return fontMetricsBySizeIndex[sizeIndex]; + } + var sizeStyleMap = [ + [1, 1, 1], + [2, 1, 1], + [3, 1, 1], + [4, 2, 1], + [5, 2, 1], + [6, 3, 1], + [7, 4, 2], + [8, 6, 3], + [9, 7, 6], + [10, 8, 7], + [11, 10, 9], + ]; + var sizeMultipliers = [ + 0.5, 0.6, 0.7, 0.8, 0.9, 1, 1.2, 1.44, 1.728, 2.074, 2.488, + ]; + var sizeAtStyle = function sizeAtStyle(size, style) { + return style.size < 2 ? size : sizeStyleMap[size - 1][style.size - 1]; + }; + var Options = (function () { + function Options(data) { + _classCallCheck(this, Options); + this.style = void 0; + this.color = void 0; + this.size = void 0; + this.textSize = void 0; + this.phantom = void 0; + this.font = void 0; + this.fontFamily = void 0; + this.fontWeight = void 0; + this.fontShape = void 0; + this.sizeMultiplier = void 0; + this.maxSize = void 0; + this.minRuleThickness = void 0; + this._fontMetrics = void 0; + this.style = data.style; + this.color = data.color; + this.size = data.size || Options.BASESIZE; + this.textSize = data.textSize || this.size; + this.phantom = !!data.phantom; + this.font = data.font || ""; + this.fontFamily = data.fontFamily || ""; + this.fontWeight = data.fontWeight || ""; + this.fontShape = data.fontShape || ""; + this.sizeMultiplier = sizeMultipliers[this.size - 1]; + this.maxSize = data.maxSize; + this.minRuleThickness = data.minRuleThickness; + this._fontMetrics = undefined; + } + return _createClass(Options, [ + { + key: "extend", + value: function extend(extension) { + var data = { + style: this.style, + size: this.size, + textSize: this.textSize, + color: this.color, + phantom: this.phantom, + font: this.font, + fontFamily: this.fontFamily, + fontWeight: this.fontWeight, + fontShape: this.fontShape, + maxSize: this.maxSize, + minRuleThickness: this.minRuleThickness, + }; + for (var key in extension) { + if (extension.hasOwnProperty(key)) { + data[key] = extension[key]; + } + } + return new Options(data); + }, + }, + { + key: "havingStyle", + value: function havingStyle(style) { + if (this.style === style) { + return this; + } else { + return this.extend({ + style: style, + size: sizeAtStyle(this.textSize, style), + }); + } + }, + }, + { + key: "havingCrampedStyle", + value: function havingCrampedStyle() { + return this.havingStyle(this.style.cramp()); + }, + }, + { + key: "havingSize", + value: function havingSize(size) { + if (this.size === size && this.textSize === size) { + return this; + } else { + return this.extend({ + style: this.style.text(), + size: size, + textSize: size, + sizeMultiplier: sizeMultipliers[size - 1], + }); + } + }, + }, + { + key: "havingBaseStyle", + value: function havingBaseStyle(style) { + style = style || this.style.text(); + var wantSize = sizeAtStyle(Options.BASESIZE, style); + if ( + this.size === wantSize && + this.textSize === Options.BASESIZE && + this.style === style + ) { + return this; + } else { + return this.extend({ style: style, size: wantSize }); + } + }, + }, + { + key: "havingBaseSizing", + value: function havingBaseSizing() { + var size; + switch (this.style.id) { + case 4: + case 5: + size = 3; + break; + case 6: + case 7: + size = 1; + break; + default: + size = 6; + } + return this.extend({ style: this.style.text(), size: size }); + }, + }, + { + key: "withColor", + value: function withColor(color) { + return this.extend({ color: color }); + }, + }, + { + key: "withPhantom", + value: function withPhantom() { + return this.extend({ phantom: true }); + }, + }, + { + key: "withFont", + value: function withFont(font) { + return this.extend({ font: font }); + }, + }, + { + key: "withTextFontFamily", + value: function withTextFontFamily(fontFamily) { + return this.extend({ fontFamily: fontFamily, font: "" }); + }, + }, + { + key: "withTextFontWeight", + value: function withTextFontWeight(fontWeight) { + return this.extend({ fontWeight: fontWeight, font: "" }); + }, + }, + { + key: "withTextFontShape", + value: function withTextFontShape(fontShape) { + return this.extend({ fontShape: fontShape, font: "" }); + }, + }, + { + key: "sizingClasses", + value: function sizingClasses(oldOptions) { + if (oldOptions.size !== this.size) { + return [ + "sizing", + "reset-size" + oldOptions.size, + "size" + this.size, + ]; + } else { + return []; + } + }, + }, + { + key: "baseSizingClasses", + value: function baseSizingClasses() { + if (this.size !== Options.BASESIZE) { + return [ + "sizing", + "reset-size" + this.size, + "size" + Options.BASESIZE, + ]; + } else { + return []; + } + }, + }, + { + key: "fontMetrics", + value: function fontMetrics() { + if (!this._fontMetrics) { + this._fontMetrics = getGlobalMetrics(this.size); + } + return this._fontMetrics; + }, + }, + { + key: "getColor", + value: function getColor() { + if (this.phantom) { + return "transparent"; + } else { + return this.color; + } + }, + }, + ]); + })(); + Options.BASESIZE = 6; + var ptPerUnit = { + pt: 1, + mm: 7227 / 2540, + cm: 7227 / 254, + in: 72.27, + bp: 803 / 800, + pc: 12, + dd: 1238 / 1157, + cc: 14856 / 1157, + nd: 685 / 642, + nc: 1370 / 107, + sp: 1 / 65536, + px: 803 / 800, + }; + var relativeUnit = { ex: true, em: true, mu: true }; + var validUnit = function validUnit(unit) { + if (typeof unit !== "string") { + unit = unit.unit; + } + return unit in ptPerUnit || unit in relativeUnit || unit === "ex"; + }; + var calculateSize = function calculateSize(sizeValue, options) { + var scale; + if (sizeValue.unit in ptPerUnit) { + scale = + ptPerUnit[sizeValue.unit] / + options.fontMetrics().ptPerEm / + options.sizeMultiplier; + } else if (sizeValue.unit === "mu") { + scale = options.fontMetrics().cssEmPerMu; + } else { + var unitOptions; + if (options.style.isTight()) { + unitOptions = options.havingStyle(options.style.text()); + } else { + unitOptions = options; + } + if (sizeValue.unit === "ex") { + scale = unitOptions.fontMetrics().xHeight; + } else if (sizeValue.unit === "em") { + scale = unitOptions.fontMetrics().quad; + } else { + throw new ParseError("Invalid unit: '" + sizeValue.unit + "'"); + } + if (unitOptions !== options) { + scale *= unitOptions.sizeMultiplier / options.sizeMultiplier; + } + } + return Math.min(sizeValue.number * scale, options.maxSize); + }; + var makeEm = function makeEm(n) { + return +n.toFixed(4) + "em"; + }; + var createClass = function createClass(classes) { + return classes + .filter(function (cls) { + return cls; + }) + .join(" "); + }; + var initNode = function initNode(classes, options, style) { + this.classes = classes || []; + this.attributes = {}; + this.height = 0; + this.depth = 0; + this.maxFontSize = 0; + this.style = style || {}; + if (options) { + if (options.style.isTight()) { + this.classes.push("mtight"); + } + var color = options.getColor(); + if (color) { + this.style.color = color; + } + } + }; + var _toNode = function toNode(tagName) { + var node = document.createElement(tagName); + node.className = createClass(this.classes); + for (var style in this.style) { + if (this.style.hasOwnProperty(style)) { + node.style[style] = this.style[style]; + } + } + for (var attr in this.attributes) { + if (this.attributes.hasOwnProperty(attr)) { + node.setAttribute(attr, this.attributes[attr]); + } + } + for (var i = 0; i < this.children.length; i++) { + node.appendChild(this.children[i].toNode()); + } + return node; + }; + var invalidAttributeNameRegex = /[\s"'>/=\x00-\x1f]/; + var _toMarkup = function toMarkup(tagName) { + var markup = "<" + tagName; + if (this.classes.length) { + markup += ' class="' + utils.escape(createClass(this.classes)) + '"'; + } + var styles = ""; + for (var style in this.style) { + if (this.style.hasOwnProperty(style)) { + styles += utils.hyphenate(style) + ":" + this.style[style] + ";"; + } + } + if (styles) { + markup += ' style="' + utils.escape(styles) + '"'; + } + for (var attr in this.attributes) { + if (this.attributes.hasOwnProperty(attr)) { + if (invalidAttributeNameRegex.test(attr)) { + throw new ParseError("Invalid attribute name '" + attr + "'"); + } + markup += " " + attr + '="' + utils.escape(this.attributes[attr]) + '"'; + } + } + markup += ">"; + for (var i = 0; i < this.children.length; i++) { + markup += this.children[i].toMarkup(); + } + markup += ""; + return markup; + }; + var Span = (function () { + function Span(classes, children, options, style) { + _classCallCheck(this, Span); + this.children = void 0; + this.attributes = void 0; + this.classes = void 0; + this.height = void 0; + this.depth = void 0; + this.width = void 0; + this.maxFontSize = void 0; + this.style = void 0; + initNode.call(this, classes, options, style); + this.children = children || []; + } + return _createClass(Span, [ + { + key: "setAttribute", + value: function setAttribute(attribute, value) { + this.attributes[attribute] = value; + }, + }, + { + key: "hasClass", + value: function hasClass(className) { + return utils.contains(this.classes, className); + }, + }, + { + key: "toNode", + value: function toNode() { + return _toNode.call(this, "span"); + }, + }, + { + key: "toMarkup", + value: function toMarkup() { + return _toMarkup.call(this, "span"); + }, + }, + ]); + })(); + var Anchor = (function () { + function Anchor(href, classes, children, options) { + _classCallCheck(this, Anchor); + this.children = void 0; + this.attributes = void 0; + this.classes = void 0; + this.height = void 0; + this.depth = void 0; + this.maxFontSize = void 0; + this.style = void 0; + initNode.call(this, classes, options); + this.children = children || []; + this.setAttribute("href", href); + } + return _createClass(Anchor, [ + { + key: "setAttribute", + value: function setAttribute(attribute, value) { + this.attributes[attribute] = value; + }, + }, + { + key: "hasClass", + value: function hasClass(className) { + return utils.contains(this.classes, className); + }, + }, + { + key: "toNode", + value: function toNode() { + return _toNode.call(this, "a"); + }, + }, + { + key: "toMarkup", + value: function toMarkup() { + return _toMarkup.call(this, "a"); + }, + }, + ]); + })(); + var Img = (function () { + function Img(src, alt, style) { + _classCallCheck(this, Img); + this.src = void 0; + this.alt = void 0; + this.classes = void 0; + this.height = void 0; + this.depth = void 0; + this.maxFontSize = void 0; + this.style = void 0; + this.alt = alt; + this.src = src; + this.classes = ["mord"]; + this.style = style; + } + return _createClass(Img, [ + { + key: "hasClass", + value: function hasClass(className) { + return utils.contains(this.classes, className); + }, + }, + { + key: "toNode", + value: function toNode() { + var node = document.createElement("img"); + node.src = this.src; + node.alt = this.alt; + node.className = "mord"; + for (var style in this.style) { + if (this.style.hasOwnProperty(style)) { + node.style[style] = this.style[style]; + } + } + return node; + }, + }, + { + key: "toMarkup", + value: function toMarkup() { + var markup = + '' + utils.escape(this.alt) + ' 0) { + span = document.createElement("span"); + span.style.marginRight = makeEm(this.italic); + } + if (this.classes.length > 0) { + span = span || document.createElement("span"); + span.className = createClass(this.classes); + } + for (var style in this.style) { + if (this.style.hasOwnProperty(style)) { + span = span || document.createElement("span"); + span.style[style] = this.style[style]; + } + } + if (span) { + span.appendChild(node); + return span; + } else { + return node; + } + }, + }, + { + key: "toMarkup", + value: function toMarkup() { + var needsSpan = false; + var markup = " 0) { + styles += "margin-right:" + this.italic + "em;"; + } + for (var style in this.style) { + if (this.style.hasOwnProperty(style)) { + styles += utils.hyphenate(style) + ":" + this.style[style] + ";"; + } + } + if (styles) { + needsSpan = true; + markup += ' style="' + utils.escape(styles) + '"'; + } + var escaped = utils.escape(this.text); + if (needsSpan) { + markup += ">"; + markup += escaped; + markup += ""; + return markup; + } else { + return escaped; + } + }, + }, + ]); + })(); + var SvgNode = (function () { + function SvgNode(children, attributes) { + _classCallCheck(this, SvgNode); + this.children = void 0; + this.attributes = void 0; + this.children = children || []; + this.attributes = attributes || {}; + } + return _createClass(SvgNode, [ + { + key: "toNode", + value: function toNode() { + var svgNS = "http://www.w3.org/2000/svg"; + var node = document.createElementNS(svgNS, "svg"); + for (var attr in this.attributes) { + if (Object.prototype.hasOwnProperty.call(this.attributes, attr)) { + node.setAttribute(attr, this.attributes[attr]); + } + } + for (var i = 0; i < this.children.length; i++) { + node.appendChild(this.children[i].toNode()); + } + return node; + }, + }, + { + key: "toMarkup", + value: function toMarkup() { + var markup = ''; + } else { + return ''; + } + }, + }, + ]); + })(); + var LineNode = (function () { + function LineNode(attributes) { + _classCallCheck(this, LineNode); + this.attributes = void 0; + this.attributes = attributes || {}; + } + return _createClass(LineNode, [ + { + key: "toNode", + value: function toNode() { + var svgNS = "http://www.w3.org/2000/svg"; + var node = document.createElementNS(svgNS, "line"); + for (var attr in this.attributes) { + if (Object.prototype.hasOwnProperty.call(this.attributes, attr)) { + node.setAttribute(attr, this.attributes[attr]); + } + } + return node; + }, + }, + { + key: "toMarkup", + value: function toMarkup() { + var markup = " but got " + String(group) + ".", + ); + } + } + var ATOMS = { bin: 1, close: 1, inner: 1, open: 1, punct: 1, rel: 1 }; + var NON_ATOMS = { + "accent-token": 1, + mathord: 1, + "op-token": 1, + spacing: 1, + textord: 1, + }; + var symbols = { math: {}, text: {} }; + function defineSymbol(mode, font, group, replace, name, acceptUnicodeChar) { + symbols[mode][name] = { font: font, group: group, replace: replace }; + if (acceptUnicodeChar && replace) { + symbols[mode][replace] = symbols[mode][name]; + } + } + var math = "math"; + var text = "text"; + var main = "main"; + var ams = "ams"; + var accent = "accent-token"; + var bin = "bin"; + var close = "close"; + var inner = "inner"; + var mathord = "mathord"; + var op = "op-token"; + var open = "open"; + var punct = "punct"; + var rel = "rel"; + var spacing = "spacing"; + var textord = "textord"; + defineSymbol(math, main, rel, "\u2261", "\\equiv", true); + defineSymbol(math, main, rel, "\u227A", "\\prec", true); + defineSymbol(math, main, rel, "\u227B", "\\succ", true); + defineSymbol(math, main, rel, "\u223C", "\\sim", true); + defineSymbol(math, main, rel, "\u22A5", "\\perp"); + defineSymbol(math, main, rel, "\u2AAF", "\\preceq", true); + defineSymbol(math, main, rel, "\u2AB0", "\\succeq", true); + defineSymbol(math, main, rel, "\u2243", "\\simeq", true); + defineSymbol(math, main, rel, "\u2223", "\\mid", true); + defineSymbol(math, main, rel, "\u226A", "\\ll", true); + defineSymbol(math, main, rel, "\u226B", "\\gg", true); + defineSymbol(math, main, rel, "\u224D", "\\asymp", true); + defineSymbol(math, main, rel, "\u2225", "\\parallel"); + defineSymbol(math, main, rel, "\u22C8", "\\bowtie", true); + defineSymbol(math, main, rel, "\u2323", "\\smile", true); + defineSymbol(math, main, rel, "\u2291", "\\sqsubseteq", true); + defineSymbol(math, main, rel, "\u2292", "\\sqsupseteq", true); + defineSymbol(math, main, rel, "\u2250", "\\doteq", true); + defineSymbol(math, main, rel, "\u2322", "\\frown", true); + defineSymbol(math, main, rel, "\u220B", "\\ni", true); + defineSymbol(math, main, rel, "\u221D", "\\propto", true); + defineSymbol(math, main, rel, "\u22A2", "\\vdash", true); + defineSymbol(math, main, rel, "\u22A3", "\\dashv", true); + defineSymbol(math, main, rel, "\u220B", "\\owns"); + defineSymbol(math, main, punct, ".", "\\ldotp"); + defineSymbol(math, main, punct, "\u22C5", "\\cdotp"); + defineSymbol(math, main, textord, "#", "\\#"); + defineSymbol(text, main, textord, "#", "\\#"); + defineSymbol(math, main, textord, "&", "\\&"); + defineSymbol(text, main, textord, "&", "\\&"); + defineSymbol(math, main, textord, "\u2135", "\\aleph", true); + defineSymbol(math, main, textord, "\u2200", "\\forall", true); + defineSymbol(math, main, textord, "\u210F", "\\hbar", true); + defineSymbol(math, main, textord, "\u2203", "\\exists", true); + defineSymbol(math, main, textord, "\u2207", "\\nabla", true); + defineSymbol(math, main, textord, "\u266D", "\\flat", true); + defineSymbol(math, main, textord, "\u2113", "\\ell", true); + defineSymbol(math, main, textord, "\u266E", "\\natural", true); + defineSymbol(math, main, textord, "\u2663", "\\clubsuit", true); + defineSymbol(math, main, textord, "\u2118", "\\wp", true); + defineSymbol(math, main, textord, "\u266F", "\\sharp", true); + defineSymbol(math, main, textord, "\u2662", "\\diamondsuit", true); + defineSymbol(math, main, textord, "\u211C", "\\Re", true); + defineSymbol(math, main, textord, "\u2661", "\\heartsuit", true); + defineSymbol(math, main, textord, "\u2111", "\\Im", true); + defineSymbol(math, main, textord, "\u2660", "\\spadesuit", true); + defineSymbol(math, main, textord, "\xA7", "\\S", true); + defineSymbol(text, main, textord, "\xA7", "\\S"); + defineSymbol(math, main, textord, "\xB6", "\\P", true); + defineSymbol(text, main, textord, "\xB6", "\\P"); + defineSymbol(math, main, textord, "\u2020", "\\dag"); + defineSymbol(text, main, textord, "\u2020", "\\dag"); + defineSymbol(text, main, textord, "\u2020", "\\textdagger"); + defineSymbol(math, main, textord, "\u2021", "\\ddag"); + defineSymbol(text, main, textord, "\u2021", "\\ddag"); + defineSymbol(text, main, textord, "\u2021", "\\textdaggerdbl"); + defineSymbol(math, main, close, "\u23B1", "\\rmoustache", true); + defineSymbol(math, main, open, "\u23B0", "\\lmoustache", true); + defineSymbol(math, main, close, "\u27EF", "\\rgroup", true); + defineSymbol(math, main, open, "\u27EE", "\\lgroup", true); + defineSymbol(math, main, bin, "\u2213", "\\mp", true); + defineSymbol(math, main, bin, "\u2296", "\\ominus", true); + defineSymbol(math, main, bin, "\u228E", "\\uplus", true); + defineSymbol(math, main, bin, "\u2293", "\\sqcap", true); + defineSymbol(math, main, bin, "\u2217", "\\ast"); + defineSymbol(math, main, bin, "\u2294", "\\sqcup", true); + defineSymbol(math, main, bin, "\u25EF", "\\bigcirc", true); + defineSymbol(math, main, bin, "\u2219", "\\bullet", true); + defineSymbol(math, main, bin, "\u2021", "\\ddagger"); + defineSymbol(math, main, bin, "\u2240", "\\wr", true); + defineSymbol(math, main, bin, "\u2A3F", "\\amalg"); + defineSymbol(math, main, bin, "&", "\\And"); + defineSymbol(math, main, rel, "\u27F5", "\\longleftarrow", true); + defineSymbol(math, main, rel, "\u21D0", "\\Leftarrow", true); + defineSymbol(math, main, rel, "\u27F8", "\\Longleftarrow", true); + defineSymbol(math, main, rel, "\u27F6", "\\longrightarrow", true); + defineSymbol(math, main, rel, "\u21D2", "\\Rightarrow", true); + defineSymbol(math, main, rel, "\u27F9", "\\Longrightarrow", true); + defineSymbol(math, main, rel, "\u2194", "\\leftrightarrow", true); + defineSymbol(math, main, rel, "\u27F7", "\\longleftrightarrow", true); + defineSymbol(math, main, rel, "\u21D4", "\\Leftrightarrow", true); + defineSymbol(math, main, rel, "\u27FA", "\\Longleftrightarrow", true); + defineSymbol(math, main, rel, "\u21A6", "\\mapsto", true); + defineSymbol(math, main, rel, "\u27FC", "\\longmapsto", true); + defineSymbol(math, main, rel, "\u2197", "\\nearrow", true); + defineSymbol(math, main, rel, "\u21A9", "\\hookleftarrow", true); + defineSymbol(math, main, rel, "\u21AA", "\\hookrightarrow", true); + defineSymbol(math, main, rel, "\u2198", "\\searrow", true); + defineSymbol(math, main, rel, "\u21BC", "\\leftharpoonup", true); + defineSymbol(math, main, rel, "\u21C0", "\\rightharpoonup", true); + defineSymbol(math, main, rel, "\u2199", "\\swarrow", true); + defineSymbol(math, main, rel, "\u21BD", "\\leftharpoondown", true); + defineSymbol(math, main, rel, "\u21C1", "\\rightharpoondown", true); + defineSymbol(math, main, rel, "\u2196", "\\nwarrow", true); + defineSymbol(math, main, rel, "\u21CC", "\\rightleftharpoons", true); + defineSymbol(math, ams, rel, "\u226E", "\\nless", true); + defineSymbol(math, ams, rel, "\uE010", "\\@nleqslant"); + defineSymbol(math, ams, rel, "\uE011", "\\@nleqq"); + defineSymbol(math, ams, rel, "\u2A87", "\\lneq", true); + defineSymbol(math, ams, rel, "\u2268", "\\lneqq", true); + defineSymbol(math, ams, rel, "\uE00C", "\\@lvertneqq"); + defineSymbol(math, ams, rel, "\u22E6", "\\lnsim", true); + defineSymbol(math, ams, rel, "\u2A89", "\\lnapprox", true); + defineSymbol(math, ams, rel, "\u2280", "\\nprec", true); + defineSymbol(math, ams, rel, "\u22E0", "\\npreceq", true); + defineSymbol(math, ams, rel, "\u22E8", "\\precnsim", true); + defineSymbol(math, ams, rel, "\u2AB9", "\\precnapprox", true); + defineSymbol(math, ams, rel, "\u2241", "\\nsim", true); + defineSymbol(math, ams, rel, "\uE006", "\\@nshortmid"); + defineSymbol(math, ams, rel, "\u2224", "\\nmid", true); + defineSymbol(math, ams, rel, "\u22AC", "\\nvdash", true); + defineSymbol(math, ams, rel, "\u22AD", "\\nvDash", true); + defineSymbol(math, ams, rel, "\u22EA", "\\ntriangleleft"); + defineSymbol(math, ams, rel, "\u22EC", "\\ntrianglelefteq", true); + defineSymbol(math, ams, rel, "\u228A", "\\subsetneq", true); + defineSymbol(math, ams, rel, "\uE01A", "\\@varsubsetneq"); + defineSymbol(math, ams, rel, "\u2ACB", "\\subsetneqq", true); + defineSymbol(math, ams, rel, "\uE017", "\\@varsubsetneqq"); + defineSymbol(math, ams, rel, "\u226F", "\\ngtr", true); + defineSymbol(math, ams, rel, "\uE00F", "\\@ngeqslant"); + defineSymbol(math, ams, rel, "\uE00E", "\\@ngeqq"); + defineSymbol(math, ams, rel, "\u2A88", "\\gneq", true); + defineSymbol(math, ams, rel, "\u2269", "\\gneqq", true); + defineSymbol(math, ams, rel, "\uE00D", "\\@gvertneqq"); + defineSymbol(math, ams, rel, "\u22E7", "\\gnsim", true); + defineSymbol(math, ams, rel, "\u2A8A", "\\gnapprox", true); + defineSymbol(math, ams, rel, "\u2281", "\\nsucc", true); + defineSymbol(math, ams, rel, "\u22E1", "\\nsucceq", true); + defineSymbol(math, ams, rel, "\u22E9", "\\succnsim", true); + defineSymbol(math, ams, rel, "\u2ABA", "\\succnapprox", true); + defineSymbol(math, ams, rel, "\u2246", "\\ncong", true); + defineSymbol(math, ams, rel, "\uE007", "\\@nshortparallel"); + defineSymbol(math, ams, rel, "\u2226", "\\nparallel", true); + defineSymbol(math, ams, rel, "\u22AF", "\\nVDash", true); + defineSymbol(math, ams, rel, "\u22EB", "\\ntriangleright"); + defineSymbol(math, ams, rel, "\u22ED", "\\ntrianglerighteq", true); + defineSymbol(math, ams, rel, "\uE018", "\\@nsupseteqq"); + defineSymbol(math, ams, rel, "\u228B", "\\supsetneq", true); + defineSymbol(math, ams, rel, "\uE01B", "\\@varsupsetneq"); + defineSymbol(math, ams, rel, "\u2ACC", "\\supsetneqq", true); + defineSymbol(math, ams, rel, "\uE019", "\\@varsupsetneqq"); + defineSymbol(math, ams, rel, "\u22AE", "\\nVdash", true); + defineSymbol(math, ams, rel, "\u2AB5", "\\precneqq", true); + defineSymbol(math, ams, rel, "\u2AB6", "\\succneqq", true); + defineSymbol(math, ams, rel, "\uE016", "\\@nsubseteqq"); + defineSymbol(math, ams, bin, "\u22B4", "\\unlhd"); + defineSymbol(math, ams, bin, "\u22B5", "\\unrhd"); + defineSymbol(math, ams, rel, "\u219A", "\\nleftarrow", true); + defineSymbol(math, ams, rel, "\u219B", "\\nrightarrow", true); + defineSymbol(math, ams, rel, "\u21CD", "\\nLeftarrow", true); + defineSymbol(math, ams, rel, "\u21CF", "\\nRightarrow", true); + defineSymbol(math, ams, rel, "\u21AE", "\\nleftrightarrow", true); + defineSymbol(math, ams, rel, "\u21CE", "\\nLeftrightarrow", true); + defineSymbol(math, ams, rel, "\u25B3", "\\vartriangle"); + defineSymbol(math, ams, textord, "\u210F", "\\hslash"); + defineSymbol(math, ams, textord, "\u25BD", "\\triangledown"); + defineSymbol(math, ams, textord, "\u25CA", "\\lozenge"); + defineSymbol(math, ams, textord, "\u24C8", "\\circledS"); + defineSymbol(math, ams, textord, "\xAE", "\\circledR"); + defineSymbol(text, ams, textord, "\xAE", "\\circledR"); + defineSymbol(math, ams, textord, "\u2221", "\\measuredangle", true); + defineSymbol(math, ams, textord, "\u2204", "\\nexists"); + defineSymbol(math, ams, textord, "\u2127", "\\mho"); + defineSymbol(math, ams, textord, "\u2132", "\\Finv", true); + defineSymbol(math, ams, textord, "\u2141", "\\Game", true); + defineSymbol(math, ams, textord, "\u2035", "\\backprime"); + defineSymbol(math, ams, textord, "\u25B2", "\\blacktriangle"); + defineSymbol(math, ams, textord, "\u25BC", "\\blacktriangledown"); + defineSymbol(math, ams, textord, "\u25A0", "\\blacksquare"); + defineSymbol(math, ams, textord, "\u29EB", "\\blacklozenge"); + defineSymbol(math, ams, textord, "\u2605", "\\bigstar"); + defineSymbol(math, ams, textord, "\u2222", "\\sphericalangle", true); + defineSymbol(math, ams, textord, "\u2201", "\\complement", true); + defineSymbol(math, ams, textord, "\xF0", "\\eth", true); + defineSymbol(text, main, textord, "\xF0", "\xF0"); + defineSymbol(math, ams, textord, "\u2571", "\\diagup"); + defineSymbol(math, ams, textord, "\u2572", "\\diagdown"); + defineSymbol(math, ams, textord, "\u25A1", "\\square"); + defineSymbol(math, ams, textord, "\u25A1", "\\Box"); + defineSymbol(math, ams, textord, "\u25CA", "\\Diamond"); + defineSymbol(math, ams, textord, "\xA5", "\\yen", true); + defineSymbol(text, ams, textord, "\xA5", "\\yen", true); + defineSymbol(math, ams, textord, "\u2713", "\\checkmark", true); + defineSymbol(text, ams, textord, "\u2713", "\\checkmark"); + defineSymbol(math, ams, textord, "\u2136", "\\beth", true); + defineSymbol(math, ams, textord, "\u2138", "\\daleth", true); + defineSymbol(math, ams, textord, "\u2137", "\\gimel", true); + defineSymbol(math, ams, textord, "\u03DD", "\\digamma", true); + defineSymbol(math, ams, textord, "\u03F0", "\\varkappa"); + defineSymbol(math, ams, open, "\u250C", "\\@ulcorner", true); + defineSymbol(math, ams, close, "\u2510", "\\@urcorner", true); + defineSymbol(math, ams, open, "\u2514", "\\@llcorner", true); + defineSymbol(math, ams, close, "\u2518", "\\@lrcorner", true); + defineSymbol(math, ams, rel, "\u2266", "\\leqq", true); + defineSymbol(math, ams, rel, "\u2A7D", "\\leqslant", true); + defineSymbol(math, ams, rel, "\u2A95", "\\eqslantless", true); + defineSymbol(math, ams, rel, "\u2272", "\\lesssim", true); + defineSymbol(math, ams, rel, "\u2A85", "\\lessapprox", true); + defineSymbol(math, ams, rel, "\u224A", "\\approxeq", true); + defineSymbol(math, ams, bin, "\u22D6", "\\lessdot"); + defineSymbol(math, ams, rel, "\u22D8", "\\lll", true); + defineSymbol(math, ams, rel, "\u2276", "\\lessgtr", true); + defineSymbol(math, ams, rel, "\u22DA", "\\lesseqgtr", true); + defineSymbol(math, ams, rel, "\u2A8B", "\\lesseqqgtr", true); + defineSymbol(math, ams, rel, "\u2251", "\\doteqdot"); + defineSymbol(math, ams, rel, "\u2253", "\\risingdotseq", true); + defineSymbol(math, ams, rel, "\u2252", "\\fallingdotseq", true); + defineSymbol(math, ams, rel, "\u223D", "\\backsim", true); + defineSymbol(math, ams, rel, "\u22CD", "\\backsimeq", true); + defineSymbol(math, ams, rel, "\u2AC5", "\\subseteqq", true); + defineSymbol(math, ams, rel, "\u22D0", "\\Subset", true); + defineSymbol(math, ams, rel, "\u228F", "\\sqsubset", true); + defineSymbol(math, ams, rel, "\u227C", "\\preccurlyeq", true); + defineSymbol(math, ams, rel, "\u22DE", "\\curlyeqprec", true); + defineSymbol(math, ams, rel, "\u227E", "\\precsim", true); + defineSymbol(math, ams, rel, "\u2AB7", "\\precapprox", true); + defineSymbol(math, ams, rel, "\u22B2", "\\vartriangleleft"); + defineSymbol(math, ams, rel, "\u22B4", "\\trianglelefteq"); + defineSymbol(math, ams, rel, "\u22A8", "\\vDash", true); + defineSymbol(math, ams, rel, "\u22AA", "\\Vvdash", true); + defineSymbol(math, ams, rel, "\u2323", "\\smallsmile"); + defineSymbol(math, ams, rel, "\u2322", "\\smallfrown"); + defineSymbol(math, ams, rel, "\u224F", "\\bumpeq", true); + defineSymbol(math, ams, rel, "\u224E", "\\Bumpeq", true); + defineSymbol(math, ams, rel, "\u2267", "\\geqq", true); + defineSymbol(math, ams, rel, "\u2A7E", "\\geqslant", true); + defineSymbol(math, ams, rel, "\u2A96", "\\eqslantgtr", true); + defineSymbol(math, ams, rel, "\u2273", "\\gtrsim", true); + defineSymbol(math, ams, rel, "\u2A86", "\\gtrapprox", true); + defineSymbol(math, ams, bin, "\u22D7", "\\gtrdot"); + defineSymbol(math, ams, rel, "\u22D9", "\\ggg", true); + defineSymbol(math, ams, rel, "\u2277", "\\gtrless", true); + defineSymbol(math, ams, rel, "\u22DB", "\\gtreqless", true); + defineSymbol(math, ams, rel, "\u2A8C", "\\gtreqqless", true); + defineSymbol(math, ams, rel, "\u2256", "\\eqcirc", true); + defineSymbol(math, ams, rel, "\u2257", "\\circeq", true); + defineSymbol(math, ams, rel, "\u225C", "\\triangleq", true); + defineSymbol(math, ams, rel, "\u223C", "\\thicksim"); + defineSymbol(math, ams, rel, "\u2248", "\\thickapprox"); + defineSymbol(math, ams, rel, "\u2AC6", "\\supseteqq", true); + defineSymbol(math, ams, rel, "\u22D1", "\\Supset", true); + defineSymbol(math, ams, rel, "\u2290", "\\sqsupset", true); + defineSymbol(math, ams, rel, "\u227D", "\\succcurlyeq", true); + defineSymbol(math, ams, rel, "\u22DF", "\\curlyeqsucc", true); + defineSymbol(math, ams, rel, "\u227F", "\\succsim", true); + defineSymbol(math, ams, rel, "\u2AB8", "\\succapprox", true); + defineSymbol(math, ams, rel, "\u22B3", "\\vartriangleright"); + defineSymbol(math, ams, rel, "\u22B5", "\\trianglerighteq"); + defineSymbol(math, ams, rel, "\u22A9", "\\Vdash", true); + defineSymbol(math, ams, rel, "\u2223", "\\shortmid"); + defineSymbol(math, ams, rel, "\u2225", "\\shortparallel"); + defineSymbol(math, ams, rel, "\u226C", "\\between", true); + defineSymbol(math, ams, rel, "\u22D4", "\\pitchfork", true); + defineSymbol(math, ams, rel, "\u221D", "\\varpropto"); + defineSymbol(math, ams, rel, "\u25C0", "\\blacktriangleleft"); + defineSymbol(math, ams, rel, "\u2234", "\\therefore", true); + defineSymbol(math, ams, rel, "\u220D", "\\backepsilon"); + defineSymbol(math, ams, rel, "\u25B6", "\\blacktriangleright"); + defineSymbol(math, ams, rel, "\u2235", "\\because", true); + defineSymbol(math, ams, rel, "\u22D8", "\\llless"); + defineSymbol(math, ams, rel, "\u22D9", "\\gggtr"); + defineSymbol(math, ams, bin, "\u22B2", "\\lhd"); + defineSymbol(math, ams, bin, "\u22B3", "\\rhd"); + defineSymbol(math, ams, rel, "\u2242", "\\eqsim", true); + defineSymbol(math, main, rel, "\u22C8", "\\Join"); + defineSymbol(math, ams, rel, "\u2251", "\\Doteq", true); + defineSymbol(math, ams, bin, "\u2214", "\\dotplus", true); + defineSymbol(math, ams, bin, "\u2216", "\\smallsetminus"); + defineSymbol(math, ams, bin, "\u22D2", "\\Cap", true); + defineSymbol(math, ams, bin, "\u22D3", "\\Cup", true); + defineSymbol(math, ams, bin, "\u2A5E", "\\doublebarwedge", true); + defineSymbol(math, ams, bin, "\u229F", "\\boxminus", true); + defineSymbol(math, ams, bin, "\u229E", "\\boxplus", true); + defineSymbol(math, ams, bin, "\u22C7", "\\divideontimes", true); + defineSymbol(math, ams, bin, "\u22C9", "\\ltimes", true); + defineSymbol(math, ams, bin, "\u22CA", "\\rtimes", true); + defineSymbol(math, ams, bin, "\u22CB", "\\leftthreetimes", true); + defineSymbol(math, ams, bin, "\u22CC", "\\rightthreetimes", true); + defineSymbol(math, ams, bin, "\u22CF", "\\curlywedge", true); + defineSymbol(math, ams, bin, "\u22CE", "\\curlyvee", true); + defineSymbol(math, ams, bin, "\u229D", "\\circleddash", true); + defineSymbol(math, ams, bin, "\u229B", "\\circledast", true); + defineSymbol(math, ams, bin, "\u22C5", "\\centerdot"); + defineSymbol(math, ams, bin, "\u22BA", "\\intercal", true); + defineSymbol(math, ams, bin, "\u22D2", "\\doublecap"); + defineSymbol(math, ams, bin, "\u22D3", "\\doublecup"); + defineSymbol(math, ams, bin, "\u22A0", "\\boxtimes", true); + defineSymbol(math, ams, rel, "\u21E2", "\\dashrightarrow", true); + defineSymbol(math, ams, rel, "\u21E0", "\\dashleftarrow", true); + defineSymbol(math, ams, rel, "\u21C7", "\\leftleftarrows", true); + defineSymbol(math, ams, rel, "\u21C6", "\\leftrightarrows", true); + defineSymbol(math, ams, rel, "\u21DA", "\\Lleftarrow", true); + defineSymbol(math, ams, rel, "\u219E", "\\twoheadleftarrow", true); + defineSymbol(math, ams, rel, "\u21A2", "\\leftarrowtail", true); + defineSymbol(math, ams, rel, "\u21AB", "\\looparrowleft", true); + defineSymbol(math, ams, rel, "\u21CB", "\\leftrightharpoons", true); + defineSymbol(math, ams, rel, "\u21B6", "\\curvearrowleft", true); + defineSymbol(math, ams, rel, "\u21BA", "\\circlearrowleft", true); + defineSymbol(math, ams, rel, "\u21B0", "\\Lsh", true); + defineSymbol(math, ams, rel, "\u21C8", "\\upuparrows", true); + defineSymbol(math, ams, rel, "\u21BF", "\\upharpoonleft", true); + defineSymbol(math, ams, rel, "\u21C3", "\\downharpoonleft", true); + defineSymbol(math, main, rel, "\u22B6", "\\origof", true); + defineSymbol(math, main, rel, "\u22B7", "\\imageof", true); + defineSymbol(math, ams, rel, "\u22B8", "\\multimap", true); + defineSymbol(math, ams, rel, "\u21AD", "\\leftrightsquigarrow", true); + defineSymbol(math, ams, rel, "\u21C9", "\\rightrightarrows", true); + defineSymbol(math, ams, rel, "\u21C4", "\\rightleftarrows", true); + defineSymbol(math, ams, rel, "\u21A0", "\\twoheadrightarrow", true); + defineSymbol(math, ams, rel, "\u21A3", "\\rightarrowtail", true); + defineSymbol(math, ams, rel, "\u21AC", "\\looparrowright", true); + defineSymbol(math, ams, rel, "\u21B7", "\\curvearrowright", true); + defineSymbol(math, ams, rel, "\u21BB", "\\circlearrowright", true); + defineSymbol(math, ams, rel, "\u21B1", "\\Rsh", true); + defineSymbol(math, ams, rel, "\u21CA", "\\downdownarrows", true); + defineSymbol(math, ams, rel, "\u21BE", "\\upharpoonright", true); + defineSymbol(math, ams, rel, "\u21C2", "\\downharpoonright", true); + defineSymbol(math, ams, rel, "\u21DD", "\\rightsquigarrow", true); + defineSymbol(math, ams, rel, "\u21DD", "\\leadsto"); + defineSymbol(math, ams, rel, "\u21DB", "\\Rrightarrow", true); + defineSymbol(math, ams, rel, "\u21BE", "\\restriction"); + defineSymbol(math, main, textord, "\u2018", "`"); + defineSymbol(math, main, textord, "$", "\\$"); + defineSymbol(text, main, textord, "$", "\\$"); + defineSymbol(text, main, textord, "$", "\\textdollar"); + defineSymbol(math, main, textord, "%", "\\%"); + defineSymbol(text, main, textord, "%", "\\%"); + defineSymbol(math, main, textord, "_", "\\_"); + defineSymbol(text, main, textord, "_", "\\_"); + defineSymbol(text, main, textord, "_", "\\textunderscore"); + defineSymbol(math, main, textord, "\u2220", "\\angle", true); + defineSymbol(math, main, textord, "\u221E", "\\infty", true); + defineSymbol(math, main, textord, "\u2032", "\\prime"); + defineSymbol(math, main, textord, "\u25B3", "\\triangle"); + defineSymbol(math, main, textord, "\u0393", "\\Gamma", true); + defineSymbol(math, main, textord, "\u0394", "\\Delta", true); + defineSymbol(math, main, textord, "\u0398", "\\Theta", true); + defineSymbol(math, main, textord, "\u039B", "\\Lambda", true); + defineSymbol(math, main, textord, "\u039E", "\\Xi", true); + defineSymbol(math, main, textord, "\u03A0", "\\Pi", true); + defineSymbol(math, main, textord, "\u03A3", "\\Sigma", true); + defineSymbol(math, main, textord, "\u03A5", "\\Upsilon", true); + defineSymbol(math, main, textord, "\u03A6", "\\Phi", true); + defineSymbol(math, main, textord, "\u03A8", "\\Psi", true); + defineSymbol(math, main, textord, "\u03A9", "\\Omega", true); + defineSymbol(math, main, textord, "A", "\u0391"); + defineSymbol(math, main, textord, "B", "\u0392"); + defineSymbol(math, main, textord, "E", "\u0395"); + defineSymbol(math, main, textord, "Z", "\u0396"); + defineSymbol(math, main, textord, "H", "\u0397"); + defineSymbol(math, main, textord, "I", "\u0399"); + defineSymbol(math, main, textord, "K", "\u039A"); + defineSymbol(math, main, textord, "M", "\u039C"); + defineSymbol(math, main, textord, "N", "\u039D"); + defineSymbol(math, main, textord, "O", "\u039F"); + defineSymbol(math, main, textord, "P", "\u03A1"); + defineSymbol(math, main, textord, "T", "\u03A4"); + defineSymbol(math, main, textord, "X", "\u03A7"); + defineSymbol(math, main, textord, "\xAC", "\\neg", true); + defineSymbol(math, main, textord, "\xAC", "\\lnot"); + defineSymbol(math, main, textord, "\u22A4", "\\top"); + defineSymbol(math, main, textord, "\u22A5", "\\bot"); + defineSymbol(math, main, textord, "\u2205", "\\emptyset"); + defineSymbol(math, ams, textord, "\u2205", "\\varnothing"); + defineSymbol(math, main, mathord, "\u03B1", "\\alpha", true); + defineSymbol(math, main, mathord, "\u03B2", "\\beta", true); + defineSymbol(math, main, mathord, "\u03B3", "\\gamma", true); + defineSymbol(math, main, mathord, "\u03B4", "\\delta", true); + defineSymbol(math, main, mathord, "\u03F5", "\\epsilon", true); + defineSymbol(math, main, mathord, "\u03B6", "\\zeta", true); + defineSymbol(math, main, mathord, "\u03B7", "\\eta", true); + defineSymbol(math, main, mathord, "\u03B8", "\\theta", true); + defineSymbol(math, main, mathord, "\u03B9", "\\iota", true); + defineSymbol(math, main, mathord, "\u03BA", "\\kappa", true); + defineSymbol(math, main, mathord, "\u03BB", "\\lambda", true); + defineSymbol(math, main, mathord, "\u03BC", "\\mu", true); + defineSymbol(math, main, mathord, "\u03BD", "\\nu", true); + defineSymbol(math, main, mathord, "\u03BE", "\\xi", true); + defineSymbol(math, main, mathord, "\u03BF", "\\omicron", true); + defineSymbol(math, main, mathord, "\u03C0", "\\pi", true); + defineSymbol(math, main, mathord, "\u03C1", "\\rho", true); + defineSymbol(math, main, mathord, "\u03C3", "\\sigma", true); + defineSymbol(math, main, mathord, "\u03C4", "\\tau", true); + defineSymbol(math, main, mathord, "\u03C5", "\\upsilon", true); + defineSymbol(math, main, mathord, "\u03D5", "\\phi", true); + defineSymbol(math, main, mathord, "\u03C7", "\\chi", true); + defineSymbol(math, main, mathord, "\u03C8", "\\psi", true); + defineSymbol(math, main, mathord, "\u03C9", "\\omega", true); + defineSymbol(math, main, mathord, "\u03B5", "\\varepsilon", true); + defineSymbol(math, main, mathord, "\u03D1", "\\vartheta", true); + defineSymbol(math, main, mathord, "\u03D6", "\\varpi", true); + defineSymbol(math, main, mathord, "\u03F1", "\\varrho", true); + defineSymbol(math, main, mathord, "\u03C2", "\\varsigma", true); + defineSymbol(math, main, mathord, "\u03C6", "\\varphi", true); + defineSymbol(math, main, bin, "\u2217", "*", true); + defineSymbol(math, main, bin, "+", "+"); + defineSymbol(math, main, bin, "\u2212", "-", true); + defineSymbol(math, main, bin, "\u22C5", "\\cdot", true); + defineSymbol(math, main, bin, "\u2218", "\\circ", true); + defineSymbol(math, main, bin, "\xF7", "\\div", true); + defineSymbol(math, main, bin, "\xB1", "\\pm", true); + defineSymbol(math, main, bin, "\xD7", "\\times", true); + defineSymbol(math, main, bin, "\u2229", "\\cap", true); + defineSymbol(math, main, bin, "\u222A", "\\cup", true); + defineSymbol(math, main, bin, "\u2216", "\\setminus", true); + defineSymbol(math, main, bin, "\u2227", "\\land"); + defineSymbol(math, main, bin, "\u2228", "\\lor"); + defineSymbol(math, main, bin, "\u2227", "\\wedge", true); + defineSymbol(math, main, bin, "\u2228", "\\vee", true); + defineSymbol(math, main, textord, "\u221A", "\\surd"); + defineSymbol(math, main, open, "\u27E8", "\\langle", true); + defineSymbol(math, main, open, "\u2223", "\\lvert"); + defineSymbol(math, main, open, "\u2225", "\\lVert"); + defineSymbol(math, main, close, "?", "?"); + defineSymbol(math, main, close, "!", "!"); + defineSymbol(math, main, close, "\u27E9", "\\rangle", true); + defineSymbol(math, main, close, "\u2223", "\\rvert"); + defineSymbol(math, main, close, "\u2225", "\\rVert"); + defineSymbol(math, main, rel, "=", "="); + defineSymbol(math, main, rel, ":", ":"); + defineSymbol(math, main, rel, "\u2248", "\\approx", true); + defineSymbol(math, main, rel, "\u2245", "\\cong", true); + defineSymbol(math, main, rel, "\u2265", "\\ge"); + defineSymbol(math, main, rel, "\u2265", "\\geq", true); + defineSymbol(math, main, rel, "\u2190", "\\gets"); + defineSymbol(math, main, rel, ">", "\\gt", true); + defineSymbol(math, main, rel, "\u2208", "\\in", true); + defineSymbol(math, main, rel, "\uE020", "\\@not"); + defineSymbol(math, main, rel, "\u2282", "\\subset", true); + defineSymbol(math, main, rel, "\u2283", "\\supset", true); + defineSymbol(math, main, rel, "\u2286", "\\subseteq", true); + defineSymbol(math, main, rel, "\u2287", "\\supseteq", true); + defineSymbol(math, ams, rel, "\u2288", "\\nsubseteq", true); + defineSymbol(math, ams, rel, "\u2289", "\\nsupseteq", true); + defineSymbol(math, main, rel, "\u22A8", "\\models"); + defineSymbol(math, main, rel, "\u2190", "\\leftarrow", true); + defineSymbol(math, main, rel, "\u2264", "\\le"); + defineSymbol(math, main, rel, "\u2264", "\\leq", true); + defineSymbol(math, main, rel, "<", "\\lt", true); + defineSymbol(math, main, rel, "\u2192", "\\rightarrow", true); + defineSymbol(math, main, rel, "\u2192", "\\to"); + defineSymbol(math, ams, rel, "\u2271", "\\ngeq", true); + defineSymbol(math, ams, rel, "\u2270", "\\nleq", true); + defineSymbol(math, main, spacing, "\xA0", "\\ "); + defineSymbol(math, main, spacing, "\xA0", "\\space"); + defineSymbol(math, main, spacing, "\xA0", "\\nobreakspace"); + defineSymbol(text, main, spacing, "\xA0", "\\ "); + defineSymbol(text, main, spacing, "\xA0", " "); + defineSymbol(text, main, spacing, "\xA0", "\\space"); + defineSymbol(text, main, spacing, "\xA0", "\\nobreakspace"); + defineSymbol(math, main, spacing, null, "\\nobreak"); + defineSymbol(math, main, spacing, null, "\\allowbreak"); + defineSymbol(math, main, punct, ",", ","); + defineSymbol(math, main, punct, ";", ";"); + defineSymbol(math, ams, bin, "\u22BC", "\\barwedge", true); + defineSymbol(math, ams, bin, "\u22BB", "\\veebar", true); + defineSymbol(math, main, bin, "\u2299", "\\odot", true); + defineSymbol(math, main, bin, "\u2295", "\\oplus", true); + defineSymbol(math, main, bin, "\u2297", "\\otimes", true); + defineSymbol(math, main, textord, "\u2202", "\\partial", true); + defineSymbol(math, main, bin, "\u2298", "\\oslash", true); + defineSymbol(math, ams, bin, "\u229A", "\\circledcirc", true); + defineSymbol(math, ams, bin, "\u22A1", "\\boxdot", true); + defineSymbol(math, main, bin, "\u25B3", "\\bigtriangleup"); + defineSymbol(math, main, bin, "\u25BD", "\\bigtriangledown"); + defineSymbol(math, main, bin, "\u2020", "\\dagger"); + defineSymbol(math, main, bin, "\u22C4", "\\diamond"); + defineSymbol(math, main, bin, "\u22C6", "\\star"); + defineSymbol(math, main, bin, "\u25C3", "\\triangleleft"); + defineSymbol(math, main, bin, "\u25B9", "\\triangleright"); + defineSymbol(math, main, open, "{", "\\{"); + defineSymbol(text, main, textord, "{", "\\{"); + defineSymbol(text, main, textord, "{", "\\textbraceleft"); + defineSymbol(math, main, close, "}", "\\}"); + defineSymbol(text, main, textord, "}", "\\}"); + defineSymbol(text, main, textord, "}", "\\textbraceright"); + defineSymbol(math, main, open, "{", "\\lbrace"); + defineSymbol(math, main, close, "}", "\\rbrace"); + defineSymbol(math, main, open, "[", "\\lbrack", true); + defineSymbol(text, main, textord, "[", "\\lbrack", true); + defineSymbol(math, main, close, "]", "\\rbrack", true); + defineSymbol(text, main, textord, "]", "\\rbrack", true); + defineSymbol(math, main, open, "(", "\\lparen", true); + defineSymbol(math, main, close, ")", "\\rparen", true); + defineSymbol(text, main, textord, "<", "\\textless", true); + defineSymbol(text, main, textord, ">", "\\textgreater", true); + defineSymbol(math, main, open, "\u230A", "\\lfloor", true); + defineSymbol(math, main, close, "\u230B", "\\rfloor", true); + defineSymbol(math, main, open, "\u2308", "\\lceil", true); + defineSymbol(math, main, close, "\u2309", "\\rceil", true); + defineSymbol(math, main, textord, "\\", "\\backslash"); + defineSymbol(math, main, textord, "\u2223", "|"); + defineSymbol(math, main, textord, "\u2223", "\\vert"); + defineSymbol(text, main, textord, "|", "\\textbar", true); + defineSymbol(math, main, textord, "\u2225", "\\|"); + defineSymbol(math, main, textord, "\u2225", "\\Vert"); + defineSymbol(text, main, textord, "\u2225", "\\textbardbl"); + defineSymbol(text, main, textord, "~", "\\textasciitilde"); + defineSymbol(text, main, textord, "\\", "\\textbackslash"); + defineSymbol(text, main, textord, "^", "\\textasciicircum"); + defineSymbol(math, main, rel, "\u2191", "\\uparrow", true); + defineSymbol(math, main, rel, "\u21D1", "\\Uparrow", true); + defineSymbol(math, main, rel, "\u2193", "\\downarrow", true); + defineSymbol(math, main, rel, "\u21D3", "\\Downarrow", true); + defineSymbol(math, main, rel, "\u2195", "\\updownarrow", true); + defineSymbol(math, main, rel, "\u21D5", "\\Updownarrow", true); + defineSymbol(math, main, op, "\u2210", "\\coprod"); + defineSymbol(math, main, op, "\u22C1", "\\bigvee"); + defineSymbol(math, main, op, "\u22C0", "\\bigwedge"); + defineSymbol(math, main, op, "\u2A04", "\\biguplus"); + defineSymbol(math, main, op, "\u22C2", "\\bigcap"); + defineSymbol(math, main, op, "\u22C3", "\\bigcup"); + defineSymbol(math, main, op, "\u222B", "\\int"); + defineSymbol(math, main, op, "\u222B", "\\intop"); + defineSymbol(math, main, op, "\u222C", "\\iint"); + defineSymbol(math, main, op, "\u222D", "\\iiint"); + defineSymbol(math, main, op, "\u220F", "\\prod"); + defineSymbol(math, main, op, "\u2211", "\\sum"); + defineSymbol(math, main, op, "\u2A02", "\\bigotimes"); + defineSymbol(math, main, op, "\u2A01", "\\bigoplus"); + defineSymbol(math, main, op, "\u2A00", "\\bigodot"); + defineSymbol(math, main, op, "\u222E", "\\oint"); + defineSymbol(math, main, op, "\u222F", "\\oiint"); + defineSymbol(math, main, op, "\u2230", "\\oiiint"); + defineSymbol(math, main, op, "\u2A06", "\\bigsqcup"); + defineSymbol(math, main, op, "\u222B", "\\smallint"); + defineSymbol(text, main, inner, "\u2026", "\\textellipsis"); + defineSymbol(math, main, inner, "\u2026", "\\mathellipsis"); + defineSymbol(text, main, inner, "\u2026", "\\ldots", true); + defineSymbol(math, main, inner, "\u2026", "\\ldots", true); + defineSymbol(math, main, inner, "\u22EF", "\\@cdots", true); + defineSymbol(math, main, inner, "\u22F1", "\\ddots", true); + defineSymbol(math, main, textord, "\u22EE", "\\varvdots"); + defineSymbol(text, main, textord, "\u22EE", "\\varvdots"); + defineSymbol(math, main, accent, "\u02CA", "\\acute"); + defineSymbol(math, main, accent, "\u02CB", "\\grave"); + defineSymbol(math, main, accent, "\xA8", "\\ddot"); + defineSymbol(math, main, accent, "~", "\\tilde"); + defineSymbol(math, main, accent, "\u02C9", "\\bar"); + defineSymbol(math, main, accent, "\u02D8", "\\breve"); + defineSymbol(math, main, accent, "\u02C7", "\\check"); + defineSymbol(math, main, accent, "^", "\\hat"); + defineSymbol(math, main, accent, "\u20D7", "\\vec"); + defineSymbol(math, main, accent, "\u02D9", "\\dot"); + defineSymbol(math, main, accent, "\u02DA", "\\mathring"); + defineSymbol(math, main, mathord, "\uE131", "\\@imath"); + defineSymbol(math, main, mathord, "\uE237", "\\@jmath"); + defineSymbol(math, main, textord, "\u0131", "\u0131"); + defineSymbol(math, main, textord, "\u0237", "\u0237"); + defineSymbol(text, main, textord, "\u0131", "\\i", true); + defineSymbol(text, main, textord, "\u0237", "\\j", true); + defineSymbol(text, main, textord, "\xDF", "\\ss", true); + defineSymbol(text, main, textord, "\xE6", "\\ae", true); + defineSymbol(text, main, textord, "\u0153", "\\oe", true); + defineSymbol(text, main, textord, "\xF8", "\\o", true); + defineSymbol(text, main, textord, "\xC6", "\\AE", true); + defineSymbol(text, main, textord, "\u0152", "\\OE", true); + defineSymbol(text, main, textord, "\xD8", "\\O", true); + defineSymbol(text, main, accent, "\u02CA", "\\'"); + defineSymbol(text, main, accent, "\u02CB", "\\`"); + defineSymbol(text, main, accent, "\u02C6", "\\^"); + defineSymbol(text, main, accent, "\u02DC", "\\~"); + defineSymbol(text, main, accent, "\u02C9", "\\="); + defineSymbol(text, main, accent, "\u02D8", "\\u"); + defineSymbol(text, main, accent, "\u02D9", "\\."); + defineSymbol(text, main, accent, "\xB8", "\\c"); + defineSymbol(text, main, accent, "\u02DA", "\\r"); + defineSymbol(text, main, accent, "\u02C7", "\\v"); + defineSymbol(text, main, accent, "\xA8", '\\"'); + defineSymbol(text, main, accent, "\u02DD", "\\H"); + defineSymbol(text, main, accent, "\u25EF", "\\textcircled"); + var ligatures = { "--": true, "---": true, "``": true, "''": true }; + defineSymbol(text, main, textord, "\u2013", "--", true); + defineSymbol(text, main, textord, "\u2013", "\\textendash"); + defineSymbol(text, main, textord, "\u2014", "---", true); + defineSymbol(text, main, textord, "\u2014", "\\textemdash"); + defineSymbol(text, main, textord, "\u2018", "`", true); + defineSymbol(text, main, textord, "\u2018", "\\textquoteleft"); + defineSymbol(text, main, textord, "\u2019", "'", true); + defineSymbol(text, main, textord, "\u2019", "\\textquoteright"); + defineSymbol(text, main, textord, "\u201C", "``", true); + defineSymbol(text, main, textord, "\u201C", "\\textquotedblleft"); + defineSymbol(text, main, textord, "\u201D", "''", true); + defineSymbol(text, main, textord, "\u201D", "\\textquotedblright"); + defineSymbol(math, main, textord, "\xB0", "\\degree", true); + defineSymbol(text, main, textord, "\xB0", "\\degree"); + defineSymbol(text, main, textord, "\xB0", "\\textdegree", true); + defineSymbol(math, main, textord, "\xA3", "\\pounds"); + defineSymbol(math, main, textord, "\xA3", "\\mathsterling", true); + defineSymbol(text, main, textord, "\xA3", "\\pounds"); + defineSymbol(text, main, textord, "\xA3", "\\textsterling", true); + defineSymbol(math, ams, textord, "\u2720", "\\maltese"); + defineSymbol(text, ams, textord, "\u2720", "\\maltese"); + var mathTextSymbols = '0123456789/@."'; + for (var i = 0; i < mathTextSymbols.length; i++) { + var ch = mathTextSymbols.charAt(i); + defineSymbol(math, main, textord, ch, ch); + } + var textSymbols = '0123456789!@*()-=+";:?/.,'; + for (var _i = 0; _i < textSymbols.length; _i++) { + var _ch = textSymbols.charAt(_i); + defineSymbol(text, main, textord, _ch, _ch); + } + var letters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; + for (var _i2 = 0; _i2 < letters.length; _i2++) { + var _ch2 = letters.charAt(_i2); + defineSymbol(math, main, mathord, _ch2, _ch2); + defineSymbol(text, main, textord, _ch2, _ch2); + } + defineSymbol(math, ams, textord, "C", "\u2102"); + defineSymbol(text, ams, textord, "C", "\u2102"); + defineSymbol(math, ams, textord, "H", "\u210D"); + defineSymbol(text, ams, textord, "H", "\u210D"); + defineSymbol(math, ams, textord, "N", "\u2115"); + defineSymbol(text, ams, textord, "N", "\u2115"); + defineSymbol(math, ams, textord, "P", "\u2119"); + defineSymbol(text, ams, textord, "P", "\u2119"); + defineSymbol(math, ams, textord, "Q", "\u211A"); + defineSymbol(text, ams, textord, "Q", "\u211A"); + defineSymbol(math, ams, textord, "R", "\u211D"); + defineSymbol(text, ams, textord, "R", "\u211D"); + defineSymbol(math, ams, textord, "Z", "\u2124"); + defineSymbol(text, ams, textord, "Z", "\u2124"); + defineSymbol(math, main, mathord, "h", "\u210E"); + defineSymbol(text, main, mathord, "h", "\u210E"); + var wideChar = ""; + for (var _i3 = 0; _i3 < letters.length; _i3++) { + var _ch3 = letters.charAt(_i3); + wideChar = String.fromCharCode(55349, 56320 + _i3); + defineSymbol(math, main, mathord, _ch3, wideChar); + defineSymbol(text, main, textord, _ch3, wideChar); + wideChar = String.fromCharCode(55349, 56372 + _i3); + defineSymbol(math, main, mathord, _ch3, wideChar); + defineSymbol(text, main, textord, _ch3, wideChar); + wideChar = String.fromCharCode(55349, 56424 + _i3); + defineSymbol(math, main, mathord, _ch3, wideChar); + defineSymbol(text, main, textord, _ch3, wideChar); + wideChar = String.fromCharCode(55349, 56580 + _i3); + defineSymbol(math, main, mathord, _ch3, wideChar); + defineSymbol(text, main, textord, _ch3, wideChar); + wideChar = String.fromCharCode(55349, 56684 + _i3); + defineSymbol(math, main, mathord, _ch3, wideChar); + defineSymbol(text, main, textord, _ch3, wideChar); + wideChar = String.fromCharCode(55349, 56736 + _i3); + defineSymbol(math, main, mathord, _ch3, wideChar); + defineSymbol(text, main, textord, _ch3, wideChar); + wideChar = String.fromCharCode(55349, 56788 + _i3); + defineSymbol(math, main, mathord, _ch3, wideChar); + defineSymbol(text, main, textord, _ch3, wideChar); + wideChar = String.fromCharCode(55349, 56840 + _i3); + defineSymbol(math, main, mathord, _ch3, wideChar); + defineSymbol(text, main, textord, _ch3, wideChar); + wideChar = String.fromCharCode(55349, 56944 + _i3); + defineSymbol(math, main, mathord, _ch3, wideChar); + defineSymbol(text, main, textord, _ch3, wideChar); + if (_i3 < 26) { + wideChar = String.fromCharCode(55349, 56632 + _i3); + defineSymbol(math, main, mathord, _ch3, wideChar); + defineSymbol(text, main, textord, _ch3, wideChar); + wideChar = String.fromCharCode(55349, 56476 + _i3); + defineSymbol(math, main, mathord, _ch3, wideChar); + defineSymbol(text, main, textord, _ch3, wideChar); + } + } + wideChar = String.fromCharCode(55349, 56668); + defineSymbol(math, main, mathord, "k", wideChar); + defineSymbol(text, main, textord, "k", wideChar); + for (var _i4 = 0; _i4 < 10; _i4++) { + var _ch4 = _i4.toString(); + wideChar = String.fromCharCode(55349, 57294 + _i4); + defineSymbol(math, main, mathord, _ch4, wideChar); + defineSymbol(text, main, textord, _ch4, wideChar); + wideChar = String.fromCharCode(55349, 57314 + _i4); + defineSymbol(math, main, mathord, _ch4, wideChar); + defineSymbol(text, main, textord, _ch4, wideChar); + wideChar = String.fromCharCode(55349, 57324 + _i4); + defineSymbol(math, main, mathord, _ch4, wideChar); + defineSymbol(text, main, textord, _ch4, wideChar); + wideChar = String.fromCharCode(55349, 57334 + _i4); + defineSymbol(math, main, mathord, _ch4, wideChar); + defineSymbol(text, main, textord, _ch4, wideChar); + } + var extraLatin = "\xD0\xDE\xFE"; + for (var _i5 = 0; _i5 < extraLatin.length; _i5++) { + var _ch5 = extraLatin.charAt(_i5); + defineSymbol(math, main, mathord, _ch5, _ch5); + defineSymbol(text, main, textord, _ch5, _ch5); + } + var wideLatinLetterData = [ + ["mathbf", "textbf", "Main-Bold"], + ["mathbf", "textbf", "Main-Bold"], + ["mathnormal", "textit", "Math-Italic"], + ["mathnormal", "textit", "Math-Italic"], + ["boldsymbol", "boldsymbol", "Main-BoldItalic"], + ["boldsymbol", "boldsymbol", "Main-BoldItalic"], + ["mathscr", "textscr", "Script-Regular"], + ["", "", ""], + ["", "", ""], + ["", "", ""], + ["mathfrak", "textfrak", "Fraktur-Regular"], + ["mathfrak", "textfrak", "Fraktur-Regular"], + ["mathbb", "textbb", "AMS-Regular"], + ["mathbb", "textbb", "AMS-Regular"], + ["mathboldfrak", "textboldfrak", "Fraktur-Regular"], + ["mathboldfrak", "textboldfrak", "Fraktur-Regular"], + ["mathsf", "textsf", "SansSerif-Regular"], + ["mathsf", "textsf", "SansSerif-Regular"], + ["mathboldsf", "textboldsf", "SansSerif-Bold"], + ["mathboldsf", "textboldsf", "SansSerif-Bold"], + ["mathitsf", "textitsf", "SansSerif-Italic"], + ["mathitsf", "textitsf", "SansSerif-Italic"], + ["", "", ""], + ["", "", ""], + ["mathtt", "texttt", "Typewriter-Regular"], + ["mathtt", "texttt", "Typewriter-Regular"], + ]; + var wideNumeralData = [ + ["mathbf", "textbf", "Main-Bold"], + ["", "", ""], + ["mathsf", "textsf", "SansSerif-Regular"], + ["mathboldsf", "textboldsf", "SansSerif-Bold"], + ["mathtt", "texttt", "Typewriter-Regular"], + ]; + var wideCharacterFont = function wideCharacterFont(wideChar, mode) { + var H = wideChar.charCodeAt(0); + var L = wideChar.charCodeAt(1); + var codePoint = (H - 55296) * 1024 + (L - 56320) + 65536; + var j = mode === "math" ? 0 : 1; + if (119808 <= codePoint && codePoint < 120484) { + var i = Math.floor((codePoint - 119808) / 26); + return [wideLatinLetterData[i][2], wideLatinLetterData[i][j]]; + } else if (120782 <= codePoint && codePoint <= 120831) { + var _i = Math.floor((codePoint - 120782) / 10); + return [wideNumeralData[_i][2], wideNumeralData[_i][j]]; + } else if (codePoint === 120485 || codePoint === 120486) { + return [wideLatinLetterData[0][2], wideLatinLetterData[0][j]]; + } else if (120486 < codePoint && codePoint < 120782) { + return ["", ""]; + } else { + throw new ParseError("Unsupported character: " + wideChar); + } + }; + var lookupSymbol = function lookupSymbol(value, fontName, mode) { + if (symbols[mode][value] && symbols[mode][value].replace) { + value = symbols[mode][value].replace; + } + return { + value: value, + metrics: getCharacterMetrics(value, fontName, mode), + }; + }; + var makeSymbol = function makeSymbol( + value, + fontName, + mode, + options, + classes, + ) { + var lookup = lookupSymbol(value, fontName, mode); + var metrics = lookup.metrics; + value = lookup.value; + var symbolNode; + if (metrics) { + var italic = metrics.italic; + if (mode === "text" || (options && options.font === "mathit")) { + italic = 0; + } + symbolNode = new SymbolNode( + value, + metrics.height, + metrics.depth, + italic, + metrics.skew, + metrics.width, + classes, + ); + } else { + typeof console !== "undefined" && + console.warn( + "No character metrics " + + ("for '" + + value + + "' in style '" + + fontName + + "' and mode '" + + mode + + "'"), + ); + symbolNode = new SymbolNode(value, 0, 0, 0, 0, 0, classes); + } + if (options) { + symbolNode.maxFontSize = options.sizeMultiplier; + if (options.style.isTight()) { + symbolNode.classes.push("mtight"); + } + var color = options.getColor(); + if (color) { + symbolNode.style.color = color; + } + } + return symbolNode; + }; + var mathsym = function mathsym(value, mode, options, classes) { + if (classes === void 0) { + classes = []; + } + if ( + options.font === "boldsymbol" && + lookupSymbol(value, "Main-Bold", mode).metrics + ) { + return makeSymbol( + value, + "Main-Bold", + mode, + options, + classes.concat(["mathbf"]), + ); + } else if (value === "\\" || symbols[mode][value].font === "main") { + return makeSymbol(value, "Main-Regular", mode, options, classes); + } else { + return makeSymbol( + value, + "AMS-Regular", + mode, + options, + classes.concat(["amsrm"]), + ); + } + }; + var boldsymbol = function boldsymbol(value, mode, options, classes, type) { + if ( + type !== "textord" && + lookupSymbol(value, "Math-BoldItalic", mode).metrics + ) { + return { fontName: "Math-BoldItalic", fontClass: "boldsymbol" }; + } else { + return { fontName: "Main-Bold", fontClass: "mathbf" }; + } + }; + var makeOrd = function makeOrd(group, options, type) { + var mode = group.mode; + var text = group.text; + var classes = ["mord"]; + var isFont = mode === "math" || (mode === "text" && options.font); + var fontOrFamily = isFont ? options.font : options.fontFamily; + var wideFontName = ""; + var wideFontClass = ""; + if (text.charCodeAt(0) === 55349) { + var _wideCharacterFont = wideCharacterFont(text, mode); + var _wideCharacterFont2 = _slicedToArray(_wideCharacterFont, 2); + wideFontName = _wideCharacterFont2[0]; + wideFontClass = _wideCharacterFont2[1]; + } + if (wideFontName.length > 0) { + return makeSymbol( + text, + wideFontName, + mode, + options, + classes.concat(wideFontClass), + ); + } else if (fontOrFamily) { + var fontName; + var fontClasses; + if (fontOrFamily === "boldsymbol") { + var fontData = boldsymbol(text, mode, options, classes, type); + fontName = fontData.fontName; + fontClasses = [fontData.fontClass]; + } else if (isFont) { + fontName = fontMap[fontOrFamily].fontName; + fontClasses = [fontOrFamily]; + } else { + fontName = retrieveTextFontName( + fontOrFamily, + options.fontWeight, + options.fontShape, + ); + fontClasses = [fontOrFamily, options.fontWeight, options.fontShape]; + } + if (lookupSymbol(text, fontName, mode).metrics) { + return makeSymbol( + text, + fontName, + mode, + options, + classes.concat(fontClasses), + ); + } else if ( + ligatures.hasOwnProperty(text) && + fontName.slice(0, 10) === "Typewriter" + ) { + var parts = []; + for (var i = 0; i < text.length; i++) { + parts.push( + makeSymbol( + text[i], + fontName, + mode, + options, + classes.concat(fontClasses), + ), + ); + } + return makeFragment(parts); + } + } + if (type === "mathord") { + return makeSymbol( + text, + "Math-Italic", + mode, + options, + classes.concat(["mathnormal"]), + ); + } else if (type === "textord") { + var font = symbols[mode][text] && symbols[mode][text].font; + if (font === "ams") { + var _fontName = retrieveTextFontName( + "amsrm", + options.fontWeight, + options.fontShape, + ); + return makeSymbol( + text, + _fontName, + mode, + options, + classes.concat("amsrm", options.fontWeight, options.fontShape), + ); + } else if (font === "main" || !font) { + var _fontName2 = retrieveTextFontName( + "textrm", + options.fontWeight, + options.fontShape, + ); + return makeSymbol( + text, + _fontName2, + mode, + options, + classes.concat(options.fontWeight, options.fontShape), + ); + } else { + var _fontName3 = retrieveTextFontName( + font, + options.fontWeight, + options.fontShape, + ); + return makeSymbol( + text, + _fontName3, + mode, + options, + classes.concat(_fontName3, options.fontWeight, options.fontShape), + ); + } + } else { + throw new Error("unexpected type: " + type + " in makeOrd"); + } + }; + var canCombine = function canCombine(prev, next) { + if ( + createClass(prev.classes) !== createClass(next.classes) || + prev.skew !== next.skew || + prev.maxFontSize !== next.maxFontSize + ) { + return false; + } + if (prev.classes.length === 1) { + var cls = prev.classes[0]; + if (cls === "mbin" || cls === "mord") { + return false; + } + } + for (var style in prev.style) { + if ( + prev.style.hasOwnProperty(style) && + prev.style[style] !== next.style[style] + ) { + return false; + } + } + for (var _style in next.style) { + if ( + next.style.hasOwnProperty(_style) && + prev.style[_style] !== next.style[_style] + ) { + return false; + } + } + return true; + }; + var tryCombineChars = function tryCombineChars(chars) { + for (var i = 0; i < chars.length - 1; i++) { + var prev = chars[i]; + var next = chars[i + 1]; + if ( + prev instanceof SymbolNode && + next instanceof SymbolNode && + canCombine(prev, next) + ) { + prev.text += next.text; + prev.height = Math.max(prev.height, next.height); + prev.depth = Math.max(prev.depth, next.depth); + prev.italic = next.italic; + chars.splice(i + 1, 1); + i--; + } + } + return chars; + }; + var sizeElementFromChildren = function sizeElementFromChildren(elem) { + var height = 0; + var depth = 0; + var maxFontSize = 0; + for (var i = 0; i < elem.children.length; i++) { + var child = elem.children[i]; + if (child.height > height) { + height = child.height; + } + if (child.depth > depth) { + depth = child.depth; + } + if (child.maxFontSize > maxFontSize) { + maxFontSize = child.maxFontSize; + } + } + elem.height = height; + elem.depth = depth; + elem.maxFontSize = maxFontSize; + }; + var makeSpan$2 = function makeSpan(classes, children, options, style) { + var span = new Span(classes, children, options, style); + sizeElementFromChildren(span); + return span; + }; + var makeSvgSpan = function makeSvgSpan(classes, children, options, style) { + return new Span(classes, children, options, style); + }; + var makeLineSpan = function makeLineSpan(className, options, thickness) { + var line = makeSpan$2([className], [], options); + line.height = Math.max( + thickness || options.fontMetrics().defaultRuleThickness, + options.minRuleThickness, + ); + line.style.borderBottomWidth = makeEm(line.height); + line.maxFontSize = 1; + return line; + }; + var makeAnchor = function makeAnchor(href, classes, children, options) { + var anchor = new Anchor(href, classes, children, options); + sizeElementFromChildren(anchor); + return anchor; + }; + var makeFragment = function makeFragment(children) { + var fragment = new DocumentFragment(children); + sizeElementFromChildren(fragment); + return fragment; + }; + var wrapFragment = function wrapFragment(group, options) { + if (group instanceof DocumentFragment) { + return makeSpan$2([], [group], options); + } + return group; + }; + var getVListChildrenAndDepth = function getVListChildrenAndDepth(params) { + if (params.positionType === "individualShift") { + var oldChildren = params.children; + var children = [oldChildren[0]]; + var _depth = -oldChildren[0].shift - oldChildren[0].elem.depth; + var currPos = _depth; + for (var i = 1; i < oldChildren.length; i++) { + var diff = -oldChildren[i].shift - currPos - oldChildren[i].elem.depth; + var size = + diff - + (oldChildren[i - 1].elem.height + oldChildren[i - 1].elem.depth); + currPos = currPos + diff; + children.push({ type: "kern", size: size }); + children.push(oldChildren[i]); + } + return { children: children, depth: _depth }; + } + var depth; + if (params.positionType === "top") { + var bottom = params.positionData; + for (var _i = 0; _i < params.children.length; _i++) { + var child = params.children[_i]; + bottom -= + child.type === "kern" + ? child.size + : child.elem.height + child.elem.depth; + } + depth = bottom; + } else if (params.positionType === "bottom") { + depth = -params.positionData; + } else { + var firstChild = params.children[0]; + if (firstChild.type !== "elem") { + throw new Error('First child must have type "elem".'); + } + if (params.positionType === "shift") { + depth = -firstChild.elem.depth - params.positionData; + } else if (params.positionType === "firstBaseline") { + depth = -firstChild.elem.depth; + } else { + throw new Error("Invalid positionType " + params.positionType + "."); + } + } + return { children: params.children, depth: depth }; + }; + var makeVList = function makeVList(params, options) { + var _getVListChildrenAndD = getVListChildrenAndDepth(params), + children = _getVListChildrenAndD.children, + depth = _getVListChildrenAndD.depth; + var pstrutSize = 0; + for (var i = 0; i < children.length; i++) { + var child = children[i]; + if (child.type === "elem") { + var elem = child.elem; + pstrutSize = Math.max(pstrutSize, elem.maxFontSize, elem.height); + } + } + pstrutSize += 2; + var pstrut = makeSpan$2(["pstrut"], []); + pstrut.style.height = makeEm(pstrutSize); + var realChildren = []; + var minPos = depth; + var maxPos = depth; + var currPos = depth; + for (var _i2 = 0; _i2 < children.length; _i2++) { + var _child = children[_i2]; + if (_child.type === "kern") { + currPos += _child.size; + } else { + var _elem = _child.elem; + var classes = _child.wrapperClasses || []; + var style = _child.wrapperStyle || {}; + var childWrap = makeSpan$2(classes, [pstrut, _elem], undefined, style); + childWrap.style.top = makeEm(-pstrutSize - currPos - _elem.depth); + if (_child.marginLeft) { + childWrap.style.marginLeft = _child.marginLeft; + } + if (_child.marginRight) { + childWrap.style.marginRight = _child.marginRight; + } + realChildren.push(childWrap); + currPos += _elem.height + _elem.depth; + } + minPos = Math.min(minPos, currPos); + maxPos = Math.max(maxPos, currPos); + } + var vlist = makeSpan$2(["vlist"], realChildren); + vlist.style.height = makeEm(maxPos); + var rows; + if (minPos < 0) { + var emptySpan = makeSpan$2([], []); + var depthStrut = makeSpan$2(["vlist"], [emptySpan]); + depthStrut.style.height = makeEm(-minPos); + var topStrut = makeSpan$2(["vlist-s"], [new SymbolNode("\u200B")]); + rows = [ + makeSpan$2(["vlist-r"], [vlist, topStrut]), + makeSpan$2(["vlist-r"], [depthStrut]), + ]; + } else { + rows = [makeSpan$2(["vlist-r"], [vlist])]; + } + var vtable = makeSpan$2(["vlist-t"], rows); + if (rows.length === 2) { + vtable.classes.push("vlist-t2"); + } + vtable.height = maxPos; + vtable.depth = -minPos; + return vtable; + }; + var makeGlue = function makeGlue(measurement, options) { + var rule = makeSpan$2(["mspace"], [], options); + var size = calculateSize(measurement, options); + rule.style.marginRight = makeEm(size); + return rule; + }; + var retrieveTextFontName = function retrieveTextFontName( + fontFamily, + fontWeight, + fontShape, + ) { + var baseFontName = ""; + switch (fontFamily) { + case "amsrm": + baseFontName = "AMS"; + break; + case "textrm": + baseFontName = "Main"; + break; + case "textsf": + baseFontName = "SansSerif"; + break; + case "texttt": + baseFontName = "Typewriter"; + break; + default: + baseFontName = fontFamily; + } + var fontStylesName; + if (fontWeight === "textbf" && fontShape === "textit") { + fontStylesName = "BoldItalic"; + } else if (fontWeight === "textbf") { + fontStylesName = "Bold"; + } else if (fontWeight === "textit") { + fontStylesName = "Italic"; + } else { + fontStylesName = "Regular"; + } + return baseFontName + "-" + fontStylesName; + }; + var fontMap = { + mathbf: { variant: "bold", fontName: "Main-Bold" }, + mathrm: { variant: "normal", fontName: "Main-Regular" }, + textit: { variant: "italic", fontName: "Main-Italic" }, + mathit: { variant: "italic", fontName: "Main-Italic" }, + mathnormal: { variant: "italic", fontName: "Math-Italic" }, + mathsfit: { variant: "sans-serif-italic", fontName: "SansSerif-Italic" }, + mathbb: { variant: "double-struck", fontName: "AMS-Regular" }, + mathcal: { variant: "script", fontName: "Caligraphic-Regular" }, + mathfrak: { variant: "fraktur", fontName: "Fraktur-Regular" }, + mathscr: { variant: "script", fontName: "Script-Regular" }, + mathsf: { variant: "sans-serif", fontName: "SansSerif-Regular" }, + mathtt: { variant: "monospace", fontName: "Typewriter-Regular" }, + }; + var svgData = { + vec: ["vec", 0.471, 0.714], + oiintSize1: ["oiintSize1", 0.957, 0.499], + oiintSize2: ["oiintSize2", 1.472, 0.659], + oiiintSize1: ["oiiintSize1", 1.304, 0.499], + oiiintSize2: ["oiiintSize2", 1.98, 0.659], + }; + var staticSvg = function staticSvg(value, options) { + var _svgData$value = _slicedToArray(svgData[value], 3), + pathName = _svgData$value[0], + width = _svgData$value[1], + height = _svgData$value[2]; + var path = new PathNode(pathName); + var svgNode = new SvgNode([path], { + width: makeEm(width), + height: makeEm(height), + style: "width:" + makeEm(width), + viewBox: "0 0 " + 1000 * width + " " + 1000 * height, + preserveAspectRatio: "xMinYMin", + }); + var span = makeSvgSpan(["overlay"], [svgNode], options); + span.height = height; + span.style.height = makeEm(height); + span.style.width = makeEm(width); + return span; + }; + var buildCommon = { + fontMap: fontMap, + makeSymbol: makeSymbol, + mathsym: mathsym, + makeSpan: makeSpan$2, + makeSvgSpan: makeSvgSpan, + makeLineSpan: makeLineSpan, + makeAnchor: makeAnchor, + makeFragment: makeFragment, + wrapFragment: wrapFragment, + makeVList: makeVList, + makeOrd: makeOrd, + makeGlue: makeGlue, + staticSvg: staticSvg, + svgData: svgData, + tryCombineChars: tryCombineChars, + }; + var thinspace = { number: 3, unit: "mu" }; + var mediumspace = { number: 4, unit: "mu" }; + var thickspace = { number: 5, unit: "mu" }; + var spacings = { + mord: { + mop: thinspace, + mbin: mediumspace, + mrel: thickspace, + minner: thinspace, + }, + mop: { + mord: thinspace, + mop: thinspace, + mrel: thickspace, + minner: thinspace, + }, + mbin: { + mord: mediumspace, + mop: mediumspace, + mopen: mediumspace, + minner: mediumspace, + }, + mrel: { + mord: thickspace, + mop: thickspace, + mopen: thickspace, + minner: thickspace, + }, + mopen: {}, + mclose: { + mop: thinspace, + mbin: mediumspace, + mrel: thickspace, + minner: thinspace, + }, + mpunct: { + mord: thinspace, + mop: thinspace, + mrel: thickspace, + mopen: thinspace, + mclose: thinspace, + mpunct: thinspace, + minner: thinspace, + }, + minner: { + mord: thinspace, + mop: thinspace, + mbin: mediumspace, + mrel: thickspace, + mopen: thinspace, + mpunct: thinspace, + minner: thinspace, + }, + }; + var tightSpacings = { + mord: { mop: thinspace }, + mop: { mord: thinspace, mop: thinspace }, + mbin: {}, + mrel: {}, + mopen: {}, + mclose: { mop: thinspace }, + mpunct: {}, + minner: { mop: thinspace }, + }; + var _functions = {}; + var _htmlGroupBuilders = {}; + var _mathmlGroupBuilders = {}; + function defineFunction(_ref) { + var type = _ref.type, + names = _ref.names, + props = _ref.props, + handler = _ref.handler, + htmlBuilder = _ref.htmlBuilder, + mathmlBuilder = _ref.mathmlBuilder; + var data = { + type: type, + numArgs: props.numArgs, + argTypes: props.argTypes, + allowedInArgument: !!props.allowedInArgument, + allowedInText: !!props.allowedInText, + allowedInMath: + props.allowedInMath === undefined ? true : props.allowedInMath, + numOptionalArgs: props.numOptionalArgs || 0, + infix: !!props.infix, + primitive: !!props.primitive, + handler: handler, + }; + for (var i = 0; i < names.length; ++i) { + _functions[names[i]] = data; + } + if (type) { + if (htmlBuilder) { + _htmlGroupBuilders[type] = htmlBuilder; + } + if (mathmlBuilder) { + _mathmlGroupBuilders[type] = mathmlBuilder; + } + } + } + function defineFunctionBuilders(_ref2) { + var type = _ref2.type, + htmlBuilder = _ref2.htmlBuilder, + mathmlBuilder = _ref2.mathmlBuilder; + defineFunction({ + type: type, + names: [], + props: { numArgs: 0 }, + handler: function handler() { + throw new Error("Should never be called."); + }, + htmlBuilder: htmlBuilder, + mathmlBuilder: mathmlBuilder, + }); + } + var normalizeArgument = function normalizeArgument(arg) { + return arg.type === "ordgroup" && arg.body.length === 1 ? arg.body[0] : arg; + }; + var ordargument = function ordargument(arg) { + return arg.type === "ordgroup" ? arg.body : [arg]; + }; + var makeSpan$1 = buildCommon.makeSpan; + var binLeftCanceller = ["leftmost", "mbin", "mopen", "mrel", "mop", "mpunct"]; + var binRightCanceller = ["rightmost", "mrel", "mclose", "mpunct"]; + var styleMap$1 = { + display: Style$1.DISPLAY, + text: Style$1.TEXT, + script: Style$1.SCRIPT, + scriptscript: Style$1.SCRIPTSCRIPT, + }; + var DomEnum = { + mord: "mord", + mop: "mop", + mbin: "mbin", + mrel: "mrel", + mopen: "mopen", + mclose: "mclose", + mpunct: "mpunct", + minner: "minner", + }; + var buildExpression$1 = function buildExpression( + expression, + options, + isRealGroup, + surrounding, + ) { + if (surrounding === void 0) { + surrounding = [null, null]; + } + var groups = []; + for (var i = 0; i < expression.length; i++) { + var output = buildGroup$1(expression[i], options); + if (output instanceof DocumentFragment) { + var children = output.children; + groups.push.apply(groups, _toConsumableArray(children)); + } else { + groups.push(output); + } + } + buildCommon.tryCombineChars(groups); + if (!isRealGroup) { + return groups; + } + var glueOptions = options; + if (expression.length === 1) { + var node = expression[0]; + if (node.type === "sizing") { + glueOptions = options.havingSize(node.size); + } else if (node.type === "styling") { + glueOptions = options.havingStyle(styleMap$1[node.style]); + } + } + var dummyPrev = makeSpan$1([surrounding[0] || "leftmost"], [], options); + var dummyNext = makeSpan$1([surrounding[1] || "rightmost"], [], options); + var isRoot = isRealGroup === "root"; + traverseNonSpaceNodes( + groups, + function (node, prev) { + var prevType = prev.classes[0]; + var type = node.classes[0]; + if (prevType === "mbin" && utils.contains(binRightCanceller, type)) { + prev.classes[0] = "mord"; + } else if ( + type === "mbin" && + utils.contains(binLeftCanceller, prevType) + ) { + node.classes[0] = "mord"; + } + }, + { node: dummyPrev }, + dummyNext, + isRoot, + ); + traverseNonSpaceNodes( + groups, + function (node, prev) { + var prevType = getTypeOfDomTree(prev); + var type = getTypeOfDomTree(node); + var space = + prevType && type + ? node.hasClass("mtight") + ? tightSpacings[prevType][type] + : spacings[prevType][type] + : null; + if (space) { + return buildCommon.makeGlue(space, glueOptions); + } + }, + { node: dummyPrev }, + dummyNext, + isRoot, + ); + return groups; + }; + var traverseNonSpaceNodes = function traverseNonSpaceNodes( + nodes, + callback, + prev, + next, + isRoot, + ) { + if (next) { + nodes.push(next); + } + var i = 0; + for (; i < nodes.length; i++) { + var node = nodes[i]; + var partialGroup = checkPartialGroup(node); + if (partialGroup) { + traverseNonSpaceNodes( + partialGroup.children, + callback, + prev, + null, + isRoot, + ); + continue; + } + var nonspace = !node.hasClass("mspace"); + if (nonspace) { + var result = callback(node, prev.node); + if (result) { + if (prev.insertAfter) { + prev.insertAfter(result); + } else { + nodes.unshift(result); + i++; + } + } + } + if (nonspace) { + prev.node = node; + } else if (isRoot && node.hasClass("newline")) { + prev.node = makeSpan$1(["leftmost"]); + } + prev.insertAfter = (function (index) { + return function (n) { + nodes.splice(index + 1, 0, n); + i++; + }; + })(i); + } + if (next) { + nodes.pop(); + } + }; + var checkPartialGroup = function checkPartialGroup(node) { + if ( + node instanceof DocumentFragment || + node instanceof Anchor || + (node instanceof Span && node.hasClass("enclosing")) + ) { + return node; + } + return null; + }; + var getOutermostNode = function getOutermostNode(node, side) { + var partialGroup = checkPartialGroup(node); + if (partialGroup) { + var children = partialGroup.children; + if (children.length) { + if (side === "right") { + return getOutermostNode(children[children.length - 1], "right"); + } else if (side === "left") { + return getOutermostNode(children[0], "left"); + } + } + } + return node; + }; + var getTypeOfDomTree = function getTypeOfDomTree(node, side) { + if (!node) { + return null; + } + if (side) { + node = getOutermostNode(node, side); + } + return DomEnum[node.classes[0]] || null; + }; + var makeNullDelimiter = function makeNullDelimiter(options, classes) { + var moreClasses = ["nulldelimiter"].concat(options.baseSizingClasses()); + return makeSpan$1(classes.concat(moreClasses)); + }; + var buildGroup$1 = function buildGroup(group, options, baseOptions) { + if (!group) { + return makeSpan$1(); + } + if (_htmlGroupBuilders[group.type]) { + var groupNode = _htmlGroupBuilders[group.type](group, options); + if (baseOptions && options.size !== baseOptions.size) { + groupNode = makeSpan$1( + options.sizingClasses(baseOptions), + [groupNode], + options, + ); + var multiplier = options.sizeMultiplier / baseOptions.sizeMultiplier; + groupNode.height *= multiplier; + groupNode.depth *= multiplier; + } + return groupNode; + } else { + throw new ParseError("Got group of unknown type: '" + group.type + "'"); + } + }; + function buildHTMLUnbreakable(children, options) { + var body = makeSpan$1(["base"], children, options); + var strut = makeSpan$1(["strut"]); + strut.style.height = makeEm(body.height + body.depth); + if (body.depth) { + strut.style.verticalAlign = makeEm(-body.depth); + } + body.children.unshift(strut); + return body; + } + function buildHTML(tree, options) { + var tag = null; + if (tree.length === 1 && tree[0].type === "tag") { + tag = tree[0].tag; + tree = tree[0].body; + } + var expression = buildExpression$1(tree, options, "root"); + var eqnNum; + if (expression.length === 2 && expression[1].hasClass("tag")) { + eqnNum = expression.pop(); + } + var children = []; + var parts = []; + for (var i = 0; i < expression.length; i++) { + parts.push(expression[i]); + if ( + expression[i].hasClass("mbin") || + expression[i].hasClass("mrel") || + expression[i].hasClass("allowbreak") + ) { + var nobreak = false; + while ( + i < expression.length - 1 && + expression[i + 1].hasClass("mspace") && + !expression[i + 1].hasClass("newline") + ) { + i++; + parts.push(expression[i]); + if (expression[i].hasClass("nobreak")) { + nobreak = true; + } + } + if (!nobreak) { + children.push(buildHTMLUnbreakable(parts, options)); + parts = []; + } + } else if (expression[i].hasClass("newline")) { + parts.pop(); + if (parts.length > 0) { + children.push(buildHTMLUnbreakable(parts, options)); + parts = []; + } + children.push(expression[i]); + } + } + if (parts.length > 0) { + children.push(buildHTMLUnbreakable(parts, options)); + } + var tagChild; + if (tag) { + tagChild = buildHTMLUnbreakable(buildExpression$1(tag, options, true)); + tagChild.classes = ["tag"]; + children.push(tagChild); + } else if (eqnNum) { + children.push(eqnNum); + } + var htmlNode = makeSpan$1(["katex-html"], children); + htmlNode.setAttribute("aria-hidden", "true"); + if (tagChild) { + var strut = tagChild.children[0]; + strut.style.height = makeEm(htmlNode.height + htmlNode.depth); + if (htmlNode.depth) { + strut.style.verticalAlign = makeEm(-htmlNode.depth); + } + } + return htmlNode; + } + function newDocumentFragment(children) { + return new DocumentFragment(children); + } + var MathNode = (function () { + function MathNode(type, children, classes) { + _classCallCheck(this, MathNode); + this.type = void 0; + this.attributes = void 0; + this.children = void 0; + this.classes = void 0; + this.type = type; + this.attributes = {}; + this.children = children || []; + this.classes = classes || []; + } + return _createClass(MathNode, [ + { + key: "setAttribute", + value: function setAttribute(name, value) { + this.attributes[name] = value; + }, + }, + { + key: "getAttribute", + value: function getAttribute(name) { + return this.attributes[name]; + }, + }, + { + key: "toNode", + value: function toNode() { + var node = document.createElementNS( + "http://www.w3.org/1998/Math/MathML", + this.type, + ); + for (var attr in this.attributes) { + if (Object.prototype.hasOwnProperty.call(this.attributes, attr)) { + node.setAttribute(attr, this.attributes[attr]); + } + } + if (this.classes.length > 0) { + node.className = createClass(this.classes); + } + for (var i = 0; i < this.children.length; i++) { + if ( + this.children[i] instanceof TextNode && + this.children[i + 1] instanceof TextNode + ) { + var text = + this.children[i].toText() + this.children[++i].toText(); + while (this.children[i + 1] instanceof TextNode) { + text += this.children[++i].toText(); + } + node.appendChild(new TextNode(text).toNode()); + } else { + node.appendChild(this.children[i].toNode()); + } + } + return node; + }, + }, + { + key: "toMarkup", + value: function toMarkup() { + var markup = "<" + this.type; + for (var attr in this.attributes) { + if (Object.prototype.hasOwnProperty.call(this.attributes, attr)) { + markup += " " + attr + '="'; + markup += utils.escape(this.attributes[attr]); + markup += '"'; + } + } + if (this.classes.length > 0) { + markup += + ' class ="' + utils.escape(createClass(this.classes)) + '"'; + } + markup += ">"; + for (var i = 0; i < this.children.length; i++) { + markup += this.children[i].toMarkup(); + } + markup += ""; + return markup; + }, + }, + { + key: "toText", + value: function toText() { + return this.children + .map(function (child) { + return child.toText(); + }) + .join(""); + }, + }, + ]); + })(); + var TextNode = (function () { + function TextNode(text) { + _classCallCheck(this, TextNode); + this.text = void 0; + this.text = text; + } + return _createClass(TextNode, [ + { + key: "toNode", + value: function toNode() { + return document.createTextNode(this.text); + }, + }, + { + key: "toMarkup", + value: function toMarkup() { + return utils.escape(this.toText()); + }, + }, + { + key: "toText", + value: function toText() { + return this.text; + }, + }, + ]); + })(); + var SpaceNode = (function () { + function SpaceNode(width) { + _classCallCheck(this, SpaceNode); + this.width = void 0; + this.character = void 0; + this.width = width; + if (width >= 0.05555 && width <= 0.05556) { + this.character = "\u200A"; + } else if (width >= 0.1666 && width <= 0.1667) { + this.character = "\u2009"; + } else if (width >= 0.2222 && width <= 0.2223) { + this.character = "\u2005"; + } else if (width >= 0.2777 && width <= 0.2778) { + this.character = "\u2005\u200A"; + } else if (width >= -0.05556 && width <= -0.05555) { + this.character = "\u200A\u2063"; + } else if (width >= -0.1667 && width <= -0.1666) { + this.character = "\u2009\u2063"; + } else if (width >= -0.2223 && width <= -0.2222) { + this.character = "\u205F\u2063"; + } else if (width >= -0.2778 && width <= -0.2777) { + this.character = "\u2005\u2063"; + } else { + this.character = null; + } + } + return _createClass(SpaceNode, [ + { + key: "toNode", + value: function toNode() { + if (this.character) { + return document.createTextNode(this.character); + } else { + var node = document.createElementNS( + "http://www.w3.org/1998/Math/MathML", + "mspace", + ); + node.setAttribute("width", makeEm(this.width)); + return node; + } + }, + }, + { + key: "toMarkup", + value: function toMarkup() { + if (this.character) { + return "" + this.character + ""; + } else { + return ''; + } + }, + }, + { + key: "toText", + value: function toText() { + if (this.character) { + return this.character; + } else { + return " "; + } + }, + }, + ]); + })(); + var mathMLTree = { + MathNode: MathNode, + TextNode: TextNode, + SpaceNode: SpaceNode, + newDocumentFragment: newDocumentFragment, + }; + var makeText = function makeText(text, mode, options) { + if ( + symbols[mode][text] && + symbols[mode][text].replace && + text.charCodeAt(0) !== 55349 && + !( + ligatures.hasOwnProperty(text) && + options && + ((options.fontFamily && options.fontFamily.slice(4, 6) === "tt") || + (options.font && options.font.slice(4, 6) === "tt")) + ) + ) { + text = symbols[mode][text].replace; + } + return new mathMLTree.TextNode(text); + }; + var makeRow = function makeRow(body) { + if (body.length === 1) { + return body[0]; + } else { + return new mathMLTree.MathNode("mrow", body); + } + }; + var getVariant = function getVariant(group, options) { + if (options.fontFamily === "texttt") { + return "monospace"; + } else if (options.fontFamily === "textsf") { + if (options.fontShape === "textit" && options.fontWeight === "textbf") { + return "sans-serif-bold-italic"; + } else if (options.fontShape === "textit") { + return "sans-serif-italic"; + } else if (options.fontWeight === "textbf") { + return "bold-sans-serif"; + } else { + return "sans-serif"; + } + } else if ( + options.fontShape === "textit" && + options.fontWeight === "textbf" + ) { + return "bold-italic"; + } else if (options.fontShape === "textit") { + return "italic"; + } else if (options.fontWeight === "textbf") { + return "bold"; + } + var font = options.font; + if (!font || font === "mathnormal") { + return null; + } + var mode = group.mode; + if (font === "mathit") { + return "italic"; + } else if (font === "boldsymbol") { + return group.type === "textord" ? "bold" : "bold-italic"; + } else if (font === "mathbf") { + return "bold"; + } else if (font === "mathbb") { + return "double-struck"; + } else if (font === "mathsfit") { + return "sans-serif-italic"; + } else if (font === "mathfrak") { + return "fraktur"; + } else if (font === "mathscr" || font === "mathcal") { + return "script"; + } else if (font === "mathsf") { + return "sans-serif"; + } else if (font === "mathtt") { + return "monospace"; + } + var text = group.text; + if (utils.contains(["\\imath", "\\jmath"], text)) { + return null; + } + if (symbols[mode][text] && symbols[mode][text].replace) { + text = symbols[mode][text].replace; + } + var fontName = buildCommon.fontMap[font].fontName; + if (getCharacterMetrics(text, fontName, mode)) { + return buildCommon.fontMap[font].variant; + } + return null; + }; + function isNumberPunctuation(group) { + if (!group) { + return false; + } + if (group.type === "mi" && group.children.length === 1) { + var child = group.children[0]; + return child instanceof TextNode && child.text === "."; + } else if ( + group.type === "mo" && + group.children.length === 1 && + group.getAttribute("separator") === "true" && + group.getAttribute("lspace") === "0em" && + group.getAttribute("rspace") === "0em" + ) { + var _child = group.children[0]; + return _child instanceof TextNode && _child.text === ","; + } else { + return false; + } + } + var buildExpression = function buildExpression( + expression, + options, + isOrdgroup, + ) { + if (expression.length === 1) { + var group = buildGroup(expression[0], options); + if (isOrdgroup && group instanceof MathNode && group.type === "mo") { + group.setAttribute("lspace", "0em"); + group.setAttribute("rspace", "0em"); + } + return [group]; + } + var groups = []; + var lastGroup; + for (var i = 0; i < expression.length; i++) { + var _group = buildGroup(expression[i], options); + if (_group instanceof MathNode && lastGroup instanceof MathNode) { + if ( + _group.type === "mtext" && + lastGroup.type === "mtext" && + _group.getAttribute("mathvariant") === + lastGroup.getAttribute("mathvariant") + ) { + var _lastGroup$children; + (_lastGroup$children = lastGroup.children).push.apply( + _lastGroup$children, + _toConsumableArray(_group.children), + ); + continue; + } else if (_group.type === "mn" && lastGroup.type === "mn") { + var _lastGroup$children2; + (_lastGroup$children2 = lastGroup.children).push.apply( + _lastGroup$children2, + _toConsumableArray(_group.children), + ); + continue; + } else if (isNumberPunctuation(_group) && lastGroup.type === "mn") { + var _lastGroup$children3; + (_lastGroup$children3 = lastGroup.children).push.apply( + _lastGroup$children3, + _toConsumableArray(_group.children), + ); + continue; + } else if (_group.type === "mn" && isNumberPunctuation(lastGroup)) { + _group.children = [].concat( + _toConsumableArray(lastGroup.children), + _toConsumableArray(_group.children), + ); + groups.pop(); + } else if ( + (_group.type === "msup" || _group.type === "msub") && + _group.children.length >= 1 && + (lastGroup.type === "mn" || isNumberPunctuation(lastGroup)) + ) { + var base = _group.children[0]; + if (base instanceof MathNode && base.type === "mn") { + base.children = [].concat( + _toConsumableArray(lastGroup.children), + _toConsumableArray(base.children), + ); + groups.pop(); + } + } else if (lastGroup.type === "mi" && lastGroup.children.length === 1) { + var lastChild = lastGroup.children[0]; + if ( + lastChild instanceof TextNode && + lastChild.text === "\u0338" && + (_group.type === "mo" || + _group.type === "mi" || + _group.type === "mn") + ) { + var child = _group.children[0]; + if (child instanceof TextNode && child.text.length > 0) { + child.text = + child.text.slice(0, 1) + "\u0338" + child.text.slice(1); + groups.pop(); + } + } + } + } + groups.push(_group); + lastGroup = _group; + } + return groups; + }; + var buildExpressionRow = function buildExpressionRow( + expression, + options, + isOrdgroup, + ) { + return makeRow(buildExpression(expression, options, isOrdgroup)); + }; + var buildGroup = function buildGroup(group, options) { + if (!group) { + return new mathMLTree.MathNode("mrow"); + } + if (_mathmlGroupBuilders[group.type]) { + var result = _mathmlGroupBuilders[group.type](group, options); + return result; + } else { + throw new ParseError("Got group of unknown type: '" + group.type + "'"); + } + }; + function buildMathML( + tree, + texExpression, + options, + isDisplayMode, + forMathmlOnly, + ) { + var expression = buildExpression(tree, options); + var wrapper; + if ( + expression.length === 1 && + expression[0] instanceof MathNode && + utils.contains(["mrow", "mtable"], expression[0].type) + ) { + wrapper = expression[0]; + } else { + wrapper = new mathMLTree.MathNode("mrow", expression); + } + var annotation = new mathMLTree.MathNode("annotation", [ + new mathMLTree.TextNode(texExpression), + ]); + annotation.setAttribute("encoding", "application/x-tex"); + var semantics = new mathMLTree.MathNode("semantics", [wrapper, annotation]); + var math = new mathMLTree.MathNode("math", [semantics]); + math.setAttribute("xmlns", "http://www.w3.org/1998/Math/MathML"); + if (isDisplayMode) { + math.setAttribute("display", "block"); + } + var wrapperClass = forMathmlOnly ? "katex" : "katex-mathml"; + return buildCommon.makeSpan([wrapperClass], [math]); + } + var optionsFromSettings = function optionsFromSettings(settings) { + return new Options({ + style: settings.displayMode ? Style$1.DISPLAY : Style$1.TEXT, + maxSize: settings.maxSize, + minRuleThickness: settings.minRuleThickness, + }); + }; + var displayWrap = function displayWrap(node, settings) { + if (settings.displayMode) { + var classes = ["katex-display"]; + if (settings.leqno) { + classes.push("leqno"); + } + if (settings.fleqn) { + classes.push("fleqn"); + } + node = buildCommon.makeSpan(classes, [node]); + } + return node; + }; + var buildTree = function buildTree(tree, expression, settings) { + var options = optionsFromSettings(settings); + var katexNode; + if (settings.output === "mathml") { + return buildMathML(tree, expression, options, settings.displayMode, true); + } else if (settings.output === "html") { + var htmlNode = buildHTML(tree, options); + katexNode = buildCommon.makeSpan(["katex"], [htmlNode]); + } else { + var mathMLNode = buildMathML( + tree, + expression, + options, + settings.displayMode, + false, + ); + var _htmlNode = buildHTML(tree, options); + katexNode = buildCommon.makeSpan(["katex"], [mathMLNode, _htmlNode]); + } + return displayWrap(katexNode, settings); + }; + var stretchyCodePoint = { + widehat: "^", + widecheck: "\u02C7", + widetilde: "~", + utilde: "~", + overleftarrow: "\u2190", + underleftarrow: "\u2190", + xleftarrow: "\u2190", + overrightarrow: "\u2192", + underrightarrow: "\u2192", + xrightarrow: "\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", + xleftrightharpoons: "\u21CB", + xtwoheadleftarrow: "\u219E", + xtwoheadrightarrow: "\u21A0", + xlongequal: "=", + xtofrom: "\u21C4", + xrightleftarrows: "\u21C4", + xrightequilibrium: "\u21CC", + xleftequilibrium: "\u21CB", + "\\cdrightarrow": "\u2192", + "\\cdleftarrow": "\u2190", + "\\cdlongequal": "=", + }; + var mathMLnode = function mathMLnode(label) { + var node = new mathMLTree.MathNode("mo", [ + new mathMLTree.TextNode(stretchyCodePoint[label.replace(/^\\/, "")]), + ]); + node.setAttribute("stretchy", "true"); + return node; + }; + var katexImagesData = { + 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"], + "\\cdrightarrow": [["rightarrow"], 3, 522, "xMaxYMin"], + xleftarrow: [["leftarrow"], 1.469, 522, "xMinYMin"], + "\\cdleftarrow": [["leftarrow"], 3, 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"], + "\\cdlongequal": [["longequal"], 3, 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], + xLeftrightarrow: [["doubleleftarrow", "doublerightarrow"], 1.75, 560], + xrightleftharpoons: [ + ["leftharpoondownplus", "rightharpoonplus"], + 1.75, + 716, + ], + xleftrightharpoons: [ + ["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], + xrightleftarrows: [["baraboveleftarrow", "rightarrowabovebar"], 1.75, 901], + xrightequilibrium: [ + ["baraboveshortleftharpoon", "rightharpoonaboveshortbar"], + 1.75, + 716, + ], + xleftequilibrium: [ + ["shortbaraboveleftharpoon", "shortrightharpoonabovebar"], + 1.75, + 716, + ], + }; + var groupLength = function groupLength(arg) { + if (arg.type === "ordgroup") { + return arg.body.length; + } else { + return 1; + } + }; + var svgSpan = function svgSpan(group, options) { + function buildSvgSpan_() { + var viewBoxWidth = 400000; + var label = group.label.slice(1); + if ( + utils.contains(["widehat", "widecheck", "widetilde", "utilde"], label) + ) { + var grp = group; + var numChars = groupLength(grp.base); + var viewBoxHeight; + var pathName; + var _height; + if (numChars > 5) { + if (label === "widehat" || label === "widecheck") { + viewBoxHeight = 420; + viewBoxWidth = 2364; + _height = 0.42; + pathName = label + "4"; + } else { + viewBoxHeight = 312; + viewBoxWidth = 2340; + _height = 0.34; + pathName = "tilde4"; + } + } else { + var imgIndex = [1, 1, 2, 2, 3, 3][numChars]; + if (label === "widehat" || label === "widecheck") { + viewBoxWidth = [0, 1062, 2364, 2364, 2364][imgIndex]; + viewBoxHeight = [0, 239, 300, 360, 420][imgIndex]; + _height = [0, 0.24, 0.3, 0.3, 0.36, 0.42][imgIndex]; + pathName = label + imgIndex; + } else { + viewBoxWidth = [0, 600, 1033, 2339, 2340][imgIndex]; + viewBoxHeight = [0, 260, 286, 306, 312][imgIndex]; + _height = [0, 0.26, 0.286, 0.3, 0.306, 0.34][imgIndex]; + pathName = "tilde" + imgIndex; + } + } + var path = new PathNode(pathName); + var svgNode = new SvgNode([path], { + width: "100%", + height: makeEm(_height), + viewBox: "0 0 " + viewBoxWidth + " " + viewBoxHeight, + preserveAspectRatio: "none", + }); + return { + span: buildCommon.makeSvgSpan([], [svgNode], options), + minWidth: 0, + height: _height, + }; + } else { + var spans = []; + var data = katexImagesData[label]; + var _data = _slicedToArray(data, 3), + paths = _data[0], + _minWidth = _data[1], + _viewBoxHeight = _data[2]; + var _height2 = _viewBoxHeight / 1000; + var numSvgChildren = paths.length; + var widthClasses; + var aligns; + if (numSvgChildren === 1) { + var align1 = data[3]; + widthClasses = ["hide-tail"]; + aligns = [align1]; + } else if (numSvgChildren === 2) { + widthClasses = ["halfarrow-left", "halfarrow-right"]; + aligns = ["xMinYMin", "xMaxYMin"]; + } else if (numSvgChildren === 3) { + widthClasses = ["brace-left", "brace-center", "brace-right"]; + aligns = ["xMinYMin", "xMidYMin", "xMaxYMin"]; + } else { + throw new Error( + "Correct katexImagesData or update code here to support\n " + + numSvgChildren + + " children.", + ); + } + for (var i = 0; i < numSvgChildren; i++) { + var _path = new PathNode(paths[i]); + var _svgNode = new SvgNode([_path], { + width: "400em", + height: makeEm(_height2), + viewBox: "0 0 " + viewBoxWidth + " " + _viewBoxHeight, + preserveAspectRatio: aligns[i] + " slice", + }); + var _span = buildCommon.makeSvgSpan( + [widthClasses[i]], + [_svgNode], + options, + ); + if (numSvgChildren === 1) { + return { span: _span, minWidth: _minWidth, height: _height2 }; + } else { + _span.style.height = makeEm(_height2); + spans.push(_span); + } + } + return { + span: buildCommon.makeSpan(["stretchy"], spans, options), + minWidth: _minWidth, + height: _height2, + }; + } + } + var _buildSvgSpan_ = buildSvgSpan_(), + span = _buildSvgSpan_.span, + minWidth = _buildSvgSpan_.minWidth, + height = _buildSvgSpan_.height; + span.height = height; + span.style.height = makeEm(height); + if (minWidth > 0) { + span.style.minWidth = makeEm(minWidth); + } + return span; + }; + var encloseSpan = function encloseSpan( + inner, + label, + topPad, + bottomPad, + options, + ) { + var img; + var totalHeight = inner.height + inner.depth + topPad + bottomPad; + if (/fbox|color|angl/.test(label)) { + img = buildCommon.makeSpan(["stretchy", label], [], options); + if (label === "fbox") { + var color = options.color && options.getColor(); + if (color) { + img.style.borderColor = color; + } + } + } else { + var lines = []; + if (/^[bx]cancel$/.test(label)) { + lines.push( + new LineNode({ + x1: "0", + y1: "0", + x2: "100%", + y2: "100%", + "stroke-width": "0.046em", + }), + ); + } + if (/^x?cancel$/.test(label)) { + lines.push( + new LineNode({ + x1: "0", + y1: "100%", + x2: "100%", + y2: "0", + "stroke-width": "0.046em", + }), + ); + } + var svgNode = new SvgNode(lines, { + width: "100%", + height: makeEm(totalHeight), + }); + img = buildCommon.makeSvgSpan([], [svgNode], options); + } + img.height = totalHeight; + img.style.height = makeEm(totalHeight); + return img; + }; + var stretchy = { + encloseSpan: encloseSpan, + mathMLnode: mathMLnode, + svgSpan: svgSpan, + }; + function assertNodeType(node, type) { + if (!node || node.type !== type) { + throw new Error( + "Expected node of type " + + type + + ", but got " + + (node ? "node of type " + node.type : String(node)), + ); + } + return node; + } + function assertSymbolNodeType(node) { + var typedNode = checkSymbolNodeType(node); + if (!typedNode) { + throw new Error( + "Expected node of symbol group type, but got " + + (node ? "node of type " + node.type : String(node)), + ); + } + return typedNode; + } + function checkSymbolNodeType(node) { + if (node && (node.type === "atom" || NON_ATOMS.hasOwnProperty(node.type))) { + return node; + } + return null; + } + var htmlBuilder$a = function htmlBuilder$a(grp, options) { + var base; + var group; + var supSubGroup; + if (grp && grp.type === "supsub") { + group = assertNodeType(grp.base, "accent"); + base = group.base; + grp.base = base; + supSubGroup = assertSpan(buildGroup$1(grp, options)); + grp.base = group; + } else { + group = assertNodeType(grp, "accent"); + base = group.base; + } + var body = buildGroup$1(base, options.havingCrampedStyle()); + var mustShift = group.isShifty && utils.isCharacterBox(base); + var skew = 0; + if (mustShift) { + var baseChar = utils.getBaseElem(base); + var baseGroup = buildGroup$1(baseChar, options.havingCrampedStyle()); + skew = assertSymbolDomNode(baseGroup).skew; + } + var accentBelow = group.label === "\\c"; + var clearance = accentBelow + ? body.height + body.depth + : Math.min(body.height, options.fontMetrics().xHeight); + var accentBody; + if (!group.isStretchy) { + var accent; + var width; + if (group.label === "\\vec") { + accent = buildCommon.staticSvg("vec", options); + width = buildCommon.svgData.vec[1]; + } else { + accent = buildCommon.makeOrd( + { mode: group.mode, text: group.label }, + options, + "textord", + ); + accent = assertSymbolDomNode(accent); + accent.italic = 0; + width = accent.width; + if (accentBelow) { + clearance += accent.depth; + } + } + accentBody = buildCommon.makeSpan(["accent-body"], [accent]); + var accentFull = group.label === "\\textcircled"; + if (accentFull) { + accentBody.classes.push("accent-full"); + clearance = body.height; + } + var left = skew; + if (!accentFull) { + left -= width / 2; + } + accentBody.style.left = makeEm(left); + if (group.label === "\\textcircled") { + accentBody.style.top = ".2em"; + } + accentBody = buildCommon.makeVList( + { + positionType: "firstBaseline", + children: [ + { type: "elem", elem: body }, + { type: "kern", size: -clearance }, + { type: "elem", elem: accentBody }, + ], + }, + options, + ); + } else { + accentBody = stretchy.svgSpan(group, options); + accentBody = buildCommon.makeVList( + { + positionType: "firstBaseline", + children: [ + { type: "elem", elem: body }, + { + type: "elem", + elem: accentBody, + wrapperClasses: ["svg-align"], + wrapperStyle: + skew > 0 + ? { + width: "calc(100% - " + makeEm(2 * skew) + ")", + marginLeft: makeEm(2 * skew), + } + : undefined, + }, + ], + }, + options, + ); + } + var accentWrap = buildCommon.makeSpan( + ["mord", "accent"], + [accentBody], + options, + ); + if (supSubGroup) { + supSubGroup.children[0] = accentWrap; + supSubGroup.height = Math.max(accentWrap.height, supSubGroup.height); + supSubGroup.classes[0] = "mord"; + return supSubGroup; + } else { + return accentWrap; + } + }; + var mathmlBuilder$9 = function mathmlBuilder$9(group, options) { + var accentNode = group.isStretchy + ? stretchy.mathMLnode(group.label) + : new mathMLTree.MathNode("mo", [makeText(group.label, group.mode)]); + var node = new mathMLTree.MathNode("mover", [ + buildGroup(group.base, options), + accentNode, + ]); + node.setAttribute("accent", "true"); + return node; + }; + var NON_STRETCHY_ACCENT_REGEX = new RegExp( + [ + "\\acute", + "\\grave", + "\\ddot", + "\\tilde", + "\\bar", + "\\breve", + "\\check", + "\\hat", + "\\vec", + "\\dot", + "\\mathring", + ] + .map(function (accent) { + return "\\" + accent; + }) + .join("|"), + ); + defineFunction({ + type: "accent", + names: [ + "\\acute", + "\\grave", + "\\ddot", + "\\tilde", + "\\bar", + "\\breve", + "\\check", + "\\hat", + "\\vec", + "\\dot", + "\\mathring", + "\\widecheck", + "\\widehat", + "\\widetilde", + "\\overrightarrow", + "\\overleftarrow", + "\\Overrightarrow", + "\\overleftrightarrow", + "\\overgroup", + "\\overlinesegment", + "\\overleftharpoon", + "\\overrightharpoon", + ], + props: { numArgs: 1 }, + handler: function handler(context, args) { + var base = normalizeArgument(args[0]); + var isStretchy = !NON_STRETCHY_ACCENT_REGEX.test(context.funcName); + var isShifty = + !isStretchy || + context.funcName === "\\widehat" || + context.funcName === "\\widetilde" || + context.funcName === "\\widecheck"; + return { + type: "accent", + mode: context.parser.mode, + label: context.funcName, + isStretchy: isStretchy, + isShifty: isShifty, + base: base, + }; + }, + htmlBuilder: htmlBuilder$a, + mathmlBuilder: mathmlBuilder$9, + }); + defineFunction({ + type: "accent", + names: [ + "\\'", + "\\`", + "\\^", + "\\~", + "\\=", + "\\u", + "\\.", + '\\"', + "\\c", + "\\r", + "\\H", + "\\v", + "\\textcircled", + ], + props: { + numArgs: 1, + allowedInText: true, + allowedInMath: true, + argTypes: ["primitive"], + }, + handler: function handler(context, args) { + var base = args[0]; + var mode = context.parser.mode; + if (mode === "math") { + context.parser.settings.reportNonstrict( + "mathVsTextAccents", + "LaTeX's accent " + context.funcName + " works only in text mode", + ); + mode = "text"; + } + return { + type: "accent", + mode: mode, + label: context.funcName, + isStretchy: false, + isShifty: true, + base: base, + }; + }, + htmlBuilder: htmlBuilder$a, + mathmlBuilder: mathmlBuilder$9, + }); + defineFunction({ + type: "accentUnder", + names: [ + "\\underleftarrow", + "\\underrightarrow", + "\\underleftrightarrow", + "\\undergroup", + "\\underlinesegment", + "\\utilde", + ], + props: { numArgs: 1 }, + handler: function handler(_ref, args) { + var parser = _ref.parser, + funcName = _ref.funcName; + var base = args[0]; + return { + type: "accentUnder", + mode: parser.mode, + label: funcName, + base: base, + }; + }, + htmlBuilder: function htmlBuilder(group, options) { + var innerGroup = buildGroup$1(group.base, options); + var accentBody = stretchy.svgSpan(group, options); + var kern = group.label === "\\utilde" ? 0.12 : 0; + var vlist = buildCommon.makeVList( + { + positionType: "top", + positionData: innerGroup.height, + children: [ + { type: "elem", elem: accentBody, wrapperClasses: ["svg-align"] }, + { type: "kern", size: kern }, + { type: "elem", elem: innerGroup }, + ], + }, + options, + ); + return buildCommon.makeSpan(["mord", "accentunder"], [vlist], options); + }, + mathmlBuilder: function mathmlBuilder(group, options) { + var accentNode = stretchy.mathMLnode(group.label); + var node = new mathMLTree.MathNode("munder", [ + buildGroup(group.base, options), + accentNode, + ]); + node.setAttribute("accentunder", "true"); + return node; + }, + }); + var paddedNode = function paddedNode(group) { + var node = new mathMLTree.MathNode("mpadded", group ? [group] : []); + node.setAttribute("width", "+0.6em"); + node.setAttribute("lspace", "0.3em"); + return node; + }; + defineFunction({ + type: "xArrow", + names: [ + "\\xleftarrow", + "\\xrightarrow", + "\\xLeftarrow", + "\\xRightarrow", + "\\xleftrightarrow", + "\\xLeftrightarrow", + "\\xhookleftarrow", + "\\xhookrightarrow", + "\\xmapsto", + "\\xrightharpoondown", + "\\xrightharpoonup", + "\\xleftharpoondown", + "\\xleftharpoonup", + "\\xrightleftharpoons", + "\\xleftrightharpoons", + "\\xlongequal", + "\\xtwoheadrightarrow", + "\\xtwoheadleftarrow", + "\\xtofrom", + "\\xrightleftarrows", + "\\xrightequilibrium", + "\\xleftequilibrium", + "\\\\cdrightarrow", + "\\\\cdleftarrow", + "\\\\cdlongequal", + ], + props: { numArgs: 1, numOptionalArgs: 1 }, + handler: function handler(_ref, args, optArgs) { + var parser = _ref.parser, + funcName = _ref.funcName; + return { + type: "xArrow", + mode: parser.mode, + label: funcName, + body: args[0], + below: optArgs[0], + }; + }, + htmlBuilder: function htmlBuilder(group, options) { + var style = options.style; + var newOptions = options.havingStyle(style.sup()); + var upperGroup = buildCommon.wrapFragment( + buildGroup$1(group.body, newOptions, options), + options, + ); + var arrowPrefix = group.label.slice(0, 2) === "\\x" ? "x" : "cd"; + upperGroup.classes.push(arrowPrefix + "-arrow-pad"); + var lowerGroup; + if (group.below) { + newOptions = options.havingStyle(style.sub()); + lowerGroup = buildCommon.wrapFragment( + buildGroup$1(group.below, newOptions, options), + options, + ); + lowerGroup.classes.push(arrowPrefix + "-arrow-pad"); + } + var arrowBody = stretchy.svgSpan(group, options); + var arrowShift = + -options.fontMetrics().axisHeight + 0.5 * arrowBody.height; + var upperShift = + -options.fontMetrics().axisHeight - 0.5 * arrowBody.height - 0.111; + if (upperGroup.depth > 0.25 || group.label === "\\xleftequilibrium") { + upperShift -= upperGroup.depth; + } + var vlist; + if (lowerGroup) { + var lowerShift = + -options.fontMetrics().axisHeight + + lowerGroup.height + + 0.5 * arrowBody.height + + 0.111; + vlist = buildCommon.makeVList( + { + positionType: "individualShift", + children: [ + { type: "elem", elem: upperGroup, shift: upperShift }, + { type: "elem", elem: arrowBody, shift: arrowShift }, + { type: "elem", elem: lowerGroup, shift: lowerShift }, + ], + }, + options, + ); + } else { + vlist = buildCommon.makeVList( + { + positionType: "individualShift", + children: [ + { type: "elem", elem: upperGroup, shift: upperShift }, + { type: "elem", elem: arrowBody, shift: arrowShift }, + ], + }, + options, + ); + } + vlist.children[0].children[0].children[1].classes.push("svg-align"); + return buildCommon.makeSpan(["mrel", "x-arrow"], [vlist], options); + }, + mathmlBuilder: function mathmlBuilder(group, options) { + var arrowNode = stretchy.mathMLnode(group.label); + arrowNode.setAttribute( + "minsize", + group.label.charAt(0) === "x" ? "1.75em" : "3.0em", + ); + var node; + if (group.body) { + var upperNode = paddedNode(buildGroup(group.body, options)); + if (group.below) { + var lowerNode = paddedNode(buildGroup(group.below, options)); + node = new mathMLTree.MathNode("munderover", [ + arrowNode, + lowerNode, + upperNode, + ]); + } else { + node = new mathMLTree.MathNode("mover", [arrowNode, upperNode]); + } + } else if (group.below) { + var _lowerNode = paddedNode(buildGroup(group.below, options)); + node = new mathMLTree.MathNode("munder", [arrowNode, _lowerNode]); + } else { + node = paddedNode(); + node = new mathMLTree.MathNode("mover", [arrowNode, node]); + } + return node; + }, + }); + var makeSpan = buildCommon.makeSpan; + function htmlBuilder$9(group, options) { + var elements = buildExpression$1(group.body, options, true); + return makeSpan([group.mclass], elements, options); + } + function mathmlBuilder$8(group, options) { + var node; + var inner = buildExpression(group.body, options); + if (group.mclass === "minner") { + node = new mathMLTree.MathNode("mpadded", inner); + } else if (group.mclass === "mord") { + if (group.isCharacterBox) { + node = inner[0]; + node.type = "mi"; + } else { + node = new mathMLTree.MathNode("mi", inner); + } + } else { + if (group.isCharacterBox) { + node = inner[0]; + node.type = "mo"; + } else { + node = new mathMLTree.MathNode("mo", inner); + } + if (group.mclass === "mbin") { + node.attributes.lspace = "0.22em"; + node.attributes.rspace = "0.22em"; + } else if (group.mclass === "mpunct") { + node.attributes.lspace = "0em"; + node.attributes.rspace = "0.17em"; + } else if (group.mclass === "mopen" || group.mclass === "mclose") { + node.attributes.lspace = "0em"; + node.attributes.rspace = "0em"; + } else if (group.mclass === "minner") { + node.attributes.lspace = "0.0556em"; + node.attributes.width = "+0.1111em"; + } + } + return node; + } + defineFunction({ + type: "mclass", + names: [ + "\\mathord", + "\\mathbin", + "\\mathrel", + "\\mathopen", + "\\mathclose", + "\\mathpunct", + "\\mathinner", + ], + props: { numArgs: 1, primitive: true }, + handler: function handler(_ref, args) { + var parser = _ref.parser, + funcName = _ref.funcName; + var body = args[0]; + return { + type: "mclass", + mode: parser.mode, + mclass: "m" + funcName.slice(5), + body: ordargument(body), + isCharacterBox: utils.isCharacterBox(body), + }; + }, + htmlBuilder: htmlBuilder$9, + mathmlBuilder: mathmlBuilder$8, + }); + var binrelClass = function binrelClass(arg) { + var atom = arg.type === "ordgroup" && arg.body.length ? arg.body[0] : arg; + if ( + atom.type === "atom" && + (atom.family === "bin" || atom.family === "rel") + ) { + return "m" + atom.family; + } else { + return "mord"; + } + }; + defineFunction({ + type: "mclass", + names: ["\\@binrel"], + props: { numArgs: 2 }, + handler: function handler(_ref2, args) { + var parser = _ref2.parser; + return { + type: "mclass", + mode: parser.mode, + mclass: binrelClass(args[0]), + body: ordargument(args[1]), + isCharacterBox: utils.isCharacterBox(args[1]), + }; + }, + }); + defineFunction({ + type: "mclass", + names: ["\\stackrel", "\\overset", "\\underset"], + props: { numArgs: 2 }, + handler: function handler(_ref3, args) { + var parser = _ref3.parser, + funcName = _ref3.funcName; + var baseArg = args[1]; + var shiftedArg = args[0]; + var mclass; + if (funcName !== "\\stackrel") { + mclass = binrelClass(baseArg); + } else { + mclass = "mrel"; + } + var baseOp = { + type: "op", + mode: baseArg.mode, + limits: true, + alwaysHandleSupSub: true, + parentIsSupSub: false, + symbol: false, + suppressBaseShift: funcName !== "\\stackrel", + body: ordargument(baseArg), + }; + var supsub = { + type: "supsub", + mode: shiftedArg.mode, + base: baseOp, + sup: funcName === "\\underset" ? null : shiftedArg, + sub: funcName === "\\underset" ? shiftedArg : null, + }; + return { + type: "mclass", + mode: parser.mode, + mclass: mclass, + body: [supsub], + isCharacterBox: utils.isCharacterBox(supsub), + }; + }, + htmlBuilder: htmlBuilder$9, + mathmlBuilder: mathmlBuilder$8, + }); + defineFunction({ + type: "pmb", + names: ["\\pmb"], + props: { numArgs: 1, allowedInText: true }, + handler: function handler(_ref, args) { + var parser = _ref.parser; + return { + type: "pmb", + mode: parser.mode, + mclass: binrelClass(args[0]), + body: ordargument(args[0]), + }; + }, + htmlBuilder: function htmlBuilder(group, options) { + var elements = buildExpression$1(group.body, options, true); + var node = buildCommon.makeSpan([group.mclass], elements, options); + node.style.textShadow = "0.02em 0.01em 0.04px"; + return node; + }, + mathmlBuilder: function mathmlBuilder(group, style) { + var inner = buildExpression(group.body, style); + var node = new mathMLTree.MathNode("mstyle", inner); + node.setAttribute("style", "text-shadow: 0.02em 0.01em 0.04px"); + return node; + }, + }); + var cdArrowFunctionName = { + ">": "\\\\cdrightarrow", + "<": "\\\\cdleftarrow", + "=": "\\\\cdlongequal", + A: "\\uparrow", + V: "\\downarrow", + "|": "\\Vert", + ".": "no arrow", + }; + var newCell = function newCell() { + return { type: "styling", body: [], mode: "math", style: "display" }; + }; + var isStartOfArrow = function isStartOfArrow(node) { + return node.type === "textord" && node.text === "@"; + }; + var isLabelEnd = function isLabelEnd(node, endChar) { + return ( + (node.type === "mathord" || node.type === "atom") && node.text === endChar + ); + }; + function cdArrow(arrowChar, labels, parser) { + var funcName = cdArrowFunctionName[arrowChar]; + switch (funcName) { + case "\\\\cdrightarrow": + case "\\\\cdleftarrow": + return parser.callFunction(funcName, [labels[0]], [labels[1]]); + case "\\uparrow": + case "\\downarrow": { + var leftLabel = parser.callFunction("\\\\cdleft", [labels[0]], []); + var bareArrow = { + type: "atom", + text: funcName, + mode: "math", + family: "rel", + }; + var sizedArrow = parser.callFunction("\\Big", [bareArrow], []); + var rightLabel = parser.callFunction("\\\\cdright", [labels[1]], []); + var arrowGroup = { + type: "ordgroup", + mode: "math", + body: [leftLabel, sizedArrow, rightLabel], + }; + return parser.callFunction("\\\\cdparent", [arrowGroup], []); + } + case "\\\\cdlongequal": + return parser.callFunction("\\\\cdlongequal", [], []); + case "\\Vert": { + var arrow = { type: "textord", text: "\\Vert", mode: "math" }; + return parser.callFunction("\\Big", [arrow], []); + } + default: + return { type: "textord", text: " ", mode: "math" }; + } + } + function parseCD(parser) { + var parsedRows = []; + parser.gullet.beginGroup(); + parser.gullet.macros.set("\\cr", "\\\\\\relax"); + parser.gullet.beginGroup(); + while (true) { + parsedRows.push(parser.parseExpression(false, "\\\\")); + parser.gullet.endGroup(); + parser.gullet.beginGroup(); + var next = parser.fetch().text; + if (next === "&" || next === "\\\\") { + parser.consume(); + } else if (next === "\\end") { + if (parsedRows[parsedRows.length - 1].length === 0) { + parsedRows.pop(); + } + break; + } else { + throw new ParseError( + "Expected \\\\ or \\cr or \\end", + parser.nextToken, + ); + } + } + var row = []; + var body = [row]; + for (var i = 0; i < parsedRows.length; i++) { + var rowNodes = parsedRows[i]; + var cell = newCell(); + for (var j = 0; j < rowNodes.length; j++) { + if (!isStartOfArrow(rowNodes[j])) { + cell.body.push(rowNodes[j]); + } else { + row.push(cell); + j += 1; + var arrowChar = assertSymbolNodeType(rowNodes[j]).text; + var labels = new Array(2); + labels[0] = { type: "ordgroup", mode: "math", body: [] }; + labels[1] = { type: "ordgroup", mode: "math", body: [] }; + if ("=|.".indexOf(arrowChar) > -1); + else if ("<>AV".indexOf(arrowChar) > -1) { + for (var labelNum = 0; labelNum < 2; labelNum++) { + var inLabel = true; + for (var k = j + 1; k < rowNodes.length; k++) { + if (isLabelEnd(rowNodes[k], arrowChar)) { + inLabel = false; + j = k; + break; + } + if (isStartOfArrow(rowNodes[k])) { + throw new ParseError( + "Missing a " + + arrowChar + + " character to complete a CD arrow.", + rowNodes[k], + ); + } + labels[labelNum].body.push(rowNodes[k]); + } + if (inLabel) { + throw new ParseError( + "Missing a " + + arrowChar + + " character to complete a CD arrow.", + rowNodes[j], + ); + } + } + } else { + throw new ParseError( + 'Expected one of "<>AV=|." after @', + rowNodes[j], + ); + } + var arrow = cdArrow(arrowChar, labels, parser); + var wrappedArrow = { + type: "styling", + body: [arrow], + mode: "math", + style: "display", + }; + row.push(wrappedArrow); + cell = newCell(); + } + } + if (i % 2 === 0) { + row.push(cell); + } else { + row.shift(); + } + row = []; + body.push(row); + } + parser.gullet.endGroup(); + parser.gullet.endGroup(); + var cols = new Array(body[0].length).fill({ + type: "align", + align: "c", + pregap: 0.25, + postgap: 0.25, + }); + return { + type: "array", + mode: "math", + body: body, + arraystretch: 1, + addJot: true, + rowGaps: [null], + cols: cols, + colSeparationType: "CD", + hLinesBeforeRow: new Array(body.length + 1).fill([]), + }; + } + defineFunction({ + type: "cdlabel", + names: ["\\\\cdleft", "\\\\cdright"], + props: { numArgs: 1 }, + handler: function handler(_ref, args) { + var parser = _ref.parser, + funcName = _ref.funcName; + return { + type: "cdlabel", + mode: parser.mode, + side: funcName.slice(4), + label: args[0], + }; + }, + htmlBuilder: function htmlBuilder(group, options) { + var newOptions = options.havingStyle(options.style.sup()); + var label = buildCommon.wrapFragment( + buildGroup$1(group.label, newOptions, options), + options, + ); + label.classes.push("cd-label-" + group.side); + label.style.bottom = makeEm(0.8 - label.depth); + label.height = 0; + label.depth = 0; + return label; + }, + mathmlBuilder: function mathmlBuilder(group, options) { + var label = new mathMLTree.MathNode("mrow", [ + buildGroup(group.label, options), + ]); + label = new mathMLTree.MathNode("mpadded", [label]); + label.setAttribute("width", "0"); + if (group.side === "left") { + label.setAttribute("lspace", "-1width"); + } + label.setAttribute("voffset", "0.7em"); + label = new mathMLTree.MathNode("mstyle", [label]); + label.setAttribute("displaystyle", "false"); + label.setAttribute("scriptlevel", "1"); + return label; + }, + }); + defineFunction({ + type: "cdlabelparent", + names: ["\\\\cdparent"], + props: { numArgs: 1 }, + handler: function handler(_ref2, args) { + var parser = _ref2.parser; + return { type: "cdlabelparent", mode: parser.mode, fragment: args[0] }; + }, + htmlBuilder: function htmlBuilder(group, options) { + var parent = buildCommon.wrapFragment( + buildGroup$1(group.fragment, options), + options, + ); + parent.classes.push("cd-vert-arrow"); + return parent; + }, + mathmlBuilder: function mathmlBuilder(group, options) { + return new mathMLTree.MathNode("mrow", [ + buildGroup(group.fragment, options), + ]); + }, + }); + defineFunction({ + type: "textord", + names: ["\\@char"], + props: { numArgs: 1, allowedInText: true }, + handler: function handler(_ref, args) { + var parser = _ref.parser; + var arg = assertNodeType(args[0], "ordgroup"); + var group = arg.body; + var number = ""; + for (var i = 0; i < group.length; i++) { + var node = assertNodeType(group[i], "textord"); + number += node.text; + } + var code = parseInt(number); + var text; + if (isNaN(code)) { + throw new ParseError("\\@char has non-numeric argument " + number); + } else if (code < 0 || code >= 1114111) { + throw new ParseError("\\@char with invalid code point " + number); + } else if (code <= 65535) { + text = String.fromCharCode(code); + } else { + code -= 65536; + text = String.fromCharCode((code >> 10) + 55296, (code & 1023) + 56320); + } + return { type: "textord", mode: parser.mode, text: text }; + }, + }); + var htmlBuilder$8 = function htmlBuilder$8(group, options) { + var elements = buildExpression$1( + group.body, + options.withColor(group.color), + false, + ); + return buildCommon.makeFragment(elements); + }; + var mathmlBuilder$7 = function mathmlBuilder$7(group, options) { + var inner = buildExpression(group.body, options.withColor(group.color)); + var node = new mathMLTree.MathNode("mstyle", inner); + node.setAttribute("mathcolor", group.color); + return node; + }; + defineFunction({ + type: "color", + names: ["\\textcolor"], + props: { numArgs: 2, allowedInText: true, argTypes: ["color", "original"] }, + handler: function handler(_ref, args) { + var parser = _ref.parser; + var color = assertNodeType(args[0], "color-token").color; + var body = args[1]; + return { + type: "color", + mode: parser.mode, + color: color, + body: ordargument(body), + }; + }, + htmlBuilder: htmlBuilder$8, + mathmlBuilder: mathmlBuilder$7, + }); + defineFunction({ + type: "color", + names: ["\\color"], + props: { numArgs: 1, allowedInText: true, argTypes: ["color"] }, + handler: function handler(_ref2, args) { + var parser = _ref2.parser, + breakOnTokenText = _ref2.breakOnTokenText; + var color = assertNodeType(args[0], "color-token").color; + parser.gullet.macros.set("\\current@color", color); + var body = parser.parseExpression(true, breakOnTokenText); + return { type: "color", mode: parser.mode, color: color, body: body }; + }, + htmlBuilder: htmlBuilder$8, + mathmlBuilder: mathmlBuilder$7, + }); + defineFunction({ + type: "cr", + names: ["\\\\"], + props: { numArgs: 0, numOptionalArgs: 0, allowedInText: true }, + handler: function handler(_ref, args, optArgs) { + var parser = _ref.parser; + var size = + parser.gullet.future().text === "[" + ? parser.parseSizeGroup(true) + : null; + var newLine = + !parser.settings.displayMode || + !parser.settings.useStrictBehavior( + "newLineInDisplayMode", + "In LaTeX, \\\\ or \\newline " + "does nothing in display mode", + ); + return { + type: "cr", + mode: parser.mode, + newLine: newLine, + size: size && assertNodeType(size, "size").value, + }; + }, + htmlBuilder: function htmlBuilder(group, options) { + var span = buildCommon.makeSpan(["mspace"], [], options); + if (group.newLine) { + span.classes.push("newline"); + if (group.size) { + span.style.marginTop = makeEm(calculateSize(group.size, options)); + } + } + return span; + }, + mathmlBuilder: function mathmlBuilder(group, options) { + var node = new mathMLTree.MathNode("mspace"); + if (group.newLine) { + node.setAttribute("linebreak", "newline"); + if (group.size) { + node.setAttribute( + "height", + makeEm(calculateSize(group.size, options)), + ); + } + } + return node; + }, + }); + var globalMap = { + "\\global": "\\global", + "\\long": "\\\\globallong", + "\\\\globallong": "\\\\globallong", + "\\def": "\\gdef", + "\\gdef": "\\gdef", + "\\edef": "\\xdef", + "\\xdef": "\\xdef", + "\\let": "\\\\globallet", + "\\futurelet": "\\\\globalfuture", + }; + var checkControlSequence = function checkControlSequence(tok) { + var name = tok.text; + if (/^(?:[\\{}$&#^_]|EOF)$/.test(name)) { + throw new ParseError("Expected a control sequence", tok); + } + return name; + }; + var getRHS = function getRHS(parser) { + var tok = parser.gullet.popToken(); + if (tok.text === "=") { + tok = parser.gullet.popToken(); + if (tok.text === " ") { + tok = parser.gullet.popToken(); + } + } + return tok; + }; + var letCommand = function letCommand(parser, name, tok, global) { + var macro = parser.gullet.macros.get(tok.text); + if (macro == null) { + tok.noexpand = true; + macro = { + tokens: [tok], + numArgs: 0, + unexpandable: !parser.gullet.isExpandable(tok.text), + }; + } + parser.gullet.macros.set(name, macro, global); + }; + defineFunction({ + type: "internal", + names: ["\\global", "\\long", "\\\\globallong"], + props: { numArgs: 0, allowedInText: true }, + handler: function handler(_ref) { + var parser = _ref.parser, + funcName = _ref.funcName; + parser.consumeSpaces(); + var token = parser.fetch(); + if (globalMap[token.text]) { + if (funcName === "\\global" || funcName === "\\\\globallong") { + token.text = globalMap[token.text]; + } + return assertNodeType(parser.parseFunction(), "internal"); + } + throw new ParseError("Invalid token after macro prefix", token); + }, + }); + defineFunction({ + type: "internal", + names: ["\\def", "\\gdef", "\\edef", "\\xdef"], + props: { numArgs: 0, allowedInText: true, primitive: true }, + handler: function handler(_ref2) { + var parser = _ref2.parser, + funcName = _ref2.funcName; + var tok = parser.gullet.popToken(); + var name = tok.text; + if (/^(?:[\\{}$&#^_]|EOF)$/.test(name)) { + throw new ParseError("Expected a control sequence", tok); + } + var numArgs = 0; + var insert; + var delimiters = [[]]; + while (parser.gullet.future().text !== "{") { + tok = parser.gullet.popToken(); + if (tok.text === "#") { + if (parser.gullet.future().text === "{") { + insert = parser.gullet.future(); + delimiters[numArgs].push("{"); + break; + } + tok = parser.gullet.popToken(); + if (!/^[1-9]$/.test(tok.text)) { + throw new ParseError('Invalid argument number "' + tok.text + '"'); + } + if (parseInt(tok.text) !== numArgs + 1) { + throw new ParseError( + 'Argument number "' + tok.text + '" out of order', + ); + } + numArgs++; + delimiters.push([]); + } else if (tok.text === "EOF") { + throw new ParseError("Expected a macro definition"); + } else { + delimiters[numArgs].push(tok.text); + } + } + var _parser$gullet$consum = parser.gullet.consumeArg(), + tokens = _parser$gullet$consum.tokens; + if (insert) { + tokens.unshift(insert); + } + if (funcName === "\\edef" || funcName === "\\xdef") { + tokens = parser.gullet.expandTokens(tokens); + tokens.reverse(); + } + parser.gullet.macros.set( + name, + { tokens: tokens, numArgs: numArgs, delimiters: delimiters }, + funcName === globalMap[funcName], + ); + return { type: "internal", mode: parser.mode }; + }, + }); + defineFunction({ + type: "internal", + names: ["\\let", "\\\\globallet"], + props: { numArgs: 0, allowedInText: true, primitive: true }, + handler: function handler(_ref3) { + var parser = _ref3.parser, + funcName = _ref3.funcName; + var name = checkControlSequence(parser.gullet.popToken()); + parser.gullet.consumeSpaces(); + var tok = getRHS(parser); + letCommand(parser, name, tok, funcName === "\\\\globallet"); + return { type: "internal", mode: parser.mode }; + }, + }); + defineFunction({ + type: "internal", + names: ["\\futurelet", "\\\\globalfuture"], + props: { numArgs: 0, allowedInText: true, primitive: true }, + handler: function handler(_ref4) { + var parser = _ref4.parser, + funcName = _ref4.funcName; + var name = checkControlSequence(parser.gullet.popToken()); + var middle = parser.gullet.popToken(); + var tok = parser.gullet.popToken(); + letCommand(parser, name, tok, funcName === "\\\\globalfuture"); + parser.gullet.pushToken(tok); + parser.gullet.pushToken(middle); + return { type: "internal", mode: parser.mode }; + }, + }); + var getMetrics = function getMetrics(symbol, font, mode) { + var replace = symbols.math[symbol] && symbols.math[symbol].replace; + var metrics = getCharacterMetrics(replace || symbol, font, mode); + if (!metrics) { + throw new Error( + "Unsupported symbol " + symbol + " and font size " + font + ".", + ); + } + return metrics; + }; + var styleWrap = function styleWrap(delim, toStyle, options, classes) { + var newOptions = options.havingBaseStyle(toStyle); + var span = buildCommon.makeSpan( + classes.concat(newOptions.sizingClasses(options)), + [delim], + options, + ); + var delimSizeMultiplier = + newOptions.sizeMultiplier / options.sizeMultiplier; + span.height *= delimSizeMultiplier; + span.depth *= delimSizeMultiplier; + span.maxFontSize = newOptions.sizeMultiplier; + return span; + }; + var centerSpan = function centerSpan(span, options, style) { + var newOptions = options.havingBaseStyle(style); + var shift = + (1 - options.sizeMultiplier / newOptions.sizeMultiplier) * + options.fontMetrics().axisHeight; + span.classes.push("delimcenter"); + span.style.top = makeEm(shift); + span.height -= shift; + span.depth += shift; + }; + var makeSmallDelim = function makeSmallDelim( + delim, + style, + center, + options, + mode, + classes, + ) { + var text = buildCommon.makeSymbol(delim, "Main-Regular", mode, options); + var span = styleWrap(text, style, options, classes); + if (center) { + centerSpan(span, options, style); + } + return span; + }; + var mathrmSize = function mathrmSize(value, size, mode, options) { + return buildCommon.makeSymbol( + value, + "Size" + size + "-Regular", + mode, + options, + ); + }; + var makeLargeDelim = function makeLargeDelim( + delim, + size, + center, + options, + mode, + classes, + ) { + var inner = mathrmSize(delim, size, mode, options); + var span = styleWrap( + buildCommon.makeSpan(["delimsizing", "size" + size], [inner], options), + Style$1.TEXT, + options, + classes, + ); + if (center) { + centerSpan(span, options, Style$1.TEXT); + } + return span; + }; + var makeGlyphSpan = function makeGlyphSpan(symbol, font, mode) { + var sizeClass; + if (font === "Size1-Regular") { + sizeClass = "delim-size1"; + } else { + sizeClass = "delim-size4"; + } + var corner = buildCommon.makeSpan( + ["delimsizinginner", sizeClass], + [buildCommon.makeSpan([], [buildCommon.makeSymbol(symbol, font, mode)])], + ); + return { type: "elem", elem: corner }; + }; + var makeInner = function makeInner(ch, height, options) { + var width = fontMetricsData["Size4-Regular"][ch.charCodeAt(0)] + ? fontMetricsData["Size4-Regular"][ch.charCodeAt(0)][4] + : fontMetricsData["Size1-Regular"][ch.charCodeAt(0)][4]; + var path = new PathNode("inner", innerPath(ch, Math.round(1000 * height))); + var svgNode = new SvgNode([path], { + width: makeEm(width), + height: makeEm(height), + style: "width:" + makeEm(width), + viewBox: "0 0 " + 1000 * width + " " + Math.round(1000 * height), + preserveAspectRatio: "xMinYMin", + }); + var span = buildCommon.makeSvgSpan([], [svgNode], options); + span.height = height; + span.style.height = makeEm(height); + span.style.width = makeEm(width); + return { type: "elem", elem: span }; + }; + var lapInEms = 0.008; + var lap = { type: "kern", size: -1 * lapInEms }; + var verts = ["|", "\\lvert", "\\rvert", "\\vert"]; + var doubleVerts = ["\\|", "\\lVert", "\\rVert", "\\Vert"]; + var makeStackedDelim = function makeStackedDelim( + delim, + heightTotal, + center, + options, + mode, + classes, + ) { + var top; + var middle; + var repeat; + var bottom; + var svgLabel = ""; + var viewBoxWidth = 0; + top = repeat = bottom = delim; + middle = null; + var font = "Size1-Regular"; + if (delim === "\\uparrow") { + repeat = bottom = "\u23D0"; + } else if (delim === "\\Uparrow") { + repeat = bottom = "\u2016"; + } else if (delim === "\\downarrow") { + top = repeat = "\u23D0"; + } else if (delim === "\\Downarrow") { + top = repeat = "\u2016"; + } else if (delim === "\\updownarrow") { + top = "\\uparrow"; + repeat = "\u23D0"; + bottom = "\\downarrow"; + } else if (delim === "\\Updownarrow") { + top = "\\Uparrow"; + repeat = "\u2016"; + bottom = "\\Downarrow"; + } else if (utils.contains(verts, delim)) { + repeat = "\u2223"; + svgLabel = "vert"; + viewBoxWidth = 333; + } else if (utils.contains(doubleVerts, delim)) { + repeat = "\u2225"; + svgLabel = "doublevert"; + viewBoxWidth = 556; + } else if (delim === "[" || delim === "\\lbrack") { + top = "\u23A1"; + repeat = "\u23A2"; + bottom = "\u23A3"; + font = "Size4-Regular"; + svgLabel = "lbrack"; + viewBoxWidth = 667; + } else if (delim === "]" || delim === "\\rbrack") { + top = "\u23A4"; + repeat = "\u23A5"; + bottom = "\u23A6"; + font = "Size4-Regular"; + svgLabel = "rbrack"; + viewBoxWidth = 667; + } else if (delim === "\\lfloor" || delim === "\u230A") { + repeat = top = "\u23A2"; + bottom = "\u23A3"; + font = "Size4-Regular"; + svgLabel = "lfloor"; + viewBoxWidth = 667; + } else if (delim === "\\lceil" || delim === "\u2308") { + top = "\u23A1"; + repeat = bottom = "\u23A2"; + font = "Size4-Regular"; + svgLabel = "lceil"; + viewBoxWidth = 667; + } else if (delim === "\\rfloor" || delim === "\u230B") { + repeat = top = "\u23A5"; + bottom = "\u23A6"; + font = "Size4-Regular"; + svgLabel = "rfloor"; + viewBoxWidth = 667; + } else if (delim === "\\rceil" || delim === "\u2309") { + top = "\u23A4"; + repeat = bottom = "\u23A5"; + font = "Size4-Regular"; + svgLabel = "rceil"; + viewBoxWidth = 667; + } else if (delim === "(" || delim === "\\lparen") { + top = "\u239B"; + repeat = "\u239C"; + bottom = "\u239D"; + font = "Size4-Regular"; + svgLabel = "lparen"; + viewBoxWidth = 875; + } else if (delim === ")" || delim === "\\rparen") { + top = "\u239E"; + repeat = "\u239F"; + bottom = "\u23A0"; + font = "Size4-Regular"; + svgLabel = "rparen"; + viewBoxWidth = 875; + } else if (delim === "\\{" || delim === "\\lbrace") { + top = "\u23A7"; + middle = "\u23A8"; + bottom = "\u23A9"; + repeat = "\u23AA"; + font = "Size4-Regular"; + } else if (delim === "\\}" || delim === "\\rbrace") { + top = "\u23AB"; + middle = "\u23AC"; + bottom = "\u23AD"; + repeat = "\u23AA"; + font = "Size4-Regular"; + } else if (delim === "\\lgroup" || delim === "\u27EE") { + top = "\u23A7"; + bottom = "\u23A9"; + repeat = "\u23AA"; + font = "Size4-Regular"; + } else if (delim === "\\rgroup" || delim === "\u27EF") { + top = "\u23AB"; + bottom = "\u23AD"; + repeat = "\u23AA"; + font = "Size4-Regular"; + } else if (delim === "\\lmoustache" || delim === "\u23B0") { + top = "\u23A7"; + bottom = "\u23AD"; + repeat = "\u23AA"; + font = "Size4-Regular"; + } else if (delim === "\\rmoustache" || delim === "\u23B1") { + top = "\u23AB"; + bottom = "\u23A9"; + repeat = "\u23AA"; + font = "Size4-Regular"; + } + var topMetrics = getMetrics(top, font, mode); + var topHeightTotal = topMetrics.height + topMetrics.depth; + var repeatMetrics = getMetrics(repeat, font, mode); + var repeatHeightTotal = repeatMetrics.height + repeatMetrics.depth; + var bottomMetrics = getMetrics(bottom, font, mode); + var bottomHeightTotal = bottomMetrics.height + bottomMetrics.depth; + var middleHeightTotal = 0; + var middleFactor = 1; + if (middle !== null) { + var middleMetrics = getMetrics(middle, font, mode); + middleHeightTotal = middleMetrics.height + middleMetrics.depth; + middleFactor = 2; + } + var minHeight = topHeightTotal + bottomHeightTotal + middleHeightTotal; + var repeatCount = Math.max( + 0, + Math.ceil((heightTotal - minHeight) / (middleFactor * repeatHeightTotal)), + ); + var realHeightTotal = + minHeight + repeatCount * middleFactor * repeatHeightTotal; + var axisHeight = options.fontMetrics().axisHeight; + if (center) { + axisHeight *= options.sizeMultiplier; + } + var depth = realHeightTotal / 2 - axisHeight; + var stack = []; + if (svgLabel.length > 0) { + var midHeight = realHeightTotal - topHeightTotal - bottomHeightTotal; + var viewBoxHeight = Math.round(realHeightTotal * 1000); + var pathStr = tallDelim(svgLabel, Math.round(midHeight * 1000)); + var path = new PathNode(svgLabel, pathStr); + var width = (viewBoxWidth / 1000).toFixed(3) + "em"; + var height = (viewBoxHeight / 1000).toFixed(3) + "em"; + var svg = new SvgNode([path], { + width: width, + height: height, + viewBox: "0 0 " + viewBoxWidth + " " + viewBoxHeight, + }); + var wrapper = buildCommon.makeSvgSpan([], [svg], options); + wrapper.height = viewBoxHeight / 1000; + wrapper.style.width = width; + wrapper.style.height = height; + stack.push({ type: "elem", elem: wrapper }); + } else { + stack.push(makeGlyphSpan(bottom, font, mode)); + stack.push(lap); + if (middle === null) { + var innerHeight = + realHeightTotal - topHeightTotal - bottomHeightTotal + 2 * lapInEms; + stack.push(makeInner(repeat, innerHeight, options)); + } else { + var _innerHeight = + (realHeightTotal - + topHeightTotal - + bottomHeightTotal - + middleHeightTotal) / + 2 + + 2 * lapInEms; + stack.push(makeInner(repeat, _innerHeight, options)); + stack.push(lap); + stack.push(makeGlyphSpan(middle, font, mode)); + stack.push(lap); + stack.push(makeInner(repeat, _innerHeight, options)); + } + stack.push(lap); + stack.push(makeGlyphSpan(top, font, mode)); + } + var newOptions = options.havingBaseStyle(Style$1.TEXT); + var inner = buildCommon.makeVList( + { positionType: "bottom", positionData: depth, children: stack }, + newOptions, + ); + return styleWrap( + buildCommon.makeSpan(["delimsizing", "mult"], [inner], newOptions), + Style$1.TEXT, + options, + classes, + ); + }; + var vbPad = 80; + var emPad = 0.08; + var sqrtSvg = function sqrtSvg( + sqrtName, + height, + viewBoxHeight, + extraVinculum, + options, + ) { + var path = sqrtPath(sqrtName, extraVinculum, viewBoxHeight); + var pathNode = new PathNode(sqrtName, path); + var svg = new SvgNode([pathNode], { + width: "400em", + height: makeEm(height), + viewBox: "0 0 400000 " + viewBoxHeight, + preserveAspectRatio: "xMinYMin slice", + }); + return buildCommon.makeSvgSpan(["hide-tail"], [svg], options); + }; + var makeSqrtImage = function makeSqrtImage(height, options) { + var newOptions = options.havingBaseSizing(); + var delim = traverseSequence( + "\\surd", + height * newOptions.sizeMultiplier, + stackLargeDelimiterSequence, + newOptions, + ); + var sizeMultiplier = newOptions.sizeMultiplier; + var extraVinculum = Math.max( + 0, + options.minRuleThickness - options.fontMetrics().sqrtRuleThickness, + ); + var span; + var spanHeight = 0; + var texHeight = 0; + var viewBoxHeight = 0; + var advanceWidth; + if (delim.type === "small") { + viewBoxHeight = 1000 + 1000 * extraVinculum + vbPad; + if (height < 1) { + sizeMultiplier = 1; + } else if (height < 1.4) { + sizeMultiplier = 0.7; + } + spanHeight = (1 + extraVinculum + emPad) / sizeMultiplier; + texHeight = (1 + extraVinculum) / sizeMultiplier; + span = sqrtSvg( + "sqrtMain", + spanHeight, + viewBoxHeight, + extraVinculum, + options, + ); + span.style.minWidth = "0.853em"; + advanceWidth = 0.833 / sizeMultiplier; + } else if (delim.type === "large") { + viewBoxHeight = (1000 + vbPad) * sizeToMaxHeight[delim.size]; + texHeight = + (sizeToMaxHeight[delim.size] + extraVinculum) / sizeMultiplier; + spanHeight = + (sizeToMaxHeight[delim.size] + extraVinculum + emPad) / sizeMultiplier; + span = sqrtSvg( + "sqrtSize" + delim.size, + spanHeight, + viewBoxHeight, + extraVinculum, + options, + ); + span.style.minWidth = "1.02em"; + advanceWidth = 1 / sizeMultiplier; + } else { + spanHeight = height + extraVinculum + emPad; + texHeight = height + extraVinculum; + viewBoxHeight = Math.floor(1000 * height + extraVinculum) + vbPad; + span = sqrtSvg( + "sqrtTall", + spanHeight, + viewBoxHeight, + extraVinculum, + options, + ); + span.style.minWidth = "0.742em"; + advanceWidth = 1.056; + } + span.height = texHeight; + span.style.height = makeEm(spanHeight); + return { + span: span, + advanceWidth: advanceWidth, + ruleWidth: + (options.fontMetrics().sqrtRuleThickness + extraVinculum) * + sizeMultiplier, + }; + }; + var stackLargeDelimiters = [ + "(", + "\\lparen", + ")", + "\\rparen", + "[", + "\\lbrack", + "]", + "\\rbrack", + "\\{", + "\\lbrace", + "\\}", + "\\rbrace", + "\\lfloor", + "\\rfloor", + "\u230A", + "\u230B", + "\\lceil", + "\\rceil", + "\u2308", + "\u2309", + "\\surd", + ]; + var stackAlwaysDelimiters = [ + "\\uparrow", + "\\downarrow", + "\\updownarrow", + "\\Uparrow", + "\\Downarrow", + "\\Updownarrow", + "|", + "\\|", + "\\vert", + "\\Vert", + "\\lvert", + "\\rvert", + "\\lVert", + "\\rVert", + "\\lgroup", + "\\rgroup", + "\u27EE", + "\u27EF", + "\\lmoustache", + "\\rmoustache", + "\u23B0", + "\u23B1", + ]; + var stackNeverDelimiters = [ + "<", + ">", + "\\langle", + "\\rangle", + "/", + "\\backslash", + "\\lt", + "\\gt", + ]; + var sizeToMaxHeight = [0, 1.2, 1.8, 2.4, 3]; + var makeSizedDelim = function makeSizedDelim( + delim, + size, + options, + mode, + classes, + ) { + if (delim === "<" || delim === "\\lt" || delim === "\u27E8") { + delim = "\\langle"; + } else if (delim === ">" || delim === "\\gt" || delim === "\u27E9") { + delim = "\\rangle"; + } + if ( + utils.contains(stackLargeDelimiters, delim) || + utils.contains(stackNeverDelimiters, delim) + ) { + return makeLargeDelim(delim, size, false, options, mode, classes); + } else if (utils.contains(stackAlwaysDelimiters, delim)) { + return makeStackedDelim( + delim, + sizeToMaxHeight[size], + false, + options, + mode, + classes, + ); + } else { + throw new ParseError("Illegal delimiter: '" + delim + "'"); + } + }; + var stackNeverDelimiterSequence = [ + { type: "small", style: Style$1.SCRIPTSCRIPT }, + { type: "small", style: Style$1.SCRIPT }, + { type: "small", style: Style$1.TEXT }, + { type: "large", size: 1 }, + { type: "large", size: 2 }, + { type: "large", size: 3 }, + { type: "large", size: 4 }, + ]; + var stackAlwaysDelimiterSequence = [ + { type: "small", style: Style$1.SCRIPTSCRIPT }, + { type: "small", style: Style$1.SCRIPT }, + { type: "small", style: Style$1.TEXT }, + { type: "stack" }, + ]; + var stackLargeDelimiterSequence = [ + { type: "small", style: Style$1.SCRIPTSCRIPT }, + { type: "small", style: Style$1.SCRIPT }, + { type: "small", style: Style$1.TEXT }, + { type: "large", size: 1 }, + { type: "large", size: 2 }, + { type: "large", size: 3 }, + { type: "large", size: 4 }, + { type: "stack" }, + ]; + var delimTypeToFont = function delimTypeToFont(type) { + if (type.type === "small") { + return "Main-Regular"; + } else if (type.type === "large") { + return "Size" + type.size + "-Regular"; + } else if (type.type === "stack") { + return "Size4-Regular"; + } else { + throw new Error("Add support for delim type '" + type.type + "' here."); + } + }; + var traverseSequence = function traverseSequence( + delim, + height, + sequence, + options, + ) { + var start = Math.min(2, 3 - options.style.size); + for (var i = start; i < sequence.length; i++) { + if (sequence[i].type === "stack") { + break; + } + var metrics = getMetrics(delim, delimTypeToFont(sequence[i]), "math"); + var heightDepth = metrics.height + metrics.depth; + if (sequence[i].type === "small") { + var newOptions = options.havingBaseStyle(sequence[i].style); + heightDepth *= newOptions.sizeMultiplier; + } + if (heightDepth > height) { + return sequence[i]; + } + } + return sequence[sequence.length - 1]; + }; + var makeCustomSizedDelim = function makeCustomSizedDelim( + delim, + height, + center, + options, + mode, + classes, + ) { + if (delim === "<" || delim === "\\lt" || delim === "\u27E8") { + delim = "\\langle"; + } else if (delim === ">" || delim === "\\gt" || delim === "\u27E9") { + delim = "\\rangle"; + } + var sequence; + if (utils.contains(stackNeverDelimiters, delim)) { + sequence = stackNeverDelimiterSequence; + } else if (utils.contains(stackLargeDelimiters, delim)) { + sequence = stackLargeDelimiterSequence; + } else { + sequence = stackAlwaysDelimiterSequence; + } + var delimType = traverseSequence(delim, height, sequence, options); + if (delimType.type === "small") { + return makeSmallDelim( + delim, + delimType.style, + center, + options, + mode, + classes, + ); + } else if (delimType.type === "large") { + return makeLargeDelim( + delim, + delimType.size, + center, + options, + mode, + classes, + ); + } else { + return makeStackedDelim(delim, height, center, options, mode, classes); + } + }; + var makeLeftRightDelim = function makeLeftRightDelim( + delim, + height, + depth, + options, + mode, + classes, + ) { + var axisHeight = options.fontMetrics().axisHeight * options.sizeMultiplier; + var delimiterFactor = 901; + var delimiterExtend = 5 / options.fontMetrics().ptPerEm; + var maxDistFromAxis = Math.max(height - axisHeight, depth + axisHeight); + var totalHeight = Math.max( + (maxDistFromAxis / 500) * delimiterFactor, + 2 * maxDistFromAxis - delimiterExtend, + ); + return makeCustomSizedDelim( + delim, + totalHeight, + true, + options, + mode, + classes, + ); + }; + var delimiter = { + sqrtImage: makeSqrtImage, + sizedDelim: makeSizedDelim, + sizeToMaxHeight: sizeToMaxHeight, + customSizedDelim: makeCustomSizedDelim, + leftRightDelim: makeLeftRightDelim, + }; + var delimiterSizes = { + "\\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 }, + }; + var delimiters = [ + "(", + "\\lparen", + ")", + "\\rparen", + "[", + "\\lbrack", + "]", + "\\rbrack", + "\\{", + "\\lbrace", + "\\}", + "\\rbrace", + "\\lfloor", + "\\rfloor", + "\u230A", + "\u230B", + "\\lceil", + "\\rceil", + "\u2308", + "\u2309", + "<", + ">", + "\\langle", + "\u27E8", + "\\rangle", + "\u27E9", + "\\lt", + "\\gt", + "\\lvert", + "\\rvert", + "\\lVert", + "\\rVert", + "\\lgroup", + "\\rgroup", + "\u27EE", + "\u27EF", + "\\lmoustache", + "\\rmoustache", + "\u23B0", + "\u23B1", + "/", + "\\backslash", + "|", + "\\vert", + "\\|", + "\\Vert", + "\\uparrow", + "\\Uparrow", + "\\downarrow", + "\\Downarrow", + "\\updownarrow", + "\\Updownarrow", + ".", + ]; + function checkDelimiter(delim, context) { + var symDelim = checkSymbolNodeType(delim); + if (symDelim && utils.contains(delimiters, symDelim.text)) { + return symDelim; + } else if (symDelim) { + throw new ParseError( + "Invalid delimiter '" + + symDelim.text + + "' after '" + + context.funcName + + "'", + delim, + ); + } else { + throw new ParseError( + "Invalid delimiter type '" + delim.type + "'", + delim, + ); + } + } + defineFunction({ + type: "delimsizing", + names: [ + "\\bigl", + "\\Bigl", + "\\biggl", + "\\Biggl", + "\\bigr", + "\\Bigr", + "\\biggr", + "\\Biggr", + "\\bigm", + "\\Bigm", + "\\biggm", + "\\Biggm", + "\\big", + "\\Big", + "\\bigg", + "\\Bigg", + ], + props: { numArgs: 1, argTypes: ["primitive"] }, + handler: function handler(context, args) { + var delim = checkDelimiter(args[0], context); + return { + type: "delimsizing", + mode: context.parser.mode, + size: delimiterSizes[context.funcName].size, + mclass: delimiterSizes[context.funcName].mclass, + delim: delim.text, + }; + }, + htmlBuilder: function htmlBuilder(group, options) { + if (group.delim === ".") { + return buildCommon.makeSpan([group.mclass]); + } + return delimiter.sizedDelim( + group.delim, + group.size, + options, + group.mode, + [group.mclass], + ); + }, + mathmlBuilder: function mathmlBuilder(group) { + var children = []; + if (group.delim !== ".") { + children.push(makeText(group.delim, group.mode)); + } + var node = new mathMLTree.MathNode("mo", children); + if (group.mclass === "mopen" || group.mclass === "mclose") { + node.setAttribute("fence", "true"); + } else { + node.setAttribute("fence", "false"); + } + node.setAttribute("stretchy", "true"); + var size = makeEm(delimiter.sizeToMaxHeight[group.size]); + node.setAttribute("minsize", size); + node.setAttribute("maxsize", size); + return node; + }, + }); + function assertParsed(group) { + if (!group.body) { + throw new Error("Bug: The leftright ParseNode wasn't fully parsed."); + } + } + defineFunction({ + type: "leftright-right", + names: ["\\right"], + props: { numArgs: 1, primitive: true }, + handler: function handler(context, args) { + var color = context.parser.gullet.macros.get("\\current@color"); + if (color && typeof color !== "string") { + throw new ParseError("\\current@color set to non-string in \\right"); + } + return { + type: "leftright-right", + mode: context.parser.mode, + delim: checkDelimiter(args[0], context).text, + color: color, + }; + }, + }); + defineFunction({ + type: "leftright", + names: ["\\left"], + props: { numArgs: 1, primitive: true }, + handler: function handler(context, args) { + var delim = checkDelimiter(args[0], context); + var parser = context.parser; + ++parser.leftrightDepth; + var body = parser.parseExpression(false); + --parser.leftrightDepth; + parser.expect("\\right", false); + var right = assertNodeType(parser.parseFunction(), "leftright-right"); + return { + type: "leftright", + mode: parser.mode, + body: body, + left: delim.text, + right: right.delim, + rightColor: right.color, + }; + }, + htmlBuilder: function htmlBuilder(group, options) { + assertParsed(group); + var inner = buildExpression$1(group.body, options, true, [ + "mopen", + "mclose", + ]); + var innerHeight = 0; + var innerDepth = 0; + var hadMiddle = false; + for (var i = 0; i < inner.length; i++) { + if (inner[i].isMiddle) { + hadMiddle = true; + } else { + innerHeight = Math.max(inner[i].height, innerHeight); + innerDepth = Math.max(inner[i].depth, innerDepth); + } + } + innerHeight *= options.sizeMultiplier; + innerDepth *= options.sizeMultiplier; + var leftDelim; + if (group.left === ".") { + leftDelim = makeNullDelimiter(options, ["mopen"]); + } else { + leftDelim = delimiter.leftRightDelim( + group.left, + innerHeight, + innerDepth, + options, + group.mode, + ["mopen"], + ); + } + inner.unshift(leftDelim); + if (hadMiddle) { + for (var _i = 1; _i < inner.length; _i++) { + var middleDelim = inner[_i]; + var isMiddle = middleDelim.isMiddle; + if (isMiddle) { + inner[_i] = delimiter.leftRightDelim( + isMiddle.delim, + innerHeight, + innerDepth, + isMiddle.options, + group.mode, + [], + ); + } + } + } + var rightDelim; + if (group.right === ".") { + rightDelim = makeNullDelimiter(options, ["mclose"]); + } else { + var colorOptions = group.rightColor + ? options.withColor(group.rightColor) + : options; + rightDelim = delimiter.leftRightDelim( + group.right, + innerHeight, + innerDepth, + colorOptions, + group.mode, + ["mclose"], + ); + } + inner.push(rightDelim); + return buildCommon.makeSpan(["minner"], inner, options); + }, + mathmlBuilder: function mathmlBuilder(group, options) { + assertParsed(group); + var inner = buildExpression(group.body, options); + if (group.left !== ".") { + var leftNode = new mathMLTree.MathNode("mo", [ + makeText(group.left, group.mode), + ]); + leftNode.setAttribute("fence", "true"); + inner.unshift(leftNode); + } + if (group.right !== ".") { + var rightNode = new mathMLTree.MathNode("mo", [ + makeText(group.right, group.mode), + ]); + rightNode.setAttribute("fence", "true"); + if (group.rightColor) { + rightNode.setAttribute("mathcolor", group.rightColor); + } + inner.push(rightNode); + } + return makeRow(inner); + }, + }); + defineFunction({ + type: "middle", + names: ["\\middle"], + props: { numArgs: 1, primitive: true }, + handler: function handler(context, args) { + var delim = checkDelimiter(args[0], context); + if (!context.parser.leftrightDepth) { + throw new ParseError("\\middle without preceding \\left", delim); + } + return { type: "middle", mode: context.parser.mode, delim: delim.text }; + }, + htmlBuilder: function htmlBuilder(group, options) { + var middleDelim; + if (group.delim === ".") { + middleDelim = makeNullDelimiter(options, []); + } else { + middleDelim = delimiter.sizedDelim( + group.delim, + 1, + options, + group.mode, + [], + ); + var isMiddle = { delim: group.delim, options: options }; + middleDelim.isMiddle = isMiddle; + } + return middleDelim; + }, + mathmlBuilder: function mathmlBuilder(group, options) { + var textNode = + group.delim === "\\vert" || group.delim === "|" + ? makeText("|", "text") + : makeText(group.delim, group.mode); + var middleNode = new mathMLTree.MathNode("mo", [textNode]); + middleNode.setAttribute("fence", "true"); + middleNode.setAttribute("lspace", "0.05em"); + middleNode.setAttribute("rspace", "0.05em"); + return middleNode; + }, + }); + var htmlBuilder$7 = function htmlBuilder$7(group, options) { + var inner = buildCommon.wrapFragment( + buildGroup$1(group.body, options), + options, + ); + var label = group.label.slice(1); + var scale = options.sizeMultiplier; + var img; + var imgShift = 0; + var isSingleChar = utils.isCharacterBox(group.body); + if (label === "sout") { + img = buildCommon.makeSpan(["stretchy", "sout"]); + img.height = options.fontMetrics().defaultRuleThickness / scale; + imgShift = -0.5 * options.fontMetrics().xHeight; + } else if (label === "phase") { + var lineWeight = calculateSize({ number: 0.6, unit: "pt" }, options); + var clearance = calculateSize({ number: 0.35, unit: "ex" }, options); + var newOptions = options.havingBaseSizing(); + scale = scale / newOptions.sizeMultiplier; + var angleHeight = inner.height + inner.depth + lineWeight + clearance; + inner.style.paddingLeft = makeEm(angleHeight / 2 + lineWeight); + var viewBoxHeight = Math.floor(1000 * angleHeight * scale); + var path = phasePath(viewBoxHeight); + var svgNode = new SvgNode([new PathNode("phase", path)], { + width: "400em", + height: makeEm(viewBoxHeight / 1000), + viewBox: "0 0 400000 " + viewBoxHeight, + preserveAspectRatio: "xMinYMin slice", + }); + img = buildCommon.makeSvgSpan(["hide-tail"], [svgNode], options); + img.style.height = makeEm(angleHeight); + imgShift = inner.depth + lineWeight + clearance; + } else { + if (/cancel/.test(label)) { + if (!isSingleChar) { + inner.classes.push("cancel-pad"); + } + } else if (label === "angl") { + inner.classes.push("anglpad"); + } else { + inner.classes.push("boxpad"); + } + var topPad = 0; + var bottomPad = 0; + var ruleThickness = 0; + if (/box/.test(label)) { + ruleThickness = Math.max( + options.fontMetrics().fboxrule, + options.minRuleThickness, + ); + topPad = + options.fontMetrics().fboxsep + + (label === "colorbox" ? 0 : ruleThickness); + bottomPad = topPad; + } else if (label === "angl") { + ruleThickness = Math.max( + options.fontMetrics().defaultRuleThickness, + options.minRuleThickness, + ); + topPad = 4 * ruleThickness; + bottomPad = Math.max(0, 0.25 - inner.depth); + } else { + topPad = isSingleChar ? 0.2 : 0; + bottomPad = topPad; + } + img = stretchy.encloseSpan(inner, label, topPad, bottomPad, options); + if (/fbox|boxed|fcolorbox/.test(label)) { + img.style.borderStyle = "solid"; + img.style.borderWidth = makeEm(ruleThickness); + } else if (label === "angl" && ruleThickness !== 0.049) { + img.style.borderTopWidth = makeEm(ruleThickness); + img.style.borderRightWidth = makeEm(ruleThickness); + } + imgShift = inner.depth + bottomPad; + if (group.backgroundColor) { + img.style.backgroundColor = group.backgroundColor; + if (group.borderColor) { + img.style.borderColor = group.borderColor; + } + } + } + var vlist; + if (group.backgroundColor) { + vlist = buildCommon.makeVList( + { + positionType: "individualShift", + children: [ + { type: "elem", elem: img, shift: imgShift }, + { type: "elem", elem: inner, shift: 0 }, + ], + }, + options, + ); + } else { + var classes = /cancel|phase/.test(label) ? ["svg-align"] : []; + vlist = buildCommon.makeVList( + { + positionType: "individualShift", + children: [ + { type: "elem", elem: inner, shift: 0 }, + { + type: "elem", + elem: img, + shift: imgShift, + wrapperClasses: classes, + }, + ], + }, + options, + ); + } + if (/cancel/.test(label)) { + vlist.height = inner.height; + vlist.depth = inner.depth; + } + if (/cancel/.test(label) && !isSingleChar) { + return buildCommon.makeSpan(["mord", "cancel-lap"], [vlist], options); + } else { + return buildCommon.makeSpan(["mord"], [vlist], options); + } + }; + var mathmlBuilder$6 = function mathmlBuilder$6(group, options) { + var fboxsep = 0; + var node = new mathMLTree.MathNode( + group.label.indexOf("colorbox") > -1 ? "mpadded" : "menclose", + [buildGroup(group.body, options)], + ); + switch (group.label) { + case "\\cancel": + node.setAttribute("notation", "updiagonalstrike"); + break; + case "\\bcancel": + node.setAttribute("notation", "downdiagonalstrike"); + break; + case "\\phase": + node.setAttribute("notation", "phasorangle"); + break; + case "\\sout": + node.setAttribute("notation", "horizontalstrike"); + break; + case "\\fbox": + node.setAttribute("notation", "box"); + break; + case "\\angl": + node.setAttribute("notation", "actuarial"); + break; + case "\\fcolorbox": + case "\\colorbox": + fboxsep = options.fontMetrics().fboxsep * options.fontMetrics().ptPerEm; + node.setAttribute("width", "+" + 2 * fboxsep + "pt"); + node.setAttribute("height", "+" + 2 * fboxsep + "pt"); + node.setAttribute("lspace", fboxsep + "pt"); + node.setAttribute("voffset", fboxsep + "pt"); + if (group.label === "\\fcolorbox") { + var thk = Math.max( + options.fontMetrics().fboxrule, + options.minRuleThickness, + ); + node.setAttribute( + "style", + "border: " + thk + "em solid " + String(group.borderColor), + ); + } + break; + case "\\xcancel": + node.setAttribute("notation", "updiagonalstrike downdiagonalstrike"); + break; + } + if (group.backgroundColor) { + node.setAttribute("mathbackground", group.backgroundColor); + } + return node; + }; + defineFunction({ + type: "enclose", + names: ["\\colorbox"], + props: { numArgs: 2, allowedInText: true, argTypes: ["color", "text"] }, + handler: function handler(_ref, args, optArgs) { + var parser = _ref.parser, + funcName = _ref.funcName; + var color = assertNodeType(args[0], "color-token").color; + var body = args[1]; + return { + type: "enclose", + mode: parser.mode, + label: funcName, + backgroundColor: color, + body: body, + }; + }, + htmlBuilder: htmlBuilder$7, + mathmlBuilder: mathmlBuilder$6, + }); + defineFunction({ + type: "enclose", + names: ["\\fcolorbox"], + props: { + numArgs: 3, + allowedInText: true, + argTypes: ["color", "color", "text"], + }, + handler: function handler(_ref2, args, optArgs) { + var parser = _ref2.parser, + funcName = _ref2.funcName; + var borderColor = assertNodeType(args[0], "color-token").color; + var backgroundColor = assertNodeType(args[1], "color-token").color; + var body = args[2]; + return { + type: "enclose", + mode: parser.mode, + label: funcName, + backgroundColor: backgroundColor, + borderColor: borderColor, + body: body, + }; + }, + htmlBuilder: htmlBuilder$7, + mathmlBuilder: mathmlBuilder$6, + }); + defineFunction({ + type: "enclose", + names: ["\\fbox"], + props: { numArgs: 1, argTypes: ["hbox"], allowedInText: true }, + handler: function handler(_ref3, args) { + var parser = _ref3.parser; + return { + type: "enclose", + mode: parser.mode, + label: "\\fbox", + body: args[0], + }; + }, + }); + defineFunction({ + type: "enclose", + names: ["\\cancel", "\\bcancel", "\\xcancel", "\\sout", "\\phase"], + props: { numArgs: 1 }, + handler: function handler(_ref4, args) { + var parser = _ref4.parser, + funcName = _ref4.funcName; + var body = args[0]; + return { + type: "enclose", + mode: parser.mode, + label: funcName, + body: body, + }; + }, + htmlBuilder: htmlBuilder$7, + mathmlBuilder: mathmlBuilder$6, + }); + defineFunction({ + type: "enclose", + names: ["\\angl"], + props: { numArgs: 1, argTypes: ["hbox"], allowedInText: false }, + handler: function handler(_ref5, args) { + var parser = _ref5.parser; + return { + type: "enclose", + mode: parser.mode, + label: "\\angl", + body: args[0], + }; + }, + }); + var _environments = {}; + function defineEnvironment(_ref) { + var type = _ref.type, + names = _ref.names, + props = _ref.props, + handler = _ref.handler, + htmlBuilder = _ref.htmlBuilder, + mathmlBuilder = _ref.mathmlBuilder; + var data = { + type: type, + numArgs: props.numArgs || 0, + allowedInText: false, + numOptionalArgs: 0, + handler: handler, + }; + for (var i = 0; i < names.length; ++i) { + _environments[names[i]] = data; + } + if (htmlBuilder) { + _htmlGroupBuilders[type] = htmlBuilder; + } + if (mathmlBuilder) { + _mathmlGroupBuilders[type] = mathmlBuilder; + } + } + var _macros = {}; + function defineMacro(name, body) { + _macros[name] = body; + } + function getHLines(parser) { + var hlineInfo = []; + parser.consumeSpaces(); + var nxt = parser.fetch().text; + if (nxt === "\\relax") { + parser.consume(); + parser.consumeSpaces(); + nxt = parser.fetch().text; + } + while (nxt === "\\hline" || nxt === "\\hdashline") { + parser.consume(); + hlineInfo.push(nxt === "\\hdashline"); + parser.consumeSpaces(); + nxt = parser.fetch().text; + } + return hlineInfo; + } + var validateAmsEnvironmentContext = function validateAmsEnvironmentContext( + context, + ) { + var settings = context.parser.settings; + if (!settings.displayMode) { + throw new ParseError( + "{" + context.envName + "} can be used only in" + " display mode.", + ); + } + }; + function getAutoTag(name) { + if (name.indexOf("ed") === -1) { + return name.indexOf("*") === -1; + } + } + function parseArray(parser, _ref, style) { + var hskipBeforeAndAfter = _ref.hskipBeforeAndAfter, + addJot = _ref.addJot, + cols = _ref.cols, + arraystretch = _ref.arraystretch, + colSeparationType = _ref.colSeparationType, + autoTag = _ref.autoTag, + singleRow = _ref.singleRow, + emptySingleRow = _ref.emptySingleRow, + maxNumCols = _ref.maxNumCols, + leqno = _ref.leqno; + parser.gullet.beginGroup(); + if (!singleRow) { + parser.gullet.macros.set("\\cr", "\\\\\\relax"); + } + if (!arraystretch) { + var stretch = parser.gullet.expandMacroAsText("\\arraystretch"); + if (stretch == null) { + arraystretch = 1; + } else { + arraystretch = parseFloat(stretch); + if (!arraystretch || arraystretch < 0) { + throw new ParseError("Invalid \\arraystretch: " + stretch); + } + } + } + parser.gullet.beginGroup(); + var row = []; + var body = [row]; + var rowGaps = []; + var hLinesBeforeRow = []; + var tags = autoTag != null ? [] : undefined; + function beginRow() { + if (autoTag) { + parser.gullet.macros.set("\\@eqnsw", "1", true); + } + } + function endRow() { + if (tags) { + if (parser.gullet.macros.get("\\df@tag")) { + tags.push(parser.subparse([new Token("\\df@tag")])); + parser.gullet.macros.set("\\df@tag", undefined, true); + } else { + tags.push( + Boolean(autoTag) && parser.gullet.macros.get("\\@eqnsw") === "1", + ); + } + } + } + beginRow(); + hLinesBeforeRow.push(getHLines(parser)); + while (true) { + var cell = parser.parseExpression(false, singleRow ? "\\end" : "\\\\"); + parser.gullet.endGroup(); + parser.gullet.beginGroup(); + cell = { type: "ordgroup", mode: parser.mode, body: cell }; + if (style) { + cell = { + type: "styling", + mode: parser.mode, + style: style, + body: [cell], + }; + } + row.push(cell); + var next = parser.fetch().text; + if (next === "&") { + if (maxNumCols && row.length === maxNumCols) { + if (singleRow || colSeparationType) { + throw new ParseError( + "Too many tab characters: &", + parser.nextToken, + ); + } else { + parser.settings.reportNonstrict( + "textEnv", + "Too few columns " + "specified in the {array} column argument.", + ); + } + } + parser.consume(); + } else if (next === "\\end") { + endRow(); + if ( + row.length === 1 && + cell.type === "styling" && + cell.body[0].body.length === 0 && + (body.length > 1 || !emptySingleRow) + ) { + body.pop(); + } + if (hLinesBeforeRow.length < body.length + 1) { + hLinesBeforeRow.push([]); + } + break; + } else if (next === "\\\\") { + parser.consume(); + var size = void 0; + if (parser.gullet.future().text !== " ") { + size = parser.parseSizeGroup(true); + } + rowGaps.push(size ? size.value : null); + endRow(); + hLinesBeforeRow.push(getHLines(parser)); + row = []; + body.push(row); + beginRow(); + } else { + throw new ParseError( + "Expected & or \\\\ or \\cr or \\end", + parser.nextToken, + ); + } + } + parser.gullet.endGroup(); + parser.gullet.endGroup(); + return { + type: "array", + mode: parser.mode, + addJot: addJot, + arraystretch: arraystretch, + body: body, + cols: cols, + rowGaps: rowGaps, + hskipBeforeAndAfter: hskipBeforeAndAfter, + hLinesBeforeRow: hLinesBeforeRow, + colSeparationType: colSeparationType, + tags: tags, + leqno: leqno, + }; + } + function dCellStyle(envName) { + if (envName.slice(0, 1) === "d") { + return "display"; + } else { + return "text"; + } + } + var htmlBuilder$6 = function htmlBuilder(group, options) { + var r; + var c; + var nr = group.body.length; + var hLinesBeforeRow = group.hLinesBeforeRow; + var nc = 0; + var body = new Array(nr); + var hlines = []; + var ruleThickness = Math.max( + options.fontMetrics().arrayRuleWidth, + options.minRuleThickness, + ); + var pt = 1 / options.fontMetrics().ptPerEm; + var arraycolsep = 5 * pt; + if (group.colSeparationType && group.colSeparationType === "small") { + var localMultiplier = options.havingStyle(Style$1.SCRIPT).sizeMultiplier; + arraycolsep = 0.2778 * (localMultiplier / options.sizeMultiplier); + } + var baselineskip = + group.colSeparationType === "CD" + ? calculateSize({ number: 3, unit: "ex" }, options) + : 12 * pt; + var jot = 3 * pt; + var arrayskip = group.arraystretch * baselineskip; + var arstrutHeight = 0.7 * arrayskip; + var arstrutDepth = 0.3 * arrayskip; + var totalHeight = 0; + function setHLinePos(hlinesInGap) { + for (var i = 0; i < hlinesInGap.length; ++i) { + if (i > 0) { + totalHeight += 0.25; + } + hlines.push({ pos: totalHeight, isDashed: hlinesInGap[i] }); + } + } + setHLinePos(hLinesBeforeRow[0]); + for (r = 0; r < group.body.length; ++r) { + var inrow = group.body[r]; + var height = arstrutHeight; + var depth = arstrutDepth; + if (nc < inrow.length) { + nc = inrow.length; + } + var outrow = new Array(inrow.length); + for (c = 0; c < inrow.length; ++c) { + var elt = buildGroup$1(inrow[c], options); + if (depth < elt.depth) { + depth = elt.depth; + } + if (height < elt.height) { + height = elt.height; + } + outrow[c] = elt; + } + var rowGap = group.rowGaps[r]; + var gap = 0; + if (rowGap) { + gap = calculateSize(rowGap, options); + if (gap > 0) { + gap += arstrutDepth; + if (depth < gap) { + depth = gap; + } + gap = 0; + } + } + if (group.addJot) { + depth += jot; + } + outrow.height = height; + outrow.depth = depth; + totalHeight += height; + outrow.pos = totalHeight; + totalHeight += depth + gap; + body[r] = outrow; + setHLinePos(hLinesBeforeRow[r + 1]); + } + var offset = totalHeight / 2 + options.fontMetrics().axisHeight; + var colDescriptions = group.cols || []; + var cols = []; + var colSep; + var colDescrNum; + var tagSpans = []; + if ( + group.tags && + group.tags.some(function (tag) { + return tag; + }) + ) { + for (r = 0; r < nr; ++r) { + var rw = body[r]; + var shift = rw.pos - offset; + var tag = group.tags[r]; + var tagSpan = void 0; + if (tag === true) { + tagSpan = buildCommon.makeSpan(["eqn-num"], [], options); + } else if (tag === false) { + tagSpan = buildCommon.makeSpan([], [], options); + } else { + tagSpan = buildCommon.makeSpan( + [], + buildExpression$1(tag, options, true), + options, + ); + } + tagSpan.depth = rw.depth; + tagSpan.height = rw.height; + tagSpans.push({ type: "elem", elem: tagSpan, shift: shift }); + } + } + for ( + c = 0, colDescrNum = 0; + c < nc || colDescrNum < colDescriptions.length; + ++c, ++colDescrNum + ) { + var colDescr = colDescriptions[colDescrNum] || {}; + var firstSeparator = true; + while (colDescr.type === "separator") { + if (!firstSeparator) { + colSep = buildCommon.makeSpan(["arraycolsep"], []); + colSep.style.width = makeEm(options.fontMetrics().doubleRuleSep); + cols.push(colSep); + } + if (colDescr.separator === "|" || colDescr.separator === ":") { + var lineType = colDescr.separator === "|" ? "solid" : "dashed"; + var separator = buildCommon.makeSpan( + ["vertical-separator"], + [], + options, + ); + separator.style.height = makeEm(totalHeight); + separator.style.borderRightWidth = makeEm(ruleThickness); + separator.style.borderRightStyle = lineType; + separator.style.margin = "0 " + makeEm(-ruleThickness / 2); + var _shift = totalHeight - offset; + if (_shift) { + separator.style.verticalAlign = makeEm(-_shift); + } + cols.push(separator); + } else { + throw new ParseError("Invalid separator type: " + colDescr.separator); + } + colDescrNum++; + colDescr = colDescriptions[colDescrNum] || {}; + firstSeparator = false; + } + if (c >= nc) { + continue; + } + var sepwidth = void 0; + if (c > 0 || group.hskipBeforeAndAfter) { + sepwidth = utils.deflt(colDescr.pregap, arraycolsep); + if (sepwidth !== 0) { + colSep = buildCommon.makeSpan(["arraycolsep"], []); + colSep.style.width = makeEm(sepwidth); + cols.push(colSep); + } + } + var col = []; + for (r = 0; r < nr; ++r) { + var row = body[r]; + var elem = row[c]; + if (!elem) { + continue; + } + var _shift2 = row.pos - offset; + elem.depth = row.depth; + elem.height = row.height; + col.push({ type: "elem", elem: elem, shift: _shift2 }); + } + col = buildCommon.makeVList( + { positionType: "individualShift", children: col }, + options, + ); + col = buildCommon.makeSpan( + ["col-align-" + (colDescr.align || "c")], + [col], + ); + cols.push(col); + if (c < nc - 1 || group.hskipBeforeAndAfter) { + sepwidth = utils.deflt(colDescr.postgap, arraycolsep); + if (sepwidth !== 0) { + colSep = buildCommon.makeSpan(["arraycolsep"], []); + colSep.style.width = makeEm(sepwidth); + cols.push(colSep); + } + } + } + body = buildCommon.makeSpan(["mtable"], cols); + if (hlines.length > 0) { + var line = buildCommon.makeLineSpan("hline", options, ruleThickness); + var dashes = buildCommon.makeLineSpan( + "hdashline", + options, + ruleThickness, + ); + var vListElems = [{ type: "elem", elem: body, shift: 0 }]; + while (hlines.length > 0) { + var hline = hlines.pop(); + var lineShift = hline.pos - offset; + if (hline.isDashed) { + vListElems.push({ type: "elem", elem: dashes, shift: lineShift }); + } else { + vListElems.push({ type: "elem", elem: line, shift: lineShift }); + } + } + body = buildCommon.makeVList( + { positionType: "individualShift", children: vListElems }, + options, + ); + } + if (tagSpans.length === 0) { + return buildCommon.makeSpan(["mord"], [body], options); + } else { + var eqnNumCol = buildCommon.makeVList( + { positionType: "individualShift", children: tagSpans }, + options, + ); + eqnNumCol = buildCommon.makeSpan(["tag"], [eqnNumCol], options); + return buildCommon.makeFragment([body, eqnNumCol]); + } + }; + var alignMap = { c: "center ", l: "left ", r: "right " }; + var mathmlBuilder$5 = function mathmlBuilder(group, options) { + var tbl = []; + var glue = new mathMLTree.MathNode("mtd", [], ["mtr-glue"]); + var tag = new mathMLTree.MathNode("mtd", [], ["mml-eqn-num"]); + for (var i = 0; i < group.body.length; i++) { + var rw = group.body[i]; + var row = []; + for (var j = 0; j < rw.length; j++) { + row.push(new mathMLTree.MathNode("mtd", [buildGroup(rw[j], options)])); + } + if (group.tags && group.tags[i]) { + row.unshift(glue); + row.push(glue); + if (group.leqno) { + row.unshift(tag); + } else { + row.push(tag); + } + } + tbl.push(new mathMLTree.MathNode("mtr", row)); + } + var table = new mathMLTree.MathNode("mtable", tbl); + var gap = + group.arraystretch === 0.5 + ? 0.1 + : 0.16 + group.arraystretch - 1 + (group.addJot ? 0.09 : 0); + table.setAttribute("rowspacing", makeEm(gap)); + var menclose = ""; + var align = ""; + if (group.cols && group.cols.length > 0) { + var cols = group.cols; + var columnLines = ""; + var prevTypeWasAlign = false; + var iStart = 0; + var iEnd = cols.length; + if (cols[0].type === "separator") { + menclose += "top "; + iStart = 1; + } + if (cols[cols.length - 1].type === "separator") { + menclose += "bottom "; + iEnd -= 1; + } + for (var _i = iStart; _i < iEnd; _i++) { + if (cols[_i].type === "align") { + align += alignMap[cols[_i].align]; + if (prevTypeWasAlign) { + columnLines += "none "; + } + prevTypeWasAlign = true; + } else if (cols[_i].type === "separator") { + if (prevTypeWasAlign) { + columnLines += cols[_i].separator === "|" ? "solid " : "dashed "; + prevTypeWasAlign = false; + } + } + } + table.setAttribute("columnalign", align.trim()); + if (/[sd]/.test(columnLines)) { + table.setAttribute("columnlines", columnLines.trim()); + } + } + if (group.colSeparationType === "align") { + var _cols = group.cols || []; + var spacing = ""; + for (var _i2 = 1; _i2 < _cols.length; _i2++) { + spacing += _i2 % 2 ? "0em " : "1em "; + } + table.setAttribute("columnspacing", spacing.trim()); + } else if ( + group.colSeparationType === "alignat" || + group.colSeparationType === "gather" + ) { + table.setAttribute("columnspacing", "0em"); + } else if (group.colSeparationType === "small") { + table.setAttribute("columnspacing", "0.2778em"); + } else if (group.colSeparationType === "CD") { + table.setAttribute("columnspacing", "0.5em"); + } else { + table.setAttribute("columnspacing", "1em"); + } + var rowLines = ""; + var hlines = group.hLinesBeforeRow; + menclose += hlines[0].length > 0 ? "left " : ""; + menclose += hlines[hlines.length - 1].length > 0 ? "right " : ""; + for (var _i3 = 1; _i3 < hlines.length - 1; _i3++) { + rowLines += + hlines[_i3].length === 0 + ? "none " + : hlines[_i3][0] + ? "dashed " + : "solid "; + } + if (/[sd]/.test(rowLines)) { + table.setAttribute("rowlines", rowLines.trim()); + } + if (menclose !== "") { + table = new mathMLTree.MathNode("menclose", [table]); + table.setAttribute("notation", menclose.trim()); + } + if (group.arraystretch && group.arraystretch < 1) { + table = new mathMLTree.MathNode("mstyle", [table]); + table.setAttribute("scriptlevel", "1"); + } + return table; + }; + var alignedHandler = function alignedHandler(context, args) { + if (context.envName.indexOf("ed") === -1) { + validateAmsEnvironmentContext(context); + } + var cols = []; + var separationType = + context.envName.indexOf("at") > -1 ? "alignat" : "align"; + var isSplit = context.envName === "split"; + var res = parseArray( + context.parser, + { + cols: cols, + addJot: true, + autoTag: isSplit ? undefined : getAutoTag(context.envName), + emptySingleRow: true, + colSeparationType: separationType, + maxNumCols: isSplit ? 2 : undefined, + leqno: context.parser.settings.leqno, + }, + "display", + ); + var numMaths; + var numCols = 0; + var emptyGroup = { type: "ordgroup", mode: context.mode, body: [] }; + if (args[0] && args[0].type === "ordgroup") { + var arg0 = ""; + for (var i = 0; i < args[0].body.length; i++) { + var textord = assertNodeType(args[0].body[i], "textord"); + arg0 += textord.text; + } + numMaths = Number(arg0); + numCols = numMaths * 2; + } + var isAligned = !numCols; + res.body.forEach(function (row) { + for (var _i4 = 1; _i4 < row.length; _i4 += 2) { + var styling = assertNodeType(row[_i4], "styling"); + var ordgroup = assertNodeType(styling.body[0], "ordgroup"); + ordgroup.body.unshift(emptyGroup); + } + if (!isAligned) { + var curMaths = row.length / 2; + if (numMaths < curMaths) { + throw new ParseError( + "Too many math in a row: " + + ("expected " + numMaths + ", but got " + curMaths), + row[0], + ); + } + } else if (numCols < row.length) { + numCols = row.length; + } + }); + for (var _i5 = 0; _i5 < numCols; ++_i5) { + var align = "r"; + var pregap = 0; + if (_i5 % 2 === 1) { + align = "l"; + } else if (_i5 > 0 && isAligned) { + pregap = 1; + } + cols[_i5] = { type: "align", align: align, pregap: pregap, postgap: 0 }; + } + res.colSeparationType = isAligned ? "align" : "alignat"; + return res; + }; + defineEnvironment({ + type: "array", + names: ["array", "darray"], + props: { numArgs: 1 }, + handler: function handler(context, args) { + var symNode = checkSymbolNodeType(args[0]); + var colalign = symNode + ? [args[0]] + : assertNodeType(args[0], "ordgroup").body; + var cols = colalign.map(function (nde) { + var node = assertSymbolNodeType(nde); + var ca = node.text; + if ("lcr".indexOf(ca) !== -1) { + return { type: "align", align: ca }; + } else if (ca === "|") { + return { type: "separator", separator: "|" }; + } else if (ca === ":") { + return { type: "separator", separator: ":" }; + } + throw new ParseError("Unknown column alignment: " + ca, nde); + }); + var res = { + cols: cols, + hskipBeforeAndAfter: true, + maxNumCols: cols.length, + }; + return parseArray(context.parser, res, dCellStyle(context.envName)); + }, + htmlBuilder: htmlBuilder$6, + mathmlBuilder: mathmlBuilder$5, + }); + defineEnvironment({ + type: "array", + names: [ + "matrix", + "pmatrix", + "bmatrix", + "Bmatrix", + "vmatrix", + "Vmatrix", + "matrix*", + "pmatrix*", + "bmatrix*", + "Bmatrix*", + "vmatrix*", + "Vmatrix*", + ], + props: { numArgs: 0 }, + handler: function handler(context) { + var delimiters = { + matrix: null, + pmatrix: ["(", ")"], + bmatrix: ["[", "]"], + Bmatrix: ["\\{", "\\}"], + vmatrix: ["|", "|"], + Vmatrix: ["\\Vert", "\\Vert"], + }[context.envName.replace("*", "")]; + var colAlign = "c"; + var payload = { + hskipBeforeAndAfter: false, + cols: [{ type: "align", align: colAlign }], + }; + if (context.envName.charAt(context.envName.length - 1) === "*") { + var parser = context.parser; + parser.consumeSpaces(); + if (parser.fetch().text === "[") { + parser.consume(); + parser.consumeSpaces(); + colAlign = parser.fetch().text; + if ("lcr".indexOf(colAlign) === -1) { + throw new ParseError("Expected l or c or r", parser.nextToken); + } + parser.consume(); + parser.consumeSpaces(); + parser.expect("]"); + parser.consume(); + payload.cols = [{ type: "align", align: colAlign }]; + } + } + var res = parseArray( + context.parser, + payload, + dCellStyle(context.envName), + ); + var numCols = Math.max.apply( + Math, + [0].concat( + _toConsumableArray( + res.body.map(function (row) { + return row.length; + }), + ), + ), + ); + res.cols = new Array(numCols).fill({ type: "align", align: colAlign }); + return delimiters + ? { + type: "leftright", + mode: context.mode, + body: [res], + left: delimiters[0], + right: delimiters[1], + rightColor: undefined, + } + : res; + }, + htmlBuilder: htmlBuilder$6, + mathmlBuilder: mathmlBuilder$5, + }); + defineEnvironment({ + type: "array", + names: ["smallmatrix"], + props: { numArgs: 0 }, + handler: function handler(context) { + var payload = { arraystretch: 0.5 }; + var res = parseArray(context.parser, payload, "script"); + res.colSeparationType = "small"; + return res; + }, + htmlBuilder: htmlBuilder$6, + mathmlBuilder: mathmlBuilder$5, + }); + defineEnvironment({ + type: "array", + names: ["subarray"], + props: { numArgs: 1 }, + handler: function handler(context, args) { + var symNode = checkSymbolNodeType(args[0]); + var colalign = symNode + ? [args[0]] + : assertNodeType(args[0], "ordgroup").body; + var cols = colalign.map(function (nde) { + var node = assertSymbolNodeType(nde); + var ca = node.text; + if ("lc".indexOf(ca) !== -1) { + return { type: "align", align: ca }; + } + throw new ParseError("Unknown column alignment: " + ca, nde); + }); + if (cols.length > 1) { + throw new ParseError("{subarray} can contain only one column"); + } + var res = { cols: cols, hskipBeforeAndAfter: false, arraystretch: 0.5 }; + res = parseArray(context.parser, res, "script"); + if (res.body.length > 0 && res.body[0].length > 1) { + throw new ParseError("{subarray} can contain only one column"); + } + return res; + }, + htmlBuilder: htmlBuilder$6, + mathmlBuilder: mathmlBuilder$5, + }); + defineEnvironment({ + type: "array", + names: ["cases", "dcases", "rcases", "drcases"], + props: { numArgs: 0 }, + handler: function handler(context) { + var payload = { + arraystretch: 1.2, + cols: [ + { type: "align", align: "l", pregap: 0, postgap: 1 }, + { type: "align", align: "l", pregap: 0, postgap: 0 }, + ], + }; + var res = parseArray( + context.parser, + payload, + dCellStyle(context.envName), + ); + return { + type: "leftright", + mode: context.mode, + body: [res], + left: context.envName.indexOf("r") > -1 ? "." : "\\{", + right: context.envName.indexOf("r") > -1 ? "\\}" : ".", + rightColor: undefined, + }; + }, + htmlBuilder: htmlBuilder$6, + mathmlBuilder: mathmlBuilder$5, + }); + defineEnvironment({ + type: "array", + names: ["align", "align*", "aligned", "split"], + props: { numArgs: 0 }, + handler: alignedHandler, + htmlBuilder: htmlBuilder$6, + mathmlBuilder: mathmlBuilder$5, + }); + defineEnvironment({ + type: "array", + names: ["gathered", "gather", "gather*"], + props: { numArgs: 0 }, + handler: function handler(context) { + if (utils.contains(["gather", "gather*"], context.envName)) { + validateAmsEnvironmentContext(context); + } + var res = { + cols: [{ type: "align", align: "c" }], + addJot: true, + colSeparationType: "gather", + autoTag: getAutoTag(context.envName), + emptySingleRow: true, + leqno: context.parser.settings.leqno, + }; + return parseArray(context.parser, res, "display"); + }, + htmlBuilder: htmlBuilder$6, + mathmlBuilder: mathmlBuilder$5, + }); + defineEnvironment({ + type: "array", + names: ["alignat", "alignat*", "alignedat"], + props: { numArgs: 1 }, + handler: alignedHandler, + htmlBuilder: htmlBuilder$6, + mathmlBuilder: mathmlBuilder$5, + }); + defineEnvironment({ + type: "array", + names: ["equation", "equation*"], + props: { numArgs: 0 }, + handler: function handler(context) { + validateAmsEnvironmentContext(context); + var res = { + autoTag: getAutoTag(context.envName), + emptySingleRow: true, + singleRow: true, + maxNumCols: 1, + leqno: context.parser.settings.leqno, + }; + return parseArray(context.parser, res, "display"); + }, + htmlBuilder: htmlBuilder$6, + mathmlBuilder: mathmlBuilder$5, + }); + defineEnvironment({ + type: "array", + names: ["CD"], + props: { numArgs: 0 }, + handler: function handler(context) { + validateAmsEnvironmentContext(context); + return parseCD(context.parser); + }, + htmlBuilder: htmlBuilder$6, + mathmlBuilder: mathmlBuilder$5, + }); + defineMacro("\\nonumber", "\\gdef\\@eqnsw{0}"); + defineMacro("\\notag", "\\nonumber"); + defineFunction({ + type: "text", + names: ["\\hline", "\\hdashline"], + props: { numArgs: 0, allowedInText: true, allowedInMath: true }, + handler: function handler(context, args) { + throw new ParseError( + context.funcName + " valid only within array environment", + ); + }, + }); + var environments = _environments; + defineFunction({ + type: "environment", + names: ["\\begin", "\\end"], + props: { numArgs: 1, argTypes: ["text"] }, + handler: function handler(_ref, args) { + var parser = _ref.parser, + funcName = _ref.funcName; + var nameGroup = args[0]; + if (nameGroup.type !== "ordgroup") { + throw new ParseError("Invalid environment name", nameGroup); + } + var envName = ""; + for (var i = 0; i < nameGroup.body.length; ++i) { + envName += assertNodeType(nameGroup.body[i], "textord").text; + } + if (funcName === "\\begin") { + if (!environments.hasOwnProperty(envName)) { + throw new ParseError("No such environment: " + envName, nameGroup); + } + var env = environments[envName]; + var _parser$parseArgument = parser.parseArguments( + "\\begin{" + envName + "}", + env, + ), + _args = _parser$parseArgument.args, + optArgs = _parser$parseArgument.optArgs; + var context = { mode: parser.mode, envName: envName, parser: parser }; + var result = env.handler(context, _args, optArgs); + parser.expect("\\end", false); + var endNameToken = parser.nextToken; + var end = assertNodeType(parser.parseFunction(), "environment"); + if (end.name !== envName) { + throw new ParseError( + "Mismatch: \\begin{" + + envName + + "} matched by \\end{" + + end.name + + "}", + endNameToken, + ); + } + return result; + } + return { + type: "environment", + mode: parser.mode, + name: envName, + nameGroup: nameGroup, + }; + }, + }); + var htmlBuilder$5 = function htmlBuilder$5(group, options) { + var font = group.font; + var newOptions = options.withFont(font); + return buildGroup$1(group.body, newOptions); + }; + var mathmlBuilder$4 = function mathmlBuilder$4(group, options) { + var font = group.font; + var newOptions = options.withFont(font); + return buildGroup(group.body, newOptions); + }; + var fontAliases = { + "\\Bbb": "\\mathbb", + "\\bold": "\\mathbf", + "\\frak": "\\mathfrak", + "\\bm": "\\boldsymbol", + }; + defineFunction({ + type: "font", + names: [ + "\\mathrm", + "\\mathit", + "\\mathbf", + "\\mathnormal", + "\\mathsfit", + "\\mathbb", + "\\mathcal", + "\\mathfrak", + "\\mathscr", + "\\mathsf", + "\\mathtt", + "\\Bbb", + "\\bold", + "\\frak", + ], + props: { numArgs: 1, allowedInArgument: true }, + handler: function handler(_ref, args) { + var parser = _ref.parser, + funcName = _ref.funcName; + var body = normalizeArgument(args[0]); + var func = funcName; + if (func in fontAliases) { + func = fontAliases[func]; + } + return { + type: "font", + mode: parser.mode, + font: func.slice(1), + body: body, + }; + }, + htmlBuilder: htmlBuilder$5, + mathmlBuilder: mathmlBuilder$4, + }); + defineFunction({ + type: "mclass", + names: ["\\boldsymbol", "\\bm"], + props: { numArgs: 1 }, + handler: function handler(_ref2, args) { + var parser = _ref2.parser; + var body = args[0]; + var isCharacterBox = utils.isCharacterBox(body); + return { + type: "mclass", + mode: parser.mode, + mclass: binrelClass(body), + body: [ + { type: "font", mode: parser.mode, font: "boldsymbol", body: body }, + ], + isCharacterBox: isCharacterBox, + }; + }, + }); + defineFunction({ + type: "font", + names: ["\\rm", "\\sf", "\\tt", "\\bf", "\\it", "\\cal"], + props: { numArgs: 0, allowedInText: true }, + handler: function handler(_ref3, args) { + var parser = _ref3.parser, + funcName = _ref3.funcName, + breakOnTokenText = _ref3.breakOnTokenText; + var mode = parser.mode; + var body = parser.parseExpression(true, breakOnTokenText); + var style = "math" + funcName.slice(1); + return { + type: "font", + mode: mode, + font: style, + body: { type: "ordgroup", mode: parser.mode, body: body }, + }; + }, + htmlBuilder: htmlBuilder$5, + mathmlBuilder: mathmlBuilder$4, + }); + var adjustStyle = function adjustStyle(size, originalStyle) { + var style = originalStyle; + if (size === "display") { + style = style.id >= Style$1.SCRIPT.id ? style.text() : Style$1.DISPLAY; + } else if (size === "text" && style.size === Style$1.DISPLAY.size) { + style = Style$1.TEXT; + } else if (size === "script") { + style = Style$1.SCRIPT; + } else if (size === "scriptscript") { + style = Style$1.SCRIPTSCRIPT; + } + return style; + }; + var htmlBuilder$4 = function htmlBuilder$4(group, options) { + var style = adjustStyle(group.size, options.style); + var nstyle = style.fracNum(); + var dstyle = style.fracDen(); + var newOptions; + newOptions = options.havingStyle(nstyle); + var numerm = buildGroup$1(group.numer, newOptions, options); + if (group.continued) { + var hStrut = 8.5 / options.fontMetrics().ptPerEm; + var dStrut = 3.5 / options.fontMetrics().ptPerEm; + numerm.height = numerm.height < hStrut ? hStrut : numerm.height; + numerm.depth = numerm.depth < dStrut ? dStrut : numerm.depth; + } + newOptions = options.havingStyle(dstyle); + var denomm = buildGroup$1(group.denom, newOptions, options); + var rule; + var ruleWidth; + var ruleSpacing; + if (group.hasBarLine) { + if (group.barSize) { + ruleWidth = calculateSize(group.barSize, options); + rule = buildCommon.makeLineSpan("frac-line", options, ruleWidth); + } else { + rule = buildCommon.makeLineSpan("frac-line", options); + } + ruleWidth = rule.height; + ruleSpacing = rule.height; + } else { + rule = null; + ruleWidth = 0; + ruleSpacing = options.fontMetrics().defaultRuleThickness; + } + var numShift; + var clearance; + var denomShift; + if (style.size === Style$1.DISPLAY.size || group.size === "display") { + numShift = options.fontMetrics().num1; + if (ruleWidth > 0) { + clearance = 3 * ruleSpacing; + } else { + clearance = 7 * ruleSpacing; + } + denomShift = options.fontMetrics().denom1; + } else { + if (ruleWidth > 0) { + numShift = options.fontMetrics().num2; + clearance = ruleSpacing; + } else { + numShift = options.fontMetrics().num3; + clearance = 3 * ruleSpacing; + } + denomShift = options.fontMetrics().denom2; + } + var frac; + if (!rule) { + var candidateClearance = + numShift - numerm.depth - (denomm.height - denomShift); + if (candidateClearance < clearance) { + numShift += 0.5 * (clearance - candidateClearance); + denomShift += 0.5 * (clearance - candidateClearance); + } + frac = buildCommon.makeVList( + { + positionType: "individualShift", + children: [ + { type: "elem", elem: denomm, shift: denomShift }, + { type: "elem", elem: numerm, shift: -numShift }, + ], + }, + options, + ); + } else { + var axisHeight = options.fontMetrics().axisHeight; + if ( + numShift - numerm.depth - (axisHeight + 0.5 * ruleWidth) < + clearance + ) { + numShift += + clearance - + (numShift - numerm.depth - (axisHeight + 0.5 * ruleWidth)); + } + if ( + axisHeight - 0.5 * ruleWidth - (denomm.height - denomShift) < + clearance + ) { + denomShift += + clearance - + (axisHeight - 0.5 * ruleWidth - (denomm.height - denomShift)); + } + var midShift = -(axisHeight - 0.5 * ruleWidth); + frac = buildCommon.makeVList( + { + positionType: "individualShift", + children: [ + { type: "elem", elem: denomm, shift: denomShift }, + { type: "elem", elem: rule, shift: midShift }, + { type: "elem", elem: numerm, shift: -numShift }, + ], + }, + options, + ); + } + newOptions = options.havingStyle(style); + frac.height *= newOptions.sizeMultiplier / options.sizeMultiplier; + frac.depth *= newOptions.sizeMultiplier / options.sizeMultiplier; + var delimSize; + if (style.size === Style$1.DISPLAY.size) { + delimSize = options.fontMetrics().delim1; + } else if (style.size === Style$1.SCRIPTSCRIPT.size) { + delimSize = options.havingStyle(Style$1.SCRIPT).fontMetrics().delim2; + } else { + delimSize = options.fontMetrics().delim2; + } + var leftDelim; + var rightDelim; + if (group.leftDelim == null) { + leftDelim = makeNullDelimiter(options, ["mopen"]); + } else { + leftDelim = delimiter.customSizedDelim( + group.leftDelim, + delimSize, + true, + options.havingStyle(style), + group.mode, + ["mopen"], + ); + } + if (group.continued) { + rightDelim = buildCommon.makeSpan([]); + } else if (group.rightDelim == null) { + rightDelim = makeNullDelimiter(options, ["mclose"]); + } else { + rightDelim = delimiter.customSizedDelim( + group.rightDelim, + delimSize, + true, + options.havingStyle(style), + group.mode, + ["mclose"], + ); + } + return buildCommon.makeSpan( + ["mord"].concat(newOptions.sizingClasses(options)), + [leftDelim, buildCommon.makeSpan(["mfrac"], [frac]), rightDelim], + options, + ); + }; + var mathmlBuilder$3 = function mathmlBuilder$3(group, options) { + var node = new mathMLTree.MathNode("mfrac", [ + buildGroup(group.numer, options), + buildGroup(group.denom, options), + ]); + if (!group.hasBarLine) { + node.setAttribute("linethickness", "0px"); + } else if (group.barSize) { + var ruleWidth = calculateSize(group.barSize, options); + node.setAttribute("linethickness", makeEm(ruleWidth)); + } + var style = adjustStyle(group.size, options.style); + if (style.size !== options.style.size) { + node = new mathMLTree.MathNode("mstyle", [node]); + var isDisplay = style.size === Style$1.DISPLAY.size ? "true" : "false"; + node.setAttribute("displaystyle", isDisplay); + node.setAttribute("scriptlevel", "0"); + } + if (group.leftDelim != null || group.rightDelim != null) { + var withDelims = []; + if (group.leftDelim != null) { + var leftOp = new mathMLTree.MathNode("mo", [ + new mathMLTree.TextNode(group.leftDelim.replace("\\", "")), + ]); + leftOp.setAttribute("fence", "true"); + withDelims.push(leftOp); + } + withDelims.push(node); + if (group.rightDelim != null) { + var rightOp = new mathMLTree.MathNode("mo", [ + new mathMLTree.TextNode(group.rightDelim.replace("\\", "")), + ]); + rightOp.setAttribute("fence", "true"); + withDelims.push(rightOp); + } + return makeRow(withDelims); + } + return node; + }; + defineFunction({ + type: "genfrac", + names: [ + "\\dfrac", + "\\frac", + "\\tfrac", + "\\dbinom", + "\\binom", + "\\tbinom", + "\\\\atopfrac", + "\\\\bracefrac", + "\\\\brackfrac", + ], + props: { numArgs: 2, allowedInArgument: true }, + handler: function handler(_ref, args) { + var parser = _ref.parser, + funcName = _ref.funcName; + var numer = args[0]; + var denom = args[1]; + var hasBarLine; + var leftDelim = null; + var rightDelim = null; + var size = "auto"; + switch (funcName) { + case "\\dfrac": + case "\\frac": + case "\\tfrac": + hasBarLine = true; + break; + case "\\\\atopfrac": + hasBarLine = false; + break; + case "\\dbinom": + case "\\binom": + case "\\tbinom": + hasBarLine = false; + leftDelim = "("; + rightDelim = ")"; + break; + case "\\\\bracefrac": + hasBarLine = false; + leftDelim = "\\{"; + rightDelim = "\\}"; + break; + case "\\\\brackfrac": + hasBarLine = false; + leftDelim = "["; + rightDelim = "]"; + break; + default: + throw new Error("Unrecognized genfrac command"); + } + switch (funcName) { + case "\\dfrac": + case "\\dbinom": + size = "display"; + break; + case "\\tfrac": + case "\\tbinom": + size = "text"; + break; + } + return { + type: "genfrac", + mode: parser.mode, + continued: false, + numer: numer, + denom: denom, + hasBarLine: hasBarLine, + leftDelim: leftDelim, + rightDelim: rightDelim, + size: size, + barSize: null, + }; + }, + htmlBuilder: htmlBuilder$4, + mathmlBuilder: mathmlBuilder$3, + }); + defineFunction({ + type: "genfrac", + names: ["\\cfrac"], + props: { numArgs: 2 }, + handler: function handler(_ref2, args) { + var parser = _ref2.parser, + funcName = _ref2.funcName; + var numer = args[0]; + var denom = args[1]; + return { + type: "genfrac", + mode: parser.mode, + continued: true, + numer: numer, + denom: denom, + hasBarLine: true, + leftDelim: null, + rightDelim: null, + size: "display", + barSize: null, + }; + }, + }); + defineFunction({ + type: "infix", + names: ["\\over", "\\choose", "\\atop", "\\brace", "\\brack"], + props: { numArgs: 0, infix: true }, + handler: function handler(_ref3) { + var parser = _ref3.parser, + funcName = _ref3.funcName, + token = _ref3.token; + var replaceWith; + switch (funcName) { + case "\\over": + replaceWith = "\\frac"; + break; + case "\\choose": + replaceWith = "\\binom"; + break; + case "\\atop": + replaceWith = "\\\\atopfrac"; + break; + case "\\brace": + replaceWith = "\\\\bracefrac"; + break; + case "\\brack": + replaceWith = "\\\\brackfrac"; + break; + default: + throw new Error("Unrecognized infix genfrac command"); + } + return { + type: "infix", + mode: parser.mode, + replaceWith: replaceWith, + token: token, + }; + }, + }); + var stylArray = ["display", "text", "script", "scriptscript"]; + var delimFromValue = function delimFromValue(delimString) { + var delim = null; + if (delimString.length > 0) { + delim = delimString; + delim = delim === "." ? null : delim; + } + return delim; + }; + defineFunction({ + type: "genfrac", + names: ["\\genfrac"], + props: { + numArgs: 6, + allowedInArgument: true, + argTypes: ["math", "math", "size", "text", "math", "math"], + }, + handler: function handler(_ref4, args) { + var parser = _ref4.parser; + var numer = args[4]; + var denom = args[5]; + var leftNode = normalizeArgument(args[0]); + var leftDelim = + leftNode.type === "atom" && leftNode.family === "open" + ? delimFromValue(leftNode.text) + : null; + var rightNode = normalizeArgument(args[1]); + var rightDelim = + rightNode.type === "atom" && rightNode.family === "close" + ? delimFromValue(rightNode.text) + : null; + var barNode = assertNodeType(args[2], "size"); + var hasBarLine; + var barSize = null; + if (barNode.isBlank) { + hasBarLine = true; + } else { + barSize = barNode.value; + hasBarLine = barSize.number > 0; + } + var size = "auto"; + var styl = args[3]; + if (styl.type === "ordgroup") { + if (styl.body.length > 0) { + var textOrd = assertNodeType(styl.body[0], "textord"); + size = stylArray[Number(textOrd.text)]; + } + } else { + styl = assertNodeType(styl, "textord"); + size = stylArray[Number(styl.text)]; + } + return { + type: "genfrac", + mode: parser.mode, + numer: numer, + denom: denom, + continued: false, + hasBarLine: hasBarLine, + barSize: barSize, + leftDelim: leftDelim, + rightDelim: rightDelim, + size: size, + }; + }, + htmlBuilder: htmlBuilder$4, + mathmlBuilder: mathmlBuilder$3, + }); + defineFunction({ + type: "infix", + names: ["\\above"], + props: { numArgs: 1, argTypes: ["size"], infix: true }, + handler: function handler(_ref5, args) { + var parser = _ref5.parser, + funcName = _ref5.funcName, + token = _ref5.token; + return { + type: "infix", + mode: parser.mode, + replaceWith: "\\\\abovefrac", + size: assertNodeType(args[0], "size").value, + token: token, + }; + }, + }); + defineFunction({ + type: "genfrac", + names: ["\\\\abovefrac"], + props: { numArgs: 3, argTypes: ["math", "size", "math"] }, + handler: function handler(_ref6, args) { + var parser = _ref6.parser, + funcName = _ref6.funcName; + var numer = args[0]; + var barSize = assert(assertNodeType(args[1], "infix").size); + var denom = args[2]; + var hasBarLine = barSize.number > 0; + return { + type: "genfrac", + mode: parser.mode, + numer: numer, + denom: denom, + continued: false, + hasBarLine: hasBarLine, + barSize: barSize, + leftDelim: null, + rightDelim: null, + size: "auto", + }; + }, + htmlBuilder: htmlBuilder$4, + mathmlBuilder: mathmlBuilder$3, + }); + var htmlBuilder$3 = function htmlBuilder$3(grp, options) { + var style = options.style; + var supSubGroup; + var group; + if (grp.type === "supsub") { + supSubGroup = grp.sup + ? buildGroup$1(grp.sup, options.havingStyle(style.sup()), options) + : buildGroup$1(grp.sub, options.havingStyle(style.sub()), options); + group = assertNodeType(grp.base, "horizBrace"); + } else { + group = assertNodeType(grp, "horizBrace"); + } + var body = buildGroup$1( + group.base, + options.havingBaseStyle(Style$1.DISPLAY), + ); + var braceBody = stretchy.svgSpan(group, options); + var vlist; + if (group.isOver) { + vlist = buildCommon.makeVList( + { + positionType: "firstBaseline", + children: [ + { type: "elem", elem: body }, + { type: "kern", size: 0.1 }, + { type: "elem", elem: braceBody }, + ], + }, + options, + ); + vlist.children[0].children[0].children[1].classes.push("svg-align"); + } else { + vlist = buildCommon.makeVList( + { + positionType: "bottom", + positionData: body.depth + 0.1 + braceBody.height, + children: [ + { type: "elem", elem: braceBody }, + { type: "kern", size: 0.1 }, + { type: "elem", elem: body }, + ], + }, + options, + ); + vlist.children[0].children[0].children[0].classes.push("svg-align"); + } + if (supSubGroup) { + var vSpan = buildCommon.makeSpan( + ["mord", group.isOver ? "mover" : "munder"], + [vlist], + options, + ); + if (group.isOver) { + vlist = buildCommon.makeVList( + { + positionType: "firstBaseline", + children: [ + { type: "elem", elem: vSpan }, + { type: "kern", size: 0.2 }, + { type: "elem", elem: supSubGroup }, + ], + }, + options, + ); + } else { + vlist = buildCommon.makeVList( + { + positionType: "bottom", + positionData: + vSpan.depth + 0.2 + supSubGroup.height + supSubGroup.depth, + children: [ + { type: "elem", elem: supSubGroup }, + { type: "kern", size: 0.2 }, + { type: "elem", elem: vSpan }, + ], + }, + options, + ); + } + } + return buildCommon.makeSpan( + ["mord", group.isOver ? "mover" : "munder"], + [vlist], + options, + ); + }; + var mathmlBuilder$2 = function mathmlBuilder$2(group, options) { + var accentNode = stretchy.mathMLnode(group.label); + return new mathMLTree.MathNode(group.isOver ? "mover" : "munder", [ + buildGroup(group.base, options), + accentNode, + ]); + }; + defineFunction({ + type: "horizBrace", + names: ["\\overbrace", "\\underbrace"], + props: { numArgs: 1 }, + handler: function handler(_ref, args) { + var parser = _ref.parser, + funcName = _ref.funcName; + return { + type: "horizBrace", + mode: parser.mode, + label: funcName, + isOver: /^\\over/.test(funcName), + base: args[0], + }; + }, + htmlBuilder: htmlBuilder$3, + mathmlBuilder: mathmlBuilder$2, + }); + defineFunction({ + type: "href", + names: ["\\href"], + props: { numArgs: 2, argTypes: ["url", "original"], allowedInText: true }, + handler: function handler(_ref, args) { + var parser = _ref.parser; + var body = args[1]; + var href = assertNodeType(args[0], "url").url; + if (!parser.settings.isTrusted({ command: "\\href", url: href })) { + return parser.formatUnsupportedCmd("\\href"); + } + return { + type: "href", + mode: parser.mode, + href: href, + body: ordargument(body), + }; + }, + htmlBuilder: function htmlBuilder(group, options) { + var elements = buildExpression$1(group.body, options, false); + return buildCommon.makeAnchor(group.href, [], elements, options); + }, + mathmlBuilder: function mathmlBuilder(group, options) { + var math = buildExpressionRow(group.body, options); + if (!(math instanceof MathNode)) { + math = new MathNode("mrow", [math]); + } + math.setAttribute("href", group.href); + return math; + }, + }); + defineFunction({ + type: "href", + names: ["\\url"], + props: { numArgs: 1, argTypes: ["url"], allowedInText: true }, + handler: function handler(_ref2, args) { + var parser = _ref2.parser; + var href = assertNodeType(args[0], "url").url; + if (!parser.settings.isTrusted({ command: "\\url", url: href })) { + return parser.formatUnsupportedCmd("\\url"); + } + var chars = []; + for (var i = 0; i < href.length; i++) { + var c = href[i]; + if (c === "~") { + c = "\\textasciitilde"; + } + chars.push({ type: "textord", mode: "text", text: c }); + } + var body = { + type: "text", + mode: parser.mode, + font: "\\texttt", + body: chars, + }; + return { + type: "href", + mode: parser.mode, + href: href, + body: ordargument(body), + }; + }, + }); + defineFunction({ + type: "hbox", + names: ["\\hbox"], + props: { + numArgs: 1, + argTypes: ["text"], + allowedInText: true, + primitive: true, + }, + handler: function handler(_ref, args) { + var parser = _ref.parser; + return { type: "hbox", mode: parser.mode, body: ordargument(args[0]) }; + }, + htmlBuilder: function htmlBuilder(group, options) { + var elements = buildExpression$1(group.body, options, false); + return buildCommon.makeFragment(elements); + }, + mathmlBuilder: function mathmlBuilder(group, options) { + return new mathMLTree.MathNode( + "mrow", + buildExpression(group.body, options), + ); + }, + }); + defineFunction({ + type: "html", + names: ["\\htmlClass", "\\htmlId", "\\htmlStyle", "\\htmlData"], + props: { numArgs: 2, argTypes: ["raw", "original"], allowedInText: true }, + handler: function handler(_ref, args) { + var parser = _ref.parser, + funcName = _ref.funcName, + token = _ref.token; + var value = assertNodeType(args[0], "raw").string; + var body = args[1]; + if (parser.settings.strict) { + parser.settings.reportNonstrict( + "htmlExtension", + "HTML extension is disabled on strict mode", + ); + } + var trustContext; + var attributes = {}; + switch (funcName) { + case "\\htmlClass": + attributes["class"] = value; + trustContext = { command: "\\htmlClass", class: value }; + break; + case "\\htmlId": + attributes.id = value; + trustContext = { command: "\\htmlId", id: value }; + break; + case "\\htmlStyle": + attributes.style = value; + trustContext = { command: "\\htmlStyle", style: value }; + break; + case "\\htmlData": { + var data = value.split(","); + for (var i = 0; i < data.length; i++) { + var keyVal = data[i].split("="); + if (keyVal.length !== 2) { + throw new ParseError("Error parsing key-value for \\htmlData"); + } + attributes["data-" + keyVal[0].trim()] = keyVal[1].trim(); + } + trustContext = { command: "\\htmlData", attributes: attributes }; + break; + } + default: + throw new Error("Unrecognized html command"); + } + if (!parser.settings.isTrusted(trustContext)) { + return parser.formatUnsupportedCmd(funcName); + } + return { + type: "html", + mode: parser.mode, + attributes: attributes, + body: ordargument(body), + }; + }, + htmlBuilder: function htmlBuilder(group, options) { + var elements = buildExpression$1(group.body, options, false); + var classes = ["enclosing"]; + if (group.attributes["class"]) { + classes.push.apply( + classes, + _toConsumableArray(group.attributes["class"].trim().split(/\s+/)), + ); + } + var span = buildCommon.makeSpan(classes, elements, options); + for (var attr in group.attributes) { + if (attr !== "class" && group.attributes.hasOwnProperty(attr)) { + span.setAttribute(attr, group.attributes[attr]); + } + } + return span; + }, + mathmlBuilder: function mathmlBuilder(group, options) { + return buildExpressionRow(group.body, options); + }, + }); + defineFunction({ + type: "htmlmathml", + names: ["\\html@mathml"], + props: { numArgs: 2, allowedInText: true }, + handler: function handler(_ref, args) { + var parser = _ref.parser; + return { + type: "htmlmathml", + mode: parser.mode, + html: ordargument(args[0]), + mathml: ordargument(args[1]), + }; + }, + htmlBuilder: function htmlBuilder(group, options) { + var elements = buildExpression$1(group.html, options, false); + return buildCommon.makeFragment(elements); + }, + mathmlBuilder: function mathmlBuilder(group, options) { + return buildExpressionRow(group.mathml, options); + }, + }); + var sizeData = function sizeData(str) { + if (/^[-+]? *(\d+(\.\d*)?|\.\d+)$/.test(str)) { + return { number: +str, unit: "bp" }; + } else { + var match = /([-+]?) *(\d+(?:\.\d*)?|\.\d+) *([a-z]{2})/.exec(str); + if (!match) { + throw new ParseError( + "Invalid size: '" + str + "' in \\includegraphics", + ); + } + var data = { number: +(match[1] + match[2]), unit: match[3] }; + if (!validUnit(data)) { + throw new ParseError( + "Invalid unit: '" + data.unit + "' in \\includegraphics.", + ); + } + return data; + } + }; + defineFunction({ + type: "includegraphics", + names: ["\\includegraphics"], + props: { + numArgs: 1, + numOptionalArgs: 1, + argTypes: ["raw", "url"], + allowedInText: false, + }, + handler: function handler(_ref, args, optArgs) { + var parser = _ref.parser; + var width = { number: 0, unit: "em" }; + var height = { number: 0.9, unit: "em" }; + var totalheight = { number: 0, unit: "em" }; + var alt = ""; + if (optArgs[0]) { + var attributeStr = assertNodeType(optArgs[0], "raw").string; + var attributes = attributeStr.split(","); + for (var i = 0; i < attributes.length; i++) { + var keyVal = attributes[i].split("="); + if (keyVal.length === 2) { + var str = keyVal[1].trim(); + switch (keyVal[0].trim()) { + case "alt": + alt = str; + break; + case "width": + width = sizeData(str); + break; + case "height": + height = sizeData(str); + break; + case "totalheight": + totalheight = sizeData(str); + break; + default: + throw new ParseError( + "Invalid key: '" + keyVal[0] + "' in \\includegraphics.", + ); + } + } + } + } + var src = assertNodeType(args[0], "url").url; + if (alt === "") { + alt = src; + alt = alt.replace(/^.*[\\/]/, ""); + alt = alt.substring(0, alt.lastIndexOf(".")); + } + if ( + !parser.settings.isTrusted({ command: "\\includegraphics", url: src }) + ) { + return parser.formatUnsupportedCmd("\\includegraphics"); + } + return { + type: "includegraphics", + mode: parser.mode, + alt: alt, + width: width, + height: height, + totalheight: totalheight, + src: src, + }; + }, + htmlBuilder: function htmlBuilder(group, options) { + var height = calculateSize(group.height, options); + var depth = 0; + if (group.totalheight.number > 0) { + depth = calculateSize(group.totalheight, options) - height; + } + var width = 0; + if (group.width.number > 0) { + width = calculateSize(group.width, options); + } + var style = { height: makeEm(height + depth) }; + if (width > 0) { + style.width = makeEm(width); + } + if (depth > 0) { + style.verticalAlign = makeEm(-depth); + } + var node = new Img(group.src, group.alt, style); + node.height = height; + node.depth = depth; + return node; + }, + mathmlBuilder: function mathmlBuilder(group, options) { + var node = new mathMLTree.MathNode("mglyph", []); + node.setAttribute("alt", group.alt); + var height = calculateSize(group.height, options); + var depth = 0; + if (group.totalheight.number > 0) { + depth = calculateSize(group.totalheight, options) - height; + node.setAttribute("valign", makeEm(-depth)); + } + node.setAttribute("height", makeEm(height + depth)); + if (group.width.number > 0) { + var width = calculateSize(group.width, options); + node.setAttribute("width", makeEm(width)); + } + node.setAttribute("src", group.src); + return node; + }, + }); + defineFunction({ + type: "kern", + names: ["\\kern", "\\mkern", "\\hskip", "\\mskip"], + props: { + numArgs: 1, + argTypes: ["size"], + primitive: true, + allowedInText: true, + }, + handler: function handler(_ref, args) { + var parser = _ref.parser, + funcName = _ref.funcName; + var size = assertNodeType(args[0], "size"); + if (parser.settings.strict) { + var mathFunction = funcName[1] === "m"; + var muUnit = size.value.unit === "mu"; + if (mathFunction) { + if (!muUnit) { + parser.settings.reportNonstrict( + "mathVsTextUnits", + "LaTeX's " + + funcName + + " supports only mu units, " + + ("not " + size.value.unit + " units"), + ); + } + if (parser.mode !== "math") { + parser.settings.reportNonstrict( + "mathVsTextUnits", + "LaTeX's " + funcName + " works only in math mode", + ); + } + } else { + if (muUnit) { + parser.settings.reportNonstrict( + "mathVsTextUnits", + "LaTeX's " + funcName + " doesn't support mu units", + ); + } + } + } + return { type: "kern", mode: parser.mode, dimension: size.value }; + }, + htmlBuilder: function htmlBuilder(group, options) { + return buildCommon.makeGlue(group.dimension, options); + }, + mathmlBuilder: function mathmlBuilder(group, options) { + var dimension = calculateSize(group.dimension, options); + return new mathMLTree.SpaceNode(dimension); + }, + }); + defineFunction({ + type: "lap", + names: ["\\mathllap", "\\mathrlap", "\\mathclap"], + props: { numArgs: 1, allowedInText: true }, + handler: function handler(_ref, args) { + var parser = _ref.parser, + funcName = _ref.funcName; + var body = args[0]; + return { + type: "lap", + mode: parser.mode, + alignment: funcName.slice(5), + body: body, + }; + }, + htmlBuilder: function htmlBuilder(group, options) { + var inner; + if (group.alignment === "clap") { + inner = buildCommon.makeSpan([], [buildGroup$1(group.body, options)]); + inner = buildCommon.makeSpan(["inner"], [inner], options); + } else { + inner = buildCommon.makeSpan( + ["inner"], + [buildGroup$1(group.body, options)], + ); + } + var fix = buildCommon.makeSpan(["fix"], []); + var node = buildCommon.makeSpan([group.alignment], [inner, fix], options); + var strut = buildCommon.makeSpan(["strut"]); + strut.style.height = makeEm(node.height + node.depth); + if (node.depth) { + strut.style.verticalAlign = makeEm(-node.depth); + } + node.children.unshift(strut); + node = buildCommon.makeSpan(["thinbox"], [node], options); + return buildCommon.makeSpan(["mord", "vbox"], [node], options); + }, + mathmlBuilder: function mathmlBuilder(group, options) { + var node = new mathMLTree.MathNode("mpadded", [ + buildGroup(group.body, options), + ]); + if (group.alignment !== "rlap") { + var offset = group.alignment === "llap" ? "-1" : "-0.5"; + node.setAttribute("lspace", offset + "width"); + } + node.setAttribute("width", "0px"); + return node; + }, + }); + defineFunction({ + type: "styling", + names: ["\\(", "$"], + props: { numArgs: 0, allowedInText: true, allowedInMath: false }, + handler: function handler(_ref, args) { + var funcName = _ref.funcName, + parser = _ref.parser; + var outerMode = parser.mode; + parser.switchMode("math"); + var close = funcName === "\\(" ? "\\)" : "$"; + var body = parser.parseExpression(false, close); + parser.expect(close); + parser.switchMode(outerMode); + return { type: "styling", mode: parser.mode, style: "text", body: body }; + }, + }); + defineFunction({ + type: "text", + names: ["\\)", "\\]"], + props: { numArgs: 0, allowedInText: true, allowedInMath: false }, + handler: function handler(context, args) { + throw new ParseError("Mismatched " + context.funcName); + }, + }); + var chooseMathStyle = function chooseMathStyle(group, options) { + switch (options.style.size) { + case Style$1.DISPLAY.size: + return group.display; + case Style$1.TEXT.size: + return group.text; + case Style$1.SCRIPT.size: + return group.script; + case Style$1.SCRIPTSCRIPT.size: + return group.scriptscript; + default: + return group.text; + } + }; + defineFunction({ + type: "mathchoice", + names: ["\\mathchoice"], + props: { numArgs: 4, primitive: true }, + handler: function handler(_ref, args) { + var parser = _ref.parser; + return { + type: "mathchoice", + mode: parser.mode, + display: ordargument(args[0]), + text: ordargument(args[1]), + script: ordargument(args[2]), + scriptscript: ordargument(args[3]), + }; + }, + htmlBuilder: function htmlBuilder(group, options) { + var body = chooseMathStyle(group, options); + var elements = buildExpression$1(body, options, false); + return buildCommon.makeFragment(elements); + }, + mathmlBuilder: function mathmlBuilder(group, options) { + var body = chooseMathStyle(group, options); + return buildExpressionRow(body, options); + }, + }); + var assembleSupSub = function assembleSupSub( + base, + supGroup, + subGroup, + options, + style, + slant, + baseShift, + ) { + base = buildCommon.makeSpan([], [base]); + var subIsSingleCharacter = subGroup && utils.isCharacterBox(subGroup); + var sub; + var sup; + if (supGroup) { + var elem = buildGroup$1( + supGroup, + options.havingStyle(style.sup()), + options, + ); + sup = { + elem: elem, + kern: Math.max( + options.fontMetrics().bigOpSpacing1, + options.fontMetrics().bigOpSpacing3 - elem.depth, + ), + }; + } + if (subGroup) { + var _elem = buildGroup$1( + subGroup, + options.havingStyle(style.sub()), + options, + ); + sub = { + elem: _elem, + kern: Math.max( + options.fontMetrics().bigOpSpacing2, + options.fontMetrics().bigOpSpacing4 - _elem.height, + ), + }; + } + var finalGroup; + if (sup && sub) { + var bottom = + options.fontMetrics().bigOpSpacing5 + + sub.elem.height + + sub.elem.depth + + sub.kern + + base.depth + + baseShift; + finalGroup = buildCommon.makeVList( + { + positionType: "bottom", + positionData: bottom, + children: [ + { type: "kern", size: options.fontMetrics().bigOpSpacing5 }, + { type: "elem", elem: sub.elem, marginLeft: makeEm(-slant) }, + { type: "kern", size: sub.kern }, + { type: "elem", elem: base }, + { type: "kern", size: sup.kern }, + { type: "elem", elem: sup.elem, marginLeft: makeEm(slant) }, + { type: "kern", size: options.fontMetrics().bigOpSpacing5 }, + ], + }, + options, + ); + } else if (sub) { + var top = base.height - baseShift; + finalGroup = buildCommon.makeVList( + { + positionType: "top", + positionData: top, + children: [ + { type: "kern", size: options.fontMetrics().bigOpSpacing5 }, + { type: "elem", elem: sub.elem, marginLeft: makeEm(-slant) }, + { type: "kern", size: sub.kern }, + { type: "elem", elem: base }, + ], + }, + options, + ); + } else if (sup) { + var _bottom = base.depth + baseShift; + finalGroup = buildCommon.makeVList( + { + positionType: "bottom", + positionData: _bottom, + children: [ + { type: "elem", elem: base }, + { type: "kern", size: sup.kern }, + { type: "elem", elem: sup.elem, marginLeft: makeEm(slant) }, + { type: "kern", size: options.fontMetrics().bigOpSpacing5 }, + ], + }, + options, + ); + } else { + return base; + } + var parts = [finalGroup]; + if (sub && slant !== 0 && !subIsSingleCharacter) { + var spacer = buildCommon.makeSpan(["mspace"], [], options); + spacer.style.marginRight = makeEm(slant); + parts.unshift(spacer); + } + return buildCommon.makeSpan(["mop", "op-limits"], parts, options); + }; + var noSuccessor = ["\\smallint"]; + var htmlBuilder$2 = function htmlBuilder$2(grp, options) { + var supGroup; + var subGroup; + var hasLimits = false; + var group; + if (grp.type === "supsub") { + supGroup = grp.sup; + subGroup = grp.sub; + group = assertNodeType(grp.base, "op"); + hasLimits = true; + } else { + group = assertNodeType(grp, "op"); + } + var style = options.style; + var large = false; + if ( + style.size === Style$1.DISPLAY.size && + group.symbol && + !utils.contains(noSuccessor, group.name) + ) { + large = true; + } + var base; + if (group.symbol) { + var fontName = large ? "Size2-Regular" : "Size1-Regular"; + var stash = ""; + if (group.name === "\\oiint" || group.name === "\\oiiint") { + stash = group.name.slice(1); + group.name = stash === "oiint" ? "\\iint" : "\\iiint"; + } + base = buildCommon.makeSymbol(group.name, fontName, "math", options, [ + "mop", + "op-symbol", + large ? "large-op" : "small-op", + ]); + if (stash.length > 0) { + var italic = base.italic; + var oval = buildCommon.staticSvg( + stash + "Size" + (large ? "2" : "1"), + options, + ); + base = buildCommon.makeVList( + { + positionType: "individualShift", + children: [ + { type: "elem", elem: base, shift: 0 }, + { type: "elem", elem: oval, shift: large ? 0.08 : 0 }, + ], + }, + options, + ); + group.name = "\\" + stash; + base.classes.unshift("mop"); + base.italic = italic; + } + } else if (group.body) { + var inner = buildExpression$1(group.body, options, true); + if (inner.length === 1 && inner[0] instanceof SymbolNode) { + base = inner[0]; + base.classes[0] = "mop"; + } else { + base = buildCommon.makeSpan(["mop"], inner, options); + } + } else { + var output = []; + for (var i = 1; i < group.name.length; i++) { + output.push(buildCommon.mathsym(group.name[i], group.mode, options)); + } + base = buildCommon.makeSpan(["mop"], output, options); + } + var baseShift = 0; + var slant = 0; + if ( + (base instanceof SymbolNode || + group.name === "\\oiint" || + group.name === "\\oiiint") && + !group.suppressBaseShift + ) { + baseShift = + (base.height - base.depth) / 2 - options.fontMetrics().axisHeight; + slant = base.italic; + } + if (hasLimits) { + return assembleSupSub( + base, + supGroup, + subGroup, + options, + style, + slant, + baseShift, + ); + } else { + if (baseShift) { + base.style.position = "relative"; + base.style.top = makeEm(baseShift); + } + return base; + } + }; + var mathmlBuilder$1 = function mathmlBuilder$1(group, options) { + var node; + if (group.symbol) { + node = new MathNode("mo", [makeText(group.name, group.mode)]); + if (utils.contains(noSuccessor, group.name)) { + node.setAttribute("largeop", "false"); + } + } else if (group.body) { + node = new MathNode("mo", buildExpression(group.body, options)); + } else { + node = new MathNode("mi", [new TextNode(group.name.slice(1))]); + var operator = new MathNode("mo", [makeText("\u2061", "text")]); + if (group.parentIsSupSub) { + node = new MathNode("mrow", [node, operator]); + } else { + node = newDocumentFragment([node, operator]); + } + } + return node; + }; + var singleCharBigOps = { + "\u220F": "\\prod", + "\u2210": "\\coprod", + "\u2211": "\\sum", + "\u22C0": "\\bigwedge", + "\u22C1": "\\bigvee", + "\u22C2": "\\bigcap", + "\u22C3": "\\bigcup", + "\u2A00": "\\bigodot", + "\u2A01": "\\bigoplus", + "\u2A02": "\\bigotimes", + "\u2A04": "\\biguplus", + "\u2A06": "\\bigsqcup", + }; + defineFunction({ + type: "op", + names: [ + "\\coprod", + "\\bigvee", + "\\bigwedge", + "\\biguplus", + "\\bigcap", + "\\bigcup", + "\\intop", + "\\prod", + "\\sum", + "\\bigotimes", + "\\bigoplus", + "\\bigodot", + "\\bigsqcup", + "\\smallint", + "\u220F", + "\u2210", + "\u2211", + "\u22C0", + "\u22C1", + "\u22C2", + "\u22C3", + "\u2A00", + "\u2A01", + "\u2A02", + "\u2A04", + "\u2A06", + ], + props: { numArgs: 0 }, + handler: function handler(_ref, args) { + var parser = _ref.parser, + funcName = _ref.funcName; + var fName = funcName; + if (fName.length === 1) { + fName = singleCharBigOps[fName]; + } + return { + type: "op", + mode: parser.mode, + limits: true, + parentIsSupSub: false, + symbol: true, + name: fName, + }; + }, + htmlBuilder: htmlBuilder$2, + mathmlBuilder: mathmlBuilder$1, + }); + defineFunction({ + type: "op", + names: ["\\mathop"], + props: { numArgs: 1, primitive: true }, + handler: function handler(_ref2, args) { + var parser = _ref2.parser; + var body = args[0]; + return { + type: "op", + mode: parser.mode, + limits: false, + parentIsSupSub: false, + symbol: false, + body: ordargument(body), + }; + }, + htmlBuilder: htmlBuilder$2, + mathmlBuilder: mathmlBuilder$1, + }); + var singleCharIntegrals = { + "\u222B": "\\int", + "\u222C": "\\iint", + "\u222D": "\\iiint", + "\u222E": "\\oint", + "\u222F": "\\oiint", + "\u2230": "\\oiiint", + }; + defineFunction({ + type: "op", + names: [ + "\\arcsin", + "\\arccos", + "\\arctan", + "\\arctg", + "\\arcctg", + "\\arg", + "\\ch", + "\\cos", + "\\cosec", + "\\cosh", + "\\cot", + "\\cotg", + "\\coth", + "\\csc", + "\\ctg", + "\\cth", + "\\deg", + "\\dim", + "\\exp", + "\\hom", + "\\ker", + "\\lg", + "\\ln", + "\\log", + "\\sec", + "\\sin", + "\\sinh", + "\\sh", + "\\tan", + "\\tanh", + "\\tg", + "\\th", + ], + props: { numArgs: 0 }, + handler: function handler(_ref3) { + var parser = _ref3.parser, + funcName = _ref3.funcName; + return { + type: "op", + mode: parser.mode, + limits: false, + parentIsSupSub: false, + symbol: false, + name: funcName, + }; + }, + htmlBuilder: htmlBuilder$2, + mathmlBuilder: mathmlBuilder$1, + }); + defineFunction({ + type: "op", + names: [ + "\\det", + "\\gcd", + "\\inf", + "\\lim", + "\\max", + "\\min", + "\\Pr", + "\\sup", + ], + props: { numArgs: 0 }, + handler: function handler(_ref4) { + var parser = _ref4.parser, + funcName = _ref4.funcName; + return { + type: "op", + mode: parser.mode, + limits: true, + parentIsSupSub: false, + symbol: false, + name: funcName, + }; + }, + htmlBuilder: htmlBuilder$2, + mathmlBuilder: mathmlBuilder$1, + }); + defineFunction({ + type: "op", + names: [ + "\\int", + "\\iint", + "\\iiint", + "\\oint", + "\\oiint", + "\\oiiint", + "\u222B", + "\u222C", + "\u222D", + "\u222E", + "\u222F", + "\u2230", + ], + props: { numArgs: 0 }, + handler: function handler(_ref5) { + var parser = _ref5.parser, + funcName = _ref5.funcName; + var fName = funcName; + if (fName.length === 1) { + fName = singleCharIntegrals[fName]; + } + return { + type: "op", + mode: parser.mode, + limits: false, + parentIsSupSub: false, + symbol: true, + name: fName, + }; + }, + htmlBuilder: htmlBuilder$2, + mathmlBuilder: mathmlBuilder$1, + }); + var htmlBuilder$1 = function htmlBuilder$1(grp, options) { + var supGroup; + var subGroup; + var hasLimits = false; + var group; + if (grp.type === "supsub") { + supGroup = grp.sup; + subGroup = grp.sub; + group = assertNodeType(grp.base, "operatorname"); + hasLimits = true; + } else { + group = assertNodeType(grp, "operatorname"); + } + var base; + if (group.body.length > 0) { + var body = group.body.map(function (child) { + var childText = child.text; + if (typeof childText === "string") { + return { type: "textord", mode: child.mode, text: childText }; + } else { + return child; + } + }); + var expression = buildExpression$1( + body, + options.withFont("mathrm"), + true, + ); + for (var i = 0; i < expression.length; i++) { + var child = expression[i]; + if (child instanceof SymbolNode) { + child.text = child.text.replace(/\u2212/, "-").replace(/\u2217/, "*"); + } + } + base = buildCommon.makeSpan(["mop"], expression, options); + } else { + base = buildCommon.makeSpan(["mop"], [], options); + } + if (hasLimits) { + return assembleSupSub( + base, + supGroup, + subGroup, + options, + options.style, + 0, + 0, + ); + } else { + return base; + } + }; + var mathmlBuilder = function mathmlBuilder(group, options) { + var expression = buildExpression(group.body, options.withFont("mathrm")); + var isAllString = true; + for (var i = 0; i < expression.length; i++) { + var node = expression[i]; + if (node instanceof mathMLTree.SpaceNode); + else if (node instanceof mathMLTree.MathNode) { + switch (node.type) { + case "mi": + case "mn": + case "ms": + case "mspace": + case "mtext": + break; + case "mo": { + var child = node.children[0]; + if ( + node.children.length === 1 && + child instanceof mathMLTree.TextNode + ) { + child.text = child.text + .replace(/\u2212/, "-") + .replace(/\u2217/, "*"); + } else { + isAllString = false; + } + break; + } + default: + isAllString = false; + } + } else { + isAllString = false; + } + } + if (isAllString) { + var word = expression + .map(function (node) { + return node.toText(); + }) + .join(""); + expression = [new mathMLTree.TextNode(word)]; + } + var identifier = new mathMLTree.MathNode("mi", expression); + identifier.setAttribute("mathvariant", "normal"); + var operator = new mathMLTree.MathNode("mo", [makeText("\u2061", "text")]); + if (group.parentIsSupSub) { + return new mathMLTree.MathNode("mrow", [identifier, operator]); + } else { + return mathMLTree.newDocumentFragment([identifier, operator]); + } + }; + defineFunction({ + type: "operatorname", + names: ["\\operatorname@", "\\operatornamewithlimits"], + props: { numArgs: 1 }, + handler: function handler(_ref, args) { + var parser = _ref.parser, + funcName = _ref.funcName; + var body = args[0]; + return { + type: "operatorname", + mode: parser.mode, + body: ordargument(body), + alwaysHandleSupSub: funcName === "\\operatornamewithlimits", + limits: false, + parentIsSupSub: false, + }; + }, + htmlBuilder: htmlBuilder$1, + mathmlBuilder: mathmlBuilder, + }); + defineMacro( + "\\operatorname", + "\\@ifstar\\operatornamewithlimits\\operatorname@", + ); + defineFunctionBuilders({ + type: "ordgroup", + htmlBuilder: function htmlBuilder(group, options) { + if (group.semisimple) { + return buildCommon.makeFragment( + buildExpression$1(group.body, options, false), + ); + } + return buildCommon.makeSpan( + ["mord"], + buildExpression$1(group.body, options, true), + options, + ); + }, + mathmlBuilder: function mathmlBuilder(group, options) { + return buildExpressionRow(group.body, options, true); + }, + }); + defineFunction({ + type: "overline", + names: ["\\overline"], + props: { numArgs: 1 }, + handler: function handler(_ref, args) { + var parser = _ref.parser; + var body = args[0]; + return { type: "overline", mode: parser.mode, body: body }; + }, + htmlBuilder: function htmlBuilder(group, options) { + var innerGroup = buildGroup$1(group.body, options.havingCrampedStyle()); + var line = buildCommon.makeLineSpan("overline-line", options); + var defaultRuleThickness = options.fontMetrics().defaultRuleThickness; + var vlist = buildCommon.makeVList( + { + positionType: "firstBaseline", + children: [ + { type: "elem", elem: innerGroup }, + { type: "kern", size: 3 * defaultRuleThickness }, + { type: "elem", elem: line }, + { type: "kern", size: defaultRuleThickness }, + ], + }, + options, + ); + return buildCommon.makeSpan(["mord", "overline"], [vlist], options); + }, + mathmlBuilder: function mathmlBuilder(group, options) { + var operator = new mathMLTree.MathNode("mo", [ + new mathMLTree.TextNode("\u203E"), + ]); + operator.setAttribute("stretchy", "true"); + var node = new mathMLTree.MathNode("mover", [ + buildGroup(group.body, options), + operator, + ]); + node.setAttribute("accent", "true"); + return node; + }, + }); + defineFunction({ + type: "phantom", + names: ["\\phantom"], + props: { numArgs: 1, allowedInText: true }, + handler: function handler(_ref, args) { + var parser = _ref.parser; + var body = args[0]; + return { type: "phantom", mode: parser.mode, body: ordargument(body) }; + }, + htmlBuilder: function htmlBuilder(group, options) { + var elements = buildExpression$1( + group.body, + options.withPhantom(), + false, + ); + return buildCommon.makeFragment(elements); + }, + mathmlBuilder: function mathmlBuilder(group, options) { + var inner = buildExpression(group.body, options); + return new mathMLTree.MathNode("mphantom", inner); + }, + }); + defineFunction({ + type: "hphantom", + names: ["\\hphantom"], + props: { numArgs: 1, allowedInText: true }, + handler: function handler(_ref2, args) { + var parser = _ref2.parser; + var body = args[0]; + return { type: "hphantom", mode: parser.mode, body: body }; + }, + htmlBuilder: function htmlBuilder(group, options) { + var node = buildCommon.makeSpan( + [], + [buildGroup$1(group.body, options.withPhantom())], + ); + node.height = 0; + node.depth = 0; + if (node.children) { + for (var i = 0; i < node.children.length; i++) { + node.children[i].height = 0; + node.children[i].depth = 0; + } + } + node = buildCommon.makeVList( + { + positionType: "firstBaseline", + children: [{ type: "elem", elem: node }], + }, + options, + ); + return buildCommon.makeSpan(["mord"], [node], options); + }, + mathmlBuilder: function mathmlBuilder(group, options) { + var inner = buildExpression(ordargument(group.body), options); + var phantom = new mathMLTree.MathNode("mphantom", inner); + var node = new mathMLTree.MathNode("mpadded", [phantom]); + node.setAttribute("height", "0px"); + node.setAttribute("depth", "0px"); + return node; + }, + }); + defineFunction({ + type: "vphantom", + names: ["\\vphantom"], + props: { numArgs: 1, allowedInText: true }, + handler: function handler(_ref3, args) { + var parser = _ref3.parser; + var body = args[0]; + return { type: "vphantom", mode: parser.mode, body: body }; + }, + htmlBuilder: function htmlBuilder(group, options) { + var inner = buildCommon.makeSpan( + ["inner"], + [buildGroup$1(group.body, options.withPhantom())], + ); + var fix = buildCommon.makeSpan(["fix"], []); + return buildCommon.makeSpan(["mord", "rlap"], [inner, fix], options); + }, + mathmlBuilder: function mathmlBuilder(group, options) { + var inner = buildExpression(ordargument(group.body), options); + var phantom = new mathMLTree.MathNode("mphantom", inner); + var node = new mathMLTree.MathNode("mpadded", [phantom]); + node.setAttribute("width", "0px"); + return node; + }, + }); + defineFunction({ + type: "raisebox", + names: ["\\raisebox"], + props: { numArgs: 2, argTypes: ["size", "hbox"], allowedInText: true }, + handler: function handler(_ref, args) { + var parser = _ref.parser; + var amount = assertNodeType(args[0], "size").value; + var body = args[1]; + return { type: "raisebox", mode: parser.mode, dy: amount, body: body }; + }, + htmlBuilder: function htmlBuilder(group, options) { + var body = buildGroup$1(group.body, options); + var dy = calculateSize(group.dy, options); + return buildCommon.makeVList( + { + positionType: "shift", + positionData: -dy, + children: [{ type: "elem", elem: body }], + }, + options, + ); + }, + mathmlBuilder: function mathmlBuilder(group, options) { + var node = new mathMLTree.MathNode("mpadded", [ + buildGroup(group.body, options), + ]); + var dy = group.dy.number + group.dy.unit; + node.setAttribute("voffset", dy); + return node; + }, + }); + defineFunction({ + type: "internal", + names: ["\\relax"], + props: { numArgs: 0, allowedInText: true, allowedInArgument: true }, + handler: function handler(_ref) { + var parser = _ref.parser; + return { type: "internal", mode: parser.mode }; + }, + }); + defineFunction({ + type: "rule", + names: ["\\rule"], + props: { + numArgs: 2, + numOptionalArgs: 1, + allowedInText: true, + allowedInMath: true, + argTypes: ["size", "size", "size"], + }, + handler: function handler(_ref, args, optArgs) { + var parser = _ref.parser; + var shift = optArgs[0]; + var width = assertNodeType(args[0], "size"); + var height = assertNodeType(args[1], "size"); + return { + type: "rule", + mode: parser.mode, + shift: shift && assertNodeType(shift, "size").value, + width: width.value, + height: height.value, + }; + }, + htmlBuilder: function htmlBuilder(group, options) { + var rule = buildCommon.makeSpan(["mord", "rule"], [], options); + var width = calculateSize(group.width, options); + var height = calculateSize(group.height, options); + var shift = group.shift ? calculateSize(group.shift, options) : 0; + rule.style.borderRightWidth = makeEm(width); + rule.style.borderTopWidth = makeEm(height); + rule.style.bottom = makeEm(shift); + rule.width = width; + rule.height = height + shift; + rule.depth = -shift; + rule.maxFontSize = height * 1.125 * options.sizeMultiplier; + return rule; + }, + mathmlBuilder: function mathmlBuilder(group, options) { + var width = calculateSize(group.width, options); + var height = calculateSize(group.height, options); + var shift = group.shift ? calculateSize(group.shift, options) : 0; + var color = (options.color && options.getColor()) || "black"; + var rule = new mathMLTree.MathNode("mspace"); + rule.setAttribute("mathbackground", color); + rule.setAttribute("width", makeEm(width)); + rule.setAttribute("height", makeEm(height)); + var wrapper = new mathMLTree.MathNode("mpadded", [rule]); + if (shift >= 0) { + wrapper.setAttribute("height", makeEm(shift)); + } else { + wrapper.setAttribute("height", makeEm(shift)); + wrapper.setAttribute("depth", makeEm(-shift)); + } + wrapper.setAttribute("voffset", makeEm(shift)); + return wrapper; + }, + }); + function sizingGroup(value, options, baseOptions) { + var inner = buildExpression$1(value, options, false); + var multiplier = options.sizeMultiplier / baseOptions.sizeMultiplier; + for (var i = 0; i < inner.length; i++) { + var pos = inner[i].classes.indexOf("sizing"); + if (pos < 0) { + Array.prototype.push.apply( + inner[i].classes, + options.sizingClasses(baseOptions), + ); + } else if (inner[i].classes[pos + 1] === "reset-size" + options.size) { + inner[i].classes[pos + 1] = "reset-size" + baseOptions.size; + } + inner[i].height *= multiplier; + inner[i].depth *= multiplier; + } + return buildCommon.makeFragment(inner); + } + var sizeFuncs = [ + "\\tiny", + "\\sixptsize", + "\\scriptsize", + "\\footnotesize", + "\\small", + "\\normalsize", + "\\large", + "\\Large", + "\\LARGE", + "\\huge", + "\\Huge", + ]; + var htmlBuilder = function htmlBuilder(group, options) { + var newOptions = options.havingSize(group.size); + return sizingGroup(group.body, newOptions, options); + }; + defineFunction({ + type: "sizing", + names: sizeFuncs, + props: { numArgs: 0, allowedInText: true }, + handler: function handler(_ref, args) { + var breakOnTokenText = _ref.breakOnTokenText, + funcName = _ref.funcName, + parser = _ref.parser; + var body = parser.parseExpression(false, breakOnTokenText); + return { + type: "sizing", + mode: parser.mode, + size: sizeFuncs.indexOf(funcName) + 1, + body: body, + }; + }, + htmlBuilder: htmlBuilder, + mathmlBuilder: function mathmlBuilder(group, options) { + var newOptions = options.havingSize(group.size); + var inner = buildExpression(group.body, newOptions); + var node = new mathMLTree.MathNode("mstyle", inner); + node.setAttribute("mathsize", makeEm(newOptions.sizeMultiplier)); + return node; + }, + }); + defineFunction({ + type: "smash", + names: ["\\smash"], + props: { numArgs: 1, numOptionalArgs: 1, allowedInText: true }, + handler: function handler(_ref, args, optArgs) { + var parser = _ref.parser; + var smashHeight = false; + var smashDepth = false; + var tbArg = optArgs[0] && assertNodeType(optArgs[0], "ordgroup"); + if (tbArg) { + var letter = ""; + for (var i = 0; i < tbArg.body.length; ++i) { + var node = tbArg.body[i]; + letter = node.text; + if (letter === "t") { + smashHeight = true; + } else if (letter === "b") { + smashDepth = true; + } else { + smashHeight = false; + smashDepth = false; + break; + } + } + } else { + smashHeight = true; + smashDepth = true; + } + var body = args[0]; + return { + type: "smash", + mode: parser.mode, + body: body, + smashHeight: smashHeight, + smashDepth: smashDepth, + }; + }, + htmlBuilder: function htmlBuilder(group, options) { + var node = buildCommon.makeSpan([], [buildGroup$1(group.body, options)]); + if (!group.smashHeight && !group.smashDepth) { + return node; + } + if (group.smashHeight) { + node.height = 0; + if (node.children) { + for (var i = 0; i < node.children.length; i++) { + node.children[i].height = 0; + } + } + } + if (group.smashDepth) { + node.depth = 0; + if (node.children) { + for (var _i = 0; _i < node.children.length; _i++) { + node.children[_i].depth = 0; + } + } + } + var smashedNode = buildCommon.makeVList( + { + positionType: "firstBaseline", + children: [{ type: "elem", elem: node }], + }, + options, + ); + return buildCommon.makeSpan(["mord"], [smashedNode], options); + }, + mathmlBuilder: function mathmlBuilder(group, options) { + var node = new mathMLTree.MathNode("mpadded", [ + buildGroup(group.body, options), + ]); + if (group.smashHeight) { + node.setAttribute("height", "0px"); + } + if (group.smashDepth) { + node.setAttribute("depth", "0px"); + } + return node; + }, + }); + defineFunction({ + type: "sqrt", + names: ["\\sqrt"], + props: { numArgs: 1, numOptionalArgs: 1 }, + handler: function handler(_ref, args, optArgs) { + var parser = _ref.parser; + var index = optArgs[0]; + var body = args[0]; + return { type: "sqrt", mode: parser.mode, body: body, index: index }; + }, + htmlBuilder: function htmlBuilder(group, options) { + var inner = buildGroup$1(group.body, options.havingCrampedStyle()); + if (inner.height === 0) { + inner.height = options.fontMetrics().xHeight; + } + inner = buildCommon.wrapFragment(inner, options); + var metrics = options.fontMetrics(); + var theta = metrics.defaultRuleThickness; + var phi = theta; + if (options.style.id < Style$1.TEXT.id) { + phi = options.fontMetrics().xHeight; + } + var lineClearance = theta + phi / 4; + var minDelimiterHeight = + inner.height + inner.depth + lineClearance + theta; + var _delimiter$sqrtImage = delimiter.sqrtImage( + minDelimiterHeight, + options, + ), + img = _delimiter$sqrtImage.span, + ruleWidth = _delimiter$sqrtImage.ruleWidth, + advanceWidth = _delimiter$sqrtImage.advanceWidth; + var delimDepth = img.height - ruleWidth; + if (delimDepth > inner.height + inner.depth + lineClearance) { + lineClearance = + (lineClearance + delimDepth - inner.height - inner.depth) / 2; + } + var imgShift = img.height - inner.height - lineClearance - ruleWidth; + inner.style.paddingLeft = makeEm(advanceWidth); + var body = buildCommon.makeVList( + { + positionType: "firstBaseline", + children: [ + { type: "elem", elem: inner, wrapperClasses: ["svg-align"] }, + { type: "kern", size: -(inner.height + imgShift) }, + { type: "elem", elem: img }, + { type: "kern", size: ruleWidth }, + ], + }, + options, + ); + if (!group.index) { + return buildCommon.makeSpan(["mord", "sqrt"], [body], options); + } else { + var newOptions = options.havingStyle(Style$1.SCRIPTSCRIPT); + var rootm = buildGroup$1(group.index, newOptions, options); + var toShift = 0.6 * (body.height - body.depth); + var rootVList = buildCommon.makeVList( + { + positionType: "shift", + positionData: -toShift, + children: [{ type: "elem", elem: rootm }], + }, + options, + ); + var rootVListWrap = buildCommon.makeSpan(["root"], [rootVList]); + return buildCommon.makeSpan( + ["mord", "sqrt"], + [rootVListWrap, body], + options, + ); + } + }, + mathmlBuilder: function mathmlBuilder(group, options) { + var body = group.body, + index = group.index; + return index + ? new mathMLTree.MathNode("mroot", [ + buildGroup(body, options), + buildGroup(index, options), + ]) + : new mathMLTree.MathNode("msqrt", [buildGroup(body, options)]); + }, + }); + var styleMap = { + display: Style$1.DISPLAY, + text: Style$1.TEXT, + script: Style$1.SCRIPT, + scriptscript: Style$1.SCRIPTSCRIPT, + }; + defineFunction({ + type: "styling", + names: [ + "\\displaystyle", + "\\textstyle", + "\\scriptstyle", + "\\scriptscriptstyle", + ], + props: { numArgs: 0, allowedInText: true, primitive: true }, + handler: function handler(_ref, args) { + var breakOnTokenText = _ref.breakOnTokenText, + funcName = _ref.funcName, + parser = _ref.parser; + var body = parser.parseExpression(true, breakOnTokenText); + var style = funcName.slice(1, funcName.length - 5); + return { type: "styling", mode: parser.mode, style: style, body: body }; + }, + htmlBuilder: function htmlBuilder(group, options) { + var newStyle = styleMap[group.style]; + var newOptions = options.havingStyle(newStyle).withFont(""); + return sizingGroup(group.body, newOptions, options); + }, + mathmlBuilder: function mathmlBuilder(group, options) { + var newStyle = styleMap[group.style]; + var newOptions = options.havingStyle(newStyle); + var inner = buildExpression(group.body, newOptions); + var node = new mathMLTree.MathNode("mstyle", inner); + var styleAttributes = { + display: ["0", "true"], + text: ["0", "false"], + script: ["1", "false"], + scriptscript: ["2", "false"], + }; + var attr = styleAttributes[group.style]; + node.setAttribute("scriptlevel", attr[0]); + node.setAttribute("displaystyle", attr[1]); + return node; + }, + }); + var htmlBuilderDelegate = function htmlBuilderDelegate(group, options) { + var base = group.base; + if (!base) { + return null; + } else if (base.type === "op") { + var delegate = + base.limits && + (options.style.size === Style$1.DISPLAY.size || + base.alwaysHandleSupSub); + return delegate ? htmlBuilder$2 : null; + } else if (base.type === "operatorname") { + var _delegate = + base.alwaysHandleSupSub && + (options.style.size === Style$1.DISPLAY.size || base.limits); + return _delegate ? htmlBuilder$1 : null; + } else if (base.type === "accent") { + return utils.isCharacterBox(base.base) ? htmlBuilder$a : null; + } else if (base.type === "horizBrace") { + var isSup = !group.sub; + return isSup === base.isOver ? htmlBuilder$3 : null; + } else { + return null; + } + }; + defineFunctionBuilders({ + type: "supsub", + htmlBuilder: function htmlBuilder(group, options) { + var builderDelegate = htmlBuilderDelegate(group, options); + if (builderDelegate) { + return builderDelegate(group, options); + } + var valueBase = group.base, + valueSup = group.sup, + valueSub = group.sub; + var base = buildGroup$1(valueBase, options); + var supm; + var subm; + var metrics = options.fontMetrics(); + var supShift = 0; + var subShift = 0; + var isCharacterBox = valueBase && utils.isCharacterBox(valueBase); + if (valueSup) { + var newOptions = options.havingStyle(options.style.sup()); + supm = buildGroup$1(valueSup, newOptions, options); + if (!isCharacterBox) { + supShift = + base.height - + (newOptions.fontMetrics().supDrop * newOptions.sizeMultiplier) / + options.sizeMultiplier; + } + } + if (valueSub) { + var _newOptions = options.havingStyle(options.style.sub()); + subm = buildGroup$1(valueSub, _newOptions, options); + if (!isCharacterBox) { + subShift = + base.depth + + (_newOptions.fontMetrics().subDrop * _newOptions.sizeMultiplier) / + options.sizeMultiplier; + } + } + var minSupShift; + if (options.style === Style$1.DISPLAY) { + minSupShift = metrics.sup1; + } else if (options.style.cramped) { + minSupShift = metrics.sup3; + } else { + minSupShift = metrics.sup2; + } + var multiplier = options.sizeMultiplier; + var marginRight = makeEm(0.5 / metrics.ptPerEm / multiplier); + var marginLeft = null; + if (subm) { + var isOiint = + group.base && + group.base.type === "op" && + group.base.name && + (group.base.name === "\\oiint" || group.base.name === "\\oiiint"); + if (base instanceof SymbolNode || isOiint) { + marginLeft = makeEm(-base.italic); + } + } + var supsub; + if (supm && subm) { + supShift = Math.max( + supShift, + minSupShift, + supm.depth + 0.25 * metrics.xHeight, + ); + subShift = Math.max(subShift, metrics.sub2); + var ruleWidth = metrics.defaultRuleThickness; + var maxWidth = 4 * ruleWidth; + if (supShift - supm.depth - (subm.height - subShift) < maxWidth) { + subShift = maxWidth - (supShift - supm.depth) + subm.height; + var psi = 0.8 * metrics.xHeight - (supShift - supm.depth); + if (psi > 0) { + supShift += psi; + subShift -= psi; + } + } + var vlistElem = [ + { + type: "elem", + elem: subm, + shift: subShift, + marginRight: marginRight, + marginLeft: marginLeft, + }, + { + type: "elem", + elem: supm, + shift: -supShift, + marginRight: marginRight, + }, + ]; + supsub = buildCommon.makeVList( + { positionType: "individualShift", children: vlistElem }, + options, + ); + } else if (subm) { + subShift = Math.max( + subShift, + metrics.sub1, + subm.height - 0.8 * metrics.xHeight, + ); + var _vlistElem = [ + { + type: "elem", + elem: subm, + marginLeft: marginLeft, + marginRight: marginRight, + }, + ]; + supsub = buildCommon.makeVList( + { + positionType: "shift", + positionData: subShift, + children: _vlistElem, + }, + options, + ); + } else if (supm) { + supShift = Math.max( + supShift, + minSupShift, + supm.depth + 0.25 * metrics.xHeight, + ); + supsub = buildCommon.makeVList( + { + positionType: "shift", + positionData: -supShift, + children: [{ type: "elem", elem: supm, marginRight: marginRight }], + }, + options, + ); + } else { + throw new Error("supsub must have either sup or sub."); + } + var mclass = getTypeOfDomTree(base, "right") || "mord"; + return buildCommon.makeSpan( + [mclass], + [base, buildCommon.makeSpan(["msupsub"], [supsub])], + options, + ); + }, + mathmlBuilder: function mathmlBuilder(group, options) { + var isBrace = false; + var isOver; + var isSup; + if (group.base && group.base.type === "horizBrace") { + isSup = !!group.sup; + if (isSup === group.base.isOver) { + isBrace = true; + isOver = group.base.isOver; + } + } + if ( + group.base && + (group.base.type === "op" || group.base.type === "operatorname") + ) { + group.base.parentIsSupSub = true; + } + var children = [buildGroup(group.base, options)]; + if (group.sub) { + children.push(buildGroup(group.sub, options)); + } + if (group.sup) { + children.push(buildGroup(group.sup, options)); + } + var nodeType; + if (isBrace) { + nodeType = isOver ? "mover" : "munder"; + } else if (!group.sub) { + var base = group.base; + if ( + base && + base.type === "op" && + base.limits && + (options.style === Style$1.DISPLAY || base.alwaysHandleSupSub) + ) { + nodeType = "mover"; + } else if ( + base && + base.type === "operatorname" && + base.alwaysHandleSupSub && + (base.limits || options.style === Style$1.DISPLAY) + ) { + nodeType = "mover"; + } else { + nodeType = "msup"; + } + } else if (!group.sup) { + var _base = group.base; + if ( + _base && + _base.type === "op" && + _base.limits && + (options.style === Style$1.DISPLAY || _base.alwaysHandleSupSub) + ) { + nodeType = "munder"; + } else if ( + _base && + _base.type === "operatorname" && + _base.alwaysHandleSupSub && + (_base.limits || options.style === Style$1.DISPLAY) + ) { + nodeType = "munder"; + } else { + nodeType = "msub"; + } + } else { + var _base2 = group.base; + if ( + _base2 && + _base2.type === "op" && + _base2.limits && + options.style === Style$1.DISPLAY + ) { + nodeType = "munderover"; + } else if ( + _base2 && + _base2.type === "operatorname" && + _base2.alwaysHandleSupSub && + (options.style === Style$1.DISPLAY || _base2.limits) + ) { + nodeType = "munderover"; + } else { + nodeType = "msubsup"; + } + } + return new mathMLTree.MathNode(nodeType, children); + }, + }); + defineFunctionBuilders({ + type: "atom", + htmlBuilder: function htmlBuilder(group, options) { + return buildCommon.mathsym(group.text, group.mode, options, [ + "m" + group.family, + ]); + }, + mathmlBuilder: function mathmlBuilder(group, options) { + var node = new mathMLTree.MathNode("mo", [ + makeText(group.text, group.mode), + ]); + if (group.family === "bin") { + var variant = getVariant(group, options); + if (variant === "bold-italic") { + node.setAttribute("mathvariant", variant); + } + } else if (group.family === "punct") { + node.setAttribute("separator", "true"); + } else if (group.family === "open" || group.family === "close") { + node.setAttribute("stretchy", "false"); + } + return node; + }, + }); + var defaultVariant = { mi: "italic", mn: "normal", mtext: "normal" }; + defineFunctionBuilders({ + type: "mathord", + htmlBuilder: function htmlBuilder(group, options) { + return buildCommon.makeOrd(group, options, "mathord"); + }, + mathmlBuilder: function mathmlBuilder(group, options) { + var node = new mathMLTree.MathNode("mi", [ + makeText(group.text, group.mode, options), + ]); + var variant = getVariant(group, options) || "italic"; + if (variant !== defaultVariant[node.type]) { + node.setAttribute("mathvariant", variant); + } + return node; + }, + }); + defineFunctionBuilders({ + type: "textord", + htmlBuilder: function htmlBuilder(group, options) { + return buildCommon.makeOrd(group, options, "textord"); + }, + mathmlBuilder: function mathmlBuilder(group, options) { + var text = makeText(group.text, group.mode, options); + var variant = getVariant(group, options) || "normal"; + var node; + if (group.mode === "text") { + node = new mathMLTree.MathNode("mtext", [text]); + } else if (/[0-9]/.test(group.text)) { + node = new mathMLTree.MathNode("mn", [text]); + } else if (group.text === "\\prime") { + node = new mathMLTree.MathNode("mo", [text]); + } else { + node = new mathMLTree.MathNode("mi", [text]); + } + if (variant !== defaultVariant[node.type]) { + node.setAttribute("mathvariant", variant); + } + return node; + }, + }); + var cssSpace = { "\\nobreak": "nobreak", "\\allowbreak": "allowbreak" }; + var regularSpace = { + " ": {}, + "\\ ": {}, + "~": { className: "nobreak" }, + "\\space": {}, + "\\nobreakspace": { className: "nobreak" }, + }; + defineFunctionBuilders({ + type: "spacing", + htmlBuilder: function htmlBuilder(group, options) { + if (regularSpace.hasOwnProperty(group.text)) { + var className = regularSpace[group.text].className || ""; + if (group.mode === "text") { + var ord = buildCommon.makeOrd(group, options, "textord"); + ord.classes.push(className); + return ord; + } else { + return buildCommon.makeSpan( + ["mspace", className], + [buildCommon.mathsym(group.text, group.mode, options)], + options, + ); + } + } else if (cssSpace.hasOwnProperty(group.text)) { + return buildCommon.makeSpan( + ["mspace", cssSpace[group.text]], + [], + options, + ); + } else { + throw new ParseError('Unknown type of space "' + group.text + '"'); + } + }, + mathmlBuilder: function mathmlBuilder(group, options) { + var node; + if (regularSpace.hasOwnProperty(group.text)) { + node = new mathMLTree.MathNode("mtext", [ + new mathMLTree.TextNode("\xA0"), + ]); + } else if (cssSpace.hasOwnProperty(group.text)) { + return new mathMLTree.MathNode("mspace"); + } else { + throw new ParseError('Unknown type of space "' + group.text + '"'); + } + return node; + }, + }); + var pad = function pad() { + var padNode = new mathMLTree.MathNode("mtd", []); + padNode.setAttribute("width", "50%"); + return padNode; + }; + defineFunctionBuilders({ + type: "tag", + mathmlBuilder: function mathmlBuilder(group, options) { + var table = new mathMLTree.MathNode("mtable", [ + new mathMLTree.MathNode("mtr", [ + pad(), + new mathMLTree.MathNode("mtd", [ + buildExpressionRow(group.body, options), + ]), + pad(), + new mathMLTree.MathNode("mtd", [ + buildExpressionRow(group.tag, options), + ]), + ]), + ]); + table.setAttribute("width", "100%"); + return table; + }, + }); + var textFontFamilies = { + "\\text": undefined, + "\\textrm": "textrm", + "\\textsf": "textsf", + "\\texttt": "texttt", + "\\textnormal": "textrm", + }; + var textFontWeights = { "\\textbf": "textbf", "\\textmd": "textmd" }; + var textFontShapes = { "\\textit": "textit", "\\textup": "textup" }; + var optionsWithFont = function optionsWithFont(group, options) { + var font = group.font; + if (!font) { + return options; + } else if (textFontFamilies[font]) { + return options.withTextFontFamily(textFontFamilies[font]); + } else if (textFontWeights[font]) { + return options.withTextFontWeight(textFontWeights[font]); + } else if (font === "\\emph") { + return options.fontShape === "textit" + ? options.withTextFontShape("textup") + : options.withTextFontShape("textit"); + } + return options.withTextFontShape(textFontShapes[font]); + }; + defineFunction({ + type: "text", + names: [ + "\\text", + "\\textrm", + "\\textsf", + "\\texttt", + "\\textnormal", + "\\textbf", + "\\textmd", + "\\textit", + "\\textup", + "\\emph", + ], + props: { + numArgs: 1, + argTypes: ["text"], + allowedInArgument: true, + allowedInText: true, + }, + handler: function handler(_ref, args) { + var parser = _ref.parser, + funcName = _ref.funcName; + var body = args[0]; + return { + type: "text", + mode: parser.mode, + body: ordargument(body), + font: funcName, + }; + }, + htmlBuilder: function htmlBuilder(group, options) { + var newOptions = optionsWithFont(group, options); + var inner = buildExpression$1(group.body, newOptions, true); + return buildCommon.makeSpan(["mord", "text"], inner, newOptions); + }, + mathmlBuilder: function mathmlBuilder(group, options) { + var newOptions = optionsWithFont(group, options); + return buildExpressionRow(group.body, newOptions); + }, + }); + defineFunction({ + type: "underline", + names: ["\\underline"], + props: { numArgs: 1, allowedInText: true }, + handler: function handler(_ref, args) { + var parser = _ref.parser; + return { type: "underline", mode: parser.mode, body: args[0] }; + }, + htmlBuilder: function htmlBuilder(group, options) { + var innerGroup = buildGroup$1(group.body, options); + var line = buildCommon.makeLineSpan("underline-line", options); + var defaultRuleThickness = options.fontMetrics().defaultRuleThickness; + var vlist = buildCommon.makeVList( + { + positionType: "top", + positionData: innerGroup.height, + children: [ + { type: "kern", size: defaultRuleThickness }, + { type: "elem", elem: line }, + { type: "kern", size: 3 * defaultRuleThickness }, + { type: "elem", elem: innerGroup }, + ], + }, + options, + ); + return buildCommon.makeSpan(["mord", "underline"], [vlist], options); + }, + mathmlBuilder: function mathmlBuilder(group, options) { + var operator = new mathMLTree.MathNode("mo", [ + new mathMLTree.TextNode("\u203E"), + ]); + operator.setAttribute("stretchy", "true"); + var node = new mathMLTree.MathNode("munder", [ + buildGroup(group.body, options), + operator, + ]); + node.setAttribute("accentunder", "true"); + return node; + }, + }); + defineFunction({ + type: "vcenter", + names: ["\\vcenter"], + props: { numArgs: 1, argTypes: ["original"], allowedInText: false }, + handler: function handler(_ref, args) { + var parser = _ref.parser; + return { type: "vcenter", mode: parser.mode, body: args[0] }; + }, + htmlBuilder: function htmlBuilder(group, options) { + var body = buildGroup$1(group.body, options); + var axisHeight = options.fontMetrics().axisHeight; + var dy = 0.5 * (body.height - axisHeight - (body.depth + axisHeight)); + return buildCommon.makeVList( + { + positionType: "shift", + positionData: dy, + children: [{ type: "elem", elem: body }], + }, + options, + ); + }, + mathmlBuilder: function mathmlBuilder(group, options) { + return new mathMLTree.MathNode( + "mpadded", + [buildGroup(group.body, options)], + ["vcenter"], + ); + }, + }); + defineFunction({ + type: "verb", + names: ["\\verb"], + props: { numArgs: 0, allowedInText: true }, + handler: function handler(context, args, optArgs) { + throw new ParseError( + "\\verb ended by end of line instead of matching delimiter", + ); + }, + htmlBuilder: function htmlBuilder(group, options) { + var text = makeVerb(group); + var body = []; + var newOptions = options.havingStyle(options.style.text()); + for (var i = 0; i < text.length; i++) { + var c = text[i]; + if (c === "~") { + c = "\\textasciitilde"; + } + body.push( + buildCommon.makeSymbol( + c, + "Typewriter-Regular", + group.mode, + newOptions, + ["mord", "texttt"], + ), + ); + } + return buildCommon.makeSpan( + ["mord", "text"].concat(newOptions.sizingClasses(options)), + buildCommon.tryCombineChars(body), + newOptions, + ); + }, + mathmlBuilder: function mathmlBuilder(group, options) { + var text = new mathMLTree.TextNode(makeVerb(group)); + var node = new mathMLTree.MathNode("mtext", [text]); + node.setAttribute("mathvariant", "monospace"); + return node; + }, + }); + var makeVerb = function makeVerb(group) { + return group.body.replace(/ /g, group.star ? "\u2423" : "\xA0"); + }; + var functions = _functions; + var spaceRegexString = "[ \r\n\t]"; + var controlWordRegexString = "\\\\[a-zA-Z@]+"; + var controlSymbolRegexString = "\\\\[^\uD800-\uDFFF]"; + var controlWordWhitespaceRegexString = + "(" + controlWordRegexString + ")" + spaceRegexString + "*"; + var controlSpaceRegexString = "\\\\(\n|[ \r\t]+\n?)[ \r\t]*"; + var combiningDiacriticalMarkString = "[\u0300-\u036F]"; + var combiningDiacriticalMarksEndRegex = new RegExp( + combiningDiacriticalMarkString + "+$", + ); + var tokenRegexString = + "(" + + spaceRegexString + + "+)|" + + (controlSpaceRegexString + "|") + + "([!-\\[\\]-\u2027\u202A-\uD7FF\uF900-\uFFFF]" + + (combiningDiacriticalMarkString + "*") + + "|[\uD800-\uDBFF][\uDC00-\uDFFF]" + + (combiningDiacriticalMarkString + "*") + + "|\\\\verb\\*([^]).*?\\4" + + "|\\\\verb([^*a-zA-Z]).*?\\5" + + ("|" + controlWordWhitespaceRegexString) + + ("|" + controlSymbolRegexString + ")"); + var Lexer = (function () { + function Lexer(input, settings) { + _classCallCheck(this, Lexer); + this.input = void 0; + this.settings = void 0; + this.tokenRegex = void 0; + this.catcodes = void 0; + this.input = input; + this.settings = settings; + this.tokenRegex = new RegExp(tokenRegexString, "g"); + this.catcodes = { "%": 14, "~": 13 }; + } + return _createClass(Lexer, [ + { + key: "setCatcode", + value: function setCatcode(_char, code) { + this.catcodes[_char] = code; + }, + }, + { + key: "lex", + value: function lex() { + var input = this.input; + var pos = this.tokenRegex.lastIndex; + if (pos === input.length) { + return new Token("EOF", new SourceLocation(this, pos, pos)); + } + var match = this.tokenRegex.exec(input); + if (match === null || match.index !== pos) { + throw new ParseError( + "Unexpected character: '" + input[pos] + "'", + new Token(input[pos], new SourceLocation(this, pos, pos + 1)), + ); + } + var text = match[6] || match[3] || (match[2] ? "\\ " : " "); + if (this.catcodes[text] === 14) { + var nlIndex = input.indexOf("\n", this.tokenRegex.lastIndex); + if (nlIndex === -1) { + this.tokenRegex.lastIndex = input.length; + this.settings.reportNonstrict( + "commentAtEnd", + "% comment has no terminating newline; LaTeX would " + + "fail because of commenting the end of math mode (e.g. $)", + ); + } else { + this.tokenRegex.lastIndex = nlIndex + 1; + } + return this.lex(); + } + return new Token( + text, + new SourceLocation(this, pos, this.tokenRegex.lastIndex), + ); + }, + }, + ]); + })(); + var Namespace = (function () { + function Namespace(builtins, globalMacros) { + _classCallCheck(this, Namespace); + if (builtins === void 0) { + builtins = {}; + } + if (globalMacros === void 0) { + globalMacros = {}; + } + this.current = void 0; + this.builtins = void 0; + this.undefStack = void 0; + this.current = globalMacros; + this.builtins = builtins; + this.undefStack = []; + } + return _createClass(Namespace, [ + { + key: "beginGroup", + value: function beginGroup() { + this.undefStack.push({}); + }, + }, + { + key: "endGroup", + value: function endGroup() { + if (this.undefStack.length === 0) { + throw new ParseError( + "Unbalanced namespace destruction: attempt " + + "to pop global namespace; please report this as a bug", + ); + } + var undefs = this.undefStack.pop(); + for (var undef in undefs) { + if (undefs.hasOwnProperty(undef)) { + if (undefs[undef] == null) { + delete this.current[undef]; + } else { + this.current[undef] = undefs[undef]; + } + } + } + }, + }, + { + key: "endGroups", + value: function endGroups() { + while (this.undefStack.length > 0) { + this.endGroup(); + } + }, + }, + { + key: "has", + value: function has(name) { + return ( + this.current.hasOwnProperty(name) || + this.builtins.hasOwnProperty(name) + ); + }, + }, + { + key: "get", + value: function get(name) { + if (this.current.hasOwnProperty(name)) { + return this.current[name]; + } else { + return this.builtins[name]; + } + }, + }, + { + key: "set", + value: function set(name, value, global) { + if (global === void 0) { + global = false; + } + if (global) { + for (var i = 0; i < this.undefStack.length; i++) { + delete this.undefStack[i][name]; + } + if (this.undefStack.length > 0) { + this.undefStack[this.undefStack.length - 1][name] = value; + } + } else { + var top = this.undefStack[this.undefStack.length - 1]; + if (top && !top.hasOwnProperty(name)) { + top[name] = this.current[name]; + } + } + if (value == null) { + delete this.current[name]; + } else { + this.current[name] = value; + } + }, + }, + ]); + })(); + var macros = _macros; + defineMacro("\\noexpand", function (context) { + var t = context.popToken(); + if (context.isExpandable(t.text)) { + t.noexpand = true; + t.treatAsRelax = true; + } + return { tokens: [t], numArgs: 0 }; + }); + defineMacro("\\expandafter", function (context) { + var t = context.popToken(); + context.expandOnce(true); + return { tokens: [t], numArgs: 0 }; + }); + defineMacro("\\@firstoftwo", function (context) { + var args = context.consumeArgs(2); + return { tokens: args[0], numArgs: 0 }; + }); + defineMacro("\\@secondoftwo", function (context) { + var args = context.consumeArgs(2); + return { tokens: args[1], numArgs: 0 }; + }); + defineMacro("\\@ifnextchar", function (context) { + var args = context.consumeArgs(3); + context.consumeSpaces(); + var nextToken = context.future(); + if (args[0].length === 1 && args[0][0].text === nextToken.text) { + return { tokens: args[1], numArgs: 0 }; + } else { + return { tokens: args[2], numArgs: 0 }; + } + }); + defineMacro("\\@ifstar", "\\@ifnextchar *{\\@firstoftwo{#1}}"); + defineMacro("\\TextOrMath", function (context) { + var args = context.consumeArgs(2); + if (context.mode === "text") { + return { tokens: args[0], numArgs: 0 }; + } else { + return { tokens: args[1], numArgs: 0 }; + } + }); + var digitToNumber = { + 0: 0, + 1: 1, + 2: 2, + 3: 3, + 4: 4, + 5: 5, + 6: 6, + 7: 7, + 8: 8, + 9: 9, + a: 10, + A: 10, + b: 11, + B: 11, + c: 12, + C: 12, + d: 13, + D: 13, + e: 14, + E: 14, + f: 15, + F: 15, + }; + defineMacro("\\char", function (context) { + var token = context.popToken(); + var base; + var number = ""; + if (token.text === "'") { + base = 8; + token = context.popToken(); + } else if (token.text === '"') { + base = 16; + token = context.popToken(); + } else if (token.text === "`") { + token = context.popToken(); + if (token.text[0] === "\\") { + number = token.text.charCodeAt(1); + } else if (token.text === "EOF") { + throw new ParseError("\\char` missing argument"); + } else { + number = token.text.charCodeAt(0); + } + } else { + base = 10; + } + if (base) { + number = digitToNumber[token.text]; + if (number == null || number >= base) { + throw new ParseError("Invalid base-" + base + " digit " + token.text); + } + var digit; + while ( + (digit = digitToNumber[context.future().text]) != null && + digit < base + ) { + number *= base; + number += digit; + context.popToken(); + } + } + return "\\@char{" + number + "}"; + }); + var newcommand = function newcommand( + context, + existsOK, + nonexistsOK, + skipIfExists, + ) { + var arg = context.consumeArg().tokens; + if (arg.length !== 1) { + throw new ParseError( + "\\newcommand's first argument must be a macro name", + ); + } + var name = arg[0].text; + var exists = context.isDefined(name); + if (exists && !existsOK) { + throw new ParseError( + "\\newcommand{" + + name + + "} attempting to redefine " + + (name + "; use \\renewcommand"), + ); + } + if (!exists && !nonexistsOK) { + throw new ParseError( + "\\renewcommand{" + + name + + "} when command " + + name + + " " + + "does not yet exist; use \\newcommand", + ); + } + var numArgs = 0; + arg = context.consumeArg().tokens; + if (arg.length === 1 && arg[0].text === "[") { + var argText = ""; + var token = context.expandNextToken(); + while (token.text !== "]" && token.text !== "EOF") { + argText += token.text; + token = context.expandNextToken(); + } + if (!argText.match(/^\s*[0-9]+\s*$/)) { + throw new ParseError("Invalid number of arguments: " + argText); + } + numArgs = parseInt(argText); + arg = context.consumeArg().tokens; + } + if (!(exists && skipIfExists)) { + context.macros.set(name, { tokens: arg, numArgs: numArgs }); + } + return ""; + }; + defineMacro("\\newcommand", function (context) { + return newcommand(context, false, true, false); + }); + defineMacro("\\renewcommand", function (context) { + return newcommand(context, true, false, false); + }); + defineMacro("\\providecommand", function (context) { + return newcommand(context, true, true, true); + }); + defineMacro("\\message", function (context) { + var arg = context.consumeArgs(1)[0]; + console.log( + arg + .reverse() + .map(function (token) { + return token.text; + }) + .join(""), + ); + return ""; + }); + defineMacro("\\errmessage", function (context) { + var arg = context.consumeArgs(1)[0]; + console.error( + arg + .reverse() + .map(function (token) { + return token.text; + }) + .join(""), + ); + return ""; + }); + defineMacro("\\show", function (context) { + var tok = context.popToken(); + var name = tok.text; + console.log( + tok, + context.macros.get(name), + functions[name], + symbols.math[name], + symbols.text[name], + ); + return ""; + }); + defineMacro("\\bgroup", "{"); + defineMacro("\\egroup", "}"); + defineMacro("~", "\\nobreakspace"); + defineMacro("\\lq", "`"); + defineMacro("\\rq", "'"); + defineMacro("\\aa", "\\r a"); + defineMacro("\\AA", "\\r A"); + defineMacro( + "\\textcopyright", + "\\html@mathml{\\textcircled{c}}{\\char`\xA9}", + ); + defineMacro( + "\\copyright", + "\\TextOrMath{\\textcopyright}{\\text{\\textcopyright}}", + ); + defineMacro( + "\\textregistered", + "\\html@mathml{\\textcircled{\\scriptsize R}}{\\char`\xAE}", + ); + defineMacro("\u212C", "\\mathscr{B}"); + defineMacro("\u2130", "\\mathscr{E}"); + defineMacro("\u2131", "\\mathscr{F}"); + defineMacro("\u210B", "\\mathscr{H}"); + defineMacro("\u2110", "\\mathscr{I}"); + defineMacro("\u2112", "\\mathscr{L}"); + defineMacro("\u2133", "\\mathscr{M}"); + defineMacro("\u211B", "\\mathscr{R}"); + defineMacro("\u212D", "\\mathfrak{C}"); + defineMacro("\u210C", "\\mathfrak{H}"); + defineMacro("\u2128", "\\mathfrak{Z}"); + defineMacro("\\Bbbk", "\\Bbb{k}"); + defineMacro("\xB7", "\\cdotp"); + defineMacro("\\llap", "\\mathllap{\\textrm{#1}}"); + defineMacro("\\rlap", "\\mathrlap{\\textrm{#1}}"); + defineMacro("\\clap", "\\mathclap{\\textrm{#1}}"); + defineMacro("\\mathstrut", "\\vphantom{(}"); + defineMacro("\\underbar", "\\underline{\\text{#1}}"); + defineMacro( + "\\not", + '\\html@mathml{\\mathrel{\\mathrlap\\@not}}{\\char"338}', + ); + defineMacro( + "\\neq", + "\\html@mathml{\\mathrel{\\not=}}{\\mathrel{\\char`\u2260}}", + ); + defineMacro("\\ne", "\\neq"); + defineMacro("\u2260", "\\neq"); + defineMacro( + "\\notin", + "\\html@mathml{\\mathrel{{\\in}\\mathllap{/\\mskip1mu}}}" + + "{\\mathrel{\\char`\u2209}}", + ); + defineMacro("\u2209", "\\notin"); + defineMacro( + "\u2258", + "\\html@mathml{" + + "\\mathrel{=\\kern{-1em}\\raisebox{0.4em}{$\\scriptsize\\frown$}}" + + "}{\\mathrel{\\char`\u2258}}", + ); + defineMacro( + "\u2259", + "\\html@mathml{\\stackrel{\\tiny\\wedge}{=}}{\\mathrel{\\char`\u2258}}", + ); + defineMacro( + "\u225A", + "\\html@mathml{\\stackrel{\\tiny\\vee}{=}}{\\mathrel{\\char`\u225A}}", + ); + defineMacro( + "\u225B", + "\\html@mathml{\\stackrel{\\scriptsize\\star}{=}}" + + "{\\mathrel{\\char`\u225B}}", + ); + defineMacro( + "\u225D", + "\\html@mathml{\\stackrel{\\tiny\\mathrm{def}}{=}}" + + "{\\mathrel{\\char`\u225D}}", + ); + defineMacro( + "\u225E", + "\\html@mathml{\\stackrel{\\tiny\\mathrm{m}}{=}}" + + "{\\mathrel{\\char`\u225E}}", + ); + defineMacro( + "\u225F", + "\\html@mathml{\\stackrel{\\tiny?}{=}}{\\mathrel{\\char`\u225F}}", + ); + defineMacro("\u27C2", "\\perp"); + defineMacro("\u203C", "\\mathclose{!\\mkern-0.8mu!}"); + defineMacro("\u220C", "\\notni"); + defineMacro("\u231C", "\\ulcorner"); + defineMacro("\u231D", "\\urcorner"); + defineMacro("\u231E", "\\llcorner"); + defineMacro("\u231F", "\\lrcorner"); + defineMacro("\xA9", "\\copyright"); + defineMacro("\xAE", "\\textregistered"); + defineMacro("\uFE0F", "\\textregistered"); + defineMacro( + "\\ulcorner", + '\\html@mathml{\\@ulcorner}{\\mathop{\\char"231c}}', + ); + defineMacro( + "\\urcorner", + '\\html@mathml{\\@urcorner}{\\mathop{\\char"231d}}', + ); + defineMacro( + "\\llcorner", + '\\html@mathml{\\@llcorner}{\\mathop{\\char"231e}}', + ); + defineMacro( + "\\lrcorner", + '\\html@mathml{\\@lrcorner}{\\mathop{\\char"231f}}', + ); + defineMacro("\\vdots", "{\\varvdots\\rule{0pt}{15pt}}"); + defineMacro("\u22EE", "\\vdots"); + defineMacro("\\varGamma", "\\mathit{\\Gamma}"); + defineMacro("\\varDelta", "\\mathit{\\Delta}"); + defineMacro("\\varTheta", "\\mathit{\\Theta}"); + defineMacro("\\varLambda", "\\mathit{\\Lambda}"); + defineMacro("\\varXi", "\\mathit{\\Xi}"); + defineMacro("\\varPi", "\\mathit{\\Pi}"); + defineMacro("\\varSigma", "\\mathit{\\Sigma}"); + defineMacro("\\varUpsilon", "\\mathit{\\Upsilon}"); + defineMacro("\\varPhi", "\\mathit{\\Phi}"); + defineMacro("\\varPsi", "\\mathit{\\Psi}"); + defineMacro("\\varOmega", "\\mathit{\\Omega}"); + defineMacro("\\substack", "\\begin{subarray}{c}#1\\end{subarray}"); + defineMacro( + "\\colon", + "\\nobreak\\mskip2mu\\mathpunct{}" + + "\\mathchoice{\\mkern-3mu}{\\mkern-3mu}{}{}{:}\\mskip6mu\\relax", + ); + defineMacro("\\boxed", "\\fbox{$\\displaystyle{#1}$}"); + defineMacro("\\iff", "\\DOTSB\\;\\Longleftrightarrow\\;"); + defineMacro("\\implies", "\\DOTSB\\;\\Longrightarrow\\;"); + defineMacro("\\impliedby", "\\DOTSB\\;\\Longleftarrow\\;"); + defineMacro( + "\\dddot", + "{\\overset{\\raisebox{-0.1ex}{\\normalsize ...}}{#1}}", + ); + defineMacro( + "\\ddddot", + "{\\overset{\\raisebox{-0.1ex}{\\normalsize ....}}{#1}}", + ); + var dotsByToken = { + ",": "\\dotsc", + "\\not": "\\dotsb", + "+": "\\dotsb", + "=": "\\dotsb", + "<": "\\dotsb", + ">": "\\dotsb", + "-": "\\dotsb", + "*": "\\dotsb", + ":": "\\dotsb", + "\\DOTSB": "\\dotsb", + "\\coprod": "\\dotsb", + "\\bigvee": "\\dotsb", + "\\bigwedge": "\\dotsb", + "\\biguplus": "\\dotsb", + "\\bigcap": "\\dotsb", + "\\bigcup": "\\dotsb", + "\\prod": "\\dotsb", + "\\sum": "\\dotsb", + "\\bigotimes": "\\dotsb", + "\\bigoplus": "\\dotsb", + "\\bigodot": "\\dotsb", + "\\bigsqcup": "\\dotsb", + "\\And": "\\dotsb", + "\\longrightarrow": "\\dotsb", + "\\Longrightarrow": "\\dotsb", + "\\longleftarrow": "\\dotsb", + "\\Longleftarrow": "\\dotsb", + "\\longleftrightarrow": "\\dotsb", + "\\Longleftrightarrow": "\\dotsb", + "\\mapsto": "\\dotsb", + "\\longmapsto": "\\dotsb", + "\\hookrightarrow": "\\dotsb", + "\\doteq": "\\dotsb", + "\\mathbin": "\\dotsb", + "\\mathrel": "\\dotsb", + "\\relbar": "\\dotsb", + "\\Relbar": "\\dotsb", + "\\xrightarrow": "\\dotsb", + "\\xleftarrow": "\\dotsb", + "\\DOTSI": "\\dotsi", + "\\int": "\\dotsi", + "\\oint": "\\dotsi", + "\\iint": "\\dotsi", + "\\iiint": "\\dotsi", + "\\iiiint": "\\dotsi", + "\\idotsint": "\\dotsi", + "\\DOTSX": "\\dotsx", + }; + defineMacro("\\dots", function (context) { + var thedots = "\\dotso"; + var next = context.expandAfterFuture().text; + if (next in dotsByToken) { + thedots = dotsByToken[next]; + } else if (next.slice(0, 4) === "\\not") { + thedots = "\\dotsb"; + } else if (next in symbols.math) { + if (utils.contains(["bin", "rel"], symbols.math[next].group)) { + thedots = "\\dotsb"; + } + } + return thedots; + }); + var spaceAfterDots = { + ")": true, + "]": true, + "\\rbrack": true, + "\\}": true, + "\\rbrace": true, + "\\rangle": true, + "\\rceil": true, + "\\rfloor": true, + "\\rgroup": true, + "\\rmoustache": true, + "\\right": true, + "\\bigr": true, + "\\biggr": true, + "\\Bigr": true, + "\\Biggr": true, + $: true, + ";": true, + ".": true, + ",": true, + }; + defineMacro("\\dotso", function (context) { + var next = context.future().text; + if (next in spaceAfterDots) { + return "\\ldots\\,"; + } else { + return "\\ldots"; + } + }); + defineMacro("\\dotsc", function (context) { + var next = context.future().text; + if (next in spaceAfterDots && next !== ",") { + return "\\ldots\\,"; + } else { + return "\\ldots"; + } + }); + defineMacro("\\cdots", function (context) { + var next = context.future().text; + if (next in spaceAfterDots) { + return "\\@cdots\\,"; + } else { + return "\\@cdots"; + } + }); + defineMacro("\\dotsb", "\\cdots"); + defineMacro("\\dotsm", "\\cdots"); + defineMacro("\\dotsi", "\\!\\cdots"); + defineMacro("\\dotsx", "\\ldots\\,"); + defineMacro("\\DOTSI", "\\relax"); + defineMacro("\\DOTSB", "\\relax"); + defineMacro("\\DOTSX", "\\relax"); + defineMacro("\\tmspace", "\\TextOrMath{\\kern#1#3}{\\mskip#1#2}\\relax"); + defineMacro("\\,", "\\tmspace+{3mu}{.1667em}"); + defineMacro("\\thinspace", "\\,"); + defineMacro("\\>", "\\mskip{4mu}"); + defineMacro("\\:", "\\tmspace+{4mu}{.2222em}"); + defineMacro("\\medspace", "\\:"); + defineMacro("\\;", "\\tmspace+{5mu}{.2777em}"); + defineMacro("\\thickspace", "\\;"); + defineMacro("\\!", "\\tmspace-{3mu}{.1667em}"); + defineMacro("\\negthinspace", "\\!"); + defineMacro("\\negmedspace", "\\tmspace-{4mu}{.2222em}"); + defineMacro("\\negthickspace", "\\tmspace-{5mu}{.277em}"); + defineMacro("\\enspace", "\\kern.5em "); + defineMacro("\\enskip", "\\hskip.5em\\relax"); + defineMacro("\\quad", "\\hskip1em\\relax"); + defineMacro("\\qquad", "\\hskip2em\\relax"); + defineMacro("\\tag", "\\@ifstar\\tag@literal\\tag@paren"); + defineMacro("\\tag@paren", "\\tag@literal{({#1})}"); + defineMacro("\\tag@literal", function (context) { + if (context.macros.get("\\df@tag")) { + throw new ParseError("Multiple \\tag"); + } + return "\\gdef\\df@tag{\\text{#1}}"; + }); + defineMacro( + "\\bmod", + "\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}" + + "\\mathbin{\\rm mod}" + + "\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}", + ); + defineMacro( + "\\pod", + "\\allowbreak" + + "\\mathchoice{\\mkern18mu}{\\mkern8mu}{\\mkern8mu}{\\mkern8mu}(#1)", + ); + defineMacro("\\pmod", "\\pod{{\\rm mod}\\mkern6mu#1}"); + defineMacro( + "\\mod", + "\\allowbreak" + + "\\mathchoice{\\mkern18mu}{\\mkern12mu}{\\mkern12mu}{\\mkern12mu}" + + "{\\rm mod}\\,\\,#1", + ); + defineMacro("\\newline", "\\\\\\relax"); + defineMacro( + "\\TeX", + "\\textrm{\\html@mathml{" + + "T\\kern-.1667em\\raisebox{-.5ex}{E}\\kern-.125emX" + + "}{TeX}}", + ); + var latexRaiseA = makeEm( + fontMetricsData["Main-Regular"]["T".charCodeAt(0)][1] - + 0.7 * fontMetricsData["Main-Regular"]["A".charCodeAt(0)][1], + ); + defineMacro( + "\\LaTeX", + "\\textrm{\\html@mathml{" + + ("L\\kern-.36em\\raisebox{" + latexRaiseA + "}{\\scriptstyle A}") + + "\\kern-.15em\\TeX}{LaTeX}}", + ); + defineMacro( + "\\KaTeX", + "\\textrm{\\html@mathml{" + + ("K\\kern-.17em\\raisebox{" + latexRaiseA + "}{\\scriptstyle A}") + + "\\kern-.15em\\TeX}{KaTeX}}", + ); + defineMacro("\\hspace", "\\@ifstar\\@hspacer\\@hspace"); + defineMacro("\\@hspace", "\\hskip #1\\relax"); + defineMacro("\\@hspacer", "\\rule{0pt}{0pt}\\hskip #1\\relax"); + defineMacro("\\ordinarycolon", ":"); + defineMacro("\\vcentcolon", "\\mathrel{\\mathop\\ordinarycolon}"); + defineMacro( + "\\dblcolon", + "\\html@mathml{" + + "\\mathrel{\\vcentcolon\\mathrel{\\mkern-.9mu}\\vcentcolon}}" + + '{\\mathop{\\char"2237}}', + ); + defineMacro( + "\\coloneqq", + "\\html@mathml{" + + "\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}=}}" + + '{\\mathop{\\char"2254}}', + ); + defineMacro( + "\\Coloneqq", + "\\html@mathml{" + + "\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}=}}" + + '{\\mathop{\\char"2237\\char"3d}}', + ); + defineMacro( + "\\coloneq", + "\\html@mathml{" + + "\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}" + + '{\\mathop{\\char"3a\\char"2212}}', + ); + defineMacro( + "\\Coloneq", + "\\html@mathml{" + + "\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}" + + '{\\mathop{\\char"2237\\char"2212}}', + ); + defineMacro( + "\\eqqcolon", + "\\html@mathml{" + + "\\mathrel{=\\mathrel{\\mkern-1.2mu}\\vcentcolon}}" + + '{\\mathop{\\char"2255}}', + ); + defineMacro( + "\\Eqqcolon", + "\\html@mathml{" + + "\\mathrel{=\\mathrel{\\mkern-1.2mu}\\dblcolon}}" + + '{\\mathop{\\char"3d\\char"2237}}', + ); + defineMacro( + "\\eqcolon", + "\\html@mathml{" + + "\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\vcentcolon}}" + + '{\\mathop{\\char"2239}}', + ); + defineMacro( + "\\Eqcolon", + "\\html@mathml{" + + "\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\dblcolon}}" + + '{\\mathop{\\char"2212\\char"2237}}', + ); + defineMacro( + "\\colonapprox", + "\\html@mathml{" + + "\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\approx}}" + + '{\\mathop{\\char"3a\\char"2248}}', + ); + defineMacro( + "\\Colonapprox", + "\\html@mathml{" + + "\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\approx}}" + + '{\\mathop{\\char"2237\\char"2248}}', + ); + defineMacro( + "\\colonsim", + "\\html@mathml{" + + "\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\sim}}" + + '{\\mathop{\\char"3a\\char"223c}}', + ); + defineMacro( + "\\Colonsim", + "\\html@mathml{" + + "\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\sim}}" + + '{\\mathop{\\char"2237\\char"223c}}', + ); + defineMacro("\u2237", "\\dblcolon"); + defineMacro("\u2239", "\\eqcolon"); + defineMacro("\u2254", "\\coloneqq"); + defineMacro("\u2255", "\\eqqcolon"); + defineMacro("\u2A74", "\\Coloneqq"); + defineMacro("\\ratio", "\\vcentcolon"); + defineMacro("\\coloncolon", "\\dblcolon"); + defineMacro("\\colonequals", "\\coloneqq"); + defineMacro("\\coloncolonequals", "\\Coloneqq"); + defineMacro("\\equalscolon", "\\eqqcolon"); + defineMacro("\\equalscoloncolon", "\\Eqqcolon"); + defineMacro("\\colonminus", "\\coloneq"); + defineMacro("\\coloncolonminus", "\\Coloneq"); + defineMacro("\\minuscolon", "\\eqcolon"); + defineMacro("\\minuscoloncolon", "\\Eqcolon"); + defineMacro("\\coloncolonapprox", "\\Colonapprox"); + defineMacro("\\coloncolonsim", "\\Colonsim"); + defineMacro( + "\\simcolon", + "\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\vcentcolon}", + ); + defineMacro( + "\\simcoloncolon", + "\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\dblcolon}", + ); + defineMacro( + "\\approxcolon", + "\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\vcentcolon}", + ); + defineMacro( + "\\approxcoloncolon", + "\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\dblcolon}", + ); + defineMacro("\\notni", "\\html@mathml{\\not\\ni}{\\mathrel{\\char`\u220C}}"); + defineMacro("\\limsup", "\\DOTSB\\operatorname*{lim\\,sup}"); + defineMacro("\\liminf", "\\DOTSB\\operatorname*{lim\\,inf}"); + defineMacro("\\injlim", "\\DOTSB\\operatorname*{inj\\,lim}"); + defineMacro("\\projlim", "\\DOTSB\\operatorname*{proj\\,lim}"); + defineMacro("\\varlimsup", "\\DOTSB\\operatorname*{\\overline{lim}}"); + defineMacro("\\varliminf", "\\DOTSB\\operatorname*{\\underline{lim}}"); + defineMacro("\\varinjlim", "\\DOTSB\\operatorname*{\\underrightarrow{lim}}"); + defineMacro("\\varprojlim", "\\DOTSB\\operatorname*{\\underleftarrow{lim}}"); + defineMacro("\\gvertneqq", "\\html@mathml{\\@gvertneqq}{\u2269}"); + defineMacro("\\lvertneqq", "\\html@mathml{\\@lvertneqq}{\u2268}"); + defineMacro("\\ngeqq", "\\html@mathml{\\@ngeqq}{\u2271}"); + defineMacro("\\ngeqslant", "\\html@mathml{\\@ngeqslant}{\u2271}"); + defineMacro("\\nleqq", "\\html@mathml{\\@nleqq}{\u2270}"); + defineMacro("\\nleqslant", "\\html@mathml{\\@nleqslant}{\u2270}"); + defineMacro("\\nshortmid", "\\html@mathml{\\@nshortmid}{\u2224}"); + defineMacro("\\nshortparallel", "\\html@mathml{\\@nshortparallel}{\u2226}"); + defineMacro("\\nsubseteqq", "\\html@mathml{\\@nsubseteqq}{\u2288}"); + defineMacro("\\nsupseteqq", "\\html@mathml{\\@nsupseteqq}{\u2289}"); + defineMacro("\\varsubsetneq", "\\html@mathml{\\@varsubsetneq}{\u228A}"); + defineMacro("\\varsubsetneqq", "\\html@mathml{\\@varsubsetneqq}{\u2ACB}"); + defineMacro("\\varsupsetneq", "\\html@mathml{\\@varsupsetneq}{\u228B}"); + defineMacro("\\varsupsetneqq", "\\html@mathml{\\@varsupsetneqq}{\u2ACC}"); + defineMacro("\\imath", "\\html@mathml{\\@imath}{\u0131}"); + defineMacro("\\jmath", "\\html@mathml{\\@jmath}{\u0237}"); + defineMacro( + "\\llbracket", + "\\html@mathml{" + + "\\mathopen{[\\mkern-3.2mu[}}" + + "{\\mathopen{\\char`\u27E6}}", + ); + defineMacro( + "\\rrbracket", + "\\html@mathml{" + + "\\mathclose{]\\mkern-3.2mu]}}" + + "{\\mathclose{\\char`\u27E7}}", + ); + defineMacro("\u27E6", "\\llbracket"); + defineMacro("\u27E7", "\\rrbracket"); + defineMacro( + "\\lBrace", + "\\html@mathml{" + + "\\mathopen{\\{\\mkern-3.2mu[}}" + + "{\\mathopen{\\char`\u2983}}", + ); + defineMacro( + "\\rBrace", + "\\html@mathml{" + + "\\mathclose{]\\mkern-3.2mu\\}}}" + + "{\\mathclose{\\char`\u2984}}", + ); + defineMacro("\u2983", "\\lBrace"); + defineMacro("\u2984", "\\rBrace"); + defineMacro( + "\\minuso", + "\\mathbin{\\html@mathml{" + + "{\\mathrlap{\\mathchoice{\\kern{0.145em}}{\\kern{0.145em}}" + + "{\\kern{0.1015em}}{\\kern{0.0725em}}\\circ}{-}}}" + + "{\\char`\u29B5}}", + ); + defineMacro("\u29B5", "\\minuso"); + defineMacro("\\darr", "\\downarrow"); + defineMacro("\\dArr", "\\Downarrow"); + defineMacro("\\Darr", "\\Downarrow"); + defineMacro("\\lang", "\\langle"); + defineMacro("\\rang", "\\rangle"); + defineMacro("\\uarr", "\\uparrow"); + defineMacro("\\uArr", "\\Uparrow"); + defineMacro("\\Uarr", "\\Uparrow"); + defineMacro("\\N", "\\mathbb{N}"); + defineMacro("\\R", "\\mathbb{R}"); + defineMacro("\\Z", "\\mathbb{Z}"); + defineMacro("\\alef", "\\aleph"); + defineMacro("\\alefsym", "\\aleph"); + defineMacro("\\Alpha", "\\mathrm{A}"); + defineMacro("\\Beta", "\\mathrm{B}"); + defineMacro("\\bull", "\\bullet"); + defineMacro("\\Chi", "\\mathrm{X}"); + defineMacro("\\clubs", "\\clubsuit"); + defineMacro("\\cnums", "\\mathbb{C}"); + defineMacro("\\Complex", "\\mathbb{C}"); + defineMacro("\\Dagger", "\\ddagger"); + defineMacro("\\diamonds", "\\diamondsuit"); + defineMacro("\\empty", "\\emptyset"); + defineMacro("\\Epsilon", "\\mathrm{E}"); + defineMacro("\\Eta", "\\mathrm{H}"); + defineMacro("\\exist", "\\exists"); + defineMacro("\\harr", "\\leftrightarrow"); + defineMacro("\\hArr", "\\Leftrightarrow"); + defineMacro("\\Harr", "\\Leftrightarrow"); + defineMacro("\\hearts", "\\heartsuit"); + defineMacro("\\image", "\\Im"); + defineMacro("\\infin", "\\infty"); + defineMacro("\\Iota", "\\mathrm{I}"); + defineMacro("\\isin", "\\in"); + defineMacro("\\Kappa", "\\mathrm{K}"); + defineMacro("\\larr", "\\leftarrow"); + defineMacro("\\lArr", "\\Leftarrow"); + defineMacro("\\Larr", "\\Leftarrow"); + defineMacro("\\lrarr", "\\leftrightarrow"); + defineMacro("\\lrArr", "\\Leftrightarrow"); + defineMacro("\\Lrarr", "\\Leftrightarrow"); + defineMacro("\\Mu", "\\mathrm{M}"); + defineMacro("\\natnums", "\\mathbb{N}"); + defineMacro("\\Nu", "\\mathrm{N}"); + defineMacro("\\Omicron", "\\mathrm{O}"); + defineMacro("\\plusmn", "\\pm"); + defineMacro("\\rarr", "\\rightarrow"); + defineMacro("\\rArr", "\\Rightarrow"); + defineMacro("\\Rarr", "\\Rightarrow"); + defineMacro("\\real", "\\Re"); + defineMacro("\\reals", "\\mathbb{R}"); + defineMacro("\\Reals", "\\mathbb{R}"); + defineMacro("\\Rho", "\\mathrm{P}"); + defineMacro("\\sdot", "\\cdot"); + defineMacro("\\sect", "\\S"); + defineMacro("\\spades", "\\spadesuit"); + defineMacro("\\sub", "\\subset"); + defineMacro("\\sube", "\\subseteq"); + defineMacro("\\supe", "\\supseteq"); + defineMacro("\\Tau", "\\mathrm{T}"); + defineMacro("\\thetasym", "\\vartheta"); + defineMacro("\\weierp", "\\wp"); + defineMacro("\\Zeta", "\\mathrm{Z}"); + defineMacro("\\argmin", "\\DOTSB\\operatorname*{arg\\,min}"); + defineMacro("\\argmax", "\\DOTSB\\operatorname*{arg\\,max}"); + defineMacro("\\plim", "\\DOTSB\\mathop{\\operatorname{plim}}\\limits"); + defineMacro("\\bra", "\\mathinner{\\langle{#1}|}"); + defineMacro("\\ket", "\\mathinner{|{#1}\\rangle}"); + defineMacro("\\braket", "\\mathinner{\\langle{#1}\\rangle}"); + defineMacro("\\Bra", "\\left\\langle#1\\right|"); + defineMacro("\\Ket", "\\left|#1\\right\\rangle"); + var braketHelper = function braketHelper(one) { + return function (context) { + var left = context.consumeArg().tokens; + var middle = context.consumeArg().tokens; + var middleDouble = context.consumeArg().tokens; + var right = context.consumeArg().tokens; + var oldMiddle = context.macros.get("|"); + var oldMiddleDouble = context.macros.get("\\|"); + context.macros.beginGroup(); + var midMacro = function midMacro(_double) { + return function (context) { + if (one) { + context.macros.set("|", oldMiddle); + if (middleDouble.length) { + context.macros.set("\\|", oldMiddleDouble); + } + } + var doubled = _double; + if (!_double && middleDouble.length) { + var nextToken = context.future(); + if (nextToken.text === "|") { + context.popToken(); + doubled = true; + } + } + return { tokens: doubled ? middleDouble : middle, numArgs: 0 }; + }; + }; + context.macros.set("|", midMacro(false)); + if (middleDouble.length) { + context.macros.set("\\|", midMacro(true)); + } + var arg = context.consumeArg().tokens; + var expanded = context.expandTokens( + [].concat( + _toConsumableArray(right), + _toConsumableArray(arg), + _toConsumableArray(left), + ), + ); + context.macros.endGroup(); + return { tokens: expanded.reverse(), numArgs: 0 }; + }; + }; + defineMacro("\\bra@ket", braketHelper(false)); + defineMacro("\\bra@set", braketHelper(true)); + defineMacro( + "\\Braket", + "\\bra@ket{\\left\\langle}" + + "{\\,\\middle\\vert\\,}{\\,\\middle\\vert\\,}{\\right\\rangle}", + ); + defineMacro( + "\\Set", + "\\bra@set{\\left\\{\\:}" + + "{\\;\\middle\\vert\\;}{\\;\\middle\\Vert\\;}{\\:\\right\\}}", + ); + defineMacro("\\set", "\\bra@set{\\{\\,}{\\mid}{}{\\,\\}}"); + defineMacro("\\angln", "{\\angl n}"); + defineMacro("\\blue", "\\textcolor{##6495ed}{#1}"); + defineMacro("\\orange", "\\textcolor{##ffa500}{#1}"); + defineMacro("\\pink", "\\textcolor{##ff00af}{#1}"); + defineMacro("\\red", "\\textcolor{##df0030}{#1}"); + defineMacro("\\green", "\\textcolor{##28ae7b}{#1}"); + defineMacro("\\gray", "\\textcolor{gray}{#1}"); + defineMacro("\\purple", "\\textcolor{##9d38bd}{#1}"); + defineMacro("\\blueA", "\\textcolor{##ccfaff}{#1}"); + defineMacro("\\blueB", "\\textcolor{##80f6ff}{#1}"); + defineMacro("\\blueC", "\\textcolor{##63d9ea}{#1}"); + defineMacro("\\blueD", "\\textcolor{##11accd}{#1}"); + defineMacro("\\blueE", "\\textcolor{##0c7f99}{#1}"); + defineMacro("\\tealA", "\\textcolor{##94fff5}{#1}"); + defineMacro("\\tealB", "\\textcolor{##26edd5}{#1}"); + defineMacro("\\tealC", "\\textcolor{##01d1c1}{#1}"); + defineMacro("\\tealD", "\\textcolor{##01a995}{#1}"); + defineMacro("\\tealE", "\\textcolor{##208170}{#1}"); + defineMacro("\\greenA", "\\textcolor{##b6ffb0}{#1}"); + defineMacro("\\greenB", "\\textcolor{##8af281}{#1}"); + defineMacro("\\greenC", "\\textcolor{##74cf70}{#1}"); + defineMacro("\\greenD", "\\textcolor{##1fab54}{#1}"); + defineMacro("\\greenE", "\\textcolor{##0d923f}{#1}"); + defineMacro("\\goldA", "\\textcolor{##ffd0a9}{#1}"); + defineMacro("\\goldB", "\\textcolor{##ffbb71}{#1}"); + defineMacro("\\goldC", "\\textcolor{##ff9c39}{#1}"); + defineMacro("\\goldD", "\\textcolor{##e07d10}{#1}"); + defineMacro("\\goldE", "\\textcolor{##a75a05}{#1}"); + defineMacro("\\redA", "\\textcolor{##fca9a9}{#1}"); + defineMacro("\\redB", "\\textcolor{##ff8482}{#1}"); + defineMacro("\\redC", "\\textcolor{##f9685d}{#1}"); + defineMacro("\\redD", "\\textcolor{##e84d39}{#1}"); + defineMacro("\\redE", "\\textcolor{##bc2612}{#1}"); + defineMacro("\\maroonA", "\\textcolor{##ffbde0}{#1}"); + defineMacro("\\maroonB", "\\textcolor{##ff92c6}{#1}"); + defineMacro("\\maroonC", "\\textcolor{##ed5fa6}{#1}"); + defineMacro("\\maroonD", "\\textcolor{##ca337c}{#1}"); + defineMacro("\\maroonE", "\\textcolor{##9e034e}{#1}"); + defineMacro("\\purpleA", "\\textcolor{##ddd7ff}{#1}"); + defineMacro("\\purpleB", "\\textcolor{##c6b9fc}{#1}"); + defineMacro("\\purpleC", "\\textcolor{##aa87ff}{#1}"); + defineMacro("\\purpleD", "\\textcolor{##7854ab}{#1}"); + defineMacro("\\purpleE", "\\textcolor{##543b78}{#1}"); + defineMacro("\\mintA", "\\textcolor{##f5f9e8}{#1}"); + defineMacro("\\mintB", "\\textcolor{##edf2df}{#1}"); + defineMacro("\\mintC", "\\textcolor{##e0e5cc}{#1}"); + defineMacro("\\grayA", "\\textcolor{##f6f7f7}{#1}"); + defineMacro("\\grayB", "\\textcolor{##f0f1f2}{#1}"); + defineMacro("\\grayC", "\\textcolor{##e3e5e6}{#1}"); + defineMacro("\\grayD", "\\textcolor{##d6d8da}{#1}"); + defineMacro("\\grayE", "\\textcolor{##babec2}{#1}"); + defineMacro("\\grayF", "\\textcolor{##888d93}{#1}"); + defineMacro("\\grayG", "\\textcolor{##626569}{#1}"); + defineMacro("\\grayH", "\\textcolor{##3b3e40}{#1}"); + defineMacro("\\grayI", "\\textcolor{##21242c}{#1}"); + defineMacro("\\kaBlue", "\\textcolor{##314453}{#1}"); + defineMacro("\\kaGreen", "\\textcolor{##71B307}{#1}"); + var implicitCommands = { + "^": true, + _: true, + "\\limits": true, + "\\nolimits": true, + }; + var MacroExpander = (function () { + function MacroExpander(input, settings, mode) { + _classCallCheck(this, MacroExpander); + this.settings = void 0; + this.expansionCount = void 0; + this.lexer = void 0; + this.macros = void 0; + this.stack = void 0; + this.mode = void 0; + this.settings = settings; + this.expansionCount = 0; + this.feed(input); + this.macros = new Namespace(macros, settings.macros); + this.mode = mode; + this.stack = []; + } + return _createClass(MacroExpander, [ + { + key: "feed", + value: function feed(input) { + this.lexer = new Lexer(input, this.settings); + }, + }, + { + key: "switchMode", + value: function switchMode(newMode) { + this.mode = newMode; + }, + }, + { + key: "beginGroup", + value: function beginGroup() { + this.macros.beginGroup(); + }, + }, + { + key: "endGroup", + value: function endGroup() { + this.macros.endGroup(); + }, + }, + { + key: "endGroups", + value: function endGroups() { + this.macros.endGroups(); + }, + }, + { + key: "future", + value: function future() { + if (this.stack.length === 0) { + this.pushToken(this.lexer.lex()); + } + return this.stack[this.stack.length - 1]; + }, + }, + { + key: "popToken", + value: function popToken() { + this.future(); + return this.stack.pop(); + }, + }, + { + key: "pushToken", + value: function pushToken(token) { + this.stack.push(token); + }, + }, + { + key: "pushTokens", + value: function pushTokens(tokens) { + var _this$stack; + (_this$stack = this.stack).push.apply( + _this$stack, + _toConsumableArray(tokens), + ); + }, + }, + { + key: "scanArgument", + value: function scanArgument(isOptional) { + var start; + var end; + var tokens; + if (isOptional) { + this.consumeSpaces(); + if (this.future().text !== "[") { + return null; + } + start = this.popToken(); + var _this$consumeArg = this.consumeArg(["]"]); + tokens = _this$consumeArg.tokens; + end = _this$consumeArg.end; + } else { + var _this$consumeArg2 = this.consumeArg(); + tokens = _this$consumeArg2.tokens; + start = _this$consumeArg2.start; + end = _this$consumeArg2.end; + } + this.pushToken(new Token("EOF", end.loc)); + this.pushTokens(tokens); + return start.range(end, ""); + }, + }, + { + key: "consumeSpaces", + value: function consumeSpaces() { + for (;;) { + var token = this.future(); + if (token.text === " ") { + this.stack.pop(); + } else { + break; + } + } + }, + }, + { + key: "consumeArg", + value: function consumeArg(delims) { + var tokens = []; + var isDelimited = delims && delims.length > 0; + if (!isDelimited) { + this.consumeSpaces(); + } + var start = this.future(); + var tok; + var depth = 0; + var match = 0; + do { + tok = this.popToken(); + tokens.push(tok); + if (tok.text === "{") { + ++depth; + } else if (tok.text === "}") { + --depth; + if (depth === -1) { + throw new ParseError("Extra }", tok); + } + } else if (tok.text === "EOF") { + throw new ParseError( + "Unexpected end of input in a macro argument" + + ", expected '" + + (delims && isDelimited ? delims[match] : "}") + + "'", + tok, + ); + } + if (delims && isDelimited) { + if ( + (depth === 0 || (depth === 1 && delims[match] === "{")) && + tok.text === delims[match] + ) { + ++match; + if (match === delims.length) { + tokens.splice(-match, match); + break; + } + } else { + match = 0; + } + } + } while (depth !== 0 || isDelimited); + if (start.text === "{" && tokens[tokens.length - 1].text === "}") { + tokens.pop(); + tokens.shift(); + } + tokens.reverse(); + return { tokens: tokens, start: start, end: tok }; + }, + }, + { + key: "consumeArgs", + value: function consumeArgs(numArgs, delimiters) { + if (delimiters) { + if (delimiters.length !== numArgs + 1) { + throw new ParseError( + "The length of delimiters doesn't match the number of args!", + ); + } + var delims = delimiters[0]; + for (var i = 0; i < delims.length; i++) { + var tok = this.popToken(); + if (delims[i] !== tok.text) { + throw new ParseError( + "Use of the macro doesn't match its definition", + tok, + ); + } + } + } + var args = []; + for (var _i = 0; _i < numArgs; _i++) { + args.push(this.consumeArg(delimiters && delimiters[_i + 1]).tokens); + } + return args; + }, + }, + { + key: "countExpansion", + value: function countExpansion(amount) { + this.expansionCount += amount; + if (this.expansionCount > this.settings.maxExpand) { + throw new ParseError( + "Too many expansions: infinite loop or " + + "need to increase maxExpand setting", + ); + } + }, + }, + { + key: "expandOnce", + value: function expandOnce(expandableOnly) { + var topToken = this.popToken(); + var name = topToken.text; + var expansion = !topToken.noexpand ? this._getExpansion(name) : null; + if (expansion == null || (expandableOnly && expansion.unexpandable)) { + if ( + expandableOnly && + expansion == null && + name[0] === "\\" && + !this.isDefined(name) + ) { + throw new ParseError("Undefined control sequence: " + name); + } + this.pushToken(topToken); + return false; + } + this.countExpansion(1); + var tokens = expansion.tokens; + var args = this.consumeArgs(expansion.numArgs, expansion.delimiters); + if (expansion.numArgs) { + tokens = tokens.slice(); + for (var i = tokens.length - 1; i >= 0; --i) { + var tok = tokens[i]; + if (tok.text === "#") { + if (i === 0) { + throw new ParseError( + "Incomplete placeholder at end of macro body", + tok, + ); + } + tok = tokens[--i]; + if (tok.text === "#") { + tokens.splice(i + 1, 1); + } else if (/^[1-9]$/.test(tok.text)) { + var _tokens; + (_tokens = tokens).splice.apply( + _tokens, + [i, 2].concat(_toConsumableArray(args[+tok.text - 1])), + ); + } else { + throw new ParseError("Not a valid argument number", tok); + } + } + } + } + this.pushTokens(tokens); + return tokens.length; + }, + }, + { + key: "expandAfterFuture", + value: function expandAfterFuture() { + this.expandOnce(); + return this.future(); + }, + }, + { + key: "expandNextToken", + value: function expandNextToken() { + for (;;) { + if (this.expandOnce() === false) { + var token = this.stack.pop(); + if (token.treatAsRelax) { + token.text = "\\relax"; + } + return token; + } + } + throw new Error(); + }, + }, + { + key: "expandMacro", + value: function expandMacro(name) { + return this.macros.has(name) + ? this.expandTokens([new Token(name)]) + : undefined; + }, + }, + { + key: "expandTokens", + value: function expandTokens(tokens) { + var output = []; + var oldStackLength = this.stack.length; + this.pushTokens(tokens); + while (this.stack.length > oldStackLength) { + if (this.expandOnce(true) === false) { + var token = this.stack.pop(); + if (token.treatAsRelax) { + token.noexpand = false; + token.treatAsRelax = false; + } + output.push(token); + } + } + this.countExpansion(output.length); + return output; + }, + }, + { + key: "expandMacroAsText", + value: function expandMacroAsText(name) { + var tokens = this.expandMacro(name); + if (tokens) { + return tokens + .map(function (token) { + return token.text; + }) + .join(""); + } else { + return tokens; + } + }, + }, + { + key: "_getExpansion", + value: function _getExpansion(name) { + var definition = this.macros.get(name); + if (definition == null) { + return definition; + } + if (name.length === 1) { + var catcode = this.lexer.catcodes[name]; + if (catcode != null && catcode !== 13) { + return; + } + } + var expansion = + typeof definition === "function" ? definition(this) : definition; + if (typeof expansion === "string") { + var numArgs = 0; + if (expansion.indexOf("#") !== -1) { + var stripped = expansion.replace(/##/g, ""); + while (stripped.indexOf("#" + (numArgs + 1)) !== -1) { + ++numArgs; + } + } + var bodyLexer = new Lexer(expansion, this.settings); + var tokens = []; + var tok = bodyLexer.lex(); + while (tok.text !== "EOF") { + tokens.push(tok); + tok = bodyLexer.lex(); + } + tokens.reverse(); + var expanded = { tokens: tokens, numArgs: numArgs }; + return expanded; + } + return expansion; + }, + }, + { + key: "isDefined", + value: function isDefined(name) { + return ( + this.macros.has(name) || + functions.hasOwnProperty(name) || + symbols.math.hasOwnProperty(name) || + symbols.text.hasOwnProperty(name) || + implicitCommands.hasOwnProperty(name) + ); + }, + }, + { + key: "isExpandable", + value: function isExpandable(name) { + var macro = this.macros.get(name); + return macro != null + ? typeof macro === "string" || + typeof macro === "function" || + !macro.unexpandable + : functions.hasOwnProperty(name) && !functions[name].primitive; + }, + }, + ]); + })(); + var unicodeSubRegEx = /^[₊₋₌₍₎₀₁₂₃₄₅₆₇₈₉ₐₑₕᵢⱼₖₗₘₙₒₚᵣₛₜᵤᵥₓᵦᵧᵨᵩᵪ]/; + var uSubsAndSups = Object.freeze({ + "\u208A": "+", + "\u208B": "-", + "\u208C": "=", + "\u208D": "(", + "\u208E": ")", + "\u2080": "0", + "\u2081": "1", + "\u2082": "2", + "\u2083": "3", + "\u2084": "4", + "\u2085": "5", + "\u2086": "6", + "\u2087": "7", + "\u2088": "8", + "\u2089": "9", + "\u2090": "a", + "\u2091": "e", + "\u2095": "h", + "\u1D62": "i", + "\u2C7C": "j", + "\u2096": "k", + "\u2097": "l", + "\u2098": "m", + "\u2099": "n", + "\u2092": "o", + "\u209A": "p", + "\u1D63": "r", + "\u209B": "s", + "\u209C": "t", + "\u1D64": "u", + "\u1D65": "v", + "\u2093": "x", + "\u1D66": "\u03B2", + "\u1D67": "\u03B3", + "\u1D68": "\u03C1", + "\u1D69": "\u03D5", + "\u1D6A": "\u03C7", + "\u207A": "+", + "\u207B": "-", + "\u207C": "=", + "\u207D": "(", + "\u207E": ")", + "\u2070": "0", + "\xB9": "1", + "\xB2": "2", + "\xB3": "3", + "\u2074": "4", + "\u2075": "5", + "\u2076": "6", + "\u2077": "7", + "\u2078": "8", + "\u2079": "9", + "\u1D2C": "A", + "\u1D2E": "B", + "\u1D30": "D", + "\u1D31": "E", + "\u1D33": "G", + "\u1D34": "H", + "\u1D35": "I", + "\u1D36": "J", + "\u1D37": "K", + "\u1D38": "L", + "\u1D39": "M", + "\u1D3A": "N", + "\u1D3C": "O", + "\u1D3E": "P", + "\u1D3F": "R", + "\u1D40": "T", + "\u1D41": "U", + "\u2C7D": "V", + "\u1D42": "W", + "\u1D43": "a", + "\u1D47": "b", + "\u1D9C": "c", + "\u1D48": "d", + "\u1D49": "e", + "\u1DA0": "f", + "\u1D4D": "g", + "\u02B0": "h", + "\u2071": "i", + "\u02B2": "j", + "\u1D4F": "k", + "\u02E1": "l", + "\u1D50": "m", + "\u207F": "n", + "\u1D52": "o", + "\u1D56": "p", + "\u02B3": "r", + "\u02E2": "s", + "\u1D57": "t", + "\u1D58": "u", + "\u1D5B": "v", + "\u02B7": "w", + "\u02E3": "x", + "\u02B8": "y", + "\u1DBB": "z", + "\u1D5D": "\u03B2", + "\u1D5E": "\u03B3", + "\u1D5F": "\u03B4", + "\u1D60": "\u03D5", + "\u1D61": "\u03C7", + "\u1DBF": "\u03B8", + }); + var unicodeAccents = { + "\u0301": { text: "\\'", math: "\\acute" }, + "\u0300": { text: "\\`", math: "\\grave" }, + "\u0308": { text: '\\"', math: "\\ddot" }, + "\u0303": { text: "\\~", math: "\\tilde" }, + "\u0304": { text: "\\=", math: "\\bar" }, + "\u0306": { text: "\\u", math: "\\breve" }, + "\u030C": { text: "\\v", math: "\\check" }, + "\u0302": { text: "\\^", math: "\\hat" }, + "\u0307": { text: "\\.", math: "\\dot" }, + "\u030A": { text: "\\r", math: "\\mathring" }, + "\u030B": { text: "\\H" }, + "\u0327": { text: "\\c" }, + }; + var unicodeSymbols = { + "\xE1": "a\u0301", + "\xE0": "a\u0300", + "\xE4": "a\u0308", + "\u01DF": "a\u0308\u0304", + "\xE3": "a\u0303", + "\u0101": "a\u0304", + "\u0103": "a\u0306", + "\u1EAF": "a\u0306\u0301", + "\u1EB1": "a\u0306\u0300", + "\u1EB5": "a\u0306\u0303", + "\u01CE": "a\u030C", + "\xE2": "a\u0302", + "\u1EA5": "a\u0302\u0301", + "\u1EA7": "a\u0302\u0300", + "\u1EAB": "a\u0302\u0303", + "\u0227": "a\u0307", + "\u01E1": "a\u0307\u0304", + "\xE5": "a\u030A", + "\u01FB": "a\u030A\u0301", + "\u1E03": "b\u0307", + "\u0107": "c\u0301", + "\u1E09": "c\u0327\u0301", + "\u010D": "c\u030C", + "\u0109": "c\u0302", + "\u010B": "c\u0307", + "\xE7": "c\u0327", + "\u010F": "d\u030C", + "\u1E0B": "d\u0307", + "\u1E11": "d\u0327", + "\xE9": "e\u0301", + "\xE8": "e\u0300", + "\xEB": "e\u0308", + "\u1EBD": "e\u0303", + "\u0113": "e\u0304", + "\u1E17": "e\u0304\u0301", + "\u1E15": "e\u0304\u0300", + "\u0115": "e\u0306", + "\u1E1D": "e\u0327\u0306", + "\u011B": "e\u030C", + "\xEA": "e\u0302", + "\u1EBF": "e\u0302\u0301", + "\u1EC1": "e\u0302\u0300", + "\u1EC5": "e\u0302\u0303", + "\u0117": "e\u0307", + "\u0229": "e\u0327", + "\u1E1F": "f\u0307", + "\u01F5": "g\u0301", + "\u1E21": "g\u0304", + "\u011F": "g\u0306", + "\u01E7": "g\u030C", + "\u011D": "g\u0302", + "\u0121": "g\u0307", + "\u0123": "g\u0327", + "\u1E27": "h\u0308", + "\u021F": "h\u030C", + "\u0125": "h\u0302", + "\u1E23": "h\u0307", + "\u1E29": "h\u0327", + "\xED": "i\u0301", + "\xEC": "i\u0300", + "\xEF": "i\u0308", + "\u1E2F": "i\u0308\u0301", + "\u0129": "i\u0303", + "\u012B": "i\u0304", + "\u012D": "i\u0306", + "\u01D0": "i\u030C", + "\xEE": "i\u0302", + "\u01F0": "j\u030C", + "\u0135": "j\u0302", + "\u1E31": "k\u0301", + "\u01E9": "k\u030C", + "\u0137": "k\u0327", + "\u013A": "l\u0301", + "\u013E": "l\u030C", + "\u013C": "l\u0327", + "\u1E3F": "m\u0301", + "\u1E41": "m\u0307", + "\u0144": "n\u0301", + "\u01F9": "n\u0300", + "\xF1": "n\u0303", + "\u0148": "n\u030C", + "\u1E45": "n\u0307", + "\u0146": "n\u0327", + "\xF3": "o\u0301", + "\xF2": "o\u0300", + "\xF6": "o\u0308", + "\u022B": "o\u0308\u0304", + "\xF5": "o\u0303", + "\u1E4D": "o\u0303\u0301", + "\u1E4F": "o\u0303\u0308", + "\u022D": "o\u0303\u0304", + "\u014D": "o\u0304", + "\u1E53": "o\u0304\u0301", + "\u1E51": "o\u0304\u0300", + "\u014F": "o\u0306", + "\u01D2": "o\u030C", + "\xF4": "o\u0302", + "\u1ED1": "o\u0302\u0301", + "\u1ED3": "o\u0302\u0300", + "\u1ED7": "o\u0302\u0303", + "\u022F": "o\u0307", + "\u0231": "o\u0307\u0304", + "\u0151": "o\u030B", + "\u1E55": "p\u0301", + "\u1E57": "p\u0307", + "\u0155": "r\u0301", + "\u0159": "r\u030C", + "\u1E59": "r\u0307", + "\u0157": "r\u0327", + "\u015B": "s\u0301", + "\u1E65": "s\u0301\u0307", + "\u0161": "s\u030C", + "\u1E67": "s\u030C\u0307", + "\u015D": "s\u0302", + "\u1E61": "s\u0307", + "\u015F": "s\u0327", + "\u1E97": "t\u0308", + "\u0165": "t\u030C", + "\u1E6B": "t\u0307", + "\u0163": "t\u0327", + "\xFA": "u\u0301", + "\xF9": "u\u0300", + "\xFC": "u\u0308", + "\u01D8": "u\u0308\u0301", + "\u01DC": "u\u0308\u0300", + "\u01D6": "u\u0308\u0304", + "\u01DA": "u\u0308\u030C", + "\u0169": "u\u0303", + "\u1E79": "u\u0303\u0301", + "\u016B": "u\u0304", + "\u1E7B": "u\u0304\u0308", + "\u016D": "u\u0306", + "\u01D4": "u\u030C", + "\xFB": "u\u0302", + "\u016F": "u\u030A", + "\u0171": "u\u030B", + "\u1E7D": "v\u0303", + "\u1E83": "w\u0301", + "\u1E81": "w\u0300", + "\u1E85": "w\u0308", + "\u0175": "w\u0302", + "\u1E87": "w\u0307", + "\u1E98": "w\u030A", + "\u1E8D": "x\u0308", + "\u1E8B": "x\u0307", + "\xFD": "y\u0301", + "\u1EF3": "y\u0300", + "\xFF": "y\u0308", + "\u1EF9": "y\u0303", + "\u0233": "y\u0304", + "\u0177": "y\u0302", + "\u1E8F": "y\u0307", + "\u1E99": "y\u030A", + "\u017A": "z\u0301", + "\u017E": "z\u030C", + "\u1E91": "z\u0302", + "\u017C": "z\u0307", + "\xC1": "A\u0301", + "\xC0": "A\u0300", + "\xC4": "A\u0308", + "\u01DE": "A\u0308\u0304", + "\xC3": "A\u0303", + "\u0100": "A\u0304", + "\u0102": "A\u0306", + "\u1EAE": "A\u0306\u0301", + "\u1EB0": "A\u0306\u0300", + "\u1EB4": "A\u0306\u0303", + "\u01CD": "A\u030C", + "\xC2": "A\u0302", + "\u1EA4": "A\u0302\u0301", + "\u1EA6": "A\u0302\u0300", + "\u1EAA": "A\u0302\u0303", + "\u0226": "A\u0307", + "\u01E0": "A\u0307\u0304", + "\xC5": "A\u030A", + "\u01FA": "A\u030A\u0301", + "\u1E02": "B\u0307", + "\u0106": "C\u0301", + "\u1E08": "C\u0327\u0301", + "\u010C": "C\u030C", + "\u0108": "C\u0302", + "\u010A": "C\u0307", + "\xC7": "C\u0327", + "\u010E": "D\u030C", + "\u1E0A": "D\u0307", + "\u1E10": "D\u0327", + "\xC9": "E\u0301", + "\xC8": "E\u0300", + "\xCB": "E\u0308", + "\u1EBC": "E\u0303", + "\u0112": "E\u0304", + "\u1E16": "E\u0304\u0301", + "\u1E14": "E\u0304\u0300", + "\u0114": "E\u0306", + "\u1E1C": "E\u0327\u0306", + "\u011A": "E\u030C", + "\xCA": "E\u0302", + "\u1EBE": "E\u0302\u0301", + "\u1EC0": "E\u0302\u0300", + "\u1EC4": "E\u0302\u0303", + "\u0116": "E\u0307", + "\u0228": "E\u0327", + "\u1E1E": "F\u0307", + "\u01F4": "G\u0301", + "\u1E20": "G\u0304", + "\u011E": "G\u0306", + "\u01E6": "G\u030C", + "\u011C": "G\u0302", + "\u0120": "G\u0307", + "\u0122": "G\u0327", + "\u1E26": "H\u0308", + "\u021E": "H\u030C", + "\u0124": "H\u0302", + "\u1E22": "H\u0307", + "\u1E28": "H\u0327", + "\xCD": "I\u0301", + "\xCC": "I\u0300", + "\xCF": "I\u0308", + "\u1E2E": "I\u0308\u0301", + "\u0128": "I\u0303", + "\u012A": "I\u0304", + "\u012C": "I\u0306", + "\u01CF": "I\u030C", + "\xCE": "I\u0302", + "\u0130": "I\u0307", + "\u0134": "J\u0302", + "\u1E30": "K\u0301", + "\u01E8": "K\u030C", + "\u0136": "K\u0327", + "\u0139": "L\u0301", + "\u013D": "L\u030C", + "\u013B": "L\u0327", + "\u1E3E": "M\u0301", + "\u1E40": "M\u0307", + "\u0143": "N\u0301", + "\u01F8": "N\u0300", + "\xD1": "N\u0303", + "\u0147": "N\u030C", + "\u1E44": "N\u0307", + "\u0145": "N\u0327", + "\xD3": "O\u0301", + "\xD2": "O\u0300", + "\xD6": "O\u0308", + "\u022A": "O\u0308\u0304", + "\xD5": "O\u0303", + "\u1E4C": "O\u0303\u0301", + "\u1E4E": "O\u0303\u0308", + "\u022C": "O\u0303\u0304", + "\u014C": "O\u0304", + "\u1E52": "O\u0304\u0301", + "\u1E50": "O\u0304\u0300", + "\u014E": "O\u0306", + "\u01D1": "O\u030C", + "\xD4": "O\u0302", + "\u1ED0": "O\u0302\u0301", + "\u1ED2": "O\u0302\u0300", + "\u1ED6": "O\u0302\u0303", + "\u022E": "O\u0307", + "\u0230": "O\u0307\u0304", + "\u0150": "O\u030B", + "\u1E54": "P\u0301", + "\u1E56": "P\u0307", + "\u0154": "R\u0301", + "\u0158": "R\u030C", + "\u1E58": "R\u0307", + "\u0156": "R\u0327", + "\u015A": "S\u0301", + "\u1E64": "S\u0301\u0307", + "\u0160": "S\u030C", + "\u1E66": "S\u030C\u0307", + "\u015C": "S\u0302", + "\u1E60": "S\u0307", + "\u015E": "S\u0327", + "\u0164": "T\u030C", + "\u1E6A": "T\u0307", + "\u0162": "T\u0327", + "\xDA": "U\u0301", + "\xD9": "U\u0300", + "\xDC": "U\u0308", + "\u01D7": "U\u0308\u0301", + "\u01DB": "U\u0308\u0300", + "\u01D5": "U\u0308\u0304", + "\u01D9": "U\u0308\u030C", + "\u0168": "U\u0303", + "\u1E78": "U\u0303\u0301", + "\u016A": "U\u0304", + "\u1E7A": "U\u0304\u0308", + "\u016C": "U\u0306", + "\u01D3": "U\u030C", + "\xDB": "U\u0302", + "\u016E": "U\u030A", + "\u0170": "U\u030B", + "\u1E7C": "V\u0303", + "\u1E82": "W\u0301", + "\u1E80": "W\u0300", + "\u1E84": "W\u0308", + "\u0174": "W\u0302", + "\u1E86": "W\u0307", + "\u1E8C": "X\u0308", + "\u1E8A": "X\u0307", + "\xDD": "Y\u0301", + "\u1EF2": "Y\u0300", + "\u0178": "Y\u0308", + "\u1EF8": "Y\u0303", + "\u0232": "Y\u0304", + "\u0176": "Y\u0302", + "\u1E8E": "Y\u0307", + "\u0179": "Z\u0301", + "\u017D": "Z\u030C", + "\u1E90": "Z\u0302", + "\u017B": "Z\u0307", + "\u03AC": "\u03B1\u0301", + "\u1F70": "\u03B1\u0300", + "\u1FB1": "\u03B1\u0304", + "\u1FB0": "\u03B1\u0306", + "\u03AD": "\u03B5\u0301", + "\u1F72": "\u03B5\u0300", + "\u03AE": "\u03B7\u0301", + "\u1F74": "\u03B7\u0300", + "\u03AF": "\u03B9\u0301", + "\u1F76": "\u03B9\u0300", + "\u03CA": "\u03B9\u0308", + "\u0390": "\u03B9\u0308\u0301", + "\u1FD2": "\u03B9\u0308\u0300", + "\u1FD1": "\u03B9\u0304", + "\u1FD0": "\u03B9\u0306", + "\u03CC": "\u03BF\u0301", + "\u1F78": "\u03BF\u0300", + "\u03CD": "\u03C5\u0301", + "\u1F7A": "\u03C5\u0300", + "\u03CB": "\u03C5\u0308", + "\u03B0": "\u03C5\u0308\u0301", + "\u1FE2": "\u03C5\u0308\u0300", + "\u1FE1": "\u03C5\u0304", + "\u1FE0": "\u03C5\u0306", + "\u03CE": "\u03C9\u0301", + "\u1F7C": "\u03C9\u0300", + "\u038E": "\u03A5\u0301", + "\u1FEA": "\u03A5\u0300", + "\u03AB": "\u03A5\u0308", + "\u1FE9": "\u03A5\u0304", + "\u1FE8": "\u03A5\u0306", + "\u038F": "\u03A9\u0301", + "\u1FFA": "\u03A9\u0300", + }; + var Parser = (function () { + function Parser(input, settings) { + _classCallCheck(this, Parser); + this.mode = void 0; + this.gullet = void 0; + this.settings = void 0; + this.leftrightDepth = void 0; + this.nextToken = void 0; + this.mode = "math"; + this.gullet = new MacroExpander(input, settings, this.mode); + this.settings = settings; + this.leftrightDepth = 0; + } + return _createClass(Parser, [ + { + key: "expect", + value: function expect(text, consume) { + if (consume === void 0) { + consume = true; + } + if (this.fetch().text !== text) { + throw new ParseError( + "Expected '" + text + "', got '" + this.fetch().text + "'", + this.fetch(), + ); + } + if (consume) { + this.consume(); + } + }, + }, + { + key: "consume", + value: function consume() { + this.nextToken = null; + }, + }, + { + key: "fetch", + value: function fetch() { + if (this.nextToken == null) { + this.nextToken = this.gullet.expandNextToken(); + } + return this.nextToken; + }, + }, + { + key: "switchMode", + value: function switchMode(newMode) { + this.mode = newMode; + this.gullet.switchMode(newMode); + }, + }, + { + key: "parse", + value: function parse() { + if (!this.settings.globalGroup) { + this.gullet.beginGroup(); + } + if (this.settings.colorIsTextColor) { + this.gullet.macros.set("\\color", "\\textcolor"); + } + try { + var parse = this.parseExpression(false); + this.expect("EOF"); + if (!this.settings.globalGroup) { + this.gullet.endGroup(); + } + return parse; + } finally { + this.gullet.endGroups(); + } + }, + }, + { + key: "subparse", + value: function subparse(tokens) { + var oldToken = this.nextToken; + this.consume(); + this.gullet.pushToken(new Token("}")); + this.gullet.pushTokens(tokens); + var parse = this.parseExpression(false); + this.expect("}"); + this.nextToken = oldToken; + return parse; + }, + }, + { + key: "parseExpression", + value: function parseExpression(breakOnInfix, breakOnTokenText) { + var body = []; + while (true) { + if (this.mode === "math") { + this.consumeSpaces(); + } + var lex = this.fetch(); + if (Parser.endOfExpression.indexOf(lex.text) !== -1) { + break; + } + if (breakOnTokenText && lex.text === breakOnTokenText) { + break; + } + if ( + breakOnInfix && + functions[lex.text] && + functions[lex.text].infix + ) { + break; + } + var atom = this.parseAtom(breakOnTokenText); + if (!atom) { + break; + } else if (atom.type === "internal") { + continue; + } + body.push(atom); + } + if (this.mode === "text") { + this.formLigatures(body); + } + return this.handleInfixNodes(body); + }, + }, + { + key: "handleInfixNodes", + value: function handleInfixNodes(body) { + var overIndex = -1; + var funcName; + for (var i = 0; i < body.length; i++) { + if (body[i].type === "infix") { + if (overIndex !== -1) { + throw new ParseError( + "only one infix operator per group", + body[i].token, + ); + } + overIndex = i; + funcName = body[i].replaceWith; + } + } + if (overIndex !== -1 && funcName) { + var numerNode; + var denomNode; + var numerBody = body.slice(0, overIndex); + var denomBody = body.slice(overIndex + 1); + if (numerBody.length === 1 && numerBody[0].type === "ordgroup") { + numerNode = numerBody[0]; + } else { + numerNode = { + type: "ordgroup", + mode: this.mode, + body: numerBody, + }; + } + if (denomBody.length === 1 && denomBody[0].type === "ordgroup") { + denomNode = denomBody[0]; + } else { + denomNode = { + type: "ordgroup", + mode: this.mode, + body: denomBody, + }; + } + var node; + if (funcName === "\\\\abovefrac") { + node = this.callFunction( + funcName, + [numerNode, body[overIndex], denomNode], + [], + ); + } else { + node = this.callFunction(funcName, [numerNode, denomNode], []); + } + return [node]; + } else { + return body; + } + }, + }, + { + key: "handleSupSubscript", + value: function handleSupSubscript(name) { + var symbolToken = this.fetch(); + var symbol = symbolToken.text; + this.consume(); + this.consumeSpaces(); + var group; + do { + var _group; + group = this.parseGroup(name); + } while ( + ((_group = group) == null ? void 0 : _group.type) === "internal" + ); + if (!group) { + throw new ParseError( + "Expected group after '" + symbol + "'", + symbolToken, + ); + } + return group; + }, + }, + { + key: "formatUnsupportedCmd", + value: function formatUnsupportedCmd(text) { + var textordArray = []; + for (var i = 0; i < text.length; i++) { + textordArray.push({ type: "textord", mode: "text", text: text[i] }); + } + var textNode = { type: "text", mode: this.mode, body: textordArray }; + var colorNode = { + type: "color", + mode: this.mode, + color: this.settings.errorColor, + body: [textNode], + }; + return colorNode; + }, + }, + { + key: "parseAtom", + value: function parseAtom(breakOnTokenText) { + var base = this.parseGroup("atom", breakOnTokenText); + if ((base == null ? void 0 : base.type) === "internal") { + return base; + } + if (this.mode === "text") { + return base; + } + var superscript; + var subscript; + while (true) { + this.consumeSpaces(); + var lex = this.fetch(); + if (lex.text === "\\limits" || lex.text === "\\nolimits") { + if (base && base.type === "op") { + var limits = lex.text === "\\limits"; + base.limits = limits; + base.alwaysHandleSupSub = true; + } else if (base && base.type === "operatorname") { + if (base.alwaysHandleSupSub) { + base.limits = lex.text === "\\limits"; + } + } else { + throw new ParseError( + "Limit controls must follow a math operator", + lex, + ); + } + this.consume(); + } else if (lex.text === "^") { + if (superscript) { + throw new ParseError("Double superscript", lex); + } + superscript = this.handleSupSubscript("superscript"); + } else if (lex.text === "_") { + if (subscript) { + throw new ParseError("Double subscript", lex); + } + subscript = this.handleSupSubscript("subscript"); + } else if (lex.text === "'") { + if (superscript) { + throw new ParseError("Double superscript", lex); + } + var prime = { type: "textord", mode: this.mode, text: "\\prime" }; + var primes = [prime]; + this.consume(); + while (this.fetch().text === "'") { + primes.push(prime); + this.consume(); + } + if (this.fetch().text === "^") { + primes.push(this.handleSupSubscript("superscript")); + } + superscript = { type: "ordgroup", mode: this.mode, body: primes }; + } else if (uSubsAndSups[lex.text]) { + var isSub = unicodeSubRegEx.test(lex.text); + var subsupTokens = []; + subsupTokens.push(new Token(uSubsAndSups[lex.text])); + this.consume(); + while (true) { + var token = this.fetch().text; + if (!uSubsAndSups[token]) { + break; + } + if (unicodeSubRegEx.test(token) !== isSub) { + break; + } + subsupTokens.unshift(new Token(uSubsAndSups[token])); + this.consume(); + } + var body = this.subparse(subsupTokens); + if (isSub) { + subscript = { type: "ordgroup", mode: "math", body: body }; + } else { + superscript = { type: "ordgroup", mode: "math", body: body }; + } + } else { + break; + } + } + if (superscript || subscript) { + return { + type: "supsub", + mode: this.mode, + base: base, + sup: superscript, + sub: subscript, + }; + } else { + return base; + } + }, + }, + { + key: "parseFunction", + value: function parseFunction(breakOnTokenText, name) { + var token = this.fetch(); + var func = token.text; + var funcData = functions[func]; + if (!funcData) { + return null; + } + this.consume(); + if (name && name !== "atom" && !funcData.allowedInArgument) { + throw new ParseError( + "Got function '" + + func + + "' with no arguments" + + (name ? " as " + name : ""), + token, + ); + } else if (this.mode === "text" && !funcData.allowedInText) { + throw new ParseError( + "Can't use function '" + func + "' in text mode", + token, + ); + } else if (this.mode === "math" && funcData.allowedInMath === false) { + throw new ParseError( + "Can't use function '" + func + "' in math mode", + token, + ); + } + var _this$parseArguments = this.parseArguments(func, funcData), + args = _this$parseArguments.args, + optArgs = _this$parseArguments.optArgs; + return this.callFunction( + func, + args, + optArgs, + token, + breakOnTokenText, + ); + }, + }, + { + key: "callFunction", + value: function callFunction( + name, + args, + optArgs, + token, + breakOnTokenText, + ) { + var context = { + funcName: name, + parser: this, + token: token, + breakOnTokenText: breakOnTokenText, + }; + var func = functions[name]; + if (func && func.handler) { + return func.handler(context, args, optArgs); + } else { + throw new ParseError("No function handler for " + name); + } + }, + }, + { + key: "parseArguments", + value: function parseArguments(func, funcData) { + var totalArgs = funcData.numArgs + funcData.numOptionalArgs; + if (totalArgs === 0) { + return { args: [], optArgs: [] }; + } + var args = []; + var optArgs = []; + for (var i = 0; i < totalArgs; i++) { + var argType = funcData.argTypes && funcData.argTypes[i]; + var isOptional = i < funcData.numOptionalArgs; + if ( + (funcData.primitive && argType == null) || + (funcData.type === "sqrt" && i === 1 && optArgs[0] == null) + ) { + argType = "primitive"; + } + var arg = this.parseGroupOfType( + "argument to '" + func + "'", + argType, + isOptional, + ); + if (isOptional) { + optArgs.push(arg); + } else if (arg != null) { + args.push(arg); + } else { + throw new ParseError( + "Null argument, please report this as a bug", + ); + } + } + return { args: args, optArgs: optArgs }; + }, + }, + { + key: "parseGroupOfType", + value: function parseGroupOfType(name, type, optional) { + switch (type) { + case "color": + return this.parseColorGroup(optional); + case "size": + return this.parseSizeGroup(optional); + case "url": + return this.parseUrlGroup(optional); + case "math": + case "text": + return this.parseArgumentGroup(optional, type); + case "hbox": { + var group = this.parseArgumentGroup(optional, "text"); + return group != null + ? { + type: "styling", + mode: group.mode, + body: [group], + style: "text", + } + : null; + } + case "raw": { + var token = this.parseStringGroup("raw", optional); + return token != null + ? { type: "raw", mode: "text", string: token.text } + : null; + } + case "primitive": { + if (optional) { + throw new ParseError("A primitive argument cannot be optional"); + } + var _group2 = this.parseGroup(name); + if (_group2 == null) { + throw new ParseError("Expected group as " + name, this.fetch()); + } + return _group2; + } + case "original": + case null: + case undefined: + return this.parseArgumentGroup(optional); + default: + throw new ParseError( + "Unknown group type as " + name, + this.fetch(), + ); + } + }, + }, + { + key: "consumeSpaces", + value: function consumeSpaces() { + while (this.fetch().text === " ") { + this.consume(); + } + }, + }, + { + key: "parseStringGroup", + value: function parseStringGroup(modeName, optional) { + var argToken = this.gullet.scanArgument(optional); + if (argToken == null) { + return null; + } + var str = ""; + var nextToken; + while ((nextToken = this.fetch()).text !== "EOF") { + str += nextToken.text; + this.consume(); + } + this.consume(); + argToken.text = str; + return argToken; + }, + }, + { + key: "parseRegexGroup", + value: function parseRegexGroup(regex, modeName) { + var firstToken = this.fetch(); + var lastToken = firstToken; + var str = ""; + var nextToken; + while ( + (nextToken = this.fetch()).text !== "EOF" && + regex.test(str + nextToken.text) + ) { + lastToken = nextToken; + str += lastToken.text; + this.consume(); + } + if (str === "") { + throw new ParseError( + "Invalid " + modeName + ": '" + firstToken.text + "'", + firstToken, + ); + } + return firstToken.range(lastToken, str); + }, + }, + { + key: "parseColorGroup", + value: function parseColorGroup(optional) { + var res = this.parseStringGroup("color", optional); + if (res == null) { + return null; + } + var match = /^(#[a-f0-9]{3}|#?[a-f0-9]{6}|[a-z]+)$/i.exec(res.text); + if (!match) { + throw new ParseError("Invalid color: '" + res.text + "'", res); + } + var color = match[0]; + if (/^[0-9a-f]{6}$/i.test(color)) { + color = "#" + color; + } + return { type: "color-token", mode: this.mode, color: color }; + }, + }, + { + key: "parseSizeGroup", + value: function parseSizeGroup(optional) { + var res; + var isBlank = false; + this.gullet.consumeSpaces(); + if (!optional && this.gullet.future().text !== "{") { + res = this.parseRegexGroup( + /^[-+]? *(?:$|\d+|\d+\.\d*|\.\d*) *[a-z]{0,2} *$/, + "size", + ); + } else { + res = this.parseStringGroup("size", optional); + } + if (!res) { + return null; + } + if (!optional && res.text.length === 0) { + res.text = "0pt"; + isBlank = true; + } + var match = /([-+]?) *(\d+(?:\.\d*)?|\.\d+) *([a-z]{2})/.exec( + res.text, + ); + if (!match) { + throw new ParseError("Invalid size: '" + res.text + "'", res); + } + var data = { number: +(match[1] + match[2]), unit: match[3] }; + if (!validUnit(data)) { + throw new ParseError("Invalid unit: '" + data.unit + "'", res); + } + return { + type: "size", + mode: this.mode, + value: data, + isBlank: isBlank, + }; + }, + }, + { + key: "parseUrlGroup", + value: function parseUrlGroup(optional) { + this.gullet.lexer.setCatcode("%", 13); + this.gullet.lexer.setCatcode("~", 12); + var res = this.parseStringGroup("url", optional); + this.gullet.lexer.setCatcode("%", 14); + this.gullet.lexer.setCatcode("~", 13); + if (res == null) { + return null; + } + var url = res.text.replace(/\\([#$%&~_^{}])/g, "$1"); + return { type: "url", mode: this.mode, url: url }; + }, + }, + { + key: "parseArgumentGroup", + value: function parseArgumentGroup(optional, mode) { + var argToken = this.gullet.scanArgument(optional); + if (argToken == null) { + return null; + } + var outerMode = this.mode; + if (mode) { + this.switchMode(mode); + } + this.gullet.beginGroup(); + var expression = this.parseExpression(false, "EOF"); + this.expect("EOF"); + this.gullet.endGroup(); + var result = { + type: "ordgroup", + mode: this.mode, + loc: argToken.loc, + body: expression, + }; + if (mode) { + this.switchMode(outerMode); + } + return result; + }, + }, + { + key: "parseGroup", + value: function parseGroup(name, breakOnTokenText) { + var firstToken = this.fetch(); + var text = firstToken.text; + var result; + if (text === "{" || text === "\\begingroup") { + this.consume(); + var groupEnd = text === "{" ? "}" : "\\endgroup"; + this.gullet.beginGroup(); + var expression = this.parseExpression(false, groupEnd); + var lastToken = this.fetch(); + this.expect(groupEnd); + this.gullet.endGroup(); + result = { + type: "ordgroup", + mode: this.mode, + loc: SourceLocation.range(firstToken, lastToken), + body: expression, + semisimple: text === "\\begingroup" || undefined, + }; + } else { + result = + this.parseFunction(breakOnTokenText, name) || this.parseSymbol(); + if ( + result == null && + text[0] === "\\" && + !implicitCommands.hasOwnProperty(text) + ) { + if (this.settings.throwOnError) { + throw new ParseError( + "Undefined control sequence: " + text, + firstToken, + ); + } + result = this.formatUnsupportedCmd(text); + this.consume(); + } + } + return result; + }, + }, + { + key: "formLigatures", + value: function formLigatures(group) { + var n = group.length - 1; + for (var i = 0; i < n; ++i) { + var a = group[i]; + var v = a.text; + if (v === "-" && group[i + 1].text === "-") { + if (i + 1 < n && group[i + 2].text === "-") { + group.splice(i, 3, { + type: "textord", + mode: "text", + loc: SourceLocation.range(a, group[i + 2]), + text: "---", + }); + n -= 2; + } else { + group.splice(i, 2, { + type: "textord", + mode: "text", + loc: SourceLocation.range(a, group[i + 1]), + text: "--", + }); + n -= 1; + } + } + if ((v === "'" || v === "`") && group[i + 1].text === v) { + group.splice(i, 2, { + type: "textord", + mode: "text", + loc: SourceLocation.range(a, group[i + 1]), + text: v + v, + }); + n -= 1; + } + } + }, + }, + { + key: "parseSymbol", + value: function parseSymbol() { + var nucleus = this.fetch(); + var text = nucleus.text; + if (/^\\verb[^a-zA-Z]/.test(text)) { + this.consume(); + var arg = text.slice(5); + var star = arg.charAt(0) === "*"; + if (star) { + arg = arg.slice(1); + } + if (arg.length < 2 || arg.charAt(0) !== arg.slice(-1)) { + throw new ParseError( + "\\verb assertion failed --\n please report what input caused this bug", + ); + } + arg = arg.slice(1, -1); + return { type: "verb", mode: "text", body: arg, star: star }; + } + if ( + unicodeSymbols.hasOwnProperty(text[0]) && + !symbols[this.mode][text[0]] + ) { + if (this.settings.strict && this.mode === "math") { + this.settings.reportNonstrict( + "unicodeTextInMathMode", + 'Accented Unicode text character "' + + text[0] + + '" used in ' + + "math mode", + nucleus, + ); + } + text = unicodeSymbols[text[0]] + text.slice(1); + } + var match = combiningDiacriticalMarksEndRegex.exec(text); + if (match) { + text = text.substring(0, match.index); + if (text === "i") { + text = "\u0131"; + } else if (text === "j") { + text = "\u0237"; + } + } + var symbol; + if (symbols[this.mode][text]) { + if ( + this.settings.strict && + this.mode === "math" && + extraLatin.indexOf(text) >= 0 + ) { + this.settings.reportNonstrict( + "unicodeTextInMathMode", + 'Latin-1/Unicode text character "' + + text[0] + + '" used in ' + + "math mode", + nucleus, + ); + } + var group = symbols[this.mode][text].group; + var loc = SourceLocation.range(nucleus); + var s; + if (ATOMS.hasOwnProperty(group)) { + var family = group; + s = { + type: "atom", + mode: this.mode, + family: family, + loc: loc, + text: text, + }; + } else { + s = { type: group, mode: this.mode, loc: loc, text: text }; + } + symbol = s; + } else if (text.charCodeAt(0) >= 128) { + if (this.settings.strict) { + if (!supportedCodepoint(text.charCodeAt(0))) { + this.settings.reportNonstrict( + "unknownSymbol", + 'Unrecognized Unicode character "' + + text[0] + + '"' + + (" (" + text.charCodeAt(0) + ")"), + nucleus, + ); + } else if (this.mode === "math") { + this.settings.reportNonstrict( + "unicodeTextInMathMode", + 'Unicode text character "' + text[0] + '" used in math mode', + nucleus, + ); + } + } + symbol = { + type: "textord", + mode: "text", + loc: SourceLocation.range(nucleus), + text: text, + }; + } else { + return null; + } + this.consume(); + if (match) { + for (var i = 0; i < match[0].length; i++) { + var accent = match[0][i]; + if (!unicodeAccents[accent]) { + throw new ParseError( + "Unknown accent ' " + accent + "'", + nucleus, + ); + } + var command = + unicodeAccents[accent][this.mode] || + unicodeAccents[accent].text; + if (!command) { + throw new ParseError( + "Accent " + accent + " unsupported in " + this.mode + " mode", + nucleus, + ); + } + symbol = { + type: "accent", + mode: this.mode, + loc: SourceLocation.range(nucleus), + label: command, + isStretchy: false, + isShifty: true, + base: symbol, + }; + } + } + return symbol; + }, + }, + ]); + })(); + Parser.endOfExpression = ["}", "\\endgroup", "\\end", "\\right", "&"]; + var parseTree = function parseTree(toParse, settings) { + if (!(typeof toParse === "string" || toParse instanceof String)) { + throw new TypeError("KaTeX can only parse string typed expression"); + } + var parser = new Parser(toParse, settings); + delete parser.gullet.macros.current["\\df@tag"]; + var tree = parser.parse(); + delete parser.gullet.macros.current["\\current@color"]; + delete parser.gullet.macros.current["\\color"]; + if (parser.gullet.macros.get("\\df@tag")) { + if (!settings.displayMode) { + throw new ParseError("\\tag works only in display equations"); + } + tree = [ + { + type: "tag", + mode: "text", + body: tree, + tag: parser.subparse([new Token("\\df@tag")]), + }, + ]; + } + return tree; + }; + if (typeof document !== "undefined") { + if (document.compatMode !== "CSS1Compat") { + typeof console !== "undefined" && + console.warn( + "Warning: KaTeX doesn't work in quirks mode. Make sure your " + + "website has a suitable doctype.", + ); + } + } + var renderToString = function renderToString(expression, options) { + var markup = renderToDomTree(expression, options).toMarkup(); + return markup; + }; + var renderError = function renderError(error, expression, options) { + if (options.throwOnError || !(error instanceof ParseError)) { + throw error; + } + var node = buildCommon.makeSpan( + ["katex-error"], + [new SymbolNode(expression)], + ); + node.setAttribute("title", error.toString()); + node.setAttribute("style", "color:" + options.errorColor); + return node; + }; + var renderToDomTree = function renderToDomTree(expression, options) { + var settings = new Settings(options); + try { + var tree = parseTree(expression, settings); + return buildTree(tree, expression, settings); + } catch (error) { + return renderError(error, expression, settings); + } + }; + var katexInline = function katexInline(tex, options, transformer) { + var _transformer; + var result; + try { + result = renderToString( + tex, + _objectSpread(_objectSpread({}, options), {}, { displayMode: false }), + ); + } catch (error) { + if (error instanceof ParseError) { + console.warn(error); + result = "") + .concat(escapeHtml(tex), ""); + } else { + throw error; + } + } + return (_transformer = + transformer === null || transformer === void 0 + ? void 0 + : transformer(result, false)) !== null && _transformer !== void 0 + ? _transformer + : result; + }; + var katexBlock = function katexBlock(tex, options, transformer) { + var _transformer2; + var result; + try { + result = "

".concat( + renderToString( + tex, + _objectSpread(_objectSpread({}, options), {}, { displayMode: true }), + ), + "

\n", + ); + } catch (error) { + if (error instanceof ParseError) { + console.warn(error); + result = "

") + .concat(escapeHtml(tex), "

\n"); + } else { + throw error; + } + } + return (_transformer2 = + transformer === null || transformer === void 0 + ? void 0 + : transformer(result, true)) !== null && _transformer2 !== void 0 + ? _transformer2 + : result; + }; + var katex = function katex(md) { + var options = + arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; + var _options$allowInlineW2 = options.allowInlineWithSpace, + allowInlineWithSpace = + _options$allowInlineW2 === void 0 ? false : _options$allowInlineW2, + _options$mathFence2 = options.mathFence, + mathFence = _options$mathFence2 === void 0 ? false : _options$mathFence2, + _options$logger = options.logger, + logger = + _options$logger === void 0 + ? function (errorCode) { + return errorCode === "newLineInDisplayMode" ? "ignore" : "warn"; + } + : _options$logger, + _options$macros = options.macros, + macros = _options$macros === void 0 ? {} : _options$macros, + transformer = options.transformer, + userOptions = _objectWithoutProperties(options, _excluded); + md.use(tex, { + allowInlineWithSpace: allowInlineWithSpace, + mathFence: mathFence, + render: function render(content, displayMode, env) { + var katexOptions = _objectSpread( + { + strict: function strict(errorCode, errorMsg, token) { + var _logger; + return (_logger = logger(errorCode, errorMsg, token, env)) !== + null && _logger !== void 0 + ? _logger + : "ignore"; + }, + macros: macros, + throwOnError: false, + }, + userOptions, + ); + return displayMode + ? katexBlock(content, katexOptions, transformer) + : katexInline(content, katexOptions, transformer); + }, + }); + }; + return katex; +}); diff --git a/txt2tags-it/markdown-it-txt2tags.js b/txt2tags-it/markdown-it-txt2tags.js new file mode 100644 index 0000000..f8c5184 --- /dev/null +++ b/txt2tags-it/markdown-it-txt2tags.js @@ -0,0 +1,271 @@ +/*! markdown-it-txt2tags - txt2tags syntax support for markdown-it */ +(function (f) { + if (typeof exports === "object" && typeof module !== "undefined") { + module.exports = f(); + } else if (typeof define === "function" && define.amd) { + define([], f); + } else { + var g; + if (typeof window !== "undefined") { + g = window; + } else if (typeof global !== "undefined") { + g = global; + } else if (typeof self !== "undefined") { + g = self; + } else { + g = this; + } + g.markdownitTxt2tags = f(); + } +})(function () { + "use strict"; + + /** + * txt2tags syntax support for markdown-it + * + * Block rules: + * = Heading 1 = / == Heading 2 == / … / ===== Heading 5 ===== + * % This is a comment (line ignored in output) + * + * Inline rules: + * //italic// → italic + * __underline__ → underline + * --strikethrough-- → strikethrough + */ + function txt2tagsPlugin(md) { + + // ── Override text rule to also stop at / (needed for //italic//) ───────── + // markdown-it's built-in text rule stops at isTerminatorChar characters. + // '/' (0x2F) is not in that set, so '//italic//' gets consumed as plain + // text before the italic inline rule can match it. + function isTerminatorCharExtended(ch) { + // 0x2F = '/' — added for txt2tags //italic// + if (ch === 0x2F) return true; + // Replicate markdown-it's isTerminatorChar exactly (v8.4.2) + switch (ch) { + case 0x0a: case 0x21: case 0x23: case 0x24: case 0x25: case 0x26: + case 0x2a: case 0x2b: case 0x2d: case 0x3a: case 0x3c: case 0x3d: + case 0x3e: case 0x40: case 0x5b: case 0x5c: case 0x5d: case 0x5e: + case 0x5f: case 0x60: case 0x7b: case 0x7d: case 0x7e: + return true; + default: + return false; + } + } + md.inline.ruler.at("text", function (state, silent) { + var pos = state.pos; + while (pos < state.posMax && !isTerminatorCharExtended(state.src.charCodeAt(pos))) { + pos++; + } + if (pos === state.pos) return false; + if (!silent) state.pending += state.src.slice(state.pos, pos); + state.pos = pos; + return true; + }); + + // ── Block: headings ────────────────────────────────────────────────────── + // = H1 = == H2 == === H3 === ==== H4 ==== ===== H5 ===== + // Rules: + // - The number of = signs must match on both sides (1–5) + // - At least one space between the = signs and the title text + // - Trailing spaces after the closing = signs are allowed + md.block.ruler.before( + "heading", + "txt2tags_heading", + function (state, startLine, endLine, silent) { + var pos = state.bMarks[startLine] + state.tShift[startLine]; + var max = state.eMarks[startLine]; + + if (state.src.charCodeAt(pos) !== 0x3d /* = */) return false; + + var line = state.src.slice(pos, max); + var match = /^(={1,5}) +(.+?) +\1\s*$/.exec(line); + if (!match) return false; + + var level = match[1].length; + var title = match[2]; + + if (silent) return true; + + var token; + token = state.push("heading_open", "h" + level, 1); + token.markup = match[1]; + token.map = [startLine, startLine + 1]; + + token = state.push("inline", "", 0); + token.content = title; + token.map = [startLine, startLine + 1]; + token.children = []; + + token = state.push("heading_close", "h" + level, -1); + token.markup = match[1]; + + state.line = startLine + 1; + return true; + } + ); + + // ── Block: % comments ──────────────────────────────────────────────────── + // A line whose very first character is % is silently consumed. + md.block.ruler.before( + "paragraph", + "txt2tags_comment", + function (state, startLine, endLine, silent) { + // Use bMarks (not bMarks + tShift) to require % at column 0 + var pos = state.bMarks[startLine]; + if (state.src.charCodeAt(pos) !== 0x25 /* % */) return false; + if (silent) return true; + state.line = startLine + 1; + return true; + } + ); + + // ── Block: + numbered list ─────────────────────────────────────────────── + // Lines starting with '+ ' (plus space) form an ordered list. + // Registered BEFORE 'list' so markdown-it's own list rule doesn't consume +. + md.block.ruler.before( + "list", + "txt2tags_ordered_list", + function (state, startLine, endLine, silent) { + var pos = state.bMarks[startLine] + state.tShift[startLine]; + if (state.src.charCodeAt(pos) !== 0x2B /* + */ || + state.src.charCodeAt(pos + 1) !== 0x20 /* space */) return false; + if (silent) return true; + + var items = []; + var line = startLine; + while (line < endLine) { + pos = state.bMarks[line] + state.tShift[line]; + if (state.src.charCodeAt(pos) !== 0x2B || + state.src.charCodeAt(pos + 1) !== 0x20) break; + items.push(state.src.slice(pos + 2, state.eMarks[line])); + line++; + } + + var token = state.push("ordered_list_open", "ol", 1); + token.map = [startLine, line]; + token.markup = "+"; + + for (var i = 0; i < items.length; i++) { + token = state.push("list_item_open", "li", 1); + token.map = [startLine + i, startLine + i + 1]; + token.markup = "+"; + + token = state.push("inline", "", 0); + token.content = items[i]; + token.map = [startLine + i, startLine + i + 1]; + token.children = []; + + state.push("list_item_close", "li", -1).markup = "+"; + } + + state.push("ordered_list_close", "ol", -1).markup = "+"; + state.line = line; + return true; + } + ); + + // ── Inline: //italic// ─────────────────────────────────────────────────── + // Avoid matching inside URLs (e.g. http://) + md.inline.ruler.push( + "txt2tags_italic", + function (state, silent) { + var pos = state.pos; + var src = state.src; + if (src.charCodeAt(pos) !== 0x2F || src.charCodeAt(pos + 1) !== 0x2F) return false; + if (pos > 0 && src.charCodeAt(pos - 1) === 0x3A /* : */) return false; + var start = pos + 2; + var end = src.indexOf("//", start); + if (end < 0 || end === start) return false; + if (!silent) { + state.push("em_open", "em", 1).markup = "//"; + state.push("text", "", 0).content = src.slice(start, end); + state.push("em_close", "em", -1).markup = "//"; + } + state.pos = end + 2; + return true; + } + ); + + // ── Inline: __underline__ ──────────────────────────────────────────────── + // Registered BEFORE 'emphasis' so that __ is consumed here instead of + // being treated as markdown bold. + md.inline.ruler.before( + "emphasis", + "txt2tags_underline", + function (state, silent) { + var pos = state.pos; + var src = state.src; + if (src.charCodeAt(pos) !== 0x5F || src.charCodeAt(pos + 1) !== 0x5F) return false; + var start = pos + 2; + var end = src.indexOf("__", start); + if (end < 0 || end === start) return false; + if (!silent) { + state.push("txt2tags_u_open", "u", 1); + state.push("text", "", 0).content = src.slice(start, end); + state.push("txt2tags_u_close", "u", -1); + } + state.pos = end + 2; + return true; + } + ); + + // ── Inline: [label url] links ──────────────────────────────────────────── + // Registered BEFORE 'link' so markdown-it's own link rule doesn't consume [. + // If the content matches [text](url) (standard markdown), we let the link + // rule handle it by returning false when a '(' immediately follows ']'. + md.inline.ruler.before( + "link", + "txt2tags_link", + function (state, silent) { + var pos = state.pos; + var src = state.src; + if (src.charCodeAt(pos) !== 0x5B /* [ */) return false; + var closePos = src.indexOf("]", pos + 1); + if (closePos < 0) return false; + // Let standard markdown [text](url) pass through + if (src.charCodeAt(closePos + 1) === 0x28 /* ( */) return false; + var content = src.slice(pos + 1, closePos); + // Last space separates label from URL + var lastSpace = content.lastIndexOf(" "); + if (lastSpace < 0) return false; + var label = content.slice(0, lastSpace); + var url = content.slice(lastSpace + 1); + if (!label || !url) return false; + // URL must start with a recognised scheme or / + if (!/^[a-zA-Z][\w+\-.]*:\/\/|^\//.test(url)) return false; + if (!silent) { + var token = state.push("link_open", "a", 1); + token.attrs = [["href", url]]; + token.markup = "txt2tags"; + state.push("text", "", 0).content = label; + state.push("link_close", "a", -1).markup = "txt2tags"; + } + state.pos = closePos + 1; + return true; + } + ); + + // ── Inline: --strikethrough-- ───────────────────────────────────────────── + md.inline.ruler.push( + "txt2tags_strike", + function (state, silent) { + var pos = state.pos; + var src = state.src; + if (src.charCodeAt(pos) !== 0x2D || src.charCodeAt(pos + 1) !== 0x2D) return false; + var start = pos + 2; + var end = src.indexOf("--", start); + if (end < 0 || end === start) return false; + if (!silent) { + state.push("txt2tags_del_open", "del", 1); + state.push("text", "", 0).content = src.slice(start, end); + state.push("txt2tags_del_close", "del", -1); + } + state.pos = end + 2; + return true; + } + ); + } + + return txt2tagsPlugin; +}); diff --git a/txt2tags-it/markdown-it.js b/txt2tags-it/markdown-it.js new file mode 100644 index 0000000..a490b2a --- /dev/null +++ b/txt2tags-it/markdown-it.js @@ -0,0 +1,11385 @@ +/*! markdown-it 8.4.2 https://github.com//markdown-it/markdown-it @license MIT */ (function ( + f, +) { + if (typeof exports === "object" && typeof module !== "undefined") { + module.exports = f(); + } else if (typeof define === "function" && define.amd) { + define([], f); + } else { + var g; + if (typeof window !== "undefined") { + g = window; + } else if (typeof global !== "undefined") { + g = global; + } else if (typeof self !== "undefined") { + g = self; + } else { + g = this; + } + g.markdownit = f(); + } +})(function () { + var define, module, exports; + return (function () { + function e(t, n, r) { + function s(o, u) { + if (!n[o]) { + if (!t[o]) { + var a = typeof require == "function" && require; + if (!u && a) return a(o, !0); + if (i) return i(o, !0); + var f = new Error("Cannot find module '" + o + "'"); + throw ((f.code = "MODULE_NOT_FOUND"), f); + } + var l = (n[o] = { exports: {} }); + t[o][0].call( + l.exports, + function (e) { + var n = t[o][1][e]; + return s(n ? n : e); + }, + l, + l.exports, + e, + t, + n, + r, + ); + } + return n[o].exports; + } + var i = typeof require == "function" && require; + for (var o = 0; o < r.length; o++) s(r[o]); + return s; + } + return e; + })()( + { + 1: [ + function (require, module, exports) { + // HTML5 entities map: { name -> utf16string } + // + "use strict"; + + /*eslint quotes:0*/ + module.exports = require("entities/maps/entities.json"); + }, + { "entities/maps/entities.json": 52 }, + ], + 2: [ + function (require, module, exports) { + // List of valid html blocks names, accorting to commonmark spec + // http://jgm.github.io/CommonMark/spec.html#html-blocks + + "use strict"; + + module.exports = [ + "address", + "article", + "aside", + "base", + "basefont", + "blockquote", + "body", + "caption", + "center", + "col", + "colgroup", + "dd", + "details", + "dialog", + "dir", + "div", + "dl", + "dt", + "fieldset", + "figcaption", + "figure", + "footer", + "form", + "frame", + "frameset", + "h1", + "h2", + "h3", + "h4", + "h5", + "h6", + "head", + "header", + "hr", + "html", + "iframe", + "legend", + "li", + "link", + "main", + "menu", + "menuitem", + "meta", + "nav", + "noframes", + "ol", + "optgroup", + "option", + "p", + "param", + "section", + "source", + "summary", + "table", + "tbody", + "td", + "tfoot", + "th", + "thead", + "title", + "tr", + "track", + "ul", + ]; + }, + {}, + ], + 3: [ + function (require, module, exports) { + // Regexps to match html elements + + "use strict"; + + var attr_name = "[a-zA-Z_:][a-zA-Z0-9:._-]*"; + + var unquoted = "[^\"'=<>`\\x00-\\x20]+"; + var single_quoted = "'[^']*'"; + var double_quoted = '"[^"]*"'; + + var attr_value = + "(?:" + unquoted + "|" + single_quoted + "|" + double_quoted + ")"; + + var attribute = + "(?:\\s+" + attr_name + "(?:\\s*=\\s*" + attr_value + ")?)"; + + var open_tag = "<[A-Za-z][A-Za-z0-9\\-]*" + attribute + "*\\s*\\/?>"; + + var close_tag = "<\\/[A-Za-z][A-Za-z0-9\\-]*\\s*>"; + var comment = "|"; + var processing = "<[?].*?[?]>"; + var declaration = "]*>"; + var cdata = ""; + + var HTML_TAG_RE = new RegExp( + "^(?:" + + open_tag + + "|" + + close_tag + + "|" + + comment + + "|" + + processing + + "|" + + declaration + + "|" + + cdata + + ")", + ); + var HTML_OPEN_CLOSE_TAG_RE = new RegExp( + "^(?:" + open_tag + "|" + close_tag + ")", + ); + + module.exports.HTML_TAG_RE = HTML_TAG_RE; + module.exports.HTML_OPEN_CLOSE_TAG_RE = HTML_OPEN_CLOSE_TAG_RE; + }, + {}, + ], + 4: [ + function (require, module, exports) { + // Utilities + // + "use strict"; + + function _class(obj) { + return Object.prototype.toString.call(obj); + } + + function isString(obj) { + return _class(obj) === "[object String]"; + } + + var _hasOwnProperty = Object.prototype.hasOwnProperty; + + function has(object, key) { + return _hasOwnProperty.call(object, key); + } + + // Merge objects + // + function assign(obj /*from1, from2, from3, ...*/) { + var sources = Array.prototype.slice.call(arguments, 1); + + sources.forEach(function (source) { + if (!source) { + return; + } + + if (typeof source !== "object") { + throw new TypeError(source + "must be object"); + } + + Object.keys(source).forEach(function (key) { + obj[key] = source[key]; + }); + }); + + return obj; + } + + // Remove element from array and put another array at those position. + // Useful for some operations with tokens + function arrayReplaceAt(src, pos, newElements) { + return [].concat( + src.slice(0, pos), + newElements, + src.slice(pos + 1), + ); + } + + //////////////////////////////////////////////////////////////////////////////// + + function isValidEntityCode(c) { + /*eslint no-bitwise:0*/ + // broken sequence + if (c >= 0xd800 && c <= 0xdfff) { + return false; + } + // never used + if (c >= 0xfdd0 && c <= 0xfdef) { + return false; + } + if ((c & 0xffff) === 0xffff || (c & 0xffff) === 0xfffe) { + return false; + } + // control codes + if (c >= 0x00 && c <= 0x08) { + return false; + } + if (c === 0x0b) { + return false; + } + if (c >= 0x0e && c <= 0x1f) { + return false; + } + if (c >= 0x7f && c <= 0x9f) { + return false; + } + // out of range + if (c > 0x10ffff) { + return false; + } + return true; + } + + function fromCodePoint(c) { + /*eslint no-bitwise:0*/ + if (c > 0xffff) { + c -= 0x10000; + var surrogate1 = 0xd800 + (c >> 10), + surrogate2 = 0xdc00 + (c & 0x3ff); + + return String.fromCharCode(surrogate1, surrogate2); + } + return String.fromCharCode(c); + } + + var UNESCAPE_MD_RE = /\\([!"#$%&'()*+,\-.\/:;<=>?@[\\\]^_`{|}~])/g; + var ENTITY_RE = /&([a-z#][a-z0-9]{1,31});/gi; + var UNESCAPE_ALL_RE = new RegExp( + UNESCAPE_MD_RE.source + "|" + ENTITY_RE.source, + "gi", + ); + + var DIGITAL_ENTITY_TEST_RE = /^#((?:x[a-f0-9]{1,8}|[0-9]{1,8}))/i; + + var entities = require("./entities"); + + function replaceEntityPattern(match, name) { + var code = 0; + + if (has(entities, name)) { + return entities[name]; + } + + if ( + name.charCodeAt(0) === 0x23 /* # */ && + DIGITAL_ENTITY_TEST_RE.test(name) + ) { + code = + name[1].toLowerCase() === "x" + ? parseInt(name.slice(2), 16) + : parseInt(name.slice(1), 10); + if (isValidEntityCode(code)) { + return fromCodePoint(code); + } + } + + return match; + } + + /*function replaceEntities(str) { + if (str.indexOf('&') < 0) { return str; } + + return str.replace(ENTITY_RE, replaceEntityPattern); +}*/ + + function unescapeMd(str) { + if (str.indexOf("\\") < 0) { + return str; + } + return str.replace(UNESCAPE_MD_RE, "$1"); + } + + function unescapeAll(str) { + if (str.indexOf("\\") < 0 && str.indexOf("&") < 0) { + return str; + } + + return str.replace( + UNESCAPE_ALL_RE, + function (match, escaped, entity) { + if (escaped) { + return escaped; + } + return replaceEntityPattern(match, entity); + }, + ); + } + + //////////////////////////////////////////////////////////////////////////////// + + var HTML_ESCAPE_TEST_RE = /[&<>"]/; + var HTML_ESCAPE_REPLACE_RE = /[&<>"]/g; + var HTML_REPLACEMENTS = { + "&": "&", + "<": "<", + ">": ">", + '"': """, + }; + + function replaceUnsafeChar(ch) { + return HTML_REPLACEMENTS[ch]; + } + + function escapeHtml(str) { + if (HTML_ESCAPE_TEST_RE.test(str)) { + return str.replace(HTML_ESCAPE_REPLACE_RE, replaceUnsafeChar); + } + return str; + } + + //////////////////////////////////////////////////////////////////////////////// + + var REGEXP_ESCAPE_RE = /[.?*+^$[\]\\(){}|-]/g; + + function escapeRE(str) { + return str.replace(REGEXP_ESCAPE_RE, "\\$&"); + } + + //////////////////////////////////////////////////////////////////////////////// + + function isSpace(code) { + switch (code) { + case 0x09: + case 0x20: + return true; + } + return false; + } + + // Zs (unicode class) || [\t\f\v\r\n] + function isWhiteSpace(code) { + if (code >= 0x2000 && code <= 0x200a) { + return true; + } + switch (code) { + case 0x09: // \t + case 0x0a: // \n + case 0x0b: // \v + case 0x0c: // \f + case 0x0d: // \r + case 0x20: + case 0xa0: + case 0x1680: + case 0x202f: + case 0x205f: + case 0x3000: + return true; + } + return false; + } + + //////////////////////////////////////////////////////////////////////////////// + + /*eslint-disable max-len*/ + var UNICODE_PUNCT_RE = require("uc.micro/categories/P/regex"); + + // Currently without astral characters support. + function isPunctChar(ch) { + return UNICODE_PUNCT_RE.test(ch); + } + + // Markdown ASCII punctuation characters. + // + // !, ", #, $, %, &, ', (, ), *, +, ,, -, ., /, :, ;, <, =, >, ?, @, [, \, ], ^, _, `, {, |, }, or ~ + // http://spec.commonmark.org/0.15/#ascii-punctuation-character + // + // Don't confuse with unicode punctuation !!! It lacks some chars in ascii range. + // + function isMdAsciiPunct(ch) { + switch (ch) { + case 0x21 /* ! */: + case 0x22 /* " */: + case 0x23 /* # */: + case 0x24 /* $ */: + case 0x25 /* % */: + case 0x26 /* & */: + case 0x27 /* ' */: + case 0x28 /* ( */: + case 0x29 /* ) */: + case 0x2a /* * */: + case 0x2b /* + */: + case 0x2c /* , */: + case 0x2d /* - */: + case 0x2e /* . */: + case 0x2f /* / */: + case 0x3a /* : */: + case 0x3b /* ; */: + case 0x3c /* < */: + case 0x3d /* = */: + case 0x3e /* > */: + case 0x3f /* ? */: + case 0x40 /* @ */: + case 0x5b /* [ */: + case 0x5c /* \ */: + case 0x5d /* ] */: + case 0x5e /* ^ */: + case 0x5f /* _ */: + case 0x60 /* ` */: + case 0x7b /* { */: + case 0x7c /* | */: + case 0x7d /* } */: + case 0x7e /* ~ */: + return true; + default: + return false; + } + } + + // Hepler to unify [reference labels]. + // + function normalizeReference(str) { + // use .toUpperCase() instead of .toLowerCase() + // here to avoid a conflict with Object.prototype + // members (most notably, `__proto__`) + return str.trim().replace(/\s+/g, " ").toUpperCase(); + } + + //////////////////////////////////////////////////////////////////////////////// + + // Re-export libraries commonly used in both markdown-it and its plugins, + // so plugins won't have to depend on them explicitly, which reduces their + // bundled size (e.g. a browser build). + // + exports.lib = {}; + exports.lib.mdurl = require("mdurl"); + exports.lib.ucmicro = require("uc.micro"); + + exports.assign = assign; + exports.isString = isString; + exports.has = has; + exports.unescapeMd = unescapeMd; + exports.unescapeAll = unescapeAll; + exports.isValidEntityCode = isValidEntityCode; + exports.fromCodePoint = fromCodePoint; + // exports.replaceEntities = replaceEntities; + exports.escapeHtml = escapeHtml; + exports.arrayReplaceAt = arrayReplaceAt; + exports.isSpace = isSpace; + exports.isWhiteSpace = isWhiteSpace; + exports.isMdAsciiPunct = isMdAsciiPunct; + exports.isPunctChar = isPunctChar; + exports.escapeRE = escapeRE; + exports.normalizeReference = normalizeReference; + }, + { + "./entities": 1, + mdurl: 58, + "uc.micro": 65, + "uc.micro/categories/P/regex": 63, + }, + ], + 5: [ + function (require, module, exports) { + // Just a shortcut for bulk export + "use strict"; + + exports.parseLinkLabel = require("./parse_link_label"); + exports.parseLinkDestination = require("./parse_link_destination"); + exports.parseLinkTitle = require("./parse_link_title"); + }, + { + "./parse_link_destination": 6, + "./parse_link_label": 7, + "./parse_link_title": 8, + }, + ], + 6: [ + function (require, module, exports) { + // Parse link destination + // + "use strict"; + + var isSpace = require("../common/utils").isSpace; + var unescapeAll = require("../common/utils").unescapeAll; + + module.exports = function parseLinkDestination(str, pos, max) { + var code, + level, + lines = 0, + start = pos, + result = { + ok: false, + pos: 0, + lines: 0, + str: "", + }; + + if (str.charCodeAt(pos) === 0x3c /* < */) { + pos++; + while (pos < max) { + code = str.charCodeAt(pos); + if (code === 0x0a /* \n */ || isSpace(code)) { + return result; + } + if (code === 0x3e /* > */) { + result.pos = pos + 1; + result.str = unescapeAll(str.slice(start + 1, pos)); + result.ok = true; + return result; + } + if (code === 0x5c /* \ */ && pos + 1 < max) { + pos += 2; + continue; + } + + pos++; + } + + // no closing '>' + return result; + } + + // this should be ... } else { ... branch + + level = 0; + while (pos < max) { + code = str.charCodeAt(pos); + + if (code === 0x20) { + break; + } + + // ascii control characters + if (code < 0x20 || code === 0x7f) { + break; + } + + if (code === 0x5c /* \ */ && pos + 1 < max) { + pos += 2; + continue; + } + + if (code === 0x28 /* ( */) { + level++; + } + + if (code === 0x29 /* ) */) { + if (level === 0) { + break; + } + level--; + } + + pos++; + } + + if (start === pos) { + return result; + } + if (level !== 0) { + return result; + } + + result.str = unescapeAll(str.slice(start, pos)); + result.lines = lines; + result.pos = pos; + result.ok = true; + return result; + }; + }, + { "../common/utils": 4 }, + ], + 7: [ + function (require, module, exports) { + // Parse link label + // + // this function assumes that first character ("[") already matches; + // returns the end of the label + // + "use strict"; + + module.exports = function parseLinkLabel( + state, + start, + disableNested, + ) { + var level, + found, + marker, + prevPos, + labelEnd = -1, + max = state.posMax, + oldPos = state.pos; + + state.pos = start + 1; + level = 1; + + while (state.pos < max) { + marker = state.src.charCodeAt(state.pos); + if (marker === 0x5d /* ] */) { + level--; + if (level === 0) { + found = true; + break; + } + } + + prevPos = state.pos; + state.md.inline.skipToken(state); + if (marker === 0x5b /* [ */) { + if (prevPos === state.pos - 1) { + // increase level if we find text `[`, which is not a part of any token + level++; + } else if (disableNested) { + state.pos = oldPos; + return -1; + } + } + } + + if (found) { + labelEnd = state.pos; + } + + // restore old state + state.pos = oldPos; + + return labelEnd; + }; + }, + {}, + ], + 8: [ + function (require, module, exports) { + // Parse link title + // + "use strict"; + + var unescapeAll = require("../common/utils").unescapeAll; + + module.exports = function parseLinkTitle(str, pos, max) { + var code, + marker, + lines = 0, + start = pos, + result = { + ok: false, + pos: 0, + lines: 0, + str: "", + }; + + if (pos >= max) { + return result; + } + + marker = str.charCodeAt(pos); + + if ( + marker !== 0x22 /* " */ && + marker !== 0x27 /* ' */ && + marker !== 0x28 /* ( */ + ) { + return result; + } + + pos++; + + // if opening marker is "(", switch it to closing marker ")" + if (marker === 0x28) { + marker = 0x29; + } + + while (pos < max) { + code = str.charCodeAt(pos); + if (code === marker) { + result.pos = pos + 1; + result.lines = lines; + result.str = unescapeAll(str.slice(start + 1, pos)); + result.ok = true; + return result; + } else if (code === 0x0a) { + lines++; + } else if (code === 0x5c /* \ */ && pos + 1 < max) { + pos++; + if (str.charCodeAt(pos) === 0x0a) { + lines++; + } + } + + pos++; + } + + return result; + }; + }, + { "../common/utils": 4 }, + ], + 9: [ + function (require, module, exports) { + // Main parser class + + "use strict"; + + var utils = require("./common/utils"); + var helpers = require("./helpers"); + var Renderer = require("./renderer"); + var ParserCore = require("./parser_core"); + var ParserBlock = require("./parser_block"); + var ParserInline = require("./parser_inline"); + var LinkifyIt = require("linkify-it"); + var mdurl = require("mdurl"); + var punycode = require("punycode"); + + var config = { + default: require("./presets/default"), + zero: require("./presets/zero"), + commonmark: require("./presets/commonmark"), + }; + + //////////////////////////////////////////////////////////////////////////////// + // + // This validator can prohibit more than really needed to prevent XSS. It's a + // tradeoff to keep code simple and to be secure by default. + // + // If you need different setup - override validator method as you wish. Or + // replace it with dummy function and use external sanitizer. + // + + var BAD_PROTO_RE = /^(vbscript|javascript|file|data):/; + var GOOD_DATA_RE = /^data:image\/(gif|png|jpeg|webp);/; + + function validateLink(url) { + // url should be normalized at this point, and existing entities are decoded + var str = url.trim().toLowerCase(); + + return BAD_PROTO_RE.test(str) + ? GOOD_DATA_RE.test(str) + ? true + : false + : true; + } + + //////////////////////////////////////////////////////////////////////////////// + + var RECODE_HOSTNAME_FOR = ["http:", "https:", "mailto:"]; + + function normalizeLink(url) { + var parsed = mdurl.parse(url, true); + + if (parsed.hostname) { + // Encode hostnames in urls like: + // `http://host/`, `https://host/`, `mailto:user@host`, `//host/` + // + // We don't encode unknown schemas, because it's likely that we encode + // something we shouldn't (e.g. `skype:name` treated as `skype:host`) + // + if ( + !parsed.protocol || + RECODE_HOSTNAME_FOR.indexOf(parsed.protocol) >= 0 + ) { + try { + parsed.hostname = punycode.toASCII(parsed.hostname); + } catch (er) { + /**/ + } + } + } + + return mdurl.encode(mdurl.format(parsed)); + } + + function normalizeLinkText(url) { + var parsed = mdurl.parse(url, true); + + if (parsed.hostname) { + // Encode hostnames in urls like: + // `http://host/`, `https://host/`, `mailto:user@host`, `//host/` + // + // We don't encode unknown schemas, because it's likely that we encode + // something we shouldn't (e.g. `skype:name` treated as `skype:host`) + // + if ( + !parsed.protocol || + RECODE_HOSTNAME_FOR.indexOf(parsed.protocol) >= 0 + ) { + try { + parsed.hostname = punycode.toUnicode(parsed.hostname); + } catch (er) { + /**/ + } + } + } + + return mdurl.decode(mdurl.format(parsed)); + } + + /** + * class MarkdownIt + * + * Main parser/renderer class. + * + * ##### Usage + * + * ```javascript + * // node.js, "classic" way: + * var MarkdownIt = require('markdown-it'), + * md = new MarkdownIt(); + * var result = md.render('# markdown-it rulezz!'); + * + * // node.js, the same, but with sugar: + * var md = require('markdown-it')(); + * var result = md.render('# markdown-it rulezz!'); + * + * // browser without AMD, added to "window" on script load + * // Note, there are no dash. + * var md = window.markdownit(); + * var result = md.render('# markdown-it rulezz!'); + * ``` + * + * Single line rendering, without paragraph wrap: + * + * ```javascript + * var md = require('markdown-it')(); + * var result = md.renderInline('__markdown-it__ rulezz!'); + * ``` + **/ + + /** + * new MarkdownIt([presetName, options]) + * - presetName (String): optional, `commonmark` / `zero` + * - options (Object) + * + * Creates parser instanse with given config. Can be called without `new`. + * + * ##### presetName + * + * MarkdownIt provides named presets as a convenience to quickly + * enable/disable active syntax rules and options for common use cases. + * + * - ["commonmark"](https://github.com/markdown-it/markdown-it/blob/main/lib/presets/commonmark.js) - + * configures parser to strict [CommonMark](http://commonmark.org/) mode. + * - [default](https://github.com/markdown-it/markdown-it/blob/main/lib/presets/default.js) - + * similar to GFM, used when no preset name given. Enables all available rules, + * but still without html, typographer & autolinker. + * - ["zero"](https://github.com/markdown-it/markdown-it/blob/main/lib/presets/zero.js) - + * all rules disabled. Useful to quickly setup your config via `.enable()`. + * For example, when you need only `bold` and `italic` markup and nothing else. + * + * ##### options: + * + * - __html__ - `false`. Set `true` to enable HTML tags in source. Be careful! + * That's not safe! You may need external sanitizer to protect output from XSS. + * It's better to extend features via plugins, instead of enabling HTML. + * - __xhtmlOut__ - `false`. Set `true` to add '/' when closing single tags + * (`
`). This is needed only for full CommonMark compatibility. In real + * world you will need HTML output. + * - __breaks__ - `false`. Set `true` to convert `\n` in paragraphs into `
`. + * - __langPrefix__ - `language-`. CSS language class prefix for fenced blocks. + * Can be useful for external highlighters. + * - __linkify__ - `false`. Set `true` to autoconvert URL-like text to links. + * - __typographer__ - `false`. Set `true` to enable [some language-neutral + * replacement](https://github.com/markdown-it/markdown-it/blob/main/lib/rules_core/replacements.js) + + * quotes beautification (smartquotes). + * - __quotes__ - `“”‘’`, String or Array. Double + single quotes replacement + * pairs, when typographer enabled and smartquotes on. For example, you can + * use `'«»„“'` for Russian, `'„“‚‘'` for German, and + * `['«\xA0', '\xA0»', '‹\xA0', '\xA0›']` for French (including nbsp). + * - __highlight__ - `null`. Highlighter function for fenced code blocks. + * Highlighter `function (str, lang)` should return escaped HTML. It can also + * return empty string if the source was not changed and should be escaped + * externaly. If result starts with `): + * + * ```javascript + * var hljs = require('highlight.js') // https://highlightjs.org/ + * + * // Actual default values + * var md = require('markdown-it')({ + * highlight: function (str, lang) { + * if (lang && hljs.getLanguage(lang)) { + * try { + * return '
' +
+           *                hljs.highlight(lang, str, true).value +
+           *                '
'; + * } catch (__) {} + * } + * + * return '
' + md.utils.escapeHtml(str) + '
'; + * } + * }); + * ``` + * + **/ + function MarkdownIt(presetName, options) { + if (!(this instanceof MarkdownIt)) { + return new MarkdownIt(presetName, options); + } + + if (!options) { + if (!utils.isString(presetName)) { + options = presetName || {}; + presetName = "default"; + } + } + + /** + * MarkdownIt#inline -> ParserInline + * + * Instance of [[ParserInline]]. You may need it to add new rules when + * writing plugins. For simple rules control use [[MarkdownIt.disable]] and + * [[MarkdownIt.enable]]. + **/ + this.inline = new ParserInline(); + + /** + * MarkdownIt#block -> ParserBlock + * + * Instance of [[ParserBlock]]. You may need it to add new rules when + * writing plugins. For simple rules control use [[MarkdownIt.disable]] and + * [[MarkdownIt.enable]]. + **/ + this.block = new ParserBlock(); + + /** + * MarkdownIt#core -> Core + * + * Instance of [[Core]] chain executor. You may need it to add new rules when + * writing plugins. For simple rules control use [[MarkdownIt.disable]] and + * [[MarkdownIt.enable]]. + **/ + this.core = new ParserCore(); + + /** + * MarkdownIt#renderer -> Renderer + * + * Instance of [[Renderer]]. Use it to modify output look. Or to add rendering + * rules for new token types, generated by plugins. + * + * ##### Example + * + * ```javascript + * var md = require('markdown-it')(); + * + * function myToken(tokens, idx, options, env, self) { + * //... + * return result; + * }; + * + * md.renderer.rules['my_token'] = myToken + * ``` + * + * See [[Renderer]] docs and [source code](https://github.com/markdown-it/markdown-it/blob/main/lib/renderer.js). + **/ + this.renderer = new Renderer(); + + /** + * MarkdownIt#linkify -> LinkifyIt + * + * [linkify-it](https://github.com/markdown-it/linkify-it) instance. + * Used by [linkify](https://github.com/markdown-it/markdown-it/blob/main/lib/rules_core/linkify.js) + * rule. + **/ + this.linkify = new LinkifyIt(); + + /** + * MarkdownIt#validateLink(url) -> Boolean + * + * Link validation function. CommonMark allows too much in links. By default + * we disable `javascript:`, `vbscript:`, `file:` schemas, and almost all `data:...` schemas + * except some embedded image types. + * + * You can change this behaviour: + * + * ```javascript + * var md = require('markdown-it')(); + * // enable everything + * md.validateLink = function () { return true; } + * ``` + **/ + this.validateLink = validateLink; + + /** + * MarkdownIt#normalizeLink(url) -> String + * + * Function used to encode link url to a machine-readable format, + * which includes url-encoding, punycode, etc. + **/ + this.normalizeLink = normalizeLink; + + /** + * MarkdownIt#normalizeLinkText(url) -> String + * + * Function used to decode link url to a human-readable format` + **/ + this.normalizeLinkText = normalizeLinkText; + + // Expose utils & helpers for easy acces from plugins + + /** + * MarkdownIt#utils -> utils + * + * Assorted utility functions, useful to write plugins. See details + * [here](https://github.com/markdown-it/markdown-it/blob/main/lib/common/utils.js). + **/ + this.utils = utils; + + /** + * MarkdownIt#helpers -> helpers + * + * Link components parser functions, useful to write plugins. See details + * [here](https://github.com/markdown-it/markdown-it/blob/main/lib/helpers). + **/ + this.helpers = utils.assign({}, helpers); + + this.options = {}; + this.configure(presetName); + + if (options) { + this.set(options); + } + } + + /** chainable + * MarkdownIt.set(options) + * + * Set parser options (in the same format as in constructor). Probably, you + * will never need it, but you can change options after constructor call. + * + * ##### Example + * + * ```javascript + * var md = require('markdown-it')() + * .set({ html: true, breaks: true }) + * .set({ typographer, true }); + * ``` + * + * __Note:__ To achieve the best possible performance, don't modify a + * `markdown-it` instance options on the fly. If you need multiple configurations + * it's best to create multiple instances and initialize each with separate + * config. + **/ + MarkdownIt.prototype.set = function (options) { + utils.assign(this.options, options); + return this; + }; + + /** chainable, internal + * MarkdownIt.configure(presets) + * + * Batch load of all options and compenent settings. This is internal method, + * and you probably will not need it. But if you with - see available presets + * and data structure [here](https://github.com/markdown-it/markdown-it/tree/main/lib/presets) + * + * We strongly recommend to use presets instead of direct config loads. That + * will give better compatibility with next versions. + **/ + MarkdownIt.prototype.configure = function (presets) { + var self = this, + presetName; + + if (utils.isString(presets)) { + presetName = presets; + presets = config[presetName]; + if (!presets) { + throw new Error( + 'Wrong `markdown-it` preset "' + presetName + '", check name', + ); + } + } + + if (!presets) { + throw new Error("Wrong `markdown-it` preset, can't be empty"); + } + + if (presets.options) { + self.set(presets.options); + } + + if (presets.components) { + Object.keys(presets.components).forEach(function (name) { + if (presets.components[name].rules) { + self[name].ruler.enableOnly(presets.components[name].rules); + } + if (presets.components[name].rules2) { + self[name].ruler2.enableOnly(presets.components[name].rules2); + } + }); + } + return this; + }; + + /** chainable + * MarkdownIt.enable(list, ignoreInvalid) + * - list (String|Array): rule name or list of rule names to enable + * - ignoreInvalid (Boolean): set `true` to ignore errors when rule not found. + * + * Enable list or rules. It will automatically find appropriate components, + * containing rules with given names. If rule not found, and `ignoreInvalid` + * not set - throws exception. + * + * ##### Example + * + * ```javascript + * var md = require('markdown-it')() + * .enable(['sub', 'sup']) + * .disable('smartquotes'); + * ``` + **/ + MarkdownIt.prototype.enable = function (list, ignoreInvalid) { + var result = []; + + if (!Array.isArray(list)) { + list = [list]; + } + + ["core", "block", "inline"].forEach(function (chain) { + result = result.concat(this[chain].ruler.enable(list, true)); + }, this); + + result = result.concat(this.inline.ruler2.enable(list, true)); + + var missed = list.filter(function (name) { + return result.indexOf(name) < 0; + }); + + if (missed.length && !ignoreInvalid) { + throw new Error( + "MarkdownIt. Failed to enable unknown rule(s): " + missed, + ); + } + + return this; + }; + + /** chainable + * MarkdownIt.disable(list, ignoreInvalid) + * - list (String|Array): rule name or list of rule names to disable. + * - ignoreInvalid (Boolean): set `true` to ignore errors when rule not found. + * + * The same as [[MarkdownIt.enable]], but turn specified rules off. + **/ + MarkdownIt.prototype.disable = function (list, ignoreInvalid) { + var result = []; + + if (!Array.isArray(list)) { + list = [list]; + } + + ["core", "block", "inline"].forEach(function (chain) { + result = result.concat(this[chain].ruler.disable(list, true)); + }, this); + + result = result.concat(this.inline.ruler2.disable(list, true)); + + var missed = list.filter(function (name) { + return result.indexOf(name) < 0; + }); + + if (missed.length && !ignoreInvalid) { + throw new Error( + "MarkdownIt. Failed to disable unknown rule(s): " + missed, + ); + } + return this; + }; + + /** chainable + * MarkdownIt.use(plugin, params) + * + * Load specified plugin with given params into current parser instance. + * It's just a sugar to call `plugin(md, params)` with curring. + * + * ##### Example + * + * ```javascript + * var iterator = require('markdown-it-for-inline'); + * var md = require('markdown-it')() + * .use(iterator, 'foo_replace', 'text', function (tokens, idx) { + * tokens[idx].content = tokens[idx].content.replace(/foo/g, 'bar'); + * }); + * ``` + **/ + MarkdownIt.prototype.use = function (plugin /*, params, ... */) { + var args = [this].concat(Array.prototype.slice.call(arguments, 1)); + plugin.apply(plugin, args); + return this; + }; + + /** internal + * MarkdownIt.parse(src, env) -> Array + * - src (String): source string + * - env (Object): environment sandbox + * + * Parse input string and returns list of block tokens (special token type + * "inline" will contain list of inline tokens). You should not call this + * method directly, until you write custom renderer (for example, to produce + * AST). + * + * `env` is used to pass data between "distributed" rules and return additional + * metadata like reference info, needed for the renderer. It also can be used to + * inject data in specific cases. Usually, you will be ok to pass `{}`, + * and then pass updated object to renderer. + **/ + MarkdownIt.prototype.parse = function (src, env) { + if (typeof src !== "string") { + throw new Error("Input data should be a String"); + } + + var state = new this.core.State(src, this, env); + + this.core.process(state); + + return state.tokens; + }; + + /** + * MarkdownIt.render(src [, env]) -> String + * - src (String): source string + * - env (Object): environment sandbox + * + * Render markdown string into html. It does all magic for you :). + * + * `env` can be used to inject additional metadata (`{}` by default). + * But you will not need it with high probability. See also comment + * in [[MarkdownIt.parse]]. + **/ + MarkdownIt.prototype.render = function (src, env) { + env = env || {}; + + return this.renderer.render( + this.parse(src, env), + this.options, + env, + ); + }; + + /** internal + * MarkdownIt.parseInline(src, env) -> Array + * - src (String): source string + * - env (Object): environment sandbox + * + * The same as [[MarkdownIt.parse]] but skip all block rules. It returns the + * block tokens list with the single `inline` element, containing parsed inline + * tokens in `children` property. Also updates `env` object. + **/ + MarkdownIt.prototype.parseInline = function (src, env) { + var state = new this.core.State(src, this, env); + + state.inlineMode = true; + this.core.process(state); + + return state.tokens; + }; + + /** + * MarkdownIt.renderInline(src [, env]) -> String + * - src (String): source string + * - env (Object): environment sandbox + * + * Similar to [[MarkdownIt.render]] but for single paragraph content. Result + * will NOT be wrapped into `

` tags. + **/ + MarkdownIt.prototype.renderInline = function (src, env) { + env = env || {}; + + return this.renderer.render( + this.parseInline(src, env), + this.options, + env, + ); + }; + + module.exports = MarkdownIt; + }, + { + "./common/utils": 4, + "./helpers": 5, + "./parser_block": 10, + "./parser_core": 11, + "./parser_inline": 12, + "./presets/commonmark": 13, + "./presets/default": 14, + "./presets/zero": 15, + "./renderer": 16, + "linkify-it": 53, + mdurl: 58, + punycode: 60, + }, + ], + 10: [ + function (require, module, exports) { + /** internal + * class ParserBlock + * + * Block-level tokenizer. + **/ + "use strict"; + + var Ruler = require("./ruler"); + + var _rules = [ + // First 2 params - rule name & source. Secondary array - list of rules, + // which can be terminated by this one. + [ + "table", + require("./rules_block/table"), + ["paragraph", "reference"], + ], + ["code", require("./rules_block/code")], + [ + "fence", + require("./rules_block/fence"), + ["paragraph", "reference", "blockquote", "list"], + ], + [ + "blockquote", + require("./rules_block/blockquote"), + ["paragraph", "reference", "blockquote", "list"], + ], + [ + "hr", + require("./rules_block/hr"), + ["paragraph", "reference", "blockquote", "list"], + ], + [ + "list", + require("./rules_block/list"), + ["paragraph", "reference", "blockquote"], + ], + ["reference", require("./rules_block/reference")], + [ + "heading", + require("./rules_block/heading"), + ["paragraph", "reference", "blockquote"], + ], + ["lheading", require("./rules_block/lheading")], + [ + "html_block", + require("./rules_block/html_block"), + ["paragraph", "reference", "blockquote"], + ], + ["paragraph", require("./rules_block/paragraph")], + ]; + + /** + * new ParserBlock() + **/ + function ParserBlock() { + /** + * ParserBlock#ruler -> Ruler + * + * [[Ruler]] instance. Keep configuration of block rules. + **/ + this.ruler = new Ruler(); + + for (var i = 0; i < _rules.length; i++) { + this.ruler.push(_rules[i][0], _rules[i][1], { + alt: (_rules[i][2] || []).slice(), + }); + } + } + + // Generate tokens for input range + // + ParserBlock.prototype.tokenize = function ( + state, + startLine, + endLine, + ) { + var ok, + i, + rules = this.ruler.getRules(""), + len = rules.length, + line = startLine, + hasEmptyLines = false, + maxNesting = state.md.options.maxNesting; + + while (line < endLine) { + state.line = line = state.skipEmptyLines(line); + if (line >= endLine) { + break; + } + + // Termination condition for nested calls. + // Nested calls currently used for blockquotes & lists + if (state.sCount[line] < state.blkIndent) { + break; + } + + // If nesting level exceeded - skip tail to the end. That's not ordinary + // situation and we should not care about content. + if (state.level >= maxNesting) { + state.line = endLine; + break; + } + + // Try all possible rules. + // On success, rule should: + // + // - update `state.line` + // - update `state.tokens` + // - return true + + for (i = 0; i < len; i++) { + ok = rules[i](state, line, endLine, false); + if (ok) { + break; + } + } + + // set state.tight if we had an empty line before current tag + // i.e. latest empty line should not count + state.tight = !hasEmptyLines; + + // paragraph might "eat" one newline after it in nested lists + if (state.isEmpty(state.line - 1)) { + hasEmptyLines = true; + } + + line = state.line; + + if (line < endLine && state.isEmpty(line)) { + hasEmptyLines = true; + line++; + state.line = line; + } + } + }; + + /** + * ParserBlock.parse(str, md, env, outTokens) + * + * Process input string and push block tokens into `outTokens` + **/ + ParserBlock.prototype.parse = function (src, md, env, outTokens) { + var state; + + if (!src) { + return; + } + + state = new this.State(src, md, env, outTokens); + + this.tokenize(state, state.line, state.lineMax); + }; + + ParserBlock.prototype.State = require("./rules_block/state_block"); + + module.exports = ParserBlock; + }, + { + "./ruler": 17, + "./rules_block/blockquote": 18, + "./rules_block/code": 19, + "./rules_block/fence": 20, + "./rules_block/heading": 21, + "./rules_block/hr": 22, + "./rules_block/html_block": 23, + "./rules_block/lheading": 24, + "./rules_block/list": 25, + "./rules_block/paragraph": 26, + "./rules_block/reference": 27, + "./rules_block/state_block": 28, + "./rules_block/table": 29, + }, + ], + 11: [ + function (require, module, exports) { + /** internal + * class Core + * + * Top-level rules executor. Glues block/inline parsers and does intermediate + * transformations. + **/ + "use strict"; + + var Ruler = require("./ruler"); + + var _rules = [ + ["normalize", require("./rules_core/normalize")], + ["block", require("./rules_core/block")], + ["inline", require("./rules_core/inline")], + ["linkify", require("./rules_core/linkify")], + ["replacements", require("./rules_core/replacements")], + ["smartquotes", require("./rules_core/smartquotes")], + ]; + + /** + * new Core() + **/ + function Core() { + /** + * Core#ruler -> Ruler + * + * [[Ruler]] instance. Keep configuration of core rules. + **/ + this.ruler = new Ruler(); + + for (var i = 0; i < _rules.length; i++) { + this.ruler.push(_rules[i][0], _rules[i][1]); + } + } + + /** + * Core.process(state) + * + * Executes core chain rules. + **/ + Core.prototype.process = function (state) { + var i, l, rules; + + rules = this.ruler.getRules(""); + + for (i = 0, l = rules.length; i < l; i++) { + rules[i](state); + } + }; + + Core.prototype.State = require("./rules_core/state_core"); + + module.exports = Core; + }, + { + "./ruler": 17, + "./rules_core/block": 30, + "./rules_core/inline": 31, + "./rules_core/linkify": 32, + "./rules_core/normalize": 33, + "./rules_core/replacements": 34, + "./rules_core/smartquotes": 35, + "./rules_core/state_core": 36, + }, + ], + 12: [ + function (require, module, exports) { + /** internal + * class ParserInline + * + * Tokenizes paragraph content. + **/ + "use strict"; + + var Ruler = require("./ruler"); + + //////////////////////////////////////////////////////////////////////////////// + // Parser rules + + var _rules = [ + ["text", require("./rules_inline/text")], + ["newline", require("./rules_inline/newline")], + ["escape", require("./rules_inline/escape")], + ["backticks", require("./rules_inline/backticks")], + ["strikethrough", require("./rules_inline/strikethrough").tokenize], + ["emphasis", require("./rules_inline/emphasis").tokenize], + ["link", require("./rules_inline/link")], + ["image", require("./rules_inline/image")], + ["autolink", require("./rules_inline/autolink")], + ["html_inline", require("./rules_inline/html_inline")], + ["entity", require("./rules_inline/entity")], + ]; + + var _rules2 = [ + ["balance_pairs", require("./rules_inline/balance_pairs")], + [ + "strikethrough", + require("./rules_inline/strikethrough").postProcess, + ], + ["emphasis", require("./rules_inline/emphasis").postProcess], + ["text_collapse", require("./rules_inline/text_collapse")], + ]; + + /** + * new ParserInline() + **/ + function ParserInline() { + var i; + + /** + * ParserInline#ruler -> Ruler + * + * [[Ruler]] instance. Keep configuration of inline rules. + **/ + this.ruler = new Ruler(); + + for (i = 0; i < _rules.length; i++) { + this.ruler.push(_rules[i][0], _rules[i][1]); + } + + /** + * ParserInline#ruler2 -> Ruler + * + * [[Ruler]] instance. Second ruler used for post-processing + * (e.g. in emphasis-like rules). + **/ + this.ruler2 = new Ruler(); + + for (i = 0; i < _rules2.length; i++) { + this.ruler2.push(_rules2[i][0], _rules2[i][1]); + } + } + + // Skip single token by running all rules in validation mode; + // returns `true` if any rule reported success + // + ParserInline.prototype.skipToken = function (state) { + var ok, + i, + pos = state.pos, + rules = this.ruler.getRules(""), + len = rules.length, + maxNesting = state.md.options.maxNesting, + cache = state.cache; + + if (typeof cache[pos] !== "undefined") { + state.pos = cache[pos]; + return; + } + + if (state.level < maxNesting) { + for (i = 0; i < len; i++) { + // Increment state.level and decrement it later to limit recursion. + // It's harmless to do here, because no tokens are created. But ideally, + // we'd need a separate private state variable for this purpose. + // + state.level++; + ok = rules[i](state, true); + state.level--; + + if (ok) { + break; + } + } + } else { + // Too much nesting, just skip until the end of the paragraph. + // + // NOTE: this will cause links to behave incorrectly in the following case, + // when an amount of `[` is exactly equal to `maxNesting + 1`: + // + // [[[[[[[[[[[[[[[[[[[[[foo]() + // + // TODO: remove this workaround when CM standard will allow nested links + // (we can replace it by preventing links from being parsed in + // validation mode) + // + state.pos = state.posMax; + } + + if (!ok) { + state.pos++; + } + cache[pos] = state.pos; + }; + + // Generate tokens for input range + // + ParserInline.prototype.tokenize = function (state) { + var ok, + i, + rules = this.ruler.getRules(""), + len = rules.length, + end = state.posMax, + maxNesting = state.md.options.maxNesting; + + while (state.pos < end) { + // Try all possible rules. + // On success, rule should: + // + // - update `state.pos` + // - update `state.tokens` + // - return true + + if (state.level < maxNesting) { + for (i = 0; i < len; i++) { + ok = rules[i](state, false); + if (ok) { + break; + } + } + } + + if (ok) { + if (state.pos >= end) { + break; + } + continue; + } + + state.pending += state.src[state.pos++]; + } + + if (state.pending) { + state.pushPending(); + } + }; + + /** + * ParserInline.parse(str, md, env, outTokens) + * + * Process input string and push inline tokens into `outTokens` + **/ + ParserInline.prototype.parse = function (str, md, env, outTokens) { + var i, rules, len; + var state = new this.State(str, md, env, outTokens); + + this.tokenize(state); + + rules = this.ruler2.getRules(""); + len = rules.length; + + for (i = 0; i < len; i++) { + rules[i](state); + } + }; + + ParserInline.prototype.State = require("./rules_inline/state_inline"); + + module.exports = ParserInline; + }, + { + "./ruler": 17, + "./rules_inline/autolink": 37, + "./rules_inline/backticks": 38, + "./rules_inline/balance_pairs": 39, + "./rules_inline/emphasis": 40, + "./rules_inline/entity": 41, + "./rules_inline/escape": 42, + "./rules_inline/html_inline": 43, + "./rules_inline/image": 44, + "./rules_inline/link": 45, + "./rules_inline/newline": 46, + "./rules_inline/state_inline": 47, + "./rules_inline/strikethrough": 48, + "./rules_inline/text": 49, + "./rules_inline/text_collapse": 50, + }, + ], + 13: [ + function (require, module, exports) { + // Commonmark default options + + "use strict"; + + module.exports = { + options: { + html: true, // Enable HTML tags in source + xhtmlOut: true, // Use '/' to close single tags (
) + breaks: false, // Convert '\n' in paragraphs into
+ langPrefix: "language-", // CSS language prefix for fenced blocks + linkify: false, // autoconvert URL-like texts to links + + // Enable some language-neutral replacements + quotes beautification + typographer: false, + + // Double + single quotes replacement pairs, when typographer enabled, + // and smartquotes on. Could be either a String or an Array. + // + // For example, you can use '«»„“' for Russian, '„“‚‘' for German, + // and ['«\xA0', '\xA0»', '‹\xA0', '\xA0›'] for French (including nbsp). + quotes: "\u201c\u201d\u2018\u2019" /* “”‘’ */, + + // Highlighter function. Should return escaped HTML, + // or '' if the source string is not changed and should be escaped externaly. + // If result starts with ) + breaks: false, // Convert '\n' in paragraphs into
+ langPrefix: "language-", // CSS language prefix for fenced blocks + linkify: false, // autoconvert URL-like texts to links + + // Enable some language-neutral replacements + quotes beautification + typographer: false, + + // Double + single quotes replacement pairs, when typographer enabled, + // and smartquotes on. Could be either a String or an Array. + // + // For example, you can use '«»„“' for Russian, '„“‚‘' for German, + // and ['«\xA0', '\xA0»', '‹\xA0', '\xA0›'] for French (including nbsp). + quotes: "\u201c\u201d\u2018\u2019" /* “”‘’ */, + + // Highlighter function. Should return escaped HTML, + // or '' if the source string is not changed and should be escaped externaly. + // If result starts with ) + breaks: false, // Convert '\n' in paragraphs into
+ langPrefix: "language-", // CSS language prefix for fenced blocks + linkify: false, // autoconvert URL-like texts to links + + // Enable some language-neutral replacements + quotes beautification + typographer: false, + + // Double + single quotes replacement pairs, when typographer enabled, + // and smartquotes on. Could be either a String or an Array. + // + // For example, you can use '«»„“' for Russian, '„“‚‘' for German, + // and ['«\xA0', '\xA0»', '‹\xA0', '\xA0›'] for French (including nbsp). + quotes: "\u201c\u201d\u2018\u2019" /* “”‘’ */, + + // Highlighter function. Should return escaped HTML, + // or '' if the source string is not changed and should be escaped externaly. + // If result starts with " + + escapeHtml(tokens[idx].content) + + "" + ); + }; + + default_rules.code_block = function (tokens, idx, options, env, slf) { + var token = tokens[idx]; + + return ( + "" + + escapeHtml(tokens[idx].content) + + "\n" + ); + }; + + default_rules.fence = function (tokens, idx, options, env, slf) { + var token = tokens[idx], + info = token.info ? unescapeAll(token.info).trim() : "", + langName = "", + highlighted, + i, + tmpAttrs, + tmpToken; + + if (info) { + langName = info.split(/\s+/g)[0]; + } + + if (options.highlight) { + highlighted = + options.highlight(token.content, langName) || + escapeHtml(token.content); + } else { + highlighted = escapeHtml(token.content); + } + + if (highlighted.indexOf("" + + highlighted + + "\n" + ); + } + + return ( + "

" +
+              highlighted +
+              "
\n" + ); + }; + + default_rules.image = function (tokens, idx, options, env, slf) { + var token = tokens[idx]; + + // "alt" attr MUST be set, even if empty. Because it's mandatory and + // should be placed on proper position for tests. + // + // Replace content with actual value + + token.attrs[token.attrIndex("alt")][1] = slf.renderInlineAsText( + token.children, + options, + env, + ); + + return slf.renderToken(tokens, idx, options); + }; + + default_rules.hardbreak = function (tokens, idx, options /*, env */) { + return options.xhtmlOut ? "
\n" : "
\n"; + }; + default_rules.softbreak = function (tokens, idx, options /*, env */) { + return options.breaks + ? options.xhtmlOut + ? "
\n" + : "
\n" + : "\n"; + }; + + default_rules.text = function (tokens, idx /*, options, env */) { + return escapeHtml(tokens[idx].content); + }; + + default_rules.html_block = function ( + tokens, + idx /*, options, env */, + ) { + return tokens[idx].content; + }; + default_rules.html_inline = function ( + tokens, + idx /*, options, env */, + ) { + return tokens[idx].content; + }; + + /** + * new Renderer() + * + * Creates new [[Renderer]] instance and fill [[Renderer#rules]] with defaults. + **/ + function Renderer() { + /** + * Renderer#rules -> Object + * + * Contains render rules for tokens. Can be updated and extended. + * + * ##### Example + * + * ```javascript + * var md = require('markdown-it')(); + * + * md.renderer.rules.strong_open = function () { return ''; }; + * md.renderer.rules.strong_close = function () { return ''; }; + * + * var result = md.renderInline(...); + * ``` + * + * Each rule is called as independent static function with fixed signature: + * + * ```javascript + * function my_token_render(tokens, idx, options, env, renderer) { + * // ... + * return renderedHTML; + * } + * ``` + * + * See [source code](https://github.com/markdown-it/markdown-it/blob/main/lib/renderer.js) + * for more details and examples. + **/ + this.rules = assign({}, default_rules); + } + + /** + * Renderer.renderAttrs(token) -> String + * + * Render token attributes to string. + **/ + Renderer.prototype.renderAttrs = function renderAttrs(token) { + var i, l, result; + + if (!token.attrs) { + return ""; + } + + result = ""; + + for (i = 0, l = token.attrs.length; i < l; i++) { + result += + " " + + escapeHtml(token.attrs[i][0]) + + '="' + + escapeHtml(token.attrs[i][1]) + + '"'; + } + + return result; + }; + + /** + * Renderer.renderToken(tokens, idx, options) -> String + * - tokens (Array): list of tokens + * - idx (Numbed): token index to render + * - options (Object): params of parser instance + * + * Default token renderer. Can be overriden by custom function + * in [[Renderer#rules]]. + **/ + Renderer.prototype.renderToken = function renderToken( + tokens, + idx, + options, + ) { + var nextToken, + result = "", + needLf = false, + token = tokens[idx]; + + // Tight list paragraphs + if (token.hidden) { + return ""; + } + + // Insert a newline between hidden paragraph and subsequent opening + // block-level tag. + // + // For example, here we should insert a newline before blockquote: + // - a + // > + // + if ( + token.block && + token.nesting !== -1 && + idx && + tokens[idx - 1].hidden + ) { + result += "\n"; + } + + // Add token name, e.g. ``. + // + needLf = false; + } + } + } + } + + result += needLf ? ">\n" : ">"; + + return result; + }; + + /** + * Renderer.renderInline(tokens, options, env) -> String + * - tokens (Array): list on block tokens to renter + * - options (Object): params of parser instance + * - env (Object): additional data from parsed input (references, for example) + * + * The same as [[Renderer.render]], but for single token of `inline` type. + **/ + Renderer.prototype.renderInline = function (tokens, options, env) { + var type, + result = "", + rules = this.rules; + + for (var i = 0, len = tokens.length; i < len; i++) { + type = tokens[i].type; + + if (typeof rules[type] !== "undefined") { + result += rules[type](tokens, i, options, env, this); + } else { + result += this.renderToken(tokens, i, options); + } + } + + return result; + }; + + /** internal + * Renderer.renderInlineAsText(tokens, options, env) -> String + * - tokens (Array): list on block tokens to renter + * - options (Object): params of parser instance + * - env (Object): additional data from parsed input (references, for example) + * + * Special kludge for image `alt` attributes to conform CommonMark spec. + * Don't try to use it! Spec requires to show `alt` content with stripped markup, + * instead of simple escaping. + **/ + Renderer.prototype.renderInlineAsText = function ( + tokens, + options, + env, + ) { + var result = ""; + + for (var i = 0, len = tokens.length; i < len; i++) { + if (tokens[i].type === "text") { + result += tokens[i].content; + } else if (tokens[i].type === "image") { + result += this.renderInlineAsText( + tokens[i].children, + options, + env, + ); + } + } + + return result; + }; + + /** + * Renderer.render(tokens, options, env) -> String + * - tokens (Array): list on block tokens to renter + * - options (Object): params of parser instance + * - env (Object): additional data from parsed input (references, for example) + * + * Takes token stream and generates HTML. Probably, you will never need to call + * this method directly. + **/ + Renderer.prototype.render = function (tokens, options, env) { + var i, + len, + type, + result = "", + rules = this.rules; + + for (i = 0, len = tokens.length; i < len; i++) { + type = tokens[i].type; + + if (type === "inline") { + result += this.renderInline(tokens[i].children, options, env); + } else if (typeof rules[type] !== "undefined") { + result += rules[tokens[i].type](tokens, i, options, env, this); + } else { + result += this.renderToken(tokens, i, options, env); + } + } + + return result; + }; + + module.exports = Renderer; + }, + { "./common/utils": 4 }, + ], + 17: [ + function (require, module, exports) { + /** + * class Ruler + * + * Helper class, used by [[MarkdownIt#core]], [[MarkdownIt#block]] and + * [[MarkdownIt#inline]] to manage sequences of functions (rules): + * + * - keep rules in defined order + * - assign the name to each rule + * - enable/disable rules + * - add/replace rules + * - allow assign rules to additional named chains (in the same) + * - cacheing lists of active rules + * + * You will not need use this class directly until write plugins. For simple + * rules control use [[MarkdownIt.disable]], [[MarkdownIt.enable]] and + * [[MarkdownIt.use]]. + **/ + "use strict"; + + /** + * new Ruler() + **/ + function Ruler() { + // List of added rules. Each element is: + // + // { + // name: XXX, + // enabled: Boolean, + // fn: Function(), + // alt: [ name2, name3 ] + // } + // + this.__rules__ = []; + + // Cached rule chains. + // + // First level - chain name, '' for default. + // Second level - diginal anchor for fast filtering by charcodes. + // + this.__cache__ = null; + } + + //////////////////////////////////////////////////////////////////////////////// + // Helper methods, should not be used directly + + // Find rule index by name + // + Ruler.prototype.__find__ = function (name) { + for (var i = 0; i < this.__rules__.length; i++) { + if (this.__rules__[i].name === name) { + return i; + } + } + return -1; + }; + + // Build rules lookup cache + // + Ruler.prototype.__compile__ = function () { + var self = this; + var chains = [""]; + + // collect unique names + self.__rules__.forEach(function (rule) { + if (!rule.enabled) { + return; + } + + rule.alt.forEach(function (altName) { + if (chains.indexOf(altName) < 0) { + chains.push(altName); + } + }); + }); + + self.__cache__ = {}; + + chains.forEach(function (chain) { + self.__cache__[chain] = []; + self.__rules__.forEach(function (rule) { + if (!rule.enabled) { + return; + } + + if (chain && rule.alt.indexOf(chain) < 0) { + return; + } + + self.__cache__[chain].push(rule.fn); + }); + }); + }; + + /** + * Ruler.at(name, fn [, options]) + * - name (String): rule name to replace. + * - fn (Function): new rule function. + * - options (Object): new rule options (not mandatory). + * + * Replace rule by name with new function & options. Throws error if name not + * found. + * + * ##### Options: + * + * - __alt__ - array with names of "alternate" chains. + * + * ##### Example + * + * Replace existing typographer replacement rule with new one: + * + * ```javascript + * var md = require('markdown-it')(); + * + * md.core.ruler.at('replacements', function replace(state) { + * //... + * }); + * ``` + **/ + Ruler.prototype.at = function (name, fn, options) { + var index = this.__find__(name); + var opt = options || {}; + + if (index === -1) { + throw new Error("Parser rule not found: " + name); + } + + this.__rules__[index].fn = fn; + this.__rules__[index].alt = opt.alt || []; + this.__cache__ = null; + }; + + /** + * Ruler.before(beforeName, ruleName, fn [, options]) + * - beforeName (String): new rule will be added before this one. + * - ruleName (String): name of added rule. + * - fn (Function): rule function. + * - options (Object): rule options (not mandatory). + * + * Add new rule to chain before one with given name. See also + * [[Ruler.after]], [[Ruler.push]]. + * + * ##### Options: + * + * - __alt__ - array with names of "alternate" chains. + * + * ##### Example + * + * ```javascript + * var md = require('markdown-it')(); + * + * md.block.ruler.before('paragraph', 'my_rule', function replace(state) { + * //... + * }); + * ``` + **/ + Ruler.prototype.before = function ( + beforeName, + ruleName, + fn, + options, + ) { + var index = this.__find__(beforeName); + var opt = options || {}; + + if (index === -1) { + throw new Error("Parser rule not found: " + beforeName); + } + + this.__rules__.splice(index, 0, { + name: ruleName, + enabled: true, + fn: fn, + alt: opt.alt || [], + }); + + this.__cache__ = null; + }; + + /** + * Ruler.after(afterName, ruleName, fn [, options]) + * - afterName (String): new rule will be added after this one. + * - ruleName (String): name of added rule. + * - fn (Function): rule function. + * - options (Object): rule options (not mandatory). + * + * Add new rule to chain after one with given name. See also + * [[Ruler.before]], [[Ruler.push]]. + * + * ##### Options: + * + * - __alt__ - array with names of "alternate" chains. + * + * ##### Example + * + * ```javascript + * var md = require('markdown-it')(); + * + * md.inline.ruler.after('text', 'my_rule', function replace(state) { + * //... + * }); + * ``` + **/ + Ruler.prototype.after = function (afterName, ruleName, fn, options) { + var index = this.__find__(afterName); + var opt = options || {}; + + if (index === -1) { + throw new Error("Parser rule not found: " + afterName); + } + + this.__rules__.splice(index + 1, 0, { + name: ruleName, + enabled: true, + fn: fn, + alt: opt.alt || [], + }); + + this.__cache__ = null; + }; + + /** + * Ruler.push(ruleName, fn [, options]) + * - ruleName (String): name of added rule. + * - fn (Function): rule function. + * - options (Object): rule options (not mandatory). + * + * Push new rule to the end of chain. See also + * [[Ruler.before]], [[Ruler.after]]. + * + * ##### Options: + * + * - __alt__ - array with names of "alternate" chains. + * + * ##### Example + * + * ```javascript + * var md = require('markdown-it')(); + * + * md.core.ruler.push('my_rule', function replace(state) { + * //... + * }); + * ``` + **/ + Ruler.prototype.push = function (ruleName, fn, options) { + var opt = options || {}; + + this.__rules__.push({ + name: ruleName, + enabled: true, + fn: fn, + alt: opt.alt || [], + }); + + this.__cache__ = null; + }; + + /** + * Ruler.enable(list [, ignoreInvalid]) -> Array + * - list (String|Array): list of rule names to enable. + * - ignoreInvalid (Boolean): set `true` to ignore errors when rule not found. + * + * Enable rules with given names. If any rule name not found - throw Error. + * Errors can be disabled by second param. + * + * Returns list of found rule names (if no exception happened). + * + * See also [[Ruler.disable]], [[Ruler.enableOnly]]. + **/ + Ruler.prototype.enable = function (list, ignoreInvalid) { + if (!Array.isArray(list)) { + list = [list]; + } + + var result = []; + + // Search by name and enable + list.forEach(function (name) { + var idx = this.__find__(name); + + if (idx < 0) { + if (ignoreInvalid) { + return; + } + throw new Error("Rules manager: invalid rule name " + name); + } + this.__rules__[idx].enabled = true; + result.push(name); + }, this); + + this.__cache__ = null; + return result; + }; + + /** + * Ruler.enableOnly(list [, ignoreInvalid]) + * - list (String|Array): list of rule names to enable (whitelist). + * - ignoreInvalid (Boolean): set `true` to ignore errors when rule not found. + * + * Enable rules with given names, and disable everything else. If any rule name + * not found - throw Error. Errors can be disabled by second param. + * + * See also [[Ruler.disable]], [[Ruler.enable]]. + **/ + Ruler.prototype.enableOnly = function (list, ignoreInvalid) { + if (!Array.isArray(list)) { + list = [list]; + } + + this.__rules__.forEach(function (rule) { + rule.enabled = false; + }); + + this.enable(list, ignoreInvalid); + }; + + /** + * Ruler.disable(list [, ignoreInvalid]) -> Array + * - list (String|Array): list of rule names to disable. + * - ignoreInvalid (Boolean): set `true` to ignore errors when rule not found. + * + * Disable rules with given names. If any rule name not found - throw Error. + * Errors can be disabled by second param. + * + * Returns list of found rule names (if no exception happened). + * + * See also [[Ruler.enable]], [[Ruler.enableOnly]]. + **/ + Ruler.prototype.disable = function (list, ignoreInvalid) { + if (!Array.isArray(list)) { + list = [list]; + } + + var result = []; + + // Search by name and disable + list.forEach(function (name) { + var idx = this.__find__(name); + + if (idx < 0) { + if (ignoreInvalid) { + return; + } + throw new Error("Rules manager: invalid rule name " + name); + } + this.__rules__[idx].enabled = false; + result.push(name); + }, this); + + this.__cache__ = null; + return result; + }; + + /** + * Ruler.getRules(chainName) -> Array + * + * Return array of active functions (rules) for given chain name. It analyzes + * rules configuration, compiles caches if not exists and returns result. + * + * Default chain name is `''` (empty string). It can't be skipped. That's + * done intentionally, to keep signature monomorphic for high speed. + **/ + Ruler.prototype.getRules = function (chainName) { + if (this.__cache__ === null) { + this.__compile__(); + } + + // Chain can be empty, if rules disabled. But we still have to return Array. + return this.__cache__[chainName] || []; + }; + + module.exports = Ruler; + }, + {}, + ], + 18: [ + function (require, module, exports) { + // Block quotes + + "use strict"; + + var isSpace = require("../common/utils").isSpace; + + module.exports = function blockquote( + state, + startLine, + endLine, + silent, + ) { + var adjustTab, + ch, + i, + initial, + l, + lastLineEmpty, + lines, + nextLine, + offset, + oldBMarks, + oldBSCount, + oldIndent, + oldParentType, + oldSCount, + oldTShift, + spaceAfterMarker, + terminate, + terminatorRules, + token, + wasOutdented, + oldLineMax = state.lineMax, + pos = state.bMarks[startLine] + state.tShift[startLine], + max = state.eMarks[startLine]; + + // if it's indented more than 3 spaces, it should be a code block + if (state.sCount[startLine] - state.blkIndent >= 4) { + return false; + } + + // check the block quote marker + if (state.src.charCodeAt(pos++) !== 0x3e /* > */) { + return false; + } + + // we know that it's going to be a valid blockquote, + // so no point trying to find the end of it in silent mode + if (silent) { + return true; + } + + // skip spaces after ">" and re-calculate offset + initial = offset = + state.sCount[startLine] + + pos - + (state.bMarks[startLine] + state.tShift[startLine]); + + // skip one optional space after '>' + if (state.src.charCodeAt(pos) === 0x20 /* space */) { + // ' > test ' + // ^ -- position start of line here: + pos++; + initial++; + offset++; + adjustTab = false; + spaceAfterMarker = true; + } else if (state.src.charCodeAt(pos) === 0x09 /* tab */) { + spaceAfterMarker = true; + + if ((state.bsCount[startLine] + offset) % 4 === 3) { + // ' >\t test ' + // ^ -- position start of line here (tab has width===1) + pos++; + initial++; + offset++; + adjustTab = false; + } else { + // ' >\t test ' + // ^ -- position start of line here + shift bsCount slightly + // to make extra space appear + adjustTab = true; + } + } else { + spaceAfterMarker = false; + } + + oldBMarks = [state.bMarks[startLine]]; + state.bMarks[startLine] = pos; + + while (pos < max) { + ch = state.src.charCodeAt(pos); + + if (isSpace(ch)) { + if (ch === 0x09) { + offset += + 4 - + ((offset + state.bsCount[startLine] + (adjustTab ? 1 : 0)) % + 4); + } else { + offset++; + } + } else { + break; + } + + pos++; + } + + oldBSCount = [state.bsCount[startLine]]; + state.bsCount[startLine] = + state.sCount[startLine] + 1 + (spaceAfterMarker ? 1 : 0); + + lastLineEmpty = pos >= max; + + oldSCount = [state.sCount[startLine]]; + state.sCount[startLine] = offset - initial; + + oldTShift = [state.tShift[startLine]]; + state.tShift[startLine] = pos - state.bMarks[startLine]; + + terminatorRules = state.md.block.ruler.getRules("blockquote"); + + oldParentType = state.parentType; + state.parentType = "blockquote"; + wasOutdented = false; + + // Search the end of the block + // + // Block ends with either: + // 1. an empty line outside: + // ``` + // > test + // + // ``` + // 2. an empty line inside: + // ``` + // > + // test + // ``` + // 3. another tag: + // ``` + // > test + // - - - + // ``` + for (nextLine = startLine + 1; nextLine < endLine; nextLine++) { + // check if it's outdented, i.e. it's inside list item and indented + // less than said list item: + // + // ``` + // 1. anything + // > current blockquote + // 2. checking this line + // ``` + if (state.sCount[nextLine] < state.blkIndent) wasOutdented = true; + + pos = state.bMarks[nextLine] + state.tShift[nextLine]; + max = state.eMarks[nextLine]; + + if (pos >= max) { + // Case 1: line is not inside the blockquote, and this line is empty. + break; + } + + if ( + state.src.charCodeAt(pos++) === 0x3e /* > */ && + !wasOutdented + ) { + // This line is inside the blockquote. + + // skip spaces after ">" and re-calculate offset + initial = offset = + state.sCount[nextLine] + + pos - + (state.bMarks[nextLine] + state.tShift[nextLine]); + + // skip one optional space after '>' + if (state.src.charCodeAt(pos) === 0x20 /* space */) { + // ' > test ' + // ^ -- position start of line here: + pos++; + initial++; + offset++; + adjustTab = false; + spaceAfterMarker = true; + } else if (state.src.charCodeAt(pos) === 0x09 /* tab */) { + spaceAfterMarker = true; + + if ((state.bsCount[nextLine] + offset) % 4 === 3) { + // ' >\t test ' + // ^ -- position start of line here (tab has width===1) + pos++; + initial++; + offset++; + adjustTab = false; + } else { + // ' >\t test ' + // ^ -- position start of line here + shift bsCount slightly + // to make extra space appear + adjustTab = true; + } + } else { + spaceAfterMarker = false; + } + + oldBMarks.push(state.bMarks[nextLine]); + state.bMarks[nextLine] = pos; + + while (pos < max) { + ch = state.src.charCodeAt(pos); + + if (isSpace(ch)) { + if (ch === 0x09) { + offset += + 4 - + ((offset + + state.bsCount[nextLine] + + (adjustTab ? 1 : 0)) % + 4); + } else { + offset++; + } + } else { + break; + } + + pos++; + } + + lastLineEmpty = pos >= max; + + oldBSCount.push(state.bsCount[nextLine]); + state.bsCount[nextLine] = + state.sCount[nextLine] + 1 + (spaceAfterMarker ? 1 : 0); + + oldSCount.push(state.sCount[nextLine]); + state.sCount[nextLine] = offset - initial; + + oldTShift.push(state.tShift[nextLine]); + state.tShift[nextLine] = pos - state.bMarks[nextLine]; + continue; + } + + // Case 2: line is not inside the blockquote, and the last line was empty. + if (lastLineEmpty) { + break; + } + + // Case 3: another tag found. + terminate = false; + for (i = 0, l = terminatorRules.length; i < l; i++) { + if (terminatorRules[i](state, nextLine, endLine, true)) { + terminate = true; + break; + } + } + + if (terminate) { + // Quirk to enforce "hard termination mode" for paragraphs; + // normally if you call `tokenize(state, startLine, nextLine)`, + // paragraphs will look below nextLine for paragraph continuation, + // but if blockquote is terminated by another tag, they shouldn't + state.lineMax = nextLine; + + if (state.blkIndent !== 0) { + // state.blkIndent was non-zero, we now set it to zero, + // so we need to re-calculate all offsets to appear as + // if indent wasn't changed + oldBMarks.push(state.bMarks[nextLine]); + oldBSCount.push(state.bsCount[nextLine]); + oldTShift.push(state.tShift[nextLine]); + oldSCount.push(state.sCount[nextLine]); + state.sCount[nextLine] -= state.blkIndent; + } + + break; + } + + oldBMarks.push(state.bMarks[nextLine]); + oldBSCount.push(state.bsCount[nextLine]); + oldTShift.push(state.tShift[nextLine]); + oldSCount.push(state.sCount[nextLine]); + + // A negative indentation means that this is a paragraph continuation + // + state.sCount[nextLine] = -1; + } + + oldIndent = state.blkIndent; + state.blkIndent = 0; + + token = state.push("blockquote_open", "blockquote", 1); + token.markup = ">"; + token.map = lines = [startLine, 0]; + + state.md.block.tokenize(state, startLine, nextLine); + + token = state.push("blockquote_close", "blockquote", -1); + token.markup = ">"; + + state.lineMax = oldLineMax; + state.parentType = oldParentType; + lines[1] = state.line; + + // Restore original tShift; this might not be necessary since the parser + // has already been here, but just to make sure we can do that. + for (i = 0; i < oldTShift.length; i++) { + state.bMarks[i + startLine] = oldBMarks[i]; + state.tShift[i + startLine] = oldTShift[i]; + state.sCount[i + startLine] = oldSCount[i]; + state.bsCount[i + startLine] = oldBSCount[i]; + } + state.blkIndent = oldIndent; + + return true; + }; + }, + { "../common/utils": 4 }, + ], + 19: [ + function (require, module, exports) { + // Code block (4 spaces padded) + + "use strict"; + + module.exports = function code( + state, + startLine, + endLine /*, silent*/, + ) { + var nextLine, last, token; + + if (state.sCount[startLine] - state.blkIndent < 4) { + return false; + } + + last = nextLine = startLine + 1; + + while (nextLine < endLine) { + if (state.isEmpty(nextLine)) { + nextLine++; + continue; + } + + if (state.sCount[nextLine] - state.blkIndent >= 4) { + nextLine++; + last = nextLine; + continue; + } + break; + } + + state.line = last; + + token = state.push("code_block", "code", 0); + token.content = state.getLines( + startLine, + last, + 4 + state.blkIndent, + true, + ); + token.map = [startLine, state.line]; + + return true; + }; + }, + {}, + ], + 20: [ + function (require, module, exports) { + // fences (``` lang, ~~~ lang) + + "use strict"; + + module.exports = function fence(state, startLine, endLine, silent) { + var marker, + len, + params, + nextLine, + mem, + token, + markup, + haveEndMarker = false, + pos = state.bMarks[startLine] + state.tShift[startLine], + max = state.eMarks[startLine]; + + // if it's indented more than 3 spaces, it should be a code block + if (state.sCount[startLine] - state.blkIndent >= 4) { + return false; + } + + if (pos + 3 > max) { + return false; + } + + marker = state.src.charCodeAt(pos); + + if (marker !== 0x7e /* ~ */ && marker !== 0x60 /* ` */) { + return false; + } + + // scan marker length + mem = pos; + pos = state.skipChars(pos, marker); + + len = pos - mem; + + if (len < 3) { + return false; + } + + markup = state.src.slice(mem, pos); + params = state.src.slice(pos, max); + + if (params.indexOf(String.fromCharCode(marker)) >= 0) { + return false; + } + + // Since start is found, we can report success here in validation mode + if (silent) { + return true; + } + + // search end of block + nextLine = startLine; + + for (;;) { + nextLine++; + if (nextLine >= endLine) { + // unclosed block should be autoclosed by end of document. + // also block seems to be autoclosed by end of parent + break; + } + + pos = mem = state.bMarks[nextLine] + state.tShift[nextLine]; + max = state.eMarks[nextLine]; + + if (pos < max && state.sCount[nextLine] < state.blkIndent) { + // non-empty line with negative indent should stop the list: + // - ``` + // test + break; + } + + if (state.src.charCodeAt(pos) !== marker) { + continue; + } + + if (state.sCount[nextLine] - state.blkIndent >= 4) { + // closing fence should be indented less than 4 spaces + continue; + } + + pos = state.skipChars(pos, marker); + + // closing code fence must be at least as long as the opening one + if (pos - mem < len) { + continue; + } + + // make sure tail has spaces only + pos = state.skipSpaces(pos); + + if (pos < max) { + continue; + } + + haveEndMarker = true; + // found! + break; + } + + // If a fence has heading spaces, they should be removed from its inner block + len = state.sCount[startLine]; + + state.line = nextLine + (haveEndMarker ? 1 : 0); + + token = state.push("fence", "code", 0); + token.info = params; + token.content = state.getLines(startLine + 1, nextLine, len, true); + token.markup = markup; + token.map = [startLine, state.line]; + + return true; + }; + }, + {}, + ], + 21: [ + function (require, module, exports) { + // heading (#, ##, ...) + + "use strict"; + + var isSpace = require("../common/utils").isSpace; + + module.exports = function heading(state, startLine, endLine, silent) { + var ch, + level, + tmp, + token, + pos = state.bMarks[startLine] + state.tShift[startLine], + max = state.eMarks[startLine]; + + // if it's indented more than 3 spaces, it should be a code block + if (state.sCount[startLine] - state.blkIndent >= 4) { + return false; + } + + ch = state.src.charCodeAt(pos); + + if (ch !== 0x23 /* # */ || pos >= max) { + return false; + } + + // count heading level + level = 1; + ch = state.src.charCodeAt(++pos); + while (ch === 0x23 /* # */ && pos < max && level <= 6) { + level++; + ch = state.src.charCodeAt(++pos); + } + + if (level > 6 || (pos < max && !isSpace(ch))) { + return false; + } + + if (silent) { + return true; + } + + // Let's cut tails like ' ### ' from the end of string + + max = state.skipSpacesBack(max, pos); + tmp = state.skipCharsBack(max, 0x23, pos); // # + if (tmp > pos && isSpace(state.src.charCodeAt(tmp - 1))) { + max = tmp; + } + + state.line = startLine + 1; + + token = state.push("heading_open", "h" + String(level), 1); + token.markup = "########".slice(0, level); + token.map = [startLine, state.line]; + + token = state.push("inline", "", 0); + token.content = state.src.slice(pos, max).trim(); + token.map = [startLine, state.line]; + token.children = []; + + token = state.push("heading_close", "h" + String(level), -1); + token.markup = "########".slice(0, level); + + return true; + }; + }, + { "../common/utils": 4 }, + ], + 22: [ + function (require, module, exports) { + // Horizontal rule + + "use strict"; + + var isSpace = require("../common/utils").isSpace; + + module.exports = function hr(state, startLine, endLine, silent) { + var marker, + cnt, + ch, + token, + pos = state.bMarks[startLine] + state.tShift[startLine], + max = state.eMarks[startLine]; + + // if it's indented more than 3 spaces, it should be a code block + if (state.sCount[startLine] - state.blkIndent >= 4) { + return false; + } + + marker = state.src.charCodeAt(pos++); + + // Check hr marker + if ( + marker !== 0x2a /* * */ && + marker !== 0x2d /* - */ && + marker !== 0x5f /* _ */ + ) { + return false; + } + + // markers can be mixed with spaces, but there should be at least 3 of them + + cnt = 1; + while (pos < max) { + ch = state.src.charCodeAt(pos++); + if (ch !== marker && !isSpace(ch)) { + return false; + } + if (ch === marker) { + cnt++; + } + } + + if (cnt < 3) { + return false; + } + + if (silent) { + return true; + } + + state.line = startLine + 1; + + token = state.push("hr", "hr", 0); + token.map = [startLine, state.line]; + token.markup = Array(cnt + 1).join(String.fromCharCode(marker)); + + return true; + }; + }, + { "../common/utils": 4 }, + ], + 23: [ + function (require, module, exports) { + // HTML block + + "use strict"; + + var block_names = require("../common/html_blocks"); + var HTML_OPEN_CLOSE_TAG_RE = + require("../common/html_re").HTML_OPEN_CLOSE_TAG_RE; + + // An array of opening and corresponding closing sequences for html tags, + // last argument defines whether it can terminate a paragraph or not + // + var HTML_SEQUENCES = [ + [ + /^<(script|pre|style)(?=(\s|>|$))/i, + /<\/(script|pre|style)>/i, + true, + ], + [/^/, true], + [/^<\?/, /\?>/, true], + [/^/, true], + [/^/, true], + [ + new RegExp( + "^|$))", + "i", + ), + /^$/, + true, + ], + [new RegExp(HTML_OPEN_CLOSE_TAG_RE.source + "\\s*$"), /^$/, false], + ]; + + module.exports = function html_block( + state, + startLine, + endLine, + silent, + ) { + var i, + nextLine, + token, + lineText, + pos = state.bMarks[startLine] + state.tShift[startLine], + max = state.eMarks[startLine]; + + // if it's indented more than 3 spaces, it should be a code block + if (state.sCount[startLine] - state.blkIndent >= 4) { + return false; + } + + if (!state.md.options.html) { + return false; + } + + if (state.src.charCodeAt(pos) !== 0x3c /* < */) { + return false; + } + + lineText = state.src.slice(pos, max); + + for (i = 0; i < HTML_SEQUENCES.length; i++) { + if (HTML_SEQUENCES[i][0].test(lineText)) { + break; + } + } + + if (i === HTML_SEQUENCES.length) { + return false; + } + + if (silent) { + // true if this sequence can be a terminator, false otherwise + return HTML_SEQUENCES[i][2]; + } + + nextLine = startLine + 1; + + // If we are here - we detected HTML block. + // Let's roll down till block end. + if (!HTML_SEQUENCES[i][1].test(lineText)) { + for (; nextLine < endLine; nextLine++) { + if (state.sCount[nextLine] < state.blkIndent) { + break; + } + + pos = state.bMarks[nextLine] + state.tShift[nextLine]; + max = state.eMarks[nextLine]; + lineText = state.src.slice(pos, max); + + if (HTML_SEQUENCES[i][1].test(lineText)) { + if (lineText.length !== 0) { + nextLine++; + } + break; + } + } + } + + state.line = nextLine; + + token = state.push("html_block", "", 0); + token.map = [startLine, nextLine]; + token.content = state.getLines( + startLine, + nextLine, + state.blkIndent, + true, + ); + + return true; + }; + }, + { "../common/html_blocks": 2, "../common/html_re": 3 }, + ], + 24: [ + function (require, module, exports) { + // lheading (---, ===) + + "use strict"; + + module.exports = function lheading( + state, + startLine, + endLine /*, silent*/, + ) { + var content, + terminate, + i, + l, + token, + pos, + max, + level, + marker, + nextLine = startLine + 1, + oldParentType, + terminatorRules = state.md.block.ruler.getRules("paragraph"); + + // if it's indented more than 3 spaces, it should be a code block + if (state.sCount[startLine] - state.blkIndent >= 4) { + return false; + } + + oldParentType = state.parentType; + state.parentType = "paragraph"; // use paragraph to match terminatorRules + + // jump line-by-line until empty one or EOF + for (; nextLine < endLine && !state.isEmpty(nextLine); nextLine++) { + // this would be a code block normally, but after paragraph + // it's considered a lazy continuation regardless of what's there + if (state.sCount[nextLine] - state.blkIndent > 3) { + continue; + } + + // + // Check for underline in setext header + // + if (state.sCount[nextLine] >= state.blkIndent) { + pos = state.bMarks[nextLine] + state.tShift[nextLine]; + max = state.eMarks[nextLine]; + + if (pos < max) { + marker = state.src.charCodeAt(pos); + + if (marker === 0x2d /* - */ || marker === 0x3d /* = */) { + pos = state.skipChars(pos, marker); + pos = state.skipSpaces(pos); + + if (pos >= max) { + level = marker === 0x3d /* = */ ? 1 : 2; + break; + } + } + } + } + + // quirk for blockquotes, this line should already be checked by that rule + if (state.sCount[nextLine] < 0) { + continue; + } + + // Some tags can terminate paragraph without empty line. + terminate = false; + for (i = 0, l = terminatorRules.length; i < l; i++) { + if (terminatorRules[i](state, nextLine, endLine, true)) { + terminate = true; + break; + } + } + if (terminate) { + break; + } + } + + if (!level) { + // Didn't find valid underline + return false; + } + + content = state + .getLines(startLine, nextLine, state.blkIndent, false) + .trim(); + + state.line = nextLine + 1; + + token = state.push("heading_open", "h" + String(level), 1); + token.markup = String.fromCharCode(marker); + token.map = [startLine, state.line]; + + token = state.push("inline", "", 0); + token.content = content; + token.map = [startLine, state.line - 1]; + token.children = []; + + token = state.push("heading_close", "h" + String(level), -1); + token.markup = String.fromCharCode(marker); + + state.parentType = oldParentType; + + return true; + }; + }, + {}, + ], + 25: [ + function (require, module, exports) { + // Lists + + "use strict"; + + var isSpace = require("../common/utils").isSpace; + + // Search `[-+*][\n ]`, returns next pos after marker on success + // or -1 on fail. + function skipBulletListMarker(state, startLine) { + var marker, pos, max, ch; + + pos = state.bMarks[startLine] + state.tShift[startLine]; + max = state.eMarks[startLine]; + + marker = state.src.charCodeAt(pos++); + // Check bullet + if ( + marker !== 0x2a /* * */ && + marker !== 0x2d /* - */ && + marker !== 0x2b /* + */ + ) { + return -1; + } + + if (pos < max) { + ch = state.src.charCodeAt(pos); + + if (!isSpace(ch)) { + // " -test " - is not a list item + return -1; + } + } + + return pos; + } + + // Search `\d+[.)][\n ]`, returns next pos after marker on success + // or -1 on fail. + function skipOrderedListMarker(state, startLine) { + var ch, + start = state.bMarks[startLine] + state.tShift[startLine], + pos = start, + max = state.eMarks[startLine]; + + // List marker should have at least 2 chars (digit + dot) + if (pos + 1 >= max) { + return -1; + } + + ch = state.src.charCodeAt(pos++); + + if (ch < 0x30 /* 0 */ || ch > 0x39 /* 9 */) { + return -1; + } + + for (;;) { + // EOL -> fail + if (pos >= max) { + return -1; + } + + ch = state.src.charCodeAt(pos++); + + if (ch >= 0x30 /* 0 */ && ch <= 0x39 /* 9 */) { + // List marker should have no more than 9 digits + // (prevents integer overflow in browsers) + if (pos - start >= 10) { + return -1; + } + + continue; + } + + // found valid marker + if (ch === 0x29 /* ) */ || ch === 0x2e /* . */) { + break; + } + + return -1; + } + + if (pos < max) { + ch = state.src.charCodeAt(pos); + + if (!isSpace(ch)) { + // " 1.test " - is not a list item + return -1; + } + } + return pos; + } + + function markTightParagraphs(state, idx) { + var i, + l, + level = state.level + 2; + + for (i = idx + 2, l = state.tokens.length - 2; i < l; i++) { + if ( + state.tokens[i].level === level && + state.tokens[i].type === "paragraph_open" + ) { + state.tokens[i + 2].hidden = true; + state.tokens[i].hidden = true; + i += 2; + } + } + } + + module.exports = function list(state, startLine, endLine, silent) { + var ch, + contentStart, + i, + indent, + indentAfterMarker, + initial, + isOrdered, + itemLines, + l, + listLines, + listTokIdx, + markerCharCode, + markerValue, + max, + nextLine, + offset, + oldIndent, + oldLIndent, + oldParentType, + oldTShift, + oldTight, + pos, + posAfterMarker, + prevEmptyEnd, + start, + terminate, + terminatorRules, + token, + isTerminatingParagraph = false, + tight = true; + + // if it's indented more than 3 spaces, it should be a code block + if (state.sCount[startLine] - state.blkIndent >= 4) { + return false; + } + + // limit conditions when list can interrupt + // a paragraph (validation mode only) + if (silent && state.parentType === "paragraph") { + // Next list item should still terminate previous list item; + // + // This code can fail if plugins use blkIndent as well as lists, + // but I hope the spec gets fixed long before that happens. + // + if (state.tShift[startLine] >= state.blkIndent) { + isTerminatingParagraph = true; + } + } + + // Detect list type and position after marker + if ( + (posAfterMarker = skipOrderedListMarker(state, startLine)) >= 0 + ) { + isOrdered = true; + start = state.bMarks[startLine] + state.tShift[startLine]; + markerValue = Number( + state.src.substr(start, posAfterMarker - start - 1), + ); + + // If we're starting a new ordered list right after + // a paragraph, it should start with 1. + if (isTerminatingParagraph && markerValue !== 1) return false; + } else if ( + (posAfterMarker = skipBulletListMarker(state, startLine)) >= 0 + ) { + isOrdered = false; + } else { + return false; + } + + // If we're starting a new unordered list right after + // a paragraph, first line should not be empty. + if (isTerminatingParagraph) { + if (state.skipSpaces(posAfterMarker) >= state.eMarks[startLine]) + return false; + } + + // We should terminate list on style change. Remember first one to compare. + markerCharCode = state.src.charCodeAt(posAfterMarker - 1); + + // For validation mode we can terminate immediately + if (silent) { + return true; + } + + // Start list + listTokIdx = state.tokens.length; + + if (isOrdered) { + token = state.push("ordered_list_open", "ol", 1); + if (markerValue !== 1) { + token.attrs = [["start", markerValue]]; + } + } else { + token = state.push("bullet_list_open", "ul", 1); + } + + token.map = listLines = [startLine, 0]; + token.markup = String.fromCharCode(markerCharCode); + + // + // Iterate list items + // + + nextLine = startLine; + prevEmptyEnd = false; + terminatorRules = state.md.block.ruler.getRules("list"); + + oldParentType = state.parentType; + state.parentType = "list"; + + while (nextLine < endLine) { + pos = posAfterMarker; + max = state.eMarks[nextLine]; + + initial = offset = + state.sCount[nextLine] + + posAfterMarker - + (state.bMarks[startLine] + state.tShift[startLine]); + + while (pos < max) { + ch = state.src.charCodeAt(pos); + + if (ch === 0x09) { + offset += 4 - ((offset + state.bsCount[nextLine]) % 4); + } else if (ch === 0x20) { + offset++; + } else { + break; + } + + pos++; + } + + contentStart = pos; + + if (contentStart >= max) { + // trimming space in "- \n 3" case, indent is 1 here + indentAfterMarker = 1; + } else { + indentAfterMarker = offset - initial; + } + + // If we have more than 4 spaces, the indent is 1 + // (the rest is just indented code block) + if (indentAfterMarker > 4) { + indentAfterMarker = 1; + } + + // " - test" + // ^^^^^ - calculating total length of this thing + indent = initial + indentAfterMarker; + + // Run subparser & write tokens + token = state.push("list_item_open", "li", 1); + token.markup = String.fromCharCode(markerCharCode); + token.map = itemLines = [startLine, 0]; + + oldIndent = state.blkIndent; + oldTight = state.tight; + oldTShift = state.tShift[startLine]; + oldLIndent = state.sCount[startLine]; + state.blkIndent = indent; + state.tight = true; + state.tShift[startLine] = contentStart - state.bMarks[startLine]; + state.sCount[startLine] = offset; + + if (contentStart >= max && state.isEmpty(startLine + 1)) { + // workaround for this case + // (list item is empty, list terminates before "foo"): + // ~~~~~~~~ + // - + // + // foo + // ~~~~~~~~ + state.line = Math.min(state.line + 2, endLine); + } else { + state.md.block.tokenize(state, startLine, endLine, true); + } + + // If any of list item is tight, mark list as tight + if (!state.tight || prevEmptyEnd) { + tight = false; + } + // Item become loose if finish with empty line, + // but we should filter last element, because it means list finish + prevEmptyEnd = + state.line - startLine > 1 && state.isEmpty(state.line - 1); + + state.blkIndent = oldIndent; + state.tShift[startLine] = oldTShift; + state.sCount[startLine] = oldLIndent; + state.tight = oldTight; + + token = state.push("list_item_close", "li", -1); + token.markup = String.fromCharCode(markerCharCode); + + nextLine = startLine = state.line; + itemLines[1] = nextLine; + contentStart = state.bMarks[startLine]; + + if (nextLine >= endLine) { + break; + } + + // + // Try to check if list is terminated or continued. + // + if (state.sCount[nextLine] < state.blkIndent) { + break; + } + + // fail if terminating block found + terminate = false; + for (i = 0, l = terminatorRules.length; i < l; i++) { + if (terminatorRules[i](state, nextLine, endLine, true)) { + terminate = true; + break; + } + } + if (terminate) { + break; + } + + // fail if list has another type + if (isOrdered) { + posAfterMarker = skipOrderedListMarker(state, nextLine); + if (posAfterMarker < 0) { + break; + } + } else { + posAfterMarker = skipBulletListMarker(state, nextLine); + if (posAfterMarker < 0) { + break; + } + } + + if (markerCharCode !== state.src.charCodeAt(posAfterMarker - 1)) { + break; + } + } + + // Finalize list + if (isOrdered) { + token = state.push("ordered_list_close", "ol", -1); + } else { + token = state.push("bullet_list_close", "ul", -1); + } + token.markup = String.fromCharCode(markerCharCode); + + listLines[1] = nextLine; + state.line = nextLine; + + state.parentType = oldParentType; + + // mark paragraphs tight if needed + if (tight) { + markTightParagraphs(state, listTokIdx); + } + + return true; + }; + }, + { "../common/utils": 4 }, + ], + 26: [ + function (require, module, exports) { + // Paragraph + + "use strict"; + + module.exports = function paragraph(state, startLine /*, endLine*/) { + var content, + terminate, + i, + l, + token, + oldParentType, + nextLine = startLine + 1, + terminatorRules = state.md.block.ruler.getRules("paragraph"), + endLine = state.lineMax; + + oldParentType = state.parentType; + state.parentType = "paragraph"; + + // jump line-by-line until empty one or EOF + for (; nextLine < endLine && !state.isEmpty(nextLine); nextLine++) { + // this would be a code block normally, but after paragraph + // it's considered a lazy continuation regardless of what's there + if (state.sCount[nextLine] - state.blkIndent > 3) { + continue; + } + + // quirk for blockquotes, this line should already be checked by that rule + if (state.sCount[nextLine] < 0) { + continue; + } + + // Some tags can terminate paragraph without empty line. + terminate = false; + for (i = 0, l = terminatorRules.length; i < l; i++) { + if (terminatorRules[i](state, nextLine, endLine, true)) { + terminate = true; + break; + } + } + if (terminate) { + break; + } + } + + content = state + .getLines(startLine, nextLine, state.blkIndent, false) + .trim(); + + state.line = nextLine; + + token = state.push("paragraph_open", "p", 1); + token.map = [startLine, state.line]; + + token = state.push("inline", "", 0); + token.content = content; + token.map = [startLine, state.line]; + token.children = []; + + token = state.push("paragraph_close", "p", -1); + + state.parentType = oldParentType; + + return true; + }; + }, + {}, + ], + 27: [ + function (require, module, exports) { + "use strict"; + + var normalizeReference = + require("../common/utils").normalizeReference; + var isSpace = require("../common/utils").isSpace; + + module.exports = function reference( + state, + startLine, + _endLine, + silent, + ) { + var ch, + destEndPos, + destEndLineNo, + endLine, + href, + i, + l, + label, + labelEnd, + oldParentType, + res, + start, + str, + terminate, + terminatorRules, + title, + lines = 0, + pos = state.bMarks[startLine] + state.tShift[startLine], + max = state.eMarks[startLine], + nextLine = startLine + 1; + + // if it's indented more than 3 spaces, it should be a code block + if (state.sCount[startLine] - state.blkIndent >= 4) { + return false; + } + + if (state.src.charCodeAt(pos) !== 0x5b /* [ */) { + return false; + } + + // Simple check to quickly interrupt scan on [link](url) at the start of line. + // Can be useful on practice: https://github.com/markdown-it/markdown-it/issues/54 + while (++pos < max) { + if ( + state.src.charCodeAt(pos) === 0x5d /* ] */ && + state.src.charCodeAt(pos - 1) !== 0x5c /* \ */ + ) { + if (pos + 1 === max) { + return false; + } + if (state.src.charCodeAt(pos + 1) !== 0x3a /* : */) { + return false; + } + break; + } + } + + endLine = state.lineMax; + + // jump line-by-line until empty one or EOF + terminatorRules = state.md.block.ruler.getRules("reference"); + + oldParentType = state.parentType; + state.parentType = "reference"; + + for (; nextLine < endLine && !state.isEmpty(nextLine); nextLine++) { + // this would be a code block normally, but after paragraph + // it's considered a lazy continuation regardless of what's there + if (state.sCount[nextLine] - state.blkIndent > 3) { + continue; + } + + // quirk for blockquotes, this line should already be checked by that rule + if (state.sCount[nextLine] < 0) { + continue; + } + + // Some tags can terminate paragraph without empty line. + terminate = false; + for (i = 0, l = terminatorRules.length; i < l; i++) { + if (terminatorRules[i](state, nextLine, endLine, true)) { + terminate = true; + break; + } + } + if (terminate) { + break; + } + } + + str = state + .getLines(startLine, nextLine, state.blkIndent, false) + .trim(); + max = str.length; + + for (pos = 1; pos < max; pos++) { + ch = str.charCodeAt(pos); + if (ch === 0x5b /* [ */) { + return false; + } else if (ch === 0x5d /* ] */) { + labelEnd = pos; + break; + } else if (ch === 0x0a /* \n */) { + lines++; + } else if (ch === 0x5c /* \ */) { + pos++; + if (pos < max && str.charCodeAt(pos) === 0x0a) { + lines++; + } + } + } + + if (labelEnd < 0 || str.charCodeAt(labelEnd + 1) !== 0x3a /* : */) { + return false; + } + + // [label]: destination 'title' + // ^^^ skip optional whitespace here + for (pos = labelEnd + 2; pos < max; pos++) { + ch = str.charCodeAt(pos); + if (ch === 0x0a) { + lines++; + } else if (isSpace(ch)) { + /*eslint no-empty:0*/ + } else { + break; + } + } + + // [label]: destination 'title' + // ^^^^^^^^^^^ parse this + res = state.md.helpers.parseLinkDestination(str, pos, max); + if (!res.ok) { + return false; + } + + href = state.md.normalizeLink(res.str); + if (!state.md.validateLink(href)) { + return false; + } + + pos = res.pos; + lines += res.lines; + + // save cursor state, we could require to rollback later + destEndPos = pos; + destEndLineNo = lines; + + // [label]: destination 'title' + // ^^^ skipping those spaces + start = pos; + for (; pos < max; pos++) { + ch = str.charCodeAt(pos); + if (ch === 0x0a) { + lines++; + } else if (isSpace(ch)) { + /*eslint no-empty:0*/ + } else { + break; + } + } + + // [label]: destination 'title' + // ^^^^^^^ parse this + res = state.md.helpers.parseLinkTitle(str, pos, max); + if (pos < max && start !== pos && res.ok) { + title = res.str; + pos = res.pos; + lines += res.lines; + } else { + title = ""; + pos = destEndPos; + lines = destEndLineNo; + } + + // skip trailing spaces until the rest of the line + while (pos < max) { + ch = str.charCodeAt(pos); + if (!isSpace(ch)) { + break; + } + pos++; + } + + if (pos < max && str.charCodeAt(pos) !== 0x0a) { + if (title) { + // garbage at the end of the line after title, + // but it could still be a valid reference if we roll back + title = ""; + pos = destEndPos; + lines = destEndLineNo; + while (pos < max) { + ch = str.charCodeAt(pos); + if (!isSpace(ch)) { + break; + } + pos++; + } + } + } + + if (pos < max && str.charCodeAt(pos) !== 0x0a) { + // garbage at the end of the line + return false; + } + + label = normalizeReference(str.slice(1, labelEnd)); + if (!label) { + // CommonMark 0.20 disallows empty labels + return false; + } + + // Reference can not terminate anything. This check is for safety only. + /*istanbul ignore if*/ + if (silent) { + return true; + } + + if (typeof state.env.references === "undefined") { + state.env.references = {}; + } + if (typeof state.env.references[label] === "undefined") { + state.env.references[label] = { title: title, href: href }; + } + + state.parentType = oldParentType; + + state.line = startLine + lines + 1; + return true; + }; + }, + { "../common/utils": 4 }, + ], + 28: [ + function (require, module, exports) { + // Parser state class + + "use strict"; + + var Token = require("../token"); + var isSpace = require("../common/utils").isSpace; + + function StateBlock(src, md, env, tokens) { + var ch, s, start, pos, len, indent, offset, indent_found; + + this.src = src; + + // link to parser instance + this.md = md; + + this.env = env; + + // + // Internal state vartiables + // + + this.tokens = tokens; + + this.bMarks = []; // line begin offsets for fast jumps + this.eMarks = []; // line end offsets for fast jumps + this.tShift = []; // offsets of the first non-space characters (tabs not expanded) + this.sCount = []; // indents for each line (tabs expanded) + + // An amount of virtual spaces (tabs expanded) between beginning + // of each line (bMarks) and real beginning of that line. + // + // It exists only as a hack because blockquotes override bMarks + // losing information in the process. + // + // It's used only when expanding tabs, you can think about it as + // an initial tab length, e.g. bsCount=21 applied to string `\t123` + // means first tab should be expanded to 4-21%4 === 3 spaces. + // + this.bsCount = []; + + // block parser variables + this.blkIndent = 0; // required block content indent + // (for example, if we are in list) + this.line = 0; // line index in src + this.lineMax = 0; // lines count + this.tight = false; // loose/tight mode for lists + this.ddIndent = -1; // indent of the current dd block (-1 if there isn't any) + + // can be 'blockquote', 'list', 'root', 'paragraph' or 'reference' + // used in lists to determine if they interrupt a paragraph + this.parentType = "root"; + + this.level = 0; + + // renderer + this.result = ""; + + // Create caches + // Generate markers. + s = this.src; + indent_found = false; + + for ( + start = pos = indent = offset = 0, len = s.length; + pos < len; + pos++ + ) { + ch = s.charCodeAt(pos); + + if (!indent_found) { + if (isSpace(ch)) { + indent++; + + if (ch === 0x09) { + offset += 4 - (offset % 4); + } else { + offset++; + } + continue; + } else { + indent_found = true; + } + } + + if (ch === 0x0a || pos === len - 1) { + if (ch !== 0x0a) { + pos++; + } + this.bMarks.push(start); + this.eMarks.push(pos); + this.tShift.push(indent); + this.sCount.push(offset); + this.bsCount.push(0); + + indent_found = false; + indent = 0; + offset = 0; + start = pos + 1; + } + } + + // Push fake entry to simplify cache bounds checks + this.bMarks.push(s.length); + this.eMarks.push(s.length); + this.tShift.push(0); + this.sCount.push(0); + this.bsCount.push(0); + + this.lineMax = this.bMarks.length - 1; // don't count last fake line + } + + // Push new token to "stream". + // + StateBlock.prototype.push = function (type, tag, nesting) { + var token = new Token(type, tag, nesting); + token.block = true; + + if (nesting < 0) { + this.level--; + } + token.level = this.level; + if (nesting > 0) { + this.level++; + } + + this.tokens.push(token); + return token; + }; + + StateBlock.prototype.isEmpty = function isEmpty(line) { + return this.bMarks[line] + this.tShift[line] >= this.eMarks[line]; + }; + + StateBlock.prototype.skipEmptyLines = function skipEmptyLines(from) { + for (var max = this.lineMax; from < max; from++) { + if (this.bMarks[from] + this.tShift[from] < this.eMarks[from]) { + break; + } + } + return from; + }; + + // Skip spaces from given position. + StateBlock.prototype.skipSpaces = function skipSpaces(pos) { + var ch; + + for (var max = this.src.length; pos < max; pos++) { + ch = this.src.charCodeAt(pos); + if (!isSpace(ch)) { + break; + } + } + return pos; + }; + + // Skip spaces from given position in reverse. + StateBlock.prototype.skipSpacesBack = function skipSpacesBack( + pos, + min, + ) { + if (pos <= min) { + return pos; + } + + while (pos > min) { + if (!isSpace(this.src.charCodeAt(--pos))) { + return pos + 1; + } + } + return pos; + }; + + // Skip char codes from given position + StateBlock.prototype.skipChars = function skipChars(pos, code) { + for (var max = this.src.length; pos < max; pos++) { + if (this.src.charCodeAt(pos) !== code) { + break; + } + } + return pos; + }; + + // Skip char codes reverse from given position - 1 + StateBlock.prototype.skipCharsBack = function skipCharsBack( + pos, + code, + min, + ) { + if (pos <= min) { + return pos; + } + + while (pos > min) { + if (code !== this.src.charCodeAt(--pos)) { + return pos + 1; + } + } + return pos; + }; + + // cut lines range from source. + StateBlock.prototype.getLines = function getLines( + begin, + end, + indent, + keepLastLF, + ) { + var i, + lineIndent, + ch, + first, + last, + queue, + lineStart, + line = begin; + + if (begin >= end) { + return ""; + } + + queue = new Array(end - begin); + + for (i = 0; line < end; line++, i++) { + lineIndent = 0; + lineStart = first = this.bMarks[line]; + + if (line + 1 < end || keepLastLF) { + // No need for bounds check because we have fake entry on tail. + last = this.eMarks[line] + 1; + } else { + last = this.eMarks[line]; + } + + while (first < last && lineIndent < indent) { + ch = this.src.charCodeAt(first); + + if (isSpace(ch)) { + if (ch === 0x09) { + lineIndent += 4 - ((lineIndent + this.bsCount[line]) % 4); + } else { + lineIndent++; + } + } else if (first - lineStart < this.tShift[line]) { + // patched tShift masked characters to look like spaces (blockquotes, list markers) + lineIndent++; + } else { + break; + } + + first++; + } + + if (lineIndent > indent) { + // partially expanding tabs in code blocks, e.g '\t\tfoobar' + // with indent=2 becomes ' \tfoobar' + queue[i] = + new Array(lineIndent - indent + 1).join(" ") + + this.src.slice(first, last); + } else { + queue[i] = this.src.slice(first, last); + } + } + + return queue.join(""); + }; + + // re-export Token class to use in block rules + StateBlock.prototype.Token = Token; + + module.exports = StateBlock; + }, + { "../common/utils": 4, "../token": 51 }, + ], + 29: [ + function (require, module, exports) { + // GFM table, non-standard + + "use strict"; + + var isSpace = require("../common/utils").isSpace; + + function getLine(state, line) { + var pos = state.bMarks[line] + state.blkIndent, + max = state.eMarks[line]; + + return state.src.substr(pos, max - pos); + } + + function escapedSplit(str) { + var result = [], + pos = 0, + max = str.length, + ch, + escapes = 0, + lastPos = 0, + backTicked = false, + lastBackTick = 0; + + ch = str.charCodeAt(pos); + + while (pos < max) { + if (ch === 0x60 /* ` */) { + if (backTicked) { + // make \` close code sequence, but not open it; + // the reason is: `\` is correct code block + backTicked = false; + lastBackTick = pos; + } else if (escapes % 2 === 0) { + backTicked = true; + lastBackTick = pos; + } + } else if ( + ch === 0x7c /* | */ && + escapes % 2 === 0 && + !backTicked + ) { + result.push(str.substring(lastPos, pos)); + lastPos = pos + 1; + } + + if (ch === 0x5c /* \ */) { + escapes++; + } else { + escapes = 0; + } + + pos++; + + // If there was an un-closed backtick, go back to just after + // the last backtick, but as if it was a normal character + if (pos === max && backTicked) { + backTicked = false; + pos = lastBackTick + 1; + } + + ch = str.charCodeAt(pos); + } + + result.push(str.substring(lastPos)); + + return result; + } + + module.exports = function table(state, startLine, endLine, silent) { + var ch, + lineText, + pos, + i, + nextLine, + columns, + columnCount, + token, + aligns, + t, + tableLines, + tbodyLines; + + // should have at least two lines + if (startLine + 2 > endLine) { + return false; + } + + nextLine = startLine + 1; + + if (state.sCount[nextLine] < state.blkIndent) { + return false; + } + + // if it's indented more than 3 spaces, it should be a code block + if (state.sCount[nextLine] - state.blkIndent >= 4) { + return false; + } + + // first character of the second line should be '|', '-', ':', + // and no other characters are allowed but spaces; + // basically, this is the equivalent of /^[-:|][-:|\s]*$/ regexp + + pos = state.bMarks[nextLine] + state.tShift[nextLine]; + if (pos >= state.eMarks[nextLine]) { + return false; + } + + ch = state.src.charCodeAt(pos++); + if ( + ch !== 0x7c /* | */ && + ch !== 0x2d /* - */ && + ch !== 0x3a /* : */ + ) { + return false; + } + + while (pos < state.eMarks[nextLine]) { + ch = state.src.charCodeAt(pos); + + if ( + ch !== 0x7c /* | */ && + ch !== 0x2d /* - */ && + ch !== 0x3a /* : */ && + !isSpace(ch) + ) { + return false; + } + + pos++; + } + + lineText = getLine(state, startLine + 1); + + columns = lineText.split("|"); + aligns = []; + for (i = 0; i < columns.length; i++) { + t = columns[i].trim(); + if (!t) { + // allow empty columns before and after table, but not in between columns; + // e.g. allow ` |---| `, disallow ` ---||--- ` + if (i === 0 || i === columns.length - 1) { + continue; + } else { + return false; + } + } + + if (!/^:?-+:?$/.test(t)) { + return false; + } + if (t.charCodeAt(t.length - 1) === 0x3a /* : */) { + aligns.push( + t.charCodeAt(0) === 0x3a /* : */ ? "center" : "right", + ); + } else if (t.charCodeAt(0) === 0x3a /* : */) { + aligns.push("left"); + } else { + aligns.push(""); + } + } + + lineText = getLine(state, startLine).trim(); + if (lineText.indexOf("|") === -1) { + return false; + } + if (state.sCount[startLine] - state.blkIndent >= 4) { + return false; + } + columns = escapedSplit(lineText.replace(/^\||\|$/g, "")); + + // header row will define an amount of columns in the entire table, + // and align row shouldn't be smaller than that (the rest of the rows can) + columnCount = columns.length; + if (columnCount > aligns.length) { + return false; + } + + if (silent) { + return true; + } + + token = state.push("table_open", 'table cellspacing="0"', 1); + token.map = tableLines = [startLine, 0]; + + token = state.push("thead_open", "thead", 1); + token.map = [startLine, startLine + 1]; + + token = state.push("tr_open", "tr", 1); + token.map = [startLine, startLine + 1]; + + for (i = 0; i < columns.length; i++) { + token = state.push("th_open", "th", 1); + token.map = [startLine, startLine + 1]; + if (aligns[i]) { + token.attrs = [["style", "text-align:" + aligns[i]]]; + } + + token = state.push("inline", "", 0); + token.content = columns[i].trim(); + token.map = [startLine, startLine + 1]; + token.children = []; + + token = state.push("th_close", "th", -1); + } + + token = state.push("tr_close", "tr", -1); + token = state.push("thead_close", "thead", -1); + + token = state.push("tbody_open", "tbody", 1); + token.map = tbodyLines = [startLine + 2, 0]; + + for (nextLine = startLine + 2; nextLine < endLine; nextLine++) { + if (state.sCount[nextLine] < state.blkIndent) { + break; + } + + lineText = getLine(state, nextLine).trim(); + if (lineText.indexOf("|") === -1) { + break; + } + if (state.sCount[nextLine] - state.blkIndent >= 4) { + break; + } + columns = escapedSplit(lineText.replace(/^\||\|$/g, "")); + + token = state.push("tr_open", "tr", 1); + for (i = 0; i < columnCount; i++) { + token = state.push("td_open", "td", 1); + if (aligns[i]) { + token.attrs = [["style", "text-align:" + aligns[i]]]; + } + + token = state.push("inline", "", 0); + token.content = columns[i] ? columns[i].trim() : ""; + token.children = []; + + token = state.push("td_close", "td", -1); + } + token = state.push("tr_close", "tr", -1); + } + token = state.push("tbody_close", "tbody", -1); + token = state.push("table_close", "table", -1); + + tableLines[1] = tbodyLines[1] = nextLine; + state.line = nextLine; + return true; + }; + }, + { "../common/utils": 4 }, + ], + 30: [ + function (require, module, exports) { + "use strict"; + + module.exports = function block(state) { + var token; + + if (state.inlineMode) { + token = new state.Token("inline", "", 0); + token.content = state.src; + token.map = [0, 1]; + token.children = []; + state.tokens.push(token); + } else { + state.md.block.parse( + state.src, + state.md, + state.env, + state.tokens, + ); + } + }; + }, + {}, + ], + 31: [ + function (require, module, exports) { + "use strict"; + + module.exports = function inline(state) { + var tokens = state.tokens, + tok, + i, + l; + + // Parse inlines + for (i = 0, l = tokens.length; i < l; i++) { + tok = tokens[i]; + if (tok.type === "inline") { + state.md.inline.parse( + tok.content, + state.md, + state.env, + tok.children, + ); + } + } + }; + }, + {}, + ], + 32: [ + function (require, module, exports) { + // Replace link-like texts with link nodes. + // + // Currently restricted by `md.validateLink()` to http/https/ftp + // + "use strict"; + + var arrayReplaceAt = require("../common/utils").arrayReplaceAt; + + function isLinkOpen(str) { + return /^\s]/i.test(str); + } + function isLinkClose(str) { + return /^<\/a\s*>/i.test(str); + } + + module.exports = function linkify(state) { + var i, + j, + l, + tokens, + token, + currentToken, + nodes, + ln, + text, + pos, + lastPos, + level, + htmlLinkLevel, + url, + fullUrl, + urlText, + blockTokens = state.tokens, + links; + + if (!state.md.options.linkify) { + return; + } + + for (j = 0, l = blockTokens.length; j < l; j++) { + if ( + blockTokens[j].type !== "inline" || + !state.md.linkify.pretest(blockTokens[j].content) + ) { + continue; + } + + tokens = blockTokens[j].children; + + htmlLinkLevel = 0; + + // We scan from the end, to keep position when new tags added. + // Use reversed logic in links start/end match + for (i = tokens.length - 1; i >= 0; i--) { + currentToken = tokens[i]; + + // Skip content of markdown links + if (currentToken.type === "link_close") { + i--; + while ( + tokens[i].level !== currentToken.level && + tokens[i].type !== "link_open" + ) { + i--; + } + continue; + } + + // Skip content of html tag links + if (currentToken.type === "html_inline") { + if (isLinkOpen(currentToken.content) && htmlLinkLevel > 0) { + htmlLinkLevel--; + } + if (isLinkClose(currentToken.content)) { + htmlLinkLevel++; + } + } + if (htmlLinkLevel > 0) { + continue; + } + + if ( + currentToken.type === "text" && + state.md.linkify.test(currentToken.content) + ) { + text = currentToken.content; + links = state.md.linkify.match(text); + + // Now split string to nodes + nodes = []; + level = currentToken.level; + lastPos = 0; + + for (ln = 0; ln < links.length; ln++) { + url = links[ln].url; + fullUrl = state.md.normalizeLink(url); + if (!state.md.validateLink(fullUrl)) { + continue; + } + + urlText = links[ln].text; + + // Linkifier might send raw hostnames like "example.com", where url + // starts with domain name. So we prepend http:// in those cases, + // and remove it afterwards. + // + if (!links[ln].schema) { + urlText = state.md + .normalizeLinkText("http://" + urlText) + .replace(/^http:\/\//, ""); + } else if ( + links[ln].schema === "mailto:" && + !/^mailto:/i.test(urlText) + ) { + urlText = state.md + .normalizeLinkText("mailto:" + urlText) + .replace(/^mailto:/, ""); + } else { + urlText = state.md.normalizeLinkText(urlText); + } + + pos = links[ln].index; + + if (pos > lastPos) { + token = new state.Token("text", "", 0); + token.content = text.slice(lastPos, pos); + token.level = level; + nodes.push(token); + } + + token = new state.Token("link_open", "a", 1); + token.attrs = [["href", fullUrl]]; + token.level = level++; + token.markup = "linkify"; + token.info = "auto"; + nodes.push(token); + + token = new state.Token("text", "", 0); + token.content = urlText; + token.level = level; + nodes.push(token); + + token = new state.Token("link_close", "a", -1); + token.level = --level; + token.markup = "linkify"; + token.info = "auto"; + nodes.push(token); + + lastPos = links[ln].lastIndex; + } + if (lastPos < text.length) { + token = new state.Token("text", "", 0); + token.content = text.slice(lastPos); + token.level = level; + nodes.push(token); + } + + // replace current node + blockTokens[j].children = tokens = arrayReplaceAt( + tokens, + i, + nodes, + ); + } + } + } + }; + }, + { "../common/utils": 4 }, + ], + 33: [ + function (require, module, exports) { + // Normalize input string + + "use strict"; + + var NEWLINES_RE = /\r[\n\u0085]?|[\u2424\u2028\u0085]/g; + var NULL_RE = /\u0000/g; + + module.exports = function inline(state) { + var str; + + // Normalize newlines + str = state.src.replace(NEWLINES_RE, "\n"); + + // Replace NULL characters + str = str.replace(NULL_RE, "\uFFFD"); + + state.src = str; + }; + }, + {}, + ], + 34: [ + function (require, module, exports) { + // Simple typographyc replacements + // + // (c) (C) → © + // (tm) (TM) → ™ + // (r) (R) → ® + // +- → ± + // (p) (P) -> § + // ... → … (also ?.... → ?.., !.... → !..) + // ???????? → ???, !!!!! → !!!, `,,` → `,` + // -- → –, --- → — + // + "use strict"; + + // TODO: + // - fractionals 1/2, 1/4, 3/4 -> ½, ¼, ¾ + // - miltiplication 2 x 4 -> 2 × 4 + + var RARE_RE = /\+-|\.\.|\?\?\?\?|!!!!|,,|--/; + + // Workaround for phantomjs - need regex without /g flag, + // or root check will fail every second time + var SCOPED_ABBR_TEST_RE = /\((c|tm|r|p)\)/i; + + var SCOPED_ABBR_RE = /\((c|tm|r|p)\)/gi; + var SCOPED_ABBR = { + c: "©", + r: "®", + p: "§", + tm: "™", + }; + + function replaceFn(match, name) { + return SCOPED_ABBR[name.toLowerCase()]; + } + + function replace_scoped(inlineTokens) { + var i, + token, + inside_autolink = 0; + + for (i = inlineTokens.length - 1; i >= 0; i--) { + token = inlineTokens[i]; + + if (token.type === "text" && !inside_autolink) { + token.content = token.content.replace( + SCOPED_ABBR_RE, + replaceFn, + ); + } + + if (token.type === "link_open" && token.info === "auto") { + inside_autolink--; + } + + if (token.type === "link_close" && token.info === "auto") { + inside_autolink++; + } + } + } + + function replace_rare(inlineTokens) { + var i, + token, + inside_autolink = 0; + + for (i = inlineTokens.length - 1; i >= 0; i--) { + token = inlineTokens[i]; + + if (token.type === "text" && !inside_autolink) { + if (RARE_RE.test(token.content)) { + token.content = token.content + .replace(/\+-/g, "±") + // .., ..., ....... -> … + // but ?..... & !..... -> ?.. & !.. + .replace(/\.{2,}/g, "…") + .replace(/([?!])…/g, "$1..") + .replace(/([?!]){4,}/g, "$1$1$1") + .replace(/,{2,}/g, ",") + // em-dash + .replace(/(^|[^-])---([^-]|$)/gm, "$1\u2014$2") + // en-dash + .replace(/(^|\s)--(\s|$)/gm, "$1\u2013$2") + .replace(/(^|[^-\s])--([^-\s]|$)/gm, "$1\u2013$2"); + } + } + + if (token.type === "link_open" && token.info === "auto") { + inside_autolink--; + } + + if (token.type === "link_close" && token.info === "auto") { + inside_autolink++; + } + } + } + + module.exports = function replace(state) { + var blkIdx; + + if (!state.md.options.typographer) { + return; + } + + for (blkIdx = state.tokens.length - 1; blkIdx >= 0; blkIdx--) { + if (state.tokens[blkIdx].type !== "inline") { + continue; + } + + if (SCOPED_ABBR_TEST_RE.test(state.tokens[blkIdx].content)) { + replace_scoped(state.tokens[blkIdx].children); + } + + if (RARE_RE.test(state.tokens[blkIdx].content)) { + replace_rare(state.tokens[blkIdx].children); + } + } + }; + }, + {}, + ], + 35: [ + function (require, module, exports) { + // Convert straight quotation marks to typographic ones + // + "use strict"; + + var isWhiteSpace = require("../common/utils").isWhiteSpace; + var isPunctChar = require("../common/utils").isPunctChar; + var isMdAsciiPunct = require("../common/utils").isMdAsciiPunct; + + var QUOTE_TEST_RE = /['"]/; + var QUOTE_RE = /['"]/g; + var APOSTROPHE = "\u2019"; /* ’ */ + + function replaceAt(str, index, ch) { + return str.substr(0, index) + ch + str.substr(index + 1); + } + + function process_inlines(tokens, state) { + var i, + token, + text, + t, + pos, + max, + thisLevel, + item, + lastChar, + nextChar, + isLastPunctChar, + isNextPunctChar, + isLastWhiteSpace, + isNextWhiteSpace, + canOpen, + canClose, + j, + isSingle, + stack, + openQuote, + closeQuote; + + stack = []; + + for (i = 0; i < tokens.length; i++) { + token = tokens[i]; + + thisLevel = tokens[i].level; + + for (j = stack.length - 1; j >= 0; j--) { + if (stack[j].level <= thisLevel) { + break; + } + } + stack.length = j + 1; + + if (token.type !== "text") { + continue; + } + + text = token.content; + pos = 0; + max = text.length; + + /*eslint no-labels:0,block-scoped-var:0*/ + OUTER: while (pos < max) { + QUOTE_RE.lastIndex = pos; + t = QUOTE_RE.exec(text); + if (!t) { + break; + } + + canOpen = canClose = true; + pos = t.index + 1; + isSingle = t[0] === "'"; + + // Find previous character, + // default to space if it's the beginning of the line + // + lastChar = 0x20; + + if (t.index - 1 >= 0) { + lastChar = text.charCodeAt(t.index - 1); + } else { + for (j = i - 1; j >= 0; j--) { + if ( + tokens[j].type === "softbreak" || + tokens[j].type === "hardbreak" + ) + break; // lastChar defaults to 0x20 + if (tokens[j].type !== "text") continue; + + lastChar = tokens[j].content.charCodeAt( + tokens[j].content.length - 1, + ); + break; + } + } + + // Find next character, + // default to space if it's the end of the line + // + nextChar = 0x20; + + if (pos < max) { + nextChar = text.charCodeAt(pos); + } else { + for (j = i + 1; j < tokens.length; j++) { + if ( + tokens[j].type === "softbreak" || + tokens[j].type === "hardbreak" + ) + break; // nextChar defaults to 0x20 + if (tokens[j].type !== "text") continue; + + nextChar = tokens[j].content.charCodeAt(0); + break; + } + } + + isLastPunctChar = + isMdAsciiPunct(lastChar) || + isPunctChar(String.fromCharCode(lastChar)); + isNextPunctChar = + isMdAsciiPunct(nextChar) || + isPunctChar(String.fromCharCode(nextChar)); + + isLastWhiteSpace = isWhiteSpace(lastChar); + isNextWhiteSpace = isWhiteSpace(nextChar); + + if (isNextWhiteSpace) { + canOpen = false; + } else if (isNextPunctChar) { + if (!(isLastWhiteSpace || isLastPunctChar)) { + canOpen = false; + } + } + + if (isLastWhiteSpace) { + canClose = false; + } else if (isLastPunctChar) { + if (!(isNextWhiteSpace || isNextPunctChar)) { + canClose = false; + } + } + + if (nextChar === 0x22 /* " */ && t[0] === '"') { + if (lastChar >= 0x30 /* 0 */ && lastChar <= 0x39 /* 9 */) { + // special case: 1"" - count first quote as an inch + canClose = canOpen = false; + } + } + + if (canOpen && canClose) { + // treat this as the middle of the word + canOpen = false; + canClose = isNextPunctChar; + } + + if (!canOpen && !canClose) { + // middle of word + if (isSingle) { + token.content = replaceAt( + token.content, + t.index, + APOSTROPHE, + ); + } + continue; + } + + if (canClose) { + // this could be a closing quote, rewind the stack to get a match + for (j = stack.length - 1; j >= 0; j--) { + item = stack[j]; + if (stack[j].level < thisLevel) { + break; + } + if ( + item.single === isSingle && + stack[j].level === thisLevel + ) { + item = stack[j]; + + if (isSingle) { + openQuote = state.md.options.quotes[2]; + closeQuote = state.md.options.quotes[3]; + } else { + openQuote = state.md.options.quotes[0]; + closeQuote = state.md.options.quotes[1]; + } + + // replace token.content *before* tokens[item.token].content, + // because, if they are pointing at the same token, replaceAt + // could mess up indices when quote length != 1 + token.content = replaceAt( + token.content, + t.index, + closeQuote, + ); + tokens[item.token].content = replaceAt( + tokens[item.token].content, + item.pos, + openQuote, + ); + + pos += closeQuote.length - 1; + if (item.token === i) { + pos += openQuote.length - 1; + } + + text = token.content; + max = text.length; + + stack.length = j; + continue OUTER; + } + } + } + + if (canOpen) { + stack.push({ + token: i, + pos: t.index, + single: isSingle, + level: thisLevel, + }); + } else if (canClose && isSingle) { + token.content = replaceAt(token.content, t.index, APOSTROPHE); + } + } + } + } + + module.exports = function smartquotes(state) { + /*eslint max-depth:0*/ + var blkIdx; + + if (!state.md.options.typographer) { + return; + } + + for (blkIdx = state.tokens.length - 1; blkIdx >= 0; blkIdx--) { + if ( + state.tokens[blkIdx].type !== "inline" || + !QUOTE_TEST_RE.test(state.tokens[blkIdx].content) + ) { + continue; + } + + process_inlines(state.tokens[blkIdx].children, state); + } + }; + }, + { "../common/utils": 4 }, + ], + 36: [ + function (require, module, exports) { + // Core state object + // + "use strict"; + + var Token = require("../token"); + + function StateCore(src, md, env) { + this.src = src; + this.env = env; + this.tokens = []; + this.inlineMode = false; + this.md = md; // link to parser instance + } + + // re-export Token class to use in core rules + StateCore.prototype.Token = Token; + + module.exports = StateCore; + }, + { "../token": 51 }, + ], + 37: [ + function (require, module, exports) { + // Process autolinks '' + + "use strict"; + + /*eslint max-len:0*/ + var EMAIL_RE = + /^<([a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*)>/; + var AUTOLINK_RE = + /^<([a-zA-Z][a-zA-Z0-9+.\-]{1,31}):([^<>\x00-\x20]*)>/; + + module.exports = function autolink(state, silent) { + var tail, + linkMatch, + emailMatch, + url, + fullUrl, + token, + pos = state.pos; + + if (state.src.charCodeAt(pos) !== 0x3c /* < */) { + return false; + } + + tail = state.src.slice(pos); + + if (tail.indexOf(">") < 0) { + return false; + } + + if (AUTOLINK_RE.test(tail)) { + linkMatch = tail.match(AUTOLINK_RE); + + url = linkMatch[0].slice(1, -1); + fullUrl = state.md.normalizeLink(url); + if (!state.md.validateLink(fullUrl)) { + return false; + } + + if (!silent) { + token = state.push("link_open", "a", 1); + token.attrs = [["href", fullUrl]]; + token.markup = "autolink"; + token.info = "auto"; + + token = state.push("text", "", 0); + token.content = state.md.normalizeLinkText(url); + + token = state.push("link_close", "a", -1); + token.markup = "autolink"; + token.info = "auto"; + } + + state.pos += linkMatch[0].length; + return true; + } + + if (EMAIL_RE.test(tail)) { + emailMatch = tail.match(EMAIL_RE); + + url = emailMatch[0].slice(1, -1); + fullUrl = state.md.normalizeLink("mailto:" + url); + if (!state.md.validateLink(fullUrl)) { + return false; + } + + if (!silent) { + token = state.push("link_open", "a", 1); + token.attrs = [["href", fullUrl]]; + token.markup = "autolink"; + token.info = "auto"; + + token = state.push("text", "", 0); + token.content = state.md.normalizeLinkText(url); + + token = state.push("link_close", "a", -1); + token.markup = "autolink"; + token.info = "auto"; + } + + state.pos += emailMatch[0].length; + return true; + } + + return false; + }; + }, + {}, + ], + 38: [ + function (require, module, exports) { + // Parse backticks + + "use strict"; + + module.exports = function backtick(state, silent) { + var start, + max, + marker, + matchStart, + matchEnd, + token, + pos = state.pos, + ch = state.src.charCodeAt(pos); + + if (ch !== 0x60 /* ` */) { + return false; + } + + start = pos; + pos++; + max = state.posMax; + + while (pos < max && state.src.charCodeAt(pos) === 0x60 /* ` */) { + pos++; + } + + marker = state.src.slice(start, pos); + + matchStart = matchEnd = pos; + + while ((matchStart = state.src.indexOf("`", matchEnd)) !== -1) { + matchEnd = matchStart + 1; + + while ( + matchEnd < max && + state.src.charCodeAt(matchEnd) === 0x60 /* ` */ + ) { + matchEnd++; + } + + if (matchEnd - matchStart === marker.length) { + if (!silent) { + token = state.push("code_inline", "code", 0); + token.markup = marker; + token.content = state.src + .slice(pos, matchStart) + .replace(/[ \n]+/g, " ") + .trim(); + } + state.pos = matchEnd; + return true; + } + } + + if (!silent) { + state.pending += marker; + } + state.pos += marker.length; + return true; + }; + }, + {}, + ], + 39: [ + function (require, module, exports) { + // For each opening emphasis-like marker find a matching closing one + // + "use strict"; + + module.exports = function link_pairs(state) { + var i, + j, + lastDelim, + currDelim, + delimiters = state.delimiters, + max = state.delimiters.length; + + for (i = 0; i < max; i++) { + lastDelim = delimiters[i]; + + if (!lastDelim.close) { + continue; + } + + j = i - lastDelim.jump - 1; + + while (j >= 0) { + currDelim = delimiters[j]; + + if ( + currDelim.open && + currDelim.marker === lastDelim.marker && + currDelim.end < 0 && + currDelim.level === lastDelim.level + ) { + // typeofs are for backward compatibility with plugins + var odd_match = + (currDelim.close || lastDelim.open) && + typeof currDelim.length !== "undefined" && + typeof lastDelim.length !== "undefined" && + (currDelim.length + lastDelim.length) % 3 === 0; + + if (!odd_match) { + lastDelim.jump = i - j; + lastDelim.open = false; + currDelim.end = i; + currDelim.jump = 0; + break; + } + } + + j -= currDelim.jump + 1; + } + } + }; + }, + {}, + ], + 40: [ + function (require, module, exports) { + // Process *this* and _that_ + // + "use strict"; + + // Insert each marker as a separate text token, and add it to delimiter list + // + module.exports.tokenize = function emphasis(state, silent) { + var i, + scanned, + token, + start = state.pos, + marker = state.src.charCodeAt(start); + + if (silent) { + return false; + } + + if (marker !== 0x5f /* _ */ && marker !== 0x2a /* * */) { + return false; + } + + scanned = state.scanDelims(state.pos, marker === 0x2a); + + for (i = 0; i < scanned.length; i++) { + token = state.push("text", "", 0); + token.content = String.fromCharCode(marker); + + state.delimiters.push({ + // Char code of the starting marker (number). + // + marker: marker, + + // Total length of these series of delimiters. + // + length: scanned.length, + + // An amount of characters before this one that's equivalent to + // current one. In plain English: if this delimiter does not open + // an emphasis, neither do previous `jump` characters. + // + // Used to skip sequences like "*****" in one step, for 1st asterisk + // value will be 0, for 2nd it's 1 and so on. + // + jump: i, + + // A position of the token this delimiter corresponds to. + // + token: state.tokens.length - 1, + + // Token level. + // + level: state.level, + + // If this delimiter is matched as a valid opener, `end` will be + // equal to its position, otherwise it's `-1`. + // + end: -1, + + // Boolean flags that determine if this delimiter could open or close + // an emphasis. + // + open: scanned.can_open, + close: scanned.can_close, + }); + } + + state.pos += scanned.length; + + return true; + }; + + // Walk through delimiter list and replace text tokens with tags + // + module.exports.postProcess = function emphasis(state) { + var i, + startDelim, + endDelim, + token, + ch, + isStrong, + delimiters = state.delimiters, + max = state.delimiters.length; + + for (i = max - 1; i >= 0; i--) { + startDelim = delimiters[i]; + + if ( + startDelim.marker !== 0x5f /* _ */ && + startDelim.marker !== 0x2a /* * */ + ) { + continue; + } + + // Process only opening markers + if (startDelim.end === -1) { + continue; + } + + endDelim = delimiters[startDelim.end]; + + // If the previous delimiter has the same marker and is adjacent to this one, + // merge those into one strong delimiter. + // + // `whatever` -> `whatever` + // + isStrong = + i > 0 && + delimiters[i - 1].end === startDelim.end + 1 && + delimiters[i - 1].token === startDelim.token - 1 && + delimiters[startDelim.end + 1].token === endDelim.token + 1 && + delimiters[i - 1].marker === startDelim.marker; + + ch = String.fromCharCode(startDelim.marker); + + token = state.tokens[startDelim.token]; + token.type = isStrong ? "strong_open" : "em_open"; + token.tag = isStrong ? "strong" : "em"; + token.nesting = 1; + token.markup = isStrong ? ch + ch : ch; + token.content = ""; + + token = state.tokens[endDelim.token]; + token.type = isStrong ? "strong_close" : "em_close"; + token.tag = isStrong ? "strong" : "em"; + token.nesting = -1; + token.markup = isStrong ? ch + ch : ch; + token.content = ""; + + if (isStrong) { + state.tokens[delimiters[i - 1].token].content = ""; + state.tokens[delimiters[startDelim.end + 1].token].content = ""; + i--; + } + } + }; + }, + {}, + ], + 41: [ + function (require, module, exports) { + // Process html entity - {, ¯, ", ... + + "use strict"; + + var entities = require("../common/entities"); + var has = require("../common/utils").has; + var isValidEntityCode = require("../common/utils").isValidEntityCode; + var fromCodePoint = require("../common/utils").fromCodePoint; + + var DIGITAL_RE = /^&#((?:x[a-f0-9]{1,8}|[0-9]{1,8}));/i; + var NAMED_RE = /^&([a-z][a-z0-9]{1,31});/i; + + module.exports = function entity(state, silent) { + var ch, + code, + match, + pos = state.pos, + max = state.posMax; + + if (state.src.charCodeAt(pos) !== 0x26 /* & */) { + return false; + } + + if (pos + 1 < max) { + ch = state.src.charCodeAt(pos + 1); + + if (ch === 0x23 /* # */) { + match = state.src.slice(pos).match(DIGITAL_RE); + if (match) { + if (!silent) { + code = + match[1][0].toLowerCase() === "x" + ? parseInt(match[1].slice(1), 16) + : parseInt(match[1], 10); + state.pending += isValidEntityCode(code) + ? fromCodePoint(code) + : fromCodePoint(0xfffd); + } + state.pos += match[0].length; + return true; + } + } else { + match = state.src.slice(pos).match(NAMED_RE); + if (match) { + if (has(entities, match[1])) { + if (!silent) { + state.pending += entities[match[1]]; + } + state.pos += match[0].length; + return true; + } + } + } + } + + if (!silent) { + state.pending += "&"; + } + state.pos++; + return true; + }; + }, + { "../common/entities": 1, "../common/utils": 4 }, + ], + 42: [ + function (require, module, exports) { + // Process escaped chars and hardbreaks + + "use strict"; + + var isSpace = require("../common/utils").isSpace; + + var ESCAPED = []; + + for (var i = 0; i < 256; i++) { + ESCAPED.push(0); + } + + "\\!\"#$%&'()*+,./:;<=>?@[]^_`{|}~-".split("").forEach(function (ch) { + ESCAPED[ch.charCodeAt(0)] = 1; + }); + + module.exports = function escape(state, silent) { + var ch, + pos = state.pos, + max = state.posMax; + + if (state.src.charCodeAt(pos) !== 0x5c /* \ */) { + return false; + } + + pos++; + + if (pos < max) { + ch = state.src.charCodeAt(pos); + + if (ch < 256 && ESCAPED[ch] !== 0) { + if (!silent) { + state.pending += state.src[pos]; + } + state.pos += 2; + return true; + } + + if (ch === 0x0a) { + if (!silent) { + state.push("hardbreak", "br", 0); + } + + pos++; + // skip leading whitespaces from next line + while (pos < max) { + ch = state.src.charCodeAt(pos); + if (!isSpace(ch)) { + break; + } + pos++; + } + + state.pos = pos; + return true; + } + } + + if (!silent) { + state.pending += "\\"; + } + state.pos++; + return true; + }; + }, + { "../common/utils": 4 }, + ], + 43: [ + function (require, module, exports) { + // Process html tags + + "use strict"; + + var HTML_TAG_RE = require("../common/html_re").HTML_TAG_RE; + + function isLetter(ch) { + /*eslint no-bitwise:0*/ + var lc = ch | 0x20; // to lower case + return lc >= 0x61 /* a */ && lc <= 0x7a /* z */; + } + + module.exports = function html_inline(state, silent) { + var ch, + match, + max, + token, + pos = state.pos; + + if (!state.md.options.html) { + return false; + } + + // Check start + max = state.posMax; + if (state.src.charCodeAt(pos) !== 0x3c /* < */ || pos + 2 >= max) { + return false; + } + + // Quick fail on second char + ch = state.src.charCodeAt(pos + 1); + if ( + ch !== 0x21 /* ! */ && + ch !== 0x3f /* ? */ && + ch !== 0x2f /* / */ && + !isLetter(ch) + ) { + return false; + } + + match = state.src.slice(pos).match(HTML_TAG_RE); + if (!match) { + return false; + } + + if (!silent) { + token = state.push("html_inline", "", 0); + token.content = state.src.slice(pos, pos + match[0].length); + } + state.pos += match[0].length; + return true; + }; + }, + { "../common/html_re": 3 }, + ], + 44: [ + function (require, module, exports) { + // Process ![image]( "title") + + "use strict"; + + var normalizeReference = + require("../common/utils").normalizeReference; + var isSpace = require("../common/utils").isSpace; + + module.exports = function image(state, silent) { + var attrs, + code, + content, + label, + labelEnd, + labelStart, + pos, + ref, + res, + title, + token, + tokens, + start, + href = "", + oldPos = state.pos, + max = state.posMax; + + if (state.src.charCodeAt(state.pos) !== 0x21 /* ! */) { + return false; + } + if (state.src.charCodeAt(state.pos + 1) !== 0x5b /* [ */) { + return false; + } + + labelStart = state.pos + 2; + labelEnd = state.md.helpers.parseLinkLabel( + state, + state.pos + 1, + false, + ); + + // parser failed to find ']', so it's not a valid link + if (labelEnd < 0) { + return false; + } + + pos = labelEnd + 1; + if (pos < max && state.src.charCodeAt(pos) === 0x28 /* ( */) { + // + // Inline link + // + + // [link]( "title" ) + // ^^ skipping these spaces + pos++; + for (; pos < max; pos++) { + code = state.src.charCodeAt(pos); + if (!isSpace(code) && code !== 0x0a) { + break; + } + } + if (pos >= max) { + return false; + } + + // [link]( "title" ) + // ^^^^^^ parsing link destination + start = pos; + res = state.md.helpers.parseLinkDestination( + state.src, + pos, + state.posMax, + ); + if (res.ok) { + href = state.md.normalizeLink(res.str); + if (state.md.validateLink(href)) { + pos = res.pos; + } else { + href = ""; + } + } + + // [link]( "title" ) + // ^^ skipping these spaces + start = pos; + for (; pos < max; pos++) { + code = state.src.charCodeAt(pos); + if (!isSpace(code) && code !== 0x0a) { + break; + } + } + + // [link]( "title" ) + // ^^^^^^^ parsing link title + res = state.md.helpers.parseLinkTitle( + state.src, + pos, + state.posMax, + ); + if (pos < max && start !== pos && res.ok) { + title = res.str; + pos = res.pos; + + // [link]( "title" ) + // ^^ skipping these spaces + for (; pos < max; pos++) { + code = state.src.charCodeAt(pos); + if (!isSpace(code) && code !== 0x0a) { + break; + } + } + } else { + title = ""; + } + + if (pos >= max || state.src.charCodeAt(pos) !== 0x29 /* ) */) { + state.pos = oldPos; + return false; + } + pos++; + } else { + // + // Link reference + // + if (typeof state.env.references === "undefined") { + return false; + } + + if (pos < max && state.src.charCodeAt(pos) === 0x5b /* [ */) { + start = pos + 1; + pos = state.md.helpers.parseLinkLabel(state, pos); + if (pos >= 0) { + label = state.src.slice(start, pos++); + } else { + pos = labelEnd + 1; + } + } else { + pos = labelEnd + 1; + } + + // covers label === '' and label === undefined + // (collapsed reference link and shortcut reference link respectively) + if (!label) { + label = state.src.slice(labelStart, labelEnd); + } + + ref = state.env.references[normalizeReference(label)]; + if (!ref) { + state.pos = oldPos; + return false; + } + href = ref.href; + title = ref.title; + } + + // + // We found the end of the link, and know for a fact it's a valid link; + // so all that's left to do is to call tokenizer. + // + if (!silent) { + content = state.src.slice(labelStart, labelEnd); + + state.md.inline.parse( + content, + state.md, + state.env, + (tokens = []), + ); + + token = state.push("image", "img", 0); + token.attrs = attrs = [ + ["src", href], + ["alt", ""], + ]; + token.children = tokens; + token.content = content; + + if (title) { + attrs.push(["title", title]); + } + } + + state.pos = pos; + state.posMax = max; + return true; + }; + }, + { "../common/utils": 4 }, + ], + 45: [ + function (require, module, exports) { + // Process [link]( "stuff") + + "use strict"; + + var normalizeReference = + require("../common/utils").normalizeReference; + var isSpace = require("../common/utils").isSpace; + + module.exports = function link(state, silent) { + var attrs, + code, + label, + labelEnd, + labelStart, + pos, + res, + ref, + title, + token, + href = "", + oldPos = state.pos, + max = state.posMax, + start = state.pos, + parseReference = true; + + if (state.src.charCodeAt(state.pos) !== 0x5b /* [ */) { + return false; + } + + labelStart = state.pos + 1; + labelEnd = state.md.helpers.parseLinkLabel(state, state.pos, true); + + // parser failed to find ']', so it's not a valid link + if (labelEnd < 0) { + return false; + } + + pos = labelEnd + 1; + if (pos < max && state.src.charCodeAt(pos) === 0x28 /* ( */) { + // + // Inline link + // + + // might have found a valid shortcut link, disable reference parsing + parseReference = false; + + // [link]( "title" ) + // ^^ skipping these spaces + pos++; + for (; pos < max; pos++) { + code = state.src.charCodeAt(pos); + if (!isSpace(code) && code !== 0x0a) { + break; + } + } + if (pos >= max) { + return false; + } + + // [link]( "title" ) + // ^^^^^^ parsing link destination + start = pos; + res = state.md.helpers.parseLinkDestination( + state.src, + pos, + state.posMax, + ); + if (res.ok) { + href = state.md.normalizeLink(res.str); + if (state.md.validateLink(href)) { + pos = res.pos; + } else { + href = ""; + } + } + + // [link]( "title" ) + // ^^ skipping these spaces + start = pos; + for (; pos < max; pos++) { + code = state.src.charCodeAt(pos); + if (!isSpace(code) && code !== 0x0a) { + break; + } + } + + // [link]( "title" ) + // ^^^^^^^ parsing link title + res = state.md.helpers.parseLinkTitle( + state.src, + pos, + state.posMax, + ); + if (pos < max && start !== pos && res.ok) { + title = res.str; + pos = res.pos; + + // [link]( "title" ) + // ^^ skipping these spaces + for (; pos < max; pos++) { + code = state.src.charCodeAt(pos); + if (!isSpace(code) && code !== 0x0a) { + break; + } + } + } else { + title = ""; + } + + if (pos >= max || state.src.charCodeAt(pos) !== 0x29 /* ) */) { + // parsing a valid shortcut link failed, fallback to reference + parseReference = true; + } + pos++; + } + + if (parseReference) { + // + // Link reference + // + if (typeof state.env.references === "undefined") { + return false; + } + + if (pos < max && state.src.charCodeAt(pos) === 0x5b /* [ */) { + start = pos + 1; + pos = state.md.helpers.parseLinkLabel(state, pos); + if (pos >= 0) { + label = state.src.slice(start, pos++); + } else { + pos = labelEnd + 1; + } + } else { + pos = labelEnd + 1; + } + + // covers label === '' and label === undefined + // (collapsed reference link and shortcut reference link respectively) + if (!label) { + label = state.src.slice(labelStart, labelEnd); + } + + ref = state.env.references[normalizeReference(label)]; + if (!ref) { + state.pos = oldPos; + return false; + } + href = ref.href; + title = ref.title; + } + + // + // We found the end of the link, and know for a fact it's a valid link; + // so all that's left to do is to call tokenizer. + // + if (!silent) { + state.pos = labelStart; + state.posMax = labelEnd; + + token = state.push("link_open", "a", 1); + token.attrs = attrs = [["href", href]]; + if (title) { + attrs.push(["title", title]); + } + + state.md.inline.tokenize(state); + + token = state.push("link_close", "a", -1); + } + + state.pos = pos; + state.posMax = max; + return true; + }; + }, + { "../common/utils": 4 }, + ], + 46: [ + function (require, module, exports) { + // Proceess '\n' + + "use strict"; + + var isSpace = require("../common/utils").isSpace; + + module.exports = function newline(state, silent) { + var pmax, + max, + pos = state.pos; + + if (state.src.charCodeAt(pos) !== 0x0a /* \n */) { + return false; + } + + pmax = state.pending.length - 1; + max = state.posMax; + + // ' \n' -> hardbreak + // Lookup in pending chars is bad practice! Don't copy to other rules! + // Pending string is stored in concat mode, indexed lookups will cause + // convertion to flat mode. + if (!silent) { + if (pmax >= 0 && state.pending.charCodeAt(pmax) === 0x20) { + if (pmax >= 1 && state.pending.charCodeAt(pmax - 1) === 0x20) { + state.pending = state.pending.replace(/ +$/, ""); + state.push("hardbreak", "br", 0); + } else { + state.pending = state.pending.slice(0, -1); + state.push("softbreak", "br", 0); + } + } else { + state.push("softbreak", "br", 0); + } + } + + pos++; + + // skip heading spaces for next line + while (pos < max && isSpace(state.src.charCodeAt(pos))) { + pos++; + } + + state.pos = pos; + return true; + }; + }, + { "../common/utils": 4 }, + ], + 47: [ + function (require, module, exports) { + // Inline parser state + + "use strict"; + + var Token = require("../token"); + var isWhiteSpace = require("../common/utils").isWhiteSpace; + var isPunctChar = require("../common/utils").isPunctChar; + var isMdAsciiPunct = require("../common/utils").isMdAsciiPunct; + + function StateInline(src, md, env, outTokens) { + this.src = src; + this.env = env; + this.md = md; + this.tokens = outTokens; + + this.pos = 0; + this.posMax = this.src.length; + this.level = 0; + this.pending = ""; + this.pendingLevel = 0; + + this.cache = {}; // Stores { start: end } pairs. Useful for backtrack + // optimization of pairs parse (emphasis, strikes). + + this.delimiters = []; // Emphasis-like delimiters + } + + // Flush pending text + // + StateInline.prototype.pushPending = function () { + var token = new Token("text", "", 0); + token.content = this.pending; + token.level = this.pendingLevel; + this.tokens.push(token); + this.pending = ""; + return token; + }; + + // Push new token to "stream". + // If pending text exists - flush it as text token + // + StateInline.prototype.push = function (type, tag, nesting) { + if (this.pending) { + this.pushPending(); + } + + var token = new Token(type, tag, nesting); + + if (nesting < 0) { + this.level--; + } + token.level = this.level; + if (nesting > 0) { + this.level++; + } + + this.pendingLevel = this.level; + this.tokens.push(token); + return token; + }; + + // Scan a sequence of emphasis-like markers, and determine whether + // it can start an emphasis sequence or end an emphasis sequence. + // + // - start - position to scan from (it should point at a valid marker); + // - canSplitWord - determine if these markers can be found inside a word + // + StateInline.prototype.scanDelims = function (start, canSplitWord) { + var pos = start, + lastChar, + nextChar, + count, + can_open, + can_close, + isLastWhiteSpace, + isLastPunctChar, + isNextWhiteSpace, + isNextPunctChar, + left_flanking = true, + right_flanking = true, + max = this.posMax, + marker = this.src.charCodeAt(start); + + // treat beginning of the line as a whitespace + lastChar = start > 0 ? this.src.charCodeAt(start - 1) : 0x20; + + while (pos < max && this.src.charCodeAt(pos) === marker) { + pos++; + } + + count = pos - start; + + // treat end of the line as a whitespace + nextChar = pos < max ? this.src.charCodeAt(pos) : 0x20; + + isLastPunctChar = + isMdAsciiPunct(lastChar) || + isPunctChar(String.fromCharCode(lastChar)); + isNextPunctChar = + isMdAsciiPunct(nextChar) || + isPunctChar(String.fromCharCode(nextChar)); + + isLastWhiteSpace = isWhiteSpace(lastChar); + isNextWhiteSpace = isWhiteSpace(nextChar); + + if (isNextWhiteSpace) { + left_flanking = false; + } else if (isNextPunctChar) { + if (!(isLastWhiteSpace || isLastPunctChar)) { + left_flanking = false; + } + } + + if (isLastWhiteSpace) { + right_flanking = false; + } else if (isLastPunctChar) { + if (!(isNextWhiteSpace || isNextPunctChar)) { + right_flanking = false; + } + } + + if (!canSplitWord) { + can_open = left_flanking && (!right_flanking || isLastPunctChar); + can_close = right_flanking && (!left_flanking || isNextPunctChar); + } else { + can_open = left_flanking; + can_close = right_flanking; + } + + return { + can_open: can_open, + can_close: can_close, + length: count, + }; + }; + + // re-export Token class to use in block rules + StateInline.prototype.Token = Token; + + module.exports = StateInline; + }, + { "../common/utils": 4, "../token": 51 }, + ], + 48: [ + function (require, module, exports) { + // ~~strike through~~ + // + "use strict"; + + // Insert each marker as a separate text token, and add it to delimiter list + // + module.exports.tokenize = function strikethrough(state, silent) { + var i, + scanned, + token, + len, + ch, + start = state.pos, + marker = state.src.charCodeAt(start); + + if (silent) { + return false; + } + + if (marker !== 0x7e /* ~ */) { + return false; + } + + scanned = state.scanDelims(state.pos, true); + len = scanned.length; + ch = String.fromCharCode(marker); + + if (len < 2) { + return false; + } + + if (len % 2) { + token = state.push("text", "", 0); + token.content = ch; + len--; + } + + for (i = 0; i < len; i += 2) { + token = state.push("text", "", 0); + token.content = ch + ch; + + state.delimiters.push({ + marker: marker, + jump: i, + token: state.tokens.length - 1, + level: state.level, + end: -1, + open: scanned.can_open, + close: scanned.can_close, + }); + } + + state.pos += scanned.length; + + return true; + }; + + // Walk through delimiter list and replace text tokens with tags + // + module.exports.postProcess = function strikethrough(state) { + var i, + j, + startDelim, + endDelim, + token, + loneMarkers = [], + delimiters = state.delimiters, + max = state.delimiters.length; + + for (i = 0; i < max; i++) { + startDelim = delimiters[i]; + + if (startDelim.marker !== 0x7e /* ~ */) { + continue; + } + + if (startDelim.end === -1) { + continue; + } + + endDelim = delimiters[startDelim.end]; + + token = state.tokens[startDelim.token]; + token.type = "s_open"; + token.tag = "s"; + token.nesting = 1; + token.markup = "~~"; + token.content = ""; + + token = state.tokens[endDelim.token]; + token.type = "s_close"; + token.tag = "s"; + token.nesting = -1; + token.markup = "~~"; + token.content = ""; + + if ( + state.tokens[endDelim.token - 1].type === "text" && + state.tokens[endDelim.token - 1].content === "~" + ) { + loneMarkers.push(endDelim.token - 1); + } + } + + // If a marker sequence has an odd number of characters, it's splitted + // like this: `~~~~~` -> `~` + `~~` + `~~`, leaving one marker at the + // start of the sequence. + // + // So, we have to move all those markers after subsequent s_close tags. + // + while (loneMarkers.length) { + i = loneMarkers.pop(); + j = i + 1; + + while ( + j < state.tokens.length && + state.tokens[j].type === "s_close" + ) { + j++; + } + + j--; + + if (i !== j) { + token = state.tokens[j]; + state.tokens[j] = state.tokens[i]; + state.tokens[i] = token; + } + } + }; + }, + {}, + ], + 49: [ + function (require, module, exports) { + // Skip text characters for text token, place those to pending buffer + // and increment current pos + + "use strict"; + + // Rule to skip pure text + // '{}$%@~+=:' reserved for extentions + + // !, ", #, $, %, &, ', (, ), *, +, ,, -, ., /, :, ;, <, =, >, ?, @, [, \, ], ^, _, `, {, |, }, or ~ + + // !!!! Don't confuse with "Markdown ASCII Punctuation" chars + // http://spec.commonmark.org/0.15/#ascii-punctuation-character + function isTerminatorChar(ch) { + switch (ch) { + case 0x0a /* \n */: + case 0x21 /* ! */: + case 0x23 /* # */: + case 0x24 /* $ */: + case 0x25 /* % */: + case 0x26 /* & */: + case 0x2a /* * */: + case 0x2b /* + */: + case 0x2d /* - */: + case 0x3a /* : */: + case 0x3c /* < */: + case 0x3d /* = */: + case 0x3e /* > */: + case 0x40 /* @ */: + case 0x5b /* [ */: + case 0x5c /* \ */: + case 0x5d /* ] */: + case 0x5e /* ^ */: + case 0x5f /* _ */: + case 0x60 /* ` */: + case 0x7b /* { */: + case 0x7d /* } */: + case 0x7e /* ~ */: + return true; + default: + return false; + } + } + + module.exports = function text(state, silent) { + var pos = state.pos; + + while ( + pos < state.posMax && + !isTerminatorChar(state.src.charCodeAt(pos)) + ) { + pos++; + } + + if (pos === state.pos) { + return false; + } + + if (!silent) { + state.pending += state.src.slice(state.pos, pos); + } + + state.pos = pos; + + return true; + }; + + // Alternative implementation, for memory. + // + // It costs 10% of performance, but allows extend terminators list, if place it + // to `ParcerInline` property. Probably, will switch to it sometime, such + // flexibility required. + + /* +var TERMINATOR_RE = /[\n!#$%&*+\-:<=>@[\\\]^_`{}~]/; + +module.exports = function text(state, silent) { + var pos = state.pos, + idx = state.src.slice(pos).search(TERMINATOR_RE); + + // first char is terminator -> empty text + if (idx === 0) { return false; } + + // no terminator -> text till end of string + if (idx < 0) { + if (!silent) { state.pending += state.src.slice(pos); } + state.pos = state.src.length; + return true; + } + + if (!silent) { state.pending += state.src.slice(pos, pos + idx); } + + state.pos += idx; + + return true; +};*/ + }, + {}, + ], + 50: [ + function (require, module, exports) { + // Merge adjacent text nodes into one, and re-calculate all token levels + // + "use strict"; + + module.exports = function text_collapse(state) { + var curr, + last, + level = 0, + tokens = state.tokens, + max = state.tokens.length; + + for (curr = last = 0; curr < max; curr++) { + // re-calculate levels + level += tokens[curr].nesting; + tokens[curr].level = level; + + if ( + tokens[curr].type === "text" && + curr + 1 < max && + tokens[curr + 1].type === "text" + ) { + // collapse two adjacent text nodes + tokens[curr + 1].content = + tokens[curr].content + tokens[curr + 1].content; + } else { + if (curr !== last) { + tokens[last] = tokens[curr]; + } + + last++; + } + } + + if (curr !== last) { + tokens.length = last; + } + }; + }, + {}, + ], + 51: [ + function (require, module, exports) { + // Token class + + "use strict"; + + /** + * class Token + **/ + + /** + * new Token(type, tag, nesting) + * + * Create new token and fill passed properties. + **/ + function Token(type, tag, nesting) { + /** + * Token#type -> String + * + * Type of the token (string, e.g. "paragraph_open") + **/ + this.type = type; + + /** + * Token#tag -> String + * + * html tag name, e.g. "p" + **/ + this.tag = tag; + + /** + * Token#attrs -> Array + * + * Html attributes. Format: `[ [ name1, value1 ], [ name2, value2 ] ]` + **/ + this.attrs = null; + + /** + * Token#map -> Array + * + * Source map info. Format: `[ line_begin, line_end ]` + **/ + this.map = null; + + /** + * Token#nesting -> Number + * + * Level change (number in {-1, 0, 1} set), where: + * + * - `1` means the tag is opening + * - `0` means the tag is self-closing + * - `-1` means the tag is closing + **/ + this.nesting = nesting; + + /** + * Token#level -> Number + * + * nesting level, the same as `state.level` + **/ + this.level = 0; + + /** + * Token#children -> Array + * + * An array of child nodes (inline and img tokens) + **/ + this.children = null; + + /** + * Token#content -> String + * + * In a case of self-closing tag (code, html, fence, etc.), + * it has contents of this tag. + **/ + this.content = ""; + + /** + * Token#markup -> String + * + * '*' or '_' for emphasis, fence string for fence, etc. + **/ + this.markup = ""; + + /** + * Token#info -> String + * + * fence infostring + **/ + this.info = ""; + + /** + * Token#meta -> Object + * + * A place for plugins to store an arbitrary data + **/ + this.meta = null; + + /** + * Token#block -> Boolean + * + * True for block-level tokens, false for inline tokens. + * Used in renderer to calculate line breaks + **/ + this.block = false; + + /** + * Token#hidden -> Boolean + * + * If it's true, ignore this element when rendering. Used for tight lists + * to hide paragraphs. + **/ + this.hidden = false; + } + + /** + * Token.attrIndex(name) -> Number + * + * Search attribute index by name. + **/ + Token.prototype.attrIndex = function attrIndex(name) { + var attrs, i, len; + + if (!this.attrs) { + return -1; + } + + attrs = this.attrs; + + for (i = 0, len = attrs.length; i < len; i++) { + if (attrs[i][0] === name) { + return i; + } + } + return -1; + }; + + /** + * Token.attrPush(attrData) + * + * Add `[ name, value ]` attribute to list. Init attrs if necessary + **/ + Token.prototype.attrPush = function attrPush(attrData) { + if (this.attrs) { + this.attrs.push(attrData); + } else { + this.attrs = [attrData]; + } + }; + + /** + * Token.attrSet(name, value) + * + * Set `name` attribute to `value`. Override old value if exists. + **/ + Token.prototype.attrSet = function attrSet(name, value) { + var idx = this.attrIndex(name), + attrData = [name, value]; + + if (idx < 0) { + this.attrPush(attrData); + } else { + this.attrs[idx] = attrData; + } + }; + + /** + * Token.attrGet(name) + * + * Get the value of attribute `name`, or null if it does not exist. + **/ + Token.prototype.attrGet = function attrGet(name) { + var idx = this.attrIndex(name), + value = null; + if (idx >= 0) { + value = this.attrs[idx][1]; + } + return value; + }; + + /** + * Token.attrJoin(name, value) + * + * Join value to existing attribute via space. Or create new attribute if not + * exists. Useful to operate with token classes. + **/ + Token.prototype.attrJoin = function attrJoin(name, value) { + var idx = this.attrIndex(name); + + if (idx < 0) { + this.attrPush([name, value]); + } else { + this.attrs[idx][1] = this.attrs[idx][1] + " " + value; + } + }; + + module.exports = Token; + }, + {}, + ], + 52: [ + function (require, module, exports) { + module.exports = { + Aacute: "\u00C1", + aacute: "\u00E1", + Abreve: "\u0102", + abreve: "\u0103", + ac: "\u223E", + acd: "\u223F", + acE: "\u223E\u0333", + Acirc: "\u00C2", + acirc: "\u00E2", + acute: "\u00B4", + Acy: "\u0410", + acy: "\u0430", + AElig: "\u00C6", + aelig: "\u00E6", + af: "\u2061", + Afr: "\uD835\uDD04", + afr: "\uD835\uDD1E", + Agrave: "\u00C0", + agrave: "\u00E0", + alefsym: "\u2135", + aleph: "\u2135", + Alpha: "\u0391", + alpha: "\u03B1", + Amacr: "\u0100", + amacr: "\u0101", + amalg: "\u2A3F", + amp: "&", + AMP: "&", + andand: "\u2A55", + And: "\u2A53", + and: "\u2227", + andd: "\u2A5C", + andslope: "\u2A58", + andv: "\u2A5A", + ang: "\u2220", + ange: "\u29A4", + angle: "\u2220", + angmsdaa: "\u29A8", + angmsdab: "\u29A9", + angmsdac: "\u29AA", + angmsdad: "\u29AB", + angmsdae: "\u29AC", + angmsdaf: "\u29AD", + angmsdag: "\u29AE", + angmsdah: "\u29AF", + angmsd: "\u2221", + angrt: "\u221F", + angrtvb: "\u22BE", + angrtvbd: "\u299D", + angsph: "\u2222", + angst: "\u00C5", + angzarr: "\u237C", + Aogon: "\u0104", + aogon: "\u0105", + Aopf: "\uD835\uDD38", + aopf: "\uD835\uDD52", + apacir: "\u2A6F", + ap: "\u2248", + apE: "\u2A70", + ape: "\u224A", + apid: "\u224B", + apos: "'", + ApplyFunction: "\u2061", + approx: "\u2248", + approxeq: "\u224A", + Aring: "\u00C5", + aring: "\u00E5", + Ascr: "\uD835\uDC9C", + ascr: "\uD835\uDCB6", + Assign: "\u2254", + ast: "*", + asymp: "\u2248", + asympeq: "\u224D", + Atilde: "\u00C3", + atilde: "\u00E3", + Auml: "\u00C4", + auml: "\u00E4", + awconint: "\u2233", + awint: "\u2A11", + backcong: "\u224C", + backepsilon: "\u03F6", + backprime: "\u2035", + backsim: "\u223D", + backsimeq: "\u22CD", + Backslash: "\u2216", + Barv: "\u2AE7", + barvee: "\u22BD", + barwed: "\u2305", + Barwed: "\u2306", + barwedge: "\u2305", + bbrk: "\u23B5", + bbrktbrk: "\u23B6", + bcong: "\u224C", + Bcy: "\u0411", + bcy: "\u0431", + bdquo: "\u201E", + becaus: "\u2235", + because: "\u2235", + Because: "\u2235", + bemptyv: "\u29B0", + bepsi: "\u03F6", + bernou: "\u212C", + Bernoullis: "\u212C", + Beta: "\u0392", + beta: "\u03B2", + beth: "\u2136", + between: "\u226C", + Bfr: "\uD835\uDD05", + bfr: "\uD835\uDD1F", + bigcap: "\u22C2", + bigcirc: "\u25EF", + bigcup: "\u22C3", + bigodot: "\u2A00", + bigoplus: "\u2A01", + bigotimes: "\u2A02", + bigsqcup: "\u2A06", + bigstar: "\u2605", + bigtriangledown: "\u25BD", + bigtriangleup: "\u25B3", + biguplus: "\u2A04", + bigvee: "\u22C1", + bigwedge: "\u22C0", + bkarow: "\u290D", + blacklozenge: "\u29EB", + blacksquare: "\u25AA", + blacktriangle: "\u25B4", + blacktriangledown: "\u25BE", + blacktriangleleft: "\u25C2", + blacktriangleright: "\u25B8", + blank: "\u2423", + blk12: "\u2592", + blk14: "\u2591", + blk34: "\u2593", + block: "\u2588", + bne: "=\u20E5", + bnequiv: "\u2261\u20E5", + bNot: "\u2AED", + bnot: "\u2310", + Bopf: "\uD835\uDD39", + bopf: "\uD835\uDD53", + bot: "\u22A5", + bottom: "\u22A5", + bowtie: "\u22C8", + boxbox: "\u29C9", + boxdl: "\u2510", + boxdL: "\u2555", + boxDl: "\u2556", + boxDL: "\u2557", + boxdr: "\u250C", + boxdR: "\u2552", + boxDr: "\u2553", + boxDR: "\u2554", + boxh: "\u2500", + boxH: "\u2550", + boxhd: "\u252C", + boxHd: "\u2564", + boxhD: "\u2565", + boxHD: "\u2566", + boxhu: "\u2534", + boxHu: "\u2567", + boxhU: "\u2568", + boxHU: "\u2569", + boxminus: "\u229F", + boxplus: "\u229E", + boxtimes: "\u22A0", + boxul: "\u2518", + boxuL: "\u255B", + boxUl: "\u255C", + boxUL: "\u255D", + boxur: "\u2514", + boxuR: "\u2558", + boxUr: "\u2559", + boxUR: "\u255A", + boxv: "\u2502", + boxV: "\u2551", + boxvh: "\u253C", + boxvH: "\u256A", + boxVh: "\u256B", + boxVH: "\u256C", + boxvl: "\u2524", + boxvL: "\u2561", + boxVl: "\u2562", + boxVL: "\u2563", + boxvr: "\u251C", + boxvR: "\u255E", + boxVr: "\u255F", + boxVR: "\u2560", + bprime: "\u2035", + breve: "\u02D8", + Breve: "\u02D8", + brvbar: "\u00A6", + bscr: "\uD835\uDCB7", + Bscr: "\u212C", + bsemi: "\u204F", + bsim: "\u223D", + bsime: "\u22CD", + bsolb: "\u29C5", + bsol: "\\", + bsolhsub: "\u27C8", + bull: "\u2022", + bullet: "\u2022", + bump: "\u224E", + bumpE: "\u2AAE", + bumpe: "\u224F", + Bumpeq: "\u224E", + bumpeq: "\u224F", + Cacute: "\u0106", + cacute: "\u0107", + capand: "\u2A44", + capbrcup: "\u2A49", + capcap: "\u2A4B", + cap: "\u2229", + Cap: "\u22D2", + capcup: "\u2A47", + capdot: "\u2A40", + CapitalDifferentialD: "\u2145", + caps: "\u2229\uFE00", + caret: "\u2041", + caron: "\u02C7", + Cayleys: "\u212D", + ccaps: "\u2A4D", + Ccaron: "\u010C", + ccaron: "\u010D", + Ccedil: "\u00C7", + ccedil: "\u00E7", + Ccirc: "\u0108", + ccirc: "\u0109", + Cconint: "\u2230", + ccups: "\u2A4C", + ccupssm: "\u2A50", + Cdot: "\u010A", + cdot: "\u010B", + cedil: "\u00B8", + Cedilla: "\u00B8", + cemptyv: "\u29B2", + cent: "\u00A2", + centerdot: "\u00B7", + CenterDot: "\u00B7", + cfr: "\uD835\uDD20", + Cfr: "\u212D", + CHcy: "\u0427", + chcy: "\u0447", + check: "\u2713", + checkmark: "\u2713", + Chi: "\u03A7", + chi: "\u03C7", + circ: "\u02C6", + circeq: "\u2257", + circlearrowleft: "\u21BA", + circlearrowright: "\u21BB", + circledast: "\u229B", + circledcirc: "\u229A", + circleddash: "\u229D", + CircleDot: "\u2299", + circledR: "\u00AE", + circledS: "\u24C8", + CircleMinus: "\u2296", + CirclePlus: "\u2295", + CircleTimes: "\u2297", + cir: "\u25CB", + cirE: "\u29C3", + cire: "\u2257", + cirfnint: "\u2A10", + cirmid: "\u2AEF", + cirscir: "\u29C2", + ClockwiseContourIntegral: "\u2232", + CloseCurlyDoubleQuote: "\u201D", + CloseCurlyQuote: "\u2019", + clubs: "\u2663", + clubsuit: "\u2663", + colon: ":", + Colon: "\u2237", + Colone: "\u2A74", + colone: "\u2254", + coloneq: "\u2254", + comma: ",", + commat: "@", + comp: "\u2201", + compfn: "\u2218", + complement: "\u2201", + complexes: "\u2102", + cong: "\u2245", + congdot: "\u2A6D", + Congruent: "\u2261", + conint: "\u222E", + Conint: "\u222F", + ContourIntegral: "\u222E", + copf: "\uD835\uDD54", + Copf: "\u2102", + coprod: "\u2210", + Coproduct: "\u2210", + copy: "\u00A9", + COPY: "\u00A9", + copysr: "\u2117", + CounterClockwiseContourIntegral: "\u2233", + crarr: "\u21B5", + cross: "\u2717", + Cross: "\u2A2F", + Cscr: "\uD835\uDC9E", + cscr: "\uD835\uDCB8", + csub: "\u2ACF", + csube: "\u2AD1", + csup: "\u2AD0", + csupe: "\u2AD2", + ctdot: "\u22EF", + cudarrl: "\u2938", + cudarrr: "\u2935", + cuepr: "\u22DE", + cuesc: "\u22DF", + cularr: "\u21B6", + cularrp: "\u293D", + cupbrcap: "\u2A48", + cupcap: "\u2A46", + CupCap: "\u224D", + cup: "\u222A", + Cup: "\u22D3", + cupcup: "\u2A4A", + cupdot: "\u228D", + cupor: "\u2A45", + cups: "\u222A\uFE00", + curarr: "\u21B7", + curarrm: "\u293C", + curlyeqprec: "\u22DE", + curlyeqsucc: "\u22DF", + curlyvee: "\u22CE", + curlywedge: "\u22CF", + curren: "\u00A4", + curvearrowleft: "\u21B6", + curvearrowright: "\u21B7", + cuvee: "\u22CE", + cuwed: "\u22CF", + cwconint: "\u2232", + cwint: "\u2231", + cylcty: "\u232D", + dagger: "\u2020", + Dagger: "\u2021", + daleth: "\u2138", + darr: "\u2193", + Darr: "\u21A1", + dArr: "\u21D3", + dash: "\u2010", + Dashv: "\u2AE4", + dashv: "\u22A3", + dbkarow: "\u290F", + dblac: "\u02DD", + Dcaron: "\u010E", + dcaron: "\u010F", + Dcy: "\u0414", + dcy: "\u0434", + ddagger: "\u2021", + ddarr: "\u21CA", + DD: "\u2145", + dd: "\u2146", + DDotrahd: "\u2911", + ddotseq: "\u2A77", + deg: "\u00B0", + Del: "\u2207", + Delta: "\u0394", + delta: "\u03B4", + demptyv: "\u29B1", + dfisht: "\u297F", + Dfr: "\uD835\uDD07", + dfr: "\uD835\uDD21", + dHar: "\u2965", + dharl: "\u21C3", + dharr: "\u21C2", + DiacriticalAcute: "\u00B4", + DiacriticalDot: "\u02D9", + DiacriticalDoubleAcute: "\u02DD", + DiacriticalGrave: "`", + DiacriticalTilde: "\u02DC", + diam: "\u22C4", + diamond: "\u22C4", + Diamond: "\u22C4", + diamondsuit: "\u2666", + diams: "\u2666", + die: "\u00A8", + DifferentialD: "\u2146", + digamma: "\u03DD", + disin: "\u22F2", + div: "\u00F7", + divide: "\u00F7", + divideontimes: "\u22C7", + divonx: "\u22C7", + DJcy: "\u0402", + djcy: "\u0452", + dlcorn: "\u231E", + dlcrop: "\u230D", + dollar: "$", + Dopf: "\uD835\uDD3B", + dopf: "\uD835\uDD55", + Dot: "\u00A8", + dot: "\u02D9", + DotDot: "\u20DC", + doteq: "\u2250", + doteqdot: "\u2251", + DotEqual: "\u2250", + dotminus: "\u2238", + dotplus: "\u2214", + dotsquare: "\u22A1", + doublebarwedge: "\u2306", + DoubleContourIntegral: "\u222F", + DoubleDot: "\u00A8", + DoubleDownArrow: "\u21D3", + DoubleLeftArrow: "\u21D0", + DoubleLeftRightArrow: "\u21D4", + DoubleLeftTee: "\u2AE4", + DoubleLongLeftArrow: "\u27F8", + DoubleLongLeftRightArrow: "\u27FA", + DoubleLongRightArrow: "\u27F9", + DoubleRightArrow: "\u21D2", + DoubleRightTee: "\u22A8", + DoubleUpArrow: "\u21D1", + DoubleUpDownArrow: "\u21D5", + DoubleVerticalBar: "\u2225", + DownArrowBar: "\u2913", + downarrow: "\u2193", + DownArrow: "\u2193", + Downarrow: "\u21D3", + DownArrowUpArrow: "\u21F5", + DownBreve: "\u0311", + downdownarrows: "\u21CA", + downharpoonleft: "\u21C3", + downharpoonright: "\u21C2", + DownLeftRightVector: "\u2950", + DownLeftTeeVector: "\u295E", + DownLeftVectorBar: "\u2956", + DownLeftVector: "\u21BD", + DownRightTeeVector: "\u295F", + DownRightVectorBar: "\u2957", + DownRightVector: "\u21C1", + DownTeeArrow: "\u21A7", + DownTee: "\u22A4", + drbkarow: "\u2910", + drcorn: "\u231F", + drcrop: "\u230C", + Dscr: "\uD835\uDC9F", + dscr: "\uD835\uDCB9", + DScy: "\u0405", + dscy: "\u0455", + dsol: "\u29F6", + Dstrok: "\u0110", + dstrok: "\u0111", + dtdot: "\u22F1", + dtri: "\u25BF", + dtrif: "\u25BE", + duarr: "\u21F5", + duhar: "\u296F", + dwangle: "\u29A6", + DZcy: "\u040F", + dzcy: "\u045F", + dzigrarr: "\u27FF", + Eacute: "\u00C9", + eacute: "\u00E9", + easter: "\u2A6E", + Ecaron: "\u011A", + ecaron: "\u011B", + Ecirc: "\u00CA", + ecirc: "\u00EA", + ecir: "\u2256", + ecolon: "\u2255", + Ecy: "\u042D", + ecy: "\u044D", + eDDot: "\u2A77", + Edot: "\u0116", + edot: "\u0117", + eDot: "\u2251", + ee: "\u2147", + efDot: "\u2252", + Efr: "\uD835\uDD08", + efr: "\uD835\uDD22", + eg: "\u2A9A", + Egrave: "\u00C8", + egrave: "\u00E8", + egs: "\u2A96", + egsdot: "\u2A98", + el: "\u2A99", + Element: "\u2208", + elinters: "\u23E7", + ell: "\u2113", + els: "\u2A95", + elsdot: "\u2A97", + Emacr: "\u0112", + emacr: "\u0113", + empty: "\u2205", + emptyset: "\u2205", + EmptySmallSquare: "\u25FB", + emptyv: "\u2205", + EmptyVerySmallSquare: "\u25AB", + emsp13: "\u2004", + emsp14: "\u2005", + emsp: "\u2003", + ENG: "\u014A", + eng: "\u014B", + ensp: "\u2002", + Eogon: "\u0118", + eogon: "\u0119", + Eopf: "\uD835\uDD3C", + eopf: "\uD835\uDD56", + epar: "\u22D5", + eparsl: "\u29E3", + eplus: "\u2A71", + epsi: "\u03B5", + Epsilon: "\u0395", + epsilon: "\u03B5", + epsiv: "\u03F5", + eqcirc: "\u2256", + eqcolon: "\u2255", + eqsim: "\u2242", + eqslantgtr: "\u2A96", + eqslantless: "\u2A95", + Equal: "\u2A75", + equals: "=", + EqualTilde: "\u2242", + equest: "\u225F", + Equilibrium: "\u21CC", + equiv: "\u2261", + equivDD: "\u2A78", + eqvparsl: "\u29E5", + erarr: "\u2971", + erDot: "\u2253", + escr: "\u212F", + Escr: "\u2130", + esdot: "\u2250", + Esim: "\u2A73", + esim: "\u2242", + Eta: "\u0397", + eta: "\u03B7", + ETH: "\u00D0", + eth: "\u00F0", + Euml: "\u00CB", + euml: "\u00EB", + euro: "\u20AC", + excl: "!", + exist: "\u2203", + Exists: "\u2203", + expectation: "\u2130", + exponentiale: "\u2147", + ExponentialE: "\u2147", + fallingdotseq: "\u2252", + Fcy: "\u0424", + fcy: "\u0444", + female: "\u2640", + ffilig: "\uFB03", + fflig: "\uFB00", + ffllig: "\uFB04", + Ffr: "\uD835\uDD09", + ffr: "\uD835\uDD23", + filig: "\uFB01", + FilledSmallSquare: "\u25FC", + FilledVerySmallSquare: "\u25AA", + fjlig: "fj", + flat: "\u266D", + fllig: "\uFB02", + fltns: "\u25B1", + fnof: "\u0192", + Fopf: "\uD835\uDD3D", + fopf: "\uD835\uDD57", + forall: "\u2200", + ForAll: "\u2200", + fork: "\u22D4", + forkv: "\u2AD9", + Fouriertrf: "\u2131", + fpartint: "\u2A0D", + frac12: "\u00BD", + frac13: "\u2153", + frac14: "\u00BC", + frac15: "\u2155", + frac16: "\u2159", + frac18: "\u215B", + frac23: "\u2154", + frac25: "\u2156", + frac34: "\u00BE", + frac35: "\u2157", + frac38: "\u215C", + frac45: "\u2158", + frac56: "\u215A", + frac58: "\u215D", + frac78: "\u215E", + frasl: "\u2044", + frown: "\u2322", + fscr: "\uD835\uDCBB", + Fscr: "\u2131", + gacute: "\u01F5", + Gamma: "\u0393", + gamma: "\u03B3", + Gammad: "\u03DC", + gammad: "\u03DD", + gap: "\u2A86", + Gbreve: "\u011E", + gbreve: "\u011F", + Gcedil: "\u0122", + Gcirc: "\u011C", + gcirc: "\u011D", + Gcy: "\u0413", + gcy: "\u0433", + Gdot: "\u0120", + gdot: "\u0121", + ge: "\u2265", + gE: "\u2267", + gEl: "\u2A8C", + gel: "\u22DB", + geq: "\u2265", + geqq: "\u2267", + geqslant: "\u2A7E", + gescc: "\u2AA9", + ges: "\u2A7E", + gesdot: "\u2A80", + gesdoto: "\u2A82", + gesdotol: "\u2A84", + gesl: "\u22DB\uFE00", + gesles: "\u2A94", + Gfr: "\uD835\uDD0A", + gfr: "\uD835\uDD24", + gg: "\u226B", + Gg: "\u22D9", + ggg: "\u22D9", + gimel: "\u2137", + GJcy: "\u0403", + gjcy: "\u0453", + gla: "\u2AA5", + gl: "\u2277", + glE: "\u2A92", + glj: "\u2AA4", + gnap: "\u2A8A", + gnapprox: "\u2A8A", + gne: "\u2A88", + gnE: "\u2269", + gneq: "\u2A88", + gneqq: "\u2269", + gnsim: "\u22E7", + Gopf: "\uD835\uDD3E", + gopf: "\uD835\uDD58", + grave: "`", + GreaterEqual: "\u2265", + GreaterEqualLess: "\u22DB", + GreaterFullEqual: "\u2267", + GreaterGreater: "\u2AA2", + GreaterLess: "\u2277", + GreaterSlantEqual: "\u2A7E", + GreaterTilde: "\u2273", + Gscr: "\uD835\uDCA2", + gscr: "\u210A", + gsim: "\u2273", + gsime: "\u2A8E", + gsiml: "\u2A90", + gtcc: "\u2AA7", + gtcir: "\u2A7A", + gt: ">", + GT: ">", + Gt: "\u226B", + gtdot: "\u22D7", + gtlPar: "\u2995", + gtquest: "\u2A7C", + gtrapprox: "\u2A86", + gtrarr: "\u2978", + gtrdot: "\u22D7", + gtreqless: "\u22DB", + gtreqqless: "\u2A8C", + gtrless: "\u2277", + gtrsim: "\u2273", + gvertneqq: "\u2269\uFE00", + gvnE: "\u2269\uFE00", + Hacek: "\u02C7", + hairsp: "\u200A", + half: "\u00BD", + hamilt: "\u210B", + HARDcy: "\u042A", + hardcy: "\u044A", + harrcir: "\u2948", + harr: "\u2194", + hArr: "\u21D4", + harrw: "\u21AD", + Hat: "^", + hbar: "\u210F", + Hcirc: "\u0124", + hcirc: "\u0125", + hearts: "\u2665", + heartsuit: "\u2665", + hellip: "\u2026", + hercon: "\u22B9", + hfr: "\uD835\uDD25", + Hfr: "\u210C", + HilbertSpace: "\u210B", + hksearow: "\u2925", + hkswarow: "\u2926", + hoarr: "\u21FF", + homtht: "\u223B", + hookleftarrow: "\u21A9", + hookrightarrow: "\u21AA", + hopf: "\uD835\uDD59", + Hopf: "\u210D", + horbar: "\u2015", + HorizontalLine: "\u2500", + hscr: "\uD835\uDCBD", + Hscr: "\u210B", + hslash: "\u210F", + Hstrok: "\u0126", + hstrok: "\u0127", + HumpDownHump: "\u224E", + HumpEqual: "\u224F", + hybull: "\u2043", + hyphen: "\u2010", + Iacute: "\u00CD", + iacute: "\u00ED", + ic: "\u2063", + Icirc: "\u00CE", + icirc: "\u00EE", + Icy: "\u0418", + icy: "\u0438", + Idot: "\u0130", + IEcy: "\u0415", + iecy: "\u0435", + iexcl: "\u00A1", + iff: "\u21D4", + ifr: "\uD835\uDD26", + Ifr: "\u2111", + Igrave: "\u00CC", + igrave: "\u00EC", + ii: "\u2148", + iiiint: "\u2A0C", + iiint: "\u222D", + iinfin: "\u29DC", + iiota: "\u2129", + IJlig: "\u0132", + ijlig: "\u0133", + Imacr: "\u012A", + imacr: "\u012B", + image: "\u2111", + ImaginaryI: "\u2148", + imagline: "\u2110", + imagpart: "\u2111", + imath: "\u0131", + Im: "\u2111", + imof: "\u22B7", + imped: "\u01B5", + Implies: "\u21D2", + incare: "\u2105", + in: "\u2208", + infin: "\u221E", + infintie: "\u29DD", + inodot: "\u0131", + intcal: "\u22BA", + int: "\u222B", + Int: "\u222C", + integers: "\u2124", + Integral: "\u222B", + intercal: "\u22BA", + Intersection: "\u22C2", + intlarhk: "\u2A17", + intprod: "\u2A3C", + InvisibleComma: "\u2063", + InvisibleTimes: "\u2062", + IOcy: "\u0401", + iocy: "\u0451", + Iogon: "\u012E", + iogon: "\u012F", + Iopf: "\uD835\uDD40", + iopf: "\uD835\uDD5A", + Iota: "\u0399", + iota: "\u03B9", + iprod: "\u2A3C", + iquest: "\u00BF", + iscr: "\uD835\uDCBE", + Iscr: "\u2110", + isin: "\u2208", + isindot: "\u22F5", + isinE: "\u22F9", + isins: "\u22F4", + isinsv: "\u22F3", + isinv: "\u2208", + it: "\u2062", + Itilde: "\u0128", + itilde: "\u0129", + Iukcy: "\u0406", + iukcy: "\u0456", + Iuml: "\u00CF", + iuml: "\u00EF", + Jcirc: "\u0134", + jcirc: "\u0135", + Jcy: "\u0419", + jcy: "\u0439", + Jfr: "\uD835\uDD0D", + jfr: "\uD835\uDD27", + jmath: "\u0237", + Jopf: "\uD835\uDD41", + jopf: "\uD835\uDD5B", + Jscr: "\uD835\uDCA5", + jscr: "\uD835\uDCBF", + Jsercy: "\u0408", + jsercy: "\u0458", + Jukcy: "\u0404", + jukcy: "\u0454", + Kappa: "\u039A", + kappa: "\u03BA", + kappav: "\u03F0", + Kcedil: "\u0136", + kcedil: "\u0137", + Kcy: "\u041A", + kcy: "\u043A", + Kfr: "\uD835\uDD0E", + kfr: "\uD835\uDD28", + kgreen: "\u0138", + KHcy: "\u0425", + khcy: "\u0445", + KJcy: "\u040C", + kjcy: "\u045C", + Kopf: "\uD835\uDD42", + kopf: "\uD835\uDD5C", + Kscr: "\uD835\uDCA6", + kscr: "\uD835\uDCC0", + lAarr: "\u21DA", + Lacute: "\u0139", + lacute: "\u013A", + laemptyv: "\u29B4", + lagran: "\u2112", + Lambda: "\u039B", + lambda: "\u03BB", + lang: "\u27E8", + Lang: "\u27EA", + langd: "\u2991", + langle: "\u27E8", + lap: "\u2A85", + Laplacetrf: "\u2112", + laquo: "\u00AB", + larrb: "\u21E4", + larrbfs: "\u291F", + larr: "\u2190", + Larr: "\u219E", + lArr: "\u21D0", + larrfs: "\u291D", + larrhk: "\u21A9", + larrlp: "\u21AB", + larrpl: "\u2939", + larrsim: "\u2973", + larrtl: "\u21A2", + latail: "\u2919", + lAtail: "\u291B", + lat: "\u2AAB", + late: "\u2AAD", + lates: "\u2AAD\uFE00", + lbarr: "\u290C", + lBarr: "\u290E", + lbbrk: "\u2772", + lbrace: "{", + lbrack: "[", + lbrke: "\u298B", + lbrksld: "\u298F", + lbrkslu: "\u298D", + Lcaron: "\u013D", + lcaron: "\u013E", + Lcedil: "\u013B", + lcedil: "\u013C", + lceil: "\u2308", + lcub: "{", + Lcy: "\u041B", + lcy: "\u043B", + ldca: "\u2936", + ldquo: "\u201C", + ldquor: "\u201E", + ldrdhar: "\u2967", + ldrushar: "\u294B", + ldsh: "\u21B2", + le: "\u2264", + lE: "\u2266", + LeftAngleBracket: "\u27E8", + LeftArrowBar: "\u21E4", + leftarrow: "\u2190", + LeftArrow: "\u2190", + Leftarrow: "\u21D0", + LeftArrowRightArrow: "\u21C6", + leftarrowtail: "\u21A2", + LeftCeiling: "\u2308", + LeftDoubleBracket: "\u27E6", + LeftDownTeeVector: "\u2961", + LeftDownVectorBar: "\u2959", + LeftDownVector: "\u21C3", + LeftFloor: "\u230A", + leftharpoondown: "\u21BD", + leftharpoonup: "\u21BC", + leftleftarrows: "\u21C7", + leftrightarrow: "\u2194", + LeftRightArrow: "\u2194", + Leftrightarrow: "\u21D4", + leftrightarrows: "\u21C6", + leftrightharpoons: "\u21CB", + leftrightsquigarrow: "\u21AD", + LeftRightVector: "\u294E", + LeftTeeArrow: "\u21A4", + LeftTee: "\u22A3", + LeftTeeVector: "\u295A", + leftthreetimes: "\u22CB", + LeftTriangleBar: "\u29CF", + LeftTriangle: "\u22B2", + LeftTriangleEqual: "\u22B4", + LeftUpDownVector: "\u2951", + LeftUpTeeVector: "\u2960", + LeftUpVectorBar: "\u2958", + LeftUpVector: "\u21BF", + LeftVectorBar: "\u2952", + LeftVector: "\u21BC", + lEg: "\u2A8B", + leg: "\u22DA", + leq: "\u2264", + leqq: "\u2266", + leqslant: "\u2A7D", + lescc: "\u2AA8", + les: "\u2A7D", + lesdot: "\u2A7F", + lesdoto: "\u2A81", + lesdotor: "\u2A83", + lesg: "\u22DA\uFE00", + lesges: "\u2A93", + lessapprox: "\u2A85", + lessdot: "\u22D6", + lesseqgtr: "\u22DA", + lesseqqgtr: "\u2A8B", + LessEqualGreater: "\u22DA", + LessFullEqual: "\u2266", + LessGreater: "\u2276", + lessgtr: "\u2276", + LessLess: "\u2AA1", + lesssim: "\u2272", + LessSlantEqual: "\u2A7D", + LessTilde: "\u2272", + lfisht: "\u297C", + lfloor: "\u230A", + Lfr: "\uD835\uDD0F", + lfr: "\uD835\uDD29", + lg: "\u2276", + lgE: "\u2A91", + lHar: "\u2962", + lhard: "\u21BD", + lharu: "\u21BC", + lharul: "\u296A", + lhblk: "\u2584", + LJcy: "\u0409", + ljcy: "\u0459", + llarr: "\u21C7", + ll: "\u226A", + Ll: "\u22D8", + llcorner: "\u231E", + Lleftarrow: "\u21DA", + llhard: "\u296B", + lltri: "\u25FA", + Lmidot: "\u013F", + lmidot: "\u0140", + lmoustache: "\u23B0", + lmoust: "\u23B0", + lnap: "\u2A89", + lnapprox: "\u2A89", + lne: "\u2A87", + lnE: "\u2268", + lneq: "\u2A87", + lneqq: "\u2268", + lnsim: "\u22E6", + loang: "\u27EC", + loarr: "\u21FD", + lobrk: "\u27E6", + longleftarrow: "\u27F5", + LongLeftArrow: "\u27F5", + Longleftarrow: "\u27F8", + longleftrightarrow: "\u27F7", + LongLeftRightArrow: "\u27F7", + Longleftrightarrow: "\u27FA", + longmapsto: "\u27FC", + longrightarrow: "\u27F6", + LongRightArrow: "\u27F6", + Longrightarrow: "\u27F9", + looparrowleft: "\u21AB", + looparrowright: "\u21AC", + lopar: "\u2985", + Lopf: "\uD835\uDD43", + lopf: "\uD835\uDD5D", + loplus: "\u2A2D", + lotimes: "\u2A34", + lowast: "\u2217", + lowbar: "_", + LowerLeftArrow: "\u2199", + LowerRightArrow: "\u2198", + loz: "\u25CA", + lozenge: "\u25CA", + lozf: "\u29EB", + lpar: "(", + lparlt: "\u2993", + lrarr: "\u21C6", + lrcorner: "\u231F", + lrhar: "\u21CB", + lrhard: "\u296D", + lrm: "\u200E", + lrtri: "\u22BF", + lsaquo: "\u2039", + lscr: "\uD835\uDCC1", + Lscr: "\u2112", + lsh: "\u21B0", + Lsh: "\u21B0", + lsim: "\u2272", + lsime: "\u2A8D", + lsimg: "\u2A8F", + lsqb: "[", + lsquo: "\u2018", + lsquor: "\u201A", + Lstrok: "\u0141", + lstrok: "\u0142", + ltcc: "\u2AA6", + ltcir: "\u2A79", + lt: "<", + LT: "<", + Lt: "\u226A", + ltdot: "\u22D6", + lthree: "\u22CB", + ltimes: "\u22C9", + ltlarr: "\u2976", + ltquest: "\u2A7B", + ltri: "\u25C3", + ltrie: "\u22B4", + ltrif: "\u25C2", + ltrPar: "\u2996", + lurdshar: "\u294A", + luruhar: "\u2966", + lvertneqq: "\u2268\uFE00", + lvnE: "\u2268\uFE00", + macr: "\u00AF", + male: "\u2642", + malt: "\u2720", + maltese: "\u2720", + Map: "\u2905", + map: "\u21A6", + mapsto: "\u21A6", + mapstodown: "\u21A7", + mapstoleft: "\u21A4", + mapstoup: "\u21A5", + marker: "\u25AE", + mcomma: "\u2A29", + Mcy: "\u041C", + mcy: "\u043C", + mdash: "\u2014", + mDDot: "\u223A", + measuredangle: "\u2221", + MediumSpace: "\u205F", + Mellintrf: "\u2133", + Mfr: "\uD835\uDD10", + mfr: "\uD835\uDD2A", + mho: "\u2127", + micro: "\u00B5", + midast: "*", + midcir: "\u2AF0", + mid: "\u2223", + middot: "\u00B7", + minusb: "\u229F", + minus: "\u2212", + minusd: "\u2238", + minusdu: "\u2A2A", + MinusPlus: "\u2213", + mlcp: "\u2ADB", + mldr: "\u2026", + mnplus: "\u2213", + models: "\u22A7", + Mopf: "\uD835\uDD44", + mopf: "\uD835\uDD5E", + mp: "\u2213", + mscr: "\uD835\uDCC2", + Mscr: "\u2133", + mstpos: "\u223E", + Mu: "\u039C", + mu: "\u03BC", + multimap: "\u22B8", + mumap: "\u22B8", + nabla: "\u2207", + Nacute: "\u0143", + nacute: "\u0144", + nang: "\u2220\u20D2", + nap: "\u2249", + napE: "\u2A70\u0338", + napid: "\u224B\u0338", + napos: "\u0149", + napprox: "\u2249", + natural: "\u266E", + naturals: "\u2115", + natur: "\u266E", + nbsp: "\u00A0", + nbump: "\u224E\u0338", + nbumpe: "\u224F\u0338", + ncap: "\u2A43", + Ncaron: "\u0147", + ncaron: "\u0148", + Ncedil: "\u0145", + ncedil: "\u0146", + ncong: "\u2247", + ncongdot: "\u2A6D\u0338", + ncup: "\u2A42", + Ncy: "\u041D", + ncy: "\u043D", + ndash: "\u2013", + nearhk: "\u2924", + nearr: "\u2197", + neArr: "\u21D7", + nearrow: "\u2197", + ne: "\u2260", + nedot: "\u2250\u0338", + NegativeMediumSpace: "\u200B", + NegativeThickSpace: "\u200B", + NegativeThinSpace: "\u200B", + NegativeVeryThinSpace: "\u200B", + nequiv: "\u2262", + nesear: "\u2928", + nesim: "\u2242\u0338", + NestedGreaterGreater: "\u226B", + NestedLessLess: "\u226A", + NewLine: "\n", + nexist: "\u2204", + nexists: "\u2204", + Nfr: "\uD835\uDD11", + nfr: "\uD835\uDD2B", + ngE: "\u2267\u0338", + nge: "\u2271", + ngeq: "\u2271", + ngeqq: "\u2267\u0338", + ngeqslant: "\u2A7E\u0338", + nges: "\u2A7E\u0338", + nGg: "\u22D9\u0338", + ngsim: "\u2275", + nGt: "\u226B\u20D2", + ngt: "\u226F", + ngtr: "\u226F", + nGtv: "\u226B\u0338", + nharr: "\u21AE", + nhArr: "\u21CE", + nhpar: "\u2AF2", + ni: "\u220B", + nis: "\u22FC", + nisd: "\u22FA", + niv: "\u220B", + NJcy: "\u040A", + njcy: "\u045A", + nlarr: "\u219A", + nlArr: "\u21CD", + nldr: "\u2025", + nlE: "\u2266\u0338", + nle: "\u2270", + nleftarrow: "\u219A", + nLeftarrow: "\u21CD", + nleftrightarrow: "\u21AE", + nLeftrightarrow: "\u21CE", + nleq: "\u2270", + nleqq: "\u2266\u0338", + nleqslant: "\u2A7D\u0338", + nles: "\u2A7D\u0338", + nless: "\u226E", + nLl: "\u22D8\u0338", + nlsim: "\u2274", + nLt: "\u226A\u20D2", + nlt: "\u226E", + nltri: "\u22EA", + nltrie: "\u22EC", + nLtv: "\u226A\u0338", + nmid: "\u2224", + NoBreak: "\u2060", + NonBreakingSpace: "\u00A0", + nopf: "\uD835\uDD5F", + Nopf: "\u2115", + Not: "\u2AEC", + not: "\u00AC", + NotCongruent: "\u2262", + NotCupCap: "\u226D", + NotDoubleVerticalBar: "\u2226", + NotElement: "\u2209", + NotEqual: "\u2260", + NotEqualTilde: "\u2242\u0338", + NotExists: "\u2204", + NotGreater: "\u226F", + NotGreaterEqual: "\u2271", + NotGreaterFullEqual: "\u2267\u0338", + NotGreaterGreater: "\u226B\u0338", + NotGreaterLess: "\u2279", + NotGreaterSlantEqual: "\u2A7E\u0338", + NotGreaterTilde: "\u2275", + NotHumpDownHump: "\u224E\u0338", + NotHumpEqual: "\u224F\u0338", + notin: "\u2209", + notindot: "\u22F5\u0338", + notinE: "\u22F9\u0338", + notinva: "\u2209", + notinvb: "\u22F7", + notinvc: "\u22F6", + NotLeftTriangleBar: "\u29CF\u0338", + NotLeftTriangle: "\u22EA", + NotLeftTriangleEqual: "\u22EC", + NotLess: "\u226E", + NotLessEqual: "\u2270", + NotLessGreater: "\u2278", + NotLessLess: "\u226A\u0338", + NotLessSlantEqual: "\u2A7D\u0338", + NotLessTilde: "\u2274", + NotNestedGreaterGreater: "\u2AA2\u0338", + NotNestedLessLess: "\u2AA1\u0338", + notni: "\u220C", + notniva: "\u220C", + notnivb: "\u22FE", + notnivc: "\u22FD", + NotPrecedes: "\u2280", + NotPrecedesEqual: "\u2AAF\u0338", + NotPrecedesSlantEqual: "\u22E0", + NotReverseElement: "\u220C", + NotRightTriangleBar: "\u29D0\u0338", + NotRightTriangle: "\u22EB", + NotRightTriangleEqual: "\u22ED", + NotSquareSubset: "\u228F\u0338", + NotSquareSubsetEqual: "\u22E2", + NotSquareSuperset: "\u2290\u0338", + NotSquareSupersetEqual: "\u22E3", + NotSubset: "\u2282\u20D2", + NotSubsetEqual: "\u2288", + NotSucceeds: "\u2281", + NotSucceedsEqual: "\u2AB0\u0338", + NotSucceedsSlantEqual: "\u22E1", + NotSucceedsTilde: "\u227F\u0338", + NotSuperset: "\u2283\u20D2", + NotSupersetEqual: "\u2289", + NotTilde: "\u2241", + NotTildeEqual: "\u2244", + NotTildeFullEqual: "\u2247", + NotTildeTilde: "\u2249", + NotVerticalBar: "\u2224", + nparallel: "\u2226", + npar: "\u2226", + nparsl: "\u2AFD\u20E5", + npart: "\u2202\u0338", + npolint: "\u2A14", + npr: "\u2280", + nprcue: "\u22E0", + nprec: "\u2280", + npreceq: "\u2AAF\u0338", + npre: "\u2AAF\u0338", + nrarrc: "\u2933\u0338", + nrarr: "\u219B", + nrArr: "\u21CF", + nrarrw: "\u219D\u0338", + nrightarrow: "\u219B", + nRightarrow: "\u21CF", + nrtri: "\u22EB", + nrtrie: "\u22ED", + nsc: "\u2281", + nsccue: "\u22E1", + nsce: "\u2AB0\u0338", + Nscr: "\uD835\uDCA9", + nscr: "\uD835\uDCC3", + nshortmid: "\u2224", + nshortparallel: "\u2226", + nsim: "\u2241", + nsime: "\u2244", + nsimeq: "\u2244", + nsmid: "\u2224", + nspar: "\u2226", + nsqsube: "\u22E2", + nsqsupe: "\u22E3", + nsub: "\u2284", + nsubE: "\u2AC5\u0338", + nsube: "\u2288", + nsubset: "\u2282\u20D2", + nsubseteq: "\u2288", + nsubseteqq: "\u2AC5\u0338", + nsucc: "\u2281", + nsucceq: "\u2AB0\u0338", + nsup: "\u2285", + nsupE: "\u2AC6\u0338", + nsupe: "\u2289", + nsupset: "\u2283\u20D2", + nsupseteq: "\u2289", + nsupseteqq: "\u2AC6\u0338", + ntgl: "\u2279", + Ntilde: "\u00D1", + ntilde: "\u00F1", + ntlg: "\u2278", + ntriangleleft: "\u22EA", + ntrianglelefteq: "\u22EC", + ntriangleright: "\u22EB", + ntrianglerighteq: "\u22ED", + Nu: "\u039D", + nu: "\u03BD", + num: "#", + numero: "\u2116", + numsp: "\u2007", + nvap: "\u224D\u20D2", + nvdash: "\u22AC", + nvDash: "\u22AD", + nVdash: "\u22AE", + nVDash: "\u22AF", + nvge: "\u2265\u20D2", + nvgt: ">\u20D2", + nvHarr: "\u2904", + nvinfin: "\u29DE", + nvlArr: "\u2902", + nvle: "\u2264\u20D2", + nvlt: "<\u20D2", + nvltrie: "\u22B4\u20D2", + nvrArr: "\u2903", + nvrtrie: "\u22B5\u20D2", + nvsim: "\u223C\u20D2", + nwarhk: "\u2923", + nwarr: "\u2196", + nwArr: "\u21D6", + nwarrow: "\u2196", + nwnear: "\u2927", + Oacute: "\u00D3", + oacute: "\u00F3", + oast: "\u229B", + Ocirc: "\u00D4", + ocirc: "\u00F4", + ocir: "\u229A", + Ocy: "\u041E", + ocy: "\u043E", + odash: "\u229D", + Odblac: "\u0150", + odblac: "\u0151", + odiv: "\u2A38", + odot: "\u2299", + odsold: "\u29BC", + OElig: "\u0152", + oelig: "\u0153", + ofcir: "\u29BF", + Ofr: "\uD835\uDD12", + ofr: "\uD835\uDD2C", + ogon: "\u02DB", + Ograve: "\u00D2", + ograve: "\u00F2", + ogt: "\u29C1", + ohbar: "\u29B5", + ohm: "\u03A9", + oint: "\u222E", + olarr: "\u21BA", + olcir: "\u29BE", + olcross: "\u29BB", + oline: "\u203E", + olt: "\u29C0", + Omacr: "\u014C", + omacr: "\u014D", + Omega: "\u03A9", + omega: "\u03C9", + Omicron: "\u039F", + omicron: "\u03BF", + omid: "\u29B6", + ominus: "\u2296", + Oopf: "\uD835\uDD46", + oopf: "\uD835\uDD60", + opar: "\u29B7", + OpenCurlyDoubleQuote: "\u201C", + OpenCurlyQuote: "\u2018", + operp: "\u29B9", + oplus: "\u2295", + orarr: "\u21BB", + Or: "\u2A54", + or: "\u2228", + ord: "\u2A5D", + order: "\u2134", + orderof: "\u2134", + ordf: "\u00AA", + ordm: "\u00BA", + origof: "\u22B6", + oror: "\u2A56", + orslope: "\u2A57", + orv: "\u2A5B", + oS: "\u24C8", + Oscr: "\uD835\uDCAA", + oscr: "\u2134", + Oslash: "\u00D8", + oslash: "\u00F8", + osol: "\u2298", + Otilde: "\u00D5", + otilde: "\u00F5", + otimesas: "\u2A36", + Otimes: "\u2A37", + otimes: "\u2297", + Ouml: "\u00D6", + ouml: "\u00F6", + ovbar: "\u233D", + OverBar: "\u203E", + OverBrace: "\u23DE", + OverBracket: "\u23B4", + OverParenthesis: "\u23DC", + para: "\u00B6", + parallel: "\u2225", + par: "\u2225", + parsim: "\u2AF3", + parsl: "\u2AFD", + part: "\u2202", + PartialD: "\u2202", + Pcy: "\u041F", + pcy: "\u043F", + percnt: "%", + period: ".", + permil: "\u2030", + perp: "\u22A5", + pertenk: "\u2031", + Pfr: "\uD835\uDD13", + pfr: "\uD835\uDD2D", + Phi: "\u03A6", + phi: "\u03C6", + phiv: "\u03D5", + phmmat: "\u2133", + phone: "\u260E", + Pi: "\u03A0", + pi: "\u03C0", + pitchfork: "\u22D4", + piv: "\u03D6", + planck: "\u210F", + planckh: "\u210E", + plankv: "\u210F", + plusacir: "\u2A23", + plusb: "\u229E", + pluscir: "\u2A22", + plus: "+", + plusdo: "\u2214", + plusdu: "\u2A25", + pluse: "\u2A72", + PlusMinus: "\u00B1", + plusmn: "\u00B1", + plussim: "\u2A26", + plustwo: "\u2A27", + pm: "\u00B1", + Poincareplane: "\u210C", + pointint: "\u2A15", + popf: "\uD835\uDD61", + Popf: "\u2119", + pound: "\u00A3", + prap: "\u2AB7", + Pr: "\u2ABB", + pr: "\u227A", + prcue: "\u227C", + precapprox: "\u2AB7", + prec: "\u227A", + preccurlyeq: "\u227C", + Precedes: "\u227A", + PrecedesEqual: "\u2AAF", + PrecedesSlantEqual: "\u227C", + PrecedesTilde: "\u227E", + preceq: "\u2AAF", + precnapprox: "\u2AB9", + precneqq: "\u2AB5", + precnsim: "\u22E8", + pre: "\u2AAF", + prE: "\u2AB3", + precsim: "\u227E", + prime: "\u2032", + Prime: "\u2033", + primes: "\u2119", + prnap: "\u2AB9", + prnE: "\u2AB5", + prnsim: "\u22E8", + prod: "\u220F", + Product: "\u220F", + profalar: "\u232E", + profline: "\u2312", + profsurf: "\u2313", + prop: "\u221D", + Proportional: "\u221D", + Proportion: "\u2237", + propto: "\u221D", + prsim: "\u227E", + prurel: "\u22B0", + Pscr: "\uD835\uDCAB", + pscr: "\uD835\uDCC5", + Psi: "\u03A8", + psi: "\u03C8", + puncsp: "\u2008", + Qfr: "\uD835\uDD14", + qfr: "\uD835\uDD2E", + qint: "\u2A0C", + qopf: "\uD835\uDD62", + Qopf: "\u211A", + qprime: "\u2057", + Qscr: "\uD835\uDCAC", + qscr: "\uD835\uDCC6", + quaternions: "\u210D", + quatint: "\u2A16", + quest: "?", + questeq: "\u225F", + quot: '"', + QUOT: '"', + rAarr: "\u21DB", + race: "\u223D\u0331", + Racute: "\u0154", + racute: "\u0155", + radic: "\u221A", + raemptyv: "\u29B3", + rang: "\u27E9", + Rang: "\u27EB", + rangd: "\u2992", + range: "\u29A5", + rangle: "\u27E9", + raquo: "\u00BB", + rarrap: "\u2975", + rarrb: "\u21E5", + rarrbfs: "\u2920", + rarrc: "\u2933", + rarr: "\u2192", + Rarr: "\u21A0", + rArr: "\u21D2", + rarrfs: "\u291E", + rarrhk: "\u21AA", + rarrlp: "\u21AC", + rarrpl: "\u2945", + rarrsim: "\u2974", + Rarrtl: "\u2916", + rarrtl: "\u21A3", + rarrw: "\u219D", + ratail: "\u291A", + rAtail: "\u291C", + ratio: "\u2236", + rationals: "\u211A", + rbarr: "\u290D", + rBarr: "\u290F", + RBarr: "\u2910", + rbbrk: "\u2773", + rbrace: "}", + rbrack: "]", + rbrke: "\u298C", + rbrksld: "\u298E", + rbrkslu: "\u2990", + Rcaron: "\u0158", + rcaron: "\u0159", + Rcedil: "\u0156", + rcedil: "\u0157", + rceil: "\u2309", + rcub: "}", + Rcy: "\u0420", + rcy: "\u0440", + rdca: "\u2937", + rdldhar: "\u2969", + rdquo: "\u201D", + rdquor: "\u201D", + rdsh: "\u21B3", + real: "\u211C", + realine: "\u211B", + realpart: "\u211C", + reals: "\u211D", + Re: "\u211C", + rect: "\u25AD", + reg: "\u00AE", + REG: "\u00AE", + ReverseElement: "\u220B", + ReverseEquilibrium: "\u21CB", + ReverseUpEquilibrium: "\u296F", + rfisht: "\u297D", + rfloor: "\u230B", + rfr: "\uD835\uDD2F", + Rfr: "\u211C", + rHar: "\u2964", + rhard: "\u21C1", + rharu: "\u21C0", + rharul: "\u296C", + Rho: "\u03A1", + rho: "\u03C1", + rhov: "\u03F1", + RightAngleBracket: "\u27E9", + RightArrowBar: "\u21E5", + rightarrow: "\u2192", + RightArrow: "\u2192", + Rightarrow: "\u21D2", + RightArrowLeftArrow: "\u21C4", + rightarrowtail: "\u21A3", + RightCeiling: "\u2309", + RightDoubleBracket: "\u27E7", + RightDownTeeVector: "\u295D", + RightDownVectorBar: "\u2955", + RightDownVector: "\u21C2", + RightFloor: "\u230B", + rightharpoondown: "\u21C1", + rightharpoonup: "\u21C0", + rightleftarrows: "\u21C4", + rightleftharpoons: "\u21CC", + rightrightarrows: "\u21C9", + rightsquigarrow: "\u219D", + RightTeeArrow: "\u21A6", + RightTee: "\u22A2", + RightTeeVector: "\u295B", + rightthreetimes: "\u22CC", + RightTriangleBar: "\u29D0", + RightTriangle: "\u22B3", + RightTriangleEqual: "\u22B5", + RightUpDownVector: "\u294F", + RightUpTeeVector: "\u295C", + RightUpVectorBar: "\u2954", + RightUpVector: "\u21BE", + RightVectorBar: "\u2953", + RightVector: "\u21C0", + ring: "\u02DA", + risingdotseq: "\u2253", + rlarr: "\u21C4", + rlhar: "\u21CC", + rlm: "\u200F", + rmoustache: "\u23B1", + rmoust: "\u23B1", + rnmid: "\u2AEE", + roang: "\u27ED", + roarr: "\u21FE", + robrk: "\u27E7", + ropar: "\u2986", + ropf: "\uD835\uDD63", + Ropf: "\u211D", + roplus: "\u2A2E", + rotimes: "\u2A35", + RoundImplies: "\u2970", + rpar: ")", + rpargt: "\u2994", + rppolint: "\u2A12", + rrarr: "\u21C9", + Rrightarrow: "\u21DB", + rsaquo: "\u203A", + rscr: "\uD835\uDCC7", + Rscr: "\u211B", + rsh: "\u21B1", + Rsh: "\u21B1", + rsqb: "]", + rsquo: "\u2019", + rsquor: "\u2019", + rthree: "\u22CC", + rtimes: "\u22CA", + rtri: "\u25B9", + rtrie: "\u22B5", + rtrif: "\u25B8", + rtriltri: "\u29CE", + RuleDelayed: "\u29F4", + ruluhar: "\u2968", + rx: "\u211E", + Sacute: "\u015A", + sacute: "\u015B", + sbquo: "\u201A", + scap: "\u2AB8", + Scaron: "\u0160", + scaron: "\u0161", + Sc: "\u2ABC", + sc: "\u227B", + sccue: "\u227D", + sce: "\u2AB0", + scE: "\u2AB4", + Scedil: "\u015E", + scedil: "\u015F", + Scirc: "\u015C", + scirc: "\u015D", + scnap: "\u2ABA", + scnE: "\u2AB6", + scnsim: "\u22E9", + scpolint: "\u2A13", + scsim: "\u227F", + Scy: "\u0421", + scy: "\u0441", + sdotb: "\u22A1", + sdot: "\u22C5", + sdote: "\u2A66", + searhk: "\u2925", + searr: "\u2198", + seArr: "\u21D8", + searrow: "\u2198", + sect: "\u00A7", + semi: ";", + seswar: "\u2929", + setminus: "\u2216", + setmn: "\u2216", + sext: "\u2736", + Sfr: "\uD835\uDD16", + sfr: "\uD835\uDD30", + sfrown: "\u2322", + sharp: "\u266F", + SHCHcy: "\u0429", + shchcy: "\u0449", + SHcy: "\u0428", + shcy: "\u0448", + ShortDownArrow: "\u2193", + ShortLeftArrow: "\u2190", + shortmid: "\u2223", + shortparallel: "\u2225", + ShortRightArrow: "\u2192", + ShortUpArrow: "\u2191", + shy: "\u00AD", + Sigma: "\u03A3", + sigma: "\u03C3", + sigmaf: "\u03C2", + sigmav: "\u03C2", + sim: "\u223C", + simdot: "\u2A6A", + sime: "\u2243", + simeq: "\u2243", + simg: "\u2A9E", + simgE: "\u2AA0", + siml: "\u2A9D", + simlE: "\u2A9F", + simne: "\u2246", + simplus: "\u2A24", + simrarr: "\u2972", + slarr: "\u2190", + SmallCircle: "\u2218", + smallsetminus: "\u2216", + smashp: "\u2A33", + smeparsl: "\u29E4", + smid: "\u2223", + smile: "\u2323", + smt: "\u2AAA", + smte: "\u2AAC", + smtes: "\u2AAC\uFE00", + SOFTcy: "\u042C", + softcy: "\u044C", + solbar: "\u233F", + solb: "\u29C4", + sol: "/", + Sopf: "\uD835\uDD4A", + sopf: "\uD835\uDD64", + spades: "\u2660", + spadesuit: "\u2660", + spar: "\u2225", + sqcap: "\u2293", + sqcaps: "\u2293\uFE00", + sqcup: "\u2294", + sqcups: "\u2294\uFE00", + Sqrt: "\u221A", + sqsub: "\u228F", + sqsube: "\u2291", + sqsubset: "\u228F", + sqsubseteq: "\u2291", + sqsup: "\u2290", + sqsupe: "\u2292", + sqsupset: "\u2290", + sqsupseteq: "\u2292", + square: "\u25A1", + Square: "\u25A1", + SquareIntersection: "\u2293", + SquareSubset: "\u228F", + SquareSubsetEqual: "\u2291", + SquareSuperset: "\u2290", + SquareSupersetEqual: "\u2292", + SquareUnion: "\u2294", + squarf: "\u25AA", + squ: "\u25A1", + squf: "\u25AA", + srarr: "\u2192", + Sscr: "\uD835\uDCAE", + sscr: "\uD835\uDCC8", + ssetmn: "\u2216", + ssmile: "\u2323", + sstarf: "\u22C6", + Star: "\u22C6", + star: "\u2606", + starf: "\u2605", + straightepsilon: "\u03F5", + straightphi: "\u03D5", + strns: "\u00AF", + sub: "\u2282", + Sub: "\u22D0", + subdot: "\u2ABD", + subE: "\u2AC5", + sube: "\u2286", + subedot: "\u2AC3", + submult: "\u2AC1", + subnE: "\u2ACB", + subne: "\u228A", + subplus: "\u2ABF", + subrarr: "\u2979", + subset: "\u2282", + Subset: "\u22D0", + subseteq: "\u2286", + subseteqq: "\u2AC5", + SubsetEqual: "\u2286", + subsetneq: "\u228A", + subsetneqq: "\u2ACB", + subsim: "\u2AC7", + subsub: "\u2AD5", + subsup: "\u2AD3", + succapprox: "\u2AB8", + succ: "\u227B", + succcurlyeq: "\u227D", + Succeeds: "\u227B", + SucceedsEqual: "\u2AB0", + SucceedsSlantEqual: "\u227D", + SucceedsTilde: "\u227F", + succeq: "\u2AB0", + succnapprox: "\u2ABA", + succneqq: "\u2AB6", + succnsim: "\u22E9", + succsim: "\u227F", + SuchThat: "\u220B", + sum: "\u2211", + Sum: "\u2211", + sung: "\u266A", + sup1: "\u00B9", + sup2: "\u00B2", + sup3: "\u00B3", + sup: "\u2283", + Sup: "\u22D1", + supdot: "\u2ABE", + supdsub: "\u2AD8", + supE: "\u2AC6", + supe: "\u2287", + supedot: "\u2AC4", + Superset: "\u2283", + SupersetEqual: "\u2287", + suphsol: "\u27C9", + suphsub: "\u2AD7", + suplarr: "\u297B", + supmult: "\u2AC2", + supnE: "\u2ACC", + supne: "\u228B", + supplus: "\u2AC0", + supset: "\u2283", + Supset: "\u22D1", + supseteq: "\u2287", + supseteqq: "\u2AC6", + supsetneq: "\u228B", + supsetneqq: "\u2ACC", + supsim: "\u2AC8", + supsub: "\u2AD4", + supsup: "\u2AD6", + swarhk: "\u2926", + swarr: "\u2199", + swArr: "\u21D9", + swarrow: "\u2199", + swnwar: "\u292A", + szlig: "\u00DF", + Tab: "\t", + target: "\u2316", + Tau: "\u03A4", + tau: "\u03C4", + tbrk: "\u23B4", + Tcaron: "\u0164", + tcaron: "\u0165", + Tcedil: "\u0162", + tcedil: "\u0163", + Tcy: "\u0422", + tcy: "\u0442", + tdot: "\u20DB", + telrec: "\u2315", + Tfr: "\uD835\uDD17", + tfr: "\uD835\uDD31", + there4: "\u2234", + therefore: "\u2234", + Therefore: "\u2234", + Theta: "\u0398", + theta: "\u03B8", + thetasym: "\u03D1", + thetav: "\u03D1", + thickapprox: "\u2248", + thicksim: "\u223C", + ThickSpace: "\u205F\u200A", + ThinSpace: "\u2009", + thinsp: "\u2009", + thkap: "\u2248", + thksim: "\u223C", + THORN: "\u00DE", + thorn: "\u00FE", + tilde: "\u02DC", + Tilde: "\u223C", + TildeEqual: "\u2243", + TildeFullEqual: "\u2245", + TildeTilde: "\u2248", + timesbar: "\u2A31", + timesb: "\u22A0", + times: "\u00D7", + timesd: "\u2A30", + tint: "\u222D", + toea: "\u2928", + topbot: "\u2336", + topcir: "\u2AF1", + top: "\u22A4", + Topf: "\uD835\uDD4B", + topf: "\uD835\uDD65", + topfork: "\u2ADA", + tosa: "\u2929", + tprime: "\u2034", + trade: "\u2122", + TRADE: "\u2122", + triangle: "\u25B5", + triangledown: "\u25BF", + triangleleft: "\u25C3", + trianglelefteq: "\u22B4", + triangleq: "\u225C", + triangleright: "\u25B9", + trianglerighteq: "\u22B5", + tridot: "\u25EC", + trie: "\u225C", + triminus: "\u2A3A", + TripleDot: "\u20DB", + triplus: "\u2A39", + trisb: "\u29CD", + tritime: "\u2A3B", + trpezium: "\u23E2", + Tscr: "\uD835\uDCAF", + tscr: "\uD835\uDCC9", + TScy: "\u0426", + tscy: "\u0446", + TSHcy: "\u040B", + tshcy: "\u045B", + Tstrok: "\u0166", + tstrok: "\u0167", + twixt: "\u226C", + twoheadleftarrow: "\u219E", + twoheadrightarrow: "\u21A0", + Uacute: "\u00DA", + uacute: "\u00FA", + uarr: "\u2191", + Uarr: "\u219F", + uArr: "\u21D1", + Uarrocir: "\u2949", + Ubrcy: "\u040E", + ubrcy: "\u045E", + Ubreve: "\u016C", + ubreve: "\u016D", + Ucirc: "\u00DB", + ucirc: "\u00FB", + Ucy: "\u0423", + ucy: "\u0443", + udarr: "\u21C5", + Udblac: "\u0170", + udblac: "\u0171", + udhar: "\u296E", + ufisht: "\u297E", + Ufr: "\uD835\uDD18", + ufr: "\uD835\uDD32", + Ugrave: "\u00D9", + ugrave: "\u00F9", + uHar: "\u2963", + uharl: "\u21BF", + uharr: "\u21BE", + uhblk: "\u2580", + ulcorn: "\u231C", + ulcorner: "\u231C", + ulcrop: "\u230F", + ultri: "\u25F8", + Umacr: "\u016A", + umacr: "\u016B", + uml: "\u00A8", + UnderBar: "_", + UnderBrace: "\u23DF", + UnderBracket: "\u23B5", + UnderParenthesis: "\u23DD", + Union: "\u22C3", + UnionPlus: "\u228E", + Uogon: "\u0172", + uogon: "\u0173", + Uopf: "\uD835\uDD4C", + uopf: "\uD835\uDD66", + UpArrowBar: "\u2912", + uparrow: "\u2191", + UpArrow: "\u2191", + Uparrow: "\u21D1", + UpArrowDownArrow: "\u21C5", + updownarrow: "\u2195", + UpDownArrow: "\u2195", + Updownarrow: "\u21D5", + UpEquilibrium: "\u296E", + upharpoonleft: "\u21BF", + upharpoonright: "\u21BE", + uplus: "\u228E", + UpperLeftArrow: "\u2196", + UpperRightArrow: "\u2197", + upsi: "\u03C5", + Upsi: "\u03D2", + upsih: "\u03D2", + Upsilon: "\u03A5", + upsilon: "\u03C5", + UpTeeArrow: "\u21A5", + UpTee: "\u22A5", + upuparrows: "\u21C8", + urcorn: "\u231D", + urcorner: "\u231D", + urcrop: "\u230E", + Uring: "\u016E", + uring: "\u016F", + urtri: "\u25F9", + Uscr: "\uD835\uDCB0", + uscr: "\uD835\uDCCA", + utdot: "\u22F0", + Utilde: "\u0168", + utilde: "\u0169", + utri: "\u25B5", + utrif: "\u25B4", + uuarr: "\u21C8", + Uuml: "\u00DC", + uuml: "\u00FC", + uwangle: "\u29A7", + vangrt: "\u299C", + varepsilon: "\u03F5", + varkappa: "\u03F0", + varnothing: "\u2205", + varphi: "\u03D5", + varpi: "\u03D6", + varpropto: "\u221D", + varr: "\u2195", + vArr: "\u21D5", + varrho: "\u03F1", + varsigma: "\u03C2", + varsubsetneq: "\u228A\uFE00", + varsubsetneqq: "\u2ACB\uFE00", + varsupsetneq: "\u228B\uFE00", + varsupsetneqq: "\u2ACC\uFE00", + vartheta: "\u03D1", + vartriangleleft: "\u22B2", + vartriangleright: "\u22B3", + vBar: "\u2AE8", + Vbar: "\u2AEB", + vBarv: "\u2AE9", + Vcy: "\u0412", + vcy: "\u0432", + vdash: "\u22A2", + vDash: "\u22A8", + Vdash: "\u22A9", + VDash: "\u22AB", + Vdashl: "\u2AE6", + veebar: "\u22BB", + vee: "\u2228", + Vee: "\u22C1", + veeeq: "\u225A", + vellip: "\u22EE", + verbar: "|", + Verbar: "\u2016", + vert: "|", + Vert: "\u2016", + VerticalBar: "\u2223", + VerticalLine: "|", + VerticalSeparator: "\u2758", + VerticalTilde: "\u2240", + VeryThinSpace: "\u200A", + Vfr: "\uD835\uDD19", + vfr: "\uD835\uDD33", + vltri: "\u22B2", + vnsub: "\u2282\u20D2", + vnsup: "\u2283\u20D2", + Vopf: "\uD835\uDD4D", + vopf: "\uD835\uDD67", + vprop: "\u221D", + vrtri: "\u22B3", + Vscr: "\uD835\uDCB1", + vscr: "\uD835\uDCCB", + vsubnE: "\u2ACB\uFE00", + vsubne: "\u228A\uFE00", + vsupnE: "\u2ACC\uFE00", + vsupne: "\u228B\uFE00", + Vvdash: "\u22AA", + vzigzag: "\u299A", + Wcirc: "\u0174", + wcirc: "\u0175", + wedbar: "\u2A5F", + wedge: "\u2227", + Wedge: "\u22C0", + wedgeq: "\u2259", + weierp: "\u2118", + Wfr: "\uD835\uDD1A", + wfr: "\uD835\uDD34", + Wopf: "\uD835\uDD4E", + wopf: "\uD835\uDD68", + wp: "\u2118", + wr: "\u2240", + wreath: "\u2240", + Wscr: "\uD835\uDCB2", + wscr: "\uD835\uDCCC", + xcap: "\u22C2", + xcirc: "\u25EF", + xcup: "\u22C3", + xdtri: "\u25BD", + Xfr: "\uD835\uDD1B", + xfr: "\uD835\uDD35", + xharr: "\u27F7", + xhArr: "\u27FA", + Xi: "\u039E", + xi: "\u03BE", + xlarr: "\u27F5", + xlArr: "\u27F8", + xmap: "\u27FC", + xnis: "\u22FB", + xodot: "\u2A00", + Xopf: "\uD835\uDD4F", + xopf: "\uD835\uDD69", + xoplus: "\u2A01", + xotime: "\u2A02", + xrarr: "\u27F6", + xrArr: "\u27F9", + Xscr: "\uD835\uDCB3", + xscr: "\uD835\uDCCD", + xsqcup: "\u2A06", + xuplus: "\u2A04", + xutri: "\u25B3", + xvee: "\u22C1", + xwedge: "\u22C0", + Yacute: "\u00DD", + yacute: "\u00FD", + YAcy: "\u042F", + yacy: "\u044F", + Ycirc: "\u0176", + ycirc: "\u0177", + Ycy: "\u042B", + ycy: "\u044B", + yen: "\u00A5", + Yfr: "\uD835\uDD1C", + yfr: "\uD835\uDD36", + YIcy: "\u0407", + yicy: "\u0457", + Yopf: "\uD835\uDD50", + yopf: "\uD835\uDD6A", + Yscr: "\uD835\uDCB4", + yscr: "\uD835\uDCCE", + YUcy: "\u042E", + yucy: "\u044E", + yuml: "\u00FF", + Yuml: "\u0178", + Zacute: "\u0179", + zacute: "\u017A", + Zcaron: "\u017D", + zcaron: "\u017E", + Zcy: "\u0417", + zcy: "\u0437", + Zdot: "\u017B", + zdot: "\u017C", + zeetrf: "\u2128", + ZeroWidthSpace: "\u200B", + Zeta: "\u0396", + zeta: "\u03B6", + zfr: "\uD835\uDD37", + Zfr: "\u2128", + ZHcy: "\u0416", + zhcy: "\u0436", + zigrarr: "\u21DD", + zopf: "\uD835\uDD6B", + Zopf: "\u2124", + Zscr: "\uD835\uDCB5", + zscr: "\uD835\uDCCF", + zwj: "\u200D", + zwnj: "\u200C", + }; + }, + {}, + ], + 53: [ + function (require, module, exports) { + "use strict"; + + //////////////////////////////////////////////////////////////////////////////// + // Helpers + + // Merge objects + // + function assign(obj /*from1, from2, from3, ...*/) { + var sources = Array.prototype.slice.call(arguments, 1); + + sources.forEach(function (source) { + if (!source) { + return; + } + + Object.keys(source).forEach(function (key) { + obj[key] = source[key]; + }); + }); + + return obj; + } + + function _class(obj) { + return Object.prototype.toString.call(obj); + } + function isString(obj) { + return _class(obj) === "[object String]"; + } + function isObject(obj) { + return _class(obj) === "[object Object]"; + } + function isRegExp(obj) { + return _class(obj) === "[object RegExp]"; + } + function isFunction(obj) { + return _class(obj) === "[object Function]"; + } + + function escapeRE(str) { + return str.replace(/[.?*+^$[\]\\(){}|-]/g, "\\$&"); + } + + //////////////////////////////////////////////////////////////////////////////// + + var defaultOptions = { + fuzzyLink: true, + fuzzyEmail: true, + fuzzyIP: false, + }; + + function isOptionsObj(obj) { + return Object.keys(obj || {}).reduce(function (acc, k) { + return acc || defaultOptions.hasOwnProperty(k); + }, false); + } + + var defaultSchemas = { + "http:": { + validate: function (text, pos, self) { + var tail = text.slice(pos); + + if (!self.re.http) { + // compile lazily, because "host"-containing variables can change on tlds update. + self.re.http = new RegExp( + "^\\/\\/" + + self.re.src_auth + + self.re.src_host_port_strict + + self.re.src_path, + "i", + ); + } + if (self.re.http.test(tail)) { + return tail.match(self.re.http)[0].length; + } + return 0; + }, + }, + "https:": "http:", + "ftp:": "http:", + "//": { + validate: function (text, pos, self) { + var tail = text.slice(pos); + + if (!self.re.no_http) { + // compile lazily, because "host"-containing variables can change on tlds update. + self.re.no_http = new RegExp( + "^" + + self.re.src_auth + + // Don't allow single-level domains, because of false positives like '//test' + // with code comments + "(?:localhost|(?:(?:" + + self.re.src_domain + + ")\\.)+" + + self.re.src_domain_root + + ")" + + self.re.src_port + + self.re.src_host_terminator + + self.re.src_path, + + "i", + ); + } + + if (self.re.no_http.test(tail)) { + // should not be `://` & `///`, that protects from errors in protocol name + if (pos >= 3 && text[pos - 3] === ":") { + return 0; + } + if (pos >= 3 && text[pos - 3] === "/") { + return 0; + } + return tail.match(self.re.no_http)[0].length; + } + return 0; + }, + }, + "mailto:": { + validate: function (text, pos, self) { + var tail = text.slice(pos); + + if (!self.re.mailto) { + self.re.mailto = new RegExp( + "^" + + self.re.src_email_name + + "@" + + self.re.src_host_strict, + "i", + ); + } + if (self.re.mailto.test(tail)) { + return tail.match(self.re.mailto)[0].length; + } + return 0; + }, + }, + }; + + /*eslint-disable max-len*/ + + // RE pattern for 2-character tlds (autogenerated by ./support/tlds_2char_gen.js) + var tlds_2ch_src_re = + "a[cdefgilmnoqrstuwxz]|b[abdefghijmnorstvwyz]|c[acdfghiklmnoruvwxyz]|d[ejkmoz]|e[cegrstu]|f[ijkmor]|g[abdefghilmnpqrstuwy]|h[kmnrtu]|i[delmnoqrst]|j[emop]|k[eghimnprwyz]|l[abcikrstuvy]|m[acdeghklmnopqrstuvwxyz]|n[acefgilopruz]|om|p[aefghklmnrstwy]|qa|r[eosuw]|s[abcdeghijklmnortuvxyz]|t[cdfghjklmnortvwz]|u[agksyz]|v[aceginu]|w[fs]|y[et]|z[amw]"; + + // DON'T try to make PRs with changes. Extend TLDs with LinkifyIt.tlds() instead + var tlds_default = + "biz|com|edu|gov|net|org|pro|web|xxx|aero|asia|coop|info|museum|name|shop|рф".split( + "|", + ); + + /*eslint-enable max-len*/ + + //////////////////////////////////////////////////////////////////////////////// + + function resetScanCache(self) { + self.__index__ = -1; + self.__text_cache__ = ""; + } + + function createValidator(re) { + return function (text, pos) { + var tail = text.slice(pos); + + if (re.test(tail)) { + return tail.match(re)[0].length; + } + return 0; + }; + } + + function createNormalizer() { + return function (match, self) { + self.normalize(match); + }; + } + + // Schemas compiler. Build regexps. + // + function compile(self) { + // Load & clone RE patterns. + var re = (self.re = require("./lib/re")(self.__opts__)); + + // Define dynamic patterns + var tlds = self.__tlds__.slice(); + + self.onCompile(); + + if (!self.__tlds_replaced__) { + tlds.push(tlds_2ch_src_re); + } + tlds.push(re.src_xn); + + re.src_tlds = tlds.join("|"); + + function untpl(tpl) { + return tpl.replace("%TLDS%", re.src_tlds); + } + + re.email_fuzzy = RegExp(untpl(re.tpl_email_fuzzy), "i"); + re.link_fuzzy = RegExp(untpl(re.tpl_link_fuzzy), "i"); + re.link_no_ip_fuzzy = RegExp(untpl(re.tpl_link_no_ip_fuzzy), "i"); + re.host_fuzzy_test = RegExp(untpl(re.tpl_host_fuzzy_test), "i"); + + // + // Compile each schema + // + + var aliases = []; + + self.__compiled__ = {}; // Reset compiled data + + function schemaError(name, val) { + throw new Error( + '(LinkifyIt) Invalid schema "' + name + '": ' + val, + ); + } + + Object.keys(self.__schemas__).forEach(function (name) { + var val = self.__schemas__[name]; + + // skip disabled methods + if (val === null) { + return; + } + + var compiled = { validate: null, link: null }; + + self.__compiled__[name] = compiled; + + if (isObject(val)) { + if (isRegExp(val.validate)) { + compiled.validate = createValidator(val.validate); + } else if (isFunction(val.validate)) { + compiled.validate = val.validate; + } else { + schemaError(name, val); + } + + if (isFunction(val.normalize)) { + compiled.normalize = val.normalize; + } else if (!val.normalize) { + compiled.normalize = createNormalizer(); + } else { + schemaError(name, val); + } + + return; + } + + if (isString(val)) { + aliases.push(name); + return; + } + + schemaError(name, val); + }); + + // + // Compile postponed aliases + // + + aliases.forEach(function (alias) { + if (!self.__compiled__[self.__schemas__[alias]]) { + // Silently fail on missed schemas to avoid errons on disable. + // schemaError(alias, self.__schemas__[alias]); + return; + } + + self.__compiled__[alias].validate = + self.__compiled__[self.__schemas__[alias]].validate; + self.__compiled__[alias].normalize = + self.__compiled__[self.__schemas__[alias]].normalize; + }); + + // + // Fake record for guessed links + // + self.__compiled__[""] = { + validate: null, + normalize: createNormalizer(), + }; + + // + // Build schema condition + // + var slist = Object.keys(self.__compiled__) + .filter(function (name) { + // Filter disabled & fake schemas + return name.length > 0 && self.__compiled__[name]; + }) + .map(escapeRE) + .join("|"); + // (?!_) cause 1.5x slowdown + self.re.schema_test = RegExp( + "(^|(?!_)(?:[><\uff5c]|" + re.src_ZPCc + "))(" + slist + ")", + "i", + ); + self.re.schema_search = RegExp( + "(^|(?!_)(?:[><\uff5c]|" + re.src_ZPCc + "))(" + slist + ")", + "ig", + ); + + self.re.pretest = RegExp( + "(" + + self.re.schema_test.source + + ")|" + + "(" + + self.re.host_fuzzy_test.source + + ")|" + + "@", + "i", + ); + + // + // Cleanup + // + + resetScanCache(self); + } + + /** + * class Match + * + * Match result. Single element of array, returned by [[LinkifyIt#match]] + **/ + function Match(self, shift) { + var start = self.__index__, + end = self.__last_index__, + text = self.__text_cache__.slice(start, end); + + /** + * Match#schema -> String + * + * Prefix (protocol) for matched string. + **/ + this.schema = self.__schema__.toLowerCase(); + /** + * Match#index -> Number + * + * First position of matched string. + **/ + this.index = start + shift; + /** + * Match#lastIndex -> Number + * + * Next position after matched string. + **/ + this.lastIndex = end + shift; + /** + * Match#raw -> String + * + * Matched string. + **/ + this.raw = text; + /** + * Match#text -> String + * + * Notmalized text of matched string. + **/ + this.text = text; + /** + * Match#url -> String + * + * Normalized url of matched string. + **/ + this.url = text; + } + + function createMatch(self, shift) { + var match = new Match(self, shift); + + self.__compiled__[match.schema].normalize(match, self); + + return match; + } + + /** + * class LinkifyIt + **/ + + /** + * new LinkifyIt(schemas, options) + * - schemas (Object): Optional. Additional schemas to validate (prefix/validator) + * - options (Object): { fuzzyLink|fuzzyEmail|fuzzyIP: true|false } + * + * Creates new linkifier instance with optional additional schemas. + * Can be called without `new` keyword for convenience. + * + * By default understands: + * + * - `http(s)://...` , `ftp://...`, `mailto:...` & `//...` links + * - "fuzzy" links and emails (example.com, foo@bar.com). + * + * `schemas` is an object, where each key/value describes protocol/rule: + * + * - __key__ - link prefix (usually, protocol name with `:` at the end, `skype:` + * for example). `linkify-it` makes shure that prefix is not preceeded with + * alphanumeric char and symbols. Only whitespaces and punctuation allowed. + * - __value__ - rule to check tail after link prefix + * - _String_ - just alias to existing rule + * - _Object_ + * - _validate_ - validator function (should return matched length on success), + * or `RegExp`. + * - _normalize_ - optional function to normalize text & url of matched result + * (for example, for @twitter mentions). + * + * `options`: + * + * - __fuzzyLink__ - recognige URL-s without `http(s):` prefix. Default `true`. + * - __fuzzyIP__ - allow IPs in fuzzy links above. Can conflict with some texts + * like version numbers. Default `false`. + * - __fuzzyEmail__ - recognize emails without `mailto:` prefix. + * + **/ + function LinkifyIt(schemas, options) { + if (!(this instanceof LinkifyIt)) { + return new LinkifyIt(schemas, options); + } + + if (!options) { + if (isOptionsObj(schemas)) { + options = schemas; + schemas = {}; + } + } + + this.__opts__ = assign({}, defaultOptions, options); + + // Cache last tested result. Used to skip repeating steps on next `match` call. + this.__index__ = -1; + this.__last_index__ = -1; // Next scan position + this.__schema__ = ""; + this.__text_cache__ = ""; + + this.__schemas__ = assign({}, defaultSchemas, schemas); + this.__compiled__ = {}; + + this.__tlds__ = tlds_default; + this.__tlds_replaced__ = false; + + this.re = {}; + + compile(this); + } + + /** chainable + * LinkifyIt#add(schema, definition) + * - schema (String): rule name (fixed pattern prefix) + * - definition (String|RegExp|Object): schema definition + * + * Add new rule definition. See constructor description for details. + **/ + LinkifyIt.prototype.add = function add(schema, definition) { + this.__schemas__[schema] = definition; + compile(this); + return this; + }; + + /** chainable + * LinkifyIt#set(options) + * - options (Object): { fuzzyLink|fuzzyEmail|fuzzyIP: true|false } + * + * Set recognition options for links without schema. + **/ + LinkifyIt.prototype.set = function set(options) { + this.__opts__ = assign(this.__opts__, options); + return this; + }; + + /** + * LinkifyIt#test(text) -> Boolean + * + * Searches linkifiable pattern and returns `true` on success or `false` on fail. + **/ + LinkifyIt.prototype.test = function test(text) { + // Reset scan cache + this.__text_cache__ = text; + this.__index__ = -1; + + if (!text.length) { + return false; + } + + var m, ml, me, len, shift, next, re, tld_pos, at_pos; + + // try to scan for link with schema - that's the most simple rule + if (this.re.schema_test.test(text)) { + re = this.re.schema_search; + re.lastIndex = 0; + while ((m = re.exec(text)) !== null) { + len = this.testSchemaAt(text, m[2], re.lastIndex); + if (len) { + this.__schema__ = m[2]; + this.__index__ = m.index + m[1].length; + this.__last_index__ = m.index + m[0].length + len; + break; + } + } + } + + if (this.__opts__.fuzzyLink && this.__compiled__["http:"]) { + // guess schemaless links + tld_pos = text.search(this.re.host_fuzzy_test); + if (tld_pos >= 0) { + // if tld is located after found link - no need to check fuzzy pattern + if (this.__index__ < 0 || tld_pos < this.__index__) { + if ( + (ml = text.match( + this.__opts__.fuzzyIP + ? this.re.link_fuzzy + : this.re.link_no_ip_fuzzy, + )) !== null + ) { + shift = ml.index + ml[1].length; + + if (this.__index__ < 0 || shift < this.__index__) { + this.__schema__ = ""; + this.__index__ = shift; + this.__last_index__ = ml.index + ml[0].length; + } + } + } + } + } + + if (this.__opts__.fuzzyEmail && this.__compiled__["mailto:"]) { + // guess schemaless emails + at_pos = text.indexOf("@"); + if (at_pos >= 0) { + // We can't skip this check, because this cases are possible: + // 192.168.1.1@gmail.com, my.in@example.com + if ((me = text.match(this.re.email_fuzzy)) !== null) { + shift = me.index + me[1].length; + next = me.index + me[0].length; + + if ( + this.__index__ < 0 || + shift < this.__index__ || + (shift === this.__index__ && next > this.__last_index__) + ) { + this.__schema__ = "mailto:"; + this.__index__ = shift; + this.__last_index__ = next; + } + } + } + } + + return this.__index__ >= 0; + }; + + /** + * LinkifyIt#pretest(text) -> Boolean + * + * Very quick check, that can give false positives. Returns true if link MAY BE + * can exists. Can be used for speed optimization, when you need to check that + * link NOT exists. + **/ + LinkifyIt.prototype.pretest = function pretest(text) { + return this.re.pretest.test(text); + }; + + /** + * LinkifyIt#testSchemaAt(text, name, position) -> Number + * - text (String): text to scan + * - name (String): rule (schema) name + * - position (Number): text offset to check from + * + * Similar to [[LinkifyIt#test]] but checks only specific protocol tail exactly + * at given position. Returns length of found pattern (0 on fail). + **/ + LinkifyIt.prototype.testSchemaAt = function testSchemaAt( + text, + schema, + pos, + ) { + // If not supported schema check requested - terminate + if (!this.__compiled__[schema.toLowerCase()]) { + return 0; + } + return this.__compiled__[schema.toLowerCase()].validate( + text, + pos, + this, + ); + }; + + /** + * LinkifyIt#match(text) -> Array|null + * + * Returns array of found link descriptions or `null` on fail. We strongly + * recommend to use [[LinkifyIt#test]] first, for best speed. + * + * ##### Result match description + * + * - __schema__ - link schema, can be empty for fuzzy links, or `//` for + * protocol-neutral links. + * - __index__ - offset of matched text + * - __lastIndex__ - index of next char after mathch end + * - __raw__ - matched text + * - __text__ - normalized text + * - __url__ - link, generated from matched text + **/ + LinkifyIt.prototype.match = function match(text) { + var shift = 0, + result = []; + + // Try to take previous element from cache, if .test() called before + if (this.__index__ >= 0 && this.__text_cache__ === text) { + result.push(createMatch(this, shift)); + shift = this.__last_index__; + } + + // Cut head if cache was used + var tail = shift ? text.slice(shift) : text; + + // Scan string until end reached + while (this.test(tail)) { + result.push(createMatch(this, shift)); + + tail = tail.slice(this.__last_index__); + shift += this.__last_index__; + } + + if (result.length) { + return result; + } + + return null; + }; + + /** chainable + * LinkifyIt#tlds(list [, keepOld]) -> this + * - list (Array): list of tlds + * - keepOld (Boolean): merge with current list if `true` (`false` by default) + * + * Load (or merge) new tlds list. Those are user for fuzzy links (without prefix) + * to avoid false positives. By default this algorythm used: + * + * - hostname with any 2-letter root zones are ok. + * - biz|com|edu|gov|net|org|pro|web|xxx|aero|asia|coop|info|museum|name|shop|рф + * are ok. + * - encoded (`xn--...`) root zones are ok. + * + * If list is replaced, then exact match for 2-chars root zones will be checked. + **/ + LinkifyIt.prototype.tlds = function tlds(list, keepOld) { + list = Array.isArray(list) ? list : [list]; + + if (!keepOld) { + this.__tlds__ = list.slice(); + this.__tlds_replaced__ = true; + compile(this); + return this; + } + + this.__tlds__ = this.__tlds__ + .concat(list) + .sort() + .filter(function (el, idx, arr) { + return el !== arr[idx - 1]; + }) + .reverse(); + + compile(this); + return this; + }; + + /** + * LinkifyIt#normalize(match) + * + * Default normalizer (if schema does not define it's own). + **/ + LinkifyIt.prototype.normalize = function normalize(match) { + // Do minimal possible changes by default. Need to collect feedback prior + // to move forward https://github.com/markdown-it/linkify-it/issues/1 + + if (!match.schema) { + match.url = "http://" + match.url; + } + + if (match.schema === "mailto:" && !/^mailto:/i.test(match.url)) { + match.url = "mailto:" + match.url; + } + }; + + /** + * LinkifyIt#onCompile() + * + * Override to modify basic RegExp-s. + **/ + LinkifyIt.prototype.onCompile = function onCompile() {}; + + module.exports = LinkifyIt; + }, + { "./lib/re": 54 }, + ], + 54: [ + function (require, module, exports) { + "use strict"; + + module.exports = function (opts) { + var re = {}; + + // Use direct extract instead of `regenerate` to reduse browserified size + re.src_Any = require("uc.micro/properties/Any/regex").source; + re.src_Cc = require("uc.micro/categories/Cc/regex").source; + re.src_Z = require("uc.micro/categories/Z/regex").source; + re.src_P = require("uc.micro/categories/P/regex").source; + + // \p{\Z\P\Cc\CF} (white spaces + control + format + punctuation) + re.src_ZPCc = [re.src_Z, re.src_P, re.src_Cc].join("|"); + + // \p{\Z\Cc} (white spaces + control) + re.src_ZCc = [re.src_Z, re.src_Cc].join("|"); + + // Experimental. List of chars, completely prohibited in links + // because can separate it from other part of text + var text_separators = "[><\uff5c]"; + + // All possible word characters (everything without punctuation, spaces & controls) + // Defined via punctuation & spaces to save space + // Should be something like \p{\L\N\S\M} (\w but without `_`) + re.src_pseudo_letter = + "(?:(?!" + + text_separators + + "|" + + re.src_ZPCc + + ")" + + re.src_Any + + ")"; + // The same as abothe but without [0-9] + // var src_pseudo_letter_non_d = '(?:(?![0-9]|' + src_ZPCc + ')' + src_Any + ')'; + + //////////////////////////////////////////////////////////////////////////////// + + re.src_ip4 = + "(?:(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)"; + + // Prohibit any of "@/[]()" in user/pass to avoid wrong domain fetch. + re.src_auth = "(?:(?:(?!" + re.src_ZCc + "|[@/\\[\\]()]).)+@)?"; + + re.src_port = + "(?::(?:6(?:[0-4]\\d{3}|5(?:[0-4]\\d{2}|5(?:[0-2]\\d|3[0-5])))|[1-5]?\\d{1,4}))?"; + + re.src_host_terminator = + "(?=$|" + + text_separators + + "|" + + re.src_ZPCc + + ")(?!-|_|:\\d|\\.-|\\.(?!$|" + + re.src_ZPCc + + "))"; + + re.src_path = + "(?:" + + "[/?#]" + + "(?:" + + "(?!" + + re.src_ZCc + + "|" + + text_separators + + "|[()[\\]{}.,\"'?!\\-]).|" + + "\\[(?:(?!" + + re.src_ZCc + + "|\\]).)*\\]|" + + "\\((?:(?!" + + re.src_ZCc + + "|[)]).)*\\)|" + + "\\{(?:(?!" + + re.src_ZCc + + "|[}]).)*\\}|" + + '\\"(?:(?!' + + re.src_ZCc + + '|["]).)+\\"|' + + "\\'(?:(?!" + + re.src_ZCc + + "|[']).)+\\'|" + + "\\'(?=" + + re.src_pseudo_letter + + "|[-]).|" + // allow `I'm_king` if no pair found + "\\.{2,3}[a-zA-Z0-9%/]|" + // github has ... in commit range links. Restrict to + // - english + // - percent-encoded + // - parts of file path + // until more examples found. + "\\.(?!" + + re.src_ZCc + + "|[.]).|" + + (opts && opts["---"] + ? "\\-(?!--(?:[^-]|$))(?:-*)|" // `---` => long dash, terminate + : "\\-+|") + + "\\,(?!" + + re.src_ZCc + + ").|" + // allow `,,,` in paths + "\\!(?!" + + re.src_ZCc + + "|[!]).|" + + "\\?(?!" + + re.src_ZCc + + "|[?])." + + ")+" + + "|\\/" + + ")?"; + + re.src_email_name = '[\\-;:&=\\+\\$,\\"\\.a-zA-Z0-9_]+'; + + re.src_xn = "xn--[a-z0-9\\-]{1,59}"; + + // More to read about domain names + // http://serverfault.com/questions/638260/ + + re.src_domain_root = + // Allow letters & digits (http://test1) + "(?:" + re.src_xn + "|" + re.src_pseudo_letter + "{1,63}" + ")"; + + re.src_domain = + "(?:" + + re.src_xn + + "|" + + "(?:" + + re.src_pseudo_letter + + ")" + + "|" + + // don't allow `--` in domain names, because: + // - that can conflict with markdown — / – + // - nobody use those anyway + "(?:" + + re.src_pseudo_letter + + "(?:-(?!-)|" + + re.src_pseudo_letter + + "){0,61}" + + re.src_pseudo_letter + + ")" + + ")"; + + re.src_host = + "(?:" + + // Don't need IP check, because digits are already allowed in normal domain names + // src_ip4 + + // '|' + + "(?:(?:(?:" + + re.src_domain + + ")\\.)*" + + re.src_domain /*_root*/ + + ")" + + ")"; + + re.tpl_host_fuzzy = + "(?:" + + re.src_ip4 + + "|" + + "(?:(?:(?:" + + re.src_domain + + ")\\.)+(?:%TLDS%))" + + ")"; + + re.tpl_host_no_ip_fuzzy = + "(?:(?:(?:" + re.src_domain + ")\\.)+(?:%TLDS%))"; + + re.src_host_strict = re.src_host + re.src_host_terminator; + + re.tpl_host_fuzzy_strict = + re.tpl_host_fuzzy + re.src_host_terminator; + + re.src_host_port_strict = + re.src_host + re.src_port + re.src_host_terminator; + + re.tpl_host_port_fuzzy_strict = + re.tpl_host_fuzzy + re.src_port + re.src_host_terminator; + + re.tpl_host_port_no_ip_fuzzy_strict = + re.tpl_host_no_ip_fuzzy + re.src_port + re.src_host_terminator; + + //////////////////////////////////////////////////////////////////////////////// + // Main rules + + // Rude test fuzzy links by host, for quick deny + re.tpl_host_fuzzy_test = + "localhost|www\\.|\\.\\d{1,3}\\.|(?:\\.(?:%TLDS%)(?:" + + re.src_ZPCc + + "|>|$))"; + + re.tpl_email_fuzzy = + "(^|" + + text_separators + + "|\\(|" + + re.src_ZCc + + ")(" + + re.src_email_name + + "@" + + re.tpl_host_fuzzy_strict + + ")"; + + re.tpl_link_fuzzy = + // Fuzzy link can't be prepended with .:/\- and non punctuation. + // but can start with > (markdown blockquote) + "(^|(?![.:/\\-_@])(?:[$+<=>^`|\uff5c]|" + + re.src_ZPCc + + "))" + + "((?![$+<=>^`|\uff5c])" + + re.tpl_host_port_fuzzy_strict + + re.src_path + + ")"; + + re.tpl_link_no_ip_fuzzy = + // Fuzzy link can't be prepended with .:/\- and non punctuation. + // but can start with > (markdown blockquote) + "(^|(?![.:/\\-_@])(?:[$+<=>^`|\uff5c]|" + + re.src_ZPCc + + "))" + + "((?![$+<=>^`|\uff5c])" + + re.tpl_host_port_no_ip_fuzzy_strict + + re.src_path + + ")"; + + return re; + }; + }, + { + "uc.micro/categories/Cc/regex": 61, + "uc.micro/categories/P/regex": 63, + "uc.micro/categories/Z/regex": 64, + "uc.micro/properties/Any/regex": 66, + }, + ], + 55: [ + function (require, module, exports) { + "use strict"; + + /* eslint-disable no-bitwise */ + + var decodeCache = {}; + + function getDecodeCache(exclude) { + var i, + ch, + cache = decodeCache[exclude]; + if (cache) { + return cache; + } + + cache = decodeCache[exclude] = []; + + for (i = 0; i < 128; i++) { + ch = String.fromCharCode(i); + cache.push(ch); + } + + for (i = 0; i < exclude.length; i++) { + ch = exclude.charCodeAt(i); + cache[ch] = "%" + ("0" + ch.toString(16).toUpperCase()).slice(-2); + } + + return cache; + } + + // Decode percent-encoded string. + // + function decode(string, exclude) { + var cache; + + if (typeof exclude !== "string") { + exclude = decode.defaultChars; + } + + cache = getDecodeCache(exclude); + + return string.replace(/(%[a-f0-9]{2})+/gi, function (seq) { + var i, + l, + b1, + b2, + b3, + b4, + chr, + result = ""; + + for (i = 0, l = seq.length; i < l; i += 3) { + b1 = parseInt(seq.slice(i + 1, i + 3), 16); + + if (b1 < 0x80) { + result += cache[b1]; + continue; + } + + if ((b1 & 0xe0) === 0xc0 && i + 3 < l) { + // 110xxxxx 10xxxxxx + b2 = parseInt(seq.slice(i + 4, i + 6), 16); + + if ((b2 & 0xc0) === 0x80) { + chr = ((b1 << 6) & 0x7c0) | (b2 & 0x3f); + + if (chr < 0x80) { + result += "\ufffd\ufffd"; + } else { + result += String.fromCharCode(chr); + } + + i += 3; + continue; + } + } + + if ((b1 & 0xf0) === 0xe0 && i + 6 < l) { + // 1110xxxx 10xxxxxx 10xxxxxx + b2 = parseInt(seq.slice(i + 4, i + 6), 16); + b3 = parseInt(seq.slice(i + 7, i + 9), 16); + + if ((b2 & 0xc0) === 0x80 && (b3 & 0xc0) === 0x80) { + chr = + ((b1 << 12) & 0xf000) | ((b2 << 6) & 0xfc0) | (b3 & 0x3f); + + if (chr < 0x800 || (chr >= 0xd800 && chr <= 0xdfff)) { + result += "\ufffd\ufffd\ufffd"; + } else { + result += String.fromCharCode(chr); + } + + i += 6; + continue; + } + } + + if ((b1 & 0xf8) === 0xf0 && i + 9 < l) { + // 111110xx 10xxxxxx 10xxxxxx 10xxxxxx + b2 = parseInt(seq.slice(i + 4, i + 6), 16); + b3 = parseInt(seq.slice(i + 7, i + 9), 16); + b4 = parseInt(seq.slice(i + 10, i + 12), 16); + + if ( + (b2 & 0xc0) === 0x80 && + (b3 & 0xc0) === 0x80 && + (b4 & 0xc0) === 0x80 + ) { + chr = + ((b1 << 18) & 0x1c0000) | + ((b2 << 12) & 0x3f000) | + ((b3 << 6) & 0xfc0) | + (b4 & 0x3f); + + if (chr < 0x10000 || chr > 0x10ffff) { + result += "\ufffd\ufffd\ufffd\ufffd"; + } else { + chr -= 0x10000; + result += String.fromCharCode( + 0xd800 + (chr >> 10), + 0xdc00 + (chr & 0x3ff), + ); + } + + i += 9; + continue; + } + } + + result += "\ufffd"; + } + + return result; + }); + } + + decode.defaultChars = ";/?:@&=+$,#"; + decode.componentChars = ""; + + module.exports = decode; + }, + {}, + ], + 56: [ + function (require, module, exports) { + "use strict"; + + var encodeCache = {}; + + // Create a lookup array where anything but characters in `chars` string + // and alphanumeric chars is percent-encoded. + // + function getEncodeCache(exclude) { + var i, + ch, + cache = encodeCache[exclude]; + if (cache) { + return cache; + } + + cache = encodeCache[exclude] = []; + + for (i = 0; i < 128; i++) { + ch = String.fromCharCode(i); + + if (/^[0-9a-z]$/i.test(ch)) { + // always allow unencoded alphanumeric characters + cache.push(ch); + } else { + cache.push( + "%" + ("0" + i.toString(16).toUpperCase()).slice(-2), + ); + } + } + + for (i = 0; i < exclude.length; i++) { + cache[exclude.charCodeAt(i)] = exclude[i]; + } + + return cache; + } + + // Encode unsafe characters with percent-encoding, skipping already + // encoded sequences. + // + // - string - string to encode + // - exclude - list of characters to ignore (in addition to a-zA-Z0-9) + // - keepEscaped - don't encode '%' in a correct escape sequence (default: true) + // + function encode(string, exclude, keepEscaped) { + var i, + l, + code, + nextCode, + cache, + result = ""; + + if (typeof exclude !== "string") { + // encode(string, keepEscaped) + keepEscaped = exclude; + exclude = encode.defaultChars; + } + + if (typeof keepEscaped === "undefined") { + keepEscaped = true; + } + + cache = getEncodeCache(exclude); + + for (i = 0, l = string.length; i < l; i++) { + code = string.charCodeAt(i); + + if (keepEscaped && code === 0x25 /* % */ && i + 2 < l) { + if (/^[0-9a-f]{2}$/i.test(string.slice(i + 1, i + 3))) { + result += string.slice(i, i + 3); + i += 2; + continue; + } + } + + if (code < 128) { + result += cache[code]; + continue; + } + + if (code >= 0xd800 && code <= 0xdfff) { + if (code >= 0xd800 && code <= 0xdbff && i + 1 < l) { + nextCode = string.charCodeAt(i + 1); + if (nextCode >= 0xdc00 && nextCode <= 0xdfff) { + result += encodeURIComponent(string[i] + string[i + 1]); + i++; + continue; + } + } + result += "%EF%BF%BD"; + continue; + } + + result += encodeURIComponent(string[i]); + } + + return result; + } + + encode.defaultChars = ";/?:@&=+$,-_.!~*'()#"; + encode.componentChars = "-_.!~*'()"; + + module.exports = encode; + }, + {}, + ], + 57: [ + function (require, module, exports) { + "use strict"; + + module.exports = function format(url) { + var result = ""; + + result += url.protocol || ""; + result += url.slashes ? "//" : ""; + result += url.auth ? url.auth + "@" : ""; + + if (url.hostname && url.hostname.indexOf(":") !== -1) { + // ipv6 address + result += "[" + url.hostname + "]"; + } else { + result += url.hostname || ""; + } + + result += url.port ? ":" + url.port : ""; + result += url.pathname || ""; + result += url.search || ""; + result += url.hash || ""; + + return result; + }; + }, + {}, + ], + 58: [ + function (require, module, exports) { + "use strict"; + + module.exports.encode = require("./encode"); + module.exports.decode = require("./decode"); + module.exports.format = require("./format"); + module.exports.parse = require("./parse"); + }, + { "./decode": 55, "./encode": 56, "./format": 57, "./parse": 59 }, + ], + 59: [ + function (require, module, exports) { + // Copyright Joyent, Inc. and other Node contributors. + // + // Permission is hereby granted, free of charge, to any person obtaining a + // copy of this software and associated documentation files (the + // "Software"), to deal in the Software without restriction, including + // without limitation the rights to use, copy, modify, merge, publish, + // distribute, sublicense, and/or sell copies of the Software, and to permit + // persons to whom the Software is furnished to do so, subject to the + // following conditions: + // + // The above copyright notice and this permission notice shall be included + // in all copies or substantial portions of the Software. + // + // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN + // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, + // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE + // USE OR OTHER DEALINGS IN THE SOFTWARE. + + "use strict"; + + // + // Changes from joyent/node: + // + // 1. No leading slash in paths, + // e.g. in `url.parse('http://foo?bar')` pathname is ``, not `/` + // + // 2. Backslashes are not replaced with slashes, + // so `http:\\example.org\` is treated like a relative path + // + // 3. Trailing colon is treated like a part of the path, + // i.e. in `http://example.org:foo` pathname is `:foo` + // + // 4. Nothing is URL-encoded in the resulting object, + // (in joyent/node some chars in auth and paths are encoded) + // + // 5. `url.parse()` does not have `parseQueryString` argument + // + // 6. Removed extraneous result properties: `host`, `path`, `query`, etc., + // which can be constructed using other parts of the url. + // + + function Url() { + this.protocol = null; + this.slashes = null; + this.auth = null; + this.port = null; + this.hostname = null; + this.hash = null; + this.search = null; + this.pathname = null; + } + + // Reference: RFC 3986, RFC 1808, RFC 2396 + + // define these here so at least they only have to be + // compiled once on the first module load. + var protocolPattern = /^([a-z0-9.+-]+:)/i, + portPattern = /:[0-9]*$/, + // Special case for a simple path URL + simplePathPattern = /^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/, + // RFC 2396: characters reserved for delimiting URLs. + // We actually just auto-escape these. + delims = ["<", ">", '"', "`", " ", "\r", "\n", "\t"], + // RFC 2396: characters not allowed for various reasons. + unwise = ["{", "}", "|", "\\", "^", "`"].concat(delims), + // Allowed by RFCs, but cause of XSS attacks. Always escape these. + autoEscape = ["'"].concat(unwise), + // Characters that are never ever allowed in a hostname. + // Note that any invalid chars are also handled, but these + // are the ones that are *expected* to be seen, so we fast-path + // them. + nonHostChars = ["%", "/", "?", ";", "#"].concat(autoEscape), + hostEndingChars = ["/", "?", "#"], + hostnameMaxLen = 255, + hostnamePartPattern = /^[+a-z0-9A-Z_-]{0,63}$/, + hostnamePartStart = /^([+a-z0-9A-Z_-]{0,63})(.*)$/, + // protocols that can allow "unsafe" and "unwise" chars. + /* eslint-disable no-script-url */ + // protocols that never have a hostname. + hostlessProtocol = { + javascript: true, + "javascript:": true, + }, + // protocols that always contain a // bit. + slashedProtocol = { + http: true, + https: true, + ftp: true, + gopher: true, + file: true, + "http:": true, + "https:": true, + "ftp:": true, + "gopher:": true, + "file:": true, + }; + /* eslint-enable no-script-url */ + + function urlParse(url, slashesDenoteHost) { + if (url && url instanceof Url) { + return url; + } + + var u = new Url(); + u.parse(url, slashesDenoteHost); + return u; + } + + Url.prototype.parse = function (url, slashesDenoteHost) { + var i, + l, + lowerProto, + hec, + slashes, + rest = url; + + // trim before proceeding. + // This is to support parse stuff like " http://foo.com \n" + rest = rest.trim(); + + if (!slashesDenoteHost && url.split("#").length === 1) { + // Try fast path regexp + var simplePath = simplePathPattern.exec(rest); + if (simplePath) { + this.pathname = simplePath[1]; + if (simplePath[2]) { + this.search = simplePath[2]; + } + return this; + } + } + + var proto = protocolPattern.exec(rest); + if (proto) { + proto = proto[0]; + lowerProto = proto.toLowerCase(); + this.protocol = proto; + rest = rest.substr(proto.length); + } + + // figure out if it's got a host + // user@server is *always* interpreted as a hostname, and url + // resolution will treat //foo/bar as host=foo,path=bar because that's + // how the browser resolves relative URLs. + if ( + slashesDenoteHost || + proto || + rest.match(/^\/\/[^@\/]+@[^@\/]+/) + ) { + slashes = rest.substr(0, 2) === "//"; + if (slashes && !(proto && hostlessProtocol[proto])) { + rest = rest.substr(2); + this.slashes = true; + } + } + + if ( + !hostlessProtocol[proto] && + (slashes || (proto && !slashedProtocol[proto])) + ) { + // there's a hostname. + // the first instance of /, ?, ;, or # ends the host. + // + // If there is an @ in the hostname, then non-host chars *are* allowed + // to the left of the last @ sign, unless some host-ending character + // comes *before* the @-sign. + // URLs are obnoxious. + // + // ex: + // http://a@b@c/ => user:a@b host:c + // http://a@b?@c => user:a host:c path:/?@c + + // v0.12 TODO(isaacs): This is not quite how Chrome does things. + // Review our test case against browsers more comprehensively. + + // find the first instance of any hostEndingChars + var hostEnd = -1; + for (i = 0; i < hostEndingChars.length; i++) { + hec = rest.indexOf(hostEndingChars[i]); + if (hec !== -1 && (hostEnd === -1 || hec < hostEnd)) { + hostEnd = hec; + } + } + + // at this point, either we have an explicit point where the + // auth portion cannot go past, or the last @ char is the decider. + var auth, atSign; + if (hostEnd === -1) { + // atSign can be anywhere. + atSign = rest.lastIndexOf("@"); + } else { + // atSign must be in auth portion. + // http://a@b/c@d => host:b auth:a path:/c@d + atSign = rest.lastIndexOf("@", hostEnd); + } + + // Now we have a portion which is definitely the auth. + // Pull that off. + if (atSign !== -1) { + auth = rest.slice(0, atSign); + rest = rest.slice(atSign + 1); + this.auth = auth; + } + + // the host is the remaining to the left of the first non-host char + hostEnd = -1; + for (i = 0; i < nonHostChars.length; i++) { + hec = rest.indexOf(nonHostChars[i]); + if (hec !== -1 && (hostEnd === -1 || hec < hostEnd)) { + hostEnd = hec; + } + } + // if we still have not hit it, then the entire thing is a host. + if (hostEnd === -1) { + hostEnd = rest.length; + } + + if (rest[hostEnd - 1] === ":") { + hostEnd--; + } + var host = rest.slice(0, hostEnd); + rest = rest.slice(hostEnd); + + // pull out port. + this.parseHost(host); + + // we've indicated that there is a hostname, + // so even if it's empty, it has to be present. + this.hostname = this.hostname || ""; + + // if hostname begins with [ and ends with ] + // assume that it's an IPv6 address. + var ipv6Hostname = + this.hostname[0] === "[" && + this.hostname[this.hostname.length - 1] === "]"; + + // validate a little. + if (!ipv6Hostname) { + var hostparts = this.hostname.split(/\./); + for (i = 0, l = hostparts.length; i < l; i++) { + var part = hostparts[i]; + if (!part) { + continue; + } + if (!part.match(hostnamePartPattern)) { + var newpart = ""; + for (var j = 0, k = part.length; j < k; j++) { + if (part.charCodeAt(j) > 127) { + // we replace non-ASCII char with a temporary placeholder + // we need this to make sure size of hostname is not + // broken by replacing non-ASCII by nothing + newpart += "x"; + } else { + newpart += part[j]; + } + } + // we test again with ASCII char only + if (!newpart.match(hostnamePartPattern)) { + var validParts = hostparts.slice(0, i); + var notHost = hostparts.slice(i + 1); + var bit = part.match(hostnamePartStart); + if (bit) { + validParts.push(bit[1]); + notHost.unshift(bit[2]); + } + if (notHost.length) { + rest = notHost.join(".") + rest; + } + this.hostname = validParts.join("."); + break; + } + } + } + } + + if (this.hostname.length > hostnameMaxLen) { + this.hostname = ""; + } + + // strip [ and ] from the hostname + // the host field still retains them, though + if (ipv6Hostname) { + this.hostname = this.hostname.substr( + 1, + this.hostname.length - 2, + ); + } + } + + // chop off from the tail first. + var hash = rest.indexOf("#"); + if (hash !== -1) { + // got a fragment string. + this.hash = rest.substr(hash); + rest = rest.slice(0, hash); + } + var qm = rest.indexOf("?"); + if (qm !== -1) { + this.search = rest.substr(qm); + rest = rest.slice(0, qm); + } + if (rest) { + this.pathname = rest; + } + if ( + slashedProtocol[lowerProto] && + this.hostname && + !this.pathname + ) { + this.pathname = ""; + } + + return this; + }; + + Url.prototype.parseHost = function (host) { + var port = portPattern.exec(host); + if (port) { + port = port[0]; + if (port !== ":") { + this.port = port.substr(1); + } + host = host.substr(0, host.length - port.length); + } + if (host) { + this.hostname = host; + } + }; + + module.exports = urlParse; + }, + {}, + ], + 60: [ + function (require, module, exports) { + (function (global) { + /*! https://mths.be/punycode v1.4.1 by @mathias */ + (function (root) { + /** Detect free variables */ + var freeExports = + typeof exports == "object" && + exports && + !exports.nodeType && + exports; + var freeModule = + typeof module == "object" && + module && + !module.nodeType && + module; + var freeGlobal = typeof global == "object" && global; + if ( + freeGlobal.global === freeGlobal || + freeGlobal.window === freeGlobal || + freeGlobal.self === freeGlobal + ) { + root = freeGlobal; + } + + /** + * The `punycode` object. + * @name punycode + * @type Object + */ + var punycode, + /** Highest positive signed 32-bit float value */ + maxInt = 2147483647, // aka. 0x7FFFFFFF or 2^31-1 + /** Bootstring parameters */ + base = 36, + tMin = 1, + tMax = 26, + skew = 38, + damp = 700, + initialBias = 72, + initialN = 128, // 0x80 + delimiter = "-", // '\x2D' + /** Regular expressions */ + regexPunycode = /^xn--/, + regexNonASCII = /[^\x20-\x7E]/, // unprintable ASCII chars + non-ASCII chars + regexSeparators = /[\x2E\u3002\uFF0E\uFF61]/g, // RFC 3490 separators + /** Error messages */ + errors = { + overflow: "Overflow: input needs wider integers to process", + "not-basic": "Illegal input >= 0x80 (not a basic code point)", + "invalid-input": "Invalid input", + }, + /** Convenience shortcuts */ + baseMinusTMin = base - tMin, + floor = Math.floor, + stringFromCharCode = String.fromCharCode, + /** Temporary variable */ + key; + + /*--------------------------------------------------------------------------*/ + + /** + * A generic error utility function. + * @private + * @param {String} type The error type. + * @returns {Error} Throws a `RangeError` with the applicable error message. + */ + function error(type) { + throw new RangeError(errors[type]); + } + + /** + * A generic `Array#map` utility function. + * @private + * @param {Array} array The array to iterate over. + * @param {Function} callback The function that gets called for every array + * item. + * @returns {Array} A new array of values returned by the callback function. + */ + function map(array, fn) { + var length = array.length; + var result = []; + while (length--) { + result[length] = fn(array[length]); + } + return result; + } + + /** + * A simple `Array#map`-like wrapper to work with domain name strings or email + * addresses. + * @private + * @param {String} domain The domain name or email address. + * @param {Function} callback The function that gets called for every + * character. + * @returns {Array} A new string of characters returned by the callback + * function. + */ + function mapDomain(string, fn) { + var parts = string.split("@"); + var result = ""; + if (parts.length > 1) { + // In email addresses, only the domain name should be punycoded. Leave + // the local part (i.e. everything up to `@`) intact. + result = parts[0] + "@"; + string = parts[1]; + } + // Avoid `split(regex)` for IE8 compatibility. See #17. + string = string.replace(regexSeparators, "\x2E"); + var labels = string.split("."); + var encoded = map(labels, fn).join("."); + return result + encoded; + } + + /** + * Creates an array containing the numeric code points of each Unicode + * character in the string. While JavaScript uses UCS-2 internally, + * this function will convert a pair of surrogate halves (each of which + * UCS-2 exposes as separate characters) into a single code point, + * matching UTF-16. + * @see `punycode.ucs2.encode` + * @see + * @memberOf punycode.ucs2 + * @name decode + * @param {String} string The Unicode input string (UCS-2). + * @returns {Array} The new array of code points. + */ + function ucs2decode(string) { + var output = [], + counter = 0, + length = string.length, + value, + extra; + while (counter < length) { + value = string.charCodeAt(counter++); + if (value >= 0xd800 && value <= 0xdbff && counter < length) { + // high surrogate, and there is a next character + extra = string.charCodeAt(counter++); + if ((extra & 0xfc00) == 0xdc00) { + // low surrogate + output.push( + ((value & 0x3ff) << 10) + (extra & 0x3ff) + 0x10000, + ); + } else { + // unmatched surrogate; only append this code unit, in case the next + // code unit is the high surrogate of a surrogate pair + output.push(value); + counter--; + } + } else { + output.push(value); + } + } + return output; + } + + /** + * Creates a string based on an array of numeric code points. + * @see `punycode.ucs2.decode` + * @memberOf punycode.ucs2 + * @name encode + * @param {Array} codePoints The array of numeric code points. + * @returns {String} The new Unicode string (UCS-2). + */ + function ucs2encode(array) { + return map(array, function (value) { + var output = ""; + if (value > 0xffff) { + value -= 0x10000; + output += stringFromCharCode( + ((value >>> 10) & 0x3ff) | 0xd800, + ); + value = 0xdc00 | (value & 0x3ff); + } + output += stringFromCharCode(value); + return output; + }).join(""); + } + + /** + * Converts a basic code point into a digit/integer. + * @see `digitToBasic()` + * @private + * @param {Number} codePoint The basic numeric code point value. + * @returns {Number} The numeric value of a basic code point (for use in + * representing integers) in the range `0` to `base - 1`, or `base` if + * the code point does not represent a value. + */ + function basicToDigit(codePoint) { + if (codePoint - 48 < 10) { + return codePoint - 22; + } + if (codePoint - 65 < 26) { + return codePoint - 65; + } + if (codePoint - 97 < 26) { + return codePoint - 97; + } + return base; + } + + /** + * Converts a digit/integer into a basic code point. + * @see `basicToDigit()` + * @private + * @param {Number} digit The numeric value of a basic code point. + * @returns {Number} The basic code point whose value (when used for + * representing integers) is `digit`, which needs to be in the range + * `0` to `base - 1`. If `flag` is non-zero, the uppercase form is + * used; else, the lowercase form is used. The behavior is undefined + * if `flag` is non-zero and `digit` has no uppercase form. + */ + function digitToBasic(digit, flag) { + // 0..25 map to ASCII a..z or A..Z + // 26..35 map to ASCII 0..9 + return digit + 22 + 75 * (digit < 26) - ((flag != 0) << 5); + } + + /** + * Bias adaptation function as per section 3.4 of RFC 3492. + * https://tools.ietf.org/html/rfc3492#section-3.4 + * @private + */ + function adapt(delta, numPoints, firstTime) { + var k = 0; + delta = firstTime ? floor(delta / damp) : delta >> 1; + delta += floor(delta / numPoints); + for ( + ; + /* no initialization */ delta > (baseMinusTMin * tMax) >> 1; + k += base + ) { + delta = floor(delta / baseMinusTMin); + } + return floor( + k + ((baseMinusTMin + 1) * delta) / (delta + skew), + ); + } + + /** + * Converts a Punycode string of ASCII-only symbols to a string of Unicode + * symbols. + * @memberOf punycode + * @param {String} input The Punycode string of ASCII-only symbols. + * @returns {String} The resulting string of Unicode symbols. + */ + function decode(input) { + // Don't use UCS-2 + var output = [], + inputLength = input.length, + out, + i = 0, + n = initialN, + bias = initialBias, + basic, + j, + index, + oldi, + w, + k, + digit, + t, + /** Cached calculation results */ + baseMinusT; + + // Handle the basic code points: let `basic` be the number of input code + // points before the last delimiter, or `0` if there is none, then copy + // the first basic code points to the output. + + basic = input.lastIndexOf(delimiter); + if (basic < 0) { + basic = 0; + } + + for (j = 0; j < basic; ++j) { + // if it's not a basic code point + if (input.charCodeAt(j) >= 0x80) { + error("not-basic"); + } + output.push(input.charCodeAt(j)); + } + + // Main decoding loop: start just after the last delimiter if any basic code + // points were copied; start at the beginning otherwise. + + for ( + index = basic > 0 ? basic + 1 : 0; + index < inputLength /* no final expression */; + + ) { + // `index` is the index of the next character to be consumed. + // Decode a generalized variable-length integer into `delta`, + // which gets added to `i`. The overflow checking is easier + // if we increase `i` as we go, then subtract off its starting + // value at the end to obtain `delta`. + for ( + oldi = i, w = 1, k = base /* no condition */; + ; + k += base + ) { + if (index >= inputLength) { + error("invalid-input"); + } + + digit = basicToDigit(input.charCodeAt(index++)); + + if (digit >= base || digit > floor((maxInt - i) / w)) { + error("overflow"); + } + + i += digit * w; + t = k <= bias ? tMin : k >= bias + tMax ? tMax : k - bias; + + if (digit < t) { + break; + } + + baseMinusT = base - t; + if (w > floor(maxInt / baseMinusT)) { + error("overflow"); + } + + w *= baseMinusT; + } + + out = output.length + 1; + bias = adapt(i - oldi, out, oldi == 0); + + // `i` was supposed to wrap around from `out` to `0`, + // incrementing `n` each time, so we'll fix that now: + if (floor(i / out) > maxInt - n) { + error("overflow"); + } + + n += floor(i / out); + i %= out; + + // Insert `n` at position `i` of the output + output.splice(i++, 0, n); + } + + return ucs2encode(output); + } + + /** + * Converts a string of Unicode symbols (e.g. a domain name label) to a + * Punycode string of ASCII-only symbols. + * @memberOf punycode + * @param {String} input The string of Unicode symbols. + * @returns {String} The resulting Punycode string of ASCII-only symbols. + */ + function encode(input) { + var n, + delta, + handledCPCount, + basicLength, + bias, + j, + m, + q, + k, + t, + currentValue, + output = [], + /** `inputLength` will hold the number of code points in `input`. */ + inputLength, + /** Cached calculation results */ + handledCPCountPlusOne, + baseMinusT, + qMinusT; + + // Convert the input in UCS-2 to Unicode + input = ucs2decode(input); + + // Cache the length + inputLength = input.length; + + // Initialize the state + n = initialN; + delta = 0; + bias = initialBias; + + // Handle the basic code points + for (j = 0; j < inputLength; ++j) { + currentValue = input[j]; + if (currentValue < 0x80) { + output.push(stringFromCharCode(currentValue)); + } + } + + handledCPCount = basicLength = output.length; + + // `handledCPCount` is the number of code points that have been handled; + // `basicLength` is the number of basic code points. + + // Finish the basic string - if it is not empty - with a delimiter + if (basicLength) { + output.push(delimiter); + } + + // Main encoding loop: + while (handledCPCount < inputLength) { + // All non-basic code points < n have been handled already. Find the next + // larger one: + for (m = maxInt, j = 0; j < inputLength; ++j) { + currentValue = input[j]; + if (currentValue >= n && currentValue < m) { + m = currentValue; + } + } + + // Increase `delta` enough to advance the decoder's state to , + // but guard against overflow + handledCPCountPlusOne = handledCPCount + 1; + if (m - n > floor((maxInt - delta) / handledCPCountPlusOne)) { + error("overflow"); + } + + delta += (m - n) * handledCPCountPlusOne; + n = m; + + for (j = 0; j < inputLength; ++j) { + currentValue = input[j]; + + if (currentValue < n && ++delta > maxInt) { + error("overflow"); + } + + if (currentValue == n) { + // Represent delta as a generalized variable-length integer + for ( + q = delta, k = base /* no condition */; + ; + k += base + ) { + t = + k <= bias ? tMin : k >= bias + tMax ? tMax : k - bias; + if (q < t) { + break; + } + qMinusT = q - t; + baseMinusT = base - t; + output.push( + stringFromCharCode( + digitToBasic(t + (qMinusT % baseMinusT), 0), + ), + ); + q = floor(qMinusT / baseMinusT); + } + + output.push(stringFromCharCode(digitToBasic(q, 0))); + bias = adapt( + delta, + handledCPCountPlusOne, + handledCPCount == basicLength, + ); + delta = 0; + ++handledCPCount; + } + } + + ++delta; + ++n; + } + return output.join(""); + } + + /** + * Converts a Punycode string representing a domain name or an email address + * to Unicode. Only the Punycoded parts of the input will be converted, i.e. + * it doesn't matter if you call it on a string that has already been + * converted to Unicode. + * @memberOf punycode + * @param {String} input The Punycoded domain name or email address to + * convert to Unicode. + * @returns {String} The Unicode representation of the given Punycode + * string. + */ + function toUnicode(input) { + return mapDomain(input, function (string) { + return regexPunycode.test(string) + ? decode(string.slice(4).toLowerCase()) + : string; + }); + } + + /** + * Converts a Unicode string representing a domain name or an email address to + * Punycode. Only the non-ASCII parts of the domain name will be converted, + * i.e. it doesn't matter if you call it with a domain that's already in + * ASCII. + * @memberOf punycode + * @param {String} input The domain name or email address to convert, as a + * Unicode string. + * @returns {String} The Punycode representation of the given domain name or + * email address. + */ + function toASCII(input) { + return mapDomain(input, function (string) { + return regexNonASCII.test(string) + ? "xn--" + encode(string) + : string; + }); + } + + /*--------------------------------------------------------------------------*/ + + /** Define the public API */ + punycode = { + /** + * A string representing the current Punycode.js version number. + * @memberOf punycode + * @type String + */ + version: "1.4.1", + /** + * An object of methods to convert from JavaScript's internal character + * representation (UCS-2) to Unicode code points, and back. + * @see + * @memberOf punycode + * @type Object + */ + ucs2: { + decode: ucs2decode, + encode: ucs2encode, + }, + decode: decode, + encode: encode, + toASCII: toASCII, + toUnicode: toUnicode, + }; + + /** Expose `punycode` */ + // Some AMD build optimizers, like r.js, check for specific condition patterns + // like the following: + if ( + typeof define == "function" && + typeof define.amd == "object" && + define.amd + ) { + define("punycode", function () { + return punycode; + }); + } else if (freeExports && freeModule) { + if (module.exports == freeExports) { + // in Node.js, io.js, or RingoJS v0.8.0+ + freeModule.exports = punycode; + } else { + // in Narwhal or RingoJS v0.7.0- + for (key in punycode) { + punycode.hasOwnProperty(key) && + (freeExports[key] = punycode[key]); + } + } + } else { + // in Rhino or a web browser + root.punycode = punycode; + } + })(this); + }).call( + this, + typeof global !== "undefined" + ? global + : typeof self !== "undefined" + ? self + : typeof window !== "undefined" + ? window + : {}, + ); + }, + {}, + ], + 61: [ + function (require, module, exports) { + module.exports = /[\0-\x1F\x7F-\x9F]/; + }, + {}, + ], + 62: [ + function (require, module, exports) { + module.exports = + /[\xAD\u0600-\u0605\u061C\u06DD\u070F\u08E2\u180E\u200B-\u200F\u202A-\u202E\u2060-\u2064\u2066-\u206F\uFEFF\uFFF9-\uFFFB]|\uD804\uDCBD|\uD82F[\uDCA0-\uDCA3]|\uD834[\uDD73-\uDD7A]|\uDB40[\uDC01\uDC20-\uDC7F]/; + }, + {}, + ], + 63: [ + function (require, module, exports) { + module.exports = + /[!-#%-\*,-/:;\?@\[-\]_\{\}\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u09FD\u0AF0\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166D\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E49\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC9\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDC4B-\uDC4F\uDC5B\uDC5D\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDE60-\uDE6C\uDF3C-\uDF3E]|\uD806[\uDE3F-\uDE46\uDE9A-\uDE9C\uDE9E-\uDEA2]|\uD807[\uDC41-\uDC45\uDC70\uDC71]|\uD809[\uDC70-\uDC74]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]|\uD83A[\uDD5E\uDD5F]/; + }, + {}, + ], + 64: [ + function (require, module, exports) { + module.exports = /[ \xA0\u1680\u2000-\u200A\u202F\u205F\u3000]/; + }, + {}, + ], + 65: [ + function (require, module, exports) { + "use strict"; + + exports.Any = require("./properties/Any/regex"); + exports.Cc = require("./categories/Cc/regex"); + exports.Cf = require("./categories/Cf/regex"); + exports.P = require("./categories/P/regex"); + exports.Z = require("./categories/Z/regex"); + }, + { + "./categories/Cc/regex": 61, + "./categories/Cf/regex": 62, + "./categories/P/regex": 63, + "./categories/Z/regex": 64, + "./properties/Any/regex": 66, + }, + ], + 66: [ + function (require, module, exports) { + module.exports = + /[\0-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/; + }, + {}, + ], + 67: [ + function (require, module, exports) { + "use strict"; + + module.exports = require("./lib/"); + }, + { "./lib/": 9 }, + ], + }, + {}, + [67], + )(67); +}); diff --git a/txt2tags-it/txt2tags-it.qml b/txt2tags-it/txt2tags-it.qml new file mode 100644 index 0000000..1922e92 --- /dev/null +++ b/txt2tags-it/txt2tags-it.qml @@ -0,0 +1,177 @@ +import QOwnNotesTypes 1.0 +import QtQml 2.0 +import "markdown-it-deflist.js" as MarkdownItDeflist +import "markdown-it-katex.js" as MarkdownItKatex +import "markdown-it-txt2tags.js" as MarkdownItTxt2tags +import "markdown-it.js" as MarkdownIt + +QtObject { + property string customStylesheet + property variant md + property string options + property variant settingsVariables: [ + { + "identifier": "options", + "name": "Markdown-it options", + "description": "For available options and default values see markdown-it presets.", + "type": "text", + "default": "{" + "\n" + " //html: false, // Enable HTML tags in source" + "\n" + " //xhtmlOut: false, // Use '/' to close single tags (
)" + "\n" + " //breaks: false, // Convert '\\n' in paragraphs into
" + "\n" + " //langPrefix: 'language-', // CSS language prefix for fenced blocks" + "\n" + " //linkify: false, // autoconvert URL-like texts to links" + "\n" + "" + "\n" + " // Enable some language-neutral replacements + quotes beautification" + "\n" + " //typographer: false," + "\n" + "" + "\n" + " // Double + single quotes replacement pairs, when typographer enabled," + "\n" + " // and smartquotes on. Could be either a String or an Array." + "\n" + " //" + "\n" + " // For example, you can use '«»„“' for Russian, '„“‚‘' for German," + "\n" + " // and ['«\\xA0', '\\xA0»', '‹\\xA0', '\\xA0›'] for French (including nbsp)." + "\n" + " //quotes: '\\u201c\\u201d\\u2018\\u2019', /* “”‘’ */" + "\n" + "" + "\n" + " // Highlighter function. Should return escaped HTML," + "\n" + " // or '' if the source string is not changed and should be escaped externaly." + "\n" + " // If result starts with ) plugin", + "type": "boolean", + "default": false + }, + { + "identifier": "useKatexPlugin", + "name": "LaTeX Support", + "text": "Enable the Markdown-it definition list KaTeX plugin", + "type": "boolean", + "default": false + }, + { + "identifier": "useTxt2tagsPlugin", + "name": "txt2tags syntax", + "text": "Enable txt2tags heading syntax (= H1 =, == H2 ==, …)", + "type": "boolean", + "default": true + }, + { + "identifier": "useEditorHighlighting", + "name": "txt2tags editor highlighting", + "text": "Enable txt2tags heading syntax highlighting in the editor", + "type": "boolean", + "default": true + }, + { + "identifier": "customStylesheet", + "name": "Custom stylesheet", + "description": "Please enter your custom stylesheet:", + "type": "text", + "default": null + } + ] + property bool useDeflistPlugin + property bool useKatexPlugin + property bool useTxt2tagsPlugin + property bool useEditorHighlighting + + function init() { + var optionsObj = eval("(" + options + ")"); + md = new this.markdownit(optionsObj); + if (useDeflistPlugin) + md.use(this.markdownitDeflist); + + if (useKatexPlugin) + this.markdownItKatex(md, { + "output": "mathml" + }); + + if (useTxt2tagsPlugin) + md.use(this.markdownitTxt2tags); + + if (useTxt2tagsPlugin && useEditorHighlighting) { + // Headings: = H1 = == H2 == … + script.addHighlightingRule("^= +.+? +=\\s*$", "=", 12); + script.addHighlightingRule("^== +.+? +==\\s*$", "=", 13); + script.addHighlightingRule("^=== +.+? +===\\s*$", "=", 14); + script.addHighlightingRule("^==== +.+? +====\\s*$", "=", 15); + script.addHighlightingRule("^===== +.+? +=====\\s*$", "=", 16); + // Inline: //italic// __underline__ --strikethrough-- + script.addHighlightingRule("//.+?//", "//", 7); + script.addHighlightingRule("__.+?__", "__", 31); + script.addHighlightingRule("--.+?--", "--", -1, 0, 0, + { foregroundColor: "#888888" }); + // Ordered list: + item + script.addHighlightingRule("^\\+ .+$", "+", 12); + // Comment: % until end of line + script.addHighlightingRule("^%.*$", "%", 11); + } + + //Allow file:// url scheme + var validateLinkOrig = md.validateLink; + var GOOD_PROTO_RE = /^(file):/; + md.validateLink = function (url) { + var str = url.trim().toLowerCase(); + return GOOD_PROTO_RE.test(str) ? true : validateLinkOrig(url); + }; + } + function isProtocolUrl(url) { + return /^[a-zA-Z][\w+.-]*:\/\//.test(url); + } + function isUnixAbsolute(path) { + return path.startsWith('/'); + } + function isWindowsAbsolute(path) { + return /^[a-zA-Z]:[\\/]/.test(path); + } + + /** + * This function is called when the markdown html of a note is generated + * + * It allows you to modify this html + * This is for example called before by the note preview + * + * The method can be used in multiple scripts to modify the html of the preview + * + * @param {NoteApi} note - the note object + * @param {string} html - the html that is about to being rendered + * @param {string} forExport - the html is used for an export, false for the preview + * @return {string} the modified html or an empty string if nothing should be modified + */ + function noteToMarkdownHtmlHook(note, html, forExport) { + var mdHtml = md.render(note.noteText); + //Insert root folder in attachments and media relative urls + var path = script.currentNoteFolderPath(); + if (script.platformIsWindows()) + path = "/" + path; + + mdHtml = mdHtml.replace(/(\b(?:src|href|data-[\w-]+)\s*=\s*["'])([^"']+)["']/gi, (_, prefix, rawPath) => { + // Convert backslashes to forward slashes for URL + + if (isProtocolUrl(rawPath)) + return `${prefix}${rawPath}"`; + + let finalPath; + if (isUnixAbsolute(rawPath) || isWindowsAbsolute(rawPath)) + // Absolute path (Unix or Windows) + finalPath = rawPath.replace(/\\/g, '/'); + else + // Relative path → resolve against base + finalPath = resolvePath(basePath, rawPath.replace(/^\.\/+/, '')); + return `${prefix}file://${finalPath}"`; + }); + // Don't attempt to render in the preview, it doesn't support mathml or complex css + if (!forExport && useKatexPlugin) + mdHtml = mdHtml.replace(/(]*>)([\s\S]*?)(<\/math>)/gi, (fullMatch, openMathTag, mathInner, closeMathTag) => { + let blockPresent = /\bdisplay="block"/i.test(openMathTag); + let out = blockPresent ? '
' + openMathTag : ' ' + openMathTag; + out += mathInner.replace(/(]*>)([\s\S]*?)(<\/semantics>)/gi, (semiMatch, openSemi, semiInner, closeSemi) => { + const cleaned = semiInner.replace(/]*>[\s\S]*?<\/mrow>/gi, ''); + return openSemi + cleaned + closeSemi; + }); + out += blockPresent ? closeMathTag + '
' : closeMathTag + '
 '; + return out; + }); + + //Get original styles + var head = html.match(new RegExp("(?:.|\n)*?"))[0]; + //Add custom styles + head = head.replace("", "table {border-spacing: 0; border-style: solid; border-width: 1px; border-collapse: collapse; margin-top: 0.5em;} th, td {padding: 0 5px;} del {text-decoration: line-through;}" + customStylesheet + ""); + mdHtml = "" + head + "" + mdHtml + ""; + return mdHtml; + } + function resolvePath(base, relative) { + const baseParts = base.replace(/\/+$/, '').split('/'); + const relParts = relative.replace(/^\.\/+/, '').split('/'); + for (const part of relParts) { + if (part === '..') + baseParts.pop(); + else if (part !== '.' && part !== '') + baseParts.push(part); + } + return baseParts.join('/'); + } +} From 8ab43f164309f6546e9f83303f8e7fb4c47de37e Mon Sep 17 00:00:00 2001 From: luginf Date: Tue, 14 Apr 2026 20:37:19 +0200 Subject: [PATCH 02/16] fix: strikethrough, HTML options default, link rules ordering MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Enable html:true by default so HTML comments () are passed through as-is instead of being escaped as visible text - Fix --strikethrough-- to use tag instead of , consistent with markdown ~~strikethrough~~ rendering - Remove + item ordered list editor highlighting rule (was applying an unwanted heading style to list lines) - Fix basePath undefined variable → path in relative URL resolution - Register txt2tags_link before adding autolink/wikilink rules: ruler.before("txt2tags_link", ...) threw "Parser rule not found" when called before txt2tags_link was itself registered, aborting the entire plugin initialisation and breaking all txt2tags rendering Co-Authored-By: Claude Sonnet 4.6 --- txt2tags-it/markdown-it-txt2tags.js | 73 ++++++++++++++++++++++++++++- txt2tags-it/txt2tags-it.qml | 40 ++++------------ 2 files changed, 81 insertions(+), 32 deletions(-) diff --git a/txt2tags-it/markdown-it-txt2tags.js b/txt2tags-it/markdown-it-txt2tags.js index f8c5184..55bfb1b 100644 --- a/txt2tags-it/markdown-it-txt2tags.js +++ b/txt2tags-it/markdown-it-txt2tags.js @@ -246,6 +246,75 @@ } ); + // ── Inline: bare URLs ──────────────────────────────────────────────────── + // Matches scheme://... URLs that appear without brackets. + // Registered BEFORE the text rule so the text rule doesn't consume the + // leading letters (it stops at '/' but would first consume e.g. "http:"). + md.inline.ruler.before( + "text", + "txt2tags_autolink", + function (state, silent) { + var pos = state.pos; + var src = state.src; + // Must start with a URL scheme (letters then "://") + var match = /^[a-zA-Z][\w+\-.]*:\/\/[^\s\]]*/.exec(src.slice(pos)); + if (!match) return false; + var url = match[0]; + // Strip trailing punctuation that is unlikely to be part of the URL + url = url.replace(/[.,;:!?)]+$/, ""); + if (!url) return false; + if (!silent) { + var token = state.push("link_open", "a", 1); + token.attrs = [["href", url]]; + token.markup = "autolink"; + state.push("text", "", 0).content = url; + state.push("link_close", "a", -1).markup = "autolink"; + } + state.pos = pos + url.length; + return true; + } + ); + + // ── Inline: [[wikilink]] and [[wikilink|description]] ──────────────────── + // Registered BEFORE 'txt2tags_link' (and therefore before 'link') so that + // the double-bracket syntax is consumed before any single-bracket rule. + md.inline.ruler.before( + "txt2tags_link", + "txt2tags_wikilink", + function (state, silent) { + var pos = state.pos; + var src = state.src; + // Must start with [[ + if (src.charCodeAt(pos) !== 0x5B || src.charCodeAt(pos + 1) !== 0x5B) return false; + var closePos = src.indexOf("]]", pos + 2); + if (closePos < 0) return false; + var content = src.slice(pos + 2, closePos); + if (!content) return false; + // Split on first '|' to get optional description + var pipePos = content.indexOf("|"); + var target, label; + if (pipePos >= 0) { + target = content.slice(0, pipePos); + label = content.slice(pipePos + 1); + } else { + target = content; + label = content; + } + if (!target) return false; + // Append .md so the QOwnNotes hook resolves to a note file path + var href = /\.md$/i.test(target) ? target : (target + ".md"); + if (!silent) { + var token = state.push("link_open", "a", 1); + token.attrs = [["href", href]]; + token.markup = "wikilink"; + state.push("text", "", 0).content = label; + state.push("link_close", "a", -1).markup = "wikilink"; + } + state.pos = closePos + 2; + return true; + } + ); + // ── Inline: --strikethrough-- ───────────────────────────────────────────── md.inline.ruler.push( "txt2tags_strike", @@ -257,9 +326,9 @@ var end = src.indexOf("--", start); if (end < 0 || end === start) return false; if (!silent) { - state.push("txt2tags_del_open", "del", 1); + state.push("txt2tags_s_open", "s", 1); state.push("text", "", 0).content = src.slice(start, end); - state.push("txt2tags_del_close", "del", -1); + state.push("txt2tags_s_close", "s", -1); } state.pos = end + 2; return true; diff --git a/txt2tags-it/txt2tags-it.qml b/txt2tags-it/txt2tags-it.qml index 1922e92..1c618f5 100644 --- a/txt2tags-it/txt2tags-it.qml +++ b/txt2tags-it/txt2tags-it.qml @@ -15,7 +15,7 @@ QtObject { "name": "Markdown-it options", "description": "For available options and default values see markdown-it presets.", "type": "text", - "default": "{" + "\n" + " //html: false, // Enable HTML tags in source" + "\n" + " //xhtmlOut: false, // Use '/' to close single tags (
)" + "\n" + " //breaks: false, // Convert '\\n' in paragraphs into
" + "\n" + " //langPrefix: 'language-', // CSS language prefix for fenced blocks" + "\n" + " //linkify: false, // autoconvert URL-like texts to links" + "\n" + "" + "\n" + " // Enable some language-neutral replacements + quotes beautification" + "\n" + " //typographer: false," + "\n" + "" + "\n" + " // Double + single quotes replacement pairs, when typographer enabled," + "\n" + " // and smartquotes on. Could be either a String or an Array." + "\n" + " //" + "\n" + " // For example, you can use '«»„“' for Russian, '„“‚‘' for German," + "\n" + " // and ['«\\xA0', '\\xA0»', '‹\\xA0', '\\xA0›'] for French (including nbsp)." + "\n" + " //quotes: '\\u201c\\u201d\\u2018\\u2019', /* “”‘’ */" + "\n" + "" + "\n" + " // Highlighter function. Should return escaped HTML," + "\n" + " // or '' if the source string is not changed and should be escaped externaly." + "\n" + " // If result starts with )" + "\n" + " //breaks: false, // Convert '\\n' in paragraphs into
" + "\n" + " //langPrefix: 'language-', // CSS language prefix for fenced blocks" + "\n" + " //linkify: false, // autoconvert URL-like texts to links" + "\n" + "" + "\n" + " // Enable some language-neutral replacements + quotes beautification" + "\n" + " //typographer: false," + "\n" + "" + "\n" + " // Double + single quotes replacement pairs, when typographer enabled," + "\n" + " // and smartquotes on. Could be either a String or an Array." + "\n" + " //" + "\n" + " // For example, you can use '«»„“' for Russian, '„“‚‘' for German," + "\n" + " // and ['«\\xA0', '\\xA0»', '‹\\xA0', '\\xA0›'] for French (including nbsp)." + "\n" + " //quotes: '\\u201c\\u201d\\u2018\\u2019', /* “”‘’ */" + "\n" + "" + "\n" + " // Highlighter function. Should return escaped HTML," + "\n" + " // or '' if the source string is not changed and should be escaped externaly." + "\n" + " // If result starts with ) before rendering: with html:false + // (default) markdown-it escapes them as visible text instead of hiding them. + var noteText = note.noteText.replace(//g, ''); + var mdHtml = md.render(noteText); //Insert root folder in attachments and media relative urls var path = script.currentNoteFolderPath(); if (script.platformIsWindows()) @@ -140,7 +117,7 @@ QtObject { finalPath = rawPath.replace(/\\/g, '/'); else // Relative path → resolve against base - finalPath = resolvePath(basePath, rawPath.replace(/^\.\/+/, '')); + finalPath = resolvePath(path, rawPath.replace(/^\.\/+/, '')); return `${prefix}file://${finalPath}"`; }); // Don't attempt to render in the preview, it doesn't support mathml or complex css @@ -159,7 +136,10 @@ QtObject { //Get original styles var head = html.match(new RegExp("(?:.|\n)*?"))[0]; //Add custom styles - head = head.replace("", "table {border-spacing: 0; border-style: solid; border-width: 1px; border-collapse: collapse; margin-top: 0.5em;} th, td {padding: 0 5px;} del {text-decoration: line-through;}" + customStylesheet + ""); + var css = "table {border-spacing: 0; border-style: solid; border-width: 1px; border-collapse: collapse; margin-top: 0.5em;} th, td {padding: 0 5px;} del {text-decoration: line-through;}"; + if (customStylesheet) + css += customStylesheet; + head = head.replace("", css + ""); mdHtml = "" + head + "" + mdHtml + ""; return mdHtml; } From b33b8be45646ea882c19c86b301d29f19f2336fe Mon Sep 17 00:00:00 2001 From: luginf Date: Tue, 14 Apr 2026 20:50:32 +0200 Subject: [PATCH 03/16] updating and fixing --- txt2tags-it/README.md | 0 txt2tags-it/info.json | 0 txt2tags-it/markdown-it-deflist.js | 0 txt2tags-it/markdown-it-katex.js | 0 txt2tags-it/markdown-it-txt2tags.js | 0 txt2tags-it/markdown-it.js | 0 txt2tags-it/txt2tags-it.qml | 34 ++++++++++++++++++++++------- 7 files changed, 26 insertions(+), 8 deletions(-) mode change 100644 => 100755 txt2tags-it/README.md mode change 100644 => 100755 txt2tags-it/info.json mode change 100644 => 100755 txt2tags-it/markdown-it-deflist.js mode change 100644 => 100755 txt2tags-it/markdown-it-katex.js mode change 100644 => 100755 txt2tags-it/markdown-it-txt2tags.js mode change 100644 => 100755 txt2tags-it/markdown-it.js mode change 100644 => 100755 txt2tags-it/txt2tags-it.qml diff --git a/txt2tags-it/README.md b/txt2tags-it/README.md old mode 100644 new mode 100755 diff --git a/txt2tags-it/info.json b/txt2tags-it/info.json old mode 100644 new mode 100755 diff --git a/txt2tags-it/markdown-it-deflist.js b/txt2tags-it/markdown-it-deflist.js old mode 100644 new mode 100755 diff --git a/txt2tags-it/markdown-it-katex.js b/txt2tags-it/markdown-it-katex.js old mode 100644 new mode 100755 diff --git a/txt2tags-it/markdown-it-txt2tags.js b/txt2tags-it/markdown-it-txt2tags.js old mode 100644 new mode 100755 diff --git a/txt2tags-it/markdown-it.js b/txt2tags-it/markdown-it.js old mode 100644 new mode 100755 diff --git a/txt2tags-it/txt2tags-it.qml b/txt2tags-it/txt2tags-it.qml old mode 100644 new mode 100755 index 1c618f5..58cc08d --- a/txt2tags-it/txt2tags-it.qml +++ b/txt2tags-it/txt2tags-it.qml @@ -38,6 +38,13 @@ QtObject { "type": "boolean", "default": true }, + { + "identifier": "useEditorHighlighting", + "name": "txt2tags editor highlighting", + "text": "Enable txt2tags heading syntax highlighting in the editor", + "type": "boolean", + "default": true + }, { "identifier": "customStylesheet", "name": "Custom stylesheet", @@ -49,6 +56,7 @@ QtObject { property bool useDeflistPlugin property bool useKatexPlugin property bool useTxt2tagsPlugin + property bool useEditorHighlighting function init() { var optionsObj = eval("(" + options + ")"); @@ -64,6 +72,22 @@ QtObject { if (useTxt2tagsPlugin) md.use(this.markdownitTxt2tags); + if (useTxt2tagsPlugin && useEditorHighlighting) { + // Headings: = H1 = == H2 == … + script.addHighlightingRule("^= +.+? +=\\s*$", "=", 12); + script.addHighlightingRule("^== +.+? +==\\s*$", "=", 13); + script.addHighlightingRule("^=== +.+? +===\\s*$", "=", 14); + script.addHighlightingRule("^==== +.+? +====\\s*$", "=", 15); + script.addHighlightingRule("^===== +.+? +=====\\s*$", "=", 16); + // Inline: //italic// __underline__ --strikethrough-- + script.addHighlightingRule("//.+?//", "//", 7); + script.addHighlightingRule("__.+?__", "__", 31); + script.addHighlightingRule("--.+?--", "--", -1, 0, 0, + { foregroundColor: "#888888" }); + // Comment: % until end of line + script.addHighlightingRule("^%.*$", "%", 11); + } + //Allow file:// url scheme var validateLinkOrig = md.validateLink; var GOOD_PROTO_RE = /^(file):/; @@ -96,10 +120,7 @@ QtObject { * @return {string} the modified html or an empty string if nothing should be modified */ function noteToMarkdownHtmlHook(note, html, forExport) { - // Strip HTML comments () before rendering: with html:false - // (default) markdown-it escapes them as visible text instead of hiding them. - var noteText = note.noteText.replace(//g, ''); - var mdHtml = md.render(noteText); + var mdHtml = md.render(note.noteText); //Insert root folder in attachments and media relative urls var path = script.currentNoteFolderPath(); if (script.platformIsWindows()) @@ -136,10 +157,7 @@ QtObject { //Get original styles var head = html.match(new RegExp("(?:.|\n)*?"))[0]; //Add custom styles - var css = "table {border-spacing: 0; border-style: solid; border-width: 1px; border-collapse: collapse; margin-top: 0.5em;} th, td {padding: 0 5px;} del {text-decoration: line-through;}"; - if (customStylesheet) - css += customStylesheet; - head = head.replace("", css + ""); + head = head.replace("", "table {border-spacing: 0; border-style: solid; border-width: 1px; border-collapse: collapse; margin-top: 0.5em;} th, td {padding: 0 5px;} del {text-decoration: line-through;}" + customStylesheet + ""); mdHtml = "" + head + "" + mdHtml + ""; return mdHtml; } From edf9e8ca5ecb5e6c6e23e06a163568cd80165350 Mon Sep 17 00:00:00 2001 From: luginf Date: Tue, 14 Apr 2026 20:56:40 +0200 Subject: [PATCH 04/16] fix version and credits --- txt2tags-it/info.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/txt2tags-it/info.json b/txt2tags-it/info.json index cd8b516..7ef639c 100755 --- a/txt2tags-it/info.json +++ b/txt2tags-it/info.json @@ -8,8 +8,8 @@ "markdown-it-katex.js", "markdown-it-txt2tags.js" ], - "authors": ["@milan-rusev", "@bessw", "@cjendantix"], - "version": "1.5", - "minAppVersion": "20.6.0", - "description": "This script replaces the default markdown renderer with markdown-it and allows for optional LaTeX rendering support with the Markdown-It KaTeX plugin. (NOTE: LaTeX defaults to rendering with MathML ONLY). \n\nDependencies\nmarkdown-it.js (v8.4.2 bundled with the script)\nMarkdown-It KaTeX plugin (v0.18.0 bundled with the script)\n\nUsage\nFor the possible configuration options check here.\n\nImportant\nThis script currently only works with legacy media links. You can turn them on in the General Settings.\n\nImportant note: You need to use legacy image linking with this script, otherwise there will be no images shown in the preview!" + "authors": ["@luginf"], + "version": "0.1", + "minAppVersion": "26.4.11", + "description": "This script, based on markdown-it, replaces the default markdown renderer with markdown-it AND also with the txt2tags syntax. It also allows for optional LaTeX rendering support with the Markdown-It KaTeX plugin. (NOTE: LaTeX defaults to rendering with MathML ONLY). \n\nDependencies\nmarkdown-it.js (v8.4.2 bundled with the script)\nMarkdown-It KaTeX plugin (v0.18.0 bundled with the script)\n\nUsage\nFor the possible configuration options check here.\n\nImportant\nThis script currently only works with legacy media links. You can turn them on in the General Settings.\n\nImportant note: You need to use legacy image linking with this script, otherwise there will be no images shown in the preview!" } From 525f497aaf4e9fe96e68ef94a99cb66eea85d425 Mon Sep 17 00:00:00 2001 From: luginf Date: Wed, 15 Apr 2026 01:09:51 +0200 Subject: [PATCH 05/16] =?UTF-8?q?fix:=20Qt6=20compatibility=20=E2=80=94=20?= =?UTF-8?q?resolve=20markdown-it=20constructors=20via=20module=20namespace?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In Qt5, importing a JS file in QML binds the module's top-level `this` to the QML global scope, so UMD modules export their constructors onto the component via `g = this; g.markdownit = f()`, and `this.markdownit` works in init(). In Qt6, the module's top-level `this` is the module namespace object (e.g. MarkdownIt, MarkdownItTxt2tags), not the QML component scope. So the constructors land on `MarkdownIt.markdownit` etc., and `this.markdownit` in init() is undefined — causing silent init failure and a blank preview. Fix: resolve each constructor with `Namespace.name || this.name` so that Qt6 uses the module namespace and Qt5 falls back to the component scope. Co-Authored-By: Claude Sonnet 4.6 --- txt2tags-it/txt2tags-it.qml | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/txt2tags-it/txt2tags-it.qml b/txt2tags-it/txt2tags-it.qml index 58cc08d..e7f07fe 100755 --- a/txt2tags-it/txt2tags-it.qml +++ b/txt2tags-it/txt2tags-it.qml @@ -60,17 +60,28 @@ QtObject { function init() { var optionsObj = eval("(" + options + ")"); - md = new this.markdownit(optionsObj); - if (useDeflistPlugin) - md.use(this.markdownitDeflist); + // Qt5: module `this` = QML global → constructor lands on component scope → this.markdownit works + // Qt6: module `this` = module namespace → constructor lands on MarkdownIt.markdownit + var markdownitCtor = (typeof MarkdownIt !== "undefined" && MarkdownIt.markdownit) + ? MarkdownIt.markdownit : this.markdownit; + md = new markdownitCtor(optionsObj); + if (useDeflistPlugin) { + var deflistPlugin = (typeof MarkdownItDeflist !== "undefined" && MarkdownItDeflist.markdownitDeflist) + ? MarkdownItDeflist.markdownitDeflist : this.markdownitDeflist; + md.use(deflistPlugin); + } - if (useKatexPlugin) - this.markdownItKatex(md, { - "output": "mathml" - }); + if (useKatexPlugin) { + var katexFn = (typeof MarkdownItKatex !== "undefined" && MarkdownItKatex.markdownItKatex) + ? MarkdownItKatex.markdownItKatex : this.markdownItKatex; + katexFn(md, { "output": "mathml" }); + } - if (useTxt2tagsPlugin) - md.use(this.markdownitTxt2tags); + if (useTxt2tagsPlugin) { + var txt2tagsPlugin = (typeof MarkdownItTxt2tags !== "undefined" && MarkdownItTxt2tags.markdownitTxt2tags) + ? MarkdownItTxt2tags.markdownitTxt2tags : this.markdownitTxt2tags; + md.use(txt2tagsPlugin); + } if (useTxt2tagsPlugin && useEditorHighlighting) { // Headings: = H1 = == H2 == … From 394869d946d64b4827519ec73e25980b707ecc32 Mon Sep 17 00:00:00 2001 From: luginf Date: Wed, 15 Apr 2026 01:19:01 +0200 Subject: [PATCH 06/16] =?UTF-8?q?fix:=20Qt6=20UMD=20compat=20=E2=80=94=20u?= =?UTF-8?q?se=20globalThis=20when=20module=20this=20is=20undefined?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In Qt6 QML, JavaScript files imported via 'import "foo.js" as Foo' run in strict mode where `this` at the top level is undefined. The UMD wrappers in markdown-it, markdown-it-deflist, markdown-it-katex and markdown-it-txt2tags all fell back to `g = this` when window/global/self were undefined, then threw TypeError setting a property on undefined. Fix: insert `globalThis` before the `this` fallback in each UMD chain. globalThis is always the real global object in Qt6's JS engine. In init(), resolve constructors via `_g = globalThis || this` so that Qt6 uses globalThis (where the modules now export) and Qt5 falls back to the component scope (where the modules previously exported via this). Co-Authored-By: Claude Sonnet 4.6 --- txt2tags-it/markdown-it-deflist.js | 2 ++ txt2tags-it/markdown-it-katex.js | 3 ++- txt2tags-it/markdown-it-txt2tags.js | 2 ++ txt2tags-it/markdown-it.js | 2 ++ txt2tags-it/txt2tags-it.qml | 31 ++++++++++------------------- 5 files changed, 19 insertions(+), 21 deletions(-) diff --git a/txt2tags-it/markdown-it-deflist.js b/txt2tags-it/markdown-it-deflist.js index 13f63e5..1d0add4 100755 --- a/txt2tags-it/markdown-it-deflist.js +++ b/txt2tags-it/markdown-it-deflist.js @@ -13,6 +13,8 @@ g = global; } else if (typeof self !== "undefined") { g = self; + } else if (typeof globalThis !== "undefined") { + g = globalThis; } else { g = this; } diff --git a/txt2tags-it/markdown-it-katex.js b/txt2tags-it/markdown-it-katex.js index fe6f70d..cf31888 100755 --- a/txt2tags-it/markdown-it-katex.js +++ b/txt2tags-it/markdown-it-katex.js @@ -220,7 +220,8 @@ function _toPrimitive(t, r) { return ("string" === r ? String : Number)(t); } (function (factory) { - this.markdownItKatex = factory(); + var g = (typeof globalThis !== "undefined") ? globalThis : this; + g.markdownItKatex = factory(); })(function () { var escapeHtml = function escapeHtml(unsafeHTML) { return unsafeHTML diff --git a/txt2tags-it/markdown-it-txt2tags.js b/txt2tags-it/markdown-it-txt2tags.js index 55bfb1b..9895dfa 100755 --- a/txt2tags-it/markdown-it-txt2tags.js +++ b/txt2tags-it/markdown-it-txt2tags.js @@ -12,6 +12,8 @@ g = global; } else if (typeof self !== "undefined") { g = self; + } else if (typeof globalThis !== "undefined") { + g = globalThis; } else { g = this; } diff --git a/txt2tags-it/markdown-it.js b/txt2tags-it/markdown-it.js index a490b2a..e3e4191 100755 --- a/txt2tags-it/markdown-it.js +++ b/txt2tags-it/markdown-it.js @@ -13,6 +13,8 @@ g = global; } else if (typeof self !== "undefined") { g = self; + } else if (typeof globalThis !== "undefined") { + g = globalThis; } else { g = this; } diff --git a/txt2tags-it/txt2tags-it.qml b/txt2tags-it/txt2tags-it.qml index e7f07fe..20998da 100755 --- a/txt2tags-it/txt2tags-it.qml +++ b/txt2tags-it/txt2tags-it.qml @@ -60,28 +60,19 @@ QtObject { function init() { var optionsObj = eval("(" + options + ")"); - // Qt5: module `this` = QML global → constructor lands on component scope → this.markdownit works - // Qt6: module `this` = module namespace → constructor lands on MarkdownIt.markdownit - var markdownitCtor = (typeof MarkdownIt !== "undefined" && MarkdownIt.markdownit) - ? MarkdownIt.markdownit : this.markdownit; - md = new markdownitCtor(optionsObj); - if (useDeflistPlugin) { - var deflistPlugin = (typeof MarkdownItDeflist !== "undefined" && MarkdownItDeflist.markdownitDeflist) - ? MarkdownItDeflist.markdownitDeflist : this.markdownitDeflist; - md.use(deflistPlugin); - } + // UMD modules export via `g = globalThis || this` in the JS files. + // Qt5: `this` at module top-level = QML component scope → this.xxx works. + // Qt6: `this` at module top-level = undefined (strict mode) → globalThis used → access via globalThis.xxx. + var _g = (typeof globalThis !== "undefined") ? globalThis : this; + md = new _g.markdownit(optionsObj); + if (useDeflistPlugin) + md.use(_g.markdownitDeflist); - if (useKatexPlugin) { - var katexFn = (typeof MarkdownItKatex !== "undefined" && MarkdownItKatex.markdownItKatex) - ? MarkdownItKatex.markdownItKatex : this.markdownItKatex; - katexFn(md, { "output": "mathml" }); - } + if (useKatexPlugin) + _g.markdownItKatex(md, { "output": "mathml" }); - if (useTxt2tagsPlugin) { - var txt2tagsPlugin = (typeof MarkdownItTxt2tags !== "undefined" && MarkdownItTxt2tags.markdownitTxt2tags) - ? MarkdownItTxt2tags.markdownitTxt2tags : this.markdownitTxt2tags; - md.use(txt2tagsPlugin); - } + if (useTxt2tagsPlugin) + md.use(_g.markdownitTxt2tags); if (useTxt2tagsPlugin && useEditorHighlighting) { // Headings: = H1 = == H2 == … From 86145df44775fb02de732f32096d55c13fcf9fd0 Mon Sep 17 00:00:00 2001 From: luginf Date: Wed, 15 Apr 2026 01:26:01 +0200 Subject: [PATCH 07/16] =?UTF-8?q?fix:=20Qt6=20compat=20=E2=80=94=20top-lev?= =?UTF-8?q?el=20var=20export;=20remove=20deflist=20and=20katex?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The root cause of Qt6 breakage: UMD modules used `g = this; g.markdownit = f()` where `this` at module top-level is undefined in Qt6 strict mode, so the assignment threw and nothing was exported. Fix: declare `var markdownit` and `var markdownitTxt2tags` at the top level of each JS file (outside the IIFE). Top-level vars are always accessible via the QML module qualifier (MarkdownIt.markdownit, MarkdownItTxt2tags.markdownitTxt2tags) in both Qt5 and Qt6 — no runtime this/globalThis lookup needed. Also removed the unused deflist and katex plugins to simplify the script. Co-Authored-By: Claude Sonnet 4.6 --- txt2tags-it/markdown-it-txt2tags.js | 16 +- txt2tags-it/markdown-it.js | 19 +- txt2tags-it/txt2tags-it.qml | 313 ++++++++++++---------------- 3 files changed, 144 insertions(+), 204 deletions(-) diff --git a/txt2tags-it/markdown-it-txt2tags.js b/txt2tags-it/markdown-it-txt2tags.js index 9895dfa..0155165 100755 --- a/txt2tags-it/markdown-it-txt2tags.js +++ b/txt2tags-it/markdown-it-txt2tags.js @@ -1,23 +1,13 @@ /*! markdown-it-txt2tags - txt2tags syntax support for markdown-it */ +// Top-level var makes markdownitTxt2tags accessible as MarkdownItTxt2tags.markdownitTxt2tags in QML (Qt5 + Qt6). +var markdownitTxt2tags; (function (f) { if (typeof exports === "object" && typeof module !== "undefined") { module.exports = f(); } else if (typeof define === "function" && define.amd) { define([], f); } else { - var g; - if (typeof window !== "undefined") { - g = window; - } else if (typeof global !== "undefined") { - g = global; - } else if (typeof self !== "undefined") { - g = self; - } else if (typeof globalThis !== "undefined") { - g = globalThis; - } else { - g = this; - } - g.markdownitTxt2tags = f(); + markdownitTxt2tags = f(); } })(function () { "use strict"; diff --git a/txt2tags-it/markdown-it.js b/txt2tags-it/markdown-it.js index e3e4191..e399499 100755 --- a/txt2tags-it/markdown-it.js +++ b/txt2tags-it/markdown-it.js @@ -1,4 +1,7 @@ -/*! markdown-it 8.4.2 https://github.com//markdown-it/markdown-it @license MIT */ (function ( +/*! markdown-it 8.4.2 https://github.com//markdown-it/markdown-it @license MIT */ +// Top-level var makes markdownit accessible as MarkdownIt.markdownit in QML (Qt5 + Qt6). +var markdownit; +(function ( f, ) { if (typeof exports === "object" && typeof module !== "undefined") { @@ -6,19 +9,7 @@ } else if (typeof define === "function" && define.amd) { define([], f); } else { - var g; - if (typeof window !== "undefined") { - g = window; - } else if (typeof global !== "undefined") { - g = global; - } else if (typeof self !== "undefined") { - g = self; - } else if (typeof globalThis !== "undefined") { - g = globalThis; - } else { - g = this; - } - g.markdownit = f(); + markdownit = f(); } })(function () { var define, module, exports; diff --git a/txt2tags-it/txt2tags-it.qml b/txt2tags-it/txt2tags-it.qml index 20998da..4076021 100755 --- a/txt2tags-it/txt2tags-it.qml +++ b/txt2tags-it/txt2tags-it.qml @@ -1,177 +1,136 @@ -import QOwnNotesTypes 1.0 -import QtQml 2.0 -import "markdown-it-deflist.js" as MarkdownItDeflist -import "markdown-it-katex.js" as MarkdownItKatex -import "markdown-it-txt2tags.js" as MarkdownItTxt2tags -import "markdown-it.js" as MarkdownIt - -QtObject { - property string customStylesheet - property variant md - property string options - property variant settingsVariables: [ - { - "identifier": "options", - "name": "Markdown-it options", - "description": "For available options and default values see markdown-it presets.", - "type": "text", - "default": "{" + "\n" + " html: true, // Enable HTML tags in source" + "\n" + " //xhtmlOut: false, // Use '/' to close single tags (
)" + "\n" + " //breaks: false, // Convert '\\n' in paragraphs into
" + "\n" + " //langPrefix: 'language-', // CSS language prefix for fenced blocks" + "\n" + " //linkify: false, // autoconvert URL-like texts to links" + "\n" + "" + "\n" + " // Enable some language-neutral replacements + quotes beautification" + "\n" + " //typographer: false," + "\n" + "" + "\n" + " // Double + single quotes replacement pairs, when typographer enabled," + "\n" + " // and smartquotes on. Could be either a String or an Array." + "\n" + " //" + "\n" + " // For example, you can use '«»„“' for Russian, '„“‚‘' for German," + "\n" + " // and ['«\\xA0', '\\xA0»', '‹\\xA0', '\\xA0›'] for French (including nbsp)." + "\n" + " //quotes: '\\u201c\\u201d\\u2018\\u2019', /* “”‘’ */" + "\n" + "" + "\n" + " // Highlighter function. Should return escaped HTML," + "\n" + " // or '' if the source string is not changed and should be escaped externaly." + "\n" + " // If result starts with ) plugin", - "type": "boolean", - "default": false - }, - { - "identifier": "useKatexPlugin", - "name": "LaTeX Support", - "text": "Enable the Markdown-it definition list KaTeX plugin", - "type": "boolean", - "default": false - }, - { - "identifier": "useTxt2tagsPlugin", - "name": "txt2tags syntax", - "text": "Enable txt2tags heading syntax (= H1 =, == H2 ==, …)", - "type": "boolean", - "default": true - }, - { - "identifier": "useEditorHighlighting", - "name": "txt2tags editor highlighting", - "text": "Enable txt2tags heading syntax highlighting in the editor", - "type": "boolean", - "default": true - }, - { - "identifier": "customStylesheet", - "name": "Custom stylesheet", - "description": "Please enter your custom stylesheet:", - "type": "text", - "default": null - } - ] - property bool useDeflistPlugin - property bool useKatexPlugin - property bool useTxt2tagsPlugin - property bool useEditorHighlighting - - function init() { - var optionsObj = eval("(" + options + ")"); - // UMD modules export via `g = globalThis || this` in the JS files. - // Qt5: `this` at module top-level = QML component scope → this.xxx works. - // Qt6: `this` at module top-level = undefined (strict mode) → globalThis used → access via globalThis.xxx. - var _g = (typeof globalThis !== "undefined") ? globalThis : this; - md = new _g.markdownit(optionsObj); - if (useDeflistPlugin) - md.use(_g.markdownitDeflist); - - if (useKatexPlugin) - _g.markdownItKatex(md, { "output": "mathml" }); - - if (useTxt2tagsPlugin) - md.use(_g.markdownitTxt2tags); - - if (useTxt2tagsPlugin && useEditorHighlighting) { - // Headings: = H1 = == H2 == … - script.addHighlightingRule("^= +.+? +=\\s*$", "=", 12); - script.addHighlightingRule("^== +.+? +==\\s*$", "=", 13); - script.addHighlightingRule("^=== +.+? +===\\s*$", "=", 14); - script.addHighlightingRule("^==== +.+? +====\\s*$", "=", 15); - script.addHighlightingRule("^===== +.+? +=====\\s*$", "=", 16); - // Inline: //italic// __underline__ --strikethrough-- - script.addHighlightingRule("//.+?//", "//", 7); - script.addHighlightingRule("__.+?__", "__", 31); - script.addHighlightingRule("--.+?--", "--", -1, 0, 0, - { foregroundColor: "#888888" }); - // Comment: % until end of line - script.addHighlightingRule("^%.*$", "%", 11); - } - - //Allow file:// url scheme - var validateLinkOrig = md.validateLink; - var GOOD_PROTO_RE = /^(file):/; - md.validateLink = function (url) { - var str = url.trim().toLowerCase(); - return GOOD_PROTO_RE.test(str) ? true : validateLinkOrig(url); - }; - } - function isProtocolUrl(url) { - return /^[a-zA-Z][\w+.-]*:\/\//.test(url); - } - function isUnixAbsolute(path) { - return path.startsWith('/'); - } - function isWindowsAbsolute(path) { - return /^[a-zA-Z]:[\\/]/.test(path); - } - - /** - * This function is called when the markdown html of a note is generated - * - * It allows you to modify this html - * This is for example called before by the note preview - * - * The method can be used in multiple scripts to modify the html of the preview - * - * @param {NoteApi} note - the note object - * @param {string} html - the html that is about to being rendered - * @param {string} forExport - the html is used for an export, false for the preview - * @return {string} the modified html or an empty string if nothing should be modified - */ - function noteToMarkdownHtmlHook(note, html, forExport) { - var mdHtml = md.render(note.noteText); - //Insert root folder in attachments and media relative urls - var path = script.currentNoteFolderPath(); - if (script.platformIsWindows()) - path = "/" + path; - - mdHtml = mdHtml.replace(/(\b(?:src|href|data-[\w-]+)\s*=\s*["'])([^"']+)["']/gi, (_, prefix, rawPath) => { - // Convert backslashes to forward slashes for URL - - if (isProtocolUrl(rawPath)) - return `${prefix}${rawPath}"`; - - let finalPath; - if (isUnixAbsolute(rawPath) || isWindowsAbsolute(rawPath)) - // Absolute path (Unix or Windows) - finalPath = rawPath.replace(/\\/g, '/'); - else - // Relative path → resolve against base - finalPath = resolvePath(path, rawPath.replace(/^\.\/+/, '')); - return `${prefix}file://${finalPath}"`; - }); - // Don't attempt to render in the preview, it doesn't support mathml or complex css - if (!forExport && useKatexPlugin) - mdHtml = mdHtml.replace(/(]*>)([\s\S]*?)(<\/math>)/gi, (fullMatch, openMathTag, mathInner, closeMathTag) => { - let blockPresent = /\bdisplay="block"/i.test(openMathTag); - let out = blockPresent ? '
' + openMathTag : ' ' + openMathTag; - out += mathInner.replace(/(]*>)([\s\S]*?)(<\/semantics>)/gi, (semiMatch, openSemi, semiInner, closeSemi) => { - const cleaned = semiInner.replace(/]*>[\s\S]*?<\/mrow>/gi, ''); - return openSemi + cleaned + closeSemi; - }); - out += blockPresent ? closeMathTag + '
' : closeMathTag + '
 '; - return out; - }); - - //Get original styles - var head = html.match(new RegExp("(?:.|\n)*?"))[0]; - //Add custom styles - head = head.replace("", "table {border-spacing: 0; border-style: solid; border-width: 1px; border-collapse: collapse; margin-top: 0.5em;} th, td {padding: 0 5px;} del {text-decoration: line-through;}" + customStylesheet + ""); - mdHtml = "" + head + "" + mdHtml + ""; - return mdHtml; - } - function resolvePath(base, relative) { - const baseParts = base.replace(/\/+$/, '').split('/'); - const relParts = relative.replace(/^\.\/+/, '').split('/'); - for (const part of relParts) { - if (part === '..') - baseParts.pop(); - else if (part !== '.' && part !== '') - baseParts.push(part); - } - return baseParts.join('/'); - } -} +import QOwnNotesTypes 1.0 +import QtQml 2.0 +import "markdown-it-txt2tags.js" as MarkdownItTxt2tags +import "markdown-it.js" as MarkdownIt + +QtObject { + property string customStylesheet + property variant md + property string options + property variant settingsVariables: [ + { + "identifier": "options", + "name": "Markdown-it options", + "description": "For available options and default values see markdown-it presets.", + "type": "text", + "default": "{" + "\n" + " html: true, // Enable HTML tags in source" + "\n" + " //xhtmlOut: false, // Use '/' to close single tags (
)" + "\n" + " //breaks: false, // Convert '\\n' in paragraphs into
" + "\n" + " //langPrefix: 'language-', // CSS language prefix for fenced blocks" + "\n" + " //linkify: false, // autoconvert URL-like texts to links" + "\n" + "" + "\n" + " // Enable some language-neutral replacements + quotes beautification" + "\n" + " //typographer: false," + "\n" + "" + "\n" + " //maxNesting: 100 // Internal protection, recursion limit" + "\n" + "}" + }, + { + "identifier": "useTxt2tagsPlugin", + "name": "txt2tags syntax", + "text": "Enable txt2tags heading syntax (= H1 =, == H2 ==, …)", + "type": "boolean", + "default": true + }, + { + "identifier": "useEditorHighlighting", + "name": "txt2tags editor highlighting", + "text": "Enable txt2tags heading syntax highlighting in the editor", + "type": "boolean", + "default": true + }, + { + "identifier": "customStylesheet", + "name": "Custom stylesheet", + "description": "Please enter your custom stylesheet:", + "type": "text", + "default": null + } + ] + property bool useTxt2tagsPlugin + property bool useEditorHighlighting + + function init() { + var optionsObj = eval("(" + options + ")"); + // MarkdownIt.markdownit is a top-level var in markdown-it.js — accessible + // via the module qualifier in both Qt5 and Qt6 QML. + md = new MarkdownIt.markdownit(optionsObj); + + if (useTxt2tagsPlugin) + md.use(MarkdownItTxt2tags.markdownitTxt2tags); + + if (useTxt2tagsPlugin && useEditorHighlighting) { + // Headings: = H1 = == H2 == … + script.addHighlightingRule("^= +.+? +=\\s*$", "=", 12); + script.addHighlightingRule("^== +.+? +==\\s*$", "=", 13); + script.addHighlightingRule("^=== +.+? +===\\s*$", "=", 14); + script.addHighlightingRule("^==== +.+? +====\\s*$", "=", 15); + script.addHighlightingRule("^===== +.+? +=====\\s*$", "=", 16); + // Inline: //italic// __underline__ --strikethrough-- + script.addHighlightingRule("//.+?//", "//", 7); + script.addHighlightingRule("__.+?__", "__", 31); + script.addHighlightingRule("--.+?--", "--", -1, 0, 0, + { foregroundColor: "#888888" }); + // Comment: % until end of line + script.addHighlightingRule("^%.*$", "%", 11); + } + + //Allow file:// url scheme + var validateLinkOrig = md.validateLink; + var GOOD_PROTO_RE = /^(file):/; + md.validateLink = function (url) { + var str = url.trim().toLowerCase(); + return GOOD_PROTO_RE.test(str) ? true : validateLinkOrig(url); + }; + } + function isProtocolUrl(url) { + return /^[a-zA-Z][\w+.-]*:\/\//.test(url); + } + function isUnixAbsolute(path) { + return path.startsWith('/'); + } + function isWindowsAbsolute(path) { + return /^[a-zA-Z]:[\\/]/.test(path); + } + + /** + * This function is called when the markdown html of a note is generated + * + * It allows you to modify this html + * This is for example called before by the note preview + * + * The method can be used in multiple scripts to modify the html of the preview + * + * @param {NoteApi} note - the note object + * @param {string} html - the html that is about to being rendered + * @param {string} forExport - the html is used for an export, false for the preview + * @return {string} the modified html or an empty string if nothing should be modified + */ + function noteToMarkdownHtmlHook(note, html, forExport) { + var mdHtml = md.render(note.noteText); + //Insert root folder in attachments and media relative urls + var path = script.currentNoteFolderPath(); + if (script.platformIsWindows()) + path = "/" + path; + + mdHtml = mdHtml.replace(/(\b(?:src|href|data-[\w-]+)\s*=\s*["'])([^"']+)["']/gi, (_, prefix, rawPath) => { + if (isProtocolUrl(rawPath)) + return `${prefix}${rawPath}"`; + + let finalPath; + if (isUnixAbsolute(rawPath) || isWindowsAbsolute(rawPath)) + finalPath = rawPath.replace(/\\/g, '/'); + else + finalPath = resolvePath(path, rawPath.replace(/^\.\/+/, '')); + return `${prefix}file://${finalPath}"`; + }); + + //Get original styles + var head = html.match(new RegExp("(?:.|\n)*?"))[0]; + //Add custom styles + head = head.replace("", "table {border-spacing: 0; border-style: solid; border-width: 1px; border-collapse: collapse; margin-top: 0.5em;} th, td {padding: 0 5px;} del {text-decoration: line-through;}" + customStylesheet + ""); + mdHtml = "" + head + "" + mdHtml + ""; + return mdHtml; + } + function resolvePath(base, relative) { + const baseParts = base.replace(/\/+$/, '').split('/'); + const relParts = relative.replace(/^\.\/+/, '').split('/'); + for (const part of relParts) { + if (part === '..') + baseParts.pop(); + else if (part !== '.' && part !== '') + baseParts.push(part); + } + return baseParts.join('/'); + } +} From cb3881ca4df2e034a764bdcaeed4f0321d414ca2 Mon Sep 17 00:00:00 2001 From: luginf Date: Wed, 15 Apr 2026 01:29:39 +0200 Subject: [PATCH 08/16] chore: remove unused deflist and katex plugins Co-Authored-By: Claude Sonnet 4.6 --- txt2tags-it/markdown-it-deflist.js | 344 - txt2tags-it/markdown-it-katex.js | 15760 --------------------------- 2 files changed, 16104 deletions(-) delete mode 100755 txt2tags-it/markdown-it-deflist.js delete mode 100755 txt2tags-it/markdown-it-katex.js diff --git a/txt2tags-it/markdown-it-deflist.js b/txt2tags-it/markdown-it-deflist.js deleted file mode 100755 index 1d0add4..0000000 --- a/txt2tags-it/markdown-it-deflist.js +++ /dev/null @@ -1,344 +0,0 @@ -/*! markdown-it-deflist 2.0.3 https://github.com//markdown-it/markdown-it-deflist @license MIT */ (function ( - f, -) { - if (typeof exports === "object" && typeof module !== "undefined") { - module.exports = f(); - } else if (typeof define === "function" && define.amd) { - define([], f); - } else { - var g; - if (typeof window !== "undefined") { - g = window; - } else if (typeof global !== "undefined") { - g = global; - } else if (typeof self !== "undefined") { - g = self; - } else if (typeof globalThis !== "undefined") { - g = globalThis; - } else { - g = this; - } - g.markdownitDeflist = f(); - } -})(function () { - var define, module, exports; - return (function e(t, n, r) { - function s(o, u) { - if (!n[o]) { - if (!t[o]) { - var a = typeof require == "function" && require; - if (!u && a) return a(o, !0); - if (i) return i(o, !0); - var f = new Error("Cannot find module '" + o + "'"); - throw ((f.code = "MODULE_NOT_FOUND"), f); - } - var l = (n[o] = { exports: {} }); - t[o][0].call( - l.exports, - function (e) { - var n = t[o][1][e]; - return s(n ? n : e); - }, - l, - l.exports, - e, - t, - n, - r, - ); - } - return n[o].exports; - } - var i = typeof require == "function" && require; - for (var o = 0; o < r.length; o++) s(r[o]); - return s; - })( - { - 1: [ - function (require, module, exports) { - // Process definition lists - // - "use strict"; - - module.exports = function deflist_plugin(md) { - var isSpace = md.utils.isSpace; - - // Search `[:~][\n ]`, returns next pos after marker on success - // or -1 on fail. - function skipMarker(state, line) { - var pos, - marker, - start = state.bMarks[line] + state.tShift[line], - max = state.eMarks[line]; - - if (start >= max) { - return -1; - } - - // Check bullet - marker = state.src.charCodeAt(start++); - if (marker !== 0x7e /* ~ */ && marker !== 0x3a /* : */) { - return -1; - } - - pos = state.skipSpaces(start); - - // require space after ":" - if (start === pos) { - return -1; - } - - // no empty definitions, e.g. " : " - if (pos >= max) { - return -1; - } - - return start; - } - - function markTightParagraphs(state, idx) { - var i, - l, - level = state.level + 2; - - for (i = idx + 2, l = state.tokens.length - 2; i < l; i++) { - if ( - state.tokens[i].level === level && - state.tokens[i].type === "paragraph_open" - ) { - state.tokens[i + 2].hidden = true; - state.tokens[i].hidden = true; - i += 2; - } - } - } - - function deflist(state, startLine, endLine, silent) { - var ch, - contentStart, - ddLine, - dtLine, - itemLines, - listLines, - listTokIdx, - max, - nextLine, - offset, - oldDDIndent, - oldIndent, - oldParentType, - oldSCount, - oldTShift, - oldTight, - pos, - prevEmptyEnd, - tight, - token; - - if (silent) { - // quirk: validation mode validates a dd block only, not a whole deflist - if (state.ddIndent < 0) { - return false; - } - return skipMarker(state, startLine) >= 0; - } - - nextLine = startLine + 1; - if (nextLine >= endLine) { - return false; - } - - if (state.isEmpty(nextLine)) { - nextLine++; - if (nextLine >= endLine) { - return false; - } - } - - if (state.sCount[nextLine] < state.blkIndent) { - return false; - } - contentStart = skipMarker(state, nextLine); - if (contentStart < 0) { - return false; - } - - // Start list - listTokIdx = state.tokens.length; - tight = true; - - token = state.push("dl_open", "dl", 1); - token.map = listLines = [startLine, 0]; - - // - // Iterate list items - // - - dtLine = startLine; - ddLine = nextLine; - - // One definition list can contain multiple DTs, - // and one DT can be followed by multiple DDs. - // - // Thus, there is two loops here, and label is - // needed to break out of the second one - // - /*eslint no-labels:0,block-scoped-var:0*/ - OUTER: for (;;) { - prevEmptyEnd = false; - - token = state.push("dt_open", "dt", 1); - token.map = [dtLine, dtLine]; - - token = state.push("inline", "", 0); - token.map = [dtLine, dtLine]; - token.content = state - .getLines(dtLine, dtLine + 1, state.blkIndent, false) - .trim(); - token.children = []; - - token = state.push("dt_close", "dt", -1); - - for (;;) { - token = state.push("dd_open", "dd", 1); - token.map = itemLines = [nextLine, 0]; - - pos = contentStart; - max = state.eMarks[ddLine]; - offset = - state.sCount[ddLine] + - contentStart - - (state.bMarks[ddLine] + state.tShift[ddLine]); - - while (pos < max) { - ch = state.src.charCodeAt(pos); - - if (isSpace(ch)) { - if (ch === 0x09) { - offset += 4 - (offset % 4); - } else { - offset++; - } - } else { - break; - } - - pos++; - } - - contentStart = pos; - - oldTight = state.tight; - oldDDIndent = state.ddIndent; - oldIndent = state.blkIndent; - oldTShift = state.tShift[ddLine]; - oldSCount = state.sCount[ddLine]; - oldParentType = state.parentType; - state.blkIndent = state.ddIndent = state.sCount[ddLine] + 2; - state.tShift[ddLine] = contentStart - state.bMarks[ddLine]; - state.sCount[ddLine] = offset; - state.tight = true; - state.parentType = "deflist"; - - state.md.block.tokenize(state, ddLine, endLine, true); - - // If any of list item is tight, mark list as tight - if (!state.tight || prevEmptyEnd) { - tight = false; - } - // Item become loose if finish with empty line, - // but we should filter last element, because it means list finish - prevEmptyEnd = - state.line - ddLine > 1 && state.isEmpty(state.line - 1); - - state.tShift[ddLine] = oldTShift; - state.sCount[ddLine] = oldSCount; - state.tight = oldTight; - state.parentType = oldParentType; - state.blkIndent = oldIndent; - state.ddIndent = oldDDIndent; - - token = state.push("dd_close", "dd", -1); - - itemLines[1] = nextLine = state.line; - - if (nextLine >= endLine) { - break OUTER; - } - - if (state.sCount[nextLine] < state.blkIndent) { - break OUTER; - } - contentStart = skipMarker(state, nextLine); - if (contentStart < 0) { - break; - } - - ddLine = nextLine; - - // go to the next loop iteration: - // insert DD tag and repeat checking - } - - if (nextLine >= endLine) { - break; - } - dtLine = nextLine; - - if (state.isEmpty(dtLine)) { - break; - } - if (state.sCount[dtLine] < state.blkIndent) { - break; - } - - ddLine = dtLine + 1; - if (ddLine >= endLine) { - break; - } - if (state.isEmpty(ddLine)) { - ddLine++; - } - if (ddLine >= endLine) { - break; - } - - if (state.sCount[ddLine] < state.blkIndent) { - break; - } - contentStart = skipMarker(state, ddLine); - if (contentStart < 0) { - break; - } - - // go to the next loop iteration: - // insert DT and DD tags and repeat checking - } - - // Finilize list - token = state.push("dl_close", "dl", -1); - - listLines[1] = nextLine; - - state.line = nextLine; - - // mark paragraphs tight if needed - if (tight) { - markTightParagraphs(state, listTokIdx); - } - - return true; - } - - md.block.ruler.before("paragraph", "deflist", deflist, { - alt: ["paragraph", "reference"], - }); - }; - }, - {}, - ], - }, - {}, - [1], - )(1); -}); diff --git a/txt2tags-it/markdown-it-katex.js b/txt2tags-it/markdown-it-katex.js deleted file mode 100755 index cf31888..0000000 --- a/txt2tags-it/markdown-it-katex.js +++ /dev/null @@ -1,15760 +0,0 @@ -var _excluded = [ - "allowInlineWithSpace", - "mathFence", - "logger", - "macros", - "transformer", -]; -function _typeof(o) { - "@babel/helpers - typeof"; - return ( - (_typeof = - "function" == typeof Symbol && "symbol" == typeof Symbol.iterator - ? function (o) { - return typeof o; - } - : function (o) { - return o && - "function" == typeof Symbol && - o.constructor === Symbol && - o !== Symbol.prototype - ? "symbol" - : typeof o; - }), - _typeof(o) - ); -} -function _objectWithoutProperties(e, t) { - if (null == e) return {}; - var o, - r, - i = _objectWithoutPropertiesLoose(e, t); - if (Object.getOwnPropertySymbols) { - var n = Object.getOwnPropertySymbols(e); - for (r = 0; r < n.length; r++) - ((o = n[r]), - -1 === t.indexOf(o) && - {}.propertyIsEnumerable.call(e, o) && - (i[o] = e[o])); - } - return i; -} -function _objectWithoutPropertiesLoose(r, e) { - if (null == r) return {}; - var t = {}; - for (var n in r) - if ({}.hasOwnProperty.call(r, n)) { - if (-1 !== e.indexOf(n)) continue; - t[n] = r[n]; - } - return t; -} -function ownKeys(e, r) { - var t = Object.keys(e); - if (Object.getOwnPropertySymbols) { - var o = Object.getOwnPropertySymbols(e); - (r && - (o = o.filter(function (r) { - return Object.getOwnPropertyDescriptor(e, r).enumerable; - })), - t.push.apply(t, o)); - } - return t; -} -function _objectSpread(e) { - for (var r = 1; r < arguments.length; r++) { - var t = null != arguments[r] ? arguments[r] : {}; - r % 2 - ? ownKeys(Object(t), !0).forEach(function (r) { - _defineProperty(e, r, t[r]); - }) - : Object.getOwnPropertyDescriptors - ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) - : ownKeys(Object(t)).forEach(function (r) { - Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); - }); - } - return e; -} -function _defineProperty(e, r, t) { - return ( - (r = _toPropertyKey(r)) in e - ? Object.defineProperty(e, r, { - value: t, - enumerable: !0, - configurable: !0, - writable: !0, - }) - : (e[r] = t), - e - ); -} -function _slicedToArray(r, e) { - return ( - _arrayWithHoles(r) || - _iterableToArrayLimit(r, e) || - _unsupportedIterableToArray(r, e) || - _nonIterableRest() - ); -} -function _nonIterableRest() { - throw new TypeError( - "Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.", - ); -} -function _iterableToArrayLimit(r, l) { - var t = - null == r - ? null - : ("undefined" != typeof Symbol && r[Symbol.iterator]) || r["@@iterator"]; - if (null != t) { - var e, - n, - i, - u, - a = [], - f = !0, - o = !1; - try { - if (((i = (t = t.call(r)).next), 0 === l)) { - if (Object(t) !== t) return; - f = !1; - } else - for ( - ; - !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); - f = !0 - ); - } catch (r) { - ((o = !0), (n = r)); - } finally { - try { - if (!f && null != t["return"] && ((u = t["return"]()), Object(u) !== u)) - return; - } finally { - if (o) throw n; - } - } - return a; - } -} -function _arrayWithHoles(r) { - if (Array.isArray(r)) return r; -} -function _toConsumableArray(r) { - return ( - _arrayWithoutHoles(r) || - _iterableToArray(r) || - _unsupportedIterableToArray(r) || - _nonIterableSpread() - ); -} -function _nonIterableSpread() { - throw new TypeError( - "Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.", - ); -} -function _unsupportedIterableToArray(r, a) { - if (r) { - if ("string" == typeof r) return _arrayLikeToArray(r, a); - var t = {}.toString.call(r).slice(8, -1); - return ( - "Object" === t && r.constructor && (t = r.constructor.name), - "Map" === t || "Set" === t - ? Array.from(r) - : "Arguments" === t || - /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) - ? _arrayLikeToArray(r, a) - : void 0 - ); - } -} -function _iterableToArray(r) { - if ( - ("undefined" != typeof Symbol && null != r[Symbol.iterator]) || - null != r["@@iterator"] - ) - return Array.from(r); -} -function _arrayWithoutHoles(r) { - if (Array.isArray(r)) return _arrayLikeToArray(r); -} -function _arrayLikeToArray(r, a) { - (null == a || a > r.length) && (a = r.length); - for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; - return n; -} -function _classCallCheck(a, n) { - if (!(a instanceof n)) - throw new TypeError("Cannot call a class as a function"); -} -function _defineProperties(e, r) { - for (var t = 0; t < r.length; t++) { - var o = r[t]; - ((o.enumerable = o.enumerable || !1), - (o.configurable = !0), - "value" in o && (o.writable = !0), - Object.defineProperty(e, _toPropertyKey(o.key), o)); - } -} -function _createClass(e, r, t) { - return ( - r && _defineProperties(e.prototype, r), - t && _defineProperties(e, t), - Object.defineProperty(e, "prototype", { writable: !1 }), - e - ); -} -function _toPropertyKey(t) { - var i = _toPrimitive(t, "string"); - return "symbol" == _typeof(i) ? i : i + ""; -} -function _toPrimitive(t, r) { - if ("object" != _typeof(t) || !t) return t; - var e = t[Symbol.toPrimitive]; - if (void 0 !== e) { - var i = e.call(t, r || "default"); - if ("object" != _typeof(i)) return i; - throw new TypeError("@@toPrimitive must return a primitive value."); - } - return ("string" === r ? String : Number)(t); -} -(function (factory) { - var g = (typeof globalThis !== "undefined") ? globalThis : this; - g.markdownItKatex = factory(); -})(function () { - var escapeHtml = function escapeHtml(unsafeHTML) { - return unsafeHTML - .replace(/&/g, "&") - .replace(//g, ">") - .replace(/"/g, """) - .replace(/'/g, "'"); - }; - var isValidDelim = function isValidDelim(state, pos, allowInlineWithSpace) { - var prevChar = state.src.charAt(pos - 1); - var nextChar = state.src.charAt(pos + 1); - return { - canOpen: allowInlineWithSpace || (nextChar !== " " && nextChar !== "\t"), - canClose: - !/[0-9]/.exec(nextChar) && - (allowInlineWithSpace || (prevChar !== " " && prevChar !== "\t")), - }; - }; - var getInlineTex = function getInlineTex(allowInlineWithSpace) { - return function (state, silent) { - if (state.src[state.pos] !== "$") return false; - var delimState = isValidDelim(state, state.pos, allowInlineWithSpace); - if (!delimState.canOpen) { - if (!silent) state.pending += "$"; - state.pos++; - return true; - } - var start = state.pos + 1; - var match = start; - var pos; - while ((match = state.src.indexOf("$", match)) !== -1) { - pos = match - 1; - while (state.src[pos] === "\\") pos--; - if ((match - pos) % 2 === 1) break; - match++; - } - if (match === -1) { - if (!silent) state.pending += "$"; - state.pos = start; - return true; - } - if (match - start === 0) { - if (!silent) state.pending += "$$"; - state.pos = start + 1; - return true; - } - delimState = isValidDelim(state, match, allowInlineWithSpace); - if (!delimState.canClose) { - if (!silent) state.pending += "$"; - state.pos = start; - return true; - } - if (!silent) { - var token = state.push("math_inline", "math", 0); - token.markup = "$"; - token.content = state.src.slice(start, match); - } - state.pos = match + 1; - return true; - }; - }; - var blockTex = function blockTex(state, start, end, silent) { - var pos = state.bMarks[start] + state.tShift[start]; - var max = state.eMarks[start]; - if (pos + 2 > max) return false; - if (state.src.slice(pos, pos + 2) !== "$$") return false; - pos += 2; - var firstLine = state.src.slice(pos, max).trim(); - if (silent) return true; - var found = false; - if (firstLine.endsWith("$$")) { - firstLine = firstLine.slice(0, -2); - found = true; - } - var current = start; - var lastLine = ""; - while (!found) { - current++; - if (current >= end) break; - pos = state.bMarks[current] + state.tShift[current]; - max = state.eMarks[current]; - if (pos < max && state.tShift[current] < state.blkIndent) break; - if (state.src.slice(pos, max).trim().endsWith("$$")) { - lastLine = state.src - .slice(pos, state.src.slice(0, max).lastIndexOf("$$")) - .trim(); - found = true; - } - } - state.line = found ? current + 1 : current; - var token = state.push("math_block", "math", 0); - token.block = true; - token.content = - (firstLine ? "".concat(firstLine, "\n") : "") + - state.getLines(start + 1, current, state.tShift[start], true) + - (lastLine ? "".concat(lastLine, "\n") : ""); - token.map = [start, state.line]; - token.markup = "$$"; - return true; - }; - var tex = function tex(md, options) { - if ( - typeof (options === null || options === void 0 - ? void 0 - : options.render) !== "function" - ) - throw new Error( - '[@mdit/plugin-tex]: "render" option should be a function', - ); - var _options$allowInlineW = options.allowInlineWithSpace, - allowInlineWithSpace = - _options$allowInlineW === void 0 ? false : _options$allowInlineW, - _options$mathFence = options.mathFence, - mathFence = _options$mathFence === void 0 ? false : _options$mathFence, - render = options.render; - if (mathFence) { - var fence = md.renderer.rules.fence; - md.renderer.rules.fence = function () { - for ( - var _len = arguments.length, args = new Array(_len), _key = 0; - _key < _len; - _key++ - ) { - args[_key] = arguments[_key]; - } - var tokens = args[0], - index = args[1], - env = args[3]; - var _tokens$index = tokens[index], - content = _tokens$index.content, - info = _tokens$index.info; - if (info.trim() === "math") return render(content, true, env); - return fence.apply(void 0, args); - }; - } - md.inline.ruler.after( - "escape", - "math_inline", - getInlineTex(allowInlineWithSpace), - ); - md.block.ruler.after("blockquote", "math_block", blockTex, { - alt: ["paragraph", "reference", "blockquote", "list"], - }); - md.renderer.rules.math_inline = function (tokens, index, _options, env) { - return render(tokens[index].content, false, env); - }; - md.renderer.rules.math_block = function (tokens, index, _options, env) { - return render(tokens[index].content, true, env); - }; - }; - var SourceLocation = (function () { - function SourceLocation(lexer, start, end) { - _classCallCheck(this, SourceLocation); - this.lexer = void 0; - this.start = void 0; - this.end = void 0; - this.lexer = lexer; - this.start = start; - this.end = end; - } - return _createClass(SourceLocation, null, [ - { - key: "range", - value: function range(first, second) { - if (!second) { - return first && first.loc; - } else if ( - !first || - !first.loc || - !second.loc || - first.loc.lexer !== second.loc.lexer - ) { - return null; - } else { - return new SourceLocation( - first.loc.lexer, - first.loc.start, - second.loc.end, - ); - } - }, - }, - ]); - })(); - var Token = (function () { - function Token(text, loc) { - _classCallCheck(this, Token); - this.text = void 0; - this.loc = void 0; - this.noexpand = void 0; - this.treatAsRelax = void 0; - this.text = text; - this.loc = loc; - } - return _createClass(Token, [ - { - key: "range", - value: function range(endToken, text) { - return new Token(text, SourceLocation.range(this, endToken)); - }, - }, - ]); - })(); - var ParseError = _createClass(function ParseError(message, token) { - _classCallCheck(this, ParseError); - this.name = void 0; - this.position = void 0; - this.length = void 0; - this.rawMessage = void 0; - var error = "KaTeX parse error: " + message; - var start; - var end; - var loc = token && token.loc; - if (loc && loc.start <= loc.end) { - var input = loc.lexer.input; - start = loc.start; - end = loc.end; - if (start === input.length) { - error += " at end of input: "; - } else { - error += " at position " + (start + 1) + ": "; - } - var underlined = input.slice(start, end).replace(/[^]/g, "$&\u0332"); - var left; - if (start > 15) { - left = "\u2026" + input.slice(start - 15, start); - } else { - left = input.slice(0, start); - } - var right; - if (end + 15 < input.length) { - right = input.slice(end, end + 15) + "\u2026"; - } else { - right = input.slice(end); - } - error += left + underlined + right; - } - var self = new Error(error); - self.name = "ParseError"; - self.__proto__ = ParseError.prototype; - self.position = start; - if (start != null && end != null) { - self.length = end - start; - } - self.rawMessage = message; - return self; - }); - ParseError.prototype.__proto__ = Error.prototype; - var contains = function contains(list, elem) { - return list.indexOf(elem) !== -1; - }; - var deflt = function deflt(setting, defaultIfUndefined) { - return setting === undefined ? defaultIfUndefined : setting; - }; - var uppercase = /([A-Z])/g; - var hyphenate = function hyphenate(str) { - return str.replace(uppercase, "-$1").toLowerCase(); - }; - var ESCAPE_LOOKUP = { - "&": "&", - ">": ">", - "<": "<", - '"': """, - "'": "'", - }; - var ESCAPE_REGEX = /[&><"']/g; - function escape(text) { - return String(text).replace(ESCAPE_REGEX, function (match) { - return ESCAPE_LOOKUP[match]; - }); - } - var getBaseElem = function getBaseElem(group) { - if (group.type === "ordgroup") { - if (group.body.length === 1) { - return getBaseElem(group.body[0]); - } else { - return group; - } - } else if (group.type === "color") { - if (group.body.length === 1) { - return getBaseElem(group.body[0]); - } else { - return group; - } - } else if (group.type === "font") { - return getBaseElem(group.body); - } else { - return group; - } - }; - var isCharacterBox = function isCharacterBox(group) { - var baseElem = getBaseElem(group); - return ( - baseElem.type === "mathord" || - baseElem.type === "textord" || - baseElem.type === "atom" - ); - }; - var assert = function assert(value) { - if (!value) { - throw new Error("Expected non-null, but got " + String(value)); - } - return value; - }; - var protocolFromUrl = function protocolFromUrl(url) { - var protocol = /^[\x00-\x20]*([^\\/#?]*?)(:|�*58|�*3a|&colon)/i.exec( - url, - ); - if (!protocol) { - return "_relative"; - } - if (protocol[2] !== ":") { - return null; - } - if (!/^[a-zA-Z][a-zA-Z0-9+\-.]*$/.test(protocol[1])) { - return null; - } - return protocol[1].toLowerCase(); - }; - var utils = { - contains: contains, - deflt: deflt, - escape: escape, - hyphenate: hyphenate, - getBaseElem: getBaseElem, - isCharacterBox: isCharacterBox, - protocolFromUrl: protocolFromUrl, - }; - var SETTINGS_SCHEMA = { - displayMode: { - type: "boolean", - description: - "Render math in display mode, which puts the math in " + - "display style (so \\int and \\sum are large, for example), and " + - "centers the math on the page on its own line.", - cli: "-d, --display-mode", - }, - output: { - type: { enum: ["htmlAndMathml", "html", "mathml"] }, - description: "Determines the markup language of the output.", - cli: "-F, --format ", - }, - leqno: { - type: "boolean", - description: "Render display math in leqno style (left-justified tags).", - }, - fleqn: { type: "boolean", description: "Render display math flush left." }, - throwOnError: { - type: "boolean", - default: true, - cli: "-t, --no-throw-on-error", - cliDescription: - "Render errors (in the color given by --error-color) ins" + - "tead of throwing a ParseError exception when encountering an error.", - }, - errorColor: { - type: "string", - default: "#cc0000", - cli: "-c, --error-color ", - cliDescription: - "A color string given in the format 'rgb' or 'rrggbb' " + - "(no #). This option determines the color of errors rendered by the " + - "-t option.", - cliProcessor: function cliProcessor(color) { - return "#" + color; - }, - }, - macros: { - type: "object", - cli: "-m, --macro ", - cliDescription: - "Define custom macro of the form '\\foo:expansion' (use " + - "multiple -m arguments for multiple macros).", - cliDefault: [], - cliProcessor: function cliProcessor(def, defs) { - defs.push(def); - return defs; - }, - }, - minRuleThickness: { - type: "number", - description: - "Specifies a minimum thickness, in ems, for fraction lines," + - " `\\sqrt` top lines, `{array}` vertical lines, `\\hline`, " + - "`\\hdashline`, `\\underline`, `\\overline`, and the borders of " + - "`\\fbox`, `\\boxed`, and `\\fcolorbox`.", - processor: function processor(t) { - return Math.max(0, t); - }, - cli: "--min-rule-thickness ", - cliProcessor: parseFloat, - }, - colorIsTextColor: { - type: "boolean", - description: - "Makes \\color behave like LaTeX's 2-argument \\textcolor, " + - "instead of LaTeX's one-argument \\color mode change.", - cli: "-b, --color-is-text-color", - }, - strict: { - type: [{ enum: ["warn", "ignore", "error"] }, "boolean", "function"], - description: - "Turn on strict / LaTeX faithfulness mode, which throws an " + - "error if the input uses features that are not supported by LaTeX.", - cli: "-S, --strict", - cliDefault: false, - }, - trust: { - type: ["boolean", "function"], - description: "Trust the input, enabling all HTML features such as \\url.", - cli: "-T, --trust", - }, - maxSize: { - type: "number", - default: Infinity, - description: - "If non-zero, all user-specified sizes, e.g. in " + - "\\rule{500em}{500em}, will be capped to maxSize ems. Otherwise, " + - "elements and spaces can be arbitrarily large", - processor: function processor(s) { - return Math.max(0, s); - }, - cli: "-s, --max-size ", - cliProcessor: parseInt, - }, - maxExpand: { - type: "number", - default: 1000, - description: - "Limit the number of macro expansions to the specified " + - "number, to prevent e.g. infinite macro loops. If set to Infinity, " + - "the macro expander will try to fully expand as in LaTeX.", - processor: function processor(n) { - return Math.max(0, n); - }, - cli: "-e, --max-expand ", - cliProcessor: function cliProcessor(n) { - return n === "Infinity" ? Infinity : parseInt(n); - }, - }, - globalGroup: { type: "boolean", cli: false }, - }; - function getDefaultValue(schema) { - if (schema["default"]) { - return schema["default"]; - } - var type = schema.type; - var defaultType = Array.isArray(type) ? type[0] : type; - if (typeof defaultType !== "string") { - return defaultType["enum"][0]; - } - switch (defaultType) { - case "boolean": - return false; - case "string": - return ""; - case "number": - return 0; - case "object": - return {}; - } - } - var Settings = (function () { - function Settings(options) { - _classCallCheck(this, Settings); - this.displayMode = void 0; - this.output = void 0; - this.leqno = void 0; - this.fleqn = void 0; - this.throwOnError = void 0; - this.errorColor = void 0; - this.macros = void 0; - this.minRuleThickness = void 0; - this.colorIsTextColor = void 0; - this.strict = void 0; - this.trust = void 0; - this.maxSize = void 0; - this.maxExpand = void 0; - this.globalGroup = void 0; - options = options || {}; - for (var prop in SETTINGS_SCHEMA) { - if (SETTINGS_SCHEMA.hasOwnProperty(prop)) { - var schema = SETTINGS_SCHEMA[prop]; - this[prop] = - options[prop] !== undefined - ? schema.processor - ? schema.processor(options[prop]) - : options[prop] - : getDefaultValue(schema); - } - } - } - return _createClass(Settings, [ - { - key: "reportNonstrict", - value: function reportNonstrict(errorCode, errorMsg, token) { - var strict = this.strict; - if (typeof strict === "function") { - strict = strict(errorCode, errorMsg, token); - } - if (!strict || strict === "ignore") { - return; - } else if (strict === true || strict === "error") { - throw new ParseError( - "LaTeX-incompatible input and strict mode is set to 'error': " + - (errorMsg + " [" + errorCode + "]"), - token, - ); - } else if (strict === "warn") { - typeof console !== "undefined" && - console.warn( - "LaTeX-incompatible input and strict mode is set to 'warn': " + - (errorMsg + " [" + errorCode + "]"), - ); - } else { - typeof console !== "undefined" && - console.warn( - "LaTeX-incompatible input and strict mode is set to " + - ("unrecognized '" + - strict + - "': " + - errorMsg + - " [" + - errorCode + - "]"), - ); - } - }, - }, - { - key: "useStrictBehavior", - value: function useStrictBehavior(errorCode, errorMsg, token) { - var strict = this.strict; - if (typeof strict === "function") { - try { - strict = strict(errorCode, errorMsg, token); - } catch (error) { - strict = "error"; - } - } - if (!strict || strict === "ignore") { - return false; - } else if (strict === true || strict === "error") { - return true; - } else if (strict === "warn") { - typeof console !== "undefined" && - console.warn( - "LaTeX-incompatible input and strict mode is set to 'warn': " + - (errorMsg + " [" + errorCode + "]"), - ); - return false; - } else { - typeof console !== "undefined" && - console.warn( - "LaTeX-incompatible input and strict mode is set to " + - ("unrecognized '" + - strict + - "': " + - errorMsg + - " [" + - errorCode + - "]"), - ); - return false; - } - }, - }, - { - key: "isTrusted", - value: function isTrusted(context) { - if (context.url && !context.protocol) { - var protocol = utils.protocolFromUrl(context.url); - if (protocol == null) { - return false; - } - context.protocol = protocol; - } - var trust = - typeof this.trust === "function" ? this.trust(context) : this.trust; - return Boolean(trust); - }, - }, - ]); - })(); - var Style = (function () { - function Style(id, size, cramped) { - _classCallCheck(this, Style); - this.id = void 0; - this.size = void 0; - this.cramped = void 0; - this.id = id; - this.size = size; - this.cramped = cramped; - } - return _createClass(Style, [ - { - key: "sup", - value: function sup() { - return styles[_sup[this.id]]; - }, - }, - { - key: "sub", - value: function sub() { - return styles[_sub[this.id]]; - }, - }, - { - key: "fracNum", - value: function fracNum() { - return styles[_fracNum[this.id]]; - }, - }, - { - key: "fracDen", - value: function fracDen() { - return styles[_fracDen[this.id]]; - }, - }, - { - key: "cramp", - value: function cramp() { - return styles[_cramp[this.id]]; - }, - }, - { - key: "text", - value: function text() { - return styles[text$1[this.id]]; - }, - }, - { - key: "isTight", - value: function isTight() { - return this.size >= 2; - }, - }, - ]); - })(); - var D = 0; - var Dc = 1; - var T = 2; - var Tc = 3; - var S = 4; - var Sc = 5; - var SS = 6; - var SSc = 7; - var styles = [ - new Style(D, 0, false), - new Style(Dc, 0, true), - new Style(T, 1, false), - new Style(Tc, 1, true), - new Style(S, 2, false), - new Style(Sc, 2, true), - new Style(SS, 3, false), - new Style(SSc, 3, true), - ]; - var _sup = [S, Sc, S, Sc, SS, SSc, SS, SSc]; - var _sub = [Sc, Sc, Sc, Sc, SSc, SSc, SSc, SSc]; - var _fracNum = [T, Tc, S, Sc, SS, SSc, SS, SSc]; - var _fracDen = [Tc, Tc, Sc, Sc, SSc, SSc, SSc, SSc]; - var _cramp = [Dc, Dc, Tc, Tc, Sc, Sc, SSc, SSc]; - var text$1 = [D, Dc, T, Tc, T, Tc, T, Tc]; - var Style$1 = { - DISPLAY: styles[D], - TEXT: styles[T], - SCRIPT: styles[S], - SCRIPTSCRIPT: styles[SS], - }; - var scriptData = [ - { - name: "latin", - blocks: [ - [256, 591], - [768, 879], - ], - }, - { name: "cyrillic", blocks: [[1024, 1279]] }, - { name: "armenian", blocks: [[1328, 1423]] }, - { name: "brahmic", blocks: [[2304, 4255]] }, - { name: "georgian", blocks: [[4256, 4351]] }, - { - name: "cjk", - blocks: [ - [12288, 12543], - [19968, 40879], - [65280, 65376], - ], - }, - { name: "hangul", blocks: [[44032, 55215]] }, - ]; - function scriptFromCodepoint(codepoint) { - for (var i = 0; i < scriptData.length; i++) { - var script = scriptData[i]; - for (var _i = 0; _i < script.blocks.length; _i++) { - var block = script.blocks[_i]; - if (codepoint >= block[0] && codepoint <= block[1]) { - return script.name; - } - } - } - return null; - } - var allBlocks = []; - scriptData.forEach(function (s) { - return s.blocks.forEach(function (b) { - return allBlocks.push.apply(allBlocks, _toConsumableArray(b)); - }); - }); - function supportedCodepoint(codepoint) { - for (var i = 0; i < allBlocks.length; i += 2) { - if (codepoint >= allBlocks[i] && codepoint <= allBlocks[i + 1]) { - return true; - } - } - return false; - } - var hLinePad = 80; - var sqrtMain = function sqrtMain(extraVinculum, hLinePad) { - return ( - "M95," + - (622 + extraVinculum + hLinePad) + - "\nc-2.7,0,-7.17,-2.7,-13.5,-8c-5.8,-5.3,-9.5,-10,-9.5,-14\nc0,-2,0.3,-3.3,1,-4c1.3,-2.7,23.83,-20.7,67.5,-54\nc44.2,-33.3,65.8,-50.3,66.5,-51c1.3,-1.3,3,-2,5,-2c4.7,0,8.7,3.3,12,10\ns173,378,173,378c0.7,0,35.3,-71,104,-213c68.7,-142,137.5,-285,206.5,-429\nc69,-144,104.5,-217.7,106.5,-221\nl" + - extraVinculum / 2.075 + - " -" + - extraVinculum + - "\nc5.3,-9.3,12,-14,20,-14\nH400000v" + - (40 + extraVinculum) + - "H845.2724\ns-225.272,467,-225.272,467s-235,486,-235,486c-2.7,4.7,-9,7,-19,7\nc-6,0,-10,-1,-12,-3s-194,-422,-194,-422s-65,47,-65,47z\nM" + - (834 + extraVinculum) + - " " + - hLinePad + - "h400000v" + - (40 + extraVinculum) + - "h-400000z" - ); - }; - var sqrtSize1 = function sqrtSize1(extraVinculum, hLinePad) { - return ( - "M263," + - (601 + extraVinculum + hLinePad) + - "c0.7,0,18,39.7,52,119\nc34,79.3,68.167,158.7,102.5,238c34.3,79.3,51.8,119.3,52.5,120\nc340,-704.7,510.7,-1060.3,512,-1067\nl" + - extraVinculum / 2.084 + - " -" + - extraVinculum + - "\nc4.7,-7.3,11,-11,19,-11\nH40000v" + - (40 + extraVinculum) + - "H1012.3\ns-271.3,567,-271.3,567c-38.7,80.7,-84,175,-136,283c-52,108,-89.167,185.3,-111.5,232\nc-22.3,46.7,-33.8,70.3,-34.5,71c-4.7,4.7,-12.3,7,-23,7s-12,-1,-12,-1\ns-109,-253,-109,-253c-72.7,-168,-109.3,-252,-110,-252c-10.7,8,-22,16.7,-34,26\nc-22,17.3,-33.3,26,-34,26s-26,-26,-26,-26s76,-59,76,-59s76,-60,76,-60z\nM" + - (1001 + extraVinculum) + - " " + - hLinePad + - "h400000v" + - (40 + extraVinculum) + - "h-400000z" - ); - }; - var sqrtSize2 = function sqrtSize2(extraVinculum, hLinePad) { - return ( - "M983 " + - (10 + extraVinculum + hLinePad) + - "\nl" + - extraVinculum / 3.13 + - " -" + - extraVinculum + - "\nc4,-6.7,10,-10,18,-10 H400000v" + - (40 + extraVinculum) + - "\nH1013.1s-83.4,268,-264.1,840c-180.7,572,-277,876.3,-289,913c-4.7,4.7,-12.7,7,-24,7\ns-12,0,-12,0c-1.3,-3.3,-3.7,-11.7,-7,-25c-35.3,-125.3,-106.7,-373.3,-214,-744\nc-10,12,-21,25,-33,39s-32,39,-32,39c-6,-5.3,-15,-14,-27,-26s25,-30,25,-30\nc26.7,-32.7,52,-63,76,-91s52,-60,52,-60s208,722,208,722\nc56,-175.3,126.3,-397.3,211,-666c84.7,-268.7,153.8,-488.2,207.5,-658.5\nc53.7,-170.3,84.5,-266.8,92.5,-289.5z\nM" + - (1001 + extraVinculum) + - " " + - hLinePad + - "h400000v" + - (40 + extraVinculum) + - "h-400000z" - ); - }; - var sqrtSize3 = function sqrtSize3(extraVinculum, hLinePad) { - return ( - "M424," + - (2398 + extraVinculum + hLinePad) + - "\nc-1.3,-0.7,-38.5,-172,-111.5,-514c-73,-342,-109.8,-513.3,-110.5,-514\nc0,-2,-10.7,14.3,-32,49c-4.7,7.3,-9.8,15.7,-15.5,25c-5.7,9.3,-9.8,16,-12.5,20\ns-5,7,-5,7c-4,-3.3,-8.3,-7.7,-13,-13s-13,-13,-13,-13s76,-122,76,-122s77,-121,77,-121\ns209,968,209,968c0,-2,84.7,-361.7,254,-1079c169.3,-717.3,254.7,-1077.7,256,-1081\nl" + - extraVinculum / 4.223 + - " -" + - extraVinculum + - "c4,-6.7,10,-10,18,-10 H400000\nv" + - (40 + extraVinculum) + - "H1014.6\ns-87.3,378.7,-272.6,1166c-185.3,787.3,-279.3,1182.3,-282,1185\nc-2,6,-10,9,-24,9\nc-8,0,-12,-0.7,-12,-2z M" + - (1001 + extraVinculum) + - " " + - hLinePad + - "\nh400000v" + - (40 + extraVinculum) + - "h-400000z" - ); - }; - var sqrtSize4 = function sqrtSize4(extraVinculum, hLinePad) { - return ( - "M473," + - (2713 + extraVinculum + hLinePad) + - "\nc339.3,-1799.3,509.3,-2700,510,-2702 l" + - extraVinculum / 5.298 + - " -" + - extraVinculum + - "\nc3.3,-7.3,9.3,-11,18,-11 H400000v" + - (40 + extraVinculum) + - "H1017.7\ns-90.5,478,-276.2,1466c-185.7,988,-279.5,1483,-281.5,1485c-2,6,-10,9,-24,9\nc-8,0,-12,-0.7,-12,-2c0,-1.3,-5.3,-32,-16,-92c-50.7,-293.3,-119.7,-693.3,-207,-1200\nc0,-1.3,-5.3,8.7,-16,30c-10.7,21.3,-21.3,42.7,-32,64s-16,33,-16,33s-26,-26,-26,-26\ns76,-153,76,-153s77,-151,77,-151c0.7,0.7,35.7,202,105,604c67.3,400.7,102,602.7,104,\n606zM" + - (1001 + extraVinculum) + - " " + - hLinePad + - "h400000v" + - (40 + extraVinculum) + - "H1017.7z" - ); - }; - var phasePath = function phasePath(y) { - var x = y / 2; - return ( - "M400000 " + y + " H0 L" + x + " 0 l65 45 L145 " + (y - 80) + " H400000z" - ); - }; - var sqrtTall = function sqrtTall(extraVinculum, hLinePad, viewBoxHeight) { - var vertSegment = viewBoxHeight - 54 - hLinePad - extraVinculum; - return ( - "M702 " + - (extraVinculum + hLinePad) + - "H400000" + - (40 + extraVinculum) + - "\nH742v" + - vertSegment + - "l-4 4-4 4c-.667.7 -2 1.5-4 2.5s-4.167 1.833-6.5 2.5-5.5 1-9.5 1\nh-12l-28-84c-16.667-52-96.667 -294.333-240-727l-212 -643 -85 170\nc-4-3.333-8.333-7.667-13 -13l-13-13l77-155 77-156c66 199.333 139 419.667\n219 661 l218 661zM702 " + - hLinePad + - "H400000v" + - (40 + extraVinculum) + - "H742z" - ); - }; - var sqrtPath = function sqrtPath(size, extraVinculum, viewBoxHeight) { - extraVinculum = 1000 * extraVinculum; - var path = ""; - switch (size) { - case "sqrtMain": - path = sqrtMain(extraVinculum, hLinePad); - break; - case "sqrtSize1": - path = sqrtSize1(extraVinculum, hLinePad); - break; - case "sqrtSize2": - path = sqrtSize2(extraVinculum, hLinePad); - break; - case "sqrtSize3": - path = sqrtSize3(extraVinculum, hLinePad); - break; - case "sqrtSize4": - path = sqrtSize4(extraVinculum, hLinePad); - break; - case "sqrtTall": - path = sqrtTall(extraVinculum, hLinePad, viewBoxHeight); - } - return path; - }; - var innerPath = function innerPath(name, height) { - switch (name) { - case "\u239C": - return ( - "M291 0 H417 V" + height + " H291z M291 0 H417 V" + height + " H291z" - ); - case "\u2223": - return ( - "M145 0 H188 V" + height + " H145z M145 0 H188 V" + height + " H145z" - ); - case "\u2225": - return ( - "M145 0 H188 V" + - height + - " H145z M145 0 H188 V" + - height + - " H145z" + - ("M367 0 H410 V" + - height + - " H367z M367 0 H410 V" + - height + - " H367z") - ); - case "\u239F": - return ( - "M457 0 H583 V" + height + " H457z M457 0 H583 V" + height + " H457z" - ); - case "\u23A2": - return ( - "M319 0 H403 V" + height + " H319z M319 0 H403 V" + height + " H319z" - ); - case "\u23A5": - return ( - "M263 0 H347 V" + height + " H263z M263 0 H347 V" + height + " H263z" - ); - case "\u23AA": - return ( - "M384 0 H504 V" + height + " H384z M384 0 H504 V" + height + " H384z" - ); - case "\u23D0": - return ( - "M312 0 H355 V" + height + " H312z M312 0 H355 V" + height + " H312z" - ); - case "\u2016": - return ( - "M257 0 H300 V" + - height + - " H257z M257 0 H300 V" + - height + - " H257z" + - ("M478 0 H521 V" + - height + - " H478z M478 0 H521 V" + - height + - " H478z") - ); - default: - return ""; - } - }; - var path = { - doubleleftarrow: - "M262 157\nl10-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\n 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\n 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\nc2 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\n 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\n-86-123l-10-10h399738v-40H218c328 0 0 0 0 0l-10-8c-26.7-20-65.7-43-117-69 2.7\n-2 6-3.7 10-5 36.7-16 72.3-37.3 107-64l10-8h399782v-40z\nm8 0v40h399730v-40zm0 194v40h399730v-40z", - doublerightarrow: - "M399738 392l\n-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\n 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\n-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\n-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\n-13h-6c-12 .7-18 4-18 10 0 2 1.7 7 5 15 23.3 46 52 87 86 123l10 10H0v40h399782\nc-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\n-107 64l-10 8H0v40zM0 157v40h399730v-40zm0 194v40h399730v-40z", - leftarrow: - "M400000 241H110l3-3c68.7-52.7 113.7-120\n 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\n-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\nc-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\n 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\n 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\n l-3-3h399890zM100 241v40h399900v-40z", - leftbrace: - "M6 548l-6-6v-35l6-11c56-104 135.3-181.3 238-232 57.3-28.7 117\n-45 179-50h399577v120H403c-43.3 7-81 15-113 26-100.7 33-179.7 91-237 174-2.7\n 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\n 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\n 0 2 .3 4 1 18.688 2.7 76 4.3 172 5h399450v120H429l-6-1c-124.688-8-235-61.7\n-331-161C60.687 138.7 32.312 99.3 7 54L0 41V6z", - leftgroup: - "M400000 80\nH435C64 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\n 435 0h399565z", - leftgroupunder: - "M400000 262\nH435C64 262 168.3 112.6 21 82c-5.9-1.2-18 0-18 0-2 0-3 1-3 3v38c76 158 257 219\n 435 219h399565z", - leftharpoon: - "M0 267c.7 5.3 3 10 7 14h399993v-40H93c3.3\n-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\n-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\n-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\n 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\n-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\n-10.7 8-12 10-1.3 2-2 5.7-2 11zm100-26v40h399900v-40zM0 435v40h400000v-40z\nm0 0v40h400000v-40z", - leftharpoondown: - "M7 241c-4 4-6.333 8.667-7 14 0 5.333.667 9 2 11s5.333\n 5.333 12 10c90.667 54 156 130 196 228 3.333 10.667 6.333 16.333 9 17 2 .667 5\n 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\n-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\n 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\n-2 18-6 2-2.7 1-9.7-3-21-32-87.3-82.7-157.7-152-211l-3-3h399907v-40H7zm93 0\nv40h399900v-40zM0 241v40h399900v-40zm0 0v40h399900v-40z", - lefthook: - "M400000 281 H103s-33-11.2-61-33.5S0 197.3 0 164s14.2-61.2 42.5\n-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\n-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\n 71.5 23h399859zM103 281v-40h399897v40z", - leftlinesegment: - "M40 281 V428 H0 V94 H40 V241 H400000 v40z\nM40 281 V428 H0 V94 H40 V241 H400000 v40z", - leftmapsto: - "M40 281 V448H0V74H40V241H400000v40z\nM40 281 V448H0V74H40V241H400000v40z", - leftToFrom: - "M0 147h400000v40H0zm0 214c68 40 115.7 95.7 143 167h22c15.3 0 23\n-.3 23-1 0-1.3-5.3-13.7-16-37-18-35.3-41.3-69-70-101l-7-8h399905v-40H95l7-8\nc28.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\n 68 321 0 361zm0-174v-40h399900v40zm100 154v40h399900v-40z", - longequal: - "M0 50 h400000 v40H0z m0 194h40000v40H0z\nM0 50 h400000 v40H0z m0 194h40000v40H0z", - midbrace: - "M200428 334\nc-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\n-53.3 86.7-123.7 153-211 199-66.7 36-137.3 56.3-212 62H0V214h199568c178.3-11.7\n 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\n 12 44.7 59.3 101.3 106.3 170 141s145.3 54.3 229 60h199572v120z", - midbraceunder: - "M199572 214\nc100.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\n 53.3-86.7 123.7-153 211-199 66.7-36 137.3-56.3 212-62h199568v120H200432c-178.3\n 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\n-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\n-320.3 177.6S193.1 320.6 193.1 249.8c0-71.4 46.9-178.2 319.5-178.2z\nm368.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\n60.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\n-451.1 228.8-386.3 0-452.7-137.5-452.7-228.8 0-92.4 66.4-230 452.7-230z\nm502.4 230c0-111.2-82.4-277.2-502.4-277.2s-504 166-504 277.2\nc0 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\n-480.5 177.6S202.1 320.6 202.1 249.8c0-71.4 70.5-178.2 479.3-178.2z\nm525.8 178.2c0-86.4-86.8-215.4-525.7-215.4-437.9 0-524.7 129-524.7 215.4 0\n85.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\n-707.8 275.8-606 0-710.2-165.8-710.2-275.8C311 218.8 415.2 53 1021.2 53z\nm770.4 277.1c0-131.2-126.4-327.6-770.5-327.6S248.4 198.9 248.4 330.1\nc0 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\n-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\n 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\n 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\n-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\n-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\n 151.7 139 205zm0 0v40h399900v-40z", - rightbrace: - "M400000 542l\n-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\ns-117.2-55.8-184.5-66.5c-.7 0-2-.3-4-1-18.7-2.7-76-4.3-172-5H0V214h399571l6 1\nc124.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\n 28.7-117 45-179 50H-300V214h399897c43.3-7 81-15 113-26 100.7-33 179.7-91 237\n-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\n 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\n 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\n-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\n-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\n 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\n-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\n 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\nm0 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\n 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\n-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\n-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\n 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\n 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\n-64.7 57-92 95-27.3 38-48.7 77.7-64 119-3.3 8.7-5 14-5 16zM0 435v40h399900v-40z\nm0-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\n 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\n-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\n 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\nM399960 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\n 1 0 1.3 5.3 13.7 16 37 18 35.3 41.3 69 70 101l7 8H0v40h399905l-7 8c-28.7 32\n-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\n-167z M100 147v40h399900v-40zM0 341v40h399900v-40z", - twoheadleftarrow: - "M0 167c68 40\n 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\n-70-101l-7-8h125l9 7c50.7 39.3 85 86 103 140h46c0-4.7-6.3-18.7-19-42-18-35.3\n-40-67.3-66-96l-9-9h399716v-40H284l9-9c26-28.7 48-60.7 66-96 12.7-23.333 19\n-37.333 19-42h-46c-18 54-52.3 100.7-103 140l-9 7H95l7-8c28.7-32 52-65.7 70-101\n 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\nc-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\n 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\n 18 35.3 40 67.3 66 96l9 9H0v40h399716l-9 9c-26 28.7-48 60.7-66 96-12.7 23.333\n-19 37.333-19 42h46c18-54 52.3-100.7 103-140l9-7h125l-7 8c-28.7 32-52 65.7-70\n 101-10.7 23.333-16 35.7-16 37 0 .7 7.7 1 23 1h22c27.3-71.3 75-127 143-167z", - tilde1: - "M200 55.538c-77 0-168 73.953-177 73.953-3 0-7\n-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\n 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\n 4.35-2 7.613-5 9.788l-19 13.05c-92 63.077-116.937 75.308-183 76.128\n-68.267.847-113-73.952-191-73.952z", - tilde2: - "M344 55.266c-142 0-300.638 81.316-311.5 86.418\n-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\n 31.9 283 0 358 0c148 0 188 122 331 122s314-97 326-97c4 0 8 2 10 7l7 21.114\nc1 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\n 181.476 676 181.476c-149 0-189-126.21-332-126.21z", - tilde3: - "M786 59C457 59 32 175.242 13 175.242c-6 0-10-3.457\n-11-10.37L.15 138c-1-7 3-12 10-13l19.2-6.4C378.4 40.7 634.3 0 804.3 0c337 0\n 411.8 157 746.8 157 328 0 754-112 773-112 5 0 10 3 11 9l1 14.075c1 8.066-.697\n 16.595-6.697 17.492l-21.052 7.31c-367.9 98.146-609.15 122.696-778.15 122.696\n -338 0-409-156.573-744-156.573z", - tilde4: - "M786 58C457 58 32 177.487 13 177.487c-6 0-10-3.345\n-11-10.035L.15 143c-1-7 3-12 10-13l22-6.7C381.2 35 637.15 0 807.15 0c337 0 409\n 177 744 177 328 0 754-127 773-127 5 0 10 3 11 9l1 14.794c1 7.805-3 13.38-9\n 14.495l-20.7 5.574c-366.85 99.79-607.3 139.372-776.3 139.372-338 0-409\n -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\n3.333 2.667 6.667 9 10 19 6.667 24.667 20.333 43.667 41 57 7.333 4.667 11\n10.667 11 18 0 6-1 10-3 12s-6.667 5-14 9c-28.667 14.667-53.667 35.667-75 63\n-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\n-7 1c-4.667 0-9.167-1.833-13.5-5.5S337 184 337 178c0-12.667 15.667-32.333 47-59\nH213l-171-1c-8.667-6-13-12.333-13-19 0-4.667 4.333-11.333 13-20h359\nc-16-25.333-24-45-24-59z", - widehat1: - "M529 0h5l519 115c5 1 9 5 9 10 0 1-1 2-1 3l-4 22\nc-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\n-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\n-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\n-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,\n-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,\n-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,\n-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,\n-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\nc4 -14.7 6 -23 6 -25c0 -7.3 -7 -11 -21 -11c-8 0 -13.2 0.8 -15.5 2.5\nc-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\ns-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\n121.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\ns2.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\nc0 -2 -2 -10.3 -6 -25c-20 -79.3 -65 -146.7 -135 -202l-3 -3h399890z\nM100 620v40h399900v-40z M0 241v40h399900v-40zM0 241v40h399900v-40z", - rightarrowabovebar: - "M0 241v40h399891c-47.3 35.3-84 78-110 128-16.7 32\n-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\n13.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\n-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\n-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\n-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\n151.7 139 205zm96 379h399894v40H0zm0 0h399904v40H0z", - baraboveshortleftharpoon: - "M507,435c-4,4,-6.3,8.7,-7,14c0,5.3,0.7,9,2,11\nc1.3,2,5.3,5.3,12,10c90.7,54,156,130,196,228c3.3,10.7,6.3,16.3,9,17\nc2,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\nc-32,-87.3,-82.7,-157.7,-152,-211c0,0,-3,-3,-3,-3l399351,0l0,-40\nc-398570,0,-399437,0,-399437,0z M593 435 v40 H399500 v-40z\nM0 281 v-40 H399908 v40z M0 281 v-40 H399908 v40z", - rightharpoonaboveshortbar: - "M0,241 l0,40c399126,0,399993,0,399993,0\nc4.7,-4.7,7,-9.3,7,-14c0,-9.3,-3.7,-15.3,-11,-18c-92.7,-56.7,-159,-133.7,-199,\n-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\nc-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\nM0 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\nc1.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,\n1c0,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,\n-152,-211c0,0,-3,-3,-3,-3l399907,0l0,-40c-399126,0,-399993,0,-399993,0z\nM93 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\nc4.7,-4.7,7,-9.3,7,-14c0,-9.3,-3.7,-15.3,-11,-18c-92.7,-56.7,-159,-133.7,-199,\n-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\nc-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\nM500 241 v40 H399408 v-40z M500 435 v40 H400000 v-40z", - }; - var tallDelim = function tallDelim(label, midHeight) { - switch (label) { - case "lbrack": - return ( - "M403 1759 V84 H666 V0 H319 V1759 v" + - midHeight + - " v1759 h347 v-84\nH403z M403 1759 V0 H319 V1759 v" + - midHeight + - " v1759 h84z" - ); - case "rbrack": - return ( - "M347 1759 V0 H0 V84 H263 V1759 v" + - midHeight + - " v1759 H0 v84 H347z\nM347 1759 V0 H263 V1759 v" + - midHeight + - " v1759 h84z" - ); - case "vert": - return ( - "M145 15 v585 v" + - midHeight + - " v585 c2.667,10,9.667,15,21,15\nc10,0,16.667,-5,20,-15 v-585 v" + - -midHeight + - " v-585 c-2.667,-10,-9.667,-15,-21,-15\nc-10,0,-16.667,5,-20,15z M188 15 H145 v585 v" + - midHeight + - " v585 h43z" - ); - case "doublevert": - return ( - "M145 15 v585 v" + - midHeight + - " v585 c2.667,10,9.667,15,21,15\nc10,0,16.667,-5,20,-15 v-585 v" + - -midHeight + - " v-585 c-2.667,-10,-9.667,-15,-21,-15\nc-10,0,-16.667,5,-20,15z M188 15 H145 v585 v" + - midHeight + - " v585 h43z\nM367 15 v585 v" + - midHeight + - " v585 c2.667,10,9.667,15,21,15\nc10,0,16.667,-5,20,-15 v-585 v" + - -midHeight + - " v-585 c-2.667,-10,-9.667,-15,-21,-15\nc-10,0,-16.667,5,-20,15z M410 15 H367 v585 v" + - midHeight + - " v585 h43z" - ); - case "lfloor": - return ( - "M319 602 V0 H403 V602 v" + - midHeight + - " v1715 h263 v84 H319z\nMM319 602 V0 H403 V602 v" + - midHeight + - " v1715 H319z" - ); - case "rfloor": - return ( - "M319 602 V0 H403 V602 v" + - midHeight + - " v1799 H0 v-84 H319z\nMM319 602 V0 H403 V602 v" + - midHeight + - " v1715 H319z" - ); - case "lceil": - return ( - "M403 1759 V84 H666 V0 H319 V1759 v" + - midHeight + - " v602 h84z\nM403 1759 V0 H319 V1759 v" + - midHeight + - " v602 h84z" - ); - case "rceil": - return ( - "M347 1759 V0 H0 V84 H263 V1759 v" + - midHeight + - " v602 h84z\nM347 1759 V0 h-84 V1759 v" + - midHeight + - " v602 h84z" - ); - case "lparen": - return ( - "M863,9c0,-2,-2,-5,-6,-9c0,0,-17,0,-17,0c-12.7,0,-19.3,0.3,-20,1\nc-5.3,5.3,-10.3,11,-15,17c-242.7,294.7,-395.3,682,-458,1162c-21.3,163.3,-33.3,349,\n-36,557 l0," + - (midHeight + 84) + - "c0.2,6,0,26,0,60c2,159.3,10,310.7,24,454c53.3,528,210,\n949.7,470,1265c4.7,6,9.7,11.7,15,17c0.7,0.7,7,1,19,1c0,0,18,0,18,0c4,-4,6,-7,6,-9\nc0,-2.7,-3.3,-8.7,-10,-18c-135.3,-192.7,-235.5,-414.3,-300.5,-665c-65,-250.7,-102.5,\n-544.7,-112.5,-882c-2,-104,-3,-167,-3,-189\nl0,-" + - (midHeight + 92) + - "c0,-162.7,5.7,-314,17,-454c20.7,-272,63.7,-513,129,-723c65.3,\n-210,155.3,-396.3,270,-559c6.7,-9.3,10,-15.3,10,-18z" - ); - case "rparen": - return ( - "M76,0c-16.7,0,-25,3,-25,9c0,2,2,6.3,6,13c21.3,28.7,42.3,60.3,\n63,95c96.7,156.7,172.8,332.5,228.5,527.5c55.7,195,92.8,416.5,111.5,664.5\nc11.3,139.3,17,290.7,17,454c0,28,1.7,43,3.3,45l0," + - (midHeight + 9) + - "\nc-3,4,-3.3,16.7,-3.3,38c0,162,-5.7,313.7,-17,455c-18.7,248,-55.8,469.3,-111.5,664\nc-55.7,194.7,-131.8,370.3,-228.5,527c-20.7,34.7,-41.7,66.3,-63,95c-2,3.3,-4,7,-6,11\nc0,7.3,5.7,11,17,11c0,0,11,0,11,0c9.3,0,14.3,-0.3,15,-1c5.3,-5.3,10.3,-11,15,-17\nc242.7,-294.7,395.3,-681.7,458,-1161c21.3,-164.7,33.3,-350.7,36,-558\nl0,-" + - (midHeight + 144) + - "c-2,-159.3,-10,-310.7,-24,-454c-53.3,-528,-210,-949.7,\n-470,-1265c-4.7,-6,-9.7,-11.7,-15,-17c-0.7,-0.7,-6.7,-1,-18,-1z" - ); - default: - throw new Error("Unknown stretchy delimiter."); - } - }; - var DocumentFragment = (function () { - function DocumentFragment(children) { - _classCallCheck(this, DocumentFragment); - this.children = void 0; - this.classes = void 0; - this.height = void 0; - this.depth = void 0; - this.maxFontSize = void 0; - this.style = void 0; - this.children = children; - this.classes = []; - this.height = 0; - this.depth = 0; - this.maxFontSize = 0; - this.style = {}; - } - return _createClass(DocumentFragment, [ - { - key: "hasClass", - value: function hasClass(className) { - return utils.contains(this.classes, className); - }, - }, - { - key: "toNode", - value: function toNode() { - var frag = document.createDocumentFragment(); - for (var i = 0; i < this.children.length; i++) { - frag.appendChild(this.children[i].toNode()); - } - return frag; - }, - }, - { - key: "toMarkup", - value: function toMarkup() { - var markup = ""; - for (var i = 0; i < this.children.length; i++) { - markup += this.children[i].toMarkup(); - } - return markup; - }, - }, - { - key: "toText", - value: function toText() { - var toText = function toText(child) { - return child.toText(); - }; - return this.children.map(toText).join(""); - }, - }, - ]); - })(); - var fontMetricsData = { - "AMS-Regular": { - 32: [0, 0, 0, 0, 0.25], - 65: [0, 0.68889, 0, 0, 0.72222], - 66: [0, 0.68889, 0, 0, 0.66667], - 67: [0, 0.68889, 0, 0, 0.72222], - 68: [0, 0.68889, 0, 0, 0.72222], - 69: [0, 0.68889, 0, 0, 0.66667], - 70: [0, 0.68889, 0, 0, 0.61111], - 71: [0, 0.68889, 0, 0, 0.77778], - 72: [0, 0.68889, 0, 0, 0.77778], - 73: [0, 0.68889, 0, 0, 0.38889], - 74: [0.16667, 0.68889, 0, 0, 0.5], - 75: [0, 0.68889, 0, 0, 0.77778], - 76: [0, 0.68889, 0, 0, 0.66667], - 77: [0, 0.68889, 0, 0, 0.94445], - 78: [0, 0.68889, 0, 0, 0.72222], - 79: [0.16667, 0.68889, 0, 0, 0.77778], - 80: [0, 0.68889, 0, 0, 0.61111], - 81: [0.16667, 0.68889, 0, 0, 0.77778], - 82: [0, 0.68889, 0, 0, 0.72222], - 83: [0, 0.68889, 0, 0, 0.55556], - 84: [0, 0.68889, 0, 0, 0.66667], - 85: [0, 0.68889, 0, 0, 0.72222], - 86: [0, 0.68889, 0, 0, 0.72222], - 87: [0, 0.68889, 0, 0, 1], - 88: [0, 0.68889, 0, 0, 0.72222], - 89: [0, 0.68889, 0, 0, 0.72222], - 90: [0, 0.68889, 0, 0, 0.66667], - 107: [0, 0.68889, 0, 0, 0.55556], - 160: [0, 0, 0, 0, 0.25], - 165: [0, 0.675, 0.025, 0, 0.75], - 174: [0.15559, 0.69224, 0, 0, 0.94666], - 240: [0, 0.68889, 0, 0, 0.55556], - 295: [0, 0.68889, 0, 0, 0.54028], - 710: [0, 0.825, 0, 0, 2.33334], - 732: [0, 0.9, 0, 0, 2.33334], - 770: [0, 0.825, 0, 0, 2.33334], - 771: [0, 0.9, 0, 0, 2.33334], - 989: [0.08167, 0.58167, 0, 0, 0.77778], - 1008: [0, 0.43056, 0.04028, 0, 0.66667], - 8245: [0, 0.54986, 0, 0, 0.275], - 8463: [0, 0.68889, 0, 0, 0.54028], - 8487: [0, 0.68889, 0, 0, 0.72222], - 8498: [0, 0.68889, 0, 0, 0.55556], - 8502: [0, 0.68889, 0, 0, 0.66667], - 8503: [0, 0.68889, 0, 0, 0.44445], - 8504: [0, 0.68889, 0, 0, 0.66667], - 8513: [0, 0.68889, 0, 0, 0.63889], - 8592: [-0.03598, 0.46402, 0, 0, 0.5], - 8594: [-0.03598, 0.46402, 0, 0, 0.5], - 8602: [-0.13313, 0.36687, 0, 0, 1], - 8603: [-0.13313, 0.36687, 0, 0, 1], - 8606: [0.01354, 0.52239, 0, 0, 1], - 8608: [0.01354, 0.52239, 0, 0, 1], - 8610: [0.01354, 0.52239, 0, 0, 1.11111], - 8611: [0.01354, 0.52239, 0, 0, 1.11111], - 8619: [0, 0.54986, 0, 0, 1], - 8620: [0, 0.54986, 0, 0, 1], - 8621: [-0.13313, 0.37788, 0, 0, 1.38889], - 8622: [-0.13313, 0.36687, 0, 0, 1], - 8624: [0, 0.69224, 0, 0, 0.5], - 8625: [0, 0.69224, 0, 0, 0.5], - 8630: [0, 0.43056, 0, 0, 1], - 8631: [0, 0.43056, 0, 0, 1], - 8634: [0.08198, 0.58198, 0, 0, 0.77778], - 8635: [0.08198, 0.58198, 0, 0, 0.77778], - 8638: [0.19444, 0.69224, 0, 0, 0.41667], - 8639: [0.19444, 0.69224, 0, 0, 0.41667], - 8642: [0.19444, 0.69224, 0, 0, 0.41667], - 8643: [0.19444, 0.69224, 0, 0, 0.41667], - 8644: [0.1808, 0.675, 0, 0, 1], - 8646: [0.1808, 0.675, 0, 0, 1], - 8647: [0.1808, 0.675, 0, 0, 1], - 8648: [0.19444, 0.69224, 0, 0, 0.83334], - 8649: [0.1808, 0.675, 0, 0, 1], - 8650: [0.19444, 0.69224, 0, 0, 0.83334], - 8651: [0.01354, 0.52239, 0, 0, 1], - 8652: [0.01354, 0.52239, 0, 0, 1], - 8653: [-0.13313, 0.36687, 0, 0, 1], - 8654: [-0.13313, 0.36687, 0, 0, 1], - 8655: [-0.13313, 0.36687, 0, 0, 1], - 8666: [0.13667, 0.63667, 0, 0, 1], - 8667: [0.13667, 0.63667, 0, 0, 1], - 8669: [-0.13313, 0.37788, 0, 0, 1], - 8672: [-0.064, 0.437, 0, 0, 1.334], - 8674: [-0.064, 0.437, 0, 0, 1.334], - 8705: [0, 0.825, 0, 0, 0.5], - 8708: [0, 0.68889, 0, 0, 0.55556], - 8709: [0.08167, 0.58167, 0, 0, 0.77778], - 8717: [0, 0.43056, 0, 0, 0.42917], - 8722: [-0.03598, 0.46402, 0, 0, 0.5], - 8724: [0.08198, 0.69224, 0, 0, 0.77778], - 8726: [0.08167, 0.58167, 0, 0, 0.77778], - 8733: [0, 0.69224, 0, 0, 0.77778], - 8736: [0, 0.69224, 0, 0, 0.72222], - 8737: [0, 0.69224, 0, 0, 0.72222], - 8738: [0.03517, 0.52239, 0, 0, 0.72222], - 8739: [0.08167, 0.58167, 0, 0, 0.22222], - 8740: [0.25142, 0.74111, 0, 0, 0.27778], - 8741: [0.08167, 0.58167, 0, 0, 0.38889], - 8742: [0.25142, 0.74111, 0, 0, 0.5], - 8756: [0, 0.69224, 0, 0, 0.66667], - 8757: [0, 0.69224, 0, 0, 0.66667], - 8764: [-0.13313, 0.36687, 0, 0, 0.77778], - 8765: [-0.13313, 0.37788, 0, 0, 0.77778], - 8769: [-0.13313, 0.36687, 0, 0, 0.77778], - 8770: [-0.03625, 0.46375, 0, 0, 0.77778], - 8774: [0.30274, 0.79383, 0, 0, 0.77778], - 8776: [-0.01688, 0.48312, 0, 0, 0.77778], - 8778: [0.08167, 0.58167, 0, 0, 0.77778], - 8782: [0.06062, 0.54986, 0, 0, 0.77778], - 8783: [0.06062, 0.54986, 0, 0, 0.77778], - 8785: [0.08198, 0.58198, 0, 0, 0.77778], - 8786: [0.08198, 0.58198, 0, 0, 0.77778], - 8787: [0.08198, 0.58198, 0, 0, 0.77778], - 8790: [0, 0.69224, 0, 0, 0.77778], - 8791: [0.22958, 0.72958, 0, 0, 0.77778], - 8796: [0.08198, 0.91667, 0, 0, 0.77778], - 8806: [0.25583, 0.75583, 0, 0, 0.77778], - 8807: [0.25583, 0.75583, 0, 0, 0.77778], - 8808: [0.25142, 0.75726, 0, 0, 0.77778], - 8809: [0.25142, 0.75726, 0, 0, 0.77778], - 8812: [0.25583, 0.75583, 0, 0, 0.5], - 8814: [0.20576, 0.70576, 0, 0, 0.77778], - 8815: [0.20576, 0.70576, 0, 0, 0.77778], - 8816: [0.30274, 0.79383, 0, 0, 0.77778], - 8817: [0.30274, 0.79383, 0, 0, 0.77778], - 8818: [0.22958, 0.72958, 0, 0, 0.77778], - 8819: [0.22958, 0.72958, 0, 0, 0.77778], - 8822: [0.1808, 0.675, 0, 0, 0.77778], - 8823: [0.1808, 0.675, 0, 0, 0.77778], - 8828: [0.13667, 0.63667, 0, 0, 0.77778], - 8829: [0.13667, 0.63667, 0, 0, 0.77778], - 8830: [0.22958, 0.72958, 0, 0, 0.77778], - 8831: [0.22958, 0.72958, 0, 0, 0.77778], - 8832: [0.20576, 0.70576, 0, 0, 0.77778], - 8833: [0.20576, 0.70576, 0, 0, 0.77778], - 8840: [0.30274, 0.79383, 0, 0, 0.77778], - 8841: [0.30274, 0.79383, 0, 0, 0.77778], - 8842: [0.13597, 0.63597, 0, 0, 0.77778], - 8843: [0.13597, 0.63597, 0, 0, 0.77778], - 8847: [0.03517, 0.54986, 0, 0, 0.77778], - 8848: [0.03517, 0.54986, 0, 0, 0.77778], - 8858: [0.08198, 0.58198, 0, 0, 0.77778], - 8859: [0.08198, 0.58198, 0, 0, 0.77778], - 8861: [0.08198, 0.58198, 0, 0, 0.77778], - 8862: [0, 0.675, 0, 0, 0.77778], - 8863: [0, 0.675, 0, 0, 0.77778], - 8864: [0, 0.675, 0, 0, 0.77778], - 8865: [0, 0.675, 0, 0, 0.77778], - 8872: [0, 0.69224, 0, 0, 0.61111], - 8873: [0, 0.69224, 0, 0, 0.72222], - 8874: [0, 0.69224, 0, 0, 0.88889], - 8876: [0, 0.68889, 0, 0, 0.61111], - 8877: [0, 0.68889, 0, 0, 0.61111], - 8878: [0, 0.68889, 0, 0, 0.72222], - 8879: [0, 0.68889, 0, 0, 0.72222], - 8882: [0.03517, 0.54986, 0, 0, 0.77778], - 8883: [0.03517, 0.54986, 0, 0, 0.77778], - 8884: [0.13667, 0.63667, 0, 0, 0.77778], - 8885: [0.13667, 0.63667, 0, 0, 0.77778], - 8888: [0, 0.54986, 0, 0, 1.11111], - 8890: [0.19444, 0.43056, 0, 0, 0.55556], - 8891: [0.19444, 0.69224, 0, 0, 0.61111], - 8892: [0.19444, 0.69224, 0, 0, 0.61111], - 8901: [0, 0.54986, 0, 0, 0.27778], - 8903: [0.08167, 0.58167, 0, 0, 0.77778], - 8905: [0.08167, 0.58167, 0, 0, 0.77778], - 8906: [0.08167, 0.58167, 0, 0, 0.77778], - 8907: [0, 0.69224, 0, 0, 0.77778], - 8908: [0, 0.69224, 0, 0, 0.77778], - 8909: [-0.03598, 0.46402, 0, 0, 0.77778], - 8910: [0, 0.54986, 0, 0, 0.76042], - 8911: [0, 0.54986, 0, 0, 0.76042], - 8912: [0.03517, 0.54986, 0, 0, 0.77778], - 8913: [0.03517, 0.54986, 0, 0, 0.77778], - 8914: [0, 0.54986, 0, 0, 0.66667], - 8915: [0, 0.54986, 0, 0, 0.66667], - 8916: [0, 0.69224, 0, 0, 0.66667], - 8918: [0.0391, 0.5391, 0, 0, 0.77778], - 8919: [0.0391, 0.5391, 0, 0, 0.77778], - 8920: [0.03517, 0.54986, 0, 0, 1.33334], - 8921: [0.03517, 0.54986, 0, 0, 1.33334], - 8922: [0.38569, 0.88569, 0, 0, 0.77778], - 8923: [0.38569, 0.88569, 0, 0, 0.77778], - 8926: [0.13667, 0.63667, 0, 0, 0.77778], - 8927: [0.13667, 0.63667, 0, 0, 0.77778], - 8928: [0.30274, 0.79383, 0, 0, 0.77778], - 8929: [0.30274, 0.79383, 0, 0, 0.77778], - 8934: [0.23222, 0.74111, 0, 0, 0.77778], - 8935: [0.23222, 0.74111, 0, 0, 0.77778], - 8936: [0.23222, 0.74111, 0, 0, 0.77778], - 8937: [0.23222, 0.74111, 0, 0, 0.77778], - 8938: [0.20576, 0.70576, 0, 0, 0.77778], - 8939: [0.20576, 0.70576, 0, 0, 0.77778], - 8940: [0.30274, 0.79383, 0, 0, 0.77778], - 8941: [0.30274, 0.79383, 0, 0, 0.77778], - 8994: [0.19444, 0.69224, 0, 0, 0.77778], - 8995: [0.19444, 0.69224, 0, 0, 0.77778], - 9416: [0.15559, 0.69224, 0, 0, 0.90222], - 9484: [0, 0.69224, 0, 0, 0.5], - 9488: [0, 0.69224, 0, 0, 0.5], - 9492: [0, 0.37788, 0, 0, 0.5], - 9496: [0, 0.37788, 0, 0, 0.5], - 9585: [0.19444, 0.68889, 0, 0, 0.88889], - 9586: [0.19444, 0.74111, 0, 0, 0.88889], - 9632: [0, 0.675, 0, 0, 0.77778], - 9633: [0, 0.675, 0, 0, 0.77778], - 9650: [0, 0.54986, 0, 0, 0.72222], - 9651: [0, 0.54986, 0, 0, 0.72222], - 9654: [0.03517, 0.54986, 0, 0, 0.77778], - 9660: [0, 0.54986, 0, 0, 0.72222], - 9661: [0, 0.54986, 0, 0, 0.72222], - 9664: [0.03517, 0.54986, 0, 0, 0.77778], - 9674: [0.11111, 0.69224, 0, 0, 0.66667], - 9733: [0.19444, 0.69224, 0, 0, 0.94445], - 10003: [0, 0.69224, 0, 0, 0.83334], - 10016: [0, 0.69224, 0, 0, 0.83334], - 10731: [0.11111, 0.69224, 0, 0, 0.66667], - 10846: [0.19444, 0.75583, 0, 0, 0.61111], - 10877: [0.13667, 0.63667, 0, 0, 0.77778], - 10878: [0.13667, 0.63667, 0, 0, 0.77778], - 10885: [0.25583, 0.75583, 0, 0, 0.77778], - 10886: [0.25583, 0.75583, 0, 0, 0.77778], - 10887: [0.13597, 0.63597, 0, 0, 0.77778], - 10888: [0.13597, 0.63597, 0, 0, 0.77778], - 10889: [0.26167, 0.75726, 0, 0, 0.77778], - 10890: [0.26167, 0.75726, 0, 0, 0.77778], - 10891: [0.48256, 0.98256, 0, 0, 0.77778], - 10892: [0.48256, 0.98256, 0, 0, 0.77778], - 10901: [0.13667, 0.63667, 0, 0, 0.77778], - 10902: [0.13667, 0.63667, 0, 0, 0.77778], - 10933: [0.25142, 0.75726, 0, 0, 0.77778], - 10934: [0.25142, 0.75726, 0, 0, 0.77778], - 10935: [0.26167, 0.75726, 0, 0, 0.77778], - 10936: [0.26167, 0.75726, 0, 0, 0.77778], - 10937: [0.26167, 0.75726, 0, 0, 0.77778], - 10938: [0.26167, 0.75726, 0, 0, 0.77778], - 10949: [0.25583, 0.75583, 0, 0, 0.77778], - 10950: [0.25583, 0.75583, 0, 0, 0.77778], - 10955: [0.28481, 0.79383, 0, 0, 0.77778], - 10956: [0.28481, 0.79383, 0, 0, 0.77778], - 57350: [0.08167, 0.58167, 0, 0, 0.22222], - 57351: [0.08167, 0.58167, 0, 0, 0.38889], - 57352: [0.08167, 0.58167, 0, 0, 0.77778], - 57353: [0, 0.43056, 0.04028, 0, 0.66667], - 57356: [0.25142, 0.75726, 0, 0, 0.77778], - 57357: [0.25142, 0.75726, 0, 0, 0.77778], - 57358: [0.41951, 0.91951, 0, 0, 0.77778], - 57359: [0.30274, 0.79383, 0, 0, 0.77778], - 57360: [0.30274, 0.79383, 0, 0, 0.77778], - 57361: [0.41951, 0.91951, 0, 0, 0.77778], - 57366: [0.25142, 0.75726, 0, 0, 0.77778], - 57367: [0.25142, 0.75726, 0, 0, 0.77778], - 57368: [0.25142, 0.75726, 0, 0, 0.77778], - 57369: [0.25142, 0.75726, 0, 0, 0.77778], - 57370: [0.13597, 0.63597, 0, 0, 0.77778], - 57371: [0.13597, 0.63597, 0, 0, 0.77778], - }, - "Caligraphic-Regular": { - 32: [0, 0, 0, 0, 0.25], - 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, 0.00965, 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: [0, 0, 0, 0, 0.25], - }, - "Fraktur-Regular": { - 32: [0, 0, 0, 0, 0.25], - 33: [0, 0.69141, 0, 0, 0.29574], - 34: [0, 0.69141, 0, 0, 0.21471], - 38: [0, 0.69141, 0, 0, 0.73786], - 39: [0, 0.69141, 0, 0, 0.21201], - 40: [0.24982, 0.74947, 0, 0, 0.38865], - 41: [0.24982, 0.74947, 0, 0, 0.38865], - 42: [0, 0.62119, 0, 0, 0.27764], - 43: [0.08319, 0.58283, 0, 0, 0.75623], - 44: [0, 0.10803, 0, 0, 0.27764], - 45: [0.08319, 0.58283, 0, 0, 0.75623], - 46: [0, 0.10803, 0, 0, 0.27764], - 47: [0.24982, 0.74947, 0, 0, 0.50181], - 48: [0, 0.47534, 0, 0, 0.50181], - 49: [0, 0.47534, 0, 0, 0.50181], - 50: [0, 0.47534, 0, 0, 0.50181], - 51: [0.18906, 0.47534, 0, 0, 0.50181], - 52: [0.18906, 0.47534, 0, 0, 0.50181], - 53: [0.18906, 0.47534, 0, 0, 0.50181], - 54: [0, 0.69141, 0, 0, 0.50181], - 55: [0.18906, 0.47534, 0, 0, 0.50181], - 56: [0, 0.69141, 0, 0, 0.50181], - 57: [0.18906, 0.47534, 0, 0, 0.50181], - 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: [0.24982, 0.74947, 0, 0, 0.27764], - 93: [0.24982, 0.74947, 0, 0, 0.27764], - 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: [0, 0, 0, 0, 0.25], - 8216: [0, 0.69141, 0, 0, 0.21471], - 8217: [0, 0.69141, 0, 0, 0.21471], - 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: [0, 0, 0, 0, 0.25], - 33: [0, 0.69444, 0, 0, 0.35], - 34: [0, 0.69444, 0, 0, 0.60278], - 35: [0.19444, 0.69444, 0, 0, 0.95833], - 36: [0.05556, 0.75, 0, 0, 0.575], - 37: [0.05556, 0.75, 0, 0, 0.95833], - 38: [0, 0.69444, 0, 0, 0.89444], - 39: [0, 0.69444, 0, 0, 0.31944], - 40: [0.25, 0.75, 0, 0, 0.44722], - 41: [0.25, 0.75, 0, 0, 0.44722], - 42: [0, 0.75, 0, 0, 0.575], - 43: [0.13333, 0.63333, 0, 0, 0.89444], - 44: [0.19444, 0.15556, 0, 0, 0.31944], - 45: [0, 0.44444, 0, 0, 0.38333], - 46: [0, 0.15556, 0, 0, 0.31944], - 47: [0.25, 0.75, 0, 0, 0.575], - 48: [0, 0.64444, 0, 0, 0.575], - 49: [0, 0.64444, 0, 0, 0.575], - 50: [0, 0.64444, 0, 0, 0.575], - 51: [0, 0.64444, 0, 0, 0.575], - 52: [0, 0.64444, 0, 0, 0.575], - 53: [0, 0.64444, 0, 0, 0.575], - 54: [0, 0.64444, 0, 0, 0.575], - 55: [0, 0.64444, 0, 0, 0.575], - 56: [0, 0.64444, 0, 0, 0.575], - 57: [0, 0.64444, 0, 0, 0.575], - 58: [0, 0.44444, 0, 0, 0.31944], - 59: [0.19444, 0.44444, 0, 0, 0.31944], - 60: [0.08556, 0.58556, 0, 0, 0.89444], - 61: [-0.10889, 0.39111, 0, 0, 0.89444], - 62: [0.08556, 0.58556, 0, 0, 0.89444], - 63: [0, 0.69444, 0, 0, 0.54305], - 64: [0, 0.69444, 0, 0, 0.89444], - 65: [0, 0.68611, 0, 0, 0.86944], - 66: [0, 0.68611, 0, 0, 0.81805], - 67: [0, 0.68611, 0, 0, 0.83055], - 68: [0, 0.68611, 0, 0, 0.88194], - 69: [0, 0.68611, 0, 0, 0.75555], - 70: [0, 0.68611, 0, 0, 0.72361], - 71: [0, 0.68611, 0, 0, 0.90416], - 72: [0, 0.68611, 0, 0, 0.9], - 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: [0, 0.68611, 0, 0, 0.69166], - 77: [0, 0.68611, 0, 0, 1.09166], - 78: [0, 0.68611, 0, 0, 0.9], - 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: [0, 0.68611, 0, 0, 0.86944], - 89: [0, 0.68611, 0.02875, 0, 0.86944], - 90: [0, 0.68611, 0, 0, 0.70277], - 91: [0.25, 0.75, 0, 0, 0.31944], - 92: [0.25, 0.75, 0, 0, 0.575], - 93: [0.25, 0.75, 0, 0, 0.31944], - 94: [0, 0.69444, 0, 0, 0.575], - 95: [0.31, 0.13444, 0.03194, 0, 0.575], - 97: [0, 0.44444, 0, 0, 0.55902], - 98: [0, 0.69444, 0, 0, 0.63889], - 99: [0, 0.44444, 0, 0, 0.51111], - 100: [0, 0.69444, 0, 0, 0.63889], - 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: [0, 0.69444, 0, 0, 0.63889], - 105: [0, 0.69444, 0, 0, 0.31944], - 106: [0.19444, 0.69444, 0, 0, 0.35139], - 107: [0, 0.69444, 0, 0, 0.60694], - 108: [0, 0.69444, 0, 0, 0.31944], - 109: [0, 0.44444, 0, 0, 0.95833], - 110: [0, 0.44444, 0, 0, 0.63889], - 111: [0, 0.44444, 0, 0, 0.575], - 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: [0, 0.44444, 0, 0, 0.63889], - 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: [0, 0.44444, 0, 0, 0.51111], - 123: [0.25, 0.75, 0, 0, 0.575], - 124: [0.25, 0.75, 0, 0, 0.31944], - 125: [0.25, 0.75, 0, 0, 0.575], - 126: [0.35, 0.34444, 0, 0, 0.575], - 160: [0, 0, 0, 0, 0.25], - 163: [0, 0.69444, 0, 0, 0.86853], - 168: [0, 0.69444, 0, 0, 0.575], - 172: [0, 0.44444, 0, 0, 0.76666], - 176: [0, 0.69444, 0, 0, 0.86944], - 177: [0.13333, 0.63333, 0, 0, 0.89444], - 184: [0.17014, 0, 0, 0, 0.51111], - 198: [0, 0.68611, 0, 0, 1.04166], - 215: [0.13333, 0.63333, 0, 0, 0.89444], - 216: [0.04861, 0.73472, 0, 0, 0.89444], - 223: [0, 0.69444, 0, 0, 0.59722], - 230: [0, 0.44444, 0, 0, 0.83055], - 247: [0.13333, 0.63333, 0, 0, 0.89444], - 248: [0.09722, 0.54167, 0, 0, 0.575], - 305: [0, 0.44444, 0, 0, 0.31944], - 338: [0, 0.68611, 0, 0, 1.16944], - 339: [0, 0.44444, 0, 0, 0.89444], - 567: [0.19444, 0.44444, 0, 0, 0.35139], - 710: [0, 0.69444, 0, 0, 0.575], - 711: [0, 0.63194, 0, 0, 0.575], - 713: [0, 0.59611, 0, 0, 0.575], - 714: [0, 0.69444, 0, 0, 0.575], - 715: [0, 0.69444, 0, 0, 0.575], - 728: [0, 0.69444, 0, 0, 0.575], - 729: [0, 0.69444, 0, 0, 0.31944], - 730: [0, 0.69444, 0, 0, 0.86944], - 732: [0, 0.69444, 0, 0, 0.575], - 733: [0, 0.69444, 0, 0, 0.575], - 915: [0, 0.68611, 0, 0, 0.69166], - 916: [0, 0.68611, 0, 0, 0.95833], - 920: [0, 0.68611, 0, 0, 0.89444], - 923: [0, 0.68611, 0, 0, 0.80555], - 926: [0, 0.68611, 0, 0, 0.76666], - 928: [0, 0.68611, 0, 0, 0.9], - 931: [0, 0.68611, 0, 0, 0.83055], - 933: [0, 0.68611, 0, 0, 0.89444], - 934: [0, 0.68611, 0, 0, 0.83055], - 936: [0, 0.68611, 0, 0, 0.89444], - 937: [0, 0.68611, 0, 0, 0.83055], - 8211: [0, 0.44444, 0.03194, 0, 0.575], - 8212: [0, 0.44444, 0.03194, 0, 1.14999], - 8216: [0, 0.69444, 0, 0, 0.31944], - 8217: [0, 0.69444, 0, 0, 0.31944], - 8220: [0, 0.69444, 0, 0, 0.60278], - 8221: [0, 0.69444, 0, 0, 0.60278], - 8224: [0.19444, 0.69444, 0, 0, 0.51111], - 8225: [0.19444, 0.69444, 0, 0, 0.51111], - 8242: [0, 0.55556, 0, 0, 0.34444], - 8407: [0, 0.72444, 0.15486, 0, 0.575], - 8463: [0, 0.69444, 0, 0, 0.66759], - 8465: [0, 0.69444, 0, 0, 0.83055], - 8467: [0, 0.69444, 0, 0, 0.47361], - 8472: [0.19444, 0.44444, 0, 0, 0.74027], - 8476: [0, 0.69444, 0, 0, 0.83055], - 8501: [0, 0.69444, 0, 0, 0.70277], - 8592: [-0.10889, 0.39111, 0, 0, 1.14999], - 8593: [0.19444, 0.69444, 0, 0, 0.575], - 8594: [-0.10889, 0.39111, 0, 0, 1.14999], - 8595: [0.19444, 0.69444, 0, 0, 0.575], - 8596: [-0.10889, 0.39111, 0, 0, 1.14999], - 8597: [0.25, 0.75, 0, 0, 0.575], - 8598: [0.19444, 0.69444, 0, 0, 1.14999], - 8599: [0.19444, 0.69444, 0, 0, 1.14999], - 8600: [0.19444, 0.69444, 0, 0, 1.14999], - 8601: [0.19444, 0.69444, 0, 0, 1.14999], - 8636: [-0.10889, 0.39111, 0, 0, 1.14999], - 8637: [-0.10889, 0.39111, 0, 0, 1.14999], - 8640: [-0.10889, 0.39111, 0, 0, 1.14999], - 8641: [-0.10889, 0.39111, 0, 0, 1.14999], - 8656: [-0.10889, 0.39111, 0, 0, 1.14999], - 8657: [0.19444, 0.69444, 0, 0, 0.70277], - 8658: [-0.10889, 0.39111, 0, 0, 1.14999], - 8659: [0.19444, 0.69444, 0, 0, 0.70277], - 8660: [-0.10889, 0.39111, 0, 0, 1.14999], - 8661: [0.25, 0.75, 0, 0, 0.70277], - 8704: [0, 0.69444, 0, 0, 0.63889], - 8706: [0, 0.69444, 0.06389, 0, 0.62847], - 8707: [0, 0.69444, 0, 0, 0.63889], - 8709: [0.05556, 0.75, 0, 0, 0.575], - 8711: [0, 0.68611, 0, 0, 0.95833], - 8712: [0.08556, 0.58556, 0, 0, 0.76666], - 8715: [0.08556, 0.58556, 0, 0, 0.76666], - 8722: [0.13333, 0.63333, 0, 0, 0.89444], - 8723: [0.13333, 0.63333, 0, 0, 0.89444], - 8725: [0.25, 0.75, 0, 0, 0.575], - 8726: [0.25, 0.75, 0, 0, 0.575], - 8727: [-0.02778, 0.47222, 0, 0, 0.575], - 8728: [-0.02639, 0.47361, 0, 0, 0.575], - 8729: [-0.02639, 0.47361, 0, 0, 0.575], - 8730: [0.18, 0.82, 0, 0, 0.95833], - 8733: [0, 0.44444, 0, 0, 0.89444], - 8734: [0, 0.44444, 0, 0, 1.14999], - 8736: [0, 0.69224, 0, 0, 0.72222], - 8739: [0.25, 0.75, 0, 0, 0.31944], - 8741: [0.25, 0.75, 0, 0, 0.575], - 8743: [0, 0.55556, 0, 0, 0.76666], - 8744: [0, 0.55556, 0, 0, 0.76666], - 8745: [0, 0.55556, 0, 0, 0.76666], - 8746: [0, 0.55556, 0, 0, 0.76666], - 8747: [0.19444, 0.69444, 0.12778, 0, 0.56875], - 8764: [-0.10889, 0.39111, 0, 0, 0.89444], - 8768: [0.19444, 0.69444, 0, 0, 0.31944], - 8771: [0.00222, 0.50222, 0, 0, 0.89444], - 8773: [0.027, 0.638, 0, 0, 0.894], - 8776: [0.02444, 0.52444, 0, 0, 0.89444], - 8781: [0.00222, 0.50222, 0, 0, 0.89444], - 8801: [0.00222, 0.50222, 0, 0, 0.89444], - 8804: [0.19667, 0.69667, 0, 0, 0.89444], - 8805: [0.19667, 0.69667, 0, 0, 0.89444], - 8810: [0.08556, 0.58556, 0, 0, 1.14999], - 8811: [0.08556, 0.58556, 0, 0, 1.14999], - 8826: [0.08556, 0.58556, 0, 0, 0.89444], - 8827: [0.08556, 0.58556, 0, 0, 0.89444], - 8834: [0.08556, 0.58556, 0, 0, 0.89444], - 8835: [0.08556, 0.58556, 0, 0, 0.89444], - 8838: [0.19667, 0.69667, 0, 0, 0.89444], - 8839: [0.19667, 0.69667, 0, 0, 0.89444], - 8846: [0, 0.55556, 0, 0, 0.76666], - 8849: [0.19667, 0.69667, 0, 0, 0.89444], - 8850: [0.19667, 0.69667, 0, 0, 0.89444], - 8851: [0, 0.55556, 0, 0, 0.76666], - 8852: [0, 0.55556, 0, 0, 0.76666], - 8853: [0.13333, 0.63333, 0, 0, 0.89444], - 8854: [0.13333, 0.63333, 0, 0, 0.89444], - 8855: [0.13333, 0.63333, 0, 0, 0.89444], - 8856: [0.13333, 0.63333, 0, 0, 0.89444], - 8857: [0.13333, 0.63333, 0, 0, 0.89444], - 8866: [0, 0.69444, 0, 0, 0.70277], - 8867: [0, 0.69444, 0, 0, 0.70277], - 8868: [0, 0.69444, 0, 0, 0.89444], - 8869: [0, 0.69444, 0, 0, 0.89444], - 8900: [-0.02639, 0.47361, 0, 0, 0.575], - 8901: [-0.02639, 0.47361, 0, 0, 0.31944], - 8902: [-0.02778, 0.47222, 0, 0, 0.575], - 8968: [0.25, 0.75, 0, 0, 0.51111], - 8969: [0.25, 0.75, 0, 0, 0.51111], - 8970: [0.25, 0.75, 0, 0, 0.51111], - 8971: [0.25, 0.75, 0, 0, 0.51111], - 8994: [-0.13889, 0.36111, 0, 0, 1.14999], - 8995: [-0.13889, 0.36111, 0, 0, 1.14999], - 9651: [0.19444, 0.69444, 0, 0, 1.02222], - 9657: [-0.02778, 0.47222, 0, 0, 0.575], - 9661: [0.19444, 0.69444, 0, 0, 1.02222], - 9667: [-0.02778, 0.47222, 0, 0, 0.575], - 9711: [0.19444, 0.69444, 0, 0, 1.14999], - 9824: [0.12963, 0.69444, 0, 0, 0.89444], - 9825: [0.12963, 0.69444, 0, 0, 0.89444], - 9826: [0.12963, 0.69444, 0, 0, 0.89444], - 9827: [0.12963, 0.69444, 0, 0, 0.89444], - 9837: [0, 0.75, 0, 0, 0.44722], - 9838: [0.19444, 0.69444, 0, 0, 0.44722], - 9839: [0.19444, 0.69444, 0, 0, 0.44722], - 10216: [0.25, 0.75, 0, 0, 0.44722], - 10217: [0.25, 0.75, 0, 0, 0.44722], - 10815: [0, 0.68611, 0, 0, 0.9], - 10927: [0.19667, 0.69667, 0, 0, 0.89444], - 10928: [0.19667, 0.69667, 0, 0, 0.89444], - 57376: [0.19444, 0.69444, 0, 0, 0], - }, - "Main-BoldItalic": { - 32: [0, 0, 0, 0, 0.25], - 33: [0, 0.69444, 0.11417, 0, 0.38611], - 34: [0, 0.69444, 0.07939, 0, 0.62055], - 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: [0, 0.69444, 0.12945, 0, 0.35555], - 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: [0, 0.64444, 0.13167, 0, 0.59111], - 49: [0, 0.64444, 0.13167, 0, 0.59111], - 50: [0, 0.64444, 0.13167, 0, 0.59111], - 51: [0, 0.64444, 0.13167, 0, 0.59111], - 52: [0.19444, 0.64444, 0.13167, 0, 0.59111], - 53: [0, 0.64444, 0.13167, 0, 0.59111], - 54: [0, 0.64444, 0.13167, 0, 0.59111], - 55: [0.19444, 0.64444, 0.13167, 0, 0.59111], - 56: [0, 0.64444, 0.13167, 0, 0.59111], - 57: [0, 0.64444, 0.13167, 0, 0.59111], - 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: [0, 0.69444, 0.11472, 0, 0.59111], - 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: [0, 0.68611, 0.17208, 0, 0.8961], - 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: [0, 0.68611, 0.17208, 0, 0.8961], - 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: [0, 0.69444, 0.06709, 0, 0.59111], - 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: [0.19444, 0.44444, 0.105, 0, 0.53222], - 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: [0.19444, 0.44444, 0.105, 0, 0.53222], - 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: [0, 0, 0, 0, 0.25], - 168: [0, 0.69444, 0.11473, 0, 0.59111], - 176: [0, 0.69444, 0, 0, 0.94888], - 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: [0, 0.44444, 0.085, 0, 0.82666], - 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: [0, 0.44444, 0.085, 0, 0.82666], - 567: [0.19444, 0.44444, 0.04611, 0, 0.385], - 710: [0, 0.69444, 0.06709, 0, 0.59111], - 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: [0, 0.69444, 0.12945, 0, 0.35555], - 730: [0, 0.69444, 0, 0, 0.94888], - 732: [0, 0.69444, 0.11472, 0, 0.59111], - 733: [0, 0.69444, 0.11472, 0, 0.59111], - 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: [0, 0.68611, 0.17208, 0, 0.8961], - 931: [0, 0.68611, 0.11431, 0, 0.82666], - 933: [0, 0.68611, 0.10778, 0, 0.88555], - 934: [0, 0.68611, 0.05632, 0, 0.82666], - 936: [0, 0.68611, 0.10778, 0, 0.88555], - 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: [0, 0.69444, 0.12945, 0, 0.35555], - 8217: [0, 0.69444, 0.12945, 0, 0.35555], - 8220: [0, 0.69444, 0.16772, 0, 0.62055], - 8221: [0, 0.69444, 0.07939, 0, 0.62055], - }, - "Main-Italic": { - 32: [0, 0, 0, 0, 0.25], - 33: [0, 0.69444, 0.12417, 0, 0.30667], - 34: [0, 0.69444, 0.06961, 0, 0.51444], - 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: [0, 0.69444, 0.12417, 0, 0.30667], - 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: [0, 0.64444, 0.13556, 0, 0.51111], - 49: [0, 0.64444, 0.13556, 0, 0.51111], - 50: [0, 0.64444, 0.13556, 0, 0.51111], - 51: [0, 0.64444, 0.13556, 0, 0.51111], - 52: [0.19444, 0.64444, 0.13556, 0, 0.51111], - 53: [0, 0.64444, 0.13556, 0, 0.51111], - 54: [0, 0.64444, 0.13556, 0, 0.51111], - 55: [0.19444, 0.64444, 0.13556, 0, 0.51111], - 56: [0, 0.64444, 0.13556, 0, 0.51111], - 57: [0, 0.64444, 0.13556, 0, 0.51111], - 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: [0, 0.69444, 0.1225, 0, 0.51111], - 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: [0, 0.68333, 0.16389, 0, 0.74333], - 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: [0, 0.68333, 0.16389, 0, 0.74333], - 79: [0, 0.68333, 0.09403, 0, 0.76666], - 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: [0, 0.68333, 0.16389, 0, 0.74333], - 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: [0, 0.69444, 0.06646, 0, 0.51111], - 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: [0.19444, 0.43056, 0.08847, 0, 0.46], - 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: [0.19444, 0.43056, 0.08847, 0, 0.46], - 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: [0, 0, 0, 0, 0.25], - 168: [0, 0.66786, 0.10474, 0, 0.51111], - 176: [0, 0.69444, 0, 0, 0.83129], - 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: [0, 0.43056, 0.07514, 0, 0.71555], - 248: [0.09722, 0.52778, 0.09194, 0, 0.51111], - 338: [0, 0.68333, 0.12028, 0, 0.98499], - 339: [0, 0.43056, 0.07514, 0, 0.71555], - 710: [0, 0.69444, 0.06646, 0, 0.51111], - 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: [0, 0.69444, 0, 0, 0.83129], - 732: [0, 0.66786, 0.11585, 0, 0.51111], - 733: [0, 0.69444, 0.1225, 0, 0.51111], - 915: [0, 0.68333, 0.13305, 0, 0.62722], - 916: [0, 0.68333, 0, 0, 0.81777], - 920: [0, 0.68333, 0.09403, 0, 0.76666], - 923: [0, 0.68333, 0, 0, 0.69222], - 926: [0, 0.68333, 0.15294, 0, 0.66444], - 928: [0, 0.68333, 0.16389, 0, 0.74333], - 931: [0, 0.68333, 0.12028, 0, 0.71555], - 933: [0, 0.68333, 0.11111, 0, 0.76666], - 934: [0, 0.68333, 0.05986, 0, 0.71555], - 936: [0, 0.68333, 0.11111, 0, 0.76666], - 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: [0, 0.69444, 0.12417, 0, 0.30667], - 8217: [0, 0.69444, 0.12417, 0, 0.30667], - 8220: [0, 0.69444, 0.1685, 0, 0.51444], - 8221: [0, 0.69444, 0.06961, 0, 0.51444], - 8463: [0, 0.68889, 0, 0, 0.54028], - }, - "Main-Regular": { - 32: [0, 0, 0, 0, 0.25], - 33: [0, 0.69444, 0, 0, 0.27778], - 34: [0, 0.69444, 0, 0, 0.5], - 35: [0.19444, 0.69444, 0, 0, 0.83334], - 36: [0.05556, 0.75, 0, 0, 0.5], - 37: [0.05556, 0.75, 0, 0, 0.83334], - 38: [0, 0.69444, 0, 0, 0.77778], - 39: [0, 0.69444, 0, 0, 0.27778], - 40: [0.25, 0.75, 0, 0, 0.38889], - 41: [0.25, 0.75, 0, 0, 0.38889], - 42: [0, 0.75, 0, 0, 0.5], - 43: [0.08333, 0.58333, 0, 0, 0.77778], - 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: [0.25, 0.75, 0, 0, 0.5], - 48: [0, 0.64444, 0, 0, 0.5], - 49: [0, 0.64444, 0, 0, 0.5], - 50: [0, 0.64444, 0, 0, 0.5], - 51: [0, 0.64444, 0, 0, 0.5], - 52: [0, 0.64444, 0, 0, 0.5], - 53: [0, 0.64444, 0, 0, 0.5], - 54: [0, 0.64444, 0, 0, 0.5], - 55: [0, 0.64444, 0, 0, 0.5], - 56: [0, 0.64444, 0, 0, 0.5], - 57: [0, 0.64444, 0, 0, 0.5], - 58: [0, 0.43056, 0, 0, 0.27778], - 59: [0.19444, 0.43056, 0, 0, 0.27778], - 60: [0.0391, 0.5391, 0, 0, 0.77778], - 61: [-0.13313, 0.36687, 0, 0, 0.77778], - 62: [0.0391, 0.5391, 0, 0, 0.77778], - 63: [0, 0.69444, 0, 0, 0.47222], - 64: [0, 0.69444, 0, 0, 0.77778], - 65: [0, 0.68333, 0, 0, 0.75], - 66: [0, 0.68333, 0, 0, 0.70834], - 67: [0, 0.68333, 0, 0, 0.72222], - 68: [0, 0.68333, 0, 0, 0.76389], - 69: [0, 0.68333, 0, 0, 0.68056], - 70: [0, 0.68333, 0, 0, 0.65278], - 71: [0, 0.68333, 0, 0, 0.78472], - 72: [0, 0.68333, 0, 0, 0.75], - 73: [0, 0.68333, 0, 0, 0.36111], - 74: [0, 0.68333, 0, 0, 0.51389], - 75: [0, 0.68333, 0, 0, 0.77778], - 76: [0, 0.68333, 0, 0, 0.625], - 77: [0, 0.68333, 0, 0, 0.91667], - 78: [0, 0.68333, 0, 0, 0.75], - 79: [0, 0.68333, 0, 0, 0.77778], - 80: [0, 0.68333, 0, 0, 0.68056], - 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: [0, 0.68333, 0, 0, 0.72222], - 85: [0, 0.68333, 0, 0, 0.75], - 86: [0, 0.68333, 0.01389, 0, 0.75], - 87: [0, 0.68333, 0.01389, 0, 1.02778], - 88: [0, 0.68333, 0, 0, 0.75], - 89: [0, 0.68333, 0.025, 0, 0.75], - 90: [0, 0.68333, 0, 0, 0.61111], - 91: [0.25, 0.75, 0, 0, 0.27778], - 92: [0.25, 0.75, 0, 0, 0.5], - 93: [0.25, 0.75, 0, 0, 0.27778], - 94: [0, 0.69444, 0, 0, 0.5], - 95: [0.31, 0.12056, 0.02778, 0, 0.5], - 97: [0, 0.43056, 0, 0, 0.5], - 98: [0, 0.69444, 0, 0, 0.55556], - 99: [0, 0.43056, 0, 0, 0.44445], - 100: [0, 0.69444, 0, 0, 0.55556], - 101: [0, 0.43056, 0, 0, 0.44445], - 102: [0, 0.69444, 0.07778, 0, 0.30556], - 103: [0.19444, 0.43056, 0.01389, 0, 0.5], - 104: [0, 0.69444, 0, 0, 0.55556], - 105: [0, 0.66786, 0, 0, 0.27778], - 106: [0.19444, 0.66786, 0, 0, 0.30556], - 107: [0, 0.69444, 0, 0, 0.52778], - 108: [0, 0.69444, 0, 0, 0.27778], - 109: [0, 0.43056, 0, 0, 0.83334], - 110: [0, 0.43056, 0, 0, 0.55556], - 111: [0, 0.43056, 0, 0, 0.5], - 112: [0.19444, 0.43056, 0, 0, 0.55556], - 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: [0, 0.43056, 0, 0, 0.55556], - 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: [0, 0.43056, 0, 0, 0.44445], - 123: [0.25, 0.75, 0, 0, 0.5], - 124: [0.25, 0.75, 0, 0, 0.27778], - 125: [0.25, 0.75, 0, 0, 0.5], - 126: [0.35, 0.31786, 0, 0, 0.5], - 160: [0, 0, 0, 0, 0.25], - 163: [0, 0.69444, 0, 0, 0.76909], - 167: [0.19444, 0.69444, 0, 0, 0.44445], - 168: [0, 0.66786, 0, 0, 0.5], - 172: [0, 0.43056, 0, 0, 0.66667], - 176: [0, 0.69444, 0, 0, 0.75], - 177: [0.08333, 0.58333, 0, 0, 0.77778], - 182: [0.19444, 0.69444, 0, 0, 0.61111], - 184: [0.17014, 0, 0, 0, 0.44445], - 198: [0, 0.68333, 0, 0, 0.90278], - 215: [0.08333, 0.58333, 0, 0, 0.77778], - 216: [0.04861, 0.73194, 0, 0, 0.77778], - 223: [0, 0.69444, 0, 0, 0.5], - 230: [0, 0.43056, 0, 0, 0.72222], - 247: [0.08333, 0.58333, 0, 0, 0.77778], - 248: [0.09722, 0.52778, 0, 0, 0.5], - 305: [0, 0.43056, 0, 0, 0.27778], - 338: [0, 0.68333, 0, 0, 1.01389], - 339: [0, 0.43056, 0, 0, 0.77778], - 567: [0.19444, 0.43056, 0, 0, 0.30556], - 710: [0, 0.69444, 0, 0, 0.5], - 711: [0, 0.62847, 0, 0, 0.5], - 713: [0, 0.56778, 0, 0, 0.5], - 714: [0, 0.69444, 0, 0, 0.5], - 715: [0, 0.69444, 0, 0, 0.5], - 728: [0, 0.69444, 0, 0, 0.5], - 729: [0, 0.66786, 0, 0, 0.27778], - 730: [0, 0.69444, 0, 0, 0.75], - 732: [0, 0.66786, 0, 0, 0.5], - 733: [0, 0.69444, 0, 0, 0.5], - 915: [0, 0.68333, 0, 0, 0.625], - 916: [0, 0.68333, 0, 0, 0.83334], - 920: [0, 0.68333, 0, 0, 0.77778], - 923: [0, 0.68333, 0, 0, 0.69445], - 926: [0, 0.68333, 0, 0, 0.66667], - 928: [0, 0.68333, 0, 0, 0.75], - 931: [0, 0.68333, 0, 0, 0.72222], - 933: [0, 0.68333, 0, 0, 0.77778], - 934: [0, 0.68333, 0, 0, 0.72222], - 936: [0, 0.68333, 0, 0, 0.77778], - 937: [0, 0.68333, 0, 0, 0.72222], - 8211: [0, 0.43056, 0.02778, 0, 0.5], - 8212: [0, 0.43056, 0.02778, 0, 1], - 8216: [0, 0.69444, 0, 0, 0.27778], - 8217: [0, 0.69444, 0, 0, 0.27778], - 8220: [0, 0.69444, 0, 0, 0.5], - 8221: [0, 0.69444, 0, 0, 0.5], - 8224: [0.19444, 0.69444, 0, 0, 0.44445], - 8225: [0.19444, 0.69444, 0, 0, 0.44445], - 8230: [0, 0.123, 0, 0, 1.172], - 8242: [0, 0.55556, 0, 0, 0.275], - 8407: [0, 0.71444, 0.15382, 0, 0.5], - 8463: [0, 0.68889, 0, 0, 0.54028], - 8465: [0, 0.69444, 0, 0, 0.72222], - 8467: [0, 0.69444, 0, 0.11111, 0.41667], - 8472: [0.19444, 0.43056, 0, 0.11111, 0.63646], - 8476: [0, 0.69444, 0, 0, 0.72222], - 8501: [0, 0.69444, 0, 0, 0.61111], - 8592: [-0.13313, 0.36687, 0, 0, 1], - 8593: [0.19444, 0.69444, 0, 0, 0.5], - 8594: [-0.13313, 0.36687, 0, 0, 1], - 8595: [0.19444, 0.69444, 0, 0, 0.5], - 8596: [-0.13313, 0.36687, 0, 0, 1], - 8597: [0.25, 0.75, 0, 0, 0.5], - 8598: [0.19444, 0.69444, 0, 0, 1], - 8599: [0.19444, 0.69444, 0, 0, 1], - 8600: [0.19444, 0.69444, 0, 0, 1], - 8601: [0.19444, 0.69444, 0, 0, 1], - 8614: [0.011, 0.511, 0, 0, 1], - 8617: [0.011, 0.511, 0, 0, 1.126], - 8618: [0.011, 0.511, 0, 0, 1.126], - 8636: [-0.13313, 0.36687, 0, 0, 1], - 8637: [-0.13313, 0.36687, 0, 0, 1], - 8640: [-0.13313, 0.36687, 0, 0, 1], - 8641: [-0.13313, 0.36687, 0, 0, 1], - 8652: [0.011, 0.671, 0, 0, 1], - 8656: [-0.13313, 0.36687, 0, 0, 1], - 8657: [0.19444, 0.69444, 0, 0, 0.61111], - 8658: [-0.13313, 0.36687, 0, 0, 1], - 8659: [0.19444, 0.69444, 0, 0, 0.61111], - 8660: [-0.13313, 0.36687, 0, 0, 1], - 8661: [0.25, 0.75, 0, 0, 0.61111], - 8704: [0, 0.69444, 0, 0, 0.55556], - 8706: [0, 0.69444, 0.05556, 0.08334, 0.5309], - 8707: [0, 0.69444, 0, 0, 0.55556], - 8709: [0.05556, 0.75, 0, 0, 0.5], - 8711: [0, 0.68333, 0, 0, 0.83334], - 8712: [0.0391, 0.5391, 0, 0, 0.66667], - 8715: [0.0391, 0.5391, 0, 0, 0.66667], - 8722: [0.08333, 0.58333, 0, 0, 0.77778], - 8723: [0.08333, 0.58333, 0, 0, 0.77778], - 8725: [0.25, 0.75, 0, 0, 0.5], - 8726: [0.25, 0.75, 0, 0, 0.5], - 8727: [-0.03472, 0.46528, 0, 0, 0.5], - 8728: [-0.05555, 0.44445, 0, 0, 0.5], - 8729: [-0.05555, 0.44445, 0, 0, 0.5], - 8730: [0.2, 0.8, 0, 0, 0.83334], - 8733: [0, 0.43056, 0, 0, 0.77778], - 8734: [0, 0.43056, 0, 0, 1], - 8736: [0, 0.69224, 0, 0, 0.72222], - 8739: [0.25, 0.75, 0, 0, 0.27778], - 8741: [0.25, 0.75, 0, 0, 0.5], - 8743: [0, 0.55556, 0, 0, 0.66667], - 8744: [0, 0.55556, 0, 0, 0.66667], - 8745: [0, 0.55556, 0, 0, 0.66667], - 8746: [0, 0.55556, 0, 0, 0.66667], - 8747: [0.19444, 0.69444, 0.11111, 0, 0.41667], - 8764: [-0.13313, 0.36687, 0, 0, 0.77778], - 8768: [0.19444, 0.69444, 0, 0, 0.27778], - 8771: [-0.03625, 0.46375, 0, 0, 0.77778], - 8773: [-0.022, 0.589, 0, 0, 0.778], - 8776: [-0.01688, 0.48312, 0, 0, 0.77778], - 8781: [-0.03625, 0.46375, 0, 0, 0.77778], - 8784: [-0.133, 0.673, 0, 0, 0.778], - 8801: [-0.03625, 0.46375, 0, 0, 0.77778], - 8804: [0.13597, 0.63597, 0, 0, 0.77778], - 8805: [0.13597, 0.63597, 0, 0, 0.77778], - 8810: [0.0391, 0.5391, 0, 0, 1], - 8811: [0.0391, 0.5391, 0, 0, 1], - 8826: [0.0391, 0.5391, 0, 0, 0.77778], - 8827: [0.0391, 0.5391, 0, 0, 0.77778], - 8834: [0.0391, 0.5391, 0, 0, 0.77778], - 8835: [0.0391, 0.5391, 0, 0, 0.77778], - 8838: [0.13597, 0.63597, 0, 0, 0.77778], - 8839: [0.13597, 0.63597, 0, 0, 0.77778], - 8846: [0, 0.55556, 0, 0, 0.66667], - 8849: [0.13597, 0.63597, 0, 0, 0.77778], - 8850: [0.13597, 0.63597, 0, 0, 0.77778], - 8851: [0, 0.55556, 0, 0, 0.66667], - 8852: [0, 0.55556, 0, 0, 0.66667], - 8853: [0.08333, 0.58333, 0, 0, 0.77778], - 8854: [0.08333, 0.58333, 0, 0, 0.77778], - 8855: [0.08333, 0.58333, 0, 0, 0.77778], - 8856: [0.08333, 0.58333, 0, 0, 0.77778], - 8857: [0.08333, 0.58333, 0, 0, 0.77778], - 8866: [0, 0.69444, 0, 0, 0.61111], - 8867: [0, 0.69444, 0, 0, 0.61111], - 8868: [0, 0.69444, 0, 0, 0.77778], - 8869: [0, 0.69444, 0, 0, 0.77778], - 8872: [0.249, 0.75, 0, 0, 0.867], - 8900: [-0.05555, 0.44445, 0, 0, 0.5], - 8901: [-0.05555, 0.44445, 0, 0, 0.27778], - 8902: [-0.03472, 0.46528, 0, 0, 0.5], - 8904: [0.005, 0.505, 0, 0, 0.9], - 8942: [0.03, 0.903, 0, 0, 0.278], - 8943: [-0.19, 0.313, 0, 0, 1.172], - 8945: [-0.1, 0.823, 0, 0, 1.282], - 8968: [0.25, 0.75, 0, 0, 0.44445], - 8969: [0.25, 0.75, 0, 0, 0.44445], - 8970: [0.25, 0.75, 0, 0, 0.44445], - 8971: [0.25, 0.75, 0, 0, 0.44445], - 8994: [-0.14236, 0.35764, 0, 0, 1], - 8995: [-0.14236, 0.35764, 0, 0, 1], - 9136: [0.244, 0.744, 0, 0, 0.412], - 9137: [0.244, 0.745, 0, 0, 0.412], - 9651: [0.19444, 0.69444, 0, 0, 0.88889], - 9657: [-0.03472, 0.46528, 0, 0, 0.5], - 9661: [0.19444, 0.69444, 0, 0, 0.88889], - 9667: [-0.03472, 0.46528, 0, 0, 0.5], - 9711: [0.19444, 0.69444, 0, 0, 1], - 9824: [0.12963, 0.69444, 0, 0, 0.77778], - 9825: [0.12963, 0.69444, 0, 0, 0.77778], - 9826: [0.12963, 0.69444, 0, 0, 0.77778], - 9827: [0.12963, 0.69444, 0, 0, 0.77778], - 9837: [0, 0.75, 0, 0, 0.38889], - 9838: [0.19444, 0.69444, 0, 0, 0.38889], - 9839: [0.19444, 0.69444, 0, 0, 0.38889], - 10216: [0.25, 0.75, 0, 0, 0.38889], - 10217: [0.25, 0.75, 0, 0, 0.38889], - 10222: [0.244, 0.744, 0, 0, 0.412], - 10223: [0.244, 0.745, 0, 0, 0.412], - 10229: [0.011, 0.511, 0, 0, 1.609], - 10230: [0.011, 0.511, 0, 0, 1.638], - 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: [0.011, 0.511, 0, 0, 1.638], - 10815: [0, 0.68333, 0, 0, 0.75], - 10927: [0.13597, 0.63597, 0, 0, 0.77778], - 10928: [0.13597, 0.63597, 0, 0, 0.77778], - 57376: [0.19444, 0.69444, 0, 0, 0], - }, - "Math-BoldItalic": { - 32: [0, 0, 0, 0, 0.25], - 48: [0, 0.44444, 0, 0, 0.575], - 49: [0, 0.44444, 0, 0, 0.575], - 50: [0, 0.44444, 0, 0, 0.575], - 51: [0.19444, 0.44444, 0, 0, 0.575], - 52: [0.19444, 0.44444, 0, 0, 0.575], - 53: [0.19444, 0.44444, 0, 0, 0.575], - 54: [0, 0.64444, 0, 0, 0.575], - 55: [0.19444, 0.44444, 0, 0, 0.575], - 56: [0, 0.64444, 0, 0, 0.575], - 57: [0.19444, 0.44444, 0, 0, 0.575], - 65: [0, 0.68611, 0, 0, 0.86944], - 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: [0, 0.68611, 0.08229, 0, 0.98229], - 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: [0, 0.68611, 0, 0, 0.75555], - 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, 0.00421, 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: [0, 0.69444, 0, 0, 0.66759], - 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, 0.0088, 0, 0.34815], - 109: [0, 0.44444, 0, 0, 1.0324], - 110: [0, 0.44444, 0, 0, 0.71296], - 111: [0, 0.44444, 0, 0, 0.58472], - 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: [0, 0, 0, 0, 0.25], - 915: [0, 0.68611, 0.15972, 0, 0.65694], - 916: [0, 0.68611, 0, 0, 0.95833], - 920: [0, 0.68611, 0.03194, 0, 0.86722], - 923: [0, 0.68611, 0, 0, 0.80555], - 926: [0, 0.68611, 0.07458, 0, 0.84125], - 928: [0, 0.68611, 0.08229, 0, 0.98229], - 931: [0, 0.68611, 0.05451, 0, 0.88507], - 933: [0, 0.68611, 0.15972, 0, 0.67083], - 934: [0, 0.68611, 0, 0, 0.76666], - 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: [0, 0.44444, 0, 0, 0.58472], - 960: [0, 0.44444, 0.03704, 0, 0.68241], - 961: [0.19444, 0.44444, 0, 0, 0.6118], - 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: [0.19444, 0.44444, 0, 0, 0.6118], - 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: [0, 0, 0, 0, 0.25], - 48: [0, 0.43056, 0, 0, 0.5], - 49: [0, 0.43056, 0, 0, 0.5], - 50: [0, 0.43056, 0, 0, 0.5], - 51: [0.19444, 0.43056, 0, 0, 0.5], - 52: [0.19444, 0.43056, 0, 0, 0.5], - 53: [0.19444, 0.43056, 0, 0, 0.5], - 54: [0, 0.64444, 0, 0, 0.5], - 55: [0.19444, 0.43056, 0, 0, 0.5], - 56: [0, 0.64444, 0, 0, 0.5], - 57: [0.19444, 0.43056, 0, 0, 0.5], - 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: [0, 0.68333, 0.08125, 0.05556, 0.83125], - 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: [0, 0.68333, 0.02778, 0.08334, 0.76278], - 80: [0, 0.68333, 0.13889, 0.08334, 0.64201], - 81: [0.19444, 0.68333, 0, 0.08334, 0.79056], - 82: [0, 0.68333, 0.00773, 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: [0, 0.43056, 0, 0.05556, 0.48472], - 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: [0, 0, 0, 0, 0.25], - 915: [0, 0.68333, 0.13889, 0.08334, 0.61528], - 916: [0, 0.68333, 0, 0.16667, 0.83334], - 920: [0, 0.68333, 0.02778, 0.08334, 0.76278], - 923: [0, 0.68333, 0, 0.16667, 0.69445], - 926: [0, 0.68333, 0.07569, 0.08334, 0.74236], - 928: [0, 0.68333, 0.08125, 0.05556, 0.83125], - 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, 0.0037, 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: [0, 0.43056, 0, 0.05556, 0.48472], - 960: [0, 0.43056, 0.03588, 0, 0.57003], - 961: [0.19444, 0.43056, 0, 0.08334, 0.51702], - 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: [0.19444, 0.43056, 0, 0.08334, 0.51702], - 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: [0, 0, 0, 0, 0.25], - 33: [0, 0.69444, 0, 0, 0.36667], - 34: [0, 0.69444, 0, 0, 0.55834], - 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: [0, 0.69444, 0, 0, 0.30556], - 40: [0.25, 0.75, 0, 0, 0.42778], - 41: [0.25, 0.75, 0, 0, 0.42778], - 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: [0, 0.69444, 0, 0, 0.55], - 49: [0, 0.69444, 0, 0, 0.55], - 50: [0, 0.69444, 0, 0, 0.55], - 51: [0, 0.69444, 0, 0, 0.55], - 52: [0, 0.69444, 0, 0, 0.55], - 53: [0, 0.69444, 0, 0, 0.55], - 54: [0, 0.69444, 0, 0, 0.55], - 55: [0, 0.69444, 0, 0, 0.55], - 56: [0, 0.69444, 0, 0, 0.55], - 57: [0, 0.69444, 0, 0, 0.55], - 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: [0, 0.69444, 0, 0, 0.51945], - 64: [0, 0.69444, 0, 0, 0.73334], - 65: [0, 0.69444, 0, 0, 0.73334], - 66: [0, 0.69444, 0, 0, 0.73334], - 67: [0, 0.69444, 0, 0, 0.70278], - 68: [0, 0.69444, 0, 0, 0.79445], - 69: [0, 0.69444, 0, 0, 0.64167], - 70: [0, 0.69444, 0, 0, 0.61111], - 71: [0, 0.69444, 0, 0, 0.73334], - 72: [0, 0.69444, 0, 0, 0.79445], - 73: [0, 0.69444, 0, 0, 0.33056], - 74: [0, 0.69444, 0, 0, 0.51945], - 75: [0, 0.69444, 0, 0, 0.76389], - 76: [0, 0.69444, 0, 0, 0.58056], - 77: [0, 0.69444, 0, 0, 0.97778], - 78: [0, 0.69444, 0, 0, 0.79445], - 79: [0, 0.69444, 0, 0, 0.79445], - 80: [0, 0.69444, 0, 0, 0.70278], - 81: [0.10556, 0.69444, 0, 0, 0.79445], - 82: [0, 0.69444, 0, 0, 0.70278], - 83: [0, 0.69444, 0, 0, 0.61111], - 84: [0, 0.69444, 0, 0, 0.73334], - 85: [0, 0.69444, 0, 0, 0.76389], - 86: [0, 0.69444, 0.01528, 0, 0.73334], - 87: [0, 0.69444, 0.01528, 0, 1.03889], - 88: [0, 0.69444, 0, 0, 0.73334], - 89: [0, 0.69444, 0.0275, 0, 0.73334], - 90: [0, 0.69444, 0, 0, 0.67223], - 91: [0.25, 0.75, 0, 0, 0.34306], - 93: [0.25, 0.75, 0, 0, 0.34306], - 94: [0, 0.69444, 0, 0, 0.55], - 95: [0.35, 0.10833, 0.03056, 0, 0.55], - 97: [0, 0.45833, 0, 0, 0.525], - 98: [0, 0.69444, 0, 0, 0.56111], - 99: [0, 0.45833, 0, 0, 0.48889], - 100: [0, 0.69444, 0, 0, 0.56111], - 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: [0, 0.69444, 0, 0, 0.56111], - 105: [0, 0.69444, 0, 0, 0.25556], - 106: [0.19444, 0.69444, 0, 0, 0.28611], - 107: [0, 0.69444, 0, 0, 0.53056], - 108: [0, 0.69444, 0, 0, 0.25556], - 109: [0, 0.45833, 0, 0, 0.86667], - 110: [0, 0.45833, 0, 0, 0.56111], - 111: [0, 0.45833, 0, 0, 0.55], - 112: [0.19444, 0.45833, 0, 0, 0.56111], - 113: [0.19444, 0.45833, 0, 0, 0.56111], - 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: [0, 0.45833, 0, 0, 0.56111], - 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: [0, 0, 0, 0, 0.25], - 168: [0, 0.69444, 0, 0, 0.55], - 176: [0, 0.69444, 0, 0, 0.73334], - 180: [0, 0.69444, 0, 0, 0.55], - 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: [0, 0.69444, 0, 0, 0.55], - 711: [0, 0.63542, 0, 0, 0.55], - 713: [0, 0.63778, 0, 0, 0.55], - 728: [0, 0.69444, 0, 0, 0.55], - 729: [0, 0.69444, 0, 0, 0.30556], - 730: [0, 0.69444, 0, 0, 0.73334], - 732: [0, 0.69444, 0, 0, 0.55], - 733: [0, 0.69444, 0, 0, 0.55], - 915: [0, 0.69444, 0, 0, 0.58056], - 916: [0, 0.69444, 0, 0, 0.91667], - 920: [0, 0.69444, 0, 0, 0.85556], - 923: [0, 0.69444, 0, 0, 0.67223], - 926: [0, 0.69444, 0, 0, 0.73334], - 928: [0, 0.69444, 0, 0, 0.79445], - 931: [0, 0.69444, 0, 0, 0.79445], - 933: [0, 0.69444, 0, 0, 0.85556], - 934: [0, 0.69444, 0, 0, 0.79445], - 936: [0, 0.69444, 0, 0, 0.85556], - 937: [0, 0.69444, 0, 0, 0.79445], - 8211: [0, 0.45833, 0.03056, 0, 0.55], - 8212: [0, 0.45833, 0.03056, 0, 1.10001], - 8216: [0, 0.69444, 0, 0, 0.30556], - 8217: [0, 0.69444, 0, 0, 0.30556], - 8220: [0, 0.69444, 0, 0, 0.55834], - 8221: [0, 0.69444, 0, 0, 0.55834], - }, - "SansSerif-Italic": { - 32: [0, 0, 0, 0, 0.25], - 33: [0, 0.69444, 0.05733, 0, 0.31945], - 34: [0, 0.69444, 0.00316, 0, 0.5], - 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: [0, 0.69444, 0.07816, 0, 0.27778], - 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: [0.125, 0.08333, 0, 0, 0.27778], - 45: [0, 0.44444, 0.01946, 0, 0.33333], - 46: [0, 0.08333, 0, 0, 0.27778], - 47: [0.25, 0.75, 0.13164, 0, 0.5], - 48: [0, 0.65556, 0.11156, 0, 0.5], - 49: [0, 0.65556, 0.11156, 0, 0.5], - 50: [0, 0.65556, 0.11156, 0, 0.5], - 51: [0, 0.65556, 0.11156, 0, 0.5], - 52: [0, 0.65556, 0.11156, 0, 0.5], - 53: [0, 0.65556, 0.11156, 0, 0.5], - 54: [0, 0.65556, 0.11156, 0, 0.5], - 55: [0, 0.65556, 0.11156, 0, 0.5], - 56: [0, 0.65556, 0.11156, 0, 0.5], - 57: [0, 0.65556, 0.11156, 0, 0.5], - 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: [0, 0.69444, 0, 0, 0.66667], - 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: [0, 0.69444, 0.08094, 0, 0.70834], - 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: [0, 0.69444, 0, 0, 0.54167], - 77: [0, 0.69444, 0.08094, 0, 0.875], - 78: [0, 0.69444, 0.08094, 0, 0.70834], - 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: [0, 0.69444, 0.0799, 0, 0.5], - 95: [0.35, 0.09444, 0.08616, 0, 0.5], - 97: [0, 0.44444, 0.00981, 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: [0, 0, 0, 0, 0.25], - 168: [0, 0.67937, 0.06385, 0, 0.5], - 176: [0, 0.69444, 0, 0, 0.73752], - 184: [0.17014, 0, 0, 0, 0.44445], - 305: [0, 0.44444, 0.04169, 0, 0.23889], - 567: [0.19444, 0.44444, 0.04169, 0, 0.26667], - 710: [0, 0.69444, 0.0799, 0, 0.5], - 711: [0, 0.63194, 0.08432, 0, 0.5], - 713: [0, 0.60889, 0.08776, 0, 0.5], - 714: [0, 0.69444, 0.09205, 0, 0.5], - 715: [0, 0.69444, 0, 0, 0.5], - 728: [0, 0.69444, 0.09483, 0, 0.5], - 729: [0, 0.67937, 0.07774, 0, 0.27778], - 730: [0, 0.69444, 0, 0, 0.73752], - 732: [0, 0.67659, 0.08826, 0, 0.5], - 733: [0, 0.69444, 0.09205, 0, 0.5], - 915: [0, 0.69444, 0.13372, 0, 0.54167], - 916: [0, 0.69444, 0, 0, 0.83334], - 920: [0, 0.69444, 0.07555, 0, 0.77778], - 923: [0, 0.69444, 0, 0, 0.61111], - 926: [0, 0.69444, 0.12816, 0, 0.66667], - 928: [0, 0.69444, 0.08094, 0, 0.70834], - 931: [0, 0.69444, 0.11983, 0, 0.72222], - 933: [0, 0.69444, 0.09031, 0, 0.77778], - 934: [0, 0.69444, 0.04603, 0, 0.72222], - 936: [0, 0.69444, 0.09031, 0, 0.77778], - 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: [0, 0.69444, 0.07816, 0, 0.27778], - 8217: [0, 0.69444, 0.07816, 0, 0.27778], - 8220: [0, 0.69444, 0.14205, 0, 0.5], - 8221: [0, 0.69444, 0.00316, 0, 0.5], - }, - "SansSerif-Regular": { - 32: [0, 0, 0, 0, 0.25], - 33: [0, 0.69444, 0, 0, 0.31945], - 34: [0, 0.69444, 0, 0, 0.5], - 35: [0.19444, 0.69444, 0, 0, 0.83334], - 36: [0.05556, 0.75, 0, 0, 0.5], - 37: [0.05556, 0.75, 0, 0, 0.83334], - 38: [0, 0.69444, 0, 0, 0.75834], - 39: [0, 0.69444, 0, 0, 0.27778], - 40: [0.25, 0.75, 0, 0, 0.38889], - 41: [0.25, 0.75, 0, 0, 0.38889], - 42: [0, 0.75, 0, 0, 0.5], - 43: [0.08333, 0.58333, 0, 0, 0.77778], - 44: [0.125, 0.08333, 0, 0, 0.27778], - 45: [0, 0.44444, 0, 0, 0.33333], - 46: [0, 0.08333, 0, 0, 0.27778], - 47: [0.25, 0.75, 0, 0, 0.5], - 48: [0, 0.65556, 0, 0, 0.5], - 49: [0, 0.65556, 0, 0, 0.5], - 50: [0, 0.65556, 0, 0, 0.5], - 51: [0, 0.65556, 0, 0, 0.5], - 52: [0, 0.65556, 0, 0, 0.5], - 53: [0, 0.65556, 0, 0, 0.5], - 54: [0, 0.65556, 0, 0, 0.5], - 55: [0, 0.65556, 0, 0, 0.5], - 56: [0, 0.65556, 0, 0, 0.5], - 57: [0, 0.65556, 0, 0, 0.5], - 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: [0, 0.69444, 0, 0, 0.47222], - 64: [0, 0.69444, 0, 0, 0.66667], - 65: [0, 0.69444, 0, 0, 0.66667], - 66: [0, 0.69444, 0, 0, 0.66667], - 67: [0, 0.69444, 0, 0, 0.63889], - 68: [0, 0.69444, 0, 0, 0.72223], - 69: [0, 0.69444, 0, 0, 0.59722], - 70: [0, 0.69444, 0, 0, 0.56945], - 71: [0, 0.69444, 0, 0, 0.66667], - 72: [0, 0.69444, 0, 0, 0.70834], - 73: [0, 0.69444, 0, 0, 0.27778], - 74: [0, 0.69444, 0, 0, 0.47222], - 75: [0, 0.69444, 0, 0, 0.69445], - 76: [0, 0.69444, 0, 0, 0.54167], - 77: [0, 0.69444, 0, 0, 0.875], - 78: [0, 0.69444, 0, 0, 0.70834], - 79: [0, 0.69444, 0, 0, 0.73611], - 80: [0, 0.69444, 0, 0, 0.63889], - 81: [0.125, 0.69444, 0, 0, 0.73611], - 82: [0, 0.69444, 0, 0, 0.64584], - 83: [0, 0.69444, 0, 0, 0.55556], - 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: [0, 0.69444, 0, 0, 0.66667], - 89: [0, 0.69444, 0.025, 0, 0.66667], - 90: [0, 0.69444, 0, 0, 0.61111], - 91: [0.25, 0.75, 0, 0, 0.28889], - 93: [0.25, 0.75, 0, 0, 0.28889], - 94: [0, 0.69444, 0, 0, 0.5], - 95: [0.35, 0.09444, 0.02778, 0, 0.5], - 97: [0, 0.44444, 0, 0, 0.48056], - 98: [0, 0.69444, 0, 0, 0.51667], - 99: [0, 0.44444, 0, 0, 0.44445], - 100: [0, 0.69444, 0, 0, 0.51667], - 101: [0, 0.44444, 0, 0, 0.44445], - 102: [0, 0.69444, 0.06944, 0, 0.30556], - 103: [0.19444, 0.44444, 0.01389, 0, 0.5], - 104: [0, 0.69444, 0, 0, 0.51667], - 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: [0, 0.44444, 0, 0, 0.51667], - 111: [0, 0.44444, 0, 0, 0.5], - 112: [0.19444, 0.44444, 0, 0, 0.51667], - 113: [0.19444, 0.44444, 0, 0, 0.51667], - 114: [0, 0.44444, 0.01389, 0, 0.34167], - 115: [0, 0.44444, 0, 0, 0.38333], - 116: [0, 0.57143, 0, 0, 0.36111], - 117: [0, 0.44444, 0, 0, 0.51667], - 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: [0, 0, 0, 0, 0.25], - 168: [0, 0.67937, 0, 0, 0.5], - 176: [0, 0.69444, 0, 0, 0.66667], - 184: [0.17014, 0, 0, 0, 0.44445], - 305: [0, 0.44444, 0, 0, 0.23889], - 567: [0.19444, 0.44444, 0, 0, 0.26667], - 710: [0, 0.69444, 0, 0, 0.5], - 711: [0, 0.63194, 0, 0, 0.5], - 713: [0, 0.60889, 0, 0, 0.5], - 714: [0, 0.69444, 0, 0, 0.5], - 715: [0, 0.69444, 0, 0, 0.5], - 728: [0, 0.69444, 0, 0, 0.5], - 729: [0, 0.67937, 0, 0, 0.27778], - 730: [0, 0.69444, 0, 0, 0.66667], - 732: [0, 0.67659, 0, 0, 0.5], - 733: [0, 0.69444, 0, 0, 0.5], - 915: [0, 0.69444, 0, 0, 0.54167], - 916: [0, 0.69444, 0, 0, 0.83334], - 920: [0, 0.69444, 0, 0, 0.77778], - 923: [0, 0.69444, 0, 0, 0.61111], - 926: [0, 0.69444, 0, 0, 0.66667], - 928: [0, 0.69444, 0, 0, 0.70834], - 931: [0, 0.69444, 0, 0, 0.72222], - 933: [0, 0.69444, 0, 0, 0.77778], - 934: [0, 0.69444, 0, 0, 0.72222], - 936: [0, 0.69444, 0, 0, 0.77778], - 937: [0, 0.69444, 0, 0, 0.72222], - 8211: [0, 0.44444, 0.02778, 0, 0.5], - 8212: [0, 0.44444, 0.02778, 0, 1], - 8216: [0, 0.69444, 0, 0, 0.27778], - 8217: [0, 0.69444, 0, 0, 0.27778], - 8220: [0, 0.69444, 0, 0, 0.5], - 8221: [0, 0.69444, 0, 0, 0.5], - }, - "Script-Regular": { - 32: [0, 0, 0, 0, 0.25], - 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: [0, 0, 0, 0, 0.25], - }, - "Size1-Regular": { - 32: [0, 0, 0, 0, 0.25], - 40: [0.35001, 0.85, 0, 0, 0.45834], - 41: [0.35001, 0.85, 0, 0, 0.45834], - 47: [0.35001, 0.85, 0, 0, 0.57778], - 91: [0.35001, 0.85, 0, 0, 0.41667], - 92: [0.35001, 0.85, 0, 0, 0.57778], - 93: [0.35001, 0.85, 0, 0, 0.41667], - 123: [0.35001, 0.85, 0, 0, 0.58334], - 125: [0.35001, 0.85, 0, 0, 0.58334], - 160: [0, 0, 0, 0, 0.25], - 710: [0, 0.72222, 0, 0, 0.55556], - 732: [0, 0.72222, 0, 0, 0.55556], - 770: [0, 0.72222, 0, 0, 0.55556], - 771: [0, 0.72222, 0, 0, 0.55556], - 8214: [-99e-5, 0.601, 0, 0, 0.77778], - 8593: [1e-5, 0.6, 0, 0, 0.66667], - 8595: [1e-5, 0.6, 0, 0, 0.66667], - 8657: [1e-5, 0.6, 0, 0, 0.77778], - 8659: [1e-5, 0.6, 0, 0, 0.77778], - 8719: [0.25001, 0.75, 0, 0, 0.94445], - 8720: [0.25001, 0.75, 0, 0, 0.94445], - 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: [0.30612, 0.805, 0.19445, 0, 0.47222], - 8748: [0.306, 0.805, 0.19445, 0, 0.47222], - 8749: [0.306, 0.805, 0.19445, 0, 0.47222], - 8750: [0.30612, 0.805, 0.19445, 0, 0.47222], - 8896: [0.25001, 0.75, 0, 0, 0.83334], - 8897: [0.25001, 0.75, 0, 0, 0.83334], - 8898: [0.25001, 0.75, 0, 0, 0.83334], - 8899: [0.25001, 0.75, 0, 0, 0.83334], - 8968: [0.35001, 0.85, 0, 0, 0.47222], - 8969: [0.35001, 0.85, 0, 0, 0.47222], - 8970: [0.35001, 0.85, 0, 0, 0.47222], - 8971: [0.35001, 0.85, 0, 0, 0.47222], - 9168: [-99e-5, 0.601, 0, 0, 0.66667], - 10216: [0.35001, 0.85, 0, 0, 0.47222], - 10217: [0.35001, 0.85, 0, 0, 0.47222], - 10752: [0.25001, 0.75, 0, 0, 1.11111], - 10753: [0.25001, 0.75, 0, 0, 1.11111], - 10754: [0.25001, 0.75, 0, 0, 1.11111], - 10756: [0.25001, 0.75, 0, 0, 0.83334], - 10758: [0.25001, 0.75, 0, 0, 0.83334], - }, - "Size2-Regular": { - 32: [0, 0, 0, 0, 0.25], - 40: [0.65002, 1.15, 0, 0, 0.59722], - 41: [0.65002, 1.15, 0, 0, 0.59722], - 47: [0.65002, 1.15, 0, 0, 0.81111], - 91: [0.65002, 1.15, 0, 0, 0.47222], - 92: [0.65002, 1.15, 0, 0, 0.81111], - 93: [0.65002, 1.15, 0, 0, 0.47222], - 123: [0.65002, 1.15, 0, 0, 0.66667], - 125: [0.65002, 1.15, 0, 0, 0.66667], - 160: [0, 0, 0, 0, 0.25], - 710: [0, 0.75, 0, 0, 1], - 732: [0, 0.75, 0, 0, 1], - 770: [0, 0.75, 0, 0, 1], - 771: [0, 0.75, 0, 0, 1], - 8719: [0.55001, 1.05, 0, 0, 1.27778], - 8720: [0.55001, 1.05, 0, 0, 1.27778], - 8721: [0.55001, 1.05, 0, 0, 1.44445], - 8730: [0.65002, 1.15, 0, 0, 1], - 8747: [0.86225, 1.36, 0.44445, 0, 0.55556], - 8748: [0.862, 1.36, 0.44445, 0, 0.55556], - 8749: [0.862, 1.36, 0.44445, 0, 0.55556], - 8750: [0.86225, 1.36, 0.44445, 0, 0.55556], - 8896: [0.55001, 1.05, 0, 0, 1.11111], - 8897: [0.55001, 1.05, 0, 0, 1.11111], - 8898: [0.55001, 1.05, 0, 0, 1.11111], - 8899: [0.55001, 1.05, 0, 0, 1.11111], - 8968: [0.65002, 1.15, 0, 0, 0.52778], - 8969: [0.65002, 1.15, 0, 0, 0.52778], - 8970: [0.65002, 1.15, 0, 0, 0.52778], - 8971: [0.65002, 1.15, 0, 0, 0.52778], - 10216: [0.65002, 1.15, 0, 0, 0.61111], - 10217: [0.65002, 1.15, 0, 0, 0.61111], - 10752: [0.55001, 1.05, 0, 0, 1.51112], - 10753: [0.55001, 1.05, 0, 0, 1.51112], - 10754: [0.55001, 1.05, 0, 0, 1.51112], - 10756: [0.55001, 1.05, 0, 0, 1.11111], - 10758: [0.55001, 1.05, 0, 0, 1.11111], - }, - "Size3-Regular": { - 32: [0, 0, 0, 0, 0.25], - 40: [0.95003, 1.45, 0, 0, 0.73611], - 41: [0.95003, 1.45, 0, 0, 0.73611], - 47: [0.95003, 1.45, 0, 0, 1.04445], - 91: [0.95003, 1.45, 0, 0, 0.52778], - 92: [0.95003, 1.45, 0, 0, 1.04445], - 93: [0.95003, 1.45, 0, 0, 0.52778], - 123: [0.95003, 1.45, 0, 0, 0.75], - 125: [0.95003, 1.45, 0, 0, 0.75], - 160: [0, 0, 0, 0, 0.25], - 710: [0, 0.75, 0, 0, 1.44445], - 732: [0, 0.75, 0, 0, 1.44445], - 770: [0, 0.75, 0, 0, 1.44445], - 771: [0, 0.75, 0, 0, 1.44445], - 8730: [0.95003, 1.45, 0, 0, 1], - 8968: [0.95003, 1.45, 0, 0, 0.58334], - 8969: [0.95003, 1.45, 0, 0, 0.58334], - 8970: [0.95003, 1.45, 0, 0, 0.58334], - 8971: [0.95003, 1.45, 0, 0, 0.58334], - 10216: [0.95003, 1.45, 0, 0, 0.75], - 10217: [0.95003, 1.45, 0, 0, 0.75], - }, - "Size4-Regular": { - 32: [0, 0, 0, 0, 0.25], - 40: [1.25003, 1.75, 0, 0, 0.79167], - 41: [1.25003, 1.75, 0, 0, 0.79167], - 47: [1.25003, 1.75, 0, 0, 1.27778], - 91: [1.25003, 1.75, 0, 0, 0.58334], - 92: [1.25003, 1.75, 0, 0, 1.27778], - 93: [1.25003, 1.75, 0, 0, 0.58334], - 123: [1.25003, 1.75, 0, 0, 0.80556], - 125: [1.25003, 1.75, 0, 0, 0.80556], - 160: [0, 0, 0, 0, 0.25], - 710: [0, 0.825, 0, 0, 1.8889], - 732: [0, 0.825, 0, 0, 1.8889], - 770: [0, 0.825, 0, 0, 1.8889], - 771: [0, 0.825, 0, 0, 1.8889], - 8730: [1.25003, 1.75, 0, 0, 1], - 8968: [1.25003, 1.75, 0, 0, 0.63889], - 8969: [1.25003, 1.75, 0, 0, 0.63889], - 8970: [1.25003, 1.75, 0, 0, 0.63889], - 8971: [1.25003, 1.75, 0, 0, 0.63889], - 9115: [0.64502, 1.155, 0, 0, 0.875], - 9116: [1e-5, 0.6, 0, 0, 0.875], - 9117: [0.64502, 1.155, 0, 0, 0.875], - 9118: [0.64502, 1.155, 0, 0, 0.875], - 9119: [1e-5, 0.6, 0, 0, 0.875], - 9120: [0.64502, 1.155, 0, 0, 0.875], - 9121: [0.64502, 1.155, 0, 0, 0.66667], - 9122: [-99e-5, 0.601, 0, 0, 0.66667], - 9123: [0.64502, 1.155, 0, 0, 0.66667], - 9124: [0.64502, 1.155, 0, 0, 0.66667], - 9125: [-99e-5, 0.601, 0, 0, 0.66667], - 9126: [0.64502, 1.155, 0, 0, 0.66667], - 9127: [1e-5, 0.9, 0, 0, 0.88889], - 9128: [0.65002, 1.15, 0, 0, 0.88889], - 9129: [0.90001, 0, 0, 0, 0.88889], - 9130: [0, 0.3, 0, 0, 0.88889], - 9131: [1e-5, 0.9, 0, 0, 0.88889], - 9132: [0.65002, 1.15, 0, 0, 0.88889], - 9133: [0.90001, 0, 0, 0, 0.88889], - 9143: [0.88502, 0.915, 0, 0, 1.05556], - 10216: [1.25003, 1.75, 0, 0, 0.80556], - 10217: [1.25003, 1.75, 0, 0, 0.80556], - 57344: [-499e-5, 0.605, 0, 0, 1.05556], - 57345: [-499e-5, 0.605, 0, 0, 1.05556], - 57680: [0, 0.12, 0, 0, 0.45], - 57681: [0, 0.12, 0, 0, 0.45], - 57682: [0, 0.12, 0, 0, 0.45], - 57683: [0, 0.12, 0, 0, 0.45], - }, - "Typewriter-Regular": { - 32: [0, 0, 0, 0, 0.525], - 33: [0, 0.61111, 0, 0, 0.525], - 34: [0, 0.61111, 0, 0, 0.525], - 35: [0, 0.61111, 0, 0, 0.525], - 36: [0.08333, 0.69444, 0, 0, 0.525], - 37: [0.08333, 0.69444, 0, 0, 0.525], - 38: [0, 0.61111, 0, 0, 0.525], - 39: [0, 0.61111, 0, 0, 0.525], - 40: [0.08333, 0.69444, 0, 0, 0.525], - 41: [0.08333, 0.69444, 0, 0, 0.525], - 42: [0, 0.52083, 0, 0, 0.525], - 43: [-0.08056, 0.53055, 0, 0, 0.525], - 44: [0.13889, 0.125, 0, 0, 0.525], - 45: [-0.08056, 0.53055, 0, 0, 0.525], - 46: [0, 0.125, 0, 0, 0.525], - 47: [0.08333, 0.69444, 0, 0, 0.525], - 48: [0, 0.61111, 0, 0, 0.525], - 49: [0, 0.61111, 0, 0, 0.525], - 50: [0, 0.61111, 0, 0, 0.525], - 51: [0, 0.61111, 0, 0, 0.525], - 52: [0, 0.61111, 0, 0, 0.525], - 53: [0, 0.61111, 0, 0, 0.525], - 54: [0, 0.61111, 0, 0, 0.525], - 55: [0, 0.61111, 0, 0, 0.525], - 56: [0, 0.61111, 0, 0, 0.525], - 57: [0, 0.61111, 0, 0, 0.525], - 58: [0, 0.43056, 0, 0, 0.525], - 59: [0.13889, 0.43056, 0, 0, 0.525], - 60: [-0.05556, 0.55556, 0, 0, 0.525], - 61: [-0.19549, 0.41562, 0, 0, 0.525], - 62: [-0.05556, 0.55556, 0, 0, 0.525], - 63: [0, 0.61111, 0, 0, 0.525], - 64: [0, 0.61111, 0, 0, 0.525], - 65: [0, 0.61111, 0, 0, 0.525], - 66: [0, 0.61111, 0, 0, 0.525], - 67: [0, 0.61111, 0, 0, 0.525], - 68: [0, 0.61111, 0, 0, 0.525], - 69: [0, 0.61111, 0, 0, 0.525], - 70: [0, 0.61111, 0, 0, 0.525], - 71: [0, 0.61111, 0, 0, 0.525], - 72: [0, 0.61111, 0, 0, 0.525], - 73: [0, 0.61111, 0, 0, 0.525], - 74: [0, 0.61111, 0, 0, 0.525], - 75: [0, 0.61111, 0, 0, 0.525], - 76: [0, 0.61111, 0, 0, 0.525], - 77: [0, 0.61111, 0, 0, 0.525], - 78: [0, 0.61111, 0, 0, 0.525], - 79: [0, 0.61111, 0, 0, 0.525], - 80: [0, 0.61111, 0, 0, 0.525], - 81: [0.13889, 0.61111, 0, 0, 0.525], - 82: [0, 0.61111, 0, 0, 0.525], - 83: [0, 0.61111, 0, 0, 0.525], - 84: [0, 0.61111, 0, 0, 0.525], - 85: [0, 0.61111, 0, 0, 0.525], - 86: [0, 0.61111, 0, 0, 0.525], - 87: [0, 0.61111, 0, 0, 0.525], - 88: [0, 0.61111, 0, 0, 0.525], - 89: [0, 0.61111, 0, 0, 0.525], - 90: [0, 0.61111, 0, 0, 0.525], - 91: [0.08333, 0.69444, 0, 0, 0.525], - 92: [0.08333, 0.69444, 0, 0, 0.525], - 93: [0.08333, 0.69444, 0, 0, 0.525], - 94: [0, 0.61111, 0, 0, 0.525], - 95: [0.09514, 0, 0, 0, 0.525], - 96: [0, 0.61111, 0, 0, 0.525], - 97: [0, 0.43056, 0, 0, 0.525], - 98: [0, 0.61111, 0, 0, 0.525], - 99: [0, 0.43056, 0, 0, 0.525], - 100: [0, 0.61111, 0, 0, 0.525], - 101: [0, 0.43056, 0, 0, 0.525], - 102: [0, 0.61111, 0, 0, 0.525], - 103: [0.22222, 0.43056, 0, 0, 0.525], - 104: [0, 0.61111, 0, 0, 0.525], - 105: [0, 0.61111, 0, 0, 0.525], - 106: [0.22222, 0.61111, 0, 0, 0.525], - 107: [0, 0.61111, 0, 0, 0.525], - 108: [0, 0.61111, 0, 0, 0.525], - 109: [0, 0.43056, 0, 0, 0.525], - 110: [0, 0.43056, 0, 0, 0.525], - 111: [0, 0.43056, 0, 0, 0.525], - 112: [0.22222, 0.43056, 0, 0, 0.525], - 113: [0.22222, 0.43056, 0, 0, 0.525], - 114: [0, 0.43056, 0, 0, 0.525], - 115: [0, 0.43056, 0, 0, 0.525], - 116: [0, 0.55358, 0, 0, 0.525], - 117: [0, 0.43056, 0, 0, 0.525], - 118: [0, 0.43056, 0, 0, 0.525], - 119: [0, 0.43056, 0, 0, 0.525], - 120: [0, 0.43056, 0, 0, 0.525], - 121: [0.22222, 0.43056, 0, 0, 0.525], - 122: [0, 0.43056, 0, 0, 0.525], - 123: [0.08333, 0.69444, 0, 0, 0.525], - 124: [0.08333, 0.69444, 0, 0, 0.525], - 125: [0.08333, 0.69444, 0, 0, 0.525], - 126: [0, 0.61111, 0, 0, 0.525], - 127: [0, 0.61111, 0, 0, 0.525], - 160: [0, 0, 0, 0, 0.525], - 176: [0, 0.61111, 0, 0, 0.525], - 184: [0.19445, 0, 0, 0, 0.525], - 305: [0, 0.43056, 0, 0, 0.525], - 567: [0.22222, 0.43056, 0, 0, 0.525], - 711: [0, 0.56597, 0, 0, 0.525], - 713: [0, 0.56555, 0, 0, 0.525], - 714: [0, 0.61111, 0, 0, 0.525], - 715: [0, 0.61111, 0, 0, 0.525], - 728: [0, 0.61111, 0, 0, 0.525], - 730: [0, 0.61111, 0, 0, 0.525], - 770: [0, 0.61111, 0, 0, 0.525], - 771: [0, 0.61111, 0, 0, 0.525], - 776: [0, 0.61111, 0, 0, 0.525], - 915: [0, 0.61111, 0, 0, 0.525], - 916: [0, 0.61111, 0, 0, 0.525], - 920: [0, 0.61111, 0, 0, 0.525], - 923: [0, 0.61111, 0, 0, 0.525], - 926: [0, 0.61111, 0, 0, 0.525], - 928: [0, 0.61111, 0, 0, 0.525], - 931: [0, 0.61111, 0, 0, 0.525], - 933: [0, 0.61111, 0, 0, 0.525], - 934: [0, 0.61111, 0, 0, 0.525], - 936: [0, 0.61111, 0, 0, 0.525], - 937: [0, 0.61111, 0, 0, 0.525], - 8216: [0, 0.61111, 0, 0, 0.525], - 8217: [0, 0.61111, 0, 0, 0.525], - 8242: [0, 0.61111, 0, 0, 0.525], - 9251: [0.11111, 0.21944, 0, 0, 0.525], - }, - }; - var sigmasAndXis = { - slant: [0.25, 0.25, 0.25], - space: [0, 0, 0], - stretch: [0, 0, 0], - shrink: [0, 0, 0], - xHeight: [0.431, 0.431, 0.431], - quad: [1, 1.171, 1.472], - extraSpace: [0, 0, 0], - num1: [0.677, 0.732, 0.925], - num2: [0.394, 0.384, 0.387], - 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: [0.25, 0.25, 0.25], - 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], - ptPerEm: [10, 10, 10], - doubleRuleSep: [0.2, 0.2, 0.2], - arrayRuleWidth: [0.04, 0.04, 0.04], - fboxsep: [0.3, 0.3, 0.3], - fboxrule: [0.04, 0.04, 0.04], - }; - var extraCharacterMap = { - "\xC5": "A", - "\xD0": "D", - "\xDE": "o", - "\xE5": "a", - "\xF0": "d", - "\xFE": "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 getCharacterMetrics(character, font, mode) { - if (!fontMetricsData[font]) { - throw new Error("Font metrics not found for font: " + font + "."); - } - var ch = character.charCodeAt(0); - var metrics = fontMetricsData[font][ch]; - if (!metrics && character[0] in extraCharacterMap) { - ch = extraCharacterMap[character[0]].charCodeAt(0); - metrics = fontMetricsData[font][ch]; - } - if (!metrics && mode === "text") { - if (supportedCodepoint(ch)) { - metrics = fontMetricsData[font][77]; - } - } - if (metrics) { - return { - depth: metrics[0], - height: metrics[1], - italic: metrics[2], - skew: metrics[3], - width: metrics[4], - }; - } - } - var fontMetricsBySizeIndex = {}; - function getGlobalMetrics(size) { - var sizeIndex; - if (size >= 5) { - sizeIndex = 0; - } else if (size >= 3) { - sizeIndex = 1; - } else { - sizeIndex = 2; - } - if (!fontMetricsBySizeIndex[sizeIndex]) { - var metrics = (fontMetricsBySizeIndex[sizeIndex] = { - cssEmPerMu: sigmasAndXis.quad[sizeIndex] / 18, - }); - for (var key in sigmasAndXis) { - if (sigmasAndXis.hasOwnProperty(key)) { - metrics[key] = sigmasAndXis[key][sizeIndex]; - } - } - } - return fontMetricsBySizeIndex[sizeIndex]; - } - var sizeStyleMap = [ - [1, 1, 1], - [2, 1, 1], - [3, 1, 1], - [4, 2, 1], - [5, 2, 1], - [6, 3, 1], - [7, 4, 2], - [8, 6, 3], - [9, 7, 6], - [10, 8, 7], - [11, 10, 9], - ]; - var sizeMultipliers = [ - 0.5, 0.6, 0.7, 0.8, 0.9, 1, 1.2, 1.44, 1.728, 2.074, 2.488, - ]; - var sizeAtStyle = function sizeAtStyle(size, style) { - return style.size < 2 ? size : sizeStyleMap[size - 1][style.size - 1]; - }; - var Options = (function () { - function Options(data) { - _classCallCheck(this, Options); - this.style = void 0; - this.color = void 0; - this.size = void 0; - this.textSize = void 0; - this.phantom = void 0; - this.font = void 0; - this.fontFamily = void 0; - this.fontWeight = void 0; - this.fontShape = void 0; - this.sizeMultiplier = void 0; - this.maxSize = void 0; - this.minRuleThickness = void 0; - this._fontMetrics = void 0; - this.style = data.style; - this.color = data.color; - this.size = data.size || Options.BASESIZE; - this.textSize = data.textSize || this.size; - this.phantom = !!data.phantom; - this.font = data.font || ""; - this.fontFamily = data.fontFamily || ""; - this.fontWeight = data.fontWeight || ""; - this.fontShape = data.fontShape || ""; - this.sizeMultiplier = sizeMultipliers[this.size - 1]; - this.maxSize = data.maxSize; - this.minRuleThickness = data.minRuleThickness; - this._fontMetrics = undefined; - } - return _createClass(Options, [ - { - key: "extend", - value: function extend(extension) { - var data = { - style: this.style, - size: this.size, - textSize: this.textSize, - color: this.color, - phantom: this.phantom, - font: this.font, - fontFamily: this.fontFamily, - fontWeight: this.fontWeight, - fontShape: this.fontShape, - maxSize: this.maxSize, - minRuleThickness: this.minRuleThickness, - }; - for (var key in extension) { - if (extension.hasOwnProperty(key)) { - data[key] = extension[key]; - } - } - return new Options(data); - }, - }, - { - key: "havingStyle", - value: function havingStyle(style) { - if (this.style === style) { - return this; - } else { - return this.extend({ - style: style, - size: sizeAtStyle(this.textSize, style), - }); - } - }, - }, - { - key: "havingCrampedStyle", - value: function havingCrampedStyle() { - return this.havingStyle(this.style.cramp()); - }, - }, - { - key: "havingSize", - value: function havingSize(size) { - if (this.size === size && this.textSize === size) { - return this; - } else { - return this.extend({ - style: this.style.text(), - size: size, - textSize: size, - sizeMultiplier: sizeMultipliers[size - 1], - }); - } - }, - }, - { - key: "havingBaseStyle", - value: function havingBaseStyle(style) { - style = style || this.style.text(); - var wantSize = sizeAtStyle(Options.BASESIZE, style); - if ( - this.size === wantSize && - this.textSize === Options.BASESIZE && - this.style === style - ) { - return this; - } else { - return this.extend({ style: style, size: wantSize }); - } - }, - }, - { - key: "havingBaseSizing", - value: function havingBaseSizing() { - var size; - switch (this.style.id) { - case 4: - case 5: - size = 3; - break; - case 6: - case 7: - size = 1; - break; - default: - size = 6; - } - return this.extend({ style: this.style.text(), size: size }); - }, - }, - { - key: "withColor", - value: function withColor(color) { - return this.extend({ color: color }); - }, - }, - { - key: "withPhantom", - value: function withPhantom() { - return this.extend({ phantom: true }); - }, - }, - { - key: "withFont", - value: function withFont(font) { - return this.extend({ font: font }); - }, - }, - { - key: "withTextFontFamily", - value: function withTextFontFamily(fontFamily) { - return this.extend({ fontFamily: fontFamily, font: "" }); - }, - }, - { - key: "withTextFontWeight", - value: function withTextFontWeight(fontWeight) { - return this.extend({ fontWeight: fontWeight, font: "" }); - }, - }, - { - key: "withTextFontShape", - value: function withTextFontShape(fontShape) { - return this.extend({ fontShape: fontShape, font: "" }); - }, - }, - { - key: "sizingClasses", - value: function sizingClasses(oldOptions) { - if (oldOptions.size !== this.size) { - return [ - "sizing", - "reset-size" + oldOptions.size, - "size" + this.size, - ]; - } else { - return []; - } - }, - }, - { - key: "baseSizingClasses", - value: function baseSizingClasses() { - if (this.size !== Options.BASESIZE) { - return [ - "sizing", - "reset-size" + this.size, - "size" + Options.BASESIZE, - ]; - } else { - return []; - } - }, - }, - { - key: "fontMetrics", - value: function fontMetrics() { - if (!this._fontMetrics) { - this._fontMetrics = getGlobalMetrics(this.size); - } - return this._fontMetrics; - }, - }, - { - key: "getColor", - value: function getColor() { - if (this.phantom) { - return "transparent"; - } else { - return this.color; - } - }, - }, - ]); - })(); - Options.BASESIZE = 6; - var ptPerUnit = { - pt: 1, - mm: 7227 / 2540, - cm: 7227 / 254, - in: 72.27, - bp: 803 / 800, - pc: 12, - dd: 1238 / 1157, - cc: 14856 / 1157, - nd: 685 / 642, - nc: 1370 / 107, - sp: 1 / 65536, - px: 803 / 800, - }; - var relativeUnit = { ex: true, em: true, mu: true }; - var validUnit = function validUnit(unit) { - if (typeof unit !== "string") { - unit = unit.unit; - } - return unit in ptPerUnit || unit in relativeUnit || unit === "ex"; - }; - var calculateSize = function calculateSize(sizeValue, options) { - var scale; - if (sizeValue.unit in ptPerUnit) { - scale = - ptPerUnit[sizeValue.unit] / - options.fontMetrics().ptPerEm / - options.sizeMultiplier; - } else if (sizeValue.unit === "mu") { - scale = options.fontMetrics().cssEmPerMu; - } else { - var unitOptions; - if (options.style.isTight()) { - unitOptions = options.havingStyle(options.style.text()); - } else { - unitOptions = options; - } - if (sizeValue.unit === "ex") { - scale = unitOptions.fontMetrics().xHeight; - } else if (sizeValue.unit === "em") { - scale = unitOptions.fontMetrics().quad; - } else { - throw new ParseError("Invalid unit: '" + sizeValue.unit + "'"); - } - if (unitOptions !== options) { - scale *= unitOptions.sizeMultiplier / options.sizeMultiplier; - } - } - return Math.min(sizeValue.number * scale, options.maxSize); - }; - var makeEm = function makeEm(n) { - return +n.toFixed(4) + "em"; - }; - var createClass = function createClass(classes) { - return classes - .filter(function (cls) { - return cls; - }) - .join(" "); - }; - var initNode = function initNode(classes, options, style) { - this.classes = classes || []; - this.attributes = {}; - this.height = 0; - this.depth = 0; - this.maxFontSize = 0; - this.style = style || {}; - if (options) { - if (options.style.isTight()) { - this.classes.push("mtight"); - } - var color = options.getColor(); - if (color) { - this.style.color = color; - } - } - }; - var _toNode = function toNode(tagName) { - var node = document.createElement(tagName); - node.className = createClass(this.classes); - for (var style in this.style) { - if (this.style.hasOwnProperty(style)) { - node.style[style] = this.style[style]; - } - } - for (var attr in this.attributes) { - if (this.attributes.hasOwnProperty(attr)) { - node.setAttribute(attr, this.attributes[attr]); - } - } - for (var i = 0; i < this.children.length; i++) { - node.appendChild(this.children[i].toNode()); - } - return node; - }; - var invalidAttributeNameRegex = /[\s"'>/=\x00-\x1f]/; - var _toMarkup = function toMarkup(tagName) { - var markup = "<" + tagName; - if (this.classes.length) { - markup += ' class="' + utils.escape(createClass(this.classes)) + '"'; - } - var styles = ""; - for (var style in this.style) { - if (this.style.hasOwnProperty(style)) { - styles += utils.hyphenate(style) + ":" + this.style[style] + ";"; - } - } - if (styles) { - markup += ' style="' + utils.escape(styles) + '"'; - } - for (var attr in this.attributes) { - if (this.attributes.hasOwnProperty(attr)) { - if (invalidAttributeNameRegex.test(attr)) { - throw new ParseError("Invalid attribute name '" + attr + "'"); - } - markup += " " + attr + '="' + utils.escape(this.attributes[attr]) + '"'; - } - } - markup += ">"; - for (var i = 0; i < this.children.length; i++) { - markup += this.children[i].toMarkup(); - } - markup += ""; - return markup; - }; - var Span = (function () { - function Span(classes, children, options, style) { - _classCallCheck(this, Span); - this.children = void 0; - this.attributes = void 0; - this.classes = void 0; - this.height = void 0; - this.depth = void 0; - this.width = void 0; - this.maxFontSize = void 0; - this.style = void 0; - initNode.call(this, classes, options, style); - this.children = children || []; - } - return _createClass(Span, [ - { - key: "setAttribute", - value: function setAttribute(attribute, value) { - this.attributes[attribute] = value; - }, - }, - { - key: "hasClass", - value: function hasClass(className) { - return utils.contains(this.classes, className); - }, - }, - { - key: "toNode", - value: function toNode() { - return _toNode.call(this, "span"); - }, - }, - { - key: "toMarkup", - value: function toMarkup() { - return _toMarkup.call(this, "span"); - }, - }, - ]); - })(); - var Anchor = (function () { - function Anchor(href, classes, children, options) { - _classCallCheck(this, Anchor); - this.children = void 0; - this.attributes = void 0; - this.classes = void 0; - this.height = void 0; - this.depth = void 0; - this.maxFontSize = void 0; - this.style = void 0; - initNode.call(this, classes, options); - this.children = children || []; - this.setAttribute("href", href); - } - return _createClass(Anchor, [ - { - key: "setAttribute", - value: function setAttribute(attribute, value) { - this.attributes[attribute] = value; - }, - }, - { - key: "hasClass", - value: function hasClass(className) { - return utils.contains(this.classes, className); - }, - }, - { - key: "toNode", - value: function toNode() { - return _toNode.call(this, "a"); - }, - }, - { - key: "toMarkup", - value: function toMarkup() { - return _toMarkup.call(this, "a"); - }, - }, - ]); - })(); - var Img = (function () { - function Img(src, alt, style) { - _classCallCheck(this, Img); - this.src = void 0; - this.alt = void 0; - this.classes = void 0; - this.height = void 0; - this.depth = void 0; - this.maxFontSize = void 0; - this.style = void 0; - this.alt = alt; - this.src = src; - this.classes = ["mord"]; - this.style = style; - } - return _createClass(Img, [ - { - key: "hasClass", - value: function hasClass(className) { - return utils.contains(this.classes, className); - }, - }, - { - key: "toNode", - value: function toNode() { - var node = document.createElement("img"); - node.src = this.src; - node.alt = this.alt; - node.className = "mord"; - for (var style in this.style) { - if (this.style.hasOwnProperty(style)) { - node.style[style] = this.style[style]; - } - } - return node; - }, - }, - { - key: "toMarkup", - value: function toMarkup() { - var markup = - '' + utils.escape(this.alt) + ' 0) { - span = document.createElement("span"); - span.style.marginRight = makeEm(this.italic); - } - if (this.classes.length > 0) { - span = span || document.createElement("span"); - span.className = createClass(this.classes); - } - for (var style in this.style) { - if (this.style.hasOwnProperty(style)) { - span = span || document.createElement("span"); - span.style[style] = this.style[style]; - } - } - if (span) { - span.appendChild(node); - return span; - } else { - return node; - } - }, - }, - { - key: "toMarkup", - value: function toMarkup() { - var needsSpan = false; - var markup = " 0) { - styles += "margin-right:" + this.italic + "em;"; - } - for (var style in this.style) { - if (this.style.hasOwnProperty(style)) { - styles += utils.hyphenate(style) + ":" + this.style[style] + ";"; - } - } - if (styles) { - needsSpan = true; - markup += ' style="' + utils.escape(styles) + '"'; - } - var escaped = utils.escape(this.text); - if (needsSpan) { - markup += ">"; - markup += escaped; - markup += ""; - return markup; - } else { - return escaped; - } - }, - }, - ]); - })(); - var SvgNode = (function () { - function SvgNode(children, attributes) { - _classCallCheck(this, SvgNode); - this.children = void 0; - this.attributes = void 0; - this.children = children || []; - this.attributes = attributes || {}; - } - return _createClass(SvgNode, [ - { - key: "toNode", - value: function toNode() { - var svgNS = "http://www.w3.org/2000/svg"; - var node = document.createElementNS(svgNS, "svg"); - for (var attr in this.attributes) { - if (Object.prototype.hasOwnProperty.call(this.attributes, attr)) { - node.setAttribute(attr, this.attributes[attr]); - } - } - for (var i = 0; i < this.children.length; i++) { - node.appendChild(this.children[i].toNode()); - } - return node; - }, - }, - { - key: "toMarkup", - value: function toMarkup() { - var markup = ''; - } else { - return ''; - } - }, - }, - ]); - })(); - var LineNode = (function () { - function LineNode(attributes) { - _classCallCheck(this, LineNode); - this.attributes = void 0; - this.attributes = attributes || {}; - } - return _createClass(LineNode, [ - { - key: "toNode", - value: function toNode() { - var svgNS = "http://www.w3.org/2000/svg"; - var node = document.createElementNS(svgNS, "line"); - for (var attr in this.attributes) { - if (Object.prototype.hasOwnProperty.call(this.attributes, attr)) { - node.setAttribute(attr, this.attributes[attr]); - } - } - return node; - }, - }, - { - key: "toMarkup", - value: function toMarkup() { - var markup = " but got " + String(group) + ".", - ); - } - } - var ATOMS = { bin: 1, close: 1, inner: 1, open: 1, punct: 1, rel: 1 }; - var NON_ATOMS = { - "accent-token": 1, - mathord: 1, - "op-token": 1, - spacing: 1, - textord: 1, - }; - var symbols = { math: {}, text: {} }; - function defineSymbol(mode, font, group, replace, name, acceptUnicodeChar) { - symbols[mode][name] = { font: font, group: group, replace: replace }; - if (acceptUnicodeChar && replace) { - symbols[mode][replace] = symbols[mode][name]; - } - } - var math = "math"; - var text = "text"; - var main = "main"; - var ams = "ams"; - var accent = "accent-token"; - var bin = "bin"; - var close = "close"; - var inner = "inner"; - var mathord = "mathord"; - var op = "op-token"; - var open = "open"; - var punct = "punct"; - var rel = "rel"; - var spacing = "spacing"; - var textord = "textord"; - defineSymbol(math, main, rel, "\u2261", "\\equiv", true); - defineSymbol(math, main, rel, "\u227A", "\\prec", true); - defineSymbol(math, main, rel, "\u227B", "\\succ", true); - defineSymbol(math, main, rel, "\u223C", "\\sim", true); - defineSymbol(math, main, rel, "\u22A5", "\\perp"); - defineSymbol(math, main, rel, "\u2AAF", "\\preceq", true); - defineSymbol(math, main, rel, "\u2AB0", "\\succeq", true); - defineSymbol(math, main, rel, "\u2243", "\\simeq", true); - defineSymbol(math, main, rel, "\u2223", "\\mid", true); - defineSymbol(math, main, rel, "\u226A", "\\ll", true); - defineSymbol(math, main, rel, "\u226B", "\\gg", true); - defineSymbol(math, main, rel, "\u224D", "\\asymp", true); - defineSymbol(math, main, rel, "\u2225", "\\parallel"); - defineSymbol(math, main, rel, "\u22C8", "\\bowtie", true); - defineSymbol(math, main, rel, "\u2323", "\\smile", true); - defineSymbol(math, main, rel, "\u2291", "\\sqsubseteq", true); - defineSymbol(math, main, rel, "\u2292", "\\sqsupseteq", true); - defineSymbol(math, main, rel, "\u2250", "\\doteq", true); - defineSymbol(math, main, rel, "\u2322", "\\frown", true); - defineSymbol(math, main, rel, "\u220B", "\\ni", true); - defineSymbol(math, main, rel, "\u221D", "\\propto", true); - defineSymbol(math, main, rel, "\u22A2", "\\vdash", true); - defineSymbol(math, main, rel, "\u22A3", "\\dashv", true); - defineSymbol(math, main, rel, "\u220B", "\\owns"); - defineSymbol(math, main, punct, ".", "\\ldotp"); - defineSymbol(math, main, punct, "\u22C5", "\\cdotp"); - defineSymbol(math, main, textord, "#", "\\#"); - defineSymbol(text, main, textord, "#", "\\#"); - defineSymbol(math, main, textord, "&", "\\&"); - defineSymbol(text, main, textord, "&", "\\&"); - defineSymbol(math, main, textord, "\u2135", "\\aleph", true); - defineSymbol(math, main, textord, "\u2200", "\\forall", true); - defineSymbol(math, main, textord, "\u210F", "\\hbar", true); - defineSymbol(math, main, textord, "\u2203", "\\exists", true); - defineSymbol(math, main, textord, "\u2207", "\\nabla", true); - defineSymbol(math, main, textord, "\u266D", "\\flat", true); - defineSymbol(math, main, textord, "\u2113", "\\ell", true); - defineSymbol(math, main, textord, "\u266E", "\\natural", true); - defineSymbol(math, main, textord, "\u2663", "\\clubsuit", true); - defineSymbol(math, main, textord, "\u2118", "\\wp", true); - defineSymbol(math, main, textord, "\u266F", "\\sharp", true); - defineSymbol(math, main, textord, "\u2662", "\\diamondsuit", true); - defineSymbol(math, main, textord, "\u211C", "\\Re", true); - defineSymbol(math, main, textord, "\u2661", "\\heartsuit", true); - defineSymbol(math, main, textord, "\u2111", "\\Im", true); - defineSymbol(math, main, textord, "\u2660", "\\spadesuit", true); - defineSymbol(math, main, textord, "\xA7", "\\S", true); - defineSymbol(text, main, textord, "\xA7", "\\S"); - defineSymbol(math, main, textord, "\xB6", "\\P", true); - defineSymbol(text, main, textord, "\xB6", "\\P"); - defineSymbol(math, main, textord, "\u2020", "\\dag"); - defineSymbol(text, main, textord, "\u2020", "\\dag"); - defineSymbol(text, main, textord, "\u2020", "\\textdagger"); - defineSymbol(math, main, textord, "\u2021", "\\ddag"); - defineSymbol(text, main, textord, "\u2021", "\\ddag"); - defineSymbol(text, main, textord, "\u2021", "\\textdaggerdbl"); - defineSymbol(math, main, close, "\u23B1", "\\rmoustache", true); - defineSymbol(math, main, open, "\u23B0", "\\lmoustache", true); - defineSymbol(math, main, close, "\u27EF", "\\rgroup", true); - defineSymbol(math, main, open, "\u27EE", "\\lgroup", true); - defineSymbol(math, main, bin, "\u2213", "\\mp", true); - defineSymbol(math, main, bin, "\u2296", "\\ominus", true); - defineSymbol(math, main, bin, "\u228E", "\\uplus", true); - defineSymbol(math, main, bin, "\u2293", "\\sqcap", true); - defineSymbol(math, main, bin, "\u2217", "\\ast"); - defineSymbol(math, main, bin, "\u2294", "\\sqcup", true); - defineSymbol(math, main, bin, "\u25EF", "\\bigcirc", true); - defineSymbol(math, main, bin, "\u2219", "\\bullet", true); - defineSymbol(math, main, bin, "\u2021", "\\ddagger"); - defineSymbol(math, main, bin, "\u2240", "\\wr", true); - defineSymbol(math, main, bin, "\u2A3F", "\\amalg"); - defineSymbol(math, main, bin, "&", "\\And"); - defineSymbol(math, main, rel, "\u27F5", "\\longleftarrow", true); - defineSymbol(math, main, rel, "\u21D0", "\\Leftarrow", true); - defineSymbol(math, main, rel, "\u27F8", "\\Longleftarrow", true); - defineSymbol(math, main, rel, "\u27F6", "\\longrightarrow", true); - defineSymbol(math, main, rel, "\u21D2", "\\Rightarrow", true); - defineSymbol(math, main, rel, "\u27F9", "\\Longrightarrow", true); - defineSymbol(math, main, rel, "\u2194", "\\leftrightarrow", true); - defineSymbol(math, main, rel, "\u27F7", "\\longleftrightarrow", true); - defineSymbol(math, main, rel, "\u21D4", "\\Leftrightarrow", true); - defineSymbol(math, main, rel, "\u27FA", "\\Longleftrightarrow", true); - defineSymbol(math, main, rel, "\u21A6", "\\mapsto", true); - defineSymbol(math, main, rel, "\u27FC", "\\longmapsto", true); - defineSymbol(math, main, rel, "\u2197", "\\nearrow", true); - defineSymbol(math, main, rel, "\u21A9", "\\hookleftarrow", true); - defineSymbol(math, main, rel, "\u21AA", "\\hookrightarrow", true); - defineSymbol(math, main, rel, "\u2198", "\\searrow", true); - defineSymbol(math, main, rel, "\u21BC", "\\leftharpoonup", true); - defineSymbol(math, main, rel, "\u21C0", "\\rightharpoonup", true); - defineSymbol(math, main, rel, "\u2199", "\\swarrow", true); - defineSymbol(math, main, rel, "\u21BD", "\\leftharpoondown", true); - defineSymbol(math, main, rel, "\u21C1", "\\rightharpoondown", true); - defineSymbol(math, main, rel, "\u2196", "\\nwarrow", true); - defineSymbol(math, main, rel, "\u21CC", "\\rightleftharpoons", true); - defineSymbol(math, ams, rel, "\u226E", "\\nless", true); - defineSymbol(math, ams, rel, "\uE010", "\\@nleqslant"); - defineSymbol(math, ams, rel, "\uE011", "\\@nleqq"); - defineSymbol(math, ams, rel, "\u2A87", "\\lneq", true); - defineSymbol(math, ams, rel, "\u2268", "\\lneqq", true); - defineSymbol(math, ams, rel, "\uE00C", "\\@lvertneqq"); - defineSymbol(math, ams, rel, "\u22E6", "\\lnsim", true); - defineSymbol(math, ams, rel, "\u2A89", "\\lnapprox", true); - defineSymbol(math, ams, rel, "\u2280", "\\nprec", true); - defineSymbol(math, ams, rel, "\u22E0", "\\npreceq", true); - defineSymbol(math, ams, rel, "\u22E8", "\\precnsim", true); - defineSymbol(math, ams, rel, "\u2AB9", "\\precnapprox", true); - defineSymbol(math, ams, rel, "\u2241", "\\nsim", true); - defineSymbol(math, ams, rel, "\uE006", "\\@nshortmid"); - defineSymbol(math, ams, rel, "\u2224", "\\nmid", true); - defineSymbol(math, ams, rel, "\u22AC", "\\nvdash", true); - defineSymbol(math, ams, rel, "\u22AD", "\\nvDash", true); - defineSymbol(math, ams, rel, "\u22EA", "\\ntriangleleft"); - defineSymbol(math, ams, rel, "\u22EC", "\\ntrianglelefteq", true); - defineSymbol(math, ams, rel, "\u228A", "\\subsetneq", true); - defineSymbol(math, ams, rel, "\uE01A", "\\@varsubsetneq"); - defineSymbol(math, ams, rel, "\u2ACB", "\\subsetneqq", true); - defineSymbol(math, ams, rel, "\uE017", "\\@varsubsetneqq"); - defineSymbol(math, ams, rel, "\u226F", "\\ngtr", true); - defineSymbol(math, ams, rel, "\uE00F", "\\@ngeqslant"); - defineSymbol(math, ams, rel, "\uE00E", "\\@ngeqq"); - defineSymbol(math, ams, rel, "\u2A88", "\\gneq", true); - defineSymbol(math, ams, rel, "\u2269", "\\gneqq", true); - defineSymbol(math, ams, rel, "\uE00D", "\\@gvertneqq"); - defineSymbol(math, ams, rel, "\u22E7", "\\gnsim", true); - defineSymbol(math, ams, rel, "\u2A8A", "\\gnapprox", true); - defineSymbol(math, ams, rel, "\u2281", "\\nsucc", true); - defineSymbol(math, ams, rel, "\u22E1", "\\nsucceq", true); - defineSymbol(math, ams, rel, "\u22E9", "\\succnsim", true); - defineSymbol(math, ams, rel, "\u2ABA", "\\succnapprox", true); - defineSymbol(math, ams, rel, "\u2246", "\\ncong", true); - defineSymbol(math, ams, rel, "\uE007", "\\@nshortparallel"); - defineSymbol(math, ams, rel, "\u2226", "\\nparallel", true); - defineSymbol(math, ams, rel, "\u22AF", "\\nVDash", true); - defineSymbol(math, ams, rel, "\u22EB", "\\ntriangleright"); - defineSymbol(math, ams, rel, "\u22ED", "\\ntrianglerighteq", true); - defineSymbol(math, ams, rel, "\uE018", "\\@nsupseteqq"); - defineSymbol(math, ams, rel, "\u228B", "\\supsetneq", true); - defineSymbol(math, ams, rel, "\uE01B", "\\@varsupsetneq"); - defineSymbol(math, ams, rel, "\u2ACC", "\\supsetneqq", true); - defineSymbol(math, ams, rel, "\uE019", "\\@varsupsetneqq"); - defineSymbol(math, ams, rel, "\u22AE", "\\nVdash", true); - defineSymbol(math, ams, rel, "\u2AB5", "\\precneqq", true); - defineSymbol(math, ams, rel, "\u2AB6", "\\succneqq", true); - defineSymbol(math, ams, rel, "\uE016", "\\@nsubseteqq"); - defineSymbol(math, ams, bin, "\u22B4", "\\unlhd"); - defineSymbol(math, ams, bin, "\u22B5", "\\unrhd"); - defineSymbol(math, ams, rel, "\u219A", "\\nleftarrow", true); - defineSymbol(math, ams, rel, "\u219B", "\\nrightarrow", true); - defineSymbol(math, ams, rel, "\u21CD", "\\nLeftarrow", true); - defineSymbol(math, ams, rel, "\u21CF", "\\nRightarrow", true); - defineSymbol(math, ams, rel, "\u21AE", "\\nleftrightarrow", true); - defineSymbol(math, ams, rel, "\u21CE", "\\nLeftrightarrow", true); - defineSymbol(math, ams, rel, "\u25B3", "\\vartriangle"); - defineSymbol(math, ams, textord, "\u210F", "\\hslash"); - defineSymbol(math, ams, textord, "\u25BD", "\\triangledown"); - defineSymbol(math, ams, textord, "\u25CA", "\\lozenge"); - defineSymbol(math, ams, textord, "\u24C8", "\\circledS"); - defineSymbol(math, ams, textord, "\xAE", "\\circledR"); - defineSymbol(text, ams, textord, "\xAE", "\\circledR"); - defineSymbol(math, ams, textord, "\u2221", "\\measuredangle", true); - defineSymbol(math, ams, textord, "\u2204", "\\nexists"); - defineSymbol(math, ams, textord, "\u2127", "\\mho"); - defineSymbol(math, ams, textord, "\u2132", "\\Finv", true); - defineSymbol(math, ams, textord, "\u2141", "\\Game", true); - defineSymbol(math, ams, textord, "\u2035", "\\backprime"); - defineSymbol(math, ams, textord, "\u25B2", "\\blacktriangle"); - defineSymbol(math, ams, textord, "\u25BC", "\\blacktriangledown"); - defineSymbol(math, ams, textord, "\u25A0", "\\blacksquare"); - defineSymbol(math, ams, textord, "\u29EB", "\\blacklozenge"); - defineSymbol(math, ams, textord, "\u2605", "\\bigstar"); - defineSymbol(math, ams, textord, "\u2222", "\\sphericalangle", true); - defineSymbol(math, ams, textord, "\u2201", "\\complement", true); - defineSymbol(math, ams, textord, "\xF0", "\\eth", true); - defineSymbol(text, main, textord, "\xF0", "\xF0"); - defineSymbol(math, ams, textord, "\u2571", "\\diagup"); - defineSymbol(math, ams, textord, "\u2572", "\\diagdown"); - defineSymbol(math, ams, textord, "\u25A1", "\\square"); - defineSymbol(math, ams, textord, "\u25A1", "\\Box"); - defineSymbol(math, ams, textord, "\u25CA", "\\Diamond"); - defineSymbol(math, ams, textord, "\xA5", "\\yen", true); - defineSymbol(text, ams, textord, "\xA5", "\\yen", true); - defineSymbol(math, ams, textord, "\u2713", "\\checkmark", true); - defineSymbol(text, ams, textord, "\u2713", "\\checkmark"); - defineSymbol(math, ams, textord, "\u2136", "\\beth", true); - defineSymbol(math, ams, textord, "\u2138", "\\daleth", true); - defineSymbol(math, ams, textord, "\u2137", "\\gimel", true); - defineSymbol(math, ams, textord, "\u03DD", "\\digamma", true); - defineSymbol(math, ams, textord, "\u03F0", "\\varkappa"); - defineSymbol(math, ams, open, "\u250C", "\\@ulcorner", true); - defineSymbol(math, ams, close, "\u2510", "\\@urcorner", true); - defineSymbol(math, ams, open, "\u2514", "\\@llcorner", true); - defineSymbol(math, ams, close, "\u2518", "\\@lrcorner", true); - defineSymbol(math, ams, rel, "\u2266", "\\leqq", true); - defineSymbol(math, ams, rel, "\u2A7D", "\\leqslant", true); - defineSymbol(math, ams, rel, "\u2A95", "\\eqslantless", true); - defineSymbol(math, ams, rel, "\u2272", "\\lesssim", true); - defineSymbol(math, ams, rel, "\u2A85", "\\lessapprox", true); - defineSymbol(math, ams, rel, "\u224A", "\\approxeq", true); - defineSymbol(math, ams, bin, "\u22D6", "\\lessdot"); - defineSymbol(math, ams, rel, "\u22D8", "\\lll", true); - defineSymbol(math, ams, rel, "\u2276", "\\lessgtr", true); - defineSymbol(math, ams, rel, "\u22DA", "\\lesseqgtr", true); - defineSymbol(math, ams, rel, "\u2A8B", "\\lesseqqgtr", true); - defineSymbol(math, ams, rel, "\u2251", "\\doteqdot"); - defineSymbol(math, ams, rel, "\u2253", "\\risingdotseq", true); - defineSymbol(math, ams, rel, "\u2252", "\\fallingdotseq", true); - defineSymbol(math, ams, rel, "\u223D", "\\backsim", true); - defineSymbol(math, ams, rel, "\u22CD", "\\backsimeq", true); - defineSymbol(math, ams, rel, "\u2AC5", "\\subseteqq", true); - defineSymbol(math, ams, rel, "\u22D0", "\\Subset", true); - defineSymbol(math, ams, rel, "\u228F", "\\sqsubset", true); - defineSymbol(math, ams, rel, "\u227C", "\\preccurlyeq", true); - defineSymbol(math, ams, rel, "\u22DE", "\\curlyeqprec", true); - defineSymbol(math, ams, rel, "\u227E", "\\precsim", true); - defineSymbol(math, ams, rel, "\u2AB7", "\\precapprox", true); - defineSymbol(math, ams, rel, "\u22B2", "\\vartriangleleft"); - defineSymbol(math, ams, rel, "\u22B4", "\\trianglelefteq"); - defineSymbol(math, ams, rel, "\u22A8", "\\vDash", true); - defineSymbol(math, ams, rel, "\u22AA", "\\Vvdash", true); - defineSymbol(math, ams, rel, "\u2323", "\\smallsmile"); - defineSymbol(math, ams, rel, "\u2322", "\\smallfrown"); - defineSymbol(math, ams, rel, "\u224F", "\\bumpeq", true); - defineSymbol(math, ams, rel, "\u224E", "\\Bumpeq", true); - defineSymbol(math, ams, rel, "\u2267", "\\geqq", true); - defineSymbol(math, ams, rel, "\u2A7E", "\\geqslant", true); - defineSymbol(math, ams, rel, "\u2A96", "\\eqslantgtr", true); - defineSymbol(math, ams, rel, "\u2273", "\\gtrsim", true); - defineSymbol(math, ams, rel, "\u2A86", "\\gtrapprox", true); - defineSymbol(math, ams, bin, "\u22D7", "\\gtrdot"); - defineSymbol(math, ams, rel, "\u22D9", "\\ggg", true); - defineSymbol(math, ams, rel, "\u2277", "\\gtrless", true); - defineSymbol(math, ams, rel, "\u22DB", "\\gtreqless", true); - defineSymbol(math, ams, rel, "\u2A8C", "\\gtreqqless", true); - defineSymbol(math, ams, rel, "\u2256", "\\eqcirc", true); - defineSymbol(math, ams, rel, "\u2257", "\\circeq", true); - defineSymbol(math, ams, rel, "\u225C", "\\triangleq", true); - defineSymbol(math, ams, rel, "\u223C", "\\thicksim"); - defineSymbol(math, ams, rel, "\u2248", "\\thickapprox"); - defineSymbol(math, ams, rel, "\u2AC6", "\\supseteqq", true); - defineSymbol(math, ams, rel, "\u22D1", "\\Supset", true); - defineSymbol(math, ams, rel, "\u2290", "\\sqsupset", true); - defineSymbol(math, ams, rel, "\u227D", "\\succcurlyeq", true); - defineSymbol(math, ams, rel, "\u22DF", "\\curlyeqsucc", true); - defineSymbol(math, ams, rel, "\u227F", "\\succsim", true); - defineSymbol(math, ams, rel, "\u2AB8", "\\succapprox", true); - defineSymbol(math, ams, rel, "\u22B3", "\\vartriangleright"); - defineSymbol(math, ams, rel, "\u22B5", "\\trianglerighteq"); - defineSymbol(math, ams, rel, "\u22A9", "\\Vdash", true); - defineSymbol(math, ams, rel, "\u2223", "\\shortmid"); - defineSymbol(math, ams, rel, "\u2225", "\\shortparallel"); - defineSymbol(math, ams, rel, "\u226C", "\\between", true); - defineSymbol(math, ams, rel, "\u22D4", "\\pitchfork", true); - defineSymbol(math, ams, rel, "\u221D", "\\varpropto"); - defineSymbol(math, ams, rel, "\u25C0", "\\blacktriangleleft"); - defineSymbol(math, ams, rel, "\u2234", "\\therefore", true); - defineSymbol(math, ams, rel, "\u220D", "\\backepsilon"); - defineSymbol(math, ams, rel, "\u25B6", "\\blacktriangleright"); - defineSymbol(math, ams, rel, "\u2235", "\\because", true); - defineSymbol(math, ams, rel, "\u22D8", "\\llless"); - defineSymbol(math, ams, rel, "\u22D9", "\\gggtr"); - defineSymbol(math, ams, bin, "\u22B2", "\\lhd"); - defineSymbol(math, ams, bin, "\u22B3", "\\rhd"); - defineSymbol(math, ams, rel, "\u2242", "\\eqsim", true); - defineSymbol(math, main, rel, "\u22C8", "\\Join"); - defineSymbol(math, ams, rel, "\u2251", "\\Doteq", true); - defineSymbol(math, ams, bin, "\u2214", "\\dotplus", true); - defineSymbol(math, ams, bin, "\u2216", "\\smallsetminus"); - defineSymbol(math, ams, bin, "\u22D2", "\\Cap", true); - defineSymbol(math, ams, bin, "\u22D3", "\\Cup", true); - defineSymbol(math, ams, bin, "\u2A5E", "\\doublebarwedge", true); - defineSymbol(math, ams, bin, "\u229F", "\\boxminus", true); - defineSymbol(math, ams, bin, "\u229E", "\\boxplus", true); - defineSymbol(math, ams, bin, "\u22C7", "\\divideontimes", true); - defineSymbol(math, ams, bin, "\u22C9", "\\ltimes", true); - defineSymbol(math, ams, bin, "\u22CA", "\\rtimes", true); - defineSymbol(math, ams, bin, "\u22CB", "\\leftthreetimes", true); - defineSymbol(math, ams, bin, "\u22CC", "\\rightthreetimes", true); - defineSymbol(math, ams, bin, "\u22CF", "\\curlywedge", true); - defineSymbol(math, ams, bin, "\u22CE", "\\curlyvee", true); - defineSymbol(math, ams, bin, "\u229D", "\\circleddash", true); - defineSymbol(math, ams, bin, "\u229B", "\\circledast", true); - defineSymbol(math, ams, bin, "\u22C5", "\\centerdot"); - defineSymbol(math, ams, bin, "\u22BA", "\\intercal", true); - defineSymbol(math, ams, bin, "\u22D2", "\\doublecap"); - defineSymbol(math, ams, bin, "\u22D3", "\\doublecup"); - defineSymbol(math, ams, bin, "\u22A0", "\\boxtimes", true); - defineSymbol(math, ams, rel, "\u21E2", "\\dashrightarrow", true); - defineSymbol(math, ams, rel, "\u21E0", "\\dashleftarrow", true); - defineSymbol(math, ams, rel, "\u21C7", "\\leftleftarrows", true); - defineSymbol(math, ams, rel, "\u21C6", "\\leftrightarrows", true); - defineSymbol(math, ams, rel, "\u21DA", "\\Lleftarrow", true); - defineSymbol(math, ams, rel, "\u219E", "\\twoheadleftarrow", true); - defineSymbol(math, ams, rel, "\u21A2", "\\leftarrowtail", true); - defineSymbol(math, ams, rel, "\u21AB", "\\looparrowleft", true); - defineSymbol(math, ams, rel, "\u21CB", "\\leftrightharpoons", true); - defineSymbol(math, ams, rel, "\u21B6", "\\curvearrowleft", true); - defineSymbol(math, ams, rel, "\u21BA", "\\circlearrowleft", true); - defineSymbol(math, ams, rel, "\u21B0", "\\Lsh", true); - defineSymbol(math, ams, rel, "\u21C8", "\\upuparrows", true); - defineSymbol(math, ams, rel, "\u21BF", "\\upharpoonleft", true); - defineSymbol(math, ams, rel, "\u21C3", "\\downharpoonleft", true); - defineSymbol(math, main, rel, "\u22B6", "\\origof", true); - defineSymbol(math, main, rel, "\u22B7", "\\imageof", true); - defineSymbol(math, ams, rel, "\u22B8", "\\multimap", true); - defineSymbol(math, ams, rel, "\u21AD", "\\leftrightsquigarrow", true); - defineSymbol(math, ams, rel, "\u21C9", "\\rightrightarrows", true); - defineSymbol(math, ams, rel, "\u21C4", "\\rightleftarrows", true); - defineSymbol(math, ams, rel, "\u21A0", "\\twoheadrightarrow", true); - defineSymbol(math, ams, rel, "\u21A3", "\\rightarrowtail", true); - defineSymbol(math, ams, rel, "\u21AC", "\\looparrowright", true); - defineSymbol(math, ams, rel, "\u21B7", "\\curvearrowright", true); - defineSymbol(math, ams, rel, "\u21BB", "\\circlearrowright", true); - defineSymbol(math, ams, rel, "\u21B1", "\\Rsh", true); - defineSymbol(math, ams, rel, "\u21CA", "\\downdownarrows", true); - defineSymbol(math, ams, rel, "\u21BE", "\\upharpoonright", true); - defineSymbol(math, ams, rel, "\u21C2", "\\downharpoonright", true); - defineSymbol(math, ams, rel, "\u21DD", "\\rightsquigarrow", true); - defineSymbol(math, ams, rel, "\u21DD", "\\leadsto"); - defineSymbol(math, ams, rel, "\u21DB", "\\Rrightarrow", true); - defineSymbol(math, ams, rel, "\u21BE", "\\restriction"); - defineSymbol(math, main, textord, "\u2018", "`"); - defineSymbol(math, main, textord, "$", "\\$"); - defineSymbol(text, main, textord, "$", "\\$"); - defineSymbol(text, main, textord, "$", "\\textdollar"); - defineSymbol(math, main, textord, "%", "\\%"); - defineSymbol(text, main, textord, "%", "\\%"); - defineSymbol(math, main, textord, "_", "\\_"); - defineSymbol(text, main, textord, "_", "\\_"); - defineSymbol(text, main, textord, "_", "\\textunderscore"); - defineSymbol(math, main, textord, "\u2220", "\\angle", true); - defineSymbol(math, main, textord, "\u221E", "\\infty", true); - defineSymbol(math, main, textord, "\u2032", "\\prime"); - defineSymbol(math, main, textord, "\u25B3", "\\triangle"); - defineSymbol(math, main, textord, "\u0393", "\\Gamma", true); - defineSymbol(math, main, textord, "\u0394", "\\Delta", true); - defineSymbol(math, main, textord, "\u0398", "\\Theta", true); - defineSymbol(math, main, textord, "\u039B", "\\Lambda", true); - defineSymbol(math, main, textord, "\u039E", "\\Xi", true); - defineSymbol(math, main, textord, "\u03A0", "\\Pi", true); - defineSymbol(math, main, textord, "\u03A3", "\\Sigma", true); - defineSymbol(math, main, textord, "\u03A5", "\\Upsilon", true); - defineSymbol(math, main, textord, "\u03A6", "\\Phi", true); - defineSymbol(math, main, textord, "\u03A8", "\\Psi", true); - defineSymbol(math, main, textord, "\u03A9", "\\Omega", true); - defineSymbol(math, main, textord, "A", "\u0391"); - defineSymbol(math, main, textord, "B", "\u0392"); - defineSymbol(math, main, textord, "E", "\u0395"); - defineSymbol(math, main, textord, "Z", "\u0396"); - defineSymbol(math, main, textord, "H", "\u0397"); - defineSymbol(math, main, textord, "I", "\u0399"); - defineSymbol(math, main, textord, "K", "\u039A"); - defineSymbol(math, main, textord, "M", "\u039C"); - defineSymbol(math, main, textord, "N", "\u039D"); - defineSymbol(math, main, textord, "O", "\u039F"); - defineSymbol(math, main, textord, "P", "\u03A1"); - defineSymbol(math, main, textord, "T", "\u03A4"); - defineSymbol(math, main, textord, "X", "\u03A7"); - defineSymbol(math, main, textord, "\xAC", "\\neg", true); - defineSymbol(math, main, textord, "\xAC", "\\lnot"); - defineSymbol(math, main, textord, "\u22A4", "\\top"); - defineSymbol(math, main, textord, "\u22A5", "\\bot"); - defineSymbol(math, main, textord, "\u2205", "\\emptyset"); - defineSymbol(math, ams, textord, "\u2205", "\\varnothing"); - defineSymbol(math, main, mathord, "\u03B1", "\\alpha", true); - defineSymbol(math, main, mathord, "\u03B2", "\\beta", true); - defineSymbol(math, main, mathord, "\u03B3", "\\gamma", true); - defineSymbol(math, main, mathord, "\u03B4", "\\delta", true); - defineSymbol(math, main, mathord, "\u03F5", "\\epsilon", true); - defineSymbol(math, main, mathord, "\u03B6", "\\zeta", true); - defineSymbol(math, main, mathord, "\u03B7", "\\eta", true); - defineSymbol(math, main, mathord, "\u03B8", "\\theta", true); - defineSymbol(math, main, mathord, "\u03B9", "\\iota", true); - defineSymbol(math, main, mathord, "\u03BA", "\\kappa", true); - defineSymbol(math, main, mathord, "\u03BB", "\\lambda", true); - defineSymbol(math, main, mathord, "\u03BC", "\\mu", true); - defineSymbol(math, main, mathord, "\u03BD", "\\nu", true); - defineSymbol(math, main, mathord, "\u03BE", "\\xi", true); - defineSymbol(math, main, mathord, "\u03BF", "\\omicron", true); - defineSymbol(math, main, mathord, "\u03C0", "\\pi", true); - defineSymbol(math, main, mathord, "\u03C1", "\\rho", true); - defineSymbol(math, main, mathord, "\u03C3", "\\sigma", true); - defineSymbol(math, main, mathord, "\u03C4", "\\tau", true); - defineSymbol(math, main, mathord, "\u03C5", "\\upsilon", true); - defineSymbol(math, main, mathord, "\u03D5", "\\phi", true); - defineSymbol(math, main, mathord, "\u03C7", "\\chi", true); - defineSymbol(math, main, mathord, "\u03C8", "\\psi", true); - defineSymbol(math, main, mathord, "\u03C9", "\\omega", true); - defineSymbol(math, main, mathord, "\u03B5", "\\varepsilon", true); - defineSymbol(math, main, mathord, "\u03D1", "\\vartheta", true); - defineSymbol(math, main, mathord, "\u03D6", "\\varpi", true); - defineSymbol(math, main, mathord, "\u03F1", "\\varrho", true); - defineSymbol(math, main, mathord, "\u03C2", "\\varsigma", true); - defineSymbol(math, main, mathord, "\u03C6", "\\varphi", true); - defineSymbol(math, main, bin, "\u2217", "*", true); - defineSymbol(math, main, bin, "+", "+"); - defineSymbol(math, main, bin, "\u2212", "-", true); - defineSymbol(math, main, bin, "\u22C5", "\\cdot", true); - defineSymbol(math, main, bin, "\u2218", "\\circ", true); - defineSymbol(math, main, bin, "\xF7", "\\div", true); - defineSymbol(math, main, bin, "\xB1", "\\pm", true); - defineSymbol(math, main, bin, "\xD7", "\\times", true); - defineSymbol(math, main, bin, "\u2229", "\\cap", true); - defineSymbol(math, main, bin, "\u222A", "\\cup", true); - defineSymbol(math, main, bin, "\u2216", "\\setminus", true); - defineSymbol(math, main, bin, "\u2227", "\\land"); - defineSymbol(math, main, bin, "\u2228", "\\lor"); - defineSymbol(math, main, bin, "\u2227", "\\wedge", true); - defineSymbol(math, main, bin, "\u2228", "\\vee", true); - defineSymbol(math, main, textord, "\u221A", "\\surd"); - defineSymbol(math, main, open, "\u27E8", "\\langle", true); - defineSymbol(math, main, open, "\u2223", "\\lvert"); - defineSymbol(math, main, open, "\u2225", "\\lVert"); - defineSymbol(math, main, close, "?", "?"); - defineSymbol(math, main, close, "!", "!"); - defineSymbol(math, main, close, "\u27E9", "\\rangle", true); - defineSymbol(math, main, close, "\u2223", "\\rvert"); - defineSymbol(math, main, close, "\u2225", "\\rVert"); - defineSymbol(math, main, rel, "=", "="); - defineSymbol(math, main, rel, ":", ":"); - defineSymbol(math, main, rel, "\u2248", "\\approx", true); - defineSymbol(math, main, rel, "\u2245", "\\cong", true); - defineSymbol(math, main, rel, "\u2265", "\\ge"); - defineSymbol(math, main, rel, "\u2265", "\\geq", true); - defineSymbol(math, main, rel, "\u2190", "\\gets"); - defineSymbol(math, main, rel, ">", "\\gt", true); - defineSymbol(math, main, rel, "\u2208", "\\in", true); - defineSymbol(math, main, rel, "\uE020", "\\@not"); - defineSymbol(math, main, rel, "\u2282", "\\subset", true); - defineSymbol(math, main, rel, "\u2283", "\\supset", true); - defineSymbol(math, main, rel, "\u2286", "\\subseteq", true); - defineSymbol(math, main, rel, "\u2287", "\\supseteq", true); - defineSymbol(math, ams, rel, "\u2288", "\\nsubseteq", true); - defineSymbol(math, ams, rel, "\u2289", "\\nsupseteq", true); - defineSymbol(math, main, rel, "\u22A8", "\\models"); - defineSymbol(math, main, rel, "\u2190", "\\leftarrow", true); - defineSymbol(math, main, rel, "\u2264", "\\le"); - defineSymbol(math, main, rel, "\u2264", "\\leq", true); - defineSymbol(math, main, rel, "<", "\\lt", true); - defineSymbol(math, main, rel, "\u2192", "\\rightarrow", true); - defineSymbol(math, main, rel, "\u2192", "\\to"); - defineSymbol(math, ams, rel, "\u2271", "\\ngeq", true); - defineSymbol(math, ams, rel, "\u2270", "\\nleq", true); - defineSymbol(math, main, spacing, "\xA0", "\\ "); - defineSymbol(math, main, spacing, "\xA0", "\\space"); - defineSymbol(math, main, spacing, "\xA0", "\\nobreakspace"); - defineSymbol(text, main, spacing, "\xA0", "\\ "); - defineSymbol(text, main, spacing, "\xA0", " "); - defineSymbol(text, main, spacing, "\xA0", "\\space"); - defineSymbol(text, main, spacing, "\xA0", "\\nobreakspace"); - defineSymbol(math, main, spacing, null, "\\nobreak"); - defineSymbol(math, main, spacing, null, "\\allowbreak"); - defineSymbol(math, main, punct, ",", ","); - defineSymbol(math, main, punct, ";", ";"); - defineSymbol(math, ams, bin, "\u22BC", "\\barwedge", true); - defineSymbol(math, ams, bin, "\u22BB", "\\veebar", true); - defineSymbol(math, main, bin, "\u2299", "\\odot", true); - defineSymbol(math, main, bin, "\u2295", "\\oplus", true); - defineSymbol(math, main, bin, "\u2297", "\\otimes", true); - defineSymbol(math, main, textord, "\u2202", "\\partial", true); - defineSymbol(math, main, bin, "\u2298", "\\oslash", true); - defineSymbol(math, ams, bin, "\u229A", "\\circledcirc", true); - defineSymbol(math, ams, bin, "\u22A1", "\\boxdot", true); - defineSymbol(math, main, bin, "\u25B3", "\\bigtriangleup"); - defineSymbol(math, main, bin, "\u25BD", "\\bigtriangledown"); - defineSymbol(math, main, bin, "\u2020", "\\dagger"); - defineSymbol(math, main, bin, "\u22C4", "\\diamond"); - defineSymbol(math, main, bin, "\u22C6", "\\star"); - defineSymbol(math, main, bin, "\u25C3", "\\triangleleft"); - defineSymbol(math, main, bin, "\u25B9", "\\triangleright"); - defineSymbol(math, main, open, "{", "\\{"); - defineSymbol(text, main, textord, "{", "\\{"); - defineSymbol(text, main, textord, "{", "\\textbraceleft"); - defineSymbol(math, main, close, "}", "\\}"); - defineSymbol(text, main, textord, "}", "\\}"); - defineSymbol(text, main, textord, "}", "\\textbraceright"); - defineSymbol(math, main, open, "{", "\\lbrace"); - defineSymbol(math, main, close, "}", "\\rbrace"); - defineSymbol(math, main, open, "[", "\\lbrack", true); - defineSymbol(text, main, textord, "[", "\\lbrack", true); - defineSymbol(math, main, close, "]", "\\rbrack", true); - defineSymbol(text, main, textord, "]", "\\rbrack", true); - defineSymbol(math, main, open, "(", "\\lparen", true); - defineSymbol(math, main, close, ")", "\\rparen", true); - defineSymbol(text, main, textord, "<", "\\textless", true); - defineSymbol(text, main, textord, ">", "\\textgreater", true); - defineSymbol(math, main, open, "\u230A", "\\lfloor", true); - defineSymbol(math, main, close, "\u230B", "\\rfloor", true); - defineSymbol(math, main, open, "\u2308", "\\lceil", true); - defineSymbol(math, main, close, "\u2309", "\\rceil", true); - defineSymbol(math, main, textord, "\\", "\\backslash"); - defineSymbol(math, main, textord, "\u2223", "|"); - defineSymbol(math, main, textord, "\u2223", "\\vert"); - defineSymbol(text, main, textord, "|", "\\textbar", true); - defineSymbol(math, main, textord, "\u2225", "\\|"); - defineSymbol(math, main, textord, "\u2225", "\\Vert"); - defineSymbol(text, main, textord, "\u2225", "\\textbardbl"); - defineSymbol(text, main, textord, "~", "\\textasciitilde"); - defineSymbol(text, main, textord, "\\", "\\textbackslash"); - defineSymbol(text, main, textord, "^", "\\textasciicircum"); - defineSymbol(math, main, rel, "\u2191", "\\uparrow", true); - defineSymbol(math, main, rel, "\u21D1", "\\Uparrow", true); - defineSymbol(math, main, rel, "\u2193", "\\downarrow", true); - defineSymbol(math, main, rel, "\u21D3", "\\Downarrow", true); - defineSymbol(math, main, rel, "\u2195", "\\updownarrow", true); - defineSymbol(math, main, rel, "\u21D5", "\\Updownarrow", true); - defineSymbol(math, main, op, "\u2210", "\\coprod"); - defineSymbol(math, main, op, "\u22C1", "\\bigvee"); - defineSymbol(math, main, op, "\u22C0", "\\bigwedge"); - defineSymbol(math, main, op, "\u2A04", "\\biguplus"); - defineSymbol(math, main, op, "\u22C2", "\\bigcap"); - defineSymbol(math, main, op, "\u22C3", "\\bigcup"); - defineSymbol(math, main, op, "\u222B", "\\int"); - defineSymbol(math, main, op, "\u222B", "\\intop"); - defineSymbol(math, main, op, "\u222C", "\\iint"); - defineSymbol(math, main, op, "\u222D", "\\iiint"); - defineSymbol(math, main, op, "\u220F", "\\prod"); - defineSymbol(math, main, op, "\u2211", "\\sum"); - defineSymbol(math, main, op, "\u2A02", "\\bigotimes"); - defineSymbol(math, main, op, "\u2A01", "\\bigoplus"); - defineSymbol(math, main, op, "\u2A00", "\\bigodot"); - defineSymbol(math, main, op, "\u222E", "\\oint"); - defineSymbol(math, main, op, "\u222F", "\\oiint"); - defineSymbol(math, main, op, "\u2230", "\\oiiint"); - defineSymbol(math, main, op, "\u2A06", "\\bigsqcup"); - defineSymbol(math, main, op, "\u222B", "\\smallint"); - defineSymbol(text, main, inner, "\u2026", "\\textellipsis"); - defineSymbol(math, main, inner, "\u2026", "\\mathellipsis"); - defineSymbol(text, main, inner, "\u2026", "\\ldots", true); - defineSymbol(math, main, inner, "\u2026", "\\ldots", true); - defineSymbol(math, main, inner, "\u22EF", "\\@cdots", true); - defineSymbol(math, main, inner, "\u22F1", "\\ddots", true); - defineSymbol(math, main, textord, "\u22EE", "\\varvdots"); - defineSymbol(text, main, textord, "\u22EE", "\\varvdots"); - defineSymbol(math, main, accent, "\u02CA", "\\acute"); - defineSymbol(math, main, accent, "\u02CB", "\\grave"); - defineSymbol(math, main, accent, "\xA8", "\\ddot"); - defineSymbol(math, main, accent, "~", "\\tilde"); - defineSymbol(math, main, accent, "\u02C9", "\\bar"); - defineSymbol(math, main, accent, "\u02D8", "\\breve"); - defineSymbol(math, main, accent, "\u02C7", "\\check"); - defineSymbol(math, main, accent, "^", "\\hat"); - defineSymbol(math, main, accent, "\u20D7", "\\vec"); - defineSymbol(math, main, accent, "\u02D9", "\\dot"); - defineSymbol(math, main, accent, "\u02DA", "\\mathring"); - defineSymbol(math, main, mathord, "\uE131", "\\@imath"); - defineSymbol(math, main, mathord, "\uE237", "\\@jmath"); - defineSymbol(math, main, textord, "\u0131", "\u0131"); - defineSymbol(math, main, textord, "\u0237", "\u0237"); - defineSymbol(text, main, textord, "\u0131", "\\i", true); - defineSymbol(text, main, textord, "\u0237", "\\j", true); - defineSymbol(text, main, textord, "\xDF", "\\ss", true); - defineSymbol(text, main, textord, "\xE6", "\\ae", true); - defineSymbol(text, main, textord, "\u0153", "\\oe", true); - defineSymbol(text, main, textord, "\xF8", "\\o", true); - defineSymbol(text, main, textord, "\xC6", "\\AE", true); - defineSymbol(text, main, textord, "\u0152", "\\OE", true); - defineSymbol(text, main, textord, "\xD8", "\\O", true); - defineSymbol(text, main, accent, "\u02CA", "\\'"); - defineSymbol(text, main, accent, "\u02CB", "\\`"); - defineSymbol(text, main, accent, "\u02C6", "\\^"); - defineSymbol(text, main, accent, "\u02DC", "\\~"); - defineSymbol(text, main, accent, "\u02C9", "\\="); - defineSymbol(text, main, accent, "\u02D8", "\\u"); - defineSymbol(text, main, accent, "\u02D9", "\\."); - defineSymbol(text, main, accent, "\xB8", "\\c"); - defineSymbol(text, main, accent, "\u02DA", "\\r"); - defineSymbol(text, main, accent, "\u02C7", "\\v"); - defineSymbol(text, main, accent, "\xA8", '\\"'); - defineSymbol(text, main, accent, "\u02DD", "\\H"); - defineSymbol(text, main, accent, "\u25EF", "\\textcircled"); - var ligatures = { "--": true, "---": true, "``": true, "''": true }; - defineSymbol(text, main, textord, "\u2013", "--", true); - defineSymbol(text, main, textord, "\u2013", "\\textendash"); - defineSymbol(text, main, textord, "\u2014", "---", true); - defineSymbol(text, main, textord, "\u2014", "\\textemdash"); - defineSymbol(text, main, textord, "\u2018", "`", true); - defineSymbol(text, main, textord, "\u2018", "\\textquoteleft"); - defineSymbol(text, main, textord, "\u2019", "'", true); - defineSymbol(text, main, textord, "\u2019", "\\textquoteright"); - defineSymbol(text, main, textord, "\u201C", "``", true); - defineSymbol(text, main, textord, "\u201C", "\\textquotedblleft"); - defineSymbol(text, main, textord, "\u201D", "''", true); - defineSymbol(text, main, textord, "\u201D", "\\textquotedblright"); - defineSymbol(math, main, textord, "\xB0", "\\degree", true); - defineSymbol(text, main, textord, "\xB0", "\\degree"); - defineSymbol(text, main, textord, "\xB0", "\\textdegree", true); - defineSymbol(math, main, textord, "\xA3", "\\pounds"); - defineSymbol(math, main, textord, "\xA3", "\\mathsterling", true); - defineSymbol(text, main, textord, "\xA3", "\\pounds"); - defineSymbol(text, main, textord, "\xA3", "\\textsterling", true); - defineSymbol(math, ams, textord, "\u2720", "\\maltese"); - defineSymbol(text, ams, textord, "\u2720", "\\maltese"); - var mathTextSymbols = '0123456789/@."'; - for (var i = 0; i < mathTextSymbols.length; i++) { - var ch = mathTextSymbols.charAt(i); - defineSymbol(math, main, textord, ch, ch); - } - var textSymbols = '0123456789!@*()-=+";:?/.,'; - for (var _i = 0; _i < textSymbols.length; _i++) { - var _ch = textSymbols.charAt(_i); - defineSymbol(text, main, textord, _ch, _ch); - } - var letters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; - for (var _i2 = 0; _i2 < letters.length; _i2++) { - var _ch2 = letters.charAt(_i2); - defineSymbol(math, main, mathord, _ch2, _ch2); - defineSymbol(text, main, textord, _ch2, _ch2); - } - defineSymbol(math, ams, textord, "C", "\u2102"); - defineSymbol(text, ams, textord, "C", "\u2102"); - defineSymbol(math, ams, textord, "H", "\u210D"); - defineSymbol(text, ams, textord, "H", "\u210D"); - defineSymbol(math, ams, textord, "N", "\u2115"); - defineSymbol(text, ams, textord, "N", "\u2115"); - defineSymbol(math, ams, textord, "P", "\u2119"); - defineSymbol(text, ams, textord, "P", "\u2119"); - defineSymbol(math, ams, textord, "Q", "\u211A"); - defineSymbol(text, ams, textord, "Q", "\u211A"); - defineSymbol(math, ams, textord, "R", "\u211D"); - defineSymbol(text, ams, textord, "R", "\u211D"); - defineSymbol(math, ams, textord, "Z", "\u2124"); - defineSymbol(text, ams, textord, "Z", "\u2124"); - defineSymbol(math, main, mathord, "h", "\u210E"); - defineSymbol(text, main, mathord, "h", "\u210E"); - var wideChar = ""; - for (var _i3 = 0; _i3 < letters.length; _i3++) { - var _ch3 = letters.charAt(_i3); - wideChar = String.fromCharCode(55349, 56320 + _i3); - defineSymbol(math, main, mathord, _ch3, wideChar); - defineSymbol(text, main, textord, _ch3, wideChar); - wideChar = String.fromCharCode(55349, 56372 + _i3); - defineSymbol(math, main, mathord, _ch3, wideChar); - defineSymbol(text, main, textord, _ch3, wideChar); - wideChar = String.fromCharCode(55349, 56424 + _i3); - defineSymbol(math, main, mathord, _ch3, wideChar); - defineSymbol(text, main, textord, _ch3, wideChar); - wideChar = String.fromCharCode(55349, 56580 + _i3); - defineSymbol(math, main, mathord, _ch3, wideChar); - defineSymbol(text, main, textord, _ch3, wideChar); - wideChar = String.fromCharCode(55349, 56684 + _i3); - defineSymbol(math, main, mathord, _ch3, wideChar); - defineSymbol(text, main, textord, _ch3, wideChar); - wideChar = String.fromCharCode(55349, 56736 + _i3); - defineSymbol(math, main, mathord, _ch3, wideChar); - defineSymbol(text, main, textord, _ch3, wideChar); - wideChar = String.fromCharCode(55349, 56788 + _i3); - defineSymbol(math, main, mathord, _ch3, wideChar); - defineSymbol(text, main, textord, _ch3, wideChar); - wideChar = String.fromCharCode(55349, 56840 + _i3); - defineSymbol(math, main, mathord, _ch3, wideChar); - defineSymbol(text, main, textord, _ch3, wideChar); - wideChar = String.fromCharCode(55349, 56944 + _i3); - defineSymbol(math, main, mathord, _ch3, wideChar); - defineSymbol(text, main, textord, _ch3, wideChar); - if (_i3 < 26) { - wideChar = String.fromCharCode(55349, 56632 + _i3); - defineSymbol(math, main, mathord, _ch3, wideChar); - defineSymbol(text, main, textord, _ch3, wideChar); - wideChar = String.fromCharCode(55349, 56476 + _i3); - defineSymbol(math, main, mathord, _ch3, wideChar); - defineSymbol(text, main, textord, _ch3, wideChar); - } - } - wideChar = String.fromCharCode(55349, 56668); - defineSymbol(math, main, mathord, "k", wideChar); - defineSymbol(text, main, textord, "k", wideChar); - for (var _i4 = 0; _i4 < 10; _i4++) { - var _ch4 = _i4.toString(); - wideChar = String.fromCharCode(55349, 57294 + _i4); - defineSymbol(math, main, mathord, _ch4, wideChar); - defineSymbol(text, main, textord, _ch4, wideChar); - wideChar = String.fromCharCode(55349, 57314 + _i4); - defineSymbol(math, main, mathord, _ch4, wideChar); - defineSymbol(text, main, textord, _ch4, wideChar); - wideChar = String.fromCharCode(55349, 57324 + _i4); - defineSymbol(math, main, mathord, _ch4, wideChar); - defineSymbol(text, main, textord, _ch4, wideChar); - wideChar = String.fromCharCode(55349, 57334 + _i4); - defineSymbol(math, main, mathord, _ch4, wideChar); - defineSymbol(text, main, textord, _ch4, wideChar); - } - var extraLatin = "\xD0\xDE\xFE"; - for (var _i5 = 0; _i5 < extraLatin.length; _i5++) { - var _ch5 = extraLatin.charAt(_i5); - defineSymbol(math, main, mathord, _ch5, _ch5); - defineSymbol(text, main, textord, _ch5, _ch5); - } - var wideLatinLetterData = [ - ["mathbf", "textbf", "Main-Bold"], - ["mathbf", "textbf", "Main-Bold"], - ["mathnormal", "textit", "Math-Italic"], - ["mathnormal", "textit", "Math-Italic"], - ["boldsymbol", "boldsymbol", "Main-BoldItalic"], - ["boldsymbol", "boldsymbol", "Main-BoldItalic"], - ["mathscr", "textscr", "Script-Regular"], - ["", "", ""], - ["", "", ""], - ["", "", ""], - ["mathfrak", "textfrak", "Fraktur-Regular"], - ["mathfrak", "textfrak", "Fraktur-Regular"], - ["mathbb", "textbb", "AMS-Regular"], - ["mathbb", "textbb", "AMS-Regular"], - ["mathboldfrak", "textboldfrak", "Fraktur-Regular"], - ["mathboldfrak", "textboldfrak", "Fraktur-Regular"], - ["mathsf", "textsf", "SansSerif-Regular"], - ["mathsf", "textsf", "SansSerif-Regular"], - ["mathboldsf", "textboldsf", "SansSerif-Bold"], - ["mathboldsf", "textboldsf", "SansSerif-Bold"], - ["mathitsf", "textitsf", "SansSerif-Italic"], - ["mathitsf", "textitsf", "SansSerif-Italic"], - ["", "", ""], - ["", "", ""], - ["mathtt", "texttt", "Typewriter-Regular"], - ["mathtt", "texttt", "Typewriter-Regular"], - ]; - var wideNumeralData = [ - ["mathbf", "textbf", "Main-Bold"], - ["", "", ""], - ["mathsf", "textsf", "SansSerif-Regular"], - ["mathboldsf", "textboldsf", "SansSerif-Bold"], - ["mathtt", "texttt", "Typewriter-Regular"], - ]; - var wideCharacterFont = function wideCharacterFont(wideChar, mode) { - var H = wideChar.charCodeAt(0); - var L = wideChar.charCodeAt(1); - var codePoint = (H - 55296) * 1024 + (L - 56320) + 65536; - var j = mode === "math" ? 0 : 1; - if (119808 <= codePoint && codePoint < 120484) { - var i = Math.floor((codePoint - 119808) / 26); - return [wideLatinLetterData[i][2], wideLatinLetterData[i][j]]; - } else if (120782 <= codePoint && codePoint <= 120831) { - var _i = Math.floor((codePoint - 120782) / 10); - return [wideNumeralData[_i][2], wideNumeralData[_i][j]]; - } else if (codePoint === 120485 || codePoint === 120486) { - return [wideLatinLetterData[0][2], wideLatinLetterData[0][j]]; - } else if (120486 < codePoint && codePoint < 120782) { - return ["", ""]; - } else { - throw new ParseError("Unsupported character: " + wideChar); - } - }; - var lookupSymbol = function lookupSymbol(value, fontName, mode) { - if (symbols[mode][value] && symbols[mode][value].replace) { - value = symbols[mode][value].replace; - } - return { - value: value, - metrics: getCharacterMetrics(value, fontName, mode), - }; - }; - var makeSymbol = function makeSymbol( - value, - fontName, - mode, - options, - classes, - ) { - var lookup = lookupSymbol(value, fontName, mode); - var metrics = lookup.metrics; - value = lookup.value; - var symbolNode; - if (metrics) { - var italic = metrics.italic; - if (mode === "text" || (options && options.font === "mathit")) { - italic = 0; - } - symbolNode = new SymbolNode( - value, - metrics.height, - metrics.depth, - italic, - metrics.skew, - metrics.width, - classes, - ); - } else { - typeof console !== "undefined" && - console.warn( - "No character metrics " + - ("for '" + - value + - "' in style '" + - fontName + - "' and mode '" + - mode + - "'"), - ); - symbolNode = new SymbolNode(value, 0, 0, 0, 0, 0, classes); - } - if (options) { - symbolNode.maxFontSize = options.sizeMultiplier; - if (options.style.isTight()) { - symbolNode.classes.push("mtight"); - } - var color = options.getColor(); - if (color) { - symbolNode.style.color = color; - } - } - return symbolNode; - }; - var mathsym = function mathsym(value, mode, options, classes) { - if (classes === void 0) { - classes = []; - } - if ( - options.font === "boldsymbol" && - lookupSymbol(value, "Main-Bold", mode).metrics - ) { - return makeSymbol( - value, - "Main-Bold", - mode, - options, - classes.concat(["mathbf"]), - ); - } else if (value === "\\" || symbols[mode][value].font === "main") { - return makeSymbol(value, "Main-Regular", mode, options, classes); - } else { - return makeSymbol( - value, - "AMS-Regular", - mode, - options, - classes.concat(["amsrm"]), - ); - } - }; - var boldsymbol = function boldsymbol(value, mode, options, classes, type) { - if ( - type !== "textord" && - lookupSymbol(value, "Math-BoldItalic", mode).metrics - ) { - return { fontName: "Math-BoldItalic", fontClass: "boldsymbol" }; - } else { - return { fontName: "Main-Bold", fontClass: "mathbf" }; - } - }; - var makeOrd = function makeOrd(group, options, type) { - var mode = group.mode; - var text = group.text; - var classes = ["mord"]; - var isFont = mode === "math" || (mode === "text" && options.font); - var fontOrFamily = isFont ? options.font : options.fontFamily; - var wideFontName = ""; - var wideFontClass = ""; - if (text.charCodeAt(0) === 55349) { - var _wideCharacterFont = wideCharacterFont(text, mode); - var _wideCharacterFont2 = _slicedToArray(_wideCharacterFont, 2); - wideFontName = _wideCharacterFont2[0]; - wideFontClass = _wideCharacterFont2[1]; - } - if (wideFontName.length > 0) { - return makeSymbol( - text, - wideFontName, - mode, - options, - classes.concat(wideFontClass), - ); - } else if (fontOrFamily) { - var fontName; - var fontClasses; - if (fontOrFamily === "boldsymbol") { - var fontData = boldsymbol(text, mode, options, classes, type); - fontName = fontData.fontName; - fontClasses = [fontData.fontClass]; - } else if (isFont) { - fontName = fontMap[fontOrFamily].fontName; - fontClasses = [fontOrFamily]; - } else { - fontName = retrieveTextFontName( - fontOrFamily, - options.fontWeight, - options.fontShape, - ); - fontClasses = [fontOrFamily, options.fontWeight, options.fontShape]; - } - if (lookupSymbol(text, fontName, mode).metrics) { - return makeSymbol( - text, - fontName, - mode, - options, - classes.concat(fontClasses), - ); - } else if ( - ligatures.hasOwnProperty(text) && - fontName.slice(0, 10) === "Typewriter" - ) { - var parts = []; - for (var i = 0; i < text.length; i++) { - parts.push( - makeSymbol( - text[i], - fontName, - mode, - options, - classes.concat(fontClasses), - ), - ); - } - return makeFragment(parts); - } - } - if (type === "mathord") { - return makeSymbol( - text, - "Math-Italic", - mode, - options, - classes.concat(["mathnormal"]), - ); - } else if (type === "textord") { - var font = symbols[mode][text] && symbols[mode][text].font; - if (font === "ams") { - var _fontName = retrieveTextFontName( - "amsrm", - options.fontWeight, - options.fontShape, - ); - return makeSymbol( - text, - _fontName, - mode, - options, - classes.concat("amsrm", options.fontWeight, options.fontShape), - ); - } else if (font === "main" || !font) { - var _fontName2 = retrieveTextFontName( - "textrm", - options.fontWeight, - options.fontShape, - ); - return makeSymbol( - text, - _fontName2, - mode, - options, - classes.concat(options.fontWeight, options.fontShape), - ); - } else { - var _fontName3 = retrieveTextFontName( - font, - options.fontWeight, - options.fontShape, - ); - return makeSymbol( - text, - _fontName3, - mode, - options, - classes.concat(_fontName3, options.fontWeight, options.fontShape), - ); - } - } else { - throw new Error("unexpected type: " + type + " in makeOrd"); - } - }; - var canCombine = function canCombine(prev, next) { - if ( - createClass(prev.classes) !== createClass(next.classes) || - prev.skew !== next.skew || - prev.maxFontSize !== next.maxFontSize - ) { - return false; - } - if (prev.classes.length === 1) { - var cls = prev.classes[0]; - if (cls === "mbin" || cls === "mord") { - return false; - } - } - for (var style in prev.style) { - if ( - prev.style.hasOwnProperty(style) && - prev.style[style] !== next.style[style] - ) { - return false; - } - } - for (var _style in next.style) { - if ( - next.style.hasOwnProperty(_style) && - prev.style[_style] !== next.style[_style] - ) { - return false; - } - } - return true; - }; - var tryCombineChars = function tryCombineChars(chars) { - for (var i = 0; i < chars.length - 1; i++) { - var prev = chars[i]; - var next = chars[i + 1]; - if ( - prev instanceof SymbolNode && - next instanceof SymbolNode && - canCombine(prev, next) - ) { - prev.text += next.text; - prev.height = Math.max(prev.height, next.height); - prev.depth = Math.max(prev.depth, next.depth); - prev.italic = next.italic; - chars.splice(i + 1, 1); - i--; - } - } - return chars; - }; - var sizeElementFromChildren = function sizeElementFromChildren(elem) { - var height = 0; - var depth = 0; - var maxFontSize = 0; - for (var i = 0; i < elem.children.length; i++) { - var child = elem.children[i]; - if (child.height > height) { - height = child.height; - } - if (child.depth > depth) { - depth = child.depth; - } - if (child.maxFontSize > maxFontSize) { - maxFontSize = child.maxFontSize; - } - } - elem.height = height; - elem.depth = depth; - elem.maxFontSize = maxFontSize; - }; - var makeSpan$2 = function makeSpan(classes, children, options, style) { - var span = new Span(classes, children, options, style); - sizeElementFromChildren(span); - return span; - }; - var makeSvgSpan = function makeSvgSpan(classes, children, options, style) { - return new Span(classes, children, options, style); - }; - var makeLineSpan = function makeLineSpan(className, options, thickness) { - var line = makeSpan$2([className], [], options); - line.height = Math.max( - thickness || options.fontMetrics().defaultRuleThickness, - options.minRuleThickness, - ); - line.style.borderBottomWidth = makeEm(line.height); - line.maxFontSize = 1; - return line; - }; - var makeAnchor = function makeAnchor(href, classes, children, options) { - var anchor = new Anchor(href, classes, children, options); - sizeElementFromChildren(anchor); - return anchor; - }; - var makeFragment = function makeFragment(children) { - var fragment = new DocumentFragment(children); - sizeElementFromChildren(fragment); - return fragment; - }; - var wrapFragment = function wrapFragment(group, options) { - if (group instanceof DocumentFragment) { - return makeSpan$2([], [group], options); - } - return group; - }; - var getVListChildrenAndDepth = function getVListChildrenAndDepth(params) { - if (params.positionType === "individualShift") { - var oldChildren = params.children; - var children = [oldChildren[0]]; - var _depth = -oldChildren[0].shift - oldChildren[0].elem.depth; - var currPos = _depth; - for (var i = 1; i < oldChildren.length; i++) { - var diff = -oldChildren[i].shift - currPos - oldChildren[i].elem.depth; - var size = - diff - - (oldChildren[i - 1].elem.height + oldChildren[i - 1].elem.depth); - currPos = currPos + diff; - children.push({ type: "kern", size: size }); - children.push(oldChildren[i]); - } - return { children: children, depth: _depth }; - } - var depth; - if (params.positionType === "top") { - var bottom = params.positionData; - for (var _i = 0; _i < params.children.length; _i++) { - var child = params.children[_i]; - bottom -= - child.type === "kern" - ? child.size - : child.elem.height + child.elem.depth; - } - depth = bottom; - } else if (params.positionType === "bottom") { - depth = -params.positionData; - } else { - var firstChild = params.children[0]; - if (firstChild.type !== "elem") { - throw new Error('First child must have type "elem".'); - } - if (params.positionType === "shift") { - depth = -firstChild.elem.depth - params.positionData; - } else if (params.positionType === "firstBaseline") { - depth = -firstChild.elem.depth; - } else { - throw new Error("Invalid positionType " + params.positionType + "."); - } - } - return { children: params.children, depth: depth }; - }; - var makeVList = function makeVList(params, options) { - var _getVListChildrenAndD = getVListChildrenAndDepth(params), - children = _getVListChildrenAndD.children, - depth = _getVListChildrenAndD.depth; - var pstrutSize = 0; - for (var i = 0; i < children.length; i++) { - var child = children[i]; - if (child.type === "elem") { - var elem = child.elem; - pstrutSize = Math.max(pstrutSize, elem.maxFontSize, elem.height); - } - } - pstrutSize += 2; - var pstrut = makeSpan$2(["pstrut"], []); - pstrut.style.height = makeEm(pstrutSize); - var realChildren = []; - var minPos = depth; - var maxPos = depth; - var currPos = depth; - for (var _i2 = 0; _i2 < children.length; _i2++) { - var _child = children[_i2]; - if (_child.type === "kern") { - currPos += _child.size; - } else { - var _elem = _child.elem; - var classes = _child.wrapperClasses || []; - var style = _child.wrapperStyle || {}; - var childWrap = makeSpan$2(classes, [pstrut, _elem], undefined, style); - childWrap.style.top = makeEm(-pstrutSize - currPos - _elem.depth); - if (_child.marginLeft) { - childWrap.style.marginLeft = _child.marginLeft; - } - if (_child.marginRight) { - childWrap.style.marginRight = _child.marginRight; - } - realChildren.push(childWrap); - currPos += _elem.height + _elem.depth; - } - minPos = Math.min(minPos, currPos); - maxPos = Math.max(maxPos, currPos); - } - var vlist = makeSpan$2(["vlist"], realChildren); - vlist.style.height = makeEm(maxPos); - var rows; - if (minPos < 0) { - var emptySpan = makeSpan$2([], []); - var depthStrut = makeSpan$2(["vlist"], [emptySpan]); - depthStrut.style.height = makeEm(-minPos); - var topStrut = makeSpan$2(["vlist-s"], [new SymbolNode("\u200B")]); - rows = [ - makeSpan$2(["vlist-r"], [vlist, topStrut]), - makeSpan$2(["vlist-r"], [depthStrut]), - ]; - } else { - rows = [makeSpan$2(["vlist-r"], [vlist])]; - } - var vtable = makeSpan$2(["vlist-t"], rows); - if (rows.length === 2) { - vtable.classes.push("vlist-t2"); - } - vtable.height = maxPos; - vtable.depth = -minPos; - return vtable; - }; - var makeGlue = function makeGlue(measurement, options) { - var rule = makeSpan$2(["mspace"], [], options); - var size = calculateSize(measurement, options); - rule.style.marginRight = makeEm(size); - return rule; - }; - var retrieveTextFontName = function retrieveTextFontName( - fontFamily, - fontWeight, - fontShape, - ) { - var baseFontName = ""; - switch (fontFamily) { - case "amsrm": - baseFontName = "AMS"; - break; - case "textrm": - baseFontName = "Main"; - break; - case "textsf": - baseFontName = "SansSerif"; - break; - case "texttt": - baseFontName = "Typewriter"; - break; - default: - baseFontName = fontFamily; - } - var fontStylesName; - if (fontWeight === "textbf" && fontShape === "textit") { - fontStylesName = "BoldItalic"; - } else if (fontWeight === "textbf") { - fontStylesName = "Bold"; - } else if (fontWeight === "textit") { - fontStylesName = "Italic"; - } else { - fontStylesName = "Regular"; - } - return baseFontName + "-" + fontStylesName; - }; - var fontMap = { - mathbf: { variant: "bold", fontName: "Main-Bold" }, - mathrm: { variant: "normal", fontName: "Main-Regular" }, - textit: { variant: "italic", fontName: "Main-Italic" }, - mathit: { variant: "italic", fontName: "Main-Italic" }, - mathnormal: { variant: "italic", fontName: "Math-Italic" }, - mathsfit: { variant: "sans-serif-italic", fontName: "SansSerif-Italic" }, - mathbb: { variant: "double-struck", fontName: "AMS-Regular" }, - mathcal: { variant: "script", fontName: "Caligraphic-Regular" }, - mathfrak: { variant: "fraktur", fontName: "Fraktur-Regular" }, - mathscr: { variant: "script", fontName: "Script-Regular" }, - mathsf: { variant: "sans-serif", fontName: "SansSerif-Regular" }, - mathtt: { variant: "monospace", fontName: "Typewriter-Regular" }, - }; - var svgData = { - vec: ["vec", 0.471, 0.714], - oiintSize1: ["oiintSize1", 0.957, 0.499], - oiintSize2: ["oiintSize2", 1.472, 0.659], - oiiintSize1: ["oiiintSize1", 1.304, 0.499], - oiiintSize2: ["oiiintSize2", 1.98, 0.659], - }; - var staticSvg = function staticSvg(value, options) { - var _svgData$value = _slicedToArray(svgData[value], 3), - pathName = _svgData$value[0], - width = _svgData$value[1], - height = _svgData$value[2]; - var path = new PathNode(pathName); - var svgNode = new SvgNode([path], { - width: makeEm(width), - height: makeEm(height), - style: "width:" + makeEm(width), - viewBox: "0 0 " + 1000 * width + " " + 1000 * height, - preserveAspectRatio: "xMinYMin", - }); - var span = makeSvgSpan(["overlay"], [svgNode], options); - span.height = height; - span.style.height = makeEm(height); - span.style.width = makeEm(width); - return span; - }; - var buildCommon = { - fontMap: fontMap, - makeSymbol: makeSymbol, - mathsym: mathsym, - makeSpan: makeSpan$2, - makeSvgSpan: makeSvgSpan, - makeLineSpan: makeLineSpan, - makeAnchor: makeAnchor, - makeFragment: makeFragment, - wrapFragment: wrapFragment, - makeVList: makeVList, - makeOrd: makeOrd, - makeGlue: makeGlue, - staticSvg: staticSvg, - svgData: svgData, - tryCombineChars: tryCombineChars, - }; - var thinspace = { number: 3, unit: "mu" }; - var mediumspace = { number: 4, unit: "mu" }; - var thickspace = { number: 5, unit: "mu" }; - var spacings = { - mord: { - mop: thinspace, - mbin: mediumspace, - mrel: thickspace, - minner: thinspace, - }, - mop: { - mord: thinspace, - mop: thinspace, - mrel: thickspace, - minner: thinspace, - }, - mbin: { - mord: mediumspace, - mop: mediumspace, - mopen: mediumspace, - minner: mediumspace, - }, - mrel: { - mord: thickspace, - mop: thickspace, - mopen: thickspace, - minner: thickspace, - }, - mopen: {}, - mclose: { - mop: thinspace, - mbin: mediumspace, - mrel: thickspace, - minner: thinspace, - }, - mpunct: { - mord: thinspace, - mop: thinspace, - mrel: thickspace, - mopen: thinspace, - mclose: thinspace, - mpunct: thinspace, - minner: thinspace, - }, - minner: { - mord: thinspace, - mop: thinspace, - mbin: mediumspace, - mrel: thickspace, - mopen: thinspace, - mpunct: thinspace, - minner: thinspace, - }, - }; - var tightSpacings = { - mord: { mop: thinspace }, - mop: { mord: thinspace, mop: thinspace }, - mbin: {}, - mrel: {}, - mopen: {}, - mclose: { mop: thinspace }, - mpunct: {}, - minner: { mop: thinspace }, - }; - var _functions = {}; - var _htmlGroupBuilders = {}; - var _mathmlGroupBuilders = {}; - function defineFunction(_ref) { - var type = _ref.type, - names = _ref.names, - props = _ref.props, - handler = _ref.handler, - htmlBuilder = _ref.htmlBuilder, - mathmlBuilder = _ref.mathmlBuilder; - var data = { - type: type, - numArgs: props.numArgs, - argTypes: props.argTypes, - allowedInArgument: !!props.allowedInArgument, - allowedInText: !!props.allowedInText, - allowedInMath: - props.allowedInMath === undefined ? true : props.allowedInMath, - numOptionalArgs: props.numOptionalArgs || 0, - infix: !!props.infix, - primitive: !!props.primitive, - handler: handler, - }; - for (var i = 0; i < names.length; ++i) { - _functions[names[i]] = data; - } - if (type) { - if (htmlBuilder) { - _htmlGroupBuilders[type] = htmlBuilder; - } - if (mathmlBuilder) { - _mathmlGroupBuilders[type] = mathmlBuilder; - } - } - } - function defineFunctionBuilders(_ref2) { - var type = _ref2.type, - htmlBuilder = _ref2.htmlBuilder, - mathmlBuilder = _ref2.mathmlBuilder; - defineFunction({ - type: type, - names: [], - props: { numArgs: 0 }, - handler: function handler() { - throw new Error("Should never be called."); - }, - htmlBuilder: htmlBuilder, - mathmlBuilder: mathmlBuilder, - }); - } - var normalizeArgument = function normalizeArgument(arg) { - return arg.type === "ordgroup" && arg.body.length === 1 ? arg.body[0] : arg; - }; - var ordargument = function ordargument(arg) { - return arg.type === "ordgroup" ? arg.body : [arg]; - }; - var makeSpan$1 = buildCommon.makeSpan; - var binLeftCanceller = ["leftmost", "mbin", "mopen", "mrel", "mop", "mpunct"]; - var binRightCanceller = ["rightmost", "mrel", "mclose", "mpunct"]; - var styleMap$1 = { - display: Style$1.DISPLAY, - text: Style$1.TEXT, - script: Style$1.SCRIPT, - scriptscript: Style$1.SCRIPTSCRIPT, - }; - var DomEnum = { - mord: "mord", - mop: "mop", - mbin: "mbin", - mrel: "mrel", - mopen: "mopen", - mclose: "mclose", - mpunct: "mpunct", - minner: "minner", - }; - var buildExpression$1 = function buildExpression( - expression, - options, - isRealGroup, - surrounding, - ) { - if (surrounding === void 0) { - surrounding = [null, null]; - } - var groups = []; - for (var i = 0; i < expression.length; i++) { - var output = buildGroup$1(expression[i], options); - if (output instanceof DocumentFragment) { - var children = output.children; - groups.push.apply(groups, _toConsumableArray(children)); - } else { - groups.push(output); - } - } - buildCommon.tryCombineChars(groups); - if (!isRealGroup) { - return groups; - } - var glueOptions = options; - if (expression.length === 1) { - var node = expression[0]; - if (node.type === "sizing") { - glueOptions = options.havingSize(node.size); - } else if (node.type === "styling") { - glueOptions = options.havingStyle(styleMap$1[node.style]); - } - } - var dummyPrev = makeSpan$1([surrounding[0] || "leftmost"], [], options); - var dummyNext = makeSpan$1([surrounding[1] || "rightmost"], [], options); - var isRoot = isRealGroup === "root"; - traverseNonSpaceNodes( - groups, - function (node, prev) { - var prevType = prev.classes[0]; - var type = node.classes[0]; - if (prevType === "mbin" && utils.contains(binRightCanceller, type)) { - prev.classes[0] = "mord"; - } else if ( - type === "mbin" && - utils.contains(binLeftCanceller, prevType) - ) { - node.classes[0] = "mord"; - } - }, - { node: dummyPrev }, - dummyNext, - isRoot, - ); - traverseNonSpaceNodes( - groups, - function (node, prev) { - var prevType = getTypeOfDomTree(prev); - var type = getTypeOfDomTree(node); - var space = - prevType && type - ? node.hasClass("mtight") - ? tightSpacings[prevType][type] - : spacings[prevType][type] - : null; - if (space) { - return buildCommon.makeGlue(space, glueOptions); - } - }, - { node: dummyPrev }, - dummyNext, - isRoot, - ); - return groups; - }; - var traverseNonSpaceNodes = function traverseNonSpaceNodes( - nodes, - callback, - prev, - next, - isRoot, - ) { - if (next) { - nodes.push(next); - } - var i = 0; - for (; i < nodes.length; i++) { - var node = nodes[i]; - var partialGroup = checkPartialGroup(node); - if (partialGroup) { - traverseNonSpaceNodes( - partialGroup.children, - callback, - prev, - null, - isRoot, - ); - continue; - } - var nonspace = !node.hasClass("mspace"); - if (nonspace) { - var result = callback(node, prev.node); - if (result) { - if (prev.insertAfter) { - prev.insertAfter(result); - } else { - nodes.unshift(result); - i++; - } - } - } - if (nonspace) { - prev.node = node; - } else if (isRoot && node.hasClass("newline")) { - prev.node = makeSpan$1(["leftmost"]); - } - prev.insertAfter = (function (index) { - return function (n) { - nodes.splice(index + 1, 0, n); - i++; - }; - })(i); - } - if (next) { - nodes.pop(); - } - }; - var checkPartialGroup = function checkPartialGroup(node) { - if ( - node instanceof DocumentFragment || - node instanceof Anchor || - (node instanceof Span && node.hasClass("enclosing")) - ) { - return node; - } - return null; - }; - var getOutermostNode = function getOutermostNode(node, side) { - var partialGroup = checkPartialGroup(node); - if (partialGroup) { - var children = partialGroup.children; - if (children.length) { - if (side === "right") { - return getOutermostNode(children[children.length - 1], "right"); - } else if (side === "left") { - return getOutermostNode(children[0], "left"); - } - } - } - return node; - }; - var getTypeOfDomTree = function getTypeOfDomTree(node, side) { - if (!node) { - return null; - } - if (side) { - node = getOutermostNode(node, side); - } - return DomEnum[node.classes[0]] || null; - }; - var makeNullDelimiter = function makeNullDelimiter(options, classes) { - var moreClasses = ["nulldelimiter"].concat(options.baseSizingClasses()); - return makeSpan$1(classes.concat(moreClasses)); - }; - var buildGroup$1 = function buildGroup(group, options, baseOptions) { - if (!group) { - return makeSpan$1(); - } - if (_htmlGroupBuilders[group.type]) { - var groupNode = _htmlGroupBuilders[group.type](group, options); - if (baseOptions && options.size !== baseOptions.size) { - groupNode = makeSpan$1( - options.sizingClasses(baseOptions), - [groupNode], - options, - ); - var multiplier = options.sizeMultiplier / baseOptions.sizeMultiplier; - groupNode.height *= multiplier; - groupNode.depth *= multiplier; - } - return groupNode; - } else { - throw new ParseError("Got group of unknown type: '" + group.type + "'"); - } - }; - function buildHTMLUnbreakable(children, options) { - var body = makeSpan$1(["base"], children, options); - var strut = makeSpan$1(["strut"]); - strut.style.height = makeEm(body.height + body.depth); - if (body.depth) { - strut.style.verticalAlign = makeEm(-body.depth); - } - body.children.unshift(strut); - return body; - } - function buildHTML(tree, options) { - var tag = null; - if (tree.length === 1 && tree[0].type === "tag") { - tag = tree[0].tag; - tree = tree[0].body; - } - var expression = buildExpression$1(tree, options, "root"); - var eqnNum; - if (expression.length === 2 && expression[1].hasClass("tag")) { - eqnNum = expression.pop(); - } - var children = []; - var parts = []; - for (var i = 0; i < expression.length; i++) { - parts.push(expression[i]); - if ( - expression[i].hasClass("mbin") || - expression[i].hasClass("mrel") || - expression[i].hasClass("allowbreak") - ) { - var nobreak = false; - while ( - i < expression.length - 1 && - expression[i + 1].hasClass("mspace") && - !expression[i + 1].hasClass("newline") - ) { - i++; - parts.push(expression[i]); - if (expression[i].hasClass("nobreak")) { - nobreak = true; - } - } - if (!nobreak) { - children.push(buildHTMLUnbreakable(parts, options)); - parts = []; - } - } else if (expression[i].hasClass("newline")) { - parts.pop(); - if (parts.length > 0) { - children.push(buildHTMLUnbreakable(parts, options)); - parts = []; - } - children.push(expression[i]); - } - } - if (parts.length > 0) { - children.push(buildHTMLUnbreakable(parts, options)); - } - var tagChild; - if (tag) { - tagChild = buildHTMLUnbreakable(buildExpression$1(tag, options, true)); - tagChild.classes = ["tag"]; - children.push(tagChild); - } else if (eqnNum) { - children.push(eqnNum); - } - var htmlNode = makeSpan$1(["katex-html"], children); - htmlNode.setAttribute("aria-hidden", "true"); - if (tagChild) { - var strut = tagChild.children[0]; - strut.style.height = makeEm(htmlNode.height + htmlNode.depth); - if (htmlNode.depth) { - strut.style.verticalAlign = makeEm(-htmlNode.depth); - } - } - return htmlNode; - } - function newDocumentFragment(children) { - return new DocumentFragment(children); - } - var MathNode = (function () { - function MathNode(type, children, classes) { - _classCallCheck(this, MathNode); - this.type = void 0; - this.attributes = void 0; - this.children = void 0; - this.classes = void 0; - this.type = type; - this.attributes = {}; - this.children = children || []; - this.classes = classes || []; - } - return _createClass(MathNode, [ - { - key: "setAttribute", - value: function setAttribute(name, value) { - this.attributes[name] = value; - }, - }, - { - key: "getAttribute", - value: function getAttribute(name) { - return this.attributes[name]; - }, - }, - { - key: "toNode", - value: function toNode() { - var node = document.createElementNS( - "http://www.w3.org/1998/Math/MathML", - this.type, - ); - for (var attr in this.attributes) { - if (Object.prototype.hasOwnProperty.call(this.attributes, attr)) { - node.setAttribute(attr, this.attributes[attr]); - } - } - if (this.classes.length > 0) { - node.className = createClass(this.classes); - } - for (var i = 0; i < this.children.length; i++) { - if ( - this.children[i] instanceof TextNode && - this.children[i + 1] instanceof TextNode - ) { - var text = - this.children[i].toText() + this.children[++i].toText(); - while (this.children[i + 1] instanceof TextNode) { - text += this.children[++i].toText(); - } - node.appendChild(new TextNode(text).toNode()); - } else { - node.appendChild(this.children[i].toNode()); - } - } - return node; - }, - }, - { - key: "toMarkup", - value: function toMarkup() { - var markup = "<" + this.type; - for (var attr in this.attributes) { - if (Object.prototype.hasOwnProperty.call(this.attributes, attr)) { - markup += " " + attr + '="'; - markup += utils.escape(this.attributes[attr]); - markup += '"'; - } - } - if (this.classes.length > 0) { - markup += - ' class ="' + utils.escape(createClass(this.classes)) + '"'; - } - markup += ">"; - for (var i = 0; i < this.children.length; i++) { - markup += this.children[i].toMarkup(); - } - markup += ""; - return markup; - }, - }, - { - key: "toText", - value: function toText() { - return this.children - .map(function (child) { - return child.toText(); - }) - .join(""); - }, - }, - ]); - })(); - var TextNode = (function () { - function TextNode(text) { - _classCallCheck(this, TextNode); - this.text = void 0; - this.text = text; - } - return _createClass(TextNode, [ - { - key: "toNode", - value: function toNode() { - return document.createTextNode(this.text); - }, - }, - { - key: "toMarkup", - value: function toMarkup() { - return utils.escape(this.toText()); - }, - }, - { - key: "toText", - value: function toText() { - return this.text; - }, - }, - ]); - })(); - var SpaceNode = (function () { - function SpaceNode(width) { - _classCallCheck(this, SpaceNode); - this.width = void 0; - this.character = void 0; - this.width = width; - if (width >= 0.05555 && width <= 0.05556) { - this.character = "\u200A"; - } else if (width >= 0.1666 && width <= 0.1667) { - this.character = "\u2009"; - } else if (width >= 0.2222 && width <= 0.2223) { - this.character = "\u2005"; - } else if (width >= 0.2777 && width <= 0.2778) { - this.character = "\u2005\u200A"; - } else if (width >= -0.05556 && width <= -0.05555) { - this.character = "\u200A\u2063"; - } else if (width >= -0.1667 && width <= -0.1666) { - this.character = "\u2009\u2063"; - } else if (width >= -0.2223 && width <= -0.2222) { - this.character = "\u205F\u2063"; - } else if (width >= -0.2778 && width <= -0.2777) { - this.character = "\u2005\u2063"; - } else { - this.character = null; - } - } - return _createClass(SpaceNode, [ - { - key: "toNode", - value: function toNode() { - if (this.character) { - return document.createTextNode(this.character); - } else { - var node = document.createElementNS( - "http://www.w3.org/1998/Math/MathML", - "mspace", - ); - node.setAttribute("width", makeEm(this.width)); - return node; - } - }, - }, - { - key: "toMarkup", - value: function toMarkup() { - if (this.character) { - return "" + this.character + ""; - } else { - return ''; - } - }, - }, - { - key: "toText", - value: function toText() { - if (this.character) { - return this.character; - } else { - return " "; - } - }, - }, - ]); - })(); - var mathMLTree = { - MathNode: MathNode, - TextNode: TextNode, - SpaceNode: SpaceNode, - newDocumentFragment: newDocumentFragment, - }; - var makeText = function makeText(text, mode, options) { - if ( - symbols[mode][text] && - symbols[mode][text].replace && - text.charCodeAt(0) !== 55349 && - !( - ligatures.hasOwnProperty(text) && - options && - ((options.fontFamily && options.fontFamily.slice(4, 6) === "tt") || - (options.font && options.font.slice(4, 6) === "tt")) - ) - ) { - text = symbols[mode][text].replace; - } - return new mathMLTree.TextNode(text); - }; - var makeRow = function makeRow(body) { - if (body.length === 1) { - return body[0]; - } else { - return new mathMLTree.MathNode("mrow", body); - } - }; - var getVariant = function getVariant(group, options) { - if (options.fontFamily === "texttt") { - return "monospace"; - } else if (options.fontFamily === "textsf") { - if (options.fontShape === "textit" && options.fontWeight === "textbf") { - return "sans-serif-bold-italic"; - } else if (options.fontShape === "textit") { - return "sans-serif-italic"; - } else if (options.fontWeight === "textbf") { - return "bold-sans-serif"; - } else { - return "sans-serif"; - } - } else if ( - options.fontShape === "textit" && - options.fontWeight === "textbf" - ) { - return "bold-italic"; - } else if (options.fontShape === "textit") { - return "italic"; - } else if (options.fontWeight === "textbf") { - return "bold"; - } - var font = options.font; - if (!font || font === "mathnormal") { - return null; - } - var mode = group.mode; - if (font === "mathit") { - return "italic"; - } else if (font === "boldsymbol") { - return group.type === "textord" ? "bold" : "bold-italic"; - } else if (font === "mathbf") { - return "bold"; - } else if (font === "mathbb") { - return "double-struck"; - } else if (font === "mathsfit") { - return "sans-serif-italic"; - } else if (font === "mathfrak") { - return "fraktur"; - } else if (font === "mathscr" || font === "mathcal") { - return "script"; - } else if (font === "mathsf") { - return "sans-serif"; - } else if (font === "mathtt") { - return "monospace"; - } - var text = group.text; - if (utils.contains(["\\imath", "\\jmath"], text)) { - return null; - } - if (symbols[mode][text] && symbols[mode][text].replace) { - text = symbols[mode][text].replace; - } - var fontName = buildCommon.fontMap[font].fontName; - if (getCharacterMetrics(text, fontName, mode)) { - return buildCommon.fontMap[font].variant; - } - return null; - }; - function isNumberPunctuation(group) { - if (!group) { - return false; - } - if (group.type === "mi" && group.children.length === 1) { - var child = group.children[0]; - return child instanceof TextNode && child.text === "."; - } else if ( - group.type === "mo" && - group.children.length === 1 && - group.getAttribute("separator") === "true" && - group.getAttribute("lspace") === "0em" && - group.getAttribute("rspace") === "0em" - ) { - var _child = group.children[0]; - return _child instanceof TextNode && _child.text === ","; - } else { - return false; - } - } - var buildExpression = function buildExpression( - expression, - options, - isOrdgroup, - ) { - if (expression.length === 1) { - var group = buildGroup(expression[0], options); - if (isOrdgroup && group instanceof MathNode && group.type === "mo") { - group.setAttribute("lspace", "0em"); - group.setAttribute("rspace", "0em"); - } - return [group]; - } - var groups = []; - var lastGroup; - for (var i = 0; i < expression.length; i++) { - var _group = buildGroup(expression[i], options); - if (_group instanceof MathNode && lastGroup instanceof MathNode) { - if ( - _group.type === "mtext" && - lastGroup.type === "mtext" && - _group.getAttribute("mathvariant") === - lastGroup.getAttribute("mathvariant") - ) { - var _lastGroup$children; - (_lastGroup$children = lastGroup.children).push.apply( - _lastGroup$children, - _toConsumableArray(_group.children), - ); - continue; - } else if (_group.type === "mn" && lastGroup.type === "mn") { - var _lastGroup$children2; - (_lastGroup$children2 = lastGroup.children).push.apply( - _lastGroup$children2, - _toConsumableArray(_group.children), - ); - continue; - } else if (isNumberPunctuation(_group) && lastGroup.type === "mn") { - var _lastGroup$children3; - (_lastGroup$children3 = lastGroup.children).push.apply( - _lastGroup$children3, - _toConsumableArray(_group.children), - ); - continue; - } else if (_group.type === "mn" && isNumberPunctuation(lastGroup)) { - _group.children = [].concat( - _toConsumableArray(lastGroup.children), - _toConsumableArray(_group.children), - ); - groups.pop(); - } else if ( - (_group.type === "msup" || _group.type === "msub") && - _group.children.length >= 1 && - (lastGroup.type === "mn" || isNumberPunctuation(lastGroup)) - ) { - var base = _group.children[0]; - if (base instanceof MathNode && base.type === "mn") { - base.children = [].concat( - _toConsumableArray(lastGroup.children), - _toConsumableArray(base.children), - ); - groups.pop(); - } - } else if (lastGroup.type === "mi" && lastGroup.children.length === 1) { - var lastChild = lastGroup.children[0]; - if ( - lastChild instanceof TextNode && - lastChild.text === "\u0338" && - (_group.type === "mo" || - _group.type === "mi" || - _group.type === "mn") - ) { - var child = _group.children[0]; - if (child instanceof TextNode && child.text.length > 0) { - child.text = - child.text.slice(0, 1) + "\u0338" + child.text.slice(1); - groups.pop(); - } - } - } - } - groups.push(_group); - lastGroup = _group; - } - return groups; - }; - var buildExpressionRow = function buildExpressionRow( - expression, - options, - isOrdgroup, - ) { - return makeRow(buildExpression(expression, options, isOrdgroup)); - }; - var buildGroup = function buildGroup(group, options) { - if (!group) { - return new mathMLTree.MathNode("mrow"); - } - if (_mathmlGroupBuilders[group.type]) { - var result = _mathmlGroupBuilders[group.type](group, options); - return result; - } else { - throw new ParseError("Got group of unknown type: '" + group.type + "'"); - } - }; - function buildMathML( - tree, - texExpression, - options, - isDisplayMode, - forMathmlOnly, - ) { - var expression = buildExpression(tree, options); - var wrapper; - if ( - expression.length === 1 && - expression[0] instanceof MathNode && - utils.contains(["mrow", "mtable"], expression[0].type) - ) { - wrapper = expression[0]; - } else { - wrapper = new mathMLTree.MathNode("mrow", expression); - } - var annotation = new mathMLTree.MathNode("annotation", [ - new mathMLTree.TextNode(texExpression), - ]); - annotation.setAttribute("encoding", "application/x-tex"); - var semantics = new mathMLTree.MathNode("semantics", [wrapper, annotation]); - var math = new mathMLTree.MathNode("math", [semantics]); - math.setAttribute("xmlns", "http://www.w3.org/1998/Math/MathML"); - if (isDisplayMode) { - math.setAttribute("display", "block"); - } - var wrapperClass = forMathmlOnly ? "katex" : "katex-mathml"; - return buildCommon.makeSpan([wrapperClass], [math]); - } - var optionsFromSettings = function optionsFromSettings(settings) { - return new Options({ - style: settings.displayMode ? Style$1.DISPLAY : Style$1.TEXT, - maxSize: settings.maxSize, - minRuleThickness: settings.minRuleThickness, - }); - }; - var displayWrap = function displayWrap(node, settings) { - if (settings.displayMode) { - var classes = ["katex-display"]; - if (settings.leqno) { - classes.push("leqno"); - } - if (settings.fleqn) { - classes.push("fleqn"); - } - node = buildCommon.makeSpan(classes, [node]); - } - return node; - }; - var buildTree = function buildTree(tree, expression, settings) { - var options = optionsFromSettings(settings); - var katexNode; - if (settings.output === "mathml") { - return buildMathML(tree, expression, options, settings.displayMode, true); - } else if (settings.output === "html") { - var htmlNode = buildHTML(tree, options); - katexNode = buildCommon.makeSpan(["katex"], [htmlNode]); - } else { - var mathMLNode = buildMathML( - tree, - expression, - options, - settings.displayMode, - false, - ); - var _htmlNode = buildHTML(tree, options); - katexNode = buildCommon.makeSpan(["katex"], [mathMLNode, _htmlNode]); - } - return displayWrap(katexNode, settings); - }; - var stretchyCodePoint = { - widehat: "^", - widecheck: "\u02C7", - widetilde: "~", - utilde: "~", - overleftarrow: "\u2190", - underleftarrow: "\u2190", - xleftarrow: "\u2190", - overrightarrow: "\u2192", - underrightarrow: "\u2192", - xrightarrow: "\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", - xleftrightharpoons: "\u21CB", - xtwoheadleftarrow: "\u219E", - xtwoheadrightarrow: "\u21A0", - xlongequal: "=", - xtofrom: "\u21C4", - xrightleftarrows: "\u21C4", - xrightequilibrium: "\u21CC", - xleftequilibrium: "\u21CB", - "\\cdrightarrow": "\u2192", - "\\cdleftarrow": "\u2190", - "\\cdlongequal": "=", - }; - var mathMLnode = function mathMLnode(label) { - var node = new mathMLTree.MathNode("mo", [ - new mathMLTree.TextNode(stretchyCodePoint[label.replace(/^\\/, "")]), - ]); - node.setAttribute("stretchy", "true"); - return node; - }; - var katexImagesData = { - 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"], - "\\cdrightarrow": [["rightarrow"], 3, 522, "xMaxYMin"], - xleftarrow: [["leftarrow"], 1.469, 522, "xMinYMin"], - "\\cdleftarrow": [["leftarrow"], 3, 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"], - "\\cdlongequal": [["longequal"], 3, 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], - xLeftrightarrow: [["doubleleftarrow", "doublerightarrow"], 1.75, 560], - xrightleftharpoons: [ - ["leftharpoondownplus", "rightharpoonplus"], - 1.75, - 716, - ], - xleftrightharpoons: [ - ["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], - xrightleftarrows: [["baraboveleftarrow", "rightarrowabovebar"], 1.75, 901], - xrightequilibrium: [ - ["baraboveshortleftharpoon", "rightharpoonaboveshortbar"], - 1.75, - 716, - ], - xleftequilibrium: [ - ["shortbaraboveleftharpoon", "shortrightharpoonabovebar"], - 1.75, - 716, - ], - }; - var groupLength = function groupLength(arg) { - if (arg.type === "ordgroup") { - return arg.body.length; - } else { - return 1; - } - }; - var svgSpan = function svgSpan(group, options) { - function buildSvgSpan_() { - var viewBoxWidth = 400000; - var label = group.label.slice(1); - if ( - utils.contains(["widehat", "widecheck", "widetilde", "utilde"], label) - ) { - var grp = group; - var numChars = groupLength(grp.base); - var viewBoxHeight; - var pathName; - var _height; - if (numChars > 5) { - if (label === "widehat" || label === "widecheck") { - viewBoxHeight = 420; - viewBoxWidth = 2364; - _height = 0.42; - pathName = label + "4"; - } else { - viewBoxHeight = 312; - viewBoxWidth = 2340; - _height = 0.34; - pathName = "tilde4"; - } - } else { - var imgIndex = [1, 1, 2, 2, 3, 3][numChars]; - if (label === "widehat" || label === "widecheck") { - viewBoxWidth = [0, 1062, 2364, 2364, 2364][imgIndex]; - viewBoxHeight = [0, 239, 300, 360, 420][imgIndex]; - _height = [0, 0.24, 0.3, 0.3, 0.36, 0.42][imgIndex]; - pathName = label + imgIndex; - } else { - viewBoxWidth = [0, 600, 1033, 2339, 2340][imgIndex]; - viewBoxHeight = [0, 260, 286, 306, 312][imgIndex]; - _height = [0, 0.26, 0.286, 0.3, 0.306, 0.34][imgIndex]; - pathName = "tilde" + imgIndex; - } - } - var path = new PathNode(pathName); - var svgNode = new SvgNode([path], { - width: "100%", - height: makeEm(_height), - viewBox: "0 0 " + viewBoxWidth + " " + viewBoxHeight, - preserveAspectRatio: "none", - }); - return { - span: buildCommon.makeSvgSpan([], [svgNode], options), - minWidth: 0, - height: _height, - }; - } else { - var spans = []; - var data = katexImagesData[label]; - var _data = _slicedToArray(data, 3), - paths = _data[0], - _minWidth = _data[1], - _viewBoxHeight = _data[2]; - var _height2 = _viewBoxHeight / 1000; - var numSvgChildren = paths.length; - var widthClasses; - var aligns; - if (numSvgChildren === 1) { - var align1 = data[3]; - widthClasses = ["hide-tail"]; - aligns = [align1]; - } else if (numSvgChildren === 2) { - widthClasses = ["halfarrow-left", "halfarrow-right"]; - aligns = ["xMinYMin", "xMaxYMin"]; - } else if (numSvgChildren === 3) { - widthClasses = ["brace-left", "brace-center", "brace-right"]; - aligns = ["xMinYMin", "xMidYMin", "xMaxYMin"]; - } else { - throw new Error( - "Correct katexImagesData or update code here to support\n " + - numSvgChildren + - " children.", - ); - } - for (var i = 0; i < numSvgChildren; i++) { - var _path = new PathNode(paths[i]); - var _svgNode = new SvgNode([_path], { - width: "400em", - height: makeEm(_height2), - viewBox: "0 0 " + viewBoxWidth + " " + _viewBoxHeight, - preserveAspectRatio: aligns[i] + " slice", - }); - var _span = buildCommon.makeSvgSpan( - [widthClasses[i]], - [_svgNode], - options, - ); - if (numSvgChildren === 1) { - return { span: _span, minWidth: _minWidth, height: _height2 }; - } else { - _span.style.height = makeEm(_height2); - spans.push(_span); - } - } - return { - span: buildCommon.makeSpan(["stretchy"], spans, options), - minWidth: _minWidth, - height: _height2, - }; - } - } - var _buildSvgSpan_ = buildSvgSpan_(), - span = _buildSvgSpan_.span, - minWidth = _buildSvgSpan_.minWidth, - height = _buildSvgSpan_.height; - span.height = height; - span.style.height = makeEm(height); - if (minWidth > 0) { - span.style.minWidth = makeEm(minWidth); - } - return span; - }; - var encloseSpan = function encloseSpan( - inner, - label, - topPad, - bottomPad, - options, - ) { - var img; - var totalHeight = inner.height + inner.depth + topPad + bottomPad; - if (/fbox|color|angl/.test(label)) { - img = buildCommon.makeSpan(["stretchy", label], [], options); - if (label === "fbox") { - var color = options.color && options.getColor(); - if (color) { - img.style.borderColor = color; - } - } - } else { - var lines = []; - if (/^[bx]cancel$/.test(label)) { - lines.push( - new LineNode({ - x1: "0", - y1: "0", - x2: "100%", - y2: "100%", - "stroke-width": "0.046em", - }), - ); - } - if (/^x?cancel$/.test(label)) { - lines.push( - new LineNode({ - x1: "0", - y1: "100%", - x2: "100%", - y2: "0", - "stroke-width": "0.046em", - }), - ); - } - var svgNode = new SvgNode(lines, { - width: "100%", - height: makeEm(totalHeight), - }); - img = buildCommon.makeSvgSpan([], [svgNode], options); - } - img.height = totalHeight; - img.style.height = makeEm(totalHeight); - return img; - }; - var stretchy = { - encloseSpan: encloseSpan, - mathMLnode: mathMLnode, - svgSpan: svgSpan, - }; - function assertNodeType(node, type) { - if (!node || node.type !== type) { - throw new Error( - "Expected node of type " + - type + - ", but got " + - (node ? "node of type " + node.type : String(node)), - ); - } - return node; - } - function assertSymbolNodeType(node) { - var typedNode = checkSymbolNodeType(node); - if (!typedNode) { - throw new Error( - "Expected node of symbol group type, but got " + - (node ? "node of type " + node.type : String(node)), - ); - } - return typedNode; - } - function checkSymbolNodeType(node) { - if (node && (node.type === "atom" || NON_ATOMS.hasOwnProperty(node.type))) { - return node; - } - return null; - } - var htmlBuilder$a = function htmlBuilder$a(grp, options) { - var base; - var group; - var supSubGroup; - if (grp && grp.type === "supsub") { - group = assertNodeType(grp.base, "accent"); - base = group.base; - grp.base = base; - supSubGroup = assertSpan(buildGroup$1(grp, options)); - grp.base = group; - } else { - group = assertNodeType(grp, "accent"); - base = group.base; - } - var body = buildGroup$1(base, options.havingCrampedStyle()); - var mustShift = group.isShifty && utils.isCharacterBox(base); - var skew = 0; - if (mustShift) { - var baseChar = utils.getBaseElem(base); - var baseGroup = buildGroup$1(baseChar, options.havingCrampedStyle()); - skew = assertSymbolDomNode(baseGroup).skew; - } - var accentBelow = group.label === "\\c"; - var clearance = accentBelow - ? body.height + body.depth - : Math.min(body.height, options.fontMetrics().xHeight); - var accentBody; - if (!group.isStretchy) { - var accent; - var width; - if (group.label === "\\vec") { - accent = buildCommon.staticSvg("vec", options); - width = buildCommon.svgData.vec[1]; - } else { - accent = buildCommon.makeOrd( - { mode: group.mode, text: group.label }, - options, - "textord", - ); - accent = assertSymbolDomNode(accent); - accent.italic = 0; - width = accent.width; - if (accentBelow) { - clearance += accent.depth; - } - } - accentBody = buildCommon.makeSpan(["accent-body"], [accent]); - var accentFull = group.label === "\\textcircled"; - if (accentFull) { - accentBody.classes.push("accent-full"); - clearance = body.height; - } - var left = skew; - if (!accentFull) { - left -= width / 2; - } - accentBody.style.left = makeEm(left); - if (group.label === "\\textcircled") { - accentBody.style.top = ".2em"; - } - accentBody = buildCommon.makeVList( - { - positionType: "firstBaseline", - children: [ - { type: "elem", elem: body }, - { type: "kern", size: -clearance }, - { type: "elem", elem: accentBody }, - ], - }, - options, - ); - } else { - accentBody = stretchy.svgSpan(group, options); - accentBody = buildCommon.makeVList( - { - positionType: "firstBaseline", - children: [ - { type: "elem", elem: body }, - { - type: "elem", - elem: accentBody, - wrapperClasses: ["svg-align"], - wrapperStyle: - skew > 0 - ? { - width: "calc(100% - " + makeEm(2 * skew) + ")", - marginLeft: makeEm(2 * skew), - } - : undefined, - }, - ], - }, - options, - ); - } - var accentWrap = buildCommon.makeSpan( - ["mord", "accent"], - [accentBody], - options, - ); - if (supSubGroup) { - supSubGroup.children[0] = accentWrap; - supSubGroup.height = Math.max(accentWrap.height, supSubGroup.height); - supSubGroup.classes[0] = "mord"; - return supSubGroup; - } else { - return accentWrap; - } - }; - var mathmlBuilder$9 = function mathmlBuilder$9(group, options) { - var accentNode = group.isStretchy - ? stretchy.mathMLnode(group.label) - : new mathMLTree.MathNode("mo", [makeText(group.label, group.mode)]); - var node = new mathMLTree.MathNode("mover", [ - buildGroup(group.base, options), - accentNode, - ]); - node.setAttribute("accent", "true"); - return node; - }; - var NON_STRETCHY_ACCENT_REGEX = new RegExp( - [ - "\\acute", - "\\grave", - "\\ddot", - "\\tilde", - "\\bar", - "\\breve", - "\\check", - "\\hat", - "\\vec", - "\\dot", - "\\mathring", - ] - .map(function (accent) { - return "\\" + accent; - }) - .join("|"), - ); - defineFunction({ - type: "accent", - names: [ - "\\acute", - "\\grave", - "\\ddot", - "\\tilde", - "\\bar", - "\\breve", - "\\check", - "\\hat", - "\\vec", - "\\dot", - "\\mathring", - "\\widecheck", - "\\widehat", - "\\widetilde", - "\\overrightarrow", - "\\overleftarrow", - "\\Overrightarrow", - "\\overleftrightarrow", - "\\overgroup", - "\\overlinesegment", - "\\overleftharpoon", - "\\overrightharpoon", - ], - props: { numArgs: 1 }, - handler: function handler(context, args) { - var base = normalizeArgument(args[0]); - var isStretchy = !NON_STRETCHY_ACCENT_REGEX.test(context.funcName); - var isShifty = - !isStretchy || - context.funcName === "\\widehat" || - context.funcName === "\\widetilde" || - context.funcName === "\\widecheck"; - return { - type: "accent", - mode: context.parser.mode, - label: context.funcName, - isStretchy: isStretchy, - isShifty: isShifty, - base: base, - }; - }, - htmlBuilder: htmlBuilder$a, - mathmlBuilder: mathmlBuilder$9, - }); - defineFunction({ - type: "accent", - names: [ - "\\'", - "\\`", - "\\^", - "\\~", - "\\=", - "\\u", - "\\.", - '\\"', - "\\c", - "\\r", - "\\H", - "\\v", - "\\textcircled", - ], - props: { - numArgs: 1, - allowedInText: true, - allowedInMath: true, - argTypes: ["primitive"], - }, - handler: function handler(context, args) { - var base = args[0]; - var mode = context.parser.mode; - if (mode === "math") { - context.parser.settings.reportNonstrict( - "mathVsTextAccents", - "LaTeX's accent " + context.funcName + " works only in text mode", - ); - mode = "text"; - } - return { - type: "accent", - mode: mode, - label: context.funcName, - isStretchy: false, - isShifty: true, - base: base, - }; - }, - htmlBuilder: htmlBuilder$a, - mathmlBuilder: mathmlBuilder$9, - }); - defineFunction({ - type: "accentUnder", - names: [ - "\\underleftarrow", - "\\underrightarrow", - "\\underleftrightarrow", - "\\undergroup", - "\\underlinesegment", - "\\utilde", - ], - props: { numArgs: 1 }, - handler: function handler(_ref, args) { - var parser = _ref.parser, - funcName = _ref.funcName; - var base = args[0]; - return { - type: "accentUnder", - mode: parser.mode, - label: funcName, - base: base, - }; - }, - htmlBuilder: function htmlBuilder(group, options) { - var innerGroup = buildGroup$1(group.base, options); - var accentBody = stretchy.svgSpan(group, options); - var kern = group.label === "\\utilde" ? 0.12 : 0; - var vlist = buildCommon.makeVList( - { - positionType: "top", - positionData: innerGroup.height, - children: [ - { type: "elem", elem: accentBody, wrapperClasses: ["svg-align"] }, - { type: "kern", size: kern }, - { type: "elem", elem: innerGroup }, - ], - }, - options, - ); - return buildCommon.makeSpan(["mord", "accentunder"], [vlist], options); - }, - mathmlBuilder: function mathmlBuilder(group, options) { - var accentNode = stretchy.mathMLnode(group.label); - var node = new mathMLTree.MathNode("munder", [ - buildGroup(group.base, options), - accentNode, - ]); - node.setAttribute("accentunder", "true"); - return node; - }, - }); - var paddedNode = function paddedNode(group) { - var node = new mathMLTree.MathNode("mpadded", group ? [group] : []); - node.setAttribute("width", "+0.6em"); - node.setAttribute("lspace", "0.3em"); - return node; - }; - defineFunction({ - type: "xArrow", - names: [ - "\\xleftarrow", - "\\xrightarrow", - "\\xLeftarrow", - "\\xRightarrow", - "\\xleftrightarrow", - "\\xLeftrightarrow", - "\\xhookleftarrow", - "\\xhookrightarrow", - "\\xmapsto", - "\\xrightharpoondown", - "\\xrightharpoonup", - "\\xleftharpoondown", - "\\xleftharpoonup", - "\\xrightleftharpoons", - "\\xleftrightharpoons", - "\\xlongequal", - "\\xtwoheadrightarrow", - "\\xtwoheadleftarrow", - "\\xtofrom", - "\\xrightleftarrows", - "\\xrightequilibrium", - "\\xleftequilibrium", - "\\\\cdrightarrow", - "\\\\cdleftarrow", - "\\\\cdlongequal", - ], - props: { numArgs: 1, numOptionalArgs: 1 }, - handler: function handler(_ref, args, optArgs) { - var parser = _ref.parser, - funcName = _ref.funcName; - return { - type: "xArrow", - mode: parser.mode, - label: funcName, - body: args[0], - below: optArgs[0], - }; - }, - htmlBuilder: function htmlBuilder(group, options) { - var style = options.style; - var newOptions = options.havingStyle(style.sup()); - var upperGroup = buildCommon.wrapFragment( - buildGroup$1(group.body, newOptions, options), - options, - ); - var arrowPrefix = group.label.slice(0, 2) === "\\x" ? "x" : "cd"; - upperGroup.classes.push(arrowPrefix + "-arrow-pad"); - var lowerGroup; - if (group.below) { - newOptions = options.havingStyle(style.sub()); - lowerGroup = buildCommon.wrapFragment( - buildGroup$1(group.below, newOptions, options), - options, - ); - lowerGroup.classes.push(arrowPrefix + "-arrow-pad"); - } - var arrowBody = stretchy.svgSpan(group, options); - var arrowShift = - -options.fontMetrics().axisHeight + 0.5 * arrowBody.height; - var upperShift = - -options.fontMetrics().axisHeight - 0.5 * arrowBody.height - 0.111; - if (upperGroup.depth > 0.25 || group.label === "\\xleftequilibrium") { - upperShift -= upperGroup.depth; - } - var vlist; - if (lowerGroup) { - var lowerShift = - -options.fontMetrics().axisHeight + - lowerGroup.height + - 0.5 * arrowBody.height + - 0.111; - vlist = buildCommon.makeVList( - { - positionType: "individualShift", - children: [ - { type: "elem", elem: upperGroup, shift: upperShift }, - { type: "elem", elem: arrowBody, shift: arrowShift }, - { type: "elem", elem: lowerGroup, shift: lowerShift }, - ], - }, - options, - ); - } else { - vlist = buildCommon.makeVList( - { - positionType: "individualShift", - children: [ - { type: "elem", elem: upperGroup, shift: upperShift }, - { type: "elem", elem: arrowBody, shift: arrowShift }, - ], - }, - options, - ); - } - vlist.children[0].children[0].children[1].classes.push("svg-align"); - return buildCommon.makeSpan(["mrel", "x-arrow"], [vlist], options); - }, - mathmlBuilder: function mathmlBuilder(group, options) { - var arrowNode = stretchy.mathMLnode(group.label); - arrowNode.setAttribute( - "minsize", - group.label.charAt(0) === "x" ? "1.75em" : "3.0em", - ); - var node; - if (group.body) { - var upperNode = paddedNode(buildGroup(group.body, options)); - if (group.below) { - var lowerNode = paddedNode(buildGroup(group.below, options)); - node = new mathMLTree.MathNode("munderover", [ - arrowNode, - lowerNode, - upperNode, - ]); - } else { - node = new mathMLTree.MathNode("mover", [arrowNode, upperNode]); - } - } else if (group.below) { - var _lowerNode = paddedNode(buildGroup(group.below, options)); - node = new mathMLTree.MathNode("munder", [arrowNode, _lowerNode]); - } else { - node = paddedNode(); - node = new mathMLTree.MathNode("mover", [arrowNode, node]); - } - return node; - }, - }); - var makeSpan = buildCommon.makeSpan; - function htmlBuilder$9(group, options) { - var elements = buildExpression$1(group.body, options, true); - return makeSpan([group.mclass], elements, options); - } - function mathmlBuilder$8(group, options) { - var node; - var inner = buildExpression(group.body, options); - if (group.mclass === "minner") { - node = new mathMLTree.MathNode("mpadded", inner); - } else if (group.mclass === "mord") { - if (group.isCharacterBox) { - node = inner[0]; - node.type = "mi"; - } else { - node = new mathMLTree.MathNode("mi", inner); - } - } else { - if (group.isCharacterBox) { - node = inner[0]; - node.type = "mo"; - } else { - node = new mathMLTree.MathNode("mo", inner); - } - if (group.mclass === "mbin") { - node.attributes.lspace = "0.22em"; - node.attributes.rspace = "0.22em"; - } else if (group.mclass === "mpunct") { - node.attributes.lspace = "0em"; - node.attributes.rspace = "0.17em"; - } else if (group.mclass === "mopen" || group.mclass === "mclose") { - node.attributes.lspace = "0em"; - node.attributes.rspace = "0em"; - } else if (group.mclass === "minner") { - node.attributes.lspace = "0.0556em"; - node.attributes.width = "+0.1111em"; - } - } - return node; - } - defineFunction({ - type: "mclass", - names: [ - "\\mathord", - "\\mathbin", - "\\mathrel", - "\\mathopen", - "\\mathclose", - "\\mathpunct", - "\\mathinner", - ], - props: { numArgs: 1, primitive: true }, - handler: function handler(_ref, args) { - var parser = _ref.parser, - funcName = _ref.funcName; - var body = args[0]; - return { - type: "mclass", - mode: parser.mode, - mclass: "m" + funcName.slice(5), - body: ordargument(body), - isCharacterBox: utils.isCharacterBox(body), - }; - }, - htmlBuilder: htmlBuilder$9, - mathmlBuilder: mathmlBuilder$8, - }); - var binrelClass = function binrelClass(arg) { - var atom = arg.type === "ordgroup" && arg.body.length ? arg.body[0] : arg; - if ( - atom.type === "atom" && - (atom.family === "bin" || atom.family === "rel") - ) { - return "m" + atom.family; - } else { - return "mord"; - } - }; - defineFunction({ - type: "mclass", - names: ["\\@binrel"], - props: { numArgs: 2 }, - handler: function handler(_ref2, args) { - var parser = _ref2.parser; - return { - type: "mclass", - mode: parser.mode, - mclass: binrelClass(args[0]), - body: ordargument(args[1]), - isCharacterBox: utils.isCharacterBox(args[1]), - }; - }, - }); - defineFunction({ - type: "mclass", - names: ["\\stackrel", "\\overset", "\\underset"], - props: { numArgs: 2 }, - handler: function handler(_ref3, args) { - var parser = _ref3.parser, - funcName = _ref3.funcName; - var baseArg = args[1]; - var shiftedArg = args[0]; - var mclass; - if (funcName !== "\\stackrel") { - mclass = binrelClass(baseArg); - } else { - mclass = "mrel"; - } - var baseOp = { - type: "op", - mode: baseArg.mode, - limits: true, - alwaysHandleSupSub: true, - parentIsSupSub: false, - symbol: false, - suppressBaseShift: funcName !== "\\stackrel", - body: ordargument(baseArg), - }; - var supsub = { - type: "supsub", - mode: shiftedArg.mode, - base: baseOp, - sup: funcName === "\\underset" ? null : shiftedArg, - sub: funcName === "\\underset" ? shiftedArg : null, - }; - return { - type: "mclass", - mode: parser.mode, - mclass: mclass, - body: [supsub], - isCharacterBox: utils.isCharacterBox(supsub), - }; - }, - htmlBuilder: htmlBuilder$9, - mathmlBuilder: mathmlBuilder$8, - }); - defineFunction({ - type: "pmb", - names: ["\\pmb"], - props: { numArgs: 1, allowedInText: true }, - handler: function handler(_ref, args) { - var parser = _ref.parser; - return { - type: "pmb", - mode: parser.mode, - mclass: binrelClass(args[0]), - body: ordargument(args[0]), - }; - }, - htmlBuilder: function htmlBuilder(group, options) { - var elements = buildExpression$1(group.body, options, true); - var node = buildCommon.makeSpan([group.mclass], elements, options); - node.style.textShadow = "0.02em 0.01em 0.04px"; - return node; - }, - mathmlBuilder: function mathmlBuilder(group, style) { - var inner = buildExpression(group.body, style); - var node = new mathMLTree.MathNode("mstyle", inner); - node.setAttribute("style", "text-shadow: 0.02em 0.01em 0.04px"); - return node; - }, - }); - var cdArrowFunctionName = { - ">": "\\\\cdrightarrow", - "<": "\\\\cdleftarrow", - "=": "\\\\cdlongequal", - A: "\\uparrow", - V: "\\downarrow", - "|": "\\Vert", - ".": "no arrow", - }; - var newCell = function newCell() { - return { type: "styling", body: [], mode: "math", style: "display" }; - }; - var isStartOfArrow = function isStartOfArrow(node) { - return node.type === "textord" && node.text === "@"; - }; - var isLabelEnd = function isLabelEnd(node, endChar) { - return ( - (node.type === "mathord" || node.type === "atom") && node.text === endChar - ); - }; - function cdArrow(arrowChar, labels, parser) { - var funcName = cdArrowFunctionName[arrowChar]; - switch (funcName) { - case "\\\\cdrightarrow": - case "\\\\cdleftarrow": - return parser.callFunction(funcName, [labels[0]], [labels[1]]); - case "\\uparrow": - case "\\downarrow": { - var leftLabel = parser.callFunction("\\\\cdleft", [labels[0]], []); - var bareArrow = { - type: "atom", - text: funcName, - mode: "math", - family: "rel", - }; - var sizedArrow = parser.callFunction("\\Big", [bareArrow], []); - var rightLabel = parser.callFunction("\\\\cdright", [labels[1]], []); - var arrowGroup = { - type: "ordgroup", - mode: "math", - body: [leftLabel, sizedArrow, rightLabel], - }; - return parser.callFunction("\\\\cdparent", [arrowGroup], []); - } - case "\\\\cdlongequal": - return parser.callFunction("\\\\cdlongequal", [], []); - case "\\Vert": { - var arrow = { type: "textord", text: "\\Vert", mode: "math" }; - return parser.callFunction("\\Big", [arrow], []); - } - default: - return { type: "textord", text: " ", mode: "math" }; - } - } - function parseCD(parser) { - var parsedRows = []; - parser.gullet.beginGroup(); - parser.gullet.macros.set("\\cr", "\\\\\\relax"); - parser.gullet.beginGroup(); - while (true) { - parsedRows.push(parser.parseExpression(false, "\\\\")); - parser.gullet.endGroup(); - parser.gullet.beginGroup(); - var next = parser.fetch().text; - if (next === "&" || next === "\\\\") { - parser.consume(); - } else if (next === "\\end") { - if (parsedRows[parsedRows.length - 1].length === 0) { - parsedRows.pop(); - } - break; - } else { - throw new ParseError( - "Expected \\\\ or \\cr or \\end", - parser.nextToken, - ); - } - } - var row = []; - var body = [row]; - for (var i = 0; i < parsedRows.length; i++) { - var rowNodes = parsedRows[i]; - var cell = newCell(); - for (var j = 0; j < rowNodes.length; j++) { - if (!isStartOfArrow(rowNodes[j])) { - cell.body.push(rowNodes[j]); - } else { - row.push(cell); - j += 1; - var arrowChar = assertSymbolNodeType(rowNodes[j]).text; - var labels = new Array(2); - labels[0] = { type: "ordgroup", mode: "math", body: [] }; - labels[1] = { type: "ordgroup", mode: "math", body: [] }; - if ("=|.".indexOf(arrowChar) > -1); - else if ("<>AV".indexOf(arrowChar) > -1) { - for (var labelNum = 0; labelNum < 2; labelNum++) { - var inLabel = true; - for (var k = j + 1; k < rowNodes.length; k++) { - if (isLabelEnd(rowNodes[k], arrowChar)) { - inLabel = false; - j = k; - break; - } - if (isStartOfArrow(rowNodes[k])) { - throw new ParseError( - "Missing a " + - arrowChar + - " character to complete a CD arrow.", - rowNodes[k], - ); - } - labels[labelNum].body.push(rowNodes[k]); - } - if (inLabel) { - throw new ParseError( - "Missing a " + - arrowChar + - " character to complete a CD arrow.", - rowNodes[j], - ); - } - } - } else { - throw new ParseError( - 'Expected one of "<>AV=|." after @', - rowNodes[j], - ); - } - var arrow = cdArrow(arrowChar, labels, parser); - var wrappedArrow = { - type: "styling", - body: [arrow], - mode: "math", - style: "display", - }; - row.push(wrappedArrow); - cell = newCell(); - } - } - if (i % 2 === 0) { - row.push(cell); - } else { - row.shift(); - } - row = []; - body.push(row); - } - parser.gullet.endGroup(); - parser.gullet.endGroup(); - var cols = new Array(body[0].length).fill({ - type: "align", - align: "c", - pregap: 0.25, - postgap: 0.25, - }); - return { - type: "array", - mode: "math", - body: body, - arraystretch: 1, - addJot: true, - rowGaps: [null], - cols: cols, - colSeparationType: "CD", - hLinesBeforeRow: new Array(body.length + 1).fill([]), - }; - } - defineFunction({ - type: "cdlabel", - names: ["\\\\cdleft", "\\\\cdright"], - props: { numArgs: 1 }, - handler: function handler(_ref, args) { - var parser = _ref.parser, - funcName = _ref.funcName; - return { - type: "cdlabel", - mode: parser.mode, - side: funcName.slice(4), - label: args[0], - }; - }, - htmlBuilder: function htmlBuilder(group, options) { - var newOptions = options.havingStyle(options.style.sup()); - var label = buildCommon.wrapFragment( - buildGroup$1(group.label, newOptions, options), - options, - ); - label.classes.push("cd-label-" + group.side); - label.style.bottom = makeEm(0.8 - label.depth); - label.height = 0; - label.depth = 0; - return label; - }, - mathmlBuilder: function mathmlBuilder(group, options) { - var label = new mathMLTree.MathNode("mrow", [ - buildGroup(group.label, options), - ]); - label = new mathMLTree.MathNode("mpadded", [label]); - label.setAttribute("width", "0"); - if (group.side === "left") { - label.setAttribute("lspace", "-1width"); - } - label.setAttribute("voffset", "0.7em"); - label = new mathMLTree.MathNode("mstyle", [label]); - label.setAttribute("displaystyle", "false"); - label.setAttribute("scriptlevel", "1"); - return label; - }, - }); - defineFunction({ - type: "cdlabelparent", - names: ["\\\\cdparent"], - props: { numArgs: 1 }, - handler: function handler(_ref2, args) { - var parser = _ref2.parser; - return { type: "cdlabelparent", mode: parser.mode, fragment: args[0] }; - }, - htmlBuilder: function htmlBuilder(group, options) { - var parent = buildCommon.wrapFragment( - buildGroup$1(group.fragment, options), - options, - ); - parent.classes.push("cd-vert-arrow"); - return parent; - }, - mathmlBuilder: function mathmlBuilder(group, options) { - return new mathMLTree.MathNode("mrow", [ - buildGroup(group.fragment, options), - ]); - }, - }); - defineFunction({ - type: "textord", - names: ["\\@char"], - props: { numArgs: 1, allowedInText: true }, - handler: function handler(_ref, args) { - var parser = _ref.parser; - var arg = assertNodeType(args[0], "ordgroup"); - var group = arg.body; - var number = ""; - for (var i = 0; i < group.length; i++) { - var node = assertNodeType(group[i], "textord"); - number += node.text; - } - var code = parseInt(number); - var text; - if (isNaN(code)) { - throw new ParseError("\\@char has non-numeric argument " + number); - } else if (code < 0 || code >= 1114111) { - throw new ParseError("\\@char with invalid code point " + number); - } else if (code <= 65535) { - text = String.fromCharCode(code); - } else { - code -= 65536; - text = String.fromCharCode((code >> 10) + 55296, (code & 1023) + 56320); - } - return { type: "textord", mode: parser.mode, text: text }; - }, - }); - var htmlBuilder$8 = function htmlBuilder$8(group, options) { - var elements = buildExpression$1( - group.body, - options.withColor(group.color), - false, - ); - return buildCommon.makeFragment(elements); - }; - var mathmlBuilder$7 = function mathmlBuilder$7(group, options) { - var inner = buildExpression(group.body, options.withColor(group.color)); - var node = new mathMLTree.MathNode("mstyle", inner); - node.setAttribute("mathcolor", group.color); - return node; - }; - defineFunction({ - type: "color", - names: ["\\textcolor"], - props: { numArgs: 2, allowedInText: true, argTypes: ["color", "original"] }, - handler: function handler(_ref, args) { - var parser = _ref.parser; - var color = assertNodeType(args[0], "color-token").color; - var body = args[1]; - return { - type: "color", - mode: parser.mode, - color: color, - body: ordargument(body), - }; - }, - htmlBuilder: htmlBuilder$8, - mathmlBuilder: mathmlBuilder$7, - }); - defineFunction({ - type: "color", - names: ["\\color"], - props: { numArgs: 1, allowedInText: true, argTypes: ["color"] }, - handler: function handler(_ref2, args) { - var parser = _ref2.parser, - breakOnTokenText = _ref2.breakOnTokenText; - var color = assertNodeType(args[0], "color-token").color; - parser.gullet.macros.set("\\current@color", color); - var body = parser.parseExpression(true, breakOnTokenText); - return { type: "color", mode: parser.mode, color: color, body: body }; - }, - htmlBuilder: htmlBuilder$8, - mathmlBuilder: mathmlBuilder$7, - }); - defineFunction({ - type: "cr", - names: ["\\\\"], - props: { numArgs: 0, numOptionalArgs: 0, allowedInText: true }, - handler: function handler(_ref, args, optArgs) { - var parser = _ref.parser; - var size = - parser.gullet.future().text === "[" - ? parser.parseSizeGroup(true) - : null; - var newLine = - !parser.settings.displayMode || - !parser.settings.useStrictBehavior( - "newLineInDisplayMode", - "In LaTeX, \\\\ or \\newline " + "does nothing in display mode", - ); - return { - type: "cr", - mode: parser.mode, - newLine: newLine, - size: size && assertNodeType(size, "size").value, - }; - }, - htmlBuilder: function htmlBuilder(group, options) { - var span = buildCommon.makeSpan(["mspace"], [], options); - if (group.newLine) { - span.classes.push("newline"); - if (group.size) { - span.style.marginTop = makeEm(calculateSize(group.size, options)); - } - } - return span; - }, - mathmlBuilder: function mathmlBuilder(group, options) { - var node = new mathMLTree.MathNode("mspace"); - if (group.newLine) { - node.setAttribute("linebreak", "newline"); - if (group.size) { - node.setAttribute( - "height", - makeEm(calculateSize(group.size, options)), - ); - } - } - return node; - }, - }); - var globalMap = { - "\\global": "\\global", - "\\long": "\\\\globallong", - "\\\\globallong": "\\\\globallong", - "\\def": "\\gdef", - "\\gdef": "\\gdef", - "\\edef": "\\xdef", - "\\xdef": "\\xdef", - "\\let": "\\\\globallet", - "\\futurelet": "\\\\globalfuture", - }; - var checkControlSequence = function checkControlSequence(tok) { - var name = tok.text; - if (/^(?:[\\{}$&#^_]|EOF)$/.test(name)) { - throw new ParseError("Expected a control sequence", tok); - } - return name; - }; - var getRHS = function getRHS(parser) { - var tok = parser.gullet.popToken(); - if (tok.text === "=") { - tok = parser.gullet.popToken(); - if (tok.text === " ") { - tok = parser.gullet.popToken(); - } - } - return tok; - }; - var letCommand = function letCommand(parser, name, tok, global) { - var macro = parser.gullet.macros.get(tok.text); - if (macro == null) { - tok.noexpand = true; - macro = { - tokens: [tok], - numArgs: 0, - unexpandable: !parser.gullet.isExpandable(tok.text), - }; - } - parser.gullet.macros.set(name, macro, global); - }; - defineFunction({ - type: "internal", - names: ["\\global", "\\long", "\\\\globallong"], - props: { numArgs: 0, allowedInText: true }, - handler: function handler(_ref) { - var parser = _ref.parser, - funcName = _ref.funcName; - parser.consumeSpaces(); - var token = parser.fetch(); - if (globalMap[token.text]) { - if (funcName === "\\global" || funcName === "\\\\globallong") { - token.text = globalMap[token.text]; - } - return assertNodeType(parser.parseFunction(), "internal"); - } - throw new ParseError("Invalid token after macro prefix", token); - }, - }); - defineFunction({ - type: "internal", - names: ["\\def", "\\gdef", "\\edef", "\\xdef"], - props: { numArgs: 0, allowedInText: true, primitive: true }, - handler: function handler(_ref2) { - var parser = _ref2.parser, - funcName = _ref2.funcName; - var tok = parser.gullet.popToken(); - var name = tok.text; - if (/^(?:[\\{}$&#^_]|EOF)$/.test(name)) { - throw new ParseError("Expected a control sequence", tok); - } - var numArgs = 0; - var insert; - var delimiters = [[]]; - while (parser.gullet.future().text !== "{") { - tok = parser.gullet.popToken(); - if (tok.text === "#") { - if (parser.gullet.future().text === "{") { - insert = parser.gullet.future(); - delimiters[numArgs].push("{"); - break; - } - tok = parser.gullet.popToken(); - if (!/^[1-9]$/.test(tok.text)) { - throw new ParseError('Invalid argument number "' + tok.text + '"'); - } - if (parseInt(tok.text) !== numArgs + 1) { - throw new ParseError( - 'Argument number "' + tok.text + '" out of order', - ); - } - numArgs++; - delimiters.push([]); - } else if (tok.text === "EOF") { - throw new ParseError("Expected a macro definition"); - } else { - delimiters[numArgs].push(tok.text); - } - } - var _parser$gullet$consum = parser.gullet.consumeArg(), - tokens = _parser$gullet$consum.tokens; - if (insert) { - tokens.unshift(insert); - } - if (funcName === "\\edef" || funcName === "\\xdef") { - tokens = parser.gullet.expandTokens(tokens); - tokens.reverse(); - } - parser.gullet.macros.set( - name, - { tokens: tokens, numArgs: numArgs, delimiters: delimiters }, - funcName === globalMap[funcName], - ); - return { type: "internal", mode: parser.mode }; - }, - }); - defineFunction({ - type: "internal", - names: ["\\let", "\\\\globallet"], - props: { numArgs: 0, allowedInText: true, primitive: true }, - handler: function handler(_ref3) { - var parser = _ref3.parser, - funcName = _ref3.funcName; - var name = checkControlSequence(parser.gullet.popToken()); - parser.gullet.consumeSpaces(); - var tok = getRHS(parser); - letCommand(parser, name, tok, funcName === "\\\\globallet"); - return { type: "internal", mode: parser.mode }; - }, - }); - defineFunction({ - type: "internal", - names: ["\\futurelet", "\\\\globalfuture"], - props: { numArgs: 0, allowedInText: true, primitive: true }, - handler: function handler(_ref4) { - var parser = _ref4.parser, - funcName = _ref4.funcName; - var name = checkControlSequence(parser.gullet.popToken()); - var middle = parser.gullet.popToken(); - var tok = parser.gullet.popToken(); - letCommand(parser, name, tok, funcName === "\\\\globalfuture"); - parser.gullet.pushToken(tok); - parser.gullet.pushToken(middle); - return { type: "internal", mode: parser.mode }; - }, - }); - var getMetrics = function getMetrics(symbol, font, mode) { - var replace = symbols.math[symbol] && symbols.math[symbol].replace; - var metrics = getCharacterMetrics(replace || symbol, font, mode); - if (!metrics) { - throw new Error( - "Unsupported symbol " + symbol + " and font size " + font + ".", - ); - } - return metrics; - }; - var styleWrap = function styleWrap(delim, toStyle, options, classes) { - var newOptions = options.havingBaseStyle(toStyle); - var span = buildCommon.makeSpan( - classes.concat(newOptions.sizingClasses(options)), - [delim], - options, - ); - var delimSizeMultiplier = - newOptions.sizeMultiplier / options.sizeMultiplier; - span.height *= delimSizeMultiplier; - span.depth *= delimSizeMultiplier; - span.maxFontSize = newOptions.sizeMultiplier; - return span; - }; - var centerSpan = function centerSpan(span, options, style) { - var newOptions = options.havingBaseStyle(style); - var shift = - (1 - options.sizeMultiplier / newOptions.sizeMultiplier) * - options.fontMetrics().axisHeight; - span.classes.push("delimcenter"); - span.style.top = makeEm(shift); - span.height -= shift; - span.depth += shift; - }; - var makeSmallDelim = function makeSmallDelim( - delim, - style, - center, - options, - mode, - classes, - ) { - var text = buildCommon.makeSymbol(delim, "Main-Regular", mode, options); - var span = styleWrap(text, style, options, classes); - if (center) { - centerSpan(span, options, style); - } - return span; - }; - var mathrmSize = function mathrmSize(value, size, mode, options) { - return buildCommon.makeSymbol( - value, - "Size" + size + "-Regular", - mode, - options, - ); - }; - var makeLargeDelim = function makeLargeDelim( - delim, - size, - center, - options, - mode, - classes, - ) { - var inner = mathrmSize(delim, size, mode, options); - var span = styleWrap( - buildCommon.makeSpan(["delimsizing", "size" + size], [inner], options), - Style$1.TEXT, - options, - classes, - ); - if (center) { - centerSpan(span, options, Style$1.TEXT); - } - return span; - }; - var makeGlyphSpan = function makeGlyphSpan(symbol, font, mode) { - var sizeClass; - if (font === "Size1-Regular") { - sizeClass = "delim-size1"; - } else { - sizeClass = "delim-size4"; - } - var corner = buildCommon.makeSpan( - ["delimsizinginner", sizeClass], - [buildCommon.makeSpan([], [buildCommon.makeSymbol(symbol, font, mode)])], - ); - return { type: "elem", elem: corner }; - }; - var makeInner = function makeInner(ch, height, options) { - var width = fontMetricsData["Size4-Regular"][ch.charCodeAt(0)] - ? fontMetricsData["Size4-Regular"][ch.charCodeAt(0)][4] - : fontMetricsData["Size1-Regular"][ch.charCodeAt(0)][4]; - var path = new PathNode("inner", innerPath(ch, Math.round(1000 * height))); - var svgNode = new SvgNode([path], { - width: makeEm(width), - height: makeEm(height), - style: "width:" + makeEm(width), - viewBox: "0 0 " + 1000 * width + " " + Math.round(1000 * height), - preserveAspectRatio: "xMinYMin", - }); - var span = buildCommon.makeSvgSpan([], [svgNode], options); - span.height = height; - span.style.height = makeEm(height); - span.style.width = makeEm(width); - return { type: "elem", elem: span }; - }; - var lapInEms = 0.008; - var lap = { type: "kern", size: -1 * lapInEms }; - var verts = ["|", "\\lvert", "\\rvert", "\\vert"]; - var doubleVerts = ["\\|", "\\lVert", "\\rVert", "\\Vert"]; - var makeStackedDelim = function makeStackedDelim( - delim, - heightTotal, - center, - options, - mode, - classes, - ) { - var top; - var middle; - var repeat; - var bottom; - var svgLabel = ""; - var viewBoxWidth = 0; - top = repeat = bottom = delim; - middle = null; - var font = "Size1-Regular"; - if (delim === "\\uparrow") { - repeat = bottom = "\u23D0"; - } else if (delim === "\\Uparrow") { - repeat = bottom = "\u2016"; - } else if (delim === "\\downarrow") { - top = repeat = "\u23D0"; - } else if (delim === "\\Downarrow") { - top = repeat = "\u2016"; - } else if (delim === "\\updownarrow") { - top = "\\uparrow"; - repeat = "\u23D0"; - bottom = "\\downarrow"; - } else if (delim === "\\Updownarrow") { - top = "\\Uparrow"; - repeat = "\u2016"; - bottom = "\\Downarrow"; - } else if (utils.contains(verts, delim)) { - repeat = "\u2223"; - svgLabel = "vert"; - viewBoxWidth = 333; - } else if (utils.contains(doubleVerts, delim)) { - repeat = "\u2225"; - svgLabel = "doublevert"; - viewBoxWidth = 556; - } else if (delim === "[" || delim === "\\lbrack") { - top = "\u23A1"; - repeat = "\u23A2"; - bottom = "\u23A3"; - font = "Size4-Regular"; - svgLabel = "lbrack"; - viewBoxWidth = 667; - } else if (delim === "]" || delim === "\\rbrack") { - top = "\u23A4"; - repeat = "\u23A5"; - bottom = "\u23A6"; - font = "Size4-Regular"; - svgLabel = "rbrack"; - viewBoxWidth = 667; - } else if (delim === "\\lfloor" || delim === "\u230A") { - repeat = top = "\u23A2"; - bottom = "\u23A3"; - font = "Size4-Regular"; - svgLabel = "lfloor"; - viewBoxWidth = 667; - } else if (delim === "\\lceil" || delim === "\u2308") { - top = "\u23A1"; - repeat = bottom = "\u23A2"; - font = "Size4-Regular"; - svgLabel = "lceil"; - viewBoxWidth = 667; - } else if (delim === "\\rfloor" || delim === "\u230B") { - repeat = top = "\u23A5"; - bottom = "\u23A6"; - font = "Size4-Regular"; - svgLabel = "rfloor"; - viewBoxWidth = 667; - } else if (delim === "\\rceil" || delim === "\u2309") { - top = "\u23A4"; - repeat = bottom = "\u23A5"; - font = "Size4-Regular"; - svgLabel = "rceil"; - viewBoxWidth = 667; - } else if (delim === "(" || delim === "\\lparen") { - top = "\u239B"; - repeat = "\u239C"; - bottom = "\u239D"; - font = "Size4-Regular"; - svgLabel = "lparen"; - viewBoxWidth = 875; - } else if (delim === ")" || delim === "\\rparen") { - top = "\u239E"; - repeat = "\u239F"; - bottom = "\u23A0"; - font = "Size4-Regular"; - svgLabel = "rparen"; - viewBoxWidth = 875; - } else if (delim === "\\{" || delim === "\\lbrace") { - top = "\u23A7"; - middle = "\u23A8"; - bottom = "\u23A9"; - repeat = "\u23AA"; - font = "Size4-Regular"; - } else if (delim === "\\}" || delim === "\\rbrace") { - top = "\u23AB"; - middle = "\u23AC"; - bottom = "\u23AD"; - repeat = "\u23AA"; - font = "Size4-Regular"; - } else if (delim === "\\lgroup" || delim === "\u27EE") { - top = "\u23A7"; - bottom = "\u23A9"; - repeat = "\u23AA"; - font = "Size4-Regular"; - } else if (delim === "\\rgroup" || delim === "\u27EF") { - top = "\u23AB"; - bottom = "\u23AD"; - repeat = "\u23AA"; - font = "Size4-Regular"; - } else if (delim === "\\lmoustache" || delim === "\u23B0") { - top = "\u23A7"; - bottom = "\u23AD"; - repeat = "\u23AA"; - font = "Size4-Regular"; - } else if (delim === "\\rmoustache" || delim === "\u23B1") { - top = "\u23AB"; - bottom = "\u23A9"; - repeat = "\u23AA"; - font = "Size4-Regular"; - } - var topMetrics = getMetrics(top, font, mode); - var topHeightTotal = topMetrics.height + topMetrics.depth; - var repeatMetrics = getMetrics(repeat, font, mode); - var repeatHeightTotal = repeatMetrics.height + repeatMetrics.depth; - var bottomMetrics = getMetrics(bottom, font, mode); - var bottomHeightTotal = bottomMetrics.height + bottomMetrics.depth; - var middleHeightTotal = 0; - var middleFactor = 1; - if (middle !== null) { - var middleMetrics = getMetrics(middle, font, mode); - middleHeightTotal = middleMetrics.height + middleMetrics.depth; - middleFactor = 2; - } - var minHeight = topHeightTotal + bottomHeightTotal + middleHeightTotal; - var repeatCount = Math.max( - 0, - Math.ceil((heightTotal - minHeight) / (middleFactor * repeatHeightTotal)), - ); - var realHeightTotal = - minHeight + repeatCount * middleFactor * repeatHeightTotal; - var axisHeight = options.fontMetrics().axisHeight; - if (center) { - axisHeight *= options.sizeMultiplier; - } - var depth = realHeightTotal / 2 - axisHeight; - var stack = []; - if (svgLabel.length > 0) { - var midHeight = realHeightTotal - topHeightTotal - bottomHeightTotal; - var viewBoxHeight = Math.round(realHeightTotal * 1000); - var pathStr = tallDelim(svgLabel, Math.round(midHeight * 1000)); - var path = new PathNode(svgLabel, pathStr); - var width = (viewBoxWidth / 1000).toFixed(3) + "em"; - var height = (viewBoxHeight / 1000).toFixed(3) + "em"; - var svg = new SvgNode([path], { - width: width, - height: height, - viewBox: "0 0 " + viewBoxWidth + " " + viewBoxHeight, - }); - var wrapper = buildCommon.makeSvgSpan([], [svg], options); - wrapper.height = viewBoxHeight / 1000; - wrapper.style.width = width; - wrapper.style.height = height; - stack.push({ type: "elem", elem: wrapper }); - } else { - stack.push(makeGlyphSpan(bottom, font, mode)); - stack.push(lap); - if (middle === null) { - var innerHeight = - realHeightTotal - topHeightTotal - bottomHeightTotal + 2 * lapInEms; - stack.push(makeInner(repeat, innerHeight, options)); - } else { - var _innerHeight = - (realHeightTotal - - topHeightTotal - - bottomHeightTotal - - middleHeightTotal) / - 2 + - 2 * lapInEms; - stack.push(makeInner(repeat, _innerHeight, options)); - stack.push(lap); - stack.push(makeGlyphSpan(middle, font, mode)); - stack.push(lap); - stack.push(makeInner(repeat, _innerHeight, options)); - } - stack.push(lap); - stack.push(makeGlyphSpan(top, font, mode)); - } - var newOptions = options.havingBaseStyle(Style$1.TEXT); - var inner = buildCommon.makeVList( - { positionType: "bottom", positionData: depth, children: stack }, - newOptions, - ); - return styleWrap( - buildCommon.makeSpan(["delimsizing", "mult"], [inner], newOptions), - Style$1.TEXT, - options, - classes, - ); - }; - var vbPad = 80; - var emPad = 0.08; - var sqrtSvg = function sqrtSvg( - sqrtName, - height, - viewBoxHeight, - extraVinculum, - options, - ) { - var path = sqrtPath(sqrtName, extraVinculum, viewBoxHeight); - var pathNode = new PathNode(sqrtName, path); - var svg = new SvgNode([pathNode], { - width: "400em", - height: makeEm(height), - viewBox: "0 0 400000 " + viewBoxHeight, - preserveAspectRatio: "xMinYMin slice", - }); - return buildCommon.makeSvgSpan(["hide-tail"], [svg], options); - }; - var makeSqrtImage = function makeSqrtImage(height, options) { - var newOptions = options.havingBaseSizing(); - var delim = traverseSequence( - "\\surd", - height * newOptions.sizeMultiplier, - stackLargeDelimiterSequence, - newOptions, - ); - var sizeMultiplier = newOptions.sizeMultiplier; - var extraVinculum = Math.max( - 0, - options.minRuleThickness - options.fontMetrics().sqrtRuleThickness, - ); - var span; - var spanHeight = 0; - var texHeight = 0; - var viewBoxHeight = 0; - var advanceWidth; - if (delim.type === "small") { - viewBoxHeight = 1000 + 1000 * extraVinculum + vbPad; - if (height < 1) { - sizeMultiplier = 1; - } else if (height < 1.4) { - sizeMultiplier = 0.7; - } - spanHeight = (1 + extraVinculum + emPad) / sizeMultiplier; - texHeight = (1 + extraVinculum) / sizeMultiplier; - span = sqrtSvg( - "sqrtMain", - spanHeight, - viewBoxHeight, - extraVinculum, - options, - ); - span.style.minWidth = "0.853em"; - advanceWidth = 0.833 / sizeMultiplier; - } else if (delim.type === "large") { - viewBoxHeight = (1000 + vbPad) * sizeToMaxHeight[delim.size]; - texHeight = - (sizeToMaxHeight[delim.size] + extraVinculum) / sizeMultiplier; - spanHeight = - (sizeToMaxHeight[delim.size] + extraVinculum + emPad) / sizeMultiplier; - span = sqrtSvg( - "sqrtSize" + delim.size, - spanHeight, - viewBoxHeight, - extraVinculum, - options, - ); - span.style.minWidth = "1.02em"; - advanceWidth = 1 / sizeMultiplier; - } else { - spanHeight = height + extraVinculum + emPad; - texHeight = height + extraVinculum; - viewBoxHeight = Math.floor(1000 * height + extraVinculum) + vbPad; - span = sqrtSvg( - "sqrtTall", - spanHeight, - viewBoxHeight, - extraVinculum, - options, - ); - span.style.minWidth = "0.742em"; - advanceWidth = 1.056; - } - span.height = texHeight; - span.style.height = makeEm(spanHeight); - return { - span: span, - advanceWidth: advanceWidth, - ruleWidth: - (options.fontMetrics().sqrtRuleThickness + extraVinculum) * - sizeMultiplier, - }; - }; - var stackLargeDelimiters = [ - "(", - "\\lparen", - ")", - "\\rparen", - "[", - "\\lbrack", - "]", - "\\rbrack", - "\\{", - "\\lbrace", - "\\}", - "\\rbrace", - "\\lfloor", - "\\rfloor", - "\u230A", - "\u230B", - "\\lceil", - "\\rceil", - "\u2308", - "\u2309", - "\\surd", - ]; - var stackAlwaysDelimiters = [ - "\\uparrow", - "\\downarrow", - "\\updownarrow", - "\\Uparrow", - "\\Downarrow", - "\\Updownarrow", - "|", - "\\|", - "\\vert", - "\\Vert", - "\\lvert", - "\\rvert", - "\\lVert", - "\\rVert", - "\\lgroup", - "\\rgroup", - "\u27EE", - "\u27EF", - "\\lmoustache", - "\\rmoustache", - "\u23B0", - "\u23B1", - ]; - var stackNeverDelimiters = [ - "<", - ">", - "\\langle", - "\\rangle", - "/", - "\\backslash", - "\\lt", - "\\gt", - ]; - var sizeToMaxHeight = [0, 1.2, 1.8, 2.4, 3]; - var makeSizedDelim = function makeSizedDelim( - delim, - size, - options, - mode, - classes, - ) { - if (delim === "<" || delim === "\\lt" || delim === "\u27E8") { - delim = "\\langle"; - } else if (delim === ">" || delim === "\\gt" || delim === "\u27E9") { - delim = "\\rangle"; - } - if ( - utils.contains(stackLargeDelimiters, delim) || - utils.contains(stackNeverDelimiters, delim) - ) { - return makeLargeDelim(delim, size, false, options, mode, classes); - } else if (utils.contains(stackAlwaysDelimiters, delim)) { - return makeStackedDelim( - delim, - sizeToMaxHeight[size], - false, - options, - mode, - classes, - ); - } else { - throw new ParseError("Illegal delimiter: '" + delim + "'"); - } - }; - var stackNeverDelimiterSequence = [ - { type: "small", style: Style$1.SCRIPTSCRIPT }, - { type: "small", style: Style$1.SCRIPT }, - { type: "small", style: Style$1.TEXT }, - { type: "large", size: 1 }, - { type: "large", size: 2 }, - { type: "large", size: 3 }, - { type: "large", size: 4 }, - ]; - var stackAlwaysDelimiterSequence = [ - { type: "small", style: Style$1.SCRIPTSCRIPT }, - { type: "small", style: Style$1.SCRIPT }, - { type: "small", style: Style$1.TEXT }, - { type: "stack" }, - ]; - var stackLargeDelimiterSequence = [ - { type: "small", style: Style$1.SCRIPTSCRIPT }, - { type: "small", style: Style$1.SCRIPT }, - { type: "small", style: Style$1.TEXT }, - { type: "large", size: 1 }, - { type: "large", size: 2 }, - { type: "large", size: 3 }, - { type: "large", size: 4 }, - { type: "stack" }, - ]; - var delimTypeToFont = function delimTypeToFont(type) { - if (type.type === "small") { - return "Main-Regular"; - } else if (type.type === "large") { - return "Size" + type.size + "-Regular"; - } else if (type.type === "stack") { - return "Size4-Regular"; - } else { - throw new Error("Add support for delim type '" + type.type + "' here."); - } - }; - var traverseSequence = function traverseSequence( - delim, - height, - sequence, - options, - ) { - var start = Math.min(2, 3 - options.style.size); - for (var i = start; i < sequence.length; i++) { - if (sequence[i].type === "stack") { - break; - } - var metrics = getMetrics(delim, delimTypeToFont(sequence[i]), "math"); - var heightDepth = metrics.height + metrics.depth; - if (sequence[i].type === "small") { - var newOptions = options.havingBaseStyle(sequence[i].style); - heightDepth *= newOptions.sizeMultiplier; - } - if (heightDepth > height) { - return sequence[i]; - } - } - return sequence[sequence.length - 1]; - }; - var makeCustomSizedDelim = function makeCustomSizedDelim( - delim, - height, - center, - options, - mode, - classes, - ) { - if (delim === "<" || delim === "\\lt" || delim === "\u27E8") { - delim = "\\langle"; - } else if (delim === ">" || delim === "\\gt" || delim === "\u27E9") { - delim = "\\rangle"; - } - var sequence; - if (utils.contains(stackNeverDelimiters, delim)) { - sequence = stackNeverDelimiterSequence; - } else if (utils.contains(stackLargeDelimiters, delim)) { - sequence = stackLargeDelimiterSequence; - } else { - sequence = stackAlwaysDelimiterSequence; - } - var delimType = traverseSequence(delim, height, sequence, options); - if (delimType.type === "small") { - return makeSmallDelim( - delim, - delimType.style, - center, - options, - mode, - classes, - ); - } else if (delimType.type === "large") { - return makeLargeDelim( - delim, - delimType.size, - center, - options, - mode, - classes, - ); - } else { - return makeStackedDelim(delim, height, center, options, mode, classes); - } - }; - var makeLeftRightDelim = function makeLeftRightDelim( - delim, - height, - depth, - options, - mode, - classes, - ) { - var axisHeight = options.fontMetrics().axisHeight * options.sizeMultiplier; - var delimiterFactor = 901; - var delimiterExtend = 5 / options.fontMetrics().ptPerEm; - var maxDistFromAxis = Math.max(height - axisHeight, depth + axisHeight); - var totalHeight = Math.max( - (maxDistFromAxis / 500) * delimiterFactor, - 2 * maxDistFromAxis - delimiterExtend, - ); - return makeCustomSizedDelim( - delim, - totalHeight, - true, - options, - mode, - classes, - ); - }; - var delimiter = { - sqrtImage: makeSqrtImage, - sizedDelim: makeSizedDelim, - sizeToMaxHeight: sizeToMaxHeight, - customSizedDelim: makeCustomSizedDelim, - leftRightDelim: makeLeftRightDelim, - }; - var delimiterSizes = { - "\\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 }, - }; - var delimiters = [ - "(", - "\\lparen", - ")", - "\\rparen", - "[", - "\\lbrack", - "]", - "\\rbrack", - "\\{", - "\\lbrace", - "\\}", - "\\rbrace", - "\\lfloor", - "\\rfloor", - "\u230A", - "\u230B", - "\\lceil", - "\\rceil", - "\u2308", - "\u2309", - "<", - ">", - "\\langle", - "\u27E8", - "\\rangle", - "\u27E9", - "\\lt", - "\\gt", - "\\lvert", - "\\rvert", - "\\lVert", - "\\rVert", - "\\lgroup", - "\\rgroup", - "\u27EE", - "\u27EF", - "\\lmoustache", - "\\rmoustache", - "\u23B0", - "\u23B1", - "/", - "\\backslash", - "|", - "\\vert", - "\\|", - "\\Vert", - "\\uparrow", - "\\Uparrow", - "\\downarrow", - "\\Downarrow", - "\\updownarrow", - "\\Updownarrow", - ".", - ]; - function checkDelimiter(delim, context) { - var symDelim = checkSymbolNodeType(delim); - if (symDelim && utils.contains(delimiters, symDelim.text)) { - return symDelim; - } else if (symDelim) { - throw new ParseError( - "Invalid delimiter '" + - symDelim.text + - "' after '" + - context.funcName + - "'", - delim, - ); - } else { - throw new ParseError( - "Invalid delimiter type '" + delim.type + "'", - delim, - ); - } - } - defineFunction({ - type: "delimsizing", - names: [ - "\\bigl", - "\\Bigl", - "\\biggl", - "\\Biggl", - "\\bigr", - "\\Bigr", - "\\biggr", - "\\Biggr", - "\\bigm", - "\\Bigm", - "\\biggm", - "\\Biggm", - "\\big", - "\\Big", - "\\bigg", - "\\Bigg", - ], - props: { numArgs: 1, argTypes: ["primitive"] }, - handler: function handler(context, args) { - var delim = checkDelimiter(args[0], context); - return { - type: "delimsizing", - mode: context.parser.mode, - size: delimiterSizes[context.funcName].size, - mclass: delimiterSizes[context.funcName].mclass, - delim: delim.text, - }; - }, - htmlBuilder: function htmlBuilder(group, options) { - if (group.delim === ".") { - return buildCommon.makeSpan([group.mclass]); - } - return delimiter.sizedDelim( - group.delim, - group.size, - options, - group.mode, - [group.mclass], - ); - }, - mathmlBuilder: function mathmlBuilder(group) { - var children = []; - if (group.delim !== ".") { - children.push(makeText(group.delim, group.mode)); - } - var node = new mathMLTree.MathNode("mo", children); - if (group.mclass === "mopen" || group.mclass === "mclose") { - node.setAttribute("fence", "true"); - } else { - node.setAttribute("fence", "false"); - } - node.setAttribute("stretchy", "true"); - var size = makeEm(delimiter.sizeToMaxHeight[group.size]); - node.setAttribute("minsize", size); - node.setAttribute("maxsize", size); - return node; - }, - }); - function assertParsed(group) { - if (!group.body) { - throw new Error("Bug: The leftright ParseNode wasn't fully parsed."); - } - } - defineFunction({ - type: "leftright-right", - names: ["\\right"], - props: { numArgs: 1, primitive: true }, - handler: function handler(context, args) { - var color = context.parser.gullet.macros.get("\\current@color"); - if (color && typeof color !== "string") { - throw new ParseError("\\current@color set to non-string in \\right"); - } - return { - type: "leftright-right", - mode: context.parser.mode, - delim: checkDelimiter(args[0], context).text, - color: color, - }; - }, - }); - defineFunction({ - type: "leftright", - names: ["\\left"], - props: { numArgs: 1, primitive: true }, - handler: function handler(context, args) { - var delim = checkDelimiter(args[0], context); - var parser = context.parser; - ++parser.leftrightDepth; - var body = parser.parseExpression(false); - --parser.leftrightDepth; - parser.expect("\\right", false); - var right = assertNodeType(parser.parseFunction(), "leftright-right"); - return { - type: "leftright", - mode: parser.mode, - body: body, - left: delim.text, - right: right.delim, - rightColor: right.color, - }; - }, - htmlBuilder: function htmlBuilder(group, options) { - assertParsed(group); - var inner = buildExpression$1(group.body, options, true, [ - "mopen", - "mclose", - ]); - var innerHeight = 0; - var innerDepth = 0; - var hadMiddle = false; - for (var i = 0; i < inner.length; i++) { - if (inner[i].isMiddle) { - hadMiddle = true; - } else { - innerHeight = Math.max(inner[i].height, innerHeight); - innerDepth = Math.max(inner[i].depth, innerDepth); - } - } - innerHeight *= options.sizeMultiplier; - innerDepth *= options.sizeMultiplier; - var leftDelim; - if (group.left === ".") { - leftDelim = makeNullDelimiter(options, ["mopen"]); - } else { - leftDelim = delimiter.leftRightDelim( - group.left, - innerHeight, - innerDepth, - options, - group.mode, - ["mopen"], - ); - } - inner.unshift(leftDelim); - if (hadMiddle) { - for (var _i = 1; _i < inner.length; _i++) { - var middleDelim = inner[_i]; - var isMiddle = middleDelim.isMiddle; - if (isMiddle) { - inner[_i] = delimiter.leftRightDelim( - isMiddle.delim, - innerHeight, - innerDepth, - isMiddle.options, - group.mode, - [], - ); - } - } - } - var rightDelim; - if (group.right === ".") { - rightDelim = makeNullDelimiter(options, ["mclose"]); - } else { - var colorOptions = group.rightColor - ? options.withColor(group.rightColor) - : options; - rightDelim = delimiter.leftRightDelim( - group.right, - innerHeight, - innerDepth, - colorOptions, - group.mode, - ["mclose"], - ); - } - inner.push(rightDelim); - return buildCommon.makeSpan(["minner"], inner, options); - }, - mathmlBuilder: function mathmlBuilder(group, options) { - assertParsed(group); - var inner = buildExpression(group.body, options); - if (group.left !== ".") { - var leftNode = new mathMLTree.MathNode("mo", [ - makeText(group.left, group.mode), - ]); - leftNode.setAttribute("fence", "true"); - inner.unshift(leftNode); - } - if (group.right !== ".") { - var rightNode = new mathMLTree.MathNode("mo", [ - makeText(group.right, group.mode), - ]); - rightNode.setAttribute("fence", "true"); - if (group.rightColor) { - rightNode.setAttribute("mathcolor", group.rightColor); - } - inner.push(rightNode); - } - return makeRow(inner); - }, - }); - defineFunction({ - type: "middle", - names: ["\\middle"], - props: { numArgs: 1, primitive: true }, - handler: function handler(context, args) { - var delim = checkDelimiter(args[0], context); - if (!context.parser.leftrightDepth) { - throw new ParseError("\\middle without preceding \\left", delim); - } - return { type: "middle", mode: context.parser.mode, delim: delim.text }; - }, - htmlBuilder: function htmlBuilder(group, options) { - var middleDelim; - if (group.delim === ".") { - middleDelim = makeNullDelimiter(options, []); - } else { - middleDelim = delimiter.sizedDelim( - group.delim, - 1, - options, - group.mode, - [], - ); - var isMiddle = { delim: group.delim, options: options }; - middleDelim.isMiddle = isMiddle; - } - return middleDelim; - }, - mathmlBuilder: function mathmlBuilder(group, options) { - var textNode = - group.delim === "\\vert" || group.delim === "|" - ? makeText("|", "text") - : makeText(group.delim, group.mode); - var middleNode = new mathMLTree.MathNode("mo", [textNode]); - middleNode.setAttribute("fence", "true"); - middleNode.setAttribute("lspace", "0.05em"); - middleNode.setAttribute("rspace", "0.05em"); - return middleNode; - }, - }); - var htmlBuilder$7 = function htmlBuilder$7(group, options) { - var inner = buildCommon.wrapFragment( - buildGroup$1(group.body, options), - options, - ); - var label = group.label.slice(1); - var scale = options.sizeMultiplier; - var img; - var imgShift = 0; - var isSingleChar = utils.isCharacterBox(group.body); - if (label === "sout") { - img = buildCommon.makeSpan(["stretchy", "sout"]); - img.height = options.fontMetrics().defaultRuleThickness / scale; - imgShift = -0.5 * options.fontMetrics().xHeight; - } else if (label === "phase") { - var lineWeight = calculateSize({ number: 0.6, unit: "pt" }, options); - var clearance = calculateSize({ number: 0.35, unit: "ex" }, options); - var newOptions = options.havingBaseSizing(); - scale = scale / newOptions.sizeMultiplier; - var angleHeight = inner.height + inner.depth + lineWeight + clearance; - inner.style.paddingLeft = makeEm(angleHeight / 2 + lineWeight); - var viewBoxHeight = Math.floor(1000 * angleHeight * scale); - var path = phasePath(viewBoxHeight); - var svgNode = new SvgNode([new PathNode("phase", path)], { - width: "400em", - height: makeEm(viewBoxHeight / 1000), - viewBox: "0 0 400000 " + viewBoxHeight, - preserveAspectRatio: "xMinYMin slice", - }); - img = buildCommon.makeSvgSpan(["hide-tail"], [svgNode], options); - img.style.height = makeEm(angleHeight); - imgShift = inner.depth + lineWeight + clearance; - } else { - if (/cancel/.test(label)) { - if (!isSingleChar) { - inner.classes.push("cancel-pad"); - } - } else if (label === "angl") { - inner.classes.push("anglpad"); - } else { - inner.classes.push("boxpad"); - } - var topPad = 0; - var bottomPad = 0; - var ruleThickness = 0; - if (/box/.test(label)) { - ruleThickness = Math.max( - options.fontMetrics().fboxrule, - options.minRuleThickness, - ); - topPad = - options.fontMetrics().fboxsep + - (label === "colorbox" ? 0 : ruleThickness); - bottomPad = topPad; - } else if (label === "angl") { - ruleThickness = Math.max( - options.fontMetrics().defaultRuleThickness, - options.minRuleThickness, - ); - topPad = 4 * ruleThickness; - bottomPad = Math.max(0, 0.25 - inner.depth); - } else { - topPad = isSingleChar ? 0.2 : 0; - bottomPad = topPad; - } - img = stretchy.encloseSpan(inner, label, topPad, bottomPad, options); - if (/fbox|boxed|fcolorbox/.test(label)) { - img.style.borderStyle = "solid"; - img.style.borderWidth = makeEm(ruleThickness); - } else if (label === "angl" && ruleThickness !== 0.049) { - img.style.borderTopWidth = makeEm(ruleThickness); - img.style.borderRightWidth = makeEm(ruleThickness); - } - imgShift = inner.depth + bottomPad; - if (group.backgroundColor) { - img.style.backgroundColor = group.backgroundColor; - if (group.borderColor) { - img.style.borderColor = group.borderColor; - } - } - } - var vlist; - if (group.backgroundColor) { - vlist = buildCommon.makeVList( - { - positionType: "individualShift", - children: [ - { type: "elem", elem: img, shift: imgShift }, - { type: "elem", elem: inner, shift: 0 }, - ], - }, - options, - ); - } else { - var classes = /cancel|phase/.test(label) ? ["svg-align"] : []; - vlist = buildCommon.makeVList( - { - positionType: "individualShift", - children: [ - { type: "elem", elem: inner, shift: 0 }, - { - type: "elem", - elem: img, - shift: imgShift, - wrapperClasses: classes, - }, - ], - }, - options, - ); - } - if (/cancel/.test(label)) { - vlist.height = inner.height; - vlist.depth = inner.depth; - } - if (/cancel/.test(label) && !isSingleChar) { - return buildCommon.makeSpan(["mord", "cancel-lap"], [vlist], options); - } else { - return buildCommon.makeSpan(["mord"], [vlist], options); - } - }; - var mathmlBuilder$6 = function mathmlBuilder$6(group, options) { - var fboxsep = 0; - var node = new mathMLTree.MathNode( - group.label.indexOf("colorbox") > -1 ? "mpadded" : "menclose", - [buildGroup(group.body, options)], - ); - switch (group.label) { - case "\\cancel": - node.setAttribute("notation", "updiagonalstrike"); - break; - case "\\bcancel": - node.setAttribute("notation", "downdiagonalstrike"); - break; - case "\\phase": - node.setAttribute("notation", "phasorangle"); - break; - case "\\sout": - node.setAttribute("notation", "horizontalstrike"); - break; - case "\\fbox": - node.setAttribute("notation", "box"); - break; - case "\\angl": - node.setAttribute("notation", "actuarial"); - break; - case "\\fcolorbox": - case "\\colorbox": - fboxsep = options.fontMetrics().fboxsep * options.fontMetrics().ptPerEm; - node.setAttribute("width", "+" + 2 * fboxsep + "pt"); - node.setAttribute("height", "+" + 2 * fboxsep + "pt"); - node.setAttribute("lspace", fboxsep + "pt"); - node.setAttribute("voffset", fboxsep + "pt"); - if (group.label === "\\fcolorbox") { - var thk = Math.max( - options.fontMetrics().fboxrule, - options.minRuleThickness, - ); - node.setAttribute( - "style", - "border: " + thk + "em solid " + String(group.borderColor), - ); - } - break; - case "\\xcancel": - node.setAttribute("notation", "updiagonalstrike downdiagonalstrike"); - break; - } - if (group.backgroundColor) { - node.setAttribute("mathbackground", group.backgroundColor); - } - return node; - }; - defineFunction({ - type: "enclose", - names: ["\\colorbox"], - props: { numArgs: 2, allowedInText: true, argTypes: ["color", "text"] }, - handler: function handler(_ref, args, optArgs) { - var parser = _ref.parser, - funcName = _ref.funcName; - var color = assertNodeType(args[0], "color-token").color; - var body = args[1]; - return { - type: "enclose", - mode: parser.mode, - label: funcName, - backgroundColor: color, - body: body, - }; - }, - htmlBuilder: htmlBuilder$7, - mathmlBuilder: mathmlBuilder$6, - }); - defineFunction({ - type: "enclose", - names: ["\\fcolorbox"], - props: { - numArgs: 3, - allowedInText: true, - argTypes: ["color", "color", "text"], - }, - handler: function handler(_ref2, args, optArgs) { - var parser = _ref2.parser, - funcName = _ref2.funcName; - var borderColor = assertNodeType(args[0], "color-token").color; - var backgroundColor = assertNodeType(args[1], "color-token").color; - var body = args[2]; - return { - type: "enclose", - mode: parser.mode, - label: funcName, - backgroundColor: backgroundColor, - borderColor: borderColor, - body: body, - }; - }, - htmlBuilder: htmlBuilder$7, - mathmlBuilder: mathmlBuilder$6, - }); - defineFunction({ - type: "enclose", - names: ["\\fbox"], - props: { numArgs: 1, argTypes: ["hbox"], allowedInText: true }, - handler: function handler(_ref3, args) { - var parser = _ref3.parser; - return { - type: "enclose", - mode: parser.mode, - label: "\\fbox", - body: args[0], - }; - }, - }); - defineFunction({ - type: "enclose", - names: ["\\cancel", "\\bcancel", "\\xcancel", "\\sout", "\\phase"], - props: { numArgs: 1 }, - handler: function handler(_ref4, args) { - var parser = _ref4.parser, - funcName = _ref4.funcName; - var body = args[0]; - return { - type: "enclose", - mode: parser.mode, - label: funcName, - body: body, - }; - }, - htmlBuilder: htmlBuilder$7, - mathmlBuilder: mathmlBuilder$6, - }); - defineFunction({ - type: "enclose", - names: ["\\angl"], - props: { numArgs: 1, argTypes: ["hbox"], allowedInText: false }, - handler: function handler(_ref5, args) { - var parser = _ref5.parser; - return { - type: "enclose", - mode: parser.mode, - label: "\\angl", - body: args[0], - }; - }, - }); - var _environments = {}; - function defineEnvironment(_ref) { - var type = _ref.type, - names = _ref.names, - props = _ref.props, - handler = _ref.handler, - htmlBuilder = _ref.htmlBuilder, - mathmlBuilder = _ref.mathmlBuilder; - var data = { - type: type, - numArgs: props.numArgs || 0, - allowedInText: false, - numOptionalArgs: 0, - handler: handler, - }; - for (var i = 0; i < names.length; ++i) { - _environments[names[i]] = data; - } - if (htmlBuilder) { - _htmlGroupBuilders[type] = htmlBuilder; - } - if (mathmlBuilder) { - _mathmlGroupBuilders[type] = mathmlBuilder; - } - } - var _macros = {}; - function defineMacro(name, body) { - _macros[name] = body; - } - function getHLines(parser) { - var hlineInfo = []; - parser.consumeSpaces(); - var nxt = parser.fetch().text; - if (nxt === "\\relax") { - parser.consume(); - parser.consumeSpaces(); - nxt = parser.fetch().text; - } - while (nxt === "\\hline" || nxt === "\\hdashline") { - parser.consume(); - hlineInfo.push(nxt === "\\hdashline"); - parser.consumeSpaces(); - nxt = parser.fetch().text; - } - return hlineInfo; - } - var validateAmsEnvironmentContext = function validateAmsEnvironmentContext( - context, - ) { - var settings = context.parser.settings; - if (!settings.displayMode) { - throw new ParseError( - "{" + context.envName + "} can be used only in" + " display mode.", - ); - } - }; - function getAutoTag(name) { - if (name.indexOf("ed") === -1) { - return name.indexOf("*") === -1; - } - } - function parseArray(parser, _ref, style) { - var hskipBeforeAndAfter = _ref.hskipBeforeAndAfter, - addJot = _ref.addJot, - cols = _ref.cols, - arraystretch = _ref.arraystretch, - colSeparationType = _ref.colSeparationType, - autoTag = _ref.autoTag, - singleRow = _ref.singleRow, - emptySingleRow = _ref.emptySingleRow, - maxNumCols = _ref.maxNumCols, - leqno = _ref.leqno; - parser.gullet.beginGroup(); - if (!singleRow) { - parser.gullet.macros.set("\\cr", "\\\\\\relax"); - } - if (!arraystretch) { - var stretch = parser.gullet.expandMacroAsText("\\arraystretch"); - if (stretch == null) { - arraystretch = 1; - } else { - arraystretch = parseFloat(stretch); - if (!arraystretch || arraystretch < 0) { - throw new ParseError("Invalid \\arraystretch: " + stretch); - } - } - } - parser.gullet.beginGroup(); - var row = []; - var body = [row]; - var rowGaps = []; - var hLinesBeforeRow = []; - var tags = autoTag != null ? [] : undefined; - function beginRow() { - if (autoTag) { - parser.gullet.macros.set("\\@eqnsw", "1", true); - } - } - function endRow() { - if (tags) { - if (parser.gullet.macros.get("\\df@tag")) { - tags.push(parser.subparse([new Token("\\df@tag")])); - parser.gullet.macros.set("\\df@tag", undefined, true); - } else { - tags.push( - Boolean(autoTag) && parser.gullet.macros.get("\\@eqnsw") === "1", - ); - } - } - } - beginRow(); - hLinesBeforeRow.push(getHLines(parser)); - while (true) { - var cell = parser.parseExpression(false, singleRow ? "\\end" : "\\\\"); - parser.gullet.endGroup(); - parser.gullet.beginGroup(); - cell = { type: "ordgroup", mode: parser.mode, body: cell }; - if (style) { - cell = { - type: "styling", - mode: parser.mode, - style: style, - body: [cell], - }; - } - row.push(cell); - var next = parser.fetch().text; - if (next === "&") { - if (maxNumCols && row.length === maxNumCols) { - if (singleRow || colSeparationType) { - throw new ParseError( - "Too many tab characters: &", - parser.nextToken, - ); - } else { - parser.settings.reportNonstrict( - "textEnv", - "Too few columns " + "specified in the {array} column argument.", - ); - } - } - parser.consume(); - } else if (next === "\\end") { - endRow(); - if ( - row.length === 1 && - cell.type === "styling" && - cell.body[0].body.length === 0 && - (body.length > 1 || !emptySingleRow) - ) { - body.pop(); - } - if (hLinesBeforeRow.length < body.length + 1) { - hLinesBeforeRow.push([]); - } - break; - } else if (next === "\\\\") { - parser.consume(); - var size = void 0; - if (parser.gullet.future().text !== " ") { - size = parser.parseSizeGroup(true); - } - rowGaps.push(size ? size.value : null); - endRow(); - hLinesBeforeRow.push(getHLines(parser)); - row = []; - body.push(row); - beginRow(); - } else { - throw new ParseError( - "Expected & or \\\\ or \\cr or \\end", - parser.nextToken, - ); - } - } - parser.gullet.endGroup(); - parser.gullet.endGroup(); - return { - type: "array", - mode: parser.mode, - addJot: addJot, - arraystretch: arraystretch, - body: body, - cols: cols, - rowGaps: rowGaps, - hskipBeforeAndAfter: hskipBeforeAndAfter, - hLinesBeforeRow: hLinesBeforeRow, - colSeparationType: colSeparationType, - tags: tags, - leqno: leqno, - }; - } - function dCellStyle(envName) { - if (envName.slice(0, 1) === "d") { - return "display"; - } else { - return "text"; - } - } - var htmlBuilder$6 = function htmlBuilder(group, options) { - var r; - var c; - var nr = group.body.length; - var hLinesBeforeRow = group.hLinesBeforeRow; - var nc = 0; - var body = new Array(nr); - var hlines = []; - var ruleThickness = Math.max( - options.fontMetrics().arrayRuleWidth, - options.minRuleThickness, - ); - var pt = 1 / options.fontMetrics().ptPerEm; - var arraycolsep = 5 * pt; - if (group.colSeparationType && group.colSeparationType === "small") { - var localMultiplier = options.havingStyle(Style$1.SCRIPT).sizeMultiplier; - arraycolsep = 0.2778 * (localMultiplier / options.sizeMultiplier); - } - var baselineskip = - group.colSeparationType === "CD" - ? calculateSize({ number: 3, unit: "ex" }, options) - : 12 * pt; - var jot = 3 * pt; - var arrayskip = group.arraystretch * baselineskip; - var arstrutHeight = 0.7 * arrayskip; - var arstrutDepth = 0.3 * arrayskip; - var totalHeight = 0; - function setHLinePos(hlinesInGap) { - for (var i = 0; i < hlinesInGap.length; ++i) { - if (i > 0) { - totalHeight += 0.25; - } - hlines.push({ pos: totalHeight, isDashed: hlinesInGap[i] }); - } - } - setHLinePos(hLinesBeforeRow[0]); - for (r = 0; r < group.body.length; ++r) { - var inrow = group.body[r]; - var height = arstrutHeight; - var depth = arstrutDepth; - if (nc < inrow.length) { - nc = inrow.length; - } - var outrow = new Array(inrow.length); - for (c = 0; c < inrow.length; ++c) { - var elt = buildGroup$1(inrow[c], options); - if (depth < elt.depth) { - depth = elt.depth; - } - if (height < elt.height) { - height = elt.height; - } - outrow[c] = elt; - } - var rowGap = group.rowGaps[r]; - var gap = 0; - if (rowGap) { - gap = calculateSize(rowGap, options); - if (gap > 0) { - gap += arstrutDepth; - if (depth < gap) { - depth = gap; - } - gap = 0; - } - } - if (group.addJot) { - depth += jot; - } - outrow.height = height; - outrow.depth = depth; - totalHeight += height; - outrow.pos = totalHeight; - totalHeight += depth + gap; - body[r] = outrow; - setHLinePos(hLinesBeforeRow[r + 1]); - } - var offset = totalHeight / 2 + options.fontMetrics().axisHeight; - var colDescriptions = group.cols || []; - var cols = []; - var colSep; - var colDescrNum; - var tagSpans = []; - if ( - group.tags && - group.tags.some(function (tag) { - return tag; - }) - ) { - for (r = 0; r < nr; ++r) { - var rw = body[r]; - var shift = rw.pos - offset; - var tag = group.tags[r]; - var tagSpan = void 0; - if (tag === true) { - tagSpan = buildCommon.makeSpan(["eqn-num"], [], options); - } else if (tag === false) { - tagSpan = buildCommon.makeSpan([], [], options); - } else { - tagSpan = buildCommon.makeSpan( - [], - buildExpression$1(tag, options, true), - options, - ); - } - tagSpan.depth = rw.depth; - tagSpan.height = rw.height; - tagSpans.push({ type: "elem", elem: tagSpan, shift: shift }); - } - } - for ( - c = 0, colDescrNum = 0; - c < nc || colDescrNum < colDescriptions.length; - ++c, ++colDescrNum - ) { - var colDescr = colDescriptions[colDescrNum] || {}; - var firstSeparator = true; - while (colDescr.type === "separator") { - if (!firstSeparator) { - colSep = buildCommon.makeSpan(["arraycolsep"], []); - colSep.style.width = makeEm(options.fontMetrics().doubleRuleSep); - cols.push(colSep); - } - if (colDescr.separator === "|" || colDescr.separator === ":") { - var lineType = colDescr.separator === "|" ? "solid" : "dashed"; - var separator = buildCommon.makeSpan( - ["vertical-separator"], - [], - options, - ); - separator.style.height = makeEm(totalHeight); - separator.style.borderRightWidth = makeEm(ruleThickness); - separator.style.borderRightStyle = lineType; - separator.style.margin = "0 " + makeEm(-ruleThickness / 2); - var _shift = totalHeight - offset; - if (_shift) { - separator.style.verticalAlign = makeEm(-_shift); - } - cols.push(separator); - } else { - throw new ParseError("Invalid separator type: " + colDescr.separator); - } - colDescrNum++; - colDescr = colDescriptions[colDescrNum] || {}; - firstSeparator = false; - } - if (c >= nc) { - continue; - } - var sepwidth = void 0; - if (c > 0 || group.hskipBeforeAndAfter) { - sepwidth = utils.deflt(colDescr.pregap, arraycolsep); - if (sepwidth !== 0) { - colSep = buildCommon.makeSpan(["arraycolsep"], []); - colSep.style.width = makeEm(sepwidth); - cols.push(colSep); - } - } - var col = []; - for (r = 0; r < nr; ++r) { - var row = body[r]; - var elem = row[c]; - if (!elem) { - continue; - } - var _shift2 = row.pos - offset; - elem.depth = row.depth; - elem.height = row.height; - col.push({ type: "elem", elem: elem, shift: _shift2 }); - } - col = buildCommon.makeVList( - { positionType: "individualShift", children: col }, - options, - ); - col = buildCommon.makeSpan( - ["col-align-" + (colDescr.align || "c")], - [col], - ); - cols.push(col); - if (c < nc - 1 || group.hskipBeforeAndAfter) { - sepwidth = utils.deflt(colDescr.postgap, arraycolsep); - if (sepwidth !== 0) { - colSep = buildCommon.makeSpan(["arraycolsep"], []); - colSep.style.width = makeEm(sepwidth); - cols.push(colSep); - } - } - } - body = buildCommon.makeSpan(["mtable"], cols); - if (hlines.length > 0) { - var line = buildCommon.makeLineSpan("hline", options, ruleThickness); - var dashes = buildCommon.makeLineSpan( - "hdashline", - options, - ruleThickness, - ); - var vListElems = [{ type: "elem", elem: body, shift: 0 }]; - while (hlines.length > 0) { - var hline = hlines.pop(); - var lineShift = hline.pos - offset; - if (hline.isDashed) { - vListElems.push({ type: "elem", elem: dashes, shift: lineShift }); - } else { - vListElems.push({ type: "elem", elem: line, shift: lineShift }); - } - } - body = buildCommon.makeVList( - { positionType: "individualShift", children: vListElems }, - options, - ); - } - if (tagSpans.length === 0) { - return buildCommon.makeSpan(["mord"], [body], options); - } else { - var eqnNumCol = buildCommon.makeVList( - { positionType: "individualShift", children: tagSpans }, - options, - ); - eqnNumCol = buildCommon.makeSpan(["tag"], [eqnNumCol], options); - return buildCommon.makeFragment([body, eqnNumCol]); - } - }; - var alignMap = { c: "center ", l: "left ", r: "right " }; - var mathmlBuilder$5 = function mathmlBuilder(group, options) { - var tbl = []; - var glue = new mathMLTree.MathNode("mtd", [], ["mtr-glue"]); - var tag = new mathMLTree.MathNode("mtd", [], ["mml-eqn-num"]); - for (var i = 0; i < group.body.length; i++) { - var rw = group.body[i]; - var row = []; - for (var j = 0; j < rw.length; j++) { - row.push(new mathMLTree.MathNode("mtd", [buildGroup(rw[j], options)])); - } - if (group.tags && group.tags[i]) { - row.unshift(glue); - row.push(glue); - if (group.leqno) { - row.unshift(tag); - } else { - row.push(tag); - } - } - tbl.push(new mathMLTree.MathNode("mtr", row)); - } - var table = new mathMLTree.MathNode("mtable", tbl); - var gap = - group.arraystretch === 0.5 - ? 0.1 - : 0.16 + group.arraystretch - 1 + (group.addJot ? 0.09 : 0); - table.setAttribute("rowspacing", makeEm(gap)); - var menclose = ""; - var align = ""; - if (group.cols && group.cols.length > 0) { - var cols = group.cols; - var columnLines = ""; - var prevTypeWasAlign = false; - var iStart = 0; - var iEnd = cols.length; - if (cols[0].type === "separator") { - menclose += "top "; - iStart = 1; - } - if (cols[cols.length - 1].type === "separator") { - menclose += "bottom "; - iEnd -= 1; - } - for (var _i = iStart; _i < iEnd; _i++) { - if (cols[_i].type === "align") { - align += alignMap[cols[_i].align]; - if (prevTypeWasAlign) { - columnLines += "none "; - } - prevTypeWasAlign = true; - } else if (cols[_i].type === "separator") { - if (prevTypeWasAlign) { - columnLines += cols[_i].separator === "|" ? "solid " : "dashed "; - prevTypeWasAlign = false; - } - } - } - table.setAttribute("columnalign", align.trim()); - if (/[sd]/.test(columnLines)) { - table.setAttribute("columnlines", columnLines.trim()); - } - } - if (group.colSeparationType === "align") { - var _cols = group.cols || []; - var spacing = ""; - for (var _i2 = 1; _i2 < _cols.length; _i2++) { - spacing += _i2 % 2 ? "0em " : "1em "; - } - table.setAttribute("columnspacing", spacing.trim()); - } else if ( - group.colSeparationType === "alignat" || - group.colSeparationType === "gather" - ) { - table.setAttribute("columnspacing", "0em"); - } else if (group.colSeparationType === "small") { - table.setAttribute("columnspacing", "0.2778em"); - } else if (group.colSeparationType === "CD") { - table.setAttribute("columnspacing", "0.5em"); - } else { - table.setAttribute("columnspacing", "1em"); - } - var rowLines = ""; - var hlines = group.hLinesBeforeRow; - menclose += hlines[0].length > 0 ? "left " : ""; - menclose += hlines[hlines.length - 1].length > 0 ? "right " : ""; - for (var _i3 = 1; _i3 < hlines.length - 1; _i3++) { - rowLines += - hlines[_i3].length === 0 - ? "none " - : hlines[_i3][0] - ? "dashed " - : "solid "; - } - if (/[sd]/.test(rowLines)) { - table.setAttribute("rowlines", rowLines.trim()); - } - if (menclose !== "") { - table = new mathMLTree.MathNode("menclose", [table]); - table.setAttribute("notation", menclose.trim()); - } - if (group.arraystretch && group.arraystretch < 1) { - table = new mathMLTree.MathNode("mstyle", [table]); - table.setAttribute("scriptlevel", "1"); - } - return table; - }; - var alignedHandler = function alignedHandler(context, args) { - if (context.envName.indexOf("ed") === -1) { - validateAmsEnvironmentContext(context); - } - var cols = []; - var separationType = - context.envName.indexOf("at") > -1 ? "alignat" : "align"; - var isSplit = context.envName === "split"; - var res = parseArray( - context.parser, - { - cols: cols, - addJot: true, - autoTag: isSplit ? undefined : getAutoTag(context.envName), - emptySingleRow: true, - colSeparationType: separationType, - maxNumCols: isSplit ? 2 : undefined, - leqno: context.parser.settings.leqno, - }, - "display", - ); - var numMaths; - var numCols = 0; - var emptyGroup = { type: "ordgroup", mode: context.mode, body: [] }; - if (args[0] && args[0].type === "ordgroup") { - var arg0 = ""; - for (var i = 0; i < args[0].body.length; i++) { - var textord = assertNodeType(args[0].body[i], "textord"); - arg0 += textord.text; - } - numMaths = Number(arg0); - numCols = numMaths * 2; - } - var isAligned = !numCols; - res.body.forEach(function (row) { - for (var _i4 = 1; _i4 < row.length; _i4 += 2) { - var styling = assertNodeType(row[_i4], "styling"); - var ordgroup = assertNodeType(styling.body[0], "ordgroup"); - ordgroup.body.unshift(emptyGroup); - } - if (!isAligned) { - var curMaths = row.length / 2; - if (numMaths < curMaths) { - throw new ParseError( - "Too many math in a row: " + - ("expected " + numMaths + ", but got " + curMaths), - row[0], - ); - } - } else if (numCols < row.length) { - numCols = row.length; - } - }); - for (var _i5 = 0; _i5 < numCols; ++_i5) { - var align = "r"; - var pregap = 0; - if (_i5 % 2 === 1) { - align = "l"; - } else if (_i5 > 0 && isAligned) { - pregap = 1; - } - cols[_i5] = { type: "align", align: align, pregap: pregap, postgap: 0 }; - } - res.colSeparationType = isAligned ? "align" : "alignat"; - return res; - }; - defineEnvironment({ - type: "array", - names: ["array", "darray"], - props: { numArgs: 1 }, - handler: function handler(context, args) { - var symNode = checkSymbolNodeType(args[0]); - var colalign = symNode - ? [args[0]] - : assertNodeType(args[0], "ordgroup").body; - var cols = colalign.map(function (nde) { - var node = assertSymbolNodeType(nde); - var ca = node.text; - if ("lcr".indexOf(ca) !== -1) { - return { type: "align", align: ca }; - } else if (ca === "|") { - return { type: "separator", separator: "|" }; - } else if (ca === ":") { - return { type: "separator", separator: ":" }; - } - throw new ParseError("Unknown column alignment: " + ca, nde); - }); - var res = { - cols: cols, - hskipBeforeAndAfter: true, - maxNumCols: cols.length, - }; - return parseArray(context.parser, res, dCellStyle(context.envName)); - }, - htmlBuilder: htmlBuilder$6, - mathmlBuilder: mathmlBuilder$5, - }); - defineEnvironment({ - type: "array", - names: [ - "matrix", - "pmatrix", - "bmatrix", - "Bmatrix", - "vmatrix", - "Vmatrix", - "matrix*", - "pmatrix*", - "bmatrix*", - "Bmatrix*", - "vmatrix*", - "Vmatrix*", - ], - props: { numArgs: 0 }, - handler: function handler(context) { - var delimiters = { - matrix: null, - pmatrix: ["(", ")"], - bmatrix: ["[", "]"], - Bmatrix: ["\\{", "\\}"], - vmatrix: ["|", "|"], - Vmatrix: ["\\Vert", "\\Vert"], - }[context.envName.replace("*", "")]; - var colAlign = "c"; - var payload = { - hskipBeforeAndAfter: false, - cols: [{ type: "align", align: colAlign }], - }; - if (context.envName.charAt(context.envName.length - 1) === "*") { - var parser = context.parser; - parser.consumeSpaces(); - if (parser.fetch().text === "[") { - parser.consume(); - parser.consumeSpaces(); - colAlign = parser.fetch().text; - if ("lcr".indexOf(colAlign) === -1) { - throw new ParseError("Expected l or c or r", parser.nextToken); - } - parser.consume(); - parser.consumeSpaces(); - parser.expect("]"); - parser.consume(); - payload.cols = [{ type: "align", align: colAlign }]; - } - } - var res = parseArray( - context.parser, - payload, - dCellStyle(context.envName), - ); - var numCols = Math.max.apply( - Math, - [0].concat( - _toConsumableArray( - res.body.map(function (row) { - return row.length; - }), - ), - ), - ); - res.cols = new Array(numCols).fill({ type: "align", align: colAlign }); - return delimiters - ? { - type: "leftright", - mode: context.mode, - body: [res], - left: delimiters[0], - right: delimiters[1], - rightColor: undefined, - } - : res; - }, - htmlBuilder: htmlBuilder$6, - mathmlBuilder: mathmlBuilder$5, - }); - defineEnvironment({ - type: "array", - names: ["smallmatrix"], - props: { numArgs: 0 }, - handler: function handler(context) { - var payload = { arraystretch: 0.5 }; - var res = parseArray(context.parser, payload, "script"); - res.colSeparationType = "small"; - return res; - }, - htmlBuilder: htmlBuilder$6, - mathmlBuilder: mathmlBuilder$5, - }); - defineEnvironment({ - type: "array", - names: ["subarray"], - props: { numArgs: 1 }, - handler: function handler(context, args) { - var symNode = checkSymbolNodeType(args[0]); - var colalign = symNode - ? [args[0]] - : assertNodeType(args[0], "ordgroup").body; - var cols = colalign.map(function (nde) { - var node = assertSymbolNodeType(nde); - var ca = node.text; - if ("lc".indexOf(ca) !== -1) { - return { type: "align", align: ca }; - } - throw new ParseError("Unknown column alignment: " + ca, nde); - }); - if (cols.length > 1) { - throw new ParseError("{subarray} can contain only one column"); - } - var res = { cols: cols, hskipBeforeAndAfter: false, arraystretch: 0.5 }; - res = parseArray(context.parser, res, "script"); - if (res.body.length > 0 && res.body[0].length > 1) { - throw new ParseError("{subarray} can contain only one column"); - } - return res; - }, - htmlBuilder: htmlBuilder$6, - mathmlBuilder: mathmlBuilder$5, - }); - defineEnvironment({ - type: "array", - names: ["cases", "dcases", "rcases", "drcases"], - props: { numArgs: 0 }, - handler: function handler(context) { - var payload = { - arraystretch: 1.2, - cols: [ - { type: "align", align: "l", pregap: 0, postgap: 1 }, - { type: "align", align: "l", pregap: 0, postgap: 0 }, - ], - }; - var res = parseArray( - context.parser, - payload, - dCellStyle(context.envName), - ); - return { - type: "leftright", - mode: context.mode, - body: [res], - left: context.envName.indexOf("r") > -1 ? "." : "\\{", - right: context.envName.indexOf("r") > -1 ? "\\}" : ".", - rightColor: undefined, - }; - }, - htmlBuilder: htmlBuilder$6, - mathmlBuilder: mathmlBuilder$5, - }); - defineEnvironment({ - type: "array", - names: ["align", "align*", "aligned", "split"], - props: { numArgs: 0 }, - handler: alignedHandler, - htmlBuilder: htmlBuilder$6, - mathmlBuilder: mathmlBuilder$5, - }); - defineEnvironment({ - type: "array", - names: ["gathered", "gather", "gather*"], - props: { numArgs: 0 }, - handler: function handler(context) { - if (utils.contains(["gather", "gather*"], context.envName)) { - validateAmsEnvironmentContext(context); - } - var res = { - cols: [{ type: "align", align: "c" }], - addJot: true, - colSeparationType: "gather", - autoTag: getAutoTag(context.envName), - emptySingleRow: true, - leqno: context.parser.settings.leqno, - }; - return parseArray(context.parser, res, "display"); - }, - htmlBuilder: htmlBuilder$6, - mathmlBuilder: mathmlBuilder$5, - }); - defineEnvironment({ - type: "array", - names: ["alignat", "alignat*", "alignedat"], - props: { numArgs: 1 }, - handler: alignedHandler, - htmlBuilder: htmlBuilder$6, - mathmlBuilder: mathmlBuilder$5, - }); - defineEnvironment({ - type: "array", - names: ["equation", "equation*"], - props: { numArgs: 0 }, - handler: function handler(context) { - validateAmsEnvironmentContext(context); - var res = { - autoTag: getAutoTag(context.envName), - emptySingleRow: true, - singleRow: true, - maxNumCols: 1, - leqno: context.parser.settings.leqno, - }; - return parseArray(context.parser, res, "display"); - }, - htmlBuilder: htmlBuilder$6, - mathmlBuilder: mathmlBuilder$5, - }); - defineEnvironment({ - type: "array", - names: ["CD"], - props: { numArgs: 0 }, - handler: function handler(context) { - validateAmsEnvironmentContext(context); - return parseCD(context.parser); - }, - htmlBuilder: htmlBuilder$6, - mathmlBuilder: mathmlBuilder$5, - }); - defineMacro("\\nonumber", "\\gdef\\@eqnsw{0}"); - defineMacro("\\notag", "\\nonumber"); - defineFunction({ - type: "text", - names: ["\\hline", "\\hdashline"], - props: { numArgs: 0, allowedInText: true, allowedInMath: true }, - handler: function handler(context, args) { - throw new ParseError( - context.funcName + " valid only within array environment", - ); - }, - }); - var environments = _environments; - defineFunction({ - type: "environment", - names: ["\\begin", "\\end"], - props: { numArgs: 1, argTypes: ["text"] }, - handler: function handler(_ref, args) { - var parser = _ref.parser, - funcName = _ref.funcName; - var nameGroup = args[0]; - if (nameGroup.type !== "ordgroup") { - throw new ParseError("Invalid environment name", nameGroup); - } - var envName = ""; - for (var i = 0; i < nameGroup.body.length; ++i) { - envName += assertNodeType(nameGroup.body[i], "textord").text; - } - if (funcName === "\\begin") { - if (!environments.hasOwnProperty(envName)) { - throw new ParseError("No such environment: " + envName, nameGroup); - } - var env = environments[envName]; - var _parser$parseArgument = parser.parseArguments( - "\\begin{" + envName + "}", - env, - ), - _args = _parser$parseArgument.args, - optArgs = _parser$parseArgument.optArgs; - var context = { mode: parser.mode, envName: envName, parser: parser }; - var result = env.handler(context, _args, optArgs); - parser.expect("\\end", false); - var endNameToken = parser.nextToken; - var end = assertNodeType(parser.parseFunction(), "environment"); - if (end.name !== envName) { - throw new ParseError( - "Mismatch: \\begin{" + - envName + - "} matched by \\end{" + - end.name + - "}", - endNameToken, - ); - } - return result; - } - return { - type: "environment", - mode: parser.mode, - name: envName, - nameGroup: nameGroup, - }; - }, - }); - var htmlBuilder$5 = function htmlBuilder$5(group, options) { - var font = group.font; - var newOptions = options.withFont(font); - return buildGroup$1(group.body, newOptions); - }; - var mathmlBuilder$4 = function mathmlBuilder$4(group, options) { - var font = group.font; - var newOptions = options.withFont(font); - return buildGroup(group.body, newOptions); - }; - var fontAliases = { - "\\Bbb": "\\mathbb", - "\\bold": "\\mathbf", - "\\frak": "\\mathfrak", - "\\bm": "\\boldsymbol", - }; - defineFunction({ - type: "font", - names: [ - "\\mathrm", - "\\mathit", - "\\mathbf", - "\\mathnormal", - "\\mathsfit", - "\\mathbb", - "\\mathcal", - "\\mathfrak", - "\\mathscr", - "\\mathsf", - "\\mathtt", - "\\Bbb", - "\\bold", - "\\frak", - ], - props: { numArgs: 1, allowedInArgument: true }, - handler: function handler(_ref, args) { - var parser = _ref.parser, - funcName = _ref.funcName; - var body = normalizeArgument(args[0]); - var func = funcName; - if (func in fontAliases) { - func = fontAliases[func]; - } - return { - type: "font", - mode: parser.mode, - font: func.slice(1), - body: body, - }; - }, - htmlBuilder: htmlBuilder$5, - mathmlBuilder: mathmlBuilder$4, - }); - defineFunction({ - type: "mclass", - names: ["\\boldsymbol", "\\bm"], - props: { numArgs: 1 }, - handler: function handler(_ref2, args) { - var parser = _ref2.parser; - var body = args[0]; - var isCharacterBox = utils.isCharacterBox(body); - return { - type: "mclass", - mode: parser.mode, - mclass: binrelClass(body), - body: [ - { type: "font", mode: parser.mode, font: "boldsymbol", body: body }, - ], - isCharacterBox: isCharacterBox, - }; - }, - }); - defineFunction({ - type: "font", - names: ["\\rm", "\\sf", "\\tt", "\\bf", "\\it", "\\cal"], - props: { numArgs: 0, allowedInText: true }, - handler: function handler(_ref3, args) { - var parser = _ref3.parser, - funcName = _ref3.funcName, - breakOnTokenText = _ref3.breakOnTokenText; - var mode = parser.mode; - var body = parser.parseExpression(true, breakOnTokenText); - var style = "math" + funcName.slice(1); - return { - type: "font", - mode: mode, - font: style, - body: { type: "ordgroup", mode: parser.mode, body: body }, - }; - }, - htmlBuilder: htmlBuilder$5, - mathmlBuilder: mathmlBuilder$4, - }); - var adjustStyle = function adjustStyle(size, originalStyle) { - var style = originalStyle; - if (size === "display") { - style = style.id >= Style$1.SCRIPT.id ? style.text() : Style$1.DISPLAY; - } else if (size === "text" && style.size === Style$1.DISPLAY.size) { - style = Style$1.TEXT; - } else if (size === "script") { - style = Style$1.SCRIPT; - } else if (size === "scriptscript") { - style = Style$1.SCRIPTSCRIPT; - } - return style; - }; - var htmlBuilder$4 = function htmlBuilder$4(group, options) { - var style = adjustStyle(group.size, options.style); - var nstyle = style.fracNum(); - var dstyle = style.fracDen(); - var newOptions; - newOptions = options.havingStyle(nstyle); - var numerm = buildGroup$1(group.numer, newOptions, options); - if (group.continued) { - var hStrut = 8.5 / options.fontMetrics().ptPerEm; - var dStrut = 3.5 / options.fontMetrics().ptPerEm; - numerm.height = numerm.height < hStrut ? hStrut : numerm.height; - numerm.depth = numerm.depth < dStrut ? dStrut : numerm.depth; - } - newOptions = options.havingStyle(dstyle); - var denomm = buildGroup$1(group.denom, newOptions, options); - var rule; - var ruleWidth; - var ruleSpacing; - if (group.hasBarLine) { - if (group.barSize) { - ruleWidth = calculateSize(group.barSize, options); - rule = buildCommon.makeLineSpan("frac-line", options, ruleWidth); - } else { - rule = buildCommon.makeLineSpan("frac-line", options); - } - ruleWidth = rule.height; - ruleSpacing = rule.height; - } else { - rule = null; - ruleWidth = 0; - ruleSpacing = options.fontMetrics().defaultRuleThickness; - } - var numShift; - var clearance; - var denomShift; - if (style.size === Style$1.DISPLAY.size || group.size === "display") { - numShift = options.fontMetrics().num1; - if (ruleWidth > 0) { - clearance = 3 * ruleSpacing; - } else { - clearance = 7 * ruleSpacing; - } - denomShift = options.fontMetrics().denom1; - } else { - if (ruleWidth > 0) { - numShift = options.fontMetrics().num2; - clearance = ruleSpacing; - } else { - numShift = options.fontMetrics().num3; - clearance = 3 * ruleSpacing; - } - denomShift = options.fontMetrics().denom2; - } - var frac; - if (!rule) { - var candidateClearance = - numShift - numerm.depth - (denomm.height - denomShift); - if (candidateClearance < clearance) { - numShift += 0.5 * (clearance - candidateClearance); - denomShift += 0.5 * (clearance - candidateClearance); - } - frac = buildCommon.makeVList( - { - positionType: "individualShift", - children: [ - { type: "elem", elem: denomm, shift: denomShift }, - { type: "elem", elem: numerm, shift: -numShift }, - ], - }, - options, - ); - } else { - var axisHeight = options.fontMetrics().axisHeight; - if ( - numShift - numerm.depth - (axisHeight + 0.5 * ruleWidth) < - clearance - ) { - numShift += - clearance - - (numShift - numerm.depth - (axisHeight + 0.5 * ruleWidth)); - } - if ( - axisHeight - 0.5 * ruleWidth - (denomm.height - denomShift) < - clearance - ) { - denomShift += - clearance - - (axisHeight - 0.5 * ruleWidth - (denomm.height - denomShift)); - } - var midShift = -(axisHeight - 0.5 * ruleWidth); - frac = buildCommon.makeVList( - { - positionType: "individualShift", - children: [ - { type: "elem", elem: denomm, shift: denomShift }, - { type: "elem", elem: rule, shift: midShift }, - { type: "elem", elem: numerm, shift: -numShift }, - ], - }, - options, - ); - } - newOptions = options.havingStyle(style); - frac.height *= newOptions.sizeMultiplier / options.sizeMultiplier; - frac.depth *= newOptions.sizeMultiplier / options.sizeMultiplier; - var delimSize; - if (style.size === Style$1.DISPLAY.size) { - delimSize = options.fontMetrics().delim1; - } else if (style.size === Style$1.SCRIPTSCRIPT.size) { - delimSize = options.havingStyle(Style$1.SCRIPT).fontMetrics().delim2; - } else { - delimSize = options.fontMetrics().delim2; - } - var leftDelim; - var rightDelim; - if (group.leftDelim == null) { - leftDelim = makeNullDelimiter(options, ["mopen"]); - } else { - leftDelim = delimiter.customSizedDelim( - group.leftDelim, - delimSize, - true, - options.havingStyle(style), - group.mode, - ["mopen"], - ); - } - if (group.continued) { - rightDelim = buildCommon.makeSpan([]); - } else if (group.rightDelim == null) { - rightDelim = makeNullDelimiter(options, ["mclose"]); - } else { - rightDelim = delimiter.customSizedDelim( - group.rightDelim, - delimSize, - true, - options.havingStyle(style), - group.mode, - ["mclose"], - ); - } - return buildCommon.makeSpan( - ["mord"].concat(newOptions.sizingClasses(options)), - [leftDelim, buildCommon.makeSpan(["mfrac"], [frac]), rightDelim], - options, - ); - }; - var mathmlBuilder$3 = function mathmlBuilder$3(group, options) { - var node = new mathMLTree.MathNode("mfrac", [ - buildGroup(group.numer, options), - buildGroup(group.denom, options), - ]); - if (!group.hasBarLine) { - node.setAttribute("linethickness", "0px"); - } else if (group.barSize) { - var ruleWidth = calculateSize(group.barSize, options); - node.setAttribute("linethickness", makeEm(ruleWidth)); - } - var style = adjustStyle(group.size, options.style); - if (style.size !== options.style.size) { - node = new mathMLTree.MathNode("mstyle", [node]); - var isDisplay = style.size === Style$1.DISPLAY.size ? "true" : "false"; - node.setAttribute("displaystyle", isDisplay); - node.setAttribute("scriptlevel", "0"); - } - if (group.leftDelim != null || group.rightDelim != null) { - var withDelims = []; - if (group.leftDelim != null) { - var leftOp = new mathMLTree.MathNode("mo", [ - new mathMLTree.TextNode(group.leftDelim.replace("\\", "")), - ]); - leftOp.setAttribute("fence", "true"); - withDelims.push(leftOp); - } - withDelims.push(node); - if (group.rightDelim != null) { - var rightOp = new mathMLTree.MathNode("mo", [ - new mathMLTree.TextNode(group.rightDelim.replace("\\", "")), - ]); - rightOp.setAttribute("fence", "true"); - withDelims.push(rightOp); - } - return makeRow(withDelims); - } - return node; - }; - defineFunction({ - type: "genfrac", - names: [ - "\\dfrac", - "\\frac", - "\\tfrac", - "\\dbinom", - "\\binom", - "\\tbinom", - "\\\\atopfrac", - "\\\\bracefrac", - "\\\\brackfrac", - ], - props: { numArgs: 2, allowedInArgument: true }, - handler: function handler(_ref, args) { - var parser = _ref.parser, - funcName = _ref.funcName; - var numer = args[0]; - var denom = args[1]; - var hasBarLine; - var leftDelim = null; - var rightDelim = null; - var size = "auto"; - switch (funcName) { - case "\\dfrac": - case "\\frac": - case "\\tfrac": - hasBarLine = true; - break; - case "\\\\atopfrac": - hasBarLine = false; - break; - case "\\dbinom": - case "\\binom": - case "\\tbinom": - hasBarLine = false; - leftDelim = "("; - rightDelim = ")"; - break; - case "\\\\bracefrac": - hasBarLine = false; - leftDelim = "\\{"; - rightDelim = "\\}"; - break; - case "\\\\brackfrac": - hasBarLine = false; - leftDelim = "["; - rightDelim = "]"; - break; - default: - throw new Error("Unrecognized genfrac command"); - } - switch (funcName) { - case "\\dfrac": - case "\\dbinom": - size = "display"; - break; - case "\\tfrac": - case "\\tbinom": - size = "text"; - break; - } - return { - type: "genfrac", - mode: parser.mode, - continued: false, - numer: numer, - denom: denom, - hasBarLine: hasBarLine, - leftDelim: leftDelim, - rightDelim: rightDelim, - size: size, - barSize: null, - }; - }, - htmlBuilder: htmlBuilder$4, - mathmlBuilder: mathmlBuilder$3, - }); - defineFunction({ - type: "genfrac", - names: ["\\cfrac"], - props: { numArgs: 2 }, - handler: function handler(_ref2, args) { - var parser = _ref2.parser, - funcName = _ref2.funcName; - var numer = args[0]; - var denom = args[1]; - return { - type: "genfrac", - mode: parser.mode, - continued: true, - numer: numer, - denom: denom, - hasBarLine: true, - leftDelim: null, - rightDelim: null, - size: "display", - barSize: null, - }; - }, - }); - defineFunction({ - type: "infix", - names: ["\\over", "\\choose", "\\atop", "\\brace", "\\brack"], - props: { numArgs: 0, infix: true }, - handler: function handler(_ref3) { - var parser = _ref3.parser, - funcName = _ref3.funcName, - token = _ref3.token; - var replaceWith; - switch (funcName) { - case "\\over": - replaceWith = "\\frac"; - break; - case "\\choose": - replaceWith = "\\binom"; - break; - case "\\atop": - replaceWith = "\\\\atopfrac"; - break; - case "\\brace": - replaceWith = "\\\\bracefrac"; - break; - case "\\brack": - replaceWith = "\\\\brackfrac"; - break; - default: - throw new Error("Unrecognized infix genfrac command"); - } - return { - type: "infix", - mode: parser.mode, - replaceWith: replaceWith, - token: token, - }; - }, - }); - var stylArray = ["display", "text", "script", "scriptscript"]; - var delimFromValue = function delimFromValue(delimString) { - var delim = null; - if (delimString.length > 0) { - delim = delimString; - delim = delim === "." ? null : delim; - } - return delim; - }; - defineFunction({ - type: "genfrac", - names: ["\\genfrac"], - props: { - numArgs: 6, - allowedInArgument: true, - argTypes: ["math", "math", "size", "text", "math", "math"], - }, - handler: function handler(_ref4, args) { - var parser = _ref4.parser; - var numer = args[4]; - var denom = args[5]; - var leftNode = normalizeArgument(args[0]); - var leftDelim = - leftNode.type === "atom" && leftNode.family === "open" - ? delimFromValue(leftNode.text) - : null; - var rightNode = normalizeArgument(args[1]); - var rightDelim = - rightNode.type === "atom" && rightNode.family === "close" - ? delimFromValue(rightNode.text) - : null; - var barNode = assertNodeType(args[2], "size"); - var hasBarLine; - var barSize = null; - if (barNode.isBlank) { - hasBarLine = true; - } else { - barSize = barNode.value; - hasBarLine = barSize.number > 0; - } - var size = "auto"; - var styl = args[3]; - if (styl.type === "ordgroup") { - if (styl.body.length > 0) { - var textOrd = assertNodeType(styl.body[0], "textord"); - size = stylArray[Number(textOrd.text)]; - } - } else { - styl = assertNodeType(styl, "textord"); - size = stylArray[Number(styl.text)]; - } - return { - type: "genfrac", - mode: parser.mode, - numer: numer, - denom: denom, - continued: false, - hasBarLine: hasBarLine, - barSize: barSize, - leftDelim: leftDelim, - rightDelim: rightDelim, - size: size, - }; - }, - htmlBuilder: htmlBuilder$4, - mathmlBuilder: mathmlBuilder$3, - }); - defineFunction({ - type: "infix", - names: ["\\above"], - props: { numArgs: 1, argTypes: ["size"], infix: true }, - handler: function handler(_ref5, args) { - var parser = _ref5.parser, - funcName = _ref5.funcName, - token = _ref5.token; - return { - type: "infix", - mode: parser.mode, - replaceWith: "\\\\abovefrac", - size: assertNodeType(args[0], "size").value, - token: token, - }; - }, - }); - defineFunction({ - type: "genfrac", - names: ["\\\\abovefrac"], - props: { numArgs: 3, argTypes: ["math", "size", "math"] }, - handler: function handler(_ref6, args) { - var parser = _ref6.parser, - funcName = _ref6.funcName; - var numer = args[0]; - var barSize = assert(assertNodeType(args[1], "infix").size); - var denom = args[2]; - var hasBarLine = barSize.number > 0; - return { - type: "genfrac", - mode: parser.mode, - numer: numer, - denom: denom, - continued: false, - hasBarLine: hasBarLine, - barSize: barSize, - leftDelim: null, - rightDelim: null, - size: "auto", - }; - }, - htmlBuilder: htmlBuilder$4, - mathmlBuilder: mathmlBuilder$3, - }); - var htmlBuilder$3 = function htmlBuilder$3(grp, options) { - var style = options.style; - var supSubGroup; - var group; - if (grp.type === "supsub") { - supSubGroup = grp.sup - ? buildGroup$1(grp.sup, options.havingStyle(style.sup()), options) - : buildGroup$1(grp.sub, options.havingStyle(style.sub()), options); - group = assertNodeType(grp.base, "horizBrace"); - } else { - group = assertNodeType(grp, "horizBrace"); - } - var body = buildGroup$1( - group.base, - options.havingBaseStyle(Style$1.DISPLAY), - ); - var braceBody = stretchy.svgSpan(group, options); - var vlist; - if (group.isOver) { - vlist = buildCommon.makeVList( - { - positionType: "firstBaseline", - children: [ - { type: "elem", elem: body }, - { type: "kern", size: 0.1 }, - { type: "elem", elem: braceBody }, - ], - }, - options, - ); - vlist.children[0].children[0].children[1].classes.push("svg-align"); - } else { - vlist = buildCommon.makeVList( - { - positionType: "bottom", - positionData: body.depth + 0.1 + braceBody.height, - children: [ - { type: "elem", elem: braceBody }, - { type: "kern", size: 0.1 }, - { type: "elem", elem: body }, - ], - }, - options, - ); - vlist.children[0].children[0].children[0].classes.push("svg-align"); - } - if (supSubGroup) { - var vSpan = buildCommon.makeSpan( - ["mord", group.isOver ? "mover" : "munder"], - [vlist], - options, - ); - if (group.isOver) { - vlist = buildCommon.makeVList( - { - positionType: "firstBaseline", - children: [ - { type: "elem", elem: vSpan }, - { type: "kern", size: 0.2 }, - { type: "elem", elem: supSubGroup }, - ], - }, - options, - ); - } else { - vlist = buildCommon.makeVList( - { - positionType: "bottom", - positionData: - vSpan.depth + 0.2 + supSubGroup.height + supSubGroup.depth, - children: [ - { type: "elem", elem: supSubGroup }, - { type: "kern", size: 0.2 }, - { type: "elem", elem: vSpan }, - ], - }, - options, - ); - } - } - return buildCommon.makeSpan( - ["mord", group.isOver ? "mover" : "munder"], - [vlist], - options, - ); - }; - var mathmlBuilder$2 = function mathmlBuilder$2(group, options) { - var accentNode = stretchy.mathMLnode(group.label); - return new mathMLTree.MathNode(group.isOver ? "mover" : "munder", [ - buildGroup(group.base, options), - accentNode, - ]); - }; - defineFunction({ - type: "horizBrace", - names: ["\\overbrace", "\\underbrace"], - props: { numArgs: 1 }, - handler: function handler(_ref, args) { - var parser = _ref.parser, - funcName = _ref.funcName; - return { - type: "horizBrace", - mode: parser.mode, - label: funcName, - isOver: /^\\over/.test(funcName), - base: args[0], - }; - }, - htmlBuilder: htmlBuilder$3, - mathmlBuilder: mathmlBuilder$2, - }); - defineFunction({ - type: "href", - names: ["\\href"], - props: { numArgs: 2, argTypes: ["url", "original"], allowedInText: true }, - handler: function handler(_ref, args) { - var parser = _ref.parser; - var body = args[1]; - var href = assertNodeType(args[0], "url").url; - if (!parser.settings.isTrusted({ command: "\\href", url: href })) { - return parser.formatUnsupportedCmd("\\href"); - } - return { - type: "href", - mode: parser.mode, - href: href, - body: ordargument(body), - }; - }, - htmlBuilder: function htmlBuilder(group, options) { - var elements = buildExpression$1(group.body, options, false); - return buildCommon.makeAnchor(group.href, [], elements, options); - }, - mathmlBuilder: function mathmlBuilder(group, options) { - var math = buildExpressionRow(group.body, options); - if (!(math instanceof MathNode)) { - math = new MathNode("mrow", [math]); - } - math.setAttribute("href", group.href); - return math; - }, - }); - defineFunction({ - type: "href", - names: ["\\url"], - props: { numArgs: 1, argTypes: ["url"], allowedInText: true }, - handler: function handler(_ref2, args) { - var parser = _ref2.parser; - var href = assertNodeType(args[0], "url").url; - if (!parser.settings.isTrusted({ command: "\\url", url: href })) { - return parser.formatUnsupportedCmd("\\url"); - } - var chars = []; - for (var i = 0; i < href.length; i++) { - var c = href[i]; - if (c === "~") { - c = "\\textasciitilde"; - } - chars.push({ type: "textord", mode: "text", text: c }); - } - var body = { - type: "text", - mode: parser.mode, - font: "\\texttt", - body: chars, - }; - return { - type: "href", - mode: parser.mode, - href: href, - body: ordargument(body), - }; - }, - }); - defineFunction({ - type: "hbox", - names: ["\\hbox"], - props: { - numArgs: 1, - argTypes: ["text"], - allowedInText: true, - primitive: true, - }, - handler: function handler(_ref, args) { - var parser = _ref.parser; - return { type: "hbox", mode: parser.mode, body: ordargument(args[0]) }; - }, - htmlBuilder: function htmlBuilder(group, options) { - var elements = buildExpression$1(group.body, options, false); - return buildCommon.makeFragment(elements); - }, - mathmlBuilder: function mathmlBuilder(group, options) { - return new mathMLTree.MathNode( - "mrow", - buildExpression(group.body, options), - ); - }, - }); - defineFunction({ - type: "html", - names: ["\\htmlClass", "\\htmlId", "\\htmlStyle", "\\htmlData"], - props: { numArgs: 2, argTypes: ["raw", "original"], allowedInText: true }, - handler: function handler(_ref, args) { - var parser = _ref.parser, - funcName = _ref.funcName, - token = _ref.token; - var value = assertNodeType(args[0], "raw").string; - var body = args[1]; - if (parser.settings.strict) { - parser.settings.reportNonstrict( - "htmlExtension", - "HTML extension is disabled on strict mode", - ); - } - var trustContext; - var attributes = {}; - switch (funcName) { - case "\\htmlClass": - attributes["class"] = value; - trustContext = { command: "\\htmlClass", class: value }; - break; - case "\\htmlId": - attributes.id = value; - trustContext = { command: "\\htmlId", id: value }; - break; - case "\\htmlStyle": - attributes.style = value; - trustContext = { command: "\\htmlStyle", style: value }; - break; - case "\\htmlData": { - var data = value.split(","); - for (var i = 0; i < data.length; i++) { - var keyVal = data[i].split("="); - if (keyVal.length !== 2) { - throw new ParseError("Error parsing key-value for \\htmlData"); - } - attributes["data-" + keyVal[0].trim()] = keyVal[1].trim(); - } - trustContext = { command: "\\htmlData", attributes: attributes }; - break; - } - default: - throw new Error("Unrecognized html command"); - } - if (!parser.settings.isTrusted(trustContext)) { - return parser.formatUnsupportedCmd(funcName); - } - return { - type: "html", - mode: parser.mode, - attributes: attributes, - body: ordargument(body), - }; - }, - htmlBuilder: function htmlBuilder(group, options) { - var elements = buildExpression$1(group.body, options, false); - var classes = ["enclosing"]; - if (group.attributes["class"]) { - classes.push.apply( - classes, - _toConsumableArray(group.attributes["class"].trim().split(/\s+/)), - ); - } - var span = buildCommon.makeSpan(classes, elements, options); - for (var attr in group.attributes) { - if (attr !== "class" && group.attributes.hasOwnProperty(attr)) { - span.setAttribute(attr, group.attributes[attr]); - } - } - return span; - }, - mathmlBuilder: function mathmlBuilder(group, options) { - return buildExpressionRow(group.body, options); - }, - }); - defineFunction({ - type: "htmlmathml", - names: ["\\html@mathml"], - props: { numArgs: 2, allowedInText: true }, - handler: function handler(_ref, args) { - var parser = _ref.parser; - return { - type: "htmlmathml", - mode: parser.mode, - html: ordargument(args[0]), - mathml: ordargument(args[1]), - }; - }, - htmlBuilder: function htmlBuilder(group, options) { - var elements = buildExpression$1(group.html, options, false); - return buildCommon.makeFragment(elements); - }, - mathmlBuilder: function mathmlBuilder(group, options) { - return buildExpressionRow(group.mathml, options); - }, - }); - var sizeData = function sizeData(str) { - if (/^[-+]? *(\d+(\.\d*)?|\.\d+)$/.test(str)) { - return { number: +str, unit: "bp" }; - } else { - var match = /([-+]?) *(\d+(?:\.\d*)?|\.\d+) *([a-z]{2})/.exec(str); - if (!match) { - throw new ParseError( - "Invalid size: '" + str + "' in \\includegraphics", - ); - } - var data = { number: +(match[1] + match[2]), unit: match[3] }; - if (!validUnit(data)) { - throw new ParseError( - "Invalid unit: '" + data.unit + "' in \\includegraphics.", - ); - } - return data; - } - }; - defineFunction({ - type: "includegraphics", - names: ["\\includegraphics"], - props: { - numArgs: 1, - numOptionalArgs: 1, - argTypes: ["raw", "url"], - allowedInText: false, - }, - handler: function handler(_ref, args, optArgs) { - var parser = _ref.parser; - var width = { number: 0, unit: "em" }; - var height = { number: 0.9, unit: "em" }; - var totalheight = { number: 0, unit: "em" }; - var alt = ""; - if (optArgs[0]) { - var attributeStr = assertNodeType(optArgs[0], "raw").string; - var attributes = attributeStr.split(","); - for (var i = 0; i < attributes.length; i++) { - var keyVal = attributes[i].split("="); - if (keyVal.length === 2) { - var str = keyVal[1].trim(); - switch (keyVal[0].trim()) { - case "alt": - alt = str; - break; - case "width": - width = sizeData(str); - break; - case "height": - height = sizeData(str); - break; - case "totalheight": - totalheight = sizeData(str); - break; - default: - throw new ParseError( - "Invalid key: '" + keyVal[0] + "' in \\includegraphics.", - ); - } - } - } - } - var src = assertNodeType(args[0], "url").url; - if (alt === "") { - alt = src; - alt = alt.replace(/^.*[\\/]/, ""); - alt = alt.substring(0, alt.lastIndexOf(".")); - } - if ( - !parser.settings.isTrusted({ command: "\\includegraphics", url: src }) - ) { - return parser.formatUnsupportedCmd("\\includegraphics"); - } - return { - type: "includegraphics", - mode: parser.mode, - alt: alt, - width: width, - height: height, - totalheight: totalheight, - src: src, - }; - }, - htmlBuilder: function htmlBuilder(group, options) { - var height = calculateSize(group.height, options); - var depth = 0; - if (group.totalheight.number > 0) { - depth = calculateSize(group.totalheight, options) - height; - } - var width = 0; - if (group.width.number > 0) { - width = calculateSize(group.width, options); - } - var style = { height: makeEm(height + depth) }; - if (width > 0) { - style.width = makeEm(width); - } - if (depth > 0) { - style.verticalAlign = makeEm(-depth); - } - var node = new Img(group.src, group.alt, style); - node.height = height; - node.depth = depth; - return node; - }, - mathmlBuilder: function mathmlBuilder(group, options) { - var node = new mathMLTree.MathNode("mglyph", []); - node.setAttribute("alt", group.alt); - var height = calculateSize(group.height, options); - var depth = 0; - if (group.totalheight.number > 0) { - depth = calculateSize(group.totalheight, options) - height; - node.setAttribute("valign", makeEm(-depth)); - } - node.setAttribute("height", makeEm(height + depth)); - if (group.width.number > 0) { - var width = calculateSize(group.width, options); - node.setAttribute("width", makeEm(width)); - } - node.setAttribute("src", group.src); - return node; - }, - }); - defineFunction({ - type: "kern", - names: ["\\kern", "\\mkern", "\\hskip", "\\mskip"], - props: { - numArgs: 1, - argTypes: ["size"], - primitive: true, - allowedInText: true, - }, - handler: function handler(_ref, args) { - var parser = _ref.parser, - funcName = _ref.funcName; - var size = assertNodeType(args[0], "size"); - if (parser.settings.strict) { - var mathFunction = funcName[1] === "m"; - var muUnit = size.value.unit === "mu"; - if (mathFunction) { - if (!muUnit) { - parser.settings.reportNonstrict( - "mathVsTextUnits", - "LaTeX's " + - funcName + - " supports only mu units, " + - ("not " + size.value.unit + " units"), - ); - } - if (parser.mode !== "math") { - parser.settings.reportNonstrict( - "mathVsTextUnits", - "LaTeX's " + funcName + " works only in math mode", - ); - } - } else { - if (muUnit) { - parser.settings.reportNonstrict( - "mathVsTextUnits", - "LaTeX's " + funcName + " doesn't support mu units", - ); - } - } - } - return { type: "kern", mode: parser.mode, dimension: size.value }; - }, - htmlBuilder: function htmlBuilder(group, options) { - return buildCommon.makeGlue(group.dimension, options); - }, - mathmlBuilder: function mathmlBuilder(group, options) { - var dimension = calculateSize(group.dimension, options); - return new mathMLTree.SpaceNode(dimension); - }, - }); - defineFunction({ - type: "lap", - names: ["\\mathllap", "\\mathrlap", "\\mathclap"], - props: { numArgs: 1, allowedInText: true }, - handler: function handler(_ref, args) { - var parser = _ref.parser, - funcName = _ref.funcName; - var body = args[0]; - return { - type: "lap", - mode: parser.mode, - alignment: funcName.slice(5), - body: body, - }; - }, - htmlBuilder: function htmlBuilder(group, options) { - var inner; - if (group.alignment === "clap") { - inner = buildCommon.makeSpan([], [buildGroup$1(group.body, options)]); - inner = buildCommon.makeSpan(["inner"], [inner], options); - } else { - inner = buildCommon.makeSpan( - ["inner"], - [buildGroup$1(group.body, options)], - ); - } - var fix = buildCommon.makeSpan(["fix"], []); - var node = buildCommon.makeSpan([group.alignment], [inner, fix], options); - var strut = buildCommon.makeSpan(["strut"]); - strut.style.height = makeEm(node.height + node.depth); - if (node.depth) { - strut.style.verticalAlign = makeEm(-node.depth); - } - node.children.unshift(strut); - node = buildCommon.makeSpan(["thinbox"], [node], options); - return buildCommon.makeSpan(["mord", "vbox"], [node], options); - }, - mathmlBuilder: function mathmlBuilder(group, options) { - var node = new mathMLTree.MathNode("mpadded", [ - buildGroup(group.body, options), - ]); - if (group.alignment !== "rlap") { - var offset = group.alignment === "llap" ? "-1" : "-0.5"; - node.setAttribute("lspace", offset + "width"); - } - node.setAttribute("width", "0px"); - return node; - }, - }); - defineFunction({ - type: "styling", - names: ["\\(", "$"], - props: { numArgs: 0, allowedInText: true, allowedInMath: false }, - handler: function handler(_ref, args) { - var funcName = _ref.funcName, - parser = _ref.parser; - var outerMode = parser.mode; - parser.switchMode("math"); - var close = funcName === "\\(" ? "\\)" : "$"; - var body = parser.parseExpression(false, close); - parser.expect(close); - parser.switchMode(outerMode); - return { type: "styling", mode: parser.mode, style: "text", body: body }; - }, - }); - defineFunction({ - type: "text", - names: ["\\)", "\\]"], - props: { numArgs: 0, allowedInText: true, allowedInMath: false }, - handler: function handler(context, args) { - throw new ParseError("Mismatched " + context.funcName); - }, - }); - var chooseMathStyle = function chooseMathStyle(group, options) { - switch (options.style.size) { - case Style$1.DISPLAY.size: - return group.display; - case Style$1.TEXT.size: - return group.text; - case Style$1.SCRIPT.size: - return group.script; - case Style$1.SCRIPTSCRIPT.size: - return group.scriptscript; - default: - return group.text; - } - }; - defineFunction({ - type: "mathchoice", - names: ["\\mathchoice"], - props: { numArgs: 4, primitive: true }, - handler: function handler(_ref, args) { - var parser = _ref.parser; - return { - type: "mathchoice", - mode: parser.mode, - display: ordargument(args[0]), - text: ordargument(args[1]), - script: ordargument(args[2]), - scriptscript: ordargument(args[3]), - }; - }, - htmlBuilder: function htmlBuilder(group, options) { - var body = chooseMathStyle(group, options); - var elements = buildExpression$1(body, options, false); - return buildCommon.makeFragment(elements); - }, - mathmlBuilder: function mathmlBuilder(group, options) { - var body = chooseMathStyle(group, options); - return buildExpressionRow(body, options); - }, - }); - var assembleSupSub = function assembleSupSub( - base, - supGroup, - subGroup, - options, - style, - slant, - baseShift, - ) { - base = buildCommon.makeSpan([], [base]); - var subIsSingleCharacter = subGroup && utils.isCharacterBox(subGroup); - var sub; - var sup; - if (supGroup) { - var elem = buildGroup$1( - supGroup, - options.havingStyle(style.sup()), - options, - ); - sup = { - elem: elem, - kern: Math.max( - options.fontMetrics().bigOpSpacing1, - options.fontMetrics().bigOpSpacing3 - elem.depth, - ), - }; - } - if (subGroup) { - var _elem = buildGroup$1( - subGroup, - options.havingStyle(style.sub()), - options, - ); - sub = { - elem: _elem, - kern: Math.max( - options.fontMetrics().bigOpSpacing2, - options.fontMetrics().bigOpSpacing4 - _elem.height, - ), - }; - } - var finalGroup; - if (sup && sub) { - var bottom = - options.fontMetrics().bigOpSpacing5 + - sub.elem.height + - sub.elem.depth + - sub.kern + - base.depth + - baseShift; - finalGroup = buildCommon.makeVList( - { - positionType: "bottom", - positionData: bottom, - children: [ - { type: "kern", size: options.fontMetrics().bigOpSpacing5 }, - { type: "elem", elem: sub.elem, marginLeft: makeEm(-slant) }, - { type: "kern", size: sub.kern }, - { type: "elem", elem: base }, - { type: "kern", size: sup.kern }, - { type: "elem", elem: sup.elem, marginLeft: makeEm(slant) }, - { type: "kern", size: options.fontMetrics().bigOpSpacing5 }, - ], - }, - options, - ); - } else if (sub) { - var top = base.height - baseShift; - finalGroup = buildCommon.makeVList( - { - positionType: "top", - positionData: top, - children: [ - { type: "kern", size: options.fontMetrics().bigOpSpacing5 }, - { type: "elem", elem: sub.elem, marginLeft: makeEm(-slant) }, - { type: "kern", size: sub.kern }, - { type: "elem", elem: base }, - ], - }, - options, - ); - } else if (sup) { - var _bottom = base.depth + baseShift; - finalGroup = buildCommon.makeVList( - { - positionType: "bottom", - positionData: _bottom, - children: [ - { type: "elem", elem: base }, - { type: "kern", size: sup.kern }, - { type: "elem", elem: sup.elem, marginLeft: makeEm(slant) }, - { type: "kern", size: options.fontMetrics().bigOpSpacing5 }, - ], - }, - options, - ); - } else { - return base; - } - var parts = [finalGroup]; - if (sub && slant !== 0 && !subIsSingleCharacter) { - var spacer = buildCommon.makeSpan(["mspace"], [], options); - spacer.style.marginRight = makeEm(slant); - parts.unshift(spacer); - } - return buildCommon.makeSpan(["mop", "op-limits"], parts, options); - }; - var noSuccessor = ["\\smallint"]; - var htmlBuilder$2 = function htmlBuilder$2(grp, options) { - var supGroup; - var subGroup; - var hasLimits = false; - var group; - if (grp.type === "supsub") { - supGroup = grp.sup; - subGroup = grp.sub; - group = assertNodeType(grp.base, "op"); - hasLimits = true; - } else { - group = assertNodeType(grp, "op"); - } - var style = options.style; - var large = false; - if ( - style.size === Style$1.DISPLAY.size && - group.symbol && - !utils.contains(noSuccessor, group.name) - ) { - large = true; - } - var base; - if (group.symbol) { - var fontName = large ? "Size2-Regular" : "Size1-Regular"; - var stash = ""; - if (group.name === "\\oiint" || group.name === "\\oiiint") { - stash = group.name.slice(1); - group.name = stash === "oiint" ? "\\iint" : "\\iiint"; - } - base = buildCommon.makeSymbol(group.name, fontName, "math", options, [ - "mop", - "op-symbol", - large ? "large-op" : "small-op", - ]); - if (stash.length > 0) { - var italic = base.italic; - var oval = buildCommon.staticSvg( - stash + "Size" + (large ? "2" : "1"), - options, - ); - base = buildCommon.makeVList( - { - positionType: "individualShift", - children: [ - { type: "elem", elem: base, shift: 0 }, - { type: "elem", elem: oval, shift: large ? 0.08 : 0 }, - ], - }, - options, - ); - group.name = "\\" + stash; - base.classes.unshift("mop"); - base.italic = italic; - } - } else if (group.body) { - var inner = buildExpression$1(group.body, options, true); - if (inner.length === 1 && inner[0] instanceof SymbolNode) { - base = inner[0]; - base.classes[0] = "mop"; - } else { - base = buildCommon.makeSpan(["mop"], inner, options); - } - } else { - var output = []; - for (var i = 1; i < group.name.length; i++) { - output.push(buildCommon.mathsym(group.name[i], group.mode, options)); - } - base = buildCommon.makeSpan(["mop"], output, options); - } - var baseShift = 0; - var slant = 0; - if ( - (base instanceof SymbolNode || - group.name === "\\oiint" || - group.name === "\\oiiint") && - !group.suppressBaseShift - ) { - baseShift = - (base.height - base.depth) / 2 - options.fontMetrics().axisHeight; - slant = base.italic; - } - if (hasLimits) { - return assembleSupSub( - base, - supGroup, - subGroup, - options, - style, - slant, - baseShift, - ); - } else { - if (baseShift) { - base.style.position = "relative"; - base.style.top = makeEm(baseShift); - } - return base; - } - }; - var mathmlBuilder$1 = function mathmlBuilder$1(group, options) { - var node; - if (group.symbol) { - node = new MathNode("mo", [makeText(group.name, group.mode)]); - if (utils.contains(noSuccessor, group.name)) { - node.setAttribute("largeop", "false"); - } - } else if (group.body) { - node = new MathNode("mo", buildExpression(group.body, options)); - } else { - node = new MathNode("mi", [new TextNode(group.name.slice(1))]); - var operator = new MathNode("mo", [makeText("\u2061", "text")]); - if (group.parentIsSupSub) { - node = new MathNode("mrow", [node, operator]); - } else { - node = newDocumentFragment([node, operator]); - } - } - return node; - }; - var singleCharBigOps = { - "\u220F": "\\prod", - "\u2210": "\\coprod", - "\u2211": "\\sum", - "\u22C0": "\\bigwedge", - "\u22C1": "\\bigvee", - "\u22C2": "\\bigcap", - "\u22C3": "\\bigcup", - "\u2A00": "\\bigodot", - "\u2A01": "\\bigoplus", - "\u2A02": "\\bigotimes", - "\u2A04": "\\biguplus", - "\u2A06": "\\bigsqcup", - }; - defineFunction({ - type: "op", - names: [ - "\\coprod", - "\\bigvee", - "\\bigwedge", - "\\biguplus", - "\\bigcap", - "\\bigcup", - "\\intop", - "\\prod", - "\\sum", - "\\bigotimes", - "\\bigoplus", - "\\bigodot", - "\\bigsqcup", - "\\smallint", - "\u220F", - "\u2210", - "\u2211", - "\u22C0", - "\u22C1", - "\u22C2", - "\u22C3", - "\u2A00", - "\u2A01", - "\u2A02", - "\u2A04", - "\u2A06", - ], - props: { numArgs: 0 }, - handler: function handler(_ref, args) { - var parser = _ref.parser, - funcName = _ref.funcName; - var fName = funcName; - if (fName.length === 1) { - fName = singleCharBigOps[fName]; - } - return { - type: "op", - mode: parser.mode, - limits: true, - parentIsSupSub: false, - symbol: true, - name: fName, - }; - }, - htmlBuilder: htmlBuilder$2, - mathmlBuilder: mathmlBuilder$1, - }); - defineFunction({ - type: "op", - names: ["\\mathop"], - props: { numArgs: 1, primitive: true }, - handler: function handler(_ref2, args) { - var parser = _ref2.parser; - var body = args[0]; - return { - type: "op", - mode: parser.mode, - limits: false, - parentIsSupSub: false, - symbol: false, - body: ordargument(body), - }; - }, - htmlBuilder: htmlBuilder$2, - mathmlBuilder: mathmlBuilder$1, - }); - var singleCharIntegrals = { - "\u222B": "\\int", - "\u222C": "\\iint", - "\u222D": "\\iiint", - "\u222E": "\\oint", - "\u222F": "\\oiint", - "\u2230": "\\oiiint", - }; - defineFunction({ - type: "op", - names: [ - "\\arcsin", - "\\arccos", - "\\arctan", - "\\arctg", - "\\arcctg", - "\\arg", - "\\ch", - "\\cos", - "\\cosec", - "\\cosh", - "\\cot", - "\\cotg", - "\\coth", - "\\csc", - "\\ctg", - "\\cth", - "\\deg", - "\\dim", - "\\exp", - "\\hom", - "\\ker", - "\\lg", - "\\ln", - "\\log", - "\\sec", - "\\sin", - "\\sinh", - "\\sh", - "\\tan", - "\\tanh", - "\\tg", - "\\th", - ], - props: { numArgs: 0 }, - handler: function handler(_ref3) { - var parser = _ref3.parser, - funcName = _ref3.funcName; - return { - type: "op", - mode: parser.mode, - limits: false, - parentIsSupSub: false, - symbol: false, - name: funcName, - }; - }, - htmlBuilder: htmlBuilder$2, - mathmlBuilder: mathmlBuilder$1, - }); - defineFunction({ - type: "op", - names: [ - "\\det", - "\\gcd", - "\\inf", - "\\lim", - "\\max", - "\\min", - "\\Pr", - "\\sup", - ], - props: { numArgs: 0 }, - handler: function handler(_ref4) { - var parser = _ref4.parser, - funcName = _ref4.funcName; - return { - type: "op", - mode: parser.mode, - limits: true, - parentIsSupSub: false, - symbol: false, - name: funcName, - }; - }, - htmlBuilder: htmlBuilder$2, - mathmlBuilder: mathmlBuilder$1, - }); - defineFunction({ - type: "op", - names: [ - "\\int", - "\\iint", - "\\iiint", - "\\oint", - "\\oiint", - "\\oiiint", - "\u222B", - "\u222C", - "\u222D", - "\u222E", - "\u222F", - "\u2230", - ], - props: { numArgs: 0 }, - handler: function handler(_ref5) { - var parser = _ref5.parser, - funcName = _ref5.funcName; - var fName = funcName; - if (fName.length === 1) { - fName = singleCharIntegrals[fName]; - } - return { - type: "op", - mode: parser.mode, - limits: false, - parentIsSupSub: false, - symbol: true, - name: fName, - }; - }, - htmlBuilder: htmlBuilder$2, - mathmlBuilder: mathmlBuilder$1, - }); - var htmlBuilder$1 = function htmlBuilder$1(grp, options) { - var supGroup; - var subGroup; - var hasLimits = false; - var group; - if (grp.type === "supsub") { - supGroup = grp.sup; - subGroup = grp.sub; - group = assertNodeType(grp.base, "operatorname"); - hasLimits = true; - } else { - group = assertNodeType(grp, "operatorname"); - } - var base; - if (group.body.length > 0) { - var body = group.body.map(function (child) { - var childText = child.text; - if (typeof childText === "string") { - return { type: "textord", mode: child.mode, text: childText }; - } else { - return child; - } - }); - var expression = buildExpression$1( - body, - options.withFont("mathrm"), - true, - ); - for (var i = 0; i < expression.length; i++) { - var child = expression[i]; - if (child instanceof SymbolNode) { - child.text = child.text.replace(/\u2212/, "-").replace(/\u2217/, "*"); - } - } - base = buildCommon.makeSpan(["mop"], expression, options); - } else { - base = buildCommon.makeSpan(["mop"], [], options); - } - if (hasLimits) { - return assembleSupSub( - base, - supGroup, - subGroup, - options, - options.style, - 0, - 0, - ); - } else { - return base; - } - }; - var mathmlBuilder = function mathmlBuilder(group, options) { - var expression = buildExpression(group.body, options.withFont("mathrm")); - var isAllString = true; - for (var i = 0; i < expression.length; i++) { - var node = expression[i]; - if (node instanceof mathMLTree.SpaceNode); - else if (node instanceof mathMLTree.MathNode) { - switch (node.type) { - case "mi": - case "mn": - case "ms": - case "mspace": - case "mtext": - break; - case "mo": { - var child = node.children[0]; - if ( - node.children.length === 1 && - child instanceof mathMLTree.TextNode - ) { - child.text = child.text - .replace(/\u2212/, "-") - .replace(/\u2217/, "*"); - } else { - isAllString = false; - } - break; - } - default: - isAllString = false; - } - } else { - isAllString = false; - } - } - if (isAllString) { - var word = expression - .map(function (node) { - return node.toText(); - }) - .join(""); - expression = [new mathMLTree.TextNode(word)]; - } - var identifier = new mathMLTree.MathNode("mi", expression); - identifier.setAttribute("mathvariant", "normal"); - var operator = new mathMLTree.MathNode("mo", [makeText("\u2061", "text")]); - if (group.parentIsSupSub) { - return new mathMLTree.MathNode("mrow", [identifier, operator]); - } else { - return mathMLTree.newDocumentFragment([identifier, operator]); - } - }; - defineFunction({ - type: "operatorname", - names: ["\\operatorname@", "\\operatornamewithlimits"], - props: { numArgs: 1 }, - handler: function handler(_ref, args) { - var parser = _ref.parser, - funcName = _ref.funcName; - var body = args[0]; - return { - type: "operatorname", - mode: parser.mode, - body: ordargument(body), - alwaysHandleSupSub: funcName === "\\operatornamewithlimits", - limits: false, - parentIsSupSub: false, - }; - }, - htmlBuilder: htmlBuilder$1, - mathmlBuilder: mathmlBuilder, - }); - defineMacro( - "\\operatorname", - "\\@ifstar\\operatornamewithlimits\\operatorname@", - ); - defineFunctionBuilders({ - type: "ordgroup", - htmlBuilder: function htmlBuilder(group, options) { - if (group.semisimple) { - return buildCommon.makeFragment( - buildExpression$1(group.body, options, false), - ); - } - return buildCommon.makeSpan( - ["mord"], - buildExpression$1(group.body, options, true), - options, - ); - }, - mathmlBuilder: function mathmlBuilder(group, options) { - return buildExpressionRow(group.body, options, true); - }, - }); - defineFunction({ - type: "overline", - names: ["\\overline"], - props: { numArgs: 1 }, - handler: function handler(_ref, args) { - var parser = _ref.parser; - var body = args[0]; - return { type: "overline", mode: parser.mode, body: body }; - }, - htmlBuilder: function htmlBuilder(group, options) { - var innerGroup = buildGroup$1(group.body, options.havingCrampedStyle()); - var line = buildCommon.makeLineSpan("overline-line", options); - var defaultRuleThickness = options.fontMetrics().defaultRuleThickness; - var vlist = buildCommon.makeVList( - { - positionType: "firstBaseline", - children: [ - { type: "elem", elem: innerGroup }, - { type: "kern", size: 3 * defaultRuleThickness }, - { type: "elem", elem: line }, - { type: "kern", size: defaultRuleThickness }, - ], - }, - options, - ); - return buildCommon.makeSpan(["mord", "overline"], [vlist], options); - }, - mathmlBuilder: function mathmlBuilder(group, options) { - var operator = new mathMLTree.MathNode("mo", [ - new mathMLTree.TextNode("\u203E"), - ]); - operator.setAttribute("stretchy", "true"); - var node = new mathMLTree.MathNode("mover", [ - buildGroup(group.body, options), - operator, - ]); - node.setAttribute("accent", "true"); - return node; - }, - }); - defineFunction({ - type: "phantom", - names: ["\\phantom"], - props: { numArgs: 1, allowedInText: true }, - handler: function handler(_ref, args) { - var parser = _ref.parser; - var body = args[0]; - return { type: "phantom", mode: parser.mode, body: ordargument(body) }; - }, - htmlBuilder: function htmlBuilder(group, options) { - var elements = buildExpression$1( - group.body, - options.withPhantom(), - false, - ); - return buildCommon.makeFragment(elements); - }, - mathmlBuilder: function mathmlBuilder(group, options) { - var inner = buildExpression(group.body, options); - return new mathMLTree.MathNode("mphantom", inner); - }, - }); - defineFunction({ - type: "hphantom", - names: ["\\hphantom"], - props: { numArgs: 1, allowedInText: true }, - handler: function handler(_ref2, args) { - var parser = _ref2.parser; - var body = args[0]; - return { type: "hphantom", mode: parser.mode, body: body }; - }, - htmlBuilder: function htmlBuilder(group, options) { - var node = buildCommon.makeSpan( - [], - [buildGroup$1(group.body, options.withPhantom())], - ); - node.height = 0; - node.depth = 0; - if (node.children) { - for (var i = 0; i < node.children.length; i++) { - node.children[i].height = 0; - node.children[i].depth = 0; - } - } - node = buildCommon.makeVList( - { - positionType: "firstBaseline", - children: [{ type: "elem", elem: node }], - }, - options, - ); - return buildCommon.makeSpan(["mord"], [node], options); - }, - mathmlBuilder: function mathmlBuilder(group, options) { - var inner = buildExpression(ordargument(group.body), options); - var phantom = new mathMLTree.MathNode("mphantom", inner); - var node = new mathMLTree.MathNode("mpadded", [phantom]); - node.setAttribute("height", "0px"); - node.setAttribute("depth", "0px"); - return node; - }, - }); - defineFunction({ - type: "vphantom", - names: ["\\vphantom"], - props: { numArgs: 1, allowedInText: true }, - handler: function handler(_ref3, args) { - var parser = _ref3.parser; - var body = args[0]; - return { type: "vphantom", mode: parser.mode, body: body }; - }, - htmlBuilder: function htmlBuilder(group, options) { - var inner = buildCommon.makeSpan( - ["inner"], - [buildGroup$1(group.body, options.withPhantom())], - ); - var fix = buildCommon.makeSpan(["fix"], []); - return buildCommon.makeSpan(["mord", "rlap"], [inner, fix], options); - }, - mathmlBuilder: function mathmlBuilder(group, options) { - var inner = buildExpression(ordargument(group.body), options); - var phantom = new mathMLTree.MathNode("mphantom", inner); - var node = new mathMLTree.MathNode("mpadded", [phantom]); - node.setAttribute("width", "0px"); - return node; - }, - }); - defineFunction({ - type: "raisebox", - names: ["\\raisebox"], - props: { numArgs: 2, argTypes: ["size", "hbox"], allowedInText: true }, - handler: function handler(_ref, args) { - var parser = _ref.parser; - var amount = assertNodeType(args[0], "size").value; - var body = args[1]; - return { type: "raisebox", mode: parser.mode, dy: amount, body: body }; - }, - htmlBuilder: function htmlBuilder(group, options) { - var body = buildGroup$1(group.body, options); - var dy = calculateSize(group.dy, options); - return buildCommon.makeVList( - { - positionType: "shift", - positionData: -dy, - children: [{ type: "elem", elem: body }], - }, - options, - ); - }, - mathmlBuilder: function mathmlBuilder(group, options) { - var node = new mathMLTree.MathNode("mpadded", [ - buildGroup(group.body, options), - ]); - var dy = group.dy.number + group.dy.unit; - node.setAttribute("voffset", dy); - return node; - }, - }); - defineFunction({ - type: "internal", - names: ["\\relax"], - props: { numArgs: 0, allowedInText: true, allowedInArgument: true }, - handler: function handler(_ref) { - var parser = _ref.parser; - return { type: "internal", mode: parser.mode }; - }, - }); - defineFunction({ - type: "rule", - names: ["\\rule"], - props: { - numArgs: 2, - numOptionalArgs: 1, - allowedInText: true, - allowedInMath: true, - argTypes: ["size", "size", "size"], - }, - handler: function handler(_ref, args, optArgs) { - var parser = _ref.parser; - var shift = optArgs[0]; - var width = assertNodeType(args[0], "size"); - var height = assertNodeType(args[1], "size"); - return { - type: "rule", - mode: parser.mode, - shift: shift && assertNodeType(shift, "size").value, - width: width.value, - height: height.value, - }; - }, - htmlBuilder: function htmlBuilder(group, options) { - var rule = buildCommon.makeSpan(["mord", "rule"], [], options); - var width = calculateSize(group.width, options); - var height = calculateSize(group.height, options); - var shift = group.shift ? calculateSize(group.shift, options) : 0; - rule.style.borderRightWidth = makeEm(width); - rule.style.borderTopWidth = makeEm(height); - rule.style.bottom = makeEm(shift); - rule.width = width; - rule.height = height + shift; - rule.depth = -shift; - rule.maxFontSize = height * 1.125 * options.sizeMultiplier; - return rule; - }, - mathmlBuilder: function mathmlBuilder(group, options) { - var width = calculateSize(group.width, options); - var height = calculateSize(group.height, options); - var shift = group.shift ? calculateSize(group.shift, options) : 0; - var color = (options.color && options.getColor()) || "black"; - var rule = new mathMLTree.MathNode("mspace"); - rule.setAttribute("mathbackground", color); - rule.setAttribute("width", makeEm(width)); - rule.setAttribute("height", makeEm(height)); - var wrapper = new mathMLTree.MathNode("mpadded", [rule]); - if (shift >= 0) { - wrapper.setAttribute("height", makeEm(shift)); - } else { - wrapper.setAttribute("height", makeEm(shift)); - wrapper.setAttribute("depth", makeEm(-shift)); - } - wrapper.setAttribute("voffset", makeEm(shift)); - return wrapper; - }, - }); - function sizingGroup(value, options, baseOptions) { - var inner = buildExpression$1(value, options, false); - var multiplier = options.sizeMultiplier / baseOptions.sizeMultiplier; - for (var i = 0; i < inner.length; i++) { - var pos = inner[i].classes.indexOf("sizing"); - if (pos < 0) { - Array.prototype.push.apply( - inner[i].classes, - options.sizingClasses(baseOptions), - ); - } else if (inner[i].classes[pos + 1] === "reset-size" + options.size) { - inner[i].classes[pos + 1] = "reset-size" + baseOptions.size; - } - inner[i].height *= multiplier; - inner[i].depth *= multiplier; - } - return buildCommon.makeFragment(inner); - } - var sizeFuncs = [ - "\\tiny", - "\\sixptsize", - "\\scriptsize", - "\\footnotesize", - "\\small", - "\\normalsize", - "\\large", - "\\Large", - "\\LARGE", - "\\huge", - "\\Huge", - ]; - var htmlBuilder = function htmlBuilder(group, options) { - var newOptions = options.havingSize(group.size); - return sizingGroup(group.body, newOptions, options); - }; - defineFunction({ - type: "sizing", - names: sizeFuncs, - props: { numArgs: 0, allowedInText: true }, - handler: function handler(_ref, args) { - var breakOnTokenText = _ref.breakOnTokenText, - funcName = _ref.funcName, - parser = _ref.parser; - var body = parser.parseExpression(false, breakOnTokenText); - return { - type: "sizing", - mode: parser.mode, - size: sizeFuncs.indexOf(funcName) + 1, - body: body, - }; - }, - htmlBuilder: htmlBuilder, - mathmlBuilder: function mathmlBuilder(group, options) { - var newOptions = options.havingSize(group.size); - var inner = buildExpression(group.body, newOptions); - var node = new mathMLTree.MathNode("mstyle", inner); - node.setAttribute("mathsize", makeEm(newOptions.sizeMultiplier)); - return node; - }, - }); - defineFunction({ - type: "smash", - names: ["\\smash"], - props: { numArgs: 1, numOptionalArgs: 1, allowedInText: true }, - handler: function handler(_ref, args, optArgs) { - var parser = _ref.parser; - var smashHeight = false; - var smashDepth = false; - var tbArg = optArgs[0] && assertNodeType(optArgs[0], "ordgroup"); - if (tbArg) { - var letter = ""; - for (var i = 0; i < tbArg.body.length; ++i) { - var node = tbArg.body[i]; - letter = node.text; - if (letter === "t") { - smashHeight = true; - } else if (letter === "b") { - smashDepth = true; - } else { - smashHeight = false; - smashDepth = false; - break; - } - } - } else { - smashHeight = true; - smashDepth = true; - } - var body = args[0]; - return { - type: "smash", - mode: parser.mode, - body: body, - smashHeight: smashHeight, - smashDepth: smashDepth, - }; - }, - htmlBuilder: function htmlBuilder(group, options) { - var node = buildCommon.makeSpan([], [buildGroup$1(group.body, options)]); - if (!group.smashHeight && !group.smashDepth) { - return node; - } - if (group.smashHeight) { - node.height = 0; - if (node.children) { - for (var i = 0; i < node.children.length; i++) { - node.children[i].height = 0; - } - } - } - if (group.smashDepth) { - node.depth = 0; - if (node.children) { - for (var _i = 0; _i < node.children.length; _i++) { - node.children[_i].depth = 0; - } - } - } - var smashedNode = buildCommon.makeVList( - { - positionType: "firstBaseline", - children: [{ type: "elem", elem: node }], - }, - options, - ); - return buildCommon.makeSpan(["mord"], [smashedNode], options); - }, - mathmlBuilder: function mathmlBuilder(group, options) { - var node = new mathMLTree.MathNode("mpadded", [ - buildGroup(group.body, options), - ]); - if (group.smashHeight) { - node.setAttribute("height", "0px"); - } - if (group.smashDepth) { - node.setAttribute("depth", "0px"); - } - return node; - }, - }); - defineFunction({ - type: "sqrt", - names: ["\\sqrt"], - props: { numArgs: 1, numOptionalArgs: 1 }, - handler: function handler(_ref, args, optArgs) { - var parser = _ref.parser; - var index = optArgs[0]; - var body = args[0]; - return { type: "sqrt", mode: parser.mode, body: body, index: index }; - }, - htmlBuilder: function htmlBuilder(group, options) { - var inner = buildGroup$1(group.body, options.havingCrampedStyle()); - if (inner.height === 0) { - inner.height = options.fontMetrics().xHeight; - } - inner = buildCommon.wrapFragment(inner, options); - var metrics = options.fontMetrics(); - var theta = metrics.defaultRuleThickness; - var phi = theta; - if (options.style.id < Style$1.TEXT.id) { - phi = options.fontMetrics().xHeight; - } - var lineClearance = theta + phi / 4; - var minDelimiterHeight = - inner.height + inner.depth + lineClearance + theta; - var _delimiter$sqrtImage = delimiter.sqrtImage( - minDelimiterHeight, - options, - ), - img = _delimiter$sqrtImage.span, - ruleWidth = _delimiter$sqrtImage.ruleWidth, - advanceWidth = _delimiter$sqrtImage.advanceWidth; - var delimDepth = img.height - ruleWidth; - if (delimDepth > inner.height + inner.depth + lineClearance) { - lineClearance = - (lineClearance + delimDepth - inner.height - inner.depth) / 2; - } - var imgShift = img.height - inner.height - lineClearance - ruleWidth; - inner.style.paddingLeft = makeEm(advanceWidth); - var body = buildCommon.makeVList( - { - positionType: "firstBaseline", - children: [ - { type: "elem", elem: inner, wrapperClasses: ["svg-align"] }, - { type: "kern", size: -(inner.height + imgShift) }, - { type: "elem", elem: img }, - { type: "kern", size: ruleWidth }, - ], - }, - options, - ); - if (!group.index) { - return buildCommon.makeSpan(["mord", "sqrt"], [body], options); - } else { - var newOptions = options.havingStyle(Style$1.SCRIPTSCRIPT); - var rootm = buildGroup$1(group.index, newOptions, options); - var toShift = 0.6 * (body.height - body.depth); - var rootVList = buildCommon.makeVList( - { - positionType: "shift", - positionData: -toShift, - children: [{ type: "elem", elem: rootm }], - }, - options, - ); - var rootVListWrap = buildCommon.makeSpan(["root"], [rootVList]); - return buildCommon.makeSpan( - ["mord", "sqrt"], - [rootVListWrap, body], - options, - ); - } - }, - mathmlBuilder: function mathmlBuilder(group, options) { - var body = group.body, - index = group.index; - return index - ? new mathMLTree.MathNode("mroot", [ - buildGroup(body, options), - buildGroup(index, options), - ]) - : new mathMLTree.MathNode("msqrt", [buildGroup(body, options)]); - }, - }); - var styleMap = { - display: Style$1.DISPLAY, - text: Style$1.TEXT, - script: Style$1.SCRIPT, - scriptscript: Style$1.SCRIPTSCRIPT, - }; - defineFunction({ - type: "styling", - names: [ - "\\displaystyle", - "\\textstyle", - "\\scriptstyle", - "\\scriptscriptstyle", - ], - props: { numArgs: 0, allowedInText: true, primitive: true }, - handler: function handler(_ref, args) { - var breakOnTokenText = _ref.breakOnTokenText, - funcName = _ref.funcName, - parser = _ref.parser; - var body = parser.parseExpression(true, breakOnTokenText); - var style = funcName.slice(1, funcName.length - 5); - return { type: "styling", mode: parser.mode, style: style, body: body }; - }, - htmlBuilder: function htmlBuilder(group, options) { - var newStyle = styleMap[group.style]; - var newOptions = options.havingStyle(newStyle).withFont(""); - return sizingGroup(group.body, newOptions, options); - }, - mathmlBuilder: function mathmlBuilder(group, options) { - var newStyle = styleMap[group.style]; - var newOptions = options.havingStyle(newStyle); - var inner = buildExpression(group.body, newOptions); - var node = new mathMLTree.MathNode("mstyle", inner); - var styleAttributes = { - display: ["0", "true"], - text: ["0", "false"], - script: ["1", "false"], - scriptscript: ["2", "false"], - }; - var attr = styleAttributes[group.style]; - node.setAttribute("scriptlevel", attr[0]); - node.setAttribute("displaystyle", attr[1]); - return node; - }, - }); - var htmlBuilderDelegate = function htmlBuilderDelegate(group, options) { - var base = group.base; - if (!base) { - return null; - } else if (base.type === "op") { - var delegate = - base.limits && - (options.style.size === Style$1.DISPLAY.size || - base.alwaysHandleSupSub); - return delegate ? htmlBuilder$2 : null; - } else if (base.type === "operatorname") { - var _delegate = - base.alwaysHandleSupSub && - (options.style.size === Style$1.DISPLAY.size || base.limits); - return _delegate ? htmlBuilder$1 : null; - } else if (base.type === "accent") { - return utils.isCharacterBox(base.base) ? htmlBuilder$a : null; - } else if (base.type === "horizBrace") { - var isSup = !group.sub; - return isSup === base.isOver ? htmlBuilder$3 : null; - } else { - return null; - } - }; - defineFunctionBuilders({ - type: "supsub", - htmlBuilder: function htmlBuilder(group, options) { - var builderDelegate = htmlBuilderDelegate(group, options); - if (builderDelegate) { - return builderDelegate(group, options); - } - var valueBase = group.base, - valueSup = group.sup, - valueSub = group.sub; - var base = buildGroup$1(valueBase, options); - var supm; - var subm; - var metrics = options.fontMetrics(); - var supShift = 0; - var subShift = 0; - var isCharacterBox = valueBase && utils.isCharacterBox(valueBase); - if (valueSup) { - var newOptions = options.havingStyle(options.style.sup()); - supm = buildGroup$1(valueSup, newOptions, options); - if (!isCharacterBox) { - supShift = - base.height - - (newOptions.fontMetrics().supDrop * newOptions.sizeMultiplier) / - options.sizeMultiplier; - } - } - if (valueSub) { - var _newOptions = options.havingStyle(options.style.sub()); - subm = buildGroup$1(valueSub, _newOptions, options); - if (!isCharacterBox) { - subShift = - base.depth + - (_newOptions.fontMetrics().subDrop * _newOptions.sizeMultiplier) / - options.sizeMultiplier; - } - } - var minSupShift; - if (options.style === Style$1.DISPLAY) { - minSupShift = metrics.sup1; - } else if (options.style.cramped) { - minSupShift = metrics.sup3; - } else { - minSupShift = metrics.sup2; - } - var multiplier = options.sizeMultiplier; - var marginRight = makeEm(0.5 / metrics.ptPerEm / multiplier); - var marginLeft = null; - if (subm) { - var isOiint = - group.base && - group.base.type === "op" && - group.base.name && - (group.base.name === "\\oiint" || group.base.name === "\\oiiint"); - if (base instanceof SymbolNode || isOiint) { - marginLeft = makeEm(-base.italic); - } - } - var supsub; - if (supm && subm) { - supShift = Math.max( - supShift, - minSupShift, - supm.depth + 0.25 * metrics.xHeight, - ); - subShift = Math.max(subShift, metrics.sub2); - var ruleWidth = metrics.defaultRuleThickness; - var maxWidth = 4 * ruleWidth; - if (supShift - supm.depth - (subm.height - subShift) < maxWidth) { - subShift = maxWidth - (supShift - supm.depth) + subm.height; - var psi = 0.8 * metrics.xHeight - (supShift - supm.depth); - if (psi > 0) { - supShift += psi; - subShift -= psi; - } - } - var vlistElem = [ - { - type: "elem", - elem: subm, - shift: subShift, - marginRight: marginRight, - marginLeft: marginLeft, - }, - { - type: "elem", - elem: supm, - shift: -supShift, - marginRight: marginRight, - }, - ]; - supsub = buildCommon.makeVList( - { positionType: "individualShift", children: vlistElem }, - options, - ); - } else if (subm) { - subShift = Math.max( - subShift, - metrics.sub1, - subm.height - 0.8 * metrics.xHeight, - ); - var _vlistElem = [ - { - type: "elem", - elem: subm, - marginLeft: marginLeft, - marginRight: marginRight, - }, - ]; - supsub = buildCommon.makeVList( - { - positionType: "shift", - positionData: subShift, - children: _vlistElem, - }, - options, - ); - } else if (supm) { - supShift = Math.max( - supShift, - minSupShift, - supm.depth + 0.25 * metrics.xHeight, - ); - supsub = buildCommon.makeVList( - { - positionType: "shift", - positionData: -supShift, - children: [{ type: "elem", elem: supm, marginRight: marginRight }], - }, - options, - ); - } else { - throw new Error("supsub must have either sup or sub."); - } - var mclass = getTypeOfDomTree(base, "right") || "mord"; - return buildCommon.makeSpan( - [mclass], - [base, buildCommon.makeSpan(["msupsub"], [supsub])], - options, - ); - }, - mathmlBuilder: function mathmlBuilder(group, options) { - var isBrace = false; - var isOver; - var isSup; - if (group.base && group.base.type === "horizBrace") { - isSup = !!group.sup; - if (isSup === group.base.isOver) { - isBrace = true; - isOver = group.base.isOver; - } - } - if ( - group.base && - (group.base.type === "op" || group.base.type === "operatorname") - ) { - group.base.parentIsSupSub = true; - } - var children = [buildGroup(group.base, options)]; - if (group.sub) { - children.push(buildGroup(group.sub, options)); - } - if (group.sup) { - children.push(buildGroup(group.sup, options)); - } - var nodeType; - if (isBrace) { - nodeType = isOver ? "mover" : "munder"; - } else if (!group.sub) { - var base = group.base; - if ( - base && - base.type === "op" && - base.limits && - (options.style === Style$1.DISPLAY || base.alwaysHandleSupSub) - ) { - nodeType = "mover"; - } else if ( - base && - base.type === "operatorname" && - base.alwaysHandleSupSub && - (base.limits || options.style === Style$1.DISPLAY) - ) { - nodeType = "mover"; - } else { - nodeType = "msup"; - } - } else if (!group.sup) { - var _base = group.base; - if ( - _base && - _base.type === "op" && - _base.limits && - (options.style === Style$1.DISPLAY || _base.alwaysHandleSupSub) - ) { - nodeType = "munder"; - } else if ( - _base && - _base.type === "operatorname" && - _base.alwaysHandleSupSub && - (_base.limits || options.style === Style$1.DISPLAY) - ) { - nodeType = "munder"; - } else { - nodeType = "msub"; - } - } else { - var _base2 = group.base; - if ( - _base2 && - _base2.type === "op" && - _base2.limits && - options.style === Style$1.DISPLAY - ) { - nodeType = "munderover"; - } else if ( - _base2 && - _base2.type === "operatorname" && - _base2.alwaysHandleSupSub && - (options.style === Style$1.DISPLAY || _base2.limits) - ) { - nodeType = "munderover"; - } else { - nodeType = "msubsup"; - } - } - return new mathMLTree.MathNode(nodeType, children); - }, - }); - defineFunctionBuilders({ - type: "atom", - htmlBuilder: function htmlBuilder(group, options) { - return buildCommon.mathsym(group.text, group.mode, options, [ - "m" + group.family, - ]); - }, - mathmlBuilder: function mathmlBuilder(group, options) { - var node = new mathMLTree.MathNode("mo", [ - makeText(group.text, group.mode), - ]); - if (group.family === "bin") { - var variant = getVariant(group, options); - if (variant === "bold-italic") { - node.setAttribute("mathvariant", variant); - } - } else if (group.family === "punct") { - node.setAttribute("separator", "true"); - } else if (group.family === "open" || group.family === "close") { - node.setAttribute("stretchy", "false"); - } - return node; - }, - }); - var defaultVariant = { mi: "italic", mn: "normal", mtext: "normal" }; - defineFunctionBuilders({ - type: "mathord", - htmlBuilder: function htmlBuilder(group, options) { - return buildCommon.makeOrd(group, options, "mathord"); - }, - mathmlBuilder: function mathmlBuilder(group, options) { - var node = new mathMLTree.MathNode("mi", [ - makeText(group.text, group.mode, options), - ]); - var variant = getVariant(group, options) || "italic"; - if (variant !== defaultVariant[node.type]) { - node.setAttribute("mathvariant", variant); - } - return node; - }, - }); - defineFunctionBuilders({ - type: "textord", - htmlBuilder: function htmlBuilder(group, options) { - return buildCommon.makeOrd(group, options, "textord"); - }, - mathmlBuilder: function mathmlBuilder(group, options) { - var text = makeText(group.text, group.mode, options); - var variant = getVariant(group, options) || "normal"; - var node; - if (group.mode === "text") { - node = new mathMLTree.MathNode("mtext", [text]); - } else if (/[0-9]/.test(group.text)) { - node = new mathMLTree.MathNode("mn", [text]); - } else if (group.text === "\\prime") { - node = new mathMLTree.MathNode("mo", [text]); - } else { - node = new mathMLTree.MathNode("mi", [text]); - } - if (variant !== defaultVariant[node.type]) { - node.setAttribute("mathvariant", variant); - } - return node; - }, - }); - var cssSpace = { "\\nobreak": "nobreak", "\\allowbreak": "allowbreak" }; - var regularSpace = { - " ": {}, - "\\ ": {}, - "~": { className: "nobreak" }, - "\\space": {}, - "\\nobreakspace": { className: "nobreak" }, - }; - defineFunctionBuilders({ - type: "spacing", - htmlBuilder: function htmlBuilder(group, options) { - if (regularSpace.hasOwnProperty(group.text)) { - var className = regularSpace[group.text].className || ""; - if (group.mode === "text") { - var ord = buildCommon.makeOrd(group, options, "textord"); - ord.classes.push(className); - return ord; - } else { - return buildCommon.makeSpan( - ["mspace", className], - [buildCommon.mathsym(group.text, group.mode, options)], - options, - ); - } - } else if (cssSpace.hasOwnProperty(group.text)) { - return buildCommon.makeSpan( - ["mspace", cssSpace[group.text]], - [], - options, - ); - } else { - throw new ParseError('Unknown type of space "' + group.text + '"'); - } - }, - mathmlBuilder: function mathmlBuilder(group, options) { - var node; - if (regularSpace.hasOwnProperty(group.text)) { - node = new mathMLTree.MathNode("mtext", [ - new mathMLTree.TextNode("\xA0"), - ]); - } else if (cssSpace.hasOwnProperty(group.text)) { - return new mathMLTree.MathNode("mspace"); - } else { - throw new ParseError('Unknown type of space "' + group.text + '"'); - } - return node; - }, - }); - var pad = function pad() { - var padNode = new mathMLTree.MathNode("mtd", []); - padNode.setAttribute("width", "50%"); - return padNode; - }; - defineFunctionBuilders({ - type: "tag", - mathmlBuilder: function mathmlBuilder(group, options) { - var table = new mathMLTree.MathNode("mtable", [ - new mathMLTree.MathNode("mtr", [ - pad(), - new mathMLTree.MathNode("mtd", [ - buildExpressionRow(group.body, options), - ]), - pad(), - new mathMLTree.MathNode("mtd", [ - buildExpressionRow(group.tag, options), - ]), - ]), - ]); - table.setAttribute("width", "100%"); - return table; - }, - }); - var textFontFamilies = { - "\\text": undefined, - "\\textrm": "textrm", - "\\textsf": "textsf", - "\\texttt": "texttt", - "\\textnormal": "textrm", - }; - var textFontWeights = { "\\textbf": "textbf", "\\textmd": "textmd" }; - var textFontShapes = { "\\textit": "textit", "\\textup": "textup" }; - var optionsWithFont = function optionsWithFont(group, options) { - var font = group.font; - if (!font) { - return options; - } else if (textFontFamilies[font]) { - return options.withTextFontFamily(textFontFamilies[font]); - } else if (textFontWeights[font]) { - return options.withTextFontWeight(textFontWeights[font]); - } else if (font === "\\emph") { - return options.fontShape === "textit" - ? options.withTextFontShape("textup") - : options.withTextFontShape("textit"); - } - return options.withTextFontShape(textFontShapes[font]); - }; - defineFunction({ - type: "text", - names: [ - "\\text", - "\\textrm", - "\\textsf", - "\\texttt", - "\\textnormal", - "\\textbf", - "\\textmd", - "\\textit", - "\\textup", - "\\emph", - ], - props: { - numArgs: 1, - argTypes: ["text"], - allowedInArgument: true, - allowedInText: true, - }, - handler: function handler(_ref, args) { - var parser = _ref.parser, - funcName = _ref.funcName; - var body = args[0]; - return { - type: "text", - mode: parser.mode, - body: ordargument(body), - font: funcName, - }; - }, - htmlBuilder: function htmlBuilder(group, options) { - var newOptions = optionsWithFont(group, options); - var inner = buildExpression$1(group.body, newOptions, true); - return buildCommon.makeSpan(["mord", "text"], inner, newOptions); - }, - mathmlBuilder: function mathmlBuilder(group, options) { - var newOptions = optionsWithFont(group, options); - return buildExpressionRow(group.body, newOptions); - }, - }); - defineFunction({ - type: "underline", - names: ["\\underline"], - props: { numArgs: 1, allowedInText: true }, - handler: function handler(_ref, args) { - var parser = _ref.parser; - return { type: "underline", mode: parser.mode, body: args[0] }; - }, - htmlBuilder: function htmlBuilder(group, options) { - var innerGroup = buildGroup$1(group.body, options); - var line = buildCommon.makeLineSpan("underline-line", options); - var defaultRuleThickness = options.fontMetrics().defaultRuleThickness; - var vlist = buildCommon.makeVList( - { - positionType: "top", - positionData: innerGroup.height, - children: [ - { type: "kern", size: defaultRuleThickness }, - { type: "elem", elem: line }, - { type: "kern", size: 3 * defaultRuleThickness }, - { type: "elem", elem: innerGroup }, - ], - }, - options, - ); - return buildCommon.makeSpan(["mord", "underline"], [vlist], options); - }, - mathmlBuilder: function mathmlBuilder(group, options) { - var operator = new mathMLTree.MathNode("mo", [ - new mathMLTree.TextNode("\u203E"), - ]); - operator.setAttribute("stretchy", "true"); - var node = new mathMLTree.MathNode("munder", [ - buildGroup(group.body, options), - operator, - ]); - node.setAttribute("accentunder", "true"); - return node; - }, - }); - defineFunction({ - type: "vcenter", - names: ["\\vcenter"], - props: { numArgs: 1, argTypes: ["original"], allowedInText: false }, - handler: function handler(_ref, args) { - var parser = _ref.parser; - return { type: "vcenter", mode: parser.mode, body: args[0] }; - }, - htmlBuilder: function htmlBuilder(group, options) { - var body = buildGroup$1(group.body, options); - var axisHeight = options.fontMetrics().axisHeight; - var dy = 0.5 * (body.height - axisHeight - (body.depth + axisHeight)); - return buildCommon.makeVList( - { - positionType: "shift", - positionData: dy, - children: [{ type: "elem", elem: body }], - }, - options, - ); - }, - mathmlBuilder: function mathmlBuilder(group, options) { - return new mathMLTree.MathNode( - "mpadded", - [buildGroup(group.body, options)], - ["vcenter"], - ); - }, - }); - defineFunction({ - type: "verb", - names: ["\\verb"], - props: { numArgs: 0, allowedInText: true }, - handler: function handler(context, args, optArgs) { - throw new ParseError( - "\\verb ended by end of line instead of matching delimiter", - ); - }, - htmlBuilder: function htmlBuilder(group, options) { - var text = makeVerb(group); - var body = []; - var newOptions = options.havingStyle(options.style.text()); - for (var i = 0; i < text.length; i++) { - var c = text[i]; - if (c === "~") { - c = "\\textasciitilde"; - } - body.push( - buildCommon.makeSymbol( - c, - "Typewriter-Regular", - group.mode, - newOptions, - ["mord", "texttt"], - ), - ); - } - return buildCommon.makeSpan( - ["mord", "text"].concat(newOptions.sizingClasses(options)), - buildCommon.tryCombineChars(body), - newOptions, - ); - }, - mathmlBuilder: function mathmlBuilder(group, options) { - var text = new mathMLTree.TextNode(makeVerb(group)); - var node = new mathMLTree.MathNode("mtext", [text]); - node.setAttribute("mathvariant", "monospace"); - return node; - }, - }); - var makeVerb = function makeVerb(group) { - return group.body.replace(/ /g, group.star ? "\u2423" : "\xA0"); - }; - var functions = _functions; - var spaceRegexString = "[ \r\n\t]"; - var controlWordRegexString = "\\\\[a-zA-Z@]+"; - var controlSymbolRegexString = "\\\\[^\uD800-\uDFFF]"; - var controlWordWhitespaceRegexString = - "(" + controlWordRegexString + ")" + spaceRegexString + "*"; - var controlSpaceRegexString = "\\\\(\n|[ \r\t]+\n?)[ \r\t]*"; - var combiningDiacriticalMarkString = "[\u0300-\u036F]"; - var combiningDiacriticalMarksEndRegex = new RegExp( - combiningDiacriticalMarkString + "+$", - ); - var tokenRegexString = - "(" + - spaceRegexString + - "+)|" + - (controlSpaceRegexString + "|") + - "([!-\\[\\]-\u2027\u202A-\uD7FF\uF900-\uFFFF]" + - (combiningDiacriticalMarkString + "*") + - "|[\uD800-\uDBFF][\uDC00-\uDFFF]" + - (combiningDiacriticalMarkString + "*") + - "|\\\\verb\\*([^]).*?\\4" + - "|\\\\verb([^*a-zA-Z]).*?\\5" + - ("|" + controlWordWhitespaceRegexString) + - ("|" + controlSymbolRegexString + ")"); - var Lexer = (function () { - function Lexer(input, settings) { - _classCallCheck(this, Lexer); - this.input = void 0; - this.settings = void 0; - this.tokenRegex = void 0; - this.catcodes = void 0; - this.input = input; - this.settings = settings; - this.tokenRegex = new RegExp(tokenRegexString, "g"); - this.catcodes = { "%": 14, "~": 13 }; - } - return _createClass(Lexer, [ - { - key: "setCatcode", - value: function setCatcode(_char, code) { - this.catcodes[_char] = code; - }, - }, - { - key: "lex", - value: function lex() { - var input = this.input; - var pos = this.tokenRegex.lastIndex; - if (pos === input.length) { - return new Token("EOF", new SourceLocation(this, pos, pos)); - } - var match = this.tokenRegex.exec(input); - if (match === null || match.index !== pos) { - throw new ParseError( - "Unexpected character: '" + input[pos] + "'", - new Token(input[pos], new SourceLocation(this, pos, pos + 1)), - ); - } - var text = match[6] || match[3] || (match[2] ? "\\ " : " "); - if (this.catcodes[text] === 14) { - var nlIndex = input.indexOf("\n", this.tokenRegex.lastIndex); - if (nlIndex === -1) { - this.tokenRegex.lastIndex = input.length; - this.settings.reportNonstrict( - "commentAtEnd", - "% comment has no terminating newline; LaTeX would " + - "fail because of commenting the end of math mode (e.g. $)", - ); - } else { - this.tokenRegex.lastIndex = nlIndex + 1; - } - return this.lex(); - } - return new Token( - text, - new SourceLocation(this, pos, this.tokenRegex.lastIndex), - ); - }, - }, - ]); - })(); - var Namespace = (function () { - function Namespace(builtins, globalMacros) { - _classCallCheck(this, Namespace); - if (builtins === void 0) { - builtins = {}; - } - if (globalMacros === void 0) { - globalMacros = {}; - } - this.current = void 0; - this.builtins = void 0; - this.undefStack = void 0; - this.current = globalMacros; - this.builtins = builtins; - this.undefStack = []; - } - return _createClass(Namespace, [ - { - key: "beginGroup", - value: function beginGroup() { - this.undefStack.push({}); - }, - }, - { - key: "endGroup", - value: function endGroup() { - if (this.undefStack.length === 0) { - throw new ParseError( - "Unbalanced namespace destruction: attempt " + - "to pop global namespace; please report this as a bug", - ); - } - var undefs = this.undefStack.pop(); - for (var undef in undefs) { - if (undefs.hasOwnProperty(undef)) { - if (undefs[undef] == null) { - delete this.current[undef]; - } else { - this.current[undef] = undefs[undef]; - } - } - } - }, - }, - { - key: "endGroups", - value: function endGroups() { - while (this.undefStack.length > 0) { - this.endGroup(); - } - }, - }, - { - key: "has", - value: function has(name) { - return ( - this.current.hasOwnProperty(name) || - this.builtins.hasOwnProperty(name) - ); - }, - }, - { - key: "get", - value: function get(name) { - if (this.current.hasOwnProperty(name)) { - return this.current[name]; - } else { - return this.builtins[name]; - } - }, - }, - { - key: "set", - value: function set(name, value, global) { - if (global === void 0) { - global = false; - } - if (global) { - for (var i = 0; i < this.undefStack.length; i++) { - delete this.undefStack[i][name]; - } - if (this.undefStack.length > 0) { - this.undefStack[this.undefStack.length - 1][name] = value; - } - } else { - var top = this.undefStack[this.undefStack.length - 1]; - if (top && !top.hasOwnProperty(name)) { - top[name] = this.current[name]; - } - } - if (value == null) { - delete this.current[name]; - } else { - this.current[name] = value; - } - }, - }, - ]); - })(); - var macros = _macros; - defineMacro("\\noexpand", function (context) { - var t = context.popToken(); - if (context.isExpandable(t.text)) { - t.noexpand = true; - t.treatAsRelax = true; - } - return { tokens: [t], numArgs: 0 }; - }); - defineMacro("\\expandafter", function (context) { - var t = context.popToken(); - context.expandOnce(true); - return { tokens: [t], numArgs: 0 }; - }); - defineMacro("\\@firstoftwo", function (context) { - var args = context.consumeArgs(2); - return { tokens: args[0], numArgs: 0 }; - }); - defineMacro("\\@secondoftwo", function (context) { - var args = context.consumeArgs(2); - return { tokens: args[1], numArgs: 0 }; - }); - defineMacro("\\@ifnextchar", function (context) { - var args = context.consumeArgs(3); - context.consumeSpaces(); - var nextToken = context.future(); - if (args[0].length === 1 && args[0][0].text === nextToken.text) { - return { tokens: args[1], numArgs: 0 }; - } else { - return { tokens: args[2], numArgs: 0 }; - } - }); - defineMacro("\\@ifstar", "\\@ifnextchar *{\\@firstoftwo{#1}}"); - defineMacro("\\TextOrMath", function (context) { - var args = context.consumeArgs(2); - if (context.mode === "text") { - return { tokens: args[0], numArgs: 0 }; - } else { - return { tokens: args[1], numArgs: 0 }; - } - }); - var digitToNumber = { - 0: 0, - 1: 1, - 2: 2, - 3: 3, - 4: 4, - 5: 5, - 6: 6, - 7: 7, - 8: 8, - 9: 9, - a: 10, - A: 10, - b: 11, - B: 11, - c: 12, - C: 12, - d: 13, - D: 13, - e: 14, - E: 14, - f: 15, - F: 15, - }; - defineMacro("\\char", function (context) { - var token = context.popToken(); - var base; - var number = ""; - if (token.text === "'") { - base = 8; - token = context.popToken(); - } else if (token.text === '"') { - base = 16; - token = context.popToken(); - } else if (token.text === "`") { - token = context.popToken(); - if (token.text[0] === "\\") { - number = token.text.charCodeAt(1); - } else if (token.text === "EOF") { - throw new ParseError("\\char` missing argument"); - } else { - number = token.text.charCodeAt(0); - } - } else { - base = 10; - } - if (base) { - number = digitToNumber[token.text]; - if (number == null || number >= base) { - throw new ParseError("Invalid base-" + base + " digit " + token.text); - } - var digit; - while ( - (digit = digitToNumber[context.future().text]) != null && - digit < base - ) { - number *= base; - number += digit; - context.popToken(); - } - } - return "\\@char{" + number + "}"; - }); - var newcommand = function newcommand( - context, - existsOK, - nonexistsOK, - skipIfExists, - ) { - var arg = context.consumeArg().tokens; - if (arg.length !== 1) { - throw new ParseError( - "\\newcommand's first argument must be a macro name", - ); - } - var name = arg[0].text; - var exists = context.isDefined(name); - if (exists && !existsOK) { - throw new ParseError( - "\\newcommand{" + - name + - "} attempting to redefine " + - (name + "; use \\renewcommand"), - ); - } - if (!exists && !nonexistsOK) { - throw new ParseError( - "\\renewcommand{" + - name + - "} when command " + - name + - " " + - "does not yet exist; use \\newcommand", - ); - } - var numArgs = 0; - arg = context.consumeArg().tokens; - if (arg.length === 1 && arg[0].text === "[") { - var argText = ""; - var token = context.expandNextToken(); - while (token.text !== "]" && token.text !== "EOF") { - argText += token.text; - token = context.expandNextToken(); - } - if (!argText.match(/^\s*[0-9]+\s*$/)) { - throw new ParseError("Invalid number of arguments: " + argText); - } - numArgs = parseInt(argText); - arg = context.consumeArg().tokens; - } - if (!(exists && skipIfExists)) { - context.macros.set(name, { tokens: arg, numArgs: numArgs }); - } - return ""; - }; - defineMacro("\\newcommand", function (context) { - return newcommand(context, false, true, false); - }); - defineMacro("\\renewcommand", function (context) { - return newcommand(context, true, false, false); - }); - defineMacro("\\providecommand", function (context) { - return newcommand(context, true, true, true); - }); - defineMacro("\\message", function (context) { - var arg = context.consumeArgs(1)[0]; - console.log( - arg - .reverse() - .map(function (token) { - return token.text; - }) - .join(""), - ); - return ""; - }); - defineMacro("\\errmessage", function (context) { - var arg = context.consumeArgs(1)[0]; - console.error( - arg - .reverse() - .map(function (token) { - return token.text; - }) - .join(""), - ); - return ""; - }); - defineMacro("\\show", function (context) { - var tok = context.popToken(); - var name = tok.text; - console.log( - tok, - context.macros.get(name), - functions[name], - symbols.math[name], - symbols.text[name], - ); - return ""; - }); - defineMacro("\\bgroup", "{"); - defineMacro("\\egroup", "}"); - defineMacro("~", "\\nobreakspace"); - defineMacro("\\lq", "`"); - defineMacro("\\rq", "'"); - defineMacro("\\aa", "\\r a"); - defineMacro("\\AA", "\\r A"); - defineMacro( - "\\textcopyright", - "\\html@mathml{\\textcircled{c}}{\\char`\xA9}", - ); - defineMacro( - "\\copyright", - "\\TextOrMath{\\textcopyright}{\\text{\\textcopyright}}", - ); - defineMacro( - "\\textregistered", - "\\html@mathml{\\textcircled{\\scriptsize R}}{\\char`\xAE}", - ); - defineMacro("\u212C", "\\mathscr{B}"); - defineMacro("\u2130", "\\mathscr{E}"); - defineMacro("\u2131", "\\mathscr{F}"); - defineMacro("\u210B", "\\mathscr{H}"); - defineMacro("\u2110", "\\mathscr{I}"); - defineMacro("\u2112", "\\mathscr{L}"); - defineMacro("\u2133", "\\mathscr{M}"); - defineMacro("\u211B", "\\mathscr{R}"); - defineMacro("\u212D", "\\mathfrak{C}"); - defineMacro("\u210C", "\\mathfrak{H}"); - defineMacro("\u2128", "\\mathfrak{Z}"); - defineMacro("\\Bbbk", "\\Bbb{k}"); - defineMacro("\xB7", "\\cdotp"); - defineMacro("\\llap", "\\mathllap{\\textrm{#1}}"); - defineMacro("\\rlap", "\\mathrlap{\\textrm{#1}}"); - defineMacro("\\clap", "\\mathclap{\\textrm{#1}}"); - defineMacro("\\mathstrut", "\\vphantom{(}"); - defineMacro("\\underbar", "\\underline{\\text{#1}}"); - defineMacro( - "\\not", - '\\html@mathml{\\mathrel{\\mathrlap\\@not}}{\\char"338}', - ); - defineMacro( - "\\neq", - "\\html@mathml{\\mathrel{\\not=}}{\\mathrel{\\char`\u2260}}", - ); - defineMacro("\\ne", "\\neq"); - defineMacro("\u2260", "\\neq"); - defineMacro( - "\\notin", - "\\html@mathml{\\mathrel{{\\in}\\mathllap{/\\mskip1mu}}}" + - "{\\mathrel{\\char`\u2209}}", - ); - defineMacro("\u2209", "\\notin"); - defineMacro( - "\u2258", - "\\html@mathml{" + - "\\mathrel{=\\kern{-1em}\\raisebox{0.4em}{$\\scriptsize\\frown$}}" + - "}{\\mathrel{\\char`\u2258}}", - ); - defineMacro( - "\u2259", - "\\html@mathml{\\stackrel{\\tiny\\wedge}{=}}{\\mathrel{\\char`\u2258}}", - ); - defineMacro( - "\u225A", - "\\html@mathml{\\stackrel{\\tiny\\vee}{=}}{\\mathrel{\\char`\u225A}}", - ); - defineMacro( - "\u225B", - "\\html@mathml{\\stackrel{\\scriptsize\\star}{=}}" + - "{\\mathrel{\\char`\u225B}}", - ); - defineMacro( - "\u225D", - "\\html@mathml{\\stackrel{\\tiny\\mathrm{def}}{=}}" + - "{\\mathrel{\\char`\u225D}}", - ); - defineMacro( - "\u225E", - "\\html@mathml{\\stackrel{\\tiny\\mathrm{m}}{=}}" + - "{\\mathrel{\\char`\u225E}}", - ); - defineMacro( - "\u225F", - "\\html@mathml{\\stackrel{\\tiny?}{=}}{\\mathrel{\\char`\u225F}}", - ); - defineMacro("\u27C2", "\\perp"); - defineMacro("\u203C", "\\mathclose{!\\mkern-0.8mu!}"); - defineMacro("\u220C", "\\notni"); - defineMacro("\u231C", "\\ulcorner"); - defineMacro("\u231D", "\\urcorner"); - defineMacro("\u231E", "\\llcorner"); - defineMacro("\u231F", "\\lrcorner"); - defineMacro("\xA9", "\\copyright"); - defineMacro("\xAE", "\\textregistered"); - defineMacro("\uFE0F", "\\textregistered"); - defineMacro( - "\\ulcorner", - '\\html@mathml{\\@ulcorner}{\\mathop{\\char"231c}}', - ); - defineMacro( - "\\urcorner", - '\\html@mathml{\\@urcorner}{\\mathop{\\char"231d}}', - ); - defineMacro( - "\\llcorner", - '\\html@mathml{\\@llcorner}{\\mathop{\\char"231e}}', - ); - defineMacro( - "\\lrcorner", - '\\html@mathml{\\@lrcorner}{\\mathop{\\char"231f}}', - ); - defineMacro("\\vdots", "{\\varvdots\\rule{0pt}{15pt}}"); - defineMacro("\u22EE", "\\vdots"); - defineMacro("\\varGamma", "\\mathit{\\Gamma}"); - defineMacro("\\varDelta", "\\mathit{\\Delta}"); - defineMacro("\\varTheta", "\\mathit{\\Theta}"); - defineMacro("\\varLambda", "\\mathit{\\Lambda}"); - defineMacro("\\varXi", "\\mathit{\\Xi}"); - defineMacro("\\varPi", "\\mathit{\\Pi}"); - defineMacro("\\varSigma", "\\mathit{\\Sigma}"); - defineMacro("\\varUpsilon", "\\mathit{\\Upsilon}"); - defineMacro("\\varPhi", "\\mathit{\\Phi}"); - defineMacro("\\varPsi", "\\mathit{\\Psi}"); - defineMacro("\\varOmega", "\\mathit{\\Omega}"); - defineMacro("\\substack", "\\begin{subarray}{c}#1\\end{subarray}"); - defineMacro( - "\\colon", - "\\nobreak\\mskip2mu\\mathpunct{}" + - "\\mathchoice{\\mkern-3mu}{\\mkern-3mu}{}{}{:}\\mskip6mu\\relax", - ); - defineMacro("\\boxed", "\\fbox{$\\displaystyle{#1}$}"); - defineMacro("\\iff", "\\DOTSB\\;\\Longleftrightarrow\\;"); - defineMacro("\\implies", "\\DOTSB\\;\\Longrightarrow\\;"); - defineMacro("\\impliedby", "\\DOTSB\\;\\Longleftarrow\\;"); - defineMacro( - "\\dddot", - "{\\overset{\\raisebox{-0.1ex}{\\normalsize ...}}{#1}}", - ); - defineMacro( - "\\ddddot", - "{\\overset{\\raisebox{-0.1ex}{\\normalsize ....}}{#1}}", - ); - var dotsByToken = { - ",": "\\dotsc", - "\\not": "\\dotsb", - "+": "\\dotsb", - "=": "\\dotsb", - "<": "\\dotsb", - ">": "\\dotsb", - "-": "\\dotsb", - "*": "\\dotsb", - ":": "\\dotsb", - "\\DOTSB": "\\dotsb", - "\\coprod": "\\dotsb", - "\\bigvee": "\\dotsb", - "\\bigwedge": "\\dotsb", - "\\biguplus": "\\dotsb", - "\\bigcap": "\\dotsb", - "\\bigcup": "\\dotsb", - "\\prod": "\\dotsb", - "\\sum": "\\dotsb", - "\\bigotimes": "\\dotsb", - "\\bigoplus": "\\dotsb", - "\\bigodot": "\\dotsb", - "\\bigsqcup": "\\dotsb", - "\\And": "\\dotsb", - "\\longrightarrow": "\\dotsb", - "\\Longrightarrow": "\\dotsb", - "\\longleftarrow": "\\dotsb", - "\\Longleftarrow": "\\dotsb", - "\\longleftrightarrow": "\\dotsb", - "\\Longleftrightarrow": "\\dotsb", - "\\mapsto": "\\dotsb", - "\\longmapsto": "\\dotsb", - "\\hookrightarrow": "\\dotsb", - "\\doteq": "\\dotsb", - "\\mathbin": "\\dotsb", - "\\mathrel": "\\dotsb", - "\\relbar": "\\dotsb", - "\\Relbar": "\\dotsb", - "\\xrightarrow": "\\dotsb", - "\\xleftarrow": "\\dotsb", - "\\DOTSI": "\\dotsi", - "\\int": "\\dotsi", - "\\oint": "\\dotsi", - "\\iint": "\\dotsi", - "\\iiint": "\\dotsi", - "\\iiiint": "\\dotsi", - "\\idotsint": "\\dotsi", - "\\DOTSX": "\\dotsx", - }; - defineMacro("\\dots", function (context) { - var thedots = "\\dotso"; - var next = context.expandAfterFuture().text; - if (next in dotsByToken) { - thedots = dotsByToken[next]; - } else if (next.slice(0, 4) === "\\not") { - thedots = "\\dotsb"; - } else if (next in symbols.math) { - if (utils.contains(["bin", "rel"], symbols.math[next].group)) { - thedots = "\\dotsb"; - } - } - return thedots; - }); - var spaceAfterDots = { - ")": true, - "]": true, - "\\rbrack": true, - "\\}": true, - "\\rbrace": true, - "\\rangle": true, - "\\rceil": true, - "\\rfloor": true, - "\\rgroup": true, - "\\rmoustache": true, - "\\right": true, - "\\bigr": true, - "\\biggr": true, - "\\Bigr": true, - "\\Biggr": true, - $: true, - ";": true, - ".": true, - ",": true, - }; - defineMacro("\\dotso", function (context) { - var next = context.future().text; - if (next in spaceAfterDots) { - return "\\ldots\\,"; - } else { - return "\\ldots"; - } - }); - defineMacro("\\dotsc", function (context) { - var next = context.future().text; - if (next in spaceAfterDots && next !== ",") { - return "\\ldots\\,"; - } else { - return "\\ldots"; - } - }); - defineMacro("\\cdots", function (context) { - var next = context.future().text; - if (next in spaceAfterDots) { - return "\\@cdots\\,"; - } else { - return "\\@cdots"; - } - }); - defineMacro("\\dotsb", "\\cdots"); - defineMacro("\\dotsm", "\\cdots"); - defineMacro("\\dotsi", "\\!\\cdots"); - defineMacro("\\dotsx", "\\ldots\\,"); - defineMacro("\\DOTSI", "\\relax"); - defineMacro("\\DOTSB", "\\relax"); - defineMacro("\\DOTSX", "\\relax"); - defineMacro("\\tmspace", "\\TextOrMath{\\kern#1#3}{\\mskip#1#2}\\relax"); - defineMacro("\\,", "\\tmspace+{3mu}{.1667em}"); - defineMacro("\\thinspace", "\\,"); - defineMacro("\\>", "\\mskip{4mu}"); - defineMacro("\\:", "\\tmspace+{4mu}{.2222em}"); - defineMacro("\\medspace", "\\:"); - defineMacro("\\;", "\\tmspace+{5mu}{.2777em}"); - defineMacro("\\thickspace", "\\;"); - defineMacro("\\!", "\\tmspace-{3mu}{.1667em}"); - defineMacro("\\negthinspace", "\\!"); - defineMacro("\\negmedspace", "\\tmspace-{4mu}{.2222em}"); - defineMacro("\\negthickspace", "\\tmspace-{5mu}{.277em}"); - defineMacro("\\enspace", "\\kern.5em "); - defineMacro("\\enskip", "\\hskip.5em\\relax"); - defineMacro("\\quad", "\\hskip1em\\relax"); - defineMacro("\\qquad", "\\hskip2em\\relax"); - defineMacro("\\tag", "\\@ifstar\\tag@literal\\tag@paren"); - defineMacro("\\tag@paren", "\\tag@literal{({#1})}"); - defineMacro("\\tag@literal", function (context) { - if (context.macros.get("\\df@tag")) { - throw new ParseError("Multiple \\tag"); - } - return "\\gdef\\df@tag{\\text{#1}}"; - }); - defineMacro( - "\\bmod", - "\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}" + - "\\mathbin{\\rm mod}" + - "\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}", - ); - defineMacro( - "\\pod", - "\\allowbreak" + - "\\mathchoice{\\mkern18mu}{\\mkern8mu}{\\mkern8mu}{\\mkern8mu}(#1)", - ); - defineMacro("\\pmod", "\\pod{{\\rm mod}\\mkern6mu#1}"); - defineMacro( - "\\mod", - "\\allowbreak" + - "\\mathchoice{\\mkern18mu}{\\mkern12mu}{\\mkern12mu}{\\mkern12mu}" + - "{\\rm mod}\\,\\,#1", - ); - defineMacro("\\newline", "\\\\\\relax"); - defineMacro( - "\\TeX", - "\\textrm{\\html@mathml{" + - "T\\kern-.1667em\\raisebox{-.5ex}{E}\\kern-.125emX" + - "}{TeX}}", - ); - var latexRaiseA = makeEm( - fontMetricsData["Main-Regular"]["T".charCodeAt(0)][1] - - 0.7 * fontMetricsData["Main-Regular"]["A".charCodeAt(0)][1], - ); - defineMacro( - "\\LaTeX", - "\\textrm{\\html@mathml{" + - ("L\\kern-.36em\\raisebox{" + latexRaiseA + "}{\\scriptstyle A}") + - "\\kern-.15em\\TeX}{LaTeX}}", - ); - defineMacro( - "\\KaTeX", - "\\textrm{\\html@mathml{" + - ("K\\kern-.17em\\raisebox{" + latexRaiseA + "}{\\scriptstyle A}") + - "\\kern-.15em\\TeX}{KaTeX}}", - ); - defineMacro("\\hspace", "\\@ifstar\\@hspacer\\@hspace"); - defineMacro("\\@hspace", "\\hskip #1\\relax"); - defineMacro("\\@hspacer", "\\rule{0pt}{0pt}\\hskip #1\\relax"); - defineMacro("\\ordinarycolon", ":"); - defineMacro("\\vcentcolon", "\\mathrel{\\mathop\\ordinarycolon}"); - defineMacro( - "\\dblcolon", - "\\html@mathml{" + - "\\mathrel{\\vcentcolon\\mathrel{\\mkern-.9mu}\\vcentcolon}}" + - '{\\mathop{\\char"2237}}', - ); - defineMacro( - "\\coloneqq", - "\\html@mathml{" + - "\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}=}}" + - '{\\mathop{\\char"2254}}', - ); - defineMacro( - "\\Coloneqq", - "\\html@mathml{" + - "\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}=}}" + - '{\\mathop{\\char"2237\\char"3d}}', - ); - defineMacro( - "\\coloneq", - "\\html@mathml{" + - "\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}" + - '{\\mathop{\\char"3a\\char"2212}}', - ); - defineMacro( - "\\Coloneq", - "\\html@mathml{" + - "\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}" + - '{\\mathop{\\char"2237\\char"2212}}', - ); - defineMacro( - "\\eqqcolon", - "\\html@mathml{" + - "\\mathrel{=\\mathrel{\\mkern-1.2mu}\\vcentcolon}}" + - '{\\mathop{\\char"2255}}', - ); - defineMacro( - "\\Eqqcolon", - "\\html@mathml{" + - "\\mathrel{=\\mathrel{\\mkern-1.2mu}\\dblcolon}}" + - '{\\mathop{\\char"3d\\char"2237}}', - ); - defineMacro( - "\\eqcolon", - "\\html@mathml{" + - "\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\vcentcolon}}" + - '{\\mathop{\\char"2239}}', - ); - defineMacro( - "\\Eqcolon", - "\\html@mathml{" + - "\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\dblcolon}}" + - '{\\mathop{\\char"2212\\char"2237}}', - ); - defineMacro( - "\\colonapprox", - "\\html@mathml{" + - "\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\approx}}" + - '{\\mathop{\\char"3a\\char"2248}}', - ); - defineMacro( - "\\Colonapprox", - "\\html@mathml{" + - "\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\approx}}" + - '{\\mathop{\\char"2237\\char"2248}}', - ); - defineMacro( - "\\colonsim", - "\\html@mathml{" + - "\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\sim}}" + - '{\\mathop{\\char"3a\\char"223c}}', - ); - defineMacro( - "\\Colonsim", - "\\html@mathml{" + - "\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\sim}}" + - '{\\mathop{\\char"2237\\char"223c}}', - ); - defineMacro("\u2237", "\\dblcolon"); - defineMacro("\u2239", "\\eqcolon"); - defineMacro("\u2254", "\\coloneqq"); - defineMacro("\u2255", "\\eqqcolon"); - defineMacro("\u2A74", "\\Coloneqq"); - defineMacro("\\ratio", "\\vcentcolon"); - defineMacro("\\coloncolon", "\\dblcolon"); - defineMacro("\\colonequals", "\\coloneqq"); - defineMacro("\\coloncolonequals", "\\Coloneqq"); - defineMacro("\\equalscolon", "\\eqqcolon"); - defineMacro("\\equalscoloncolon", "\\Eqqcolon"); - defineMacro("\\colonminus", "\\coloneq"); - defineMacro("\\coloncolonminus", "\\Coloneq"); - defineMacro("\\minuscolon", "\\eqcolon"); - defineMacro("\\minuscoloncolon", "\\Eqcolon"); - defineMacro("\\coloncolonapprox", "\\Colonapprox"); - defineMacro("\\coloncolonsim", "\\Colonsim"); - defineMacro( - "\\simcolon", - "\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\vcentcolon}", - ); - defineMacro( - "\\simcoloncolon", - "\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\dblcolon}", - ); - defineMacro( - "\\approxcolon", - "\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\vcentcolon}", - ); - defineMacro( - "\\approxcoloncolon", - "\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\dblcolon}", - ); - defineMacro("\\notni", "\\html@mathml{\\not\\ni}{\\mathrel{\\char`\u220C}}"); - defineMacro("\\limsup", "\\DOTSB\\operatorname*{lim\\,sup}"); - defineMacro("\\liminf", "\\DOTSB\\operatorname*{lim\\,inf}"); - defineMacro("\\injlim", "\\DOTSB\\operatorname*{inj\\,lim}"); - defineMacro("\\projlim", "\\DOTSB\\operatorname*{proj\\,lim}"); - defineMacro("\\varlimsup", "\\DOTSB\\operatorname*{\\overline{lim}}"); - defineMacro("\\varliminf", "\\DOTSB\\operatorname*{\\underline{lim}}"); - defineMacro("\\varinjlim", "\\DOTSB\\operatorname*{\\underrightarrow{lim}}"); - defineMacro("\\varprojlim", "\\DOTSB\\operatorname*{\\underleftarrow{lim}}"); - defineMacro("\\gvertneqq", "\\html@mathml{\\@gvertneqq}{\u2269}"); - defineMacro("\\lvertneqq", "\\html@mathml{\\@lvertneqq}{\u2268}"); - defineMacro("\\ngeqq", "\\html@mathml{\\@ngeqq}{\u2271}"); - defineMacro("\\ngeqslant", "\\html@mathml{\\@ngeqslant}{\u2271}"); - defineMacro("\\nleqq", "\\html@mathml{\\@nleqq}{\u2270}"); - defineMacro("\\nleqslant", "\\html@mathml{\\@nleqslant}{\u2270}"); - defineMacro("\\nshortmid", "\\html@mathml{\\@nshortmid}{\u2224}"); - defineMacro("\\nshortparallel", "\\html@mathml{\\@nshortparallel}{\u2226}"); - defineMacro("\\nsubseteqq", "\\html@mathml{\\@nsubseteqq}{\u2288}"); - defineMacro("\\nsupseteqq", "\\html@mathml{\\@nsupseteqq}{\u2289}"); - defineMacro("\\varsubsetneq", "\\html@mathml{\\@varsubsetneq}{\u228A}"); - defineMacro("\\varsubsetneqq", "\\html@mathml{\\@varsubsetneqq}{\u2ACB}"); - defineMacro("\\varsupsetneq", "\\html@mathml{\\@varsupsetneq}{\u228B}"); - defineMacro("\\varsupsetneqq", "\\html@mathml{\\@varsupsetneqq}{\u2ACC}"); - defineMacro("\\imath", "\\html@mathml{\\@imath}{\u0131}"); - defineMacro("\\jmath", "\\html@mathml{\\@jmath}{\u0237}"); - defineMacro( - "\\llbracket", - "\\html@mathml{" + - "\\mathopen{[\\mkern-3.2mu[}}" + - "{\\mathopen{\\char`\u27E6}}", - ); - defineMacro( - "\\rrbracket", - "\\html@mathml{" + - "\\mathclose{]\\mkern-3.2mu]}}" + - "{\\mathclose{\\char`\u27E7}}", - ); - defineMacro("\u27E6", "\\llbracket"); - defineMacro("\u27E7", "\\rrbracket"); - defineMacro( - "\\lBrace", - "\\html@mathml{" + - "\\mathopen{\\{\\mkern-3.2mu[}}" + - "{\\mathopen{\\char`\u2983}}", - ); - defineMacro( - "\\rBrace", - "\\html@mathml{" + - "\\mathclose{]\\mkern-3.2mu\\}}}" + - "{\\mathclose{\\char`\u2984}}", - ); - defineMacro("\u2983", "\\lBrace"); - defineMacro("\u2984", "\\rBrace"); - defineMacro( - "\\minuso", - "\\mathbin{\\html@mathml{" + - "{\\mathrlap{\\mathchoice{\\kern{0.145em}}{\\kern{0.145em}}" + - "{\\kern{0.1015em}}{\\kern{0.0725em}}\\circ}{-}}}" + - "{\\char`\u29B5}}", - ); - defineMacro("\u29B5", "\\minuso"); - defineMacro("\\darr", "\\downarrow"); - defineMacro("\\dArr", "\\Downarrow"); - defineMacro("\\Darr", "\\Downarrow"); - defineMacro("\\lang", "\\langle"); - defineMacro("\\rang", "\\rangle"); - defineMacro("\\uarr", "\\uparrow"); - defineMacro("\\uArr", "\\Uparrow"); - defineMacro("\\Uarr", "\\Uparrow"); - defineMacro("\\N", "\\mathbb{N}"); - defineMacro("\\R", "\\mathbb{R}"); - defineMacro("\\Z", "\\mathbb{Z}"); - defineMacro("\\alef", "\\aleph"); - defineMacro("\\alefsym", "\\aleph"); - defineMacro("\\Alpha", "\\mathrm{A}"); - defineMacro("\\Beta", "\\mathrm{B}"); - defineMacro("\\bull", "\\bullet"); - defineMacro("\\Chi", "\\mathrm{X}"); - defineMacro("\\clubs", "\\clubsuit"); - defineMacro("\\cnums", "\\mathbb{C}"); - defineMacro("\\Complex", "\\mathbb{C}"); - defineMacro("\\Dagger", "\\ddagger"); - defineMacro("\\diamonds", "\\diamondsuit"); - defineMacro("\\empty", "\\emptyset"); - defineMacro("\\Epsilon", "\\mathrm{E}"); - defineMacro("\\Eta", "\\mathrm{H}"); - defineMacro("\\exist", "\\exists"); - defineMacro("\\harr", "\\leftrightarrow"); - defineMacro("\\hArr", "\\Leftrightarrow"); - defineMacro("\\Harr", "\\Leftrightarrow"); - defineMacro("\\hearts", "\\heartsuit"); - defineMacro("\\image", "\\Im"); - defineMacro("\\infin", "\\infty"); - defineMacro("\\Iota", "\\mathrm{I}"); - defineMacro("\\isin", "\\in"); - defineMacro("\\Kappa", "\\mathrm{K}"); - defineMacro("\\larr", "\\leftarrow"); - defineMacro("\\lArr", "\\Leftarrow"); - defineMacro("\\Larr", "\\Leftarrow"); - defineMacro("\\lrarr", "\\leftrightarrow"); - defineMacro("\\lrArr", "\\Leftrightarrow"); - defineMacro("\\Lrarr", "\\Leftrightarrow"); - defineMacro("\\Mu", "\\mathrm{M}"); - defineMacro("\\natnums", "\\mathbb{N}"); - defineMacro("\\Nu", "\\mathrm{N}"); - defineMacro("\\Omicron", "\\mathrm{O}"); - defineMacro("\\plusmn", "\\pm"); - defineMacro("\\rarr", "\\rightarrow"); - defineMacro("\\rArr", "\\Rightarrow"); - defineMacro("\\Rarr", "\\Rightarrow"); - defineMacro("\\real", "\\Re"); - defineMacro("\\reals", "\\mathbb{R}"); - defineMacro("\\Reals", "\\mathbb{R}"); - defineMacro("\\Rho", "\\mathrm{P}"); - defineMacro("\\sdot", "\\cdot"); - defineMacro("\\sect", "\\S"); - defineMacro("\\spades", "\\spadesuit"); - defineMacro("\\sub", "\\subset"); - defineMacro("\\sube", "\\subseteq"); - defineMacro("\\supe", "\\supseteq"); - defineMacro("\\Tau", "\\mathrm{T}"); - defineMacro("\\thetasym", "\\vartheta"); - defineMacro("\\weierp", "\\wp"); - defineMacro("\\Zeta", "\\mathrm{Z}"); - defineMacro("\\argmin", "\\DOTSB\\operatorname*{arg\\,min}"); - defineMacro("\\argmax", "\\DOTSB\\operatorname*{arg\\,max}"); - defineMacro("\\plim", "\\DOTSB\\mathop{\\operatorname{plim}}\\limits"); - defineMacro("\\bra", "\\mathinner{\\langle{#1}|}"); - defineMacro("\\ket", "\\mathinner{|{#1}\\rangle}"); - defineMacro("\\braket", "\\mathinner{\\langle{#1}\\rangle}"); - defineMacro("\\Bra", "\\left\\langle#1\\right|"); - defineMacro("\\Ket", "\\left|#1\\right\\rangle"); - var braketHelper = function braketHelper(one) { - return function (context) { - var left = context.consumeArg().tokens; - var middle = context.consumeArg().tokens; - var middleDouble = context.consumeArg().tokens; - var right = context.consumeArg().tokens; - var oldMiddle = context.macros.get("|"); - var oldMiddleDouble = context.macros.get("\\|"); - context.macros.beginGroup(); - var midMacro = function midMacro(_double) { - return function (context) { - if (one) { - context.macros.set("|", oldMiddle); - if (middleDouble.length) { - context.macros.set("\\|", oldMiddleDouble); - } - } - var doubled = _double; - if (!_double && middleDouble.length) { - var nextToken = context.future(); - if (nextToken.text === "|") { - context.popToken(); - doubled = true; - } - } - return { tokens: doubled ? middleDouble : middle, numArgs: 0 }; - }; - }; - context.macros.set("|", midMacro(false)); - if (middleDouble.length) { - context.macros.set("\\|", midMacro(true)); - } - var arg = context.consumeArg().tokens; - var expanded = context.expandTokens( - [].concat( - _toConsumableArray(right), - _toConsumableArray(arg), - _toConsumableArray(left), - ), - ); - context.macros.endGroup(); - return { tokens: expanded.reverse(), numArgs: 0 }; - }; - }; - defineMacro("\\bra@ket", braketHelper(false)); - defineMacro("\\bra@set", braketHelper(true)); - defineMacro( - "\\Braket", - "\\bra@ket{\\left\\langle}" + - "{\\,\\middle\\vert\\,}{\\,\\middle\\vert\\,}{\\right\\rangle}", - ); - defineMacro( - "\\Set", - "\\bra@set{\\left\\{\\:}" + - "{\\;\\middle\\vert\\;}{\\;\\middle\\Vert\\;}{\\:\\right\\}}", - ); - defineMacro("\\set", "\\bra@set{\\{\\,}{\\mid}{}{\\,\\}}"); - defineMacro("\\angln", "{\\angl n}"); - defineMacro("\\blue", "\\textcolor{##6495ed}{#1}"); - defineMacro("\\orange", "\\textcolor{##ffa500}{#1}"); - defineMacro("\\pink", "\\textcolor{##ff00af}{#1}"); - defineMacro("\\red", "\\textcolor{##df0030}{#1}"); - defineMacro("\\green", "\\textcolor{##28ae7b}{#1}"); - defineMacro("\\gray", "\\textcolor{gray}{#1}"); - defineMacro("\\purple", "\\textcolor{##9d38bd}{#1}"); - defineMacro("\\blueA", "\\textcolor{##ccfaff}{#1}"); - defineMacro("\\blueB", "\\textcolor{##80f6ff}{#1}"); - defineMacro("\\blueC", "\\textcolor{##63d9ea}{#1}"); - defineMacro("\\blueD", "\\textcolor{##11accd}{#1}"); - defineMacro("\\blueE", "\\textcolor{##0c7f99}{#1}"); - defineMacro("\\tealA", "\\textcolor{##94fff5}{#1}"); - defineMacro("\\tealB", "\\textcolor{##26edd5}{#1}"); - defineMacro("\\tealC", "\\textcolor{##01d1c1}{#1}"); - defineMacro("\\tealD", "\\textcolor{##01a995}{#1}"); - defineMacro("\\tealE", "\\textcolor{##208170}{#1}"); - defineMacro("\\greenA", "\\textcolor{##b6ffb0}{#1}"); - defineMacro("\\greenB", "\\textcolor{##8af281}{#1}"); - defineMacro("\\greenC", "\\textcolor{##74cf70}{#1}"); - defineMacro("\\greenD", "\\textcolor{##1fab54}{#1}"); - defineMacro("\\greenE", "\\textcolor{##0d923f}{#1}"); - defineMacro("\\goldA", "\\textcolor{##ffd0a9}{#1}"); - defineMacro("\\goldB", "\\textcolor{##ffbb71}{#1}"); - defineMacro("\\goldC", "\\textcolor{##ff9c39}{#1}"); - defineMacro("\\goldD", "\\textcolor{##e07d10}{#1}"); - defineMacro("\\goldE", "\\textcolor{##a75a05}{#1}"); - defineMacro("\\redA", "\\textcolor{##fca9a9}{#1}"); - defineMacro("\\redB", "\\textcolor{##ff8482}{#1}"); - defineMacro("\\redC", "\\textcolor{##f9685d}{#1}"); - defineMacro("\\redD", "\\textcolor{##e84d39}{#1}"); - defineMacro("\\redE", "\\textcolor{##bc2612}{#1}"); - defineMacro("\\maroonA", "\\textcolor{##ffbde0}{#1}"); - defineMacro("\\maroonB", "\\textcolor{##ff92c6}{#1}"); - defineMacro("\\maroonC", "\\textcolor{##ed5fa6}{#1}"); - defineMacro("\\maroonD", "\\textcolor{##ca337c}{#1}"); - defineMacro("\\maroonE", "\\textcolor{##9e034e}{#1}"); - defineMacro("\\purpleA", "\\textcolor{##ddd7ff}{#1}"); - defineMacro("\\purpleB", "\\textcolor{##c6b9fc}{#1}"); - defineMacro("\\purpleC", "\\textcolor{##aa87ff}{#1}"); - defineMacro("\\purpleD", "\\textcolor{##7854ab}{#1}"); - defineMacro("\\purpleE", "\\textcolor{##543b78}{#1}"); - defineMacro("\\mintA", "\\textcolor{##f5f9e8}{#1}"); - defineMacro("\\mintB", "\\textcolor{##edf2df}{#1}"); - defineMacro("\\mintC", "\\textcolor{##e0e5cc}{#1}"); - defineMacro("\\grayA", "\\textcolor{##f6f7f7}{#1}"); - defineMacro("\\grayB", "\\textcolor{##f0f1f2}{#1}"); - defineMacro("\\grayC", "\\textcolor{##e3e5e6}{#1}"); - defineMacro("\\grayD", "\\textcolor{##d6d8da}{#1}"); - defineMacro("\\grayE", "\\textcolor{##babec2}{#1}"); - defineMacro("\\grayF", "\\textcolor{##888d93}{#1}"); - defineMacro("\\grayG", "\\textcolor{##626569}{#1}"); - defineMacro("\\grayH", "\\textcolor{##3b3e40}{#1}"); - defineMacro("\\grayI", "\\textcolor{##21242c}{#1}"); - defineMacro("\\kaBlue", "\\textcolor{##314453}{#1}"); - defineMacro("\\kaGreen", "\\textcolor{##71B307}{#1}"); - var implicitCommands = { - "^": true, - _: true, - "\\limits": true, - "\\nolimits": true, - }; - var MacroExpander = (function () { - function MacroExpander(input, settings, mode) { - _classCallCheck(this, MacroExpander); - this.settings = void 0; - this.expansionCount = void 0; - this.lexer = void 0; - this.macros = void 0; - this.stack = void 0; - this.mode = void 0; - this.settings = settings; - this.expansionCount = 0; - this.feed(input); - this.macros = new Namespace(macros, settings.macros); - this.mode = mode; - this.stack = []; - } - return _createClass(MacroExpander, [ - { - key: "feed", - value: function feed(input) { - this.lexer = new Lexer(input, this.settings); - }, - }, - { - key: "switchMode", - value: function switchMode(newMode) { - this.mode = newMode; - }, - }, - { - key: "beginGroup", - value: function beginGroup() { - this.macros.beginGroup(); - }, - }, - { - key: "endGroup", - value: function endGroup() { - this.macros.endGroup(); - }, - }, - { - key: "endGroups", - value: function endGroups() { - this.macros.endGroups(); - }, - }, - { - key: "future", - value: function future() { - if (this.stack.length === 0) { - this.pushToken(this.lexer.lex()); - } - return this.stack[this.stack.length - 1]; - }, - }, - { - key: "popToken", - value: function popToken() { - this.future(); - return this.stack.pop(); - }, - }, - { - key: "pushToken", - value: function pushToken(token) { - this.stack.push(token); - }, - }, - { - key: "pushTokens", - value: function pushTokens(tokens) { - var _this$stack; - (_this$stack = this.stack).push.apply( - _this$stack, - _toConsumableArray(tokens), - ); - }, - }, - { - key: "scanArgument", - value: function scanArgument(isOptional) { - var start; - var end; - var tokens; - if (isOptional) { - this.consumeSpaces(); - if (this.future().text !== "[") { - return null; - } - start = this.popToken(); - var _this$consumeArg = this.consumeArg(["]"]); - tokens = _this$consumeArg.tokens; - end = _this$consumeArg.end; - } else { - var _this$consumeArg2 = this.consumeArg(); - tokens = _this$consumeArg2.tokens; - start = _this$consumeArg2.start; - end = _this$consumeArg2.end; - } - this.pushToken(new Token("EOF", end.loc)); - this.pushTokens(tokens); - return start.range(end, ""); - }, - }, - { - key: "consumeSpaces", - value: function consumeSpaces() { - for (;;) { - var token = this.future(); - if (token.text === " ") { - this.stack.pop(); - } else { - break; - } - } - }, - }, - { - key: "consumeArg", - value: function consumeArg(delims) { - var tokens = []; - var isDelimited = delims && delims.length > 0; - if (!isDelimited) { - this.consumeSpaces(); - } - var start = this.future(); - var tok; - var depth = 0; - var match = 0; - do { - tok = this.popToken(); - tokens.push(tok); - if (tok.text === "{") { - ++depth; - } else if (tok.text === "}") { - --depth; - if (depth === -1) { - throw new ParseError("Extra }", tok); - } - } else if (tok.text === "EOF") { - throw new ParseError( - "Unexpected end of input in a macro argument" + - ", expected '" + - (delims && isDelimited ? delims[match] : "}") + - "'", - tok, - ); - } - if (delims && isDelimited) { - if ( - (depth === 0 || (depth === 1 && delims[match] === "{")) && - tok.text === delims[match] - ) { - ++match; - if (match === delims.length) { - tokens.splice(-match, match); - break; - } - } else { - match = 0; - } - } - } while (depth !== 0 || isDelimited); - if (start.text === "{" && tokens[tokens.length - 1].text === "}") { - tokens.pop(); - tokens.shift(); - } - tokens.reverse(); - return { tokens: tokens, start: start, end: tok }; - }, - }, - { - key: "consumeArgs", - value: function consumeArgs(numArgs, delimiters) { - if (delimiters) { - if (delimiters.length !== numArgs + 1) { - throw new ParseError( - "The length of delimiters doesn't match the number of args!", - ); - } - var delims = delimiters[0]; - for (var i = 0; i < delims.length; i++) { - var tok = this.popToken(); - if (delims[i] !== tok.text) { - throw new ParseError( - "Use of the macro doesn't match its definition", - tok, - ); - } - } - } - var args = []; - for (var _i = 0; _i < numArgs; _i++) { - args.push(this.consumeArg(delimiters && delimiters[_i + 1]).tokens); - } - return args; - }, - }, - { - key: "countExpansion", - value: function countExpansion(amount) { - this.expansionCount += amount; - if (this.expansionCount > this.settings.maxExpand) { - throw new ParseError( - "Too many expansions: infinite loop or " + - "need to increase maxExpand setting", - ); - } - }, - }, - { - key: "expandOnce", - value: function expandOnce(expandableOnly) { - var topToken = this.popToken(); - var name = topToken.text; - var expansion = !topToken.noexpand ? this._getExpansion(name) : null; - if (expansion == null || (expandableOnly && expansion.unexpandable)) { - if ( - expandableOnly && - expansion == null && - name[0] === "\\" && - !this.isDefined(name) - ) { - throw new ParseError("Undefined control sequence: " + name); - } - this.pushToken(topToken); - return false; - } - this.countExpansion(1); - var tokens = expansion.tokens; - var args = this.consumeArgs(expansion.numArgs, expansion.delimiters); - if (expansion.numArgs) { - tokens = tokens.slice(); - for (var i = tokens.length - 1; i >= 0; --i) { - var tok = tokens[i]; - if (tok.text === "#") { - if (i === 0) { - throw new ParseError( - "Incomplete placeholder at end of macro body", - tok, - ); - } - tok = tokens[--i]; - if (tok.text === "#") { - tokens.splice(i + 1, 1); - } else if (/^[1-9]$/.test(tok.text)) { - var _tokens; - (_tokens = tokens).splice.apply( - _tokens, - [i, 2].concat(_toConsumableArray(args[+tok.text - 1])), - ); - } else { - throw new ParseError("Not a valid argument number", tok); - } - } - } - } - this.pushTokens(tokens); - return tokens.length; - }, - }, - { - key: "expandAfterFuture", - value: function expandAfterFuture() { - this.expandOnce(); - return this.future(); - }, - }, - { - key: "expandNextToken", - value: function expandNextToken() { - for (;;) { - if (this.expandOnce() === false) { - var token = this.stack.pop(); - if (token.treatAsRelax) { - token.text = "\\relax"; - } - return token; - } - } - throw new Error(); - }, - }, - { - key: "expandMacro", - value: function expandMacro(name) { - return this.macros.has(name) - ? this.expandTokens([new Token(name)]) - : undefined; - }, - }, - { - key: "expandTokens", - value: function expandTokens(tokens) { - var output = []; - var oldStackLength = this.stack.length; - this.pushTokens(tokens); - while (this.stack.length > oldStackLength) { - if (this.expandOnce(true) === false) { - var token = this.stack.pop(); - if (token.treatAsRelax) { - token.noexpand = false; - token.treatAsRelax = false; - } - output.push(token); - } - } - this.countExpansion(output.length); - return output; - }, - }, - { - key: "expandMacroAsText", - value: function expandMacroAsText(name) { - var tokens = this.expandMacro(name); - if (tokens) { - return tokens - .map(function (token) { - return token.text; - }) - .join(""); - } else { - return tokens; - } - }, - }, - { - key: "_getExpansion", - value: function _getExpansion(name) { - var definition = this.macros.get(name); - if (definition == null) { - return definition; - } - if (name.length === 1) { - var catcode = this.lexer.catcodes[name]; - if (catcode != null && catcode !== 13) { - return; - } - } - var expansion = - typeof definition === "function" ? definition(this) : definition; - if (typeof expansion === "string") { - var numArgs = 0; - if (expansion.indexOf("#") !== -1) { - var stripped = expansion.replace(/##/g, ""); - while (stripped.indexOf("#" + (numArgs + 1)) !== -1) { - ++numArgs; - } - } - var bodyLexer = new Lexer(expansion, this.settings); - var tokens = []; - var tok = bodyLexer.lex(); - while (tok.text !== "EOF") { - tokens.push(tok); - tok = bodyLexer.lex(); - } - tokens.reverse(); - var expanded = { tokens: tokens, numArgs: numArgs }; - return expanded; - } - return expansion; - }, - }, - { - key: "isDefined", - value: function isDefined(name) { - return ( - this.macros.has(name) || - functions.hasOwnProperty(name) || - symbols.math.hasOwnProperty(name) || - symbols.text.hasOwnProperty(name) || - implicitCommands.hasOwnProperty(name) - ); - }, - }, - { - key: "isExpandable", - value: function isExpandable(name) { - var macro = this.macros.get(name); - return macro != null - ? typeof macro === "string" || - typeof macro === "function" || - !macro.unexpandable - : functions.hasOwnProperty(name) && !functions[name].primitive; - }, - }, - ]); - })(); - var unicodeSubRegEx = /^[₊₋₌₍₎₀₁₂₃₄₅₆₇₈₉ₐₑₕᵢⱼₖₗₘₙₒₚᵣₛₜᵤᵥₓᵦᵧᵨᵩᵪ]/; - var uSubsAndSups = Object.freeze({ - "\u208A": "+", - "\u208B": "-", - "\u208C": "=", - "\u208D": "(", - "\u208E": ")", - "\u2080": "0", - "\u2081": "1", - "\u2082": "2", - "\u2083": "3", - "\u2084": "4", - "\u2085": "5", - "\u2086": "6", - "\u2087": "7", - "\u2088": "8", - "\u2089": "9", - "\u2090": "a", - "\u2091": "e", - "\u2095": "h", - "\u1D62": "i", - "\u2C7C": "j", - "\u2096": "k", - "\u2097": "l", - "\u2098": "m", - "\u2099": "n", - "\u2092": "o", - "\u209A": "p", - "\u1D63": "r", - "\u209B": "s", - "\u209C": "t", - "\u1D64": "u", - "\u1D65": "v", - "\u2093": "x", - "\u1D66": "\u03B2", - "\u1D67": "\u03B3", - "\u1D68": "\u03C1", - "\u1D69": "\u03D5", - "\u1D6A": "\u03C7", - "\u207A": "+", - "\u207B": "-", - "\u207C": "=", - "\u207D": "(", - "\u207E": ")", - "\u2070": "0", - "\xB9": "1", - "\xB2": "2", - "\xB3": "3", - "\u2074": "4", - "\u2075": "5", - "\u2076": "6", - "\u2077": "7", - "\u2078": "8", - "\u2079": "9", - "\u1D2C": "A", - "\u1D2E": "B", - "\u1D30": "D", - "\u1D31": "E", - "\u1D33": "G", - "\u1D34": "H", - "\u1D35": "I", - "\u1D36": "J", - "\u1D37": "K", - "\u1D38": "L", - "\u1D39": "M", - "\u1D3A": "N", - "\u1D3C": "O", - "\u1D3E": "P", - "\u1D3F": "R", - "\u1D40": "T", - "\u1D41": "U", - "\u2C7D": "V", - "\u1D42": "W", - "\u1D43": "a", - "\u1D47": "b", - "\u1D9C": "c", - "\u1D48": "d", - "\u1D49": "e", - "\u1DA0": "f", - "\u1D4D": "g", - "\u02B0": "h", - "\u2071": "i", - "\u02B2": "j", - "\u1D4F": "k", - "\u02E1": "l", - "\u1D50": "m", - "\u207F": "n", - "\u1D52": "o", - "\u1D56": "p", - "\u02B3": "r", - "\u02E2": "s", - "\u1D57": "t", - "\u1D58": "u", - "\u1D5B": "v", - "\u02B7": "w", - "\u02E3": "x", - "\u02B8": "y", - "\u1DBB": "z", - "\u1D5D": "\u03B2", - "\u1D5E": "\u03B3", - "\u1D5F": "\u03B4", - "\u1D60": "\u03D5", - "\u1D61": "\u03C7", - "\u1DBF": "\u03B8", - }); - var unicodeAccents = { - "\u0301": { text: "\\'", math: "\\acute" }, - "\u0300": { text: "\\`", math: "\\grave" }, - "\u0308": { text: '\\"', math: "\\ddot" }, - "\u0303": { text: "\\~", math: "\\tilde" }, - "\u0304": { text: "\\=", math: "\\bar" }, - "\u0306": { text: "\\u", math: "\\breve" }, - "\u030C": { text: "\\v", math: "\\check" }, - "\u0302": { text: "\\^", math: "\\hat" }, - "\u0307": { text: "\\.", math: "\\dot" }, - "\u030A": { text: "\\r", math: "\\mathring" }, - "\u030B": { text: "\\H" }, - "\u0327": { text: "\\c" }, - }; - var unicodeSymbols = { - "\xE1": "a\u0301", - "\xE0": "a\u0300", - "\xE4": "a\u0308", - "\u01DF": "a\u0308\u0304", - "\xE3": "a\u0303", - "\u0101": "a\u0304", - "\u0103": "a\u0306", - "\u1EAF": "a\u0306\u0301", - "\u1EB1": "a\u0306\u0300", - "\u1EB5": "a\u0306\u0303", - "\u01CE": "a\u030C", - "\xE2": "a\u0302", - "\u1EA5": "a\u0302\u0301", - "\u1EA7": "a\u0302\u0300", - "\u1EAB": "a\u0302\u0303", - "\u0227": "a\u0307", - "\u01E1": "a\u0307\u0304", - "\xE5": "a\u030A", - "\u01FB": "a\u030A\u0301", - "\u1E03": "b\u0307", - "\u0107": "c\u0301", - "\u1E09": "c\u0327\u0301", - "\u010D": "c\u030C", - "\u0109": "c\u0302", - "\u010B": "c\u0307", - "\xE7": "c\u0327", - "\u010F": "d\u030C", - "\u1E0B": "d\u0307", - "\u1E11": "d\u0327", - "\xE9": "e\u0301", - "\xE8": "e\u0300", - "\xEB": "e\u0308", - "\u1EBD": "e\u0303", - "\u0113": "e\u0304", - "\u1E17": "e\u0304\u0301", - "\u1E15": "e\u0304\u0300", - "\u0115": "e\u0306", - "\u1E1D": "e\u0327\u0306", - "\u011B": "e\u030C", - "\xEA": "e\u0302", - "\u1EBF": "e\u0302\u0301", - "\u1EC1": "e\u0302\u0300", - "\u1EC5": "e\u0302\u0303", - "\u0117": "e\u0307", - "\u0229": "e\u0327", - "\u1E1F": "f\u0307", - "\u01F5": "g\u0301", - "\u1E21": "g\u0304", - "\u011F": "g\u0306", - "\u01E7": "g\u030C", - "\u011D": "g\u0302", - "\u0121": "g\u0307", - "\u0123": "g\u0327", - "\u1E27": "h\u0308", - "\u021F": "h\u030C", - "\u0125": "h\u0302", - "\u1E23": "h\u0307", - "\u1E29": "h\u0327", - "\xED": "i\u0301", - "\xEC": "i\u0300", - "\xEF": "i\u0308", - "\u1E2F": "i\u0308\u0301", - "\u0129": "i\u0303", - "\u012B": "i\u0304", - "\u012D": "i\u0306", - "\u01D0": "i\u030C", - "\xEE": "i\u0302", - "\u01F0": "j\u030C", - "\u0135": "j\u0302", - "\u1E31": "k\u0301", - "\u01E9": "k\u030C", - "\u0137": "k\u0327", - "\u013A": "l\u0301", - "\u013E": "l\u030C", - "\u013C": "l\u0327", - "\u1E3F": "m\u0301", - "\u1E41": "m\u0307", - "\u0144": "n\u0301", - "\u01F9": "n\u0300", - "\xF1": "n\u0303", - "\u0148": "n\u030C", - "\u1E45": "n\u0307", - "\u0146": "n\u0327", - "\xF3": "o\u0301", - "\xF2": "o\u0300", - "\xF6": "o\u0308", - "\u022B": "o\u0308\u0304", - "\xF5": "o\u0303", - "\u1E4D": "o\u0303\u0301", - "\u1E4F": "o\u0303\u0308", - "\u022D": "o\u0303\u0304", - "\u014D": "o\u0304", - "\u1E53": "o\u0304\u0301", - "\u1E51": "o\u0304\u0300", - "\u014F": "o\u0306", - "\u01D2": "o\u030C", - "\xF4": "o\u0302", - "\u1ED1": "o\u0302\u0301", - "\u1ED3": "o\u0302\u0300", - "\u1ED7": "o\u0302\u0303", - "\u022F": "o\u0307", - "\u0231": "o\u0307\u0304", - "\u0151": "o\u030B", - "\u1E55": "p\u0301", - "\u1E57": "p\u0307", - "\u0155": "r\u0301", - "\u0159": "r\u030C", - "\u1E59": "r\u0307", - "\u0157": "r\u0327", - "\u015B": "s\u0301", - "\u1E65": "s\u0301\u0307", - "\u0161": "s\u030C", - "\u1E67": "s\u030C\u0307", - "\u015D": "s\u0302", - "\u1E61": "s\u0307", - "\u015F": "s\u0327", - "\u1E97": "t\u0308", - "\u0165": "t\u030C", - "\u1E6B": "t\u0307", - "\u0163": "t\u0327", - "\xFA": "u\u0301", - "\xF9": "u\u0300", - "\xFC": "u\u0308", - "\u01D8": "u\u0308\u0301", - "\u01DC": "u\u0308\u0300", - "\u01D6": "u\u0308\u0304", - "\u01DA": "u\u0308\u030C", - "\u0169": "u\u0303", - "\u1E79": "u\u0303\u0301", - "\u016B": "u\u0304", - "\u1E7B": "u\u0304\u0308", - "\u016D": "u\u0306", - "\u01D4": "u\u030C", - "\xFB": "u\u0302", - "\u016F": "u\u030A", - "\u0171": "u\u030B", - "\u1E7D": "v\u0303", - "\u1E83": "w\u0301", - "\u1E81": "w\u0300", - "\u1E85": "w\u0308", - "\u0175": "w\u0302", - "\u1E87": "w\u0307", - "\u1E98": "w\u030A", - "\u1E8D": "x\u0308", - "\u1E8B": "x\u0307", - "\xFD": "y\u0301", - "\u1EF3": "y\u0300", - "\xFF": "y\u0308", - "\u1EF9": "y\u0303", - "\u0233": "y\u0304", - "\u0177": "y\u0302", - "\u1E8F": "y\u0307", - "\u1E99": "y\u030A", - "\u017A": "z\u0301", - "\u017E": "z\u030C", - "\u1E91": "z\u0302", - "\u017C": "z\u0307", - "\xC1": "A\u0301", - "\xC0": "A\u0300", - "\xC4": "A\u0308", - "\u01DE": "A\u0308\u0304", - "\xC3": "A\u0303", - "\u0100": "A\u0304", - "\u0102": "A\u0306", - "\u1EAE": "A\u0306\u0301", - "\u1EB0": "A\u0306\u0300", - "\u1EB4": "A\u0306\u0303", - "\u01CD": "A\u030C", - "\xC2": "A\u0302", - "\u1EA4": "A\u0302\u0301", - "\u1EA6": "A\u0302\u0300", - "\u1EAA": "A\u0302\u0303", - "\u0226": "A\u0307", - "\u01E0": "A\u0307\u0304", - "\xC5": "A\u030A", - "\u01FA": "A\u030A\u0301", - "\u1E02": "B\u0307", - "\u0106": "C\u0301", - "\u1E08": "C\u0327\u0301", - "\u010C": "C\u030C", - "\u0108": "C\u0302", - "\u010A": "C\u0307", - "\xC7": "C\u0327", - "\u010E": "D\u030C", - "\u1E0A": "D\u0307", - "\u1E10": "D\u0327", - "\xC9": "E\u0301", - "\xC8": "E\u0300", - "\xCB": "E\u0308", - "\u1EBC": "E\u0303", - "\u0112": "E\u0304", - "\u1E16": "E\u0304\u0301", - "\u1E14": "E\u0304\u0300", - "\u0114": "E\u0306", - "\u1E1C": "E\u0327\u0306", - "\u011A": "E\u030C", - "\xCA": "E\u0302", - "\u1EBE": "E\u0302\u0301", - "\u1EC0": "E\u0302\u0300", - "\u1EC4": "E\u0302\u0303", - "\u0116": "E\u0307", - "\u0228": "E\u0327", - "\u1E1E": "F\u0307", - "\u01F4": "G\u0301", - "\u1E20": "G\u0304", - "\u011E": "G\u0306", - "\u01E6": "G\u030C", - "\u011C": "G\u0302", - "\u0120": "G\u0307", - "\u0122": "G\u0327", - "\u1E26": "H\u0308", - "\u021E": "H\u030C", - "\u0124": "H\u0302", - "\u1E22": "H\u0307", - "\u1E28": "H\u0327", - "\xCD": "I\u0301", - "\xCC": "I\u0300", - "\xCF": "I\u0308", - "\u1E2E": "I\u0308\u0301", - "\u0128": "I\u0303", - "\u012A": "I\u0304", - "\u012C": "I\u0306", - "\u01CF": "I\u030C", - "\xCE": "I\u0302", - "\u0130": "I\u0307", - "\u0134": "J\u0302", - "\u1E30": "K\u0301", - "\u01E8": "K\u030C", - "\u0136": "K\u0327", - "\u0139": "L\u0301", - "\u013D": "L\u030C", - "\u013B": "L\u0327", - "\u1E3E": "M\u0301", - "\u1E40": "M\u0307", - "\u0143": "N\u0301", - "\u01F8": "N\u0300", - "\xD1": "N\u0303", - "\u0147": "N\u030C", - "\u1E44": "N\u0307", - "\u0145": "N\u0327", - "\xD3": "O\u0301", - "\xD2": "O\u0300", - "\xD6": "O\u0308", - "\u022A": "O\u0308\u0304", - "\xD5": "O\u0303", - "\u1E4C": "O\u0303\u0301", - "\u1E4E": "O\u0303\u0308", - "\u022C": "O\u0303\u0304", - "\u014C": "O\u0304", - "\u1E52": "O\u0304\u0301", - "\u1E50": "O\u0304\u0300", - "\u014E": "O\u0306", - "\u01D1": "O\u030C", - "\xD4": "O\u0302", - "\u1ED0": "O\u0302\u0301", - "\u1ED2": "O\u0302\u0300", - "\u1ED6": "O\u0302\u0303", - "\u022E": "O\u0307", - "\u0230": "O\u0307\u0304", - "\u0150": "O\u030B", - "\u1E54": "P\u0301", - "\u1E56": "P\u0307", - "\u0154": "R\u0301", - "\u0158": "R\u030C", - "\u1E58": "R\u0307", - "\u0156": "R\u0327", - "\u015A": "S\u0301", - "\u1E64": "S\u0301\u0307", - "\u0160": "S\u030C", - "\u1E66": "S\u030C\u0307", - "\u015C": "S\u0302", - "\u1E60": "S\u0307", - "\u015E": "S\u0327", - "\u0164": "T\u030C", - "\u1E6A": "T\u0307", - "\u0162": "T\u0327", - "\xDA": "U\u0301", - "\xD9": "U\u0300", - "\xDC": "U\u0308", - "\u01D7": "U\u0308\u0301", - "\u01DB": "U\u0308\u0300", - "\u01D5": "U\u0308\u0304", - "\u01D9": "U\u0308\u030C", - "\u0168": "U\u0303", - "\u1E78": "U\u0303\u0301", - "\u016A": "U\u0304", - "\u1E7A": "U\u0304\u0308", - "\u016C": "U\u0306", - "\u01D3": "U\u030C", - "\xDB": "U\u0302", - "\u016E": "U\u030A", - "\u0170": "U\u030B", - "\u1E7C": "V\u0303", - "\u1E82": "W\u0301", - "\u1E80": "W\u0300", - "\u1E84": "W\u0308", - "\u0174": "W\u0302", - "\u1E86": "W\u0307", - "\u1E8C": "X\u0308", - "\u1E8A": "X\u0307", - "\xDD": "Y\u0301", - "\u1EF2": "Y\u0300", - "\u0178": "Y\u0308", - "\u1EF8": "Y\u0303", - "\u0232": "Y\u0304", - "\u0176": "Y\u0302", - "\u1E8E": "Y\u0307", - "\u0179": "Z\u0301", - "\u017D": "Z\u030C", - "\u1E90": "Z\u0302", - "\u017B": "Z\u0307", - "\u03AC": "\u03B1\u0301", - "\u1F70": "\u03B1\u0300", - "\u1FB1": "\u03B1\u0304", - "\u1FB0": "\u03B1\u0306", - "\u03AD": "\u03B5\u0301", - "\u1F72": "\u03B5\u0300", - "\u03AE": "\u03B7\u0301", - "\u1F74": "\u03B7\u0300", - "\u03AF": "\u03B9\u0301", - "\u1F76": "\u03B9\u0300", - "\u03CA": "\u03B9\u0308", - "\u0390": "\u03B9\u0308\u0301", - "\u1FD2": "\u03B9\u0308\u0300", - "\u1FD1": "\u03B9\u0304", - "\u1FD0": "\u03B9\u0306", - "\u03CC": "\u03BF\u0301", - "\u1F78": "\u03BF\u0300", - "\u03CD": "\u03C5\u0301", - "\u1F7A": "\u03C5\u0300", - "\u03CB": "\u03C5\u0308", - "\u03B0": "\u03C5\u0308\u0301", - "\u1FE2": "\u03C5\u0308\u0300", - "\u1FE1": "\u03C5\u0304", - "\u1FE0": "\u03C5\u0306", - "\u03CE": "\u03C9\u0301", - "\u1F7C": "\u03C9\u0300", - "\u038E": "\u03A5\u0301", - "\u1FEA": "\u03A5\u0300", - "\u03AB": "\u03A5\u0308", - "\u1FE9": "\u03A5\u0304", - "\u1FE8": "\u03A5\u0306", - "\u038F": "\u03A9\u0301", - "\u1FFA": "\u03A9\u0300", - }; - var Parser = (function () { - function Parser(input, settings) { - _classCallCheck(this, Parser); - this.mode = void 0; - this.gullet = void 0; - this.settings = void 0; - this.leftrightDepth = void 0; - this.nextToken = void 0; - this.mode = "math"; - this.gullet = new MacroExpander(input, settings, this.mode); - this.settings = settings; - this.leftrightDepth = 0; - } - return _createClass(Parser, [ - { - key: "expect", - value: function expect(text, consume) { - if (consume === void 0) { - consume = true; - } - if (this.fetch().text !== text) { - throw new ParseError( - "Expected '" + text + "', got '" + this.fetch().text + "'", - this.fetch(), - ); - } - if (consume) { - this.consume(); - } - }, - }, - { - key: "consume", - value: function consume() { - this.nextToken = null; - }, - }, - { - key: "fetch", - value: function fetch() { - if (this.nextToken == null) { - this.nextToken = this.gullet.expandNextToken(); - } - return this.nextToken; - }, - }, - { - key: "switchMode", - value: function switchMode(newMode) { - this.mode = newMode; - this.gullet.switchMode(newMode); - }, - }, - { - key: "parse", - value: function parse() { - if (!this.settings.globalGroup) { - this.gullet.beginGroup(); - } - if (this.settings.colorIsTextColor) { - this.gullet.macros.set("\\color", "\\textcolor"); - } - try { - var parse = this.parseExpression(false); - this.expect("EOF"); - if (!this.settings.globalGroup) { - this.gullet.endGroup(); - } - return parse; - } finally { - this.gullet.endGroups(); - } - }, - }, - { - key: "subparse", - value: function subparse(tokens) { - var oldToken = this.nextToken; - this.consume(); - this.gullet.pushToken(new Token("}")); - this.gullet.pushTokens(tokens); - var parse = this.parseExpression(false); - this.expect("}"); - this.nextToken = oldToken; - return parse; - }, - }, - { - key: "parseExpression", - value: function parseExpression(breakOnInfix, breakOnTokenText) { - var body = []; - while (true) { - if (this.mode === "math") { - this.consumeSpaces(); - } - var lex = this.fetch(); - if (Parser.endOfExpression.indexOf(lex.text) !== -1) { - break; - } - if (breakOnTokenText && lex.text === breakOnTokenText) { - break; - } - if ( - breakOnInfix && - functions[lex.text] && - functions[lex.text].infix - ) { - break; - } - var atom = this.parseAtom(breakOnTokenText); - if (!atom) { - break; - } else if (atom.type === "internal") { - continue; - } - body.push(atom); - } - if (this.mode === "text") { - this.formLigatures(body); - } - return this.handleInfixNodes(body); - }, - }, - { - key: "handleInfixNodes", - value: function handleInfixNodes(body) { - var overIndex = -1; - var funcName; - for (var i = 0; i < body.length; i++) { - if (body[i].type === "infix") { - if (overIndex !== -1) { - throw new ParseError( - "only one infix operator per group", - body[i].token, - ); - } - overIndex = i; - funcName = body[i].replaceWith; - } - } - if (overIndex !== -1 && funcName) { - var numerNode; - var denomNode; - var numerBody = body.slice(0, overIndex); - var denomBody = body.slice(overIndex + 1); - if (numerBody.length === 1 && numerBody[0].type === "ordgroup") { - numerNode = numerBody[0]; - } else { - numerNode = { - type: "ordgroup", - mode: this.mode, - body: numerBody, - }; - } - if (denomBody.length === 1 && denomBody[0].type === "ordgroup") { - denomNode = denomBody[0]; - } else { - denomNode = { - type: "ordgroup", - mode: this.mode, - body: denomBody, - }; - } - var node; - if (funcName === "\\\\abovefrac") { - node = this.callFunction( - funcName, - [numerNode, body[overIndex], denomNode], - [], - ); - } else { - node = this.callFunction(funcName, [numerNode, denomNode], []); - } - return [node]; - } else { - return body; - } - }, - }, - { - key: "handleSupSubscript", - value: function handleSupSubscript(name) { - var symbolToken = this.fetch(); - var symbol = symbolToken.text; - this.consume(); - this.consumeSpaces(); - var group; - do { - var _group; - group = this.parseGroup(name); - } while ( - ((_group = group) == null ? void 0 : _group.type) === "internal" - ); - if (!group) { - throw new ParseError( - "Expected group after '" + symbol + "'", - symbolToken, - ); - } - return group; - }, - }, - { - key: "formatUnsupportedCmd", - value: function formatUnsupportedCmd(text) { - var textordArray = []; - for (var i = 0; i < text.length; i++) { - textordArray.push({ type: "textord", mode: "text", text: text[i] }); - } - var textNode = { type: "text", mode: this.mode, body: textordArray }; - var colorNode = { - type: "color", - mode: this.mode, - color: this.settings.errorColor, - body: [textNode], - }; - return colorNode; - }, - }, - { - key: "parseAtom", - value: function parseAtom(breakOnTokenText) { - var base = this.parseGroup("atom", breakOnTokenText); - if ((base == null ? void 0 : base.type) === "internal") { - return base; - } - if (this.mode === "text") { - return base; - } - var superscript; - var subscript; - while (true) { - this.consumeSpaces(); - var lex = this.fetch(); - if (lex.text === "\\limits" || lex.text === "\\nolimits") { - if (base && base.type === "op") { - var limits = lex.text === "\\limits"; - base.limits = limits; - base.alwaysHandleSupSub = true; - } else if (base && base.type === "operatorname") { - if (base.alwaysHandleSupSub) { - base.limits = lex.text === "\\limits"; - } - } else { - throw new ParseError( - "Limit controls must follow a math operator", - lex, - ); - } - this.consume(); - } else if (lex.text === "^") { - if (superscript) { - throw new ParseError("Double superscript", lex); - } - superscript = this.handleSupSubscript("superscript"); - } else if (lex.text === "_") { - if (subscript) { - throw new ParseError("Double subscript", lex); - } - subscript = this.handleSupSubscript("subscript"); - } else if (lex.text === "'") { - if (superscript) { - throw new ParseError("Double superscript", lex); - } - var prime = { type: "textord", mode: this.mode, text: "\\prime" }; - var primes = [prime]; - this.consume(); - while (this.fetch().text === "'") { - primes.push(prime); - this.consume(); - } - if (this.fetch().text === "^") { - primes.push(this.handleSupSubscript("superscript")); - } - superscript = { type: "ordgroup", mode: this.mode, body: primes }; - } else if (uSubsAndSups[lex.text]) { - var isSub = unicodeSubRegEx.test(lex.text); - var subsupTokens = []; - subsupTokens.push(new Token(uSubsAndSups[lex.text])); - this.consume(); - while (true) { - var token = this.fetch().text; - if (!uSubsAndSups[token]) { - break; - } - if (unicodeSubRegEx.test(token) !== isSub) { - break; - } - subsupTokens.unshift(new Token(uSubsAndSups[token])); - this.consume(); - } - var body = this.subparse(subsupTokens); - if (isSub) { - subscript = { type: "ordgroup", mode: "math", body: body }; - } else { - superscript = { type: "ordgroup", mode: "math", body: body }; - } - } else { - break; - } - } - if (superscript || subscript) { - return { - type: "supsub", - mode: this.mode, - base: base, - sup: superscript, - sub: subscript, - }; - } else { - return base; - } - }, - }, - { - key: "parseFunction", - value: function parseFunction(breakOnTokenText, name) { - var token = this.fetch(); - var func = token.text; - var funcData = functions[func]; - if (!funcData) { - return null; - } - this.consume(); - if (name && name !== "atom" && !funcData.allowedInArgument) { - throw new ParseError( - "Got function '" + - func + - "' with no arguments" + - (name ? " as " + name : ""), - token, - ); - } else if (this.mode === "text" && !funcData.allowedInText) { - throw new ParseError( - "Can't use function '" + func + "' in text mode", - token, - ); - } else if (this.mode === "math" && funcData.allowedInMath === false) { - throw new ParseError( - "Can't use function '" + func + "' in math mode", - token, - ); - } - var _this$parseArguments = this.parseArguments(func, funcData), - args = _this$parseArguments.args, - optArgs = _this$parseArguments.optArgs; - return this.callFunction( - func, - args, - optArgs, - token, - breakOnTokenText, - ); - }, - }, - { - key: "callFunction", - value: function callFunction( - name, - args, - optArgs, - token, - breakOnTokenText, - ) { - var context = { - funcName: name, - parser: this, - token: token, - breakOnTokenText: breakOnTokenText, - }; - var func = functions[name]; - if (func && func.handler) { - return func.handler(context, args, optArgs); - } else { - throw new ParseError("No function handler for " + name); - } - }, - }, - { - key: "parseArguments", - value: function parseArguments(func, funcData) { - var totalArgs = funcData.numArgs + funcData.numOptionalArgs; - if (totalArgs === 0) { - return { args: [], optArgs: [] }; - } - var args = []; - var optArgs = []; - for (var i = 0; i < totalArgs; i++) { - var argType = funcData.argTypes && funcData.argTypes[i]; - var isOptional = i < funcData.numOptionalArgs; - if ( - (funcData.primitive && argType == null) || - (funcData.type === "sqrt" && i === 1 && optArgs[0] == null) - ) { - argType = "primitive"; - } - var arg = this.parseGroupOfType( - "argument to '" + func + "'", - argType, - isOptional, - ); - if (isOptional) { - optArgs.push(arg); - } else if (arg != null) { - args.push(arg); - } else { - throw new ParseError( - "Null argument, please report this as a bug", - ); - } - } - return { args: args, optArgs: optArgs }; - }, - }, - { - key: "parseGroupOfType", - value: function parseGroupOfType(name, type, optional) { - switch (type) { - case "color": - return this.parseColorGroup(optional); - case "size": - return this.parseSizeGroup(optional); - case "url": - return this.parseUrlGroup(optional); - case "math": - case "text": - return this.parseArgumentGroup(optional, type); - case "hbox": { - var group = this.parseArgumentGroup(optional, "text"); - return group != null - ? { - type: "styling", - mode: group.mode, - body: [group], - style: "text", - } - : null; - } - case "raw": { - var token = this.parseStringGroup("raw", optional); - return token != null - ? { type: "raw", mode: "text", string: token.text } - : null; - } - case "primitive": { - if (optional) { - throw new ParseError("A primitive argument cannot be optional"); - } - var _group2 = this.parseGroup(name); - if (_group2 == null) { - throw new ParseError("Expected group as " + name, this.fetch()); - } - return _group2; - } - case "original": - case null: - case undefined: - return this.parseArgumentGroup(optional); - default: - throw new ParseError( - "Unknown group type as " + name, - this.fetch(), - ); - } - }, - }, - { - key: "consumeSpaces", - value: function consumeSpaces() { - while (this.fetch().text === " ") { - this.consume(); - } - }, - }, - { - key: "parseStringGroup", - value: function parseStringGroup(modeName, optional) { - var argToken = this.gullet.scanArgument(optional); - if (argToken == null) { - return null; - } - var str = ""; - var nextToken; - while ((nextToken = this.fetch()).text !== "EOF") { - str += nextToken.text; - this.consume(); - } - this.consume(); - argToken.text = str; - return argToken; - }, - }, - { - key: "parseRegexGroup", - value: function parseRegexGroup(regex, modeName) { - var firstToken = this.fetch(); - var lastToken = firstToken; - var str = ""; - var nextToken; - while ( - (nextToken = this.fetch()).text !== "EOF" && - regex.test(str + nextToken.text) - ) { - lastToken = nextToken; - str += lastToken.text; - this.consume(); - } - if (str === "") { - throw new ParseError( - "Invalid " + modeName + ": '" + firstToken.text + "'", - firstToken, - ); - } - return firstToken.range(lastToken, str); - }, - }, - { - key: "parseColorGroup", - value: function parseColorGroup(optional) { - var res = this.parseStringGroup("color", optional); - if (res == null) { - return null; - } - var match = /^(#[a-f0-9]{3}|#?[a-f0-9]{6}|[a-z]+)$/i.exec(res.text); - if (!match) { - throw new ParseError("Invalid color: '" + res.text + "'", res); - } - var color = match[0]; - if (/^[0-9a-f]{6}$/i.test(color)) { - color = "#" + color; - } - return { type: "color-token", mode: this.mode, color: color }; - }, - }, - { - key: "parseSizeGroup", - value: function parseSizeGroup(optional) { - var res; - var isBlank = false; - this.gullet.consumeSpaces(); - if (!optional && this.gullet.future().text !== "{") { - res = this.parseRegexGroup( - /^[-+]? *(?:$|\d+|\d+\.\d*|\.\d*) *[a-z]{0,2} *$/, - "size", - ); - } else { - res = this.parseStringGroup("size", optional); - } - if (!res) { - return null; - } - if (!optional && res.text.length === 0) { - res.text = "0pt"; - isBlank = true; - } - var match = /([-+]?) *(\d+(?:\.\d*)?|\.\d+) *([a-z]{2})/.exec( - res.text, - ); - if (!match) { - throw new ParseError("Invalid size: '" + res.text + "'", res); - } - var data = { number: +(match[1] + match[2]), unit: match[3] }; - if (!validUnit(data)) { - throw new ParseError("Invalid unit: '" + data.unit + "'", res); - } - return { - type: "size", - mode: this.mode, - value: data, - isBlank: isBlank, - }; - }, - }, - { - key: "parseUrlGroup", - value: function parseUrlGroup(optional) { - this.gullet.lexer.setCatcode("%", 13); - this.gullet.lexer.setCatcode("~", 12); - var res = this.parseStringGroup("url", optional); - this.gullet.lexer.setCatcode("%", 14); - this.gullet.lexer.setCatcode("~", 13); - if (res == null) { - return null; - } - var url = res.text.replace(/\\([#$%&~_^{}])/g, "$1"); - return { type: "url", mode: this.mode, url: url }; - }, - }, - { - key: "parseArgumentGroup", - value: function parseArgumentGroup(optional, mode) { - var argToken = this.gullet.scanArgument(optional); - if (argToken == null) { - return null; - } - var outerMode = this.mode; - if (mode) { - this.switchMode(mode); - } - this.gullet.beginGroup(); - var expression = this.parseExpression(false, "EOF"); - this.expect("EOF"); - this.gullet.endGroup(); - var result = { - type: "ordgroup", - mode: this.mode, - loc: argToken.loc, - body: expression, - }; - if (mode) { - this.switchMode(outerMode); - } - return result; - }, - }, - { - key: "parseGroup", - value: function parseGroup(name, breakOnTokenText) { - var firstToken = this.fetch(); - var text = firstToken.text; - var result; - if (text === "{" || text === "\\begingroup") { - this.consume(); - var groupEnd = text === "{" ? "}" : "\\endgroup"; - this.gullet.beginGroup(); - var expression = this.parseExpression(false, groupEnd); - var lastToken = this.fetch(); - this.expect(groupEnd); - this.gullet.endGroup(); - result = { - type: "ordgroup", - mode: this.mode, - loc: SourceLocation.range(firstToken, lastToken), - body: expression, - semisimple: text === "\\begingroup" || undefined, - }; - } else { - result = - this.parseFunction(breakOnTokenText, name) || this.parseSymbol(); - if ( - result == null && - text[0] === "\\" && - !implicitCommands.hasOwnProperty(text) - ) { - if (this.settings.throwOnError) { - throw new ParseError( - "Undefined control sequence: " + text, - firstToken, - ); - } - result = this.formatUnsupportedCmd(text); - this.consume(); - } - } - return result; - }, - }, - { - key: "formLigatures", - value: function formLigatures(group) { - var n = group.length - 1; - for (var i = 0; i < n; ++i) { - var a = group[i]; - var v = a.text; - if (v === "-" && group[i + 1].text === "-") { - if (i + 1 < n && group[i + 2].text === "-") { - group.splice(i, 3, { - type: "textord", - mode: "text", - loc: SourceLocation.range(a, group[i + 2]), - text: "---", - }); - n -= 2; - } else { - group.splice(i, 2, { - type: "textord", - mode: "text", - loc: SourceLocation.range(a, group[i + 1]), - text: "--", - }); - n -= 1; - } - } - if ((v === "'" || v === "`") && group[i + 1].text === v) { - group.splice(i, 2, { - type: "textord", - mode: "text", - loc: SourceLocation.range(a, group[i + 1]), - text: v + v, - }); - n -= 1; - } - } - }, - }, - { - key: "parseSymbol", - value: function parseSymbol() { - var nucleus = this.fetch(); - var text = nucleus.text; - if (/^\\verb[^a-zA-Z]/.test(text)) { - this.consume(); - var arg = text.slice(5); - var star = arg.charAt(0) === "*"; - if (star) { - arg = arg.slice(1); - } - if (arg.length < 2 || arg.charAt(0) !== arg.slice(-1)) { - throw new ParseError( - "\\verb assertion failed --\n please report what input caused this bug", - ); - } - arg = arg.slice(1, -1); - return { type: "verb", mode: "text", body: arg, star: star }; - } - if ( - unicodeSymbols.hasOwnProperty(text[0]) && - !symbols[this.mode][text[0]] - ) { - if (this.settings.strict && this.mode === "math") { - this.settings.reportNonstrict( - "unicodeTextInMathMode", - 'Accented Unicode text character "' + - text[0] + - '" used in ' + - "math mode", - nucleus, - ); - } - text = unicodeSymbols[text[0]] + text.slice(1); - } - var match = combiningDiacriticalMarksEndRegex.exec(text); - if (match) { - text = text.substring(0, match.index); - if (text === "i") { - text = "\u0131"; - } else if (text === "j") { - text = "\u0237"; - } - } - var symbol; - if (symbols[this.mode][text]) { - if ( - this.settings.strict && - this.mode === "math" && - extraLatin.indexOf(text) >= 0 - ) { - this.settings.reportNonstrict( - "unicodeTextInMathMode", - 'Latin-1/Unicode text character "' + - text[0] + - '" used in ' + - "math mode", - nucleus, - ); - } - var group = symbols[this.mode][text].group; - var loc = SourceLocation.range(nucleus); - var s; - if (ATOMS.hasOwnProperty(group)) { - var family = group; - s = { - type: "atom", - mode: this.mode, - family: family, - loc: loc, - text: text, - }; - } else { - s = { type: group, mode: this.mode, loc: loc, text: text }; - } - symbol = s; - } else if (text.charCodeAt(0) >= 128) { - if (this.settings.strict) { - if (!supportedCodepoint(text.charCodeAt(0))) { - this.settings.reportNonstrict( - "unknownSymbol", - 'Unrecognized Unicode character "' + - text[0] + - '"' + - (" (" + text.charCodeAt(0) + ")"), - nucleus, - ); - } else if (this.mode === "math") { - this.settings.reportNonstrict( - "unicodeTextInMathMode", - 'Unicode text character "' + text[0] + '" used in math mode', - nucleus, - ); - } - } - symbol = { - type: "textord", - mode: "text", - loc: SourceLocation.range(nucleus), - text: text, - }; - } else { - return null; - } - this.consume(); - if (match) { - for (var i = 0; i < match[0].length; i++) { - var accent = match[0][i]; - if (!unicodeAccents[accent]) { - throw new ParseError( - "Unknown accent ' " + accent + "'", - nucleus, - ); - } - var command = - unicodeAccents[accent][this.mode] || - unicodeAccents[accent].text; - if (!command) { - throw new ParseError( - "Accent " + accent + " unsupported in " + this.mode + " mode", - nucleus, - ); - } - symbol = { - type: "accent", - mode: this.mode, - loc: SourceLocation.range(nucleus), - label: command, - isStretchy: false, - isShifty: true, - base: symbol, - }; - } - } - return symbol; - }, - }, - ]); - })(); - Parser.endOfExpression = ["}", "\\endgroup", "\\end", "\\right", "&"]; - var parseTree = function parseTree(toParse, settings) { - if (!(typeof toParse === "string" || toParse instanceof String)) { - throw new TypeError("KaTeX can only parse string typed expression"); - } - var parser = new Parser(toParse, settings); - delete parser.gullet.macros.current["\\df@tag"]; - var tree = parser.parse(); - delete parser.gullet.macros.current["\\current@color"]; - delete parser.gullet.macros.current["\\color"]; - if (parser.gullet.macros.get("\\df@tag")) { - if (!settings.displayMode) { - throw new ParseError("\\tag works only in display equations"); - } - tree = [ - { - type: "tag", - mode: "text", - body: tree, - tag: parser.subparse([new Token("\\df@tag")]), - }, - ]; - } - return tree; - }; - if (typeof document !== "undefined") { - if (document.compatMode !== "CSS1Compat") { - typeof console !== "undefined" && - console.warn( - "Warning: KaTeX doesn't work in quirks mode. Make sure your " + - "website has a suitable doctype.", - ); - } - } - var renderToString = function renderToString(expression, options) { - var markup = renderToDomTree(expression, options).toMarkup(); - return markup; - }; - var renderError = function renderError(error, expression, options) { - if (options.throwOnError || !(error instanceof ParseError)) { - throw error; - } - var node = buildCommon.makeSpan( - ["katex-error"], - [new SymbolNode(expression)], - ); - node.setAttribute("title", error.toString()); - node.setAttribute("style", "color:" + options.errorColor); - return node; - }; - var renderToDomTree = function renderToDomTree(expression, options) { - var settings = new Settings(options); - try { - var tree = parseTree(expression, settings); - return buildTree(tree, expression, settings); - } catch (error) { - return renderError(error, expression, settings); - } - }; - var katexInline = function katexInline(tex, options, transformer) { - var _transformer; - var result; - try { - result = renderToString( - tex, - _objectSpread(_objectSpread({}, options), {}, { displayMode: false }), - ); - } catch (error) { - if (error instanceof ParseError) { - console.warn(error); - result = "") - .concat(escapeHtml(tex), ""); - } else { - throw error; - } - } - return (_transformer = - transformer === null || transformer === void 0 - ? void 0 - : transformer(result, false)) !== null && _transformer !== void 0 - ? _transformer - : result; - }; - var katexBlock = function katexBlock(tex, options, transformer) { - var _transformer2; - var result; - try { - result = "

".concat( - renderToString( - tex, - _objectSpread(_objectSpread({}, options), {}, { displayMode: true }), - ), - "

\n", - ); - } catch (error) { - if (error instanceof ParseError) { - console.warn(error); - result = "

") - .concat(escapeHtml(tex), "

\n"); - } else { - throw error; - } - } - return (_transformer2 = - transformer === null || transformer === void 0 - ? void 0 - : transformer(result, true)) !== null && _transformer2 !== void 0 - ? _transformer2 - : result; - }; - var katex = function katex(md) { - var options = - arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; - var _options$allowInlineW2 = options.allowInlineWithSpace, - allowInlineWithSpace = - _options$allowInlineW2 === void 0 ? false : _options$allowInlineW2, - _options$mathFence2 = options.mathFence, - mathFence = _options$mathFence2 === void 0 ? false : _options$mathFence2, - _options$logger = options.logger, - logger = - _options$logger === void 0 - ? function (errorCode) { - return errorCode === "newLineInDisplayMode" ? "ignore" : "warn"; - } - : _options$logger, - _options$macros = options.macros, - macros = _options$macros === void 0 ? {} : _options$macros, - transformer = options.transformer, - userOptions = _objectWithoutProperties(options, _excluded); - md.use(tex, { - allowInlineWithSpace: allowInlineWithSpace, - mathFence: mathFence, - render: function render(content, displayMode, env) { - var katexOptions = _objectSpread( - { - strict: function strict(errorCode, errorMsg, token) { - var _logger; - return (_logger = logger(errorCode, errorMsg, token, env)) !== - null && _logger !== void 0 - ? _logger - : "ignore"; - }, - macros: macros, - throwOnError: false, - }, - userOptions, - ); - return displayMode - ? katexBlock(content, katexOptions, transformer) - : katexInline(content, katexOptions, transformer); - }, - }); - }; - return katex; -}); From b9c9b0c30cc1a6768b206d4ced8074a14388df7d Mon Sep 17 00:00:00 2001 From: Patrizio Bekerle Date: Wed, 15 Apr 2026 21:01:47 +0200 Subject: [PATCH 09/16] Guard URL schemes Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- txt2tags-it/markdown-it-txt2tags.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/txt2tags-it/markdown-it-txt2tags.js b/txt2tags-it/markdown-it-txt2tags.js index 0155165..159208c 100755 --- a/txt2tags-it/markdown-it-txt2tags.js +++ b/txt2tags-it/markdown-it-txt2tags.js @@ -226,9 +226,11 @@ var markdownitTxt2tags; if (!label || !url) return false; // URL must start with a recognised scheme or / if (!/^[a-zA-Z][\w+\-.]*:\/\/|^\//.test(url)) return false; + if (!md.validateLink(url)) return false; + var normalizedUrl = md.normalizeLink(url); if (!silent) { var token = state.push("link_open", "a", 1); - token.attrs = [["href", url]]; + token.attrs = [["href", normalizedUrl]]; token.markup = "txt2tags"; state.push("text", "", 0).content = label; state.push("link_close", "a", -1).markup = "txt2tags"; From af82b5029ab5275251aa6a5886358931920c41b6 Mon Sep 17 00:00:00 2001 From: luginf Date: Fri, 17 Apr 2026 08:25:53 +0200 Subject: [PATCH 10/16] remove obsolete ressources in info.json --- txt2tags-it/info.json | 2 -- 1 file changed, 2 deletions(-) diff --git a/txt2tags-it/info.json b/txt2tags-it/info.json index 7ef639c..2a64377 100755 --- a/txt2tags-it/info.json +++ b/txt2tags-it/info.json @@ -4,8 +4,6 @@ "script": "txt2tags-it.qml", "resources": [ "markdown-it.js", - "markdown-it-deflist.js", - "markdown-it-katex.js", "markdown-it-txt2tags.js" ], "authors": ["@luginf"], From 17b33602e8aaed8e9ad636c7c3286d5553b970d2 Mon Sep 17 00:00:00 2001 From: luginf Date: Fri, 17 Apr 2026 17:36:37 +0200 Subject: [PATCH 11/16] fix html quotes --- txt2tags-it/txt2tags-it.qml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/txt2tags-it/txt2tags-it.qml b/txt2tags-it/txt2tags-it.qml index 4076021..405a2cb 100755 --- a/txt2tags-it/txt2tags-it.qml +++ b/txt2tags-it/txt2tags-it.qml @@ -103,16 +103,16 @@ QtObject { if (script.platformIsWindows()) path = "/" + path; - mdHtml = mdHtml.replace(/(\b(?:src|href|data-[\w-]+)\s*=\s*["'])([^"']+)["']/gi, (_, prefix, rawPath) => { + mdHtml = mdHtml.replace(/(\b(?:src|href|data-[\w-]+)\s*=\s*)(["'])([^"']+)\2/gi, (_, attr, quote, rawPath) => { if (isProtocolUrl(rawPath)) - return `${prefix}${rawPath}"`; + return `${attr}${quote}${rawPath}${quote}`; let finalPath; if (isUnixAbsolute(rawPath) || isWindowsAbsolute(rawPath)) finalPath = rawPath.replace(/\\/g, '/'); else finalPath = resolvePath(path, rawPath.replace(/^\.\/+/, '')); - return `${prefix}file://${finalPath}"`; + return `${attr}${quote}file://${finalPath}${quote}`; }); //Get original styles From 89efeb4adffcf193465028774c76eef02118ec4c Mon Sep 17 00:00:00 2001 From: luginf Date: Fri, 17 Apr 2026 17:41:51 +0200 Subject: [PATCH 12/16] fix comment % after a line break --- txt2tags-it/markdown-it-txt2tags.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/txt2tags-it/markdown-it-txt2tags.js b/txt2tags-it/markdown-it-txt2tags.js index 159208c..2fcf519 100755 --- a/txt2tags-it/markdown-it-txt2tags.js +++ b/txt2tags-it/markdown-it-txt2tags.js @@ -109,7 +109,8 @@ var markdownitTxt2tags; if (silent) return true; state.line = startLine + 1; return true; - } + }, + { alt: ["paragraph"] } ); // ── Block: + numbered list ─────────────────────────────────────────────── From 80a4a971bac000cdd6458680f47010ac60274f7c Mon Sep 17 00:00:00 2001 From: luginf Date: Fri, 17 Apr 2026 17:54:29 +0200 Subject: [PATCH 13/16] remove setext md by default (activable via option) --- txt2tags-it/markdown-it-txt2tags.js | 12 +++++++++++- txt2tags-it/txt2tags-it.qml | 15 ++++++++++++++- 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/txt2tags-it/markdown-it-txt2tags.js b/txt2tags-it/markdown-it-txt2tags.js index 2fcf519..bbec1ee 100755 --- a/txt2tags-it/markdown-it-txt2tags.js +++ b/txt2tags-it/markdown-it-txt2tags.js @@ -23,8 +23,18 @@ var markdownitTxt2tags; * //italic// → italic * __underline__ → underline * --strikethrough-- → strikethrough + * + * Options: + * useSetextHeadings {boolean} — enable markdown setext headings (Title\n===). + * Default: false. */ - function txt2tagsPlugin(md) { + function txt2tagsPlugin(md, options) { + options = Object.assign({ useSetextHeadings: false }, options); + + if (!options.useSetextHeadings) { + md.block.ruler.disable("lheading"); + } + // ── Override text rule to also stop at / (needed for //italic//) ───────── // markdown-it's built-in text rule stops at isTerminatorChar characters. diff --git a/txt2tags-it/txt2tags-it.qml b/txt2tags-it/txt2tags-it.qml index 405a2cb..07bd9fc 100755 --- a/txt2tags-it/txt2tags-it.qml +++ b/txt2tags-it/txt2tags-it.qml @@ -29,6 +29,13 @@ QtObject { "type": "boolean", "default": true }, + { + "identifier": "useSetextHeadings", + "name": "Setext headings", + "text": "Enable markdown setext headings (Title followed by === or ---)", + "type": "boolean", + "default": false + }, { "identifier": "customStylesheet", "name": "Custom stylesheet", @@ -39,6 +46,7 @@ QtObject { ] property bool useTxt2tagsPlugin property bool useEditorHighlighting + property bool useSetextHeadings function init() { var optionsObj = eval("(" + options + ")"); @@ -47,7 +55,7 @@ QtObject { md = new MarkdownIt.markdownit(optionsObj); if (useTxt2tagsPlugin) - md.use(MarkdownItTxt2tags.markdownitTxt2tags); + md.use(MarkdownItTxt2tags.markdownitTxt2tags, { useSetextHeadings: useSetextHeadings }); if (useTxt2tagsPlugin && useEditorHighlighting) { // Headings: = H1 = == H2 == … @@ -65,6 +73,11 @@ QtObject { script.addHighlightingRule("^%.*$", "%", 11); } + if (useEditorHighlighting && useSetextHeadings) { + script.addHighlightingRule("^={2,}\\s*$", "=", 12); + script.addHighlightingRule("^-{2,}\\s*$", "-", 13); + } + //Allow file:// url scheme var validateLinkOrig = md.validateLink; var GOOD_PROTO_RE = /^(file):/; From 885aa1ea3e9bdd75d6ae2a13cc4f188403b77c2f Mon Sep 17 00:00:00 2001 From: luginf Date: Fri, 17 Apr 2026 19:54:33 +0200 Subject: [PATCH 14/16] fix setex line --- txt2tags-it/txt2tags-it.qml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/txt2tags-it/txt2tags-it.qml b/txt2tags-it/txt2tags-it.qml index 07bd9fc..a990e22 100755 --- a/txt2tags-it/txt2tags-it.qml +++ b/txt2tags-it/txt2tags-it.qml @@ -73,10 +73,6 @@ QtObject { script.addHighlightingRule("^%.*$", "%", 11); } - if (useEditorHighlighting && useSetextHeadings) { - script.addHighlightingRule("^={2,}\\s*$", "=", 12); - script.addHighlightingRule("^-{2,}\\s*$", "-", 13); - } //Allow file:// url scheme var validateLinkOrig = md.validateLink; From 669979b5dc80743932ba1e0a6c852830598b32c2 Mon Sep 17 00:00:00 2001 From: luginf Date: Fri, 17 Apr 2026 23:03:39 +0200 Subject: [PATCH 15/16] adding shortcuts for txt2tags syntax (italic, underline, strikes., heading lv 1->3) --- txt2tags-it/txt2tags-it.qml | 56 +++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) diff --git a/txt2tags-it/txt2tags-it.qml b/txt2tags-it/txt2tags-it.qml index a990e22..4c91bd9 100755 --- a/txt2tags-it/txt2tags-it.qml +++ b/txt2tags-it/txt2tags-it.qml @@ -57,6 +57,15 @@ QtObject { if (useTxt2tagsPlugin) md.use(MarkdownItTxt2tags.markdownitTxt2tags, { useSetextHeadings: useSetextHeadings }); + if (useTxt2tagsPlugin) { + script.registerCustomAction("txt2tags-italic", qsTr("Italic (txt2tags)"), qsTr("Italic"), "format-text-italic", true, false, false); + script.registerCustomAction("txt2tags-strikethrough", qsTr("Strikethrough (txt2tags)"), qsTr("Strike"), "format-text-strikethrough", true, false, false); + script.registerCustomAction("txt2tags-underline", qsTr("Underline (txt2tags)"), qsTr("Underline"), "format-text-underline", true, false, false); + script.registerCustomAction("txt2tags-h1", qsTr("Heading 1 (txt2tags)"), qsTr("H1"), "format-text-header", true, false, false); + script.registerCustomAction("txt2tags-h2", qsTr("Heading 2 (txt2tags)"), qsTr("H2"), "format-text-header", true, false, false); + script.registerCustomAction("txt2tags-h3", qsTr("Heading 3 (txt2tags)"), qsTr("H3"), "format-text-header", true, false, false); + } + if (useTxt2tagsPlugin && useEditorHighlighting) { // Headings: = H1 = == H2 == … script.addHighlightingRule("^= +.+? +=\\s*$", "=", 12); @@ -92,6 +101,53 @@ QtObject { return /^[a-zA-Z]:[\\/]/.test(path); } + function wrapInline(marker) { + var selectedText = script.noteTextEditSelectedText(); + if (selectedText.length > 0) { + script.noteTextEditWrite(marker + selectedText + marker); + } else { + script.noteTextEditWrite(marker + marker); + script.noteTextEditSetCursorPosition(script.noteTextEditCursorPosition() - marker.length); + } + } + + function applyHeading(level) { + var markers = ""; + for (var i = 0; i < level; i++) markers += "="; + + var noteText = script.currentNote().noteText; + var pos = script.noteTextEditCursorPosition(); + var lineStart = noteText.lastIndexOf('\n', pos - 1) + 1; + var lineEnd = noteText.indexOf('\n', pos); + if (lineEnd === -1) lineEnd = noteText.length; + + var line = noteText.substring(lineStart, lineEnd); + + // Extract bare content, stripping any existing txt2tags heading + var headingMatch = line.match(/^(=+)\s+(.*?)\s+\1\s*$/); + var content = headingMatch ? headingMatch[2] : line.trim(); + + // Toggle off if already this heading level, otherwise apply + var sameLevelRe = new RegExp("^" + markers + "\\s+.*?\\s+" + markers + "\\s*$"); + var newLine = sameLevelRe.test(line) + ? content + : markers + " " + content + " " + markers; + + script.noteTextEditSetSelection(lineStart, lineEnd); + script.noteTextEditWrite(newLine); + } + + function customActionInvoked(identifier) { + switch (identifier) { + case "txt2tags-italic": wrapInline("//"); break; + case "txt2tags-strikethrough": wrapInline("--"); break; + case "txt2tags-underline": wrapInline("__"); break; + case "txt2tags-h1": applyHeading(1); break; + case "txt2tags-h2": applyHeading(2); break; + case "txt2tags-h3": applyHeading(3); break; + } + } + /** * This function is called when the markdown html of a note is generated * From bc2c44353e6835073ea7d4c2600a45fd6509247c Mon Sep 17 00:00:00 2001 From: luginf Date: Fri, 17 Apr 2026 23:29:34 +0200 Subject: [PATCH 16/16] fixed various copilot inputs in #284 --- txt2tags-it/info.json | 2 +- txt2tags-it/markdown-it-txt2tags.js | 8 +++++--- txt2tags-it/txt2tags-it.qml | 4 ++-- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/txt2tags-it/info.json b/txt2tags-it/info.json index 2a64377..6774782 100755 --- a/txt2tags-it/info.json +++ b/txt2tags-it/info.json @@ -9,5 +9,5 @@ "authors": ["@luginf"], "version": "0.1", "minAppVersion": "26.4.11", - "description": "This script, based on markdown-it, replaces the default markdown renderer with markdown-it AND also with the txt2tags syntax. It also allows for optional LaTeX rendering support with the Markdown-It KaTeX plugin. (NOTE: LaTeX defaults to rendering with MathML ONLY). \n\nDependencies\nmarkdown-it.js (v8.4.2 bundled with the script)\nMarkdown-It KaTeX plugin (v0.18.0 bundled with the script)\n\nUsage\nFor the possible configuration options check here.\n\nImportant\nThis script currently only works with legacy media links. You can turn them on in the General Settings.\n\nImportant note: You need to use legacy image linking with this script, otherwise there will be no images shown in the preview!" + "description": "This script, based on markdown-it, replaces the default markdown renderer with markdown-it AND also with the txt2tags syntax.\n\nDependencies\nmarkdown-it.js (v8.4.2 bundled with the script)\n\nUsage\nFor the possible configuration options check here.\n\nImportant\nThis script currently only works with legacy media links. You can turn them on in the General Settings.\n\nImportant note: You need to use legacy image linking with this script, otherwise there will be no images shown in the preview!" } diff --git a/txt2tags-it/markdown-it-txt2tags.js b/txt2tags-it/markdown-it-txt2tags.js index bbec1ee..5249f7d 100755 --- a/txt2tags-it/markdown-it-txt2tags.js +++ b/txt2tags-it/markdown-it-txt2tags.js @@ -268,9 +268,11 @@ var markdownitTxt2tags; // Strip trailing punctuation that is unlikely to be part of the URL url = url.replace(/[.,;:!?)]+$/, ""); if (!url) return false; + if (!md.validateLink(url)) return false; + var normalizedUrl = md.normalizeLink(url); if (!silent) { var token = state.push("link_open", "a", 1); - token.attrs = [["href", url]]; + token.attrs = [["href", normalizedUrl]]; token.markup = "autolink"; state.push("text", "", 0).content = url; state.push("link_close", "a", -1).markup = "autolink"; @@ -331,9 +333,9 @@ var markdownitTxt2tags; var end = src.indexOf("--", start); if (end < 0 || end === start) return false; if (!silent) { - state.push("txt2tags_s_open", "s", 1); + state.push("txt2tags_s_open", "del", 1); state.push("text", "", 0).content = src.slice(start, end); - state.push("txt2tags_s_close", "s", -1); + state.push("txt2tags_s_close", "del", -1); } state.pos = end + 2; return true; diff --git a/txt2tags-it/txt2tags-it.qml b/txt2tags-it/txt2tags-it.qml index 4c91bd9..0afc17a 100755 --- a/txt2tags-it/txt2tags-it.qml +++ b/txt2tags-it/txt2tags-it.qml @@ -13,7 +13,7 @@ QtObject { "name": "Markdown-it options", "description": "For available options and default values see markdown-it presets.", "type": "text", - "default": "{" + "\n" + " html: true, // Enable HTML tags in source" + "\n" + " //xhtmlOut: false, // Use '/' to close single tags (
)" + "\n" + " //breaks: false, // Convert '\\n' in paragraphs into
" + "\n" + " //langPrefix: 'language-', // CSS language prefix for fenced blocks" + "\n" + " //linkify: false, // autoconvert URL-like texts to links" + "\n" + "" + "\n" + " // Enable some language-neutral replacements + quotes beautification" + "\n" + " //typographer: false," + "\n" + "" + "\n" + " //maxNesting: 100 // Internal protection, recursion limit" + "\n" + "}" + "default": "{" + "\n" + " html: false, // Enable HTML tags in source" + "\n" + " //xhtmlOut: false, // Use '/' to close single tags (
)" + "\n" + " //breaks: false, // Convert '\\n' in paragraphs into
" + "\n" + " //langPrefix: 'language-', // CSS language prefix for fenced blocks" + "\n" + " //linkify: false, // autoconvert URL-like texts to links" + "\n" + "" + "\n" + " // Enable some language-neutral replacements + quotes beautification" + "\n" + " //typographer: false," + "\n" + "" + "\n" + " //maxNesting: 100 // Internal protection, recursion limit" + "\n" + "}" }, { "identifier": "useTxt2tagsPlugin", @@ -183,7 +183,7 @@ QtObject { //Get original styles var head = html.match(new RegExp("(?:.|\n)*?"))[0]; //Add custom styles - head = head.replace("", "table {border-spacing: 0; border-style: solid; border-width: 1px; border-collapse: collapse; margin-top: 0.5em;} th, td {padding: 0 5px;} del {text-decoration: line-through;}" + customStylesheet + ""); + head = head.replace("", "table {border-spacing: 0; border-style: solid; border-width: 1px; border-collapse: collapse; margin-top: 0.5em;} th, td {padding: 0 5px;} del {text-decoration: line-through;}" + (customStylesheet || "") + ""); mdHtml = "" + head + "" + mdHtml + ""; return mdHtml; }