UNPKG

@andatoshiki/toshiki-cdn

Version:
2 lines 171 kB
(function(e){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=e()}else if(typeof define==="function"&&define.amd){define([],e)}else{var t;if(typeof window!=="undefined"){t=window}else if(typeof global!=="undefined"){t=global}else if(typeof self!=="undefined"){t=self}else{t=this}t.katex=e()}})(function(){var e,t,i;return function h(e,t,i){function a(l,s){if(!t[l]){if(!e[l]){var p=typeof require=="function"&&require;if(!s&&p)return p(l,!0);if(r)return r(l,!0);var c=new Error("Cannot find module '"+l+"'");throw c.code="MODULE_NOT_FOUND",c}var n=t[l]={exports:{}};e[l][0].call(n.exports,function(t){var i=e[l][1][t];return a(i?i:t)},n,n.exports,h,e,t,i)}return t[l].exports}var r=typeof require=="function"&&require;for(var l=0;l<i.length;l++)a(i[l]);return a}({1:[function(e,t,i){var h=e("./katexsrc/ParseError");var a=e("./katexsrc/Settings");var r=e("./katexsrc/buildTree");var l=e("./katexsrc/parseTree");var s=e("./katexsrc/utils");var p=function(e,t,i){s.clearNode(t);var h=new a(i);var p=l(e,h);var c=r(p,e,h).toNode();t.appendChild(c)};if(typeof document!=="undefined"){if(document.compatMode!=="CSS1Compat"){typeof console!=="undefined"&&console.warn("Warning: KaTeX doesn't work in quirks mode. Make sure your "+"website has a suitable doctype.");p=function(){throw new h("KaTeX doesn't work in quirks mode.")}}}var c=function(e,t){var i=new a(t);var h=l(e,i);return r(h,e,i).toMarkup()};var n=function(e,t){var i=new a(t);return l(e,i)};t.exports={render:p,renderToString:c,__parse:n,ParseError:h}},{"./katexsrc/ParseError":5,"./katexsrc/Settings":7,"./katexsrc/buildTree":12,"./katexsrc/parseTree":21,"./katexsrc/utils":23}],2:[function(e,t,i){"use strict";function h(e){if(!e.__matchAtRelocatable){var t=e.source+"|()";var i="g"+(e.ignoreCase?"i":"")+(e.multiline?"m":"")+(e.unicode?"u":"");e.__matchAtRelocatable=new RegExp(t,i)}return e.__matchAtRelocatable}function a(e,t,i){if(e.global||e.sticky){throw new Error("matchAt(...): Only non-global regexes are supported")}var a=h(e);a.lastIndex=i;var r=a.exec(t);if(r[r.length-1]==null){r.length=r.length-1;return r}else{return null}}t.exports=a},{}],3:[function(e,t,i){var h=e("match-at");var a=e("./ParseError");function r(e){this._input=e}function l(e,t,i){this.text=e;this.data=t;this.position=i}var s=[/[/|@.""`0-9a-zA-Z]/,/[*+-]/,/[=<>:]/,/[,;]/,/['\^_{}]/,/[(\[]/,/[)\]?!]/,/~/,/&/,/\\\\/];var p=[/[a-zA-Z0-9`!@*()-=+\[\]'";:?\/.,]/,/[{}]/,/~/,/&/,/\\\\/];var c=/\s*/;var n=/ +|\\ +/;var o=/\\(?:[a-zA-Z]+|.)/;r.prototype._innerLex=function(e,t,i){var r=this._input;var s;if(i){s=h(c,r,e)[0];e+=s.length}else{s=h(n,r,e);if(s!==null){return new l(" ",null,e+s[0].length)}}if(e===r.length){return new l("EOF",null,e)}var p;if(p=h(o,r,e)){return new l(p[0],null,e+p[0].length)}else{for(var g=0;g<t.length;g++){var d=t[g];if(p=h(d,r,e)){return new l(p[0],null,e+p[0].length)}}}throw new a("Unexpected character: '"+r[e]+"'",this,e)};var g=/#[a-z0-9]+|[a-z]+/i;r.prototype._innerLexColor=function(e){var t=this._input;var i=h(c,t,e)[0];e+=i.length;var r;if(r=h(g,t,e)){return new l(r[0],null,e+r[0].length)}else{throw new a("Invalid color",this,e)}};var d=/(-?)\s*(\d+(?:\.\d*)?|\.\d+)\s*([a-z]{2})/;r.prototype._innerLexSize=function(e){var t=this._input;var i=h(c,t,e)[0];e+=i.length;var r;if(r=h(d,t,e)){var s=r[3];if(s!=="em"&&s!=="ex"){throw new a("Invalid unit: '"+s+"'",this,e)}return new l(r[0],{number:+(r[1]+r[2]),unit:s},e+r[0].length)}throw new a("Invalid size",this,e)};r.prototype._innerLexWhitespace=function(e){var t=this._input;var i=h(c,t,e)[0];e+=i.length;return new l(i[0],null,e)};r.prototype.lex=function(e,t){if(t==="math"){return this._innerLex(e,s,true)}else if(t==="text"){return this._innerLex(e,p,false)}else if(t==="color"){return this._innerLexColor(e)}else if(t==="size"){return this._innerLexSize(e)}else if(t==="whitespace"){return this._innerLexWhitespace(e)}};t.exports=r},{"./ParseError":5,"match-at":2}],4:[function(e,t,i){function h(e){this.style=e.style;this.color=e.color;this.size=e.size;this.phantom=e.phantom;this.font=e.font;if(e.parentStyle===undefined){this.parentStyle=e.style}else{this.parentStyle=e.parentStyle}if(e.parentSize===undefined){this.parentSize=e.size}else{this.parentSize=e.parentSize}}h.prototype.extend=function(e){var t={style:this.style,size:this.size,color:this.color,parentStyle:this.style,parentSize:this.size,phantom:this.phantom,font:this.font};for(var i in e){if(e.hasOwnProperty(i)){t[i]=e[i]}}return new h(t)};h.prototype.withStyle=function(e){return this.extend({style:e})};h.prototype.withSize=function(e){return this.extend({size:e})};h.prototype.withColor=function(e){return this.extend({color:e})};h.prototype.withPhantom=function(){return this.extend({phantom:true})};h.prototype.withFont=function(e){return this.extend({font:e})};h.prototype.reset=function(){return this.extend({})};var a={"katex-blue":"#6495ed","katex-orange":"#ffa500","katex-pink":"#ff00af","katex-red":"#df0030","katex-green":"#28ae7b","katex-gray":"gray","katex-purple":"#9d38bd","katex-blueA":"#c7e9f1","katex-blueB":"#9cdceb","katex-blueC":"#58c4dd","katex-blueD":"#29abca","katex-blueE":"#1c758a","katex-tealA":"#acead7","katex-tealB":"#76ddc0","katex-tealC":"#5cd0b3","katex-tealD":"#55c1a7","katex-tealE":"#49a88f","katex-greenA":"#c9e2ae","katex-greenB":"#a6cf8c","katex-greenC":"#83c167","katex-greenD":"#77b05d","katex-greenE":"#699c52","katex-goldA":"#f7c797","katex-goldB":"#f9b775","katex-goldC":"#f0ac5f","katex-goldD":"#e1a158","katex-goldE":"#c78d46","katex-redA":"#f7a1a3","katex-redB":"#ff8080","katex-redC":"#fc6255","katex-redD":"#e65a4c","katex-redE":"#cf5044","katex-maroonA":"#ecabc1","katex-maroonB":"#ec92ab","katex-maroonC":"#c55f73","katex-maroonD":"#a24d61","katex-maroonE":"#94424f","katex-purpleA":"#caa3e8","katex-purpleB":"#b189c6","katex-purpleC":"#9a72ac","katex-purpleD":"#715582","katex-purpleE":"#644172","katex-mintA":"#f5f9e8","katex-mintB":"#edf2df","katex-mintC":"#e0e5cc","katex-grayA":"#fdfdfd","katex-grayB":"#f7f7f7","katex-grayC":"#eeeeee","katex-grayD":"#dddddd","katex-grayE":"#cccccc","katex-grayF":"#aaaaaa","katex-grayG":"#999999","katex-grayH":"#555555","katex-grayI":"#333333","katex-kaBlue":"#314453","katex-kaGreen":"#639b24"};h.prototype.getColor=function(){if(this.phantom){return"transparent"}else{return a[this.color]||this.color}};t.exports=h},{}],5:[function(e,t,i){function h(e,t,i){var a="KaTeX parse error: "+e;if(t!==undefined&&i!==undefined){a+=" at position "+i+": ";var r=t._input;r=r.slice(0,i)+"\u0332"+r.slice(i);var l=Math.max(0,i-15);var s=i+15;a+=r.slice(l,s)}var p=new Error(a);p.name="ParseError";p.__proto__=h.prototype;p.position=i;return p}h.prototype.__proto__=Error.prototype;t.exports=h},{}],6:[function(e,t,i){var h=e("./functions");var a=e("./environments");var r=e("./Lexer");var l=e("./symbols");var s=e("./utils");var p=e("./parseData");var c=e("./ParseError");function n(e,t){this.lexer=new r(e);this.settings=t}var o=p.ParseNode;var g=p.ParseResult;function d(e,t){this.result=e;this.isFunction=t}n.prototype.expect=function(e,t){if(e.text!==t){throw new c("Expected '"+t+"', got '"+e.text+"'",this.lexer,e.position)}};n.prototype.parse=function(e){var t=this.parseInput(0,"math");return t.result};n.prototype.parseInput=function(e,t){var i=this.parseExpression(e,t,false);this.expect(i.peek,"EOF");return i};var w=["}","\\end","\\right","&","\\\\","\\cr"];n.prototype.parseExpression=function(e,t,i,h){var a=[];var r=null;while(true){r=this.lexer.lex(e,t);if(w.indexOf(r.text)!==-1){break}if(h&&r.text===h){break}var l=this.parseAtom(e,t);if(!l){if(!this.settings.throwOnError&&r.text[0]==="\\"){var s=this.handleUnsupportedCmd(r.text,t);a.push(s);e=r.position;continue}break}if(i&&l.result.type==="infix"){break}a.push(l.result);e=l.position}var p=new g(this.handleInfixNodes(a,t),e);p.peek=r;return p};n.prototype.handleInfixNodes=function(e,t){var i=-1;var a;var r;for(var l=0;l<e.length;l++){var s=e[l];if(s.type==="infix"){if(i!==-1){throw new c("only one infix operator per group",this.lexer,-1)}i=l;r=s.value.replaceWith;a=h.funcs[r]}}if(i!==-1){var p,n;var g=e.slice(0,i);var d=e.slice(i+1);if(g.length===1&&g[0].type==="ordgroup"){p=g[0]}else{p=new o("ordgroup",g,t)}if(d.length===1&&d[0].type==="ordgroup"){n=d[0]}else{n=new o("ordgroup",d,t)}var w=a.handler(r,p,n);return[new o(w.type,w,t)]}else{return e}};var u=1;n.prototype.handleSupSubscript=function(e,t,i,a){var r=this.parseGroup(e,t);if(!r){var l=this.lexer.lex(e,t);if(!this.settings.throwOnError&&l.text[0]==="\\"){return new g(this.handleUnsupportedCmd(l.text,t),l.position)}else{throw new c("Expected group after '"+i+"'",this.lexer,e)}}else if(r.isFunction){var s=h.funcs[r.result.result].greediness;if(s>u){return this.parseFunction(e,t)}else{throw new c("Got function '"+r.result.result+"' with no arguments "+"as "+a,this.lexer,e)}}else{return r.result}};n.prototype.handleUnsupportedCmd=function(e,t){var i=[];for(var h=0;h<e.length;h++){i.push(new o("textord",e[h],"text"))}var a=new o("text",{body:i,type:"text"},t);var r=new o("color",{color:this.settings.errorColor,value:[a],type:"color"},t);return r};n.prototype.parseAtom=function(e,t){var i=this.parseImplicitGroup(e,t);if(t==="text"){return i}var h;if(!i){h=e;i=undefined}else{h=i.position}var a;var r;var l;while(true){var s=this.lexer.lex(h,t);if(s.text==="\\limits"||s.text==="\\nolimits"){if(!i||i.result.type!=="op"){throw new c("Limit controls must follow a math operator",this.lexer,h)}else{var p=s.text==="\\limits";i.result.value.limits=p;i.result.value.alwaysHandleSupSub=true;h=s.position}}else if(s.text==="^"){if(a){throw new c("Double superscript",this.lexer,h)}l=this.handleSupSubscript(s.position,t,s.text,"superscript");h=l.position;a=l.result}else if(s.text==="_"){if(r){throw new c("Double subscript",this.lexer,h)}l=this.handleSupSubscript(s.position,t,s.text,"subscript");h=l.position;r=l.result}else if(s.text==="'"){var n=new o("textord","\\prime",t);var d=[n];h=s.position;while((s=this.lexer.lex(h,t)).text==="'"){d.push(n);h=s.position}a=new o("ordgroup",d,t)}else{break}}if(a||r){return new g(new o("supsub",{base:i&&i.result,sup:a,sub:r},t),h)}else{return i}};var k=["\\tiny","\\scriptsize","\\footnotesize","\\small","\\normalsize","\\large","\\Large","\\LARGE","\\huge","\\Huge"];var m=["\\displaystyle","\\textstyle","\\scriptstyle","\\scriptscriptstyle"];n.prototype.parseImplicitGroup=function(e,t){var i=this.parseSymbol(e,t);if(!i||!i.result){return this.parseFunction(e,t)}var h=i.result.result;var r;if(h==="\\left"){var l=this.parseFunction(e,t);r=this.parseExpression(l.position,t,false);this.expect(r.peek,"\\right");var p=this.parseFunction(r.position,t);return new g(new o("leftright",{body:r.result,left:l.result.value.value,right:p.result.value.value},t),p.position)}else if(h==="\\begin"){var n=this.parseFunction(e,t);var d=n.result.value.name;if(!a.hasOwnProperty(d)){throw new c("No such environment: "+d,this.lexer,n.result.value.namepos)}var w=a[d];var u=[null,t,d];var f=this.parseArguments(n.position,t,"\\begin{"+d+"}",w,u);u[0]=f;var v=w.handler.apply(this,u);var y=this.lexer.lex(v.position,t);this.expect(y,"\\end");var x=this.parseFunction(v.position,t);if(x.result.value.name!==d){throw new c("Mismatch: \\begin{"+d+"} matched "+"by \\end{"+x.result.value.name+"}",this.lexer,x.namepos)}v.position=x.position;return v}else if(s.contains(k,h)){r=this.parseExpression(i.result.position,t,false);return new g(new o("sizing",{size:"size"+(s.indexOf(k,h)+1),value:r.result},t),r.position)}else if(s.contains(m,h)){r=this.parseExpression(i.result.position,t,true);return new g(new o("styling",{style:h.slice(1,h.length-5),value:r.result},t),r.position)}else{return this.parseFunction(e,t)}};n.prototype.parseFunction=function(e,t){var i=this.parseGroup(e,t);if(i){if(i.isFunction){var a=i.result.result;var r=h.funcs[a];if(t==="text"&&!r.allowedInText){throw new c("Can't use function '"+a+"' in text mode",this.lexer,i.position)}var l=[a];var s=this.parseArguments(i.result.position,t,a,r,l);var p=h.funcs[a].handler.apply(this,l);return new g(new o(p.type,p,t),s)}else{return i.result}}else{return null}};n.prototype.parseArguments=function(e,t,i,a,r){var l=a.numArgs+a.numOptionalArgs;if(l===0){return e}var s=e;var p=a.greediness;var n=[s];for(var o=0;o<l;o++){var w=a.argTypes&&a.argTypes[o];var u;if(o<a.numOptionalArgs){if(w){u=this.parseSpecialGroup(s,w,t,true)}else{u=this.parseOptionalGroup(s,t)}if(!u){r.push(null);n.push(s);continue}}else{if(w){u=this.parseSpecialGroup(s,w,t)}else{u=this.parseGroup(s,t)}if(!u){var k=this.lexer.lex(s,t);if(!this.settings.throwOnError&&k.text[0]==="\\"){u=new d(new g(this.handleUnsupportedCmd(k.text,t),k.position),false)}else{throw new c("Expected group after '"+i+"'",this.lexer,e)}}}var m;if(u.isFunction){var f=h.funcs[u.result.result].greediness;if(f>p){m=this.parseFunction(s,t)}else{throw new c("Got function '"+u.result.result+"' as "+"argument to '"+i+"'",this.lexer,u.result.position-1)}}else{m=u.result}r.push(m.result);n.push(m.position);s=m.position}r.push(n);return s};n.prototype.parseSpecialGroup=function(e,t,i,h){if(t==="original"){t=i}if(t==="color"||t==="size"){var a=this.lexer.lex(e,i);if(h&&a.text!=="["){return null}this.expect(a,h?"[":"{");var r=this.lexer.lex(a.position,t);var l;if(t==="color"){l=r.text}else{l=r.data}var s=this.lexer.lex(r.position,i);this.expect(s,h?"]":"}");return new d(new g(new o(t,l,i),s.position),false)}else if(t==="text"){var p=this.lexer.lex(e,"whitespace");e=p.position}if(h){return this.parseOptionalGroup(e,t)}else{return this.parseGroup(e,t)}};n.prototype.parseGroup=function(e,t){var i=this.lexer.lex(e,t);if(i.text==="{"){var h=this.parseExpression(i.position,t,false);var a=this.lexer.lex(h.position,t);this.expect(a,"}");return new d(new g(new o("ordgroup",h.result,t),a.position),false)}else{return this.parseSymbol(e,t)}};n.prototype.parseOptionalGroup=function(e,t){var i=this.lexer.lex(e,t);if(i.text==="["){var h=this.parseExpression(i.position,t,false,"]");var a=this.lexer.lex(h.position,t);this.expect(a,"]");return new d(new g(new o("ordgroup",h.result,t),a.position),false)}else{return null}};n.prototype.parseSymbol=function(e,t){var i=this.lexer.lex(e,t);if(h.funcs[i.text]){return new d(new g(i.text,i.position),true)}else if(l[t][i.text]){return new d(new g(new o(l[t][i.text].group,i.text,t),i.position),false)}else{return null}};n.prototype.ParseNode=o;t.exports=n},{"./Lexer":3,"./ParseError":5,"./environments":15,"./functions":18,"./parseData":20,"./symbols":22,"./utils":23}],7:[function(e,t,i){function h(e,t){return e===undefined?t:e}function a(e){e=e||{};this.displayMode=h(e.displayMode,false);this.throwOnError=h(e.throwOnError,true);this.errorColor=h(e.errorColor,"#cc0000")}t.exports=a},{}],8:[function(e,t,i){function h(e,t,i,h){this.id=e;this.size=t;this.cramped=h;this.sizeMultiplier=i}h.prototype.sup=function(){return w[u[this.id]]};h.prototype.sub=function(){return w[k[this.id]]};h.prototype.fracNum=function(){return w[m[this.id]]};h.prototype.fracDen=function(){return w[f[this.id]]};h.prototype.cramp=function(){return w[v[this.id]]};h.prototype.cls=function(){return g[this.size]+(this.cramped?" cramped":" uncramped")};h.prototype.reset=function(){return d[this.size]};var a=0;var r=1;var l=2;var s=3;var p=4;var c=5;var n=6;var o=7;var g=["displaystyle textstyle","textstyle","scriptstyle","scriptscriptstyle"];var d=["reset-textstyle","reset-textstyle","reset-scriptstyle","reset-scriptscriptstyle"];var w=[new h(a,0,1,false),new h(r,0,1,true),new h(l,1,1,false),new h(s,1,1,true),new h(p,2,.7,false),new h(c,2,.7,true),new h(n,3,.5,false),new h(o,3,.5,true)];var u=[p,c,p,c,n,o,n,o];var k=[c,c,c,c,o,o,o,o];var m=[l,s,p,c,n,o,n,o];var f=[s,s,c,c,o,o,o,o];var v=[r,r,s,s,c,c,o,o];t.exports={DISPLAY:w[a],TEXT:w[l],SCRIPT:w[p],SCRIPTSCRIPT:w[n]}},{}],9:[function(e,t,i){var h=e("./domTree");var a=e("./fontMetrics");var r=e("./symbols");var l=e("./utils");var s=["\\Gamma","\\Delta","\\Theta","\\Lambda","\\Xi","\\Pi","\\Sigma","\\Upsilon","\\Phi","\\Psi","\\Omega"];var p=["\u0131","\u0237"];var c=function(e,t,i,l,s){if(r[i][e]&&r[i][e].replace){e=r[i][e].replace}var p=a.getCharacterMetrics(e,t);var c;if(p){c=new h.symbolNode(e,p.height,p.depth,p.italic,p.skew,s)}else{typeof console!=="undefined"&&console.warn("No character metrics for '"+e+"' in style '"+t+"'");c=new h.symbolNode(e,0,0,0,0,s)}if(l){c.style.color=l}return c};var n=function(e,t,i,h){if(e==="\\"||r[t][e].font==="main"){return c(e,"Main-Regular",t,i,h)}else{return c(e,"AMS-Regular",t,i,h.concat(["amsrm"]))}};var o=function(e,t,i,h,a){if(a==="mathord"){return g(e,t,i,h)}else if(a==="textord"){return c(e,"Main-Regular",t,i,h.concat(["mathrm"]))}else{throw new Error("unexpected type: "+a+" in mathDefault")}};var g=function(e,t,i,h){if(/[0-9]/.test(e.charAt(0))||l.contains(p,e)||l.contains(s,e)){return c(e,"Main-Italic",t,i,h.concat(["mainit"]))}else{return c(e,"Math-Italic",t,i,h.concat(["mathit"]))}};var d=function(e,t,i){var h=e.mode;var s=e.value;if(r[h][s]&&r[h][s].replace){s=r[h][s].replace}var n=["mord"];var d=t.getColor();var w=t.font;if(w){if(w==="mathit"||l.contains(p,s)){return g(s,h,d,n)}else{var u=x[w].fontName;if(a.getCharacterMetrics(s,u)){return c(s,u,h,d,n.concat([w]))}else{return o(s,h,d,n,i)}}}else{return o(s,h,d,n,i)}};var w=function(e){var t=0;var i=0;var h=0;if(e.children){for(var a=0;a<e.children.length;a++){if(e.children[a].height>t){t=e.children[a].height}if(e.children[a].depth>i){i=e.children[a].depth}if(e.children[a].maxFontSize>h){h=e.children[a].maxFontSize}}}e.height=t;e.depth=i;e.maxFontSize=h};var u=function(e,t,i){var a=new h.span(e,t);w(a);if(i){a.style.color=i}return a};var k=function(e){var t=new h.documentFragment(e);w(t);return t};var m=function(e,t){var i=u([],[new h.symbolNode("\u200b")]);i.style.fontSize=t/e.style.sizeMultiplier+"em";var a=u(["fontsize-ensurer","reset-"+e.size,"size5"],[i]);return a};var f=function(e,t,i,a){var r;var l;var s;if(t==="individualShift"){var p=e;e=[p[0]];r=-p[0].shift-p[0].elem.depth;l=r;for(s=1;s<p.length;s++){var c=-p[s].shift-l-p[s].elem.depth;var n=c-(p[s-1].elem.height+p[s-1].elem.depth);l=l+c;e.push({type:"kern",size:n});e.push(p[s])}}else if(t==="top"){var o=i;for(s=0;s<e.length;s++){if(e[s].type==="kern"){o-=e[s].size}else{o-=e[s].elem.height+e[s].elem.depth}}r=o}else if(t==="bottom"){r=-i}else if(t==="shift"){r=-e[0].elem.depth-i}else if(t==="firstBaseline"){r=-e[0].elem.depth}else{r=0}var g=0;for(s=0;s<e.length;s++){if(e[s].type==="elem"){g=Math.max(g,e[s].elem.maxFontSize)}}var d=m(a,g);var w=[];l=r;for(s=0;s<e.length;s++){if(e[s].type==="kern"){l+=e[s].size}else{var k=e[s].elem;var f=-k.depth-l;l+=k.height+k.depth;var v=u([],[d,k]);v.height-=f;v.depth+=f;v.style.top=f+"em";w.push(v)}}var y=u(["baseline-fix"],[d,new h.symbolNode("\u200b")]);w.push(y);var x=u(["vlist"],w);x.height=Math.max(l,x.height);x.depth=Math.max(-r,x.depth);return x};var v={size1:.5,size2:.7,size3:.8,size4:.9,size5:1,size6:1.2,size7:1.44,size8:1.73,size9:2.07,size10:2.49};var y={"\\qquad":{size:"2em",className:"qquad"},"\\quad":{size:"1em",className:"quad"},"\\enspace":{size:"0.5em",className:"enspace"},"\\;":{size:"0.277778em",className:"thickspace"},"\\:":{size:"0.22222em",className:"mediumspace"},"\\,":{size:"0.16667em",className:"thinspace"},"\\!":{size:"-0.16667em",className:"negativethinspace"}};var x={mathbf:{variant:"bold",fontName:"Main-Bold"},mathrm:{variant:"normal",fontName:"Main-Regular"},mathbb:{variant:"double-struck",fontName:"AMS-Regular"},mathcal:{variant:"script",fontName:"Caligraphic-Regular"},mathfrak:{variant:"fraktur",fontName:"Fraktur-Regular"},mathscr:{variant:"script",fontName:"Script-Regular"},mathsf:{variant:"sans-serif",fontName:"SansSerif-Regular"},mathtt:{variant:"monospace",fontName:"Typewriter-Regular"}};t.exports={fontMap:x,makeSymbol:c,mathsym:n,makeSpan:u,makeFragment:k,makeVList:f,makeOrd:d,sizingMultiplier:v,spacingFunctions:y}},{"./domTree":14,"./fontMetrics":16,"./symbols":22,"./utils":23}],10:[function(e,t,i){var h=e("./ParseError");var a=e("./Style");var r=e("./buildCommon");var l=e("./delimiter");var s=e("./domTree");var p=e("./fontMetrics");var c=e("./utils");var n=r.makeSpan;var o=function(e,t,i){var h=[];for(var a=0;a<e.length;a++){var r=e[a];h.push(v(r,t,i));i=r}return h};var g={mathord:"mord",textord:"mord",bin:"mbin",rel:"mrel",text:"mord",open:"mopen",close:"mclose",inner:"minner",genfrac:"mord",array:"mord",spacing:"mord",punct:"mpunct",ordgroup:"mord",op:"mop",katex:"mord",overline:"mord",rule:"mord",leftright:"minner",sqrt:"mord",accent:"mord"};var d=function(e){if(e==null){return g.mathord}else if(e.type==="supsub"){return d(e.value.base)}else if(e.type==="llap"||e.type==="rlap"){return d(e.value)}else if(e.type==="color"){return d(e.value.value)}else if(e.type==="sizing"){return d(e.value.value)}else if(e.type==="styling"){return d(e.value.value)}else if(e.type==="delimsizing"){return g[e.value.delimType]}else{return g[e.type]}};var w=function(e,t){if(!e){return false}else if(e.type==="op"){return e.value.limits&&(t.style.size===a.DISPLAY.size||e.value.alwaysHandleSupSub)}else if(e.type==="accent"){return k(e.value.base)}else{return null}};var u=function(e){if(!e){return false}else if(e.type==="ordgroup"){if(e.value.length===1){return u(e.value[0])}else{return e}}else if(e.type==="color"){if(e.value.value.length===1){return u(e.value.value[0])}else{return e}}else{return e}};var k=function(e){var t=u(e);return t.type==="mathord"||t.type==="textord"||t.type==="bin"||t.type==="rel"||t.type==="inner"||t.type==="open"||t.type==="close"||t.type==="punct"};var m=function(e){return n(["sizing","reset-"+e.size,"size5",e.style.reset(),a.TEXT.cls(),"nulldelimiter"])};var f={mathord:function(e,t,i){return r.makeOrd(e,t,"mathord")},textord:function(e,t,i){return r.makeOrd(e,t,"textord")},bin:function(e,t,i){var h="mbin";var a=i;while(a&&a.type==="color"){var l=a.value.value;a=l[l.length-1]}if(!i||c.contains(["mbin","mopen","mrel","mop","mpunct"],d(a))){e.type="textord";h="mord"}return r.mathsym(e.value,e.mode,t.getColor(),[h])},rel:function(e,t,i){return r.mathsym(e.value,e.mode,t.getColor(),["mrel"])},open:function(e,t,i){return r.mathsym(e.value,e.mode,t.getColor(),["mopen"])},close:function(e,t,i){return r.mathsym(e.value,e.mode,t.getColor(),["mclose"])},inner:function(e,t,i){return r.mathsym(e.value,e.mode,t.getColor(),["minner"])},punct:function(e,t,i){return r.mathsym(e.value,e.mode,t.getColor(),["mpunct"])},ordgroup:function(e,t,i){return n(["mord",t.style.cls()],o(e.value,t.reset()))},text:function(e,t,i){return n(["text","mord",t.style.cls()],o(e.value.body,t.reset()))},color:function(e,t,i){var h=o(e.value.value,t.withColor(e.value.color),i);return new r.makeFragment(h)},supsub:function(e,t,i){if(w(e.value.base,t)){return f[e.value.base.type](e,t,i)}var h=v(e.value.base,t.reset());var l,c,o,g;if(e.value.sup){o=v(e.value.sup,t.withStyle(t.style.sup()));l=n([t.style.reset(),t.style.sup().cls()],[o])}if(e.value.sub){g=v(e.value.sub,t.withStyle(t.style.sub()));c=n([t.style.reset(),t.style.sub().cls()],[g])}var u,m;if(k(e.value.base)){u=0;m=0}else{u=h.height-p.metrics.supDrop;m=h.depth+p.metrics.subDrop}var y;if(t.style===a.DISPLAY){y=p.metrics.sup1}else if(t.style.cramped){y=p.metrics.sup3}else{y=p.metrics.sup2}var x=a.TEXT.sizeMultiplier*t.style.sizeMultiplier;var b=.5/p.metrics.ptPerEm/x+"em";var z;if(!e.value.sup){m=Math.max(m,p.metrics.sub1,g.height-.8*p.metrics.xHeight);z=r.makeVList([{type:"elem",elem:c}],"shift",m,t);z.children[0].style.marginRight=b;if(h instanceof s.symbolNode){z.children[0].style.marginLeft=-h.italic+"em"}}else if(!e.value.sub){u=Math.max(u,y,o.depth+.25*p.metrics.xHeight);z=r.makeVList([{type:"elem",elem:l}],"shift",-u,t);z.children[0].style.marginRight=b}else{u=Math.max(u,y,o.depth+.25*p.metrics.xHeight);m=Math.max(m,p.metrics.sub2);var S=p.metrics.defaultRuleThickness;if(u-o.depth-(g.height-m)<4*S){m=4*S-(u-o.depth)+g.height;var M=.8*p.metrics.xHeight-(u-o.depth);if(M>0){u+=M;m-=M}}z=r.makeVList([{type:"elem",elem:c,shift:m},{type:"elem",elem:l,shift:-u}],"individualShift",null,t);if(h instanceof s.symbolNode){z.children[0].style.marginLeft=-h.italic+"em"}z.children[0].style.marginRight=b;z.children[1].style.marginRight=b}return n([d(e.value.base)],[h,z])},genfrac:function(e,t,i){var h=t.style;if(e.value.size==="display"){h=a.DISPLAY}else if(e.value.size==="text"){h=a.TEXT}var s=h.fracNum();var c=h.fracDen();var o=v(e.value.numer,t.withStyle(s));var g=n([h.reset(),s.cls()],[o]);var d=v(e.value.denom,t.withStyle(c));var w=n([h.reset(),c.cls()],[d]);var u;if(e.value.hasBarLine){u=p.metrics.defaultRuleThickness/t.style.sizeMultiplier}else{u=0}var k;var f;var y;if(h.size===a.DISPLAY.size){k=p.metrics.num1;if(u>0){f=3*u}else{f=7*p.metrics.defaultRuleThickness}y=p.metrics.denom1}else{if(u>0){k=p.metrics.num2;f=u}else{k=p.metrics.num3;f=3*p.metrics.defaultRuleThickness}y=p.metrics.denom2}var x;if(u===0){var b=k-o.depth-(d.height-y);if(b<f){k+=.5*(f-b);y+=.5*(f-b)}x=r.makeVList([{type:"elem",elem:w,shift:y},{type:"elem",elem:g,shift:-k}],"individualShift",null,t)}else{var z=p.metrics.axisHeight;if(k-o.depth-(z+.5*u)<f){k+=f-(k-o.depth-(z+.5*u))}if(z-.5*u-(d.height-y)<f){y+=f-(z-.5*u-(d.height-y))}var S=n([t.style.reset(),a.TEXT.cls(),"frac-line"]);S.height=u;var M=-(z-.5*u);x=r.makeVList([{type:"elem",elem:w,shift:y},{type:"elem",elem:S,shift:M},{type:"elem",elem:g,shift:-k}],"individualShift",null,t)}x.height*=h.sizeMultiplier/t.style.sizeMultiplier;x.depth*=h.sizeMultiplier/t.style.sizeMultiplier;var q;if(h.size===a.DISPLAY.size){q=p.metrics.delim1}else{q=p.metrics.getDelim2(h)}var A,T;if(e.value.leftDelim==null){A=m(t)}else{A=l.customSizedDelim(e.value.leftDelim,q,true,t.withStyle(h),e.mode)}if(e.value.rightDelim==null){T=m(t)}else{T=l.customSizedDelim(e.value.rightDelim,q,true,t.withStyle(h),e.mode)}return n(["mord",t.style.reset(),h.cls()],[A,n(["mfrac"],[x]),T],t.getColor())},array:function(e,t,i){var a,l;var s=e.value.body.length;var o=0;var g=new Array(s);var d=1/p.metrics.ptPerEm;var w=5*d;var u=12*d;var k=c.deflt(e.value.arraystretch,1);var m=k*u;var f=.7*m;var y=.3*m;var x=0;for(a=0;a<e.value.body.length;++a){var b=e.value.body[a];var z=f;var S=y;if(o<b.length){o=b.length}var M=new Array(b.length);for(l=0;l<b.length;++l){var q=v(b[l],t);if(S<q.depth){S=q.depth}if(z<q.height){z=q.height}M[l]=q}var A=0;if(e.value.rowGaps[a]){A=e.value.rowGaps[a].value;switch(A.unit){case"em":A=A.number;break;case"ex":A=A.number*p.metrics.emPerEx;break;default:console.error("Can't handle unit "+A.unit);A=0}if(A>0){A+=y;if(S<A){S=A}A=0}}M.height=z;M.depth=S;x+=z;M.pos=x;x+=S+A;g[a]=M}var T=x/2+p.metrics.axisHeight;var N=e.value.cols||[];var C=[];var R;var E;for(l=0,E=0;l<o||E<N.length;++l,++E){var P=N[E]||{};var D=true;while(P.type==="separator"){if(!D){R=n(["arraycolsep"],[]);R.style.width=p.metrics.doubleRuleSep+"em";C.push(R)}if(P.separator==="|"){var L=n(["vertical-separator"],[]);L.style.height=x+"em";L.style.verticalAlign=-(x-T)+"em";C.push(L)}else{throw new h("Invalid separator type: "+P.separator)}E++;P=N[E]||{};D=false}if(l>=o){continue}var O;if(l>0||e.value.hskipBeforeAndAfter){O=c.deflt(P.pregap,w);if(O!==0){R=n(["arraycolsep"],[]);R.style.width=O+"em";C.push(R)}}var I=[];for(a=0;a<s;++a){var B=g[a];var F=B[l];if(!F){continue}var _=B.pos-T;F.depth=B.depth;F.height=B.height;I.push({type:"elem",elem:F,shift:_})}I=r.makeVList(I,"individualShift",null,t);I=n(["col-align-"+(P.align||"c")],[I]);C.push(I);if(l<o-1||e.value.hskipBeforeAndAfter){O=c.deflt(P.postgap,w);if(O!==0){R=n(["arraycolsep"],[]);R.style.width=O+"em";C.push(R)}}}g=n(["mtable"],C);return n(["mord"],[g],t.getColor())},spacing:function(e,t,i){if(e.value==="\\ "||e.value==="\\space"||e.value===" "||e.value==="~"){return n(["mord","mspace"],[r.mathsym(e.value,e.mode)])}else{return n(["mord","mspace",r.spacingFunctions[e.value].className])}},llap:function(e,t,i){var h=n(["inner"],[v(e.value.body,t.reset())]);var a=n(["fix"],[]);return n(["llap",t.style.cls()],[h,a])},rlap:function(e,t,i){var h=n(["inner"],[v(e.value.body,t.reset())]);var a=n(["fix"],[]);return n(["rlap",t.style.cls()],[h,a])},op:function(e,t,i){var h;var l;var s=false;if(e.type==="supsub"){h=e.value.sup;l=e.value.sub;e=e.value.base;s=true}var o=["\\smallint"];var g=false;if(t.style.size===a.DISPLAY.size&&e.value.symbol&&!c.contains(o,e.value.body)){g=true}var d;var w=0;var u=0;if(e.value.symbol){var k=g?"Size2-Regular":"Size1-Regular";d=r.makeSymbol(e.value.body,k,"math",t.getColor(),["op-symbol",g?"large-op":"small-op","mop"]);w=(d.height-d.depth)/2-p.metrics.axisHeight*t.style.sizeMultiplier;u=d.italic}else{var m=[];for(var f=1;f<e.value.body.length;f++){m.push(r.mathsym(e.value.body[f],e.mode))}d=n(["mop"],m,t.getColor())}if(s){d=n([],[d]);var y,x,b,z;if(h){var S=v(h,t.withStyle(t.style.sup()));y=n([t.style.reset(),t.style.sup().cls()],[S]);x=Math.max(p.metrics.bigOpSpacing1,p.metrics.bigOpSpacing3-S.depth)}if(l){var M=v(l,t.withStyle(t.style.sub()));b=n([t.style.reset(),t.style.sub().cls()],[M]);z=Math.max(p.metrics.bigOpSpacing2,p.metrics.bigOpSpacing4-M.height)}var q,A,T;if(!h){A=d.height-w;q=r.makeVList([{type:"kern",size:p.metrics.bigOpSpacing5},{type:"elem",elem:b},{type:"kern",size:z},{type:"elem",elem:d}],"top",A,t);q.children[0].style.marginLeft=-u+"em"}else if(!l){T=d.depth+w;q=r.makeVList([{type:"elem",elem:d},{type:"kern",size:x},{type:"elem",elem:y},{type:"kern",size:p.metrics.bigOpSpacing5}],"bottom",T,t);q.children[1].style.marginLeft=u+"em"}else if(!h&&!l){return d}else{T=p.metrics.bigOpSpacing5+b.height+b.depth+z+d.depth+w;q=r.makeVList([{type:"kern",size:p.metrics.bigOpSpacing5},{type:"elem",elem:b},{type:"kern",size:z},{type:"elem",elem:d},{type:"kern",size:x},{type:"elem",elem:y},{type:"kern",size:p.metrics.bigOpSpacing5}],"bottom",T,t);q.children[0].style.marginLeft=-u+"em";q.children[2].style.marginLeft=u+"em"}return n(["mop","op-limits"],[q])}else{if(e.value.symbol){d.style.top=w+"em"}return d}},katex:function(e,t,i){var h=n(["k"],[r.mathsym("K",e.mode)]);var a=n(["a"],[r.mathsym("A",e.mode)]);a.height=(a.height+.2)*.75;a.depth=(a.height-.2)*.75;var l=n(["t"],[r.mathsym("T",e.mode)]);var s=n(["e"],[r.mathsym("E",e.mode)]);s.height=s.height-.2155;s.depth=s.depth+.2155;var p=n(["x"],[r.mathsym("X",e.mode)]);return n(["katex-logo","mord"],[h,a,l,s,p],t.getColor())},overline:function(e,t,i){var h=v(e.value.body,t.withStyle(t.style.cramp()));var l=p.metrics.defaultRuleThickness/t.style.sizeMultiplier;var s=n([t.style.reset(),a.TEXT.cls(),"overline-line"]);s.height=l;s.maxFontSize=1;var c=r.makeVList([{type:"elem",elem:h},{type:"kern",size:3*l},{type:"elem",elem:s},{type:"kern",size:l}],"firstBaseline",null,t);return n(["overline","mord"],[c],t.getColor())},sqrt:function(e,t,i){var h=v(e.value.body,t.withStyle(t.style.cramp()));var s=p.metrics.defaultRuleThickness/t.style.sizeMultiplier;var c=n([t.style.reset(),a.TEXT.cls(),"sqrt-line"],[],t.getColor());c.height=s;c.maxFontSize=1;var o=s;if(t.style.id<a.TEXT.id){o=p.metrics.xHeight}var g=s+o/4;var d=(h.height+h.depth)*t.style.sizeMultiplier;var w=d+g+s;var u=n(["sqrt-sign"],[l.customSizedDelim("\\surd",w,false,t,e.mode)],t.getColor());var k=u.height+u.depth-s;if(k>h.height+h.depth+g){g=(g+k-h.height-h.depth)/2}var m=-(h.height+g+s)+u.height;u.style.top=m+"em";u.height-=m;u.depth+=m;var f;if(h.height===0&&h.depth===0){f=n()}else{f=r.makeVList([{type:"elem",elem:h},{type:"kern",size:g},{type:"elem",elem:c},{type:"kern",size:s}],"firstBaseline",null,t)}if(!e.value.index){return n(["sqrt","mord"],[u,f])}else{var y=v(e.value.index,t.withStyle(a.SCRIPTSCRIPT));var x=n([t.style.reset(),a.SCRIPTSCRIPT.cls()],[y]);var b=Math.max(u.height,f.height);var z=Math.max(u.depth,f.depth);var S=.6*(b-z);var M=r.makeVList([{type:"elem",elem:x}],"shift",-S,t);var q=n(["root"],[M]);return n(["sqrt","mord"],[q,u,f])}},sizing:function(e,t,i){var h=o(e.value.value,t.withSize(e.value.size),i);var a=n(["mord"],[n(["sizing","reset-"+t.size,e.value.size,t.style.cls()],h)]);var l=r.sizingMultiplier[e.value.size];a.maxFontSize=l*t.style.sizeMultiplier; return a},styling:function(e,t,i){var h={display:a.DISPLAY,text:a.TEXT,script:a.SCRIPT,scriptscript:a.SCRIPTSCRIPT};var r=h[e.value.style];var l=o(e.value.value,t.withStyle(r),i);return n([t.style.reset(),r.cls()],l)},font:function(e,t,i){var h=e.value.font;return v(e.value.body,t.withFont(h),i)},delimsizing:function(e,t,i){var h=e.value.value;if(h==="."){return n([g[e.value.delimType]])}return n([g[e.value.delimType]],[l.sizedDelim(h,e.value.size,t,e.mode)])},leftright:function(e,t,i){var h=o(e.value.body,t.reset());var a=0;var r=0;for(var s=0;s<h.length;s++){a=Math.max(h[s].height,a);r=Math.max(h[s].depth,r)}a*=t.style.sizeMultiplier;r*=t.style.sizeMultiplier;var p;if(e.value.left==="."){p=m(t)}else{p=l.leftRightDelim(e.value.left,a,r,t,e.mode)}h.unshift(p);var c;if(e.value.right==="."){c=m(t)}else{c=l.leftRightDelim(e.value.right,a,r,t,e.mode)}h.push(c);return n(["minner",t.style.cls()],h,t.getColor())},rule:function(e,t,i){var h=n(["mord","rule"],[],t.getColor());var a=0;if(e.value.shift){a=e.value.shift.number;if(e.value.shift.unit==="ex"){a*=p.metrics.xHeight}}var r=e.value.width.number;if(e.value.width.unit==="ex"){r*=p.metrics.xHeight}var l=e.value.height.number;if(e.value.height.unit==="ex"){l*=p.metrics.xHeight}a/=t.style.sizeMultiplier;r/=t.style.sizeMultiplier;l/=t.style.sizeMultiplier;h.style.borderRightWidth=r+"em";h.style.borderTopWidth=l+"em";h.style.bottom=a+"em";h.width=r;h.height=l+a;h.depth=-a;return h},accent:function(e,t,i){var h=e.value.base;var a;if(e.type==="supsub"){var l=e;e=l.value.base;h=e.value.base;l.value.base=h;a=v(l,t.reset(),i)}var s=v(h,t.withStyle(t.style.cramp()));var c;if(k(h)){var o=u(h);var g=v(o,t.withStyle(t.style.cramp()));c=g.skew}else{c=0}var d=Math.min(s.height,p.metrics.xHeight);var w=r.makeSymbol(e.value.accent,"Main-Regular","math",t.getColor());w.italic=0;var m=e.value.accent==="\\vec"?"accent-vec":null;var f=n(["accent-body",m],[n([],[w])]);f=r.makeVList([{type:"elem",elem:s},{type:"kern",size:-d},{type:"elem",elem:f}],"firstBaseline",null,t);f.children[1].style.marginLeft=2*c+"em";var y=n(["mord","accent"],[f]);if(a){a.children[0]=y;a.height=Math.max(y.height,a.height);a.classes[0]="mord";return a}else{return y}},phantom:function(e,t,i){var h=o(e.value.value,t.withPhantom(),i);return new r.makeFragment(h)}};var v=function(e,t,i){if(!e){return n()}if(f[e.type]){var a=f[e.type](e,t,i);var l;if(t.style!==t.parentStyle){l=t.style.sizeMultiplier/t.parentStyle.sizeMultiplier;a.height*=l;a.depth*=l}if(t.size!==t.parentSize){l=r.sizingMultiplier[t.size]/r.sizingMultiplier[t.parentSize];a.height*=l;a.depth*=l}return a}else{throw new h("Got group of unknown type: '"+e.type+"'")}};var y=function(e,t){e=JSON.parse(JSON.stringify(e));var i=o(e,t);var h=n(["base",t.style.cls()],i);var a=n(["strut"]);var r=n(["strut","bottom"]);a.style.height=h.height+"em";r.style.height=h.height+h.depth+"em";r.style.verticalAlign=-h.depth+"em";var l=n(["katex-html"],[a,r,h]);l.setAttribute("aria-hidden","true");return l};t.exports=y},{"./ParseError":5,"./Style":8,"./buildCommon":9,"./delimiter":13,"./domTree":14,"./fontMetrics":16,"./utils":23}],11:[function(e,t,i){var h=e("./buildCommon");var a=e("./fontMetrics");var r=e("./mathMLTree");var l=e("./ParseError");var s=e("./symbols");var p=e("./utils");var c=h.makeSpan;var n=h.fontMap;var o=function(e,t){if(s[t][e]&&s[t][e].replace){e=s[t][e].replace}return new r.TextNode(e)};var g=function(e,t){var i=t.font;if(!i){return null}var h=e.mode;if(i==="mathit"){return"italic"}var r=e.value;if(p.contains(["\\imath","\\jmath"],r)){return null}if(s[h][r]&&s[h][r].replace){r=s[h][r].replace}var l=n[i].fontName;if(a.getCharacterMetrics(r,l)){return n[t.font].variant}return null};var d={mathord:function(e,t){var i=new r.MathNode("mi",[o(e.value,e.mode)]);var h=g(e,t);if(h){i.setAttribute("mathvariant",h)}return i},textord:function(e,t){var i=o(e.value,e.mode);var h=g(e,t)||"normal";var a;if(/[0-9]/.test(e.value)){a=new r.MathNode("mn",[i]);if(t.font){a.setAttribute("mathvariant",h)}}else{a=new r.MathNode("mi",[i]);a.setAttribute("mathvariant",h)}return a},bin:function(e){var t=new r.MathNode("mo",[o(e.value,e.mode)]);return t},rel:function(e){var t=new r.MathNode("mo",[o(e.value,e.mode)]);return t},open:function(e){var t=new r.MathNode("mo",[o(e.value,e.mode)]);return t},close:function(e){var t=new r.MathNode("mo",[o(e.value,e.mode)]);return t},inner:function(e){var t=new r.MathNode("mo",[o(e.value,e.mode)]);return t},punct:function(e){var t=new r.MathNode("mo",[o(e.value,e.mode)]);t.setAttribute("separator","true");return t},ordgroup:function(e,t){var i=w(e.value,t);var h=new r.MathNode("mrow",i);return h},text:function(e,t){var i=w(e.value.body,t);var h=new r.MathNode("mtext",i);return h},color:function(e,t){var i=w(e.value.value,t);var h=new r.MathNode("mstyle",i);h.setAttribute("mathcolor",e.value.color);return h},supsub:function(e,t){var i=[u(e.value.base,t)];if(e.value.sub){i.push(u(e.value.sub,t))}if(e.value.sup){i.push(u(e.value.sup,t))}var h;if(!e.value.sub){h="msup"}else if(!e.value.sup){h="msub"}else{h="msubsup"}var a=new r.MathNode(h,i);return a},genfrac:function(e,t){var i=new r.MathNode("mfrac",[u(e.value.numer,t),u(e.value.denom,t)]);if(!e.value.hasBarLine){i.setAttribute("linethickness","0px")}if(e.value.leftDelim!=null||e.value.rightDelim!=null){var h=[];if(e.value.leftDelim!=null){var a=new r.MathNode("mo",[new r.TextNode(e.value.leftDelim)]);a.setAttribute("fence","true");h.push(a)}h.push(i);if(e.value.rightDelim!=null){var l=new r.MathNode("mo",[new r.TextNode(e.value.rightDelim)]);l.setAttribute("fence","true");h.push(l)}var s=new r.MathNode("mrow",h);return s}return i},array:function(e,t){return new r.MathNode("mtable",e.value.body.map(function(e){return new r.MathNode("mtr",e.map(function(e){return new r.MathNode("mtd",[u(e,t)])}))}))},sqrt:function(e,t){var i;if(e.value.index){i=new r.MathNode("mroot",[u(e.value.body,t),u(e.value.index,t)])}else{i=new r.MathNode("msqrt",[u(e.value.body,t)])}return i},leftright:function(e,t){var i=w(e.value.body,t);if(e.value.left!=="."){var h=new r.MathNode("mo",[o(e.value.left,e.mode)]);h.setAttribute("fence","true");i.unshift(h)}if(e.value.right!=="."){var a=new r.MathNode("mo",[o(e.value.right,e.mode)]);a.setAttribute("fence","true");i.push(a)}var l=new r.MathNode("mrow",i);return l},accent:function(e,t){var i=new r.MathNode("mo",[o(e.value.accent,e.mode)]);var h=new r.MathNode("mover",[u(e.value.base,t),i]);h.setAttribute("accent","true");return h},spacing:function(e){var t;if(e.value==="\\ "||e.value==="\\space"||e.value===" "||e.value==="~"){t=new r.MathNode("mtext",[new r.TextNode("\xa0")])}else{t=new r.MathNode("mspace");t.setAttribute("width",h.spacingFunctions[e.value].size)}return t},op:function(e){var t;if(e.value.symbol){t=new r.MathNode("mo",[o(e.value.body,e.mode)])}else{t=new r.MathNode("mi",[new r.TextNode(e.value.body.slice(1))])}return t},katex:function(e){var t=new r.MathNode("mtext",[new r.TextNode("KaTeX")]);return t},font:function(e,t){var i=e.value.font;return u(e.value.body,t.withFont(i))},delimsizing:function(e){var t=[];if(e.value.value!=="."){t.push(o(e.value.value,e.mode))}var i=new r.MathNode("mo",t);if(e.value.delimType==="open"||e.value.delimType==="close"){i.setAttribute("fence","true")}else{i.setAttribute("fence","false")}return i},styling:function(e,t){var i=w(e.value.value,t);var h=new r.MathNode("mstyle",i);var a={display:["0","true"],text:["0","false"],script:["1","false"],scriptscript:["2","false"]};var l=a[e.value.style];h.setAttribute("scriptlevel",l[0]);h.setAttribute("displaystyle",l[1]);return h},sizing:function(e,t){var i=w(e.value.value,t);var a=new r.MathNode("mstyle",i);a.setAttribute("mathsize",h.sizingMultiplier[e.value.size]+"em");return a},overline:function(e,t){var i=new r.MathNode("mo",[new r.TextNode("\u203e")]);i.setAttribute("stretchy","true");var h=new r.MathNode("mover",[u(e.value.body,t),i]);h.setAttribute("accent","true");return h},rule:function(e){var t=new r.MathNode("mrow");return t},llap:function(e,t){var i=new r.MathNode("mpadded",[u(e.value.body,t)]);i.setAttribute("lspace","-1width");i.setAttribute("width","0px");return i},rlap:function(e,t){var i=new r.MathNode("mpadded",[u(e.value.body,t)]);i.setAttribute("width","0px");return i},phantom:function(e,t,i){var h=w(e.value.value,t);return new r.MathNode("mphantom",h)}};var w=function(e,t){var i=[];for(var h=0;h<e.length;h++){var a=e[h];i.push(u(a,t))}return i};var u=function(e,t){if(!e){return new r.MathNode("mrow")}if(d[e.type]){return d[e.type](e,t)}else{throw new l("Got group of unknown type: '"+e.type+"'")}};var k=function(e,t,i){var h=w(e,i);var a=new r.MathNode("mrow",h);var l=new r.MathNode("annotation",[new r.TextNode(t)]);l.setAttribute("encoding","application/x-tex");var s=new r.MathNode("semantics",[a,l]);var p=new r.MathNode("math",[s]);return c(["katex-mathml"],[p])};t.exports=k},{"./ParseError":5,"./buildCommon":9,"./fontMetrics":16,"./mathMLTree":19,"./symbols":22,"./utils":23}],12:[function(e,t,i){var h=e("./buildHTML");var a=e("./buildMathML");var r=e("./buildCommon");var l=e("./Options");var s=e("./Settings");var p=e("./Style");var c=r.makeSpan;var n=function(e,t,i){i=i||new s({});var r=p.TEXT;if(i.displayMode){r=p.DISPLAY}var n=new l({style:r,size:"size5"});var o=a(e,t,n);var g=h(e,n);var d=c(["katex"],[o,g]);if(i.displayMode){return c(["katex-display"],[d])}else{return d}};t.exports=n},{"./Options":4,"./Settings":7,"./Style":8,"./buildCommon":9,"./buildHTML":10,"./buildMathML":11}],13:[function(e,t,i){var h=e("./ParseError");var a=e("./Style");var r=e("./buildCommon");var l=e("./fontMetrics");var s=e("./symbols");var p=e("./utils");var c=r.makeSpan;var n=function(e,t){if(s.math[e]&&s.math[e].replace){return l.getCharacterMetrics(s.math[e].replace,t)}else{return l.getCharacterMetrics(e,t)}};var o=function(e,t,i){return r.makeSymbol(e,"Size"+t+"-Regular",i)};var g=function(e,t,i){var h=c(["style-wrap",i.style.reset(),t.cls()],[e]);var a=t.sizeMultiplier/i.style.sizeMultiplier;h.height*=a;h.depth*=a;h.maxFontSize=t.sizeMultiplier;return h};var d=function(e,t,i,h,a){var s=r.makeSymbol(e,"Main-Regular",a);var p=g(s,t,h);if(i){var c=(1-h.style.sizeMultiplier/t.sizeMultiplier)*l.metrics.axisHeight;p.style.top=c+"em";p.height-=c;p.depth+=c}return p};var w=function(e,t,i,h,r){var s=o(e,t,r);var p=g(c(["delimsizing","size"+t],[s],h.getColor()),a.TEXT,h);if(i){var n=(1-h.style.sizeMultiplier)*l.metrics.axisHeight;p.style.top=n+"em";p.height-=n;p.depth+=n}return p};var u=function(e,t,i){var h;if(t==="Size1-Regular"){h="delim-size1"}else if(t==="Size4-Regular"){h="delim-size4"}var a=c(["delimsizinginner",h],[c([],[r.makeSymbol(e,t,i)])]);return{type:"elem",elem:a}};var k=function(e,t,i,h,s){var p,o,d,w;p=d=w=e;o=null;var k="Size1-Regular";if(e==="\\uparrow"){d=w="\u23d0"}else if(e==="\\Uparrow"){d=w="\u2016"}else if(e==="\\downarrow"){p=d="\u23d0"}else if(e==="\\Downarrow"){p=d="\u2016"}else if(e==="\\updownarrow"){p="\\uparrow";d="\u23d0";w="\\downarrow"}else if(e==="\\Updownarrow"){p="\\Uparrow";d="\u2016";w="\\Downarrow"}else if(e==="["||e==="\\lbrack"){p="\u23a1";d="\u23a2";w="\u23a3";k="Size4-Regular"}else if(e==="]"||e==="\\rbrack"){p="\u23a4";d="\u23a5";w="\u23a6";k="Size4-Regular"}else if(e==="\\lfloor"){d=p="\u23a2";w="\u23a3";k="Size4-Regular"}else if(e==="\\lceil"){p="\u23a1";d=w="\u23a2";k="Size4-Regular"}else if(e==="\\rfloor"){d=p="\u23a5";w="\u23a6";k="Size4-Regular"}else if(e==="\\rceil"){p="\u23a4";d=w="\u23a5";k="Size4-Regular"}else if(e==="("){p="\u239b";d="\u239c";w="\u239d";k="Size4-Regular"}else if(e===")"){p="\u239e";d="\u239f";w="\u23a0";k="Size4-Regular"}else if(e==="\\{"||e==="\\lbrace"){p="\u23a7";o="\u23a8";w="\u23a9";d="\u23aa";k="Size4-Regular"}else if(e==="\\}"||e==="\\rbrace"){p="\u23ab";o="\u23ac";w="\u23ad";d="\u23aa";k="Size4-Regular"}else if(e==="\\lgroup"){p="\u23a7";w="\u23a9";d="\u23aa";k="Size4-Regular"}else if(e==="\\rgroup"){p="\u23ab";w="\u23ad";d="\u23aa";k="Size4-Regular"}else if(e==="\\lmoustache"){p="\u23a7";w="\u23ad";d="\u23aa";k="Size4-Regular"}else if(e==="\\rmoustache"){p="\u23ab";w="\u23a9";d="\u23aa";k="Size4-Regular"}else if(e==="\\surd"){p="\ue001";w="\u23b7";d="\ue000";k="Size4-Regular"}var m=n(p,k);var f=m.height+m.depth;var v=n(d,k);var y=v.height+v.depth;var x=n(w,k);var b=x.height+x.depth;var z=0;var S=1;if(o!==null){var M=n(o,k);z=M.height+M.depth;S=2}var q=f+b+z;var A=Math.ceil((t-q)/(S*y));var T=q+A*S*y;var N=l.metrics.axisHeight;if(i){N*=h.style.sizeMultiplier}var C=T/2-N;var R=[];R.push(u(w,k,s));var E;if(o===null){for(E=0;E<A;E++){R.push(u(d,k,s))}}else{for(E=0;E<A;E++){R.push(u(d,k,s))}R.push(u(o,k,s));for(E=0;E<A;E++){R.push(u(d,k,s))}}R.push(u(p,k,s));var P=r.makeVList(R,"bottom",C,h);return g(c(["delimsizing","mult"],[P],h.getColor()),a.TEXT,h)};var m=["(",")","[","\\lbrack","]","\\rbrack","\\{","\\lbrace","\\}","\\rbrace","\\lfloor","\\rfloor","\\lceil","\\rceil","\\surd"];var f=["\\uparrow","\\downarrow","\\updownarrow","\\Uparrow","\\Downarrow","\\Updownarrow","|","\\|","\\vert","\\Vert","\\lvert","\\rvert","\\lVert","\\rVert","\\lgroup","\\rgroup","\\lmoustache","\\rmoustache"];var v=["<",">","\\langle","\\rangle","/","\\backslash"];var y=[0,1.2,1.8,2.4,3];var x=function(e,t,i,a){if(e==="<"){e="\\langle"}else if(e===">"){e="\\rangle"}if(p.contains(m,e)||p.contains(v,e)){return w(e,t,false,i,a)}else if(p.contains(f,e)){return k(e,y[t],false,i,a)}else{throw new h("Illegal delimiter: '"+e+"'")}};var b=[{type:"small",style:a.SCRIPTSCRIPT},{type:"small",style:a.SCRIPT},{type:"small",style:a.TEXT},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4}];var z=[{type:"small",style:a.SCRIPTSCRIPT},{type:"small",style:a.SCRIPT},{type:"small",style:a.TEXT},{type:"stack"}];var S=[{type:"small",style:a.SCRIPTSCRIPT},{type:"small",style:a.SCRIPT},{type:"small",style:a.TEXT},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4},{type:"stack"}];var M=function(e){if(e.type==="small"){return"Main-Regular"}else if(e.type==="large"){return"Size"+e.size+"-Regular"}else if(e.type==="stack"){return"Size4-Regular"}};var q=function(e,t,i,h){var a=Math.min(2,3-h.style.size);for(var r=a;r<i.length;r++){if(i[r].type==="stack"){break}var l=n(e,M(i[r]));var s=l.height+l.depth;if(i[r].type==="small"){s*=i[r].style.sizeMultiplier}if(s>t){return i[r]}}return i[i.length-1]};var A=function(e,t,i,h,a){if(e==="<"){e="\\langle"}else if(e===">"){e="\\rangle"}var r;if(p.contains(v,e)){r=b}else if(p.contains(m,e)){r=S}else{r=z}var l=q(e,t,r,h);if(l.type==="small"){return d(e,l.style,i,h,a)}else if(l.type==="large"){return w(e,l.size,i,h,a)}else if(l.type==="stack"){return k(e,t,i,h,a)}};var T=function(e,t,i,h,a){var r=l.metrics.axisHeight*h.style.sizeMultiplier;var s=901;var p=5/l.metrics.ptPerEm;var c=Math.max(t-r,i+r);var n=Math.max(c/500*s,2*c-p);return A(e,n,true,h,a)};t.exports={sizedDelim:x,customSizedDelim:A,leftRightDelim:T}},{"./ParseError":5,"./Style":8,"./buildCommon":9,"./fontMetrics":16,"./symbols":22,"./utils":23}],14:[function(e,t,i){var h=e("./utils");var a=function(e){e=e.slice();for(var t=e.length-1;t>=0;t--){if(!e[t]){e.splice(t,1)}}return e.join(" ")};function r(e,t,i,h,a,r){this.classes=e||[];this.children=t||[];this.height=i||0;this.depth=h||0;this.maxFontSize=a||0;this.style=r||{};this.attributes={}}r.prototype.setAttribute=function(e,t){this.attributes[e]=t};r.prototype.toNode=function(){var e=document.createElement("span");e.className=a(this.classes);for(var t in this.style){if(Object.prototype.hasOwnProperty.call(this.style,t)){e.style[t]=this.style[t]}}for(var i in this.attributes){if(Object.prototype.hasOwnProperty.call(this.attributes,i)){e.setAttribute(i,this.attributes[i])}}for(var h=0;h<this.children.length;h++){e.appendChild(this.children[h].toNode())}return e};r.prototype.toMarkup=function(){var e="<span";if(this.classes.length){e+=' class="';e+=h.escape(a(this.classes));e+='"'}var t="";for(var i in this.style){if(this.style.hasOwnProperty(i)){t+=h.hyphenate(i)+":"+this.style[i]+";"}}if(t){e+=' style="'+h.escape(t)+'"'}for(var r in this.attributes){if(Object.prototype.hasOwnProperty.call(this.attributes,r)){e+=" "+r+'="';e+=h.escape(this.attributes[r]);e+='"'}}e+=">";for(var l=0;l<this.children.length;l++){e+=this.children[l].toMarkup()}e+="</span>";return e};function l(e,t,i,h){this.children=e||[];this.height=t||0;this.depth=i||0;this.maxFontSize=h||0}l.prototype.toNode=function(){var e=document.createDocumentFragment();for(var t=0;t<this.children.length;t++){e.appendChild(this.children[t].toNode())}return e};l.prototype.toMarkup=function(){var e="";for(var t=0;t<this.children.length;t++){e+=this.children[t].toMarkup()}return e};function s(e,t,i,h,a,r,l){this.value=e||"";this.height=t||0;this.depth=i||0;this.italic=h||0;this.skew=a||0;this.classes=r||[];this.style=l||{};this.maxFontSize=0}s.prototype.toNode=function(){var e=document.createTextNode(this.value);var t=null;if(this.italic>0){t=document.createElement("span");t.style.marginRight=this.italic+"em"}if(this.classes.length>0){t=t||document.createElement("span");t.className=a(this.classes)}for(var i in this.style){if(this.style.hasOwnProperty(i)){t=t||document.createElement("span");t.style[i]=this.style[i]}}if(t){t.appendChild(e);return t}else{return e}};s.prototype.toMarkup=function(){var e=false;var t="<span";if(this.classes.length){e=true;t+=' class="';t+=h.escape(a(this.classes));t+='"'}var i="";if(this.italic>0){i+="margin-right:"+this.italic+"em;"}for(var r in this.style){if(this.style.hasOwnProperty(r)){i+=h.hyphenate(r)+":"+this.style[r]+";"}}if(i){e=true;t+=' style="'+h.escape(i)+'"'}var l=h.escape(this.value);if(e){t+=">";t+=l;t+="</span>";return t}else{return l}};t.exports={span:r,documentFragment:l,symbolNode:s}},{"./utils":23}],15:[function(e,t,i){var h=e("./fontMetrics");var a=e("./parseData");var r=e("./ParseError");var l=a.ParseN