arnaucube
arnaucube/arnaucube.comPublic Self-hosted repository
arnaucube.com/blog/js/katex/katex.js
blog/js/katex/katex.jsRaw
    1(function webpackUniversalModuleDefinition(root, factory) {
    2	if(typeof exports === 'object' && typeof module === 'object')
    3		module.exports = factory();
    4	else if(typeof define === 'function' && define.amd)
    5		define([], factory);
    6	else if(typeof exports === 'object')
    7		exports["katex"] = factory();
    8	else
    9		root["katex"] = factory();
   10})((typeof self !== 'undefined' ? self : this), function() {
   11return /******/ (function() { // webpackBootstrap
   12/******/ 	"use strict";
   13/******/ 	// The require scope
   14/******/ 	var __webpack_require__ = {};
   15/******/ 	
   16/************************************************************************/
   17/******/ 	/* webpack/runtime/define property getters */
   18/******/ 	!function() {
   19/******/ 		// define getter functions for harmony exports
   20/******/ 		__webpack_require__.d = function(exports, definition) {
   21/******/ 			for(var key in definition) {
   22/******/ 				if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
   23/******/ 					Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
   24/******/ 				}
   25/******/ 			}
   26/******/ 		};
   27/******/ 	}();
   28/******/ 	
   29/******/ 	/* webpack/runtime/hasOwnProperty shorthand */
   30/******/ 	!function() {
   31/******/ 		__webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }
   32/******/ 	}();
   33/******/ 	
   34/************************************************************************/
   35var __webpack_exports__ = {};
   36
   37// EXPORTS
   38__webpack_require__.d(__webpack_exports__, {
   39  "default": function() { return /* binding */ katex_webpack; }
   40});
   41
   42;// CONCATENATED MODULE: ./src/ParseError.js
   43
   44
   45/**
   46 * This is the ParseError class, which is the main error thrown by KaTeX
   47 * functions when something has gone wrong. This is used to distinguish internal
   48 * errors from errors in the expression that the user provided.
   49 *
   50 * If possible, a caller should provide a Token or ParseNode with information
   51 * about where in the source string the problem occurred.
   52 */
   53var ParseError = // Error position based on passed-in Token or ParseNode.
   54function ParseError(message, // The error message
   55token // An object providing position information
   56) {
   57  this.position = void 0;
   58  var error = "KaTeX parse error: " + message;
   59  var start;
   60  var loc = token && token.loc;
   61
   62  if (loc && loc.start <= loc.end) {
   63    // If we have the input and a position, make the error a bit fancier
   64    // Get the input
   65    var input = loc.lexer.input; // Prepend some information
   66
   67    start = loc.start;
   68    var end = loc.end;
   69
   70    if (start === input.length) {
   71      error += " at end of input: ";
   72    } else {
   73      error += " at position " + (start + 1) + ": ";
   74    } // Underline token in question using combining underscores
   75
   76
   77    var underlined = input.slice(start, end).replace(/[^]/g, "$&\u0332"); // Extract some context from the input and add it to the error
   78
   79    var left;
   80
   81    if (start > 15) {
   82      left = "…" + input.slice(start - 15, start);
   83    } else {
   84      left = input.slice(0, start);
   85    }
   86
   87    var right;
   88
   89    if (end + 15 < input.length) {
   90      right = input.slice(end, end + 15) + "…";
   91    } else {
   92      right = input.slice(end);
   93    }
   94
   95    error += left + underlined + right;
   96  } // Some hackery to make ParseError a prototype of Error
   97  // See http://stackoverflow.com/a/8460753
   98
   99
  100  var self = new Error(error);
  101  self.name = "ParseError"; // $FlowFixMe
  102
  103  self.__proto__ = ParseError.prototype; // $FlowFixMe
  104
  105  self.position = start;
  106  return self;
  107}; // $FlowFixMe More hackery
  108
  109
  110ParseError.prototype.__proto__ = Error.prototype;
  111/* harmony default export */ var src_ParseError = (ParseError);
  112;// CONCATENATED MODULE: ./src/utils.js
  113/**
  114 * This file contains a list of utility functions which are useful in other
  115 * files.
  116 */
  117
  118/**
  119 * Return whether an element is contained in a list
  120 */
  121var contains = function contains(list, elem) {
  122  return list.indexOf(elem) !== -1;
  123};
  124/**
  125 * Provide a default value if a setting is undefined
  126 * NOTE: Couldn't use `T` as the output type due to facebook/flow#5022.
  127 */
  128
  129
  130var deflt = function deflt(setting, defaultIfUndefined) {
  131  return setting === undefined ? defaultIfUndefined : setting;
  132}; // hyphenate and escape adapted from Facebook's React under Apache 2 license
  133
  134
  135var uppercase = /([A-Z])/g;
  136
  137var hyphenate = function hyphenate(str) {
  138  return str.replace(uppercase, "-$1").toLowerCase();
  139};
  140
  141var ESCAPE_LOOKUP = {
  142  "&": "&amp;",
  143  ">": "&gt;",
  144  "<": "&lt;",
  145  "\"": "&quot;",
  146  "'": "&#x27;"
  147};
  148var ESCAPE_REGEX = /[&><"']/g;
  149/**
  150 * Escapes text to prevent scripting attacks.
  151 */
  152
  153function utils_escape(text) {
  154  return String(text).replace(ESCAPE_REGEX, function (match) {
  155    return ESCAPE_LOOKUP[match];
  156  });
  157}
  158/**
  159 * Sometimes we want to pull out the innermost element of a group. In most
  160 * cases, this will just be the group itself, but when ordgroups and colors have
  161 * a single element, we want to pull that out.
  162 */
  163
  164
  165var getBaseElem = function getBaseElem(group) {
  166  if (group.type === "ordgroup") {
  167    if (group.body.length === 1) {
  168      return getBaseElem(group.body[0]);
  169    } else {
  170      return group;
  171    }
  172  } else if (group.type === "color") {
  173    if (group.body.length === 1) {
  174      return getBaseElem(group.body[0]);
  175    } else {
  176      return group;
  177    }
  178  } else if (group.type === "font") {
  179    return getBaseElem(group.body);
  180  } else {
  181    return group;
  182  }
  183};
  184/**
  185 * TeXbook algorithms often reference "character boxes", which are simply groups
  186 * with a single character in them. To decide if something is a character box,
  187 * we find its innermost group, and see if it is a single character.
  188 */
  189
  190
  191var isCharacterBox = function isCharacterBox(group) {
  192  var baseElem = getBaseElem(group); // These are all they types of groups which hold single characters
  193
  194  return baseElem.type === "mathord" || baseElem.type === "textord" || baseElem.type === "atom";
  195};
  196
  197var assert = function assert(value) {
  198  if (!value) {
  199    throw new Error('Expected non-null, but got ' + String(value));
  200  }
  201
  202  return value;
  203};
  204/**
  205 * Return the protocol of a URL, or "_relative" if the URL does not specify a
  206 * protocol (and thus is relative).
  207 */
  208
  209var protocolFromUrl = function protocolFromUrl(url) {
  210  var protocol = /^\s*([^\\/#]*?)(?::|&#0*58|&#x0*3a)/i.exec(url);
  211  return protocol != null ? protocol[1] : "_relative";
  212};
  213/* harmony default export */ var utils = ({
  214  contains: contains,
  215  deflt: deflt,
  216  escape: utils_escape,
  217  hyphenate: hyphenate,
  218  getBaseElem: getBaseElem,
  219  isCharacterBox: isCharacterBox,
  220  protocolFromUrl: protocolFromUrl
  221});
  222;// CONCATENATED MODULE: ./src/Settings.js
  223/* eslint no-console:0 */
  224
  225/**
  226 * This is a module for storing settings passed into KaTeX. It correctly handles
  227 * default settings.
  228 */
  229
  230
  231
  232// TODO: automatically generate documentation
  233// TODO: check all properties on Settings exist
  234// TODO: check the type of a property on Settings matches
  235var SETTINGS_SCHEMA = {
  236  displayMode: {
  237    type: "boolean",
  238    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.",
  239    cli: "-d, --display-mode"
  240  },
  241  output: {
  242    type: {
  243      enum: ["htmlAndMathml", "html", "mathml"]
  244    },
  245    description: "Determines the markup language of the output.",
  246    cli: "-F, --format <type>"
  247  },
  248  leqno: {
  249    type: "boolean",
  250    description: "Render display math in leqno style (left-justified tags)."
  251  },
  252  fleqn: {
  253    type: "boolean",
  254    description: "Render display math flush left."
  255  },
  256  throwOnError: {
  257    type: "boolean",
  258    default: true,
  259    cli: "-t, --no-throw-on-error",
  260    cliDescription: "Render errors (in the color given by --error-color) ins" + "tead of throwing a ParseError exception when encountering an error."
  261  },
  262  errorColor: {
  263    type: "string",
  264    default: "#cc0000",
  265    cli: "-c, --error-color <color>",
  266    cliDescription: "A color string given in the format 'rgb' or 'rrggbb' " + "(no #). This option determines the color of errors rendered by the " + "-t option.",
  267    cliProcessor: function cliProcessor(color) {
  268      return "#" + color;
  269    }
  270  },
  271  macros: {
  272    type: "object",
  273    cli: "-m, --macro <def>",
  274    cliDescription: "Define custom macro of the form '\\foo:expansion' (use " + "multiple -m arguments for multiple macros).",
  275    cliDefault: [],
  276    cliProcessor: function cliProcessor(def, defs) {
  277      defs.push(def);
  278      return defs;
  279    }
  280  },
  281  minRuleThickness: {
  282    type: "number",
  283    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`.",
  284    processor: function processor(t) {
  285      return Math.max(0, t);
  286    },
  287    cli: "--min-rule-thickness <size>",
  288    cliProcessor: parseFloat
  289  },
  290  colorIsTextColor: {
  291    type: "boolean",
  292    description: "Makes \\color behave like LaTeX's 2-argument \\textcolor, " + "instead of LaTeX's one-argument \\color mode change.",
  293    cli: "-b, --color-is-text-color"
  294  },
  295  strict: {
  296    type: [{
  297      enum: ["warn", "ignore", "error"]
  298    }, "boolean", "function"],
  299    description: "Turn on strict / LaTeX faithfulness mode, which throws an " + "error if the input uses features that are not supported by LaTeX.",
  300    cli: "-S, --strict",
  301    cliDefault: false
  302  },
  303  trust: {
  304    type: ["boolean", "function"],
  305    description: "Trust the input, enabling all HTML features such as \\url.",
  306    cli: "-T, --trust"
  307  },
  308  maxSize: {
  309    type: "number",
  310    default: Infinity,
  311    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",
  312    processor: function processor(s) {
  313      return Math.max(0, s);
  314    },
  315    cli: "-s, --max-size <n>",
  316    cliProcessor: parseInt
  317  },
  318  maxExpand: {
  319    type: "number",
  320    default: 1000,
  321    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.",
  322    processor: function processor(n) {
  323      return Math.max(0, n);
  324    },
  325    cli: "-e, --max-expand <n>",
  326    cliProcessor: function cliProcessor(n) {
  327      return n === "Infinity" ? Infinity : parseInt(n);
  328    }
  329  },
  330  globalGroup: {
  331    type: "boolean",
  332    cli: false
  333  }
  334};
  335
  336function getDefaultValue(schema) {
  337  if (schema.default) {
  338    return schema.default;
  339  }
  340
  341  var type = schema.type;
  342  var defaultType = Array.isArray(type) ? type[0] : type;
  343
  344  if (typeof defaultType !== 'string') {
  345    return defaultType.enum[0];
  346  }
  347
  348  switch (defaultType) {
  349    case 'boolean':
  350      return false;
  351
  352    case 'string':
  353      return '';
  354
  355    case 'number':
  356      return 0;
  357
  358    case 'object':
  359      return {};
  360  }
  361}
  362/**
  363 * The main Settings object
  364 *
  365 * The current options stored are:
  366 *  - displayMode: Whether the expression should be typeset as inline math
  367 *                 (false, the default), meaning that the math starts in
  368 *                 \textstyle and is placed in an inline-block); or as display
  369 *                 math (true), meaning that the math starts in \displaystyle
  370 *                 and is placed in a block with vertical margin.
  371 */
  372
  373
  374var Settings = /*#__PURE__*/function () {
  375  function Settings(options) {
  376    this.displayMode = void 0;
  377    this.output = void 0;
  378    this.leqno = void 0;
  379    this.fleqn = void 0;
  380    this.throwOnError = void 0;
  381    this.errorColor = void 0;
  382    this.macros = void 0;
  383    this.minRuleThickness = void 0;
  384    this.colorIsTextColor = void 0;
  385    this.strict = void 0;
  386    this.trust = void 0;
  387    this.maxSize = void 0;
  388    this.maxExpand = void 0;
  389    this.globalGroup = void 0;
  390    // allow null options
  391    options = options || {};
  392
  393    for (var prop in SETTINGS_SCHEMA) {
  394      if (SETTINGS_SCHEMA.hasOwnProperty(prop)) {
  395        // $FlowFixMe
  396        var schema = SETTINGS_SCHEMA[prop]; // TODO: validate options
  397        // $FlowFixMe
  398
  399        this[prop] = options[prop] !== undefined ? schema.processor ? schema.processor(options[prop]) : options[prop] : getDefaultValue(schema);
  400      }
  401    }
  402  }
  403  /**
  404   * Report nonstrict (non-LaTeX-compatible) input.
  405   * Can safely not be called if `this.strict` is false in JavaScript.
  406   */
  407
  408
  409  var _proto = Settings.prototype;
  410
  411  _proto.reportNonstrict = function reportNonstrict(errorCode, errorMsg, token) {
  412    var strict = this.strict;
  413
  414    if (typeof strict === "function") {
  415      // Allow return value of strict function to be boolean or string
  416      // (or null/undefined, meaning no further processing).
  417      strict = strict(errorCode, errorMsg, token);
  418    }
  419
  420    if (!strict || strict === "ignore") {
  421      return;
  422    } else if (strict === true || strict === "error") {
  423      throw new src_ParseError("LaTeX-incompatible input and strict mode is set to 'error': " + (errorMsg + " [" + errorCode + "]"), token);
  424    } else if (strict === "warn") {
  425      typeof console !== "undefined" && console.warn("LaTeX-incompatible input and strict mode is set to 'warn': " + (errorMsg + " [" + errorCode + "]"));
  426    } else {
  427      // won't happen in type-safe code
  428      typeof console !== "undefined" && console.warn("LaTeX-incompatible input and strict mode is set to " + ("unrecognized '" + strict + "': " + errorMsg + " [" + errorCode + "]"));
  429    }
  430  }
  431  /**
  432   * Check whether to apply strict (LaTeX-adhering) behavior for unusual
  433   * input (like `\\`).  Unlike `nonstrict`, will not throw an error;
  434   * instead, "error" translates to a return value of `true`, while "ignore"
  435   * translates to a return value of `false`.  May still print a warning:
  436   * "warn" prints a warning and returns `false`.
  437   * This is for the second category of `errorCode`s listed in the README.
  438   */
  439  ;
  440
  441  _proto.useStrictBehavior = function useStrictBehavior(errorCode, errorMsg, token) {
  442    var strict = this.strict;
  443
  444    if (typeof strict === "function") {
  445      // Allow return value of strict function to be boolean or string
  446      // (or null/undefined, meaning no further processing).
  447      // But catch any exceptions thrown by function, treating them
  448      // like "error".
  449      try {
  450        strict = strict(errorCode, errorMsg, token);
  451      } catch (error) {
  452        strict = "error";
  453      }
  454    }
  455
  456    if (!strict || strict === "ignore") {
  457      return false;
  458    } else if (strict === true || strict === "error") {
  459      return true;
  460    } else if (strict === "warn") {
  461      typeof console !== "undefined" && console.warn("LaTeX-incompatible input and strict mode is set to 'warn': " + (errorMsg + " [" + errorCode + "]"));
  462      return false;
  463    } else {
  464      // won't happen in type-safe code
  465      typeof console !== "undefined" && console.warn("LaTeX-incompatible input and strict mode is set to " + ("unrecognized '" + strict + "': " + errorMsg + " [" + errorCode + "]"));
  466      return false;
  467    }
  468  }
  469  /**
  470   * Check whether to test potentially dangerous input, and return
  471   * `true` (trusted) or `false` (untrusted).  The sole argument `context`
  472   * should be an object with `command` field specifying the relevant LaTeX
  473   * command (as a string starting with `\`), and any other arguments, etc.
  474   * If `context` has a `url` field, a `protocol` field will automatically
  475   * get added by this function (changing the specified object).
  476   */
  477  ;
  478
  479  _proto.isTrusted = function isTrusted(context) {
  480    if (context.url && !context.protocol) {
  481      context.protocol = utils.protocolFromUrl(context.url);
  482    }
  483
  484    var trust = typeof this.trust === "function" ? this.trust(context) : this.trust;
  485    return Boolean(trust);
  486  };
  487
  488  return Settings;
  489}();
  490
  491
  492;// CONCATENATED MODULE: ./src/Style.js
  493/**
  494 * This file contains information and classes for the various kinds of styles
  495 * used in TeX. It provides a generic `Style` class, which holds information
  496 * about a specific style. It then provides instances of all the different kinds
  497 * of styles possible, and provides functions to move between them and get
  498 * information about them.
  499 */
  500
  501/**
  502 * The main style class. Contains a unique id for the style, a size (which is
  503 * the same for cramped and uncramped version of a style), and a cramped flag.
  504 */
  505var Style = /*#__PURE__*/function () {
  506  function Style(id, size, cramped) {
  507    this.id = void 0;
  508    this.size = void 0;
  509    this.cramped = void 0;
  510    this.id = id;
  511    this.size = size;
  512    this.cramped = cramped;
  513  }
  514  /**
  515   * Get the style of a superscript given a base in the current style.
  516   */
  517
  518
  519  var _proto = Style.prototype;
  520
  521  _proto.sup = function sup() {
  522    return styles[_sup[this.id]];
  523  }
  524  /**
  525   * Get the style of a subscript given a base in the current style.
  526   */
  527  ;
  528
  529  _proto.sub = function sub() {
  530    return styles[_sub[this.id]];
  531  }
  532  /**
  533   * Get the style of a fraction numerator given the fraction in the current
  534   * style.
  535   */
  536  ;
  537
  538  _proto.fracNum = function fracNum() {
  539    return styles[_fracNum[this.id]];
  540  }
  541  /**
  542   * Get the style of a fraction denominator given the fraction in the current
  543   * style.
  544   */
  545  ;
  546
  547  _proto.fracDen = function fracDen() {
  548    return styles[_fracDen[this.id]];
  549  }
  550  /**
  551   * Get the cramped version of a style (in particular, cramping a cramped style
  552   * doesn't change the style).
  553   */
  554  ;
  555
  556  _proto.cramp = function cramp() {
  557    return styles[_cramp[this.id]];
  558  }
  559  /**
  560   * Get a text or display version of this style.
  561   */
  562  ;
  563
  564  _proto.text = function text() {
  565    return styles[_text[this.id]];
  566  }
  567  /**
  568   * Return true if this style is tightly spaced (scriptstyle/scriptscriptstyle)
  569   */
  570  ;
  571
  572  _proto.isTight = function isTight() {
  573    return this.size >= 2;
  574  };
  575
  576  return Style;
  577}(); // Export an interface for type checking, but don't expose the implementation.
  578// This way, no more styles can be generated.
  579
  580
  581// IDs of the different styles
  582var D = 0;
  583var Dc = 1;
  584var T = 2;
  585var Tc = 3;
  586var S = 4;
  587var Sc = 5;
  588var SS = 6;
  589var SSc = 7; // Instances of the different styles
  590
  591var 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)]; // Lookup tables for switching from one style to another
  592
  593var _sup = [S, Sc, S, Sc, SS, SSc, SS, SSc];
  594var _sub = [Sc, Sc, Sc, Sc, SSc, SSc, SSc, SSc];
  595var _fracNum = [T, Tc, S, Sc, SS, SSc, SS, SSc];
  596var _fracDen = [Tc, Tc, Sc, Sc, SSc, SSc, SSc, SSc];
  597var _cramp = [Dc, Dc, Tc, Tc, Sc, Sc, SSc, SSc];
  598var _text = [D, Dc, T, Tc, T, Tc, T, Tc]; // We only export some of the styles.
  599
  600/* harmony default export */ var src_Style = ({
  601  DISPLAY: styles[D],
  602  TEXT: styles[T],
  603  SCRIPT: styles[S],
  604  SCRIPTSCRIPT: styles[SS]
  605});
  606;// CONCATENATED MODULE: ./src/unicodeScripts.js
  607/*
  608 * This file defines the Unicode scripts and script families that we
  609 * support. To add new scripts or families, just add a new entry to the
  610 * scriptData array below. Adding scripts to the scriptData array allows
  611 * characters from that script to appear in \text{} environments.
  612 */
  613
  614/**
  615 * Each script or script family has a name and an array of blocks.
  616 * Each block is an array of two numbers which specify the start and
  617 * end points (inclusive) of a block of Unicode codepoints.
  618 */
  619
  620/**
  621 * Unicode block data for the families of scripts we support in \text{}.
  622 * Scripts only need to appear here if they do not have font metrics.
  623 */
  624var scriptData = [{
  625  // Latin characters beyond the Latin-1 characters we have metrics for.
  626  // Needed for Czech, Hungarian and Turkish text, for example.
  627  name: 'latin',
  628  blocks: [[0x0100, 0x024f], // Latin Extended-A and Latin Extended-B
  629  [0x0300, 0x036f] // Combining Diacritical marks
  630  ]
  631}, {
  632  // The Cyrillic script used by Russian and related languages.
  633  // A Cyrillic subset used to be supported as explicitly defined
  634  // symbols in symbols.js
  635  name: 'cyrillic',
  636  blocks: [[0x0400, 0x04ff]]
  637}, {
  638  // Armenian
  639  name: 'armenian',
  640  blocks: [[0x0530, 0x058F]]
  641}, {
  642  // The Brahmic scripts of South and Southeast Asia
  643  // Devanagari (0900–097F)
  644  // Bengali (0980–09FF)
  645  // Gurmukhi (0A00–0A7F)
  646  // Gujarati (0A80–0AFF)
  647  // Oriya (0B00–0B7F)
  648  // Tamil (0B80–0BFF)
  649  // Telugu (0C00–0C7F)
  650  // Kannada (0C80–0CFF)
  651  // Malayalam (0D00–0D7F)
  652  // Sinhala (0D80–0DFF)
  653  // Thai (0E00–0E7F)
  654  // Lao (0E80–0EFF)
  655  // Tibetan (0F00–0FFF)
  656  // Myanmar (1000–109F)
  657  name: 'brahmic',
  658  blocks: [[0x0900, 0x109F]]
  659}, {
  660  name: 'georgian',
  661  blocks: [[0x10A0, 0x10ff]]
  662}, {
  663  // Chinese and Japanese.
  664  // The "k" in cjk is for Korean, but we've separated Korean out
  665  name: "cjk",
  666  blocks: [[0x3000, 0x30FF], // CJK symbols and punctuation, Hiragana, Katakana
  667  [0x4E00, 0x9FAF], // CJK ideograms
  668  [0xFF00, 0xFF60] // Fullwidth punctuation
  669  // TODO: add halfwidth Katakana and Romanji glyphs
  670  ]
  671}, {
  672  // Korean
  673  name: 'hangul',
  674  blocks: [[0xAC00, 0xD7AF]]
  675}];
  676/**
  677 * Given a codepoint, return the name of the script or script family
  678 * it is from, or null if it is not part of a known block
  679 */
  680
  681function scriptFromCodepoint(codepoint) {
  682  for (var i = 0; i < scriptData.length; i++) {
  683    var script = scriptData[i];
  684
  685    for (var _i = 0; _i < script.blocks.length; _i++) {
  686      var block = script.blocks[_i];
  687
  688      if (codepoint >= block[0] && codepoint <= block[1]) {
  689        return script.name;
  690      }
  691    }
  692  }
  693
  694  return null;
  695}
  696/**
  697 * A flattened version of all the supported blocks in a single array.
  698 * This is an optimization to make supportedCodepoint() fast.
  699 */
  700
  701var allBlocks = [];
  702scriptData.forEach(function (s) {
  703  return s.blocks.forEach(function (b) {
  704    return allBlocks.push.apply(allBlocks, b);
  705  });
  706});
  707/**
  708 * Given a codepoint, return true if it falls within one of the
  709 * scripts or script families defined above and false otherwise.
  710 *
  711 * Micro benchmarks shows that this is faster than
  712 * /[\u3000-\u30FF\u4E00-\u9FAF\uFF00-\uFF60\uAC00-\uD7AF\u0900-\u109F]/.test()
  713 * in Firefox, Chrome and Node.
  714 */
  715
  716function supportedCodepoint(codepoint) {
  717  for (var i = 0; i < allBlocks.length; i += 2) {
  718    if (codepoint >= allBlocks[i] && codepoint <= allBlocks[i + 1]) {
  719      return true;
  720    }
  721  }
  722
  723  return false;
  724}
  725;// CONCATENATED MODULE: ./src/svgGeometry.js
  726/**
  727 * This file provides support to domTree.js and delimiter.js.
  728 * It's a storehouse of path geometry for SVG images.
  729 */
  730// In all paths below, the viewBox-to-em scale is 1000:1.
  731var hLinePad = 80; // padding above a sqrt viniculum. Prevents image cropping.
  732// The viniculum of a \sqrt can be made thicker by a KaTeX rendering option.
  733// Think of variable extraViniculum as two detours in the SVG path.
  734// The detour begins at the lower left of the area labeled extraViniculum below.
  735// The detour proceeds one extraViniculum distance up and slightly to the right,
  736// displacing the radiused corner between surd and viniculum. The radius is
  737// traversed as usual, then the detour resumes. It goes right, to the end of
  738// the very long viniculumn, then down one extraViniculum distance,
  739// after which it resumes regular path geometry for the radical.
  740
  741/*                                                  viniculum
  742                                                   /
  743         /▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒←extraViniculum
  744        / █████████████████████←0.04em (40 unit) std viniculum thickness
  745       / /
  746      / /
  747     / /\
  748    / / surd
  749*/
  750
  751var sqrtMain = function sqrtMain(extraViniculum, hLinePad) {
  752  // sqrtMain path geometry is from glyph U221A in the font KaTeX Main
  753  return "M95," + (622 + extraViniculum + 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" + extraViniculum / 2.075 + " -" + extraViniculum + "\nc5.3,-9.3,12,-14,20,-14\nH400000v" + (40 + extraViniculum) + "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 + extraViniculum) + " " + hLinePad + "h400000v" + (40 + extraViniculum) + "h-400000z";
  754};
  755
  756var sqrtSize1 = function sqrtSize1(extraViniculum, hLinePad) {
  757  // size1 is from glyph U221A in the font KaTeX_Size1-Regular
  758  return "M263," + (601 + extraViniculum + 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" + extraViniculum / 2.084 + " -" + extraViniculum + "\nc4.7,-7.3,11,-11,19,-11\nH40000v" + (40 + extraViniculum) + "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 + extraViniculum) + " " + hLinePad + "h400000v" + (40 + extraViniculum) + "h-400000z";
  759};
  760
  761var sqrtSize2 = function sqrtSize2(extraViniculum, hLinePad) {
  762  // size2 is from glyph U221A in the font KaTeX_Size2-Regular
  763  return "M983 " + (10 + extraViniculum + hLinePad) + "\nl" + extraViniculum / 3.13 + " -" + extraViniculum + "\nc4,-6.7,10,-10,18,-10 H400000v" + (40 + extraViniculum) + "\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 + extraViniculum) + " " + hLinePad + "h400000v" + (40 + extraViniculum) + "h-400000z";
  764};
  765
  766var sqrtSize3 = function sqrtSize3(extraViniculum, hLinePad) {
  767  // size3 is from glyph U221A in the font KaTeX_Size3-Regular
  768  return "M424," + (2398 + extraViniculum + 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" + extraViniculum / 4.223 + " -" + extraViniculum + "c4,-6.7,10,-10,18,-10 H400000\nv" + (40 + extraViniculum) + "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 + extraViniculum) + " " + hLinePad + "\nh400000v" + (40 + extraViniculum) + "h-400000z";
  769};
  770
  771var sqrtSize4 = function sqrtSize4(extraViniculum, hLinePad) {
  772  // size4 is from glyph U221A in the font KaTeX_Size4-Regular
  773  return "M473," + (2713 + extraViniculum + hLinePad) + "\nc339.3,-1799.3,509.3,-2700,510,-2702 l" + extraViniculum / 5.298 + " -" + extraViniculum + "\nc3.3,-7.3,9.3,-11,18,-11 H400000v" + (40 + extraViniculum) + "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 + extraViniculum) + " " + hLinePad + "h400000v" + (40 + extraViniculum) + "H1017.7z";
  774};
  775
  776var phasePath = function phasePath(y) {
  777  var x = y / 2; // x coordinate at top of angle
  778
  779  return "M400000 " + y + " H0 L" + x + " 0 l65 45 L145 " + (y - 80) + " H400000z";
  780};
  781
  782var sqrtTall = function sqrtTall(extraViniculum, hLinePad, viewBoxHeight) {
  783  // sqrtTall is from glyph U23B7 in the font KaTeX_Size4-Regular
  784  // One path edge has a variable length. It runs vertically from the viniculumn
  785  // to a point near (14 units) the bottom of the surd. The viniculum
  786  // is normally 40 units thick. So the length of the line in question is:
  787  var vertSegment = viewBoxHeight - 54 - hLinePad - extraViniculum;
  788  return "M702 " + (extraViniculum + hLinePad) + "H400000" + (40 + extraViniculum) + "\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 + extraViniculum) + "H742z";
  789};
  790
  791var sqrtPath = function sqrtPath(size, extraViniculum, viewBoxHeight) {
  792  extraViniculum = 1000 * extraViniculum; // Convert from document ems to viewBox.
  793
  794  var path = "";
  795
  796  switch (size) {
  797    case "sqrtMain":
  798      path = sqrtMain(extraViniculum, hLinePad);
  799      break;
  800
  801    case "sqrtSize1":
  802      path = sqrtSize1(extraViniculum, hLinePad);
  803      break;
  804
  805    case "sqrtSize2":
  806      path = sqrtSize2(extraViniculum, hLinePad);
  807      break;
  808
  809    case "sqrtSize3":
  810      path = sqrtSize3(extraViniculum, hLinePad);
  811      break;
  812
  813    case "sqrtSize4":
  814      path = sqrtSize4(extraViniculum, hLinePad);
  815      break;
  816
  817    case "sqrtTall":
  818      path = sqrtTall(extraViniculum, hLinePad, viewBoxHeight);
  819  }
  820
  821  return path;
  822};
  823var innerPath = function innerPath(name, height) {
  824  // The inner part of stretchy tall delimiters
  825  switch (name) {
  826    case "\u239C":
  827      return "M291 0 H417 V" + height + " H291z M291 0 H417 V" + height + " H291z";
  828
  829    case "\u2223":
  830      return "M145 0 H188 V" + height + " H145z M145 0 H188 V" + height + " H145z";
  831
  832    case "\u2225":
  833      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");
  834
  835    case "\u239F":
  836      return "M457 0 H583 V" + height + " H457z M457 0 H583 V" + height + " H457z";
  837
  838    case "\u23A2":
  839      return "M319 0 H403 V" + height + " H319z M319 0 H403 V" + height + " H319z";
  840
  841    case "\u23A5":
  842      return "M263 0 H347 V" + height + " H263z M263 0 H347 V" + height + " H263z";
  843
  844    case "\u23AA":
  845      return "M384 0 H504 V" + height + " H384z M384 0 H504 V" + height + " H384z";
  846
  847    case "\u23D0":
  848      return "M312 0 H355 V" + height + " H312z M312 0 H355 V" + height + " H312z";
  849
  850    case "\u2016":
  851      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");
  852
  853    default:
  854      return "";
  855  }
  856};
  857var path = {
  858  // The doubleleftarrow geometry is from glyph U+21D0 in the font KaTeX Main
  859  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",
  860  // doublerightarrow is from glyph U+21D2 in font KaTeX Main
  861  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",
  862  // leftarrow is from glyph U+2190 in font KaTeX Main
  863  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",
  864  // overbrace is from glyphs U+23A9/23A8/23A7 in font KaTeX_Size4-Regular
  865  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",
  866  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",
  867  // overgroup is from the MnSymbol package (public domain)
  868  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",
  869  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",
  870  // Harpoons are from glyph U+21BD in font KaTeX Main
  871  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",
  872  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",
  873  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",
  874  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",
  875  // hook is from glyph U+21A9 in font KaTeX Main
  876  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",
  877  leftlinesegment: "M40 281 V428 H0 V94 H40 V241 H400000 v40z\nM40 281 V428 H0 V94 H40 V241 H400000 v40z",
  878  leftmapsto: "M40 281 V448H0V74H40V241H400000v40z\nM40 281 V448H0V74H40V241H400000v40z",
  879  // tofrom is from glyph U+21C4 in font KaTeX AMS Regular
  880  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",
  881  longequal: "M0 50 h400000 v40H0z m0 194h40000v40H0z\nM0 50 h400000 v40H0z m0 194h40000v40H0z",
  882  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",
  883  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",
  884  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",
  885  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",
  886  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",
  887  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",
  888  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",
  889  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",
  890  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",
  891  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",
  892  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",
  893  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",
  894  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",
  895  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",
  896  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",
  897  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",
  898  rightlinesegment: "M399960 241 V94 h40 V428 h-40 V281 H0 v-40z\nM399960 241 V94 h40 V428 h-40 V281 H0 v-40z",
  899  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",
  900  // twoheadleftarrow is from glyph U+219E in font KaTeX AMS Regular
  901  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",
  902  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",
  903  // tilde1 is a modified version of a glyph from the MnSymbol package
  904  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",
  905  // ditto tilde2, tilde3, & tilde4
  906  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",
  907  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",
  908  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",
  909  // vec is from glyph U+20D7 in font KaTeX Main
  910  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",
  911  // widehat1 is a modified version of a glyph from the MnSymbol package
  912  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",
  913  // ditto widehat2, widehat3, & widehat4
  914  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",
  915  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",
  916  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",
  917  // widecheck paths are all inverted versions of widehat
  918  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",
  919  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",
  920  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",
  921  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",
  922  // The next ten paths support reaction arrows from the mhchem package.
  923  // Arrows for \ce{<-->} are offset from xAxis by 0.22ex, per mhchem in LaTeX
  924  // baraboveleftarrow is mostly from from glyph U+2190 in font KaTeX Main
  925  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",
  926  // rightarrowabovebar is mostly from glyph U+2192, KaTeX Main
  927  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",
  928  // The short left harpoon has 0.5em (i.e. 500 units) kern on the left end.
  929  // Ref from mhchem.sty: \rlap{\raisebox{-.22ex}{$\kern0.5em
  930  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",
  931  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",
  932  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",
  933  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"
  934};
  935;// CONCATENATED MODULE: ./src/tree.js
  936
  937
  938/**
  939 * This node represents a document fragment, which contains elements, but when
  940 * placed into the DOM doesn't have any representation itself. It only contains
  941 * children and doesn't have any DOM node properties.
  942 */
  943var DocumentFragment = /*#__PURE__*/function () {
  944  // HtmlDomNode
  945  // Never used; needed for satisfying interface.
  946  function DocumentFragment(children) {
  947    this.children = void 0;
  948    this.classes = void 0;
  949    this.height = void 0;
  950    this.depth = void 0;
  951    this.maxFontSize = void 0;
  952    this.style = void 0;
  953    this.children = children;
  954    this.classes = [];
  955    this.height = 0;
  956    this.depth = 0;
  957    this.maxFontSize = 0;
  958    this.style = {};
  959  }
  960
  961  var _proto = DocumentFragment.prototype;
  962
  963  _proto.hasClass = function hasClass(className) {
  964    return utils.contains(this.classes, className);
  965  }
  966  /** Convert the fragment into a node. */
  967  ;
  968
  969  _proto.toNode = function toNode() {
  970    var frag = document.createDocumentFragment();
  971
  972    for (var i = 0; i < this.children.length; i++) {
  973      frag.appendChild(this.children[i].toNode());
  974    }
  975
  976    return frag;
  977  }
  978  /** Convert the fragment into HTML markup. */
  979  ;
  980
  981  _proto.toMarkup = function toMarkup() {
  982    var markup = ""; // Simply concatenate the markup for the children together.
  983
  984    for (var i = 0; i < this.children.length; i++) {
  985      markup += this.children[i].toMarkup();
  986    }
  987
  988    return markup;
  989  }
  990  /**
  991   * Converts the math node into a string, similar to innerText. Applies to
  992   * MathDomNode's only.
  993   */
  994  ;
  995
  996  _proto.toText = function toText() {
  997    // To avoid this, we would subclass documentFragment separately for
  998    // MathML, but polyfills for subclassing is expensive per PR 1469.
  999    // $FlowFixMe: Only works for ChildType = MathDomNode.
 1000    var toText = function toText(child) {
 1001      return child.toText();
 1002    };
 1003
 1004    return this.children.map(toText).join("");
 1005  };
 1006
 1007  return DocumentFragment;
 1008}();
 1009;// CONCATENATED MODULE: ./src/fontMetricsData.js
 1010// This file is GENERATED by buildMetrics.sh. DO NOT MODIFY.
 1011/* harmony default export */ var fontMetricsData = ({
 1012  "AMS-Regular": {
 1013    "32": [0, 0, 0, 0, 0.25],
 1014    "65": [0, 0.68889, 0, 0, 0.72222],
 1015    "66": [0, 0.68889, 0, 0, 0.66667],
 1016    "67": [0, 0.68889, 0, 0, 0.72222],
 1017    "68": [0, 0.68889, 0, 0, 0.72222],
 1018    "69": [0, 0.68889, 0, 0, 0.66667],
 1019    "70": [0, 0.68889, 0, 0, 0.61111],
 1020    "71": [0, 0.68889, 0, 0, 0.77778],
 1021    "72": [0, 0.68889, 0, 0, 0.77778],
 1022    "73": [0, 0.68889, 0, 0, 0.38889],
 1023    "74": [0.16667, 0.68889, 0, 0, 0.5],
 1024    "75": [0, 0.68889, 0, 0, 0.77778],
 1025    "76": [0, 0.68889, 0, 0, 0.66667],
 1026    "77": [0, 0.68889, 0, 0, 0.94445],
 1027    "78": [0, 0.68889, 0, 0, 0.72222],
 1028    "79": [0.16667, 0.68889, 0, 0, 0.77778],
 1029    "80": [0, 0.68889, 0, 0, 0.61111],
 1030    "81": [0.16667, 0.68889, 0, 0, 0.77778],
 1031    "82": [0, 0.68889, 0, 0, 0.72222],
 1032    "83": [0, 0.68889, 0, 0, 0.55556],
 1033    "84": [0, 0.68889, 0, 0, 0.66667],
 1034    "85": [0, 0.68889, 0, 0, 0.72222],
 1035    "86": [0, 0.68889, 0, 0, 0.72222],
 1036    "87": [0, 0.68889, 0, 0, 1.0],
 1037    "88": [0, 0.68889, 0, 0, 0.72222],
 1038    "89": [0, 0.68889, 0, 0, 0.72222],
 1039    "90": [0, 0.68889, 0, 0, 0.66667],
 1040    "107": [0, 0.68889, 0, 0, 0.55556],
 1041    "160": [0, 0, 0, 0, 0.25],
 1042    "165": [0, 0.675, 0.025, 0, 0.75],
 1043    "174": [0.15559, 0.69224, 0, 0, 0.94666],
 1044    "240": [0, 0.68889, 0, 0, 0.55556],
 1045    "295": [0, 0.68889, 0, 0, 0.54028],
 1046    "710": [0, 0.825, 0, 0, 2.33334],
 1047    "732": [0, 0.9, 0, 0, 2.33334],
 1048    "770": [0, 0.825, 0, 0, 2.33334],
 1049    "771": [0, 0.9, 0, 0, 2.33334],
 1050    "989": [0.08167, 0.58167, 0, 0, 0.77778],
 1051    "1008": [0, 0.43056, 0.04028, 0, 0.66667],
 1052    "8245": [0, 0.54986, 0, 0, 0.275],
 1053    "8463": [0, 0.68889, 0, 0, 0.54028],
 1054    "8487": [0, 0.68889, 0, 0, 0.72222],
 1055    "8498": [0, 0.68889, 0, 0, 0.55556],
 1056    "8502": [0, 0.68889, 0, 0, 0.66667],
 1057    "8503": [0, 0.68889, 0, 0, 0.44445],
 1058    "8504": [0, 0.68889, 0, 0, 0.66667],
 1059    "8513": [0, 0.68889, 0, 0, 0.63889],
 1060    "8592": [-0.03598, 0.46402, 0, 0, 0.5],
 1061    "8594": [-0.03598, 0.46402, 0, 0, 0.5],
 1062    "8602": [-0.13313, 0.36687, 0, 0, 1.0],
 1063    "8603": [-0.13313, 0.36687, 0, 0, 1.0],
 1064    "8606": [0.01354, 0.52239, 0, 0, 1.0],
 1065    "8608": [0.01354, 0.52239, 0, 0, 1.0],
 1066    "8610": [0.01354, 0.52239, 0, 0, 1.11111],
 1067    "8611": [0.01354, 0.52239, 0, 0, 1.11111],
 1068    "8619": [0, 0.54986, 0, 0, 1.0],
 1069    "8620": [0, 0.54986, 0, 0, 1.0],
 1070    "8621": [-0.13313, 0.37788, 0, 0, 1.38889],
 1071    "8622": [-0.13313, 0.36687, 0, 0, 1.0],
 1072    "8624": [0, 0.69224, 0, 0, 0.5],
 1073    "8625": [0, 0.69224, 0, 0, 0.5],
 1074    "8630": [0, 0.43056, 0, 0, 1.0],
 1075    "8631": [0, 0.43056, 0, 0, 1.0],
 1076    "8634": [0.08198, 0.58198, 0, 0, 0.77778],
 1077    "8635": [0.08198, 0.58198, 0, 0, 0.77778],
 1078    "8638": [0.19444, 0.69224, 0, 0, 0.41667],
 1079    "8639": [0.19444, 0.69224, 0, 0, 0.41667],
 1080    "8642": [0.19444, 0.69224, 0, 0, 0.41667],
 1081    "8643": [0.19444, 0.69224, 0, 0, 0.41667],
 1082    "8644": [0.1808, 0.675, 0, 0, 1.0],
 1083    "8646": [0.1808, 0.675, 0, 0, 1.0],
 1084    "8647": [0.1808, 0.675, 0, 0, 1.0],
 1085    "8648": [0.19444, 0.69224, 0, 0, 0.83334],
 1086    "8649": [0.1808, 0.675, 0, 0, 1.0],
 1087    "8650": [0.19444, 0.69224, 0, 0, 0.83334],
 1088    "8651": [0.01354, 0.52239, 0, 0, 1.0],
 1089    "8652": [0.01354, 0.52239, 0, 0, 1.0],
 1090    "8653": [-0.13313, 0.36687, 0, 0, 1.0],
 1091    "8654": [-0.13313, 0.36687, 0, 0, 1.0],
 1092    "8655": [-0.13313, 0.36687, 0, 0, 1.0],
 1093    "8666": [0.13667, 0.63667, 0, 0, 1.0],
 1094    "8667": [0.13667, 0.63667, 0, 0, 1.0],
 1095    "8669": [-0.13313, 0.37788, 0, 0, 1.0],
 1096    "8672": [-0.064, 0.437, 0, 0, 1.334],
 1097    "8674": [-0.064, 0.437, 0, 0, 1.334],
 1098    "8705": [0, 0.825, 0, 0, 0.5],
 1099    "8708": [0, 0.68889, 0, 0, 0.55556],
 1100    "8709": [0.08167, 0.58167, 0, 0, 0.77778],
 1101    "8717": [0, 0.43056, 0, 0, 0.42917],
 1102    "8722": [-0.03598, 0.46402, 0, 0, 0.5],
 1103    "8724": [0.08198, 0.69224, 0, 0, 0.77778],
 1104    "8726": [0.08167, 0.58167, 0, 0, 0.77778],
 1105    "8733": [0, 0.69224, 0, 0, 0.77778],
 1106    "8736": [0, 0.69224, 0, 0, 0.72222],
 1107    "8737": [0, 0.69224, 0, 0, 0.72222],
 1108    "8738": [0.03517, 0.52239, 0, 0, 0.72222],
 1109    "8739": [0.08167, 0.58167, 0, 0, 0.22222],
 1110    "8740": [0.25142, 0.74111, 0, 0, 0.27778],
 1111    "8741": [0.08167, 0.58167, 0, 0, 0.38889],
 1112    "8742": [0.25142, 0.74111, 0, 0, 0.5],
 1113    "8756": [0, 0.69224, 0, 0, 0.66667],
 1114    "8757": [0, 0.69224, 0, 0, 0.66667],
 1115    "8764": [-0.13313, 0.36687, 0, 0, 0.77778],
 1116    "8765": [-0.13313, 0.37788, 0, 0, 0.77778],
 1117    "8769": [-0.13313, 0.36687, 0, 0, 0.77778],
 1118    "8770": [-0.03625, 0.46375, 0, 0, 0.77778],
 1119    "8774": [0.30274, 0.79383, 0, 0, 0.77778],
 1120    "8776": [-0.01688, 0.48312, 0, 0, 0.77778],
 1121    "8778": [0.08167, 0.58167, 0, 0, 0.77778],
 1122    "8782": [0.06062, 0.54986, 0, 0, 0.77778],
 1123    "8783": [0.06062, 0.54986, 0, 0, 0.77778],
 1124    "8785": [0.08198, 0.58198, 0, 0, 0.77778],
 1125    "8786": [0.08198, 0.58198, 0, 0, 0.77778],
 1126    "8787": [0.08198, 0.58198, 0, 0, 0.77778],
 1127    "8790": [0, 0.69224, 0, 0, 0.77778],
 1128    "8791": [0.22958, 0.72958, 0, 0, 0.77778],
 1129    "8796": [0.08198, 0.91667, 0, 0, 0.77778],
 1130    "8806": [0.25583, 0.75583, 0, 0, 0.77778],
 1131    "8807": [0.25583, 0.75583, 0, 0, 0.77778],
 1132    "8808": [0.25142, 0.75726, 0, 0, 0.77778],
 1133    "8809": [0.25142, 0.75726, 0, 0, 0.77778],
 1134    "8812": [0.25583, 0.75583, 0, 0, 0.5],
 1135    "8814": [0.20576, 0.70576, 0, 0, 0.77778],
 1136    "8815": [0.20576, 0.70576, 0, 0, 0.77778],
 1137    "8816": [0.30274, 0.79383, 0, 0, 0.77778],
 1138    "8817": [0.30274, 0.79383, 0, 0, 0.77778],
 1139    "8818": [0.22958, 0.72958, 0, 0, 0.77778],
 1140    "8819": [0.22958, 0.72958, 0, 0, 0.77778],
 1141    "8822": [0.1808, 0.675, 0, 0, 0.77778],
 1142    "8823": [0.1808, 0.675, 0, 0, 0.77778],
 1143    "8828": [0.13667, 0.63667, 0, 0, 0.77778],
 1144    "8829": [0.13667, 0.63667, 0, 0, 0.77778],
 1145    "8830": [0.22958, 0.72958, 0, 0, 0.77778],
 1146    "8831": [0.22958, 0.72958, 0, 0, 0.77778],
 1147    "8832": [0.20576, 0.70576, 0, 0, 0.77778],
 1148    "8833": [0.20576, 0.70576, 0, 0, 0.77778],
 1149    "8840": [0.30274, 0.79383, 0, 0, 0.77778],
 1150    "8841": [0.30274, 0.79383, 0, 0, 0.77778],
 1151    "8842": [0.13597, 0.63597, 0, 0, 0.77778],
 1152    "8843": [0.13597, 0.63597, 0, 0, 0.77778],
 1153    "8847": [0.03517, 0.54986, 0, 0, 0.77778],
 1154    "8848": [0.03517, 0.54986, 0, 0, 0.77778],
 1155    "8858": [0.08198, 0.58198, 0, 0, 0.77778],
 1156    "8859": [0.08198, 0.58198, 0, 0, 0.77778],
 1157    "8861": [0.08198, 0.58198, 0, 0, 0.77778],
 1158    "8862": [0, 0.675, 0, 0, 0.77778],
 1159    "8863": [0, 0.675, 0, 0, 0.77778],
 1160    "8864": [0, 0.675, 0, 0, 0.77778],
 1161    "8865": [0, 0.675, 0, 0, 0.77778],
 1162    "8872": [0, 0.69224, 0, 0, 0.61111],
 1163    "8873": [0, 0.69224, 0, 0, 0.72222],
 1164    "8874": [0, 0.69224, 0, 0, 0.88889],
 1165    "8876": [0, 0.68889, 0, 0, 0.61111],
 1166    "8877": [0, 0.68889, 0, 0, 0.61111],
 1167    "8878": [0, 0.68889, 0, 0, 0.72222],
 1168    "8879": [0, 0.68889, 0, 0, 0.72222],
 1169    "8882": [0.03517, 0.54986, 0, 0, 0.77778],
 1170    "8883": [0.03517, 0.54986, 0, 0, 0.77778],
 1171    "8884": [0.13667, 0.63667, 0, 0, 0.77778],
 1172    "8885": [0.13667, 0.63667, 0, 0, 0.77778],
 1173    "8888": [0, 0.54986, 0, 0, 1.11111],
 1174    "8890": [0.19444, 0.43056, 0, 0, 0.55556],
 1175    "8891": [0.19444, 0.69224, 0, 0, 0.61111],
 1176    "8892": [0.19444, 0.69224, 0, 0, 0.61111],
 1177    "8901": [0, 0.54986, 0, 0, 0.27778],
 1178    "8903": [0.08167, 0.58167, 0, 0, 0.77778],
 1179    "8905": [0.08167, 0.58167, 0, 0, 0.77778],
 1180    "8906": [0.08167, 0.58167, 0, 0, 0.77778],
 1181    "8907": [0, 0.69224, 0, 0, 0.77778],
 1182    "8908": [0, 0.69224, 0, 0, 0.77778],
 1183    "8909": [-0.03598, 0.46402, 0, 0, 0.77778],
 1184    "8910": [0, 0.54986, 0, 0, 0.76042],
 1185    "8911": [0, 0.54986, 0, 0, 0.76042],
 1186    "8912": [0.03517, 0.54986, 0, 0, 0.77778],
 1187    "8913": [0.03517, 0.54986, 0, 0, 0.77778],
 1188    "8914": [0, 0.54986, 0, 0, 0.66667],
 1189    "8915": [0, 0.54986, 0, 0, 0.66667],
 1190    "8916": [0, 0.69224, 0, 0, 0.66667],
 1191    "8918": [0.0391, 0.5391, 0, 0, 0.77778],
 1192    "8919": [0.0391, 0.5391, 0, 0, 0.77778],
 1193    "8920": [0.03517, 0.54986, 0, 0, 1.33334],
 1194    "8921": [0.03517, 0.54986, 0, 0, 1.33334],
 1195    "8922": [0.38569, 0.88569, 0, 0, 0.77778],
 1196    "8923": [0.38569, 0.88569, 0, 0, 0.77778],
 1197    "8926": [0.13667, 0.63667, 0, 0, 0.77778],
 1198    "8927": [0.13667, 0.63667, 0, 0, 0.77778],
 1199    "8928": [0.30274, 0.79383, 0, 0, 0.77778],
 1200    "8929": [0.30274, 0.79383, 0, 0, 0.77778],
 1201    "8934": [0.23222, 0.74111, 0, 0, 0.77778],
 1202    "8935": [0.23222, 0.74111, 0, 0, 0.77778],
 1203    "8936": [0.23222, 0.74111, 0, 0, 0.77778],
 1204    "8937": [0.23222, 0.74111, 0, 0, 0.77778],
 1205    "8938": [0.20576, 0.70576, 0, 0, 0.77778],
 1206    "8939": [0.20576, 0.70576, 0, 0, 0.77778],
 1207    "8940": [0.30274, 0.79383, 0, 0, 0.77778],
 1208    "8941": [0.30274, 0.79383, 0, 0, 0.77778],
 1209    "8994": [0.19444, 0.69224, 0, 0, 0.77778],
 1210    "8995": [0.19444, 0.69224, 0, 0, 0.77778],
 1211    "9416": [0.15559, 0.69224, 0, 0, 0.90222],
 1212    "9484": [0, 0.69224, 0, 0, 0.5],
 1213    "9488": [0, 0.69224, 0, 0, 0.5],
 1214    "9492": [0, 0.37788, 0, 0, 0.5],
 1215    "9496": [0, 0.37788, 0, 0, 0.5],
 1216    "9585": [0.19444, 0.68889, 0, 0, 0.88889],
 1217    "9586": [0.19444, 0.74111, 0, 0, 0.88889],
 1218    "9632": [0, 0.675, 0, 0, 0.77778],
 1219    "9633": [0, 0.675, 0, 0, 0.77778],
 1220    "9650": [0, 0.54986, 0, 0, 0.72222],
 1221    "9651": [0, 0.54986, 0, 0, 0.72222],
 1222    "9654": [0.03517, 0.54986, 0, 0, 0.77778],
 1223    "9660": [0, 0.54986, 0, 0, 0.72222],
 1224    "9661": [0, 0.54986, 0, 0, 0.72222],
 1225    "9664": [0.03517, 0.54986, 0, 0, 0.77778],
 1226    "9674": [0.11111, 0.69224, 0, 0, 0.66667],
 1227    "9733": [0.19444, 0.69224, 0, 0, 0.94445],
 1228    "10003": [0, 0.69224, 0, 0, 0.83334],
 1229    "10016": [0, 0.69224, 0, 0, 0.83334],
 1230    "10731": [0.11111, 0.69224, 0, 0, 0.66667],
 1231    "10846": [0.19444, 0.75583, 0, 0, 0.61111],
 1232    "10877": [0.13667, 0.63667, 0, 0, 0.77778],
 1233    "10878": [0.13667, 0.63667, 0, 0, 0.77778],
 1234    "10885": [0.25583, 0.75583, 0, 0, 0.77778],
 1235    "10886": [0.25583, 0.75583, 0, 0, 0.77778],
 1236    "10887": [0.13597, 0.63597, 0, 0, 0.77778],
 1237    "10888": [0.13597, 0.63597, 0, 0, 0.77778],
 1238    "10889": [0.26167, 0.75726, 0, 0, 0.77778],
 1239    "10890": [0.26167, 0.75726, 0, 0, 0.77778],
 1240    "10891": [0.48256, 0.98256, 0, 0, 0.77778],
 1241    "10892": [0.48256, 0.98256, 0, 0, 0.77778],
 1242    "10901": [0.13667, 0.63667, 0, 0, 0.77778],
 1243    "10902": [0.13667, 0.63667, 0, 0, 0.77778],
 1244    "10933": [0.25142, 0.75726, 0, 0, 0.77778],
 1245    "10934": [0.25142, 0.75726, 0, 0, 0.77778],
 1246    "10935": [0.26167, 0.75726, 0, 0, 0.77778],
 1247    "10936": [0.26167, 0.75726, 0, 0, 0.77778],
 1248    "10937": [0.26167, 0.75726, 0, 0, 0.77778],
 1249    "10938": [0.26167, 0.75726, 0, 0, 0.77778],
 1250    "10949": [0.25583, 0.75583, 0, 0, 0.77778],
 1251    "10950": [0.25583, 0.75583, 0, 0, 0.77778],
 1252    "10955": [0.28481, 0.79383, 0, 0, 0.77778],
 1253    "10956": [0.28481, 0.79383, 0, 0, 0.77778],
 1254    "57350": [0.08167, 0.58167, 0, 0, 0.22222],
 1255    "57351": [0.08167, 0.58167, 0, 0, 0.38889],
 1256    "57352": [0.08167, 0.58167, 0, 0, 0.77778],
 1257    "57353": [0, 0.43056, 0.04028, 0, 0.66667],
 1258    "57356": [0.25142, 0.75726, 0, 0, 0.77778],
 1259    "57357": [0.25142, 0.75726, 0, 0, 0.77778],
 1260    "57358": [0.41951, 0.91951, 0, 0, 0.77778],
 1261    "57359": [0.30274, 0.79383, 0, 0, 0.77778],
 1262    "57360": [0.30274, 0.79383, 0, 0, 0.77778],
 1263    "57361": [0.41951, 0.91951, 0, 0, 0.77778],
 1264    "57366": [0.25142, 0.75726, 0, 0, 0.77778],
 1265    "57367": [0.25142, 0.75726, 0, 0, 0.77778],
 1266    "57368": [0.25142, 0.75726, 0, 0, 0.77778],
 1267    "57369": [0.25142, 0.75726, 0, 0, 0.77778],
 1268    "57370": [0.13597, 0.63597, 0, 0, 0.77778],
 1269    "57371": [0.13597, 0.63597, 0, 0, 0.77778]
 1270  },
 1271  "Caligraphic-Regular": {
 1272    "32": [0, 0, 0, 0, 0.25],
 1273    "65": [0, 0.68333, 0, 0.19445, 0.79847],
 1274    "66": [0, 0.68333, 0.03041, 0.13889, 0.65681],
 1275    "67": [0, 0.68333, 0.05834, 0.13889, 0.52653],
 1276    "68": [0, 0.68333, 0.02778, 0.08334, 0.77139],
 1277    "69": [0, 0.68333, 0.08944, 0.11111, 0.52778],
 1278    "70": [0, 0.68333, 0.09931, 0.11111, 0.71875],
 1279    "71": [0.09722, 0.68333, 0.0593, 0.11111, 0.59487],
 1280    "72": [0, 0.68333, 0.00965, 0.11111, 0.84452],
 1281    "73": [0, 0.68333, 0.07382, 0, 0.54452],
 1282    "74": [0.09722, 0.68333, 0.18472, 0.16667, 0.67778],
 1283    "75": [0, 0.68333, 0.01445, 0.05556, 0.76195],
 1284    "76": [0, 0.68333, 0, 0.13889, 0.68972],
 1285    "77": [0, 0.68333, 0, 0.13889, 1.2009],
 1286    "78": [0, 0.68333, 0.14736, 0.08334, 0.82049],
 1287    "79": [0, 0.68333, 0.02778, 0.11111, 0.79611],
 1288    "80": [0, 0.68333, 0.08222, 0.08334, 0.69556],
 1289    "81": [0.09722, 0.68333, 0, 0.11111, 0.81667],
 1290    "82": [0, 0.68333, 0, 0.08334, 0.8475],
 1291    "83": [0, 0.68333, 0.075, 0.13889, 0.60556],
 1292    "84": [0, 0.68333, 0.25417, 0, 0.54464],
 1293    "85": [0, 0.68333, 0.09931, 0.08334, 0.62583],
 1294    "86": [0, 0.68333, 0.08222, 0, 0.61278],
 1295    "87": [0, 0.68333, 0.08222, 0.08334, 0.98778],
 1296    "88": [0, 0.68333, 0.14643, 0.13889, 0.7133],
 1297    "89": [0.09722, 0.68333, 0.08222, 0.08334, 0.66834],
 1298    "90": [0, 0.68333, 0.07944, 0.13889, 0.72473],
 1299    "160": [0, 0, 0, 0, 0.25]
 1300  },
 1301  "Fraktur-Regular": {
 1302    "32": [0, 0, 0, 0, 0.25],
 1303    "33": [0, 0.69141, 0, 0, 0.29574],
 1304    "34": [0, 0.69141, 0, 0, 0.21471],
 1305    "38": [0, 0.69141, 0, 0, 0.73786],
 1306    "39": [0, 0.69141, 0, 0, 0.21201],
 1307    "40": [0.24982, 0.74947, 0, 0, 0.38865],
 1308    "41": [0.24982, 0.74947, 0, 0, 0.38865],
 1309    "42": [0, 0.62119, 0, 0, 0.27764],
 1310    "43": [0.08319, 0.58283, 0, 0, 0.75623],
 1311    "44": [0, 0.10803, 0, 0, 0.27764],
 1312    "45": [0.08319, 0.58283, 0, 0, 0.75623],
 1313    "46": [0, 0.10803, 0, 0, 0.27764],
 1314    "47": [0.24982, 0.74947, 0, 0, 0.50181],
 1315    "48": [0, 0.47534, 0, 0, 0.50181],
 1316    "49": [0, 0.47534, 0, 0, 0.50181],
 1317    "50": [0, 0.47534, 0, 0, 0.50181],
 1318    "51": [0.18906, 0.47534, 0, 0, 0.50181],
 1319    "52": [0.18906, 0.47534, 0, 0, 0.50181],
 1320    "53": [0.18906, 0.47534, 0, 0, 0.50181],
 1321    "54": [0, 0.69141, 0, 0, 0.50181],
 1322    "55": [0.18906, 0.47534, 0, 0, 0.50181],
 1323    "56": [0, 0.69141, 0, 0, 0.50181],
 1324    "57": [0.18906, 0.47534, 0, 0, 0.50181],
 1325    "58": [0, 0.47534, 0, 0, 0.21606],
 1326    "59": [0.12604, 0.47534, 0, 0, 0.21606],
 1327    "61": [-0.13099, 0.36866, 0, 0, 0.75623],
 1328    "63": [0, 0.69141, 0, 0, 0.36245],
 1329    "65": [0, 0.69141, 0, 0, 0.7176],
 1330    "66": [0, 0.69141, 0, 0, 0.88397],
 1331    "67": [0, 0.69141, 0, 0, 0.61254],
 1332    "68": [0, 0.69141, 0, 0, 0.83158],
 1333    "69": [0, 0.69141, 0, 0, 0.66278],
 1334    "70": [0.12604, 0.69141, 0, 0, 0.61119],
 1335    "71": [0, 0.69141, 0, 0, 0.78539],
 1336    "72": [0.06302, 0.69141, 0, 0, 0.7203],
 1337    "73": [0, 0.69141, 0, 0, 0.55448],
 1338    "74": [0.12604, 0.69141, 0, 0, 0.55231],
 1339    "75": [0, 0.69141, 0, 0, 0.66845],
 1340    "76": [0, 0.69141, 0, 0, 0.66602],
 1341    "77": [0, 0.69141, 0, 0, 1.04953],
 1342    "78": [0, 0.69141, 0, 0, 0.83212],
 1343    "79": [0, 0.69141, 0, 0, 0.82699],
 1344    "80": [0.18906, 0.69141, 0, 0, 0.82753],
 1345    "81": [0.03781, 0.69141, 0, 0, 0.82699],
 1346    "82": [0, 0.69141, 0, 0, 0.82807],
 1347    "83": [0, 0.69141, 0, 0, 0.82861],
 1348    "84": [0, 0.69141, 0, 0, 0.66899],
 1349    "85": [0, 0.69141, 0, 0, 0.64576],
 1350    "86": [0, 0.69141, 0, 0, 0.83131],
 1351    "87": [0, 0.69141, 0, 0, 1.04602],
 1352    "88": [0, 0.69141, 0, 0, 0.71922],
 1353    "89": [0.18906, 0.69141, 0, 0, 0.83293],
 1354    "90": [0.12604, 0.69141, 0, 0, 0.60201],
 1355    "91": [0.24982, 0.74947, 0, 0, 0.27764],
 1356    "93": [0.24982, 0.74947, 0, 0, 0.27764],
 1357    "94": [0, 0.69141, 0, 0, 0.49965],
 1358    "97": [0, 0.47534, 0, 0, 0.50046],
 1359    "98": [0, 0.69141, 0, 0, 0.51315],
 1360    "99": [0, 0.47534, 0, 0, 0.38946],
 1361    "100": [0, 0.62119, 0, 0, 0.49857],
 1362    "101": [0, 0.47534, 0, 0, 0.40053],
 1363    "102": [0.18906, 0.69141, 0, 0, 0.32626],
 1364    "103": [0.18906, 0.47534, 0, 0, 0.5037],
 1365    "104": [0.18906, 0.69141, 0, 0, 0.52126],
 1366    "105": [0, 0.69141, 0, 0, 0.27899],
 1367    "106": [0, 0.69141, 0, 0, 0.28088],
 1368    "107": [0, 0.69141, 0, 0, 0.38946],
 1369    "108": [0, 0.69141, 0, 0, 0.27953],
 1370    "109": [0, 0.47534, 0, 0, 0.76676],
 1371    "110": [0, 0.47534, 0, 0, 0.52666],
 1372    "111": [0, 0.47534, 0, 0, 0.48885],
 1373    "112": [0.18906, 0.52396, 0, 0, 0.50046],
 1374    "113": [0.18906, 0.47534, 0, 0, 0.48912],
 1375    "114": [0, 0.47534, 0, 0, 0.38919],
 1376    "115": [0, 0.47534, 0, 0, 0.44266],
 1377    "116": [0, 0.62119, 0, 0, 0.33301],
 1378    "117": [0, 0.47534, 0, 0, 0.5172],
 1379    "118": [0, 0.52396, 0, 0, 0.5118],
 1380    "119": [0, 0.52396, 0, 0, 0.77351],
 1381    "120": [0.18906, 0.47534, 0, 0, 0.38865],
 1382    "121": [0.18906, 0.47534, 0, 0, 0.49884],
 1383    "122": [0.18906, 0.47534, 0, 0, 0.39054],
 1384    "160": [0, 0, 0, 0, 0.25],
 1385    "8216": [0, 0.69141, 0, 0, 0.21471],
 1386    "8217": [0, 0.69141, 0, 0, 0.21471],
 1387    "58112": [0, 0.62119, 0, 0, 0.49749],
 1388    "58113": [0, 0.62119, 0, 0, 0.4983],
 1389    "58114": [0.18906, 0.69141, 0, 0, 0.33328],
 1390    "58115": [0.18906, 0.69141, 0, 0, 0.32923],
 1391    "58116": [0.18906, 0.47534, 0, 0, 0.50343],
 1392    "58117": [0, 0.69141, 0, 0, 0.33301],
 1393    "58118": [0, 0.62119, 0, 0, 0.33409],
 1394    "58119": [0, 0.47534, 0, 0, 0.50073]
 1395  },
 1396  "Main-Bold": {
 1397    "32": [0, 0, 0, 0, 0.25],
 1398    "33": [0, 0.69444, 0, 0, 0.35],
 1399    "34": [0, 0.69444, 0, 0, 0.60278],
 1400    "35": [0.19444, 0.69444, 0, 0, 0.95833],
 1401    "36": [0.05556, 0.75, 0, 0, 0.575],
 1402    "37": [0.05556, 0.75, 0, 0, 0.95833],
 1403    "38": [0, 0.69444, 0, 0, 0.89444],
 1404    "39": [0, 0.69444, 0, 0, 0.31944],
 1405    "40": [0.25, 0.75, 0, 0, 0.44722],
 1406    "41": [0.25, 0.75, 0, 0, 0.44722],
 1407    "42": [0, 0.75, 0, 0, 0.575],
 1408    "43": [0.13333, 0.63333, 0, 0, 0.89444],
 1409    "44": [0.19444, 0.15556, 0, 0, 0.31944],
 1410    "45": [0, 0.44444, 0, 0, 0.38333],
 1411    "46": [0, 0.15556, 0, 0, 0.31944],
 1412    "47": [0.25, 0.75, 0, 0, 0.575],
 1413    "48": [0, 0.64444, 0, 0, 0.575],
 1414    "49": [0, 0.64444, 0, 0, 0.575],
 1415    "50": [0, 0.64444, 0, 0, 0.575],
 1416    "51": [0, 0.64444, 0, 0, 0.575],
 1417    "52": [0, 0.64444, 0, 0, 0.575],
 1418    "53": [0, 0.64444, 0, 0, 0.575],
 1419    "54": [0, 0.64444, 0, 0, 0.575],
 1420    "55": [0, 0.64444, 0, 0, 0.575],
 1421    "56": [0, 0.64444, 0, 0, 0.575],
 1422    "57": [0, 0.64444, 0, 0, 0.575],
 1423    "58": [0, 0.44444, 0, 0, 0.31944],
 1424    "59": [0.19444, 0.44444, 0, 0, 0.31944],
 1425    "60": [0.08556, 0.58556, 0, 0, 0.89444],
 1426    "61": [-0.10889, 0.39111, 0, 0, 0.89444],
 1427    "62": [0.08556, 0.58556, 0, 0, 0.89444],
 1428    "63": [0, 0.69444, 0, 0, 0.54305],
 1429    "64": [0, 0.69444, 0, 0, 0.89444],
 1430    "65": [0, 0.68611, 0, 0, 0.86944],
 1431    "66": [0, 0.68611, 0, 0, 0.81805],
 1432    "67": [0, 0.68611, 0, 0, 0.83055],
 1433    "68": [0, 0.68611, 0, 0, 0.88194],
 1434    "69": [0, 0.68611, 0, 0, 0.75555],
 1435    "70": [0, 0.68611, 0, 0, 0.72361],
 1436    "71": [0, 0.68611, 0, 0, 0.90416],
 1437    "72": [0, 0.68611, 0, 0, 0.9],
 1438    "73": [0, 0.68611, 0, 0, 0.43611],
 1439    "74": [0, 0.68611, 0, 0, 0.59444],
 1440    "75": [0, 0.68611, 0, 0, 0.90138],
 1441    "76": [0, 0.68611, 0, 0, 0.69166],
 1442    "77": [0, 0.68611, 0, 0, 1.09166],
 1443    "78": [0, 0.68611, 0, 0, 0.9],
 1444    "79": [0, 0.68611, 0, 0, 0.86388],
 1445    "80": [0, 0.68611, 0, 0, 0.78611],
 1446    "81": [0.19444, 0.68611, 0, 0, 0.86388],
 1447    "82": [0, 0.68611, 0, 0, 0.8625],
 1448    "83": [0, 0.68611, 0, 0, 0.63889],
 1449    "84": [0, 0.68611, 0, 0, 0.8],
 1450    "85": [0, 0.68611, 0, 0, 0.88472],
 1451    "86": [0, 0.68611, 0.01597, 0, 0.86944],
 1452    "87": [0, 0.68611, 0.01597, 0, 1.18888],
 1453    "88": [0, 0.68611, 0, 0, 0.86944],
 1454    "89": [0, 0.68611, 0.02875, 0, 0.86944],
 1455    "90": [0, 0.68611, 0, 0, 0.70277],
 1456    "91": [0.25, 0.75, 0, 0, 0.31944],
 1457    "92": [0.25, 0.75, 0, 0, 0.575],
 1458    "93": [0.25, 0.75, 0, 0, 0.31944],
 1459    "94": [0, 0.69444, 0, 0, 0.575],
 1460    "95": [0.31, 0.13444, 0.03194, 0, 0.575],
 1461    "97": [0, 0.44444, 0, 0, 0.55902],
 1462    "98": [0, 0.69444, 0, 0, 0.63889],
 1463    "99": [0, 0.44444, 0, 0, 0.51111],
 1464    "100": [0, 0.69444, 0, 0, 0.63889],
 1465    "101": [0, 0.44444, 0, 0, 0.52708],
 1466    "102": [0, 0.69444, 0.10903, 0, 0.35139],
 1467    "103": [0.19444, 0.44444, 0.01597, 0, 0.575],
 1468    "104": [0, 0.69444, 0, 0, 0.63889],
 1469    "105": [0, 0.69444, 0, 0, 0.31944],
 1470    "106": [0.19444, 0.69444, 0, 0, 0.35139],
 1471    "107": [0, 0.69444, 0, 0, 0.60694],
 1472    "108": [0, 0.69444, 0, 0, 0.31944],
 1473    "109": [0, 0.44444, 0, 0, 0.95833],
 1474    "110": [0, 0.44444, 0, 0, 0.63889],
 1475    "111": [0, 0.44444, 0, 0, 0.575],
 1476    "112": [0.19444, 0.44444, 0, 0, 0.63889],
 1477    "113": [0.19444, 0.44444, 0, 0, 0.60694],
 1478    "114": [0, 0.44444, 0, 0, 0.47361],
 1479    "115": [0, 0.44444, 0, 0, 0.45361],
 1480    "116": [0, 0.63492, 0, 0, 0.44722],
 1481    "117": [0, 0.44444, 0, 0, 0.63889],
 1482    "118": [0, 0.44444, 0.01597, 0, 0.60694],
 1483    "119": [0, 0.44444, 0.01597, 0, 0.83055],
 1484    "120": [0, 0.44444, 0, 0, 0.60694],
 1485    "121": [0.19444, 0.44444, 0.01597, 0, 0.60694],
 1486    "122": [0, 0.44444, 0, 0, 0.51111],
 1487    "123": [0.25, 0.75, 0, 0, 0.575],
 1488    "124": [0.25, 0.75, 0, 0, 0.31944],
 1489    "125": [0.25, 0.75, 0, 0, 0.575],
 1490    "126": [0.35, 0.34444, 0, 0, 0.575],
 1491    "160": [0, 0, 0, 0, 0.25],
 1492    "163": [0, 0.69444, 0, 0, 0.86853],
 1493    "168": [0, 0.69444, 0, 0, 0.575],
 1494    "172": [0, 0.44444, 0, 0, 0.76666],
 1495    "176": [0, 0.69444, 0, 0, 0.86944],
 1496    "177": [0.13333, 0.63333, 0, 0, 0.89444],
 1497    "184": [0.17014, 0, 0, 0, 0.51111],
 1498    "198": [0, 0.68611, 0, 0, 1.04166],
 1499    "215": [0.13333, 0.63333, 0, 0, 0.89444],
 1500    "216": [0.04861, 0.73472, 0, 0, 0.89444],
 1501    "223": [0, 0.69444, 0, 0, 0.59722],
 1502    "230": [0, 0.44444, 0, 0, 0.83055],
 1503    "247": [0.13333, 0.63333, 0, 0, 0.89444],
 1504    "248": [0.09722, 0.54167, 0, 0, 0.575],
 1505    "305": [0, 0.44444, 0, 0, 0.31944],
 1506    "338": [0, 0.68611, 0, 0, 1.16944],
 1507    "339": [0, 0.44444, 0, 0, 0.89444],
 1508    "567": [0.19444, 0.44444, 0, 0, 0.35139],
 1509    "710": [0, 0.69444, 0, 0, 0.575],
 1510    "711": [0, 0.63194, 0, 0, 0.575],
 1511    "713": [0, 0.59611, 0, 0, 0.575],
 1512    "714": [0, 0.69444, 0, 0, 0.575],
 1513    "715": [0, 0.69444, 0, 0, 0.575],
 1514    "728": [0, 0.69444, 0, 0, 0.575],
 1515    "729": [0, 0.69444, 0, 0, 0.31944],
 1516    "730": [0, 0.69444, 0, 0, 0.86944],
 1517    "732": [0, 0.69444, 0, 0, 0.575],
 1518    "733": [0, 0.69444, 0, 0, 0.575],
 1519    "915": [0, 0.68611, 0, 0, 0.69166],
 1520    "916": [0, 0.68611, 0, 0, 0.95833],
 1521    "920": [0, 0.68611, 0, 0, 0.89444],
 1522    "923": [0, 0.68611, 0, 0, 0.80555],
 1523    "926": [0, 0.68611, 0, 0, 0.76666],
 1524    "928": [0, 0.68611, 0, 0, 0.9],
 1525    "931": [0, 0.68611, 0, 0, 0.83055],
 1526    "933": [0, 0.68611, 0, 0, 0.89444],
 1527    "934": [0, 0.68611, 0, 0, 0.83055],
 1528    "936": [0, 0.68611, 0, 0, 0.89444],
 1529    "937": [0, 0.68611, 0, 0, 0.83055],
 1530    "8211": [0, 0.44444, 0.03194, 0, 0.575],
 1531    "8212": [0, 0.44444, 0.03194, 0, 1.14999],
 1532    "8216": [0, 0.69444, 0, 0, 0.31944],
 1533    "8217": [0, 0.69444, 0, 0, 0.31944],
 1534    "8220": [0, 0.69444, 0, 0, 0.60278],
 1535    "8221": [0, 0.69444, 0, 0, 0.60278],
 1536    "8224": [0.19444, 0.69444, 0, 0, 0.51111],
 1537    "8225": [0.19444, 0.69444, 0, 0, 0.51111],
 1538    "8242": [0, 0.55556, 0, 0, 0.34444],
 1539    "8407": [0, 0.72444, 0.15486, 0, 0.575],
 1540    "8463": [0, 0.69444, 0, 0, 0.66759],
 1541    "8465": [0, 0.69444, 0, 0, 0.83055],
 1542    "8467": [0, 0.69444, 0, 0, 0.47361],
 1543    "8472": [0.19444, 0.44444, 0, 0, 0.74027],
 1544    "8476": [0, 0.69444, 0, 0, 0.83055],
 1545    "8501": [0, 0.69444, 0, 0, 0.70277],
 1546    "8592": [-0.10889, 0.39111, 0, 0, 1.14999],
 1547    "8593": [0.19444, 0.69444, 0, 0, 0.575],
 1548    "8594": [-0.10889, 0.39111, 0, 0, 1.14999],
 1549    "8595": [0.19444, 0.69444, 0, 0, 0.575],
 1550    "8596": [-0.10889, 0.39111, 0, 0, 1.14999],
 1551    "8597": [0.25, 0.75, 0, 0, 0.575],
 1552    "8598": [0.19444, 0.69444, 0, 0, 1.14999],
 1553    "8599": [0.19444, 0.69444, 0, 0, 1.14999],
 1554    "8600": [0.19444, 0.69444, 0, 0, 1.14999],
 1555    "8601": [0.19444, 0.69444, 0, 0, 1.14999],
 1556    "8636": [-0.10889, 0.39111, 0, 0, 1.14999],
 1557    "8637": [-0.10889, 0.39111, 0, 0, 1.14999],
 1558    "8640": [-0.10889, 0.39111, 0, 0, 1.14999],
 1559    "8641": [-0.10889, 0.39111, 0, 0, 1.14999],
 1560    "8656": [-0.10889, 0.39111, 0, 0, 1.14999],
 1561    "8657": [0.19444, 0.69444, 0, 0, 0.70277],
 1562    "8658": [-0.10889, 0.39111, 0, 0, 1.14999],
 1563    "8659": [0.19444, 0.69444, 0, 0, 0.70277],
 1564    "8660": [-0.10889, 0.39111, 0, 0, 1.14999],
 1565    "8661": [0.25, 0.75, 0, 0, 0.70277],
 1566    "8704": [0, 0.69444, 0, 0, 0.63889],
 1567    "8706": [0, 0.69444, 0.06389, 0, 0.62847],
 1568    "8707": [0, 0.69444, 0, 0, 0.63889],
 1569    "8709": [0.05556, 0.75, 0, 0, 0.575],
 1570    "8711": [0, 0.68611, 0, 0, 0.95833],
 1571    "8712": [0.08556, 0.58556, 0, 0, 0.76666],
 1572    "8715": [0.08556, 0.58556, 0, 0, 0.76666],
 1573    "8722": [0.13333, 0.63333, 0, 0, 0.89444],
 1574    "8723": [0.13333, 0.63333, 0, 0, 0.89444],
 1575    "8725": [0.25, 0.75, 0, 0, 0.575],
 1576    "8726": [0.25, 0.75, 0, 0, 0.575],
 1577    "8727": [-0.02778, 0.47222, 0, 0, 0.575],
 1578    "8728": [-0.02639, 0.47361, 0, 0, 0.575],
 1579    "8729": [-0.02639, 0.47361, 0, 0, 0.575],
 1580    "8730": [0.18, 0.82, 0, 0, 0.95833],
 1581    "8733": [0, 0.44444, 0, 0, 0.89444],
 1582    "8734": [0, 0.44444, 0, 0, 1.14999],
 1583    "8736": [0, 0.69224, 0, 0, 0.72222],
 1584    "8739": [0.25, 0.75, 0, 0, 0.31944],
 1585    "8741": [0.25, 0.75, 0, 0, 0.575],
 1586    "8743": [0, 0.55556, 0, 0, 0.76666],
 1587    "8744": [0, 0.55556, 0, 0, 0.76666],
 1588    "8745": [0, 0.55556, 0, 0, 0.76666],
 1589    "8746": [0, 0.55556, 0, 0, 0.76666],
 1590    "8747": [0.19444, 0.69444, 0.12778, 0, 0.56875],
 1591    "8764": [-0.10889, 0.39111, 0, 0, 0.89444],
 1592    "8768": [0.19444, 0.69444, 0, 0, 0.31944],
 1593    "8771": [0.00222, 0.50222, 0, 0, 0.89444],
 1594    "8773": [0.027, 0.638, 0, 0, 0.894],
 1595    "8776": [0.02444, 0.52444, 0, 0, 0.89444],
 1596    "8781": [0.00222, 0.50222, 0, 0, 0.89444],
 1597    "8801": [0.00222, 0.50222, 0, 0, 0.89444],
 1598    "8804": [0.19667, 0.69667, 0, 0, 0.89444],
 1599    "8805": [0.19667, 0.69667, 0, 0, 0.89444],
 1600    "8810": [0.08556, 0.58556, 0, 0, 1.14999],
 1601    "8811": [0.08556, 0.58556, 0, 0, 1.14999],
 1602    "8826": [0.08556, 0.58556, 0, 0, 0.89444],
 1603    "8827": [0.08556, 0.58556, 0, 0, 0.89444],
 1604    "8834": [0.08556, 0.58556, 0, 0, 0.89444],
 1605    "8835": [0.08556, 0.58556, 0, 0, 0.89444],
 1606    "8838": [0.19667, 0.69667, 0, 0, 0.89444],
 1607    "8839": [0.19667, 0.69667, 0, 0, 0.89444],
 1608    "8846": [0, 0.55556, 0, 0, 0.76666],
 1609    "8849": [0.19667, 0.69667, 0, 0, 0.89444],
 1610    "8850": [0.19667, 0.69667, 0, 0, 0.89444],
 1611    "8851": [0, 0.55556, 0, 0, 0.76666],
 1612    "8852": [0, 0.55556, 0, 0, 0.76666],
 1613    "8853": [0.13333, 0.63333, 0, 0, 0.89444],
 1614    "8854": [0.13333, 0.63333, 0, 0, 0.89444],
 1615    "8855": [0.13333, 0.63333, 0, 0, 0.89444],
 1616    "8856": [0.13333, 0.63333, 0, 0, 0.89444],
 1617    "8857": [0.13333, 0.63333, 0, 0, 0.89444],
 1618    "8866": [0, 0.69444, 0, 0, 0.70277],
 1619    "8867": [0, 0.69444, 0, 0, 0.70277],
 1620    "8868": [0, 0.69444, 0, 0, 0.89444],
 1621    "8869": [0, 0.69444, 0, 0, 0.89444],
 1622    "8900": [-0.02639, 0.47361, 0, 0, 0.575],
 1623    "8901": [-0.02639, 0.47361, 0, 0, 0.31944],
 1624    "8902": [-0.02778, 0.47222, 0, 0, 0.575],
 1625    "8968": [0.25, 0.75, 0, 0, 0.51111],
 1626    "8969": [0.25, 0.75, 0, 0, 0.51111],
 1627    "8970": [0.25, 0.75, 0, 0, 0.51111],
 1628    "8971": [0.25, 0.75, 0, 0, 0.51111],
 1629    "8994": [-0.13889, 0.36111, 0, 0, 1.14999],
 1630    "8995": [-0.13889, 0.36111, 0, 0, 1.14999],
 1631    "9651": [0.19444, 0.69444, 0, 0, 1.02222],
 1632    "9657": [-0.02778, 0.47222, 0, 0, 0.575],
 1633    "9661": [0.19444, 0.69444, 0, 0, 1.02222],
 1634    "9667": [-0.02778, 0.47222, 0, 0, 0.575],
 1635    "9711": [0.19444, 0.69444, 0, 0, 1.14999],
 1636    "9824": [0.12963, 0.69444, 0, 0, 0.89444],
 1637    "9825": [0.12963, 0.69444, 0, 0, 0.89444],
 1638    "9826": [0.12963, 0.69444, 0, 0, 0.89444],
 1639    "9827": [0.12963, 0.69444, 0, 0, 0.89444],
 1640    "9837": [0, 0.75, 0, 0, 0.44722],
 1641    "9838": [0.19444, 0.69444, 0, 0, 0.44722],
 1642    "9839": [0.19444, 0.69444, 0, 0, 0.44722],
 1643    "10216": [0.25, 0.75, 0, 0, 0.44722],
 1644    "10217": [0.25, 0.75, 0, 0, 0.44722],
 1645    "10815": [0, 0.68611, 0, 0, 0.9],
 1646    "10927": [0.19667, 0.69667, 0, 0, 0.89444],
 1647    "10928": [0.19667, 0.69667, 0, 0, 0.89444],
 1648    "57376": [0.19444, 0.69444, 0, 0, 0]
 1649  },
 1650  "Main-BoldItalic": {
 1651    "32": [0, 0, 0, 0, 0.25],
 1652    "33": [0, 0.69444, 0.11417, 0, 0.38611],
 1653    "34": [0, 0.69444, 0.07939, 0, 0.62055],
 1654    "35": [0.19444, 0.69444, 0.06833, 0, 0.94444],
 1655    "37": [0.05556, 0.75, 0.12861, 0, 0.94444],
 1656    "38": [0, 0.69444, 0.08528, 0, 0.88555],
 1657    "39": [0, 0.69444, 0.12945, 0, 0.35555],
 1658    "40": [0.25, 0.75, 0.15806, 0, 0.47333],
 1659    "41": [0.25, 0.75, 0.03306, 0, 0.47333],
 1660    "42": [0, 0.75, 0.14333, 0, 0.59111],
 1661    "43": [0.10333, 0.60333, 0.03306, 0, 0.88555],
 1662    "44": [0.19444, 0.14722, 0, 0, 0.35555],
 1663    "45": [0, 0.44444, 0.02611, 0, 0.41444],
 1664    "46": [0, 0.14722, 0, 0, 0.35555],
 1665    "47": [0.25, 0.75, 0.15806, 0, 0.59111],
 1666    "48": [0, 0.64444, 0.13167, 0, 0.59111],
 1667    "49": [0, 0.64444, 0.13167, 0, 0.59111],
 1668    "50": [0, 0.64444, 0.13167, 0, 0.59111],
 1669    "51": [0, 0.64444, 0.13167, 0, 0.59111],
 1670    "52": [0.19444, 0.64444, 0.13167, 0, 0.59111],
 1671    "53": [0, 0.64444, 0.13167, 0, 0.59111],
 1672    "54": [0, 0.64444, 0.13167, 0, 0.59111],
 1673    "55": [0.19444, 0.64444, 0.13167, 0, 0.59111],
 1674    "56": [0, 0.64444, 0.13167, 0, 0.59111],
 1675    "57": [0, 0.64444, 0.13167, 0, 0.59111],
 1676    "58": [0, 0.44444, 0.06695, 0, 0.35555],
 1677    "59": [0.19444, 0.44444, 0.06695, 0, 0.35555],
 1678    "61": [-0.10889, 0.39111, 0.06833, 0, 0.88555],
 1679    "63": [0, 0.69444, 0.11472, 0, 0.59111],
 1680    "64": [0, 0.69444, 0.09208, 0, 0.88555],
 1681    "65": [0, 0.68611, 0, 0, 0.86555],
 1682    "66": [0, 0.68611, 0.0992, 0, 0.81666],
 1683    "67": [0, 0.68611, 0.14208, 0, 0.82666],
 1684    "68": [0, 0.68611, 0.09062, 0, 0.87555],
 1685    "69": [0, 0.68611, 0.11431, 0, 0.75666],
 1686    "70": [0, 0.68611, 0.12903, 0, 0.72722],
 1687    "71": [0, 0.68611, 0.07347, 0, 0.89527],
 1688    "72": [0, 0.68611, 0.17208, 0, 0.8961],
 1689    "73": [0, 0.68611, 0.15681, 0, 0.47166],
 1690    "74": [0, 0.68611, 0.145, 0, 0.61055],
 1691    "75": [0, 0.68611, 0.14208, 0, 0.89499],
 1692    "76": [0, 0.68611, 0, 0, 0.69777],
 1693    "77": [0, 0.68611, 0.17208, 0, 1.07277],
 1694    "78": [0, 0.68611, 0.17208, 0, 0.8961],
 1695    "79": [0, 0.68611, 0.09062, 0, 0.85499],
 1696    "80": [0, 0.68611, 0.0992, 0, 0.78721],
 1697    "81": [0.19444, 0.68611, 0.09062, 0, 0.85499],
 1698    "82": [0, 0.68611, 0.02559, 0, 0.85944],
 1699    "83": [0, 0.68611, 0.11264, 0, 0.64999],
 1700    "84": [0, 0.68611, 0.12903, 0, 0.7961],
 1701    "85": [0, 0.68611, 0.17208, 0, 0.88083],
 1702    "86": [0, 0.68611, 0.18625, 0, 0.86555],
 1703    "87": [0, 0.68611, 0.18625, 0, 1.15999],
 1704    "88": [0, 0.68611, 0.15681, 0, 0.86555],
 1705    "89": [0, 0.68611, 0.19803, 0, 0.86555],
 1706    "90": [0, 0.68611, 0.14208, 0, 0.70888],
 1707    "91": [0.25, 0.75, 0.1875, 0, 0.35611],
 1708    "93": [0.25, 0.75, 0.09972, 0, 0.35611],
 1709    "94": [0, 0.69444, 0.06709, 0, 0.59111],
 1710    "95": [0.31, 0.13444, 0.09811, 0, 0.59111],
 1711    "97": [0, 0.44444, 0.09426, 0, 0.59111],
 1712    "98": [0, 0.69444, 0.07861, 0, 0.53222],
 1713    "99": [0, 0.44444, 0.05222, 0, 0.53222],
 1714    "100": [0, 0.69444, 0.10861, 0, 0.59111],
 1715    "101": [0, 0.44444, 0.085, 0, 0.53222],
 1716    "102": [0.19444, 0.69444, 0.21778, 0, 0.4],
 1717    "103": [0.19444, 0.44444, 0.105, 0, 0.53222],
 1718    "104": [0, 0.69444, 0.09426, 0, 0.59111],
 1719    "105": [0, 0.69326, 0.11387, 0, 0.35555],
 1720    "106": [0.19444, 0.69326, 0.1672, 0, 0.35555],
 1721    "107": [0, 0.69444, 0.11111, 0, 0.53222],
 1722    "108": [0, 0.69444, 0.10861, 0, 0.29666],
 1723    "109": [0, 0.44444, 0.09426, 0, 0.94444],
 1724    "110": [0, 0.44444, 0.09426, 0, 0.64999],
 1725    "111": [0, 0.44444, 0.07861, 0, 0.59111],
 1726    "112": [0.19444, 0.44444, 0.07861, 0, 0.59111],
 1727    "113": [0.19444, 0.44444, 0.105, 0, 0.53222],
 1728    "114": [0, 0.44444, 0.11111, 0, 0.50167],
 1729    "115": [0, 0.44444, 0.08167, 0, 0.48694],
 1730    "116": [0, 0.63492, 0.09639, 0, 0.385],
 1731    "117": [0, 0.44444, 0.09426, 0, 0.62055],
 1732    "118": [0, 0.44444, 0.11111, 0, 0.53222],
 1733    "119": [0, 0.44444, 0.11111, 0, 0.76777],
 1734    "120": [0, 0.44444, 0.12583, 0, 0.56055],
 1735    "121": [0.19444, 0.44444, 0.105, 0, 0.56166],
 1736    "122": [0, 0.44444, 0.13889, 0, 0.49055],
 1737    "126": [0.35, 0.34444, 0.11472, 0, 0.59111],
 1738    "160": [0, 0, 0, 0, 0.25],
 1739    "168": [0, 0.69444, 0.11473, 0, 0.59111],
 1740    "176": [0, 0.69444, 0, 0, 0.94888],
 1741    "184": [0.17014, 0, 0, 0, 0.53222],
 1742    "198": [0, 0.68611, 0.11431, 0, 1.02277],
 1743    "216": [0.04861, 0.73472, 0.09062, 0, 0.88555],
 1744    "223": [0.19444, 0.69444, 0.09736, 0, 0.665],
 1745    "230": [0, 0.44444, 0.085, 0, 0.82666],
 1746    "248": [0.09722, 0.54167, 0.09458, 0, 0.59111],
 1747    "305": [0, 0.44444, 0.09426, 0, 0.35555],
 1748    "338": [0, 0.68611, 0.11431, 0, 1.14054],
 1749    "339": [0, 0.44444, 0.085, 0, 0.82666],
 1750    "567": [0.19444, 0.44444, 0.04611, 0, 0.385],
 1751    "710": [0, 0.69444, 0.06709, 0, 0.59111],
 1752    "711": [0, 0.63194, 0.08271, 0, 0.59111],
 1753    "713": [0, 0.59444, 0.10444, 0, 0.59111],
 1754    "714": [0, 0.69444, 0.08528, 0, 0.59111],
 1755    "715": [0, 0.69444, 0, 0, 0.59111],
 1756    "728": [0, 0.69444, 0.10333, 0, 0.59111],
 1757    "729": [0, 0.69444, 0.12945, 0, 0.35555],
 1758    "730": [0, 0.69444, 0, 0, 0.94888],
 1759    "732": [0, 0.69444, 0.11472, 0, 0.59111],
 1760    "733": [0, 0.69444, 0.11472, 0, 0.59111],
 1761    "915": [0, 0.68611, 0.12903, 0, 0.69777],
 1762    "916": [0, 0.68611, 0, 0, 0.94444],
 1763    "920": [0, 0.68611, 0.09062, 0, 0.88555],
 1764    "923": [0, 0.68611, 0, 0, 0.80666],
 1765    "926": [0, 0.68611, 0.15092, 0, 0.76777],
 1766    "928": [0, 0.68611, 0.17208, 0, 0.8961],
 1767    "931": [0, 0.68611, 0.11431, 0, 0.82666],
 1768    "933": [0, 0.68611, 0.10778, 0, 0.88555],
 1769    "934": [0, 0.68611, 0.05632, 0, 0.82666],
 1770    "936": [0, 0.68611, 0.10778, 0, 0.88555],
 1771    "937": [0, 0.68611, 0.0992, 0, 0.82666],
 1772    "8211": [0, 0.44444, 0.09811, 0, 0.59111],
 1773    "8212": [0, 0.44444, 0.09811, 0, 1.18221],
 1774    "8216": [0, 0.69444, 0.12945, 0, 0.35555],
 1775    "8217": [0, 0.69444, 0.12945, 0, 0.35555],
 1776    "8220": [0, 0.69444, 0.16772, 0, 0.62055],
 1777    "8221": [0, 0.69444, 0.07939, 0, 0.62055]
 1778  },
 1779  "Main-Italic": {
 1780    "32": [0, 0, 0, 0, 0.25],
 1781    "33": [0, 0.69444, 0.12417, 0, 0.30667],
 1782    "34": [0, 0.69444, 0.06961, 0, 0.51444],
 1783    "35": [0.19444, 0.69444, 0.06616, 0, 0.81777],
 1784    "37": [0.05556, 0.75, 0.13639, 0, 0.81777],
 1785    "38": [0, 0.69444, 0.09694, 0, 0.76666],
 1786    "39": [0, 0.69444, 0.12417, 0, 0.30667],
 1787    "40": [0.25, 0.75, 0.16194, 0, 0.40889],
 1788    "41": [0.25, 0.75, 0.03694, 0, 0.40889],
 1789    "42": [0, 0.75, 0.14917, 0, 0.51111],
 1790    "43": [0.05667, 0.56167, 0.03694, 0, 0.76666],
 1791    "44": [0.19444, 0.10556, 0, 0, 0.30667],
 1792    "45": [0, 0.43056, 0.02826, 0, 0.35778],
 1793    "46": [0, 0.10556, 0, 0, 0.30667],
 1794    "47": [0.25, 0.75, 0.16194, 0, 0.51111],
 1795    "48": [0, 0.64444, 0.13556, 0, 0.51111],
 1796    "49": [0, 0.64444, 0.13556, 0, 0.51111],
 1797    "50": [0, 0.64444, 0.13556, 0, 0.51111],
 1798    "51": [0, 0.64444, 0.13556, 0, 0.51111],
 1799    "52": [0.19444, 0.64444, 0.13556, 0, 0.51111],
 1800    "53": [0, 0.64444, 0.13556, 0, 0.51111],
 1801    "54": [0, 0.64444, 0.13556, 0, 0.51111],
 1802    "55": [0.19444, 0.64444, 0.13556, 0, 0.51111],
 1803    "56": [0, 0.64444, 0.13556, 0, 0.51111],
 1804    "57": [0, 0.64444, 0.13556, 0, 0.51111],
 1805    "58": [0, 0.43056, 0.0582, 0, 0.30667],
 1806    "59": [0.19444, 0.43056, 0.0582, 0, 0.30667],
 1807    "61": [-0.13313, 0.36687, 0.06616, 0, 0.76666],
 1808    "63": [0, 0.69444, 0.1225, 0, 0.51111],
 1809    "64": [0, 0.69444, 0.09597, 0, 0.76666],
 1810    "65": [0, 0.68333, 0, 0, 0.74333],
 1811    "66": [0, 0.68333, 0.10257, 0, 0.70389],
 1812    "67": [0, 0.68333, 0.14528, 0, 0.71555],
 1813    "68": [0, 0.68333, 0.09403, 0, 0.755],
 1814    "69": [0, 0.68333, 0.12028, 0, 0.67833],
 1815    "70": [0, 0.68333, 0.13305, 0, 0.65277],
 1816    "71": [0, 0.68333, 0.08722, 0, 0.77361],
 1817    "72": [0, 0.68333, 0.16389, 0, 0.74333],
 1818    "73": [0, 0.68333, 0.15806, 0, 0.38555],
 1819    "74": [0, 0.68333, 0.14028, 0, 0.525],
 1820    "75": [0, 0.68333, 0.14528, 0, 0.76888],
 1821    "76": [0, 0.68333, 0, 0, 0.62722],
 1822    "77": [0, 0.68333, 0.16389, 0, 0.89666],
 1823    "78": [0, 0.68333, 0.16389, 0, 0.74333],
 1824    "79": [0, 0.68333, 0.09403, 0, 0.76666],
 1825    "80": [0, 0.68333, 0.10257, 0, 0.67833],
 1826    "81": [0.19444, 0.68333, 0.09403, 0, 0.76666],
 1827    "82": [0, 0.68333, 0.03868, 0, 0.72944],
 1828    "83": [0, 0.68333, 0.11972, 0, 0.56222],
 1829    "84": [0, 0.68333, 0.13305, 0, 0.71555],
 1830    "85": [0, 0.68333, 0.16389, 0, 0.74333],
 1831    "86": [0, 0.68333, 0.18361, 0, 0.74333],
 1832    "87": [0, 0.68333, 0.18361, 0, 0.99888],
 1833    "88": [0, 0.68333, 0.15806, 0, 0.74333],
 1834    "89": [0, 0.68333, 0.19383, 0, 0.74333],
 1835    "90": [0, 0.68333, 0.14528, 0, 0.61333],
 1836    "91": [0.25, 0.75, 0.1875, 0, 0.30667],
 1837    "93": [0.25, 0.75, 0.10528, 0, 0.30667],
 1838    "94": [0, 0.69444, 0.06646, 0, 0.51111],
 1839    "95": [0.31, 0.12056, 0.09208, 0, 0.51111],
 1840    "97": [0, 0.43056, 0.07671, 0, 0.51111],
 1841    "98": [0, 0.69444, 0.06312, 0, 0.46],
 1842    "99": [0, 0.43056, 0.05653, 0, 0.46],
 1843    "100": [0, 0.69444, 0.10333, 0, 0.51111],
 1844    "101": [0, 0.43056, 0.07514, 0, 0.46],
 1845    "102": [0.19444, 0.69444, 0.21194, 0, 0.30667],
 1846    "103": [0.19444, 0.43056, 0.08847, 0, 0.46],
 1847    "104": [0, 0.69444, 0.07671, 0, 0.51111],
 1848    "105": [0, 0.65536, 0.1019, 0, 0.30667],
 1849    "106": [0.19444, 0.65536, 0.14467, 0, 0.30667],
 1850    "107": [0, 0.69444, 0.10764, 0, 0.46],
 1851    "108": [0, 0.69444, 0.10333, 0, 0.25555],
 1852    "109": [0, 0.43056, 0.07671, 0, 0.81777],
 1853    "110": [0, 0.43056, 0.07671, 0, 0.56222],
 1854    "111": [0, 0.43056, 0.06312, 0, 0.51111],
 1855    "112": [0.19444, 0.43056, 0.06312, 0, 0.51111],
 1856    "113": [0.19444, 0.43056, 0.08847, 0, 0.46],
 1857    "114": [0, 0.43056, 0.10764, 0, 0.42166],
 1858    "115": [0, 0.43056, 0.08208, 0, 0.40889],
 1859    "116": [0, 0.61508, 0.09486, 0, 0.33222],
 1860    "117": [0, 0.43056, 0.07671, 0, 0.53666],
 1861    "118": [0, 0.43056, 0.10764, 0, 0.46],
 1862    "119": [0, 0.43056, 0.10764, 0, 0.66444],
 1863    "120": [0, 0.43056, 0.12042, 0, 0.46389],
 1864    "121": [0.19444, 0.43056, 0.08847, 0, 0.48555],
 1865    "122": [0, 0.43056, 0.12292, 0, 0.40889],
 1866    "126": [0.35, 0.31786, 0.11585, 0, 0.51111],
 1867    "160": [0, 0, 0, 0, 0.25],
 1868    "168": [0, 0.66786, 0.10474, 0, 0.51111],
 1869    "176": [0, 0.69444, 0, 0, 0.83129],
 1870    "184": [0.17014, 0, 0, 0, 0.46],
 1871    "198": [0, 0.68333, 0.12028, 0, 0.88277],
 1872    "216": [0.04861, 0.73194, 0.09403, 0, 0.76666],
 1873    "223": [0.19444, 0.69444, 0.10514, 0, 0.53666],
 1874    "230": [0, 0.43056, 0.07514, 0, 0.71555],
 1875    "248": [0.09722, 0.52778, 0.09194, 0, 0.51111],
 1876    "338": [0, 0.68333, 0.12028, 0, 0.98499],
 1877    "339": [0, 0.43056, 0.07514, 0, 0.71555],
 1878    "710": [0, 0.69444, 0.06646, 0, 0.51111],
 1879    "711": [0, 0.62847, 0.08295, 0, 0.51111],
 1880    "713": [0, 0.56167, 0.10333, 0, 0.51111],
 1881    "714": [0, 0.69444, 0.09694, 0, 0.51111],
 1882    "715": [0, 0.69444, 0, 0, 0.51111],
 1883    "728": [0, 0.69444, 0.10806, 0, 0.51111],
 1884    "729": [0, 0.66786, 0.11752, 0, 0.30667],
 1885    "730": [0, 0.69444, 0, 0, 0.83129],
 1886    "732": [0, 0.66786, 0.11585, 0, 0.51111],
 1887    "733": [0, 0.69444, 0.1225, 0, 0.51111],
 1888    "915": [0, 0.68333, 0.13305, 0, 0.62722],
 1889    "916": [0, 0.68333, 0, 0, 0.81777],
 1890    "920": [0, 0.68333, 0.09403, 0, 0.76666],
 1891    "923": [0, 0.68333, 0, 0, 0.69222],
 1892    "926": [0, 0.68333, 0.15294, 0, 0.66444],
 1893    "928": [0, 0.68333, 0.16389, 0, 0.74333],
 1894    "931": [0, 0.68333, 0.12028, 0, 0.71555],
 1895    "933": [0, 0.68333, 0.11111, 0, 0.76666],
 1896    "934": [0, 0.68333, 0.05986, 0, 0.71555],
 1897    "936": [0, 0.68333, 0.11111, 0, 0.76666],
 1898    "937": [0, 0.68333, 0.10257, 0, 0.71555],
 1899    "8211": [0, 0.43056, 0.09208, 0, 0.51111],
 1900    "8212": [0, 0.43056, 0.09208, 0, 1.02222],
 1901    "8216": [0, 0.69444, 0.12417, 0, 0.30667],
 1902    "8217": [0, 0.69444, 0.12417, 0, 0.30667],
 1903    "8220": [0, 0.69444, 0.1685, 0, 0.51444],
 1904    "8221": [0, 0.69444, 0.06961, 0, 0.51444],
 1905    "8463": [0, 0.68889, 0, 0, 0.54028]
 1906  },
 1907  "Main-Regular": {
 1908    "32": [0, 0, 0, 0, 0.25],
 1909    "33": [0, 0.69444, 0, 0, 0.27778],
 1910    "34": [0, 0.69444, 0, 0, 0.5],
 1911    "35": [0.19444, 0.69444, 0, 0, 0.83334],
 1912    "36": [0.05556, 0.75, 0, 0, 0.5],
 1913    "37": [0.05556, 0.75, 0, 0, 0.83334],
 1914    "38": [0, 0.69444, 0, 0, 0.77778],
 1915    "39": [0, 0.69444, 0, 0, 0.27778],
 1916    "40": [0.25, 0.75, 0, 0, 0.38889],
 1917    "41": [0.25, 0.75, 0, 0, 0.38889],
 1918    "42": [0, 0.75, 0, 0, 0.5],
 1919    "43": [0.08333, 0.58333, 0, 0, 0.77778],
 1920    "44": [0.19444, 0.10556, 0, 0, 0.27778],
 1921    "45": [0, 0.43056, 0, 0, 0.33333],
 1922    "46": [0, 0.10556, 0, 0, 0.27778],
 1923    "47": [0.25, 0.75, 0, 0, 0.5],
 1924    "48": [0, 0.64444, 0, 0, 0.5],
 1925    "49": [0, 0.64444, 0, 0, 0.5],
 1926    "50": [0, 0.64444, 0, 0, 0.5],
 1927    "51": [0, 0.64444, 0, 0, 0.5],
 1928    "52": [0, 0.64444, 0, 0, 0.5],
 1929    "53": [0, 0.64444, 0, 0, 0.5],
 1930    "54": [0, 0.64444, 0, 0, 0.5],
 1931    "55": [0, 0.64444, 0, 0, 0.5],
 1932    "56": [0, 0.64444, 0, 0, 0.5],
 1933    "57": [0, 0.64444, 0, 0, 0.5],
 1934    "58": [0, 0.43056, 0, 0, 0.27778],
 1935    "59": [0.19444, 0.43056, 0, 0, 0.27778],
 1936    "60": [0.0391, 0.5391, 0, 0, 0.77778],
 1937    "61": [-0.13313, 0.36687, 0, 0, 0.77778],
 1938    "62": [0.0391, 0.5391, 0, 0, 0.77778],
 1939    "63": [0, 0.69444, 0, 0, 0.47222],
 1940    "64": [0, 0.69444, 0, 0, 0.77778],
 1941    "65": [0, 0.68333, 0, 0, 0.75],
 1942    "66": [0, 0.68333, 0, 0, 0.70834],
 1943    "67": [0, 0.68333, 0, 0, 0.72222],
 1944    "68": [0, 0.68333, 0, 0, 0.76389],
 1945    "69": [0, 0.68333, 0, 0, 0.68056],
 1946    "70": [0, 0.68333, 0, 0, 0.65278],
 1947    "71": [0, 0.68333, 0, 0, 0.78472],
 1948    "72": [0, 0.68333, 0, 0, 0.75],
 1949    "73": [0, 0.68333, 0, 0, 0.36111],
 1950    "74": [0, 0.68333, 0, 0, 0.51389],
 1951    "75": [0, 0.68333, 0, 0, 0.77778],
 1952    "76": [0, 0.68333, 0, 0, 0.625],
 1953    "77": [0, 0.68333, 0, 0, 0.91667],
 1954    "78": [0, 0.68333, 0, 0, 0.75],
 1955    "79": [0, 0.68333, 0, 0, 0.77778],
 1956    "80": [0, 0.68333, 0, 0, 0.68056],
 1957    "81": [0.19444, 0.68333, 0, 0, 0.77778],
 1958    "82": [0, 0.68333, 0, 0, 0.73611],
 1959    "83": [0, 0.68333, 0, 0, 0.55556],
 1960    "84": [0, 0.68333, 0, 0, 0.72222],
 1961    "85": [0, 0.68333, 0, 0, 0.75],
 1962    "86": [0, 0.68333, 0.01389, 0, 0.75],
 1963    "87": [0, 0.68333, 0.01389, 0, 1.02778],
 1964    "88": [0, 0.68333, 0, 0, 0.75],
 1965    "89": [0, 0.68333, 0.025, 0, 0.75],
 1966    "90": [0, 0.68333, 0, 0, 0.61111],
 1967    "91": [0.25, 0.75, 0, 0, 0.27778],
 1968    "92": [0.25, 0.75, 0, 0, 0.5],
 1969    "93": [0.25, 0.75, 0, 0, 0.27778],
 1970    "94": [0, 0.69444, 0, 0, 0.5],
 1971    "95": [0.31, 0.12056, 0.02778, 0, 0.5],
 1972    "97": [0, 0.43056, 0, 0, 0.5],
 1973    "98": [0, 0.69444, 0, 0, 0.55556],
 1974    "99": [0, 0.43056, 0, 0, 0.44445],
 1975    "100": [0, 0.69444, 0, 0, 0.55556],
 1976    "101": [0, 0.43056, 0, 0, 0.44445],
 1977    "102": [0, 0.69444, 0.07778, 0, 0.30556],
 1978    "103": [0.19444, 0.43056, 0.01389, 0, 0.5],
 1979    "104": [0, 0.69444, 0, 0, 0.55556],
 1980    "105": [0, 0.66786, 0, 0, 0.27778],
 1981    "106": [0.19444, 0.66786, 0, 0, 0.30556],
 1982    "107": [0, 0.69444, 0, 0, 0.52778],
 1983    "108": [0, 0.69444, 0, 0, 0.27778],
 1984    "109": [0, 0.43056, 0, 0, 0.83334],
 1985    "110": [0, 0.43056, 0, 0, 0.55556],
 1986    "111": [0, 0.43056, 0, 0, 0.5],
 1987    "112": [0.19444, 0.43056, 0, 0, 0.55556],
 1988    "113": [0.19444, 0.43056, 0, 0, 0.52778],
 1989    "114": [0, 0.43056, 0, 0, 0.39167],
 1990    "115": [0, 0.43056, 0, 0, 0.39445],
 1991    "116": [0, 0.61508, 0, 0, 0.38889],
 1992    "117": [0, 0.43056, 0, 0, 0.55556],
 1993    "118": [0, 0.43056, 0.01389, 0, 0.52778],
 1994    "119": [0, 0.43056, 0.01389, 0, 0.72222],
 1995    "120": [0, 0.43056, 0, 0, 0.52778],
 1996    "121": [0.19444, 0.43056, 0.01389, 0, 0.52778],
 1997    "122": [0, 0.43056, 0, 0, 0.44445],
 1998    "123": [0.25, 0.75, 0, 0, 0.5],
 1999    "124": [0.25, 0.75, 0, 0, 0.27778],
 2000    "125": [0.25, 0.75, 0, 0, 0.5],
 2001    "126": [0.35, 0.31786, 0, 0, 0.5],
 2002    "160": [0, 0, 0, 0, 0.25],
 2003    "163": [0, 0.69444, 0, 0, 0.76909],
 2004    "167": [0.19444, 0.69444, 0, 0, 0.44445],
 2005    "168": [0, 0.66786, 0, 0, 0.5],
 2006    "172": [0, 0.43056, 0, 0, 0.66667],
 2007    "176": [0, 0.69444, 0, 0, 0.75],
 2008    "177": [0.08333, 0.58333, 0, 0, 0.77778],
 2009    "182": [0.19444, 0.69444, 0, 0, 0.61111],
 2010    "184": [0.17014, 0, 0, 0, 0.44445],
 2011    "198": [0, 0.68333, 0, 0, 0.90278],
 2012    "215": [0.08333, 0.58333, 0, 0, 0.77778],
 2013    "216": [0.04861, 0.73194, 0, 0, 0.77778],
 2014    "223": [0, 0.69444, 0, 0, 0.5],
 2015    "230": [0, 0.43056, 0, 0, 0.72222],
 2016    "247": [0.08333, 0.58333, 0, 0, 0.77778],
 2017    "248": [0.09722, 0.52778, 0, 0, 0.5],
 2018    "305": [0, 0.43056, 0, 0, 0.27778],
 2019    "338": [0, 0.68333, 0, 0, 1.01389],
 2020    "339": [0, 0.43056, 0, 0, 0.77778],
 2021    "567": [0.19444, 0.43056, 0, 0, 0.30556],
 2022    "710": [0, 0.69444, 0, 0, 0.5],
 2023    "711": [0, 0.62847, 0, 0, 0.5],
 2024    "713": [0, 0.56778, 0, 0, 0.5],
 2025    "714": [0, 0.69444, 0, 0, 0.5],
 2026    "715": [0, 0.69444, 0, 0, 0.5],
 2027    "728": [0, 0.69444, 0, 0, 0.5],
 2028    "729": [0, 0.66786, 0, 0, 0.27778],
 2029    "730": [0, 0.69444, 0, 0, 0.75],
 2030    "732": [0, 0.66786, 0, 0, 0.5],
 2031    "733": [0, 0.69444, 0, 0, 0.5],
 2032    "915": [0, 0.68333, 0, 0, 0.625],
 2033    "916": [0, 0.68333, 0, 0, 0.83334],
 2034    "920": [0, 0.68333, 0, 0, 0.77778],
 2035    "923": [0, 0.68333, 0, 0, 0.69445],
 2036    "926": [0, 0.68333, 0, 0, 0.66667],
 2037    "928": [0, 0.68333, 0, 0, 0.75],
 2038    "931": [0, 0.68333, 0, 0, 0.72222],
 2039    "933": [0, 0.68333, 0, 0, 0.77778],
 2040    "934": [0, 0.68333, 0, 0, 0.72222],
 2041    "936": [0, 0.68333, 0, 0, 0.77778],
 2042    "937": [0, 0.68333, 0, 0, 0.72222],
 2043    "8211": [0, 0.43056, 0.02778, 0, 0.5],
 2044    "8212": [0, 0.43056, 0.02778, 0, 1.0],
 2045    "8216": [0, 0.69444, 0, 0, 0.27778],
 2046    "8217": [0, 0.69444, 0, 0, 0.27778],
 2047    "8220": [0, 0.69444, 0, 0, 0.5],
 2048    "8221": [0, 0.69444, 0, 0, 0.5],
 2049    "8224": [0.19444, 0.69444, 0, 0, 0.44445],
 2050    "8225": [0.19444, 0.69444, 0, 0, 0.44445],
 2051    "8230": [0, 0.123, 0, 0, 1.172],
 2052    "8242": [0, 0.55556, 0, 0, 0.275],
 2053    "8407": [0, 0.71444, 0.15382, 0, 0.5],
 2054    "8463": [0, 0.68889, 0, 0, 0.54028],
 2055    "8465": [0, 0.69444, 0, 0, 0.72222],
 2056    "8467": [0, 0.69444, 0, 0.11111, 0.41667],
 2057    "8472": [0.19444, 0.43056, 0, 0.11111, 0.63646],
 2058    "8476": [0, 0.69444, 0, 0, 0.72222],
 2059    "8501": [0, 0.69444, 0, 0, 0.61111],
 2060    "8592": [-0.13313, 0.36687, 0, 0, 1.0],
 2061    "8593": [0.19444, 0.69444, 0, 0, 0.5],
 2062    "8594": [-0.13313, 0.36687, 0, 0, 1.0],
 2063    "8595": [0.19444, 0.69444, 0, 0, 0.5],
 2064    "8596": [-0.13313, 0.36687, 0, 0, 1.0],
 2065    "8597": [0.25, 0.75, 0, 0, 0.5],
 2066    "8598": [0.19444, 0.69444, 0, 0, 1.0],
 2067    "8599": [0.19444, 0.69444, 0, 0, 1.0],
 2068    "8600": [0.19444, 0.69444, 0, 0, 1.0],
 2069    "8601": [0.19444, 0.69444, 0, 0, 1.0],
 2070    "8614": [0.011, 0.511, 0, 0, 1.0],
 2071    "8617": [0.011, 0.511, 0, 0, 1.126],
 2072    "8618": [0.011, 0.511, 0, 0, 1.126],
 2073    "8636": [-0.13313, 0.36687, 0, 0, 1.0],
 2074    "8637": [-0.13313, 0.36687, 0, 0, 1.0],
 2075    "8640": [-0.13313, 0.36687, 0, 0, 1.0],
 2076    "8641": [-0.13313, 0.36687, 0, 0, 1.0],
 2077    "8652": [0.011, 0.671, 0, 0, 1.0],
 2078    "8656": [-0.13313, 0.36687, 0, 0, 1.0],
 2079    "8657": [0.19444, 0.69444, 0, 0, 0.61111],
 2080    "8658": [-0.13313, 0.36687, 0, 0, 1.0],
 2081    "8659": [0.19444, 0.69444, 0, 0, 0.61111],
 2082    "8660": [-0.13313, 0.36687, 0, 0, 1.0],
 2083    "8661": [0.25, 0.75, 0, 0, 0.61111],
 2084    "8704": [0, 0.69444, 0, 0, 0.55556],
 2085    "8706": [0, 0.69444, 0.05556, 0.08334, 0.5309],
 2086    "8707": [0, 0.69444, 0, 0, 0.55556],
 2087    "8709": [0.05556, 0.75, 0, 0, 0.5],
 2088    "8711": [0, 0.68333, 0, 0, 0.83334],
 2089    "8712": [0.0391, 0.5391, 0, 0, 0.66667],
 2090    "8715": [0.0391, 0.5391, 0, 0, 0.66667],
 2091    "8722": [0.08333, 0.58333, 0, 0, 0.77778],
 2092    "8723": [0.08333, 0.58333, 0, 0, 0.77778],
 2093    "8725": [0.25, 0.75, 0, 0, 0.5],
 2094    "8726": [0.25, 0.75, 0, 0, 0.5],
 2095    "8727": [-0.03472, 0.46528, 0, 0, 0.5],
 2096    "8728": [-0.05555, 0.44445, 0, 0, 0.5],
 2097    "8729": [-0.05555, 0.44445, 0, 0, 0.5],
 2098    "8730": [0.2, 0.8, 0, 0, 0.83334],
 2099    "8733": [0, 0.43056, 0, 0, 0.77778],
 2100    "8734": [0, 0.43056, 0, 0, 1.0],
 2101    "8736": [0, 0.69224, 0, 0, 0.72222],
 2102    "8739": [0.25, 0.75, 0, 0, 0.27778],
 2103    "8741": [0.25, 0.75, 0, 0, 0.5],
 2104    "8743": [0, 0.55556, 0, 0, 0.66667],
 2105    "8744": [0, 0.55556, 0, 0, 0.66667],
 2106    "8745": [0, 0.55556, 0, 0, 0.66667],
 2107    "8746": [0, 0.55556, 0, 0, 0.66667],
 2108    "8747": [0.19444, 0.69444, 0.11111, 0, 0.41667],
 2109    "8764": [-0.13313, 0.36687, 0, 0, 0.77778],
 2110    "8768": [0.19444, 0.69444, 0, 0, 0.27778],
 2111    "8771": [-0.03625, 0.46375, 0, 0, 0.77778],
 2112    "8773": [-0.022, 0.589, 0, 0, 0.778],
 2113    "8776": [-0.01688, 0.48312, 0, 0, 0.77778],
 2114    "8781": [-0.03625, 0.46375, 0, 0, 0.77778],
 2115    "8784": [-0.133, 0.673, 0, 0, 0.778],
 2116    "8801": [-0.03625, 0.46375, 0, 0, 0.77778],
 2117    "8804": [0.13597, 0.63597, 0, 0, 0.77778],
 2118    "8805": [0.13597, 0.63597, 0, 0, 0.77778],
 2119    "8810": [0.0391, 0.5391, 0, 0, 1.0],
 2120    "8811": [0.0391, 0.5391, 0, 0, 1.0],
 2121    "8826": [0.0391, 0.5391, 0, 0, 0.77778],
 2122    "8827": [0.0391, 0.5391, 0, 0, 0.77778],
 2123    "8834": [0.0391, 0.5391, 0, 0, 0.77778],
 2124    "8835": [0.0391, 0.5391, 0, 0, 0.77778],
 2125    "8838": [0.13597, 0.63597, 0, 0, 0.77778],
 2126    "8839": [0.13597, 0.63597, 0, 0, 0.77778],
 2127    "8846": [0, 0.55556, 0, 0, 0.66667],
 2128    "8849": [0.13597, 0.63597, 0, 0, 0.77778],
 2129    "8850": [0.13597, 0.63597, 0, 0, 0.77778],
 2130    "8851": [0, 0.55556, 0, 0, 0.66667],
 2131    "8852": [0, 0.55556, 0, 0, 0.66667],
 2132    "8853": [0.08333, 0.58333, 0, 0, 0.77778],
 2133    "8854": [0.08333, 0.58333, 0, 0, 0.77778],
 2134    "8855": [0.08333, 0.58333, 0, 0, 0.77778],
 2135    "8856": [0.08333, 0.58333, 0, 0, 0.77778],
 2136    "8857": [0.08333, 0.58333, 0, 0, 0.77778],
 2137    "8866": [0, 0.69444, 0, 0, 0.61111],
 2138    "8867": [0, 0.69444, 0, 0, 0.61111],
 2139    "8868": [0, 0.69444, 0, 0, 0.77778],
 2140    "8869": [0, 0.69444, 0, 0, 0.77778],
 2141    "8872": [0.249, 0.75, 0, 0, 0.867],
 2142    "8900": [-0.05555, 0.44445, 0, 0, 0.5],
 2143    "8901": [-0.05555, 0.44445, 0, 0, 0.27778],
 2144    "8902": [-0.03472, 0.46528, 0, 0, 0.5],
 2145    "8904": [0.005, 0.505, 0, 0, 0.9],
 2146    "8942": [0.03, 0.903, 0, 0, 0.278],
 2147    "8943": [-0.19, 0.313, 0, 0, 1.172],
 2148    "8945": [-0.1, 0.823, 0, 0, 1.282],
 2149    "8968": [0.25, 0.75, 0, 0, 0.44445],
 2150    "8969": [0.25, 0.75, 0, 0, 0.44445],
 2151    "8970": [0.25, 0.75, 0, 0, 0.44445],
 2152    "8971": [0.25, 0.75, 0, 0, 0.44445],
 2153    "8994": [-0.14236, 0.35764, 0, 0, 1.0],
 2154    "8995": [-0.14236, 0.35764, 0, 0, 1.0],
 2155    "9136": [0.244, 0.744, 0, 0, 0.412],
 2156    "9137": [0.244, 0.745, 0, 0, 0.412],
 2157    "9651": [0.19444, 0.69444, 0, 0, 0.88889],
 2158    "9657": [-0.03472, 0.46528, 0, 0, 0.5],
 2159    "9661": [0.19444, 0.69444, 0, 0, 0.88889],
 2160    "9667": [-0.03472, 0.46528, 0, 0, 0.5],
 2161    "9711": [0.19444, 0.69444, 0, 0, 1.0],
 2162    "9824": [0.12963, 0.69444, 0, 0, 0.77778],
 2163    "9825": [0.12963, 0.69444, 0, 0, 0.77778],
 2164    "9826": [0.12963, 0.69444, 0, 0, 0.77778],
 2165    "9827": [0.12963, 0.69444, 0, 0, 0.77778],
 2166    "9837": [0, 0.75, 0, 0, 0.38889],
 2167    "9838": [0.19444, 0.69444, 0, 0, 0.38889],
 2168    "9839": [0.19444, 0.69444, 0, 0, 0.38889],
 2169    "10216": [0.25, 0.75, 0, 0, 0.38889],
 2170    "10217": [0.25, 0.75, 0, 0, 0.38889],
 2171    "10222": [0.244, 0.744, 0, 0, 0.412],
 2172    "10223": [0.244, 0.745, 0, 0, 0.412],
 2173    "10229": [0.011, 0.511, 0, 0, 1.609],
 2174    "10230": [0.011, 0.511, 0, 0, 1.638],
 2175    "10231": [0.011, 0.511, 0, 0, 1.859],
 2176    "10232": [0.024, 0.525, 0, 0, 1.609],
 2177    "10233": [0.024, 0.525, 0, 0, 1.638],
 2178    "10234": [0.024, 0.525, 0, 0, 1.858],
 2179    "10236": [0.011, 0.511, 0, 0, 1.638],
 2180    "10815": [0, 0.68333, 0, 0, 0.75],
 2181    "10927": [0.13597, 0.63597, 0, 0, 0.77778],
 2182    "10928": [0.13597, 0.63597, 0, 0, 0.77778],
 2183    "57376": [0.19444, 0.69444, 0, 0, 0]
 2184  },
 2185  "Math-BoldItalic": {
 2186    "32": [0, 0, 0, 0, 0.25],
 2187    "48": [0, 0.44444, 0, 0, 0.575],
 2188    "49": [0, 0.44444, 0, 0, 0.575],
 2189    "50": [0, 0.44444, 0, 0, 0.575],
 2190    "51": [0.19444, 0.44444, 0, 0, 0.575],
 2191    "52": [0.19444, 0.44444, 0, 0, 0.575],
 2192    "53": [0.19444, 0.44444, 0, 0, 0.575],
 2193    "54": [0, 0.64444, 0, 0, 0.575],
 2194    "55": [0.19444, 0.44444, 0, 0, 0.575],
 2195    "56": [0, 0.64444, 0, 0, 0.575],
 2196    "57": [0.19444, 0.44444, 0, 0, 0.575],
 2197    "65": [0, 0.68611, 0, 0, 0.86944],
 2198    "66": [0, 0.68611, 0.04835, 0, 0.8664],
 2199    "67": [0, 0.68611, 0.06979, 0, 0.81694],
 2200    "68": [0, 0.68611, 0.03194, 0, 0.93812],
 2201    "69": [0, 0.68611, 0.05451, 0, 0.81007],
 2202    "70": [0, 0.68611, 0.15972, 0, 0.68889],
 2203    "71": [0, 0.68611, 0, 0, 0.88673],
 2204    "72": [0, 0.68611, 0.08229, 0, 0.98229],
 2205    "73": [0, 0.68611, 0.07778, 0, 0.51111],
 2206    "74": [0, 0.68611, 0.10069, 0, 0.63125],
 2207    "75": [0, 0.68611, 0.06979, 0, 0.97118],
 2208    "76": [0, 0.68611, 0, 0, 0.75555],
 2209    "77": [0, 0.68611, 0.11424, 0, 1.14201],
 2210    "78": [0, 0.68611, 0.11424, 0, 0.95034],
 2211    "79": [0, 0.68611, 0.03194, 0, 0.83666],
 2212    "80": [0, 0.68611, 0.15972, 0, 0.72309],
 2213    "81": [0.19444, 0.68611, 0, 0, 0.86861],
 2214    "82": [0, 0.68611, 0.00421, 0, 0.87235],
 2215    "83": [0, 0.68611, 0.05382, 0, 0.69271],
 2216    "84": [0, 0.68611, 0.15972, 0, 0.63663],
 2217    "85": [0, 0.68611, 0.11424, 0, 0.80027],
 2218    "86": [0, 0.68611, 0.25555, 0, 0.67778],
 2219    "87": [0, 0.68611, 0.15972, 0, 1.09305],
 2220    "88": [0, 0.68611, 0.07778, 0, 0.94722],
 2221    "89": [0, 0.68611, 0.25555, 0, 0.67458],
 2222    "90": [0, 0.68611, 0.06979, 0, 0.77257],
 2223    "97": [0, 0.44444, 0, 0, 0.63287],
 2224    "98": [0, 0.69444, 0, 0, 0.52083],
 2225    "99": [0, 0.44444, 0, 0, 0.51342],
 2226    "100": [0, 0.69444, 0, 0, 0.60972],
 2227    "101": [0, 0.44444, 0, 0, 0.55361],
 2228    "102": [0.19444, 0.69444, 0.11042, 0, 0.56806],
 2229    "103": [0.19444, 0.44444, 0.03704, 0, 0.5449],
 2230    "104": [0, 0.69444, 0, 0, 0.66759],
 2231    "105": [0, 0.69326, 0, 0, 0.4048],
 2232    "106": [0.19444, 0.69326, 0.0622, 0, 0.47083],
 2233    "107": [0, 0.69444, 0.01852, 0, 0.6037],
 2234    "108": [0, 0.69444, 0.0088, 0, 0.34815],
 2235    "109": [0, 0.44444, 0, 0, 1.0324],
 2236    "110": [0, 0.44444, 0, 0, 0.71296],
 2237    "111": [0, 0.44444, 0, 0, 0.58472],
 2238    "112": [0.19444, 0.44444, 0, 0, 0.60092],
 2239    "113": [0.19444, 0.44444, 0.03704, 0, 0.54213],
 2240    "114": [0, 0.44444, 0.03194, 0, 0.5287],
 2241    "115": [0, 0.44444, 0, 0, 0.53125],
 2242    "116": [0, 0.63492, 0, 0, 0.41528],
 2243    "117": [0, 0.44444, 0, 0, 0.68102],
 2244    "118": [0, 0.44444, 0.03704, 0, 0.56666],
 2245    "119": [0, 0.44444, 0.02778, 0, 0.83148],
 2246    "120": [0, 0.44444, 0, 0, 0.65903],
 2247    "121": [0.19444, 0.44444, 0.03704, 0, 0.59028],
 2248    "122": [0, 0.44444, 0.04213, 0, 0.55509],
 2249    "160": [0, 0, 0, 0, 0.25],
 2250    "915": [0, 0.68611, 0.15972, 0, 0.65694],
 2251    "916": [0, 0.68611, 0, 0, 0.95833],
 2252    "920": [0, 0.68611, 0.03194, 0, 0.86722],
 2253    "923": [0, 0.68611, 0, 0, 0.80555],
 2254    "926": [0, 0.68611, 0.07458, 0, 0.84125],
 2255    "928": [0, 0.68611, 0.08229, 0, 0.98229],
 2256    "931": [0, 0.68611, 0.05451, 0, 0.88507],
 2257    "933": [0, 0.68611, 0.15972, 0, 0.67083],
 2258    "934": [0, 0.68611, 0, 0, 0.76666],
 2259    "936": [0, 0.68611, 0.11653, 0, 0.71402],
 2260    "937": [0, 0.68611, 0.04835, 0, 0.8789],
 2261    "945": [0, 0.44444, 0, 0, 0.76064],
 2262    "946": [0.19444, 0.69444, 0.03403, 0, 0.65972],
 2263    "947": [0.19444, 0.44444, 0.06389, 0, 0.59003],
 2264    "948": [0, 0.69444, 0.03819, 0, 0.52222],
 2265    "949": [0, 0.44444, 0, 0, 0.52882],
 2266    "950": [0.19444, 0.69444, 0.06215, 0, 0.50833],
 2267    "951": [0.19444, 0.44444, 0.03704, 0, 0.6],
 2268    "952": [0, 0.69444, 0.03194, 0, 0.5618],
 2269    "953": [0, 0.44444, 0, 0, 0.41204],
 2270    "954": [0, 0.44444, 0, 0, 0.66759],
 2271    "955": [0, 0.69444, 0, 0, 0.67083],
 2272    "956": [0.19444, 0.44444, 0, 0, 0.70787],
 2273    "957": [0, 0.44444, 0.06898, 0, 0.57685],
 2274    "958": [0.19444, 0.69444, 0.03021, 0, 0.50833],
 2275    "959": [0, 0.44444, 0, 0, 0.58472],
 2276    "960": [0, 0.44444, 0.03704, 0, 0.68241],
 2277    "961": [0.19444, 0.44444, 0, 0, 0.6118],
 2278    "962": [0.09722, 0.44444, 0.07917, 0, 0.42361],
 2279    "963": [0, 0.44444, 0.03704, 0, 0.68588],
 2280    "964": [0, 0.44444, 0.13472, 0, 0.52083],
 2281    "965": [0, 0.44444, 0.03704, 0, 0.63055],
 2282    "966": [0.19444, 0.44444, 0, 0, 0.74722],
 2283    "967": [0.19444, 0.44444, 0, 0, 0.71805],
 2284    "968": [0.19444, 0.69444, 0.03704, 0, 0.75833],
 2285    "969": [0, 0.44444, 0.03704, 0, 0.71782],
 2286    "977": [0, 0.69444, 0, 0, 0.69155],
 2287    "981": [0.19444, 0.69444, 0, 0, 0.7125],
 2288    "982": [0, 0.44444, 0.03194, 0, 0.975],
 2289    "1009": [0.19444, 0.44444, 0, 0, 0.6118],
 2290    "1013": [0, 0.44444, 0, 0, 0.48333],
 2291    "57649": [0, 0.44444, 0, 0, 0.39352],
 2292    "57911": [0.19444, 0.44444, 0, 0, 0.43889]
 2293  },
 2294  "Math-Italic": {
 2295    "32": [0, 0, 0, 0, 0.25],
 2296    "48": [0, 0.43056, 0, 0, 0.5],
 2297    "49": [0, 0.43056, 0, 0, 0.5],
 2298    "50": [0, 0.43056, 0, 0, 0.5],
 2299    "51": [0.19444, 0.43056, 0, 0, 0.5],
 2300    "52": [0.19444, 0.43056, 0, 0, 0.5],
 2301    "53": [0.19444, 0.43056, 0, 0, 0.5],
 2302    "54": [0, 0.64444, 0, 0, 0.5],
 2303    "55": [0.19444, 0.43056, 0, 0, 0.5],
 2304    "56": [0, 0.64444, 0, 0, 0.5],
 2305    "57": [0.19444, 0.43056, 0, 0, 0.5],
 2306    "65": [0, 0.68333, 0, 0.13889, 0.75],
 2307    "66": [0, 0.68333, 0.05017, 0.08334, 0.75851],
 2308    "67": [0, 0.68333, 0.07153, 0.08334, 0.71472],
 2309    "68": [0, 0.68333, 0.02778, 0.05556, 0.82792],
 2310    "69": [0, 0.68333, 0.05764, 0.08334, 0.7382],
 2311    "70": [0, 0.68333, 0.13889, 0.08334, 0.64306],
 2312    "71": [0, 0.68333, 0, 0.08334, 0.78625],
 2313    "72": [0, 0.68333, 0.08125, 0.05556, 0.83125],
 2314    "73": [0, 0.68333, 0.07847, 0.11111, 0.43958],
 2315    "74": [0, 0.68333, 0.09618, 0.16667, 0.55451],
 2316    "75": [0, 0.68333, 0.07153, 0.05556, 0.84931],
 2317    "76": [0, 0.68333, 0, 0.02778, 0.68056],
 2318    "77": [0, 0.68333, 0.10903, 0.08334, 0.97014],
 2319    "78": [0, 0.68333, 0.10903, 0.08334, 0.80347],
 2320    "79": [0, 0.68333, 0.02778, 0.08334, 0.76278],
 2321    "80": [0, 0.68333, 0.13889, 0.08334, 0.64201],
 2322    "81": [0.19444, 0.68333, 0, 0.08334, 0.79056],
 2323    "82": [0, 0.68333, 0.00773, 0.08334, 0.75929],
 2324    "83": [0, 0.68333, 0.05764, 0.08334, 0.6132],
 2325    "84": [0, 0.68333, 0.13889, 0.08334, 0.58438],
 2326    "85": [0, 0.68333, 0.10903, 0.02778, 0.68278],
 2327    "86": [0, 0.68333, 0.22222, 0, 0.58333],
 2328    "87": [0, 0.68333, 0.13889, 0, 0.94445],
 2329    "88": [0, 0.68333, 0.07847, 0.08334, 0.82847],
 2330    "89": [0, 0.68333, 0.22222, 0, 0.58056],
 2331    "90": [0, 0.68333, 0.07153, 0.08334, 0.68264],
 2332    "97": [0, 0.43056, 0, 0, 0.52859],
 2333    "98": [0, 0.69444, 0, 0, 0.42917],
 2334    "99": [0, 0.43056, 0, 0.05556, 0.43276],
 2335    "100": [0, 0.69444, 0, 0.16667, 0.52049],
 2336    "101": [0, 0.43056, 0, 0.05556, 0.46563],
 2337    "102": [0.19444, 0.69444, 0.10764, 0.16667, 0.48959],
 2338    "103": [0.19444, 0.43056, 0.03588, 0.02778, 0.47697],
 2339    "104": [0, 0.69444, 0, 0, 0.57616],
 2340    "105": [0, 0.65952, 0, 0, 0.34451],
 2341    "106": [0.19444, 0.65952, 0.05724, 0, 0.41181],
 2342    "107": [0, 0.69444, 0.03148, 0, 0.5206],
 2343    "108": [0, 0.69444, 0.01968, 0.08334, 0.29838],
 2344    "109": [0, 0.43056, 0, 0, 0.87801],
 2345    "110": [0, 0.43056, 0, 0, 0.60023],
 2346    "111": [0, 0.43056, 0, 0.05556, 0.48472],
 2347    "112": [0.19444, 0.43056, 0, 0.08334, 0.50313],
 2348    "113": [0.19444, 0.43056, 0.03588, 0.08334, 0.44641],
 2349    "114": [0, 0.43056, 0.02778, 0.05556, 0.45116],
 2350    "115": [0, 0.43056, 0, 0.05556, 0.46875],
 2351    "116": [0, 0.61508, 0, 0.08334, 0.36111],
 2352    "117": [0, 0.43056, 0, 0.02778, 0.57246],
 2353    "118": [0, 0.43056, 0.03588, 0.02778, 0.48472],
 2354    "119": [0, 0.43056, 0.02691, 0.08334, 0.71592],
 2355    "120": [0, 0.43056, 0, 0.02778, 0.57153],
 2356    "121": [0.19444, 0.43056, 0.03588, 0.05556, 0.49028],
 2357    "122": [0, 0.43056, 0.04398, 0.05556, 0.46505],
 2358    "160": [0, 0, 0, 0, 0.25],
 2359    "915": [0, 0.68333, 0.13889, 0.08334, 0.61528],
 2360    "916": [0, 0.68333, 0, 0.16667, 0.83334],
 2361    "920": [0, 0.68333, 0.02778, 0.08334, 0.76278],
 2362    "923": [0, 0.68333, 0, 0.16667, 0.69445],
 2363    "926": [0, 0.68333, 0.07569, 0.08334, 0.74236],
 2364    "928": [0, 0.68333, 0.08125, 0.05556, 0.83125],
 2365    "931": [0, 0.68333, 0.05764, 0.08334, 0.77986],
 2366    "933": [0, 0.68333, 0.13889, 0.05556, 0.58333],
 2367    "934": [0, 0.68333, 0, 0.08334, 0.66667],
 2368    "936": [0, 0.68333, 0.11, 0.05556, 0.61222],
 2369    "937": [0, 0.68333, 0.05017, 0.08334, 0.7724],
 2370    "945": [0, 0.43056, 0.0037, 0.02778, 0.6397],
 2371    "946": [0.19444, 0.69444, 0.05278, 0.08334, 0.56563],
 2372    "947": [0.19444, 0.43056, 0.05556, 0, 0.51773],
 2373    "948": [0, 0.69444, 0.03785, 0.05556, 0.44444],
 2374    "949": [0, 0.43056, 0, 0.08334, 0.46632],
 2375    "950": [0.19444, 0.69444, 0.07378, 0.08334, 0.4375],
 2376    "951": [0.19444, 0.43056, 0.03588, 0.05556, 0.49653],
 2377    "952": [0, 0.69444, 0.02778, 0.08334, 0.46944],
 2378    "953": [0, 0.43056, 0, 0.05556, 0.35394],
 2379    "954": [0, 0.43056, 0, 0, 0.57616],
 2380    "955": [0, 0.69444, 0, 0, 0.58334],
 2381    "956": [0.19444, 0.43056, 0, 0.02778, 0.60255],
 2382    "957": [0, 0.43056, 0.06366, 0.02778, 0.49398],
 2383    "958": [0.19444, 0.69444, 0.04601, 0.11111, 0.4375],
 2384    "959": [0, 0.43056, 0, 0.05556, 0.48472],
 2385    "960": [0, 0.43056, 0.03588, 0, 0.57003],
 2386    "961": [0.19444, 0.43056, 0, 0.08334, 0.51702],
 2387    "962": [0.09722, 0.43056, 0.07986, 0.08334, 0.36285],
 2388    "963": [0, 0.43056, 0.03588, 0, 0.57141],
 2389    "964": [0, 0.43056, 0.1132, 0.02778, 0.43715],
 2390    "965": [0, 0.43056, 0.03588, 0.02778, 0.54028],
 2391    "966": [0.19444, 0.43056, 0, 0.08334, 0.65417],
 2392    "967": [0.19444, 0.43056, 0, 0.05556, 0.62569],
 2393    "968": [0.19444, 0.69444, 0.03588, 0.11111, 0.65139],
 2394    "969": [0, 0.43056, 0.03588, 0, 0.62245],
 2395    "977": [0, 0.69444, 0, 0.08334, 0.59144],
 2396    "981": [0.19444, 0.69444, 0, 0.08334, 0.59583],
 2397    "982": [0, 0.43056, 0.02778, 0, 0.82813],
 2398    "1009": [0.19444, 0.43056, 0, 0.08334, 0.51702],
 2399    "1013": [0, 0.43056, 0, 0.05556, 0.4059],
 2400    "57649": [0, 0.43056, 0, 0.02778, 0.32246],
 2401    "57911": [0.19444, 0.43056, 0, 0.08334, 0.38403]
 2402  },
 2403  "SansSerif-Bold": {
 2404    "32": [0, 0, 0, 0, 0.25],
 2405    "33": [0, 0.69444, 0, 0, 0.36667],
 2406    "34": [0, 0.69444, 0, 0, 0.55834],
 2407    "35": [0.19444, 0.69444, 0, 0, 0.91667],
 2408    "36": [0.05556, 0.75, 0, 0, 0.55],
 2409    "37": [0.05556, 0.75, 0, 0, 1.02912],
 2410    "38": [0, 0.69444, 0, 0, 0.83056],
 2411    "39": [0, 0.69444, 0, 0, 0.30556],
 2412    "40": [0.25, 0.75, 0, 0, 0.42778],
 2413    "41": [0.25, 0.75, 0, 0, 0.42778],
 2414    "42": [0, 0.75, 0, 0, 0.55],
 2415    "43": [0.11667, 0.61667, 0, 0, 0.85556],
 2416    "44": [0.10556, 0.13056, 0, 0, 0.30556],
 2417    "45": [0, 0.45833, 0, 0, 0.36667],
 2418    "46": [0, 0.13056, 0, 0, 0.30556],
 2419    "47": [0.25, 0.75, 0, 0, 0.55],
 2420    "48": [0, 0.69444, 0, 0, 0.55],
 2421    "49": [0, 0.69444, 0, 0, 0.55],
 2422    "50": [0, 0.69444, 0, 0, 0.55],
 2423    "51": [0, 0.69444, 0, 0, 0.55],
 2424    "52": [0, 0.69444, 0, 0, 0.55],
 2425    "53": [0, 0.69444, 0, 0, 0.55],
 2426    "54": [0, 0.69444, 0, 0, 0.55],
 2427    "55": [0, 0.69444, 0, 0, 0.55],
 2428    "56": [0, 0.69444, 0, 0, 0.55],
 2429    "57": [0, 0.69444, 0, 0, 0.55],
 2430    "58": [0, 0.45833, 0, 0, 0.30556],
 2431    "59": [0.10556, 0.45833, 0, 0, 0.30556],
 2432    "61": [-0.09375, 0.40625, 0, 0, 0.85556],
 2433    "63": [0, 0.69444, 0, 0, 0.51945],
 2434    "64": [0, 0.69444, 0, 0, 0.73334],
 2435    "65": [0, 0.69444, 0, 0, 0.73334],
 2436    "66": [0, 0.69444, 0, 0, 0.73334],
 2437    "67": [0, 0.69444, 0, 0, 0.70278],
 2438    "68": [0, 0.69444, 0, 0, 0.79445],
 2439    "69": [0, 0.69444, 0, 0, 0.64167],
 2440    "70": [0, 0.69444, 0, 0, 0.61111],
 2441    "71": [0, 0.69444, 0, 0, 0.73334],
 2442    "72": [0, 0.69444, 0, 0, 0.79445],
 2443    "73": [0, 0.69444, 0, 0, 0.33056],
 2444    "74": [0, 0.69444, 0, 0, 0.51945],
 2445    "75": [0, 0.69444, 0, 0, 0.76389],
 2446    "76": [0, 0.69444, 0, 0, 0.58056],
 2447    "77": [0, 0.69444, 0, 0, 0.97778],
 2448    "78": [0, 0.69444, 0, 0, 0.79445],
 2449    "79": [0, 0.69444, 0, 0, 0.79445],
 2450    "80": [0, 0.69444, 0, 0, 0.70278],
 2451    "81": [0.10556, 0.69444, 0, 0, 0.79445],
 2452    "82": [0, 0.69444, 0, 0, 0.70278],
 2453    "83": [0, 0.69444, 0, 0, 0.61111],
 2454    "84": [0, 0.69444, 0, 0, 0.73334],
 2455    "85": [0, 0.69444, 0, 0, 0.76389],
 2456    "86": [0, 0.69444, 0.01528, 0, 0.73334],
 2457    "87": [0, 0.69444, 0.01528, 0, 1.03889],
 2458    "88": [0, 0.69444, 0, 0, 0.73334],
 2459    "89": [0, 0.69444, 0.0275, 0, 0.73334],
 2460    "90": [0, 0.69444, 0, 0, 0.67223],
 2461    "91": [0.25, 0.75, 0, 0, 0.34306],
 2462    "93": [0.25, 0.75, 0, 0, 0.34306],
 2463    "94": [0, 0.69444, 0, 0, 0.55],
 2464    "95": [0.35, 0.10833, 0.03056, 0, 0.55],
 2465    "97": [0, 0.45833, 0, 0, 0.525],
 2466    "98": [0, 0.69444, 0, 0, 0.56111],
 2467    "99": [0, 0.45833, 0, 0, 0.48889],
 2468    "100": [0, 0.69444, 0, 0, 0.56111],
 2469    "101": [0, 0.45833, 0, 0, 0.51111],
 2470    "102": [0, 0.69444, 0.07639, 0, 0.33611],
 2471    "103": [0.19444, 0.45833, 0.01528, 0, 0.55],
 2472    "104": [0, 0.69444, 0, 0, 0.56111],
 2473    "105": [0, 0.69444, 0, 0, 0.25556],
 2474    "106": [0.19444, 0.69444, 0, 0, 0.28611],
 2475    "107": [0, 0.69444, 0, 0, 0.53056],
 2476    "108": [0, 0.69444, 0, 0, 0.25556],
 2477    "109": [0, 0.45833, 0, 0, 0.86667],
 2478    "110": [0, 0.45833, 0, 0, 0.56111],
 2479    "111": [0, 0.45833, 0, 0, 0.55],
 2480    "112": [0.19444, 0.45833, 0, 0, 0.56111],
 2481    "113": [0.19444, 0.45833, 0, 0, 0.56111],
 2482    "114": [0, 0.45833, 0.01528, 0, 0.37222],
 2483    "115": [0, 0.45833, 0, 0, 0.42167],
 2484    "116": [0, 0.58929, 0, 0, 0.40417],
 2485    "117": [0, 0.45833, 0, 0, 0.56111],
 2486    "118": [0, 0.45833, 0.01528, 0, 0.5],
 2487    "119": [0, 0.45833, 0.01528, 0, 0.74445],
 2488    "120": [0, 0.45833, 0, 0, 0.5],
 2489    "121": [0.19444, 0.45833, 0.01528, 0, 0.5],
 2490    "122": [0, 0.45833, 0, 0, 0.47639],
 2491    "126": [0.35, 0.34444, 0, 0, 0.55],
 2492    "160": [0, 0, 0, 0, 0.25],
 2493    "168": [0, 0.69444, 0, 0, 0.55],
 2494    "176": [0, 0.69444, 0, 0, 0.73334],
 2495    "180": [0, 0.69444, 0, 0, 0.55],
 2496    "184": [0.17014, 0, 0, 0, 0.48889],
 2497    "305": [0, 0.45833, 0, 0, 0.25556],
 2498    "567": [0.19444, 0.45833, 0, 0, 0.28611],
 2499    "710": [0, 0.69444, 0, 0, 0.55],
 2500    "711": [0, 0.63542, 0, 0, 0.55],
 2501    "713": [0, 0.63778, 0, 0, 0.55],
 2502    "728": [0, 0.69444, 0, 0, 0.55],
 2503    "729": [0, 0.69444, 0, 0, 0.30556],
 2504    "730": [0, 0.69444, 0, 0, 0.73334],
 2505    "732": [0, 0.69444, 0, 0, 0.55],
 2506    "733": [0, 0.69444, 0, 0, 0.55],
 2507    "915": [0, 0.69444, 0, 0, 0.58056],
 2508    "916": [0, 0.69444, 0, 0, 0.91667],
 2509    "920": [0, 0.69444, 0, 0, 0.85556],
 2510    "923": [0, 0.69444, 0, 0, 0.67223],
 2511    "926": [0, 0.69444, 0, 0, 0.73334],
 2512    "928": [0, 0.69444, 0, 0, 0.79445],
 2513    "931": [0, 0.69444, 0, 0, 0.79445],
 2514    "933": [0, 0.69444, 0, 0, 0.85556],
 2515    "934": [0, 0.69444, 0, 0, 0.79445],
 2516    "936": [0, 0.69444, 0, 0, 0.85556],
 2517    "937": [0, 0.69444, 0, 0, 0.79445],
 2518    "8211": [0, 0.45833, 0.03056, 0, 0.55],
 2519    "8212": [0, 0.45833, 0.03056, 0, 1.10001],
 2520    "8216": [0, 0.69444, 0, 0, 0.30556],
 2521    "8217": [0, 0.69444, 0, 0, 0.30556],
 2522    "8220": [0, 0.69444, 0, 0, 0.55834],
 2523    "8221": [0, 0.69444, 0, 0, 0.55834]
 2524  },
 2525  "SansSerif-Italic": {
 2526    "32": [0, 0, 0, 0, 0.25],
 2527    "33": [0, 0.69444, 0.05733, 0, 0.31945],
 2528    "34": [0, 0.69444, 0.00316, 0, 0.5],
 2529    "35": [0.19444, 0.69444, 0.05087, 0, 0.83334],
 2530    "36": [0.05556, 0.75, 0.11156, 0, 0.5],
 2531    "37": [0.05556, 0.75, 0.03126, 0, 0.83334],
 2532    "38": [0, 0.69444, 0.03058, 0, 0.75834],
 2533    "39": [0, 0.69444, 0.07816, 0, 0.27778],
 2534    "40": [0.25, 0.75, 0.13164, 0, 0.38889],
 2535    "41": [0.25, 0.75, 0.02536, 0, 0.38889],
 2536    "42": [0, 0.75, 0.11775, 0, 0.5],
 2537    "43": [0.08333, 0.58333, 0.02536, 0, 0.77778],
 2538    "44": [0.125, 0.08333, 0, 0, 0.27778],
 2539    "45": [0, 0.44444, 0.01946, 0, 0.33333],
 2540    "46": [0, 0.08333, 0, 0, 0.27778],
 2541    "47": [0.25, 0.75, 0.13164, 0, 0.5],
 2542    "48": [0, 0.65556, 0.11156, 0, 0.5],
 2543    "49": [0, 0.65556, 0.11156, 0, 0.5],
 2544    "50": [0, 0.65556, 0.11156, 0, 0.5],
 2545    "51": [0, 0.65556, 0.11156, 0, 0.5],
 2546    "52": [0, 0.65556, 0.11156, 0, 0.5],
 2547    "53": [0, 0.65556, 0.11156, 0, 0.5],
 2548    "54": [0, 0.65556, 0.11156, 0, 0.5],
 2549    "55": [0, 0.65556, 0.11156, 0, 0.5],
 2550    "56": [0, 0.65556, 0.11156, 0, 0.5],
 2551    "57": [0, 0.65556, 0.11156, 0, 0.5],
 2552    "58": [0, 0.44444, 0.02502, 0, 0.27778],
 2553    "59": [0.125, 0.44444, 0.02502, 0, 0.27778],
 2554    "61": [-0.13, 0.37, 0.05087, 0, 0.77778],
 2555    "63": [0, 0.69444, 0.11809, 0, 0.47222],
 2556    "64": [0, 0.69444, 0.07555, 0, 0.66667],
 2557    "65": [0, 0.69444, 0, 0, 0.66667],
 2558    "66": [0, 0.69444, 0.08293, 0, 0.66667],
 2559    "67": [0, 0.69444, 0.11983, 0, 0.63889],
 2560    "68": [0, 0.69444, 0.07555, 0, 0.72223],
 2561    "69": [0, 0.69444, 0.11983, 0, 0.59722],
 2562    "70": [0, 0.69444, 0.13372, 0, 0.56945],
 2563    "71": [0, 0.69444, 0.11983, 0, 0.66667],
 2564    "72": [0, 0.69444, 0.08094, 0, 0.70834],
 2565    "73": [0, 0.69444, 0.13372, 0, 0.27778],
 2566    "74": [0, 0.69444, 0.08094, 0, 0.47222],
 2567    "75": [0, 0.69444, 0.11983, 0, 0.69445],
 2568    "76": [0, 0.69444, 0, 0, 0.54167],
 2569    "77": [0, 0.69444, 0.08094, 0, 0.875],
 2570    "78": [0, 0.69444, 0.08094, 0, 0.70834],
 2571    "79": [0, 0.69444, 0.07555, 0, 0.73611],
 2572    "80": [0, 0.69444, 0.08293, 0, 0.63889],
 2573    "81": [0.125, 0.69444, 0.07555, 0, 0.73611],
 2574    "82": [0, 0.69444, 0.08293, 0, 0.64584],
 2575    "83": [0, 0.69444, 0.09205, 0, 0.55556],
 2576    "84": [0, 0.69444, 0.13372, 0, 0.68056],
 2577    "85": [0, 0.69444, 0.08094, 0, 0.6875],
 2578    "86": [0, 0.69444, 0.1615, 0, 0.66667],
 2579    "87": [0, 0.69444, 0.1615, 0, 0.94445],
 2580    "88": [0, 0.69444, 0.13372, 0, 0.66667],
 2581    "89": [0, 0.69444, 0.17261, 0, 0.66667],
 2582    "90": [0, 0.69444, 0.11983, 0, 0.61111],
 2583    "91": [0.25, 0.75, 0.15942, 0, 0.28889],
 2584    "93": [0.25, 0.75, 0.08719, 0, 0.28889],
 2585    "94": [0, 0.69444, 0.0799, 0, 0.5],
 2586    "95": [0.35, 0.09444, 0.08616, 0, 0.5],
 2587    "97": [0, 0.44444, 0.00981, 0, 0.48056],
 2588    "98": [0, 0.69444, 0.03057, 0, 0.51667],
 2589    "99": [0, 0.44444, 0.08336, 0, 0.44445],
 2590    "100": [0, 0.69444, 0.09483, 0, 0.51667],
 2591    "101": [0, 0.44444, 0.06778, 0, 0.44445],
 2592    "102": [0, 0.69444, 0.21705, 0, 0.30556],
 2593    "103": [0.19444, 0.44444, 0.10836, 0, 0.5],
 2594    "104": [0, 0.69444, 0.01778, 0, 0.51667],
 2595    "105": [0, 0.67937, 0.09718, 0, 0.23889],
 2596    "106": [0.19444, 0.67937, 0.09162, 0, 0.26667],
 2597    "107": [0, 0.69444, 0.08336, 0, 0.48889],
 2598    "108": [0, 0.69444, 0.09483, 0, 0.23889],
 2599    "109": [0, 0.44444, 0.01778, 0, 0.79445],
 2600    "110": [0, 0.44444, 0.01778, 0, 0.51667],
 2601    "111": [0, 0.44444, 0.06613, 0, 0.5],
 2602    "112": [0.19444, 0.44444, 0.0389, 0, 0.51667],
 2603    "113": [0.19444, 0.44444, 0.04169, 0, 0.51667],
 2604    "114": [0, 0.44444, 0.10836, 0, 0.34167],
 2605    "115": [0, 0.44444, 0.0778, 0, 0.38333],
 2606    "116": [0, 0.57143, 0.07225, 0, 0.36111],
 2607    "117": [0, 0.44444, 0.04169, 0, 0.51667],
 2608    "118": [0, 0.44444, 0.10836, 0, 0.46111],
 2609    "119": [0, 0.44444, 0.10836, 0, 0.68334],
 2610    "120": [0, 0.44444, 0.09169, 0, 0.46111],
 2611    "121": [0.19444, 0.44444, 0.10836, 0, 0.46111],
 2612    "122": [0, 0.44444, 0.08752, 0, 0.43472],
 2613    "126": [0.35, 0.32659, 0.08826, 0, 0.5],
 2614    "160": [0, 0, 0, 0, 0.25],
 2615    "168": [0, 0.67937, 0.06385, 0, 0.5],
 2616    "176": [0, 0.69444, 0, 0, 0.73752],
 2617    "184": [0.17014, 0, 0, 0, 0.44445],
 2618    "305": [0, 0.44444, 0.04169, 0, 0.23889],
 2619    "567": [0.19444, 0.44444, 0.04169, 0, 0.26667],
 2620    "710": [0, 0.69444, 0.0799, 0, 0.5],
 2621    "711": [0, 0.63194, 0.08432, 0, 0.5],
 2622    "713": [0, 0.60889, 0.08776, 0, 0.5],
 2623    "714": [0, 0.69444, 0.09205, 0, 0.5],
 2624    "715": [0, 0.69444, 0, 0, 0.5],
 2625    "728": [0, 0.69444, 0.09483, 0, 0.5],
 2626    "729": [0, 0.67937, 0.07774, 0, 0.27778],
 2627    "730": [0, 0.69444, 0, 0, 0.73752],
 2628    "732": [0, 0.67659, 0.08826, 0, 0.5],
 2629    "733": [0, 0.69444, 0.09205, 0, 0.5],
 2630    "915": [0, 0.69444, 0.13372, 0, 0.54167],
 2631    "916": [0, 0.69444, 0, 0, 0.83334],
 2632    "920": [0, 0.69444, 0.07555, 0, 0.77778],
 2633    "923": [0, 0.69444, 0, 0, 0.61111],
 2634    "926": [0, 0.69444, 0.12816, 0, 0.66667],
 2635    "928": [0, 0.69444, 0.08094, 0, 0.70834],
 2636    "931": [0, 0.69444, 0.11983, 0, 0.72222],
 2637    "933": [0, 0.69444, 0.09031, 0, 0.77778],
 2638    "934": [0, 0.69444, 0.04603, 0, 0.72222],
 2639    "936": [0, 0.69444, 0.09031, 0, 0.77778],
 2640    "937": [0, 0.69444, 0.08293, 0, 0.72222],
 2641    "8211": [0, 0.44444, 0.08616, 0, 0.5],
 2642    "8212": [0, 0.44444, 0.08616, 0, 1.0],
 2643    "8216": [0, 0.69444, 0.07816, 0, 0.27778],
 2644    "8217": [0, 0.69444, 0.07816, 0, 0.27778],
 2645    "8220": [0, 0.69444, 0.14205, 0, 0.5],
 2646    "8221": [0, 0.69444, 0.00316, 0, 0.5]
 2647  },
 2648  "SansSerif-Regular": {
 2649    "32": [0, 0, 0, 0, 0.25],
 2650    "33": [0, 0.69444, 0, 0, 0.31945],
 2651    "34": [0, 0.69444, 0, 0, 0.5],
 2652    "35": [0.19444, 0.69444, 0, 0, 0.83334],
 2653    "36": [0.05556, 0.75, 0, 0, 0.5],
 2654    "37": [0.05556, 0.75, 0, 0, 0.83334],
 2655    "38": [0, 0.69444, 0, 0, 0.75834],
 2656    "39": [0, 0.69444, 0, 0, 0.27778],
 2657    "40": [0.25, 0.75, 0, 0, 0.38889],
 2658    "41": [0.25, 0.75, 0, 0, 0.38889],
 2659    "42": [0, 0.75, 0, 0, 0.5],
 2660    "43": [0.08333, 0.58333, 0, 0, 0.77778],
 2661    "44": [0.125, 0.08333, 0, 0, 0.27778],
 2662    "45": [0, 0.44444, 0, 0, 0.33333],
 2663    "46": [0, 0.08333, 0, 0, 0.27778],
 2664    "47": [0.25, 0.75, 0, 0, 0.5],
 2665    "48": [0, 0.65556, 0, 0, 0.5],
 2666    "49": [0, 0.65556, 0, 0, 0.5],
 2667    "50": [0, 0.65556, 0, 0, 0.5],
 2668    "51": [0, 0.65556, 0, 0, 0.5],
 2669    "52": [0, 0.65556, 0, 0, 0.5],
 2670    "53": [0, 0.65556, 0, 0, 0.5],
 2671    "54": [0, 0.65556, 0, 0, 0.5],
 2672    "55": [0, 0.65556, 0, 0, 0.5],
 2673    "56": [0, 0.65556, 0, 0, 0.5],
 2674    "57": [0, 0.65556, 0, 0, 0.5],
 2675    "58": [0, 0.44444, 0, 0, 0.27778],
 2676    "59": [0.125, 0.44444, 0, 0, 0.27778],
 2677    "61": [-0.13, 0.37, 0, 0, 0.77778],
 2678    "63": [0, 0.69444, 0, 0, 0.47222],
 2679    "64": [0, 0.69444, 0, 0, 0.66667],
 2680    "65": [0, 0.69444, 0, 0, 0.66667],
 2681    "66": [0, 0.69444, 0, 0, 0.66667],
 2682    "67": [0, 0.69444, 0, 0, 0.63889],
 2683    "68": [0, 0.69444, 0, 0, 0.72223],
 2684    "69": [0, 0.69444, 0, 0, 0.59722],
 2685    "70": [0, 0.69444, 0, 0, 0.56945],
 2686    "71": [0, 0.69444, 0, 0, 0.66667],
 2687    "72": [0, 0.69444, 0, 0, 0.70834],
 2688    "73": [0, 0.69444, 0, 0, 0.27778],
 2689    "74": [0, 0.69444, 0, 0, 0.47222],
 2690    "75": [0, 0.69444, 0, 0, 0.69445],
 2691    "76": [0, 0.69444, 0, 0, 0.54167],
 2692    "77": [0, 0.69444, 0, 0, 0.875],
 2693    "78": [0, 0.69444, 0, 0, 0.70834],
 2694    "79": [0, 0.69444, 0, 0, 0.73611],
 2695    "80": [0, 0.69444, 0, 0, 0.63889],
 2696    "81": [0.125, 0.69444, 0, 0, 0.73611],
 2697    "82": [0, 0.69444, 0, 0, 0.64584],
 2698    "83": [0, 0.69444, 0, 0, 0.55556],
 2699    "84": [0, 0.69444, 0, 0, 0.68056],
 2700    "85": [0, 0.69444, 0, 0, 0.6875],
 2701    "86": [0, 0.69444, 0.01389, 0, 0.66667],
 2702    "87": [0, 0.69444, 0.01389, 0, 0.94445],
 2703    "88": [0, 0.69444, 0, 0, 0.66667],
 2704    "89": [0, 0.69444, 0.025, 0, 0.66667],
 2705    "90": [0, 0.69444, 0, 0, 0.61111],
 2706    "91": [0.25, 0.75, 0, 0, 0.28889],
 2707    "93": [0.25, 0.75, 0, 0, 0.28889],
 2708    "94": [0, 0.69444, 0, 0, 0.5],
 2709    "95": [0.35, 0.09444, 0.02778, 0, 0.5],
 2710    "97": [0, 0.44444, 0, 0, 0.48056],
 2711    "98": [0, 0.69444, 0, 0, 0.51667],
 2712    "99": [0, 0.44444, 0, 0, 0.44445],
 2713    "100": [0, 0.69444, 0, 0, 0.51667],
 2714    "101": [0, 0.44444, 0, 0, 0.44445],
 2715    "102": [0, 0.69444, 0.06944, 0, 0.30556],
 2716    "103": [0.19444, 0.44444, 0.01389, 0, 0.5],
 2717    "104": [0, 0.69444, 0, 0, 0.51667],
 2718    "105": [0, 0.67937, 0, 0, 0.23889],
 2719    "106": [0.19444, 0.67937, 0, 0, 0.26667],
 2720    "107": [0, 0.69444, 0, 0, 0.48889],
 2721    "108": [0, 0.69444, 0, 0, 0.23889],
 2722    "109": [0, 0.44444, 0, 0, 0.79445],
 2723    "110": [0, 0.44444, 0, 0, 0.51667],
 2724    "111": [0, 0.44444, 0, 0, 0.5],
 2725    "112": [0.19444, 0.44444, 0, 0, 0.51667],
 2726    "113": [0.19444, 0.44444, 0, 0, 0.51667],
 2727    "114": [0, 0.44444, 0.01389, 0, 0.34167],
 2728    "115": [0, 0.44444, 0, 0, 0.38333],
 2729    "116": [0, 0.57143, 0, 0, 0.36111],
 2730    "117": [0, 0.44444, 0, 0, 0.51667],
 2731    "118": [0, 0.44444, 0.01389, 0, 0.46111],
 2732    "119": [0, 0.44444, 0.01389, 0, 0.68334],
 2733    "120": [0, 0.44444, 0, 0, 0.46111],
 2734    "121": [0.19444, 0.44444, 0.01389, 0, 0.46111],
 2735    "122": [0, 0.44444, 0, 0, 0.43472],
 2736    "126": [0.35, 0.32659, 0, 0, 0.5],
 2737    "160": [0, 0, 0, 0, 0.25],
 2738    "168": [0, 0.67937, 0, 0, 0.5],
 2739    "176": [0, 0.69444, 0, 0, 0.66667],
 2740    "184": [0.17014, 0, 0, 0, 0.44445],
 2741    "305": [0, 0.44444, 0, 0, 0.23889],
 2742    "567": [0.19444, 0.44444, 0, 0, 0.26667],
 2743    "710": [0, 0.69444, 0, 0, 0.5],
 2744    "711": [0, 0.63194, 0, 0, 0.5],
 2745    "713": [0, 0.60889, 0, 0, 0.5],
 2746    "714": [0, 0.69444, 0, 0, 0.5],
 2747    "715": [0, 0.69444, 0, 0, 0.5],
 2748    "728": [0, 0.69444, 0, 0, 0.5],
 2749    "729": [0, 0.67937, 0, 0, 0.27778],
 2750    "730": [0, 0.69444, 0, 0, 0.66667],
 2751    "732": [0, 0.67659, 0, 0, 0.5],
 2752    "733": [0, 0.69444, 0, 0, 0.5],
 2753    "915": [0, 0.69444, 0, 0, 0.54167],
 2754    "916": [0, 0.69444, 0, 0, 0.83334],
 2755    "920": [0, 0.69444, 0, 0, 0.77778],
 2756    "923": [0, 0.69444, 0, 0, 0.61111],
 2757    "926": [0, 0.69444, 0, 0, 0.66667],
 2758    "928": [0, 0.69444, 0, 0, 0.70834],
 2759    "931": [0, 0.69444, 0, 0, 0.72222],
 2760    "933": [0, 0.69444, 0, 0, 0.77778],
 2761    "934": [0, 0.69444, 0, 0, 0.72222],
 2762    "936": [0, 0.69444, 0, 0, 0.77778],
 2763    "937": [0, 0.69444, 0, 0, 0.72222],
 2764    "8211": [0, 0.44444, 0.02778, 0, 0.5],
 2765    "8212": [0, 0.44444, 0.02778, 0, 1.0],
 2766    "8216": [0, 0.69444, 0, 0, 0.27778],
 2767    "8217": [0, 0.69444, 0, 0, 0.27778],
 2768    "8220": [0, 0.69444, 0, 0, 0.5],
 2769    "8221": [0, 0.69444, 0, 0, 0.5]
 2770  },
 2771  "Script-Regular": {
 2772    "32": [0, 0, 0, 0, 0.25],
 2773    "65": [0, 0.7, 0.22925, 0, 0.80253],
 2774    "66": [0, 0.7, 0.04087, 0, 0.90757],
 2775    "67": [0, 0.7, 0.1689, 0, 0.66619],
 2776    "68": [0, 0.7, 0.09371, 0, 0.77443],
 2777    "69": [0, 0.7, 0.18583, 0, 0.56162],
 2778    "70": [0, 0.7, 0.13634, 0, 0.89544],
 2779    "71": [0, 0.7, 0.17322, 0, 0.60961],
 2780    "72": [0, 0.7, 0.29694, 0, 0.96919],
 2781    "73": [0, 0.7, 0.19189, 0, 0.80907],
 2782    "74": [0.27778, 0.7, 0.19189, 0, 1.05159],
 2783    "75": [0, 0.7, 0.31259, 0, 0.91364],
 2784    "76": [0, 0.7, 0.19189, 0, 0.87373],
 2785    "77": [0, 0.7, 0.15981, 0, 1.08031],
 2786    "78": [0, 0.7, 0.3525, 0, 0.9015],
 2787    "79": [0, 0.7, 0.08078, 0, 0.73787],
 2788    "80": [0, 0.7, 0.08078, 0, 1.01262],
 2789    "81": [0, 0.7, 0.03305, 0, 0.88282],
 2790    "82": [0, 0.7, 0.06259, 0, 0.85],
 2791    "83": [0, 0.7, 0.19189, 0, 0.86767],
 2792    "84": [0, 0.7, 0.29087, 0, 0.74697],
 2793    "85": [0, 0.7, 0.25815, 0, 0.79996],
 2794    "86": [0, 0.7, 0.27523, 0, 0.62204],
 2795    "87": [0, 0.7, 0.27523, 0, 0.80532],
 2796    "88": [0, 0.7, 0.26006, 0, 0.94445],
 2797    "89": [0, 0.7, 0.2939, 0, 0.70961],
 2798    "90": [0, 0.7, 0.24037, 0, 0.8212],
 2799    "160": [0, 0, 0, 0, 0.25]
 2800  },
 2801  "Size1-Regular": {
 2802    "32": [0, 0, 0, 0, 0.25],
 2803    "40": [0.35001, 0.85, 0, 0, 0.45834],
 2804    "41": [0.35001, 0.85, 0, 0, 0.45834],
 2805    "47": [0.35001, 0.85, 0, 0, 0.57778],
 2806    "91": [0.35001, 0.85, 0, 0, 0.41667],
 2807    "92": [0.35001, 0.85, 0, 0, 0.57778],
 2808    "93": [0.35001, 0.85, 0, 0, 0.41667],
 2809    "123": [0.35001, 0.85, 0, 0, 0.58334],
 2810    "125": [0.35001, 0.85, 0, 0, 0.58334],
 2811    "160": [0, 0, 0, 0, 0.25],
 2812    "710": [0, 0.72222, 0, 0, 0.55556],
 2813    "732": [0, 0.72222, 0, 0, 0.55556],
 2814    "770": [0, 0.72222, 0, 0, 0.55556],
 2815    "771": [0, 0.72222, 0, 0, 0.55556],
 2816    "8214": [-0.00099, 0.601, 0, 0, 0.77778],
 2817    "8593": [1e-05, 0.6, 0, 0, 0.66667],
 2818    "8595": [1e-05, 0.6, 0, 0, 0.66667],
 2819    "8657": [1e-05, 0.6, 0, 0, 0.77778],
 2820    "8659": [1e-05, 0.6, 0, 0, 0.77778],
 2821    "8719": [0.25001, 0.75, 0, 0, 0.94445],
 2822    "8720": [0.25001, 0.75, 0, 0, 0.94445],
 2823    "8721": [0.25001, 0.75, 0, 0, 1.05556],
 2824    "8730": [0.35001, 0.85, 0, 0, 1.0],
 2825    "8739": [-0.00599, 0.606, 0, 0, 0.33333],
 2826    "8741": [-0.00599, 0.606, 0, 0, 0.55556],
 2827    "8747": [0.30612, 0.805, 0.19445, 0, 0.47222],
 2828    "8748": [0.306, 0.805, 0.19445, 0, 0.47222],
 2829    "8749": [0.306, 0.805, 0.19445, 0, 0.47222],
 2830    "8750": [0.30612, 0.805, 0.19445, 0, 0.47222],
 2831    "8896": [0.25001, 0.75, 0, 0, 0.83334],
 2832    "8897": [0.25001, 0.75, 0, 0, 0.83334],
 2833    "8898": [0.25001, 0.75, 0, 0, 0.83334],
 2834    "8899": [0.25001, 0.75, 0, 0, 0.83334],
 2835    "8968": [0.35001, 0.85, 0, 0, 0.47222],
 2836    "8969": [0.35001, 0.85, 0, 0, 0.47222],
 2837    "8970": [0.35001, 0.85, 0, 0, 0.47222],
 2838    "8971": [0.35001, 0.85, 0, 0, 0.47222],
 2839    "9168": [-0.00099, 0.601, 0, 0, 0.66667],
 2840    "10216": [0.35001, 0.85, 0, 0, 0.47222],
 2841    "10217": [0.35001, 0.85, 0, 0, 0.47222],
 2842    "10752": [0.25001, 0.75, 0, 0, 1.11111],
 2843    "10753": [0.25001, 0.75, 0, 0, 1.11111],
 2844    "10754": [0.25001, 0.75, 0, 0, 1.11111],
 2845    "10756": [0.25001, 0.75, 0, 0, 0.83334],
 2846    "10758": [0.25001, 0.75, 0, 0, 0.83334]
 2847  },
 2848  "Size2-Regular": {
 2849    "32": [0, 0, 0, 0, 0.25],
 2850    "40": [0.65002, 1.15, 0, 0, 0.59722],
 2851    "41": [0.65002, 1.15, 0, 0, 0.59722],
 2852    "47": [0.65002, 1.15, 0, 0, 0.81111],
 2853    "91": [0.65002, 1.15, 0, 0, 0.47222],
 2854    "92": [0.65002, 1.15, 0, 0, 0.81111],
 2855    "93": [0.65002, 1.15, 0, 0, 0.47222],
 2856    "123": [0.65002, 1.15, 0, 0, 0.66667],
 2857    "125": [0.65002, 1.15, 0, 0, 0.66667],
 2858    "160": [0, 0, 0, 0, 0.25],
 2859    "710": [0, 0.75, 0, 0, 1.0],
 2860    "732": [0, 0.75, 0, 0, 1.0],
 2861    "770": [0, 0.75, 0, 0, 1.0],
 2862    "771": [0, 0.75, 0, 0, 1.0],
 2863    "8719": [0.55001, 1.05, 0, 0, 1.27778],
 2864    "8720": [0.55001, 1.05, 0, 0, 1.27778],
 2865    "8721": [0.55001, 1.05, 0, 0, 1.44445],
 2866    "8730": [0.65002, 1.15, 0, 0, 1.0],
 2867    "8747": [0.86225, 1.36, 0.44445, 0, 0.55556],
 2868    "8748": [0.862, 1.36, 0.44445, 0, 0.55556],
 2869    "8749": [0.862, 1.36, 0.44445, 0, 0.55556],
 2870    "8750": [0.86225, 1.36, 0.44445, 0, 0.55556],
 2871    "8896": [0.55001, 1.05, 0, 0, 1.11111],
 2872    "8897": [0.55001, 1.05, 0, 0, 1.11111],
 2873    "8898": [0.55001, 1.05, 0, 0, 1.11111],
 2874    "8899": [0.55001, 1.05, 0, 0, 1.11111],
 2875    "8968": [0.65002, 1.15, 0, 0, 0.52778],
 2876    "8969": [0.65002, 1.15, 0, 0, 0.52778],
 2877    "8970": [0.65002, 1.15, 0, 0, 0.52778],
 2878    "8971": [0.65002, 1.15, 0, 0, 0.52778],
 2879    "10216": [0.65002, 1.15, 0, 0, 0.61111],
 2880    "10217": [0.65002, 1.15, 0, 0, 0.61111],
 2881    "10752": [0.55001, 1.05, 0, 0, 1.51112],
 2882    "10753": [0.55001, 1.05, 0, 0, 1.51112],
 2883    "10754": [0.55001, 1.05, 0, 0, 1.51112],
 2884    "10756": [0.55001, 1.05, 0, 0, 1.11111],
 2885    "10758": [0.55001, 1.05, 0, 0, 1.11111]
 2886  },
 2887  "Size3-Regular": {
 2888    "32": [0, 0, 0, 0, 0.25],
 2889    "40": [0.95003, 1.45, 0, 0, 0.73611],
 2890    "41": [0.95003, 1.45, 0, 0, 0.73611],
 2891    "47": [0.95003, 1.45, 0, 0, 1.04445],
 2892    "91": [0.95003, 1.45, 0, 0, 0.52778],
 2893    "92": [0.95003, 1.45, 0, 0, 1.04445],
 2894    "93": [0.95003, 1.45, 0, 0, 0.52778],
 2895    "123": [0.95003, 1.45, 0, 0, 0.75],
 2896    "125": [0.95003, 1.45, 0, 0, 0.75],
 2897    "160": [0, 0, 0, 0, 0.25],
 2898    "710": [0, 0.75, 0, 0, 1.44445],
 2899    "732": [0, 0.75, 0, 0, 1.44445],
 2900    "770": [0, 0.75, 0, 0, 1.44445],
 2901    "771": [0, 0.75, 0, 0, 1.44445],
 2902    "8730": [0.95003, 1.45, 0, 0, 1.0],
 2903    "8968": [0.95003, 1.45, 0, 0, 0.58334],
 2904    "8969": [0.95003, 1.45, 0, 0, 0.58334],
 2905    "8970": [0.95003, 1.45, 0, 0, 0.58334],
 2906    "8971": [0.95003, 1.45, 0, 0, 0.58334],
 2907    "10216": [0.95003, 1.45, 0, 0, 0.75],
 2908    "10217": [0.95003, 1.45, 0, 0, 0.75]
 2909  },
 2910  "Size4-Regular": {
 2911    "32": [0, 0, 0, 0, 0.25],
 2912    "40": [1.25003, 1.75, 0, 0, 0.79167],
 2913    "41": [1.25003, 1.75, 0, 0, 0.79167],
 2914    "47": [1.25003, 1.75, 0, 0, 1.27778],
 2915    "91": [1.25003, 1.75, 0, 0, 0.58334],
 2916    "92": [1.25003, 1.75, 0, 0, 1.27778],
 2917    "93": [1.25003, 1.75, 0, 0, 0.58334],
 2918    "123": [1.25003, 1.75, 0, 0, 0.80556],
 2919    "125": [1.25003, 1.75, 0, 0, 0.80556],
 2920    "160": [0, 0, 0, 0, 0.25],
 2921    "710": [0, 0.825, 0, 0, 1.8889],
 2922    "732": [0, 0.825, 0, 0, 1.8889],
 2923    "770": [0, 0.825, 0, 0, 1.8889],
 2924    "771": [0, 0.825, 0, 0, 1.8889],
 2925    "8730": [1.25003, 1.75, 0, 0, 1.0],
 2926    "8968": [1.25003, 1.75, 0, 0, 0.63889],
 2927    "8969": [1.25003, 1.75, 0, 0, 0.63889],
 2928    "8970": [1.25003, 1.75, 0, 0, 0.63889],
 2929    "8971": [1.25003, 1.75, 0, 0, 0.63889],
 2930    "9115": [0.64502, 1.155, 0, 0, 0.875],
 2931    "9116": [1e-05, 0.6, 0, 0, 0.875],
 2932    "9117": [0.64502, 1.155, 0, 0, 0.875],
 2933    "9118": [0.64502, 1.155, 0, 0, 0.875],
 2934    "9119": [1e-05, 0.6, 0, 0, 0.875],
 2935    "9120": [0.64502, 1.155, 0, 0, 0.875],
 2936    "9121": [0.64502, 1.155, 0, 0, 0.66667],
 2937    "9122": [-0.00099, 0.601, 0, 0, 0.66667],
 2938    "9123": [0.64502, 1.155, 0, 0, 0.66667],
 2939    "9124": [0.64502, 1.155, 0, 0, 0.66667],
 2940    "9125": [-0.00099, 0.601, 0, 0, 0.66667],
 2941    "9126": [0.64502, 1.155, 0, 0, 0.66667],
 2942    "9127": [1e-05, 0.9, 0, 0, 0.88889],
 2943    "9128": [0.65002, 1.15, 0, 0, 0.88889],
 2944    "9129": [0.90001, 0, 0, 0, 0.88889],
 2945    "9130": [0, 0.3, 0, 0, 0.88889],
 2946    "9131": [1e-05, 0.9, 0, 0, 0.88889],
 2947    "9132": [0.65002, 1.15, 0, 0, 0.88889],
 2948    "9133": [0.90001, 0, 0, 0, 0.88889],
 2949    "9143": [0.88502, 0.915, 0, 0, 1.05556],
 2950    "10216": [1.25003, 1.75, 0, 0, 0.80556],
 2951    "10217": [1.25003, 1.75, 0, 0, 0.80556],
 2952    "57344": [-0.00499, 0.605, 0, 0, 1.05556],
 2953    "57345": [-0.00499, 0.605, 0, 0, 1.05556],
 2954    "57680": [0, 0.12, 0, 0, 0.45],
 2955    "57681": [0, 0.12, 0, 0, 0.45],
 2956    "57682": [0, 0.12, 0, 0, 0.45],
 2957    "57683": [0, 0.12, 0, 0, 0.45]
 2958  },
 2959  "Typewriter-Regular": {
 2960    "32": [0, 0, 0, 0, 0.525],
 2961    "33": [0, 0.61111, 0, 0, 0.525],
 2962    "34": [0, 0.61111, 0, 0, 0.525],
 2963    "35": [0, 0.61111, 0, 0, 0.525],
 2964    "36": [0.08333, 0.69444, 0, 0, 0.525],
 2965    "37": [0.08333, 0.69444, 0, 0, 0.525],
 2966    "38": [0, 0.61111, 0, 0, 0.525],
 2967    "39": [0, 0.61111, 0, 0, 0.525],
 2968    "40": [0.08333, 0.69444, 0, 0, 0.525],
 2969    "41": [0.08333, 0.69444, 0, 0, 0.525],
 2970    "42": [0, 0.52083, 0, 0, 0.525],
 2971    "43": [-0.08056, 0.53055, 0, 0, 0.525],
 2972    "44": [0.13889, 0.125, 0, 0, 0.525],
 2973    "45": [-0.08056, 0.53055, 0, 0, 0.525],
 2974    "46": [0, 0.125, 0, 0, 0.525],
 2975    "47": [0.08333, 0.69444, 0, 0, 0.525],
 2976    "48": [0, 0.61111, 0, 0, 0.525],
 2977    "49": [0, 0.61111, 0, 0, 0.525],
 2978    "50": [0, 0.61111, 0, 0, 0.525],
 2979    "51": [0, 0.61111, 0, 0, 0.525],
 2980    "52": [0, 0.61111, 0, 0, 0.525],
 2981    "53": [0, 0.61111, 0, 0, 0.525],
 2982    "54": [0, 0.61111, 0, 0, 0.525],
 2983    "55": [0, 0.61111, 0, 0, 0.525],
 2984    "56": [0, 0.61111, 0, 0, 0.525],
 2985    "57": [0, 0.61111, 0, 0, 0.525],
 2986    "58": [0, 0.43056, 0, 0, 0.525],
 2987    "59": [0.13889, 0.43056, 0, 0, 0.525],
 2988    "60": [-0.05556, 0.55556, 0, 0, 0.525],
 2989    "61": [-0.19549, 0.41562, 0, 0, 0.525],
 2990    "62": [-0.05556, 0.55556, 0, 0, 0.525],
 2991    "63": [0, 0.61111, 0, 0, 0.525],
 2992    "64": [0, 0.61111, 0, 0, 0.525],
 2993    "65": [0, 0.61111, 0, 0, 0.525],
 2994    "66": [0, 0.61111, 0, 0, 0.525],
 2995    "67": [0, 0.61111, 0, 0, 0.525],
 2996    "68": [0, 0.61111, 0, 0, 0.525],
 2997    "69": [0, 0.61111, 0, 0, 0.525],
 2998    "70": [0, 0.61111, 0, 0, 0.525],
 2999    "71": [0, 0.61111, 0, 0, 0.525],
 3000    "72": [0, 0.61111, 0, 0, 0.525],
 3001    "73": [0, 0.61111, 0, 0, 0.525],
 3002    "74": [0, 0.61111, 0, 0, 0.525],
 3003    "75": [0, 0.61111, 0, 0, 0.525],
 3004    "76": [0, 0.61111, 0, 0, 0.525],
 3005    "77": [0, 0.61111, 0, 0, 0.525],
 3006    "78": [0, 0.61111, 0, 0, 0.525],
 3007    "79": [0, 0.61111, 0, 0, 0.525],
 3008    "80": [0, 0.61111, 0, 0, 0.525],
 3009    "81": [0.13889, 0.61111, 0, 0, 0.525],
 3010    "82": [0, 0.61111, 0, 0, 0.525],
 3011    "83": [0, 0.61111, 0, 0, 0.525],
 3012    "84": [0, 0.61111, 0, 0, 0.525],
 3013    "85": [0, 0.61111, 0, 0, 0.525],
 3014    "86": [0, 0.61111, 0, 0, 0.525],
 3015    "87": [0, 0.61111, 0, 0, 0.525],
 3016    "88": [0, 0.61111, 0, 0, 0.525],
 3017    "89": [0, 0.61111, 0, 0, 0.525],
 3018    "90": [0, 0.61111, 0, 0, 0.525],
 3019    "91": [0.08333, 0.69444, 0, 0, 0.525],
 3020    "92": [0.08333, 0.69444, 0, 0, 0.525],
 3021    "93": [0.08333, 0.69444, 0, 0, 0.525],
 3022    "94": [0, 0.61111, 0, 0, 0.525],
 3023    "95": [0.09514, 0, 0, 0, 0.525],
 3024    "96": [0, 0.61111, 0, 0, 0.525],
 3025    "97": [0, 0.43056, 0, 0, 0.525],
 3026    "98": [0, 0.61111, 0, 0, 0.525],
 3027    "99": [0, 0.43056, 0, 0, 0.525],
 3028    "100": [0, 0.61111, 0, 0, 0.525],
 3029    "101": [0, 0.43056, 0, 0, 0.525],
 3030    "102": [0, 0.61111, 0, 0, 0.525],
 3031    "103": [0.22222, 0.43056, 0, 0, 0.525],
 3032    "104": [0, 0.61111, 0, 0, 0.525],
 3033    "105": [0, 0.61111, 0, 0, 0.525],
 3034    "106": [0.22222, 0.61111, 0, 0, 0.525],
 3035    "107": [0, 0.61111, 0, 0, 0.525],
 3036    "108": [0, 0.61111, 0, 0, 0.525],
 3037    "109": [0, 0.43056, 0, 0, 0.525],
 3038    "110": [0, 0.43056, 0, 0, 0.525],
 3039    "111": [0, 0.43056, 0, 0, 0.525],
 3040    "112": [0.22222, 0.43056, 0, 0, 0.525],
 3041    "113": [0.22222, 0.43056, 0, 0, 0.525],
 3042    "114": [0, 0.43056, 0, 0, 0.525],
 3043    "115": [0, 0.43056, 0, 0, 0.525],
 3044    "116": [0, 0.55358, 0, 0, 0.525],
 3045    "117": [0, 0.43056, 0, 0, 0.525],
 3046    "118": [0, 0.43056, 0, 0, 0.525],
 3047    "119": [0, 0.43056, 0, 0, 0.525],
 3048    "120": [0, 0.43056, 0, 0, 0.525],
 3049    "121": [0.22222, 0.43056, 0, 0, 0.525],
 3050    "122": [0, 0.43056, 0, 0, 0.525],
 3051    "123": [0.08333, 0.69444, 0, 0, 0.525],
 3052    "124": [0.08333, 0.69444, 0, 0, 0.525],
 3053    "125": [0.08333, 0.69444, 0, 0, 0.525],
 3054    "126": [0, 0.61111, 0, 0, 0.525],
 3055    "127": [0, 0.61111, 0, 0, 0.525],
 3056    "160": [0, 0, 0, 0, 0.525],
 3057    "176": [0, 0.61111, 0, 0, 0.525],
 3058    "184": [0.19445, 0, 0, 0, 0.525],
 3059    "305": [0, 0.43056, 0, 0, 0.525],
 3060    "567": [0.22222, 0.43056, 0, 0, 0.525],
 3061    "711": [0, 0.56597, 0, 0, 0.525],
 3062    "713": [0, 0.56555, 0, 0, 0.525],
 3063    "714": [0, 0.61111, 0, 0, 0.525],
 3064    "715": [0, 0.61111, 0, 0, 0.525],
 3065    "728": [0, 0.61111, 0, 0, 0.525],
 3066    "730": [0, 0.61111, 0, 0, 0.525],
 3067    "770": [0, 0.61111, 0, 0, 0.525],
 3068    "771": [0, 0.61111, 0, 0, 0.525],
 3069    "776": [0, 0.61111, 0, 0, 0.525],
 3070    "915": [0, 0.61111, 0, 0, 0.525],
 3071    "916": [0, 0.61111, 0, 0, 0.525],
 3072    "920": [0, 0.61111, 0, 0, 0.525],
 3073    "923": [0, 0.61111, 0, 0, 0.525],
 3074    "926": [0, 0.61111, 0, 0, 0.525],
 3075    "928": [0, 0.61111, 0, 0, 0.525],
 3076    "931": [0, 0.61111, 0, 0, 0.525],
 3077    "933": [0, 0.61111, 0, 0, 0.525],
 3078    "934": [0, 0.61111, 0, 0, 0.525],
 3079    "936": [0, 0.61111, 0, 0, 0.525],
 3080    "937": [0, 0.61111, 0, 0, 0.525],
 3081    "8216": [0, 0.61111, 0, 0, 0.525],
 3082    "8217": [0, 0.61111, 0, 0, 0.525],
 3083    "8242": [0, 0.61111, 0, 0, 0.525],
 3084    "9251": [0.11111, 0.21944, 0, 0, 0.525]
 3085  }
 3086});
 3087;// CONCATENATED MODULE: ./src/fontMetrics.js
 3088
 3089
 3090/**
 3091 * This file contains metrics regarding fonts and individual symbols. The sigma
 3092 * and xi variables, as well as the metricMap map contain data extracted from
 3093 * TeX, TeX font metrics, and the TTF files. These data are then exposed via the
 3094 * `metrics` variable and the getCharacterMetrics function.
 3095 */
 3096// In TeX, there are actually three sets of dimensions, one for each of
 3097// textstyle (size index 5 and higher: >=9pt), scriptstyle (size index 3 and 4:
 3098// 7-8pt), and scriptscriptstyle (size index 1 and 2: 5-6pt).  These are
 3099// provided in the the arrays below, in that order.
 3100//
 3101// The font metrics are stored in fonts cmsy10, cmsy7, and cmsy5 respsectively.
 3102// This was determined by running the following script:
 3103//
 3104//     latex -interaction=nonstopmode \
 3105//     '\documentclass{article}\usepackage{amsmath}\begin{document}' \
 3106//     '$a$ \expandafter\show\the\textfont2' \
 3107//     '\expandafter\show\the\scriptfont2' \
 3108//     '\expandafter\show\the\scriptscriptfont2' \
 3109//     '\stop'
 3110//
 3111// The metrics themselves were retreived using the following commands:
 3112//
 3113//     tftopl cmsy10
 3114//     tftopl cmsy7
 3115//     tftopl cmsy5
 3116//
 3117// The output of each of these commands is quite lengthy.  The only part we
 3118// care about is the FONTDIMEN section. Each value is measured in EMs.
 3119var sigmasAndXis = {
 3120  slant: [0.250, 0.250, 0.250],
 3121  // sigma1
 3122  space: [0.000, 0.000, 0.000],
 3123  // sigma2
 3124  stretch: [0.000, 0.000, 0.000],
 3125  // sigma3
 3126  shrink: [0.000, 0.000, 0.000],
 3127  // sigma4
 3128  xHeight: [0.431, 0.431, 0.431],
 3129  // sigma5
 3130  quad: [1.000, 1.171, 1.472],
 3131  // sigma6
 3132  extraSpace: [0.000, 0.000, 0.000],
 3133  // sigma7
 3134  num1: [0.677, 0.732, 0.925],
 3135  // sigma8
 3136  num2: [0.394, 0.384, 0.387],
 3137  // sigma9
 3138  num3: [0.444, 0.471, 0.504],
 3139  // sigma10
 3140  denom1: [0.686, 0.752, 1.025],
 3141  // sigma11
 3142  denom2: [0.345, 0.344, 0.532],
 3143  // sigma12
 3144  sup1: [0.413, 0.503, 0.504],
 3145  // sigma13
 3146  sup2: [0.363, 0.431, 0.404],
 3147  // sigma14
 3148  sup3: [0.289, 0.286, 0.294],
 3149  // sigma15
 3150  sub1: [0.150, 0.143, 0.200],
 3151  // sigma16
 3152  sub2: [0.247, 0.286, 0.400],
 3153  // sigma17
 3154  supDrop: [0.386, 0.353, 0.494],
 3155  // sigma18
 3156  subDrop: [0.050, 0.071, 0.100],
 3157  // sigma19
 3158  delim1: [2.390, 1.700, 1.980],
 3159  // sigma20
 3160  delim2: [1.010, 1.157, 1.420],
 3161  // sigma21
 3162  axisHeight: [0.250, 0.250, 0.250],
 3163  // sigma22
 3164  // These font metrics are extracted from TeX by using tftopl on cmex10.tfm;
 3165  // they correspond to the font parameters of the extension fonts (family 3).
 3166  // See the TeXbook, page 441. In AMSTeX, the extension fonts scale; to
 3167  // match cmex7, we'd use cmex7.tfm values for script and scriptscript
 3168  // values.
 3169  defaultRuleThickness: [0.04, 0.049, 0.049],
 3170  // xi8; cmex7: 0.049
 3171  bigOpSpacing1: [0.111, 0.111, 0.111],
 3172  // xi9
 3173  bigOpSpacing2: [0.166, 0.166, 0.166],
 3174  // xi10
 3175  bigOpSpacing3: [0.2, 0.2, 0.2],
 3176  // xi11
 3177  bigOpSpacing4: [0.6, 0.611, 0.611],
 3178  // xi12; cmex7: 0.611
 3179  bigOpSpacing5: [0.1, 0.143, 0.143],
 3180  // xi13; cmex7: 0.143
 3181  // The \sqrt rule width is taken from the height of the surd character.
 3182  // Since we use the same font at all sizes, this thickness doesn't scale.
 3183  sqrtRuleThickness: [0.04, 0.04, 0.04],
 3184  // This value determines how large a pt is, for metrics which are defined
 3185  // in terms of pts.
 3186  // This value is also used in katex.less; if you change it make sure the
 3187  // values match.
 3188  ptPerEm: [10.0, 10.0, 10.0],
 3189  // The space between adjacent `|` columns in an array definition. From
 3190  // `\showthe\doublerulesep` in LaTeX. Equals 2.0 / ptPerEm.
 3191  doubleRuleSep: [0.2, 0.2, 0.2],
 3192  // The width of separator lines in {array} environments. From
 3193  // `\showthe\arrayrulewidth` in LaTeX. Equals 0.4 / ptPerEm.
 3194  arrayRuleWidth: [0.04, 0.04, 0.04],
 3195  // Two values from LaTeX source2e:
 3196  fboxsep: [0.3, 0.3, 0.3],
 3197  //        3 pt / ptPerEm
 3198  fboxrule: [0.04, 0.04, 0.04] // 0.4 pt / ptPerEm
 3199
 3200}; // This map contains a mapping from font name and character code to character
 3201// metrics, including height, depth, italic correction, and skew (kern from the
 3202// character to the corresponding \skewchar)
 3203// This map is generated via `make metrics`. It should not be changed manually.
 3204
 3205 // These are very rough approximations.  We default to Times New Roman which
 3206// should have Latin-1 and Cyrillic characters, but may not depending on the
 3207// operating system.  The metrics do not account for extra height from the
 3208// accents.  In the case of Cyrillic characters which have both ascenders and
 3209// descenders we prefer approximations with ascenders, primarily to prevent
 3210// the fraction bar or root line from intersecting the glyph.
 3211// TODO(kevinb) allow union of multiple glyph metrics for better accuracy.
 3212
 3213var extraCharacterMap = {
 3214  // Latin-1
 3215  'Å': 'A',
 3216  'Ð': 'D',
 3217  'Þ': 'o',
 3218  'å': 'a',
 3219  'ð': 'd',
 3220  'þ': 'o',
 3221  // Cyrillic
 3222  'А': 'A',
 3223  'Б': 'B',
 3224  'В': 'B',
 3225  'Г': 'F',
 3226  'Д': 'A',
 3227  'Е': 'E',
 3228  'Ж': 'K',
 3229  'З': '3',
 3230  'И': 'N',
 3231  'Й': 'N',
 3232  'К': 'K',
 3233  'Л': 'N',
 3234  'М': 'M',
 3235  'Н': 'H',
 3236  'О': 'O',
 3237  'П': 'N',
 3238  'Р': 'P',
 3239  'С': 'C',
 3240  'Т': 'T',
 3241  'У': 'y',
 3242  'Ф': 'O',
 3243  'Х': 'X',
 3244  'Ц': 'U',
 3245  'Ч': 'h',
 3246  'Ш': 'W',
 3247  'Щ': 'W',
 3248  'Ъ': 'B',
 3249  'Ы': 'X',
 3250  'Ь': 'B',
 3251  'Э': '3',
 3252  'Ю': 'X',
 3253  'Я': 'R',
 3254  'а': 'a',
 3255  'б': 'b',
 3256  'в': 'a',
 3257  'г': 'r',
 3258  'д': 'y',
 3259  'е': 'e',
 3260  'ж': 'm',
 3261  'з': 'e',
 3262  'и': 'n',
 3263  'й': 'n',
 3264  'к': 'n',
 3265  'л': 'n',
 3266  'м': 'm',
 3267  'н': 'n',
 3268  'о': 'o',
 3269  'п': 'n',
 3270  'р': 'p',
 3271  'с': 'c',
 3272  'т': 'o',
 3273  'у': 'y',
 3274  'ф': 'b',
 3275  'х': 'x',
 3276  'ц': 'n',
 3277  'ч': 'n',
 3278  'ш': 'w',
 3279  'щ': 'w',
 3280  'ъ': 'a',
 3281  'ы': 'm',
 3282  'ь': 'a',
 3283  'э': 'e',
 3284  'ю': 'm',
 3285  'я': 'r'
 3286};
 3287
 3288/**
 3289 * This function adds new font metrics to default metricMap
 3290 * It can also override existing metrics
 3291 */
 3292function setFontMetrics(fontName, metrics) {
 3293  fontMetricsData[fontName] = metrics;
 3294}
 3295/**
 3296 * This function is a convenience function for looking up information in the
 3297 * metricMap table. It takes a character as a string, and a font.
 3298 *
 3299 * Note: the `width` property may be undefined if fontMetricsData.js wasn't
 3300 * built using `Make extended_metrics`.
 3301 */
 3302
 3303function getCharacterMetrics(character, font, mode) {
 3304  if (!fontMetricsData[font]) {
 3305    throw new Error("Font metrics not found for font: " + font + ".");
 3306  }
 3307
 3308  var ch = character.charCodeAt(0);
 3309  var metrics = fontMetricsData[font][ch];
 3310
 3311  if (!metrics && character[0] in extraCharacterMap) {
 3312    ch = extraCharacterMap[character[0]].charCodeAt(0);
 3313    metrics = fontMetricsData[font][ch];
 3314  }
 3315
 3316  if (!metrics && mode === 'text') {
 3317    // We don't typically have font metrics for Asian scripts.
 3318    // But since we support them in text mode, we need to return
 3319    // some sort of metrics.
 3320    // So if the character is in a script we support but we
 3321    // don't have metrics for it, just use the metrics for
 3322    // the Latin capital letter M. This is close enough because
 3323    // we (currently) only care about the height of the glpyh
 3324    // not its width.
 3325    if (supportedCodepoint(ch)) {
 3326      metrics = fontMetricsData[font][77]; // 77 is the charcode for 'M'
 3327    }
 3328  }
 3329
 3330  if (metrics) {
 3331    return {
 3332      depth: metrics[0],
 3333      height: metrics[1],
 3334      italic: metrics[2],
 3335      skew: metrics[3],
 3336      width: metrics[4]
 3337    };
 3338  }
 3339}
 3340var fontMetricsBySizeIndex = {};
 3341/**
 3342 * Get the font metrics for a given size.
 3343 */
 3344
 3345function getGlobalMetrics(size) {
 3346  var sizeIndex;
 3347
 3348  if (size >= 5) {
 3349    sizeIndex = 0;
 3350  } else if (size >= 3) {
 3351    sizeIndex = 1;
 3352  } else {
 3353    sizeIndex = 2;
 3354  }
 3355
 3356  if (!fontMetricsBySizeIndex[sizeIndex]) {
 3357    var metrics = fontMetricsBySizeIndex[sizeIndex] = {
 3358      cssEmPerMu: sigmasAndXis.quad[sizeIndex] / 18
 3359    };
 3360
 3361    for (var key in sigmasAndXis) {
 3362      if (sigmasAndXis.hasOwnProperty(key)) {
 3363        metrics[key] = sigmasAndXis[key][sizeIndex];
 3364      }
 3365    }
 3366  }
 3367
 3368  return fontMetricsBySizeIndex[sizeIndex];
 3369}
 3370;// CONCATENATED MODULE: ./src/Options.js
 3371/**
 3372 * This file contains information about the options that the Parser carries
 3373 * around with it while parsing. Data is held in an `Options` object, and when
 3374 * recursing, a new `Options` object can be created with the `.with*` and
 3375 * `.reset` functions.
 3376 */
 3377
 3378var sizeStyleMap = [// Each element contains [textsize, scriptsize, scriptscriptsize].
 3379// The size mappings are taken from TeX with \normalsize=10pt.
 3380[1, 1, 1], // size1: [5, 5, 5]              \tiny
 3381[2, 1, 1], // size2: [6, 5, 5]
 3382[3, 1, 1], // size3: [7, 5, 5]              \scriptsize
 3383[4, 2, 1], // size4: [8, 6, 5]              \footnotesize
 3384[5, 2, 1], // size5: [9, 6, 5]              \small
 3385[6, 3, 1], // size6: [10, 7, 5]             \normalsize
 3386[7, 4, 2], // size7: [12, 8, 6]             \large
 3387[8, 6, 3], // size8: [14.4, 10, 7]          \Large
 3388[9, 7, 6], // size9: [17.28, 12, 10]        \LARGE
 3389[10, 8, 7], // size10: [20.74, 14.4, 12]     \huge
 3390[11, 10, 9] // size11: [24.88, 20.74, 17.28] \HUGE
 3391];
 3392var sizeMultipliers = [// fontMetrics.js:getGlobalMetrics also uses size indexes, so if
 3393// you change size indexes, change that function.
 33940.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.2, 1.44, 1.728, 2.074, 2.488];
 3395
 3396var sizeAtStyle = function sizeAtStyle(size, style) {
 3397  return style.size < 2 ? size : sizeStyleMap[size - 1][style.size - 1];
 3398}; // In these types, "" (empty string) means "no change".
 3399
 3400
 3401/**
 3402 * This is the main options class. It contains the current style, size, color,
 3403 * and font.
 3404 *
 3405 * Options objects should not be modified. To create a new Options with
 3406 * different properties, call a `.having*` method.
 3407 */
 3408var Options = /*#__PURE__*/function () {
 3409  // A font family applies to a group of fonts (i.e. SansSerif), while a font
 3410  // represents a specific font (i.e. SansSerif Bold).
 3411  // See: https://tex.stackexchange.com/questions/22350/difference-between-textrm-and-mathrm
 3412
 3413  /**
 3414   * The base size index.
 3415   */
 3416  function Options(data) {
 3417    this.style = void 0;
 3418    this.color = void 0;
 3419    this.size = void 0;
 3420    this.textSize = void 0;
 3421    this.phantom = void 0;
 3422    this.font = void 0;
 3423    this.fontFamily = void 0;
 3424    this.fontWeight = void 0;
 3425    this.fontShape = void 0;
 3426    this.sizeMultiplier = void 0;
 3427    this.maxSize = void 0;
 3428    this.minRuleThickness = void 0;
 3429    this._fontMetrics = void 0;
 3430    this.style = data.style;
 3431    this.color = data.color;
 3432    this.size = data.size || Options.BASESIZE;
 3433    this.textSize = data.textSize || this.size;
 3434    this.phantom = !!data.phantom;
 3435    this.font = data.font || "";
 3436    this.fontFamily = data.fontFamily || "";
 3437    this.fontWeight = data.fontWeight || '';
 3438    this.fontShape = data.fontShape || '';
 3439    this.sizeMultiplier = sizeMultipliers[this.size - 1];
 3440    this.maxSize = data.maxSize;
 3441    this.minRuleThickness = data.minRuleThickness;
 3442    this._fontMetrics = undefined;
 3443  }
 3444  /**
 3445   * Returns a new options object with the same properties as "this".  Properties
 3446   * from "extension" will be copied to the new options object.
 3447   */
 3448
 3449
 3450  var _proto = Options.prototype;
 3451
 3452  _proto.extend = function extend(extension) {
 3453    var data = {
 3454      style: this.style,
 3455      size: this.size,
 3456      textSize: this.textSize,
 3457      color: this.color,
 3458      phantom: this.phantom,
 3459      font: this.font,
 3460      fontFamily: this.fontFamily,
 3461      fontWeight: this.fontWeight,
 3462      fontShape: this.fontShape,
 3463      maxSize: this.maxSize,
 3464      minRuleThickness: this.minRuleThickness
 3465    };
 3466
 3467    for (var key in extension) {
 3468      if (extension.hasOwnProperty(key)) {
 3469        data[key] = extension[key];
 3470      }
 3471    }
 3472
 3473    return new Options(data);
 3474  }
 3475  /**
 3476   * Return an options object with the given style. If `this.style === style`,
 3477   * returns `this`.
 3478   */
 3479  ;
 3480
 3481  _proto.havingStyle = function havingStyle(style) {
 3482    if (this.style === style) {
 3483      return this;
 3484    } else {
 3485      return this.extend({
 3486        style: style,
 3487        size: sizeAtStyle(this.textSize, style)
 3488      });
 3489    }
 3490  }
 3491  /**
 3492   * Return an options object with a cramped version of the current style. If
 3493   * the current style is cramped, returns `this`.
 3494   */
 3495  ;
 3496
 3497  _proto.havingCrampedStyle = function havingCrampedStyle() {
 3498    return this.havingStyle(this.style.cramp());
 3499  }
 3500  /**
 3501   * Return an options object with the given size and in at least `\textstyle`.
 3502   * Returns `this` if appropriate.
 3503   */
 3504  ;
 3505
 3506  _proto.havingSize = function havingSize(size) {
 3507    if (this.size === size && this.textSize === size) {
 3508      return this;
 3509    } else {
 3510      return this.extend({
 3511        style: this.style.text(),
 3512        size: size,
 3513        textSize: size,
 3514        sizeMultiplier: sizeMultipliers[size - 1]
 3515      });
 3516    }
 3517  }
 3518  /**
 3519   * Like `this.havingSize(BASESIZE).havingStyle(style)`. If `style` is omitted,
 3520   * changes to at least `\textstyle`.
 3521   */
 3522  ;
 3523
 3524  _proto.havingBaseStyle = function havingBaseStyle(style) {
 3525    style = style || this.style.text();
 3526    var wantSize = sizeAtStyle(Options.BASESIZE, style);
 3527
 3528    if (this.size === wantSize && this.textSize === Options.BASESIZE && this.style === style) {
 3529      return this;
 3530    } else {
 3531      return this.extend({
 3532        style: style,
 3533        size: wantSize
 3534      });
 3535    }
 3536  }
 3537  /**
 3538   * Remove the effect of sizing changes such as \Huge.
 3539   * Keep the effect of the current style, such as \scriptstyle.
 3540   */
 3541  ;
 3542
 3543  _proto.havingBaseSizing = function havingBaseSizing() {
 3544    var size;
 3545
 3546    switch (this.style.id) {
 3547      case 4:
 3548      case 5:
 3549        size = 3; // normalsize in scriptstyle
 3550
 3551        break;
 3552
 3553      case 6:
 3554      case 7:
 3555        size = 1; // normalsize in scriptscriptstyle
 3556
 3557        break;
 3558
 3559      default:
 3560        size = 6;
 3561      // normalsize in textstyle or displaystyle
 3562    }
 3563
 3564    return this.extend({
 3565      style: this.style.text(),
 3566      size: size
 3567    });
 3568  }
 3569  /**
 3570   * Create a new options object with the given color.
 3571   */
 3572  ;
 3573
 3574  _proto.withColor = function withColor(color) {
 3575    return this.extend({
 3576      color: color
 3577    });
 3578  }
 3579  /**
 3580   * Create a new options object with "phantom" set to true.
 3581   */
 3582  ;
 3583
 3584  _proto.withPhantom = function withPhantom() {
 3585    return this.extend({
 3586      phantom: true
 3587    });
 3588  }
 3589  /**
 3590   * Creates a new options object with the given math font or old text font.
 3591   * @type {[type]}
 3592   */
 3593  ;
 3594
 3595  _proto.withFont = function withFont(font) {
 3596    return this.extend({
 3597      font: font
 3598    });
 3599  }
 3600  /**
 3601   * Create a new options objects with the given fontFamily.
 3602   */
 3603  ;
 3604
 3605  _proto.withTextFontFamily = function withTextFontFamily(fontFamily) {
 3606    return this.extend({
 3607      fontFamily: fontFamily,
 3608      font: ""
 3609    });
 3610  }
 3611  /**
 3612   * Creates a new options object with the given font weight
 3613   */
 3614  ;
 3615
 3616  _proto.withTextFontWeight = function withTextFontWeight(fontWeight) {
 3617    return this.extend({
 3618      fontWeight: fontWeight,
 3619      font: ""
 3620    });
 3621  }
 3622  /**
 3623   * Creates a new options object with the given font weight
 3624   */
 3625  ;
 3626
 3627  _proto.withTextFontShape = function withTextFontShape(fontShape) {
 3628    return this.extend({
 3629      fontShape: fontShape,
 3630      font: ""
 3631    });
 3632  }
 3633  /**
 3634   * Return the CSS sizing classes required to switch from enclosing options
 3635   * `oldOptions` to `this`. Returns an array of classes.
 3636   */
 3637  ;
 3638
 3639  _proto.sizingClasses = function sizingClasses(oldOptions) {
 3640    if (oldOptions.size !== this.size) {
 3641      return ["sizing", "reset-size" + oldOptions.size, "size" + this.size];
 3642    } else {
 3643      return [];
 3644    }
 3645  }
 3646  /**
 3647   * Return the CSS sizing classes required to switch to the base size. Like
 3648   * `this.havingSize(BASESIZE).sizingClasses(this)`.
 3649   */
 3650  ;
 3651
 3652  _proto.baseSizingClasses = function baseSizingClasses() {
 3653    if (this.size !== Options.BASESIZE) {
 3654      return ["sizing", "reset-size" + this.size, "size" + Options.BASESIZE];
 3655    } else {
 3656      return [];
 3657    }
 3658  }
 3659  /**
 3660   * Return the font metrics for this size.
 3661   */
 3662  ;
 3663
 3664  _proto.fontMetrics = function fontMetrics() {
 3665    if (!this._fontMetrics) {
 3666      this._fontMetrics = getGlobalMetrics(this.size);
 3667    }
 3668
 3669    return this._fontMetrics;
 3670  }
 3671  /**
 3672   * Gets the CSS color of the current options object
 3673   */
 3674  ;
 3675
 3676  _proto.getColor = function getColor() {
 3677    if (this.phantom) {
 3678      return "transparent";
 3679    } else {
 3680      return this.color;
 3681    }
 3682  };
 3683
 3684  return Options;
 3685}();
 3686
 3687Options.BASESIZE = 6;
 3688/* harmony default export */ var src_Options = (Options);
 3689;// CONCATENATED MODULE: ./src/units.js
 3690/**
 3691 * This file does conversion between units.  In particular, it provides
 3692 * calculateSize to convert other units into ems.
 3693 */
 3694
 3695 // This table gives the number of TeX pts in one of each *absolute* TeX unit.
 3696// Thus, multiplying a length by this number converts the length from units
 3697// into pts.  Dividing the result by ptPerEm gives the number of ems
 3698// *assuming* a font size of ptPerEm (normal size, normal style).
 3699
 3700var ptPerUnit = {
 3701  // https://en.wikibooks.org/wiki/LaTeX/Lengths and
 3702  // https://tex.stackexchange.com/a/8263
 3703  "pt": 1,
 3704  // TeX point
 3705  "mm": 7227 / 2540,
 3706  // millimeter
 3707  "cm": 7227 / 254,
 3708  // centimeter
 3709  "in": 72.27,
 3710  // inch
 3711  "bp": 803 / 800,
 3712  // big (PostScript) points
 3713  "pc": 12,
 3714  // pica
 3715  "dd": 1238 / 1157,
 3716  // didot
 3717  "cc": 14856 / 1157,
 3718  // cicero (12 didot)
 3719  "nd": 685 / 642,
 3720  // new didot
 3721  "nc": 1370 / 107,
 3722  // new cicero (12 new didot)
 3723  "sp": 1 / 65536,
 3724  // scaled point (TeX's internal smallest unit)
 3725  // https://tex.stackexchange.com/a/41371
 3726  "px": 803 / 800 // \pdfpxdimen defaults to 1 bp in pdfTeX and LuaTeX
 3727
 3728}; // Dictionary of relative units, for fast validity testing.
 3729
 3730var relativeUnit = {
 3731  "ex": true,
 3732  "em": true,
 3733  "mu": true
 3734};
 3735
 3736/**
 3737 * Determine whether the specified unit (either a string defining the unit
 3738 * or a "size" parse node containing a unit field) is valid.
 3739 */
 3740var validUnit = function validUnit(unit) {
 3741  if (typeof unit !== "string") {
 3742    unit = unit.unit;
 3743  }
 3744
 3745  return unit in ptPerUnit || unit in relativeUnit || unit === "ex";
 3746};
 3747/*
 3748 * Convert a "size" parse node (with numeric "number" and string "unit" fields,
 3749 * as parsed by functions.js argType "size") into a CSS em value for the
 3750 * current style/scale.  `options` gives the current options.
 3751 */
 3752
 3753var calculateSize = function calculateSize(sizeValue, options) {
 3754  var scale;
 3755
 3756  if (sizeValue.unit in ptPerUnit) {
 3757    // Absolute units
 3758    scale = ptPerUnit[sizeValue.unit] // Convert unit to pt
 3759    / options.fontMetrics().ptPerEm // Convert pt to CSS em
 3760    / options.sizeMultiplier; // Unscale to make absolute units
 3761  } else if (sizeValue.unit === "mu") {
 3762    // `mu` units scale with scriptstyle/scriptscriptstyle.
 3763    scale = options.fontMetrics().cssEmPerMu;
 3764  } else {
 3765    // Other relative units always refer to the *textstyle* font
 3766    // in the current size.
 3767    var unitOptions;
 3768
 3769    if (options.style.isTight()) {
 3770      // isTight() means current style is script/scriptscript.
 3771      unitOptions = options.havingStyle(options.style.text());
 3772    } else {
 3773      unitOptions = options;
 3774    } // TODO: In TeX these units are relative to the quad of the current
 3775    // *text* font, e.g. cmr10. KaTeX instead uses values from the
 3776    // comparably-sized *Computer Modern symbol* font. At 10pt, these
 3777    // match. At 7pt and 5pt, they differ: cmr7=1.138894, cmsy7=1.170641;
 3778    // cmr5=1.361133, cmsy5=1.472241. Consider $\scriptsize a\kern1emb$.
 3779    // TeX \showlists shows a kern of 1.13889 * fontsize;
 3780    // KaTeX shows a kern of 1.171 * fontsize.
 3781
 3782
 3783    if (sizeValue.unit === "ex") {
 3784      scale = unitOptions.fontMetrics().xHeight;
 3785    } else if (sizeValue.unit === "em") {
 3786      scale = unitOptions.fontMetrics().quad;
 3787    } else {
 3788      throw new src_ParseError("Invalid unit: '" + sizeValue.unit + "'");
 3789    }
 3790
 3791    if (unitOptions !== options) {
 3792      scale *= unitOptions.sizeMultiplier / options.sizeMultiplier;
 3793    }
 3794  }
 3795
 3796  return Math.min(sizeValue.number * scale, options.maxSize);
 3797};
 3798/**
 3799 * Round `n` to 4 decimal places, or to the nearest 1/10,000th em. See
 3800 * https://github.com/KaTeX/KaTeX/pull/2460.
 3801 */
 3802
 3803var makeEm = function makeEm(n) {
 3804  return +n.toFixed(4) + "em";
 3805};
 3806;// CONCATENATED MODULE: ./src/domTree.js
 3807/**
 3808 * These objects store the data about the DOM nodes we create, as well as some
 3809 * extra data. They can then be transformed into real DOM nodes with the
 3810 * `toNode` function or HTML markup using `toMarkup`. They are useful for both
 3811 * storing extra properties on the nodes, as well as providing a way to easily
 3812 * work with the DOM.
 3813 *
 3814 * Similar functions for working with MathML nodes exist in mathMLTree.js.
 3815 *
 3816 * TODO: refactor `span` and `anchor` into common superclass when
 3817 * target environments support class inheritance
 3818 */
 3819
 3820
 3821
 3822
 3823
 3824
 3825/**
 3826 * Create an HTML className based on a list of classes. In addition to joining
 3827 * with spaces, we also remove empty classes.
 3828 */
 3829var createClass = function createClass(classes) {
 3830  return classes.filter(function (cls) {
 3831    return cls;
 3832  }).join(" ");
 3833};
 3834
 3835var initNode = function initNode(classes, options, style) {
 3836  this.classes = classes || [];
 3837  this.attributes = {};
 3838  this.height = 0;
 3839  this.depth = 0;
 3840  this.maxFontSize = 0;
 3841  this.style = style || {};
 3842
 3843  if (options) {
 3844    if (options.style.isTight()) {
 3845      this.classes.push("mtight");
 3846    }
 3847
 3848    var color = options.getColor();
 3849
 3850    if (color) {
 3851      this.style.color = color;
 3852    }
 3853  }
 3854};
 3855/**
 3856 * Convert into an HTML node
 3857 */
 3858
 3859
 3860var _toNode = function toNode(tagName) {
 3861  var node = document.createElement(tagName); // Apply the class
 3862
 3863  node.className = createClass(this.classes); // Apply inline styles
 3864
 3865  for (var style in this.style) {
 3866    if (this.style.hasOwnProperty(style)) {
 3867      // $FlowFixMe Flow doesn't seem to understand span.style's type.
 3868      node.style[style] = this.style[style];
 3869    }
 3870  } // Apply attributes
 3871
 3872
 3873  for (var attr in this.attributes) {
 3874    if (this.attributes.hasOwnProperty(attr)) {
 3875      node.setAttribute(attr, this.attributes[attr]);
 3876    }
 3877  } // Append the children, also as HTML nodes
 3878
 3879
 3880  for (var i = 0; i < this.children.length; i++) {
 3881    node.appendChild(this.children[i].toNode());
 3882  }
 3883
 3884  return node;
 3885};
 3886/**
 3887 * Convert into an HTML markup string
 3888 */
 3889
 3890
 3891var _toMarkup = function toMarkup(tagName) {
 3892  var markup = "<" + tagName; // Add the class
 3893
 3894  if (this.classes.length) {
 3895    markup += " class=\"" + utils.escape(createClass(this.classes)) + "\"";
 3896  }
 3897
 3898  var styles = ""; // Add the styles, after hyphenation
 3899
 3900  for (var style in this.style) {
 3901    if (this.style.hasOwnProperty(style)) {
 3902      styles += utils.hyphenate(style) + ":" + this.style[style] + ";";
 3903    }
 3904  }
 3905
 3906  if (styles) {
 3907    markup += " style=\"" + utils.escape(styles) + "\"";
 3908  } // Add the attributes
 3909
 3910
 3911  for (var attr in this.attributes) {
 3912    if (this.attributes.hasOwnProperty(attr)) {
 3913      markup += " " + attr + "=\"" + utils.escape(this.attributes[attr]) + "\"";
 3914    }
 3915  }
 3916
 3917  markup += ">"; // Add the markup of the children, also as markup
 3918
 3919  for (var i = 0; i < this.children.length; i++) {
 3920    markup += this.children[i].toMarkup();
 3921  }
 3922
 3923  markup += "</" + tagName + ">";
 3924  return markup;
 3925}; // Making the type below exact with all optional fields doesn't work due to
 3926// - https://github.com/facebook/flow/issues/4582
 3927// - https://github.com/facebook/flow/issues/5688
 3928// However, since *all* fields are optional, $Shape<> works as suggested in 5688
 3929// above.
 3930// This type does not include all CSS properties. Additional properties should
 3931// be added as needed.
 3932
 3933
 3934/**
 3935 * This node represents a span node, with a className, a list of children, and
 3936 * an inline style. It also contains information about its height, depth, and
 3937 * maxFontSize.
 3938 *
 3939 * Represents two types with different uses: SvgSpan to wrap an SVG and DomSpan
 3940 * otherwise. This typesafety is important when HTML builders access a span's
 3941 * children.
 3942 */
 3943var Span = /*#__PURE__*/function () {
 3944  function Span(classes, children, options, style) {
 3945    this.children = void 0;
 3946    this.attributes = void 0;
 3947    this.classes = void 0;
 3948    this.height = void 0;
 3949    this.depth = void 0;
 3950    this.width = void 0;
 3951    this.maxFontSize = void 0;
 3952    this.style = void 0;
 3953    initNode.call(this, classes, options, style);
 3954    this.children = children || [];
 3955  }
 3956  /**
 3957   * Sets an arbitrary attribute on the span. Warning: use this wisely. Not
 3958   * all browsers support attributes the same, and having too many custom
 3959   * attributes is probably bad.
 3960   */
 3961
 3962
 3963  var _proto = Span.prototype;
 3964
 3965  _proto.setAttribute = function setAttribute(attribute, value) {
 3966    this.attributes[attribute] = value;
 3967  };
 3968
 3969  _proto.hasClass = function hasClass(className) {
 3970    return utils.contains(this.classes, className);
 3971  };
 3972
 3973  _proto.toNode = function toNode() {
 3974    return _toNode.call(this, "span");
 3975  };
 3976
 3977  _proto.toMarkup = function toMarkup() {
 3978    return _toMarkup.call(this, "span");
 3979  };
 3980
 3981  return Span;
 3982}();
 3983/**
 3984 * This node represents an anchor (<a>) element with a hyperlink.  See `span`
 3985 * for further details.
 3986 */
 3987
 3988var Anchor = /*#__PURE__*/function () {
 3989  function Anchor(href, classes, children, options) {
 3990    this.children = void 0;
 3991    this.attributes = void 0;
 3992    this.classes = void 0;
 3993    this.height = void 0;
 3994    this.depth = void 0;
 3995    this.maxFontSize = void 0;
 3996    this.style = void 0;
 3997    initNode.call(this, classes, options);
 3998    this.children = children || [];
 3999    this.setAttribute('href', href);
 4000  }
 4001
 4002  var _proto2 = Anchor.prototype;
 4003
 4004  _proto2.setAttribute = function setAttribute(attribute, value) {
 4005    this.attributes[attribute] = value;
 4006  };
 4007
 4008  _proto2.hasClass = function hasClass(className) {
 4009    return utils.contains(this.classes, className);
 4010  };
 4011
 4012  _proto2.toNode = function toNode() {
 4013    return _toNode.call(this, "a");
 4014  };
 4015
 4016  _proto2.toMarkup = function toMarkup() {
 4017    return _toMarkup.call(this, "a");
 4018  };
 4019
 4020  return Anchor;
 4021}();
 4022/**
 4023 * This node represents an image embed (<img>) element.
 4024 */
 4025
 4026var Img = /*#__PURE__*/function () {
 4027  function Img(src, alt, style) {
 4028    this.src = void 0;
 4029    this.alt = void 0;
 4030    this.classes = void 0;
 4031    this.height = void 0;
 4032    this.depth = void 0;
 4033    this.maxFontSize = void 0;
 4034    this.style = void 0;
 4035    this.alt = alt;
 4036    this.src = src;
 4037    this.classes = ["mord"];
 4038    this.style = style;
 4039  }
 4040
 4041  var _proto3 = Img.prototype;
 4042
 4043  _proto3.hasClass = function hasClass(className) {
 4044    return utils.contains(this.classes, className);
 4045  };
 4046
 4047  _proto3.toNode = function toNode() {
 4048    var node = document.createElement("img");
 4049    node.src = this.src;
 4050    node.alt = this.alt;
 4051    node.className = "mord"; // Apply inline styles
 4052
 4053    for (var style in this.style) {
 4054      if (this.style.hasOwnProperty(style)) {
 4055        // $FlowFixMe
 4056        node.style[style] = this.style[style];
 4057      }
 4058    }
 4059
 4060    return node;
 4061  };
 4062
 4063  _proto3.toMarkup = function toMarkup() {
 4064    var markup = "<img  src='" + this.src + " 'alt='" + this.alt + "' "; // Add the styles, after hyphenation
 4065
 4066    var styles = "";
 4067
 4068    for (var style in this.style) {
 4069      if (this.style.hasOwnProperty(style)) {
 4070        styles += utils.hyphenate(style) + ":" + this.style[style] + ";";
 4071      }
 4072    }
 4073
 4074    if (styles) {
 4075      markup += " style=\"" + utils.escape(styles) + "\"";
 4076    }
 4077
 4078    markup += "'/>";
 4079    return markup;
 4080  };
 4081
 4082  return Img;
 4083}();
 4084var iCombinations = {
 4085  'î': "\u0131\u0302",
 4086  'ï': "\u0131\u0308",
 4087  'í': "\u0131\u0301",
 4088  // 'ī': '\u0131\u0304', // enable when we add Extended Latin
 4089  'ì': "\u0131\u0300"
 4090};
 4091/**
 4092 * A symbol node contains information about a single symbol. It either renders
 4093 * to a single text node, or a span with a single text node in it, depending on
 4094 * whether it has CSS classes, styles, or needs italic correction.
 4095 */
 4096
 4097var SymbolNode = /*#__PURE__*/function () {
 4098  function SymbolNode(text, height, depth, italic, skew, width, classes, style) {
 4099    this.text = void 0;
 4100    this.height = void 0;
 4101    this.depth = void 0;
 4102    this.italic = void 0;
 4103    this.skew = void 0;
 4104    this.width = void 0;
 4105    this.maxFontSize = void 0;
 4106    this.classes = void 0;
 4107    this.style = void 0;
 4108    this.text = text;
 4109    this.height = height || 0;
 4110    this.depth = depth || 0;
 4111    this.italic = italic || 0;
 4112    this.skew = skew || 0;
 4113    this.width = width || 0;
 4114    this.classes = classes || [];
 4115    this.style = style || {};
 4116    this.maxFontSize = 0; // Mark text from non-Latin scripts with specific classes so that we
 4117    // can specify which fonts to use.  This allows us to render these
 4118    // characters with a serif font in situations where the browser would
 4119    // either default to a sans serif or render a placeholder character.
 4120    // We use CSS class names like cjk_fallback, hangul_fallback and
 4121    // brahmic_fallback. See ./unicodeScripts.js for the set of possible
 4122    // script names
 4123
 4124    var script = scriptFromCodepoint(this.text.charCodeAt(0));
 4125
 4126    if (script) {
 4127      this.classes.push(script + "_fallback");
 4128    }
 4129
 4130    if (/[îïíì]/.test(this.text)) {
 4131      // add ī when we add Extended Latin
 4132      this.text = iCombinations[this.text];
 4133    }
 4134  }
 4135
 4136  var _proto4 = SymbolNode.prototype;
 4137
 4138  _proto4.hasClass = function hasClass(className) {
 4139    return utils.contains(this.classes, className);
 4140  }
 4141  /**
 4142   * Creates a text node or span from a symbol node. Note that a span is only
 4143   * created if it is needed.
 4144   */
 4145  ;
 4146
 4147  _proto4.toNode = function toNode() {
 4148    var node = document.createTextNode(this.text);
 4149    var span = null;
 4150
 4151    if (this.italic > 0) {
 4152      span = document.createElement("span");
 4153      span.style.marginRight = makeEm(this.italic);
 4154    }
 4155
 4156    if (this.classes.length > 0) {
 4157      span = span || document.createElement("span");
 4158      span.className = createClass(this.classes);
 4159    }
 4160
 4161    for (var style in this.style) {
 4162      if (this.style.hasOwnProperty(style)) {
 4163        span = span || document.createElement("span"); // $FlowFixMe Flow doesn't seem to understand span.style's type.
 4164
 4165        span.style[style] = this.style[style];
 4166      }
 4167    }
 4168
 4169    if (span) {
 4170      span.appendChild(node);
 4171      return span;
 4172    } else {
 4173      return node;
 4174    }
 4175  }
 4176  /**
 4177   * Creates markup for a symbol node.
 4178   */
 4179  ;
 4180
 4181  _proto4.toMarkup = function toMarkup() {
 4182    // TODO(alpert): More duplication than I'd like from
 4183    // span.prototype.toMarkup and symbolNode.prototype.toNode...
 4184    var needsSpan = false;
 4185    var markup = "<span";
 4186
 4187    if (this.classes.length) {
 4188      needsSpan = true;
 4189      markup += " class=\"";
 4190      markup += utils.escape(createClass(this.classes));
 4191      markup += "\"";
 4192    }
 4193
 4194    var styles = "";
 4195
 4196    if (this.italic > 0) {
 4197      styles += "margin-right:" + this.italic + "em;";
 4198    }
 4199
 4200    for (var style in this.style) {
 4201      if (this.style.hasOwnProperty(style)) {
 4202        styles += utils.hyphenate(style) + ":" + this.style[style] + ";";
 4203      }
 4204    }
 4205
 4206    if (styles) {
 4207      needsSpan = true;
 4208      markup += " style=\"" + utils.escape(styles) + "\"";
 4209    }
 4210
 4211    var escaped = utils.escape(this.text);
 4212
 4213    if (needsSpan) {
 4214      markup += ">";
 4215      markup += escaped;
 4216      markup += "</span>";
 4217      return markup;
 4218    } else {
 4219      return escaped;
 4220    }
 4221  };
 4222
 4223  return SymbolNode;
 4224}();
 4225/**
 4226 * SVG nodes are used to render stretchy wide elements.
 4227 */
 4228
 4229var SvgNode = /*#__PURE__*/function () {
 4230  function SvgNode(children, attributes) {
 4231    this.children = void 0;
 4232    this.attributes = void 0;
 4233    this.children = children || [];
 4234    this.attributes = attributes || {};
 4235  }
 4236
 4237  var _proto5 = SvgNode.prototype;
 4238
 4239  _proto5.toNode = function toNode() {
 4240    var svgNS = "http://www.w3.org/2000/svg";
 4241    var node = document.createElementNS(svgNS, "svg"); // Apply attributes
 4242
 4243    for (var attr in this.attributes) {
 4244      if (Object.prototype.hasOwnProperty.call(this.attributes, attr)) {
 4245        node.setAttribute(attr, this.attributes[attr]);
 4246      }
 4247    }
 4248
 4249    for (var i = 0; i < this.children.length; i++) {
 4250      node.appendChild(this.children[i].toNode());
 4251    }
 4252
 4253    return node;
 4254  };
 4255
 4256  _proto5.toMarkup = function toMarkup() {
 4257    var markup = "<svg xmlns=\"http://www.w3.org/2000/svg\""; // Apply attributes
 4258
 4259    for (var attr in this.attributes) {
 4260      if (Object.prototype.hasOwnProperty.call(this.attributes, attr)) {
 4261        markup += " " + attr + "='" + this.attributes[attr] + "'";
 4262      }
 4263    }
 4264
 4265    markup += ">";
 4266
 4267    for (var i = 0; i < this.children.length; i++) {
 4268      markup += this.children[i].toMarkup();
 4269    }
 4270
 4271    markup += "</svg>";
 4272    return markup;
 4273  };
 4274
 4275  return SvgNode;
 4276}();
 4277var PathNode = /*#__PURE__*/function () {
 4278  function PathNode(pathName, alternate) {
 4279    this.pathName = void 0;
 4280    this.alternate = void 0;
 4281    this.pathName = pathName;
 4282    this.alternate = alternate; // Used only for \sqrt, \phase, & tall delims
 4283  }
 4284
 4285  var _proto6 = PathNode.prototype;
 4286
 4287  _proto6.toNode = function toNode() {
 4288    var svgNS = "http://www.w3.org/2000/svg";
 4289    var node = document.createElementNS(svgNS, "path");
 4290
 4291    if (this.alternate) {
 4292      node.setAttribute("d", this.alternate);
 4293    } else {
 4294      node.setAttribute("d", path[this.pathName]);
 4295    }
 4296
 4297    return node;
 4298  };
 4299
 4300  _proto6.toMarkup = function toMarkup() {
 4301    if (this.alternate) {
 4302      return "<path d='" + this.alternate + "'/>";
 4303    } else {
 4304      return "<path d='" + path[this.pathName] + "'/>";
 4305    }
 4306  };
 4307
 4308  return PathNode;
 4309}();
 4310var LineNode = /*#__PURE__*/function () {
 4311  function LineNode(attributes) {
 4312    this.attributes = void 0;
 4313    this.attributes = attributes || {};
 4314  }
 4315
 4316  var _proto7 = LineNode.prototype;
 4317
 4318  _proto7.toNode = function toNode() {
 4319    var svgNS = "http://www.w3.org/2000/svg";
 4320    var node = document.createElementNS(svgNS, "line"); // Apply attributes
 4321
 4322    for (var attr in this.attributes) {
 4323      if (Object.prototype.hasOwnProperty.call(this.attributes, attr)) {
 4324        node.setAttribute(attr, this.attributes[attr]);
 4325      }
 4326    }
 4327
 4328    return node;
 4329  };
 4330
 4331  _proto7.toMarkup = function toMarkup() {
 4332    var markup = "<line";
 4333
 4334    for (var attr in this.attributes) {
 4335      if (Object.prototype.hasOwnProperty.call(this.attributes, attr)) {
 4336        markup += " " + attr + "='" + this.attributes[attr] + "'";
 4337      }
 4338    }
 4339
 4340    markup += "/>";
 4341    return markup;
 4342  };
 4343
 4344  return LineNode;
 4345}();
 4346function assertSymbolDomNode(group) {
 4347  if (group instanceof SymbolNode) {
 4348    return group;
 4349  } else {
 4350    throw new Error("Expected symbolNode but got " + String(group) + ".");
 4351  }
 4352}
 4353function assertSpan(group) {
 4354  if (group instanceof Span) {
 4355    return group;
 4356  } else {
 4357    throw new Error("Expected span<HtmlDomNode> but got " + String(group) + ".");
 4358  }
 4359}
 4360;// CONCATENATED MODULE: ./src/symbols.js
 4361/**
 4362 * This file holds a list of all no-argument functions and single-character
 4363 * symbols (like 'a' or ';').
 4364 *
 4365 * For each of the symbols, there are three properties they can have:
 4366 * - font (required): the font to be used for this symbol. Either "main" (the
 4367     normal font), or "ams" (the ams fonts).
 4368 * - group (required): the ParseNode group type the symbol should have (i.e.
 4369     "textord", "mathord", etc).
 4370     See https://github.com/KaTeX/KaTeX/wiki/Examining-TeX#group-types
 4371 * - replace: the character that this symbol or function should be
 4372 *   replaced with (i.e. "\phi" has a replace value of "\u03d5", the phi
 4373 *   character in the main font).
 4374 *
 4375 * The outermost map in the table indicates what mode the symbols should be
 4376 * accepted in (e.g. "math" or "text").
 4377 */
 4378// Some of these have a "-token" suffix since these are also used as `ParseNode`
 4379// types for raw text tokens, and we want to avoid conflicts with higher-level
 4380// `ParseNode` types. These `ParseNode`s are constructed within `Parser` by
 4381// looking up the `symbols` map.
 4382var ATOMS = {
 4383  "bin": 1,
 4384  "close": 1,
 4385  "inner": 1,
 4386  "open": 1,
 4387  "punct": 1,
 4388  "rel": 1
 4389};
 4390var NON_ATOMS = {
 4391  "accent-token": 1,
 4392  "mathord": 1,
 4393  "op-token": 1,
 4394  "spacing": 1,
 4395  "textord": 1
 4396};
 4397var symbols = {
 4398  "math": {},
 4399  "text": {}
 4400};
 4401/* harmony default export */ var src_symbols = (symbols);
 4402/** `acceptUnicodeChar = true` is only applicable if `replace` is set. */
 4403
 4404function defineSymbol(mode, font, group, replace, name, acceptUnicodeChar) {
 4405  symbols[mode][name] = {
 4406    font: font,
 4407    group: group,
 4408    replace: replace
 4409  };
 4410
 4411  if (acceptUnicodeChar && replace) {
 4412    symbols[mode][replace] = symbols[mode][name];
 4413  }
 4414} // Some abbreviations for commonly used strings.
 4415// This helps minify the code, and also spotting typos using jshint.
 4416// modes:
 4417
 4418var math = "math";
 4419var symbols_text = "text"; // fonts:
 4420
 4421var main = "main";
 4422var ams = "ams"; // groups:
 4423
 4424var accent = "accent-token";
 4425var bin = "bin";
 4426var symbols_close = "close";
 4427var inner = "inner";
 4428var mathord = "mathord";
 4429var op = "op-token";
 4430var symbols_open = "open";
 4431var punct = "punct";
 4432var rel = "rel";
 4433var spacing = "spacing";
 4434var textord = "textord"; // Now comes the symbol table
 4435// Relation Symbols
 4436
 4437defineSymbol(math, main, rel, "\u2261", "\\equiv", true);
 4438defineSymbol(math, main, rel, "\u227A", "\\prec", true);
 4439defineSymbol(math, main, rel, "\u227B", "\\succ", true);
 4440defineSymbol(math, main, rel, "\u223C", "\\sim", true);
 4441defineSymbol(math, main, rel, "\u22A5", "\\perp");
 4442defineSymbol(math, main, rel, "\u2AAF", "\\preceq", true);
 4443defineSymbol(math, main, rel, "\u2AB0", "\\succeq", true);
 4444defineSymbol(math, main, rel, "\u2243", "\\simeq", true);
 4445defineSymbol(math, main, rel, "\u2223", "\\mid", true);
 4446defineSymbol(math, main, rel, "\u226A", "\\ll", true);
 4447defineSymbol(math, main, rel, "\u226B", "\\gg", true);
 4448defineSymbol(math, main, rel, "\u224D", "\\asymp", true);
 4449defineSymbol(math, main, rel, "\u2225", "\\parallel");
 4450defineSymbol(math, main, rel, "\u22C8", "\\bowtie", true);
 4451defineSymbol(math, main, rel, "\u2323", "\\smile", true);
 4452defineSymbol(math, main, rel, "\u2291", "\\sqsubseteq", true);
 4453defineSymbol(math, main, rel, "\u2292", "\\sqsupseteq", true);
 4454defineSymbol(math, main, rel, "\u2250", "\\doteq", true);
 4455defineSymbol(math, main, rel, "\u2322", "\\frown", true);
 4456defineSymbol(math, main, rel, "\u220B", "\\ni", true);
 4457defineSymbol(math, main, rel, "\u221D", "\\propto", true);
 4458defineSymbol(math, main, rel, "\u22A2", "\\vdash", true);
 4459defineSymbol(math, main, rel, "\u22A3", "\\dashv", true);
 4460defineSymbol(math, main, rel, "\u220B", "\\owns"); // Punctuation
 4461
 4462defineSymbol(math, main, punct, ".", "\\ldotp");
 4463defineSymbol(math, main, punct, "\u22C5", "\\cdotp"); // Misc Symbols
 4464
 4465defineSymbol(math, main, textord, "#", "\\#");
 4466defineSymbol(symbols_text, main, textord, "#", "\\#");
 4467defineSymbol(math, main, textord, "&", "\\&");
 4468defineSymbol(symbols_text, main, textord, "&", "\\&");
 4469defineSymbol(math, main, textord, "\u2135", "\\aleph", true);
 4470defineSymbol(math, main, textord, "\u2200", "\\forall", true);
 4471defineSymbol(math, main, textord, "\u210F", "\\hbar", true);
 4472defineSymbol(math, main, textord, "\u2203", "\\exists", true);
 4473defineSymbol(math, main, textord, "\u2207", "\\nabla", true);
 4474defineSymbol(math, main, textord, "\u266D", "\\flat", true);
 4475defineSymbol(math, main, textord, "\u2113", "\\ell", true);
 4476defineSymbol(math, main, textord, "\u266E", "\\natural", true);
 4477defineSymbol(math, main, textord, "\u2663", "\\clubsuit", true);
 4478defineSymbol(math, main, textord, "\u2118", "\\wp", true);
 4479defineSymbol(math, main, textord, "\u266F", "\\sharp", true);
 4480defineSymbol(math, main, textord, "\u2662", "\\diamondsuit", true);
 4481defineSymbol(math, main, textord, "\u211C", "\\Re", true);
 4482defineSymbol(math, main, textord, "\u2661", "\\heartsuit", true);
 4483defineSymbol(math, main, textord, "\u2111", "\\Im", true);
 4484defineSymbol(math, main, textord, "\u2660", "\\spadesuit", true);
 4485defineSymbol(math, main, textord, "\xA7", "\\S", true);
 4486defineSymbol(symbols_text, main, textord, "\xA7", "\\S");
 4487defineSymbol(math, main, textord, "\xB6", "\\P", true);
 4488defineSymbol(symbols_text, main, textord, "\xB6", "\\P"); // Math and Text
 4489
 4490defineSymbol(math, main, textord, "\u2020", "\\dag");
 4491defineSymbol(symbols_text, main, textord, "\u2020", "\\dag");
 4492defineSymbol(symbols_text, main, textord, "\u2020", "\\textdagger");
 4493defineSymbol(math, main, textord, "\u2021", "\\ddag");
 4494defineSymbol(symbols_text, main, textord, "\u2021", "\\ddag");
 4495defineSymbol(symbols_text, main, textord, "\u2021", "\\textdaggerdbl"); // Large Delimiters
 4496
 4497defineSymbol(math, main, symbols_close, "\u23B1", "\\rmoustache", true);
 4498defineSymbol(math, main, symbols_open, "\u23B0", "\\lmoustache", true);
 4499defineSymbol(math, main, symbols_close, "\u27EF", "\\rgroup", true);
 4500defineSymbol(math, main, symbols_open, "\u27EE", "\\lgroup", true); // Binary Operators
 4501
 4502defineSymbol(math, main, bin, "\u2213", "\\mp", true);
 4503defineSymbol(math, main, bin, "\u2296", "\\ominus", true);
 4504defineSymbol(math, main, bin, "\u228E", "\\uplus", true);
 4505defineSymbol(math, main, bin, "\u2293", "\\sqcap", true);
 4506defineSymbol(math, main, bin, "\u2217", "\\ast");
 4507defineSymbol(math, main, bin, "\u2294", "\\sqcup", true);
 4508defineSymbol(math, main, bin, "\u25EF", "\\bigcirc", true);
 4509defineSymbol(math, main, bin, "\u2219", "\\bullet", true);
 4510defineSymbol(math, main, bin, "\u2021", "\\ddagger");
 4511defineSymbol(math, main, bin, "\u2240", "\\wr", true);
 4512defineSymbol(math, main, bin, "\u2A3F", "\\amalg");
 4513defineSymbol(math, main, bin, "&", "\\And"); // from amsmath
 4514// Arrow Symbols
 4515
 4516defineSymbol(math, main, rel, "\u27F5", "\\longleftarrow", true);
 4517defineSymbol(math, main, rel, "\u21D0", "\\Leftarrow", true);
 4518defineSymbol(math, main, rel, "\u27F8", "\\Longleftarrow", true);
 4519defineSymbol(math, main, rel, "\u27F6", "\\longrightarrow", true);
 4520defineSymbol(math, main, rel, "\u21D2", "\\Rightarrow", true);
 4521defineSymbol(math, main, rel, "\u27F9", "\\Longrightarrow", true);
 4522defineSymbol(math, main, rel, "\u2194", "\\leftrightarrow", true);
 4523defineSymbol(math, main, rel, "\u27F7", "\\longleftrightarrow", true);
 4524defineSymbol(math, main, rel, "\u21D4", "\\Leftrightarrow", true);
 4525defineSymbol(math, main, rel, "\u27FA", "\\Longleftrightarrow", true);
 4526defineSymbol(math, main, rel, "\u21A6", "\\mapsto", true);
 4527defineSymbol(math, main, rel, "\u27FC", "\\longmapsto", true);
 4528defineSymbol(math, main, rel, "\u2197", "\\nearrow", true);
 4529defineSymbol(math, main, rel, "\u21A9", "\\hookleftarrow", true);
 4530defineSymbol(math, main, rel, "\u21AA", "\\hookrightarrow", true);
 4531defineSymbol(math, main, rel, "\u2198", "\\searrow", true);
 4532defineSymbol(math, main, rel, "\u21BC", "\\leftharpoonup", true);
 4533defineSymbol(math, main, rel, "\u21C0", "\\rightharpoonup", true);
 4534defineSymbol(math, main, rel, "\u2199", "\\swarrow", true);
 4535defineSymbol(math, main, rel, "\u21BD", "\\leftharpoondown", true);
 4536defineSymbol(math, main, rel, "\u21C1", "\\rightharpoondown", true);
 4537defineSymbol(math, main, rel, "\u2196", "\\nwarrow", true);
 4538defineSymbol(math, main, rel, "\u21CC", "\\rightleftharpoons", true); // AMS Negated Binary Relations
 4539
 4540defineSymbol(math, ams, rel, "\u226E", "\\nless", true); // Symbol names preceeded by "@" each have a corresponding macro.
 4541
 4542defineSymbol(math, ams, rel, "\uE010", "\\@nleqslant");
 4543defineSymbol(math, ams, rel, "\uE011", "\\@nleqq");
 4544defineSymbol(math, ams, rel, "\u2A87", "\\lneq", true);
 4545defineSymbol(math, ams, rel, "\u2268", "\\lneqq", true);
 4546defineSymbol(math, ams, rel, "\uE00C", "\\@lvertneqq");
 4547defineSymbol(math, ams, rel, "\u22E6", "\\lnsim", true);
 4548defineSymbol(math, ams, rel, "\u2A89", "\\lnapprox", true);
 4549defineSymbol(math, ams, rel, "\u2280", "\\nprec", true); // unicode-math maps \u22e0 to \npreccurlyeq. We'll use the AMS synonym.
 4550
 4551defineSymbol(math, ams, rel, "\u22E0", "\\npreceq", true);
 4552defineSymbol(math, ams, rel, "\u22E8", "\\precnsim", true);
 4553defineSymbol(math, ams, rel, "\u2AB9", "\\precnapprox", true);
 4554defineSymbol(math, ams, rel, "\u2241", "\\nsim", true);
 4555defineSymbol(math, ams, rel, "\uE006", "\\@nshortmid");
 4556defineSymbol(math, ams, rel, "\u2224", "\\nmid", true);
 4557defineSymbol(math, ams, rel, "\u22AC", "\\nvdash", true);
 4558defineSymbol(math, ams, rel, "\u22AD", "\\nvDash", true);
 4559defineSymbol(math, ams, rel, "\u22EA", "\\ntriangleleft");
 4560defineSymbol(math, ams, rel, "\u22EC", "\\ntrianglelefteq", true);
 4561defineSymbol(math, ams, rel, "\u228A", "\\subsetneq", true);
 4562defineSymbol(math, ams, rel, "\uE01A", "\\@varsubsetneq");
 4563defineSymbol(math, ams, rel, "\u2ACB", "\\subsetneqq", true);
 4564defineSymbol(math, ams, rel, "\uE017", "\\@varsubsetneqq");
 4565defineSymbol(math, ams, rel, "\u226F", "\\ngtr", true);
 4566defineSymbol(math, ams, rel, "\uE00F", "\\@ngeqslant");
 4567defineSymbol(math, ams, rel, "\uE00E", "\\@ngeqq");
 4568defineSymbol(math, ams, rel, "\u2A88", "\\gneq", true);
 4569defineSymbol(math, ams, rel, "\u2269", "\\gneqq", true);
 4570defineSymbol(math, ams, rel, "\uE00D", "\\@gvertneqq");
 4571defineSymbol(math, ams, rel, "\u22E7", "\\gnsim", true);
 4572defineSymbol(math, ams, rel, "\u2A8A", "\\gnapprox", true);
 4573defineSymbol(math, ams, rel, "\u2281", "\\nsucc", true); // unicode-math maps \u22e1 to \nsucccurlyeq. We'll use the AMS synonym.
 4574
 4575defineSymbol(math, ams, rel, "\u22E1", "\\nsucceq", true);
 4576defineSymbol(math, ams, rel, "\u22E9", "\\succnsim", true);
 4577defineSymbol(math, ams, rel, "\u2ABA", "\\succnapprox", true); // unicode-math maps \u2246 to \simneqq. We'll use the AMS synonym.
 4578
 4579defineSymbol(math, ams, rel, "\u2246", "\\ncong", true);
 4580defineSymbol(math, ams, rel, "\uE007", "\\@nshortparallel");
 4581defineSymbol(math, ams, rel, "\u2226", "\\nparallel", true);
 4582defineSymbol(math, ams, rel, "\u22AF", "\\nVDash", true);
 4583defineSymbol(math, ams, rel, "\u22EB", "\\ntriangleright");
 4584defineSymbol(math, ams, rel, "\u22ED", "\\ntrianglerighteq", true);
 4585defineSymbol(math, ams, rel, "\uE018", "\\@nsupseteqq");
 4586defineSymbol(math, ams, rel, "\u228B", "\\supsetneq", true);
 4587defineSymbol(math, ams, rel, "\uE01B", "\\@varsupsetneq");
 4588defineSymbol(math, ams, rel, "\u2ACC", "\\supsetneqq", true);
 4589defineSymbol(math, ams, rel, "\uE019", "\\@varsupsetneqq");
 4590defineSymbol(math, ams, rel, "\u22AE", "\\nVdash", true);
 4591defineSymbol(math, ams, rel, "\u2AB5", "\\precneqq", true);
 4592defineSymbol(math, ams, rel, "\u2AB6", "\\succneqq", true);
 4593defineSymbol(math, ams, rel, "\uE016", "\\@nsubseteqq");
 4594defineSymbol(math, ams, bin, "\u22B4", "\\unlhd");
 4595defineSymbol(math, ams, bin, "\u22B5", "\\unrhd"); // AMS Negated Arrows
 4596
 4597defineSymbol(math, ams, rel, "\u219A", "\\nleftarrow", true);
 4598defineSymbol(math, ams, rel, "\u219B", "\\nrightarrow", true);
 4599defineSymbol(math, ams, rel, "\u21CD", "\\nLeftarrow", true);
 4600defineSymbol(math, ams, rel, "\u21CF", "\\nRightarrow", true);
 4601defineSymbol(math, ams, rel, "\u21AE", "\\nleftrightarrow", true);
 4602defineSymbol(math, ams, rel, "\u21CE", "\\nLeftrightarrow", true); // AMS Misc
 4603
 4604defineSymbol(math, ams, rel, "\u25B3", "\\vartriangle");
 4605defineSymbol(math, ams, textord, "\u210F", "\\hslash");
 4606defineSymbol(math, ams, textord, "\u25BD", "\\triangledown");
 4607defineSymbol(math, ams, textord, "\u25CA", "\\lozenge");
 4608defineSymbol(math, ams, textord, "\u24C8", "\\circledS");
 4609defineSymbol(math, ams, textord, "\xAE", "\\circledR");
 4610defineSymbol(symbols_text, ams, textord, "\xAE", "\\circledR");
 4611defineSymbol(math, ams, textord, "\u2221", "\\measuredangle", true);
 4612defineSymbol(math, ams, textord, "\u2204", "\\nexists");
 4613defineSymbol(math, ams, textord, "\u2127", "\\mho");
 4614defineSymbol(math, ams, textord, "\u2132", "\\Finv", true);
 4615defineSymbol(math, ams, textord, "\u2141", "\\Game", true);
 4616defineSymbol(math, ams, textord, "\u2035", "\\backprime");
 4617defineSymbol(math, ams, textord, "\u25B2", "\\blacktriangle");
 4618defineSymbol(math, ams, textord, "\u25BC", "\\blacktriangledown");
 4619defineSymbol(math, ams, textord, "\u25A0", "\\blacksquare");
 4620defineSymbol(math, ams, textord, "\u29EB", "\\blacklozenge");
 4621defineSymbol(math, ams, textord, "\u2605", "\\bigstar");
 4622defineSymbol(math, ams, textord, "\u2222", "\\sphericalangle", true);
 4623defineSymbol(math, ams, textord, "\u2201", "\\complement", true); // unicode-math maps U+F0 to \matheth. We map to AMS function \eth
 4624
 4625defineSymbol(math, ams, textord, "\xF0", "\\eth", true);
 4626defineSymbol(symbols_text, main, textord, "\xF0", "\xF0");
 4627defineSymbol(math, ams, textord, "\u2571", "\\diagup");
 4628defineSymbol(math, ams, textord, "\u2572", "\\diagdown");
 4629defineSymbol(math, ams, textord, "\u25A1", "\\square");
 4630defineSymbol(math, ams, textord, "\u25A1", "\\Box");
 4631defineSymbol(math, ams, textord, "\u25CA", "\\Diamond"); // unicode-math maps U+A5 to \mathyen. We map to AMS function \yen
 4632
 4633defineSymbol(math, ams, textord, "\xA5", "\\yen", true);
 4634defineSymbol(symbols_text, ams, textord, "\xA5", "\\yen", true);
 4635defineSymbol(math, ams, textord, "\u2713", "\\checkmark", true);
 4636defineSymbol(symbols_text, ams, textord, "\u2713", "\\checkmark"); // AMS Hebrew
 4637
 4638defineSymbol(math, ams, textord, "\u2136", "\\beth", true);
 4639defineSymbol(math, ams, textord, "\u2138", "\\daleth", true);
 4640defineSymbol(math, ams, textord, "\u2137", "\\gimel", true); // AMS Greek
 4641
 4642defineSymbol(math, ams, textord, "\u03DD", "\\digamma", true);
 4643defineSymbol(math, ams, textord, "\u03F0", "\\varkappa"); // AMS Delimiters
 4644
 4645defineSymbol(math, ams, symbols_open, "\u250C", "\\@ulcorner", true);
 4646defineSymbol(math, ams, symbols_close, "\u2510", "\\@urcorner", true);
 4647defineSymbol(math, ams, symbols_open, "\u2514", "\\@llcorner", true);
 4648defineSymbol(math, ams, symbols_close, "\u2518", "\\@lrcorner", true); // AMS Binary Relations
 4649
 4650defineSymbol(math, ams, rel, "\u2266", "\\leqq", true);
 4651defineSymbol(math, ams, rel, "\u2A7D", "\\leqslant", true);
 4652defineSymbol(math, ams, rel, "\u2A95", "\\eqslantless", true);
 4653defineSymbol(math, ams, rel, "\u2272", "\\lesssim", true);
 4654defineSymbol(math, ams, rel, "\u2A85", "\\lessapprox", true);
 4655defineSymbol(math, ams, rel, "\u224A", "\\approxeq", true);
 4656defineSymbol(math, ams, bin, "\u22D6", "\\lessdot");
 4657defineSymbol(math, ams, rel, "\u22D8", "\\lll", true);
 4658defineSymbol(math, ams, rel, "\u2276", "\\lessgtr", true);
 4659defineSymbol(math, ams, rel, "\u22DA", "\\lesseqgtr", true);
 4660defineSymbol(math, ams, rel, "\u2A8B", "\\lesseqqgtr", true);
 4661defineSymbol(math, ams, rel, "\u2251", "\\doteqdot");
 4662defineSymbol(math, ams, rel, "\u2253", "\\risingdotseq", true);
 4663defineSymbol(math, ams, rel, "\u2252", "\\fallingdotseq", true);
 4664defineSymbol(math, ams, rel, "\u223D", "\\backsim", true);
 4665defineSymbol(math, ams, rel, "\u22CD", "\\backsimeq", true);
 4666defineSymbol(math, ams, rel, "\u2AC5", "\\subseteqq", true);
 4667defineSymbol(math, ams, rel, "\u22D0", "\\Subset", true);
 4668defineSymbol(math, ams, rel, "\u228F", "\\sqsubset", true);
 4669defineSymbol(math, ams, rel, "\u227C", "\\preccurlyeq", true);
 4670defineSymbol(math, ams, rel, "\u22DE", "\\curlyeqprec", true);
 4671defineSymbol(math, ams, rel, "\u227E", "\\precsim", true);
 4672defineSymbol(math, ams, rel, "\u2AB7", "\\precapprox", true);
 4673defineSymbol(math, ams, rel, "\u22B2", "\\vartriangleleft");
 4674defineSymbol(math, ams, rel, "\u22B4", "\\trianglelefteq");
 4675defineSymbol(math, ams, rel, "\u22A8", "\\vDash", true);
 4676defineSymbol(math, ams, rel, "\u22AA", "\\Vvdash", true);
 4677defineSymbol(math, ams, rel, "\u2323", "\\smallsmile");
 4678defineSymbol(math, ams, rel, "\u2322", "\\smallfrown");
 4679defineSymbol(math, ams, rel, "\u224F", "\\bumpeq", true);
 4680defineSymbol(math, ams, rel, "\u224E", "\\Bumpeq", true);
 4681defineSymbol(math, ams, rel, "\u2267", "\\geqq", true);
 4682defineSymbol(math, ams, rel, "\u2A7E", "\\geqslant", true);
 4683defineSymbol(math, ams, rel, "\u2A96", "\\eqslantgtr", true);
 4684defineSymbol(math, ams, rel, "\u2273", "\\gtrsim", true);
 4685defineSymbol(math, ams, rel, "\u2A86", "\\gtrapprox", true);
 4686defineSymbol(math, ams, bin, "\u22D7", "\\gtrdot");
 4687defineSymbol(math, ams, rel, "\u22D9", "\\ggg", true);
 4688defineSymbol(math, ams, rel, "\u2277", "\\gtrless", true);
 4689defineSymbol(math, ams, rel, "\u22DB", "\\gtreqless", true);
 4690defineSymbol(math, ams, rel, "\u2A8C", "\\gtreqqless", true);
 4691defineSymbol(math, ams, rel, "\u2256", "\\eqcirc", true);
 4692defineSymbol(math, ams, rel, "\u2257", "\\circeq", true);
 4693defineSymbol(math, ams, rel, "\u225C", "\\triangleq", true);
 4694defineSymbol(math, ams, rel, "\u223C", "\\thicksim");
 4695defineSymbol(math, ams, rel, "\u2248", "\\thickapprox");
 4696defineSymbol(math, ams, rel, "\u2AC6", "\\supseteqq", true);
 4697defineSymbol(math, ams, rel, "\u22D1", "\\Supset", true);
 4698defineSymbol(math, ams, rel, "\u2290", "\\sqsupset", true);
 4699defineSymbol(math, ams, rel, "\u227D", "\\succcurlyeq", true);
 4700defineSymbol(math, ams, rel, "\u22DF", "\\curlyeqsucc", true);
 4701defineSymbol(math, ams, rel, "\u227F", "\\succsim", true);
 4702defineSymbol(math, ams, rel, "\u2AB8", "\\succapprox", true);
 4703defineSymbol(math, ams, rel, "\u22B3", "\\vartriangleright");
 4704defineSymbol(math, ams, rel, "\u22B5", "\\trianglerighteq");
 4705defineSymbol(math, ams, rel, "\u22A9", "\\Vdash", true);
 4706defineSymbol(math, ams, rel, "\u2223", "\\shortmid");
 4707defineSymbol(math, ams, rel, "\u2225", "\\shortparallel");
 4708defineSymbol(math, ams, rel, "\u226C", "\\between", true);
 4709defineSymbol(math, ams, rel, "\u22D4", "\\pitchfork", true);
 4710defineSymbol(math, ams, rel, "\u221D", "\\varpropto");
 4711defineSymbol(math, ams, rel, "\u25C0", "\\blacktriangleleft"); // unicode-math says that \therefore is a mathord atom.
 4712// We kept the amssymb atom type, which is rel.
 4713
 4714defineSymbol(math, ams, rel, "\u2234", "\\therefore", true);
 4715defineSymbol(math, ams, rel, "\u220D", "\\backepsilon");
 4716defineSymbol(math, ams, rel, "\u25B6", "\\blacktriangleright"); // unicode-math says that \because is a mathord atom.
 4717// We kept the amssymb atom type, which is rel.
 4718
 4719defineSymbol(math, ams, rel, "\u2235", "\\because", true);
 4720defineSymbol(math, ams, rel, "\u22D8", "\\llless");
 4721defineSymbol(math, ams, rel, "\u22D9", "\\gggtr");
 4722defineSymbol(math, ams, bin, "\u22B2", "\\lhd");
 4723defineSymbol(math, ams, bin, "\u22B3", "\\rhd");
 4724defineSymbol(math, ams, rel, "\u2242", "\\eqsim", true);
 4725defineSymbol(math, main, rel, "\u22C8", "\\Join");
 4726defineSymbol(math, ams, rel, "\u2251", "\\Doteq", true); // AMS Binary Operators
 4727
 4728defineSymbol(math, ams, bin, "\u2214", "\\dotplus", true);
 4729defineSymbol(math, ams, bin, "\u2216", "\\smallsetminus");
 4730defineSymbol(math, ams, bin, "\u22D2", "\\Cap", true);
 4731defineSymbol(math, ams, bin, "\u22D3", "\\Cup", true);
 4732defineSymbol(math, ams, bin, "\u2A5E", "\\doublebarwedge", true);
 4733defineSymbol(math, ams, bin, "\u229F", "\\boxminus", true);
 4734defineSymbol(math, ams, bin, "\u229E", "\\boxplus", true);
 4735defineSymbol(math, ams, bin, "\u22C7", "\\divideontimes", true);
 4736defineSymbol(math, ams, bin, "\u22C9", "\\ltimes", true);
 4737defineSymbol(math, ams, bin, "\u22CA", "\\rtimes", true);
 4738defineSymbol(math, ams, bin, "\u22CB", "\\leftthreetimes", true);
 4739defineSymbol(math, ams, bin, "\u22CC", "\\rightthreetimes", true);
 4740defineSymbol(math, ams, bin, "\u22CF", "\\curlywedge", true);
 4741defineSymbol(math, ams, bin, "\u22CE", "\\curlyvee", true);
 4742defineSymbol(math, ams, bin, "\u229D", "\\circleddash", true);
 4743defineSymbol(math, ams, bin, "\u229B", "\\circledast", true);
 4744defineSymbol(math, ams, bin, "\u22C5", "\\centerdot");
 4745defineSymbol(math, ams, bin, "\u22BA", "\\intercal", true);
 4746defineSymbol(math, ams, bin, "\u22D2", "\\doublecap");
 4747defineSymbol(math, ams, bin, "\u22D3", "\\doublecup");
 4748defineSymbol(math, ams, bin, "\u22A0", "\\boxtimes", true); // AMS Arrows
 4749// Note: unicode-math maps \u21e2 to their own function \rightdasharrow.
 4750// We'll map it to AMS function \dashrightarrow. It produces the same atom.
 4751
 4752defineSymbol(math, ams, rel, "\u21E2", "\\dashrightarrow", true); // unicode-math maps \u21e0 to \leftdasharrow. We'll use the AMS synonym.
 4753
 4754defineSymbol(math, ams, rel, "\u21E0", "\\dashleftarrow", true);
 4755defineSymbol(math, ams, rel, "\u21C7", "\\leftleftarrows", true);
 4756defineSymbol(math, ams, rel, "\u21C6", "\\leftrightarrows", true);
 4757defineSymbol(math, ams, rel, "\u21DA", "\\Lleftarrow", true);
 4758defineSymbol(math, ams, rel, "\u219E", "\\twoheadleftarrow", true);
 4759defineSymbol(math, ams, rel, "\u21A2", "\\leftarrowtail", true);
 4760defineSymbol(math, ams, rel, "\u21AB", "\\looparrowleft", true);
 4761defineSymbol(math, ams, rel, "\u21CB", "\\leftrightharpoons", true);
 4762defineSymbol(math, ams, rel, "\u21B6", "\\curvearrowleft", true); // unicode-math maps \u21ba to \acwopencirclearrow. We'll use the AMS synonym.
 4763
 4764defineSymbol(math, ams, rel, "\u21BA", "\\circlearrowleft", true);
 4765defineSymbol(math, ams, rel, "\u21B0", "\\Lsh", true);
 4766defineSymbol(math, ams, rel, "\u21C8", "\\upuparrows", true);
 4767defineSymbol(math, ams, rel, "\u21BF", "\\upharpoonleft", true);
 4768defineSymbol(math, ams, rel, "\u21C3", "\\downharpoonleft", true);
 4769defineSymbol(math, main, rel, "\u22B6", "\\origof", true); // not in font
 4770
 4771defineSymbol(math, main, rel, "\u22B7", "\\imageof", true); // not in font
 4772
 4773defineSymbol(math, ams, rel, "\u22B8", "\\multimap", true);
 4774defineSymbol(math, ams, rel, "\u21AD", "\\leftrightsquigarrow", true);
 4775defineSymbol(math, ams, rel, "\u21C9", "\\rightrightarrows", true);
 4776defineSymbol(math, ams, rel, "\u21C4", "\\rightleftarrows", true);
 4777defineSymbol(math, ams, rel, "\u21A0", "\\twoheadrightarrow", true);
 4778defineSymbol(math, ams, rel, "\u21A3", "\\rightarrowtail", true);
 4779defineSymbol(math, ams, rel, "\u21AC", "\\looparrowright", true);
 4780defineSymbol(math, ams, rel, "\u21B7", "\\curvearrowright", true); // unicode-math maps \u21bb to \cwopencirclearrow. We'll use the AMS synonym.
 4781
 4782defineSymbol(math, ams, rel, "\u21BB", "\\circlearrowright", true);
 4783defineSymbol(math, ams, rel, "\u21B1", "\\Rsh", true);
 4784defineSymbol(math, ams, rel, "\u21CA", "\\downdownarrows", true);
 4785defineSymbol(math, ams, rel, "\u21BE", "\\upharpoonright", true);
 4786defineSymbol(math, ams, rel, "\u21C2", "\\downharpoonright", true);
 4787defineSymbol(math, ams, rel, "\u21DD", "\\rightsquigarrow", true);
 4788defineSymbol(math, ams, rel, "\u21DD", "\\leadsto");
 4789defineSymbol(math, ams, rel, "\u21DB", "\\Rrightarrow", true);
 4790defineSymbol(math, ams, rel, "\u21BE", "\\restriction");
 4791defineSymbol(math, main, textord, "\u2018", "`");
 4792defineSymbol(math, main, textord, "$", "\\$");
 4793defineSymbol(symbols_text, main, textord, "$", "\\$");
 4794defineSymbol(symbols_text, main, textord, "$", "\\textdollar");
 4795defineSymbol(math, main, textord, "%", "\\%");
 4796defineSymbol(symbols_text, main, textord, "%", "\\%");
 4797defineSymbol(math, main, textord, "_", "\\_");
 4798defineSymbol(symbols_text, main, textord, "_", "\\_");
 4799defineSymbol(symbols_text, main, textord, "_", "\\textunderscore");
 4800defineSymbol(math, main, textord, "\u2220", "\\angle", true);
 4801defineSymbol(math, main, textord, "\u221E", "\\infty", true);
 4802defineSymbol(math, main, textord, "\u2032", "\\prime");
 4803defineSymbol(math, main, textord, "\u25B3", "\\triangle");
 4804defineSymbol(math, main, textord, "\u0393", "\\Gamma", true);
 4805defineSymbol(math, main, textord, "\u0394", "\\Delta", true);
 4806defineSymbol(math, main, textord, "\u0398", "\\Theta", true);
 4807defineSymbol(math, main, textord, "\u039B", "\\Lambda", true);
 4808defineSymbol(math, main, textord, "\u039E", "\\Xi", true);
 4809defineSymbol(math, main, textord, "\u03A0", "\\Pi", true);
 4810defineSymbol(math, main, textord, "\u03A3", "\\Sigma", true);
 4811defineSymbol(math, main, textord, "\u03A5", "\\Upsilon", true);
 4812defineSymbol(math, main, textord, "\u03A6", "\\Phi", true);
 4813defineSymbol(math, main, textord, "\u03A8", "\\Psi", true);
 4814defineSymbol(math, main, textord, "\u03A9", "\\Omega", true);
 4815defineSymbol(math, main, textord, "A", "\u0391");
 4816defineSymbol(math, main, textord, "B", "\u0392");
 4817defineSymbol(math, main, textord, "E", "\u0395");
 4818defineSymbol(math, main, textord, "Z", "\u0396");
 4819defineSymbol(math, main, textord, "H", "\u0397");
 4820defineSymbol(math, main, textord, "I", "\u0399");
 4821defineSymbol(math, main, textord, "K", "\u039A");
 4822defineSymbol(math, main, textord, "M", "\u039C");
 4823defineSymbol(math, main, textord, "N", "\u039D");
 4824defineSymbol(math, main, textord, "O", "\u039F");
 4825defineSymbol(math, main, textord, "P", "\u03A1");
 4826defineSymbol(math, main, textord, "T", "\u03A4");
 4827defineSymbol(math, main, textord, "X", "\u03A7");
 4828defineSymbol(math, main, textord, "\xAC", "\\neg", true);
 4829defineSymbol(math, main, textord, "\xAC", "\\lnot");
 4830defineSymbol(math, main, textord, "\u22A4", "\\top");
 4831defineSymbol(math, main, textord, "\u22A5", "\\bot");
 4832defineSymbol(math, main, textord, "\u2205", "\\emptyset");
 4833defineSymbol(math, ams, textord, "\u2205", "\\varnothing");
 4834defineSymbol(math, main, mathord, "\u03B1", "\\alpha", true);
 4835defineSymbol(math, main, mathord, "\u03B2", "\\beta", true);
 4836defineSymbol(math, main, mathord, "\u03B3", "\\gamma", true);
 4837defineSymbol(math, main, mathord, "\u03B4", "\\delta", true);
 4838defineSymbol(math, main, mathord, "\u03F5", "\\epsilon", true);
 4839defineSymbol(math, main, mathord, "\u03B6", "\\zeta", true);
 4840defineSymbol(math, main, mathord, "\u03B7", "\\eta", true);
 4841defineSymbol(math, main, mathord, "\u03B8", "\\theta", true);
 4842defineSymbol(math, main, mathord, "\u03B9", "\\iota", true);
 4843defineSymbol(math, main, mathord, "\u03BA", "\\kappa", true);
 4844defineSymbol(math, main, mathord, "\u03BB", "\\lambda", true);
 4845defineSymbol(math, main, mathord, "\u03BC", "\\mu", true);
 4846defineSymbol(math, main, mathord, "\u03BD", "\\nu", true);
 4847defineSymbol(math, main, mathord, "\u03BE", "\\xi", true);
 4848defineSymbol(math, main, mathord, "\u03BF", "\\omicron", true);
 4849defineSymbol(math, main, mathord, "\u03C0", "\\pi", true);
 4850defineSymbol(math, main, mathord, "\u03C1", "\\rho", true);
 4851defineSymbol(math, main, mathord, "\u03C3", "\\sigma", true);
 4852defineSymbol(math, main, mathord, "\u03C4", "\\tau", true);
 4853defineSymbol(math, main, mathord, "\u03C5", "\\upsilon", true);
 4854defineSymbol(math, main, mathord, "\u03D5", "\\phi", true);
 4855defineSymbol(math, main, mathord, "\u03C7", "\\chi", true);
 4856defineSymbol(math, main, mathord, "\u03C8", "\\psi", true);
 4857defineSymbol(math, main, mathord, "\u03C9", "\\omega", true);
 4858defineSymbol(math, main, mathord, "\u03B5", "\\varepsilon", true);
 4859defineSymbol(math, main, mathord, "\u03D1", "\\vartheta", true);
 4860defineSymbol(math, main, mathord, "\u03D6", "\\varpi", true);
 4861defineSymbol(math, main, mathord, "\u03F1", "\\varrho", true);
 4862defineSymbol(math, main, mathord, "\u03C2", "\\varsigma", true);
 4863defineSymbol(math, main, mathord, "\u03C6", "\\varphi", true);
 4864defineSymbol(math, main, bin, "\u2217", "*", true);
 4865defineSymbol(math, main, bin, "+", "+");
 4866defineSymbol(math, main, bin, "\u2212", "-", true);
 4867defineSymbol(math, main, bin, "\u22C5", "\\cdot", true);
 4868defineSymbol(math, main, bin, "\u2218", "\\circ", true);
 4869defineSymbol(math, main, bin, "\xF7", "\\div", true);
 4870defineSymbol(math, main, bin, "\xB1", "\\pm", true);
 4871defineSymbol(math, main, bin, "\xD7", "\\times", true);
 4872defineSymbol(math, main, bin, "\u2229", "\\cap", true);
 4873defineSymbol(math, main, bin, "\u222A", "\\cup", true);
 4874defineSymbol(math, main, bin, "\u2216", "\\setminus", true);
 4875defineSymbol(math, main, bin, "\u2227", "\\land");
 4876defineSymbol(math, main, bin, "\u2228", "\\lor");
 4877defineSymbol(math, main, bin, "\u2227", "\\wedge", true);
 4878defineSymbol(math, main, bin, "\u2228", "\\vee", true);
 4879defineSymbol(math, main, textord, "\u221A", "\\surd");
 4880defineSymbol(math, main, symbols_open, "\u27E8", "\\langle", true);
 4881defineSymbol(math, main, symbols_open, "\u2223", "\\lvert");
 4882defineSymbol(math, main, symbols_open, "\u2225", "\\lVert");
 4883defineSymbol(math, main, symbols_close, "?", "?");
 4884defineSymbol(math, main, symbols_close, "!", "!");
 4885defineSymbol(math, main, symbols_close, "\u27E9", "\\rangle", true);
 4886defineSymbol(math, main, symbols_close, "\u2223", "\\rvert");
 4887defineSymbol(math, main, symbols_close, "\u2225", "\\rVert");
 4888defineSymbol(math, main, rel, "=", "=");
 4889defineSymbol(math, main, rel, ":", ":");
 4890defineSymbol(math, main, rel, "\u2248", "\\approx", true);
 4891defineSymbol(math, main, rel, "\u2245", "\\cong", true);
 4892defineSymbol(math, main, rel, "\u2265", "\\ge");
 4893defineSymbol(math, main, rel, "\u2265", "\\geq", true);
 4894defineSymbol(math, main, rel, "\u2190", "\\gets");
 4895defineSymbol(math, main, rel, ">", "\\gt", true);
 4896defineSymbol(math, main, rel, "\u2208", "\\in", true);
 4897defineSymbol(math, main, rel, "\uE020", "\\@not");
 4898defineSymbol(math, main, rel, "\u2282", "\\subset", true);
 4899defineSymbol(math, main, rel, "\u2283", "\\supset", true);
 4900defineSymbol(math, main, rel, "\u2286", "\\subseteq", true);
 4901defineSymbol(math, main, rel, "\u2287", "\\supseteq", true);
 4902defineSymbol(math, ams, rel, "\u2288", "\\nsubseteq", true);
 4903defineSymbol(math, ams, rel, "\u2289", "\\nsupseteq", true);
 4904defineSymbol(math, main, rel, "\u22A8", "\\models");
 4905defineSymbol(math, main, rel, "\u2190", "\\leftarrow", true);
 4906defineSymbol(math, main, rel, "\u2264", "\\le");
 4907defineSymbol(math, main, rel, "\u2264", "\\leq", true);
 4908defineSymbol(math, main, rel, "<", "\\lt", true);
 4909defineSymbol(math, main, rel, "\u2192", "\\rightarrow", true);
 4910defineSymbol(math, main, rel, "\u2192", "\\to");
 4911defineSymbol(math, ams, rel, "\u2271", "\\ngeq", true);
 4912defineSymbol(math, ams, rel, "\u2270", "\\nleq", true);
 4913defineSymbol(math, main, spacing, "\xA0", "\\ ");
 4914defineSymbol(math, main, spacing, "\xA0", "\\space"); // Ref: LaTeX Source 2e: \DeclareRobustCommand{\nobreakspace}{%
 4915
 4916defineSymbol(math, main, spacing, "\xA0", "\\nobreakspace");
 4917defineSymbol(symbols_text, main, spacing, "\xA0", "\\ ");
 4918defineSymbol(symbols_text, main, spacing, "\xA0", " ");
 4919defineSymbol(symbols_text, main, spacing, "\xA0", "\\space");
 4920defineSymbol(symbols_text, main, spacing, "\xA0", "\\nobreakspace");
 4921defineSymbol(math, main, spacing, null, "\\nobreak");
 4922defineSymbol(math, main, spacing, null, "\\allowbreak");
 4923defineSymbol(math, main, punct, ",", ",");
 4924defineSymbol(math, main, punct, ";", ";");
 4925defineSymbol(math, ams, bin, "\u22BC", "\\barwedge", true);
 4926defineSymbol(math, ams, bin, "\u22BB", "\\veebar", true);
 4927defineSymbol(math, main, bin, "\u2299", "\\odot", true);
 4928defineSymbol(math, main, bin, "\u2295", "\\oplus", true);
 4929defineSymbol(math, main, bin, "\u2297", "\\otimes", true);
 4930defineSymbol(math, main, textord, "\u2202", "\\partial", true);
 4931defineSymbol(math, main, bin, "\u2298", "\\oslash", true);
 4932defineSymbol(math, ams, bin, "\u229A", "\\circledcirc", true);
 4933defineSymbol(math, ams, bin, "\u22A1", "\\boxdot", true);
 4934defineSymbol(math, main, bin, "\u25B3", "\\bigtriangleup");
 4935defineSymbol(math, main, bin, "\u25BD", "\\bigtriangledown");
 4936defineSymbol(math, main, bin, "\u2020", "\\dagger");
 4937defineSymbol(math, main, bin, "\u22C4", "\\diamond");
 4938defineSymbol(math, main, bin, "\u22C6", "\\star");
 4939defineSymbol(math, main, bin, "\u25C3", "\\triangleleft");
 4940defineSymbol(math, main, bin, "\u25B9", "\\triangleright");
 4941defineSymbol(math, main, symbols_open, "{", "\\{");
 4942defineSymbol(symbols_text, main, textord, "{", "\\{");
 4943defineSymbol(symbols_text, main, textord, "{", "\\textbraceleft");
 4944defineSymbol(math, main, symbols_close, "}", "\\}");
 4945defineSymbol(symbols_text, main, textord, "}", "\\}");
 4946defineSymbol(symbols_text, main, textord, "}", "\\textbraceright");
 4947defineSymbol(math, main, symbols_open, "{", "\\lbrace");
 4948defineSymbol(math, main, symbols_close, "}", "\\rbrace");
 4949defineSymbol(math, main, symbols_open, "[", "\\lbrack", true);
 4950defineSymbol(symbols_text, main, textord, "[", "\\lbrack", true);
 4951defineSymbol(math, main, symbols_close, "]", "\\rbrack", true);
 4952defineSymbol(symbols_text, main, textord, "]", "\\rbrack", true);
 4953defineSymbol(math, main, symbols_open, "(", "\\lparen", true);
 4954defineSymbol(math, main, symbols_close, ")", "\\rparen", true);
 4955defineSymbol(symbols_text, main, textord, "<", "\\textless", true); // in T1 fontenc
 4956
 4957defineSymbol(symbols_text, main, textord, ">", "\\textgreater", true); // in T1 fontenc
 4958
 4959defineSymbol(math, main, symbols_open, "\u230A", "\\lfloor", true);
 4960defineSymbol(math, main, symbols_close, "\u230B", "\\rfloor", true);
 4961defineSymbol(math, main, symbols_open, "\u2308", "\\lceil", true);
 4962defineSymbol(math, main, symbols_close, "\u2309", "\\rceil", true);
 4963defineSymbol(math, main, textord, "\\", "\\backslash");
 4964defineSymbol(math, main, textord, "\u2223", "|");
 4965defineSymbol(math, main, textord, "\u2223", "\\vert");
 4966defineSymbol(symbols_text, main, textord, "|", "\\textbar", true); // in T1 fontenc
 4967
 4968defineSymbol(math, main, textord, "\u2225", "\\|");
 4969defineSymbol(math, main, textord, "\u2225", "\\Vert");
 4970defineSymbol(symbols_text, main, textord, "\u2225", "\\textbardbl");
 4971defineSymbol(symbols_text, main, textord, "~", "\\textasciitilde");
 4972defineSymbol(symbols_text, main, textord, "\\", "\\textbackslash");
 4973defineSymbol(symbols_text, main, textord, "^", "\\textasciicircum");
 4974defineSymbol(math, main, rel, "\u2191", "\\uparrow", true);
 4975defineSymbol(math, main, rel, "\u21D1", "\\Uparrow", true);
 4976defineSymbol(math, main, rel, "\u2193", "\\downarrow", true);
 4977defineSymbol(math, main, rel, "\u21D3", "\\Downarrow", true);
 4978defineSymbol(math, main, rel, "\u2195", "\\updownarrow", true);
 4979defineSymbol(math, main, rel, "\u21D5", "\\Updownarrow", true);
 4980defineSymbol(math, main, op, "\u2210", "\\coprod");
 4981defineSymbol(math, main, op, "\u22C1", "\\bigvee");
 4982defineSymbol(math, main, op, "\u22C0", "\\bigwedge");
 4983defineSymbol(math, main, op, "\u2A04", "\\biguplus");
 4984defineSymbol(math, main, op, "\u22C2", "\\bigcap");
 4985defineSymbol(math, main, op, "\u22C3", "\\bigcup");
 4986defineSymbol(math, main, op, "\u222B", "\\int");
 4987defineSymbol(math, main, op, "\u222B", "\\intop");
 4988defineSymbol(math, main, op, "\u222C", "\\iint");
 4989defineSymbol(math, main, op, "\u222D", "\\iiint");
 4990defineSymbol(math, main, op, "\u220F", "\\prod");
 4991defineSymbol(math, main, op, "\u2211", "\\sum");
 4992defineSymbol(math, main, op, "\u2A02", "\\bigotimes");
 4993defineSymbol(math, main, op, "\u2A01", "\\bigoplus");
 4994defineSymbol(math, main, op, "\u2A00", "\\bigodot");
 4995defineSymbol(math, main, op, "\u222E", "\\oint");
 4996defineSymbol(math, main, op, "\u222F", "\\oiint");
 4997defineSymbol(math, main, op, "\u2230", "\\oiiint");
 4998defineSymbol(math, main, op, "\u2A06", "\\bigsqcup");
 4999defineSymbol(math, main, op, "\u222B", "\\smallint");
 5000defineSymbol(symbols_text, main, inner, "\u2026", "\\textellipsis");
 5001defineSymbol(math, main, inner, "\u2026", "\\mathellipsis");
 5002defineSymbol(symbols_text, main, inner, "\u2026", "\\ldots", true);
 5003defineSymbol(math, main, inner, "\u2026", "\\ldots", true);
 5004defineSymbol(math, main, inner, "\u22EF", "\\@cdots", true);
 5005defineSymbol(math, main, inner, "\u22F1", "\\ddots", true);
 5006defineSymbol(math, main, textord, "\u22EE", "\\varvdots"); // \vdots is a macro
 5007
 5008defineSymbol(math, main, accent, "\u02CA", "\\acute");
 5009defineSymbol(math, main, accent, "\u02CB", "\\grave");
 5010defineSymbol(math, main, accent, "\xA8", "\\ddot");
 5011defineSymbol(math, main, accent, "~", "\\tilde");
 5012defineSymbol(math, main, accent, "\u02C9", "\\bar");
 5013defineSymbol(math, main, accent, "\u02D8", "\\breve");
 5014defineSymbol(math, main, accent, "\u02C7", "\\check");
 5015defineSymbol(math, main, accent, "^", "\\hat");
 5016defineSymbol(math, main, accent, "\u20D7", "\\vec");
 5017defineSymbol(math, main, accent, "\u02D9", "\\dot");
 5018defineSymbol(math, main, accent, "\u02DA", "\\mathring"); // \imath and \jmath should be invariant to \mathrm, \mathbf, etc., so use PUA
 5019
 5020defineSymbol(math, main, mathord, "\uE131", "\\@imath");
 5021defineSymbol(math, main, mathord, "\uE237", "\\@jmath");
 5022defineSymbol(math, main, textord, "\u0131", "\u0131");
 5023defineSymbol(math, main, textord, "\u0237", "\u0237");
 5024defineSymbol(symbols_text, main, textord, "\u0131", "\\i", true);
 5025defineSymbol(symbols_text, main, textord, "\u0237", "\\j", true);
 5026defineSymbol(symbols_text, main, textord, "\xDF", "\\ss", true);
 5027defineSymbol(symbols_text, main, textord, "\xE6", "\\ae", true);
 5028defineSymbol(symbols_text, main, textord, "\u0153", "\\oe", true);
 5029defineSymbol(symbols_text, main, textord, "\xF8", "\\o", true);
 5030defineSymbol(symbols_text, main, textord, "\xC6", "\\AE", true);
 5031defineSymbol(symbols_text, main, textord, "\u0152", "\\OE", true);
 5032defineSymbol(symbols_text, main, textord, "\xD8", "\\O", true);
 5033defineSymbol(symbols_text, main, accent, "\u02CA", "\\'"); // acute
 5034
 5035defineSymbol(symbols_text, main, accent, "\u02CB", "\\`"); // grave
 5036
 5037defineSymbol(symbols_text, main, accent, "\u02C6", "\\^"); // circumflex
 5038
 5039defineSymbol(symbols_text, main, accent, "\u02DC", "\\~"); // tilde
 5040
 5041defineSymbol(symbols_text, main, accent, "\u02C9", "\\="); // macron
 5042
 5043defineSymbol(symbols_text, main, accent, "\u02D8", "\\u"); // breve
 5044
 5045defineSymbol(symbols_text, main, accent, "\u02D9", "\\."); // dot above
 5046
 5047defineSymbol(symbols_text, main, accent, "\xB8", "\\c"); // cedilla
 5048
 5049defineSymbol(symbols_text, main, accent, "\u02DA", "\\r"); // ring above
 5050
 5051defineSymbol(symbols_text, main, accent, "\u02C7", "\\v"); // caron
 5052
 5053defineSymbol(symbols_text, main, accent, "\xA8", '\\"'); // diaresis
 5054
 5055defineSymbol(symbols_text, main, accent, "\u02DD", "\\H"); // double acute
 5056
 5057defineSymbol(symbols_text, main, accent, "\u25EF", "\\textcircled"); // \bigcirc glyph
 5058// These ligatures are detected and created in Parser.js's `formLigatures`.
 5059
 5060var ligatures = {
 5061  "--": true,
 5062  "---": true,
 5063  "``": true,
 5064  "''": true
 5065};
 5066defineSymbol(symbols_text, main, textord, "\u2013", "--", true);
 5067defineSymbol(symbols_text, main, textord, "\u2013", "\\textendash");
 5068defineSymbol(symbols_text, main, textord, "\u2014", "---", true);
 5069defineSymbol(symbols_text, main, textord, "\u2014", "\\textemdash");
 5070defineSymbol(symbols_text, main, textord, "\u2018", "`", true);
 5071defineSymbol(symbols_text, main, textord, "\u2018", "\\textquoteleft");
 5072defineSymbol(symbols_text, main, textord, "\u2019", "'", true);
 5073defineSymbol(symbols_text, main, textord, "\u2019", "\\textquoteright");
 5074defineSymbol(symbols_text, main, textord, "\u201C", "``", true);
 5075defineSymbol(symbols_text, main, textord, "\u201C", "\\textquotedblleft");
 5076defineSymbol(symbols_text, main, textord, "\u201D", "''", true);
 5077defineSymbol(symbols_text, main, textord, "\u201D", "\\textquotedblright"); //  \degree from gensymb package
 5078
 5079defineSymbol(math, main, textord, "\xB0", "\\degree", true);
 5080defineSymbol(symbols_text, main, textord, "\xB0", "\\degree"); // \textdegree from inputenc package
 5081
 5082defineSymbol(symbols_text, main, textord, "\xB0", "\\textdegree", true); // TODO: In LaTeX, \pounds can generate a different character in text and math
 5083// mode, but among our fonts, only Main-Regular defines this character "163".
 5084
 5085defineSymbol(math, main, textord, "\xA3", "\\pounds");
 5086defineSymbol(math, main, textord, "\xA3", "\\mathsterling", true);
 5087defineSymbol(symbols_text, main, textord, "\xA3", "\\pounds");
 5088defineSymbol(symbols_text, main, textord, "\xA3", "\\textsterling", true);
 5089defineSymbol(math, ams, textord, "\u2720", "\\maltese");
 5090defineSymbol(symbols_text, ams, textord, "\u2720", "\\maltese"); // There are lots of symbols which are the same, so we add them in afterwards.
 5091// All of these are textords in math mode
 5092
 5093var mathTextSymbols = "0123456789/@.\"";
 5094
 5095for (var i = 0; i < mathTextSymbols.length; i++) {
 5096  var ch = mathTextSymbols.charAt(i);
 5097  defineSymbol(math, main, textord, ch, ch);
 5098} // All of these are textords in text mode
 5099
 5100
 5101var textSymbols = "0123456789!@*()-=+\";:?/.,";
 5102
 5103for (var _i = 0; _i < textSymbols.length; _i++) {
 5104  var _ch = textSymbols.charAt(_i);
 5105
 5106  defineSymbol(symbols_text, main, textord, _ch, _ch);
 5107} // All of these are textords in text mode, and mathords in math mode
 5108
 5109
 5110var letters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
 5111
 5112for (var _i2 = 0; _i2 < letters.length; _i2++) {
 5113  var _ch2 = letters.charAt(_i2);
 5114
 5115  defineSymbol(math, main, mathord, _ch2, _ch2);
 5116  defineSymbol(symbols_text, main, textord, _ch2, _ch2);
 5117} // Blackboard bold and script letters in Unicode range
 5118
 5119
 5120defineSymbol(math, ams, textord, "C", "\u2102"); // blackboard bold
 5121
 5122defineSymbol(symbols_text, ams, textord, "C", "\u2102");
 5123defineSymbol(math, ams, textord, "H", "\u210D");
 5124defineSymbol(symbols_text, ams, textord, "H", "\u210D");
 5125defineSymbol(math, ams, textord, "N", "\u2115");
 5126defineSymbol(symbols_text, ams, textord, "N", "\u2115");
 5127defineSymbol(math, ams, textord, "P", "\u2119");
 5128defineSymbol(symbols_text, ams, textord, "P", "\u2119");
 5129defineSymbol(math, ams, textord, "Q", "\u211A");
 5130defineSymbol(symbols_text, ams, textord, "Q", "\u211A");
 5131defineSymbol(math, ams, textord, "R", "\u211D");
 5132defineSymbol(symbols_text, ams, textord, "R", "\u211D");
 5133defineSymbol(math, ams, textord, "Z", "\u2124");
 5134defineSymbol(symbols_text, ams, textord, "Z", "\u2124");
 5135defineSymbol(math, main, mathord, "h", "\u210E"); // italic h, Planck constant
 5136
 5137defineSymbol(symbols_text, main, mathord, "h", "\u210E"); // The next loop loads wide (surrogate pair) characters.
 5138// We support some letters in the Unicode range U+1D400 to U+1D7FF,
 5139// Mathematical Alphanumeric Symbols.
 5140// Some editors do not deal well with wide characters. So don't write the
 5141// string into this file. Instead, create the string from the surrogate pair.
 5142
 5143var wideChar = "";
 5144
 5145for (var _i3 = 0; _i3 < letters.length; _i3++) {
 5146  var _ch3 = letters.charAt(_i3); // The hex numbers in the next line are a surrogate pair.
 5147  // 0xD835 is the high surrogate for all letters in the range we support.
 5148  // 0xDC00 is the low surrogate for bold A.
 5149
 5150
 5151  wideChar = String.fromCharCode(0xD835, 0xDC00 + _i3); // A-Z a-z bold
 5152
 5153  defineSymbol(math, main, mathord, _ch3, wideChar);
 5154  defineSymbol(symbols_text, main, textord, _ch3, wideChar);
 5155  wideChar = String.fromCharCode(0xD835, 0xDC34 + _i3); // A-Z a-z italic
 5156
 5157  defineSymbol(math, main, mathord, _ch3, wideChar);
 5158  defineSymbol(symbols_text, main, textord, _ch3, wideChar);
 5159  wideChar = String.fromCharCode(0xD835, 0xDC68 + _i3); // A-Z a-z bold italic
 5160
 5161  defineSymbol(math, main, mathord, _ch3, wideChar);
 5162  defineSymbol(symbols_text, main, textord, _ch3, wideChar);
 5163  wideChar = String.fromCharCode(0xD835, 0xDD04 + _i3); // A-Z a-z Fractur
 5164
 5165  defineSymbol(math, main, mathord, _ch3, wideChar);
 5166  defineSymbol(symbols_text, main, textord, _ch3, wideChar);
 5167  wideChar = String.fromCharCode(0xD835, 0xDDA0 + _i3); // A-Z a-z sans-serif
 5168
 5169  defineSymbol(math, main, mathord, _ch3, wideChar);
 5170  defineSymbol(symbols_text, main, textord, _ch3, wideChar);
 5171  wideChar = String.fromCharCode(0xD835, 0xDDD4 + _i3); // A-Z a-z sans bold
 5172
 5173  defineSymbol(math, main, mathord, _ch3, wideChar);
 5174  defineSymbol(symbols_text, main, textord, _ch3, wideChar);
 5175  wideChar = String.fromCharCode(0xD835, 0xDE08 + _i3); // A-Z a-z sans italic
 5176
 5177  defineSymbol(math, main, mathord, _ch3, wideChar);
 5178  defineSymbol(symbols_text, main, textord, _ch3, wideChar);
 5179  wideChar = String.fromCharCode(0xD835, 0xDE70 + _i3); // A-Z a-z monospace
 5180
 5181  defineSymbol(math, main, mathord, _ch3, wideChar);
 5182  defineSymbol(symbols_text, main, textord, _ch3, wideChar);
 5183
 5184  if (_i3 < 26) {
 5185    // KaTeX fonts have only capital letters for blackboard bold and script.
 5186    // See exception for k below.
 5187    wideChar = String.fromCharCode(0xD835, 0xDD38 + _i3); // A-Z double struck
 5188
 5189    defineSymbol(math, main, mathord, _ch3, wideChar);
 5190    defineSymbol(symbols_text, main, textord, _ch3, wideChar);
 5191    wideChar = String.fromCharCode(0xD835, 0xDC9C + _i3); // A-Z script
 5192
 5193    defineSymbol(math, main, mathord, _ch3, wideChar);
 5194    defineSymbol(symbols_text, main, textord, _ch3, wideChar);
 5195  } // TODO: Add bold script when it is supported by a KaTeX font.
 5196
 5197} // "k" is the only double struck lower case letter in the KaTeX fonts.
 5198
 5199
 5200wideChar = String.fromCharCode(0xD835, 0xDD5C); // k double struck
 5201
 5202defineSymbol(math, main, mathord, "k", wideChar);
 5203defineSymbol(symbols_text, main, textord, "k", wideChar); // Next, some wide character numerals
 5204
 5205for (var _i4 = 0; _i4 < 10; _i4++) {
 5206  var _ch4 = _i4.toString();
 5207
 5208  wideChar = String.fromCharCode(0xD835, 0xDFCE + _i4); // 0-9 bold
 5209
 5210  defineSymbol(math, main, mathord, _ch4, wideChar);
 5211  defineSymbol(symbols_text, main, textord, _ch4, wideChar);
 5212  wideChar = String.fromCharCode(0xD835, 0xDFE2 + _i4); // 0-9 sans serif
 5213
 5214  defineSymbol(math, main, mathord, _ch4, wideChar);
 5215  defineSymbol(symbols_text, main, textord, _ch4, wideChar);
 5216  wideChar = String.fromCharCode(0xD835, 0xDFEC + _i4); // 0-9 bold sans
 5217
 5218  defineSymbol(math, main, mathord, _ch4, wideChar);
 5219  defineSymbol(symbols_text, main, textord, _ch4, wideChar);
 5220  wideChar = String.fromCharCode(0xD835, 0xDFF6 + _i4); // 0-9 monospace
 5221
 5222  defineSymbol(math, main, mathord, _ch4, wideChar);
 5223  defineSymbol(symbols_text, main, textord, _ch4, wideChar);
 5224} // We add these Latin-1 letters as symbols for backwards-compatibility,
 5225// but they are not actually in the font, nor are they supported by the
 5226// Unicode accent mechanism, so they fall back to Times font and look ugly.
 5227// TODO(edemaine): Fix this.
 5228
 5229
 5230var extraLatin = "\xD0\xDE\xFE";
 5231
 5232for (var _i5 = 0; _i5 < extraLatin.length; _i5++) {
 5233  var _ch5 = extraLatin.charAt(_i5);
 5234
 5235  defineSymbol(math, main, mathord, _ch5, _ch5);
 5236  defineSymbol(symbols_text, main, textord, _ch5, _ch5);
 5237}
 5238;// CONCATENATED MODULE: ./src/wide-character.js
 5239/**
 5240 * This file provides support for Unicode range U+1D400 to U+1D7FF,
 5241 * Mathematical Alphanumeric Symbols.
 5242 *
 5243 * Function wideCharacterFont takes a wide character as input and returns
 5244 * the font information necessary to render it properly.
 5245 */
 5246
 5247/**
 5248 * Data below is from https://www.unicode.org/charts/PDF/U1D400.pdf
 5249 * That document sorts characters into groups by font type, say bold or italic.
 5250 *
 5251 * In the arrays below, each subarray consists three elements:
 5252 *      * The CSS class of that group when in math mode.
 5253 *      * The CSS class of that group when in text mode.
 5254 *      * The font name, so that KaTeX can get font metrics.
 5255 */
 5256
 5257var wideLatinLetterData = [["mathbf", "textbf", "Main-Bold"], // A-Z bold upright
 5258["mathbf", "textbf", "Main-Bold"], // a-z bold upright
 5259["mathnormal", "textit", "Math-Italic"], // A-Z italic
 5260["mathnormal", "textit", "Math-Italic"], // a-z italic
 5261["boldsymbol", "boldsymbol", "Main-BoldItalic"], // A-Z bold italic
 5262["boldsymbol", "boldsymbol", "Main-BoldItalic"], // a-z bold italic
 5263// Map fancy A-Z letters to script, not calligraphic.
 5264// This aligns with unicode-math and math fonts (except Cambria Math).
 5265["mathscr", "textscr", "Script-Regular"], // A-Z script
 5266["", "", ""], // a-z script.  No font
 5267["", "", ""], // A-Z bold script. No font
 5268["", "", ""], // a-z bold script. No font
 5269["mathfrak", "textfrak", "Fraktur-Regular"], // A-Z Fraktur
 5270["mathfrak", "textfrak", "Fraktur-Regular"], // a-z Fraktur
 5271["mathbb", "textbb", "AMS-Regular"], // A-Z double-struck
 5272["mathbb", "textbb", "AMS-Regular"], // k double-struck
 5273["", "", ""], // A-Z bold Fraktur No font metrics
 5274["", "", ""], // a-z bold Fraktur.   No font.
 5275["mathsf", "textsf", "SansSerif-Regular"], // A-Z sans-serif
 5276["mathsf", "textsf", "SansSerif-Regular"], // a-z sans-serif
 5277["mathboldsf", "textboldsf", "SansSerif-Bold"], // A-Z bold sans-serif
 5278["mathboldsf", "textboldsf", "SansSerif-Bold"], // a-z bold sans-serif
 5279["mathitsf", "textitsf", "SansSerif-Italic"], // A-Z italic sans-serif
 5280["mathitsf", "textitsf", "SansSerif-Italic"], // a-z italic sans-serif
 5281["", "", ""], // A-Z bold italic sans. No font
 5282["", "", ""], // a-z bold italic sans. No font
 5283["mathtt", "texttt", "Typewriter-Regular"], // A-Z monospace
 5284["mathtt", "texttt", "Typewriter-Regular"] // a-z monospace
 5285];
 5286var wideNumeralData = [["mathbf", "textbf", "Main-Bold"], // 0-9 bold
 5287["", "", ""], // 0-9 double-struck. No KaTeX font.
 5288["mathsf", "textsf", "SansSerif-Regular"], // 0-9 sans-serif
 5289["mathboldsf", "textboldsf", "SansSerif-Bold"], // 0-9 bold sans-serif
 5290["mathtt", "texttt", "Typewriter-Regular"] // 0-9 monospace
 5291];
 5292var wideCharacterFont = function wideCharacterFont(wideChar, mode) {
 5293  // IE doesn't support codePointAt(). So work with the surrogate pair.
 5294  var H = wideChar.charCodeAt(0); // high surrogate
 5295
 5296  var L = wideChar.charCodeAt(1); // low surrogate
 5297
 5298  var codePoint = (H - 0xD800) * 0x400 + (L - 0xDC00) + 0x10000;
 5299  var j = mode === "math" ? 0 : 1; // column index for CSS class.
 5300
 5301  if (0x1D400 <= codePoint && codePoint < 0x1D6A4) {
 5302    // wideLatinLetterData contains exactly 26 chars on each row.
 5303    // So we can calculate the relevant row. No traverse necessary.
 5304    var i = Math.floor((codePoint - 0x1D400) / 26);
 5305    return [wideLatinLetterData[i][2], wideLatinLetterData[i][j]];
 5306  } else if (0x1D7CE <= codePoint && codePoint <= 0x1D7FF) {
 5307    // Numerals, ten per row.
 5308    var _i = Math.floor((codePoint - 0x1D7CE) / 10);
 5309
 5310    return [wideNumeralData[_i][2], wideNumeralData[_i][j]];
 5311  } else if (codePoint === 0x1D6A5 || codePoint === 0x1D6A6) {
 5312    // dotless i or j
 5313    return [wideLatinLetterData[0][2], wideLatinLetterData[0][j]];
 5314  } else if (0x1D6A6 < codePoint && codePoint < 0x1D7CE) {
 5315    // Greek letters. Not supported, yet.
 5316    return ["", ""];
 5317  } else {
 5318    // We don't support any wide characters outside 1D400–1D7FF.
 5319    throw new src_ParseError("Unsupported character: " + wideChar);
 5320  }
 5321};
 5322;// CONCATENATED MODULE: ./src/buildCommon.js
 5323/* eslint no-console:0 */
 5324
 5325/**
 5326 * This module contains general functions that can be used for building
 5327 * different kinds of domTree nodes in a consistent manner.
 5328 */
 5329
 5330
 5331
 5332
 5333
 5334
 5335
 5336/**
 5337 * Looks up the given symbol in fontMetrics, after applying any symbol
 5338 * replacements defined in symbol.js
 5339 */
 5340var lookupSymbol = function lookupSymbol(value, // TODO(#963): Use a union type for this.
 5341fontName, mode) {
 5342  // Replace the value with its replaced value from symbol.js
 5343  if (src_symbols[mode][value] && src_symbols[mode][value].replace) {
 5344    value = src_symbols[mode][value].replace;
 5345  }
 5346
 5347  return {
 5348    value: value,
 5349    metrics: getCharacterMetrics(value, fontName, mode)
 5350  };
 5351};
 5352/**
 5353 * Makes a symbolNode after translation via the list of symbols in symbols.js.
 5354 * Correctly pulls out metrics for the character, and optionally takes a list of
 5355 * classes to be attached to the node.
 5356 *
 5357 * TODO: make argument order closer to makeSpan
 5358 * TODO: add a separate argument for math class (e.g. `mop`, `mbin`), which
 5359 * should if present come first in `classes`.
 5360 * TODO(#953): Make `options` mandatory and always pass it in.
 5361 */
 5362
 5363
 5364var makeSymbol = function makeSymbol(value, fontName, mode, options, classes) {
 5365  var lookup = lookupSymbol(value, fontName, mode);
 5366  var metrics = lookup.metrics;
 5367  value = lookup.value;
 5368  var symbolNode;
 5369
 5370  if (metrics) {
 5371    var italic = metrics.italic;
 5372
 5373    if (mode === "text" || options && options.font === "mathit") {
 5374      italic = 0;
 5375    }
 5376
 5377    symbolNode = new SymbolNode(value, metrics.height, metrics.depth, italic, metrics.skew, metrics.width, classes);
 5378  } else {
 5379    // TODO(emily): Figure out a good way to only print this in development
 5380    typeof console !== "undefined" && console.warn("No character metrics " + ("for '" + value + "' in style '" + fontName + "' and mode '" + mode + "'"));
 5381    symbolNode = new SymbolNode(value, 0, 0, 0, 0, 0, classes);
 5382  }
 5383
 5384  if (options) {
 5385    symbolNode.maxFontSize = options.sizeMultiplier;
 5386
 5387    if (options.style.isTight()) {
 5388      symbolNode.classes.push("mtight");
 5389    }
 5390
 5391    var color = options.getColor();
 5392
 5393    if (color) {
 5394      symbolNode.style.color = color;
 5395    }
 5396  }
 5397
 5398  return symbolNode;
 5399};
 5400/**
 5401 * Makes a symbol in Main-Regular or AMS-Regular.
 5402 * Used for rel, bin, open, close, inner, and punct.
 5403 */
 5404
 5405
 5406var mathsym = function mathsym(value, mode, options, classes) {
 5407  if (classes === void 0) {
 5408    classes = [];
 5409  }
 5410
 5411  // Decide what font to render the symbol in by its entry in the symbols
 5412  // table.
 5413  // Have a special case for when the value = \ because the \ is used as a
 5414  // textord in unsupported command errors but cannot be parsed as a regular
 5415  // text ordinal and is therefore not present as a symbol in the symbols
 5416  // table for text, as well as a special case for boldsymbol because it
 5417  // can be used for bold + and -
 5418  if (options.font === "boldsymbol" && lookupSymbol(value, "Main-Bold", mode).metrics) {
 5419    return makeSymbol(value, "Main-Bold", mode, options, classes.concat(["mathbf"]));
 5420  } else if (value === "\\" || src_symbols[mode][value].font === "main") {
 5421    return makeSymbol(value, "Main-Regular", mode, options, classes);
 5422  } else {
 5423    return makeSymbol(value, "AMS-Regular", mode, options, classes.concat(["amsrm"]));
 5424  }
 5425};
 5426/**
 5427 * Determines which of the two font names (Main-Bold and Math-BoldItalic) and
 5428 * corresponding style tags (mathbf or boldsymbol) to use for font "boldsymbol",
 5429 * depending on the symbol.  Use this function instead of fontMap for font
 5430 * "boldsymbol".
 5431 */
 5432
 5433
 5434var boldsymbol = function boldsymbol(value, mode, options, classes, type) {
 5435  if (type !== "textord" && lookupSymbol(value, "Math-BoldItalic", mode).metrics) {
 5436    return {
 5437      fontName: "Math-BoldItalic",
 5438      fontClass: "boldsymbol"
 5439    };
 5440  } else {
 5441    // Some glyphs do not exist in Math-BoldItalic so we need to use
 5442    // Main-Bold instead.
 5443    return {
 5444      fontName: "Main-Bold",
 5445      fontClass: "mathbf"
 5446    };
 5447  }
 5448};
 5449/**
 5450 * Makes either a mathord or textord in the correct font and color.
 5451 */
 5452
 5453
 5454var makeOrd = function makeOrd(group, options, type) {
 5455  var mode = group.mode;
 5456  var text = group.text;
 5457  var classes = ["mord"]; // Math mode or Old font (i.e. \rm)
 5458
 5459  var isFont = mode === "math" || mode === "text" && options.font;
 5460  var fontOrFamily = isFont ? options.font : options.fontFamily;
 5461
 5462  if (text.charCodeAt(0) === 0xD835) {
 5463    // surrogate pairs get special treatment
 5464    var _wideCharacterFont = wideCharacterFont(text, mode),
 5465        wideFontName = _wideCharacterFont[0],
 5466        wideFontClass = _wideCharacterFont[1];
 5467
 5468    return makeSymbol(text, wideFontName, mode, options, classes.concat(wideFontClass));
 5469  } else if (fontOrFamily) {
 5470    var fontName;
 5471    var fontClasses;
 5472
 5473    if (fontOrFamily === "boldsymbol") {
 5474      var fontData = boldsymbol(text, mode, options, classes, type);
 5475      fontName = fontData.fontName;
 5476      fontClasses = [fontData.fontClass];
 5477    } else if (isFont) {
 5478      fontName = fontMap[fontOrFamily].fontName;
 5479      fontClasses = [fontOrFamily];
 5480    } else {
 5481      fontName = retrieveTextFontName(fontOrFamily, options.fontWeight, options.fontShape);
 5482      fontClasses = [fontOrFamily, options.fontWeight, options.fontShape];
 5483    }
 5484
 5485    if (lookupSymbol(text, fontName, mode).metrics) {
 5486      return makeSymbol(text, fontName, mode, options, classes.concat(fontClasses));
 5487    } else if (ligatures.hasOwnProperty(text) && fontName.substr(0, 10) === "Typewriter") {
 5488      // Deconstruct ligatures in monospace fonts (\texttt, \tt).
 5489      var parts = [];
 5490
 5491      for (var i = 0; i < text.length; i++) {
 5492        parts.push(makeSymbol(text[i], fontName, mode, options, classes.concat(fontClasses)));
 5493      }
 5494
 5495      return makeFragment(parts);
 5496    }
 5497  } // Makes a symbol in the default font for mathords and textords.
 5498
 5499
 5500  if (type === "mathord") {
 5501    return makeSymbol(text, "Math-Italic", mode, options, classes.concat(["mathnormal"]));
 5502  } else if (type === "textord") {
 5503    var font = src_symbols[mode][text] && src_symbols[mode][text].font;
 5504
 5505    if (font === "ams") {
 5506      var _fontName = retrieveTextFontName("amsrm", options.fontWeight, options.fontShape);
 5507
 5508      return makeSymbol(text, _fontName, mode, options, classes.concat("amsrm", options.fontWeight, options.fontShape));
 5509    } else if (font === "main" || !font) {
 5510      var _fontName2 = retrieveTextFontName("textrm", options.fontWeight, options.fontShape);
 5511
 5512      return makeSymbol(text, _fontName2, mode, options, classes.concat(options.fontWeight, options.fontShape));
 5513    } else {
 5514      // fonts added by plugins
 5515      var _fontName3 = retrieveTextFontName(font, options.fontWeight, options.fontShape); // We add font name as a css class
 5516
 5517
 5518      return makeSymbol(text, _fontName3, mode, options, classes.concat(_fontName3, options.fontWeight, options.fontShape));
 5519    }
 5520  } else {
 5521    throw new Error("unexpected type: " + type + " in makeOrd");
 5522  }
 5523};
 5524/**
 5525 * Returns true if subsequent symbolNodes have the same classes, skew, maxFont,
 5526 * and styles.
 5527 */
 5528
 5529
 5530var canCombine = function canCombine(prev, next) {
 5531  if (createClass(prev.classes) !== createClass(next.classes) || prev.skew !== next.skew || prev.maxFontSize !== next.maxFontSize) {
 5532    return false;
 5533  } // If prev and next both are just "mbin"s or "mord"s we don't combine them
 5534  // so that the proper spacing can be preserved.
 5535
 5536
 5537  if (prev.classes.length === 1) {
 5538    var cls = prev.classes[0];
 5539
 5540    if (cls === "mbin" || cls === "mord") {
 5541      return false;
 5542    }
 5543  }
 5544
 5545  for (var style in prev.style) {
 5546    if (prev.style.hasOwnProperty(style) && prev.style[style] !== next.style[style]) {
 5547      return false;
 5548    }
 5549  }
 5550
 5551  for (var _style in next.style) {
 5552    if (next.style.hasOwnProperty(_style) && prev.style[_style] !== next.style[_style]) {
 5553      return false;
 5554    }
 5555  }
 5556
 5557  return true;
 5558};
 5559/**
 5560 * Combine consecutive domTree.symbolNodes into a single symbolNode.
 5561 * Note: this function mutates the argument.
 5562 */
 5563
 5564
 5565var tryCombineChars = function tryCombineChars(chars) {
 5566  for (var i = 0; i < chars.length - 1; i++) {
 5567    var prev = chars[i];
 5568    var next = chars[i + 1];
 5569
 5570    if (prev instanceof SymbolNode && next instanceof SymbolNode && canCombine(prev, next)) {
 5571      prev.text += next.text;
 5572      prev.height = Math.max(prev.height, next.height);
 5573      prev.depth = Math.max(prev.depth, next.depth); // Use the last character's italic correction since we use
 5574      // it to add padding to the right of the span created from
 5575      // the combined characters.
 5576
 5577      prev.italic = next.italic;
 5578      chars.splice(i + 1, 1);
 5579      i--;
 5580    }
 5581  }
 5582
 5583  return chars;
 5584};
 5585/**
 5586 * Calculate the height, depth, and maxFontSize of an element based on its
 5587 * children.
 5588 */
 5589
 5590
 5591var sizeElementFromChildren = function sizeElementFromChildren(elem) {
 5592  var height = 0;
 5593  var depth = 0;
 5594  var maxFontSize = 0;
 5595
 5596  for (var i = 0; i < elem.children.length; i++) {
 5597    var child = elem.children[i];
 5598
 5599    if (child.height > height) {
 5600      height = child.height;
 5601    }
 5602
 5603    if (child.depth > depth) {
 5604      depth = child.depth;
 5605    }
 5606
 5607    if (child.maxFontSize > maxFontSize) {
 5608      maxFontSize = child.maxFontSize;
 5609    }
 5610  }
 5611
 5612  elem.height = height;
 5613  elem.depth = depth;
 5614  elem.maxFontSize = maxFontSize;
 5615};
 5616/**
 5617 * Makes a span with the given list of classes, list of children, and options.
 5618 *
 5619 * TODO(#953): Ensure that `options` is always provided (currently some call
 5620 * sites don't pass it) and make the type below mandatory.
 5621 * TODO: add a separate argument for math class (e.g. `mop`, `mbin`), which
 5622 * should if present come first in `classes`.
 5623 */
 5624
 5625
 5626var makeSpan = function makeSpan(classes, children, options, style) {
 5627  var span = new Span(classes, children, options, style);
 5628  sizeElementFromChildren(span);
 5629  return span;
 5630}; // SVG one is simpler -- doesn't require height, depth, max-font setting.
 5631// This is also a separate method for typesafety.
 5632
 5633
 5634var makeSvgSpan = function makeSvgSpan(classes, children, options, style) {
 5635  return new Span(classes, children, options, style);
 5636};
 5637
 5638var makeLineSpan = function makeLineSpan(className, options, thickness) {
 5639  var line = makeSpan([className], [], options);
 5640  line.height = Math.max(thickness || options.fontMetrics().defaultRuleThickness, options.minRuleThickness);
 5641  line.style.borderBottomWidth = makeEm(line.height);
 5642  line.maxFontSize = 1.0;
 5643  return line;
 5644};
 5645/**
 5646 * Makes an anchor with the given href, list of classes, list of children,
 5647 * and options.
 5648 */
 5649
 5650
 5651var makeAnchor = function makeAnchor(href, classes, children, options) {
 5652  var anchor = new Anchor(href, classes, children, options);
 5653  sizeElementFromChildren(anchor);
 5654  return anchor;
 5655};
 5656/**
 5657 * Makes a document fragment with the given list of children.
 5658 */
 5659
 5660
 5661var makeFragment = function makeFragment(children) {
 5662  var fragment = new DocumentFragment(children);
 5663  sizeElementFromChildren(fragment);
 5664  return fragment;
 5665};
 5666/**
 5667 * Wraps group in a span if it's a document fragment, allowing to apply classes
 5668 * and styles
 5669 */
 5670
 5671
 5672var wrapFragment = function wrapFragment(group, options) {
 5673  if (group instanceof DocumentFragment) {
 5674    return makeSpan([], [group], options);
 5675  }
 5676
 5677  return group;
 5678}; // These are exact object types to catch typos in the names of the optional fields.
 5679
 5680
 5681// Computes the updated `children` list and the overall depth.
 5682//
 5683// This helper function for makeVList makes it easier to enforce type safety by
 5684// allowing early exits (returns) in the logic.
 5685var getVListChildrenAndDepth = function getVListChildrenAndDepth(params) {
 5686  if (params.positionType === "individualShift") {
 5687    var oldChildren = params.children;
 5688    var children = [oldChildren[0]]; // Add in kerns to the list of params.children to get each element to be
 5689    // shifted to the correct specified shift
 5690
 5691    var _depth = -oldChildren[0].shift - oldChildren[0].elem.depth;
 5692
 5693    var currPos = _depth;
 5694
 5695    for (var i = 1; i < oldChildren.length; i++) {
 5696      var diff = -oldChildren[i].shift - currPos - oldChildren[i].elem.depth;
 5697      var size = diff - (oldChildren[i - 1].elem.height + oldChildren[i - 1].elem.depth);
 5698      currPos = currPos + diff;
 5699      children.push({
 5700        type: "kern",
 5701        size: size
 5702      });
 5703      children.push(oldChildren[i]);
 5704    }
 5705
 5706    return {
 5707      children: children,
 5708      depth: _depth
 5709    };
 5710  }
 5711
 5712  var depth;
 5713
 5714  if (params.positionType === "top") {
 5715    // We always start at the bottom, so calculate the bottom by adding up
 5716    // all the sizes
 5717    var bottom = params.positionData;
 5718
 5719    for (var _i = 0; _i < params.children.length; _i++) {
 5720      var child = params.children[_i];
 5721      bottom -= child.type === "kern" ? child.size : child.elem.height + child.elem.depth;
 5722    }
 5723
 5724    depth = bottom;
 5725  } else if (params.positionType === "bottom") {
 5726    depth = -params.positionData;
 5727  } else {
 5728    var firstChild = params.children[0];
 5729
 5730    if (firstChild.type !== "elem") {
 5731      throw new Error('First child must have type "elem".');
 5732    }
 5733
 5734    if (params.positionType === "shift") {
 5735      depth = -firstChild.elem.depth - params.positionData;
 5736    } else if (params.positionType === "firstBaseline") {
 5737      depth = -firstChild.elem.depth;
 5738    } else {
 5739      throw new Error("Invalid positionType " + params.positionType + ".");
 5740    }
 5741  }
 5742
 5743  return {
 5744    children: params.children,
 5745    depth: depth
 5746  };
 5747};
 5748/**
 5749 * Makes a vertical list by stacking elements and kerns on top of each other.
 5750 * Allows for many different ways of specifying the positioning method.
 5751 *
 5752 * See VListParam documentation above.
 5753 */
 5754
 5755
 5756var makeVList = function makeVList(params, options) {
 5757  var _getVListChildrenAndD = getVListChildrenAndDepth(params),
 5758      children = _getVListChildrenAndD.children,
 5759      depth = _getVListChildrenAndD.depth; // Create a strut that is taller than any list item. The strut is added to
 5760  // each item, where it will determine the item's baseline. Since it has
 5761  // `overflow:hidden`, the strut's top edge will sit on the item's line box's
 5762  // top edge and the strut's bottom edge will sit on the item's baseline,
 5763  // with no additional line-height spacing. This allows the item baseline to
 5764  // be positioned precisely without worrying about font ascent and
 5765  // line-height.
 5766
 5767
 5768  var pstrutSize = 0;
 5769
 5770  for (var i = 0; i < children.length; i++) {
 5771    var child = children[i];
 5772
 5773    if (child.type === "elem") {
 5774      var elem = child.elem;
 5775      pstrutSize = Math.max(pstrutSize, elem.maxFontSize, elem.height);
 5776    }
 5777  }
 5778
 5779  pstrutSize += 2;
 5780  var pstrut = makeSpan(["pstrut"], []);
 5781  pstrut.style.height = makeEm(pstrutSize); // Create a new list of actual children at the correct offsets
 5782
 5783  var realChildren = [];
 5784  var minPos = depth;
 5785  var maxPos = depth;
 5786  var currPos = depth;
 5787
 5788  for (var _i2 = 0; _i2 < children.length; _i2++) {
 5789    var _child = children[_i2];
 5790
 5791    if (_child.type === "kern") {
 5792      currPos += _child.size;
 5793    } else {
 5794      var _elem = _child.elem;
 5795      var classes = _child.wrapperClasses || [];
 5796      var style = _child.wrapperStyle || {};
 5797      var childWrap = makeSpan(classes, [pstrut, _elem], undefined, style);
 5798      childWrap.style.top = makeEm(-pstrutSize - currPos - _elem.depth);
 5799
 5800      if (_child.marginLeft) {
 5801        childWrap.style.marginLeft = _child.marginLeft;
 5802      }
 5803
 5804      if (_child.marginRight) {
 5805        childWrap.style.marginRight = _child.marginRight;
 5806      }
 5807
 5808      realChildren.push(childWrap);
 5809      currPos += _elem.height + _elem.depth;
 5810    }
 5811
 5812    minPos = Math.min(minPos, currPos);
 5813    maxPos = Math.max(maxPos, currPos);
 5814  } // The vlist contents go in a table-cell with `vertical-align:bottom`.
 5815  // This cell's bottom edge will determine the containing table's baseline
 5816  // without overly expanding the containing line-box.
 5817
 5818
 5819  var vlist = makeSpan(["vlist"], realChildren);
 5820  vlist.style.height = makeEm(maxPos); // A second row is used if necessary to represent the vlist's depth.
 5821
 5822  var rows;
 5823
 5824  if (minPos < 0) {
 5825    // We will define depth in an empty span with display: table-cell.
 5826    // It should render with the height that we define. But Chrome, in
 5827    // contenteditable mode only, treats that span as if it contains some
 5828    // text content. And that min-height over-rides our desired height.
 5829    // So we put another empty span inside the depth strut span.
 5830    var emptySpan = makeSpan([], []);
 5831    var depthStrut = makeSpan(["vlist"], [emptySpan]);
 5832    depthStrut.style.height = makeEm(-minPos); // Safari wants the first row to have inline content; otherwise it
 5833    // puts the bottom of the *second* row on the baseline.
 5834
 5835    var topStrut = makeSpan(["vlist-s"], [new SymbolNode("\u200B")]);
 5836    rows = [makeSpan(["vlist-r"], [vlist, topStrut]), makeSpan(["vlist-r"], [depthStrut])];
 5837  } else {
 5838    rows = [makeSpan(["vlist-r"], [vlist])];
 5839  }
 5840
 5841  var vtable = makeSpan(["vlist-t"], rows);
 5842
 5843  if (rows.length === 2) {
 5844    vtable.classes.push("vlist-t2");
 5845  }
 5846
 5847  vtable.height = maxPos;
 5848  vtable.depth = -minPos;
 5849  return vtable;
 5850}; // Glue is a concept from TeX which is a flexible space between elements in
 5851// either a vertical or horizontal list. In KaTeX, at least for now, it's
 5852// static space between elements in a horizontal layout.
 5853
 5854
 5855var makeGlue = function makeGlue(measurement, options) {
 5856  // Make an empty span for the space
 5857  var rule = makeSpan(["mspace"], [], options);
 5858  var size = calculateSize(measurement, options);
 5859  rule.style.marginRight = makeEm(size);
 5860  return rule;
 5861}; // Takes font options, and returns the appropriate fontLookup name
 5862
 5863
 5864var retrieveTextFontName = function retrieveTextFontName(fontFamily, fontWeight, fontShape) {
 5865  var baseFontName = "";
 5866
 5867  switch (fontFamily) {
 5868    case "amsrm":
 5869      baseFontName = "AMS";
 5870      break;
 5871
 5872    case "textrm":
 5873      baseFontName = "Main";
 5874      break;
 5875
 5876    case "textsf":
 5877      baseFontName = "SansSerif";
 5878      break;
 5879
 5880    case "texttt":
 5881      baseFontName = "Typewriter";
 5882      break;
 5883
 5884    default:
 5885      baseFontName = fontFamily;
 5886    // use fonts added by a plugin
 5887  }
 5888
 5889  var fontStylesName;
 5890
 5891  if (fontWeight === "textbf" && fontShape === "textit") {
 5892    fontStylesName = "BoldItalic";
 5893  } else if (fontWeight === "textbf") {
 5894    fontStylesName = "Bold";
 5895  } else if (fontWeight === "textit") {
 5896    fontStylesName = "Italic";
 5897  } else {
 5898    fontStylesName = "Regular";
 5899  }
 5900
 5901  return baseFontName + "-" + fontStylesName;
 5902};
 5903/**
 5904 * Maps TeX font commands to objects containing:
 5905 * - variant: string used for "mathvariant" attribute in buildMathML.js
 5906 * - fontName: the "style" parameter to fontMetrics.getCharacterMetrics
 5907 */
 5908// A map between tex font commands an MathML mathvariant attribute values
 5909
 5910
 5911var fontMap = {
 5912  // styles
 5913  "mathbf": {
 5914    variant: "bold",
 5915    fontName: "Main-Bold"
 5916  },
 5917  "mathrm": {
 5918    variant: "normal",
 5919    fontName: "Main-Regular"
 5920  },
 5921  "textit": {
 5922    variant: "italic",
 5923    fontName: "Main-Italic"
 5924  },
 5925  "mathit": {
 5926    variant: "italic",
 5927    fontName: "Main-Italic"
 5928  },
 5929  "mathnormal": {
 5930    variant: "italic",
 5931    fontName: "Math-Italic"
 5932  },
 5933  // "boldsymbol" is missing because they require the use of multiple fonts:
 5934  // Math-BoldItalic and Main-Bold.  This is handled by a special case in
 5935  // makeOrd which ends up calling boldsymbol.
 5936  // families
 5937  "mathbb": {
 5938    variant: "double-struck",
 5939    fontName: "AMS-Regular"
 5940  },
 5941  "mathcal": {
 5942    variant: "script",
 5943    fontName: "Caligraphic-Regular"
 5944  },
 5945  "mathfrak": {
 5946    variant: "fraktur",
 5947    fontName: "Fraktur-Regular"
 5948  },
 5949  "mathscr": {
 5950    variant: "script",
 5951    fontName: "Script-Regular"
 5952  },
 5953  "mathsf": {
 5954    variant: "sans-serif",
 5955    fontName: "SansSerif-Regular"
 5956  },
 5957  "mathtt": {
 5958    variant: "monospace",
 5959    fontName: "Typewriter-Regular"
 5960  }
 5961};
 5962var svgData = {
 5963  //   path, width, height
 5964  vec: ["vec", 0.471, 0.714],
 5965  // values from the font glyph
 5966  oiintSize1: ["oiintSize1", 0.957, 0.499],
 5967  // oval to overlay the integrand
 5968  oiintSize2: ["oiintSize2", 1.472, 0.659],
 5969  oiiintSize1: ["oiiintSize1", 1.304, 0.499],
 5970  oiiintSize2: ["oiiintSize2", 1.98, 0.659]
 5971};
 5972
 5973var staticSvg = function staticSvg(value, options) {
 5974  // Create a span with inline SVG for the element.
 5975  var _svgData$value = svgData[value],
 5976      pathName = _svgData$value[0],
 5977      width = _svgData$value[1],
 5978      height = _svgData$value[2];
 5979  var path = new PathNode(pathName);
 5980  var svgNode = new SvgNode([path], {
 5981    "width": makeEm(width),
 5982    "height": makeEm(height),
 5983    // Override CSS rule `.katex svg { width: 100% }`
 5984    "style": "width:" + makeEm(width),
 5985    "viewBox": "0 0 " + 1000 * width + " " + 1000 * height,
 5986    "preserveAspectRatio": "xMinYMin"
 5987  });
 5988  var span = makeSvgSpan(["overlay"], [svgNode], options);
 5989  span.height = height;
 5990  span.style.height = makeEm(height);
 5991  span.style.width = makeEm(width);
 5992  return span;
 5993};
 5994
 5995/* harmony default export */ var buildCommon = ({
 5996  fontMap: fontMap,
 5997  makeSymbol: makeSymbol,
 5998  mathsym: mathsym,
 5999  makeSpan: makeSpan,
 6000  makeSvgSpan: makeSvgSpan,
 6001  makeLineSpan: makeLineSpan,
 6002  makeAnchor: makeAnchor,
 6003  makeFragment: makeFragment,
 6004  wrapFragment: wrapFragment,
 6005  makeVList: makeVList,
 6006  makeOrd: makeOrd,
 6007  makeGlue: makeGlue,
 6008  staticSvg: staticSvg,
 6009  svgData: svgData,
 6010  tryCombineChars: tryCombineChars
 6011});
 6012;// CONCATENATED MODULE: ./src/spacingData.js
 6013/**
 6014 * Describes spaces between different classes of atoms.
 6015 */
 6016var thinspace = {
 6017  number: 3,
 6018  unit: "mu"
 6019};
 6020var mediumspace = {
 6021  number: 4,
 6022  unit: "mu"
 6023};
 6024var thickspace = {
 6025  number: 5,
 6026  unit: "mu"
 6027}; // Making the type below exact with all optional fields doesn't work due to
 6028// - https://github.com/facebook/flow/issues/4582
 6029// - https://github.com/facebook/flow/issues/5688
 6030// However, since *all* fields are optional, $Shape<> works as suggested in 5688
 6031// above.
 6032
 6033// Spacing relationships for display and text styles
 6034var spacings = {
 6035  mord: {
 6036    mop: thinspace,
 6037    mbin: mediumspace,
 6038    mrel: thickspace,
 6039    minner: thinspace
 6040  },
 6041  mop: {
 6042    mord: thinspace,
 6043    mop: thinspace,
 6044    mrel: thickspace,
 6045    minner: thinspace
 6046  },
 6047  mbin: {
 6048    mord: mediumspace,
 6049    mop: mediumspace,
 6050    mopen: mediumspace,
 6051    minner: mediumspace
 6052  },
 6053  mrel: {
 6054    mord: thickspace,
 6055    mop: thickspace,
 6056    mopen: thickspace,
 6057    minner: thickspace
 6058  },
 6059  mopen: {},
 6060  mclose: {
 6061    mop: thinspace,
 6062    mbin: mediumspace,
 6063    mrel: thickspace,
 6064    minner: thinspace
 6065  },
 6066  mpunct: {
 6067    mord: thinspace,
 6068    mop: thinspace,
 6069    mrel: thickspace,
 6070    mopen: thinspace,
 6071    mclose: thinspace,
 6072    mpunct: thinspace,
 6073    minner: thinspace
 6074  },
 6075  minner: {
 6076    mord: thinspace,
 6077    mop: thinspace,
 6078    mbin: mediumspace,
 6079    mrel: thickspace,
 6080    mopen: thinspace,
 6081    mpunct: thinspace,
 6082    minner: thinspace
 6083  }
 6084}; // Spacing relationships for script and scriptscript styles
 6085
 6086var tightSpacings = {
 6087  mord: {
 6088    mop: thinspace
 6089  },
 6090  mop: {
 6091    mord: thinspace,
 6092    mop: thinspace
 6093  },
 6094  mbin: {},
 6095  mrel: {},
 6096  mopen: {},
 6097  mclose: {
 6098    mop: thinspace
 6099  },
 6100  mpunct: {},
 6101  minner: {
 6102    mop: thinspace
 6103  }
 6104};
 6105;// CONCATENATED MODULE: ./src/defineFunction.js
 6106/** Context provided to function handlers for error messages. */
 6107// Note: reverse the order of the return type union will cause a flow error.
 6108// See https://github.com/facebook/flow/issues/3663.
 6109// More general version of `HtmlBuilder` for nodes (e.g. \sum, accent types)
 6110// whose presence impacts super/subscripting. In this case, ParseNode<"supsub">
 6111// delegates its HTML building to the HtmlBuilder corresponding to these nodes.
 6112
 6113/**
 6114 * Final function spec for use at parse time.
 6115 * This is almost identical to `FunctionPropSpec`, except it
 6116 * 1. includes the function handler, and
 6117 * 2. requires all arguments except argTypes.
 6118 * It is generated by `defineFunction()` below.
 6119 */
 6120
 6121/**
 6122 * All registered functions.
 6123 * `functions.js` just exports this same dictionary again and makes it public.
 6124 * `Parser.js` requires this dictionary.
 6125 */
 6126var _functions = {};
 6127/**
 6128 * All HTML builders. Should be only used in the `define*` and the `build*ML`
 6129 * functions.
 6130 */
 6131
 6132var _htmlGroupBuilders = {};
 6133/**
 6134 * All MathML builders. Should be only used in the `define*` and the `build*ML`
 6135 * functions.
 6136 */
 6137
 6138var _mathmlGroupBuilders = {};
 6139function defineFunction(_ref) {
 6140  var type = _ref.type,
 6141      names = _ref.names,
 6142      props = _ref.props,
 6143      handler = _ref.handler,
 6144      htmlBuilder = _ref.htmlBuilder,
 6145      mathmlBuilder = _ref.mathmlBuilder;
 6146  // Set default values of functions
 6147  var data = {
 6148    type: type,
 6149    numArgs: props.numArgs,
 6150    argTypes: props.argTypes,
 6151    allowedInArgument: !!props.allowedInArgument,
 6152    allowedInText: !!props.allowedInText,
 6153    allowedInMath: props.allowedInMath === undefined ? true : props.allowedInMath,
 6154    numOptionalArgs: props.numOptionalArgs || 0,
 6155    infix: !!props.infix,
 6156    primitive: !!props.primitive,
 6157    handler: handler
 6158  };
 6159
 6160  for (var i = 0; i < names.length; ++i) {
 6161    _functions[names[i]] = data;
 6162  }
 6163
 6164  if (type) {
 6165    if (htmlBuilder) {
 6166      _htmlGroupBuilders[type] = htmlBuilder;
 6167    }
 6168
 6169    if (mathmlBuilder) {
 6170      _mathmlGroupBuilders[type] = mathmlBuilder;
 6171    }
 6172  }
 6173}
 6174/**
 6175 * Use this to register only the HTML and MathML builders for a function (e.g.
 6176 * if the function's ParseNode is generated in Parser.js rather than via a
 6177 * stand-alone handler provided to `defineFunction`).
 6178 */
 6179
 6180function defineFunctionBuilders(_ref2) {
 6181  var type = _ref2.type,
 6182      htmlBuilder = _ref2.htmlBuilder,
 6183      mathmlBuilder = _ref2.mathmlBuilder;
 6184  defineFunction({
 6185    type: type,
 6186    names: [],
 6187    props: {
 6188      numArgs: 0
 6189    },
 6190    handler: function handler() {
 6191      throw new Error('Should never be called.');
 6192    },
 6193    htmlBuilder: htmlBuilder,
 6194    mathmlBuilder: mathmlBuilder
 6195  });
 6196}
 6197var normalizeArgument = function normalizeArgument(arg) {
 6198  return arg.type === "ordgroup" && arg.body.length === 1 ? arg.body[0] : arg;
 6199}; // Since the corresponding buildHTML/buildMathML function expects a
 6200// list of elements, we normalize for different kinds of arguments
 6201
 6202var ordargument = function ordargument(arg) {
 6203  return arg.type === "ordgroup" ? arg.body : [arg];
 6204};
 6205;// CONCATENATED MODULE: ./src/buildHTML.js
 6206/**
 6207 * This file does the main work of building a domTree structure from a parse
 6208 * tree. The entry point is the `buildHTML` function, which takes a parse tree.
 6209 * Then, the buildExpression, buildGroup, and various groupBuilders functions
 6210 * are called, to produce a final HTML tree.
 6211 */
 6212
 6213
 6214
 6215
 6216
 6217
 6218
 6219
 6220
 6221var buildHTML_makeSpan = buildCommon.makeSpan; // Binary atoms (first class `mbin`) change into ordinary atoms (`mord`)
 6222// depending on their surroundings. See TeXbook pg. 442-446, Rules 5 and 6,
 6223// and the text before Rule 19.
 6224
 6225var binLeftCanceller = ["leftmost", "mbin", "mopen", "mrel", "mop", "mpunct"];
 6226var binRightCanceller = ["rightmost", "mrel", "mclose", "mpunct"];
 6227var styleMap = {
 6228  "display": src_Style.DISPLAY,
 6229  "text": src_Style.TEXT,
 6230  "script": src_Style.SCRIPT,
 6231  "scriptscript": src_Style.SCRIPTSCRIPT
 6232};
 6233var DomEnum = {
 6234  mord: "mord",
 6235  mop: "mop",
 6236  mbin: "mbin",
 6237  mrel: "mrel",
 6238  mopen: "mopen",
 6239  mclose: "mclose",
 6240  mpunct: "mpunct",
 6241  minner: "minner"
 6242};
 6243
 6244/**
 6245 * Take a list of nodes, build them in order, and return a list of the built
 6246 * nodes. documentFragments are flattened into their contents, so the
 6247 * returned list contains no fragments. `isRealGroup` is true if `expression`
 6248 * is a real group (no atoms will be added on either side), as opposed to
 6249 * a partial group (e.g. one created by \color). `surrounding` is an array
 6250 * consisting type of nodes that will be added to the left and right.
 6251 */
 6252var buildExpression = function buildExpression(expression, options, isRealGroup, surrounding) {
 6253  if (surrounding === void 0) {
 6254    surrounding = [null, null];
 6255  }
 6256
 6257  // Parse expressions into `groups`.
 6258  var groups = [];
 6259
 6260  for (var i = 0; i < expression.length; i++) {
 6261    var output = buildGroup(expression[i], options);
 6262
 6263    if (output instanceof DocumentFragment) {
 6264      var children = output.children;
 6265      groups.push.apply(groups, children);
 6266    } else {
 6267      groups.push(output);
 6268    }
 6269  } // Combine consecutive domTree.symbolNodes into a single symbolNode.
 6270
 6271
 6272  buildCommon.tryCombineChars(groups); // If `expression` is a partial group, let the parent handle spacings
 6273  // to avoid processing groups multiple times.
 6274
 6275  if (!isRealGroup) {
 6276    return groups;
 6277  }
 6278
 6279  var glueOptions = options;
 6280
 6281  if (expression.length === 1) {
 6282    var node = expression[0];
 6283
 6284    if (node.type === "sizing") {
 6285      glueOptions = options.havingSize(node.size);
 6286    } else if (node.type === "styling") {
 6287      glueOptions = options.havingStyle(styleMap[node.style]);
 6288    }
 6289  } // Dummy spans for determining spacings between surrounding atoms.
 6290  // If `expression` has no atoms on the left or right, class "leftmost"
 6291  // or "rightmost", respectively, is used to indicate it.
 6292
 6293
 6294  var dummyPrev = buildHTML_makeSpan([surrounding[0] || "leftmost"], [], options);
 6295  var dummyNext = buildHTML_makeSpan([surrounding[1] || "rightmost"], [], options); // TODO: These code assumes that a node's math class is the first element
 6296  // of its `classes` array. A later cleanup should ensure this, for
 6297  // instance by changing the signature of `makeSpan`.
 6298  // Before determining what spaces to insert, perform bin cancellation.
 6299  // Binary operators change to ordinary symbols in some contexts.
 6300
 6301  var isRoot = isRealGroup === "root";
 6302  traverseNonSpaceNodes(groups, function (node, prev) {
 6303    var prevType = prev.classes[0];
 6304    var type = node.classes[0];
 6305
 6306    if (prevType === "mbin" && utils.contains(binRightCanceller, type)) {
 6307      prev.classes[0] = "mord";
 6308    } else if (type === "mbin" && utils.contains(binLeftCanceller, prevType)) {
 6309      node.classes[0] = "mord";
 6310    }
 6311  }, {
 6312    node: dummyPrev
 6313  }, dummyNext, isRoot);
 6314  traverseNonSpaceNodes(groups, function (node, prev) {
 6315    var prevType = getTypeOfDomTree(prev);
 6316    var type = getTypeOfDomTree(node); // 'mtight' indicates that the node is script or scriptscript style.
 6317
 6318    var space = prevType && type ? node.hasClass("mtight") ? tightSpacings[prevType][type] : spacings[prevType][type] : null;
 6319
 6320    if (space) {
 6321      // Insert glue (spacing) after the `prev`.
 6322      return buildCommon.makeGlue(space, glueOptions);
 6323    }
 6324  }, {
 6325    node: dummyPrev
 6326  }, dummyNext, isRoot);
 6327  return groups;
 6328}; // Depth-first traverse non-space `nodes`, calling `callback` with the current and
 6329// previous node as arguments, optionally returning a node to insert after the
 6330// previous node. `prev` is an object with the previous node and `insertAfter`
 6331// function to insert after it. `next` is a node that will be added to the right.
 6332// Used for bin cancellation and inserting spacings.
 6333
 6334var traverseNonSpaceNodes = function traverseNonSpaceNodes(nodes, callback, prev, next, isRoot) {
 6335  if (next) {
 6336    // temporarily append the right node, if exists
 6337    nodes.push(next);
 6338  }
 6339
 6340  var i = 0;
 6341
 6342  for (; i < nodes.length; i++) {
 6343    var node = nodes[i];
 6344    var partialGroup = checkPartialGroup(node);
 6345
 6346    if (partialGroup) {
 6347      // Recursive DFS
 6348      // $FlowFixMe: make nodes a $ReadOnlyArray by returning a new array
 6349      traverseNonSpaceNodes(partialGroup.children, callback, prev, null, isRoot);
 6350      continue;
 6351    } // Ignore explicit spaces (e.g., \;, \,) when determining what implicit
 6352    // spacing should go between atoms of different classes
 6353
 6354
 6355    var nonspace = !node.hasClass("mspace");
 6356
 6357    if (nonspace) {
 6358      var result = callback(node, prev.node);
 6359
 6360      if (result) {
 6361        if (prev.insertAfter) {
 6362          prev.insertAfter(result);
 6363        } else {
 6364          // insert at front
 6365          nodes.unshift(result);
 6366          i++;
 6367        }
 6368      }
 6369    }
 6370
 6371    if (nonspace) {
 6372      prev.node = node;
 6373    } else if (isRoot && node.hasClass("newline")) {
 6374      prev.node = buildHTML_makeSpan(["leftmost"]); // treat like beginning of line
 6375    }
 6376
 6377    prev.insertAfter = function (index) {
 6378      return function (n) {
 6379        nodes.splice(index + 1, 0, n);
 6380        i++;
 6381      };
 6382    }(i);
 6383  }
 6384
 6385  if (next) {
 6386    nodes.pop();
 6387  }
 6388}; // Check if given node is a partial group, i.e., does not affect spacing around.
 6389
 6390
 6391var checkPartialGroup = function checkPartialGroup(node) {
 6392  if (node instanceof DocumentFragment || node instanceof Anchor || node instanceof Span && node.hasClass("enclosing")) {
 6393    return node;
 6394  }
 6395
 6396  return null;
 6397}; // Return the outermost node of a domTree.
 6398
 6399
 6400var getOutermostNode = function getOutermostNode(node, side) {
 6401  var partialGroup = checkPartialGroup(node);
 6402
 6403  if (partialGroup) {
 6404    var children = partialGroup.children;
 6405
 6406    if (children.length) {
 6407      if (side === "right") {
 6408        return getOutermostNode(children[children.length - 1], "right");
 6409      } else if (side === "left") {
 6410        return getOutermostNode(children[0], "left");
 6411      }
 6412    }
 6413  }
 6414
 6415  return node;
 6416}; // Return math atom class (mclass) of a domTree.
 6417// If `side` is given, it will get the type of the outermost node at given side.
 6418
 6419
 6420var getTypeOfDomTree = function getTypeOfDomTree(node, side) {
 6421  if (!node) {
 6422    return null;
 6423  }
 6424
 6425  if (side) {
 6426    node = getOutermostNode(node, side);
 6427  } // This makes a lot of assumptions as to where the type of atom
 6428  // appears.  We should do a better job of enforcing this.
 6429
 6430
 6431  return DomEnum[node.classes[0]] || null;
 6432};
 6433var makeNullDelimiter = function makeNullDelimiter(options, classes) {
 6434  var moreClasses = ["nulldelimiter"].concat(options.baseSizingClasses());
 6435  return buildHTML_makeSpan(classes.concat(moreClasses));
 6436};
 6437/**
 6438 * buildGroup is the function that takes a group and calls the correct groupType
 6439 * function for it. It also handles the interaction of size and style changes
 6440 * between parents and children.
 6441 */
 6442
 6443var buildGroup = function buildGroup(group, options, baseOptions) {
 6444  if (!group) {
 6445    return buildHTML_makeSpan();
 6446  }
 6447
 6448  if (_htmlGroupBuilders[group.type]) {
 6449    // Call the groupBuilders function
 6450    // $FlowFixMe
 6451    var groupNode = _htmlGroupBuilders[group.type](group, options); // If the size changed between the parent and the current group, account
 6452    // for that size difference.
 6453
 6454    if (baseOptions && options.size !== baseOptions.size) {
 6455      groupNode = buildHTML_makeSpan(options.sizingClasses(baseOptions), [groupNode], options);
 6456      var multiplier = options.sizeMultiplier / baseOptions.sizeMultiplier;
 6457      groupNode.height *= multiplier;
 6458      groupNode.depth *= multiplier;
 6459    }
 6460
 6461    return groupNode;
 6462  } else {
 6463    throw new src_ParseError("Got group of unknown type: '" + group.type + "'");
 6464  }
 6465};
 6466/**
 6467 * Combine an array of HTML DOM nodes (e.g., the output of `buildExpression`)
 6468 * into an unbreakable HTML node of class .base, with proper struts to
 6469 * guarantee correct vertical extent.  `buildHTML` calls this repeatedly to
 6470 * make up the entire expression as a sequence of unbreakable units.
 6471 */
 6472
 6473function buildHTMLUnbreakable(children, options) {
 6474  // Compute height and depth of this chunk.
 6475  var body = buildHTML_makeSpan(["base"], children, options); // Add strut, which ensures that the top of the HTML element falls at
 6476  // the height of the expression, and the bottom of the HTML element
 6477  // falls at the depth of the expression.
 6478
 6479  var strut = buildHTML_makeSpan(["strut"]);
 6480  strut.style.height = makeEm(body.height + body.depth);
 6481
 6482  if (body.depth) {
 6483    strut.style.verticalAlign = makeEm(-body.depth);
 6484  }
 6485
 6486  body.children.unshift(strut);
 6487  return body;
 6488}
 6489/**
 6490 * Take an entire parse tree, and build it into an appropriate set of HTML
 6491 * nodes.
 6492 */
 6493
 6494
 6495function buildHTML(tree, options) {
 6496  // Strip off outer tag wrapper for processing below.
 6497  var tag = null;
 6498
 6499  if (tree.length === 1 && tree[0].type === "tag") {
 6500    tag = tree[0].tag;
 6501    tree = tree[0].body;
 6502  } // Build the expression contained in the tree
 6503
 6504
 6505  var expression = buildExpression(tree, options, "root");
 6506  var eqnNum;
 6507
 6508  if (expression.length === 2 && expression[1].hasClass("tag")) {
 6509    // An environment with automatic equation numbers, e.g. {gather}.
 6510    eqnNum = expression.pop();
 6511  }
 6512
 6513  var children = []; // Create one base node for each chunk between potential line breaks.
 6514  // The TeXBook [p.173] says "A formula will be broken only after a
 6515  // relation symbol like $=$ or $<$ or $\rightarrow$, or after a binary
 6516  // operation symbol like $+$ or $-$ or $\times$, where the relation or
 6517  // binary operation is on the ``outer level'' of the formula (i.e., not
 6518  // enclosed in {...} and not part of an \over construction)."
 6519
 6520  var parts = [];
 6521
 6522  for (var i = 0; i < expression.length; i++) {
 6523    parts.push(expression[i]);
 6524
 6525    if (expression[i].hasClass("mbin") || expression[i].hasClass("mrel") || expression[i].hasClass("allowbreak")) {
 6526      // Put any post-operator glue on same line as operator.
 6527      // Watch for \nobreak along the way, and stop at \newline.
 6528      var nobreak = false;
 6529
 6530      while (i < expression.length - 1 && expression[i + 1].hasClass("mspace") && !expression[i + 1].hasClass("newline")) {
 6531        i++;
 6532        parts.push(expression[i]);
 6533
 6534        if (expression[i].hasClass("nobreak")) {
 6535          nobreak = true;
 6536        }
 6537      } // Don't allow break if \nobreak among the post-operator glue.
 6538
 6539
 6540      if (!nobreak) {
 6541        children.push(buildHTMLUnbreakable(parts, options));
 6542        parts = [];
 6543      }
 6544    } else if (expression[i].hasClass("newline")) {
 6545      // Write the line except the newline
 6546      parts.pop();
 6547
 6548      if (parts.length > 0) {
 6549        children.push(buildHTMLUnbreakable(parts, options));
 6550        parts = [];
 6551      } // Put the newline at the top level
 6552
 6553
 6554      children.push(expression[i]);
 6555    }
 6556  }
 6557
 6558  if (parts.length > 0) {
 6559    children.push(buildHTMLUnbreakable(parts, options));
 6560  } // Now, if there was a tag, build it too and append it as a final child.
 6561
 6562
 6563  var tagChild;
 6564
 6565  if (tag) {
 6566    tagChild = buildHTMLUnbreakable(buildExpression(tag, options, true));
 6567    tagChild.classes = ["tag"];
 6568    children.push(tagChild);
 6569  } else if (eqnNum) {
 6570    children.push(eqnNum);
 6571  }
 6572
 6573  var htmlNode = buildHTML_makeSpan(["katex-html"], children);
 6574  htmlNode.setAttribute("aria-hidden", "true"); // Adjust the strut of the tag to be the maximum height of all children
 6575  // (the height of the enclosing htmlNode) for proper vertical alignment.
 6576
 6577  if (tagChild) {
 6578    var strut = tagChild.children[0];
 6579    strut.style.height = makeEm(htmlNode.height + htmlNode.depth);
 6580
 6581    if (htmlNode.depth) {
 6582      strut.style.verticalAlign = makeEm(-htmlNode.depth);
 6583    }
 6584  }
 6585
 6586  return htmlNode;
 6587}
 6588;// CONCATENATED MODULE: ./src/mathMLTree.js
 6589/**
 6590 * These objects store data about MathML nodes. This is the MathML equivalent
 6591 * of the types in domTree.js. Since MathML handles its own rendering, and
 6592 * since we're mainly using MathML to improve accessibility, we don't manage
 6593 * any of the styling state that the plain DOM nodes do.
 6594 *
 6595 * The `toNode` and `toMarkup` functions work simlarly to how they do in
 6596 * domTree.js, creating namespaced DOM nodes and HTML text markup respectively.
 6597 */
 6598
 6599
 6600
 6601
 6602function newDocumentFragment(children) {
 6603  return new DocumentFragment(children);
 6604}
 6605/**
 6606 * This node represents a general purpose MathML node of any type. The
 6607 * constructor requires the type of node to create (for example, `"mo"` or
 6608 * `"mspace"`, corresponding to `<mo>` and `<mspace>` tags).
 6609 */
 6610
 6611var MathNode = /*#__PURE__*/function () {
 6612  function MathNode(type, children, classes) {
 6613    this.type = void 0;
 6614    this.attributes = void 0;
 6615    this.children = void 0;
 6616    this.classes = void 0;
 6617    this.type = type;
 6618    this.attributes = {};
 6619    this.children = children || [];
 6620    this.classes = classes || [];
 6621  }
 6622  /**
 6623   * Sets an attribute on a MathML node. MathML depends on attributes to convey a
 6624   * semantic content, so this is used heavily.
 6625   */
 6626
 6627
 6628  var _proto = MathNode.prototype;
 6629
 6630  _proto.setAttribute = function setAttribute(name, value) {
 6631    this.attributes[name] = value;
 6632  }
 6633  /**
 6634   * Gets an attribute on a MathML node.
 6635   */
 6636  ;
 6637
 6638  _proto.getAttribute = function getAttribute(name) {
 6639    return this.attributes[name];
 6640  }
 6641  /**
 6642   * Converts the math node into a MathML-namespaced DOM element.
 6643   */
 6644  ;
 6645
 6646  _proto.toNode = function toNode() {
 6647    var node = document.createElementNS("http://www.w3.org/1998/Math/MathML", this.type);
 6648
 6649    for (var attr in this.attributes) {
 6650      if (Object.prototype.hasOwnProperty.call(this.attributes, attr)) {
 6651        node.setAttribute(attr, this.attributes[attr]);
 6652      }
 6653    }
 6654
 6655    if (this.classes.length > 0) {
 6656      node.className = createClass(this.classes);
 6657    }
 6658
 6659    for (var i = 0; i < this.children.length; i++) {
 6660      node.appendChild(this.children[i].toNode());
 6661    }
 6662
 6663    return node;
 6664  }
 6665  /**
 6666   * Converts the math node into an HTML markup string.
 6667   */
 6668  ;
 6669
 6670  _proto.toMarkup = function toMarkup() {
 6671    var markup = "<" + this.type; // Add the attributes
 6672
 6673    for (var attr in this.attributes) {
 6674      if (Object.prototype.hasOwnProperty.call(this.attributes, attr)) {
 6675        markup += " " + attr + "=\"";
 6676        markup += utils.escape(this.attributes[attr]);
 6677        markup += "\"";
 6678      }
 6679    }
 6680
 6681    if (this.classes.length > 0) {
 6682      markup += " class =\"" + utils.escape(createClass(this.classes)) + "\"";
 6683    }
 6684
 6685    markup += ">";
 6686
 6687    for (var i = 0; i < this.children.length; i++) {
 6688      markup += this.children[i].toMarkup();
 6689    }
 6690
 6691    markup += "</" + this.type + ">";
 6692    return markup;
 6693  }
 6694  /**
 6695   * Converts the math node into a string, similar to innerText, but escaped.
 6696   */
 6697  ;
 6698
 6699  _proto.toText = function toText() {
 6700    return this.children.map(function (child) {
 6701      return child.toText();
 6702    }).join("");
 6703  };
 6704
 6705  return MathNode;
 6706}();
 6707/**
 6708 * This node represents a piece of text.
 6709 */
 6710
 6711var TextNode = /*#__PURE__*/function () {
 6712  function TextNode(text) {
 6713    this.text = void 0;
 6714    this.text = text;
 6715  }
 6716  /**
 6717   * Converts the text node into a DOM text node.
 6718   */
 6719
 6720
 6721  var _proto2 = TextNode.prototype;
 6722
 6723  _proto2.toNode = function toNode() {
 6724    return document.createTextNode(this.text);
 6725  }
 6726  /**
 6727   * Converts the text node into escaped HTML markup
 6728   * (representing the text itself).
 6729   */
 6730  ;
 6731
 6732  _proto2.toMarkup = function toMarkup() {
 6733    return utils.escape(this.toText());
 6734  }
 6735  /**
 6736   * Converts the text node into a string
 6737   * (representing the text iteself).
 6738   */
 6739  ;
 6740
 6741  _proto2.toText = function toText() {
 6742    return this.text;
 6743  };
 6744
 6745  return TextNode;
 6746}();
 6747/**
 6748 * This node represents a space, but may render as <mspace.../> or as text,
 6749 * depending on the width.
 6750 */
 6751
 6752var SpaceNode = /*#__PURE__*/function () {
 6753  /**
 6754   * Create a Space node with width given in CSS ems.
 6755   */
 6756  function SpaceNode(width) {
 6757    this.width = void 0;
 6758    this.character = void 0;
 6759    this.width = width; // See https://www.w3.org/TR/2000/WD-MathML2-20000328/chapter6.html
 6760    // for a table of space-like characters.  We use Unicode
 6761    // representations instead of &LongNames; as it's not clear how to
 6762    // make the latter via document.createTextNode.
 6763
 6764    if (width >= 0.05555 && width <= 0.05556) {
 6765      this.character = "\u200A"; // &VeryThinSpace;
 6766    } else if (width >= 0.1666 && width <= 0.1667) {
 6767      this.character = "\u2009"; // &ThinSpace;
 6768    } else if (width >= 0.2222 && width <= 0.2223) {
 6769      this.character = "\u2005"; // &MediumSpace;
 6770    } else if (width >= 0.2777 && width <= 0.2778) {
 6771      this.character = "\u2005\u200A"; // &ThickSpace;
 6772    } else if (width >= -0.05556 && width <= -0.05555) {
 6773      this.character = "\u200A\u2063"; // &NegativeVeryThinSpace;
 6774    } else if (width >= -0.1667 && width <= -0.1666) {
 6775      this.character = "\u2009\u2063"; // &NegativeThinSpace;
 6776    } else if (width >= -0.2223 && width <= -0.2222) {
 6777      this.character = "\u205F\u2063"; // &NegativeMediumSpace;
 6778    } else if (width >= -0.2778 && width <= -0.2777) {
 6779      this.character = "\u2005\u2063"; // &NegativeThickSpace;
 6780    } else {
 6781      this.character = null;
 6782    }
 6783  }
 6784  /**
 6785   * Converts the math node into a MathML-namespaced DOM element.
 6786   */
 6787
 6788
 6789  var _proto3 = SpaceNode.prototype;
 6790
 6791  _proto3.toNode = function toNode() {
 6792    if (this.character) {
 6793      return document.createTextNode(this.character);
 6794    } else {
 6795      var node = document.createElementNS("http://www.w3.org/1998/Math/MathML", "mspace");
 6796      node.setAttribute("width", makeEm(this.width));
 6797      return node;
 6798    }
 6799  }
 6800  /**
 6801   * Converts the math node into an HTML markup string.
 6802   */
 6803  ;
 6804
 6805  _proto3.toMarkup = function toMarkup() {
 6806    if (this.character) {
 6807      return "<mtext>" + this.character + "</mtext>";
 6808    } else {
 6809      return "<mspace width=\"" + makeEm(this.width) + "\"/>";
 6810    }
 6811  }
 6812  /**
 6813   * Converts the math node into a string, similar to innerText.
 6814   */
 6815  ;
 6816
 6817  _proto3.toText = function toText() {
 6818    if (this.character) {
 6819      return this.character;
 6820    } else {
 6821      return " ";
 6822    }
 6823  };
 6824
 6825  return SpaceNode;
 6826}();
 6827
 6828/* harmony default export */ var mathMLTree = ({
 6829  MathNode: MathNode,
 6830  TextNode: TextNode,
 6831  SpaceNode: SpaceNode,
 6832  newDocumentFragment: newDocumentFragment
 6833});
 6834;// CONCATENATED MODULE: ./src/buildMathML.js
 6835/**
 6836 * This file converts a parse tree into a cooresponding MathML tree. The main
 6837 * entry point is the `buildMathML` function, which takes a parse tree from the
 6838 * parser.
 6839 */
 6840
 6841
 6842
 6843
 6844
 6845
 6846
 6847
 6848
 6849/**
 6850 * Takes a symbol and converts it into a MathML text node after performing
 6851 * optional replacement from symbols.js.
 6852 */
 6853var makeText = function makeText(text, mode, options) {
 6854  if (src_symbols[mode][text] && src_symbols[mode][text].replace && text.charCodeAt(0) !== 0xD835 && !(ligatures.hasOwnProperty(text) && options && (options.fontFamily && options.fontFamily.substr(4, 2) === "tt" || options.font && options.font.substr(4, 2) === "tt"))) {
 6855    text = src_symbols[mode][text].replace;
 6856  }
 6857
 6858  return new mathMLTree.TextNode(text);
 6859};
 6860/**
 6861 * Wrap the given array of nodes in an <mrow> node if needed, i.e.,
 6862 * unless the array has length 1.  Always returns a single node.
 6863 */
 6864
 6865var makeRow = function makeRow(body) {
 6866  if (body.length === 1) {
 6867    return body[0];
 6868  } else {
 6869    return new mathMLTree.MathNode("mrow", body);
 6870  }
 6871};
 6872/**
 6873 * Returns the math variant as a string or null if none is required.
 6874 */
 6875
 6876var getVariant = function getVariant(group, options) {
 6877  // Handle \text... font specifiers as best we can.
 6878  // MathML has a limited list of allowable mathvariant specifiers; see
 6879  // https://www.w3.org/TR/MathML3/chapter3.html#presm.commatt
 6880  if (options.fontFamily === "texttt") {
 6881    return "monospace";
 6882  } else if (options.fontFamily === "textsf") {
 6883    if (options.fontShape === "textit" && options.fontWeight === "textbf") {
 6884      return "sans-serif-bold-italic";
 6885    } else if (options.fontShape === "textit") {
 6886      return "sans-serif-italic";
 6887    } else if (options.fontWeight === "textbf") {
 6888      return "bold-sans-serif";
 6889    } else {
 6890      return "sans-serif";
 6891    }
 6892  } else if (options.fontShape === "textit" && options.fontWeight === "textbf") {
 6893    return "bold-italic";
 6894  } else if (options.fontShape === "textit") {
 6895    return "italic";
 6896  } else if (options.fontWeight === "textbf") {
 6897    return "bold";
 6898  }
 6899
 6900  var font = options.font;
 6901
 6902  if (!font || font === "mathnormal") {
 6903    return null;
 6904  }
 6905
 6906  var mode = group.mode;
 6907
 6908  if (font === "mathit") {
 6909    return "italic";
 6910  } else if (font === "boldsymbol") {
 6911    return group.type === "textord" ? "bold" : "bold-italic";
 6912  } else if (font === "mathbf") {
 6913    return "bold";
 6914  } else if (font === "mathbb") {
 6915    return "double-struck";
 6916  } else if (font === "mathfrak") {
 6917    return "fraktur";
 6918  } else if (font === "mathscr" || font === "mathcal") {
 6919    // MathML makes no distinction between script and caligrahpic
 6920    return "script";
 6921  } else if (font === "mathsf") {
 6922    return "sans-serif";
 6923  } else if (font === "mathtt") {
 6924    return "monospace";
 6925  }
 6926
 6927  var text = group.text;
 6928
 6929  if (utils.contains(["\\imath", "\\jmath"], text)) {
 6930    return null;
 6931  }
 6932
 6933  if (src_symbols[mode][text] && src_symbols[mode][text].replace) {
 6934    text = src_symbols[mode][text].replace;
 6935  }
 6936
 6937  var fontName = buildCommon.fontMap[font].fontName;
 6938
 6939  if (getCharacterMetrics(text, fontName, mode)) {
 6940    return buildCommon.fontMap[font].variant;
 6941  }
 6942
 6943  return null;
 6944};
 6945/**
 6946 * Takes a list of nodes, builds them, and returns a list of the generated
 6947 * MathML nodes.  Also combine consecutive <mtext> outputs into a single
 6948 * <mtext> tag.
 6949 */
 6950
 6951var buildMathML_buildExpression = function buildExpression(expression, options, isOrdgroup) {
 6952  if (expression.length === 1) {
 6953    var group = buildMathML_buildGroup(expression[0], options);
 6954
 6955    if (isOrdgroup && group instanceof MathNode && group.type === "mo") {
 6956      // When TeX writers want to suppress spacing on an operator,
 6957      // they often put the operator by itself inside braces.
 6958      group.setAttribute("lspace", "0em");
 6959      group.setAttribute("rspace", "0em");
 6960    }
 6961
 6962    return [group];
 6963  }
 6964
 6965  var groups = [];
 6966  var lastGroup;
 6967
 6968  for (var i = 0; i < expression.length; i++) {
 6969    var _group = buildMathML_buildGroup(expression[i], options);
 6970
 6971    if (_group instanceof MathNode && lastGroup instanceof MathNode) {
 6972      // Concatenate adjacent <mtext>s
 6973      if (_group.type === 'mtext' && lastGroup.type === 'mtext' && _group.getAttribute('mathvariant') === lastGroup.getAttribute('mathvariant')) {
 6974        var _lastGroup$children;
 6975
 6976        (_lastGroup$children = lastGroup.children).push.apply(_lastGroup$children, _group.children);
 6977
 6978        continue; // Concatenate adjacent <mn>s
 6979      } else if (_group.type === 'mn' && lastGroup.type === 'mn') {
 6980        var _lastGroup$children2;
 6981
 6982        (_lastGroup$children2 = lastGroup.children).push.apply(_lastGroup$children2, _group.children);
 6983
 6984        continue; // Concatenate <mn>...</mn> followed by <mi>.</mi>
 6985      } else if (_group.type === 'mi' && _group.children.length === 1 && lastGroup.type === 'mn') {
 6986        var child = _group.children[0];
 6987
 6988        if (child instanceof TextNode && child.text === '.') {
 6989          var _lastGroup$children3;
 6990
 6991          (_lastGroup$children3 = lastGroup.children).push.apply(_lastGroup$children3, _group.children);
 6992
 6993          continue;
 6994        }
 6995      } else if (lastGroup.type === 'mi' && lastGroup.children.length === 1) {
 6996        var lastChild = lastGroup.children[0];
 6997
 6998        if (lastChild instanceof TextNode && lastChild.text === "\u0338" && (_group.type === 'mo' || _group.type === 'mi' || _group.type === 'mn')) {
 6999          var _child = _group.children[0];
 7000
 7001          if (_child instanceof TextNode && _child.text.length > 0) {
 7002            // Overlay with combining character long solidus
 7003            _child.text = _child.text.slice(0, 1) + "\u0338" + _child.text.slice(1);
 7004            groups.pop();
 7005          }
 7006        }
 7007      }
 7008    }
 7009
 7010    groups.push(_group);
 7011    lastGroup = _group;
 7012  }
 7013
 7014  return groups;
 7015};
 7016/**
 7017 * Equivalent to buildExpression, but wraps the elements in an <mrow>
 7018 * if there's more than one.  Returns a single node instead of an array.
 7019 */
 7020
 7021var buildExpressionRow = function buildExpressionRow(expression, options, isOrdgroup) {
 7022  return makeRow(buildMathML_buildExpression(expression, options, isOrdgroup));
 7023};
 7024/**
 7025 * Takes a group from the parser and calls the appropriate groupBuilders function
 7026 * on it to produce a MathML node.
 7027 */
 7028
 7029var buildMathML_buildGroup = function buildGroup(group, options) {
 7030  if (!group) {
 7031    return new mathMLTree.MathNode("mrow");
 7032  }
 7033
 7034  if (_mathmlGroupBuilders[group.type]) {
 7035    // Call the groupBuilders function
 7036    // $FlowFixMe
 7037    var result = _mathmlGroupBuilders[group.type](group, options); // $FlowFixMe
 7038
 7039    return result;
 7040  } else {
 7041    throw new src_ParseError("Got group of unknown type: '" + group.type + "'");
 7042  }
 7043};
 7044/**
 7045 * Takes a full parse tree and settings and builds a MathML representation of
 7046 * it. In particular, we put the elements from building the parse tree into a
 7047 * <semantics> tag so we can also include that TeX source as an annotation.
 7048 *
 7049 * Note that we actually return a domTree element with a `<math>` inside it so
 7050 * we can do appropriate styling.
 7051 */
 7052
 7053function buildMathML(tree, texExpression, options, isDisplayMode, forMathmlOnly) {
 7054  var expression = buildMathML_buildExpression(tree, options); // TODO: Make a pass thru the MathML similar to buildHTML.traverseNonSpaceNodes
 7055  // and add spacing nodes. This is necessary only adjacent to math operators
 7056  // like \sin or \lim or to subsup elements that contain math operators.
 7057  // MathML takes care of the other spacing issues.
 7058  // Wrap up the expression in an mrow so it is presented in the semantics
 7059  // tag correctly, unless it's a single <mrow> or <mtable>.
 7060
 7061  var wrapper;
 7062
 7063  if (expression.length === 1 && expression[0] instanceof MathNode && utils.contains(["mrow", "mtable"], expression[0].type)) {
 7064    wrapper = expression[0];
 7065  } else {
 7066    wrapper = new mathMLTree.MathNode("mrow", expression);
 7067  } // Build a TeX annotation of the source
 7068
 7069
 7070  var annotation = new mathMLTree.MathNode("annotation", [new mathMLTree.TextNode(texExpression)]);
 7071  annotation.setAttribute("encoding", "application/x-tex");
 7072  var semantics = new mathMLTree.MathNode("semantics", [wrapper, annotation]);
 7073  var math = new mathMLTree.MathNode("math", [semantics]);
 7074  math.setAttribute("xmlns", "http://www.w3.org/1998/Math/MathML");
 7075
 7076  if (isDisplayMode) {
 7077    math.setAttribute("display", "block");
 7078  } // You can't style <math> nodes, so we wrap the node in a span.
 7079  // NOTE: The span class is not typed to have <math> nodes as children, and
 7080  // we don't want to make the children type more generic since the children
 7081  // of span are expected to have more fields in `buildHtml` contexts.
 7082
 7083
 7084  var wrapperClass = forMathmlOnly ? "katex" : "katex-mathml"; // $FlowFixMe
 7085
 7086  return buildCommon.makeSpan([wrapperClass], [math]);
 7087}
 7088;// CONCATENATED MODULE: ./src/buildTree.js
 7089
 7090
 7091
 7092
 7093
 7094
 7095
 7096var optionsFromSettings = function optionsFromSettings(settings) {
 7097  return new src_Options({
 7098    style: settings.displayMode ? src_Style.DISPLAY : src_Style.TEXT,
 7099    maxSize: settings.maxSize,
 7100    minRuleThickness: settings.minRuleThickness
 7101  });
 7102};
 7103
 7104var displayWrap = function displayWrap(node, settings) {
 7105  if (settings.displayMode) {
 7106    var classes = ["katex-display"];
 7107
 7108    if (settings.leqno) {
 7109      classes.push("leqno");
 7110    }
 7111
 7112    if (settings.fleqn) {
 7113      classes.push("fleqn");
 7114    }
 7115
 7116    node = buildCommon.makeSpan(classes, [node]);
 7117  }
 7118
 7119  return node;
 7120};
 7121
 7122var buildTree = function buildTree(tree, expression, settings) {
 7123  var options = optionsFromSettings(settings);
 7124  var katexNode;
 7125
 7126  if (settings.output === "mathml") {
 7127    return buildMathML(tree, expression, options, settings.displayMode, true);
 7128  } else if (settings.output === "html") {
 7129    var htmlNode = buildHTML(tree, options);
 7130    katexNode = buildCommon.makeSpan(["katex"], [htmlNode]);
 7131  } else {
 7132    var mathMLNode = buildMathML(tree, expression, options, settings.displayMode, false);
 7133
 7134    var _htmlNode = buildHTML(tree, options);
 7135
 7136    katexNode = buildCommon.makeSpan(["katex"], [mathMLNode, _htmlNode]);
 7137  }
 7138
 7139  return displayWrap(katexNode, settings);
 7140};
 7141var buildHTMLTree = function buildHTMLTree(tree, expression, settings) {
 7142  var options = optionsFromSettings(settings);
 7143  var htmlNode = buildHTML(tree, options);
 7144  var katexNode = buildCommon.makeSpan(["katex"], [htmlNode]);
 7145  return displayWrap(katexNode, settings);
 7146};
 7147/* harmony default export */ var src_buildTree = ((/* unused pure expression or super */ null && (buildTree)));
 7148;// CONCATENATED MODULE: ./src/stretchy.js
 7149/**
 7150 * This file provides support to buildMathML.js and buildHTML.js
 7151 * for stretchy wide elements rendered from SVG files
 7152 * and other CSS trickery.
 7153 */
 7154
 7155
 7156
 7157
 7158
 7159var stretchyCodePoint = {
 7160  widehat: "^",
 7161  widecheck: "ˇ",
 7162  widetilde: "~",
 7163  utilde: "~",
 7164  overleftarrow: "\u2190",
 7165  underleftarrow: "\u2190",
 7166  xleftarrow: "\u2190",
 7167  overrightarrow: "\u2192",
 7168  underrightarrow: "\u2192",
 7169  xrightarrow: "\u2192",
 7170  underbrace: "\u23DF",
 7171  overbrace: "\u23DE",
 7172  overgroup: "\u23E0",
 7173  undergroup: "\u23E1",
 7174  overleftrightarrow: "\u2194",
 7175  underleftrightarrow: "\u2194",
 7176  xleftrightarrow: "\u2194",
 7177  Overrightarrow: "\u21D2",
 7178  xRightarrow: "\u21D2",
 7179  overleftharpoon: "\u21BC",
 7180  xleftharpoonup: "\u21BC",
 7181  overrightharpoon: "\u21C0",
 7182  xrightharpoonup: "\u21C0",
 7183  xLeftarrow: "\u21D0",
 7184  xLeftrightarrow: "\u21D4",
 7185  xhookleftarrow: "\u21A9",
 7186  xhookrightarrow: "\u21AA",
 7187  xmapsto: "\u21A6",
 7188  xrightharpoondown: "\u21C1",
 7189  xleftharpoondown: "\u21BD",
 7190  xrightleftharpoons: "\u21CC",
 7191  xleftrightharpoons: "\u21CB",
 7192  xtwoheadleftarrow: "\u219E",
 7193  xtwoheadrightarrow: "\u21A0",
 7194  xlongequal: "=",
 7195  xtofrom: "\u21C4",
 7196  xrightleftarrows: "\u21C4",
 7197  xrightequilibrium: "\u21CC",
 7198  // Not a perfect match.
 7199  xleftequilibrium: "\u21CB",
 7200  // None better available.
 7201  "\\cdrightarrow": "\u2192",
 7202  "\\cdleftarrow": "\u2190",
 7203  "\\cdlongequal": "="
 7204};
 7205
 7206var mathMLnode = function mathMLnode(label) {
 7207  var node = new mathMLTree.MathNode("mo", [new mathMLTree.TextNode(stretchyCodePoint[label.replace(/^\\/, '')])]);
 7208  node.setAttribute("stretchy", "true");
 7209  return node;
 7210}; // Many of the KaTeX SVG images have been adapted from glyphs in KaTeX fonts.
 7211// Copyright (c) 2009-2010, Design Science, Inc. (<www.mathjax.org>)
 7212// Copyright (c) 2014-2017 Khan Academy (<www.khanacademy.org>)
 7213// Licensed under the SIL Open Font License, Version 1.1.
 7214// See \nhttp://scripts.sil.org/OFL
 7215// Very Long SVGs
 7216//    Many of the KaTeX stretchy wide elements use a long SVG image and an
 7217//    overflow: hidden tactic to achieve a stretchy image while avoiding
 7218//    distortion of arrowheads or brace corners.
 7219//    The SVG typically contains a very long (400 em) arrow.
 7220//    The SVG is in a container span that has overflow: hidden, so the span
 7221//    acts like a window that exposes only part of the  SVG.
 7222//    The SVG always has a longer, thinner aspect ratio than the container span.
 7223//    After the SVG fills 100% of the height of the container span,
 7224//    there is a long arrow shaft left over. That left-over shaft is not shown.
 7225//    Instead, it is sliced off because the span's CSS has overflow: hidden.
 7226//    Thus, the reader sees an arrow that matches the subject matter width
 7227//    without distortion.
 7228//    Some functions, such as \cancel, need to vary their aspect ratio. These
 7229//    functions do not get the overflow SVG treatment.
 7230// Second Brush Stroke
 7231//    Low resolution monitors struggle to display images in fine detail.
 7232//    So browsers apply anti-aliasing. A long straight arrow shaft therefore
 7233//    will sometimes appear as if it has a blurred edge.
 7234//    To mitigate this, these SVG files contain a second "brush-stroke" on the
 7235//    arrow shafts. That is, a second long thin rectangular SVG path has been
 7236//    written directly on top of each arrow shaft. This reinforcement causes
 7237//    some of the screen pixels to display as black instead of the anti-aliased
 7238//    gray pixel that a  single path would generate. So we get arrow shafts
 7239//    whose edges appear to be sharper.
 7240// In the katexImagesData object just below, the dimensions all
 7241// correspond to path geometry inside the relevant SVG.
 7242// For example, \overrightarrow uses the same arrowhead as glyph U+2192
 7243// from the KaTeX Main font. The scaling factor is 1000.
 7244// That is, inside the font, that arrowhead is 522 units tall, which
 7245// corresponds to 0.522 em inside the document.
 7246
 7247
 7248var katexImagesData = {
 7249  //   path(s), minWidth, height, align
 7250  overrightarrow: [["rightarrow"], 0.888, 522, "xMaxYMin"],
 7251  overleftarrow: [["leftarrow"], 0.888, 522, "xMinYMin"],
 7252  underrightarrow: [["rightarrow"], 0.888, 522, "xMaxYMin"],
 7253  underleftarrow: [["leftarrow"], 0.888, 522, "xMinYMin"],
 7254  xrightarrow: [["rightarrow"], 1.469, 522, "xMaxYMin"],
 7255  "\\cdrightarrow": [["rightarrow"], 3.0, 522, "xMaxYMin"],
 7256  // CD minwwidth2.5pc
 7257  xleftarrow: [["leftarrow"], 1.469, 522, "xMinYMin"],
 7258  "\\cdleftarrow": [["leftarrow"], 3.0, 522, "xMinYMin"],
 7259  Overrightarrow: [["doublerightarrow"], 0.888, 560, "xMaxYMin"],
 7260  xRightarrow: [["doublerightarrow"], 1.526, 560, "xMaxYMin"],
 7261  xLeftarrow: [["doubleleftarrow"], 1.526, 560, "xMinYMin"],
 7262  overleftharpoon: [["leftharpoon"], 0.888, 522, "xMinYMin"],
 7263  xleftharpoonup: [["leftharpoon"], 0.888, 522, "xMinYMin"],
 7264  xleftharpoondown: [["leftharpoondown"], 0.888, 522, "xMinYMin"],
 7265  overrightharpoon: [["rightharpoon"], 0.888, 522, "xMaxYMin"],
 7266  xrightharpoonup: [["rightharpoon"], 0.888, 522, "xMaxYMin"],
 7267  xrightharpoondown: [["rightharpoondown"], 0.888, 522, "xMaxYMin"],
 7268  xlongequal: [["longequal"], 0.888, 334, "xMinYMin"],
 7269  "\\cdlongequal": [["longequal"], 3.0, 334, "xMinYMin"],
 7270  xtwoheadleftarrow: [["twoheadleftarrow"], 0.888, 334, "xMinYMin"],
 7271  xtwoheadrightarrow: [["twoheadrightarrow"], 0.888, 334, "xMaxYMin"],
 7272  overleftrightarrow: [["leftarrow", "rightarrow"], 0.888, 522],
 7273  overbrace: [["leftbrace", "midbrace", "rightbrace"], 1.6, 548],
 7274  underbrace: [["leftbraceunder", "midbraceunder", "rightbraceunder"], 1.6, 548],
 7275  underleftrightarrow: [["leftarrow", "rightarrow"], 0.888, 522],
 7276  xleftrightarrow: [["leftarrow", "rightarrow"], 1.75, 522],
 7277  xLeftrightarrow: [["doubleleftarrow", "doublerightarrow"], 1.75, 560],
 7278  xrightleftharpoons: [["leftharpoondownplus", "rightharpoonplus"], 1.75, 716],
 7279  xleftrightharpoons: [["leftharpoonplus", "rightharpoondownplus"], 1.75, 716],
 7280  xhookleftarrow: [["leftarrow", "righthook"], 1.08, 522],
 7281  xhookrightarrow: [["lefthook", "rightarrow"], 1.08, 522],
 7282  overlinesegment: [["leftlinesegment", "rightlinesegment"], 0.888, 522],
 7283  underlinesegment: [["leftlinesegment", "rightlinesegment"], 0.888, 522],
 7284  overgroup: [["leftgroup", "rightgroup"], 0.888, 342],
 7285  undergroup: [["leftgroupunder", "rightgroupunder"], 0.888, 342],
 7286  xmapsto: [["leftmapsto", "rightarrow"], 1.5, 522],
 7287  xtofrom: [["leftToFrom", "rightToFrom"], 1.75, 528],
 7288  // The next three arrows are from the mhchem package.
 7289  // In mhchem.sty, min-length is 2.0em. But these arrows might appear in the
 7290  // document as \xrightarrow or \xrightleftharpoons. Those have
 7291  // min-length = 1.75em, so we set min-length on these next three to match.
 7292  xrightleftarrows: [["baraboveleftarrow", "rightarrowabovebar"], 1.75, 901],
 7293  xrightequilibrium: [["baraboveshortleftharpoon", "rightharpoonaboveshortbar"], 1.75, 716],
 7294  xleftequilibrium: [["shortbaraboveleftharpoon", "shortrightharpoonabovebar"], 1.75, 716]
 7295};
 7296
 7297var groupLength = function groupLength(arg) {
 7298  if (arg.type === "ordgroup") {
 7299    return arg.body.length;
 7300  } else {
 7301    return 1;
 7302  }
 7303};
 7304
 7305var svgSpan = function svgSpan(group, options) {
 7306  // Create a span with inline SVG for the element.
 7307  function buildSvgSpan_() {
 7308    var viewBoxWidth = 400000; // default
 7309
 7310    var label = group.label.substr(1);
 7311
 7312    if (utils.contains(["widehat", "widecheck", "widetilde", "utilde"], label)) {
 7313      // Each type in the `if` statement corresponds to one of the ParseNode
 7314      // types below. This narrowing is required to access `grp.base`.
 7315      // $FlowFixMe
 7316      var grp = group; // There are four SVG images available for each function.
 7317      // Choose a taller image when there are more characters.
 7318
 7319      var numChars = groupLength(grp.base);
 7320      var viewBoxHeight;
 7321      var pathName;
 7322
 7323      var _height;
 7324
 7325      if (numChars > 5) {
 7326        if (label === "widehat" || label === "widecheck") {
 7327          viewBoxHeight = 420;
 7328          viewBoxWidth = 2364;
 7329          _height = 0.42;
 7330          pathName = label + "4";
 7331        } else {
 7332          viewBoxHeight = 312;
 7333          viewBoxWidth = 2340;
 7334          _height = 0.34;
 7335          pathName = "tilde4";
 7336        }
 7337      } else {
 7338        var imgIndex = [1, 1, 2, 2, 3, 3][numChars];
 7339
 7340        if (label === "widehat" || label === "widecheck") {
 7341          viewBoxWidth = [0, 1062, 2364, 2364, 2364][imgIndex];
 7342          viewBoxHeight = [0, 239, 300, 360, 420][imgIndex];
 7343          _height = [0, 0.24, 0.3, 0.3, 0.36, 0.42][imgIndex];
 7344          pathName = label + imgIndex;
 7345        } else {
 7346          viewBoxWidth = [0, 600, 1033, 2339, 2340][imgIndex];
 7347          viewBoxHeight = [0, 260, 286, 306, 312][imgIndex];
 7348          _height = [0, 0.26, 0.286, 0.3, 0.306, 0.34][imgIndex];
 7349          pathName = "tilde" + imgIndex;
 7350        }
 7351      }
 7352
 7353      var path = new PathNode(pathName);
 7354      var svgNode = new SvgNode([path], {
 7355        "width": "100%",
 7356        "height": makeEm(_height),
 7357        "viewBox": "0 0 " + viewBoxWidth + " " + viewBoxHeight,
 7358        "preserveAspectRatio": "none"
 7359      });
 7360      return {
 7361        span: buildCommon.makeSvgSpan([], [svgNode], options),
 7362        minWidth: 0,
 7363        height: _height
 7364      };
 7365    } else {
 7366      var spans = [];
 7367      var data = katexImagesData[label];
 7368      var paths = data[0],
 7369          _minWidth = data[1],
 7370          _viewBoxHeight = data[2];
 7371
 7372      var _height2 = _viewBoxHeight / 1000;
 7373
 7374      var numSvgChildren = paths.length;
 7375      var widthClasses;
 7376      var aligns;
 7377
 7378      if (numSvgChildren === 1) {
 7379        // $FlowFixMe: All these cases must be of the 4-tuple type.
 7380        var align1 = data[3];
 7381        widthClasses = ["hide-tail"];
 7382        aligns = [align1];
 7383      } else if (numSvgChildren === 2) {
 7384        widthClasses = ["halfarrow-left", "halfarrow-right"];
 7385        aligns = ["xMinYMin", "xMaxYMin"];
 7386      } else if (numSvgChildren === 3) {
 7387        widthClasses = ["brace-left", "brace-center", "brace-right"];
 7388        aligns = ["xMinYMin", "xMidYMin", "xMaxYMin"];
 7389      } else {
 7390        throw new Error("Correct katexImagesData or update code here to support\n                    " + numSvgChildren + " children.");
 7391      }
 7392
 7393      for (var i = 0; i < numSvgChildren; i++) {
 7394        var _path = new PathNode(paths[i]);
 7395
 7396        var _svgNode = new SvgNode([_path], {
 7397          "width": "400em",
 7398          "height": makeEm(_height2),
 7399          "viewBox": "0 0 " + viewBoxWidth + " " + _viewBoxHeight,
 7400          "preserveAspectRatio": aligns[i] + " slice"
 7401        });
 7402
 7403        var _span = buildCommon.makeSvgSpan([widthClasses[i]], [_svgNode], options);
 7404
 7405        if (numSvgChildren === 1) {
 7406          return {
 7407            span: _span,
 7408            minWidth: _minWidth,
 7409            height: _height2
 7410          };
 7411        } else {
 7412          _span.style.height = makeEm(_height2);
 7413          spans.push(_span);
 7414        }
 7415      }
 7416
 7417      return {
 7418        span: buildCommon.makeSpan(["stretchy"], spans, options),
 7419        minWidth: _minWidth,
 7420        height: _height2
 7421      };
 7422    }
 7423  } // buildSvgSpan_()
 7424
 7425
 7426  var _buildSvgSpan_ = buildSvgSpan_(),
 7427      span = _buildSvgSpan_.span,
 7428      minWidth = _buildSvgSpan_.minWidth,
 7429      height = _buildSvgSpan_.height; // Note that we are returning span.depth = 0.
 7430  // Any adjustments relative to the baseline must be done in buildHTML.
 7431
 7432
 7433  span.height = height;
 7434  span.style.height = makeEm(height);
 7435
 7436  if (minWidth > 0) {
 7437    span.style.minWidth = makeEm(minWidth);
 7438  }
 7439
 7440  return span;
 7441};
 7442
 7443var encloseSpan = function encloseSpan(inner, label, topPad, bottomPad, options) {
 7444  // Return an image span for \cancel, \bcancel, \xcancel, \fbox, or \angl
 7445  var img;
 7446  var totalHeight = inner.height + inner.depth + topPad + bottomPad;
 7447
 7448  if (/fbox|color|angl/.test(label)) {
 7449    img = buildCommon.makeSpan(["stretchy", label], [], options);
 7450
 7451    if (label === "fbox") {
 7452      var color = options.color && options.getColor();
 7453
 7454      if (color) {
 7455        img.style.borderColor = color;
 7456      }
 7457    }
 7458  } else {
 7459    // \cancel, \bcancel, or \xcancel
 7460    // Since \cancel's SVG is inline and it omits the viewBox attribute,
 7461    // its stroke-width will not vary with span area.
 7462    var lines = [];
 7463
 7464    if (/^[bx]cancel$/.test(label)) {
 7465      lines.push(new LineNode({
 7466        "x1": "0",
 7467        "y1": "0",
 7468        "x2": "100%",
 7469        "y2": "100%",
 7470        "stroke-width": "0.046em"
 7471      }));
 7472    }
 7473
 7474    if (/^x?cancel$/.test(label)) {
 7475      lines.push(new LineNode({
 7476        "x1": "0",
 7477        "y1": "100%",
 7478        "x2": "100%",
 7479        "y2": "0",
 7480        "stroke-width": "0.046em"
 7481      }));
 7482    }
 7483
 7484    var svgNode = new SvgNode(lines, {
 7485      "width": "100%",
 7486      "height": makeEm(totalHeight)
 7487    });
 7488    img = buildCommon.makeSvgSpan([], [svgNode], options);
 7489  }
 7490
 7491  img.height = totalHeight;
 7492  img.style.height = makeEm(totalHeight);
 7493  return img;
 7494};
 7495
 7496/* harmony default export */ var stretchy = ({
 7497  encloseSpan: encloseSpan,
 7498  mathMLnode: mathMLnode,
 7499  svgSpan: svgSpan
 7500});
 7501;// CONCATENATED MODULE: ./src/parseNode.js
 7502
 7503
 7504/**
 7505 * Asserts that the node is of the given type and returns it with stricter
 7506 * typing. Throws if the node's type does not match.
 7507 */
 7508function assertNodeType(node, type) {
 7509  if (!node || node.type !== type) {
 7510    throw new Error("Expected node of type " + type + ", but got " + (node ? "node of type " + node.type : String(node)));
 7511  } // $FlowFixMe, >=0.125
 7512
 7513
 7514  return node;
 7515}
 7516/**
 7517 * Returns the node more strictly typed iff it is of the given type. Otherwise,
 7518 * returns null.
 7519 */
 7520
 7521function assertSymbolNodeType(node) {
 7522  var typedNode = checkSymbolNodeType(node);
 7523
 7524  if (!typedNode) {
 7525    throw new Error("Expected node of symbol group type, but got " + (node ? "node of type " + node.type : String(node)));
 7526  }
 7527
 7528  return typedNode;
 7529}
 7530/**
 7531 * Returns the node more strictly typed iff it is of the given type. Otherwise,
 7532 * returns null.
 7533 */
 7534
 7535function checkSymbolNodeType(node) {
 7536  if (node && (node.type === "atom" || NON_ATOMS.hasOwnProperty(node.type))) {
 7537    // $FlowFixMe
 7538    return node;
 7539  }
 7540
 7541  return null;
 7542}
 7543;// CONCATENATED MODULE: ./src/functions/accent.js
 7544
 7545
 7546
 7547
 7548
 7549
 7550
 7551
 7552
 7553
 7554// NOTE: Unlike most `htmlBuilder`s, this one handles not only "accent", but
 7555// also "supsub" since an accent can affect super/subscripting.
 7556var htmlBuilder = function htmlBuilder(grp, options) {
 7557  // Accents are handled in the TeXbook pg. 443, rule 12.
 7558  var base;
 7559  var group;
 7560  var supSubGroup;
 7561
 7562  if (grp && grp.type === "supsub") {
 7563    // If our base is a character box, and we have superscripts and
 7564    // subscripts, the supsub will defer to us. In particular, we want
 7565    // to attach the superscripts and subscripts to the inner body (so
 7566    // that the position of the superscripts and subscripts won't be
 7567    // affected by the height of the accent). We accomplish this by
 7568    // sticking the base of the accent into the base of the supsub, and
 7569    // rendering that, while keeping track of where the accent is.
 7570    // The real accent group is the base of the supsub group
 7571    group = assertNodeType(grp.base, "accent"); // The character box is the base of the accent group
 7572
 7573    base = group.base; // Stick the character box into the base of the supsub group
 7574
 7575    grp.base = base; // Rerender the supsub group with its new base, and store that
 7576    // result.
 7577
 7578    supSubGroup = assertSpan(buildGroup(grp, options)); // reset original base
 7579
 7580    grp.base = group;
 7581  } else {
 7582    group = assertNodeType(grp, "accent");
 7583    base = group.base;
 7584  } // Build the base group
 7585
 7586
 7587  var body = buildGroup(base, options.havingCrampedStyle()); // Does the accent need to shift for the skew of a character?
 7588
 7589  var mustShift = group.isShifty && utils.isCharacterBox(base); // Calculate the skew of the accent. This is based on the line "If the
 7590  // nucleus is not a single character, let s = 0; otherwise set s to the
 7591  // kern amount for the nucleus followed by the \skewchar of its font."
 7592  // Note that our skew metrics are just the kern between each character
 7593  // and the skewchar.
 7594
 7595  var skew = 0;
 7596
 7597  if (mustShift) {
 7598    // If the base is a character box, then we want the skew of the
 7599    // innermost character. To do that, we find the innermost character:
 7600    var baseChar = utils.getBaseElem(base); // Then, we render its group to get the symbol inside it
 7601
 7602    var baseGroup = buildGroup(baseChar, options.havingCrampedStyle()); // Finally, we pull the skew off of the symbol.
 7603
 7604    skew = assertSymbolDomNode(baseGroup).skew; // Note that we now throw away baseGroup, because the layers we
 7605    // removed with getBaseElem might contain things like \color which
 7606    // we can't get rid of.
 7607    // TODO(emily): Find a better way to get the skew
 7608  }
 7609
 7610  var accentBelow = group.label === "\\c"; // calculate the amount of space between the body and the accent
 7611
 7612  var clearance = accentBelow ? body.height + body.depth : Math.min(body.height, options.fontMetrics().xHeight); // Build the accent
 7613
 7614  var accentBody;
 7615
 7616  if (!group.isStretchy) {
 7617    var accent;
 7618    var width;
 7619
 7620    if (group.label === "\\vec") {
 7621      // Before version 0.9, \vec used the combining font glyph U+20D7.
 7622      // But browsers, especially Safari, are not consistent in how they
 7623      // render combining characters when not preceded by a character.
 7624      // So now we use an SVG.
 7625      // If Safari reforms, we should consider reverting to the glyph.
 7626      accent = buildCommon.staticSvg("vec", options);
 7627      width = buildCommon.svgData.vec[1];
 7628    } else {
 7629      accent = buildCommon.makeOrd({
 7630        mode: group.mode,
 7631        text: group.label
 7632      }, options, "textord");
 7633      accent = assertSymbolDomNode(accent); // Remove the italic correction of the accent, because it only serves to
 7634      // shift the accent over to a place we don't want.
 7635
 7636      accent.italic = 0;
 7637      width = accent.width;
 7638
 7639      if (accentBelow) {
 7640        clearance += accent.depth;
 7641      }
 7642    }
 7643
 7644    accentBody = buildCommon.makeSpan(["accent-body"], [accent]); // "Full" accents expand the width of the resulting symbol to be
 7645    // at least the width of the accent, and overlap directly onto the
 7646    // character without any vertical offset.
 7647
 7648    var accentFull = group.label === "\\textcircled";
 7649
 7650    if (accentFull) {
 7651      accentBody.classes.push('accent-full');
 7652      clearance = body.height;
 7653    } // Shift the accent over by the skew.
 7654
 7655
 7656    var left = skew; // CSS defines `.katex .accent .accent-body:not(.accent-full) { width: 0 }`
 7657    // so that the accent doesn't contribute to the bounding box.
 7658    // We need to shift the character by its width (effectively half
 7659    // its width) to compensate.
 7660
 7661    if (!accentFull) {
 7662      left -= width / 2;
 7663    }
 7664
 7665    accentBody.style.left = makeEm(left); // \textcircled uses the \bigcirc glyph, so it needs some
 7666    // vertical adjustment to match LaTeX.
 7667
 7668    if (group.label === "\\textcircled") {
 7669      accentBody.style.top = ".2em";
 7670    }
 7671
 7672    accentBody = buildCommon.makeVList({
 7673      positionType: "firstBaseline",
 7674      children: [{
 7675        type: "elem",
 7676        elem: body
 7677      }, {
 7678        type: "kern",
 7679        size: -clearance
 7680      }, {
 7681        type: "elem",
 7682        elem: accentBody
 7683      }]
 7684    }, options);
 7685  } else {
 7686    accentBody = stretchy.svgSpan(group, options);
 7687    accentBody = buildCommon.makeVList({
 7688      positionType: "firstBaseline",
 7689      children: [{
 7690        type: "elem",
 7691        elem: body
 7692      }, {
 7693        type: "elem",
 7694        elem: accentBody,
 7695        wrapperClasses: ["svg-align"],
 7696        wrapperStyle: skew > 0 ? {
 7697          width: "calc(100% - " + makeEm(2 * skew) + ")",
 7698          marginLeft: makeEm(2 * skew)
 7699        } : undefined
 7700      }]
 7701    }, options);
 7702  }
 7703
 7704  var accentWrap = buildCommon.makeSpan(["mord", "accent"], [accentBody], options);
 7705
 7706  if (supSubGroup) {
 7707    // Here, we replace the "base" child of the supsub with our newly
 7708    // generated accent.
 7709    supSubGroup.children[0] = accentWrap; // Since we don't rerun the height calculation after replacing the
 7710    // accent, we manually recalculate height.
 7711
 7712    supSubGroup.height = Math.max(accentWrap.height, supSubGroup.height); // Accents should always be ords, even when their innards are not.
 7713
 7714    supSubGroup.classes[0] = "mord";
 7715    return supSubGroup;
 7716  } else {
 7717    return accentWrap;
 7718  }
 7719};
 7720
 7721var mathmlBuilder = function mathmlBuilder(group, options) {
 7722  var accentNode = group.isStretchy ? stretchy.mathMLnode(group.label) : new mathMLTree.MathNode("mo", [makeText(group.label, group.mode)]);
 7723  var node = new mathMLTree.MathNode("mover", [buildMathML_buildGroup(group.base, options), accentNode]);
 7724  node.setAttribute("accent", "true");
 7725  return node;
 7726};
 7727
 7728var NON_STRETCHY_ACCENT_REGEX = new RegExp(["\\acute", "\\grave", "\\ddot", "\\tilde", "\\bar", "\\breve", "\\check", "\\hat", "\\vec", "\\dot", "\\mathring"].map(function (accent) {
 7729  return "\\" + accent;
 7730}).join("|")); // Accents
 7731
 7732defineFunction({
 7733  type: "accent",
 7734  names: ["\\acute", "\\grave", "\\ddot", "\\tilde", "\\bar", "\\breve", "\\check", "\\hat", "\\vec", "\\dot", "\\mathring", "\\widecheck", "\\widehat", "\\widetilde", "\\overrightarrow", "\\overleftarrow", "\\Overrightarrow", "\\overleftrightarrow", "\\overgroup", "\\overlinesegment", "\\overleftharpoon", "\\overrightharpoon"],
 7735  props: {
 7736    numArgs: 1
 7737  },
 7738  handler: function handler(context, args) {
 7739    var base = normalizeArgument(args[0]);
 7740    var isStretchy = !NON_STRETCHY_ACCENT_REGEX.test(context.funcName);
 7741    var isShifty = !isStretchy || context.funcName === "\\widehat" || context.funcName === "\\widetilde" || context.funcName === "\\widecheck";
 7742    return {
 7743      type: "accent",
 7744      mode: context.parser.mode,
 7745      label: context.funcName,
 7746      isStretchy: isStretchy,
 7747      isShifty: isShifty,
 7748      base: base
 7749    };
 7750  },
 7751  htmlBuilder: htmlBuilder,
 7752  mathmlBuilder: mathmlBuilder
 7753}); // Text-mode accents
 7754
 7755defineFunction({
 7756  type: "accent",
 7757  names: ["\\'", "\\`", "\\^", "\\~", "\\=", "\\u", "\\.", '\\"', "\\c", "\\r", "\\H", "\\v", "\\textcircled"],
 7758  props: {
 7759    numArgs: 1,
 7760    allowedInText: true,
 7761    allowedInMath: true,
 7762    // unless in strict mode
 7763    argTypes: ["primitive"]
 7764  },
 7765  handler: function handler(context, args) {
 7766    var base = args[0];
 7767    var mode = context.parser.mode;
 7768
 7769    if (mode === "math") {
 7770      context.parser.settings.reportNonstrict("mathVsTextAccents", "LaTeX's accent " + context.funcName + " works only in text mode");
 7771      mode = "text";
 7772    }
 7773
 7774    return {
 7775      type: "accent",
 7776      mode: mode,
 7777      label: context.funcName,
 7778      isStretchy: false,
 7779      isShifty: true,
 7780      base: base
 7781    };
 7782  },
 7783  htmlBuilder: htmlBuilder,
 7784  mathmlBuilder: mathmlBuilder
 7785});
 7786;// CONCATENATED MODULE: ./src/functions/accentunder.js
 7787// Horizontal overlap functions
 7788
 7789
 7790
 7791
 7792
 7793
 7794defineFunction({
 7795  type: "accentUnder",
 7796  names: ["\\underleftarrow", "\\underrightarrow", "\\underleftrightarrow", "\\undergroup", "\\underlinesegment", "\\utilde"],
 7797  props: {
 7798    numArgs: 1
 7799  },
 7800  handler: function handler(_ref, args) {
 7801    var parser = _ref.parser,
 7802        funcName = _ref.funcName;
 7803    var base = args[0];
 7804    return {
 7805      type: "accentUnder",
 7806      mode: parser.mode,
 7807      label: funcName,
 7808      base: base
 7809    };
 7810  },
 7811  htmlBuilder: function htmlBuilder(group, options) {
 7812    // Treat under accents much like underlines.
 7813    var innerGroup = buildGroup(group.base, options);
 7814    var accentBody = stretchy.svgSpan(group, options);
 7815    var kern = group.label === "\\utilde" ? 0.12 : 0; // Generate the vlist, with the appropriate kerns
 7816
 7817    var vlist = buildCommon.makeVList({
 7818      positionType: "top",
 7819      positionData: innerGroup.height,
 7820      children: [{
 7821        type: "elem",
 7822        elem: accentBody,
 7823        wrapperClasses: ["svg-align"]
 7824      }, {
 7825        type: "kern",
 7826        size: kern
 7827      }, {
 7828        type: "elem",
 7829        elem: innerGroup
 7830      }]
 7831    }, options);
 7832    return buildCommon.makeSpan(["mord", "accentunder"], [vlist], options);
 7833  },
 7834  mathmlBuilder: function mathmlBuilder(group, options) {
 7835    var accentNode = stretchy.mathMLnode(group.label);
 7836    var node = new mathMLTree.MathNode("munder", [buildMathML_buildGroup(group.base, options), accentNode]);
 7837    node.setAttribute("accentunder", "true");
 7838    return node;
 7839  }
 7840});
 7841;// CONCATENATED MODULE: ./src/functions/arrow.js
 7842
 7843
 7844
 7845
 7846
 7847
 7848
 7849// Helper function
 7850var paddedNode = function paddedNode(group) {
 7851  var node = new mathMLTree.MathNode("mpadded", group ? [group] : []);
 7852  node.setAttribute("width", "+0.6em");
 7853  node.setAttribute("lspace", "0.3em");
 7854  return node;
 7855}; // Stretchy arrows with an optional argument
 7856
 7857
 7858defineFunction({
 7859  type: "xArrow",
 7860  names: ["\\xleftarrow", "\\xrightarrow", "\\xLeftarrow", "\\xRightarrow", "\\xleftrightarrow", "\\xLeftrightarrow", "\\xhookleftarrow", "\\xhookrightarrow", "\\xmapsto", "\\xrightharpoondown", "\\xrightharpoonup", "\\xleftharpoondown", "\\xleftharpoonup", "\\xrightleftharpoons", "\\xleftrightharpoons", "\\xlongequal", "\\xtwoheadrightarrow", "\\xtwoheadleftarrow", "\\xtofrom", // The next 3 functions are here to support the mhchem extension.
 7861  // Direct use of these functions is discouraged and may break someday.
 7862  "\\xrightleftarrows", "\\xrightequilibrium", "\\xleftequilibrium", // The next 3 functions are here only to support the {CD} environment.
 7863  "\\\\cdrightarrow", "\\\\cdleftarrow", "\\\\cdlongequal"],
 7864  props: {
 7865    numArgs: 1,
 7866    numOptionalArgs: 1
 7867  },
 7868  handler: function handler(_ref, args, optArgs) {
 7869    var parser = _ref.parser,
 7870        funcName = _ref.funcName;
 7871    return {
 7872      type: "xArrow",
 7873      mode: parser.mode,
 7874      label: funcName,
 7875      body: args[0],
 7876      below: optArgs[0]
 7877    };
 7878  },
 7879  // Flow is unable to correctly infer the type of `group`, even though it's
 7880  // unamibiguously determined from the passed-in `type` above.
 7881  htmlBuilder: function htmlBuilder(group, options) {
 7882    var style = options.style; // Build the argument groups in the appropriate style.
 7883    // Ref: amsmath.dtx:   \hbox{$\scriptstyle\mkern#3mu{#6}\mkern#4mu$}%
 7884    // Some groups can return document fragments.  Handle those by wrapping
 7885    // them in a span.
 7886
 7887    var newOptions = options.havingStyle(style.sup());
 7888    var upperGroup = buildCommon.wrapFragment(buildGroup(group.body, newOptions, options), options);
 7889    var arrowPrefix = group.label.slice(0, 2) === "\\x" ? "x" : "cd";
 7890    upperGroup.classes.push(arrowPrefix + "-arrow-pad");
 7891    var lowerGroup;
 7892
 7893    if (group.below) {
 7894      // Build the lower group
 7895      newOptions = options.havingStyle(style.sub());
 7896      lowerGroup = buildCommon.wrapFragment(buildGroup(group.below, newOptions, options), options);
 7897      lowerGroup.classes.push(arrowPrefix + "-arrow-pad");
 7898    }
 7899
 7900    var arrowBody = stretchy.svgSpan(group, options); // Re shift: Note that stretchy.svgSpan returned arrowBody.depth = 0.
 7901    // The point we want on the math axis is at 0.5 * arrowBody.height.
 7902
 7903    var arrowShift = -options.fontMetrics().axisHeight + 0.5 * arrowBody.height; // 2 mu kern. Ref: amsmath.dtx: #7\if0#2\else\mkern#2mu\fi
 7904
 7905    var upperShift = -options.fontMetrics().axisHeight - 0.5 * arrowBody.height - 0.111; // 0.111 em = 2 mu
 7906
 7907    if (upperGroup.depth > 0.25 || group.label === "\\xleftequilibrium") {
 7908      upperShift -= upperGroup.depth; // shift up if depth encroaches
 7909    } // Generate the vlist
 7910
 7911
 7912    var vlist;
 7913
 7914    if (lowerGroup) {
 7915      var lowerShift = -options.fontMetrics().axisHeight + lowerGroup.height + 0.5 * arrowBody.height + 0.111;
 7916      vlist = buildCommon.makeVList({
 7917        positionType: "individualShift",
 7918        children: [{
 7919          type: "elem",
 7920          elem: upperGroup,
 7921          shift: upperShift
 7922        }, {
 7923          type: "elem",
 7924          elem: arrowBody,
 7925          shift: arrowShift
 7926        }, {
 7927          type: "elem",
 7928          elem: lowerGroup,
 7929          shift: lowerShift
 7930        }]
 7931      }, options);
 7932    } else {
 7933      vlist = buildCommon.makeVList({
 7934        positionType: "individualShift",
 7935        children: [{
 7936          type: "elem",
 7937          elem: upperGroup,
 7938          shift: upperShift
 7939        }, {
 7940          type: "elem",
 7941          elem: arrowBody,
 7942          shift: arrowShift
 7943        }]
 7944      }, options);
 7945    } // $FlowFixMe: Replace this with passing "svg-align" into makeVList.
 7946
 7947
 7948    vlist.children[0].children[0].children[1].classes.push("svg-align");
 7949    return buildCommon.makeSpan(["mrel", "x-arrow"], [vlist], options);
 7950  },
 7951  mathmlBuilder: function mathmlBuilder(group, options) {
 7952    var arrowNode = stretchy.mathMLnode(group.label);
 7953    arrowNode.setAttribute("minsize", group.label.charAt(0) === "x" ? "1.75em" : "3.0em");
 7954    var node;
 7955
 7956    if (group.body) {
 7957      var upperNode = paddedNode(buildMathML_buildGroup(group.body, options));
 7958
 7959      if (group.below) {
 7960        var lowerNode = paddedNode(buildMathML_buildGroup(group.below, options));
 7961        node = new mathMLTree.MathNode("munderover", [arrowNode, lowerNode, upperNode]);
 7962      } else {
 7963        node = new mathMLTree.MathNode("mover", [arrowNode, upperNode]);
 7964      }
 7965    } else if (group.below) {
 7966      var _lowerNode = paddedNode(buildMathML_buildGroup(group.below, options));
 7967
 7968      node = new mathMLTree.MathNode("munder", [arrowNode, _lowerNode]);
 7969    } else {
 7970      // This should never happen.
 7971      // Parser.js throws an error if there is no argument.
 7972      node = paddedNode();
 7973      node = new mathMLTree.MathNode("mover", [arrowNode, node]);
 7974    }
 7975
 7976    return node;
 7977  }
 7978});
 7979;// CONCATENATED MODULE: ./src/environments/cd.js
 7980
 7981
 7982
 7983
 7984
 7985
 7986
 7987
 7988var cdArrowFunctionName = {
 7989  ">": "\\\\cdrightarrow",
 7990  "<": "\\\\cdleftarrow",
 7991  "=": "\\\\cdlongequal",
 7992  "A": "\\uparrow",
 7993  "V": "\\downarrow",
 7994  "|": "\\Vert",
 7995  ".": "no arrow"
 7996};
 7997
 7998var newCell = function newCell() {
 7999  // Create an empty cell, to be filled below with parse nodes.
 8000  // The parseTree from this module must be constructed like the
 8001  // one created by parseArray(), so an empty CD cell must
 8002  // be a ParseNode<"styling">. And CD is always displaystyle.
 8003  // So these values are fixed and flow can do implicit typing.
 8004  return {
 8005    type: "styling",
 8006    body: [],
 8007    mode: "math",
 8008    style: "display"
 8009  };
 8010};
 8011
 8012var isStartOfArrow = function isStartOfArrow(node) {
 8013  return node.type === "textord" && node.text === "@";
 8014};
 8015
 8016var isLabelEnd = function isLabelEnd(node, endChar) {
 8017  return (node.type === "mathord" || node.type === "atom") && node.text === endChar;
 8018};
 8019
 8020function cdArrow(arrowChar, labels, parser) {
 8021  // Return a parse tree of an arrow and its labels.
 8022  // This acts in a way similar to a macro expansion.
 8023  var funcName = cdArrowFunctionName[arrowChar];
 8024
 8025  switch (funcName) {
 8026    case "\\\\cdrightarrow":
 8027    case "\\\\cdleftarrow":
 8028      return parser.callFunction(funcName, [labels[0]], [labels[1]]);
 8029
 8030    case "\\uparrow":
 8031    case "\\downarrow":
 8032      {
 8033        var leftLabel = parser.callFunction("\\\\cdleft", [labels[0]], []);
 8034        var bareArrow = {
 8035          type: "atom",
 8036          text: funcName,
 8037          mode: "math",
 8038          family: "rel"
 8039        };
 8040        var sizedArrow = parser.callFunction("\\Big", [bareArrow], []);
 8041        var rightLabel = parser.callFunction("\\\\cdright", [labels[1]], []);
 8042        var arrowGroup = {
 8043          type: "ordgroup",
 8044          mode: "math",
 8045          body: [leftLabel, sizedArrow, rightLabel]
 8046        };
 8047        return parser.callFunction("\\\\cdparent", [arrowGroup], []);
 8048      }
 8049
 8050    case "\\\\cdlongequal":
 8051      return parser.callFunction("\\\\cdlongequal", [], []);
 8052
 8053    case "\\Vert":
 8054      {
 8055        var arrow = {
 8056          type: "textord",
 8057          text: "\\Vert",
 8058          mode: "math"
 8059        };
 8060        return parser.callFunction("\\Big", [arrow], []);
 8061      }
 8062
 8063    default:
 8064      return {
 8065        type: "textord",
 8066        text: " ",
 8067        mode: "math"
 8068      };
 8069  }
 8070}
 8071
 8072function parseCD(parser) {
 8073  // Get the array's parse nodes with \\ temporarily mapped to \cr.
 8074  var parsedRows = [];
 8075  parser.gullet.beginGroup();
 8076  parser.gullet.macros.set("\\cr", "\\\\\\relax");
 8077  parser.gullet.beginGroup();
 8078
 8079  while (true) {
 8080    // eslint-disable-line no-constant-condition
 8081    // Get the parse nodes for the next row.
 8082    parsedRows.push(parser.parseExpression(false, "\\\\"));
 8083    parser.gullet.endGroup();
 8084    parser.gullet.beginGroup();
 8085    var next = parser.fetch().text;
 8086
 8087    if (next === "&" || next === "\\\\") {
 8088      parser.consume();
 8089    } else if (next === "\\end") {
 8090      if (parsedRows[parsedRows.length - 1].length === 0) {
 8091        parsedRows.pop(); // final row ended in \\
 8092      }
 8093
 8094      break;
 8095    } else {
 8096      throw new src_ParseError("Expected \\\\ or \\cr or \\end", parser.nextToken);
 8097    }
 8098  }
 8099
 8100  var row = [];
 8101  var body = [row]; // Loop thru the parse nodes. Collect them into cells and arrows.
 8102
 8103  for (var i = 0; i < parsedRows.length; i++) {
 8104    // Start a new row.
 8105    var rowNodes = parsedRows[i]; // Create the first cell.
 8106
 8107    var cell = newCell();
 8108
 8109    for (var j = 0; j < rowNodes.length; j++) {
 8110      if (!isStartOfArrow(rowNodes[j])) {
 8111        // If a parseNode is not an arrow, it goes into a cell.
 8112        cell.body.push(rowNodes[j]);
 8113      } else {
 8114        // Parse node j is an "@", the start of an arrow.
 8115        // Before starting on the arrow, push the cell into `row`.
 8116        row.push(cell); // Now collect parseNodes into an arrow.
 8117        // The character after "@" defines the arrow type.
 8118
 8119        j += 1;
 8120        var arrowChar = assertSymbolNodeType(rowNodes[j]).text; // Create two empty label nodes. We may or may not use them.
 8121
 8122        var labels = new Array(2);
 8123        labels[0] = {
 8124          type: "ordgroup",
 8125          mode: "math",
 8126          body: []
 8127        };
 8128        labels[1] = {
 8129          type: "ordgroup",
 8130          mode: "math",
 8131          body: []
 8132        }; // Process the arrow.
 8133
 8134        if ("=|.".indexOf(arrowChar) > -1) {// Three "arrows", ``@=`, `@|`, and `@.`, do not take labels.
 8135          // Do nothing here.
 8136        } else if ("<>AV".indexOf(arrowChar) > -1) {
 8137          // Four arrows, `@>>>`, `@<<<`, `@AAA`, and `@VVV`, each take
 8138          // two optional labels. E.g. the right-point arrow syntax is
 8139          // really:  @>{optional label}>{optional label}>
 8140          // Collect parseNodes into labels.
 8141          for (var labelNum = 0; labelNum < 2; labelNum++) {
 8142            var inLabel = true;
 8143
 8144            for (var k = j + 1; k < rowNodes.length; k++) {
 8145              if (isLabelEnd(rowNodes[k], arrowChar)) {
 8146                inLabel = false;
 8147                j = k;
 8148                break;
 8149              }
 8150
 8151              if (isStartOfArrow(rowNodes[k])) {
 8152                throw new src_ParseError("Missing a " + arrowChar + " character to complete a CD arrow.", rowNodes[k]);
 8153              }
 8154
 8155              labels[labelNum].body.push(rowNodes[k]);
 8156            }
 8157
 8158            if (inLabel) {
 8159              // isLabelEnd never returned a true.
 8160              throw new src_ParseError("Missing a " + arrowChar + " character to complete a CD arrow.", rowNodes[j]);
 8161            }
 8162          }
 8163        } else {
 8164          throw new src_ParseError("Expected one of \"<>AV=|.\" after @", rowNodes[j]);
 8165        } // Now join the arrow to its labels.
 8166
 8167
 8168        var arrow = cdArrow(arrowChar, labels, parser); // Wrap the arrow in  ParseNode<"styling">.
 8169        // This is done to match parseArray() behavior.
 8170
 8171        var wrappedArrow = {
 8172          type: "styling",
 8173          body: [arrow],
 8174          mode: "math",
 8175          style: "display" // CD is always displaystyle.
 8176
 8177        };
 8178        row.push(wrappedArrow); // In CD's syntax, cells are implicit. That is, everything that
 8179        // is not an arrow gets collected into a cell. So create an empty
 8180        // cell now. It will collect upcoming parseNodes.
 8181
 8182        cell = newCell();
 8183      }
 8184    }
 8185
 8186    if (i % 2 === 0) {
 8187      // Even-numbered rows consist of: cell, arrow, cell, arrow, ... cell
 8188      // The last cell is not yet pushed into `row`, so:
 8189      row.push(cell);
 8190    } else {
 8191      // Odd-numbered rows consist of: vert arrow, empty cell, ... vert arrow
 8192      // Remove the empty cell that was placed at the beginning of `row`.
 8193      row.shift();
 8194    }
 8195
 8196    row = [];
 8197    body.push(row);
 8198  } // End row group
 8199
 8200
 8201  parser.gullet.endGroup(); // End array group defining \\
 8202
 8203  parser.gullet.endGroup(); // define column separation.
 8204
 8205  var cols = new Array(body[0].length).fill({
 8206    type: "align",
 8207    align: "c",
 8208    pregap: 0.25,
 8209    // CD package sets \enskip between columns.
 8210    postgap: 0.25 // So pre and post each get half an \enskip, i.e. 0.25em.
 8211
 8212  });
 8213  return {
 8214    type: "array",
 8215    mode: "math",
 8216    body: body,
 8217    arraystretch: 1,
 8218    addJot: true,
 8219    rowGaps: [null],
 8220    cols: cols,
 8221    colSeparationType: "CD",
 8222    hLinesBeforeRow: new Array(body.length + 1).fill([])
 8223  };
 8224} // The functions below are not available for general use.
 8225// They are here only for internal use by the {CD} environment in placing labels
 8226// next to vertical arrows.
 8227// We don't need any such functions for horizontal arrows because we can reuse
 8228// the functionality that already exists for extensible arrows.
 8229
 8230defineFunction({
 8231  type: "cdlabel",
 8232  names: ["\\\\cdleft", "\\\\cdright"],
 8233  props: {
 8234    numArgs: 1
 8235  },
 8236  handler: function handler(_ref, args) {
 8237    var parser = _ref.parser,
 8238        funcName = _ref.funcName;
 8239    return {
 8240      type: "cdlabel",
 8241      mode: parser.mode,
 8242      side: funcName.slice(4),
 8243      label: args[0]
 8244    };
 8245  },
 8246  htmlBuilder: function htmlBuilder(group, options) {
 8247    var newOptions = options.havingStyle(options.style.sup());
 8248    var label = buildCommon.wrapFragment(buildGroup(group.label, newOptions, options), options);
 8249    label.classes.push("cd-label-" + group.side);
 8250    label.style.bottom = makeEm(0.8 - label.depth); // Zero out label height & depth, so vertical align of arrow is set
 8251    // by the arrow height, not by the label.
 8252
 8253    label.height = 0;
 8254    label.depth = 0;
 8255    return label;
 8256  },
 8257  mathmlBuilder: function mathmlBuilder(group, options) {
 8258    var label = new mathMLTree.MathNode("mrow", [buildMathML_buildGroup(group.label, options)]);
 8259    label = new mathMLTree.MathNode("mpadded", [label]);
 8260    label.setAttribute("width", "0");
 8261
 8262    if (group.side === "left") {
 8263      label.setAttribute("lspace", "-1width");
 8264    } // We have to guess at vertical alignment. We know the arrow is 1.8em tall,
 8265    // But we don't know the height or depth of the label.
 8266
 8267
 8268    label.setAttribute("voffset", "0.7em");
 8269    label = new mathMLTree.MathNode("mstyle", [label]);
 8270    label.setAttribute("displaystyle", "false");
 8271    label.setAttribute("scriptlevel", "1");
 8272    return label;
 8273  }
 8274});
 8275defineFunction({
 8276  type: "cdlabelparent",
 8277  names: ["\\\\cdparent"],
 8278  props: {
 8279    numArgs: 1
 8280  },
 8281  handler: function handler(_ref2, args) {
 8282    var parser = _ref2.parser;
 8283    return {
 8284      type: "cdlabelparent",
 8285      mode: parser.mode,
 8286      fragment: args[0]
 8287    };
 8288  },
 8289  htmlBuilder: function htmlBuilder(group, options) {
 8290    // Wrap the vertical arrow and its labels.
 8291    // The parent gets position: relative. The child gets position: absolute.
 8292    // So CSS can locate the label correctly.
 8293    var parent = buildCommon.wrapFragment(buildGroup(group.fragment, options), options);
 8294    parent.classes.push("cd-vert-arrow");
 8295    return parent;
 8296  },
 8297  mathmlBuilder: function mathmlBuilder(group, options) {
 8298    return new mathMLTree.MathNode("mrow", [buildMathML_buildGroup(group.fragment, options)]);
 8299  }
 8300});
 8301;// CONCATENATED MODULE: ./src/functions/char.js
 8302
 8303
 8304 // \@char is an internal function that takes a grouped decimal argument like
 8305// {123} and converts into symbol with code 123.  It is used by the *macro*
 8306// \char defined in macros.js.
 8307
 8308defineFunction({
 8309  type: "textord",
 8310  names: ["\\@char"],
 8311  props: {
 8312    numArgs: 1,
 8313    allowedInText: true
 8314  },
 8315  handler: function handler(_ref, args) {
 8316    var parser = _ref.parser;
 8317    var arg = assertNodeType(args[0], "ordgroup");
 8318    var group = arg.body;
 8319    var number = "";
 8320
 8321    for (var i = 0; i < group.length; i++) {
 8322      var node = assertNodeType(group[i], "textord");
 8323      number += node.text;
 8324    }
 8325
 8326    var code = parseInt(number);
 8327    var text;
 8328
 8329    if (isNaN(code)) {
 8330      throw new src_ParseError("\\@char has non-numeric argument " + number); // If we drop IE support, the following code could be replaced with
 8331      // text = String.fromCodePoint(code)
 8332    } else if (code < 0 || code >= 0x10ffff) {
 8333      throw new src_ParseError("\\@char with invalid code point " + number);
 8334    } else if (code <= 0xffff) {
 8335      text = String.fromCharCode(code);
 8336    } else {
 8337      // Astral code point; split into surrogate halves
 8338      code -= 0x10000;
 8339      text = String.fromCharCode((code >> 10) + 0xd800, (code & 0x3ff) + 0xdc00);
 8340    }
 8341
 8342    return {
 8343      type: "textord",
 8344      mode: parser.mode,
 8345      text: text
 8346    };
 8347  }
 8348});
 8349;// CONCATENATED MODULE: ./src/functions/color.js
 8350
 8351
 8352
 8353
 8354
 8355
 8356
 8357var color_htmlBuilder = function htmlBuilder(group, options) {
 8358  var elements = buildExpression(group.body, options.withColor(group.color), false); // \color isn't supposed to affect the type of the elements it contains.
 8359  // To accomplish this, we wrap the results in a fragment, so the inner
 8360  // elements will be able to directly interact with their neighbors. For
 8361  // example, `\color{red}{2 +} 3` has the same spacing as `2 + 3`
 8362
 8363  return buildCommon.makeFragment(elements);
 8364};
 8365
 8366var color_mathmlBuilder = function mathmlBuilder(group, options) {
 8367  var inner = buildMathML_buildExpression(group.body, options.withColor(group.color));
 8368  var node = new mathMLTree.MathNode("mstyle", inner);
 8369  node.setAttribute("mathcolor", group.color);
 8370  return node;
 8371};
 8372
 8373defineFunction({
 8374  type: "color",
 8375  names: ["\\textcolor"],
 8376  props: {
 8377    numArgs: 2,
 8378    allowedInText: true,
 8379    argTypes: ["color", "original"]
 8380  },
 8381  handler: function handler(_ref, args) {
 8382    var parser = _ref.parser;
 8383    var color = assertNodeType(args[0], "color-token").color;
 8384    var body = args[1];
 8385    return {
 8386      type: "color",
 8387      mode: parser.mode,
 8388      color: color,
 8389      body: ordargument(body)
 8390    };
 8391  },
 8392  htmlBuilder: color_htmlBuilder,
 8393  mathmlBuilder: color_mathmlBuilder
 8394});
 8395defineFunction({
 8396  type: "color",
 8397  names: ["\\color"],
 8398  props: {
 8399    numArgs: 1,
 8400    allowedInText: true,
 8401    argTypes: ["color"]
 8402  },
 8403  handler: function handler(_ref2, args) {
 8404    var parser = _ref2.parser,
 8405        breakOnTokenText = _ref2.breakOnTokenText;
 8406    var color = assertNodeType(args[0], "color-token").color; // Set macro \current@color in current namespace to store the current
 8407    // color, mimicking the behavior of color.sty.
 8408    // This is currently used just to correctly color a \right
 8409    // that follows a \color command.
 8410
 8411    parser.gullet.macros.set("\\current@color", color); // Parse out the implicit body that should be colored.
 8412
 8413    var body = parser.parseExpression(true, breakOnTokenText);
 8414    return {
 8415      type: "color",
 8416      mode: parser.mode,
 8417      color: color,
 8418      body: body
 8419    };
 8420  },
 8421  htmlBuilder: color_htmlBuilder,
 8422  mathmlBuilder: color_mathmlBuilder
 8423});
 8424;// CONCATENATED MODULE: ./src/functions/cr.js
 8425// Row breaks within tabular environments, and line breaks at top level
 8426
 8427
 8428
 8429
 8430 // \DeclareRobustCommand\\{...\@xnewline}
 8431
 8432defineFunction({
 8433  type: "cr",
 8434  names: ["\\\\"],
 8435  props: {
 8436    numArgs: 0,
 8437    numOptionalArgs: 1,
 8438    argTypes: ["size"],
 8439    allowedInText: true
 8440  },
 8441  handler: function handler(_ref, args, optArgs) {
 8442    var parser = _ref.parser;
 8443    var size = optArgs[0];
 8444    var newLine = !parser.settings.displayMode || !parser.settings.useStrictBehavior("newLineInDisplayMode", "In LaTeX, \\\\ or \\newline " + "does nothing in display mode");
 8445    return {
 8446      type: "cr",
 8447      mode: parser.mode,
 8448      newLine: newLine,
 8449      size: size && assertNodeType(size, "size").value
 8450    };
 8451  },
 8452  // The following builders are called only at the top level,
 8453  // not within tabular/array environments.
 8454  htmlBuilder: function htmlBuilder(group, options) {
 8455    var span = buildCommon.makeSpan(["mspace"], [], options);
 8456
 8457    if (group.newLine) {
 8458      span.classes.push("newline");
 8459
 8460      if (group.size) {
 8461        span.style.marginTop = makeEm(calculateSize(group.size, options));
 8462      }
 8463    }
 8464
 8465    return span;
 8466  },
 8467  mathmlBuilder: function mathmlBuilder(group, options) {
 8468    var node = new mathMLTree.MathNode("mspace");
 8469
 8470    if (group.newLine) {
 8471      node.setAttribute("linebreak", "newline");
 8472
 8473      if (group.size) {
 8474        node.setAttribute("height", makeEm(calculateSize(group.size, options)));
 8475      }
 8476    }
 8477
 8478    return node;
 8479  }
 8480});
 8481;// CONCATENATED MODULE: ./src/functions/def.js
 8482
 8483
 8484
 8485var globalMap = {
 8486  "\\global": "\\global",
 8487  "\\long": "\\\\globallong",
 8488  "\\\\globallong": "\\\\globallong",
 8489  "\\def": "\\gdef",
 8490  "\\gdef": "\\gdef",
 8491  "\\edef": "\\xdef",
 8492  "\\xdef": "\\xdef",
 8493  "\\let": "\\\\globallet",
 8494  "\\futurelet": "\\\\globalfuture"
 8495};
 8496
 8497var checkControlSequence = function checkControlSequence(tok) {
 8498  var name = tok.text;
 8499
 8500  if (/^(?:[\\{}$&#^_]|EOF)$/.test(name)) {
 8501    throw new src_ParseError("Expected a control sequence", tok);
 8502  }
 8503
 8504  return name;
 8505};
 8506
 8507var getRHS = function getRHS(parser) {
 8508  var tok = parser.gullet.popToken();
 8509
 8510  if (tok.text === "=") {
 8511    // consume optional equals
 8512    tok = parser.gullet.popToken();
 8513
 8514    if (tok.text === " ") {
 8515      // consume one optional space
 8516      tok = parser.gullet.popToken();
 8517    }
 8518  }
 8519
 8520  return tok;
 8521};
 8522
 8523var letCommand = function letCommand(parser, name, tok, global) {
 8524  var macro = parser.gullet.macros.get(tok.text);
 8525
 8526  if (macro == null) {
 8527    // don't expand it later even if a macro with the same name is defined
 8528    // e.g., \let\foo=\frac \def\frac{\relax} \frac12
 8529    tok.noexpand = true;
 8530    macro = {
 8531      tokens: [tok],
 8532      numArgs: 0,
 8533      // reproduce the same behavior in expansion
 8534      unexpandable: !parser.gullet.isExpandable(tok.text)
 8535    };
 8536  }
 8537
 8538  parser.gullet.macros.set(name, macro, global);
 8539}; // <assignment> -> <non-macro assignment>|<macro assignment>
 8540// <non-macro assignment> -> <simple assignment>|\global<non-macro assignment>
 8541// <macro assignment> -> <definition>|<prefix><macro assignment>
 8542// <prefix> -> \global|\long|\outer
 8543
 8544
 8545defineFunction({
 8546  type: "internal",
 8547  names: ["\\global", "\\long", "\\\\globallong" // can’t be entered directly
 8548  ],
 8549  props: {
 8550    numArgs: 0,
 8551    allowedInText: true
 8552  },
 8553  handler: function handler(_ref) {
 8554    var parser = _ref.parser,
 8555        funcName = _ref.funcName;
 8556    parser.consumeSpaces();
 8557    var token = parser.fetch();
 8558
 8559    if (globalMap[token.text]) {
 8560      // KaTeX doesn't have \par, so ignore \long
 8561      if (funcName === "\\global" || funcName === "\\\\globallong") {
 8562        token.text = globalMap[token.text];
 8563      }
 8564
 8565      return assertNodeType(parser.parseFunction(), "internal");
 8566    }
 8567
 8568    throw new src_ParseError("Invalid token after macro prefix", token);
 8569  }
 8570}); // Basic support for macro definitions: \def, \gdef, \edef, \xdef
 8571// <definition> -> <def><control sequence><definition text>
 8572// <def> -> \def|\gdef|\edef|\xdef
 8573// <definition text> -> <parameter text><left brace><balanced text><right brace>
 8574
 8575defineFunction({
 8576  type: "internal",
 8577  names: ["\\def", "\\gdef", "\\edef", "\\xdef"],
 8578  props: {
 8579    numArgs: 0,
 8580    allowedInText: true,
 8581    primitive: true
 8582  },
 8583  handler: function handler(_ref2) {
 8584    var parser = _ref2.parser,
 8585        funcName = _ref2.funcName;
 8586    var tok = parser.gullet.popToken();
 8587    var name = tok.text;
 8588
 8589    if (/^(?:[\\{}$&#^_]|EOF)$/.test(name)) {
 8590      throw new src_ParseError("Expected a control sequence", tok);
 8591    }
 8592
 8593    var numArgs = 0;
 8594    var insert;
 8595    var delimiters = [[]]; // <parameter text> contains no braces
 8596
 8597    while (parser.gullet.future().text !== "{") {
 8598      tok = parser.gullet.popToken();
 8599
 8600      if (tok.text === "#") {
 8601        // If the very last character of the <parameter text> is #, so that
 8602        // this # is immediately followed by {, TeX will behave as if the {
 8603        // had been inserted at the right end of both the parameter text
 8604        // and the replacement text.
 8605        if (parser.gullet.future().text === "{") {
 8606          insert = parser.gullet.future();
 8607          delimiters[numArgs].push("{");
 8608          break;
 8609        } // A parameter, the first appearance of # must be followed by 1,
 8610        // the next by 2, and so on; up to nine #’s are allowed
 8611
 8612
 8613        tok = parser.gullet.popToken();
 8614
 8615        if (!/^[1-9]$/.test(tok.text)) {
 8616          throw new src_ParseError("Invalid argument number \"" + tok.text + "\"");
 8617        }
 8618
 8619        if (parseInt(tok.text) !== numArgs + 1) {
 8620          throw new src_ParseError("Argument number \"" + tok.text + "\" out of order");
 8621        }
 8622
 8623        numArgs++;
 8624        delimiters.push([]);
 8625      } else if (tok.text === "EOF") {
 8626        throw new src_ParseError("Expected a macro definition");
 8627      } else {
 8628        delimiters[numArgs].push(tok.text);
 8629      }
 8630    } // replacement text, enclosed in '{' and '}' and properly nested
 8631
 8632
 8633    var _parser$gullet$consum = parser.gullet.consumeArg(),
 8634        tokens = _parser$gullet$consum.tokens;
 8635
 8636    if (insert) {
 8637      tokens.unshift(insert);
 8638    }
 8639
 8640    if (funcName === "\\edef" || funcName === "\\xdef") {
 8641      tokens = parser.gullet.expandTokens(tokens);
 8642      tokens.reverse(); // to fit in with stack order
 8643    } // Final arg is the expansion of the macro
 8644
 8645
 8646    parser.gullet.macros.set(name, {
 8647      tokens: tokens,
 8648      numArgs: numArgs,
 8649      delimiters: delimiters
 8650    }, funcName === globalMap[funcName]);
 8651    return {
 8652      type: "internal",
 8653      mode: parser.mode
 8654    };
 8655  }
 8656}); // <simple assignment> -> <let assignment>
 8657// <let assignment> -> \futurelet<control sequence><token><token>
 8658//     | \let<control sequence><equals><one optional space><token>
 8659// <equals> -> <optional spaces>|<optional spaces>=
 8660
 8661defineFunction({
 8662  type: "internal",
 8663  names: ["\\let", "\\\\globallet" // can’t be entered directly
 8664  ],
 8665  props: {
 8666    numArgs: 0,
 8667    allowedInText: true,
 8668    primitive: true
 8669  },
 8670  handler: function handler(_ref3) {
 8671    var parser = _ref3.parser,
 8672        funcName = _ref3.funcName;
 8673    var name = checkControlSequence(parser.gullet.popToken());
 8674    parser.gullet.consumeSpaces();
 8675    var tok = getRHS(parser);
 8676    letCommand(parser, name, tok, funcName === "\\\\globallet");
 8677    return {
 8678      type: "internal",
 8679      mode: parser.mode
 8680    };
 8681  }
 8682}); // ref: https://www.tug.org/TUGboat/tb09-3/tb22bechtolsheim.pdf
 8683
 8684defineFunction({
 8685  type: "internal",
 8686  names: ["\\futurelet", "\\\\globalfuture" // can’t be entered directly
 8687  ],
 8688  props: {
 8689    numArgs: 0,
 8690    allowedInText: true,
 8691    primitive: true
 8692  },
 8693  handler: function handler(_ref4) {
 8694    var parser = _ref4.parser,
 8695        funcName = _ref4.funcName;
 8696    var name = checkControlSequence(parser.gullet.popToken());
 8697    var middle = parser.gullet.popToken();
 8698    var tok = parser.gullet.popToken();
 8699    letCommand(parser, name, tok, funcName === "\\\\globalfuture");
 8700    parser.gullet.pushToken(tok);
 8701    parser.gullet.pushToken(middle);
 8702    return {
 8703      type: "internal",
 8704      mode: parser.mode
 8705    };
 8706  }
 8707});
 8708;// CONCATENATED MODULE: ./src/delimiter.js
 8709/**
 8710 * This file deals with creating delimiters of various sizes. The TeXbook
 8711 * discusses these routines on page 441-442, in the "Another subroutine sets box
 8712 * x to a specified variable delimiter" paragraph.
 8713 *
 8714 * There are three main routines here. `makeSmallDelim` makes a delimiter in the
 8715 * normal font, but in either text, script, or scriptscript style.
 8716 * `makeLargeDelim` makes a delimiter in textstyle, but in one of the Size1,
 8717 * Size2, Size3, or Size4 fonts. `makeStackedDelim` makes a delimiter out of
 8718 * smaller pieces that are stacked on top of one another.
 8719 *
 8720 * The functions take a parameter `center`, which determines if the delimiter
 8721 * should be centered around the axis.
 8722 *
 8723 * Then, there are three exposed functions. `sizedDelim` makes a delimiter in
 8724 * one of the given sizes. This is used for things like `\bigl`.
 8725 * `customSizedDelim` makes a delimiter with a given total height+depth. It is
 8726 * called in places like `\sqrt`. `leftRightDelim` makes an appropriate
 8727 * delimiter which surrounds an expression of a given height an depth. It is
 8728 * used in `\left` and `\right`.
 8729 */
 8730
 8731
 8732
 8733
 8734
 8735
 8736
 8737
 8738
 8739
 8740
 8741/**
 8742 * Get the metrics for a given symbol and font, after transformation (i.e.
 8743 * after following replacement from symbols.js)
 8744 */
 8745var getMetrics = function getMetrics(symbol, font, mode) {
 8746  var replace = src_symbols.math[symbol] && src_symbols.math[symbol].replace;
 8747  var metrics = getCharacterMetrics(replace || symbol, font, mode);
 8748
 8749  if (!metrics) {
 8750    throw new Error("Unsupported symbol " + symbol + " and font size " + font + ".");
 8751  }
 8752
 8753  return metrics;
 8754};
 8755/**
 8756 * Puts a delimiter span in a given style, and adds appropriate height, depth,
 8757 * and maxFontSizes.
 8758 */
 8759
 8760
 8761var styleWrap = function styleWrap(delim, toStyle, options, classes) {
 8762  var newOptions = options.havingBaseStyle(toStyle);
 8763  var span = buildCommon.makeSpan(classes.concat(newOptions.sizingClasses(options)), [delim], options);
 8764  var delimSizeMultiplier = newOptions.sizeMultiplier / options.sizeMultiplier;
 8765  span.height *= delimSizeMultiplier;
 8766  span.depth *= delimSizeMultiplier;
 8767  span.maxFontSize = newOptions.sizeMultiplier;
 8768  return span;
 8769};
 8770
 8771var centerSpan = function centerSpan(span, options, style) {
 8772  var newOptions = options.havingBaseStyle(style);
 8773  var shift = (1 - options.sizeMultiplier / newOptions.sizeMultiplier) * options.fontMetrics().axisHeight;
 8774  span.classes.push("delimcenter");
 8775  span.style.top = makeEm(shift);
 8776  span.height -= shift;
 8777  span.depth += shift;
 8778};
 8779/**
 8780 * Makes a small delimiter. This is a delimiter that comes in the Main-Regular
 8781 * font, but is restyled to either be in textstyle, scriptstyle, or
 8782 * scriptscriptstyle.
 8783 */
 8784
 8785
 8786var makeSmallDelim = function makeSmallDelim(delim, style, center, options, mode, classes) {
 8787  var text = buildCommon.makeSymbol(delim, "Main-Regular", mode, options);
 8788  var span = styleWrap(text, style, options, classes);
 8789
 8790  if (center) {
 8791    centerSpan(span, options, style);
 8792  }
 8793
 8794  return span;
 8795};
 8796/**
 8797 * Builds a symbol in the given font size (note size is an integer)
 8798 */
 8799
 8800
 8801var mathrmSize = function mathrmSize(value, size, mode, options) {
 8802  return buildCommon.makeSymbol(value, "Size" + size + "-Regular", mode, options);
 8803};
 8804/**
 8805 * Makes a large delimiter. This is a delimiter that comes in the Size1, Size2,
 8806 * Size3, or Size4 fonts. It is always rendered in textstyle.
 8807 */
 8808
 8809
 8810var makeLargeDelim = function makeLargeDelim(delim, size, center, options, mode, classes) {
 8811  var inner = mathrmSize(delim, size, mode, options);
 8812  var span = styleWrap(buildCommon.makeSpan(["delimsizing", "size" + size], [inner], options), src_Style.TEXT, options, classes);
 8813
 8814  if (center) {
 8815    centerSpan(span, options, src_Style.TEXT);
 8816  }
 8817
 8818  return span;
 8819};
 8820/**
 8821 * Make a span from a font glyph with the given offset and in the given font.
 8822 * This is used in makeStackedDelim to make the stacking pieces for the delimiter.
 8823 */
 8824
 8825
 8826var makeGlyphSpan = function makeGlyphSpan(symbol, font, mode) {
 8827  var sizeClass; // Apply the correct CSS class to choose the right font.
 8828
 8829  if (font === "Size1-Regular") {
 8830    sizeClass = "delim-size1";
 8831  } else
 8832    /* if (font === "Size4-Regular") */
 8833    {
 8834      sizeClass = "delim-size4";
 8835    }
 8836
 8837  var corner = buildCommon.makeSpan(["delimsizinginner", sizeClass], [buildCommon.makeSpan([], [buildCommon.makeSymbol(symbol, font, mode)])]); // Since this will be passed into `makeVList` in the end, wrap the element
 8838  // in the appropriate tag that VList uses.
 8839
 8840  return {
 8841    type: "elem",
 8842    elem: corner
 8843  };
 8844};
 8845
 8846var makeInner = function makeInner(ch, height, options) {
 8847  // Create a span with inline SVG for the inner part of a tall stacked delimiter.
 8848  var width = fontMetricsData["Size4-Regular"][ch.charCodeAt(0)] ? fontMetricsData["Size4-Regular"][ch.charCodeAt(0)][4] : fontMetricsData["Size1-Regular"][ch.charCodeAt(0)][4];
 8849  var path = new PathNode("inner", innerPath(ch, Math.round(1000 * height)));
 8850  var svgNode = new SvgNode([path], {
 8851    "width": makeEm(width),
 8852    "height": makeEm(height),
 8853    // Override CSS rule `.katex svg { width: 100% }`
 8854    "style": "width:" + makeEm(width),
 8855    "viewBox": "0 0 " + 1000 * width + " " + Math.round(1000 * height),
 8856    "preserveAspectRatio": "xMinYMin"
 8857  });
 8858  var span = buildCommon.makeSvgSpan([], [svgNode], options);
 8859  span.height = height;
 8860  span.style.height = makeEm(height);
 8861  span.style.width = makeEm(width);
 8862  return {
 8863    type: "elem",
 8864    elem: span
 8865  };
 8866}; // Helpers for makeStackedDelim
 8867
 8868
 8869var lapInEms = 0.008;
 8870var lap = {
 8871  type: "kern",
 8872  size: -1 * lapInEms
 8873};
 8874var verts = ["|", "\\lvert", "\\rvert", "\\vert"];
 8875var doubleVerts = ["\\|", "\\lVert", "\\rVert", "\\Vert"];
 8876/**
 8877 * Make a stacked delimiter out of a given delimiter, with the total height at
 8878 * least `heightTotal`. This routine is mentioned on page 442 of the TeXbook.
 8879 */
 8880
 8881var makeStackedDelim = function makeStackedDelim(delim, heightTotal, center, options, mode, classes) {
 8882  // There are four parts, the top, an optional middle, a repeated part, and a
 8883  // bottom.
 8884  var top;
 8885  var middle;
 8886  var repeat;
 8887  var bottom;
 8888  top = repeat = bottom = delim;
 8889  middle = null; // Also keep track of what font the delimiters are in
 8890
 8891  var font = "Size1-Regular"; // We set the parts and font based on the symbol. Note that we use
 8892  // '\u23d0' instead of '|' and '\u2016' instead of '\\|' for the
 8893  // repeats of the arrows
 8894
 8895  if (delim === "\\uparrow") {
 8896    repeat = bottom = "\u23D0";
 8897  } else if (delim === "\\Uparrow") {
 8898    repeat = bottom = "\u2016";
 8899  } else if (delim === "\\downarrow") {
 8900    top = repeat = "\u23D0";
 8901  } else if (delim === "\\Downarrow") {
 8902    top = repeat = "\u2016";
 8903  } else if (delim === "\\updownarrow") {
 8904    top = "\\uparrow";
 8905    repeat = "\u23D0";
 8906    bottom = "\\downarrow";
 8907  } else if (delim === "\\Updownarrow") {
 8908    top = "\\Uparrow";
 8909    repeat = "\u2016";
 8910    bottom = "\\Downarrow";
 8911  } else if (utils.contains(verts, delim)) {
 8912    repeat = "\u2223";
 8913  } else if (utils.contains(doubleVerts, delim)) {
 8914    repeat = "\u2225";
 8915  } else if (delim === "[" || delim === "\\lbrack") {
 8916    top = "\u23A1";
 8917    repeat = "\u23A2";
 8918    bottom = "\u23A3";
 8919    font = "Size4-Regular";
 8920  } else if (delim === "]" || delim === "\\rbrack") {
 8921    top = "\u23A4";
 8922    repeat = "\u23A5";
 8923    bottom = "\u23A6";
 8924    font = "Size4-Regular";
 8925  } else if (delim === "\\lfloor" || delim === "\u230A") {
 8926    repeat = top = "\u23A2";
 8927    bottom = "\u23A3";
 8928    font = "Size4-Regular";
 8929  } else if (delim === "\\lceil" || delim === "\u2308") {
 8930    top = "\u23A1";
 8931    repeat = bottom = "\u23A2";
 8932    font = "Size4-Regular";
 8933  } else if (delim === "\\rfloor" || delim === "\u230B") {
 8934    repeat = top = "\u23A5";
 8935    bottom = "\u23A6";
 8936    font = "Size4-Regular";
 8937  } else if (delim === "\\rceil" || delim === "\u2309") {
 8938    top = "\u23A4";
 8939    repeat = bottom = "\u23A5";
 8940    font = "Size4-Regular";
 8941  } else if (delim === "(" || delim === "\\lparen") {
 8942    top = "\u239B";
 8943    repeat = "\u239C";
 8944    bottom = "\u239D";
 8945    font = "Size4-Regular";
 8946  } else if (delim === ")" || delim === "\\rparen") {
 8947    top = "\u239E";
 8948    repeat = "\u239F";
 8949    bottom = "\u23A0";
 8950    font = "Size4-Regular";
 8951  } else if (delim === "\\{" || delim === "\\lbrace") {
 8952    top = "\u23A7";
 8953    middle = "\u23A8";
 8954    bottom = "\u23A9";
 8955    repeat = "\u23AA";
 8956    font = "Size4-Regular";
 8957  } else if (delim === "\\}" || delim === "\\rbrace") {
 8958    top = "\u23AB";
 8959    middle = "\u23AC";
 8960    bottom = "\u23AD";
 8961    repeat = "\u23AA";
 8962    font = "Size4-Regular";
 8963  } else if (delim === "\\lgroup" || delim === "\u27EE") {
 8964    top = "\u23A7";
 8965    bottom = "\u23A9";
 8966    repeat = "\u23AA";
 8967    font = "Size4-Regular";
 8968  } else if (delim === "\\rgroup" || delim === "\u27EF") {
 8969    top = "\u23AB";
 8970    bottom = "\u23AD";
 8971    repeat = "\u23AA";
 8972    font = "Size4-Regular";
 8973  } else if (delim === "\\lmoustache" || delim === "\u23B0") {
 8974    top = "\u23A7";
 8975    bottom = "\u23AD";
 8976    repeat = "\u23AA";
 8977    font = "Size4-Regular";
 8978  } else if (delim === "\\rmoustache" || delim === "\u23B1") {
 8979    top = "\u23AB";
 8980    bottom = "\u23A9";
 8981    repeat = "\u23AA";
 8982    font = "Size4-Regular";
 8983  } // Get the metrics of the four sections
 8984
 8985
 8986  var topMetrics = getMetrics(top, font, mode);
 8987  var topHeightTotal = topMetrics.height + topMetrics.depth;
 8988  var repeatMetrics = getMetrics(repeat, font, mode);
 8989  var repeatHeightTotal = repeatMetrics.height + repeatMetrics.depth;
 8990  var bottomMetrics = getMetrics(bottom, font, mode);
 8991  var bottomHeightTotal = bottomMetrics.height + bottomMetrics.depth;
 8992  var middleHeightTotal = 0;
 8993  var middleFactor = 1;
 8994
 8995  if (middle !== null) {
 8996    var middleMetrics = getMetrics(middle, font, mode);
 8997    middleHeightTotal = middleMetrics.height + middleMetrics.depth;
 8998    middleFactor = 2; // repeat symmetrically above and below middle
 8999  } // Calcuate the minimal height that the delimiter can have.
 9000  // It is at least the size of the top, bottom, and optional middle combined.
 9001
 9002
 9003  var minHeight = topHeightTotal + bottomHeightTotal + middleHeightTotal; // Compute the number of copies of the repeat symbol we will need
 9004
 9005  var repeatCount = Math.max(0, Math.ceil((heightTotal - minHeight) / (middleFactor * repeatHeightTotal))); // Compute the total height of the delimiter including all the symbols
 9006
 9007  var realHeightTotal = minHeight + repeatCount * middleFactor * repeatHeightTotal; // The center of the delimiter is placed at the center of the axis. Note
 9008  // that in this context, "center" means that the delimiter should be
 9009  // centered around the axis in the current style, while normally it is
 9010  // centered around the axis in textstyle.
 9011
 9012  var axisHeight = options.fontMetrics().axisHeight;
 9013
 9014  if (center) {
 9015    axisHeight *= options.sizeMultiplier;
 9016  } // Calculate the depth
 9017
 9018
 9019  var depth = realHeightTotal / 2 - axisHeight; // Now, we start building the pieces that will go into the vlist
 9020  // Keep a list of the pieces of the stacked delimiter
 9021
 9022  var stack = []; // Add the bottom symbol
 9023
 9024  stack.push(makeGlyphSpan(bottom, font, mode));
 9025  stack.push(lap); // overlap
 9026
 9027  if (middle === null) {
 9028    // The middle section will be an SVG. Make it an extra 0.016em tall.
 9029    // We'll overlap by 0.008em at top and bottom.
 9030    var innerHeight = realHeightTotal - topHeightTotal - bottomHeightTotal + 2 * lapInEms;
 9031    stack.push(makeInner(repeat, innerHeight, options));
 9032  } else {
 9033    // When there is a middle bit, we need the middle part and two repeated
 9034    // sections
 9035    var _innerHeight = (realHeightTotal - topHeightTotal - bottomHeightTotal - middleHeightTotal) / 2 + 2 * lapInEms;
 9036
 9037    stack.push(makeInner(repeat, _innerHeight, options)); // Now insert the middle of the brace.
 9038
 9039    stack.push(lap);
 9040    stack.push(makeGlyphSpan(middle, font, mode));
 9041    stack.push(lap);
 9042    stack.push(makeInner(repeat, _innerHeight, options));
 9043  } // Add the top symbol
 9044
 9045
 9046  stack.push(lap);
 9047  stack.push(makeGlyphSpan(top, font, mode)); // Finally, build the vlist
 9048
 9049  var newOptions = options.havingBaseStyle(src_Style.TEXT);
 9050  var inner = buildCommon.makeVList({
 9051    positionType: "bottom",
 9052    positionData: depth,
 9053    children: stack
 9054  }, newOptions);
 9055  return styleWrap(buildCommon.makeSpan(["delimsizing", "mult"], [inner], newOptions), src_Style.TEXT, options, classes);
 9056}; // All surds have 0.08em padding above the viniculum inside the SVG.
 9057// That keeps browser span height rounding error from pinching the line.
 9058
 9059
 9060var vbPad = 80; // padding above the surd, measured inside the viewBox.
 9061
 9062var emPad = 0.08; // padding, in ems, measured in the document.
 9063
 9064var sqrtSvg = function sqrtSvg(sqrtName, height, viewBoxHeight, extraViniculum, options) {
 9065  var path = sqrtPath(sqrtName, extraViniculum, viewBoxHeight);
 9066  var pathNode = new PathNode(sqrtName, path);
 9067  var svg = new SvgNode([pathNode], {
 9068    // Note: 1000:1 ratio of viewBox to document em width.
 9069    "width": "400em",
 9070    "height": makeEm(height),
 9071    "viewBox": "0 0 400000 " + viewBoxHeight,
 9072    "preserveAspectRatio": "xMinYMin slice"
 9073  });
 9074  return buildCommon.makeSvgSpan(["hide-tail"], [svg], options);
 9075};
 9076/**
 9077 * Make a sqrt image of the given height,
 9078 */
 9079
 9080
 9081var makeSqrtImage = function makeSqrtImage(height, options) {
 9082  // Define a newOptions that removes the effect of size changes such as \Huge.
 9083  // We don't pick different a height surd for \Huge. For it, we scale up.
 9084  var newOptions = options.havingBaseSizing(); // Pick the desired surd glyph from a sequence of surds.
 9085
 9086  var delim = traverseSequence("\\surd", height * newOptions.sizeMultiplier, stackLargeDelimiterSequence, newOptions);
 9087  var sizeMultiplier = newOptions.sizeMultiplier; // default
 9088  // The standard sqrt SVGs each have a 0.04em thick viniculum.
 9089  // If Settings.minRuleThickness is larger than that, we add extraViniculum.
 9090
 9091  var extraViniculum = Math.max(0, options.minRuleThickness - options.fontMetrics().sqrtRuleThickness); // Create a span containing an SVG image of a sqrt symbol.
 9092
 9093  var span;
 9094  var spanHeight = 0;
 9095  var texHeight = 0;
 9096  var viewBoxHeight = 0;
 9097  var advanceWidth; // We create viewBoxes with 80 units of "padding" above each surd.
 9098  // Then browser rounding error on the parent span height will not
 9099  // encroach on the ink of the viniculum. But that padding is not
 9100  // included in the TeX-like `height` used for calculation of
 9101  // vertical alignment. So texHeight = span.height < span.style.height.
 9102
 9103  if (delim.type === "small") {
 9104    // Get an SVG that is derived from glyph U+221A in font KaTeX-Main.
 9105    // 1000 unit normal glyph height.
 9106    viewBoxHeight = 1000 + 1000 * extraViniculum + vbPad;
 9107
 9108    if (height < 1.0) {
 9109      sizeMultiplier = 1.0; // mimic a \textfont radical
 9110    } else if (height < 1.4) {
 9111      sizeMultiplier = 0.7; // mimic a \scriptfont radical
 9112    }
 9113
 9114    spanHeight = (1.0 + extraViniculum + emPad) / sizeMultiplier;
 9115    texHeight = (1.00 + extraViniculum) / sizeMultiplier;
 9116    span = sqrtSvg("sqrtMain", spanHeight, viewBoxHeight, extraViniculum, options);
 9117    span.style.minWidth = "0.853em";
 9118    advanceWidth = 0.833 / sizeMultiplier; // from the font.
 9119  } else if (delim.type === "large") {
 9120    // These SVGs come from fonts: KaTeX_Size1, _Size2, etc.
 9121    viewBoxHeight = (1000 + vbPad) * sizeToMaxHeight[delim.size];
 9122    texHeight = (sizeToMaxHeight[delim.size] + extraViniculum) / sizeMultiplier;
 9123    spanHeight = (sizeToMaxHeight[delim.size] + extraViniculum + emPad) / sizeMultiplier;
 9124    span = sqrtSvg("sqrtSize" + delim.size, spanHeight, viewBoxHeight, extraViniculum, options);
 9125    span.style.minWidth = "1.02em";
 9126    advanceWidth = 1.0 / sizeMultiplier; // 1.0 from the font.
 9127  } else {
 9128    // Tall sqrt. In TeX, this would be stacked using multiple glyphs.
 9129    // We'll use a single SVG to accomplish the same thing.
 9130    spanHeight = height + extraViniculum + emPad;
 9131    texHeight = height + extraViniculum;
 9132    viewBoxHeight = Math.floor(1000 * height + extraViniculum) + vbPad;
 9133    span = sqrtSvg("sqrtTall", spanHeight, viewBoxHeight, extraViniculum, options);
 9134    span.style.minWidth = "0.742em";
 9135    advanceWidth = 1.056;
 9136  }
 9137
 9138  span.height = texHeight;
 9139  span.style.height = makeEm(spanHeight);
 9140  return {
 9141    span: span,
 9142    advanceWidth: advanceWidth,
 9143    // Calculate the actual line width.
 9144    // This actually should depend on the chosen font -- e.g. \boldmath
 9145    // should use the thicker surd symbols from e.g. KaTeX_Main-Bold, and
 9146    // have thicker rules.
 9147    ruleWidth: (options.fontMetrics().sqrtRuleThickness + extraViniculum) * sizeMultiplier
 9148  };
 9149}; // There are three kinds of delimiters, delimiters that stack when they become
 9150// too large
 9151
 9152
 9153var stackLargeDelimiters = ["(", "\\lparen", ")", "\\rparen", "[", "\\lbrack", "]", "\\rbrack", "\\{", "\\lbrace", "\\}", "\\rbrace", "\\lfloor", "\\rfloor", "\u230A", "\u230B", "\\lceil", "\\rceil", "\u2308", "\u2309", "\\surd"]; // delimiters that always stack
 9154
 9155var stackAlwaysDelimiters = ["\\uparrow", "\\downarrow", "\\updownarrow", "\\Uparrow", "\\Downarrow", "\\Updownarrow", "|", "\\|", "\\vert", "\\Vert", "\\lvert", "\\rvert", "\\lVert", "\\rVert", "\\lgroup", "\\rgroup", "\u27EE", "\u27EF", "\\lmoustache", "\\rmoustache", "\u23B0", "\u23B1"]; // and delimiters that never stack
 9156
 9157var stackNeverDelimiters = ["<", ">", "\\langle", "\\rangle", "/", "\\backslash", "\\lt", "\\gt"]; // Metrics of the different sizes. Found by looking at TeX's output of
 9158// $\bigl| // \Bigl| \biggl| \Biggl| \showlists$
 9159// Used to create stacked delimiters of appropriate sizes in makeSizedDelim.
 9160
 9161var sizeToMaxHeight = [0, 1.2, 1.8, 2.4, 3.0];
 9162/**
 9163 * Used to create a delimiter of a specific size, where `size` is 1, 2, 3, or 4.
 9164 */
 9165
 9166var makeSizedDelim = function makeSizedDelim(delim, size, options, mode, classes) {
 9167  // < and > turn into \langle and \rangle in delimiters
 9168  if (delim === "<" || delim === "\\lt" || delim === "\u27E8") {
 9169    delim = "\\langle";
 9170  } else if (delim === ">" || delim === "\\gt" || delim === "\u27E9") {
 9171    delim = "\\rangle";
 9172  } // Sized delimiters are never centered.
 9173
 9174
 9175  if (utils.contains(stackLargeDelimiters, delim) || utils.contains(stackNeverDelimiters, delim)) {
 9176    return makeLargeDelim(delim, size, false, options, mode, classes);
 9177  } else if (utils.contains(stackAlwaysDelimiters, delim)) {
 9178    return makeStackedDelim(delim, sizeToMaxHeight[size], false, options, mode, classes);
 9179  } else {
 9180    throw new src_ParseError("Illegal delimiter: '" + delim + "'");
 9181  }
 9182};
 9183/**
 9184 * There are three different sequences of delimiter sizes that the delimiters
 9185 * follow depending on the kind of delimiter. This is used when creating custom
 9186 * sized delimiters to decide whether to create a small, large, or stacked
 9187 * delimiter.
 9188 *
 9189 * In real TeX, these sequences aren't explicitly defined, but are instead
 9190 * defined inside the font metrics. Since there are only three sequences that
 9191 * are possible for the delimiters that TeX defines, it is easier to just encode
 9192 * them explicitly here.
 9193 */
 9194
 9195
 9196// Delimiters that never stack try small delimiters and large delimiters only
 9197var stackNeverDelimiterSequence = [{
 9198  type: "small",
 9199  style: src_Style.SCRIPTSCRIPT
 9200}, {
 9201  type: "small",
 9202  style: src_Style.SCRIPT
 9203}, {
 9204  type: "small",
 9205  style: src_Style.TEXT
 9206}, {
 9207  type: "large",
 9208  size: 1
 9209}, {
 9210  type: "large",
 9211  size: 2
 9212}, {
 9213  type: "large",
 9214  size: 3
 9215}, {
 9216  type: "large",
 9217  size: 4
 9218}]; // Delimiters that always stack try the small delimiters first, then stack
 9219
 9220var stackAlwaysDelimiterSequence = [{
 9221  type: "small",
 9222  style: src_Style.SCRIPTSCRIPT
 9223}, {
 9224  type: "small",
 9225  style: src_Style.SCRIPT
 9226}, {
 9227  type: "small",
 9228  style: src_Style.TEXT
 9229}, {
 9230  type: "stack"
 9231}]; // Delimiters that stack when large try the small and then large delimiters, and
 9232// stack afterwards
 9233
 9234var stackLargeDelimiterSequence = [{
 9235  type: "small",
 9236  style: src_Style.SCRIPTSCRIPT
 9237}, {
 9238  type: "small",
 9239  style: src_Style.SCRIPT
 9240}, {
 9241  type: "small",
 9242  style: src_Style.TEXT
 9243}, {
 9244  type: "large",
 9245  size: 1
 9246}, {
 9247  type: "large",
 9248  size: 2
 9249}, {
 9250  type: "large",
 9251  size: 3
 9252}, {
 9253  type: "large",
 9254  size: 4
 9255}, {
 9256  type: "stack"
 9257}];
 9258/**
 9259 * Get the font used in a delimiter based on what kind of delimiter it is.
 9260 * TODO(#963) Use more specific font family return type once that is introduced.
 9261 */
 9262
 9263var delimTypeToFont = function delimTypeToFont(type) {
 9264  if (type.type === "small") {
 9265    return "Main-Regular";
 9266  } else if (type.type === "large") {
 9267    return "Size" + type.size + "-Regular";
 9268  } else if (type.type === "stack") {
 9269    return "Size4-Regular";
 9270  } else {
 9271    throw new Error("Add support for delim type '" + type.type + "' here.");
 9272  }
 9273};
 9274/**
 9275 * Traverse a sequence of types of delimiters to decide what kind of delimiter
 9276 * should be used to create a delimiter of the given height+depth.
 9277 */
 9278
 9279
 9280var traverseSequence = function traverseSequence(delim, height, sequence, options) {
 9281  // Here, we choose the index we should start at in the sequences. In smaller
 9282  // sizes (which correspond to larger numbers in style.size) we start earlier
 9283  // in the sequence. Thus, scriptscript starts at index 3-3=0, script starts
 9284  // at index 3-2=1, text starts at 3-1=2, and display starts at min(2,3-0)=2
 9285  var start = Math.min(2, 3 - options.style.size);
 9286
 9287  for (var i = start; i < sequence.length; i++) {
 9288    if (sequence[i].type === "stack") {
 9289      // This is always the last delimiter, so we just break the loop now.
 9290      break;
 9291    }
 9292
 9293    var metrics = getMetrics(delim, delimTypeToFont(sequence[i]), "math");
 9294    var heightDepth = metrics.height + metrics.depth; // Small delimiters are scaled down versions of the same font, so we
 9295    // account for the style change size.
 9296
 9297    if (sequence[i].type === "small") {
 9298      var newOptions = options.havingBaseStyle(sequence[i].style);
 9299      heightDepth *= newOptions.sizeMultiplier;
 9300    } // Check if the delimiter at this size works for the given height.
 9301
 9302
 9303    if (heightDepth > height) {
 9304      return sequence[i];
 9305    }
 9306  } // If we reached the end of the sequence, return the last sequence element.
 9307
 9308
 9309  return sequence[sequence.length - 1];
 9310};
 9311/**
 9312 * Make a delimiter of a given height+depth, with optional centering. Here, we
 9313 * traverse the sequences, and create a delimiter that the sequence tells us to.
 9314 */
 9315
 9316
 9317var makeCustomSizedDelim = function makeCustomSizedDelim(delim, height, center, options, mode, classes) {
 9318  if (delim === "<" || delim === "\\lt" || delim === "\u27E8") {
 9319    delim = "\\langle";
 9320  } else if (delim === ">" || delim === "\\gt" || delim === "\u27E9") {
 9321    delim = "\\rangle";
 9322  } // Decide what sequence to use
 9323
 9324
 9325  var sequence;
 9326
 9327  if (utils.contains(stackNeverDelimiters, delim)) {
 9328    sequence = stackNeverDelimiterSequence;
 9329  } else if (utils.contains(stackLargeDelimiters, delim)) {
 9330    sequence = stackLargeDelimiterSequence;
 9331  } else {
 9332    sequence = stackAlwaysDelimiterSequence;
 9333  } // Look through the sequence
 9334
 9335
 9336  var delimType = traverseSequence(delim, height, sequence, options); // Get the delimiter from font glyphs.
 9337  // Depending on the sequence element we decided on, call the
 9338  // appropriate function.
 9339
 9340  if (delimType.type === "small") {
 9341    return makeSmallDelim(delim, delimType.style, center, options, mode, classes);
 9342  } else if (delimType.type === "large") {
 9343    return makeLargeDelim(delim, delimType.size, center, options, mode, classes);
 9344  } else
 9345    /* if (delimType.type === "stack") */
 9346    {
 9347      return makeStackedDelim(delim, height, center, options, mode, classes);
 9348    }
 9349};
 9350/**
 9351 * Make a delimiter for use with `\left` and `\right`, given a height and depth
 9352 * of an expression that the delimiters surround.
 9353 */
 9354
 9355
 9356var makeLeftRightDelim = function makeLeftRightDelim(delim, height, depth, options, mode, classes) {
 9357  // We always center \left/\right delimiters, so the axis is always shifted
 9358  var axisHeight = options.fontMetrics().axisHeight * options.sizeMultiplier; // Taken from TeX source, tex.web, function make_left_right
 9359
 9360  var delimiterFactor = 901;
 9361  var delimiterExtend = 5.0 / options.fontMetrics().ptPerEm;
 9362  var maxDistFromAxis = Math.max(height - axisHeight, depth + axisHeight);
 9363  var totalHeight = Math.max( // In real TeX, calculations are done using integral values which are
 9364  // 65536 per pt, or 655360 per em. So, the division here truncates in
 9365  // TeX but doesn't here, producing different results. If we wanted to
 9366  // exactly match TeX's calculation, we could do
 9367  //   Math.floor(655360 * maxDistFromAxis / 500) *
 9368  //    delimiterFactor / 655360
 9369  // (To see the difference, compare
 9370  //    x^{x^{\left(\rule{0.1em}{0.68em}\right)}}
 9371  // in TeX and KaTeX)
 9372  maxDistFromAxis / 500 * delimiterFactor, 2 * maxDistFromAxis - delimiterExtend); // Finally, we defer to `makeCustomSizedDelim` with our calculated total
 9373  // height
 9374
 9375  return makeCustomSizedDelim(delim, totalHeight, true, options, mode, classes);
 9376};
 9377
 9378/* harmony default export */ var delimiter = ({
 9379  sqrtImage: makeSqrtImage,
 9380  sizedDelim: makeSizedDelim,
 9381  sizeToMaxHeight: sizeToMaxHeight,
 9382  customSizedDelim: makeCustomSizedDelim,
 9383  leftRightDelim: makeLeftRightDelim
 9384});
 9385;// CONCATENATED MODULE: ./src/functions/delimsizing.js
 9386
 9387
 9388
 9389
 9390
 9391
 9392
 9393
 9394
 9395
 9396// Extra data needed for the delimiter handler down below
 9397var delimiterSizes = {
 9398  "\\bigl": {
 9399    mclass: "mopen",
 9400    size: 1
 9401  },
 9402  "\\Bigl": {
 9403    mclass: "mopen",
 9404    size: 2
 9405  },
 9406  "\\biggl": {
 9407    mclass: "mopen",
 9408    size: 3
 9409  },
 9410  "\\Biggl": {
 9411    mclass: "mopen",
 9412    size: 4
 9413  },
 9414  "\\bigr": {
 9415    mclass: "mclose",
 9416    size: 1
 9417  },
 9418  "\\Bigr": {
 9419    mclass: "mclose",
 9420    size: 2
 9421  },
 9422  "\\biggr": {
 9423    mclass: "mclose",
 9424    size: 3
 9425  },
 9426  "\\Biggr": {
 9427    mclass: "mclose",
 9428    size: 4
 9429  },
 9430  "\\bigm": {
 9431    mclass: "mrel",
 9432    size: 1
 9433  },
 9434  "\\Bigm": {
 9435    mclass: "mrel",
 9436    size: 2
 9437  },
 9438  "\\biggm": {
 9439    mclass: "mrel",
 9440    size: 3
 9441  },
 9442  "\\Biggm": {
 9443    mclass: "mrel",
 9444    size: 4
 9445  },
 9446  "\\big": {
 9447    mclass: "mord",
 9448    size: 1
 9449  },
 9450  "\\Big": {
 9451    mclass: "mord",
 9452    size: 2
 9453  },
 9454  "\\bigg": {
 9455    mclass: "mord",
 9456    size: 3
 9457  },
 9458  "\\Bigg": {
 9459    mclass: "mord",
 9460    size: 4
 9461  }
 9462};
 9463var 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", "."];
 9464
 9465// Delimiter functions
 9466function checkDelimiter(delim, context) {
 9467  var symDelim = checkSymbolNodeType(delim);
 9468
 9469  if (symDelim && utils.contains(delimiters, symDelim.text)) {
 9470    return symDelim;
 9471  } else if (symDelim) {
 9472    throw new src_ParseError("Invalid delimiter '" + symDelim.text + "' after '" + context.funcName + "'", delim);
 9473  } else {
 9474    throw new src_ParseError("Invalid delimiter type '" + delim.type + "'", delim);
 9475  }
 9476}
 9477
 9478defineFunction({
 9479  type: "delimsizing",
 9480  names: ["\\bigl", "\\Bigl", "\\biggl", "\\Biggl", "\\bigr", "\\Bigr", "\\biggr", "\\Biggr", "\\bigm", "\\Bigm", "\\biggm", "\\Biggm", "\\big", "\\Big", "\\bigg", "\\Bigg"],
 9481  props: {
 9482    numArgs: 1,
 9483    argTypes: ["primitive"]
 9484  },
 9485  handler: function handler(context, args) {
 9486    var delim = checkDelimiter(args[0], context);
 9487    return {
 9488      type: "delimsizing",
 9489      mode: context.parser.mode,
 9490      size: delimiterSizes[context.funcName].size,
 9491      mclass: delimiterSizes[context.funcName].mclass,
 9492      delim: delim.text
 9493    };
 9494  },
 9495  htmlBuilder: function htmlBuilder(group, options) {
 9496    if (group.delim === ".") {
 9497      // Empty delimiters still count as elements, even though they don't
 9498      // show anything.
 9499      return buildCommon.makeSpan([group.mclass]);
 9500    } // Use delimiter.sizedDelim to generate the delimiter.
 9501
 9502
 9503    return delimiter.sizedDelim(group.delim, group.size, options, group.mode, [group.mclass]);
 9504  },
 9505  mathmlBuilder: function mathmlBuilder(group) {
 9506    var children = [];
 9507
 9508    if (group.delim !== ".") {
 9509      children.push(makeText(group.delim, group.mode));
 9510    }
 9511
 9512    var node = new mathMLTree.MathNode("mo", children);
 9513
 9514    if (group.mclass === "mopen" || group.mclass === "mclose") {
 9515      // Only some of the delimsizing functions act as fences, and they
 9516      // return "mopen" or "mclose" mclass.
 9517      node.setAttribute("fence", "true");
 9518    } else {
 9519      // Explicitly disable fencing if it's not a fence, to override the
 9520      // defaults.
 9521      node.setAttribute("fence", "false");
 9522    }
 9523
 9524    node.setAttribute("stretchy", "true");
 9525    var size = makeEm(delimiter.sizeToMaxHeight[group.size]);
 9526    node.setAttribute("minsize", size);
 9527    node.setAttribute("maxsize", size);
 9528    return node;
 9529  }
 9530});
 9531
 9532function assertParsed(group) {
 9533  if (!group.body) {
 9534    throw new Error("Bug: The leftright ParseNode wasn't fully parsed.");
 9535  }
 9536}
 9537
 9538defineFunction({
 9539  type: "leftright-right",
 9540  names: ["\\right"],
 9541  props: {
 9542    numArgs: 1,
 9543    primitive: true
 9544  },
 9545  handler: function handler(context, args) {
 9546    // \left case below triggers parsing of \right in
 9547    //   `const right = parser.parseFunction();`
 9548    // uses this return value.
 9549    var color = context.parser.gullet.macros.get("\\current@color");
 9550
 9551    if (color && typeof color !== "string") {
 9552      throw new src_ParseError("\\current@color set to non-string in \\right");
 9553    }
 9554
 9555    return {
 9556      type: "leftright-right",
 9557      mode: context.parser.mode,
 9558      delim: checkDelimiter(args[0], context).text,
 9559      color: color // undefined if not set via \color
 9560
 9561    };
 9562  }
 9563});
 9564defineFunction({
 9565  type: "leftright",
 9566  names: ["\\left"],
 9567  props: {
 9568    numArgs: 1,
 9569    primitive: true
 9570  },
 9571  handler: function handler(context, args) {
 9572    var delim = checkDelimiter(args[0], context);
 9573    var parser = context.parser; // Parse out the implicit body
 9574
 9575    ++parser.leftrightDepth; // parseExpression stops before '\\right'
 9576
 9577    var body = parser.parseExpression(false);
 9578    --parser.leftrightDepth; // Check the next token
 9579
 9580    parser.expect("\\right", false);
 9581    var right = assertNodeType(parser.parseFunction(), "leftright-right");
 9582    return {
 9583      type: "leftright",
 9584      mode: parser.mode,
 9585      body: body,
 9586      left: delim.text,
 9587      right: right.delim,
 9588      rightColor: right.color
 9589    };
 9590  },
 9591  htmlBuilder: function htmlBuilder(group, options) {
 9592    assertParsed(group); // Build the inner expression
 9593
 9594    var inner = buildExpression(group.body, options, true, ["mopen", "mclose"]);
 9595    var innerHeight = 0;
 9596    var innerDepth = 0;
 9597    var hadMiddle = false; // Calculate its height and depth
 9598
 9599    for (var i = 0; i < inner.length; i++) {
 9600      // Property `isMiddle` not defined on `span`. See comment in
 9601      // "middle"'s htmlBuilder.
 9602      // $FlowFixMe
 9603      if (inner[i].isMiddle) {
 9604        hadMiddle = true;
 9605      } else {
 9606        innerHeight = Math.max(inner[i].height, innerHeight);
 9607        innerDepth = Math.max(inner[i].depth, innerDepth);
 9608      }
 9609    } // The size of delimiters is the same, regardless of what style we are
 9610    // in. Thus, to correctly calculate the size of delimiter we need around
 9611    // a group, we scale down the inner size based on the size.
 9612
 9613
 9614    innerHeight *= options.sizeMultiplier;
 9615    innerDepth *= options.sizeMultiplier;
 9616    var leftDelim;
 9617
 9618    if (group.left === ".") {
 9619      // Empty delimiters in \left and \right make null delimiter spaces.
 9620      leftDelim = makeNullDelimiter(options, ["mopen"]);
 9621    } else {
 9622      // Otherwise, use leftRightDelim to generate the correct sized
 9623      // delimiter.
 9624      leftDelim = delimiter.leftRightDelim(group.left, innerHeight, innerDepth, options, group.mode, ["mopen"]);
 9625    } // Add it to the beginning of the expression
 9626
 9627
 9628    inner.unshift(leftDelim); // Handle middle delimiters
 9629
 9630    if (hadMiddle) {
 9631      for (var _i = 1; _i < inner.length; _i++) {
 9632        var middleDelim = inner[_i]; // Property `isMiddle` not defined on `span`. See comment in
 9633        // "middle"'s htmlBuilder.
 9634        // $FlowFixMe
 9635
 9636        var isMiddle = middleDelim.isMiddle;
 9637
 9638        if (isMiddle) {
 9639          // Apply the options that were active when \middle was called
 9640          inner[_i] = delimiter.leftRightDelim(isMiddle.delim, innerHeight, innerDepth, isMiddle.options, group.mode, []);
 9641        }
 9642      }
 9643    }
 9644
 9645    var rightDelim; // Same for the right delimiter, but using color specified by \color
 9646
 9647    if (group.right === ".") {
 9648      rightDelim = makeNullDelimiter(options, ["mclose"]);
 9649    } else {
 9650      var colorOptions = group.rightColor ? options.withColor(group.rightColor) : options;
 9651      rightDelim = delimiter.leftRightDelim(group.right, innerHeight, innerDepth, colorOptions, group.mode, ["mclose"]);
 9652    } // Add it to the end of the expression.
 9653
 9654
 9655    inner.push(rightDelim);
 9656    return buildCommon.makeSpan(["minner"], inner, options);
 9657  },
 9658  mathmlBuilder: function mathmlBuilder(group, options) {
 9659    assertParsed(group);
 9660    var inner = buildMathML_buildExpression(group.body, options);
 9661
 9662    if (group.left !== ".") {
 9663      var leftNode = new mathMLTree.MathNode("mo", [makeText(group.left, group.mode)]);
 9664      leftNode.setAttribute("fence", "true");
 9665      inner.unshift(leftNode);
 9666    }
 9667
 9668    if (group.right !== ".") {
 9669      var rightNode = new mathMLTree.MathNode("mo", [makeText(group.right, group.mode)]);
 9670      rightNode.setAttribute("fence", "true");
 9671
 9672      if (group.rightColor) {
 9673        rightNode.setAttribute("mathcolor", group.rightColor);
 9674      }
 9675
 9676      inner.push(rightNode);
 9677    }
 9678
 9679    return makeRow(inner);
 9680  }
 9681});
 9682defineFunction({
 9683  type: "middle",
 9684  names: ["\\middle"],
 9685  props: {
 9686    numArgs: 1,
 9687    primitive: true
 9688  },
 9689  handler: function handler(context, args) {
 9690    var delim = checkDelimiter(args[0], context);
 9691
 9692    if (!context.parser.leftrightDepth) {
 9693      throw new src_ParseError("\\middle without preceding \\left", delim);
 9694    }
 9695
 9696    return {
 9697      type: "middle",
 9698      mode: context.parser.mode,
 9699      delim: delim.text
 9700    };
 9701  },
 9702  htmlBuilder: function htmlBuilder(group, options) {
 9703    var middleDelim;
 9704
 9705    if (group.delim === ".") {
 9706      middleDelim = makeNullDelimiter(options, []);
 9707    } else {
 9708      middleDelim = delimiter.sizedDelim(group.delim, 1, options, group.mode, []);
 9709      var isMiddle = {
 9710        delim: group.delim,
 9711        options: options
 9712      }; // Property `isMiddle` not defined on `span`. It is only used in
 9713      // this file above.
 9714      // TODO: Fix this violation of the `span` type and possibly rename
 9715      // things since `isMiddle` sounds like a boolean, but is a struct.
 9716      // $FlowFixMe
 9717
 9718      middleDelim.isMiddle = isMiddle;
 9719    }
 9720
 9721    return middleDelim;
 9722  },
 9723  mathmlBuilder: function mathmlBuilder(group, options) {
 9724    // A Firefox \middle will strech a character vertically only if it
 9725    // is in the fence part of the operator dictionary at:
 9726    // https://www.w3.org/TR/MathML3/appendixc.html.
 9727    // So we need to avoid U+2223 and use plain "|" instead.
 9728    var textNode = group.delim === "\\vert" || group.delim === "|" ? makeText("|", "text") : makeText(group.delim, group.mode);
 9729    var middleNode = new mathMLTree.MathNode("mo", [textNode]);
 9730    middleNode.setAttribute("fence", "true"); // MathML gives 5/18em spacing to each <mo> element.
 9731    // \middle should get delimiter spacing instead.
 9732
 9733    middleNode.setAttribute("lspace", "0.05em");
 9734    middleNode.setAttribute("rspace", "0.05em");
 9735    return middleNode;
 9736  }
 9737});
 9738;// CONCATENATED MODULE: ./src/functions/enclose.js
 9739
 9740
 9741
 9742
 9743
 9744
 9745
 9746
 9747
 9748
 9749
 9750
 9751var enclose_htmlBuilder = function htmlBuilder(group, options) {
 9752  // \cancel, \bcancel, \xcancel, \sout, \fbox, \colorbox, \fcolorbox, \phase
 9753  // Some groups can return document fragments.  Handle those by wrapping
 9754  // them in a span.
 9755  var inner = buildCommon.wrapFragment(buildGroup(group.body, options), options);
 9756  var label = group.label.substr(1);
 9757  var scale = options.sizeMultiplier;
 9758  var img;
 9759  var imgShift = 0; // In the LaTeX cancel package, line geometry is slightly different
 9760  // depending on whether the subject is wider than it is tall, or vice versa.
 9761  // We don't know the width of a group, so as a proxy, we test if
 9762  // the subject is a single character. This captures most of the
 9763  // subjects that should get the "tall" treatment.
 9764
 9765  var isSingleChar = utils.isCharacterBox(group.body);
 9766
 9767  if (label === "sout") {
 9768    img = buildCommon.makeSpan(["stretchy", "sout"]);
 9769    img.height = options.fontMetrics().defaultRuleThickness / scale;
 9770    imgShift = -0.5 * options.fontMetrics().xHeight;
 9771  } else if (label === "phase") {
 9772    // Set a couple of dimensions from the steinmetz package.
 9773    var lineWeight = calculateSize({
 9774      number: 0.6,
 9775      unit: "pt"
 9776    }, options);
 9777    var clearance = calculateSize({
 9778      number: 0.35,
 9779      unit: "ex"
 9780    }, options); // Prevent size changes like \Huge from affecting line thickness
 9781
 9782    var newOptions = options.havingBaseSizing();
 9783    scale = scale / newOptions.sizeMultiplier;
 9784    var angleHeight = inner.height + inner.depth + lineWeight + clearance; // Reserve a left pad for the angle.
 9785
 9786    inner.style.paddingLeft = makeEm(angleHeight / 2 + lineWeight); // Create an SVG
 9787
 9788    var viewBoxHeight = Math.floor(1000 * angleHeight * scale);
 9789    var path = phasePath(viewBoxHeight);
 9790    var svgNode = new SvgNode([new PathNode("phase", path)], {
 9791      "width": "400em",
 9792      "height": makeEm(viewBoxHeight / 1000),
 9793      "viewBox": "0 0 400000 " + viewBoxHeight,
 9794      "preserveAspectRatio": "xMinYMin slice"
 9795    }); // Wrap it in a span with overflow: hidden.
 9796
 9797    img = buildCommon.makeSvgSpan(["hide-tail"], [svgNode], options);
 9798    img.style.height = makeEm(angleHeight);
 9799    imgShift = inner.depth + lineWeight + clearance;
 9800  } else {
 9801    // Add horizontal padding
 9802    if (/cancel/.test(label)) {
 9803      if (!isSingleChar) {
 9804        inner.classes.push("cancel-pad");
 9805      }
 9806    } else if (label === "angl") {
 9807      inner.classes.push("anglpad");
 9808    } else {
 9809      inner.classes.push("boxpad");
 9810    } // Add vertical padding
 9811
 9812
 9813    var topPad = 0;
 9814    var bottomPad = 0;
 9815    var ruleThickness = 0; // ref: cancel package: \advance\totalheight2\p@ % "+2"
 9816
 9817    if (/box/.test(label)) {
 9818      ruleThickness = Math.max(options.fontMetrics().fboxrule, // default
 9819      options.minRuleThickness // User override.
 9820      );
 9821      topPad = options.fontMetrics().fboxsep + (label === "colorbox" ? 0 : ruleThickness);
 9822      bottomPad = topPad;
 9823    } else if (label === "angl") {
 9824      ruleThickness = Math.max(options.fontMetrics().defaultRuleThickness, options.minRuleThickness);
 9825      topPad = 4 * ruleThickness; // gap = 3 × line, plus the line itself.
 9826
 9827      bottomPad = Math.max(0, 0.25 - inner.depth);
 9828    } else {
 9829      topPad = isSingleChar ? 0.2 : 0;
 9830      bottomPad = topPad;
 9831    }
 9832
 9833    img = stretchy.encloseSpan(inner, label, topPad, bottomPad, options);
 9834
 9835    if (/fbox|boxed|fcolorbox/.test(label)) {
 9836      img.style.borderStyle = "solid";
 9837      img.style.borderWidth = makeEm(ruleThickness);
 9838    } else if (label === "angl" && ruleThickness !== 0.049) {
 9839      img.style.borderTopWidth = makeEm(ruleThickness);
 9840      img.style.borderRightWidth = makeEm(ruleThickness);
 9841    }
 9842
 9843    imgShift = inner.depth + bottomPad;
 9844
 9845    if (group.backgroundColor) {
 9846      img.style.backgroundColor = group.backgroundColor;
 9847
 9848      if (group.borderColor) {
 9849        img.style.borderColor = group.borderColor;
 9850      }
 9851    }
 9852  }
 9853
 9854  var vlist;
 9855
 9856  if (group.backgroundColor) {
 9857    vlist = buildCommon.makeVList({
 9858      positionType: "individualShift",
 9859      children: [// Put the color background behind inner;
 9860      {
 9861        type: "elem",
 9862        elem: img,
 9863        shift: imgShift
 9864      }, {
 9865        type: "elem",
 9866        elem: inner,
 9867        shift: 0
 9868      }]
 9869    }, options);
 9870  } else {
 9871    var classes = /cancel|phase/.test(label) ? ["svg-align"] : [];
 9872    vlist = buildCommon.makeVList({
 9873      positionType: "individualShift",
 9874      children: [// Write the \cancel stroke on top of inner.
 9875      {
 9876        type: "elem",
 9877        elem: inner,
 9878        shift: 0
 9879      }, {
 9880        type: "elem",
 9881        elem: img,
 9882        shift: imgShift,
 9883        wrapperClasses: classes
 9884      }]
 9885    }, options);
 9886  }
 9887
 9888  if (/cancel/.test(label)) {
 9889    // The cancel package documentation says that cancel lines add their height
 9890    // to the expression, but tests show that isn't how it actually works.
 9891    vlist.height = inner.height;
 9892    vlist.depth = inner.depth;
 9893  }
 9894
 9895  if (/cancel/.test(label) && !isSingleChar) {
 9896    // cancel does not create horiz space for its line extension.
 9897    return buildCommon.makeSpan(["mord", "cancel-lap"], [vlist], options);
 9898  } else {
 9899    return buildCommon.makeSpan(["mord"], [vlist], options);
 9900  }
 9901};
 9902
 9903var enclose_mathmlBuilder = function mathmlBuilder(group, options) {
 9904  var fboxsep = 0;
 9905  var node = new mathMLTree.MathNode(group.label.indexOf("colorbox") > -1 ? "mpadded" : "menclose", [buildMathML_buildGroup(group.body, options)]);
 9906
 9907  switch (group.label) {
 9908    case "\\cancel":
 9909      node.setAttribute("notation", "updiagonalstrike");
 9910      break;
 9911
 9912    case "\\bcancel":
 9913      node.setAttribute("notation", "downdiagonalstrike");
 9914      break;
 9915
 9916    case "\\phase":
 9917      node.setAttribute("notation", "phasorangle");
 9918      break;
 9919
 9920    case "\\sout":
 9921      node.setAttribute("notation", "horizontalstrike");
 9922      break;
 9923
 9924    case "\\fbox":
 9925      node.setAttribute("notation", "box");
 9926      break;
 9927
 9928    case "\\angl":
 9929      node.setAttribute("notation", "actuarial");
 9930      break;
 9931
 9932    case "\\fcolorbox":
 9933    case "\\colorbox":
 9934      // <menclose> doesn't have a good notation option. So use <mpadded>
 9935      // instead. Set some attributes that come included with <menclose>.
 9936      fboxsep = options.fontMetrics().fboxsep * options.fontMetrics().ptPerEm;
 9937      node.setAttribute("width", "+" + 2 * fboxsep + "pt");
 9938      node.setAttribute("height", "+" + 2 * fboxsep + "pt");
 9939      node.setAttribute("lspace", fboxsep + "pt"); //
 9940
 9941      node.setAttribute("voffset", fboxsep + "pt");
 9942
 9943      if (group.label === "\\fcolorbox") {
 9944        var thk = Math.max(options.fontMetrics().fboxrule, // default
 9945        options.minRuleThickness // user override
 9946        );
 9947        node.setAttribute("style", "border: " + thk + "em solid " + String(group.borderColor));
 9948      }
 9949
 9950      break;
 9951
 9952    case "\\xcancel":
 9953      node.setAttribute("notation", "updiagonalstrike downdiagonalstrike");
 9954      break;
 9955  }
 9956
 9957  if (group.backgroundColor) {
 9958    node.setAttribute("mathbackground", group.backgroundColor);
 9959  }
 9960
 9961  return node;
 9962};
 9963
 9964defineFunction({
 9965  type: "enclose",
 9966  names: ["\\colorbox"],
 9967  props: {
 9968    numArgs: 2,
 9969    allowedInText: true,
 9970    argTypes: ["color", "text"]
 9971  },
 9972  handler: function handler(_ref, args, optArgs) {
 9973    var parser = _ref.parser,
 9974        funcName = _ref.funcName;
 9975    var color = assertNodeType(args[0], "color-token").color;
 9976    var body = args[1];
 9977    return {
 9978      type: "enclose",
 9979      mode: parser.mode,
 9980      label: funcName,
 9981      backgroundColor: color,
 9982      body: body
 9983    };
 9984  },
 9985  htmlBuilder: enclose_htmlBuilder,
 9986  mathmlBuilder: enclose_mathmlBuilder
 9987});
 9988defineFunction({
 9989  type: "enclose",
 9990  names: ["\\fcolorbox"],
 9991  props: {
 9992    numArgs: 3,
 9993    allowedInText: true,
 9994    argTypes: ["color", "color", "text"]
 9995  },
 9996  handler: function handler(_ref2, args, optArgs) {
 9997    var parser = _ref2.parser,
 9998        funcName = _ref2.funcName;
 9999    var borderColor = assertNodeType(args[0], "color-token").color;
10000    var backgroundColor = assertNodeType(args[1], "color-token").color;
10001    var body = args[2];
10002    return {
10003      type: "enclose",
10004      mode: parser.mode,
10005      label: funcName,
10006      backgroundColor: backgroundColor,
10007      borderColor: borderColor,
10008      body: body
10009    };
10010  },
10011  htmlBuilder: enclose_htmlBuilder,
10012  mathmlBuilder: enclose_mathmlBuilder
10013});
10014defineFunction({
10015  type: "enclose",
10016  names: ["\\fbox"],
10017  props: {
10018    numArgs: 1,
10019    argTypes: ["hbox"],
10020    allowedInText: true
10021  },
10022  handler: function handler(_ref3, args) {
10023    var parser = _ref3.parser;
10024    return {
10025      type: "enclose",
10026      mode: parser.mode,
10027      label: "\\fbox",
10028      body: args[0]
10029    };
10030  }
10031});
10032defineFunction({
10033  type: "enclose",
10034  names: ["\\cancel", "\\bcancel", "\\xcancel", "\\sout", "\\phase"],
10035  props: {
10036    numArgs: 1
10037  },
10038  handler: function handler(_ref4, args) {
10039    var parser = _ref4.parser,
10040        funcName = _ref4.funcName;
10041    var body = args[0];
10042    return {
10043      type: "enclose",
10044      mode: parser.mode,
10045      label: funcName,
10046      body: body
10047    };
10048  },
10049  htmlBuilder: enclose_htmlBuilder,
10050  mathmlBuilder: enclose_mathmlBuilder
10051});
10052defineFunction({
10053  type: "enclose",
10054  names: ["\\angl"],
10055  props: {
10056    numArgs: 1,
10057    argTypes: ["hbox"],
10058    allowedInText: false
10059  },
10060  handler: function handler(_ref5, args) {
10061    var parser = _ref5.parser;
10062    return {
10063      type: "enclose",
10064      mode: parser.mode,
10065      label: "\\angl",
10066      body: args[0]
10067    };
10068  }
10069});
10070;// CONCATENATED MODULE: ./src/defineEnvironment.js
10071
10072
10073/**
10074 * All registered environments.
10075 * `environments.js` exports this same dictionary again and makes it public.
10076 * `Parser.js` requires this dictionary via `environments.js`.
10077 */
10078var _environments = {};
10079function defineEnvironment(_ref) {
10080  var type = _ref.type,
10081      names = _ref.names,
10082      props = _ref.props,
10083      handler = _ref.handler,
10084      htmlBuilder = _ref.htmlBuilder,
10085      mathmlBuilder = _ref.mathmlBuilder;
10086  // Set default values of environments.
10087  var data = {
10088    type: type,
10089    numArgs: props.numArgs || 0,
10090    allowedInText: false,
10091    numOptionalArgs: 0,
10092    handler: handler
10093  };
10094
10095  for (var i = 0; i < names.length; ++i) {
10096    // TODO: The value type of _environments should be a type union of all
10097    // possible `EnvSpec<>` possibilities instead of `EnvSpec<*>`, which is
10098    // an existential type.
10099    _environments[names[i]] = data;
10100  }
10101
10102  if (htmlBuilder) {
10103    _htmlGroupBuilders[type] = htmlBuilder;
10104  }
10105
10106  if (mathmlBuilder) {
10107    _mathmlGroupBuilders[type] = mathmlBuilder;
10108  }
10109}
10110;// CONCATENATED MODULE: ./src/defineMacro.js
10111
10112
10113/**
10114 * All registered global/built-in macros.
10115 * `macros.js` exports this same dictionary again and makes it public.
10116 * `Parser.js` requires this dictionary via `macros.js`.
10117 */
10118var _macros = {}; // This function might one day accept an additional argument and do more things.
10119
10120function defineMacro(name, body) {
10121  _macros[name] = body;
10122}
10123;// CONCATENATED MODULE: ./src/SourceLocation.js
10124/**
10125 * Lexing or parsing positional information for error reporting.
10126 * This object is immutable.
10127 */
10128var SourceLocation = /*#__PURE__*/function () {
10129  // The + prefix indicates that these fields aren't writeable
10130  // Lexer holding the input string.
10131  // Start offset, zero-based inclusive.
10132  // End offset, zero-based exclusive.
10133  function SourceLocation(lexer, start, end) {
10134    this.lexer = void 0;
10135    this.start = void 0;
10136    this.end = void 0;
10137    this.lexer = lexer;
10138    this.start = start;
10139    this.end = end;
10140  }
10141  /**
10142   * Merges two `SourceLocation`s from location providers, given they are
10143   * provided in order of appearance.
10144   * - Returns the first one's location if only the first is provided.
10145   * - Returns a merged range of the first and the last if both are provided
10146   *   and their lexers match.
10147   * - Otherwise, returns null.
10148   */
10149
10150
10151  SourceLocation.range = function range(first, second) {
10152    if (!second) {
10153      return first && first.loc;
10154    } else if (!first || !first.loc || !second.loc || first.loc.lexer !== second.loc.lexer) {
10155      return null;
10156    } else {
10157      return new SourceLocation(first.loc.lexer, first.loc.start, second.loc.end);
10158    }
10159  };
10160
10161  return SourceLocation;
10162}();
10163
10164
10165;// CONCATENATED MODULE: ./src/Token.js
10166
10167/**
10168 * Interface required to break circular dependency between Token, Lexer, and
10169 * ParseError.
10170 */
10171
10172/**
10173 * The resulting token returned from `lex`.
10174 *
10175 * It consists of the token text plus some position information.
10176 * The position information is essentially a range in an input string,
10177 * but instead of referencing the bare input string, we refer to the lexer.
10178 * That way it is possible to attach extra metadata to the input string,
10179 * like for example a file name or similar.
10180 *
10181 * The position information is optional, so it is OK to construct synthetic
10182 * tokens if appropriate. Not providing available position information may
10183 * lead to degraded error reporting, though.
10184 */
10185var Token = /*#__PURE__*/function () {
10186  // don't expand the token
10187  // used in \noexpand
10188  function Token(text, // the text of this token
10189  loc) {
10190    this.text = void 0;
10191    this.loc = void 0;
10192    this.noexpand = void 0;
10193    this.treatAsRelax = void 0;
10194    this.text = text;
10195    this.loc = loc;
10196  }
10197  /**
10198   * Given a pair of tokens (this and endToken), compute a `Token` encompassing
10199   * the whole input range enclosed by these two.
10200   */
10201
10202
10203  var _proto = Token.prototype;
10204
10205  _proto.range = function range(endToken, // last token of the range, inclusive
10206  text // the text of the newly constructed token
10207  ) {
10208    return new Token(text, SourceLocation.range(this, endToken));
10209  };
10210
10211  return Token;
10212}();
10213;// CONCATENATED MODULE: ./src/environments/array.js
10214
10215
10216
10217
10218
10219
10220
10221
10222
10223
10224
10225
10226
10227
10228
10229
10230// Helper functions
10231function getHLines(parser) {
10232  // Return an array. The array length = number of hlines.
10233  // Each element in the array tells if the line is dashed.
10234  var hlineInfo = [];
10235  parser.consumeSpaces();
10236  var nxt = parser.fetch().text;
10237
10238  while (nxt === "\\hline" || nxt === "\\hdashline") {
10239    parser.consume();
10240    hlineInfo.push(nxt === "\\hdashline");
10241    parser.consumeSpaces();
10242    nxt = parser.fetch().text;
10243  }
10244
10245  return hlineInfo;
10246}
10247
10248var validateAmsEnvironmentContext = function validateAmsEnvironmentContext(context) {
10249  var settings = context.parser.settings;
10250
10251  if (!settings.displayMode) {
10252    throw new src_ParseError("{" + context.envName + "} can be used only in" + " display mode.");
10253  }
10254}; // autoTag (an argument to parseArray) can be one of three values:
10255// * undefined: Regular (not-top-level) array; no tags on each row
10256// * true: Automatic equation numbering, overridable by \tag
10257// * false: Tags allowed on each row, but no automatic numbering
10258// This function *doesn't* work with the "split" environment name.
10259
10260
10261function getAutoTag(name) {
10262  if (name.indexOf("ed") === -1) {
10263    return name.indexOf("*") === -1;
10264  } // return undefined;
10265
10266}
10267/**
10268 * Parse the body of the environment, with rows delimited by \\ and
10269 * columns delimited by &, and create a nested list in row-major order
10270 * with one group per cell.  If given an optional argument style
10271 * ("text", "display", etc.), then each cell is cast into that style.
10272 */
10273
10274
10275function parseArray(parser, _ref, style) {
10276  var hskipBeforeAndAfter = _ref.hskipBeforeAndAfter,
10277      addJot = _ref.addJot,
10278      cols = _ref.cols,
10279      arraystretch = _ref.arraystretch,
10280      colSeparationType = _ref.colSeparationType,
10281      autoTag = _ref.autoTag,
10282      singleRow = _ref.singleRow,
10283      emptySingleRow = _ref.emptySingleRow,
10284      maxNumCols = _ref.maxNumCols,
10285      leqno = _ref.leqno;
10286  parser.gullet.beginGroup();
10287
10288  if (!singleRow) {
10289    // \cr is equivalent to \\ without the optional size argument (see below)
10290    // TODO: provide helpful error when \cr is used outside array environment
10291    parser.gullet.macros.set("\\cr", "\\\\\\relax");
10292  } // Get current arraystretch if it's not set by the environment
10293
10294
10295  if (!arraystretch) {
10296    var stretch = parser.gullet.expandMacroAsText("\\arraystretch");
10297
10298    if (stretch == null) {
10299      // Default \arraystretch from lttab.dtx
10300      arraystretch = 1;
10301    } else {
10302      arraystretch = parseFloat(stretch);
10303
10304      if (!arraystretch || arraystretch < 0) {
10305        throw new src_ParseError("Invalid \\arraystretch: " + stretch);
10306      }
10307    }
10308  } // Start group for first cell
10309
10310
10311  parser.gullet.beginGroup();
10312  var row = [];
10313  var body = [row];
10314  var rowGaps = [];
10315  var hLinesBeforeRow = [];
10316  var tags = autoTag != null ? [] : undefined; // amsmath uses \global\@eqnswtrue and \global\@eqnswfalse to represent
10317  // whether this row should have an equation number.  Simulate this with
10318  // a \@eqnsw macro set to 1 or 0.
10319
10320  function beginRow() {
10321    if (autoTag) {
10322      parser.gullet.macros.set("\\@eqnsw", "1", true);
10323    }
10324  }
10325
10326  function endRow() {
10327    if (tags) {
10328      if (parser.gullet.macros.get("\\df@tag")) {
10329        tags.push(parser.subparse([new Token("\\df@tag")]));
10330        parser.gullet.macros.set("\\df@tag", undefined, true);
10331      } else {
10332        tags.push(Boolean(autoTag) && parser.gullet.macros.get("\\@eqnsw") === "1");
10333      }
10334    }
10335  }
10336
10337  beginRow(); // Test for \hline at the top of the array.
10338
10339  hLinesBeforeRow.push(getHLines(parser));
10340
10341  while (true) {
10342    // eslint-disable-line no-constant-condition
10343    // Parse each cell in its own group (namespace)
10344    var cell = parser.parseExpression(false, singleRow ? "\\end" : "\\\\");
10345    parser.gullet.endGroup();
10346    parser.gullet.beginGroup();
10347    cell = {
10348      type: "ordgroup",
10349      mode: parser.mode,
10350      body: cell
10351    };
10352
10353    if (style) {
10354      cell = {
10355        type: "styling",
10356        mode: parser.mode,
10357        style: style,
10358        body: [cell]
10359      };
10360    }
10361
10362    row.push(cell);
10363    var next = parser.fetch().text;
10364
10365    if (next === "&") {
10366      if (maxNumCols && row.length === maxNumCols) {
10367        if (singleRow || colSeparationType) {
10368          // {equation} or {split}
10369          throw new src_ParseError("Too many tab characters: &", parser.nextToken);
10370        } else {
10371          // {array} environment
10372          parser.settings.reportNonstrict("textEnv", "Too few columns " + "specified in the {array} column argument.");
10373        }
10374      }
10375
10376      parser.consume();
10377    } else if (next === "\\end") {
10378      endRow(); // Arrays terminate newlines with `\crcr` which consumes a `\cr` if
10379      // the last line is empty.  However, AMS environments keep the
10380      // empty row if it's the only one.
10381      // NOTE: Currently, `cell` is the last item added into `row`.
10382
10383      if (row.length === 1 && cell.type === "styling" && cell.body[0].body.length === 0 && (body.length > 1 || !emptySingleRow)) {
10384        body.pop();
10385      }
10386
10387      if (hLinesBeforeRow.length < body.length + 1) {
10388        hLinesBeforeRow.push([]);
10389      }
10390
10391      break;
10392    } else if (next === "\\\\") {
10393      parser.consume();
10394      var size = void 0; // \def\Let@{\let\\\math@cr}
10395      // \def\math@cr{...\math@cr@}
10396      // \def\math@cr@{\new@ifnextchar[\math@cr@@{\math@cr@@[\z@]}}
10397      // \def\math@cr@@[#1]{...\math@cr@@@...}
10398      // \def\math@cr@@@{\cr}
10399
10400      if (parser.gullet.future().text !== " ") {
10401        size = parser.parseSizeGroup(true);
10402      }
10403
10404      rowGaps.push(size ? size.value : null);
10405      endRow(); // check for \hline(s) following the row separator
10406
10407      hLinesBeforeRow.push(getHLines(parser));
10408      row = [];
10409      body.push(row);
10410      beginRow();
10411    } else {
10412      throw new src_ParseError("Expected & or \\\\ or \\cr or \\end", parser.nextToken);
10413    }
10414  } // End cell group
10415
10416
10417  parser.gullet.endGroup(); // End array group defining \cr
10418
10419  parser.gullet.endGroup();
10420  return {
10421    type: "array",
10422    mode: parser.mode,
10423    addJot: addJot,
10424    arraystretch: arraystretch,
10425    body: body,
10426    cols: cols,
10427    rowGaps: rowGaps,
10428    hskipBeforeAndAfter: hskipBeforeAndAfter,
10429    hLinesBeforeRow: hLinesBeforeRow,
10430    colSeparationType: colSeparationType,
10431    tags: tags,
10432    leqno: leqno
10433  };
10434} // Decides on a style for cells in an array according to whether the given
10435// environment name starts with the letter 'd'.
10436
10437
10438function dCellStyle(envName) {
10439  if (envName.substr(0, 1) === "d") {
10440    return "display";
10441  } else {
10442    return "text";
10443  }
10444}
10445
10446var array_htmlBuilder = function htmlBuilder(group, options) {
10447  var r;
10448  var c;
10449  var nr = group.body.length;
10450  var hLinesBeforeRow = group.hLinesBeforeRow;
10451  var nc = 0;
10452  var body = new Array(nr);
10453  var hlines = [];
10454  var ruleThickness = Math.max( // From LaTeX \showthe\arrayrulewidth. Equals 0.04 em.
10455  options.fontMetrics().arrayRuleWidth, options.minRuleThickness // User override.
10456  ); // Horizontal spacing
10457
10458  var pt = 1 / options.fontMetrics().ptPerEm;
10459  var arraycolsep = 5 * pt; // default value, i.e. \arraycolsep in article.cls
10460
10461  if (group.colSeparationType && group.colSeparationType === "small") {
10462    // We're in a {smallmatrix}. Default column space is \thickspace,
10463    // i.e. 5/18em = 0.2778em, per amsmath.dtx for {smallmatrix}.
10464    // But that needs adjustment because LaTeX applies \scriptstyle to the
10465    // entire array, including the colspace, but this function applies
10466    // \scriptstyle only inside each element.
10467    var localMultiplier = options.havingStyle(src_Style.SCRIPT).sizeMultiplier;
10468    arraycolsep = 0.2778 * (localMultiplier / options.sizeMultiplier);
10469  } // Vertical spacing
10470
10471
10472  var baselineskip = group.colSeparationType === "CD" ? calculateSize({
10473    number: 3,
10474    unit: "ex"
10475  }, options) : 12 * pt; // see size10.clo
10476  // Default \jot from ltmath.dtx
10477  // TODO(edemaine): allow overriding \jot via \setlength (#687)
10478
10479  var jot = 3 * pt;
10480  var arrayskip = group.arraystretch * baselineskip;
10481  var arstrutHeight = 0.7 * arrayskip; // \strutbox in ltfsstrc.dtx and
10482
10483  var arstrutDepth = 0.3 * arrayskip; // \@arstrutbox in lttab.dtx
10484
10485  var totalHeight = 0; // Set a position for \hline(s) at the top of the array, if any.
10486
10487  function setHLinePos(hlinesInGap) {
10488    for (var i = 0; i < hlinesInGap.length; ++i) {
10489      if (i > 0) {
10490        totalHeight += 0.25;
10491      }
10492
10493      hlines.push({
10494        pos: totalHeight,
10495        isDashed: hlinesInGap[i]
10496      });
10497    }
10498  }
10499
10500  setHLinePos(hLinesBeforeRow[0]);
10501
10502  for (r = 0; r < group.body.length; ++r) {
10503    var inrow = group.body[r];
10504    var height = arstrutHeight; // \@array adds an \@arstrut
10505
10506    var depth = arstrutDepth; // to each tow (via the template)
10507
10508    if (nc < inrow.length) {
10509      nc = inrow.length;
10510    }
10511
10512    var outrow = new Array(inrow.length);
10513
10514    for (c = 0; c < inrow.length; ++c) {
10515      var elt = buildGroup(inrow[c], options);
10516
10517      if (depth < elt.depth) {
10518        depth = elt.depth;
10519      }
10520
10521      if (height < elt.height) {
10522        height = elt.height;
10523      }
10524
10525      outrow[c] = elt;
10526    }
10527
10528    var rowGap = group.rowGaps[r];
10529    var gap = 0;
10530
10531    if (rowGap) {
10532      gap = calculateSize(rowGap, options);
10533
10534      if (gap > 0) {
10535        // \@argarraycr
10536        gap += arstrutDepth;
10537
10538        if (depth < gap) {
10539          depth = gap; // \@xargarraycr
10540        }
10541
10542        gap = 0;
10543      }
10544    } // In AMS multiline environments such as aligned and gathered, rows
10545    // correspond to lines that have additional \jot added to the
10546    // \baselineskip via \openup.
10547
10548
10549    if (group.addJot) {
10550      depth += jot;
10551    }
10552
10553    outrow.height = height;
10554    outrow.depth = depth;
10555    totalHeight += height;
10556    outrow.pos = totalHeight;
10557    totalHeight += depth + gap; // \@yargarraycr
10558
10559    body[r] = outrow; // Set a position for \hline(s), if any.
10560
10561    setHLinePos(hLinesBeforeRow[r + 1]);
10562  }
10563
10564  var offset = totalHeight / 2 + options.fontMetrics().axisHeight;
10565  var colDescriptions = group.cols || [];
10566  var cols = [];
10567  var colSep;
10568  var colDescrNum;
10569  var tagSpans = [];
10570
10571  if (group.tags && group.tags.some(function (tag) {
10572    return tag;
10573  })) {
10574    // An environment with manual tags and/or automatic equation numbers.
10575    // Create node(s), the latter of which trigger CSS counter increment.
10576    for (r = 0; r < nr; ++r) {
10577      var rw = body[r];
10578      var shift = rw.pos - offset;
10579      var tag = group.tags[r];
10580      var tagSpan = void 0;
10581
10582      if (tag === true) {
10583        // automatic numbering
10584        tagSpan = buildCommon.makeSpan(["eqn-num"], [], options);
10585      } else if (tag === false) {
10586        // \nonumber/\notag or starred environment
10587        tagSpan = buildCommon.makeSpan([], [], options);
10588      } else {
10589        // manual \tag
10590        tagSpan = buildCommon.makeSpan([], buildExpression(tag, options, true), options);
10591      }
10592
10593      tagSpan.depth = rw.depth;
10594      tagSpan.height = rw.height;
10595      tagSpans.push({
10596        type: "elem",
10597        elem: tagSpan,
10598        shift: shift
10599      });
10600    }
10601  }
10602
10603  for (c = 0, colDescrNum = 0; // Continue while either there are more columns or more column
10604  // descriptions, so trailing separators don't get lost.
10605  c < nc || colDescrNum < colDescriptions.length; ++c, ++colDescrNum) {
10606    var colDescr = colDescriptions[colDescrNum] || {};
10607    var firstSeparator = true;
10608
10609    while (colDescr.type === "separator") {
10610      // If there is more than one separator in a row, add a space
10611      // between them.
10612      if (!firstSeparator) {
10613        colSep = buildCommon.makeSpan(["arraycolsep"], []);
10614        colSep.style.width = makeEm(options.fontMetrics().doubleRuleSep);
10615        cols.push(colSep);
10616      }
10617
10618      if (colDescr.separator === "|" || colDescr.separator === ":") {
10619        var lineType = colDescr.separator === "|" ? "solid" : "dashed";
10620        var separator = buildCommon.makeSpan(["vertical-separator"], [], options);
10621        separator.style.height = makeEm(totalHeight);
10622        separator.style.borderRightWidth = makeEm(ruleThickness);
10623        separator.style.borderRightStyle = lineType;
10624        separator.style.margin = "0 " + makeEm(-ruleThickness / 2);
10625
10626        var _shift = totalHeight - offset;
10627
10628        if (_shift) {
10629          separator.style.verticalAlign = makeEm(-_shift);
10630        }
10631
10632        cols.push(separator);
10633      } else {
10634        throw new src_ParseError("Invalid separator type: " + colDescr.separator);
10635      }
10636
10637      colDescrNum++;
10638      colDescr = colDescriptions[colDescrNum] || {};
10639      firstSeparator = false;
10640    }
10641
10642    if (c >= nc) {
10643      continue;
10644    }
10645
10646    var sepwidth = void 0;
10647
10648    if (c > 0 || group.hskipBeforeAndAfter) {
10649      sepwidth = utils.deflt(colDescr.pregap, arraycolsep);
10650
10651      if (sepwidth !== 0) {
10652        colSep = buildCommon.makeSpan(["arraycolsep"], []);
10653        colSep.style.width = makeEm(sepwidth);
10654        cols.push(colSep);
10655      }
10656    }
10657
10658    var col = [];
10659
10660    for (r = 0; r < nr; ++r) {
10661      var row = body[r];
10662      var elem = row[c];
10663
10664      if (!elem) {
10665        continue;
10666      }
10667
10668      var _shift2 = row.pos - offset;
10669
10670      elem.depth = row.depth;
10671      elem.height = row.height;
10672      col.push({
10673        type: "elem",
10674        elem: elem,
10675        shift: _shift2
10676      });
10677    }
10678
10679    col = buildCommon.makeVList({
10680      positionType: "individualShift",
10681      children: col
10682    }, options);
10683    col = buildCommon.makeSpan(["col-align-" + (colDescr.align || "c")], [col]);
10684    cols.push(col);
10685
10686    if (c < nc - 1 || group.hskipBeforeAndAfter) {
10687      sepwidth = utils.deflt(colDescr.postgap, arraycolsep);
10688
10689      if (sepwidth !== 0) {
10690        colSep = buildCommon.makeSpan(["arraycolsep"], []);
10691        colSep.style.width = makeEm(sepwidth);
10692        cols.push(colSep);
10693      }
10694    }
10695  }
10696
10697  body = buildCommon.makeSpan(["mtable"], cols); // Add \hline(s), if any.
10698
10699  if (hlines.length > 0) {
10700    var line = buildCommon.makeLineSpan("hline", options, ruleThickness);
10701    var dashes = buildCommon.makeLineSpan("hdashline", options, ruleThickness);
10702    var vListElems = [{
10703      type: "elem",
10704      elem: body,
10705      shift: 0
10706    }];
10707
10708    while (hlines.length > 0) {
10709      var hline = hlines.pop();
10710      var lineShift = hline.pos - offset;
10711
10712      if (hline.isDashed) {
10713        vListElems.push({
10714          type: "elem",
10715          elem: dashes,
10716          shift: lineShift
10717        });
10718      } else {
10719        vListElems.push({
10720          type: "elem",
10721          elem: line,
10722          shift: lineShift
10723        });
10724      }
10725    }
10726
10727    body = buildCommon.makeVList({
10728      positionType: "individualShift",
10729      children: vListElems
10730    }, options);
10731  }
10732
10733  if (tagSpans.length === 0) {
10734    return buildCommon.makeSpan(["mord"], [body], options);
10735  } else {
10736    var eqnNumCol = buildCommon.makeVList({
10737      positionType: "individualShift",
10738      children: tagSpans
10739    }, options);
10740    eqnNumCol = buildCommon.makeSpan(["tag"], [eqnNumCol], options);
10741    return buildCommon.makeFragment([body, eqnNumCol]);
10742  }
10743};
10744
10745var alignMap = {
10746  c: "center ",
10747  l: "left ",
10748  r: "right "
10749};
10750
10751var array_mathmlBuilder = function mathmlBuilder(group, options) {
10752  var tbl = [];
10753  var glue = new mathMLTree.MathNode("mtd", [], ["mtr-glue"]);
10754  var tag = new mathMLTree.MathNode("mtd", [], ["mml-eqn-num"]);
10755
10756  for (var i = 0; i < group.body.length; i++) {
10757    var rw = group.body[i];
10758    var row = [];
10759
10760    for (var j = 0; j < rw.length; j++) {
10761      row.push(new mathMLTree.MathNode("mtd", [buildMathML_buildGroup(rw[j], options)]));
10762    }
10763
10764    if (group.tags && group.tags[i]) {
10765      row.unshift(glue);
10766      row.push(glue);
10767
10768      if (group.leqno) {
10769        row.unshift(tag);
10770      } else {
10771        row.push(tag);
10772      }
10773    }
10774
10775    tbl.push(new mathMLTree.MathNode("mtr", row));
10776  }
10777
10778  var table = new mathMLTree.MathNode("mtable", tbl); // Set column alignment, row spacing, column spacing, and
10779  // array lines by setting attributes on the table element.
10780  // Set the row spacing. In MathML, we specify a gap distance.
10781  // We do not use rowGap[] because MathML automatically increases
10782  // cell height with the height/depth of the element content.
10783  // LaTeX \arraystretch multiplies the row baseline-to-baseline distance.
10784  // We simulate this by adding (arraystretch - 1)em to the gap. This
10785  // does a reasonable job of adjusting arrays containing 1 em tall content.
10786  // The 0.16 and 0.09 values are found emprically. They produce an array
10787  // similar to LaTeX and in which content does not interfere with \hines.
10788
10789  var gap = group.arraystretch === 0.5 ? 0.1 // {smallmatrix}, {subarray}
10790  : 0.16 + group.arraystretch - 1 + (group.addJot ? 0.09 : 0);
10791  table.setAttribute("rowspacing", makeEm(gap)); // MathML table lines go only between cells.
10792  // To place a line on an edge we'll use <menclose>, if necessary.
10793
10794  var menclose = "";
10795  var align = "";
10796
10797  if (group.cols && group.cols.length > 0) {
10798    // Find column alignment, column spacing, and  vertical lines.
10799    var cols = group.cols;
10800    var columnLines = "";
10801    var prevTypeWasAlign = false;
10802    var iStart = 0;
10803    var iEnd = cols.length;
10804
10805    if (cols[0].type === "separator") {
10806      menclose += "top ";
10807      iStart = 1;
10808    }
10809
10810    if (cols[cols.length - 1].type === "separator") {
10811      menclose += "bottom ";
10812      iEnd -= 1;
10813    }
10814
10815    for (var _i = iStart; _i < iEnd; _i++) {
10816      if (cols[_i].type === "align") {
10817        align += alignMap[cols[_i].align];
10818
10819        if (prevTypeWasAlign) {
10820          columnLines += "none ";
10821        }
10822
10823        prevTypeWasAlign = true;
10824      } else if (cols[_i].type === "separator") {
10825        // MathML accepts only single lines between cells.
10826        // So we read only the first of consecutive separators.
10827        if (prevTypeWasAlign) {
10828          columnLines += cols[_i].separator === "|" ? "solid " : "dashed ";
10829          prevTypeWasAlign = false;
10830        }
10831      }
10832    }
10833
10834    table.setAttribute("columnalign", align.trim());
10835
10836    if (/[sd]/.test(columnLines)) {
10837      table.setAttribute("columnlines", columnLines.trim());
10838    }
10839  } // Set column spacing.
10840
10841
10842  if (group.colSeparationType === "align") {
10843    var _cols = group.cols || [];
10844
10845    var spacing = "";
10846
10847    for (var _i2 = 1; _i2 < _cols.length; _i2++) {
10848      spacing += _i2 % 2 ? "0em " : "1em ";
10849    }
10850
10851    table.setAttribute("columnspacing", spacing.trim());
10852  } else if (group.colSeparationType === "alignat" || group.colSeparationType === "gather") {
10853    table.setAttribute("columnspacing", "0em");
10854  } else if (group.colSeparationType === "small") {
10855    table.setAttribute("columnspacing", "0.2778em");
10856  } else if (group.colSeparationType === "CD") {
10857    table.setAttribute("columnspacing", "0.5em");
10858  } else {
10859    table.setAttribute("columnspacing", "1em");
10860  } // Address \hline and \hdashline
10861
10862
10863  var rowLines = "";
10864  var hlines = group.hLinesBeforeRow;
10865  menclose += hlines[0].length > 0 ? "left " : "";
10866  menclose += hlines[hlines.length - 1].length > 0 ? "right " : "";
10867
10868  for (var _i3 = 1; _i3 < hlines.length - 1; _i3++) {
10869    rowLines += hlines[_i3].length === 0 ? "none " // MathML accepts only a single line between rows. Read one element.
10870    : hlines[_i3][0] ? "dashed " : "solid ";
10871  }
10872
10873  if (/[sd]/.test(rowLines)) {
10874    table.setAttribute("rowlines", rowLines.trim());
10875  }
10876
10877  if (menclose !== "") {
10878    table = new mathMLTree.MathNode("menclose", [table]);
10879    table.setAttribute("notation", menclose.trim());
10880  }
10881
10882  if (group.arraystretch && group.arraystretch < 1) {
10883    // A small array. Wrap in scriptstyle so row gap is not too large.
10884    table = new mathMLTree.MathNode("mstyle", [table]);
10885    table.setAttribute("scriptlevel", "1");
10886  }
10887
10888  return table;
10889}; // Convenience function for align, align*, aligned, alignat, alignat*, alignedat.
10890
10891
10892var alignedHandler = function alignedHandler(context, args) {
10893  if (context.envName.indexOf("ed") === -1) {
10894    validateAmsEnvironmentContext(context);
10895  }
10896
10897  var cols = [];
10898  var separationType = context.envName.indexOf("at") > -1 ? "alignat" : "align";
10899  var isSplit = context.envName === "split";
10900  var res = parseArray(context.parser, {
10901    cols: cols,
10902    addJot: true,
10903    autoTag: isSplit ? undefined : getAutoTag(context.envName),
10904    emptySingleRow: true,
10905    colSeparationType: separationType,
10906    maxNumCols: isSplit ? 2 : undefined,
10907    leqno: context.parser.settings.leqno
10908  }, "display"); // Determining number of columns.
10909  // 1. If the first argument is given, we use it as a number of columns,
10910  //    and makes sure that each row doesn't exceed that number.
10911  // 2. Otherwise, just count number of columns = maximum number
10912  //    of cells in each row ("aligned" mode -- isAligned will be true).
10913  //
10914  // At the same time, prepend empty group {} at beginning of every second
10915  // cell in each row (starting with second cell) so that operators become
10916  // binary.  This behavior is implemented in amsmath's \start@aligned.
10917
10918  var numMaths;
10919  var numCols = 0;
10920  var emptyGroup = {
10921    type: "ordgroup",
10922    mode: context.mode,
10923    body: []
10924  };
10925
10926  if (args[0] && args[0].type === "ordgroup") {
10927    var arg0 = "";
10928
10929    for (var i = 0; i < args[0].body.length; i++) {
10930      var textord = assertNodeType(args[0].body[i], "textord");
10931      arg0 += textord.text;
10932    }
10933
10934    numMaths = Number(arg0);
10935    numCols = numMaths * 2;
10936  }
10937
10938  var isAligned = !numCols;
10939  res.body.forEach(function (row) {
10940    for (var _i4 = 1; _i4 < row.length; _i4 += 2) {
10941      // Modify ordgroup node within styling node
10942      var styling = assertNodeType(row[_i4], "styling");
10943      var ordgroup = assertNodeType(styling.body[0], "ordgroup");
10944      ordgroup.body.unshift(emptyGroup);
10945    }
10946
10947    if (!isAligned) {
10948      // Case 1
10949      var curMaths = row.length / 2;
10950
10951      if (numMaths < curMaths) {
10952        throw new src_ParseError("Too many math in a row: " + ("expected " + numMaths + ", but got " + curMaths), row[0]);
10953      }
10954    } else if (numCols < row.length) {
10955      // Case 2
10956      numCols = row.length;
10957    }
10958  }); // Adjusting alignment.
10959  // In aligned mode, we add one \qquad between columns;
10960  // otherwise we add nothing.
10961
10962  for (var _i5 = 0; _i5 < numCols; ++_i5) {
10963    var align = "r";
10964    var pregap = 0;
10965
10966    if (_i5 % 2 === 1) {
10967      align = "l";
10968    } else if (_i5 > 0 && isAligned) {
10969      // "aligned" mode.
10970      pregap = 1; // add one \quad
10971    }
10972
10973    cols[_i5] = {
10974      type: "align",
10975      align: align,
10976      pregap: pregap,
10977      postgap: 0
10978    };
10979  }
10980
10981  res.colSeparationType = isAligned ? "align" : "alignat";
10982  return res;
10983}; // Arrays are part of LaTeX, defined in lttab.dtx so its documentation
10984// is part of the source2e.pdf file of LaTeX2e source documentation.
10985// {darray} is an {array} environment where cells are set in \displaystyle,
10986// as defined in nccmath.sty.
10987
10988
10989defineEnvironment({
10990  type: "array",
10991  names: ["array", "darray"],
10992  props: {
10993    numArgs: 1
10994  },
10995  handler: function handler(context, args) {
10996    // Since no types are specified above, the two possibilities are
10997    // - The argument is wrapped in {} or [], in which case Parser's
10998    //   parseGroup() returns an "ordgroup" wrapping some symbol node.
10999    // - The argument is a bare symbol node.
11000    var symNode = checkSymbolNodeType(args[0]);
11001    var colalign = symNode ? [args[0]] : assertNodeType(args[0], "ordgroup").body;
11002    var cols = colalign.map(function (nde) {
11003      var node = assertSymbolNodeType(nde);
11004      var ca = node.text;
11005
11006      if ("lcr".indexOf(ca) !== -1) {
11007        return {
11008          type: "align",
11009          align: ca
11010        };
11011      } else if (ca === "|") {
11012        return {
11013          type: "separator",
11014          separator: "|"
11015        };
11016      } else if (ca === ":") {
11017        return {
11018          type: "separator",
11019          separator: ":"
11020        };
11021      }
11022
11023      throw new src_ParseError("Unknown column alignment: " + ca, nde);
11024    });
11025    var res = {
11026      cols: cols,
11027      hskipBeforeAndAfter: true,
11028      // \@preamble in lttab.dtx
11029      maxNumCols: cols.length
11030    };
11031    return parseArray(context.parser, res, dCellStyle(context.envName));
11032  },
11033  htmlBuilder: array_htmlBuilder,
11034  mathmlBuilder: array_mathmlBuilder
11035}); // The matrix environments of amsmath builds on the array environment
11036// of LaTeX, which is discussed above.
11037// The mathtools package adds starred versions of the same environments.
11038// These have an optional argument to choose left|center|right justification.
11039
11040defineEnvironment({
11041  type: "array",
11042  names: ["matrix", "pmatrix", "bmatrix", "Bmatrix", "vmatrix", "Vmatrix", "matrix*", "pmatrix*", "bmatrix*", "Bmatrix*", "vmatrix*", "Vmatrix*"],
11043  props: {
11044    numArgs: 0
11045  },
11046  handler: function handler(context) {
11047    var delimiters = {
11048      "matrix": null,
11049      "pmatrix": ["(", ")"],
11050      "bmatrix": ["[", "]"],
11051      "Bmatrix": ["\\{", "\\}"],
11052      "vmatrix": ["|", "|"],
11053      "Vmatrix": ["\\Vert", "\\Vert"]
11054    }[context.envName.replace("*", "")]; // \hskip -\arraycolsep in amsmath
11055
11056    var colAlign = "c";
11057    var payload = {
11058      hskipBeforeAndAfter: false,
11059      cols: [{
11060        type: "align",
11061        align: colAlign
11062      }]
11063    };
11064
11065    if (context.envName.charAt(context.envName.length - 1) === "*") {
11066      // It's one of the mathtools starred functions.
11067      // Parse the optional alignment argument.
11068      var parser = context.parser;
11069      parser.consumeSpaces();
11070
11071      if (parser.fetch().text === "[") {
11072        parser.consume();
11073        parser.consumeSpaces();
11074        colAlign = parser.fetch().text;
11075
11076        if ("lcr".indexOf(colAlign) === -1) {
11077          throw new src_ParseError("Expected l or c or r", parser.nextToken);
11078        }
11079
11080        parser.consume();
11081        parser.consumeSpaces();
11082        parser.expect("]");
11083        parser.consume();
11084        payload.cols = [{
11085          type: "align",
11086          align: colAlign
11087        }];
11088      }
11089    }
11090
11091    var res = parseArray(context.parser, payload, dCellStyle(context.envName)); // Populate cols with the correct number of column alignment specs.
11092
11093    var numCols = Math.max.apply(Math, [0].concat(res.body.map(function (row) {
11094      return row.length;
11095    })));
11096    res.cols = new Array(numCols).fill({
11097      type: "align",
11098      align: colAlign
11099    });
11100    return delimiters ? {
11101      type: "leftright",
11102      mode: context.mode,
11103      body: [res],
11104      left: delimiters[0],
11105      right: delimiters[1],
11106      rightColor: undefined // \right uninfluenced by \color in array
11107
11108    } : res;
11109  },
11110  htmlBuilder: array_htmlBuilder,
11111  mathmlBuilder: array_mathmlBuilder
11112});
11113defineEnvironment({
11114  type: "array",
11115  names: ["smallmatrix"],
11116  props: {
11117    numArgs: 0
11118  },
11119  handler: function handler(context) {
11120    var payload = {
11121      arraystretch: 0.5
11122    };
11123    var res = parseArray(context.parser, payload, "script");
11124    res.colSeparationType = "small";
11125    return res;
11126  },
11127  htmlBuilder: array_htmlBuilder,
11128  mathmlBuilder: array_mathmlBuilder
11129});
11130defineEnvironment({
11131  type: "array",
11132  names: ["subarray"],
11133  props: {
11134    numArgs: 1
11135  },
11136  handler: function handler(context, args) {
11137    // Parsing of {subarray} is similar to {array}
11138    var symNode = checkSymbolNodeType(args[0]);
11139    var colalign = symNode ? [args[0]] : assertNodeType(args[0], "ordgroup").body;
11140    var cols = colalign.map(function (nde) {
11141      var node = assertSymbolNodeType(nde);
11142      var ca = node.text; // {subarray} only recognizes "l" & "c"
11143
11144      if ("lc".indexOf(ca) !== -1) {
11145        return {
11146          type: "align",
11147          align: ca
11148        };
11149      }
11150
11151      throw new src_ParseError("Unknown column alignment: " + ca, nde);
11152    });
11153
11154    if (cols.length > 1) {
11155      throw new src_ParseError("{subarray} can contain only one column");
11156    }
11157
11158    var res = {
11159      cols: cols,
11160      hskipBeforeAndAfter: false,
11161      arraystretch: 0.5
11162    };
11163    res = parseArray(context.parser, res, "script");
11164
11165    if (res.body.length > 0 && res.body[0].length > 1) {
11166      throw new src_ParseError("{subarray} can contain only one column");
11167    }
11168
11169    return res;
11170  },
11171  htmlBuilder: array_htmlBuilder,
11172  mathmlBuilder: array_mathmlBuilder
11173}); // A cases environment (in amsmath.sty) is almost equivalent to
11174// \def\arraystretch{1.2}%
11175// \left\{\begin{array}{@{}l@{\quad}l@{}} … \end{array}\right.
11176// {dcases} is a {cases} environment where cells are set in \displaystyle,
11177// as defined in mathtools.sty.
11178// {rcases} is another mathtools environment. It's brace is on the right side.
11179
11180defineEnvironment({
11181  type: "array",
11182  names: ["cases", "dcases", "rcases", "drcases"],
11183  props: {
11184    numArgs: 0
11185  },
11186  handler: function handler(context) {
11187    var payload = {
11188      arraystretch: 1.2,
11189      cols: [{
11190        type: "align",
11191        align: "l",
11192        pregap: 0,
11193        // TODO(kevinb) get the current style.
11194        // For now we use the metrics for TEXT style which is what we were
11195        // doing before.  Before attempting to get the current style we
11196        // should look at TeX's behavior especially for \over and matrices.
11197        postgap: 1.0
11198        /* 1em quad */
11199
11200      }, {
11201        type: "align",
11202        align: "l",
11203        pregap: 0,
11204        postgap: 0
11205      }]
11206    };
11207    var res = parseArray(context.parser, payload, dCellStyle(context.envName));
11208    return {
11209      type: "leftright",
11210      mode: context.mode,
11211      body: [res],
11212      left: context.envName.indexOf("r") > -1 ? "." : "\\{",
11213      right: context.envName.indexOf("r") > -1 ? "\\}" : ".",
11214      rightColor: undefined
11215    };
11216  },
11217  htmlBuilder: array_htmlBuilder,
11218  mathmlBuilder: array_mathmlBuilder
11219}); // In the align environment, one uses ampersands, &, to specify number of
11220// columns in each row, and to locate spacing between each column.
11221// align gets automatic numbering. align* and aligned do not.
11222// The alignedat environment can be used in math mode.
11223// Note that we assume \nomallineskiplimit to be zero,
11224// so that \strut@ is the same as \strut.
11225
11226defineEnvironment({
11227  type: "array",
11228  names: ["align", "align*", "aligned", "split"],
11229  props: {
11230    numArgs: 0
11231  },
11232  handler: alignedHandler,
11233  htmlBuilder: array_htmlBuilder,
11234  mathmlBuilder: array_mathmlBuilder
11235}); // A gathered environment is like an array environment with one centered
11236// column, but where rows are considered lines so get \jot line spacing
11237// and contents are set in \displaystyle.
11238
11239defineEnvironment({
11240  type: "array",
11241  names: ["gathered", "gather", "gather*"],
11242  props: {
11243    numArgs: 0
11244  },
11245  handler: function handler(context) {
11246    if (utils.contains(["gather", "gather*"], context.envName)) {
11247      validateAmsEnvironmentContext(context);
11248    }
11249
11250    var res = {
11251      cols: [{
11252        type: "align",
11253        align: "c"
11254      }],
11255      addJot: true,
11256      colSeparationType: "gather",
11257      autoTag: getAutoTag(context.envName),
11258      emptySingleRow: true,
11259      leqno: context.parser.settings.leqno
11260    };
11261    return parseArray(context.parser, res, "display");
11262  },
11263  htmlBuilder: array_htmlBuilder,
11264  mathmlBuilder: array_mathmlBuilder
11265}); // alignat environment is like an align environment, but one must explicitly
11266// specify maximum number of columns in each row, and can adjust spacing between
11267// each columns.
11268
11269defineEnvironment({
11270  type: "array",
11271  names: ["alignat", "alignat*", "alignedat"],
11272  props: {
11273    numArgs: 1
11274  },
11275  handler: alignedHandler,
11276  htmlBuilder: array_htmlBuilder,
11277  mathmlBuilder: array_mathmlBuilder
11278});
11279defineEnvironment({
11280  type: "array",
11281  names: ["equation", "equation*"],
11282  props: {
11283    numArgs: 0
11284  },
11285  handler: function handler(context) {
11286    validateAmsEnvironmentContext(context);
11287    var res = {
11288      autoTag: getAutoTag(context.envName),
11289      emptySingleRow: true,
11290      singleRow: true,
11291      maxNumCols: 1,
11292      leqno: context.parser.settings.leqno
11293    };
11294    return parseArray(context.parser, res, "display");
11295  },
11296  htmlBuilder: array_htmlBuilder,
11297  mathmlBuilder: array_mathmlBuilder
11298});
11299defineEnvironment({
11300  type: "array",
11301  names: ["CD"],
11302  props: {
11303    numArgs: 0
11304  },
11305  handler: function handler(context) {
11306    validateAmsEnvironmentContext(context);
11307    return parseCD(context.parser);
11308  },
11309  htmlBuilder: array_htmlBuilder,
11310  mathmlBuilder: array_mathmlBuilder
11311});
11312defineMacro("\\nonumber", "\\gdef\\@eqnsw{0}");
11313defineMacro("\\notag", "\\nonumber"); // Catch \hline outside array environment
11314
11315defineFunction({
11316  type: "text",
11317  // Doesn't matter what this is.
11318  names: ["\\hline", "\\hdashline"],
11319  props: {
11320    numArgs: 0,
11321    allowedInText: true,
11322    allowedInMath: true
11323  },
11324  handler: function handler(context, args) {
11325    throw new src_ParseError(context.funcName + " valid only within array environment");
11326  }
11327});
11328;// CONCATENATED MODULE: ./src/environments.js
11329
11330var environments = _environments;
11331/* harmony default export */ var src_environments = (environments); // All environment definitions should be imported below
11332
11333
11334;// CONCATENATED MODULE: ./src/functions/environment.js
11335
11336
11337
11338 // Environment delimiters. HTML/MathML rendering is defined in the corresponding
11339// defineEnvironment definitions.
11340
11341defineFunction({
11342  type: "environment",
11343  names: ["\\begin", "\\end"],
11344  props: {
11345    numArgs: 1,
11346    argTypes: ["text"]
11347  },
11348  handler: function handler(_ref, args) {
11349    var parser = _ref.parser,
11350        funcName = _ref.funcName;
11351    var nameGroup = args[0];
11352
11353    if (nameGroup.type !== "ordgroup") {
11354      throw new src_ParseError("Invalid environment name", nameGroup);
11355    }
11356
11357    var envName = "";
11358
11359    for (var i = 0; i < nameGroup.body.length; ++i) {
11360      envName += assertNodeType(nameGroup.body[i], "textord").text;
11361    }
11362
11363    if (funcName === "\\begin") {
11364      // begin...end is similar to left...right
11365      if (!src_environments.hasOwnProperty(envName)) {
11366        throw new src_ParseError("No such environment: " + envName, nameGroup);
11367      } // Build the environment object. Arguments and other information will
11368      // be made available to the begin and end methods using properties.
11369
11370
11371      var env = src_environments[envName];
11372
11373      var _parser$parseArgument = parser.parseArguments("\\begin{" + envName + "}", env),
11374          _args = _parser$parseArgument.args,
11375          optArgs = _parser$parseArgument.optArgs;
11376
11377      var context = {
11378        mode: parser.mode,
11379        envName: envName,
11380        parser: parser
11381      };
11382      var result = env.handler(context, _args, optArgs);
11383      parser.expect("\\end", false);
11384      var endNameToken = parser.nextToken;
11385      var end = assertNodeType(parser.parseFunction(), "environment");
11386
11387      if (end.name !== envName) {
11388        throw new src_ParseError("Mismatch: \\begin{" + envName + "} matched by \\end{" + end.name + "}", endNameToken);
11389      } // $FlowFixMe, "environment" handler returns an environment ParseNode
11390
11391
11392      return result;
11393    }
11394
11395    return {
11396      type: "environment",
11397      mode: parser.mode,
11398      name: envName,
11399      nameGroup: nameGroup
11400    };
11401  }
11402});
11403;// CONCATENATED MODULE: ./src/functions/mclass.js
11404
11405
11406
11407
11408
11409
11410var mclass_makeSpan = buildCommon.makeSpan;
11411
11412function mclass_htmlBuilder(group, options) {
11413  var elements = buildExpression(group.body, options, true);
11414  return mclass_makeSpan([group.mclass], elements, options);
11415}
11416
11417function mclass_mathmlBuilder(group, options) {
11418  var node;
11419  var inner = buildMathML_buildExpression(group.body, options);
11420
11421  if (group.mclass === "minner") {
11422    node = new mathMLTree.MathNode("mpadded", inner);
11423  } else if (group.mclass === "mord") {
11424    if (group.isCharacterBox) {
11425      node = inner[0];
11426      node.type = "mi";
11427    } else {
11428      node = new mathMLTree.MathNode("mi", inner);
11429    }
11430  } else {
11431    if (group.isCharacterBox) {
11432      node = inner[0];
11433      node.type = "mo";
11434    } else {
11435      node = new mathMLTree.MathNode("mo", inner);
11436    } // Set spacing based on what is the most likely adjacent atom type.
11437    // See TeXbook p170.
11438
11439
11440    if (group.mclass === "mbin") {
11441      node.attributes.lspace = "0.22em"; // medium space
11442
11443      node.attributes.rspace = "0.22em";
11444    } else if (group.mclass === "mpunct") {
11445      node.attributes.lspace = "0em";
11446      node.attributes.rspace = "0.17em"; // thinspace
11447    } else if (group.mclass === "mopen" || group.mclass === "mclose") {
11448      node.attributes.lspace = "0em";
11449      node.attributes.rspace = "0em";
11450    } else if (group.mclass === "minner") {
11451      node.attributes.lspace = "0.0556em"; // 1 mu is the most likely option
11452
11453      node.attributes.width = "+0.1111em";
11454    } // MathML <mo> default space is 5/18 em, so <mrel> needs no action.
11455    // Ref: https://developer.mozilla.org/en-US/docs/Web/MathML/Element/mo
11456
11457  }
11458
11459  return node;
11460} // Math class commands except \mathop
11461
11462
11463defineFunction({
11464  type: "mclass",
11465  names: ["\\mathord", "\\mathbin", "\\mathrel", "\\mathopen", "\\mathclose", "\\mathpunct", "\\mathinner"],
11466  props: {
11467    numArgs: 1,
11468    primitive: true
11469  },
11470  handler: function handler(_ref, args) {
11471    var parser = _ref.parser,
11472        funcName = _ref.funcName;
11473    var body = args[0];
11474    return {
11475      type: "mclass",
11476      mode: parser.mode,
11477      mclass: "m" + funcName.substr(5),
11478      // TODO(kevinb): don't prefix with 'm'
11479      body: ordargument(body),
11480      isCharacterBox: utils.isCharacterBox(body)
11481    };
11482  },
11483  htmlBuilder: mclass_htmlBuilder,
11484  mathmlBuilder: mclass_mathmlBuilder
11485});
11486var binrelClass = function binrelClass(arg) {
11487  // \binrel@ spacing varies with (bin|rel|ord) of the atom in the argument.
11488  // (by rendering separately and with {}s before and after, and measuring
11489  // the change in spacing).  We'll do roughly the same by detecting the
11490  // atom type directly.
11491  var atom = arg.type === "ordgroup" && arg.body.length ? arg.body[0] : arg;
11492
11493  if (atom.type === "atom" && (atom.family === "bin" || atom.family === "rel")) {
11494    return "m" + atom.family;
11495  } else {
11496    return "mord";
11497  }
11498}; // \@binrel{x}{y} renders like y but as mbin/mrel/mord if x is mbin/mrel/mord.
11499// This is equivalent to \binrel@{x}\binrel@@{y} in AMSTeX.
11500
11501defineFunction({
11502  type: "mclass",
11503  names: ["\\@binrel"],
11504  props: {
11505    numArgs: 2
11506  },
11507  handler: function handler(_ref2, args) {
11508    var parser = _ref2.parser;
11509    return {
11510      type: "mclass",
11511      mode: parser.mode,
11512      mclass: binrelClass(args[0]),
11513      body: ordargument(args[1]),
11514      isCharacterBox: utils.isCharacterBox(args[1])
11515    };
11516  }
11517}); // Build a relation or stacked op by placing one symbol on top of another
11518
11519defineFunction({
11520  type: "mclass",
11521  names: ["\\stackrel", "\\overset", "\\underset"],
11522  props: {
11523    numArgs: 2
11524  },
11525  handler: function handler(_ref3, args) {
11526    var parser = _ref3.parser,
11527        funcName = _ref3.funcName;
11528    var baseArg = args[1];
11529    var shiftedArg = args[0];
11530    var mclass;
11531
11532    if (funcName !== "\\stackrel") {
11533      // LaTeX applies \binrel spacing to \overset and \underset.
11534      mclass = binrelClass(baseArg);
11535    } else {
11536      mclass = "mrel"; // for \stackrel
11537    }
11538
11539    var baseOp = {
11540      type: "op",
11541      mode: baseArg.mode,
11542      limits: true,
11543      alwaysHandleSupSub: true,
11544      parentIsSupSub: false,
11545      symbol: false,
11546      suppressBaseShift: funcName !== "\\stackrel",
11547      body: ordargument(baseArg)
11548    };
11549    var supsub = {
11550      type: "supsub",
11551      mode: shiftedArg.mode,
11552      base: baseOp,
11553      sup: funcName === "\\underset" ? null : shiftedArg,
11554      sub: funcName === "\\underset" ? shiftedArg : null
11555    };
11556    return {
11557      type: "mclass",
11558      mode: parser.mode,
11559      mclass: mclass,
11560      body: [supsub],
11561      isCharacterBox: utils.isCharacterBox(supsub)
11562    };
11563  },
11564  htmlBuilder: mclass_htmlBuilder,
11565  mathmlBuilder: mclass_mathmlBuilder
11566});
11567;// CONCATENATED MODULE: ./src/functions/font.js
11568// TODO(kevinb): implement \\sl and \\sc
11569
11570
11571
11572
11573
11574
11575var font_htmlBuilder = function htmlBuilder(group, options) {
11576  var font = group.font;
11577  var newOptions = options.withFont(font);
11578  return buildGroup(group.body, newOptions);
11579};
11580
11581var font_mathmlBuilder = function mathmlBuilder(group, options) {
11582  var font = group.font;
11583  var newOptions = options.withFont(font);
11584  return buildMathML_buildGroup(group.body, newOptions);
11585};
11586
11587var fontAliases = {
11588  "\\Bbb": "\\mathbb",
11589  "\\bold": "\\mathbf",
11590  "\\frak": "\\mathfrak",
11591  "\\bm": "\\boldsymbol"
11592};
11593defineFunction({
11594  type: "font",
11595  names: [// styles, except \boldsymbol defined below
11596  "\\mathrm", "\\mathit", "\\mathbf", "\\mathnormal", // families
11597  "\\mathbb", "\\mathcal", "\\mathfrak", "\\mathscr", "\\mathsf", "\\mathtt", // aliases, except \bm defined below
11598  "\\Bbb", "\\bold", "\\frak"],
11599  props: {
11600    numArgs: 1,
11601    allowedInArgument: true
11602  },
11603  handler: function handler(_ref, args) {
11604    var parser = _ref.parser,
11605        funcName = _ref.funcName;
11606    var body = normalizeArgument(args[0]);
11607    var func = funcName;
11608
11609    if (func in fontAliases) {
11610      func = fontAliases[func];
11611    }
11612
11613    return {
11614      type: "font",
11615      mode: parser.mode,
11616      font: func.slice(1),
11617      body: body
11618    };
11619  },
11620  htmlBuilder: font_htmlBuilder,
11621  mathmlBuilder: font_mathmlBuilder
11622});
11623defineFunction({
11624  type: "mclass",
11625  names: ["\\boldsymbol", "\\bm"],
11626  props: {
11627    numArgs: 1
11628  },
11629  handler: function handler(_ref2, args) {
11630    var parser = _ref2.parser;
11631    var body = args[0];
11632    var isCharacterBox = utils.isCharacterBox(body); // amsbsy.sty's \boldsymbol uses \binrel spacing to inherit the
11633    // argument's bin|rel|ord status
11634
11635    return {
11636      type: "mclass",
11637      mode: parser.mode,
11638      mclass: binrelClass(body),
11639      body: [{
11640        type: "font",
11641        mode: parser.mode,
11642        font: "boldsymbol",
11643        body: body
11644      }],
11645      isCharacterBox: isCharacterBox
11646    };
11647  }
11648}); // Old font changing functions
11649
11650defineFunction({
11651  type: "font",
11652  names: ["\\rm", "\\sf", "\\tt", "\\bf", "\\it", "\\cal"],
11653  props: {
11654    numArgs: 0,
11655    allowedInText: true
11656  },
11657  handler: function handler(_ref3, args) {
11658    var parser = _ref3.parser,
11659        funcName = _ref3.funcName,
11660        breakOnTokenText = _ref3.breakOnTokenText;
11661    var mode = parser.mode;
11662    var body = parser.parseExpression(true, breakOnTokenText);
11663    var style = "math" + funcName.slice(1);
11664    return {
11665      type: "font",
11666      mode: mode,
11667      font: style,
11668      body: {
11669        type: "ordgroup",
11670        mode: parser.mode,
11671        body: body
11672      }
11673    };
11674  },
11675  htmlBuilder: font_htmlBuilder,
11676  mathmlBuilder: font_mathmlBuilder
11677});
11678;// CONCATENATED MODULE: ./src/functions/genfrac.js
11679
11680
11681
11682
11683
11684
11685
11686
11687
11688
11689
11690var adjustStyle = function adjustStyle(size, originalStyle) {
11691  // Figure out what style this fraction should be in based on the
11692  // function used
11693  var style = originalStyle;
11694
11695  if (size === "display") {
11696    // Get display style as a default.
11697    // If incoming style is sub/sup, use style.text() to get correct size.
11698    style = style.id >= src_Style.SCRIPT.id ? style.text() : src_Style.DISPLAY;
11699  } else if (size === "text" && style.size === src_Style.DISPLAY.size) {
11700    // We're in a \tfrac but incoming style is displaystyle, so:
11701    style = src_Style.TEXT;
11702  } else if (size === "script") {
11703    style = src_Style.SCRIPT;
11704  } else if (size === "scriptscript") {
11705    style = src_Style.SCRIPTSCRIPT;
11706  }
11707
11708  return style;
11709};
11710
11711var genfrac_htmlBuilder = function htmlBuilder(group, options) {
11712  // Fractions are handled in the TeXbook on pages 444-445, rules 15(a-e).
11713  var style = adjustStyle(group.size, options.style);
11714  var nstyle = style.fracNum();
11715  var dstyle = style.fracDen();
11716  var newOptions;
11717  newOptions = options.havingStyle(nstyle);
11718  var numerm = buildGroup(group.numer, newOptions, options);
11719
11720  if (group.continued) {
11721    // \cfrac inserts a \strut into the numerator.
11722    // Get \strut dimensions from TeXbook page 353.
11723    var hStrut = 8.5 / options.fontMetrics().ptPerEm;
11724    var dStrut = 3.5 / options.fontMetrics().ptPerEm;
11725    numerm.height = numerm.height < hStrut ? hStrut : numerm.height;
11726    numerm.depth = numerm.depth < dStrut ? dStrut : numerm.depth;
11727  }
11728
11729  newOptions = options.havingStyle(dstyle);
11730  var denomm = buildGroup(group.denom, newOptions, options);
11731  var rule;
11732  var ruleWidth;
11733  var ruleSpacing;
11734
11735  if (group.hasBarLine) {
11736    if (group.barSize) {
11737      ruleWidth = calculateSize(group.barSize, options);
11738      rule = buildCommon.makeLineSpan("frac-line", options, ruleWidth);
11739    } else {
11740      rule = buildCommon.makeLineSpan("frac-line", options);
11741    }
11742
11743    ruleWidth = rule.height;
11744    ruleSpacing = rule.height;
11745  } else {
11746    rule = null;
11747    ruleWidth = 0;
11748    ruleSpacing = options.fontMetrics().defaultRuleThickness;
11749  } // Rule 15b
11750
11751
11752  var numShift;
11753  var clearance;
11754  var denomShift;
11755
11756  if (style.size === src_Style.DISPLAY.size || group.size === "display") {
11757    numShift = options.fontMetrics().num1;
11758
11759    if (ruleWidth > 0) {
11760      clearance = 3 * ruleSpacing;
11761    } else {
11762      clearance = 7 * ruleSpacing;
11763    }
11764
11765    denomShift = options.fontMetrics().denom1;
11766  } else {
11767    if (ruleWidth > 0) {
11768      numShift = options.fontMetrics().num2;
11769      clearance = ruleSpacing;
11770    } else {
11771      numShift = options.fontMetrics().num3;
11772      clearance = 3 * ruleSpacing;
11773    }
11774
11775    denomShift = options.fontMetrics().denom2;
11776  }
11777
11778  var frac;
11779
11780  if (!rule) {
11781    // Rule 15c
11782    var candidateClearance = numShift - numerm.depth - (denomm.height - denomShift);
11783
11784    if (candidateClearance < clearance) {
11785      numShift += 0.5 * (clearance - candidateClearance);
11786      denomShift += 0.5 * (clearance - candidateClearance);
11787    }
11788
11789    frac = buildCommon.makeVList({
11790      positionType: "individualShift",
11791      children: [{
11792        type: "elem",
11793        elem: denomm,
11794        shift: denomShift
11795      }, {
11796        type: "elem",
11797        elem: numerm,
11798        shift: -numShift
11799      }]
11800    }, options);
11801  } else {
11802    // Rule 15d
11803    var axisHeight = options.fontMetrics().axisHeight;
11804
11805    if (numShift - numerm.depth - (axisHeight + 0.5 * ruleWidth) < clearance) {
11806      numShift += clearance - (numShift - numerm.depth - (axisHeight + 0.5 * ruleWidth));
11807    }
11808
11809    if (axisHeight - 0.5 * ruleWidth - (denomm.height - denomShift) < clearance) {
11810      denomShift += clearance - (axisHeight - 0.5 * ruleWidth - (denomm.height - denomShift));
11811    }
11812
11813    var midShift = -(axisHeight - 0.5 * ruleWidth);
11814    frac = buildCommon.makeVList({
11815      positionType: "individualShift",
11816      children: [{
11817        type: "elem",
11818        elem: denomm,
11819        shift: denomShift
11820      }, {
11821        type: "elem",
11822        elem: rule,
11823        shift: midShift
11824      }, {
11825        type: "elem",
11826        elem: numerm,
11827        shift: -numShift
11828      }]
11829    }, options);
11830  } // Since we manually change the style sometimes (with \dfrac or \tfrac),
11831  // account for the possible size change here.
11832
11833
11834  newOptions = options.havingStyle(style);
11835  frac.height *= newOptions.sizeMultiplier / options.sizeMultiplier;
11836  frac.depth *= newOptions.sizeMultiplier / options.sizeMultiplier; // Rule 15e
11837
11838  var delimSize;
11839
11840  if (style.size === src_Style.DISPLAY.size) {
11841    delimSize = options.fontMetrics().delim1;
11842  } else if (style.size === src_Style.SCRIPTSCRIPT.size) {
11843    delimSize = options.havingStyle(src_Style.SCRIPT).fontMetrics().delim2;
11844  } else {
11845    delimSize = options.fontMetrics().delim2;
11846  }
11847
11848  var leftDelim;
11849  var rightDelim;
11850
11851  if (group.leftDelim == null) {
11852    leftDelim = makeNullDelimiter(options, ["mopen"]);
11853  } else {
11854    leftDelim = delimiter.customSizedDelim(group.leftDelim, delimSize, true, options.havingStyle(style), group.mode, ["mopen"]);
11855  }
11856
11857  if (group.continued) {
11858    rightDelim = buildCommon.makeSpan([]); // zero width for \cfrac
11859  } else if (group.rightDelim == null) {
11860    rightDelim = makeNullDelimiter(options, ["mclose"]);
11861  } else {
11862    rightDelim = delimiter.customSizedDelim(group.rightDelim, delimSize, true, options.havingStyle(style), group.mode, ["mclose"]);
11863  }
11864
11865  return buildCommon.makeSpan(["mord"].concat(newOptions.sizingClasses(options)), [leftDelim, buildCommon.makeSpan(["mfrac"], [frac]), rightDelim], options);
11866};
11867
11868var genfrac_mathmlBuilder = function mathmlBuilder(group, options) {
11869  var node = new mathMLTree.MathNode("mfrac", [buildMathML_buildGroup(group.numer, options), buildMathML_buildGroup(group.denom, options)]);
11870
11871  if (!group.hasBarLine) {
11872    node.setAttribute("linethickness", "0px");
11873  } else if (group.barSize) {
11874    var ruleWidth = calculateSize(group.barSize, options);
11875    node.setAttribute("linethickness", makeEm(ruleWidth));
11876  }
11877
11878  var style = adjustStyle(group.size, options.style);
11879
11880  if (style.size !== options.style.size) {
11881    node = new mathMLTree.MathNode("mstyle", [node]);
11882    var isDisplay = style.size === src_Style.DISPLAY.size ? "true" : "false";
11883    node.setAttribute("displaystyle", isDisplay);
11884    node.setAttribute("scriptlevel", "0");
11885  }
11886
11887  if (group.leftDelim != null || group.rightDelim != null) {
11888    var withDelims = [];
11889
11890    if (group.leftDelim != null) {
11891      var leftOp = new mathMLTree.MathNode("mo", [new mathMLTree.TextNode(group.leftDelim.replace("\\", ""))]);
11892      leftOp.setAttribute("fence", "true");
11893      withDelims.push(leftOp);
11894    }
11895
11896    withDelims.push(node);
11897
11898    if (group.rightDelim != null) {
11899      var rightOp = new mathMLTree.MathNode("mo", [new mathMLTree.TextNode(group.rightDelim.replace("\\", ""))]);
11900      rightOp.setAttribute("fence", "true");
11901      withDelims.push(rightOp);
11902    }
11903
11904    return makeRow(withDelims);
11905  }
11906
11907  return node;
11908};
11909
11910defineFunction({
11911  type: "genfrac",
11912  names: ["\\dfrac", "\\frac", "\\tfrac", "\\dbinom", "\\binom", "\\tbinom", "\\\\atopfrac", // can’t be entered directly
11913  "\\\\bracefrac", "\\\\brackfrac" // ditto
11914  ],
11915  props: {
11916    numArgs: 2,
11917    allowedInArgument: true
11918  },
11919  handler: function handler(_ref, args) {
11920    var parser = _ref.parser,
11921        funcName = _ref.funcName;
11922    var numer = args[0];
11923    var denom = args[1];
11924    var hasBarLine;
11925    var leftDelim = null;
11926    var rightDelim = null;
11927    var size = "auto";
11928
11929    switch (funcName) {
11930      case "\\dfrac":
11931      case "\\frac":
11932      case "\\tfrac":
11933        hasBarLine = true;
11934        break;
11935
11936      case "\\\\atopfrac":
11937        hasBarLine = false;
11938        break;
11939
11940      case "\\dbinom":
11941      case "\\binom":
11942      case "\\tbinom":
11943        hasBarLine = false;
11944        leftDelim = "(";
11945        rightDelim = ")";
11946        break;
11947
11948      case "\\\\bracefrac":
11949        hasBarLine = false;
11950        leftDelim = "\\{";
11951        rightDelim = "\\}";
11952        break;
11953
11954      case "\\\\brackfrac":
11955        hasBarLine = false;
11956        leftDelim = "[";
11957        rightDelim = "]";
11958        break;
11959
11960      default:
11961        throw new Error("Unrecognized genfrac command");
11962    }
11963
11964    switch (funcName) {
11965      case "\\dfrac":
11966      case "\\dbinom":
11967        size = "display";
11968        break;
11969
11970      case "\\tfrac":
11971      case "\\tbinom":
11972        size = "text";
11973        break;
11974    }
11975
11976    return {
11977      type: "genfrac",
11978      mode: parser.mode,
11979      continued: false,
11980      numer: numer,
11981      denom: denom,
11982      hasBarLine: hasBarLine,
11983      leftDelim: leftDelim,
11984      rightDelim: rightDelim,
11985      size: size,
11986      barSize: null
11987    };
11988  },
11989  htmlBuilder: genfrac_htmlBuilder,
11990  mathmlBuilder: genfrac_mathmlBuilder
11991});
11992defineFunction({
11993  type: "genfrac",
11994  names: ["\\cfrac"],
11995  props: {
11996    numArgs: 2
11997  },
11998  handler: function handler(_ref2, args) {
11999    var parser = _ref2.parser,
12000        funcName = _ref2.funcName;
12001    var numer = args[0];
12002    var denom = args[1];
12003    return {
12004      type: "genfrac",
12005      mode: parser.mode,
12006      continued: true,
12007      numer: numer,
12008      denom: denom,
12009      hasBarLine: true,
12010      leftDelim: null,
12011      rightDelim: null,
12012      size: "display",
12013      barSize: null
12014    };
12015  }
12016}); // Infix generalized fractions -- these are not rendered directly, but replaced
12017// immediately by one of the variants above.
12018
12019defineFunction({
12020  type: "infix",
12021  names: ["\\over", "\\choose", "\\atop", "\\brace", "\\brack"],
12022  props: {
12023    numArgs: 0,
12024    infix: true
12025  },
12026  handler: function handler(_ref3) {
12027    var parser = _ref3.parser,
12028        funcName = _ref3.funcName,
12029        token = _ref3.token;
12030    var replaceWith;
12031
12032    switch (funcName) {
12033      case "\\over":
12034        replaceWith = "\\frac";
12035        break;
12036
12037      case "\\choose":
12038        replaceWith = "\\binom";
12039        break;
12040
12041      case "\\atop":
12042        replaceWith = "\\\\atopfrac";
12043        break;
12044
12045      case "\\brace":
12046        replaceWith = "\\\\bracefrac";
12047        break;
12048
12049      case "\\brack":
12050        replaceWith = "\\\\brackfrac";
12051        break;
12052
12053      default:
12054        throw new Error("Unrecognized infix genfrac command");
12055    }
12056
12057    return {
12058      type: "infix",
12059      mode: parser.mode,
12060      replaceWith: replaceWith,
12061      token: token
12062    };
12063  }
12064});
12065var stylArray = ["display", "text", "script", "scriptscript"];
12066
12067var delimFromValue = function delimFromValue(delimString) {
12068  var delim = null;
12069
12070  if (delimString.length > 0) {
12071    delim = delimString;
12072    delim = delim === "." ? null : delim;
12073  }
12074
12075  return delim;
12076};
12077
12078defineFunction({
12079  type: "genfrac",
12080  names: ["\\genfrac"],
12081  props: {
12082    numArgs: 6,
12083    allowedInArgument: true,
12084    argTypes: ["math", "math", "size", "text", "math", "math"]
12085  },
12086  handler: function handler(_ref4, args) {
12087    var parser = _ref4.parser;
12088    var numer = args[4];
12089    var denom = args[5]; // Look into the parse nodes to get the desired delimiters.
12090
12091    var leftNode = normalizeArgument(args[0]);
12092    var leftDelim = leftNode.type === "atom" && leftNode.family === "open" ? delimFromValue(leftNode.text) : null;
12093    var rightNode = normalizeArgument(args[1]);
12094    var rightDelim = rightNode.type === "atom" && rightNode.family === "close" ? delimFromValue(rightNode.text) : null;
12095    var barNode = assertNodeType(args[2], "size");
12096    var hasBarLine;
12097    var barSize = null;
12098
12099    if (barNode.isBlank) {
12100      // \genfrac acts differently than \above.
12101      // \genfrac treats an empty size group as a signal to use a
12102      // standard bar size. \above would see size = 0 and omit the bar.
12103      hasBarLine = true;
12104    } else {
12105      barSize = barNode.value;
12106      hasBarLine = barSize.number > 0;
12107    } // Find out if we want displaystyle, textstyle, etc.
12108
12109
12110    var size = "auto";
12111    var styl = args[3];
12112
12113    if (styl.type === "ordgroup") {
12114      if (styl.body.length > 0) {
12115        var textOrd = assertNodeType(styl.body[0], "textord");
12116        size = stylArray[Number(textOrd.text)];
12117      }
12118    } else {
12119      styl = assertNodeType(styl, "textord");
12120      size = stylArray[Number(styl.text)];
12121    }
12122
12123    return {
12124      type: "genfrac",
12125      mode: parser.mode,
12126      numer: numer,
12127      denom: denom,
12128      continued: false,
12129      hasBarLine: hasBarLine,
12130      barSize: barSize,
12131      leftDelim: leftDelim,
12132      rightDelim: rightDelim,
12133      size: size
12134    };
12135  },
12136  htmlBuilder: genfrac_htmlBuilder,
12137  mathmlBuilder: genfrac_mathmlBuilder
12138}); // \above is an infix fraction that also defines a fraction bar size.
12139
12140defineFunction({
12141  type: "infix",
12142  names: ["\\above"],
12143  props: {
12144    numArgs: 1,
12145    argTypes: ["size"],
12146    infix: true
12147  },
12148  handler: function handler(_ref5, args) {
12149    var parser = _ref5.parser,
12150        funcName = _ref5.funcName,
12151        token = _ref5.token;
12152    return {
12153      type: "infix",
12154      mode: parser.mode,
12155      replaceWith: "\\\\abovefrac",
12156      size: assertNodeType(args[0], "size").value,
12157      token: token
12158    };
12159  }
12160});
12161defineFunction({
12162  type: "genfrac",
12163  names: ["\\\\abovefrac"],
12164  props: {
12165    numArgs: 3,
12166    argTypes: ["math", "size", "math"]
12167  },
12168  handler: function handler(_ref6, args) {
12169    var parser = _ref6.parser,
12170        funcName = _ref6.funcName;
12171    var numer = args[0];
12172    var barSize = assert(assertNodeType(args[1], "infix").size);
12173    var denom = args[2];
12174    var hasBarLine = barSize.number > 0;
12175    return {
12176      type: "genfrac",
12177      mode: parser.mode,
12178      numer: numer,
12179      denom: denom,
12180      continued: false,
12181      hasBarLine: hasBarLine,
12182      barSize: barSize,
12183      leftDelim: null,
12184      rightDelim: null,
12185      size: "auto"
12186    };
12187  },
12188  htmlBuilder: genfrac_htmlBuilder,
12189  mathmlBuilder: genfrac_mathmlBuilder
12190});
12191;// CONCATENATED MODULE: ./src/functions/horizBrace.js
12192
12193
12194
12195
12196
12197
12198
12199
12200// NOTE: Unlike most `htmlBuilder`s, this one handles not only "horizBrace", but
12201// also "supsub" since an over/underbrace can affect super/subscripting.
12202var horizBrace_htmlBuilder = function htmlBuilder(grp, options) {
12203  var style = options.style; // Pull out the `ParseNode<"horizBrace">` if `grp` is a "supsub" node.
12204
12205  var supSubGroup;
12206  var group;
12207
12208  if (grp.type === "supsub") {
12209    // Ref: LaTeX source2e: }}}}\limits}
12210    // i.e. LaTeX treats the brace similar to an op and passes it
12211    // with \limits, so we need to assign supsub style.
12212    supSubGroup = grp.sup ? buildGroup(grp.sup, options.havingStyle(style.sup()), options) : buildGroup(grp.sub, options.havingStyle(style.sub()), options);
12213    group = assertNodeType(grp.base, "horizBrace");
12214  } else {
12215    group = assertNodeType(grp, "horizBrace");
12216  } // Build the base group
12217
12218
12219  var body = buildGroup(group.base, options.havingBaseStyle(src_Style.DISPLAY)); // Create the stretchy element
12220
12221  var braceBody = stretchy.svgSpan(group, options); // Generate the vlist, with the appropriate kerns        ┏━━━━━━━━┓
12222  // This first vlist contains the content and the brace:   equation
12223
12224  var vlist;
12225
12226  if (group.isOver) {
12227    vlist = buildCommon.makeVList({
12228      positionType: "firstBaseline",
12229      children: [{
12230        type: "elem",
12231        elem: body
12232      }, {
12233        type: "kern",
12234        size: 0.1
12235      }, {
12236        type: "elem",
12237        elem: braceBody
12238      }]
12239    }, options); // $FlowFixMe: Replace this with passing "svg-align" into makeVList.
12240
12241    vlist.children[0].children[0].children[1].classes.push("svg-align");
12242  } else {
12243    vlist = buildCommon.makeVList({
12244      positionType: "bottom",
12245      positionData: body.depth + 0.1 + braceBody.height,
12246      children: [{
12247        type: "elem",
12248        elem: braceBody
12249      }, {
12250        type: "kern",
12251        size: 0.1
12252      }, {
12253        type: "elem",
12254        elem: body
12255      }]
12256    }, options); // $FlowFixMe: Replace this with passing "svg-align" into makeVList.
12257
12258    vlist.children[0].children[0].children[0].classes.push("svg-align");
12259  }
12260
12261  if (supSubGroup) {
12262    // To write the supsub, wrap the first vlist in another vlist:
12263    // They can't all go in the same vlist, because the note might be
12264    // wider than the equation. We want the equation to control the
12265    // brace width.
12266    //      note          long note           long note
12267    //   ┏━━━━━━━━┓   or    ┏━━━┓     not    ┏━━━━━━━━━┓
12268    //    equation           eqn                 eqn
12269    var vSpan = buildCommon.makeSpan(["mord", group.isOver ? "mover" : "munder"], [vlist], options);
12270
12271    if (group.isOver) {
12272      vlist = buildCommon.makeVList({
12273        positionType: "firstBaseline",
12274        children: [{
12275          type: "elem",
12276          elem: vSpan
12277        }, {
12278          type: "kern",
12279          size: 0.2
12280        }, {
12281          type: "elem",
12282          elem: supSubGroup
12283        }]
12284      }, options);
12285    } else {
12286      vlist = buildCommon.makeVList({
12287        positionType: "bottom",
12288        positionData: vSpan.depth + 0.2 + supSubGroup.height + supSubGroup.depth,
12289        children: [{
12290          type: "elem",
12291          elem: supSubGroup
12292        }, {
12293          type: "kern",
12294          size: 0.2
12295        }, {
12296          type: "elem",
12297          elem: vSpan
12298        }]
12299      }, options);
12300    }
12301  }
12302
12303  return buildCommon.makeSpan(["mord", group.isOver ? "mover" : "munder"], [vlist], options);
12304};
12305
12306var horizBrace_mathmlBuilder = function mathmlBuilder(group, options) {
12307  var accentNode = stretchy.mathMLnode(group.label);
12308  return new mathMLTree.MathNode(group.isOver ? "mover" : "munder", [buildMathML_buildGroup(group.base, options), accentNode]);
12309}; // Horizontal stretchy braces
12310
12311
12312defineFunction({
12313  type: "horizBrace",
12314  names: ["\\overbrace", "\\underbrace"],
12315  props: {
12316    numArgs: 1
12317  },
12318  handler: function handler(_ref, args) {
12319    var parser = _ref.parser,
12320        funcName = _ref.funcName;
12321    return {
12322      type: "horizBrace",
12323      mode: parser.mode,
12324      label: funcName,
12325      isOver: /^\\over/.test(funcName),
12326      base: args[0]
12327    };
12328  },
12329  htmlBuilder: horizBrace_htmlBuilder,
12330  mathmlBuilder: horizBrace_mathmlBuilder
12331});
12332;// CONCATENATED MODULE: ./src/functions/href.js
12333
12334
12335
12336
12337
12338
12339defineFunction({
12340  type: "href",
12341  names: ["\\href"],
12342  props: {
12343    numArgs: 2,
12344    argTypes: ["url", "original"],
12345    allowedInText: true
12346  },
12347  handler: function handler(_ref, args) {
12348    var parser = _ref.parser;
12349    var body = args[1];
12350    var href = assertNodeType(args[0], "url").url;
12351
12352    if (!parser.settings.isTrusted({
12353      command: "\\href",
12354      url: href
12355    })) {
12356      return parser.formatUnsupportedCmd("\\href");
12357    }
12358
12359    return {
12360      type: "href",
12361      mode: parser.mode,
12362      href: href,
12363      body: ordargument(body)
12364    };
12365  },
12366  htmlBuilder: function htmlBuilder(group, options) {
12367    var elements = buildExpression(group.body, options, false);
12368    return buildCommon.makeAnchor(group.href, [], elements, options);
12369  },
12370  mathmlBuilder: function mathmlBuilder(group, options) {
12371    var math = buildExpressionRow(group.body, options);
12372
12373    if (!(math instanceof MathNode)) {
12374      math = new MathNode("mrow", [math]);
12375    }
12376
12377    math.setAttribute("href", group.href);
12378    return math;
12379  }
12380});
12381defineFunction({
12382  type: "href",
12383  names: ["\\url"],
12384  props: {
12385    numArgs: 1,
12386    argTypes: ["url"],
12387    allowedInText: true
12388  },
12389  handler: function handler(_ref2, args) {
12390    var parser = _ref2.parser;
12391    var href = assertNodeType(args[0], "url").url;
12392
12393    if (!parser.settings.isTrusted({
12394      command: "\\url",
12395      url: href
12396    })) {
12397      return parser.formatUnsupportedCmd("\\url");
12398    }
12399
12400    var chars = [];
12401
12402    for (var i = 0; i < href.length; i++) {
12403      var c = href[i];
12404
12405      if (c === "~") {
12406        c = "\\textasciitilde";
12407      }
12408
12409      chars.push({
12410        type: "textord",
12411        mode: "text",
12412        text: c
12413      });
12414    }
12415
12416    var body = {
12417      type: "text",
12418      mode: parser.mode,
12419      font: "\\texttt",
12420      body: chars
12421    };
12422    return {
12423      type: "href",
12424      mode: parser.mode,
12425      href: href,
12426      body: ordargument(body)
12427    };
12428  }
12429});
12430;// CONCATENATED MODULE: ./src/functions/hbox.js
12431
12432
12433
12434
12435 // \hbox is provided for compatibility with LaTeX \vcenter.
12436// In LaTeX, \vcenter can act only on a box, as in
12437// \vcenter{\hbox{$\frac{a+b}{\dfrac{c}{d}}$}}
12438// This function by itself doesn't do anything but prevent a soft line break.
12439
12440defineFunction({
12441  type: "hbox",
12442  names: ["\\hbox"],
12443  props: {
12444    numArgs: 1,
12445    argTypes: ["text"],
12446    allowedInText: true,
12447    primitive: true
12448  },
12449  handler: function handler(_ref, args) {
12450    var parser = _ref.parser;
12451    return {
12452      type: "hbox",
12453      mode: parser.mode,
12454      body: ordargument(args[0])
12455    };
12456  },
12457  htmlBuilder: function htmlBuilder(group, options) {
12458    var elements = buildExpression(group.body, options, false);
12459    return buildCommon.makeFragment(elements);
12460  },
12461  mathmlBuilder: function mathmlBuilder(group, options) {
12462    return new mathMLTree.MathNode("mrow", buildMathML_buildExpression(group.body, options));
12463  }
12464});
12465;// CONCATENATED MODULE: ./src/functions/html.js
12466
12467
12468
12469
12470
12471
12472defineFunction({
12473  type: "html",
12474  names: ["\\htmlClass", "\\htmlId", "\\htmlStyle", "\\htmlData"],
12475  props: {
12476    numArgs: 2,
12477    argTypes: ["raw", "original"],
12478    allowedInText: true
12479  },
12480  handler: function handler(_ref, args) {
12481    var parser = _ref.parser,
12482        funcName = _ref.funcName,
12483        token = _ref.token;
12484    var value = assertNodeType(args[0], "raw").string;
12485    var body = args[1];
12486
12487    if (parser.settings.strict) {
12488      parser.settings.reportNonstrict("htmlExtension", "HTML extension is disabled on strict mode");
12489    }
12490
12491    var trustContext;
12492    var attributes = {};
12493
12494    switch (funcName) {
12495      case "\\htmlClass":
12496        attributes.class = value;
12497        trustContext = {
12498          command: "\\htmlClass",
12499          class: value
12500        };
12501        break;
12502
12503      case "\\htmlId":
12504        attributes.id = value;
12505        trustContext = {
12506          command: "\\htmlId",
12507          id: value
12508        };
12509        break;
12510
12511      case "\\htmlStyle":
12512        attributes.style = value;
12513        trustContext = {
12514          command: "\\htmlStyle",
12515          style: value
12516        };
12517        break;
12518
12519      case "\\htmlData":
12520        {
12521          var data = value.split(",");
12522
12523          for (var i = 0; i < data.length; i++) {
12524            var keyVal = data[i].split("=");
12525
12526            if (keyVal.length !== 2) {
12527              throw new src_ParseError("Error parsing key-value for \\htmlData");
12528            }
12529
12530            attributes["data-" + keyVal[0].trim()] = keyVal[1].trim();
12531          }
12532
12533          trustContext = {
12534            command: "\\htmlData",
12535            attributes: attributes
12536          };
12537          break;
12538        }
12539
12540      default:
12541        throw new Error("Unrecognized html command");
12542    }
12543
12544    if (!parser.settings.isTrusted(trustContext)) {
12545      return parser.formatUnsupportedCmd(funcName);
12546    }
12547
12548    return {
12549      type: "html",
12550      mode: parser.mode,
12551      attributes: attributes,
12552      body: ordargument(body)
12553    };
12554  },
12555  htmlBuilder: function htmlBuilder(group, options) {
12556    var elements = buildExpression(group.body, options, false);
12557    var classes = ["enclosing"];
12558
12559    if (group.attributes.class) {
12560      classes.push.apply(classes, group.attributes.class.trim().split(/\s+/));
12561    }
12562
12563    var span = buildCommon.makeSpan(classes, elements, options);
12564
12565    for (var attr in group.attributes) {
12566      if (attr !== "class" && group.attributes.hasOwnProperty(attr)) {
12567        span.setAttribute(attr, group.attributes[attr]);
12568      }
12569    }
12570
12571    return span;
12572  },
12573  mathmlBuilder: function mathmlBuilder(group, options) {
12574    return buildExpressionRow(group.body, options);
12575  }
12576});
12577;// CONCATENATED MODULE: ./src/functions/htmlmathml.js
12578
12579
12580
12581
12582defineFunction({
12583  type: "htmlmathml",
12584  names: ["\\html@mathml"],
12585  props: {
12586    numArgs: 2,
12587    allowedInText: true
12588  },
12589  handler: function handler(_ref, args) {
12590    var parser = _ref.parser;
12591    return {
12592      type: "htmlmathml",
12593      mode: parser.mode,
12594      html: ordargument(args[0]),
12595      mathml: ordargument(args[1])
12596    };
12597  },
12598  htmlBuilder: function htmlBuilder(group, options) {
12599    var elements = buildExpression(group.html, options, false);
12600    return buildCommon.makeFragment(elements);
12601  },
12602  mathmlBuilder: function mathmlBuilder(group, options) {
12603    return buildExpressionRow(group.mathml, options);
12604  }
12605});
12606;// CONCATENATED MODULE: ./src/functions/includegraphics.js
12607
12608
12609
12610
12611
12612
12613
12614var sizeData = function sizeData(str) {
12615  if (/^[-+]? *(\d+(\.\d*)?|\.\d+)$/.test(str)) {
12616    // str is a number with no unit specified.
12617    // default unit is bp, per graphix package.
12618    return {
12619      number: +str,
12620      unit: "bp"
12621    };
12622  } else {
12623    var match = /([-+]?) *(\d+(?:\.\d*)?|\.\d+) *([a-z]{2})/.exec(str);
12624
12625    if (!match) {
12626      throw new src_ParseError("Invalid size: '" + str + "' in \\includegraphics");
12627    }
12628
12629    var data = {
12630      number: +(match[1] + match[2]),
12631      // sign + magnitude, cast to number
12632      unit: match[3]
12633    };
12634
12635    if (!validUnit(data)) {
12636      throw new src_ParseError("Invalid unit: '" + data.unit + "' in \\includegraphics.");
12637    }
12638
12639    return data;
12640  }
12641};
12642
12643defineFunction({
12644  type: "includegraphics",
12645  names: ["\\includegraphics"],
12646  props: {
12647    numArgs: 1,
12648    numOptionalArgs: 1,
12649    argTypes: ["raw", "url"],
12650    allowedInText: false
12651  },
12652  handler: function handler(_ref, args, optArgs) {
12653    var parser = _ref.parser;
12654    var width = {
12655      number: 0,
12656      unit: "em"
12657    };
12658    var height = {
12659      number: 0.9,
12660      unit: "em"
12661    }; // sorta character sized.
12662
12663    var totalheight = {
12664      number: 0,
12665      unit: "em"
12666    };
12667    var alt = "";
12668
12669    if (optArgs[0]) {
12670      var attributeStr = assertNodeType(optArgs[0], "raw").string; // Parser.js does not parse key/value pairs. We get a string.
12671
12672      var attributes = attributeStr.split(",");
12673
12674      for (var i = 0; i < attributes.length; i++) {
12675        var keyVal = attributes[i].split("=");
12676
12677        if (keyVal.length === 2) {
12678          var str = keyVal[1].trim();
12679
12680          switch (keyVal[0].trim()) {
12681            case "alt":
12682              alt = str;
12683              break;
12684
12685            case "width":
12686              width = sizeData(str);
12687              break;
12688
12689            case "height":
12690              height = sizeData(str);
12691              break;
12692
12693            case "totalheight":
12694              totalheight = sizeData(str);
12695              break;
12696
12697            default:
12698              throw new src_ParseError("Invalid key: '" + keyVal[0] + "' in \\includegraphics.");
12699          }
12700        }
12701      }
12702    }
12703
12704    var src = assertNodeType(args[0], "url").url;
12705
12706    if (alt === "") {
12707      // No alt given. Use the file name. Strip away the path.
12708      alt = src;
12709      alt = alt.replace(/^.*[\\/]/, '');
12710      alt = alt.substring(0, alt.lastIndexOf('.'));
12711    }
12712
12713    if (!parser.settings.isTrusted({
12714      command: "\\includegraphics",
12715      url: src
12716    })) {
12717      return parser.formatUnsupportedCmd("\\includegraphics");
12718    }
12719
12720    return {
12721      type: "includegraphics",
12722      mode: parser.mode,
12723      alt: alt,
12724      width: width,
12725      height: height,
12726      totalheight: totalheight,
12727      src: src
12728    };
12729  },
12730  htmlBuilder: function htmlBuilder(group, options) {
12731    var height = calculateSize(group.height, options);
12732    var depth = 0;
12733
12734    if (group.totalheight.number > 0) {
12735      depth = calculateSize(group.totalheight, options) - height;
12736    }
12737
12738    var width = 0;
12739
12740    if (group.width.number > 0) {
12741      width = calculateSize(group.width, options);
12742    }
12743
12744    var style = {
12745      height: makeEm(height + depth)
12746    };
12747
12748    if (width > 0) {
12749      style.width = makeEm(width);
12750    }
12751
12752    if (depth > 0) {
12753      style.verticalAlign = makeEm(-depth);
12754    }
12755
12756    var node = new Img(group.src, group.alt, style);
12757    node.height = height;
12758    node.depth = depth;
12759    return node;
12760  },
12761  mathmlBuilder: function mathmlBuilder(group, options) {
12762    var node = new mathMLTree.MathNode("mglyph", []);
12763    node.setAttribute("alt", group.alt);
12764    var height = calculateSize(group.height, options);
12765    var depth = 0;
12766
12767    if (group.totalheight.number > 0) {
12768      depth = calculateSize(group.totalheight, options) - height;
12769      node.setAttribute("valign", makeEm(-depth));
12770    }
12771
12772    node.setAttribute("height", makeEm(height + depth));
12773
12774    if (group.width.number > 0) {
12775      var width = calculateSize(group.width, options);
12776      node.setAttribute("width", makeEm(width));
12777    }
12778
12779    node.setAttribute("src", group.src);
12780    return node;
12781  }
12782});
12783;// CONCATENATED MODULE: ./src/functions/kern.js
12784// Horizontal spacing commands
12785
12786
12787
12788
12789 // TODO: \hskip and \mskip should support plus and minus in lengths
12790
12791defineFunction({
12792  type: "kern",
12793  names: ["\\kern", "\\mkern", "\\hskip", "\\mskip"],
12794  props: {
12795    numArgs: 1,
12796    argTypes: ["size"],
12797    primitive: true,
12798    allowedInText: true
12799  },
12800  handler: function handler(_ref, args) {
12801    var parser = _ref.parser,
12802        funcName = _ref.funcName;
12803    var size = assertNodeType(args[0], "size");
12804
12805    if (parser.settings.strict) {
12806      var mathFunction = funcName[1] === 'm'; // \mkern, \mskip
12807
12808      var muUnit = size.value.unit === 'mu';
12809
12810      if (mathFunction) {
12811        if (!muUnit) {
12812          parser.settings.reportNonstrict("mathVsTextUnits", "LaTeX's " + funcName + " supports only mu units, " + ("not " + size.value.unit + " units"));
12813        }
12814
12815        if (parser.mode !== "math") {
12816          parser.settings.reportNonstrict("mathVsTextUnits", "LaTeX's " + funcName + " works only in math mode");
12817        }
12818      } else {
12819        // !mathFunction
12820        if (muUnit) {
12821          parser.settings.reportNonstrict("mathVsTextUnits", "LaTeX's " + funcName + " doesn't support mu units");
12822        }
12823      }
12824    }
12825
12826    return {
12827      type: "kern",
12828      mode: parser.mode,
12829      dimension: size.value
12830    };
12831  },
12832  htmlBuilder: function htmlBuilder(group, options) {
12833    return buildCommon.makeGlue(group.dimension, options);
12834  },
12835  mathmlBuilder: function mathmlBuilder(group, options) {
12836    var dimension = calculateSize(group.dimension, options);
12837    return new mathMLTree.SpaceNode(dimension);
12838  }
12839});
12840;// CONCATENATED MODULE: ./src/functions/lap.js
12841// Horizontal overlap functions
12842
12843
12844
12845
12846
12847
12848defineFunction({
12849  type: "lap",
12850  names: ["\\mathllap", "\\mathrlap", "\\mathclap"],
12851  props: {
12852    numArgs: 1,
12853    allowedInText: true
12854  },
12855  handler: function handler(_ref, args) {
12856    var parser = _ref.parser,
12857        funcName = _ref.funcName;
12858    var body = args[0];
12859    return {
12860      type: "lap",
12861      mode: parser.mode,
12862      alignment: funcName.slice(5),
12863      body: body
12864    };
12865  },
12866  htmlBuilder: function htmlBuilder(group, options) {
12867    // mathllap, mathrlap, mathclap
12868    var inner;
12869
12870    if (group.alignment === "clap") {
12871      // ref: https://www.math.lsu.edu/~aperlis/publications/mathclap/
12872      inner = buildCommon.makeSpan([], [buildGroup(group.body, options)]); // wrap, since CSS will center a .clap > .inner > span
12873
12874      inner = buildCommon.makeSpan(["inner"], [inner], options);
12875    } else {
12876      inner = buildCommon.makeSpan(["inner"], [buildGroup(group.body, options)]);
12877    }
12878
12879    var fix = buildCommon.makeSpan(["fix"], []);
12880    var node = buildCommon.makeSpan([group.alignment], [inner, fix], options); // At this point, we have correctly set horizontal alignment of the
12881    // two items involved in the lap.
12882    // Next, use a strut to set the height of the HTML bounding box.
12883    // Otherwise, a tall argument may be misplaced.
12884    // This code resolved issue #1153
12885
12886    var strut = buildCommon.makeSpan(["strut"]);
12887    strut.style.height = makeEm(node.height + node.depth);
12888
12889    if (node.depth) {
12890      strut.style.verticalAlign = makeEm(-node.depth);
12891    }
12892
12893    node.children.unshift(strut); // Next, prevent vertical misplacement when next to something tall.
12894    // This code resolves issue #1234
12895
12896    node = buildCommon.makeSpan(["thinbox"], [node], options);
12897    return buildCommon.makeSpan(["mord", "vbox"], [node], options);
12898  },
12899  mathmlBuilder: function mathmlBuilder(group, options) {
12900    // mathllap, mathrlap, mathclap
12901    var node = new mathMLTree.MathNode("mpadded", [buildMathML_buildGroup(group.body, options)]);
12902
12903    if (group.alignment !== "rlap") {
12904      var offset = group.alignment === "llap" ? "-1" : "-0.5";
12905      node.setAttribute("lspace", offset + "width");
12906    }
12907
12908    node.setAttribute("width", "0px");
12909    return node;
12910  }
12911});
12912;// CONCATENATED MODULE: ./src/functions/math.js
12913
12914 // Switching from text mode back to math mode
12915
12916defineFunction({
12917  type: "styling",
12918  names: ["\\(", "$"],
12919  props: {
12920    numArgs: 0,
12921    allowedInText: true,
12922    allowedInMath: false
12923  },
12924  handler: function handler(_ref, args) {
12925    var funcName = _ref.funcName,
12926        parser = _ref.parser;
12927    var outerMode = parser.mode;
12928    parser.switchMode("math");
12929    var close = funcName === "\\(" ? "\\)" : "$";
12930    var body = parser.parseExpression(false, close);
12931    parser.expect(close);
12932    parser.switchMode(outerMode);
12933    return {
12934      type: "styling",
12935      mode: parser.mode,
12936      style: "text",
12937      body: body
12938    };
12939  }
12940}); // Check for extra closing math delimiters
12941
12942defineFunction({
12943  type: "text",
12944  // Doesn't matter what this is.
12945  names: ["\\)", "\\]"],
12946  props: {
12947    numArgs: 0,
12948    allowedInText: true,
12949    allowedInMath: false
12950  },
12951  handler: function handler(context, args) {
12952    throw new src_ParseError("Mismatched " + context.funcName);
12953  }
12954});
12955;// CONCATENATED MODULE: ./src/functions/mathchoice.js
12956
12957
12958
12959
12960
12961
12962var chooseMathStyle = function chooseMathStyle(group, options) {
12963  switch (options.style.size) {
12964    case src_Style.DISPLAY.size:
12965      return group.display;
12966
12967    case src_Style.TEXT.size:
12968      return group.text;
12969
12970    case src_Style.SCRIPT.size:
12971      return group.script;
12972
12973    case src_Style.SCRIPTSCRIPT.size:
12974      return group.scriptscript;
12975
12976    default:
12977      return group.text;
12978  }
12979};
12980
12981defineFunction({
12982  type: "mathchoice",
12983  names: ["\\mathchoice"],
12984  props: {
12985    numArgs: 4,
12986    primitive: true
12987  },
12988  handler: function handler(_ref, args) {
12989    var parser = _ref.parser;
12990    return {
12991      type: "mathchoice",
12992      mode: parser.mode,
12993      display: ordargument(args[0]),
12994      text: ordargument(args[1]),
12995      script: ordargument(args[2]),
12996      scriptscript: ordargument(args[3])
12997    };
12998  },
12999  htmlBuilder: function htmlBuilder(group, options) {
13000    var body = chooseMathStyle(group, options);
13001    var elements = buildExpression(body, options, false);
13002    return buildCommon.makeFragment(elements);
13003  },
13004  mathmlBuilder: function mathmlBuilder(group, options) {
13005    var body = chooseMathStyle(group, options);
13006    return buildExpressionRow(body, options);
13007  }
13008});
13009;// CONCATENATED MODULE: ./src/functions/utils/assembleSupSub.js
13010
13011
13012
13013 // For an operator with limits, assemble the base, sup, and sub into a span.
13014
13015var assembleSupSub = function assembleSupSub(base, supGroup, subGroup, options, style, slant, baseShift) {
13016  base = buildCommon.makeSpan([], [base]);
13017  var subIsSingleCharacter = subGroup && utils.isCharacterBox(subGroup);
13018  var sub;
13019  var sup; // We manually have to handle the superscripts and subscripts. This,
13020  // aside from the kern calculations, is copied from supsub.
13021
13022  if (supGroup) {
13023    var elem = buildGroup(supGroup, options.havingStyle(style.sup()), options);
13024    sup = {
13025      elem: elem,
13026      kern: Math.max(options.fontMetrics().bigOpSpacing1, options.fontMetrics().bigOpSpacing3 - elem.depth)
13027    };
13028  }
13029
13030  if (subGroup) {
13031    var _elem = buildGroup(subGroup, options.havingStyle(style.sub()), options);
13032
13033    sub = {
13034      elem: _elem,
13035      kern: Math.max(options.fontMetrics().bigOpSpacing2, options.fontMetrics().bigOpSpacing4 - _elem.height)
13036    };
13037  } // Build the final group as a vlist of the possible subscript, base,
13038  // and possible superscript.
13039
13040
13041  var finalGroup;
13042
13043  if (sup && sub) {
13044    var bottom = options.fontMetrics().bigOpSpacing5 + sub.elem.height + sub.elem.depth + sub.kern + base.depth + baseShift;
13045    finalGroup = buildCommon.makeVList({
13046      positionType: "bottom",
13047      positionData: bottom,
13048      children: [{
13049        type: "kern",
13050        size: options.fontMetrics().bigOpSpacing5
13051      }, {
13052        type: "elem",
13053        elem: sub.elem,
13054        marginLeft: makeEm(-slant)
13055      }, {
13056        type: "kern",
13057        size: sub.kern
13058      }, {
13059        type: "elem",
13060        elem: base
13061      }, {
13062        type: "kern",
13063        size: sup.kern
13064      }, {
13065        type: "elem",
13066        elem: sup.elem,
13067        marginLeft: makeEm(slant)
13068      }, {
13069        type: "kern",
13070        size: options.fontMetrics().bigOpSpacing5
13071      }]
13072    }, options);
13073  } else if (sub) {
13074    var top = base.height - baseShift; // Shift the limits by the slant of the symbol. Note
13075    // that we are supposed to shift the limits by 1/2 of the slant,
13076    // but since we are centering the limits adding a full slant of
13077    // margin will shift by 1/2 that.
13078
13079    finalGroup = buildCommon.makeVList({
13080      positionType: "top",
13081      positionData: top,
13082      children: [{
13083        type: "kern",
13084        size: options.fontMetrics().bigOpSpacing5
13085      }, {
13086        type: "elem",
13087        elem: sub.elem,
13088        marginLeft: makeEm(-slant)
13089      }, {
13090        type: "kern",
13091        size: sub.kern
13092      }, {
13093        type: "elem",
13094        elem: base
13095      }]
13096    }, options);
13097  } else if (sup) {
13098    var _bottom = base.depth + baseShift;
13099
13100    finalGroup = buildCommon.makeVList({
13101      positionType: "bottom",
13102      positionData: _bottom,
13103      children: [{
13104        type: "elem",
13105        elem: base
13106      }, {
13107        type: "kern",
13108        size: sup.kern
13109      }, {
13110        type: "elem",
13111        elem: sup.elem,
13112        marginLeft: makeEm(slant)
13113      }, {
13114        type: "kern",
13115        size: options.fontMetrics().bigOpSpacing5
13116      }]
13117    }, options);
13118  } else {
13119    // This case probably shouldn't occur (this would mean the
13120    // supsub was sending us a group with no superscript or
13121    // subscript) but be safe.
13122    return base;
13123  }
13124
13125  var parts = [finalGroup];
13126
13127  if (sub && slant !== 0 && !subIsSingleCharacter) {
13128    // A negative margin-left was applied to the lower limit.
13129    // Avoid an overlap by placing a spacer on the left on the group.
13130    var spacer = buildCommon.makeSpan(["mspace"], [], options);
13131    spacer.style.marginRight = makeEm(slant);
13132    parts.unshift(spacer);
13133  }
13134
13135  return buildCommon.makeSpan(["mop", "op-limits"], parts, options);
13136};
13137;// CONCATENATED MODULE: ./src/functions/op.js
13138// Limits, symbols
13139
13140
13141
13142
13143
13144
13145
13146
13147
13148
13149
13150// Most operators have a large successor symbol, but these don't.
13151var noSuccessor = ["\\smallint"]; // NOTE: Unlike most `htmlBuilder`s, this one handles not only "op", but also
13152// "supsub" since some of them (like \int) can affect super/subscripting.
13153
13154var op_htmlBuilder = function htmlBuilder(grp, options) {
13155  // Operators are handled in the TeXbook pg. 443-444, rule 13(a).
13156  var supGroup;
13157  var subGroup;
13158  var hasLimits = false;
13159  var group;
13160
13161  if (grp.type === "supsub") {
13162    // If we have limits, supsub will pass us its group to handle. Pull
13163    // out the superscript and subscript and set the group to the op in
13164    // its base.
13165    supGroup = grp.sup;
13166    subGroup = grp.sub;
13167    group = assertNodeType(grp.base, "op");
13168    hasLimits = true;
13169  } else {
13170    group = assertNodeType(grp, "op");
13171  }
13172
13173  var style = options.style;
13174  var large = false;
13175
13176  if (style.size === src_Style.DISPLAY.size && group.symbol && !utils.contains(noSuccessor, group.name)) {
13177    // Most symbol operators get larger in displaystyle (rule 13)
13178    large = true;
13179  }
13180
13181  var base;
13182
13183  if (group.symbol) {
13184    // If this is a symbol, create the symbol.
13185    var fontName = large ? "Size2-Regular" : "Size1-Regular";
13186    var stash = "";
13187
13188    if (group.name === "\\oiint" || group.name === "\\oiiint") {
13189      // No font glyphs yet, so use a glyph w/o the oval.
13190      // TODO: When font glyphs are available, delete this code.
13191      stash = group.name.substr(1);
13192      group.name = stash === "oiint" ? "\\iint" : "\\iiint";
13193    }
13194
13195    base = buildCommon.makeSymbol(group.name, fontName, "math", options, ["mop", "op-symbol", large ? "large-op" : "small-op"]);
13196
13197    if (stash.length > 0) {
13198      // We're in \oiint or \oiiint. Overlay the oval.
13199      // TODO: When font glyphs are available, delete this code.
13200      var italic = base.italic;
13201      var oval = buildCommon.staticSvg(stash + "Size" + (large ? "2" : "1"), options);
13202      base = buildCommon.makeVList({
13203        positionType: "individualShift",
13204        children: [{
13205          type: "elem",
13206          elem: base,
13207          shift: 0
13208        }, {
13209          type: "elem",
13210          elem: oval,
13211          shift: large ? 0.08 : 0
13212        }]
13213      }, options);
13214      group.name = "\\" + stash;
13215      base.classes.unshift("mop"); // $FlowFixMe
13216
13217      base.italic = italic;
13218    }
13219  } else if (group.body) {
13220    // If this is a list, compose that list.
13221    var inner = buildExpression(group.body, options, true);
13222
13223    if (inner.length === 1 && inner[0] instanceof SymbolNode) {
13224      base = inner[0];
13225      base.classes[0] = "mop"; // replace old mclass
13226    } else {
13227      base = buildCommon.makeSpan(["mop"], inner, options);
13228    }
13229  } else {
13230    // Otherwise, this is a text operator. Build the text from the
13231    // operator's name.
13232    var output = [];
13233
13234    for (var i = 1; i < group.name.length; i++) {
13235      output.push(buildCommon.mathsym(group.name[i], group.mode, options));
13236    }
13237
13238    base = buildCommon.makeSpan(["mop"], output, options);
13239  } // If content of op is a single symbol, shift it vertically.
13240
13241
13242  var baseShift = 0;
13243  var slant = 0;
13244
13245  if ((base instanceof SymbolNode || group.name === "\\oiint" || group.name === "\\oiiint") && !group.suppressBaseShift) {
13246    // We suppress the shift of the base of \overset and \underset. Otherwise,
13247    // shift the symbol so its center lies on the axis (rule 13). It
13248    // appears that our fonts have the centers of the symbols already
13249    // almost on the axis, so these numbers are very small. Note we
13250    // don't actually apply this here, but instead it is used either in
13251    // the vlist creation or separately when there are no limits.
13252    baseShift = (base.height - base.depth) / 2 - options.fontMetrics().axisHeight; // The slant of the symbol is just its italic correction.
13253    // $FlowFixMe
13254
13255    slant = base.italic;
13256  }
13257
13258  if (hasLimits) {
13259    return assembleSupSub(base, supGroup, subGroup, options, style, slant, baseShift);
13260  } else {
13261    if (baseShift) {
13262      base.style.position = "relative";
13263      base.style.top = makeEm(baseShift);
13264    }
13265
13266    return base;
13267  }
13268};
13269
13270var op_mathmlBuilder = function mathmlBuilder(group, options) {
13271  var node;
13272
13273  if (group.symbol) {
13274    // This is a symbol. Just add the symbol.
13275    node = new MathNode("mo", [makeText(group.name, group.mode)]);
13276
13277    if (utils.contains(noSuccessor, group.name)) {
13278      node.setAttribute("largeop", "false");
13279    }
13280  } else if (group.body) {
13281    // This is an operator with children. Add them.
13282    node = new MathNode("mo", buildMathML_buildExpression(group.body, options));
13283  } else {
13284    // This is a text operator. Add all of the characters from the
13285    // operator's name.
13286    node = new MathNode("mi", [new TextNode(group.name.slice(1))]); // Append an <mo>&ApplyFunction;</mo>.
13287    // ref: https://www.w3.org/TR/REC-MathML/chap3_2.html#sec3.2.4
13288
13289    var operator = new MathNode("mo", [makeText("\u2061", "text")]);
13290
13291    if (group.parentIsSupSub) {
13292      node = new MathNode("mrow", [node, operator]);
13293    } else {
13294      node = newDocumentFragment([node, operator]);
13295    }
13296  }
13297
13298  return node;
13299};
13300
13301var singleCharBigOps = {
13302  "\u220F": "\\prod",
13303  "\u2210": "\\coprod",
13304  "\u2211": "\\sum",
13305  "\u22C0": "\\bigwedge",
13306  "\u22C1": "\\bigvee",
13307  "\u22C2": "\\bigcap",
13308  "\u22C3": "\\bigcup",
13309  "\u2A00": "\\bigodot",
13310  "\u2A01": "\\bigoplus",
13311  "\u2A02": "\\bigotimes",
13312  "\u2A04": "\\biguplus",
13313  "\u2A06": "\\bigsqcup"
13314};
13315defineFunction({
13316  type: "op",
13317  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"],
13318  props: {
13319    numArgs: 0
13320  },
13321  handler: function handler(_ref, args) {
13322    var parser = _ref.parser,
13323        funcName = _ref.funcName;
13324    var fName = funcName;
13325
13326    if (fName.length === 1) {
13327      fName = singleCharBigOps[fName];
13328    }
13329
13330    return {
13331      type: "op",
13332      mode: parser.mode,
13333      limits: true,
13334      parentIsSupSub: false,
13335      symbol: true,
13336      name: fName
13337    };
13338  },
13339  htmlBuilder: op_htmlBuilder,
13340  mathmlBuilder: op_mathmlBuilder
13341}); // Note: calling defineFunction with a type that's already been defined only
13342// works because the same htmlBuilder and mathmlBuilder are being used.
13343
13344defineFunction({
13345  type: "op",
13346  names: ["\\mathop"],
13347  props: {
13348    numArgs: 1,
13349    primitive: true
13350  },
13351  handler: function handler(_ref2, args) {
13352    var parser = _ref2.parser;
13353    var body = args[0];
13354    return {
13355      type: "op",
13356      mode: parser.mode,
13357      limits: false,
13358      parentIsSupSub: false,
13359      symbol: false,
13360      body: ordargument(body)
13361    };
13362  },
13363  htmlBuilder: op_htmlBuilder,
13364  mathmlBuilder: op_mathmlBuilder
13365}); // There are 2 flags for operators; whether they produce limits in
13366// displaystyle, and whether they are symbols and should grow in
13367// displaystyle. These four groups cover the four possible choices.
13368
13369var singleCharIntegrals = {
13370  "\u222B": "\\int",
13371  "\u222C": "\\iint",
13372  "\u222D": "\\iiint",
13373  "\u222E": "\\oint",
13374  "\u222F": "\\oiint",
13375  "\u2230": "\\oiiint"
13376}; // No limits, not symbols
13377
13378defineFunction({
13379  type: "op",
13380  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"],
13381  props: {
13382    numArgs: 0
13383  },
13384  handler: function handler(_ref3) {
13385    var parser = _ref3.parser,
13386        funcName = _ref3.funcName;
13387    return {
13388      type: "op",
13389      mode: parser.mode,
13390      limits: false,
13391      parentIsSupSub: false,
13392      symbol: false,
13393      name: funcName
13394    };
13395  },
13396  htmlBuilder: op_htmlBuilder,
13397  mathmlBuilder: op_mathmlBuilder
13398}); // Limits, not symbols
13399
13400defineFunction({
13401  type: "op",
13402  names: ["\\det", "\\gcd", "\\inf", "\\lim", "\\max", "\\min", "\\Pr", "\\sup"],
13403  props: {
13404    numArgs: 0
13405  },
13406  handler: function handler(_ref4) {
13407    var parser = _ref4.parser,
13408        funcName = _ref4.funcName;
13409    return {
13410      type: "op",
13411      mode: parser.mode,
13412      limits: true,
13413      parentIsSupSub: false,
13414      symbol: false,
13415      name: funcName
13416    };
13417  },
13418  htmlBuilder: op_htmlBuilder,
13419  mathmlBuilder: op_mathmlBuilder
13420}); // No limits, symbols
13421
13422defineFunction({
13423  type: "op",
13424  names: ["\\int", "\\iint", "\\iiint", "\\oint", "\\oiint", "\\oiiint", "\u222B", "\u222C", "\u222D", "\u222E", "\u222F", "\u2230"],
13425  props: {
13426    numArgs: 0
13427  },
13428  handler: function handler(_ref5) {
13429    var parser = _ref5.parser,
13430        funcName = _ref5.funcName;
13431    var fName = funcName;
13432
13433    if (fName.length === 1) {
13434      fName = singleCharIntegrals[fName];
13435    }
13436
13437    return {
13438      type: "op",
13439      mode: parser.mode,
13440      limits: false,
13441      parentIsSupSub: false,
13442      symbol: true,
13443      name: fName
13444    };
13445  },
13446  htmlBuilder: op_htmlBuilder,
13447  mathmlBuilder: op_mathmlBuilder
13448});
13449;// CONCATENATED MODULE: ./src/functions/operatorname.js
13450
13451
13452
13453
13454
13455
13456
13457
13458
13459// NOTE: Unlike most `htmlBuilder`s, this one handles not only
13460// "operatorname", but also  "supsub" since \operatorname* can
13461// affect super/subscripting.
13462var operatorname_htmlBuilder = function htmlBuilder(grp, options) {
13463  // Operators are handled in the TeXbook pg. 443-444, rule 13(a).
13464  var supGroup;
13465  var subGroup;
13466  var hasLimits = false;
13467  var group;
13468
13469  if (grp.type === "supsub") {
13470    // If we have limits, supsub will pass us its group to handle. Pull
13471    // out the superscript and subscript and set the group to the op in
13472    // its base.
13473    supGroup = grp.sup;
13474    subGroup = grp.sub;
13475    group = assertNodeType(grp.base, "operatorname");
13476    hasLimits = true;
13477  } else {
13478    group = assertNodeType(grp, "operatorname");
13479  }
13480
13481  var base;
13482
13483  if (group.body.length > 0) {
13484    var body = group.body.map(function (child) {
13485      // $FlowFixMe: Check if the node has a string `text` property.
13486      var childText = child.text;
13487
13488      if (typeof childText === "string") {
13489        return {
13490          type: "textord",
13491          mode: child.mode,
13492          text: childText
13493        };
13494      } else {
13495        return child;
13496      }
13497    }); // Consolidate function names into symbol characters.
13498
13499    var expression = buildExpression(body, options.withFont("mathrm"), true);
13500
13501    for (var i = 0; i < expression.length; i++) {
13502      var child = expression[i];
13503
13504      if (child instanceof SymbolNode) {
13505        // Per amsopn package,
13506        // change minus to hyphen and \ast to asterisk
13507        child.text = child.text.replace(/\u2212/, "-").replace(/\u2217/, "*");
13508      }
13509    }
13510
13511    base = buildCommon.makeSpan(["mop"], expression, options);
13512  } else {
13513    base = buildCommon.makeSpan(["mop"], [], options);
13514  }
13515
13516  if (hasLimits) {
13517    return assembleSupSub(base, supGroup, subGroup, options, options.style, 0, 0);
13518  } else {
13519    return base;
13520  }
13521};
13522
13523var operatorname_mathmlBuilder = function mathmlBuilder(group, options) {
13524  // The steps taken here are similar to the html version.
13525  var expression = buildMathML_buildExpression(group.body, options.withFont("mathrm")); // Is expression a string or has it something like a fraction?
13526
13527  var isAllString = true; // default
13528
13529  for (var i = 0; i < expression.length; i++) {
13530    var node = expression[i];
13531
13532    if (node instanceof mathMLTree.SpaceNode) {// Do nothing
13533    } else if (node instanceof mathMLTree.MathNode) {
13534      switch (node.type) {
13535        case "mi":
13536        case "mn":
13537        case "ms":
13538        case "mspace":
13539        case "mtext":
13540          break;
13541        // Do nothing yet.
13542
13543        case "mo":
13544          {
13545            var child = node.children[0];
13546
13547            if (node.children.length === 1 && child instanceof mathMLTree.TextNode) {
13548              child.text = child.text.replace(/\u2212/, "-").replace(/\u2217/, "*");
13549            } else {
13550              isAllString = false;
13551            }
13552
13553            break;
13554          }
13555
13556        default:
13557          isAllString = false;
13558      }
13559    } else {
13560      isAllString = false;
13561    }
13562  }
13563
13564  if (isAllString) {
13565    // Write a single TextNode instead of multiple nested tags.
13566    var word = expression.map(function (node) {
13567      return node.toText();
13568    }).join("");
13569    expression = [new mathMLTree.TextNode(word)];
13570  }
13571
13572  var identifier = new mathMLTree.MathNode("mi", expression);
13573  identifier.setAttribute("mathvariant", "normal"); // \u2061 is the same as &ApplyFunction;
13574  // ref: https://www.w3schools.com/charsets/ref_html_entities_a.asp
13575
13576  var operator = new mathMLTree.MathNode("mo", [makeText("\u2061", "text")]);
13577
13578  if (group.parentIsSupSub) {
13579    return new mathMLTree.MathNode("mrow", [identifier, operator]);
13580  } else {
13581    return mathMLTree.newDocumentFragment([identifier, operator]);
13582  }
13583}; // \operatorname
13584// amsopn.dtx: \mathop{#1\kern\z@\operator@font#3}\newmcodes@
13585
13586
13587defineFunction({
13588  type: "operatorname",
13589  names: ["\\operatorname@", "\\operatornamewithlimits"],
13590  props: {
13591    numArgs: 1
13592  },
13593  handler: function handler(_ref, args) {
13594    var parser = _ref.parser,
13595        funcName = _ref.funcName;
13596    var body = args[0];
13597    return {
13598      type: "operatorname",
13599      mode: parser.mode,
13600      body: ordargument(body),
13601      alwaysHandleSupSub: funcName === "\\operatornamewithlimits",
13602      limits: false,
13603      parentIsSupSub: false
13604    };
13605  },
13606  htmlBuilder: operatorname_htmlBuilder,
13607  mathmlBuilder: operatorname_mathmlBuilder
13608});
13609defineMacro("\\operatorname", "\\@ifstar\\operatornamewithlimits\\operatorname@");
13610;// CONCATENATED MODULE: ./src/functions/ordgroup.js
13611
13612
13613
13614
13615defineFunctionBuilders({
13616  type: "ordgroup",
13617  htmlBuilder: function htmlBuilder(group, options) {
13618    if (group.semisimple) {
13619      return buildCommon.makeFragment(buildExpression(group.body, options, false));
13620    }
13621
13622    return buildCommon.makeSpan(["mord"], buildExpression(group.body, options, true), options);
13623  },
13624  mathmlBuilder: function mathmlBuilder(group, options) {
13625    return buildExpressionRow(group.body, options, true);
13626  }
13627});
13628;// CONCATENATED MODULE: ./src/functions/overline.js
13629
13630
13631
13632
13633
13634defineFunction({
13635  type: "overline",
13636  names: ["\\overline"],
13637  props: {
13638    numArgs: 1
13639  },
13640  handler: function handler(_ref, args) {
13641    var parser = _ref.parser;
13642    var body = args[0];
13643    return {
13644      type: "overline",
13645      mode: parser.mode,
13646      body: body
13647    };
13648  },
13649  htmlBuilder: function htmlBuilder(group, options) {
13650    // Overlines are handled in the TeXbook pg 443, Rule 9.
13651    // Build the inner group in the cramped style.
13652    var innerGroup = buildGroup(group.body, options.havingCrampedStyle()); // Create the line above the body
13653
13654    var line = buildCommon.makeLineSpan("overline-line", options); // Generate the vlist, with the appropriate kerns
13655
13656    var defaultRuleThickness = options.fontMetrics().defaultRuleThickness;
13657    var vlist = buildCommon.makeVList({
13658      positionType: "firstBaseline",
13659      children: [{
13660        type: "elem",
13661        elem: innerGroup
13662      }, {
13663        type: "kern",
13664        size: 3 * defaultRuleThickness
13665      }, {
13666        type: "elem",
13667        elem: line
13668      }, {
13669        type: "kern",
13670        size: defaultRuleThickness
13671      }]
13672    }, options);
13673    return buildCommon.makeSpan(["mord", "overline"], [vlist], options);
13674  },
13675  mathmlBuilder: function mathmlBuilder(group, options) {
13676    var operator = new mathMLTree.MathNode("mo", [new mathMLTree.TextNode("\u203E")]);
13677    operator.setAttribute("stretchy", "true");
13678    var node = new mathMLTree.MathNode("mover", [buildMathML_buildGroup(group.body, options), operator]);
13679    node.setAttribute("accent", "true");
13680    return node;
13681  }
13682});
13683;// CONCATENATED MODULE: ./src/functions/phantom.js
13684
13685
13686
13687
13688
13689defineFunction({
13690  type: "phantom",
13691  names: ["\\phantom"],
13692  props: {
13693    numArgs: 1,
13694    allowedInText: true
13695  },
13696  handler: function handler(_ref, args) {
13697    var parser = _ref.parser;
13698    var body = args[0];
13699    return {
13700      type: "phantom",
13701      mode: parser.mode,
13702      body: ordargument(body)
13703    };
13704  },
13705  htmlBuilder: function htmlBuilder(group, options) {
13706    var elements = buildExpression(group.body, options.withPhantom(), false); // \phantom isn't supposed to affect the elements it contains.
13707    // See "color" for more details.
13708
13709    return buildCommon.makeFragment(elements);
13710  },
13711  mathmlBuilder: function mathmlBuilder(group, options) {
13712    var inner = buildMathML_buildExpression(group.body, options);
13713    return new mathMLTree.MathNode("mphantom", inner);
13714  }
13715});
13716defineFunction({
13717  type: "hphantom",
13718  names: ["\\hphantom"],
13719  props: {
13720    numArgs: 1,
13721    allowedInText: true
13722  },
13723  handler: function handler(_ref2, args) {
13724    var parser = _ref2.parser;
13725    var body = args[0];
13726    return {
13727      type: "hphantom",
13728      mode: parser.mode,
13729      body: body
13730    };
13731  },
13732  htmlBuilder: function htmlBuilder(group, options) {
13733    var node = buildCommon.makeSpan([], [buildGroup(group.body, options.withPhantom())]);
13734    node.height = 0;
13735    node.depth = 0;
13736
13737    if (node.children) {
13738      for (var i = 0; i < node.children.length; i++) {
13739        node.children[i].height = 0;
13740        node.children[i].depth = 0;
13741      }
13742    } // See smash for comment re: use of makeVList
13743
13744
13745    node = buildCommon.makeVList({
13746      positionType: "firstBaseline",
13747      children: [{
13748        type: "elem",
13749        elem: node
13750      }]
13751    }, options); // For spacing, TeX treats \smash as a math group (same spacing as ord).
13752
13753    return buildCommon.makeSpan(["mord"], [node], options);
13754  },
13755  mathmlBuilder: function mathmlBuilder(group, options) {
13756    var inner = buildMathML_buildExpression(ordargument(group.body), options);
13757    var phantom = new mathMLTree.MathNode("mphantom", inner);
13758    var node = new mathMLTree.MathNode("mpadded", [phantom]);
13759    node.setAttribute("height", "0px");
13760    node.setAttribute("depth", "0px");
13761    return node;
13762  }
13763});
13764defineFunction({
13765  type: "vphantom",
13766  names: ["\\vphantom"],
13767  props: {
13768    numArgs: 1,
13769    allowedInText: true
13770  },
13771  handler: function handler(_ref3, args) {
13772    var parser = _ref3.parser;
13773    var body = args[0];
13774    return {
13775      type: "vphantom",
13776      mode: parser.mode,
13777      body: body
13778    };
13779  },
13780  htmlBuilder: function htmlBuilder(group, options) {
13781    var inner = buildCommon.makeSpan(["inner"], [buildGroup(group.body, options.withPhantom())]);
13782    var fix = buildCommon.makeSpan(["fix"], []);
13783    return buildCommon.makeSpan(["mord", "rlap"], [inner, fix], options);
13784  },
13785  mathmlBuilder: function mathmlBuilder(group, options) {
13786    var inner = buildMathML_buildExpression(ordargument(group.body), options);
13787    var phantom = new mathMLTree.MathNode("mphantom", inner);
13788    var node = new mathMLTree.MathNode("mpadded", [phantom]);
13789    node.setAttribute("width", "0px");
13790    return node;
13791  }
13792});
13793;// CONCATENATED MODULE: ./src/functions/raisebox.js
13794
13795
13796
13797
13798
13799
13800 // Box manipulation
13801
13802defineFunction({
13803  type: "raisebox",
13804  names: ["\\raisebox"],
13805  props: {
13806    numArgs: 2,
13807    argTypes: ["size", "hbox"],
13808    allowedInText: true
13809  },
13810  handler: function handler(_ref, args) {
13811    var parser = _ref.parser;
13812    var amount = assertNodeType(args[0], "size").value;
13813    var body = args[1];
13814    return {
13815      type: "raisebox",
13816      mode: parser.mode,
13817      dy: amount,
13818      body: body
13819    };
13820  },
13821  htmlBuilder: function htmlBuilder(group, options) {
13822    var body = buildGroup(group.body, options);
13823    var dy = calculateSize(group.dy, options);
13824    return buildCommon.makeVList({
13825      positionType: "shift",
13826      positionData: -dy,
13827      children: [{
13828        type: "elem",
13829        elem: body
13830      }]
13831    }, options);
13832  },
13833  mathmlBuilder: function mathmlBuilder(group, options) {
13834    var node = new mathMLTree.MathNode("mpadded", [buildMathML_buildGroup(group.body, options)]);
13835    var dy = group.dy.number + group.dy.unit;
13836    node.setAttribute("voffset", dy);
13837    return node;
13838  }
13839});
13840;// CONCATENATED MODULE: ./src/functions/relax.js
13841
13842defineFunction({
13843  type: "internal",
13844  names: ["\\relax"],
13845  props: {
13846    numArgs: 0,
13847    allowedInText: true
13848  },
13849  handler: function handler(_ref) {
13850    var parser = _ref.parser;
13851    return {
13852      type: "internal",
13853      mode: parser.mode
13854    };
13855  }
13856});
13857;// CONCATENATED MODULE: ./src/functions/rule.js
13858
13859
13860
13861
13862
13863defineFunction({
13864  type: "rule",
13865  names: ["\\rule"],
13866  props: {
13867    numArgs: 2,
13868    numOptionalArgs: 1,
13869    argTypes: ["size", "size", "size"]
13870  },
13871  handler: function handler(_ref, args, optArgs) {
13872    var parser = _ref.parser;
13873    var shift = optArgs[0];
13874    var width = assertNodeType(args[0], "size");
13875    var height = assertNodeType(args[1], "size");
13876    return {
13877      type: "rule",
13878      mode: parser.mode,
13879      shift: shift && assertNodeType(shift, "size").value,
13880      width: width.value,
13881      height: height.value
13882    };
13883  },
13884  htmlBuilder: function htmlBuilder(group, options) {
13885    // Make an empty span for the rule
13886    var rule = buildCommon.makeSpan(["mord", "rule"], [], options); // Calculate the shift, width, and height of the rule, and account for units
13887
13888    var width = calculateSize(group.width, options);
13889    var height = calculateSize(group.height, options);
13890    var shift = group.shift ? calculateSize(group.shift, options) : 0; // Style the rule to the right size
13891
13892    rule.style.borderRightWidth = makeEm(width);
13893    rule.style.borderTopWidth = makeEm(height);
13894    rule.style.bottom = makeEm(shift); // Record the height and width
13895
13896    rule.width = width;
13897    rule.height = height + shift;
13898    rule.depth = -shift; // Font size is the number large enough that the browser will
13899    // reserve at least `absHeight` space above the baseline.
13900    // The 1.125 factor was empirically determined
13901
13902    rule.maxFontSize = height * 1.125 * options.sizeMultiplier;
13903    return rule;
13904  },
13905  mathmlBuilder: function mathmlBuilder(group, options) {
13906    var width = calculateSize(group.width, options);
13907    var height = calculateSize(group.height, options);
13908    var shift = group.shift ? calculateSize(group.shift, options) : 0;
13909    var color = options.color && options.getColor() || "black";
13910    var rule = new mathMLTree.MathNode("mspace");
13911    rule.setAttribute("mathbackground", color);
13912    rule.setAttribute("width", makeEm(width));
13913    rule.setAttribute("height", makeEm(height));
13914    var wrapper = new mathMLTree.MathNode("mpadded", [rule]);
13915
13916    if (shift >= 0) {
13917      wrapper.setAttribute("height", makeEm(shift));
13918    } else {
13919      wrapper.setAttribute("height", makeEm(shift));
13920      wrapper.setAttribute("depth", makeEm(-shift));
13921    }
13922
13923    wrapper.setAttribute("voffset", makeEm(shift));
13924    return wrapper;
13925  }
13926});
13927;// CONCATENATED MODULE: ./src/functions/sizing.js
13928
13929
13930
13931
13932
13933
13934function sizingGroup(value, options, baseOptions) {
13935  var inner = buildExpression(value, options, false);
13936  var multiplier = options.sizeMultiplier / baseOptions.sizeMultiplier; // Add size-resetting classes to the inner list and set maxFontSize
13937  // manually. Handle nested size changes.
13938
13939  for (var i = 0; i < inner.length; i++) {
13940    var pos = inner[i].classes.indexOf("sizing");
13941
13942    if (pos < 0) {
13943      Array.prototype.push.apply(inner[i].classes, options.sizingClasses(baseOptions));
13944    } else if (inner[i].classes[pos + 1] === "reset-size" + options.size) {
13945      // This is a nested size change: e.g., inner[i] is the "b" in
13946      // `\Huge a \small b`. Override the old size (the `reset-` class)
13947      // but not the new size.
13948      inner[i].classes[pos + 1] = "reset-size" + baseOptions.size;
13949    }
13950
13951    inner[i].height *= multiplier;
13952    inner[i].depth *= multiplier;
13953  }
13954
13955  return buildCommon.makeFragment(inner);
13956}
13957var sizeFuncs = ["\\tiny", "\\sixptsize", "\\scriptsize", "\\footnotesize", "\\small", "\\normalsize", "\\large", "\\Large", "\\LARGE", "\\huge", "\\Huge"];
13958var sizing_htmlBuilder = function htmlBuilder(group, options) {
13959  // Handle sizing operators like \Huge. Real TeX doesn't actually allow
13960  // these functions inside of math expressions, so we do some special
13961  // handling.
13962  var newOptions = options.havingSize(group.size);
13963  return sizingGroup(group.body, newOptions, options);
13964};
13965defineFunction({
13966  type: "sizing",
13967  names: sizeFuncs,
13968  props: {
13969    numArgs: 0,
13970    allowedInText: true
13971  },
13972  handler: function handler(_ref, args) {
13973    var breakOnTokenText = _ref.breakOnTokenText,
13974        funcName = _ref.funcName,
13975        parser = _ref.parser;
13976    var body = parser.parseExpression(false, breakOnTokenText);
13977    return {
13978      type: "sizing",
13979      mode: parser.mode,
13980      // Figure out what size to use based on the list of functions above
13981      size: sizeFuncs.indexOf(funcName) + 1,
13982      body: body
13983    };
13984  },
13985  htmlBuilder: sizing_htmlBuilder,
13986  mathmlBuilder: function mathmlBuilder(group, options) {
13987    var newOptions = options.havingSize(group.size);
13988    var inner = buildMathML_buildExpression(group.body, newOptions);
13989    var node = new mathMLTree.MathNode("mstyle", inner); // TODO(emily): This doesn't produce the correct size for nested size
13990    // changes, because we don't keep state of what style we're currently
13991    // in, so we can't reset the size to normal before changing it.  Now
13992    // that we're passing an options parameter we should be able to fix
13993    // this.
13994
13995    node.setAttribute("mathsize", makeEm(newOptions.sizeMultiplier));
13996    return node;
13997  }
13998});
13999;// CONCATENATED MODULE: ./src/functions/smash.js
14000// smash, with optional [tb], as in AMS
14001
14002
14003
14004
14005
14006
14007defineFunction({
14008  type: "smash",
14009  names: ["\\smash"],
14010  props: {
14011    numArgs: 1,
14012    numOptionalArgs: 1,
14013    allowedInText: true
14014  },
14015  handler: function handler(_ref, args, optArgs) {
14016    var parser = _ref.parser;
14017    var smashHeight = false;
14018    var smashDepth = false;
14019    var tbArg = optArgs[0] && assertNodeType(optArgs[0], "ordgroup");
14020
14021    if (tbArg) {
14022      // Optional [tb] argument is engaged.
14023      // ref: amsmath: \renewcommand{\smash}[1][tb]{%
14024      //               def\mb@t{\ht}\def\mb@b{\dp}\def\mb@tb{\ht\z@\z@\dp}%
14025      var letter = "";
14026
14027      for (var i = 0; i < tbArg.body.length; ++i) {
14028        var node = tbArg.body[i]; // $FlowFixMe: Not every node type has a `text` property.
14029
14030        letter = node.text;
14031
14032        if (letter === "t") {
14033          smashHeight = true;
14034        } else if (letter === "b") {
14035          smashDepth = true;
14036        } else {
14037          smashHeight = false;
14038          smashDepth = false;
14039          break;
14040        }
14041      }
14042    } else {
14043      smashHeight = true;
14044      smashDepth = true;
14045    }
14046
14047    var body = args[0];
14048    return {
14049      type: "smash",
14050      mode: parser.mode,
14051      body: body,
14052      smashHeight: smashHeight,
14053      smashDepth: smashDepth
14054    };
14055  },
14056  htmlBuilder: function htmlBuilder(group, options) {
14057    var node = buildCommon.makeSpan([], [buildGroup(group.body, options)]);
14058
14059    if (!group.smashHeight && !group.smashDepth) {
14060      return node;
14061    }
14062
14063    if (group.smashHeight) {
14064      node.height = 0; // In order to influence makeVList, we have to reset the children.
14065
14066      if (node.children) {
14067        for (var i = 0; i < node.children.length; i++) {
14068          node.children[i].height = 0;
14069        }
14070      }
14071    }
14072
14073    if (group.smashDepth) {
14074      node.depth = 0;
14075
14076      if (node.children) {
14077        for (var _i = 0; _i < node.children.length; _i++) {
14078          node.children[_i].depth = 0;
14079        }
14080      }
14081    } // At this point, we've reset the TeX-like height and depth values.
14082    // But the span still has an HTML line height.
14083    // makeVList applies "display: table-cell", which prevents the browser
14084    // from acting on that line height. So we'll call makeVList now.
14085
14086
14087    var smashedNode = buildCommon.makeVList({
14088      positionType: "firstBaseline",
14089      children: [{
14090        type: "elem",
14091        elem: node
14092      }]
14093    }, options); // For spacing, TeX treats \hphantom as a math group (same spacing as ord).
14094
14095    return buildCommon.makeSpan(["mord"], [smashedNode], options);
14096  },
14097  mathmlBuilder: function mathmlBuilder(group, options) {
14098    var node = new mathMLTree.MathNode("mpadded", [buildMathML_buildGroup(group.body, options)]);
14099
14100    if (group.smashHeight) {
14101      node.setAttribute("height", "0px");
14102    }
14103
14104    if (group.smashDepth) {
14105      node.setAttribute("depth", "0px");
14106    }
14107
14108    return node;
14109  }
14110});
14111;// CONCATENATED MODULE: ./src/functions/sqrt.js
14112
14113
14114
14115
14116
14117
14118
14119
14120defineFunction({
14121  type: "sqrt",
14122  names: ["\\sqrt"],
14123  props: {
14124    numArgs: 1,
14125    numOptionalArgs: 1
14126  },
14127  handler: function handler(_ref, args, optArgs) {
14128    var parser = _ref.parser;
14129    var index = optArgs[0];
14130    var body = args[0];
14131    return {
14132      type: "sqrt",
14133      mode: parser.mode,
14134      body: body,
14135      index: index
14136    };
14137  },
14138  htmlBuilder: function htmlBuilder(group, options) {
14139    // Square roots are handled in the TeXbook pg. 443, Rule 11.
14140    // First, we do the same steps as in overline to build the inner group
14141    // and line
14142    var inner = buildGroup(group.body, options.havingCrampedStyle());
14143
14144    if (inner.height === 0) {
14145      // Render a small surd.
14146      inner.height = options.fontMetrics().xHeight;
14147    } // Some groups can return document fragments.  Handle those by wrapping
14148    // them in a span.
14149
14150
14151    inner = buildCommon.wrapFragment(inner, options); // Calculate the minimum size for the \surd delimiter
14152
14153    var metrics = options.fontMetrics();
14154    var theta = metrics.defaultRuleThickness;
14155    var phi = theta;
14156
14157    if (options.style.id < src_Style.TEXT.id) {
14158      phi = options.fontMetrics().xHeight;
14159    } // Calculate the clearance between the body and line
14160
14161
14162    var lineClearance = theta + phi / 4;
14163    var minDelimiterHeight = inner.height + inner.depth + lineClearance + theta; // Create a sqrt SVG of the required minimum size
14164
14165    var _delimiter$sqrtImage = delimiter.sqrtImage(minDelimiterHeight, options),
14166        img = _delimiter$sqrtImage.span,
14167        ruleWidth = _delimiter$sqrtImage.ruleWidth,
14168        advanceWidth = _delimiter$sqrtImage.advanceWidth;
14169
14170    var delimDepth = img.height - ruleWidth; // Adjust the clearance based on the delimiter size
14171
14172    if (delimDepth > inner.height + inner.depth + lineClearance) {
14173      lineClearance = (lineClearance + delimDepth - inner.height - inner.depth) / 2;
14174    } // Shift the sqrt image
14175
14176
14177    var imgShift = img.height - inner.height - lineClearance - ruleWidth;
14178    inner.style.paddingLeft = makeEm(advanceWidth); // Overlay the image and the argument.
14179
14180    var body = buildCommon.makeVList({
14181      positionType: "firstBaseline",
14182      children: [{
14183        type: "elem",
14184        elem: inner,
14185        wrapperClasses: ["svg-align"]
14186      }, {
14187        type: "kern",
14188        size: -(inner.height + imgShift)
14189      }, {
14190        type: "elem",
14191        elem: img
14192      }, {
14193        type: "kern",
14194        size: ruleWidth
14195      }]
14196    }, options);
14197
14198    if (!group.index) {
14199      return buildCommon.makeSpan(["mord", "sqrt"], [body], options);
14200    } else {
14201      // Handle the optional root index
14202      // The index is always in scriptscript style
14203      var newOptions = options.havingStyle(src_Style.SCRIPTSCRIPT);
14204      var rootm = buildGroup(group.index, newOptions, options); // The amount the index is shifted by. This is taken from the TeX
14205      // source, in the definition of `\r@@t`.
14206
14207      var toShift = 0.6 * (body.height - body.depth); // Build a VList with the superscript shifted up correctly
14208
14209      var rootVList = buildCommon.makeVList({
14210        positionType: "shift",
14211        positionData: -toShift,
14212        children: [{
14213          type: "elem",
14214          elem: rootm
14215        }]
14216      }, options); // Add a class surrounding it so we can add on the appropriate
14217      // kerning
14218
14219      var rootVListWrap = buildCommon.makeSpan(["root"], [rootVList]);
14220      return buildCommon.makeSpan(["mord", "sqrt"], [rootVListWrap, body], options);
14221    }
14222  },
14223  mathmlBuilder: function mathmlBuilder(group, options) {
14224    var body = group.body,
14225        index = group.index;
14226    return index ? new mathMLTree.MathNode("mroot", [buildMathML_buildGroup(body, options), buildMathML_buildGroup(index, options)]) : new mathMLTree.MathNode("msqrt", [buildMathML_buildGroup(body, options)]);
14227  }
14228});
14229;// CONCATENATED MODULE: ./src/functions/styling.js
14230
14231
14232
14233
14234
14235var styling_styleMap = {
14236  "display": src_Style.DISPLAY,
14237  "text": src_Style.TEXT,
14238  "script": src_Style.SCRIPT,
14239  "scriptscript": src_Style.SCRIPTSCRIPT
14240};
14241defineFunction({
14242  type: "styling",
14243  names: ["\\displaystyle", "\\textstyle", "\\scriptstyle", "\\scriptscriptstyle"],
14244  props: {
14245    numArgs: 0,
14246    allowedInText: true,
14247    primitive: true
14248  },
14249  handler: function handler(_ref, args) {
14250    var breakOnTokenText = _ref.breakOnTokenText,
14251        funcName = _ref.funcName,
14252        parser = _ref.parser;
14253    // parse out the implicit body
14254    var body = parser.parseExpression(true, breakOnTokenText); // TODO: Refactor to avoid duplicating styleMap in multiple places (e.g.
14255    // here and in buildHTML and de-dupe the enumeration of all the styles).
14256    // $FlowFixMe: The names above exactly match the styles.
14257
14258    var style = funcName.slice(1, funcName.length - 5);
14259    return {
14260      type: "styling",
14261      mode: parser.mode,
14262      // Figure out what style to use by pulling out the style from
14263      // the function name
14264      style: style,
14265      body: body
14266    };
14267  },
14268  htmlBuilder: function htmlBuilder(group, options) {
14269    // Style changes are handled in the TeXbook on pg. 442, Rule 3.
14270    var newStyle = styling_styleMap[group.style];
14271    var newOptions = options.havingStyle(newStyle).withFont('');
14272    return sizingGroup(group.body, newOptions, options);
14273  },
14274  mathmlBuilder: function mathmlBuilder(group, options) {
14275    // Figure out what style we're changing to.
14276    var newStyle = styling_styleMap[group.style];
14277    var newOptions = options.havingStyle(newStyle);
14278    var inner = buildMathML_buildExpression(group.body, newOptions);
14279    var node = new mathMLTree.MathNode("mstyle", inner);
14280    var styleAttributes = {
14281      "display": ["0", "true"],
14282      "text": ["0", "false"],
14283      "script": ["1", "false"],
14284      "scriptscript": ["2", "false"]
14285    };
14286    var attr = styleAttributes[group.style];
14287    node.setAttribute("scriptlevel", attr[0]);
14288    node.setAttribute("displaystyle", attr[1]);
14289    return node;
14290  }
14291});
14292;// CONCATENATED MODULE: ./src/functions/supsub.js
14293
14294
14295
14296
14297
14298
14299
14300
14301
14302
14303
14304
14305
14306
14307/**
14308 * Sometimes, groups perform special rules when they have superscripts or
14309 * subscripts attached to them. This function lets the `supsub` group know that
14310 * Sometimes, groups perform special rules when they have superscripts or
14311 * its inner element should handle the superscripts and subscripts instead of
14312 * handling them itself.
14313 */
14314var htmlBuilderDelegate = function htmlBuilderDelegate(group, options) {
14315  var base = group.base;
14316
14317  if (!base) {
14318    return null;
14319  } else if (base.type === "op") {
14320    // Operators handle supsubs differently when they have limits
14321    // (e.g. `\displaystyle\sum_2^3`)
14322    var delegate = base.limits && (options.style.size === src_Style.DISPLAY.size || base.alwaysHandleSupSub);
14323    return delegate ? op_htmlBuilder : null;
14324  } else if (base.type === "operatorname") {
14325    var _delegate = base.alwaysHandleSupSub && (options.style.size === src_Style.DISPLAY.size || base.limits);
14326
14327    return _delegate ? operatorname_htmlBuilder : null;
14328  } else if (base.type === "accent") {
14329    return utils.isCharacterBox(base.base) ? htmlBuilder : null;
14330  } else if (base.type === "horizBrace") {
14331    var isSup = !group.sub;
14332    return isSup === base.isOver ? horizBrace_htmlBuilder : null;
14333  } else {
14334    return null;
14335  }
14336}; // Super scripts and subscripts, whose precise placement can depend on other
14337// functions that precede them.
14338
14339
14340defineFunctionBuilders({
14341  type: "supsub",
14342  htmlBuilder: function htmlBuilder(group, options) {
14343    // Superscript and subscripts are handled in the TeXbook on page
14344    // 445-446, rules 18(a-f).
14345    // Here is where we defer to the inner group if it should handle
14346    // superscripts and subscripts itself.
14347    var builderDelegate = htmlBuilderDelegate(group, options);
14348
14349    if (builderDelegate) {
14350      return builderDelegate(group, options);
14351    }
14352
14353    var valueBase = group.base,
14354        valueSup = group.sup,
14355        valueSub = group.sub;
14356    var base = buildGroup(valueBase, options);
14357    var supm;
14358    var subm;
14359    var metrics = options.fontMetrics(); // Rule 18a
14360
14361    var supShift = 0;
14362    var subShift = 0;
14363    var isCharacterBox = valueBase && utils.isCharacterBox(valueBase);
14364
14365    if (valueSup) {
14366      var newOptions = options.havingStyle(options.style.sup());
14367      supm = buildGroup(valueSup, newOptions, options);
14368
14369      if (!isCharacterBox) {
14370        supShift = base.height - newOptions.fontMetrics().supDrop * newOptions.sizeMultiplier / options.sizeMultiplier;
14371      }
14372    }
14373
14374    if (valueSub) {
14375      var _newOptions = options.havingStyle(options.style.sub());
14376
14377      subm = buildGroup(valueSub, _newOptions, options);
14378
14379      if (!isCharacterBox) {
14380        subShift = base.depth + _newOptions.fontMetrics().subDrop * _newOptions.sizeMultiplier / options.sizeMultiplier;
14381      }
14382    } // Rule 18c
14383
14384
14385    var minSupShift;
14386
14387    if (options.style === src_Style.DISPLAY) {
14388      minSupShift = metrics.sup1;
14389    } else if (options.style.cramped) {
14390      minSupShift = metrics.sup3;
14391    } else {
14392      minSupShift = metrics.sup2;
14393    } // scriptspace is a font-size-independent size, so scale it
14394    // appropriately for use as the marginRight.
14395
14396
14397    var multiplier = options.sizeMultiplier;
14398    var marginRight = makeEm(0.5 / metrics.ptPerEm / multiplier);
14399    var marginLeft = null;
14400
14401    if (subm) {
14402      // Subscripts shouldn't be shifted by the base's italic correction.
14403      // Account for that by shifting the subscript back the appropriate
14404      // amount. Note we only do this when the base is a single symbol.
14405      var isOiint = group.base && group.base.type === "op" && group.base.name && (group.base.name === "\\oiint" || group.base.name === "\\oiiint");
14406
14407      if (base instanceof SymbolNode || isOiint) {
14408        // $FlowFixMe
14409        marginLeft = makeEm(-base.italic);
14410      }
14411    }
14412
14413    var supsub;
14414
14415    if (supm && subm) {
14416      supShift = Math.max(supShift, minSupShift, supm.depth + 0.25 * metrics.xHeight);
14417      subShift = Math.max(subShift, metrics.sub2);
14418      var ruleWidth = metrics.defaultRuleThickness; // Rule 18e
14419
14420      var maxWidth = 4 * ruleWidth;
14421
14422      if (supShift - supm.depth - (subm.height - subShift) < maxWidth) {
14423        subShift = maxWidth - (supShift - supm.depth) + subm.height;
14424        var psi = 0.8 * metrics.xHeight - (supShift - supm.depth);
14425
14426        if (psi > 0) {
14427          supShift += psi;
14428          subShift -= psi;
14429        }
14430      }
14431
14432      var vlistElem = [{
14433        type: "elem",
14434        elem: subm,
14435        shift: subShift,
14436        marginRight: marginRight,
14437        marginLeft: marginLeft
14438      }, {
14439        type: "elem",
14440        elem: supm,
14441        shift: -supShift,
14442        marginRight: marginRight
14443      }];
14444      supsub = buildCommon.makeVList({
14445        positionType: "individualShift",
14446        children: vlistElem
14447      }, options);
14448    } else if (subm) {
14449      // Rule 18b
14450      subShift = Math.max(subShift, metrics.sub1, subm.height - 0.8 * metrics.xHeight);
14451      var _vlistElem = [{
14452        type: "elem",
14453        elem: subm,
14454        marginLeft: marginLeft,
14455        marginRight: marginRight
14456      }];
14457      supsub = buildCommon.makeVList({
14458        positionType: "shift",
14459        positionData: subShift,
14460        children: _vlistElem
14461      }, options);
14462    } else if (supm) {
14463      // Rule 18c, d
14464      supShift = Math.max(supShift, minSupShift, supm.depth + 0.25 * metrics.xHeight);
14465      supsub = buildCommon.makeVList({
14466        positionType: "shift",
14467        positionData: -supShift,
14468        children: [{
14469          type: "elem",
14470          elem: supm,
14471          marginRight: marginRight
14472        }]
14473      }, options);
14474    } else {
14475      throw new Error("supsub must have either sup or sub.");
14476    } // Wrap the supsub vlist in a span.msupsub to reset text-align.
14477
14478
14479    var mclass = getTypeOfDomTree(base, "right") || "mord";
14480    return buildCommon.makeSpan([mclass], [base, buildCommon.makeSpan(["msupsub"], [supsub])], options);
14481  },
14482  mathmlBuilder: function mathmlBuilder(group, options) {
14483    // Is the inner group a relevant horizonal brace?
14484    var isBrace = false;
14485    var isOver;
14486    var isSup;
14487
14488    if (group.base && group.base.type === "horizBrace") {
14489      isSup = !!group.sup;
14490
14491      if (isSup === group.base.isOver) {
14492        isBrace = true;
14493        isOver = group.base.isOver;
14494      }
14495    }
14496
14497    if (group.base && (group.base.type === "op" || group.base.type === "operatorname")) {
14498      group.base.parentIsSupSub = true;
14499    }
14500
14501    var children = [buildMathML_buildGroup(group.base, options)];
14502
14503    if (group.sub) {
14504      children.push(buildMathML_buildGroup(group.sub, options));
14505    }
14506
14507    if (group.sup) {
14508      children.push(buildMathML_buildGroup(group.sup, options));
14509    }
14510
14511    var nodeType;
14512
14513    if (isBrace) {
14514      nodeType = isOver ? "mover" : "munder";
14515    } else if (!group.sub) {
14516      var base = group.base;
14517
14518      if (base && base.type === "op" && base.limits && (options.style === src_Style.DISPLAY || base.alwaysHandleSupSub)) {
14519        nodeType = "mover";
14520      } else if (base && base.type === "operatorname" && base.alwaysHandleSupSub && (base.limits || options.style === src_Style.DISPLAY)) {
14521        nodeType = "mover";
14522      } else {
14523        nodeType = "msup";
14524      }
14525    } else if (!group.sup) {
14526      var _base = group.base;
14527
14528      if (_base && _base.type === "op" && _base.limits && (options.style === src_Style.DISPLAY || _base.alwaysHandleSupSub)) {
14529        nodeType = "munder";
14530      } else if (_base && _base.type === "operatorname" && _base.alwaysHandleSupSub && (_base.limits || options.style === src_Style.DISPLAY)) {
14531        nodeType = "munder";
14532      } else {
14533        nodeType = "msub";
14534      }
14535    } else {
14536      var _base2 = group.base;
14537
14538      if (_base2 && _base2.type === "op" && _base2.limits && options.style === src_Style.DISPLAY) {
14539        nodeType = "munderover";
14540      } else if (_base2 && _base2.type === "operatorname" && _base2.alwaysHandleSupSub && (options.style === src_Style.DISPLAY || _base2.limits)) {
14541        nodeType = "munderover";
14542      } else {
14543        nodeType = "msubsup";
14544      }
14545    }
14546
14547    return new mathMLTree.MathNode(nodeType, children);
14548  }
14549});
14550;// CONCATENATED MODULE: ./src/functions/symbolsOp.js
14551
14552
14553
14554 // Operator ParseNodes created in Parser.js from symbol Groups in src/symbols.js.
14555
14556defineFunctionBuilders({
14557  type: "atom",
14558  htmlBuilder: function htmlBuilder(group, options) {
14559    return buildCommon.mathsym(group.text, group.mode, options, ["m" + group.family]);
14560  },
14561  mathmlBuilder: function mathmlBuilder(group, options) {
14562    var node = new mathMLTree.MathNode("mo", [makeText(group.text, group.mode)]);
14563
14564    if (group.family === "bin") {
14565      var variant = getVariant(group, options);
14566
14567      if (variant === "bold-italic") {
14568        node.setAttribute("mathvariant", variant);
14569      }
14570    } else if (group.family === "punct") {
14571      node.setAttribute("separator", "true");
14572    } else if (group.family === "open" || group.family === "close") {
14573      // Delims built here should not stretch vertically.
14574      // See delimsizing.js for stretchy delims.
14575      node.setAttribute("stretchy", "false");
14576    }
14577
14578    return node;
14579  }
14580});
14581;// CONCATENATED MODULE: ./src/functions/symbolsOrd.js
14582
14583
14584
14585
14586// "mathord" and "textord" ParseNodes created in Parser.js from symbol Groups in
14587// src/symbols.js.
14588var defaultVariant = {
14589  "mi": "italic",
14590  "mn": "normal",
14591  "mtext": "normal"
14592};
14593defineFunctionBuilders({
14594  type: "mathord",
14595  htmlBuilder: function htmlBuilder(group, options) {
14596    return buildCommon.makeOrd(group, options, "mathord");
14597  },
14598  mathmlBuilder: function mathmlBuilder(group, options) {
14599    var node = new mathMLTree.MathNode("mi", [makeText(group.text, group.mode, options)]);
14600    var variant = getVariant(group, options) || "italic";
14601
14602    if (variant !== defaultVariant[node.type]) {
14603      node.setAttribute("mathvariant", variant);
14604    }
14605
14606    return node;
14607  }
14608});
14609defineFunctionBuilders({
14610  type: "textord",
14611  htmlBuilder: function htmlBuilder(group, options) {
14612    return buildCommon.makeOrd(group, options, "textord");
14613  },
14614  mathmlBuilder: function mathmlBuilder(group, options) {
14615    var text = makeText(group.text, group.mode, options);
14616    var variant = getVariant(group, options) || "normal";
14617    var node;
14618
14619    if (group.mode === 'text') {
14620      node = new mathMLTree.MathNode("mtext", [text]);
14621    } else if (/[0-9]/.test(group.text)) {
14622      node = new mathMLTree.MathNode("mn", [text]);
14623    } else if (group.text === "\\prime") {
14624      node = new mathMLTree.MathNode("mo", [text]);
14625    } else {
14626      node = new mathMLTree.MathNode("mi", [text]);
14627    }
14628
14629    if (variant !== defaultVariant[node.type]) {
14630      node.setAttribute("mathvariant", variant);
14631    }
14632
14633    return node;
14634  }
14635});
14636;// CONCATENATED MODULE: ./src/functions/symbolsSpacing.js
14637
14638
14639
14640 // A map of CSS-based spacing functions to their CSS class.
14641
14642var cssSpace = {
14643  "\\nobreak": "nobreak",
14644  "\\allowbreak": "allowbreak"
14645}; // A lookup table to determine whether a spacing function/symbol should be
14646// treated like a regular space character.  If a symbol or command is a key
14647// in this table, then it should be a regular space character.  Furthermore,
14648// the associated value may have a `className` specifying an extra CSS class
14649// to add to the created `span`.
14650
14651var regularSpace = {
14652  " ": {},
14653  "\\ ": {},
14654  "~": {
14655    className: "nobreak"
14656  },
14657  "\\space": {},
14658  "\\nobreakspace": {
14659    className: "nobreak"
14660  }
14661}; // ParseNode<"spacing"> created in Parser.js from the "spacing" symbol Groups in
14662// src/symbols.js.
14663
14664defineFunctionBuilders({
14665  type: "spacing",
14666  htmlBuilder: function htmlBuilder(group, options) {
14667    if (regularSpace.hasOwnProperty(group.text)) {
14668      var className = regularSpace[group.text].className || ""; // Spaces are generated by adding an actual space. Each of these
14669      // things has an entry in the symbols table, so these will be turned
14670      // into appropriate outputs.
14671
14672      if (group.mode === "text") {
14673        var ord = buildCommon.makeOrd(group, options, "textord");
14674        ord.classes.push(className);
14675        return ord;
14676      } else {
14677        return buildCommon.makeSpan(["mspace", className], [buildCommon.mathsym(group.text, group.mode, options)], options);
14678      }
14679    } else if (cssSpace.hasOwnProperty(group.text)) {
14680      // Spaces based on just a CSS class.
14681      return buildCommon.makeSpan(["mspace", cssSpace[group.text]], [], options);
14682    } else {
14683      throw new src_ParseError("Unknown type of space \"" + group.text + "\"");
14684    }
14685  },
14686  mathmlBuilder: function mathmlBuilder(group, options) {
14687    var node;
14688
14689    if (regularSpace.hasOwnProperty(group.text)) {
14690      node = new mathMLTree.MathNode("mtext", [new mathMLTree.TextNode("\xA0")]);
14691    } else if (cssSpace.hasOwnProperty(group.text)) {
14692      // CSS-based MathML spaces (\nobreak, \allowbreak) are ignored
14693      return new mathMLTree.MathNode("mspace");
14694    } else {
14695      throw new src_ParseError("Unknown type of space \"" + group.text + "\"");
14696    }
14697
14698    return node;
14699  }
14700});
14701;// CONCATENATED MODULE: ./src/functions/tag.js
14702
14703
14704
14705
14706var pad = function pad() {
14707  var padNode = new mathMLTree.MathNode("mtd", []);
14708  padNode.setAttribute("width", "50%");
14709  return padNode;
14710};
14711
14712defineFunctionBuilders({
14713  type: "tag",
14714  mathmlBuilder: function mathmlBuilder(group, options) {
14715    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)])])]);
14716    table.setAttribute("width", "100%");
14717    return table; // TODO: Left-aligned tags.
14718    // Currently, the group and options passed here do not contain
14719    // enough info to set tag alignment. `leqno` is in Settings but it is
14720    // not passed to Options. On the HTML side, leqno is
14721    // set by a CSS class applied in buildTree.js. That would have worked
14722    // in MathML if browsers supported <mlabeledtr>. Since they don't, we
14723    // need to rewrite the way this function is called.
14724  }
14725});
14726;// CONCATENATED MODULE: ./src/functions/text.js
14727
14728
14729
14730 // Non-mathy text, possibly in a font
14731
14732var textFontFamilies = {
14733  "\\text": undefined,
14734  "\\textrm": "textrm",
14735  "\\textsf": "textsf",
14736  "\\texttt": "texttt",
14737  "\\textnormal": "textrm"
14738};
14739var textFontWeights = {
14740  "\\textbf": "textbf",
14741  "\\textmd": "textmd"
14742};
14743var textFontShapes = {
14744  "\\textit": "textit",
14745  "\\textup": "textup"
14746};
14747
14748var optionsWithFont = function optionsWithFont(group, options) {
14749  var font = group.font; // Checks if the argument is a font family or a font style.
14750
14751  if (!font) {
14752    return options;
14753  } else if (textFontFamilies[font]) {
14754    return options.withTextFontFamily(textFontFamilies[font]);
14755  } else if (textFontWeights[font]) {
14756    return options.withTextFontWeight(textFontWeights[font]);
14757  } else {
14758    return options.withTextFontShape(textFontShapes[font]);
14759  }
14760};
14761
14762defineFunction({
14763  type: "text",
14764  names: [// Font families
14765  "\\text", "\\textrm", "\\textsf", "\\texttt", "\\textnormal", // Font weights
14766  "\\textbf", "\\textmd", // Font Shapes
14767  "\\textit", "\\textup"],
14768  props: {
14769    numArgs: 1,
14770    argTypes: ["text"],
14771    allowedInArgument: true,
14772    allowedInText: true
14773  },
14774  handler: function handler(_ref, args) {
14775    var parser = _ref.parser,
14776        funcName = _ref.funcName;
14777    var body = args[0];
14778    return {
14779      type: "text",
14780      mode: parser.mode,
14781      body: ordargument(body),
14782      font: funcName
14783    };
14784  },
14785  htmlBuilder: function htmlBuilder(group, options) {
14786    var newOptions = optionsWithFont(group, options);
14787    var inner = buildExpression(group.body, newOptions, true);
14788    return buildCommon.makeSpan(["mord", "text"], inner, newOptions);
14789  },
14790  mathmlBuilder: function mathmlBuilder(group, options) {
14791    var newOptions = optionsWithFont(group, options);
14792    return buildExpressionRow(group.body, newOptions);
14793  }
14794});
14795;// CONCATENATED MODULE: ./src/functions/underline.js
14796
14797
14798
14799
14800
14801defineFunction({
14802  type: "underline",
14803  names: ["\\underline"],
14804  props: {
14805    numArgs: 1,
14806    allowedInText: true
14807  },
14808  handler: function handler(_ref, args) {
14809    var parser = _ref.parser;
14810    return {
14811      type: "underline",
14812      mode: parser.mode,
14813      body: args[0]
14814    };
14815  },
14816  htmlBuilder: function htmlBuilder(group, options) {
14817    // Underlines are handled in the TeXbook pg 443, Rule 10.
14818    // Build the inner group.
14819    var innerGroup = buildGroup(group.body, options); // Create the line to go below the body
14820
14821    var line = buildCommon.makeLineSpan("underline-line", options); // Generate the vlist, with the appropriate kerns
14822
14823    var defaultRuleThickness = options.fontMetrics().defaultRuleThickness;
14824    var vlist = buildCommon.makeVList({
14825      positionType: "top",
14826      positionData: innerGroup.height,
14827      children: [{
14828        type: "kern",
14829        size: defaultRuleThickness
14830      }, {
14831        type: "elem",
14832        elem: line
14833      }, {
14834        type: "kern",
14835        size: 3 * defaultRuleThickness
14836      }, {
14837        type: "elem",
14838        elem: innerGroup
14839      }]
14840    }, options);
14841    return buildCommon.makeSpan(["mord", "underline"], [vlist], options);
14842  },
14843  mathmlBuilder: function mathmlBuilder(group, options) {
14844    var operator = new mathMLTree.MathNode("mo", [new mathMLTree.TextNode("\u203E")]);
14845    operator.setAttribute("stretchy", "true");
14846    var node = new mathMLTree.MathNode("munder", [buildMathML_buildGroup(group.body, options), operator]);
14847    node.setAttribute("accentunder", "true");
14848    return node;
14849  }
14850});
14851;// CONCATENATED MODULE: ./src/functions/vcenter.js
14852
14853
14854
14855
14856 // \vcenter:  Vertically center the argument group on the math axis.
14857
14858defineFunction({
14859  type: "vcenter",
14860  names: ["\\vcenter"],
14861  props: {
14862    numArgs: 1,
14863    argTypes: ["original"],
14864    // In LaTeX, \vcenter can act only on a box.
14865    allowedInText: false
14866  },
14867  handler: function handler(_ref, args) {
14868    var parser = _ref.parser;
14869    return {
14870      type: "vcenter",
14871      mode: parser.mode,
14872      body: args[0]
14873    };
14874  },
14875  htmlBuilder: function htmlBuilder(group, options) {
14876    var body = buildGroup(group.body, options);
14877    var axisHeight = options.fontMetrics().axisHeight;
14878    var dy = 0.5 * (body.height - axisHeight - (body.depth + axisHeight));
14879    return buildCommon.makeVList({
14880      positionType: "shift",
14881      positionData: dy,
14882      children: [{
14883        type: "elem",
14884        elem: body
14885      }]
14886    }, options);
14887  },
14888  mathmlBuilder: function mathmlBuilder(group, options) {
14889    // There is no way to do this in MathML.
14890    // Write a class as a breadcrumb in case some post-processor wants
14891    // to perform a vcenter adjustment.
14892    return new mathMLTree.MathNode("mpadded", [buildMathML_buildGroup(group.body, options)], ["vcenter"]);
14893  }
14894});
14895;// CONCATENATED MODULE: ./src/functions/verb.js
14896
14897
14898
14899
14900defineFunction({
14901  type: "verb",
14902  names: ["\\verb"],
14903  props: {
14904    numArgs: 0,
14905    allowedInText: true
14906  },
14907  handler: function handler(context, args, optArgs) {
14908    // \verb and \verb* are dealt with directly in Parser.js.
14909    // If we end up here, it's because of a failure to match the two delimiters
14910    // in the regex in Lexer.js.  LaTeX raises the following error when \verb is
14911    // terminated by end of line (or file).
14912    throw new src_ParseError("\\verb ended by end of line instead of matching delimiter");
14913  },
14914  htmlBuilder: function htmlBuilder(group, options) {
14915    var text = makeVerb(group);
14916    var body = []; // \verb enters text mode and therefore is sized like \textstyle
14917
14918    var newOptions = options.havingStyle(options.style.text());
14919
14920    for (var i = 0; i < text.length; i++) {
14921      var c = text[i];
14922
14923      if (c === '~') {
14924        c = '\\textasciitilde';
14925      }
14926
14927      body.push(buildCommon.makeSymbol(c, "Typewriter-Regular", group.mode, newOptions, ["mord", "texttt"]));
14928    }
14929
14930    return buildCommon.makeSpan(["mord", "text"].concat(newOptions.sizingClasses(options)), buildCommon.tryCombineChars(body), newOptions);
14931  },
14932  mathmlBuilder: function mathmlBuilder(group, options) {
14933    var text = new mathMLTree.TextNode(makeVerb(group));
14934    var node = new mathMLTree.MathNode("mtext", [text]);
14935    node.setAttribute("mathvariant", "monospace");
14936    return node;
14937  }
14938});
14939/**
14940 * Converts verb group into body string.
14941 *
14942 * \verb* replaces each space with an open box \u2423
14943 * \verb replaces each space with a no-break space \xA0
14944 */
14945
14946var makeVerb = function makeVerb(group) {
14947  return group.body.replace(/ /g, group.star ? "\u2423" : '\xA0');
14948};
14949;// CONCATENATED MODULE: ./src/functions.js
14950/** Include this to ensure that all functions are defined. */
14951
14952var functions = _functions;
14953/* harmony default export */ var src_functions = (functions); // TODO(kevinb): have functions return an object and call defineFunction with
14954// that object in this file instead of relying on side-effects.
14955
14956
14957
14958
14959
14960
14961
14962
14963
14964
14965
14966
14967
14968
14969
14970
14971
14972
14973
14974
14975
14976
14977
14978
14979
14980
14981
14982
14983
14984
14985
14986
14987
14988
14989
14990
14991
14992
14993
14994
14995
14996
14997
14998
14999
15000
15001;// CONCATENATED MODULE: ./src/Lexer.js
15002/**
15003 * The Lexer class handles tokenizing the input in various ways. Since our
15004 * parser expects us to be able to backtrack, the lexer allows lexing from any
15005 * given starting point.
15006 *
15007 * Its main exposed function is the `lex` function, which takes a position to
15008 * lex from and a type of token to lex. It defers to the appropriate `_innerLex`
15009 * function.
15010 *
15011 * The various `_innerLex` functions perform the actual lexing of different
15012 * kinds.
15013 */
15014
15015
15016
15017
15018/* The following tokenRegex
15019 * - matches typical whitespace (but not NBSP etc.) using its first group
15020 * - does not match any control character \x00-\x1f except whitespace
15021 * - does not match a bare backslash
15022 * - matches any ASCII character except those just mentioned
15023 * - does not match the BMP private use area \uE000-\uF8FF
15024 * - does not match bare surrogate code units
15025 * - matches any BMP character except for those just described
15026 * - matches any valid Unicode surrogate pair
15027 * - matches a backslash followed by one or more whitespace characters
15028 * - matches a backslash followed by one or more letters then whitespace
15029 * - matches a backslash followed by any BMP character
15030 * Capturing groups:
15031 *   [1] regular whitespace
15032 *   [2] backslash followed by whitespace
15033 *   [3] anything else, which may include:
15034 *     [4] left character of \verb*
15035 *     [5] left character of \verb
15036 *     [6] backslash followed by word, excluding any trailing whitespace
15037 * Just because the Lexer matches something doesn't mean it's valid input:
15038 * If there is no matching function or symbol definition, the Parser will
15039 * still reject the input.
15040 */
15041var spaceRegexString = "[ \r\n\t]";
15042var controlWordRegexString = "\\\\[a-zA-Z@]+";
15043var controlSymbolRegexString = "\\\\[^\uD800-\uDFFF]";
15044var controlWordWhitespaceRegexString = "(" + controlWordRegexString + ")" + spaceRegexString + "*";
15045var controlSpaceRegexString = "\\\\(\n|[ \r\t]+\n?)[ \r\t]*";
15046var combiningDiacriticalMarkString = "[\u0300-\u036F]";
15047var combiningDiacriticalMarksEndRegex = new RegExp(combiningDiacriticalMarkString + "+$");
15048var tokenRegexString = "(" + spaceRegexString + "+)|" + ( // whitespace
15049controlSpaceRegexString + "|") + // \whitespace
15050"([!-\\[\\]-\u2027\u202A-\uD7FF\uF900-\uFFFF]" + ( // single codepoint
15051combiningDiacriticalMarkString + "*") + // ...plus accents
15052"|[\uD800-\uDBFF][\uDC00-\uDFFF]" + ( // surrogate pair
15053combiningDiacriticalMarkString + "*") + // ...plus accents
15054"|\\\\verb\\*([^]).*?\\4" + // \verb*
15055"|\\\\verb([^*a-zA-Z]).*?\\5" + ( // \verb unstarred
15056"|" + controlWordWhitespaceRegexString) + ( // \macroName + spaces
15057"|" + controlSymbolRegexString + ")"); // \\, \', etc.
15058
15059/** Main Lexer class */
15060
15061var Lexer = /*#__PURE__*/function () {
15062  // Category codes. The lexer only supports comment characters (14) for now.
15063  // MacroExpander additionally distinguishes active (13).
15064  function Lexer(input, settings) {
15065    this.input = void 0;
15066    this.settings = void 0;
15067    this.tokenRegex = void 0;
15068    this.catcodes = void 0;
15069    // Separate accents from characters
15070    this.input = input;
15071    this.settings = settings;
15072    this.tokenRegex = new RegExp(tokenRegexString, 'g');
15073    this.catcodes = {
15074      "%": 14,
15075      // comment character
15076      "~": 13 // active character
15077
15078    };
15079  }
15080
15081  var _proto = Lexer.prototype;
15082
15083  _proto.setCatcode = function setCatcode(char, code) {
15084    this.catcodes[char] = code;
15085  }
15086  /**
15087   * This function lexes a single token.
15088   */
15089  ;
15090
15091  _proto.lex = function lex() {
15092    var input = this.input;
15093    var pos = this.tokenRegex.lastIndex;
15094
15095    if (pos === input.length) {
15096      return new Token("EOF", new SourceLocation(this, pos, pos));
15097    }
15098
15099    var match = this.tokenRegex.exec(input);
15100
15101    if (match === null || match.index !== pos) {
15102      throw new src_ParseError("Unexpected character: '" + input[pos] + "'", new Token(input[pos], new SourceLocation(this, pos, pos + 1)));
15103    }
15104
15105    var text = match[6] || match[3] || (match[2] ? "\\ " : " ");
15106
15107    if (this.catcodes[text] === 14) {
15108      // comment character
15109      var nlIndex = input.indexOf('\n', this.tokenRegex.lastIndex);
15110
15111      if (nlIndex === -1) {
15112        this.tokenRegex.lastIndex = input.length; // EOF
15113
15114        this.settings.reportNonstrict("commentAtEnd", "% comment has no terminating newline; LaTeX would " + "fail because of commenting the end of math mode (e.g. $)");
15115      } else {
15116        this.tokenRegex.lastIndex = nlIndex + 1;
15117      }
15118
15119      return this.lex();
15120    }
15121
15122    return new Token(text, new SourceLocation(this, pos, this.tokenRegex.lastIndex));
15123  };
15124
15125  return Lexer;
15126}();
15127
15128
15129;// CONCATENATED MODULE: ./src/Namespace.js
15130/**
15131 * A `Namespace` refers to a space of nameable things like macros or lengths,
15132 * which can be `set` either globally or local to a nested group, using an
15133 * undo stack similar to how TeX implements this functionality.
15134 * Performance-wise, `get` and local `set` take constant time, while global
15135 * `set` takes time proportional to the depth of group nesting.
15136 */
15137
15138
15139var Namespace = /*#__PURE__*/function () {
15140  /**
15141   * Both arguments are optional.  The first argument is an object of
15142   * built-in mappings which never change.  The second argument is an object
15143   * of initial (global-level) mappings, which will constantly change
15144   * according to any global/top-level `set`s done.
15145   */
15146  function Namespace(builtins, globalMacros) {
15147    if (builtins === void 0) {
15148      builtins = {};
15149    }
15150
15151    if (globalMacros === void 0) {
15152      globalMacros = {};
15153    }
15154
15155    this.current = void 0;
15156    this.builtins = void 0;
15157    this.undefStack = void 0;
15158    this.current = globalMacros;
15159    this.builtins = builtins;
15160    this.undefStack = [];
15161  }
15162  /**
15163   * Start a new nested group, affecting future local `set`s.
15164   */
15165
15166
15167  var _proto = Namespace.prototype;
15168
15169  _proto.beginGroup = function beginGroup() {
15170    this.undefStack.push({});
15171  }
15172  /**
15173   * End current nested group, restoring values before the group began.
15174   */
15175  ;
15176
15177  _proto.endGroup = function endGroup() {
15178    if (this.undefStack.length === 0) {
15179      throw new src_ParseError("Unbalanced namespace destruction: attempt " + "to pop global namespace; please report this as a bug");
15180    }
15181
15182    var undefs = this.undefStack.pop();
15183
15184    for (var undef in undefs) {
15185      if (undefs.hasOwnProperty(undef)) {
15186        if (undefs[undef] == null) {
15187          delete this.current[undef];
15188        } else {
15189          this.current[undef] = undefs[undef];
15190        }
15191      }
15192    }
15193  }
15194  /**
15195   * Ends all currently nested groups (if any), restoring values before the
15196   * groups began.  Useful in case of an error in the middle of parsing.
15197   */
15198  ;
15199
15200  _proto.endGroups = function endGroups() {
15201    while (this.undefStack.length > 0) {
15202      this.endGroup();
15203    }
15204  }
15205  /**
15206   * Detect whether `name` has a definition.  Equivalent to
15207   * `get(name) != null`.
15208   */
15209  ;
15210
15211  _proto.has = function has(name) {
15212    return this.current.hasOwnProperty(name) || this.builtins.hasOwnProperty(name);
15213  }
15214  /**
15215   * Get the current value of a name, or `undefined` if there is no value.
15216   *
15217   * Note: Do not use `if (namespace.get(...))` to detect whether a macro
15218   * is defined, as the definition may be the empty string which evaluates
15219   * to `false` in JavaScript.  Use `if (namespace.get(...) != null)` or
15220   * `if (namespace.has(...))`.
15221   */
15222  ;
15223
15224  _proto.get = function get(name) {
15225    if (this.current.hasOwnProperty(name)) {
15226      return this.current[name];
15227    } else {
15228      return this.builtins[name];
15229    }
15230  }
15231  /**
15232   * Set the current value of a name, and optionally set it globally too.
15233   * Local set() sets the current value and (when appropriate) adds an undo
15234   * operation to the undo stack.  Global set() may change the undo
15235   * operation at every level, so takes time linear in their number.
15236   * A value of undefined means to delete existing definitions.
15237   */
15238  ;
15239
15240  _proto.set = function set(name, value, global) {
15241    if (global === void 0) {
15242      global = false;
15243    }
15244
15245    if (global) {
15246      // Global set is equivalent to setting in all groups.  Simulate this
15247      // by destroying any undos currently scheduled for this name,
15248      // and adding an undo with the *new* value (in case it later gets
15249      // locally reset within this environment).
15250      for (var i = 0; i < this.undefStack.length; i++) {
15251        delete this.undefStack[i][name];
15252      }
15253
15254      if (this.undefStack.length > 0) {
15255        this.undefStack[this.undefStack.length - 1][name] = value;
15256      }
15257    } else {
15258      // Undo this set at end of this group (possibly to `undefined`),
15259      // unless an undo is already in place, in which case that older
15260      // value is the correct one.
15261      var top = this.undefStack[this.undefStack.length - 1];
15262
15263      if (top && !top.hasOwnProperty(name)) {
15264        top[name] = this.current[name];
15265      }
15266    }
15267
15268    if (value == null) {
15269      delete this.current[name];
15270    } else {
15271      this.current[name] = value;
15272    }
15273  };
15274
15275  return Namespace;
15276}();
15277
15278
15279;// CONCATENATED MODULE: ./src/macros.js
15280/**
15281 * Predefined macros for KaTeX.
15282 * This can be used to define some commands in terms of others.
15283 */
15284// Export global macros object from defineMacro
15285
15286var macros = _macros;
15287/* harmony default export */ var src_macros = (macros);
15288
15289
15290
15291
15292
15293 //////////////////////////////////////////////////////////////////////
15294// macro tools
15295
15296defineMacro("\\noexpand", function (context) {
15297  // The expansion is the token itself; but that token is interpreted
15298  // as if its meaning were ‘\relax’ if it is a control sequence that
15299  // would ordinarily be expanded by TeX’s expansion rules.
15300  var t = context.popToken();
15301
15302  if (context.isExpandable(t.text)) {
15303    t.noexpand = true;
15304    t.treatAsRelax = true;
15305  }
15306
15307  return {
15308    tokens: [t],
15309    numArgs: 0
15310  };
15311});
15312defineMacro("\\expandafter", function (context) {
15313  // TeX first reads the token that comes immediately after \expandafter,
15314  // without expanding it; let’s call this token t. Then TeX reads the
15315  // token that comes after t (and possibly more tokens, if that token
15316  // has an argument), replacing it by its expansion. Finally TeX puts
15317  // t back in front of that expansion.
15318  var t = context.popToken();
15319  context.expandOnce(true); // expand only an expandable token
15320
15321  return {
15322    tokens: [t],
15323    numArgs: 0
15324  };
15325}); // LaTeX's \@firstoftwo{#1}{#2} expands to #1, skipping #2
15326// TeX source: \long\def\@firstoftwo#1#2{#1}
15327
15328defineMacro("\\@firstoftwo", function (context) {
15329  var args = context.consumeArgs(2);
15330  return {
15331    tokens: args[0],
15332    numArgs: 0
15333  };
15334}); // LaTeX's \@secondoftwo{#1}{#2} expands to #2, skipping #1
15335// TeX source: \long\def\@secondoftwo#1#2{#2}
15336
15337defineMacro("\\@secondoftwo", function (context) {
15338  var args = context.consumeArgs(2);
15339  return {
15340    tokens: args[1],
15341    numArgs: 0
15342  };
15343}); // LaTeX's \@ifnextchar{#1}{#2}{#3} looks ahead to the next (unexpanded)
15344// symbol that isn't a space, consuming any spaces but not consuming the
15345// first nonspace character.  If that nonspace character matches #1, then
15346// the macro expands to #2; otherwise, it expands to #3.
15347
15348defineMacro("\\@ifnextchar", function (context) {
15349  var args = context.consumeArgs(3); // symbol, if, else
15350
15351  context.consumeSpaces();
15352  var nextToken = context.future();
15353
15354  if (args[0].length === 1 && args[0][0].text === nextToken.text) {
15355    return {
15356      tokens: args[1],
15357      numArgs: 0
15358    };
15359  } else {
15360    return {
15361      tokens: args[2],
15362      numArgs: 0
15363    };
15364  }
15365}); // LaTeX's \@ifstar{#1}{#2} looks ahead to the next (unexpanded) symbol.
15366// If it is `*`, then it consumes the symbol, and the macro expands to #1;
15367// otherwise, the macro expands to #2 (without consuming the symbol).
15368// TeX source: \def\@ifstar#1{\@ifnextchar *{\@firstoftwo{#1}}}
15369
15370defineMacro("\\@ifstar", "\\@ifnextchar *{\\@firstoftwo{#1}}"); // LaTeX's \TextOrMath{#1}{#2} expands to #1 in text mode, #2 in math mode
15371
15372defineMacro("\\TextOrMath", function (context) {
15373  var args = context.consumeArgs(2);
15374
15375  if (context.mode === 'text') {
15376    return {
15377      tokens: args[0],
15378      numArgs: 0
15379    };
15380  } else {
15381    return {
15382      tokens: args[1],
15383      numArgs: 0
15384    };
15385  }
15386}); // Lookup table for parsing numbers in base 8 through 16
15387
15388var digitToNumber = {
15389  "0": 0,
15390  "1": 1,
15391  "2": 2,
15392  "3": 3,
15393  "4": 4,
15394  "5": 5,
15395  "6": 6,
15396  "7": 7,
15397  "8": 8,
15398  "9": 9,
15399  "a": 10,
15400  "A": 10,
15401  "b": 11,
15402  "B": 11,
15403  "c": 12,
15404  "C": 12,
15405  "d": 13,
15406  "D": 13,
15407  "e": 14,
15408  "E": 14,
15409  "f": 15,
15410  "F": 15
15411}; // TeX \char makes a literal character (catcode 12) using the following forms:
15412// (see The TeXBook, p. 43)
15413//   \char123  -- decimal
15414//   \char'123 -- octal
15415//   \char"123 -- hex
15416//   \char`x   -- character that can be written (i.e. isn't active)
15417//   \char`\x  -- character that cannot be written (e.g. %)
15418// These all refer to characters from the font, so we turn them into special
15419// calls to a function \@char dealt with in the Parser.
15420
15421defineMacro("\\char", function (context) {
15422  var token = context.popToken();
15423  var base;
15424  var number = '';
15425
15426  if (token.text === "'") {
15427    base = 8;
15428    token = context.popToken();
15429  } else if (token.text === '"') {
15430    base = 16;
15431    token = context.popToken();
15432  } else if (token.text === "`") {
15433    token = context.popToken();
15434
15435    if (token.text[0] === "\\") {
15436      number = token.text.charCodeAt(1);
15437    } else if (token.text === "EOF") {
15438      throw new src_ParseError("\\char` missing argument");
15439    } else {
15440      number = token.text.charCodeAt(0);
15441    }
15442  } else {
15443    base = 10;
15444  }
15445
15446  if (base) {
15447    // Parse a number in the given base, starting with first `token`.
15448    number = digitToNumber[token.text];
15449
15450    if (number == null || number >= base) {
15451      throw new src_ParseError("Invalid base-" + base + " digit " + token.text);
15452    }
15453
15454    var digit;
15455
15456    while ((digit = digitToNumber[context.future().text]) != null && digit < base) {
15457      number *= base;
15458      number += digit;
15459      context.popToken();
15460    }
15461  }
15462
15463  return "\\@char{" + number + "}";
15464}); // \newcommand{\macro}[args]{definition}
15465// \renewcommand{\macro}[args]{definition}
15466// TODO: Optional arguments: \newcommand{\macro}[args][default]{definition}
15467
15468var newcommand = function newcommand(context, existsOK, nonexistsOK) {
15469  var arg = context.consumeArg().tokens;
15470
15471  if (arg.length !== 1) {
15472    throw new src_ParseError("\\newcommand's first argument must be a macro name");
15473  }
15474
15475  var name = arg[0].text;
15476  var exists = context.isDefined(name);
15477
15478  if (exists && !existsOK) {
15479    throw new src_ParseError("\\newcommand{" + name + "} attempting to redefine " + (name + "; use \\renewcommand"));
15480  }
15481
15482  if (!exists && !nonexistsOK) {
15483    throw new src_ParseError("\\renewcommand{" + name + "} when command " + name + " " + "does not yet exist; use \\newcommand");
15484  }
15485
15486  var numArgs = 0;
15487  arg = context.consumeArg().tokens;
15488
15489  if (arg.length === 1 && arg[0].text === "[") {
15490    var argText = '';
15491    var token = context.expandNextToken();
15492
15493    while (token.text !== "]" && token.text !== "EOF") {
15494      // TODO: Should properly expand arg, e.g., ignore {}s
15495      argText += token.text;
15496      token = context.expandNextToken();
15497    }
15498
15499    if (!argText.match(/^\s*[0-9]+\s*$/)) {
15500      throw new src_ParseError("Invalid number of arguments: " + argText);
15501    }
15502
15503    numArgs = parseInt(argText);
15504    arg = context.consumeArg().tokens;
15505  } // Final arg is the expansion of the macro
15506
15507
15508  context.macros.set(name, {
15509    tokens: arg,
15510    numArgs: numArgs
15511  });
15512  return '';
15513};
15514
15515defineMacro("\\newcommand", function (context) {
15516  return newcommand(context, false, true);
15517});
15518defineMacro("\\renewcommand", function (context) {
15519  return newcommand(context, true, false);
15520});
15521defineMacro("\\providecommand", function (context) {
15522  return newcommand(context, true, true);
15523}); // terminal (console) tools
15524
15525defineMacro("\\message", function (context) {
15526  var arg = context.consumeArgs(1)[0]; // eslint-disable-next-line no-console
15527
15528  console.log(arg.reverse().map(function (token) {
15529    return token.text;
15530  }).join(""));
15531  return '';
15532});
15533defineMacro("\\errmessage", function (context) {
15534  var arg = context.consumeArgs(1)[0]; // eslint-disable-next-line no-console
15535
15536  console.error(arg.reverse().map(function (token) {
15537    return token.text;
15538  }).join(""));
15539  return '';
15540});
15541defineMacro("\\show", function (context) {
15542  var tok = context.popToken();
15543  var name = tok.text; // eslint-disable-next-line no-console
15544
15545  console.log(tok, context.macros.get(name), src_functions[name], src_symbols.math[name], src_symbols.text[name]);
15546  return '';
15547}); //////////////////////////////////////////////////////////////////////
15548// Grouping
15549// \let\bgroup={ \let\egroup=}
15550
15551defineMacro("\\bgroup", "{");
15552defineMacro("\\egroup", "}"); // Symbols from latex.ltx:
15553// \def~{\nobreakspace{}}
15554// \def\lq{`}
15555// \def\rq{'}
15556// \def \aa {\r a}
15557// \def \AA {\r A}
15558
15559defineMacro("~", "\\nobreakspace");
15560defineMacro("\\lq", "`");
15561defineMacro("\\rq", "'");
15562defineMacro("\\aa", "\\r a");
15563defineMacro("\\AA", "\\r A"); // Copyright (C) and registered (R) symbols. Use raw symbol in MathML.
15564// \DeclareTextCommandDefault{\textcopyright}{\textcircled{c}}
15565// \DeclareTextCommandDefault{\textregistered}{\textcircled{%
15566//      \check@mathfonts\fontsize\sf@size\z@\math@fontsfalse\selectfont R}}
15567// \DeclareRobustCommand{\copyright}{%
15568//    \ifmmode{\nfss@text{\textcopyright}}\else\textcopyright\fi}
15569
15570defineMacro("\\textcopyright", "\\html@mathml{\\textcircled{c}}{\\char`©}");
15571defineMacro("\\copyright", "\\TextOrMath{\\textcopyright}{\\text{\\textcopyright}}");
15572defineMacro("\\textregistered", "\\html@mathml{\\textcircled{\\scriptsize R}}{\\char`®}"); // Characters omitted from Unicode range 1D400–1D7FF
15573
15574defineMacro("\u212C", "\\mathscr{B}"); // script
15575
15576defineMacro("\u2130", "\\mathscr{E}");
15577defineMacro("\u2131", "\\mathscr{F}");
15578defineMacro("\u210B", "\\mathscr{H}");
15579defineMacro("\u2110", "\\mathscr{I}");
15580defineMacro("\u2112", "\\mathscr{L}");
15581defineMacro("\u2133", "\\mathscr{M}");
15582defineMacro("\u211B", "\\mathscr{R}");
15583defineMacro("\u212D", "\\mathfrak{C}"); // Fraktur
15584
15585defineMacro("\u210C", "\\mathfrak{H}");
15586defineMacro("\u2128", "\\mathfrak{Z}"); // Define \Bbbk with a macro that works in both HTML and MathML.
15587
15588defineMacro("\\Bbbk", "\\Bbb{k}"); // Unicode middle dot
15589// The KaTeX fonts do not contain U+00B7. Instead, \cdotp displays
15590// the dot at U+22C5 and gives it punct spacing.
15591
15592defineMacro("\xB7", "\\cdotp"); // \llap and \rlap render their contents in text mode
15593
15594defineMacro("\\llap", "\\mathllap{\\textrm{#1}}");
15595defineMacro("\\rlap", "\\mathrlap{\\textrm{#1}}");
15596defineMacro("\\clap", "\\mathclap{\\textrm{#1}}"); // \mathstrut from the TeXbook, p 360
15597
15598defineMacro("\\mathstrut", "\\vphantom{(}"); // \underbar from TeXbook p 353
15599
15600defineMacro("\\underbar", "\\underline{\\text{#1}}"); // \not is defined by base/fontmath.ltx via
15601// \DeclareMathSymbol{\not}{\mathrel}{symbols}{"36}
15602// It's thus treated like a \mathrel, but defined by a symbol that has zero
15603// width but extends to the right.  We use \rlap to get that spacing.
15604// For MathML we write U+0338 here. buildMathML.js will then do the overlay.
15605
15606defineMacro("\\not", '\\html@mathml{\\mathrel{\\mathrlap\\@not}}{\\char"338}'); // Negated symbols from base/fontmath.ltx:
15607// \def\neq{\not=} \let\ne=\neq
15608// \DeclareRobustCommand
15609//   \notin{\mathrel{\m@th\mathpalette\c@ncel\in}}
15610// \def\c@ncel#1#2{\m@th\ooalign{$\hfil#1\mkern1mu/\hfil$\crcr$#1#2$}}
15611
15612defineMacro("\\neq", "\\html@mathml{\\mathrel{\\not=}}{\\mathrel{\\char`≠}}");
15613defineMacro("\\ne", "\\neq");
15614defineMacro("\u2260", "\\neq");
15615defineMacro("\\notin", "\\html@mathml{\\mathrel{{\\in}\\mathllap{/\\mskip1mu}}}" + "{\\mathrel{\\char`∉}}");
15616defineMacro("\u2209", "\\notin"); // Unicode stacked relations
15617
15618defineMacro("\u2258", "\\html@mathml{" + "\\mathrel{=\\kern{-1em}\\raisebox{0.4em}{$\\scriptsize\\frown$}}" + "}{\\mathrel{\\char`\u2258}}");
15619defineMacro("\u2259", "\\html@mathml{\\stackrel{\\tiny\\wedge}{=}}{\\mathrel{\\char`\u2258}}");
15620defineMacro("\u225A", "\\html@mathml{\\stackrel{\\tiny\\vee}{=}}{\\mathrel{\\char`\u225A}}");
15621defineMacro("\u225B", "\\html@mathml{\\stackrel{\\scriptsize\\star}{=}}" + "{\\mathrel{\\char`\u225B}}");
15622defineMacro("\u225D", "\\html@mathml{\\stackrel{\\tiny\\mathrm{def}}{=}}" + "{\\mathrel{\\char`\u225D}}");
15623defineMacro("\u225E", "\\html@mathml{\\stackrel{\\tiny\\mathrm{m}}{=}}" + "{\\mathrel{\\char`\u225E}}");
15624defineMacro("\u225F", "\\html@mathml{\\stackrel{\\tiny?}{=}}{\\mathrel{\\char`\u225F}}"); // Misc Unicode
15625
15626defineMacro("\u27C2", "\\perp");
15627defineMacro("\u203C", "\\mathclose{!\\mkern-0.8mu!}");
15628defineMacro("\u220C", "\\notni");
15629defineMacro("\u231C", "\\ulcorner");
15630defineMacro("\u231D", "\\urcorner");
15631defineMacro("\u231E", "\\llcorner");
15632defineMacro("\u231F", "\\lrcorner");
15633defineMacro("\xA9", "\\copyright");
15634defineMacro("\xAE", "\\textregistered");
15635defineMacro("\uFE0F", "\\textregistered"); // The KaTeX fonts have corners at codepoints that don't match Unicode.
15636// For MathML purposes, use the Unicode code point.
15637
15638defineMacro("\\ulcorner", "\\html@mathml{\\@ulcorner}{\\mathop{\\char\"231c}}");
15639defineMacro("\\urcorner", "\\html@mathml{\\@urcorner}{\\mathop{\\char\"231d}}");
15640defineMacro("\\llcorner", "\\html@mathml{\\@llcorner}{\\mathop{\\char\"231e}}");
15641defineMacro("\\lrcorner", "\\html@mathml{\\@lrcorner}{\\mathop{\\char\"231f}}"); //////////////////////////////////////////////////////////////////////
15642// LaTeX_2ε
15643// \vdots{\vbox{\baselineskip4\p@  \lineskiplimit\z@
15644// \kern6\p@\hbox{.}\hbox{.}\hbox{.}}}
15645// We'll call \varvdots, which gets a glyph from symbols.js.
15646// The zero-width rule gets us an equivalent to the vertical 6pt kern.
15647
15648defineMacro("\\vdots", "\\mathord{\\varvdots\\rule{0pt}{15pt}}");
15649defineMacro("\u22EE", "\\vdots"); //////////////////////////////////////////////////////////////////////
15650// amsmath.sty
15651// http://mirrors.concertpass.com/tex-archive/macros/latex/required/amsmath/amsmath.pdf
15652// Italic Greek capital letters.  AMS defines these with \DeclareMathSymbol,
15653// but they are equivalent to \mathit{\Letter}.
15654
15655defineMacro("\\varGamma", "\\mathit{\\Gamma}");
15656defineMacro("\\varDelta", "\\mathit{\\Delta}");
15657defineMacro("\\varTheta", "\\mathit{\\Theta}");
15658defineMacro("\\varLambda", "\\mathit{\\Lambda}");
15659defineMacro("\\varXi", "\\mathit{\\Xi}");
15660defineMacro("\\varPi", "\\mathit{\\Pi}");
15661defineMacro("\\varSigma", "\\mathit{\\Sigma}");
15662defineMacro("\\varUpsilon", "\\mathit{\\Upsilon}");
15663defineMacro("\\varPhi", "\\mathit{\\Phi}");
15664defineMacro("\\varPsi", "\\mathit{\\Psi}");
15665defineMacro("\\varOmega", "\\mathit{\\Omega}"); //\newcommand{\substack}[1]{\subarray{c}#1\endsubarray}
15666
15667defineMacro("\\substack", "\\begin{subarray}{c}#1\\end{subarray}"); // \renewcommand{\colon}{\nobreak\mskip2mu\mathpunct{}\nonscript
15668// \mkern-\thinmuskip{:}\mskip6muplus1mu\relax}
15669
15670defineMacro("\\colon", "\\nobreak\\mskip2mu\\mathpunct{}" + "\\mathchoice{\\mkern-3mu}{\\mkern-3mu}{}{}{:}\\mskip6mu\\relax"); // \newcommand{\boxed}[1]{\fbox{\m@th$\displaystyle#1$}}
15671
15672defineMacro("\\boxed", "\\fbox{$\\displaystyle{#1}$}"); // \def\iff{\DOTSB\;\Longleftrightarrow\;}
15673// \def\implies{\DOTSB\;\Longrightarrow\;}
15674// \def\impliedby{\DOTSB\;\Longleftarrow\;}
15675
15676defineMacro("\\iff", "\\DOTSB\\;\\Longleftrightarrow\\;");
15677defineMacro("\\implies", "\\DOTSB\\;\\Longrightarrow\\;");
15678defineMacro("\\impliedby", "\\DOTSB\\;\\Longleftarrow\\;"); // AMSMath's automatic \dots, based on \mdots@@ macro.
15679
15680var dotsByToken = {
15681  ',': '\\dotsc',
15682  '\\not': '\\dotsb',
15683  // \keybin@ checks for the following:
15684  '+': '\\dotsb',
15685  '=': '\\dotsb',
15686  '<': '\\dotsb',
15687  '>': '\\dotsb',
15688  '-': '\\dotsb',
15689  '*': '\\dotsb',
15690  ':': '\\dotsb',
15691  // Symbols whose definition starts with \DOTSB:
15692  '\\DOTSB': '\\dotsb',
15693  '\\coprod': '\\dotsb',
15694  '\\bigvee': '\\dotsb',
15695  '\\bigwedge': '\\dotsb',
15696  '\\biguplus': '\\dotsb',
15697  '\\bigcap': '\\dotsb',
15698  '\\bigcup': '\\dotsb',
15699  '\\prod': '\\dotsb',
15700  '\\sum': '\\dotsb',
15701  '\\bigotimes': '\\dotsb',
15702  '\\bigoplus': '\\dotsb',
15703  '\\bigodot': '\\dotsb',
15704  '\\bigsqcup': '\\dotsb',
15705  '\\And': '\\dotsb',
15706  '\\longrightarrow': '\\dotsb',
15707  '\\Longrightarrow': '\\dotsb',
15708  '\\longleftarrow': '\\dotsb',
15709  '\\Longleftarrow': '\\dotsb',
15710  '\\longleftrightarrow': '\\dotsb',
15711  '\\Longleftrightarrow': '\\dotsb',
15712  '\\mapsto': '\\dotsb',
15713  '\\longmapsto': '\\dotsb',
15714  '\\hookrightarrow': '\\dotsb',
15715  '\\doteq': '\\dotsb',
15716  // Symbols whose definition starts with \mathbin:
15717  '\\mathbin': '\\dotsb',
15718  // Symbols whose definition starts with \mathrel:
15719  '\\mathrel': '\\dotsb',
15720  '\\relbar': '\\dotsb',
15721  '\\Relbar': '\\dotsb',
15722  '\\xrightarrow': '\\dotsb',
15723  '\\xleftarrow': '\\dotsb',
15724  // Symbols whose definition starts with \DOTSI:
15725  '\\DOTSI': '\\dotsi',
15726  '\\int': '\\dotsi',
15727  '\\oint': '\\dotsi',
15728  '\\iint': '\\dotsi',
15729  '\\iiint': '\\dotsi',
15730  '\\iiiint': '\\dotsi',
15731  '\\idotsint': '\\dotsi',
15732  // Symbols whose definition starts with \DOTSX:
15733  '\\DOTSX': '\\dotsx'
15734};
15735defineMacro("\\dots", function (context) {
15736  // TODO: If used in text mode, should expand to \textellipsis.
15737  // However, in KaTeX, \textellipsis and \ldots behave the same
15738  // (in text mode), and it's unlikely we'd see any of the math commands
15739  // that affect the behavior of \dots when in text mode.  So fine for now
15740  // (until we support \ifmmode ... \else ... \fi).
15741  var thedots = '\\dotso';
15742  var next = context.expandAfterFuture().text;
15743
15744  if (next in dotsByToken) {
15745    thedots = dotsByToken[next];
15746  } else if (next.substr(0, 4) === '\\not') {
15747    thedots = '\\dotsb';
15748  } else if (next in src_symbols.math) {
15749    if (utils.contains(['bin', 'rel'], src_symbols.math[next].group)) {
15750      thedots = '\\dotsb';
15751    }
15752  }
15753
15754  return thedots;
15755});
15756var spaceAfterDots = {
15757  // \rightdelim@ checks for the following:
15758  ')': true,
15759  ']': true,
15760  '\\rbrack': true,
15761  '\\}': true,
15762  '\\rbrace': true,
15763  '\\rangle': true,
15764  '\\rceil': true,
15765  '\\rfloor': true,
15766  '\\rgroup': true,
15767  '\\rmoustache': true,
15768  '\\right': true,
15769  '\\bigr': true,
15770  '\\biggr': true,
15771  '\\Bigr': true,
15772  '\\Biggr': true,
15773  // \extra@ also tests for the following:
15774  '$': true,
15775  // \extrap@ checks for the following:
15776  ';': true,
15777  '.': true,
15778  ',': true
15779};
15780defineMacro("\\dotso", function (context) {
15781  var next = context.future().text;
15782
15783  if (next in spaceAfterDots) {
15784    return "\\ldots\\,";
15785  } else {
15786    return "\\ldots";
15787  }
15788});
15789defineMacro("\\dotsc", function (context) {
15790  var next = context.future().text; // \dotsc uses \extra@ but not \extrap@, instead specially checking for
15791  // ';' and '.', but doesn't check for ','.
15792
15793  if (next in spaceAfterDots && next !== ',') {
15794    return "\\ldots\\,";
15795  } else {
15796    return "\\ldots";
15797  }
15798});
15799defineMacro("\\cdots", function (context) {
15800  var next = context.future().text;
15801
15802  if (next in spaceAfterDots) {
15803    return "\\@cdots\\,";
15804  } else {
15805    return "\\@cdots";
15806  }
15807});
15808defineMacro("\\dotsb", "\\cdots");
15809defineMacro("\\dotsm", "\\cdots");
15810defineMacro("\\dotsi", "\\!\\cdots"); // amsmath doesn't actually define \dotsx, but \dots followed by a macro
15811// starting with \DOTSX implies \dotso, and then \extra@ detects this case
15812// and forces the added `\,`.
15813
15814defineMacro("\\dotsx", "\\ldots\\,"); // \let\DOTSI\relax
15815// \let\DOTSB\relax
15816// \let\DOTSX\relax
15817
15818defineMacro("\\DOTSI", "\\relax");
15819defineMacro("\\DOTSB", "\\relax");
15820defineMacro("\\DOTSX", "\\relax"); // Spacing, based on amsmath.sty's override of LaTeX defaults
15821// \DeclareRobustCommand{\tmspace}[3]{%
15822//   \ifmmode\mskip#1#2\else\kern#1#3\fi\relax}
15823
15824defineMacro("\\tmspace", "\\TextOrMath{\\kern#1#3}{\\mskip#1#2}\\relax"); // \renewcommand{\,}{\tmspace+\thinmuskip{.1667em}}
15825// TODO: math mode should use \thinmuskip
15826
15827defineMacro("\\,", "\\tmspace+{3mu}{.1667em}"); // \let\thinspace\,
15828
15829defineMacro("\\thinspace", "\\,"); // \def\>{\mskip\medmuskip}
15830// \renewcommand{\:}{\tmspace+\medmuskip{.2222em}}
15831// TODO: \> and math mode of \: should use \medmuskip = 4mu plus 2mu minus 4mu
15832
15833defineMacro("\\>", "\\mskip{4mu}");
15834defineMacro("\\:", "\\tmspace+{4mu}{.2222em}"); // \let\medspace\:
15835
15836defineMacro("\\medspace", "\\:"); // \renewcommand{\;}{\tmspace+\thickmuskip{.2777em}}
15837// TODO: math mode should use \thickmuskip = 5mu plus 5mu
15838
15839defineMacro("\\;", "\\tmspace+{5mu}{.2777em}"); // \let\thickspace\;
15840
15841defineMacro("\\thickspace", "\\;"); // \renewcommand{\!}{\tmspace-\thinmuskip{.1667em}}
15842// TODO: math mode should use \thinmuskip
15843
15844defineMacro("\\!", "\\tmspace-{3mu}{.1667em}"); // \let\negthinspace\!
15845
15846defineMacro("\\negthinspace", "\\!"); // \newcommand{\negmedspace}{\tmspace-\medmuskip{.2222em}}
15847// TODO: math mode should use \medmuskip
15848
15849defineMacro("\\negmedspace", "\\tmspace-{4mu}{.2222em}"); // \newcommand{\negthickspace}{\tmspace-\thickmuskip{.2777em}}
15850// TODO: math mode should use \thickmuskip
15851
15852defineMacro("\\negthickspace", "\\tmspace-{5mu}{.277em}"); // \def\enspace{\kern.5em }
15853
15854defineMacro("\\enspace", "\\kern.5em "); // \def\enskip{\hskip.5em\relax}
15855
15856defineMacro("\\enskip", "\\hskip.5em\\relax"); // \def\quad{\hskip1em\relax}
15857
15858defineMacro("\\quad", "\\hskip1em\\relax"); // \def\qquad{\hskip2em\relax}
15859
15860defineMacro("\\qquad", "\\hskip2em\\relax"); // \tag@in@display form of \tag
15861
15862defineMacro("\\tag", "\\@ifstar\\tag@literal\\tag@paren");
15863defineMacro("\\tag@paren", "\\tag@literal{({#1})}");
15864defineMacro("\\tag@literal", function (context) {
15865  if (context.macros.get("\\df@tag")) {
15866    throw new src_ParseError("Multiple \\tag");
15867  }
15868
15869  return "\\gdef\\df@tag{\\text{#1}}";
15870}); // \renewcommand{\bmod}{\nonscript\mskip-\medmuskip\mkern5mu\mathbin
15871//   {\operator@font mod}\penalty900
15872//   \mkern5mu\nonscript\mskip-\medmuskip}
15873// \newcommand{\pod}[1]{\allowbreak
15874//   \if@display\mkern18mu\else\mkern8mu\fi(#1)}
15875// \renewcommand{\pmod}[1]{\pod{{\operator@font mod}\mkern6mu#1}}
15876// \newcommand{\mod}[1]{\allowbreak\if@display\mkern18mu
15877//   \else\mkern12mu\fi{\operator@font mod}\,\,#1}
15878// TODO: math mode should use \medmuskip = 4mu plus 2mu minus 4mu
15879
15880defineMacro("\\bmod", "\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}" + "\\mathbin{\\rm mod}" + "\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}");
15881defineMacro("\\pod", "\\allowbreak" + "\\mathchoice{\\mkern18mu}{\\mkern8mu}{\\mkern8mu}{\\mkern8mu}(#1)");
15882defineMacro("\\pmod", "\\pod{{\\rm mod}\\mkern6mu#1}");
15883defineMacro("\\mod", "\\allowbreak" + "\\mathchoice{\\mkern18mu}{\\mkern12mu}{\\mkern12mu}{\\mkern12mu}" + "{\\rm mod}\\,\\,#1"); // \pmb    --   A simulation of bold.
15884// The version in ambsy.sty works by typesetting three copies of the argument
15885// with small offsets. We use two copies. We omit the vertical offset because
15886// of rendering problems that makeVList encounters in Safari.
15887
15888defineMacro("\\pmb", "\\html@mathml{" + "\\@binrel{#1}{\\mathrlap{#1}\\kern0.5px#1}}" + "{\\mathbf{#1}}"); //////////////////////////////////////////////////////////////////////
15889// LaTeX source2e
15890// \expandafter\let\expandafter\@normalcr
15891//     \csname\expandafter\@gobble\string\\ \endcsname
15892// \DeclareRobustCommand\newline{\@normalcr\relax}
15893
15894defineMacro("\\newline", "\\\\\\relax"); // \def\TeX{T\kern-.1667em\lower.5ex\hbox{E}\kern-.125emX\@}
15895// TODO: Doesn't normally work in math mode because \@ fails.  KaTeX doesn't
15896// support \@ yet, so that's omitted, and we add \text so that the result
15897// doesn't look funny in math mode.
15898
15899defineMacro("\\TeX", "\\textrm{\\html@mathml{" + "T\\kern-.1667em\\raisebox{-.5ex}{E}\\kern-.125emX" + "}{TeX}}"); // \DeclareRobustCommand{\LaTeX}{L\kern-.36em%
15900//         {\sbox\z@ T%
15901//          \vbox to\ht\z@{\hbox{\check@mathfonts
15902//                               \fontsize\sf@size\z@
15903//                               \math@fontsfalse\selectfont
15904//                               A}%
15905//                         \vss}%
15906//         }%
15907//         \kern-.15em%
15908//         \TeX}
15909// This code aligns the top of the A with the T (from the perspective of TeX's
15910// boxes, though visually the A appears to extend above slightly).
15911// We compute the corresponding \raisebox when A is rendered in \normalsize
15912// \scriptstyle, which has a scale factor of 0.7 (see Options.js).
15913
15914var latexRaiseA = makeEm(fontMetricsData["Main-Regular"]["T".charCodeAt(0)][1] - 0.7 * fontMetricsData["Main-Regular"]["A".charCodeAt(0)][1]);
15915defineMacro("\\LaTeX", "\\textrm{\\html@mathml{" + ("L\\kern-.36em\\raisebox{" + latexRaiseA + "}{\\scriptstyle A}") + "\\kern-.15em\\TeX}{LaTeX}}"); // New KaTeX logo based on tweaking LaTeX logo
15916
15917defineMacro("\\KaTeX", "\\textrm{\\html@mathml{" + ("K\\kern-.17em\\raisebox{" + latexRaiseA + "}{\\scriptstyle A}") + "\\kern-.15em\\TeX}{KaTeX}}"); // \DeclareRobustCommand\hspace{\@ifstar\@hspacer\@hspace}
15918// \def\@hspace#1{\hskip  #1\relax}
15919// \def\@hspacer#1{\vrule \@width\z@\nobreak
15920//                 \hskip #1\hskip \z@skip}
15921
15922defineMacro("\\hspace", "\\@ifstar\\@hspacer\\@hspace");
15923defineMacro("\\@hspace", "\\hskip #1\\relax");
15924defineMacro("\\@hspacer", "\\rule{0pt}{0pt}\\hskip #1\\relax"); //////////////////////////////////////////////////////////////////////
15925// mathtools.sty
15926//\providecommand\ordinarycolon{:}
15927
15928defineMacro("\\ordinarycolon", ":"); //\def\vcentcolon{\mathrel{\mathop\ordinarycolon}}
15929//TODO(edemaine): Not yet centered. Fix via \raisebox or #726
15930
15931defineMacro("\\vcentcolon", "\\mathrel{\\mathop\\ordinarycolon}"); // \providecommand*\dblcolon{\vcentcolon\mathrel{\mkern-.9mu}\vcentcolon}
15932
15933defineMacro("\\dblcolon", "\\html@mathml{" + "\\mathrel{\\vcentcolon\\mathrel{\\mkern-.9mu}\\vcentcolon}}" + "{\\mathop{\\char\"2237}}"); // \providecommand*\coloneqq{\vcentcolon\mathrel{\mkern-1.2mu}=}
15934
15935defineMacro("\\coloneqq", "\\html@mathml{" + "\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}=}}" + "{\\mathop{\\char\"2254}}"); // ≔
15936// \providecommand*\Coloneqq{\dblcolon\mathrel{\mkern-1.2mu}=}
15937
15938defineMacro("\\Coloneqq", "\\html@mathml{" + "\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}=}}" + "{\\mathop{\\char\"2237\\char\"3d}}"); // \providecommand*\coloneq{\vcentcolon\mathrel{\mkern-1.2mu}\mathrel{-}}
15939
15940defineMacro("\\coloneq", "\\html@mathml{" + "\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}" + "{\\mathop{\\char\"3a\\char\"2212}}"); // \providecommand*\Coloneq{\dblcolon\mathrel{\mkern-1.2mu}\mathrel{-}}
15941
15942defineMacro("\\Coloneq", "\\html@mathml{" + "\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}" + "{\\mathop{\\char\"2237\\char\"2212}}"); // \providecommand*\eqqcolon{=\mathrel{\mkern-1.2mu}\vcentcolon}
15943
15944defineMacro("\\eqqcolon", "\\html@mathml{" + "\\mathrel{=\\mathrel{\\mkern-1.2mu}\\vcentcolon}}" + "{\\mathop{\\char\"2255}}"); // ≕
15945// \providecommand*\Eqqcolon{=\mathrel{\mkern-1.2mu}\dblcolon}
15946
15947defineMacro("\\Eqqcolon", "\\html@mathml{" + "\\mathrel{=\\mathrel{\\mkern-1.2mu}\\dblcolon}}" + "{\\mathop{\\char\"3d\\char\"2237}}"); // \providecommand*\eqcolon{\mathrel{-}\mathrel{\mkern-1.2mu}\vcentcolon}
15948
15949defineMacro("\\eqcolon", "\\html@mathml{" + "\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\vcentcolon}}" + "{\\mathop{\\char\"2239}}"); // \providecommand*\Eqcolon{\mathrel{-}\mathrel{\mkern-1.2mu}\dblcolon}
15950
15951defineMacro("\\Eqcolon", "\\html@mathml{" + "\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\dblcolon}}" + "{\\mathop{\\char\"2212\\char\"2237}}"); // \providecommand*\colonapprox{\vcentcolon\mathrel{\mkern-1.2mu}\approx}
15952
15953defineMacro("\\colonapprox", "\\html@mathml{" + "\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\approx}}" + "{\\mathop{\\char\"3a\\char\"2248}}"); // \providecommand*\Colonapprox{\dblcolon\mathrel{\mkern-1.2mu}\approx}
15954
15955defineMacro("\\Colonapprox", "\\html@mathml{" + "\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\approx}}" + "{\\mathop{\\char\"2237\\char\"2248}}"); // \providecommand*\colonsim{\vcentcolon\mathrel{\mkern-1.2mu}\sim}
15956
15957defineMacro("\\colonsim", "\\html@mathml{" + "\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\sim}}" + "{\\mathop{\\char\"3a\\char\"223c}}"); // \providecommand*\Colonsim{\dblcolon\mathrel{\mkern-1.2mu}\sim}
15958
15959defineMacro("\\Colonsim", "\\html@mathml{" + "\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\sim}}" + "{\\mathop{\\char\"2237\\char\"223c}}"); // Some Unicode characters are implemented with macros to mathtools functions.
15960
15961defineMacro("\u2237", "\\dblcolon"); // ::
15962
15963defineMacro("\u2239", "\\eqcolon"); // -:
15964
15965defineMacro("\u2254", "\\coloneqq"); // :=
15966
15967defineMacro("\u2255", "\\eqqcolon"); // =:
15968
15969defineMacro("\u2A74", "\\Coloneqq"); // ::=
15970//////////////////////////////////////////////////////////////////////
15971// colonequals.sty
15972// Alternate names for mathtools's macros:
15973
15974defineMacro("\\ratio", "\\vcentcolon");
15975defineMacro("\\coloncolon", "\\dblcolon");
15976defineMacro("\\colonequals", "\\coloneqq");
15977defineMacro("\\coloncolonequals", "\\Coloneqq");
15978defineMacro("\\equalscolon", "\\eqqcolon");
15979defineMacro("\\equalscoloncolon", "\\Eqqcolon");
15980defineMacro("\\colonminus", "\\coloneq");
15981defineMacro("\\coloncolonminus", "\\Coloneq");
15982defineMacro("\\minuscolon", "\\eqcolon");
15983defineMacro("\\minuscoloncolon", "\\Eqcolon"); // \colonapprox name is same in mathtools and colonequals.
15984
15985defineMacro("\\coloncolonapprox", "\\Colonapprox"); // \colonsim name is same in mathtools and colonequals.
15986
15987defineMacro("\\coloncolonsim", "\\Colonsim"); // Additional macros, implemented by analogy with mathtools definitions:
15988
15989defineMacro("\\simcolon", "\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\vcentcolon}");
15990defineMacro("\\simcoloncolon", "\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\dblcolon}");
15991defineMacro("\\approxcolon", "\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\vcentcolon}");
15992defineMacro("\\approxcoloncolon", "\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\dblcolon}"); // Present in newtxmath, pxfonts and txfonts
15993
15994defineMacro("\\notni", "\\html@mathml{\\not\\ni}{\\mathrel{\\char`\u220C}}");
15995defineMacro("\\limsup", "\\DOTSB\\operatorname*{lim\\,sup}");
15996defineMacro("\\liminf", "\\DOTSB\\operatorname*{lim\\,inf}"); //////////////////////////////////////////////////////////////////////
15997// From amsopn.sty
15998
15999defineMacro("\\injlim", "\\DOTSB\\operatorname*{inj\\,lim}");
16000defineMacro("\\projlim", "\\DOTSB\\operatorname*{proj\\,lim}");
16001defineMacro("\\varlimsup", "\\DOTSB\\operatorname*{\\overline{lim}}");
16002defineMacro("\\varliminf", "\\DOTSB\\operatorname*{\\underline{lim}}");
16003defineMacro("\\varinjlim", "\\DOTSB\\operatorname*{\\underrightarrow{lim}}");
16004defineMacro("\\varprojlim", "\\DOTSB\\operatorname*{\\underleftarrow{lim}}"); //////////////////////////////////////////////////////////////////////
16005// MathML alternates for KaTeX glyphs in the Unicode private area
16006
16007defineMacro("\\gvertneqq", "\\html@mathml{\\@gvertneqq}{\u2269}");
16008defineMacro("\\lvertneqq", "\\html@mathml{\\@lvertneqq}{\u2268}");
16009defineMacro("\\ngeqq", "\\html@mathml{\\@ngeqq}{\u2271}");
16010defineMacro("\\ngeqslant", "\\html@mathml{\\@ngeqslant}{\u2271}");
16011defineMacro("\\nleqq", "\\html@mathml{\\@nleqq}{\u2270}");
16012defineMacro("\\nleqslant", "\\html@mathml{\\@nleqslant}{\u2270}");
16013defineMacro("\\nshortmid", "\\html@mathml{\\@nshortmid}{∤}");
16014defineMacro("\\nshortparallel", "\\html@mathml{\\@nshortparallel}{∦}");
16015defineMacro("\\nsubseteqq", "\\html@mathml{\\@nsubseteqq}{\u2288}");
16016defineMacro("\\nsupseteqq", "\\html@mathml{\\@nsupseteqq}{\u2289}");
16017defineMacro("\\varsubsetneq", "\\html@mathml{\\@varsubsetneq}{⊊}");
16018defineMacro("\\varsubsetneqq", "\\html@mathml{\\@varsubsetneqq}{⫋}");
16019defineMacro("\\varsupsetneq", "\\html@mathml{\\@varsupsetneq}{⊋}");
16020defineMacro("\\varsupsetneqq", "\\html@mathml{\\@varsupsetneqq}{⫌}");
16021defineMacro("\\imath", "\\html@mathml{\\@imath}{\u0131}");
16022defineMacro("\\jmath", "\\html@mathml{\\@jmath}{\u0237}"); //////////////////////////////////////////////////////////////////////
16023// stmaryrd and semantic
16024// The stmaryrd and semantic packages render the next four items by calling a
16025// glyph. Those glyphs do not exist in the KaTeX fonts. Hence the macros.
16026
16027defineMacro("\\llbracket", "\\html@mathml{" + "\\mathopen{[\\mkern-3.2mu[}}" + "{\\mathopen{\\char`\u27E6}}");
16028defineMacro("\\rrbracket", "\\html@mathml{" + "\\mathclose{]\\mkern-3.2mu]}}" + "{\\mathclose{\\char`\u27E7}}");
16029defineMacro("\u27E6", "\\llbracket"); // blackboard bold [
16030
16031defineMacro("\u27E7", "\\rrbracket"); // blackboard bold ]
16032
16033defineMacro("\\lBrace", "\\html@mathml{" + "\\mathopen{\\{\\mkern-3.2mu[}}" + "{\\mathopen{\\char`\u2983}}");
16034defineMacro("\\rBrace", "\\html@mathml{" + "\\mathclose{]\\mkern-3.2mu\\}}}" + "{\\mathclose{\\char`\u2984}}");
16035defineMacro("\u2983", "\\lBrace"); // blackboard bold {
16036
16037defineMacro("\u2984", "\\rBrace"); // blackboard bold }
16038// TODO: Create variable sized versions of the last two items. I believe that
16039// will require new font glyphs.
16040// The stmaryrd function `\minuso` provides a "Plimsoll" symbol that
16041// superimposes the characters \circ and \mathminus. Used in chemistry.
16042
16043defineMacro("\\minuso", "\\mathbin{\\html@mathml{" + "{\\mathrlap{\\mathchoice{\\kern{0.145em}}{\\kern{0.145em}}" + "{\\kern{0.1015em}}{\\kern{0.0725em}}\\circ}{-}}}" + "{\\char`⦵}}");
16044defineMacro("⦵", "\\minuso"); //////////////////////////////////////////////////////////////////////
16045// texvc.sty
16046// The texvc package contains macros available in mediawiki pages.
16047// We omit the functions deprecated at
16048// https://en.wikipedia.org/wiki/Help:Displaying_a_formula#Deprecated_syntax
16049// We also omit texvc's \O, which conflicts with \text{\O}
16050
16051defineMacro("\\darr", "\\downarrow");
16052defineMacro("\\dArr", "\\Downarrow");
16053defineMacro("\\Darr", "\\Downarrow");
16054defineMacro("\\lang", "\\langle");
16055defineMacro("\\rang", "\\rangle");
16056defineMacro("\\uarr", "\\uparrow");
16057defineMacro("\\uArr", "\\Uparrow");
16058defineMacro("\\Uarr", "\\Uparrow");
16059defineMacro("\\N", "\\mathbb{N}");
16060defineMacro("\\R", "\\mathbb{R}");
16061defineMacro("\\Z", "\\mathbb{Z}");
16062defineMacro("\\alef", "\\aleph");
16063defineMacro("\\alefsym", "\\aleph");
16064defineMacro("\\Alpha", "\\mathrm{A}");
16065defineMacro("\\Beta", "\\mathrm{B}");
16066defineMacro("\\bull", "\\bullet");
16067defineMacro("\\Chi", "\\mathrm{X}");
16068defineMacro("\\clubs", "\\clubsuit");
16069defineMacro("\\cnums", "\\mathbb{C}");
16070defineMacro("\\Complex", "\\mathbb{C}");
16071defineMacro("\\Dagger", "\\ddagger");
16072defineMacro("\\diamonds", "\\diamondsuit");
16073defineMacro("\\empty", "\\emptyset");
16074defineMacro("\\Epsilon", "\\mathrm{E}");
16075defineMacro("\\Eta", "\\mathrm{H}");
16076defineMacro("\\exist", "\\exists");
16077defineMacro("\\harr", "\\leftrightarrow");
16078defineMacro("\\hArr", "\\Leftrightarrow");
16079defineMacro("\\Harr", "\\Leftrightarrow");
16080defineMacro("\\hearts", "\\heartsuit");
16081defineMacro("\\image", "\\Im");
16082defineMacro("\\infin", "\\infty");
16083defineMacro("\\Iota", "\\mathrm{I}");
16084defineMacro("\\isin", "\\in");
16085defineMacro("\\Kappa", "\\mathrm{K}");
16086defineMacro("\\larr", "\\leftarrow");
16087defineMacro("\\lArr", "\\Leftarrow");
16088defineMacro("\\Larr", "\\Leftarrow");
16089defineMacro("\\lrarr", "\\leftrightarrow");
16090defineMacro("\\lrArr", "\\Leftrightarrow");
16091defineMacro("\\Lrarr", "\\Leftrightarrow");
16092defineMacro("\\Mu", "\\mathrm{M}");
16093defineMacro("\\natnums", "\\mathbb{N}");
16094defineMacro("\\Nu", "\\mathrm{N}");
16095defineMacro("\\Omicron", "\\mathrm{O}");
16096defineMacro("\\plusmn", "\\pm");
16097defineMacro("\\rarr", "\\rightarrow");
16098defineMacro("\\rArr", "\\Rightarrow");
16099defineMacro("\\Rarr", "\\Rightarrow");
16100defineMacro("\\real", "\\Re");
16101defineMacro("\\reals", "\\mathbb{R}");
16102defineMacro("\\Reals", "\\mathbb{R}");
16103defineMacro("\\Rho", "\\mathrm{P}");
16104defineMacro("\\sdot", "\\cdot");
16105defineMacro("\\sect", "\\S");
16106defineMacro("\\spades", "\\spadesuit");
16107defineMacro("\\sub", "\\subset");
16108defineMacro("\\sube", "\\subseteq");
16109defineMacro("\\supe", "\\supseteq");
16110defineMacro("\\Tau", "\\mathrm{T}");
16111defineMacro("\\thetasym", "\\vartheta"); // TODO: defineMacro("\\varcoppa", "\\\mbox{\\coppa}");
16112
16113defineMacro("\\weierp", "\\wp");
16114defineMacro("\\Zeta", "\\mathrm{Z}"); //////////////////////////////////////////////////////////////////////
16115// statmath.sty
16116// https://ctan.math.illinois.edu/macros/latex/contrib/statmath/statmath.pdf
16117
16118defineMacro("\\argmin", "\\DOTSB\\operatorname*{arg\\,min}");
16119defineMacro("\\argmax", "\\DOTSB\\operatorname*{arg\\,max}");
16120defineMacro("\\plim", "\\DOTSB\\mathop{\\operatorname{plim}}\\limits"); //////////////////////////////////////////////////////////////////////
16121// braket.sty
16122// http://ctan.math.washington.edu/tex-archive/macros/latex/contrib/braket/braket.pdf
16123
16124defineMacro("\\bra", "\\mathinner{\\langle{#1}|}");
16125defineMacro("\\ket", "\\mathinner{|{#1}\\rangle}");
16126defineMacro("\\braket", "\\mathinner{\\langle{#1}\\rangle}");
16127defineMacro("\\Bra", "\\left\\langle#1\\right|");
16128defineMacro("\\Ket", "\\left|#1\\right\\rangle"); //////////////////////////////////////////////////////////////////////
16129// actuarialangle.dtx
16130
16131defineMacro("\\angln", "{\\angl n}"); // Custom Khan Academy colors, should be moved to an optional package
16132
16133defineMacro("\\blue", "\\textcolor{##6495ed}{#1}");
16134defineMacro("\\orange", "\\textcolor{##ffa500}{#1}");
16135defineMacro("\\pink", "\\textcolor{##ff00af}{#1}");
16136defineMacro("\\red", "\\textcolor{##df0030}{#1}");
16137defineMacro("\\green", "\\textcolor{##28ae7b}{#1}");
16138defineMacro("\\gray", "\\textcolor{gray}{#1}");
16139defineMacro("\\purple", "\\textcolor{##9d38bd}{#1}");
16140defineMacro("\\blueA", "\\textcolor{##ccfaff}{#1}");
16141defineMacro("\\blueB", "\\textcolor{##80f6ff}{#1}");
16142defineMacro("\\blueC", "\\textcolor{##63d9ea}{#1}");
16143defineMacro("\\blueD", "\\textcolor{##11accd}{#1}");
16144defineMacro("\\blueE", "\\textcolor{##0c7f99}{#1}");
16145defineMacro("\\tealA", "\\textcolor{##94fff5}{#1}");
16146defineMacro("\\tealB", "\\textcolor{##26edd5}{#1}");
16147defineMacro("\\tealC", "\\textcolor{##01d1c1}{#1}");
16148defineMacro("\\tealD", "\\textcolor{##01a995}{#1}");
16149defineMacro("\\tealE", "\\textcolor{##208170}{#1}");
16150defineMacro("\\greenA", "\\textcolor{##b6ffb0}{#1}");
16151defineMacro("\\greenB", "\\textcolor{##8af281}{#1}");
16152defineMacro("\\greenC", "\\textcolor{##74cf70}{#1}");
16153defineMacro("\\greenD", "\\textcolor{##1fab54}{#1}");
16154defineMacro("\\greenE", "\\textcolor{##0d923f}{#1}");
16155defineMacro("\\goldA", "\\textcolor{##ffd0a9}{#1}");
16156defineMacro("\\goldB", "\\textcolor{##ffbb71}{#1}");
16157defineMacro("\\goldC", "\\textcolor{##ff9c39}{#1}");
16158defineMacro("\\goldD", "\\textcolor{##e07d10}{#1}");
16159defineMacro("\\goldE", "\\textcolor{##a75a05}{#1}");
16160defineMacro("\\redA", "\\textcolor{##fca9a9}{#1}");
16161defineMacro("\\redB", "\\textcolor{##ff8482}{#1}");
16162defineMacro("\\redC", "\\textcolor{##f9685d}{#1}");
16163defineMacro("\\redD", "\\textcolor{##e84d39}{#1}");
16164defineMacro("\\redE", "\\textcolor{##bc2612}{#1}");
16165defineMacro("\\maroonA", "\\textcolor{##ffbde0}{#1}");
16166defineMacro("\\maroonB", "\\textcolor{##ff92c6}{#1}");
16167defineMacro("\\maroonC", "\\textcolor{##ed5fa6}{#1}");
16168defineMacro("\\maroonD", "\\textcolor{##ca337c}{#1}");
16169defineMacro("\\maroonE", "\\textcolor{##9e034e}{#1}");
16170defineMacro("\\purpleA", "\\textcolor{##ddd7ff}{#1}");
16171defineMacro("\\purpleB", "\\textcolor{##c6b9fc}{#1}");
16172defineMacro("\\purpleC", "\\textcolor{##aa87ff}{#1}");
16173defineMacro("\\purpleD", "\\textcolor{##7854ab}{#1}");
16174defineMacro("\\purpleE", "\\textcolor{##543b78}{#1}");
16175defineMacro("\\mintA", "\\textcolor{##f5f9e8}{#1}");
16176defineMacro("\\mintB", "\\textcolor{##edf2df}{#1}");
16177defineMacro("\\mintC", "\\textcolor{##e0e5cc}{#1}");
16178defineMacro("\\grayA", "\\textcolor{##f6f7f7}{#1}");
16179defineMacro("\\grayB", "\\textcolor{##f0f1f2}{#1}");
16180defineMacro("\\grayC", "\\textcolor{##e3e5e6}{#1}");
16181defineMacro("\\grayD", "\\textcolor{##d6d8da}{#1}");
16182defineMacro("\\grayE", "\\textcolor{##babec2}{#1}");
16183defineMacro("\\grayF", "\\textcolor{##888d93}{#1}");
16184defineMacro("\\grayG", "\\textcolor{##626569}{#1}");
16185defineMacro("\\grayH", "\\textcolor{##3b3e40}{#1}");
16186defineMacro("\\grayI", "\\textcolor{##21242c}{#1}");
16187defineMacro("\\kaBlue", "\\textcolor{##314453}{#1}");
16188defineMacro("\\kaGreen", "\\textcolor{##71B307}{#1}");
16189;// CONCATENATED MODULE: ./src/MacroExpander.js
16190/**
16191 * This file contains the “gullet” where macros are expanded
16192 * until only non-macro tokens remain.
16193 */
16194
16195
16196
16197
16198
16199
16200
16201// List of commands that act like macros but aren't defined as a macro,
16202// function, or symbol.  Used in `isDefined`.
16203var implicitCommands = {
16204  "^": true,
16205  // Parser.js
16206  "_": true,
16207  // Parser.js
16208  "\\limits": true,
16209  // Parser.js
16210  "\\nolimits": true // Parser.js
16211
16212};
16213
16214var MacroExpander = /*#__PURE__*/function () {
16215  function MacroExpander(input, settings, mode) {
16216    this.settings = void 0;
16217    this.expansionCount = void 0;
16218    this.lexer = void 0;
16219    this.macros = void 0;
16220    this.stack = void 0;
16221    this.mode = void 0;
16222    this.settings = settings;
16223    this.expansionCount = 0;
16224    this.feed(input); // Make new global namespace
16225
16226    this.macros = new Namespace(src_macros, settings.macros);
16227    this.mode = mode;
16228    this.stack = []; // contains tokens in REVERSE order
16229  }
16230  /**
16231   * Feed a new input string to the same MacroExpander
16232   * (with existing macros etc.).
16233   */
16234
16235
16236  var _proto = MacroExpander.prototype;
16237
16238  _proto.feed = function feed(input) {
16239    this.lexer = new Lexer(input, this.settings);
16240  }
16241  /**
16242   * Switches between "text" and "math" modes.
16243   */
16244  ;
16245
16246  _proto.switchMode = function switchMode(newMode) {
16247    this.mode = newMode;
16248  }
16249  /**
16250   * Start a new group nesting within all namespaces.
16251   */
16252  ;
16253
16254  _proto.beginGroup = function beginGroup() {
16255    this.macros.beginGroup();
16256  }
16257  /**
16258   * End current group nesting within all namespaces.
16259   */
16260  ;
16261
16262  _proto.endGroup = function endGroup() {
16263    this.macros.endGroup();
16264  }
16265  /**
16266   * Ends all currently nested groups (if any), restoring values before the
16267   * groups began.  Useful in case of an error in the middle of parsing.
16268   */
16269  ;
16270
16271  _proto.endGroups = function endGroups() {
16272    this.macros.endGroups();
16273  }
16274  /**
16275   * Returns the topmost token on the stack, without expanding it.
16276   * Similar in behavior to TeX's `\futurelet`.
16277   */
16278  ;
16279
16280  _proto.future = function future() {
16281    if (this.stack.length === 0) {
16282      this.pushToken(this.lexer.lex());
16283    }
16284
16285    return this.stack[this.stack.length - 1];
16286  }
16287  /**
16288   * Remove and return the next unexpanded token.
16289   */
16290  ;
16291
16292  _proto.popToken = function popToken() {
16293    this.future(); // ensure non-empty stack
16294
16295    return this.stack.pop();
16296  }
16297  /**
16298   * Add a given token to the token stack.  In particular, this get be used
16299   * to put back a token returned from one of the other methods.
16300   */
16301  ;
16302
16303  _proto.pushToken = function pushToken(token) {
16304    this.stack.push(token);
16305  }
16306  /**
16307   * Append an array of tokens to the token stack.
16308   */
16309  ;
16310
16311  _proto.pushTokens = function pushTokens(tokens) {
16312    var _this$stack;
16313
16314    (_this$stack = this.stack).push.apply(_this$stack, tokens);
16315  }
16316  /**
16317   * Find an macro argument without expanding tokens and append the array of
16318   * tokens to the token stack. Uses Token as a container for the result.
16319   */
16320  ;
16321
16322  _proto.scanArgument = function scanArgument(isOptional) {
16323    var start;
16324    var end;
16325    var tokens;
16326
16327    if (isOptional) {
16328      this.consumeSpaces(); // \@ifnextchar gobbles any space following it
16329
16330      if (this.future().text !== "[") {
16331        return null;
16332      }
16333
16334      start = this.popToken(); // don't include [ in tokens
16335
16336      var _this$consumeArg = this.consumeArg(["]"]);
16337
16338      tokens = _this$consumeArg.tokens;
16339      end = _this$consumeArg.end;
16340    } else {
16341      var _this$consumeArg2 = this.consumeArg();
16342
16343      tokens = _this$consumeArg2.tokens;
16344      start = _this$consumeArg2.start;
16345      end = _this$consumeArg2.end;
16346    } // indicate the end of an argument
16347
16348
16349    this.pushToken(new Token("EOF", end.loc));
16350    this.pushTokens(tokens);
16351    return start.range(end, "");
16352  }
16353  /**
16354   * Consume all following space tokens, without expansion.
16355   */
16356  ;
16357
16358  _proto.consumeSpaces = function consumeSpaces() {
16359    for (;;) {
16360      var token = this.future();
16361
16362      if (token.text === " ") {
16363        this.stack.pop();
16364      } else {
16365        break;
16366      }
16367    }
16368  }
16369  /**
16370   * Consume an argument from the token stream, and return the resulting array
16371   * of tokens and start/end token.
16372   */
16373  ;
16374
16375  _proto.consumeArg = function consumeArg(delims) {
16376    // The argument for a delimited parameter is the shortest (possibly
16377    // empty) sequence of tokens with properly nested {...} groups that is
16378    // followed ... by this particular list of non-parameter tokens.
16379    // The argument for an undelimited parameter is the next nonblank
16380    // token, unless that token is ‘{’, when the argument will be the
16381    // entire {...} group that follows.
16382    var tokens = [];
16383    var isDelimited = delims && delims.length > 0;
16384
16385    if (!isDelimited) {
16386      // Ignore spaces between arguments.  As the TeXbook says:
16387      // "After you have said ‘\def\row#1#2{...}’, you are allowed to
16388      //  put spaces between the arguments (e.g., ‘\row x n’), because
16389      //  TeX doesn’t use single spaces as undelimited arguments."
16390      this.consumeSpaces();
16391    }
16392
16393    var start = this.future();
16394    var tok;
16395    var depth = 0;
16396    var match = 0;
16397
16398    do {
16399      tok = this.popToken();
16400      tokens.push(tok);
16401
16402      if (tok.text === "{") {
16403        ++depth;
16404      } else if (tok.text === "}") {
16405        --depth;
16406
16407        if (depth === -1) {
16408          throw new src_ParseError("Extra }", tok);
16409        }
16410      } else if (tok.text === "EOF") {
16411        throw new src_ParseError("Unexpected end of input in a macro argument" + ", expected '" + (delims && isDelimited ? delims[match] : "}") + "'", tok);
16412      }
16413
16414      if (delims && isDelimited) {
16415        if ((depth === 0 || depth === 1 && delims[match] === "{") && tok.text === delims[match]) {
16416          ++match;
16417
16418          if (match === delims.length) {
16419            // don't include delims in tokens
16420            tokens.splice(-match, match);
16421            break;
16422          }
16423        } else {
16424          match = 0;
16425        }
16426      }
16427    } while (depth !== 0 || isDelimited); // If the argument found ... has the form ‘{<nested tokens>}’,
16428    // ... the outermost braces enclosing the argument are removed
16429
16430
16431    if (start.text === "{" && tokens[tokens.length - 1].text === "}") {
16432      tokens.pop();
16433      tokens.shift();
16434    }
16435
16436    tokens.reverse(); // to fit in with stack order
16437
16438    return {
16439      tokens: tokens,
16440      start: start,
16441      end: tok
16442    };
16443  }
16444  /**
16445   * Consume the specified number of (delimited) arguments from the token
16446   * stream and return the resulting array of arguments.
16447   */
16448  ;
16449
16450  _proto.consumeArgs = function consumeArgs(numArgs, delimiters) {
16451    if (delimiters) {
16452      if (delimiters.length !== numArgs + 1) {
16453        throw new src_ParseError("The length of delimiters doesn't match the number of args!");
16454      }
16455
16456      var delims = delimiters[0];
16457
16458      for (var i = 0; i < delims.length; i++) {
16459        var tok = this.popToken();
16460
16461        if (delims[i] !== tok.text) {
16462          throw new src_ParseError("Use of the macro doesn't match its definition", tok);
16463        }
16464      }
16465    }
16466
16467    var args = [];
16468
16469    for (var _i = 0; _i < numArgs; _i++) {
16470      args.push(this.consumeArg(delimiters && delimiters[_i + 1]).tokens);
16471    }
16472
16473    return args;
16474  }
16475  /**
16476   * Expand the next token only once if possible.
16477   *
16478   * If the token is expanded, the resulting tokens will be pushed onto
16479   * the stack in reverse order and will be returned as an array,
16480   * also in reverse order.
16481   *
16482   * If not, the next token will be returned without removing it
16483   * from the stack.  This case can be detected by a `Token` return value
16484   * instead of an `Array` return value.
16485   *
16486   * In either case, the next token will be on the top of the stack,
16487   * or the stack will be empty.
16488   *
16489   * Used to implement `expandAfterFuture` and `expandNextToken`.
16490   *
16491   * If expandableOnly, only expandable tokens are expanded and
16492   * an undefined control sequence results in an error.
16493   */
16494  ;
16495
16496  _proto.expandOnce = function expandOnce(expandableOnly) {
16497    var topToken = this.popToken();
16498    var name = topToken.text;
16499    var expansion = !topToken.noexpand ? this._getExpansion(name) : null;
16500
16501    if (expansion == null || expandableOnly && expansion.unexpandable) {
16502      if (expandableOnly && expansion == null && name[0] === "\\" && !this.isDefined(name)) {
16503        throw new src_ParseError("Undefined control sequence: " + name);
16504      }
16505
16506      this.pushToken(topToken);
16507      return topToken;
16508    }
16509
16510    this.expansionCount++;
16511
16512    if (this.expansionCount > this.settings.maxExpand) {
16513      throw new src_ParseError("Too many expansions: infinite loop or " + "need to increase maxExpand setting");
16514    }
16515
16516    var tokens = expansion.tokens;
16517    var args = this.consumeArgs(expansion.numArgs, expansion.delimiters);
16518
16519    if (expansion.numArgs) {
16520      // paste arguments in place of the placeholders
16521      tokens = tokens.slice(); // make a shallow copy
16522
16523      for (var i = tokens.length - 1; i >= 0; --i) {
16524        var tok = tokens[i];
16525
16526        if (tok.text === "#") {
16527          if (i === 0) {
16528            throw new src_ParseError("Incomplete placeholder at end of macro body", tok);
16529          }
16530
16531          tok = tokens[--i]; // next token on stack
16532
16533          if (tok.text === "#") {
16534            // ## → #
16535            tokens.splice(i + 1, 1); // drop first #
16536          } else if (/^[1-9]$/.test(tok.text)) {
16537            var _tokens;
16538
16539            // replace the placeholder with the indicated argument
16540            (_tokens = tokens).splice.apply(_tokens, [i, 2].concat(args[+tok.text - 1]));
16541          } else {
16542            throw new src_ParseError("Not a valid argument number", tok);
16543          }
16544        }
16545      }
16546    } // Concatenate expansion onto top of stack.
16547
16548
16549    this.pushTokens(tokens);
16550    return tokens;
16551  }
16552  /**
16553   * Expand the next token only once (if possible), and return the resulting
16554   * top token on the stack (without removing anything from the stack).
16555   * Similar in behavior to TeX's `\expandafter\futurelet`.
16556   * Equivalent to expandOnce() followed by future().
16557   */
16558  ;
16559
16560  _proto.expandAfterFuture = function expandAfterFuture() {
16561    this.expandOnce();
16562    return this.future();
16563  }
16564  /**
16565   * Recursively expand first token, then return first non-expandable token.
16566   */
16567  ;
16568
16569  _proto.expandNextToken = function expandNextToken() {
16570    for (;;) {
16571      var expanded = this.expandOnce(); // expandOnce returns Token if and only if it's fully expanded.
16572
16573      if (expanded instanceof Token) {
16574        // the token after \noexpand is interpreted as if its meaning
16575        // were ‘\relax’
16576        if (expanded.treatAsRelax) {
16577          expanded.text = "\\relax";
16578        }
16579
16580        return this.stack.pop(); // === expanded
16581      }
16582    } // Flow unable to figure out that this pathway is impossible.
16583    // https://github.com/facebook/flow/issues/4808
16584
16585
16586    throw new Error(); // eslint-disable-line no-unreachable
16587  }
16588  /**
16589   * Fully expand the given macro name and return the resulting list of
16590   * tokens, or return `undefined` if no such macro is defined.
16591   */
16592  ;
16593
16594  _proto.expandMacro = function expandMacro(name) {
16595    return this.macros.has(name) ? this.expandTokens([new Token(name)]) : undefined;
16596  }
16597  /**
16598   * Fully expand the given token stream and return the resulting list of tokens
16599   */
16600  ;
16601
16602  _proto.expandTokens = function expandTokens(tokens) {
16603    var output = [];
16604    var oldStackLength = this.stack.length;
16605    this.pushTokens(tokens);
16606
16607    while (this.stack.length > oldStackLength) {
16608      var expanded = this.expandOnce(true); // expand only expandable tokens
16609      // expandOnce returns Token if and only if it's fully expanded.
16610
16611      if (expanded instanceof Token) {
16612        if (expanded.treatAsRelax) {
16613          // the expansion of \noexpand is the token itself
16614          expanded.noexpand = false;
16615          expanded.treatAsRelax = false;
16616        }
16617
16618        output.push(this.stack.pop());
16619      }
16620    }
16621
16622    return output;
16623  }
16624  /**
16625   * Fully expand the given macro name and return the result as a string,
16626   * or return `undefined` if no such macro is defined.
16627   */
16628  ;
16629
16630  _proto.expandMacroAsText = function expandMacroAsText(name) {
16631    var tokens = this.expandMacro(name);
16632
16633    if (tokens) {
16634      return tokens.map(function (token) {
16635        return token.text;
16636      }).join("");
16637    } else {
16638      return tokens;
16639    }
16640  }
16641  /**
16642   * Returns the expanded macro as a reversed array of tokens and a macro
16643   * argument count.  Or returns `null` if no such macro.
16644   */
16645  ;
16646
16647  _proto._getExpansion = function _getExpansion(name) {
16648    var definition = this.macros.get(name);
16649
16650    if (definition == null) {
16651      // mainly checking for undefined here
16652      return definition;
16653    } // If a single character has an associated catcode other than 13
16654    // (active character), then don't expand it.
16655
16656
16657    if (name.length === 1) {
16658      var catcode = this.lexer.catcodes[name];
16659
16660      if (catcode != null && catcode !== 13) {
16661        return;
16662      }
16663    }
16664
16665    var expansion = typeof definition === "function" ? definition(this) : definition;
16666
16667    if (typeof expansion === "string") {
16668      var numArgs = 0;
16669
16670      if (expansion.indexOf("#") !== -1) {
16671        var stripped = expansion.replace(/##/g, "");
16672
16673        while (stripped.indexOf("#" + (numArgs + 1)) !== -1) {
16674          ++numArgs;
16675        }
16676      }
16677
16678      var bodyLexer = new Lexer(expansion, this.settings);
16679      var tokens = [];
16680      var tok = bodyLexer.lex();
16681
16682      while (tok.text !== "EOF") {
16683        tokens.push(tok);
16684        tok = bodyLexer.lex();
16685      }
16686
16687      tokens.reverse(); // to fit in with stack using push and pop
16688
16689      var expanded = {
16690        tokens: tokens,
16691        numArgs: numArgs
16692      };
16693      return expanded;
16694    }
16695
16696    return expansion;
16697  }
16698  /**
16699   * Determine whether a command is currently "defined" (has some
16700   * functionality), meaning that it's a macro (in the current group),
16701   * a function, a symbol, or one of the special commands listed in
16702   * `implicitCommands`.
16703   */
16704  ;
16705
16706  _proto.isDefined = function isDefined(name) {
16707    return this.macros.has(name) || src_functions.hasOwnProperty(name) || src_symbols.math.hasOwnProperty(name) || src_symbols.text.hasOwnProperty(name) || implicitCommands.hasOwnProperty(name);
16708  }
16709  /**
16710   * Determine whether a command is expandable.
16711   */
16712  ;
16713
16714  _proto.isExpandable = function isExpandable(name) {
16715    var macro = this.macros.get(name);
16716    return macro != null ? typeof macro === "string" || typeof macro === "function" || !macro.unexpandable : src_functions.hasOwnProperty(name) && !src_functions[name].primitive;
16717  };
16718
16719  return MacroExpander;
16720}();
16721
16722
16723;// CONCATENATED MODULE: ./src/Parser.js
16724/* eslint no-constant-condition:0 */
16725
16726
16727
16728
16729
16730
16731
16732
16733
16734 // Pre-evaluate both modules as unicodeSymbols require String.normalize()
16735
16736var unicodeAccents = {
16737  "́": {
16738    "text": "\\'",
16739    "math": "\\acute"
16740  },
16741  "̀": {
16742    "text": "\\`",
16743    "math": "\\grave"
16744  },
16745  "̈": {
16746    "text": "\\\"",
16747    "math": "\\ddot"
16748  },
16749  "̃": {
16750    "text": "\\~",
16751    "math": "\\tilde"
16752  },
16753  "̄": {
16754    "text": "\\=",
16755    "math": "\\bar"
16756  },
16757  "̆": {
16758    "text": "\\u",
16759    "math": "\\breve"
16760  },
16761  "̌": {
16762    "text": "\\v",
16763    "math": "\\check"
16764  },
16765  "̂": {
16766    "text": "\\^",
16767    "math": "\\hat"
16768  },
16769  "̇": {
16770    "text": "\\.",
16771    "math": "\\dot"
16772  },
16773  "̊": {
16774    "text": "\\r",
16775    "math": "\\mathring"
16776  },
16777  "̋": {
16778    "text": "\\H"
16779  },
16780  "̧": {
16781    "text": "\\c"
16782  }
16783};
16784var unicodeSymbols = {
16785  "á": "á",
16786  "à": "à",
16787  "ä": "ä",
16788  "ǟ": "ǟ",
16789  "ã": "ã",
16790  "ā": "ā",
16791  "ă": "ă",
16792  "ắ": "ắ",
16793  "ằ": "ằ",
16794  "ẵ": "ẵ",
16795  "ǎ": "ǎ",
16796  "â": "â",
16797  "ấ": "ấ",
16798  "ầ": "ầ",
16799  "ẫ": "ẫ",
16800  "ȧ": "ȧ",
16801  "ǡ": "ǡ",
16802  "å": "å",
16803  "ǻ": "ǻ",
16804  "ḃ": "ḃ",
16805  "ć": "ć",
16806  "ḉ": "ḉ",
16807  "č": "č",
16808  "ĉ": "ĉ",
16809  "ċ": "ċ",
16810  "ç": "ç",
16811  "ď": "ď",
16812  "ḋ": "ḋ",
16813  "ḑ": "ḑ",
16814  "é": "é",
16815  "è": "è",
16816  "ë": "ë",
16817  "ẽ": "ẽ",
16818  "ē": "ē",
16819  "ḗ": "ḗ",
16820  "ḕ": "ḕ",
16821  "ĕ": "ĕ",
16822  "ḝ": "ḝ",
16823  "ě": "ě",
16824  "ê": "ê",
16825  "ế": "ế",
16826  "ề": "ề",
16827  "ễ": "ễ",
16828  "ė": "ė",
16829  "ȩ": "ȩ",
16830  "ḟ": "ḟ",
16831  "ǵ": "ǵ",
16832  "ḡ": "ḡ",
16833  "ğ": "ğ",
16834  "ǧ": "ǧ",
16835  "ĝ": "ĝ",
16836  "ġ": "ġ",
16837  "ģ": "ģ",
16838  "ḧ": "ḧ",
16839  "ȟ": "ȟ",
16840  "ĥ": "ĥ",
16841  "ḣ": "ḣ",
16842  "ḩ": "ḩ",
16843  "í": "í",
16844  "ì": "ì",
16845  "ï": "ï",
16846  "ḯ": "ḯ",
16847  "ĩ": "ĩ",
16848  "ī": "ī",
16849  "ĭ": "ĭ",
16850  "ǐ": "ǐ",
16851  "î": "î",
16852  "ǰ": "ǰ",
16853  "ĵ": "ĵ",
16854  "ḱ": "ḱ",
16855  "ǩ": "ǩ",
16856  "ķ": "ķ",
16857  "ĺ": "ĺ",
16858  "ľ": "ľ",
16859  "ļ": "ļ",
16860  "ḿ": "ḿ",
16861  "ṁ": "ṁ",
16862  "ń": "ń",
16863  "ǹ": "ǹ",
16864  "ñ": "ñ",
16865  "ň": "ň",
16866  "ṅ": "ṅ",
16867  "ņ": "ņ",
16868  "ó": "ó",
16869  "ò": "ò",
16870  "ö": "ö",
16871  "ȫ": "ȫ",
16872  "õ": "õ",
16873  "ṍ": "ṍ",
16874  "ṏ": "ṏ",
16875  "ȭ": "ȭ",
16876  "ō": "ō",
16877  "ṓ": "ṓ",
16878  "ṑ": "ṑ",
16879  "ŏ": "ŏ",
16880  "ǒ": "ǒ",
16881  "ô": "ô",
16882  "ố": "ố",
16883  "ồ": "ồ",
16884  "ỗ": "ỗ",
16885  "ȯ": "ȯ",
16886  "ȱ": "ȱ",
16887  "ő": "ő",
16888  "ṕ": "ṕ",
16889  "ṗ": "ṗ",
16890  "ŕ": "ŕ",
16891  "ř": "ř",
16892  "ṙ": "ṙ",
16893  "ŗ": "ŗ",
16894  "ś": "ś",
16895  "ṥ": "ṥ",
16896  "š": "š",
16897  "ṧ": "ṧ",
16898  "ŝ": "ŝ",
16899  "ṡ": "ṡ",
16900  "ş": "ş",
16901  "ẗ": "ẗ",
16902  "ť": "ť",
16903  "ṫ": "ṫ",
16904  "ţ": "ţ",
16905  "ú": "ú",
16906  "ù": "ù",
16907  "ü": "ü",
16908  "ǘ": "ǘ",
16909  "ǜ": "ǜ",
16910  "ǖ": "ǖ",
16911  "ǚ": "ǚ",
16912  "ũ": "ũ",
16913  "ṹ": "ṹ",
16914  "ū": "ū",
16915  "ṻ": "ṻ",
16916  "ŭ": "ŭ",
16917  "ǔ": "ǔ",
16918  "û": "û",
16919  "ů": "ů",
16920  "ű": "ű",
16921  "ṽ": "ṽ",
16922  "ẃ": "ẃ",
16923  "ẁ": "ẁ",
16924  "ẅ": "ẅ",
16925  "ŵ": "ŵ",
16926  "ẇ": "ẇ",
16927  "ẘ": "ẘ",
16928  "ẍ": "ẍ",
16929  "ẋ": "ẋ",
16930  "ý": "ý",
16931  "ỳ": "ỳ",
16932  "ÿ": "ÿ",
16933  "ỹ": "ỹ",
16934  "ȳ": "ȳ",
16935  "ŷ": "ŷ",
16936  "ẏ": "ẏ",
16937  "ẙ": "ẙ",
16938  "ź": "ź",
16939  "ž": "ž",
16940  "ẑ": "ẑ",
16941  "ż": "ż",
16942  "Á": "Á",
16943  "À": "À",
16944  "Ä": "Ä",
16945  "Ǟ": "Ǟ",
16946  "Ã": "Ã",
16947  "Ā": "Ā",
16948  "Ă": "Ă",
16949  "Ắ": "Ắ",
16950  "Ằ": "Ằ",
16951  "Ẵ": "Ẵ",
16952  "Ǎ": "Ǎ",
16953  "Â": "Â",
16954  "Ấ": "Ấ",
16955  "Ầ": "Ầ",
16956  "Ẫ": "Ẫ",
16957  "Ȧ": "Ȧ",
16958  "Ǡ": "Ǡ",
16959  "Å": "Å",
16960  "Ǻ": "Ǻ",
16961  "Ḃ": "Ḃ",
16962  "Ć": "Ć",
16963  "Ḉ": "Ḉ",
16964  "Č": "Č",
16965  "Ĉ": "Ĉ",
16966  "Ċ": "Ċ",
16967  "Ç": "Ç",
16968  "Ď": "Ď",
16969  "Ḋ": "Ḋ",
16970  "Ḑ": "Ḑ",
16971  "É": "É",
16972  "È": "È",
16973  "Ë": "Ë",
16974  "Ẽ": "Ẽ",
16975  "Ē": "Ē",
16976  "Ḗ": "Ḗ",
16977  "Ḕ": "Ḕ",
16978  "Ĕ": "Ĕ",
16979  "Ḝ": "Ḝ",
16980  "Ě": "Ě",
16981  "Ê": "Ê",
16982  "Ế": "Ế",
16983  "Ề": "Ề",
16984  "Ễ": "Ễ",
16985  "Ė": "Ė",
16986  "Ȩ": "Ȩ",
16987  "Ḟ": "Ḟ",
16988  "Ǵ": "Ǵ",
16989  "Ḡ": "Ḡ",
16990  "Ğ": "Ğ",
16991  "Ǧ": "Ǧ",
16992  "Ĝ": "Ĝ",
16993  "Ġ": "Ġ",
16994  "Ģ": "Ģ",
16995  "Ḧ": "Ḧ",
16996  "Ȟ": "Ȟ",
16997  "Ĥ": "Ĥ",
16998  "Ḣ": "Ḣ",
16999  "Ḩ": "Ḩ",
17000  "Í": "Í",
17001  "Ì": "Ì",
17002  "Ï": "Ï",
17003  "Ḯ": "Ḯ",
17004  "Ĩ": "Ĩ",
17005  "Ī": "Ī",
17006  "Ĭ": "Ĭ",
17007  "Ǐ": "Ǐ",
17008  "Î": "Î",
17009  "İ": "İ",
17010  "Ĵ": "Ĵ",
17011  "Ḱ": "Ḱ",
17012  "Ǩ": "Ǩ",
17013  "Ķ": "Ķ",
17014  "Ĺ": "Ĺ",
17015  "Ľ": "Ľ",
17016  "Ļ": "Ļ",
17017  "Ḿ": "Ḿ",
17018  "Ṁ": "Ṁ",
17019  "Ń": "Ń",
17020  "Ǹ": "Ǹ",
17021  "Ñ": "Ñ",
17022  "Ň": "Ň",
17023  "Ṅ": "Ṅ",
17024  "Ņ": "Ņ",
17025  "Ó": "Ó",
17026  "Ò": "Ò",
17027  "Ö": "Ö",
17028  "Ȫ": "Ȫ",
17029  "Õ": "Õ",
17030  "Ṍ": "Ṍ",
17031  "Ṏ": "Ṏ",
17032  "Ȭ": "Ȭ",
17033  "Ō": "Ō",
17034  "Ṓ": "Ṓ",
17035  "Ṑ": "Ṑ",
17036  "Ŏ": "Ŏ",
17037  "Ǒ": "Ǒ",
17038  "Ô": "Ô",
17039  "Ố": "Ố",
17040  "Ồ": "Ồ",
17041  "Ỗ": "Ỗ",
17042  "Ȯ": "Ȯ",
17043  "Ȱ": "Ȱ",
17044  "Ő": "Ő",
17045  "Ṕ": "Ṕ",
17046  "Ṗ": "Ṗ",
17047  "Ŕ": "Ŕ",
17048  "Ř": "Ř",
17049  "Ṙ": "Ṙ",
17050  "Ŗ": "Ŗ",
17051  "Ś": "Ś",
17052  "Ṥ": "Ṥ",
17053  "Š": "Š",
17054  "Ṧ": "Ṧ",
17055  "Ŝ": "Ŝ",
17056  "Ṡ": "Ṡ",
17057  "Ş": "Ş",
17058  "Ť": "Ť",
17059  "Ṫ": "Ṫ",
17060  "Ţ": "Ţ",
17061  "Ú": "Ú",
17062  "Ù": "Ù",
17063  "Ü": "Ü",
17064  "Ǘ": "Ǘ",
17065  "Ǜ": "Ǜ",
17066  "Ǖ": "Ǖ",
17067  "Ǚ": "Ǚ",
17068  "Ũ": "Ũ",
17069  "Ṹ": "Ṹ",
17070  "Ū": "Ū",
17071  "Ṻ": "Ṻ",
17072  "Ŭ": "Ŭ",
17073  "Ǔ": "Ǔ",
17074  "Û": "Û",
17075  "Ů": "Ů",
17076  "Ű": "Ű",
17077  "Ṽ": "Ṽ",
17078  "Ẃ": "Ẃ",
17079  "Ẁ": "Ẁ",
17080  "Ẅ": "Ẅ",
17081  "Ŵ": "Ŵ",
17082  "Ẇ": "Ẇ",
17083  "Ẍ": "Ẍ",
17084  "Ẋ": "Ẋ",
17085  "Ý": "Ý",
17086  "Ỳ": "Ỳ",
17087  "Ÿ": "Ÿ",
17088  "Ỹ": "Ỹ",
17089  "Ȳ": "Ȳ",
17090  "Ŷ": "Ŷ",
17091  "Ẏ": "Ẏ",
17092  "Ź": "Ź",
17093  "Ž": "Ž",
17094  "Ẑ": "Ẑ",
17095  "Ż": "Ż",
17096  "ά": "ά",
17097  "ὰ": "ὰ",
17098  "ᾱ": "ᾱ",
17099  "ᾰ": "ᾰ",
17100  "έ": "έ",
17101  "ὲ": "ὲ",
17102  "ή": "ή",
17103  "ὴ": "ὴ",
17104  "ί": "ί",
17105  "ὶ": "ὶ",
17106  "ϊ": "ϊ",
17107  "ΐ": "ΐ",
17108  "ῒ": "ῒ",
17109  "ῑ": "ῑ",
17110  "ῐ": "ῐ",
17111  "ό": "ό",
17112  "ὸ": "ὸ",
17113  "ύ": "ύ",
17114  "ὺ": "ὺ",
17115  "ϋ": "ϋ",
17116  "ΰ": "ΰ",
17117  "ῢ": "ῢ",
17118  "ῡ": "ῡ",
17119  "ῠ": "ῠ",
17120  "ώ": "ώ",
17121  "ὼ": "ὼ",
17122  "Ύ": "Ύ",
17123  "Ὺ": "Ὺ",
17124  "Ϋ": "Ϋ",
17125  "Ῡ": "Ῡ",
17126  "Ῠ": "Ῠ",
17127  "Ώ": "Ώ",
17128  "Ὼ": "Ὼ"
17129};
17130
17131/**
17132 * This file contains the parser used to parse out a TeX expression from the
17133 * input. Since TeX isn't context-free, standard parsers don't work particularly
17134 * well.
17135 *
17136 * The strategy of this parser is as such:
17137 *
17138 * The main functions (the `.parse...` ones) take a position in the current
17139 * parse string to parse tokens from. The lexer (found in Lexer.js, stored at
17140 * this.gullet.lexer) also supports pulling out tokens at arbitrary places. When
17141 * individual tokens are needed at a position, the lexer is called to pull out a
17142 * token, which is then used.
17143 *
17144 * The parser has a property called "mode" indicating the mode that
17145 * the parser is currently in. Currently it has to be one of "math" or
17146 * "text", which denotes whether the current environment is a math-y
17147 * one or a text-y one (e.g. inside \text). Currently, this serves to
17148 * limit the functions which can be used in text mode.
17149 *
17150 * The main functions then return an object which contains the useful data that
17151 * was parsed at its given point, and a new position at the end of the parsed
17152 * data. The main functions can call each other and continue the parsing by
17153 * using the returned position as a new starting point.
17154 *
17155 * There are also extra `.handle...` functions, which pull out some reused
17156 * functionality into self-contained functions.
17157 *
17158 * The functions return ParseNodes.
17159 */
17160var Parser = /*#__PURE__*/function () {
17161  function Parser(input, settings) {
17162    this.mode = void 0;
17163    this.gullet = void 0;
17164    this.settings = void 0;
17165    this.leftrightDepth = void 0;
17166    this.nextToken = void 0;
17167    // Start in math mode
17168    this.mode = "math"; // Create a new macro expander (gullet) and (indirectly via that) also a
17169    // new lexer (mouth) for this parser (stomach, in the language of TeX)
17170
17171    this.gullet = new MacroExpander(input, settings, this.mode); // Store the settings for use in parsing
17172
17173    this.settings = settings; // Count leftright depth (for \middle errors)
17174
17175    this.leftrightDepth = 0;
17176  }
17177  /**
17178   * Checks a result to make sure it has the right type, and throws an
17179   * appropriate error otherwise.
17180   */
17181
17182
17183  var _proto = Parser.prototype;
17184
17185  _proto.expect = function expect(text, consume) {
17186    if (consume === void 0) {
17187      consume = true;
17188    }
17189
17190    if (this.fetch().text !== text) {
17191      throw new src_ParseError("Expected '" + text + "', got '" + this.fetch().text + "'", this.fetch());
17192    }
17193
17194    if (consume) {
17195      this.consume();
17196    }
17197  }
17198  /**
17199   * Discards the current lookahead token, considering it consumed.
17200   */
17201  ;
17202
17203  _proto.consume = function consume() {
17204    this.nextToken = null;
17205  }
17206  /**
17207   * Return the current lookahead token, or if there isn't one (at the
17208   * beginning, or if the previous lookahead token was consume()d),
17209   * fetch the next token as the new lookahead token and return it.
17210   */
17211  ;
17212
17213  _proto.fetch = function fetch() {
17214    if (this.nextToken == null) {
17215      this.nextToken = this.gullet.expandNextToken();
17216    }
17217
17218    return this.nextToken;
17219  }
17220  /**
17221   * Switches between "text" and "math" modes.
17222   */
17223  ;
17224
17225  _proto.switchMode = function switchMode(newMode) {
17226    this.mode = newMode;
17227    this.gullet.switchMode(newMode);
17228  }
17229  /**
17230   * Main parsing function, which parses an entire input.
17231   */
17232  ;
17233
17234  _proto.parse = function parse() {
17235    if (!this.settings.globalGroup) {
17236      // Create a group namespace for the math expression.
17237      // (LaTeX creates a new group for every $...$, $$...$$, \[...\].)
17238      this.gullet.beginGroup();
17239    } // Use old \color behavior (same as LaTeX's \textcolor) if requested.
17240    // We do this within the group for the math expression, so it doesn't
17241    // pollute settings.macros.
17242
17243
17244    if (this.settings.colorIsTextColor) {
17245      this.gullet.macros.set("\\color", "\\textcolor");
17246    }
17247
17248    try {
17249      // Try to parse the input
17250      var parse = this.parseExpression(false); // If we succeeded, make sure there's an EOF at the end
17251
17252      this.expect("EOF"); // End the group namespace for the expression
17253
17254      if (!this.settings.globalGroup) {
17255        this.gullet.endGroup();
17256      }
17257
17258      return parse; // Close any leftover groups in case of a parse error.
17259    } finally {
17260      this.gullet.endGroups();
17261    }
17262  }
17263  /**
17264   * Fully parse a separate sequence of tokens as a separate job.
17265   * Tokens should be specified in reverse order, as in a MacroDefinition.
17266   */
17267  ;
17268
17269  _proto.subparse = function subparse(tokens) {
17270    // Save the next token from the current job.
17271    var oldToken = this.nextToken;
17272    this.consume(); // Run the new job, terminating it with an excess '}'
17273
17274    this.gullet.pushToken(new Token("}"));
17275    this.gullet.pushTokens(tokens);
17276    var parse = this.parseExpression(false);
17277    this.expect("}"); // Restore the next token from the current job.
17278
17279    this.nextToken = oldToken;
17280    return parse;
17281  };
17282
17283  /**
17284   * Parses an "expression", which is a list of atoms.
17285   *
17286   * `breakOnInfix`: Should the parsing stop when we hit infix nodes? This
17287   *                 happens when functions have higher precendence han infix
17288   *                 nodes in implicit parses.
17289   *
17290   * `breakOnTokenText`: The text of the token that the expression should end
17291   *                     with, or `null` if something else should end the
17292   *                     expression.
17293   */
17294  _proto.parseExpression = function parseExpression(breakOnInfix, breakOnTokenText) {
17295    var body = []; // Keep adding atoms to the body until we can't parse any more atoms (either
17296    // we reached the end, a }, or a \right)
17297
17298    while (true) {
17299      // Ignore spaces in math mode
17300      if (this.mode === "math") {
17301        this.consumeSpaces();
17302      }
17303
17304      var lex = this.fetch();
17305
17306      if (Parser.endOfExpression.indexOf(lex.text) !== -1) {
17307        break;
17308      }
17309
17310      if (breakOnTokenText && lex.text === breakOnTokenText) {
17311        break;
17312      }
17313
17314      if (breakOnInfix && src_functions[lex.text] && src_functions[lex.text].infix) {
17315        break;
17316      }
17317
17318      var atom = this.parseAtom(breakOnTokenText);
17319
17320      if (!atom) {
17321        break;
17322      } else if (atom.type === "internal") {
17323        continue;
17324      }
17325
17326      body.push(atom);
17327    }
17328
17329    if (this.mode === "text") {
17330      this.formLigatures(body);
17331    }
17332
17333    return this.handleInfixNodes(body);
17334  }
17335  /**
17336   * Rewrites infix operators such as \over with corresponding commands such
17337   * as \frac.
17338   *
17339   * There can only be one infix operator per group.  If there's more than one
17340   * then the expression is ambiguous.  This can be resolved by adding {}.
17341   */
17342  ;
17343
17344  _proto.handleInfixNodes = function handleInfixNodes(body) {
17345    var overIndex = -1;
17346    var funcName;
17347
17348    for (var i = 0; i < body.length; i++) {
17349      if (body[i].type === "infix") {
17350        if (overIndex !== -1) {
17351          throw new src_ParseError("only one infix operator per group", body[i].token);
17352        }
17353
17354        overIndex = i;
17355        funcName = body[i].replaceWith;
17356      }
17357    }
17358
17359    if (overIndex !== -1 && funcName) {
17360      var numerNode;
17361      var denomNode;
17362      var numerBody = body.slice(0, overIndex);
17363      var denomBody = body.slice(overIndex + 1);
17364
17365      if (numerBody.length === 1 && numerBody[0].type === "ordgroup") {
17366        numerNode = numerBody[0];
17367      } else {
17368        numerNode = {
17369          type: "ordgroup",
17370          mode: this.mode,
17371          body: numerBody
17372        };
17373      }
17374
17375      if (denomBody.length === 1 && denomBody[0].type === "ordgroup") {
17376        denomNode = denomBody[0];
17377      } else {
17378        denomNode = {
17379          type: "ordgroup",
17380          mode: this.mode,
17381          body: denomBody
17382        };
17383      }
17384
17385      var node;
17386
17387      if (funcName === "\\\\abovefrac") {
17388        node = this.callFunction(funcName, [numerNode, body[overIndex], denomNode], []);
17389      } else {
17390        node = this.callFunction(funcName, [numerNode, denomNode], []);
17391      }
17392
17393      return [node];
17394    } else {
17395      return body;
17396    }
17397  }
17398  /**
17399   * Handle a subscript or superscript with nice errors.
17400   */
17401  ;
17402
17403  _proto.handleSupSubscript = function handleSupSubscript(name // For error reporting.
17404  ) {
17405    var symbolToken = this.fetch();
17406    var symbol = symbolToken.text;
17407    this.consume();
17408    this.consumeSpaces(); // ignore spaces before sup/subscript argument
17409
17410    var group = this.parseGroup(name);
17411
17412    if (!group) {
17413      throw new src_ParseError("Expected group after '" + symbol + "'", symbolToken);
17414    }
17415
17416    return group;
17417  }
17418  /**
17419   * Converts the textual input of an unsupported command into a text node
17420   * contained within a color node whose color is determined by errorColor
17421   */
17422  ;
17423
17424  _proto.formatUnsupportedCmd = function formatUnsupportedCmd(text) {
17425    var textordArray = [];
17426
17427    for (var i = 0; i < text.length; i++) {
17428      textordArray.push({
17429        type: "textord",
17430        mode: "text",
17431        text: text[i]
17432      });
17433    }
17434
17435    var textNode = {
17436      type: "text",
17437      mode: this.mode,
17438      body: textordArray
17439    };
17440    var colorNode = {
17441      type: "color",
17442      mode: this.mode,
17443      color: this.settings.errorColor,
17444      body: [textNode]
17445    };
17446    return colorNode;
17447  }
17448  /**
17449   * Parses a group with optional super/subscripts.
17450   */
17451  ;
17452
17453  _proto.parseAtom = function parseAtom(breakOnTokenText) {
17454    // The body of an atom is an implicit group, so that things like
17455    // \left(x\right)^2 work correctly.
17456    var base = this.parseGroup("atom", breakOnTokenText); // In text mode, we don't have superscripts or subscripts
17457
17458    if (this.mode === "text") {
17459      return base;
17460    } // Note that base may be empty (i.e. null) at this point.
17461
17462
17463    var superscript;
17464    var subscript;
17465
17466    while (true) {
17467      // Guaranteed in math mode, so eat any spaces first.
17468      this.consumeSpaces(); // Lex the first token
17469
17470      var lex = this.fetch();
17471
17472      if (lex.text === "\\limits" || lex.text === "\\nolimits") {
17473        // We got a limit control
17474        if (base && base.type === "op") {
17475          var limits = lex.text === "\\limits";
17476          base.limits = limits;
17477          base.alwaysHandleSupSub = true;
17478        } else if (base && base.type === "operatorname") {
17479          if (base.alwaysHandleSupSub) {
17480            base.limits = lex.text === "\\limits";
17481          }
17482        } else {
17483          throw new src_ParseError("Limit controls must follow a math operator", lex);
17484        }
17485
17486        this.consume();
17487      } else if (lex.text === "^") {
17488        // We got a superscript start
17489        if (superscript) {
17490          throw new src_ParseError("Double superscript", lex);
17491        }
17492
17493        superscript = this.handleSupSubscript("superscript");
17494      } else if (lex.text === "_") {
17495        // We got a subscript start
17496        if (subscript) {
17497          throw new src_ParseError("Double subscript", lex);
17498        }
17499
17500        subscript = this.handleSupSubscript("subscript");
17501      } else if (lex.text === "'") {
17502        // We got a prime
17503        if (superscript) {
17504          throw new src_ParseError("Double superscript", lex);
17505        }
17506
17507        var prime = {
17508          type: "textord",
17509          mode: this.mode,
17510          text: "\\prime"
17511        }; // Many primes can be grouped together, so we handle this here
17512
17513        var primes = [prime];
17514        this.consume(); // Keep lexing tokens until we get something that's not a prime
17515
17516        while (this.fetch().text === "'") {
17517          // For each one, add another prime to the list
17518          primes.push(prime);
17519          this.consume();
17520        } // If there's a superscript following the primes, combine that
17521        // superscript in with the primes.
17522
17523
17524        if (this.fetch().text === "^") {
17525          primes.push(this.handleSupSubscript("superscript"));
17526        } // Put everything into an ordgroup as the superscript
17527
17528
17529        superscript = {
17530          type: "ordgroup",
17531          mode: this.mode,
17532          body: primes
17533        };
17534      } else {
17535        // If it wasn't ^, _, or ', stop parsing super/subscripts
17536        break;
17537      }
17538    } // Base must be set if superscript or subscript are set per logic above,
17539    // but need to check here for type check to pass.
17540
17541
17542    if (superscript || subscript) {
17543      // If we got either a superscript or subscript, create a supsub
17544      return {
17545        type: "supsub",
17546        mode: this.mode,
17547        base: base,
17548        sup: superscript,
17549        sub: subscript
17550      };
17551    } else {
17552      // Otherwise return the original body
17553      return base;
17554    }
17555  }
17556  /**
17557   * Parses an entire function, including its base and all of its arguments.
17558   */
17559  ;
17560
17561  _proto.parseFunction = function parseFunction(breakOnTokenText, name // For determining its context
17562  ) {
17563    var token = this.fetch();
17564    var func = token.text;
17565    var funcData = src_functions[func];
17566
17567    if (!funcData) {
17568      return null;
17569    }
17570
17571    this.consume(); // consume command token
17572
17573    if (name && name !== "atom" && !funcData.allowedInArgument) {
17574      throw new src_ParseError("Got function '" + func + "' with no arguments" + (name ? " as " + name : ""), token);
17575    } else if (this.mode === "text" && !funcData.allowedInText) {
17576      throw new src_ParseError("Can't use function '" + func + "' in text mode", token);
17577    } else if (this.mode === "math" && funcData.allowedInMath === false) {
17578      throw new src_ParseError("Can't use function '" + func + "' in math mode", token);
17579    }
17580
17581    var _this$parseArguments = this.parseArguments(func, funcData),
17582        args = _this$parseArguments.args,
17583        optArgs = _this$parseArguments.optArgs;
17584
17585    return this.callFunction(func, args, optArgs, token, breakOnTokenText);
17586  }
17587  /**
17588   * Call a function handler with a suitable context and arguments.
17589   */
17590  ;
17591
17592  _proto.callFunction = function callFunction(name, args, optArgs, token, breakOnTokenText) {
17593    var context = {
17594      funcName: name,
17595      parser: this,
17596      token: token,
17597      breakOnTokenText: breakOnTokenText
17598    };
17599    var func = src_functions[name];
17600
17601    if (func && func.handler) {
17602      return func.handler(context, args, optArgs);
17603    } else {
17604      throw new src_ParseError("No function handler for " + name);
17605    }
17606  }
17607  /**
17608   * Parses the arguments of a function or environment
17609   */
17610  ;
17611
17612  _proto.parseArguments = function parseArguments(func, // Should look like "\name" or "\begin{name}".
17613  funcData) {
17614    var totalArgs = funcData.numArgs + funcData.numOptionalArgs;
17615
17616    if (totalArgs === 0) {
17617      return {
17618        args: [],
17619        optArgs: []
17620      };
17621    }
17622
17623    var args = [];
17624    var optArgs = [];
17625
17626    for (var i = 0; i < totalArgs; i++) {
17627      var argType = funcData.argTypes && funcData.argTypes[i];
17628      var isOptional = i < funcData.numOptionalArgs;
17629
17630      if (funcData.primitive && argType == null || // \sqrt expands into primitive if optional argument doesn't exist
17631      funcData.type === "sqrt" && i === 1 && optArgs[0] == null) {
17632        argType = "primitive";
17633      }
17634
17635      var arg = this.parseGroupOfType("argument to '" + func + "'", argType, isOptional);
17636
17637      if (isOptional) {
17638        optArgs.push(arg);
17639      } else if (arg != null) {
17640        args.push(arg);
17641      } else {
17642        // should be unreachable
17643        throw new src_ParseError("Null argument, please report this as a bug");
17644      }
17645    }
17646
17647    return {
17648      args: args,
17649      optArgs: optArgs
17650    };
17651  }
17652  /**
17653   * Parses a group when the mode is changing.
17654   */
17655  ;
17656
17657  _proto.parseGroupOfType = function parseGroupOfType(name, type, optional) {
17658    switch (type) {
17659      case "color":
17660        return this.parseColorGroup(optional);
17661
17662      case "size":
17663        return this.parseSizeGroup(optional);
17664
17665      case "url":
17666        return this.parseUrlGroup(optional);
17667
17668      case "math":
17669      case "text":
17670        return this.parseArgumentGroup(optional, type);
17671
17672      case "hbox":
17673        {
17674          // hbox argument type wraps the argument in the equivalent of
17675          // \hbox, which is like \text but switching to \textstyle size.
17676          var group = this.parseArgumentGroup(optional, "text");
17677          return group != null ? {
17678            type: "styling",
17679            mode: group.mode,
17680            body: [group],
17681            style: "text" // simulate \textstyle
17682
17683          } : null;
17684        }
17685
17686      case "raw":
17687        {
17688          var token = this.parseStringGroup("raw", optional);
17689          return token != null ? {
17690            type: "raw",
17691            mode: "text",
17692            string: token.text
17693          } : null;
17694        }
17695
17696      case "primitive":
17697        {
17698          if (optional) {
17699            throw new src_ParseError("A primitive argument cannot be optional");
17700          }
17701
17702          var _group = this.parseGroup(name);
17703
17704          if (_group == null) {
17705            throw new src_ParseError("Expected group as " + name, this.fetch());
17706          }
17707
17708          return _group;
17709        }
17710
17711      case "original":
17712      case null:
17713      case undefined:
17714        return this.parseArgumentGroup(optional);
17715
17716      default:
17717        throw new src_ParseError("Unknown group type as " + name, this.fetch());
17718    }
17719  }
17720  /**
17721   * Discard any space tokens, fetching the next non-space token.
17722   */
17723  ;
17724
17725  _proto.consumeSpaces = function consumeSpaces() {
17726    while (this.fetch().text === " ") {
17727      this.consume();
17728    }
17729  }
17730  /**
17731   * Parses a group, essentially returning the string formed by the
17732   * brace-enclosed tokens plus some position information.
17733   */
17734  ;
17735
17736  _proto.parseStringGroup = function parseStringGroup(modeName, // Used to describe the mode in error messages.
17737  optional) {
17738    var argToken = this.gullet.scanArgument(optional);
17739
17740    if (argToken == null) {
17741      return null;
17742    }
17743
17744    var str = "";
17745    var nextToken;
17746
17747    while ((nextToken = this.fetch()).text !== "EOF") {
17748      str += nextToken.text;
17749      this.consume();
17750    }
17751
17752    this.consume(); // consume the end of the argument
17753
17754    argToken.text = str;
17755    return argToken;
17756  }
17757  /**
17758   * Parses a regex-delimited group: the largest sequence of tokens
17759   * whose concatenated strings match `regex`. Returns the string
17760   * formed by the tokens plus some position information.
17761   */
17762  ;
17763
17764  _proto.parseRegexGroup = function parseRegexGroup(regex, modeName // Used to describe the mode in error messages.
17765  ) {
17766    var firstToken = this.fetch();
17767    var lastToken = firstToken;
17768    var str = "";
17769    var nextToken;
17770
17771    while ((nextToken = this.fetch()).text !== "EOF" && regex.test(str + nextToken.text)) {
17772      lastToken = nextToken;
17773      str += lastToken.text;
17774      this.consume();
17775    }
17776
17777    if (str === "") {
17778      throw new src_ParseError("Invalid " + modeName + ": '" + firstToken.text + "'", firstToken);
17779    }
17780
17781    return firstToken.range(lastToken, str);
17782  }
17783  /**
17784   * Parses a color description.
17785   */
17786  ;
17787
17788  _proto.parseColorGroup = function parseColorGroup(optional) {
17789    var res = this.parseStringGroup("color", optional);
17790
17791    if (res == null) {
17792      return null;
17793    }
17794
17795    var match = /^(#[a-f0-9]{3}|#?[a-f0-9]{6}|[a-z]+)$/i.exec(res.text);
17796
17797    if (!match) {
17798      throw new src_ParseError("Invalid color: '" + res.text + "'", res);
17799    }
17800
17801    var color = match[0];
17802
17803    if (/^[0-9a-f]{6}$/i.test(color)) {
17804      // We allow a 6-digit HTML color spec without a leading "#".
17805      // This follows the xcolor package's HTML color model.
17806      // Predefined color names are all missed by this RegEx pattern.
17807      color = "#" + color;
17808    }
17809
17810    return {
17811      type: "color-token",
17812      mode: this.mode,
17813      color: color
17814    };
17815  }
17816  /**
17817   * Parses a size specification, consisting of magnitude and unit.
17818   */
17819  ;
17820
17821  _proto.parseSizeGroup = function parseSizeGroup(optional) {
17822    var res;
17823    var isBlank = false; // don't expand before parseStringGroup
17824
17825    this.gullet.consumeSpaces();
17826
17827    if (!optional && this.gullet.future().text !== "{") {
17828      res = this.parseRegexGroup(/^[-+]? *(?:$|\d+|\d+\.\d*|\.\d*) *[a-z]{0,2} *$/, "size");
17829    } else {
17830      res = this.parseStringGroup("size", optional);
17831    }
17832
17833    if (!res) {
17834      return null;
17835    }
17836
17837    if (!optional && res.text.length === 0) {
17838      // Because we've tested for what is !optional, this block won't
17839      // affect \kern, \hspace, etc. It will capture the mandatory arguments
17840      // to \genfrac and \above.
17841      res.text = "0pt"; // Enable \above{}
17842
17843      isBlank = true; // This is here specifically for \genfrac
17844    }
17845
17846    var match = /([-+]?) *(\d+(?:\.\d*)?|\.\d+) *([a-z]{2})/.exec(res.text);
17847
17848    if (!match) {
17849      throw new src_ParseError("Invalid size: '" + res.text + "'", res);
17850    }
17851
17852    var data = {
17853      number: +(match[1] + match[2]),
17854      // sign + magnitude, cast to number
17855      unit: match[3]
17856    };
17857
17858    if (!validUnit(data)) {
17859      throw new src_ParseError("Invalid unit: '" + data.unit + "'", res);
17860    }
17861
17862    return {
17863      type: "size",
17864      mode: this.mode,
17865      value: data,
17866      isBlank: isBlank
17867    };
17868  }
17869  /**
17870   * Parses an URL, checking escaped letters and allowed protocols,
17871   * and setting the catcode of % as an active character (as in \hyperref).
17872   */
17873  ;
17874
17875  _proto.parseUrlGroup = function parseUrlGroup(optional) {
17876    this.gullet.lexer.setCatcode("%", 13); // active character
17877
17878    this.gullet.lexer.setCatcode("~", 12); // other character
17879
17880    var res = this.parseStringGroup("url", optional);
17881    this.gullet.lexer.setCatcode("%", 14); // comment character
17882
17883    this.gullet.lexer.setCatcode("~", 13); // active character
17884
17885    if (res == null) {
17886      return null;
17887    } // hyperref package allows backslashes alone in href, but doesn't
17888    // generate valid links in such cases; we interpret this as
17889    // "undefined" behaviour, and keep them as-is. Some browser will
17890    // replace backslashes with forward slashes.
17891
17892
17893    var url = res.text.replace(/\\([#$%&~_^{}])/g, '$1');
17894    return {
17895      type: "url",
17896      mode: this.mode,
17897      url: url
17898    };
17899  }
17900  /**
17901   * Parses an argument with the mode specified.
17902   */
17903  ;
17904
17905  _proto.parseArgumentGroup = function parseArgumentGroup(optional, mode) {
17906    var argToken = this.gullet.scanArgument(optional);
17907
17908    if (argToken == null) {
17909      return null;
17910    }
17911
17912    var outerMode = this.mode;
17913
17914    if (mode) {
17915      // Switch to specified mode
17916      this.switchMode(mode);
17917    }
17918
17919    this.gullet.beginGroup();
17920    var expression = this.parseExpression(false, "EOF"); // TODO: find an alternative way to denote the end
17921
17922    this.expect("EOF"); // expect the end of the argument
17923
17924    this.gullet.endGroup();
17925    var result = {
17926      type: "ordgroup",
17927      mode: this.mode,
17928      loc: argToken.loc,
17929      body: expression
17930    };
17931
17932    if (mode) {
17933      // Switch mode back
17934      this.switchMode(outerMode);
17935    }
17936
17937    return result;
17938  }
17939  /**
17940   * Parses an ordinary group, which is either a single nucleus (like "x")
17941   * or an expression in braces (like "{x+y}") or an implicit group, a group
17942   * that starts at the current position, and ends right before a higher explicit
17943   * group ends, or at EOF.
17944   */
17945  ;
17946
17947  _proto.parseGroup = function parseGroup(name, // For error reporting.
17948  breakOnTokenText) {
17949    var firstToken = this.fetch();
17950    var text = firstToken.text;
17951    var result; // Try to parse an open brace or \begingroup
17952
17953    if (text === "{" || text === "\\begingroup") {
17954      this.consume();
17955      var groupEnd = text === "{" ? "}" : "\\endgroup";
17956      this.gullet.beginGroup(); // If we get a brace, parse an expression
17957
17958      var expression = this.parseExpression(false, groupEnd);
17959      var lastToken = this.fetch();
17960      this.expect(groupEnd); // Check that we got a matching closing brace
17961
17962      this.gullet.endGroup();
17963      result = {
17964        type: "ordgroup",
17965        mode: this.mode,
17966        loc: SourceLocation.range(firstToken, lastToken),
17967        body: expression,
17968        // A group formed by \begingroup...\endgroup is a semi-simple group
17969        // which doesn't affect spacing in math mode, i.e., is transparent.
17970        // https://tex.stackexchange.com/questions/1930/when-should-one-
17971        // use-begingroup-instead-of-bgroup
17972        semisimple: text === "\\begingroup" || undefined
17973      };
17974    } else {
17975      // If there exists a function with this name, parse the function.
17976      // Otherwise, just return a nucleus
17977      result = this.parseFunction(breakOnTokenText, name) || this.parseSymbol();
17978
17979      if (result == null && text[0] === "\\" && !implicitCommands.hasOwnProperty(text)) {
17980        if (this.settings.throwOnError) {
17981          throw new src_ParseError("Undefined control sequence: " + text, firstToken);
17982        }
17983
17984        result = this.formatUnsupportedCmd(text);
17985        this.consume();
17986      }
17987    }
17988
17989    return result;
17990  }
17991  /**
17992   * Form ligature-like combinations of characters for text mode.
17993   * This includes inputs like "--", "---", "``" and "''".
17994   * The result will simply replace multiple textord nodes with a single
17995   * character in each value by a single textord node having multiple
17996   * characters in its value.  The representation is still ASCII source.
17997   * The group will be modified in place.
17998   */
17999  ;
18000
18001  _proto.formLigatures = function formLigatures(group) {
18002    var n = group.length - 1;
18003
18004    for (var i = 0; i < n; ++i) {
18005      var a = group[i]; // $FlowFixMe: Not every node type has a `text` property.
18006
18007      var v = a.text;
18008
18009      if (v === "-" && group[i + 1].text === "-") {
18010        if (i + 1 < n && group[i + 2].text === "-") {
18011          group.splice(i, 3, {
18012            type: "textord",
18013            mode: "text",
18014            loc: SourceLocation.range(a, group[i + 2]),
18015            text: "---"
18016          });
18017          n -= 2;
18018        } else {
18019          group.splice(i, 2, {
18020            type: "textord",
18021            mode: "text",
18022            loc: SourceLocation.range(a, group[i + 1]),
18023            text: "--"
18024          });
18025          n -= 1;
18026        }
18027      }
18028
18029      if ((v === "'" || v === "`") && group[i + 1].text === v) {
18030        group.splice(i, 2, {
18031          type: "textord",
18032          mode: "text",
18033          loc: SourceLocation.range(a, group[i + 1]),
18034          text: v + v
18035        });
18036        n -= 1;
18037      }
18038    }
18039  }
18040  /**
18041   * Parse a single symbol out of the string. Here, we handle single character
18042   * symbols and special functions like \verb.
18043   */
18044  ;
18045
18046  _proto.parseSymbol = function parseSymbol() {
18047    var nucleus = this.fetch();
18048    var text = nucleus.text;
18049
18050    if (/^\\verb[^a-zA-Z]/.test(text)) {
18051      this.consume();
18052      var arg = text.slice(5);
18053      var star = arg.charAt(0) === "*";
18054
18055      if (star) {
18056        arg = arg.slice(1);
18057      } // Lexer's tokenRegex is constructed to always have matching
18058      // first/last characters.
18059
18060
18061      if (arg.length < 2 || arg.charAt(0) !== arg.slice(-1)) {
18062        throw new src_ParseError("\\verb assertion failed --\n                    please report what input caused this bug");
18063      }
18064
18065      arg = arg.slice(1, -1); // remove first and last char
18066
18067      return {
18068        type: "verb",
18069        mode: "text",
18070        body: arg,
18071        star: star
18072      };
18073    } // At this point, we should have a symbol, possibly with accents.
18074    // First expand any accented base symbol according to unicodeSymbols.
18075
18076
18077    if (unicodeSymbols.hasOwnProperty(text[0]) && !src_symbols[this.mode][text[0]]) {
18078      // This behavior is not strict (XeTeX-compatible) in math mode.
18079      if (this.settings.strict && this.mode === "math") {
18080        this.settings.reportNonstrict("unicodeTextInMathMode", "Accented Unicode text character \"" + text[0] + "\" used in " + "math mode", nucleus);
18081      }
18082
18083      text = unicodeSymbols[text[0]] + text.substr(1);
18084    } // Strip off any combining characters
18085
18086
18087    var match = combiningDiacriticalMarksEndRegex.exec(text);
18088
18089    if (match) {
18090      text = text.substring(0, match.index);
18091
18092      if (text === 'i') {
18093        text = "\u0131"; // dotless i, in math and text mode
18094      } else if (text === 'j') {
18095        text = "\u0237"; // dotless j, in math and text mode
18096      }
18097    } // Recognize base symbol
18098
18099
18100    var symbol;
18101
18102    if (src_symbols[this.mode][text]) {
18103      if (this.settings.strict && this.mode === 'math' && extraLatin.indexOf(text) >= 0) {
18104        this.settings.reportNonstrict("unicodeTextInMathMode", "Latin-1/Unicode text character \"" + text[0] + "\" used in " + "math mode", nucleus);
18105      }
18106
18107      var group = src_symbols[this.mode][text].group;
18108      var loc = SourceLocation.range(nucleus);
18109      var s;
18110
18111      if (ATOMS.hasOwnProperty(group)) {
18112        // $FlowFixMe
18113        var family = group;
18114        s = {
18115          type: "atom",
18116          mode: this.mode,
18117          family: family,
18118          loc: loc,
18119          text: text
18120        };
18121      } else {
18122        // $FlowFixMe
18123        s = {
18124          type: group,
18125          mode: this.mode,
18126          loc: loc,
18127          text: text
18128        };
18129      } // $FlowFixMe
18130
18131
18132      symbol = s;
18133    } else if (text.charCodeAt(0) >= 0x80) {
18134      // no symbol for e.g. ^
18135      if (this.settings.strict) {
18136        if (!supportedCodepoint(text.charCodeAt(0))) {
18137          this.settings.reportNonstrict("unknownSymbol", "Unrecognized Unicode character \"" + text[0] + "\"" + (" (" + text.charCodeAt(0) + ")"), nucleus);
18138        } else if (this.mode === "math") {
18139          this.settings.reportNonstrict("unicodeTextInMathMode", "Unicode text character \"" + text[0] + "\" used in math mode", nucleus);
18140        }
18141      } // All nonmathematical Unicode characters are rendered as if they
18142      // are in text mode (wrapped in \text) because that's what it
18143      // takes to render them in LaTeX.  Setting `mode: this.mode` is
18144      // another natural choice (the user requested math mode), but
18145      // this makes it more difficult for getCharacterMetrics() to
18146      // distinguish Unicode characters without metrics and those for
18147      // which we want to simulate the letter M.
18148
18149
18150      symbol = {
18151        type: "textord",
18152        mode: "text",
18153        loc: SourceLocation.range(nucleus),
18154        text: text
18155      };
18156    } else {
18157      return null; // EOF, ^, _, {, }, etc.
18158    }
18159
18160    this.consume(); // Transform combining characters into accents
18161
18162    if (match) {
18163      for (var i = 0; i < match[0].length; i++) {
18164        var accent = match[0][i];
18165
18166        if (!unicodeAccents[accent]) {
18167          throw new src_ParseError("Unknown accent ' " + accent + "'", nucleus);
18168        }
18169
18170        var command = unicodeAccents[accent][this.mode] || unicodeAccents[accent].text;
18171
18172        if (!command) {
18173          throw new src_ParseError("Accent " + accent + " unsupported in " + this.mode + " mode", nucleus);
18174        }
18175
18176        symbol = {
18177          type: "accent",
18178          mode: this.mode,
18179          loc: SourceLocation.range(nucleus),
18180          label: command,
18181          isStretchy: false,
18182          isShifty: true,
18183          // $FlowFixMe
18184          base: symbol
18185        };
18186      }
18187    } // $FlowFixMe
18188
18189
18190    return symbol;
18191  };
18192
18193  return Parser;
18194}();
18195
18196Parser.endOfExpression = ["}", "\\endgroup", "\\end", "\\right", "&"];
18197
18198;// CONCATENATED MODULE: ./src/parseTree.js
18199/**
18200 * Provides a single function for parsing an expression using a Parser
18201 * TODO(emily): Remove this
18202 */
18203
18204
18205
18206
18207/**
18208 * Parses an expression using a Parser, then returns the parsed result.
18209 */
18210var parseTree = function parseTree(toParse, settings) {
18211  if (!(typeof toParse === 'string' || toParse instanceof String)) {
18212    throw new TypeError('KaTeX can only parse string typed expression');
18213  }
18214
18215  var parser = new Parser(toParse, settings); // Blank out any \df@tag to avoid spurious "Duplicate \tag" errors
18216
18217  delete parser.gullet.macros.current["\\df@tag"];
18218  var tree = parser.parse(); // Prevent a color definition from persisting between calls to katex.render().
18219
18220  delete parser.gullet.macros.current["\\current@color"];
18221  delete parser.gullet.macros.current["\\color"]; // If the input used \tag, it will set the \df@tag macro to the tag.
18222  // In this case, we separately parse the tag and wrap the tree.
18223
18224  if (parser.gullet.macros.get("\\df@tag")) {
18225    if (!settings.displayMode) {
18226      throw new src_ParseError("\\tag works only in display equations");
18227    }
18228
18229    tree = [{
18230      type: "tag",
18231      mode: "text",
18232      body: tree,
18233      tag: parser.subparse([new Token("\\df@tag")])
18234    }];
18235  }
18236
18237  return tree;
18238};
18239
18240/* harmony default export */ var src_parseTree = (parseTree);
18241;// CONCATENATED MODULE: ./katex.js
18242/* eslint no-console:0 */
18243
18244/**
18245 * This is the main entry point for KaTeX. Here, we expose functions for
18246 * rendering expressions either to DOM nodes or to markup strings.
18247 *
18248 * We also expose the ParseError class to check if errors thrown from KaTeX are
18249 * errors in the expression, or errors in javascript handling.
18250 */
18251
18252
18253
18254
18255
18256
18257
18258
18259
18260
18261/**
18262 * Parse and build an expression, and place that expression in the DOM node
18263 * given.
18264 */
18265var render = function render(expression, baseNode, options) {
18266  baseNode.textContent = "";
18267  var node = renderToDomTree(expression, options).toNode();
18268  baseNode.appendChild(node);
18269}; // KaTeX's styles don't work properly in quirks mode. Print out an error, and
18270// disable rendering.
18271
18272
18273if (typeof document !== "undefined") {
18274  if (document.compatMode !== "CSS1Compat") {
18275    typeof console !== "undefined" && console.warn("Warning: KaTeX doesn't work in quirks mode. Make sure your " + "website has a suitable doctype.");
18276
18277    render = function render() {
18278      throw new src_ParseError("KaTeX doesn't work in quirks mode.");
18279    };
18280  }
18281}
18282/**
18283 * Parse and build an expression, and return the markup for that.
18284 */
18285
18286
18287var renderToString = function renderToString(expression, options) {
18288  var markup = renderToDomTree(expression, options).toMarkup();
18289  return markup;
18290};
18291/**
18292 * Parse an expression and return the parse tree.
18293 */
18294
18295
18296var generateParseTree = function generateParseTree(expression, options) {
18297  var settings = new Settings(options);
18298  return src_parseTree(expression, settings);
18299};
18300/**
18301 * If the given error is a KaTeX ParseError and options.throwOnError is false,
18302 * renders the invalid LaTeX as a span with hover title giving the KaTeX
18303 * error message.  Otherwise, simply throws the error.
18304 */
18305
18306
18307var renderError = function renderError(error, expression, options) {
18308  if (options.throwOnError || !(error instanceof src_ParseError)) {
18309    throw error;
18310  }
18311
18312  var node = buildCommon.makeSpan(["katex-error"], [new SymbolNode(expression)]);
18313  node.setAttribute("title", error.toString());
18314  node.setAttribute("style", "color:" + options.errorColor);
18315  return node;
18316};
18317/**
18318 * Generates and returns the katex build tree. This is used for advanced
18319 * use cases (like rendering to custom output).
18320 */
18321
18322
18323var renderToDomTree = function renderToDomTree(expression, options) {
18324  var settings = new Settings(options);
18325
18326  try {
18327    var tree = src_parseTree(expression, settings);
18328    return buildTree(tree, expression, settings);
18329  } catch (error) {
18330    return renderError(error, expression, settings);
18331  }
18332};
18333/**
18334 * Generates and returns the katex build tree, with just HTML (no MathML).
18335 * This is used for advanced use cases (like rendering to custom output).
18336 */
18337
18338
18339var renderToHTMLTree = function renderToHTMLTree(expression, options) {
18340  var settings = new Settings(options);
18341
18342  try {
18343    var tree = src_parseTree(expression, settings);
18344    return buildHTMLTree(tree, expression, settings);
18345  } catch (error) {
18346    return renderError(error, expression, settings);
18347  }
18348};
18349
18350/* harmony default export */ var katex = ({
18351  /**
18352   * Current KaTeX version
18353   */
18354  version: "0.15.3",
18355
18356  /**
18357   * Renders the given LaTeX into an HTML+MathML combination, and adds
18358   * it as a child to the specified DOM node.
18359   */
18360  render: render,
18361
18362  /**
18363   * Renders the given LaTeX into an HTML+MathML combination string,
18364   * for sending to the client.
18365   */
18366  renderToString: renderToString,
18367
18368  /**
18369   * KaTeX error, usually during parsing.
18370   */
18371  ParseError: src_ParseError,
18372
18373  /**
18374   * The shema of Settings
18375   */
18376  SETTINGS_SCHEMA: SETTINGS_SCHEMA,
18377
18378  /**
18379   * Parses the given LaTeX into KaTeX's internal parse tree structure,
18380   * without rendering to HTML or MathML.
18381   *
18382   * NOTE: This method is not currently recommended for public use.
18383   * The internal tree representation is unstable and is very likely
18384   * to change. Use at your own risk.
18385   */
18386  __parse: generateParseTree,
18387
18388  /**
18389   * Renders the given LaTeX into an HTML+MathML internal DOM tree
18390   * representation, without flattening that representation to a string.
18391   *
18392   * NOTE: This method is not currently recommended for public use.
18393   * The internal tree representation is unstable and is very likely
18394   * to change. Use at your own risk.
18395   */
18396  __renderToDomTree: renderToDomTree,
18397
18398  /**
18399   * Renders the given LaTeX into an HTML internal DOM tree representation,
18400   * without MathML and without flattening that representation to a string.
18401   *
18402   * NOTE: This method is not currently recommended for public use.
18403   * The internal tree representation is unstable and is very likely
18404   * to change. Use at your own risk.
18405   */
18406  __renderToHTMLTree: renderToHTMLTree,
18407
18408  /**
18409   * extends internal font metrics object with a new object
18410   * each key in the new object represents a font name
18411  */
18412  __setFontMetrics: setFontMetrics,
18413
18414  /**
18415   * adds a new symbol to builtin symbols table
18416   */
18417  __defineSymbol: defineSymbol,
18418
18419  /**
18420   * adds a new macro to builtin macro list
18421   */
18422  __defineMacro: defineMacro,
18423
18424  /**
18425   * Expose the dom tree node types, which can be useful for type checking nodes.
18426   *
18427   * NOTE: This method is not currently recommended for public use.
18428   * The internal tree representation is unstable and is very likely
18429   * to change. Use at your own risk.
18430   */
18431  __domTree: {
18432    Span: Span,
18433    Anchor: Anchor,
18434    SymbolNode: SymbolNode,
18435    SvgNode: SvgNode,
18436    PathNode: PathNode,
18437    LineNode: LineNode
18438  }
18439});
18440;// CONCATENATED MODULE: ./katex.webpack.js
18441/**
18442 * This is the webpack entry point for KaTeX. As ECMAScript, flow[1] and jest[2]
18443 * doesn't support CSS modules natively, a separate entry point is used and
18444 * it is not flowtyped.
18445 *
18446 * [1] https://gist.github.com/lambdahands/d19e0da96285b749f0ef
18447 * [2] https://facebook.github.io/jest/docs/en/webpack.html
18448 */
18449
18450
18451/* harmony default export */ var katex_webpack = (katex);
18452__webpack_exports__ = __webpack_exports__["default"];
18453/******/ 	return __webpack_exports__;
18454/******/ })()
18455;
18456});