temml 0.10.33 → 0.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/temml.min.js CHANGED
@@ -1 +1 @@
1
- var temml=function(){"use strict";class e{constructor(t,r){let n,o=" "+t;const s=r&&r.loc;if(s&&s.start<=s.end){const e=s.lexer.input;n=s.start;const t=s.end;n===e.length?o+=" at end of input: ":o+=" at position "+(n+1)+": ";const r=e.slice(n,t).replace(/[^]/g,"$&̲");let a,l;a=n>15?"…"+e.slice(n-15,n):e.slice(0,n),l=t+15<e.length?e.slice(t,t+15)+"…":e.slice(t),o+=a+r+l}const a=new Error(o);return a.name="ParseError",a.__proto__=e.prototype,a.position=n,a}}e.prototype.__proto__=Error.prototype;const t=/([A-Z])/g,r={"&":"&amp;",">":"&gt;","<":"&lt;",'"':"&quot;","'":"&#x27;"},n=/[&><"']/g;const o=function(e){return"ordgroup"===e.type||"color"===e.type?1===e.body.length?o(e.body[0]):e:"font"===e.type?o(e.body):e};var s={deflt:function(e,t){return void 0===e?t:e},escape:function(e){return String(e).replace(n,(e=>r[e]))},hyphenate:function(e){return e.replace(t,"-$1").toLowerCase()},getBaseElem:o,isCharacterBox:function(e){const t=o(e);return"mathord"===t.type||"textord"===t.type||"atom"===t.type},protocolFromUrl:function(e){const t=/^[\x00-\x20]*([^\\/#?]*?)(:|&#0*58|&#x0*3a|&colon)/i.exec(e);return t?":"!==t[2]?null:/^[a-zA-Z][a-zA-Z0-9+\-.]*$/.test(t[1])?t[1].toLowerCase():null:"_relative"},round:function(e){return+e.toFixed(4)}};class a{constructor(e){e=e||{},this.displayMode=s.deflt(e.displayMode,!1),this.annotate=s.deflt(e.annotate,!1),this.leqno=s.deflt(e.leqno,!1),this.throwOnError=s.deflt(e.throwOnError,!1),this.errorColor=s.deflt(e.errorColor,"#b22222"),this.macros=e.macros||{},this.wrap=s.deflt(e.wrap,"tex"),this.xml=s.deflt(e.xml,!1),this.colorIsTextColor=s.deflt(e.colorIsTextColor,!1),this.strict=s.deflt(e.strict,!1),this.trust=s.deflt(e.trust,!1),this.maxSize=void 0===e.maxSize?[1/0,1/0]:Array.isArray(e.maxSize)?e.maxSize:[1/0,1/0],this.maxExpand=Math.max(0,s.deflt(e.maxExpand,1e3))}isTrusted(e){if(e.url&&!e.protocol){const t=s.protocolFromUrl(e.url);if(null==t)return!1;e.protocol=t}const t="function"==typeof this.trust?this.trust(e):this.trust;return Boolean(t)}}const l={},i={};function c({type:e,names:t,props:r,handler:n,mathmlBuilder:o}){const s={type:e,numArgs:r.numArgs,argTypes:r.argTypes,allowedInArgument:!!r.allowedInArgument,allowedInText:!!r.allowedInText,allowedInMath:void 0===r.allowedInMath||r.allowedInMath,numOptionalArgs:r.numOptionalArgs||0,infix:!!r.infix,primitive:!!r.primitive,handler:n};for(let e=0;e<t.length;++e)l[t[e]]=s;e&&o&&(i[e]=o)}function m({type:e,mathmlBuilder:t}){c({type:e,names:[],props:{numArgs:0},handler(){throw new Error("Should never be called.")},mathmlBuilder:t})}const u=function(e){return"ordgroup"===e.type&&1===e.body.length?e.body[0]:e},d=function(e){return"ordgroup"===e.type?e.body:[e]};class p{constructor(e){this.children=e,this.classes=[],this.style={}}hasClass(e){return this.classes.includes(e)}toNode(){const e=document.createDocumentFragment();for(let t=0;t<this.children.length;t++)e.appendChild(this.children[t].toNode());return e}toMarkup(){let e="";for(let t=0;t<this.children.length;t++)e+=this.children[t].toMarkup();return e}toText(){return this.children.map((e=>e.toText())).join("")}}const h=function(e){return e.filter((e=>e)).join(" ")},g=function(e,t){this.classes=e||[],this.attributes={},this.style=t||{}},f=function(e){const t=document.createElement(e);t.className=h(this.classes);for(const e in this.style)Object.prototype.hasOwnProperty.call(this.style,e)&&(t.style[e]=this.style[e]);for(const e in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,e)&&t.setAttribute(e,this.attributes[e]);for(let e=0;e<this.children.length;e++)t.appendChild(this.children[e].toNode());return t},b=function(e){let t=`<${e}`;this.classes.length&&(t+=` class="${s.escape(h(this.classes))}"`);let r="";for(const e in this.style)Object.prototype.hasOwnProperty.call(this.style,e)&&(r+=`${s.hyphenate(e)}:${this.style[e]};`);r&&(t+=` style="${r}"`);for(const e in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,e)&&(t+=` ${e}="${s.escape(this.attributes[e])}"`);t+=">";for(let e=0;e<this.children.length;e++)t+=this.children[e].toMarkup();return t+=`</${e}>`,t};class y{constructor(e,t,r){g.call(this,e,r),this.children=t||[]}setAttribute(e,t){this.attributes[e]=t}toNode(){return f.call(this,"span")}toMarkup(){return b.call(this,"span")}}let w=class{constructor(e){this.text=e}toNode(){return document.createTextNode(this.text)}toMarkup(){return s.escape(this.text)}};class x{constructor(e,t,r){this.href=e,this.classes=t,this.children=r||[]}toNode(){const e=document.createElement("a");e.setAttribute("href",this.href),this.classes.length>0&&(e.className=h(this.classes));for(let t=0;t<this.children.length;t++)e.appendChild(this.children[t].toNode());return e}toMarkup(){let e=`<a href='${s.escape(this.href)}'`;this.classes.length>0&&(e+=` class="${s.escape(h(this.classes))}"`),e+=">";for(let t=0;t<this.children.length;t++)e+=this.children[t].toMarkup();return e+="</a>",e}}class k{constructor(e,t,r){this.alt=t,this.src=e,this.classes=["mord"],this.style=r}hasClass(e){return this.classes.includes(e)}toNode(){const e=document.createElement("img");e.src=this.src,e.alt=this.alt,e.className="mord";for(const t in this.style)Object.prototype.hasOwnProperty.call(this.style,t)&&(e.style[t]=this.style[t]);return e}toMarkup(){let e=`<img src='${this.src}' alt='${this.alt}'`,t="";for(const e in this.style)Object.prototype.hasOwnProperty.call(this.style,e)&&(t+=`${s.hyphenate(e)}:${this.style[e]};`);return t&&(e+=` style="${s.escape(t)}"`),e+=">",e}}class v{constructor(e,t,r,n){this.type=e,this.attributes={},this.children=t||[],this.classes=r||[],this.style=n||{}}setAttribute(e,t){this.attributes[e]=t}getAttribute(e){return this.attributes[e]}toNode(){const e=document.createElementNS("http://www.w3.org/1998/Math/MathML",this.type);for(const t in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,t)&&e.setAttribute(t,this.attributes[t]);this.classes.length>0&&(e.className=h(this.classes));for(const t in this.style)Object.prototype.hasOwnProperty.call(this.style,t)&&(e.style[t]=this.style[t]);for(let t=0;t<this.children.length;t++)e.appendChild(this.children[t].toNode());return e}toMarkup(){let e="<"+this.type;for(const t in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,t)&&(e+=" "+t+'="',e+=s.escape(this.attributes[t]),e+='"');this.classes.length>0&&(e+=` class="${s.escape(h(this.classes))}"`);let t="";for(const e in this.style)Object.prototype.hasOwnProperty.call(this.style,e)&&(t+=`${s.hyphenate(e)}:${this.style[e]};`);t&&(e+=` style="${t}"`),e+=">";for(let t=0;t<this.children.length;t++)e+=this.children[t].toMarkup();return e+="</"+this.type+">",e}toText(){return this.children.map((e=>e.toText())).join("")}}class A{constructor(e){this.text=e}toNode(){return document.createTextNode(this.text)}toMarkup(){return s.escape(this.toText())}toText(){return this.text}}const N=e=>{let t;return 1===e.length&&"mrow"===e[0].type?(t=e.pop(),t.type="mstyle"):t=new v("mstyle",e),t};var T={MathNode:v,TextNode:A,newDocumentFragment:function(e){return new p(e)}};const S=e=>{let t=0;if(e.body)for(const r of e.body)t+=S(r);else if("supsub"===e.type)t+=S(e.base),e.sub&&(t+=.7*S(e.sub)),e.sup&&(t+=.7*S(e.sup));else if("mathord"===e.type||"textord"===e.type)for(const r of e.text.split("")){const e=r.codePointAt(0);t+=96<e&&e<123||944<e&&e<970?.56:47<e&&e<58?.5:.92}else t+=1;return t},q={widehat:"^",widecheck:"ˇ",widetilde:"~",wideparen:"⏜",utilde:"~",overleftarrow:"←",underleftarrow:"←",xleftarrow:"←",overrightarrow:"→",underrightarrow:"→",xrightarrow:"→",underbrace:"⏟",overbrace:"⏞",overgroup:"⏠",overparen:"⏜",undergroup:"⏡",underparen:"⏝",overleftrightarrow:"↔",underleftrightarrow:"↔",xleftrightarrow:"↔",Overrightarrow:"⇒",xRightarrow:"⇒",overleftharpoon:"↼",xleftharpoonup:"↼",overrightharpoon:"⇀",xrightharpoonup:"⇀",xLeftarrow:"⇐",xLeftrightarrow:"⇔",xhookleftarrow:"↩",xhookrightarrow:"↪",xmapsto:"↦",xrightharpoondown:"⇁",xleftharpoondown:"↽",xtwoheadleftarrow:"↞",xtwoheadrightarrow:"↠",xlongequal:"=",xrightleftarrows:"⇄",yields:"→",yieldsLeft:"←",mesomerism:"↔",longrightharpoonup:"⇀",longleftharpoondown:"↽",eqrightharpoonup:"⇀",eqleftharpoondown:"↽","\\cdrightarrow":"→","\\cdleftarrow":"←","\\cdlongequal":"="},O=function(e){const t=new T.TextNode(q[e.slice(1)]),r=new T.MathNode("mo",[t]);return r.setAttribute("stretchy","true"),r},M=["\\widetilde","\\widehat","\\widecheck","\\utilde"];var B=O,C=e=>{const t=O(e.label);if(M.includes(e.label)){const r=S(e.base);1<r&&r<1.6?t.classes.push("tml-crooked-2"):1.6<=r&&r<2.5?t.classes.push("tml-crooked-3"):2.5<=r&&t.classes.push("tml-crooked-4")}return t};const z={bin:1,close:1,inner:1,open:1,punct:1,rel:1},E={"accent-token":1,mathord:1,"op-token":1,spacing:1,textord:1},I={math:{},text:{}};function $(e,t,r,n,o){I[e][n]={group:t,replace:r},o&&r&&(I[e][r]=I[e][n])}const L="math",F="text",G="accent-token",D="bin",j="close",P="inner",R="mathord",U="op-token",H="open",V="punct",_="rel",W="spacing",X="textord";$(L,_,"≡","\\equiv",!0),$(L,_,"≺","\\prec",!0),$(L,_,"≻","\\succ",!0),$(L,_,"∼","\\sim",!0),$(L,_,"⟂","\\perp",!0),$(L,_,"⪯","\\preceq",!0),$(L,_,"⪰","\\succeq",!0),$(L,_,"≃","\\simeq",!0),$(L,_,"≌","\\backcong",!0),$(L,_,"|","\\mid",!0),$(L,_,"≪","\\ll",!0),$(L,_,"≫","\\gg",!0),$(L,_,"≍","\\asymp",!0),$(L,_,"∥","\\parallel"),$(L,_,"⌣","\\smile",!0),$(L,_,"⊑","\\sqsubseteq",!0),$(L,_,"⊒","\\sqsupseteq",!0),$(L,_,"≐","\\doteq",!0),$(L,_,"⌢","\\frown",!0),$(L,_,"∋","\\ni",!0),$(L,_,"∌","\\notni",!0),$(L,_,"∝","\\propto",!0),$(L,_,"⊢","\\vdash",!0),$(L,_,"⊣","\\dashv",!0),$(L,_,"∋","\\owns"),$(L,_,"≘","\\arceq",!0),$(L,_,"≙","\\wedgeq",!0),$(L,_,"≚","\\veeeq",!0),$(L,_,"≛","\\stareq",!0),$(L,_,"≝","\\eqdef",!0),$(L,_,"≞","\\measeq",!0),$(L,_,"≟","\\questeq",!0),$(L,_,"≠","\\ne",!0),$(L,_,"≠","\\neq"),$(L,_,"⩵","\\eqeq",!0),$(L,_,"⩶","\\eqeqeq",!0),$(L,_,"∷","\\dblcolon",!0),$(L,_,"≔","\\coloneqq",!0),$(L,_,"≕","\\eqqcolon",!0),$(L,_,"∹","\\eqcolon",!0),$(L,_,"⩴","\\Coloneqq",!0),$(L,V,".","\\ldotp"),$(L,V,"·","\\cdotp"),$(L,X,"#","\\#"),$(F,X,"#","\\#"),$(L,X,"&","\\&"),$(F,X,"&","\\&"),$(L,X,"ℵ","\\aleph",!0),$(L,X,"∀","\\forall",!0),$(L,X,"ℏ","\\hbar",!0),$(L,X,"∃","\\exists",!0),$(L,D,"∇","\\nabla",!0),$(L,X,"♭","\\flat",!0),$(L,X,"ℓ","\\ell",!0),$(L,X,"♮","\\natural",!0),$(L,X,"Å","\\Angstrom",!0),$(F,X,"Å","\\Angstrom",!0),$(L,X,"♣","\\clubsuit",!0),$(L,X,"♧","\\varclubsuit",!0),$(L,X,"℘","\\wp",!0),$(L,X,"♯","\\sharp",!0),$(L,X,"♢","\\diamondsuit",!0),$(L,X,"♦","\\vardiamondsuit",!0),$(L,X,"ℜ","\\Re",!0),$(L,X,"♡","\\heartsuit",!0),$(L,X,"♥","\\varheartsuit",!0),$(L,X,"ℑ","\\Im",!0),$(L,X,"♠","\\spadesuit",!0),$(L,X,"♤","\\varspadesuit",!0),$(L,X,"♀","\\female",!0),$(L,X,"♂","\\male",!0),$(L,X,"§","\\S",!0),$(F,X,"§","\\S"),$(L,X,"¶","\\P",!0),$(F,X,"¶","\\P"),$(F,X,"☺","\\smiley",!0),$(L,X,"☺","\\smiley",!0),$(L,X,"†","\\dag"),$(F,X,"†","\\dag"),$(F,X,"†","\\textdagger"),$(L,X,"‡","\\ddag"),$(F,X,"‡","\\ddag"),$(F,X,"‡","\\textdaggerdbl"),$(L,j,"⎱","\\rmoustache",!0),$(L,H,"⎰","\\lmoustache",!0),$(L,j,"⟯","\\rgroup",!0),$(L,H,"⟮","\\lgroup",!0),$(L,D,"∓","\\mp",!0),$(L,D,"⊖","\\ominus",!0),$(L,D,"⊎","\\uplus",!0),$(L,D,"⊓","\\sqcap",!0),$(L,D,"∗","\\ast"),$(L,D,"⊔","\\sqcup",!0),$(L,D,"◯","\\bigcirc",!0),$(L,D,"∙","\\bullet",!0),$(L,D,"‡","\\ddagger"),$(L,D,"≀","\\wr",!0),$(L,D,"⨿","\\amalg"),$(L,D,"&","\\And"),$(L,D,"⫽","\\sslash",!0),$(L,_,"⟵","\\longleftarrow",!0),$(L,_,"⇐","\\Leftarrow",!0),$(L,_,"⟸","\\Longleftarrow",!0),$(L,_,"⟶","\\longrightarrow",!0),$(L,_,"⇒","\\Rightarrow",!0),$(L,_,"⟹","\\Longrightarrow",!0),$(L,_,"↔","\\leftrightarrow",!0),$(L,_,"⟷","\\longleftrightarrow",!0),$(L,_,"⇔","\\Leftrightarrow",!0),$(L,_,"⟺","\\Longleftrightarrow",!0),$(L,_,"↤","\\mapsfrom",!0),$(L,_,"↦","\\mapsto",!0),$(L,_,"⟼","\\longmapsto",!0),$(L,_,"↗","\\nearrow",!0),$(L,_,"↩","\\hookleftarrow",!0),$(L,_,"↪","\\hookrightarrow",!0),$(L,_,"↘","\\searrow",!0),$(L,_,"↼","\\leftharpoonup",!0),$(L,_,"⇀","\\rightharpoonup",!0),$(L,_,"↙","\\swarrow",!0),$(L,_,"↽","\\leftharpoondown",!0),$(L,_,"⇁","\\rightharpoondown",!0),$(L,_,"↖","\\nwarrow",!0),$(L,_,"⇌","\\rightleftharpoons",!0),$(L,R,"↯","\\lightning",!0),$(L,R,"∎","\\QED",!0),$(L,R,"‰","\\permil",!0),$(F,X,"‰","\\permil"),$(L,R,"☉","\\astrosun",!0),$(L,R,"☼","\\sun",!0),$(L,R,"☾","\\leftmoon",!0),$(L,R,"☽","\\rightmoon",!0),$(L,R,"⊕","\\Earth"),$(L,_,"≮","\\nless",!0),$(L,_,"⪇","\\lneq",!0),$(L,_,"≨","\\lneqq",!0),$(L,_,"≨︀","\\lvertneqq"),$(L,_,"⋦","\\lnsim",!0),$(L,_,"⪉","\\lnapprox",!0),$(L,_,"⊀","\\nprec",!0),$(L,_,"⋠","\\npreceq",!0),$(L,_,"⋨","\\precnsim",!0),$(L,_,"⪹","\\precnapprox",!0),$(L,_,"≁","\\nsim",!0),$(L,_,"∤","\\nmid",!0),$(L,_,"∤","\\nshortmid"),$(L,_,"⊬","\\nvdash",!0),$(L,_,"⊭","\\nvDash",!0),$(L,_,"⋪","\\ntriangleleft"),$(L,_,"⋬","\\ntrianglelefteq",!0),$(L,_,"⊄","\\nsubset",!0),$(L,_,"⊅","\\nsupset",!0),$(L,_,"⊊","\\subsetneq",!0),$(L,_,"⊊︀","\\varsubsetneq"),$(L,_,"⫋","\\subsetneqq",!0),$(L,_,"⫋︀","\\varsubsetneqq"),$(L,_,"≯","\\ngtr",!0),$(L,_,"⪈","\\gneq",!0),$(L,_,"≩","\\gneqq",!0),$(L,_,"≩︀","\\gvertneqq"),$(L,_,"⋧","\\gnsim",!0),$(L,_,"⪊","\\gnapprox",!0),$(L,_,"⊁","\\nsucc",!0),$(L,_,"⋡","\\nsucceq",!0),$(L,_,"⋩","\\succnsim",!0),$(L,_,"⪺","\\succnapprox",!0),$(L,_,"≆","\\ncong",!0),$(L,_,"∦","\\nparallel",!0),$(L,_,"∦","\\nshortparallel"),$(L,_,"⊯","\\nVDash",!0),$(L,_,"⋫","\\ntriangleright"),$(L,_,"⋭","\\ntrianglerighteq",!0),$(L,_,"⊋","\\supsetneq",!0),$(L,_,"⊋","\\varsupsetneq"),$(L,_,"⫌","\\supsetneqq",!0),$(L,_,"⫌︀","\\varsupsetneqq"),$(L,_,"⊮","\\nVdash",!0),$(L,_,"⪵","\\precneqq",!0),$(L,_,"⪶","\\succneqq",!0),$(L,D,"⊴","\\unlhd"),$(L,D,"⊵","\\unrhd"),$(L,_,"↚","\\nleftarrow",!0),$(L,_,"↛","\\nrightarrow",!0),$(L,_,"⇍","\\nLeftarrow",!0),$(L,_,"⇏","\\nRightarrow",!0),$(L,_,"↮","\\nleftrightarrow",!0),$(L,_,"⇎","\\nLeftrightarrow",!0),$(L,_,"△","\\vartriangle"),$(L,X,"ℏ","\\hslash"),$(L,X,"▽","\\triangledown"),$(L,X,"◊","\\lozenge"),$(L,X,"Ⓢ","\\circledS"),$(L,X,"®","\\circledR",!0),$(F,X,"®","\\circledR"),$(F,X,"®","\\textregistered"),$(L,X,"∡","\\measuredangle",!0),$(L,X,"∄","\\nexists"),$(L,X,"℧","\\mho"),$(L,X,"Ⅎ","\\Finv",!0),$(L,X,"⅁","\\Game",!0),$(L,X,"‵","\\backprime"),$(L,X,"‶","\\backdprime"),$(L,X,"‷","\\backtrprime"),$(L,X,"▲","\\blacktriangle"),$(L,X,"▼","\\blacktriangledown"),$(L,X,"■","\\blacksquare"),$(L,X,"⧫","\\blacklozenge"),$(L,X,"★","\\bigstar"),$(L,X,"∢","\\sphericalangle",!0),$(L,X,"∁","\\complement",!0),$(L,X,"ð","\\eth",!0),$(F,X,"ð","ð"),$(L,X,"╱","\\diagup"),$(L,X,"╲","\\diagdown"),$(L,X,"□","\\square"),$(L,X,"□","\\Box"),$(L,X,"◊","\\Diamond"),$(L,X,"¥","\\yen",!0),$(F,X,"¥","\\yen",!0),$(L,X,"✓","\\checkmark",!0),$(F,X,"✓","\\checkmark"),$(L,X,"✗","\\ballotx",!0),$(F,X,"✗","\\ballotx"),$(F,X,"•","\\textbullet"),$(L,X,"ℶ","\\beth",!0),$(L,X,"ℸ","\\daleth",!0),$(L,X,"ℷ","\\gimel",!0),$(L,X,"ϝ","\\digamma",!0),$(L,X,"ϰ","\\varkappa"),$(L,H,"⌜","\\ulcorner",!0),$(L,j,"⌝","\\urcorner",!0),$(L,H,"⌞","\\llcorner",!0),$(L,j,"⌟","\\lrcorner",!0),$(L,_,"≦","\\leqq",!0),$(L,_,"⩽","\\leqslant",!0),$(L,_,"⪕","\\eqslantless",!0),$(L,_,"≲","\\lesssim",!0),$(L,_,"⪅","\\lessapprox",!0),$(L,_,"≊","\\approxeq",!0),$(L,D,"⋖","\\lessdot"),$(L,_,"⋘","\\lll",!0),$(L,_,"≶","\\lessgtr",!0),$(L,_,"⋚","\\lesseqgtr",!0),$(L,_,"⪋","\\lesseqqgtr",!0),$(L,_,"≑","\\doteqdot"),$(L,_,"≓","\\risingdotseq",!0),$(L,_,"≒","\\fallingdotseq",!0),$(L,_,"∽","\\backsim",!0),$(L,_,"⋍","\\backsimeq",!0),$(L,_,"⫅","\\subseteqq",!0),$(L,_,"⋐","\\Subset",!0),$(L,_,"⊏","\\sqsubset",!0),$(L,_,"≼","\\preccurlyeq",!0),$(L,_,"⋞","\\curlyeqprec",!0),$(L,_,"≾","\\precsim",!0),$(L,_,"⪷","\\precapprox",!0),$(L,_,"⊲","\\vartriangleleft"),$(L,_,"⊴","\\trianglelefteq"),$(L,_,"⊨","\\vDash",!0),$(L,_,"⊫","\\VDash",!0),$(L,_,"⊪","\\Vvdash",!0),$(L,_,"⌣","\\smallsmile"),$(L,_,"⌢","\\smallfrown"),$(L,_,"≏","\\bumpeq",!0),$(L,_,"≎","\\Bumpeq",!0),$(L,_,"≧","\\geqq",!0),$(L,_,"⩾","\\geqslant",!0),$(L,_,"⪖","\\eqslantgtr",!0),$(L,_,"≳","\\gtrsim",!0),$(L,_,"⪆","\\gtrapprox",!0),$(L,D,"⋗","\\gtrdot"),$(L,_,"⋙","\\ggg",!0),$(L,_,"≷","\\gtrless",!0),$(L,_,"⋛","\\gtreqless",!0),$(L,_,"⪌","\\gtreqqless",!0),$(L,_,"≖","\\eqcirc",!0),$(L,_,"≗","\\circeq",!0),$(L,_,"≜","\\triangleq",!0),$(L,_,"∼","\\thicksim"),$(L,_,"≈","\\thickapprox"),$(L,_,"⫆","\\supseteqq",!0),$(L,_,"⋑","\\Supset",!0),$(L,_,"⊐","\\sqsupset",!0),$(L,_,"≽","\\succcurlyeq",!0),$(L,_,"⋟","\\curlyeqsucc",!0),$(L,_,"≿","\\succsim",!0),$(L,_,"⪸","\\succapprox",!0),$(L,_,"⊳","\\vartriangleright"),$(L,_,"⊵","\\trianglerighteq"),$(L,_,"⊩","\\Vdash",!0),$(L,_,"∣","\\shortmid"),$(L,_,"∥","\\shortparallel"),$(L,_,"≬","\\between",!0),$(L,_,"⋔","\\pitchfork",!0),$(L,_,"∝","\\varpropto"),$(L,_,"◀","\\blacktriangleleft"),$(L,_,"∴","\\therefore",!0),$(L,_,"∍","\\backepsilon"),$(L,_,"▶","\\blacktriangleright"),$(L,_,"∵","\\because",!0),$(L,_,"⋘","\\llless"),$(L,_,"⋙","\\gggtr"),$(L,D,"⊲","\\lhd"),$(L,D,"⊳","\\rhd"),$(L,_,"≂","\\eqsim",!0),$(L,_,"≑","\\Doteq",!0),$(L,_,"⥽","\\strictif",!0),$(L,_,"⥼","\\strictfi",!0),$(L,D,"∔","\\dotplus",!0),$(L,D,"∖","\\smallsetminus"),$(L,D,"⋒","\\Cap",!0),$(L,D,"⋓","\\Cup",!0),$(L,D,"⩞","\\doublebarwedge",!0),$(L,D,"⊟","\\boxminus",!0),$(L,D,"⊞","\\boxplus",!0),$(L,D,"⧄","\\boxslash",!0),$(L,D,"⋇","\\divideontimes",!0),$(L,D,"⋉","\\ltimes",!0),$(L,D,"⋊","\\rtimes",!0),$(L,D,"⋋","\\leftthreetimes",!0),$(L,D,"⋌","\\rightthreetimes",!0),$(L,D,"⋏","\\curlywedge",!0),$(L,D,"⋎","\\curlyvee",!0),$(L,D,"⊝","\\circleddash",!0),$(L,D,"⊛","\\circledast",!0),$(L,D,"⊺","\\intercal",!0),$(L,D,"⋒","\\doublecap"),$(L,D,"⋓","\\doublecup"),$(L,D,"⊠","\\boxtimes",!0),$(L,D,"⋈","\\bowtie",!0),$(L,D,"⋈","\\Join"),$(L,D,"⟕","\\leftouterjoin",!0),$(L,D,"⟖","\\rightouterjoin",!0),$(L,D,"⟗","\\fullouterjoin",!0),$(L,D,"∸","\\dotminus",!0),$(L,D,"⟑","\\wedgedot",!0),$(L,D,"⟇","\\veedot",!0),$(L,D,"⩢","\\doublebarvee",!0),$(L,D,"⩣","\\veedoublebar",!0),$(L,D,"⩟","\\wedgebar",!0),$(L,D,"⩠","\\wedgedoublebar",!0),$(L,D,"⩔","\\Vee",!0),$(L,D,"⩓","\\Wedge",!0),$(L,D,"⩃","\\barcap",!0),$(L,D,"⩂","\\barcup",!0),$(L,D,"⩈","\\capbarcup",!0),$(L,D,"⩀","\\capdot",!0),$(L,D,"⩇","\\capovercup",!0),$(L,D,"⩆","\\cupovercap",!0),$(L,D,"⩍","\\closedvarcap",!0),$(L,D,"⩌","\\closedvarcup",!0),$(L,D,"⨪","\\minusdot",!0),$(L,D,"⨫","\\minusfdots",!0),$(L,D,"⨬","\\minusrdots",!0),$(L,D,"⊻","\\Xor",!0),$(L,D,"⊼","\\Nand",!0),$(L,D,"⊽","\\Nor",!0),$(L,D,"⊽","\\barvee"),$(L,D,"⫴","\\interleave",!0),$(L,D,"⧢","\\shuffle",!0),$(L,D,"⫶","\\threedotcolon",!0),$(L,D,"⦂","\\typecolon",!0),$(L,D,"∾","\\invlazys",!0),$(L,D,"⩋","\\twocaps",!0),$(L,D,"⩊","\\twocups",!0),$(L,D,"⩎","\\Sqcap",!0),$(L,D,"⩏","\\Sqcup",!0),$(L,D,"⩖","\\veeonvee",!0),$(L,D,"⩕","\\wedgeonwedge",!0),$(L,D,"⧗","\\blackhourglass",!0),$(L,D,"⧆","\\boxast",!0),$(L,D,"⧈","\\boxbox",!0),$(L,D,"⧇","\\boxcircle",!0),$(L,D,"⊜","\\circledequal",!0),$(L,D,"⦷","\\circledparallel",!0),$(L,D,"⦶","\\circledvert",!0),$(L,D,"⦵","\\circlehbar",!0),$(L,D,"⟡","\\concavediamond",!0),$(L,D,"⟢","\\concavediamondtickleft",!0),$(L,D,"⟣","\\concavediamondtickright",!0),$(L,D,"⋄","\\diamond",!0),$(L,D,"⧖","\\hourglass",!0),$(L,D,"⟠","\\lozengeminus",!0),$(L,D,"⌽","\\obar",!0),$(L,D,"⦸","\\obslash",!0),$(L,D,"⨸","\\odiv",!0),$(L,D,"⧁","\\ogreaterthan",!0),$(L,D,"⧀","\\olessthan",!0),$(L,D,"⦹","\\operp",!0),$(L,D,"⨷","\\Otimes",!0),$(L,D,"⨶","\\otimeshat",!0),$(L,D,"⋆","\\star",!0),$(L,D,"△","\\triangle",!0),$(L,D,"⨺","\\triangleminus",!0),$(L,D,"⨹","\\triangleplus",!0),$(L,D,"⨻","\\triangletimes",!0),$(L,D,"⟤","\\whitesquaretickleft",!0),$(L,D,"⟥","\\whitesquaretickright",!0),$(L,D,"⨳","\\smashtimes",!0),$(L,_,"⇢","\\dashrightarrow",!0),$(L,_,"⇠","\\dashleftarrow",!0),$(L,_,"⇇","\\leftleftarrows",!0),$(L,_,"⇆","\\leftrightarrows",!0),$(L,_,"⇚","\\Lleftarrow",!0),$(L,_,"↞","\\twoheadleftarrow",!0),$(L,_,"↢","\\leftarrowtail",!0),$(L,_,"↫","\\looparrowleft",!0),$(L,_,"⇋","\\leftrightharpoons",!0),$(L,_,"↶","\\curvearrowleft",!0),$(L,_,"↺","\\circlearrowleft",!0),$(L,_,"↰","\\Lsh",!0),$(L,_,"⇈","\\upuparrows",!0),$(L,_,"↿","\\upharpoonleft",!0),$(L,_,"⇃","\\downharpoonleft",!0),$(L,_,"⊶","\\origof",!0),$(L,_,"⊷","\\imageof",!0),$(L,_,"⊸","\\multimap",!0),$(L,_,"↭","\\leftrightsquigarrow",!0),$(L,_,"⇉","\\rightrightarrows",!0),$(L,_,"⇄","\\rightleftarrows",!0),$(L,_,"↠","\\twoheadrightarrow",!0),$(L,_,"↣","\\rightarrowtail",!0),$(L,_,"↬","\\looparrowright",!0),$(L,_,"↷","\\curvearrowright",!0),$(L,_,"↻","\\circlearrowright",!0),$(L,_,"↱","\\Rsh",!0),$(L,_,"⇊","\\downdownarrows",!0),$(L,_,"↾","\\upharpoonright",!0),$(L,_,"⇂","\\downharpoonright",!0),$(L,_,"⇝","\\rightsquigarrow",!0),$(L,_,"⇝","\\leadsto"),$(L,_,"⇛","\\Rrightarrow",!0),$(L,_,"↾","\\restriction"),$(L,X,"‘","`"),$(L,X,"$","\\$"),$(F,X,"$","\\$"),$(F,X,"$","\\textdollar"),$(L,X,"¢","\\cent"),$(F,X,"¢","\\cent"),$(L,X,"%","\\%"),$(F,X,"%","\\%"),$(L,X,"_","\\_"),$(F,X,"_","\\_"),$(F,X,"_","\\textunderscore"),$(F,X,"␣","\\textvisiblespace",!0),$(L,X,"∠","\\angle",!0),$(L,X,"∞","\\infty",!0),$(L,X,"′","\\prime"),$(L,X,"″","\\dprime"),$(L,X,"‴","\\trprime"),$(L,X,"⁗","\\qprime"),$(L,X,"△","\\triangle"),$(F,X,"Α","\\Alpha",!0),$(F,X,"Β","\\Beta",!0),$(F,X,"Γ","\\Gamma",!0),$(F,X,"Δ","\\Delta",!0),$(F,X,"Ε","\\Epsilon",!0),$(F,X,"Ζ","\\Zeta",!0),$(F,X,"Η","\\Eta",!0),$(F,X,"Θ","\\Theta",!0),$(F,X,"Ι","\\Iota",!0),$(F,X,"Κ","\\Kappa",!0),$(F,X,"Λ","\\Lambda",!0),$(F,X,"Μ","\\Mu",!0),$(F,X,"Ν","\\Nu",!0),$(F,X,"Ξ","\\Xi",!0),$(F,X,"Ο","\\Omicron",!0),$(F,X,"Π","\\Pi",!0),$(F,X,"Ρ","\\Rho",!0),$(F,X,"Σ","\\Sigma",!0),$(F,X,"Τ","\\Tau",!0),$(F,X,"Υ","\\Upsilon",!0),$(F,X,"Φ","\\Phi",!0),$(F,X,"Χ","\\Chi",!0),$(F,X,"Ψ","\\Psi",!0),$(F,X,"Ω","\\Omega",!0),$(L,R,"Α","\\Alpha",!0),$(L,R,"Β","\\Beta",!0),$(L,R,"Γ","\\Gamma",!0),$(L,R,"Δ","\\Delta",!0),$(L,R,"Ε","\\Epsilon",!0),$(L,R,"Ζ","\\Zeta",!0),$(L,R,"Η","\\Eta",!0),$(L,R,"Θ","\\Theta",!0),$(L,R,"Ι","\\Iota",!0),$(L,R,"Κ","\\Kappa",!0),$(L,R,"Λ","\\Lambda",!0),$(L,R,"Μ","\\Mu",!0),$(L,R,"Ν","\\Nu",!0),$(L,R,"Ξ","\\Xi",!0),$(L,R,"Ο","\\Omicron",!0),$(L,R,"Π","\\Pi",!0),$(L,R,"Ρ","\\Rho",!0),$(L,R,"Σ","\\Sigma",!0),$(L,R,"Τ","\\Tau",!0),$(L,R,"Υ","\\Upsilon",!0),$(L,R,"Φ","\\Phi",!0),$(L,R,"Χ","\\Chi",!0),$(L,R,"Ψ","\\Psi",!0),$(L,R,"Ω","\\Omega",!0),$(L,H,"¬","\\neg",!0),$(L,H,"¬","\\lnot"),$(L,X,"⊤","\\top"),$(L,X,"⊥","\\bot"),$(L,X,"∅","\\emptyset"),$(L,X,"⌀","\\varnothing"),$(L,R,"α","\\alpha",!0),$(L,R,"β","\\beta",!0),$(L,R,"γ","\\gamma",!0),$(L,R,"δ","\\delta",!0),$(L,R,"ϵ","\\epsilon",!0),$(L,R,"ζ","\\zeta",!0),$(L,R,"η","\\eta",!0),$(L,R,"θ","\\theta",!0),$(L,R,"ι","\\iota",!0),$(L,R,"κ","\\kappa",!0),$(L,R,"λ","\\lambda",!0),$(L,R,"μ","\\mu",!0),$(L,R,"ν","\\nu",!0),$(L,R,"ξ","\\xi",!0),$(L,R,"ο","\\omicron",!0),$(L,R,"π","\\pi",!0),$(L,R,"ρ","\\rho",!0),$(L,R,"σ","\\sigma",!0),$(L,R,"τ","\\tau",!0),$(L,R,"υ","\\upsilon",!0),$(L,R,"ϕ","\\phi",!0),$(L,R,"χ","\\chi",!0),$(L,R,"ψ","\\psi",!0),$(L,R,"ω","\\omega",!0),$(L,R,"ε","\\varepsilon",!0),$(L,R,"ϑ","\\vartheta",!0),$(L,R,"ϖ","\\varpi",!0),$(L,R,"ϱ","\\varrho",!0),$(L,R,"ς","\\varsigma",!0),$(L,R,"φ","\\varphi",!0),$(L,R,"Ϙ","\\Coppa",!0),$(L,R,"ϙ","\\coppa",!0),$(L,R,"ϙ","\\varcoppa",!0),$(L,R,"Ϟ","\\Koppa",!0),$(L,R,"ϟ","\\koppa",!0),$(L,R,"Ϡ","\\Sampi",!0),$(L,R,"ϡ","\\sampi",!0),$(L,R,"Ϛ","\\Stigma",!0),$(L,R,"ϛ","\\stigma",!0),$(L,R,"⫫","\\Bot"),$(L,D,"∗","∗",!0),$(L,D,"+","+"),$(L,D,"*","*"),$(L,D,"⁄","/",!0),$(L,D,"⁄","⁄"),$(L,D,"−","-",!0),$(L,D,"⋅","\\cdot",!0),$(L,D,"∘","\\circ",!0),$(L,D,"÷","\\div",!0),$(L,D,"±","\\pm",!0),$(L,D,"×","\\times",!0),$(L,D,"∩","\\cap",!0),$(L,D,"∪","\\cup",!0),$(L,D,"∖","\\setminus",!0),$(L,D,"∧","\\land"),$(L,D,"∨","\\lor"),$(L,D,"∧","\\wedge",!0),$(L,D,"∨","\\vee",!0),$(L,H,"⟦","\\llbracket",!0),$(L,j,"⟧","\\rrbracket",!0),$(L,H,"⟨","\\langle",!0),$(L,H,"⟪","\\lAngle",!0),$(L,H,"⦉","\\llangle",!0),$(L,H,"|","\\lvert"),$(L,H,"‖","\\lVert",!0),$(L,X,"!","\\oc"),$(L,X,"?","\\wn"),$(L,X,"↓","\\shpos"),$(L,X,"↕","\\shift"),$(L,X,"↑","\\shneg"),$(L,j,"?","?"),$(L,j,"!","!"),$(L,j,"‼","‼"),$(L,j,"⟩","\\rangle",!0),$(L,j,"⟫","\\rAngle",!0),$(L,j,"⦊","\\rrangle",!0),$(L,j,"|","\\rvert"),$(L,j,"‖","\\rVert"),$(L,H,"⦃","\\lBrace",!0),$(L,j,"⦄","\\rBrace",!0),$(L,_,"=","\\equal",!0),$(L,_,":",":"),$(L,_,"≈","\\approx",!0),$(L,_,"≅","\\cong",!0),$(L,_,"≥","\\ge"),$(L,_,"≥","\\geq",!0),$(L,_,"←","\\gets"),$(L,_,">","\\gt",!0),$(L,_,"∈","\\in",!0),$(L,_,"∉","\\notin",!0),$(L,_,"","\\@not"),$(L,_,"⊂","\\subset",!0),$(L,_,"⊃","\\supset",!0),$(L,_,"⊆","\\subseteq",!0),$(L,_,"⊇","\\supseteq",!0),$(L,_,"⊈","\\nsubseteq",!0),$(L,_,"⊈","\\nsubseteqq"),$(L,_,"⊉","\\nsupseteq",!0),$(L,_,"⊉","\\nsupseteqq"),$(L,_,"⊨","\\models"),$(L,_,"←","\\leftarrow",!0),$(L,_,"≤","\\le"),$(L,_,"≤","\\leq",!0),$(L,_,"<","\\lt",!0),$(L,_,"→","\\rightarrow",!0),$(L,_,"→","\\to"),$(L,_,"≱","\\ngeq",!0),$(L,_,"≱","\\ngeqq"),$(L,_,"≱","\\ngeqslant"),$(L,_,"≰","\\nleq",!0),$(L,_,"≰","\\nleqq"),$(L,_,"≰","\\nleqslant"),$(L,_,"⫫","\\Perp",!0),$(L,W," ","\\ "),$(L,W," ","\\space"),$(L,W," ","\\nobreakspace"),$(F,W," ","\\ "),$(F,W," "," "),$(F,W," ","\\space"),$(F,W," ","\\nobreakspace"),$(L,W,null,"\\nobreak"),$(L,W,null,"\\allowbreak"),$(L,V,",",","),$(F,V,":",":"),$(L,V,";",";"),$(L,D,"⊼","\\barwedge"),$(L,D,"⊻","\\veebar"),$(L,D,"⊙","\\odot",!0),$(L,D,"⊕︎","\\oplus"),$(L,D,"⊗","\\otimes",!0),$(L,X,"∂","\\partial",!0),$(L,D,"⊘","\\oslash",!0),$(L,D,"⊚","\\circledcirc",!0),$(L,D,"⊡","\\boxdot",!0),$(L,D,"△","\\bigtriangleup"),$(L,D,"▽","\\bigtriangledown"),$(L,D,"†","\\dagger"),$(L,D,"⋄","\\diamond"),$(L,D,"◃","\\triangleleft"),$(L,D,"▹","\\triangleright"),$(L,H,"{","\\{"),$(F,X,"{","\\{"),$(F,X,"{","\\textbraceleft"),$(L,j,"}","\\}"),$(F,X,"}","\\}"),$(F,X,"}","\\textbraceright"),$(L,H,"{","\\lbrace"),$(L,j,"}","\\rbrace"),$(L,H,"[","\\lbrack",!0),$(F,X,"[","\\lbrack",!0),$(L,j,"]","\\rbrack",!0),$(F,X,"]","\\rbrack",!0),$(L,H,"(","\\lparen",!0),$(L,j,")","\\rparen",!0),$(L,H,"⦇","\\llparenthesis",!0),$(L,j,"⦈","\\rrparenthesis",!0),$(F,X,"<","\\textless",!0),$(F,X,">","\\textgreater",!0),$(L,H,"⌊","\\lfloor",!0),$(L,j,"⌋","\\rfloor",!0),$(L,H,"⌈","\\lceil",!0),$(L,j,"⌉","\\rceil",!0),$(L,X,"\\","\\backslash"),$(L,X,"|","|"),$(L,X,"|","\\vert"),$(F,X,"|","\\textbar",!0),$(L,X,"‖","\\|"),$(L,X,"‖","\\Vert"),$(F,X,"‖","\\textbardbl"),$(F,X,"~","\\textasciitilde"),$(F,X,"\\","\\textbackslash"),$(F,X,"^","\\textasciicircum"),$(L,_,"↑","\\uparrow",!0),$(L,_,"⇑","\\Uparrow",!0),$(L,_,"↓","\\downarrow",!0),$(L,_,"⇓","\\Downarrow",!0),$(L,_,"↕","\\updownarrow",!0),$(L,_,"⇕","\\Updownarrow",!0),$(L,U,"∐","\\coprod"),$(L,U,"⋁","\\bigvee"),$(L,U,"⋀","\\bigwedge"),$(L,U,"⨄","\\biguplus"),$(L,U,"⨄","\\bigcupplus"),$(L,U,"⨃","\\bigcupdot"),$(L,U,"⨇","\\bigdoublevee"),$(L,U,"⨈","\\bigdoublewedge"),$(L,U,"⋂","\\bigcap"),$(L,U,"⋃","\\bigcup"),$(L,U,"∫","\\int"),$(L,U,"∫","\\intop"),$(L,U,"∬","\\iint"),$(L,U,"∭","\\iiint"),$(L,U,"∏","\\prod"),$(L,U,"∑","\\sum"),$(L,U,"⨂","\\bigotimes"),$(L,U,"⨁","\\bigoplus"),$(L,U,"⨀","\\bigodot"),$(L,U,"⨉","\\bigtimes"),$(L,U,"∮","\\oint"),$(L,U,"∯","\\oiint"),$(L,U,"∰","\\oiiint"),$(L,U,"∱","\\intclockwise"),$(L,U,"∲","\\varointclockwise"),$(L,U,"⨌","\\iiiint"),$(L,U,"⨍","\\intbar"),$(L,U,"⨎","\\intBar"),$(L,U,"⨏","\\fint"),$(L,U,"⨒","\\rppolint"),$(L,U,"⨓","\\scpolint"),$(L,U,"⨕","\\pointint"),$(L,U,"⨖","\\sqint"),$(L,U,"⨗","\\intlarhk"),$(L,U,"⨘","\\intx"),$(L,U,"⨙","\\intcap"),$(L,U,"⨚","\\intcup"),$(L,U,"⨅","\\bigsqcap"),$(L,U,"⨆","\\bigsqcup"),$(L,U,"∫","\\smallint"),$(F,P,"…","\\textellipsis"),$(L,P,"…","\\mathellipsis"),$(F,P,"…","\\ldots",!0),$(L,P,"…","\\ldots",!0),$(L,P,"⋰","\\iddots",!0),$(L,P,"⋯","\\@cdots",!0),$(L,P,"⋱","\\ddots",!0),$(L,X,"⋮","\\varvdots"),$(F,X,"⋮","\\varvdots"),$(L,G,"ˊ","\\acute"),$(L,G,"`","\\grave"),$(L,G,"¨","\\ddot"),$(L,G,"…","\\dddot"),$(L,G,"….","\\ddddot"),$(L,G,"~","\\tilde"),$(L,G,"‾","\\bar"),$(L,G,"˘","\\breve"),$(L,G,"ˇ","\\check"),$(L,G,"^","\\hat"),$(L,G,"→","\\vec"),$(L,G,"˙","\\dot"),$(L,G,"˚","\\mathring"),$(L,R,"ı","\\imath",!0),$(L,R,"ȷ","\\jmath",!0),$(L,X,"ı","ı"),$(L,X,"ȷ","ȷ"),$(F,X,"ı","\\i",!0),$(F,X,"ȷ","\\j",!0),$(F,X,"ß","\\ss",!0),$(F,X,"æ","\\ae",!0),$(F,X,"œ","\\oe",!0),$(F,X,"ø","\\o",!0),$(L,R,"ø","\\o",!0),$(F,X,"Æ","\\AE",!0),$(F,X,"Œ","\\OE",!0),$(F,X,"Ø","\\O",!0),$(L,R,"Ø","\\O",!0),$(F,G,"ˊ","\\'"),$(F,G,"ˋ","\\`"),$(F,G,"ˆ","\\^"),$(F,G,"˜","\\~"),$(F,G,"ˉ","\\="),$(F,G,"˘","\\u"),$(F,G,"˙","\\."),$(F,G,"¸","\\c"),$(F,G,"˚","\\r"),$(F,G,"ˇ","\\v"),$(F,G,"¨",'\\"'),$(F,G,"˝","\\H"),$(L,G,"ˊ","\\'"),$(L,G,"ˋ","\\`"),$(L,G,"ˆ","\\^"),$(L,G,"˜","\\~"),$(L,G,"ˉ","\\="),$(L,G,"˘","\\u"),$(L,G,"˙","\\."),$(L,G,"¸","\\c"),$(L,G,"˚","\\r"),$(L,G,"ˇ","\\v"),$(L,G,"¨",'\\"'),$(L,G,"˝","\\H");const Z={"--":!0,"---":!0,"``":!0,"''":!0};$(F,X,"–","--",!0),$(F,X,"–","\\textendash"),$(F,X,"—","---",!0),$(F,X,"—","\\textemdash"),$(F,X,"‘","`",!0),$(F,X,"‘","\\textquoteleft"),$(F,X,"’","'",!0),$(F,X,"’","\\textquoteright"),$(F,X,"“","``",!0),$(F,X,"“","\\textquotedblleft"),$(F,X,"”","''",!0),$(F,X,"”","\\textquotedblright"),$(L,X,"°","\\degree",!0),$(F,X,"°","\\degree"),$(F,X,"°","\\textdegree",!0),$(L,X,"£","\\pounds"),$(L,X,"£","\\mathsterling",!0),$(F,X,"£","\\pounds"),$(F,X,"£","\\textsterling",!0),$(L,X,"✠","\\maltese"),$(F,X,"✠","\\maltese"),$(L,X,"€","\\euro",!0),$(F,X,"€","\\euro",!0),$(F,X,"€","\\texteuro"),$(L,X,"©","\\copyright",!0),$(F,X,"©","\\textcopyright"),$(L,X,"⌀","\\diameter",!0),$(F,X,"⌀","\\diameter"),$(L,X,"𝛤","\\varGamma"),$(L,X,"𝛥","\\varDelta"),$(L,X,"𝛩","\\varTheta"),$(L,X,"𝛬","\\varLambda"),$(L,X,"𝛯","\\varXi"),$(L,X,"𝛱","\\varPi"),$(L,X,"𝛴","\\varSigma"),$(L,X,"𝛶","\\varUpsilon"),$(L,X,"𝛷","\\varPhi"),$(L,X,"𝛹","\\varPsi"),$(L,X,"𝛺","\\varOmega"),$(F,X,"𝛤","\\varGamma"),$(F,X,"𝛥","\\varDelta"),$(F,X,"𝛩","\\varTheta"),$(F,X,"𝛬","\\varLambda"),$(F,X,"𝛯","\\varXi"),$(F,X,"𝛱","\\varPi"),$(F,X,"𝛴","\\varSigma"),$(F,X,"𝛶","\\varUpsilon"),$(F,X,"𝛷","\\varPhi"),$(F,X,"𝛹","\\varPsi"),$(F,X,"𝛺","\\varOmega");const Y='0123456789/@."';for(let e=0;e<14;e++){const t=Y.charAt(e);$(L,X,t,t)}const K='0123456789!@*()-=+";:?/.,';for(let e=0;e<25;e++){const t=K.charAt(e);$(F,X,t,t)}const J="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";for(let e=0;e<52;e++){const t=J.charAt(e);$(L,R,t,t),$(F,X,t,t)}const Q="ÇÐÞçþℂℍℕℙℚℝℤℎℏℊℋℌℐℑℒℓ℘ℛℜℬℰℱℳℭℨ";for(let e=0;e<30;e++){const t=Q.charAt(e);$(L,R,t,t),$(F,X,t,t)}let ee="";for(let e=0;e<52;e++){ee=String.fromCharCode(55349,56320+e),$(L,R,ee,ee),$(F,X,ee,ee),ee=String.fromCharCode(55349,56372+e),$(L,R,ee,ee),$(F,X,ee,ee),ee=String.fromCharCode(55349,56424+e),$(L,R,ee,ee),$(F,X,ee,ee),ee=String.fromCharCode(55349,56580+e),$(L,R,ee,ee),$(F,X,ee,ee),ee=String.fromCharCode(55349,56736+e),$(L,R,ee,ee),$(F,X,ee,ee),ee=String.fromCharCode(55349,56788+e),$(L,R,ee,ee),$(F,X,ee,ee),ee=String.fromCharCode(55349,56840+e),$(L,R,ee,ee),$(F,X,ee,ee),ee=String.fromCharCode(55349,56944+e),$(L,R,ee,ee),$(F,X,ee,ee),ee=String.fromCharCode(55349,56632+e),$(L,R,ee,ee),$(F,X,ee,ee);const t=J.charAt(e);ee=String.fromCharCode(55349,56476+e),$(L,R,t,ee),$(F,X,t,ee)}for(let e=0;e<10;e++)ee=String.fromCharCode(55349,57294+e),$(L,R,ee,ee),$(F,X,ee,ee),ee=String.fromCharCode(55349,57314+e),$(L,R,ee,ee),$(F,X,ee,ee),ee=String.fromCharCode(55349,57324+e),$(L,R,ee,ee),$(F,X,ee,ee),ee=String.fromCharCode(55349,57334+e),$(L,R,ee,ee),$(F,X,ee,ee);const te=function(e,t,r){return!I[t][e]||!I[t][e].replace||55349===e.charCodeAt(0)||Object.prototype.hasOwnProperty.call(Z,e)&&r&&(r.fontFamily&&"tt"===r.fontFamily.slice(4,6)||r.font&&"tt"===r.font.slice(4,6))||(e=I[t][e].replace),new T.TextNode(e)},re=(e,t)=>{if(0===e.children.length||"mtext"!==e.children[e.children.length-1].type){const r=new T.MathNode("mtext",[new T.TextNode(t.children[0].text)]);e.children.push(r)}else e.children[e.children.length-1].children[0].text+=t.children[0].text},ne=e=>{if("mrow"!==e.type&&"mstyle"!==e.type)return e;if(0===e.children.length)return e;const t=new T.MathNode("mrow");for(let r=0;r<e.children.length;r++){const n=e.children[r];if("mtext"===n.type&&0===Object.keys(n.attributes).length)re(t,n);else if("mrow"===n.type){let e=!0;for(let t=0;t<n.children.length;t++){if("mtext"!==n.children[t].type||0!==Object.keys(n.attributes).length){e=!1;break}}if(e)for(let e=0;e<n.children.length;e++){const r=n.children[e];re(t,r)}else t.children.push(n)}else t.children.push(n)}for(let r=0;r<t.children.length;r++)if("mtext"===t.children[r].type){const n=t.children[r];" "===n.children[0].text.charAt(0)&&(n.children[0].text=" "+n.children[0].text.slice(1));const o=n.children[0].text.length;o>0&&" "===n.children[0].text.charAt(o-1)&&(n.children[0].text=n.children[0].text.slice(0,-1)+" ");for(const[t,r]of Object.entries(e.attributes))n.attributes[t]=r}return 1===t.children.length&&"mtext"===t.children[0].type?t.children[0]:t},oe=function(e,t=!1){if(!(1!==e.length||e[0]instanceof p))return e[0];if(!t){e[0]instanceof v&&"mo"===e[0].type&&!e[0].attributes.fence&&(e[0].attributes.lspace="0em",e[0].attributes.rspace="0em");const t=e.length-1;e[t]instanceof v&&"mo"===e[t].type&&!e[t].attributes.fence&&(e[t].attributes.lspace="0em",e[t].attributes.rspace="0em")}return new T.MathNode("mrow",e)};function se(e){if(!e)return!1;if("mi"===e.type&&1===e.children.length){const t=e.children[0];return t instanceof A&&"."===t.text}if("mtext"===e.type&&1===e.children.length){const t=e.children[0];return t instanceof A&&" "===t.text}if("mo"===e.type&&1===e.children.length&&"true"===e.getAttribute("separator")&&"0em"===e.getAttribute("lspace")&&"0em"===e.getAttribute("rspace")){const t=e.children[0];return t instanceof A&&","===t.text}return!1}const ae=(e,t)=>{const r=e[t],n=e[t+1];return"atom"===r.type&&","===r.text&&r.loc&&n.loc&&r.loc.end===n.loc.start},le=e=>"atom"===e.type&&"rel"===e.family||"mclass"===e.type&&"mrel"===e.mclass,ie=function(e,t,r=!1){if(!r&&1===e.length){const r=me(e[0],t);return r instanceof v&&"mo"===r.type&&(r.setAttribute("lspace","0em"),r.setAttribute("rspace","0em")),[r]}const n=[],o=[];let s;for(let r=0;r<e.length;r++)o.push(me(e[r],t));for(let t=0;t<o.length;t++){const r=o[t];if(t<e.length-1&&le(e[t])&&le(e[t+1])&&r.setAttribute("rspace","0em"),t>0&&le(e[t])&&le(e[t-1])&&r.setAttribute("lspace","0em"),"mn"===r.type&&s&&"mn"===s.type)s.children.push(...r.children);else if(se(r)&&s&&"mn"===s.type)s.children.push(...r.children);else if(s&&"mn"===s.type&&t<o.length-1&&"mn"===o[t+1].type&&ae(e,t))s.children.push(...r.children);else{if("mn"===r.type&&se(s))r.children=[...s.children,...r.children],n.pop();else if(("msup"===r.type||"msub"===r.type)&&r.children.length>=1&&s&&("mn"===s.type||se(s))){const e=r.children[0];e instanceof v&&"mn"===e.type&&s&&(e.children=[...s.children,...e.children],n.pop())}n.push(r),s=r}}return n},ce=function(e,t,r=!1){return oe(ie(e,t,r),r)},me=function(t,r){if(!t)return new T.MathNode("mrow");if(i[t.type]){return i[t.type](t,r)}throw new e("Got group of unknown type: '"+t.type+"'")},ue=e=>new T.MathNode("mtd",[],[],{padding:"0",width:"50%"});function de(e,t,r,n){let o=null;1===e.length&&"tag"===e[0].type&&(o=e[0].tag,e=e[0].body);const s=ie(e,r);if(1===s.length&&s[0]instanceof x)return s[0];const a=n.displayMode||n.annotate?"none":n.wrap,l=0===s.length?null:s[0];let i=1===s.length&&null===o&&l instanceof v?s[0]:function(e,t,r){const n=[];let o=[],s=[],a=0,l=0,i=0;for(;l<e.length;){for(;e[l]instanceof p;)e.splice(l,1,...e[l].children);const r=e[l];if(r.attributes&&r.attributes.linebreak&&"newline"===r.attributes.linebreak){s.length>0&&o.push(new T.MathNode("mrow",s)),o.push(r),s=[];const e=new T.MathNode("mtd",o);e.style.textAlign="left",n.push(new T.MathNode("mtr",[e])),o=[],l+=1}else{if(s.push(r),r.type&&"mo"===r.type&&1===r.children.length&&!Object.hasOwn(r.attributes,"movablelimits")){const n=r.children[0].text;if("([{⌊⌈⟨⟮⎰⟦⦃".indexOf(n)>-1)i+=1;else if(")]}⌋⌉⟩⟯⎱⟦⦄".indexOf(n)>-1)i-=1;else if(0===i&&"="===t&&"="===n){if(a+=1,a>1){s.pop();const e=new T.MathNode("mrow",s);o.push(e),s=[r]}}else if(0===i&&"tex"===t&&"∇"!==n){const t=l<e.length-1?e[l+1]:null;let r=!0;if(!t||"mtext"!==t.type||!t.attributes.linebreak||"nobreak"!==t.attributes.linebreak)for(let t=l+1;t<e.length;t++){const n=e[t];if(!n.type||"mspace"!==n.type||n.attributes.linebreak&&"newline"===n.attributes.linebreak)break;s.push(n),l+=1,n.attributes&&n.attributes.linebreak&&"nobreak"===n.attributes.linebreak&&(r=!1)}if(r){const e=new T.MathNode("mrow",s);o.push(e),s=[]}}}l+=1}}if(s.length>0){const e=new T.MathNode("mrow",s);o.push(e)}if(n.length>0){const e=new T.MathNode("mtd",o);e.style.textAlign="left";const t=new T.MathNode("mtr",[e]);n.push(t);const s=new T.MathNode("mtable",n);return r||(s.setAttribute("columnalign","left"),s.setAttribute("rowspacing","0em")),s}return T.newDocumentFragment(o)}(s,a,n.displayMode);if(o&&(i=((e,t,r,n)=>{t=ce(t[0].body,r),(t=ne(t)).classes.push("tml-tag"),e=new T.MathNode("mtd",[e]);const o=[ue(),e,ue()];o[n?0:2].classes.push(n?"tml-left":"tml-right"),o[n?0:2].children.push(t);const s=new T.MathNode("mtr",o,["tml-tageqn"]),a=new T.MathNode("mtable",[s]);return a.style.width="100%",a.setAttribute("displaystyle","true"),a})(i,o,r,n.leqno)),n.annotate){const e=new T.MathNode("annotation",[new T.TextNode(t)]);e.setAttribute("encoding","application/x-tex"),i=new T.MathNode("semantics",[i,e])}const c=new T.MathNode("math",[i]);return n.xml&&c.setAttribute("xmlns","http://www.w3.org/1998/Math/MathML"),i.style.width&&(c.style.width="100%"),n.displayMode&&(c.setAttribute("display","block"),c.style.display="block math",c.classes=["tml-display"]),c}const pe="acegıȷmnopqrsuvwxyzαγεηικμνοπρςστυχωϕ𝐚𝐜𝐞𝐠𝐦𝐧𝐨𝐩𝐪𝐫𝐬𝐮𝐯𝐰𝐱𝐲𝐳",he="ABCDEFGHIJKLMNOPQRSTUVWXYZbdfhkltΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡΣΤΥΦΧΨΩβδλζφθψ𝐀𝐁𝐂𝐃𝐄𝐅𝐆𝐇𝐈𝐉𝐊𝐋𝐌𝐍𝐎𝐏𝐐𝐑𝐒𝐓𝐔𝐕𝐖𝐗𝐘𝐙𝐛𝐝𝐟𝐡𝐤𝐥𝐭",ge=new Set(["\\alpha","\\gamma","\\delta","\\epsilon","\\eta","\\iota","\\kappa","\\mu","\\nu","\\pi","\\rho","\\sigma","\\tau","\\upsilon","\\chi","\\psi","\\omega","\\imath","\\jmath"]),fe=new Set(["\\Gamma","\\Delta","\\Sigma","\\Omega","\\beta","\\delta","\\lambda","\\theta","\\psi"]),be=(e,t)=>{const r=e.isStretchy?C(e):new T.MathNode("mo",[te(e.label,e.mode)]);if("\\vec"===e.label)r.style.transform="scale(0.75) translate(10%, 30%)";else if(r.style.mathStyle="normal",r.style.mathDepth="0",we.has(e.label)&&s.isCharacterBox(e.base)){let t="";const n=e.base.text;(pe.indexOf(n)>-1||ge.has(n))&&(t="tml-xshift"),(he.indexOf(n)>-1||fe.has(n))&&(t="tml-capshift"),t&&r.classes.push(t)}e.isStretchy||r.setAttribute("stretchy","false");return new T.MathNode("\\c"===e.label?"munder":"mover",[me(e.base,t),r])},ye=new Set(["\\acute","\\grave","\\ddot","\\dddot","\\ddddot","\\tilde","\\bar","\\breve","\\check","\\hat","\\vec","\\dot","\\mathring"]),we=new Set(["\\acute","\\bar","\\breve","\\check","\\dot","\\ddot","\\grave","\\hat","\\mathring","\\'","\\^","\\~","\\=","\\u","\\.",'\\"',"\\r","\\H","\\v"]),xe={"\\`":"̀","\\'":"́","\\^":"̂","\\~":"̃","\\=":"̄","\\u":"̆","\\.":"̇",'\\"':"̈","\\r":"̊","\\H":"̋","\\v":"̌"};c({type:"accent",names:["\\acute","\\grave","\\ddot","\\dddot","\\ddddot","\\tilde","\\bar","\\breve","\\check","\\hat","\\vec","\\dot","\\mathring","\\overparen","\\widecheck","\\widehat","\\wideparen","\\widetilde","\\overrightarrow","\\overleftarrow","\\Overrightarrow","\\overleftrightarrow","\\overgroup","\\overleftharpoon","\\overrightharpoon"],props:{numArgs:1},handler:(e,t)=>{const r=u(t[0]),n=!ye.has(e.funcName);return{type:"accent",mode:e.parser.mode,label:e.funcName,isStretchy:n,base:r}},mathmlBuilder:be}),c({type:"accent",names:["\\'","\\`","\\^","\\~","\\=","\\c","\\u","\\.",'\\"',"\\r","\\H","\\v"],props:{numArgs:1,allowedInText:!0,allowedInMath:!0,argTypes:["primitive"]},handler:(e,t)=>{const r=u(t[0]),n=e.parser.mode;return"math"===n&&e.parser.settings.strict&&console.log(`Temml parse error: Command ${e.funcName} is invalid in math mode.`),"text"===n&&r.text&&1===r.text.length&&e.funcName in xe&&pe.indexOf(r.text)>-1?{type:"textord",mode:"text",text:r.text+xe[e.funcName]}:{type:"accent",mode:n,label:e.funcName,isStretchy:!1,base:r}},mathmlBuilder:be}),c({type:"accentUnder",names:["\\underleftarrow","\\underrightarrow","\\underleftrightarrow","\\undergroup","\\underparen","\\utilde"],props:{numArgs:1},handler:({parser:e,funcName:t},r)=>{const n=r[0];return{type:"accentUnder",mode:e.mode,label:t,base:n}},mathmlBuilder:(e,t)=>{const r=C(e);r.style["math-depth"]=0;return new T.MathNode("munder",[me(e.base,t),r])}});const ke={pt:800/803,pc:9600/803,dd:1238/1157*800/803,cc:12.792133216944668,nd:685/642*800/803,nc:1370/107*800/803,sp:1/65536*800/803,mm:25.4/72,cm:2.54/72,in:1/72,px:96/72},ve=["em","ex","mu","pt","mm","cm","in","px","bp","pc","dd","cc","nd","nc","sp"],Ae=function(e){return"string"!=typeof e&&(e=e.unit),ve.indexOf(e)>-1},Ne=e=>[1,.7,.5][Math.max(e-1,0)],Te=function(t,r){let n=t.number;if(r.maxSize[0]<0&&n>0)return{number:0,unit:"em"};const o=t.unit;switch(o){case"mm":case"cm":case"in":case"px":return n*ke[o]>r.maxSize[1]?{number:r.maxSize[1],unit:"pt"}:{number:n,unit:o};case"em":case"ex":return"ex"===o&&(n*=.431),n=Math.min(n/Ne(r.level),r.maxSize[0]),{number:s.round(n),unit:"em"};case"bp":return n>r.maxSize[1]&&(n=r.maxSize[1]),{number:n,unit:"pt"};case"pt":case"pc":case"dd":case"cc":case"nd":case"nc":case"sp":return n=Math.min(n*ke[o],r.maxSize[1]),{number:s.round(n),unit:"pt"};case"mu":return n=Math.min(n/18,r.maxSize[0]),{number:s.round(n),unit:"em"};default:throw new e("Invalid unit: '"+o+"'")}},Se=e=>{const t=new T.MathNode("mspace");return t.setAttribute("width",e+"em"),t},qe=(e,t=.3,r=0,n=!1)=>{if(null==e&&0===r)return Se(t);const o=e?[e]:[];if(0!==t&&o.unshift(Se(t)),r>0&&o.push(Se(r)),n){const e=new T.MathNode("mpadded",o);return e.setAttribute("height","0"),e}return new T.MathNode("mrow",o)},Oe=(e,t)=>Number(e)/Ne(t),Me=(e,t,r,n)=>{const o=B(e),s="eq"===e.slice(1,3),a="x"===e.charAt(1)?"1.75":"cd"===e.slice(2,4)?"3.0":s?"1.0":"2.0";o.setAttribute("lspace","0"),o.setAttribute("rspace",s?"0.5em":"0");const l=n.withLevel(n.level<2?2:3),i=Oe(a,l.level),c=Oe(a,3),m=qe(null,i.toFixed(4),0),u=qe(null,c.toFixed(4),0),d=Oe(s?0:.3,l.level).toFixed(4);let p,h;const g=t&&t.body&&(t.body.body||t.body.length>0);if(g){let r=me(t,l);r=qe(r,d,d,"\\\\cdrightarrow"===e||"\\\\cdleftarrow"===e),p=new T.MathNode("mover",[r,u])}const f=r&&r.body&&(r.body.body||r.body.length>0);if(f){let e=me(r,l);e=qe(e,d,d),h=new T.MathNode("munder",[e,u])}let b;return b=g||f?g&&f?new T.MathNode("munderover",[o,h,p]):g?new T.MathNode("mover",[o,p]):new T.MathNode("munder",[o,h]):new T.MathNode("mover",[o,m]),"3.0"===a&&(b.style.height="1em"),b.setAttribute("accent","false"),b};c({type:"xArrow",names:["\\xleftarrow","\\xrightarrow","\\xLeftarrow","\\xRightarrow","\\xleftrightarrow","\\xLeftrightarrow","\\xhookleftarrow","\\xhookrightarrow","\\xmapsto","\\xrightharpoondown","\\xrightharpoonup","\\xleftharpoondown","\\xleftharpoonup","\\xlongequal","\\xtwoheadrightarrow","\\xtwoheadleftarrow","\\yields","\\yieldsLeft","\\mesomerism","\\longrightharpoonup","\\longleftharpoondown","\\\\cdrightarrow","\\\\cdleftarrow","\\\\cdlongequal"],props:{numArgs:1,numOptionalArgs:1},handler:({parser:e,funcName:t},r,n)=>({type:"xArrow",mode:e.mode,name:t,body:r[0],below:n[0]}),mathmlBuilder(e,t){const r=[Me(e.name,e.body,e.below,t)];return r.unshift(Se(.2778)),r.push(Se(.2778)),new T.MathNode("mrow",r)}});const Be={"\\xtofrom":["\\xrightarrow","\\xleftarrow"],"\\xleftrightharpoons":["\\xleftharpoonup","\\xrightharpoondown"],"\\xrightleftharpoons":["\\xrightharpoonup","\\xleftharpoondown"],"\\yieldsLeftRight":["\\yields","\\yieldsLeft"],"\\equilibrium":["\\longrightharpoonup","\\longleftharpoondown"],"\\equilibriumRight":["\\longrightharpoonup","\\eqleftharpoondown"],"\\equilibriumLeft":["\\eqrightharpoonup","\\longleftharpoondown"]};function Ce(e,t){if(!e||e.type!==t)throw new Error(`Expected node of type ${t}, but got `+(e?`node of type ${e.type}`:String(e)));return e}function ze(e){const t=Ee(e);if(!t)throw new Error("Expected node of symbol group type, but got "+(e?`node of type ${e.type}`:String(e)));return t}function Ee(e){return e&&("atom"===e.type||Object.prototype.hasOwnProperty.call(E,e.type))?e:null}c({type:"stackedArrow",names:["\\xtofrom","\\xleftrightharpoons","\\xrightleftharpoons","\\yieldsLeftRight","\\equilibrium","\\equilibriumRight","\\equilibriumLeft"],props:{numArgs:1,numOptionalArgs:1},handler({parser:e,funcName:t},r,n){const o=r[0]?{type:"hphantom",mode:e.mode,body:r[0]}:null,s=n[0]?{type:"hphantom",mode:e.mode,body:n[0]}:null;return{type:"stackedArrow",mode:e.mode,name:t,body:r[0],upperArrowBelow:s,lowerArrowBody:o,below:n[0]}},mathmlBuilder(e,t){const r=Be[e.name][0],n=Be[e.name][1],o=Me(r,e.body,e.upperArrowBelow,t),s=Me(n,e.lowerArrowBody,e.below,t);let a;const l=new T.MathNode("mpadded",[o]);if(l.setAttribute("voffset","0.3em"),l.setAttribute("height","+0.3em"),l.setAttribute("depth","-0.3em"),"\\equilibriumLeft"===e.name){const e=new T.MathNode("mpadded",[s]);e.setAttribute("width","0.5em"),a=new T.MathNode("mpadded",[Se(.2778),e,l,Se(.2778)])}else l.setAttribute("width","\\equilibriumRight"===e.name?"0.5em":"0"),a=new T.MathNode("mpadded",[Se(.2778),l,s,Se(.2778)]);return a.setAttribute("voffset","-0.18em"),a.setAttribute("height","-0.18em"),a.setAttribute("depth","+0.18em"),a}});const Ie={">":"\\\\cdrightarrow","<":"\\\\cdleftarrow","=":"\\\\cdlongequal",A:"\\uparrow",V:"\\downarrow","|":"\\Vert",".":"no arrow"},$e=e=>"textord"===e.type&&"@"===e.text;function Le(e,t,r){const n=Ie[e];switch(n){case"\\\\cdrightarrow":case"\\\\cdleftarrow":return r.callFunction(n,[t[0]],[t[1]]);case"\\uparrow":case"\\downarrow":{const e={type:"atom",text:n,mode:"math",family:"rel"},o={type:"ordgroup",mode:"math",body:[r.callFunction("\\\\cdleft",[t[0]],[]),r.callFunction("\\Big",[e],[]),r.callFunction("\\\\cdright",[t[1]],[])],semisimple:!0};return r.callFunction("\\\\cdparent",[o],[])}case"\\\\cdlongequal":return r.callFunction("\\\\cdlongequal",[],[]);case"\\Vert":{const e={type:"textord",text:"\\Vert",mode:"math"};return r.callFunction("\\Big",[e],[])}default:return{type:"textord",text:" ",mode:"math"}}}c({type:"cdlabel",names:["\\\\cdleft","\\\\cdright"],props:{numArgs:1},handler:({parser:e,funcName:t},r)=>({type:"cdlabel",mode:e.mode,side:t.slice(4),label:r[0]}),mathmlBuilder(e,t){if(0===e.label.body.length)return new T.MathNode("mrow",t);const r=new T.MathNode("mtd",[me(e.label,t)]);r.style.padding="0";const n=new T.MathNode("mtr",[r]),o=new T.MathNode("mtable",[n]),s=new T.MathNode("mpadded",[o]);return s.setAttribute("width","0"),s.setAttribute("displaystyle","false"),s.setAttribute("scriptlevel","1"),"left"===e.side&&(s.style.display="flex",s.style.justifyContent="flex-end"),s}}),c({type:"cdlabelparent",names:["\\\\cdparent"],props:{numArgs:1},handler:({parser:e},t)=>({type:"cdlabelparent",mode:e.mode,fragment:t[0]}),mathmlBuilder:(e,t)=>new T.MathNode("mrow",[me(e.fragment,t)])}),c({type:"textord",names:["\\@char"],props:{numArgs:1,allowedInText:!0},handler({parser:t,token:r},n){const o=Ce(n[0],"ordgroup").body;let s="";for(let e=0;e<o.length;e++){s+=Ce(o[e],"textord").text}const a=parseInt(s);if(isNaN(a))throw new e(`\\@char has non-numeric argument ${s}`,r);return{type:"textord",mode:t.mode,text:String.fromCodePoint(a)}}});const Fe=/^(#[a-f0-9]{3}|#?[a-f0-9]{6})$/i,Ge=/^(#[a-f0-9]{3}|#?[a-f0-9]{6}|[a-z]+)$/i,De=/^ *\d{1,3} *(?:, *\d{1,3} *){2}$/,je=/^ *[10](?:\.\d*)? *(?:, *[10](?:\.\d*)? *){2}$/,Pe=/^[a-f0-9]{6}$/i,Re=e=>{let t=e.toString(16);return 1===t.length&&(t="0"+t),t},Ue=JSON.parse('{\n "Apricot": "#ffb484",\n "Aquamarine": "#08b4bc",\n "Bittersweet": "#c84c14",\n "blue": "#0000FF",\n "Blue": "#303494",\n "BlueGreen": "#08b4bc",\n "BlueViolet": "#503c94",\n "BrickRed": "#b8341c",\n "brown": "#BF8040",\n "Brown": "#802404",\n "BurntOrange": "#f8941c",\n "CadetBlue": "#78749c",\n "CarnationPink": "#f884b4",\n "Cerulean": "#08a4e4",\n "CornflowerBlue": "#40ace4",\n "cyan": "#00FFFF",\n "Cyan": "#08acec",\n "Dandelion": "#ffbc44",\n "darkgray": "#404040",\n "DarkOrchid": "#a8548c",\n "Emerald": "#08ac9c",\n "ForestGreen": "#089c54",\n "Fuchsia": "#90348c",\n "Goldenrod": "#ffdc44",\n "gray": "#808080",\n "Gray": "#98949c",\n "green": "#00FF00",\n "Green": "#08a44c",\n "GreenYellow": "#e0e474",\n "JungleGreen": "#08ac9c",\n "Lavender": "#f89cc4",\n "lightgray": "#c0c0c0",\n "lime": "#BFFF00",\n "LimeGreen": "#90c43c",\n "magenta": "#FF00FF",\n "Magenta": "#f0048c",\n "Mahogany": "#b0341c",\n "Maroon": "#b03434",\n "Melon": "#f89c7c",\n "MidnightBlue": "#086494",\n "Mulberry": "#b03c94",\n "NavyBlue": "#086cbc",\n "olive": "#7F7F00",\n "OliveGreen": "#407c34",\n "orange": "#FF8000",\n "Orange": "#f8843c",\n "OrangeRed": "#f0145c",\n "Orchid": "#b074ac",\n "Peach": "#f8945c",\n "Periwinkle": "#8074bc",\n "PineGreen": "#088c74",\n "pink": "#ff7f7f",\n "Plum": "#98248c",\n "ProcessBlue": "#08b4ec",\n "purple": "#BF0040",\n "Purple": "#a0449c",\n "RawSienna": "#983c04",\n "red": "#ff0000",\n "Red": "#f01c24",\n "RedOrange": "#f86434",\n "RedViolet": "#a0246c",\n "Rhodamine": "#f0549c",\n "Royallue": "#0874bc",\n "RoyalPurple": "#683c9c",\n "RubineRed": "#f0047c",\n "Salmon": "#f8948c",\n "SeaGreen": "#30bc9c",\n "Sepia": "#701404",\n "SkyBlue": "#48c4dc",\n "SpringGreen": "#c8dc64",\n "Tan": "#e09c74",\n "teal": "#007F7F",\n "TealBlue": "#08acb4",\n "Thistle": "#d884b4",\n "Turquoise": "#08b4cc",\n "violet": "#800080",\n "Violet": "#60449c",\n "VioletRed": "#f054a4",\n "WildStrawberry": "#f0246c",\n "yellow": "#FFFF00",\n "Yellow": "#fff404",\n "YellowGreen": "#98cc6c",\n "YellowOrange": "#ffa41c"\n}'),He=(t,r)=>{let n="";if("HTML"===t){if(!Fe.test(r))throw new e("Invalid HTML input.");n=r}else if("RGB"===t){if(!De.test(r))throw new e("Invalid RGB input.");r.split(",").map((e=>{n+=Re(Number(e.trim()))}))}else{if(!je.test(r))throw new e("Invalid rbg input.");r.split(",").map((t=>{const r=Number(t.trim());if(r>1)throw new e("Color rgb input must be < 1.");n+=Re(Number((255*r).toFixed(0)))}))}return"#"!==n.charAt(0)&&(n="#"+n),n},Ve=(t,r,n)=>{const o=`\\\\color@${t}`;if(!Ge.exec(t))throw new e("Invalid color: '"+t+"'",n);return Pe.test(t)?"#"+t:("#"===t.charAt(0)||(r.has(o)?t=r.get(o).tokens[0].text:Ue[t]&&(t=Ue[t])),t)},_e=(e,t)=>{let r=ie(e.body,t.withColor(e.color));return r=r.map((t=>(t.style.color=e.color,t))),T.newDocumentFragment(r)};c({type:"color",names:["\\textcolor"],props:{numArgs:2,numOptionalArgs:1,allowedInText:!0,argTypes:["raw","raw","original"]},handler({parser:e,token:t},r,n){const o=n[0]&&Ce(n[0],"raw").string;let s="";if(o){const e=Ce(r[0],"raw").string;s=He(o,e)}else s=Ve(Ce(r[0],"raw").string,e.gullet.macros,t);const a=r[1];return{type:"color",mode:e.mode,color:s,isTextColor:!0,body:d(a)}},mathmlBuilder:_e}),c({type:"color",names:["\\color"],props:{numArgs:1,numOptionalArgs:1,allowedInText:!0,argTypes:["raw","raw"]},handler({parser:e,breakOnTokenText:t,token:r},n,o){const s=o[0]&&Ce(o[0],"raw").string;let a="";if(s){const e=Ce(n[0],"raw").string;a=He(s,e)}else a=Ve(Ce(n[0],"raw").string,e.gullet.macros,r);const l=e.parseExpression(!0,t,!0);return{type:"color",mode:e.mode,color:a,isTextColor:!1,body:l}},mathmlBuilder:_e}),c({type:"color",names:["\\definecolor"],props:{numArgs:3,allowedInText:!0,argTypes:["raw","raw","raw"]},handler({parser:t,funcName:r,token:n},o){const s=Ce(o[0],"raw").string;if(!/^[A-Za-z]+$/.test(s))throw new e("Color name must be latin letters.",n);const a=Ce(o[1],"raw").string;if(!["HTML","RGB","rgb"].includes(a))throw new e("Color model must be HTML, RGB, or rgb.",n);const l=Ce(o[2],"raw").string,i=He(a,l);return t.gullet.macros.set(`\\\\color@${s}`,{tokens:[{text:i}],numArgs:0}),{type:"internal",mode:t.mode}}}),c({type:"cr",names:["\\\\"],props:{numArgs:0,numOptionalArgs:0,allowedInText:!0},handler({parser:e},t,r){const n="["===e.gullet.future().text?e.parseSizeGroup(!0):null,o=!e.settings.displayMode;return{type:"cr",mode:e.mode,newLine:o,size:n&&Ce(n,"size").value}},mathmlBuilder(e,t){const r=new T.MathNode("mo");if(e.newLine&&(r.setAttribute("linebreak","newline"),e.size)){const n=Te(e.size,t);r.setAttribute("height",n.number+n.unit)}return r}});const We={"\\global":"\\global","\\long":"\\\\globallong","\\\\globallong":"\\\\globallong","\\def":"\\gdef","\\gdef":"\\gdef","\\edef":"\\xdef","\\xdef":"\\xdef","\\let":"\\\\globallet","\\futurelet":"\\\\globalfuture"},Xe=t=>{const r=t.text;if(/^(?:[\\{}$&#^_]|EOF)$/.test(r))throw new e("Expected a control sequence",t);return r},Ze=(e,t,r,n)=>{let o=e.gullet.macros.get(r.text);null==o&&(r.noexpand=!0,o={tokens:[r],numArgs:0,unexpandable:!e.gullet.isExpandable(r.text)}),e.gullet.macros.set(t,o,n)};c({type:"internal",names:["\\global","\\long","\\\\globallong"],props:{numArgs:0,allowedInText:!0},handler({parser:t,funcName:r}){t.consumeSpaces();const n=t.fetch();if(We[n.text])return"\\global"!==r&&"\\\\globallong"!==r||(n.text=We[n.text]),Ce(t.parseFunction(),"internal");throw new e("Invalid token after macro prefix",n)}}),c({type:"internal",names:["\\def","\\gdef","\\edef","\\xdef"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler({parser:t,funcName:r}){let n=t.gullet.popToken();const o=n.text;if(/^(?:[\\{}$&#^_]|EOF)$/.test(o))throw new e("Expected a control sequence",n);let s,a=0;const l=[[]];for(;"{"!==t.gullet.future().text;)if(n=t.gullet.popToken(),"#"===n.text){if("{"===t.gullet.future().text){s=t.gullet.future(),l[a].push("{");break}if(n=t.gullet.popToken(),!/^[1-9]$/.test(n.text))throw new e(`Invalid argument number "${n.text}"`);if(parseInt(n.text)!==a+1)throw new e(`Argument number "${n.text}" out of order`);a++,l.push([])}else{if("EOF"===n.text)throw new e("Expected a macro definition");l[a].push(n.text)}let{tokens:i}=t.gullet.consumeArg();if(s&&i.unshift(s),"\\edef"===r||"\\xdef"===r){if(i=t.gullet.expandTokens(i),i.length>t.gullet.settings.maxExpand)throw new e("Too many expansions in an "+r);i.reverse()}return t.gullet.macros.set(o,{tokens:i,numArgs:a,delimiters:l},r===We[r]),{type:"internal",mode:t.mode}}}),c({type:"internal",names:["\\let","\\\\globallet"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler({parser:e,funcName:t}){const r=Xe(e.gullet.popToken());e.gullet.consumeSpaces();const n=(e=>{let t=e.gullet.popToken();return"="===t.text&&(t=e.gullet.popToken()," "===t.text&&(t=e.gullet.popToken())),t})(e);return Ze(e,r,n,"\\\\globallet"===t),{type:"internal",mode:e.mode}}}),c({type:"internal",names:["\\futurelet","\\\\globalfuture"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler({parser:e,funcName:t}){const r=Xe(e.gullet.popToken()),n=e.gullet.popToken(),o=e.gullet.popToken();return Ze(e,r,o,"\\\\globalfuture"===t),e.gullet.pushToken(o),e.gullet.pushToken(n),{type:"internal",mode:e.mode}}}),c({type:"internal",names:["\\newcommand","\\renewcommand","\\providecommand"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler({parser:t,funcName:r}){let n="";const o=t.gullet.popToken();"{"===o.text?(n=Xe(t.gullet.popToken()),t.gullet.popToken()):n=Xe(o);const s=t.gullet.isDefined(n);if(s&&"\\newcommand"===r)throw new e(`\\newcommand{${n}} attempting to redefine ${n}; use \\renewcommand`);if(!s&&"\\renewcommand"===r)throw new e(`\\renewcommand{${n}} when command ${n} does not yet exist; use \\newcommand`);let a=0;if("["===t.gullet.future().text){let r=t.gullet.popToken();if(r=t.gullet.popToken(),!/^[0-9]$/.test(r.text))throw new e(`Invalid number of arguments: "${r.text}"`);if(a=parseInt(r.text),r=t.gullet.popToken(),"]"!==r.text)throw new e(`Invalid argument "${r.text}"`)}const{tokens:l}=t.gullet.consumeArg();return"\\providecommand"===r&&t.gullet.macros.has(n)||t.gullet.macros.set(n,{tokens:l,numArgs:a}),{type:"internal",mode:t.mode}}});const Ye={"\\bigl":{mclass:"mopen",size:1},"\\Bigl":{mclass:"mopen",size:2},"\\biggl":{mclass:"mopen",size:3},"\\Biggl":{mclass:"mopen",size:4},"\\bigr":{mclass:"mclose",size:1},"\\Bigr":{mclass:"mclose",size:2},"\\biggr":{mclass:"mclose",size:3},"\\Biggr":{mclass:"mclose",size:4},"\\bigm":{mclass:"mrel",size:1},"\\Bigm":{mclass:"mrel",size:2},"\\biggm":{mclass:"mrel",size:3},"\\Biggm":{mclass:"mrel",size:4},"\\big":{mclass:"mord",size:1},"\\Big":{mclass:"mord",size:2},"\\bigg":{mclass:"mord",size:3},"\\Bigg":{mclass:"mord",size:4}},Ke=["(","\\lparen",")","\\rparen","[","\\lbrack","]","\\rbrack","\\{","\\lbrace","\\}","\\rbrace","⦇","\\llparenthesis","⦈","\\rrparenthesis","\\lfloor","\\rfloor","⌊","⌋","\\lceil","\\rceil","⌈","⌉","<",">","\\langle","⟨","\\rangle","⟩","\\lAngle","⟪","\\rAngle","⟫","\\llangle","⦉","\\rrangle","⦊","\\lt","\\gt","\\lvert","\\rvert","\\lVert","\\rVert","\\lgroup","\\rgroup","⟮","⟯","\\lmoustache","\\rmoustache","⎰","⎱","\\llbracket","\\rrbracket","⟦","⟦","\\lBrace","\\rBrace","⦃","⦄","/","\\backslash","|","\\vert","\\|","\\Vert","‖","\\uparrow","\\Uparrow","\\downarrow","\\Downarrow","\\updownarrow","\\Updownarrow","."],Je=["}","\\left","\\middle","\\right"],Qe=e=>e.length>0&&(Ke.includes(e)||Ye[e]||Je.includes(e)),et=[0,1.2,1.8,2.4,3];function tt(t,r){const n=Ee(t);if(n&&Ke.includes(n.text))return["<","\\lt"].includes(n.text)&&(n.text="⟨"),[">","\\gt"].includes(n.text)&&(n.text="⟩"),n;throw new e(n?`Invalid delimiter '${n.text}' after '${r.funcName}'`:`Invalid delimiter type '${t.type}'`,t)}const rt=["/","\\","\\backslash","\\vert","|"];c({type:"delimsizing",names:["\\bigl","\\Bigl","\\biggl","\\Biggl","\\bigr","\\Bigr","\\biggr","\\Biggr","\\bigm","\\Bigm","\\biggm","\\Biggm","\\big","\\Big","\\bigg","\\Bigg"],props:{numArgs:1,argTypes:["primitive"]},handler:(e,t)=>{const r=tt(t[0],e);return{type:"delimsizing",mode:e.parser.mode,size:Ye[e.funcName].size,mclass:Ye[e.funcName].mclass,delim:r.text}},mathmlBuilder:e=>{const t=[];"."===e.delim&&(e.delim=""),t.push(te(e.delim,e.mode));const r=new T.MathNode("mo",t);return"mopen"===e.mclass||"mclose"===e.mclass?r.setAttribute("fence","true"):r.setAttribute("fence","false"),(rt.includes(e.delim)||e.delim.indexOf("arrow")>-1)&&r.setAttribute("stretchy","true"),r.setAttribute("symmetric","true"),r.setAttribute("minsize",et[e.size]+"em"),r.setAttribute("maxsize",et[e.size]+"em"),r}}),c({type:"leftright-right",names:["\\right"],props:{numArgs:1,argTypes:["primitive"]},handler:(e,t)=>({type:"leftright-right",mode:e.parser.mode,delim:tt(t[0],e).text})}),c({type:"leftright",names:["\\left"],props:{numArgs:1,argTypes:["primitive"]},handler:(t,r)=>{const n=tt(r[0],t),o=t.parser;++o.leftrightDepth;let s=o.parseExpression(!1,null,!0),a=o.fetch();for(;"\\middle"===a.text;){o.consume();const t=o.fetch().text;if(!I.math[t])throw new e(`Invalid delimiter '${t}' after '\\middle'`);tt({type:"atom",mode:"math",text:t},{funcName:"\\middle"}),s.push({type:"middle",mode:"math",delim:t}),o.consume(),s=s.concat(o.parseExpression(!1,null,!0)),a=o.fetch()}--o.leftrightDepth,o.expect("\\right",!1);const l=Ce(o.parseFunction(),"leftright-right");return{type:"leftright",mode:o.mode,body:s,left:n.text,right:l.delim}},mathmlBuilder:(e,t)=>{!function(e){if(!e.body)throw new Error("Bug: The leftright ParseNode wasn't fully parsed.")}(e);const r=ie(e.body,t);"."===e.left&&(e.left="");const n=new T.MathNode("mo",[te(e.left,e.mode)]);n.setAttribute("fence","true"),n.setAttribute("form","prefix"),("/"===e.left||"\\"===e.left||e.left.indexOf("arrow")>-1)&&n.setAttribute("stretchy","true"),r.unshift(n),"."===e.right&&(e.right="");const o=new T.MathNode("mo",[te(e.right,e.mode)]);if(o.setAttribute("fence","true"),o.setAttribute("form","postfix"),("∖"===e.right||e.right.indexOf("arrow")>-1)&&o.setAttribute("stretchy","true"),e.body.length>0){const t=e.body[e.body.length-1];"color"!==t.type||t.isTextColor||o.setAttribute("mathcolor",t.color)}return r.push(o),oe(r)}}),c({type:"middle",names:["\\middle"],props:{numArgs:1,argTypes:["primitive"]},handler:(t,r)=>{const n=tt(r[0],t);if(!t.parser.leftrightDepth)throw new e("\\middle without preceding \\left",n);return{type:"middle",mode:t.parser.mode,delim:n.text}},mathmlBuilder:(e,t)=>{const r=te(e.delim,e.mode),n=new T.MathNode("mo",[r]);return n.setAttribute("fence","true"),e.delim.indexOf("arrow")>-1&&n.setAttribute("stretchy","true"),n.setAttribute("form","prefix"),n.setAttribute("lspace","0.05em"),n.setAttribute("rspace","0.05em"),n}});const nt=e=>{const t=new T.MathNode("mspace");return t.setAttribute("width","3pt"),t},ot=(e,t)=>{let r;switch(r=e.label.indexOf("colorbox")>-1||"\\boxed"===e.label?new T.MathNode("mrow",[nt(),me(e.body,t),nt()]):new T.MathNode("menclose",[me(e.body,t)]),e.label){case"\\overline":r.setAttribute("notation","top"),r.classes.push("tml-overline");break;case"\\underline":r.setAttribute("notation","bottom"),r.classes.push("tml-underline");break;case"\\cancel":r.setAttribute("notation","updiagonalstrike"),r.children.push(new T.MathNode("mrow",[],["tml-cancel","upstrike"]));break;case"\\bcancel":r.setAttribute("notation","downdiagonalstrike"),r.children.push(new T.MathNode("mrow",[],["tml-cancel","downstrike"]));break;case"\\sout":r.setAttribute("notation","horizontalstrike"),r.children.push(new T.MathNode("mrow",[],["tml-cancel","sout"]));break;case"\\xcancel":r.setAttribute("notation","updiagonalstrike downdiagonalstrike"),r.classes.push("tml-xcancel");break;case"\\longdiv":r.setAttribute("notation","longdiv"),r.classes.push("longdiv-top"),r.children.push(new T.MathNode("mrow",[],["longdiv-arc"]));break;case"\\phase":r.setAttribute("notation","phasorangle"),r.classes.push("phasor-bottom"),r.children.push(new T.MathNode("mrow",[],["phasor-angle"]));break;case"\\textcircled":r.setAttribute("notation","circle"),r.classes.push("circle-pad"),r.children.push(new T.MathNode("mrow",[],["textcircle"]));break;case"\\angl":r.setAttribute("notation","actuarial"),r.classes.push("actuarial");break;case"\\boxed":r.setAttribute("notation","box"),r.classes.push("tml-box"),r.setAttribute("scriptlevel","0"),r.setAttribute("displaystyle","true");break;case"\\fbox":r.setAttribute("notation","box"),r.classes.push("tml-fbox");break;case"\\fcolorbox":case"\\colorbox":{const t={padding:"3pt 0 3pt 0"};"\\fcolorbox"===e.label&&(t.border="0.0667em solid "+String(e.borderColor)),r.style=t;break}}return e.backgroundColor&&r.setAttribute("mathbackground",e.backgroundColor),r};c({type:"enclose",names:["\\colorbox"],props:{numArgs:2,numOptionalArgs:1,allowedInText:!0,argTypes:["raw","raw","text"]},handler({parser:e,funcName:t},r,n){const o=n[0]&&Ce(n[0],"raw").string;let s="";if(o){const e=Ce(r[0],"raw").string;s=He(o,e)}else s=Ve(Ce(r[0],"raw").string,e.gullet.macros);const a=r[1];return{type:"enclose",mode:e.mode,label:t,backgroundColor:s,body:a}},mathmlBuilder:ot}),c({type:"enclose",names:["\\fcolorbox"],props:{numArgs:3,numOptionalArgs:1,allowedInText:!0,argTypes:["raw","raw","raw","text"]},handler({parser:e,funcName:t},r,n){const o=n[0]&&Ce(n[0],"raw").string;let s,a="";if(o){const e=Ce(r[0],"raw").string,t=Ce(r[0],"raw").string;a=He(o,e),s=He(o,t)}else a=Ve(Ce(r[0],"raw").string,e.gullet.macros),s=Ve(Ce(r[1],"raw").string,e.gullet.macros);const l=r[2];return{type:"enclose",mode:e.mode,label:t,backgroundColor:s,borderColor:a,body:l}},mathmlBuilder:ot}),c({type:"enclose",names:["\\fbox"],props:{numArgs:1,argTypes:["hbox"],allowedInText:!0},handler:({parser:e},t)=>({type:"enclose",mode:e.mode,label:"\\fbox",body:t[0]})}),c({type:"enclose",names:["\\angl","\\cancel","\\bcancel","\\xcancel","\\sout","\\overline","\\boxed","\\longdiv","\\phase"],props:{numArgs:1},handler({parser:e,funcName:t},r){const n=r[0];return{type:"enclose",mode:e.mode,label:t,body:n}},mathmlBuilder:ot}),c({type:"enclose",names:["\\underline"],props:{numArgs:1,allowedInText:!0},handler({parser:e,funcName:t},r){const n=r[0];return{type:"enclose",mode:e.mode,label:t,body:n}},mathmlBuilder:ot}),c({type:"enclose",names:["\\textcircled"],props:{numArgs:1,argTypes:["text"],allowedInArgument:!0,allowedInText:!0},handler({parser:e,funcName:t},r){const n=r[0];return{type:"enclose",mode:e.mode,label:t,body:n}},mathmlBuilder:ot});const st={};function at({type:e,names:t,props:r,handler:n,mathmlBuilder:o}){const s={type:e,numArgs:r.numArgs||0,allowedInText:!1,numOptionalArgs:0,handler:n};for(let e=0;e<t.length;++e)st[t[e]]=s;o&&(i[e]=o)}const lt=0,it=1,ct=2,mt=3,ut={};function dt(e,t){ut[e]=t}const pt=ut;dt("\\noexpand",(function(e){const t=e.popToken();return e.isExpandable(t.text)&&(t.noexpand=!0,t.treatAsRelax=!0),{tokens:[t],numArgs:0}})),dt("\\expandafter",(function(e){const t=e.popToken();return e.expandOnce(!0),{tokens:[t],numArgs:0}})),dt("\\@firstoftwo",(function(e){return{tokens:e.consumeArgs(2)[0],numArgs:0}})),dt("\\@secondoftwo",(function(e){return{tokens:e.consumeArgs(2)[1],numArgs:0}})),dt("\\@ifnextchar",(function(e){const t=e.consumeArgs(3);e.consumeSpaces();const r=e.future();return 1===t[0].length&&t[0][0].text===r.text?{tokens:t[1],numArgs:0}:{tokens:t[2],numArgs:0}})),dt("\\@ifstar","\\@ifnextchar *{\\@firstoftwo{#1}}"),dt("\\TextOrMath",(function(e){const t=e.consumeArgs(2);return"text"===e.mode?{tokens:t[0],numArgs:0}:{tokens:t[1],numArgs:0}}));const ht=e=>{let t="";for(let r=e.length-1;r>-1;r--)t+=e[r].text;return t},gt={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,a:10,A:10,b:11,B:11,c:12,C:12,d:13,D:13,e:14,E:14,f:15,F:15},ft=e=>{const t=e.future().text;return"EOF"===t?[null,""]:[gt[t.charAt(0)],t]},bt=(e,t,r)=>{for(let n=1;n<t.length;n++){e*=r,e+=gt[t.charAt(n)]}return e};function yt(e){const t=e.consumeArgs(1)[0];let r="",n=t[t.length-1].loc.start;for(let e=t.length-1;e>=0;e--){const o=t[e].loc.start;o>n&&(r+=" ",n=o),r+=t[e].text,n+=t[e].text.length}return r}dt("\\char",(function(t){let r,n=t.popToken(),o="";if("'"===n.text)r=8,n=t.popToken();else if('"'===n.text)r=16,n=t.popToken();else if("`"===n.text)if(n=t.popToken(),"\\"===n.text[0])o=n.text.charCodeAt(1);else{if("EOF"===n.text)throw new e("\\char` missing argument");o=n.text.charCodeAt(0)}else r=10;if(r){let s,a=n.text;if(o=gt[a.charAt(0)],null==o||o>=r)throw new e(`Invalid base-${r} digit ${n.text}`);for(o=bt(o,a,r),[s,a]=ft(t);null!=s&&s<r;)o*=r,o+=s,o=bt(o,a,r),t.popToken(),[s,a]=ft(t)}return`\\@char{${o}}`})),dt("\\surd","\\sqrt{\\vphantom{|}}"),dt("⊕","\\oplus"),dt("\\long",""),dt("\\bgroup","{"),dt("\\egroup","}"),dt("~","\\nobreakspace"),dt("\\lq","`"),dt("\\rq","'"),dt("\\aa","\\r a"),dt("\\Bbbk","\\Bbb{k}"),dt("\\mathstrut","\\vphantom{(}"),dt("\\underbar","\\underline{\\text{#1}}"),dt("\\vdots","{\\varvdots\\rule{0pt}{15pt}}"),dt("⋮","\\vdots"),dt("\\arraystretch","1"),dt("\\arraycolsep","6pt"),dt("\\substack","\\begin{subarray}{c}#1\\end{subarray}"),dt("\\iff","\\DOTSB\\;\\Longleftrightarrow\\;"),dt("\\implies","\\DOTSB\\;\\Longrightarrow\\;"),dt("\\impliedby","\\DOTSB\\;\\Longleftarrow\\;");const wt={",":"\\dotsc","\\not":"\\dotsb","+":"\\dotsb","=":"\\dotsb","<":"\\dotsb",">":"\\dotsb","-":"\\dotsb","*":"\\dotsb",":":"\\dotsb","\\DOTSB":"\\dotsb","\\coprod":"\\dotsb","\\bigvee":"\\dotsb","\\bigwedge":"\\dotsb","\\biguplus":"\\dotsb","\\bigcap":"\\dotsb","\\bigcup":"\\dotsb","\\prod":"\\dotsb","\\sum":"\\dotsb","\\bigotimes":"\\dotsb","\\bigoplus":"\\dotsb","\\bigodot":"\\dotsb","\\bigsqcap":"\\dotsb","\\bigsqcup":"\\dotsb","\\bigtimes":"\\dotsb","\\And":"\\dotsb","\\longrightarrow":"\\dotsb","\\Longrightarrow":"\\dotsb","\\longleftarrow":"\\dotsb","\\Longleftarrow":"\\dotsb","\\longleftrightarrow":"\\dotsb","\\Longleftrightarrow":"\\dotsb","\\mapsto":"\\dotsb","\\longmapsto":"\\dotsb","\\hookrightarrow":"\\dotsb","\\doteq":"\\dotsb","\\mathbin":"\\dotsb","\\mathrel":"\\dotsb","\\relbar":"\\dotsb","\\Relbar":"\\dotsb","\\xrightarrow":"\\dotsb","\\xleftarrow":"\\dotsb","\\DOTSI":"\\dotsi","\\int":"\\dotsi","\\oint":"\\dotsi","\\iint":"\\dotsi","\\iiint":"\\dotsi","\\iiiint":"\\dotsi","\\idotsint":"\\dotsi","\\DOTSX":"\\dotsx"};dt("\\dots",(function(e){let t="\\dotso";const r=e.expandAfterFuture().text;return r in wt?t=wt[r]:("\\not"===r.slice(0,4)||r in I.math&&["bin","rel"].includes(I.math[r].group))&&(t="\\dotsb"),t}));const xt={")":!0,"]":!0,"\\rbrack":!0,"\\}":!0,"\\rbrace":!0,"\\rangle":!0,"\\rceil":!0,"\\rfloor":!0,"\\rgroup":!0,"\\rmoustache":!0,"\\right":!0,"\\bigr":!0,"\\biggr":!0,"\\Bigr":!0,"\\Biggr":!0,$:!0,";":!0,".":!0,",":!0};dt("\\dotso",(function(e){return e.future().text in xt?"\\ldots\\,":"\\ldots"})),dt("\\dotsc",(function(e){const t=e.future().text;return t in xt&&","!==t?"\\ldots\\,":"\\ldots"})),dt("\\cdots",(function(e){return e.future().text in xt?"\\@cdots\\,":"\\@cdots"})),dt("\\dotsb","\\cdots"),dt("\\dotsm","\\cdots"),dt("\\dotsi","\\!\\cdots"),dt("\\idotsint","\\dotsi"),dt("\\dotsx","\\ldots\\,"),dt("\\DOTSI","\\relax"),dt("\\DOTSB","\\relax"),dt("\\DOTSX","\\relax"),dt("\\tmspace","\\TextOrMath{\\kern#1#3}{\\mskip#1#2}\\relax"),dt("\\,","{\\tmspace+{3mu}{.1667em}}"),dt("\\thinspace","\\,"),dt("\\>","\\mskip{4mu}"),dt("\\:","{\\tmspace+{4mu}{.2222em}}"),dt("\\medspace","\\:"),dt("\\;","{\\tmspace+{5mu}{.2777em}}"),dt("\\thickspace","\\;"),dt("\\!","{\\tmspace-{3mu}{.1667em}}"),dt("\\negthinspace","\\!"),dt("\\negmedspace","{\\tmspace-{4mu}{.2222em}}"),dt("\\negthickspace","{\\tmspace-{5mu}{.277em}}"),dt("\\enspace","\\kern.5em "),dt("\\enskip","\\hskip.5em\\relax"),dt("\\quad","\\hskip1em\\relax"),dt("\\qquad","\\hskip2em\\relax"),dt("\\AA","\\TextOrMath{\\Angstrom}{\\mathring{A}}\\relax"),dt("\\tag","\\@ifstar\\tag@literal\\tag@paren"),dt("\\tag@paren","\\tag@literal{({#1})}"),dt("\\tag@literal",(t=>{if(t.macros.get("\\df@tag"))throw new e("Multiple \\tag");return"\\def\\df@tag{\\text{#1}}"})),dt("\\bmod","\\mathbin{\\text{mod}}"),dt("\\pod","\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern8mu}{\\mkern8mu}{\\mkern8mu}(#1)"),dt("\\pmod","\\pod{{\\rm mod}\\mkern6mu#1}"),dt("\\mod","\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern12mu}{\\mkern12mu}{\\mkern12mu}{\\rm mod}\\,\\,#1"),dt("\\newline","\\\\\\relax"),dt("\\TeX","\\textrm{T}\\kern-.1667em\\raisebox{-.5ex}{E}\\kern-.125em\\textrm{X}"),dt("\\LaTeX","\\textrm{L}\\kern-.35em\\raisebox{0.2em}{\\scriptstyle A}\\kern-.15em\\TeX"),dt("\\Temml","\\textrm{T}\\kern-0.2em\\lower{0.2em}{\\textrm{E}}\\kern-0.08em{\\textrm{M}\\kern-0.08em\\raise{0.2em}\\textrm{M}\\kern-0.08em\\textrm{L}}"),dt("\\hspace","\\@ifstar\\@hspacer\\@hspace"),dt("\\@hspace","\\hskip #1\\relax"),dt("\\@hspacer","\\rule{0pt}{0pt}\\hskip #1\\relax"),dt("\\colon",'\\mathpunct{\\char"3a}'),dt("\\prescript","\\pres@cript{_{#1}^{#2}}{}{#3}"),dt("\\ordinarycolon",'\\char"3a'),dt("\\vcentcolon","\\mathrel{\\raisebox{0.035em}{\\ordinarycolon}}"),dt("\\coloneq",'\\mathrel{\\raisebox{0.035em}{\\ordinarycolon}\\char"2212}'),dt("\\Coloneq",'\\mathrel{\\char"2237\\char"2212}'),dt("\\Eqqcolon",'\\mathrel{\\char"3d\\char"2237}'),dt("\\Eqcolon",'\\mathrel{\\char"2212\\char"2237}'),dt("\\colonapprox",'\\mathrel{\\raisebox{0.035em}{\\ordinarycolon}\\char"2248}'),dt("\\Colonapprox",'\\mathrel{\\char"2237\\char"2248}'),dt("\\colonsim",'\\mathrel{\\raisebox{0.035em}{\\ordinarycolon}\\char"223c}'),dt("\\Colonsim",'\\mathrel{\\raisebox{0.035em}{\\ordinarycolon}\\char"223c}'),dt("\\ratio","\\vcentcolon"),dt("\\coloncolon","\\dblcolon"),dt("\\colonequals","\\coloneqq"),dt("\\coloncolonequals","\\Coloneqq"),dt("\\equalscolon","\\eqqcolon"),dt("\\equalscoloncolon","\\Eqqcolon"),dt("\\colonminus","\\coloneq"),dt("\\coloncolonminus","\\Coloneq"),dt("\\minuscolon","\\eqcolon"),dt("\\minuscoloncolon","\\Eqcolon"),dt("\\coloncolonapprox","\\Colonapprox"),dt("\\coloncolonsim","\\Colonsim"),dt("\\notni","\\mathrel{\\char`∌}"),dt("\\limsup","\\DOTSB\\operatorname*{lim\\,sup}"),dt("\\liminf","\\DOTSB\\operatorname*{lim\\,inf}"),dt("\\injlim","\\DOTSB\\operatorname*{inj\\,lim}"),dt("\\projlim","\\DOTSB\\operatorname*{proj\\,lim}"),dt("\\varlimsup","\\DOTSB\\operatorname*{\\overline{\\text{lim}}}"),dt("\\varliminf","\\DOTSB\\operatorname*{\\underline{\\text{lim}}}"),dt("\\varinjlim","\\DOTSB\\operatorname*{\\underrightarrow{\\text{lim}}}"),dt("\\varprojlim","\\DOTSB\\operatorname*{\\underleftarrow{\\text{lim}}}"),dt("\\centerdot","{\\medspace\\rule{0.167em}{0.189em}\\medspace}"),dt("\\argmin","\\DOTSB\\operatorname*{arg\\,min}"),dt("\\argmax","\\DOTSB\\operatorname*{arg\\,max}"),dt("\\plim","\\DOTSB\\operatorname*{plim}"),dt("\\leftmodels","\\mathop{\\reflectbox{$\\models$}}"),dt("\\bra","\\mathinner{\\langle{#1}|}"),dt("\\ket","\\mathinner{|{#1}\\rangle}"),dt("\\braket","\\mathinner{\\langle{#1}\\rangle}"),dt("\\Bra","\\left\\langle#1\\right|"),dt("\\Ket","\\left|#1\\right\\rangle");const kt=(e,t)=>{const r=`}\\,\\middle${"|"===t[0]?"\\vert":"\\Vert"}\\,{`;return e.slice(0,t.index)+r+e.slice(t.index+t[0].length)};dt("\\Braket",(function(e){let t=yt(e);const r=/\|\||\||\\\|/g;let n;for(;null!==(n=r.exec(t));)t=kt(t,n);return"\\left\\langle{"+t+"}\\right\\rangle"})),dt("\\Set",(function(e){let t=yt(e);const r=/\|\||\||\\\|/.exec(t);return r&&(t=kt(t,r)),"\\left\\{\\:{"+t+"}\\:\\right\\}"})),dt("\\set",(function(e){return"\\{{"+yt(e).replace(/\|/,"}\\mid{")+"}\\}"})),dt("\\angln","{\\angl n}"),dt("\\odv","\\@ifstar\\odv@next\\odv@numerator"),dt("\\odv@numerator","\\frac{\\mathrm{d}#1}{\\mathrm{d}#2}"),dt("\\odv@next","\\frac{\\mathrm{d}}{\\mathrm{d}#2}#1"),dt("\\pdv","\\@ifstar\\pdv@next\\pdv@numerator");const vt=e=>{const t=e[0][0].text,r=ht(e[1]).split(","),n=String(r.length),o="1"===n?"\\partial":`\\partial^${n}`;let s="";return r.map((e=>{s+="\\partial "+e.trim()+"\\,"})),[t,o,s.replace(/\\,$/,"")]};function At(e){const t=[];e.consumeSpaces();let r=e.fetch().text;for("\\relax"===r&&(e.consume(),e.consumeSpaces(),r=e.fetch().text);"\\hline"===r||"\\hdashline"===r;)e.consume(),t.push("\\hdashline"===r),e.consumeSpaces(),r=e.fetch().text;return t}dt("\\pdv@numerator",(function(e){const[t,r,n]=vt(e.consumeArgs(2));return`\\frac{${r} ${t}}{${n}}`})),dt("\\pdv@next",(function(e){const[t,r,n]=vt(e.consumeArgs(2));return`\\frac{${r}}{${n}} ${t}`})),dt("\\upalpha","\\up@greek{\\alpha}"),dt("\\upbeta","\\up@greek{\\beta}"),dt("\\upgamma","\\up@greek{\\gamma}"),dt("\\updelta","\\up@greek{\\delta}"),dt("\\upepsilon","\\up@greek{\\epsilon}"),dt("\\upzeta","\\up@greek{\\zeta}"),dt("\\upeta","\\up@greek{\\eta}"),dt("\\uptheta","\\up@greek{\\theta}"),dt("\\upiota","\\up@greek{\\iota}"),dt("\\upkappa","\\up@greek{\\kappa}"),dt("\\uplambda","\\up@greek{\\lambda}"),dt("\\upmu","\\up@greek{\\mu}"),dt("\\upnu","\\up@greek{\\nu}"),dt("\\upxi","\\up@greek{\\xi}"),dt("\\upomicron","\\up@greek{\\omicron}"),dt("\\uppi","\\up@greek{\\pi}"),dt("\\upalpha","\\up@greek{\\alpha}"),dt("\\uprho","\\up@greek{\\rho}"),dt("\\upsigma","\\up@greek{\\sigma}"),dt("\\uptau","\\up@greek{\\tau}"),dt("\\upupsilon","\\up@greek{\\upsilon}"),dt("\\upphi","\\up@greek{\\phi}"),dt("\\upchi","\\up@greek{\\chi}"),dt("\\uppsi","\\up@greek{\\psi}"),dt("\\upomega","\\up@greek{\\omega}"),dt("\\invamp",'\\mathbin{\\char"214b}'),dt("\\parr",'\\mathbin{\\char"214b}'),dt("\\with",'\\mathbin{\\char"26}'),dt("\\multimapinv",'\\mathrel{\\char"27dc}'),dt("\\multimapboth",'\\mathrel{\\char"29df}'),dt("\\scoh",'{\\mkern5mu\\char"2322\\mkern5mu}'),dt("\\sincoh",'{\\mkern5mu\\char"2323\\mkern5mu}'),dt("\\coh",'{\\mkern5mu\\rule{}{0.7em}\\mathrlap{\\smash{\\raise2mu{\\char"2322}}}\n{\\smash{\\lower4mu{\\char"2323}}}\\mkern5mu}'),dt("\\incoh",'{\\mkern5mu\\rule{}{0.7em}\\mathrlap{\\smash{\\raise2mu{\\char"2323}}}\n{\\smash{\\lower4mu{\\char"2322}}}\\mkern5mu}'),dt("\\standardstate","\\text{\\tiny\\char`⦵}");const Nt=t=>{if(!t.parser.settings.displayMode)throw new e(`{${t.envName}} can be used only in display mode.`)},Tt=/([-+]?) *(\d+(?:\.\d*)?|\.\d+) *([a-z]{2})/,St=e=>{let t=e.get("\\arraystretch");"string"!=typeof t&&(t=ht(t.tokens)),t=isNaN(t)?null:Number(t);let r=e.get("\\arraycolsep");"string"!=typeof r&&(r=ht(r.tokens));const n=Tt.exec(r);return[t,n?{number:+(n[1]+n[2]),unit:n[3]}:null]},qt=(e,t,r)=>{let n;const o=e.tags.shift();if(o){if(!o.body)return n=new T.MathNode("mtext",[],[]),n;n=ce(o.body,t,!0),n.classes=["tml-tag"]}else{if(e.envClasses.includes("multline")&&(e.leqno&&0!==r||!e.leqno&&r!==e.body.length-1))return n=new T.MathNode("mtext",[],[]),n;n=new T.MathNode("mtext",[new y(["tml-eqn"])])}return n};function Ot(t,{cols:r,envClasses:n,addEqnNum:o,singleRow:s,emptySingleRow:a,maxNumCols:l,leqno:i,arraystretch:c,arraycolsep:m},u){t.gullet.beginGroup(),s||t.gullet.macros.set("\\cr","\\\\\\relax"),o&&(t.gullet.macros.set("\\tag","\\@ifstar\\envtag@literal\\envtag@paren"),t.gullet.macros.set("\\envtag@paren","\\env@tag{{(\\text{#1})}}"),t.gullet.macros.set("\\envtag@literal","\\env@tag{\\text{#1}}"),t.gullet.macros.set("\\notag","\\env@notag"),t.gullet.macros.set("\\nonumber","\\env@notag")),t.gullet.beginGroup();let d=[];const p=[d],h=[],g=[];let f;const b=[];for(b.push(At(t));;){let r=t.parseExpression(!1,s?"\\end":"\\\\");if(o&&!f)for(let e=0;e<r.length;e++)if("envTag"===r[e].type||"noTag"===r[e].type){f="envTag"===r[e].type?r.splice(e,1)[0].body.body[0]:{body:null};break}t.gullet.endGroup(),t.gullet.beginGroup(),r={type:"ordgroup",mode:t.mode,body:r,semisimple:!0},d.push(r);const i=t.fetch().text;if("&"===i){if(l&&d.length===l){if(!n.includes("array"))throw new e(2===l?"The split environment accepts no more than two columns":"The equation environment accepts only one column",t.nextToken);if(t.settings.strict)throw new e("Too few columns specified in the {array} column argument.",t.nextToken)}t.consume()}else{if("\\end"===i){1===d.length&&0===r.body.length&&(p.length>1||!a)&&p.pop(),b.length<p.length+1&&b.push([]);break}if("\\\\"!==i)throw new e("Expected & or \\\\ or \\cr or \\end",t.nextToken);{let e;t.consume()," "!==t.gullet.future().text&&(e=t.parseSizeGroup(!0)),h.push(e?e.value:null),g.push(f),b.push(At(t)),d=[],f=null,p.push(d)}}}return t.gullet.endGroup(),t.gullet.endGroup(),g.push(f),{type:"array",mode:t.mode,body:p,cols:r,rowGaps:h,hLinesBeforeRow:b,envClasses:n,addEqnNum:o,scriptLevel:u,tags:g,leqno:i,arraystretch:c,arraycolsep:m}}function Mt(e){return"d"===e.slice(0,1)?"display":"text"}const Bt={c:"center ",l:"left ",r:"right "},Ct=e=>{const t=new T.MathNode("mtd",[]);return t.style={padding:"0",width:"50%"},e.envClasses.includes("multline")&&(t.style.width="7.5%"),t},zt=function(e,t){const r=[],n=e.body.length,o=e.hLinesBeforeRow;for(let s=0;s<n;s++){const a=e.body[s],l=[],i="text"===e.scriptLevel?it:"script"===e.scriptLevel?ct:lt;for(let r=0;r<a.length;r++){const o=new T.MathNode("mtd",[me(a[r],t.withLevel(i))]);if(e.envClasses.includes("multline")){const e=0===s?"left":s===n-1?"right":"center";o.setAttribute("columnalign",e),"center"!==e&&o.classes.push("tml-"+e)}l.push(o)}if(e.addEqnNum){l.unshift(Ct(e)),l.push(Ct(e));const r=qt(e,t.withLevel(i),s);e.leqno?(l[0].children.push(r),l[0].classes.push("tml-left")):(l[l.length-1].children.push(r),l[l.length-1].classes.push("tml-right"))}const c=new T.MathNode("mtr",l,[]);0===s&&o[0].length>0&&(2===o[0].length?c.children.forEach((e=>{e.style.borderTop="0.15em double"})):c.children.forEach((e=>{e.style.borderTop=o[0][0]?"0.06em dashed":"0.06em solid"}))),o[s+1].length>0&&(2===o[s+1].length?c.children.forEach((e=>{e.style.borderBottom="0.15em double"})):c.children.forEach((e=>{e.style.borderBottom=o[s+1][0]?"0.06em dashed":"0.06em solid"}))),r.push(c)}if(e.envClasses.length>0){let n=e.envClasses.includes("jot")?"0.7":e.envClasses.includes("small")?"0.35":"0.5";e.arraystretch&&1!==e.arraystretch&&(n=String(1.4*e.arraystretch-.8));let o=e.envClasses.includes("abut")||e.envClasses.includes("cases")?"0":e.envClasses.includes("small")?"0.1389":e.envClasses.includes("cd")?"0.25":"0.4",s="em";if(e.arraycolsep){const r=Te(e.arraycolsep,t);o=r.number,s=r.unit}const a=0===r.length?0:r[0].children.length,l=(t,r)=>0===t&&0===r||t===a-1&&1===r?"0":"align"!==e.envClasses[0]?o:1===r?"0":e.addEqnNum?t%2?"1":"0":t%2?"0":"1";for(let e=0;e<r.length;e++)for(let t=0;t<r[e].children.length;t++)r[e].children[t].style.padding=`${n}ex ${l(t,1)}${s} ${n}ex ${l(t,0)}${s}`;const i=e.envClasses.includes("align")||e.envClasses.includes("alignat");for(let t=0;t<r.length;t++){const n=r[t];if(i){for(let e=0;e<n.children.length;e++)n.children[e].classes=["tml-"+(e%2?"left":"right")];if(e.addEqnNum){const t=e.leqno?0:n.children.length-1;n.children[t].classes=["tml-"+(e.leqno?"left":"right")]}}if(n.children.length>1&&e.envClasses.includes("cases")&&(n.children[1].style.padding=n.children[1].style.padding.replace(/0em$/,"1em")),e.envClasses.includes("cases")||e.envClasses.includes("subarray"))for(const e of n.children)e.classes.push("tml-left")}}else for(let e=0;e<r.length;e++)r[e].children[0].style.paddingLeft="0em",r[e].children.length===r[0].children.length&&(r[e].children[r[e].children.length-1].style.paddingRight="0em");let s=new T.MathNode("mtable",r);"display"===e.scriptLevel&&s.setAttribute("displaystyle","true"),(e.addEqnNum||e.envClasses.includes("multline"))&&(s.style.width="100%");let a="";if(e.cols&&e.cols.length>0){const t=e.cols;let r=!1,n=0,o=t.length;for(;"separator"===t[n].type;)n+=1;for(;"separator"===t[o-1].type;)o-=1;if("separator"===t[0].type){const e="separator"===t[1].type?"0.15em double":"|"===t[0].separator?"0.06em solid ":"0.06em dashed ";for(const t of s.children)t.children[0].style.borderLeft=e}let l=e.addEqnNum?0:-1;for(let e=n;e<o;e++)if("align"===t[e].type){const n=Bt[t[e].align];a+=n,l+=1;for(const e of s.children)"center"!==n.trim()&&l<e.children.length&&(e.children[l].classes=["tml-"+n.trim()]);r=!0}else if("separator"===t[e].type){if(r){const r="separator"===t[e+1].type?"0.15em double":"|"===t[e].separator?"0.06em solid":"0.06em dashed";for(const e of s.children)l<e.children.length&&(e.children[l].style.borderRight=r)}r=!1}if("separator"===t[t.length-1].type){const e="separator"===t[t.length-2].type?"0.15em double":"|"===t[t.length-1].separator?"0.06em solid":"0.06em dashed";for(const t of s.children)t.children[t.children.length-1].style.borderRight=e,t.children[t.children.length-1].style.paddingRight="0.4em"}}return e.addEqnNum&&(a="left "+(a.length>0?a:"center ")+"right "),a&&s.setAttribute("columnalign",a.trim()),e.envClasses.includes("small")&&(s=new T.MathNode("mstyle",[s]),s.setAttribute("scriptlevel","1")),s},Et=function(t,r){-1===t.envName.indexOf("ed")&&Nt(t);const n=[],o=Ot(t.parser,{cols:n,addEqnNum:"align"===t.envName||"alignat"===t.envName,emptySingleRow:!0,envClasses:["abut","jot"],maxNumCols:"split"===t.envName?2:void 0,leqno:t.parser.settings.leqno},"display");let s,a=0;const l=t.envName.indexOf("at")>-1;if(r[0]&&l){let t="";for(let e=0;e<r[0].body.length;e++){t+=Ce(r[0].body[e],"textord").text}if(isNaN(t))throw new e("The alignat enviroment requires a numeric first argument.");s=Number(t),a=2*s}o.body.forEach((function(t){if(l){const r=t.length/2;if(s<r)throw new e(`Too many math in a row: expected ${s}, but got ${r}`,t[0])}else a<t.length&&(a=t.length)}));for(let e=0;e<a;++e){let t="r";e%2==1&&(t="l"),n[e]={type:"align",align:t}}return"split"===t.envName||(l?o.envClasses.push("alignat"):o.envClasses[0]="align"),o};at({type:"array",names:["array","darray"],props:{numArgs:1},handler(t,r){const n=(Ee(r[0])?[r[0]]:Ce(r[0],"ordgroup").body).map((function(t){const r=ze(t).text;if(-1!=="lcr".indexOf(r))return{type:"align",align:r};if("|"===r)return{type:"separator",separator:"|"};if(":"===r)return{type:"separator",separator:":"};throw new e("Unknown column alignment: "+r,t)})),[o,s]=St(t.parser.gullet.macros),a={cols:n,envClasses:["array"],maxNumCols:n.length,arraystretch:o,arraycolsep:s};return Ot(t.parser,a,Mt(t.envName))},mathmlBuilder:zt}),at({type:"array",names:["matrix","pmatrix","bmatrix","Bmatrix","vmatrix","Vmatrix","matrix*","pmatrix*","bmatrix*","Bmatrix*","vmatrix*","Vmatrix*"],props:{numArgs:0},handler(t){const r={matrix:null,pmatrix:["(",")"],bmatrix:["[","]"],Bmatrix:["\\{","\\}"],vmatrix:["|","|"],Vmatrix:["\\Vert","\\Vert"]}[t.envName.replace("*","")];let n="c";const o={envClasses:[],cols:[]};if("*"===t.envName.charAt(t.envName.length-1)){const r=t.parser;if(r.consumeSpaces(),"["===r.fetch().text){if(r.consume(),r.consumeSpaces(),n=r.fetch().text,-1==="lcr".indexOf(n))throw new e("Expected l or c or r",r.nextToken);r.consume(),r.consumeSpaces(),r.expect("]"),r.consume(),o.cols=[]}}const s=Ot(t.parser,o,"text");s.cols=new Array(s.body[0].length).fill({type:"align",align:n});const[a,l]=St(t.parser.gullet.macros);return r?{type:"leftright",mode:t.mode,body:[s],left:r[0],right:r[1],rightColor:void 0,arraystretch:a,arraycolsep:l}:s},mathmlBuilder:zt}),at({type:"array",names:["smallmatrix"],props:{numArgs:0},handler(e){const t=Ot(e.parser,{type:"small"},"script");return t.envClasses=["small"],t},mathmlBuilder:zt}),at({type:"array",names:["subarray"],props:{numArgs:1},handler(t,r){const n=(Ee(r[0])?[r[0]]:Ce(r[0],"ordgroup").body).map((function(t){const r=ze(t).text;if(-1!=="lc".indexOf(r))return{type:"align",align:r};throw new e("Unknown column alignment: "+r,t)}));if(n.length>1)throw new e("{subarray} can contain only one column");let o={cols:n,envClasses:["small"]};if(o=Ot(t.parser,o,"script"),o.body.length>0&&o.body[0].length>1)throw new e("{subarray} can contain only one column");return o},mathmlBuilder:zt}),at({type:"array",names:["cases","dcases","rcases","drcases"],props:{numArgs:0},handler(e){const t=Ot(e.parser,{cols:[],envClasses:["cases"]},Mt(e.envName));return{type:"leftright",mode:e.mode,body:[t],left:e.envName.indexOf("r")>-1?".":"\\{",right:e.envName.indexOf("r")>-1?"\\}":".",rightColor:void 0}},mathmlBuilder:zt}),at({type:"array",names:["align","align*","aligned","split"],props:{numArgs:0},handler:Et,mathmlBuilder:zt}),at({type:"array",names:["alignat","alignat*","alignedat"],props:{numArgs:1},handler:Et,mathmlBuilder:zt}),at({type:"array",names:["gathered","gather","gather*"],props:{numArgs:0},handler(e){"gathered"!==e.envName&&Nt(e);const t={cols:[],envClasses:["abut","jot"],addEqnNum:"gather"===e.envName,emptySingleRow:!0,leqno:e.parser.settings.leqno};return Ot(e.parser,t,"display")},mathmlBuilder:zt}),at({type:"array",names:["equation","equation*"],props:{numArgs:0},handler(e){Nt(e);const t={addEqnNum:"equation"===e.envName,emptySingleRow:!0,singleRow:!0,maxNumCols:1,envClasses:["align"],leqno:e.parser.settings.leqno};return Ot(e.parser,t,"display")},mathmlBuilder:zt}),at({type:"array",names:["multline","multline*"],props:{numArgs:0},handler(e){Nt(e);const t={addEqnNum:"multline"===e.envName,maxNumCols:1,envClasses:["jot","multline"],leqno:e.parser.settings.leqno};return Ot(e.parser,t,"display")},mathmlBuilder:zt}),at({type:"array",names:["CD"],props:{numArgs:0},handler:t=>(Nt(t),function(t){const r=[];for(t.gullet.beginGroup(),t.gullet.macros.set("\\cr","\\\\\\relax"),t.gullet.beginGroup();;){r.push(t.parseExpression(!1,"\\\\")),t.gullet.endGroup(),t.gullet.beginGroup();const n=t.fetch().text;if("&"!==n&&"\\\\"!==n){if("\\end"===n){0===r[r.length-1].length&&r.pop();break}throw new e("Expected \\\\ or \\cr or \\end",t.nextToken)}t.consume()}let n=[];const o=[n];for(let l=0;l<r.length;l++){const i=r[l];let c={type:"styling",body:[],mode:"math",scriptLevel:"display"};for(let r=0;r<i.length;r++)if($e(i[r])){n.push(c),r+=1;const o=ze(i[r]).text,l=new Array(2);if(l[0]={type:"ordgroup",mode:"math",body:[]},l[1]={type:"ordgroup",mode:"math",body:[]},"=|.".indexOf(o)>-1);else{if(!("<>AV".indexOf(o)>-1))throw new e('Expected one of "<>AV=|." after @.');for(let t=0;t<2;t++){let n=!0;for(let c=r+1;c<i.length;c++){if(a=o,("mathord"===(s=i[c]).type||"atom"===s.type)&&s.text===a){n=!1,r=c;break}if($e(i[c]))throw new e("Missing a "+o+" character to complete a CD arrow.",i[c]);l[t].body.push(i[c])}if(n)throw new e("Missing a "+o+" character to complete a CD arrow.",i[r])}}const m=Le(o,l,t);n.push(m),c={type:"styling",body:[],mode:"math",scriptLevel:"display"}}else c.body.push(i[r]);l%2==0?n.push(c):n.shift(),n=[],o.push(n)}var s,a;return o.pop(),t.gullet.endGroup(),t.gullet.endGroup(),{type:"array",mode:"math",body:o,envClasses:["jot","cd"],cols:[],hLinesBeforeRow:new Array(o.length+1).fill([])}}(t.parser)),mathmlBuilder:zt}),c({type:"text",names:["\\hline","\\hdashline"],props:{numArgs:0,allowedInText:!0,allowedInMath:!0},handler(t,r){throw new e(`${t.funcName} valid only within array environment`)}});const It=st;c({type:"environment",names:["\\begin","\\end"],props:{numArgs:1,argTypes:["text"]},handler({parser:t,funcName:r},n){const o=n[0];if("ordgroup"!==o.type)throw new e("Invalid environment name",o);let s="";for(let e=0;e<o.body.length;++e)s+=Ce(o.body[e],"textord").text;if("\\begin"===r){if(!Object.prototype.hasOwnProperty.call(It,s))throw new e("No such environment: "+s,o);const r=It[s],{args:n,optArgs:a}=t.parseArguments("\\begin{"+s+"}",r),l={mode:t.mode,envName:s,parser:t},i=r.handler(l,n,a);t.expect("\\end",!1);const c=t.nextToken,m=Ce(t.parseFunction(),"environment");if(m.name!==s)throw new e(`Mismatch: \\begin{${s}} matched by \\end{${m.name}}`,c);return i}return{type:"environment",mode:t.mode,name:s,nameGroup:o}}}),c({type:"envTag",names:["\\env@tag"],props:{numArgs:1,argTypes:["math"]},handler:({parser:e},t)=>({type:"envTag",mode:e.mode,body:t[0]}),mathmlBuilder:(e,t)=>new T.MathNode("mrow")}),c({type:"noTag",names:["\\env@notag"],props:{numArgs:0},handler:({parser:e})=>({type:"noTag",mode:e.mode}),mathmlBuilder:(e,t)=>new T.MathNode("mrow")});const $t=(e,t)=>{const r=e.font,n=t.withFont(r),o=me(e.body,n);if(0===o.children.length)return o;if("boldsymbol"===r&&["mo","mpadded","mrow"].includes(o.type))return o.style.fontWeight="bold",o;if(((e,t)=>{if("mathrm"!==t||"ordgroup"!==e.body.type||1===e.body.body.length)return!1;if("mathord"!==e.body.body[0].type)return!1;for(let t=1;t<e.body.body.length;t++){const r=e.body.body[t].type;if("mathord"!==r&&("textord"!==r||isNaN(e.body.body[t].text)))return!1}return!0})(e,r)){const e=o.children[0].children[0];delete e.attributes.mathvariant;for(let t=1;t<o.children.length;t++)e.children[0].text+="mn"===o.children[t].type?o.children[t].children[0].text:o.children[t].children[0].children[0].text;const t=new T.MathNode("mtext",new T.TextNode("​"));return new T.MathNode("mrow",[t,e])}let s="mo"===o.children[0].type;for(let e=1;e<o.children.length;e++){"mo"===o.children[e].type&&"boldsymbol"===r&&(o.children[e].style.fontWeight="bold"),"mi"!==o.children[e].type&&(s=!1);"normal"!==(o.children[e].attributes&&o.children[e].attributes.mathvariant||"")&&(s=!1)}if(!s)return o;const a=o.children[0];for(let e=1;e<o.children.length;e++)a.children.push(o.children[e].children[0]);if(a.attributes.mathvariant&&"normal"===a.attributes.mathvariant){const e=new T.MathNode("mtext",new T.TextNode("​"));return new T.MathNode("mrow",[e,a])}return a},Lt={"\\Bbb":"\\mathbb","\\bold":"\\mathbf","\\frak":"\\mathfrak","\\bm":"\\boldsymbol"};c({type:"font",names:["\\mathrm","\\mathit","\\mathbf","\\mathnormal","\\up@greek","\\boldsymbol","\\mathbb","\\mathcal","\\mathfrak","\\mathscr","\\mathsf","\\mathsfit","\\mathtt","\\Bbb","\\bm","\\bold","\\frak"],props:{numArgs:1,allowedInArgument:!0},handler:({parser:e,funcName:t},r)=>{const n=u(r[0]);let o=t;return o in Lt&&(o=Lt[o]),{type:"font",mode:e.mode,font:o.slice(1),body:n}},mathmlBuilder:$t}),c({type:"font",names:["\\rm","\\sf","\\tt","\\bf","\\it","\\cal"],props:{numArgs:0,allowedInText:!0},handler:({parser:e,funcName:t,breakOnTokenText:r},n)=>{const{mode:o}=e,s=e.parseExpression(!0,r,!0);return{type:"font",mode:o,font:`math${t.slice(1)}`,body:{type:"ordgroup",mode:e.mode,body:s}}},mathmlBuilder:$t});const Ft=["display","text","script","scriptscript"],Gt={auto:-1,display:0,text:0,script:1,scriptscript:2},Dt=(e,t)=>{const r="auto"===e.scriptLevel?t.incrementLevel():"display"===e.scriptLevel?t.withLevel(it):"text"===e.scriptLevel?t.withLevel(ct):t.withLevel(mt),n=me(e.numer,r),o=me(e.denom,r);3===t.level&&(n.style.mathDepth="2",n.setAttribute("scriptlevel","2"),o.style.mathDepth="2",o.setAttribute("scriptlevel","2"));let s=new T.MathNode("mfrac",[n,o]);if(e.hasBarLine){if(e.barSize){const r=Te(e.barSize,t);s.setAttribute("linethickness",r.number+r.unit)}}else s.setAttribute("linethickness","0px");if(null!=e.leftDelim||null!=e.rightDelim){const t=[];if(null!=e.leftDelim){const r=new T.MathNode("mo",[new T.TextNode(e.leftDelim.replace("\\",""))]);r.setAttribute("fence","true"),t.push(r)}if(t.push(s),null!=e.rightDelim){const r=new T.MathNode("mo",[new T.TextNode(e.rightDelim.replace("\\",""))]);r.setAttribute("fence","true"),t.push(r)}s=oe(t)}return"auto"!==e.scriptLevel&&(s=new T.MathNode("mstyle",[s]),s.setAttribute("displaystyle",String("display"===e.scriptLevel)),s.setAttribute("scriptlevel",Gt[e.scriptLevel])),s};c({type:"genfrac",names:["\\dfrac","\\frac","\\tfrac","\\dbinom","\\binom","\\tbinom","\\\\atopfrac","\\\\bracefrac","\\\\brackfrac"],props:{numArgs:2,allowedInArgument:!0},handler:({parser:e,funcName:t},r)=>{const n=r[0],o=r[1];let s=!1,a=null,l=null,i="auto";switch(t){case"\\dfrac":case"\\frac":case"\\tfrac":s=!0;break;case"\\\\atopfrac":s=!1;break;case"\\dbinom":case"\\binom":case"\\tbinom":a="(",l=")";break;case"\\\\bracefrac":a="\\{",l="\\}";break;case"\\\\brackfrac":a="[",l="]";break;default:throw new Error("Unrecognized genfrac command")}switch(t){case"\\dfrac":case"\\dbinom":i="display";break;case"\\tfrac":case"\\tbinom":i="text"}return{type:"genfrac",mode:e.mode,continued:!1,numer:n,denom:o,hasBarLine:s,leftDelim:a,rightDelim:l,scriptLevel:i,barSize:null}},mathmlBuilder:Dt}),c({type:"genfrac",names:["\\cfrac"],props:{numArgs:2},handler:({parser:e,funcName:t},r)=>{const n=r[0],o=r[1];return{type:"genfrac",mode:e.mode,continued:!0,numer:n,denom:o,hasBarLine:!0,leftDelim:null,rightDelim:null,scriptLevel:"display",barSize:null}}}),c({type:"infix",names:["\\over","\\choose","\\atop","\\brace","\\brack"],props:{numArgs:0,infix:!0},handler({parser:e,funcName:t,token:r}){let n;switch(t){case"\\over":n="\\frac";break;case"\\choose":n="\\binom";break;case"\\atop":n="\\\\atopfrac";break;case"\\brace":n="\\\\bracefrac";break;case"\\brack":n="\\\\brackfrac";break;default:throw new Error("Unrecognized infix genfrac command")}return{type:"infix",mode:e.mode,replaceWith:n,token:r}}});const jt=function(e){let t=null;return e.length>0&&(t=e,t="."===t?null:t),t};c({type:"genfrac",names:["\\genfrac"],props:{numArgs:6,allowedInArgument:!0,argTypes:["math","math","size","text","math","math"]},handler({parser:e},t){const r=t[4],n=t[5],o=u(t[0]),s="atom"===o.type&&"open"===o.family?jt(o.text):null,a=u(t[1]),l="atom"===a.type&&"close"===a.family?jt(a.text):null,i=Ce(t[2],"size");let c,m=null;i.isBlank?c=!0:(m=i.value,c=m.number>0);let d="auto",p=t[3];if("ordgroup"===p.type){if(p.body.length>0){const e=Ce(p.body[0],"textord");d=Ft[Number(e.text)]}}else p=Ce(p,"textord"),d=Ft[Number(p.text)];return{type:"genfrac",mode:e.mode,numer:r,denom:n,continued:!1,hasBarLine:c,barSize:m,leftDelim:s,rightDelim:l,scriptLevel:d}},mathmlBuilder:Dt}),c({type:"infix",names:["\\above"],props:{numArgs:1,argTypes:["size"],infix:!0},handler:({parser:e,funcName:t,token:r},n)=>({type:"infix",mode:e.mode,replaceWith:"\\\\abovefrac",barSize:Ce(n[0],"size").value,token:r})}),c({type:"genfrac",names:["\\\\abovefrac"],props:{numArgs:3,argTypes:["math","size","math"]},handler:({parser:e,funcName:t},r)=>{const n=r[0],o=function(e){if(!e)throw new Error("Expected non-null, but got "+String(e));return e}(Ce(r[1],"infix").barSize),s=r[2],a=o.number>0;return{type:"genfrac",mode:e.mode,numer:n,denom:s,continued:!1,hasBarLine:a,barSize:o,leftDelim:null,rightDelim:null,scriptLevel:"auto"}},mathmlBuilder:Dt}),c({type:"hbox",names:["\\hbox"],props:{numArgs:1,argTypes:["hbox"],allowedInArgument:!0,allowedInText:!1},handler:({parser:e},t)=>({type:"hbox",mode:e.mode,body:d(t[0])}),mathmlBuilder(e,t){const r=t.withLevel(it),n=ce(e.body,r);return ne(n)}});c({type:"horizBrace",names:["\\overbrace","\\underbrace"],props:{numArgs:1},handler:({parser:e,funcName:t},r)=>({type:"horizBrace",mode:e.mode,label:t,isOver:/^\\over/.test(t),base:r[0]}),mathmlBuilder:(e,t)=>{const r=B(e.label);return r.style["math-depth"]=0,new T.MathNode(e.isOver?"mover":"munder",[me(e.base,t),r])}}),c({type:"href",names:["\\href"],props:{numArgs:2,argTypes:["url","original"],allowedInText:!0},handler:({parser:t,token:r},n)=>{const o=n[1],s=Ce(n[0],"url").url;if(!t.settings.isTrusted({command:"\\href",url:s}))throw new e('Function "\\href" is not trusted',r);return{type:"href",mode:t.mode,href:s,body:d(o)}},mathmlBuilder:(e,t)=>{const r=new v("math",[ce(e.body,t)]);return new x(e.href,[],[r])}}),c({type:"href",names:["\\url"],props:{numArgs:1,argTypes:["url"],allowedInText:!0},handler:({parser:t,token:r},n)=>{const o=Ce(n[0],"url").url;if(!t.settings.isTrusted({command:"\\url",url:o}))throw new e('Function "\\url" is not trusted',r);const s=[];for(let e=0;e<o.length;e++){let t=o[e];"~"===t&&(t="\\textasciitilde"),s.push({type:"textord",mode:"text",text:t})}const a={type:"text",mode:t.mode,font:"\\texttt",body:s};return{type:"href",mode:t.mode,href:o,body:d(a)}}}),c({type:"html",names:["\\class","\\id","\\style","\\data"],props:{numArgs:2,argTypes:["raw","original"],allowedInText:!0},handler:({parser:t,funcName:r,token:n},o)=>{const s=Ce(o[0],"raw").string,a=o[1];if(t.settings.strict)throw new e(`Function "${r}" is disabled in strict mode`,n);let l;const i={};switch(r){case"\\class":i.class=s,l={command:"\\class",class:s};break;case"\\id":i.id=s,l={command:"\\id",id:s};break;case"\\style":i.style=s,l={command:"\\style",style:s};break;case"\\data":{const t=s.split(",");for(let r=0;r<t.length;r++){const n=t[r].split("=");if(2!==n.length)throw new e("Error parsing key-value for \\data");i["data-"+n[0].trim()]=n[1].trim()}l={command:"\\data",attributes:i};break}default:throw new Error("Unrecognized html command")}if(!t.settings.isTrusted(l))throw new e(`Function "${r}" is not trusted`,n);return{type:"html",mode:t.mode,attributes:i,body:d(a)}},mathmlBuilder:(e,t)=>{const r=ce(e.body,t),n=[];e.attributes.class&&n.push(...e.attributes.class.trim().split(/\s+/)),r.classes=n;for(const t in e.attributes)"class"!==t&&Object.prototype.hasOwnProperty.call(e.attributes,t)&&r.setAttribute(t,e.attributes[t]);return r}});const Pt=function(t){if(/^[-+]? *(\d+(\.\d*)?|\.\d+)$/.test(t))return{number:+t,unit:"bp"};{const r=/([-+]?) *(\d+(?:\.\d*)?|\.\d+) *([a-z]{2})/.exec(t);if(!r)throw new e("Invalid size: '"+t+"' in \\includegraphics");const n={number:+(r[1]+r[2]),unit:r[3]};if(!Ae(n))throw new e("Invalid unit: '"+n.unit+"' in \\includegraphics.");return n}};c({type:"includegraphics",names:["\\includegraphics"],props:{numArgs:1,numOptionalArgs:1,argTypes:["raw","url"],allowedInText:!1},handler:({parser:t,token:r},n,o)=>{let s={number:0,unit:"em"},a={number:.9,unit:"em"},l={number:0,unit:"em"},i="";if(o[0]){const t=Ce(o[0],"raw").string.split(",");for(let r=0;r<t.length;r++){const n=t[r].split("=");if(2===n.length){const t=n[1].trim();switch(n[0].trim()){case"alt":i=t;break;case"width":s=Pt(t);break;case"height":a=Pt(t);break;case"totalheight":l=Pt(t);break;default:throw new e("Invalid key: '"+n[0]+"' in \\includegraphics.")}}}}const c=Ce(n[0],"url").url;if(""===i&&(i=c,i=i.replace(/^.*[\\/]/,""),i=i.substring(0,i.lastIndexOf("."))),!t.settings.isTrusted({command:"\\includegraphics",url:c}))throw new e('Function "\\includegraphics" is not trusted',r);return{type:"includegraphics",mode:t.mode,alt:i,width:s,height:a,totalheight:l,src:c}},mathmlBuilder:(e,t)=>{const r=Te(e.height,t),n={number:0,unit:"em"};e.totalheight.number>0&&e.totalheight.unit===r.unit&&e.totalheight.number>r.number&&(n.number=e.totalheight.number-r.number,n.unit=r.unit);let o=0;e.width.number>0&&(o=Te(e.width,t));const s={height:r.number+n.number+"em"};o.number>0&&(s.width=o.number+o.unit),n.number>0&&(s.verticalAlign=-n.number+n.unit);const a=new k(e.src,e.alt,s);return a.height=r,a.depth=n,new T.MathNode("mtext",[a])}}),c({type:"kern",names:["\\kern","\\mkern","\\hskip","\\mskip"],props:{numArgs:1,argTypes:["size"],primitive:!0,allowedInText:!0},handler({parser:t,funcName:r,token:n},o){const s=Ce(o[0],"size");if(t.settings.strict){const o="m"===r[1],a="mu"===s.value.unit;if(o){if(!a)throw new e(`LaTeX's ${r} supports only mu units, not ${s.value.unit} units`,n);if("math"!==t.mode)throw new e(`LaTeX's ${r} works only in math mode`,n)}else if(a)throw new e(`LaTeX's ${r} doesn't support mu units`,n)}return{type:"kern",mode:t.mode,dimension:s.value}},mathmlBuilder(e,t){const r=Te(e.dimension,t),n="em"===r.unit?Rt(r.number):"";if("text"===e.mode&&n.length>0){const e=new T.TextNode(n);return new T.MathNode("mtext",[e])}{const e=new T.MathNode("mspace");return e.setAttribute("width",r.number+r.unit),r.number<0&&(e.style.marginLeft=r.number+r.unit),e}}});const Rt=function(e){return e>=.05555&&e<=.05556?" ":e>=.1666&&e<=.1667?" ":e>=.2222&&e<=.2223?" ":e>=.2777&&e<=.2778?"  ":""},Ut=/[^A-Za-z_0-9-]/g;c({type:"label",names:["\\label"],props:{numArgs:1,argTypes:["raw"]},handler:({parser:e},t)=>({type:"label",mode:e.mode,string:t[0].string.replace(Ut,"")}),mathmlBuilder(e,t){const r=new T.MathNode("mrow",[],["tml-label"]);return e.string.length>0&&r.setAttribute("id",e.string),r}});const Ht=["\\clap","\\llap","\\rlap"];c({type:"lap",names:["\\mathllap","\\mathrlap","\\mathclap","\\clap","\\llap","\\rlap"],props:{numArgs:1,allowedInText:!0},handler:({parser:t,funcName:r,token:n},o)=>{if(Ht.includes(r)){if(t.settings.strict&&"text"!==t.mode)throw new e(`{${r}} can be used only in text mode.\n Try \\math${r.slice(1)}`,n);r=r.slice(1)}else r=r.slice(5);const s=o[0];return{type:"lap",mode:t.mode,alignment:r,body:s}},mathmlBuilder:(e,t)=>{let r;if("llap"===e.alignment){const n=ie(d(e.body),t),o=new T.MathNode("mphantom",n);r=new T.MathNode("mpadded",[o]),r.setAttribute("width","0px")}const n=me(e.body,t);let o;if("llap"===e.alignment?(n.style.position="absolute",n.style.right="0",n.style.bottom="0",o=new T.MathNode("mpadded",[r,n])):o=new T.MathNode("mpadded",[n]),"rlap"===e.alignment)e.body.body.length>0&&"genfrac"===e.body.body[0].type&&o.setAttribute("lspace","0.16667em");else{const t="llap"===e.alignment?"-1":"-0.5";o.setAttribute("lspace",t+"width"),"llap"===e.alignment?o.style.position="relative":(o.style.display="flex",o.style.justifyContent="center")}return o.setAttribute("width","0px"),o}}),c({type:"ordgroup",names:["\\(","$"],props:{numArgs:0,allowedInText:!0,allowedInMath:!1},handler({funcName:e,parser:t},r){const n=t.mode;t.switchMode("math");const o="\\("===e?"\\)":"$",s=t.parseExpression(!1,o);return t.expect(o),t.switchMode(n),{type:"ordgroup",mode:t.mode,body:s}}}),c({type:"text",names:["\\)","\\]"],props:{numArgs:0,allowedInText:!0,allowedInMath:!1},handler(t,r){throw new e(`Mismatched ${t.funcName}`,r)}});c({type:"mathchoice",names:["\\mathchoice"],props:{numArgs:4,primitive:!0},handler:({parser:e},t)=>({type:"mathchoice",mode:e.mode,display:d(t[0]),text:d(t[1]),script:d(t[2]),scriptscript:d(t[3])}),mathmlBuilder:(e,t)=>{const r=((e,t)=>{switch(t.level){case lt:return e.display;case it:return e.text;case ct:return e.script;case mt:return e.scriptscript;default:return e.text}})(e,t);return ce(r,t)}});const Vt=["text","textord","mathord","atom"],_t=e=>{const t=new T.MathNode("mspace");return t.setAttribute("width",e+"em"),t};function Wt(e,t){let r;const n=ie(e.body,t);if("minner"===e.mclass)r=new T.MathNode("mpadded",n);else if("mord"===e.mclass)e.isCharacterBox||"mathord"===n[0].type?(r=n[0],r.type="mi",1===r.children.length&&r.children[0].text&&"∇"===r.children[0].text&&r.setAttribute("mathvariant","normal")):r=new T.MathNode("mi",n);else{r=new T.MathNode("mrow",n),e.mustPromote?(r=n[0],r.type="mo",e.isCharacterBox&&e.body[0].text&&/[A-Za-z]/.test(e.body[0].text)&&r.setAttribute("mathvariant","italic")):r=new T.MathNode("mrow",n);const o=t.level<2;"mrow"===r.type?o&&("mbin"===e.mclass?(r.children.unshift(_t(.2222)),r.children.push(_t(.2222))):"mrel"===e.mclass?(r.children.unshift(_t(.2778)),r.children.push(_t(.2778))):"mpunct"===e.mclass?r.children.push(_t(.1667)):"minner"===e.mclass&&(r.children.unshift(_t(.0556)),r.children.push(_t(.0556)))):"mbin"===e.mclass?(r.attributes.lspace=o?"0.2222em":"0",r.attributes.rspace=o?"0.2222em":"0"):"mrel"===e.mclass?(r.attributes.lspace=o?"0.2778em":"0",r.attributes.rspace=o?"0.2778em":"0"):"mpunct"===e.mclass?(r.attributes.lspace="0em",r.attributes.rspace=o?"0.1667em":"0"):"mopen"===e.mclass||"mclose"===e.mclass?(r.attributes.lspace="0em",r.attributes.rspace="0em"):"minner"===e.mclass&&o&&(r.attributes.lspace="0.0556em",r.attributes.width="+0.1111em"),"mopen"!==e.mclass&&"mclose"!==e.mclass&&(delete r.attributes.stretchy,delete r.attributes.form)}return r}c({type:"mclass",names:["\\mathord","\\mathbin","\\mathrel","\\mathopen","\\mathclose","\\mathpunct","\\mathinner"],props:{numArgs:1,primitive:!0},handler({parser:e,funcName:t},r){const n=r[0],o=s.isCharacterBox(n);let a=!0;const l={type:"mathord",text:"",mode:e.mode},i=n.body?n.body:[n];for(const t of i){if(!Vt.includes(t.type)){a=!1;break}I[e.mode][t.text]?l.text+=I[e.mode][t.text].replace:t.text?l.text+=t.text:t.body&&t.body.map((e=>{l.text+=e.text}))}return{type:"mclass",mode:e.mode,mclass:"m"+t.slice(5),body:d(a?l:n),isCharacterBox:o,mustPromote:a}},mathmlBuilder:Wt});const Xt=e=>{const t="ordgroup"===e.type&&e.body.length?e.body[0]:e;return"atom"!==t.type||"bin"!==t.family&&"rel"!==t.family?"mord":"m"+t.family};c({type:"mclass",names:["\\@binrel"],props:{numArgs:2},handler:({parser:e},t)=>({type:"mclass",mode:e.mode,mclass:Xt(t[0]),body:d(t[1]),isCharacterBox:s.isCharacterBox(t[1])})}),c({type:"mclass",names:["\\stackrel","\\overset","\\underset"],props:{numArgs:2},handler({parser:e,funcName:t},r){const n=r[1],o=r[0],s={type:"op",mode:n.mode,limits:!0,alwaysHandleSupSub:!0,parentIsSupSub:!1,symbol:!1,stack:!0,suppressBaseShift:"\\stackrel"!==t,body:d(n)};return{type:"supsub",mode:o.mode,base:s,sup:"\\underset"===t?null:o,sub:"\\underset"===t?o:null}},mathmlBuilder:Wt});const Zt=(e,t,r)=>{if(!e)return r;const n=me(e,t);return"mrow"===n.type&&0===n.children.length?r:n};c({type:"multiscript",names:["\\sideset","\\pres@cript"],props:{numArgs:3},handler({parser:t,funcName:r,token:n},o){if(0===o[2].body.length)throw new e(r+"cannot parse an empty base.");const s=o[2].body[0];if(t.settings.strict&&"\\sideset"===r&&!s.symbol)throw new e("The base of \\sideset must be a big operator. Try \\prescript.");if(o[0].body.length>0&&"supsub"!==o[0].body[0].type||o[1].body.length>0&&"supsub"!==o[1].body[0].type)throw new e("\\sideset can parse only subscripts and superscripts in its first two arguments",n);const a=o[0].body.length>0?o[0].body[0]:null,l=o[1].body.length>0?o[1].body[0]:null;return a||l?a?{type:"multiscript",mode:t.mode,isSideset:"\\sideset"===r,prescripts:a,postscripts:l,base:s}:{type:"styling",mode:t.mode,scriptLevel:"text",body:[{type:"supsub",mode:t.mode,base:s,sup:l.sup,sub:l.sub}]}:s},mathmlBuilder(e,t){const r=me(e.base,t),n=new T.MathNode("mprescripts"),o=new T.MathNode("none");let s=[];const a=Zt(e.prescripts.sub,t,o),l=Zt(e.prescripts.sup,t,o);if(e.isSideset&&(a.setAttribute("style","text-align: left;"),l.setAttribute("style","text-align: left;")),e.postscripts){s=[r,Zt(e.postscripts.sub,t,o),Zt(e.postscripts.sup,t,o),n,a,l]}else s=[r,n,a,l];return new T.MathNode("mmultiscripts",s)}}),c({type:"not",names:["\\not"],props:{numArgs:1,primitive:!0,allowedInText:!1},handler({parser:e},t){const r=s.isCharacterBox(t[0]);let n;if(r)n=d(t[0]),"\\"===n[0].text.charAt(0)&&(n[0].text=I.math[n[0].text].replace),n[0].text=n[0].text.slice(0,1)+"̸"+n[0].text.slice(1);else{n=[{type:"textord",mode:"math",text:"̸"},{type:"kern",mode:"math",dimension:{number:-.6,unit:"em"}},t[0]]}return{type:"not",mode:e.mode,body:n,isCharacterBox:r}},mathmlBuilder(e,t){if(e.isCharacterBox){return ie(e.body,t,!0)[0]}return ce(e.body,t)}});const Yt=["textord","mathord","atom"],Kt=["\\smallint"],Jt=["textord","mathord","ordgroup","close","leftright","font"],Qt=e=>{e.attributes.lspace="0.1667em",e.attributes.rspace="0.1667em"},er=(e,t)=>{let r;if(e.symbol)r=new v("mo",[te(e.name,e.mode)]),Kt.includes(e.name)?r.setAttribute("largeop","false"):r.setAttribute("movablelimits","false"),e.fromMathOp&&Qt(r);else if(e.body)r=new v("mo",ie(e.body,t)),e.fromMathOp&&Qt(r);else if(r=new v("mi",[new A(e.name.slice(1))]),!e.parentIsSupSub){const t=[r,new v("mo",[te("⁡","text")])];if(e.needsLeadingSpace){const e=new v("mspace");e.setAttribute("width","0.1667em"),t.unshift(e)}if(!e.isFollowedByDelimiter){const e=new v("mspace");e.setAttribute("width","0.1667em"),t.push(e)}r=new v("mrow",t)}return r},tr={"∏":"\\prod","∐":"\\coprod","∑":"\\sum","⋀":"\\bigwedge","⋁":"\\bigvee","⋂":"\\bigcap","⋃":"\\bigcup","⨀":"\\bigodot","⨁":"\\bigoplus","⨂":"\\bigotimes","⨄":"\\biguplus","⨅":"\\bigsqcap","⨆":"\\bigsqcup","⨃":"\\bigcupdot","⨇":"\\bigdoublevee","⨈":"\\bigdoublewedge","⨉":"\\bigtimes"};c({type:"op",names:["\\coprod","\\bigvee","\\bigwedge","\\biguplus","\\bigcupplus","\\bigcupdot","\\bigcap","\\bigcup","\\bigdoublevee","\\bigdoublewedge","\\intop","\\prod","\\sum","\\bigotimes","\\bigoplus","\\bigodot","\\bigsqcap","\\bigsqcup","\\bigtimes","\\smallint","∏","∐","∑","⋀","⋁","⋂","⋃","⨀","⨁","⨂","⨄","⨆"],props:{numArgs:0},handler:({parser:e,funcName:t},r)=>{let n=t;return 1===n.length&&(n=tr[n]),{type:"op",mode:e.mode,limits:!0,parentIsSupSub:!1,symbol:!0,stack:!1,name:n}},mathmlBuilder:er}),c({type:"op",names:["\\mathop"],props:{numArgs:1,primitive:!0},handler:({parser:e},t)=>{const r=t[0],n=r.body?r.body:[r],o=1===n.length&&Yt.includes(n[0].type);return{type:"op",mode:e.mode,limits:!0,parentIsSupSub:!1,symbol:o,fromMathOp:!0,stack:!1,name:o?n[0].text:null,body:o?null:d(r)}},mathmlBuilder:er});const rr={"∫":"\\int","∬":"\\iint","∭":"\\iiint","∮":"\\oint","∯":"\\oiint","∰":"\\oiiint","∱":"\\intclockwise","∲":"\\varointclockwise","⨌":"\\iiiint","⨍":"\\intbar","⨎":"\\intBar","⨏":"\\fint","⨒":"\\rppolint","⨓":"\\scpolint","⨕":"\\pointint","⨖":"\\sqint","⨗":"\\intlarhk","⨘":"\\intx","⨙":"\\intcap","⨚":"\\intcup"};c({type:"op",names:["\\arcsin","\\arccos","\\arctan","\\arctg","\\arcctg","\\arg","\\ch","\\cos","\\cosec","\\cosh","\\cot","\\cotg","\\coth","\\csc","\\ctg","\\cth","\\deg","\\dim","\\exp","\\hom","\\ker","\\lg","\\ln","\\log","\\sec","\\sin","\\sinh","\\sh","\\sgn","\\tan","\\tanh","\\tg","\\th"],props:{numArgs:0},handler({parser:e,funcName:t}){const r=e.prevAtomType,n=e.gullet.future().text;return{type:"op",mode:e.mode,limits:!1,parentIsSupSub:!1,symbol:!1,stack:!1,isFollowedByDelimiter:Qe(n),needsLeadingSpace:r.length>0&&Jt.includes(r),name:t}},mathmlBuilder:er}),c({type:"op",names:["\\det","\\gcd","\\inf","\\lim","\\max","\\min","\\Pr","\\sup"],props:{numArgs:0},handler({parser:e,funcName:t}){const r=e.prevAtomType,n=e.gullet.future().text;return{type:"op",mode:e.mode,limits:!0,parentIsSupSub:!1,symbol:!1,stack:!1,isFollowedByDelimiter:Qe(n),needsLeadingSpace:r.length>0&&Jt.includes(r),name:t}},mathmlBuilder:er}),c({type:"op",names:["\\int","\\iint","\\iiint","\\iiiint","\\oint","\\oiint","\\oiiint","\\intclockwise","\\varointclockwise","\\intbar","\\intBar","\\fint","\\rppolint","\\scpolint","\\pointint","\\sqint","\\intlarhk","\\intx","\\intcap","\\intcup","∫","∬","∭","∮","∯","∰","∱","∲","⨌","⨍","⨎","⨏","⨒","⨓","⨕","⨖","⨗","⨘","⨙","⨚"],props:{numArgs:0},handler({parser:e,funcName:t}){let r=t;return 1===r.length&&(r=rr[r]),{type:"op",mode:e.mode,limits:!1,parentIsSupSub:!1,symbol:!0,stack:!1,name:r}},mathmlBuilder:er});c({type:"operatorname",names:["\\operatorname@","\\operatornamewithlimits"],props:{numArgs:1,allowedInArgument:!0},handler:({parser:e,funcName:t},r)=>{const n=r[0],o=e.prevAtomType,s=e.gullet.future().text;return{type:"operatorname",mode:e.mode,body:d(n),alwaysHandleSupSub:"\\operatornamewithlimits"===t,limits:!1,parentIsSupSub:!1,isFollowedByDelimiter:Qe(s),needsLeadingSpace:o.length>0&&Jt.includes(o)}},mathmlBuilder:(e,t)=>{let r,n=ie(e.body,t.withFont("mathrm")),o=!0;for(let e=0;e<n.length;e++){let t=n[e];if(t instanceof T.MathNode)switch("mrow"===t.type&&1===t.children.length&&t.children[0]instanceof T.MathNode&&(t=t.children[0]),t.type){case"mi":case"mn":case"ms":case"mtext":break;case"mspace":if(t.attributes.width){const r=t.attributes.width.replace("em",""),s=Rt(Number(r));""===s?o=!1:n[e]=new T.MathNode("mtext",[new T.TextNode(s)])}break;case"mo":{const e=t.children[0];1===t.children.length&&e instanceof T.TextNode?e.text=e.text.replace(/\u2212/,"-").replace(/\u2217/,"*"):o=!1;break}default:o=!1}else o=!1}if(o){const e=n.map((e=>e.toText())).join("");n=[new T.TextNode(e)]}else if(1===n.length&&["mover","munder"].includes(n[0].type)&&("mi"===n[0].children[0].type||"mtext"===n[0].children[0].type)){if(n[0].children[0].type="mi",e.parentIsSupSub)return new T.MathNode("mrow",n);{const e=new T.MathNode("mo",[te("⁡","text")]);return T.newDocumentFragment([n[0],e])}}if(o?(r=new T.MathNode("mi",n),1===n[0].text.length&&r.setAttribute("mathvariant","normal")):r=new T.MathNode("mrow",n),!e.parentIsSupSub){const t=[r,new T.MathNode("mo",[te("⁡","text")])];if(e.needsLeadingSpace){const e=new T.MathNode("mspace");e.setAttribute("width","0.1667em"),t.unshift(e)}if(!e.isFollowedByDelimiter){const e=new T.MathNode("mspace");e.setAttribute("width","0.1667em"),t.push(e)}return T.newDocumentFragment(t)}return r}}),dt("\\operatorname","\\@ifstar\\operatornamewithlimits\\operatorname@"),m({type:"ordgroup",mathmlBuilder:(e,t)=>ce(e.body,t,e.semisimple)}),c({type:"phantom",names:["\\phantom"],props:{numArgs:1,allowedInText:!0},handler:({parser:e},t)=>{const r=t[0];return{type:"phantom",mode:e.mode,body:d(r)}},mathmlBuilder:(e,t)=>{const r=ie(e.body,t);return new T.MathNode("mphantom",r)}}),c({type:"hphantom",names:["\\hphantom"],props:{numArgs:1,allowedInText:!0},handler:({parser:e},t)=>{const r=t[0];return{type:"hphantom",mode:e.mode,body:r}},mathmlBuilder:(e,t)=>{const r=ie(d(e.body),t),n=new T.MathNode("mphantom",r),o=new T.MathNode("mpadded",[n]);return o.setAttribute("height","0px"),o.setAttribute("depth","0px"),o}}),c({type:"vphantom",names:["\\vphantom"],props:{numArgs:1,allowedInText:!0},handler:({parser:e},t)=>{const r=t[0];return{type:"vphantom",mode:e.mode,body:r}},mathmlBuilder:(e,t)=>{const r=ie(d(e.body),t),n=new T.MathNode("mphantom",r),o=new T.MathNode("mpadded",[n]);return o.setAttribute("width","0px"),o}}),c({type:"pmb",names:["\\pmb"],props:{numArgs:1,allowedInText:!0},handler:({parser:e},t)=>({type:"pmb",mode:e.mode,body:d(t[0])}),mathmlBuilder(e,t){const r=ie(e.body,t),n=N(r);return n.setAttribute("style","font-weight:bold"),n}});const nr=(e,t)=>{const r=t.withLevel(it),n=new T.MathNode("mpadded",[me(e.body,r)]),o=Te(e.dy,t);return n.setAttribute("voffset",o.number+o.unit),o.number>0?n.style.padding=o.number+o.unit+" 0 0 0":n.style.padding="0 0 "+Math.abs(o.number)+o.unit+" 0",n};c({type:"raise",names:["\\raise","\\lower"],props:{numArgs:2,argTypes:["size","primitive"],primitive:!0},handler({parser:e,funcName:t},r){const n=Ce(r[0],"size").value;"\\lower"===t&&(n.number*=-1);const o=r[1];return{type:"raise",mode:e.mode,dy:n,body:o}},mathmlBuilder:nr}),c({type:"raise",names:["\\raisebox"],props:{numArgs:2,argTypes:["size","hbox"],allowedInText:!0},handler({parser:e,funcName:t},r){const n=Ce(r[0],"size").value,o=r[1];return{type:"raise",mode:e.mode,dy:n,body:o}},mathmlBuilder:nr}),c({type:"ref",names:["\\ref","\\eqref"],props:{numArgs:1,argTypes:["raw"]},handler:({parser:e,funcName:t},r)=>({type:"ref",mode:e.mode,funcName:t,string:r[0].string.replace(Ut,"")}),mathmlBuilder(e,t){const r="\\ref"===e.funcName?["tml-ref"]:["tml-ref","tml-eqref"];return new x("#"+e.string,r,null)}}),c({type:"reflect",names:["\\reflectbox"],props:{numArgs:1,argTypes:["hbox"],allowedInText:!0},handler:({parser:e},t)=>({type:"reflect",mode:e.mode,body:t[0]}),mathmlBuilder(e,t){const r=me(e.body,t);return r.style.transform="scaleX(-1)",r}}),c({type:"internal",names:["\\relax"],props:{numArgs:0,allowedInText:!0},handler:({parser:e})=>({type:"internal",mode:e.mode})}),c({type:"rule",names:["\\rule"],props:{numArgs:2,numOptionalArgs:1,allowedInText:!0,allowedInMath:!0,argTypes:["size","size","size"]},handler({parser:e},t,r){const n=r[0],o=Ce(t[0],"size"),s=Ce(t[1],"size");return{type:"rule",mode:e.mode,shift:n&&Ce(n,"size").value,width:o.value,height:s.value}},mathmlBuilder(e,t){const r=Te(e.width,t),n=Te(e.height,t),o=e.shift?Te(e.shift,t):{number:0,unit:"em"},s=t.color&&t.getColor()||"black",a=new T.MathNode("mspace");if(r.number>0&&n.number>0&&a.setAttribute("mathbackground",s),a.setAttribute("width",r.number+r.unit),a.setAttribute("height",n.number+n.unit),0===o.number)return a;const l=new T.MathNode("mpadded",[a]);return o.number>=0?l.setAttribute("height","+"+o.number+o.unit):(l.setAttribute("height",o.number+o.unit),l.setAttribute("depth","+"+-o.number+o.unit)),l.setAttribute("voffset",o.number+o.unit),l}});const or={"\\tiny":.5,"\\sixptsize":.6,"\\Tiny":.6,"\\scriptsize":.7,"\\footnotesize":.8,"\\small":.9,"\\normalsize":1,"\\large":1.2,"\\Large":1.44,"\\LARGE":1.728,"\\huge":2.074,"\\Huge":2.488};c({type:"sizing",names:["\\tiny","\\sixptsize","\\Tiny","\\scriptsize","\\footnotesize","\\small","\\normalsize","\\large","\\Large","\\LARGE","\\huge","\\Huge"],props:{numArgs:0,allowedInText:!0},handler:({breakOnTokenText:e,funcName:t,parser:r},n)=>{r.settings.strict&&"math"===r.mode&&console.log(`Temml strict-mode warning: Command ${t} is invalid in math mode.`);const o=r.parseExpression(!1,e,!0);return{type:"sizing",mode:r.mode,funcName:t,body:o}},mathmlBuilder:(e,t)=>{const r=t.withFontSize(or[e.funcName]),n=ie(e.body,r),o=N(n),s=(or[e.funcName]/t.fontSize).toFixed(4);return o.setAttribute("mathsize",s+"em"),o}}),c({type:"smash",names:["\\smash"],props:{numArgs:1,numOptionalArgs:1,allowedInText:!0},handler:({parser:e},t,r)=>{let n=!1,o=!1;const s=r[0]&&Ce(r[0],"ordgroup");if(s){let e="";for(let t=0;t<s.body.length;++t){if(e=s.body[t].text,"t"===e)n=!0;else{if("b"!==e){n=!1,o=!1;break}o=!0}}}else n=!0,o=!0;const a=t[0];return{type:"smash",mode:e.mode,body:a,smashHeight:n,smashDepth:o}},mathmlBuilder:(e,t)=>{const r=new T.MathNode("mpadded",[me(e.body,t)]);return e.smashHeight&&r.setAttribute("height","0px"),e.smashDepth&&r.setAttribute("depth","0px"),r}}),c({type:"sqrt",names:["\\sqrt"],props:{numArgs:1,numOptionalArgs:1},handler({parser:e},t,r){const n=r[0],o=t[0];return{type:"sqrt",mode:e.mode,body:o,index:n}},mathmlBuilder(e,t){const{body:r,index:n}=e;return n?new T.MathNode("mroot",[me(r,t),me(n,t.incrementLevel())]):new T.MathNode("msqrt",[me(r,t)])}});const sr={display:0,text:1,script:2,scriptscript:3},ar={display:["0","true"],text:["0","false"],script:["1","false"],scriptscript:["2","false"]};c({type:"styling",names:["\\displaystyle","\\textstyle","\\scriptstyle","\\scriptscriptstyle"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler({breakOnTokenText:e,funcName:t,parser:r},n){const o=r.parseExpression(!0,e,!0),s=t.slice(1,t.length-5);return{type:"styling",mode:r.mode,scriptLevel:s,body:o}},mathmlBuilder(e,t){const r=t.withLevel(sr[e.scriptLevel]),n=ie(e.body,r),o=N(n),s=ar[e.scriptLevel];return o.setAttribute("scriptlevel",s[0]),o.setAttribute("displaystyle",s[1]),o}});const lr=/^m(over|under|underover)$/;m({type:"supsub",mathmlBuilder(e,t){let r,n,o=!1,s=!1,a=!1,l=!1;e.base&&"horizBrace"===e.base.type&&(n=!!e.sup,n===e.base.isOver&&(o=!0,r=e.base.isOver)),!e.base||e.base.stack||"op"!==e.base.type&&"operatorname"!==e.base.type||(e.base.parentIsSupSub=!0,s=!e.base.symbol,a=s&&!e.isFollowedByDelimiter,l=e.base.needsLeadingSpace);const i=e.base&&e.base.stack?[me(e.base.body[0],t)]:[me(e.base,t)],c=t.inSubOrSup();if(e.sub){const r=me(e.sub,c);3===t.level&&r.setAttribute("scriptlevel","2"),i.push(r)}if(e.sup){const r=me(e.sup,c);3===t.level&&r.setAttribute("scriptlevel","2");const n="mrow"===r.type?r.children[0]:r;n&&"mo"===n.type&&n.classes.includes("tml-prime")&&e.base&&e.base.text&&"fF".indexOf(e.base.text)>-1&&n.classes.push("prime-pad"),i.push(r)}let m;if(o)m=r?"mover":"munder";else if(e.sub)if(e.sup){const r=e.base;m=r&&("op"===r.type&&r.limits||"multiscript"===r.type)&&(t.level===lt||r.alwaysHandleSupSub)||r&&"operatorname"===r.type&&r.alwaysHandleSupSub&&(t.level===lt||r.limits)?"munderover":"msubsup"}else{const r=e.base;m=r&&"op"===r.type&&r.limits&&(t.level===lt||r.alwaysHandleSupSub)||r&&"operatorname"===r.type&&r.alwaysHandleSupSub&&(r.limits||t.level===lt)?"munder":"msub"}else{const r=e.base;m=r&&"op"===r.type&&r.limits&&(t.level===lt||r.alwaysHandleSupSub)||r&&"operatorname"===r.type&&r.alwaysHandleSupSub&&(r.limits||t.level===lt)?"mover":"msup"}let u=new T.MathNode(m,i);if(s){const e=new T.MathNode("mo",[te("⁡","text")]);if(l){const t=new T.MathNode("mspace");t.setAttribute("width","0.1667em"),u=T.newDocumentFragment([t,u,e])}else u=T.newDocumentFragment([u,e]);if(a){const e=new T.MathNode("mspace");e.setAttribute("width","0.1667em"),u.children.push(e)}}else lr.test(m)&&(u=new T.MathNode("mrow",[u]));return u}});const ir=["\\shortmid","\\nshortmid","\\shortparallel","\\nshortparallel","\\smallsetminus"],cr=["\\Rsh","\\Lsh","\\restriction"];m({type:"atom",mathmlBuilder(e,t){const r=new T.MathNode("mo",[te(e.text,e.mode)]);return"punct"===e.family?r.setAttribute("separator","true"):"open"===e.family||"close"===e.family?"open"===e.family?(r.setAttribute("form","prefix"),r.setAttribute("stretchy","false")):"close"===e.family&&(r.setAttribute("form","postfix"),r.setAttribute("stretchy","false")):"\\mid"===e.text?(r.setAttribute("lspace","0.22em"),r.setAttribute("rspace","0.22em"),r.setAttribute("stretchy","false")):"rel"===e.family&&(e=>{if(1===e.length){const t=e.codePointAt(0);return 8591<t&&t<8704}return e.indexOf("arrow")>-1||e.indexOf("harpoon")>-1||cr.includes(e)})(e.text)?r.setAttribute("stretchy","false"):ir.includes(e.text)?r.setAttribute("mathsize","70%"):":"===e.text&&(r.attributes.lspace="0.2222em",r.attributes.rspace="0.2222em"),r}});const mr={mathbf:"bold",mathrm:"normal",textit:"italic",mathit:"italic",mathnormal:"italic",mathbb:"double-struck",mathcal:"script",mathfrak:"fraktur",mathscr:"script",mathsf:"sans-serif",mathtt:"monospace"},ur=function(e,t){if("texttt"===t.fontFamily)return"monospace";if("textsc"===t.fontFamily)return"normal";if("textsf"===t.fontFamily)return"textit"===t.fontShape&&"textbf"===t.fontWeight?"sans-serif-bold-italic":"textit"===t.fontShape?"sans-serif-italic":"textbf"===t.fontWeight?"sans-serif-bold":"sans-serif";if("textit"===t.fontShape&&"textbf"===t.fontWeight)return"bold-italic";if("textit"===t.fontShape)return"italic";if("textbf"===t.fontWeight)return"bold";const r=t.font;if(!r||"mathnormal"===r)return null;const n=e.mode;switch(r){case"mathit":case"greekItalic":return"italic";case"mathrm":{const t=e.text.codePointAt(0);return 939<t&&t<975?"italic":"normal"}case"up@greek":return"normal";case"boldsymbol":case"mathboldsymbol":return"bold-italic";case"mathbf":return"bold";case"mathbb":return"double-struck";case"mathfrak":return"fraktur";case"mathscr":case"mathcal":return"script";case"mathsf":return"sans-serif";case"mathsfit":return"sans-serif-italic";case"mathtt":return"monospace"}let o=e.text;return I[n][o]&&I[n][o].replace&&(o=I[n][o].replace),Object.prototype.hasOwnProperty.call(mr,r)?mr[r]:null},dr=Object.freeze({B:8426,E:8427,F:8427,H:8387,I:8391,L:8390,M:8422,R:8393,e:8394,g:8355,o:8389}),pr=Object.freeze({C:8426,H:8388,I:8392,R:8394,Z:8398}),hr=Object.freeze({C:8383,H:8389,N:8391,P:8393,Q:8393,R:8395,Z:8394}),gr=Object.freeze({"ϵ":119527,"ϑ":119564,"ϰ":119534,"φ":119577,"ϱ":119535,"ϖ":119563}),fr=Object.freeze({"ϵ":119643,"ϑ":119680,"ϰ":119650,"φ":119693,"ϱ":119651,"ϖ":119679}),br=Object.freeze({"ϵ":119701,"ϑ":119738,"ϰ":119708,"φ":119751,"ϱ":119709,"ϖ":119737}),yr=Object.freeze({"ϵ":119759,"ϑ":119796,"ϰ":119766,"φ":119809,"ϱ":119767,"ϖ":119795}),wr=Object.freeze({upperCaseLatin:{normal:e=>0,bold:e=>119743,italic:e=>119795,"bold-italic":e=>119847,script:e=>dr[e]||119899,"script-bold":e=>119951,fraktur:e=>pr[e]||120003,"fraktur-bold":e=>120107,"double-struck":e=>hr[e]||120055,"sans-serif":e=>120159,"sans-serif-bold":e=>120211,"sans-serif-italic":e=>120263,"sans-serif-bold-italic":e=>120380,monospace:e=>120367},lowerCaseLatin:{normal:e=>0,bold:e=>119737,italic:e=>"h"===e?8358:119789,"bold-italic":e=>119841,script:e=>dr[e]||119893,"script-bold":e=>119945,fraktur:e=>119997,"fraktur-bold":e=>120101,"double-struck":e=>120049,"sans-serif":e=>120153,"sans-serif-bold":e=>120205,"sans-serif-italic":e=>120257,"sans-serif-bold-italic":e=>120309,monospace:e=>120361},upperCaseGreek:{normal:e=>0,bold:e=>119575,italic:e=>119633,"bold-italic":e=>119575,script:e=>0,"script-bold":e=>0,fraktur:e=>0,"fraktur-bold":e=>0,"double-struck":e=>0,"sans-serif":e=>119749,"sans-serif-bold":e=>119749,"sans-serif-italic":e=>0,"sans-serif-bold-italic":e=>119807,monospace:e=>0},lowerCaseGreek:{normal:e=>0,bold:e=>119569,italic:e=>119627,"bold-italic":e=>"ϕ"===e?119678:119685,script:e=>0,"script-bold":e=>0,fraktur:e=>0,"fraktur-bold":e=>0,"double-struck":e=>0,"sans-serif":e=>119743,"sans-serif-bold":e=>119743,"sans-serif-italic":e=>0,"sans-serif-bold-italic":e=>119801,monospace:e=>0},varGreek:{normal:e=>0,bold:e=>gr[e]||-51,italic:e=>0,"bold-italic":e=>fr[e]||58,script:e=>0,"script-bold":e=>0,fraktur:e=>0,"fraktur-bold":e=>0,"double-struck":e=>0,"sans-serif":e=>br[e]||116,"sans-serif-bold":e=>br[e]||116,"sans-serif-italic":e=>0,"sans-serif-bold-italic":e=>yr[e]||174,monospace:e=>0},numeral:{normal:e=>0,bold:e=>120734,italic:e=>0,"bold-italic":e=>0,script:e=>0,"script-bold":e=>0,fraktur:e=>0,"fraktur-bold":e=>0,"double-struck":e=>120744,"sans-serif":e=>120754,"sans-serif-bold":e=>120764,"sans-serif-italic":e=>0,"sans-serif-bold-italic":e=>0,monospace:e=>120774}}),xr=(e,t)=>{const r=e.codePointAt(0),n=64<r&&r<91?"upperCaseLatin":96<r&&r<123?"lowerCaseLatin":912<r&&r<938?"upperCaseGreek":944<r&&r<970||"ϕ"===e?"lowerCaseGreek":120545<r&&r<120572||gr[e]?"varGreek":47<r&&r<58?"numeral":"other";return"other"===n?e:String.fromCodePoint(r+wr[n][t](e))},kr=Object.freeze({a:"ᴀ",b:"ʙ",c:"ᴄ",d:"ᴅ",e:"ᴇ",f:"ꜰ",g:"ɢ",h:"ʜ",i:"ɪ",j:"ᴊ",k:"ᴋ",l:"ʟ",m:"ᴍ",n:"ɴ",o:"ᴏ",p:"ᴘ",q:"ǫ",r:"ʀ",s:"s",t:"ᴛ",u:"ᴜ",v:"ᴠ",w:"ᴡ",x:"x",y:"ʏ",z:"ᴢ"}),vr=/^\d(?:[\d,.]*\d)?$/,Ar=/[A-Ba-z]/,Nr=new Set(["\\prime","\\dprime","\\trprime","\\qprime","\\backprime","\\backdprime","\\backtrprime"]);m({type:"mathord",mathmlBuilder(e,t){const r=te(e.text,e.mode,t),n=r.text.codePointAt(0),o=912<n&&n<938?"normal":"italic",s=ur(e,t)||o;if("script"===s)return r.text=xr(r.text,s),new T.MathNode("mi",[r],[t.font]);"italic"!==s&&(r.text=xr(r.text,s));let a=new T.MathNode("mi",[r]);return"normal"===s&&(a.setAttribute("mathvariant","normal"),1===r.text.length&&(a=new T.MathNode("mrow",[a]))),a}}),m({type:"textord",mathmlBuilder(e,t){let r=e.text;const n=r.codePointAt(0);"textsc"===t.fontFamily&&96<n&&n<123&&(r=kr[r]);const o=te(r,e.mode,t),s=ur(e,t)||"normal";let a;if(vr.test(e.text)){const t="text"===e.mode?"mtext":"mn";if("italic"===s||"bold-italic"===s)return((e,t,r)=>{const n=new T.MathNode(r,[e]),o=new T.MathNode("mstyle",[n]);return o.style["font-style"]="italic",o.style["font-family"]="Cambria, 'Times New Roman', serif","bold-italic"===t&&(o.style["font-weight"]="bold"),o})(o,s,t);"normal"!==s&&(o.text=o.text.split("").map((e=>xr(e,s))).join("")),a=new T.MathNode(t,[o])}else if("text"===e.mode)"normal"!==s&&(o.text=xr(o.text,s)),a=new T.MathNode("mtext",[o]);else if(Nr.has(e.text))a=new T.MathNode("mo",[o]),a.classes.push("tml-prime");else{const e=o.text;"italic"!==s&&(o.text=xr(o.text,s)),a=new T.MathNode("mi",[o]),o.text===e&&Ar.test(e)&&a.setAttribute("mathvariant","italic")}return a}});const Tr={"\\nobreak":"nobreak","\\allowbreak":"allowbreak"},Sr={" ":{},"\\ ":{},"~":{className:"nobreak"},"\\space":{},"\\nobreakspace":{className:"nobreak"}};m({type:"spacing",mathmlBuilder(t,r){let n;if(Object.prototype.hasOwnProperty.call(Sr,t.text))n=new T.MathNode("mtext",[new T.TextNode(" ")]);else{if(!Object.prototype.hasOwnProperty.call(Tr,t.text))throw new e(`Unknown type of space "${t.text}"`);n=new T.MathNode("mo"),"\\nobreak"===t.text&&n.setAttribute("linebreak","nobreak")}return n}}),m({type:"tag"});const qr={"\\text":void 0,"\\textrm":"textrm","\\textsf":"textsf","\\texttt":"texttt","\\textnormal":"textrm","\\textsc":"textsc"},Or={"\\textbf":"textbf","\\textmd":"textmd"},Mr={"\\textit":"textit","\\textup":"textup"};c({type:"text",names:["\\text","\\textrm","\\textsf","\\texttt","\\textnormal","\\textsc","\\textbf","\\textmd","\\textit","\\textup","\\emph"],props:{numArgs:1,argTypes:["text"],allowedInArgument:!0,allowedInText:!0},handler({parser:e,funcName:t},r){const n=r[0];return{type:"text",mode:e.mode,body:d(n),font:t}},mathmlBuilder(e,t){const r=((e,t)=>{const r=e.font;return r?qr[r]?t.withTextFontFamily(qr[r]):Or[r]?t.withTextFontWeight(Or[r]):"\\emph"===r?"textit"===t.fontShape?t.withTextFontShape("textup"):t.withTextFontShape("textit"):t.withTextFontShape(Mr[r]):t})(e,t),n=ce(e.body,r);return ne(n)}}),c({type:"vcenter",names:["\\vcenter"],props:{numArgs:1,argTypes:["original"],allowedInText:!1},handler:({parser:e},t)=>({type:"vcenter",mode:e.mode,body:t[0]}),mathmlBuilder(e,t){const r=new T.MathNode("mtd",[me(e.body,t)]);r.style.padding="0";const n=new T.MathNode("mtr",[r]);return new T.MathNode("mtable",[n])}}),c({type:"verb",names:["\\verb"],props:{numArgs:0,allowedInText:!0},handler(t,r,n){throw new e("\\verb ended by end of line instead of matching delimiter")},mathmlBuilder(e,t){const r=new T.TextNode(Br(e)),n=new T.MathNode("mtext",[r]);return n.setAttribute("mathvariant","monospace"),n}});const Br=e=>e.body.replace(/ /g,e.star?"␣":" "),Cr=l;class zr{constructor(e,t,r){this.lexer=e,this.start=t,this.end=r}static range(e,t){return t?e&&e.loc&&t.loc&&e.loc.lexer===t.loc.lexer?new zr(e.loc.lexer,e.loc.start,t.loc.end):null:e&&e.loc}}class Er{constructor(e,t){this.text=e,this.loc=t}range(e,t){return new Er(t,zr.range(this,e))}}const Ir="[ \r\n\t]",$r=`(\\\\[a-zA-Z@]+)${Ir}*`,Lr="[̀-ͯ]",Fr=new RegExp(`${Lr}+$`),Gr=`(${Ir}+)|\\\\(\n|[ \r\t]+\n?)[ \r\t]*|([!-\\[\\]-‧‪-퟿豈-￿]${Lr}*|[\ud800-\udbff][\udc00-\udfff]${Lr}*|\\\\verb\\*([^]).*?\\4|\\\\verb([^*a-zA-Z]).*?\\5|${$r}|\\\\[^\ud800-\udfff])`;class Dr{constructor(e,t){this.input=e,this.settings=t,this.tokenRegex=new RegExp(Gr,"g"),this.catcodes={"%":14,"~":13}}setCatcode(e,t){this.catcodes[e]=t}lex(){const t=this.input,r=this.tokenRegex.lastIndex;if(r===t.length)return new Er("EOF",new zr(this,r,r));const n=this.tokenRegex.exec(t);if(null===n||n.index!==r)throw new e(`Unexpected character: '${t[r]}'`,new Er(t[r],new zr(this,r,r+1)));const o=n[6]||n[3]||(n[2]?"\\ ":" ");if(14===this.catcodes[o]){const r=t.indexOf("\n",this.tokenRegex.lastIndex);if(-1===r){if(this.tokenRegex.lastIndex=t.length,this.settings.strict)throw new e("% comment has no terminating newline; LaTeX would fail because of commenting the end of math mode")}else this.tokenRegex.lastIndex=r+1;return this.lex()}return new Er(o,new zr(this,r,this.tokenRegex.lastIndex))}}class jr{constructor(e={},t={}){this.current=t,this.builtins=e,this.undefStack=[]}beginGroup(){this.undefStack.push({})}endGroup(){if(0===this.undefStack.length)throw new e("Unbalanced namespace destruction: attempt to pop global namespace; please report this as a bug");const t=this.undefStack.pop();for(const e in t)Object.prototype.hasOwnProperty.call(t,e)&&(void 0===t[e]?delete this.current[e]:this.current[e]=t[e])}has(e){return Object.prototype.hasOwnProperty.call(this.current,e)||Object.prototype.hasOwnProperty.call(this.builtins,e)}get(e){return Object.prototype.hasOwnProperty.call(this.current,e)?this.current[e]:this.builtins[e]}set(e,t,r=!1){if(r){for(let t=0;t<this.undefStack.length;t++)delete this.undefStack[t][e];this.undefStack.length>0&&(this.undefStack[this.undefStack.length-1][e]=t)}else{const t=this.undefStack[this.undefStack.length-1];t&&!Object.prototype.hasOwnProperty.call(t,e)&&(t[e]=this.current[e])}this.current[e]=t}}const Pr={"^":!0,_:!0,"\\limits":!0,"\\nolimits":!0};class Rr{constructor(e,t,r){this.settings=t,this.expansionCount=0,this.feed(e),this.macros=new jr(pt,t.macros),this.mode=r,this.stack=[]}feed(e){this.lexer=new Dr(e,this.settings)}switchMode(e){this.mode=e}beginGroup(){this.macros.beginGroup()}endGroup(){this.macros.endGroup()}future(){return 0===this.stack.length&&this.pushToken(this.lexer.lex()),this.stack[this.stack.length-1]}popToken(){return this.future(),this.stack.pop()}pushToken(e){this.stack.push(e)}pushTokens(e){this.stack.push(...e)}scanArgument(e){let t,r,n;if(e){if(this.consumeSpaces(),"["!==this.future().text)return null;t=this.popToken(),({tokens:n,end:r}=this.consumeArg(["]"]))}else({tokens:n,start:t,end:r}=this.consumeArg());return this.pushToken(new Er("EOF",r.loc)),this.pushTokens(n),t.range(r,"")}consumeSpaces(){for(;;){if(" "!==this.future().text)break;this.stack.pop()}}consumeArg(t){const r=[],n=t&&t.length>0;n||this.consumeSpaces();const o=this.future();let s,a=0,l=0;do{if(s=this.popToken(),r.push(s),"{"===s.text)++a;else if("}"===s.text){if(--a,-1===a)throw new e("Extra }",s)}else if("EOF"===s.text)throw new e("Unexpected end of input in a macro argument, expected '"+(t&&n?t[l]:"}")+"'",s);if(t&&n)if((0===a||1===a&&"{"===t[l])&&s.text===t[l]){if(++l,l===t.length){r.splice(-l,l);break}}else l=0}while(0!==a||n);return"{"===o.text&&"}"===r[r.length-1].text&&(r.pop(),r.shift()),r.reverse(),{tokens:r,start:o,end:s}}consumeArgs(t,r){if(r){if(r.length!==t+1)throw new e("The length of delimiters doesn't match the number of args!");const n=r[0];for(let t=0;t<n.length;t++){const r=this.popToken();if(n[t]!==r.text)throw new e("Use of the macro doesn't match its definition",r)}}const n=[];for(let e=0;e<t;e++)n.push(this.consumeArg(r&&r[e+1]).tokens);return n}expandOnce(t){const r=this.popToken(),n=r.text,o=r.noexpand?null:this._getExpansion(n);if(null==o||t&&o.unexpandable){if(t&&null==o&&"\\"===n[0]&&!this.isDefined(n))throw new e("Undefined control sequence: "+n);return this.pushToken(r),!1}if(this.expansionCount++,this.expansionCount>this.settings.maxExpand)throw new e("Too many expansions: infinite loop or need to increase maxExpand setting");let s=o.tokens;const a=this.consumeArgs(o.numArgs,o.delimiters);if(o.numArgs){s=s.slice();for(let t=s.length-1;t>=0;--t){let r=s[t];if("#"===r.text){if(0===t)throw new e("Incomplete placeholder at end of macro body",r);if(r=s[--t],"#"===r.text)s.splice(t+1,1);else{if(!/^[1-9]$/.test(r.text))throw new e("Not a valid argument number",r);s.splice(t,2,...a[+r.text-1])}}}}return this.pushTokens(s),s.length}expandAfterFuture(){return this.expandOnce(),this.future()}expandNextToken(){for(;;)if(!1===this.expandOnce()){const e=this.stack.pop();return e.treatAsRelax&&(e.text="\\relax"),e}throw new Error}expandMacro(e){return this.macros.has(e)?this.expandTokens([new Er(e)]):void 0}expandTokens(e){const t=[],r=this.stack.length;for(this.pushTokens(e);this.stack.length>r;)if(!1===this.expandOnce(!0)){const e=this.stack.pop();e.treatAsRelax&&(e.noexpand=!1,e.treatAsRelax=!1),t.push(e)}return t}expandMacroAsText(e){const t=this.expandMacro(e);return t?t.map((e=>e.text)).join(""):t}_getExpansion(e){const t=this.macros.get(e);if(null==t)return t;if(1===e.length){const t=this.lexer.catcodes[e];if(null!=t&&13!==t)return}const r="function"==typeof t?t(this):t;if("string"==typeof r){let e=0;if(-1!==r.indexOf("#")){const t=r.replace(/##/g,"");for(;-1!==t.indexOf("#"+(e+1));)++e}const t=new Dr(r,this.settings),n=[];let o=t.lex();for(;"EOF"!==o.text;)n.push(o),o=t.lex();n.reverse();return{tokens:n,numArgs:e}}return r}isDefined(e){return this.macros.has(e)||Object.prototype.hasOwnProperty.call(Cr,e)||Object.prototype.hasOwnProperty.call(I.math,e)||Object.prototype.hasOwnProperty.call(I.text,e)||Object.prototype.hasOwnProperty.call(Pr,e)}isExpandable(e){const t=this.macros.get(e);return null!=t?"string"==typeof t||"function"==typeof t||!t.unexpandable:Object.prototype.hasOwnProperty.call(Cr,e)&&!Cr[e].primitive}}const Ur=/^[₊₋₌₍₎₀₁₂₃₄₅₆₇₈₉ₐₑₕᵢⱼₖₗₘₙₒₚᵣₛₜᵤᵥₓᵦᵧᵨᵩᵪ]/,Hr=Object.freeze({"₊":"+","₋":"-","₌":"=","₍":"(","₎":")","₀":"0","₁":"1","₂":"2","₃":"3","₄":"4","₅":"5","₆":"6","₇":"7","₈":"8","₉":"9","ₐ":"a","ₑ":"e","ₕ":"h","ᵢ":"i","ⱼ":"j","ₖ":"k","ₗ":"l","ₘ":"m","ₙ":"n","ₒ":"o","ₚ":"p","ᵣ":"r","ₛ":"s","ₜ":"t","ᵤ":"u","ᵥ":"v","ₓ":"x","ᵦ":"β","ᵧ":"γ","ᵨ":"ρ","ᵩ":"ϕ","ᵪ":"χ","⁺":"+","⁻":"-","⁼":"=","⁽":"(","⁾":")","⁰":"0","¹":"1","²":"2","³":"3","⁴":"4","⁵":"5","⁶":"6","⁷":"7","⁸":"8","⁹":"9","ᴬ":"A","ᴮ":"B","ᴰ":"D","ᴱ":"E","ᴳ":"G","ᴴ":"H","ᴵ":"I","ᴶ":"J","ᴷ":"K","ᴸ":"L","ᴹ":"M","ᴺ":"N","ᴼ":"O","ᴾ":"P","ᴿ":"R","ᵀ":"T","ᵁ":"U","ⱽ":"V","ᵂ":"W","ᵃ":"a","ᵇ":"b","ᶜ":"c","ᵈ":"d","ᵉ":"e","ᶠ":"f","ᵍ":"g","ʰ":"h","ⁱ":"i","ʲ":"j","ᵏ":"k","ˡ":"l","ᵐ":"m","ⁿ":"n","ᵒ":"o","ᵖ":"p","ʳ":"r","ˢ":"s","ᵗ":"t","ᵘ":"u","ᵛ":"v","ʷ":"w","ˣ":"x","ʸ":"y","ᶻ":"z","ᵝ":"β","ᵞ":"γ","ᵟ":"δ","ᵠ":"ϕ","ᵡ":"χ","ᶿ":"θ"}),Vr=Object.freeze({"𝒜":"A","ℬ":"B","𝒞":"C","𝒟":"D","ℰ":"E","ℱ":"F","𝒢":"G","ℋ":"H","ℐ":"I","𝒥":"J","𝒦":"K","ℒ":"L","ℳ":"M","𝒩":"N","𝒪":"O","𝒫":"P","𝒬":"Q","ℛ":"R","𝒮":"S","𝒯":"T","𝒰":"U","𝒱":"V","𝒲":"W","𝒳":"X","𝒴":"Y","𝒵":"Z"});var _r={"́":{text:"\\'",math:"\\acute"},"̀":{text:"\\`",math:"\\grave"},"̈":{text:'\\"',math:"\\ddot"},"̃":{text:"\\~",math:"\\tilde"},"̄":{text:"\\=",math:"\\bar"},"̆":{text:"\\u",math:"\\breve"},"̌":{text:"\\v",math:"\\check"},"̂":{text:"\\^",math:"\\hat"},"̇":{text:"\\.",math:"\\dot"},"̊":{text:"\\r",math:"\\mathring"},"̋":{text:"\\H"},"̧":{text:"\\c"}},Wr={"á":"á","à":"à","ä":"ä","ǟ":"ǟ","ã":"ã","ā":"ā","ă":"ă","ắ":"ắ","ằ":"ằ","ẵ":"ẵ","ǎ":"ǎ","â":"â","ấ":"ấ","ầ":"ầ","ẫ":"ẫ","ȧ":"ȧ","ǡ":"ǡ","å":"å","ǻ":"ǻ","ḃ":"ḃ","ć":"ć","č":"č","ĉ":"ĉ","ċ":"ċ","ď":"ď","ḋ":"ḋ","é":"é","è":"è","ë":"ë","ẽ":"ẽ","ē":"ē","ḗ":"ḗ","ḕ":"ḕ","ĕ":"ĕ","ě":"ě","ê":"ê","ế":"ế","ề":"ề","ễ":"ễ","ė":"ė","ḟ":"ḟ","ǵ":"ǵ","ḡ":"ḡ","ğ":"ğ","ǧ":"ǧ","ĝ":"ĝ","ġ":"ġ","ḧ":"ḧ","ȟ":"ȟ","ĥ":"ĥ","ḣ":"ḣ","í":"í","ì":"ì","ï":"ï","ḯ":"ḯ","ĩ":"ĩ","ī":"ī","ĭ":"ĭ","ǐ":"ǐ","î":"î","ǰ":"ǰ","ĵ":"ĵ","ḱ":"ḱ","ǩ":"ǩ","ĺ":"ĺ","ľ":"ľ","ḿ":"ḿ","ṁ":"ṁ","ń":"ń","ǹ":"ǹ","ñ":"ñ","ň":"ň","ṅ":"ṅ","ó":"ó","ò":"ò","ö":"ö","ȫ":"ȫ","õ":"õ","ṍ":"ṍ","ṏ":"ṏ","ȭ":"ȭ","ō":"ō","ṓ":"ṓ","ṑ":"ṑ","ŏ":"ŏ","ǒ":"ǒ","ô":"ô","ố":"ố","ồ":"ồ","ỗ":"ỗ","ȯ":"ȯ","ȱ":"ȱ","ő":"ő","ṕ":"ṕ","ṗ":"ṗ","ŕ":"ŕ","ř":"ř","ṙ":"ṙ","ś":"ś","ṥ":"ṥ","š":"š","ṧ":"ṧ","ŝ":"ŝ","ṡ":"ṡ","ẗ":"ẗ","ť":"ť","ṫ":"ṫ","ú":"ú","ù":"ù","ü":"ü","ǘ":"ǘ","ǜ":"ǜ","ǖ":"ǖ","ǚ":"ǚ","ũ":"ũ","ṹ":"ṹ","ū":"ū","ṻ":"ṻ","ŭ":"ŭ","ǔ":"ǔ","û":"û","ů":"ů","ű":"ű","ṽ":"ṽ","ẃ":"ẃ","ẁ":"ẁ","ẅ":"ẅ","ŵ":"ŵ","ẇ":"ẇ","ẘ":"ẘ","ẍ":"ẍ","ẋ":"ẋ","ý":"ý","ỳ":"ỳ","ÿ":"ÿ","ỹ":"ỹ","ȳ":"ȳ","ŷ":"ŷ","ẏ":"ẏ","ẙ":"ẙ","ź":"ź","ž":"ž","ẑ":"ẑ","ż":"ż","Á":"Á","À":"À","Ä":"Ä","Ǟ":"Ǟ","Ã":"Ã","Ā":"Ā","Ă":"Ă","Ắ":"Ắ","Ằ":"Ằ","Ẵ":"Ẵ","Ǎ":"Ǎ","Â":"Â","Ấ":"Ấ","Ầ":"Ầ","Ẫ":"Ẫ","Ȧ":"Ȧ","Ǡ":"Ǡ","Å":"Å","Ǻ":"Ǻ","Ḃ":"Ḃ","Ć":"Ć","Č":"Č","Ĉ":"Ĉ","Ċ":"Ċ","Ď":"Ď","Ḋ":"Ḋ","É":"É","È":"È","Ë":"Ë","Ẽ":"Ẽ","Ē":"Ē","Ḗ":"Ḗ","Ḕ":"Ḕ","Ĕ":"Ĕ","Ě":"Ě","Ê":"Ê","Ế":"Ế","Ề":"Ề","Ễ":"Ễ","Ė":"Ė","Ḟ":"Ḟ","Ǵ":"Ǵ","Ḡ":"Ḡ","Ğ":"Ğ","Ǧ":"Ǧ","Ĝ":"Ĝ","Ġ":"Ġ","Ḧ":"Ḧ","Ȟ":"Ȟ","Ĥ":"Ĥ","Ḣ":"Ḣ","Í":"Í","Ì":"Ì","Ï":"Ï","Ḯ":"Ḯ","Ĩ":"Ĩ","Ī":"Ī","Ĭ":"Ĭ","Ǐ":"Ǐ","Î":"Î","İ":"İ","Ĵ":"Ĵ","Ḱ":"Ḱ","Ǩ":"Ǩ","Ĺ":"Ĺ","Ľ":"Ľ","Ḿ":"Ḿ","Ṁ":"Ṁ","Ń":"Ń","Ǹ":"Ǹ","Ñ":"Ñ","Ň":"Ň","Ṅ":"Ṅ","Ó":"Ó","Ò":"Ò","Ö":"Ö","Ȫ":"Ȫ","Õ":"Õ","Ṍ":"Ṍ","Ṏ":"Ṏ","Ȭ":"Ȭ","Ō":"Ō","Ṓ":"Ṓ","Ṑ":"Ṑ","Ŏ":"Ŏ","Ǒ":"Ǒ","Ô":"Ô","Ố":"Ố","Ồ":"Ồ","Ỗ":"Ỗ","Ȯ":"Ȯ","Ȱ":"Ȱ","Ő":"Ő","Ṕ":"Ṕ","Ṗ":"Ṗ","Ŕ":"Ŕ","Ř":"Ř","Ṙ":"Ṙ","Ś":"Ś","Ṥ":"Ṥ","Š":"Š","Ṧ":"Ṧ","Ŝ":"Ŝ","Ṡ":"Ṡ","Ť":"Ť","Ṫ":"Ṫ","Ú":"Ú","Ù":"Ù","Ü":"Ü","Ǘ":"Ǘ","Ǜ":"Ǜ","Ǖ":"Ǖ","Ǚ":"Ǚ","Ũ":"Ũ","Ṹ":"Ṹ","Ū":"Ū","Ṻ":"Ṻ","Ŭ":"Ŭ","Ǔ":"Ǔ","Û":"Û","Ů":"Ů","Ű":"Ű","Ṽ":"Ṽ","Ẃ":"Ẃ","Ẁ":"Ẁ","Ẅ":"Ẅ","Ŵ":"Ŵ","Ẇ":"Ẇ","Ẍ":"Ẍ","Ẋ":"Ẋ","Ý":"Ý","Ỳ":"Ỳ","Ÿ":"Ÿ","Ỹ":"Ỹ","Ȳ":"Ȳ","Ŷ":"Ŷ","Ẏ":"Ẏ","Ź":"Ź","Ž":"Ž","Ẑ":"Ẑ","Ż":"Ż","ά":"ά","ὰ":"ὰ","ᾱ":"ᾱ","ᾰ":"ᾰ","έ":"έ","ὲ":"ὲ","ή":"ή","ὴ":"ὴ","ί":"ί","ὶ":"ὶ","ϊ":"ϊ","ΐ":"ΐ","ῒ":"ῒ","ῑ":"ῑ","ῐ":"ῐ","ό":"ό","ὸ":"ὸ","ύ":"ύ","ὺ":"ὺ","ϋ":"ϋ","ΰ":"ΰ","ῢ":"ῢ","ῡ":"ῡ","ῠ":"ῠ","ώ":"ώ","ὼ":"ὼ","Ύ":"Ύ","Ὺ":"Ὺ","Ϋ":"Ϋ","Ῡ":"Ῡ","Ῠ":"Ῠ","Ώ":"Ώ","Ὼ":"Ὼ"};const Xr=["bin","op","open","punct","rel"],Zr=/([-+]?) *(\d+(?:\.\d*)?|\.\d+) *([a-z]{2})/;class Yr{constructor(e,t,r=!1){this.mode="math",this.gullet=new Rr(e,t,this.mode),this.settings=t,this.isPreamble=r,this.leftrightDepth=0,this.prevAtomType=""}expect(t,r=!0){if(this.fetch().text!==t)throw new e(`Expected '${t}', got '${this.fetch().text}'`,this.fetch());r&&this.consume()}consume(){this.nextToken=null}fetch(){return null==this.nextToken&&(this.nextToken=this.gullet.expandNextToken()),this.nextToken}switchMode(e){this.mode=e,this.gullet.switchMode(e)}parse(){this.gullet.beginGroup(),this.settings.colorIsTextColor&&this.gullet.macros.set("\\color","\\textcolor");const e=this.parseExpression(!1);if(this.expect("EOF"),this.isPreamble){const e=Object.create(null);return Object.entries(this.gullet.macros.current).forEach((([t,r])=>{e[t]=r})),this.gullet.endGroup(),e}const t=this.gullet.macros.get("\\df@tag");return this.gullet.endGroup(),t&&(this.gullet.macros.current["\\df@tag"]=t),e}static get endOfExpression(){return["}","\\endgroup","\\end","\\right","\\endtoggle","&"]}subparse(e){const t=this.nextToken;this.consume(),this.gullet.pushToken(new Er("}")),this.gullet.pushTokens(e);const r=this.parseExpression(!1);return this.expect("}"),this.nextToken=t,r}parseExpression(e,t,r){const n=[];for(this.prevAtomType="";;){"math"===this.mode&&this.consumeSpaces();const o=this.fetch();if(-1!==Yr.endOfExpression.indexOf(o.text))break;if(t&&o.text===t)break;if(r&&"\\middle"===o.text)break;if(e&&Cr[o.text]&&Cr[o.text].infix)break;const s=this.parseAtom(t);if(!s)break;"internal"!==s.type&&(n.push(s),this.prevAtomType="atom"===s.type?s.family:s.type)}return"text"===this.mode&&this.formLigatures(n),this.handleInfixNodes(n)}handleInfixNodes(t){let r,n=-1;for(let o=0;o<t.length;o++)if("infix"===t[o].type){if(-1!==n)throw new e("only one infix operator per group",t[o].token);n=o,r=t[o].replaceWith}if(-1!==n&&r){let e,o;const s=t.slice(0,n),a=t.slice(n+1);let l;return e=1===s.length&&"ordgroup"===s[0].type?s[0]:{type:"ordgroup",mode:this.mode,body:s},o=1===a.length&&"ordgroup"===a[0].type?a[0]:{type:"ordgroup",mode:this.mode,body:a},l="\\\\abovefrac"===r?this.callFunction(r,[e,t[n],o],[]):this.callFunction(r,[e,o],[]),[l]}return t}handleSupSubscript(t){const r=this.fetch(),n=r.text;this.consume(),this.consumeSpaces();const o=this.parseGroup(t);if(!o)throw new e("Expected group after '"+n+"'",r);return o}formatUnsupportedCmd(e){const t=[];for(let r=0;r<e.length;r++)t.push({type:"textord",mode:"text",text:e[r]});const r={type:"text",mode:this.mode,body:t};return{type:"color",mode:this.mode,color:this.settings.errorColor,body:[r]}}parseAtom(t){const r=this.parseGroup("atom",t);if("text"===this.mode)return r;let n,o;for(;;){this.consumeSpaces();const t=this.fetch();if("\\limits"===t.text||"\\nolimits"===t.text){if(r&&"op"===r.type){const e="\\limits"===t.text;r.limits=e,r.alwaysHandleSupSub=!0}else{if(!r||"operatorname"!==r.type)throw new e("Limit controls must follow a math operator",t);r.alwaysHandleSupSub&&(r.limits="\\limits"===t.text)}this.consume()}else if("^"===t.text){if(n)throw new e("Double superscript",t);n=this.handleSupSubscript("superscript")}else if("_"===t.text){if(o)throw new e("Double subscript",t);o=this.handleSupSubscript("subscript")}else if("'"===t.text){if(n)throw new e("Double superscript",t);const r={type:"textord",mode:this.mode,text:"\\prime"},o=[r];for(this.consume();"'"===this.fetch().text;)o.push(r),this.consume();"^"===this.fetch().text&&o.push(this.handleSupSubscript("superscript")),n={type:"ordgroup",mode:this.mode,body:o}}else{if(!Hr[t.text])break;{const e=Ur.test(t.text),r=[];for(r.push(new Er(Hr[t.text])),this.consume();;){const t=this.fetch().text;if(!Hr[t])break;if(Ur.test(t)!==e)break;r.unshift(new Er(Hr[t])),this.consume()}const s=this.subparse(r);e?o={type:"ordgroup",mode:"math",body:s}:n={type:"ordgroup",mode:"math",body:s}}}}if(n||o){if(r&&"multiscript"===r.type&&!r.postscripts)return r.postscripts={sup:n,sub:o},r;{const e=!r||"op"!==r.type&&"operatorname"!==r.type?void 0:Qe(this.nextToken.text);return{type:"supsub",mode:this.mode,base:r,sup:n,sub:o,isFollowedByDelimiter:e}}}return r}parseFunction(t,r){const n=this.fetch(),o=n.text,s=Cr[o];if(!s)return null;if(this.consume(),r&&"atom"!==r&&!s.allowedInArgument)throw new e("Got function '"+o+"' with no arguments"+(r?" as "+r:""),n);if("text"===this.mode&&!s.allowedInText)throw new e("Can't use function '"+o+"' in text mode",n);if("math"===this.mode&&!1===s.allowedInMath)throw new e("Can't use function '"+o+"' in math mode",n);const a=this.prevAtomType,{args:l,optArgs:i}=this.parseArguments(o,s);return this.prevAtomType=a,this.callFunction(o,l,i,n,t)}callFunction(t,r,n,o,s){const a={funcName:t,parser:this,token:o,breakOnTokenText:s},l=Cr[t];if(l&&l.handler)return l.handler(a,r,n);throw new e(`No function handler for ${t}`)}parseArguments(t,r){const n=r.numArgs+r.numOptionalArgs;if(0===n)return{args:[],optArgs:[]};const o=[],s=[];for(let a=0;a<n;a++){let n=r.argTypes&&r.argTypes[a];const l=a<r.numOptionalArgs;(r.primitive&&null==n||"sqrt"===r.type&&1===a&&null==s[0])&&(n="primitive");const i=this.parseGroupOfType(`argument to '${t}'`,n,l);if(l)s.push(i);else{if(null==i)throw new e("Null argument, please report this as a bug");o.push(i)}}return{args:o,optArgs:s}}parseGroupOfType(t,r,n){switch(r){case"size":return this.parseSizeGroup(n);case"url":return this.parseUrlGroup(n);case"math":case"text":return this.parseArgumentGroup(n,r);case"hbox":{const e=this.parseArgumentGroup(n,"text");return null!=e?{type:"styling",mode:e.mode,body:[e],scriptLevel:"text"}:null}case"raw":{const e=this.parseStringGroup("raw",n);return null!=e?{type:"raw",mode:"text",string:e.text}:null}case"primitive":{if(n)throw new e("A primitive argument cannot be optional");const r=this.parseGroup(t);if(null==r)throw new e("Expected group as "+t,this.fetch());return r}case"original":case null:case void 0:return this.parseArgumentGroup(n);default:throw new e("Unknown group type as "+t,this.fetch())}}consumeSpaces(){for(;;){const e=this.fetch().text;if(" "!==e&&" "!==e&&"︎"!==e)break;this.consume()}}parseStringGroup(e,t){const r=this.gullet.scanArgument(t);if(null==r)return null;let n,o="";for(;"EOF"!==(n=this.fetch()).text;)o+=n.text,this.consume();return this.consume(),r.text=o,r}parseRegexGroup(t,r){const n=this.fetch();let o,s=n,a="";for(;"EOF"!==(o=this.fetch()).text&&t.test(a+o.text);)s=o,a+=s.text,this.consume();if(""===a)throw new e("Invalid "+r+": '"+n.text+"'",n);return n.range(s,a)}parseSizeGroup(t){let r,n=!1;if(this.gullet.consumeSpaces(),r=t||"{"===this.gullet.future().text?this.parseStringGroup("size",t):this.parseRegexGroup(/^[-+]? *(?:$|\d+|\d+\.\d*|\.\d*) *[a-z]{0,2} *$/,"size"),!r)return null;t||0!==r.text.length||(r.text="0pt",n=!0);const o=Zr.exec(r.text);if(!o)throw new e("Invalid size: '"+r.text+"'",r);const s={number:+(o[1]+o[2]),unit:o[3]};if(!Ae(s))throw new e("Invalid unit: '"+s.unit+"'",r);return{type:"size",mode:this.mode,value:s,isBlank:n}}parseUrlGroup(e){this.gullet.lexer.setCatcode("%",13),this.gullet.lexer.setCatcode("~",12);const t=this.parseStringGroup("url",e);if(this.gullet.lexer.setCatcode("%",14),this.gullet.lexer.setCatcode("~",13),null==t)return null;let r=t.text.replace(/\\([#$%&~_^{}])/g,"$1");return r=t.text.replace(/{\u2044}/g,"/"),{type:"url",mode:this.mode,url:r}}parseArgumentGroup(e,t){const r=this.gullet.scanArgument(e);if(null==r)return null;const n=this.mode;t&&this.switchMode(t),this.gullet.beginGroup();const o=this.parseExpression(!1,"EOF");this.expect("EOF"),this.gullet.endGroup();const s={type:"ordgroup",mode:this.mode,loc:r.loc,body:o};return t&&this.switchMode(n),s}parseGroup(e,t){const r=this.fetch(),n=r.text;let o;if("{"===n||"\\begingroup"===n||"\\toggle"===n){this.consume();const e="{"===n?"}":"\\begingroup"===n?"\\endgroup":"\\endtoggle";this.gullet.beginGroup();const t=this.parseExpression(!1,e),s=this.fetch();this.expect(e),this.gullet.endGroup(),o={type:"\\endtoggle"===s.text?"toggle":"ordgroup",mode:this.mode,loc:zr.range(r,s),body:t,semisimple:"\\begingroup"===n||void 0}}else o=this.parseFunction(t,e)||this.parseSymbol(),null!=o||"\\"!==n[0]||Object.prototype.hasOwnProperty.call(Pr,n)||(o=this.formatUnsupportedCmd(n),this.consume());return o}formLigatures(e){let t=e.length-1;for(let r=0;r<t;++r){const n=e[r],o=n.text;"-"===o&&"-"===e[r+1].text&&(r+1<t&&"-"===e[r+2].text?(e.splice(r,3,{type:"textord",mode:"text",loc:zr.range(n,e[r+2]),text:"---"}),t-=2):(e.splice(r,2,{type:"textord",mode:"text",loc:zr.range(n,e[r+1]),text:"--"}),t-=1)),"'"!==o&&"`"!==o||e[r+1].text!==o||(e.splice(r,2,{type:"textord",mode:"text",loc:zr.range(n,e[r+1]),text:o+o}),t-=1)}}parseSymbol(){const t=this.fetch();let r=t.text;if(/^\\verb[^a-zA-Z]/.test(r)){this.consume();let t=r.slice(5);const n="*"===t.charAt(0);if(n&&(t=t.slice(1)),t.length<2||t.charAt(0)!==t.slice(-1))throw new e("\\verb assertion failed --\n please report what input caused this bug");return t=t.slice(1,-1),{type:"verb",mode:"text",body:t,star:n}}if(Object.prototype.hasOwnProperty.call(Wr,r[0])&&"math"===this.mode&&!I[this.mode][r[0]]){if(this.settings.strict&&"math"===this.mode)throw new e(`Accented Unicode text character "${r[0]}" used in math mode`,t);r=Wr[r[0]]+r.slice(1)}const n="math"===this.mode?Fr.exec(r):null;let o;if(n&&(r=r.substring(0,n.index),"i"===r?r="ı":"j"===r&&(r="ȷ")),I[this.mode][r]){let e=I[this.mode][r].group;"bin"===e&&Xr.includes(this.prevAtomType)&&(e="open");const n=zr.range(t);let s;if(Object.prototype.hasOwnProperty.call(z,e)){const t=e;s={type:"atom",mode:this.mode,family:t,loc:n,text:r}}else{if(Vr[r]){this.consume();const e=this.fetch().text.charCodeAt(0),t=65025===e?"mathscr":"mathcal";return 65024!==e&&65025!==e||this.consume(),{type:"font",mode:"math",font:t,body:{type:"mathord",mode:"math",loc:n,text:Vr[r]}}}s={type:e,mode:this.mode,loc:n,text:r}}o=s}else{if(!(r.charCodeAt(0)>=128||Fr.exec(r)))return null;if(this.settings.strict&&"math"===this.mode)throw new e(`Unicode text character "${r[0]}" used in math mode`,t);o={type:"textord",mode:"text",loc:zr.range(t),text:r}}if(this.consume(),n)for(let r=0;r<n[0].length;r++){const s=n[0][r];if(!_r[s])throw new e(`Unknown accent ' ${s}'`,t);const a=_r[s][this.mode]||_r[s].text;if(!a)throw new e(`Accent ${s} unsupported in ${this.mode} mode`,t);o={type:"accent",mode:this.mode,loc:zr.range(t),label:a,isStretchy:!1,base:o}}return o}}const Kr=function(t,r){if(!("string"==typeof t||t instanceof String))throw new TypeError("Temml can only parse string typed expression");const n=new Yr(t,r);delete n.gullet.macros.current["\\df@tag"];let o=n.parse();if(!(o.length>0&&o[0].type&&"array"===o[0].type&&o[0].addEqnNum)&&n.gullet.macros.get("\\df@tag")){if(!r.displayMode)throw new e("\\tag works only in display mode");n.gullet.feed("\\df@tag"),o=[{type:"tag",mode:"text",body:o,tag:n.parse()}]}return o},Jr=[2,2,3,3];class Qr{constructor(e){this.level=e.level,this.color=e.color,this.font=e.font||"",this.fontFamily=e.fontFamily||"",this.fontSize=e.fontSize||1,this.fontWeight=e.fontWeight||"",this.fontShape=e.fontShape||"",this.maxSize=e.maxSize}extend(e){const t={level:this.level,color:this.color,font:this.font,fontFamily:this.fontFamily,fontSize:this.fontSize,fontWeight:this.fontWeight,fontShape:this.fontShape,maxSize:this.maxSize};for(const r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return new Qr(t)}withLevel(e){return this.extend({level:e})}incrementLevel(){return this.extend({level:Math.min(this.level+1,3)})}inSubOrSup(){return this.extend({level:Jr[this.level]})}withColor(e){return this.extend({color:e})}withFont(e){return this.extend({font:e})}withTextFontFamily(e){return this.extend({fontFamily:e,font:""})}withFontSize(e){return this.extend({fontSize:e})}withTextFontWeight(e){return this.extend({fontWeight:e,font:""})}withTextFontShape(e){return this.extend({fontShape:e,font:""})}getColor(){return this.color}}let en=function(e,t,r={}){t.textContent="";const n="math"===t.tagName.toLowerCase();n&&(r.wrap="none");const o=tn(e,r);n||o.children.length>1?(t.textContent="",o.children.forEach((e=>{t.appendChild(e.toNode())}))):t.appendChild(o.toNode())};"undefined"!=typeof document&&"CSS1Compat"!==document.compatMode&&("undefined"!=typeof console&&console.warn("Warning: Temml doesn't work in quirks mode. Make sure your website has a suitable doctype."),en=function(){throw new e("Temml doesn't work in quirks mode.")});const tn=function(t,r){const n=new a(r);try{const e=Kr(t,n);return de(e,t,new Qr({level:n.displayMode?lt:it,maxSize:n.maxSize}),n)}catch(r){return function(t,r,n){if(n.throwOnError||!(t instanceof e))throw t;const o=new y(["temml-error"],[new w(r+"\n"+t.toString())]);return o.style.color=n.errorColor,o.style.whiteSpace="pre-line",o}(r,t,n)}};var rn={version:"0.10.33",render:en,renderToString:function(e,t){return tn(e,t).toMarkup()},postProcess:function(e){const t={};let r=0;const n=document.getElementsByClassName("tml-eqn");for(let e of n)for(r+=1,e.setAttribute("id","tml-eqn-"+String(r));;){const n=e.getElementsByClassName("tml-label");if(n.length>0){e.setAttribute("id",n[0].id),t[n[0].id]=String(r);break}if("mtable"===e.tagName)break;e=e.parentElement}const o=document.getElementsByClassName("tml-tageqn");for(const e of o){const r=e.getElementsByClassName("tml-label");if(r.length>0){const n=e.getElementsByClassName("tml-tag");n.length>0&&(t[r[0].id]=n[0].textContent)}}[...e.getElementsByClassName("tml-ref")].forEach((e=>{const r=e.getAttribute("href");let n=t[r.slice(1)];-1===e.className.indexOf("tml-eqref")?(n=n.replace(/^\(/,""),n=n.replace(/\)$/,"")):("("!==n.charAt(0)&&(n="("+n),")"!==n.slice(-1)&&(n+=")"));const o=document.createElementNS("http://www.w3.org/1998/Math/MathML","mtext");o.appendChild(document.createTextNode(n));const s=document.createElementNS("http://www.w3.org/1998/Math/MathML","math");s.appendChild(o),e.appendChild(s)}))},ParseError:e,definePreamble:function(e,t){const r=new a(t);if(r.macros={},!("string"==typeof e||e instanceof String))throw new TypeError("Temml can only parse string typed expression");const n=new Yr(e,r,!0);delete n.gullet.macros.current["\\df@tag"];return n.parse()},__parse:function(e,t){const r=new a(t);return Kr(e,r)},__renderToMathMLTree:tn,__defineSymbol:$,__defineMacro:dt};return rn}();
1
+ var temml=function(){"use strict";class e{constructor(t,r){let n,s=" "+t;const o=r&&r.loc;if(o&&o.start<=o.end){const e=o.lexer.input;n=o.start;const t=o.end;n===e.length?s+=" at end of input: ":s+=" at position "+(n+1)+": ";const r=e.slice(n,t).replace(/[^]/g,"$&̲");let a,i;a=n>15?"…"+e.slice(n-15,n):e.slice(0,n),i=t+15<e.length?e.slice(t,t+15)+"…":e.slice(t),s+=a+r+i}const a=new Error(s);return a.name="ParseError",a.__proto__=e.prototype,a.position=n,a}}e.prototype.__proto__=Error.prototype;const t=/([A-Z])/g,r={"&":"&amp;",">":"&gt;","<":"&lt;",'"':"&quot;","'":"&#x27;"},n=/[&><"']/g;const s=function(e){return"ordgroup"===e.type||"color"===e.type?1===e.body.length?s(e.body[0]):e:"font"===e.type?s(e.body):e};var o={deflt:function(e,t){return void 0===e?t:e},escape:function(e){return String(e).replace(n,(e=>r[e]))},hyphenate:function(e){return e.replace(t,"-$1").toLowerCase()},getBaseElem:s,isCharacterBox:function(e){const t=s(e);return"mathord"===t.type||"textord"===t.type||"atom"===t.type},protocolFromUrl:function(e){const t=/^[\x00-\x20]*([^\\/#?]*?)(:|&#0*58|&#x0*3a|&colon)/i.exec(e);return t?":"!==t[2]?null:/^[a-zA-Z][a-zA-Z0-9+\-.]*$/.test(t[1])?t[1].toLowerCase():null:"_relative"},round:function(e){return+e.toFixed(4)}};class a{constructor(e){e=e||{},this.displayMode=o.deflt(e.displayMode,!1),this.annotate=o.deflt(e.annotate,!1),this.leqno=o.deflt(e.leqno,!1),this.throwOnError=o.deflt(e.throwOnError,!1),this.errorColor=o.deflt(e.errorColor,"#b22222"),this.macros=e.macros||{},this.wrap=o.deflt(e.wrap,"tex"),this.xml=o.deflt(e.xml,!1),this.colorIsTextColor=o.deflt(e.colorIsTextColor,!1),this.strict=o.deflt(e.strict,!1),this.trust=o.deflt(e.trust,!1),this.maxSize=void 0===e.maxSize?[1/0,1/0]:Array.isArray(e.maxSize)?e.maxSize:[1/0,1/0],this.maxExpand=Math.max(0,o.deflt(e.maxExpand,1e3))}isTrusted(e){if(e.url&&!e.protocol){const t=o.protocolFromUrl(e.url);if(null==t)return!1;e.protocol=t}const t="function"==typeof this.trust?this.trust(e):this.trust;return Boolean(t)}}const i={},l={};function c({type:e,names:t,props:r,handler:n,mathmlBuilder:s}){const o={type:e,numArgs:r.numArgs,argTypes:r.argTypes,allowedInArgument:!!r.allowedInArgument,allowedInText:!!r.allowedInText,allowedInMath:void 0===r.allowedInMath||r.allowedInMath,numOptionalArgs:r.numOptionalArgs||0,infix:!!r.infix,primitive:!!r.primitive,handler:n};for(let e=0;e<t.length;++e)i[t[e]]=o;e&&s&&(l[e]=s)}function m({type:e,mathmlBuilder:t}){c({type:e,names:[],props:{numArgs:0},handler(){throw new Error("Should never be called.")},mathmlBuilder:t})}const d=function(e){return"ordgroup"===e.type&&1===e.body.length?e.body[0]:e},p=function(e){return"ordgroup"===e.type?e.body:[e]};class u{constructor(e){this.children=e,this.classes=[],this.style={}}hasClass(e){return this.classes.includes(e)}toNode(){const e=document.createDocumentFragment();for(let t=0;t<this.children.length;t++)e.appendChild(this.children[t].toNode());return e}toMarkup(){let e="";for(let t=0;t<this.children.length;t++)e+=this.children[t].toMarkup();return e}toText(){return this.children.map((e=>e.toText())).join("")}}const h=function(e){return e.filter((e=>e)).join(" ")},g=function(e,t){this.classes=e||[],this.attributes={},this.style=t||{}},f=function(e){const t=document.createElement(e);t.className=h(this.classes);for(const e in this.style)Object.prototype.hasOwnProperty.call(this.style,e)&&(t.style[e]=this.style[e]);for(const e in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,e)&&t.setAttribute(e,this.attributes[e]);for(let e=0;e<this.children.length;e++)t.appendChild(this.children[e].toNode());return t},b=function(e){let t=`<${e}`;this.classes.length&&(t+=` class="${o.escape(h(this.classes))}"`);let r="";for(const e in this.style)Object.prototype.hasOwnProperty.call(this.style,e)&&(r+=`${o.hyphenate(e)}:${this.style[e]};`);r&&(t+=` style="${r}"`);for(const e in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,e)&&(t+=` ${e}="${o.escape(this.attributes[e])}"`);t+=">";for(let e=0;e<this.children.length;e++)t+=this.children[e].toMarkup();return t+=`</${e}>`,t};class y{constructor(e,t,r){g.call(this,e,r),this.children=t||[]}setAttribute(e,t){this.attributes[e]=t}toNode(){return f.call(this,"span")}toMarkup(){return b.call(this,"span")}}let w=class{constructor(e){this.text=e}toNode(){return document.createTextNode(this.text)}toMarkup(){return o.escape(this.text)}};class x{constructor(e,t,r){this.href=e,this.classes=t,this.children=r||[]}toNode(){const e=document.createElement("a");e.setAttribute("href",this.href),this.classes.length>0&&(e.className=h(this.classes));for(let t=0;t<this.children.length;t++)e.appendChild(this.children[t].toNode());return e}toMarkup(){let e=`<a href='${o.escape(this.href)}'`;this.classes.length>0&&(e+=` class="${o.escape(h(this.classes))}"`),e+=">";for(let t=0;t<this.children.length;t++)e+=this.children[t].toMarkup();return e+="</a>",e}}class k{constructor(e,t,r){this.alt=t,this.src=e,this.classes=["mord"],this.style=r}hasClass(e){return this.classes.includes(e)}toNode(){const e=document.createElement("img");e.src=this.src,e.alt=this.alt,e.className="mord";for(const t in this.style)Object.prototype.hasOwnProperty.call(this.style,t)&&(e.style[t]=this.style[t]);return e}toMarkup(){let e=`<img src='${this.src}' alt='${this.alt}'`,t="";for(const e in this.style)Object.prototype.hasOwnProperty.call(this.style,e)&&(t+=`${o.hyphenate(e)}:${this.style[e]};`);return t&&(e+=` style="${o.escape(t)}"`),e+=">",e}}class v{constructor(e,t,r,n){this.type=e,this.attributes={},this.children=t||[],this.classes=r||[],this.style=n||{},this.label=""}setAttribute(e,t){this.attributes[e]=t}getAttribute(e){return this.attributes[e]}setLabel(e){this.label=e}toNode(){const e=document.createElementNS("http://www.w3.org/1998/Math/MathML",this.type);for(const t in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,t)&&e.setAttribute(t,this.attributes[t]);this.classes.length>0&&(e.className=h(this.classes));for(const t in this.style)Object.prototype.hasOwnProperty.call(this.style,t)&&(e.style[t]=this.style[t]);for(let t=0;t<this.children.length;t++)e.appendChild(this.children[t].toNode());return e}toMarkup(){let e="<"+this.type;for(const t in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,t)&&(e+=" "+t+'="',e+=o.escape(this.attributes[t]),e+='"');this.classes.length>0&&(e+=` class="${o.escape(h(this.classes))}"`);let t="";for(const e in this.style)Object.prototype.hasOwnProperty.call(this.style,e)&&(t+=`${o.hyphenate(e)}:${this.style[e]};`);t&&(e+=` style="${t}"`),e+=">";for(let t=0;t<this.children.length;t++)e+=this.children[t].toMarkup();return e+="</"+this.type+">",e}toText(){return this.children.map((e=>e.toText())).join("")}}class A{constructor(e){this.text=e}toNode(){return document.createTextNode(this.text)}toMarkup(){return o.escape(this.toText())}toText(){return this.text}}const N=e=>{let t;return 1===e.length&&"mrow"===e[0].type?(t=e.pop(),t.type="mstyle"):t=new v("mstyle",e),t};var T={MathNode:v,TextNode:A,newDocumentFragment:function(e){return new u(e)}};const S=e=>{let t=0;if(e.body)for(const r of e.body)t+=S(r);else if("supsub"===e.type)t+=S(e.base),e.sub&&(t+=.7*S(e.sub)),e.sup&&(t+=.7*S(e.sup));else if("mathord"===e.type||"textord"===e.type)for(const r of e.text.split("")){const e=r.codePointAt(0);t+=96<e&&e<123||944<e&&e<970?.56:47<e&&e<58?.5:.92}else t+=1;return t},q={widehat:"^",widecheck:"ˇ",widetilde:"~",wideparen:"⏜",utilde:"~",overleftarrow:"←",underleftarrow:"←",xleftarrow:"←",overrightarrow:"→",underrightarrow:"→",xrightarrow:"→",underbrace:"⏟",overbrace:"⏞",overgroup:"⏠",overparen:"⏜",undergroup:"⏡",underparen:"⏝",overleftrightarrow:"↔",underleftrightarrow:"↔",xleftrightarrow:"↔",Overrightarrow:"⇒",xRightarrow:"⇒",overleftharpoon:"↼",xleftharpoonup:"↼",overrightharpoon:"⇀",xrightharpoonup:"⇀",xLeftarrow:"⇐",xLeftrightarrow:"⇔",xhookleftarrow:"↩",xhookrightarrow:"↪",xmapsto:"↦",xrightharpoondown:"⇁",xleftharpoondown:"↽",xtwoheadleftarrow:"↞",xtwoheadrightarrow:"↠",xlongequal:"=",xrightleftarrows:"⇄",yields:"→",yieldsLeft:"←",mesomerism:"↔",longrightharpoonup:"⇀",longleftharpoondown:"↽",eqrightharpoonup:"⇀",eqleftharpoondown:"↽","\\cdrightarrow":"→","\\cdleftarrow":"←","\\cdlongequal":"="},O=function(e){const t=new T.TextNode(q[e.slice(1)]),r=new T.MathNode("mo",[t]);return r.setAttribute("stretchy","true"),r},M=["\\widetilde","\\widehat","\\widecheck","\\utilde"];var B=O,C=e=>{const t=O(e.label);if(M.includes(e.label)){const r=S(e.base);1<r&&r<1.6?t.classes.push("tml-crooked-2"):1.6<=r&&r<2.5?t.classes.push("tml-crooked-3"):2.5<=r&&t.classes.push("tml-crooked-4")}return t};const z={bin:1,close:1,inner:1,open:1,punct:1,rel:1},$={"accent-token":1,mathord:1,"op-token":1,spacing:1,textord:1},E={math:{},text:{}};function I(e,t,r,n,s){E[e][n]={group:t,replace:r},s&&r&&(E[e][r]=E[e][n])}const L="math",F="text",D="accent-token",G="bin",j="close",P="inner",R="mathord",U="op-token",H="open",V="punct",_="rel",W="spacing",X="textord";I(L,_,"≡","\\equiv",!0),I(L,_,"≺","\\prec",!0),I(L,_,"≻","\\succ",!0),I(L,_,"∼","\\sim",!0),I(L,_,"⟂","\\perp",!0),I(L,_,"⪯","\\preceq",!0),I(L,_,"⪰","\\succeq",!0),I(L,_,"≃","\\simeq",!0),I(L,_,"≌","\\backcong",!0),I(L,_,"|","\\mid",!0),I(L,_,"≪","\\ll",!0),I(L,_,"≫","\\gg",!0),I(L,_,"≍","\\asymp",!0),I(L,_,"∥","\\parallel"),I(L,_,"⌣","\\smile",!0),I(L,_,"⊑","\\sqsubseteq",!0),I(L,_,"⊒","\\sqsupseteq",!0),I(L,_,"≐","\\doteq",!0),I(L,_,"⌢","\\frown",!0),I(L,_,"∋","\\ni",!0),I(L,_,"∌","\\notni",!0),I(L,_,"∝","\\propto",!0),I(L,_,"⊢","\\vdash",!0),I(L,_,"⊣","\\dashv",!0),I(L,_,"∋","\\owns"),I(L,_,"≘","\\arceq",!0),I(L,_,"≙","\\wedgeq",!0),I(L,_,"≚","\\veeeq",!0),I(L,_,"≛","\\stareq",!0),I(L,_,"≝","\\eqdef",!0),I(L,_,"≞","\\measeq",!0),I(L,_,"≟","\\questeq",!0),I(L,_,"≠","\\ne",!0),I(L,_,"≠","\\neq"),I(L,_,"⩵","\\eqeq",!0),I(L,_,"⩶","\\eqeqeq",!0),I(L,_,"∷","\\dblcolon",!0),I(L,_,"≔","\\coloneqq",!0),I(L,_,"≕","\\eqqcolon",!0),I(L,_,"∹","\\eqcolon",!0),I(L,_,"⩴","\\Coloneqq",!0),I(L,V,".","\\ldotp"),I(L,V,"·","\\cdotp"),I(L,X,"#","\\#"),I(F,X,"#","\\#"),I(L,X,"&","\\&"),I(F,X,"&","\\&"),I(L,X,"ℵ","\\aleph",!0),I(L,X,"∀","\\forall",!0),I(L,X,"ℏ","\\hbar",!0),I(L,X,"∃","\\exists",!0),I(L,G,"∇","\\nabla",!0),I(L,X,"♭","\\flat",!0),I(L,X,"ℓ","\\ell",!0),I(L,X,"♮","\\natural",!0),I(L,X,"Å","\\Angstrom",!0),I(F,X,"Å","\\Angstrom",!0),I(L,X,"♣","\\clubsuit",!0),I(L,X,"♧","\\varclubsuit",!0),I(L,X,"℘","\\wp",!0),I(L,X,"♯","\\sharp",!0),I(L,X,"♢","\\diamondsuit",!0),I(L,X,"♦","\\vardiamondsuit",!0),I(L,X,"ℜ","\\Re",!0),I(L,X,"♡","\\heartsuit",!0),I(L,X,"♥","\\varheartsuit",!0),I(L,X,"ℑ","\\Im",!0),I(L,X,"♠","\\spadesuit",!0),I(L,X,"♤","\\varspadesuit",!0),I(L,X,"♀","\\female",!0),I(L,X,"♂","\\male",!0),I(L,X,"§","\\S",!0),I(F,X,"§","\\S"),I(L,X,"¶","\\P",!0),I(F,X,"¶","\\P"),I(F,X,"☺","\\smiley",!0),I(L,X,"☺","\\smiley",!0),I(L,X,"†","\\dag"),I(F,X,"†","\\dag"),I(F,X,"†","\\textdagger"),I(L,X,"‡","\\ddag"),I(F,X,"‡","\\ddag"),I(F,X,"‡","\\textdaggerdbl"),I(L,j,"⎱","\\rmoustache",!0),I(L,H,"⎰","\\lmoustache",!0),I(L,j,"⟯","\\rgroup",!0),I(L,H,"⟮","\\lgroup",!0),I(L,G,"∓","\\mp",!0),I(L,G,"⊖","\\ominus",!0),I(L,G,"⊎","\\uplus",!0),I(L,G,"⊓","\\sqcap",!0),I(L,G,"∗","\\ast"),I(L,G,"⊔","\\sqcup",!0),I(L,G,"◯","\\bigcirc",!0),I(L,G,"∙","\\bullet",!0),I(L,G,"‡","\\ddagger"),I(L,G,"≀","\\wr",!0),I(L,G,"⨿","\\amalg"),I(L,G,"&","\\And"),I(L,G,"⫽","\\sslash",!0),I(L,_,"⟵","\\longleftarrow",!0),I(L,_,"⇐","\\Leftarrow",!0),I(L,_,"⟸","\\Longleftarrow",!0),I(L,_,"⟶","\\longrightarrow",!0),I(L,_,"⇒","\\Rightarrow",!0),I(L,_,"⟹","\\Longrightarrow",!0),I(L,_,"↔","\\leftrightarrow",!0),I(L,_,"⟷","\\longleftrightarrow",!0),I(L,_,"⇔","\\Leftrightarrow",!0),I(L,_,"⟺","\\Longleftrightarrow",!0),I(L,_,"↤","\\mapsfrom",!0),I(L,_,"↦","\\mapsto",!0),I(L,_,"⟼","\\longmapsto",!0),I(L,_,"↗","\\nearrow",!0),I(L,_,"↩","\\hookleftarrow",!0),I(L,_,"↪","\\hookrightarrow",!0),I(L,_,"↘","\\searrow",!0),I(L,_,"↼","\\leftharpoonup",!0),I(L,_,"⇀","\\rightharpoonup",!0),I(L,_,"↙","\\swarrow",!0),I(L,_,"↽","\\leftharpoondown",!0),I(L,_,"⇁","\\rightharpoondown",!0),I(L,_,"↖","\\nwarrow",!0),I(L,_,"⇌","\\rightleftharpoons",!0),I(L,R,"↯","\\lightning",!0),I(L,R,"∎","\\QED",!0),I(L,R,"‰","\\permil",!0),I(F,X,"‰","\\permil"),I(L,R,"☉","\\astrosun",!0),I(L,R,"☼","\\sun",!0),I(L,R,"☾","\\leftmoon",!0),I(L,R,"☽","\\rightmoon",!0),I(L,R,"⊕","\\Earth"),I(L,_,"≮","\\nless",!0),I(L,_,"⪇","\\lneq",!0),I(L,_,"≨","\\lneqq",!0),I(L,_,"≨︀","\\lvertneqq"),I(L,_,"⋦","\\lnsim",!0),I(L,_,"⪉","\\lnapprox",!0),I(L,_,"⊀","\\nprec",!0),I(L,_,"⋠","\\npreceq",!0),I(L,_,"⋨","\\precnsim",!0),I(L,_,"⪹","\\precnapprox",!0),I(L,_,"≁","\\nsim",!0),I(L,_,"∤","\\nmid",!0),I(L,_,"∤","\\nshortmid"),I(L,_,"⊬","\\nvdash",!0),I(L,_,"⊭","\\nvDash",!0),I(L,_,"⋪","\\ntriangleleft"),I(L,_,"⋬","\\ntrianglelefteq",!0),I(L,_,"⊄","\\nsubset",!0),I(L,_,"⊅","\\nsupset",!0),I(L,_,"⊊","\\subsetneq",!0),I(L,_,"⊊︀","\\varsubsetneq"),I(L,_,"⫋","\\subsetneqq",!0),I(L,_,"⫋︀","\\varsubsetneqq"),I(L,_,"≯","\\ngtr",!0),I(L,_,"⪈","\\gneq",!0),I(L,_,"≩","\\gneqq",!0),I(L,_,"≩︀","\\gvertneqq"),I(L,_,"⋧","\\gnsim",!0),I(L,_,"⪊","\\gnapprox",!0),I(L,_,"⊁","\\nsucc",!0),I(L,_,"⋡","\\nsucceq",!0),I(L,_,"⋩","\\succnsim",!0),I(L,_,"⪺","\\succnapprox",!0),I(L,_,"≆","\\ncong",!0),I(L,_,"∦","\\nparallel",!0),I(L,_,"∦","\\nshortparallel"),I(L,_,"⊯","\\nVDash",!0),I(L,_,"⋫","\\ntriangleright"),I(L,_,"⋭","\\ntrianglerighteq",!0),I(L,_,"⊋","\\supsetneq",!0),I(L,_,"⊋","\\varsupsetneq"),I(L,_,"⫌","\\supsetneqq",!0),I(L,_,"⫌︀","\\varsupsetneqq"),I(L,_,"⊮","\\nVdash",!0),I(L,_,"⪵","\\precneqq",!0),I(L,_,"⪶","\\succneqq",!0),I(L,G,"⊴","\\unlhd"),I(L,G,"⊵","\\unrhd"),I(L,_,"↚","\\nleftarrow",!0),I(L,_,"↛","\\nrightarrow",!0),I(L,_,"⇍","\\nLeftarrow",!0),I(L,_,"⇏","\\nRightarrow",!0),I(L,_,"↮","\\nleftrightarrow",!0),I(L,_,"⇎","\\nLeftrightarrow",!0),I(L,_,"△","\\vartriangle"),I(L,X,"ℏ","\\hslash"),I(L,X,"▽","\\triangledown"),I(L,X,"◊","\\lozenge"),I(L,X,"Ⓢ","\\circledS"),I(L,X,"®","\\circledR",!0),I(F,X,"®","\\circledR"),I(F,X,"®","\\textregistered"),I(L,X,"∡","\\measuredangle",!0),I(L,X,"∄","\\nexists"),I(L,X,"℧","\\mho"),I(L,X,"Ⅎ","\\Finv",!0),I(L,X,"⅁","\\Game",!0),I(L,X,"‵","\\backprime"),I(L,X,"‶","\\backdprime"),I(L,X,"‷","\\backtrprime"),I(L,X,"▲","\\blacktriangle"),I(L,X,"▼","\\blacktriangledown"),I(L,X,"■","\\blacksquare"),I(L,X,"⧫","\\blacklozenge"),I(L,X,"★","\\bigstar"),I(L,X,"∢","\\sphericalangle",!0),I(L,X,"∁","\\complement",!0),I(L,X,"ð","\\eth",!0),I(F,X,"ð","ð"),I(L,X,"╱","\\diagup"),I(L,X,"╲","\\diagdown"),I(L,X,"□","\\square"),I(L,X,"□","\\Box"),I(L,X,"◊","\\Diamond"),I(L,X,"¥","\\yen",!0),I(F,X,"¥","\\yen",!0),I(L,X,"✓","\\checkmark",!0),I(F,X,"✓","\\checkmark"),I(L,X,"✗","\\ballotx",!0),I(F,X,"✗","\\ballotx"),I(F,X,"•","\\textbullet"),I(L,X,"ℶ","\\beth",!0),I(L,X,"ℸ","\\daleth",!0),I(L,X,"ℷ","\\gimel",!0),I(L,X,"ϝ","\\digamma",!0),I(L,X,"ϰ","\\varkappa"),I(L,H,"⌜","\\ulcorner",!0),I(L,j,"⌝","\\urcorner",!0),I(L,H,"⌞","\\llcorner",!0),I(L,j,"⌟","\\lrcorner",!0),I(L,_,"≦","\\leqq",!0),I(L,_,"⩽","\\leqslant",!0),I(L,_,"⪕","\\eqslantless",!0),I(L,_,"≲","\\lesssim",!0),I(L,_,"⪅","\\lessapprox",!0),I(L,_,"≊","\\approxeq",!0),I(L,G,"⋖","\\lessdot"),I(L,_,"⋘","\\lll",!0),I(L,_,"≶","\\lessgtr",!0),I(L,_,"⋚","\\lesseqgtr",!0),I(L,_,"⪋","\\lesseqqgtr",!0),I(L,_,"≑","\\doteqdot"),I(L,_,"≓","\\risingdotseq",!0),I(L,_,"≒","\\fallingdotseq",!0),I(L,_,"∽","\\backsim",!0),I(L,_,"⋍","\\backsimeq",!0),I(L,_,"⫅","\\subseteqq",!0),I(L,_,"⋐","\\Subset",!0),I(L,_,"⊏","\\sqsubset",!0),I(L,_,"≼","\\preccurlyeq",!0),I(L,_,"⋞","\\curlyeqprec",!0),I(L,_,"≾","\\precsim",!0),I(L,_,"⪷","\\precapprox",!0),I(L,_,"⊲","\\vartriangleleft"),I(L,_,"⊴","\\trianglelefteq"),I(L,_,"⊨","\\vDash",!0),I(L,_,"⊫","\\VDash",!0),I(L,_,"⊪","\\Vvdash",!0),I(L,_,"⌣","\\smallsmile"),I(L,_,"⌢","\\smallfrown"),I(L,_,"≏","\\bumpeq",!0),I(L,_,"≎","\\Bumpeq",!0),I(L,_,"≧","\\geqq",!0),I(L,_,"⩾","\\geqslant",!0),I(L,_,"⪖","\\eqslantgtr",!0),I(L,_,"≳","\\gtrsim",!0),I(L,_,"⪆","\\gtrapprox",!0),I(L,G,"⋗","\\gtrdot"),I(L,_,"⋙","\\ggg",!0),I(L,_,"≷","\\gtrless",!0),I(L,_,"⋛","\\gtreqless",!0),I(L,_,"⪌","\\gtreqqless",!0),I(L,_,"≖","\\eqcirc",!0),I(L,_,"≗","\\circeq",!0),I(L,_,"≜","\\triangleq",!0),I(L,_,"∼","\\thicksim"),I(L,_,"≈","\\thickapprox"),I(L,_,"⫆","\\supseteqq",!0),I(L,_,"⋑","\\Supset",!0),I(L,_,"⊐","\\sqsupset",!0),I(L,_,"≽","\\succcurlyeq",!0),I(L,_,"⋟","\\curlyeqsucc",!0),I(L,_,"≿","\\succsim",!0),I(L,_,"⪸","\\succapprox",!0),I(L,_,"⊳","\\vartriangleright"),I(L,_,"⊵","\\trianglerighteq"),I(L,_,"⊩","\\Vdash",!0),I(L,_,"∣","\\shortmid"),I(L,_,"∥","\\shortparallel"),I(L,_,"≬","\\between",!0),I(L,_,"⋔","\\pitchfork",!0),I(L,_,"∝","\\varpropto"),I(L,_,"◀","\\blacktriangleleft"),I(L,_,"∴","\\therefore",!0),I(L,_,"∍","\\backepsilon"),I(L,_,"▶","\\blacktriangleright"),I(L,_,"∵","\\because",!0),I(L,_,"⋘","\\llless"),I(L,_,"⋙","\\gggtr"),I(L,G,"⊲","\\lhd"),I(L,G,"⊳","\\rhd"),I(L,_,"≂","\\eqsim",!0),I(L,_,"≑","\\Doteq",!0),I(L,_,"⥽","\\strictif",!0),I(L,_,"⥼","\\strictfi",!0),I(L,G,"∔","\\dotplus",!0),I(L,G,"∖","\\smallsetminus"),I(L,G,"⋒","\\Cap",!0),I(L,G,"⋓","\\Cup",!0),I(L,G,"⩞","\\doublebarwedge",!0),I(L,G,"⊟","\\boxminus",!0),I(L,G,"⊞","\\boxplus",!0),I(L,G,"⧄","\\boxslash",!0),I(L,G,"⋇","\\divideontimes",!0),I(L,G,"⋉","\\ltimes",!0),I(L,G,"⋊","\\rtimes",!0),I(L,G,"⋋","\\leftthreetimes",!0),I(L,G,"⋌","\\rightthreetimes",!0),I(L,G,"⋏","\\curlywedge",!0),I(L,G,"⋎","\\curlyvee",!0),I(L,G,"⊝","\\circleddash",!0),I(L,G,"⊛","\\circledast",!0),I(L,G,"⊺","\\intercal",!0),I(L,G,"⋒","\\doublecap"),I(L,G,"⋓","\\doublecup"),I(L,G,"⊠","\\boxtimes",!0),I(L,G,"⋈","\\bowtie",!0),I(L,G,"⋈","\\Join"),I(L,G,"⟕","\\leftouterjoin",!0),I(L,G,"⟖","\\rightouterjoin",!0),I(L,G,"⟗","\\fullouterjoin",!0),I(L,G,"∸","\\dotminus",!0),I(L,G,"⟑","\\wedgedot",!0),I(L,G,"⟇","\\veedot",!0),I(L,G,"⩢","\\doublebarvee",!0),I(L,G,"⩣","\\veedoublebar",!0),I(L,G,"⩟","\\wedgebar",!0),I(L,G,"⩠","\\wedgedoublebar",!0),I(L,G,"⩔","\\Vee",!0),I(L,G,"⩓","\\Wedge",!0),I(L,G,"⩃","\\barcap",!0),I(L,G,"⩂","\\barcup",!0),I(L,G,"⩈","\\capbarcup",!0),I(L,G,"⩀","\\capdot",!0),I(L,G,"⩇","\\capovercup",!0),I(L,G,"⩆","\\cupovercap",!0),I(L,G,"⩍","\\closedvarcap",!0),I(L,G,"⩌","\\closedvarcup",!0),I(L,G,"⨪","\\minusdot",!0),I(L,G,"⨫","\\minusfdots",!0),I(L,G,"⨬","\\minusrdots",!0),I(L,G,"⊻","\\Xor",!0),I(L,G,"⊼","\\Nand",!0),I(L,G,"⊽","\\Nor",!0),I(L,G,"⊽","\\barvee"),I(L,G,"⫴","\\interleave",!0),I(L,G,"⧢","\\shuffle",!0),I(L,G,"⫶","\\threedotcolon",!0),I(L,G,"⦂","\\typecolon",!0),I(L,G,"∾","\\invlazys",!0),I(L,G,"⩋","\\twocaps",!0),I(L,G,"⩊","\\twocups",!0),I(L,G,"⩎","\\Sqcap",!0),I(L,G,"⩏","\\Sqcup",!0),I(L,G,"⩖","\\veeonvee",!0),I(L,G,"⩕","\\wedgeonwedge",!0),I(L,G,"⧗","\\blackhourglass",!0),I(L,G,"⧆","\\boxast",!0),I(L,G,"⧈","\\boxbox",!0),I(L,G,"⧇","\\boxcircle",!0),I(L,G,"⊜","\\circledequal",!0),I(L,G,"⦷","\\circledparallel",!0),I(L,G,"⦶","\\circledvert",!0),I(L,G,"⦵","\\circlehbar",!0),I(L,G,"⟡","\\concavediamond",!0),I(L,G,"⟢","\\concavediamondtickleft",!0),I(L,G,"⟣","\\concavediamondtickright",!0),I(L,G,"⋄","\\diamond",!0),I(L,G,"⧖","\\hourglass",!0),I(L,G,"⟠","\\lozengeminus",!0),I(L,G,"⌽","\\obar",!0),I(L,G,"⦸","\\obslash",!0),I(L,G,"⨸","\\odiv",!0),I(L,G,"⧁","\\ogreaterthan",!0),I(L,G,"⧀","\\olessthan",!0),I(L,G,"⦹","\\operp",!0),I(L,G,"⨷","\\Otimes",!0),I(L,G,"⨶","\\otimeshat",!0),I(L,G,"⋆","\\star",!0),I(L,G,"△","\\triangle",!0),I(L,G,"⨺","\\triangleminus",!0),I(L,G,"⨹","\\triangleplus",!0),I(L,G,"⨻","\\triangletimes",!0),I(L,G,"⟤","\\whitesquaretickleft",!0),I(L,G,"⟥","\\whitesquaretickright",!0),I(L,G,"⨳","\\smashtimes",!0),I(L,_,"⇢","\\dashrightarrow",!0),I(L,_,"⇠","\\dashleftarrow",!0),I(L,_,"⇇","\\leftleftarrows",!0),I(L,_,"⇆","\\leftrightarrows",!0),I(L,_,"⇚","\\Lleftarrow",!0),I(L,_,"↞","\\twoheadleftarrow",!0),I(L,_,"↢","\\leftarrowtail",!0),I(L,_,"↫","\\looparrowleft",!0),I(L,_,"⇋","\\leftrightharpoons",!0),I(L,_,"↶","\\curvearrowleft",!0),I(L,_,"↺","\\circlearrowleft",!0),I(L,_,"↰","\\Lsh",!0),I(L,_,"⇈","\\upuparrows",!0),I(L,_,"↿","\\upharpoonleft",!0),I(L,_,"⇃","\\downharpoonleft",!0),I(L,_,"⊶","\\origof",!0),I(L,_,"⊷","\\imageof",!0),I(L,_,"⊸","\\multimap",!0),I(L,_,"↭","\\leftrightsquigarrow",!0),I(L,_,"⇉","\\rightrightarrows",!0),I(L,_,"⇄","\\rightleftarrows",!0),I(L,_,"↠","\\twoheadrightarrow",!0),I(L,_,"↣","\\rightarrowtail",!0),I(L,_,"↬","\\looparrowright",!0),I(L,_,"↷","\\curvearrowright",!0),I(L,_,"↻","\\circlearrowright",!0),I(L,_,"↱","\\Rsh",!0),I(L,_,"⇊","\\downdownarrows",!0),I(L,_,"↾","\\upharpoonright",!0),I(L,_,"⇂","\\downharpoonright",!0),I(L,_,"⇝","\\rightsquigarrow",!0),I(L,_,"⇝","\\leadsto"),I(L,_,"⇛","\\Rrightarrow",!0),I(L,_,"↾","\\restriction"),I(L,X,"‘","`"),I(L,X,"$","\\$"),I(F,X,"$","\\$"),I(F,X,"$","\\textdollar"),I(L,X,"¢","\\cent"),I(F,X,"¢","\\cent"),I(L,X,"%","\\%"),I(F,X,"%","\\%"),I(L,X,"_","\\_"),I(F,X,"_","\\_"),I(F,X,"_","\\textunderscore"),I(F,X,"␣","\\textvisiblespace",!0),I(L,X,"∠","\\angle",!0),I(L,X,"∞","\\infty",!0),I(L,X,"′","\\prime"),I(L,X,"″","\\dprime"),I(L,X,"‴","\\trprime"),I(L,X,"⁗","\\qprime"),I(L,X,"△","\\triangle"),I(F,X,"Α","\\Alpha",!0),I(F,X,"Β","\\Beta",!0),I(F,X,"Γ","\\Gamma",!0),I(F,X,"Δ","\\Delta",!0),I(F,X,"Ε","\\Epsilon",!0),I(F,X,"Ζ","\\Zeta",!0),I(F,X,"Η","\\Eta",!0),I(F,X,"Θ","\\Theta",!0),I(F,X,"Ι","\\Iota",!0),I(F,X,"Κ","\\Kappa",!0),I(F,X,"Λ","\\Lambda",!0),I(F,X,"Μ","\\Mu",!0),I(F,X,"Ν","\\Nu",!0),I(F,X,"Ξ","\\Xi",!0),I(F,X,"Ο","\\Omicron",!0),I(F,X,"Π","\\Pi",!0),I(F,X,"Ρ","\\Rho",!0),I(F,X,"Σ","\\Sigma",!0),I(F,X,"Τ","\\Tau",!0),I(F,X,"Υ","\\Upsilon",!0),I(F,X,"Φ","\\Phi",!0),I(F,X,"Χ","\\Chi",!0),I(F,X,"Ψ","\\Psi",!0),I(F,X,"Ω","\\Omega",!0),I(L,R,"Α","\\Alpha",!0),I(L,R,"Β","\\Beta",!0),I(L,R,"Γ","\\Gamma",!0),I(L,R,"Δ","\\Delta",!0),I(L,R,"Ε","\\Epsilon",!0),I(L,R,"Ζ","\\Zeta",!0),I(L,R,"Η","\\Eta",!0),I(L,R,"Θ","\\Theta",!0),I(L,R,"Ι","\\Iota",!0),I(L,R,"Κ","\\Kappa",!0),I(L,R,"Λ","\\Lambda",!0),I(L,R,"Μ","\\Mu",!0),I(L,R,"Ν","\\Nu",!0),I(L,R,"Ξ","\\Xi",!0),I(L,R,"Ο","\\Omicron",!0),I(L,R,"Π","\\Pi",!0),I(L,R,"Ρ","\\Rho",!0),I(L,R,"Σ","\\Sigma",!0),I(L,R,"Τ","\\Tau",!0),I(L,R,"Υ","\\Upsilon",!0),I(L,R,"Φ","\\Phi",!0),I(L,R,"Χ","\\Chi",!0),I(L,R,"Ψ","\\Psi",!0),I(L,R,"Ω","\\Omega",!0),I(L,H,"¬","\\neg",!0),I(L,H,"¬","\\lnot"),I(L,X,"⊤","\\top"),I(L,X,"⊥","\\bot"),I(L,X,"∅","\\emptyset"),I(L,X,"⌀","\\varnothing"),I(L,R,"α","\\alpha",!0),I(L,R,"β","\\beta",!0),I(L,R,"γ","\\gamma",!0),I(L,R,"δ","\\delta",!0),I(L,R,"ϵ","\\epsilon",!0),I(L,R,"ζ","\\zeta",!0),I(L,R,"η","\\eta",!0),I(L,R,"θ","\\theta",!0),I(L,R,"ι","\\iota",!0),I(L,R,"κ","\\kappa",!0),I(L,R,"λ","\\lambda",!0),I(L,R,"μ","\\mu",!0),I(L,R,"ν","\\nu",!0),I(L,R,"ξ","\\xi",!0),I(L,R,"ο","\\omicron",!0),I(L,R,"π","\\pi",!0),I(L,R,"ρ","\\rho",!0),I(L,R,"σ","\\sigma",!0),I(L,R,"τ","\\tau",!0),I(L,R,"υ","\\upsilon",!0),I(L,R,"ϕ","\\phi",!0),I(L,R,"χ","\\chi",!0),I(L,R,"ψ","\\psi",!0),I(L,R,"ω","\\omega",!0),I(L,R,"ε","\\varepsilon",!0),I(L,R,"ϑ","\\vartheta",!0),I(L,R,"ϖ","\\varpi",!0),I(L,R,"ϱ","\\varrho",!0),I(L,R,"ς","\\varsigma",!0),I(L,R,"φ","\\varphi",!0),I(L,R,"Ϙ","\\Coppa",!0),I(L,R,"ϙ","\\coppa",!0),I(L,R,"ϙ","\\varcoppa",!0),I(L,R,"Ϟ","\\Koppa",!0),I(L,R,"ϟ","\\koppa",!0),I(L,R,"Ϡ","\\Sampi",!0),I(L,R,"ϡ","\\sampi",!0),I(L,R,"Ϛ","\\Stigma",!0),I(L,R,"ϛ","\\stigma",!0),I(L,R,"⫫","\\Bot"),I(L,G,"∗","∗",!0),I(L,G,"+","+"),I(L,G,"∗","*"),I(L,G,"⁄","/",!0),I(L,G,"⁄","⁄"),I(L,G,"−","-",!0),I(L,G,"⋅","\\cdot",!0),I(L,G,"∘","\\circ",!0),I(L,G,"÷","\\div",!0),I(L,G,"±","\\pm",!0),I(L,G,"×","\\times",!0),I(L,G,"∩","\\cap",!0),I(L,G,"∪","\\cup",!0),I(L,G,"∖","\\setminus",!0),I(L,G,"∧","\\land"),I(L,G,"∨","\\lor"),I(L,G,"∧","\\wedge",!0),I(L,G,"∨","\\vee",!0),I(L,H,"⟦","\\llbracket",!0),I(L,j,"⟧","\\rrbracket",!0),I(L,H,"⟨","\\langle",!0),I(L,H,"⟪","\\lAngle",!0),I(L,H,"⦉","\\llangle",!0),I(L,H,"|","\\lvert"),I(L,H,"‖","\\lVert",!0),I(L,X,"!","\\oc"),I(L,X,"?","\\wn"),I(L,X,"↓","\\shpos"),I(L,X,"↕","\\shift"),I(L,X,"↑","\\shneg"),I(L,j,"?","?"),I(L,j,"!","!"),I(L,j,"‼","‼"),I(L,j,"⟩","\\rangle",!0),I(L,j,"⟫","\\rAngle",!0),I(L,j,"⦊","\\rrangle",!0),I(L,j,"|","\\rvert"),I(L,j,"‖","\\rVert"),I(L,H,"⦃","\\lBrace",!0),I(L,j,"⦄","\\rBrace",!0),I(L,_,"=","\\equal",!0),I(L,_,":",":"),I(L,_,"≈","\\approx",!0),I(L,_,"≅","\\cong",!0),I(L,_,"≥","\\ge"),I(L,_,"≥","\\geq",!0),I(L,_,"←","\\gets"),I(L,_,">","\\gt",!0),I(L,_,"∈","\\in",!0),I(L,_,"∉","\\notin",!0),I(L,_,"","\\@not"),I(L,_,"⊂","\\subset",!0),I(L,_,"⊃","\\supset",!0),I(L,_,"⊆","\\subseteq",!0),I(L,_,"⊇","\\supseteq",!0),I(L,_,"⊈","\\nsubseteq",!0),I(L,_,"⊈","\\nsubseteqq"),I(L,_,"⊉","\\nsupseteq",!0),I(L,_,"⊉","\\nsupseteqq"),I(L,_,"⊨","\\models"),I(L,_,"←","\\leftarrow",!0),I(L,_,"≤","\\le"),I(L,_,"≤","\\leq",!0),I(L,_,"<","\\lt",!0),I(L,_,"→","\\rightarrow",!0),I(L,_,"→","\\to"),I(L,_,"≱","\\ngeq",!0),I(L,_,"≱","\\ngeqq"),I(L,_,"≱","\\ngeqslant"),I(L,_,"≰","\\nleq",!0),I(L,_,"≰","\\nleqq"),I(L,_,"≰","\\nleqslant"),I(L,_,"⫫","\\Perp",!0),I(L,W," ","\\ "),I(L,W," ","\\space"),I(L,W," ","\\nobreakspace"),I(F,W," ","\\ "),I(F,W," "," "),I(F,W," ","\\space"),I(F,W," ","\\nobreakspace"),I(L,W,null,"\\nobreak"),I(L,W,null,"\\allowbreak"),I(L,V,",",","),I(F,V,":",":"),I(L,V,";",";"),I(L,G,"⊼","\\barwedge"),I(L,G,"⊻","\\veebar"),I(L,G,"⊙","\\odot",!0),I(L,G,"⊕︎","\\oplus"),I(L,G,"⊗","\\otimes",!0),I(L,X,"∂","\\partial",!0),I(L,G,"⊘","\\oslash",!0),I(L,G,"⊚","\\circledcirc",!0),I(L,G,"⊡","\\boxdot",!0),I(L,G,"△","\\bigtriangleup"),I(L,G,"▽","\\bigtriangledown"),I(L,G,"†","\\dagger"),I(L,G,"⋄","\\diamond"),I(L,G,"◃","\\triangleleft"),I(L,G,"▹","\\triangleright"),I(L,H,"{","\\{"),I(F,X,"{","\\{"),I(F,X,"{","\\textbraceleft"),I(L,j,"}","\\}"),I(F,X,"}","\\}"),I(F,X,"}","\\textbraceright"),I(L,H,"{","\\lbrace"),I(L,j,"}","\\rbrace"),I(L,H,"[","\\lbrack",!0),I(F,X,"[","\\lbrack",!0),I(L,j,"]","\\rbrack",!0),I(F,X,"]","\\rbrack",!0),I(L,H,"(","\\lparen",!0),I(L,j,")","\\rparen",!0),I(L,H,"⦇","\\llparenthesis",!0),I(L,j,"⦈","\\rrparenthesis",!0),I(F,X,"<","\\textless",!0),I(F,X,">","\\textgreater",!0),I(L,H,"⌊","\\lfloor",!0),I(L,j,"⌋","\\rfloor",!0),I(L,H,"⌈","\\lceil",!0),I(L,j,"⌉","\\rceil",!0),I(L,X,"\\","\\backslash"),I(L,X,"|","|"),I(L,X,"|","\\vert"),I(F,X,"|","\\textbar",!0),I(L,X,"‖","\\|"),I(L,X,"‖","\\Vert"),I(F,X,"‖","\\textbardbl"),I(F,X,"~","\\textasciitilde"),I(F,X,"\\","\\textbackslash"),I(F,X,"^","\\textasciicircum"),I(L,_,"↑","\\uparrow",!0),I(L,_,"⇑","\\Uparrow",!0),I(L,_,"↓","\\downarrow",!0),I(L,_,"⇓","\\Downarrow",!0),I(L,_,"↕","\\updownarrow",!0),I(L,_,"⇕","\\Updownarrow",!0),I(L,U,"∐","\\coprod"),I(L,U,"⋁","\\bigvee"),I(L,U,"⋀","\\bigwedge"),I(L,U,"⨄","\\biguplus"),I(L,U,"⨄","\\bigcupplus"),I(L,U,"⨃","\\bigcupdot"),I(L,U,"⨇","\\bigdoublevee"),I(L,U,"⨈","\\bigdoublewedge"),I(L,U,"⋂","\\bigcap"),I(L,U,"⋃","\\bigcup"),I(L,U,"∫","\\int"),I(L,U,"∫","\\intop"),I(L,U,"∬","\\iint"),I(L,U,"∭","\\iiint"),I(L,U,"∏","\\prod"),I(L,U,"∑","\\sum"),I(L,U,"⨂","\\bigotimes"),I(L,U,"⨁","\\bigoplus"),I(L,U,"⨀","\\bigodot"),I(L,U,"⨉","\\bigtimes"),I(L,U,"∮","\\oint"),I(L,U,"∯","\\oiint"),I(L,U,"∰","\\oiiint"),I(L,U,"∱","\\intclockwise"),I(L,U,"∲","\\varointclockwise"),I(L,U,"⨌","\\iiiint"),I(L,U,"⨍","\\intbar"),I(L,U,"⨎","\\intBar"),I(L,U,"⨏","\\fint"),I(L,U,"⨒","\\rppolint"),I(L,U,"⨓","\\scpolint"),I(L,U,"⨕","\\pointint"),I(L,U,"⨖","\\sqint"),I(L,U,"⨗","\\intlarhk"),I(L,U,"⨘","\\intx"),I(L,U,"⨙","\\intcap"),I(L,U,"⨚","\\intcup"),I(L,U,"⨅","\\bigsqcap"),I(L,U,"⨆","\\bigsqcup"),I(L,U,"∫","\\smallint"),I(F,P,"…","\\textellipsis"),I(L,P,"…","\\mathellipsis"),I(F,P,"…","\\ldots",!0),I(L,P,"…","\\ldots",!0),I(L,P,"⋰","\\iddots",!0),I(L,P,"⋯","\\@cdots",!0),I(L,P,"⋱","\\ddots",!0),I(L,X,"⋮","\\varvdots"),I(F,X,"⋮","\\varvdots"),I(L,D,"ˊ","\\acute"),I(L,D,"`","\\grave"),I(L,D,"¨","\\ddot"),I(L,D,"…","\\dddot"),I(L,D,"….","\\ddddot"),I(L,D,"~","\\tilde"),I(L,D,"‾","\\bar"),I(L,D,"˘","\\breve"),I(L,D,"ˇ","\\check"),I(L,D,"^","\\hat"),I(L,D,"→","\\vec"),I(L,D,"˙","\\dot"),I(L,D,"˚","\\mathring"),I(L,R,"ı","\\imath",!0),I(L,R,"ȷ","\\jmath",!0),I(L,X,"ı","ı"),I(L,X,"ȷ","ȷ"),I(F,X,"ı","\\i",!0),I(F,X,"ȷ","\\j",!0),I(F,X,"ß","\\ss",!0),I(F,X,"æ","\\ae",!0),I(F,X,"œ","\\oe",!0),I(F,X,"ø","\\o",!0),I(L,R,"ø","\\o",!0),I(F,X,"Æ","\\AE",!0),I(F,X,"Œ","\\OE",!0),I(F,X,"Ø","\\O",!0),I(L,R,"Ø","\\O",!0),I(F,D,"ˊ","\\'"),I(F,D,"ˋ","\\`"),I(F,D,"ˆ","\\^"),I(F,D,"˜","\\~"),I(F,D,"ˉ","\\="),I(F,D,"˘","\\u"),I(F,D,"˙","\\."),I(F,D,"¸","\\c"),I(F,D,"˚","\\r"),I(F,D,"ˇ","\\v"),I(F,D,"¨",'\\"'),I(F,D,"˝","\\H"),I(L,D,"ˊ","\\'"),I(L,D,"ˋ","\\`"),I(L,D,"ˆ","\\^"),I(L,D,"˜","\\~"),I(L,D,"ˉ","\\="),I(L,D,"˘","\\u"),I(L,D,"˙","\\."),I(L,D,"¸","\\c"),I(L,D,"˚","\\r"),I(L,D,"ˇ","\\v"),I(L,D,"¨",'\\"'),I(L,D,"˝","\\H");const Z={"--":!0,"---":!0,"``":!0,"''":!0};I(F,X,"–","--",!0),I(F,X,"–","\\textendash"),I(F,X,"—","---",!0),I(F,X,"—","\\textemdash"),I(F,X,"‘","`",!0),I(F,X,"‘","\\textquoteleft"),I(F,X,"’","'",!0),I(F,X,"’","\\textquoteright"),I(F,X,"“","``",!0),I(F,X,"“","\\textquotedblleft"),I(F,X,"”","''",!0),I(F,X,"”","\\textquotedblright"),I(L,X,"°","\\degree",!0),I(F,X,"°","\\degree"),I(F,X,"°","\\textdegree",!0),I(L,X,"£","\\pounds"),I(L,X,"£","\\mathsterling",!0),I(F,X,"£","\\pounds"),I(F,X,"£","\\textsterling",!0),I(L,X,"✠","\\maltese"),I(F,X,"✠","\\maltese"),I(L,X,"€","\\euro",!0),I(F,X,"€","\\euro",!0),I(F,X,"€","\\texteuro"),I(L,X,"©","\\copyright",!0),I(F,X,"©","\\textcopyright"),I(L,X,"⌀","\\diameter",!0),I(F,X,"⌀","\\diameter"),I(L,X,"𝛤","\\varGamma"),I(L,X,"𝛥","\\varDelta"),I(L,X,"𝛩","\\varTheta"),I(L,X,"𝛬","\\varLambda"),I(L,X,"𝛯","\\varXi"),I(L,X,"𝛱","\\varPi"),I(L,X,"𝛴","\\varSigma"),I(L,X,"𝛶","\\varUpsilon"),I(L,X,"𝛷","\\varPhi"),I(L,X,"𝛹","\\varPsi"),I(L,X,"𝛺","\\varOmega"),I(F,X,"𝛤","\\varGamma"),I(F,X,"𝛥","\\varDelta"),I(F,X,"𝛩","\\varTheta"),I(F,X,"𝛬","\\varLambda"),I(F,X,"𝛯","\\varXi"),I(F,X,"𝛱","\\varPi"),I(F,X,"𝛴","\\varSigma"),I(F,X,"𝛶","\\varUpsilon"),I(F,X,"𝛷","\\varPhi"),I(F,X,"𝛹","\\varPsi"),I(F,X,"𝛺","\\varOmega");const Y='0123456789/@."';for(let e=0;e<14;e++){const t=Y.charAt(e);I(L,X,t,t)}const K='0123456789!@*()-=+";:?/.,';for(let e=0;e<25;e++){const t=K.charAt(e);I(F,X,t,t)}const J="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";for(let e=0;e<52;e++){const t=J.charAt(e);I(L,R,t,t),I(F,X,t,t)}const Q="ÇÐÞçþℂℍℕℙℚℝℤℎℏℊℋℌℐℑℒℓ℘ℛℜℬℰℱℳℭℨ";for(let e=0;e<30;e++){const t=Q.charAt(e);I(L,R,t,t),I(F,X,t,t)}let ee="";for(let e=0;e<52;e++){ee=String.fromCharCode(55349,56320+e),I(L,R,ee,ee),I(F,X,ee,ee),ee=String.fromCharCode(55349,56372+e),I(L,R,ee,ee),I(F,X,ee,ee),ee=String.fromCharCode(55349,56424+e),I(L,R,ee,ee),I(F,X,ee,ee),ee=String.fromCharCode(55349,56580+e),I(L,R,ee,ee),I(F,X,ee,ee),ee=String.fromCharCode(55349,56736+e),I(L,R,ee,ee),I(F,X,ee,ee),ee=String.fromCharCode(55349,56788+e),I(L,R,ee,ee),I(F,X,ee,ee),ee=String.fromCharCode(55349,56840+e),I(L,R,ee,ee),I(F,X,ee,ee),ee=String.fromCharCode(55349,56944+e),I(L,R,ee,ee),I(F,X,ee,ee),ee=String.fromCharCode(55349,56632+e),I(L,R,ee,ee),I(F,X,ee,ee);const t=J.charAt(e);ee=String.fromCharCode(55349,56476+e),I(L,R,t,ee),I(F,X,t,ee)}for(let e=0;e<10;e++)ee=String.fromCharCode(55349,57294+e),I(L,R,ee,ee),I(F,X,ee,ee),ee=String.fromCharCode(55349,57314+e),I(L,R,ee,ee),I(F,X,ee,ee),ee=String.fromCharCode(55349,57324+e),I(L,R,ee,ee),I(F,X,ee,ee),ee=String.fromCharCode(55349,57334+e),I(L,R,ee,ee),I(F,X,ee,ee);const te=function(e,t,r){return!E[t][e]||!E[t][e].replace||55349===e.charCodeAt(0)||Object.prototype.hasOwnProperty.call(Z,e)&&r&&(r.fontFamily&&"tt"===r.fontFamily.slice(4,6)||r.font&&"tt"===r.font.slice(4,6))||(e=E[t][e].replace),new T.TextNode(e)},re=(e,t)=>{if(0===e.children.length||"mtext"!==e.children[e.children.length-1].type){const r=new T.MathNode("mtext",[new T.TextNode(t.children[0].text)]);e.children.push(r)}else e.children[e.children.length-1].children[0].text+=t.children[0].text},ne=e=>{if("mrow"!==e.type&&"mstyle"!==e.type)return e;if(0===e.children.length)return e;const t=new T.MathNode("mrow");for(let r=0;r<e.children.length;r++){const n=e.children[r];if("mtext"===n.type&&0===Object.keys(n.attributes).length)re(t,n);else if("mrow"===n.type){let e=!0;for(let t=0;t<n.children.length;t++){if("mtext"!==n.children[t].type||0!==Object.keys(n.attributes).length){e=!1;break}}if(e)for(let e=0;e<n.children.length;e++){const r=n.children[e];re(t,r)}else t.children.push(n)}else t.children.push(n)}for(let r=0;r<t.children.length;r++)if("mtext"===t.children[r].type){const n=t.children[r];" "===n.children[0].text.charAt(0)&&(n.children[0].text=" "+n.children[0].text.slice(1));const s=n.children[0].text.length;s>0&&" "===n.children[0].text.charAt(s-1)&&(n.children[0].text=n.children[0].text.slice(0,-1)+" ");for(const[t,r]of Object.entries(e.attributes))n.attributes[t]=r}return 1===t.children.length&&"mtext"===t.children[0].type?t.children[0]:t},se=function(e,t=!1){if(!(1!==e.length||e[0]instanceof u))return e[0];if(!t){e[0]instanceof v&&"mo"===e[0].type&&!e[0].attributes.fence&&(e[0].attributes.lspace="0em",e[0].attributes.rspace="0em");const t=e.length-1;e[t]instanceof v&&"mo"===e[t].type&&!e[t].attributes.fence&&(e[t].attributes.lspace="0em",e[t].attributes.rspace="0em")}return new T.MathNode("mrow",e)};function oe(e){if(!e)return!1;if("mi"===e.type&&1===e.children.length){const t=e.children[0];return t instanceof A&&"."===t.text}if("mtext"===e.type&&1===e.children.length){const t=e.children[0];return t instanceof A&&" "===t.text}if("mo"===e.type&&1===e.children.length&&"true"===e.getAttribute("separator")&&"0em"===e.getAttribute("lspace")&&"0em"===e.getAttribute("rspace")){const t=e.children[0];return t instanceof A&&","===t.text}return!1}const ae=(e,t)=>{const r=e[t],n=e[t+1];return"atom"===r.type&&","===r.text&&r.loc&&n.loc&&r.loc.end===n.loc.start},ie=e=>"atom"===e.type&&"rel"===e.family||"mclass"===e.type&&"mrel"===e.mclass,le=function(e,t,r=!1){if(!r&&1===e.length){const r=me(e[0],t);return r instanceof v&&"mo"===r.type&&(r.setAttribute("lspace","0em"),r.setAttribute("rspace","0em")),[r]}const n=[],s=[];let o;for(let r=0;r<e.length;r++)s.push(me(e[r],t));for(let t=0;t<s.length;t++){const r=s[t];if(t<e.length-1&&ie(e[t])&&ie(e[t+1])&&r.setAttribute("rspace","0em"),t>0&&ie(e[t])&&ie(e[t-1])&&r.setAttribute("lspace","0em"),"mn"===r.type&&o&&"mn"===o.type)o.children.push(...r.children);else if(oe(r)&&o&&"mn"===o.type)o.children.push(...r.children);else if(o&&"mn"===o.type&&t<s.length-1&&"mn"===s[t+1].type&&ae(e,t))o.children.push(...r.children);else{if("mn"===r.type&&oe(o))r.children=[...o.children,...r.children],n.pop();else if(("msup"===r.type||"msub"===r.type)&&r.children.length>=1&&o&&("mn"===o.type||oe(o))){const e=r.children[0];e instanceof v&&"mn"===e.type&&o&&(e.children=[...o.children,...e.children],n.pop())}n.push(r),o=r}}return n},ce=function(e,t,r=!1){return se(le(e,t,r),r)},me=function(t,r){if(!t)return new T.MathNode("mrow");if(l[t.type]){return l[t.type](t,r)}throw new e("Got group of unknown type: '"+t.type+"'")},de=e=>new T.MathNode("mtd",[],[],{padding:"0",width:"50%"}),pe=["mrow","mtd","mtable","mtr"],ue=e=>{for(const t of e.children)if(t.type&&pe.includes(t.type)){if(t.classes&&"tml-label"===t.classes[0]){return t.label}{const e=ue(t);if(e)return e}}else if(!t.type){const e=ue(t);if(e)return e}};function he(e,t,r,n){let s=null;1===e.length&&"tag"===e[0].type&&(s=e[0].tag,e=e[0].body);const o=le(e,r);if(1===o.length&&o[0]instanceof x)return o[0];const a=n.displayMode||n.annotate?"none":n.wrap,i=0===o.length?null:o[0];let l=1===o.length&&null===s&&i instanceof v?o[0]:function(e,t,r){const n=[];let s=[],o=[],a=0,i=0,l=0;for(;i<e.length;){for(;e[i]instanceof u;)e.splice(i,1,...e[i].children);const r=e[i];if(r.attributes&&r.attributes.linebreak&&"newline"===r.attributes.linebreak){o.length>0&&s.push(new T.MathNode("mrow",o)),s.push(r),o=[];const e=new T.MathNode("mtd",s);e.style.textAlign="left",n.push(new T.MathNode("mtr",[e])),s=[],i+=1}else{if(o.push(r),r.type&&"mo"===r.type&&1===r.children.length&&!Object.prototype.hasOwnProperty.call(r.attributes,"movablelimits")){const n=r.children[0].text;if("([{⌊⌈⟨⟮⎰⟦⦃".indexOf(n)>-1)l+=1;else if(")]}⌋⌉⟩⟯⎱⟦⦄".indexOf(n)>-1)l-=1;else if(0===l&&"="===t&&"="===n){if(a+=1,a>1){o.pop();const e=new T.MathNode("mrow",o);s.push(e),o=[r]}}else if(0===l&&"tex"===t&&"∇"!==n){const t=i<e.length-1?e[i+1]:null;let r=!0;if(!t||"mtext"!==t.type||!t.attributes.linebreak||"nobreak"!==t.attributes.linebreak)for(let t=i+1;t<e.length;t++){const n=e[t];if(!n.type||"mspace"!==n.type||n.attributes.linebreak&&"newline"===n.attributes.linebreak)break;o.push(n),i+=1,n.attributes&&n.attributes.linebreak&&"nobreak"===n.attributes.linebreak&&(r=!1)}if(r){const e=new T.MathNode("mrow",o);s.push(e),o=[]}}}i+=1}}if(o.length>0){const e=new T.MathNode("mrow",o);s.push(e)}if(n.length>0){const e=new T.MathNode("mtd",s);e.style.textAlign="left";const t=new T.MathNode("mtr",[e]);n.push(t);const o=new T.MathNode("mtable",n);return r||(o.setAttribute("columnalign","left"),o.setAttribute("rowspacing","0em")),o}return T.newDocumentFragment(s)}(o,a,n.displayMode);if(s&&(l=((e,t,r,n)=>{t=ce(t[0].body,r),(t=ne(t)).classes.push("tml-tag");const s=ue(e);e=new T.MathNode("mtd",[e]);const o=[de(),e,de()];o[n?0:2].classes.push(n?"tml-left":"tml-right"),o[n?0:2].children.push(t);const a=new T.MathNode("mtr",o,["tml-tageqn"]);s&&a.setAttribute("id",s);const i=new T.MathNode("mtable",[a]);return i.style.width="100%",i.setAttribute("displaystyle","true"),i})(l,s,r,n.leqno)),n.annotate){const e=new T.MathNode("annotation",[new T.TextNode(t)]);e.setAttribute("encoding","application/x-tex"),l=new T.MathNode("semantics",[l,e])}const c=new T.MathNode("math",[l]);return n.xml&&c.setAttribute("xmlns","http://www.w3.org/1998/Math/MathML"),l.style.width&&(c.style.width="100%"),n.displayMode&&(c.setAttribute("display","block"),c.style.display="block math",c.classes=["tml-display"]),c}const ge="acegıȷmnopqrsuvwxyzαγεηικμνοπρςστυχωϕ𝐚𝐜𝐞𝐠𝐦𝐧𝐨𝐩𝐪𝐫𝐬𝐮𝐯𝐰𝐱𝐲𝐳",fe="ABCDEFGHIJKLMNOPQRSTUVWXYZbdfhkltΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡΣΤΥΦΧΨΩβδλζφθψ𝐀𝐁𝐂𝐃𝐄𝐅𝐆𝐇𝐈𝐉𝐊𝐋𝐌𝐍𝐎𝐏𝐐𝐑𝐒𝐓𝐔𝐕𝐖𝐗𝐘𝐙𝐛𝐝𝐟𝐡𝐤𝐥𝐭",be=new Set(["\\alpha","\\gamma","\\delta","\\epsilon","\\eta","\\iota","\\kappa","\\mu","\\nu","\\pi","\\rho","\\sigma","\\tau","\\upsilon","\\chi","\\psi","\\omega","\\imath","\\jmath"]),ye=new Set(["\\Gamma","\\Delta","\\Sigma","\\Omega","\\beta","\\delta","\\lambda","\\theta","\\psi"]),we=(e,t)=>{const r=e.isStretchy?C(e):new T.MathNode("mo",[te(e.label,e.mode)]);if("\\vec"===e.label)r.style.transform="scale(0.75) translate(10%, 30%)";else if(r.style.mathStyle="normal",r.style.mathDepth="0",ke.has(e.label)&&o.isCharacterBox(e.base)){let t="";const n=e.base.text;(ge.indexOf(n)>-1||be.has(n))&&(t="tml-xshift"),(fe.indexOf(n)>-1||ye.has(n))&&(t="tml-capshift"),t&&r.classes.push(t)}e.isStretchy||r.setAttribute("stretchy","false");return new T.MathNode("\\c"===e.label?"munder":"mover",[me(e.base,t),r])},xe=new Set(["\\acute","\\grave","\\ddot","\\dddot","\\ddddot","\\tilde","\\bar","\\breve","\\check","\\hat","\\vec","\\dot","\\mathring"]),ke=new Set(["\\acute","\\bar","\\breve","\\check","\\dot","\\ddot","\\grave","\\hat","\\mathring","\\'","\\^","\\~","\\=","\\u","\\.",'\\"',"\\r","\\H","\\v"]),ve={"\\`":"̀","\\'":"́","\\^":"̂","\\~":"̃","\\=":"̄","\\u":"̆","\\.":"̇",'\\"':"̈","\\r":"̊","\\H":"̋","\\v":"̌"};c({type:"accent",names:["\\acute","\\grave","\\ddot","\\dddot","\\ddddot","\\tilde","\\bar","\\breve","\\check","\\hat","\\vec","\\dot","\\mathring","\\overparen","\\widecheck","\\widehat","\\wideparen","\\widetilde","\\overrightarrow","\\overleftarrow","\\Overrightarrow","\\overleftrightarrow","\\overgroup","\\overleftharpoon","\\overrightharpoon"],props:{numArgs:1},handler:(e,t)=>{const r=d(t[0]),n=!xe.has(e.funcName);return{type:"accent",mode:e.parser.mode,label:e.funcName,isStretchy:n,base:r}},mathmlBuilder:we}),c({type:"accent",names:["\\'","\\`","\\^","\\~","\\=","\\c","\\u","\\.",'\\"',"\\r","\\H","\\v"],props:{numArgs:1,allowedInText:!0,allowedInMath:!0,argTypes:["primitive"]},handler:(e,t)=>{const r=d(t[0]),n=e.parser.mode;return"math"===n&&e.parser.settings.strict&&console.log(`Temml parse error: Command ${e.funcName} is invalid in math mode.`),"text"===n&&r.text&&1===r.text.length&&e.funcName in ve&&ge.indexOf(r.text)>-1?{type:"textord",mode:"text",text:r.text+ve[e.funcName]}:{type:"accent",mode:n,label:e.funcName,isStretchy:!1,base:r}},mathmlBuilder:we}),c({type:"accentUnder",names:["\\underleftarrow","\\underrightarrow","\\underleftrightarrow","\\undergroup","\\underparen","\\utilde"],props:{numArgs:1},handler:({parser:e,funcName:t},r)=>{const n=r[0];return{type:"accentUnder",mode:e.mode,label:t,base:n}},mathmlBuilder:(e,t)=>{const r=C(e);r.style["math-depth"]=0;return new T.MathNode("munder",[me(e.base,t),r])}});const Ae={pt:800/803,pc:9600/803,dd:1238/1157*800/803,cc:12.792133216944668,nd:685/642*800/803,nc:1370/107*800/803,sp:1/65536*800/803,mm:25.4/72,cm:2.54/72,in:1/72,px:96/72},Ne=["em","ex","mu","pt","mm","cm","in","px","bp","pc","dd","cc","nd","nc","sp"],Te=function(e){return"string"!=typeof e&&(e=e.unit),Ne.indexOf(e)>-1},Se=e=>[1,.7,.5][Math.max(e-1,0)],qe=function(t,r){let n=t.number;if(r.maxSize[0]<0&&n>0)return{number:0,unit:"em"};const s=t.unit;switch(s){case"mm":case"cm":case"in":case"px":return n*Ae[s]>r.maxSize[1]?{number:r.maxSize[1],unit:"pt"}:{number:n,unit:s};case"em":case"ex":return"ex"===s&&(n*=.431),n=Math.min(n/Se(r.level),r.maxSize[0]),{number:o.round(n),unit:"em"};case"bp":return n>r.maxSize[1]&&(n=r.maxSize[1]),{number:n,unit:"pt"};case"pt":case"pc":case"dd":case"cc":case"nd":case"nc":case"sp":return n=Math.min(n*Ae[s],r.maxSize[1]),{number:o.round(n),unit:"pt"};case"mu":return n=Math.min(n/18,r.maxSize[0]),{number:o.round(n),unit:"em"};default:throw new e("Invalid unit: '"+s+"'")}},Oe=e=>{const t=new T.MathNode("mspace");return t.setAttribute("width",e+"em"),t},Me=(e,t=.3,r=0,n=!1)=>{if(null==e&&0===r)return Oe(t);const s=e?[e]:[];if(0!==t&&s.unshift(Oe(t)),r>0&&s.push(Oe(r)),n){const e=new T.MathNode("mpadded",s);return e.setAttribute("height","0"),e}return new T.MathNode("mrow",s)},Be=(e,t)=>Number(e)/Se(t),Ce=(e,t,r,n)=>{const s=B(e),o="eq"===e.slice(1,3),a="x"===e.charAt(1)?"1.75":"cd"===e.slice(2,4)?"3.0":o?"1.0":"2.0";s.setAttribute("lspace","0"),s.setAttribute("rspace",o?"0.5em":"0");const i=n.withLevel(n.level<2?2:3),l=Be(a,i.level),c=Be(a,3),m=Me(null,l.toFixed(4),0),d=Me(null,c.toFixed(4),0),p=Be(o?0:.3,i.level).toFixed(4);let u,h;const g=t&&t.body&&(t.body.body||t.body.length>0);if(g){let r=me(t,i);r=Me(r,p,p,"\\\\cdrightarrow"===e||"\\\\cdleftarrow"===e),u=new T.MathNode("mover",[r,d])}const f=r&&r.body&&(r.body.body||r.body.length>0);if(f){let e=me(r,i);e=Me(e,p,p),h=new T.MathNode("munder",[e,d])}let b;return b=g||f?g&&f?new T.MathNode("munderover",[s,h,u]):g?new T.MathNode("mover",[s,u]):new T.MathNode("munder",[s,h]):new T.MathNode("mover",[s,m]),"3.0"===a&&(b.style.height="1em"),b.setAttribute("accent","false"),b};c({type:"xArrow",names:["\\xleftarrow","\\xrightarrow","\\xLeftarrow","\\xRightarrow","\\xleftrightarrow","\\xLeftrightarrow","\\xhookleftarrow","\\xhookrightarrow","\\xmapsto","\\xrightharpoondown","\\xrightharpoonup","\\xleftharpoondown","\\xleftharpoonup","\\xlongequal","\\xtwoheadrightarrow","\\xtwoheadleftarrow","\\yields","\\yieldsLeft","\\mesomerism","\\longrightharpoonup","\\longleftharpoondown","\\\\cdrightarrow","\\\\cdleftarrow","\\\\cdlongequal"],props:{numArgs:1,numOptionalArgs:1},handler:({parser:e,funcName:t},r,n)=>({type:"xArrow",mode:e.mode,name:t,body:r[0],below:n[0]}),mathmlBuilder(e,t){const r=[Ce(e.name,e.body,e.below,t)];return r.unshift(Oe(.2778)),r.push(Oe(.2778)),new T.MathNode("mrow",r)}});const ze={"\\xtofrom":["\\xrightarrow","\\xleftarrow"],"\\xleftrightharpoons":["\\xleftharpoonup","\\xrightharpoondown"],"\\xrightleftharpoons":["\\xrightharpoonup","\\xleftharpoondown"],"\\yieldsLeftRight":["\\yields","\\yieldsLeft"],"\\equilibrium":["\\longrightharpoonup","\\longleftharpoondown"],"\\equilibriumRight":["\\longrightharpoonup","\\eqleftharpoondown"],"\\equilibriumLeft":["\\eqrightharpoonup","\\longleftharpoondown"]};function $e(e,t){if(!e||e.type!==t)throw new Error(`Expected node of type ${t}, but got `+(e?`node of type ${e.type}`:String(e)));return e}function Ee(e){const t=Ie(e);if(!t)throw new Error("Expected node of symbol group type, but got "+(e?`node of type ${e.type}`:String(e)));return t}function Ie(e){return e&&("atom"===e.type||Object.prototype.hasOwnProperty.call($,e.type))?e:null}c({type:"stackedArrow",names:["\\xtofrom","\\xleftrightharpoons","\\xrightleftharpoons","\\yieldsLeftRight","\\equilibrium","\\equilibriumRight","\\equilibriumLeft"],props:{numArgs:1,numOptionalArgs:1},handler({parser:e,funcName:t},r,n){const s=r[0]?{type:"hphantom",mode:e.mode,body:r[0]}:null,o=n[0]?{type:"hphantom",mode:e.mode,body:n[0]}:null;return{type:"stackedArrow",mode:e.mode,name:t,body:r[0],upperArrowBelow:o,lowerArrowBody:s,below:n[0]}},mathmlBuilder(e,t){const r=ze[e.name][0],n=ze[e.name][1],s=Ce(r,e.body,e.upperArrowBelow,t),o=Ce(n,e.lowerArrowBody,e.below,t);let a;const i=new T.MathNode("mpadded",[s]);if(i.setAttribute("voffset","0.3em"),i.setAttribute("height","+0.3em"),i.setAttribute("depth","-0.3em"),"\\equilibriumLeft"===e.name){const e=new T.MathNode("mpadded",[o]);e.setAttribute("width","0.5em"),a=new T.MathNode("mpadded",[Oe(.2778),e,i,Oe(.2778)])}else i.setAttribute("width","\\equilibriumRight"===e.name?"0.5em":"0"),a=new T.MathNode("mpadded",[Oe(.2778),i,o,Oe(.2778)]);return a.setAttribute("voffset","-0.18em"),a.setAttribute("height","-0.18em"),a.setAttribute("depth","+0.18em"),a}});const Le={">":"\\\\cdrightarrow","<":"\\\\cdleftarrow","=":"\\\\cdlongequal",A:"\\uparrow",V:"\\downarrow","|":"\\Vert",".":"no arrow"},Fe=e=>"textord"===e.type&&"@"===e.text;function De(e,t,r){const n=Le[e];switch(n){case"\\\\cdrightarrow":case"\\\\cdleftarrow":return r.callFunction(n,[t[0]],[t[1]]);case"\\uparrow":case"\\downarrow":{const e={type:"atom",text:n,mode:"math",family:"rel"},s={type:"ordgroup",mode:"math",body:[r.callFunction("\\\\cdleft",[t[0]],[]),r.callFunction("\\Big",[e],[]),r.callFunction("\\\\cdright",[t[1]],[])],semisimple:!0};return r.callFunction("\\\\cdparent",[s],[])}case"\\\\cdlongequal":return r.callFunction("\\\\cdlongequal",[],[]);case"\\Vert":{const e={type:"textord",text:"\\Vert",mode:"math"};return r.callFunction("\\Big",[e],[])}default:return{type:"textord",text:" ",mode:"math"}}}c({type:"cdlabel",names:["\\\\cdleft","\\\\cdright"],props:{numArgs:1},handler:({parser:e,funcName:t},r)=>({type:"cdlabel",mode:e.mode,side:t.slice(4),label:r[0]}),mathmlBuilder(e,t){if(0===e.label.body.length)return new T.MathNode("mrow",t);const r=new T.MathNode("mtd",[me(e.label,t)]);r.style.padding="0";const n=new T.MathNode("mtr",[r]),s=new T.MathNode("mtable",[n]),o=new T.MathNode("mpadded",[s]);return o.setAttribute("width","0"),o.setAttribute("displaystyle","false"),o.setAttribute("scriptlevel","1"),"left"===e.side&&(o.style.display="flex",o.style.justifyContent="flex-end"),o}}),c({type:"cdlabelparent",names:["\\\\cdparent"],props:{numArgs:1},handler:({parser:e},t)=>({type:"cdlabelparent",mode:e.mode,fragment:t[0]}),mathmlBuilder:(e,t)=>new T.MathNode("mrow",[me(e.fragment,t)])}),c({type:"textord",names:["\\@char"],props:{numArgs:1,allowedInText:!0},handler({parser:t,token:r},n){const s=$e(n[0],"ordgroup").body;let o="";for(let e=0;e<s.length;e++){o+=$e(s[e],"textord").text}const a=parseInt(o);if(isNaN(a))throw new e(`\\@char has non-numeric argument ${o}`,r);return{type:"textord",mode:t.mode,text:String.fromCodePoint(a)}}});const Ge=/^(#[a-f0-9]{3}|#?[a-f0-9]{6})$/i,je=/^(#[a-f0-9]{3}|#?[a-f0-9]{6}|[a-z]+)$/i,Pe=/^ *\d{1,3} *(?:, *\d{1,3} *){2}$/,Re=/^ *[10](?:\.\d*)? *(?:, *[10](?:\.\d*)? *){2}$/,Ue=/^[a-f0-9]{6}$/i,He=e=>{let t=e.toString(16);return 1===t.length&&(t="0"+t),t},Ve=JSON.parse('{\n "Apricot": "#ffb484",\n "Aquamarine": "#08b4bc",\n "Bittersweet": "#c84c14",\n "blue": "#0000FF",\n "Blue": "#303494",\n "BlueGreen": "#08b4bc",\n "BlueViolet": "#503c94",\n "BrickRed": "#b8341c",\n "brown": "#BF8040",\n "Brown": "#802404",\n "BurntOrange": "#f8941c",\n "CadetBlue": "#78749c",\n "CarnationPink": "#f884b4",\n "Cerulean": "#08a4e4",\n "CornflowerBlue": "#40ace4",\n "cyan": "#00FFFF",\n "Cyan": "#08acec",\n "Dandelion": "#ffbc44",\n "darkgray": "#404040",\n "DarkOrchid": "#a8548c",\n "Emerald": "#08ac9c",\n "ForestGreen": "#089c54",\n "Fuchsia": "#90348c",\n "Goldenrod": "#ffdc44",\n "gray": "#808080",\n "Gray": "#98949c",\n "green": "#00FF00",\n "Green": "#08a44c",\n "GreenYellow": "#e0e474",\n "JungleGreen": "#08ac9c",\n "Lavender": "#f89cc4",\n "lightgray": "#c0c0c0",\n "lime": "#BFFF00",\n "LimeGreen": "#90c43c",\n "magenta": "#FF00FF",\n "Magenta": "#f0048c",\n "Mahogany": "#b0341c",\n "Maroon": "#b03434",\n "Melon": "#f89c7c",\n "MidnightBlue": "#086494",\n "Mulberry": "#b03c94",\n "NavyBlue": "#086cbc",\n "olive": "#7F7F00",\n "OliveGreen": "#407c34",\n "orange": "#FF8000",\n "Orange": "#f8843c",\n "OrangeRed": "#f0145c",\n "Orchid": "#b074ac",\n "Peach": "#f8945c",\n "Periwinkle": "#8074bc",\n "PineGreen": "#088c74",\n "pink": "#ff7f7f",\n "Plum": "#98248c",\n "ProcessBlue": "#08b4ec",\n "purple": "#BF0040",\n "Purple": "#a0449c",\n "RawSienna": "#983c04",\n "red": "#ff0000",\n "Red": "#f01c24",\n "RedOrange": "#f86434",\n "RedViolet": "#a0246c",\n "Rhodamine": "#f0549c",\n "Royallue": "#0874bc",\n "RoyalPurple": "#683c9c",\n "RubineRed": "#f0047c",\n "Salmon": "#f8948c",\n "SeaGreen": "#30bc9c",\n "Sepia": "#701404",\n "SkyBlue": "#48c4dc",\n "SpringGreen": "#c8dc64",\n "Tan": "#e09c74",\n "teal": "#007F7F",\n "TealBlue": "#08acb4",\n "Thistle": "#d884b4",\n "Turquoise": "#08b4cc",\n "violet": "#800080",\n "Violet": "#60449c",\n "VioletRed": "#f054a4",\n "WildStrawberry": "#f0246c",\n "yellow": "#FFFF00",\n "Yellow": "#fff404",\n "YellowGreen": "#98cc6c",\n "YellowOrange": "#ffa41c"\n}'),_e=(t,r)=>{let n="";if("HTML"===t){if(!Ge.test(r))throw new e("Invalid HTML input.");n=r}else if("RGB"===t){if(!Pe.test(r))throw new e("Invalid RGB input.");r.split(",").map((e=>{n+=He(Number(e.trim()))}))}else{if(!Re.test(r))throw new e("Invalid rbg input.");r.split(",").map((t=>{const r=Number(t.trim());if(r>1)throw new e("Color rgb input must be < 1.");n+=He(Number((255*r).toFixed(0)))}))}return"#"!==n.charAt(0)&&(n="#"+n),n},We=(t,r,n)=>{const s=`\\\\color@${t}`;if(!je.exec(t))throw new e("Invalid color: '"+t+"'",n);return Ue.test(t)?"#"+t:("#"===t.charAt(0)||(r.has(s)?t=r.get(s).tokens[0].text:Ve[t]&&(t=Ve[t])),t)},Xe=(e,t)=>{let r=le(e.body,t.withColor(e.color));return r=r.map((t=>(t.style.color=e.color,t))),T.newDocumentFragment(r)};c({type:"color",names:["\\textcolor"],props:{numArgs:2,numOptionalArgs:1,allowedInText:!0,argTypes:["raw","raw","original"]},handler({parser:e,token:t},r,n){const s=n[0]&&$e(n[0],"raw").string;let o="";if(s){const e=$e(r[0],"raw").string;o=_e(s,e)}else o=We($e(r[0],"raw").string,e.gullet.macros,t);const a=r[1];return{type:"color",mode:e.mode,color:o,isTextColor:!0,body:p(a)}},mathmlBuilder:Xe}),c({type:"color",names:["\\color"],props:{numArgs:1,numOptionalArgs:1,allowedInText:!0,argTypes:["raw","raw"]},handler({parser:e,breakOnTokenText:t,token:r},n,s){const o=s[0]&&$e(s[0],"raw").string;let a="";if(o){const e=$e(n[0],"raw").string;a=_e(o,e)}else a=We($e(n[0],"raw").string,e.gullet.macros,r);const i=e.parseExpression(!0,t,!0);return{type:"color",mode:e.mode,color:a,isTextColor:!1,body:i}},mathmlBuilder:Xe}),c({type:"color",names:["\\definecolor"],props:{numArgs:3,allowedInText:!0,argTypes:["raw","raw","raw"]},handler({parser:t,funcName:r,token:n},s){const o=$e(s[0],"raw").string;if(!/^[A-Za-z]+$/.test(o))throw new e("Color name must be latin letters.",n);const a=$e(s[1],"raw").string;if(!["HTML","RGB","rgb"].includes(a))throw new e("Color model must be HTML, RGB, or rgb.",n);const i=$e(s[2],"raw").string,l=_e(a,i);return t.gullet.macros.set(`\\\\color@${o}`,{tokens:[{text:l}],numArgs:0}),{type:"internal",mode:t.mode}}}),c({type:"cr",names:["\\\\"],props:{numArgs:0,numOptionalArgs:0,allowedInText:!0},handler({parser:e},t,r){const n="["===e.gullet.future().text?e.parseSizeGroup(!0):null,s=!e.settings.displayMode;return{type:"cr",mode:e.mode,newLine:s,size:n&&$e(n,"size").value}},mathmlBuilder(e,t){const r=new T.MathNode("mo");if(e.newLine&&(r.setAttribute("linebreak","newline"),e.size)){const n=qe(e.size,t);r.setAttribute("height",n.number+n.unit)}return r}});const Ze={"\\global":"\\global","\\long":"\\\\globallong","\\\\globallong":"\\\\globallong","\\def":"\\gdef","\\gdef":"\\gdef","\\edef":"\\xdef","\\xdef":"\\xdef","\\let":"\\\\globallet","\\futurelet":"\\\\globalfuture"},Ye=t=>{const r=t.text;if(/^(?:[\\{}$&#^_]|EOF)$/.test(r))throw new e("Expected a control sequence",t);return r},Ke=(e,t,r,n)=>{let s=e.gullet.macros.get(r.text);null==s&&(r.noexpand=!0,s={tokens:[r],numArgs:0,unexpandable:!e.gullet.isExpandable(r.text)}),e.gullet.macros.set(t,s,n)};c({type:"internal",names:["\\global","\\long","\\\\globallong"],props:{numArgs:0,allowedInText:!0},handler({parser:t,funcName:r}){t.consumeSpaces();const n=t.fetch();if(Ze[n.text])return"\\global"!==r&&"\\\\globallong"!==r||(n.text=Ze[n.text]),$e(t.parseFunction(),"internal");throw new e("Invalid token after macro prefix",n)}}),c({type:"internal",names:["\\def","\\gdef","\\edef","\\xdef"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler({parser:t,funcName:r}){let n=t.gullet.popToken();const s=n.text;if(/^(?:[\\{}$&#^_]|EOF)$/.test(s))throw new e("Expected a control sequence",n);let o,a=0;const i=[[]];for(;"{"!==t.gullet.future().text;)if(n=t.gullet.popToken(),"#"===n.text){if("{"===t.gullet.future().text){o=t.gullet.future(),i[a].push("{");break}if(n=t.gullet.popToken(),!/^[1-9]$/.test(n.text))throw new e(`Invalid argument number "${n.text}"`);if(parseInt(n.text)!==a+1)throw new e(`Argument number "${n.text}" out of order`);a++,i.push([])}else{if("EOF"===n.text)throw new e("Expected a macro definition");i[a].push(n.text)}let{tokens:l}=t.gullet.consumeArg();if(o&&l.unshift(o),"\\edef"===r||"\\xdef"===r){if(l=t.gullet.expandTokens(l),l.length>t.gullet.settings.maxExpand)throw new e("Too many expansions in an "+r);l.reverse()}return t.gullet.macros.set(s,{tokens:l,numArgs:a,delimiters:i},r===Ze[r]),{type:"internal",mode:t.mode}}}),c({type:"internal",names:["\\let","\\\\globallet"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler({parser:e,funcName:t}){const r=Ye(e.gullet.popToken());e.gullet.consumeSpaces();const n=(e=>{let t=e.gullet.popToken();return"="===t.text&&(t=e.gullet.popToken()," "===t.text&&(t=e.gullet.popToken())),t})(e);return Ke(e,r,n,"\\\\globallet"===t),{type:"internal",mode:e.mode}}}),c({type:"internal",names:["\\futurelet","\\\\globalfuture"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler({parser:e,funcName:t}){const r=Ye(e.gullet.popToken()),n=e.gullet.popToken(),s=e.gullet.popToken();return Ke(e,r,s,"\\\\globalfuture"===t),e.gullet.pushToken(s),e.gullet.pushToken(n),{type:"internal",mode:e.mode}}}),c({type:"internal",names:["\\newcommand","\\renewcommand","\\providecommand"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler({parser:t,funcName:r}){let n="";const s=t.gullet.popToken();"{"===s.text?(n=Ye(t.gullet.popToken()),t.gullet.popToken()):n=Ye(s);const o=t.gullet.isDefined(n);if(o&&"\\newcommand"===r)throw new e(`\\newcommand{${n}} attempting to redefine ${n}; use \\renewcommand`);if(!o&&"\\renewcommand"===r)throw new e(`\\renewcommand{${n}} when command ${n} does not yet exist; use \\newcommand`);let a=0;if("["===t.gullet.future().text){let r=t.gullet.popToken();if(r=t.gullet.popToken(),!/^[0-9]$/.test(r.text))throw new e(`Invalid number of arguments: "${r.text}"`);if(a=parseInt(r.text),r=t.gullet.popToken(),"]"!==r.text)throw new e(`Invalid argument "${r.text}"`)}const{tokens:i}=t.gullet.consumeArg();return"\\providecommand"===r&&t.gullet.macros.has(n)||t.gullet.macros.set(n,{tokens:i,numArgs:a}),{type:"internal",mode:t.mode}}});const Je={"\\bigl":{mclass:"mopen",size:1},"\\Bigl":{mclass:"mopen",size:2},"\\biggl":{mclass:"mopen",size:3},"\\Biggl":{mclass:"mopen",size:4},"\\bigr":{mclass:"mclose",size:1},"\\Bigr":{mclass:"mclose",size:2},"\\biggr":{mclass:"mclose",size:3},"\\Biggr":{mclass:"mclose",size:4},"\\bigm":{mclass:"mrel",size:1},"\\Bigm":{mclass:"mrel",size:2},"\\biggm":{mclass:"mrel",size:3},"\\Biggm":{mclass:"mrel",size:4},"\\big":{mclass:"mord",size:1},"\\Big":{mclass:"mord",size:2},"\\bigg":{mclass:"mord",size:3},"\\Bigg":{mclass:"mord",size:4}},Qe=["(","\\lparen",")","\\rparen","[","\\lbrack","]","\\rbrack","\\{","\\lbrace","\\}","\\rbrace","⦇","\\llparenthesis","⦈","\\rrparenthesis","\\lfloor","\\rfloor","⌊","⌋","\\lceil","\\rceil","⌈","⌉","<",">","\\langle","⟨","\\rangle","⟩","\\lAngle","⟪","\\rAngle","⟫","\\llangle","⦉","\\rrangle","⦊","\\lt","\\gt","\\lvert","\\rvert","\\lVert","\\rVert","\\lgroup","\\rgroup","⟮","⟯","\\lmoustache","\\rmoustache","⎰","⎱","\\llbracket","\\rrbracket","⟦","⟦","\\lBrace","\\rBrace","⦃","⦄","/","\\backslash","|","\\vert","\\|","\\Vert","‖","\\uparrow","\\Uparrow","\\downarrow","\\Downarrow","\\updownarrow","\\Updownarrow","."],et=["}","\\left","\\middle","\\right"],tt=e=>e.length>0&&(Qe.includes(e)||Je[e]||et.includes(e)),rt=[0,1.2,1.8,2.4,3];function nt(t,r){const n=Ie(t);if(n&&Qe.includes(n.text))return["<","\\lt"].includes(n.text)&&(n.text="⟨"),[">","\\gt"].includes(n.text)&&(n.text="⟩"),n;throw new e(n?`Invalid delimiter '${n.text}' after '${r.funcName}'`:`Invalid delimiter type '${t.type}'`,t)}const st=["/","\\","\\backslash","\\vert","|"];c({type:"delimsizing",names:["\\bigl","\\Bigl","\\biggl","\\Biggl","\\bigr","\\Bigr","\\biggr","\\Biggr","\\bigm","\\Bigm","\\biggm","\\Biggm","\\big","\\Big","\\bigg","\\Bigg"],props:{numArgs:1,argTypes:["primitive"]},handler:(e,t)=>{const r=nt(t[0],e);return{type:"delimsizing",mode:e.parser.mode,size:Je[e.funcName].size,mclass:Je[e.funcName].mclass,delim:r.text}},mathmlBuilder:e=>{const t=[];"."===e.delim&&(e.delim=""),t.push(te(e.delim,e.mode));const r=new T.MathNode("mo",t);return"mopen"===e.mclass||"mclose"===e.mclass?r.setAttribute("fence","true"):r.setAttribute("fence","false"),(st.includes(e.delim)||e.delim.indexOf("arrow")>-1)&&r.setAttribute("stretchy","true"),r.setAttribute("symmetric","true"),r.setAttribute("minsize",rt[e.size]+"em"),r.setAttribute("maxsize",rt[e.size]+"em"),r}}),c({type:"leftright-right",names:["\\right"],props:{numArgs:1,argTypes:["primitive"]},handler:(e,t)=>({type:"leftright-right",mode:e.parser.mode,delim:nt(t[0],e).text})}),c({type:"leftright",names:["\\left"],props:{numArgs:1,argTypes:["primitive"]},handler:(t,r)=>{const n=nt(r[0],t),s=t.parser;++s.leftrightDepth;let o=s.parseExpression(!1,null,!0),a=s.fetch();for(;"\\middle"===a.text;){s.consume();const t=s.fetch().text;if(!E.math[t])throw new e(`Invalid delimiter '${t}' after '\\middle'`);nt({type:"atom",mode:"math",text:t},{funcName:"\\middle"}),o.push({type:"middle",mode:"math",delim:t}),s.consume(),o=o.concat(s.parseExpression(!1,null,!0)),a=s.fetch()}--s.leftrightDepth,s.expect("\\right",!1);const i=$e(s.parseFunction(),"leftright-right");return{type:"leftright",mode:s.mode,body:o,left:n.text,right:i.delim}},mathmlBuilder:(e,t)=>{!function(e){if(!e.body)throw new Error("Bug: The leftright ParseNode wasn't fully parsed.")}(e);const r=le(e.body,t);"."===e.left&&(e.left="");const n=new T.MathNode("mo",[te(e.left,e.mode)]);n.setAttribute("fence","true"),n.setAttribute("form","prefix"),("/"===e.left||"\\"===e.left||e.left.indexOf("arrow")>-1)&&n.setAttribute("stretchy","true"),r.unshift(n),"."===e.right&&(e.right="");const s=new T.MathNode("mo",[te(e.right,e.mode)]);if(s.setAttribute("fence","true"),s.setAttribute("form","postfix"),("∖"===e.right||e.right.indexOf("arrow")>-1)&&s.setAttribute("stretchy","true"),e.body.length>0){const t=e.body[e.body.length-1];"color"!==t.type||t.isTextColor||s.setAttribute("mathcolor",t.color)}return r.push(s),se(r)}}),c({type:"middle",names:["\\middle"],props:{numArgs:1,argTypes:["primitive"]},handler:(t,r)=>{const n=nt(r[0],t);if(!t.parser.leftrightDepth)throw new e("\\middle without preceding \\left",n);return{type:"middle",mode:t.parser.mode,delim:n.text}},mathmlBuilder:(e,t)=>{const r=te(e.delim,e.mode),n=new T.MathNode("mo",[r]);return n.setAttribute("fence","true"),e.delim.indexOf("arrow")>-1&&n.setAttribute("stretchy","true"),n.setAttribute("form","prefix"),n.setAttribute("lspace","0.05em"),n.setAttribute("rspace","0.05em"),n}});const ot=e=>{const t=new T.MathNode("mspace");return t.setAttribute("width","3pt"),t},at=(e,t)=>{let r;switch(r=e.label.indexOf("colorbox")>-1||"\\boxed"===e.label?new T.MathNode("mrow",[ot(),me(e.body,t),ot()]):new T.MathNode("menclose",[me(e.body,t)]),e.label){case"\\overline":r.setAttribute("notation","top"),r.classes.push("tml-overline");break;case"\\underline":r.setAttribute("notation","bottom"),r.classes.push("tml-underline");break;case"\\cancel":r.setAttribute("notation","updiagonalstrike"),r.children.push(new T.MathNode("mrow",[],["tml-cancel","upstrike"]));break;case"\\bcancel":r.setAttribute("notation","downdiagonalstrike"),r.children.push(new T.MathNode("mrow",[],["tml-cancel","downstrike"]));break;case"\\sout":r.setAttribute("notation","horizontalstrike"),r.children.push(new T.MathNode("mrow",[],["tml-cancel","sout"]));break;case"\\xcancel":r.setAttribute("notation","updiagonalstrike downdiagonalstrike"),r.classes.push("tml-xcancel");break;case"\\longdiv":r.setAttribute("notation","longdiv"),r.classes.push("longdiv-top"),r.children.push(new T.MathNode("mrow",[],["longdiv-arc"]));break;case"\\phase":r.setAttribute("notation","phasorangle"),r.classes.push("phasor-bottom"),r.children.push(new T.MathNode("mrow",[],["phasor-angle"]));break;case"\\textcircled":r.setAttribute("notation","circle"),r.classes.push("circle-pad"),r.children.push(new T.MathNode("mrow",[],["textcircle"]));break;case"\\angl":r.setAttribute("notation","actuarial"),r.classes.push("actuarial");break;case"\\boxed":r.setAttribute("notation","box"),r.classes.push("tml-box"),r.setAttribute("scriptlevel","0"),r.setAttribute("displaystyle","true");break;case"\\fbox":r.setAttribute("notation","box"),r.classes.push("tml-fbox");break;case"\\fcolorbox":case"\\colorbox":{const t={padding:"3pt 0 3pt 0"};"\\fcolorbox"===e.label&&(t.border="0.0667em solid "+String(e.borderColor)),r.style=t;break}}return e.backgroundColor&&r.setAttribute("mathbackground",e.backgroundColor),r};c({type:"enclose",names:["\\colorbox"],props:{numArgs:2,numOptionalArgs:1,allowedInText:!0,argTypes:["raw","raw","text"]},handler({parser:e,funcName:t},r,n){const s=n[0]&&$e(n[0],"raw").string;let o="";if(s){const e=$e(r[0],"raw").string;o=_e(s,e)}else o=We($e(r[0],"raw").string,e.gullet.macros);const a=r[1];return{type:"enclose",mode:e.mode,label:t,backgroundColor:o,body:a}},mathmlBuilder:at}),c({type:"enclose",names:["\\fcolorbox"],props:{numArgs:3,numOptionalArgs:1,allowedInText:!0,argTypes:["raw","raw","raw","text"]},handler({parser:e,funcName:t},r,n){const s=n[0]&&$e(n[0],"raw").string;let o,a="";if(s){const e=$e(r[0],"raw").string,t=$e(r[0],"raw").string;a=_e(s,e),o=_e(s,t)}else a=We($e(r[0],"raw").string,e.gullet.macros),o=We($e(r[1],"raw").string,e.gullet.macros);const i=r[2];return{type:"enclose",mode:e.mode,label:t,backgroundColor:o,borderColor:a,body:i}},mathmlBuilder:at}),c({type:"enclose",names:["\\fbox"],props:{numArgs:1,argTypes:["hbox"],allowedInText:!0},handler:({parser:e},t)=>({type:"enclose",mode:e.mode,label:"\\fbox",body:t[0]})}),c({type:"enclose",names:["\\angl","\\cancel","\\bcancel","\\xcancel","\\sout","\\overline","\\boxed","\\longdiv","\\phase"],props:{numArgs:1},handler({parser:e,funcName:t},r){const n=r[0];return{type:"enclose",mode:e.mode,label:t,body:n}},mathmlBuilder:at}),c({type:"enclose",names:["\\underline"],props:{numArgs:1,allowedInText:!0},handler({parser:e,funcName:t},r){const n=r[0];return{type:"enclose",mode:e.mode,label:t,body:n}},mathmlBuilder:at}),c({type:"enclose",names:["\\textcircled"],props:{numArgs:1,argTypes:["text"],allowedInArgument:!0,allowedInText:!0},handler({parser:e,funcName:t},r){const n=r[0];return{type:"enclose",mode:e.mode,label:t,body:n}},mathmlBuilder:at});const it={};function lt({type:e,names:t,props:r,handler:n,mathmlBuilder:s}){const o={type:e,numArgs:r.numArgs||0,allowedInText:!1,numOptionalArgs:0,handler:n};for(let e=0;e<t.length;++e)it[t[e]]=o;s&&(l[e]=s)}class ct{constructor(e,t,r){this.lexer=e,this.start=t,this.end=r}static range(e,t){return t?e&&e.loc&&t.loc&&e.loc.lexer===t.loc.lexer?new ct(e.loc.lexer,e.loc.start,t.loc.end):null:e&&e.loc}}class mt{constructor(e,t){this.text=e,this.loc=t}range(e,t){return new mt(t,ct.range(this,e))}}const dt=0,pt=1,ut=2,ht=3,gt={};function ft(e,t){gt[e]=t}const bt=gt;ft("\\noexpand",(function(e){const t=e.popToken();return e.isExpandable(t.text)&&(t.noexpand=!0,t.treatAsRelax=!0),{tokens:[t],numArgs:0}})),ft("\\expandafter",(function(e){const t=e.popToken();return e.expandOnce(!0),{tokens:[t],numArgs:0}})),ft("\\@firstoftwo",(function(e){return{tokens:e.consumeArgs(2)[0],numArgs:0}})),ft("\\@secondoftwo",(function(e){return{tokens:e.consumeArgs(2)[1],numArgs:0}})),ft("\\@ifnextchar",(function(e){const t=e.consumeArgs(3);e.consumeSpaces();const r=e.future();return 1===t[0].length&&t[0][0].text===r.text?{tokens:t[1],numArgs:0}:{tokens:t[2],numArgs:0}})),ft("\\@ifstar","\\@ifnextchar *{\\@firstoftwo{#1}}"),ft("\\TextOrMath",(function(e){const t=e.consumeArgs(2);return"text"===e.mode?{tokens:t[0],numArgs:0}:{tokens:t[1],numArgs:0}}));const yt=e=>{let t="";for(let r=e.length-1;r>-1;r--)t+=e[r].text;return t},wt={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,a:10,A:10,b:11,B:11,c:12,C:12,d:13,D:13,e:14,E:14,f:15,F:15},xt=e=>{const t=e.future().text;return"EOF"===t?[null,""]:[wt[t.charAt(0)],t]},kt=(e,t,r)=>{for(let n=1;n<t.length;n++){e*=r,e+=wt[t.charAt(n)]}return e};function vt(e){const t=e.consumeArgs(1)[0];let r="",n=t[t.length-1].loc.start;for(let e=t.length-1;e>=0;e--){const s=t[e].loc.start;s>n&&(r+=" ",n=s),r+=t[e].text,n+=t[e].text.length}return r}ft("\\char",(function(t){let r,n=t.popToken(),s="";if("'"===n.text)r=8,n=t.popToken();else if('"'===n.text)r=16,n=t.popToken();else if("`"===n.text)if(n=t.popToken(),"\\"===n.text[0])s=n.text.charCodeAt(1);else{if("EOF"===n.text)throw new e("\\char` missing argument");s=n.text.charCodeAt(0)}else r=10;if(r){let o,a=n.text;if(s=wt[a.charAt(0)],null==s||s>=r)throw new e(`Invalid base-${r} digit ${n.text}`);for(s=kt(s,a,r),[o,a]=xt(t);null!=o&&o<r;)s*=r,s+=o,s=kt(s,a,r),t.popToken(),[o,a]=xt(t)}return`\\@char{${s}}`})),ft("\\surd","\\sqrt{\\vphantom{|}}"),ft("⊕","\\oplus"),ft("\\long",""),ft("\\bgroup","{"),ft("\\egroup","}"),ft("~","\\nobreakspace"),ft("\\lq","`"),ft("\\rq","'"),ft("\\aa","\\r a"),ft("\\Bbbk","\\Bbb{k}"),ft("\\mathstrut","\\vphantom{(}"),ft("\\underbar","\\underline{\\text{#1}}"),ft("\\vdots","{\\varvdots\\rule{0pt}{15pt}}"),ft("⋮","\\vdots"),ft("\\arraystretch","1"),ft("\\arraycolsep","6pt"),ft("\\substack","\\begin{subarray}{c}#1\\end{subarray}"),ft("\\iff","\\DOTSB\\;\\Longleftrightarrow\\;"),ft("\\implies","\\DOTSB\\;\\Longrightarrow\\;"),ft("\\impliedby","\\DOTSB\\;\\Longleftarrow\\;");const At={",":"\\dotsc","\\not":"\\dotsb","+":"\\dotsb","=":"\\dotsb","<":"\\dotsb",">":"\\dotsb","-":"\\dotsb","*":"\\dotsb",":":"\\dotsb","\\DOTSB":"\\dotsb","\\coprod":"\\dotsb","\\bigvee":"\\dotsb","\\bigwedge":"\\dotsb","\\biguplus":"\\dotsb","\\bigcap":"\\dotsb","\\bigcup":"\\dotsb","\\prod":"\\dotsb","\\sum":"\\dotsb","\\bigotimes":"\\dotsb","\\bigoplus":"\\dotsb","\\bigodot":"\\dotsb","\\bigsqcap":"\\dotsb","\\bigsqcup":"\\dotsb","\\bigtimes":"\\dotsb","\\And":"\\dotsb","\\longrightarrow":"\\dotsb","\\Longrightarrow":"\\dotsb","\\longleftarrow":"\\dotsb","\\Longleftarrow":"\\dotsb","\\longleftrightarrow":"\\dotsb","\\Longleftrightarrow":"\\dotsb","\\mapsto":"\\dotsb","\\longmapsto":"\\dotsb","\\hookrightarrow":"\\dotsb","\\doteq":"\\dotsb","\\mathbin":"\\dotsb","\\mathrel":"\\dotsb","\\relbar":"\\dotsb","\\Relbar":"\\dotsb","\\xrightarrow":"\\dotsb","\\xleftarrow":"\\dotsb","\\DOTSI":"\\dotsi","\\int":"\\dotsi","\\oint":"\\dotsi","\\iint":"\\dotsi","\\iiint":"\\dotsi","\\iiiint":"\\dotsi","\\idotsint":"\\dotsi","\\DOTSX":"\\dotsx"};ft("\\dots",(function(e){let t="\\dotso";const r=e.expandAfterFuture().text;return r in At?t=At[r]:("\\not"===r.slice(0,4)||r in E.math&&["bin","rel"].includes(E.math[r].group))&&(t="\\dotsb"),t}));const Nt={")":!0,"]":!0,"\\rbrack":!0,"\\}":!0,"\\rbrace":!0,"\\rangle":!0,"\\rceil":!0,"\\rfloor":!0,"\\rgroup":!0,"\\rmoustache":!0,"\\right":!0,"\\bigr":!0,"\\biggr":!0,"\\Bigr":!0,"\\Biggr":!0,$:!0,";":!0,".":!0,",":!0};ft("\\dotso",(function(e){return e.future().text in Nt?"\\ldots\\,":"\\ldots"})),ft("\\dotsc",(function(e){const t=e.future().text;return t in Nt&&","!==t?"\\ldots\\,":"\\ldots"})),ft("\\cdots",(function(e){return e.future().text in Nt?"\\@cdots\\,":"\\@cdots"})),ft("\\dotsb","\\cdots"),ft("\\dotsm","\\cdots"),ft("\\dotsi","\\!\\cdots"),ft("\\idotsint","\\dotsi"),ft("\\dotsx","\\ldots\\,"),ft("\\DOTSI","\\relax"),ft("\\DOTSB","\\relax"),ft("\\DOTSX","\\relax"),ft("\\tmspace","\\TextOrMath{\\kern#1#3}{\\mskip#1#2}\\relax"),ft("\\,","{\\tmspace+{3mu}{.1667em}}"),ft("\\thinspace","\\,"),ft("\\>","\\mskip{4mu}"),ft("\\:","{\\tmspace+{4mu}{.2222em}}"),ft("\\medspace","\\:"),ft("\\;","{\\tmspace+{5mu}{.2777em}}"),ft("\\thickspace","\\;"),ft("\\!","{\\tmspace-{3mu}{.1667em}}"),ft("\\negthinspace","\\!"),ft("\\negmedspace","{\\tmspace-{4mu}{.2222em}}"),ft("\\negthickspace","{\\tmspace-{5mu}{.277em}}"),ft("\\enspace","\\kern.5em "),ft("\\enskip","\\hskip.5em\\relax"),ft("\\quad","\\hskip1em\\relax"),ft("\\qquad","\\hskip2em\\relax"),ft("\\AA","\\TextOrMath{\\Angstrom}{\\mathring{A}}\\relax"),ft("\\tag","\\@ifstar\\tag@literal\\tag@paren"),ft("\\tag@paren","\\tag@literal{({#1})}"),ft("\\tag@literal",(t=>{if(t.macros.get("\\df@tag"))throw new e("Multiple \\tag");return"\\gdef\\df@tag{\\text{#1}}"})),ft("\\notag","\\nonumber"),ft("\\nonumber","\\gdef\\@eqnsw{0}"),ft("\\bmod","\\mathbin{\\text{mod}}"),ft("\\pod","\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern8mu}{\\mkern8mu}{\\mkern8mu}(#1)"),ft("\\pmod","\\pod{{\\rm mod}\\mkern6mu#1}"),ft("\\mod","\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern12mu}{\\mkern12mu}{\\mkern12mu}{\\rm mod}\\,\\,#1"),ft("\\newline","\\\\\\relax"),ft("\\TeX","\\textrm{T}\\kern-.1667em\\raisebox{-.5ex}{E}\\kern-.125em\\textrm{X}"),ft("\\LaTeX","\\textrm{L}\\kern-.35em\\raisebox{0.2em}{\\scriptstyle A}\\kern-.15em\\TeX"),ft("\\Temml","\\textrm{T}\\kern-0.2em\\lower{0.2em}{\\textrm{E}}\\kern-0.08em{\\textrm{M}\\kern-0.08em\\raise{0.2em}\\textrm{M}\\kern-0.08em\\textrm{L}}"),ft("\\hspace","\\@ifstar\\@hspacer\\@hspace"),ft("\\@hspace","\\hskip #1\\relax"),ft("\\@hspacer","\\rule{0pt}{0pt}\\hskip #1\\relax"),ft("\\colon",'\\mathpunct{\\char"3a}'),ft("\\prescript","\\pres@cript{_{#1}^{#2}}{}{#3}"),ft("\\ordinarycolon",'\\char"3a'),ft("\\vcentcolon","\\mathrel{\\raisebox{0.035em}{\\ordinarycolon}}"),ft("\\coloneq",'\\mathrel{\\raisebox{0.035em}{\\ordinarycolon}\\char"2212}'),ft("\\Coloneq",'\\mathrel{\\char"2237\\char"2212}'),ft("\\Eqqcolon",'\\mathrel{\\char"3d\\char"2237}'),ft("\\Eqcolon",'\\mathrel{\\char"2212\\char"2237}'),ft("\\colonapprox",'\\mathrel{\\raisebox{0.035em}{\\ordinarycolon}\\char"2248}'),ft("\\Colonapprox",'\\mathrel{\\char"2237\\char"2248}'),ft("\\colonsim",'\\mathrel{\\raisebox{0.035em}{\\ordinarycolon}\\char"223c}'),ft("\\Colonsim",'\\mathrel{\\raisebox{0.035em}{\\ordinarycolon}\\char"223c}'),ft("\\ratio","\\vcentcolon"),ft("\\coloncolon","\\dblcolon"),ft("\\colonequals","\\coloneqq"),ft("\\coloncolonequals","\\Coloneqq"),ft("\\equalscolon","\\eqqcolon"),ft("\\equalscoloncolon","\\Eqqcolon"),ft("\\colonminus","\\coloneq"),ft("\\coloncolonminus","\\Coloneq"),ft("\\minuscolon","\\eqcolon"),ft("\\minuscoloncolon","\\Eqcolon"),ft("\\coloncolonapprox","\\Colonapprox"),ft("\\coloncolonsim","\\Colonsim"),ft("\\notni","\\mathrel{\\char`∌}"),ft("\\limsup","\\DOTSB\\operatorname*{lim\\,sup}"),ft("\\liminf","\\DOTSB\\operatorname*{lim\\,inf}"),ft("\\injlim","\\DOTSB\\operatorname*{inj\\,lim}"),ft("\\projlim","\\DOTSB\\operatorname*{proj\\,lim}"),ft("\\varlimsup","\\DOTSB\\operatorname*{\\overline{\\text{lim}}}"),ft("\\varliminf","\\DOTSB\\operatorname*{\\underline{\\text{lim}}}"),ft("\\varinjlim","\\DOTSB\\operatorname*{\\underrightarrow{\\text{lim}}}"),ft("\\varprojlim","\\DOTSB\\operatorname*{\\underleftarrow{\\text{lim}}}"),ft("\\centerdot","{\\medspace\\rule{0.167em}{0.189em}\\medspace}"),ft("\\argmin","\\DOTSB\\operatorname*{arg\\,min}"),ft("\\argmax","\\DOTSB\\operatorname*{arg\\,max}"),ft("\\plim","\\DOTSB\\operatorname*{plim}"),ft("\\leftmodels","\\mathop{\\reflectbox{$\\models$}}"),ft("\\bra","\\mathinner{\\langle{#1}|}"),ft("\\ket","\\mathinner{|{#1}\\rangle}"),ft("\\braket","\\mathinner{\\langle{#1}\\rangle}"),ft("\\Bra","\\left\\langle#1\\right|"),ft("\\Ket","\\left|#1\\right\\rangle");const Tt=(e,t)=>{const r=`}\\,\\middle${"|"===t[0]?"\\vert":"\\Vert"}\\,{`;return e.slice(0,t.index)+r+e.slice(t.index+t[0].length)};ft("\\Braket",(function(e){let t=vt(e);const r=/\|\||\||\\\|/g;let n;for(;null!==(n=r.exec(t));)t=Tt(t,n);return"\\left\\langle{"+t+"}\\right\\rangle"})),ft("\\Set",(function(e){let t=vt(e);const r=/\|\||\||\\\|/.exec(t);return r&&(t=Tt(t,r)),"\\left\\{\\:{"+t+"}\\:\\right\\}"})),ft("\\set",(function(e){return"\\{{"+vt(e).replace(/\|/,"}\\mid{")+"}\\}"})),ft("\\angln","{\\angl n}"),ft("\\odv","\\@ifstar\\odv@next\\odv@numerator"),ft("\\odv@numerator","\\frac{\\mathrm{d}#1}{\\mathrm{d}#2}"),ft("\\odv@next","\\frac{\\mathrm{d}}{\\mathrm{d}#2}#1"),ft("\\pdv","\\@ifstar\\pdv@next\\pdv@numerator");const St=e=>{const t=e[0][0].text,r=yt(e[1]).split(","),n=String(r.length),s="1"===n?"\\partial":`\\partial^${n}`;let o="";return r.map((e=>{o+="\\partial "+e.trim()+"\\,"})),[t,s,o.replace(/\\,$/,"")]};function qt(e){const t=[];e.consumeSpaces();let r=e.fetch().text;for("\\relax"===r&&(e.consume(),e.consumeSpaces(),r=e.fetch().text);"\\hline"===r||"\\hdashline"===r;)e.consume(),t.push("\\hdashline"===r),e.consumeSpaces(),r=e.fetch().text;return t}ft("\\pdv@numerator",(function(e){const[t,r,n]=St(e.consumeArgs(2));return`\\frac{${r} ${t}}{${n}}`})),ft("\\pdv@next",(function(e){const[t,r,n]=St(e.consumeArgs(2));return`\\frac{${r}}{${n}} ${t}`})),ft("\\upalpha","\\up@greek{\\alpha}"),ft("\\upbeta","\\up@greek{\\beta}"),ft("\\upgamma","\\up@greek{\\gamma}"),ft("\\updelta","\\up@greek{\\delta}"),ft("\\upepsilon","\\up@greek{\\epsilon}"),ft("\\upzeta","\\up@greek{\\zeta}"),ft("\\upeta","\\up@greek{\\eta}"),ft("\\uptheta","\\up@greek{\\theta}"),ft("\\upiota","\\up@greek{\\iota}"),ft("\\upkappa","\\up@greek{\\kappa}"),ft("\\uplambda","\\up@greek{\\lambda}"),ft("\\upmu","\\up@greek{\\mu}"),ft("\\upnu","\\up@greek{\\nu}"),ft("\\upxi","\\up@greek{\\xi}"),ft("\\upomicron","\\up@greek{\\omicron}"),ft("\\uppi","\\up@greek{\\pi}"),ft("\\upalpha","\\up@greek{\\alpha}"),ft("\\uprho","\\up@greek{\\rho}"),ft("\\upsigma","\\up@greek{\\sigma}"),ft("\\uptau","\\up@greek{\\tau}"),ft("\\upupsilon","\\up@greek{\\upsilon}"),ft("\\upphi","\\up@greek{\\phi}"),ft("\\upchi","\\up@greek{\\chi}"),ft("\\uppsi","\\up@greek{\\psi}"),ft("\\upomega","\\up@greek{\\omega}"),ft("\\invamp",'\\mathbin{\\char"214b}'),ft("\\parr",'\\mathbin{\\char"214b}'),ft("\\with",'\\mathbin{\\char"26}'),ft("\\multimapinv",'\\mathrel{\\char"27dc}'),ft("\\multimapboth",'\\mathrel{\\char"29df}'),ft("\\scoh",'{\\mkern5mu\\char"2322\\mkern5mu}'),ft("\\sincoh",'{\\mkern5mu\\char"2323\\mkern5mu}'),ft("\\coh",'{\\mkern5mu\\rule{}{0.7em}\\mathrlap{\\smash{\\raise2mu{\\char"2322}}}\n{\\smash{\\lower4mu{\\char"2323}}}\\mkern5mu}'),ft("\\incoh",'{\\mkern5mu\\rule{}{0.7em}\\mathrlap{\\smash{\\raise2mu{\\char"2323}}}\n{\\smash{\\lower4mu{\\char"2322}}}\\mkern5mu}'),ft("\\standardstate","\\text{\\tiny\\char`⦵}");const Ot=t=>{if(!t.parser.settings.displayMode)throw new e(`{${t.envName}} can be used only in display mode.`)},Mt=/([-+]?) *(\d+(?:\.\d*)?|\.\d+) *([a-z]{2})/,Bt=e=>{let t=e.get("\\arraystretch");"string"!=typeof t&&(t=yt(t.tokens)),t=isNaN(t)?null:Number(t);let r=e.get("\\arraycolsep");"string"!=typeof r&&(r=yt(r.tokens));const n=Mt.exec(r);return[t,n?{number:+(n[1]+n[2]),unit:n[3]}:null]},Ct=t=>{let r="";for(let n=0;n<t.length;n++)if("label"===t[n].type){if(r)throw new e("Multiple \\labels in one row");r=t[n].string}return r};function zt(e){if(-1===e.indexOf("ed"))return-1===e.indexOf("*")}function $t(t,{cols:r,envClasses:n,autoTag:s,singleRow:o,emptySingleRow:a,maxNumCols:i,leqno:l,arraystretch:c,arraycolsep:m},d){t.gullet.beginGroup(),o||t.gullet.macros.set("\\cr","\\\\\\relax"),t.gullet.beginGroup();let p=[];const u=[p],h=[],g=[],f=[],b=null!=s?[]:void 0;function y(){s&&t.gullet.macros.set("\\@eqnsw","1",!0)}function w(){b&&(t.gullet.macros.get("\\df@tag")?(b.push(t.subparse([new mt("\\df@tag")])),t.gullet.macros.set("\\df@tag",void 0,!0)):b.push(Boolean(s)&&"1"===t.gullet.macros.get("\\@eqnsw")))}for(y(),f.push(qt(t));;){let r=t.parseExpression(!1,o?"\\end":"\\\\");t.gullet.endGroup(),t.gullet.beginGroup(),r={type:"ordgroup",mode:t.mode,body:r,semisimple:!0},p.push(r);const s=t.fetch().text;if("&"===s){if(i&&p.length===i){if(!n.includes("array"))throw new e(2===i?"The split environment accepts no more than two columns":"The equation environment accepts only one column",t.nextToken);if(t.settings.strict)throw new e("Too few columns specified in the {array} column argument.",t.nextToken)}t.consume()}else{if("\\end"===s){w(),1===p.length&&0===r.body.length&&(u.length>1||!a)&&u.pop(),g.push(Ct(r.body)),f.length<u.length+1&&f.push([]);break}if("\\\\"!==s)throw new e("Expected & or \\\\ or \\cr or \\end",t.nextToken);{let e;t.consume()," "!==t.gullet.future().text&&(e=t.parseSizeGroup(!0)),h.push(e?e.value:null),w(),g.push(Ct(r.body)),f.push(qt(t)),p=[],u.push(p),y()}}}return t.gullet.endGroup(),t.gullet.endGroup(),{type:"array",mode:t.mode,body:u,cols:r,rowGaps:h,hLinesBeforeRow:f,envClasses:n,autoTag:s,scriptLevel:d,tags:b,labels:g,leqno:l,arraystretch:c,arraycolsep:m}}function Et(e){return"d"===e.slice(0,1)?"display":"text"}const It={c:"center ",l:"left ",r:"right "},Lt=e=>{const t=new T.MathNode("mtd",[]);return t.style={padding:"0",width:"50%"},e.envClasses.includes("multline")&&(t.style.width="7.5%"),t},Ft=function(e,t){const r=[],n=e.body.length,s=e.hLinesBeforeRow;for(let o=0;o<n;o++){const a=e.body[o],i=[],l="text"===e.scriptLevel?pt:"script"===e.scriptLevel?ut:dt;for(let r=0;r<a.length;r++){const s=new T.MathNode("mtd",[me(a[r],t.withLevel(l))]);if(e.envClasses.includes("multline")){const e=0===o?"left":o===n-1?"right":"center";s.setAttribute("columnalign",e),"center"!==e&&s.classes.push("tml-"+e)}i.push(s)}const c=e.body[0].length;for(let e=0;e<c-a.length;e++)i.push(new T.MathNode("mtd",[],t));if(e.autoTag){const r=e.tags[o];let n;!0===r?n=new T.MathNode("mtext",[new y(["tml-eqn"])]):!1===r?n=new T.MathNode("mtext",[],[]):(n=ce(r[0].body,t.withLevel(l),!0),n=ne(n),n.classes=["tml-tag"]),n&&(i.unshift(Lt(e)),i.push(Lt(e)),e.leqno?(i[0].children.push(n),i[0].classes.push("tml-left")):(i[i.length-1].children.push(n),i[i.length-1].classes.push("tml-right")))}const m=new T.MathNode("mtr",i,[]),d=e.labels.shift();d&&e.tags&&e.tags[o]&&(m.setAttribute("id",d),Array.isArray(e.tags[o])&&m.classes.push("tml-tageqn")),0===o&&s[0].length>0&&(2===s[0].length?m.children.forEach((e=>{e.style.borderTop="0.15em double"})):m.children.forEach((e=>{e.style.borderTop=s[0][0]?"0.06em dashed":"0.06em solid"}))),s[o+1].length>0&&(2===s[o+1].length?m.children.forEach((e=>{e.style.borderBottom="0.15em double"})):m.children.forEach((e=>{e.style.borderBottom=s[o+1][0]?"0.06em dashed":"0.06em solid"}))),r.push(m)}if(e.envClasses.length>0){if(e.arraystretch&&1!==e.arraystretch){const t=String(1.4*e.arraystretch-.8)+"ex";for(let e=0;e<r.length;e++)for(let n=0;n<r[e].children.length;n++)r[e].children[n].style.paddingTop=t,r[e].children[n].style.paddingBottom=t}let n=e.envClasses.includes("abut")||e.envClasses.includes("cases")?"0":e.envClasses.includes("small")?"0.1389":e.envClasses.includes("cd")?"0.25":"0.4",s="em";if(e.arraycolsep){const r=qe(e.arraycolsep,t);n=r.number.toFixed(4),s=r.unit}const o=0===r.length?0:r[0].children.length,a=(t,r)=>0===t&&0===r||t===o-1&&1===r?"0":"align"!==e.envClasses[0]?n:1===r?"0":e.autoTag?t%2?"1":"0":t%2?"0":"1";for(let e=0;e<r.length;e++)for(let t=0;t<r[e].children.length;t++)r[e].children[t].style.paddingLeft=`${a(t,0)}${s}`,r[e].children[t].style.paddingRight=`${a(t,1)}${s}`;const i=e.envClasses.includes("align")||e.envClasses.includes("alignat");for(let t=0;t<r.length;t++){const n=r[t];if(i){for(let e=0;e<n.children.length;e++)n.children[e].classes=["tml-"+(e%2?"left":"right")];if(e.autoTag){const t=e.leqno?0:n.children.length-1;n.children[t].classes=["tml-"+(e.leqno?"left":"right")]}}if(n.children.length>1&&e.envClasses.includes("cases")&&(n.children[1].style.paddingLeft="1em"),e.envClasses.includes("cases")||e.envClasses.includes("subarray"))for(const e of n.children)e.classes.push("tml-left")}}else for(let e=0;e<r.length;e++)r[e].children[0].style.paddingLeft="0em",r[e].children.length===r[0].children.length&&(r[e].children[r[e].children.length-1].style.paddingRight="0em");let o=new T.MathNode("mtable",r);e.envClasses.length>0&&(e.envClasses.includes("jot")?o.classes.push("tml-jot"):e.envClasses.includes("small")&&o.classes.push("tml-small")),"display"===e.scriptLevel&&o.setAttribute("displaystyle","true"),(e.autoTag||e.envClasses.includes("multline"))&&(o.style.width="100%");let a="";if(e.cols&&e.cols.length>0){const t=e.cols;let r=!1,n=0,s=t.length;for(;"separator"===t[n].type;)n+=1;for(;"separator"===t[s-1].type;)s-=1;if("separator"===t[0].type){const e="separator"===t[1].type?"0.15em double":"|"===t[0].separator?"0.06em solid ":"0.06em dashed ";for(const t of o.children)t.children[0].style.borderLeft=e}let i=e.autoTag?0:-1;for(let e=n;e<s;e++)if("align"===t[e].type){const n=It[t[e].align];a+=n,i+=1;for(const e of o.children)"center"!==n.trim()&&i<e.children.length&&(e.children[i].classes=["tml-"+n.trim()]);r=!0}else if("separator"===t[e].type){if(r){const r="separator"===t[e+1].type?"0.15em double":"|"===t[e].separator?"0.06em solid":"0.06em dashed";for(const e of o.children)i<e.children.length&&(e.children[i].style.borderRight=r)}r=!1}if("separator"===t[t.length-1].type){const e="separator"===t[t.length-2].type?"0.15em double":"|"===t[t.length-1].separator?"0.06em solid":"0.06em dashed";for(const t of o.children)t.children[t.children.length-1].style.borderRight=e,t.children[t.children.length-1].style.paddingRight="0.4em"}}return e.autoTag&&(a="left "+(a.length>0?a:"center ")+"right "),a&&o.setAttribute("columnalign",a.trim()),e.envClasses.includes("small")&&(o=new T.MathNode("mstyle",[o]),o.setAttribute("scriptlevel","1")),o},Dt=function(t,r){-1===t.envName.indexOf("ed")&&Ot(t);const n="split"===t.envName,s=[],o=$t(t.parser,{cols:s,emptySingleRow:!0,autoTag:n?void 0:zt(t.envName),envClasses:["abut","jot"],maxNumCols:"split"===t.envName?2:void 0,leqno:t.parser.settings.leqno},"display");let a,i=0;const l=t.envName.indexOf("at")>-1;if(r[0]&&l){let t="";for(let e=0;e<r[0].body.length;e++){t+=$e(r[0].body[e],"textord").text}if(isNaN(t))throw new e("The alignat enviroment requires a numeric first argument.");a=Number(t),i=2*a}o.body.forEach((function(t){if(l){const r=t.length/2;if(a<r)throw new e(`Too many math in a row: expected ${a}, but got ${r}`,t[0])}else i<t.length&&(i=t.length)}));for(let e=0;e<i;++e){let t="r";e%2==1&&(t="l"),s[e]={type:"align",align:t}}return"split"===t.envName||(l?o.envClasses.push("alignat"):o.envClasses[0]="align"),o};lt({type:"array",names:["array","darray"],props:{numArgs:1},handler(t,r){const n=(Ie(r[0])?[r[0]]:$e(r[0],"ordgroup").body).map((function(t){const r=Ee(t).text;if(-1!=="lcr".indexOf(r))return{type:"align",align:r};if("|"===r)return{type:"separator",separator:"|"};if(":"===r)return{type:"separator",separator:":"};throw new e("Unknown column alignment: "+r,t)})),[s,o]=Bt(t.parser.gullet.macros),a={cols:n,envClasses:["array"],maxNumCols:n.length,arraystretch:s,arraycolsep:o};return $t(t.parser,a,Et(t.envName))},mathmlBuilder:Ft}),lt({type:"array",names:["matrix","pmatrix","bmatrix","Bmatrix","vmatrix","Vmatrix","matrix*","pmatrix*","bmatrix*","Bmatrix*","vmatrix*","Vmatrix*"],props:{numArgs:0},handler(t){const r={matrix:null,pmatrix:["(",")"],bmatrix:["[","]"],Bmatrix:["\\{","\\}"],vmatrix:["|","|"],Vmatrix:["\\Vert","\\Vert"]}[t.envName.replace("*","")];let n="c";const s={envClasses:[],cols:[]};if("*"===t.envName.charAt(t.envName.length-1)){const r=t.parser;if(r.consumeSpaces(),"["===r.fetch().text){if(r.consume(),r.consumeSpaces(),n=r.fetch().text,-1==="lcr".indexOf(n))throw new e("Expected l or c or r",r.nextToken);r.consume(),r.consumeSpaces(),r.expect("]"),r.consume(),s.cols=[]}}const o=$t(t.parser,s,"text");o.cols=new Array(o.body[0].length).fill({type:"align",align:n});const[a,i]=Bt(t.parser.gullet.macros);return r?{type:"leftright",mode:t.mode,body:[o],left:r[0],right:r[1],rightColor:void 0,arraystretch:a,arraycolsep:i}:o},mathmlBuilder:Ft}),lt({type:"array",names:["smallmatrix"],props:{numArgs:0},handler(e){const t=$t(e.parser,{type:"small"},"script");return t.envClasses=["small"],t},mathmlBuilder:Ft}),lt({type:"array",names:["subarray"],props:{numArgs:1},handler(t,r){const n=(Ie(r[0])?[r[0]]:$e(r[0],"ordgroup").body).map((function(t){const r=Ee(t).text;if(-1!=="lc".indexOf(r))return{type:"align",align:r};throw new e("Unknown column alignment: "+r,t)}));if(n.length>1)throw new e("{subarray} can contain only one column");let s={cols:n,envClasses:["small"]};if(s=$t(t.parser,s,"script"),s.body.length>0&&s.body[0].length>1)throw new e("{subarray} can contain only one column");return s},mathmlBuilder:Ft}),lt({type:"array",names:["cases","dcases","rcases","drcases"],props:{numArgs:0},handler(e){const t=$t(e.parser,{cols:[],envClasses:["cases"]},Et(e.envName));return{type:"leftright",mode:e.mode,body:[t],left:e.envName.indexOf("r")>-1?".":"\\{",right:e.envName.indexOf("r")>-1?"\\}":".",rightColor:void 0}},mathmlBuilder:Ft}),lt({type:"array",names:["align","align*","aligned","split"],props:{numArgs:0},handler:Dt,mathmlBuilder:Ft}),lt({type:"array",names:["alignat","alignat*","alignedat"],props:{numArgs:1},handler:Dt,mathmlBuilder:Ft}),lt({type:"array",names:["gathered","gather","gather*"],props:{numArgs:0},handler(e){"gathered"!==e.envName&&Ot(e);const t={cols:[],envClasses:["abut","jot"],autoTag:zt(e.envName),emptySingleRow:!0,leqno:e.parser.settings.leqno};return $t(e.parser,t,"display")},mathmlBuilder:Ft}),lt({type:"array",names:["equation","equation*"],props:{numArgs:0},handler(e){Ot(e);const t={autoTag:zt(e.envName),emptySingleRow:!0,singleRow:!0,maxNumCols:1,envClasses:["align"],leqno:e.parser.settings.leqno};return $t(e.parser,t,"display")},mathmlBuilder:Ft}),lt({type:"array",names:["multline","multline*"],props:{numArgs:0},handler(e){Ot(e);const t={autoTag:"multline"===e.envName,maxNumCols:1,envClasses:["jot","multline"],leqno:e.parser.settings.leqno};return $t(e.parser,t,"display")},mathmlBuilder:Ft}),lt({type:"array",names:["CD"],props:{numArgs:0},handler:t=>(Ot(t),function(t){const r=[];for(t.gullet.beginGroup(),t.gullet.macros.set("\\cr","\\\\\\relax"),t.gullet.beginGroup();;){r.push(t.parseExpression(!1,"\\\\")),t.gullet.endGroup(),t.gullet.beginGroup();const n=t.fetch().text;if("&"!==n&&"\\\\"!==n){if("\\end"===n){0===r[r.length-1].length&&r.pop();break}throw new e("Expected \\\\ or \\cr or \\end",t.nextToken)}t.consume()}let n=[];const s=[n];for(let i=0;i<r.length;i++){const l=r[i];let c={type:"styling",body:[],mode:"math",scriptLevel:"display"};for(let r=0;r<l.length;r++)if(Fe(l[r])){n.push(c),r+=1;const s=Ee(l[r]).text,i=new Array(2);if(i[0]={type:"ordgroup",mode:"math",body:[]},i[1]={type:"ordgroup",mode:"math",body:[]},"=|.".indexOf(s)>-1);else{if(!("<>AV".indexOf(s)>-1))throw new e('Expected one of "<>AV=|." after @.');for(let t=0;t<2;t++){let n=!0;for(let c=r+1;c<l.length;c++){if(a=s,("mathord"===(o=l[c]).type||"atom"===o.type)&&o.text===a){n=!1,r=c;break}if(Fe(l[c]))throw new e("Missing a "+s+" character to complete a CD arrow.",l[c]);i[t].body.push(l[c])}if(n)throw new e("Missing a "+s+" character to complete a CD arrow.",l[r])}}const m=De(s,i,t);n.push(m),c={type:"styling",body:[],mode:"math",scriptLevel:"display"}}else c.body.push(l[r]);i%2==0?n.push(c):n.shift(),n=[],s.push(n)}var o,a;return s.pop(),t.gullet.endGroup(),t.gullet.endGroup(),{type:"array",mode:"math",body:s,tags:null,labels:new Array(s.length+1).fill(""),envClasses:["jot","cd"],cols:[],hLinesBeforeRow:new Array(s.length+1).fill([])}}(t.parser)),mathmlBuilder:Ft}),c({type:"text",names:["\\hline","\\hdashline"],props:{numArgs:0,allowedInText:!0,allowedInMath:!0},handler(t,r){throw new e(`${t.funcName} valid only within array environment`)}});const Gt=it;c({type:"environment",names:["\\begin","\\end"],props:{numArgs:1,argTypes:["text"]},handler({parser:t,funcName:r},n){const s=n[0];if("ordgroup"!==s.type)throw new e("Invalid environment name",s);let o="";for(let e=0;e<s.body.length;++e)o+=$e(s.body[e],"textord").text;if("\\begin"===r){if(!Object.prototype.hasOwnProperty.call(Gt,o))throw new e("No such environment: "+o,s);const r=Gt[o],{args:n,optArgs:a}=t.parseArguments("\\begin{"+o+"}",r),i={mode:t.mode,envName:o,parser:t},l=r.handler(i,n,a);t.expect("\\end",!1);const c=t.nextToken,m=$e(t.parseFunction(),"environment");if(m.name!==o)throw new e(`Mismatch: \\begin{${o}} matched by \\end{${m.name}}`,c);return l}return{type:"environment",mode:t.mode,name:o,nameGroup:s}}}),c({type:"envTag",names:["\\env@tag"],props:{numArgs:1,argTypes:["math"]},handler:({parser:e},t)=>({type:"envTag",mode:e.mode,body:t[0]}),mathmlBuilder:(e,t)=>new T.MathNode("mrow")}),c({type:"noTag",names:["\\env@notag"],props:{numArgs:0},handler:({parser:e})=>({type:"noTag",mode:e.mode}),mathmlBuilder:(e,t)=>new T.MathNode("mrow")});const jt=(e,t)=>{const r=e.font,n=t.withFont(r),s=me(e.body,n);if(0===s.children.length)return s;if("boldsymbol"===r&&["mo","mpadded","mrow"].includes(s.type))return s.style.fontWeight="bold",s;if(((e,t)=>{if("mathrm"!==t||"ordgroup"!==e.body.type||1===e.body.body.length)return!1;if("mathord"!==e.body.body[0].type)return!1;for(let t=1;t<e.body.body.length;t++){const r=e.body.body[t].type;if("mathord"!==r&&("textord"!==r||isNaN(e.body.body[t].text)))return!1}return!0})(e,r)){const e=s.children[0].children[0];delete e.attributes.mathvariant;for(let t=1;t<s.children.length;t++)e.children[0].text+="mn"===s.children[t].type?s.children[t].children[0].text:s.children[t].children[0].children[0].text;const t=new T.MathNode("mtext",new T.TextNode("​"));return new T.MathNode("mrow",[t,e])}let o="mo"===s.children[0].type;for(let e=1;e<s.children.length;e++){"mo"===s.children[e].type&&"boldsymbol"===r&&(s.children[e].style.fontWeight="bold"),"mi"!==s.children[e].type&&(o=!1);"normal"!==(s.children[e].attributes&&s.children[e].attributes.mathvariant||"")&&(o=!1)}if(!o)return s;const a=s.children[0];for(let e=1;e<s.children.length;e++)a.children.push(s.children[e].children[0]);if(a.attributes.mathvariant&&"normal"===a.attributes.mathvariant){const e=new T.MathNode("mtext",new T.TextNode("​"));return new T.MathNode("mrow",[e,a])}return a},Pt={"\\Bbb":"\\mathbb","\\bold":"\\mathbf","\\frak":"\\mathfrak","\\bm":"\\boldsymbol"};c({type:"font",names:["\\mathrm","\\mathit","\\mathbf","\\mathnormal","\\up@greek","\\boldsymbol","\\mathbb","\\mathcal","\\mathfrak","\\mathscr","\\mathsf","\\mathsfit","\\mathtt","\\Bbb","\\bm","\\bold","\\frak"],props:{numArgs:1,allowedInArgument:!0},handler:({parser:e,funcName:t},r)=>{const n=d(r[0]);let s=t;return s in Pt&&(s=Pt[s]),{type:"font",mode:e.mode,font:s.slice(1),body:n}},mathmlBuilder:jt}),c({type:"font",names:["\\rm","\\sf","\\tt","\\bf","\\it","\\cal"],props:{numArgs:0,allowedInText:!0},handler:({parser:e,funcName:t,breakOnTokenText:r},n)=>{const{mode:s}=e,o=e.parseExpression(!0,r,!0);return{type:"font",mode:s,font:`math${t.slice(1)}`,body:{type:"ordgroup",mode:e.mode,body:o}}},mathmlBuilder:jt});const Rt=["display","text","script","scriptscript"],Ut={auto:-1,display:0,text:0,script:1,scriptscript:2},Ht=(e,t)=>{const r="auto"===e.scriptLevel?t.incrementLevel():"display"===e.scriptLevel?t.withLevel(pt):"text"===e.scriptLevel?t.withLevel(ut):t.withLevel(ht),n=me(e.numer,r),s=me(e.denom,r);3===t.level&&(n.style.mathDepth="2",n.setAttribute("scriptlevel","2"),s.style.mathDepth="2",s.setAttribute("scriptlevel","2"));let o=new T.MathNode("mfrac",[n,s]);if(e.hasBarLine){if(e.barSize){const r=qe(e.barSize,t);o.setAttribute("linethickness",r.number+r.unit)}}else o.setAttribute("linethickness","0px");if(null!=e.leftDelim||null!=e.rightDelim){const t=[];if(null!=e.leftDelim){const r=new T.MathNode("mo",[new T.TextNode(e.leftDelim.replace("\\",""))]);r.setAttribute("fence","true"),t.push(r)}if(t.push(o),null!=e.rightDelim){const r=new T.MathNode("mo",[new T.TextNode(e.rightDelim.replace("\\",""))]);r.setAttribute("fence","true"),t.push(r)}o=se(t)}return"auto"!==e.scriptLevel&&(o=new T.MathNode("mstyle",[o]),o.setAttribute("displaystyle",String("display"===e.scriptLevel)),o.setAttribute("scriptlevel",Ut[e.scriptLevel])),o};c({type:"genfrac",names:["\\dfrac","\\frac","\\tfrac","\\dbinom","\\binom","\\tbinom","\\\\atopfrac","\\\\bracefrac","\\\\brackfrac"],props:{numArgs:2,allowedInArgument:!0},handler:({parser:e,funcName:t},r)=>{const n=r[0],s=r[1];let o=!1,a=null,i=null,l="auto";switch(t){case"\\dfrac":case"\\frac":case"\\tfrac":o=!0;break;case"\\\\atopfrac":o=!1;break;case"\\dbinom":case"\\binom":case"\\tbinom":a="(",i=")";break;case"\\\\bracefrac":a="\\{",i="\\}";break;case"\\\\brackfrac":a="[",i="]";break;default:throw new Error("Unrecognized genfrac command")}switch(t){case"\\dfrac":case"\\dbinom":l="display";break;case"\\tfrac":case"\\tbinom":l="text"}return{type:"genfrac",mode:e.mode,continued:!1,numer:n,denom:s,hasBarLine:o,leftDelim:a,rightDelim:i,scriptLevel:l,barSize:null}},mathmlBuilder:Ht}),c({type:"genfrac",names:["\\cfrac"],props:{numArgs:2},handler:({parser:e,funcName:t},r)=>{const n=r[0],s=r[1];return{type:"genfrac",mode:e.mode,continued:!0,numer:n,denom:s,hasBarLine:!0,leftDelim:null,rightDelim:null,scriptLevel:"display",barSize:null}}}),c({type:"infix",names:["\\over","\\choose","\\atop","\\brace","\\brack"],props:{numArgs:0,infix:!0},handler({parser:e,funcName:t,token:r}){let n;switch(t){case"\\over":n="\\frac";break;case"\\choose":n="\\binom";break;case"\\atop":n="\\\\atopfrac";break;case"\\brace":n="\\\\bracefrac";break;case"\\brack":n="\\\\brackfrac";break;default:throw new Error("Unrecognized infix genfrac command")}return{type:"infix",mode:e.mode,replaceWith:n,token:r}}});const Vt=function(e){let t=null;return e.length>0&&(t=e,t="."===t?null:t),t};c({type:"genfrac",names:["\\genfrac"],props:{numArgs:6,allowedInArgument:!0,argTypes:["math","math","size","text","math","math"]},handler({parser:e},t){const r=t[4],n=t[5],s=d(t[0]),o="atom"===s.type&&"open"===s.family?Vt(s.text):null,a=d(t[1]),i="atom"===a.type&&"close"===a.family?Vt(a.text):null,l=$e(t[2],"size");let c,m=null;l.isBlank?c=!0:(m=l.value,c=m.number>0);let p="auto",u=t[3];if("ordgroup"===u.type){if(u.body.length>0){const e=$e(u.body[0],"textord");p=Rt[Number(e.text)]}}else u=$e(u,"textord"),p=Rt[Number(u.text)];return{type:"genfrac",mode:e.mode,numer:r,denom:n,continued:!1,hasBarLine:c,barSize:m,leftDelim:o,rightDelim:i,scriptLevel:p}},mathmlBuilder:Ht}),c({type:"infix",names:["\\above"],props:{numArgs:1,argTypes:["size"],infix:!0},handler:({parser:e,funcName:t,token:r},n)=>({type:"infix",mode:e.mode,replaceWith:"\\\\abovefrac",barSize:$e(n[0],"size").value,token:r})}),c({type:"genfrac",names:["\\\\abovefrac"],props:{numArgs:3,argTypes:["math","size","math"]},handler:({parser:e,funcName:t},r)=>{const n=r[0],s=function(e){if(!e)throw new Error("Expected non-null, but got "+String(e));return e}($e(r[1],"infix").barSize),o=r[2],a=s.number>0;return{type:"genfrac",mode:e.mode,numer:n,denom:o,continued:!1,hasBarLine:a,barSize:s,leftDelim:null,rightDelim:null,scriptLevel:"auto"}},mathmlBuilder:Ht}),c({type:"hbox",names:["\\hbox"],props:{numArgs:1,argTypes:["hbox"],allowedInArgument:!0,allowedInText:!1},handler:({parser:e},t)=>({type:"hbox",mode:e.mode,body:p(t[0])}),mathmlBuilder(e,t){const r=t.withLevel(pt),n=ce(e.body,r);return ne(n)}});c({type:"horizBrace",names:["\\overbrace","\\underbrace"],props:{numArgs:1},handler:({parser:e,funcName:t},r)=>({type:"horizBrace",mode:e.mode,label:t,isOver:/^\\over/.test(t),base:r[0]}),mathmlBuilder:(e,t)=>{const r=B(e.label);return r.style["math-depth"]=0,new T.MathNode(e.isOver?"mover":"munder",[me(e.base,t),r])}}),c({type:"href",names:["\\href"],props:{numArgs:2,argTypes:["url","original"],allowedInText:!0},handler:({parser:t,token:r},n)=>{const s=n[1],o=$e(n[0],"url").url;if(!t.settings.isTrusted({command:"\\href",url:o}))throw new e('Function "\\href" is not trusted',r);return{type:"href",mode:t.mode,href:o,body:p(s)}},mathmlBuilder:(e,t)=>{const r=new v("math",[ce(e.body,t)]);return new x(e.href,[],[r])}}),c({type:"href",names:["\\url"],props:{numArgs:1,argTypes:["url"],allowedInText:!0},handler:({parser:t,token:r},n)=>{const s=$e(n[0],"url").url;if(!t.settings.isTrusted({command:"\\url",url:s}))throw new e('Function "\\url" is not trusted',r);const o=[];for(let e=0;e<s.length;e++){let t=s[e];"~"===t&&(t="\\textasciitilde"),o.push({type:"textord",mode:"text",text:t})}const a={type:"text",mode:t.mode,font:"\\texttt",body:o};return{type:"href",mode:t.mode,href:s,body:p(a)}}}),c({type:"html",names:["\\class","\\id","\\style","\\data"],props:{numArgs:2,argTypes:["raw","original"],allowedInText:!0},handler:({parser:t,funcName:r,token:n},s)=>{const o=$e(s[0],"raw").string,a=s[1];if(t.settings.strict)throw new e(`Function "${r}" is disabled in strict mode`,n);let i;const l={};switch(r){case"\\class":l.class=o,i={command:"\\class",class:o};break;case"\\id":l.id=o,i={command:"\\id",id:o};break;case"\\style":l.style=o,i={command:"\\style",style:o};break;case"\\data":{const t=o.split(",");for(let r=0;r<t.length;r++){const n=t[r].split("=");if(2!==n.length)throw new e("Error parsing key-value for \\data");l["data-"+n[0].trim()]=n[1].trim()}i={command:"\\data",attributes:l};break}default:throw new Error("Unrecognized html command")}if(!t.settings.isTrusted(i))throw new e(`Function "${r}" is not trusted`,n);return{type:"html",mode:t.mode,attributes:l,body:p(a)}},mathmlBuilder:(e,t)=>{const r=ce(e.body,t),n=[];e.attributes.class&&n.push(...e.attributes.class.trim().split(/\s+/)),r.classes=n;for(const t in e.attributes)"class"!==t&&Object.prototype.hasOwnProperty.call(e.attributes,t)&&r.setAttribute(t,e.attributes[t]);return r}});const _t=function(t){if(/^[-+]? *(\d+(\.\d*)?|\.\d+)$/.test(t))return{number:+t,unit:"bp"};{const r=/([-+]?) *(\d+(?:\.\d*)?|\.\d+) *([a-z]{2})/.exec(t);if(!r)throw new e("Invalid size: '"+t+"' in \\includegraphics");const n={number:+(r[1]+r[2]),unit:r[3]};if(!Te(n))throw new e("Invalid unit: '"+n.unit+"' in \\includegraphics.");return n}};c({type:"includegraphics",names:["\\includegraphics"],props:{numArgs:1,numOptionalArgs:1,argTypes:["raw","url"],allowedInText:!1},handler:({parser:t,token:r},n,s)=>{let o={number:0,unit:"em"},a={number:.9,unit:"em"},i={number:0,unit:"em"},l="";if(s[0]){const t=$e(s[0],"raw").string.split(",");for(let r=0;r<t.length;r++){const n=t[r].split("=");if(2===n.length){const t=n[1].trim();switch(n[0].trim()){case"alt":l=t;break;case"width":o=_t(t);break;case"height":a=_t(t);break;case"totalheight":i=_t(t);break;default:throw new e("Invalid key: '"+n[0]+"' in \\includegraphics.")}}}}const c=$e(n[0],"url").url;if(""===l&&(l=c,l=l.replace(/^.*[\\/]/,""),l=l.substring(0,l.lastIndexOf("."))),!t.settings.isTrusted({command:"\\includegraphics",url:c}))throw new e('Function "\\includegraphics" is not trusted',r);return{type:"includegraphics",mode:t.mode,alt:l,width:o,height:a,totalheight:i,src:c}},mathmlBuilder:(e,t)=>{const r=qe(e.height,t),n={number:0,unit:"em"};e.totalheight.number>0&&e.totalheight.unit===r.unit&&e.totalheight.number>r.number&&(n.number=e.totalheight.number-r.number,n.unit=r.unit);let s=0;e.width.number>0&&(s=qe(e.width,t));const o={height:r.number+n.number+"em"};s.number>0&&(o.width=s.number+s.unit),n.number>0&&(o.verticalAlign=-n.number+n.unit);const a=new k(e.src,e.alt,o);return a.height=r,a.depth=n,new T.MathNode("mtext",[a])}}),c({type:"kern",names:["\\kern","\\mkern","\\hskip","\\mskip"],props:{numArgs:1,argTypes:["size"],primitive:!0,allowedInText:!0},handler({parser:t,funcName:r,token:n},s){const o=$e(s[0],"size");if(t.settings.strict){const s="m"===r[1],a="mu"===o.value.unit;if(s){if(!a)throw new e(`LaTeX's ${r} supports only mu units, not ${o.value.unit} units`,n);if("math"!==t.mode)throw new e(`LaTeX's ${r} works only in math mode`,n)}else if(a)throw new e(`LaTeX's ${r} doesn't support mu units`,n)}return{type:"kern",mode:t.mode,dimension:o.value}},mathmlBuilder(e,t){const r=qe(e.dimension,t),n="em"===r.unit?Wt(r.number):"";if("text"===e.mode&&n.length>0){const e=new T.TextNode(n);return new T.MathNode("mtext",[e])}{const e=new T.MathNode("mspace");return e.setAttribute("width",r.number+r.unit),r.number<0&&(e.style.marginLeft=r.number+r.unit),e}}});const Wt=function(e){return e>=.05555&&e<=.05556?" ":e>=.1666&&e<=.1667?" ":e>=.2222&&e<=.2223?" ":e>=.2777&&e<=.2778?"  ":""},Xt=/[^A-Za-z_0-9-]/g;c({type:"label",names:["\\label"],props:{numArgs:1,argTypes:["raw"]},handler:({parser:e},t)=>({type:"label",mode:e.mode,string:t[0].string.replace(Xt,"")}),mathmlBuilder(e,t){const r=new T.MathNode("mrow",[],["tml-label"]);return e.string.length>0&&r.setLabel(e.string),r}});const Zt=["\\clap","\\llap","\\rlap"];c({type:"lap",names:["\\mathllap","\\mathrlap","\\mathclap","\\clap","\\llap","\\rlap"],props:{numArgs:1,allowedInText:!0},handler:({parser:t,funcName:r,token:n},s)=>{if(Zt.includes(r)){if(t.settings.strict&&"text"!==t.mode)throw new e(`{${r}} can be used only in text mode.\n Try \\math${r.slice(1)}`,n);r=r.slice(1)}else r=r.slice(5);const o=s[0];return{type:"lap",mode:t.mode,alignment:r,body:o}},mathmlBuilder:(e,t)=>{let r;if("llap"===e.alignment){const n=le(p(e.body),t),s=new T.MathNode("mphantom",n);r=new T.MathNode("mpadded",[s]),r.setAttribute("width","0px")}const n=me(e.body,t);let s;if("llap"===e.alignment?(n.style.position="absolute",n.style.right="0",n.style.bottom="0",s=new T.MathNode("mpadded",[r,n])):s=new T.MathNode("mpadded",[n]),"rlap"===e.alignment)e.body.body.length>0&&"genfrac"===e.body.body[0].type&&s.setAttribute("lspace","0.16667em");else{const t="llap"===e.alignment?"-1":"-0.5";s.setAttribute("lspace",t+"width"),"llap"===e.alignment?s.style.position="relative":(s.style.display="flex",s.style.justifyContent="center")}return s.setAttribute("width","0px"),s}}),c({type:"ordgroup",names:["\\(","$"],props:{numArgs:0,allowedInText:!0,allowedInMath:!1},handler({funcName:e,parser:t},r){const n=t.mode;t.switchMode("math");const s="\\("===e?"\\)":"$",o=t.parseExpression(!1,s);return t.expect(s),t.switchMode(n),{type:"ordgroup",mode:t.mode,body:o}}}),c({type:"text",names:["\\)","\\]"],props:{numArgs:0,allowedInText:!0,allowedInMath:!1},handler(t,r){throw new e(`Mismatched ${t.funcName}`,r)}});c({type:"mathchoice",names:["\\mathchoice"],props:{numArgs:4,primitive:!0},handler:({parser:e},t)=>({type:"mathchoice",mode:e.mode,display:p(t[0]),text:p(t[1]),script:p(t[2]),scriptscript:p(t[3])}),mathmlBuilder:(e,t)=>{const r=((e,t)=>{switch(t.level){case dt:return e.display;case pt:return e.text;case ut:return e.script;case ht:return e.scriptscript;default:return e.text}})(e,t);return ce(r,t)}});const Yt=["text","textord","mathord","atom"],Kt=e=>{const t=new T.MathNode("mspace");return t.setAttribute("width",e+"em"),t};function Jt(e,t){let r;const n=le(e.body,t);if("minner"===e.mclass)r=new T.MathNode("mpadded",n);else if("mord"===e.mclass)e.isCharacterBox||"mathord"===n[0].type?(r=n[0],r.type="mi",1===r.children.length&&r.children[0].text&&"∇"===r.children[0].text&&r.setAttribute("mathvariant","normal")):r=new T.MathNode("mi",n);else{r=new T.MathNode("mrow",n),e.mustPromote?(r=n[0],r.type="mo",e.isCharacterBox&&e.body[0].text&&/[A-Za-z]/.test(e.body[0].text)&&r.setAttribute("mathvariant","italic")):r=new T.MathNode("mrow",n);const s=t.level<2;"mrow"===r.type?s&&("mbin"===e.mclass?(r.children.unshift(Kt(.2222)),r.children.push(Kt(.2222))):"mrel"===e.mclass?(r.children.unshift(Kt(.2778)),r.children.push(Kt(.2778))):"mpunct"===e.mclass?r.children.push(Kt(.1667)):"minner"===e.mclass&&(r.children.unshift(Kt(.0556)),r.children.push(Kt(.0556)))):"mbin"===e.mclass?(r.attributes.lspace=s?"0.2222em":"0",r.attributes.rspace=s?"0.2222em":"0"):"mrel"===e.mclass?(r.attributes.lspace=s?"0.2778em":"0",r.attributes.rspace=s?"0.2778em":"0"):"mpunct"===e.mclass?(r.attributes.lspace="0em",r.attributes.rspace=s?"0.1667em":"0"):"mopen"===e.mclass||"mclose"===e.mclass?(r.attributes.lspace="0em",r.attributes.rspace="0em"):"minner"===e.mclass&&s&&(r.attributes.lspace="0.0556em",r.attributes.width="+0.1111em"),"mopen"!==e.mclass&&"mclose"!==e.mclass&&(delete r.attributes.stretchy,delete r.attributes.form)}return r}c({type:"mclass",names:["\\mathord","\\mathbin","\\mathrel","\\mathopen","\\mathclose","\\mathpunct","\\mathinner"],props:{numArgs:1,primitive:!0},handler({parser:e,funcName:t},r){const n=r[0],s=o.isCharacterBox(n);let a=!0;const i={type:"mathord",text:"",mode:e.mode},l=n.body?n.body:[n];for(const t of l){if(!Yt.includes(t.type)){a=!1;break}E[e.mode][t.text]?i.text+=E[e.mode][t.text].replace:t.text?i.text+=t.text:t.body&&t.body.map((e=>{i.text+=e.text}))}return{type:"mclass",mode:e.mode,mclass:"m"+t.slice(5),body:p(a?i:n),isCharacterBox:s,mustPromote:a}},mathmlBuilder:Jt});const Qt=e=>{const t="ordgroup"===e.type&&e.body.length?e.body[0]:e;return"atom"!==t.type||"bin"!==t.family&&"rel"!==t.family?"mord":"m"+t.family};c({type:"mclass",names:["\\@binrel"],props:{numArgs:2},handler:({parser:e},t)=>({type:"mclass",mode:e.mode,mclass:Qt(t[0]),body:p(t[1]),isCharacterBox:o.isCharacterBox(t[1])})}),c({type:"mclass",names:["\\stackrel","\\overset","\\underset"],props:{numArgs:2},handler({parser:e,funcName:t},r){const n=r[1],s=r[0],o={type:"op",mode:n.mode,limits:!0,alwaysHandleSupSub:!0,parentIsSupSub:!1,symbol:!1,stack:!0,suppressBaseShift:"\\stackrel"!==t,body:p(n)};return{type:"supsub",mode:s.mode,base:o,sup:"\\underset"===t?null:s,sub:"\\underset"===t?s:null}},mathmlBuilder:Jt});const er=(e,t,r)=>{if(!e)return r;const n=me(e,t);return"mrow"===n.type&&0===n.children.length?r:n};c({type:"multiscript",names:["\\sideset","\\pres@cript"],props:{numArgs:3},handler({parser:t,funcName:r,token:n},s){if(0===s[2].body.length)throw new e(r+"cannot parse an empty base.");const o=s[2].body[0];if(t.settings.strict&&"\\sideset"===r&&!o.symbol)throw new e("The base of \\sideset must be a big operator. Try \\prescript.");if(s[0].body.length>0&&"supsub"!==s[0].body[0].type||s[1].body.length>0&&"supsub"!==s[1].body[0].type)throw new e("\\sideset can parse only subscripts and superscripts in its first two arguments",n);const a=s[0].body.length>0?s[0].body[0]:null,i=s[1].body.length>0?s[1].body[0]:null;return a||i?a?{type:"multiscript",mode:t.mode,isSideset:"\\sideset"===r,prescripts:a,postscripts:i,base:o}:{type:"styling",mode:t.mode,scriptLevel:"text",body:[{type:"supsub",mode:t.mode,base:o,sup:i.sup,sub:i.sub}]}:o},mathmlBuilder(e,t){const r=me(e.base,t),n=new T.MathNode("mprescripts"),s=new T.MathNode("none");let o=[];const a=er(e.prescripts.sub,t,s),i=er(e.prescripts.sup,t,s);if(e.isSideset&&(a.setAttribute("style","text-align: left;"),i.setAttribute("style","text-align: left;")),e.postscripts){o=[r,er(e.postscripts.sub,t,s),er(e.postscripts.sup,t,s),n,a,i]}else o=[r,n,a,i];return new T.MathNode("mmultiscripts",o)}}),c({type:"not",names:["\\not"],props:{numArgs:1,primitive:!0,allowedInText:!1},handler({parser:e},t){const r=o.isCharacterBox(t[0]);let n;if(r)n=p(t[0]),"\\"===n[0].text.charAt(0)&&(n[0].text=E.math[n[0].text].replace),n[0].text=n[0].text.slice(0,1)+"̸"+n[0].text.slice(1);else{n=[{type:"textord",mode:"math",text:"̸"},{type:"kern",mode:"math",dimension:{number:-.6,unit:"em"}},t[0]]}return{type:"not",mode:e.mode,body:n,isCharacterBox:r}},mathmlBuilder(e,t){if(e.isCharacterBox){return le(e.body,t,!0)[0]}return ce(e.body,t)}});const tr=["textord","mathord","atom"],rr=["\\smallint"],nr=["textord","mathord","ordgroup","close","leftright","font"],sr=e=>{e.attributes.lspace="0.1667em",e.attributes.rspace="0.1667em"},or=(e,t)=>{let r;if(e.symbol)r=new v("mo",[te(e.name,e.mode)]),rr.includes(e.name)?r.setAttribute("largeop","false"):r.setAttribute("movablelimits","false"),e.fromMathOp&&sr(r);else if(e.body)r=new v("mo",le(e.body,t)),e.fromMathOp&&sr(r);else if(r=new v("mi",[new A(e.name.slice(1))]),!e.parentIsSupSub){const t=[r,new v("mo",[te("⁡","text")])];if(e.needsLeadingSpace){const e=new v("mspace");e.setAttribute("width","0.1667em"),t.unshift(e)}if(!e.isFollowedByDelimiter){const e=new v("mspace");e.setAttribute("width","0.1667em"),t.push(e)}r=new v("mrow",t)}return r},ar={"∏":"\\prod","∐":"\\coprod","∑":"\\sum","⋀":"\\bigwedge","⋁":"\\bigvee","⋂":"\\bigcap","⋃":"\\bigcup","⨀":"\\bigodot","⨁":"\\bigoplus","⨂":"\\bigotimes","⨄":"\\biguplus","⨅":"\\bigsqcap","⨆":"\\bigsqcup","⨃":"\\bigcupdot","⨇":"\\bigdoublevee","⨈":"\\bigdoublewedge","⨉":"\\bigtimes"};c({type:"op",names:["\\coprod","\\bigvee","\\bigwedge","\\biguplus","\\bigcupplus","\\bigcupdot","\\bigcap","\\bigcup","\\bigdoublevee","\\bigdoublewedge","\\intop","\\prod","\\sum","\\bigotimes","\\bigoplus","\\bigodot","\\bigsqcap","\\bigsqcup","\\bigtimes","\\smallint","∏","∐","∑","⋀","⋁","⋂","⋃","⨀","⨁","⨂","⨄","⨆"],props:{numArgs:0},handler:({parser:e,funcName:t},r)=>{let n=t;return 1===n.length&&(n=ar[n]),{type:"op",mode:e.mode,limits:!0,parentIsSupSub:!1,symbol:!0,stack:!1,name:n}},mathmlBuilder:or}),c({type:"op",names:["\\mathop"],props:{numArgs:1,primitive:!0},handler:({parser:e},t)=>{const r=t[0],n=r.body?r.body:[r],s=1===n.length&&tr.includes(n[0].type);return{type:"op",mode:e.mode,limits:!0,parentIsSupSub:!1,symbol:s,fromMathOp:!0,stack:!1,name:s?n[0].text:null,body:s?null:p(r)}},mathmlBuilder:or});const ir={"∫":"\\int","∬":"\\iint","∭":"\\iiint","∮":"\\oint","∯":"\\oiint","∰":"\\oiiint","∱":"\\intclockwise","∲":"\\varointclockwise","⨌":"\\iiiint","⨍":"\\intbar","⨎":"\\intBar","⨏":"\\fint","⨒":"\\rppolint","⨓":"\\scpolint","⨕":"\\pointint","⨖":"\\sqint","⨗":"\\intlarhk","⨘":"\\intx","⨙":"\\intcap","⨚":"\\intcup"};c({type:"op",names:["\\arcsin","\\arccos","\\arctan","\\arctg","\\arcctg","\\arg","\\ch","\\cos","\\cosec","\\cosh","\\cot","\\cotg","\\coth","\\csc","\\ctg","\\cth","\\deg","\\dim","\\exp","\\hom","\\ker","\\lg","\\ln","\\log","\\sec","\\sin","\\sinh","\\sh","\\sgn","\\tan","\\tanh","\\tg","\\th"],props:{numArgs:0},handler({parser:e,funcName:t}){const r=e.prevAtomType,n=e.gullet.future().text;return{type:"op",mode:e.mode,limits:!1,parentIsSupSub:!1,symbol:!1,stack:!1,isFollowedByDelimiter:tt(n),needsLeadingSpace:r.length>0&&nr.includes(r),name:t}},mathmlBuilder:or}),c({type:"op",names:["\\det","\\gcd","\\inf","\\lim","\\max","\\min","\\Pr","\\sup"],props:{numArgs:0},handler({parser:e,funcName:t}){const r=e.prevAtomType,n=e.gullet.future().text;return{type:"op",mode:e.mode,limits:!0,parentIsSupSub:!1,symbol:!1,stack:!1,isFollowedByDelimiter:tt(n),needsLeadingSpace:r.length>0&&nr.includes(r),name:t}},mathmlBuilder:or}),c({type:"op",names:["\\int","\\iint","\\iiint","\\iiiint","\\oint","\\oiint","\\oiiint","\\intclockwise","\\varointclockwise","\\intbar","\\intBar","\\fint","\\rppolint","\\scpolint","\\pointint","\\sqint","\\intlarhk","\\intx","\\intcap","\\intcup","∫","∬","∭","∮","∯","∰","∱","∲","⨌","⨍","⨎","⨏","⨒","⨓","⨕","⨖","⨗","⨘","⨙","⨚"],props:{numArgs:0},handler({parser:e,funcName:t}){let r=t;return 1===r.length&&(r=ir[r]),{type:"op",mode:e.mode,limits:!1,parentIsSupSub:!1,symbol:!0,stack:!1,name:r}},mathmlBuilder:or});c({type:"operatorname",names:["\\operatorname@","\\operatornamewithlimits"],props:{numArgs:1,allowedInArgument:!0},handler:({parser:e,funcName:t},r)=>{const n=r[0],s=e.prevAtomType,o=e.gullet.future().text;return{type:"operatorname",mode:e.mode,body:p(n),alwaysHandleSupSub:"\\operatornamewithlimits"===t,limits:!1,parentIsSupSub:!1,isFollowedByDelimiter:tt(o),needsLeadingSpace:s.length>0&&nr.includes(s)}},mathmlBuilder:(e,t)=>{let r,n=le(e.body,t.withFont("mathrm")),s=!0;for(let e=0;e<n.length;e++){let t=n[e];if(t instanceof T.MathNode)switch("mrow"===t.type&&1===t.children.length&&t.children[0]instanceof T.MathNode&&(t=t.children[0]),t.type){case"mi":case"mn":case"ms":case"mtext":break;case"mspace":if(t.attributes.width){const r=t.attributes.width.replace("em",""),o=Wt(Number(r));""===o?s=!1:n[e]=new T.MathNode("mtext",[new T.TextNode(o)])}break;case"mo":{const e=t.children[0];1===t.children.length&&e instanceof T.TextNode?e.text=e.text.replace(/\u2212/,"-").replace(/\u2217/,"*"):s=!1;break}default:s=!1}else s=!1}if(s){const e=n.map((e=>e.toText())).join("");n=[new T.TextNode(e)]}else if(1===n.length&&["mover","munder"].includes(n[0].type)&&("mi"===n[0].children[0].type||"mtext"===n[0].children[0].type)){if(n[0].children[0].type="mi",e.parentIsSupSub)return new T.MathNode("mrow",n);{const e=new T.MathNode("mo",[te("⁡","text")]);return T.newDocumentFragment([n[0],e])}}if(s?(r=new T.MathNode("mi",n),1===n[0].text.length&&r.setAttribute("mathvariant","normal")):r=new T.MathNode("mrow",n),!e.parentIsSupSub){const t=[r,new T.MathNode("mo",[te("⁡","text")])];if(e.needsLeadingSpace){const e=new T.MathNode("mspace");e.setAttribute("width","0.1667em"),t.unshift(e)}if(!e.isFollowedByDelimiter){const e=new T.MathNode("mspace");e.setAttribute("width","0.1667em"),t.push(e)}return T.newDocumentFragment(t)}return r}}),ft("\\operatorname","\\@ifstar\\operatornamewithlimits\\operatorname@"),m({type:"ordgroup",mathmlBuilder:(e,t)=>ce(e.body,t,e.semisimple)}),c({type:"phantom",names:["\\phantom"],props:{numArgs:1,allowedInText:!0},handler:({parser:e},t)=>{const r=t[0];return{type:"phantom",mode:e.mode,body:p(r)}},mathmlBuilder:(e,t)=>{const r=le(e.body,t);return new T.MathNode("mphantom",r)}}),c({type:"hphantom",names:["\\hphantom"],props:{numArgs:1,allowedInText:!0},handler:({parser:e},t)=>{const r=t[0];return{type:"hphantom",mode:e.mode,body:r}},mathmlBuilder:(e,t)=>{const r=le(p(e.body),t),n=new T.MathNode("mphantom",r),s=new T.MathNode("mpadded",[n]);return s.setAttribute("height","0px"),s.setAttribute("depth","0px"),s}}),c({type:"vphantom",names:["\\vphantom"],props:{numArgs:1,allowedInText:!0},handler:({parser:e},t)=>{const r=t[0];return{type:"vphantom",mode:e.mode,body:r}},mathmlBuilder:(e,t)=>{const r=le(p(e.body),t),n=new T.MathNode("mphantom",r),s=new T.MathNode("mpadded",[n]);return s.setAttribute("width","0px"),s}}),c({type:"pmb",names:["\\pmb"],props:{numArgs:1,allowedInText:!0},handler:({parser:e},t)=>({type:"pmb",mode:e.mode,body:p(t[0])}),mathmlBuilder(e,t){const r=le(e.body,t),n=N(r);return n.setAttribute("style","font-weight:bold"),n}});const lr=(e,t)=>{const r=t.withLevel(pt),n=new T.MathNode("mpadded",[me(e.body,r)]),s=qe(e.dy,t);return n.setAttribute("voffset",s.number+s.unit),s.number>0?n.style.padding=s.number+s.unit+" 0 0 0":n.style.padding="0 0 "+Math.abs(s.number)+s.unit+" 0",n};c({type:"raise",names:["\\raise","\\lower"],props:{numArgs:2,argTypes:["size","primitive"],primitive:!0},handler({parser:e,funcName:t},r){const n=$e(r[0],"size").value;"\\lower"===t&&(n.number*=-1);const s=r[1];return{type:"raise",mode:e.mode,dy:n,body:s}},mathmlBuilder:lr}),c({type:"raise",names:["\\raisebox"],props:{numArgs:2,argTypes:["size","hbox"],allowedInText:!0},handler({parser:e,funcName:t},r){const n=$e(r[0],"size").value,s=r[1];return{type:"raise",mode:e.mode,dy:n,body:s}},mathmlBuilder:lr}),c({type:"ref",names:["\\ref","\\eqref"],props:{numArgs:1,argTypes:["raw"]},handler:({parser:e,funcName:t},r)=>({type:"ref",mode:e.mode,funcName:t,string:r[0].string.replace(Xt,"")}),mathmlBuilder(e,t){const r="\\ref"===e.funcName?["tml-ref"]:["tml-ref","tml-eqref"];return new x("#"+e.string,r,null)}}),c({type:"reflect",names:["\\reflectbox"],props:{numArgs:1,argTypes:["hbox"],allowedInText:!0},handler:({parser:e},t)=>({type:"reflect",mode:e.mode,body:t[0]}),mathmlBuilder(e,t){const r=me(e.body,t);return r.style.transform="scaleX(-1)",r}}),c({type:"internal",names:["\\relax"],props:{numArgs:0,allowedInText:!0},handler:({parser:e})=>({type:"internal",mode:e.mode})}),c({type:"rule",names:["\\rule"],props:{numArgs:2,numOptionalArgs:1,allowedInText:!0,allowedInMath:!0,argTypes:["size","size","size"]},handler({parser:e},t,r){const n=r[0],s=$e(t[0],"size"),o=$e(t[1],"size");return{type:"rule",mode:e.mode,shift:n&&$e(n,"size").value,width:s.value,height:o.value}},mathmlBuilder(e,t){const r=qe(e.width,t),n=qe(e.height,t),s=e.shift?qe(e.shift,t):{number:0,unit:"em"},o=t.color&&t.getColor()||"black",a=new T.MathNode("mspace");if(r.number>0&&n.number>0&&a.setAttribute("mathbackground",o),a.setAttribute("width",r.number+r.unit),a.setAttribute("height",n.number+n.unit),0===s.number)return a;const i=new T.MathNode("mpadded",[a]);return s.number>=0?i.setAttribute("height","+"+s.number+s.unit):(i.setAttribute("height",s.number+s.unit),i.setAttribute("depth","+"+-s.number+s.unit)),i.setAttribute("voffset",s.number+s.unit),i}});const cr={"\\tiny":.5,"\\sixptsize":.6,"\\Tiny":.6,"\\scriptsize":.7,"\\footnotesize":.8,"\\small":.9,"\\normalsize":1,"\\large":1.2,"\\Large":1.44,"\\LARGE":1.728,"\\huge":2.074,"\\Huge":2.488};c({type:"sizing",names:["\\tiny","\\sixptsize","\\Tiny","\\scriptsize","\\footnotesize","\\small","\\normalsize","\\large","\\Large","\\LARGE","\\huge","\\Huge"],props:{numArgs:0,allowedInText:!0},handler:({breakOnTokenText:e,funcName:t,parser:r},n)=>{r.settings.strict&&"math"===r.mode&&console.log(`Temml strict-mode warning: Command ${t} is invalid in math mode.`);const s=r.parseExpression(!1,e,!0);return{type:"sizing",mode:r.mode,funcName:t,body:s}},mathmlBuilder:(e,t)=>{const r=t.withFontSize(cr[e.funcName]),n=le(e.body,r),s=N(n),o=(cr[e.funcName]/t.fontSize).toFixed(4);return s.setAttribute("mathsize",o+"em"),s}}),c({type:"smash",names:["\\smash"],props:{numArgs:1,numOptionalArgs:1,allowedInText:!0},handler:({parser:e},t,r)=>{let n=!1,s=!1;const o=r[0]&&$e(r[0],"ordgroup");if(o){let e="";for(let t=0;t<o.body.length;++t){if(e=o.body[t].text,"t"===e)n=!0;else{if("b"!==e){n=!1,s=!1;break}s=!0}}}else n=!0,s=!0;const a=t[0];return{type:"smash",mode:e.mode,body:a,smashHeight:n,smashDepth:s}},mathmlBuilder:(e,t)=>{const r=new T.MathNode("mpadded",[me(e.body,t)]);return e.smashHeight&&r.setAttribute("height","0px"),e.smashDepth&&r.setAttribute("depth","0px"),r}}),c({type:"sqrt",names:["\\sqrt"],props:{numArgs:1,numOptionalArgs:1},handler({parser:e},t,r){const n=r[0],s=t[0];return{type:"sqrt",mode:e.mode,body:s,index:n}},mathmlBuilder(e,t){const{body:r,index:n}=e;return n?new T.MathNode("mroot",[me(r,t),me(n,t.incrementLevel())]):new T.MathNode("msqrt",[me(r,t)])}});const mr={display:0,text:1,script:2,scriptscript:3},dr={display:["0","true"],text:["0","false"],script:["1","false"],scriptscript:["2","false"]};c({type:"styling",names:["\\displaystyle","\\textstyle","\\scriptstyle","\\scriptscriptstyle"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler({breakOnTokenText:e,funcName:t,parser:r},n){const s=r.parseExpression(!0,e,!0),o=t.slice(1,t.length-5);return{type:"styling",mode:r.mode,scriptLevel:o,body:s}},mathmlBuilder(e,t){const r=t.withLevel(mr[e.scriptLevel]),n=le(e.body,r),s=N(n),o=dr[e.scriptLevel];return s.setAttribute("scriptlevel",o[0]),s.setAttribute("displaystyle",o[1]),s}});const pr=/^m(over|under|underover)$/;m({type:"supsub",mathmlBuilder(e,t){let r,n,s=!1,o=!1,a=!1,i=!1;e.base&&"horizBrace"===e.base.type&&(n=!!e.sup,n===e.base.isOver&&(s=!0,r=e.base.isOver)),!e.base||e.base.stack||"op"!==e.base.type&&"operatorname"!==e.base.type||(e.base.parentIsSupSub=!0,o=!e.base.symbol,a=o&&!e.isFollowedByDelimiter,i=e.base.needsLeadingSpace);const l=e.base&&e.base.stack?[me(e.base.body[0],t)]:[me(e.base,t)],c=t.inSubOrSup();if(e.sub){const r=me(e.sub,c);3===t.level&&r.setAttribute("scriptlevel","2"),l.push(r)}if(e.sup){const r=me(e.sup,c);3===t.level&&r.setAttribute("scriptlevel","2");const n="mrow"===r.type?r.children[0]:r;n&&"mo"===n.type&&n.classes.includes("tml-prime")&&e.base&&e.base.text&&"fF".indexOf(e.base.text)>-1&&n.classes.push("prime-pad"),l.push(r)}let m;if(s)m=r?"mover":"munder";else if(e.sub)if(e.sup){const r=e.base;m=r&&("op"===r.type&&r.limits||"multiscript"===r.type)&&(t.level===dt||r.alwaysHandleSupSub)||r&&"operatorname"===r.type&&r.alwaysHandleSupSub&&(t.level===dt||r.limits)?"munderover":"msubsup"}else{const r=e.base;m=r&&"op"===r.type&&r.limits&&(t.level===dt||r.alwaysHandleSupSub)||r&&"operatorname"===r.type&&r.alwaysHandleSupSub&&(r.limits||t.level===dt)?"munder":"msub"}else{const r=e.base;m=r&&"op"===r.type&&r.limits&&(t.level===dt||r.alwaysHandleSupSub)||r&&"operatorname"===r.type&&r.alwaysHandleSupSub&&(r.limits||t.level===dt)?"mover":"msup"}let d=new T.MathNode(m,l);if(o){const e=new T.MathNode("mo",[te("⁡","text")]);if(i){const t=new T.MathNode("mspace");t.setAttribute("width","0.1667em"),d=T.newDocumentFragment([t,d,e])}else d=T.newDocumentFragment([d,e]);if(a){const e=new T.MathNode("mspace");e.setAttribute("width","0.1667em"),d.children.push(e)}}else pr.test(m)&&(d=new T.MathNode("mrow",[d]));return d}});const ur=["\\shortmid","\\nshortmid","\\shortparallel","\\nshortparallel","\\smallsetminus"],hr=["\\Rsh","\\Lsh","\\restriction"];m({type:"atom",mathmlBuilder(e,t){const r=new T.MathNode("mo",[te(e.text,e.mode)]);return"punct"===e.family?r.setAttribute("separator","true"):"open"===e.family||"close"===e.family?"open"===e.family?(r.setAttribute("form","prefix"),r.setAttribute("stretchy","false")):"close"===e.family&&(r.setAttribute("form","postfix"),r.setAttribute("stretchy","false")):"\\mid"===e.text?(r.setAttribute("lspace","0.22em"),r.setAttribute("rspace","0.22em"),r.setAttribute("stretchy","false")):"rel"===e.family&&(e=>{if(1===e.length){const t=e.codePointAt(0);return 8591<t&&t<8704}return e.indexOf("arrow")>-1||e.indexOf("harpoon")>-1||hr.includes(e)})(e.text)?r.setAttribute("stretchy","false"):ur.includes(e.text)?r.setAttribute("mathsize","70%"):":"===e.text&&(r.attributes.lspace="0.2222em",r.attributes.rspace="0.2222em"),r}});const gr={mathbf:"bold",mathrm:"normal",textit:"italic",mathit:"italic",mathnormal:"italic",mathbb:"double-struck",mathcal:"script",mathfrak:"fraktur",mathscr:"script",mathsf:"sans-serif",mathtt:"monospace"},fr=function(e,t){if("texttt"===t.fontFamily)return"monospace";if("textsc"===t.fontFamily)return"normal";if("textsf"===t.fontFamily)return"textit"===t.fontShape&&"textbf"===t.fontWeight?"sans-serif-bold-italic":"textit"===t.fontShape?"sans-serif-italic":"textbf"===t.fontWeight?"sans-serif-bold":"sans-serif";if("textit"===t.fontShape&&"textbf"===t.fontWeight)return"bold-italic";if("textit"===t.fontShape)return"italic";if("textbf"===t.fontWeight)return"bold";const r=t.font;if(!r||"mathnormal"===r)return null;const n=e.mode;switch(r){case"mathit":case"greekItalic":return"italic";case"mathrm":{const t=e.text.codePointAt(0);return 939<t&&t<975?"italic":"normal"}case"up@greek":return"normal";case"boldsymbol":case"mathboldsymbol":return"bold-italic";case"mathbf":return"bold";case"mathbb":return"double-struck";case"mathfrak":return"fraktur";case"mathscr":case"mathcal":return"script";case"mathsf":return"sans-serif";case"mathsfit":return"sans-serif-italic";case"mathtt":return"monospace"}let s=e.text;return E[n][s]&&E[n][s].replace&&(s=E[n][s].replace),Object.prototype.hasOwnProperty.call(gr,r)?gr[r]:null},br=Object.freeze({B:8426,E:8427,F:8427,H:8387,I:8391,L:8390,M:8422,R:8393,e:8394,g:8355,o:8389}),yr=Object.freeze({C:8426,H:8388,I:8392,R:8394,Z:8398}),wr=Object.freeze({C:8383,H:8389,N:8391,P:8393,Q:8393,R:8395,Z:8394}),xr=Object.freeze({"ϵ":119527,"ϑ":119564,"ϰ":119534,"φ":119577,"ϱ":119535,"ϖ":119563}),kr=Object.freeze({"ϵ":119643,"ϑ":119680,"ϰ":119650,"φ":119693,"ϱ":119651,"ϖ":119679}),vr=Object.freeze({"ϵ":119701,"ϑ":119738,"ϰ":119708,"φ":119751,"ϱ":119709,"ϖ":119737}),Ar=Object.freeze({"ϵ":119759,"ϑ":119796,"ϰ":119766,"φ":119809,"ϱ":119767,"ϖ":119795}),Nr=Object.freeze({upperCaseLatin:{normal:e=>0,bold:e=>119743,italic:e=>119795,"bold-italic":e=>119847,script:e=>br[e]||119899,"script-bold":e=>119951,fraktur:e=>yr[e]||120003,"fraktur-bold":e=>120107,"double-struck":e=>wr[e]||120055,"sans-serif":e=>120159,"sans-serif-bold":e=>120211,"sans-serif-italic":e=>120263,"sans-serif-bold-italic":e=>120380,monospace:e=>120367},lowerCaseLatin:{normal:e=>0,bold:e=>119737,italic:e=>"h"===e?8358:119789,"bold-italic":e=>119841,script:e=>br[e]||119893,"script-bold":e=>119945,fraktur:e=>119997,"fraktur-bold":e=>120101,"double-struck":e=>120049,"sans-serif":e=>120153,"sans-serif-bold":e=>120205,"sans-serif-italic":e=>120257,"sans-serif-bold-italic":e=>120309,monospace:e=>120361},upperCaseGreek:{normal:e=>0,bold:e=>119575,italic:e=>119633,"bold-italic":e=>119575,script:e=>0,"script-bold":e=>0,fraktur:e=>0,"fraktur-bold":e=>0,"double-struck":e=>0,"sans-serif":e=>119749,"sans-serif-bold":e=>119749,"sans-serif-italic":e=>0,"sans-serif-bold-italic":e=>119807,monospace:e=>0},lowerCaseGreek:{normal:e=>0,bold:e=>119569,italic:e=>119627,"bold-italic":e=>"ϕ"===e?119678:119685,script:e=>0,"script-bold":e=>0,fraktur:e=>0,"fraktur-bold":e=>0,"double-struck":e=>0,"sans-serif":e=>119743,"sans-serif-bold":e=>119743,"sans-serif-italic":e=>0,"sans-serif-bold-italic":e=>119801,monospace:e=>0},varGreek:{normal:e=>0,bold:e=>xr[e]||-51,italic:e=>0,"bold-italic":e=>kr[e]||58,script:e=>0,"script-bold":e=>0,fraktur:e=>0,"fraktur-bold":e=>0,"double-struck":e=>0,"sans-serif":e=>vr[e]||116,"sans-serif-bold":e=>vr[e]||116,"sans-serif-italic":e=>0,"sans-serif-bold-italic":e=>Ar[e]||174,monospace:e=>0},numeral:{normal:e=>0,bold:e=>120734,italic:e=>0,"bold-italic":e=>0,script:e=>0,"script-bold":e=>0,fraktur:e=>0,"fraktur-bold":e=>0,"double-struck":e=>120744,"sans-serif":e=>120754,"sans-serif-bold":e=>120764,"sans-serif-italic":e=>0,"sans-serif-bold-italic":e=>0,monospace:e=>120774}}),Tr=(e,t)=>{const r=e.codePointAt(0),n=64<r&&r<91?"upperCaseLatin":96<r&&r<123?"lowerCaseLatin":912<r&&r<938?"upperCaseGreek":944<r&&r<970||"ϕ"===e?"lowerCaseGreek":120545<r&&r<120572||xr[e]?"varGreek":47<r&&r<58?"numeral":"other";return"other"===n?e:String.fromCodePoint(r+Nr[n][t](e))},Sr=Object.freeze({a:"ᴀ",b:"ʙ",c:"ᴄ",d:"ᴅ",e:"ᴇ",f:"ꜰ",g:"ɢ",h:"ʜ",i:"ɪ",j:"ᴊ",k:"ᴋ",l:"ʟ",m:"ᴍ",n:"ɴ",o:"ᴏ",p:"ᴘ",q:"ǫ",r:"ʀ",s:"s",t:"ᴛ",u:"ᴜ",v:"ᴠ",w:"ᴡ",x:"x",y:"ʏ",z:"ᴢ"}),qr=/^\d(?:[\d,.]*\d)?$/,Or=/[A-Ba-z]/,Mr=new Set(["\\prime","\\dprime","\\trprime","\\qprime","\\backprime","\\backdprime","\\backtrprime"]);m({type:"mathord",mathmlBuilder(e,t){const r=te(e.text,e.mode,t),n=r.text.codePointAt(0),s=912<n&&n<938?"normal":"italic",o=fr(e,t)||s;if("script"===o)return r.text=Tr(r.text,o),new T.MathNode("mi",[r],[t.font]);"italic"!==o&&(r.text=Tr(r.text,o));let a=new T.MathNode("mi",[r]);return"normal"===o&&(a.setAttribute("mathvariant","normal"),1===r.text.length&&(a=new T.MathNode("mrow",[a]))),a}}),m({type:"textord",mathmlBuilder(e,t){let r=e.text;const n=r.codePointAt(0);"textsc"===t.fontFamily&&96<n&&n<123&&(r=Sr[r]);const s=te(r,e.mode,t),o=fr(e,t)||"normal";let a;if(qr.test(e.text)){const t="text"===e.mode?"mtext":"mn";if("italic"===o||"bold-italic"===o)return((e,t,r)=>{const n=new T.MathNode(r,[e]),s=new T.MathNode("mstyle",[n]);return s.style["font-style"]="italic",s.style["font-family"]="Cambria, 'Times New Roman', serif","bold-italic"===t&&(s.style["font-weight"]="bold"),s})(s,o,t);"normal"!==o&&(s.text=s.text.split("").map((e=>Tr(e,o))).join("")),a=new T.MathNode(t,[s])}else if("text"===e.mode)"normal"!==o&&(s.text=Tr(s.text,o)),a=new T.MathNode("mtext",[s]);else if(Mr.has(e.text))a=new T.MathNode("mo",[s]),a.classes.push("tml-prime");else{const e=s.text;"italic"!==o&&(s.text=Tr(s.text,o)),a=new T.MathNode("mi",[s]),s.text===e&&Or.test(e)&&a.setAttribute("mathvariant","italic")}return a}});const Br={"\\nobreak":"nobreak","\\allowbreak":"allowbreak"},Cr={" ":{},"\\ ":{},"~":{className:"nobreak"},"\\space":{},"\\nobreakspace":{className:"nobreak"}};m({type:"spacing",mathmlBuilder(t,r){let n;if(Object.prototype.hasOwnProperty.call(Cr,t.text))n=new T.MathNode("mtext",[new T.TextNode(" ")]);else{if(!Object.prototype.hasOwnProperty.call(Br,t.text))throw new e(`Unknown type of space "${t.text}"`);n=new T.MathNode("mo"),"\\nobreak"===t.text&&n.setAttribute("linebreak","nobreak")}return n}}),m({type:"tag"});const zr={"\\text":void 0,"\\textrm":"textrm","\\textsf":"textsf","\\texttt":"texttt","\\textnormal":"textrm","\\textsc":"textsc"},$r={"\\textbf":"textbf","\\textmd":"textmd"},Er={"\\textit":"textit","\\textup":"textup"};c({type:"text",names:["\\text","\\textrm","\\textsf","\\texttt","\\textnormal","\\textsc","\\textbf","\\textmd","\\textit","\\textup","\\emph"],props:{numArgs:1,argTypes:["text"],allowedInArgument:!0,allowedInText:!0},handler({parser:e,funcName:t},r){const n=r[0];return{type:"text",mode:e.mode,body:p(n),font:t}},mathmlBuilder(e,t){const r=((e,t)=>{const r=e.font;return r?zr[r]?t.withTextFontFamily(zr[r]):$r[r]?t.withTextFontWeight($r[r]):"\\emph"===r?"textit"===t.fontShape?t.withTextFontShape("textup"):t.withTextFontShape("textit"):t.withTextFontShape(Er[r]):t})(e,t),n=ce(e.body,r);return ne(n)}}),c({type:"vcenter",names:["\\vcenter"],props:{numArgs:1,argTypes:["original"],allowedInText:!1},handler:({parser:e},t)=>({type:"vcenter",mode:e.mode,body:t[0]}),mathmlBuilder(e,t){const r=new T.MathNode("mtd",[me(e.body,t)]);r.style.padding="0";const n=new T.MathNode("mtr",[r]);return new T.MathNode("mtable",[n])}}),c({type:"verb",names:["\\verb"],props:{numArgs:0,allowedInText:!0},handler(t,r,n){throw new e("\\verb ended by end of line instead of matching delimiter")},mathmlBuilder(e,t){const r=new T.TextNode(Ir(e)),n=new T.MathNode("mtext",[r]);return n.setAttribute("mathvariant","monospace"),n}});const Ir=e=>e.body.replace(/ /g,e.star?"␣":" "),Lr=i,Fr="[ \r\n\t]",Dr=`(\\\\[a-zA-Z@]+)${Fr}*`,Gr="[̀-ͯ]",jr=new RegExp(`${Gr}+$`),Pr=`(${Fr}+)|\\\\(\n|[ \r\t]+\n?)[ \r\t]*|([!-\\[\\]-‧‪-퟿豈-￿]${Gr}*|[\ud800-\udbff][\udc00-\udfff]${Gr}*|\\\\verb\\*([^]).*?\\4|\\\\verb([^*a-zA-Z]).*?\\5|${Dr}|\\\\[^\ud800-\udfff])`;class Rr{constructor(e,t){this.input=e,this.settings=t,this.tokenRegex=new RegExp(Pr,"g"),this.catcodes={"%":14,"~":13}}setCatcode(e,t){this.catcodes[e]=t}lex(){const t=this.input,r=this.tokenRegex.lastIndex;if(r===t.length)return new mt("EOF",new ct(this,r,r));const n=this.tokenRegex.exec(t);if(null===n||n.index!==r)throw new e(`Unexpected character: '${t[r]}'`,new mt(t[r],new ct(this,r,r+1)));const s=n[6]||n[3]||(n[2]?"\\ ":" ");if(14===this.catcodes[s]){const r=t.indexOf("\n",this.tokenRegex.lastIndex);if(-1===r){if(this.tokenRegex.lastIndex=t.length,this.settings.strict)throw new e("% comment has no terminating newline; LaTeX would fail because of commenting the end of math mode")}else this.tokenRegex.lastIndex=r+1;return this.lex()}return new mt(s,new ct(this,r,this.tokenRegex.lastIndex))}}class Ur{constructor(e={},t={}){this.current=t,this.builtins=e,this.undefStack=[]}beginGroup(){this.undefStack.push({})}endGroup(){if(0===this.undefStack.length)throw new e("Unbalanced namespace destruction: attempt to pop global namespace; please report this as a bug");const t=this.undefStack.pop();for(const e in t)Object.prototype.hasOwnProperty.call(t,e)&&(void 0===t[e]?delete this.current[e]:this.current[e]=t[e])}has(e){return Object.prototype.hasOwnProperty.call(this.current,e)||Object.prototype.hasOwnProperty.call(this.builtins,e)}get(e){return Object.prototype.hasOwnProperty.call(this.current,e)?this.current[e]:this.builtins[e]}set(e,t,r=!1){if(r){for(let t=0;t<this.undefStack.length;t++)delete this.undefStack[t][e];this.undefStack.length>0&&(this.undefStack[this.undefStack.length-1][e]=t)}else{const t=this.undefStack[this.undefStack.length-1];t&&!Object.prototype.hasOwnProperty.call(t,e)&&(t[e]=this.current[e])}this.current[e]=t}}const Hr={"^":!0,_:!0,"\\limits":!0,"\\nolimits":!0};class Vr{constructor(e,t,r){this.settings=t,this.expansionCount=0,this.feed(e),this.macros=new Ur(bt,t.macros),this.mode=r,this.stack=[]}feed(e){this.lexer=new Rr(e,this.settings)}switchMode(e){this.mode=e}beginGroup(){this.macros.beginGroup()}endGroup(){this.macros.endGroup()}future(){return 0===this.stack.length&&this.pushToken(this.lexer.lex()),this.stack[this.stack.length-1]}popToken(){return this.future(),this.stack.pop()}pushToken(e){this.stack.push(e)}pushTokens(e){this.stack.push(...e)}scanArgument(e){let t,r,n;if(e){if(this.consumeSpaces(),"["!==this.future().text)return null;t=this.popToken(),({tokens:n,end:r}=this.consumeArg(["]"]))}else({tokens:n,start:t,end:r}=this.consumeArg());return this.pushToken(new mt("EOF",r.loc)),this.pushTokens(n),t.range(r,"")}consumeSpaces(){for(;;){if(" "!==this.future().text)break;this.stack.pop()}}consumeArg(t){const r=[],n=t&&t.length>0;n||this.consumeSpaces();const s=this.future();let o,a=0,i=0;do{if(o=this.popToken(),r.push(o),"{"===o.text)++a;else if("}"===o.text){if(--a,-1===a)throw new e("Extra }",o)}else if("EOF"===o.text)throw new e("Unexpected end of input in a macro argument, expected '"+(t&&n?t[i]:"}")+"'",o);if(t&&n)if((0===a||1===a&&"{"===t[i])&&o.text===t[i]){if(++i,i===t.length){r.splice(-i,i);break}}else i=0}while(0!==a||n);return"{"===s.text&&"}"===r[r.length-1].text&&(r.pop(),r.shift()),r.reverse(),{tokens:r,start:s,end:o}}consumeArgs(t,r){if(r){if(r.length!==t+1)throw new e("The length of delimiters doesn't match the number of args!");const n=r[0];for(let t=0;t<n.length;t++){const r=this.popToken();if(n[t]!==r.text)throw new e("Use of the macro doesn't match its definition",r)}}const n=[];for(let e=0;e<t;e++)n.push(this.consumeArg(r&&r[e+1]).tokens);return n}expandOnce(t){const r=this.popToken(),n=r.text,s=r.noexpand?null:this._getExpansion(n);if(null==s||t&&s.unexpandable){if(t&&null==s&&"\\"===n[0]&&!this.isDefined(n))throw new e("Undefined control sequence: "+n);return this.pushToken(r),!1}if(this.expansionCount++,this.expansionCount>this.settings.maxExpand)throw new e("Too many expansions: infinite loop or need to increase maxExpand setting");let o=s.tokens;const a=this.consumeArgs(s.numArgs,s.delimiters);if(s.numArgs){o=o.slice();for(let t=o.length-1;t>=0;--t){let r=o[t];if("#"===r.text){if(0===t)throw new e("Incomplete placeholder at end of macro body",r);if(r=o[--t],"#"===r.text)o.splice(t+1,1);else{if(!/^[1-9]$/.test(r.text))throw new e("Not a valid argument number",r);o.splice(t,2,...a[+r.text-1])}}}}return this.pushTokens(o),o.length}expandAfterFuture(){return this.expandOnce(),this.future()}expandNextToken(){for(;;)if(!1===this.expandOnce()){const e=this.stack.pop();return e.treatAsRelax&&(e.text="\\relax"),e}throw new Error}expandMacro(e){return this.macros.has(e)?this.expandTokens([new mt(e)]):void 0}expandTokens(e){const t=[],r=this.stack.length;for(this.pushTokens(e);this.stack.length>r;)if(!1===this.expandOnce(!0)){const e=this.stack.pop();e.treatAsRelax&&(e.noexpand=!1,e.treatAsRelax=!1),t.push(e)}return t}expandMacroAsText(e){const t=this.expandMacro(e);return t?t.map((e=>e.text)).join(""):t}_getExpansion(e){const t=this.macros.get(e);if(null==t)return t;if(1===e.length){const t=this.lexer.catcodes[e];if(null!=t&&13!==t)return}const r="function"==typeof t?t(this):t;if("string"==typeof r){let e=0;if(-1!==r.indexOf("#")){const t=r.replace(/##/g,"");for(;-1!==t.indexOf("#"+(e+1));)++e}const t=new Rr(r,this.settings),n=[];let s=t.lex();for(;"EOF"!==s.text;)n.push(s),s=t.lex();n.reverse();return{tokens:n,numArgs:e}}return r}isDefined(e){return this.macros.has(e)||Object.prototype.hasOwnProperty.call(Lr,e)||Object.prototype.hasOwnProperty.call(E.math,e)||Object.prototype.hasOwnProperty.call(E.text,e)||Object.prototype.hasOwnProperty.call(Hr,e)}isExpandable(e){const t=this.macros.get(e);return null!=t?"string"==typeof t||"function"==typeof t||!t.unexpandable:Object.prototype.hasOwnProperty.call(Lr,e)&&!Lr[e].primitive}}const _r=/^[₊₋₌₍₎₀₁₂₃₄₅₆₇₈₉ₐₑₕᵢⱼₖₗₘₙₒₚᵣₛₜᵤᵥₓᵦᵧᵨᵩᵪ]/,Wr=Object.freeze({"₊":"+","₋":"-","₌":"=","₍":"(","₎":")","₀":"0","₁":"1","₂":"2","₃":"3","₄":"4","₅":"5","₆":"6","₇":"7","₈":"8","₉":"9","ₐ":"a","ₑ":"e","ₕ":"h","ᵢ":"i","ⱼ":"j","ₖ":"k","ₗ":"l","ₘ":"m","ₙ":"n","ₒ":"o","ₚ":"p","ᵣ":"r","ₛ":"s","ₜ":"t","ᵤ":"u","ᵥ":"v","ₓ":"x","ᵦ":"β","ᵧ":"γ","ᵨ":"ρ","ᵩ":"ϕ","ᵪ":"χ","⁺":"+","⁻":"-","⁼":"=","⁽":"(","⁾":")","⁰":"0","¹":"1","²":"2","³":"3","⁴":"4","⁵":"5","⁶":"6","⁷":"7","⁸":"8","⁹":"9","ᴬ":"A","ᴮ":"B","ᴰ":"D","ᴱ":"E","ᴳ":"G","ᴴ":"H","ᴵ":"I","ᴶ":"J","ᴷ":"K","ᴸ":"L","ᴹ":"M","ᴺ":"N","ᴼ":"O","ᴾ":"P","ᴿ":"R","ᵀ":"T","ᵁ":"U","ⱽ":"V","ᵂ":"W","ᵃ":"a","ᵇ":"b","ᶜ":"c","ᵈ":"d","ᵉ":"e","ᶠ":"f","ᵍ":"g","ʰ":"h","ⁱ":"i","ʲ":"j","ᵏ":"k","ˡ":"l","ᵐ":"m","ⁿ":"n","ᵒ":"o","ᵖ":"p","ʳ":"r","ˢ":"s","ᵗ":"t","ᵘ":"u","ᵛ":"v","ʷ":"w","ˣ":"x","ʸ":"y","ᶻ":"z","ᵝ":"β","ᵞ":"γ","ᵟ":"δ","ᵠ":"ϕ","ᵡ":"χ","ᶿ":"θ"}),Xr=Object.freeze({"𝒜":"A","ℬ":"B","𝒞":"C","𝒟":"D","ℰ":"E","ℱ":"F","𝒢":"G","ℋ":"H","ℐ":"I","𝒥":"J","𝒦":"K","ℒ":"L","ℳ":"M","𝒩":"N","𝒪":"O","𝒫":"P","𝒬":"Q","ℛ":"R","𝒮":"S","𝒯":"T","𝒰":"U","𝒱":"V","𝒲":"W","𝒳":"X","𝒴":"Y","𝒵":"Z"});var Zr={"́":{text:"\\'",math:"\\acute"},"̀":{text:"\\`",math:"\\grave"},"̈":{text:'\\"',math:"\\ddot"},"̃":{text:"\\~",math:"\\tilde"},"̄":{text:"\\=",math:"\\bar"},"̆":{text:"\\u",math:"\\breve"},"̌":{text:"\\v",math:"\\check"},"̂":{text:"\\^",math:"\\hat"},"̇":{text:"\\.",math:"\\dot"},"̊":{text:"\\r",math:"\\mathring"},"̋":{text:"\\H"},"̧":{text:"\\c"}},Yr={"á":"á","à":"à","ä":"ä","ǟ":"ǟ","ã":"ã","ā":"ā","ă":"ă","ắ":"ắ","ằ":"ằ","ẵ":"ẵ","ǎ":"ǎ","â":"â","ấ":"ấ","ầ":"ầ","ẫ":"ẫ","ȧ":"ȧ","ǡ":"ǡ","å":"å","ǻ":"ǻ","ḃ":"ḃ","ć":"ć","č":"č","ĉ":"ĉ","ċ":"ċ","ď":"ď","ḋ":"ḋ","é":"é","è":"è","ë":"ë","ẽ":"ẽ","ē":"ē","ḗ":"ḗ","ḕ":"ḕ","ĕ":"ĕ","ě":"ě","ê":"ê","ế":"ế","ề":"ề","ễ":"ễ","ė":"ė","ḟ":"ḟ","ǵ":"ǵ","ḡ":"ḡ","ğ":"ğ","ǧ":"ǧ","ĝ":"ĝ","ġ":"ġ","ḧ":"ḧ","ȟ":"ȟ","ĥ":"ĥ","ḣ":"ḣ","í":"í","ì":"ì","ï":"ï","ḯ":"ḯ","ĩ":"ĩ","ī":"ī","ĭ":"ĭ","ǐ":"ǐ","î":"î","ǰ":"ǰ","ĵ":"ĵ","ḱ":"ḱ","ǩ":"ǩ","ĺ":"ĺ","ľ":"ľ","ḿ":"ḿ","ṁ":"ṁ","ń":"ń","ǹ":"ǹ","ñ":"ñ","ň":"ň","ṅ":"ṅ","ó":"ó","ò":"ò","ö":"ö","ȫ":"ȫ","õ":"õ","ṍ":"ṍ","ṏ":"ṏ","ȭ":"ȭ","ō":"ō","ṓ":"ṓ","ṑ":"ṑ","ŏ":"ŏ","ǒ":"ǒ","ô":"ô","ố":"ố","ồ":"ồ","ỗ":"ỗ","ȯ":"ȯ","ȱ":"ȱ","ő":"ő","ṕ":"ṕ","ṗ":"ṗ","ŕ":"ŕ","ř":"ř","ṙ":"ṙ","ś":"ś","ṥ":"ṥ","š":"š","ṧ":"ṧ","ŝ":"ŝ","ṡ":"ṡ","ẗ":"ẗ","ť":"ť","ṫ":"ṫ","ú":"ú","ù":"ù","ü":"ü","ǘ":"ǘ","ǜ":"ǜ","ǖ":"ǖ","ǚ":"ǚ","ũ":"ũ","ṹ":"ṹ","ū":"ū","ṻ":"ṻ","ŭ":"ŭ","ǔ":"ǔ","û":"û","ů":"ů","ű":"ű","ṽ":"ṽ","ẃ":"ẃ","ẁ":"ẁ","ẅ":"ẅ","ŵ":"ŵ","ẇ":"ẇ","ẘ":"ẘ","ẍ":"ẍ","ẋ":"ẋ","ý":"ý","ỳ":"ỳ","ÿ":"ÿ","ỹ":"ỹ","ȳ":"ȳ","ŷ":"ŷ","ẏ":"ẏ","ẙ":"ẙ","ź":"ź","ž":"ž","ẑ":"ẑ","ż":"ż","Á":"Á","À":"À","Ä":"Ä","Ǟ":"Ǟ","Ã":"Ã","Ā":"Ā","Ă":"Ă","Ắ":"Ắ","Ằ":"Ằ","Ẵ":"Ẵ","Ǎ":"Ǎ","Â":"Â","Ấ":"Ấ","Ầ":"Ầ","Ẫ":"Ẫ","Ȧ":"Ȧ","Ǡ":"Ǡ","Å":"Å","Ǻ":"Ǻ","Ḃ":"Ḃ","Ć":"Ć","Č":"Č","Ĉ":"Ĉ","Ċ":"Ċ","Ď":"Ď","Ḋ":"Ḋ","É":"É","È":"È","Ë":"Ë","Ẽ":"Ẽ","Ē":"Ē","Ḗ":"Ḗ","Ḕ":"Ḕ","Ĕ":"Ĕ","Ě":"Ě","Ê":"Ê","Ế":"Ế","Ề":"Ề","Ễ":"Ễ","Ė":"Ė","Ḟ":"Ḟ","Ǵ":"Ǵ","Ḡ":"Ḡ","Ğ":"Ğ","Ǧ":"Ǧ","Ĝ":"Ĝ","Ġ":"Ġ","Ḧ":"Ḧ","Ȟ":"Ȟ","Ĥ":"Ĥ","Ḣ":"Ḣ","Í":"Í","Ì":"Ì","Ï":"Ï","Ḯ":"Ḯ","Ĩ":"Ĩ","Ī":"Ī","Ĭ":"Ĭ","Ǐ":"Ǐ","Î":"Î","İ":"İ","Ĵ":"Ĵ","Ḱ":"Ḱ","Ǩ":"Ǩ","Ĺ":"Ĺ","Ľ":"Ľ","Ḿ":"Ḿ","Ṁ":"Ṁ","Ń":"Ń","Ǹ":"Ǹ","Ñ":"Ñ","Ň":"Ň","Ṅ":"Ṅ","Ó":"Ó","Ò":"Ò","Ö":"Ö","Ȫ":"Ȫ","Õ":"Õ","Ṍ":"Ṍ","Ṏ":"Ṏ","Ȭ":"Ȭ","Ō":"Ō","Ṓ":"Ṓ","Ṑ":"Ṑ","Ŏ":"Ŏ","Ǒ":"Ǒ","Ô":"Ô","Ố":"Ố","Ồ":"Ồ","Ỗ":"Ỗ","Ȯ":"Ȯ","Ȱ":"Ȱ","Ő":"Ő","Ṕ":"Ṕ","Ṗ":"Ṗ","Ŕ":"Ŕ","Ř":"Ř","Ṙ":"Ṙ","Ś":"Ś","Ṥ":"Ṥ","Š":"Š","Ṧ":"Ṧ","Ŝ":"Ŝ","Ṡ":"Ṡ","Ť":"Ť","Ṫ":"Ṫ","Ú":"Ú","Ù":"Ù","Ü":"Ü","Ǘ":"Ǘ","Ǜ":"Ǜ","Ǖ":"Ǖ","Ǚ":"Ǚ","Ũ":"Ũ","Ṹ":"Ṹ","Ū":"Ū","Ṻ":"Ṻ","Ŭ":"Ŭ","Ǔ":"Ǔ","Û":"Û","Ů":"Ů","Ű":"Ű","Ṽ":"Ṽ","Ẃ":"Ẃ","Ẁ":"Ẁ","Ẅ":"Ẅ","Ŵ":"Ŵ","Ẇ":"Ẇ","Ẍ":"Ẍ","Ẋ":"Ẋ","Ý":"Ý","Ỳ":"Ỳ","Ÿ":"Ÿ","Ỹ":"Ỹ","Ȳ":"Ȳ","Ŷ":"Ŷ","Ẏ":"Ẏ","Ź":"Ź","Ž":"Ž","Ẑ":"Ẑ","Ż":"Ż","ά":"ά","ὰ":"ὰ","ᾱ":"ᾱ","ᾰ":"ᾰ","έ":"έ","ὲ":"ὲ","ή":"ή","ὴ":"ὴ","ί":"ί","ὶ":"ὶ","ϊ":"ϊ","ΐ":"ΐ","ῒ":"ῒ","ῑ":"ῑ","ῐ":"ῐ","ό":"ό","ὸ":"ὸ","ύ":"ύ","ὺ":"ὺ","ϋ":"ϋ","ΰ":"ΰ","ῢ":"ῢ","ῡ":"ῡ","ῠ":"ῠ","ώ":"ώ","ὼ":"ὼ","Ύ":"Ύ","Ὺ":"Ὺ","Ϋ":"Ϋ","Ῡ":"Ῡ","Ῠ":"Ῠ","Ώ":"Ώ","Ὼ":"Ὼ"};const Kr=["bin","op","open","punct","rel"],Jr=/([-+]?) *(\d+(?:\.\d*)?|\.\d+) *([a-z]{2})/;class Qr{constructor(e,t,r=!1){this.mode="math",this.gullet=new Vr(e,t,this.mode),this.settings=t,this.isPreamble=r,this.leftrightDepth=0,this.prevAtomType=""}expect(t,r=!0){if(this.fetch().text!==t)throw new e(`Expected '${t}', got '${this.fetch().text}'`,this.fetch());r&&this.consume()}consume(){this.nextToken=null}fetch(){return null==this.nextToken&&(this.nextToken=this.gullet.expandNextToken()),this.nextToken}switchMode(e){this.mode=e,this.gullet.switchMode(e)}parse(){this.gullet.beginGroup(),this.settings.colorIsTextColor&&this.gullet.macros.set("\\color","\\textcolor");const e=this.parseExpression(!1);if(this.expect("EOF"),this.isPreamble){const e=Object.create(null);return Object.entries(this.gullet.macros.current).forEach((([t,r])=>{e[t]=r})),this.gullet.endGroup(),e}const t=this.gullet.macros.get("\\df@tag");return this.gullet.endGroup(),t&&(this.gullet.macros.current["\\df@tag"]=t),e}static get endOfExpression(){return["}","\\endgroup","\\end","\\right","\\endtoggle","&"]}subparse(e){const t=this.nextToken;this.consume(),this.gullet.pushToken(new mt("}")),this.gullet.pushTokens(e);const r=this.parseExpression(!1);return this.expect("}"),this.nextToken=t,r}parseExpression(e,t,r){const n=[];for(this.prevAtomType="";;){"math"===this.mode&&this.consumeSpaces();const s=this.fetch();if(-1!==Qr.endOfExpression.indexOf(s.text))break;if(t&&s.text===t)break;if(r&&"\\middle"===s.text)break;if(e&&Lr[s.text]&&Lr[s.text].infix)break;const o=this.parseAtom(t);if(!o)break;"internal"!==o.type&&(n.push(o),this.prevAtomType="atom"===o.type?o.family:o.type)}return"text"===this.mode&&this.formLigatures(n),this.handleInfixNodes(n)}handleInfixNodes(t){let r,n=-1;for(let s=0;s<t.length;s++)if("infix"===t[s].type){if(-1!==n)throw new e("only one infix operator per group",t[s].token);n=s,r=t[s].replaceWith}if(-1!==n&&r){let e,s;const o=t.slice(0,n),a=t.slice(n+1);let i;return e=1===o.length&&"ordgroup"===o[0].type?o[0]:{type:"ordgroup",mode:this.mode,body:o},s=1===a.length&&"ordgroup"===a[0].type?a[0]:{type:"ordgroup",mode:this.mode,body:a},i="\\\\abovefrac"===r?this.callFunction(r,[e,t[n],s],[]):this.callFunction(r,[e,s],[]),[i]}return t}handleSupSubscript(t){const r=this.fetch(),n=r.text;this.consume(),this.consumeSpaces();const s=this.parseGroup(t);if(!s)throw new e("Expected group after '"+n+"'",r);return s}formatUnsupportedCmd(e){const t=[];for(let r=0;r<e.length;r++)t.push({type:"textord",mode:"text",text:e[r]});const r={type:"text",mode:this.mode,body:t};return{type:"color",mode:this.mode,color:this.settings.errorColor,body:[r]}}parseAtom(t){const r=this.parseGroup("atom",t);if("text"===this.mode)return r;let n,s;for(;;){this.consumeSpaces();const t=this.fetch();if("\\limits"===t.text||"\\nolimits"===t.text){if(r&&"op"===r.type){const e="\\limits"===t.text;r.limits=e,r.alwaysHandleSupSub=!0}else{if(!r||"operatorname"!==r.type)throw new e("Limit controls must follow a math operator",t);r.alwaysHandleSupSub&&(r.limits="\\limits"===t.text)}this.consume()}else if("^"===t.text){if(n)throw new e("Double superscript",t);n=this.handleSupSubscript("superscript")}else if("_"===t.text){if(s)throw new e("Double subscript",t);s=this.handleSupSubscript("subscript")}else if("'"===t.text){if(n)throw new e("Double superscript",t);const r={type:"textord",mode:this.mode,text:"\\prime"},s=[r];for(this.consume();"'"===this.fetch().text;)s.push(r),this.consume();"^"===this.fetch().text&&s.push(this.handleSupSubscript("superscript")),n={type:"ordgroup",mode:this.mode,body:s}}else{if(!Wr[t.text])break;{const e=_r.test(t.text),r=[];for(r.push(new mt(Wr[t.text])),this.consume();;){const t=this.fetch().text;if(!Wr[t])break;if(_r.test(t)!==e)break;r.unshift(new mt(Wr[t])),this.consume()}const o=this.subparse(r);e?s={type:"ordgroup",mode:"math",body:o}:n={type:"ordgroup",mode:"math",body:o}}}}if(n||s){if(r&&"multiscript"===r.type&&!r.postscripts)return r.postscripts={sup:n,sub:s},r;{const e=!r||"op"!==r.type&&"operatorname"!==r.type?void 0:tt(this.nextToken.text);return{type:"supsub",mode:this.mode,base:r,sup:n,sub:s,isFollowedByDelimiter:e}}}return r}parseFunction(t,r){const n=this.fetch(),s=n.text,o=Lr[s];if(!o)return null;if(this.consume(),r&&"atom"!==r&&!o.allowedInArgument)throw new e("Got function '"+s+"' with no arguments"+(r?" as "+r:""),n);if("text"===this.mode&&!o.allowedInText)throw new e("Can't use function '"+s+"' in text mode",n);if("math"===this.mode&&!1===o.allowedInMath)throw new e("Can't use function '"+s+"' in math mode",n);const a=this.prevAtomType,{args:i,optArgs:l}=this.parseArguments(s,o);return this.prevAtomType=a,this.callFunction(s,i,l,n,t)}callFunction(t,r,n,s,o){const a={funcName:t,parser:this,token:s,breakOnTokenText:o},i=Lr[t];if(i&&i.handler)return i.handler(a,r,n);throw new e(`No function handler for ${t}`)}parseArguments(t,r){const n=r.numArgs+r.numOptionalArgs;if(0===n)return{args:[],optArgs:[]};const s=[],o=[];for(let a=0;a<n;a++){let n=r.argTypes&&r.argTypes[a];const i=a<r.numOptionalArgs;(r.primitive&&null==n||"sqrt"===r.type&&1===a&&null==o[0])&&(n="primitive");const l=this.parseGroupOfType(`argument to '${t}'`,n,i);if(i)o.push(l);else{if(null==l)throw new e("Null argument, please report this as a bug");s.push(l)}}return{args:s,optArgs:o}}parseGroupOfType(t,r,n){switch(r){case"size":return this.parseSizeGroup(n);case"url":return this.parseUrlGroup(n);case"math":case"text":return this.parseArgumentGroup(n,r);case"hbox":{const e=this.parseArgumentGroup(n,"text");return null!=e?{type:"styling",mode:e.mode,body:[e],scriptLevel:"text"}:null}case"raw":{const e=this.parseStringGroup("raw",n);return null!=e?{type:"raw",mode:"text",string:e.text}:null}case"primitive":{if(n)throw new e("A primitive argument cannot be optional");const r=this.parseGroup(t);if(null==r)throw new e("Expected group as "+t,this.fetch());return r}case"original":case null:case void 0:return this.parseArgumentGroup(n);default:throw new e("Unknown group type as "+t,this.fetch())}}consumeSpaces(){for(;;){const e=this.fetch().text;if(" "!==e&&" "!==e&&"︎"!==e)break;this.consume()}}parseStringGroup(e,t){const r=this.gullet.scanArgument(t);if(null==r)return null;let n,s="";for(;"EOF"!==(n=this.fetch()).text;)s+=n.text,this.consume();return this.consume(),r.text=s,r}parseRegexGroup(t,r){const n=this.fetch();let s,o=n,a="";for(;"EOF"!==(s=this.fetch()).text&&t.test(a+s.text);)o=s,a+=o.text,this.consume();if(""===a)throw new e("Invalid "+r+": '"+n.text+"'",n);return n.range(o,a)}parseSizeGroup(t){let r,n=!1;if(this.gullet.consumeSpaces(),r=t||"{"===this.gullet.future().text?this.parseStringGroup("size",t):this.parseRegexGroup(/^[-+]? *(?:$|\d+|\d+\.\d*|\.\d*) *[a-z]{0,2} *$/,"size"),!r)return null;t||0!==r.text.length||(r.text="0pt",n=!0);const s=Jr.exec(r.text);if(!s)throw new e("Invalid size: '"+r.text+"'",r);const o={number:+(s[1]+s[2]),unit:s[3]};if(!Te(o))throw new e("Invalid unit: '"+o.unit+"'",r);return{type:"size",mode:this.mode,value:o,isBlank:n}}parseUrlGroup(e){this.gullet.lexer.setCatcode("%",13),this.gullet.lexer.setCatcode("~",12);const t=this.parseStringGroup("url",e);if(this.gullet.lexer.setCatcode("%",14),this.gullet.lexer.setCatcode("~",13),null==t)return null;let r=t.text.replace(/\\([#$%&~_^{}])/g,"$1");return r=t.text.replace(/{\u2044}/g,"/"),{type:"url",mode:this.mode,url:r}}parseArgumentGroup(e,t){const r=this.gullet.scanArgument(e);if(null==r)return null;const n=this.mode;t&&this.switchMode(t),this.gullet.beginGroup();const s=this.parseExpression(!1,"EOF");this.expect("EOF"),this.gullet.endGroup();const o={type:"ordgroup",mode:this.mode,loc:r.loc,body:s};return t&&this.switchMode(n),o}parseGroup(e,t){const r=this.fetch(),n=r.text;let s;if("{"===n||"\\begingroup"===n||"\\toggle"===n){this.consume();const e="{"===n?"}":"\\begingroup"===n?"\\endgroup":"\\endtoggle";this.gullet.beginGroup();const t=this.parseExpression(!1,e),o=this.fetch();this.expect(e),this.gullet.endGroup(),s={type:"\\endtoggle"===o.text?"toggle":"ordgroup",mode:this.mode,loc:ct.range(r,o),body:t,semisimple:"\\begingroup"===n||void 0}}else s=this.parseFunction(t,e)||this.parseSymbol(),null!=s||"\\"!==n[0]||Object.prototype.hasOwnProperty.call(Hr,n)||(s=this.formatUnsupportedCmd(n),this.consume());return s}formLigatures(e){let t=e.length-1;for(let r=0;r<t;++r){const n=e[r],s=n.text;"-"===s&&"-"===e[r+1].text&&(r+1<t&&"-"===e[r+2].text?(e.splice(r,3,{type:"textord",mode:"text",loc:ct.range(n,e[r+2]),text:"---"}),t-=2):(e.splice(r,2,{type:"textord",mode:"text",loc:ct.range(n,e[r+1]),text:"--"}),t-=1)),"'"!==s&&"`"!==s||e[r+1].text!==s||(e.splice(r,2,{type:"textord",mode:"text",loc:ct.range(n,e[r+1]),text:s+s}),t-=1)}}parseSymbol(){const t=this.fetch();let r=t.text;if(/^\\verb[^a-zA-Z]/.test(r)){this.consume();let t=r.slice(5);const n="*"===t.charAt(0);if(n&&(t=t.slice(1)),t.length<2||t.charAt(0)!==t.slice(-1))throw new e("\\verb assertion failed --\n please report what input caused this bug");return t=t.slice(1,-1),{type:"verb",mode:"text",body:t,star:n}}if(Object.prototype.hasOwnProperty.call(Yr,r[0])&&"math"===this.mode&&!E[this.mode][r[0]]){if(this.settings.strict&&"math"===this.mode)throw new e(`Accented Unicode text character "${r[0]}" used in math mode`,t);r=Yr[r[0]]+r.slice(1)}const n="math"===this.mode?jr.exec(r):null;let s;if(n&&(r=r.substring(0,n.index),"i"===r?r="ı":"j"===r&&(r="ȷ")),E[this.mode][r]){let e=E[this.mode][r].group;"bin"===e&&Kr.includes(this.prevAtomType)&&(e="open");const n=ct.range(t);let o;if(Object.prototype.hasOwnProperty.call(z,e)){const t=e;o={type:"atom",mode:this.mode,family:t,loc:n,text:r}}else{if(Xr[r]){this.consume();const e=this.fetch().text.charCodeAt(0),t=65025===e?"mathscr":"mathcal";return 65024!==e&&65025!==e||this.consume(),{type:"font",mode:"math",font:t,body:{type:"mathord",mode:"math",loc:n,text:Xr[r]}}}o={type:e,mode:this.mode,loc:n,text:r}}s=o}else{if(!(r.charCodeAt(0)>=128||jr.exec(r)))return null;if(this.settings.strict&&"math"===this.mode)throw new e(`Unicode text character "${r[0]}" used in math mode`,t);s={type:"textord",mode:"text",loc:ct.range(t),text:r}}if(this.consume(),n)for(let r=0;r<n[0].length;r++){const o=n[0][r];if(!Zr[o])throw new e(`Unknown accent ' ${o}'`,t);const a=Zr[o][this.mode]||Zr[o].text;if(!a)throw new e(`Accent ${o} unsupported in ${this.mode} mode`,t);s={type:"accent",mode:this.mode,loc:ct.range(t),label:a,isStretchy:!1,base:s}}return s}}const en=function(t,r){if(!("string"==typeof t||t instanceof String))throw new TypeError("Temml can only parse string typed expression");const n=new Qr(t,r);delete n.gullet.macros.current["\\df@tag"];let s=n.parse();if(!(s.length>0&&s[0].type&&"array"===s[0].type&&s[0].addEqnNum)&&n.gullet.macros.get("\\df@tag")){if(!r.displayMode)throw new e("\\tag works only in display mode");n.gullet.feed("\\df@tag"),s=[{type:"tag",mode:"text",body:s,tag:n.parse()}]}return s},tn=[2,2,3,3];class rn{constructor(e){this.level=e.level,this.color=e.color,this.font=e.font||"",this.fontFamily=e.fontFamily||"",this.fontSize=e.fontSize||1,this.fontWeight=e.fontWeight||"",this.fontShape=e.fontShape||"",this.maxSize=e.maxSize}extend(e){const t={level:this.level,color:this.color,font:this.font,fontFamily:this.fontFamily,fontSize:this.fontSize,fontWeight:this.fontWeight,fontShape:this.fontShape,maxSize:this.maxSize};for(const r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return new rn(t)}withLevel(e){return this.extend({level:e})}incrementLevel(){return this.extend({level:Math.min(this.level+1,3)})}inSubOrSup(){return this.extend({level:tn[this.level]})}withColor(e){return this.extend({color:e})}withFont(e){return this.extend({font:e})}withTextFontFamily(e){return this.extend({fontFamily:e,font:""})}withFontSize(e){return this.extend({fontSize:e})}withTextFontWeight(e){return this.extend({fontWeight:e,font:""})}withTextFontShape(e){return this.extend({fontShape:e,font:""})}getColor(){return this.color}}function nn(e){const t={};let r=0;const n=document.getElementsByClassName("tml-eqn");for(let e of n)for(r+=1,e.setAttribute("id","tml-eqn-"+String(r));"mtable"!==e.tagName;){if(e.getElementsByClassName("tml-label").length>0){const n=e.attributes.id.value;t[n]=String(r);break}e=e.parentElement}const s=document.getElementsByClassName("tml-tageqn");for(const e of s){if(e.getElementsByClassName("tml-label").length>0){const r=e.getElementsByClassName("tml-tag");if(r.length>0){const n=e.attributes.id.value;t[n]=r[0].textContent}}}[...e.getElementsByClassName("tml-ref")].forEach((e=>{const r=e.getAttribute("href");let n=t[r.slice(1)];-1===e.className.indexOf("tml-eqref")?(n=n.replace(/^\(/,""),n=n.replace(/\)$/,"")):("("!==n.charAt(0)&&(n="("+n),")"!==n.slice(-1)&&(n+=")"));const s=document.createElementNS("http://www.w3.org/1998/Math/MathML","mtext");s.appendChild(document.createTextNode(n));const o=document.createElementNS("http://www.w3.org/1998/Math/MathML","math");o.appendChild(s),e.appendChild(o)}))}const sn=function(e,t,r){let n=r,s=0;const o=e.length;for(;n<t.length;){const r=t[n];if(s<=0&&t.slice(n,n+o)===e)return n;"\\"===r?n++:"{"===r?s++:"}"===r&&s--,n++}return-1},on=/^\\(?:begin|(?:eq)?ref){/,an=[{left:"$$",right:"$$",display:!0},{left:"\\(",right:"\\)",display:!1},{left:"\\begin{equation}",right:"\\end{equation}",display:!0},{left:"\\begin{equation*}",right:"\\end{equation*}",display:!0},{left:"\\begin{align}",right:"\\end{align}",display:!0},{left:"\\begin{align*}",right:"\\end{align*}",display:!0},{left:"\\begin{alignat}",right:"\\end{alignat}",display:!0},{left:"\\begin{alignat*}",right:"\\end{alignat*}",display:!0},{left:"\\begin{gather}",right:"\\end{gather}",display:!0},{left:"\\begin{gather*}",right:"\\end{gather*}",display:!0},{left:"\\begin{CD}",right:"\\end{CD}",display:!0},{left:"\\ref{",right:"}",display:!1},{left:"\\eqref{",right:"}",display:!1},{left:"\\[",right:"\\]",display:!0}],ln={$:[{left:"$$",right:"$$",display:!0},{left:"$`",right:"`$",display:!1},{left:"$",right:"$",display:!1}],"(":[{left:"\\[",right:"\\]",display:!0},{left:"\\(",right:"\\)",display:!1}]},cn=[{left:"\\begin{equation}",right:"\\end{equation}",display:!0},{left:"\\begin{equation*}",right:"\\end{equation*}",display:!0},{left:"\\begin{align}",right:"\\end{align}",display:!0},{left:"\\begin{align*}",right:"\\end{align*}",display:!0},{left:"\\begin{alignat}",right:"\\end{alignat}",display:!0},{left:"\\begin{alignat*}",right:"\\end{alignat*}",display:!0},{left:"\\begin{gather}",right:"\\end{gather}",display:!0},{left:"\\begin{gather*}",right:"\\end{gather*}",display:!0},{left:"\\begin{CD}",right:"\\end{CD}",display:!0},{left:"\\ref{",right:"}",display:!1},{left:"\\eqref{",right:"}",display:!1}],mn=function(t,r){const n=function(e,t){let r;const n=[],s=new RegExp("("+t.map((e=>e.left.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&"))).join("|")+")");for(;r=e.search(s),-1!==r;){r>0&&(n.push({type:"text",data:e.slice(0,r)}),e=e.slice(r));const s=t.findIndex((t=>e.startsWith(t.left)));if(r=sn(t[s].right,e,t[s].left.length),-1===r)break;const o=e.slice(0,r+t[s].right.length),a=on.test(o)?o:e.slice(t[s].left.length,r);n.push({type:"math",data:a,rawData:o,display:t[s].display}),e=e.slice(r+t[s].right.length)}return""!==e&&n.push({type:"text",data:e}),n}(t,r.delimiters);if(1===n.length&&"text"===n[0].type)return null;const s=document.createDocumentFragment();for(let t=0;t<n.length;t++)if("text"===n[t].type)s.appendChild(document.createTextNode(n[t].data));else{const o=document.createElement("span");let a=n[t].data;r.displayMode=n[t].display;try{r.preProcess&&(a=r.preProcess(a)),temml.render(a,o,r)}catch(o){if(!(o instanceof e))throw o;r.errorCallback("Temml auto-render: Failed to parse `"+n[t].data+"` with ",o),s.appendChild(document.createTextNode(n[t].rawData));continue}s.appendChild(o)}return s},dn=function(e,t){for(let r=0;r<e.childNodes.length;r++){const n=e.childNodes[r];if(3===n.nodeType){const s=mn(n.textContent,t);s&&(r+=s.childNodes.length-1,e.replaceChild(s,n))}else if(1===n.nodeType){const e=" "+n.className+" ";-1===t.ignoredTags.indexOf(n.nodeName.toLowerCase())&&t.ignoredClasses.every((t=>-1===e.indexOf(" "+t+" ")))&&dn(n,t)}}};let pn=function(e,t,r={}){t.textContent="";const n="math"===t.tagName.toLowerCase();n&&(r.wrap="none");const s=un(e,r);n||s.children.length>1?(t.textContent="",s.children.forEach((e=>{t.appendChild(e.toNode())}))):t.appendChild(s.toNode())};"undefined"!=typeof document&&"CSS1Compat"!==document.compatMode&&("undefined"!=typeof console&&console.warn("Warning: Temml doesn't work in quirks mode. Make sure your website has a suitable doctype."),pn=function(){throw new e("Temml doesn't work in quirks mode.")});const un=function(t,r){const n=new a(r);try{const e=en(t,n);return he(e,t,new rn({level:n.displayMode?dt:pt,maxSize:n.maxSize}),n)}catch(r){return function(t,r,n){if(n.throwOnError||!(t instanceof e))throw t;const s=new y(["temml-error"],[new w(r+"\n"+t.toString())]);return s.style.color=n.errorColor,s.style.whiteSpace="pre-line",s}(r,t,n)}};return{version:"0.11.00",render:pn,renderToString:function(e,t){return un(e,t).toMarkup()},renderMathInElement:function(e,t){if(!e)throw new Error("No element provided to render");const r={};for(const e in t)Object.prototype.hasOwnProperty.call(t,e)&&(r[e]=t[e]);r.fences?r.delimiters=(e=>{if("$"===e||"("===e)return ln[e];if("$+"===e||"(+"===e)return ln[e.slice(0,1)].concat(cn);return"ams"===e?cn:"all"===e?ln["("].concat(ln.$).concat(cn):an})(r.fences):r.delimiters=r.delimiters||an,r.ignoredTags=r.ignoredTags||["script","noscript","style","textarea","pre","code","option"],r.ignoredClasses=r.ignoredClasses||[],r.errorCallback=r.errorCallback||console.error,r.macros=r.macros||{},dn(e,r),nn(e)},postProcess:nn,ParseError:e,definePreamble:function(e,t){const r=new a(t);if(r.macros={},!("string"==typeof e||e instanceof String))throw new TypeError("Temml can only parse string typed expression");const n=new Qr(e,r,!0);delete n.gullet.macros.current["\\df@tag"];return n.parse()},__parse:function(e,t){const r=new a(t);return en(e,r)},__renderToMathMLTree:un,__defineSymbol:I,__defineMacro:ft}}();