{"version":3,"sources":["webpack:///./node_modules/katex/src/ParseError.js","webpack:///./node_modules/katex/src/Options.js","webpack:///./node_modules/katex/src/Style.js","webpack:///./node_modules/katex/src/Parser.js","webpack:///./node_modules/ieee754/index.js","webpack:///./node_modules/katex/src/Settings.js","webpack:///./node_modules/katex/katex.js","webpack:///./node_modules/isarray/index.js","webpack:///./node_modules/katex/src/Lexer.js"],"names":["ParseError","message","lexer","position","error","undefined","input","_input","slice","begin","Math","max","end","self","Error","name","__proto__","prototype","module","exports","Options","data","this","style","color","size","phantom","font","parentStyle","parentSize","extend","extension","key","hasOwnProperty","withStyle","withSize","withColor","withPhantom","withFont","reset","colorMap","getColor","Style","id","multiplier","cramped","sizeMultiplier","sup","styles","sub","fracNum","fracDen","cramp","cls","sizeNames","resetNames","D","Dc","T","Tc","S","Sc","SS","SSc","DISPLAY","TEXT","SCRIPT","SCRIPTSCRIPT","functions","environments","Lexer","symbols","utils","parseData","Parser","settings","ParseNode","ParseFuncOrArgument","result","isFunction","expect","text","consume","nextToken","pos","lex","mode","parse","parseInput","expression","parseExpression","endOfExpression","breakOnInfix","breakOnToken","body","indexOf","atom","parseAtom","throwOnError","errorNode","handleUnsupportedCmd","push","type","handleInfixNodes","funcName","overIndex","i","length","node","value","replaceWith","numerNode","denomNode","numerBody","denomBody","callFunction","SUPSUB_GREEDINESS","handleSupSubscript","symbol","symPos","group","parseGroup","funcGreediness","greediness","parseFunction","textordArray","textNode","colorNode","errorColor","superscript","subscript","base","parseImplicitGroup","limits","alwaysHandleSupSub","prime","primes","sizeFuncs","styleFuncs","start","parseSymbol","func","left","right","envName","namepos","env","args","parseArguments","context","parser","positions","pop","handler","contains","baseGroup","funcData","allowedInText","totalArgs","numArgs","numOptionalArgs","baseGreediness","arg","argNode","argType","argTypes","parseSpecialGroup","parseOptionalGroup","argGreediness","innerMode","optional","res","outerMode","openBrace","inner","whitespace","nucleus","read","buffer","offset","isLE","mLen","nBytes","e","m","eLen","eMax","eBias","nBits","d","s","NaN","Infinity","pow","write","c","rt","abs","isNaN","floor","log","LN2","get","option","defaultValue","Settings","options","displayMode","buildTree","parseTree","render","baseNode","clearNode","tree","toNode","appendChild","document","compatMode","console","warn","renderToString","toMarkup","generateParseTree","__parse","toString","Array","isArray","arr","call","matchAt","Token","tokenRegex","RegExp","whitespaceRegex","_innerLex","ignoreWhitespace","match","cssColor","_innerLexColor","sizeRegex","_innerLexSize","unit","number","_innerLexWhitespace"],"mappings":"iGAKA,SAASA,EAAWC,EAASC,EAAOC,GAChC,IAAIC,EAAQ,sBAAwBH,EAEpC,QAAcI,IAAVH,QAAoCG,IAAbF,EAAwB,CAI/CC,GAAS,gBAAkBD,EAAW,KAGtC,IAAIG,EAAQJ,EAAMK,OAElBD,EAAQA,EAAME,MAAM,EAAGL,GAAY,IAC/BG,EAAME,MAAML,GAGhB,IAAIM,EAAQC,KAAKC,IAAI,EAAGR,EAAW,IAC/BS,EAAMT,EAAW,GACrBC,GAASE,EAAME,MAAMC,EAAOG,GAKhC,IAAIC,EAAO,IAAIC,MAAMV,GAKrB,OAJAS,EAAKE,KAAO,aACZF,EAAKG,UAAYhB,EAAWiB,UAE5BJ,EAAKV,SAAWA,EACTU,EAIXb,EAAWiB,UAAUD,UAAYF,MAAMG,UAEvCC,EAAOC,QAAUnB,G,qBCvBjB,SAASoB,EAAQC,GACbC,KAAKC,MAAQF,EAAKE,MAClBD,KAAKE,MAAQH,EAAKG,MAClBF,KAAKG,KAAOJ,EAAKI,KACjBH,KAAKI,QAAUL,EAAKK,QACpBJ,KAAKK,KAAON,EAAKM,UAEQtB,IAArBgB,EAAKO,YACLN,KAAKM,YAAcP,EAAKE,MAExBD,KAAKM,YAAcP,EAAKO,iBAGJvB,IAApBgB,EAAKQ,WACLP,KAAKO,WAAaR,EAAKI,KAEvBH,KAAKO,WAAaR,EAAKQ,WAQ/BT,EAAQH,UAAUa,OAAS,SAASC,GAChC,IAAIV,EAAO,CACPE,MAAOD,KAAKC,MACZE,KAAMH,KAAKG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8E,GAElC,OAAO,IAAIkJ,EAAMM,EAAM,GAAI,KAAMxJ,EAAMwJ,EAAM,GAAGjI,QAEhD,MAAM,IAAI3G,EAAW,gBAAiBsB,KAAM8D,IAMpD,IAAI2J,EAAY,4CAKhBzK,EAAMrD,UAAU+N,cAAgB,SAAS5J,GACrC,IAMIwJ,EANAtO,EAAQgB,KAAKf,OAGbwK,EAAasD,EAAQI,EAAiBnO,EAAO8E,GAAK,GAItD,GAHAA,GAAO2F,EAAWpE,OAGbiI,EAAQP,EAAQU,EAAWzO,EAAO8E,GAAO,CAC1C,IAAI6J,EAAOL,EAAM,GAEjB,GAAa,OAATK,GAA0B,OAATA,EACjB,MAAM,IAAIjP,EAAW,kBAAoBiP,EAAO,IAAK3N,KAAM8D,GAE/D,OAAO,IAAIkJ,EAAMM,EAAM,GAAI,CACvBM,SAAUN,EAAM,GAAKA,EAAM,IAC3BK,KAAMA,GACP7J,EAAMwJ,EAAM,GAAGjI,QAGtB,MAAM,IAAI3G,EAAW,eAAgBsB,KAAM8D,IAM/Cd,EAAMrD,UAAUkO,oBAAsB,SAAS/J,GAC3C,IAAI9E,EAAQgB,KAAKf,OAEbwK,EAAasD,EAAQI,EAAiBnO,EAAO8E,GAAK,GAGtD,OAFAA,GAAO2F,EAAWpE,OAEX,IAAI2H,EAAMvD,EAAW,GAAI,KAAM3F,IAO1Cd,EAAMrD,UAAUoE,IAAM,SAASD,EAAKE,GAChC,MAAa,SAATA,EACOhE,KAAKoN,UAAUtJ,GAAK,GACX,SAATE,EACAhE,KAAKoN,UAAUtJ,GAAK,GACX,UAATE,EACAhE,KAAKwN,eAAe1J,GACX,SAATE,EACAhE,KAAK0N,cAAc5J,GACV,eAATE,EACAhE,KAAK6N,oBAAoB/J,QAD7B,GAKXlE,EAAOC,QAAUmD","file":"js/chunk-38b012f3.c6100a13.js","sourcesContent":["/**\n * This is the ParseError class, which is the main error thrown by KaTeX\n * functions when something has gone wrong. This is used to distinguish internal\n * errors from errors in the expression that the user provided.\n */\nfunction ParseError(message, lexer, position) {\n var error = \"KaTeX parse error: \" + message;\n\n if (lexer !== undefined && position !== undefined) {\n // If we have the input and a position, make the error a bit fancier\n\n // Prepend some information\n error += \" at position \" + position + \": \";\n\n // Get the input\n var input = lexer._input;\n // Insert a combining underscore at the correct position\n input = input.slice(0, position) + \"\\u0332\" +\n input.slice(position);\n\n // Extract some context from the input and add it to the error\n var begin = Math.max(0, position - 15);\n var end = position + 15;\n error += input.slice(begin, end);\n }\n\n // Some hackery to make ParseError a prototype of Error\n // See http://stackoverflow.com/a/8460753\n var self = new Error(error);\n self.name = \"ParseError\";\n self.__proto__ = ParseError.prototype;\n\n self.position = position;\n return self;\n}\n\n// More hackery\nParseError.prototype.__proto__ = Error.prototype;\n\nmodule.exports = ParseError;\n","/**\n * This file contains information about the options that the Parser carries\n * around with it while parsing. Data is held in an `Options` object, and when\n * recursing, a new `Options` object can be created with the `.with*` and\n * `.reset` functions.\n */\n\n/**\n * This is the main options class. It contains the style, size, color, and font\n * of the current parse level. It also contains the style and size of the parent\n * parse level, so size changes can be handled efficiently.\n *\n * Each of the `.with*` and `.reset` functions passes its current style and size\n * as the parentStyle and parentSize of the new options class, so parent\n * handling is taken care of automatically.\n */\nfunction Options(data) {\n this.style = data.style;\n this.color = data.color;\n this.size = data.size;\n this.phantom = data.phantom;\n this.font = data.font;\n\n if (data.parentStyle === undefined) {\n this.parentStyle = data.style;\n } else {\n this.parentStyle = data.parentStyle;\n }\n\n if (data.parentSize === undefined) {\n this.parentSize = data.size;\n } else {\n this.parentSize = data.parentSize;\n }\n}\n\n/**\n * Returns a new options object with the same properties as \"this\". Properties\n * from \"extension\" will be copied to the new options object.\n */\nOptions.prototype.extend = function(extension) {\n var data = {\n style: this.style,\n size: this.size,\n color: this.color,\n parentStyle: this.style,\n parentSize: this.size,\n phantom: this.phantom,\n font: this.font,\n };\n\n for (var key in extension) {\n if (extension.hasOwnProperty(key)) {\n data[key] = extension[key];\n }\n }\n\n return new Options(data);\n};\n\n/**\n * Create a new options object with the given style.\n */\nOptions.prototype.withStyle = function(style) {\n return this.extend({\n style: style,\n });\n};\n\n/**\n * Create a new options object with the given size.\n */\nOptions.prototype.withSize = function(size) {\n return this.extend({\n size: size,\n });\n};\n\n/**\n * Create a new options object with the given color.\n */\nOptions.prototype.withColor = function(color) {\n return this.extend({\n color: color,\n });\n};\n\n/**\n * Create a new options object with \"phantom\" set to true.\n */\nOptions.prototype.withPhantom = function() {\n return this.extend({\n phantom: true,\n });\n};\n\n/**\n * Create a new options objects with the give font.\n */\nOptions.prototype.withFont = function(font) {\n return this.extend({\n font: font,\n });\n};\n\n/**\n * Create a new options object with the same style, size, and color. This is\n * used so that parent style and size changes are handled correctly.\n */\nOptions.prototype.reset = function() {\n return this.extend({});\n};\n\n/**\n * A map of color names to CSS colors.\n * TODO(emily): Remove this when we have real macros\n */\nvar colorMap = {\n \"katex-blue\": \"#6495ed\",\n \"katex-orange\": \"#ffa500\",\n \"katex-pink\": \"#ff00af\",\n \"katex-red\": \"#df0030\",\n \"katex-green\": \"#28ae7b\",\n \"katex-gray\": \"gray\",\n \"katex-purple\": \"#9d38bd\",\n \"katex-blueA\": \"#c7e9f1\",\n \"katex-blueB\": \"#9cdceb\",\n \"katex-blueC\": \"#58c4dd\",\n \"katex-blueD\": \"#29abca\",\n \"katex-blueE\": \"#1c758a\",\n \"katex-tealA\": \"#acead7\",\n \"katex-tealB\": \"#76ddc0\",\n \"katex-tealC\": \"#5cd0b3\",\n \"katex-tealD\": \"#55c1a7\",\n \"katex-tealE\": \"#49a88f\",\n \"katex-greenA\": \"#c9e2ae\",\n \"katex-greenB\": \"#a6cf8c\",\n \"katex-greenC\": \"#83c167\",\n \"katex-greenD\": \"#77b05d\",\n \"katex-greenE\": \"#699c52\",\n \"katex-goldA\": \"#f7c797\",\n \"katex-goldB\": \"#f9b775\",\n \"katex-goldC\": \"#f0ac5f\",\n \"katex-goldD\": \"#e1a158\",\n \"katex-goldE\": \"#c78d46\",\n \"katex-redA\": \"#f7a1a3\",\n \"katex-redB\": \"#ff8080\",\n \"katex-redC\": \"#fc6255\",\n \"katex-redD\": \"#e65a4c\",\n \"katex-redE\": \"#cf5044\",\n \"katex-maroonA\": \"#ecabc1\",\n \"katex-maroonB\": \"#ec92ab\",\n \"katex-maroonC\": \"#c55f73\",\n \"katex-maroonD\": \"#a24d61\",\n \"katex-maroonE\": \"#94424f\",\n \"katex-purpleA\": \"#caa3e8\",\n \"katex-purpleB\": \"#b189c6\",\n \"katex-purpleC\": \"#9a72ac\",\n \"katex-purpleD\": \"#715582\",\n \"katex-purpleE\": \"#644172\",\n \"katex-mintA\": \"#f5f9e8\",\n \"katex-mintB\": \"#edf2df\",\n \"katex-mintC\": \"#e0e5cc\",\n \"katex-grayA\": \"#fdfdfd\",\n \"katex-grayB\": \"#f7f7f7\",\n \"katex-grayC\": \"#eeeeee\",\n \"katex-grayD\": \"#dddddd\",\n \"katex-grayE\": \"#cccccc\",\n \"katex-grayF\": \"#aaaaaa\",\n \"katex-grayG\": \"#999999\",\n \"katex-grayH\": \"#555555\",\n \"katex-grayI\": \"#333333\",\n \"katex-kaBlue\": \"#314453\",\n \"katex-kaGreen\": \"#639b24\",\n};\n\n/**\n * Gets the CSS color of the current options object, accounting for the\n * `colorMap`.\n */\nOptions.prototype.getColor = function() {\n if (this.phantom) {\n return \"transparent\";\n } else {\n return colorMap[this.color] || this.color;\n }\n};\n\nmodule.exports = Options;\n","/**\n * This file contains information and classes for the various kinds of styles\n * used in TeX. It provides a generic `Style` class, which holds information\n * about a specific style. It then provides instances of all the different kinds\n * of styles possible, and provides functions to move between them and get\n * information about them.\n */\n\n/**\n * The main style class. Contains a unique id for the style, a size (which is\n * the same for cramped and uncramped version of a style), a cramped flag, and a\n * size multiplier, which gives the size difference between a style and\n * textstyle.\n */\nfunction Style(id, size, multiplier, cramped) {\n this.id = id;\n this.size = size;\n this.cramped = cramped;\n this.sizeMultiplier = multiplier;\n}\n\n/**\n * Get the style of a superscript given a base in the current style.\n */\nStyle.prototype.sup = function() {\n return styles[sup[this.id]];\n};\n\n/**\n * Get the style of a subscript given a base in the current style.\n */\nStyle.prototype.sub = function() {\n return styles[sub[this.id]];\n};\n\n/**\n * Get the style of a fraction numerator given the fraction in the current\n * style.\n */\nStyle.prototype.fracNum = function() {\n return styles[fracNum[this.id]];\n};\n\n/**\n * Get the style of a fraction denominator given the fraction in the current\n * style.\n */\nStyle.prototype.fracDen = function() {\n return styles[fracDen[this.id]];\n};\n\n/**\n * Get the cramped version of a style (in particular, cramping a cramped style\n * doesn't change the style).\n */\nStyle.prototype.cramp = function() {\n return styles[cramp[this.id]];\n};\n\n/**\n * HTML class name, like \"displaystyle cramped\"\n */\nStyle.prototype.cls = function() {\n return sizeNames[this.size] + (this.cramped ? \" cramped\" : \" uncramped\");\n};\n\n/**\n * HTML Reset class name, like \"reset-textstyle\"\n */\nStyle.prototype.reset = function() {\n return resetNames[this.size];\n};\n\n// IDs of the different styles\nvar D = 0;\nvar Dc = 1;\nvar T = 2;\nvar Tc = 3;\nvar S = 4;\nvar Sc = 5;\nvar SS = 6;\nvar SSc = 7;\n\n// String names for the different sizes\nvar sizeNames = [\n \"displaystyle textstyle\",\n \"textstyle\",\n \"scriptstyle\",\n \"scriptscriptstyle\",\n];\n\n// Reset names for the different sizes\nvar resetNames = [\n \"reset-textstyle\",\n \"reset-textstyle\",\n \"reset-scriptstyle\",\n \"reset-scriptscriptstyle\",\n];\n\n// Instances of the different styles\nvar styles = [\n new Style(D, 0, 1.0, false),\n new Style(Dc, 0, 1.0, true),\n new Style(T, 1, 1.0, false),\n new Style(Tc, 1, 1.0, true),\n new Style(S, 2, 0.7, false),\n new Style(Sc, 2, 0.7, true),\n new Style(SS, 3, 0.5, false),\n new Style(SSc, 3, 0.5, true),\n];\n\n// Lookup tables for switching from one style to another\nvar sup = [S, Sc, S, Sc, SS, SSc, SS, SSc];\nvar sub = [Sc, Sc, Sc, Sc, SSc, SSc, SSc, SSc];\nvar fracNum = [T, Tc, S, Sc, SS, SSc, SS, SSc];\nvar fracDen = [Tc, Tc, Sc, Sc, SSc, SSc, SSc, SSc];\nvar cramp = [Dc, Dc, Tc, Tc, Sc, Sc, SSc, SSc];\n\n// We only export some of the styles. Also, we don't export the `Style` class so\n// no more styles can be generated.\nmodule.exports = {\n DISPLAY: styles[D],\n TEXT: styles[T],\n SCRIPT: styles[S],\n SCRIPTSCRIPT: styles[SS],\n};\n","/* eslint no-constant-condition:0 */\nvar functions = require(\"./functions\");\nvar environments = require(\"./environments\");\nvar Lexer = require(\"./Lexer\");\nvar symbols = require(\"./symbols\");\nvar utils = require(\"./utils\");\n\nvar parseData = require(\"./parseData\");\nvar ParseError = require(\"./ParseError\");\n\n/**\n * This file contains the parser used to parse out a TeX expression from the\n * input. Since TeX isn't context-free, standard parsers don't work particularly\n * well.\n *\n * The strategy of this parser is as such:\n *\n * The main functions (the `.parse...` ones) take a position in the current\n * parse string to parse tokens from. The lexer (found in Lexer.js, stored at\n * this.lexer) also supports pulling out tokens at arbitrary places. When\n * individual tokens are needed at a position, the lexer is called to pull out a\n * token, which is then used.\n *\n * The parser has a property called \"mode\" indicating the mode that\n * the parser is currently in. Currently it has to be one of \"math\" or\n * \"text\", which denotes whether the current environment is a math-y\n * one or a text-y one (e.g. inside \\text). Currently, this serves to\n * limit the functions which can be used in text mode.\n *\n * The main functions then return an object which contains the useful data that\n * was parsed at its given point, and a new position at the end of the parsed\n * data. The main functions can call each other and continue the parsing by\n * using the returned position as a new starting point.\n *\n * There are also extra `.handle...` functions, which pull out some reused\n * functionality into self-contained functions.\n *\n * The earlier functions return ParseNodes.\n * The later functions (which are called deeper in the parse) sometimes return\n * ParseFuncOrArgument, which contain a ParseNode as well as some data about\n * whether the parsed object is a function which is missing some arguments, or a\n * standalone object which can be used as an argument to another function.\n */\n\n/**\n * Main Parser class\n */\nfunction Parser(input, settings) {\n // Make a new lexer\n this.lexer = new Lexer(input);\n // Store the settings for use in parsing\n this.settings = settings;\n}\n\nvar ParseNode = parseData.ParseNode;\n\n/**\n * An initial function (without its arguments), or an argument to a function.\n * The `result` argument should be a ParseNode.\n */\nfunction ParseFuncOrArgument(result, isFunction) {\n this.result = result;\n // Is this a function (i.e. is it something defined in functions.js)?\n this.isFunction = isFunction;\n}\n\n/**\n * Checks a result to make sure it has the right type, and throws an\n * appropriate error otherwise.\n *\n * @param {boolean=} consume whether to consume the expected token,\n * defaults to true\n */\nParser.prototype.expect = function(text, consume) {\n if (this.nextToken.text !== text) {\n throw new ParseError(\n \"Expected '\" + text + \"', got '\" + this.nextToken.text + \"'\",\n this.lexer, this.nextToken.position\n );\n }\n if (consume !== false) {\n this.consume();\n }\n};\n\n/**\n * Considers the current look ahead token as consumed,\n * and fetches the one after that as the new look ahead.\n */\nParser.prototype.consume = function() {\n this.pos = this.nextToken.position;\n this.nextToken = this.lexer.lex(this.pos, this.mode);\n};\n\n/**\n * Main parsing function, which parses an entire input.\n *\n * @return {?Array.}\n */\nParser.prototype.parse = function() {\n // Try to parse the input\n this.mode = \"math\";\n this.pos = 0;\n this.nextToken = this.lexer.lex(this.pos, this.mode);\n var parse = this.parseInput();\n return parse;\n};\n\n/**\n * Parses an entire input tree.\n */\nParser.prototype.parseInput = function() {\n // Parse an expression\n var expression = this.parseExpression(false);\n // If we succeeded, make sure there's an EOF at the end\n this.expect(\"EOF\", false);\n return expression;\n};\n\nvar endOfExpression = [\"}\", \"\\\\end\", \"\\\\right\", \"&\", \"\\\\\\\\\", \"\\\\cr\"];\n\n/**\n * Parses an \"expression\", which is a list of atoms.\n *\n * @param {boolean} breakOnInfix Should the parsing stop when we hit infix\n * nodes? This happens when functions have higher precendence\n * than infix nodes in implicit parses.\n *\n * @param {?string} breakOnToken The token that the expression should end with,\n * or `null` if something else should end the expression.\n *\n * @return {ParseNode}\n */\nParser.prototype.parseExpression = function(breakOnInfix, breakOnToken) {\n var body = [];\n // Keep adding atoms to the body until we can't parse any more atoms (either\n // we reached the end, a }, or a \\right)\n while (true) {\n var lex = this.nextToken;\n var pos = this.pos;\n if (endOfExpression.indexOf(lex.text) !== -1) {\n break;\n }\n if (breakOnToken && lex.text === breakOnToken) {\n break;\n }\n var atom = this.parseAtom();\n if (!atom) {\n if (!this.settings.throwOnError && lex.text[0] === \"\\\\\") {\n var errorNode = this.handleUnsupportedCmd();\n body.push(errorNode);\n\n pos = lex.position;\n continue;\n }\n\n break;\n }\n if (breakOnInfix && atom.type === \"infix\") {\n // rewind so we can parse the infix atom again\n this.pos = pos;\n this.nextToken = lex;\n break;\n }\n body.push(atom);\n }\n return this.handleInfixNodes(body);\n};\n\n/**\n * Rewrites infix operators such as \\over with corresponding commands such\n * as \\frac.\n *\n * There can only be one infix operator per group. If there's more than one\n * then the expression is ambiguous. This can be resolved by adding {}.\n *\n * @returns {Array}\n */\nParser.prototype.handleInfixNodes = function(body) {\n var overIndex = -1;\n var funcName;\n\n for (var i = 0; i < body.length; i++) {\n var node = body[i];\n if (node.type === \"infix\") {\n if (overIndex !== -1) {\n throw new ParseError(\"only one infix operator per group\",\n this.lexer, -1);\n }\n overIndex = i;\n funcName = node.value.replaceWith;\n }\n }\n\n if (overIndex !== -1) {\n var numerNode;\n var denomNode;\n\n var numerBody = body.slice(0, overIndex);\n var denomBody = body.slice(overIndex + 1);\n\n if (numerBody.length === 1 && numerBody[0].type === \"ordgroup\") {\n numerNode = numerBody[0];\n } else {\n numerNode = new ParseNode(\"ordgroup\", numerBody, this.mode);\n }\n\n if (denomBody.length === 1 && denomBody[0].type === \"ordgroup\") {\n denomNode = denomBody[0];\n } else {\n denomNode = new ParseNode(\"ordgroup\", denomBody, this.mode);\n }\n\n var value = this.callFunction(\n funcName, [numerNode, denomNode], null);\n return [new ParseNode(value.type, value, this.mode)];\n } else {\n return body;\n }\n};\n\n// The greediness of a superscript or subscript\nvar SUPSUB_GREEDINESS = 1;\n\n/**\n * Handle a subscript or superscript with nice errors.\n */\nParser.prototype.handleSupSubscript = function(name) {\n var symbol = this.nextToken.text;\n var symPos = this.pos;\n this.consume();\n var group = this.parseGroup();\n\n if (!group) {\n if (!this.settings.throwOnError && this.nextToken.text[0] === \"\\\\\") {\n return this.handleUnsupportedCmd();\n } else {\n throw new ParseError(\n \"Expected group after '\" + symbol + \"'\",\n this.lexer,\n symPos + 1\n );\n }\n } else if (group.isFunction) {\n // ^ and _ have a greediness, so handle interactions with functions'\n // greediness\n var funcGreediness = functions[group.result].greediness;\n if (funcGreediness > SUPSUB_GREEDINESS) {\n return this.parseFunction(group);\n } else {\n throw new ParseError(\n \"Got function '\" + group.result + \"' with no arguments \" +\n \"as \" + name,\n this.lexer, symPos + 1);\n }\n } else {\n return group.result;\n }\n};\n\n/**\n * Converts the textual input of an unsupported command into a text node\n * contained within a color node whose color is determined by errorColor\n */\nParser.prototype.handleUnsupportedCmd = function() {\n var text = this.nextToken.text;\n var textordArray = [];\n\n for (var i = 0; i < text.length; i++) {\n textordArray.push(new ParseNode(\"textord\", text[i], \"text\"));\n }\n\n var textNode = new ParseNode(\n \"text\",\n {\n body: textordArray,\n type: \"text\",\n },\n this.mode);\n\n var colorNode = new ParseNode(\n \"color\",\n {\n color: this.settings.errorColor,\n value: [textNode],\n type: \"color\",\n },\n this.mode);\n\n this.consume();\n return colorNode;\n};\n\n/**\n * Parses a group with optional super/subscripts.\n *\n * @return {?ParseNode}\n */\nParser.prototype.parseAtom = function() {\n // The body of an atom is an implicit group, so that things like\n // \\left(x\\right)^2 work correctly.\n var base = this.parseImplicitGroup();\n\n // In text mode, we don't have superscripts or subscripts\n if (this.mode === \"text\") {\n return base;\n }\n\n // Note that base may be empty (i.e. null) at this point.\n\n var superscript;\n var subscript;\n while (true) {\n // Lex the first token\n var lex = this.nextToken;\n\n if (lex.text === \"\\\\limits\" || lex.text === \"\\\\nolimits\") {\n // We got a limit control\n if (!base || base.type !== \"op\") {\n throw new ParseError(\n \"Limit controls must follow a math operator\",\n this.lexer, this.pos);\n } else {\n var limits = lex.text === \"\\\\limits\";\n base.value.limits = limits;\n base.value.alwaysHandleSupSub = true;\n }\n this.consume();\n } else if (lex.text === \"^\") {\n // We got a superscript start\n if (superscript) {\n throw new ParseError(\n \"Double superscript\", this.lexer, this.pos);\n }\n superscript = this.handleSupSubscript(\"superscript\");\n } else if (lex.text === \"_\") {\n // We got a subscript start\n if (subscript) {\n throw new ParseError(\n \"Double subscript\", this.lexer, this.pos);\n }\n subscript = this.handleSupSubscript(\"subscript\");\n } else if (lex.text === \"'\") {\n // We got a prime\n var prime = new ParseNode(\"textord\", \"\\\\prime\", this.mode);\n\n // Many primes can be grouped together, so we handle this here\n var primes = [prime];\n this.consume();\n // Keep lexing tokens until we get something that's not a prime\n while (this.nextToken.text === \"'\") {\n // For each one, add another prime to the list\n primes.push(prime);\n this.consume();\n }\n // Put them into an ordgroup as the superscript\n superscript = new ParseNode(\"ordgroup\", primes, this.mode);\n } else {\n // If it wasn't ^, _, or ', stop parsing super/subscripts\n break;\n }\n }\n\n if (superscript || subscript) {\n // If we got either a superscript or subscript, create a supsub\n return new ParseNode(\"supsub\", {\n base: base,\n sup: superscript,\n sub: subscript,\n }, this.mode);\n } else {\n // Otherwise return the original body\n return base;\n }\n};\n\n// A list of the size-changing functions, for use in parseImplicitGroup\nvar sizeFuncs = [\n \"\\\\tiny\", \"\\\\scriptsize\", \"\\\\footnotesize\", \"\\\\small\", \"\\\\normalsize\",\n \"\\\\large\", \"\\\\Large\", \"\\\\LARGE\", \"\\\\huge\", \"\\\\Huge\",\n];\n\n// A list of the style-changing functions, for use in parseImplicitGroup\nvar styleFuncs = [\n \"\\\\displaystyle\", \"\\\\textstyle\", \"\\\\scriptstyle\", \"\\\\scriptscriptstyle\",\n];\n\n/**\n * Parses an implicit group, which is a group that starts at the end of a\n * specified, and ends right before a higher explicit group ends, or at EOL. It\n * is used for functions that appear to affect the current style, like \\Large or\n * \\textrm, where instead of keeping a style we just pretend that there is an\n * implicit grouping after it until the end of the group. E.g.\n * small text {\\Large large text} small text again\n * It is also used for \\left and \\right to get the correct grouping.\n *\n * @return {?ParseNode}\n */\nParser.prototype.parseImplicitGroup = function() {\n var start = this.parseSymbol();\n\n if (start == null) {\n // If we didn't get anything we handle, fall back to parseFunction\n return this.parseFunction();\n }\n\n var func = start.result;\n var body;\n\n if (func === \"\\\\left\") {\n // If we see a left:\n // Parse the entire left function (including the delimiter)\n var left = this.parseFunction(start);\n // Parse out the implicit body\n body = this.parseExpression(false);\n // Check the next token\n this.expect(\"\\\\right\", false);\n var right = this.parseFunction();\n return new ParseNode(\"leftright\", {\n body: body,\n left: left.value.value,\n right: right.value.value,\n }, this.mode);\n } else if (func === \"\\\\begin\") {\n // begin...end is similar to left...right\n var begin = this.parseFunction(start);\n var envName = begin.value.name;\n if (!environments.hasOwnProperty(envName)) {\n throw new ParseError(\n \"No such environment: \" + envName,\n this.lexer, begin.value.namepos);\n }\n // Build the environment object. Arguments and other information will\n // be made available to the begin and end methods using properties.\n var env = environments[envName];\n var args = this.parseArguments(\"\\\\begin{\" + envName + \"}\", env);\n var context = {\n mode: this.mode,\n envName: envName,\n parser: this,\n lexer: this.lexer,\n positions: args.pop(),\n };\n var result = env.handler(context, args);\n this.expect(\"\\\\end\", false);\n var end = this.parseFunction();\n if (end.value.name !== envName) {\n throw new ParseError(\n \"Mismatch: \\\\begin{\" + envName + \"} matched \" +\n \"by \\\\end{\" + end.value.name + \"}\",\n this.lexer /* , end.value.namepos */);\n // TODO: Add position to the above line and adjust test case,\n // requires #385 to get merged first\n }\n result.position = end.position;\n return result;\n } else if (utils.contains(sizeFuncs, func)) {\n // If we see a sizing function, parse out the implict body\n body = this.parseExpression(false);\n return new ParseNode(\"sizing\", {\n // Figure out what size to use based on the list of functions above\n size: \"size\" + (utils.indexOf(sizeFuncs, func) + 1),\n value: body,\n }, this.mode);\n } else if (utils.contains(styleFuncs, func)) {\n // If we see a styling function, parse out the implict body\n body = this.parseExpression(true);\n return new ParseNode(\"styling\", {\n // Figure out what style to use by pulling out the style from\n // the function name\n style: func.slice(1, func.length - 5),\n value: body,\n }, this.mode);\n } else {\n // Defer to parseFunction if it's not a function we handle\n return this.parseFunction(start);\n }\n};\n\n/**\n * Parses an entire function, including its base and all of its arguments.\n * The base might either have been parsed already, in which case\n * it is provided as an argument, or it's the next group in the input.\n *\n * @param {ParseFuncOrArgument=} baseGroup optional as described above\n * @return {?ParseNode}\n */\nParser.prototype.parseFunction = function(baseGroup) {\n if (!baseGroup) {\n baseGroup = this.parseGroup();\n }\n\n if (baseGroup) {\n if (baseGroup.isFunction) {\n var func = baseGroup.result;\n var funcData = functions[func];\n if (this.mode === \"text\" && !funcData.allowedInText) {\n throw new ParseError(\n \"Can't use function '\" + func + \"' in text mode\",\n this.lexer, baseGroup.position);\n }\n\n var args = this.parseArguments(func, funcData);\n var result = this.callFunction(func, args, args.pop());\n return new ParseNode(result.type, result, this.mode);\n } else {\n return baseGroup.result;\n }\n } else {\n return null;\n }\n};\n\n/**\n * Call a function handler with a suitable context and arguments.\n */\nParser.prototype.callFunction = function(name, args, positions) {\n var context = {\n funcName: name,\n parser: this,\n lexer: this.lexer,\n positions: positions,\n };\n return functions[name].handler(context, args);\n};\n\n/**\n * Parses the arguments of a function or environment\n *\n * @param {string} func \"\\name\" or \"\\begin{name}\"\n * @param {{numArgs:number,numOptionalArgs:number|undefined}} funcData\n * @return the array of arguments, with the list of positions as last element\n */\nParser.prototype.parseArguments = function(func, funcData) {\n var totalArgs = funcData.numArgs + funcData.numOptionalArgs;\n if (totalArgs === 0) {\n return [[this.pos]];\n }\n\n var baseGreediness = funcData.greediness;\n var positions = [this.pos];\n var args = [];\n\n for (var i = 0; i < totalArgs; i++) {\n var argType = funcData.argTypes && funcData.argTypes[i];\n var arg;\n if (i < funcData.numOptionalArgs) {\n if (argType) {\n arg = this.parseSpecialGroup(argType, true);\n } else {\n arg = this.parseOptionalGroup();\n }\n if (!arg) {\n args.push(null);\n positions.push(this.pos);\n continue;\n }\n } else {\n if (argType) {\n arg = this.parseSpecialGroup(argType);\n } else {\n arg = this.parseGroup();\n }\n if (!arg) {\n if (!this.settings.throwOnError &&\n this.nextToken.text[0] === \"\\\\\") {\n arg = new ParseFuncOrArgument(\n this.handleUnsupportedCmd(this.nextToken.text),\n false);\n } else {\n throw new ParseError(\n \"Expected group after '\" + func + \"'\",\n this.lexer, this.pos);\n }\n }\n }\n var argNode;\n if (arg.isFunction) {\n var argGreediness =\n functions[arg.result].greediness;\n if (argGreediness > baseGreediness) {\n argNode = this.parseFunction(arg);\n } else {\n throw new ParseError(\n \"Got function '\" + arg.result + \"' as \" +\n \"argument to '\" + func + \"'\",\n this.lexer, this.pos - 1);\n }\n } else {\n argNode = arg.result;\n }\n args.push(argNode);\n positions.push(this.pos);\n }\n\n args.push(positions);\n\n return args;\n};\n\n\n/**\n * Parses a group when the mode is changing. Takes a position, a new mode, and\n * an outer mode that is used to parse the outside.\n *\n * @return {?ParseFuncOrArgument}\n */\nParser.prototype.parseSpecialGroup = function(innerMode, optional) {\n var outerMode = this.mode;\n // Handle `original` argTypes\n if (innerMode === \"original\") {\n innerMode = outerMode;\n }\n\n if (innerMode === \"color\" || innerMode === \"size\") {\n // color and size modes are special because they should have braces and\n // should only lex a single symbol inside\n var openBrace = this.nextToken;\n if (optional && openBrace.text !== \"[\") {\n // optional arguments should return null if they don't exist\n return null;\n }\n // The call to expect will lex the token after the '{' in inner mode\n this.mode = innerMode;\n this.expect(optional ? \"[\" : \"{\");\n var inner = this.nextToken;\n this.mode = outerMode;\n var data;\n if (innerMode === \"color\") {\n data = inner.text;\n } else {\n data = inner.data;\n }\n this.consume(); // consume the token stored in inner\n this.expect(optional ? \"]\" : \"}\");\n return new ParseFuncOrArgument(\n new ParseNode(innerMode, data, outerMode),\n false);\n } else if (innerMode === \"text\") {\n // text mode is special because it should ignore the whitespace before\n // it\n var whitespace = this.lexer.lex(this.pos, \"whitespace\");\n this.pos = whitespace.position;\n }\n\n // By the time we get here, innerMode is one of \"text\" or \"math\".\n // We switch the mode of the parser, recurse, then restore the old mode.\n this.mode = innerMode;\n this.nextToken = this.lexer.lex(this.pos, innerMode);\n var res;\n if (optional) {\n res = this.parseOptionalGroup();\n } else {\n res = this.parseGroup();\n }\n this.mode = outerMode;\n this.nextToken = this.lexer.lex(this.pos, outerMode);\n return res;\n};\n\n/**\n * Parses a group, which is either a single nucleus (like \"x\") or an expression\n * in braces (like \"{x+y}\")\n *\n * @return {?ParseFuncOrArgument}\n */\nParser.prototype.parseGroup = function() {\n // Try to parse an open brace\n if (this.nextToken.text === \"{\") {\n // If we get a brace, parse an expression\n this.consume();\n var expression = this.parseExpression(false);\n // Make sure we get a close brace\n this.expect(\"}\");\n return new ParseFuncOrArgument(\n new ParseNode(\"ordgroup\", expression, this.mode),\n false);\n } else {\n // Otherwise, just return a nucleus\n return this.parseSymbol();\n }\n};\n\n/**\n * Parses a group, which is an expression in brackets (like \"[x+y]\")\n *\n * @return {?ParseFuncOrArgument}\n */\nParser.prototype.parseOptionalGroup = function() {\n // Try to parse an open bracket\n if (this.nextToken.text === \"[\") {\n // If we get a brace, parse an expression\n this.consume();\n var expression = this.parseExpression(false, \"]\");\n // Make sure we get a close bracket\n this.expect(\"]\");\n return new ParseFuncOrArgument(\n new ParseNode(\"ordgroup\", expression, this.mode),\n false);\n } else {\n // Otherwise, return null,\n return null;\n }\n};\n\n/**\n * Parse a single symbol out of the string. Here, we handle both the functions\n * we have defined, as well as the single character symbols\n *\n * @return {?ParseFuncOrArgument}\n */\nParser.prototype.parseSymbol = function() {\n var nucleus = this.nextToken;\n\n if (functions[nucleus.text]) {\n this.consume();\n // If there exists a function with this name, we return the function and\n // say that it is a function.\n return new ParseFuncOrArgument(\n nucleus.text,\n true);\n } else if (symbols[this.mode][nucleus.text]) {\n this.consume();\n // Otherwise if this is a no-argument function, find the type it\n // corresponds to in the symbols map\n return new ParseFuncOrArgument(\n new ParseNode(symbols[this.mode][nucleus.text].group,\n nucleus.text, this.mode),\n false);\n } else {\n return null;\n }\n};\n\nParser.prototype.ParseNode = ParseNode;\n\nmodule.exports = Parser;\n","/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh */\nexports.read = function (buffer, offset, isLE, mLen, nBytes) {\n var e, m\n var eLen = (nBytes * 8) - mLen - 1\n var eMax = (1 << eLen) - 1\n var eBias = eMax >> 1\n var nBits = -7\n var i = isLE ? (nBytes - 1) : 0\n var d = isLE ? -1 : 1\n var s = buffer[offset + i]\n\n i += d\n\n e = s & ((1 << (-nBits)) - 1)\n s >>= (-nBits)\n nBits += eLen\n for (; nBits > 0; e = (e * 256) + buffer[offset + i], i += d, nBits -= 8) {}\n\n m = e & ((1 << (-nBits)) - 1)\n e >>= (-nBits)\n nBits += mLen\n for (; nBits > 0; m = (m * 256) + buffer[offset + i], i += d, nBits -= 8) {}\n\n if (e === 0) {\n e = 1 - eBias\n } else if (e === eMax) {\n return m ? NaN : ((s ? -1 : 1) * Infinity)\n } else {\n m = m + Math.pow(2, mLen)\n e = e - eBias\n }\n return (s ? -1 : 1) * m * Math.pow(2, e - mLen)\n}\n\nexports.write = function (buffer, value, offset, isLE, mLen, nBytes) {\n var e, m, c\n var eLen = (nBytes * 8) - mLen - 1\n var eMax = (1 << eLen) - 1\n var eBias = eMax >> 1\n var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0)\n var i = isLE ? 0 : (nBytes - 1)\n var d = isLE ? 1 : -1\n var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0\n\n value = Math.abs(value)\n\n if (isNaN(value) || value === Infinity) {\n m = isNaN(value) ? 1 : 0\n e = eMax\n } else {\n e = Math.floor(Math.log(value) / Math.LN2)\n if (value * (c = Math.pow(2, -e)) < 1) {\n e--\n c *= 2\n }\n if (e + eBias >= 1) {\n value += rt / c\n } else {\n value += rt * Math.pow(2, 1 - eBias)\n }\n if (value * c >= 2) {\n e++\n c /= 2\n }\n\n if (e + eBias >= eMax) {\n m = 0\n e = eMax\n } else if (e + eBias >= 1) {\n m = ((value * c) - 1) * Math.pow(2, mLen)\n e = e + eBias\n } else {\n m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen)\n e = 0\n }\n }\n\n for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}\n\n e = (e << mLen) | m\n eLen += mLen\n for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}\n\n buffer[offset + i - d] |= s * 128\n}\n","/**\n * This is a module for storing settings passed into KaTeX. It correctly handles\n * default settings.\n */\n\n/**\n * Helper function for getting a default value if the value is undefined\n */\nfunction get(option, defaultValue) {\n return option === undefined ? defaultValue : option;\n}\n\n/**\n * The main Settings object\n *\n * The current options stored are:\n * - displayMode: Whether the expression should be typeset by default in\n * textstyle or displaystyle (default false)\n */\nfunction Settings(options) {\n // allow null options\n options = options || {};\n this.displayMode = get(options.displayMode, false);\n this.throwOnError = get(options.throwOnError, true);\n this.errorColor = get(options.errorColor, \"#cc0000\");\n}\n\nmodule.exports = Settings;\n","/* eslint no-console:0 */\n/**\n * This is the main entry point for KaTeX. Here, we expose functions for\n * rendering expressions either to DOM nodes or to markup strings.\n *\n * We also expose the ParseError class to check if errors thrown from KaTeX are\n * errors in the expression, or errors in javascript handling.\n */\n\nvar ParseError = require(\"./src/ParseError\");\nvar Settings = require(\"./src/Settings\");\n\nvar buildTree = require(\"./src/buildTree\");\nvar parseTree = require(\"./src/parseTree\");\nvar utils = require(\"./src/utils\");\n\n/**\n * Parse and build an expression, and place that expression in the DOM node\n * given.\n */\nvar render = function(expression, baseNode, options) {\n utils.clearNode(baseNode);\n\n var settings = new Settings(options);\n\n var tree = parseTree(expression, settings);\n var node = buildTree(tree, expression, settings).toNode();\n\n baseNode.appendChild(node);\n};\n\n// KaTeX's styles don't work properly in quirks mode. Print out an error, and\n// disable rendering.\nif (typeof document !== \"undefined\") {\n if (document.compatMode !== \"CSS1Compat\") {\n typeof console !== \"undefined\" && console.warn(\n \"Warning: KaTeX doesn't work in quirks mode. Make sure your \" +\n \"website has a suitable doctype.\");\n\n render = function() {\n throw new ParseError(\"KaTeX doesn't work in quirks mode.\");\n };\n }\n}\n\n/**\n * Parse and build an expression, and return the markup for that.\n */\nvar renderToString = function(expression, options) {\n var settings = new Settings(options);\n\n var tree = parseTree(expression, settings);\n return buildTree(tree, expression, settings).toMarkup();\n};\n\n/**\n * Parse an expression and return the parse tree.\n */\nvar generateParseTree = function(expression, options) {\n var settings = new Settings(options);\n return parseTree(expression, settings);\n};\n\nmodule.exports = {\n render: render,\n renderToString: renderToString,\n /**\n * NOTE: This method is not currently recommended for public use.\n * The internal tree representation is unstable and is very likely\n * to change. Use at your own risk.\n */\n __parse: generateParseTree,\n ParseError: ParseError,\n};\n","var toString = {}.toString;\n\nmodule.exports = Array.isArray || function (arr) {\n return toString.call(arr) == '[object Array]';\n};\n","/**\n * The Lexer class handles tokenizing the input in various ways. Since our\n * parser expects us to be able to backtrack, the lexer allows lexing from any\n * given starting point.\n *\n * Its main exposed function is the `lex` function, which takes a position to\n * lex from and a type of token to lex. It defers to the appropriate `_innerLex`\n * function.\n *\n * The various `_innerLex` functions perform the actual lexing of different\n * kinds.\n */\n\nvar matchAt = require(\"match-at\");\n\nvar ParseError = require(\"./ParseError\");\n\n// The main lexer class\nfunction Lexer(input) {\n this._input = input;\n}\n\n// The resulting token returned from `lex`.\nfunction Token(text, data, position) {\n this.text = text;\n this.data = data;\n this.position = position;\n}\n\n/* The following tokenRegex\n * - matches typical whitespace (but not NBSP etc.) using its first group\n * - matches symbol combinations which result in a single output character\n * - does not match any control character \\x00-\\x1f except whitespace\n * - does not match a bare backslash\n * - matches any ASCII character except those just mentioned\n * - does not match the BMP private use area \\uE000-\\uF8FF\n * - does not match bare surrogate code units\n * - matches any BMP character except for those just described\n * - matches any valid Unicode surrogate pair\n * - matches a backslash followed by one or more letters\n * - matches a backslash followed by any BMP character, including newline\n * Just because the Lexer matches something doesn't mean it's valid input:\n * If there is no matching function or symbol definition, the Parser will\n * still reject the input.\n */\nvar tokenRegex = new RegExp(\n \"([ \\r\\n\\t]+)|(\" + // whitespace\n \"---?\" + // special combinations\n \"|[!-\\\\[\\\\]-\\u2027\\u202A-\\uD7FF\\uF900-\\uFFFF]\" + // single codepoint\n \"|[\\uD800-\\uDBFF][\\uDC00-\\uDFFF]\" + // surrogate pair\n \"|\\\\\\\\(?:[a-zA-Z]+|[^\\uD800-\\uDFFF])\" + // function name\n \")\"\n);\n\nvar whitespaceRegex = /\\s*/;\n\n/**\n * This function lexes a single normal token. It takes a position and\n * whether it should completely ignore whitespace or not.\n */\nLexer.prototype._innerLex = function(pos, ignoreWhitespace) {\n var input = this._input;\n if (pos === input.length) {\n return new Token(\"EOF\", null, pos);\n }\n var match = matchAt(tokenRegex, input, pos);\n if (match === null) {\n throw new ParseError(\n \"Unexpected character: '\" + input[pos] + \"'\",\n this, pos);\n } else if (match[2]) { // matched non-whitespace\n return new Token(match[2], null, pos + match[2].length);\n } else if (ignoreWhitespace) {\n return this._innerLex(pos + match[1].length, true);\n } else { // concatenate whitespace to a single space\n return new Token(\" \", null, pos + match[1].length);\n }\n};\n\n// A regex to match a CSS color (like #ffffff or BlueViolet)\nvar cssColor = /#[a-z0-9]+|[a-z]+/i;\n\n/**\n * This function lexes a CSS color.\n */\nLexer.prototype._innerLexColor = function(pos) {\n var input = this._input;\n\n // Ignore whitespace\n var whitespace = matchAt(whitespaceRegex, input, pos)[0];\n pos += whitespace.length;\n\n var match;\n if ((match = matchAt(cssColor, input, pos))) {\n // If we look like a color, return a color\n return new Token(match[0], null, pos + match[0].length);\n } else {\n throw new ParseError(\"Invalid color\", this, pos);\n }\n};\n\n// A regex to match a dimension. Dimensions look like\n// \"1.2em\" or \".4pt\" or \"1 ex\"\nvar sizeRegex = /(-?)\\s*(\\d+(?:\\.\\d*)?|\\.\\d+)\\s*([a-z]{2})/;\n\n/**\n * This function lexes a dimension.\n */\nLexer.prototype._innerLexSize = function(pos) {\n var input = this._input;\n\n // Ignore whitespace\n var whitespace = matchAt(whitespaceRegex, input, pos)[0];\n pos += whitespace.length;\n\n var match;\n if ((match = matchAt(sizeRegex, input, pos))) {\n var unit = match[3];\n // We only currently handle \"em\" and \"ex\" units\n if (unit !== \"em\" && unit !== \"ex\") {\n throw new ParseError(\"Invalid unit: '\" + unit + \"'\", this, pos);\n }\n return new Token(match[0], {\n number: +(match[1] + match[2]),\n unit: unit,\n }, pos + match[0].length);\n }\n\n throw new ParseError(\"Invalid size\", this, pos);\n};\n\n/**\n * This function lexes a string of whitespace.\n */\nLexer.prototype._innerLexWhitespace = function(pos) {\n var input = this._input;\n\n var whitespace = matchAt(whitespaceRegex, input, pos)[0];\n pos += whitespace.length;\n\n return new Token(whitespace[0], null, pos);\n};\n\n/**\n * This function lexes a single token starting at `pos` and of the given mode.\n * Based on the mode, we defer to one of the `_innerLex` functions.\n */\nLexer.prototype.lex = function(pos, mode) {\n if (mode === \"math\") {\n return this._innerLex(pos, true);\n } else if (mode === \"text\") {\n return this._innerLex(pos, false);\n } else if (mode === \"color\") {\n return this._innerLexColor(pos);\n } else if (mode === \"size\") {\n return this._innerLexSize(pos);\n } else if (mode === \"whitespace\") {\n return this._innerLexWhitespace(pos);\n }\n};\n\nmodule.exports = Lexer;\n"],"sourceRoot":""}