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(modules) { // webpackBootstrap
12/******/ 	// The module cache
13/******/ 	var installedModules = {};
14/******/
15/******/ 	// The require function
16/******/ 	function __webpack_require__(moduleId) {
17/******/
18/******/ 		// Check if module is in cache
19/******/ 		if(installedModules[moduleId]) {
20/******/ 			return installedModules[moduleId].exports;
21/******/ 		}
22/******/ 		// Create a new module (and put it into the cache)
23/******/ 		var module = installedModules[moduleId] = {
24/******/ 			i: moduleId,
25/******/ 			l: false,
26/******/ 			exports: {}
27/******/ 		};
28/******/
29/******/ 		// Execute the module function
30/******/ 		modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
31/******/
32/******/ 		// Flag the module as loaded
33/******/ 		module.l = true;
34/******/
35/******/ 		// Return the exports of the module
36/******/ 		return module.exports;
37/******/ 	}
38/******/
39/******/
40/******/ 	// expose the modules object (__webpack_modules__)
41/******/ 	__webpack_require__.m = modules;
42/******/
43/******/ 	// expose the module cache
44/******/ 	__webpack_require__.c = installedModules;
45/******/
46/******/ 	// define getter function for harmony exports
47/******/ 	__webpack_require__.d = function(exports, name, getter) {
48/******/ 		if(!__webpack_require__.o(exports, name)) {
49/******/ 			Object.defineProperty(exports, name, { enumerable: true, get: getter });
50/******/ 		}
51/******/ 	};
52/******/
53/******/ 	// define __esModule on exports
54/******/ 	__webpack_require__.r = function(exports) {
55/******/ 		if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
56/******/ 			Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
57/******/ 		}
58/******/ 		Object.defineProperty(exports, '__esModule', { value: true });
59/******/ 	};
60/******/
61/******/ 	// create a fake namespace object
62/******/ 	// mode & 1: value is a module id, require it
63/******/ 	// mode & 2: merge all properties of value into the ns
64/******/ 	// mode & 4: return value when already ns object
65/******/ 	// mode & 8|1: behave like require
66/******/ 	__webpack_require__.t = function(value, mode) {
67/******/ 		if(mode & 1) value = __webpack_require__(value);
68/******/ 		if(mode & 8) return value;
69/******/ 		if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
70/******/ 		var ns = Object.create(null);
71/******/ 		__webpack_require__.r(ns);
72/******/ 		Object.defineProperty(ns, 'default', { enumerable: true, value: value });
73/******/ 		if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
74/******/ 		return ns;
75/******/ 	};
76/******/
77/******/ 	// getDefaultExport function for compatibility with non-harmony modules
78/******/ 	__webpack_require__.n = function(module) {
79/******/ 		var getter = module && module.__esModule ?
80/******/ 			function getDefault() { return module['default']; } :
81/******/ 			function getModuleExports() { return module; };
82/******/ 		__webpack_require__.d(getter, 'a', getter);
83/******/ 		return getter;
84/******/ 	};
85/******/
86/******/ 	// Object.prototype.hasOwnProperty.call
87/******/ 	__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
88/******/
89/******/ 	// __webpack_public_path__
90/******/ 	__webpack_require__.p = "";
91/******/
92/******/
93/******/ 	// Load entry module and return exports
94/******/ 	return __webpack_require__(__webpack_require__.s = 1);
95/******/ })
96/************************************************************************/
97/******/ ([
98/* 0 */
99/***/ (function(module, exports, __webpack_require__) {
100
101// extracted by mini-css-extract-plugin
102
103/***/ }),
104/* 1 */
105/***/ (function(module, __webpack_exports__, __webpack_require__) {
106
107"use strict";
108__webpack_require__.r(__webpack_exports__);
109
110// EXTERNAL MODULE: ./src/katex.less
111var katex = __webpack_require__(0);
112
113// CONCATENATED MODULE: ./src/SourceLocation.js
114/**
115 * Lexing or parsing positional information for error reporting.
116 * This object is immutable.
117 */
118var SourceLocation =
119/*#__PURE__*/
120function () {
121  // The + prefix indicates that these fields aren't writeable
122  // Lexer holding the input string.
123  // Start offset, zero-based inclusive.
124  // End offset, zero-based exclusive.
125  function SourceLocation(lexer, start, end) {
126    this.lexer = void 0;
127    this.start = void 0;
128    this.end = void 0;
129    this.lexer = lexer;
130    this.start = start;
131    this.end = end;
132  }
133  /**
134   * Merges two `SourceLocation`s from location providers, given they are
135   * provided in order of appearance.
136   * - Returns the first one's location if only the first is provided.
137   * - Returns a merged range of the first and the last if both are provided
138   *   and their lexers match.
139   * - Otherwise, returns null.
140   */
141
142
143  SourceLocation.range = function range(first, second) {
144    if (!second) {
145      return first && first.loc;
146    } else if (!first || !first.loc || !second.loc || first.loc.lexer !== second.loc.lexer) {
147      return null;
148    } else {
149      return new SourceLocation(first.loc.lexer, first.loc.start, second.loc.end);
150    }
151  };
152
153  return SourceLocation;
154}();
155
156
157// CONCATENATED MODULE: ./src/Token.js
158
159/**
160 * Interface required to break circular dependency between Token, Lexer, and
161 * ParseError.
162 */
163
164/**
165 * The resulting token returned from `lex`.
166 *
167 * It consists of the token text plus some position information.
168 * The position information is essentially a range in an input string,
169 * but instead of referencing the bare input string, we refer to the lexer.
170 * That way it is possible to attach extra metadata to the input string,
171 * like for example a file name or similar.
172 *
173 * The position information is optional, so it is OK to construct synthetic
174 * tokens if appropriate. Not providing available position information may
175 * lead to degraded error reporting, though.
176 */
177var Token_Token =
178/*#__PURE__*/
179function () {
180  function Token(text, // the text of this token
181  loc) {
182    this.text = void 0;
183    this.loc = void 0;
184    this.text = text;
185    this.loc = loc;
186  }
187  /**
188   * Given a pair of tokens (this and endToken), compute a `Token` encompassing
189   * the whole input range enclosed by these two.
190   */
191
192
193  var _proto = Token.prototype;
194
195  _proto.range = function range(endToken, // last token of the range, inclusive
196  text) // the text of the newly constructed token
197  {
198    return new Token(text, SourceLocation.range(this, endToken));
199  };
200
201  return Token;
202}();
203// CONCATENATED MODULE: ./src/ParseError.js
204
205
206/**
207 * This is the ParseError class, which is the main error thrown by KaTeX
208 * functions when something has gone wrong. This is used to distinguish internal
209 * errors from errors in the expression that the user provided.
210 *
211 * If possible, a caller should provide a Token or ParseNode with information
212 * about where in the source string the problem occurred.
213 */
214var ParseError = // Error position based on passed-in Token or ParseNode.
215function ParseError(message, // The error message
216token) // An object providing position information
217{
218  this.position = void 0;
219  var error = "KaTeX parse error: " + message;
220  var start;
221  var loc = token && token.loc;
222
223  if (loc && loc.start <= loc.end) {
224    // If we have the input and a position, make the error a bit fancier
225    // Get the input
226    var input = loc.lexer.input; // Prepend some information
227
228    start = loc.start;
229    var end = loc.end;
230
231    if (start === input.length) {
232      error += " at end of input: ";
233    } else {
234      error += " at position " + (start + 1) + ": ";
235    } // Underline token in question using combining underscores
236
237
238    var underlined = input.slice(start, end).replace(/[^]/g, "$&\u0332"); // Extract some context from the input and add it to the error
239
240    var left;
241
242    if (start > 15) {
243      left = "…" + input.slice(start - 15, start);
244    } else {
245      left = input.slice(0, start);
246    }
247
248    var right;
249
250    if (end + 15 < input.length) {
251      right = input.slice(end, end + 15) + "…";
252    } else {
253      right = input.slice(end);
254    }
255
256    error += left + underlined + right;
257  } // Some hackery to make ParseError a prototype of Error
258  // See http://stackoverflow.com/a/8460753
259
260
261  var self = new Error(error);
262  self.name = "ParseError"; // $FlowFixMe
263
264  self.__proto__ = ParseError.prototype; // $FlowFixMe
265
266  self.position = start;
267  return self;
268}; // $FlowFixMe More hackery
269
270
271ParseError.prototype.__proto__ = Error.prototype;
272/* harmony default export */ var src_ParseError = (ParseError);
273// CONCATENATED MODULE: ./src/utils.js
274/**
275 * This file contains a list of utility functions which are useful in other
276 * files.
277 */
278
279/**
280 * Return whether an element is contained in a list
281 */
282var contains = function contains(list, elem) {
283  return list.indexOf(elem) !== -1;
284};
285/**
286 * Provide a default value if a setting is undefined
287 * NOTE: Couldn't use `T` as the output type due to facebook/flow#5022.
288 */
289
290
291var deflt = function deflt(setting, defaultIfUndefined) {
292  return setting === undefined ? defaultIfUndefined : setting;
293}; // hyphenate and escape adapted from Facebook's React under Apache 2 license
294
295
296var uppercase = /([A-Z])/g;
297
298var hyphenate = function hyphenate(str) {
299  return str.replace(uppercase, "-$1").toLowerCase();
300};
301
302var ESCAPE_LOOKUP = {
303  "&": "&amp;",
304  ">": "&gt;",
305  "<": "&lt;",
306  "\"": "&quot;",
307  "'": "&#x27;"
308};
309var ESCAPE_REGEX = /[&><"']/g;
310/**
311 * Escapes text to prevent scripting attacks.
312 */
313
314function utils_escape(text) {
315  return String(text).replace(ESCAPE_REGEX, function (match) {
316    return ESCAPE_LOOKUP[match];
317  });
318}
319/**
320 * Sometimes we want to pull out the innermost element of a group. In most
321 * cases, this will just be the group itself, but when ordgroups and colors have
322 * a single element, we want to pull that out.
323 */
324
325
326var getBaseElem = function getBaseElem(group) {
327  if (group.type === "ordgroup") {
328    if (group.body.length === 1) {
329      return getBaseElem(group.body[0]);
330    } else {
331      return group;
332    }
333  } else if (group.type === "color") {
334    if (group.body.length === 1) {
335      return getBaseElem(group.body[0]);
336    } else {
337      return group;
338    }
339  } else if (group.type === "font") {
340    return getBaseElem(group.body);
341  } else {
342    return group;
343  }
344};
345/**
346 * TeXbook algorithms often reference "character boxes", which are simply groups
347 * with a single character in them. To decide if something is a character box,
348 * we find its innermost group, and see if it is a single character.
349 */
350
351
352var utils_isCharacterBox = function isCharacterBox(group) {
353  var baseElem = getBaseElem(group); // These are all they types of groups which hold single characters
354
355  return baseElem.type === "mathord" || baseElem.type === "textord" || baseElem.type === "atom";
356};
357
358var assert = function assert(value) {
359  if (!value) {
360    throw new Error('Expected non-null, but got ' + String(value));
361  }
362
363  return value;
364};
365/**
366 * Return the protocol of a URL, or "_relative" if the URL does not specify a
367 * protocol (and thus is relative).
368 */
369
370var protocolFromUrl = function protocolFromUrl(url) {
371  var protocol = /^\s*([^\\/#]*?)(?::|&#0*58|&#x0*3a)/i.exec(url);
372  return protocol != null ? protocol[1] : "_relative";
373};
374/* harmony default export */ var utils = ({
375  contains: contains,
376  deflt: deflt,
377  escape: utils_escape,
378  hyphenate: hyphenate,
379  getBaseElem: getBaseElem,
380  isCharacterBox: utils_isCharacterBox,
381  protocolFromUrl: protocolFromUrl
382});
383// CONCATENATED MODULE: ./src/Settings.js
384/* eslint no-console:0 */
385
386/**
387 * This is a module for storing settings passed into KaTeX. It correctly handles
388 * default settings.
389 */
390
391
392
393
394/**
395 * The main Settings object
396 *
397 * The current options stored are:
398 *  - displayMode: Whether the expression should be typeset as inline math
399 *                 (false, the default), meaning that the math starts in
400 *                 \textstyle and is placed in an inline-block); or as display
401 *                 math (true), meaning that the math starts in \displaystyle
402 *                 and is placed in a block with vertical margin.
403 */
404var Settings_Settings =
405/*#__PURE__*/
406function () {
407  function Settings(options) {
408    this.displayMode = void 0;
409    this.output = void 0;
410    this.leqno = void 0;
411    this.fleqn = void 0;
412    this.throwOnError = void 0;
413    this.errorColor = void 0;
414    this.macros = void 0;
415    this.minRuleThickness = void 0;
416    this.colorIsTextColor = void 0;
417    this.strict = void 0;
418    this.trust = void 0;
419    this.maxSize = void 0;
420    this.maxExpand = void 0;
421    // allow null options
422    options = options || {};
423    this.displayMode = utils.deflt(options.displayMode, false);
424    this.output = utils.deflt(options.output, "htmlAndMathml");
425    this.leqno = utils.deflt(options.leqno, false);
426    this.fleqn = utils.deflt(options.fleqn, false);
427    this.throwOnError = utils.deflt(options.throwOnError, true);
428    this.errorColor = utils.deflt(options.errorColor, "#cc0000");
429    this.macros = options.macros || {};
430    this.minRuleThickness = Math.max(0, utils.deflt(options.minRuleThickness, 0));
431    this.colorIsTextColor = utils.deflt(options.colorIsTextColor, false);
432    this.strict = utils.deflt(options.strict, "warn");
433    this.trust = utils.deflt(options.trust, false);
434    this.maxSize = Math.max(0, utils.deflt(options.maxSize, Infinity));
435    this.maxExpand = Math.max(0, utils.deflt(options.maxExpand, 1000));
436  }
437  /**
438   * Report nonstrict (non-LaTeX-compatible) input.
439   * Can safely not be called if `this.strict` is false in JavaScript.
440   */
441
442
443  var _proto = Settings.prototype;
444
445  _proto.reportNonstrict = function reportNonstrict(errorCode, errorMsg, token) {
446    var strict = this.strict;
447
448    if (typeof strict === "function") {
449      // Allow return value of strict function to be boolean or string
450      // (or null/undefined, meaning no further processing).
451      strict = strict(errorCode, errorMsg, token);
452    }
453
454    if (!strict || strict === "ignore") {
455      return;
456    } else if (strict === true || strict === "error") {
457      throw new src_ParseError("LaTeX-incompatible input and strict mode is set to 'error': " + (errorMsg + " [" + errorCode + "]"), token);
458    } else if (strict === "warn") {
459      typeof console !== "undefined" && console.warn("LaTeX-incompatible input and strict mode is set to 'warn': " + (errorMsg + " [" + errorCode + "]"));
460    } else {
461      // won't happen in type-safe code
462      typeof console !== "undefined" && console.warn("LaTeX-incompatible input and strict mode is set to " + ("unrecognized '" + strict + "': " + errorMsg + " [" + errorCode + "]"));
463    }
464  }
465  /**
466   * Check whether to apply strict (LaTeX-adhering) behavior for unusual
467   * input (like `\\`).  Unlike `nonstrict`, will not throw an error;
468   * instead, "error" translates to a return value of `true`, while "ignore"
469   * translates to a return value of `false`.  May still print a warning:
470   * "warn" prints a warning and returns `false`.
471   * This is for the second category of `errorCode`s listed in the README.
472   */
473  ;
474
475  _proto.useStrictBehavior = function useStrictBehavior(errorCode, errorMsg, token) {
476    var strict = this.strict;
477
478    if (typeof strict === "function") {
479      // Allow return value of strict function to be boolean or string
480      // (or null/undefined, meaning no further processing).
481      // But catch any exceptions thrown by function, treating them
482      // like "error".
483      try {
484        strict = strict(errorCode, errorMsg, token);
485      } catch (error) {
486        strict = "error";
487      }
488    }
489
490    if (!strict || strict === "ignore") {
491      return false;
492    } else if (strict === true || strict === "error") {
493      return true;
494    } else if (strict === "warn") {
495      typeof console !== "undefined" && console.warn("LaTeX-incompatible input and strict mode is set to 'warn': " + (errorMsg + " [" + errorCode + "]"));
496      return false;
497    } else {
498      // won't happen in type-safe code
499      typeof console !== "undefined" && console.warn("LaTeX-incompatible input and strict mode is set to " + ("unrecognized '" + strict + "': " + errorMsg + " [" + errorCode + "]"));
500      return false;
501    }
502  }
503  /**
504   * Check whether to test potentially dangerous input, and return
505   * `true` (trusted) or `false` (untrusted).  The sole argument `context`
506   * should be an object with `command` field specifying the relevant LaTeX
507   * command (as a string starting with `\`), and any other arguments, etc.
508   * If `context` has a `url` field, a `protocol` field will automatically
509   * get added by this function (changing the specified object).
510   */
511  ;
512
513  _proto.isTrusted = function isTrusted(context) {
514    if (context.url && !context.protocol) {
515      context.protocol = utils.protocolFromUrl(context.url);
516    }
517
518    var trust = typeof this.trust === "function" ? this.trust(context) : this.trust;
519    return Boolean(trust);
520  };
521
522  return Settings;
523}();
524
525
526// CONCATENATED MODULE: ./src/Style.js
527/**
528 * This file contains information and classes for the various kinds of styles
529 * used in TeX. It provides a generic `Style` class, which holds information
530 * about a specific style. It then provides instances of all the different kinds
531 * of styles possible, and provides functions to move between them and get
532 * information about them.
533 */
534
535/**
536 * The main style class. Contains a unique id for the style, a size (which is
537 * the same for cramped and uncramped version of a style), and a cramped flag.
538 */
539var Style =
540/*#__PURE__*/
541function () {
542  function Style(id, size, cramped) {
543    this.id = void 0;
544    this.size = void 0;
545    this.cramped = void 0;
546    this.id = id;
547    this.size = size;
548    this.cramped = cramped;
549  }
550  /**
551   * Get the style of a superscript given a base in the current style.
552   */
553
554
555  var _proto = Style.prototype;
556
557  _proto.sup = function sup() {
558    return Style_styles[_sup[this.id]];
559  }
560  /**
561   * Get the style of a subscript given a base in the current style.
562   */
563  ;
564
565  _proto.sub = function sub() {
566    return Style_styles[_sub[this.id]];
567  }
568  /**
569   * Get the style of a fraction numerator given the fraction in the current
570   * style.
571   */
572  ;
573
574  _proto.fracNum = function fracNum() {
575    return Style_styles[_fracNum[this.id]];
576  }
577  /**
578   * Get the style of a fraction denominator given the fraction in the current
579   * style.
580   */
581  ;
582
583  _proto.fracDen = function fracDen() {
584    return Style_styles[_fracDen[this.id]];
585  }
586  /**
587   * Get the cramped version of a style (in particular, cramping a cramped style
588   * doesn't change the style).
589   */
590  ;
591
592  _proto.cramp = function cramp() {
593    return Style_styles[_cramp[this.id]];
594  }
595  /**
596   * Get a text or display version of this style.
597   */
598  ;
599
600  _proto.text = function text() {
601    return Style_styles[_text[this.id]];
602  }
603  /**
604   * Return true if this style is tightly spaced (scriptstyle/scriptscriptstyle)
605   */
606  ;
607
608  _proto.isTight = function isTight() {
609    return this.size >= 2;
610  };
611
612  return Style;
613}(); // Export an interface for type checking, but don't expose the implementation.
614// This way, no more styles can be generated.
615
616
617// IDs of the different styles
618var D = 0;
619var Dc = 1;
620var T = 2;
621var Tc = 3;
622var S = 4;
623var Sc = 5;
624var SS = 6;
625var SSc = 7; // Instances of the different styles
626
627var Style_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
628
629var _sup = [S, Sc, S, Sc, SS, SSc, SS, SSc];
630var _sub = [Sc, Sc, Sc, Sc, SSc, SSc, SSc, SSc];
631var _fracNum = [T, Tc, S, Sc, SS, SSc, SS, SSc];
632var _fracDen = [Tc, Tc, Sc, Sc, SSc, SSc, SSc, SSc];
633var _cramp = [Dc, Dc, Tc, Tc, Sc, Sc, SSc, SSc];
634var _text = [D, Dc, T, Tc, T, Tc, T, Tc]; // We only export some of the styles.
635
636/* harmony default export */ var src_Style = ({
637  DISPLAY: Style_styles[D],
638  TEXT: Style_styles[T],
639  SCRIPT: Style_styles[S],
640  SCRIPTSCRIPT: Style_styles[SS]
641});
642// CONCATENATED MODULE: ./src/unicodeScripts.js
643/*
644 * This file defines the Unicode scripts and script families that we
645 * support. To add new scripts or families, just add a new entry to the
646 * scriptData array below. Adding scripts to the scriptData array allows
647 * characters from that script to appear in \text{} environments.
648 */
649
650/**
651 * Each script or script family has a name and an array of blocks.
652 * Each block is an array of two numbers which specify the start and
653 * end points (inclusive) of a block of Unicode codepoints.
654 */
655
656/**
657 * Unicode block data for the families of scripts we support in \text{}.
658 * Scripts only need to appear here if they do not have font metrics.
659 */
660var scriptData = [{
661  // Latin characters beyond the Latin-1 characters we have metrics for.
662  // Needed for Czech, Hungarian and Turkish text, for example.
663  name: 'latin',
664  blocks: [[0x0100, 0x024f], // Latin Extended-A and Latin Extended-B
665  [0x0300, 0x036f]]
666}, {
667  // The Cyrillic script used by Russian and related languages.
668  // A Cyrillic subset used to be supported as explicitly defined
669  // symbols in symbols.js
670  name: 'cyrillic',
671  blocks: [[0x0400, 0x04ff]]
672}, {
673  // The Brahmic scripts of South and Southeast Asia
674  // Devanagari (0900–097F)
675  // Bengali (0980–09FF)
676  // Gurmukhi (0A00–0A7F)
677  // Gujarati (0A80–0AFF)
678  // Oriya (0B00–0B7F)
679  // Tamil (0B80–0BFF)
680  // Telugu (0C00–0C7F)
681  // Kannada (0C80–0CFF)
682  // Malayalam (0D00–0D7F)
683  // Sinhala (0D80–0DFF)
684  // Thai (0E00–0E7F)
685  // Lao (0E80–0EFF)
686  // Tibetan (0F00–0FFF)
687  // Myanmar (1000–109F)
688  name: 'brahmic',
689  blocks: [[0x0900, 0x109F]]
690}, {
691  name: 'georgian',
692  blocks: [[0x10A0, 0x10ff]]
693}, {
694  // Chinese and Japanese.
695  // The "k" in cjk is for Korean, but we've separated Korean out
696  name: "cjk",
697  blocks: [[0x3000, 0x30FF], // CJK symbols and punctuation, Hiragana, Katakana
698  [0x4E00, 0x9FAF], // CJK ideograms
699  [0xFF00, 0xFF60]]
700}, {
701  // Korean
702  name: 'hangul',
703  blocks: [[0xAC00, 0xD7AF]]
704}];
705/**
706 * Given a codepoint, return the name of the script or script family
707 * it is from, or null if it is not part of a known block
708 */
709
710function scriptFromCodepoint(codepoint) {
711  for (var i = 0; i < scriptData.length; i++) {
712    var script = scriptData[i];
713
714    for (var _i = 0; _i < script.blocks.length; _i++) {
715      var block = script.blocks[_i];
716
717      if (codepoint >= block[0] && codepoint <= block[1]) {
718        return script.name;
719      }
720    }
721  }
722
723  return null;
724}
725/**
726 * A flattened version of all the supported blocks in a single array.
727 * This is an optimization to make supportedCodepoint() fast.
728 */
729
730var allBlocks = [];
731scriptData.forEach(function (s) {
732  return s.blocks.forEach(function (b) {
733    return allBlocks.push.apply(allBlocks, b);
734  });
735});
736/**
737 * Given a codepoint, return true if it falls within one of the
738 * scripts or script families defined above and false otherwise.
739 *
740 * Micro benchmarks shows that this is faster than
741 * /[\u3000-\u30FF\u4E00-\u9FAF\uFF00-\uFF60\uAC00-\uD7AF\u0900-\u109F]/.test()
742 * in Firefox, Chrome and Node.
743 */
744
745function supportedCodepoint(codepoint) {
746  for (var i = 0; i < allBlocks.length; i += 2) {
747    if (codepoint >= allBlocks[i] && codepoint <= allBlocks[i + 1]) {
748      return true;
749    }
750  }
751
752  return false;
753}
754// CONCATENATED MODULE: ./src/svgGeometry.js
755/**
756 * This file provides support to domTree.js and delimiter.js.
757 * It's a storehouse of path geometry for SVG images.
758 */
759// In all paths below, the viewBox-to-em scale is 1000:1.
760var hLinePad = 80; // padding above a sqrt viniculum. Prevents image cropping.
761// The viniculum of a \sqrt can be made thicker by a KaTeX rendering option.
762// Think of variable extraViniculum as two detours in the SVG path.
763// The detour begins at the lower left of the area labeled extraViniculum below.
764// The detour proceeds one extraViniculum distance up and slightly to the right,
765// displacing the radiused corner between surd and viniculum. The radius is
766// traversed as usual, then the detour resumes. It goes right, to the end of
767// the very long viniculumn, then down one extraViniculum distance,
768// after which it resumes regular path geometry for the radical.
769
770/*                                                  viniculum
771                                                   /
772         /▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒←extraViniculum
773        / █████████████████████←0.04em (40 unit) std viniculum thickness
774       / /
775      / /
776     / /\
777    / / surd
778*/
779
780var sqrtMain = function sqrtMain(extraViniculum, hLinePad) {
781  // sqrtMain path geometry is from glyph U221A in the font KaTeX Main
782  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";
783};
784
785var sqrtSize1 = function sqrtSize1(extraViniculum, hLinePad) {
786  // size1 is from glyph U221A in the font KaTeX_Size1-Regular
787  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";
788};
789
790var sqrtSize2 = function sqrtSize2(extraViniculum, hLinePad) {
791  // size2 is from glyph U221A in the font KaTeX_Size2-Regular
792  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";
793};
794
795var sqrtSize3 = function sqrtSize3(extraViniculum, hLinePad) {
796  // size3 is from glyph U221A in the font KaTeX_Size3-Regular
797  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";
798};
799
800var sqrtSize4 = function sqrtSize4(extraViniculum, hLinePad) {
801  // size4 is from glyph U221A in the font KaTeX_Size4-Regular
802  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";
803};
804
805var sqrtTall = function sqrtTall(extraViniculum, hLinePad, viewBoxHeight) {
806  // sqrtTall is from glyph U23B7 in the font KaTeX_Size4-Regular
807  // One path edge has a variable length. It runs vertically from the viniculumn
808  // to a point near (14 units) the bottom of the surd. The viniculum
809  // is normally 40 units thick. So the length of the line in question is:
810  var vertSegment = viewBoxHeight - 54 - hLinePad - extraViniculum;
811  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";
812};
813
814var sqrtPath = function sqrtPath(size, extraViniculum, viewBoxHeight) {
815  extraViniculum = 1000 * extraViniculum; // Convert from document ems to viewBox.
816
817  var path = "";
818
819  switch (size) {
820    case "sqrtMain":
821      path = sqrtMain(extraViniculum, hLinePad);
822      break;
823
824    case "sqrtSize1":
825      path = sqrtSize1(extraViniculum, hLinePad);
826      break;
827
828    case "sqrtSize2":
829      path = sqrtSize2(extraViniculum, hLinePad);
830      break;
831
832    case "sqrtSize3":
833      path = sqrtSize3(extraViniculum, hLinePad);
834      break;
835
836    case "sqrtSize4":
837      path = sqrtSize4(extraViniculum, hLinePad);
838      break;
839
840    case "sqrtTall":
841      path = sqrtTall(extraViniculum, hLinePad, viewBoxHeight);
842  }
843
844  return path;
845};
846var svgGeometry_path = {
847  // The doubleleftarrow geometry is from glyph U+21D0 in the font KaTeX Main
848  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",
849  // doublerightarrow is from glyph U+21D2 in font KaTeX Main
850  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",
851  // leftarrow is from glyph U+2190 in font KaTeX Main
852  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",
853  // overbrace is from glyphs U+23A9/23A8/23A7 in font KaTeX_Size4-Regular
854  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",
855  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",
856  // overgroup is from the MnSymbol package (public domain)
857  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",
858  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",
859  // Harpoons are from glyph U+21BD in font KaTeX Main
860  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",
861  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",
862  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",
863  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",
864  // hook is from glyph U+21A9 in font KaTeX Main
865  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",
866  leftlinesegment: "M40 281 V428 H0 V94 H40 V241 H400000 v40z\nM40 281 V428 H0 V94 H40 V241 H400000 v40z",
867  leftmapsto: "M40 281 V448H0V74H40V241H400000v40z\nM40 281 V448H0V74H40V241H400000v40z",
868  // tofrom is from glyph U+21C4 in font KaTeX AMS Regular
869  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",
870  longequal: "M0 50 h400000 v40H0z m0 194h40000v40H0z\nM0 50 h400000 v40H0z m0 194h40000v40H0z",
871  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",
872  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",
873  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",
874  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",
875  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",
876  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",
877  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",
878  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",
879  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",
880  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",
881  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",
882  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",
883  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",
884  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",
885  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",
886  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",
887  rightlinesegment: "M399960 241 V94 h40 V428 h-40 V281 H0 v-40z\nM399960 241 V94 h40 V428 h-40 V281 H0 v-40z",
888  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",
889  // twoheadleftarrow is from glyph U+219E in font KaTeX AMS Regular
890  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",
891  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",
892  // tilde1 is a modified version of a glyph from the MnSymbol package
893  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",
894  // ditto tilde2, tilde3, & tilde4
895  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",
896  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",
897  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",
898  // vec is from glyph U+20D7 in font KaTeX Main
899  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",
900  // widehat1 is a modified version of a glyph from the MnSymbol package
901  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",
902  // ditto widehat2, widehat3, & widehat4
903  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",
904  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",
905  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",
906  // widecheck paths are all inverted versions of widehat
907  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",
908  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",
909  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",
910  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",
911  // The next ten paths support reaction arrows from the mhchem package.
912  // Arrows for \ce{<-->} are offset from xAxis by 0.22ex, per mhchem in LaTeX
913  // baraboveleftarrow is mostly from from glyph U+2190 in font KaTeX Main
914  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",
915  // rightarrowabovebar is mostly from glyph U+2192, KaTeX Main
916  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",
917  // The short left harpoon has 0.5em (i.e. 500 units) kern on the left end.
918  // Ref from mhchem.sty: \rlap{\raisebox{-.22ex}{$\kern0.5em
919  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",
920  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",
921  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",
922  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"
923};
924// CONCATENATED MODULE: ./src/tree.js
925
926
927/**
928 * This node represents a document fragment, which contains elements, but when
929 * placed into the DOM doesn't have any representation itself. It only contains
930 * children and doesn't have any DOM node properties.
931 */
932var tree_DocumentFragment =
933/*#__PURE__*/
934function () {
935  // HtmlDomNode
936  // Never used; needed for satisfying interface.
937  function DocumentFragment(children) {
938    this.children = void 0;
939    this.classes = void 0;
940    this.height = void 0;
941    this.depth = void 0;
942    this.maxFontSize = void 0;
943    this.style = void 0;
944    this.children = children;
945    this.classes = [];
946    this.height = 0;
947    this.depth = 0;
948    this.maxFontSize = 0;
949    this.style = {};
950  }
951
952  var _proto = DocumentFragment.prototype;
953
954  _proto.hasClass = function hasClass(className) {
955    return utils.contains(this.classes, className);
956  }
957  /** Convert the fragment into a node. */
958  ;
959
960  _proto.toNode = function toNode() {
961    var frag = document.createDocumentFragment();
962
963    for (var i = 0; i < this.children.length; i++) {
964      frag.appendChild(this.children[i].toNode());
965    }
966
967    return frag;
968  }
969  /** Convert the fragment into HTML markup. */
970  ;
971
972  _proto.toMarkup = function toMarkup() {
973    var markup = ""; // Simply concatenate the markup for the children together.
974
975    for (var i = 0; i < this.children.length; i++) {
976      markup += this.children[i].toMarkup();
977    }
978
979    return markup;
980  }
981  /**
982   * Converts the math node into a string, similar to innerText. Applies to
983   * MathDomNode's only.
984   */
985  ;
986
987  _proto.toText = function toText() {
988    // To avoid this, we would subclass documentFragment separately for
989    // MathML, but polyfills for subclassing is expensive per PR 1469.
990    // $FlowFixMe: Only works for ChildType = MathDomNode.
991    var toText = function toText(child) {
992      return child.toText();
993    };
994
995    return this.children.map(toText).join("");
996  };
997
998  return DocumentFragment;
999}();
1000// CONCATENATED MODULE: ./src/domTree.js
1001/**
1002 * These objects store the data about the DOM nodes we create, as well as some
1003 * extra data. They can then be transformed into real DOM nodes with the
1004 * `toNode` function or HTML markup using `toMarkup`. They are useful for both
1005 * storing extra properties on the nodes, as well as providing a way to easily
1006 * work with the DOM.
1007 *
1008 * Similar functions for working with MathML nodes exist in mathMLTree.js.
1009 *
1010 * TODO: refactor `span` and `anchor` into common superclass when
1011 * target environments support class inheritance
1012 */
1013
1014
1015
1016
1017
1018/**
1019 * Create an HTML className based on a list of classes. In addition to joining
1020 * with spaces, we also remove empty classes.
1021 */
1022var createClass = function createClass(classes) {
1023  return classes.filter(function (cls) {
1024    return cls;
1025  }).join(" ");
1026};
1027
1028var initNode = function initNode(classes, options, style) {
1029  this.classes = classes || [];
1030  this.attributes = {};
1031  this.height = 0;
1032  this.depth = 0;
1033  this.maxFontSize = 0;
1034  this.style = style || {};
1035
1036  if (options) {
1037    if (options.style.isTight()) {
1038      this.classes.push("mtight");
1039    }
1040
1041    var color = options.getColor();
1042
1043    if (color) {
1044      this.style.color = color;
1045    }
1046  }
1047};
1048/**
1049 * Convert into an HTML node
1050 */
1051
1052
1053var _toNode = function toNode(tagName) {
1054  var node = document.createElement(tagName); // Apply the class
1055
1056  node.className = createClass(this.classes); // Apply inline styles
1057
1058  for (var style in this.style) {
1059    if (this.style.hasOwnProperty(style)) {
1060      // $FlowFixMe Flow doesn't seem to understand span.style's type.
1061      node.style[style] = this.style[style];
1062    }
1063  } // Apply attributes
1064
1065
1066  for (var attr in this.attributes) {
1067    if (this.attributes.hasOwnProperty(attr)) {
1068      node.setAttribute(attr, this.attributes[attr]);
1069    }
1070  } // Append the children, also as HTML nodes
1071
1072
1073  for (var i = 0; i < this.children.length; i++) {
1074    node.appendChild(this.children[i].toNode());
1075  }
1076
1077  return node;
1078};
1079/**
1080 * Convert into an HTML markup string
1081 */
1082
1083
1084var _toMarkup = function toMarkup(tagName) {
1085  var markup = "<" + tagName; // Add the class
1086
1087  if (this.classes.length) {
1088    markup += " class=\"" + utils.escape(createClass(this.classes)) + "\"";
1089  }
1090
1091  var styles = ""; // Add the styles, after hyphenation
1092
1093  for (var style in this.style) {
1094    if (this.style.hasOwnProperty(style)) {
1095      styles += utils.hyphenate(style) + ":" + this.style[style] + ";";
1096    }
1097  }
1098
1099  if (styles) {
1100    markup += " style=\"" + utils.escape(styles) + "\"";
1101  } // Add the attributes
1102
1103
1104  for (var attr in this.attributes) {
1105    if (this.attributes.hasOwnProperty(attr)) {
1106      markup += " " + attr + "=\"" + utils.escape(this.attributes[attr]) + "\"";
1107    }
1108  }
1109
1110  markup += ">"; // Add the markup of the children, also as markup
1111
1112  for (var i = 0; i < this.children.length; i++) {
1113    markup += this.children[i].toMarkup();
1114  }
1115
1116  markup += "</" + tagName + ">";
1117  return markup;
1118}; // Making the type below exact with all optional fields doesn't work due to
1119// - https://github.com/facebook/flow/issues/4582
1120// - https://github.com/facebook/flow/issues/5688
1121// However, since *all* fields are optional, $Shape<> works as suggested in 5688
1122// above.
1123// This type does not include all CSS properties. Additional properties should
1124// be added as needed.
1125
1126
1127/**
1128 * This node represents a span node, with a className, a list of children, and
1129 * an inline style. It also contains information about its height, depth, and
1130 * maxFontSize.
1131 *
1132 * Represents two types with different uses: SvgSpan to wrap an SVG and DomSpan
1133 * otherwise. This typesafety is important when HTML builders access a span's
1134 * children.
1135 */
1136var domTree_Span =
1137/*#__PURE__*/
1138function () {
1139  function Span(classes, children, options, style) {
1140    this.children = void 0;
1141    this.attributes = void 0;
1142    this.classes = void 0;
1143    this.height = void 0;
1144    this.depth = void 0;
1145    this.width = void 0;
1146    this.maxFontSize = void 0;
1147    this.style = void 0;
1148    initNode.call(this, classes, options, style);
1149    this.children = children || [];
1150  }
1151  /**
1152   * Sets an arbitrary attribute on the span. Warning: use this wisely. Not
1153   * all browsers support attributes the same, and having too many custom
1154   * attributes is probably bad.
1155   */
1156
1157
1158  var _proto = Span.prototype;
1159
1160  _proto.setAttribute = function setAttribute(attribute, value) {
1161    this.attributes[attribute] = value;
1162  };
1163
1164  _proto.hasClass = function hasClass(className) {
1165    return utils.contains(this.classes, className);
1166  };
1167
1168  _proto.toNode = function toNode() {
1169    return _toNode.call(this, "span");
1170  };
1171
1172  _proto.toMarkup = function toMarkup() {
1173    return _toMarkup.call(this, "span");
1174  };
1175
1176  return Span;
1177}();
1178/**
1179 * This node represents an anchor (<a>) element with a hyperlink.  See `span`
1180 * for further details.
1181 */
1182
1183var domTree_Anchor =
1184/*#__PURE__*/
1185function () {
1186  function Anchor(href, classes, children, options) {
1187    this.children = void 0;
1188    this.attributes = void 0;
1189    this.classes = void 0;
1190    this.height = void 0;
1191    this.depth = void 0;
1192    this.maxFontSize = void 0;
1193    this.style = void 0;
1194    initNode.call(this, classes, options);
1195    this.children = children || [];
1196    this.setAttribute('href', href);
1197  }
1198
1199  var _proto2 = Anchor.prototype;
1200
1201  _proto2.setAttribute = function setAttribute(attribute, value) {
1202    this.attributes[attribute] = value;
1203  };
1204
1205  _proto2.hasClass = function hasClass(className) {
1206    return utils.contains(this.classes, className);
1207  };
1208
1209  _proto2.toNode = function toNode() {
1210    return _toNode.call(this, "a");
1211  };
1212
1213  _proto2.toMarkup = function toMarkup() {
1214    return _toMarkup.call(this, "a");
1215  };
1216
1217  return Anchor;
1218}();
1219/**
1220 * This node represents an image embed (<img>) element.
1221 */
1222
1223var domTree_Img =
1224/*#__PURE__*/
1225function () {
1226  function Img(src, alt, style) {
1227    this.src = void 0;
1228    this.alt = void 0;
1229    this.classes = void 0;
1230    this.height = void 0;
1231    this.depth = void 0;
1232    this.maxFontSize = void 0;
1233    this.style = void 0;
1234    this.alt = alt;
1235    this.src = src;
1236    this.classes = ["mord"];
1237    this.style = style;
1238  }
1239
1240  var _proto3 = Img.prototype;
1241
1242  _proto3.hasClass = function hasClass(className) {
1243    return utils.contains(this.classes, className);
1244  };
1245
1246  _proto3.toNode = function toNode() {
1247    var node = document.createElement("img");
1248    node.src = this.src;
1249    node.alt = this.alt;
1250    node.className = "mord"; // Apply inline styles
1251
1252    for (var style in this.style) {
1253      if (this.style.hasOwnProperty(style)) {
1254        // $FlowFixMe
1255        node.style[style] = this.style[style];
1256      }
1257    }
1258
1259    return node;
1260  };
1261
1262  _proto3.toMarkup = function toMarkup() {
1263    var markup = "<img  src='" + this.src + " 'alt='" + this.alt + "' "; // Add the styles, after hyphenation
1264
1265    var styles = "";
1266
1267    for (var style in this.style) {
1268      if (this.style.hasOwnProperty(style)) {
1269        styles += utils.hyphenate(style) + ":" + this.style[style] + ";";
1270      }
1271    }
1272
1273    if (styles) {
1274      markup += " style=\"" + utils.escape(styles) + "\"";
1275    }
1276
1277    markup += "'/>";
1278    return markup;
1279  };
1280
1281  return Img;
1282}();
1283var iCombinations = {
1284  'î': "\u0131\u0302",
1285  'ï': "\u0131\u0308",
1286  'í': "\u0131\u0301",
1287  // 'ī': '\u0131\u0304', // enable when we add Extended Latin
1288  'ì': "\u0131\u0300"
1289};
1290/**
1291 * A symbol node contains information about a single symbol. It either renders
1292 * to a single text node, or a span with a single text node in it, depending on
1293 * whether it has CSS classes, styles, or needs italic correction.
1294 */
1295
1296var domTree_SymbolNode =
1297/*#__PURE__*/
1298function () {
1299  function SymbolNode(text, height, depth, italic, skew, width, classes, style) {
1300    this.text = void 0;
1301    this.height = void 0;
1302    this.depth = void 0;
1303    this.italic = void 0;
1304    this.skew = void 0;
1305    this.width = void 0;
1306    this.maxFontSize = void 0;
1307    this.classes = void 0;
1308    this.style = void 0;
1309    this.text = text;
1310    this.height = height || 0;
1311    this.depth = depth || 0;
1312    this.italic = italic || 0;
1313    this.skew = skew || 0;
1314    this.width = width || 0;
1315    this.classes = classes || [];
1316    this.style = style || {};
1317    this.maxFontSize = 0; // Mark text from non-Latin scripts with specific classes so that we
1318    // can specify which fonts to use.  This allows us to render these
1319    // characters with a serif font in situations where the browser would
1320    // either default to a sans serif or render a placeholder character.
1321    // We use CSS class names like cjk_fallback, hangul_fallback and
1322    // brahmic_fallback. See ./unicodeScripts.js for the set of possible
1323    // script names
1324
1325    var script = scriptFromCodepoint(this.text.charCodeAt(0));
1326
1327    if (script) {
1328      this.classes.push(script + "_fallback");
1329    }
1330
1331    if (/[îïíì]/.test(this.text)) {
1332      // add ī when we add Extended Latin
1333      this.text = iCombinations[this.text];
1334    }
1335  }
1336
1337  var _proto4 = SymbolNode.prototype;
1338
1339  _proto4.hasClass = function hasClass(className) {
1340    return utils.contains(this.classes, className);
1341  }
1342  /**
1343   * Creates a text node or span from a symbol node. Note that a span is only
1344   * created if it is needed.
1345   */
1346  ;
1347
1348  _proto4.toNode = function toNode() {
1349    var node = document.createTextNode(this.text);
1350    var span = null;
1351
1352    if (this.italic > 0) {
1353      span = document.createElement("span");
1354      span.style.marginRight = this.italic + "em";
1355    }
1356
1357    if (this.classes.length > 0) {
1358      span = span || document.createElement("span");
1359      span.className = createClass(this.classes);
1360    }
1361
1362    for (var style in this.style) {
1363      if (this.style.hasOwnProperty(style)) {
1364        span = span || document.createElement("span"); // $FlowFixMe Flow doesn't seem to understand span.style's type.
1365
1366        span.style[style] = this.style[style];
1367      }
1368    }
1369
1370    if (span) {
1371      span.appendChild(node);
1372      return span;
1373    } else {
1374      return node;
1375    }
1376  }
1377  /**
1378   * Creates markup for a symbol node.
1379   */
1380  ;
1381
1382  _proto4.toMarkup = function toMarkup() {
1383    // TODO(alpert): More duplication than I'd like from
1384    // span.prototype.toMarkup and symbolNode.prototype.toNode...
1385    var needsSpan = false;
1386    var markup = "<span";
1387
1388    if (this.classes.length) {
1389      needsSpan = true;
1390      markup += " class=\"";
1391      markup += utils.escape(createClass(this.classes));
1392      markup += "\"";
1393    }
1394
1395    var styles = "";
1396
1397    if (this.italic > 0) {
1398      styles += "margin-right:" + this.italic + "em;";
1399    }
1400
1401    for (var style in this.style) {
1402      if (this.style.hasOwnProperty(style)) {
1403        styles += utils.hyphenate(style) + ":" + this.style[style] + ";";
1404      }
1405    }
1406
1407    if (styles) {
1408      needsSpan = true;
1409      markup += " style=\"" + utils.escape(styles) + "\"";
1410    }
1411
1412    var escaped = utils.escape(this.text);
1413
1414    if (needsSpan) {
1415      markup += ">";
1416      markup += escaped;
1417      markup += "</span>";
1418      return markup;
1419    } else {
1420      return escaped;
1421    }
1422  };
1423
1424  return SymbolNode;
1425}();
1426/**
1427 * SVG nodes are used to render stretchy wide elements.
1428 */
1429
1430var SvgNode =
1431/*#__PURE__*/
1432function () {
1433  function SvgNode(children, attributes) {
1434    this.children = void 0;
1435    this.attributes = void 0;
1436    this.children = children || [];
1437    this.attributes = attributes || {};
1438  }
1439
1440  var _proto5 = SvgNode.prototype;
1441
1442  _proto5.toNode = function toNode() {
1443    var svgNS = "http://www.w3.org/2000/svg";
1444    var node = document.createElementNS(svgNS, "svg"); // Apply attributes
1445
1446    for (var attr in this.attributes) {
1447      if (Object.prototype.hasOwnProperty.call(this.attributes, attr)) {
1448        node.setAttribute(attr, this.attributes[attr]);
1449      }
1450    }
1451
1452    for (var i = 0; i < this.children.length; i++) {
1453      node.appendChild(this.children[i].toNode());
1454    }
1455
1456    return node;
1457  };
1458
1459  _proto5.toMarkup = function toMarkup() {
1460    var markup = "<svg"; // Apply attributes
1461
1462    for (var attr in this.attributes) {
1463      if (Object.prototype.hasOwnProperty.call(this.attributes, attr)) {
1464        markup += " " + attr + "='" + this.attributes[attr] + "'";
1465      }
1466    }
1467
1468    markup += ">";
1469
1470    for (var i = 0; i < this.children.length; i++) {
1471      markup += this.children[i].toMarkup();
1472    }
1473
1474    markup += "</svg>";
1475    return markup;
1476  };
1477
1478  return SvgNode;
1479}();
1480var domTree_PathNode =
1481/*#__PURE__*/
1482function () {
1483  function PathNode(pathName, alternate) {
1484    this.pathName = void 0;
1485    this.alternate = void 0;
1486    this.pathName = pathName;
1487    this.alternate = alternate; // Used only for \sqrt
1488  }
1489
1490  var _proto6 = PathNode.prototype;
1491
1492  _proto6.toNode = function toNode() {
1493    var svgNS = "http://www.w3.org/2000/svg";
1494    var node = document.createElementNS(svgNS, "path");
1495
1496    if (this.alternate) {
1497      node.setAttribute("d", this.alternate);
1498    } else {
1499      node.setAttribute("d", svgGeometry_path[this.pathName]);
1500    }
1501
1502    return node;
1503  };
1504
1505  _proto6.toMarkup = function toMarkup() {
1506    if (this.alternate) {
1507      return "<path d='" + this.alternate + "'/>";
1508    } else {
1509      return "<path d='" + svgGeometry_path[this.pathName] + "'/>";
1510    }
1511  };
1512
1513  return PathNode;
1514}();
1515var LineNode =
1516/*#__PURE__*/
1517function () {
1518  function LineNode(attributes) {
1519    this.attributes = void 0;
1520    this.attributes = attributes || {};
1521  }
1522
1523  var _proto7 = LineNode.prototype;
1524
1525  _proto7.toNode = function toNode() {
1526    var svgNS = "http://www.w3.org/2000/svg";
1527    var node = document.createElementNS(svgNS, "line"); // Apply attributes
1528
1529    for (var attr in this.attributes) {
1530      if (Object.prototype.hasOwnProperty.call(this.attributes, attr)) {
1531        node.setAttribute(attr, this.attributes[attr]);
1532      }
1533    }
1534
1535    return node;
1536  };
1537
1538  _proto7.toMarkup = function toMarkup() {
1539    var markup = "<line";
1540
1541    for (var attr in this.attributes) {
1542      if (Object.prototype.hasOwnProperty.call(this.attributes, attr)) {
1543        markup += " " + attr + "='" + this.attributes[attr] + "'";
1544      }
1545    }
1546
1547    markup += "/>";
1548    return markup;
1549  };
1550
1551  return LineNode;
1552}();
1553function assertSymbolDomNode(group) {
1554  if (group instanceof domTree_SymbolNode) {
1555    return group;
1556  } else {
1557    throw new Error("Expected symbolNode but got " + String(group) + ".");
1558  }
1559}
1560function assertSpan(group) {
1561  if (group instanceof domTree_Span) {
1562    return group;
1563  } else {
1564    throw new Error("Expected span<HtmlDomNode> but got " + String(group) + ".");
1565  }
1566}
1567// CONCATENATED MODULE: ./submodules/katex-fonts/fontMetricsData.js
1568// This file is GENERATED by buildMetrics.sh. DO NOT MODIFY.
1569/* harmony default export */ var fontMetricsData = ({
1570  "AMS-Regular": {
1571    "65": [0, 0.68889, 0, 0, 0.72222],
1572    "66": [0, 0.68889, 0, 0, 0.66667],
1573    "67": [0, 0.68889, 0, 0, 0.72222],
1574    "68": [0, 0.68889, 0, 0, 0.72222],
1575    "69": [0, 0.68889, 0, 0, 0.66667],
1576    "70": [0, 0.68889, 0, 0, 0.61111],
1577    "71": [0, 0.68889, 0, 0, 0.77778],
1578    "72": [0, 0.68889, 0, 0, 0.77778],
1579    "73": [0, 0.68889, 0, 0, 0.38889],
1580    "74": [0.16667, 0.68889, 0, 0, 0.5],
1581    "75": [0, 0.68889, 0, 0, 0.77778],
1582    "76": [0, 0.68889, 0, 0, 0.66667],
1583    "77": [0, 0.68889, 0, 0, 0.94445],
1584    "78": [0, 0.68889, 0, 0, 0.72222],
1585    "79": [0.16667, 0.68889, 0, 0, 0.77778],
1586    "80": [0, 0.68889, 0, 0, 0.61111],
1587    "81": [0.16667, 0.68889, 0, 0, 0.77778],
1588    "82": [0, 0.68889, 0, 0, 0.72222],
1589    "83": [0, 0.68889, 0, 0, 0.55556],
1590    "84": [0, 0.68889, 0, 0, 0.66667],
1591    "85": [0, 0.68889, 0, 0, 0.72222],
1592    "86": [0, 0.68889, 0, 0, 0.72222],
1593    "87": [0, 0.68889, 0, 0, 1.0],
1594    "88": [0, 0.68889, 0, 0, 0.72222],
1595    "89": [0, 0.68889, 0, 0, 0.72222],
1596    "90": [0, 0.68889, 0, 0, 0.66667],
1597    "107": [0, 0.68889, 0, 0, 0.55556],
1598    "165": [0, 0.675, 0.025, 0, 0.75],
1599    "174": [0.15559, 0.69224, 0, 0, 0.94666],
1600    "240": [0, 0.68889, 0, 0, 0.55556],
1601    "295": [0, 0.68889, 0, 0, 0.54028],
1602    "710": [0, 0.825, 0, 0, 2.33334],
1603    "732": [0, 0.9, 0, 0, 2.33334],
1604    "770": [0, 0.825, 0, 0, 2.33334],
1605    "771": [0, 0.9, 0, 0, 2.33334],
1606    "989": [0.08167, 0.58167, 0, 0, 0.77778],
1607    "1008": [0, 0.43056, 0.04028, 0, 0.66667],
1608    "8245": [0, 0.54986, 0, 0, 0.275],
1609    "8463": [0, 0.68889, 0, 0, 0.54028],
1610    "8487": [0, 0.68889, 0, 0, 0.72222],
1611    "8498": [0, 0.68889, 0, 0, 0.55556],
1612    "8502": [0, 0.68889, 0, 0, 0.66667],
1613    "8503": [0, 0.68889, 0, 0, 0.44445],
1614    "8504": [0, 0.68889, 0, 0, 0.66667],
1615    "8513": [0, 0.68889, 0, 0, 0.63889],
1616    "8592": [-0.03598, 0.46402, 0, 0, 0.5],
1617    "8594": [-0.03598, 0.46402, 0, 0, 0.5],
1618    "8602": [-0.13313, 0.36687, 0, 0, 1.0],
1619    "8603": [-0.13313, 0.36687, 0, 0, 1.0],
1620    "8606": [0.01354, 0.52239, 0, 0, 1.0],
1621    "8608": [0.01354, 0.52239, 0, 0, 1.0],
1622    "8610": [0.01354, 0.52239, 0, 0, 1.11111],
1623    "8611": [0.01354, 0.52239, 0, 0, 1.11111],
1624    "8619": [0, 0.54986, 0, 0, 1.0],
1625    "8620": [0, 0.54986, 0, 0, 1.0],
1626    "8621": [-0.13313, 0.37788, 0, 0, 1.38889],
1627    "8622": [-0.13313, 0.36687, 0, 0, 1.0],
1628    "8624": [0, 0.69224, 0, 0, 0.5],
1629    "8625": [0, 0.69224, 0, 0, 0.5],
1630    "8630": [0, 0.43056, 0, 0, 1.0],
1631    "8631": [0, 0.43056, 0, 0, 1.0],
1632    "8634": [0.08198, 0.58198, 0, 0, 0.77778],
1633    "8635": [0.08198, 0.58198, 0, 0, 0.77778],
1634    "8638": [0.19444, 0.69224, 0, 0, 0.41667],
1635    "8639": [0.19444, 0.69224, 0, 0, 0.41667],
1636    "8642": [0.19444, 0.69224, 0, 0, 0.41667],
1637    "8643": [0.19444, 0.69224, 0, 0, 0.41667],
1638    "8644": [0.1808, 0.675, 0, 0, 1.0],
1639    "8646": [0.1808, 0.675, 0, 0, 1.0],
1640    "8647": [0.1808, 0.675, 0, 0, 1.0],
1641    "8648": [0.19444, 0.69224, 0, 0, 0.83334],
1642    "8649": [0.1808, 0.675, 0, 0, 1.0],
1643    "8650": [0.19444, 0.69224, 0, 0, 0.83334],
1644    "8651": [0.01354, 0.52239, 0, 0, 1.0],
1645    "8652": [0.01354, 0.52239, 0, 0, 1.0],
1646    "8653": [-0.13313, 0.36687, 0, 0, 1.0],
1647    "8654": [-0.13313, 0.36687, 0, 0, 1.0],
1648    "8655": [-0.13313, 0.36687, 0, 0, 1.0],
1649    "8666": [0.13667, 0.63667, 0, 0, 1.0],
1650    "8667": [0.13667, 0.63667, 0, 0, 1.0],
1651    "8669": [-0.13313, 0.37788, 0, 0, 1.0],
1652    "8672": [-0.064, 0.437, 0, 0, 1.334],
1653    "8674": [-0.064, 0.437, 0, 0, 1.334],
1654    "8705": [0, 0.825, 0, 0, 0.5],
1655    "8708": [0, 0.68889, 0, 0, 0.55556],
1656    "8709": [0.08167, 0.58167, 0, 0, 0.77778],
1657    "8717": [0, 0.43056, 0, 0, 0.42917],
1658    "8722": [-0.03598, 0.46402, 0, 0, 0.5],
1659    "8724": [0.08198, 0.69224, 0, 0, 0.77778],
1660    "8726": [0.08167, 0.58167, 0, 0, 0.77778],
1661    "8733": [0, 0.69224, 0, 0, 0.77778],
1662    "8736": [0, 0.69224, 0, 0, 0.72222],
1663    "8737": [0, 0.69224, 0, 0, 0.72222],
1664    "8738": [0.03517, 0.52239, 0, 0, 0.72222],
1665    "8739": [0.08167, 0.58167, 0, 0, 0.22222],
1666    "8740": [0.25142, 0.74111, 0, 0, 0.27778],
1667    "8741": [0.08167, 0.58167, 0, 0, 0.38889],
1668    "8742": [0.25142, 0.74111, 0, 0, 0.5],
1669    "8756": [0, 0.69224, 0, 0, 0.66667],
1670    "8757": [0, 0.69224, 0, 0, 0.66667],
1671    "8764": [-0.13313, 0.36687, 0, 0, 0.77778],
1672    "8765": [-0.13313, 0.37788, 0, 0, 0.77778],
1673    "8769": [-0.13313, 0.36687, 0, 0, 0.77778],
1674    "8770": [-0.03625, 0.46375, 0, 0, 0.77778],
1675    "8774": [0.30274, 0.79383, 0, 0, 0.77778],
1676    "8776": [-0.01688, 0.48312, 0, 0, 0.77778],
1677    "8778": [0.08167, 0.58167, 0, 0, 0.77778],
1678    "8782": [0.06062, 0.54986, 0, 0, 0.77778],
1679    "8783": [0.06062, 0.54986, 0, 0, 0.77778],
1680    "8785": [0.08198, 0.58198, 0, 0, 0.77778],
1681    "8786": [0.08198, 0.58198, 0, 0, 0.77778],
1682    "8787": [0.08198, 0.58198, 0, 0, 0.77778],
1683    "8790": [0, 0.69224, 0, 0, 0.77778],
1684    "8791": [0.22958, 0.72958, 0, 0, 0.77778],
1685    "8796": [0.08198, 0.91667, 0, 0, 0.77778],
1686    "8806": [0.25583, 0.75583, 0, 0, 0.77778],
1687    "8807": [0.25583, 0.75583, 0, 0, 0.77778],
1688    "8808": [0.25142, 0.75726, 0, 0, 0.77778],
1689    "8809": [0.25142, 0.75726, 0, 0, 0.77778],
1690    "8812": [0.25583, 0.75583, 0, 0, 0.5],
1691    "8814": [0.20576, 0.70576, 0, 0, 0.77778],
1692    "8815": [0.20576, 0.70576, 0, 0, 0.77778],
1693    "8816": [0.30274, 0.79383, 0, 0, 0.77778],
1694    "8817": [0.30274, 0.79383, 0, 0, 0.77778],
1695    "8818": [0.22958, 0.72958, 0, 0, 0.77778],
1696    "8819": [0.22958, 0.72958, 0, 0, 0.77778],
1697    "8822": [0.1808, 0.675, 0, 0, 0.77778],
1698    "8823": [0.1808, 0.675, 0, 0, 0.77778],
1699    "8828": [0.13667, 0.63667, 0, 0, 0.77778],
1700    "8829": [0.13667, 0.63667, 0, 0, 0.77778],
1701    "8830": [0.22958, 0.72958, 0, 0, 0.77778],
1702    "8831": [0.22958, 0.72958, 0, 0, 0.77778],
1703    "8832": [0.20576, 0.70576, 0, 0, 0.77778],
1704    "8833": [0.20576, 0.70576, 0, 0, 0.77778],
1705    "8840": [0.30274, 0.79383, 0, 0, 0.77778],
1706    "8841": [0.30274, 0.79383, 0, 0, 0.77778],
1707    "8842": [0.13597, 0.63597, 0, 0, 0.77778],
1708    "8843": [0.13597, 0.63597, 0, 0, 0.77778],
1709    "8847": [0.03517, 0.54986, 0, 0, 0.77778],
1710    "8848": [0.03517, 0.54986, 0, 0, 0.77778],
1711    "8858": [0.08198, 0.58198, 0, 0, 0.77778],
1712    "8859": [0.08198, 0.58198, 0, 0, 0.77778],
1713    "8861": [0.08198, 0.58198, 0, 0, 0.77778],
1714    "8862": [0, 0.675, 0, 0, 0.77778],
1715    "8863": [0, 0.675, 0, 0, 0.77778],
1716    "8864": [0, 0.675, 0, 0, 0.77778],
1717    "8865": [0, 0.675, 0, 0, 0.77778],
1718    "8872": [0, 0.69224, 0, 0, 0.61111],
1719    "8873": [0, 0.69224, 0, 0, 0.72222],
1720    "8874": [0, 0.69224, 0, 0, 0.88889],
1721    "8876": [0, 0.68889, 0, 0, 0.61111],
1722    "8877": [0, 0.68889, 0, 0, 0.61111],
1723    "8878": [0, 0.68889, 0, 0, 0.72222],
1724    "8879": [0, 0.68889, 0, 0, 0.72222],
1725    "8882": [0.03517, 0.54986, 0, 0, 0.77778],
1726    "8883": [0.03517, 0.54986, 0, 0, 0.77778],
1727    "8884": [0.13667, 0.63667, 0, 0, 0.77778],
1728    "8885": [0.13667, 0.63667, 0, 0, 0.77778],
1729    "8888": [0, 0.54986, 0, 0, 1.11111],
1730    "8890": [0.19444, 0.43056, 0, 0, 0.55556],
1731    "8891": [0.19444, 0.69224, 0, 0, 0.61111],
1732    "8892": [0.19444, 0.69224, 0, 0, 0.61111],
1733    "8901": [0, 0.54986, 0, 0, 0.27778],
1734    "8903": [0.08167, 0.58167, 0, 0, 0.77778],
1735    "8905": [0.08167, 0.58167, 0, 0, 0.77778],
1736    "8906": [0.08167, 0.58167, 0, 0, 0.77778],
1737    "8907": [0, 0.69224, 0, 0, 0.77778],
1738    "8908": [0, 0.69224, 0, 0, 0.77778],
1739    "8909": [-0.03598, 0.46402, 0, 0, 0.77778],
1740    "8910": [0, 0.54986, 0, 0, 0.76042],
1741    "8911": [0, 0.54986, 0, 0, 0.76042],
1742    "8912": [0.03517, 0.54986, 0, 0, 0.77778],
1743    "8913": [0.03517, 0.54986, 0, 0, 0.77778],
1744    "8914": [0, 0.54986, 0, 0, 0.66667],
1745    "8915": [0, 0.54986, 0, 0, 0.66667],
1746    "8916": [0, 0.69224, 0, 0, 0.66667],
1747    "8918": [0.0391, 0.5391, 0, 0, 0.77778],
1748    "8919": [0.0391, 0.5391, 0, 0, 0.77778],
1749    "8920": [0.03517, 0.54986, 0, 0, 1.33334],
1750    "8921": [0.03517, 0.54986, 0, 0, 1.33334],
1751    "8922": [0.38569, 0.88569, 0, 0, 0.77778],
1752    "8923": [0.38569, 0.88569, 0, 0, 0.77778],
1753    "8926": [0.13667, 0.63667, 0, 0, 0.77778],
1754    "8927": [0.13667, 0.63667, 0, 0, 0.77778],
1755    "8928": [0.30274, 0.79383, 0, 0, 0.77778],
1756    "8929": [0.30274, 0.79383, 0, 0, 0.77778],
1757    "8934": [0.23222, 0.74111, 0, 0, 0.77778],
1758    "8935": [0.23222, 0.74111, 0, 0, 0.77778],
1759    "8936": [0.23222, 0.74111, 0, 0, 0.77778],
1760    "8937": [0.23222, 0.74111, 0, 0, 0.77778],
1761    "8938": [0.20576, 0.70576, 0, 0, 0.77778],
1762    "8939": [0.20576, 0.70576, 0, 0, 0.77778],
1763    "8940": [0.30274, 0.79383, 0, 0, 0.77778],
1764    "8941": [0.30274, 0.79383, 0, 0, 0.77778],
1765    "8994": [0.19444, 0.69224, 0, 0, 0.77778],
1766    "8995": [0.19444, 0.69224, 0, 0, 0.77778],
1767    "9416": [0.15559, 0.69224, 0, 0, 0.90222],
1768    "9484": [0, 0.69224, 0, 0, 0.5],
1769    "9488": [0, 0.69224, 0, 0, 0.5],
1770    "9492": [0, 0.37788, 0, 0, 0.5],
1771    "9496": [0, 0.37788, 0, 0, 0.5],
1772    "9585": [0.19444, 0.68889, 0, 0, 0.88889],
1773    "9586": [0.19444, 0.74111, 0, 0, 0.88889],
1774    "9632": [0, 0.675, 0, 0, 0.77778],
1775    "9633": [0, 0.675, 0, 0, 0.77778],
1776    "9650": [0, 0.54986, 0, 0, 0.72222],
1777    "9651": [0, 0.54986, 0, 0, 0.72222],
1778    "9654": [0.03517, 0.54986, 0, 0, 0.77778],
1779    "9660": [0, 0.54986, 0, 0, 0.72222],
1780    "9661": [0, 0.54986, 0, 0, 0.72222],
1781    "9664": [0.03517, 0.54986, 0, 0, 0.77778],
1782    "9674": [0.11111, 0.69224, 0, 0, 0.66667],
1783    "9733": [0.19444, 0.69224, 0, 0, 0.94445],
1784    "10003": [0, 0.69224, 0, 0, 0.83334],
1785    "10016": [0, 0.69224, 0, 0, 0.83334],
1786    "10731": [0.11111, 0.69224, 0, 0, 0.66667],
1787    "10846": [0.19444, 0.75583, 0, 0, 0.61111],
1788    "10877": [0.13667, 0.63667, 0, 0, 0.77778],
1789    "10878": [0.13667, 0.63667, 0, 0, 0.77778],
1790    "10885": [0.25583, 0.75583, 0, 0, 0.77778],
1791    "10886": [0.25583, 0.75583, 0, 0, 0.77778],
1792    "10887": [0.13597, 0.63597, 0, 0, 0.77778],
1793    "10888": [0.13597, 0.63597, 0, 0, 0.77778],
1794    "10889": [0.26167, 0.75726, 0, 0, 0.77778],
1795    "10890": [0.26167, 0.75726, 0, 0, 0.77778],
1796    "10891": [0.48256, 0.98256, 0, 0, 0.77778],
1797    "10892": [0.48256, 0.98256, 0, 0, 0.77778],
1798    "10901": [0.13667, 0.63667, 0, 0, 0.77778],
1799    "10902": [0.13667, 0.63667, 0, 0, 0.77778],
1800    "10933": [0.25142, 0.75726, 0, 0, 0.77778],
1801    "10934": [0.25142, 0.75726, 0, 0, 0.77778],
1802    "10935": [0.26167, 0.75726, 0, 0, 0.77778],
1803    "10936": [0.26167, 0.75726, 0, 0, 0.77778],
1804    "10937": [0.26167, 0.75726, 0, 0, 0.77778],
1805    "10938": [0.26167, 0.75726, 0, 0, 0.77778],
1806    "10949": [0.25583, 0.75583, 0, 0, 0.77778],
1807    "10950": [0.25583, 0.75583, 0, 0, 0.77778],
1808    "10955": [0.28481, 0.79383, 0, 0, 0.77778],
1809    "10956": [0.28481, 0.79383, 0, 0, 0.77778],
1810    "57350": [0.08167, 0.58167, 0, 0, 0.22222],
1811    "57351": [0.08167, 0.58167, 0, 0, 0.38889],
1812    "57352": [0.08167, 0.58167, 0, 0, 0.77778],
1813    "57353": [0, 0.43056, 0.04028, 0, 0.66667],
1814    "57356": [0.25142, 0.75726, 0, 0, 0.77778],
1815    "57357": [0.25142, 0.75726, 0, 0, 0.77778],
1816    "57358": [0.41951, 0.91951, 0, 0, 0.77778],
1817    "57359": [0.30274, 0.79383, 0, 0, 0.77778],
1818    "57360": [0.30274, 0.79383, 0, 0, 0.77778],
1819    "57361": [0.41951, 0.91951, 0, 0, 0.77778],
1820    "57366": [0.25142, 0.75726, 0, 0, 0.77778],
1821    "57367": [0.25142, 0.75726, 0, 0, 0.77778],
1822    "57368": [0.25142, 0.75726, 0, 0, 0.77778],
1823    "57369": [0.25142, 0.75726, 0, 0, 0.77778],
1824    "57370": [0.13597, 0.63597, 0, 0, 0.77778],
1825    "57371": [0.13597, 0.63597, 0, 0, 0.77778]
1826  },
1827  "Caligraphic-Regular": {
1828    "48": [0, 0.43056, 0, 0, 0.5],
1829    "49": [0, 0.43056, 0, 0, 0.5],
1830    "50": [0, 0.43056, 0, 0, 0.5],
1831    "51": [0.19444, 0.43056, 0, 0, 0.5],
1832    "52": [0.19444, 0.43056, 0, 0, 0.5],
1833    "53": [0.19444, 0.43056, 0, 0, 0.5],
1834    "54": [0, 0.64444, 0, 0, 0.5],
1835    "55": [0.19444, 0.43056, 0, 0, 0.5],
1836    "56": [0, 0.64444, 0, 0, 0.5],
1837    "57": [0.19444, 0.43056, 0, 0, 0.5],
1838    "65": [0, 0.68333, 0, 0.19445, 0.79847],
1839    "66": [0, 0.68333, 0.03041, 0.13889, 0.65681],
1840    "67": [0, 0.68333, 0.05834, 0.13889, 0.52653],
1841    "68": [0, 0.68333, 0.02778, 0.08334, 0.77139],
1842    "69": [0, 0.68333, 0.08944, 0.11111, 0.52778],
1843    "70": [0, 0.68333, 0.09931, 0.11111, 0.71875],
1844    "71": [0.09722, 0.68333, 0.0593, 0.11111, 0.59487],
1845    "72": [0, 0.68333, 0.00965, 0.11111, 0.84452],
1846    "73": [0, 0.68333, 0.07382, 0, 0.54452],
1847    "74": [0.09722, 0.68333, 0.18472, 0.16667, 0.67778],
1848    "75": [0, 0.68333, 0.01445, 0.05556, 0.76195],
1849    "76": [0, 0.68333, 0, 0.13889, 0.68972],
1850    "77": [0, 0.68333, 0, 0.13889, 1.2009],
1851    "78": [0, 0.68333, 0.14736, 0.08334, 0.82049],
1852    "79": [0, 0.68333, 0.02778, 0.11111, 0.79611],
1853    "80": [0, 0.68333, 0.08222, 0.08334, 0.69556],
1854    "81": [0.09722, 0.68333, 0, 0.11111, 0.81667],
1855    "82": [0, 0.68333, 0, 0.08334, 0.8475],
1856    "83": [0, 0.68333, 0.075, 0.13889, 0.60556],
1857    "84": [0, 0.68333, 0.25417, 0, 0.54464],
1858    "85": [0, 0.68333, 0.09931, 0.08334, 0.62583],
1859    "86": [0, 0.68333, 0.08222, 0, 0.61278],
1860    "87": [0, 0.68333, 0.08222, 0.08334, 0.98778],
1861    "88": [0, 0.68333, 0.14643, 0.13889, 0.7133],
1862    "89": [0.09722, 0.68333, 0.08222, 0.08334, 0.66834],
1863    "90": [0, 0.68333, 0.07944, 0.13889, 0.72473]
1864  },
1865  "Fraktur-Regular": {
1866    "33": [0, 0.69141, 0, 0, 0.29574],
1867    "34": [0, 0.69141, 0, 0, 0.21471],
1868    "38": [0, 0.69141, 0, 0, 0.73786],
1869    "39": [0, 0.69141, 0, 0, 0.21201],
1870    "40": [0.24982, 0.74947, 0, 0, 0.38865],
1871    "41": [0.24982, 0.74947, 0, 0, 0.38865],
1872    "42": [0, 0.62119, 0, 0, 0.27764],
1873    "43": [0.08319, 0.58283, 0, 0, 0.75623],
1874    "44": [0, 0.10803, 0, 0, 0.27764],
1875    "45": [0.08319, 0.58283, 0, 0, 0.75623],
1876    "46": [0, 0.10803, 0, 0, 0.27764],
1877    "47": [0.24982, 0.74947, 0, 0, 0.50181],
1878    "48": [0, 0.47534, 0, 0, 0.50181],
1879    "49": [0, 0.47534, 0, 0, 0.50181],
1880    "50": [0, 0.47534, 0, 0, 0.50181],
1881    "51": [0.18906, 0.47534, 0, 0, 0.50181],
1882    "52": [0.18906, 0.47534, 0, 0, 0.50181],
1883    "53": [0.18906, 0.47534, 0, 0, 0.50181],
1884    "54": [0, 0.69141, 0, 0, 0.50181],
1885    "55": [0.18906, 0.47534, 0, 0, 0.50181],
1886    "56": [0, 0.69141, 0, 0, 0.50181],
1887    "57": [0.18906, 0.47534, 0, 0, 0.50181],
1888    "58": [0, 0.47534, 0, 0, 0.21606],
1889    "59": [0.12604, 0.47534, 0, 0, 0.21606],
1890    "61": [-0.13099, 0.36866, 0, 0, 0.75623],
1891    "63": [0, 0.69141, 0, 0, 0.36245],
1892    "65": [0, 0.69141, 0, 0, 0.7176],
1893    "66": [0, 0.69141, 0, 0, 0.88397],
1894    "67": [0, 0.69141, 0, 0, 0.61254],
1895    "68": [0, 0.69141, 0, 0, 0.83158],
1896    "69": [0, 0.69141, 0, 0, 0.66278],
1897    "70": [0.12604, 0.69141, 0, 0, 0.61119],
1898    "71": [0, 0.69141, 0, 0, 0.78539],
1899    "72": [0.06302, 0.69141, 0, 0, 0.7203],
1900    "73": [0, 0.69141, 0, 0, 0.55448],
1901    "74": [0.12604, 0.69141, 0, 0, 0.55231],
1902    "75": [0, 0.69141, 0, 0, 0.66845],
1903    "76": [0, 0.69141, 0, 0, 0.66602],
1904    "77": [0, 0.69141, 0, 0, 1.04953],
1905    "78": [0, 0.69141, 0, 0, 0.83212],
1906    "79": [0, 0.69141, 0, 0, 0.82699],
1907    "80": [0.18906, 0.69141, 0, 0, 0.82753],
1908    "81": [0.03781, 0.69141, 0, 0, 0.82699],
1909    "82": [0, 0.69141, 0, 0, 0.82807],
1910    "83": [0, 0.69141, 0, 0, 0.82861],
1911    "84": [0, 0.69141, 0, 0, 0.66899],
1912    "85": [0, 0.69141, 0, 0, 0.64576],
1913    "86": [0, 0.69141, 0, 0, 0.83131],
1914    "87": [0, 0.69141, 0, 0, 1.04602],
1915    "88": [0, 0.69141, 0, 0, 0.71922],
1916    "89": [0.18906, 0.69141, 0, 0, 0.83293],
1917    "90": [0.12604, 0.69141, 0, 0, 0.60201],
1918    "91": [0.24982, 0.74947, 0, 0, 0.27764],
1919    "93": [0.24982, 0.74947, 0, 0, 0.27764],
1920    "94": [0, 0.69141, 0, 0, 0.49965],
1921    "97": [0, 0.47534, 0, 0, 0.50046],
1922    "98": [0, 0.69141, 0, 0, 0.51315],
1923    "99": [0, 0.47534, 0, 0, 0.38946],
1924    "100": [0, 0.62119, 0, 0, 0.49857],
1925    "101": [0, 0.47534, 0, 0, 0.40053],
1926    "102": [0.18906, 0.69141, 0, 0, 0.32626],
1927    "103": [0.18906, 0.47534, 0, 0, 0.5037],
1928    "104": [0.18906, 0.69141, 0, 0, 0.52126],
1929    "105": [0, 0.69141, 0, 0, 0.27899],
1930    "106": [0, 0.69141, 0, 0, 0.28088],
1931    "107": [0, 0.69141, 0, 0, 0.38946],
1932    "108": [0, 0.69141, 0, 0, 0.27953],
1933    "109": [0, 0.47534, 0, 0, 0.76676],
1934    "110": [0, 0.47534, 0, 0, 0.52666],
1935    "111": [0, 0.47534, 0, 0, 0.48885],
1936    "112": [0.18906, 0.52396, 0, 0, 0.50046],
1937    "113": [0.18906, 0.47534, 0, 0, 0.48912],
1938    "114": [0, 0.47534, 0, 0, 0.38919],
1939    "115": [0, 0.47534, 0, 0, 0.44266],
1940    "116": [0, 0.62119, 0, 0, 0.33301],
1941    "117": [0, 0.47534, 0, 0, 0.5172],
1942    "118": [0, 0.52396, 0, 0, 0.5118],
1943    "119": [0, 0.52396, 0, 0, 0.77351],
1944    "120": [0.18906, 0.47534, 0, 0, 0.38865],
1945    "121": [0.18906, 0.47534, 0, 0, 0.49884],
1946    "122": [0.18906, 0.47534, 0, 0, 0.39054],
1947    "8216": [0, 0.69141, 0, 0, 0.21471],
1948    "8217": [0, 0.69141, 0, 0, 0.21471],
1949    "58112": [0, 0.62119, 0, 0, 0.49749],
1950    "58113": [0, 0.62119, 0, 0, 0.4983],
1951    "58114": [0.18906, 0.69141, 0, 0, 0.33328],
1952    "58115": [0.18906, 0.69141, 0, 0, 0.32923],
1953    "58116": [0.18906, 0.47534, 0, 0, 0.50343],
1954    "58117": [0, 0.69141, 0, 0, 0.33301],
1955    "58118": [0, 0.62119, 0, 0, 0.33409],
1956    "58119": [0, 0.47534, 0, 0, 0.50073]
1957  },
1958  "Main-Bold": {
1959    "33": [0, 0.69444, 0, 0, 0.35],
1960    "34": [0, 0.69444, 0, 0, 0.60278],
1961    "35": [0.19444, 0.69444, 0, 0, 0.95833],
1962    "36": [0.05556, 0.75, 0, 0, 0.575],
1963    "37": [0.05556, 0.75, 0, 0, 0.95833],
1964    "38": [0, 0.69444, 0, 0, 0.89444],
1965    "39": [0, 0.69444, 0, 0, 0.31944],
1966    "40": [0.25, 0.75, 0, 0, 0.44722],
1967    "41": [0.25, 0.75, 0, 0, 0.44722],
1968    "42": [0, 0.75, 0, 0, 0.575],
1969    "43": [0.13333, 0.63333, 0, 0, 0.89444],
1970    "44": [0.19444, 0.15556, 0, 0, 0.31944],
1971    "45": [0, 0.44444, 0, 0, 0.38333],
1972    "46": [0, 0.15556, 0, 0, 0.31944],
1973    "47": [0.25, 0.75, 0, 0, 0.575],
1974    "48": [0, 0.64444, 0, 0, 0.575],
1975    "49": [0, 0.64444, 0, 0, 0.575],
1976    "50": [0, 0.64444, 0, 0, 0.575],
1977    "51": [0, 0.64444, 0, 0, 0.575],
1978    "52": [0, 0.64444, 0, 0, 0.575],
1979    "53": [0, 0.64444, 0, 0, 0.575],
1980    "54": [0, 0.64444, 0, 0, 0.575],
1981    "55": [0, 0.64444, 0, 0, 0.575],
1982    "56": [0, 0.64444, 0, 0, 0.575],
1983    "57": [0, 0.64444, 0, 0, 0.575],
1984    "58": [0, 0.44444, 0, 0, 0.31944],
1985    "59": [0.19444, 0.44444, 0, 0, 0.31944],
1986    "60": [0.08556, 0.58556, 0, 0, 0.89444],
1987    "61": [-0.10889, 0.39111, 0, 0, 0.89444],
1988    "62": [0.08556, 0.58556, 0, 0, 0.89444],
1989    "63": [0, 0.69444, 0, 0, 0.54305],
1990    "64": [0, 0.69444, 0, 0, 0.89444],
1991    "65": [0, 0.68611, 0, 0, 0.86944],
1992    "66": [0, 0.68611, 0, 0, 0.81805],
1993    "67": [0, 0.68611, 0, 0, 0.83055],
1994    "68": [0, 0.68611, 0, 0, 0.88194],
1995    "69": [0, 0.68611, 0, 0, 0.75555],
1996    "70": [0, 0.68611, 0, 0, 0.72361],
1997    "71": [0, 0.68611, 0, 0, 0.90416],
1998    "72": [0, 0.68611, 0, 0, 0.9],
1999    "73": [0, 0.68611, 0, 0, 0.43611],
2000    "74": [0, 0.68611, 0, 0, 0.59444],
2001    "75": [0, 0.68611, 0, 0, 0.90138],
2002    "76": [0, 0.68611, 0, 0, 0.69166],
2003    "77": [0, 0.68611, 0, 0, 1.09166],
2004    "78": [0, 0.68611, 0, 0, 0.9],
2005    "79": [0, 0.68611, 0, 0, 0.86388],
2006    "80": [0, 0.68611, 0, 0, 0.78611],
2007    "81": [0.19444, 0.68611, 0, 0, 0.86388],
2008    "82": [0, 0.68611, 0, 0, 0.8625],
2009    "83": [0, 0.68611, 0, 0, 0.63889],
2010    "84": [0, 0.68611, 0, 0, 0.8],
2011    "85": [0, 0.68611, 0, 0, 0.88472],
2012    "86": [0, 0.68611, 0.01597, 0, 0.86944],
2013    "87": [0, 0.68611, 0.01597, 0, 1.18888],
2014    "88": [0, 0.68611, 0, 0, 0.86944],
2015    "89": [0, 0.68611, 0.02875, 0, 0.86944],
2016    "90": [0, 0.68611, 0, 0, 0.70277],
2017    "91": [0.25, 0.75, 0, 0, 0.31944],
2018    "92": [0.25, 0.75, 0, 0, 0.575],
2019    "93": [0.25, 0.75, 0, 0, 0.31944],
2020    "94": [0, 0.69444, 0, 0, 0.575],
2021    "95": [0.31, 0.13444, 0.03194, 0, 0.575],
2022    "97": [0, 0.44444, 0, 0, 0.55902],
2023    "98": [0, 0.69444, 0, 0, 0.63889],
2024    "99": [0, 0.44444, 0, 0, 0.51111],
2025    "100": [0, 0.69444, 0, 0, 0.63889],
2026    "101": [0, 0.44444, 0, 0, 0.52708],
2027    "102": [0, 0.69444, 0.10903, 0, 0.35139],
2028    "103": [0.19444, 0.44444, 0.01597, 0, 0.575],
2029    "104": [0, 0.69444, 0, 0, 0.63889],
2030    "105": [0, 0.69444, 0, 0, 0.31944],
2031    "106": [0.19444, 0.69444, 0, 0, 0.35139],
2032    "107": [0, 0.69444, 0, 0, 0.60694],
2033    "108": [0, 0.69444, 0, 0, 0.31944],
2034    "109": [0, 0.44444, 0, 0, 0.95833],
2035    "110": [0, 0.44444, 0, 0, 0.63889],
2036    "111": [0, 0.44444, 0, 0, 0.575],
2037    "112": [0.19444, 0.44444, 0, 0, 0.63889],
2038    "113": [0.19444, 0.44444, 0, 0, 0.60694],
2039    "114": [0, 0.44444, 0, 0, 0.47361],
2040    "115": [0, 0.44444, 0, 0, 0.45361],
2041    "116": [0, 0.63492, 0, 0, 0.44722],
2042    "117": [0, 0.44444, 0, 0, 0.63889],
2043    "118": [0, 0.44444, 0.01597, 0, 0.60694],
2044    "119": [0, 0.44444, 0.01597, 0, 0.83055],
2045    "120": [0, 0.44444, 0, 0, 0.60694],
2046    "121": [0.19444, 0.44444, 0.01597, 0, 0.60694],
2047    "122": [0, 0.44444, 0, 0, 0.51111],
2048    "123": [0.25, 0.75, 0, 0, 0.575],
2049    "124": [0.25, 0.75, 0, 0, 0.31944],
2050    "125": [0.25, 0.75, 0, 0, 0.575],
2051    "126": [0.35, 0.34444, 0, 0, 0.575],
2052    "168": [0, 0.69444, 0, 0, 0.575],
2053    "172": [0, 0.44444, 0, 0, 0.76666],
2054    "176": [0, 0.69444, 0, 0, 0.86944],
2055    "177": [0.13333, 0.63333, 0, 0, 0.89444],
2056    "184": [0.17014, 0, 0, 0, 0.51111],
2057    "198": [0, 0.68611, 0, 0, 1.04166],
2058    "215": [0.13333, 0.63333, 0, 0, 0.89444],
2059    "216": [0.04861, 0.73472, 0, 0, 0.89444],
2060    "223": [0, 0.69444, 0, 0, 0.59722],
2061    "230": [0, 0.44444, 0, 0, 0.83055],
2062    "247": [0.13333, 0.63333, 0, 0, 0.89444],
2063    "248": [0.09722, 0.54167, 0, 0, 0.575],
2064    "305": [0, 0.44444, 0, 0, 0.31944],
2065    "338": [0, 0.68611, 0, 0, 1.16944],
2066    "339": [0, 0.44444, 0, 0, 0.89444],
2067    "567": [0.19444, 0.44444, 0, 0, 0.35139],
2068    "710": [0, 0.69444, 0, 0, 0.575],
2069    "711": [0, 0.63194, 0, 0, 0.575],
2070    "713": [0, 0.59611, 0, 0, 0.575],
2071    "714": [0, 0.69444, 0, 0, 0.575],
2072    "715": [0, 0.69444, 0, 0, 0.575],
2073    "728": [0, 0.69444, 0, 0, 0.575],
2074    "729": [0, 0.69444, 0, 0, 0.31944],
2075    "730": [0, 0.69444, 0, 0, 0.86944],
2076    "732": [0, 0.69444, 0, 0, 0.575],
2077    "733": [0, 0.69444, 0, 0, 0.575],
2078    "915": [0, 0.68611, 0, 0, 0.69166],
2079    "916": [0, 0.68611, 0, 0, 0.95833],
2080    "920": [0, 0.68611, 0, 0, 0.89444],
2081    "923": [0, 0.68611, 0, 0, 0.80555],
2082    "926": [0, 0.68611, 0, 0, 0.76666],
2083    "928": [0, 0.68611, 0, 0, 0.9],
2084    "931": [0, 0.68611, 0, 0, 0.83055],
2085    "933": [0, 0.68611, 0, 0, 0.89444],
2086    "934": [0, 0.68611, 0, 0, 0.83055],
2087    "936": [0, 0.68611, 0, 0, 0.89444],
2088    "937": [0, 0.68611, 0, 0, 0.83055],
2089    "8211": [0, 0.44444, 0.03194, 0, 0.575],
2090    "8212": [0, 0.44444, 0.03194, 0, 1.14999],
2091    "8216": [0, 0.69444, 0, 0, 0.31944],
2092    "8217": [0, 0.69444, 0, 0, 0.31944],
2093    "8220": [0, 0.69444, 0, 0, 0.60278],
2094    "8221": [0, 0.69444, 0, 0, 0.60278],
2095    "8224": [0.19444, 0.69444, 0, 0, 0.51111],
2096    "8225": [0.19444, 0.69444, 0, 0, 0.51111],
2097    "8242": [0, 0.55556, 0, 0, 0.34444],
2098    "8407": [0, 0.72444, 0.15486, 0, 0.575],
2099    "8463": [0, 0.69444, 0, 0, 0.66759],
2100    "8465": [0, 0.69444, 0, 0, 0.83055],
2101    "8467": [0, 0.69444, 0, 0, 0.47361],
2102    "8472": [0.19444, 0.44444, 0, 0, 0.74027],
2103    "8476": [0, 0.69444, 0, 0, 0.83055],
2104    "8501": [0, 0.69444, 0, 0, 0.70277],
2105    "8592": [-0.10889, 0.39111, 0, 0, 1.14999],
2106    "8593": [0.19444, 0.69444, 0, 0, 0.575],
2107    "8594": [-0.10889, 0.39111, 0, 0, 1.14999],
2108    "8595": [0.19444, 0.69444, 0, 0, 0.575],
2109    "8596": [-0.10889, 0.39111, 0, 0, 1.14999],
2110    "8597": [0.25, 0.75, 0, 0, 0.575],
2111    "8598": [0.19444, 0.69444, 0, 0, 1.14999],
2112    "8599": [0.19444, 0.69444, 0, 0, 1.14999],
2113    "8600": [0.19444, 0.69444, 0, 0, 1.14999],
2114    "8601": [0.19444, 0.69444, 0, 0, 1.14999],
2115    "8636": [-0.10889, 0.39111, 0, 0, 1.14999],
2116    "8637": [-0.10889, 0.39111, 0, 0, 1.14999],
2117    "8640": [-0.10889, 0.39111, 0, 0, 1.14999],
2118    "8641": [-0.10889, 0.39111, 0, 0, 1.14999],
2119    "8656": [-0.10889, 0.39111, 0, 0, 1.14999],
2120    "8657": [0.19444, 0.69444, 0, 0, 0.70277],
2121    "8658": [-0.10889, 0.39111, 0, 0, 1.14999],
2122    "8659": [0.19444, 0.69444, 0, 0, 0.70277],
2123    "8660": [-0.10889, 0.39111, 0, 0, 1.14999],
2124    "8661": [0.25, 0.75, 0, 0, 0.70277],
2125    "8704": [0, 0.69444, 0, 0, 0.63889],
2126    "8706": [0, 0.69444, 0.06389, 0, 0.62847],
2127    "8707": [0, 0.69444, 0, 0, 0.63889],
2128    "8709": [0.05556, 0.75, 0, 0, 0.575],
2129    "8711": [0, 0.68611, 0, 0, 0.95833],
2130    "8712": [0.08556, 0.58556, 0, 0, 0.76666],
2131    "8715": [0.08556, 0.58556, 0, 0, 0.76666],
2132    "8722": [0.13333, 0.63333, 0, 0, 0.89444],
2133    "8723": [0.13333, 0.63333, 0, 0, 0.89444],
2134    "8725": [0.25, 0.75, 0, 0, 0.575],
2135    "8726": [0.25, 0.75, 0, 0, 0.575],
2136    "8727": [-0.02778, 0.47222, 0, 0, 0.575],
2137    "8728": [-0.02639, 0.47361, 0, 0, 0.575],
2138    "8729": [-0.02639, 0.47361, 0, 0, 0.575],
2139    "8730": [0.18, 0.82, 0, 0, 0.95833],
2140    "8733": [0, 0.44444, 0, 0, 0.89444],
2141    "8734": [0, 0.44444, 0, 0, 1.14999],
2142    "8736": [0, 0.69224, 0, 0, 0.72222],
2143    "8739": [0.25, 0.75, 0, 0, 0.31944],
2144    "8741": [0.25, 0.75, 0, 0, 0.575],
2145    "8743": [0, 0.55556, 0, 0, 0.76666],
2146    "8744": [0, 0.55556, 0, 0, 0.76666],
2147    "8745": [0, 0.55556, 0, 0, 0.76666],
2148    "8746": [0, 0.55556, 0, 0, 0.76666],
2149    "8747": [0.19444, 0.69444, 0.12778, 0, 0.56875],
2150    "8764": [-0.10889, 0.39111, 0, 0, 0.89444],
2151    "8768": [0.19444, 0.69444, 0, 0, 0.31944],
2152    "8771": [0.00222, 0.50222, 0, 0, 0.89444],
2153    "8776": [0.02444, 0.52444, 0, 0, 0.89444],
2154    "8781": [0.00222, 0.50222, 0, 0, 0.89444],
2155    "8801": [0.00222, 0.50222, 0, 0, 0.89444],
2156    "8804": [0.19667, 0.69667, 0, 0, 0.89444],
2157    "8805": [0.19667, 0.69667, 0, 0, 0.89444],
2158    "8810": [0.08556, 0.58556, 0, 0, 1.14999],
2159    "8811": [0.08556, 0.58556, 0, 0, 1.14999],
2160    "8826": [0.08556, 0.58556, 0, 0, 0.89444],
2161    "8827": [0.08556, 0.58556, 0, 0, 0.89444],
2162    "8834": [0.08556, 0.58556, 0, 0, 0.89444],
2163    "8835": [0.08556, 0.58556, 0, 0, 0.89444],
2164    "8838": [0.19667, 0.69667, 0, 0, 0.89444],
2165    "8839": [0.19667, 0.69667, 0, 0, 0.89444],
2166    "8846": [0, 0.55556, 0, 0, 0.76666],
2167    "8849": [0.19667, 0.69667, 0, 0, 0.89444],
2168    "8850": [0.19667, 0.69667, 0, 0, 0.89444],
2169    "8851": [0, 0.55556, 0, 0, 0.76666],
2170    "8852": [0, 0.55556, 0, 0, 0.76666],
2171    "8853": [0.13333, 0.63333, 0, 0, 0.89444],
2172    "8854": [0.13333, 0.63333, 0, 0, 0.89444],
2173    "8855": [0.13333, 0.63333, 0, 0, 0.89444],
2174    "8856": [0.13333, 0.63333, 0, 0, 0.89444],
2175    "8857": [0.13333, 0.63333, 0, 0, 0.89444],
2176    "8866": [0, 0.69444, 0, 0, 0.70277],
2177    "8867": [0, 0.69444, 0, 0, 0.70277],
2178    "8868": [0, 0.69444, 0, 0, 0.89444],
2179    "8869": [0, 0.69444, 0, 0, 0.89444],
2180    "8900": [-0.02639, 0.47361, 0, 0, 0.575],
2181    "8901": [-0.02639, 0.47361, 0, 0, 0.31944],
2182    "8902": [-0.02778, 0.47222, 0, 0, 0.575],
2183    "8968": [0.25, 0.75, 0, 0, 0.51111],
2184    "8969": [0.25, 0.75, 0, 0, 0.51111],
2185    "8970": [0.25, 0.75, 0, 0, 0.51111],
2186    "8971": [0.25, 0.75, 0, 0, 0.51111],
2187    "8994": [-0.13889, 0.36111, 0, 0, 1.14999],
2188    "8995": [-0.13889, 0.36111, 0, 0, 1.14999],
2189    "9651": [0.19444, 0.69444, 0, 0, 1.02222],
2190    "9657": [-0.02778, 0.47222, 0, 0, 0.575],
2191    "9661": [0.19444, 0.69444, 0, 0, 1.02222],
2192    "9667": [-0.02778, 0.47222, 0, 0, 0.575],
2193    "9711": [0.19444, 0.69444, 0, 0, 1.14999],
2194    "9824": [0.12963, 0.69444, 0, 0, 0.89444],
2195    "9825": [0.12963, 0.69444, 0, 0, 0.89444],
2196    "9826": [0.12963, 0.69444, 0, 0, 0.89444],
2197    "9827": [0.12963, 0.69444, 0, 0, 0.89444],
2198    "9837": [0, 0.75, 0, 0, 0.44722],
2199    "9838": [0.19444, 0.69444, 0, 0, 0.44722],
2200    "9839": [0.19444, 0.69444, 0, 0, 0.44722],
2201    "10216": [0.25, 0.75, 0, 0, 0.44722],
2202    "10217": [0.25, 0.75, 0, 0, 0.44722],
2203    "10815": [0, 0.68611, 0, 0, 0.9],
2204    "10927": [0.19667, 0.69667, 0, 0, 0.89444],
2205    "10928": [0.19667, 0.69667, 0, 0, 0.89444],
2206    "57376": [0.19444, 0.69444, 0, 0, 0]
2207  },
2208  "Main-BoldItalic": {
2209    "33": [0, 0.69444, 0.11417, 0, 0.38611],
2210    "34": [0, 0.69444, 0.07939, 0, 0.62055],
2211    "35": [0.19444, 0.69444, 0.06833, 0, 0.94444],
2212    "37": [0.05556, 0.75, 0.12861, 0, 0.94444],
2213    "38": [0, 0.69444, 0.08528, 0, 0.88555],
2214    "39": [0, 0.69444, 0.12945, 0, 0.35555],
2215    "40": [0.25, 0.75, 0.15806, 0, 0.47333],
2216    "41": [0.25, 0.75, 0.03306, 0, 0.47333],
2217    "42": [0, 0.75, 0.14333, 0, 0.59111],
2218    "43": [0.10333, 0.60333, 0.03306, 0, 0.88555],
2219    "44": [0.19444, 0.14722, 0, 0, 0.35555],
2220    "45": [0, 0.44444, 0.02611, 0, 0.41444],
2221    "46": [0, 0.14722, 0, 0, 0.35555],
2222    "47": [0.25, 0.75, 0.15806, 0, 0.59111],
2223    "48": [0, 0.64444, 0.13167, 0, 0.59111],
2224    "49": [0, 0.64444, 0.13167, 0, 0.59111],
2225    "50": [0, 0.64444, 0.13167, 0, 0.59111],
2226    "51": [0, 0.64444, 0.13167, 0, 0.59111],
2227    "52": [0.19444, 0.64444, 0.13167, 0, 0.59111],
2228    "53": [0, 0.64444, 0.13167, 0, 0.59111],
2229    "54": [0, 0.64444, 0.13167, 0, 0.59111],
2230    "55": [0.19444, 0.64444, 0.13167, 0, 0.59111],
2231    "56": [0, 0.64444, 0.13167, 0, 0.59111],
2232    "57": [0, 0.64444, 0.13167, 0, 0.59111],
2233    "58": [0, 0.44444, 0.06695, 0, 0.35555],
2234    "59": [0.19444, 0.44444, 0.06695, 0, 0.35555],
2235    "61": [-0.10889, 0.39111, 0.06833, 0, 0.88555],
2236    "63": [0, 0.69444, 0.11472, 0, 0.59111],
2237    "64": [0, 0.69444, 0.09208, 0, 0.88555],
2238    "65": [0, 0.68611, 0, 0, 0.86555],
2239    "66": [0, 0.68611, 0.0992, 0, 0.81666],
2240    "67": [0, 0.68611, 0.14208, 0, 0.82666],
2241    "68": [0, 0.68611, 0.09062, 0, 0.87555],
2242    "69": [0, 0.68611, 0.11431, 0, 0.75666],
2243    "70": [0, 0.68611, 0.12903, 0, 0.72722],
2244    "71": [0, 0.68611, 0.07347, 0, 0.89527],
2245    "72": [0, 0.68611, 0.17208, 0, 0.8961],
2246    "73": [0, 0.68611, 0.15681, 0, 0.47166],
2247    "74": [0, 0.68611, 0.145, 0, 0.61055],
2248    "75": [0, 0.68611, 0.14208, 0, 0.89499],
2249    "76": [0, 0.68611, 0, 0, 0.69777],
2250    "77": [0, 0.68611, 0.17208, 0, 1.07277],
2251    "78": [0, 0.68611, 0.17208, 0, 0.8961],
2252    "79": [0, 0.68611, 0.09062, 0, 0.85499],
2253    "80": [0, 0.68611, 0.0992, 0, 0.78721],
2254    "81": [0.19444, 0.68611, 0.09062, 0, 0.85499],
2255    "82": [0, 0.68611, 0.02559, 0, 0.85944],
2256    "83": [0, 0.68611, 0.11264, 0, 0.64999],
2257    "84": [0, 0.68611, 0.12903, 0, 0.7961],
2258    "85": [0, 0.68611, 0.17208, 0, 0.88083],
2259    "86": [0, 0.68611, 0.18625, 0, 0.86555],
2260    "87": [0, 0.68611, 0.18625, 0, 1.15999],
2261    "88": [0, 0.68611, 0.15681, 0, 0.86555],
2262    "89": [0, 0.68611, 0.19803, 0, 0.86555],
2263    "90": [0, 0.68611, 0.14208, 0, 0.70888],
2264    "91": [0.25, 0.75, 0.1875, 0, 0.35611],
2265    "93": [0.25, 0.75, 0.09972, 0, 0.35611],
2266    "94": [0, 0.69444, 0.06709, 0, 0.59111],
2267    "95": [0.31, 0.13444, 0.09811, 0, 0.59111],
2268    "97": [0, 0.44444, 0.09426, 0, 0.59111],
2269    "98": [0, 0.69444, 0.07861, 0, 0.53222],
2270    "99": [0, 0.44444, 0.05222, 0, 0.53222],
2271    "100": [0, 0.69444, 0.10861, 0, 0.59111],
2272    "101": [0, 0.44444, 0.085, 0, 0.53222],
2273    "102": [0.19444, 0.69444, 0.21778, 0, 0.4],
2274    "103": [0.19444, 0.44444, 0.105, 0, 0.53222],
2275    "104": [0, 0.69444, 0.09426, 0, 0.59111],
2276    "105": [0, 0.69326, 0.11387, 0, 0.35555],
2277    "106": [0.19444, 0.69326, 0.1672, 0, 0.35555],
2278    "107": [0, 0.69444, 0.11111, 0, 0.53222],
2279    "108": [0, 0.69444, 0.10861, 0, 0.29666],
2280    "109": [0, 0.44444, 0.09426, 0, 0.94444],
2281    "110": [0, 0.44444, 0.09426, 0, 0.64999],
2282    "111": [0, 0.44444, 0.07861, 0, 0.59111],
2283    "112": [0.19444, 0.44444, 0.07861, 0, 0.59111],
2284    "113": [0.19444, 0.44444, 0.105, 0, 0.53222],
2285    "114": [0, 0.44444, 0.11111, 0, 0.50167],
2286    "115": [0, 0.44444, 0.08167, 0, 0.48694],
2287    "116": [0, 0.63492, 0.09639, 0, 0.385],
2288    "117": [0, 0.44444, 0.09426, 0, 0.62055],
2289    "118": [0, 0.44444, 0.11111, 0, 0.53222],
2290    "119": [0, 0.44444, 0.11111, 0, 0.76777],
2291    "120": [0, 0.44444, 0.12583, 0, 0.56055],
2292    "121": [0.19444, 0.44444, 0.105, 0, 0.56166],
2293    "122": [0, 0.44444, 0.13889, 0, 0.49055],
2294    "126": [0.35, 0.34444, 0.11472, 0, 0.59111],
2295    "163": [0, 0.69444, 0, 0, 0.86853],
2296    "168": [0, 0.69444, 0.11473, 0, 0.59111],
2297    "176": [0, 0.69444, 0, 0, 0.94888],
2298    "184": [0.17014, 0, 0, 0, 0.53222],
2299    "198": [0, 0.68611, 0.11431, 0, 1.02277],
2300    "216": [0.04861, 0.73472, 0.09062, 0, 0.88555],
2301    "223": [0.19444, 0.69444, 0.09736, 0, 0.665],
2302    "230": [0, 0.44444, 0.085, 0, 0.82666],
2303    "248": [0.09722, 0.54167, 0.09458, 0, 0.59111],
2304    "305": [0, 0.44444, 0.09426, 0, 0.35555],
2305    "338": [0, 0.68611, 0.11431, 0, 1.14054],
2306    "339": [0, 0.44444, 0.085, 0, 0.82666],
2307    "567": [0.19444, 0.44444, 0.04611, 0, 0.385],
2308    "710": [0, 0.69444, 0.06709, 0, 0.59111],
2309    "711": [0, 0.63194, 0.08271, 0, 0.59111],
2310    "713": [0, 0.59444, 0.10444, 0, 0.59111],
2311    "714": [0, 0.69444, 0.08528, 0, 0.59111],
2312    "715": [0, 0.69444, 0, 0, 0.59111],
2313    "728": [0, 0.69444, 0.10333, 0, 0.59111],
2314    "729": [0, 0.69444, 0.12945, 0, 0.35555],
2315    "730": [0, 0.69444, 0, 0, 0.94888],
2316    "732": [0, 0.69444, 0.11472, 0, 0.59111],
2317    "733": [0, 0.69444, 0.11472, 0, 0.59111],
2318    "915": [0, 0.68611, 0.12903, 0, 0.69777],
2319    "916": [0, 0.68611, 0, 0, 0.94444],
2320    "920": [0, 0.68611, 0.09062, 0, 0.88555],
2321    "923": [0, 0.68611, 0, 0, 0.80666],
2322    "926": [0, 0.68611, 0.15092, 0, 0.76777],
2323    "928": [0, 0.68611, 0.17208, 0, 0.8961],
2324    "931": [0, 0.68611, 0.11431, 0, 0.82666],
2325    "933": [0, 0.68611, 0.10778, 0, 0.88555],
2326    "934": [0, 0.68611, 0.05632, 0, 0.82666],
2327    "936": [0, 0.68611, 0.10778, 0, 0.88555],
2328    "937": [0, 0.68611, 0.0992, 0, 0.82666],
2329    "8211": [0, 0.44444, 0.09811, 0, 0.59111],
2330    "8212": [0, 0.44444, 0.09811, 0, 1.18221],
2331    "8216": [0, 0.69444, 0.12945, 0, 0.35555],
2332    "8217": [0, 0.69444, 0.12945, 0, 0.35555],
2333    "8220": [0, 0.69444, 0.16772, 0, 0.62055],
2334    "8221": [0, 0.69444, 0.07939, 0, 0.62055]
2335  },
2336  "Main-Italic": {
2337    "33": [0, 0.69444, 0.12417, 0, 0.30667],
2338    "34": [0, 0.69444, 0.06961, 0, 0.51444],
2339    "35": [0.19444, 0.69444, 0.06616, 0, 0.81777],
2340    "37": [0.05556, 0.75, 0.13639, 0, 0.81777],
2341    "38": [0, 0.69444, 0.09694, 0, 0.76666],
2342    "39": [0, 0.69444, 0.12417, 0, 0.30667],
2343    "40": [0.25, 0.75, 0.16194, 0, 0.40889],
2344    "41": [0.25, 0.75, 0.03694, 0, 0.40889],
2345    "42": [0, 0.75, 0.14917, 0, 0.51111],
2346    "43": [0.05667, 0.56167, 0.03694, 0, 0.76666],
2347    "44": [0.19444, 0.10556, 0, 0, 0.30667],
2348    "45": [0, 0.43056, 0.02826, 0, 0.35778],
2349    "46": [0, 0.10556, 0, 0, 0.30667],
2350    "47": [0.25, 0.75, 0.16194, 0, 0.51111],
2351    "48": [0, 0.64444, 0.13556, 0, 0.51111],
2352    "49": [0, 0.64444, 0.13556, 0, 0.51111],
2353    "50": [0, 0.64444, 0.13556, 0, 0.51111],
2354    "51": [0, 0.64444, 0.13556, 0, 0.51111],
2355    "52": [0.19444, 0.64444, 0.13556, 0, 0.51111],
2356    "53": [0, 0.64444, 0.13556, 0, 0.51111],
2357    "54": [0, 0.64444, 0.13556, 0, 0.51111],
2358    "55": [0.19444, 0.64444, 0.13556, 0, 0.51111],
2359    "56": [0, 0.64444, 0.13556, 0, 0.51111],
2360    "57": [0, 0.64444, 0.13556, 0, 0.51111],
2361    "58": [0, 0.43056, 0.0582, 0, 0.30667],
2362    "59": [0.19444, 0.43056, 0.0582, 0, 0.30667],
2363    "61": [-0.13313, 0.36687, 0.06616, 0, 0.76666],
2364    "63": [0, 0.69444, 0.1225, 0, 0.51111],
2365    "64": [0, 0.69444, 0.09597, 0, 0.76666],
2366    "65": [0, 0.68333, 0, 0, 0.74333],
2367    "66": [0, 0.68333, 0.10257, 0, 0.70389],
2368    "67": [0, 0.68333, 0.14528, 0, 0.71555],
2369    "68": [0, 0.68333, 0.09403, 0, 0.755],
2370    "69": [0, 0.68333, 0.12028, 0, 0.67833],
2371    "70": [0, 0.68333, 0.13305, 0, 0.65277],
2372    "71": [0, 0.68333, 0.08722, 0, 0.77361],
2373    "72": [0, 0.68333, 0.16389, 0, 0.74333],
2374    "73": [0, 0.68333, 0.15806, 0, 0.38555],
2375    "74": [0, 0.68333, 0.14028, 0, 0.525],
2376    "75": [0, 0.68333, 0.14528, 0, 0.76888],
2377    "76": [0, 0.68333, 0, 0, 0.62722],
2378    "77": [0, 0.68333, 0.16389, 0, 0.89666],
2379    "78": [0, 0.68333, 0.16389, 0, 0.74333],
2380    "79": [0, 0.68333, 0.09403, 0, 0.76666],
2381    "80": [0, 0.68333, 0.10257, 0, 0.67833],
2382    "81": [0.19444, 0.68333, 0.09403, 0, 0.76666],
2383    "82": [0, 0.68333, 0.03868, 0, 0.72944],
2384    "83": [0, 0.68333, 0.11972, 0, 0.56222],
2385    "84": [0, 0.68333, 0.13305, 0, 0.71555],
2386    "85": [0, 0.68333, 0.16389, 0, 0.74333],
2387    "86": [0, 0.68333, 0.18361, 0, 0.74333],
2388    "87": [0, 0.68333, 0.18361, 0, 0.99888],
2389    "88": [0, 0.68333, 0.15806, 0, 0.74333],
2390    "89": [0, 0.68333, 0.19383, 0, 0.74333],
2391    "90": [0, 0.68333, 0.14528, 0, 0.61333],
2392    "91": [0.25, 0.75, 0.1875, 0, 0.30667],
2393    "93": [0.25, 0.75, 0.10528, 0, 0.30667],
2394    "94": [0, 0.69444, 0.06646, 0, 0.51111],
2395    "95": [0.31, 0.12056, 0.09208, 0, 0.51111],
2396    "97": [0, 0.43056, 0.07671, 0, 0.51111],
2397    "98": [0, 0.69444, 0.06312, 0, 0.46],
2398    "99": [0, 0.43056, 0.05653, 0, 0.46],
2399    "100": [0, 0.69444, 0.10333, 0, 0.51111],
2400    "101": [0, 0.43056, 0.07514, 0, 0.46],
2401    "102": [0.19444, 0.69444, 0.21194, 0, 0.30667],
2402    "103": [0.19444, 0.43056, 0.08847, 0, 0.46],
2403    "104": [0, 0.69444, 0.07671, 0, 0.51111],
2404    "105": [0, 0.65536, 0.1019, 0, 0.30667],
2405    "106": [0.19444, 0.65536, 0.14467, 0, 0.30667],
2406    "107": [0, 0.69444, 0.10764, 0, 0.46],
2407    "108": [0, 0.69444, 0.10333, 0, 0.25555],
2408    "109": [0, 0.43056, 0.07671, 0, 0.81777],
2409    "110": [0, 0.43056, 0.07671, 0, 0.56222],
2410    "111": [0, 0.43056, 0.06312, 0, 0.51111],
2411    "112": [0.19444, 0.43056, 0.06312, 0, 0.51111],
2412    "113": [0.19444, 0.43056, 0.08847, 0, 0.46],
2413    "114": [0, 0.43056, 0.10764, 0, 0.42166],
2414    "115": [0, 0.43056, 0.08208, 0, 0.40889],
2415    "116": [0, 0.61508, 0.09486, 0, 0.33222],
2416    "117": [0, 0.43056, 0.07671, 0, 0.53666],
2417    "118": [0, 0.43056, 0.10764, 0, 0.46],
2418    "119": [0, 0.43056, 0.10764, 0, 0.66444],
2419    "120": [0, 0.43056, 0.12042, 0, 0.46389],
2420    "121": [0.19444, 0.43056, 0.08847, 0, 0.48555],
2421    "122": [0, 0.43056, 0.12292, 0, 0.40889],
2422    "126": [0.35, 0.31786, 0.11585, 0, 0.51111],
2423    "163": [0, 0.69444, 0, 0, 0.76909],
2424    "168": [0, 0.66786, 0.10474, 0, 0.51111],
2425    "176": [0, 0.69444, 0, 0, 0.83129],
2426    "184": [0.17014, 0, 0, 0, 0.46],
2427    "198": [0, 0.68333, 0.12028, 0, 0.88277],
2428    "216": [0.04861, 0.73194, 0.09403, 0, 0.76666],
2429    "223": [0.19444, 0.69444, 0.10514, 0, 0.53666],
2430    "230": [0, 0.43056, 0.07514, 0, 0.71555],
2431    "248": [0.09722, 0.52778, 0.09194, 0, 0.51111],
2432    "305": [0, 0.43056, 0, 0.02778, 0.32246],
2433    "338": [0, 0.68333, 0.12028, 0, 0.98499],
2434    "339": [0, 0.43056, 0.07514, 0, 0.71555],
2435    "567": [0.19444, 0.43056, 0, 0.08334, 0.38403],
2436    "710": [0, 0.69444, 0.06646, 0, 0.51111],
2437    "711": [0, 0.62847, 0.08295, 0, 0.51111],
2438    "713": [0, 0.56167, 0.10333, 0, 0.51111],
2439    "714": [0, 0.69444, 0.09694, 0, 0.51111],
2440    "715": [0, 0.69444, 0, 0, 0.51111],
2441    "728": [0, 0.69444, 0.10806, 0, 0.51111],
2442    "729": [0, 0.66786, 0.11752, 0, 0.30667],
2443    "730": [0, 0.69444, 0, 0, 0.83129],
2444    "732": [0, 0.66786, 0.11585, 0, 0.51111],
2445    "733": [0, 0.69444, 0.1225, 0, 0.51111],
2446    "915": [0, 0.68333, 0.13305, 0, 0.62722],
2447    "916": [0, 0.68333, 0, 0, 0.81777],
2448    "920": [0, 0.68333, 0.09403, 0, 0.76666],
2449    "923": [0, 0.68333, 0, 0, 0.69222],
2450    "926": [0, 0.68333, 0.15294, 0, 0.66444],
2451    "928": [0, 0.68333, 0.16389, 0, 0.74333],
2452    "931": [0, 0.68333, 0.12028, 0, 0.71555],
2453    "933": [0, 0.68333, 0.11111, 0, 0.76666],
2454    "934": [0, 0.68333, 0.05986, 0, 0.71555],
2455    "936": [0, 0.68333, 0.11111, 0, 0.76666],
2456    "937": [0, 0.68333, 0.10257, 0, 0.71555],
2457    "8211": [0, 0.43056, 0.09208, 0, 0.51111],
2458    "8212": [0, 0.43056, 0.09208, 0, 1.02222],
2459    "8216": [0, 0.69444, 0.12417, 0, 0.30667],
2460    "8217": [0, 0.69444, 0.12417, 0, 0.30667],
2461    "8220": [0, 0.69444, 0.1685, 0, 0.51444],
2462    "8221": [0, 0.69444, 0.06961, 0, 0.51444],
2463    "8463": [0, 0.68889, 0, 0, 0.54028]
2464  },
2465  "Main-Regular": {
2466    "32": [0, 0, 0, 0, 0.25],
2467    "33": [0, 0.69444, 0, 0, 0.27778],
2468    "34": [0, 0.69444, 0, 0, 0.5],
2469    "35": [0.19444, 0.69444, 0, 0, 0.83334],
2470    "36": [0.05556, 0.75, 0, 0, 0.5],
2471    "37": [0.05556, 0.75, 0, 0, 0.83334],
2472    "38": [0, 0.69444, 0, 0, 0.77778],
2473    "39": [0, 0.69444, 0, 0, 0.27778],
2474    "40": [0.25, 0.75, 0, 0, 0.38889],
2475    "41": [0.25, 0.75, 0, 0, 0.38889],
2476    "42": [0, 0.75, 0, 0, 0.5],
2477    "43": [0.08333, 0.58333, 0, 0, 0.77778],
2478    "44": [0.19444, 0.10556, 0, 0, 0.27778],
2479    "45": [0, 0.43056, 0, 0, 0.33333],
2480    "46": [0, 0.10556, 0, 0, 0.27778],
2481    "47": [0.25, 0.75, 0, 0, 0.5],
2482    "48": [0, 0.64444, 0, 0, 0.5],
2483    "49": [0, 0.64444, 0, 0, 0.5],
2484    "50": [0, 0.64444, 0, 0, 0.5],
2485    "51": [0, 0.64444, 0, 0, 0.5],
2486    "52": [0, 0.64444, 0, 0, 0.5],
2487    "53": [0, 0.64444, 0, 0, 0.5],
2488    "54": [0, 0.64444, 0, 0, 0.5],
2489    "55": [0, 0.64444, 0, 0, 0.5],
2490    "56": [0, 0.64444, 0, 0, 0.5],
2491    "57": [0, 0.64444, 0, 0, 0.5],
2492    "58": [0, 0.43056, 0, 0, 0.27778],
2493    "59": [0.19444, 0.43056, 0, 0, 0.27778],
2494    "60": [0.0391, 0.5391, 0, 0, 0.77778],
2495    "61": [-0.13313, 0.36687, 0, 0, 0.77778],
2496    "62": [0.0391, 0.5391, 0, 0, 0.77778],
2497    "63": [0, 0.69444, 0, 0, 0.47222],
2498    "64": [0, 0.69444, 0, 0, 0.77778],
2499    "65": [0, 0.68333, 0, 0, 0.75],
2500    "66": [0, 0.68333, 0, 0, 0.70834],
2501    "67": [0, 0.68333, 0, 0, 0.72222],
2502    "68": [0, 0.68333, 0, 0, 0.76389],
2503    "69": [0, 0.68333, 0, 0, 0.68056],
2504    "70": [0, 0.68333, 0, 0, 0.65278],
2505    "71": [0, 0.68333, 0, 0, 0.78472],
2506    "72": [0, 0.68333, 0, 0, 0.75],
2507    "73": [0, 0.68333, 0, 0, 0.36111],
2508    "74": [0, 0.68333, 0, 0, 0.51389],
2509    "75": [0, 0.68333, 0, 0, 0.77778],
2510    "76": [0, 0.68333, 0, 0, 0.625],
2511    "77": [0, 0.68333, 0, 0, 0.91667],
2512    "78": [0, 0.68333, 0, 0, 0.75],
2513    "79": [0, 0.68333, 0, 0, 0.77778],
2514    "80": [0, 0.68333, 0, 0, 0.68056],
2515    "81": [0.19444, 0.68333, 0, 0, 0.77778],
2516    "82": [0, 0.68333, 0, 0, 0.73611],
2517    "83": [0, 0.68333, 0, 0, 0.55556],
2518    "84": [0, 0.68333, 0, 0, 0.72222],
2519    "85": [0, 0.68333, 0, 0, 0.75],
2520    "86": [0, 0.68333, 0.01389, 0, 0.75],
2521    "87": [0, 0.68333, 0.01389, 0, 1.02778],
2522    "88": [0, 0.68333, 0, 0, 0.75],
2523    "89": [0, 0.68333, 0.025, 0, 0.75],
2524    "90": [0, 0.68333, 0, 0, 0.61111],
2525    "91": [0.25, 0.75, 0, 0, 0.27778],
2526    "92": [0.25, 0.75, 0, 0, 0.5],
2527    "93": [0.25, 0.75, 0, 0, 0.27778],
2528    "94": [0, 0.69444, 0, 0, 0.5],
2529    "95": [0.31, 0.12056, 0.02778, 0, 0.5],
2530    "97": [0, 0.43056, 0, 0, 0.5],
2531    "98": [0, 0.69444, 0, 0, 0.55556],
2532    "99": [0, 0.43056, 0, 0, 0.44445],
2533    "100": [0, 0.69444, 0, 0, 0.55556],
2534    "101": [0, 0.43056, 0, 0, 0.44445],
2535    "102": [0, 0.69444, 0.07778, 0, 0.30556],
2536    "103": [0.19444, 0.43056, 0.01389, 0, 0.5],
2537    "104": [0, 0.69444, 0, 0, 0.55556],
2538    "105": [0, 0.66786, 0, 0, 0.27778],
2539    "106": [0.19444, 0.66786, 0, 0, 0.30556],
2540    "107": [0, 0.69444, 0, 0, 0.52778],
2541    "108": [0, 0.69444, 0, 0, 0.27778],
2542    "109": [0, 0.43056, 0, 0, 0.83334],
2543    "110": [0, 0.43056, 0, 0, 0.55556],
2544    "111": [0, 0.43056, 0, 0, 0.5],
2545    "112": [0.19444, 0.43056, 0, 0, 0.55556],
2546    "113": [0.19444, 0.43056, 0, 0, 0.52778],
2547    "114": [0, 0.43056, 0, 0, 0.39167],
2548    "115": [0, 0.43056, 0, 0, 0.39445],
2549    "116": [0, 0.61508, 0, 0, 0.38889],
2550    "117": [0, 0.43056, 0, 0, 0.55556],
2551    "118": [0, 0.43056, 0.01389, 0, 0.52778],
2552    "119": [0, 0.43056, 0.01389, 0, 0.72222],
2553    "120": [0, 0.43056, 0, 0, 0.52778],
2554    "121": [0.19444, 0.43056, 0.01389, 0, 0.52778],
2555    "122": [0, 0.43056, 0, 0, 0.44445],
2556    "123": [0.25, 0.75, 0, 0, 0.5],
2557    "124": [0.25, 0.75, 0, 0, 0.27778],
2558    "125": [0.25, 0.75, 0, 0, 0.5],
2559    "126": [0.35, 0.31786, 0, 0, 0.5],
2560    "160": [0, 0, 0, 0, 0.25],
2561    "167": [0.19444, 0.69444, 0, 0, 0.44445],
2562    "168": [0, 0.66786, 0, 0, 0.5],
2563    "172": [0, 0.43056, 0, 0, 0.66667],
2564    "176": [0, 0.69444, 0, 0, 0.75],
2565    "177": [0.08333, 0.58333, 0, 0, 0.77778],
2566    "182": [0.19444, 0.69444, 0, 0, 0.61111],
2567    "184": [0.17014, 0, 0, 0, 0.44445],
2568    "198": [0, 0.68333, 0, 0, 0.90278],
2569    "215": [0.08333, 0.58333, 0, 0, 0.77778],
2570    "216": [0.04861, 0.73194, 0, 0, 0.77778],
2571    "223": [0, 0.69444, 0, 0, 0.5],
2572    "230": [0, 0.43056, 0, 0, 0.72222],
2573    "247": [0.08333, 0.58333, 0, 0, 0.77778],
2574    "248": [0.09722, 0.52778, 0, 0, 0.5],
2575    "305": [0, 0.43056, 0, 0, 0.27778],
2576    "338": [0, 0.68333, 0, 0, 1.01389],
2577    "339": [0, 0.43056, 0, 0, 0.77778],
2578    "567": [0.19444, 0.43056, 0, 0, 0.30556],
2579    "710": [0, 0.69444, 0, 0, 0.5],
2580    "711": [0, 0.62847, 0, 0, 0.5],
2581    "713": [0, 0.56778, 0, 0, 0.5],
2582    "714": [0, 0.69444, 0, 0, 0.5],
2583    "715": [0, 0.69444, 0, 0, 0.5],
2584    "728": [0, 0.69444, 0, 0, 0.5],
2585    "729": [0, 0.66786, 0, 0, 0.27778],
2586    "730": [0, 0.69444, 0, 0, 0.75],
2587    "732": [0, 0.66786, 0, 0, 0.5],
2588    "733": [0, 0.69444, 0, 0, 0.5],
2589    "915": [0, 0.68333, 0, 0, 0.625],
2590    "916": [0, 0.68333, 0, 0, 0.83334],
2591    "920": [0, 0.68333, 0, 0, 0.77778],
2592    "923": [0, 0.68333, 0, 0, 0.69445],
2593    "926": [0, 0.68333, 0, 0, 0.66667],
2594    "928": [0, 0.68333, 0, 0, 0.75],
2595    "931": [0, 0.68333, 0, 0, 0.72222],
2596    "933": [0, 0.68333, 0, 0, 0.77778],
2597    "934": [0, 0.68333, 0, 0, 0.72222],
2598    "936": [0, 0.68333, 0, 0, 0.77778],
2599    "937": [0, 0.68333, 0, 0, 0.72222],
2600    "8211": [0, 0.43056, 0.02778, 0, 0.5],
2601    "8212": [0, 0.43056, 0.02778, 0, 1.0],
2602    "8216": [0, 0.69444, 0, 0, 0.27778],
2603    "8217": [0, 0.69444, 0, 0, 0.27778],
2604    "8220": [0, 0.69444, 0, 0, 0.5],
2605    "8221": [0, 0.69444, 0, 0, 0.5],
2606    "8224": [0.19444, 0.69444, 0, 0, 0.44445],
2607    "8225": [0.19444, 0.69444, 0, 0, 0.44445],
2608    "8230": [0, 0.12, 0, 0, 1.172],
2609    "8242": [0, 0.55556, 0, 0, 0.275],
2610    "8407": [0, 0.71444, 0.15382, 0, 0.5],
2611    "8463": [0, 0.68889, 0, 0, 0.54028],
2612    "8465": [0, 0.69444, 0, 0, 0.72222],
2613    "8467": [0, 0.69444, 0, 0.11111, 0.41667],
2614    "8472": [0.19444, 0.43056, 0, 0.11111, 0.63646],
2615    "8476": [0, 0.69444, 0, 0, 0.72222],
2616    "8501": [0, 0.69444, 0, 0, 0.61111],
2617    "8592": [-0.13313, 0.36687, 0, 0, 1.0],
2618    "8593": [0.19444, 0.69444, 0, 0, 0.5],
2619    "8594": [-0.13313, 0.36687, 0, 0, 1.0],
2620    "8595": [0.19444, 0.69444, 0, 0, 0.5],
2621    "8596": [-0.13313, 0.36687, 0, 0, 1.0],
2622    "8597": [0.25, 0.75, 0, 0, 0.5],
2623    "8598": [0.19444, 0.69444, 0, 0, 1.0],
2624    "8599": [0.19444, 0.69444, 0, 0, 1.0],
2625    "8600": [0.19444, 0.69444, 0, 0, 1.0],
2626    "8601": [0.19444, 0.69444, 0, 0, 1.0],
2627    "8614": [0.011, 0.511, 0, 0, 1.0],
2628    "8617": [0.011, 0.511, 0, 0, 1.126],
2629    "8618": [0.011, 0.511, 0, 0, 1.126],
2630    "8636": [-0.13313, 0.36687, 0, 0, 1.0],
2631    "8637": [-0.13313, 0.36687, 0, 0, 1.0],
2632    "8640": [-0.13313, 0.36687, 0, 0, 1.0],
2633    "8641": [-0.13313, 0.36687, 0, 0, 1.0],
2634    "8652": [0.011, 0.671, 0, 0, 1.0],
2635    "8656": [-0.13313, 0.36687, 0, 0, 1.0],
2636    "8657": [0.19444, 0.69444, 0, 0, 0.61111],
2637    "8658": [-0.13313, 0.36687, 0, 0, 1.0],
2638    "8659": [0.19444, 0.69444, 0, 0, 0.61111],
2639    "8660": [-0.13313, 0.36687, 0, 0, 1.0],
2640    "8661": [0.25, 0.75, 0, 0, 0.61111],
2641    "8704": [0, 0.69444, 0, 0, 0.55556],
2642    "8706": [0, 0.69444, 0.05556, 0.08334, 0.5309],
2643    "8707": [0, 0.69444, 0, 0, 0.55556],
2644    "8709": [0.05556, 0.75, 0, 0, 0.5],
2645    "8711": [0, 0.68333, 0, 0, 0.83334],
2646    "8712": [0.0391, 0.5391, 0, 0, 0.66667],
2647    "8715": [0.0391, 0.5391, 0, 0, 0.66667],
2648    "8722": [0.08333, 0.58333, 0, 0, 0.77778],
2649    "8723": [0.08333, 0.58333, 0, 0, 0.77778],
2650    "8725": [0.25, 0.75, 0, 0, 0.5],
2651    "8726": [0.25, 0.75, 0, 0, 0.5],
2652    "8727": [-0.03472, 0.46528, 0, 0, 0.5],
2653    "8728": [-0.05555, 0.44445, 0, 0, 0.5],
2654    "8729": [-0.05555, 0.44445, 0, 0, 0.5],
2655    "8730": [0.2, 0.8, 0, 0, 0.83334],
2656    "8733": [0, 0.43056, 0, 0, 0.77778],
2657    "8734": [0, 0.43056, 0, 0, 1.0],
2658    "8736": [0, 0.69224, 0, 0, 0.72222],
2659    "8739": [0.25, 0.75, 0, 0, 0.27778],
2660    "8741": [0.25, 0.75, 0, 0, 0.5],
2661    "8743": [0, 0.55556, 0, 0, 0.66667],
2662    "8744": [0, 0.55556, 0, 0, 0.66667],
2663    "8745": [0, 0.55556, 0, 0, 0.66667],
2664    "8746": [0, 0.55556, 0, 0, 0.66667],
2665    "8747": [0.19444, 0.69444, 0.11111, 0, 0.41667],
2666    "8764": [-0.13313, 0.36687, 0, 0, 0.77778],
2667    "8768": [0.19444, 0.69444, 0, 0, 0.27778],
2668    "8771": [-0.03625, 0.46375, 0, 0, 0.77778],
2669    "8773": [-0.022, 0.589, 0, 0, 1.0],
2670    "8776": [-0.01688, 0.48312, 0, 0, 0.77778],
2671    "8781": [-0.03625, 0.46375, 0, 0, 0.77778],
2672    "8784": [-0.133, 0.67, 0, 0, 0.778],
2673    "8801": [-0.03625, 0.46375, 0, 0, 0.77778],
2674    "8804": [0.13597, 0.63597, 0, 0, 0.77778],
2675    "8805": [0.13597, 0.63597, 0, 0, 0.77778],
2676    "8810": [0.0391, 0.5391, 0, 0, 1.0],
2677    "8811": [0.0391, 0.5391, 0, 0, 1.0],
2678    "8826": [0.0391, 0.5391, 0, 0, 0.77778],
2679    "8827": [0.0391, 0.5391, 0, 0, 0.77778],
2680    "8834": [0.0391, 0.5391, 0, 0, 0.77778],
2681    "8835": [0.0391, 0.5391, 0, 0, 0.77778],
2682    "8838": [0.13597, 0.63597, 0, 0, 0.77778],
2683    "8839": [0.13597, 0.63597, 0, 0, 0.77778],
2684    "8846": [0, 0.55556, 0, 0, 0.66667],
2685    "8849": [0.13597, 0.63597, 0, 0, 0.77778],
2686    "8850": [0.13597, 0.63597, 0, 0, 0.77778],
2687    "8851": [0, 0.55556, 0, 0, 0.66667],
2688    "8852": [0, 0.55556, 0, 0, 0.66667],
2689    "8853": [0.08333, 0.58333, 0, 0, 0.77778],
2690    "8854": [0.08333, 0.58333, 0, 0, 0.77778],
2691    "8855": [0.08333, 0.58333, 0, 0, 0.77778],
2692    "8856": [0.08333, 0.58333, 0, 0, 0.77778],
2693    "8857": [0.08333, 0.58333, 0, 0, 0.77778],
2694    "8866": [0, 0.69444, 0, 0, 0.61111],
2695    "8867": [0, 0.69444, 0, 0, 0.61111],
2696    "8868": [0, 0.69444, 0, 0, 0.77778],
2697    "8869": [0, 0.69444, 0, 0, 0.77778],
2698    "8872": [0.249, 0.75, 0, 0, 0.867],
2699    "8900": [-0.05555, 0.44445, 0, 0, 0.5],
2700    "8901": [-0.05555, 0.44445, 0, 0, 0.27778],
2701    "8902": [-0.03472, 0.46528, 0, 0, 0.5],
2702    "8904": [0.005, 0.505, 0, 0, 0.9],
2703    "8942": [0.03, 0.9, 0, 0, 0.278],
2704    "8943": [-0.19, 0.31, 0, 0, 1.172],
2705    "8945": [-0.1, 0.82, 0, 0, 1.282],
2706    "8968": [0.25, 0.75, 0, 0, 0.44445],
2707    "8969": [0.25, 0.75, 0, 0, 0.44445],
2708    "8970": [0.25, 0.75, 0, 0, 0.44445],
2709    "8971": [0.25, 0.75, 0, 0, 0.44445],
2710    "8994": [-0.14236, 0.35764, 0, 0, 1.0],
2711    "8995": [-0.14236, 0.35764, 0, 0, 1.0],
2712    "9136": [0.244, 0.744, 0, 0, 0.412],
2713    "9137": [0.244, 0.744, 0, 0, 0.412],
2714    "9651": [0.19444, 0.69444, 0, 0, 0.88889],
2715    "9657": [-0.03472, 0.46528, 0, 0, 0.5],
2716    "9661": [0.19444, 0.69444, 0, 0, 0.88889],
2717    "9667": [-0.03472, 0.46528, 0, 0, 0.5],
2718    "9711": [0.19444, 0.69444, 0, 0, 1.0],
2719    "9824": [0.12963, 0.69444, 0, 0, 0.77778],
2720    "9825": [0.12963, 0.69444, 0, 0, 0.77778],
2721    "9826": [0.12963, 0.69444, 0, 0, 0.77778],
2722    "9827": [0.12963, 0.69444, 0, 0, 0.77778],
2723    "9837": [0, 0.75, 0, 0, 0.38889],
2724    "9838": [0.19444, 0.69444, 0, 0, 0.38889],
2725    "9839": [0.19444, 0.69444, 0, 0, 0.38889],
2726    "10216": [0.25, 0.75, 0, 0, 0.38889],
2727    "10217": [0.25, 0.75, 0, 0, 0.38889],
2728    "10222": [0.244, 0.744, 0, 0, 0.412],
2729    "10223": [0.244, 0.744, 0, 0, 0.412],
2730    "10229": [0.011, 0.511, 0, 0, 1.609],
2731    "10230": [0.011, 0.511, 0, 0, 1.638],
2732    "10231": [0.011, 0.511, 0, 0, 1.859],
2733    "10232": [0.024, 0.525, 0, 0, 1.609],
2734    "10233": [0.024, 0.525, 0, 0, 1.638],
2735    "10234": [0.024, 0.525, 0, 0, 1.858],
2736    "10236": [0.011, 0.511, 0, 0, 1.638],
2737    "10815": [0, 0.68333, 0, 0, 0.75],
2738    "10927": [0.13597, 0.63597, 0, 0, 0.77778],
2739    "10928": [0.13597, 0.63597, 0, 0, 0.77778],
2740    "57376": [0.19444, 0.69444, 0, 0, 0]
2741  },
2742  "Math-BoldItalic": {
2743    "65": [0, 0.68611, 0, 0, 0.86944],
2744    "66": [0, 0.68611, 0.04835, 0, 0.8664],
2745    "67": [0, 0.68611, 0.06979, 0, 0.81694],
2746    "68": [0, 0.68611, 0.03194, 0, 0.93812],
2747    "69": [0, 0.68611, 0.05451, 0, 0.81007],
2748    "70": [0, 0.68611, 0.15972, 0, 0.68889],
2749    "71": [0, 0.68611, 0, 0, 0.88673],
2750    "72": [0, 0.68611, 0.08229, 0, 0.98229],
2751    "73": [0, 0.68611, 0.07778, 0, 0.51111],
2752    "74": [0, 0.68611, 0.10069, 0, 0.63125],
2753    "75": [0, 0.68611, 0.06979, 0, 0.97118],
2754    "76": [0, 0.68611, 0, 0, 0.75555],
2755    "77": [0, 0.68611, 0.11424, 0, 1.14201],
2756    "78": [0, 0.68611, 0.11424, 0, 0.95034],
2757    "79": [0, 0.68611, 0.03194, 0, 0.83666],
2758    "80": [0, 0.68611, 0.15972, 0, 0.72309],
2759    "81": [0.19444, 0.68611, 0, 0, 0.86861],
2760    "82": [0, 0.68611, 0.00421, 0, 0.87235],
2761    "83": [0, 0.68611, 0.05382, 0, 0.69271],
2762    "84": [0, 0.68611, 0.15972, 0, 0.63663],
2763    "85": [0, 0.68611, 0.11424, 0, 0.80027],
2764    "86": [0, 0.68611, 0.25555, 0, 0.67778],
2765    "87": [0, 0.68611, 0.15972, 0, 1.09305],
2766    "88": [0, 0.68611, 0.07778, 0, 0.94722],
2767    "89": [0, 0.68611, 0.25555, 0, 0.67458],
2768    "90": [0, 0.68611, 0.06979, 0, 0.77257],
2769    "97": [0, 0.44444, 0, 0, 0.63287],
2770    "98": [0, 0.69444, 0, 0, 0.52083],
2771    "99": [0, 0.44444, 0, 0, 0.51342],
2772    "100": [0, 0.69444, 0, 0, 0.60972],
2773    "101": [0, 0.44444, 0, 0, 0.55361],
2774    "102": [0.19444, 0.69444, 0.11042, 0, 0.56806],
2775    "103": [0.19444, 0.44444, 0.03704, 0, 0.5449],
2776    "104": [0, 0.69444, 0, 0, 0.66759],
2777    "105": [0, 0.69326, 0, 0, 0.4048],
2778    "106": [0.19444, 0.69326, 0.0622, 0, 0.47083],
2779    "107": [0, 0.69444, 0.01852, 0, 0.6037],
2780    "108": [0, 0.69444, 0.0088, 0, 0.34815],
2781    "109": [0, 0.44444, 0, 0, 1.0324],
2782    "110": [0, 0.44444, 0, 0, 0.71296],
2783    "111": [0, 0.44444, 0, 0, 0.58472],
2784    "112": [0.19444, 0.44444, 0, 0, 0.60092],
2785    "113": [0.19444, 0.44444, 0.03704, 0, 0.54213],
2786    "114": [0, 0.44444, 0.03194, 0, 0.5287],
2787    "115": [0, 0.44444, 0, 0, 0.53125],
2788    "116": [0, 0.63492, 0, 0, 0.41528],
2789    "117": [0, 0.44444, 0, 0, 0.68102],
2790    "118": [0, 0.44444, 0.03704, 0, 0.56666],
2791    "119": [0, 0.44444, 0.02778, 0, 0.83148],
2792    "120": [0, 0.44444, 0, 0, 0.65903],
2793    "121": [0.19444, 0.44444, 0.03704, 0, 0.59028],
2794    "122": [0, 0.44444, 0.04213, 0, 0.55509],
2795    "915": [0, 0.68611, 0.15972, 0, 0.65694],
2796    "916": [0, 0.68611, 0, 0, 0.95833],
2797    "920": [0, 0.68611, 0.03194, 0, 0.86722],
2798    "923": [0, 0.68611, 0, 0, 0.80555],
2799    "926": [0, 0.68611, 0.07458, 0, 0.84125],
2800    "928": [0, 0.68611, 0.08229, 0, 0.98229],
2801    "931": [0, 0.68611, 0.05451, 0, 0.88507],
2802    "933": [0, 0.68611, 0.15972, 0, 0.67083],
2803    "934": [0, 0.68611, 0, 0, 0.76666],
2804    "936": [0, 0.68611, 0.11653, 0, 0.71402],
2805    "937": [0, 0.68611, 0.04835, 0, 0.8789],
2806    "945": [0, 0.44444, 0, 0, 0.76064],
2807    "946": [0.19444, 0.69444, 0.03403, 0, 0.65972],
2808    "947": [0.19444, 0.44444, 0.06389, 0, 0.59003],
2809    "948": [0, 0.69444, 0.03819, 0, 0.52222],
2810    "949": [0, 0.44444, 0, 0, 0.52882],
2811    "950": [0.19444, 0.69444, 0.06215, 0, 0.50833],
2812    "951": [0.19444, 0.44444, 0.03704, 0, 0.6],
2813    "952": [0, 0.69444, 0.03194, 0, 0.5618],
2814    "953": [0, 0.44444, 0, 0, 0.41204],
2815    "954": [0, 0.44444, 0, 0, 0.66759],
2816    "955": [0, 0.69444, 0, 0, 0.67083],
2817    "956": [0.19444, 0.44444, 0, 0, 0.70787],
2818    "957": [0, 0.44444, 0.06898, 0, 0.57685],
2819    "958": [0.19444, 0.69444, 0.03021, 0, 0.50833],
2820    "959": [0, 0.44444, 0, 0, 0.58472],
2821    "960": [0, 0.44444, 0.03704, 0, 0.68241],
2822    "961": [0.19444, 0.44444, 0, 0, 0.6118],
2823    "962": [0.09722, 0.44444, 0.07917, 0, 0.42361],
2824    "963": [0, 0.44444, 0.03704, 0, 0.68588],
2825    "964": [0, 0.44444, 0.13472, 0, 0.52083],
2826    "965": [0, 0.44444, 0.03704, 0, 0.63055],
2827    "966": [0.19444, 0.44444, 0, 0, 0.74722],
2828    "967": [0.19444, 0.44444, 0, 0, 0.71805],
2829    "968": [0.19444, 0.69444, 0.03704, 0, 0.75833],
2830    "969": [0, 0.44444, 0.03704, 0, 0.71782],
2831    "977": [0, 0.69444, 0, 0, 0.69155],
2832    "981": [0.19444, 0.69444, 0, 0, 0.7125],
2833    "982": [0, 0.44444, 0.03194, 0, 0.975],
2834    "1009": [0.19444, 0.44444, 0, 0, 0.6118],
2835    "1013": [0, 0.44444, 0, 0, 0.48333]
2836  },
2837  "Math-Italic": {
2838    "65": [0, 0.68333, 0, 0.13889, 0.75],
2839    "66": [0, 0.68333, 0.05017, 0.08334, 0.75851],
2840    "67": [0, 0.68333, 0.07153, 0.08334, 0.71472],
2841    "68": [0, 0.68333, 0.02778, 0.05556, 0.82792],
2842    "69": [0, 0.68333, 0.05764, 0.08334, 0.7382],
2843    "70": [0, 0.68333, 0.13889, 0.08334, 0.64306],
2844    "71": [0, 0.68333, 0, 0.08334, 0.78625],
2845    "72": [0, 0.68333, 0.08125, 0.05556, 0.83125],
2846    "73": [0, 0.68333, 0.07847, 0.11111, 0.43958],
2847    "74": [0, 0.68333, 0.09618, 0.16667, 0.55451],
2848    "75": [0, 0.68333, 0.07153, 0.05556, 0.84931],
2849    "76": [0, 0.68333, 0, 0.02778, 0.68056],
2850    "77": [0, 0.68333, 0.10903, 0.08334, 0.97014],
2851    "78": [0, 0.68333, 0.10903, 0.08334, 0.80347],
2852    "79": [0, 0.68333, 0.02778, 0.08334, 0.76278],
2853    "80": [0, 0.68333, 0.13889, 0.08334, 0.64201],
2854    "81": [0.19444, 0.68333, 0, 0.08334, 0.79056],
2855    "82": [0, 0.68333, 0.00773, 0.08334, 0.75929],
2856    "83": [0, 0.68333, 0.05764, 0.08334, 0.6132],
2857    "84": [0, 0.68333, 0.13889, 0.08334, 0.58438],
2858    "85": [0, 0.68333, 0.10903, 0.02778, 0.68278],
2859    "86": [0, 0.68333, 0.22222, 0, 0.58333],
2860    "87": [0, 0.68333, 0.13889, 0, 0.94445],
2861    "88": [0, 0.68333, 0.07847, 0.08334, 0.82847],
2862    "89": [0, 0.68333, 0.22222, 0, 0.58056],
2863    "90": [0, 0.68333, 0.07153, 0.08334, 0.68264],
2864    "97": [0, 0.43056, 0, 0, 0.52859],
2865    "98": [0, 0.69444, 0, 0, 0.42917],
2866    "99": [0, 0.43056, 0, 0.05556, 0.43276],
2867    "100": [0, 0.69444, 0, 0.16667, 0.52049],
2868    "101": [0, 0.43056, 0, 0.05556, 0.46563],
2869    "102": [0.19444, 0.69444, 0.10764, 0.16667, 0.48959],
2870    "103": [0.19444, 0.43056, 0.03588, 0.02778, 0.47697],
2871    "104": [0, 0.69444, 0, 0, 0.57616],
2872    "105": [0, 0.65952, 0, 0, 0.34451],
2873    "106": [0.19444, 0.65952, 0.05724, 0, 0.41181],
2874    "107": [0, 0.69444, 0.03148, 0, 0.5206],
2875    "108": [0, 0.69444, 0.01968, 0.08334, 0.29838],
2876    "109": [0, 0.43056, 0, 0, 0.87801],
2877    "110": [0, 0.43056, 0, 0, 0.60023],
2878    "111": [0, 0.43056, 0, 0.05556, 0.48472],
2879    "112": [0.19444, 0.43056, 0, 0.08334, 0.50313],
2880    "113": [0.19444, 0.43056, 0.03588, 0.08334, 0.44641],
2881    "114": [0, 0.43056, 0.02778, 0.05556, 0.45116],
2882    "115": [0, 0.43056, 0, 0.05556, 0.46875],
2883    "116": [0, 0.61508, 0, 0.08334, 0.36111],
2884    "117": [0, 0.43056, 0, 0.02778, 0.57246],
2885    "118": [0, 0.43056, 0.03588, 0.02778, 0.48472],
2886    "119": [0, 0.43056, 0.02691, 0.08334, 0.71592],
2887    "120": [0, 0.43056, 0, 0.02778, 0.57153],
2888    "121": [0.19444, 0.43056, 0.03588, 0.05556, 0.49028],
2889    "122": [0, 0.43056, 0.04398, 0.05556, 0.46505],
2890    "915": [0, 0.68333, 0.13889, 0.08334, 0.61528],
2891    "916": [0, 0.68333, 0, 0.16667, 0.83334],
2892    "920": [0, 0.68333, 0.02778, 0.08334, 0.76278],
2893    "923": [0, 0.68333, 0, 0.16667, 0.69445],
2894    "926": [0, 0.68333, 0.07569, 0.08334, 0.74236],
2895    "928": [0, 0.68333, 0.08125, 0.05556, 0.83125],
2896    "931": [0, 0.68333, 0.05764, 0.08334, 0.77986],
2897    "933": [0, 0.68333, 0.13889, 0.05556, 0.58333],
2898    "934": [0, 0.68333, 0, 0.08334, 0.66667],
2899    "936": [0, 0.68333, 0.11, 0.05556, 0.61222],
2900    "937": [0, 0.68333, 0.05017, 0.08334, 0.7724],
2901    "945": [0, 0.43056, 0.0037, 0.02778, 0.6397],
2902    "946": [0.19444, 0.69444, 0.05278, 0.08334, 0.56563],
2903    "947": [0.19444, 0.43056, 0.05556, 0, 0.51773],
2904    "948": [0, 0.69444, 0.03785, 0.05556, 0.44444],
2905    "949": [0, 0.43056, 0, 0.08334, 0.46632],
2906    "950": [0.19444, 0.69444, 0.07378, 0.08334, 0.4375],
2907    "951": [0.19444, 0.43056, 0.03588, 0.05556, 0.49653],
2908    "952": [0, 0.69444, 0.02778, 0.08334, 0.46944],
2909    "953": [0, 0.43056, 0, 0.05556, 0.35394],
2910    "954": [0, 0.43056, 0, 0, 0.57616],
2911    "955": [0, 0.69444, 0, 0, 0.58334],
2912    "956": [0.19444, 0.43056, 0, 0.02778, 0.60255],
2913    "957": [0, 0.43056, 0.06366, 0.02778, 0.49398],
2914    "958": [0.19444, 0.69444, 0.04601, 0.11111, 0.4375],
2915    "959": [0, 0.43056, 0, 0.05556, 0.48472],
2916    "960": [0, 0.43056, 0.03588, 0, 0.57003],
2917    "961": [0.19444, 0.43056, 0, 0.08334, 0.51702],
2918    "962": [0.09722, 0.43056, 0.07986, 0.08334, 0.36285],
2919    "963": [0, 0.43056, 0.03588, 0, 0.57141],
2920    "964": [0, 0.43056, 0.1132, 0.02778, 0.43715],
2921    "965": [0, 0.43056, 0.03588, 0.02778, 0.54028],
2922    "966": [0.19444, 0.43056, 0, 0.08334, 0.65417],
2923    "967": [0.19444, 0.43056, 0, 0.05556, 0.62569],
2924    "968": [0.19444, 0.69444, 0.03588, 0.11111, 0.65139],
2925    "969": [0, 0.43056, 0.03588, 0, 0.62245],
2926    "977": [0, 0.69444, 0, 0.08334, 0.59144],
2927    "981": [0.19444, 0.69444, 0, 0.08334, 0.59583],
2928    "982": [0, 0.43056, 0.02778, 0, 0.82813],
2929    "1009": [0.19444, 0.43056, 0, 0.08334, 0.51702],
2930    "1013": [0, 0.43056, 0, 0.05556, 0.4059]
2931  },
2932  "Math-Regular": {
2933    "65": [0, 0.68333, 0, 0.13889, 0.75],
2934    "66": [0, 0.68333, 0.05017, 0.08334, 0.75851],
2935    "67": [0, 0.68333, 0.07153, 0.08334, 0.71472],
2936    "68": [0, 0.68333, 0.02778, 0.05556, 0.82792],
2937    "69": [0, 0.68333, 0.05764, 0.08334, 0.7382],
2938    "70": [0, 0.68333, 0.13889, 0.08334, 0.64306],
2939    "71": [0, 0.68333, 0, 0.08334, 0.78625],
2940    "72": [0, 0.68333, 0.08125, 0.05556, 0.83125],
2941    "73": [0, 0.68333, 0.07847, 0.11111, 0.43958],
2942    "74": [0, 0.68333, 0.09618, 0.16667, 0.55451],
2943    "75": [0, 0.68333, 0.07153, 0.05556, 0.84931],
2944    "76": [0, 0.68333, 0, 0.02778, 0.68056],
2945    "77": [0, 0.68333, 0.10903, 0.08334, 0.97014],
2946    "78": [0, 0.68333, 0.10903, 0.08334, 0.80347],
2947    "79": [0, 0.68333, 0.02778, 0.08334, 0.76278],
2948    "80": [0, 0.68333, 0.13889, 0.08334, 0.64201],
2949    "81": [0.19444, 0.68333, 0, 0.08334, 0.79056],
2950    "82": [0, 0.68333, 0.00773, 0.08334, 0.75929],
2951    "83": [0, 0.68333, 0.05764, 0.08334, 0.6132],
2952    "84": [0, 0.68333, 0.13889, 0.08334, 0.58438],
2953    "85": [0, 0.68333, 0.10903, 0.02778, 0.68278],
2954    "86": [0, 0.68333, 0.22222, 0, 0.58333],
2955    "87": [0, 0.68333, 0.13889, 0, 0.94445],
2956    "88": [0, 0.68333, 0.07847, 0.08334, 0.82847],
2957    "89": [0, 0.68333, 0.22222, 0, 0.58056],
2958    "90": [0, 0.68333, 0.07153, 0.08334, 0.68264],
2959    "97": [0, 0.43056, 0, 0, 0.52859],
2960    "98": [0, 0.69444, 0, 0, 0.42917],
2961    "99": [0, 0.43056, 0, 0.05556, 0.43276],
2962    "100": [0, 0.69444, 0, 0.16667, 0.52049],
2963    "101": [0, 0.43056, 0, 0.05556, 0.46563],
2964    "102": [0.19444, 0.69444, 0.10764, 0.16667, 0.48959],
2965    "103": [0.19444, 0.43056, 0.03588, 0.02778, 0.47697],
2966    "104": [0, 0.69444, 0, 0, 0.57616],
2967    "105": [0, 0.65952, 0, 0, 0.34451],
2968    "106": [0.19444, 0.65952, 0.05724, 0, 0.41181],
2969    "107": [0, 0.69444, 0.03148, 0, 0.5206],
2970    "108": [0, 0.69444, 0.01968, 0.08334, 0.29838],
2971    "109": [0, 0.43056, 0, 0, 0.87801],
2972    "110": [0, 0.43056, 0, 0, 0.60023],
2973    "111": [0, 0.43056, 0, 0.05556, 0.48472],
2974    "112": [0.19444, 0.43056, 0, 0.08334, 0.50313],
2975    "113": [0.19444, 0.43056, 0.03588, 0.08334, 0.44641],
2976    "114": [0, 0.43056, 0.02778, 0.05556, 0.45116],
2977    "115": [0, 0.43056, 0, 0.05556, 0.46875],
2978    "116": [0, 0.61508, 0, 0.08334, 0.36111],
2979    "117": [0, 0.43056, 0, 0.02778, 0.57246],
2980    "118": [0, 0.43056, 0.03588, 0.02778, 0.48472],
2981    "119": [0, 0.43056, 0.02691, 0.08334, 0.71592],
2982    "120": [0, 0.43056, 0, 0.02778, 0.57153],
2983    "121": [0.19444, 0.43056, 0.03588, 0.05556, 0.49028],
2984    "122": [0, 0.43056, 0.04398, 0.05556, 0.46505],
2985    "915": [0, 0.68333, 0.13889, 0.08334, 0.61528],
2986    "916": [0, 0.68333, 0, 0.16667, 0.83334],
2987    "920": [0, 0.68333, 0.02778, 0.08334, 0.76278],
2988    "923": [0, 0.68333, 0, 0.16667, 0.69445],
2989    "926": [0, 0.68333, 0.07569, 0.08334, 0.74236],
2990    "928": [0, 0.68333, 0.08125, 0.05556, 0.83125],
2991    "931": [0, 0.68333, 0.05764, 0.08334, 0.77986],
2992    "933": [0, 0.68333, 0.13889, 0.05556, 0.58333],
2993    "934": [0, 0.68333, 0, 0.08334, 0.66667],
2994    "936": [0, 0.68333, 0.11, 0.05556, 0.61222],
2995    "937": [0, 0.68333, 0.05017, 0.08334, 0.7724],
2996    "945": [0, 0.43056, 0.0037, 0.02778, 0.6397],
2997    "946": [0.19444, 0.69444, 0.05278, 0.08334, 0.56563],
2998    "947": [0.19444, 0.43056, 0.05556, 0, 0.51773],
2999    "948": [0, 0.69444, 0.03785, 0.05556, 0.44444],
3000    "949": [0, 0.43056, 0, 0.08334, 0.46632],
3001    "950": [0.19444, 0.69444, 0.07378, 0.08334, 0.4375],
3002    "951": [0.19444, 0.43056, 0.03588, 0.05556, 0.49653],
3003    "952": [0, 0.69444, 0.02778, 0.08334, 0.46944],
3004    "953": [0, 0.43056, 0, 0.05556, 0.35394],
3005    "954": [0, 0.43056, 0, 0, 0.57616],
3006    "955": [0, 0.69444, 0, 0, 0.58334],
3007    "956": [0.19444, 0.43056, 0, 0.02778, 0.60255],
3008    "957": [0, 0.43056, 0.06366, 0.02778, 0.49398],
3009    "958": [0.19444, 0.69444, 0.04601, 0.11111, 0.4375],
3010    "959": [0, 0.43056, 0, 0.05556, 0.48472],
3011    "960": [0, 0.43056, 0.03588, 0, 0.57003],
3012    "961": [0.19444, 0.43056, 0, 0.08334, 0.51702],
3013    "962": [0.09722, 0.43056, 0.07986, 0.08334, 0.36285],
3014    "963": [0, 0.43056, 0.03588, 0, 0.57141],
3015    "964": [0, 0.43056, 0.1132, 0.02778, 0.43715],
3016    "965": [0, 0.43056, 0.03588, 0.02778, 0.54028],
3017    "966": [0.19444, 0.43056, 0, 0.08334, 0.65417],
3018    "967": [0.19444, 0.43056, 0, 0.05556, 0.62569],
3019    "968": [0.19444, 0.69444, 0.03588, 0.11111, 0.65139],
3020    "969": [0, 0.43056, 0.03588, 0, 0.62245],
3021    "977": [0, 0.69444, 0, 0.08334, 0.59144],
3022    "981": [0.19444, 0.69444, 0, 0.08334, 0.59583],
3023    "982": [0, 0.43056, 0.02778, 0, 0.82813],
3024    "1009": [0.19444, 0.43056, 0, 0.08334, 0.51702],
3025    "1013": [0, 0.43056, 0, 0.05556, 0.4059]
3026  },
3027  "SansSerif-Bold": {
3028    "33": [0, 0.69444, 0, 0, 0.36667],
3029    "34": [0, 0.69444, 0, 0, 0.55834],
3030    "35": [0.19444, 0.69444, 0, 0, 0.91667],
3031    "36": [0.05556, 0.75, 0, 0, 0.55],
3032    "37": [0.05556, 0.75, 0, 0, 1.02912],
3033    "38": [0, 0.69444, 0, 0, 0.83056],
3034    "39": [0, 0.69444, 0, 0, 0.30556],
3035    "40": [0.25, 0.75, 0, 0, 0.42778],
3036    "41": [0.25, 0.75, 0, 0, 0.42778],
3037    "42": [0, 0.75, 0, 0, 0.55],
3038    "43": [0.11667, 0.61667, 0, 0, 0.85556],
3039    "44": [0.10556, 0.13056, 0, 0, 0.30556],
3040    "45": [0, 0.45833, 0, 0, 0.36667],
3041    "46": [0, 0.13056, 0, 0, 0.30556],
3042    "47": [0.25, 0.75, 0, 0, 0.55],
3043    "48": [0, 0.69444, 0, 0, 0.55],
3044    "49": [0, 0.69444, 0, 0, 0.55],
3045    "50": [0, 0.69444, 0, 0, 0.55],
3046    "51": [0, 0.69444, 0, 0, 0.55],
3047    "52": [0, 0.69444, 0, 0, 0.55],
3048    "53": [0, 0.69444, 0, 0, 0.55],
3049    "54": [0, 0.69444, 0, 0, 0.55],
3050    "55": [0, 0.69444, 0, 0, 0.55],
3051    "56": [0, 0.69444, 0, 0, 0.55],
3052    "57": [0, 0.69444, 0, 0, 0.55],
3053    "58": [0, 0.45833, 0, 0, 0.30556],
3054    "59": [0.10556, 0.45833, 0, 0, 0.30556],
3055    "61": [-0.09375, 0.40625, 0, 0, 0.85556],
3056    "63": [0, 0.69444, 0, 0, 0.51945],
3057    "64": [0, 0.69444, 0, 0, 0.73334],
3058    "65": [0, 0.69444, 0, 0, 0.73334],
3059    "66": [0, 0.69444, 0, 0, 0.73334],
3060    "67": [0, 0.69444, 0, 0, 0.70278],
3061    "68": [0, 0.69444, 0, 0, 0.79445],
3062    "69": [0, 0.69444, 0, 0, 0.64167],
3063    "70": [0, 0.69444, 0, 0, 0.61111],
3064    "71": [0, 0.69444, 0, 0, 0.73334],
3065    "72": [0, 0.69444, 0, 0, 0.79445],
3066    "73": [0, 0.69444, 0, 0, 0.33056],
3067    "74": [0, 0.69444, 0, 0, 0.51945],
3068    "75": [0, 0.69444, 0, 0, 0.76389],
3069    "76": [0, 0.69444, 0, 0, 0.58056],
3070    "77": [0, 0.69444, 0, 0, 0.97778],
3071    "78": [0, 0.69444, 0, 0, 0.79445],
3072    "79": [0, 0.69444, 0, 0, 0.79445],
3073    "80": [0, 0.69444, 0, 0, 0.70278],
3074    "81": [0.10556, 0.69444, 0, 0, 0.79445],
3075    "82": [0, 0.69444, 0, 0, 0.70278],
3076    "83": [0, 0.69444, 0, 0, 0.61111],
3077    "84": [0, 0.69444, 0, 0, 0.73334],
3078    "85": [0, 0.69444, 0, 0, 0.76389],
3079    "86": [0, 0.69444, 0.01528, 0, 0.73334],
3080    "87": [0, 0.69444, 0.01528, 0, 1.03889],
3081    "88": [0, 0.69444, 0, 0, 0.73334],
3082    "89": [0, 0.69444, 0.0275, 0, 0.73334],
3083    "90": [0, 0.69444, 0, 0, 0.67223],
3084    "91": [0.25, 0.75, 0, 0, 0.34306],
3085    "93": [0.25, 0.75, 0, 0, 0.34306],
3086    "94": [0, 0.69444, 0, 0, 0.55],
3087    "95": [0.35, 0.10833, 0.03056, 0, 0.55],
3088    "97": [0, 0.45833, 0, 0, 0.525],
3089    "98": [0, 0.69444, 0, 0, 0.56111],
3090    "99": [0, 0.45833, 0, 0, 0.48889],
3091    "100": [0, 0.69444, 0, 0, 0.56111],
3092    "101": [0, 0.45833, 0, 0, 0.51111],
3093    "102": [0, 0.69444, 0.07639, 0, 0.33611],
3094    "103": [0.19444, 0.45833, 0.01528, 0, 0.55],
3095    "104": [0, 0.69444, 0, 0, 0.56111],
3096    "105": [0, 0.69444, 0, 0, 0.25556],
3097    "106": [0.19444, 0.69444, 0, 0, 0.28611],
3098    "107": [0, 0.69444, 0, 0, 0.53056],
3099    "108": [0, 0.69444, 0, 0, 0.25556],
3100    "109": [0, 0.45833, 0, 0, 0.86667],
3101    "110": [0, 0.45833, 0, 0, 0.56111],
3102    "111": [0, 0.45833, 0, 0, 0.55],
3103    "112": [0.19444, 0.45833, 0, 0, 0.56111],
3104    "113": [0.19444, 0.45833, 0, 0, 0.56111],
3105    "114": [0, 0.45833, 0.01528, 0, 0.37222],
3106    "115": [0, 0.45833, 0, 0, 0.42167],
3107    "116": [0, 0.58929, 0, 0, 0.40417],
3108    "117": [0, 0.45833, 0, 0, 0.56111],
3109    "118": [0, 0.45833, 0.01528, 0, 0.5],
3110    "119": [0, 0.45833, 0.01528, 0, 0.74445],
3111    "120": [0, 0.45833, 0, 0, 0.5],
3112    "121": [0.19444, 0.45833, 0.01528, 0, 0.5],
3113    "122": [0, 0.45833, 0, 0, 0.47639],
3114    "126": [0.35, 0.34444, 0, 0, 0.55],
3115    "168": [0, 0.69444, 0, 0, 0.55],
3116    "176": [0, 0.69444, 0, 0, 0.73334],
3117    "180": [0, 0.69444, 0, 0, 0.55],
3118    "184": [0.17014, 0, 0, 0, 0.48889],
3119    "305": [0, 0.45833, 0, 0, 0.25556],
3120    "567": [0.19444, 0.45833, 0, 0, 0.28611],
3121    "710": [0, 0.69444, 0, 0, 0.55],
3122    "711": [0, 0.63542, 0, 0, 0.55],
3123    "713": [0, 0.63778, 0, 0, 0.55],
3124    "728": [0, 0.69444, 0, 0, 0.55],
3125    "729": [0, 0.69444, 0, 0, 0.30556],
3126    "730": [0, 0.69444, 0, 0, 0.73334],
3127    "732": [0, 0.69444, 0, 0, 0.55],
3128    "733": [0, 0.69444, 0, 0, 0.55],
3129    "915": [0, 0.69444, 0, 0, 0.58056],
3130    "916": [0, 0.69444, 0, 0, 0.91667],
3131    "920": [0, 0.69444, 0, 0, 0.85556],
3132    "923": [0, 0.69444, 0, 0, 0.67223],
3133    "926": [0, 0.69444, 0, 0, 0.73334],
3134    "928": [0, 0.69444, 0, 0, 0.79445],
3135    "931": [0, 0.69444, 0, 0, 0.79445],
3136    "933": [0, 0.69444, 0, 0, 0.85556],
3137    "934": [0, 0.69444, 0, 0, 0.79445],
3138    "936": [0, 0.69444, 0, 0, 0.85556],
3139    "937": [0, 0.69444, 0, 0, 0.79445],
3140    "8211": [0, 0.45833, 0.03056, 0, 0.55],
3141    "8212": [0, 0.45833, 0.03056, 0, 1.10001],
3142    "8216": [0, 0.69444, 0, 0, 0.30556],
3143    "8217": [0, 0.69444, 0, 0, 0.30556],
3144    "8220": [0, 0.69444, 0, 0, 0.55834],
3145    "8221": [0, 0.69444, 0, 0, 0.55834]
3146  },
3147  "SansSerif-Italic": {
3148    "33": [0, 0.69444, 0.05733, 0, 0.31945],
3149    "34": [0, 0.69444, 0.00316, 0, 0.5],
3150    "35": [0.19444, 0.69444, 0.05087, 0, 0.83334],
3151    "36": [0.05556, 0.75, 0.11156, 0, 0.5],
3152    "37": [0.05556, 0.75, 0.03126, 0, 0.83334],
3153    "38": [0, 0.69444, 0.03058, 0, 0.75834],
3154    "39": [0, 0.69444, 0.07816, 0, 0.27778],
3155    "40": [0.25, 0.75, 0.13164, 0, 0.38889],
3156    "41": [0.25, 0.75, 0.02536, 0, 0.38889],
3157    "42": [0, 0.75, 0.11775, 0, 0.5],
3158    "43": [0.08333, 0.58333, 0.02536, 0, 0.77778],
3159    "44": [0.125, 0.08333, 0, 0, 0.27778],
3160    "45": [0, 0.44444, 0.01946, 0, 0.33333],
3161    "46": [0, 0.08333, 0, 0, 0.27778],
3162    "47": [0.25, 0.75, 0.13164, 0, 0.5],
3163    "48": [0, 0.65556, 0.11156, 0, 0.5],
3164    "49": [0, 0.65556, 0.11156, 0, 0.5],
3165    "50": [0, 0.65556, 0.11156, 0, 0.5],
3166    "51": [0, 0.65556, 0.11156, 0, 0.5],
3167    "52": [0, 0.65556, 0.11156, 0, 0.5],
3168    "53": [0, 0.65556, 0.11156, 0, 0.5],
3169    "54": [0, 0.65556, 0.11156, 0, 0.5],
3170    "55": [0, 0.65556, 0.11156, 0, 0.5],
3171    "56": [0, 0.65556, 0.11156, 0, 0.5],
3172    "57": [0, 0.65556, 0.11156, 0, 0.5],
3173    "58": [0, 0.44444, 0.02502, 0, 0.27778],
3174    "59": [0.125, 0.44444, 0.02502, 0, 0.27778],
3175    "61": [-0.13, 0.37, 0.05087, 0, 0.77778],
3176    "63": [0, 0.69444, 0.11809, 0, 0.47222],
3177    "64": [0, 0.69444, 0.07555, 0, 0.66667],
3178    "65": [0, 0.69444, 0, 0, 0.66667],
3179    "66": [0, 0.69444, 0.08293, 0, 0.66667],
3180    "67": [0, 0.69444, 0.11983, 0, 0.63889],
3181    "68": [0, 0.69444, 0.07555, 0, 0.72223],
3182    "69": [0, 0.69444, 0.11983, 0, 0.59722],
3183    "70": [0, 0.69444, 0.13372, 0, 0.56945],
3184    "71": [0, 0.69444, 0.11983, 0, 0.66667],
3185    "72": [0, 0.69444, 0.08094, 0, 0.70834],
3186    "73": [0, 0.69444, 0.13372, 0, 0.27778],
3187    "74": [0, 0.69444, 0.08094, 0, 0.47222],
3188    "75": [0, 0.69444, 0.11983, 0, 0.69445],
3189    "76": [0, 0.69444, 0, 0, 0.54167],
3190    "77": [0, 0.69444, 0.08094, 0, 0.875],
3191    "78": [0, 0.69444, 0.08094, 0, 0.70834],
3192    "79": [0, 0.69444, 0.07555, 0, 0.73611],
3193    "80": [0, 0.69444, 0.08293, 0, 0.63889],
3194    "81": [0.125, 0.69444, 0.07555, 0, 0.73611],
3195    "82": [0, 0.69444, 0.08293, 0, 0.64584],
3196    "83": [0, 0.69444, 0.09205, 0, 0.55556],
3197    "84": [0, 0.69444, 0.13372, 0, 0.68056],
3198    "85": [0, 0.69444, 0.08094, 0, 0.6875],
3199    "86": [0, 0.69444, 0.1615, 0, 0.66667],
3200    "87": [0, 0.69444, 0.1615, 0, 0.94445],
3201    "88": [0, 0.69444, 0.13372, 0, 0.66667],
3202    "89": [0, 0.69444, 0.17261, 0, 0.66667],
3203    "90": [0, 0.69444, 0.11983, 0, 0.61111],
3204    "91": [0.25, 0.75, 0.15942, 0, 0.28889],
3205    "93": [0.25, 0.75, 0.08719, 0, 0.28889],
3206    "94": [0, 0.69444, 0.0799, 0, 0.5],
3207    "95": [0.35, 0.09444, 0.08616, 0, 0.5],
3208    "97": [0, 0.44444, 0.00981, 0, 0.48056],
3209    "98": [0, 0.69444, 0.03057, 0, 0.51667],
3210    "99": [0, 0.44444, 0.08336, 0, 0.44445],
3211    "100": [0, 0.69444, 0.09483, 0, 0.51667],
3212    "101": [0, 0.44444, 0.06778, 0, 0.44445],
3213    "102": [0, 0.69444, 0.21705, 0, 0.30556],
3214    "103": [0.19444, 0.44444, 0.10836, 0, 0.5],
3215    "104": [0, 0.69444, 0.01778, 0, 0.51667],
3216    "105": [0, 0.67937, 0.09718, 0, 0.23889],
3217    "106": [0.19444, 0.67937, 0.09162, 0, 0.26667],
3218    "107": [0, 0.69444, 0.08336, 0, 0.48889],
3219    "108": [0, 0.69444, 0.09483, 0, 0.23889],
3220    "109": [0, 0.44444, 0.01778, 0, 0.79445],
3221    "110": [0, 0.44444, 0.01778, 0, 0.51667],
3222    "111": [0, 0.44444, 0.06613, 0, 0.5],
3223    "112": [0.19444, 0.44444, 0.0389, 0, 0.51667],
3224    "113": [0.19444, 0.44444, 0.04169, 0, 0.51667],
3225    "114": [0, 0.44444, 0.10836, 0, 0.34167],
3226    "115": [0, 0.44444, 0.0778, 0, 0.38333],
3227    "116": [0, 0.57143, 0.07225, 0, 0.36111],
3228    "117": [0, 0.44444, 0.04169, 0, 0.51667],
3229    "118": [0, 0.44444, 0.10836, 0, 0.46111],
3230    "119": [0, 0.44444, 0.10836, 0, 0.68334],
3231    "120": [0, 0.44444, 0.09169, 0, 0.46111],
3232    "121": [0.19444, 0.44444, 0.10836, 0, 0.46111],
3233    "122": [0, 0.44444, 0.08752, 0, 0.43472],
3234    "126": [0.35, 0.32659, 0.08826, 0, 0.5],
3235    "168": [0, 0.67937, 0.06385, 0, 0.5],
3236    "176": [0, 0.69444, 0, 0, 0.73752],
3237    "184": [0.17014, 0, 0, 0, 0.44445],
3238    "305": [0, 0.44444, 0.04169, 0, 0.23889],
3239    "567": [0.19444, 0.44444, 0.04169, 0, 0.26667],
3240    "710": [0, 0.69444, 0.0799, 0, 0.5],
3241    "711": [0, 0.63194, 0.08432, 0, 0.5],
3242    "713": [0, 0.60889, 0.08776, 0, 0.5],
3243    "714": [0, 0.69444, 0.09205, 0, 0.5],
3244    "715": [0, 0.69444, 0, 0, 0.5],
3245    "728": [0, 0.69444, 0.09483, 0, 0.5],
3246    "729": [0, 0.67937, 0.07774, 0, 0.27778],
3247    "730": [0, 0.69444, 0, 0, 0.73752],
3248    "732": [0, 0.67659, 0.08826, 0, 0.5],
3249    "733": [0, 0.69444, 0.09205, 0, 0.5],
3250    "915": [0, 0.69444, 0.13372, 0, 0.54167],
3251    "916": [0, 0.69444, 0, 0, 0.83334],
3252    "920": [0, 0.69444, 0.07555, 0, 0.77778],
3253    "923": [0, 0.69444, 0, 0, 0.61111],
3254    "926": [0, 0.69444, 0.12816, 0, 0.66667],
3255    "928": [0, 0.69444, 0.08094, 0, 0.70834],
3256    "931": [0, 0.69444, 0.11983, 0, 0.72222],
3257    "933": [0, 0.69444, 0.09031, 0, 0.77778],
3258    "934": [0, 0.69444, 0.04603, 0, 0.72222],
3259    "936": [0, 0.69444, 0.09031, 0, 0.77778],
3260    "937": [0, 0.69444, 0.08293, 0, 0.72222],
3261    "8211": [0, 0.44444, 0.08616, 0, 0.5],
3262    "8212": [0, 0.44444, 0.08616, 0, 1.0],
3263    "8216": [0, 0.69444, 0.07816, 0, 0.27778],
3264    "8217": [0, 0.69444, 0.07816, 0, 0.27778],
3265    "8220": [0, 0.69444, 0.14205, 0, 0.5],
3266    "8221": [0, 0.69444, 0.00316, 0, 0.5]
3267  },
3268  "SansSerif-Regular": {
3269    "33": [0, 0.69444, 0, 0, 0.31945],
3270    "34": [0, 0.69444, 0, 0, 0.5],
3271    "35": [0.19444, 0.69444, 0, 0, 0.83334],
3272    "36": [0.05556, 0.75, 0, 0, 0.5],
3273    "37": [0.05556, 0.75, 0, 0, 0.83334],
3274    "38": [0, 0.69444, 0, 0, 0.75834],
3275    "39": [0, 0.69444, 0, 0, 0.27778],
3276    "40": [0.25, 0.75, 0, 0, 0.38889],
3277    "41": [0.25, 0.75, 0, 0, 0.38889],
3278    "42": [0, 0.75, 0, 0, 0.5],
3279    "43": [0.08333, 0.58333, 0, 0, 0.77778],
3280    "44": [0.125, 0.08333, 0, 0, 0.27778],
3281    "45": [0, 0.44444, 0, 0, 0.33333],
3282    "46": [0, 0.08333, 0, 0, 0.27778],
3283    "47": [0.25, 0.75, 0, 0, 0.5],
3284    "48": [0, 0.65556, 0, 0, 0.5],
3285    "49": [0, 0.65556, 0, 0, 0.5],
3286    "50": [0, 0.65556, 0, 0, 0.5],
3287    "51": [0, 0.65556, 0, 0, 0.5],
3288    "52": [0, 0.65556, 0, 0, 0.5],
3289    "53": [0, 0.65556, 0, 0, 0.5],
3290    "54": [0, 0.65556, 0, 0, 0.5],
3291    "55": [0, 0.65556, 0, 0, 0.5],
3292    "56": [0, 0.65556, 0, 0, 0.5],
3293    "57": [0, 0.65556, 0, 0, 0.5],
3294    "58": [0, 0.44444, 0, 0, 0.27778],
3295    "59": [0.125, 0.44444, 0, 0, 0.27778],
3296    "61": [-0.13, 0.37, 0, 0, 0.77778],
3297    "63": [0, 0.69444, 0, 0, 0.47222],
3298    "64": [0, 0.69444, 0, 0, 0.66667],
3299    "65": [0, 0.69444, 0, 0, 0.66667],
3300    "66": [0, 0.69444, 0, 0, 0.66667],
3301    "67": [0, 0.69444, 0, 0, 0.63889],
3302    "68": [0, 0.69444, 0, 0, 0.72223],
3303    "69": [0, 0.69444, 0, 0, 0.59722],
3304    "70": [0, 0.69444, 0, 0, 0.56945],
3305    "71": [0, 0.69444, 0, 0, 0.66667],
3306    "72": [0, 0.69444, 0, 0, 0.70834],
3307    "73": [0, 0.69444, 0, 0, 0.27778],
3308    "74": [0, 0.69444, 0, 0, 0.47222],
3309    "75": [0, 0.69444, 0, 0, 0.69445],
3310    "76": [0, 0.69444, 0, 0, 0.54167],
3311    "77": [0, 0.69444, 0, 0, 0.875],
3312    "78": [0, 0.69444, 0, 0, 0.70834],
3313    "79": [0, 0.69444, 0, 0, 0.73611],
3314    "80": [0, 0.69444, 0, 0, 0.63889],
3315    "81": [0.125, 0.69444, 0, 0, 0.73611],
3316    "82": [0, 0.69444, 0, 0, 0.64584],
3317    "83": [0, 0.69444, 0, 0, 0.55556],
3318    "84": [0, 0.69444, 0, 0, 0.68056],
3319    "85": [0, 0.69444, 0, 0, 0.6875],
3320    "86": [0, 0.69444, 0.01389, 0, 0.66667],
3321    "87": [0, 0.69444, 0.01389, 0, 0.94445],
3322    "88": [0, 0.69444, 0, 0, 0.66667],
3323    "89": [0, 0.69444, 0.025, 0, 0.66667],
3324    "90": [0, 0.69444, 0, 0, 0.61111],
3325    "91": [0.25, 0.75, 0, 0, 0.28889],
3326    "93": [0.25, 0.75, 0, 0, 0.28889],
3327    "94": [0, 0.69444, 0, 0, 0.5],
3328    "95": [0.35, 0.09444, 0.02778, 0, 0.5],
3329    "97": [0, 0.44444, 0, 0, 0.48056],
3330    "98": [0, 0.69444, 0, 0, 0.51667],
3331    "99": [0, 0.44444, 0, 0, 0.44445],
3332    "100": [0, 0.69444, 0, 0, 0.51667],
3333    "101": [0, 0.44444, 0, 0, 0.44445],
3334    "102": [0, 0.69444, 0.06944, 0, 0.30556],
3335    "103": [0.19444, 0.44444, 0.01389, 0, 0.5],
3336    "104": [0, 0.69444, 0, 0, 0.51667],
3337    "105": [0, 0.67937, 0, 0, 0.23889],
3338    "106": [0.19444, 0.67937, 0, 0, 0.26667],
3339    "107": [0, 0.69444, 0, 0, 0.48889],
3340    "108": [0, 0.69444, 0, 0, 0.23889],
3341    "109": [0, 0.44444, 0, 0, 0.79445],
3342    "110": [0, 0.44444, 0, 0, 0.51667],
3343    "111": [0, 0.44444, 0, 0, 0.5],
3344    "112": [0.19444, 0.44444, 0, 0, 0.51667],
3345    "113": [0.19444, 0.44444, 0, 0, 0.51667],
3346    "114": [0, 0.44444, 0.01389, 0, 0.34167],
3347    "115": [0, 0.44444, 0, 0, 0.38333],
3348    "116": [0, 0.57143, 0, 0, 0.36111],
3349    "117": [0, 0.44444, 0, 0, 0.51667],
3350    "118": [0, 0.44444, 0.01389, 0, 0.46111],
3351    "119": [0, 0.44444, 0.01389, 0, 0.68334],
3352    "120": [0, 0.44444, 0, 0, 0.46111],
3353    "121": [0.19444, 0.44444, 0.01389, 0, 0.46111],
3354    "122": [0, 0.44444, 0, 0, 0.43472],
3355    "126": [0.35, 0.32659, 0, 0, 0.5],
3356    "168": [0, 0.67937, 0, 0, 0.5],
3357    "176": [0, 0.69444, 0, 0, 0.66667],
3358    "184": [0.17014, 0, 0, 0, 0.44445],
3359    "305": [0, 0.44444, 0, 0, 0.23889],
3360    "567": [0.19444, 0.44444, 0, 0, 0.26667],
3361    "710": [0, 0.69444, 0, 0, 0.5],
3362    "711": [0, 0.63194, 0, 0, 0.5],
3363    "713": [0, 0.60889, 0, 0, 0.5],
3364    "714": [0, 0.69444, 0, 0, 0.5],
3365    "715": [0, 0.69444, 0, 0, 0.5],
3366    "728": [0, 0.69444, 0, 0, 0.5],
3367    "729": [0, 0.67937, 0, 0, 0.27778],
3368    "730": [0, 0.69444, 0, 0, 0.66667],
3369    "732": [0, 0.67659, 0, 0, 0.5],
3370    "733": [0, 0.69444, 0, 0, 0.5],
3371    "915": [0, 0.69444, 0, 0, 0.54167],
3372    "916": [0, 0.69444, 0, 0, 0.83334],
3373    "920": [0, 0.69444, 0, 0, 0.77778],
3374    "923": [0, 0.69444, 0, 0, 0.61111],
3375    "926": [0, 0.69444, 0, 0, 0.66667],
3376    "928": [0, 0.69444, 0, 0, 0.70834],
3377    "931": [0, 0.69444, 0, 0, 0.72222],
3378    "933": [0, 0.69444, 0, 0, 0.77778],
3379    "934": [0, 0.69444, 0, 0, 0.72222],
3380    "936": [0, 0.69444, 0, 0, 0.77778],
3381    "937": [0, 0.69444, 0, 0, 0.72222],
3382    "8211": [0, 0.44444, 0.02778, 0, 0.5],
3383    "8212": [0, 0.44444, 0.02778, 0, 1.0],
3384    "8216": [0, 0.69444, 0, 0, 0.27778],
3385    "8217": [0, 0.69444, 0, 0, 0.27778],
3386    "8220": [0, 0.69444, 0, 0, 0.5],
3387    "8221": [0, 0.69444, 0, 0, 0.5]
3388  },
3389  "Script-Regular": {
3390    "65": [0, 0.7, 0.22925, 0, 0.80253],
3391    "66": [0, 0.7, 0.04087, 0, 0.90757],
3392    "67": [0, 0.7, 0.1689, 0, 0.66619],
3393    "68": [0, 0.7, 0.09371, 0, 0.77443],
3394    "69": [0, 0.7, 0.18583, 0, 0.56162],
3395    "70": [0, 0.7, 0.13634, 0, 0.89544],
3396    "71": [0, 0.7, 0.17322, 0, 0.60961],
3397    "72": [0, 0.7, 0.29694, 0, 0.96919],
3398    "73": [0, 0.7, 0.19189, 0, 0.80907],
3399    "74": [0.27778, 0.7, 0.19189, 0, 1.05159],
3400    "75": [0, 0.7, 0.31259, 0, 0.91364],
3401    "76": [0, 0.7, 0.19189, 0, 0.87373],
3402    "77": [0, 0.7, 0.15981, 0, 1.08031],
3403    "78": [0, 0.7, 0.3525, 0, 0.9015],
3404    "79": [0, 0.7, 0.08078, 0, 0.73787],
3405    "80": [0, 0.7, 0.08078, 0, 1.01262],
3406    "81": [0, 0.7, 0.03305, 0, 0.88282],
3407    "82": [0, 0.7, 0.06259, 0, 0.85],
3408    "83": [0, 0.7, 0.19189, 0, 0.86767],
3409    "84": [0, 0.7, 0.29087, 0, 0.74697],
3410    "85": [0, 0.7, 0.25815, 0, 0.79996],
3411    "86": [0, 0.7, 0.27523, 0, 0.62204],
3412    "87": [0, 0.7, 0.27523, 0, 0.80532],
3413    "88": [0, 0.7, 0.26006, 0, 0.94445],
3414    "89": [0, 0.7, 0.2939, 0, 0.70961],
3415    "90": [0, 0.7, 0.24037, 0, 0.8212]
3416  },
3417  "Size1-Regular": {
3418    "40": [0.35001, 0.85, 0, 0, 0.45834],
3419    "41": [0.35001, 0.85, 0, 0, 0.45834],
3420    "47": [0.35001, 0.85, 0, 0, 0.57778],
3421    "91": [0.35001, 0.85, 0, 0, 0.41667],
3422    "92": [0.35001, 0.85, 0, 0, 0.57778],
3423    "93": [0.35001, 0.85, 0, 0, 0.41667],
3424    "123": [0.35001, 0.85, 0, 0, 0.58334],
3425    "125": [0.35001, 0.85, 0, 0, 0.58334],
3426    "710": [0, 0.72222, 0, 0, 0.55556],
3427    "732": [0, 0.72222, 0, 0, 0.55556],
3428    "770": [0, 0.72222, 0, 0, 0.55556],
3429    "771": [0, 0.72222, 0, 0, 0.55556],
3430    "8214": [-0.00099, 0.601, 0, 0, 0.77778],
3431    "8593": [1e-05, 0.6, 0, 0, 0.66667],
3432    "8595": [1e-05, 0.6, 0, 0, 0.66667],
3433    "8657": [1e-05, 0.6, 0, 0, 0.77778],
3434    "8659": [1e-05, 0.6, 0, 0, 0.77778],
3435    "8719": [0.25001, 0.75, 0, 0, 0.94445],
3436    "8720": [0.25001, 0.75, 0, 0, 0.94445],
3437    "8721": [0.25001, 0.75, 0, 0, 1.05556],
3438    "8730": [0.35001, 0.85, 0, 0, 1.0],
3439    "8739": [-0.00599, 0.606, 0, 0, 0.33333],
3440    "8741": [-0.00599, 0.606, 0, 0, 0.55556],
3441    "8747": [0.30612, 0.805, 0.19445, 0, 0.47222],
3442    "8748": [0.306, 0.805, 0.19445, 0, 0.47222],
3443    "8749": [0.306, 0.805, 0.19445, 0, 0.47222],
3444    "8750": [0.30612, 0.805, 0.19445, 0, 0.47222],
3445    "8896": [0.25001, 0.75, 0, 0, 0.83334],
3446    "8897": [0.25001, 0.75, 0, 0, 0.83334],
3447    "8898": [0.25001, 0.75, 0, 0, 0.83334],
3448    "8899": [0.25001, 0.75, 0, 0, 0.83334],
3449    "8968": [0.35001, 0.85, 0, 0, 0.47222],
3450    "8969": [0.35001, 0.85, 0, 0, 0.47222],
3451    "8970": [0.35001, 0.85, 0, 0, 0.47222],
3452    "8971": [0.35001, 0.85, 0, 0, 0.47222],
3453    "9168": [-0.00099, 0.601, 0, 0, 0.66667],
3454    "10216": [0.35001, 0.85, 0, 0, 0.47222],
3455    "10217": [0.35001, 0.85, 0, 0, 0.47222],
3456    "10752": [0.25001, 0.75, 0, 0, 1.11111],
3457    "10753": [0.25001, 0.75, 0, 0, 1.11111],
3458    "10754": [0.25001, 0.75, 0, 0, 1.11111],
3459    "10756": [0.25001, 0.75, 0, 0, 0.83334],
3460    "10758": [0.25001, 0.75, 0, 0, 0.83334]
3461  },
3462  "Size2-Regular": {
3463    "40": [0.65002, 1.15, 0, 0, 0.59722],
3464    "41": [0.65002, 1.15, 0, 0, 0.59722],
3465    "47": [0.65002, 1.15, 0, 0, 0.81111],
3466    "91": [0.65002, 1.15, 0, 0, 0.47222],
3467    "92": [0.65002, 1.15, 0, 0, 0.81111],
3468    "93": [0.65002, 1.15, 0, 0, 0.47222],
3469    "123": [0.65002, 1.15, 0, 0, 0.66667],
3470    "125": [0.65002, 1.15, 0, 0, 0.66667],
3471    "710": [0, 0.75, 0, 0, 1.0],
3472    "732": [0, 0.75, 0, 0, 1.0],
3473    "770": [0, 0.75, 0, 0, 1.0],
3474    "771": [0, 0.75, 0, 0, 1.0],
3475    "8719": [0.55001, 1.05, 0, 0, 1.27778],
3476    "8720": [0.55001, 1.05, 0, 0, 1.27778],
3477    "8721": [0.55001, 1.05, 0, 0, 1.44445],
3478    "8730": [0.65002, 1.15, 0, 0, 1.0],
3479    "8747": [0.86225, 1.36, 0.44445, 0, 0.55556],
3480    "8748": [0.862, 1.36, 0.44445, 0, 0.55556],
3481    "8749": [0.862, 1.36, 0.44445, 0, 0.55556],
3482    "8750": [0.86225, 1.36, 0.44445, 0, 0.55556],
3483    "8896": [0.55001, 1.05, 0, 0, 1.11111],
3484    "8897": [0.55001, 1.05, 0, 0, 1.11111],
3485    "8898": [0.55001, 1.05, 0, 0, 1.11111],
3486    "8899": [0.55001, 1.05, 0, 0, 1.11111],
3487    "8968": [0.65002, 1.15, 0, 0, 0.52778],
3488    "8969": [0.65002, 1.15, 0, 0, 0.52778],
3489    "8970": [0.65002, 1.15, 0, 0, 0.52778],
3490    "8971": [0.65002, 1.15, 0, 0, 0.52778],
3491    "10216": [0.65002, 1.15, 0, 0, 0.61111],
3492    "10217": [0.65002, 1.15, 0, 0, 0.61111],
3493    "10752": [0.55001, 1.05, 0, 0, 1.51112],
3494    "10753": [0.55001, 1.05, 0, 0, 1.51112],
3495    "10754": [0.55001, 1.05, 0, 0, 1.51112],
3496    "10756": [0.55001, 1.05, 0, 0, 1.11111],
3497    "10758": [0.55001, 1.05, 0, 0, 1.11111]
3498  },
3499  "Size3-Regular": {
3500    "40": [0.95003, 1.45, 0, 0, 0.73611],
3501    "41": [0.95003, 1.45, 0, 0, 0.73611],
3502    "47": [0.95003, 1.45, 0, 0, 1.04445],
3503    "91": [0.95003, 1.45, 0, 0, 0.52778],
3504    "92": [0.95003, 1.45, 0, 0, 1.04445],
3505    "93": [0.95003, 1.45, 0, 0, 0.52778],
3506    "123": [0.95003, 1.45, 0, 0, 0.75],
3507    "125": [0.95003, 1.45, 0, 0, 0.75],
3508    "710": [0, 0.75, 0, 0, 1.44445],
3509    "732": [0, 0.75, 0, 0, 1.44445],
3510    "770": [0, 0.75, 0, 0, 1.44445],
3511    "771": [0, 0.75, 0, 0, 1.44445],
3512    "8730": [0.95003, 1.45, 0, 0, 1.0],
3513    "8968": [0.95003, 1.45, 0, 0, 0.58334],
3514    "8969": [0.95003, 1.45, 0, 0, 0.58334],
3515    "8970": [0.95003, 1.45, 0, 0, 0.58334],
3516    "8971": [0.95003, 1.45, 0, 0, 0.58334],
3517    "10216": [0.95003, 1.45, 0, 0, 0.75],
3518    "10217": [0.95003, 1.45, 0, 0, 0.75]
3519  },
3520  "Size4-Regular": {
3521    "40": [1.25003, 1.75, 0, 0, 0.79167],
3522    "41": [1.25003, 1.75, 0, 0, 0.79167],
3523    "47": [1.25003, 1.75, 0, 0, 1.27778],
3524    "91": [1.25003, 1.75, 0, 0, 0.58334],
3525    "92": [1.25003, 1.75, 0, 0, 1.27778],
3526    "93": [1.25003, 1.75, 0, 0, 0.58334],
3527    "123": [1.25003, 1.75, 0, 0, 0.80556],
3528    "125": [1.25003, 1.75, 0, 0, 0.80556],
3529    "710": [0, 0.825, 0, 0, 1.8889],
3530    "732": [0, 0.825, 0, 0, 1.8889],
3531    "770": [0, 0.825, 0, 0, 1.8889],
3532    "771": [0, 0.825, 0, 0, 1.8889],
3533    "8730": [1.25003, 1.75, 0, 0, 1.0],
3534    "8968": [1.25003, 1.75, 0, 0, 0.63889],
3535    "8969": [1.25003, 1.75, 0, 0, 0.63889],
3536    "8970": [1.25003, 1.75, 0, 0, 0.63889],
3537    "8971": [1.25003, 1.75, 0, 0, 0.63889],
3538    "9115": [0.64502, 1.155, 0, 0, 0.875],
3539    "9116": [1e-05, 0.6, 0, 0, 0.875],
3540    "9117": [0.64502, 1.155, 0, 0, 0.875],
3541    "9118": [0.64502, 1.155, 0, 0, 0.875],
3542    "9119": [1e-05, 0.6, 0, 0, 0.875],
3543    "9120": [0.64502, 1.155, 0, 0, 0.875],
3544    "9121": [0.64502, 1.155, 0, 0, 0.66667],
3545    "9122": [-0.00099, 0.601, 0, 0, 0.66667],
3546    "9123": [0.64502, 1.155, 0, 0, 0.66667],
3547    "9124": [0.64502, 1.155, 0, 0, 0.66667],
3548    "9125": [-0.00099, 0.601, 0, 0, 0.66667],
3549    "9126": [0.64502, 1.155, 0, 0, 0.66667],
3550    "9127": [1e-05, 0.9, 0, 0, 0.88889],
3551    "9128": [0.65002, 1.15, 0, 0, 0.88889],
3552    "9129": [0.90001, 0, 0, 0, 0.88889],
3553    "9130": [0, 0.3, 0, 0, 0.88889],
3554    "9131": [1e-05, 0.9, 0, 0, 0.88889],
3555    "9132": [0.65002, 1.15, 0, 0, 0.88889],
3556    "9133": [0.90001, 0, 0, 0, 0.88889],
3557    "9143": [0.88502, 0.915, 0, 0, 1.05556],
3558    "10216": [1.25003, 1.75, 0, 0, 0.80556],
3559    "10217": [1.25003, 1.75, 0, 0, 0.80556],
3560    "57344": [-0.00499, 0.605, 0, 0, 1.05556],
3561    "57345": [-0.00499, 0.605, 0, 0, 1.05556],
3562    "57680": [0, 0.12, 0, 0, 0.45],
3563    "57681": [0, 0.12, 0, 0, 0.45],
3564    "57682": [0, 0.12, 0, 0, 0.45],
3565    "57683": [0, 0.12, 0, 0, 0.45]
3566  },
3567  "Typewriter-Regular": {
3568    "32": [0, 0, 0, 0, 0.525],
3569    "33": [0, 0.61111, 0, 0, 0.525],
3570    "34": [0, 0.61111, 0, 0, 0.525],
3571    "35": [0, 0.61111, 0, 0, 0.525],
3572    "36": [0.08333, 0.69444, 0, 0, 0.525],
3573    "37": [0.08333, 0.69444, 0, 0, 0.525],
3574    "38": [0, 0.61111, 0, 0, 0.525],
3575    "39": [0, 0.61111, 0, 0, 0.525],
3576    "40": [0.08333, 0.69444, 0, 0, 0.525],
3577    "41": [0.08333, 0.69444, 0, 0, 0.525],
3578    "42": [0, 0.52083, 0, 0, 0.525],
3579    "43": [-0.08056, 0.53055, 0, 0, 0.525],
3580    "44": [0.13889, 0.125, 0, 0, 0.525],
3581    "45": [-0.08056, 0.53055, 0, 0, 0.525],
3582    "46": [0, 0.125, 0, 0, 0.525],
3583    "47": [0.08333, 0.69444, 0, 0, 0.525],
3584    "48": [0, 0.61111, 0, 0, 0.525],
3585    "49": [0, 0.61111, 0, 0, 0.525],
3586    "50": [0, 0.61111, 0, 0, 0.525],
3587    "51": [0, 0.61111, 0, 0, 0.525],
3588    "52": [0, 0.61111, 0, 0, 0.525],
3589    "53": [0, 0.61111, 0, 0, 0.525],
3590    "54": [0, 0.61111, 0, 0, 0.525],
3591    "55": [0, 0.61111, 0, 0, 0.525],
3592    "56": [0, 0.61111, 0, 0, 0.525],
3593    "57": [0, 0.61111, 0, 0, 0.525],
3594    "58": [0, 0.43056, 0, 0, 0.525],
3595    "59": [0.13889, 0.43056, 0, 0, 0.525],
3596    "60": [-0.05556, 0.55556, 0, 0, 0.525],
3597    "61": [-0.19549, 0.41562, 0, 0, 0.525],
3598    "62": [-0.05556, 0.55556, 0, 0, 0.525],
3599    "63": [0, 0.61111, 0, 0, 0.525],
3600    "64": [0, 0.61111, 0, 0, 0.525],
3601    "65": [0, 0.61111, 0, 0, 0.525],
3602    "66": [0, 0.61111, 0, 0, 0.525],
3603    "67": [0, 0.61111, 0, 0, 0.525],
3604    "68": [0, 0.61111, 0, 0, 0.525],
3605    "69": [0, 0.61111, 0, 0, 0.525],
3606    "70": [0, 0.61111, 0, 0, 0.525],
3607    "71": [0, 0.61111, 0, 0, 0.525],
3608    "72": [0, 0.61111, 0, 0, 0.525],
3609    "73": [0, 0.61111, 0, 0, 0.525],
3610    "74": [0, 0.61111, 0, 0, 0.525],
3611    "75": [0, 0.61111, 0, 0, 0.525],
3612    "76": [0, 0.61111, 0, 0, 0.525],
3613    "77": [0, 0.61111, 0, 0, 0.525],
3614    "78": [0, 0.61111, 0, 0, 0.525],
3615    "79": [0, 0.61111, 0, 0, 0.525],
3616    "80": [0, 0.61111, 0, 0, 0.525],
3617    "81": [0.13889, 0.61111, 0, 0, 0.525],
3618    "82": [0, 0.61111, 0, 0, 0.525],
3619    "83": [0, 0.61111, 0, 0, 0.525],
3620    "84": [0, 0.61111, 0, 0, 0.525],
3621    "85": [0, 0.61111, 0, 0, 0.525],
3622    "86": [0, 0.61111, 0, 0, 0.525],
3623    "87": [0, 0.61111, 0, 0, 0.525],
3624    "88": [0, 0.61111, 0, 0, 0.525],
3625    "89": [0, 0.61111, 0, 0, 0.525],
3626    "90": [0, 0.61111, 0, 0, 0.525],
3627    "91": [0.08333, 0.69444, 0, 0, 0.525],
3628    "92": [0.08333, 0.69444, 0, 0, 0.525],
3629    "93": [0.08333, 0.69444, 0, 0, 0.525],
3630    "94": [0, 0.61111, 0, 0, 0.525],
3631    "95": [0.09514, 0, 0, 0, 0.525],
3632    "96": [0, 0.61111, 0, 0, 0.525],
3633    "97": [0, 0.43056, 0, 0, 0.525],
3634    "98": [0, 0.61111, 0, 0, 0.525],
3635    "99": [0, 0.43056, 0, 0, 0.525],
3636    "100": [0, 0.61111, 0, 0, 0.525],
3637    "101": [0, 0.43056, 0, 0, 0.525],
3638    "102": [0, 0.61111, 0, 0, 0.525],
3639    "103": [0.22222, 0.43056, 0, 0, 0.525],
3640    "104": [0, 0.61111, 0, 0, 0.525],
3641    "105": [0, 0.61111, 0, 0, 0.525],
3642    "106": [0.22222, 0.61111, 0, 0, 0.525],
3643    "107": [0, 0.61111, 0, 0, 0.525],
3644    "108": [0, 0.61111, 0, 0, 0.525],
3645    "109": [0, 0.43056, 0, 0, 0.525],
3646    "110": [0, 0.43056, 0, 0, 0.525],
3647    "111": [0, 0.43056, 0, 0, 0.525],
3648    "112": [0.22222, 0.43056, 0, 0, 0.525],
3649    "113": [0.22222, 0.43056, 0, 0, 0.525],
3650    "114": [0, 0.43056, 0, 0, 0.525],
3651    "115": [0, 0.43056, 0, 0, 0.525],
3652    "116": [0, 0.55358, 0, 0, 0.525],
3653    "117": [0, 0.43056, 0, 0, 0.525],
3654    "118": [0, 0.43056, 0, 0, 0.525],
3655    "119": [0, 0.43056, 0, 0, 0.525],
3656    "120": [0, 0.43056, 0, 0, 0.525],
3657    "121": [0.22222, 0.43056, 0, 0, 0.525],
3658    "122": [0, 0.43056, 0, 0, 0.525],
3659    "123": [0.08333, 0.69444, 0, 0, 0.525],
3660    "124": [0.08333, 0.69444, 0, 0, 0.525],
3661    "125": [0.08333, 0.69444, 0, 0, 0.525],
3662    "126": [0, 0.61111, 0, 0, 0.525],
3663    "127": [0, 0.61111, 0, 0, 0.525],
3664    "160": [0, 0, 0, 0, 0.525],
3665    "176": [0, 0.61111, 0, 0, 0.525],
3666    "184": [0.19445, 0, 0, 0, 0.525],
3667    "305": [0, 0.43056, 0, 0, 0.525],
3668    "567": [0.22222, 0.43056, 0, 0, 0.525],
3669    "711": [0, 0.56597, 0, 0, 0.525],
3670    "713": [0, 0.56555, 0, 0, 0.525],
3671    "714": [0, 0.61111, 0, 0, 0.525],
3672    "715": [0, 0.61111, 0, 0, 0.525],
3673    "728": [0, 0.61111, 0, 0, 0.525],
3674    "730": [0, 0.61111, 0, 0, 0.525],
3675    "770": [0, 0.61111, 0, 0, 0.525],
3676    "771": [0, 0.61111, 0, 0, 0.525],
3677    "776": [0, 0.61111, 0, 0, 0.525],
3678    "915": [0, 0.61111, 0, 0, 0.525],
3679    "916": [0, 0.61111, 0, 0, 0.525],
3680    "920": [0, 0.61111, 0, 0, 0.525],
3681    "923": [0, 0.61111, 0, 0, 0.525],
3682    "926": [0, 0.61111, 0, 0, 0.525],
3683    "928": [0, 0.61111, 0, 0, 0.525],
3684    "931": [0, 0.61111, 0, 0, 0.525],
3685    "933": [0, 0.61111, 0, 0, 0.525],
3686    "934": [0, 0.61111, 0, 0, 0.525],
3687    "936": [0, 0.61111, 0, 0, 0.525],
3688    "937": [0, 0.61111, 0, 0, 0.525],
3689    "8216": [0, 0.61111, 0, 0, 0.525],
3690    "8217": [0, 0.61111, 0, 0, 0.525],
3691    "8242": [0, 0.61111, 0, 0, 0.525],
3692    "9251": [0.11111, 0.21944, 0, 0, 0.525]
3693  }
3694});
3695// CONCATENATED MODULE: ./src/fontMetrics.js
3696
3697
3698/**
3699 * This file contains metrics regarding fonts and individual symbols. The sigma
3700 * and xi variables, as well as the metricMap map contain data extracted from
3701 * TeX, TeX font metrics, and the TTF files. These data are then exposed via the
3702 * `metrics` variable and the getCharacterMetrics function.
3703 */
3704// In TeX, there are actually three sets of dimensions, one for each of
3705// textstyle (size index 5 and higher: >=9pt), scriptstyle (size index 3 and 4:
3706// 7-8pt), and scriptscriptstyle (size index 1 and 2: 5-6pt).  These are
3707// provided in the the arrays below, in that order.
3708//
3709// The font metrics are stored in fonts cmsy10, cmsy7, and cmsy5 respsectively.
3710// This was determined by running the following script:
3711//
3712//     latex -interaction=nonstopmode \
3713//     '\documentclass{article}\usepackage{amsmath}\begin{document}' \
3714//     '$a$ \expandafter\show\the\textfont2' \
3715//     '\expandafter\show\the\scriptfont2' \
3716//     '\expandafter\show\the\scriptscriptfont2' \
3717//     '\stop'
3718//
3719// The metrics themselves were retreived using the following commands:
3720//
3721//     tftopl cmsy10
3722//     tftopl cmsy7
3723//     tftopl cmsy5
3724//
3725// The output of each of these commands is quite lengthy.  The only part we
3726// care about is the FONTDIMEN section. Each value is measured in EMs.
3727var sigmasAndXis = {
3728  slant: [0.250, 0.250, 0.250],
3729  // sigma1
3730  space: [0.000, 0.000, 0.000],
3731  // sigma2
3732  stretch: [0.000, 0.000, 0.000],
3733  // sigma3
3734  shrink: [0.000, 0.000, 0.000],
3735  // sigma4
3736  xHeight: [0.431, 0.431, 0.431],
3737  // sigma5
3738  quad: [1.000, 1.171, 1.472],
3739  // sigma6
3740  extraSpace: [0.000, 0.000, 0.000],
3741  // sigma7
3742  num1: [0.677, 0.732, 0.925],
3743  // sigma8
3744  num2: [0.394, 0.384, 0.387],
3745  // sigma9
3746  num3: [0.444, 0.471, 0.504],
3747  // sigma10
3748  denom1: [0.686, 0.752, 1.025],
3749  // sigma11
3750  denom2: [0.345, 0.344, 0.532],
3751  // sigma12
3752  sup1: [0.413, 0.503, 0.504],
3753  // sigma13
3754  sup2: [0.363, 0.431, 0.404],
3755  // sigma14
3756  sup3: [0.289, 0.286, 0.294],
3757  // sigma15
3758  sub1: [0.150, 0.143, 0.200],
3759  // sigma16
3760  sub2: [0.247, 0.286, 0.400],
3761  // sigma17
3762  supDrop: [0.386, 0.353, 0.494],
3763  // sigma18
3764  subDrop: [0.050, 0.071, 0.100],
3765  // sigma19
3766  delim1: [2.390, 1.700, 1.980],
3767  // sigma20
3768  delim2: [1.010, 1.157, 1.420],
3769  // sigma21
3770  axisHeight: [0.250, 0.250, 0.250],
3771  // sigma22
3772  // These font metrics are extracted from TeX by using tftopl on cmex10.tfm;
3773  // they correspond to the font parameters of the extension fonts (family 3).
3774  // See the TeXbook, page 441. In AMSTeX, the extension fonts scale; to
3775  // match cmex7, we'd use cmex7.tfm values for script and scriptscript
3776  // values.
3777  defaultRuleThickness: [0.04, 0.049, 0.049],
3778  // xi8; cmex7: 0.049
3779  bigOpSpacing1: [0.111, 0.111, 0.111],
3780  // xi9
3781  bigOpSpacing2: [0.166, 0.166, 0.166],
3782  // xi10
3783  bigOpSpacing3: [0.2, 0.2, 0.2],
3784  // xi11
3785  bigOpSpacing4: [0.6, 0.611, 0.611],
3786  // xi12; cmex7: 0.611
3787  bigOpSpacing5: [0.1, 0.143, 0.143],
3788  // xi13; cmex7: 0.143
3789  // The \sqrt rule width is taken from the height of the surd character.
3790  // Since we use the same font at all sizes, this thickness doesn't scale.
3791  sqrtRuleThickness: [0.04, 0.04, 0.04],
3792  // This value determines how large a pt is, for metrics which are defined
3793  // in terms of pts.
3794  // This value is also used in katex.less; if you change it make sure the
3795  // values match.
3796  ptPerEm: [10.0, 10.0, 10.0],
3797  // The space between adjacent `|` columns in an array definition. From
3798  // `\showthe\doublerulesep` in LaTeX. Equals 2.0 / ptPerEm.
3799  doubleRuleSep: [0.2, 0.2, 0.2],
3800  // The width of separator lines in {array} environments. From
3801  // `\showthe\arrayrulewidth` in LaTeX. Equals 0.4 / ptPerEm.
3802  arrayRuleWidth: [0.04, 0.04, 0.04],
3803  // Two values from LaTeX source2e:
3804  fboxsep: [0.3, 0.3, 0.3],
3805  //        3 pt / ptPerEm
3806  fboxrule: [0.04, 0.04, 0.04] // 0.4 pt / ptPerEm
3807
3808}; // This map contains a mapping from font name and character code to character
3809// metrics, including height, depth, italic correction, and skew (kern from the
3810// character to the corresponding \skewchar)
3811// This map is generated via `make metrics`. It should not be changed manually.
3812
3813 // These are very rough approximations.  We default to Times New Roman which
3814// should have Latin-1 and Cyrillic characters, but may not depending on the
3815// operating system.  The metrics do not account for extra height from the
3816// accents.  In the case of Cyrillic characters which have both ascenders and
3817// descenders we prefer approximations with ascenders, primarily to prevent
3818// the fraction bar or root line from intersecting the glyph.
3819// TODO(kevinb) allow union of multiple glyph metrics for better accuracy.
3820
3821var extraCharacterMap = {
3822  // Latin-1
3823  'Å': 'A',
3824  'Ç': 'C',
3825  'Ð': 'D',
3826  'Þ': 'o',
3827  'å': 'a',
3828  'ç': 'c',
3829  'ð': 'd',
3830  'þ': 'o',
3831  // Cyrillic
3832  'А': 'A',
3833  'Б': 'B',
3834  'В': 'B',
3835  'Г': 'F',
3836  'Д': 'A',
3837  'Е': 'E',
3838  'Ж': 'K',
3839  'З': '3',
3840  'И': 'N',
3841  'Й': 'N',
3842  'К': 'K',
3843  'Л': 'N',
3844  'М': 'M',
3845  'Н': 'H',
3846  'О': 'O',
3847  'П': 'N',
3848  'Р': 'P',
3849  'С': 'C',
3850  'Т': 'T',
3851  'У': 'y',
3852  'Ф': 'O',
3853  'Х': 'X',
3854  'Ц': 'U',
3855  'Ч': 'h',
3856  'Ш': 'W',
3857  'Щ': 'W',
3858  'Ъ': 'B',
3859  'Ы': 'X',
3860  'Ь': 'B',
3861  'Э': '3',
3862  'Ю': 'X',
3863  'Я': 'R',
3864  'а': 'a',
3865  'б': 'b',
3866  'в': 'a',
3867  'г': 'r',
3868  'д': 'y',
3869  'е': 'e',
3870  'ж': 'm',
3871  'з': 'e',
3872  'и': 'n',
3873  'й': 'n',
3874  'к': 'n',
3875  'л': 'n',
3876  'м': 'm',
3877  'н': 'n',
3878  'о': 'o',
3879  'п': 'n',
3880  'р': 'p',
3881  'с': 'c',
3882  'т': 'o',
3883  'у': 'y',
3884  'ф': 'b',
3885  'х': 'x',
3886  'ц': 'n',
3887  'ч': 'n',
3888  'ш': 'w',
3889  'щ': 'w',
3890  'ъ': 'a',
3891  'ы': 'm',
3892  'ь': 'a',
3893  'э': 'e',
3894  'ю': 'm',
3895  'я': 'r'
3896};
3897
3898/**
3899 * This function adds new font metrics to default metricMap
3900 * It can also override existing metrics
3901 */
3902function setFontMetrics(fontName, metrics) {
3903  fontMetricsData[fontName] = metrics;
3904}
3905/**
3906 * This function is a convenience function for looking up information in the
3907 * metricMap table. It takes a character as a string, and a font.
3908 *
3909 * Note: the `width` property may be undefined if fontMetricsData.js wasn't
3910 * built using `Make extended_metrics`.
3911 */
3912
3913function getCharacterMetrics(character, font, mode) {
3914  if (!fontMetricsData[font]) {
3915    throw new Error("Font metrics not found for font: " + font + ".");
3916  }
3917
3918  var ch = character.charCodeAt(0);
3919  var metrics = fontMetricsData[font][ch];
3920
3921  if (!metrics && character[0] in extraCharacterMap) {
3922    ch = extraCharacterMap[character[0]].charCodeAt(0);
3923    metrics = fontMetricsData[font][ch];
3924  }
3925
3926  if (!metrics && mode === 'text') {
3927    // We don't typically have font metrics for Asian scripts.
3928    // But since we support them in text mode, we need to return
3929    // some sort of metrics.
3930    // So if the character is in a script we support but we
3931    // don't have metrics for it, just use the metrics for
3932    // the Latin capital letter M. This is close enough because
3933    // we (currently) only care about the height of the glpyh
3934    // not its width.
3935    if (supportedCodepoint(ch)) {
3936      metrics = fontMetricsData[font][77]; // 77 is the charcode for 'M'
3937    }
3938  }
3939
3940  if (metrics) {
3941    return {
3942      depth: metrics[0],
3943      height: metrics[1],
3944      italic: metrics[2],
3945      skew: metrics[3],
3946      width: metrics[4]
3947    };
3948  }
3949}
3950var fontMetricsBySizeIndex = {};
3951/**
3952 * Get the font metrics for a given size.
3953 */
3954
3955function getGlobalMetrics(size) {
3956  var sizeIndex;
3957
3958  if (size >= 5) {
3959    sizeIndex = 0;
3960  } else if (size >= 3) {
3961    sizeIndex = 1;
3962  } else {
3963    sizeIndex = 2;
3964  }
3965
3966  if (!fontMetricsBySizeIndex[sizeIndex]) {
3967    var metrics = fontMetricsBySizeIndex[sizeIndex] = {
3968      cssEmPerMu: sigmasAndXis.quad[sizeIndex] / 18
3969    };
3970
3971    for (var key in sigmasAndXis) {
3972      if (sigmasAndXis.hasOwnProperty(key)) {
3973        metrics[key] = sigmasAndXis[key][sizeIndex];
3974      }
3975    }
3976  }
3977
3978  return fontMetricsBySizeIndex[sizeIndex];
3979}
3980// CONCATENATED MODULE: ./src/symbols.js
3981/**
3982 * This file holds a list of all no-argument functions and single-character
3983 * symbols (like 'a' or ';').
3984 *
3985 * For each of the symbols, there are three properties they can have:
3986 * - font (required): the font to be used for this symbol. Either "main" (the
3987     normal font), or "ams" (the ams fonts).
3988 * - group (required): the ParseNode group type the symbol should have (i.e.
3989     "textord", "mathord", etc).
3990     See https://github.com/KaTeX/KaTeX/wiki/Examining-TeX#group-types
3991 * - replace: the character that this symbol or function should be
3992 *   replaced with (i.e. "\phi" has a replace value of "\u03d5", the phi
3993 *   character in the main font).
3994 *
3995 * The outermost map in the table indicates what mode the symbols should be
3996 * accepted in (e.g. "math" or "text").
3997 */
3998// Some of these have a "-token" suffix since these are also used as `ParseNode`
3999// types for raw text tokens, and we want to avoid conflicts with higher-level
4000// `ParseNode` types. These `ParseNode`s are constructed within `Parser` by
4001// looking up the `symbols` map.
4002var ATOMS = {
4003  "bin": 1,
4004  "close": 1,
4005  "inner": 1,
4006  "open": 1,
4007  "punct": 1,
4008  "rel": 1
4009};
4010var NON_ATOMS = {
4011  "accent-token": 1,
4012  "mathord": 1,
4013  "op-token": 1,
4014  "spacing": 1,
4015  "textord": 1
4016};
4017var symbols = {
4018  "math": {},
4019  "text": {}
4020};
4021/* harmony default export */ var src_symbols = (symbols);
4022/** `acceptUnicodeChar = true` is only applicable if `replace` is set. */
4023
4024function defineSymbol(mode, font, group, replace, name, acceptUnicodeChar) {
4025  symbols[mode][name] = {
4026    font: font,
4027    group: group,
4028    replace: replace
4029  };
4030
4031  if (acceptUnicodeChar && replace) {
4032    symbols[mode][replace] = symbols[mode][name];
4033  }
4034} // Some abbreviations for commonly used strings.
4035// This helps minify the code, and also spotting typos using jshint.
4036// modes:
4037
4038var symbols_math = "math";
4039var symbols_text = "text"; // fonts:
4040
4041var main = "main";
4042var ams = "ams"; // groups:
4043
4044var symbols_accent = "accent-token";
4045var bin = "bin";
4046var symbols_close = "close";
4047var symbols_inner = "inner";
4048var mathord = "mathord";
4049var op = "op-token";
4050var symbols_open = "open";
4051var punct = "punct";
4052var rel = "rel";
4053var symbols_spacing = "spacing";
4054var symbols_textord = "textord"; // Now comes the symbol table
4055// Relation Symbols
4056
4057defineSymbol(symbols_math, main, rel, "\u2261", "\\equiv", true);
4058defineSymbol(symbols_math, main, rel, "\u227A", "\\prec", true);
4059defineSymbol(symbols_math, main, rel, "\u227B", "\\succ", true);
4060defineSymbol(symbols_math, main, rel, "\u223C", "\\sim", true);
4061defineSymbol(symbols_math, main, rel, "\u22A5", "\\perp");
4062defineSymbol(symbols_math, main, rel, "\u2AAF", "\\preceq", true);
4063defineSymbol(symbols_math, main, rel, "\u2AB0", "\\succeq", true);
4064defineSymbol(symbols_math, main, rel, "\u2243", "\\simeq", true);
4065defineSymbol(symbols_math, main, rel, "\u2223", "\\mid", true);
4066defineSymbol(symbols_math, main, rel, "\u226A", "\\ll", true);
4067defineSymbol(symbols_math, main, rel, "\u226B", "\\gg", true);
4068defineSymbol(symbols_math, main, rel, "\u224D", "\\asymp", true);
4069defineSymbol(symbols_math, main, rel, "\u2225", "\\parallel");
4070defineSymbol(symbols_math, main, rel, "\u22C8", "\\bowtie", true);
4071defineSymbol(symbols_math, main, rel, "\u2323", "\\smile", true);
4072defineSymbol(symbols_math, main, rel, "\u2291", "\\sqsubseteq", true);
4073defineSymbol(symbols_math, main, rel, "\u2292", "\\sqsupseteq", true);
4074defineSymbol(symbols_math, main, rel, "\u2250", "\\doteq", true);
4075defineSymbol(symbols_math, main, rel, "\u2322", "\\frown", true);
4076defineSymbol(symbols_math, main, rel, "\u220B", "\\ni", true);
4077defineSymbol(symbols_math, main, rel, "\u221D", "\\propto", true);
4078defineSymbol(symbols_math, main, rel, "\u22A2", "\\vdash", true);
4079defineSymbol(symbols_math, main, rel, "\u22A3", "\\dashv", true);
4080defineSymbol(symbols_math, main, rel, "\u220B", "\\owns"); // Punctuation
4081
4082defineSymbol(symbols_math, main, punct, ".", "\\ldotp");
4083defineSymbol(symbols_math, main, punct, "\u22C5", "\\cdotp"); // Misc Symbols
4084
4085defineSymbol(symbols_math, main, symbols_textord, "#", "\\#");
4086defineSymbol(symbols_text, main, symbols_textord, "#", "\\#");
4087defineSymbol(symbols_math, main, symbols_textord, "&", "\\&");
4088defineSymbol(symbols_text, main, symbols_textord, "&", "\\&");
4089defineSymbol(symbols_math, main, symbols_textord, "\u2135", "\\aleph", true);
4090defineSymbol(symbols_math, main, symbols_textord, "\u2200", "\\forall", true);
4091defineSymbol(symbols_math, main, symbols_textord, "\u210F", "\\hbar", true);
4092defineSymbol(symbols_math, main, symbols_textord, "\u2203", "\\exists", true);
4093defineSymbol(symbols_math, main, symbols_textord, "\u2207", "\\nabla", true);
4094defineSymbol(symbols_math, main, symbols_textord, "\u266D", "\\flat", true);
4095defineSymbol(symbols_math, main, symbols_textord, "\u2113", "\\ell", true);
4096defineSymbol(symbols_math, main, symbols_textord, "\u266E", "\\natural", true);
4097defineSymbol(symbols_math, main, symbols_textord, "\u2663", "\\clubsuit", true);
4098defineSymbol(symbols_math, main, symbols_textord, "\u2118", "\\wp", true);
4099defineSymbol(symbols_math, main, symbols_textord, "\u266F", "\\sharp", true);
4100defineSymbol(symbols_math, main, symbols_textord, "\u2662", "\\diamondsuit", true);
4101defineSymbol(symbols_math, main, symbols_textord, "\u211C", "\\Re", true);
4102defineSymbol(symbols_math, main, symbols_textord, "\u2661", "\\heartsuit", true);
4103defineSymbol(symbols_math, main, symbols_textord, "\u2111", "\\Im", true);
4104defineSymbol(symbols_math, main, symbols_textord, "\u2660", "\\spadesuit", true);
4105defineSymbol(symbols_text, main, symbols_textord, "\xA7", "\\S", true);
4106defineSymbol(symbols_text, main, symbols_textord, "\xB6", "\\P", true); // Math and Text
4107
4108defineSymbol(symbols_math, main, symbols_textord, "\u2020", "\\dag");
4109defineSymbol(symbols_text, main, symbols_textord, "\u2020", "\\dag");
4110defineSymbol(symbols_text, main, symbols_textord, "\u2020", "\\textdagger");
4111defineSymbol(symbols_math, main, symbols_textord, "\u2021", "\\ddag");
4112defineSymbol(symbols_text, main, symbols_textord, "\u2021", "\\ddag");
4113defineSymbol(symbols_text, main, symbols_textord, "\u2021", "\\textdaggerdbl"); // Large Delimiters
4114
4115defineSymbol(symbols_math, main, symbols_close, "\u23B1", "\\rmoustache", true);
4116defineSymbol(symbols_math, main, symbols_open, "\u23B0", "\\lmoustache", true);
4117defineSymbol(symbols_math, main, symbols_close, "\u27EF", "\\rgroup", true);
4118defineSymbol(symbols_math, main, symbols_open, "\u27EE", "\\lgroup", true); // Binary Operators
4119
4120defineSymbol(symbols_math, main, bin, "\u2213", "\\mp", true);
4121defineSymbol(symbols_math, main, bin, "\u2296", "\\ominus", true);
4122defineSymbol(symbols_math, main, bin, "\u228E", "\\uplus", true);
4123defineSymbol(symbols_math, main, bin, "\u2293", "\\sqcap", true);
4124defineSymbol(symbols_math, main, bin, "\u2217", "\\ast");
4125defineSymbol(symbols_math, main, bin, "\u2294", "\\sqcup", true);
4126defineSymbol(symbols_math, main, bin, "\u25EF", "\\bigcirc");
4127defineSymbol(symbols_math, main, bin, "\u2219", "\\bullet");
4128defineSymbol(symbols_math, main, bin, "\u2021", "\\ddagger");
4129defineSymbol(symbols_math, main, bin, "\u2240", "\\wr", true);
4130defineSymbol(symbols_math, main, bin, "\u2A3F", "\\amalg");
4131defineSymbol(symbols_math, main, bin, "&", "\\And"); // from amsmath
4132// Arrow Symbols
4133
4134defineSymbol(symbols_math, main, rel, "\u27F5", "\\longleftarrow", true);
4135defineSymbol(symbols_math, main, rel, "\u21D0", "\\Leftarrow", true);
4136defineSymbol(symbols_math, main, rel, "\u27F8", "\\Longleftarrow", true);
4137defineSymbol(symbols_math, main, rel, "\u27F6", "\\longrightarrow", true);
4138defineSymbol(symbols_math, main, rel, "\u21D2", "\\Rightarrow", true);
4139defineSymbol(symbols_math, main, rel, "\u27F9", "\\Longrightarrow", true);
4140defineSymbol(symbols_math, main, rel, "\u2194", "\\leftrightarrow", true);
4141defineSymbol(symbols_math, main, rel, "\u27F7", "\\longleftrightarrow", true);
4142defineSymbol(symbols_math, main, rel, "\u21D4", "\\Leftrightarrow", true);
4143defineSymbol(symbols_math, main, rel, "\u27FA", "\\Longleftrightarrow", true);
4144defineSymbol(symbols_math, main, rel, "\u21A6", "\\mapsto", true);
4145defineSymbol(symbols_math, main, rel, "\u27FC", "\\longmapsto", true);
4146defineSymbol(symbols_math, main, rel, "\u2197", "\\nearrow", true);
4147defineSymbol(symbols_math, main, rel, "\u21A9", "\\hookleftarrow", true);
4148defineSymbol(symbols_math, main, rel, "\u21AA", "\\hookrightarrow", true);
4149defineSymbol(symbols_math, main, rel, "\u2198", "\\searrow", true);
4150defineSymbol(symbols_math, main, rel, "\u21BC", "\\leftharpoonup", true);
4151defineSymbol(symbols_math, main, rel, "\u21C0", "\\rightharpoonup", true);
4152defineSymbol(symbols_math, main, rel, "\u2199", "\\swarrow", true);
4153defineSymbol(symbols_math, main, rel, "\u21BD", "\\leftharpoondown", true);
4154defineSymbol(symbols_math, main, rel, "\u21C1", "\\rightharpoondown", true);
4155defineSymbol(symbols_math, main, rel, "\u2196", "\\nwarrow", true);
4156defineSymbol(symbols_math, main, rel, "\u21CC", "\\rightleftharpoons", true); // AMS Negated Binary Relations
4157
4158defineSymbol(symbols_math, ams, rel, "\u226E", "\\nless", true); // Symbol names preceeded by "@" each have a corresponding macro.
4159
4160defineSymbol(symbols_math, ams, rel, "\uE010", "\\@nleqslant");
4161defineSymbol(symbols_math, ams, rel, "\uE011", "\\@nleqq");
4162defineSymbol(symbols_math, ams, rel, "\u2A87", "\\lneq", true);
4163defineSymbol(symbols_math, ams, rel, "\u2268", "\\lneqq", true);
4164defineSymbol(symbols_math, ams, rel, "\uE00C", "\\@lvertneqq");
4165defineSymbol(symbols_math, ams, rel, "\u22E6", "\\lnsim", true);
4166defineSymbol(symbols_math, ams, rel, "\u2A89", "\\lnapprox", true);
4167defineSymbol(symbols_math, ams, rel, "\u2280", "\\nprec", true); // unicode-math maps \u22e0 to \npreccurlyeq. We'll use the AMS synonym.
4168
4169defineSymbol(symbols_math, ams, rel, "\u22E0", "\\npreceq", true);
4170defineSymbol(symbols_math, ams, rel, "\u22E8", "\\precnsim", true);
4171defineSymbol(symbols_math, ams, rel, "\u2AB9", "\\precnapprox", true);
4172defineSymbol(symbols_math, ams, rel, "\u2241", "\\nsim", true);
4173defineSymbol(symbols_math, ams, rel, "\uE006", "\\@nshortmid");
4174defineSymbol(symbols_math, ams, rel, "\u2224", "\\nmid", true);
4175defineSymbol(symbols_math, ams, rel, "\u22AC", "\\nvdash", true);
4176defineSymbol(symbols_math, ams, rel, "\u22AD", "\\nvDash", true);
4177defineSymbol(symbols_math, ams, rel, "\u22EA", "\\ntriangleleft");
4178defineSymbol(symbols_math, ams, rel, "\u22EC", "\\ntrianglelefteq", true);
4179defineSymbol(symbols_math, ams, rel, "\u228A", "\\subsetneq", true);
4180defineSymbol(symbols_math, ams, rel, "\uE01A", "\\@varsubsetneq");
4181defineSymbol(symbols_math, ams, rel, "\u2ACB", "\\subsetneqq", true);
4182defineSymbol(symbols_math, ams, rel, "\uE017", "\\@varsubsetneqq");
4183defineSymbol(symbols_math, ams, rel, "\u226F", "\\ngtr", true);
4184defineSymbol(symbols_math, ams, rel, "\uE00F", "\\@ngeqslant");
4185defineSymbol(symbols_math, ams, rel, "\uE00E", "\\@ngeqq");
4186defineSymbol(symbols_math, ams, rel, "\u2A88", "\\gneq", true);
4187defineSymbol(symbols_math, ams, rel, "\u2269", "\\gneqq", true);
4188defineSymbol(symbols_math, ams, rel, "\uE00D", "\\@gvertneqq");
4189defineSymbol(symbols_math, ams, rel, "\u22E7", "\\gnsim", true);
4190defineSymbol(symbols_math, ams, rel, "\u2A8A", "\\gnapprox", true);
4191defineSymbol(symbols_math, ams, rel, "\u2281", "\\nsucc", true); // unicode-math maps \u22e1 to \nsucccurlyeq. We'll use the AMS synonym.
4192
4193defineSymbol(symbols_math, ams, rel, "\u22E1", "\\nsucceq", true);
4194defineSymbol(symbols_math, ams, rel, "\u22E9", "\\succnsim", true);
4195defineSymbol(symbols_math, ams, rel, "\u2ABA", "\\succnapprox", true); // unicode-math maps \u2246 to \simneqq. We'll use the AMS synonym.
4196
4197defineSymbol(symbols_math, ams, rel, "\u2246", "\\ncong", true);
4198defineSymbol(symbols_math, ams, rel, "\uE007", "\\@nshortparallel");
4199defineSymbol(symbols_math, ams, rel, "\u2226", "\\nparallel", true);
4200defineSymbol(symbols_math, ams, rel, "\u22AF", "\\nVDash", true);
4201defineSymbol(symbols_math, ams, rel, "\u22EB", "\\ntriangleright");
4202defineSymbol(symbols_math, ams, rel, "\u22ED", "\\ntrianglerighteq", true);
4203defineSymbol(symbols_math, ams, rel, "\uE018", "\\@nsupseteqq");
4204defineSymbol(symbols_math, ams, rel, "\u228B", "\\supsetneq", true);
4205defineSymbol(symbols_math, ams, rel, "\uE01B", "\\@varsupsetneq");
4206defineSymbol(symbols_math, ams, rel, "\u2ACC", "\\supsetneqq", true);
4207defineSymbol(symbols_math, ams, rel, "\uE019", "\\@varsupsetneqq");
4208defineSymbol(symbols_math, ams, rel, "\u22AE", "\\nVdash", true);
4209defineSymbol(symbols_math, ams, rel, "\u2AB5", "\\precneqq", true);
4210defineSymbol(symbols_math, ams, rel, "\u2AB6", "\\succneqq", true);
4211defineSymbol(symbols_math, ams, rel, "\uE016", "\\@nsubseteqq");
4212defineSymbol(symbols_math, ams, bin, "\u22B4", "\\unlhd");
4213defineSymbol(symbols_math, ams, bin, "\u22B5", "\\unrhd"); // AMS Negated Arrows
4214
4215defineSymbol(symbols_math, ams, rel, "\u219A", "\\nleftarrow", true);
4216defineSymbol(symbols_math, ams, rel, "\u219B", "\\nrightarrow", true);
4217defineSymbol(symbols_math, ams, rel, "\u21CD", "\\nLeftarrow", true);
4218defineSymbol(symbols_math, ams, rel, "\u21CF", "\\nRightarrow", true);
4219defineSymbol(symbols_math, ams, rel, "\u21AE", "\\nleftrightarrow", true);
4220defineSymbol(symbols_math, ams, rel, "\u21CE", "\\nLeftrightarrow", true); // AMS Misc
4221
4222defineSymbol(symbols_math, ams, rel, "\u25B3", "\\vartriangle");
4223defineSymbol(symbols_math, ams, symbols_textord, "\u210F", "\\hslash");
4224defineSymbol(symbols_math, ams, symbols_textord, "\u25BD", "\\triangledown");
4225defineSymbol(symbols_math, ams, symbols_textord, "\u25CA", "\\lozenge");
4226defineSymbol(symbols_math, ams, symbols_textord, "\u24C8", "\\circledS");
4227defineSymbol(symbols_math, ams, symbols_textord, "\xAE", "\\circledR");
4228defineSymbol(symbols_text, ams, symbols_textord, "\xAE", "\\circledR");
4229defineSymbol(symbols_math, ams, symbols_textord, "\u2221", "\\measuredangle", true);
4230defineSymbol(symbols_math, ams, symbols_textord, "\u2204", "\\nexists");
4231defineSymbol(symbols_math, ams, symbols_textord, "\u2127", "\\mho");
4232defineSymbol(symbols_math, ams, symbols_textord, "\u2132", "\\Finv", true);
4233defineSymbol(symbols_math, ams, symbols_textord, "\u2141", "\\Game", true);
4234defineSymbol(symbols_math, ams, symbols_textord, "\u2035", "\\backprime");
4235defineSymbol(symbols_math, ams, symbols_textord, "\u25B2", "\\blacktriangle");
4236defineSymbol(symbols_math, ams, symbols_textord, "\u25BC", "\\blacktriangledown");
4237defineSymbol(symbols_math, ams, symbols_textord, "\u25A0", "\\blacksquare");
4238defineSymbol(symbols_math, ams, symbols_textord, "\u29EB", "\\blacklozenge");
4239defineSymbol(symbols_math, ams, symbols_textord, "\u2605", "\\bigstar");
4240defineSymbol(symbols_math, ams, symbols_textord, "\u2222", "\\sphericalangle", true);
4241defineSymbol(symbols_math, ams, symbols_textord, "\u2201", "\\complement", true); // unicode-math maps U+F0 (ð) to \matheth. We map to AMS function \eth
4242
4243defineSymbol(symbols_math, ams, symbols_textord, "\xF0", "\\eth", true);
4244defineSymbol(symbols_math, ams, symbols_textord, "\u2571", "\\diagup");
4245defineSymbol(symbols_math, ams, symbols_textord, "\u2572", "\\diagdown");
4246defineSymbol(symbols_math, ams, symbols_textord, "\u25A1", "\\square");
4247defineSymbol(symbols_math, ams, symbols_textord, "\u25A1", "\\Box");
4248defineSymbol(symbols_math, ams, symbols_textord, "\u25CA", "\\Diamond"); // unicode-math maps U+A5 to \mathyen. We map to AMS function \yen
4249
4250defineSymbol(symbols_math, ams, symbols_textord, "\xA5", "\\yen", true);
4251defineSymbol(symbols_text, ams, symbols_textord, "\xA5", "\\yen", true);
4252defineSymbol(symbols_math, ams, symbols_textord, "\u2713", "\\checkmark", true);
4253defineSymbol(symbols_text, ams, symbols_textord, "\u2713", "\\checkmark"); // AMS Hebrew
4254
4255defineSymbol(symbols_math, ams, symbols_textord, "\u2136", "\\beth", true);
4256defineSymbol(symbols_math, ams, symbols_textord, "\u2138", "\\daleth", true);
4257defineSymbol(symbols_math, ams, symbols_textord, "\u2137", "\\gimel", true); // AMS Greek
4258
4259defineSymbol(symbols_math, ams, symbols_textord, "\u03DD", "\\digamma", true);
4260defineSymbol(symbols_math, ams, symbols_textord, "\u03F0", "\\varkappa"); // AMS Delimiters
4261
4262defineSymbol(symbols_math, ams, symbols_open, "\u250C", "\\ulcorner", true);
4263defineSymbol(symbols_math, ams, symbols_close, "\u2510", "\\urcorner", true);
4264defineSymbol(symbols_math, ams, symbols_open, "\u2514", "\\llcorner", true);
4265defineSymbol(symbols_math, ams, symbols_close, "\u2518", "\\lrcorner", true); // AMS Binary Relations
4266
4267defineSymbol(symbols_math, ams, rel, "\u2266", "\\leqq", true);
4268defineSymbol(symbols_math, ams, rel, "\u2A7D", "\\leqslant", true);
4269defineSymbol(symbols_math, ams, rel, "\u2A95", "\\eqslantless", true);
4270defineSymbol(symbols_math, ams, rel, "\u2272", "\\lesssim", true);
4271defineSymbol(symbols_math, ams, rel, "\u2A85", "\\lessapprox", true);
4272defineSymbol(symbols_math, ams, rel, "\u224A", "\\approxeq", true);
4273defineSymbol(symbols_math, ams, bin, "\u22D6", "\\lessdot");
4274defineSymbol(symbols_math, ams, rel, "\u22D8", "\\lll", true);
4275defineSymbol(symbols_math, ams, rel, "\u2276", "\\lessgtr", true);
4276defineSymbol(symbols_math, ams, rel, "\u22DA", "\\lesseqgtr", true);
4277defineSymbol(symbols_math, ams, rel, "\u2A8B", "\\lesseqqgtr", true);
4278defineSymbol(symbols_math, ams, rel, "\u2251", "\\doteqdot");
4279defineSymbol(symbols_math, ams, rel, "\u2253", "\\risingdotseq", true);
4280defineSymbol(symbols_math, ams, rel, "\u2252", "\\fallingdotseq", true);
4281defineSymbol(symbols_math, ams, rel, "\u223D", "\\backsim", true);
4282defineSymbol(symbols_math, ams, rel, "\u22CD", "\\backsimeq", true);
4283defineSymbol(symbols_math, ams, rel, "\u2AC5", "\\subseteqq", true);
4284defineSymbol(symbols_math, ams, rel, "\u22D0", "\\Subset", true);
4285defineSymbol(symbols_math, ams, rel, "\u228F", "\\sqsubset", true);
4286defineSymbol(symbols_math, ams, rel, "\u227C", "\\preccurlyeq", true);
4287defineSymbol(symbols_math, ams, rel, "\u22DE", "\\curlyeqprec", true);
4288defineSymbol(symbols_math, ams, rel, "\u227E", "\\precsim", true);
4289defineSymbol(symbols_math, ams, rel, "\u2AB7", "\\precapprox", true);
4290defineSymbol(symbols_math, ams, rel, "\u22B2", "\\vartriangleleft");
4291defineSymbol(symbols_math, ams, rel, "\u22B4", "\\trianglelefteq");
4292defineSymbol(symbols_math, ams, rel, "\u22A8", "\\vDash", true);
4293defineSymbol(symbols_math, ams, rel, "\u22AA", "\\Vvdash", true);
4294defineSymbol(symbols_math, ams, rel, "\u2323", "\\smallsmile");
4295defineSymbol(symbols_math, ams, rel, "\u2322", "\\smallfrown");
4296defineSymbol(symbols_math, ams, rel, "\u224F", "\\bumpeq", true);
4297defineSymbol(symbols_math, ams, rel, "\u224E", "\\Bumpeq", true);
4298defineSymbol(symbols_math, ams, rel, "\u2267", "\\geqq", true);
4299defineSymbol(symbols_math, ams, rel, "\u2A7E", "\\geqslant", true);
4300defineSymbol(symbols_math, ams, rel, "\u2A96", "\\eqslantgtr", true);
4301defineSymbol(symbols_math, ams, rel, "\u2273", "\\gtrsim", true);
4302defineSymbol(symbols_math, ams, rel, "\u2A86", "\\gtrapprox", true);
4303defineSymbol(symbols_math, ams, bin, "\u22D7", "\\gtrdot");
4304defineSymbol(symbols_math, ams, rel, "\u22D9", "\\ggg", true);
4305defineSymbol(symbols_math, ams, rel, "\u2277", "\\gtrless", true);
4306defineSymbol(symbols_math, ams, rel, "\u22DB", "\\gtreqless", true);
4307defineSymbol(symbols_math, ams, rel, "\u2A8C", "\\gtreqqless", true);
4308defineSymbol(symbols_math, ams, rel, "\u2256", "\\eqcirc", true);
4309defineSymbol(symbols_math, ams, rel, "\u2257", "\\circeq", true);
4310defineSymbol(symbols_math, ams, rel, "\u225C", "\\triangleq", true);
4311defineSymbol(symbols_math, ams, rel, "\u223C", "\\thicksim");
4312defineSymbol(symbols_math, ams, rel, "\u2248", "\\thickapprox");
4313defineSymbol(symbols_math, ams, rel, "\u2AC6", "\\supseteqq", true);
4314defineSymbol(symbols_math, ams, rel, "\u22D1", "\\Supset", true);
4315defineSymbol(symbols_math, ams, rel, "\u2290", "\\sqsupset", true);
4316defineSymbol(symbols_math, ams, rel, "\u227D", "\\succcurlyeq", true);
4317defineSymbol(symbols_math, ams, rel, "\u22DF", "\\curlyeqsucc", true);
4318defineSymbol(symbols_math, ams, rel, "\u227F", "\\succsim", true);
4319defineSymbol(symbols_math, ams, rel, "\u2AB8", "\\succapprox", true);
4320defineSymbol(symbols_math, ams, rel, "\u22B3", "\\vartriangleright");
4321defineSymbol(symbols_math, ams, rel, "\u22B5", "\\trianglerighteq");
4322defineSymbol(symbols_math, ams, rel, "\u22A9", "\\Vdash", true);
4323defineSymbol(symbols_math, ams, rel, "\u2223", "\\shortmid");
4324defineSymbol(symbols_math, ams, rel, "\u2225", "\\shortparallel");
4325defineSymbol(symbols_math, ams, rel, "\u226C", "\\between", true);
4326defineSymbol(symbols_math, ams, rel, "\u22D4", "\\pitchfork", true);
4327defineSymbol(symbols_math, ams, rel, "\u221D", "\\varpropto");
4328defineSymbol(symbols_math, ams, rel, "\u25C0", "\\blacktriangleleft"); // unicode-math says that \therefore is a mathord atom.
4329// We kept the amssymb atom type, which is rel.
4330
4331defineSymbol(symbols_math, ams, rel, "\u2234", "\\therefore", true);
4332defineSymbol(symbols_math, ams, rel, "\u220D", "\\backepsilon");
4333defineSymbol(symbols_math, ams, rel, "\u25B6", "\\blacktriangleright"); // unicode-math says that \because is a mathord atom.
4334// We kept the amssymb atom type, which is rel.
4335
4336defineSymbol(symbols_math, ams, rel, "\u2235", "\\because", true);
4337defineSymbol(symbols_math, ams, rel, "\u22D8", "\\llless");
4338defineSymbol(symbols_math, ams, rel, "\u22D9", "\\gggtr");
4339defineSymbol(symbols_math, ams, bin, "\u22B2", "\\lhd");
4340defineSymbol(symbols_math, ams, bin, "\u22B3", "\\rhd");
4341defineSymbol(symbols_math, ams, rel, "\u2242", "\\eqsim", true);
4342defineSymbol(symbols_math, main, rel, "\u22C8", "\\Join");
4343defineSymbol(symbols_math, ams, rel, "\u2251", "\\Doteq", true); // AMS Binary Operators
4344
4345defineSymbol(symbols_math, ams, bin, "\u2214", "\\dotplus", true);
4346defineSymbol(symbols_math, ams, bin, "\u2216", "\\smallsetminus");
4347defineSymbol(symbols_math, ams, bin, "\u22D2", "\\Cap", true);
4348defineSymbol(symbols_math, ams, bin, "\u22D3", "\\Cup", true);
4349defineSymbol(symbols_math, ams, bin, "\u2A5E", "\\doublebarwedge", true);
4350defineSymbol(symbols_math, ams, bin, "\u229F", "\\boxminus", true);
4351defineSymbol(symbols_math, ams, bin, "\u229E", "\\boxplus", true);
4352defineSymbol(symbols_math, ams, bin, "\u22C7", "\\divideontimes", true);
4353defineSymbol(symbols_math, ams, bin, "\u22C9", "\\ltimes", true);
4354defineSymbol(symbols_math, ams, bin, "\u22CA", "\\rtimes", true);
4355defineSymbol(symbols_math, ams, bin, "\u22CB", "\\leftthreetimes", true);
4356defineSymbol(symbols_math, ams, bin, "\u22CC", "\\rightthreetimes", true);
4357defineSymbol(symbols_math, ams, bin, "\u22CF", "\\curlywedge", true);
4358defineSymbol(symbols_math, ams, bin, "\u22CE", "\\curlyvee", true);
4359defineSymbol(symbols_math, ams, bin, "\u229D", "\\circleddash", true);
4360defineSymbol(symbols_math, ams, bin, "\u229B", "\\circledast", true);
4361defineSymbol(symbols_math, ams, bin, "\u22C5", "\\centerdot");
4362defineSymbol(symbols_math, ams, bin, "\u22BA", "\\intercal", true);
4363defineSymbol(symbols_math, ams, bin, "\u22D2", "\\doublecap");
4364defineSymbol(symbols_math, ams, bin, "\u22D3", "\\doublecup");
4365defineSymbol(symbols_math, ams, bin, "\u22A0", "\\boxtimes", true); // AMS Arrows
4366// Note: unicode-math maps \u21e2 to their own function \rightdasharrow.
4367// We'll map it to AMS function \dashrightarrow. It produces the same atom.
4368
4369defineSymbol(symbols_math, ams, rel, "\u21E2", "\\dashrightarrow", true); // unicode-math maps \u21e0 to \leftdasharrow. We'll use the AMS synonym.
4370
4371defineSymbol(symbols_math, ams, rel, "\u21E0", "\\dashleftarrow", true);
4372defineSymbol(symbols_math, ams, rel, "\u21C7", "\\leftleftarrows", true);
4373defineSymbol(symbols_math, ams, rel, "\u21C6", "\\leftrightarrows", true);
4374defineSymbol(symbols_math, ams, rel, "\u21DA", "\\Lleftarrow", true);
4375defineSymbol(symbols_math, ams, rel, "\u219E", "\\twoheadleftarrow", true);
4376defineSymbol(symbols_math, ams, rel, "\u21A2", "\\leftarrowtail", true);
4377defineSymbol(symbols_math, ams, rel, "\u21AB", "\\looparrowleft", true);
4378defineSymbol(symbols_math, ams, rel, "\u21CB", "\\leftrightharpoons", true);
4379defineSymbol(symbols_math, ams, rel, "\u21B6", "\\curvearrowleft", true); // unicode-math maps \u21ba to \acwopencirclearrow. We'll use the AMS synonym.
4380
4381defineSymbol(symbols_math, ams, rel, "\u21BA", "\\circlearrowleft", true);
4382defineSymbol(symbols_math, ams, rel, "\u21B0", "\\Lsh", true);
4383defineSymbol(symbols_math, ams, rel, "\u21C8", "\\upuparrows", true);
4384defineSymbol(symbols_math, ams, rel, "\u21BF", "\\upharpoonleft", true);
4385defineSymbol(symbols_math, ams, rel, "\u21C3", "\\downharpoonleft", true);
4386defineSymbol(symbols_math, ams, rel, "\u22B8", "\\multimap", true);
4387defineSymbol(symbols_math, ams, rel, "\u21AD", "\\leftrightsquigarrow", true);
4388defineSymbol(symbols_math, ams, rel, "\u21C9", "\\rightrightarrows", true);
4389defineSymbol(symbols_math, ams, rel, "\u21C4", "\\rightleftarrows", true);
4390defineSymbol(symbols_math, ams, rel, "\u21A0", "\\twoheadrightarrow", true);
4391defineSymbol(symbols_math, ams, rel, "\u21A3", "\\rightarrowtail", true);
4392defineSymbol(symbols_math, ams, rel, "\u21AC", "\\looparrowright", true);
4393defineSymbol(symbols_math, ams, rel, "\u21B7", "\\curvearrowright", true); // unicode-math maps \u21bb to \cwopencirclearrow. We'll use the AMS synonym.
4394
4395defineSymbol(symbols_math, ams, rel, "\u21BB", "\\circlearrowright", true);
4396defineSymbol(symbols_math, ams, rel, "\u21B1", "\\Rsh", true);
4397defineSymbol(symbols_math, ams, rel, "\u21CA", "\\downdownarrows", true);
4398defineSymbol(symbols_math, ams, rel, "\u21BE", "\\upharpoonright", true);
4399defineSymbol(symbols_math, ams, rel, "\u21C2", "\\downharpoonright", true);
4400defineSymbol(symbols_math, ams, rel, "\u21DD", "\\rightsquigarrow", true);
4401defineSymbol(symbols_math, ams, rel, "\u21DD", "\\leadsto");
4402defineSymbol(symbols_math, ams, rel, "\u21DB", "\\Rrightarrow", true);
4403defineSymbol(symbols_math, ams, rel, "\u21BE", "\\restriction");
4404defineSymbol(symbols_math, main, symbols_textord, "\u2018", "`");
4405defineSymbol(symbols_math, main, symbols_textord, "$", "\\$");
4406defineSymbol(symbols_text, main, symbols_textord, "$", "\\$");
4407defineSymbol(symbols_text, main, symbols_textord, "$", "\\textdollar");
4408defineSymbol(symbols_math, main, symbols_textord, "%", "\\%");
4409defineSymbol(symbols_text, main, symbols_textord, "%", "\\%");
4410defineSymbol(symbols_math, main, symbols_textord, "_", "\\_");
4411defineSymbol(symbols_text, main, symbols_textord, "_", "\\_");
4412defineSymbol(symbols_text, main, symbols_textord, "_", "\\textunderscore");
4413defineSymbol(symbols_math, main, symbols_textord, "\u2220", "\\angle", true);
4414defineSymbol(symbols_math, main, symbols_textord, "\u221E", "\\infty", true);
4415defineSymbol(symbols_math, main, symbols_textord, "\u2032", "\\prime");
4416defineSymbol(symbols_math, main, symbols_textord, "\u25B3", "\\triangle");
4417defineSymbol(symbols_math, main, symbols_textord, "\u0393", "\\Gamma", true);
4418defineSymbol(symbols_math, main, symbols_textord, "\u0394", "\\Delta", true);
4419defineSymbol(symbols_math, main, symbols_textord, "\u0398", "\\Theta", true);
4420defineSymbol(symbols_math, main, symbols_textord, "\u039B", "\\Lambda", true);
4421defineSymbol(symbols_math, main, symbols_textord, "\u039E", "\\Xi", true);
4422defineSymbol(symbols_math, main, symbols_textord, "\u03A0", "\\Pi", true);
4423defineSymbol(symbols_math, main, symbols_textord, "\u03A3", "\\Sigma", true);
4424defineSymbol(symbols_math, main, symbols_textord, "\u03A5", "\\Upsilon", true);
4425defineSymbol(symbols_math, main, symbols_textord, "\u03A6", "\\Phi", true);
4426defineSymbol(symbols_math, main, symbols_textord, "\u03A8", "\\Psi", true);
4427defineSymbol(symbols_math, main, symbols_textord, "\u03A9", "\\Omega", true);
4428defineSymbol(symbols_math, main, symbols_textord, "A", "\u0391");
4429defineSymbol(symbols_math, main, symbols_textord, "B", "\u0392");
4430defineSymbol(symbols_math, main, symbols_textord, "E", "\u0395");
4431defineSymbol(symbols_math, main, symbols_textord, "Z", "\u0396");
4432defineSymbol(symbols_math, main, symbols_textord, "H", "\u0397");
4433defineSymbol(symbols_math, main, symbols_textord, "I", "\u0399");
4434defineSymbol(symbols_math, main, symbols_textord, "K", "\u039A");
4435defineSymbol(symbols_math, main, symbols_textord, "M", "\u039C");
4436defineSymbol(symbols_math, main, symbols_textord, "N", "\u039D");
4437defineSymbol(symbols_math, main, symbols_textord, "O", "\u039F");
4438defineSymbol(symbols_math, main, symbols_textord, "P", "\u03A1");
4439defineSymbol(symbols_math, main, symbols_textord, "T", "\u03A4");
4440defineSymbol(symbols_math, main, symbols_textord, "X", "\u03A7");
4441defineSymbol(symbols_math, main, symbols_textord, "\xAC", "\\neg", true);
4442defineSymbol(symbols_math, main, symbols_textord, "\xAC", "\\lnot");
4443defineSymbol(symbols_math, main, symbols_textord, "\u22A4", "\\top");
4444defineSymbol(symbols_math, main, symbols_textord, "\u22A5", "\\bot");
4445defineSymbol(symbols_math, main, symbols_textord, "\u2205", "\\emptyset");
4446defineSymbol(symbols_math, ams, symbols_textord, "\u2205", "\\varnothing");
4447defineSymbol(symbols_math, main, mathord, "\u03B1", "\\alpha", true);
4448defineSymbol(symbols_math, main, mathord, "\u03B2", "\\beta", true);
4449defineSymbol(symbols_math, main, mathord, "\u03B3", "\\gamma", true);
4450defineSymbol(symbols_math, main, mathord, "\u03B4", "\\delta", true);
4451defineSymbol(symbols_math, main, mathord, "\u03F5", "\\epsilon", true);
4452defineSymbol(symbols_math, main, mathord, "\u03B6", "\\zeta", true);
4453defineSymbol(symbols_math, main, mathord, "\u03B7", "\\eta", true);
4454defineSymbol(symbols_math, main, mathord, "\u03B8", "\\theta", true);
4455defineSymbol(symbols_math, main, mathord, "\u03B9", "\\iota", true);
4456defineSymbol(symbols_math, main, mathord, "\u03BA", "\\kappa", true);
4457defineSymbol(symbols_math, main, mathord, "\u03BB", "\\lambda", true);
4458defineSymbol(symbols_math, main, mathord, "\u03BC", "\\mu", true);
4459defineSymbol(symbols_math, main, mathord, "\u03BD", "\\nu", true);
4460defineSymbol(symbols_math, main, mathord, "\u03BE", "\\xi", true);
4461defineSymbol(symbols_math, main, mathord, "\u03BF", "\\omicron", true);
4462defineSymbol(symbols_math, main, mathord, "\u03C0", "\\pi", true);
4463defineSymbol(symbols_math, main, mathord, "\u03C1", "\\rho", true);
4464defineSymbol(symbols_math, main, mathord, "\u03C3", "\\sigma", true);
4465defineSymbol(symbols_math, main, mathord, "\u03C4", "\\tau", true);
4466defineSymbol(symbols_math, main, mathord, "\u03C5", "\\upsilon", true);
4467defineSymbol(symbols_math, main, mathord, "\u03D5", "\\phi", true);
4468defineSymbol(symbols_math, main, mathord, "\u03C7", "\\chi", true);
4469defineSymbol(symbols_math, main, mathord, "\u03C8", "\\psi", true);
4470defineSymbol(symbols_math, main, mathord, "\u03C9", "\\omega", true);
4471defineSymbol(symbols_math, main, mathord, "\u03B5", "\\varepsilon", true);
4472defineSymbol(symbols_math, main, mathord, "\u03D1", "\\vartheta", true);
4473defineSymbol(symbols_math, main, mathord, "\u03D6", "\\varpi", true);
4474defineSymbol(symbols_math, main, mathord, "\u03F1", "\\varrho", true);
4475defineSymbol(symbols_math, main, mathord, "\u03C2", "\\varsigma", true);
4476defineSymbol(symbols_math, main, mathord, "\u03C6", "\\varphi", true);
4477defineSymbol(symbols_math, main, bin, "\u2217", "*");
4478defineSymbol(symbols_math, main, bin, "+", "+");
4479defineSymbol(symbols_math, main, bin, "\u2212", "-");
4480defineSymbol(symbols_math, main, bin, "\u22C5", "\\cdot", true);
4481defineSymbol(symbols_math, main, bin, "\u2218", "\\circ");
4482defineSymbol(symbols_math, main, bin, "\xF7", "\\div", true);
4483defineSymbol(symbols_math, main, bin, "\xB1", "\\pm", true);
4484defineSymbol(symbols_math, main, bin, "\xD7", "\\times", true);
4485defineSymbol(symbols_math, main, bin, "\u2229", "\\cap", true);
4486defineSymbol(symbols_math, main, bin, "\u222A", "\\cup", true);
4487defineSymbol(symbols_math, main, bin, "\u2216", "\\setminus");
4488defineSymbol(symbols_math, main, bin, "\u2227", "\\land");
4489defineSymbol(symbols_math, main, bin, "\u2228", "\\lor");
4490defineSymbol(symbols_math, main, bin, "\u2227", "\\wedge", true);
4491defineSymbol(symbols_math, main, bin, "\u2228", "\\vee", true);
4492defineSymbol(symbols_math, main, symbols_textord, "\u221A", "\\surd");
4493defineSymbol(symbols_math, main, symbols_open, "(", "(");
4494defineSymbol(symbols_math, main, symbols_open, "[", "[");
4495defineSymbol(symbols_math, main, symbols_open, "\u27E8", "\\langle", true);
4496defineSymbol(symbols_math, main, symbols_open, "\u2223", "\\lvert");
4497defineSymbol(symbols_math, main, symbols_open, "\u2225", "\\lVert");
4498defineSymbol(symbols_math, main, symbols_close, ")", ")");
4499defineSymbol(symbols_math, main, symbols_close, "]", "]");
4500defineSymbol(symbols_math, main, symbols_close, "?", "?");
4501defineSymbol(symbols_math, main, symbols_close, "!", "!");
4502defineSymbol(symbols_math, main, symbols_close, "\u27E9", "\\rangle", true);
4503defineSymbol(symbols_math, main, symbols_close, "\u2223", "\\rvert");
4504defineSymbol(symbols_math, main, symbols_close, "\u2225", "\\rVert");
4505defineSymbol(symbols_math, main, rel, "=", "=");
4506defineSymbol(symbols_math, main, rel, "<", "<");
4507defineSymbol(symbols_math, main, rel, ">", ">");
4508defineSymbol(symbols_math, main, rel, ":", ":");
4509defineSymbol(symbols_math, main, rel, "\u2248", "\\approx", true);
4510defineSymbol(symbols_math, main, rel, "\u2245", "\\cong", true);
4511defineSymbol(symbols_math, main, rel, "\u2265", "\\ge");
4512defineSymbol(symbols_math, main, rel, "\u2265", "\\geq", true);
4513defineSymbol(symbols_math, main, rel, "\u2190", "\\gets");
4514defineSymbol(symbols_math, main, rel, ">", "\\gt");
4515defineSymbol(symbols_math, main, rel, "\u2208", "\\in", true);
4516defineSymbol(symbols_math, main, rel, "\uE020", "\\@not");
4517defineSymbol(symbols_math, main, rel, "\u2282", "\\subset", true);
4518defineSymbol(symbols_math, main, rel, "\u2283", "\\supset", true);
4519defineSymbol(symbols_math, main, rel, "\u2286", "\\subseteq", true);
4520defineSymbol(symbols_math, main, rel, "\u2287", "\\supseteq", true);
4521defineSymbol(symbols_math, ams, rel, "\u2288", "\\nsubseteq", true);
4522defineSymbol(symbols_math, ams, rel, "\u2289", "\\nsupseteq", true);
4523defineSymbol(symbols_math, main, rel, "\u22A8", "\\models");
4524defineSymbol(symbols_math, main, rel, "\u2190", "\\leftarrow", true);
4525defineSymbol(symbols_math, main, rel, "\u2264", "\\le");
4526defineSymbol(symbols_math, main, rel, "\u2264", "\\leq", true);
4527defineSymbol(symbols_math, main, rel, "<", "\\lt");
4528defineSymbol(symbols_math, main, rel, "\u2192", "\\rightarrow", true);
4529defineSymbol(symbols_math, main, rel, "\u2192", "\\to");
4530defineSymbol(symbols_math, ams, rel, "\u2271", "\\ngeq", true);
4531defineSymbol(symbols_math, ams, rel, "\u2270", "\\nleq", true);
4532defineSymbol(symbols_math, main, symbols_spacing, "\xA0", "\\ ");
4533defineSymbol(symbols_math, main, symbols_spacing, "\xA0", "~");
4534defineSymbol(symbols_math, main, symbols_spacing, "\xA0", "\\space"); // Ref: LaTeX Source 2e: \DeclareRobustCommand{\nobreakspace}{%
4535
4536defineSymbol(symbols_math, main, symbols_spacing, "\xA0", "\\nobreakspace");
4537defineSymbol(symbols_text, main, symbols_spacing, "\xA0", "\\ ");
4538defineSymbol(symbols_text, main, symbols_spacing, "\xA0", "~");
4539defineSymbol(symbols_text, main, symbols_spacing, "\xA0", "\\space");
4540defineSymbol(symbols_text, main, symbols_spacing, "\xA0", "\\nobreakspace");
4541defineSymbol(symbols_math, main, symbols_spacing, null, "\\nobreak");
4542defineSymbol(symbols_math, main, symbols_spacing, null, "\\allowbreak");
4543defineSymbol(symbols_math, main, punct, ",", ",");
4544defineSymbol(symbols_math, main, punct, ";", ";");
4545defineSymbol(symbols_math, ams, bin, "\u22BC", "\\barwedge", true);
4546defineSymbol(symbols_math, ams, bin, "\u22BB", "\\veebar", true);
4547defineSymbol(symbols_math, main, bin, "\u2299", "\\odot", true);
4548defineSymbol(symbols_math, main, bin, "\u2295", "\\oplus", true);
4549defineSymbol(symbols_math, main, bin, "\u2297", "\\otimes", true);
4550defineSymbol(symbols_math, main, symbols_textord, "\u2202", "\\partial", true);
4551defineSymbol(symbols_math, main, bin, "\u2298", "\\oslash", true);
4552defineSymbol(symbols_math, ams, bin, "\u229A", "\\circledcirc", true);
4553defineSymbol(symbols_math, ams, bin, "\u22A1", "\\boxdot", true);
4554defineSymbol(symbols_math, main, bin, "\u25B3", "\\bigtriangleup");
4555defineSymbol(symbols_math, main, bin, "\u25BD", "\\bigtriangledown");
4556defineSymbol(symbols_math, main, bin, "\u2020", "\\dagger");
4557defineSymbol(symbols_math, main, bin, "\u22C4", "\\diamond");
4558defineSymbol(symbols_math, main, bin, "\u22C6", "\\star");
4559defineSymbol(symbols_math, main, bin, "\u25C3", "\\triangleleft");
4560defineSymbol(symbols_math, main, bin, "\u25B9", "\\triangleright");
4561defineSymbol(symbols_math, main, symbols_open, "{", "\\{");
4562defineSymbol(symbols_text, main, symbols_textord, "{", "\\{");
4563defineSymbol(symbols_text, main, symbols_textord, "{", "\\textbraceleft");
4564defineSymbol(symbols_math, main, symbols_close, "}", "\\}");
4565defineSymbol(symbols_text, main, symbols_textord, "}", "\\}");
4566defineSymbol(symbols_text, main, symbols_textord, "}", "\\textbraceright");
4567defineSymbol(symbols_math, main, symbols_open, "{", "\\lbrace");
4568defineSymbol(symbols_math, main, symbols_close, "}", "\\rbrace");
4569defineSymbol(symbols_math, main, symbols_open, "[", "\\lbrack");
4570defineSymbol(symbols_text, main, symbols_textord, "[", "\\lbrack");
4571defineSymbol(symbols_math, main, symbols_close, "]", "\\rbrack");
4572defineSymbol(symbols_text, main, symbols_textord, "]", "\\rbrack");
4573defineSymbol(symbols_math, main, symbols_open, "(", "\\lparen");
4574defineSymbol(symbols_math, main, symbols_close, ")", "\\rparen");
4575defineSymbol(symbols_text, main, symbols_textord, "<", "\\textless"); // in T1 fontenc
4576
4577defineSymbol(symbols_text, main, symbols_textord, ">", "\\textgreater"); // in T1 fontenc
4578
4579defineSymbol(symbols_math, main, symbols_open, "\u230A", "\\lfloor", true);
4580defineSymbol(symbols_math, main, symbols_close, "\u230B", "\\rfloor", true);
4581defineSymbol(symbols_math, main, symbols_open, "\u2308", "\\lceil", true);
4582defineSymbol(symbols_math, main, symbols_close, "\u2309", "\\rceil", true);
4583defineSymbol(symbols_math, main, symbols_textord, "\\", "\\backslash");
4584defineSymbol(symbols_math, main, symbols_textord, "\u2223", "|");
4585defineSymbol(symbols_math, main, symbols_textord, "\u2223", "\\vert");
4586defineSymbol(symbols_text, main, symbols_textord, "|", "\\textbar"); // in T1 fontenc
4587
4588defineSymbol(symbols_math, main, symbols_textord, "\u2225", "\\|");
4589defineSymbol(symbols_math, main, symbols_textord, "\u2225", "\\Vert");
4590defineSymbol(symbols_text, main, symbols_textord, "\u2225", "\\textbardbl");
4591defineSymbol(symbols_text, main, symbols_textord, "~", "\\textasciitilde");
4592defineSymbol(symbols_text, main, symbols_textord, "\\", "\\textbackslash");
4593defineSymbol(symbols_text, main, symbols_textord, "^", "\\textasciicircum");
4594defineSymbol(symbols_math, main, rel, "\u2191", "\\uparrow", true);
4595defineSymbol(symbols_math, main, rel, "\u21D1", "\\Uparrow", true);
4596defineSymbol(symbols_math, main, rel, "\u2193", "\\downarrow", true);
4597defineSymbol(symbols_math, main, rel, "\u21D3", "\\Downarrow", true);
4598defineSymbol(symbols_math, main, rel, "\u2195", "\\updownarrow", true);
4599defineSymbol(symbols_math, main, rel, "\u21D5", "\\Updownarrow", true);
4600defineSymbol(symbols_math, main, op, "\u2210", "\\coprod");
4601defineSymbol(symbols_math, main, op, "\u22C1", "\\bigvee");
4602defineSymbol(symbols_math, main, op, "\u22C0", "\\bigwedge");
4603defineSymbol(symbols_math, main, op, "\u2A04", "\\biguplus");
4604defineSymbol(symbols_math, main, op, "\u22C2", "\\bigcap");
4605defineSymbol(symbols_math, main, op, "\u22C3", "\\bigcup");
4606defineSymbol(symbols_math, main, op, "\u222B", "\\int");
4607defineSymbol(symbols_math, main, op, "\u222B", "\\intop");
4608defineSymbol(symbols_math, main, op, "\u222C", "\\iint");
4609defineSymbol(symbols_math, main, op, "\u222D", "\\iiint");
4610defineSymbol(symbols_math, main, op, "\u220F", "\\prod");
4611defineSymbol(symbols_math, main, op, "\u2211", "\\sum");
4612defineSymbol(symbols_math, main, op, "\u2A02", "\\bigotimes");
4613defineSymbol(symbols_math, main, op, "\u2A01", "\\bigoplus");
4614defineSymbol(symbols_math, main, op, "\u2A00", "\\bigodot");
4615defineSymbol(symbols_math, main, op, "\u222E", "\\oint");
4616defineSymbol(symbols_math, main, op, "\u222F", "\\oiint");
4617defineSymbol(symbols_math, main, op, "\u2230", "\\oiiint");
4618defineSymbol(symbols_math, main, op, "\u2A06", "\\bigsqcup");
4619defineSymbol(symbols_math, main, op, "\u222B", "\\smallint");
4620defineSymbol(symbols_text, main, symbols_inner, "\u2026", "\\textellipsis");
4621defineSymbol(symbols_math, main, symbols_inner, "\u2026", "\\mathellipsis");
4622defineSymbol(symbols_text, main, symbols_inner, "\u2026", "\\ldots", true);
4623defineSymbol(symbols_math, main, symbols_inner, "\u2026", "\\ldots", true);
4624defineSymbol(symbols_math, main, symbols_inner, "\u22EF", "\\@cdots", true);
4625defineSymbol(symbols_math, main, symbols_inner, "\u22F1", "\\ddots", true);
4626defineSymbol(symbols_math, main, symbols_textord, "\u22EE", "\\varvdots"); // \vdots is a macro
4627
4628defineSymbol(symbols_math, main, symbols_accent, "\u02CA", "\\acute");
4629defineSymbol(symbols_math, main, symbols_accent, "\u02CB", "\\grave");
4630defineSymbol(symbols_math, main, symbols_accent, "\xA8", "\\ddot");
4631defineSymbol(symbols_math, main, symbols_accent, "~", "\\tilde");
4632defineSymbol(symbols_math, main, symbols_accent, "\u02C9", "\\bar");
4633defineSymbol(symbols_math, main, symbols_accent, "\u02D8", "\\breve");
4634defineSymbol(symbols_math, main, symbols_accent, "\u02C7", "\\check");
4635defineSymbol(symbols_math, main, symbols_accent, "^", "\\hat");
4636defineSymbol(symbols_math, main, symbols_accent, "\u20D7", "\\vec");
4637defineSymbol(symbols_math, main, symbols_accent, "\u02D9", "\\dot");
4638defineSymbol(symbols_math, main, symbols_accent, "\u02DA", "\\mathring");
4639defineSymbol(symbols_math, main, mathord, "\u0131", "\\imath", true);
4640defineSymbol(symbols_math, main, mathord, "\u0237", "\\jmath", true);
4641defineSymbol(symbols_text, main, symbols_textord, "\u0131", "\\i", true);
4642defineSymbol(symbols_text, main, symbols_textord, "\u0237", "\\j", true);
4643defineSymbol(symbols_text, main, symbols_textord, "\xDF", "\\ss", true);
4644defineSymbol(symbols_text, main, symbols_textord, "\xE6", "\\ae", true);
4645defineSymbol(symbols_text, main, symbols_textord, "\xE6", "\\ae", true);
4646defineSymbol(symbols_text, main, symbols_textord, "\u0153", "\\oe", true);
4647defineSymbol(symbols_text, main, symbols_textord, "\xF8", "\\o", true);
4648defineSymbol(symbols_text, main, symbols_textord, "\xC6", "\\AE", true);
4649defineSymbol(symbols_text, main, symbols_textord, "\u0152", "\\OE", true);
4650defineSymbol(symbols_text, main, symbols_textord, "\xD8", "\\O", true);
4651defineSymbol(symbols_text, main, symbols_accent, "\u02CA", "\\'"); // acute
4652
4653defineSymbol(symbols_text, main, symbols_accent, "\u02CB", "\\`"); // grave
4654
4655defineSymbol(symbols_text, main, symbols_accent, "\u02C6", "\\^"); // circumflex
4656
4657defineSymbol(symbols_text, main, symbols_accent, "\u02DC", "\\~"); // tilde
4658
4659defineSymbol(symbols_text, main, symbols_accent, "\u02C9", "\\="); // macron
4660
4661defineSymbol(symbols_text, main, symbols_accent, "\u02D8", "\\u"); // breve
4662
4663defineSymbol(symbols_text, main, symbols_accent, "\u02D9", "\\."); // dot above
4664
4665defineSymbol(symbols_text, main, symbols_accent, "\u02DA", "\\r"); // ring above
4666
4667defineSymbol(symbols_text, main, symbols_accent, "\u02C7", "\\v"); // caron
4668
4669defineSymbol(symbols_text, main, symbols_accent, "\xA8", '\\"'); // diaresis
4670
4671defineSymbol(symbols_text, main, symbols_accent, "\u02DD", "\\H"); // double acute
4672
4673defineSymbol(symbols_text, main, symbols_accent, "\u25EF", "\\textcircled"); // \bigcirc glyph
4674// These ligatures are detected and created in Parser.js's `formLigatures`.
4675
4676var ligatures = {
4677  "--": true,
4678  "---": true,
4679  "``": true,
4680  "''": true
4681};
4682defineSymbol(symbols_text, main, symbols_textord, "\u2013", "--");
4683defineSymbol(symbols_text, main, symbols_textord, "\u2013", "\\textendash");
4684defineSymbol(symbols_text, main, symbols_textord, "\u2014", "---");
4685defineSymbol(symbols_text, main, symbols_textord, "\u2014", "\\textemdash");
4686defineSymbol(symbols_text, main, symbols_textord, "\u2018", "`");
4687defineSymbol(symbols_text, main, symbols_textord, "\u2018", "\\textquoteleft");
4688defineSymbol(symbols_text, main, symbols_textord, "\u2019", "'");
4689defineSymbol(symbols_text, main, symbols_textord, "\u2019", "\\textquoteright");
4690defineSymbol(symbols_text, main, symbols_textord, "\u201C", "``");
4691defineSymbol(symbols_text, main, symbols_textord, "\u201C", "\\textquotedblleft");
4692defineSymbol(symbols_text, main, symbols_textord, "\u201D", "''");
4693defineSymbol(symbols_text, main, symbols_textord, "\u201D", "\\textquotedblright"); //  \degree from gensymb package
4694
4695defineSymbol(symbols_math, main, symbols_textord, "\xB0", "\\degree", true);
4696defineSymbol(symbols_text, main, symbols_textord, "\xB0", "\\degree"); // \textdegree from inputenc package
4697
4698defineSymbol(symbols_text, main, symbols_textord, "\xB0", "\\textdegree", true); // TODO: In LaTeX, \pounds can generate a different character in text and math
4699// mode, but among our fonts, only Main-Italic defines this character "163".
4700
4701defineSymbol(symbols_math, main, mathord, "\xA3", "\\pounds");
4702defineSymbol(symbols_math, main, mathord, "\xA3", "\\mathsterling", true);
4703defineSymbol(symbols_text, main, mathord, "\xA3", "\\pounds");
4704defineSymbol(symbols_text, main, mathord, "\xA3", "\\textsterling", true);
4705defineSymbol(symbols_math, ams, symbols_textord, "\u2720", "\\maltese");
4706defineSymbol(symbols_text, ams, symbols_textord, "\u2720", "\\maltese");
4707defineSymbol(symbols_text, main, symbols_spacing, "\xA0", "\\ ");
4708defineSymbol(symbols_text, main, symbols_spacing, "\xA0", " ");
4709defineSymbol(symbols_text, main, symbols_spacing, "\xA0", "~"); // There are lots of symbols which are the same, so we add them in afterwards.
4710// All of these are textords in math mode
4711
4712var mathTextSymbols = "0123456789/@.\"";
4713
4714for (var symbols_i = 0; symbols_i < mathTextSymbols.length; symbols_i++) {
4715  var symbols_ch = mathTextSymbols.charAt(symbols_i);
4716  defineSymbol(symbols_math, main, symbols_textord, symbols_ch, symbols_ch);
4717} // All of these are textords in text mode
4718
4719
4720var textSymbols = "0123456789!@*()-=+[]<>|\";:?/.,";
4721
4722for (var src_symbols_i = 0; src_symbols_i < textSymbols.length; src_symbols_i++) {
4723  var _ch = textSymbols.charAt(src_symbols_i);
4724
4725  defineSymbol(symbols_text, main, symbols_textord, _ch, _ch);
4726} // All of these are textords in text mode, and mathords in math mode
4727
4728
4729var letters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
4730
4731for (var symbols_i2 = 0; symbols_i2 < letters.length; symbols_i2++) {
4732  var _ch2 = letters.charAt(symbols_i2);
4733
4734  defineSymbol(symbols_math, main, mathord, _ch2, _ch2);
4735  defineSymbol(symbols_text, main, symbols_textord, _ch2, _ch2);
4736} // Blackboard bold and script letters in Unicode range
4737
4738
4739defineSymbol(symbols_math, ams, symbols_textord, "C", "\u2102"); // blackboard bold
4740
4741defineSymbol(symbols_text, ams, symbols_textord, "C", "\u2102");
4742defineSymbol(symbols_math, ams, symbols_textord, "H", "\u210D");
4743defineSymbol(symbols_text, ams, symbols_textord, "H", "\u210D");
4744defineSymbol(symbols_math, ams, symbols_textord, "N", "\u2115");
4745defineSymbol(symbols_text, ams, symbols_textord, "N", "\u2115");
4746defineSymbol(symbols_math, ams, symbols_textord, "P", "\u2119");
4747defineSymbol(symbols_text, ams, symbols_textord, "P", "\u2119");
4748defineSymbol(symbols_math, ams, symbols_textord, "Q", "\u211A");
4749defineSymbol(symbols_text, ams, symbols_textord, "Q", "\u211A");
4750defineSymbol(symbols_math, ams, symbols_textord, "R", "\u211D");
4751defineSymbol(symbols_text, ams, symbols_textord, "R", "\u211D");
4752defineSymbol(symbols_math, ams, symbols_textord, "Z", "\u2124");
4753defineSymbol(symbols_text, ams, symbols_textord, "Z", "\u2124");
4754defineSymbol(symbols_math, main, mathord, "h", "\u210E"); // italic h, Planck constant
4755
4756defineSymbol(symbols_text, main, mathord, "h", "\u210E"); // The next loop loads wide (surrogate pair) characters.
4757// We support some letters in the Unicode range U+1D400 to U+1D7FF,
4758// Mathematical Alphanumeric Symbols.
4759// Some editors do not deal well with wide characters. So don't write the
4760// string into this file. Instead, create the string from the surrogate pair.
4761
4762var symbols_wideChar = "";
4763
4764for (var symbols_i3 = 0; symbols_i3 < letters.length; symbols_i3++) {
4765  var _ch3 = letters.charAt(symbols_i3); // The hex numbers in the next line are a surrogate pair.
4766  // 0xD835 is the high surrogate for all letters in the range we support.
4767  // 0xDC00 is the low surrogate for bold A.
4768
4769
4770  symbols_wideChar = String.fromCharCode(0xD835, 0xDC00 + symbols_i3); // A-Z a-z bold
4771
4772  defineSymbol(symbols_math, main, mathord, _ch3, symbols_wideChar);
4773  defineSymbol(symbols_text, main, symbols_textord, _ch3, symbols_wideChar);
4774  symbols_wideChar = String.fromCharCode(0xD835, 0xDC34 + symbols_i3); // A-Z a-z italic
4775
4776  defineSymbol(symbols_math, main, mathord, _ch3, symbols_wideChar);
4777  defineSymbol(symbols_text, main, symbols_textord, _ch3, symbols_wideChar);
4778  symbols_wideChar = String.fromCharCode(0xD835, 0xDC68 + symbols_i3); // A-Z a-z bold italic
4779
4780  defineSymbol(symbols_math, main, mathord, _ch3, symbols_wideChar);
4781  defineSymbol(symbols_text, main, symbols_textord, _ch3, symbols_wideChar);
4782  symbols_wideChar = String.fromCharCode(0xD835, 0xDD04 + symbols_i3); // A-Z a-z Fractur
4783
4784  defineSymbol(symbols_math, main, mathord, _ch3, symbols_wideChar);
4785  defineSymbol(symbols_text, main, symbols_textord, _ch3, symbols_wideChar);
4786  symbols_wideChar = String.fromCharCode(0xD835, 0xDDA0 + symbols_i3); // A-Z a-z sans-serif
4787
4788  defineSymbol(symbols_math, main, mathord, _ch3, symbols_wideChar);
4789  defineSymbol(symbols_text, main, symbols_textord, _ch3, symbols_wideChar);
4790  symbols_wideChar = String.fromCharCode(0xD835, 0xDDD4 + symbols_i3); // A-Z a-z sans bold
4791
4792  defineSymbol(symbols_math, main, mathord, _ch3, symbols_wideChar);
4793  defineSymbol(symbols_text, main, symbols_textord, _ch3, symbols_wideChar);
4794  symbols_wideChar = String.fromCharCode(0xD835, 0xDE08 + symbols_i3); // A-Z a-z sans italic
4795
4796  defineSymbol(symbols_math, main, mathord, _ch3, symbols_wideChar);
4797  defineSymbol(symbols_text, main, symbols_textord, _ch3, symbols_wideChar);
4798  symbols_wideChar = String.fromCharCode(0xD835, 0xDE70 + symbols_i3); // A-Z a-z monospace
4799
4800  defineSymbol(symbols_math, main, mathord, _ch3, symbols_wideChar);
4801  defineSymbol(symbols_text, main, symbols_textord, _ch3, symbols_wideChar);
4802
4803  if (symbols_i3 < 26) {
4804    // KaTeX fonts have only capital letters for blackboard bold and script.
4805    // See exception for k below.
4806    symbols_wideChar = String.fromCharCode(0xD835, 0xDD38 + symbols_i3); // A-Z double struck
4807
4808    defineSymbol(symbols_math, main, mathord, _ch3, symbols_wideChar);
4809    defineSymbol(symbols_text, main, symbols_textord, _ch3, symbols_wideChar);
4810    symbols_wideChar = String.fromCharCode(0xD835, 0xDC9C + symbols_i3); // A-Z script
4811
4812    defineSymbol(symbols_math, main, mathord, _ch3, symbols_wideChar);
4813    defineSymbol(symbols_text, main, symbols_textord, _ch3, symbols_wideChar);
4814  } // TODO: Add bold script when it is supported by a KaTeX font.
4815
4816} // "k" is the only double struck lower case letter in the KaTeX fonts.
4817
4818
4819symbols_wideChar = String.fromCharCode(0xD835, 0xDD5C); // k double struck
4820
4821defineSymbol(symbols_math, main, mathord, "k", symbols_wideChar);
4822defineSymbol(symbols_text, main, symbols_textord, "k", symbols_wideChar); // Next, some wide character numerals
4823
4824for (var symbols_i4 = 0; symbols_i4 < 10; symbols_i4++) {
4825  var _ch4 = symbols_i4.toString();
4826
4827  symbols_wideChar = String.fromCharCode(0xD835, 0xDFCE + symbols_i4); // 0-9 bold
4828
4829  defineSymbol(symbols_math, main, mathord, _ch4, symbols_wideChar);
4830  defineSymbol(symbols_text, main, symbols_textord, _ch4, symbols_wideChar);
4831  symbols_wideChar = String.fromCharCode(0xD835, 0xDFE2 + symbols_i4); // 0-9 sans serif
4832
4833  defineSymbol(symbols_math, main, mathord, _ch4, symbols_wideChar);
4834  defineSymbol(symbols_text, main, symbols_textord, _ch4, symbols_wideChar);
4835  symbols_wideChar = String.fromCharCode(0xD835, 0xDFEC + symbols_i4); // 0-9 bold sans
4836
4837  defineSymbol(symbols_math, main, mathord, _ch4, symbols_wideChar);
4838  defineSymbol(symbols_text, main, symbols_textord, _ch4, symbols_wideChar);
4839  symbols_wideChar = String.fromCharCode(0xD835, 0xDFF6 + symbols_i4); // 0-9 monospace
4840
4841  defineSymbol(symbols_math, main, mathord, _ch4, symbols_wideChar);
4842  defineSymbol(symbols_text, main, symbols_textord, _ch4, symbols_wideChar);
4843} // We add these Latin-1 letters as symbols for backwards-compatibility,
4844// but they are not actually in the font, nor are they supported by the
4845// Unicode accent mechanism, so they fall back to Times font and look ugly.
4846// TODO(edemaine): Fix this.
4847
4848
4849var extraLatin = "ÇÐÞçþ";
4850
4851for (var _i5 = 0; _i5 < extraLatin.length; _i5++) {
4852  var _ch5 = extraLatin.charAt(_i5);
4853
4854  defineSymbol(symbols_math, main, mathord, _ch5, _ch5);
4855  defineSymbol(symbols_text, main, symbols_textord, _ch5, _ch5);
4856}
4857
4858defineSymbol(symbols_text, main, symbols_textord, "ð", "ð"); // Unicode versions of existing characters
4859
4860defineSymbol(symbols_text, main, symbols_textord, "\u2013", "–");
4861defineSymbol(symbols_text, main, symbols_textord, "\u2014", "—");
4862defineSymbol(symbols_text, main, symbols_textord, "\u2018", "‘");
4863defineSymbol(symbols_text, main, symbols_textord, "\u2019", "’");
4864defineSymbol(symbols_text, main, symbols_textord, "\u201C", "“");
4865defineSymbol(symbols_text, main, symbols_textord, "\u201D", "”");
4866// CONCATENATED MODULE: ./src/wide-character.js
4867/**
4868 * This file provides support for Unicode range U+1D400 to U+1D7FF,
4869 * Mathematical Alphanumeric Symbols.
4870 *
4871 * Function wideCharacterFont takes a wide character as input and returns
4872 * the font information necessary to render it properly.
4873 */
4874
4875/**
4876 * Data below is from https://www.unicode.org/charts/PDF/U1D400.pdf
4877 * That document sorts characters into groups by font type, say bold or italic.
4878 *
4879 * In the arrays below, each subarray consists three elements:
4880 *      * The CSS class of that group when in math mode.
4881 *      * The CSS class of that group when in text mode.
4882 *      * The font name, so that KaTeX can get font metrics.
4883 */
4884
4885var wideLatinLetterData = [["mathbf", "textbf", "Main-Bold"], // A-Z bold upright
4886["mathbf", "textbf", "Main-Bold"], // a-z bold upright
4887["mathdefault", "textit", "Math-Italic"], // A-Z italic
4888["mathdefault", "textit", "Math-Italic"], // a-z italic
4889["boldsymbol", "boldsymbol", "Main-BoldItalic"], // A-Z bold italic
4890["boldsymbol", "boldsymbol", "Main-BoldItalic"], // a-z bold italic
4891// Map fancy A-Z letters to script, not calligraphic.
4892// This aligns with unicode-math and math fonts (except Cambria Math).
4893["mathscr", "textscr", "Script-Regular"], // A-Z script
4894["", "", ""], // a-z script.  No font
4895["", "", ""], // A-Z bold script. No font
4896["", "", ""], // a-z bold script. No font
4897["mathfrak", "textfrak", "Fraktur-Regular"], // A-Z Fraktur
4898["mathfrak", "textfrak", "Fraktur-Regular"], // a-z Fraktur
4899["mathbb", "textbb", "AMS-Regular"], // A-Z double-struck
4900["mathbb", "textbb", "AMS-Regular"], // k double-struck
4901["", "", ""], // A-Z bold Fraktur No font metrics
4902["", "", ""], // a-z bold Fraktur.   No font.
4903["mathsf", "textsf", "SansSerif-Regular"], // A-Z sans-serif
4904["mathsf", "textsf", "SansSerif-Regular"], // a-z sans-serif
4905["mathboldsf", "textboldsf", "SansSerif-Bold"], // A-Z bold sans-serif
4906["mathboldsf", "textboldsf", "SansSerif-Bold"], // a-z bold sans-serif
4907["mathitsf", "textitsf", "SansSerif-Italic"], // A-Z italic sans-serif
4908["mathitsf", "textitsf", "SansSerif-Italic"], // a-z italic sans-serif
4909["", "", ""], // A-Z bold italic sans. No font
4910["", "", ""], // a-z bold italic sans. No font
4911["mathtt", "texttt", "Typewriter-Regular"], // A-Z monospace
4912["mathtt", "texttt", "Typewriter-Regular"]];
4913var wideNumeralData = [["mathbf", "textbf", "Main-Bold"], // 0-9 bold
4914["", "", ""], // 0-9 double-struck. No KaTeX font.
4915["mathsf", "textsf", "SansSerif-Regular"], // 0-9 sans-serif
4916["mathboldsf", "textboldsf", "SansSerif-Bold"], // 0-9 bold sans-serif
4917["mathtt", "texttt", "Typewriter-Regular"]];
4918var wide_character_wideCharacterFont = function wideCharacterFont(wideChar, mode) {
4919  // IE doesn't support codePointAt(). So work with the surrogate pair.
4920  var H = wideChar.charCodeAt(0); // high surrogate
4921
4922  var L = wideChar.charCodeAt(1); // low surrogate
4923
4924  var codePoint = (H - 0xD800) * 0x400 + (L - 0xDC00) + 0x10000;
4925  var j = mode === "math" ? 0 : 1; // column index for CSS class.
4926
4927  if (0x1D400 <= codePoint && codePoint < 0x1D6A4) {
4928    // wideLatinLetterData contains exactly 26 chars on each row.
4929    // So we can calculate the relevant row. No traverse necessary.
4930    var i = Math.floor((codePoint - 0x1D400) / 26);
4931    return [wideLatinLetterData[i][2], wideLatinLetterData[i][j]];
4932  } else if (0x1D7CE <= codePoint && codePoint <= 0x1D7FF) {
4933    // Numerals, ten per row.
4934    var _i = Math.floor((codePoint - 0x1D7CE) / 10);
4935
4936    return [wideNumeralData[_i][2], wideNumeralData[_i][j]];
4937  } else if (codePoint === 0x1D6A5 || codePoint === 0x1D6A6) {
4938    // dotless i or j
4939    return [wideLatinLetterData[0][2], wideLatinLetterData[0][j]];
4940  } else if (0x1D6A6 < codePoint && codePoint < 0x1D7CE) {
4941    // Greek letters. Not supported, yet.
4942    return ["", ""];
4943  } else {
4944    // We don't support any wide characters outside 1D400–1D7FF.
4945    throw new src_ParseError("Unsupported character: " + wideChar);
4946  }
4947};
4948// CONCATENATED MODULE: ./src/Options.js
4949/**
4950 * This file contains information about the options that the Parser carries
4951 * around with it while parsing. Data is held in an `Options` object, and when
4952 * recursing, a new `Options` object can be created with the `.with*` and
4953 * `.reset` functions.
4954 */
4955
4956var sizeStyleMap = [// Each element contains [textsize, scriptsize, scriptscriptsize].
4957// The size mappings are taken from TeX with \normalsize=10pt.
4958[1, 1, 1], // size1: [5, 5, 5]              \tiny
4959[2, 1, 1], // size2: [6, 5, 5]
4960[3, 1, 1], // size3: [7, 5, 5]              \scriptsize
4961[4, 2, 1], // size4: [8, 6, 5]              \footnotesize
4962[5, 2, 1], // size5: [9, 6, 5]              \small
4963[6, 3, 1], // size6: [10, 7, 5]             \normalsize
4964[7, 4, 2], // size7: [12, 8, 6]             \large
4965[8, 6, 3], // size8: [14.4, 10, 7]          \Large
4966[9, 7, 6], // size9: [17.28, 12, 10]        \LARGE
4967[10, 8, 7], // size10: [20.74, 14.4, 12]     \huge
4968[11, 10, 9]];
4969var sizeMultipliers = [// fontMetrics.js:getGlobalMetrics also uses size indexes, so if
4970// you change size indexes, change that function.
49710.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.2, 1.44, 1.728, 2.074, 2.488];
4972
4973var sizeAtStyle = function sizeAtStyle(size, style) {
4974  return style.size < 2 ? size : sizeStyleMap[size - 1][style.size - 1];
4975}; // In these types, "" (empty string) means "no change".
4976
4977
4978/**
4979 * This is the main options class. It contains the current style, size, color,
4980 * and font.
4981 *
4982 * Options objects should not be modified. To create a new Options with
4983 * different properties, call a `.having*` method.
4984 */
4985var Options_Options =
4986/*#__PURE__*/
4987function () {
4988  // A font family applies to a group of fonts (i.e. SansSerif), while a font
4989  // represents a specific font (i.e. SansSerif Bold).
4990  // See: https://tex.stackexchange.com/questions/22350/difference-between-textrm-and-mathrm
4991
4992  /**
4993   * The base size index.
4994   */
4995  function Options(data) {
4996    this.style = void 0;
4997    this.color = void 0;
4998    this.size = void 0;
4999    this.textSize = void 0;
5000    this.phantom = void 0;
5001    this.font = void 0;
5002    this.fontFamily = void 0;
5003    this.fontWeight = void 0;
5004    this.fontShape = void 0;
5005    this.sizeMultiplier = void 0;
5006    this.maxSize = void 0;
5007    this.minRuleThickness = void 0;
5008    this._fontMetrics = void 0;
5009    this.style = data.style;
5010    this.color = data.color;
5011    this.size = data.size || Options.BASESIZE;
5012    this.textSize = data.textSize || this.size;
5013    this.phantom = !!data.phantom;
5014    this.font = data.font || "";
5015    this.fontFamily = data.fontFamily || "";
5016    this.fontWeight = data.fontWeight || '';
5017    this.fontShape = data.fontShape || '';
5018    this.sizeMultiplier = sizeMultipliers[this.size - 1];
5019    this.maxSize = data.maxSize;
5020    this.minRuleThickness = data.minRuleThickness;
5021    this._fontMetrics = undefined;
5022  }
5023  /**
5024   * Returns a new options object with the same properties as "this".  Properties
5025   * from "extension" will be copied to the new options object.
5026   */
5027
5028
5029  var _proto = Options.prototype;
5030
5031  _proto.extend = function extend(extension) {
5032    var data = {
5033      style: this.style,
5034      size: this.size,
5035      textSize: this.textSize,
5036      color: this.color,
5037      phantom: this.phantom,
5038      font: this.font,
5039      fontFamily: this.fontFamily,
5040      fontWeight: this.fontWeight,
5041      fontShape: this.fontShape,
5042      maxSize: this.maxSize,
5043      minRuleThickness: this.minRuleThickness
5044    };
5045
5046    for (var key in extension) {
5047      if (extension.hasOwnProperty(key)) {
5048        data[key] = extension[key];
5049      }
5050    }
5051
5052    return new Options(data);
5053  }
5054  /**
5055   * Return an options object with the given style. If `this.style === style`,
5056   * returns `this`.
5057   */
5058  ;
5059
5060  _proto.havingStyle = function havingStyle(style) {
5061    if (this.style === style) {
5062      return this;
5063    } else {
5064      return this.extend({
5065        style: style,
5066        size: sizeAtStyle(this.textSize, style)
5067      });
5068    }
5069  }
5070  /**
5071   * Return an options object with a cramped version of the current style. If
5072   * the current style is cramped, returns `this`.
5073   */
5074  ;
5075
5076  _proto.havingCrampedStyle = function havingCrampedStyle() {
5077    return this.havingStyle(this.style.cramp());
5078  }
5079  /**
5080   * Return an options object with the given size and in at least `\textstyle`.
5081   * Returns `this` if appropriate.
5082   */
5083  ;
5084
5085  _proto.havingSize = function havingSize(size) {
5086    if (this.size === size && this.textSize === size) {
5087      return this;
5088    } else {
5089      return this.extend({
5090        style: this.style.text(),
5091        size: size,
5092        textSize: size,
5093        sizeMultiplier: sizeMultipliers[size - 1]
5094      });
5095    }
5096  }
5097  /**
5098   * Like `this.havingSize(BASESIZE).havingStyle(style)`. If `style` is omitted,
5099   * changes to at least `\textstyle`.
5100   */
5101  ;
5102
5103  _proto.havingBaseStyle = function havingBaseStyle(style) {
5104    style = style || this.style.text();
5105    var wantSize = sizeAtStyle(Options.BASESIZE, style);
5106
5107    if (this.size === wantSize && this.textSize === Options.BASESIZE && this.style === style) {
5108      return this;
5109    } else {
5110      return this.extend({
5111        style: style,
5112        size: wantSize
5113      });
5114    }
5115  }
5116  /**
5117   * Remove the effect of sizing changes such as \Huge.
5118   * Keep the effect of the current style, such as \scriptstyle.
5119   */
5120  ;
5121
5122  _proto.havingBaseSizing = function havingBaseSizing() {
5123    var size;
5124
5125    switch (this.style.id) {
5126      case 4:
5127      case 5:
5128        size = 3; // normalsize in scriptstyle
5129
5130        break;
5131
5132      case 6:
5133      case 7:
5134        size = 1; // normalsize in scriptscriptstyle
5135
5136        break;
5137
5138      default:
5139        size = 6;
5140      // normalsize in textstyle or displaystyle
5141    }
5142
5143    return this.extend({
5144      style: this.style.text(),
5145      size: size
5146    });
5147  }
5148  /**
5149   * Create a new options object with the given color.
5150   */
5151  ;
5152
5153  _proto.withColor = function withColor(color) {
5154    return this.extend({
5155      color: color
5156    });
5157  }
5158  /**
5159   * Create a new options object with "phantom" set to true.
5160   */
5161  ;
5162
5163  _proto.withPhantom = function withPhantom() {
5164    return this.extend({
5165      phantom: true
5166    });
5167  }
5168  /**
5169   * Creates a new options object with the given math font or old text font.
5170   * @type {[type]}
5171   */
5172  ;
5173
5174  _proto.withFont = function withFont(font) {
5175    return this.extend({
5176      font: font
5177    });
5178  }
5179  /**
5180   * Create a new options objects with the given fontFamily.
5181   */
5182  ;
5183
5184  _proto.withTextFontFamily = function withTextFontFamily(fontFamily) {
5185    return this.extend({
5186      fontFamily: fontFamily,
5187      font: ""
5188    });
5189  }
5190  /**
5191   * Creates a new options object with the given font weight
5192   */
5193  ;
5194
5195  _proto.withTextFontWeight = function withTextFontWeight(fontWeight) {
5196    return this.extend({
5197      fontWeight: fontWeight,
5198      font: ""
5199    });
5200  }
5201  /**
5202   * Creates a new options object with the given font weight
5203   */
5204  ;
5205
5206  _proto.withTextFontShape = function withTextFontShape(fontShape) {
5207    return this.extend({
5208      fontShape: fontShape,
5209      font: ""
5210    });
5211  }
5212  /**
5213   * Return the CSS sizing classes required to switch from enclosing options
5214   * `oldOptions` to `this`. Returns an array of classes.
5215   */
5216  ;
5217
5218  _proto.sizingClasses = function sizingClasses(oldOptions) {
5219    if (oldOptions.size !== this.size) {
5220      return ["sizing", "reset-size" + oldOptions.size, "size" + this.size];
5221    } else {
5222      return [];
5223    }
5224  }
5225  /**
5226   * Return the CSS sizing classes required to switch to the base size. Like
5227   * `this.havingSize(BASESIZE).sizingClasses(this)`.
5228   */
5229  ;
5230
5231  _proto.baseSizingClasses = function baseSizingClasses() {
5232    if (this.size !== Options.BASESIZE) {
5233      return ["sizing", "reset-size" + this.size, "size" + Options.BASESIZE];
5234    } else {
5235      return [];
5236    }
5237  }
5238  /**
5239   * Return the font metrics for this size.
5240   */
5241  ;
5242
5243  _proto.fontMetrics = function fontMetrics() {
5244    if (!this._fontMetrics) {
5245      this._fontMetrics = getGlobalMetrics(this.size);
5246    }
5247
5248    return this._fontMetrics;
5249  }
5250  /**
5251   * Gets the CSS color of the current options object
5252   */
5253  ;
5254
5255  _proto.getColor = function getColor() {
5256    if (this.phantom) {
5257      return "transparent";
5258    } else {
5259      return this.color;
5260    }
5261  };
5262
5263  return Options;
5264}();
5265
5266Options_Options.BASESIZE = 6;
5267/* harmony default export */ var src_Options = (Options_Options);
5268// CONCATENATED MODULE: ./src/units.js
5269/**
5270 * This file does conversion between units.  In particular, it provides
5271 * calculateSize to convert other units into ems.
5272 */
5273
5274 // This table gives the number of TeX pts in one of each *absolute* TeX unit.
5275// Thus, multiplying a length by this number converts the length from units
5276// into pts.  Dividing the result by ptPerEm gives the number of ems
5277// *assuming* a font size of ptPerEm (normal size, normal style).
5278
5279var ptPerUnit = {
5280  // https://en.wikibooks.org/wiki/LaTeX/Lengths and
5281  // https://tex.stackexchange.com/a/8263
5282  "pt": 1,
5283  // TeX point
5284  "mm": 7227 / 2540,
5285  // millimeter
5286  "cm": 7227 / 254,
5287  // centimeter
5288  "in": 72.27,
5289  // inch
5290  "bp": 803 / 800,
5291  // big (PostScript) points
5292  "pc": 12,
5293  // pica
5294  "dd": 1238 / 1157,
5295  // didot
5296  "cc": 14856 / 1157,
5297  // cicero (12 didot)
5298  "nd": 685 / 642,
5299  // new didot
5300  "nc": 1370 / 107,
5301  // new cicero (12 new didot)
5302  "sp": 1 / 65536,
5303  // scaled point (TeX's internal smallest unit)
5304  // https://tex.stackexchange.com/a/41371
5305  "px": 803 / 800 // \pdfpxdimen defaults to 1 bp in pdfTeX and LuaTeX
5306
5307}; // Dictionary of relative units, for fast validity testing.
5308
5309var relativeUnit = {
5310  "ex": true,
5311  "em": true,
5312  "mu": true
5313};
5314
5315/**
5316 * Determine whether the specified unit (either a string defining the unit
5317 * or a "size" parse node containing a unit field) is valid.
5318 */
5319var validUnit = function validUnit(unit) {
5320  if (typeof unit !== "string") {
5321    unit = unit.unit;
5322  }
5323
5324  return unit in ptPerUnit || unit in relativeUnit || unit === "ex";
5325};
5326/*
5327 * Convert a "size" parse node (with numeric "number" and string "unit" fields,
5328 * as parsed by functions.js argType "size") into a CSS em value for the
5329 * current style/scale.  `options` gives the current options.
5330 */
5331
5332var units_calculateSize = function calculateSize(sizeValue, options) {
5333  var scale;
5334
5335  if (sizeValue.unit in ptPerUnit) {
5336    // Absolute units
5337    scale = ptPerUnit[sizeValue.unit] // Convert unit to pt
5338    / options.fontMetrics().ptPerEm // Convert pt to CSS em
5339    / options.sizeMultiplier; // Unscale to make absolute units
5340  } else if (sizeValue.unit === "mu") {
5341    // `mu` units scale with scriptstyle/scriptscriptstyle.
5342    scale = options.fontMetrics().cssEmPerMu;
5343  } else {
5344    // Other relative units always refer to the *textstyle* font
5345    // in the current size.
5346    var unitOptions;
5347
5348    if (options.style.isTight()) {
5349      // isTight() means current style is script/scriptscript.
5350      unitOptions = options.havingStyle(options.style.text());
5351    } else {
5352      unitOptions = options;
5353    } // TODO: In TeX these units are relative to the quad of the current
5354    // *text* font, e.g. cmr10. KaTeX instead uses values from the
5355    // comparably-sized *Computer Modern symbol* font. At 10pt, these
5356    // match. At 7pt and 5pt, they differ: cmr7=1.138894, cmsy7=1.170641;
5357    // cmr5=1.361133, cmsy5=1.472241. Consider $\scriptsize a\kern1emb$.
5358    // TeX \showlists shows a kern of 1.13889 * fontsize;
5359    // KaTeX shows a kern of 1.171 * fontsize.
5360
5361
5362    if (sizeValue.unit === "ex") {
5363      scale = unitOptions.fontMetrics().xHeight;
5364    } else if (sizeValue.unit === "em") {
5365      scale = unitOptions.fontMetrics().quad;
5366    } else {
5367      throw new src_ParseError("Invalid unit: '" + sizeValue.unit + "'");
5368    }
5369
5370    if (unitOptions !== options) {
5371      scale *= unitOptions.sizeMultiplier / options.sizeMultiplier;
5372    }
5373  }
5374
5375  return Math.min(sizeValue.number * scale, options.maxSize);
5376};
5377// CONCATENATED MODULE: ./src/buildCommon.js
5378/* eslint no-console:0 */
5379
5380/**
5381 * This module contains general functions that can be used for building
5382 * different kinds of domTree nodes in a consistent manner.
5383 */
5384
5385
5386
5387
5388
5389
5390
5391// The following have to be loaded from Main-Italic font, using class mathit
5392var mathitLetters = ["\\imath", "ı", // dotless i
5393"\\jmath", "ȷ", // dotless j
5394"\\pounds", "\\mathsterling", "\\textsterling", "£"];
5395/**
5396 * Looks up the given symbol in fontMetrics, after applying any symbol
5397 * replacements defined in symbol.js
5398 */
5399
5400var buildCommon_lookupSymbol = function lookupSymbol(value, // TODO(#963): Use a union type for this.
5401fontName, mode) {
5402  // Replace the value with its replaced value from symbol.js
5403  if (src_symbols[mode][value] && src_symbols[mode][value].replace) {
5404    value = src_symbols[mode][value].replace;
5405  }
5406
5407  return {
5408    value: value,
5409    metrics: getCharacterMetrics(value, fontName, mode)
5410  };
5411};
5412/**
5413 * Makes a symbolNode after translation via the list of symbols in symbols.js.
5414 * Correctly pulls out metrics for the character, and optionally takes a list of
5415 * classes to be attached to the node.
5416 *
5417 * TODO: make argument order closer to makeSpan
5418 * TODO: add a separate argument for math class (e.g. `mop`, `mbin`), which
5419 * should if present come first in `classes`.
5420 * TODO(#953): Make `options` mandatory and always pass it in.
5421 */
5422
5423
5424var buildCommon_makeSymbol = function makeSymbol(value, fontName, mode, options, classes) {
5425  var lookup = buildCommon_lookupSymbol(value, fontName, mode);
5426  var metrics = lookup.metrics;
5427  value = lookup.value;
5428  var symbolNode;
5429
5430  if (metrics) {
5431    var italic = metrics.italic;
5432
5433    if (mode === "text" || options && options.font === "mathit") {
5434      italic = 0;
5435    }
5436
5437    symbolNode = new domTree_SymbolNode(value, metrics.height, metrics.depth, italic, metrics.skew, metrics.width, classes);
5438  } else {
5439    // TODO(emily): Figure out a good way to only print this in development
5440    typeof console !== "undefined" && console.warn("No character metrics " + ("for '" + value + "' in style '" + fontName + "' and mode '" + mode + "'"));
5441    symbolNode = new domTree_SymbolNode(value, 0, 0, 0, 0, 0, classes);
5442  }
5443
5444  if (options) {
5445    symbolNode.maxFontSize = options.sizeMultiplier;
5446
5447    if (options.style.isTight()) {
5448      symbolNode.classes.push("mtight");
5449    }
5450
5451    var color = options.getColor();
5452
5453    if (color) {
5454      symbolNode.style.color = color;
5455    }
5456  }
5457
5458  return symbolNode;
5459};
5460/**
5461 * Makes a symbol in Main-Regular or AMS-Regular.
5462 * Used for rel, bin, open, close, inner, and punct.
5463 */
5464
5465
5466var buildCommon_mathsym = function mathsym(value, mode, options, classes) {
5467  if (classes === void 0) {
5468    classes = [];
5469  }
5470
5471  // Decide what font to render the symbol in by its entry in the symbols
5472  // table.
5473  // Have a special case for when the value = \ because the \ is used as a
5474  // textord in unsupported command errors but cannot be parsed as a regular
5475  // text ordinal and is therefore not present as a symbol in the symbols
5476  // table for text, as well as a special case for boldsymbol because it
5477  // can be used for bold + and -
5478  if (options.font === "boldsymbol" && buildCommon_lookupSymbol(value, "Main-Bold", mode).metrics) {
5479    return buildCommon_makeSymbol(value, "Main-Bold", mode, options, classes.concat(["mathbf"]));
5480  } else if (value === "\\" || src_symbols[mode][value].font === "main") {
5481    return buildCommon_makeSymbol(value, "Main-Regular", mode, options, classes);
5482  } else {
5483    return buildCommon_makeSymbol(value, "AMS-Regular", mode, options, classes.concat(["amsrm"]));
5484  }
5485};
5486/**
5487 * Determines which of the two font names (Main-Italic and Math-Italic) and
5488 * corresponding style tags (maindefault or mathit) to use for default math font,
5489 * depending on the symbol.
5490 */
5491
5492
5493var buildCommon_mathdefault = function mathdefault(value, mode, options, classes) {
5494  if (/[0-9]/.test(value.charAt(0)) || // glyphs for \imath and \jmath do not exist in Math-Italic so we
5495  // need to use Main-Italic instead
5496  utils.contains(mathitLetters, value)) {
5497    return {
5498      fontName: "Main-Italic",
5499      fontClass: "mathit"
5500    };
5501  } else {
5502    return {
5503      fontName: "Math-Italic",
5504      fontClass: "mathdefault"
5505    };
5506  }
5507};
5508/**
5509 * Determines which of the font names (Main-Italic, Math-Italic, and Caligraphic)
5510 * and corresponding style tags (mathit, mathdefault, or mathcal) to use for font
5511 * "mathnormal", depending on the symbol.  Use this function instead of fontMap for
5512 * font "mathnormal".
5513 */
5514
5515
5516var buildCommon_mathnormal = function mathnormal(value, mode, options, classes) {
5517  if (utils.contains(mathitLetters, value)) {
5518    return {
5519      fontName: "Main-Italic",
5520      fontClass: "mathit"
5521    };
5522  } else if (/[0-9]/.test(value.charAt(0))) {
5523    return {
5524      fontName: "Caligraphic-Regular",
5525      fontClass: "mathcal"
5526    };
5527  } else {
5528    return {
5529      fontName: "Math-Italic",
5530      fontClass: "mathdefault"
5531    };
5532  }
5533};
5534/**
5535 * Determines which of the two font names (Main-Bold and Math-BoldItalic) and
5536 * corresponding style tags (mathbf or boldsymbol) to use for font "boldsymbol",
5537 * depending on the symbol.  Use this function instead of fontMap for font
5538 * "boldsymbol".
5539 */
5540
5541
5542var boldsymbol = function boldsymbol(value, mode, options, classes) {
5543  if (buildCommon_lookupSymbol(value, "Math-BoldItalic", mode).metrics) {
5544    return {
5545      fontName: "Math-BoldItalic",
5546      fontClass: "boldsymbol"
5547    };
5548  } else {
5549    // Some glyphs do not exist in Math-BoldItalic so we need to use
5550    // Main-Bold instead.
5551    return {
5552      fontName: "Main-Bold",
5553      fontClass: "mathbf"
5554    };
5555  }
5556};
5557/**
5558 * Makes either a mathord or textord in the correct font and color.
5559 */
5560
5561
5562var buildCommon_makeOrd = function makeOrd(group, options, type) {
5563  var mode = group.mode;
5564  var text = group.text;
5565  var classes = ["mord"]; // Math mode or Old font (i.e. \rm)
5566
5567  var isFont = mode === "math" || mode === "text" && options.font;
5568  var fontOrFamily = isFont ? options.font : options.fontFamily;
5569
5570  if (text.charCodeAt(0) === 0xD835) {
5571    // surrogate pairs get special treatment
5572    var _wideCharacterFont = wide_character_wideCharacterFont(text, mode),
5573        wideFontName = _wideCharacterFont[0],
5574        wideFontClass = _wideCharacterFont[1];
5575
5576    return buildCommon_makeSymbol(text, wideFontName, mode, options, classes.concat(wideFontClass));
5577  } else if (fontOrFamily) {
5578    var fontName;
5579    var fontClasses;
5580
5581    if (fontOrFamily === "boldsymbol" || fontOrFamily === "mathnormal") {
5582      var fontData = fontOrFamily === "boldsymbol" ? boldsymbol(text, mode, options, classes) : buildCommon_mathnormal(text, mode, options, classes);
5583      fontName = fontData.fontName;
5584      fontClasses = [fontData.fontClass];
5585    } else if (utils.contains(mathitLetters, text)) {
5586      fontName = "Main-Italic";
5587      fontClasses = ["mathit"];
5588    } else if (isFont) {
5589      fontName = fontMap[fontOrFamily].fontName;
5590      fontClasses = [fontOrFamily];
5591    } else {
5592      fontName = retrieveTextFontName(fontOrFamily, options.fontWeight, options.fontShape);
5593      fontClasses = [fontOrFamily, options.fontWeight, options.fontShape];
5594    }
5595
5596    if (buildCommon_lookupSymbol(text, fontName, mode).metrics) {
5597      return buildCommon_makeSymbol(text, fontName, mode, options, classes.concat(fontClasses));
5598    } else if (ligatures.hasOwnProperty(text) && fontName.substr(0, 10) === "Typewriter") {
5599      // Deconstruct ligatures in monospace fonts (\texttt, \tt).
5600      var parts = [];
5601
5602      for (var i = 0; i < text.length; i++) {
5603        parts.push(buildCommon_makeSymbol(text[i], fontName, mode, options, classes.concat(fontClasses)));
5604      }
5605
5606      return buildCommon_makeFragment(parts);
5607    }
5608  } // Makes a symbol in the default font for mathords and textords.
5609
5610
5611  if (type === "mathord") {
5612    var fontLookup = buildCommon_mathdefault(text, mode, options, classes);
5613    return buildCommon_makeSymbol(text, fontLookup.fontName, mode, options, classes.concat([fontLookup.fontClass]));
5614  } else if (type === "textord") {
5615    var font = src_symbols[mode][text] && src_symbols[mode][text].font;
5616
5617    if (font === "ams") {
5618      var _fontName = retrieveTextFontName("amsrm", options.fontWeight, options.fontShape);
5619
5620      return buildCommon_makeSymbol(text, _fontName, mode, options, classes.concat("amsrm", options.fontWeight, options.fontShape));
5621    } else if (font === "main" || !font) {
5622      var _fontName2 = retrieveTextFontName("textrm", options.fontWeight, options.fontShape);
5623
5624      return buildCommon_makeSymbol(text, _fontName2, mode, options, classes.concat(options.fontWeight, options.fontShape));
5625    } else {
5626      // fonts added by plugins
5627      var _fontName3 = retrieveTextFontName(font, options.fontWeight, options.fontShape); // We add font name as a css class
5628
5629
5630      return buildCommon_makeSymbol(text, _fontName3, mode, options, classes.concat(_fontName3, options.fontWeight, options.fontShape));
5631    }
5632  } else {
5633    throw new Error("unexpected type: " + type + " in makeOrd");
5634  }
5635};
5636/**
5637 * Returns true if subsequent symbolNodes have the same classes, skew, maxFont,
5638 * and styles.
5639 */
5640
5641
5642var buildCommon_canCombine = function canCombine(prev, next) {
5643  if (createClass(prev.classes) !== createClass(next.classes) || prev.skew !== next.skew || prev.maxFontSize !== next.maxFontSize) {
5644    return false;
5645  }
5646
5647  for (var style in prev.style) {
5648    if (prev.style.hasOwnProperty(style) && prev.style[style] !== next.style[style]) {
5649      return false;
5650    }
5651  }
5652
5653  for (var _style in next.style) {
5654    if (next.style.hasOwnProperty(_style) && prev.style[_style] !== next.style[_style]) {
5655      return false;
5656    }
5657  }
5658
5659  return true;
5660};
5661/**
5662 * Combine consequetive domTree.symbolNodes into a single symbolNode.
5663 * Note: this function mutates the argument.
5664 */
5665
5666
5667var buildCommon_tryCombineChars = function tryCombineChars(chars) {
5668  for (var i = 0; i < chars.length - 1; i++) {
5669    var prev = chars[i];
5670    var next = chars[i + 1];
5671
5672    if (prev instanceof domTree_SymbolNode && next instanceof domTree_SymbolNode && buildCommon_canCombine(prev, next)) {
5673      prev.text += next.text;
5674      prev.height = Math.max(prev.height, next.height);
5675      prev.depth = Math.max(prev.depth, next.depth); // Use the last character's italic correction since we use
5676      // it to add padding to the right of the span created from
5677      // the combined characters.
5678
5679      prev.italic = next.italic;
5680      chars.splice(i + 1, 1);
5681      i--;
5682    }
5683  }
5684
5685  return chars;
5686};
5687/**
5688 * Calculate the height, depth, and maxFontSize of an element based on its
5689 * children.
5690 */
5691
5692
5693var sizeElementFromChildren = function sizeElementFromChildren(elem) {
5694  var height = 0;
5695  var depth = 0;
5696  var maxFontSize = 0;
5697
5698  for (var i = 0; i < elem.children.length; i++) {
5699    var child = elem.children[i];
5700
5701    if (child.height > height) {
5702      height = child.height;
5703    }
5704
5705    if (child.depth > depth) {
5706      depth = child.depth;
5707    }
5708
5709    if (child.maxFontSize > maxFontSize) {
5710      maxFontSize = child.maxFontSize;
5711    }
5712  }
5713
5714  elem.height = height;
5715  elem.depth = depth;
5716  elem.maxFontSize = maxFontSize;
5717};
5718/**
5719 * Makes a span with the given list of classes, list of children, and options.
5720 *
5721 * TODO(#953): Ensure that `options` is always provided (currently some call
5722 * sites don't pass it) and make the type below mandatory.
5723 * TODO: add a separate argument for math class (e.g. `mop`, `mbin`), which
5724 * should if present come first in `classes`.
5725 */
5726
5727
5728var buildCommon_makeSpan = function makeSpan(classes, children, options, style) {
5729  var span = new domTree_Span(classes, children, options, style);
5730  sizeElementFromChildren(span);
5731  return span;
5732}; // SVG one is simpler -- doesn't require height, depth, max-font setting.
5733// This is also a separate method for typesafety.
5734
5735
5736var buildCommon_makeSvgSpan = function makeSvgSpan(classes, children, options, style) {
5737  return new domTree_Span(classes, children, options, style);
5738};
5739
5740var makeLineSpan = function makeLineSpan(className, options, thickness) {
5741  var line = buildCommon_makeSpan([className], [], options);
5742  line.height = Math.max(thickness || options.fontMetrics().defaultRuleThickness, options.minRuleThickness);
5743  line.style.borderBottomWidth = line.height + "em";
5744  line.maxFontSize = 1.0;
5745  return line;
5746};
5747/**
5748 * Makes an anchor with the given href, list of classes, list of children,
5749 * and options.
5750 */
5751
5752
5753var buildCommon_makeAnchor = function makeAnchor(href, classes, children, options) {
5754  var anchor = new domTree_Anchor(href, classes, children, options);
5755  sizeElementFromChildren(anchor);
5756  return anchor;
5757};
5758/**
5759 * Makes a document fragment with the given list of children.
5760 */
5761
5762
5763var buildCommon_makeFragment = function makeFragment(children) {
5764  var fragment = new tree_DocumentFragment(children);
5765  sizeElementFromChildren(fragment);
5766  return fragment;
5767};
5768/**
5769 * Wraps group in a span if it's a document fragment, allowing to apply classes
5770 * and styles
5771 */
5772
5773
5774var buildCommon_wrapFragment = function wrapFragment(group, options) {
5775  if (group instanceof tree_DocumentFragment) {
5776    return buildCommon_makeSpan([], [group], options);
5777  }
5778
5779  return group;
5780}; // These are exact object types to catch typos in the names of the optional fields.
5781
5782
5783// Computes the updated `children` list and the overall depth.
5784//
5785// This helper function for makeVList makes it easier to enforce type safety by
5786// allowing early exits (returns) in the logic.
5787var getVListChildrenAndDepth = function getVListChildrenAndDepth(params) {
5788  if (params.positionType === "individualShift") {
5789    var oldChildren = params.children;
5790    var children = [oldChildren[0]]; // Add in kerns to the list of params.children to get each element to be
5791    // shifted to the correct specified shift
5792
5793    var _depth = -oldChildren[0].shift - oldChildren[0].elem.depth;
5794
5795    var currPos = _depth;
5796
5797    for (var i = 1; i < oldChildren.length; i++) {
5798      var diff = -oldChildren[i].shift - currPos - oldChildren[i].elem.depth;
5799      var size = diff - (oldChildren[i - 1].elem.height + oldChildren[i - 1].elem.depth);
5800      currPos = currPos + diff;
5801      children.push({
5802        type: "kern",
5803        size: size
5804      });
5805      children.push(oldChildren[i]);
5806    }
5807
5808    return {
5809      children: children,
5810      depth: _depth
5811    };
5812  }
5813
5814  var depth;
5815
5816  if (params.positionType === "top") {
5817    // We always start at the bottom, so calculate the bottom by adding up
5818    // all the sizes
5819    var bottom = params.positionData;
5820
5821    for (var _i = 0; _i < params.children.length; _i++) {
5822      var child = params.children[_i];
5823      bottom -= child.type === "kern" ? child.size : child.elem.height + child.elem.depth;
5824    }
5825
5826    depth = bottom;
5827  } else if (params.positionType === "bottom") {
5828    depth = -params.positionData;
5829  } else {
5830    var firstChild = params.children[0];
5831
5832    if (firstChild.type !== "elem") {
5833      throw new Error('First child must have type "elem".');
5834    }
5835
5836    if (params.positionType === "shift") {
5837      depth = -firstChild.elem.depth - params.positionData;
5838    } else if (params.positionType === "firstBaseline") {
5839      depth = -firstChild.elem.depth;
5840    } else {
5841      throw new Error("Invalid positionType " + params.positionType + ".");
5842    }
5843  }
5844
5845  return {
5846    children: params.children,
5847    depth: depth
5848  };
5849};
5850/**
5851 * Makes a vertical list by stacking elements and kerns on top of each other.
5852 * Allows for many different ways of specifying the positioning method.
5853 *
5854 * See VListParam documentation above.
5855 */
5856
5857
5858var buildCommon_makeVList = function makeVList(params, options) {
5859  var _getVListChildrenAndD = getVListChildrenAndDepth(params),
5860      children = _getVListChildrenAndD.children,
5861      depth = _getVListChildrenAndD.depth; // Create a strut that is taller than any list item. The strut is added to
5862  // each item, where it will determine the item's baseline. Since it has
5863  // `overflow:hidden`, the strut's top edge will sit on the item's line box's
5864  // top edge and the strut's bottom edge will sit on the item's baseline,
5865  // with no additional line-height spacing. This allows the item baseline to
5866  // be positioned precisely without worrying about font ascent and
5867  // line-height.
5868
5869
5870  var pstrutSize = 0;
5871
5872  for (var i = 0; i < children.length; i++) {
5873    var child = children[i];
5874
5875    if (child.type === "elem") {
5876      var elem = child.elem;
5877      pstrutSize = Math.max(pstrutSize, elem.maxFontSize, elem.height);
5878    }
5879  }
5880
5881  pstrutSize += 2;
5882  var pstrut = buildCommon_makeSpan(["pstrut"], []);
5883  pstrut.style.height = pstrutSize + "em"; // Create a new list of actual children at the correct offsets
5884
5885  var realChildren = [];
5886  var minPos = depth;
5887  var maxPos = depth;
5888  var currPos = depth;
5889
5890  for (var _i2 = 0; _i2 < children.length; _i2++) {
5891    var _child = children[_i2];
5892
5893    if (_child.type === "kern") {
5894      currPos += _child.size;
5895    } else {
5896      var _elem = _child.elem;
5897      var classes = _child.wrapperClasses || [];
5898      var style = _child.wrapperStyle || {};
5899      var childWrap = buildCommon_makeSpan(classes, [pstrut, _elem], undefined, style);
5900      childWrap.style.top = -pstrutSize - currPos - _elem.depth + "em";
5901
5902      if (_child.marginLeft) {
5903        childWrap.style.marginLeft = _child.marginLeft;
5904      }
5905
5906      if (_child.marginRight) {
5907        childWrap.style.marginRight = _child.marginRight;
5908      }
5909
5910      realChildren.push(childWrap);
5911      currPos += _elem.height + _elem.depth;
5912    }
5913
5914    minPos = Math.min(minPos, currPos);
5915    maxPos = Math.max(maxPos, currPos);
5916  } // The vlist contents go in a table-cell with `vertical-align:bottom`.
5917  // This cell's bottom edge will determine the containing table's baseline
5918  // without overly expanding the containing line-box.
5919
5920
5921  var vlist = buildCommon_makeSpan(["vlist"], realChildren);
5922  vlist.style.height = maxPos + "em"; // A second row is used if necessary to represent the vlist's depth.
5923
5924  var rows;
5925
5926  if (minPos < 0) {
5927    // We will define depth in an empty span with display: table-cell.
5928    // It should render with the height that we define. But Chrome, in
5929    // contenteditable mode only, treats that span as if it contains some
5930    // text content. And that min-height over-rides our desired height.
5931    // So we put another empty span inside the depth strut span.
5932    var emptySpan = buildCommon_makeSpan([], []);
5933    var depthStrut = buildCommon_makeSpan(["vlist"], [emptySpan]);
5934    depthStrut.style.height = -minPos + "em"; // Safari wants the first row to have inline content; otherwise it
5935    // puts the bottom of the *second* row on the baseline.
5936
5937    var topStrut = buildCommon_makeSpan(["vlist-s"], [new domTree_SymbolNode("\u200B")]);
5938    rows = [buildCommon_makeSpan(["vlist-r"], [vlist, topStrut]), buildCommon_makeSpan(["vlist-r"], [depthStrut])];
5939  } else {
5940    rows = [buildCommon_makeSpan(["vlist-r"], [vlist])];
5941  }
5942
5943  var vtable = buildCommon_makeSpan(["vlist-t"], rows);
5944
5945  if (rows.length === 2) {
5946    vtable.classes.push("vlist-t2");
5947  }
5948
5949  vtable.height = maxPos;
5950  vtable.depth = -minPos;
5951  return vtable;
5952}; // Glue is a concept from TeX which is a flexible space between elements in
5953// either a vertical or horizontal list. In KaTeX, at least for now, it's
5954// static space between elements in a horizontal layout.
5955
5956
5957var buildCommon_makeGlue = function makeGlue(measurement, options) {
5958  // Make an empty span for the space
5959  var rule = buildCommon_makeSpan(["mspace"], [], options);
5960  var size = units_calculateSize(measurement, options);
5961  rule.style.marginRight = size + "em";
5962  return rule;
5963}; // Takes font options, and returns the appropriate fontLookup name
5964
5965
5966var retrieveTextFontName = function retrieveTextFontName(fontFamily, fontWeight, fontShape) {
5967  var baseFontName = "";
5968
5969  switch (fontFamily) {
5970    case "amsrm":
5971      baseFontName = "AMS";
5972      break;
5973
5974    case "textrm":
5975      baseFontName = "Main";
5976      break;
5977
5978    case "textsf":
5979      baseFontName = "SansSerif";
5980      break;
5981
5982    case "texttt":
5983      baseFontName = "Typewriter";
5984      break;
5985
5986    default:
5987      baseFontName = fontFamily;
5988    // use fonts added by a plugin
5989  }
5990
5991  var fontStylesName;
5992
5993  if (fontWeight === "textbf" && fontShape === "textit") {
5994    fontStylesName = "BoldItalic";
5995  } else if (fontWeight === "textbf") {
5996    fontStylesName = "Bold";
5997  } else if (fontWeight === "textit") {
5998    fontStylesName = "Italic";
5999  } else {
6000    fontStylesName = "Regular";
6001  }
6002
6003  return baseFontName + "-" + fontStylesName;
6004};
6005/**
6006 * Maps TeX font commands to objects containing:
6007 * - variant: string used for "mathvariant" attribute in buildMathML.js
6008 * - fontName: the "style" parameter to fontMetrics.getCharacterMetrics
6009 */
6010// A map between tex font commands an MathML mathvariant attribute values
6011
6012
6013var fontMap = {
6014  // styles
6015  "mathbf": {
6016    variant: "bold",
6017    fontName: "Main-Bold"
6018  },
6019  "mathrm": {
6020    variant: "normal",
6021    fontName: "Main-Regular"
6022  },
6023  "textit": {
6024    variant: "italic",
6025    fontName: "Main-Italic"
6026  },
6027  "mathit": {
6028    variant: "italic",
6029    fontName: "Main-Italic"
6030  },
6031  // Default math font, "mathnormal" and "boldsymbol" are missing because they
6032  // require the use of several fonts: Main-Italic and Math-Italic for default
6033  // math font, Main-Italic, Math-Italic, Caligraphic for "mathnormal", and
6034  // Math-BoldItalic and Main-Bold for "boldsymbol".  This is handled by a
6035  // special case in makeOrd which ends up calling mathdefault, mathnormal,
6036  // and boldsymbol.
6037  // families
6038  "mathbb": {
6039    variant: "double-struck",
6040    fontName: "AMS-Regular"
6041  },
6042  "mathcal": {
6043    variant: "script",
6044    fontName: "Caligraphic-Regular"
6045  },
6046  "mathfrak": {
6047    variant: "fraktur",
6048    fontName: "Fraktur-Regular"
6049  },
6050  "mathscr": {
6051    variant: "script",
6052    fontName: "Script-Regular"
6053  },
6054  "mathsf": {
6055    variant: "sans-serif",
6056    fontName: "SansSerif-Regular"
6057  },
6058  "mathtt": {
6059    variant: "monospace",
6060    fontName: "Typewriter-Regular"
6061  }
6062};
6063var svgData = {
6064  //   path, width, height
6065  vec: ["vec", 0.471, 0.714],
6066  // values from the font glyph
6067  oiintSize1: ["oiintSize1", 0.957, 0.499],
6068  // oval to overlay the integrand
6069  oiintSize2: ["oiintSize2", 1.472, 0.659],
6070  oiiintSize1: ["oiiintSize1", 1.304, 0.499],
6071  oiiintSize2: ["oiiintSize2", 1.98, 0.659]
6072};
6073
6074var buildCommon_staticSvg = function staticSvg(value, options) {
6075  // Create a span with inline SVG for the element.
6076  var _svgData$value = svgData[value],
6077      pathName = _svgData$value[0],
6078      width = _svgData$value[1],
6079      height = _svgData$value[2];
6080  var path = new domTree_PathNode(pathName);
6081  var svgNode = new SvgNode([path], {
6082    "width": width + "em",
6083    "height": height + "em",
6084    // Override CSS rule `.katex svg { width: 100% }`
6085    "style": "width:" + width + "em",
6086    "viewBox": "0 0 " + 1000 * width + " " + 1000 * height,
6087    "preserveAspectRatio": "xMinYMin"
6088  });
6089  var span = buildCommon_makeSvgSpan(["overlay"], [svgNode], options);
6090  span.height = height;
6091  span.style.height = height + "em";
6092  span.style.width = width + "em";
6093  return span;
6094};
6095
6096/* harmony default export */ var buildCommon = ({
6097  fontMap: fontMap,
6098  makeSymbol: buildCommon_makeSymbol,
6099  mathsym: buildCommon_mathsym,
6100  makeSpan: buildCommon_makeSpan,
6101  makeSvgSpan: buildCommon_makeSvgSpan,
6102  makeLineSpan: makeLineSpan,
6103  makeAnchor: buildCommon_makeAnchor,
6104  makeFragment: buildCommon_makeFragment,
6105  wrapFragment: buildCommon_wrapFragment,
6106  makeVList: buildCommon_makeVList,
6107  makeOrd: buildCommon_makeOrd,
6108  makeGlue: buildCommon_makeGlue,
6109  staticSvg: buildCommon_staticSvg,
6110  svgData: svgData,
6111  tryCombineChars: buildCommon_tryCombineChars
6112});
6113// CONCATENATED MODULE: ./src/parseNode.js
6114
6115
6116/**
6117 * Asserts that the node is of the given type and returns it with stricter
6118 * typing. Throws if the node's type does not match.
6119 */
6120function assertNodeType(node, type) {
6121  var typedNode = checkNodeType(node, type);
6122
6123  if (!typedNode) {
6124    throw new Error("Expected node of type " + type + ", but got " + (node ? "node of type " + node.type : String(node)));
6125  } // $FlowFixMe: Unsure why.
6126
6127
6128  return typedNode;
6129}
6130/**
6131 * Returns the node more strictly typed iff it is of the given type. Otherwise,
6132 * returns null.
6133 */
6134
6135function checkNodeType(node, type) {
6136  if (node && node.type === type) {
6137    // The definition of ParseNode<TYPE> doesn't communicate to flow that
6138    // `type: TYPE` (as that's not explicitly mentioned anywhere), though that
6139    // happens to be true for all our value types.
6140    // $FlowFixMe
6141    return node;
6142  }
6143
6144  return null;
6145}
6146/**
6147 * Asserts that the node is of the given type and returns it with stricter
6148 * typing. Throws if the node's type does not match.
6149 */
6150
6151function assertAtomFamily(node, family) {
6152  var typedNode = checkAtomFamily(node, family);
6153
6154  if (!typedNode) {
6155    throw new Error("Expected node of type \"atom\" and family \"" + family + "\", but got " + (node ? node.type === "atom" ? "atom of family " + node.family : "node of type " + node.type : String(node)));
6156  }
6157
6158  return typedNode;
6159}
6160/**
6161 * Returns the node more strictly typed iff it is of the given type. Otherwise,
6162 * returns null.
6163 */
6164
6165function checkAtomFamily(node, family) {
6166  return node && node.type === "atom" && node.family === family ? node : null;
6167}
6168/**
6169 * Returns the node more strictly typed iff it is of the given type. Otherwise,
6170 * returns null.
6171 */
6172
6173function assertSymbolNodeType(node) {
6174  var typedNode = checkSymbolNodeType(node);
6175
6176  if (!typedNode) {
6177    throw new Error("Expected node of symbol group type, but got " + (node ? "node of type " + node.type : String(node)));
6178  }
6179
6180  return typedNode;
6181}
6182/**
6183 * Returns the node more strictly typed iff it is of the given type. Otherwise,
6184 * returns null.
6185 */
6186
6187function checkSymbolNodeType(node) {
6188  if (node && (node.type === "atom" || NON_ATOMS.hasOwnProperty(node.type))) {
6189    // $FlowFixMe
6190    return node;
6191  }
6192
6193  return null;
6194}
6195// CONCATENATED MODULE: ./src/spacingData.js
6196/**
6197 * Describes spaces between different classes of atoms.
6198 */
6199var thinspace = {
6200  number: 3,
6201  unit: "mu"
6202};
6203var mediumspace = {
6204  number: 4,
6205  unit: "mu"
6206};
6207var thickspace = {
6208  number: 5,
6209  unit: "mu"
6210}; // Making the type below exact with all optional fields doesn't work due to
6211// - https://github.com/facebook/flow/issues/4582
6212// - https://github.com/facebook/flow/issues/5688
6213// However, since *all* fields are optional, $Shape<> works as suggested in 5688
6214// above.
6215
6216// Spacing relationships for display and text styles
6217var spacings = {
6218  mord: {
6219    mop: thinspace,
6220    mbin: mediumspace,
6221    mrel: thickspace,
6222    minner: thinspace
6223  },
6224  mop: {
6225    mord: thinspace,
6226    mop: thinspace,
6227    mrel: thickspace,
6228    minner: thinspace
6229  },
6230  mbin: {
6231    mord: mediumspace,
6232    mop: mediumspace,
6233    mopen: mediumspace,
6234    minner: mediumspace
6235  },
6236  mrel: {
6237    mord: thickspace,
6238    mop: thickspace,
6239    mopen: thickspace,
6240    minner: thickspace
6241  },
6242  mopen: {},
6243  mclose: {
6244    mop: thinspace,
6245    mbin: mediumspace,
6246    mrel: thickspace,
6247    minner: thinspace
6248  },
6249  mpunct: {
6250    mord: thinspace,
6251    mop: thinspace,
6252    mrel: thickspace,
6253    mopen: thinspace,
6254    mclose: thinspace,
6255    mpunct: thinspace,
6256    minner: thinspace
6257  },
6258  minner: {
6259    mord: thinspace,
6260    mop: thinspace,
6261    mbin: mediumspace,
6262    mrel: thickspace,
6263    mopen: thinspace,
6264    mpunct: thinspace,
6265    minner: thinspace
6266  }
6267}; // Spacing relationships for script and scriptscript styles
6268
6269var tightSpacings = {
6270  mord: {
6271    mop: thinspace
6272  },
6273  mop: {
6274    mord: thinspace,
6275    mop: thinspace
6276  },
6277  mbin: {},
6278  mrel: {},
6279  mopen: {},
6280  mclose: {
6281    mop: thinspace
6282  },
6283  mpunct: {},
6284  minner: {
6285    mop: thinspace
6286  }
6287};
6288// CONCATENATED MODULE: ./src/defineFunction.js
6289
6290
6291/**
6292 * All registered functions.
6293 * `functions.js` just exports this same dictionary again and makes it public.
6294 * `Parser.js` requires this dictionary.
6295 */
6296var _functions = {};
6297/**
6298 * All HTML builders. Should be only used in the `define*` and the `build*ML`
6299 * functions.
6300 */
6301
6302var _htmlGroupBuilders = {};
6303/**
6304 * All MathML builders. Should be only used in the `define*` and the `build*ML`
6305 * functions.
6306 */
6307
6308var _mathmlGroupBuilders = {};
6309function defineFunction(_ref) {
6310  var type = _ref.type,
6311      names = _ref.names,
6312      props = _ref.props,
6313      handler = _ref.handler,
6314      htmlBuilder = _ref.htmlBuilder,
6315      mathmlBuilder = _ref.mathmlBuilder;
6316  // Set default values of functions
6317  var data = {
6318    type: type,
6319    numArgs: props.numArgs,
6320    argTypes: props.argTypes,
6321    greediness: props.greediness === undefined ? 1 : props.greediness,
6322    allowedInText: !!props.allowedInText,
6323    allowedInMath: props.allowedInMath === undefined ? true : props.allowedInMath,
6324    numOptionalArgs: props.numOptionalArgs || 0,
6325    infix: !!props.infix,
6326    handler: handler
6327  };
6328
6329  for (var i = 0; i < names.length; ++i) {
6330    _functions[names[i]] = data;
6331  }
6332
6333  if (type) {
6334    if (htmlBuilder) {
6335      _htmlGroupBuilders[type] = htmlBuilder;
6336    }
6337
6338    if (mathmlBuilder) {
6339      _mathmlGroupBuilders[type] = mathmlBuilder;
6340    }
6341  }
6342}
6343/**
6344 * Use this to register only the HTML and MathML builders for a function (e.g.
6345 * if the function's ParseNode is generated in Parser.js rather than via a
6346 * stand-alone handler provided to `defineFunction`).
6347 */
6348
6349function defineFunctionBuilders(_ref2) {
6350  var type = _ref2.type,
6351      htmlBuilder = _ref2.htmlBuilder,
6352      mathmlBuilder = _ref2.mathmlBuilder;
6353  defineFunction({
6354    type: type,
6355    names: [],
6356    props: {
6357      numArgs: 0
6358    },
6359    handler: function handler() {
6360      throw new Error('Should never be called.');
6361    },
6362    htmlBuilder: htmlBuilder,
6363    mathmlBuilder: mathmlBuilder
6364  });
6365} // Since the corresponding buildHTML/buildMathML function expects a
6366// list of elements, we normalize for different kinds of arguments
6367
6368var defineFunction_ordargument = function ordargument(arg) {
6369  var node = checkNodeType(arg, "ordgroup");
6370  return node ? node.body : [arg];
6371};
6372// CONCATENATED MODULE: ./src/buildHTML.js
6373/**
6374 * This file does the main work of building a domTree structure from a parse
6375 * tree. The entry point is the `buildHTML` function, which takes a parse tree.
6376 * Then, the buildExpression, buildGroup, and various groupBuilders functions
6377 * are called, to produce a final HTML tree.
6378 */
6379
6380
6381
6382
6383
6384
6385
6386
6387
6388var buildHTML_makeSpan = buildCommon.makeSpan; // Binary atoms (first class `mbin`) change into ordinary atoms (`mord`)
6389// depending on their surroundings. See TeXbook pg. 442-446, Rules 5 and 6,
6390// and the text before Rule 19.
6391
6392var binLeftCanceller = ["leftmost", "mbin", "mopen", "mrel", "mop", "mpunct"];
6393var binRightCanceller = ["rightmost", "mrel", "mclose", "mpunct"];
6394var styleMap = {
6395  "display": src_Style.DISPLAY,
6396  "text": src_Style.TEXT,
6397  "script": src_Style.SCRIPT,
6398  "scriptscript": src_Style.SCRIPTSCRIPT
6399};
6400var DomEnum = {
6401  mord: "mord",
6402  mop: "mop",
6403  mbin: "mbin",
6404  mrel: "mrel",
6405  mopen: "mopen",
6406  mclose: "mclose",
6407  mpunct: "mpunct",
6408  minner: "minner"
6409};
6410
6411/**
6412 * Take a list of nodes, build them in order, and return a list of the built
6413 * nodes. documentFragments are flattened into their contents, so the
6414 * returned list contains no fragments. `isRealGroup` is true if `expression`
6415 * is a real group (no atoms will be added on either side), as opposed to
6416 * a partial group (e.g. one created by \color). `surrounding` is an array
6417 * consisting type of nodes that will be added to the left and right.
6418 */
6419var buildHTML_buildExpression = function buildExpression(expression, options, isRealGroup, surrounding) {
6420  if (surrounding === void 0) {
6421    surrounding = [null, null];
6422  }
6423
6424  // Parse expressions into `groups`.
6425  var groups = [];
6426
6427  for (var i = 0; i < expression.length; i++) {
6428    var output = buildHTML_buildGroup(expression[i], options);
6429
6430    if (output instanceof tree_DocumentFragment) {
6431      var children = output.children;
6432      groups.push.apply(groups, children);
6433    } else {
6434      groups.push(output);
6435    }
6436  } // If `expression` is a partial group, let the parent handle spacings
6437  // to avoid processing groups multiple times.
6438
6439
6440  if (!isRealGroup) {
6441    return groups;
6442  }
6443
6444  var glueOptions = options;
6445
6446  if (expression.length === 1) {
6447    var node = checkNodeType(expression[0], "sizing") || checkNodeType(expression[0], "styling");
6448
6449    if (!node) {// No match.
6450    } else if (node.type === "sizing") {
6451      glueOptions = options.havingSize(node.size);
6452    } else if (node.type === "styling") {
6453      glueOptions = options.havingStyle(styleMap[node.style]);
6454    }
6455  } // Dummy spans for determining spacings between surrounding atoms.
6456  // If `expression` has no atoms on the left or right, class "leftmost"
6457  // or "rightmost", respectively, is used to indicate it.
6458
6459
6460  var dummyPrev = buildHTML_makeSpan([surrounding[0] || "leftmost"], [], options);
6461  var dummyNext = buildHTML_makeSpan([surrounding[1] || "rightmost"], [], options); // TODO: These code assumes that a node's math class is the first element
6462  // of its `classes` array. A later cleanup should ensure this, for
6463  // instance by changing the signature of `makeSpan`.
6464  // Before determining what spaces to insert, perform bin cancellation.
6465  // Binary operators change to ordinary symbols in some contexts.
6466
6467  traverseNonSpaceNodes(groups, function (node, prev) {
6468    var prevType = prev.classes[0];
6469    var type = node.classes[0];
6470
6471    if (prevType === "mbin" && utils.contains(binRightCanceller, type)) {
6472      prev.classes[0] = "mord";
6473    } else if (type === "mbin" && utils.contains(binLeftCanceller, prevType)) {
6474      node.classes[0] = "mord";
6475    }
6476  }, {
6477    node: dummyPrev
6478  }, dummyNext);
6479  traverseNonSpaceNodes(groups, function (node, prev) {
6480    var prevType = getTypeOfDomTree(prev);
6481    var type = getTypeOfDomTree(node); // 'mtight' indicates that the node is script or scriptscript style.
6482
6483    var space = prevType && type ? node.hasClass("mtight") ? tightSpacings[prevType][type] : spacings[prevType][type] : null;
6484
6485    if (space) {
6486      // Insert glue (spacing) after the `prev`.
6487      return buildCommon.makeGlue(space, glueOptions);
6488    }
6489  }, {
6490    node: dummyPrev
6491  }, dummyNext);
6492  return groups;
6493}; // Depth-first traverse non-space `nodes`, calling `callback` with the current and
6494// previous node as arguments, optionally returning a node to insert after the
6495// previous node. `prev` is an object with the previous node and `insertAfter`
6496// function to insert after it. `next` is a node that will be added to the right.
6497// Used for bin cancellation and inserting spacings.
6498
6499var traverseNonSpaceNodes = function traverseNonSpaceNodes(nodes, callback, prev, next) {
6500  if (next) {
6501    // temporarily append the right node, if exists
6502    nodes.push(next);
6503  }
6504
6505  var i = 0;
6506
6507  for (; i < nodes.length; i++) {
6508    var node = nodes[i];
6509    var partialGroup = buildHTML_checkPartialGroup(node);
6510
6511    if (partialGroup) {
6512      // Recursive DFS
6513      // $FlowFixMe: make nodes a $ReadOnlyArray by returning a new array
6514      traverseNonSpaceNodes(partialGroup.children, callback, prev);
6515      continue;
6516    } // Ignore explicit spaces (e.g., \;, \,) when determining what implicit
6517    // spacing should go between atoms of different classes
6518
6519
6520    if (node.classes[0] === "mspace") {
6521      continue;
6522    }
6523
6524    var result = callback(node, prev.node);
6525
6526    if (result) {
6527      if (prev.insertAfter) {
6528        prev.insertAfter(result);
6529      } else {
6530        // insert at front
6531        nodes.unshift(result);
6532        i++;
6533      }
6534    }
6535
6536    prev.node = node;
6537
6538    prev.insertAfter = function (index) {
6539      return function (n) {
6540        nodes.splice(index + 1, 0, n);
6541        i++;
6542      };
6543    }(i);
6544  }
6545
6546  if (next) {
6547    nodes.pop();
6548  }
6549}; // Check if given node is a partial group, i.e., does not affect spacing around.
6550
6551
6552var buildHTML_checkPartialGroup = function checkPartialGroup(node) {
6553  if (node instanceof tree_DocumentFragment || node instanceof domTree_Anchor) {
6554    return node;
6555  }
6556
6557  return null;
6558}; // Return the outermost node of a domTree.
6559
6560
6561var getOutermostNode = function getOutermostNode(node, side) {
6562  var partialGroup = buildHTML_checkPartialGroup(node);
6563
6564  if (partialGroup) {
6565    var children = partialGroup.children;
6566
6567    if (children.length) {
6568      if (side === "right") {
6569        return getOutermostNode(children[children.length - 1], "right");
6570      } else if (side === "left") {
6571        return getOutermostNode(children[0], "left");
6572      }
6573    }
6574  }
6575
6576  return node;
6577}; // Return math atom class (mclass) of a domTree.
6578// If `side` is given, it will get the type of the outermost node at given side.
6579
6580
6581var getTypeOfDomTree = function getTypeOfDomTree(node, side) {
6582  if (!node) {
6583    return null;
6584  }
6585
6586  if (side) {
6587    node = getOutermostNode(node, side);
6588  } // This makes a lot of assumptions as to where the type of atom
6589  // appears.  We should do a better job of enforcing this.
6590
6591
6592  return DomEnum[node.classes[0]] || null;
6593};
6594var makeNullDelimiter = function makeNullDelimiter(options, classes) {
6595  var moreClasses = ["nulldelimiter"].concat(options.baseSizingClasses());
6596  return buildHTML_makeSpan(classes.concat(moreClasses));
6597};
6598/**
6599 * buildGroup is the function that takes a group and calls the correct groupType
6600 * function for it. It also handles the interaction of size and style changes
6601 * between parents and children.
6602 */
6603
6604var buildHTML_buildGroup = function buildGroup(group, options, baseOptions) {
6605  if (!group) {
6606    return buildHTML_makeSpan();
6607  }
6608
6609  if (_htmlGroupBuilders[group.type]) {
6610    // Call the groupBuilders function
6611    var groupNode = _htmlGroupBuilders[group.type](group, options); // If the size changed between the parent and the current group, account
6612    // for that size difference.
6613
6614    if (baseOptions && options.size !== baseOptions.size) {
6615      groupNode = buildHTML_makeSpan(options.sizingClasses(baseOptions), [groupNode], options);
6616      var multiplier = options.sizeMultiplier / baseOptions.sizeMultiplier;
6617      groupNode.height *= multiplier;
6618      groupNode.depth *= multiplier;
6619    }
6620
6621    return groupNode;
6622  } else {
6623    throw new src_ParseError("Got group of unknown type: '" + group.type + "'");
6624  }
6625};
6626/**
6627 * Combine an array of HTML DOM nodes (e.g., the output of `buildExpression`)
6628 * into an unbreakable HTML node of class .base, with proper struts to
6629 * guarantee correct vertical extent.  `buildHTML` calls this repeatedly to
6630 * make up the entire expression as a sequence of unbreakable units.
6631 */
6632
6633function buildHTMLUnbreakable(children, options) {
6634  // Compute height and depth of this chunk.
6635  var body = buildHTML_makeSpan(["base"], children, options); // Add strut, which ensures that the top of the HTML element falls at
6636  // the height of the expression, and the bottom of the HTML element
6637  // falls at the depth of the expression.
6638  // We used to have separate top and bottom struts, where the bottom strut
6639  // would like to use `vertical-align: top`, but in IE 9 this lowers the
6640  // baseline of the box to the bottom of this strut (instead of staying in
6641  // the normal place) so we use an absolute value for vertical-align instead.
6642
6643  var strut = buildHTML_makeSpan(["strut"]);
6644  strut.style.height = body.height + body.depth + "em";
6645  strut.style.verticalAlign = -body.depth + "em";
6646  body.children.unshift(strut);
6647  return body;
6648}
6649/**
6650 * Take an entire parse tree, and build it into an appropriate set of HTML
6651 * nodes.
6652 */
6653
6654
6655function buildHTML(tree, options) {
6656  // Strip off outer tag wrapper for processing below.
6657  var tag = null;
6658
6659  if (tree.length === 1 && tree[0].type === "tag") {
6660    tag = tree[0].tag;
6661    tree = tree[0].body;
6662  } // Build the expression contained in the tree
6663
6664
6665  var expression = buildHTML_buildExpression(tree, options, true);
6666  var children = []; // Create one base node for each chunk between potential line breaks.
6667  // The TeXBook [p.173] says "A formula will be broken only after a
6668  // relation symbol like $=$ or $<$ or $\rightarrow$, or after a binary
6669  // operation symbol like $+$ or $-$ or $\times$, where the relation or
6670  // binary operation is on the ``outer level'' of the formula (i.e., not
6671  // enclosed in {...} and not part of an \over construction)."
6672
6673  var parts = [];
6674
6675  for (var i = 0; i < expression.length; i++) {
6676    parts.push(expression[i]);
6677
6678    if (expression[i].hasClass("mbin") || expression[i].hasClass("mrel") || expression[i].hasClass("allowbreak")) {
6679      // Put any post-operator glue on same line as operator.
6680      // Watch for \nobreak along the way, and stop at \newline.
6681      var nobreak = false;
6682
6683      while (i < expression.length - 1 && expression[i + 1].hasClass("mspace") && !expression[i + 1].hasClass("newline")) {
6684        i++;
6685        parts.push(expression[i]);
6686
6687        if (expression[i].hasClass("nobreak")) {
6688          nobreak = true;
6689        }
6690      } // Don't allow break if \nobreak among the post-operator glue.
6691
6692
6693      if (!nobreak) {
6694        children.push(buildHTMLUnbreakable(parts, options));
6695        parts = [];
6696      }
6697    } else if (expression[i].hasClass("newline")) {
6698      // Write the line except the newline
6699      parts.pop();
6700
6701      if (parts.length > 0) {
6702        children.push(buildHTMLUnbreakable(parts, options));
6703        parts = [];
6704      } // Put the newline at the top level
6705
6706
6707      children.push(expression[i]);
6708    }
6709  }
6710
6711  if (parts.length > 0) {
6712    children.push(buildHTMLUnbreakable(parts, options));
6713  } // Now, if there was a tag, build it too and append it as a final child.
6714
6715
6716  var tagChild;
6717
6718  if (tag) {
6719    tagChild = buildHTMLUnbreakable(buildHTML_buildExpression(tag, options, true));
6720    tagChild.classes = ["tag"];
6721    children.push(tagChild);
6722  }
6723
6724  var htmlNode = buildHTML_makeSpan(["katex-html"], children);
6725  htmlNode.setAttribute("aria-hidden", "true"); // Adjust the strut of the tag to be the maximum height of all children
6726  // (the height of the enclosing htmlNode) for proper vertical alignment.
6727
6728  if (tagChild) {
6729    var strut = tagChild.children[0];
6730    strut.style.height = htmlNode.height + htmlNode.depth + "em";
6731    strut.style.verticalAlign = -htmlNode.depth + "em";
6732  }
6733
6734  return htmlNode;
6735}
6736// CONCATENATED MODULE: ./src/mathMLTree.js
6737/**
6738 * These objects store data about MathML nodes. This is the MathML equivalent
6739 * of the types in domTree.js. Since MathML handles its own rendering, and
6740 * since we're mainly using MathML to improve accessibility, we don't manage
6741 * any of the styling state that the plain DOM nodes do.
6742 *
6743 * The `toNode` and `toMarkup` functions work simlarly to how they do in
6744 * domTree.js, creating namespaced DOM nodes and HTML text markup respectively.
6745 */
6746
6747
6748function newDocumentFragment(children) {
6749  return new tree_DocumentFragment(children);
6750}
6751/**
6752 * This node represents a general purpose MathML node of any type. The
6753 * constructor requires the type of node to create (for example, `"mo"` or
6754 * `"mspace"`, corresponding to `<mo>` and `<mspace>` tags).
6755 */
6756
6757var mathMLTree_MathNode =
6758/*#__PURE__*/
6759function () {
6760  function MathNode(type, children) {
6761    this.type = void 0;
6762    this.attributes = void 0;
6763    this.children = void 0;
6764    this.type = type;
6765    this.attributes = {};
6766    this.children = children || [];
6767  }
6768  /**
6769   * Sets an attribute on a MathML node. MathML depends on attributes to convey a
6770   * semantic content, so this is used heavily.
6771   */
6772
6773
6774  var _proto = MathNode.prototype;
6775
6776  _proto.setAttribute = function setAttribute(name, value) {
6777    this.attributes[name] = value;
6778  }
6779  /**
6780   * Gets an attribute on a MathML node.
6781   */
6782  ;
6783
6784  _proto.getAttribute = function getAttribute(name) {
6785    return this.attributes[name];
6786  }
6787  /**
6788   * Converts the math node into a MathML-namespaced DOM element.
6789   */
6790  ;
6791
6792  _proto.toNode = function toNode() {
6793    var node = document.createElementNS("http://www.w3.org/1998/Math/MathML", this.type);
6794
6795    for (var attr in this.attributes) {
6796      if (Object.prototype.hasOwnProperty.call(this.attributes, attr)) {
6797        node.setAttribute(attr, this.attributes[attr]);
6798      }
6799    }
6800
6801    for (var i = 0; i < this.children.length; i++) {
6802      node.appendChild(this.children[i].toNode());
6803    }
6804
6805    return node;
6806  }
6807  /**
6808   * Converts the math node into an HTML markup string.
6809   */
6810  ;
6811
6812  _proto.toMarkup = function toMarkup() {
6813    var markup = "<" + this.type; // Add the attributes
6814
6815    for (var attr in this.attributes) {
6816      if (Object.prototype.hasOwnProperty.call(this.attributes, attr)) {
6817        markup += " " + attr + "=\"";
6818        markup += utils.escape(this.attributes[attr]);
6819        markup += "\"";
6820      }
6821    }
6822
6823    markup += ">";
6824
6825    for (var i = 0; i < this.children.length; i++) {
6826      markup += this.children[i].toMarkup();
6827    }
6828
6829    markup += "</" + this.type + ">";
6830    return markup;
6831  }
6832  /**
6833   * Converts the math node into a string, similar to innerText, but escaped.
6834   */
6835  ;
6836
6837  _proto.toText = function toText() {
6838    return this.children.map(function (child) {
6839      return child.toText();
6840    }).join("");
6841  };
6842
6843  return MathNode;
6844}();
6845/**
6846 * This node represents a piece of text.
6847 */
6848
6849var mathMLTree_TextNode =
6850/*#__PURE__*/
6851function () {
6852  function TextNode(text) {
6853    this.text = void 0;
6854    this.text = text;
6855  }
6856  /**
6857   * Converts the text node into a DOM text node.
6858   */
6859
6860
6861  var _proto2 = TextNode.prototype;
6862
6863  _proto2.toNode = function toNode() {
6864    return document.createTextNode(this.text);
6865  }
6866  /**
6867   * Converts the text node into escaped HTML markup
6868   * (representing the text itself).
6869   */
6870  ;
6871
6872  _proto2.toMarkup = function toMarkup() {
6873    return utils.escape(this.toText());
6874  }
6875  /**
6876   * Converts the text node into a string
6877   * (representing the text iteself).
6878   */
6879  ;
6880
6881  _proto2.toText = function toText() {
6882    return this.text;
6883  };
6884
6885  return TextNode;
6886}();
6887/**
6888 * This node represents a space, but may render as <mspace.../> or as text,
6889 * depending on the width.
6890 */
6891
6892var SpaceNode =
6893/*#__PURE__*/
6894function () {
6895  /**
6896   * Create a Space node with width given in CSS ems.
6897   */
6898  function SpaceNode(width) {
6899    this.width = void 0;
6900    this.character = void 0;
6901    this.width = width; // See https://www.w3.org/TR/2000/WD-MathML2-20000328/chapter6.html
6902    // for a table of space-like characters.  We use Unicode
6903    // representations instead of &LongNames; as it's not clear how to
6904    // make the latter via document.createTextNode.
6905
6906    if (width >= 0.05555 && width <= 0.05556) {
6907      this.character = "\u200A"; // &VeryThinSpace;
6908    } else if (width >= 0.1666 && width <= 0.1667) {
6909      this.character = "\u2009"; // &ThinSpace;
6910    } else if (width >= 0.2222 && width <= 0.2223) {
6911      this.character = "\u2005"; // &MediumSpace;
6912    } else if (width >= 0.2777 && width <= 0.2778) {
6913      this.character = "\u2005\u200A"; // &ThickSpace;
6914    } else if (width >= -0.05556 && width <= -0.05555) {
6915      this.character = "\u200A\u2063"; // &NegativeVeryThinSpace;
6916    } else if (width >= -0.1667 && width <= -0.1666) {
6917      this.character = "\u2009\u2063"; // &NegativeThinSpace;
6918    } else if (width >= -0.2223 && width <= -0.2222) {
6919      this.character = "\u205F\u2063"; // &NegativeMediumSpace;
6920    } else if (width >= -0.2778 && width <= -0.2777) {
6921      this.character = "\u2005\u2063"; // &NegativeThickSpace;
6922    } else {
6923      this.character = null;
6924    }
6925  }
6926  /**
6927   * Converts the math node into a MathML-namespaced DOM element.
6928   */
6929
6930
6931  var _proto3 = SpaceNode.prototype;
6932
6933  _proto3.toNode = function toNode() {
6934    if (this.character) {
6935      return document.createTextNode(this.character);
6936    } else {
6937      var node = document.createElementNS("http://www.w3.org/1998/Math/MathML", "mspace");
6938      node.setAttribute("width", this.width + "em");
6939      return node;
6940    }
6941  }
6942  /**
6943   * Converts the math node into an HTML markup string.
6944   */
6945  ;
6946
6947  _proto3.toMarkup = function toMarkup() {
6948    if (this.character) {
6949      return "<mtext>" + this.character + "</mtext>";
6950    } else {
6951      return "<mspace width=\"" + this.width + "em\"/>";
6952    }
6953  }
6954  /**
6955   * Converts the math node into a string, similar to innerText.
6956   */
6957  ;
6958
6959  _proto3.toText = function toText() {
6960    if (this.character) {
6961      return this.character;
6962    } else {
6963      return " ";
6964    }
6965  };
6966
6967  return SpaceNode;
6968}();
6969
6970/* harmony default export */ var mathMLTree = ({
6971  MathNode: mathMLTree_MathNode,
6972  TextNode: mathMLTree_TextNode,
6973  SpaceNode: SpaceNode,
6974  newDocumentFragment: newDocumentFragment
6975});
6976// CONCATENATED MODULE: ./src/buildMathML.js
6977/**
6978 * This file converts a parse tree into a cooresponding MathML tree. The main
6979 * entry point is the `buildMathML` function, which takes a parse tree from the
6980 * parser.
6981 */
6982
6983
6984
6985
6986
6987
6988
6989
6990
6991/**
6992 * Takes a symbol and converts it into a MathML text node after performing
6993 * optional replacement from symbols.js.
6994 */
6995var buildMathML_makeText = function makeText(text, mode, options) {
6996  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"))) {
6997    text = src_symbols[mode][text].replace;
6998  }
6999
7000  return new mathMLTree.TextNode(text);
7001};
7002/**
7003 * Wrap the given array of nodes in an <mrow> node if needed, i.e.,
7004 * unless the array has length 1.  Always returns a single node.
7005 */
7006
7007var buildMathML_makeRow = function makeRow(body) {
7008  if (body.length === 1) {
7009    return body[0];
7010  } else {
7011    return new mathMLTree.MathNode("mrow", body);
7012  }
7013};
7014/**
7015 * Returns the math variant as a string or null if none is required.
7016 */
7017
7018var buildMathML_getVariant = function getVariant(group, options) {
7019  // Handle \text... font specifiers as best we can.
7020  // MathML has a limited list of allowable mathvariant specifiers; see
7021  // https://www.w3.org/TR/MathML3/chapter3.html#presm.commatt
7022  if (options.fontFamily === "texttt") {
7023    return "monospace";
7024  } else if (options.fontFamily === "textsf") {
7025    if (options.fontShape === "textit" && options.fontWeight === "textbf") {
7026      return "sans-serif-bold-italic";
7027    } else if (options.fontShape === "textit") {
7028      return "sans-serif-italic";
7029    } else if (options.fontWeight === "textbf") {
7030      return "bold-sans-serif";
7031    } else {
7032      return "sans-serif";
7033    }
7034  } else if (options.fontShape === "textit" && options.fontWeight === "textbf") {
7035    return "bold-italic";
7036  } else if (options.fontShape === "textit") {
7037    return "italic";
7038  } else if (options.fontWeight === "textbf") {
7039    return "bold";
7040  }
7041
7042  var font = options.font;
7043
7044  if (!font || font === "mathnormal") {
7045    return null;
7046  }
7047
7048  var mode = group.mode;
7049
7050  if (font === "mathit") {
7051    return "italic";
7052  } else if (font === "boldsymbol") {
7053    return "bold-italic";
7054  } else if (font === "mathbf") {
7055    return "bold";
7056  } else if (font === "mathbb") {
7057    return "double-struck";
7058  } else if (font === "mathfrak") {
7059    return "fraktur";
7060  } else if (font === "mathscr" || font === "mathcal") {
7061    // MathML makes no distinction between script and caligrahpic
7062    return "script";
7063  } else if (font === "mathsf") {
7064    return "sans-serif";
7065  } else if (font === "mathtt") {
7066    return "monospace";
7067  }
7068
7069  var text = group.text;
7070
7071  if (utils.contains(["\\imath", "\\jmath"], text)) {
7072    return null;
7073  }
7074
7075  if (src_symbols[mode][text] && src_symbols[mode][text].replace) {
7076    text = src_symbols[mode][text].replace;
7077  }
7078
7079  var fontName = buildCommon.fontMap[font].fontName;
7080
7081  if (getCharacterMetrics(text, fontName, mode)) {
7082    return buildCommon.fontMap[font].variant;
7083  }
7084
7085  return null;
7086};
7087/**
7088 * Takes a list of nodes, builds them, and returns a list of the generated
7089 * MathML nodes.  Also combine consecutive <mtext> outputs into a single
7090 * <mtext> tag.
7091 */
7092
7093var buildMathML_buildExpression = function buildExpression(expression, options, isOrdgroup) {
7094  if (expression.length === 1) {
7095    var group = buildMathML_buildGroup(expression[0], options);
7096
7097    if (isOrdgroup && group instanceof mathMLTree_MathNode && group.type === "mo") {
7098      // When TeX writers want to suppress spacing on an operator,
7099      // they often put the operator by itself inside braces.
7100      group.setAttribute("lspace", "0em");
7101      group.setAttribute("rspace", "0em");
7102    }
7103
7104    return [group];
7105  }
7106
7107  var groups = [];
7108  var lastGroup;
7109
7110  for (var i = 0; i < expression.length; i++) {
7111    var _group = buildMathML_buildGroup(expression[i], options);
7112
7113    if (_group instanceof mathMLTree_MathNode && lastGroup instanceof mathMLTree_MathNode) {
7114      // Concatenate adjacent <mtext>s
7115      if (_group.type === 'mtext' && lastGroup.type === 'mtext' && _group.getAttribute('mathvariant') === lastGroup.getAttribute('mathvariant')) {
7116        var _lastGroup$children;
7117
7118        (_lastGroup$children = lastGroup.children).push.apply(_lastGroup$children, _group.children);
7119
7120        continue; // Concatenate adjacent <mn>s
7121      } else if (_group.type === 'mn' && lastGroup.type === 'mn') {
7122        var _lastGroup$children2;
7123
7124        (_lastGroup$children2 = lastGroup.children).push.apply(_lastGroup$children2, _group.children);
7125
7126        continue; // Concatenate <mn>...</mn> followed by <mi>.</mi>
7127      } else if (_group.type === 'mi' && _group.children.length === 1 && lastGroup.type === 'mn') {
7128        var child = _group.children[0];
7129
7130        if (child instanceof mathMLTree_TextNode && child.text === '.') {
7131          var _lastGroup$children3;
7132
7133          (_lastGroup$children3 = lastGroup.children).push.apply(_lastGroup$children3, _group.children);
7134
7135          continue;
7136        }
7137      } else if (lastGroup.type === 'mi' && lastGroup.children.length === 1) {
7138        var lastChild = lastGroup.children[0];
7139
7140        if (lastChild instanceof mathMLTree_TextNode && lastChild.text === "\u0338" && (_group.type === 'mo' || _group.type === 'mi' || _group.type === 'mn')) {
7141          var _child = _group.children[0];
7142
7143          if (_child instanceof mathMLTree_TextNode && _child.text.length > 0) {
7144            // Overlay with combining character long solidus
7145            _child.text = _child.text.slice(0, 1) + "\u0338" + _child.text.slice(1);
7146            groups.pop();
7147          }
7148        }
7149      }
7150    }
7151
7152    groups.push(_group);
7153    lastGroup = _group;
7154  }
7155
7156  return groups;
7157};
7158/**
7159 * Equivalent to buildExpression, but wraps the elements in an <mrow>
7160 * if there's more than one.  Returns a single node instead of an array.
7161 */
7162
7163var buildExpressionRow = function buildExpressionRow(expression, options, isOrdgroup) {
7164  return buildMathML_makeRow(buildMathML_buildExpression(expression, options, isOrdgroup));
7165};
7166/**
7167 * Takes a group from the parser and calls the appropriate groupBuilders function
7168 * on it to produce a MathML node.
7169 */
7170
7171var buildMathML_buildGroup = function buildGroup(group, options) {
7172  if (!group) {
7173    return new mathMLTree.MathNode("mrow");
7174  }
7175
7176  if (_mathmlGroupBuilders[group.type]) {
7177    // Call the groupBuilders function
7178    var result = _mathmlGroupBuilders[group.type](group, options);
7179    return result;
7180  } else {
7181    throw new src_ParseError("Got group of unknown type: '" + group.type + "'");
7182  }
7183};
7184/**
7185 * Takes a full parse tree and settings and builds a MathML representation of
7186 * it. In particular, we put the elements from building the parse tree into a
7187 * <semantics> tag so we can also include that TeX source as an annotation.
7188 *
7189 * Note that we actually return a domTree element with a `<math>` inside it so
7190 * we can do appropriate styling.
7191 */
7192
7193function buildMathML(tree, texExpression, options, forMathmlOnly) {
7194  var expression = buildMathML_buildExpression(tree, options); // Wrap up the expression in an mrow so it is presented in the semantics
7195  // tag correctly, unless it's a single <mrow> or <mtable>.
7196
7197  var wrapper;
7198
7199  if (expression.length === 1 && expression[0] instanceof mathMLTree_MathNode && utils.contains(["mrow", "mtable"], expression[0].type)) {
7200    wrapper = expression[0];
7201  } else {
7202    wrapper = new mathMLTree.MathNode("mrow", expression);
7203  } // Build a TeX annotation of the source
7204
7205
7206  var annotation = new mathMLTree.MathNode("annotation", [new mathMLTree.TextNode(texExpression)]);
7207  annotation.setAttribute("encoding", "application/x-tex");
7208  var semantics = new mathMLTree.MathNode("semantics", [wrapper, annotation]);
7209  var math = new mathMLTree.MathNode("math", [semantics]);
7210  math.setAttribute("xmlns", "http://www.w3.org/1998/Math/MathML"); // You can't style <math> nodes, so we wrap the node in a span.
7211  // NOTE: The span class is not typed to have <math> nodes as children, and
7212  // we don't want to make the children type more generic since the children
7213  // of span are expected to have more fields in `buildHtml` contexts.
7214
7215  var wrapperClass = forMathmlOnly ? "katex" : "katex-mathml"; // $FlowFixMe
7216
7217  return buildCommon.makeSpan([wrapperClass], [math]);
7218}
7219// CONCATENATED MODULE: ./src/buildTree.js
7220
7221
7222
7223
7224
7225
7226
7227var buildTree_optionsFromSettings = function optionsFromSettings(settings) {
7228  return new src_Options({
7229    style: settings.displayMode ? src_Style.DISPLAY : src_Style.TEXT,
7230    maxSize: settings.maxSize,
7231    minRuleThickness: settings.minRuleThickness
7232  });
7233};
7234
7235var buildTree_displayWrap = function displayWrap(node, settings) {
7236  if (settings.displayMode) {
7237    var classes = ["katex-display"];
7238
7239    if (settings.leqno) {
7240      classes.push("leqno");
7241    }
7242
7243    if (settings.fleqn) {
7244      classes.push("fleqn");
7245    }
7246
7247    node = buildCommon.makeSpan(classes, [node]);
7248  }
7249
7250  return node;
7251};
7252
7253var buildTree_buildTree = function buildTree(tree, expression, settings) {
7254  var options = buildTree_optionsFromSettings(settings);
7255  var katexNode;
7256
7257  if (settings.output === "mathml") {
7258    return buildMathML(tree, expression, options, true);
7259  } else if (settings.output === "html") {
7260    var htmlNode = buildHTML(tree, options);
7261    katexNode = buildCommon.makeSpan(["katex"], [htmlNode]);
7262  } else {
7263    var mathMLNode = buildMathML(tree, expression, options, false);
7264
7265    var _htmlNode = buildHTML(tree, options);
7266
7267    katexNode = buildCommon.makeSpan(["katex"], [mathMLNode, _htmlNode]);
7268  }
7269
7270  return buildTree_displayWrap(katexNode, settings);
7271};
7272var buildTree_buildHTMLTree = function buildHTMLTree(tree, expression, settings) {
7273  var options = buildTree_optionsFromSettings(settings);
7274  var htmlNode = buildHTML(tree, options);
7275  var katexNode = buildCommon.makeSpan(["katex"], [htmlNode]);
7276  return buildTree_displayWrap(katexNode, settings);
7277};
7278/* harmony default export */ var src_buildTree = (buildTree_buildTree);
7279// CONCATENATED MODULE: ./src/stretchy.js
7280/**
7281 * This file provides support to buildMathML.js and buildHTML.js
7282 * for stretchy wide elements rendered from SVG files
7283 * and other CSS trickery.
7284 */
7285
7286
7287
7288
7289var stretchyCodePoint = {
7290  widehat: "^",
7291  widecheck: "ˇ",
7292  widetilde: "~",
7293  utilde: "~",
7294  overleftarrow: "\u2190",
7295  underleftarrow: "\u2190",
7296  xleftarrow: "\u2190",
7297  overrightarrow: "\u2192",
7298  underrightarrow: "\u2192",
7299  xrightarrow: "\u2192",
7300  underbrace: "\u23DF",
7301  overbrace: "\u23DE",
7302  overgroup: "\u23E0",
7303  undergroup: "\u23E1",
7304  overleftrightarrow: "\u2194",
7305  underleftrightarrow: "\u2194",
7306  xleftrightarrow: "\u2194",
7307  Overrightarrow: "\u21D2",
7308  xRightarrow: "\u21D2",
7309  overleftharpoon: "\u21BC",
7310  xleftharpoonup: "\u21BC",
7311  overrightharpoon: "\u21C0",
7312  xrightharpoonup: "\u21C0",
7313  xLeftarrow: "\u21D0",
7314  xLeftrightarrow: "\u21D4",
7315  xhookleftarrow: "\u21A9",
7316  xhookrightarrow: "\u21AA",
7317  xmapsto: "\u21A6",
7318  xrightharpoondown: "\u21C1",
7319  xleftharpoondown: "\u21BD",
7320  xrightleftharpoons: "\u21CC",
7321  xleftrightharpoons: "\u21CB",
7322  xtwoheadleftarrow: "\u219E",
7323  xtwoheadrightarrow: "\u21A0",
7324  xlongequal: "=",
7325  xtofrom: "\u21C4",
7326  xrightleftarrows: "\u21C4",
7327  xrightequilibrium: "\u21CC",
7328  // Not a perfect match.
7329  xleftequilibrium: "\u21CB" // None better available.
7330
7331};
7332
7333var stretchy_mathMLnode = function mathMLnode(label) {
7334  var node = new mathMLTree.MathNode("mo", [new mathMLTree.TextNode(stretchyCodePoint[label.substr(1)])]);
7335  node.setAttribute("stretchy", "true");
7336  return node;
7337}; // Many of the KaTeX SVG images have been adapted from glyphs in KaTeX fonts.
7338// Copyright (c) 2009-2010, Design Science, Inc. (<www.mathjax.org>)
7339// Copyright (c) 2014-2017 Khan Academy (<www.khanacademy.org>)
7340// Licensed under the SIL Open Font License, Version 1.1.
7341// See \nhttp://scripts.sil.org/OFL
7342// Very Long SVGs
7343//    Many of the KaTeX stretchy wide elements use a long SVG image and an
7344//    overflow: hidden tactic to achieve a stretchy image while avoiding
7345//    distortion of arrowheads or brace corners.
7346//    The SVG typically contains a very long (400 em) arrow.
7347//    The SVG is in a container span that has overflow: hidden, so the span
7348//    acts like a window that exposes only part of the  SVG.
7349//    The SVG always has a longer, thinner aspect ratio than the container span.
7350//    After the SVG fills 100% of the height of the container span,
7351//    there is a long arrow shaft left over. That left-over shaft is not shown.
7352//    Instead, it is sliced off because the span's CSS has overflow: hidden.
7353//    Thus, the reader sees an arrow that matches the subject matter width
7354//    without distortion.
7355//    Some functions, such as \cancel, need to vary their aspect ratio. These
7356//    functions do not get the overflow SVG treatment.
7357// Second Brush Stroke
7358//    Low resolution monitors struggle to display images in fine detail.
7359//    So browsers apply anti-aliasing. A long straight arrow shaft therefore
7360//    will sometimes appear as if it has a blurred edge.
7361//    To mitigate this, these SVG files contain a second "brush-stroke" on the
7362//    arrow shafts. That is, a second long thin rectangular SVG path has been
7363//    written directly on top of each arrow shaft. This reinforcement causes
7364//    some of the screen pixels to display as black instead of the anti-aliased
7365//    gray pixel that a  single path would generate. So we get arrow shafts
7366//    whose edges appear to be sharper.
7367// In the katexImagesData object just below, the dimensions all
7368// correspond to path geometry inside the relevant SVG.
7369// For example, \overrightarrow uses the same arrowhead as glyph U+2192
7370// from the KaTeX Main font. The scaling factor is 1000.
7371// That is, inside the font, that arrowhead is 522 units tall, which
7372// corresponds to 0.522 em inside the document.
7373
7374
7375var katexImagesData = {
7376  //   path(s), minWidth, height, align
7377  overrightarrow: [["rightarrow"], 0.888, 522, "xMaxYMin"],
7378  overleftarrow: [["leftarrow"], 0.888, 522, "xMinYMin"],
7379  underrightarrow: [["rightarrow"], 0.888, 522, "xMaxYMin"],
7380  underleftarrow: [["leftarrow"], 0.888, 522, "xMinYMin"],
7381  xrightarrow: [["rightarrow"], 1.469, 522, "xMaxYMin"],
7382  xleftarrow: [["leftarrow"], 1.469, 522, "xMinYMin"],
7383  Overrightarrow: [["doublerightarrow"], 0.888, 560, "xMaxYMin"],
7384  xRightarrow: [["doublerightarrow"], 1.526, 560, "xMaxYMin"],
7385  xLeftarrow: [["doubleleftarrow"], 1.526, 560, "xMinYMin"],
7386  overleftharpoon: [["leftharpoon"], 0.888, 522, "xMinYMin"],
7387  xleftharpoonup: [["leftharpoon"], 0.888, 522, "xMinYMin"],
7388  xleftharpoondown: [["leftharpoondown"], 0.888, 522, "xMinYMin"],
7389  overrightharpoon: [["rightharpoon"], 0.888, 522, "xMaxYMin"],
7390  xrightharpoonup: [["rightharpoon"], 0.888, 522, "xMaxYMin"],
7391  xrightharpoondown: [["rightharpoondown"], 0.888, 522, "xMaxYMin"],
7392  xlongequal: [["longequal"], 0.888, 334, "xMinYMin"],
7393  xtwoheadleftarrow: [["twoheadleftarrow"], 0.888, 334, "xMinYMin"],
7394  xtwoheadrightarrow: [["twoheadrightarrow"], 0.888, 334, "xMaxYMin"],
7395  overleftrightarrow: [["leftarrow", "rightarrow"], 0.888, 522],
7396  overbrace: [["leftbrace", "midbrace", "rightbrace"], 1.6, 548],
7397  underbrace: [["leftbraceunder", "midbraceunder", "rightbraceunder"], 1.6, 548],
7398  underleftrightarrow: [["leftarrow", "rightarrow"], 0.888, 522],
7399  xleftrightarrow: [["leftarrow", "rightarrow"], 1.75, 522],
7400  xLeftrightarrow: [["doubleleftarrow", "doublerightarrow"], 1.75, 560],
7401  xrightleftharpoons: [["leftharpoondownplus", "rightharpoonplus"], 1.75, 716],
7402  xleftrightharpoons: [["leftharpoonplus", "rightharpoondownplus"], 1.75, 716],
7403  xhookleftarrow: [["leftarrow", "righthook"], 1.08, 522],
7404  xhookrightarrow: [["lefthook", "rightarrow"], 1.08, 522],
7405  overlinesegment: [["leftlinesegment", "rightlinesegment"], 0.888, 522],
7406  underlinesegment: [["leftlinesegment", "rightlinesegment"], 0.888, 522],
7407  overgroup: [["leftgroup", "rightgroup"], 0.888, 342],
7408  undergroup: [["leftgroupunder", "rightgroupunder"], 0.888, 342],
7409  xmapsto: [["leftmapsto", "rightarrow"], 1.5, 522],
7410  xtofrom: [["leftToFrom", "rightToFrom"], 1.75, 528],
7411  // The next three arrows are from the mhchem package.
7412  // In mhchem.sty, min-length is 2.0em. But these arrows might appear in the
7413  // document as \xrightarrow or \xrightleftharpoons. Those have
7414  // min-length = 1.75em, so we set min-length on these next three to match.
7415  xrightleftarrows: [["baraboveleftarrow", "rightarrowabovebar"], 1.75, 901],
7416  xrightequilibrium: [["baraboveshortleftharpoon", "rightharpoonaboveshortbar"], 1.75, 716],
7417  xleftequilibrium: [["shortbaraboveleftharpoon", "shortrightharpoonabovebar"], 1.75, 716]
7418};
7419
7420var groupLength = function groupLength(arg) {
7421  if (arg.type === "ordgroup") {
7422    return arg.body.length;
7423  } else {
7424    return 1;
7425  }
7426};
7427
7428var stretchy_svgSpan = function svgSpan(group, options) {
7429  // Create a span with inline SVG for the element.
7430  function buildSvgSpan_() {
7431    var viewBoxWidth = 400000; // default
7432
7433    var label = group.label.substr(1);
7434
7435    if (utils.contains(["widehat", "widecheck", "widetilde", "utilde"], label)) {
7436      // Each type in the `if` statement corresponds to one of the ParseNode
7437      // types below. This narrowing is required to access `grp.base`.
7438      var grp = group; // There are four SVG images available for each function.
7439      // Choose a taller image when there are more characters.
7440
7441      var numChars = groupLength(grp.base);
7442      var viewBoxHeight;
7443      var pathName;
7444
7445      var _height;
7446
7447      if (numChars > 5) {
7448        if (label === "widehat" || label === "widecheck") {
7449          viewBoxHeight = 420;
7450          viewBoxWidth = 2364;
7451          _height = 0.42;
7452          pathName = label + "4";
7453        } else {
7454          viewBoxHeight = 312;
7455          viewBoxWidth = 2340;
7456          _height = 0.34;
7457          pathName = "tilde4";
7458        }
7459      } else {
7460        var imgIndex = [1, 1, 2, 2, 3, 3][numChars];
7461
7462        if (label === "widehat" || label === "widecheck") {
7463          viewBoxWidth = [0, 1062, 2364, 2364, 2364][imgIndex];
7464          viewBoxHeight = [0, 239, 300, 360, 420][imgIndex];
7465          _height = [0, 0.24, 0.3, 0.3, 0.36, 0.42][imgIndex];
7466          pathName = label + imgIndex;
7467        } else {
7468          viewBoxWidth = [0, 600, 1033, 2339, 2340][imgIndex];
7469          viewBoxHeight = [0, 260, 286, 306, 312][imgIndex];
7470          _height = [0, 0.26, 0.286, 0.3, 0.306, 0.34][imgIndex];
7471          pathName = "tilde" + imgIndex;
7472        }
7473      }
7474
7475      var path = new domTree_PathNode(pathName);
7476      var svgNode = new SvgNode([path], {
7477        "width": "100%",
7478        "height": _height + "em",
7479        "viewBox": "0 0 " + viewBoxWidth + " " + viewBoxHeight,
7480        "preserveAspectRatio": "none"
7481      });
7482      return {
7483        span: buildCommon.makeSvgSpan([], [svgNode], options),
7484        minWidth: 0,
7485        height: _height
7486      };
7487    } else {
7488      var spans = [];
7489      var data = katexImagesData[label];
7490      var paths = data[0],
7491          _minWidth = data[1],
7492          _viewBoxHeight = data[2];
7493
7494      var _height2 = _viewBoxHeight / 1000;
7495
7496      var numSvgChildren = paths.length;
7497      var widthClasses;
7498      var aligns;
7499
7500      if (numSvgChildren === 1) {
7501        // $FlowFixMe: All these cases must be of the 4-tuple type.
7502        var align1 = data[3];
7503        widthClasses = ["hide-tail"];
7504        aligns = [align1];
7505      } else if (numSvgChildren === 2) {
7506        widthClasses = ["halfarrow-left", "halfarrow-right"];
7507        aligns = ["xMinYMin", "xMaxYMin"];
7508      } else if (numSvgChildren === 3) {
7509        widthClasses = ["brace-left", "brace-center", "brace-right"];
7510        aligns = ["xMinYMin", "xMidYMin", "xMaxYMin"];
7511      } else {
7512        throw new Error("Correct katexImagesData or update code here to support\n                    " + numSvgChildren + " children.");
7513      }
7514
7515      for (var i = 0; i < numSvgChildren; i++) {
7516        var _path = new domTree_PathNode(paths[i]);
7517
7518        var _svgNode = new SvgNode([_path], {
7519          "width": "400em",
7520          "height": _height2 + "em",
7521          "viewBox": "0 0 " + viewBoxWidth + " " + _viewBoxHeight,
7522          "preserveAspectRatio": aligns[i] + " slice"
7523        });
7524
7525        var _span = buildCommon.makeSvgSpan([widthClasses[i]], [_svgNode], options);
7526
7527        if (numSvgChildren === 1) {
7528          return {
7529            span: _span,
7530            minWidth: _minWidth,
7531            height: _height2
7532          };
7533        } else {
7534          _span.style.height = _height2 + "em";
7535          spans.push(_span);
7536        }
7537      }
7538
7539      return {
7540        span: buildCommon.makeSpan(["stretchy"], spans, options),
7541        minWidth: _minWidth,
7542        height: _height2
7543      };
7544    }
7545  } // buildSvgSpan_()
7546
7547
7548  var _buildSvgSpan_ = buildSvgSpan_(),
7549      span = _buildSvgSpan_.span,
7550      minWidth = _buildSvgSpan_.minWidth,
7551      height = _buildSvgSpan_.height; // Note that we are returning span.depth = 0.
7552  // Any adjustments relative to the baseline must be done in buildHTML.
7553
7554
7555  span.height = height;
7556  span.style.height = height + "em";
7557
7558  if (minWidth > 0) {
7559    span.style.minWidth = minWidth + "em";
7560  }
7561
7562  return span;
7563};
7564
7565var stretchy_encloseSpan = function encloseSpan(inner, label, pad, options) {
7566  // Return an image span for \cancel, \bcancel, \xcancel, or \fbox
7567  var img;
7568  var totalHeight = inner.height + inner.depth + 2 * pad;
7569
7570  if (/fbox|color/.test(label)) {
7571    img = buildCommon.makeSpan(["stretchy", label], [], options);
7572
7573    if (label === "fbox") {
7574      var color = options.color && options.getColor();
7575
7576      if (color) {
7577        img.style.borderColor = color;
7578      }
7579    }
7580  } else {
7581    // \cancel, \bcancel, or \xcancel
7582    // Since \cancel's SVG is inline and it omits the viewBox attribute,
7583    // its stroke-width will not vary with span area.
7584    var lines = [];
7585
7586    if (/^[bx]cancel$/.test(label)) {
7587      lines.push(new LineNode({
7588        "x1": "0",
7589        "y1": "0",
7590        "x2": "100%",
7591        "y2": "100%",
7592        "stroke-width": "0.046em"
7593      }));
7594    }
7595
7596    if (/^x?cancel$/.test(label)) {
7597      lines.push(new LineNode({
7598        "x1": "0",
7599        "y1": "100%",
7600        "x2": "100%",
7601        "y2": "0",
7602        "stroke-width": "0.046em"
7603      }));
7604    }
7605
7606    var svgNode = new SvgNode(lines, {
7607      "width": "100%",
7608      "height": totalHeight + "em"
7609    });
7610    img = buildCommon.makeSvgSpan([], [svgNode], options);
7611  }
7612
7613  img.height = totalHeight;
7614  img.style.height = totalHeight + "em";
7615  return img;
7616};
7617
7618/* harmony default export */ var stretchy = ({
7619  encloseSpan: stretchy_encloseSpan,
7620  mathMLnode: stretchy_mathMLnode,
7621  svgSpan: stretchy_svgSpan
7622});
7623// CONCATENATED MODULE: ./src/functions/accent.js
7624
7625
7626
7627
7628
7629
7630
7631
7632
7633// NOTE: Unlike most `htmlBuilder`s, this one handles not only "accent", but
7634var accent_htmlBuilder = function htmlBuilder(grp, options) {
7635  // Accents are handled in the TeXbook pg. 443, rule 12.
7636  var base;
7637  var group;
7638  var supSub = checkNodeType(grp, "supsub");
7639  var supSubGroup;
7640
7641  if (supSub) {
7642    // If our base is a character box, and we have superscripts and
7643    // subscripts, the supsub will defer to us. In particular, we want
7644    // to attach the superscripts and subscripts to the inner body (so
7645    // that the position of the superscripts and subscripts won't be
7646    // affected by the height of the accent). We accomplish this by
7647    // sticking the base of the accent into the base of the supsub, and
7648    // rendering that, while keeping track of where the accent is.
7649    // The real accent group is the base of the supsub group
7650    group = assertNodeType(supSub.base, "accent"); // The character box is the base of the accent group
7651
7652    base = group.base; // Stick the character box into the base of the supsub group
7653
7654    supSub.base = base; // Rerender the supsub group with its new base, and store that
7655    // result.
7656
7657    supSubGroup = assertSpan(buildHTML_buildGroup(supSub, options)); // reset original base
7658
7659    supSub.base = group;
7660  } else {
7661    group = assertNodeType(grp, "accent");
7662    base = group.base;
7663  } // Build the base group
7664
7665
7666  var body = buildHTML_buildGroup(base, options.havingCrampedStyle()); // Does the accent need to shift for the skew of a character?
7667
7668  var mustShift = group.isShifty && utils.isCharacterBox(base); // Calculate the skew of the accent. This is based on the line "If the
7669  // nucleus is not a single character, let s = 0; otherwise set s to the
7670  // kern amount for the nucleus followed by the \skewchar of its font."
7671  // Note that our skew metrics are just the kern between each character
7672  // and the skewchar.
7673
7674  var skew = 0;
7675
7676  if (mustShift) {
7677    // If the base is a character box, then we want the skew of the
7678    // innermost character. To do that, we find the innermost character:
7679    var baseChar = utils.getBaseElem(base); // Then, we render its group to get the symbol inside it
7680
7681    var baseGroup = buildHTML_buildGroup(baseChar, options.havingCrampedStyle()); // Finally, we pull the skew off of the symbol.
7682
7683    skew = assertSymbolDomNode(baseGroup).skew; // Note that we now throw away baseGroup, because the layers we
7684    // removed with getBaseElem might contain things like \color which
7685    // we can't get rid of.
7686    // TODO(emily): Find a better way to get the skew
7687  } // calculate the amount of space between the body and the accent
7688
7689
7690  var clearance = Math.min(body.height, options.fontMetrics().xHeight); // Build the accent
7691
7692  var accentBody;
7693
7694  if (!group.isStretchy) {
7695    var accent;
7696    var width;
7697
7698    if (group.label === "\\vec") {
7699      // Before version 0.9, \vec used the combining font glyph U+20D7.
7700      // But browsers, especially Safari, are not consistent in how they
7701      // render combining characters when not preceded by a character.
7702      // So now we use an SVG.
7703      // If Safari reforms, we should consider reverting to the glyph.
7704      accent = buildCommon.staticSvg("vec", options);
7705      width = buildCommon.svgData.vec[1];
7706    } else {
7707      accent = buildCommon.makeOrd({
7708        mode: group.mode,
7709        text: group.label
7710      }, options, "textord");
7711      accent = assertSymbolDomNode(accent); // Remove the italic correction of the accent, because it only serves to
7712      // shift the accent over to a place we don't want.
7713
7714      accent.italic = 0;
7715      width = accent.width;
7716    }
7717
7718    accentBody = buildCommon.makeSpan(["accent-body"], [accent]); // "Full" accents expand the width of the resulting symbol to be
7719    // at least the width of the accent, and overlap directly onto the
7720    // character without any vertical offset.
7721
7722    var accentFull = group.label === "\\textcircled";
7723
7724    if (accentFull) {
7725      accentBody.classes.push('accent-full');
7726      clearance = body.height;
7727    } // Shift the accent over by the skew.
7728
7729
7730    var left = skew; // CSS defines `.katex .accent .accent-body:not(.accent-full) { width: 0 }`
7731    // so that the accent doesn't contribute to the bounding box.
7732    // We need to shift the character by its width (effectively half
7733    // its width) to compensate.
7734
7735    if (!accentFull) {
7736      left -= width / 2;
7737    }
7738
7739    accentBody.style.left = left + "em"; // \textcircled uses the \bigcirc glyph, so it needs some
7740    // vertical adjustment to match LaTeX.
7741
7742    if (group.label === "\\textcircled") {
7743      accentBody.style.top = ".2em";
7744    }
7745
7746    accentBody = buildCommon.makeVList({
7747      positionType: "firstBaseline",
7748      children: [{
7749        type: "elem",
7750        elem: body
7751      }, {
7752        type: "kern",
7753        size: -clearance
7754      }, {
7755        type: "elem",
7756        elem: accentBody
7757      }]
7758    }, options);
7759  } else {
7760    accentBody = stretchy.svgSpan(group, options);
7761    accentBody = buildCommon.makeVList({
7762      positionType: "firstBaseline",
7763      children: [{
7764        type: "elem",
7765        elem: body
7766      }, {
7767        type: "elem",
7768        elem: accentBody,
7769        wrapperClasses: ["svg-align"],
7770        wrapperStyle: skew > 0 ? {
7771          width: "calc(100% - " + 2 * skew + "em)",
7772          marginLeft: 2 * skew + "em"
7773        } : undefined
7774      }]
7775    }, options);
7776  }
7777
7778  var accentWrap = buildCommon.makeSpan(["mord", "accent"], [accentBody], options);
7779
7780  if (supSubGroup) {
7781    // Here, we replace the "base" child of the supsub with our newly
7782    // generated accent.
7783    supSubGroup.children[0] = accentWrap; // Since we don't rerun the height calculation after replacing the
7784    // accent, we manually recalculate height.
7785
7786    supSubGroup.height = Math.max(accentWrap.height, supSubGroup.height); // Accents should always be ords, even when their innards are not.
7787
7788    supSubGroup.classes[0] = "mord";
7789    return supSubGroup;
7790  } else {
7791    return accentWrap;
7792  }
7793};
7794
7795var accent_mathmlBuilder = function mathmlBuilder(group, options) {
7796  var accentNode = group.isStretchy ? stretchy.mathMLnode(group.label) : new mathMLTree.MathNode("mo", [buildMathML_makeText(group.label, group.mode)]);
7797  var node = new mathMLTree.MathNode("mover", [buildMathML_buildGroup(group.base, options), accentNode]);
7798  node.setAttribute("accent", "true");
7799  return node;
7800};
7801
7802var NON_STRETCHY_ACCENT_REGEX = new RegExp(["\\acute", "\\grave", "\\ddot", "\\tilde", "\\bar", "\\breve", "\\check", "\\hat", "\\vec", "\\dot", "\\mathring"].map(function (accent) {
7803  return "\\" + accent;
7804}).join("|")); // Accents
7805
7806defineFunction({
7807  type: "accent",
7808  names: ["\\acute", "\\grave", "\\ddot", "\\tilde", "\\bar", "\\breve", "\\check", "\\hat", "\\vec", "\\dot", "\\mathring", "\\widecheck", "\\widehat", "\\widetilde", "\\overrightarrow", "\\overleftarrow", "\\Overrightarrow", "\\overleftrightarrow", "\\overgroup", "\\overlinesegment", "\\overleftharpoon", "\\overrightharpoon"],
7809  props: {
7810    numArgs: 1
7811  },
7812  handler: function handler(context, args) {
7813    var base = args[0];
7814    var isStretchy = !NON_STRETCHY_ACCENT_REGEX.test(context.funcName);
7815    var isShifty = !isStretchy || context.funcName === "\\widehat" || context.funcName === "\\widetilde" || context.funcName === "\\widecheck";
7816    return {
7817      type: "accent",
7818      mode: context.parser.mode,
7819      label: context.funcName,
7820      isStretchy: isStretchy,
7821      isShifty: isShifty,
7822      base: base
7823    };
7824  },
7825  htmlBuilder: accent_htmlBuilder,
7826  mathmlBuilder: accent_mathmlBuilder
7827}); // Text-mode accents
7828
7829defineFunction({
7830  type: "accent",
7831  names: ["\\'", "\\`", "\\^", "\\~", "\\=", "\\u", "\\.", '\\"', "\\r", "\\H", "\\v", "\\textcircled"],
7832  props: {
7833    numArgs: 1,
7834    allowedInText: true,
7835    allowedInMath: false
7836  },
7837  handler: function handler(context, args) {
7838    var base = args[0];
7839    return {
7840      type: "accent",
7841      mode: context.parser.mode,
7842      label: context.funcName,
7843      isStretchy: false,
7844      isShifty: true,
7845      base: base
7846    };
7847  },
7848  htmlBuilder: accent_htmlBuilder,
7849  mathmlBuilder: accent_mathmlBuilder
7850});
7851// CONCATENATED MODULE: ./src/functions/accentunder.js
7852// Horizontal overlap functions
7853
7854
7855
7856
7857
7858
7859defineFunction({
7860  type: "accentUnder",
7861  names: ["\\underleftarrow", "\\underrightarrow", "\\underleftrightarrow", "\\undergroup", "\\underlinesegment", "\\utilde"],
7862  props: {
7863    numArgs: 1
7864  },
7865  handler: function handler(_ref, args) {
7866    var parser = _ref.parser,
7867        funcName = _ref.funcName;
7868    var base = args[0];
7869    return {
7870      type: "accentUnder",
7871      mode: parser.mode,
7872      label: funcName,
7873      base: base
7874    };
7875  },
7876  htmlBuilder: function htmlBuilder(group, options) {
7877    // Treat under accents much like underlines.
7878    var innerGroup = buildHTML_buildGroup(group.base, options);
7879    var accentBody = stretchy.svgSpan(group, options);
7880    var kern = group.label === "\\utilde" ? 0.12 : 0; // Generate the vlist, with the appropriate kerns
7881
7882    var vlist = buildCommon.makeVList({
7883      positionType: "bottom",
7884      positionData: accentBody.height + kern,
7885      children: [{
7886        type: "elem",
7887        elem: accentBody,
7888        wrapperClasses: ["svg-align"]
7889      }, {
7890        type: "kern",
7891        size: kern
7892      }, {
7893        type: "elem",
7894        elem: innerGroup
7895      }]
7896    }, options);
7897    return buildCommon.makeSpan(["mord", "accentunder"], [vlist], options);
7898  },
7899  mathmlBuilder: function mathmlBuilder(group, options) {
7900    var accentNode = stretchy.mathMLnode(group.label);
7901    var node = new mathMLTree.MathNode("munder", [buildMathML_buildGroup(group.base, options), accentNode]);
7902    node.setAttribute("accentunder", "true");
7903    return node;
7904  }
7905});
7906// CONCATENATED MODULE: ./src/functions/arrow.js
7907
7908
7909
7910
7911
7912
7913
7914// Helper function
7915var arrow_paddedNode = function paddedNode(group) {
7916  var node = new mathMLTree.MathNode("mpadded", group ? [group] : []);
7917  node.setAttribute("width", "+0.6em");
7918  node.setAttribute("lspace", "0.3em");
7919  return node;
7920}; // Stretchy arrows with an optional argument
7921
7922
7923defineFunction({
7924  type: "xArrow",
7925  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.
7926  // Direct use of these functions is discouraged and may break someday.
7927  "\\xrightleftarrows", "\\xrightequilibrium", "\\xleftequilibrium"],
7928  props: {
7929    numArgs: 1,
7930    numOptionalArgs: 1
7931  },
7932  handler: function handler(_ref, args, optArgs) {
7933    var parser = _ref.parser,
7934        funcName = _ref.funcName;
7935    return {
7936      type: "xArrow",
7937      mode: parser.mode,
7938      label: funcName,
7939      body: args[0],
7940      below: optArgs[0]
7941    };
7942  },
7943  // Flow is unable to correctly infer the type of `group`, even though it's
7944  // unamibiguously determined from the passed-in `type` above.
7945  htmlBuilder: function htmlBuilder(group, options) {
7946    var style = options.style; // Build the argument groups in the appropriate style.
7947    // Ref: amsmath.dtx:   \hbox{$\scriptstyle\mkern#3mu{#6}\mkern#4mu$}%
7948    // Some groups can return document fragments.  Handle those by wrapping
7949    // them in a span.
7950
7951    var newOptions = options.havingStyle(style.sup());
7952    var upperGroup = buildCommon.wrapFragment(buildHTML_buildGroup(group.body, newOptions, options), options);
7953    upperGroup.classes.push("x-arrow-pad");
7954    var lowerGroup;
7955
7956    if (group.below) {
7957      // Build the lower group
7958      newOptions = options.havingStyle(style.sub());
7959      lowerGroup = buildCommon.wrapFragment(buildHTML_buildGroup(group.below, newOptions, options), options);
7960      lowerGroup.classes.push("x-arrow-pad");
7961    }
7962
7963    var arrowBody = stretchy.svgSpan(group, options); // Re shift: Note that stretchy.svgSpan returned arrowBody.depth = 0.
7964    // The point we want on the math axis is at 0.5 * arrowBody.height.
7965
7966    var arrowShift = -options.fontMetrics().axisHeight + 0.5 * arrowBody.height; // 2 mu kern. Ref: amsmath.dtx: #7\if0#2\else\mkern#2mu\fi
7967
7968    var upperShift = -options.fontMetrics().axisHeight - 0.5 * arrowBody.height - 0.111; // 0.111 em = 2 mu
7969
7970    if (upperGroup.depth > 0.25 || group.label === "\\xleftequilibrium") {
7971      upperShift -= upperGroup.depth; // shift up if depth encroaches
7972    } // Generate the vlist
7973
7974
7975    var vlist;
7976
7977    if (lowerGroup) {
7978      var lowerShift = -options.fontMetrics().axisHeight + lowerGroup.height + 0.5 * arrowBody.height + 0.111;
7979      vlist = buildCommon.makeVList({
7980        positionType: "individualShift",
7981        children: [{
7982          type: "elem",
7983          elem: upperGroup,
7984          shift: upperShift
7985        }, {
7986          type: "elem",
7987          elem: arrowBody,
7988          shift: arrowShift
7989        }, {
7990          type: "elem",
7991          elem: lowerGroup,
7992          shift: lowerShift
7993        }]
7994      }, options);
7995    } else {
7996      vlist = buildCommon.makeVList({
7997        positionType: "individualShift",
7998        children: [{
7999          type: "elem",
8000          elem: upperGroup,
8001          shift: upperShift
8002        }, {
8003          type: "elem",
8004          elem: arrowBody,
8005          shift: arrowShift
8006        }]
8007      }, options);
8008    } // $FlowFixMe: Replace this with passing "svg-align" into makeVList.
8009
8010
8011    vlist.children[0].children[0].children[1].classes.push("svg-align");
8012    return buildCommon.makeSpan(["mrel", "x-arrow"], [vlist], options);
8013  },
8014  mathmlBuilder: function mathmlBuilder(group, options) {
8015    var arrowNode = stretchy.mathMLnode(group.label);
8016    var node;
8017
8018    if (group.body) {
8019      var upperNode = arrow_paddedNode(buildMathML_buildGroup(group.body, options));
8020
8021      if (group.below) {
8022        var lowerNode = arrow_paddedNode(buildMathML_buildGroup(group.below, options));
8023        node = new mathMLTree.MathNode("munderover", [arrowNode, lowerNode, upperNode]);
8024      } else {
8025        node = new mathMLTree.MathNode("mover", [arrowNode, upperNode]);
8026      }
8027    } else if (group.below) {
8028      var _lowerNode = arrow_paddedNode(buildMathML_buildGroup(group.below, options));
8029
8030      node = new mathMLTree.MathNode("munder", [arrowNode, _lowerNode]);
8031    } else {
8032      // This should never happen.
8033      // Parser.js throws an error if there is no argument.
8034      node = arrow_paddedNode();
8035      node = new mathMLTree.MathNode("mover", [arrowNode, node]);
8036    }
8037
8038    return node;
8039  }
8040});
8041// CONCATENATED MODULE: ./src/functions/char.js
8042
8043
8044 // \@char is an internal function that takes a grouped decimal argument like
8045// {123} and converts into symbol with code 123.  It is used by the *macro*
8046// \char defined in macros.js.
8047
8048defineFunction({
8049  type: "textord",
8050  names: ["\\@char"],
8051  props: {
8052    numArgs: 1,
8053    allowedInText: true
8054  },
8055  handler: function handler(_ref, args) {
8056    var parser = _ref.parser;
8057    var arg = assertNodeType(args[0], "ordgroup");
8058    var group = arg.body;
8059    var number = "";
8060
8061    for (var i = 0; i < group.length; i++) {
8062      var node = assertNodeType(group[i], "textord");
8063      number += node.text;
8064    }
8065
8066    var code = parseInt(number);
8067
8068    if (isNaN(code)) {
8069      throw new src_ParseError("\\@char has non-numeric argument " + number);
8070    }
8071
8072    return {
8073      type: "textord",
8074      mode: parser.mode,
8075      text: String.fromCharCode(code)
8076    };
8077  }
8078});
8079// CONCATENATED MODULE: ./src/functions/color.js
8080
8081
8082
8083
8084
8085
8086
8087var color_htmlBuilder = function htmlBuilder(group, options) {
8088  var elements = buildHTML_buildExpression(group.body, options.withColor(group.color), false); // \color isn't supposed to affect the type of the elements it contains.
8089  // To accomplish this, we wrap the results in a fragment, so the inner
8090  // elements will be able to directly interact with their neighbors. For
8091  // example, `\color{red}{2 +} 3` has the same spacing as `2 + 3`
8092
8093  return buildCommon.makeFragment(elements);
8094};
8095
8096var color_mathmlBuilder = function mathmlBuilder(group, options) {
8097  var inner = buildMathML_buildExpression(group.body, options.withColor(group.color));
8098  var node = new mathMLTree.MathNode("mstyle", inner);
8099  node.setAttribute("mathcolor", group.color);
8100  return node;
8101};
8102
8103defineFunction({
8104  type: "color",
8105  names: ["\\textcolor"],
8106  props: {
8107    numArgs: 2,
8108    allowedInText: true,
8109    greediness: 3,
8110    argTypes: ["color", "original"]
8111  },
8112  handler: function handler(_ref, args) {
8113    var parser = _ref.parser;
8114    var color = assertNodeType(args[0], "color-token").color;
8115    var body = args[1];
8116    return {
8117      type: "color",
8118      mode: parser.mode,
8119      color: color,
8120      body: defineFunction_ordargument(body)
8121    };
8122  },
8123  htmlBuilder: color_htmlBuilder,
8124  mathmlBuilder: color_mathmlBuilder
8125});
8126defineFunction({
8127  type: "color",
8128  names: ["\\color"],
8129  props: {
8130    numArgs: 1,
8131    allowedInText: true,
8132    greediness: 3,
8133    argTypes: ["color"]
8134  },
8135  handler: function handler(_ref2, args) {
8136    var parser = _ref2.parser,
8137        breakOnTokenText = _ref2.breakOnTokenText;
8138    var color = assertNodeType(args[0], "color-token").color; // Set macro \current@color in current namespace to store the current
8139    // color, mimicking the behavior of color.sty.
8140    // This is currently used just to correctly color a \right
8141    // that follows a \color command.
8142
8143    parser.gullet.macros.set("\\current@color", color); // Parse out the implicit body that should be colored.
8144
8145    var body = parser.parseExpression(true, breakOnTokenText);
8146    return {
8147      type: "color",
8148      mode: parser.mode,
8149      color: color,
8150      body: body
8151    };
8152  },
8153  htmlBuilder: color_htmlBuilder,
8154  mathmlBuilder: color_mathmlBuilder
8155});
8156// CONCATENATED MODULE: ./src/functions/cr.js
8157// Row breaks within tabular environments, and line breaks at top level
8158
8159
8160
8161
8162
8163 // \\ is a macro mapping to either \cr or \newline.  Because they have the
8164// same signature, we implement them as one megafunction, with newRow
8165// indicating whether we're in the \cr case, and newLine indicating whether
8166// to break the line in the \newline case.
8167
8168defineFunction({
8169  type: "cr",
8170  names: ["\\cr", "\\newline"],
8171  props: {
8172    numArgs: 0,
8173    numOptionalArgs: 1,
8174    argTypes: ["size"],
8175    allowedInText: true
8176  },
8177  handler: function handler(_ref, args, optArgs) {
8178    var parser = _ref.parser,
8179        funcName = _ref.funcName;
8180    var size = optArgs[0];
8181    var newRow = funcName === "\\cr";
8182    var newLine = false;
8183
8184    if (!newRow) {
8185      if (parser.settings.displayMode && parser.settings.useStrictBehavior("newLineInDisplayMode", "In LaTeX, \\\\ or \\newline " + "does nothing in display mode")) {
8186        newLine = false;
8187      } else {
8188        newLine = true;
8189      }
8190    }
8191
8192    return {
8193      type: "cr",
8194      mode: parser.mode,
8195      newLine: newLine,
8196      newRow: newRow,
8197      size: size && assertNodeType(size, "size").value
8198    };
8199  },
8200  // The following builders are called only at the top level,
8201  // not within tabular/array environments.
8202  htmlBuilder: function htmlBuilder(group, options) {
8203    if (group.newRow) {
8204      throw new src_ParseError("\\cr valid only within a tabular/array environment");
8205    }
8206
8207    var span = buildCommon.makeSpan(["mspace"], [], options);
8208
8209    if (group.newLine) {
8210      span.classes.push("newline");
8211
8212      if (group.size) {
8213        span.style.marginTop = units_calculateSize(group.size, options) + "em";
8214      }
8215    }
8216
8217    return span;
8218  },
8219  mathmlBuilder: function mathmlBuilder(group, options) {
8220    var node = new mathMLTree.MathNode("mspace");
8221
8222    if (group.newLine) {
8223      node.setAttribute("linebreak", "newline");
8224
8225      if (group.size) {
8226        node.setAttribute("height", units_calculateSize(group.size, options) + "em");
8227      }
8228    }
8229
8230    return node;
8231  }
8232});
8233// CONCATENATED MODULE: ./src/delimiter.js
8234/**
8235 * This file deals with creating delimiters of various sizes. The TeXbook
8236 * discusses these routines on page 441-442, in the "Another subroutine sets box
8237 * x to a specified variable delimiter" paragraph.
8238 *
8239 * There are three main routines here. `makeSmallDelim` makes a delimiter in the
8240 * normal font, but in either text, script, or scriptscript style.
8241 * `makeLargeDelim` makes a delimiter in textstyle, but in one of the Size1,
8242 * Size2, Size3, or Size4 fonts. `makeStackedDelim` makes a delimiter out of
8243 * smaller pieces that are stacked on top of one another.
8244 *
8245 * The functions take a parameter `center`, which determines if the delimiter
8246 * should be centered around the axis.
8247 *
8248 * Then, there are three exposed functions. `sizedDelim` makes a delimiter in
8249 * one of the given sizes. This is used for things like `\bigl`.
8250 * `customSizedDelim` makes a delimiter with a given total height+depth. It is
8251 * called in places like `\sqrt`. `leftRightDelim` makes an appropriate
8252 * delimiter which surrounds an expression of a given height an depth. It is
8253 * used in `\left` and `\right`.
8254 */
8255
8256
8257
8258
8259
8260
8261
8262
8263
8264/**
8265 * Get the metrics for a given symbol and font, after transformation (i.e.
8266 * after following replacement from symbols.js)
8267 */
8268var delimiter_getMetrics = function getMetrics(symbol, font, mode) {
8269  var replace = src_symbols.math[symbol] && src_symbols.math[symbol].replace;
8270  var metrics = getCharacterMetrics(replace || symbol, font, mode);
8271
8272  if (!metrics) {
8273    throw new Error("Unsupported symbol " + symbol + " and font size " + font + ".");
8274  }
8275
8276  return metrics;
8277};
8278/**
8279 * Puts a delimiter span in a given style, and adds appropriate height, depth,
8280 * and maxFontSizes.
8281 */
8282
8283
8284var delimiter_styleWrap = function styleWrap(delim, toStyle, options, classes) {
8285  var newOptions = options.havingBaseStyle(toStyle);
8286  var span = buildCommon.makeSpan(classes.concat(newOptions.sizingClasses(options)), [delim], options);
8287  var delimSizeMultiplier = newOptions.sizeMultiplier / options.sizeMultiplier;
8288  span.height *= delimSizeMultiplier;
8289  span.depth *= delimSizeMultiplier;
8290  span.maxFontSize = newOptions.sizeMultiplier;
8291  return span;
8292};
8293
8294var centerSpan = function centerSpan(span, options, style) {
8295  var newOptions = options.havingBaseStyle(style);
8296  var shift = (1 - options.sizeMultiplier / newOptions.sizeMultiplier) * options.fontMetrics().axisHeight;
8297  span.classes.push("delimcenter");
8298  span.style.top = shift + "em";
8299  span.height -= shift;
8300  span.depth += shift;
8301};
8302/**
8303 * Makes a small delimiter. This is a delimiter that comes in the Main-Regular
8304 * font, but is restyled to either be in textstyle, scriptstyle, or
8305 * scriptscriptstyle.
8306 */
8307
8308
8309var delimiter_makeSmallDelim = function makeSmallDelim(delim, style, center, options, mode, classes) {
8310  var text = buildCommon.makeSymbol(delim, "Main-Regular", mode, options);
8311  var span = delimiter_styleWrap(text, style, options, classes);
8312
8313  if (center) {
8314    centerSpan(span, options, style);
8315  }
8316
8317  return span;
8318};
8319/**
8320 * Builds a symbol in the given font size (note size is an integer)
8321 */
8322
8323
8324var delimiter_mathrmSize = function mathrmSize(value, size, mode, options) {
8325  return buildCommon.makeSymbol(value, "Size" + size + "-Regular", mode, options);
8326};
8327/**
8328 * Makes a large delimiter. This is a delimiter that comes in the Size1, Size2,
8329 * Size3, or Size4 fonts. It is always rendered in textstyle.
8330 */
8331
8332
8333var delimiter_makeLargeDelim = function makeLargeDelim(delim, size, center, options, mode, classes) {
8334  var inner = delimiter_mathrmSize(delim, size, mode, options);
8335  var span = delimiter_styleWrap(buildCommon.makeSpan(["delimsizing", "size" + size], [inner], options), src_Style.TEXT, options, classes);
8336
8337  if (center) {
8338    centerSpan(span, options, src_Style.TEXT);
8339  }
8340
8341  return span;
8342};
8343/**
8344 * Make an inner span with the given offset and in the given font. This is used
8345 * in `makeStackedDelim` to make the stacking pieces for the delimiter.
8346 */
8347
8348
8349var delimiter_makeInner = function makeInner(symbol, font, mode) {
8350  var sizeClass; // Apply the correct CSS class to choose the right font.
8351
8352  if (font === "Size1-Regular") {
8353    sizeClass = "delim-size1";
8354  } else
8355    /* if (font === "Size4-Regular") */
8356    {
8357      sizeClass = "delim-size4";
8358    }
8359
8360  var inner = buildCommon.makeSpan(["delimsizinginner", sizeClass], [buildCommon.makeSpan([], [buildCommon.makeSymbol(symbol, font, mode)])]); // Since this will be passed into `makeVList` in the end, wrap the element
8361  // in the appropriate tag that VList uses.
8362
8363  return {
8364    type: "elem",
8365    elem: inner
8366  };
8367}; // Helper for makeStackedDelim
8368
8369
8370var lap = {
8371  type: "kern",
8372  size: -0.005
8373};
8374/**
8375 * Make a stacked delimiter out of a given delimiter, with the total height at
8376 * least `heightTotal`. This routine is mentioned on page 442 of the TeXbook.
8377 */
8378
8379var delimiter_makeStackedDelim = function makeStackedDelim(delim, heightTotal, center, options, mode, classes) {
8380  // There are four parts, the top, an optional middle, a repeated part, and a
8381  // bottom.
8382  var top;
8383  var middle;
8384  var repeat;
8385  var bottom;
8386  top = repeat = bottom = delim;
8387  middle = null; // Also keep track of what font the delimiters are in
8388
8389  var font = "Size1-Regular"; // We set the parts and font based on the symbol. Note that we use
8390  // '\u23d0' instead of '|' and '\u2016' instead of '\\|' for the
8391  // repeats of the arrows
8392
8393  if (delim === "\\uparrow") {
8394    repeat = bottom = "\u23D0";
8395  } else if (delim === "\\Uparrow") {
8396    repeat = bottom = "\u2016";
8397  } else if (delim === "\\downarrow") {
8398    top = repeat = "\u23D0";
8399  } else if (delim === "\\Downarrow") {
8400    top = repeat = "\u2016";
8401  } else if (delim === "\\updownarrow") {
8402    top = "\\uparrow";
8403    repeat = "\u23D0";
8404    bottom = "\\downarrow";
8405  } else if (delim === "\\Updownarrow") {
8406    top = "\\Uparrow";
8407    repeat = "\u2016";
8408    bottom = "\\Downarrow";
8409  } else if (delim === "[" || delim === "\\lbrack") {
8410    top = "\u23A1";
8411    repeat = "\u23A2";
8412    bottom = "\u23A3";
8413    font = "Size4-Regular";
8414  } else if (delim === "]" || delim === "\\rbrack") {
8415    top = "\u23A4";
8416    repeat = "\u23A5";
8417    bottom = "\u23A6";
8418    font = "Size4-Regular";
8419  } else if (delim === "\\lfloor" || delim === "\u230A") {
8420    repeat = top = "\u23A2";
8421    bottom = "\u23A3";
8422    font = "Size4-Regular";
8423  } else if (delim === "\\lceil" || delim === "\u2308") {
8424    top = "\u23A1";
8425    repeat = bottom = "\u23A2";
8426    font = "Size4-Regular";
8427  } else if (delim === "\\rfloor" || delim === "\u230B") {
8428    repeat = top = "\u23A5";
8429    bottom = "\u23A6";
8430    font = "Size4-Regular";
8431  } else if (delim === "\\rceil" || delim === "\u2309") {
8432    top = "\u23A4";
8433    repeat = bottom = "\u23A5";
8434    font = "Size4-Regular";
8435  } else if (delim === "(" || delim === "\\lparen") {
8436    top = "\u239B";
8437    repeat = "\u239C";
8438    bottom = "\u239D";
8439    font = "Size4-Regular";
8440  } else if (delim === ")" || delim === "\\rparen") {
8441    top = "\u239E";
8442    repeat = "\u239F";
8443    bottom = "\u23A0";
8444    font = "Size4-Regular";
8445  } else if (delim === "\\{" || delim === "\\lbrace") {
8446    top = "\u23A7";
8447    middle = "\u23A8";
8448    bottom = "\u23A9";
8449    repeat = "\u23AA";
8450    font = "Size4-Regular";
8451  } else if (delim === "\\}" || delim === "\\rbrace") {
8452    top = "\u23AB";
8453    middle = "\u23AC";
8454    bottom = "\u23AD";
8455    repeat = "\u23AA";
8456    font = "Size4-Regular";
8457  } else if (delim === "\\lgroup" || delim === "\u27EE") {
8458    top = "\u23A7";
8459    bottom = "\u23A9";
8460    repeat = "\u23AA";
8461    font = "Size4-Regular";
8462  } else if (delim === "\\rgroup" || delim === "\u27EF") {
8463    top = "\u23AB";
8464    bottom = "\u23AD";
8465    repeat = "\u23AA";
8466    font = "Size4-Regular";
8467  } else if (delim === "\\lmoustache" || delim === "\u23B0") {
8468    top = "\u23A7";
8469    bottom = "\u23AD";
8470    repeat = "\u23AA";
8471    font = "Size4-Regular";
8472  } else if (delim === "\\rmoustache" || delim === "\u23B1") {
8473    top = "\u23AB";
8474    bottom = "\u23A9";
8475    repeat = "\u23AA";
8476    font = "Size4-Regular";
8477  } // Get the metrics of the four sections
8478
8479
8480  var topMetrics = delimiter_getMetrics(top, font, mode);
8481  var topHeightTotal = topMetrics.height + topMetrics.depth;
8482  var repeatMetrics = delimiter_getMetrics(repeat, font, mode);
8483  var repeatHeightTotal = repeatMetrics.height + repeatMetrics.depth;
8484  var bottomMetrics = delimiter_getMetrics(bottom, font, mode);
8485  var bottomHeightTotal = bottomMetrics.height + bottomMetrics.depth;
8486  var middleHeightTotal = 0;
8487  var middleFactor = 1;
8488
8489  if (middle !== null) {
8490    var middleMetrics = delimiter_getMetrics(middle, font, mode);
8491    middleHeightTotal = middleMetrics.height + middleMetrics.depth;
8492    middleFactor = 2; // repeat symmetrically above and below middle
8493  } // Calcuate the minimal height that the delimiter can have.
8494  // It is at least the size of the top, bottom, and optional middle combined.
8495
8496
8497  var minHeight = topHeightTotal + bottomHeightTotal + middleHeightTotal; // Compute the number of copies of the repeat symbol we will need
8498
8499  var repeatCount = Math.max(0, Math.ceil((heightTotal - minHeight) / (middleFactor * repeatHeightTotal))); // Compute the total height of the delimiter including all the symbols
8500
8501  var realHeightTotal = minHeight + repeatCount * middleFactor * repeatHeightTotal; // The center of the delimiter is placed at the center of the axis. Note
8502  // that in this context, "center" means that the delimiter should be
8503  // centered around the axis in the current style, while normally it is
8504  // centered around the axis in textstyle.
8505
8506  var axisHeight = options.fontMetrics().axisHeight;
8507
8508  if (center) {
8509    axisHeight *= options.sizeMultiplier;
8510  } // Calculate the depth
8511
8512
8513  var depth = realHeightTotal / 2 - axisHeight; // This function differs from the TeX procedure in one way.
8514  // We shift each repeat element downwards by 0.005em, to prevent a gap
8515  // due to browser floating point rounding error.
8516  // Then, at the last element-to element joint, we add one extra repeat
8517  // element to cover the gap created by the shifts.
8518  // Find the shift needed to align the upper end of the extra element at a point
8519  // 0.005em above the lower end of the top element.
8520
8521  var shiftOfExtraElement = (repeatCount + 1) * 0.005 - repeatHeightTotal; // Now, we start building the pieces that will go into the vlist
8522  // Keep a list of the inner pieces
8523
8524  var inners = []; // Add the bottom symbol
8525
8526  inners.push(delimiter_makeInner(bottom, font, mode));
8527
8528  if (middle === null) {
8529    // Add that many symbols
8530    for (var i = 0; i < repeatCount; i++) {
8531      inners.push(lap); // overlap
8532
8533      inners.push(delimiter_makeInner(repeat, font, mode));
8534    }
8535  } else {
8536    // When there is a middle bit, we need the middle part and two repeated
8537    // sections
8538    for (var _i = 0; _i < repeatCount; _i++) {
8539      inners.push(lap);
8540      inners.push(delimiter_makeInner(repeat, font, mode));
8541    } // Insert one extra repeat element.
8542
8543
8544    inners.push({
8545      type: "kern",
8546      size: shiftOfExtraElement
8547    });
8548    inners.push(delimiter_makeInner(repeat, font, mode));
8549    inners.push(lap); // Now insert the middle of the brace.
8550
8551    inners.push(delimiter_makeInner(middle, font, mode));
8552
8553    for (var _i2 = 0; _i2 < repeatCount; _i2++) {
8554      inners.push(lap);
8555      inners.push(delimiter_makeInner(repeat, font, mode));
8556    }
8557  } // To cover the gap create by the overlaps, insert one more repeat element,
8558  // at a position that juts 0.005 above the bottom of the top element.
8559
8560
8561  inners.push({
8562    type: "kern",
8563    size: shiftOfExtraElement
8564  });
8565  inners.push(delimiter_makeInner(repeat, font, mode));
8566  inners.push(lap); // Add the top symbol
8567
8568  inners.push(delimiter_makeInner(top, font, mode)); // Finally, build the vlist
8569
8570  var newOptions = options.havingBaseStyle(src_Style.TEXT);
8571  var inner = buildCommon.makeVList({
8572    positionType: "bottom",
8573    positionData: depth,
8574    children: inners
8575  }, newOptions);
8576  return delimiter_styleWrap(buildCommon.makeSpan(["delimsizing", "mult"], [inner], newOptions), src_Style.TEXT, options, classes);
8577}; // All surds have 0.08em padding above the viniculum inside the SVG.
8578// That keeps browser span height rounding error from pinching the line.
8579
8580
8581var vbPad = 80; // padding above the surd, measured inside the viewBox.
8582
8583var emPad = 0.08; // padding, in ems, measured in the document.
8584
8585var delimiter_sqrtSvg = function sqrtSvg(sqrtName, height, viewBoxHeight, extraViniculum, options) {
8586  var path = sqrtPath(sqrtName, extraViniculum, viewBoxHeight);
8587  var pathNode = new domTree_PathNode(sqrtName, path);
8588  var svg = new SvgNode([pathNode], {
8589    // Note: 1000:1 ratio of viewBox to document em width.
8590    "width": "400em",
8591    "height": height + "em",
8592    "viewBox": "0 0 400000 " + viewBoxHeight,
8593    "preserveAspectRatio": "xMinYMin slice"
8594  });
8595  return buildCommon.makeSvgSpan(["hide-tail"], [svg], options);
8596};
8597/**
8598 * Make a sqrt image of the given height,
8599 */
8600
8601
8602var makeSqrtImage = function makeSqrtImage(height, options) {
8603  // Define a newOptions that removes the effect of size changes such as \Huge.
8604  // We don't pick different a height surd for \Huge. For it, we scale up.
8605  var newOptions = options.havingBaseSizing(); // Pick the desired surd glyph from a sequence of surds.
8606
8607  var delim = traverseSequence("\\surd", height * newOptions.sizeMultiplier, stackLargeDelimiterSequence, newOptions);
8608  var sizeMultiplier = newOptions.sizeMultiplier; // default
8609  // The standard sqrt SVGs each have a 0.04em thick viniculum.
8610  // If Settings.minRuleThickness is larger than that, we add extraViniculum.
8611
8612  var extraViniculum = Math.max(0, options.minRuleThickness - options.fontMetrics().sqrtRuleThickness); // Create a span containing an SVG image of a sqrt symbol.
8613
8614  var span;
8615  var spanHeight = 0;
8616  var texHeight = 0;
8617  var viewBoxHeight = 0;
8618  var advanceWidth; // We create viewBoxes with 80 units of "padding" above each surd.
8619  // Then browser rounding error on the parent span height will not
8620  // encroach on the ink of the viniculum. But that padding is not
8621  // included in the TeX-like `height` used for calculation of
8622  // vertical alignment. So texHeight = span.height < span.style.height.
8623
8624  if (delim.type === "small") {
8625    // Get an SVG that is derived from glyph U+221A in font KaTeX-Main.
8626    // 1000 unit normal glyph height.
8627    viewBoxHeight = 1000 + 1000 * extraViniculum + vbPad;
8628
8629    if (height < 1.0) {
8630      sizeMultiplier = 1.0; // mimic a \textfont radical
8631    } else if (height < 1.4) {
8632      sizeMultiplier = 0.7; // mimic a \scriptfont radical
8633    }
8634
8635    spanHeight = (1.0 + extraViniculum + emPad) / sizeMultiplier;
8636    texHeight = (1.00 + extraViniculum) / sizeMultiplier;
8637    span = delimiter_sqrtSvg("sqrtMain", spanHeight, viewBoxHeight, extraViniculum, options);
8638    span.style.minWidth = "0.853em";
8639    advanceWidth = 0.833 / sizeMultiplier; // from the font.
8640  } else if (delim.type === "large") {
8641    // These SVGs come from fonts: KaTeX_Size1, _Size2, etc.
8642    viewBoxHeight = (1000 + vbPad) * sizeToMaxHeight[delim.size];
8643    texHeight = (sizeToMaxHeight[delim.size] + extraViniculum) / sizeMultiplier;
8644    spanHeight = (sizeToMaxHeight[delim.size] + extraViniculum + emPad) / sizeMultiplier;
8645    span = delimiter_sqrtSvg("sqrtSize" + delim.size, spanHeight, viewBoxHeight, extraViniculum, options);
8646    span.style.minWidth = "1.02em";
8647    advanceWidth = 1.0 / sizeMultiplier; // 1.0 from the font.
8648  } else {
8649    // Tall sqrt. In TeX, this would be stacked using multiple glyphs.
8650    // We'll use a single SVG to accomplish the same thing.
8651    spanHeight = height + extraViniculum + emPad;
8652    texHeight = height + extraViniculum;
8653    viewBoxHeight = Math.floor(1000 * height + extraViniculum) + vbPad;
8654    span = delimiter_sqrtSvg("sqrtTall", spanHeight, viewBoxHeight, extraViniculum, options);
8655    span.style.minWidth = "0.742em";
8656    advanceWidth = 1.056;
8657  }
8658
8659  span.height = texHeight;
8660  span.style.height = spanHeight + "em";
8661  return {
8662    span: span,
8663    advanceWidth: advanceWidth,
8664    // Calculate the actual line width.
8665    // This actually should depend on the chosen font -- e.g. \boldmath
8666    // should use the thicker surd symbols from e.g. KaTeX_Main-Bold, and
8667    // have thicker rules.
8668    ruleWidth: (options.fontMetrics().sqrtRuleThickness + extraViniculum) * sizeMultiplier
8669  };
8670}; // There are three kinds of delimiters, delimiters that stack when they become
8671// too large
8672
8673
8674var stackLargeDelimiters = ["(", "\\lparen", ")", "\\rparen", "[", "\\lbrack", "]", "\\rbrack", "\\{", "\\lbrace", "\\}", "\\rbrace", "\\lfloor", "\\rfloor", "\u230A", "\u230B", "\\lceil", "\\rceil", "\u2308", "\u2309", "\\surd"]; // delimiters that always stack
8675
8676var 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
8677
8678var stackNeverDelimiters = ["<", ">", "\\langle", "\\rangle", "/", "\\backslash", "\\lt", "\\gt"]; // Metrics of the different sizes. Found by looking at TeX's output of
8679// $\bigl| // \Bigl| \biggl| \Biggl| \showlists$
8680// Used to create stacked delimiters of appropriate sizes in makeSizedDelim.
8681
8682var sizeToMaxHeight = [0, 1.2, 1.8, 2.4, 3.0];
8683/**
8684 * Used to create a delimiter of a specific size, where `size` is 1, 2, 3, or 4.
8685 */
8686
8687var delimiter_makeSizedDelim = function makeSizedDelim(delim, size, options, mode, classes) {
8688  // < and > turn into \langle and \rangle in delimiters
8689  if (delim === "<" || delim === "\\lt" || delim === "\u27E8") {
8690    delim = "\\langle";
8691  } else if (delim === ">" || delim === "\\gt" || delim === "\u27E9") {
8692    delim = "\\rangle";
8693  } // Sized delimiters are never centered.
8694
8695
8696  if (utils.contains(stackLargeDelimiters, delim) || utils.contains(stackNeverDelimiters, delim)) {
8697    return delimiter_makeLargeDelim(delim, size, false, options, mode, classes);
8698  } else if (utils.contains(stackAlwaysDelimiters, delim)) {
8699    return delimiter_makeStackedDelim(delim, sizeToMaxHeight[size], false, options, mode, classes);
8700  } else {
8701    throw new src_ParseError("Illegal delimiter: '" + delim + "'");
8702  }
8703};
8704/**
8705 * There are three different sequences of delimiter sizes that the delimiters
8706 * follow depending on the kind of delimiter. This is used when creating custom
8707 * sized delimiters to decide whether to create a small, large, or stacked
8708 * delimiter.
8709 *
8710 * In real TeX, these sequences aren't explicitly defined, but are instead
8711 * defined inside the font metrics. Since there are only three sequences that
8712 * are possible for the delimiters that TeX defines, it is easier to just encode
8713 * them explicitly here.
8714 */
8715
8716
8717// Delimiters that never stack try small delimiters and large delimiters only
8718var stackNeverDelimiterSequence = [{
8719  type: "small",
8720  style: src_Style.SCRIPTSCRIPT
8721}, {
8722  type: "small",
8723  style: src_Style.SCRIPT
8724}, {
8725  type: "small",
8726  style: src_Style.TEXT
8727}, {
8728  type: "large",
8729  size: 1
8730}, {
8731  type: "large",
8732  size: 2
8733}, {
8734  type: "large",
8735  size: 3
8736}, {
8737  type: "large",
8738  size: 4
8739}]; // Delimiters that always stack try the small delimiters first, then stack
8740
8741var stackAlwaysDelimiterSequence = [{
8742  type: "small",
8743  style: src_Style.SCRIPTSCRIPT
8744}, {
8745  type: "small",
8746  style: src_Style.SCRIPT
8747}, {
8748  type: "small",
8749  style: src_Style.TEXT
8750}, {
8751  type: "stack"
8752}]; // Delimiters that stack when large try the small and then large delimiters, and
8753// stack afterwards
8754
8755var stackLargeDelimiterSequence = [{
8756  type: "small",
8757  style: src_Style.SCRIPTSCRIPT
8758}, {
8759  type: "small",
8760  style: src_Style.SCRIPT
8761}, {
8762  type: "small",
8763  style: src_Style.TEXT
8764}, {
8765  type: "large",
8766  size: 1
8767}, {
8768  type: "large",
8769  size: 2
8770}, {
8771  type: "large",
8772  size: 3
8773}, {
8774  type: "large",
8775  size: 4
8776}, {
8777  type: "stack"
8778}];
8779/**
8780 * Get the font used in a delimiter based on what kind of delimiter it is.
8781 * TODO(#963) Use more specific font family return type once that is introduced.
8782 */
8783
8784var delimTypeToFont = function delimTypeToFont(type) {
8785  if (type.type === "small") {
8786    return "Main-Regular";
8787  } else if (type.type === "large") {
8788    return "Size" + type.size + "-Regular";
8789  } else if (type.type === "stack") {
8790    return "Size4-Regular";
8791  } else {
8792    throw new Error("Add support for delim type '" + type.type + "' here.");
8793  }
8794};
8795/**
8796 * Traverse a sequence of types of delimiters to decide what kind of delimiter
8797 * should be used to create a delimiter of the given height+depth.
8798 */
8799
8800
8801var traverseSequence = function traverseSequence(delim, height, sequence, options) {
8802  // Here, we choose the index we should start at in the sequences. In smaller
8803  // sizes (which correspond to larger numbers in style.size) we start earlier
8804  // in the sequence. Thus, scriptscript starts at index 3-3=0, script starts
8805  // at index 3-2=1, text starts at 3-1=2, and display starts at min(2,3-0)=2
8806  var start = Math.min(2, 3 - options.style.size);
8807
8808  for (var i = start; i < sequence.length; i++) {
8809    if (sequence[i].type === "stack") {
8810      // This is always the last delimiter, so we just break the loop now.
8811      break;
8812    }
8813
8814    var metrics = delimiter_getMetrics(delim, delimTypeToFont(sequence[i]), "math");
8815    var heightDepth = metrics.height + metrics.depth; // Small delimiters are scaled down versions of the same font, so we
8816    // account for the style change size.
8817
8818    if (sequence[i].type === "small") {
8819      var newOptions = options.havingBaseStyle(sequence[i].style);
8820      heightDepth *= newOptions.sizeMultiplier;
8821    } // Check if the delimiter at this size works for the given height.
8822
8823
8824    if (heightDepth > height) {
8825      return sequence[i];
8826    }
8827  } // If we reached the end of the sequence, return the last sequence element.
8828
8829
8830  return sequence[sequence.length - 1];
8831};
8832/**
8833 * Make a delimiter of a given height+depth, with optional centering. Here, we
8834 * traverse the sequences, and create a delimiter that the sequence tells us to.
8835 */
8836
8837
8838var delimiter_makeCustomSizedDelim = function makeCustomSizedDelim(delim, height, center, options, mode, classes) {
8839  if (delim === "<" || delim === "\\lt" || delim === "\u27E8") {
8840    delim = "\\langle";
8841  } else if (delim === ">" || delim === "\\gt" || delim === "\u27E9") {
8842    delim = "\\rangle";
8843  } // Decide what sequence to use
8844
8845
8846  var sequence;
8847
8848  if (utils.contains(stackNeverDelimiters, delim)) {
8849    sequence = stackNeverDelimiterSequence;
8850  } else if (utils.contains(stackLargeDelimiters, delim)) {
8851    sequence = stackLargeDelimiterSequence;
8852  } else {
8853    sequence = stackAlwaysDelimiterSequence;
8854  } // Look through the sequence
8855
8856
8857  var delimType = traverseSequence(delim, height, sequence, options); // Get the delimiter from font glyphs.
8858  // Depending on the sequence element we decided on, call the
8859  // appropriate function.
8860
8861  if (delimType.type === "small") {
8862    return delimiter_makeSmallDelim(delim, delimType.style, center, options, mode, classes);
8863  } else if (delimType.type === "large") {
8864    return delimiter_makeLargeDelim(delim, delimType.size, center, options, mode, classes);
8865  } else
8866    /* if (delimType.type === "stack") */
8867    {
8868      return delimiter_makeStackedDelim(delim, height, center, options, mode, classes);
8869    }
8870};
8871/**
8872 * Make a delimiter for use with `\left` and `\right`, given a height and depth
8873 * of an expression that the delimiters surround.
8874 */
8875
8876
8877var makeLeftRightDelim = function makeLeftRightDelim(delim, height, depth, options, mode, classes) {
8878  // We always center \left/\right delimiters, so the axis is always shifted
8879  var axisHeight = options.fontMetrics().axisHeight * options.sizeMultiplier; // Taken from TeX source, tex.web, function make_left_right
8880
8881  var delimiterFactor = 901;
8882  var delimiterExtend = 5.0 / options.fontMetrics().ptPerEm;
8883  var maxDistFromAxis = Math.max(height - axisHeight, depth + axisHeight);
8884  var totalHeight = Math.max( // In real TeX, calculations are done using integral values which are
8885  // 65536 per pt, or 655360 per em. So, the division here truncates in
8886  // TeX but doesn't here, producing different results. If we wanted to
8887  // exactly match TeX's calculation, we could do
8888  //   Math.floor(655360 * maxDistFromAxis / 500) *
8889  //    delimiterFactor / 655360
8890  // (To see the difference, compare
8891  //    x^{x^{\left(\rule{0.1em}{0.68em}\right)}}
8892  // in TeX and KaTeX)
8893  maxDistFromAxis / 500 * delimiterFactor, 2 * maxDistFromAxis - delimiterExtend); // Finally, we defer to `makeCustomSizedDelim` with our calculated total
8894  // height
8895
8896  return delimiter_makeCustomSizedDelim(delim, totalHeight, true, options, mode, classes);
8897};
8898
8899/* harmony default export */ var delimiter = ({
8900  sqrtImage: makeSqrtImage,
8901  sizedDelim: delimiter_makeSizedDelim,
8902  customSizedDelim: delimiter_makeCustomSizedDelim,
8903  leftRightDelim: makeLeftRightDelim
8904});
8905// CONCATENATED MODULE: ./src/functions/delimsizing.js
8906
8907
8908
8909
8910
8911
8912
8913
8914
8915// Extra data needed for the delimiter handler down below
8916var delimiterSizes = {
8917  "\\bigl": {
8918    mclass: "mopen",
8919    size: 1
8920  },
8921  "\\Bigl": {
8922    mclass: "mopen",
8923    size: 2
8924  },
8925  "\\biggl": {
8926    mclass: "mopen",
8927    size: 3
8928  },
8929  "\\Biggl": {
8930    mclass: "mopen",
8931    size: 4
8932  },
8933  "\\bigr": {
8934    mclass: "mclose",
8935    size: 1
8936  },
8937  "\\Bigr": {
8938    mclass: "mclose",
8939    size: 2
8940  },
8941  "\\biggr": {
8942    mclass: "mclose",
8943    size: 3
8944  },
8945  "\\Biggr": {
8946    mclass: "mclose",
8947    size: 4
8948  },
8949  "\\bigm": {
8950    mclass: "mrel",
8951    size: 1
8952  },
8953  "\\Bigm": {
8954    mclass: "mrel",
8955    size: 2
8956  },
8957  "\\biggm": {
8958    mclass: "mrel",
8959    size: 3
8960  },
8961  "\\Biggm": {
8962    mclass: "mrel",
8963    size: 4
8964  },
8965  "\\big": {
8966    mclass: "mord",
8967    size: 1
8968  },
8969  "\\Big": {
8970    mclass: "mord",
8971    size: 2
8972  },
8973  "\\bigg": {
8974    mclass: "mord",
8975    size: 3
8976  },
8977  "\\Bigg": {
8978    mclass: "mord",
8979    size: 4
8980  }
8981};
8982var 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", "."];
8983
8984// Delimiter functions
8985function checkDelimiter(delim, context) {
8986  var symDelim = checkSymbolNodeType(delim);
8987
8988  if (symDelim && utils.contains(delimiters, symDelim.text)) {
8989    return symDelim;
8990  } else {
8991    throw new src_ParseError("Invalid delimiter: '" + (symDelim ? symDelim.text : JSON.stringify(delim)) + "' after '" + context.funcName + "'", delim);
8992  }
8993}
8994
8995defineFunction({
8996  type: "delimsizing",
8997  names: ["\\bigl", "\\Bigl", "\\biggl", "\\Biggl", "\\bigr", "\\Bigr", "\\biggr", "\\Biggr", "\\bigm", "\\Bigm", "\\biggm", "\\Biggm", "\\big", "\\Big", "\\bigg", "\\Bigg"],
8998  props: {
8999    numArgs: 1
9000  },
9001  handler: function handler(context, args) {
9002    var delim = checkDelimiter(args[0], context);
9003    return {
9004      type: "delimsizing",
9005      mode: context.parser.mode,
9006      size: delimiterSizes[context.funcName].size,
9007      mclass: delimiterSizes[context.funcName].mclass,
9008      delim: delim.text
9009    };
9010  },
9011  htmlBuilder: function htmlBuilder(group, options) {
9012    if (group.delim === ".") {
9013      // Empty delimiters still count as elements, even though they don't
9014      // show anything.
9015      return buildCommon.makeSpan([group.mclass]);
9016    } // Use delimiter.sizedDelim to generate the delimiter.
9017
9018
9019    return delimiter.sizedDelim(group.delim, group.size, options, group.mode, [group.mclass]);
9020  },
9021  mathmlBuilder: function mathmlBuilder(group) {
9022    var children = [];
9023
9024    if (group.delim !== ".") {
9025      children.push(buildMathML_makeText(group.delim, group.mode));
9026    }
9027
9028    var node = new mathMLTree.MathNode("mo", children);
9029
9030    if (group.mclass === "mopen" || group.mclass === "mclose") {
9031      // Only some of the delimsizing functions act as fences, and they
9032      // return "mopen" or "mclose" mclass.
9033      node.setAttribute("fence", "true");
9034    } else {
9035      // Explicitly disable fencing if it's not a fence, to override the
9036      // defaults.
9037      node.setAttribute("fence", "false");
9038    }
9039
9040    return node;
9041  }
9042});
9043
9044function assertParsed(group) {
9045  if (!group.body) {
9046    throw new Error("Bug: The leftright ParseNode wasn't fully parsed.");
9047  }
9048}
9049
9050defineFunction({
9051  type: "leftright-right",
9052  names: ["\\right"],
9053  props: {
9054    numArgs: 1
9055  },
9056  handler: function handler(context, args) {
9057    // \left case below triggers parsing of \right in
9058    //   `const right = parser.parseFunction();`
9059    // uses this return value.
9060    var color = context.parser.gullet.macros.get("\\current@color");
9061
9062    if (color && typeof color !== "string") {
9063      throw new src_ParseError("\\current@color set to non-string in \\right");
9064    }
9065
9066    return {
9067      type: "leftright-right",
9068      mode: context.parser.mode,
9069      delim: checkDelimiter(args[0], context).text,
9070      color: color // undefined if not set via \color
9071
9072    };
9073  }
9074});
9075defineFunction({
9076  type: "leftright",
9077  names: ["\\left"],
9078  props: {
9079    numArgs: 1
9080  },
9081  handler: function handler(context, args) {
9082    var delim = checkDelimiter(args[0], context);
9083    var parser = context.parser; // Parse out the implicit body
9084
9085    ++parser.leftrightDepth; // parseExpression stops before '\\right'
9086
9087    var body = parser.parseExpression(false);
9088    --parser.leftrightDepth; // Check the next token
9089
9090    parser.expect("\\right", false);
9091    var right = assertNodeType(parser.parseFunction(), "leftright-right");
9092    return {
9093      type: "leftright",
9094      mode: parser.mode,
9095      body: body,
9096      left: delim.text,
9097      right: right.delim,
9098      rightColor: right.color
9099    };
9100  },
9101  htmlBuilder: function htmlBuilder(group, options) {
9102    assertParsed(group); // Build the inner expression
9103
9104    var inner = buildHTML_buildExpression(group.body, options, true, ["mopen", "mclose"]);
9105    var innerHeight = 0;
9106    var innerDepth = 0;
9107    var hadMiddle = false; // Calculate its height and depth
9108
9109    for (var i = 0; i < inner.length; i++) {
9110      // Property `isMiddle` not defined on `span`. See comment in
9111      // "middle"'s htmlBuilder.
9112      // $FlowFixMe
9113      if (inner[i].isMiddle) {
9114        hadMiddle = true;
9115      } else {
9116        innerHeight = Math.max(inner[i].height, innerHeight);
9117        innerDepth = Math.max(inner[i].depth, innerDepth);
9118      }
9119    } // The size of delimiters is the same, regardless of what style we are
9120    // in. Thus, to correctly calculate the size of delimiter we need around
9121    // a group, we scale down the inner size based on the size.
9122
9123
9124    innerHeight *= options.sizeMultiplier;
9125    innerDepth *= options.sizeMultiplier;
9126    var leftDelim;
9127
9128    if (group.left === ".") {
9129      // Empty delimiters in \left and \right make null delimiter spaces.
9130      leftDelim = makeNullDelimiter(options, ["mopen"]);
9131    } else {
9132      // Otherwise, use leftRightDelim to generate the correct sized
9133      // delimiter.
9134      leftDelim = delimiter.leftRightDelim(group.left, innerHeight, innerDepth, options, group.mode, ["mopen"]);
9135    } // Add it to the beginning of the expression
9136
9137
9138    inner.unshift(leftDelim); // Handle middle delimiters
9139
9140    if (hadMiddle) {
9141      for (var _i = 1; _i < inner.length; _i++) {
9142        var middleDelim = inner[_i]; // Property `isMiddle` not defined on `span`. See comment in
9143        // "middle"'s htmlBuilder.
9144        // $FlowFixMe
9145
9146        var isMiddle = middleDelim.isMiddle;
9147
9148        if (isMiddle) {
9149          // Apply the options that were active when \middle was called
9150          inner[_i] = delimiter.leftRightDelim(isMiddle.delim, innerHeight, innerDepth, isMiddle.options, group.mode, []);
9151        }
9152      }
9153    }
9154
9155    var rightDelim; // Same for the right delimiter, but using color specified by \color
9156
9157    if (group.right === ".") {
9158      rightDelim = makeNullDelimiter(options, ["mclose"]);
9159    } else {
9160      var colorOptions = group.rightColor ? options.withColor(group.rightColor) : options;
9161      rightDelim = delimiter.leftRightDelim(group.right, innerHeight, innerDepth, colorOptions, group.mode, ["mclose"]);
9162    } // Add it to the end of the expression.
9163
9164
9165    inner.push(rightDelim);
9166    return buildCommon.makeSpan(["minner"], inner, options);
9167  },
9168  mathmlBuilder: function mathmlBuilder(group, options) {
9169    assertParsed(group);
9170    var inner = buildMathML_buildExpression(group.body, options);
9171
9172    if (group.left !== ".") {
9173      var leftNode = new mathMLTree.MathNode("mo", [buildMathML_makeText(group.left, group.mode)]);
9174      leftNode.setAttribute("fence", "true");
9175      inner.unshift(leftNode);
9176    }
9177
9178    if (group.right !== ".") {
9179      var rightNode = new mathMLTree.MathNode("mo", [buildMathML_makeText(group.right, group.mode)]);
9180      rightNode.setAttribute("fence", "true");
9181
9182      if (group.rightColor) {
9183        rightNode.setAttribute("mathcolor", group.rightColor);
9184      }
9185
9186      inner.push(rightNode);
9187    }
9188
9189    return buildMathML_makeRow(inner);
9190  }
9191});
9192defineFunction({
9193  type: "middle",
9194  names: ["\\middle"],
9195  props: {
9196    numArgs: 1
9197  },
9198  handler: function handler(context, args) {
9199    var delim = checkDelimiter(args[0], context);
9200
9201    if (!context.parser.leftrightDepth) {
9202      throw new src_ParseError("\\middle without preceding \\left", delim);
9203    }
9204
9205    return {
9206      type: "middle",
9207      mode: context.parser.mode,
9208      delim: delim.text
9209    };
9210  },
9211  htmlBuilder: function htmlBuilder(group, options) {
9212    var middleDelim;
9213
9214    if (group.delim === ".") {
9215      middleDelim = makeNullDelimiter(options, []);
9216    } else {
9217      middleDelim = delimiter.sizedDelim(group.delim, 1, options, group.mode, []);
9218      var isMiddle = {
9219        delim: group.delim,
9220        options: options
9221      }; // Property `isMiddle` not defined on `span`. It is only used in
9222      // this file above.
9223      // TODO: Fix this violation of the `span` type and possibly rename
9224      // things since `isMiddle` sounds like a boolean, but is a struct.
9225      // $FlowFixMe
9226
9227      middleDelim.isMiddle = isMiddle;
9228    }
9229
9230    return middleDelim;
9231  },
9232  mathmlBuilder: function mathmlBuilder(group, options) {
9233    // A Firefox \middle will strech a character vertically only if it
9234    // is in the fence part of the operator dictionary at:
9235    // https://www.w3.org/TR/MathML3/appendixc.html.
9236    // So we need to avoid U+2223 and use plain "|" instead.
9237    var textNode = group.delim === "\\vert" || group.delim === "|" ? buildMathML_makeText("|", "text") : buildMathML_makeText(group.delim, group.mode);
9238    var middleNode = new mathMLTree.MathNode("mo", [textNode]);
9239    middleNode.setAttribute("fence", "true"); // MathML gives 5/18em spacing to each <mo> element.
9240    // \middle should get delimiter spacing instead.
9241
9242    middleNode.setAttribute("lspace", "0.05em");
9243    middleNode.setAttribute("rspace", "0.05em");
9244    return middleNode;
9245  }
9246});
9247// CONCATENATED MODULE: ./src/functions/enclose.js
9248
9249
9250
9251
9252
9253
9254
9255
9256
9257var enclose_htmlBuilder = function htmlBuilder(group, options) {
9258  // \cancel, \bcancel, \xcancel, \sout, \fbox, \colorbox, \fcolorbox
9259  // Some groups can return document fragments.  Handle those by wrapping
9260  // them in a span.
9261  var inner = buildCommon.wrapFragment(buildHTML_buildGroup(group.body, options), options);
9262  var label = group.label.substr(1);
9263  var scale = options.sizeMultiplier;
9264  var img;
9265  var imgShift = 0; // In the LaTeX cancel package, line geometry is slightly different
9266  // depending on whether the subject is wider than it is tall, or vice versa.
9267  // We don't know the width of a group, so as a proxy, we test if
9268  // the subject is a single character. This captures most of the
9269  // subjects that should get the "tall" treatment.
9270
9271  var isSingleChar = utils.isCharacterBox(group.body);
9272
9273  if (label === "sout") {
9274    img = buildCommon.makeSpan(["stretchy", "sout"]);
9275    img.height = options.fontMetrics().defaultRuleThickness / scale;
9276    imgShift = -0.5 * options.fontMetrics().xHeight;
9277  } else {
9278    // Add horizontal padding
9279    if (/cancel/.test(label)) {
9280      if (!isSingleChar) {
9281        inner.classes.push("cancel-pad");
9282      }
9283    } else {
9284      inner.classes.push("boxpad");
9285    } // Add vertical padding
9286
9287
9288    var vertPad = 0;
9289    var ruleThickness = 0; // ref: cancel package: \advance\totalheight2\p@ % "+2"
9290
9291    if (/box/.test(label)) {
9292      ruleThickness = Math.max(options.fontMetrics().fboxrule, // default
9293      options.minRuleThickness // User override.
9294      );
9295      vertPad = options.fontMetrics().fboxsep + (label === "colorbox" ? 0 : ruleThickness);
9296    } else {
9297      vertPad = isSingleChar ? 0.2 : 0;
9298    }
9299
9300    img = stretchy.encloseSpan(inner, label, vertPad, options);
9301
9302    if (/fbox|boxed|fcolorbox/.test(label)) {
9303      img.style.borderStyle = "solid";
9304      img.style.borderWidth = ruleThickness + "em";
9305    }
9306
9307    imgShift = inner.depth + vertPad;
9308
9309    if (group.backgroundColor) {
9310      img.style.backgroundColor = group.backgroundColor;
9311
9312      if (group.borderColor) {
9313        img.style.borderColor = group.borderColor;
9314      }
9315    }
9316  }
9317
9318  var vlist;
9319
9320  if (group.backgroundColor) {
9321    vlist = buildCommon.makeVList({
9322      positionType: "individualShift",
9323      children: [// Put the color background behind inner;
9324      {
9325        type: "elem",
9326        elem: img,
9327        shift: imgShift
9328      }, {
9329        type: "elem",
9330        elem: inner,
9331        shift: 0
9332      }]
9333    }, options);
9334  } else {
9335    vlist = buildCommon.makeVList({
9336      positionType: "individualShift",
9337      children: [// Write the \cancel stroke on top of inner.
9338      {
9339        type: "elem",
9340        elem: inner,
9341        shift: 0
9342      }, {
9343        type: "elem",
9344        elem: img,
9345        shift: imgShift,
9346        wrapperClasses: /cancel/.test(label) ? ["svg-align"] : []
9347      }]
9348    }, options);
9349  }
9350
9351  if (/cancel/.test(label)) {
9352    // The cancel package documentation says that cancel lines add their height
9353    // to the expression, but tests show that isn't how it actually works.
9354    vlist.height = inner.height;
9355    vlist.depth = inner.depth;
9356  }
9357
9358  if (/cancel/.test(label) && !isSingleChar) {
9359    // cancel does not create horiz space for its line extension.
9360    return buildCommon.makeSpan(["mord", "cancel-lap"], [vlist], options);
9361  } else {
9362    return buildCommon.makeSpan(["mord"], [vlist], options);
9363  }
9364};
9365
9366var enclose_mathmlBuilder = function mathmlBuilder(group, options) {
9367  var fboxsep = 0;
9368  var node = new mathMLTree.MathNode(group.label.indexOf("colorbox") > -1 ? "mpadded" : "menclose", [buildMathML_buildGroup(group.body, options)]);
9369
9370  switch (group.label) {
9371    case "\\cancel":
9372      node.setAttribute("notation", "updiagonalstrike");
9373      break;
9374
9375    case "\\bcancel":
9376      node.setAttribute("notation", "downdiagonalstrike");
9377      break;
9378
9379    case "\\sout":
9380      node.setAttribute("notation", "horizontalstrike");
9381      break;
9382
9383    case "\\fbox":
9384      node.setAttribute("notation", "box");
9385      break;
9386
9387    case "\\fcolorbox":
9388    case "\\colorbox":
9389      // <menclose> doesn't have a good notation option. So use <mpadded>
9390      // instead. Set some attributes that come included with <menclose>.
9391      fboxsep = options.fontMetrics().fboxsep * options.fontMetrics().ptPerEm;
9392      node.setAttribute("width", "+" + 2 * fboxsep + "pt");
9393      node.setAttribute("height", "+" + 2 * fboxsep + "pt");
9394      node.setAttribute("lspace", fboxsep + "pt"); //
9395
9396      node.setAttribute("voffset", fboxsep + "pt");
9397
9398      if (group.label === "\\fcolorbox") {
9399        var thk = Math.max(options.fontMetrics().fboxrule, // default
9400        options.minRuleThickness // user override
9401        );
9402        node.setAttribute("style", "border: " + thk + "em solid " + String(group.borderColor));
9403      }
9404
9405      break;
9406
9407    case "\\xcancel":
9408      node.setAttribute("notation", "updiagonalstrike downdiagonalstrike");
9409      break;
9410  }
9411
9412  if (group.backgroundColor) {
9413    node.setAttribute("mathbackground", group.backgroundColor);
9414  }
9415
9416  return node;
9417};
9418
9419defineFunction({
9420  type: "enclose",
9421  names: ["\\colorbox"],
9422  props: {
9423    numArgs: 2,
9424    allowedInText: true,
9425    greediness: 3,
9426    argTypes: ["color", "text"]
9427  },
9428  handler: function handler(_ref, args, optArgs) {
9429    var parser = _ref.parser,
9430        funcName = _ref.funcName;
9431    var color = assertNodeType(args[0], "color-token").color;
9432    var body = args[1];
9433    return {
9434      type: "enclose",
9435      mode: parser.mode,
9436      label: funcName,
9437      backgroundColor: color,
9438      body: body
9439    };
9440  },
9441  htmlBuilder: enclose_htmlBuilder,
9442  mathmlBuilder: enclose_mathmlBuilder
9443});
9444defineFunction({
9445  type: "enclose",
9446  names: ["\\fcolorbox"],
9447  props: {
9448    numArgs: 3,
9449    allowedInText: true,
9450    greediness: 3,
9451    argTypes: ["color", "color", "text"]
9452  },
9453  handler: function handler(_ref2, args, optArgs) {
9454    var parser = _ref2.parser,
9455        funcName = _ref2.funcName;
9456    var borderColor = assertNodeType(args[0], "color-token").color;
9457    var backgroundColor = assertNodeType(args[1], "color-token").color;
9458    var body = args[2];
9459    return {
9460      type: "enclose",
9461      mode: parser.mode,
9462      label: funcName,
9463      backgroundColor: backgroundColor,
9464      borderColor: borderColor,
9465      body: body
9466    };
9467  },
9468  htmlBuilder: enclose_htmlBuilder,
9469  mathmlBuilder: enclose_mathmlBuilder
9470});
9471defineFunction({
9472  type: "enclose",
9473  names: ["\\fbox"],
9474  props: {
9475    numArgs: 1,
9476    argTypes: ["hbox"],
9477    allowedInText: true
9478  },
9479  handler: function handler(_ref3, args) {
9480    var parser = _ref3.parser;
9481    return {
9482      type: "enclose",
9483      mode: parser.mode,
9484      label: "\\fbox",
9485      body: args[0]
9486    };
9487  }
9488});
9489defineFunction({
9490  type: "enclose",
9491  names: ["\\cancel", "\\bcancel", "\\xcancel", "\\sout"],
9492  props: {
9493    numArgs: 1
9494  },
9495  handler: function handler(_ref4, args, optArgs) {
9496    var parser = _ref4.parser,
9497        funcName = _ref4.funcName;
9498    var body = args[0];
9499    return {
9500      type: "enclose",
9501      mode: parser.mode,
9502      label: funcName,
9503      body: body
9504    };
9505  },
9506  htmlBuilder: enclose_htmlBuilder,
9507  mathmlBuilder: enclose_mathmlBuilder
9508});
9509// CONCATENATED MODULE: ./src/defineEnvironment.js
9510
9511
9512/**
9513 * All registered environments.
9514 * `environments.js` exports this same dictionary again and makes it public.
9515 * `Parser.js` requires this dictionary via `environments.js`.
9516 */
9517var _environments = {};
9518function defineEnvironment(_ref) {
9519  var type = _ref.type,
9520      names = _ref.names,
9521      props = _ref.props,
9522      handler = _ref.handler,
9523      htmlBuilder = _ref.htmlBuilder,
9524      mathmlBuilder = _ref.mathmlBuilder;
9525  // Set default values of environments.
9526  var data = {
9527    type: type,
9528    numArgs: props.numArgs || 0,
9529    greediness: 1,
9530    allowedInText: false,
9531    numOptionalArgs: 0,
9532    handler: handler
9533  };
9534
9535  for (var i = 0; i < names.length; ++i) {
9536    // TODO: The value type of _environments should be a type union of all
9537    // possible `EnvSpec<>` possibilities instead of `EnvSpec<*>`, which is
9538    // an existential type.
9539    // $FlowFixMe
9540    _environments[names[i]] = data;
9541  }
9542
9543  if (htmlBuilder) {
9544    _htmlGroupBuilders[type] = htmlBuilder;
9545  }
9546
9547  if (mathmlBuilder) {
9548    _mathmlGroupBuilders[type] = mathmlBuilder;
9549  }
9550}
9551// CONCATENATED MODULE: ./src/environments/array.js
9552
9553
9554
9555
9556
9557
9558
9559
9560
9561
9562
9563
9564
9565function getHLines(parser) {
9566  // Return an array. The array length = number of hlines.
9567  // Each element in the array tells if the line is dashed.
9568  var hlineInfo = [];
9569  parser.consumeSpaces();
9570  var nxt = parser.fetch().text;
9571
9572  while (nxt === "\\hline" || nxt === "\\hdashline") {
9573    parser.consume();
9574    hlineInfo.push(nxt === "\\hdashline");
9575    parser.consumeSpaces();
9576    nxt = parser.fetch().text;
9577  }
9578
9579  return hlineInfo;
9580}
9581/**
9582 * Parse the body of the environment, with rows delimited by \\ and
9583 * columns delimited by &, and create a nested list in row-major order
9584 * with one group per cell.  If given an optional argument style
9585 * ("text", "display", etc.), then each cell is cast into that style.
9586 */
9587
9588
9589function parseArray(parser, _ref, style) {
9590  var hskipBeforeAndAfter = _ref.hskipBeforeAndAfter,
9591      addJot = _ref.addJot,
9592      cols = _ref.cols,
9593      arraystretch = _ref.arraystretch,
9594      colSeparationType = _ref.colSeparationType;
9595  // Parse body of array with \\ temporarily mapped to \cr
9596  parser.gullet.beginGroup();
9597  parser.gullet.macros.set("\\\\", "\\cr"); // Get current arraystretch if it's not set by the environment
9598
9599  if (!arraystretch) {
9600    var stretch = parser.gullet.expandMacroAsText("\\arraystretch");
9601
9602    if (stretch == null) {
9603      // Default \arraystretch from lttab.dtx
9604      arraystretch = 1;
9605    } else {
9606      arraystretch = parseFloat(stretch);
9607
9608      if (!arraystretch || arraystretch < 0) {
9609        throw new src_ParseError("Invalid \\arraystretch: " + stretch);
9610      }
9611    }
9612  } // Start group for first cell
9613
9614
9615  parser.gullet.beginGroup();
9616  var row = [];
9617  var body = [row];
9618  var rowGaps = [];
9619  var hLinesBeforeRow = []; // Test for \hline at the top of the array.
9620
9621  hLinesBeforeRow.push(getHLines(parser));
9622
9623  while (true) {
9624    // eslint-disable-line no-constant-condition
9625    // Parse each cell in its own group (namespace)
9626    var cell = parser.parseExpression(false, "\\cr");
9627    parser.gullet.endGroup();
9628    parser.gullet.beginGroup();
9629    cell = {
9630      type: "ordgroup",
9631      mode: parser.mode,
9632      body: cell
9633    };
9634
9635    if (style) {
9636      cell = {
9637        type: "styling",
9638        mode: parser.mode,
9639        style: style,
9640        body: [cell]
9641      };
9642    }
9643
9644    row.push(cell);
9645    var next = parser.fetch().text;
9646
9647    if (next === "&") {
9648      parser.consume();
9649    } else if (next === "\\end") {
9650      // Arrays terminate newlines with `\crcr` which consumes a `\cr` if
9651      // the last line is empty.
9652      // NOTE: Currently, `cell` is the last item added into `row`.
9653      if (row.length === 1 && cell.type === "styling" && cell.body[0].body.length === 0) {
9654        body.pop();
9655      }
9656
9657      if (hLinesBeforeRow.length < body.length + 1) {
9658        hLinesBeforeRow.push([]);
9659      }
9660
9661      break;
9662    } else if (next === "\\cr") {
9663      var cr = assertNodeType(parser.parseFunction(), "cr");
9664      rowGaps.push(cr.size); // check for \hline(s) following the row separator
9665
9666      hLinesBeforeRow.push(getHLines(parser));
9667      row = [];
9668      body.push(row);
9669    } else {
9670      throw new src_ParseError("Expected & or \\\\ or \\cr or \\end", parser.nextToken);
9671    }
9672  } // End cell group
9673
9674
9675  parser.gullet.endGroup(); // End array group defining \\
9676
9677  parser.gullet.endGroup();
9678  return {
9679    type: "array",
9680    mode: parser.mode,
9681    addJot: addJot,
9682    arraystretch: arraystretch,
9683    body: body,
9684    cols: cols,
9685    rowGaps: rowGaps,
9686    hskipBeforeAndAfter: hskipBeforeAndAfter,
9687    hLinesBeforeRow: hLinesBeforeRow,
9688    colSeparationType: colSeparationType
9689  };
9690} // Decides on a style for cells in an array according to whether the given
9691// environment name starts with the letter 'd'.
9692
9693
9694function dCellStyle(envName) {
9695  if (envName.substr(0, 1) === "d") {
9696    return "display";
9697  } else {
9698    return "text";
9699  }
9700}
9701
9702var array_htmlBuilder = function htmlBuilder(group, options) {
9703  var r;
9704  var c;
9705  var nr = group.body.length;
9706  var hLinesBeforeRow = group.hLinesBeforeRow;
9707  var nc = 0;
9708  var body = new Array(nr);
9709  var hlines = [];
9710  var ruleThickness = Math.max( // From LaTeX \showthe\arrayrulewidth. Equals 0.04 em.
9711  options.fontMetrics().arrayRuleWidth, options.minRuleThickness // User override.
9712  ); // Horizontal spacing
9713
9714  var pt = 1 / options.fontMetrics().ptPerEm;
9715  var arraycolsep = 5 * pt; // default value, i.e. \arraycolsep in article.cls
9716
9717  if (group.colSeparationType && group.colSeparationType === "small") {
9718    // We're in a {smallmatrix}. Default column space is \thickspace,
9719    // i.e. 5/18em = 0.2778em, per amsmath.dtx for {smallmatrix}.
9720    // But that needs adjustment because LaTeX applies \scriptstyle to the
9721    // entire array, including the colspace, but this function applies
9722    // \scriptstyle only inside each element.
9723    var localMultiplier = options.havingStyle(src_Style.SCRIPT).sizeMultiplier;
9724    arraycolsep = 0.2778 * (localMultiplier / options.sizeMultiplier);
9725  } // Vertical spacing
9726
9727
9728  var baselineskip = 12 * pt; // see size10.clo
9729  // Default \jot from ltmath.dtx
9730  // TODO(edemaine): allow overriding \jot via \setlength (#687)
9731
9732  var jot = 3 * pt;
9733  var arrayskip = group.arraystretch * baselineskip;
9734  var arstrutHeight = 0.7 * arrayskip; // \strutbox in ltfsstrc.dtx and
9735
9736  var arstrutDepth = 0.3 * arrayskip; // \@arstrutbox in lttab.dtx
9737
9738  var totalHeight = 0; // Set a position for \hline(s) at the top of the array, if any.
9739
9740  function setHLinePos(hlinesInGap) {
9741    for (var i = 0; i < hlinesInGap.length; ++i) {
9742      if (i > 0) {
9743        totalHeight += 0.25;
9744      }
9745
9746      hlines.push({
9747        pos: totalHeight,
9748        isDashed: hlinesInGap[i]
9749      });
9750    }
9751  }
9752
9753  setHLinePos(hLinesBeforeRow[0]);
9754
9755  for (r = 0; r < group.body.length; ++r) {
9756    var inrow = group.body[r];
9757    var height = arstrutHeight; // \@array adds an \@arstrut
9758
9759    var depth = arstrutDepth; // to each tow (via the template)
9760
9761    if (nc < inrow.length) {
9762      nc = inrow.length;
9763    }
9764
9765    var outrow = new Array(inrow.length);
9766
9767    for (c = 0; c < inrow.length; ++c) {
9768      var elt = buildHTML_buildGroup(inrow[c], options);
9769
9770      if (depth < elt.depth) {
9771        depth = elt.depth;
9772      }
9773
9774      if (height < elt.height) {
9775        height = elt.height;
9776      }
9777
9778      outrow[c] = elt;
9779    }
9780
9781    var rowGap = group.rowGaps[r];
9782    var gap = 0;
9783
9784    if (rowGap) {
9785      gap = units_calculateSize(rowGap, options);
9786
9787      if (gap > 0) {
9788        // \@argarraycr
9789        gap += arstrutDepth;
9790
9791        if (depth < gap) {
9792          depth = gap; // \@xargarraycr
9793        }
9794
9795        gap = 0;
9796      }
9797    } // In AMS multiline environments such as aligned and gathered, rows
9798    // correspond to lines that have additional \jot added to the
9799    // \baselineskip via \openup.
9800
9801
9802    if (group.addJot) {
9803      depth += jot;
9804    }
9805
9806    outrow.height = height;
9807    outrow.depth = depth;
9808    totalHeight += height;
9809    outrow.pos = totalHeight;
9810    totalHeight += depth + gap; // \@yargarraycr
9811
9812    body[r] = outrow; // Set a position for \hline(s), if any.
9813
9814    setHLinePos(hLinesBeforeRow[r + 1]);
9815  }
9816
9817  var offset = totalHeight / 2 + options.fontMetrics().axisHeight;
9818  var colDescriptions = group.cols || [];
9819  var cols = [];
9820  var colSep;
9821  var colDescrNum;
9822
9823  for (c = 0, colDescrNum = 0; // Continue while either there are more columns or more column
9824  // descriptions, so trailing separators don't get lost.
9825  c < nc || colDescrNum < colDescriptions.length; ++c, ++colDescrNum) {
9826    var colDescr = colDescriptions[colDescrNum] || {};
9827    var firstSeparator = true;
9828
9829    while (colDescr.type === "separator") {
9830      // If there is more than one separator in a row, add a space
9831      // between them.
9832      if (!firstSeparator) {
9833        colSep = buildCommon.makeSpan(["arraycolsep"], []);
9834        colSep.style.width = options.fontMetrics().doubleRuleSep + "em";
9835        cols.push(colSep);
9836      }
9837
9838      if (colDescr.separator === "|" || colDescr.separator === ":") {
9839        var lineType = colDescr.separator === "|" ? "solid" : "dashed";
9840        var separator = buildCommon.makeSpan(["vertical-separator"], [], options);
9841        separator.style.height = totalHeight + "em";
9842        separator.style.borderRightWidth = ruleThickness + "em";
9843        separator.style.borderRightStyle = lineType;
9844        separator.style.margin = "0 -" + ruleThickness / 2 + "em";
9845        separator.style.verticalAlign = -(totalHeight - offset) + "em";
9846        cols.push(separator);
9847      } else {
9848        throw new src_ParseError("Invalid separator type: " + colDescr.separator);
9849      }
9850
9851      colDescrNum++;
9852      colDescr = colDescriptions[colDescrNum] || {};
9853      firstSeparator = false;
9854    }
9855
9856    if (c >= nc) {
9857      continue;
9858    }
9859
9860    var sepwidth = void 0;
9861
9862    if (c > 0 || group.hskipBeforeAndAfter) {
9863      sepwidth = utils.deflt(colDescr.pregap, arraycolsep);
9864
9865      if (sepwidth !== 0) {
9866        colSep = buildCommon.makeSpan(["arraycolsep"], []);
9867        colSep.style.width = sepwidth + "em";
9868        cols.push(colSep);
9869      }
9870    }
9871
9872    var col = [];
9873
9874    for (r = 0; r < nr; ++r) {
9875      var row = body[r];
9876      var elem = row[c];
9877
9878      if (!elem) {
9879        continue;
9880      }
9881
9882      var shift = row.pos - offset;
9883      elem.depth = row.depth;
9884      elem.height = row.height;
9885      col.push({
9886        type: "elem",
9887        elem: elem,
9888        shift: shift
9889      });
9890    }
9891
9892    col = buildCommon.makeVList({
9893      positionType: "individualShift",
9894      children: col
9895    }, options);
9896    col = buildCommon.makeSpan(["col-align-" + (colDescr.align || "c")], [col]);
9897    cols.push(col);
9898
9899    if (c < nc - 1 || group.hskipBeforeAndAfter) {
9900      sepwidth = utils.deflt(colDescr.postgap, arraycolsep);
9901
9902      if (sepwidth !== 0) {
9903        colSep = buildCommon.makeSpan(["arraycolsep"], []);
9904        colSep.style.width = sepwidth + "em";
9905        cols.push(colSep);
9906      }
9907    }
9908  }
9909
9910  body = buildCommon.makeSpan(["mtable"], cols); // Add \hline(s), if any.
9911
9912  if (hlines.length > 0) {
9913    var line = buildCommon.makeLineSpan("hline", options, ruleThickness);
9914    var dashes = buildCommon.makeLineSpan("hdashline", options, ruleThickness);
9915    var vListElems = [{
9916      type: "elem",
9917      elem: body,
9918      shift: 0
9919    }];
9920
9921    while (hlines.length > 0) {
9922      var hline = hlines.pop();
9923      var lineShift = hline.pos - offset;
9924
9925      if (hline.isDashed) {
9926        vListElems.push({
9927          type: "elem",
9928          elem: dashes,
9929          shift: lineShift
9930        });
9931      } else {
9932        vListElems.push({
9933          type: "elem",
9934          elem: line,
9935          shift: lineShift
9936        });
9937      }
9938    }
9939
9940    body = buildCommon.makeVList({
9941      positionType: "individualShift",
9942      children: vListElems
9943    }, options);
9944  }
9945
9946  return buildCommon.makeSpan(["mord"], [body], options);
9947};
9948
9949var alignMap = {
9950  c: "center ",
9951  l: "left ",
9952  r: "right "
9953};
9954
9955var array_mathmlBuilder = function mathmlBuilder(group, options) {
9956  var table = new mathMLTree.MathNode("mtable", group.body.map(function (row) {
9957    return new mathMLTree.MathNode("mtr", row.map(function (cell) {
9958      return new mathMLTree.MathNode("mtd", [buildMathML_buildGroup(cell, options)]);
9959    }));
9960  })); // Set column alignment, row spacing, column spacing, and
9961  // array lines by setting attributes on the table element.
9962  // Set the row spacing. In MathML, we specify a gap distance.
9963  // We do not use rowGap[] because MathML automatically increases
9964  // cell height with the height/depth of the element content.
9965  // LaTeX \arraystretch multiplies the row baseline-to-baseline distance.
9966  // We simulate this by adding (arraystretch - 1)em to the gap. This
9967  // does a reasonable job of adjusting arrays containing 1 em tall content.
9968  // The 0.16 and 0.09 values are found emprically. They produce an array
9969  // similar to LaTeX and in which content does not interfere with \hines.
9970
9971  var gap = group.arraystretch === 0.5 ? 0.1 // {smallmatrix}, {subarray}
9972  : 0.16 + group.arraystretch - 1 + (group.addJot ? 0.09 : 0);
9973  table.setAttribute("rowspacing", gap + "em"); // MathML table lines go only between cells.
9974  // To place a line on an edge we'll use <menclose>, if necessary.
9975
9976  var menclose = "";
9977  var align = "";
9978
9979  if (group.cols) {
9980    // Find column alignment, column spacing, and  vertical lines.
9981    var cols = group.cols;
9982    var columnLines = "";
9983    var prevTypeWasAlign = false;
9984    var iStart = 0;
9985    var iEnd = cols.length;
9986
9987    if (cols[0].type === "separator") {
9988      menclose += "top ";
9989      iStart = 1;
9990    }
9991
9992    if (cols[cols.length - 1].type === "separator") {
9993      menclose += "bottom ";
9994      iEnd -= 1;
9995    }
9996
9997    for (var i = iStart; i < iEnd; i++) {
9998      if (cols[i].type === "align") {
9999        align += alignMap[cols[i].align];
10000
10001        if (prevTypeWasAlign) {
10002          columnLines += "none ";
10003        }
10004
10005        prevTypeWasAlign = true;
10006      } else if (cols[i].type === "separator") {
10007        // MathML accepts only single lines between cells.
10008        // So we read only the first of consecutive separators.
10009        if (prevTypeWasAlign) {
10010          columnLines += cols[i].separator === "|" ? "solid " : "dashed ";
10011          prevTypeWasAlign = false;
10012        }
10013      }
10014    }
10015
10016    table.setAttribute("columnalign", align.trim());
10017
10018    if (/[sd]/.test(columnLines)) {
10019      table.setAttribute("columnlines", columnLines.trim());
10020    }
10021  } // Set column spacing.
10022
10023
10024  if (group.colSeparationType === "align") {
10025    var _cols = group.cols || [];
10026
10027    var spacing = "";
10028
10029    for (var _i = 1; _i < _cols.length; _i++) {
10030      spacing += _i % 2 ? "0em " : "1em ";
10031    }
10032
10033    table.setAttribute("columnspacing", spacing.trim());
10034  } else if (group.colSeparationType === "alignat") {
10035    table.setAttribute("columnspacing", "0em");
10036  } else if (group.colSeparationType === "small") {
10037    table.setAttribute("columnspacing", "0.2778em");
10038  } else {
10039    table.setAttribute("columnspacing", "1em");
10040  } // Address \hline and \hdashline
10041
10042
10043  var rowLines = "";
10044  var hlines = group.hLinesBeforeRow;
10045  menclose += hlines[0].length > 0 ? "left " : "";
10046  menclose += hlines[hlines.length - 1].length > 0 ? "right " : "";
10047
10048  for (var _i2 = 1; _i2 < hlines.length - 1; _i2++) {
10049    rowLines += hlines[_i2].length === 0 ? "none " // MathML accepts only a single line between rows. Read one element.
10050    : hlines[_i2][0] ? "dashed " : "solid ";
10051  }
10052
10053  if (/[sd]/.test(rowLines)) {
10054    table.setAttribute("rowlines", rowLines.trim());
10055  }
10056
10057  if (menclose !== "") {
10058    table = new mathMLTree.MathNode("menclose", [table]);
10059    table.setAttribute("notation", menclose.trim());
10060  }
10061
10062  if (group.arraystretch && group.arraystretch < 1) {
10063    // A small array. Wrap in scriptstyle so row gap is not too large.
10064    table = new mathMLTree.MathNode("mstyle", [table]);
10065    table.setAttribute("scriptlevel", "1");
10066  }
10067
10068  return table;
10069}; // Convenience function for aligned and alignedat environments.
10070
10071
10072var array_alignedHandler = function alignedHandler(context, args) {
10073  var cols = [];
10074  var res = parseArray(context.parser, {
10075    cols: cols,
10076    addJot: true
10077  }, "display"); // Determining number of columns.
10078  // 1. If the first argument is given, we use it as a number of columns,
10079  //    and makes sure that each row doesn't exceed that number.
10080  // 2. Otherwise, just count number of columns = maximum number
10081  //    of cells in each row ("aligned" mode -- isAligned will be true).
10082  //
10083  // At the same time, prepend empty group {} at beginning of every second
10084  // cell in each row (starting with second cell) so that operators become
10085  // binary.  This behavior is implemented in amsmath's \start@aligned.
10086
10087  var numMaths;
10088  var numCols = 0;
10089  var emptyGroup = {
10090    type: "ordgroup",
10091    mode: context.mode,
10092    body: []
10093  };
10094  var ordgroup = checkNodeType(args[0], "ordgroup");
10095
10096  if (ordgroup) {
10097    var arg0 = "";
10098
10099    for (var i = 0; i < ordgroup.body.length; i++) {
10100      var textord = assertNodeType(ordgroup.body[i], "textord");
10101      arg0 += textord.text;
10102    }
10103
10104    numMaths = Number(arg0);
10105    numCols = numMaths * 2;
10106  }
10107
10108  var isAligned = !numCols;
10109  res.body.forEach(function (row) {
10110    for (var _i3 = 1; _i3 < row.length; _i3 += 2) {
10111      // Modify ordgroup node within styling node
10112      var styling = assertNodeType(row[_i3], "styling");
10113
10114      var _ordgroup = assertNodeType(styling.body[0], "ordgroup");
10115
10116      _ordgroup.body.unshift(emptyGroup);
10117    }
10118
10119    if (!isAligned) {
10120      // Case 1
10121      var curMaths = row.length / 2;
10122
10123      if (numMaths < curMaths) {
10124        throw new src_ParseError("Too many math in a row: " + ("expected " + numMaths + ", but got " + curMaths), row[0]);
10125      }
10126    } else if (numCols < row.length) {
10127      // Case 2
10128      numCols = row.length;
10129    }
10130  }); // Adjusting alignment.
10131  // In aligned mode, we add one \qquad between columns;
10132  // otherwise we add nothing.
10133
10134  for (var _i4 = 0; _i4 < numCols; ++_i4) {
10135    var align = "r";
10136    var pregap = 0;
10137
10138    if (_i4 % 2 === 1) {
10139      align = "l";
10140    } else if (_i4 > 0 && isAligned) {
10141      // "aligned" mode.
10142      pregap = 1; // add one \quad
10143    }
10144
10145    cols[_i4] = {
10146      type: "align",
10147      align: align,
10148      pregap: pregap,
10149      postgap: 0
10150    };
10151  }
10152
10153  res.colSeparationType = isAligned ? "align" : "alignat";
10154  return res;
10155}; // Arrays are part of LaTeX, defined in lttab.dtx so its documentation
10156// is part of the source2e.pdf file of LaTeX2e source documentation.
10157// {darray} is an {array} environment where cells are set in \displaystyle,
10158// as defined in nccmath.sty.
10159
10160
10161defineEnvironment({
10162  type: "array",
10163  names: ["array", "darray"],
10164  props: {
10165    numArgs: 1
10166  },
10167  handler: function handler(context, args) {
10168    // Since no types are specified above, the two possibilities are
10169    // - The argument is wrapped in {} or [], in which case Parser's
10170    //   parseGroup() returns an "ordgroup" wrapping some symbol node.
10171    // - The argument is a bare symbol node.
10172    var symNode = checkSymbolNodeType(args[0]);
10173    var colalign = symNode ? [args[0]] : assertNodeType(args[0], "ordgroup").body;
10174    var cols = colalign.map(function (nde) {
10175      var node = assertSymbolNodeType(nde);
10176      var ca = node.text;
10177
10178      if ("lcr".indexOf(ca) !== -1) {
10179        return {
10180          type: "align",
10181          align: ca
10182        };
10183      } else if (ca === "|") {
10184        return {
10185          type: "separator",
10186          separator: "|"
10187        };
10188      } else if (ca === ":") {
10189        return {
10190          type: "separator",
10191          separator: ":"
10192        };
10193      }
10194
10195      throw new src_ParseError("Unknown column alignment: " + ca, nde);
10196    });
10197    var res = {
10198      cols: cols,
10199      hskipBeforeAndAfter: true // \@preamble in lttab.dtx
10200
10201    };
10202    return parseArray(context.parser, res, dCellStyle(context.envName));
10203  },
10204  htmlBuilder: array_htmlBuilder,
10205  mathmlBuilder: array_mathmlBuilder
10206}); // The matrix environments of amsmath builds on the array environment
10207// of LaTeX, which is discussed above.
10208
10209defineEnvironment({
10210  type: "array",
10211  names: ["matrix", "pmatrix", "bmatrix", "Bmatrix", "vmatrix", "Vmatrix"],
10212  props: {
10213    numArgs: 0
10214  },
10215  handler: function handler(context) {
10216    var delimiters = {
10217      "matrix": null,
10218      "pmatrix": ["(", ")"],
10219      "bmatrix": ["[", "]"],
10220      "Bmatrix": ["\\{", "\\}"],
10221      "vmatrix": ["|", "|"],
10222      "Vmatrix": ["\\Vert", "\\Vert"]
10223    }[context.envName]; // \hskip -\arraycolsep in amsmath
10224
10225    var payload = {
10226      hskipBeforeAndAfter: false
10227    };
10228    var res = parseArray(context.parser, payload, dCellStyle(context.envName));
10229    return delimiters ? {
10230      type: "leftright",
10231      mode: context.mode,
10232      body: [res],
10233      left: delimiters[0],
10234      right: delimiters[1],
10235      rightColor: undefined // \right uninfluenced by \color in array
10236
10237    } : res;
10238  },
10239  htmlBuilder: array_htmlBuilder,
10240  mathmlBuilder: array_mathmlBuilder
10241});
10242defineEnvironment({
10243  type: "array",
10244  names: ["smallmatrix"],
10245  props: {
10246    numArgs: 0
10247  },
10248  handler: function handler(context) {
10249    var payload = {
10250      arraystretch: 0.5
10251    };
10252    var res = parseArray(context.parser, payload, "script");
10253    res.colSeparationType = "small";
10254    return res;
10255  },
10256  htmlBuilder: array_htmlBuilder,
10257  mathmlBuilder: array_mathmlBuilder
10258});
10259defineEnvironment({
10260  type: "array",
10261  names: ["subarray"],
10262  props: {
10263    numArgs: 1
10264  },
10265  handler: function handler(context, args) {
10266    // Parsing of {subarray} is similar to {array}
10267    var symNode = checkSymbolNodeType(args[0]);
10268    var colalign = symNode ? [args[0]] : assertNodeType(args[0], "ordgroup").body;
10269    var cols = colalign.map(function (nde) {
10270      var node = assertSymbolNodeType(nde);
10271      var ca = node.text; // {subarray} only recognizes "l" & "c"
10272
10273      if ("lc".indexOf(ca) !== -1) {
10274        return {
10275          type: "align",
10276          align: ca
10277        };
10278      }
10279
10280      throw new src_ParseError("Unknown column alignment: " + ca, nde);
10281    });
10282
10283    if (cols.length > 1) {
10284      throw new src_ParseError("{subarray} can contain only one column");
10285    }
10286
10287    var res = {
10288      cols: cols,
10289      hskipBeforeAndAfter: false,
10290      arraystretch: 0.5
10291    };
10292    res = parseArray(context.parser, res, "script");
10293
10294    if (res.body[0].length > 1) {
10295      throw new src_ParseError("{subarray} can contain only one column");
10296    }
10297
10298    return res;
10299  },
10300  htmlBuilder: array_htmlBuilder,
10301  mathmlBuilder: array_mathmlBuilder
10302}); // A cases environment (in amsmath.sty) is almost equivalent to
10303// \def\arraystretch{1.2}%
10304// \left\{\begin{array}{@{}l@{\quad}l@{}} … \end{array}\right.
10305// {dcases} is a {cases} environment where cells are set in \displaystyle,
10306// as defined in mathtools.sty.
10307
10308defineEnvironment({
10309  type: "array",
10310  names: ["cases", "dcases"],
10311  props: {
10312    numArgs: 0
10313  },
10314  handler: function handler(context) {
10315    var payload = {
10316      arraystretch: 1.2,
10317      cols: [{
10318        type: "align",
10319        align: "l",
10320        pregap: 0,
10321        // TODO(kevinb) get the current style.
10322        // For now we use the metrics for TEXT style which is what we were
10323        // doing before.  Before attempting to get the current style we
10324        // should look at TeX's behavior especially for \over and matrices.
10325        postgap: 1.0
10326        /* 1em quad */
10327
10328      }, {
10329        type: "align",
10330        align: "l",
10331        pregap: 0,
10332        postgap: 0
10333      }]
10334    };
10335    var res = parseArray(context.parser, payload, dCellStyle(context.envName));
10336    return {
10337      type: "leftright",
10338      mode: context.mode,
10339      body: [res],
10340      left: "\\{",
10341      right: ".",
10342      rightColor: undefined
10343    };
10344  },
10345  htmlBuilder: array_htmlBuilder,
10346  mathmlBuilder: array_mathmlBuilder
10347}); // An aligned environment is like the align* environment
10348// except it operates within math mode.
10349// Note that we assume \nomallineskiplimit to be zero,
10350// so that \strut@ is the same as \strut.
10351
10352defineEnvironment({
10353  type: "array",
10354  names: ["aligned"],
10355  props: {
10356    numArgs: 0
10357  },
10358  handler: array_alignedHandler,
10359  htmlBuilder: array_htmlBuilder,
10360  mathmlBuilder: array_mathmlBuilder
10361}); // A gathered environment is like an array environment with one centered
10362// column, but where rows are considered lines so get \jot line spacing
10363// and contents are set in \displaystyle.
10364
10365defineEnvironment({
10366  type: "array",
10367  names: ["gathered"],
10368  props: {
10369    numArgs: 0
10370  },
10371  handler: function handler(context) {
10372    var res = {
10373      cols: [{
10374        type: "align",
10375        align: "c"
10376      }],
10377      addJot: true
10378    };
10379    return parseArray(context.parser, res, "display");
10380  },
10381  htmlBuilder: array_htmlBuilder,
10382  mathmlBuilder: array_mathmlBuilder
10383}); // alignat environment is like an align environment, but one must explicitly
10384// specify maximum number of columns in each row, and can adjust spacing between
10385// each columns.
10386
10387defineEnvironment({
10388  type: "array",
10389  names: ["alignedat"],
10390  // One for numbered and for unnumbered;
10391  // but, KaTeX doesn't supports math numbering yet,
10392  // they make no difference for now.
10393  props: {
10394    numArgs: 1
10395  },
10396  handler: array_alignedHandler,
10397  htmlBuilder: array_htmlBuilder,
10398  mathmlBuilder: array_mathmlBuilder
10399}); // Catch \hline outside array environment
10400
10401defineFunction({
10402  type: "text",
10403  // Doesn't matter what this is.
10404  names: ["\\hline", "\\hdashline"],
10405  props: {
10406    numArgs: 0,
10407    allowedInText: true,
10408    allowedInMath: true
10409  },
10410  handler: function handler(context, args) {
10411    throw new src_ParseError(context.funcName + " valid only within array environment");
10412  }
10413});
10414// CONCATENATED MODULE: ./src/environments.js
10415
10416var environments = _environments;
10417/* harmony default export */ var src_environments = (environments); // All environment definitions should be imported below
10418
10419
10420// CONCATENATED MODULE: ./src/functions/environment.js
10421
10422
10423
10424 // Environment delimiters. HTML/MathML rendering is defined in the corresponding
10425// defineEnvironment definitions.
10426// $FlowFixMe, "environment" handler returns an environment ParseNode
10427
10428defineFunction({
10429  type: "environment",
10430  names: ["\\begin", "\\end"],
10431  props: {
10432    numArgs: 1,
10433    argTypes: ["text"]
10434  },
10435  handler: function handler(_ref, args) {
10436    var parser = _ref.parser,
10437        funcName = _ref.funcName;
10438    var nameGroup = args[0];
10439
10440    if (nameGroup.type !== "ordgroup") {
10441      throw new src_ParseError("Invalid environment name", nameGroup);
10442    }
10443
10444    var envName = "";
10445
10446    for (var i = 0; i < nameGroup.body.length; ++i) {
10447      envName += assertNodeType(nameGroup.body[i], "textord").text;
10448    }
10449
10450    if (funcName === "\\begin") {
10451      // begin...end is similar to left...right
10452      if (!src_environments.hasOwnProperty(envName)) {
10453        throw new src_ParseError("No such environment: " + envName, nameGroup);
10454      } // Build the environment object. Arguments and other information will
10455      // be made available to the begin and end methods using properties.
10456
10457
10458      var env = src_environments[envName];
10459
10460      var _parser$parseArgument = parser.parseArguments("\\begin{" + envName + "}", env),
10461          _args = _parser$parseArgument.args,
10462          optArgs = _parser$parseArgument.optArgs;
10463
10464      var context = {
10465        mode: parser.mode,
10466        envName: envName,
10467        parser: parser
10468      };
10469      var result = env.handler(context, _args, optArgs);
10470      parser.expect("\\end", false);
10471      var endNameToken = parser.nextToken;
10472      var end = assertNodeType(parser.parseFunction(), "environment");
10473
10474      if (end.name !== envName) {
10475        throw new src_ParseError("Mismatch: \\begin{" + envName + "} matched by \\end{" + end.name + "}", endNameToken);
10476      }
10477
10478      return result;
10479    }
10480
10481    return {
10482      type: "environment",
10483      mode: parser.mode,
10484      name: envName,
10485      nameGroup: nameGroup
10486    };
10487  }
10488});
10489// CONCATENATED MODULE: ./src/functions/mclass.js
10490
10491
10492
10493
10494
10495
10496var mclass_makeSpan = buildCommon.makeSpan;
10497
10498function mclass_htmlBuilder(group, options) {
10499  var elements = buildHTML_buildExpression(group.body, options, true);
10500  return mclass_makeSpan([group.mclass], elements, options);
10501}
10502
10503function mclass_mathmlBuilder(group, options) {
10504  var node;
10505  var inner = buildMathML_buildExpression(group.body, options);
10506
10507  if (group.mclass === "minner") {
10508    return mathMLTree.newDocumentFragment(inner);
10509  } else if (group.mclass === "mord") {
10510    if (group.isCharacterBox) {
10511      node = inner[0];
10512      node.type = "mi";
10513    } else {
10514      node = new mathMLTree.MathNode("mi", inner);
10515    }
10516  } else {
10517    if (group.isCharacterBox) {
10518      node = inner[0];
10519      node.type = "mo";
10520    } else {
10521      node = new mathMLTree.MathNode("mo", inner);
10522    } // Set spacing based on what is the most likely adjacent atom type.
10523    // See TeXbook p170.
10524
10525
10526    if (group.mclass === "mbin") {
10527      node.attributes.lspace = "0.22em"; // medium space
10528
10529      node.attributes.rspace = "0.22em";
10530    } else if (group.mclass === "mpunct") {
10531      node.attributes.lspace = "0em";
10532      node.attributes.rspace = "0.17em"; // thinspace
10533    } else if (group.mclass === "mopen" || group.mclass === "mclose") {
10534      node.attributes.lspace = "0em";
10535      node.attributes.rspace = "0em";
10536    } // MathML <mo> default space is 5/18 em, so <mrel> needs no action.
10537    // Ref: https://developer.mozilla.org/en-US/docs/Web/MathML/Element/mo
10538
10539  }
10540
10541  return node;
10542} // Math class commands except \mathop
10543
10544
10545defineFunction({
10546  type: "mclass",
10547  names: ["\\mathord", "\\mathbin", "\\mathrel", "\\mathopen", "\\mathclose", "\\mathpunct", "\\mathinner"],
10548  props: {
10549    numArgs: 1
10550  },
10551  handler: function handler(_ref, args) {
10552    var parser = _ref.parser,
10553        funcName = _ref.funcName;
10554    var body = args[0];
10555    return {
10556      type: "mclass",
10557      mode: parser.mode,
10558      mclass: "m" + funcName.substr(5),
10559      // TODO(kevinb): don't prefix with 'm'
10560      body: defineFunction_ordargument(body),
10561      isCharacterBox: utils.isCharacterBox(body)
10562    };
10563  },
10564  htmlBuilder: mclass_htmlBuilder,
10565  mathmlBuilder: mclass_mathmlBuilder
10566});
10567var binrelClass = function binrelClass(arg) {
10568  // \binrel@ spacing varies with (bin|rel|ord) of the atom in the argument.
10569  // (by rendering separately and with {}s before and after, and measuring
10570  // the change in spacing).  We'll do roughly the same by detecting the
10571  // atom type directly.
10572  var atom = arg.type === "ordgroup" && arg.body.length ? arg.body[0] : arg;
10573
10574  if (atom.type === "atom" && (atom.family === "bin" || atom.family === "rel")) {
10575    return "m" + atom.family;
10576  } else {
10577    return "mord";
10578  }
10579}; // \@binrel{x}{y} renders like y but as mbin/mrel/mord if x is mbin/mrel/mord.
10580// This is equivalent to \binrel@{x}\binrel@@{y} in AMSTeX.
10581
10582defineFunction({
10583  type: "mclass",
10584  names: ["\\@binrel"],
10585  props: {
10586    numArgs: 2
10587  },
10588  handler: function handler(_ref2, args) {
10589    var parser = _ref2.parser;
10590    return {
10591      type: "mclass",
10592      mode: parser.mode,
10593      mclass: binrelClass(args[0]),
10594      body: [args[1]],
10595      isCharacterBox: utils.isCharacterBox(args[1])
10596    };
10597  }
10598}); // Build a relation or stacked op by placing one symbol on top of another
10599
10600defineFunction({
10601  type: "mclass",
10602  names: ["\\stackrel", "\\overset", "\\underset"],
10603  props: {
10604    numArgs: 2
10605  },
10606  handler: function handler(_ref3, args) {
10607    var parser = _ref3.parser,
10608        funcName = _ref3.funcName;
10609    var baseArg = args[1];
10610    var shiftedArg = args[0];
10611    var mclass;
10612
10613    if (funcName !== "\\stackrel") {
10614      // LaTeX applies \binrel spacing to \overset and \underset.
10615      mclass = binrelClass(baseArg);
10616    } else {
10617      mclass = "mrel"; // for \stackrel
10618    }
10619
10620    var baseOp = {
10621      type: "op",
10622      mode: baseArg.mode,
10623      limits: true,
10624      alwaysHandleSupSub: true,
10625      parentIsSupSub: false,
10626      symbol: false,
10627      suppressBaseShift: funcName !== "\\stackrel",
10628      body: defineFunction_ordargument(baseArg)
10629    };
10630    var supsub = {
10631      type: "supsub",
10632      mode: shiftedArg.mode,
10633      base: baseOp,
10634      sup: funcName === "\\underset" ? null : shiftedArg,
10635      sub: funcName === "\\underset" ? shiftedArg : null
10636    };
10637    return {
10638      type: "mclass",
10639      mode: parser.mode,
10640      mclass: mclass,
10641      body: [supsub],
10642      isCharacterBox: utils.isCharacterBox(supsub)
10643    };
10644  },
10645  htmlBuilder: mclass_htmlBuilder,
10646  mathmlBuilder: mclass_mathmlBuilder
10647});
10648// CONCATENATED MODULE: ./src/functions/font.js
10649// TODO(kevinb): implement \\sl and \\sc
10650
10651
10652
10653
10654
10655
10656var font_htmlBuilder = function htmlBuilder(group, options) {
10657  var font = group.font;
10658  var newOptions = options.withFont(font);
10659  return buildHTML_buildGroup(group.body, newOptions);
10660};
10661
10662var font_mathmlBuilder = function mathmlBuilder(group, options) {
10663  var font = group.font;
10664  var newOptions = options.withFont(font);
10665  return buildMathML_buildGroup(group.body, newOptions);
10666};
10667
10668var fontAliases = {
10669  "\\Bbb": "\\mathbb",
10670  "\\bold": "\\mathbf",
10671  "\\frak": "\\mathfrak",
10672  "\\bm": "\\boldsymbol"
10673};
10674defineFunction({
10675  type: "font",
10676  names: [// styles, except \boldsymbol defined below
10677  "\\mathrm", "\\mathit", "\\mathbf", "\\mathnormal", // families
10678  "\\mathbb", "\\mathcal", "\\mathfrak", "\\mathscr", "\\mathsf", "\\mathtt", // aliases, except \bm defined below
10679  "\\Bbb", "\\bold", "\\frak"],
10680  props: {
10681    numArgs: 1,
10682    greediness: 2
10683  },
10684  handler: function handler(_ref, args) {
10685    var parser = _ref.parser,
10686        funcName = _ref.funcName;
10687    var body = args[0];
10688    var func = funcName;
10689
10690    if (func in fontAliases) {
10691      func = fontAliases[func];
10692    }
10693
10694    return {
10695      type: "font",
10696      mode: parser.mode,
10697      font: func.slice(1),
10698      body: body
10699    };
10700  },
10701  htmlBuilder: font_htmlBuilder,
10702  mathmlBuilder: font_mathmlBuilder
10703});
10704defineFunction({
10705  type: "mclass",
10706  names: ["\\boldsymbol", "\\bm"],
10707  props: {
10708    numArgs: 1,
10709    greediness: 2
10710  },
10711  handler: function handler(_ref2, args) {
10712    var parser = _ref2.parser;
10713    var body = args[0];
10714    var isCharacterBox = utils.isCharacterBox(body); // amsbsy.sty's \boldsymbol uses \binrel spacing to inherit the
10715    // argument's bin|rel|ord status
10716
10717    return {
10718      type: "mclass",
10719      mode: parser.mode,
10720      mclass: binrelClass(body),
10721      body: [{
10722        type: "font",
10723        mode: parser.mode,
10724        font: "boldsymbol",
10725        body: body
10726      }],
10727      isCharacterBox: isCharacterBox
10728    };
10729  }
10730}); // Old font changing functions
10731
10732defineFunction({
10733  type: "font",
10734  names: ["\\rm", "\\sf", "\\tt", "\\bf", "\\it"],
10735  props: {
10736    numArgs: 0,
10737    allowedInText: true
10738  },
10739  handler: function handler(_ref3, args) {
10740    var parser = _ref3.parser,
10741        funcName = _ref3.funcName,
10742        breakOnTokenText = _ref3.breakOnTokenText;
10743    var mode = parser.mode;
10744    var body = parser.parseExpression(true, breakOnTokenText);
10745    var style = "math" + funcName.slice(1);
10746    return {
10747      type: "font",
10748      mode: mode,
10749      font: style,
10750      body: {
10751        type: "ordgroup",
10752        mode: parser.mode,
10753        body: body
10754      }
10755    };
10756  },
10757  htmlBuilder: font_htmlBuilder,
10758  mathmlBuilder: font_mathmlBuilder
10759});
10760// CONCATENATED MODULE: ./src/functions/genfrac.js
10761
10762
10763
10764
10765
10766
10767
10768
10769
10770
10771
10772var genfrac_adjustStyle = function adjustStyle(size, originalStyle) {
10773  // Figure out what style this fraction should be in based on the
10774  // function used
10775  var style = originalStyle;
10776
10777  if (size === "display") {
10778    // Get display style as a default.
10779    // If incoming style is sub/sup, use style.text() to get correct size.
10780    style = style.id >= src_Style.SCRIPT.id ? style.text() : src_Style.DISPLAY;
10781  } else if (size === "text" && style.size === src_Style.DISPLAY.size) {
10782    // We're in a \tfrac but incoming style is displaystyle, so:
10783    style = src_Style.TEXT;
10784  } else if (size === "script") {
10785    style = src_Style.SCRIPT;
10786  } else if (size === "scriptscript") {
10787    style = src_Style.SCRIPTSCRIPT;
10788  }
10789
10790  return style;
10791};
10792
10793var genfrac_htmlBuilder = function htmlBuilder(group, options) {
10794  // Fractions are handled in the TeXbook on pages 444-445, rules 15(a-e).
10795  var style = genfrac_adjustStyle(group.size, options.style);
10796  var nstyle = style.fracNum();
10797  var dstyle = style.fracDen();
10798  var newOptions;
10799  newOptions = options.havingStyle(nstyle);
10800  var numerm = buildHTML_buildGroup(group.numer, newOptions, options);
10801
10802  if (group.continued) {
10803    // \cfrac inserts a \strut into the numerator.
10804    // Get \strut dimensions from TeXbook page 353.
10805    var hStrut = 8.5 / options.fontMetrics().ptPerEm;
10806    var dStrut = 3.5 / options.fontMetrics().ptPerEm;
10807    numerm.height = numerm.height < hStrut ? hStrut : numerm.height;
10808    numerm.depth = numerm.depth < dStrut ? dStrut : numerm.depth;
10809  }
10810
10811  newOptions = options.havingStyle(dstyle);
10812  var denomm = buildHTML_buildGroup(group.denom, newOptions, options);
10813  var rule;
10814  var ruleWidth;
10815  var ruleSpacing;
10816
10817  if (group.hasBarLine) {
10818    if (group.barSize) {
10819      ruleWidth = units_calculateSize(group.barSize, options);
10820      rule = buildCommon.makeLineSpan("frac-line", options, ruleWidth);
10821    } else {
10822      rule = buildCommon.makeLineSpan("frac-line", options);
10823    }
10824
10825    ruleWidth = rule.height;
10826    ruleSpacing = rule.height;
10827  } else {
10828    rule = null;
10829    ruleWidth = 0;
10830    ruleSpacing = options.fontMetrics().defaultRuleThickness;
10831  } // Rule 15b
10832
10833
10834  var numShift;
10835  var clearance;
10836  var denomShift;
10837
10838  if (style.size === src_Style.DISPLAY.size || group.size === "display") {
10839    numShift = options.fontMetrics().num1;
10840
10841    if (ruleWidth > 0) {
10842      clearance = 3 * ruleSpacing;
10843    } else {
10844      clearance = 7 * ruleSpacing;
10845    }
10846
10847    denomShift = options.fontMetrics().denom1;
10848  } else {
10849    if (ruleWidth > 0) {
10850      numShift = options.fontMetrics().num2;
10851      clearance = ruleSpacing;
10852    } else {
10853      numShift = options.fontMetrics().num3;
10854      clearance = 3 * ruleSpacing;
10855    }
10856
10857    denomShift = options.fontMetrics().denom2;
10858  }
10859
10860  var frac;
10861
10862  if (!rule) {
10863    // Rule 15c
10864    var candidateClearance = numShift - numerm.depth - (denomm.height - denomShift);
10865
10866    if (candidateClearance < clearance) {
10867      numShift += 0.5 * (clearance - candidateClearance);
10868      denomShift += 0.5 * (clearance - candidateClearance);
10869    }
10870
10871    frac = buildCommon.makeVList({
10872      positionType: "individualShift",
10873      children: [{
10874        type: "elem",
10875        elem: denomm,
10876        shift: denomShift
10877      }, {
10878        type: "elem",
10879        elem: numerm,
10880        shift: -numShift
10881      }]
10882    }, options);
10883  } else {
10884    // Rule 15d
10885    var axisHeight = options.fontMetrics().axisHeight;
10886
10887    if (numShift - numerm.depth - (axisHeight + 0.5 * ruleWidth) < clearance) {
10888      numShift += clearance - (numShift - numerm.depth - (axisHeight + 0.5 * ruleWidth));
10889    }
10890
10891    if (axisHeight - 0.5 * ruleWidth - (denomm.height - denomShift) < clearance) {
10892      denomShift += clearance - (axisHeight - 0.5 * ruleWidth - (denomm.height - denomShift));
10893    }
10894
10895    var midShift = -(axisHeight - 0.5 * ruleWidth);
10896    frac = buildCommon.makeVList({
10897      positionType: "individualShift",
10898      children: [{
10899        type: "elem",
10900        elem: denomm,
10901        shift: denomShift
10902      }, {
10903        type: "elem",
10904        elem: rule,
10905        shift: midShift
10906      }, {
10907        type: "elem",
10908        elem: numerm,
10909        shift: -numShift
10910      }]
10911    }, options);
10912  } // Since we manually change the style sometimes (with \dfrac or \tfrac),
10913  // account for the possible size change here.
10914
10915
10916  newOptions = options.havingStyle(style);
10917  frac.height *= newOptions.sizeMultiplier / options.sizeMultiplier;
10918  frac.depth *= newOptions.sizeMultiplier / options.sizeMultiplier; // Rule 15e
10919
10920  var delimSize;
10921
10922  if (style.size === src_Style.DISPLAY.size) {
10923    delimSize = options.fontMetrics().delim1;
10924  } else {
10925    delimSize = options.fontMetrics().delim2;
10926  }
10927
10928  var leftDelim;
10929  var rightDelim;
10930
10931  if (group.leftDelim == null) {
10932    leftDelim = makeNullDelimiter(options, ["mopen"]);
10933  } else {
10934    leftDelim = delimiter.customSizedDelim(group.leftDelim, delimSize, true, options.havingStyle(style), group.mode, ["mopen"]);
10935  }
10936
10937  if (group.continued) {
10938    rightDelim = buildCommon.makeSpan([]); // zero width for \cfrac
10939  } else if (group.rightDelim == null) {
10940    rightDelim = makeNullDelimiter(options, ["mclose"]);
10941  } else {
10942    rightDelim = delimiter.customSizedDelim(group.rightDelim, delimSize, true, options.havingStyle(style), group.mode, ["mclose"]);
10943  }
10944
10945  return buildCommon.makeSpan(["mord"].concat(newOptions.sizingClasses(options)), [leftDelim, buildCommon.makeSpan(["mfrac"], [frac]), rightDelim], options);
10946};
10947
10948var genfrac_mathmlBuilder = function mathmlBuilder(group, options) {
10949  var node = new mathMLTree.MathNode("mfrac", [buildMathML_buildGroup(group.numer, options), buildMathML_buildGroup(group.denom, options)]);
10950
10951  if (!group.hasBarLine) {
10952    node.setAttribute("linethickness", "0px");
10953  } else if (group.barSize) {
10954    var ruleWidth = units_calculateSize(group.barSize, options);
10955    node.setAttribute("linethickness", ruleWidth + "em");
10956  }
10957
10958  var style = genfrac_adjustStyle(group.size, options.style);
10959
10960  if (style.size !== options.style.size) {
10961    node = new mathMLTree.MathNode("mstyle", [node]);
10962    var isDisplay = style.size === src_Style.DISPLAY.size ? "true" : "false";
10963    node.setAttribute("displaystyle", isDisplay);
10964    node.setAttribute("scriptlevel", "0");
10965  }
10966
10967  if (group.leftDelim != null || group.rightDelim != null) {
10968    var withDelims = [];
10969
10970    if (group.leftDelim != null) {
10971      var leftOp = new mathMLTree.MathNode("mo", [new mathMLTree.TextNode(group.leftDelim.replace("\\", ""))]);
10972      leftOp.setAttribute("fence", "true");
10973      withDelims.push(leftOp);
10974    }
10975
10976    withDelims.push(node);
10977
10978    if (group.rightDelim != null) {
10979      var rightOp = new mathMLTree.MathNode("mo", [new mathMLTree.TextNode(group.rightDelim.replace("\\", ""))]);
10980      rightOp.setAttribute("fence", "true");
10981      withDelims.push(rightOp);
10982    }
10983
10984    return buildMathML_makeRow(withDelims);
10985  }
10986
10987  return node;
10988};
10989
10990defineFunction({
10991  type: "genfrac",
10992  names: ["\\cfrac", "\\dfrac", "\\frac", "\\tfrac", "\\dbinom", "\\binom", "\\tbinom", "\\\\atopfrac", // can’t be entered directly
10993  "\\\\bracefrac", "\\\\brackfrac"],
10994  props: {
10995    numArgs: 2,
10996    greediness: 2
10997  },
10998  handler: function handler(_ref, args) {
10999    var parser = _ref.parser,
11000        funcName = _ref.funcName;
11001    var numer = args[0];
11002    var denom = args[1];
11003    var hasBarLine;
11004    var leftDelim = null;
11005    var rightDelim = null;
11006    var size = "auto";
11007
11008    switch (funcName) {
11009      case "\\cfrac":
11010      case "\\dfrac":
11011      case "\\frac":
11012      case "\\tfrac":
11013        hasBarLine = true;
11014        break;
11015
11016      case "\\\\atopfrac":
11017        hasBarLine = false;
11018        break;
11019
11020      case "\\dbinom":
11021      case "\\binom":
11022      case "\\tbinom":
11023        hasBarLine = false;
11024        leftDelim = "(";
11025        rightDelim = ")";
11026        break;
11027
11028      case "\\\\bracefrac":
11029        hasBarLine = false;
11030        leftDelim = "\\{";
11031        rightDelim = "\\}";
11032        break;
11033
11034      case "\\\\brackfrac":
11035        hasBarLine = false;
11036        leftDelim = "[";
11037        rightDelim = "]";
11038        break;
11039
11040      default:
11041        throw new Error("Unrecognized genfrac command");
11042    }
11043
11044    switch (funcName) {
11045      case "\\cfrac":
11046      case "\\dfrac":
11047      case "\\dbinom":
11048        size = "display";
11049        break;
11050
11051      case "\\tfrac":
11052      case "\\tbinom":
11053        size = "text";
11054        break;
11055    }
11056
11057    return {
11058      type: "genfrac",
11059      mode: parser.mode,
11060      continued: funcName === "\\cfrac",
11061      numer: numer,
11062      denom: denom,
11063      hasBarLine: hasBarLine,
11064      leftDelim: leftDelim,
11065      rightDelim: rightDelim,
11066      size: size,
11067      barSize: null
11068    };
11069  },
11070  htmlBuilder: genfrac_htmlBuilder,
11071  mathmlBuilder: genfrac_mathmlBuilder
11072}); // Infix generalized fractions -- these are not rendered directly, but replaced
11073// immediately by one of the variants above.
11074
11075defineFunction({
11076  type: "infix",
11077  names: ["\\over", "\\choose", "\\atop", "\\brace", "\\brack"],
11078  props: {
11079    numArgs: 0,
11080    infix: true
11081  },
11082  handler: function handler(_ref2) {
11083    var parser = _ref2.parser,
11084        funcName = _ref2.funcName,
11085        token = _ref2.token;
11086    var replaceWith;
11087
11088    switch (funcName) {
11089      case "\\over":
11090        replaceWith = "\\frac";
11091        break;
11092
11093      case "\\choose":
11094        replaceWith = "\\binom";
11095        break;
11096
11097      case "\\atop":
11098        replaceWith = "\\\\atopfrac";
11099        break;
11100
11101      case "\\brace":
11102        replaceWith = "\\\\bracefrac";
11103        break;
11104
11105      case "\\brack":
11106        replaceWith = "\\\\brackfrac";
11107        break;
11108
11109      default:
11110        throw new Error("Unrecognized infix genfrac command");
11111    }
11112
11113    return {
11114      type: "infix",
11115      mode: parser.mode,
11116      replaceWith: replaceWith,
11117      token: token
11118    };
11119  }
11120});
11121var stylArray = ["display", "text", "script", "scriptscript"];
11122
11123var delimFromValue = function delimFromValue(delimString) {
11124  var delim = null;
11125
11126  if (delimString.length > 0) {
11127    delim = delimString;
11128    delim = delim === "." ? null : delim;
11129  }
11130
11131  return delim;
11132};
11133
11134defineFunction({
11135  type: "genfrac",
11136  names: ["\\genfrac"],
11137  props: {
11138    numArgs: 6,
11139    greediness: 6,
11140    argTypes: ["math", "math", "size", "text", "math", "math"]
11141  },
11142  handler: function handler(_ref3, args) {
11143    var parser = _ref3.parser;
11144    var numer = args[4];
11145    var denom = args[5]; // Look into the parse nodes to get the desired delimiters.
11146
11147    var leftNode = checkNodeType(args[0], "atom");
11148
11149    if (leftNode) {
11150      leftNode = assertAtomFamily(args[0], "open");
11151    }
11152
11153    var leftDelim = leftNode ? delimFromValue(leftNode.text) : null;
11154    var rightNode = checkNodeType(args[1], "atom");
11155
11156    if (rightNode) {
11157      rightNode = assertAtomFamily(args[1], "close");
11158    }
11159
11160    var rightDelim = rightNode ? delimFromValue(rightNode.text) : null;
11161    var barNode = assertNodeType(args[2], "size");
11162    var hasBarLine;
11163    var barSize = null;
11164
11165    if (barNode.isBlank) {
11166      // \genfrac acts differently than \above.
11167      // \genfrac treats an empty size group as a signal to use a
11168      // standard bar size. \above would see size = 0 and omit the bar.
11169      hasBarLine = true;
11170    } else {
11171      barSize = barNode.value;
11172      hasBarLine = barSize.number > 0;
11173    } // Find out if we want displaystyle, textstyle, etc.
11174
11175
11176    var size = "auto";
11177    var styl = checkNodeType(args[3], "ordgroup");
11178
11179    if (styl) {
11180      if (styl.body.length > 0) {
11181        var textOrd = assertNodeType(styl.body[0], "textord");
11182        size = stylArray[Number(textOrd.text)];
11183      }
11184    } else {
11185      styl = assertNodeType(args[3], "textord");
11186      size = stylArray[Number(styl.text)];
11187    }
11188
11189    return {
11190      type: "genfrac",
11191      mode: parser.mode,
11192      numer: numer,
11193      denom: denom,
11194      continued: false,
11195      hasBarLine: hasBarLine,
11196      barSize: barSize,
11197      leftDelim: leftDelim,
11198      rightDelim: rightDelim,
11199      size: size
11200    };
11201  },
11202  htmlBuilder: genfrac_htmlBuilder,
11203  mathmlBuilder: genfrac_mathmlBuilder
11204}); // \above is an infix fraction that also defines a fraction bar size.
11205
11206defineFunction({
11207  type: "infix",
11208  names: ["\\above"],
11209  props: {
11210    numArgs: 1,
11211    argTypes: ["size"],
11212    infix: true
11213  },
11214  handler: function handler(_ref4, args) {
11215    var parser = _ref4.parser,
11216        funcName = _ref4.funcName,
11217        token = _ref4.token;
11218    return {
11219      type: "infix",
11220      mode: parser.mode,
11221      replaceWith: "\\\\abovefrac",
11222      size: assertNodeType(args[0], "size").value,
11223      token: token
11224    };
11225  }
11226});
11227defineFunction({
11228  type: "genfrac",
11229  names: ["\\\\abovefrac"],
11230  props: {
11231    numArgs: 3,
11232    argTypes: ["math", "size", "math"]
11233  },
11234  handler: function handler(_ref5, args) {
11235    var parser = _ref5.parser,
11236        funcName = _ref5.funcName;
11237    var numer = args[0];
11238    var barSize = assert(assertNodeType(args[1], "infix").size);
11239    var denom = args[2];
11240    var hasBarLine = barSize.number > 0;
11241    return {
11242      type: "genfrac",
11243      mode: parser.mode,
11244      numer: numer,
11245      denom: denom,
11246      continued: false,
11247      hasBarLine: hasBarLine,
11248      barSize: barSize,
11249      leftDelim: null,
11250      rightDelim: null,
11251      size: "auto"
11252    };
11253  },
11254  htmlBuilder: genfrac_htmlBuilder,
11255  mathmlBuilder: genfrac_mathmlBuilder
11256});
11257// CONCATENATED MODULE: ./src/functions/horizBrace.js
11258
11259
11260
11261
11262
11263
11264
11265
11266// NOTE: Unlike most `htmlBuilder`s, this one handles not only "horizBrace", but
11267var horizBrace_htmlBuilder = function htmlBuilder(grp, options) {
11268  var style = options.style; // Pull out the `ParseNode<"horizBrace">` if `grp` is a "supsub" node.
11269
11270  var supSubGroup;
11271  var group;
11272  var supSub = checkNodeType(grp, "supsub");
11273
11274  if (supSub) {
11275    // Ref: LaTeX source2e: }}}}\limits}
11276    // i.e. LaTeX treats the brace similar to an op and passes it
11277    // with \limits, so we need to assign supsub style.
11278    supSubGroup = supSub.sup ? buildHTML_buildGroup(supSub.sup, options.havingStyle(style.sup()), options) : buildHTML_buildGroup(supSub.sub, options.havingStyle(style.sub()), options);
11279    group = assertNodeType(supSub.base, "horizBrace");
11280  } else {
11281    group = assertNodeType(grp, "horizBrace");
11282  } // Build the base group
11283
11284
11285  var body = buildHTML_buildGroup(group.base, options.havingBaseStyle(src_Style.DISPLAY)); // Create the stretchy element
11286
11287  var braceBody = stretchy.svgSpan(group, options); // Generate the vlist, with the appropriate kerns        ┏━━━━━━━━┓
11288  // This first vlist contains the content and the brace:   equation
11289
11290  var vlist;
11291
11292  if (group.isOver) {
11293    vlist = buildCommon.makeVList({
11294      positionType: "firstBaseline",
11295      children: [{
11296        type: "elem",
11297        elem: body
11298      }, {
11299        type: "kern",
11300        size: 0.1
11301      }, {
11302        type: "elem",
11303        elem: braceBody
11304      }]
11305    }, options); // $FlowFixMe: Replace this with passing "svg-align" into makeVList.
11306
11307    vlist.children[0].children[0].children[1].classes.push("svg-align");
11308  } else {
11309    vlist = buildCommon.makeVList({
11310      positionType: "bottom",
11311      positionData: body.depth + 0.1 + braceBody.height,
11312      children: [{
11313        type: "elem",
11314        elem: braceBody
11315      }, {
11316        type: "kern",
11317        size: 0.1
11318      }, {
11319        type: "elem",
11320        elem: body
11321      }]
11322    }, options); // $FlowFixMe: Replace this with passing "svg-align" into makeVList.
11323
11324    vlist.children[0].children[0].children[0].classes.push("svg-align");
11325  }
11326
11327  if (supSubGroup) {
11328    // To write the supsub, wrap the first vlist in another vlist:
11329    // They can't all go in the same vlist, because the note might be
11330    // wider than the equation. We want the equation to control the
11331    // brace width.
11332    //      note          long note           long note
11333    //   ┏━━━━━━━━┓   or    ┏━━━┓     not    ┏━━━━━━━━━┓
11334    //    equation           eqn                 eqn
11335    var vSpan = buildCommon.makeSpan(["mord", group.isOver ? "mover" : "munder"], [vlist], options);
11336
11337    if (group.isOver) {
11338      vlist = buildCommon.makeVList({
11339        positionType: "firstBaseline",
11340        children: [{
11341          type: "elem",
11342          elem: vSpan
11343        }, {
11344          type: "kern",
11345          size: 0.2
11346        }, {
11347          type: "elem",
11348          elem: supSubGroup
11349        }]
11350      }, options);
11351    } else {
11352      vlist = buildCommon.makeVList({
11353        positionType: "bottom",
11354        positionData: vSpan.depth + 0.2 + supSubGroup.height + supSubGroup.depth,
11355        children: [{
11356          type: "elem",
11357          elem: supSubGroup
11358        }, {
11359          type: "kern",
11360          size: 0.2
11361        }, {
11362          type: "elem",
11363          elem: vSpan
11364        }]
11365      }, options);
11366    }
11367  }
11368
11369  return buildCommon.makeSpan(["mord", group.isOver ? "mover" : "munder"], [vlist], options);
11370};
11371
11372var horizBrace_mathmlBuilder = function mathmlBuilder(group, options) {
11373  var accentNode = stretchy.mathMLnode(group.label);
11374  return new mathMLTree.MathNode(group.isOver ? "mover" : "munder", [buildMathML_buildGroup(group.base, options), accentNode]);
11375}; // Horizontal stretchy braces
11376
11377
11378defineFunction({
11379  type: "horizBrace",
11380  names: ["\\overbrace", "\\underbrace"],
11381  props: {
11382    numArgs: 1
11383  },
11384  handler: function handler(_ref, args) {
11385    var parser = _ref.parser,
11386        funcName = _ref.funcName;
11387    return {
11388      type: "horizBrace",
11389      mode: parser.mode,
11390      label: funcName,
11391      isOver: /^\\over/.test(funcName),
11392      base: args[0]
11393    };
11394  },
11395  htmlBuilder: horizBrace_htmlBuilder,
11396  mathmlBuilder: horizBrace_mathmlBuilder
11397});
11398// CONCATENATED MODULE: ./src/functions/href.js
11399
11400
11401
11402
11403
11404
11405defineFunction({
11406  type: "href",
11407  names: ["\\href"],
11408  props: {
11409    numArgs: 2,
11410    argTypes: ["url", "original"],
11411    allowedInText: true
11412  },
11413  handler: function handler(_ref, args) {
11414    var parser = _ref.parser;
11415    var body = args[1];
11416    var href = assertNodeType(args[0], "url").url;
11417
11418    if (!parser.settings.isTrusted({
11419      command: "\\href",
11420      url: href
11421    })) {
11422      return parser.formatUnsupportedCmd("\\href");
11423    }
11424
11425    return {
11426      type: "href",
11427      mode: parser.mode,
11428      href: href,
11429      body: defineFunction_ordargument(body)
11430    };
11431  },
11432  htmlBuilder: function htmlBuilder(group, options) {
11433    var elements = buildHTML_buildExpression(group.body, options, false);
11434    return buildCommon.makeAnchor(group.href, [], elements, options);
11435  },
11436  mathmlBuilder: function mathmlBuilder(group, options) {
11437    var math = buildExpressionRow(group.body, options);
11438
11439    if (!(math instanceof mathMLTree_MathNode)) {
11440      math = new mathMLTree_MathNode("mrow", [math]);
11441    }
11442
11443    math.setAttribute("href", group.href);
11444    return math;
11445  }
11446});
11447defineFunction({
11448  type: "href",
11449  names: ["\\url"],
11450  props: {
11451    numArgs: 1,
11452    argTypes: ["url"],
11453    allowedInText: true
11454  },
11455  handler: function handler(_ref2, args) {
11456    var parser = _ref2.parser;
11457    var href = assertNodeType(args[0], "url").url;
11458
11459    if (!parser.settings.isTrusted({
11460      command: "\\url",
11461      url: href
11462    })) {
11463      return parser.formatUnsupportedCmd("\\url");
11464    }
11465
11466    var chars = [];
11467
11468    for (var i = 0; i < href.length; i++) {
11469      var c = href[i];
11470
11471      if (c === "~") {
11472        c = "\\textasciitilde";
11473      }
11474
11475      chars.push({
11476        type: "textord",
11477        mode: "text",
11478        text: c
11479      });
11480    }
11481
11482    var body = {
11483      type: "text",
11484      mode: parser.mode,
11485      font: "\\texttt",
11486      body: chars
11487    };
11488    return {
11489      type: "href",
11490      mode: parser.mode,
11491      href: href,
11492      body: defineFunction_ordargument(body)
11493    };
11494  }
11495});
11496// CONCATENATED MODULE: ./src/functions/htmlmathml.js
11497
11498
11499
11500
11501defineFunction({
11502  type: "htmlmathml",
11503  names: ["\\html@mathml"],
11504  props: {
11505    numArgs: 2,
11506    allowedInText: true
11507  },
11508  handler: function handler(_ref, args) {
11509    var parser = _ref.parser;
11510    return {
11511      type: "htmlmathml",
11512      mode: parser.mode,
11513      html: defineFunction_ordargument(args[0]),
11514      mathml: defineFunction_ordargument(args[1])
11515    };
11516  },
11517  htmlBuilder: function htmlBuilder(group, options) {
11518    var elements = buildHTML_buildExpression(group.html, options, false);
11519    return buildCommon.makeFragment(elements);
11520  },
11521  mathmlBuilder: function mathmlBuilder(group, options) {
11522    return buildExpressionRow(group.mathml, options);
11523  }
11524});
11525// CONCATENATED MODULE: ./src/functions/includegraphics.js
11526
11527
11528
11529
11530
11531
11532
11533var includegraphics_sizeData = function sizeData(str) {
11534  if (/^[-+]? *(\d+(\.\d*)?|\.\d+)$/.test(str)) {
11535    // str is a number with no unit specified.
11536    // default unit is bp, per graphix package.
11537    return {
11538      number: +str,
11539      unit: "bp"
11540    };
11541  } else {
11542    var match = /([-+]?) *(\d+(?:\.\d*)?|\.\d+) *([a-z]{2})/.exec(str);
11543
11544    if (!match) {
11545      throw new src_ParseError("Invalid size: '" + str + "' in \\includegraphics");
11546    }
11547
11548    var data = {
11549      number: +(match[1] + match[2]),
11550      // sign + magnitude, cast to number
11551      unit: match[3]
11552    };
11553
11554    if (!validUnit(data)) {
11555      throw new src_ParseError("Invalid unit: '" + data.unit + "' in \\includegraphics.");
11556    }
11557
11558    return data;
11559  }
11560};
11561
11562defineFunction({
11563  type: "includegraphics",
11564  names: ["\\includegraphics"],
11565  props: {
11566    numArgs: 1,
11567    numOptionalArgs: 1,
11568    argTypes: ["raw", "url"],
11569    allowedInText: false
11570  },
11571  handler: function handler(_ref, args, optArgs) {
11572    var parser = _ref.parser;
11573    var width = {
11574      number: 0,
11575      unit: "em"
11576    };
11577    var height = {
11578      number: 0.9,
11579      unit: "em"
11580    }; // sorta character sized.
11581
11582    var totalheight = {
11583      number: 0,
11584      unit: "em"
11585    };
11586    var alt = "";
11587
11588    if (optArgs[0]) {
11589      var attributeStr = assertNodeType(optArgs[0], "raw").string; // Parser.js does not parse key/value pairs. We get a string.
11590
11591      var attributes = attributeStr.split(",");
11592
11593      for (var i = 0; i < attributes.length; i++) {
11594        var keyVal = attributes[i].split("=");
11595
11596        if (keyVal.length === 2) {
11597          var str = keyVal[1].trim();
11598
11599          switch (keyVal[0].trim()) {
11600            case "alt":
11601              alt = str;
11602              break;
11603
11604            case "width":
11605              width = includegraphics_sizeData(str);
11606              break;
11607
11608            case "height":
11609              height = includegraphics_sizeData(str);
11610              break;
11611
11612            case "totalheight":
11613              totalheight = includegraphics_sizeData(str);
11614              break;
11615
11616            default:
11617              throw new src_ParseError("Invalid key: '" + keyVal[0] + "' in \\includegraphics.");
11618          }
11619        }
11620      }
11621    }
11622
11623    var src = assertNodeType(args[0], "url").url;
11624
11625    if (alt === "") {
11626      // No alt given. Use the file name. Strip away the path.
11627      alt = src;
11628      alt = alt.replace(/^.*[\\/]/, '');
11629      alt = alt.substring(0, alt.lastIndexOf('.'));
11630    }
11631
11632    if (!parser.settings.isTrusted({
11633      command: "\\includegraphics",
11634      url: src
11635    })) {
11636      return parser.formatUnsupportedCmd("\\includegraphics");
11637    }
11638
11639    return {
11640      type: "includegraphics",
11641      mode: parser.mode,
11642      alt: alt,
11643      width: width,
11644      height: height,
11645      totalheight: totalheight,
11646      src: src
11647    };
11648  },
11649  htmlBuilder: function htmlBuilder(group, options) {
11650    var height = units_calculateSize(group.height, options);
11651    var depth = 0;
11652
11653    if (group.totalheight.number > 0) {
11654      depth = units_calculateSize(group.totalheight, options) - height;
11655      depth = Number(depth.toFixed(2));
11656    }
11657
11658    var width = 0;
11659
11660    if (group.width.number > 0) {
11661      width = units_calculateSize(group.width, options);
11662    }
11663
11664    var style = {
11665      height: height + depth + "em"
11666    };
11667
11668    if (width > 0) {
11669      style.width = width + "em";
11670    }
11671
11672    if (depth > 0) {
11673      style.verticalAlign = -depth + "em";
11674    }
11675
11676    var node = new domTree_Img(group.src, group.alt, style);
11677    node.height = height;
11678    node.depth = depth;
11679    return node;
11680  },
11681  mathmlBuilder: function mathmlBuilder(group, options) {
11682    var node = new mathMLTree.MathNode("mglyph", []);
11683    node.setAttribute("alt", group.alt);
11684    var height = units_calculateSize(group.height, options);
11685    var depth = 0;
11686
11687    if (group.totalheight.number > 0) {
11688      depth = units_calculateSize(group.totalheight, options) - height;
11689      depth = depth.toFixed(2);
11690      node.setAttribute("valign", "-" + depth + "em");
11691    }
11692
11693    node.setAttribute("height", height + depth + "em");
11694
11695    if (group.width.number > 0) {
11696      var width = units_calculateSize(group.width, options);
11697      node.setAttribute("width", width + "em");
11698    }
11699
11700    node.setAttribute("src", group.src);
11701    return node;
11702  }
11703});
11704// CONCATENATED MODULE: ./src/functions/kern.js
11705// Horizontal spacing commands
11706
11707
11708
11709
11710 // TODO: \hskip and \mskip should support plus and minus in lengths
11711
11712defineFunction({
11713  type: "kern",
11714  names: ["\\kern", "\\mkern", "\\hskip", "\\mskip"],
11715  props: {
11716    numArgs: 1,
11717    argTypes: ["size"],
11718    allowedInText: true
11719  },
11720  handler: function handler(_ref, args) {
11721    var parser = _ref.parser,
11722        funcName = _ref.funcName;
11723    var size = assertNodeType(args[0], "size");
11724
11725    if (parser.settings.strict) {
11726      var mathFunction = funcName[1] === 'm'; // \mkern, \mskip
11727
11728      var muUnit = size.value.unit === 'mu';
11729
11730      if (mathFunction) {
11731        if (!muUnit) {
11732          parser.settings.reportNonstrict("mathVsTextUnits", "LaTeX's " + funcName + " supports only mu units, " + ("not " + size.value.unit + " units"));
11733        }
11734
11735        if (parser.mode !== "math") {
11736          parser.settings.reportNonstrict("mathVsTextUnits", "LaTeX's " + funcName + " works only in math mode");
11737        }
11738      } else {
11739        // !mathFunction
11740        if (muUnit) {
11741          parser.settings.reportNonstrict("mathVsTextUnits", "LaTeX's " + funcName + " doesn't support mu units");
11742        }
11743      }
11744    }
11745
11746    return {
11747      type: "kern",
11748      mode: parser.mode,
11749      dimension: size.value
11750    };
11751  },
11752  htmlBuilder: function htmlBuilder(group, options) {
11753    return buildCommon.makeGlue(group.dimension, options);
11754  },
11755  mathmlBuilder: function mathmlBuilder(group, options) {
11756    var dimension = units_calculateSize(group.dimension, options);
11757    return new mathMLTree.SpaceNode(dimension);
11758  }
11759});
11760// CONCATENATED MODULE: ./src/functions/lap.js
11761// Horizontal overlap functions
11762
11763
11764
11765
11766
11767defineFunction({
11768  type: "lap",
11769  names: ["\\mathllap", "\\mathrlap", "\\mathclap"],
11770  props: {
11771    numArgs: 1,
11772    allowedInText: true
11773  },
11774  handler: function handler(_ref, args) {
11775    var parser = _ref.parser,
11776        funcName = _ref.funcName;
11777    var body = args[0];
11778    return {
11779      type: "lap",
11780      mode: parser.mode,
11781      alignment: funcName.slice(5),
11782      body: body
11783    };
11784  },
11785  htmlBuilder: function htmlBuilder(group, options) {
11786    // mathllap, mathrlap, mathclap
11787    var inner;
11788
11789    if (group.alignment === "clap") {
11790      // ref: https://www.math.lsu.edu/~aperlis/publications/mathclap/
11791      inner = buildCommon.makeSpan([], [buildHTML_buildGroup(group.body, options)]); // wrap, since CSS will center a .clap > .inner > span
11792
11793      inner = buildCommon.makeSpan(["inner"], [inner], options);
11794    } else {
11795      inner = buildCommon.makeSpan(["inner"], [buildHTML_buildGroup(group.body, options)]);
11796    }
11797
11798    var fix = buildCommon.makeSpan(["fix"], []);
11799    var node = buildCommon.makeSpan([group.alignment], [inner, fix], options); // At this point, we have correctly set horizontal alignment of the
11800    // two items involved in the lap.
11801    // Next, use a strut to set the height of the HTML bounding box.
11802    // Otherwise, a tall argument may be misplaced.
11803
11804    var strut = buildCommon.makeSpan(["strut"]);
11805    strut.style.height = node.height + node.depth + "em";
11806    strut.style.verticalAlign = -node.depth + "em";
11807    node.children.unshift(strut); // Next, prevent vertical misplacement when next to something tall.
11808
11809    node = buildCommon.makeVList({
11810      positionType: "firstBaseline",
11811      children: [{
11812        type: "elem",
11813        elem: node
11814      }]
11815    }, options); // Get the horizontal spacing correct relative to adjacent items.
11816
11817    return buildCommon.makeSpan(["mord"], [node], options);
11818  },
11819  mathmlBuilder: function mathmlBuilder(group, options) {
11820    // mathllap, mathrlap, mathclap
11821    var node = new mathMLTree.MathNode("mpadded", [buildMathML_buildGroup(group.body, options)]);
11822
11823    if (group.alignment !== "rlap") {
11824      var offset = group.alignment === "llap" ? "-1" : "-0.5";
11825      node.setAttribute("lspace", offset + "width");
11826    }
11827
11828    node.setAttribute("width", "0px");
11829    return node;
11830  }
11831});
11832// CONCATENATED MODULE: ./src/functions/math.js
11833
11834 // Switching from text mode back to math mode
11835
11836defineFunction({
11837  type: "styling",
11838  names: ["\\(", "$"],
11839  props: {
11840    numArgs: 0,
11841    allowedInText: true,
11842    allowedInMath: false
11843  },
11844  handler: function handler(_ref, args) {
11845    var funcName = _ref.funcName,
11846        parser = _ref.parser;
11847    var outerMode = parser.mode;
11848    parser.switchMode("math");
11849    var close = funcName === "\\(" ? "\\)" : "$";
11850    var body = parser.parseExpression(false, close);
11851    parser.expect(close);
11852    parser.switchMode(outerMode);
11853    return {
11854      type: "styling",
11855      mode: parser.mode,
11856      style: "text",
11857      body: body
11858    };
11859  }
11860}); // Check for extra closing math delimiters
11861
11862defineFunction({
11863  type: "text",
11864  // Doesn't matter what this is.
11865  names: ["\\)", "\\]"],
11866  props: {
11867    numArgs: 0,
11868    allowedInText: true,
11869    allowedInMath: false
11870  },
11871  handler: function handler(context, args) {
11872    throw new src_ParseError("Mismatched " + context.funcName);
11873  }
11874});
11875// CONCATENATED MODULE: ./src/functions/mathchoice.js
11876
11877
11878
11879
11880
11881
11882var mathchoice_chooseMathStyle = function chooseMathStyle(group, options) {
11883  switch (options.style.size) {
11884    case src_Style.DISPLAY.size:
11885      return group.display;
11886
11887    case src_Style.TEXT.size:
11888      return group.text;
11889
11890    case src_Style.SCRIPT.size:
11891      return group.script;
11892
11893    case src_Style.SCRIPTSCRIPT.size:
11894      return group.scriptscript;
11895
11896    default:
11897      return group.text;
11898  }
11899};
11900
11901defineFunction({
11902  type: "mathchoice",
11903  names: ["\\mathchoice"],
11904  props: {
11905    numArgs: 4
11906  },
11907  handler: function handler(_ref, args) {
11908    var parser = _ref.parser;
11909    return {
11910      type: "mathchoice",
11911      mode: parser.mode,
11912      display: defineFunction_ordargument(args[0]),
11913      text: defineFunction_ordargument(args[1]),
11914      script: defineFunction_ordargument(args[2]),
11915      scriptscript: defineFunction_ordargument(args[3])
11916    };
11917  },
11918  htmlBuilder: function htmlBuilder(group, options) {
11919    var body = mathchoice_chooseMathStyle(group, options);
11920    var elements = buildHTML_buildExpression(body, options, false);
11921    return buildCommon.makeFragment(elements);
11922  },
11923  mathmlBuilder: function mathmlBuilder(group, options) {
11924    var body = mathchoice_chooseMathStyle(group, options);
11925    return buildExpressionRow(body, options);
11926  }
11927});
11928// CONCATENATED MODULE: ./src/functions/utils/assembleSupSub.js
11929
11930
11931// For an operator with limits, assemble the base, sup, and sub into a span.
11932var assembleSupSub_assembleSupSub = function assembleSupSub(base, supGroup, subGroup, options, style, slant, baseShift) {
11933  // IE 8 clips \int if it is in a display: inline-block. We wrap it
11934  // in a new span so it is an inline, and works.
11935  base = buildCommon.makeSpan([], [base]);
11936  var sub;
11937  var sup; // We manually have to handle the superscripts and subscripts. This,
11938  // aside from the kern calculations, is copied from supsub.
11939
11940  if (supGroup) {
11941    var elem = buildHTML_buildGroup(supGroup, options.havingStyle(style.sup()), options);
11942    sup = {
11943      elem: elem,
11944      kern: Math.max(options.fontMetrics().bigOpSpacing1, options.fontMetrics().bigOpSpacing3 - elem.depth)
11945    };
11946  }
11947
11948  if (subGroup) {
11949    var _elem = buildHTML_buildGroup(subGroup, options.havingStyle(style.sub()), options);
11950
11951    sub = {
11952      elem: _elem,
11953      kern: Math.max(options.fontMetrics().bigOpSpacing2, options.fontMetrics().bigOpSpacing4 - _elem.height)
11954    };
11955  } // Build the final group as a vlist of the possible subscript, base,
11956  // and possible superscript.
11957
11958
11959  var finalGroup;
11960
11961  if (sup && sub) {
11962    var bottom = options.fontMetrics().bigOpSpacing5 + sub.elem.height + sub.elem.depth + sub.kern + base.depth + baseShift;
11963    finalGroup = buildCommon.makeVList({
11964      positionType: "bottom",
11965      positionData: bottom,
11966      children: [{
11967        type: "kern",
11968        size: options.fontMetrics().bigOpSpacing5
11969      }, {
11970        type: "elem",
11971        elem: sub.elem,
11972        marginLeft: -slant + "em"
11973      }, {
11974        type: "kern",
11975        size: sub.kern
11976      }, {
11977        type: "elem",
11978        elem: base
11979      }, {
11980        type: "kern",
11981        size: sup.kern
11982      }, {
11983        type: "elem",
11984        elem: sup.elem,
11985        marginLeft: slant + "em"
11986      }, {
11987        type: "kern",
11988        size: options.fontMetrics().bigOpSpacing5
11989      }]
11990    }, options);
11991  } else if (sub) {
11992    var top = base.height - baseShift; // Shift the limits by the slant of the symbol. Note
11993    // that we are supposed to shift the limits by 1/2 of the slant,
11994    // but since we are centering the limits adding a full slant of
11995    // margin will shift by 1/2 that.
11996
11997    finalGroup = buildCommon.makeVList({
11998      positionType: "top",
11999      positionData: top,
12000      children: [{
12001        type: "kern",
12002        size: options.fontMetrics().bigOpSpacing5
12003      }, {
12004        type: "elem",
12005        elem: sub.elem,
12006        marginLeft: -slant + "em"
12007      }, {
12008        type: "kern",
12009        size: sub.kern
12010      }, {
12011        type: "elem",
12012        elem: base
12013      }]
12014    }, options);
12015  } else if (sup) {
12016    var _bottom = base.depth + baseShift;
12017
12018    finalGroup = buildCommon.makeVList({
12019      positionType: "bottom",
12020      positionData: _bottom,
12021      children: [{
12022        type: "elem",
12023        elem: base
12024      }, {
12025        type: "kern",
12026        size: sup.kern
12027      }, {
12028        type: "elem",
12029        elem: sup.elem,
12030        marginLeft: slant + "em"
12031      }, {
12032        type: "kern",
12033        size: options.fontMetrics().bigOpSpacing5
12034      }]
12035    }, options);
12036  } else {
12037    // This case probably shouldn't occur (this would mean the
12038    // supsub was sending us a group with no superscript or
12039    // subscript) but be safe.
12040    return base;
12041  }
12042
12043  return buildCommon.makeSpan(["mop", "op-limits"], [finalGroup], options);
12044};
12045// CONCATENATED MODULE: ./src/functions/op.js
12046// Limits, symbols
12047
12048
12049
12050
12051
12052
12053
12054
12055
12056
12057// Most operators have a large successor symbol, but these don't.
12058var noSuccessor = ["\\smallint"]; // NOTE: Unlike most `htmlBuilder`s, this one handles not only "op", but also
12059// "supsub" since some of them (like \int) can affect super/subscripting.
12060
12061var op_htmlBuilder = function htmlBuilder(grp, options) {
12062  // Operators are handled in the TeXbook pg. 443-444, rule 13(a).
12063  var supGroup;
12064  var subGroup;
12065  var hasLimits = false;
12066  var group;
12067  var supSub = checkNodeType(grp, "supsub");
12068
12069  if (supSub) {
12070    // If we have limits, supsub will pass us its group to handle. Pull
12071    // out the superscript and subscript and set the group to the op in
12072    // its base.
12073    supGroup = supSub.sup;
12074    subGroup = supSub.sub;
12075    group = assertNodeType(supSub.base, "op");
12076    hasLimits = true;
12077  } else {
12078    group = assertNodeType(grp, "op");
12079  }
12080
12081  var style = options.style;
12082  var large = false;
12083
12084  if (style.size === src_Style.DISPLAY.size && group.symbol && !utils.contains(noSuccessor, group.name)) {
12085    // Most symbol operators get larger in displaystyle (rule 13)
12086    large = true;
12087  }
12088
12089  var base;
12090
12091  if (group.symbol) {
12092    // If this is a symbol, create the symbol.
12093    var fontName = large ? "Size2-Regular" : "Size1-Regular";
12094    var stash = "";
12095
12096    if (group.name === "\\oiint" || group.name === "\\oiiint") {
12097      // No font glyphs yet, so use a glyph w/o the oval.
12098      // TODO: When font glyphs are available, delete this code.
12099      stash = group.name.substr(1); // $FlowFixMe
12100
12101      group.name = stash === "oiint" ? "\\iint" : "\\iiint";
12102    }
12103
12104    base = buildCommon.makeSymbol(group.name, fontName, "math", options, ["mop", "op-symbol", large ? "large-op" : "small-op"]);
12105
12106    if (stash.length > 0) {
12107      // We're in \oiint or \oiiint. Overlay the oval.
12108      // TODO: When font glyphs are available, delete this code.
12109      var italic = base.italic;
12110      var oval = buildCommon.staticSvg(stash + "Size" + (large ? "2" : "1"), options);
12111      base = buildCommon.makeVList({
12112        positionType: "individualShift",
12113        children: [{
12114          type: "elem",
12115          elem: base,
12116          shift: 0
12117        }, {
12118          type: "elem",
12119          elem: oval,
12120          shift: large ? 0.08 : 0
12121        }]
12122      }, options); // $FlowFixMe
12123
12124      group.name = "\\" + stash;
12125      base.classes.unshift("mop"); // $FlowFixMe
12126
12127      base.italic = italic;
12128    }
12129  } else if (group.body) {
12130    // If this is a list, compose that list.
12131    var inner = buildHTML_buildExpression(group.body, options, true);
12132
12133    if (inner.length === 1 && inner[0] instanceof domTree_SymbolNode) {
12134      base = inner[0];
12135      base.classes[0] = "mop"; // replace old mclass
12136    } else {
12137      base = buildCommon.makeSpan(["mop"], buildCommon.tryCombineChars(inner), options);
12138    }
12139  } else {
12140    // Otherwise, this is a text operator. Build the text from the
12141    // operator's name.
12142    // TODO(emily): Add a space in the middle of some of these
12143    // operators, like \limsup
12144    var output = [];
12145
12146    for (var i = 1; i < group.name.length; i++) {
12147      output.push(buildCommon.mathsym(group.name[i], group.mode, options));
12148    }
12149
12150    base = buildCommon.makeSpan(["mop"], output, options);
12151  } // If content of op is a single symbol, shift it vertically.
12152
12153
12154  var baseShift = 0;
12155  var slant = 0;
12156
12157  if ((base instanceof domTree_SymbolNode || group.name === "\\oiint" || group.name === "\\oiiint") && !group.suppressBaseShift) {
12158    // We suppress the shift of the base of \overset and \underset. Otherwise,
12159    // shift the symbol so its center lies on the axis (rule 13). It
12160    // appears that our fonts have the centers of the symbols already
12161    // almost on the axis, so these numbers are very small. Note we
12162    // don't actually apply this here, but instead it is used either in
12163    // the vlist creation or separately when there are no limits.
12164    baseShift = (base.height - base.depth) / 2 - options.fontMetrics().axisHeight; // The slant of the symbol is just its italic correction.
12165    // $FlowFixMe
12166
12167    slant = base.italic;
12168  }
12169
12170  if (hasLimits) {
12171    return assembleSupSub_assembleSupSub(base, supGroup, subGroup, options, style, slant, baseShift);
12172  } else {
12173    if (baseShift) {
12174      base.style.position = "relative";
12175      base.style.top = baseShift + "em";
12176    }
12177
12178    return base;
12179  }
12180};
12181
12182var op_mathmlBuilder = function mathmlBuilder(group, options) {
12183  var node;
12184
12185  if (group.symbol) {
12186    // This is a symbol. Just add the symbol.
12187    node = new mathMLTree_MathNode("mo", [buildMathML_makeText(group.name, group.mode)]);
12188
12189    if (utils.contains(noSuccessor, group.name)) {
12190      node.setAttribute("largeop", "false");
12191    }
12192  } else if (group.body) {
12193    // This is an operator with children. Add them.
12194    node = new mathMLTree_MathNode("mo", buildMathML_buildExpression(group.body, options));
12195  } else {
12196    // This is a text operator. Add all of the characters from the
12197    // operator's name.
12198    node = new mathMLTree_MathNode("mi", [new mathMLTree_TextNode(group.name.slice(1))]); // Append an <mo>&ApplyFunction;</mo>.
12199    // ref: https://www.w3.org/TR/REC-MathML/chap3_2.html#sec3.2.4
12200
12201    var operator = new mathMLTree_MathNode("mo", [buildMathML_makeText("\u2061", "text")]);
12202
12203    if (group.parentIsSupSub) {
12204      node = new mathMLTree_MathNode("mo", [node, operator]);
12205    } else {
12206      node = newDocumentFragment([node, operator]);
12207    }
12208  }
12209
12210  return node;
12211};
12212
12213var singleCharBigOps = {
12214  "\u220F": "\\prod",
12215  "\u2210": "\\coprod",
12216  "\u2211": "\\sum",
12217  "\u22C0": "\\bigwedge",
12218  "\u22C1": "\\bigvee",
12219  "\u22C2": "\\bigcap",
12220  "\u22C3": "\\bigcup",
12221  "\u2A00": "\\bigodot",
12222  "\u2A01": "\\bigoplus",
12223  "\u2A02": "\\bigotimes",
12224  "\u2A04": "\\biguplus",
12225  "\u2A06": "\\bigsqcup"
12226};
12227defineFunction({
12228  type: "op",
12229  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"],
12230  props: {
12231    numArgs: 0
12232  },
12233  handler: function handler(_ref, args) {
12234    var parser = _ref.parser,
12235        funcName = _ref.funcName;
12236    var fName = funcName;
12237
12238    if (fName.length === 1) {
12239      fName = singleCharBigOps[fName];
12240    }
12241
12242    return {
12243      type: "op",
12244      mode: parser.mode,
12245      limits: true,
12246      parentIsSupSub: false,
12247      symbol: true,
12248      name: fName
12249    };
12250  },
12251  htmlBuilder: op_htmlBuilder,
12252  mathmlBuilder: op_mathmlBuilder
12253}); // Note: calling defineFunction with a type that's already been defined only
12254// works because the same htmlBuilder and mathmlBuilder are being used.
12255
12256defineFunction({
12257  type: "op",
12258  names: ["\\mathop"],
12259  props: {
12260    numArgs: 1
12261  },
12262  handler: function handler(_ref2, args) {
12263    var parser = _ref2.parser;
12264    var body = args[0];
12265    return {
12266      type: "op",
12267      mode: parser.mode,
12268      limits: false,
12269      parentIsSupSub: false,
12270      symbol: false,
12271      body: defineFunction_ordargument(body)
12272    };
12273  },
12274  htmlBuilder: op_htmlBuilder,
12275  mathmlBuilder: op_mathmlBuilder
12276}); // There are 2 flags for operators; whether they produce limits in
12277// displaystyle, and whether they are symbols and should grow in
12278// displaystyle. These four groups cover the four possible choices.
12279
12280var singleCharIntegrals = {
12281  "\u222B": "\\int",
12282  "\u222C": "\\iint",
12283  "\u222D": "\\iiint",
12284  "\u222E": "\\oint",
12285  "\u222F": "\\oiint",
12286  "\u2230": "\\oiiint"
12287}; // No limits, not symbols
12288
12289defineFunction({
12290  type: "op",
12291  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"],
12292  props: {
12293    numArgs: 0
12294  },
12295  handler: function handler(_ref3) {
12296    var parser = _ref3.parser,
12297        funcName = _ref3.funcName;
12298    return {
12299      type: "op",
12300      mode: parser.mode,
12301      limits: false,
12302      parentIsSupSub: false,
12303      symbol: false,
12304      name: funcName
12305    };
12306  },
12307  htmlBuilder: op_htmlBuilder,
12308  mathmlBuilder: op_mathmlBuilder
12309}); // Limits, not symbols
12310
12311defineFunction({
12312  type: "op",
12313  names: ["\\det", "\\gcd", "\\inf", "\\lim", "\\max", "\\min", "\\Pr", "\\sup"],
12314  props: {
12315    numArgs: 0
12316  },
12317  handler: function handler(_ref4) {
12318    var parser = _ref4.parser,
12319        funcName = _ref4.funcName;
12320    return {
12321      type: "op",
12322      mode: parser.mode,
12323      limits: true,
12324      parentIsSupSub: false,
12325      symbol: false,
12326      name: funcName
12327    };
12328  },
12329  htmlBuilder: op_htmlBuilder,
12330  mathmlBuilder: op_mathmlBuilder
12331}); // No limits, symbols
12332
12333defineFunction({
12334  type: "op",
12335  names: ["\\int", "\\iint", "\\iiint", "\\oint", "\\oiint", "\\oiiint", "\u222B", "\u222C", "\u222D", "\u222E", "\u222F", "\u2230"],
12336  props: {
12337    numArgs: 0
12338  },
12339  handler: function handler(_ref5) {
12340    var parser = _ref5.parser,
12341        funcName = _ref5.funcName;
12342    var fName = funcName;
12343
12344    if (fName.length === 1) {
12345      fName = singleCharIntegrals[fName];
12346    }
12347
12348    return {
12349      type: "op",
12350      mode: parser.mode,
12351      limits: false,
12352      parentIsSupSub: false,
12353      symbol: true,
12354      name: fName
12355    };
12356  },
12357  htmlBuilder: op_htmlBuilder,
12358  mathmlBuilder: op_mathmlBuilder
12359});
12360// CONCATENATED MODULE: ./src/functions/operatorname.js
12361
12362
12363
12364
12365
12366
12367
12368
12369// NOTE: Unlike most `htmlBuilder`s, this one handles not only
12370// "operatorname", but also  "supsub" since \operatorname* can
12371var operatorname_htmlBuilder = function htmlBuilder(grp, options) {
12372  // Operators are handled in the TeXbook pg. 443-444, rule 13(a).
12373  var supGroup;
12374  var subGroup;
12375  var hasLimits = false;
12376  var group;
12377  var supSub = checkNodeType(grp, "supsub");
12378
12379  if (supSub) {
12380    // If we have limits, supsub will pass us its group to handle. Pull
12381    // out the superscript and subscript and set the group to the op in
12382    // its base.
12383    supGroup = supSub.sup;
12384    subGroup = supSub.sub;
12385    group = assertNodeType(supSub.base, "operatorname");
12386    hasLimits = true;
12387  } else {
12388    group = assertNodeType(grp, "operatorname");
12389  }
12390
12391  var base;
12392
12393  if (group.body.length > 0) {
12394    var body = group.body.map(function (child) {
12395      // $FlowFixMe: Check if the node has a string `text` property.
12396      var childText = child.text;
12397
12398      if (typeof childText === "string") {
12399        return {
12400          type: "textord",
12401          mode: child.mode,
12402          text: childText
12403        };
12404      } else {
12405        return child;
12406      }
12407    }); // Consolidate function names into symbol characters.
12408
12409    var expression = buildHTML_buildExpression(body, options.withFont("mathrm"), true);
12410
12411    for (var i = 0; i < expression.length; i++) {
12412      var child = expression[i];
12413
12414      if (child instanceof domTree_SymbolNode) {
12415        // Per amsopn package,
12416        // change minus to hyphen and \ast to asterisk
12417        child.text = child.text.replace(/\u2212/, "-").replace(/\u2217/, "*");
12418      }
12419    }
12420
12421    base = buildCommon.makeSpan(["mop"], expression, options);
12422  } else {
12423    base = buildCommon.makeSpan(["mop"], [], options);
12424  }
12425
12426  if (hasLimits) {
12427    return assembleSupSub_assembleSupSub(base, supGroup, subGroup, options, options.style, 0, 0);
12428  } else {
12429    return base;
12430  }
12431};
12432
12433var operatorname_mathmlBuilder = function mathmlBuilder(group, options) {
12434  // The steps taken here are similar to the html version.
12435  var expression = buildMathML_buildExpression(group.body, options.withFont("mathrm")); // Is expression a string or has it something like a fraction?
12436
12437  var isAllString = true; // default
12438
12439  for (var i = 0; i < expression.length; i++) {
12440    var node = expression[i];
12441
12442    if (node instanceof mathMLTree.SpaceNode) {// Do nothing
12443    } else if (node instanceof mathMLTree.MathNode) {
12444      switch (node.type) {
12445        case "mi":
12446        case "mn":
12447        case "ms":
12448        case "mspace":
12449        case "mtext":
12450          break;
12451        // Do nothing yet.
12452
12453        case "mo":
12454          {
12455            var child = node.children[0];
12456
12457            if (node.children.length === 1 && child instanceof mathMLTree.TextNode) {
12458              child.text = child.text.replace(/\u2212/, "-").replace(/\u2217/, "*");
12459            } else {
12460              isAllString = false;
12461            }
12462
12463            break;
12464          }
12465
12466        default:
12467          isAllString = false;
12468      }
12469    } else {
12470      isAllString = false;
12471    }
12472  }
12473
12474  if (isAllString) {
12475    // Write a single TextNode instead of multiple nested tags.
12476    var word = expression.map(function (node) {
12477      return node.toText();
12478    }).join("");
12479    expression = [new mathMLTree.TextNode(word)];
12480  }
12481
12482  var identifier = new mathMLTree.MathNode("mi", expression);
12483  identifier.setAttribute("mathvariant", "normal"); // \u2061 is the same as &ApplyFunction;
12484  // ref: https://www.w3schools.com/charsets/ref_html_entities_a.asp
12485
12486  var operator = new mathMLTree.MathNode("mo", [buildMathML_makeText("\u2061", "text")]);
12487
12488  if (group.parentIsSupSub) {
12489    return new mathMLTree.MathNode("mo", [identifier, operator]);
12490  } else {
12491    return mathMLTree.newDocumentFragment([identifier, operator]);
12492  }
12493}; // \operatorname
12494// amsopn.dtx: \mathop{#1\kern\z@\operator@font#3}\newmcodes@
12495
12496
12497defineFunction({
12498  type: "operatorname",
12499  names: ["\\operatorname", "\\operatorname*"],
12500  props: {
12501    numArgs: 1
12502  },
12503  handler: function handler(_ref, args) {
12504    var parser = _ref.parser,
12505        funcName = _ref.funcName;
12506    var body = args[0];
12507    return {
12508      type: "operatorname",
12509      mode: parser.mode,
12510      body: defineFunction_ordargument(body),
12511      alwaysHandleSupSub: funcName === "\\operatorname*",
12512      limits: false,
12513      parentIsSupSub: false
12514    };
12515  },
12516  htmlBuilder: operatorname_htmlBuilder,
12517  mathmlBuilder: operatorname_mathmlBuilder
12518});
12519// CONCATENATED MODULE: ./src/functions/ordgroup.js
12520
12521
12522
12523
12524defineFunctionBuilders({
12525  type: "ordgroup",
12526  htmlBuilder: function htmlBuilder(group, options) {
12527    if (group.semisimple) {
12528      return buildCommon.makeFragment(buildHTML_buildExpression(group.body, options, false));
12529    }
12530
12531    return buildCommon.makeSpan(["mord"], buildHTML_buildExpression(group.body, options, true), options);
12532  },
12533  mathmlBuilder: function mathmlBuilder(group, options) {
12534    return buildExpressionRow(group.body, options, true);
12535  }
12536});
12537// CONCATENATED MODULE: ./src/functions/overline.js
12538
12539
12540
12541
12542
12543defineFunction({
12544  type: "overline",
12545  names: ["\\overline"],
12546  props: {
12547    numArgs: 1
12548  },
12549  handler: function handler(_ref, args) {
12550    var parser = _ref.parser;
12551    var body = args[0];
12552    return {
12553      type: "overline",
12554      mode: parser.mode,
12555      body: body
12556    };
12557  },
12558  htmlBuilder: function htmlBuilder(group, options) {
12559    // Overlines are handled in the TeXbook pg 443, Rule 9.
12560    // Build the inner group in the cramped style.
12561    var innerGroup = buildHTML_buildGroup(group.body, options.havingCrampedStyle()); // Create the line above the body
12562
12563    var line = buildCommon.makeLineSpan("overline-line", options); // Generate the vlist, with the appropriate kerns
12564
12565    var defaultRuleThickness = options.fontMetrics().defaultRuleThickness;
12566    var vlist = buildCommon.makeVList({
12567      positionType: "firstBaseline",
12568      children: [{
12569        type: "elem",
12570        elem: innerGroup
12571      }, {
12572        type: "kern",
12573        size: 3 * defaultRuleThickness
12574      }, {
12575        type: "elem",
12576        elem: line
12577      }, {
12578        type: "kern",
12579        size: defaultRuleThickness
12580      }]
12581    }, options);
12582    return buildCommon.makeSpan(["mord", "overline"], [vlist], options);
12583  },
12584  mathmlBuilder: function mathmlBuilder(group, options) {
12585    var operator = new mathMLTree.MathNode("mo", [new mathMLTree.TextNode("\u203E")]);
12586    operator.setAttribute("stretchy", "true");
12587    var node = new mathMLTree.MathNode("mover", [buildMathML_buildGroup(group.body, options), operator]);
12588    node.setAttribute("accent", "true");
12589    return node;
12590  }
12591});
12592// CONCATENATED MODULE: ./src/functions/phantom.js
12593
12594
12595
12596
12597
12598defineFunction({
12599  type: "phantom",
12600  names: ["\\phantom"],
12601  props: {
12602    numArgs: 1,
12603    allowedInText: true
12604  },
12605  handler: function handler(_ref, args) {
12606    var parser = _ref.parser;
12607    var body = args[0];
12608    return {
12609      type: "phantom",
12610      mode: parser.mode,
12611      body: defineFunction_ordargument(body)
12612    };
12613  },
12614  htmlBuilder: function htmlBuilder(group, options) {
12615    var elements = buildHTML_buildExpression(group.body, options.withPhantom(), false); // \phantom isn't supposed to affect the elements it contains.
12616    // See "color" for more details.
12617
12618    return buildCommon.makeFragment(elements);
12619  },
12620  mathmlBuilder: function mathmlBuilder(group, options) {
12621    var inner = buildMathML_buildExpression(group.body, options);
12622    return new mathMLTree.MathNode("mphantom", inner);
12623  }
12624});
12625defineFunction({
12626  type: "hphantom",
12627  names: ["\\hphantom"],
12628  props: {
12629    numArgs: 1,
12630    allowedInText: true
12631  },
12632  handler: function handler(_ref2, args) {
12633    var parser = _ref2.parser;
12634    var body = args[0];
12635    return {
12636      type: "hphantom",
12637      mode: parser.mode,
12638      body: body
12639    };
12640  },
12641  htmlBuilder: function htmlBuilder(group, options) {
12642    var node = buildCommon.makeSpan([], [buildHTML_buildGroup(group.body, options.withPhantom())]);
12643    node.height = 0;
12644    node.depth = 0;
12645
12646    if (node.children) {
12647      for (var i = 0; i < node.children.length; i++) {
12648        node.children[i].height = 0;
12649        node.children[i].depth = 0;
12650      }
12651    } // See smash for comment re: use of makeVList
12652
12653
12654    node = buildCommon.makeVList({
12655      positionType: "firstBaseline",
12656      children: [{
12657        type: "elem",
12658        elem: node
12659      }]
12660    }, options); // For spacing, TeX treats \smash as a math group (same spacing as ord).
12661
12662    return buildCommon.makeSpan(["mord"], [node], options);
12663  },
12664  mathmlBuilder: function mathmlBuilder(group, options) {
12665    var inner = buildMathML_buildExpression(defineFunction_ordargument(group.body), options);
12666    var phantom = new mathMLTree.MathNode("mphantom", inner);
12667    var node = new mathMLTree.MathNode("mpadded", [phantom]);
12668    node.setAttribute("height", "0px");
12669    node.setAttribute("depth", "0px");
12670    return node;
12671  }
12672});
12673defineFunction({
12674  type: "vphantom",
12675  names: ["\\vphantom"],
12676  props: {
12677    numArgs: 1,
12678    allowedInText: true
12679  },
12680  handler: function handler(_ref3, args) {
12681    var parser = _ref3.parser;
12682    var body = args[0];
12683    return {
12684      type: "vphantom",
12685      mode: parser.mode,
12686      body: body
12687    };
12688  },
12689  htmlBuilder: function htmlBuilder(group, options) {
12690    var inner = buildCommon.makeSpan(["inner"], [buildHTML_buildGroup(group.body, options.withPhantom())]);
12691    var fix = buildCommon.makeSpan(["fix"], []);
12692    return buildCommon.makeSpan(["mord", "rlap"], [inner, fix], options);
12693  },
12694  mathmlBuilder: function mathmlBuilder(group, options) {
12695    var inner = buildMathML_buildExpression(defineFunction_ordargument(group.body), options);
12696    var phantom = new mathMLTree.MathNode("mphantom", inner);
12697    var node = new mathMLTree.MathNode("mpadded", [phantom]);
12698    node.setAttribute("width", "0px");
12699    return node;
12700  }
12701});
12702// CONCATENATED MODULE: ./src/functions/raisebox.js
12703
12704
12705
12706
12707
12708
12709 // Box manipulation
12710
12711defineFunction({
12712  type: "raisebox",
12713  names: ["\\raisebox"],
12714  props: {
12715    numArgs: 2,
12716    argTypes: ["size", "hbox"],
12717    allowedInText: true
12718  },
12719  handler: function handler(_ref, args) {
12720    var parser = _ref.parser;
12721    var amount = assertNodeType(args[0], "size").value;
12722    var body = args[1];
12723    return {
12724      type: "raisebox",
12725      mode: parser.mode,
12726      dy: amount,
12727      body: body
12728    };
12729  },
12730  htmlBuilder: function htmlBuilder(group, options) {
12731    var body = buildHTML_buildGroup(group.body, options);
12732    var dy = units_calculateSize(group.dy, options);
12733    return buildCommon.makeVList({
12734      positionType: "shift",
12735      positionData: -dy,
12736      children: [{
12737        type: "elem",
12738        elem: body
12739      }]
12740    }, options);
12741  },
12742  mathmlBuilder: function mathmlBuilder(group, options) {
12743    var node = new mathMLTree.MathNode("mpadded", [buildMathML_buildGroup(group.body, options)]);
12744    var dy = group.dy.number + group.dy.unit;
12745    node.setAttribute("voffset", dy);
12746    return node;
12747  }
12748});
12749// CONCATENATED MODULE: ./src/functions/rule.js
12750
12751
12752
12753
12754
12755defineFunction({
12756  type: "rule",
12757  names: ["\\rule"],
12758  props: {
12759    numArgs: 2,
12760    numOptionalArgs: 1,
12761    argTypes: ["size", "size", "size"]
12762  },
12763  handler: function handler(_ref, args, optArgs) {
12764    var parser = _ref.parser;
12765    var shift = optArgs[0];
12766    var width = assertNodeType(args[0], "size");
12767    var height = assertNodeType(args[1], "size");
12768    return {
12769      type: "rule",
12770      mode: parser.mode,
12771      shift: shift && assertNodeType(shift, "size").value,
12772      width: width.value,
12773      height: height.value
12774    };
12775  },
12776  htmlBuilder: function htmlBuilder(group, options) {
12777    // Make an empty span for the rule
12778    var rule = buildCommon.makeSpan(["mord", "rule"], [], options); // Calculate the shift, width, and height of the rule, and account for units
12779
12780    var width = units_calculateSize(group.width, options);
12781    var height = units_calculateSize(group.height, options);
12782    var shift = group.shift ? units_calculateSize(group.shift, options) : 0; // Style the rule to the right size
12783
12784    rule.style.borderRightWidth = width + "em";
12785    rule.style.borderTopWidth = height + "em";
12786    rule.style.bottom = shift + "em"; // Record the height and width
12787
12788    rule.width = width;
12789    rule.height = height + shift;
12790    rule.depth = -shift; // Font size is the number large enough that the browser will
12791    // reserve at least `absHeight` space above the baseline.
12792    // The 1.125 factor was empirically determined
12793
12794    rule.maxFontSize = height * 1.125 * options.sizeMultiplier;
12795    return rule;
12796  },
12797  mathmlBuilder: function mathmlBuilder(group, options) {
12798    var width = units_calculateSize(group.width, options);
12799    var height = units_calculateSize(group.height, options);
12800    var shift = group.shift ? units_calculateSize(group.shift, options) : 0;
12801    var color = options.color && options.getColor() || "black";
12802    var rule = new mathMLTree.MathNode("mspace");
12803    rule.setAttribute("mathbackground", color);
12804    rule.setAttribute("width", width + "em");
12805    rule.setAttribute("height", height + "em");
12806    var wrapper = new mathMLTree.MathNode("mpadded", [rule]);
12807
12808    if (shift >= 0) {
12809      wrapper.setAttribute("height", "+" + shift + "em");
12810    } else {
12811      wrapper.setAttribute("height", shift + "em");
12812      wrapper.setAttribute("depth", "+" + -shift + "em");
12813    }
12814
12815    wrapper.setAttribute("voffset", shift + "em");
12816    return wrapper;
12817  }
12818});
12819// CONCATENATED MODULE: ./src/functions/sizing.js
12820
12821
12822
12823
12824
12825function sizingGroup(value, options, baseOptions) {
12826  var inner = buildHTML_buildExpression(value, options, false);
12827  var multiplier = options.sizeMultiplier / baseOptions.sizeMultiplier; // Add size-resetting classes to the inner list and set maxFontSize
12828  // manually. Handle nested size changes.
12829
12830  for (var i = 0; i < inner.length; i++) {
12831    var pos = inner[i].classes.indexOf("sizing");
12832
12833    if (pos < 0) {
12834      Array.prototype.push.apply(inner[i].classes, options.sizingClasses(baseOptions));
12835    } else if (inner[i].classes[pos + 1] === "reset-size" + options.size) {
12836      // This is a nested size change: e.g., inner[i] is the "b" in
12837      // `\Huge a \small b`. Override the old size (the `reset-` class)
12838      // but not the new size.
12839      inner[i].classes[pos + 1] = "reset-size" + baseOptions.size;
12840    }
12841
12842    inner[i].height *= multiplier;
12843    inner[i].depth *= multiplier;
12844  }
12845
12846  return buildCommon.makeFragment(inner);
12847}
12848var sizeFuncs = ["\\tiny", "\\sixptsize", "\\scriptsize", "\\footnotesize", "\\small", "\\normalsize", "\\large", "\\Large", "\\LARGE", "\\huge", "\\Huge"];
12849var sizing_htmlBuilder = function htmlBuilder(group, options) {
12850  // Handle sizing operators like \Huge. Real TeX doesn't actually allow
12851  // these functions inside of math expressions, so we do some special
12852  // handling.
12853  var newOptions = options.havingSize(group.size);
12854  return sizingGroup(group.body, newOptions, options);
12855};
12856defineFunction({
12857  type: "sizing",
12858  names: sizeFuncs,
12859  props: {
12860    numArgs: 0,
12861    allowedInText: true
12862  },
12863  handler: function handler(_ref, args) {
12864    var breakOnTokenText = _ref.breakOnTokenText,
12865        funcName = _ref.funcName,
12866        parser = _ref.parser;
12867    var body = parser.parseExpression(false, breakOnTokenText);
12868    return {
12869      type: "sizing",
12870      mode: parser.mode,
12871      // Figure out what size to use based on the list of functions above
12872      size: sizeFuncs.indexOf(funcName) + 1,
12873      body: body
12874    };
12875  },
12876  htmlBuilder: sizing_htmlBuilder,
12877  mathmlBuilder: function mathmlBuilder(group, options) {
12878    var newOptions = options.havingSize(group.size);
12879    var inner = buildMathML_buildExpression(group.body, newOptions);
12880    var node = new mathMLTree.MathNode("mstyle", inner); // TODO(emily): This doesn't produce the correct size for nested size
12881    // changes, because we don't keep state of what style we're currently
12882    // in, so we can't reset the size to normal before changing it.  Now
12883    // that we're passing an options parameter we should be able to fix
12884    // this.
12885
12886    node.setAttribute("mathsize", newOptions.sizeMultiplier + "em");
12887    return node;
12888  }
12889});
12890// CONCATENATED MODULE: ./src/functions/smash.js
12891// smash, with optional [tb], as in AMS
12892
12893
12894
12895
12896
12897
12898defineFunction({
12899  type: "smash",
12900  names: ["\\smash"],
12901  props: {
12902    numArgs: 1,
12903    numOptionalArgs: 1,
12904    allowedInText: true
12905  },
12906  handler: function handler(_ref, args, optArgs) {
12907    var parser = _ref.parser;
12908    var smashHeight = false;
12909    var smashDepth = false;
12910    var tbArg = optArgs[0] && assertNodeType(optArgs[0], "ordgroup");
12911
12912    if (tbArg) {
12913      // Optional [tb] argument is engaged.
12914      // ref: amsmath: \renewcommand{\smash}[1][tb]{%
12915      //               def\mb@t{\ht}\def\mb@b{\dp}\def\mb@tb{\ht\z@\z@\dp}%
12916      var letter = "";
12917
12918      for (var i = 0; i < tbArg.body.length; ++i) {
12919        var node = tbArg.body[i]; // $FlowFixMe: Not every node type has a `text` property.
12920
12921        letter = node.text;
12922
12923        if (letter === "t") {
12924          smashHeight = true;
12925        } else if (letter === "b") {
12926          smashDepth = true;
12927        } else {
12928          smashHeight = false;
12929          smashDepth = false;
12930          break;
12931        }
12932      }
12933    } else {
12934      smashHeight = true;
12935      smashDepth = true;
12936    }
12937
12938    var body = args[0];
12939    return {
12940      type: "smash",
12941      mode: parser.mode,
12942      body: body,
12943      smashHeight: smashHeight,
12944      smashDepth: smashDepth
12945    };
12946  },
12947  htmlBuilder: function htmlBuilder(group, options) {
12948    var node = buildCommon.makeSpan([], [buildHTML_buildGroup(group.body, options)]);
12949
12950    if (!group.smashHeight && !group.smashDepth) {
12951      return node;
12952    }
12953
12954    if (group.smashHeight) {
12955      node.height = 0; // In order to influence makeVList, we have to reset the children.
12956
12957      if (node.children) {
12958        for (var i = 0; i < node.children.length; i++) {
12959          node.children[i].height = 0;
12960        }
12961      }
12962    }
12963
12964    if (group.smashDepth) {
12965      node.depth = 0;
12966
12967      if (node.children) {
12968        for (var _i = 0; _i < node.children.length; _i++) {
12969          node.children[_i].depth = 0;
12970        }
12971      }
12972    } // At this point, we've reset the TeX-like height and depth values.
12973    // But the span still has an HTML line height.
12974    // makeVList applies "display: table-cell", which prevents the browser
12975    // from acting on that line height. So we'll call makeVList now.
12976
12977
12978    var smashedNode = buildCommon.makeVList({
12979      positionType: "firstBaseline",
12980      children: [{
12981        type: "elem",
12982        elem: node
12983      }]
12984    }, options); // For spacing, TeX treats \hphantom as a math group (same spacing as ord).
12985
12986    return buildCommon.makeSpan(["mord"], [smashedNode], options);
12987  },
12988  mathmlBuilder: function mathmlBuilder(group, options) {
12989    var node = new mathMLTree.MathNode("mpadded", [buildMathML_buildGroup(group.body, options)]);
12990
12991    if (group.smashHeight) {
12992      node.setAttribute("height", "0px");
12993    }
12994
12995    if (group.smashDepth) {
12996      node.setAttribute("depth", "0px");
12997    }
12998
12999    return node;
13000  }
13001});
13002// CONCATENATED MODULE: ./src/functions/sqrt.js
13003
13004
13005
13006
13007
13008
13009
13010defineFunction({
13011  type: "sqrt",
13012  names: ["\\sqrt"],
13013  props: {
13014    numArgs: 1,
13015    numOptionalArgs: 1
13016  },
13017  handler: function handler(_ref, args, optArgs) {
13018    var parser = _ref.parser;
13019    var index = optArgs[0];
13020    var body = args[0];
13021    return {
13022      type: "sqrt",
13023      mode: parser.mode,
13024      body: body,
13025      index: index
13026    };
13027  },
13028  htmlBuilder: function htmlBuilder(group, options) {
13029    // Square roots are handled in the TeXbook pg. 443, Rule 11.
13030    // First, we do the same steps as in overline to build the inner group
13031    // and line
13032    var inner = buildHTML_buildGroup(group.body, options.havingCrampedStyle());
13033
13034    if (inner.height === 0) {
13035      // Render a small surd.
13036      inner.height = options.fontMetrics().xHeight;
13037    } // Some groups can return document fragments.  Handle those by wrapping
13038    // them in a span.
13039
13040
13041    inner = buildCommon.wrapFragment(inner, options); // Calculate the minimum size for the \surd delimiter
13042
13043    var metrics = options.fontMetrics();
13044    var theta = metrics.defaultRuleThickness;
13045    var phi = theta;
13046
13047    if (options.style.id < src_Style.TEXT.id) {
13048      phi = options.fontMetrics().xHeight;
13049    } // Calculate the clearance between the body and line
13050
13051
13052    var lineClearance = theta + phi / 4;
13053    var minDelimiterHeight = inner.height + inner.depth + lineClearance + theta; // Create a sqrt SVG of the required minimum size
13054
13055    var _delimiter$sqrtImage = delimiter.sqrtImage(minDelimiterHeight, options),
13056        img = _delimiter$sqrtImage.span,
13057        ruleWidth = _delimiter$sqrtImage.ruleWidth,
13058        advanceWidth = _delimiter$sqrtImage.advanceWidth;
13059
13060    var delimDepth = img.height - ruleWidth; // Adjust the clearance based on the delimiter size
13061
13062    if (delimDepth > inner.height + inner.depth + lineClearance) {
13063      lineClearance = (lineClearance + delimDepth - inner.height - inner.depth) / 2;
13064    } // Shift the sqrt image
13065
13066
13067    var imgShift = img.height - inner.height - lineClearance - ruleWidth;
13068    inner.style.paddingLeft = advanceWidth + "em"; // Overlay the image and the argument.
13069
13070    var body = buildCommon.makeVList({
13071      positionType: "firstBaseline",
13072      children: [{
13073        type: "elem",
13074        elem: inner,
13075        wrapperClasses: ["svg-align"]
13076      }, {
13077        type: "kern",
13078        size: -(inner.height + imgShift)
13079      }, {
13080        type: "elem",
13081        elem: img
13082      }, {
13083        type: "kern",
13084        size: ruleWidth
13085      }]
13086    }, options);
13087
13088    if (!group.index) {
13089      return buildCommon.makeSpan(["mord", "sqrt"], [body], options);
13090    } else {
13091      // Handle the optional root index
13092      // The index is always in scriptscript style
13093      var newOptions = options.havingStyle(src_Style.SCRIPTSCRIPT);
13094      var rootm = buildHTML_buildGroup(group.index, newOptions, options); // The amount the index is shifted by. This is taken from the TeX
13095      // source, in the definition of `\r@@t`.
13096
13097      var toShift = 0.6 * (body.height - body.depth); // Build a VList with the superscript shifted up correctly
13098
13099      var rootVList = buildCommon.makeVList({
13100        positionType: "shift",
13101        positionData: -toShift,
13102        children: [{
13103          type: "elem",
13104          elem: rootm
13105        }]
13106      }, options); // Add a class surrounding it so we can add on the appropriate
13107      // kerning
13108
13109      var rootVListWrap = buildCommon.makeSpan(["root"], [rootVList]);
13110      return buildCommon.makeSpan(["mord", "sqrt"], [rootVListWrap, body], options);
13111    }
13112  },
13113  mathmlBuilder: function mathmlBuilder(group, options) {
13114    var body = group.body,
13115        index = group.index;
13116    return index ? new mathMLTree.MathNode("mroot", [buildMathML_buildGroup(body, options), buildMathML_buildGroup(index, options)]) : new mathMLTree.MathNode("msqrt", [buildMathML_buildGroup(body, options)]);
13117  }
13118});
13119// CONCATENATED MODULE: ./src/functions/styling.js
13120
13121
13122
13123
13124
13125var styling_styleMap = {
13126  "display": src_Style.DISPLAY,
13127  "text": src_Style.TEXT,
13128  "script": src_Style.SCRIPT,
13129  "scriptscript": src_Style.SCRIPTSCRIPT
13130};
13131defineFunction({
13132  type: "styling",
13133  names: ["\\displaystyle", "\\textstyle", "\\scriptstyle", "\\scriptscriptstyle"],
13134  props: {
13135    numArgs: 0,
13136    allowedInText: true
13137  },
13138  handler: function handler(_ref, args) {
13139    var breakOnTokenText = _ref.breakOnTokenText,
13140        funcName = _ref.funcName,
13141        parser = _ref.parser;
13142    // parse out the implicit body
13143    var body = parser.parseExpression(true, breakOnTokenText); // TODO: Refactor to avoid duplicating styleMap in multiple places (e.g.
13144    // here and in buildHTML and de-dupe the enumeration of all the styles).
13145    // $FlowFixMe: The names above exactly match the styles.
13146
13147    var style = funcName.slice(1, funcName.length - 5);
13148    return {
13149      type: "styling",
13150      mode: parser.mode,
13151      // Figure out what style to use by pulling out the style from
13152      // the function name
13153      style: style,
13154      body: body
13155    };
13156  },
13157  htmlBuilder: function htmlBuilder(group, options) {
13158    // Style changes are handled in the TeXbook on pg. 442, Rule 3.
13159    var newStyle = styling_styleMap[group.style];
13160    var newOptions = options.havingStyle(newStyle).withFont('');
13161    return sizingGroup(group.body, newOptions, options);
13162  },
13163  mathmlBuilder: function mathmlBuilder(group, options) {
13164    // Figure out what style we're changing to.
13165    var newStyle = styling_styleMap[group.style];
13166    var newOptions = options.havingStyle(newStyle);
13167    var inner = buildMathML_buildExpression(group.body, newOptions);
13168    var node = new mathMLTree.MathNode("mstyle", inner);
13169    var styleAttributes = {
13170      "display": ["0", "true"],
13171      "text": ["0", "false"],
13172      "script": ["1", "false"],
13173      "scriptscript": ["2", "false"]
13174    };
13175    var attr = styleAttributes[group.style];
13176    node.setAttribute("scriptlevel", attr[0]);
13177    node.setAttribute("displaystyle", attr[1]);
13178    return node;
13179  }
13180});
13181// CONCATENATED MODULE: ./src/functions/supsub.js
13182
13183
13184
13185
13186
13187
13188
13189
13190
13191
13192
13193
13194
13195
13196/**
13197 * Sometimes, groups perform special rules when they have superscripts or
13198 * subscripts attached to them. This function lets the `supsub` group know that
13199 * Sometimes, groups perform special rules when they have superscripts or
13200 * its inner element should handle the superscripts and subscripts instead of
13201 * handling them itself.
13202 */
13203var supsub_htmlBuilderDelegate = function htmlBuilderDelegate(group, options) {
13204  var base = group.base;
13205
13206  if (!base) {
13207    return null;
13208  } else if (base.type === "op") {
13209    // Operators handle supsubs differently when they have limits
13210    // (e.g. `\displaystyle\sum_2^3`)
13211    var delegate = base.limits && (options.style.size === src_Style.DISPLAY.size || base.alwaysHandleSupSub);
13212    return delegate ? op_htmlBuilder : null;
13213  } else if (base.type === "operatorname") {
13214    var _delegate = base.alwaysHandleSupSub && (options.style.size === src_Style.DISPLAY.size || base.limits);
13215
13216    return _delegate ? operatorname_htmlBuilder : null;
13217  } else if (base.type === "accent") {
13218    return utils.isCharacterBox(base.base) ? accent_htmlBuilder : null;
13219  } else if (base.type === "horizBrace") {
13220    var isSup = !group.sub;
13221    return isSup === base.isOver ? horizBrace_htmlBuilder : null;
13222  } else {
13223    return null;
13224  }
13225}; // Super scripts and subscripts, whose precise placement can depend on other
13226// functions that precede them.
13227
13228
13229defineFunctionBuilders({
13230  type: "supsub",
13231  htmlBuilder: function htmlBuilder(group, options) {
13232    // Superscript and subscripts are handled in the TeXbook on page
13233    // 445-446, rules 18(a-f).
13234    // Here is where we defer to the inner group if it should handle
13235    // superscripts and subscripts itself.
13236    var builderDelegate = supsub_htmlBuilderDelegate(group, options);
13237
13238    if (builderDelegate) {
13239      return builderDelegate(group, options);
13240    }
13241
13242    var valueBase = group.base,
13243        valueSup = group.sup,
13244        valueSub = group.sub;
13245    var base = buildHTML_buildGroup(valueBase, options);
13246    var supm;
13247    var subm;
13248    var metrics = options.fontMetrics(); // Rule 18a
13249
13250    var supShift = 0;
13251    var subShift = 0;
13252    var isCharacterBox = valueBase && utils.isCharacterBox(valueBase);
13253
13254    if (valueSup) {
13255      var newOptions = options.havingStyle(options.style.sup());
13256      supm = buildHTML_buildGroup(valueSup, newOptions, options);
13257
13258      if (!isCharacterBox) {
13259        supShift = base.height - newOptions.fontMetrics().supDrop * newOptions.sizeMultiplier / options.sizeMultiplier;
13260      }
13261    }
13262
13263    if (valueSub) {
13264      var _newOptions = options.havingStyle(options.style.sub());
13265
13266      subm = buildHTML_buildGroup(valueSub, _newOptions, options);
13267
13268      if (!isCharacterBox) {
13269        subShift = base.depth + _newOptions.fontMetrics().subDrop * _newOptions.sizeMultiplier / options.sizeMultiplier;
13270      }
13271    } // Rule 18c
13272
13273
13274    var minSupShift;
13275
13276    if (options.style === src_Style.DISPLAY) {
13277      minSupShift = metrics.sup1;
13278    } else if (options.style.cramped) {
13279      minSupShift = metrics.sup3;
13280    } else {
13281      minSupShift = metrics.sup2;
13282    } // scriptspace is a font-size-independent size, so scale it
13283    // appropriately for use as the marginRight.
13284
13285
13286    var multiplier = options.sizeMultiplier;
13287    var marginRight = 0.5 / metrics.ptPerEm / multiplier + "em";
13288    var marginLeft = null;
13289
13290    if (subm) {
13291      // Subscripts shouldn't be shifted by the base's italic correction.
13292      // Account for that by shifting the subscript back the appropriate
13293      // amount. Note we only do this when the base is a single symbol.
13294      var isOiint = group.base && group.base.type === "op" && group.base.name && (group.base.name === "\\oiint" || group.base.name === "\\oiiint");
13295
13296      if (base instanceof domTree_SymbolNode || isOiint) {
13297        // $FlowFixMe
13298        marginLeft = -base.italic + "em";
13299      }
13300    }
13301
13302    var supsub;
13303
13304    if (supm && subm) {
13305      supShift = Math.max(supShift, minSupShift, supm.depth + 0.25 * metrics.xHeight);
13306      subShift = Math.max(subShift, metrics.sub2);
13307      var ruleWidth = metrics.defaultRuleThickness; // Rule 18e
13308
13309      var maxWidth = 4 * ruleWidth;
13310
13311      if (supShift - supm.depth - (subm.height - subShift) < maxWidth) {
13312        subShift = maxWidth - (supShift - supm.depth) + subm.height;
13313        var psi = 0.8 * metrics.xHeight - (supShift - supm.depth);
13314
13315        if (psi > 0) {
13316          supShift += psi;
13317          subShift -= psi;
13318        }
13319      }
13320
13321      var vlistElem = [{
13322        type: "elem",
13323        elem: subm,
13324        shift: subShift,
13325        marginRight: marginRight,
13326        marginLeft: marginLeft
13327      }, {
13328        type: "elem",
13329        elem: supm,
13330        shift: -supShift,
13331        marginRight: marginRight
13332      }];
13333      supsub = buildCommon.makeVList({
13334        positionType: "individualShift",
13335        children: vlistElem
13336      }, options);
13337    } else if (subm) {
13338      // Rule 18b
13339      subShift = Math.max(subShift, metrics.sub1, subm.height - 0.8 * metrics.xHeight);
13340      var _vlistElem = [{
13341        type: "elem",
13342        elem: subm,
13343        marginLeft: marginLeft,
13344        marginRight: marginRight
13345      }];
13346      supsub = buildCommon.makeVList({
13347        positionType: "shift",
13348        positionData: subShift,
13349        children: _vlistElem
13350      }, options);
13351    } else if (supm) {
13352      // Rule 18c, d
13353      supShift = Math.max(supShift, minSupShift, supm.depth + 0.25 * metrics.xHeight);
13354      supsub = buildCommon.makeVList({
13355        positionType: "shift",
13356        positionData: -supShift,
13357        children: [{
13358          type: "elem",
13359          elem: supm,
13360          marginRight: marginRight
13361        }]
13362      }, options);
13363    } else {
13364      throw new Error("supsub must have either sup or sub.");
13365    } // Wrap the supsub vlist in a span.msupsub to reset text-align.
13366
13367
13368    var mclass = getTypeOfDomTree(base, "right") || "mord";
13369    return buildCommon.makeSpan([mclass], [base, buildCommon.makeSpan(["msupsub"], [supsub])], options);
13370  },
13371  mathmlBuilder: function mathmlBuilder(group, options) {
13372    // Is the inner group a relevant horizonal brace?
13373    var isBrace = false;
13374    var isOver;
13375    var isSup;
13376    var horizBrace = checkNodeType(group.base, "horizBrace");
13377
13378    if (horizBrace) {
13379      isSup = !!group.sup;
13380
13381      if (isSup === horizBrace.isOver) {
13382        isBrace = true;
13383        isOver = horizBrace.isOver;
13384      }
13385    }
13386
13387    if (group.base && (group.base.type === "op" || group.base.type === "operatorname")) {
13388      group.base.parentIsSupSub = true;
13389    }
13390
13391    var children = [buildMathML_buildGroup(group.base, options)];
13392
13393    if (group.sub) {
13394      children.push(buildMathML_buildGroup(group.sub, options));
13395    }
13396
13397    if (group.sup) {
13398      children.push(buildMathML_buildGroup(group.sup, options));
13399    }
13400
13401    var nodeType;
13402
13403    if (isBrace) {
13404      nodeType = isOver ? "mover" : "munder";
13405    } else if (!group.sub) {
13406      var base = group.base;
13407
13408      if (base && base.type === "op" && base.limits && (options.style === src_Style.DISPLAY || base.alwaysHandleSupSub)) {
13409        nodeType = "mover";
13410      } else if (base && base.type === "operatorname" && base.alwaysHandleSupSub && (base.limits || options.style === src_Style.DISPLAY)) {
13411        nodeType = "mover";
13412      } else {
13413        nodeType = "msup";
13414      }
13415    } else if (!group.sup) {
13416      var _base = group.base;
13417
13418      if (_base && _base.type === "op" && _base.limits && (options.style === src_Style.DISPLAY || _base.alwaysHandleSupSub)) {
13419        nodeType = "munder";
13420      } else if (_base && _base.type === "operatorname" && _base.alwaysHandleSupSub && (_base.limits || options.style === src_Style.DISPLAY)) {
13421        nodeType = "munder";
13422      } else {
13423        nodeType = "msub";
13424      }
13425    } else {
13426      var _base2 = group.base;
13427
13428      if (_base2 && _base2.type === "op" && _base2.limits && options.style === src_Style.DISPLAY) {
13429        nodeType = "munderover";
13430      } else if (_base2 && _base2.type === "operatorname" && _base2.alwaysHandleSupSub && (options.style === src_Style.DISPLAY || _base2.limits)) {
13431        nodeType = "munderover";
13432      } else {
13433        nodeType = "msubsup";
13434      }
13435    }
13436
13437    var node = new mathMLTree.MathNode(nodeType, children);
13438    return node;
13439  }
13440});
13441// CONCATENATED MODULE: ./src/functions/symbolsOp.js
13442
13443
13444
13445 // Operator ParseNodes created in Parser.js from symbol Groups in src/symbols.js.
13446
13447defineFunctionBuilders({
13448  type: "atom",
13449  htmlBuilder: function htmlBuilder(group, options) {
13450    return buildCommon.mathsym(group.text, group.mode, options, ["m" + group.family]);
13451  },
13452  mathmlBuilder: function mathmlBuilder(group, options) {
13453    var node = new mathMLTree.MathNode("mo", [buildMathML_makeText(group.text, group.mode)]);
13454
13455    if (group.family === "bin") {
13456      var variant = buildMathML_getVariant(group, options);
13457
13458      if (variant === "bold-italic") {
13459        node.setAttribute("mathvariant", variant);
13460      }
13461    } else if (group.family === "punct") {
13462      node.setAttribute("separator", "true");
13463    } else if (group.family === "open" || group.family === "close") {
13464      // Delims built here should not stretch vertically.
13465      // See delimsizing.js for stretchy delims.
13466      node.setAttribute("stretchy", "false");
13467    }
13468
13469    return node;
13470  }
13471});
13472// CONCATENATED MODULE: ./src/functions/symbolsOrd.js
13473
13474
13475
13476
13477// "mathord" and "textord" ParseNodes created in Parser.js from symbol Groups in
13478var defaultVariant = {
13479  "mi": "italic",
13480  "mn": "normal",
13481  "mtext": "normal"
13482};
13483defineFunctionBuilders({
13484  type: "mathord",
13485  htmlBuilder: function htmlBuilder(group, options) {
13486    return buildCommon.makeOrd(group, options, "mathord");
13487  },
13488  mathmlBuilder: function mathmlBuilder(group, options) {
13489    var node = new mathMLTree.MathNode("mi", [buildMathML_makeText(group.text, group.mode, options)]);
13490    var variant = buildMathML_getVariant(group, options) || "italic";
13491
13492    if (variant !== defaultVariant[node.type]) {
13493      node.setAttribute("mathvariant", variant);
13494    }
13495
13496    return node;
13497  }
13498});
13499defineFunctionBuilders({
13500  type: "textord",
13501  htmlBuilder: function htmlBuilder(group, options) {
13502    return buildCommon.makeOrd(group, options, "textord");
13503  },
13504  mathmlBuilder: function mathmlBuilder(group, options) {
13505    var text = buildMathML_makeText(group.text, group.mode, options);
13506    var variant = buildMathML_getVariant(group, options) || "normal";
13507    var node;
13508
13509    if (group.mode === 'text') {
13510      node = new mathMLTree.MathNode("mtext", [text]);
13511    } else if (/[0-9]/.test(group.text)) {
13512      // TODO(kevinb) merge adjacent <mn> nodes
13513      // do it as a post processing step
13514      node = new mathMLTree.MathNode("mn", [text]);
13515    } else if (group.text === "\\prime") {
13516      node = new mathMLTree.MathNode("mo", [text]);
13517    } else {
13518      node = new mathMLTree.MathNode("mi", [text]);
13519    }
13520
13521    if (variant !== defaultVariant[node.type]) {
13522      node.setAttribute("mathvariant", variant);
13523    }
13524
13525    return node;
13526  }
13527});
13528// CONCATENATED MODULE: ./src/functions/symbolsSpacing.js
13529
13530
13531
13532 // A map of CSS-based spacing functions to their CSS class.
13533
13534var cssSpace = {
13535  "\\nobreak": "nobreak",
13536  "\\allowbreak": "allowbreak"
13537}; // A lookup table to determine whether a spacing function/symbol should be
13538// treated like a regular space character.  If a symbol or command is a key
13539// in this table, then it should be a regular space character.  Furthermore,
13540// the associated value may have a `className` specifying an extra CSS class
13541// to add to the created `span`.
13542
13543var regularSpace = {
13544  " ": {},
13545  "\\ ": {},
13546  "~": {
13547    className: "nobreak"
13548  },
13549  "\\space": {},
13550  "\\nobreakspace": {
13551    className: "nobreak"
13552  }
13553}; // ParseNode<"spacing"> created in Parser.js from the "spacing" symbol Groups in
13554// src/symbols.js.
13555
13556defineFunctionBuilders({
13557  type: "spacing",
13558  htmlBuilder: function htmlBuilder(group, options) {
13559    if (regularSpace.hasOwnProperty(group.text)) {
13560      var className = regularSpace[group.text].className || ""; // Spaces are generated by adding an actual space. Each of these
13561      // things has an entry in the symbols table, so these will be turned
13562      // into appropriate outputs.
13563
13564      if (group.mode === "text") {
13565        var ord = buildCommon.makeOrd(group, options, "textord");
13566        ord.classes.push(className);
13567        return ord;
13568      } else {
13569        return buildCommon.makeSpan(["mspace", className], [buildCommon.mathsym(group.text, group.mode, options)], options);
13570      }
13571    } else if (cssSpace.hasOwnProperty(group.text)) {
13572      // Spaces based on just a CSS class.
13573      return buildCommon.makeSpan(["mspace", cssSpace[group.text]], [], options);
13574    } else {
13575      throw new src_ParseError("Unknown type of space \"" + group.text + "\"");
13576    }
13577  },
13578  mathmlBuilder: function mathmlBuilder(group, options) {
13579    var node;
13580
13581    if (regularSpace.hasOwnProperty(group.text)) {
13582      node = new mathMLTree.MathNode("mtext", [new mathMLTree.TextNode("\xA0")]);
13583    } else if (cssSpace.hasOwnProperty(group.text)) {
13584      // CSS-based MathML spaces (\nobreak, \allowbreak) are ignored
13585      return new mathMLTree.MathNode("mspace");
13586    } else {
13587      throw new src_ParseError("Unknown type of space \"" + group.text + "\"");
13588    }
13589
13590    return node;
13591  }
13592});
13593// CONCATENATED MODULE: ./src/functions/tag.js
13594
13595
13596
13597
13598var tag_pad = function pad() {
13599  var padNode = new mathMLTree.MathNode("mtd", []);
13600  padNode.setAttribute("width", "50%");
13601  return padNode;
13602};
13603
13604defineFunctionBuilders({
13605  type: "tag",
13606  mathmlBuilder: function mathmlBuilder(group, options) {
13607    var table = new mathMLTree.MathNode("mtable", [new mathMLTree.MathNode("mtr", [tag_pad(), new mathMLTree.MathNode("mtd", [buildExpressionRow(group.body, options)]), tag_pad(), new mathMLTree.MathNode("mtd", [buildExpressionRow(group.tag, options)])])]);
13608    table.setAttribute("width", "100%");
13609    return table; // TODO: Left-aligned tags.
13610    // Currently, the group and options passed here do not contain
13611    // enough info to set tag alignment. `leqno` is in Settings but it is
13612    // not passed to Options. On the HTML side, leqno is
13613    // set by a CSS class applied in buildTree.js. That would have worked
13614    // in MathML if browsers supported <mlabeledtr>. Since they don't, we
13615    // need to rewrite the way this function is called.
13616  }
13617});
13618// CONCATENATED MODULE: ./src/functions/text.js
13619
13620
13621
13622 // Non-mathy text, possibly in a font
13623
13624var textFontFamilies = {
13625  "\\text": undefined,
13626  "\\textrm": "textrm",
13627  "\\textsf": "textsf",
13628  "\\texttt": "texttt",
13629  "\\textnormal": "textrm"
13630};
13631var textFontWeights = {
13632  "\\textbf": "textbf",
13633  "\\textmd": "textmd"
13634};
13635var textFontShapes = {
13636  "\\textit": "textit",
13637  "\\textup": "textup"
13638};
13639
13640var optionsWithFont = function optionsWithFont(group, options) {
13641  var font = group.font; // Checks if the argument is a font family or a font style.
13642
13643  if (!font) {
13644    return options;
13645  } else if (textFontFamilies[font]) {
13646    return options.withTextFontFamily(textFontFamilies[font]);
13647  } else if (textFontWeights[font]) {
13648    return options.withTextFontWeight(textFontWeights[font]);
13649  } else {
13650    return options.withTextFontShape(textFontShapes[font]);
13651  }
13652};
13653
13654defineFunction({
13655  type: "text",
13656  names: [// Font families
13657  "\\text", "\\textrm", "\\textsf", "\\texttt", "\\textnormal", // Font weights
13658  "\\textbf", "\\textmd", // Font Shapes
13659  "\\textit", "\\textup"],
13660  props: {
13661    numArgs: 1,
13662    argTypes: ["text"],
13663    greediness: 2,
13664    allowedInText: true
13665  },
13666  handler: function handler(_ref, args) {
13667    var parser = _ref.parser,
13668        funcName = _ref.funcName;
13669    var body = args[0];
13670    return {
13671      type: "text",
13672      mode: parser.mode,
13673      body: defineFunction_ordargument(body),
13674      font: funcName
13675    };
13676  },
13677  htmlBuilder: function htmlBuilder(group, options) {
13678    var newOptions = optionsWithFont(group, options);
13679    var inner = buildHTML_buildExpression(group.body, newOptions, true);
13680    return buildCommon.makeSpan(["mord", "text"], buildCommon.tryCombineChars(inner), newOptions);
13681  },
13682  mathmlBuilder: function mathmlBuilder(group, options) {
13683    var newOptions = optionsWithFont(group, options);
13684    return buildExpressionRow(group.body, newOptions);
13685  }
13686});
13687// CONCATENATED MODULE: ./src/functions/underline.js
13688
13689
13690
13691
13692
13693defineFunction({
13694  type: "underline",
13695  names: ["\\underline"],
13696  props: {
13697    numArgs: 1,
13698    allowedInText: true
13699  },
13700  handler: function handler(_ref, args) {
13701    var parser = _ref.parser;
13702    return {
13703      type: "underline",
13704      mode: parser.mode,
13705      body: args[0]
13706    };
13707  },
13708  htmlBuilder: function htmlBuilder(group, options) {
13709    // Underlines are handled in the TeXbook pg 443, Rule 10.
13710    // Build the inner group.
13711    var innerGroup = buildHTML_buildGroup(group.body, options); // Create the line to go below the body
13712
13713    var line = buildCommon.makeLineSpan("underline-line", options); // Generate the vlist, with the appropriate kerns
13714
13715    var defaultRuleThickness = options.fontMetrics().defaultRuleThickness;
13716    var vlist = buildCommon.makeVList({
13717      positionType: "top",
13718      positionData: innerGroup.height,
13719      children: [{
13720        type: "kern",
13721        size: defaultRuleThickness
13722      }, {
13723        type: "elem",
13724        elem: line
13725      }, {
13726        type: "kern",
13727        size: 3 * defaultRuleThickness
13728      }, {
13729        type: "elem",
13730        elem: innerGroup
13731      }]
13732    }, options);
13733    return buildCommon.makeSpan(["mord", "underline"], [vlist], options);
13734  },
13735  mathmlBuilder: function mathmlBuilder(group, options) {
13736    var operator = new mathMLTree.MathNode("mo", [new mathMLTree.TextNode("\u203E")]);
13737    operator.setAttribute("stretchy", "true");
13738    var node = new mathMLTree.MathNode("munder", [buildMathML_buildGroup(group.body, options), operator]);
13739    node.setAttribute("accentunder", "true");
13740    return node;
13741  }
13742});
13743// CONCATENATED MODULE: ./src/functions/verb.js
13744
13745
13746
13747
13748defineFunction({
13749  type: "verb",
13750  names: ["\\verb"],
13751  props: {
13752    numArgs: 0,
13753    allowedInText: true
13754  },
13755  handler: function handler(context, args, optArgs) {
13756    // \verb and \verb* are dealt with directly in Parser.js.
13757    // If we end up here, it's because of a failure to match the two delimiters
13758    // in the regex in Lexer.js.  LaTeX raises the following error when \verb is
13759    // terminated by end of line (or file).
13760    throw new src_ParseError("\\verb ended by end of line instead of matching delimiter");
13761  },
13762  htmlBuilder: function htmlBuilder(group, options) {
13763    var text = makeVerb(group);
13764    var body = []; // \verb enters text mode and therefore is sized like \textstyle
13765
13766    var newOptions = options.havingStyle(options.style.text());
13767
13768    for (var i = 0; i < text.length; i++) {
13769      var c = text[i];
13770
13771      if (c === '~') {
13772        c = '\\textasciitilde';
13773      }
13774
13775      body.push(buildCommon.makeSymbol(c, "Typewriter-Regular", group.mode, newOptions, ["mord", "texttt"]));
13776    }
13777
13778    return buildCommon.makeSpan(["mord", "text"].concat(newOptions.sizingClasses(options)), buildCommon.tryCombineChars(body), newOptions);
13779  },
13780  mathmlBuilder: function mathmlBuilder(group, options) {
13781    var text = new mathMLTree.TextNode(makeVerb(group));
13782    var node = new mathMLTree.MathNode("mtext", [text]);
13783    node.setAttribute("mathvariant", "monospace");
13784    return node;
13785  }
13786});
13787/**
13788 * Converts verb group into body string.
13789 *
13790 * \verb* replaces each space with an open box \u2423
13791 * \verb replaces each space with a no-break space \xA0
13792 */
13793
13794var makeVerb = function makeVerb(group) {
13795  return group.body.replace(/ /g, group.star ? "\u2423" : '\xA0');
13796};
13797// CONCATENATED MODULE: ./src/functions.js
13798/** Include this to ensure that all functions are defined. */
13799
13800var functions = _functions;
13801/* harmony default export */ var src_functions = (functions); // TODO(kevinb): have functions return an object and call defineFunction with
13802// that object in this file instead of relying on side-effects.
13803
13804
13805
13806
13807
13808
13809
13810
13811
13812
13813
13814
13815
13816
13817
13818
13819
13820
13821
13822
13823
13824
13825
13826
13827
13828
13829
13830
13831
13832
13833
13834
13835
13836
13837
13838
13839
13840
13841
13842
13843// CONCATENATED MODULE: ./src/Lexer.js
13844/**
13845 * The Lexer class handles tokenizing the input in various ways. Since our
13846 * parser expects us to be able to backtrack, the lexer allows lexing from any
13847 * given starting point.
13848 *
13849 * Its main exposed function is the `lex` function, which takes a position to
13850 * lex from and a type of token to lex. It defers to the appropriate `_innerLex`
13851 * function.
13852 *
13853 * The various `_innerLex` functions perform the actual lexing of different
13854 * kinds.
13855 */
13856
13857
13858
13859
13860/* The following tokenRegex
13861 * - matches typical whitespace (but not NBSP etc.) using its first group
13862 * - does not match any control character \x00-\x1f except whitespace
13863 * - does not match a bare backslash
13864 * - matches any ASCII character except those just mentioned
13865 * - does not match the BMP private use area \uE000-\uF8FF
13866 * - does not match bare surrogate code units
13867 * - matches any BMP character except for those just described
13868 * - matches any valid Unicode surrogate pair
13869 * - matches a backslash followed by one or more letters
13870 * - matches a backslash followed by any BMP character, including newline
13871 * Just because the Lexer matches something doesn't mean it's valid input:
13872 * If there is no matching function or symbol definition, the Parser will
13873 * still reject the input.
13874 */
13875var spaceRegexString = "[ \r\n\t]";
13876var controlWordRegexString = "\\\\[a-zA-Z@]+";
13877var controlSymbolRegexString = "\\\\[^\uD800-\uDFFF]";
13878var controlWordWhitespaceRegexString = "" + controlWordRegexString + spaceRegexString + "*";
13879var controlWordWhitespaceRegex = new RegExp("^(" + controlWordRegexString + ")" + spaceRegexString + "*$");
13880var combiningDiacriticalMarkString = "[\u0300-\u036F]";
13881var combiningDiacriticalMarksEndRegex = new RegExp(combiningDiacriticalMarkString + "+$");
13882var tokenRegexString = "(" + spaceRegexString + "+)|" + // whitespace
13883"([!-\\[\\]-\u2027\u202A-\uD7FF\uF900-\uFFFF]" + ( // single codepoint
13884combiningDiacriticalMarkString + "*") + // ...plus accents
13885"|[\uD800-\uDBFF][\uDC00-\uDFFF]" + ( // surrogate pair
13886combiningDiacriticalMarkString + "*") + // ...plus accents
13887"|\\\\verb\\*([^]).*?\\3" + // \verb*
13888"|\\\\verb([^*a-zA-Z]).*?\\4" + // \verb unstarred
13889"|\\\\operatorname\\*" + ( // \operatorname*
13890"|" + controlWordWhitespaceRegexString) + ( // \macroName + spaces
13891"|" + controlSymbolRegexString + ")"); // \\, \', etc.
13892
13893/** Main Lexer class */
13894
13895var Lexer_Lexer =
13896/*#__PURE__*/
13897function () {
13898  // category codes, only supports comment characters (14) for now
13899  function Lexer(input, settings) {
13900    this.input = void 0;
13901    this.settings = void 0;
13902    this.tokenRegex = void 0;
13903    this.catcodes = void 0;
13904    // Separate accents from characters
13905    this.input = input;
13906    this.settings = settings;
13907    this.tokenRegex = new RegExp(tokenRegexString, 'g');
13908    this.catcodes = {
13909      "%": 14 // comment character
13910
13911    };
13912  }
13913
13914  var _proto = Lexer.prototype;
13915
13916  _proto.setCatcode = function setCatcode(char, code) {
13917    this.catcodes[char] = code;
13918  }
13919  /**
13920   * This function lexes a single token.
13921   */
13922  ;
13923
13924  _proto.lex = function lex() {
13925    var input = this.input;
13926    var pos = this.tokenRegex.lastIndex;
13927
13928    if (pos === input.length) {
13929      return new Token_Token("EOF", new SourceLocation(this, pos, pos));
13930    }
13931
13932    var match = this.tokenRegex.exec(input);
13933
13934    if (match === null || match.index !== pos) {
13935      throw new src_ParseError("Unexpected character: '" + input[pos] + "'", new Token_Token(input[pos], new SourceLocation(this, pos, pos + 1)));
13936    }
13937
13938    var text = match[2] || " ";
13939
13940    if (this.catcodes[text] === 14) {
13941      // comment character
13942      var nlIndex = input.indexOf('\n', this.tokenRegex.lastIndex);
13943
13944      if (nlIndex === -1) {
13945        this.tokenRegex.lastIndex = input.length; // EOF
13946
13947        this.settings.reportNonstrict("commentAtEnd", "% comment has no terminating newline; LaTeX would " + "fail because of commenting the end of math mode (e.g. $)");
13948      } else {
13949        this.tokenRegex.lastIndex = nlIndex + 1;
13950      }
13951
13952      return this.lex();
13953    } // Trim any trailing whitespace from control word match
13954
13955
13956    var controlMatch = text.match(controlWordWhitespaceRegex);
13957
13958    if (controlMatch) {
13959      text = controlMatch[1];
13960    }
13961
13962    return new Token_Token(text, new SourceLocation(this, pos, this.tokenRegex.lastIndex));
13963  };
13964
13965  return Lexer;
13966}();
13967
13968
13969// CONCATENATED MODULE: ./src/Namespace.js
13970/**
13971 * A `Namespace` refers to a space of nameable things like macros or lengths,
13972 * which can be `set` either globally or local to a nested group, using an
13973 * undo stack similar to how TeX implements this functionality.
13974 * Performance-wise, `get` and local `set` take constant time, while global
13975 * `set` takes time proportional to the depth of group nesting.
13976 */
13977
13978
13979var Namespace_Namespace =
13980/*#__PURE__*/
13981function () {
13982  /**
13983   * Both arguments are optional.  The first argument is an object of
13984   * built-in mappings which never change.  The second argument is an object
13985   * of initial (global-level) mappings, which will constantly change
13986   * according to any global/top-level `set`s done.
13987   */
13988  function Namespace(builtins, globalMacros) {
13989    if (builtins === void 0) {
13990      builtins = {};
13991    }
13992
13993    if (globalMacros === void 0) {
13994      globalMacros = {};
13995    }
13996
13997    this.current = void 0;
13998    this.builtins = void 0;
13999    this.undefStack = void 0;
14000    this.current = globalMacros;
14001    this.builtins = builtins;
14002    this.undefStack = [];
14003  }
14004  /**
14005   * Start a new nested group, affecting future local `set`s.
14006   */
14007
14008
14009  var _proto = Namespace.prototype;
14010
14011  _proto.beginGroup = function beginGroup() {
14012    this.undefStack.push({});
14013  }
14014  /**
14015   * End current nested group, restoring values before the group began.
14016   */
14017  ;
14018
14019  _proto.endGroup = function endGroup() {
14020    if (this.undefStack.length === 0) {
14021      throw new src_ParseError("Unbalanced namespace destruction: attempt " + "to pop global namespace; please report this as a bug");
14022    }
14023
14024    var undefs = this.undefStack.pop();
14025
14026    for (var undef in undefs) {
14027      if (undefs.hasOwnProperty(undef)) {
14028        if (undefs[undef] === undefined) {
14029          delete this.current[undef];
14030        } else {
14031          this.current[undef] = undefs[undef];
14032        }
14033      }
14034    }
14035  }
14036  /**
14037   * Detect whether `name` has a definition.  Equivalent to
14038   * `get(name) != null`.
14039   */
14040  ;
14041
14042  _proto.has = function has(name) {
14043    return this.current.hasOwnProperty(name) || this.builtins.hasOwnProperty(name);
14044  }
14045  /**
14046   * Get the current value of a name, or `undefined` if there is no value.
14047   *
14048   * Note: Do not use `if (namespace.get(...))` to detect whether a macro
14049   * is defined, as the definition may be the empty string which evaluates
14050   * to `false` in JavaScript.  Use `if (namespace.get(...) != null)` or
14051   * `if (namespace.has(...))`.
14052   */
14053  ;
14054
14055  _proto.get = function get(name) {
14056    if (this.current.hasOwnProperty(name)) {
14057      return this.current[name];
14058    } else {
14059      return this.builtins[name];
14060    }
14061  }
14062  /**
14063   * Set the current value of a name, and optionally set it globally too.
14064   * Local set() sets the current value and (when appropriate) adds an undo
14065   * operation to the undo stack.  Global set() may change the undo
14066   * operation at every level, so takes time linear in their number.
14067   */
14068  ;
14069
14070  _proto.set = function set(name, value, global) {
14071    if (global === void 0) {
14072      global = false;
14073    }
14074
14075    if (global) {
14076      // Global set is equivalent to setting in all groups.  Simulate this
14077      // by destroying any undos currently scheduled for this name,
14078      // and adding an undo with the *new* value (in case it later gets
14079      // locally reset within this environment).
14080      for (var i = 0; i < this.undefStack.length; i++) {
14081        delete this.undefStack[i][name];
14082      }
14083
14084      if (this.undefStack.length > 0) {
14085        this.undefStack[this.undefStack.length - 1][name] = value;
14086      }
14087    } else {
14088      // Undo this set at end of this group (possibly to `undefined`),
14089      // unless an undo is already in place, in which case that older
14090      // value is the correct one.
14091      var top = this.undefStack[this.undefStack.length - 1];
14092
14093      if (top && !top.hasOwnProperty(name)) {
14094        top[name] = this.current[name];
14095      }
14096    }
14097
14098    this.current[name] = value;
14099  };
14100
14101  return Namespace;
14102}();
14103
14104
14105// CONCATENATED MODULE: ./src/macros.js
14106/**
14107 * Predefined macros for KaTeX.
14108 * This can be used to define some commands in terms of others.
14109 */
14110
14111
14112
14113
14114
14115var builtinMacros = {};
14116/* harmony default export */ var macros = (builtinMacros); // This function might one day accept an additional argument and do more things.
14117
14118function defineMacro(name, body) {
14119  builtinMacros[name] = body;
14120} //////////////////////////////////////////////////////////////////////
14121// macro tools
14122// LaTeX's \@firstoftwo{#1}{#2} expands to #1, skipping #2
14123// TeX source: \long\def\@firstoftwo#1#2{#1}
14124
14125defineMacro("\\@firstoftwo", function (context) {
14126  var args = context.consumeArgs(2);
14127  return {
14128    tokens: args[0],
14129    numArgs: 0
14130  };
14131}); // LaTeX's \@secondoftwo{#1}{#2} expands to #2, skipping #1
14132// TeX source: \long\def\@secondoftwo#1#2{#2}
14133
14134defineMacro("\\@secondoftwo", function (context) {
14135  var args = context.consumeArgs(2);
14136  return {
14137    tokens: args[1],
14138    numArgs: 0
14139  };
14140}); // LaTeX's \@ifnextchar{#1}{#2}{#3} looks ahead to the next (unexpanded)
14141// symbol.  If it matches #1, then the macro expands to #2; otherwise, #3.
14142// Note, however, that it does not consume the next symbol in either case.
14143
14144defineMacro("\\@ifnextchar", function (context) {
14145  var args = context.consumeArgs(3); // symbol, if, else
14146
14147  var nextToken = context.future();
14148
14149  if (args[0].length === 1 && args[0][0].text === nextToken.text) {
14150    return {
14151      tokens: args[1],
14152      numArgs: 0
14153    };
14154  } else {
14155    return {
14156      tokens: args[2],
14157      numArgs: 0
14158    };
14159  }
14160}); // LaTeX's \@ifstar{#1}{#2} looks ahead to the next (unexpanded) symbol.
14161// If it is `*`, then it consumes the symbol, and the macro expands to #1;
14162// otherwise, the macro expands to #2 (without consuming the symbol).
14163// TeX source: \def\@ifstar#1{\@ifnextchar *{\@firstoftwo{#1}}}
14164
14165defineMacro("\\@ifstar", "\\@ifnextchar *{\\@firstoftwo{#1}}"); // LaTeX's \TextOrMath{#1}{#2} expands to #1 in text mode, #2 in math mode
14166
14167defineMacro("\\TextOrMath", function (context) {
14168  var args = context.consumeArgs(2);
14169
14170  if (context.mode === 'text') {
14171    return {
14172      tokens: args[0],
14173      numArgs: 0
14174    };
14175  } else {
14176    return {
14177      tokens: args[1],
14178      numArgs: 0
14179    };
14180  }
14181}); // Lookup table for parsing numbers in base 8 through 16
14182
14183var digitToNumber = {
14184  "0": 0,
14185  "1": 1,
14186  "2": 2,
14187  "3": 3,
14188  "4": 4,
14189  "5": 5,
14190  "6": 6,
14191  "7": 7,
14192  "8": 8,
14193  "9": 9,
14194  "a": 10,
14195  "A": 10,
14196  "b": 11,
14197  "B": 11,
14198  "c": 12,
14199  "C": 12,
14200  "d": 13,
14201  "D": 13,
14202  "e": 14,
14203  "E": 14,
14204  "f": 15,
14205  "F": 15
14206}; // TeX \char makes a literal character (catcode 12) using the following forms:
14207// (see The TeXBook, p. 43)
14208//   \char123  -- decimal
14209//   \char'123 -- octal
14210//   \char"123 -- hex
14211//   \char`x   -- character that can be written (i.e. isn't active)
14212//   \char`\x  -- character that cannot be written (e.g. %)
14213// These all refer to characters from the font, so we turn them into special
14214// calls to a function \@char dealt with in the Parser.
14215
14216defineMacro("\\char", function (context) {
14217  var token = context.popToken();
14218  var base;
14219  var number = '';
14220
14221  if (token.text === "'") {
14222    base = 8;
14223    token = context.popToken();
14224  } else if (token.text === '"') {
14225    base = 16;
14226    token = context.popToken();
14227  } else if (token.text === "`") {
14228    token = context.popToken();
14229
14230    if (token.text[0] === "\\") {
14231      number = token.text.charCodeAt(1);
14232    } else if (token.text === "EOF") {
14233      throw new src_ParseError("\\char` missing argument");
14234    } else {
14235      number = token.text.charCodeAt(0);
14236    }
14237  } else {
14238    base = 10;
14239  }
14240
14241  if (base) {
14242    // Parse a number in the given base, starting with first `token`.
14243    number = digitToNumber[token.text];
14244
14245    if (number == null || number >= base) {
14246      throw new src_ParseError("Invalid base-" + base + " digit " + token.text);
14247    }
14248
14249    var digit;
14250
14251    while ((digit = digitToNumber[context.future().text]) != null && digit < base) {
14252      number *= base;
14253      number += digit;
14254      context.popToken();
14255    }
14256  }
14257
14258  return "\\@char{" + number + "}";
14259}); // Basic support for macro definitions:
14260//     \def\macro{expansion}
14261//     \def\macro#1{expansion}
14262//     \def\macro#1#2{expansion}
14263//     \def\macro#1#2#3#4#5#6#7#8#9{expansion}
14264// Also the \gdef and \global\def equivalents
14265
14266var macros_def = function def(context, global) {
14267  var arg = context.consumeArgs(1)[0];
14268
14269  if (arg.length !== 1) {
14270    throw new src_ParseError("\\gdef's first argument must be a macro name");
14271  }
14272
14273  var name = arg[0].text; // Count argument specifiers, and check they are in the order #1 #2 ...
14274
14275  var numArgs = 0;
14276  arg = context.consumeArgs(1)[0];
14277
14278  while (arg.length === 1 && arg[0].text === "#") {
14279    arg = context.consumeArgs(1)[0];
14280
14281    if (arg.length !== 1) {
14282      throw new src_ParseError("Invalid argument number length \"" + arg.length + "\"");
14283    }
14284
14285    if (!/^[1-9]$/.test(arg[0].text)) {
14286      throw new src_ParseError("Invalid argument number \"" + arg[0].text + "\"");
14287    }
14288
14289    numArgs++;
14290
14291    if (parseInt(arg[0].text) !== numArgs) {
14292      throw new src_ParseError("Argument number \"" + arg[0].text + "\" out of order");
14293    }
14294
14295    arg = context.consumeArgs(1)[0];
14296  } // Final arg is the expansion of the macro
14297
14298
14299  context.macros.set(name, {
14300    tokens: arg,
14301    numArgs: numArgs
14302  }, global);
14303  return '';
14304};
14305
14306defineMacro("\\gdef", function (context) {
14307  return macros_def(context, true);
14308});
14309defineMacro("\\def", function (context) {
14310  return macros_def(context, false);
14311});
14312defineMacro("\\global", function (context) {
14313  var next = context.consumeArgs(1)[0];
14314
14315  if (next.length !== 1) {
14316    throw new src_ParseError("Invalid command after \\global");
14317  }
14318
14319  var command = next[0].text; // TODO: Should expand command
14320
14321  if (command === "\\def") {
14322    // \global\def is equivalent to \gdef
14323    return macros_def(context, true);
14324  } else {
14325    throw new src_ParseError("Invalid command '" + command + "' after \\global");
14326  }
14327}); // \newcommand{\macro}[args]{definition}
14328// \renewcommand{\macro}[args]{definition}
14329// TODO: Optional arguments: \newcommand{\macro}[args][default]{definition}
14330
14331var macros_newcommand = function newcommand(context, existsOK, nonexistsOK) {
14332  var arg = context.consumeArgs(1)[0];
14333
14334  if (arg.length !== 1) {
14335    throw new src_ParseError("\\newcommand's first argument must be a macro name");
14336  }
14337
14338  var name = arg[0].text;
14339  var exists = context.isDefined(name);
14340
14341  if (exists && !existsOK) {
14342    throw new src_ParseError("\\newcommand{" + name + "} attempting to redefine " + (name + "; use \\renewcommand"));
14343  }
14344
14345  if (!exists && !nonexistsOK) {
14346    throw new src_ParseError("\\renewcommand{" + name + "} when command " + name + " " + "does not yet exist; use \\newcommand");
14347  }
14348
14349  var numArgs = 0;
14350  arg = context.consumeArgs(1)[0];
14351
14352  if (arg.length === 1 && arg[0].text === "[") {
14353    var argText = '';
14354    var token = context.expandNextToken();
14355
14356    while (token.text !== "]" && token.text !== "EOF") {
14357      // TODO: Should properly expand arg, e.g., ignore {}s
14358      argText += token.text;
14359      token = context.expandNextToken();
14360    }
14361
14362    if (!argText.match(/^\s*[0-9]+\s*$/)) {
14363      throw new src_ParseError("Invalid number of arguments: " + argText);
14364    }
14365
14366    numArgs = parseInt(argText);
14367    arg = context.consumeArgs(1)[0];
14368  } // Final arg is the expansion of the macro
14369
14370
14371  context.macros.set(name, {
14372    tokens: arg,
14373    numArgs: numArgs
14374  });
14375  return '';
14376};
14377
14378defineMacro("\\newcommand", function (context) {
14379  return macros_newcommand(context, false, true);
14380});
14381defineMacro("\\renewcommand", function (context) {
14382  return macros_newcommand(context, true, false);
14383});
14384defineMacro("\\providecommand", function (context) {
14385  return macros_newcommand(context, true, true);
14386}); //////////////////////////////////////////////////////////////////////
14387// Grouping
14388// \let\bgroup={ \let\egroup=}
14389
14390defineMacro("\\bgroup", "{");
14391defineMacro("\\egroup", "}"); // Symbols from latex.ltx:
14392// \def\lq{`}
14393// \def\rq{'}
14394// \def \aa {\r a}
14395// \def \AA {\r A}
14396
14397defineMacro("\\lq", "`");
14398defineMacro("\\rq", "'");
14399defineMacro("\\aa", "\\r a");
14400defineMacro("\\AA", "\\r A"); // Copyright (C) and registered (R) symbols. Use raw symbol in MathML.
14401// \DeclareTextCommandDefault{\textcopyright}{\textcircled{c}}
14402// \DeclareTextCommandDefault{\textregistered}{\textcircled{%
14403//      \check@mathfonts\fontsize\sf@size\z@\math@fontsfalse\selectfont R}}
14404// \DeclareRobustCommand{\copyright}{%
14405//    \ifmmode{\nfss@text{\textcopyright}}\else\textcopyright\fi}
14406
14407defineMacro("\\textcopyright", "\\html@mathml{\\textcircled{c}}{\\char`©}");
14408defineMacro("\\copyright", "\\TextOrMath{\\textcopyright}{\\text{\\textcopyright}}");
14409defineMacro("\\textregistered", "\\html@mathml{\\textcircled{\\scriptsize R}}{\\char`®}"); // Characters omitted from Unicode range 1D400–1D7FF
14410
14411defineMacro("\u212C", "\\mathscr{B}"); // script
14412
14413defineMacro("\u2130", "\\mathscr{E}");
14414defineMacro("\u2131", "\\mathscr{F}");
14415defineMacro("\u210B", "\\mathscr{H}");
14416defineMacro("\u2110", "\\mathscr{I}");
14417defineMacro("\u2112", "\\mathscr{L}");
14418defineMacro("\u2133", "\\mathscr{M}");
14419defineMacro("\u211B", "\\mathscr{R}");
14420defineMacro("\u212D", "\\mathfrak{C}"); // Fraktur
14421
14422defineMacro("\u210C", "\\mathfrak{H}");
14423defineMacro("\u2128", "\\mathfrak{Z}"); // Define \Bbbk with a macro that works in both HTML and MathML.
14424
14425defineMacro("\\Bbbk", "\\Bbb{k}"); // Unicode middle dot
14426// The KaTeX fonts do not contain U+00B7. Instead, \cdotp displays
14427// the dot at U+22C5 and gives it punct spacing.
14428
14429defineMacro("\xB7", "\\cdotp"); // \llap and \rlap render their contents in text mode
14430
14431defineMacro("\\llap", "\\mathllap{\\textrm{#1}}");
14432defineMacro("\\rlap", "\\mathrlap{\\textrm{#1}}");
14433defineMacro("\\clap", "\\mathclap{\\textrm{#1}}"); // \not is defined by base/fontmath.ltx via
14434// \DeclareMathSymbol{\not}{\mathrel}{symbols}{"36}
14435// It's thus treated like a \mathrel, but defined by a symbol that has zero
14436// width but extends to the right.  We use \rlap to get that spacing.
14437// For MathML we write U+0338 here. buildMathML.js will then do the overlay.
14438
14439defineMacro("\\not", '\\html@mathml{\\mathrel{\\mathrlap\\@not}}{\\char"338}'); // Negated symbols from base/fontmath.ltx:
14440// \def\neq{\not=} \let\ne=\neq
14441// \DeclareRobustCommand
14442//   \notin{\mathrel{\m@th\mathpalette\c@ncel\in}}
14443// \def\c@ncel#1#2{\m@th\ooalign{$\hfil#1\mkern1mu/\hfil$\crcr$#1#2$}}
14444
14445defineMacro("\\neq", "\\html@mathml{\\mathrel{\\not=}}{\\mathrel{\\char`≠}}");
14446defineMacro("\\ne", "\\neq");
14447defineMacro("\u2260", "\\neq");
14448defineMacro("\\notin", "\\html@mathml{\\mathrel{{\\in}\\mathllap{/\\mskip1mu}}}" + "{\\mathrel{\\char`∉}}");
14449defineMacro("\u2209", "\\notin"); // Unicode stacked relations
14450
14451defineMacro("\u2258", "\\html@mathml{" + "\\mathrel{=\\kern{-1em}\\raisebox{0.4em}{$\\scriptsize\\frown$}}" + "}{\\mathrel{\\char`\u2258}}");
14452defineMacro("\u2259", "\\html@mathml{\\stackrel{\\tiny\\wedge}{=}}{\\mathrel{\\char`\u2258}}");
14453defineMacro("\u225A", "\\html@mathml{\\stackrel{\\tiny\\vee}{=}}{\\mathrel{\\char`\u225A}}");
14454defineMacro("\u225B", "\\html@mathml{\\stackrel{\\scriptsize\\star}{=}}" + "{\\mathrel{\\char`\u225B}}");
14455defineMacro("\u225D", "\\html@mathml{\\stackrel{\\tiny\\mathrm{def}}{=}}" + "{\\mathrel{\\char`\u225D}}");
14456defineMacro("\u225E", "\\html@mathml{\\stackrel{\\tiny\\mathrm{m}}{=}}" + "{\\mathrel{\\char`\u225E}}");
14457defineMacro("\u225F", "\\html@mathml{\\stackrel{\\tiny?}{=}}{\\mathrel{\\char`\u225F}}"); // Misc Unicode
14458
14459defineMacro("\u27C2", "\\perp");
14460defineMacro("\u203C", "\\mathclose{!\\mkern-0.8mu!}");
14461defineMacro("\u220C", "\\notni");
14462defineMacro("\u231C", "\\ulcorner");
14463defineMacro("\u231D", "\\urcorner");
14464defineMacro("\u231E", "\\llcorner");
14465defineMacro("\u231F", "\\lrcorner");
14466defineMacro("\xA9", "\\copyright");
14467defineMacro("\xAE", "\\textregistered");
14468defineMacro("\uFE0F", "\\textregistered"); //////////////////////////////////////////////////////////////////////
14469// LaTeX_2ε
14470// \vdots{\vbox{\baselineskip4\p@  \lineskiplimit\z@
14471// \kern6\p@\hbox{.}\hbox{.}\hbox{.}}}
14472// We'll call \varvdots, which gets a glyph from symbols.js.
14473// The zero-width rule gets us an equivalent to the vertical 6pt kern.
14474
14475defineMacro("\\vdots", "\\mathord{\\varvdots\\rule{0pt}{15pt}}");
14476defineMacro("\u22EE", "\\vdots"); //////////////////////////////////////////////////////////////////////
14477// amsmath.sty
14478// http://mirrors.concertpass.com/tex-archive/macros/latex/required/amsmath/amsmath.pdf
14479// Italic Greek capital letters.  AMS defines these with \DeclareMathSymbol,
14480// but they are equivalent to \mathit{\Letter}.
14481
14482defineMacro("\\varGamma", "\\mathit{\\Gamma}");
14483defineMacro("\\varDelta", "\\mathit{\\Delta}");
14484defineMacro("\\varTheta", "\\mathit{\\Theta}");
14485defineMacro("\\varLambda", "\\mathit{\\Lambda}");
14486defineMacro("\\varXi", "\\mathit{\\Xi}");
14487defineMacro("\\varPi", "\\mathit{\\Pi}");
14488defineMacro("\\varSigma", "\\mathit{\\Sigma}");
14489defineMacro("\\varUpsilon", "\\mathit{\\Upsilon}");
14490defineMacro("\\varPhi", "\\mathit{\\Phi}");
14491defineMacro("\\varPsi", "\\mathit{\\Psi}");
14492defineMacro("\\varOmega", "\\mathit{\\Omega}"); //\newcommand{\substack}[1]{\subarray{c}#1\endsubarray}
14493
14494defineMacro("\\substack", "\\begin{subarray}{c}#1\\end{subarray}"); // \renewcommand{\colon}{\nobreak\mskip2mu\mathpunct{}\nonscript
14495// \mkern-\thinmuskip{:}\mskip6muplus1mu\relax}
14496
14497defineMacro("\\colon", "\\nobreak\\mskip2mu\\mathpunct{}" + "\\mathchoice{\\mkern-3mu}{\\mkern-3mu}{}{}{:}\\mskip6mu"); // \newcommand{\boxed}[1]{\fbox{\m@th$\displaystyle#1$}}
14498
14499defineMacro("\\boxed", "\\fbox{$\\displaystyle{#1}$}"); // \def\iff{\DOTSB\;\Longleftrightarrow\;}
14500// \def\implies{\DOTSB\;\Longrightarrow\;}
14501// \def\impliedby{\DOTSB\;\Longleftarrow\;}
14502
14503defineMacro("\\iff", "\\DOTSB\\;\\Longleftrightarrow\\;");
14504defineMacro("\\implies", "\\DOTSB\\;\\Longrightarrow\\;");
14505defineMacro("\\impliedby", "\\DOTSB\\;\\Longleftarrow\\;"); // AMSMath's automatic \dots, based on \mdots@@ macro.
14506
14507var dotsByToken = {
14508  ',': '\\dotsc',
14509  '\\not': '\\dotsb',
14510  // \keybin@ checks for the following:
14511  '+': '\\dotsb',
14512  '=': '\\dotsb',
14513  '<': '\\dotsb',
14514  '>': '\\dotsb',
14515  '-': '\\dotsb',
14516  '*': '\\dotsb',
14517  ':': '\\dotsb',
14518  // Symbols whose definition starts with \DOTSB:
14519  '\\DOTSB': '\\dotsb',
14520  '\\coprod': '\\dotsb',
14521  '\\bigvee': '\\dotsb',
14522  '\\bigwedge': '\\dotsb',
14523  '\\biguplus': '\\dotsb',
14524  '\\bigcap': '\\dotsb',
14525  '\\bigcup': '\\dotsb',
14526  '\\prod': '\\dotsb',
14527  '\\sum': '\\dotsb',
14528  '\\bigotimes': '\\dotsb',
14529  '\\bigoplus': '\\dotsb',
14530  '\\bigodot': '\\dotsb',
14531  '\\bigsqcup': '\\dotsb',
14532  '\\And': '\\dotsb',
14533  '\\longrightarrow': '\\dotsb',
14534  '\\Longrightarrow': '\\dotsb',
14535  '\\longleftarrow': '\\dotsb',
14536  '\\Longleftarrow': '\\dotsb',
14537  '\\longleftrightarrow': '\\dotsb',
14538  '\\Longleftrightarrow': '\\dotsb',
14539  '\\mapsto': '\\dotsb',
14540  '\\longmapsto': '\\dotsb',
14541  '\\hookrightarrow': '\\dotsb',
14542  '\\doteq': '\\dotsb',
14543  // Symbols whose definition starts with \mathbin:
14544  '\\mathbin': '\\dotsb',
14545  // Symbols whose definition starts with \mathrel:
14546  '\\mathrel': '\\dotsb',
14547  '\\relbar': '\\dotsb',
14548  '\\Relbar': '\\dotsb',
14549  '\\xrightarrow': '\\dotsb',
14550  '\\xleftarrow': '\\dotsb',
14551  // Symbols whose definition starts with \DOTSI:
14552  '\\DOTSI': '\\dotsi',
14553  '\\int': '\\dotsi',
14554  '\\oint': '\\dotsi',
14555  '\\iint': '\\dotsi',
14556  '\\iiint': '\\dotsi',
14557  '\\iiiint': '\\dotsi',
14558  '\\idotsint': '\\dotsi',
14559  // Symbols whose definition starts with \DOTSX:
14560  '\\DOTSX': '\\dotsx'
14561};
14562defineMacro("\\dots", function (context) {
14563  // TODO: If used in text mode, should expand to \textellipsis.
14564  // However, in KaTeX, \textellipsis and \ldots behave the same
14565  // (in text mode), and it's unlikely we'd see any of the math commands
14566  // that affect the behavior of \dots when in text mode.  So fine for now
14567  // (until we support \ifmmode ... \else ... \fi).
14568  var thedots = '\\dotso';
14569  var next = context.expandAfterFuture().text;
14570
14571  if (next in dotsByToken) {
14572    thedots = dotsByToken[next];
14573  } else if (next.substr(0, 4) === '\\not') {
14574    thedots = '\\dotsb';
14575  } else if (next in src_symbols.math) {
14576    if (utils.contains(['bin', 'rel'], src_symbols.math[next].group)) {
14577      thedots = '\\dotsb';
14578    }
14579  }
14580
14581  return thedots;
14582});
14583var spaceAfterDots = {
14584  // \rightdelim@ checks for the following:
14585  ')': true,
14586  ']': true,
14587  '\\rbrack': true,
14588  '\\}': true,
14589  '\\rbrace': true,
14590  '\\rangle': true,
14591  '\\rceil': true,
14592  '\\rfloor': true,
14593  '\\rgroup': true,
14594  '\\rmoustache': true,
14595  '\\right': true,
14596  '\\bigr': true,
14597  '\\biggr': true,
14598  '\\Bigr': true,
14599  '\\Biggr': true,
14600  // \extra@ also tests for the following:
14601  '$': true,
14602  // \extrap@ checks for the following:
14603  ';': true,
14604  '.': true,
14605  ',': true
14606};
14607defineMacro("\\dotso", function (context) {
14608  var next = context.future().text;
14609
14610  if (next in spaceAfterDots) {
14611    return "\\ldots\\,";
14612  } else {
14613    return "\\ldots";
14614  }
14615});
14616defineMacro("\\dotsc", function (context) {
14617  var next = context.future().text; // \dotsc uses \extra@ but not \extrap@, instead specially checking for
14618  // ';' and '.', but doesn't check for ','.
14619
14620  if (next in spaceAfterDots && next !== ',') {
14621    return "\\ldots\\,";
14622  } else {
14623    return "\\ldots";
14624  }
14625});
14626defineMacro("\\cdots", function (context) {
14627  var next = context.future().text;
14628
14629  if (next in spaceAfterDots) {
14630    return "\\@cdots\\,";
14631  } else {
14632    return "\\@cdots";
14633  }
14634});
14635defineMacro("\\dotsb", "\\cdots");
14636defineMacro("\\dotsm", "\\cdots");
14637defineMacro("\\dotsi", "\\!\\cdots"); // amsmath doesn't actually define \dotsx, but \dots followed by a macro
14638// starting with \DOTSX implies \dotso, and then \extra@ detects this case
14639// and forces the added `\,`.
14640
14641defineMacro("\\dotsx", "\\ldots\\,"); // \let\DOTSI\relax
14642// \let\DOTSB\relax
14643// \let\DOTSX\relax
14644
14645defineMacro("\\DOTSI", "\\relax");
14646defineMacro("\\DOTSB", "\\relax");
14647defineMacro("\\DOTSX", "\\relax"); // Spacing, based on amsmath.sty's override of LaTeX defaults
14648// \DeclareRobustCommand{\tmspace}[3]{%
14649//   \ifmmode\mskip#1#2\else\kern#1#3\fi\relax}
14650
14651defineMacro("\\tmspace", "\\TextOrMath{\\kern#1#3}{\\mskip#1#2}\\relax"); // \renewcommand{\,}{\tmspace+\thinmuskip{.1667em}}
14652// TODO: math mode should use \thinmuskip
14653
14654defineMacro("\\,", "\\tmspace+{3mu}{.1667em}"); // \let\thinspace\,
14655
14656defineMacro("\\thinspace", "\\,"); // \def\>{\mskip\medmuskip}
14657// \renewcommand{\:}{\tmspace+\medmuskip{.2222em}}
14658// TODO: \> and math mode of \: should use \medmuskip = 4mu plus 2mu minus 4mu
14659
14660defineMacro("\\>", "\\mskip{4mu}");
14661defineMacro("\\:", "\\tmspace+{4mu}{.2222em}"); // \let\medspace\:
14662
14663defineMacro("\\medspace", "\\:"); // \renewcommand{\;}{\tmspace+\thickmuskip{.2777em}}
14664// TODO: math mode should use \thickmuskip = 5mu plus 5mu
14665
14666defineMacro("\\;", "\\tmspace+{5mu}{.2777em}"); // \let\thickspace\;
14667
14668defineMacro("\\thickspace", "\\;"); // \renewcommand{\!}{\tmspace-\thinmuskip{.1667em}}
14669// TODO: math mode should use \thinmuskip
14670
14671defineMacro("\\!", "\\tmspace-{3mu}{.1667em}"); // \let\negthinspace\!
14672
14673defineMacro("\\negthinspace", "\\!"); // \newcommand{\negmedspace}{\tmspace-\medmuskip{.2222em}}
14674// TODO: math mode should use \medmuskip
14675
14676defineMacro("\\negmedspace", "\\tmspace-{4mu}{.2222em}"); // \newcommand{\negthickspace}{\tmspace-\thickmuskip{.2777em}}
14677// TODO: math mode should use \thickmuskip
14678
14679defineMacro("\\negthickspace", "\\tmspace-{5mu}{.277em}"); // \def\enspace{\kern.5em }
14680
14681defineMacro("\\enspace", "\\kern.5em "); // \def\enskip{\hskip.5em\relax}
14682
14683defineMacro("\\enskip", "\\hskip.5em\\relax"); // \def\quad{\hskip1em\relax}
14684
14685defineMacro("\\quad", "\\hskip1em\\relax"); // \def\qquad{\hskip2em\relax}
14686
14687defineMacro("\\qquad", "\\hskip2em\\relax"); // \tag@in@display form of \tag
14688
14689defineMacro("\\tag", "\\@ifstar\\tag@literal\\tag@paren");
14690defineMacro("\\tag@paren", "\\tag@literal{({#1})}");
14691defineMacro("\\tag@literal", function (context) {
14692  if (context.macros.get("\\df@tag")) {
14693    throw new src_ParseError("Multiple \\tag");
14694  }
14695
14696  return "\\gdef\\df@tag{\\text{#1}}";
14697}); // \renewcommand{\bmod}{\nonscript\mskip-\medmuskip\mkern5mu\mathbin
14698//   {\operator@font mod}\penalty900
14699//   \mkern5mu\nonscript\mskip-\medmuskip}
14700// \newcommand{\pod}[1]{\allowbreak
14701//   \if@display\mkern18mu\else\mkern8mu\fi(#1)}
14702// \renewcommand{\pmod}[1]{\pod{{\operator@font mod}\mkern6mu#1}}
14703// \newcommand{\mod}[1]{\allowbreak\if@display\mkern18mu
14704//   \else\mkern12mu\fi{\operator@font mod}\,\,#1}
14705// TODO: math mode should use \medmuskip = 4mu plus 2mu minus 4mu
14706
14707defineMacro("\\bmod", "\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}" + "\\mathbin{\\rm mod}" + "\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}");
14708defineMacro("\\pod", "\\allowbreak" + "\\mathchoice{\\mkern18mu}{\\mkern8mu}{\\mkern8mu}{\\mkern8mu}(#1)");
14709defineMacro("\\pmod", "\\pod{{\\rm mod}\\mkern6mu#1}");
14710defineMacro("\\mod", "\\allowbreak" + "\\mathchoice{\\mkern18mu}{\\mkern12mu}{\\mkern12mu}{\\mkern12mu}" + "{\\rm mod}\\,\\,#1"); // \pmb    --   A simulation of bold.
14711// The version in ambsy.sty works by typesetting three copies of the argument
14712// with small offsets. We use two copies. We omit the vertical offset because
14713// of rendering problems that makeVList encounters in Safari.
14714
14715defineMacro("\\pmb", "\\html@mathml{" + "\\@binrel{#1}{\\mathrlap{#1}\\kern0.5px#1}}" + "{\\mathbf{#1}}"); //////////////////////////////////////////////////////////////////////
14716// LaTeX source2e
14717// \\ defaults to \newline, but changes to \cr within array environment
14718
14719defineMacro("\\\\", "\\newline"); // \def\TeX{T\kern-.1667em\lower.5ex\hbox{E}\kern-.125emX\@}
14720// TODO: Doesn't normally work in math mode because \@ fails.  KaTeX doesn't
14721// support \@ yet, so that's omitted, and we add \text so that the result
14722// doesn't look funny in math mode.
14723
14724defineMacro("\\TeX", "\\textrm{\\html@mathml{" + "T\\kern-.1667em\\raisebox{-.5ex}{E}\\kern-.125emX" + "}{TeX}}"); // \DeclareRobustCommand{\LaTeX}{L\kern-.36em%
14725//         {\sbox\z@ T%
14726//          \vbox to\ht\z@{\hbox{\check@mathfonts
14727//                               \fontsize\sf@size\z@
14728//                               \math@fontsfalse\selectfont
14729//                               A}%
14730//                         \vss}%
14731//         }%
14732//         \kern-.15em%
14733//         \TeX}
14734// This code aligns the top of the A with the T (from the perspective of TeX's
14735// boxes, though visually the A appears to extend above slightly).
14736// We compute the corresponding \raisebox when A is rendered in \normalsize
14737// \scriptstyle, which has a scale factor of 0.7 (see Options.js).
14738
14739var latexRaiseA = fontMetricsData['Main-Regular']["T".charCodeAt(0)][1] - 0.7 * fontMetricsData['Main-Regular']["A".charCodeAt(0)][1] + "em";
14740defineMacro("\\LaTeX", "\\textrm{\\html@mathml{" + ("L\\kern-.36em\\raisebox{" + latexRaiseA + "}{\\scriptstyle A}") + "\\kern-.15em\\TeX}{LaTeX}}"); // New KaTeX logo based on tweaking LaTeX logo
14741
14742defineMacro("\\KaTeX", "\\textrm{\\html@mathml{" + ("K\\kern-.17em\\raisebox{" + latexRaiseA + "}{\\scriptstyle A}") + "\\kern-.15em\\TeX}{KaTeX}}"); // \DeclareRobustCommand\hspace{\@ifstar\@hspacer\@hspace}
14743// \def\@hspace#1{\hskip  #1\relax}
14744// \def\@hspacer#1{\vrule \@width\z@\nobreak
14745//                 \hskip #1\hskip \z@skip}
14746
14747defineMacro("\\hspace", "\\@ifstar\\@hspacer\\@hspace");
14748defineMacro("\\@hspace", "\\hskip #1\\relax");
14749defineMacro("\\@hspacer", "\\rule{0pt}{0pt}\\hskip #1\\relax"); //////////////////////////////////////////////////////////////////////
14750// mathtools.sty
14751//\providecommand\ordinarycolon{:}
14752
14753defineMacro("\\ordinarycolon", ":"); //\def\vcentcolon{\mathrel{\mathop\ordinarycolon}}
14754//TODO(edemaine): Not yet centered. Fix via \raisebox or #726
14755
14756defineMacro("\\vcentcolon", "\\mathrel{\\mathop\\ordinarycolon}"); // \providecommand*\dblcolon{\vcentcolon\mathrel{\mkern-.9mu}\vcentcolon}
14757
14758defineMacro("\\dblcolon", "\\html@mathml{" + "\\mathrel{\\vcentcolon\\mathrel{\\mkern-.9mu}\\vcentcolon}}" + "{\\mathop{\\char\"2237}}"); // \providecommand*\coloneqq{\vcentcolon\mathrel{\mkern-1.2mu}=}
14759
14760defineMacro("\\coloneqq", "\\html@mathml{" + "\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}=}}" + "{\\mathop{\\char\"2254}}"); // ≔
14761// \providecommand*\Coloneqq{\dblcolon\mathrel{\mkern-1.2mu}=}
14762
14763defineMacro("\\Coloneqq", "\\html@mathml{" + "\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}=}}" + "{\\mathop{\\char\"2237\\char\"3d}}"); // \providecommand*\coloneq{\vcentcolon\mathrel{\mkern-1.2mu}\mathrel{-}}
14764
14765defineMacro("\\coloneq", "\\html@mathml{" + "\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}" + "{\\mathop{\\char\"3a\\char\"2212}}"); // \providecommand*\Coloneq{\dblcolon\mathrel{\mkern-1.2mu}\mathrel{-}}
14766
14767defineMacro("\\Coloneq", "\\html@mathml{" + "\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}" + "{\\mathop{\\char\"2237\\char\"2212}}"); // \providecommand*\eqqcolon{=\mathrel{\mkern-1.2mu}\vcentcolon}
14768
14769defineMacro("\\eqqcolon", "\\html@mathml{" + "\\mathrel{=\\mathrel{\\mkern-1.2mu}\\vcentcolon}}" + "{\\mathop{\\char\"2255}}"); // ≕
14770// \providecommand*\Eqqcolon{=\mathrel{\mkern-1.2mu}\dblcolon}
14771
14772defineMacro("\\Eqqcolon", "\\html@mathml{" + "\\mathrel{=\\mathrel{\\mkern-1.2mu}\\dblcolon}}" + "{\\mathop{\\char\"3d\\char\"2237}}"); // \providecommand*\eqcolon{\mathrel{-}\mathrel{\mkern-1.2mu}\vcentcolon}
14773
14774defineMacro("\\eqcolon", "\\html@mathml{" + "\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\vcentcolon}}" + "{\\mathop{\\char\"2239}}"); // \providecommand*\Eqcolon{\mathrel{-}\mathrel{\mkern-1.2mu}\dblcolon}
14775
14776defineMacro("\\Eqcolon", "\\html@mathml{" + "\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\dblcolon}}" + "{\\mathop{\\char\"2212\\char\"2237}}"); // \providecommand*\colonapprox{\vcentcolon\mathrel{\mkern-1.2mu}\approx}
14777
14778defineMacro("\\colonapprox", "\\html@mathml{" + "\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\approx}}" + "{\\mathop{\\char\"3a\\char\"2248}}"); // \providecommand*\Colonapprox{\dblcolon\mathrel{\mkern-1.2mu}\approx}
14779
14780defineMacro("\\Colonapprox", "\\html@mathml{" + "\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\approx}}" + "{\\mathop{\\char\"2237\\char\"2248}}"); // \providecommand*\colonsim{\vcentcolon\mathrel{\mkern-1.2mu}\sim}
14781
14782defineMacro("\\colonsim", "\\html@mathml{" + "\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\sim}}" + "{\\mathop{\\char\"3a\\char\"223c}}"); // \providecommand*\Colonsim{\dblcolon\mathrel{\mkern-1.2mu}\sim}
14783
14784defineMacro("\\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.
14785
14786defineMacro("\u2237", "\\dblcolon"); // ::
14787
14788defineMacro("\u2239", "\\eqcolon"); // -:
14789
14790defineMacro("\u2254", "\\coloneqq"); // :=
14791
14792defineMacro("\u2255", "\\eqqcolon"); // =:
14793
14794defineMacro("\u2A74", "\\Coloneqq"); // ::=
14795//////////////////////////////////////////////////////////////////////
14796// colonequals.sty
14797// Alternate names for mathtools's macros:
14798
14799defineMacro("\\ratio", "\\vcentcolon");
14800defineMacro("\\coloncolon", "\\dblcolon");
14801defineMacro("\\colonequals", "\\coloneqq");
14802defineMacro("\\coloncolonequals", "\\Coloneqq");
14803defineMacro("\\equalscolon", "\\eqqcolon");
14804defineMacro("\\equalscoloncolon", "\\Eqqcolon");
14805defineMacro("\\colonminus", "\\coloneq");
14806defineMacro("\\coloncolonminus", "\\Coloneq");
14807defineMacro("\\minuscolon", "\\eqcolon");
14808defineMacro("\\minuscoloncolon", "\\Eqcolon"); // \colonapprox name is same in mathtools and colonequals.
14809
14810defineMacro("\\coloncolonapprox", "\\Colonapprox"); // \colonsim name is same in mathtools and colonequals.
14811
14812defineMacro("\\coloncolonsim", "\\Colonsim"); // Additional macros, implemented by analogy with mathtools definitions:
14813
14814defineMacro("\\simcolon", "\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\vcentcolon}");
14815defineMacro("\\simcoloncolon", "\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\dblcolon}");
14816defineMacro("\\approxcolon", "\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\vcentcolon}");
14817defineMacro("\\approxcoloncolon", "\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\dblcolon}"); // Present in newtxmath, pxfonts and txfonts
14818
14819defineMacro("\\notni", "\\html@mathml{\\not\\ni}{\\mathrel{\\char`\u220C}}");
14820defineMacro("\\limsup", "\\DOTSB\\operatorname*{lim\\,sup}");
14821defineMacro("\\liminf", "\\DOTSB\\operatorname*{lim\\,inf}"); //////////////////////////////////////////////////////////////////////
14822// MathML alternates for KaTeX glyphs in the Unicode private area
14823
14824defineMacro("\\gvertneqq", "\\html@mathml{\\@gvertneqq}{\u2269}");
14825defineMacro("\\lvertneqq", "\\html@mathml{\\@lvertneqq}{\u2268}");
14826defineMacro("\\ngeqq", "\\html@mathml{\\@ngeqq}{\u2271}");
14827defineMacro("\\ngeqslant", "\\html@mathml{\\@ngeqslant}{\u2271}");
14828defineMacro("\\nleqq", "\\html@mathml{\\@nleqq}{\u2270}");
14829defineMacro("\\nleqslant", "\\html@mathml{\\@nleqslant}{\u2270}");
14830defineMacro("\\nshortmid", "\\html@mathml{\\@nshortmid}{∤}");
14831defineMacro("\\nshortparallel", "\\html@mathml{\\@nshortparallel}{∦}");
14832defineMacro("\\nsubseteqq", "\\html@mathml{\\@nsubseteqq}{\u2288}");
14833defineMacro("\\nsupseteqq", "\\html@mathml{\\@nsupseteqq}{\u2289}");
14834defineMacro("\\varsubsetneq", "\\html@mathml{\\@varsubsetneq}{⊊}");
14835defineMacro("\\varsubsetneqq", "\\html@mathml{\\@varsubsetneqq}{⫋}");
14836defineMacro("\\varsupsetneq", "\\html@mathml{\\@varsupsetneq}{⊋}");
14837defineMacro("\\varsupsetneqq", "\\html@mathml{\\@varsupsetneqq}{⫌}"); //////////////////////////////////////////////////////////////////////
14838// stmaryrd and semantic
14839// The stmaryrd and semantic packages render the next four items by calling a
14840// glyph. Those glyphs do not exist in the KaTeX fonts. Hence the macros.
14841
14842defineMacro("\\llbracket", "\\html@mathml{" + "\\mathopen{[\\mkern-3.2mu[}}" + "{\\mathopen{\\char`\u27E6}}");
14843defineMacro("\\rrbracket", "\\html@mathml{" + "\\mathclose{]\\mkern-3.2mu]}}" + "{\\mathclose{\\char`\u27E7}}");
14844defineMacro("\u27E6", "\\llbracket"); // blackboard bold [
14845
14846defineMacro("\u27E7", "\\rrbracket"); // blackboard bold ]
14847
14848defineMacro("\\lBrace", "\\html@mathml{" + "\\mathopen{\\{\\mkern-3.2mu[}}" + "{\\mathopen{\\char`\u2983}}");
14849defineMacro("\\rBrace", "\\html@mathml{" + "\\mathclose{]\\mkern-3.2mu\\}}}" + "{\\mathclose{\\char`\u2984}}");
14850defineMacro("\u2983", "\\lBrace"); // blackboard bold {
14851
14852defineMacro("\u2984", "\\rBrace"); // blackboard bold }
14853// TODO: Create variable sized versions of the last two items. I believe that
14854// will require new font glyphs.
14855//////////////////////////////////////////////////////////////////////
14856// texvc.sty
14857// The texvc package contains macros available in mediawiki pages.
14858// We omit the functions deprecated at
14859// https://en.wikipedia.org/wiki/Help:Displaying_a_formula#Deprecated_syntax
14860// We also omit texvc's \O, which conflicts with \text{\O}
14861
14862defineMacro("\\darr", "\\downarrow");
14863defineMacro("\\dArr", "\\Downarrow");
14864defineMacro("\\Darr", "\\Downarrow");
14865defineMacro("\\lang", "\\langle");
14866defineMacro("\\rang", "\\rangle");
14867defineMacro("\\uarr", "\\uparrow");
14868defineMacro("\\uArr", "\\Uparrow");
14869defineMacro("\\Uarr", "\\Uparrow");
14870defineMacro("\\N", "\\mathbb{N}");
14871defineMacro("\\R", "\\mathbb{R}");
14872defineMacro("\\Z", "\\mathbb{Z}");
14873defineMacro("\\alef", "\\aleph");
14874defineMacro("\\alefsym", "\\aleph");
14875defineMacro("\\Alpha", "\\mathrm{A}");
14876defineMacro("\\Beta", "\\mathrm{B}");
14877defineMacro("\\bull", "\\bullet");
14878defineMacro("\\Chi", "\\mathrm{X}");
14879defineMacro("\\clubs", "\\clubsuit");
14880defineMacro("\\cnums", "\\mathbb{C}");
14881defineMacro("\\Complex", "\\mathbb{C}");
14882defineMacro("\\Dagger", "\\ddagger");
14883defineMacro("\\diamonds", "\\diamondsuit");
14884defineMacro("\\empty", "\\emptyset");
14885defineMacro("\\Epsilon", "\\mathrm{E}");
14886defineMacro("\\Eta", "\\mathrm{H}");
14887defineMacro("\\exist", "\\exists");
14888defineMacro("\\harr", "\\leftrightarrow");
14889defineMacro("\\hArr", "\\Leftrightarrow");
14890defineMacro("\\Harr", "\\Leftrightarrow");
14891defineMacro("\\hearts", "\\heartsuit");
14892defineMacro("\\image", "\\Im");
14893defineMacro("\\infin", "\\infty");
14894defineMacro("\\Iota", "\\mathrm{I}");
14895defineMacro("\\isin", "\\in");
14896defineMacro("\\Kappa", "\\mathrm{K}");
14897defineMacro("\\larr", "\\leftarrow");
14898defineMacro("\\lArr", "\\Leftarrow");
14899defineMacro("\\Larr", "\\Leftarrow");
14900defineMacro("\\lrarr", "\\leftrightarrow");
14901defineMacro("\\lrArr", "\\Leftrightarrow");
14902defineMacro("\\Lrarr", "\\Leftrightarrow");
14903defineMacro("\\Mu", "\\mathrm{M}");
14904defineMacro("\\natnums", "\\mathbb{N}");
14905defineMacro("\\Nu", "\\mathrm{N}");
14906defineMacro("\\Omicron", "\\mathrm{O}");
14907defineMacro("\\plusmn", "\\pm");
14908defineMacro("\\rarr", "\\rightarrow");
14909defineMacro("\\rArr", "\\Rightarrow");
14910defineMacro("\\Rarr", "\\Rightarrow");
14911defineMacro("\\real", "\\Re");
14912defineMacro("\\reals", "\\mathbb{R}");
14913defineMacro("\\Reals", "\\mathbb{R}");
14914defineMacro("\\Rho", "\\mathrm{P}");
14915defineMacro("\\sdot", "\\cdot");
14916defineMacro("\\sect", "\\S");
14917defineMacro("\\spades", "\\spadesuit");
14918defineMacro("\\sub", "\\subset");
14919defineMacro("\\sube", "\\subseteq");
14920defineMacro("\\supe", "\\supseteq");
14921defineMacro("\\Tau", "\\mathrm{T}");
14922defineMacro("\\thetasym", "\\vartheta"); // TODO: defineMacro("\\varcoppa", "\\\mbox{\\coppa}");
14923
14924defineMacro("\\weierp", "\\wp");
14925defineMacro("\\Zeta", "\\mathrm{Z}"); //////////////////////////////////////////////////////////////////////
14926// statmath.sty
14927// https://ctan.math.illinois.edu/macros/latex/contrib/statmath/statmath.pdf
14928
14929defineMacro("\\argmin", "\\DOTSB\\operatorname*{arg\\,min}");
14930defineMacro("\\argmax", "\\DOTSB\\operatorname*{arg\\,max}");
14931defineMacro("\\plim", "\\DOTSB\\mathop{\\operatorname{plim}}\\limits"); // Custom Khan Academy colors, should be moved to an optional package
14932
14933defineMacro("\\blue", "\\textcolor{##6495ed}{#1}");
14934defineMacro("\\orange", "\\textcolor{##ffa500}{#1}");
14935defineMacro("\\pink", "\\textcolor{##ff00af}{#1}");
14936defineMacro("\\red", "\\textcolor{##df0030}{#1}");
14937defineMacro("\\green", "\\textcolor{##28ae7b}{#1}");
14938defineMacro("\\gray", "\\textcolor{gray}{#1}");
14939defineMacro("\\purple", "\\textcolor{##9d38bd}{#1}");
14940defineMacro("\\blueA", "\\textcolor{##ccfaff}{#1}");
14941defineMacro("\\blueB", "\\textcolor{##80f6ff}{#1}");
14942defineMacro("\\blueC", "\\textcolor{##63d9ea}{#1}");
14943defineMacro("\\blueD", "\\textcolor{##11accd}{#1}");
14944defineMacro("\\blueE", "\\textcolor{##0c7f99}{#1}");
14945defineMacro("\\tealA", "\\textcolor{##94fff5}{#1}");
14946defineMacro("\\tealB", "\\textcolor{##26edd5}{#1}");
14947defineMacro("\\tealC", "\\textcolor{##01d1c1}{#1}");
14948defineMacro("\\tealD", "\\textcolor{##01a995}{#1}");
14949defineMacro("\\tealE", "\\textcolor{##208170}{#1}");
14950defineMacro("\\greenA", "\\textcolor{##b6ffb0}{#1}");
14951defineMacro("\\greenB", "\\textcolor{##8af281}{#1}");
14952defineMacro("\\greenC", "\\textcolor{##74cf70}{#1}");
14953defineMacro("\\greenD", "\\textcolor{##1fab54}{#1}");
14954defineMacro("\\greenE", "\\textcolor{##0d923f}{#1}");
14955defineMacro("\\goldA", "\\textcolor{##ffd0a9}{#1}");
14956defineMacro("\\goldB", "\\textcolor{##ffbb71}{#1}");
14957defineMacro("\\goldC", "\\textcolor{##ff9c39}{#1}");
14958defineMacro("\\goldD", "\\textcolor{##e07d10}{#1}");
14959defineMacro("\\goldE", "\\textcolor{##a75a05}{#1}");
14960defineMacro("\\redA", "\\textcolor{##fca9a9}{#1}");
14961defineMacro("\\redB", "\\textcolor{##ff8482}{#1}");
14962defineMacro("\\redC", "\\textcolor{##f9685d}{#1}");
14963defineMacro("\\redD", "\\textcolor{##e84d39}{#1}");
14964defineMacro("\\redE", "\\textcolor{##bc2612}{#1}");
14965defineMacro("\\maroonA", "\\textcolor{##ffbde0}{#1}");
14966defineMacro("\\maroonB", "\\textcolor{##ff92c6}{#1}");
14967defineMacro("\\maroonC", "\\textcolor{##ed5fa6}{#1}");
14968defineMacro("\\maroonD", "\\textcolor{##ca337c}{#1}");
14969defineMacro("\\maroonE", "\\textcolor{##9e034e}{#1}");
14970defineMacro("\\purpleA", "\\textcolor{##ddd7ff}{#1}");
14971defineMacro("\\purpleB", "\\textcolor{##c6b9fc}{#1}");
14972defineMacro("\\purpleC", "\\textcolor{##aa87ff}{#1}");
14973defineMacro("\\purpleD", "\\textcolor{##7854ab}{#1}");
14974defineMacro("\\purpleE", "\\textcolor{##543b78}{#1}");
14975defineMacro("\\mintA", "\\textcolor{##f5f9e8}{#1}");
14976defineMacro("\\mintB", "\\textcolor{##edf2df}{#1}");
14977defineMacro("\\mintC", "\\textcolor{##e0e5cc}{#1}");
14978defineMacro("\\grayA", "\\textcolor{##f6f7f7}{#1}");
14979defineMacro("\\grayB", "\\textcolor{##f0f1f2}{#1}");
14980defineMacro("\\grayC", "\\textcolor{##e3e5e6}{#1}");
14981defineMacro("\\grayD", "\\textcolor{##d6d8da}{#1}");
14982defineMacro("\\grayE", "\\textcolor{##babec2}{#1}");
14983defineMacro("\\grayF", "\\textcolor{##888d93}{#1}");
14984defineMacro("\\grayG", "\\textcolor{##626569}{#1}");
14985defineMacro("\\grayH", "\\textcolor{##3b3e40}{#1}");
14986defineMacro("\\grayI", "\\textcolor{##21242c}{#1}");
14987defineMacro("\\kaBlue", "\\textcolor{##314453}{#1}");
14988defineMacro("\\kaGreen", "\\textcolor{##71B307}{#1}");
14989// CONCATENATED MODULE: ./src/MacroExpander.js
14990/**
14991 * This file contains the “gullet” where macros are expanded
14992 * until only non-macro tokens remain.
14993 */
14994
14995
14996
14997
14998
14999
15000
15001// List of commands that act like macros but aren't defined as a macro,
15002// function, or symbol.  Used in `isDefined`.
15003var implicitCommands = {
15004  "\\relax": true,
15005  // MacroExpander.js
15006  "^": true,
15007  // Parser.js
15008  "_": true,
15009  // Parser.js
15010  "\\limits": true,
15011  // Parser.js
15012  "\\nolimits": true // Parser.js
15013
15014};
15015
15016var MacroExpander_MacroExpander =
15017/*#__PURE__*/
15018function () {
15019  function MacroExpander(input, settings, mode) {
15020    this.settings = void 0;
15021    this.expansionCount = void 0;
15022    this.lexer = void 0;
15023    this.macros = void 0;
15024    this.stack = void 0;
15025    this.mode = void 0;
15026    this.settings = settings;
15027    this.expansionCount = 0;
15028    this.feed(input); // Make new global namespace
15029
15030    this.macros = new Namespace_Namespace(macros, settings.macros);
15031    this.mode = mode;
15032    this.stack = []; // contains tokens in REVERSE order
15033  }
15034  /**
15035   * Feed a new input string to the same MacroExpander
15036   * (with existing macros etc.).
15037   */
15038
15039
15040  var _proto = MacroExpander.prototype;
15041
15042  _proto.feed = function feed(input) {
15043    this.lexer = new Lexer_Lexer(input, this.settings);
15044  }
15045  /**
15046   * Switches between "text" and "math" modes.
15047   */
15048  ;
15049
15050  _proto.switchMode = function switchMode(newMode) {
15051    this.mode = newMode;
15052  }
15053  /**
15054   * Start a new group nesting within all namespaces.
15055   */
15056  ;
15057
15058  _proto.beginGroup = function beginGroup() {
15059    this.macros.beginGroup();
15060  }
15061  /**
15062   * End current group nesting within all namespaces.
15063   */
15064  ;
15065
15066  _proto.endGroup = function endGroup() {
15067    this.macros.endGroup();
15068  }
15069  /**
15070   * Returns the topmost token on the stack, without expanding it.
15071   * Similar in behavior to TeX's `\futurelet`.
15072   */
15073  ;
15074
15075  _proto.future = function future() {
15076    if (this.stack.length === 0) {
15077      this.pushToken(this.lexer.lex());
15078    }
15079
15080    return this.stack[this.stack.length - 1];
15081  }
15082  /**
15083   * Remove and return the next unexpanded token.
15084   */
15085  ;
15086
15087  _proto.popToken = function popToken() {
15088    this.future(); // ensure non-empty stack
15089
15090    return this.stack.pop();
15091  }
15092  /**
15093   * Add a given token to the token stack.  In particular, this get be used
15094   * to put back a token returned from one of the other methods.
15095   */
15096  ;
15097
15098  _proto.pushToken = function pushToken(token) {
15099    this.stack.push(token);
15100  }
15101  /**
15102   * Append an array of tokens to the token stack.
15103   */
15104  ;
15105
15106  _proto.pushTokens = function pushTokens(tokens) {
15107    var _this$stack;
15108
15109    (_this$stack = this.stack).push.apply(_this$stack, tokens);
15110  }
15111  /**
15112   * Consume all following space tokens, without expansion.
15113   */
15114  ;
15115
15116  _proto.consumeSpaces = function consumeSpaces() {
15117    for (;;) {
15118      var token = this.future();
15119
15120      if (token.text === " ") {
15121        this.stack.pop();
15122      } else {
15123        break;
15124      }
15125    }
15126  }
15127  /**
15128   * Consume the specified number of arguments from the token stream,
15129   * and return the resulting array of arguments.
15130   */
15131  ;
15132
15133  _proto.consumeArgs = function consumeArgs(numArgs) {
15134    var args = []; // obtain arguments, either single token or balanced {…} group
15135
15136    for (var i = 0; i < numArgs; ++i) {
15137      this.consumeSpaces(); // ignore spaces before each argument
15138
15139      var startOfArg = this.popToken();
15140
15141      if (startOfArg.text === "{") {
15142        var arg = [];
15143        var depth = 1;
15144
15145        while (depth !== 0) {
15146          var tok = this.popToken();
15147          arg.push(tok);
15148
15149          if (tok.text === "{") {
15150            ++depth;
15151          } else if (tok.text === "}") {
15152            --depth;
15153          } else if (tok.text === "EOF") {
15154            throw new src_ParseError("End of input in macro argument", startOfArg);
15155          }
15156        }
15157
15158        arg.pop(); // remove last }
15159
15160        arg.reverse(); // like above, to fit in with stack order
15161
15162        args[i] = arg;
15163      } else if (startOfArg.text === "EOF") {
15164        throw new src_ParseError("End of input expecting macro argument");
15165      } else {
15166        args[i] = [startOfArg];
15167      }
15168    }
15169
15170    return args;
15171  }
15172  /**
15173   * Expand the next token only once if possible.
15174   *
15175   * If the token is expanded, the resulting tokens will be pushed onto
15176   * the stack in reverse order and will be returned as an array,
15177   * also in reverse order.
15178   *
15179   * If not, the next token will be returned without removing it
15180   * from the stack.  This case can be detected by a `Token` return value
15181   * instead of an `Array` return value.
15182   *
15183   * In either case, the next token will be on the top of the stack,
15184   * or the stack will be empty.
15185   *
15186   * Used to implement `expandAfterFuture` and `expandNextToken`.
15187   *
15188   * At the moment, macro expansion doesn't handle delimited macros,
15189   * i.e. things like those defined by \def\foo#1\end{…}.
15190   * See the TeX book page 202ff. for details on how those should behave.
15191   */
15192  ;
15193
15194  _proto.expandOnce = function expandOnce() {
15195    var topToken = this.popToken();
15196    var name = topToken.text;
15197
15198    var expansion = this._getExpansion(name);
15199
15200    if (expansion == null) {
15201      // mainly checking for undefined here
15202      // Fully expanded
15203      this.pushToken(topToken);
15204      return topToken;
15205    }
15206
15207    this.expansionCount++;
15208
15209    if (this.expansionCount > this.settings.maxExpand) {
15210      throw new src_ParseError("Too many expansions: infinite loop or " + "need to increase maxExpand setting");
15211    }
15212
15213    var tokens = expansion.tokens;
15214
15215    if (expansion.numArgs) {
15216      var args = this.consumeArgs(expansion.numArgs); // paste arguments in place of the placeholders
15217
15218      tokens = tokens.slice(); // make a shallow copy
15219
15220      for (var i = tokens.length - 1; i >= 0; --i) {
15221        var tok = tokens[i];
15222
15223        if (tok.text === "#") {
15224          if (i === 0) {
15225            throw new src_ParseError("Incomplete placeholder at end of macro body", tok);
15226          }
15227
15228          tok = tokens[--i]; // next token on stack
15229
15230          if (tok.text === "#") {
15231            // ## → #
15232            tokens.splice(i + 1, 1); // drop first #
15233          } else if (/^[1-9]$/.test(tok.text)) {
15234            var _tokens;
15235
15236            // replace the placeholder with the indicated argument
15237            (_tokens = tokens).splice.apply(_tokens, [i, 2].concat(args[+tok.text - 1]));
15238          } else {
15239            throw new src_ParseError("Not a valid argument number", tok);
15240          }
15241        }
15242      }
15243    } // Concatenate expansion onto top of stack.
15244
15245
15246    this.pushTokens(tokens);
15247    return tokens;
15248  }
15249  /**
15250   * Expand the next token only once (if possible), and return the resulting
15251   * top token on the stack (without removing anything from the stack).
15252   * Similar in behavior to TeX's `\expandafter\futurelet`.
15253   * Equivalent to expandOnce() followed by future().
15254   */
15255  ;
15256
15257  _proto.expandAfterFuture = function expandAfterFuture() {
15258    this.expandOnce();
15259    return this.future();
15260  }
15261  /**
15262   * Recursively expand first token, then return first non-expandable token.
15263   */
15264  ;
15265
15266  _proto.expandNextToken = function expandNextToken() {
15267    for (;;) {
15268      var expanded = this.expandOnce(); // expandOnce returns Token if and only if it's fully expanded.
15269
15270      if (expanded instanceof Token_Token) {
15271        // \relax stops the expansion, but shouldn't get returned (a
15272        // null return value couldn't get implemented as a function).
15273        if (expanded.text === "\\relax") {
15274          this.stack.pop();
15275        } else {
15276          return this.stack.pop(); // === expanded
15277        }
15278      }
15279    } // Flow unable to figure out that this pathway is impossible.
15280    // https://github.com/facebook/flow/issues/4808
15281
15282
15283    throw new Error(); // eslint-disable-line no-unreachable
15284  }
15285  /**
15286   * Fully expand the given macro name and return the resulting list of
15287   * tokens, or return `undefined` if no such macro is defined.
15288   */
15289  ;
15290
15291  _proto.expandMacro = function expandMacro(name) {
15292    if (!this.macros.get(name)) {
15293      return undefined;
15294    }
15295
15296    var output = [];
15297    var oldStackLength = this.stack.length;
15298    this.pushToken(new Token_Token(name));
15299
15300    while (this.stack.length > oldStackLength) {
15301      var expanded = this.expandOnce(); // expandOnce returns Token if and only if it's fully expanded.
15302
15303      if (expanded instanceof Token_Token) {
15304        output.push(this.stack.pop());
15305      }
15306    }
15307
15308    return output;
15309  }
15310  /**
15311   * Fully expand the given macro name and return the result as a string,
15312   * or return `undefined` if no such macro is defined.
15313   */
15314  ;
15315
15316  _proto.expandMacroAsText = function expandMacroAsText(name) {
15317    var tokens = this.expandMacro(name);
15318
15319    if (tokens) {
15320      return tokens.map(function (token) {
15321        return token.text;
15322      }).join("");
15323    } else {
15324      return tokens;
15325    }
15326  }
15327  /**
15328   * Returns the expanded macro as a reversed array of tokens and a macro
15329   * argument count.  Or returns `null` if no such macro.
15330   */
15331  ;
15332
15333  _proto._getExpansion = function _getExpansion(name) {
15334    var definition = this.macros.get(name);
15335
15336    if (definition == null) {
15337      // mainly checking for undefined here
15338      return definition;
15339    }
15340
15341    var expansion = typeof definition === "function" ? definition(this) : definition;
15342
15343    if (typeof expansion === "string") {
15344      var numArgs = 0;
15345
15346      if (expansion.indexOf("#") !== -1) {
15347        var stripped = expansion.replace(/##/g, "");
15348
15349        while (stripped.indexOf("#" + (numArgs + 1)) !== -1) {
15350          ++numArgs;
15351        }
15352      }
15353
15354      var bodyLexer = new Lexer_Lexer(expansion, this.settings);
15355      var tokens = [];
15356      var tok = bodyLexer.lex();
15357
15358      while (tok.text !== "EOF") {
15359        tokens.push(tok);
15360        tok = bodyLexer.lex();
15361      }
15362
15363      tokens.reverse(); // to fit in with stack using push and pop
15364
15365      var expanded = {
15366        tokens: tokens,
15367        numArgs: numArgs
15368      };
15369      return expanded;
15370    }
15371
15372    return expansion;
15373  }
15374  /**
15375   * Determine whether a command is currently "defined" (has some
15376   * functionality), meaning that it's a macro (in the current group),
15377   * a function, a symbol, or one of the special commands listed in
15378   * `implicitCommands`.
15379   */
15380  ;
15381
15382  _proto.isDefined = function isDefined(name) {
15383    return this.macros.has(name) || src_functions.hasOwnProperty(name) || src_symbols.math.hasOwnProperty(name) || src_symbols.text.hasOwnProperty(name) || implicitCommands.hasOwnProperty(name);
15384  };
15385
15386  return MacroExpander;
15387}();
15388
15389
15390// CONCATENATED MODULE: ./src/unicodeAccents.js
15391// Mapping of Unicode accent characters to their LaTeX equivalent in text and
15392// math mode (when they exist).
15393/* harmony default export */ var unicodeAccents = ({
15394  "\u0301": {
15395    text: "\\'",
15396    math: '\\acute'
15397  },
15398  "\u0300": {
15399    text: '\\`',
15400    math: '\\grave'
15401  },
15402  "\u0308": {
15403    text: '\\"',
15404    math: '\\ddot'
15405  },
15406  "\u0303": {
15407    text: '\\~',
15408    math: '\\tilde'
15409  },
15410  "\u0304": {
15411    text: '\\=',
15412    math: '\\bar'
15413  },
15414  "\u0306": {
15415    text: "\\u",
15416    math: '\\breve'
15417  },
15418  "\u030C": {
15419    text: '\\v',
15420    math: '\\check'
15421  },
15422  "\u0302": {
15423    text: '\\^',
15424    math: '\\hat'
15425  },
15426  "\u0307": {
15427    text: '\\.',
15428    math: '\\dot'
15429  },
15430  "\u030A": {
15431    text: '\\r',
15432    math: '\\mathring'
15433  },
15434  "\u030B": {
15435    text: '\\H'
15436  }
15437});
15438// CONCATENATED MODULE: ./src/unicodeSymbols.js
15439// This file is GENERATED by unicodeMake.js. DO NOT MODIFY.
15440/* harmony default export */ var unicodeSymbols = ({
15441  "\xE1": "a\u0301",
15442  // á = \'{a}
15443  "\xE0": "a\u0300",
15444  // à = \`{a}
15445  "\xE4": "a\u0308",
15446  // ä = \"{a}
15447  "\u01DF": "a\u0308\u0304",
15448  // ǟ = \"\={a}
15449  "\xE3": "a\u0303",
15450  // ã = \~{a}
15451  "\u0101": "a\u0304",
15452  // ā = \={a}
15453  "\u0103": "a\u0306",
15454  // ă = \u{a}
15455  "\u1EAF": "a\u0306\u0301",
15456  // ắ = \u\'{a}
15457  "\u1EB1": "a\u0306\u0300",
15458  // ằ = \u\`{a}
15459  "\u1EB5": "a\u0306\u0303",
15460  // ẵ = \u\~{a}
15461  "\u01CE": "a\u030C",
15462  // ǎ = \v{a}
15463  "\xE2": "a\u0302",
15464  // â = \^{a}
15465  "\u1EA5": "a\u0302\u0301",
15466  // ấ = \^\'{a}
15467  "\u1EA7": "a\u0302\u0300",
15468  // ầ = \^\`{a}
15469  "\u1EAB": "a\u0302\u0303",
15470  // ẫ = \^\~{a}
15471  "\u0227": "a\u0307",
15472  // ȧ = \.{a}
15473  "\u01E1": "a\u0307\u0304",
15474  // ǡ = \.\={a}
15475  "\xE5": "a\u030A",
15476  // å = \r{a}
15477  "\u01FB": "a\u030A\u0301",
15478  // ǻ = \r\'{a}
15479  "\u1E03": "b\u0307",
15480  // ḃ = \.{b}
15481  "\u0107": "c\u0301",
15482  // ć = \'{c}
15483  "\u010D": "c\u030C",
15484  // č = \v{c}
15485  "\u0109": "c\u0302",
15486  // ĉ = \^{c}
15487  "\u010B": "c\u0307",
15488  // ċ = \.{c}
15489  "\u010F": "d\u030C",
15490  // ď = \v{d}
15491  "\u1E0B": "d\u0307",
15492  // ḋ = \.{d}
15493  "\xE9": "e\u0301",
15494  // é = \'{e}
15495  "\xE8": "e\u0300",
15496  // è = \`{e}
15497  "\xEB": "e\u0308",
15498  // ë = \"{e}
15499  "\u1EBD": "e\u0303",
15500  // ẽ = \~{e}
15501  "\u0113": "e\u0304",
15502  // ē = \={e}
15503  "\u1E17": "e\u0304\u0301",
15504  // ḗ = \=\'{e}
15505  "\u1E15": "e\u0304\u0300",
15506  // ḕ = \=\`{e}
15507  "\u0115": "e\u0306",
15508  // ĕ = \u{e}
15509  "\u011B": "e\u030C",
15510  // ě = \v{e}
15511  "\xEA": "e\u0302",
15512  // ê = \^{e}
15513  "\u1EBF": "e\u0302\u0301",
15514  // ế = \^\'{e}
15515  "\u1EC1": "e\u0302\u0300",
15516  // ề = \^\`{e}
15517  "\u1EC5": "e\u0302\u0303",
15518  // ễ = \^\~{e}
15519  "\u0117": "e\u0307",
15520  // ė = \.{e}
15521  "\u1E1F": "f\u0307",
15522  // ḟ = \.{f}
15523  "\u01F5": "g\u0301",
15524  // ǵ = \'{g}
15525  "\u1E21": "g\u0304",
15526  // ḡ = \={g}
15527  "\u011F": "g\u0306",
15528  // ğ = \u{g}
15529  "\u01E7": "g\u030C",
15530  // ǧ = \v{g}
15531  "\u011D": "g\u0302",
15532  // ĝ = \^{g}
15533  "\u0121": "g\u0307",
15534  // ġ = \.{g}
15535  "\u1E27": "h\u0308",
15536  // ḧ = \"{h}
15537  "\u021F": "h\u030C",
15538  // ȟ = \v{h}
15539  "\u0125": "h\u0302",
15540  // ĥ = \^{h}
15541  "\u1E23": "h\u0307",
15542  // ḣ = \.{h}
15543  "\xED": "i\u0301",
15544  // í = \'{i}
15545  "\xEC": "i\u0300",
15546  // ì = \`{i}
15547  "\xEF": "i\u0308",
15548  // ï = \"{i}
15549  "\u1E2F": "i\u0308\u0301",
15550  // ḯ = \"\'{i}
15551  "\u0129": "i\u0303",
15552  // ĩ = \~{i}
15553  "\u012B": "i\u0304",
15554  // ī = \={i}
15555  "\u012D": "i\u0306",
15556  // ĭ = \u{i}
15557  "\u01D0": "i\u030C",
15558  // ǐ = \v{i}
15559  "\xEE": "i\u0302",
15560  // î = \^{i}
15561  "\u01F0": "j\u030C",
15562  // ǰ = \v{j}
15563  "\u0135": "j\u0302",
15564  // ĵ = \^{j}
15565  "\u1E31": "k\u0301",
15566  // ḱ = \'{k}
15567  "\u01E9": "k\u030C",
15568  // ǩ = \v{k}
15569  "\u013A": "l\u0301",
15570  // ĺ = \'{l}
15571  "\u013E": "l\u030C",
15572  // ľ = \v{l}
15573  "\u1E3F": "m\u0301",
15574  // ḿ = \'{m}
15575  "\u1E41": "m\u0307",
15576  // ṁ = \.{m}
15577  "\u0144": "n\u0301",
15578  // ń = \'{n}
15579  "\u01F9": "n\u0300",
15580  // ǹ = \`{n}
15581  "\xF1": "n\u0303",
15582  // ñ = \~{n}
15583  "\u0148": "n\u030C",
15584  // ň = \v{n}
15585  "\u1E45": "n\u0307",
15586  // ṅ = \.{n}
15587  "\xF3": "o\u0301",
15588  // ó = \'{o}
15589  "\xF2": "o\u0300",
15590  // ò = \`{o}
15591  "\xF6": "o\u0308",
15592  // ö = \"{o}
15593  "\u022B": "o\u0308\u0304",
15594  // ȫ = \"\={o}
15595  "\xF5": "o\u0303",
15596  // õ = \~{o}
15597  "\u1E4D": "o\u0303\u0301",
15598  // ṍ = \~\'{o}
15599  "\u1E4F": "o\u0303\u0308",
15600  // ṏ = \~\"{o}
15601  "\u022D": "o\u0303\u0304",
15602  // ȭ = \~\={o}
15603  "\u014D": "o\u0304",
15604  // ō = \={o}
15605  "\u1E53": "o\u0304\u0301",
15606  // ṓ = \=\'{o}
15607  "\u1E51": "o\u0304\u0300",
15608  // ṑ = \=\`{o}
15609  "\u014F": "o\u0306",
15610  // ŏ = \u{o}
15611  "\u01D2": "o\u030C",
15612  // ǒ = \v{o}
15613  "\xF4": "o\u0302",
15614  // ô = \^{o}
15615  "\u1ED1": "o\u0302\u0301",
15616  // ố = \^\'{o}
15617  "\u1ED3": "o\u0302\u0300",
15618  // ồ = \^\`{o}
15619  "\u1ED7": "o\u0302\u0303",
15620  // ỗ = \^\~{o}
15621  "\u022F": "o\u0307",
15622  // ȯ = \.{o}
15623  "\u0231": "o\u0307\u0304",
15624  // ȱ = \.\={o}
15625  "\u0151": "o\u030B",
15626  // ő = \H{o}
15627  "\u1E55": "p\u0301",
15628  // ṕ = \'{p}
15629  "\u1E57": "p\u0307",
15630  // ṗ = \.{p}
15631  "\u0155": "r\u0301",
15632  // ŕ = \'{r}
15633  "\u0159": "r\u030C",
15634  // ř = \v{r}
15635  "\u1E59": "r\u0307",
15636  // ṙ = \.{r}
15637  "\u015B": "s\u0301",
15638  // ś = \'{s}
15639  "\u1E65": "s\u0301\u0307",
15640  // ṥ = \'\.{s}
15641  "\u0161": "s\u030C",
15642  // š = \v{s}
15643  "\u1E67": "s\u030C\u0307",
15644  // ṧ = \v\.{s}
15645  "\u015D": "s\u0302",
15646  // ŝ = \^{s}
15647  "\u1E61": "s\u0307",
15648  // ṡ = \.{s}
15649  "\u1E97": "t\u0308",
15650  // ẗ = \"{t}
15651  "\u0165": "t\u030C",
15652  // ť = \v{t}
15653  "\u1E6B": "t\u0307",
15654  // ṫ = \.{t}
15655  "\xFA": "u\u0301",
15656  // ú = \'{u}
15657  "\xF9": "u\u0300",
15658  // ù = \`{u}
15659  "\xFC": "u\u0308",
15660  // ü = \"{u}
15661  "\u01D8": "u\u0308\u0301",
15662  // ǘ = \"\'{u}
15663  "\u01DC": "u\u0308\u0300",
15664  // ǜ = \"\`{u}
15665  "\u01D6": "u\u0308\u0304",
15666  // ǖ = \"\={u}
15667  "\u01DA": "u\u0308\u030C",
15668  // ǚ = \"\v{u}
15669  "\u0169": "u\u0303",
15670  // ũ = \~{u}
15671  "\u1E79": "u\u0303\u0301",
15672  // ṹ = \~\'{u}
15673  "\u016B": "u\u0304",
15674  // ū = \={u}
15675  "\u1E7B": "u\u0304\u0308",
15676  // ṻ = \=\"{u}
15677  "\u016D": "u\u0306",
15678  // ŭ = \u{u}
15679  "\u01D4": "u\u030C",
15680  // ǔ = \v{u}
15681  "\xFB": "u\u0302",
15682  // û = \^{u}
15683  "\u016F": "u\u030A",
15684  // ů = \r{u}
15685  "\u0171": "u\u030B",
15686  // ű = \H{u}
15687  "\u1E7D": "v\u0303",
15688  // ṽ = \~{v}
15689  "\u1E83": "w\u0301",
15690  // ẃ = \'{w}
15691  "\u1E81": "w\u0300",
15692  // ẁ = \`{w}
15693  "\u1E85": "w\u0308",
15694  // ẅ = \"{w}
15695  "\u0175": "w\u0302",
15696  // ŵ = \^{w}
15697  "\u1E87": "w\u0307",
15698  // ẇ = \.{w}
15699  "\u1E98": "w\u030A",
15700  // ẘ = \r{w}
15701  "\u1E8D": "x\u0308",
15702  // ẍ = \"{x}
15703  "\u1E8B": "x\u0307",
15704  // ẋ = \.{x}
15705  "\xFD": "y\u0301",
15706  // ý = \'{y}
15707  "\u1EF3": "y\u0300",
15708  // ỳ = \`{y}
15709  "\xFF": "y\u0308",
15710  // ÿ = \"{y}
15711  "\u1EF9": "y\u0303",
15712  // ỹ = \~{y}
15713  "\u0233": "y\u0304",
15714  // ȳ = \={y}
15715  "\u0177": "y\u0302",
15716  // ŷ = \^{y}
15717  "\u1E8F": "y\u0307",
15718  // ẏ = \.{y}
15719  "\u1E99": "y\u030A",
15720  // ẙ = \r{y}
15721  "\u017A": "z\u0301",
15722  // ź = \'{z}
15723  "\u017E": "z\u030C",
15724  // ž = \v{z}
15725  "\u1E91": "z\u0302",
15726  // ẑ = \^{z}
15727  "\u017C": "z\u0307",
15728  // ż = \.{z}
15729  "\xC1": "A\u0301",
15730  // Á = \'{A}
15731  "\xC0": "A\u0300",
15732  // À = \`{A}
15733  "\xC4": "A\u0308",
15734  // Ä = \"{A}
15735  "\u01DE": "A\u0308\u0304",
15736  // Ǟ = \"\={A}
15737  "\xC3": "A\u0303",
15738  // Ã = \~{A}
15739  "\u0100": "A\u0304",
15740  // Ā = \={A}
15741  "\u0102": "A\u0306",
15742  // Ă = \u{A}
15743  "\u1EAE": "A\u0306\u0301",
15744  // Ắ = \u\'{A}
15745  "\u1EB0": "A\u0306\u0300",
15746  // Ằ = \u\`{A}
15747  "\u1EB4": "A\u0306\u0303",
15748  // Ẵ = \u\~{A}
15749  "\u01CD": "A\u030C",
15750  // Ǎ = \v{A}
15751  "\xC2": "A\u0302",
15752  // Â = \^{A}
15753  "\u1EA4": "A\u0302\u0301",
15754  // Ấ = \^\'{A}
15755  "\u1EA6": "A\u0302\u0300",
15756  // Ầ = \^\`{A}
15757  "\u1EAA": "A\u0302\u0303",
15758  // Ẫ = \^\~{A}
15759  "\u0226": "A\u0307",
15760  // Ȧ = \.{A}
15761  "\u01E0": "A\u0307\u0304",
15762  // Ǡ = \.\={A}
15763  "\xC5": "A\u030A",
15764  // Å = \r{A}
15765  "\u01FA": "A\u030A\u0301",
15766  // Ǻ = \r\'{A}
15767  "\u1E02": "B\u0307",
15768  // Ḃ = \.{B}
15769  "\u0106": "C\u0301",
15770  // Ć = \'{C}
15771  "\u010C": "C\u030C",
15772  // Č = \v{C}
15773  "\u0108": "C\u0302",
15774  // Ĉ = \^{C}
15775  "\u010A": "C\u0307",
15776  // Ċ = \.{C}
15777  "\u010E": "D\u030C",
15778  // Ď = \v{D}
15779  "\u1E0A": "D\u0307",
15780  // Ḋ = \.{D}
15781  "\xC9": "E\u0301",
15782  // É = \'{E}
15783  "\xC8": "E\u0300",
15784  // È = \`{E}
15785  "\xCB": "E\u0308",
15786  // Ë = \"{E}
15787  "\u1EBC": "E\u0303",
15788  // Ẽ = \~{E}
15789  "\u0112": "E\u0304",
15790  // Ē = \={E}
15791  "\u1E16": "E\u0304\u0301",
15792  // Ḗ = \=\'{E}
15793  "\u1E14": "E\u0304\u0300",
15794  // Ḕ = \=\`{E}
15795  "\u0114": "E\u0306",
15796  // Ĕ = \u{E}
15797  "\u011A": "E\u030C",
15798  // Ě = \v{E}
15799  "\xCA": "E\u0302",
15800  // Ê = \^{E}
15801  "\u1EBE": "E\u0302\u0301",
15802  // Ế = \^\'{E}
15803  "\u1EC0": "E\u0302\u0300",
15804  // Ề = \^\`{E}
15805  "\u1EC4": "E\u0302\u0303",
15806  // Ễ = \^\~{E}
15807  "\u0116": "E\u0307",
15808  // Ė = \.{E}
15809  "\u1E1E": "F\u0307",
15810  // Ḟ = \.{F}
15811  "\u01F4": "G\u0301",
15812  // Ǵ = \'{G}
15813  "\u1E20": "G\u0304",
15814  // Ḡ = \={G}
15815  "\u011E": "G\u0306",
15816  // Ğ = \u{G}
15817  "\u01E6": "G\u030C",
15818  // Ǧ = \v{G}
15819  "\u011C": "G\u0302",
15820  // Ĝ = \^{G}
15821  "\u0120": "G\u0307",
15822  // Ġ = \.{G}
15823  "\u1E26": "H\u0308",
15824  // Ḧ = \"{H}
15825  "\u021E": "H\u030C",
15826  // Ȟ = \v{H}
15827  "\u0124": "H\u0302",
15828  // Ĥ = \^{H}
15829  "\u1E22": "H\u0307",
15830  // Ḣ = \.{H}
15831  "\xCD": "I\u0301",
15832  // Í = \'{I}
15833  "\xCC": "I\u0300",
15834  // Ì = \`{I}
15835  "\xCF": "I\u0308",
15836  // Ï = \"{I}
15837  "\u1E2E": "I\u0308\u0301",
15838  // Ḯ = \"\'{I}
15839  "\u0128": "I\u0303",
15840  // Ĩ = \~{I}
15841  "\u012A": "I\u0304",
15842  // Ī = \={I}
15843  "\u012C": "I\u0306",
15844  // Ĭ = \u{I}
15845  "\u01CF": "I\u030C",
15846  // Ǐ = \v{I}
15847  "\xCE": "I\u0302",
15848  // Î = \^{I}
15849  "\u0130": "I\u0307",
15850  // İ = \.{I}
15851  "\u0134": "J\u0302",
15852  // Ĵ = \^{J}
15853  "\u1E30": "K\u0301",
15854  // Ḱ = \'{K}
15855  "\u01E8": "K\u030C",
15856  // Ǩ = \v{K}
15857  "\u0139": "L\u0301",
15858  // Ĺ = \'{L}
15859  "\u013D": "L\u030C",
15860  // Ľ = \v{L}
15861  "\u1E3E": "M\u0301",
15862  // Ḿ = \'{M}
15863  "\u1E40": "M\u0307",
15864  // Ṁ = \.{M}
15865  "\u0143": "N\u0301",
15866  // Ń = \'{N}
15867  "\u01F8": "N\u0300",
15868  // Ǹ = \`{N}
15869  "\xD1": "N\u0303",
15870  // Ñ = \~{N}
15871  "\u0147": "N\u030C",
15872  // Ň = \v{N}
15873  "\u1E44": "N\u0307",
15874  // Ṅ = \.{N}
15875  "\xD3": "O\u0301",
15876  // Ó = \'{O}
15877  "\xD2": "O\u0300",
15878  // Ò = \`{O}
15879  "\xD6": "O\u0308",
15880  // Ö = \"{O}
15881  "\u022A": "O\u0308\u0304",
15882  // Ȫ = \"\={O}
15883  "\xD5": "O\u0303",
15884  // Õ = \~{O}
15885  "\u1E4C": "O\u0303\u0301",
15886  // Ṍ = \~\'{O}
15887  "\u1E4E": "O\u0303\u0308",
15888  // Ṏ = \~\"{O}
15889  "\u022C": "O\u0303\u0304",
15890  // Ȭ = \~\={O}
15891  "\u014C": "O\u0304",
15892  // Ō = \={O}
15893  "\u1E52": "O\u0304\u0301",
15894  // Ṓ = \=\'{O}
15895  "\u1E50": "O\u0304\u0300",
15896  // Ṑ = \=\`{O}
15897  "\u014E": "O\u0306",
15898  // Ŏ = \u{O}
15899  "\u01D1": "O\u030C",
15900  // Ǒ = \v{O}
15901  "\xD4": "O\u0302",
15902  // Ô = \^{O}
15903  "\u1ED0": "O\u0302\u0301",
15904  // Ố = \^\'{O}
15905  "\u1ED2": "O\u0302\u0300",
15906  // Ồ = \^\`{O}
15907  "\u1ED6": "O\u0302\u0303",
15908  // Ỗ = \^\~{O}
15909  "\u022E": "O\u0307",
15910  // Ȯ = \.{O}
15911  "\u0230": "O\u0307\u0304",
15912  // Ȱ = \.\={O}
15913  "\u0150": "O\u030B",
15914  // Ő = \H{O}
15915  "\u1E54": "P\u0301",
15916  // Ṕ = \'{P}
15917  "\u1E56": "P\u0307",
15918  // Ṗ = \.{P}
15919  "\u0154": "R\u0301",
15920  // Ŕ = \'{R}
15921  "\u0158": "R\u030C",
15922  // Ř = \v{R}
15923  "\u1E58": "R\u0307",
15924  // Ṙ = \.{R}
15925  "\u015A": "S\u0301",
15926  // Ś = \'{S}
15927  "\u1E64": "S\u0301\u0307",
15928  // Ṥ = \'\.{S}
15929  "\u0160": "S\u030C",
15930  // Š = \v{S}
15931  "\u1E66": "S\u030C\u0307",
15932  // Ṧ = \v\.{S}
15933  "\u015C": "S\u0302",
15934  // Ŝ = \^{S}
15935  "\u1E60": "S\u0307",
15936  // Ṡ = \.{S}
15937  "\u0164": "T\u030C",
15938  // Ť = \v{T}
15939  "\u1E6A": "T\u0307",
15940  // Ṫ = \.{T}
15941  "\xDA": "U\u0301",
15942  // Ú = \'{U}
15943  "\xD9": "U\u0300",
15944  // Ù = \`{U}
15945  "\xDC": "U\u0308",
15946  // Ü = \"{U}
15947  "\u01D7": "U\u0308\u0301",
15948  // Ǘ = \"\'{U}
15949  "\u01DB": "U\u0308\u0300",
15950  // Ǜ = \"\`{U}
15951  "\u01D5": "U\u0308\u0304",
15952  // Ǖ = \"\={U}
15953  "\u01D9": "U\u0308\u030C",
15954  // Ǚ = \"\v{U}
15955  "\u0168": "U\u0303",
15956  // Ũ = \~{U}
15957  "\u1E78": "U\u0303\u0301",
15958  // Ṹ = \~\'{U}
15959  "\u016A": "U\u0304",
15960  // Ū = \={U}
15961  "\u1E7A": "U\u0304\u0308",
15962  // Ṻ = \=\"{U}
15963  "\u016C": "U\u0306",
15964  // Ŭ = \u{U}
15965  "\u01D3": "U\u030C",
15966  // Ǔ = \v{U}
15967  "\xDB": "U\u0302",
15968  // Û = \^{U}
15969  "\u016E": "U\u030A",
15970  // Ů = \r{U}
15971  "\u0170": "U\u030B",
15972  // Ű = \H{U}
15973  "\u1E7C": "V\u0303",
15974  // Ṽ = \~{V}
15975  "\u1E82": "W\u0301",
15976  // Ẃ = \'{W}
15977  "\u1E80": "W\u0300",
15978  // Ẁ = \`{W}
15979  "\u1E84": "W\u0308",
15980  // Ẅ = \"{W}
15981  "\u0174": "W\u0302",
15982  // Ŵ = \^{W}
15983  "\u1E86": "W\u0307",
15984  // Ẇ = \.{W}
15985  "\u1E8C": "X\u0308",
15986  // Ẍ = \"{X}
15987  "\u1E8A": "X\u0307",
15988  // Ẋ = \.{X}
15989  "\xDD": "Y\u0301",
15990  // Ý = \'{Y}
15991  "\u1EF2": "Y\u0300",
15992  // Ỳ = \`{Y}
15993  "\u0178": "Y\u0308",
15994  // Ÿ = \"{Y}
15995  "\u1EF8": "Y\u0303",
15996  // Ỹ = \~{Y}
15997  "\u0232": "Y\u0304",
15998  // Ȳ = \={Y}
15999  "\u0176": "Y\u0302",
16000  // Ŷ = \^{Y}
16001  "\u1E8E": "Y\u0307",
16002  // Ẏ = \.{Y}
16003  "\u0179": "Z\u0301",
16004  // Ź = \'{Z}
16005  "\u017D": "Z\u030C",
16006  // Ž = \v{Z}
16007  "\u1E90": "Z\u0302",
16008  // Ẑ = \^{Z}
16009  "\u017B": "Z\u0307",
16010  // Ż = \.{Z}
16011  "\u03AC": "\u03B1\u0301",
16012  // ά = \'{α}
16013  "\u1F70": "\u03B1\u0300",
16014  // ὰ = \`{α}
16015  "\u1FB1": "\u03B1\u0304",
16016  // ᾱ = \={α}
16017  "\u1FB0": "\u03B1\u0306",
16018  // ᾰ = \u{α}
16019  "\u03AD": "\u03B5\u0301",
16020  // έ = \'{ε}
16021  "\u1F72": "\u03B5\u0300",
16022  // ὲ = \`{ε}
16023  "\u03AE": "\u03B7\u0301",
16024  // ή = \'{η}
16025  "\u1F74": "\u03B7\u0300",
16026  // ὴ = \`{η}
16027  "\u03AF": "\u03B9\u0301",
16028  // ί = \'{ι}
16029  "\u1F76": "\u03B9\u0300",
16030  // ὶ = \`{ι}
16031  "\u03CA": "\u03B9\u0308",
16032  // ϊ = \"{ι}
16033  "\u0390": "\u03B9\u0308\u0301",
16034  // ΐ = \"\'{ι}
16035  "\u1FD2": "\u03B9\u0308\u0300",
16036  // ῒ = \"\`{ι}
16037  "\u1FD1": "\u03B9\u0304",
16038  // ῑ = \={ι}
16039  "\u1FD0": "\u03B9\u0306",
16040  // ῐ = \u{ι}
16041  "\u03CC": "\u03BF\u0301",
16042  // ό = \'{ο}
16043  "\u1F78": "\u03BF\u0300",
16044  // ὸ = \`{ο}
16045  "\u03CD": "\u03C5\u0301",
16046  // ύ = \'{υ}
16047  "\u1F7A": "\u03C5\u0300",
16048  // ὺ = \`{υ}
16049  "\u03CB": "\u03C5\u0308",
16050  // ϋ = \"{υ}
16051  "\u03B0": "\u03C5\u0308\u0301",
16052  // ΰ = \"\'{υ}
16053  "\u1FE2": "\u03C5\u0308\u0300",
16054  // ῢ = \"\`{υ}
16055  "\u1FE1": "\u03C5\u0304",
16056  // ῡ = \={υ}
16057  "\u1FE0": "\u03C5\u0306",
16058  // ῠ = \u{υ}
16059  "\u03CE": "\u03C9\u0301",
16060  // ώ = \'{ω}
16061  "\u1F7C": "\u03C9\u0300",
16062  // ὼ = \`{ω}
16063  "\u038E": "\u03A5\u0301",
16064  // Ύ = \'{Υ}
16065  "\u1FEA": "\u03A5\u0300",
16066  // Ὺ = \`{Υ}
16067  "\u03AB": "\u03A5\u0308",
16068  // Ϋ = \"{Υ}
16069  "\u1FE9": "\u03A5\u0304",
16070  // Ῡ = \={Υ}
16071  "\u1FE8": "\u03A5\u0306",
16072  // Ῠ = \u{Υ}
16073  "\u038F": "\u03A9\u0301",
16074  // Ώ = \'{Ω}
16075  "\u1FFA": "\u03A9\u0300" // Ὼ = \`{Ω}
16076
16077});
16078// CONCATENATED MODULE: ./src/Parser.js
16079/* eslint no-constant-condition:0 */
16080
16081
16082
16083
16084
16085
16086
16087
16088
16089
16090
16091
16092
16093
16094/**
16095 * This file contains the parser used to parse out a TeX expression from the
16096 * input. Since TeX isn't context-free, standard parsers don't work particularly
16097 * well.
16098 *
16099 * The strategy of this parser is as such:
16100 *
16101 * The main functions (the `.parse...` ones) take a position in the current
16102 * parse string to parse tokens from. The lexer (found in Lexer.js, stored at
16103 * this.gullet.lexer) also supports pulling out tokens at arbitrary places. When
16104 * individual tokens are needed at a position, the lexer is called to pull out a
16105 * token, which is then used.
16106 *
16107 * The parser has a property called "mode" indicating the mode that
16108 * the parser is currently in. Currently it has to be one of "math" or
16109 * "text", which denotes whether the current environment is a math-y
16110 * one or a text-y one (e.g. inside \text). Currently, this serves to
16111 * limit the functions which can be used in text mode.
16112 *
16113 * The main functions then return an object which contains the useful data that
16114 * was parsed at its given point, and a new position at the end of the parsed
16115 * data. The main functions can call each other and continue the parsing by
16116 * using the returned position as a new starting point.
16117 *
16118 * There are also extra `.handle...` functions, which pull out some reused
16119 * functionality into self-contained functions.
16120 *
16121 * The functions return ParseNodes.
16122 */
16123var Parser_Parser =
16124/*#__PURE__*/
16125function () {
16126  function Parser(input, settings) {
16127    this.mode = void 0;
16128    this.gullet = void 0;
16129    this.settings = void 0;
16130    this.leftrightDepth = void 0;
16131    this.nextToken = void 0;
16132    // Start in math mode
16133    this.mode = "math"; // Create a new macro expander (gullet) and (indirectly via that) also a
16134    // new lexer (mouth) for this parser (stomach, in the language of TeX)
16135
16136    this.gullet = new MacroExpander_MacroExpander(input, settings, this.mode); // Store the settings for use in parsing
16137
16138    this.settings = settings; // Count leftright depth (for \middle errors)
16139
16140    this.leftrightDepth = 0;
16141  }
16142  /**
16143   * Checks a result to make sure it has the right type, and throws an
16144   * appropriate error otherwise.
16145   */
16146
16147
16148  var _proto = Parser.prototype;
16149
16150  _proto.expect = function expect(text, consume) {
16151    if (consume === void 0) {
16152      consume = true;
16153    }
16154
16155    if (this.fetch().text !== text) {
16156      throw new src_ParseError("Expected '" + text + "', got '" + this.fetch().text + "'", this.fetch());
16157    }
16158
16159    if (consume) {
16160      this.consume();
16161    }
16162  }
16163  /**
16164   * Discards the current lookahead token, considering it consumed.
16165   */
16166  ;
16167
16168  _proto.consume = function consume() {
16169    this.nextToken = null;
16170  }
16171  /**
16172   * Return the current lookahead token, or if there isn't one (at the
16173   * beginning, or if the previous lookahead token was consume()d),
16174   * fetch the next token as the new lookahead token and return it.
16175   */
16176  ;
16177
16178  _proto.fetch = function fetch() {
16179    if (this.nextToken == null) {
16180      this.nextToken = this.gullet.expandNextToken();
16181    }
16182
16183    return this.nextToken;
16184  }
16185  /**
16186   * Switches between "text" and "math" modes.
16187   */
16188  ;
16189
16190  _proto.switchMode = function switchMode(newMode) {
16191    this.mode = newMode;
16192    this.gullet.switchMode(newMode);
16193  }
16194  /**
16195   * Main parsing function, which parses an entire input.
16196   */
16197  ;
16198
16199  _proto.parse = function parse() {
16200    // Create a group namespace for the math expression.
16201    // (LaTeX creates a new group for every $...$, $$...$$, \[...\].)
16202    this.gullet.beginGroup(); // Use old \color behavior (same as LaTeX's \textcolor) if requested.
16203    // We do this within the group for the math expression, so it doesn't
16204    // pollute settings.macros.
16205
16206    if (this.settings.colorIsTextColor) {
16207      this.gullet.macros.set("\\color", "\\textcolor");
16208    } // Try to parse the input
16209
16210
16211    var parse = this.parseExpression(false); // If we succeeded, make sure there's an EOF at the end
16212
16213    this.expect("EOF"); // End the group namespace for the expression
16214
16215    this.gullet.endGroup();
16216    return parse;
16217  };
16218
16219  _proto.parseExpression = function parseExpression(breakOnInfix, breakOnTokenText) {
16220    var body = []; // Keep adding atoms to the body until we can't parse any more atoms (either
16221    // we reached the end, a }, or a \right)
16222
16223    while (true) {
16224      // Ignore spaces in math mode
16225      if (this.mode === "math") {
16226        this.consumeSpaces();
16227      }
16228
16229      var lex = this.fetch();
16230
16231      if (Parser.endOfExpression.indexOf(lex.text) !== -1) {
16232        break;
16233      }
16234
16235      if (breakOnTokenText && lex.text === breakOnTokenText) {
16236        break;
16237      }
16238
16239      if (breakOnInfix && src_functions[lex.text] && src_functions[lex.text].infix) {
16240        break;
16241      }
16242
16243      var atom = this.parseAtom(breakOnTokenText);
16244
16245      if (!atom) {
16246        break;
16247      }
16248
16249      body.push(atom);
16250    }
16251
16252    if (this.mode === "text") {
16253      this.formLigatures(body);
16254    }
16255
16256    return this.handleInfixNodes(body);
16257  }
16258  /**
16259   * Rewrites infix operators such as \over with corresponding commands such
16260   * as \frac.
16261   *
16262   * There can only be one infix operator per group.  If there's more than one
16263   * then the expression is ambiguous.  This can be resolved by adding {}.
16264   */
16265  ;
16266
16267  _proto.handleInfixNodes = function handleInfixNodes(body) {
16268    var overIndex = -1;
16269    var funcName;
16270
16271    for (var i = 0; i < body.length; i++) {
16272      var node = checkNodeType(body[i], "infix");
16273
16274      if (node) {
16275        if (overIndex !== -1) {
16276          throw new src_ParseError("only one infix operator per group", node.token);
16277        }
16278
16279        overIndex = i;
16280        funcName = node.replaceWith;
16281      }
16282    }
16283
16284    if (overIndex !== -1 && funcName) {
16285      var numerNode;
16286      var denomNode;
16287      var numerBody = body.slice(0, overIndex);
16288      var denomBody = body.slice(overIndex + 1);
16289
16290      if (numerBody.length === 1 && numerBody[0].type === "ordgroup") {
16291        numerNode = numerBody[0];
16292      } else {
16293        numerNode = {
16294          type: "ordgroup",
16295          mode: this.mode,
16296          body: numerBody
16297        };
16298      }
16299
16300      if (denomBody.length === 1 && denomBody[0].type === "ordgroup") {
16301        denomNode = denomBody[0];
16302      } else {
16303        denomNode = {
16304          type: "ordgroup",
16305          mode: this.mode,
16306          body: denomBody
16307        };
16308      }
16309
16310      var _node;
16311
16312      if (funcName === "\\\\abovefrac") {
16313        _node = this.callFunction(funcName, [numerNode, body[overIndex], denomNode], []);
16314      } else {
16315        _node = this.callFunction(funcName, [numerNode, denomNode], []);
16316      }
16317
16318      return [_node];
16319    } else {
16320      return body;
16321    }
16322  } // The greediness of a superscript or subscript
16323  ;
16324
16325  /**
16326   * Handle a subscript or superscript with nice errors.
16327   */
16328  _proto.handleSupSubscript = function handleSupSubscript(name) {
16329    var symbolToken = this.fetch();
16330    var symbol = symbolToken.text;
16331    this.consume();
16332    var group = this.parseGroup(name, false, Parser.SUPSUB_GREEDINESS, undefined, undefined, true); // ignore spaces before sup/subscript argument
16333
16334    if (!group) {
16335      throw new src_ParseError("Expected group after '" + symbol + "'", symbolToken);
16336    }
16337
16338    return group;
16339  }
16340  /**
16341   * Converts the textual input of an unsupported command into a text node
16342   * contained within a color node whose color is determined by errorColor
16343   */
16344  ;
16345
16346  _proto.formatUnsupportedCmd = function formatUnsupportedCmd(text) {
16347    var textordArray = [];
16348
16349    for (var i = 0; i < text.length; i++) {
16350      textordArray.push({
16351        type: "textord",
16352        mode: "text",
16353        text: text[i]
16354      });
16355    }
16356
16357    var textNode = {
16358      type: "text",
16359      mode: this.mode,
16360      body: textordArray
16361    };
16362    var colorNode = {
16363      type: "color",
16364      mode: this.mode,
16365      color: this.settings.errorColor,
16366      body: [textNode]
16367    };
16368    return colorNode;
16369  }
16370  /**
16371   * Parses a group with optional super/subscripts.
16372   */
16373  ;
16374
16375  _proto.parseAtom = function parseAtom(breakOnTokenText) {
16376    // The body of an atom is an implicit group, so that things like
16377    // \left(x\right)^2 work correctly.
16378    var base = this.parseGroup("atom", false, null, breakOnTokenText); // In text mode, we don't have superscripts or subscripts
16379
16380    if (this.mode === "text") {
16381      return base;
16382    } // Note that base may be empty (i.e. null) at this point.
16383
16384
16385    var superscript;
16386    var subscript;
16387
16388    while (true) {
16389      // Guaranteed in math mode, so eat any spaces first.
16390      this.consumeSpaces(); // Lex the first token
16391
16392      var lex = this.fetch();
16393
16394      if (lex.text === "\\limits" || lex.text === "\\nolimits") {
16395        // We got a limit control
16396        var opNode = checkNodeType(base, "op");
16397
16398        if (opNode) {
16399          var limits = lex.text === "\\limits";
16400          opNode.limits = limits;
16401          opNode.alwaysHandleSupSub = true;
16402        } else {
16403          opNode = checkNodeType(base, "operatorname");
16404
16405          if (opNode && opNode.alwaysHandleSupSub) {
16406            var _limits = lex.text === "\\limits";
16407
16408            opNode.limits = _limits;
16409          } else {
16410            throw new src_ParseError("Limit controls must follow a math operator", lex);
16411          }
16412        }
16413
16414        this.consume();
16415      } else if (lex.text === "^") {
16416        // We got a superscript start
16417        if (superscript) {
16418          throw new src_ParseError("Double superscript", lex);
16419        }
16420
16421        superscript = this.handleSupSubscript("superscript");
16422      } else if (lex.text === "_") {
16423        // We got a subscript start
16424        if (subscript) {
16425          throw new src_ParseError("Double subscript", lex);
16426        }
16427
16428        subscript = this.handleSupSubscript("subscript");
16429      } else if (lex.text === "'") {
16430        // We got a prime
16431        if (superscript) {
16432          throw new src_ParseError("Double superscript", lex);
16433        }
16434
16435        var prime = {
16436          type: "textord",
16437          mode: this.mode,
16438          text: "\\prime"
16439        }; // Many primes can be grouped together, so we handle this here
16440
16441        var primes = [prime];
16442        this.consume(); // Keep lexing tokens until we get something that's not a prime
16443
16444        while (this.fetch().text === "'") {
16445          // For each one, add another prime to the list
16446          primes.push(prime);
16447          this.consume();
16448        } // If there's a superscript following the primes, combine that
16449        // superscript in with the primes.
16450
16451
16452        if (this.fetch().text === "^") {
16453          primes.push(this.handleSupSubscript("superscript"));
16454        } // Put everything into an ordgroup as the superscript
16455
16456
16457        superscript = {
16458          type: "ordgroup",
16459          mode: this.mode,
16460          body: primes
16461        };
16462      } else {
16463        // If it wasn't ^, _, or ', stop parsing super/subscripts
16464        break;
16465      }
16466    } // Base must be set if superscript or subscript are set per logic above,
16467    // but need to check here for type check to pass.
16468
16469
16470    if (superscript || subscript) {
16471      // If we got either a superscript or subscript, create a supsub
16472      return {
16473        type: "supsub",
16474        mode: this.mode,
16475        base: base,
16476        sup: superscript,
16477        sub: subscript
16478      };
16479    } else {
16480      // Otherwise return the original body
16481      return base;
16482    }
16483  }
16484  /**
16485   * Parses an entire function, including its base and all of its arguments.
16486   */
16487  ;
16488
16489  _proto.parseFunction = function parseFunction(breakOnTokenText, name, // For error reporting.
16490  greediness) {
16491    var token = this.fetch();
16492    var func = token.text;
16493    var funcData = src_functions[func];
16494
16495    if (!funcData) {
16496      return null;
16497    }
16498
16499    this.consume(); // consume command token
16500
16501    if (greediness != null && funcData.greediness <= greediness) {
16502      throw new src_ParseError("Got function '" + func + "' with no arguments" + (name ? " as " + name : ""), token);
16503    } else if (this.mode === "text" && !funcData.allowedInText) {
16504      throw new src_ParseError("Can't use function '" + func + "' in text mode", token);
16505    } else if (this.mode === "math" && funcData.allowedInMath === false) {
16506      throw new src_ParseError("Can't use function '" + func + "' in math mode", token);
16507    }
16508
16509    var _this$parseArguments = this.parseArguments(func, funcData),
16510        args = _this$parseArguments.args,
16511        optArgs = _this$parseArguments.optArgs;
16512
16513    return this.callFunction(func, args, optArgs, token, breakOnTokenText);
16514  }
16515  /**
16516   * Call a function handler with a suitable context and arguments.
16517   */
16518  ;
16519
16520  _proto.callFunction = function callFunction(name, args, optArgs, token, breakOnTokenText) {
16521    var context = {
16522      funcName: name,
16523      parser: this,
16524      token: token,
16525      breakOnTokenText: breakOnTokenText
16526    };
16527    var func = src_functions[name];
16528
16529    if (func && func.handler) {
16530      return func.handler(context, args, optArgs);
16531    } else {
16532      throw new src_ParseError("No function handler for " + name);
16533    }
16534  }
16535  /**
16536   * Parses the arguments of a function or environment
16537   */
16538  ;
16539
16540  _proto.parseArguments = function parseArguments(func, // Should look like "\name" or "\begin{name}".
16541  funcData) {
16542    var totalArgs = funcData.numArgs + funcData.numOptionalArgs;
16543
16544    if (totalArgs === 0) {
16545      return {
16546        args: [],
16547        optArgs: []
16548      };
16549    }
16550
16551    var baseGreediness = funcData.greediness;
16552    var args = [];
16553    var optArgs = [];
16554
16555    for (var i = 0; i < totalArgs; i++) {
16556      var argType = funcData.argTypes && funcData.argTypes[i];
16557      var isOptional = i < funcData.numOptionalArgs; // Ignore spaces between arguments.  As the TeXbook says:
16558      // "After you have said ‘\def\row#1#2{...}’, you are allowed to
16559      //  put spaces between the arguments (e.g., ‘\row x n’), because
16560      //  TeX doesn’t use single spaces as undelimited arguments."
16561
16562      var consumeSpaces = i > 0 && !isOptional || // Also consume leading spaces in math mode, as parseSymbol
16563      // won't know what to do with them.  This can only happen with
16564      // macros, e.g. \frac\foo\foo where \foo expands to a space symbol.
16565      // In LaTeX, the \foo's get treated as (blank) arguments.
16566      // In KaTeX, for now, both spaces will get consumed.
16567      // TODO(edemaine)
16568      i === 0 && !isOptional && this.mode === "math";
16569      var arg = this.parseGroupOfType("argument to '" + func + "'", argType, isOptional, baseGreediness, consumeSpaces);
16570
16571      if (!arg) {
16572        if (isOptional) {
16573          optArgs.push(null);
16574          continue;
16575        }
16576
16577        throw new src_ParseError("Expected group after '" + func + "'", this.fetch());
16578      }
16579
16580      (isOptional ? optArgs : args).push(arg);
16581    }
16582
16583    return {
16584      args: args,
16585      optArgs: optArgs
16586    };
16587  }
16588  /**
16589   * Parses a group when the mode is changing.
16590   */
16591  ;
16592
16593  _proto.parseGroupOfType = function parseGroupOfType(name, type, optional, greediness, consumeSpaces) {
16594    switch (type) {
16595      case "color":
16596        if (consumeSpaces) {
16597          this.consumeSpaces();
16598        }
16599
16600        return this.parseColorGroup(optional);
16601
16602      case "size":
16603        if (consumeSpaces) {
16604          this.consumeSpaces();
16605        }
16606
16607        return this.parseSizeGroup(optional);
16608
16609      case "url":
16610        return this.parseUrlGroup(optional, consumeSpaces);
16611
16612      case "math":
16613      case "text":
16614        return this.parseGroup(name, optional, greediness, undefined, type, consumeSpaces);
16615
16616      case "hbox":
16617        {
16618          // hbox argument type wraps the argument in the equivalent of
16619          // \hbox, which is like \text but switching to \textstyle size.
16620          var group = this.parseGroup(name, optional, greediness, undefined, "text", consumeSpaces);
16621
16622          if (!group) {
16623            return group;
16624          }
16625
16626          var styledGroup = {
16627            type: "styling",
16628            mode: group.mode,
16629            body: [group],
16630            style: "text" // simulate \textstyle
16631
16632          };
16633          return styledGroup;
16634        }
16635
16636      case "raw":
16637        {
16638          if (consumeSpaces) {
16639            this.consumeSpaces();
16640          }
16641
16642          if (optional && this.fetch().text === "{") {
16643            return null;
16644          }
16645
16646          var token = this.parseStringGroup("raw", optional, true);
16647
16648          if (token) {
16649            return {
16650              type: "raw",
16651              mode: "text",
16652              string: token.text
16653            };
16654          } else {
16655            throw new src_ParseError("Expected raw group", this.fetch());
16656          }
16657        }
16658
16659      case "original":
16660      case null:
16661      case undefined:
16662        return this.parseGroup(name, optional, greediness, undefined, undefined, consumeSpaces);
16663
16664      default:
16665        throw new src_ParseError("Unknown group type as " + name, this.fetch());
16666    }
16667  }
16668  /**
16669   * Discard any space tokens, fetching the next non-space token.
16670   */
16671  ;
16672
16673  _proto.consumeSpaces = function consumeSpaces() {
16674    while (this.fetch().text === " ") {
16675      this.consume();
16676    }
16677  }
16678  /**
16679   * Parses a group, essentially returning the string formed by the
16680   * brace-enclosed tokens plus some position information.
16681   */
16682  ;
16683
16684  _proto.parseStringGroup = function parseStringGroup(modeName, // Used to describe the mode in error messages.
16685  optional, raw) {
16686    var groupBegin = optional ? "[" : "{";
16687    var groupEnd = optional ? "]" : "}";
16688    var beginToken = this.fetch();
16689
16690    if (beginToken.text !== groupBegin) {
16691      if (optional) {
16692        return null;
16693      } else if (raw && beginToken.text !== "EOF" && /[^{}[\]]/.test(beginToken.text)) {
16694        this.consume();
16695        return beginToken;
16696      }
16697    }
16698
16699    var outerMode = this.mode;
16700    this.mode = "text";
16701    this.expect(groupBegin);
16702    var str = "";
16703    var firstToken = this.fetch();
16704    var nested = 0; // allow nested braces in raw string group
16705
16706    var lastToken = firstToken;
16707    var nextToken;
16708
16709    while ((nextToken = this.fetch()).text !== groupEnd || raw && nested > 0) {
16710      switch (nextToken.text) {
16711        case "EOF":
16712          throw new src_ParseError("Unexpected end of input in " + modeName, firstToken.range(lastToken, str));
16713
16714        case groupBegin:
16715          nested++;
16716          break;
16717
16718        case groupEnd:
16719          nested--;
16720          break;
16721      }
16722
16723      lastToken = nextToken;
16724      str += lastToken.text;
16725      this.consume();
16726    }
16727
16728    this.expect(groupEnd);
16729    this.mode = outerMode;
16730    return firstToken.range(lastToken, str);
16731  }
16732  /**
16733   * Parses a regex-delimited group: the largest sequence of tokens
16734   * whose concatenated strings match `regex`. Returns the string
16735   * formed by the tokens plus some position information.
16736   */
16737  ;
16738
16739  _proto.parseRegexGroup = function parseRegexGroup(regex, modeName) {
16740    var outerMode = this.mode;
16741    this.mode = "text";
16742    var firstToken = this.fetch();
16743    var lastToken = firstToken;
16744    var str = "";
16745    var nextToken;
16746
16747    while ((nextToken = this.fetch()).text !== "EOF" && regex.test(str + nextToken.text)) {
16748      lastToken = nextToken;
16749      str += lastToken.text;
16750      this.consume();
16751    }
16752
16753    if (str === "") {
16754      throw new src_ParseError("Invalid " + modeName + ": '" + firstToken.text + "'", firstToken);
16755    }
16756
16757    this.mode = outerMode;
16758    return firstToken.range(lastToken, str);
16759  }
16760  /**
16761   * Parses a color description.
16762   */
16763  ;
16764
16765  _proto.parseColorGroup = function parseColorGroup(optional) {
16766    var res = this.parseStringGroup("color", optional);
16767
16768    if (!res) {
16769      return null;
16770    }
16771
16772    var match = /^(#[a-f0-9]{3}|#?[a-f0-9]{6}|[a-z]+)$/i.exec(res.text);
16773
16774    if (!match) {
16775      throw new src_ParseError("Invalid color: '" + res.text + "'", res);
16776    }
16777
16778    var color = match[0];
16779
16780    if (/^[0-9a-f]{6}$/i.test(color)) {
16781      // We allow a 6-digit HTML color spec without a leading "#".
16782      // This follows the xcolor package's HTML color model.
16783      // Predefined color names are all missed by this RegEx pattern.
16784      color = "#" + color;
16785    }
16786
16787    return {
16788      type: "color-token",
16789      mode: this.mode,
16790      color: color
16791    };
16792  }
16793  /**
16794   * Parses a size specification, consisting of magnitude and unit.
16795   */
16796  ;
16797
16798  _proto.parseSizeGroup = function parseSizeGroup(optional) {
16799    var res;
16800    var isBlank = false;
16801
16802    if (!optional && this.fetch().text !== "{") {
16803      res = this.parseRegexGroup(/^[-+]? *(?:$|\d+|\d+\.\d*|\.\d*) *[a-z]{0,2} *$/, "size");
16804    } else {
16805      res = this.parseStringGroup("size", optional);
16806    }
16807
16808    if (!res) {
16809      return null;
16810    }
16811
16812    if (!optional && res.text.length === 0) {
16813      // Because we've tested for what is !optional, this block won't
16814      // affect \kern, \hspace, etc. It will capture the mandatory arguments
16815      // to \genfrac and \above.
16816      res.text = "0pt"; // Enable \above{}
16817
16818      isBlank = true; // This is here specifically for \genfrac
16819    }
16820
16821    var match = /([-+]?) *(\d+(?:\.\d*)?|\.\d+) *([a-z]{2})/.exec(res.text);
16822
16823    if (!match) {
16824      throw new src_ParseError("Invalid size: '" + res.text + "'", res);
16825    }
16826
16827    var data = {
16828      number: +(match[1] + match[2]),
16829      // sign + magnitude, cast to number
16830      unit: match[3]
16831    };
16832
16833    if (!validUnit(data)) {
16834      throw new src_ParseError("Invalid unit: '" + data.unit + "'", res);
16835    }
16836
16837    return {
16838      type: "size",
16839      mode: this.mode,
16840      value: data,
16841      isBlank: isBlank
16842    };
16843  }
16844  /**
16845   * Parses an URL, checking escaped letters and allowed protocols,
16846   * and setting the catcode of % as an active character (as in \hyperref).
16847   */
16848  ;
16849
16850  _proto.parseUrlGroup = function parseUrlGroup(optional, consumeSpaces) {
16851    this.gullet.lexer.setCatcode("%", 13); // active character
16852
16853    var res = this.parseStringGroup("url", optional, true); // get raw string
16854
16855    this.gullet.lexer.setCatcode("%", 14); // comment character
16856
16857    if (!res) {
16858      return null;
16859    } // hyperref package allows backslashes alone in href, but doesn't
16860    // generate valid links in such cases; we interpret this as
16861    // "undefined" behaviour, and keep them as-is. Some browser will
16862    // replace backslashes with forward slashes.
16863
16864
16865    var url = res.text.replace(/\\([#$%&~_^{}])/g, '$1');
16866    return {
16867      type: "url",
16868      mode: this.mode,
16869      url: url
16870    };
16871  }
16872  /**
16873   * If `optional` is false or absent, this parses an ordinary group,
16874   * which is either a single nucleus (like "x") or an expression
16875   * in braces (like "{x+y}") or an implicit group, a group that starts
16876   * at the current position, and ends right before a higher explicit
16877   * group ends, or at EOF.
16878   * If `optional` is true, it parses either a bracket-delimited expression
16879   * (like "[x+y]") or returns null to indicate the absence of a
16880   * bracket-enclosed group.
16881   * If `mode` is present, switches to that mode while parsing the group,
16882   * and switches back after.
16883   */
16884  ;
16885
16886  _proto.parseGroup = function parseGroup(name, // For error reporting.
16887  optional, greediness, breakOnTokenText, mode, consumeSpaces) {
16888    // Switch to specified mode
16889    var outerMode = this.mode;
16890
16891    if (mode) {
16892      this.switchMode(mode);
16893    } // Consume spaces if requested, crucially *after* we switch modes,
16894    // so that the next non-space token is parsed in the correct mode.
16895
16896
16897    if (consumeSpaces) {
16898      this.consumeSpaces();
16899    } // Get first token
16900
16901
16902    var firstToken = this.fetch();
16903    var text = firstToken.text;
16904    var result; // Try to parse an open brace or \begingroup
16905
16906    if (optional ? text === "[" : text === "{" || text === "\\begingroup") {
16907      this.consume();
16908      var groupEnd = Parser.endOfGroup[text]; // Start a new group namespace
16909
16910      this.gullet.beginGroup(); // If we get a brace, parse an expression
16911
16912      var expression = this.parseExpression(false, groupEnd);
16913      var lastToken = this.fetch(); // Check that we got a matching closing brace
16914
16915      this.expect(groupEnd); // End group namespace
16916
16917      this.gullet.endGroup();
16918      result = {
16919        type: "ordgroup",
16920        mode: this.mode,
16921        loc: SourceLocation.range(firstToken, lastToken),
16922        body: expression,
16923        // A group formed by \begingroup...\endgroup is a semi-simple group
16924        // which doesn't affect spacing in math mode, i.e., is transparent.
16925        // https://tex.stackexchange.com/questions/1930/when-should-one-
16926        // use-begingroup-instead-of-bgroup
16927        semisimple: text === "\\begingroup" || undefined
16928      };
16929    } else if (optional) {
16930      // Return nothing for an optional group
16931      result = null;
16932    } else {
16933      // If there exists a function with this name, parse the function.
16934      // Otherwise, just return a nucleus
16935      result = this.parseFunction(breakOnTokenText, name, greediness) || this.parseSymbol();
16936
16937      if (result == null && text[0] === "\\" && !implicitCommands.hasOwnProperty(text)) {
16938        if (this.settings.throwOnError) {
16939          throw new src_ParseError("Undefined control sequence: " + text, firstToken);
16940        }
16941
16942        result = this.formatUnsupportedCmd(text);
16943        this.consume();
16944      }
16945    } // Switch mode back
16946
16947
16948    if (mode) {
16949      this.switchMode(outerMode);
16950    }
16951
16952    return result;
16953  }
16954  /**
16955   * Form ligature-like combinations of characters for text mode.
16956   * This includes inputs like "--", "---", "``" and "''".
16957   * The result will simply replace multiple textord nodes with a single
16958   * character in each value by a single textord node having multiple
16959   * characters in its value.  The representation is still ASCII source.
16960   * The group will be modified in place.
16961   */
16962  ;
16963
16964  _proto.formLigatures = function formLigatures(group) {
16965    var n = group.length - 1;
16966
16967    for (var i = 0; i < n; ++i) {
16968      var a = group[i]; // $FlowFixMe: Not every node type has a `text` property.
16969
16970      var v = a.text;
16971
16972      if (v === "-" && group[i + 1].text === "-") {
16973        if (i + 1 < n && group[i + 2].text === "-") {
16974          group.splice(i, 3, {
16975            type: "textord",
16976            mode: "text",
16977            loc: SourceLocation.range(a, group[i + 2]),
16978            text: "---"
16979          });
16980          n -= 2;
16981        } else {
16982          group.splice(i, 2, {
16983            type: "textord",
16984            mode: "text",
16985            loc: SourceLocation.range(a, group[i + 1]),
16986            text: "--"
16987          });
16988          n -= 1;
16989        }
16990      }
16991
16992      if ((v === "'" || v === "`") && group[i + 1].text === v) {
16993        group.splice(i, 2, {
16994          type: "textord",
16995          mode: "text",
16996          loc: SourceLocation.range(a, group[i + 1]),
16997          text: v + v
16998        });
16999        n -= 1;
17000      }
17001    }
17002  }
17003  /**
17004   * Parse a single symbol out of the string. Here, we handle single character
17005   * symbols and special functions like \verb.
17006   */
17007  ;
17008
17009  _proto.parseSymbol = function parseSymbol() {
17010    var nucleus = this.fetch();
17011    var text = nucleus.text;
17012
17013    if (/^\\verb[^a-zA-Z]/.test(text)) {
17014      this.consume();
17015      var arg = text.slice(5);
17016      var star = arg.charAt(0) === "*";
17017
17018      if (star) {
17019        arg = arg.slice(1);
17020      } // Lexer's tokenRegex is constructed to always have matching
17021      // first/last characters.
17022
17023
17024      if (arg.length < 2 || arg.charAt(0) !== arg.slice(-1)) {
17025        throw new src_ParseError("\\verb assertion failed --\n                    please report what input caused this bug");
17026      }
17027
17028      arg = arg.slice(1, -1); // remove first and last char
17029
17030      return {
17031        type: "verb",
17032        mode: "text",
17033        body: arg,
17034        star: star
17035      };
17036    } // At this point, we should have a symbol, possibly with accents.
17037    // First expand any accented base symbol according to unicodeSymbols.
17038
17039
17040    if (unicodeSymbols.hasOwnProperty(text[0]) && !src_symbols[this.mode][text[0]]) {
17041      // This behavior is not strict (XeTeX-compatible) in math mode.
17042      if (this.settings.strict && this.mode === "math") {
17043        this.settings.reportNonstrict("unicodeTextInMathMode", "Accented Unicode text character \"" + text[0] + "\" used in " + "math mode", nucleus);
17044      }
17045
17046      text = unicodeSymbols[text[0]] + text.substr(1);
17047    } // Strip off any combining characters
17048
17049
17050    var match = combiningDiacriticalMarksEndRegex.exec(text);
17051
17052    if (match) {
17053      text = text.substring(0, match.index);
17054
17055      if (text === 'i') {
17056        text = "\u0131"; // dotless i, in math and text mode
17057      } else if (text === 'j') {
17058        text = "\u0237"; // dotless j, in math and text mode
17059      }
17060    } // Recognize base symbol
17061
17062
17063    var symbol;
17064
17065    if (src_symbols[this.mode][text]) {
17066      if (this.settings.strict && this.mode === 'math' && extraLatin.indexOf(text) >= 0) {
17067        this.settings.reportNonstrict("unicodeTextInMathMode", "Latin-1/Unicode text character \"" + text[0] + "\" used in " + "math mode", nucleus);
17068      }
17069
17070      var group = src_symbols[this.mode][text].group;
17071      var loc = SourceLocation.range(nucleus);
17072      var s;
17073
17074      if (ATOMS.hasOwnProperty(group)) {
17075        // $FlowFixMe
17076        var family = group;
17077        s = {
17078          type: "atom",
17079          mode: this.mode,
17080          family: family,
17081          loc: loc,
17082          text: text
17083        };
17084      } else {
17085        // $FlowFixMe
17086        s = {
17087          type: group,
17088          mode: this.mode,
17089          loc: loc,
17090          text: text
17091        };
17092      }
17093
17094      symbol = s;
17095    } else if (text.charCodeAt(0) >= 0x80) {
17096      // no symbol for e.g. ^
17097      if (this.settings.strict) {
17098        if (!supportedCodepoint(text.charCodeAt(0))) {
17099          this.settings.reportNonstrict("unknownSymbol", "Unrecognized Unicode character \"" + text[0] + "\"" + (" (" + text.charCodeAt(0) + ")"), nucleus);
17100        } else if (this.mode === "math") {
17101          this.settings.reportNonstrict("unicodeTextInMathMode", "Unicode text character \"" + text[0] + "\" used in math mode", nucleus);
17102        }
17103      } // All nonmathematical Unicode characters are rendered as if they
17104      // are in text mode (wrapped in \text) because that's what it
17105      // takes to render them in LaTeX.  Setting `mode: this.mode` is
17106      // another natural choice (the user requested math mode), but
17107      // this makes it more difficult for getCharacterMetrics() to
17108      // distinguish Unicode characters without metrics and those for
17109      // which we want to simulate the letter M.
17110
17111
17112      symbol = {
17113        type: "textord",
17114        mode: "text",
17115        loc: SourceLocation.range(nucleus),
17116        text: text
17117      };
17118    } else {
17119      return null; // EOF, ^, _, {, }, etc.
17120    }
17121
17122    this.consume(); // Transform combining characters into accents
17123
17124    if (match) {
17125      for (var i = 0; i < match[0].length; i++) {
17126        var accent = match[0][i];
17127
17128        if (!unicodeAccents[accent]) {
17129          throw new src_ParseError("Unknown accent ' " + accent + "'", nucleus);
17130        }
17131
17132        var command = unicodeAccents[accent][this.mode];
17133
17134        if (!command) {
17135          throw new src_ParseError("Accent " + accent + " unsupported in " + this.mode + " mode", nucleus);
17136        }
17137
17138        symbol = {
17139          type: "accent",
17140          mode: this.mode,
17141          loc: SourceLocation.range(nucleus),
17142          label: command,
17143          isStretchy: false,
17144          isShifty: true,
17145          base: symbol
17146        };
17147      }
17148    }
17149
17150    return symbol;
17151  };
17152
17153  return Parser;
17154}();
17155
17156Parser_Parser.endOfExpression = ["}", "\\endgroup", "\\end", "\\right", "&"];
17157Parser_Parser.endOfGroup = {
17158  "[": "]",
17159  "{": "}",
17160  "\\begingroup": "\\endgroup"
17161  /**
17162   * Parses an "expression", which is a list of atoms.
17163   *
17164   * `breakOnInfix`: Should the parsing stop when we hit infix nodes? This
17165   *                 happens when functions have higher precendence han infix
17166   *                 nodes in implicit parses.
17167   *
17168   * `breakOnTokenText`: The text of the token that the expression should end
17169   *                     with, or `null` if something else should end the
17170   *                     expression.
17171   */
17172
17173};
17174Parser_Parser.SUPSUB_GREEDINESS = 1;
17175
17176// CONCATENATED MODULE: ./src/parseTree.js
17177/**
17178 * Provides a single function for parsing an expression using a Parser
17179 * TODO(emily): Remove this
17180 */
17181
17182
17183
17184/**
17185 * Parses an expression using a Parser, then returns the parsed result.
17186 */
17187var parseTree_parseTree = function parseTree(toParse, settings) {
17188  if (!(typeof toParse === 'string' || toParse instanceof String)) {
17189    throw new TypeError('KaTeX can only parse string typed expression');
17190  }
17191
17192  var parser = new Parser_Parser(toParse, settings); // Blank out any \df@tag to avoid spurious "Duplicate \tag" errors
17193
17194  delete parser.gullet.macros.current["\\df@tag"];
17195  var tree = parser.parse(); // If the input used \tag, it will set the \df@tag macro to the tag.
17196  // In this case, we separately parse the tag and wrap the tree.
17197
17198  if (parser.gullet.macros.get("\\df@tag")) {
17199    if (!settings.displayMode) {
17200      throw new src_ParseError("\\tag works only in display equations");
17201    }
17202
17203    parser.gullet.feed("\\df@tag");
17204    tree = [{
17205      type: "tag",
17206      mode: "text",
17207      body: tree,
17208      tag: parser.parse()
17209    }];
17210  }
17211
17212  return tree;
17213};
17214
17215/* harmony default export */ var src_parseTree = (parseTree_parseTree);
17216// CONCATENATED MODULE: ./katex.js
17217/* eslint no-console:0 */
17218
17219/**
17220 * This is the main entry point for KaTeX. Here, we expose functions for
17221 * rendering expressions either to DOM nodes or to markup strings.
17222 *
17223 * We also expose the ParseError class to check if errors thrown from KaTeX are
17224 * errors in the expression, or errors in javascript handling.
17225 */
17226
17227
17228
17229
17230
17231
17232
17233
17234
17235
17236/**
17237 * Parse and build an expression, and place that expression in the DOM node
17238 * given.
17239 */
17240var katex_render = function render(expression, baseNode, options) {
17241  baseNode.textContent = "";
17242  var node = katex_renderToDomTree(expression, options).toNode();
17243  baseNode.appendChild(node);
17244}; // KaTeX's styles don't work properly in quirks mode. Print out an error, and
17245// disable rendering.
17246
17247
17248if (typeof document !== "undefined") {
17249  if (document.compatMode !== "CSS1Compat") {
17250    typeof console !== "undefined" && console.warn("Warning: KaTeX doesn't work in quirks mode. Make sure your " + "website has a suitable doctype.");
17251
17252    katex_render = function render() {
17253      throw new src_ParseError("KaTeX doesn't work in quirks mode.");
17254    };
17255  }
17256}
17257/**
17258 * Parse and build an expression, and return the markup for that.
17259 */
17260
17261
17262var renderToString = function renderToString(expression, options) {
17263  var markup = katex_renderToDomTree(expression, options).toMarkup();
17264  return markup;
17265};
17266/**
17267 * Parse an expression and return the parse tree.
17268 */
17269
17270
17271var katex_generateParseTree = function generateParseTree(expression, options) {
17272  var settings = new Settings_Settings(options);
17273  return src_parseTree(expression, settings);
17274};
17275/**
17276 * If the given error is a KaTeX ParseError and options.throwOnError is false,
17277 * renders the invalid LaTeX as a span with hover title giving the KaTeX
17278 * error message.  Otherwise, simply throws the error.
17279 */
17280
17281
17282var katex_renderError = function renderError(error, expression, options) {
17283  if (options.throwOnError || !(error instanceof src_ParseError)) {
17284    throw error;
17285  }
17286
17287  var node = buildCommon.makeSpan(["katex-error"], [new domTree_SymbolNode(expression)]);
17288  node.setAttribute("title", error.toString());
17289  node.setAttribute("style", "color:" + options.errorColor);
17290  return node;
17291};
17292/**
17293 * Generates and returns the katex build tree. This is used for advanced
17294 * use cases (like rendering to custom output).
17295 */
17296
17297
17298var katex_renderToDomTree = function renderToDomTree(expression, options) {
17299  var settings = new Settings_Settings(options);
17300
17301  try {
17302    var tree = src_parseTree(expression, settings);
17303    return buildTree_buildTree(tree, expression, settings);
17304  } catch (error) {
17305    return katex_renderError(error, expression, settings);
17306  }
17307};
17308/**
17309 * Generates and returns the katex build tree, with just HTML (no MathML).
17310 * This is used for advanced use cases (like rendering to custom output).
17311 */
17312
17313
17314var katex_renderToHTMLTree = function renderToHTMLTree(expression, options) {
17315  var settings = new Settings_Settings(options);
17316
17317  try {
17318    var tree = src_parseTree(expression, settings);
17319    return buildTree_buildHTMLTree(tree, expression, settings);
17320  } catch (error) {
17321    return katex_renderError(error, expression, settings);
17322  }
17323};
17324
17325/* harmony default export */ var katex_0 = ({
17326  /**
17327   * Current KaTeX version
17328   */
17329  version: "0.11.1",
17330
17331  /**
17332   * Renders the given LaTeX into an HTML+MathML combination, and adds
17333   * it as a child to the specified DOM node.
17334   */
17335  render: katex_render,
17336
17337  /**
17338   * Renders the given LaTeX into an HTML+MathML combination string,
17339   * for sending to the client.
17340   */
17341  renderToString: renderToString,
17342
17343  /**
17344   * KaTeX error, usually during parsing.
17345   */
17346  ParseError: src_ParseError,
17347
17348  /**
17349   * Parses the given LaTeX into KaTeX's internal parse tree structure,
17350   * without rendering to HTML or MathML.
17351   *
17352   * NOTE: This method is not currently recommended for public use.
17353   * The internal tree representation is unstable and is very likely
17354   * to change. Use at your own risk.
17355   */
17356  __parse: katex_generateParseTree,
17357
17358  /**
17359   * Renders the given LaTeX into an HTML+MathML internal DOM tree
17360   * representation, without flattening that representation to a string.
17361   *
17362   * NOTE: This method is not currently recommended for public use.
17363   * The internal tree representation is unstable and is very likely
17364   * to change. Use at your own risk.
17365   */
17366  __renderToDomTree: katex_renderToDomTree,
17367
17368  /**
17369   * Renders the given LaTeX into an HTML internal DOM tree representation,
17370   * without MathML and without flattening that representation to a string.
17371   *
17372   * NOTE: This method is not currently recommended for public use.
17373   * The internal tree representation is unstable and is very likely
17374   * to change. Use at your own risk.
17375   */
17376  __renderToHTMLTree: katex_renderToHTMLTree,
17377
17378  /**
17379   * extends internal font metrics object with a new object
17380   * each key in the new object represents a font name
17381  */
17382  __setFontMetrics: setFontMetrics,
17383
17384  /**
17385   * adds a new symbol to builtin symbols table
17386   */
17387  __defineSymbol: defineSymbol,
17388
17389  /**
17390   * adds a new macro to builtin macro list
17391   */
17392  __defineMacro: defineMacro,
17393
17394  /**
17395   * Expose the dom tree node types, which can be useful for type checking nodes.
17396   *
17397   * NOTE: This method is not currently recommended for public use.
17398   * The internal tree representation is unstable and is very likely
17399   * to change. Use at your own risk.
17400   */
17401  __domTree: {
17402    Span: domTree_Span,
17403    Anchor: domTree_Anchor,
17404    SymbolNode: domTree_SymbolNode,
17405    SvgNode: SvgNode,
17406    PathNode: domTree_PathNode,
17407    LineNode: LineNode
17408  }
17409});
17410// CONCATENATED MODULE: ./katex.webpack.js
17411/**
17412 * This is the webpack entry point for KaTeX. As ECMAScript, flow[1] and jest[2]
17413 * doesn't support CSS modules natively, a separate entry point is used and
17414 * it is not flowtyped.
17415 *
17416 * [1] https://gist.github.com/lambdahands/d19e0da96285b749f0ef
17417 * [2] https://facebook.github.io/jest/docs/en/webpack.html
17418 */
17419
17420
17421/* harmony default export */ var katex_webpack = __webpack_exports__["default"] = (katex_0);
17422
17423/***/ })
17424/******/ ])["default"];
17425});