Browse Source

Add remove public from gitignore for github pages

codeskraps 2 months ago
parent
commit
786235462d
100 changed files with 11004 additions and 1 deletions
  1. 1 1
      .gitignore
  2. 98 0
      public/404.html
  3. 157 0
      public/about/index.html
  4. 111 0
      public/categories/index.html
  5. 13 0
      public/categories/index.xml
  6. BIN
      public/codeskraps_icon.png
  7. 727 0
      public/css/style.css
  8. 1 0
      public/css/style.min.36c061153203db94fc1169914d07c49c3a537a11316e9ffbd4c7a511df482d8d.css
  9. 1 0
      public/css/style.min.38d8ec3c7cca8185fe94ab7dc7ca79d69e14b78ca3c077807b2c32725df95c62.css
  10. 1 0
      public/css/style.min.ee0d47e4d4346c71a65a9e873108c81ffae54d60a2fc2338f6df394eb4b25a82.css
  11. 177 0
      public/css/syntax.css
  12. BIN
      public/favicon.ico
  13. BIN
      public/fonts/FiraMono/FiraMono-Medium.eot
  14. BIN
      public/fonts/FiraMono/FiraMono-Medium.otf
  15. BIN
      public/fonts/FiraMono/FiraMono-Medium.ttf
  16. BIN
      public/fonts/FiraMono/FiraMono-Medium.woff
  17. BIN
      public/fonts/FiraMono/FiraMono-Medium.woff2
  18. BIN
      public/fonts/OpenSans/OpenSans-Regular.eot
  19. BIN
      public/fonts/OpenSans/OpenSans-Regular.ttf
  20. BIN
      public/fonts/OpenSans/OpenSans-Regular.woff
  21. BIN
      public/images/me_codeskraps.gif
  22. BIN
      public/images/sbrowser_logo.webp
  23. BIN
      public/images/weekly_weather_logo.webp
  24. 133 0
      public/index.html
  25. 56 0
      public/index.xml
  26. 36 0
      public/js/copy-code-block.js
  27. 1 0
      public/js/mermaid-9.0.0.min.js
  28. 96 0
      public/lib/icofont/demo.html
  29. BIN
      public/lib/icofont/fonts/icofont.eot
  30. 11 0
      public/lib/icofont/fonts/icofont.svg
  31. BIN
      public/lib/icofont/fonts/icofont.ttf
  32. BIN
      public/lib/icofont/fonts/icofont.woff
  33. BIN
      public/lib/icofont/fonts/icofont.woff2
  34. 287 0
      public/lib/icofont/icofont.css
  35. 6 0
      public/lib/icofont/icofont.min.css
  36. 119 0
      public/lib/katex/README.md
  37. 349 0
      public/lib/katex/contrib/auto-render.js
  38. 0 0
      public/lib/katex/contrib/auto-render.min.js
  39. 244 0
      public/lib/katex/contrib/auto-render.mjs
  40. 130 0
      public/lib/katex/contrib/copy-tex.js
  41. 1 0
      public/lib/katex/contrib/copy-tex.min.js
  42. 105 0
      public/lib/katex/contrib/copy-tex.mjs
  43. 112 0
      public/lib/katex/contrib/mathtex-script-type.js
  44. 1 0
      public/lib/katex/contrib/mathtex-script-type.min.js
  45. 24 0
      public/lib/katex/contrib/mathtex-script-type.mjs
  46. 3216 0
      public/lib/katex/contrib/mhchem.js
  47. 0 0
      public/lib/katex/contrib/mhchem.min.js
  48. 3109 0
      public/lib/katex/contrib/mhchem.mjs
  49. 881 0
      public/lib/katex/contrib/render-a11y-string.js
  50. 0 0
      public/lib/katex/contrib/render-a11y-string.min.js
  51. 800 0
      public/lib/katex/contrib/render-a11y-string.mjs
  52. BIN
      public/lib/katex/fonts/KaTeX_AMS-Regular.ttf
  53. BIN
      public/lib/katex/fonts/KaTeX_AMS-Regular.woff
  54. BIN
      public/lib/katex/fonts/KaTeX_AMS-Regular.woff2
  55. BIN
      public/lib/katex/fonts/KaTeX_Caligraphic-Bold.ttf
  56. BIN
      public/lib/katex/fonts/KaTeX_Caligraphic-Bold.woff
  57. BIN
      public/lib/katex/fonts/KaTeX_Caligraphic-Bold.woff2
  58. BIN
      public/lib/katex/fonts/KaTeX_Caligraphic-Regular.ttf
  59. BIN
      public/lib/katex/fonts/KaTeX_Caligraphic-Regular.woff
  60. BIN
      public/lib/katex/fonts/KaTeX_Caligraphic-Regular.woff2
  61. BIN
      public/lib/katex/fonts/KaTeX_Fraktur-Bold.ttf
  62. BIN
      public/lib/katex/fonts/KaTeX_Fraktur-Bold.woff
  63. BIN
      public/lib/katex/fonts/KaTeX_Fraktur-Bold.woff2
  64. BIN
      public/lib/katex/fonts/KaTeX_Fraktur-Regular.ttf
  65. BIN
      public/lib/katex/fonts/KaTeX_Fraktur-Regular.woff
  66. BIN
      public/lib/katex/fonts/KaTeX_Fraktur-Regular.woff2
  67. BIN
      public/lib/katex/fonts/KaTeX_Main-Bold.ttf
  68. BIN
      public/lib/katex/fonts/KaTeX_Main-Bold.woff
  69. BIN
      public/lib/katex/fonts/KaTeX_Main-Bold.woff2
  70. BIN
      public/lib/katex/fonts/KaTeX_Main-BoldItalic.ttf
  71. BIN
      public/lib/katex/fonts/KaTeX_Main-BoldItalic.woff
  72. BIN
      public/lib/katex/fonts/KaTeX_Main-BoldItalic.woff2
  73. BIN
      public/lib/katex/fonts/KaTeX_Main-Italic.ttf
  74. BIN
      public/lib/katex/fonts/KaTeX_Main-Italic.woff
  75. BIN
      public/lib/katex/fonts/KaTeX_Main-Italic.woff2
  76. BIN
      public/lib/katex/fonts/KaTeX_Main-Regular.ttf
  77. BIN
      public/lib/katex/fonts/KaTeX_Main-Regular.woff
  78. BIN
      public/lib/katex/fonts/KaTeX_Main-Regular.woff2
  79. BIN
      public/lib/katex/fonts/KaTeX_Math-BoldItalic.ttf
  80. BIN
      public/lib/katex/fonts/KaTeX_Math-BoldItalic.woff
  81. BIN
      public/lib/katex/fonts/KaTeX_Math-BoldItalic.woff2
  82. BIN
      public/lib/katex/fonts/KaTeX_Math-Italic.ttf
  83. BIN
      public/lib/katex/fonts/KaTeX_Math-Italic.woff
  84. BIN
      public/lib/katex/fonts/KaTeX_Math-Italic.woff2
  85. BIN
      public/lib/katex/fonts/KaTeX_SansSerif-Bold.ttf
  86. BIN
      public/lib/katex/fonts/KaTeX_SansSerif-Bold.woff
  87. BIN
      public/lib/katex/fonts/KaTeX_SansSerif-Bold.woff2
  88. BIN
      public/lib/katex/fonts/KaTeX_SansSerif-Italic.ttf
  89. BIN
      public/lib/katex/fonts/KaTeX_SansSerif-Italic.woff
  90. BIN
      public/lib/katex/fonts/KaTeX_SansSerif-Italic.woff2
  91. BIN
      public/lib/katex/fonts/KaTeX_SansSerif-Regular.ttf
  92. BIN
      public/lib/katex/fonts/KaTeX_SansSerif-Regular.woff
  93. BIN
      public/lib/katex/fonts/KaTeX_SansSerif-Regular.woff2
  94. BIN
      public/lib/katex/fonts/KaTeX_Script-Regular.ttf
  95. BIN
      public/lib/katex/fonts/KaTeX_Script-Regular.woff
  96. BIN
      public/lib/katex/fonts/KaTeX_Script-Regular.woff2
  97. BIN
      public/lib/katex/fonts/KaTeX_Size1-Regular.ttf
  98. BIN
      public/lib/katex/fonts/KaTeX_Size1-Regular.woff
  99. BIN
      public/lib/katex/fonts/KaTeX_Size1-Regular.woff2
  100. BIN
      public/lib/katex/fonts/KaTeX_Size2-Regular.ttf

+ 1 - 1
.gitignore

@@ -3,7 +3,7 @@
 
 ### Hugo ###
 # Generated files by hugo
-/public/
+#/public/
 /resources/_gen/
 /assets/jsconfig.json
 hugo_stats.json

+ 98 - 0
public/404.html

@@ -0,0 +1,98 @@
+<!DOCTYPE html>
+<html lang="en-us">
+
+<head>
+    <title>
+404 | codeskraps
+</title>
+
+    <meta http-equiv="content-type" content="text/html; charset=utf-8">
+<meta name="viewport" content="width=device-width, initial-scale=1.0">
+<meta name="description" content="Your website description">
+
+<meta name="generator" content="Hugo 0.134.3">
+
+
+<link rel="canonical" href="https://codeskraps.com/404.html" >
+
+
+
+
+<link href="/css/style.min.ee0d47e4d4346c71a65a9e873108c81ffae54d60a2fc2338f6df394eb4b25a82.css" rel="stylesheet">
+
+
+
+
+</head>
+
+<body>
+
+    <div class="flexWrapper">
+        <header class="headerWrapper">
+    <div class="header">
+        <div>
+            <a class="terminal" href="https://codeskraps.com/">
+                <span>me@codeskraps.com ~ $</span>
+            </a>
+        </div>
+        <input class="side-menu" type="checkbox" id="side-menu">
+        <label class="hamb" for="side-menu"><span class="hamb-line"></span></label>
+        <nav class="headerLinks">
+            <ul>
+                
+                <li>
+                    <a href="https://codeskraps.com/projects/" title="" >
+                        ~/projects</a>
+                </li>
+                
+                <li>
+                    <a href="https://codeskraps.com/about/" title="" >
+                        ~/about</a>
+                </li>
+                
+                <li>
+                    <a href="https://codeskraps.com/posts/" title="" >
+                        ~/posts</a>
+                </li>
+                
+            </ul>
+        </nav>
+    </divi>
+    
+      <script async src="https://www.googletagmanager.com/gtag/js?id=G-YP8WK3KZF1"></script>
+      <script>
+        var doNotTrack = false;
+        if ( false ) {
+          var dnt = (navigator.doNotTrack || window.doNotTrack || navigator.msDoNotTrack);
+          var doNotTrack = (dnt == "1" || dnt == "yes");
+        }
+        if (!doNotTrack) {
+          window.dataLayer = window.dataLayer || [];
+          function gtag(){dataLayer.push(arguments);}
+          gtag('js', new Date());
+          gtag('config', 'G-YP8WK3KZF1');
+        }
+      </script>
+</header>
+
+
+        <div class="content">
+            <main class="main">
+                
+<h1>NOT FOUND</h1>
+<p>You just hit a route that doesn&#39;t exist...</p>
+
+            </main>
+        </div>
+
+
+        <footer class="footer">
+    
+        <span>CC 2024, Built with <a href="https://gohugo.io" class="footerLink">Hugo</a> and <a href="https://github.com/LordMathis/hugo-theme-nightfall" class="footerLink">Nightfall</a> theme</span>
+    
+</footer>
+    </div>
+
+</body>
+
+</html>

+ 157 - 0
public/about/index.html

@@ -0,0 +1,157 @@
+<!DOCTYPE html>
+<html lang="en-us">
+
+<head>
+    <title>
+About | codeskraps
+</title>
+
+    <meta http-equiv="content-type" content="text/html; charset=utf-8">
+<meta name="viewport" content="width=device-width, initial-scale=1.0">
+<meta name="description" content="Your website description">
+
+<meta name="generator" content="Hugo 0.134.3">
+
+
+<link rel="canonical" href="https://codeskraps.com/about/" >
+
+
+
+
+<link href="/css/style.min.ee0d47e4d4346c71a65a9e873108c81ffae54d60a2fc2338f6df394eb4b25a82.css" rel="stylesheet">
+
+
+
+
+</head>
+
+<body>
+
+    <div class="flexWrapper">
+        <header class="headerWrapper">
+    <div class="header">
+        <div>
+            <a class="terminal" href="https://codeskraps.com/">
+                <span>me@codeskraps.com ~ $</span>
+            </a>
+        </div>
+        <input class="side-menu" type="checkbox" id="side-menu">
+        <label class="hamb" for="side-menu"><span class="hamb-line"></span></label>
+        <nav class="headerLinks">
+            <ul>
+                
+                <li>
+                    <a href="https://codeskraps.com/projects/" title="" >
+                        ~/projects</a>
+                </li>
+                
+                <li>
+                    <a href="https://codeskraps.com/about/" title="" >
+                        ~/about</a>
+                </li>
+                
+                <li>
+                    <a href="https://codeskraps.com/posts/" title="" >
+                        ~/posts</a>
+                </li>
+                
+            </ul>
+        </nav>
+    </divi>
+    
+      <script async src="https://www.googletagmanager.com/gtag/js?id=G-YP8WK3KZF1"></script>
+      <script>
+        var doNotTrack = false;
+        if ( false ) {
+          var dnt = (navigator.doNotTrack || window.doNotTrack || navigator.msDoNotTrack);
+          var doNotTrack = (dnt == "1" || dnt == "yes");
+        }
+        if (!doNotTrack) {
+          window.dataLayer = window.dataLayer || [];
+          function gtag(){dataLayer.push(arguments);}
+          gtag('js', new Date());
+          gtag('config', 'G-YP8WK3KZF1');
+        }
+      </script>
+</header>
+
+
+        <div class="content">
+            <main class="main">
+                
+  <article>
+      <header>
+        <h1>
+          About Me
+        </h1>
+      </header>
+      <p>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+  
+  
+  
+      
+      
+  <picture>
+  <img class="img-fluid" src="https://codeskraps.com/images/me_codeskraps.gif?v=9df9e0930034eb1e10990a99d3ef1056" alt="me" loading="lazy" height="107" width="150" />
+</picture>
+</p>
+<p>I&rsquo;m a passionate and highly motivated software engineer with a deep-rooted love for technology that dates back to my first computer, an Amstrad 8256. From those early days of programming as a hobby, I&rsquo;ve turned my passion into a successful career, specializing in mobile development with a focus on Android.</p>
+<!-- raw HTML omitted -->
+<h2 id="professional-journey">Professional Journey</h2>
+<p>Currently, I&rsquo;m leading the mobile team at Game Golf, where I oversee all aspects of our mobile app development. My experience spans various domains, including:</p>
+<ul>
+<li>Android app development and maintenance</li>
+<li>iOS development</li>
+<li>Backend technologies like Spring Framework and RESTful APIs</li>
+<li>Working in fast-paced, agile environments</li>
+</ul>
+<p>Throughout my career, I&rsquo;ve contributed to award-winning apps and worked with startups and established companies alike. I take pride in writing clean, efficient code and designing scalable solutions that adhere to best practices in object-oriented programming.</p>
+<h2 id="technical-expertise">Technical Expertise</h2>
+<p>My skill set includes:</p>
+<ul>
+<li>Proficiency in Java, Kotlin, and Android SDK</li>
+<li>Experience with iOS development</li>
+<li>Familiarity with various libraries and frameworks (RxJava, Dagger2, Room, LiveData, etc.)</li>
+<li>Version control with Git</li>
+<li>Database technologies (SQLite, MongoDB)</li>
+<li>Some web development (HTML, CSS, JavaScript)</li>
+</ul>
+<p>I&rsquo;m always eager to learn and stay up-to-date with the latest trends in technology, particularly in the mobile development world.</p>
+<h2 id="beyond-coding">Beyond Coding</h2>
+<p>Outside of my professional work, I&rsquo;m an active member of the tech community. I co-founded 091 Labs, a local hackerspace, where I&rsquo;ve conducted workshops on Android development. I&rsquo;m also passionate about open-source projects and have contributed to various initiatives on GitHub and Launchpad.</p>
+<p>As a multilingual professional fluent in English, Catalan, and Spanish, I bring a global perspective to my work and enjoy collaborating with diverse teams.</p>
+<p>Whether it&rsquo;s developing innovative mobile applications, contributing to open-source projects, or sharing knowledge with aspiring developers, I&rsquo;m always excited to take on new challenges in the ever-evolving world of technology.</p>
+<p>Feel free to check out my work on <a href="https://github.com/codeskraps">GitHub</a> or my published apps on the <a href="https://play.google.com/store/apps/developer?id=Codeskraps">Google Play Store</a>.</p>
+
+    </div>
+  </article>
+
+            </main>
+        </div>
+
+
+        <footer class="footer">
+    
+        <span>CC 2024, Built with <a href="https://gohugo.io" class="footerLink">Hugo</a> and <a href="https://github.com/LordMathis/hugo-theme-nightfall" class="footerLink">Nightfall</a> theme</span>
+    
+</footer>
+    </div>
+
+</body>
+
+</html>

+ 111 - 0
public/categories/index.html

@@ -0,0 +1,111 @@
+<!DOCTYPE html>
+<html lang="en-us">
+
+<head>
+    <title>
+Categories | codeskraps
+</title>
+
+    <meta http-equiv="content-type" content="text/html; charset=utf-8">
+<meta name="viewport" content="width=device-width, initial-scale=1.0">
+<meta name="description" content="Your website description">
+
+<meta name="generator" content="Hugo 0.134.3">
+
+
+<link rel="canonical" href="https://codeskraps.com/categories/" >
+  <link href="https://codeskraps.com/categories/index.xml" rel="alternate" type="application/rss+xml" title="codeskraps" >
+  <link href="https://codeskraps.com/categories/index.xml" rel="feed" type="application/rss+xml" title="codeskraps" >
+
+
+
+
+<link href="/css/style.min.ee0d47e4d4346c71a65a9e873108c81ffae54d60a2fc2338f6df394eb4b25a82.css" rel="stylesheet">
+
+
+
+
+</head>
+
+<body>
+
+    <div class="flexWrapper">
+        <header class="headerWrapper">
+    <div class="header">
+        <div>
+            <a class="terminal" href="https://codeskraps.com/">
+                <span>me@codeskraps.com ~ $</span>
+            </a>
+        </div>
+        <input class="side-menu" type="checkbox" id="side-menu">
+        <label class="hamb" for="side-menu"><span class="hamb-line"></span></label>
+        <nav class="headerLinks">
+            <ul>
+                
+                <li>
+                    <a href="https://codeskraps.com/projects/" title="" >
+                        ~/projects</a>
+                </li>
+                
+                <li>
+                    <a href="https://codeskraps.com/about/" title="" >
+                        ~/about</a>
+                </li>
+                
+                <li>
+                    <a href="https://codeskraps.com/posts/" title="" >
+                        ~/posts</a>
+                </li>
+                
+            </ul>
+        </nav>
+    </divi>
+    
+      <script async src="https://www.googletagmanager.com/gtag/js?id=G-YP8WK3KZF1"></script>
+      <script>
+        var doNotTrack = false;
+        if ( false ) {
+          var dnt = (navigator.doNotTrack || window.doNotTrack || navigator.msDoNotTrack);
+          var doNotTrack = (dnt == "1" || dnt == "yes");
+        }
+        if (!doNotTrack) {
+          window.dataLayer = window.dataLayer || [];
+          function gtag(){dataLayer.push(arguments);}
+          gtag('js', new Date());
+          gtag('config', 'G-YP8WK3KZF1');
+        }
+      </script>
+</header>
+
+
+        <div class="content">
+            <main class="main">
+                
+
+<div>
+    <div class="listHeader">
+        <h1>Categories</h1>
+    </div>
+
+    
+
+    <div>
+        
+    </div>
+</div>
+
+
+            </main>
+        </div>
+
+
+        <footer class="footer">
+    
+        <span>CC 2024, Built with <a href="https://gohugo.io" class="footerLink">Hugo</a> and <a href="https://github.com/LordMathis/hugo-theme-nightfall" class="footerLink">Nightfall</a> theme</span>
+    
+</footer>
+    </div>
+
+</body>
+
+</html>

+ 13 - 0
public/categories/index.xml

@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes"?>
+<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
+  <channel>
+    <title>Categories on codeskraps</title>
+    <link>https://codeskraps.com/categories/</link>
+    <description>Recent content in Categories on codeskraps</description>
+    <generator>Hugo</generator>
+    <language>en-us</language>
+    <managingEditor>me@codeskraps.com (codeskraps)</managingEditor>
+    <webMaster>me@codeskraps.com (codeskraps)</webMaster>
+    <atom:link href="https://codeskraps.com/categories/index.xml" rel="self" type="application/rss+xml" />
+  </channel>
+</rss>

BIN
public/codeskraps_icon.png


+ 727 - 0
public/css/style.css

@@ -0,0 +1,727 @@
+/* defines light color */
+:root {
+  --color-light-bg-page: #EBEBEB;
+  --color-light-bg-content: #F4F4F4;
+  --color-light-bg-block: #EBEBEB;
+  --color-light-bg-shadow: #E0E0E0;
+  --color-light-fg-font-normal: #4E403E;
+  --color-light-fg-font-hover: #555555;
+  --color-light-fg-font-quote: #57606A;
+  --color-light-fg-tiny-line: #e0e0e0;
+  --color-light-fg-marker-quote: #BFBFBF;
+  --color-light-fg-font-hyper: #4E403E;
+  --color-light-fg-font-hyper-hover: #DE629E;
+  --color-light-fg-hyperlink: #DE629E;
+  --color-light-fg-hyperlink-hover: #CB3E50;
+  --color-light-bg-pager-normal: #D4D4D4;
+  --color-light-bg-pager-current: #E4E4E4;
+  --color-light-bg-pager-hover: #ECECEC;
+}
+
+/* defines dark color */
+:root {
+  --color-dark-bg-page: #202124;
+  --color-dark-bg-content: #262628;
+  --color-dark-bg-block: #2B2B2B;
+  --color-dark-bg-shadow: #505050;
+  --color-dark-fg-font-normal: #C2C2B6;
+  --color-dark-fg-font-hover: #D2D2D3;
+  --color-dark-fg-font-quote: #8B8680;
+  --color-dark-fg-tiny-line: #3B3B3B;
+  --color-dark-fg-marker-quote: #6F6B66;
+  --color-dark-fg-font-hyper: #C2C2B6;
+  --color-dark-fg-font-hyper-hover: #DE629E;
+  --color-dark-fg-hyperlink: #DE629E;
+  --color-dark-fg-hyperlink-hover: #CB3E50;
+  --color-dark-bg-pager-normal: #303030;
+  --color-dark-bg-pager-current: #3A3A3E;
+  --color-dark-bg-pager-hover: #444446;
+}
+
+:root {
+  --color-bg-page:                  var(--color-light-bg-page);
+  --color-bg-content:               var(--color-light-bg-content);
+  --color-bg-block:                 var(--color-light-bg-block);
+  --color-bg-shadow:                var(--color-light-bg-shadow);
+  --color-fg-font-normal:           var(--color-light-fg-font-normal);
+  --color-fg-font-hover:            var(--color-light-fg-font-hover);
+  --color-fg-font-quote:            var(--color-light-fg-font-quote);
+  --color-fg-tiny-line:             var(--color-light-fg-tiny-line);
+  --color-fg-marker-quote:          var(--color-light-fg-marker-quote);
+  --color-fg-font-hyper:            var(--color-light-fg-font-hyper);
+  --color-fg-font-hyper-hover:      var(--color-light-fg-font-hyper-hover);
+  --color-fg-hyperlink:             var(--color-light-fg-hyperlink);
+  --color-fg-hyperlink-hover:       var(--color-light-fg-hyperlink-hover);
+  --color-bg-pager-normal:          var(--color-light-bg-pager-normal);
+  --color-bg-pager-current:         var(--color-light-bg-pager-current);
+  --color-bg-pager-hover:           var(--color-light-bg-pager-hover);
+}
+
+@media (prefers-color-scheme: dark) {
+  :root {
+    --color-bg-page:                var(--color-dark-bg-page);
+    --color-bg-content:             var(--color-dark-bg-content);
+    --color-bg-block:               var(--color-dark-bg-block);
+    --color-bg-shadow:              var(--color-dark-bg-shadow);
+    --color-fg-font-normal:         var(--color-dark-fg-font-normal);
+    --color-fg-font-hover:          var(--color-dark-fg-font-hover);
+    --color-fg-font-quote:          var(--color-dark-fg-font-quote);
+    --color-fg-tiny-line:           var(--color-dark-fg-tiny-line);
+    --color-fg-marker-quote:        var(--color-dark-fg-marker-quote);
+    --color-fg-font-hyper:          var(--color-dark-fg-font-hyper);
+    --color-fg-font-hyper-hover:    var(--color-dark-fg-font-hyper-hover);
+    --color-fg-hyperlink:           var(--color-dark-fg-hyperlink);
+    --color-fg-hyperlink-hover:     var(--color-dark-fg-hyperlink-hover);
+    --color-bg-pager-normal:        var(--color-dark-bg-pager-normal);
+    --color-bg-pager-current:       var(--color-dark-bg-pager-current);
+    --color-bg-pager-hover:         var(--color-dark-bg-pager-hover);
+  }
+}
+
+:root {
+  --fonts-sans-en: "Noto Sans", "Droid Sans", "Calibri", "Arial";
+  --fonts-sans-zh: "WenQuanYi Zen Hei", "WenQuanYi Micro Hei",
+                   "Noto Sans CJK", "Microsoft YaHei", "PingFang SC";
+  --fonts-sans: var(--fonts-sans-en), var(--fonts-sans-zh), sans-serif;
+
+  --fonts-serif-en: "Noto Serif", "Times New Roman";
+  --fonts-serif-zh: "Noto Serif CJK", SimSun, STSong;
+  --fonts-serif: var(--fonts-serif-en), var(--fonts-serif-zh), serif;
+
+  --fonts-mono-en: "DejaVu Sans Mono", "Noto Sans Mono", "Consolas", "Courier";
+  --fonts-mono-zh: "Noto Sans Mono CJK", "WenQuanYi Zen Hei Mono", "WenQuanYi Micro Hei Mono";
+  --fonts-mono: var(--fonts-mono-en), var(--fonts-mono-zh), monospace;
+
+  --len-0: 0.00rem;
+  --len-1: 0.25rem;
+  --len-2: 0.50rem;
+  --len-3: 1.00rem;
+  --len-4: 1.50rem;
+  --len-5: 3.00rem;
+
+  --font-size-0: 0.8125rem;
+  --font-size-1: 0.875rem;
+  --font-size-2: 1.000rem;
+  --font-size-3: 1.125rem;
+  --font-size-4: 1.250rem;
+  --font-size-5: 1.500rem;
+  --font-size-6: 2.000rem;
+}
+
+
+*, ::before, ::after {
+  font-family: inherit;
+  box-sizing: border-box;
+}
+
+html {
+  font-family: var(--fonts-sans);
+  font-size: 16px;
+  color: var(--color-fg-font-normal);
+}
+
+/**************************************************************/
+/* approximately set up the layout of header, footer and main */
+/**************************************************************/
+
+body {
+  display: flex;
+  flex-direction: column;
+
+  min-height: 100vh;
+  margin: 0;
+
+  align-items: center;
+
+  background-color: var(--color-bg-page);
+}
+
+/* set up padding and margin of some main elements */
+.main-wrapper {
+  margin-top: var(--len-5);
+  margin-bottom: var(--len-5);
+}
+
+.main-wrapper { display: flex; flex-wrap: wrap; }
+.main-wrapper > * { height: fit-content; }
+
+.main { padding: var(--len-4); }
+.side { padding-left: var(--len-4); }
+.main { flex: 0 0 72%; width: 72%; }
+.side { flex: 0 0 28%; width: 28%; }
+
+/* mobile layout: place side to bottom */
+@media (max-width: 991px) {
+  .main { padding: var(--len-4); }
+  .side { padding-left: 0; padding-top: var(--len-4); }
+  .main { flex: 0 0 100%; width: 100%; }
+  .side { flex: 0 0 100%; width: 100%; }
+}
+
+/* set light background */
+.header-wrapper,
+.footer,
+.main,
+.side-recent,
+.side-categories,
+.side-tags
+{
+  background-color: var(--color-bg-content);
+}
+
+/* place header in the center of header-wrapper */
+.header-wrapper {
+  display: flex;
+  justify-content: center;
+}
+
+/* let footer stay at bottom of screen */
+.footer {
+  margin-top: auto;
+  margin-bottom: 0;
+}
+
+
+/********** set up break point **********/
+
+                             .main-wrapper, .header { max-width: 1140px; }
+@media (max-width: 1199px) { .main-wrapper, .header { max-width: 960px; } }
+@media (max-width: 991px)  { .main-wrapper, .header { max-width: 720px; } }
+@media (max-width: 767px)  { .main-wrapper, .header { max-width: 540px; } }
+@media (max-width: 575px)  { .main-wrapper, .header { max-width: none; } }
+
+/* size the element who has breakpoint limitation */
+/* .header, .main-wrapper, .main { width: 100vw; } */
+/* .header-wrapper, .footer { width: 100vw; } */
+.header-wrapper, .footer { width: 100vw;}
+.main-wrapper { width: calc(100vw - 2 * var(--len-3));}
+
+/************************/
+/* set up header layout */
+/************************/
+
+.header {
+  padding: var(--len-3);
+  width: 100%;
+}
+
+/* place title and menus horizonally */
+.header {
+  display: flex;
+  flex-wrap: wrap;
+  align-content: center;
+  justify-content: space-between;
+}
+
+.header .menu { justify-content: center; align-items: center; }
+.header .site-title { text-align: center; }
+
+@media (max-width: 767px) {
+  .header .site-title {
+    padding-top: var(--len-4);
+
+    flex: 0 0 100%;
+  }
+
+  .header .menu {
+    flex-wrap: wrap;
+    flex: 0 0 100%;
+
+    margin-top: var(--len-3);
+    padding-top: var(--len-3);
+    border-top: 1px solid var(--color-fg-tiny-line);
+  }
+}
+
+/* setup hyper link style */
+.header .site-title {
+  text-decoration: none;
+  font-family: var(--fonts-serif);
+  font-size: var(--font-size-6);
+  font-weight: bold;
+}
+
+/********** set up menus layout **********/
+
+/* menus and submenus, hover to display, and setup animation */
+.header .menu-item       .sub-menu { visibility: hidden;  opacity: 0; transition: opacity 0.25s, visibility 0.25s; }
+.header .menu-item:hover .sub-menu { visibility: visible; opacity: 1; }
+.header .sub-menu { position: absolute; }
+
+/* menu direction */
+.header .menu {
+  display: flex;
+  align-items: center;
+}
+.header .sub-menu {
+  display: flex;
+  flex-direction: column;
+  align-items: flex-start;
+}
+
+/* set up spacing of menu items in menu and sub-menu */
+.header .menu > *            { margin-right: var(--len-3); }
+.header .menu > *:last-child { margin-right: 0; }
+.header .sub-menu > *            { margin-bottom: var(--len-2); }
+.header .sub-menu > *:last-child { margin-bottom: 0; }
+
+/* beautify sub menu style */
+.header .sub-menu {
+  background-color: var(--color-bg-content);
+  padding: var(--len-2) var(--len-4);
+  box-shadow: var(--color-bg-shadow) 0px 0px 3px 1px;
+  border-radius: 3px;
+}
+
+/* beautify menu item */
+.header .menu-item {
+  font-family: var(--fonts-serif);
+  font-size: var(--font-size-3);
+  font-weight: bold;
+}
+
+.header a       { color: var(--color-fg-font-normal); text-decoration: none; }
+.header a:hover { color: var(--color-fg-font-hover); }
+
+/************************/
+/* set up footer layout */
+/************************/
+
+.footer {
+  padding: var(--len-4) 0;
+  font-size: var(--font-size-1);
+}
+
+.footer > * {
+  margin-top: var(--len-2);
+  margin-bottom: var(--len-2);
+}
+
+/* credit, license and social layout */
+.footer .footer-row { display: flex; justify-content: center; }
+
+.footer .footer-item            { margin-right: var(--len-3); }
+.footer .footer-item:last-child { margin-right: 0; }
+
+/* beautify hyper link style */
+.footer { color: var(--color-fg-font-normal) }
+
+.footer a       { color: var(--color-fg-hyperlink); text-decoration: none; }
+.footer a:hover { color: var(--color-fg-hyperlink-hover); }
+
+/**********************************/
+/* set up home page's list layout */
+/**********************************/
+
+.list-item .tips {
+  display: flex;
+  flex-wrap: wrap;
+  justify-content: start;
+  align-items: flex-start;
+
+  font-size: var(--font-size-1);
+  color: var(--color-fg-font-quote);
+}
+
+.list-item .tips > *            { margin-right: var(--len-3); }
+.list-item .tips > *:last-child { margin-right: 0; }
+
+.list-item .title a { text-decoration: none; color: var(--color-fg-font-normal); }
+.list-item .title a:hover { color: var(--color-fg-font-hover); }
+.list-item .tips a { text-decoration: none; color: var(--color-fg-hyperlink); }
+.list-item .tips a:hover { color: var(--color-fg-hyperlink-hover); }
+
+.list-item .title { margin: var(--len-2) 0 var(--len-3) 0; }
+
+.list-item .tags > *,
+.list-item .categories > *
+{ margin: 0 var(--len-1); }
+
+.list-item .summary > * { margin: 0; }
+.list-item .title { margin: 0 0 var(--len-2) 0; }
+.list-item .tips { margin: 0 0 var(--len-3) 0; }
+
+.list-item            { border-bottom: 1px solid var(--color-fg-tiny-line); }
+.list-item:last-child { border-bottom: 0; }
+
+.list-item:first-child { padding-top: 0;}
+.list-item             { padding: var(--len-3) 0; }
+.list-item:last-child  { padding-bottom: 0;}
+
+/**********************/
+/* set up side layout */
+/**********************/
+
+.side h2 { margin: 0; }
+
+.side ul { list-style: none; margin: 0; padding: 0; }
+
+.side li            { margin-bottom: var(--len-3); }
+.side li:last-child { margin-bottom: 0; }
+
+.side hr {
+  border: none;
+  height: 1px;
+  background-color: var(--color-bg-content);
+
+  margin: var(--len-2) 0;
+}
+
+.side > * { padding: var(--len-4); }
+
+.side > *            { margin-bottom: var(--len-3); }
+.side > *:last-child { margin-bottom: 0; }
+
+.side a       { color: var(--color-fg-font-normal); text-decoration: none; }
+.side a:hover { color: var(--color-fg-hyperlink); }
+
+/* horizontally place tags */
+.side .side-tags li { display: inline-block; margin: var(--len-1) var(--len-1); }
+
+/*****************************/
+/* set up single post layout */
+/*****************************/
+
+.single {
+  display: flex;
+  flex-direction: column;
+  align-items: center;
+}
+
+.single a { text-decoration: none; color: var(--color-fg-hyperlink); }
+.single a:hover { color: var(--color-fg-hyperlink-hover); }
+
+.single .title,
+.single .tip,
+.single .taxonomies,
+.single .content
+{ width: 100%; }
+
+.single .taxonomies { margin-top: var(--len-1); }
+
+.single > hr {
+  border: none;
+  background-color: var(--color-fg-tiny-line);
+  height: 1px;
+
+  width: 90%;
+  margin: var(--len-3) 0;
+}
+
+.single .title,
+.single .tip,
+.single .taxonomies
+{ text-align: center; }
+
+.single .tip,
+.single .taxonomies
+{ color: var(--color-fg-font-normal)}
+
+.single .taxonomies > * { display: inline-block; }
+
+.single .taxonomies > * { margin-right: var(--len-3); }
+.single .taxonomies > *:last-child { margin-right: 0; }
+
+.single .title {
+  margin: var(--len-2) 0 var(--len-3) 0;
+  font-size: var(--font-size-6);
+}
+
+
+/***** set up content style *****/
+
+.content {
+    line-height: 1.5;
+}
+
+.content code {
+  font-family: var(--fonts-mono);
+
+  background-color: var(--color-bg-block);
+
+  padding: 0 2px;
+  border: 1px solid var(--color-fg-tiny-line);
+  border-radius: 2px;
+  line-height: inherit;
+  word-wrap: break-word;
+}
+
+/* keep in style with highlighting */
+.content pre {
+  background-color: var(--color-bg-block);
+  border-radius: 3px;
+
+  /* The copy button with absolute position need this.
+   * https://developer.mozilla.org/en-US/docs/Web/CSS/position
+   * https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
+  */
+  position: relative;
+}
+
+.content pre code {
+  display: block;
+
+  padding: var(--len-3);
+  border: none;
+  background-color: unset;
+  overflow: auto;
+  width: 100%;
+}
+
+.content blockquote {
+  margin-top: 5px;
+  margin-bottom: 5px;
+  padding-left: 1em;
+  margin-left: 0px;
+  border-left: 3px solid var(--color-fg-marker-quote);
+  color: var(--color-fg-font-quote);
+}
+
+.content hr {
+  border: none;
+  height: 2px;
+  background-color: var(--color-fg-tiny-line);
+
+  width: 80%;
+  margin: var(--len-2) auto;
+}
+
+.content table {
+  width: 100%;
+  margin: 40px 0;
+  border-collapse: collapse;
+  line-height: 1.5em;
+}
+
+.content th,
+.content td {
+  text-align: left;
+  padding-right: 20px;
+  vertical-align: top;
+}
+
+.content table td,
+.content table td {
+  border-spacing: none;
+  border-style: solid;
+  padding: 10px 15px;
+  border-width: 1px 0 0 0;
+}
+.content thead th,
+.content thead th {
+  text-align: left;
+  padding: 10px 15px;
+  height: 20px;
+  font-weight: bold;
+  color: #444;
+  cursor: default;
+  white-space: nowrap;
+  border: 1px solid #dadadc;
+}
+
+.content tr>td {
+  border: 1px solid #dadadc;
+}
+
+.content tr:nth-child(odd)>td {
+  background: #fcfcfc;
+}
+
+.content h1,
+.content h2,
+.content h3 {
+  font-weight: bold;
+}
+.content p,
+.content pre {
+  word-break: normal;
+  overflow-wrap: anywhere;
+}
+.content img {
+  max-width: 92%;
+  display: block;
+  margin-left: auto;
+  margin-right: auto;
+}
+.content .anchor {
+  visibility: hidden;
+}
+.content h1:hover a,
+.content h2:hover a,
+.content h3:hover a,
+.content h4:hover a
+{ visibility: visible }
+
+.highlight pre {
+  overflow-x: auto;
+}
+
+.highlight {
+  max-width: 100%;
+  overflow-x: auto;
+}
+
+/* the copy button added by /js/copy-code-button.js */
+pre .copyCodeButton {
+  position: absolute;
+  top: var(--len-1);
+  right: var(--len-3);
+
+  font-family: var(--fonts-mono);
+  color: var(--color-fg-hyperlink);
+  cursor: pointer;
+  visibility: hidden;
+}
+pre:hover .copyCodeButton {
+  visibility: visible;
+}
+pre .copyCodeButton:hover {
+  color: var(--color-fg-hyperlink-hover);
+}
+
+/**************************/
+/* setup list page layout */
+/**************************/
+
+#archive {
+  padding-left: var(--len-3);
+}
+
+#archive .group {
+  margin: var(--len-4) auto;
+}
+#archive .group .key {
+  font-size: var(--font-size-4);
+  margin-bottom: var(--len-2);
+}
+#archive .group .value {
+  display: block;
+  font-size: var(--font-size-2);
+  margin-bottom: 12px;
+}
+#archive .group .value   { text-indent: -60px; padding-left: 60px; }
+#archive .group .value * { text-indent: 0; }
+#archive .group .value .date  { display: inline-block; width: 60px; }
+#archive .group .value .title { display: inline; }
+
+#archive .group .value .date { color: var(--color-fg-font-normal); }
+
+#archive .group .value a { text-decoration: none; }
+
+#archive .group .value a { color: var(--color-fg-font-hyper); }
+#archive .group .value a:hover { color: var(--color-fg-font-hyper-hover); }
+
+#archive .group .value .tags {
+  display: inline-block;
+  margin-left: 7px;
+}
+#archive .group .value .tags {
+  background: var(--color-bg-block);
+  border-radius: 2px;
+  padding: 4px 7px;
+  font-size: var(--font-size-1);
+  margin-right: 3px;
+}
+
+/**********************/
+/* setup terms layout */
+/**********************/
+
+#tags {
+  max-width: 700px;
+  margin: 48px auto 0 auto;
+  padding: 0 12px;
+  text-align: center;
+}
+#tags .tag {
+  display: inline-block;
+  margin: 7px 7px;
+}
+@media (max-width: 700px) {
+  #tags {
+    margin: 0 auto 0 auto;
+  }
+  #tags .tag {
+    display: inline-block;
+    margin: 4px 5px;
+  }
+}
+
+#tags .tag a {
+  background: #f2f2f2;
+  padding: 4px 7px;
+  color: #757575;
+  color: #404040;
+  font-size: 14px;
+  margin-right: 3px;
+}
+#tags .tag a:hover {
+  color: #0366d6;
+}
+
+/***************************/
+/* setup pagination layout */
+/***************************/
+
+.pagination {
+  width: 100%;
+  text-align: center;
+
+  padding-top: var(--len-5);
+}
+
+.pagination a {
+  display: inline-block;
+
+  font-size: var(--font-size-2);
+
+  border-radius: var(--len-5);
+  width: var(--len-5);
+  height: var(--len-5);
+  line-height: var(--len-5);
+
+  text-align: center;
+  vertical-align: middle;
+
+  text-decoration: none;
+
+  color: var(--color-fg-font-normal);
+  background-color: var(--color-bg-pager-normal);
+
+  transition: background-color 0.25s;
+}
+
+.pagination a:hover {
+  background-color: var(--color-bg-pager-hover);
+}
+
+.pagination a.current {
+  background-color: var(--color-bg-pager-current);
+  pointer-events: none;
+  color: var(--color-fg-font-normal);
+  cursor: default;
+}
+
+/***************************/
+/* setup commenting layout */
+/***************************/
+
+.commenting {
+  width: 85%;
+}
+
+/**********/
+/** misc **/
+/**********/
+
+.archive-hint {
+  padding-left: var(--len-4);
+  color: var(--color-fg-font-quote);
+}
+
+.max-wrapper {
+  width: 100%;
+  height: 100%;
+  padding: 0;
+  margin: 0;
+}

File diff suppressed because it is too large
+ 1 - 0
public/css/style.min.36c061153203db94fc1169914d07c49c3a537a11316e9ffbd4c7a511df482d8d.css


File diff suppressed because it is too large
+ 1 - 0
public/css/style.min.38d8ec3c7cca8185fe94ab7dc7ca79d69e14b78ca3c077807b2c32725df95c62.css


File diff suppressed because it is too large
+ 1 - 0
public/css/style.min.ee0d47e4d4346c71a65a9e873108c81ffae54d60a2fc2338f6df394eb4b25a82.css


+ 177 - 0
public/css/syntax.css

@@ -0,0 +1,177 @@
+@media (prefers-color-scheme: light) {
+  /* Background */ .bg { color: #272822; }
+  /* PreWrapper */ .chroma { color: #272822; }
+  /* Other */ .chroma .x {  }
+  /* Error */ .chroma .err { color: #960050; background-color: #1e0010 }
+  /* CodeLine */ .chroma .cl {  }
+  /* LineTableTD */ .chroma .lntd { vertical-align: top; padding: 0; margin: 0; border: 0; }
+  /* LineTable */ .chroma .lntable { border-spacing: 0; padding: 0; margin: 0; border: 0; }
+  /* LineHighlight */ .chroma .hl { background-color: #ffffcc }
+  /* LineNumbersTable */ .chroma .lnt { white-space: pre; user-select: none; margin-right: 0.4em; padding: 0 0.4em 0 0.4em;color: #7f7f7f }
+  /* LineNumbers */ .chroma .ln { white-space: pre; user-select: none; margin-right: 0.4em; padding: 0 0.4em 0 0.4em;color: #7f7f7f }
+  /* Line */ .chroma .line { display: flex; }
+  /* Keyword */ .chroma .k { color: #00a8c8 }
+  /* KeywordConstant */ .chroma .kc { color: #00a8c8 }
+  /* KeywordDeclaration */ .chroma .kd { color: #00a8c8 }
+  /* KeywordNamespace */ .chroma .kn { color: #f92672 }
+  /* KeywordPseudo */ .chroma .kp { color: #00a8c8 }
+  /* KeywordReserved */ .chroma .kr { color: #00a8c8 }
+  /* KeywordType */ .chroma .kt { color: #00a8c8 }
+  /* Name */ .chroma .n { color: #111111 }
+  /* NameAttribute */ .chroma .na { color: #75af00 }
+  /* NameBuiltin */ .chroma .nb { color: #111111 }
+  /* NameBuiltinPseudo */ .chroma .bp { color: #111111 }
+  /* NameClass */ .chroma .nc { color: #75af00 }
+  /* NameConstant */ .chroma .no { color: #00a8c8 }
+  /* NameDecorator */ .chroma .nd { color: #75af00 }
+  /* NameEntity */ .chroma .ni { color: #111111 }
+  /* NameException */ .chroma .ne { color: #75af00 }
+  /* NameFunction */ .chroma .nf { color: #75af00 }
+  /* NameFunctionMagic */ .chroma .fm { color: #111111 }
+  /* NameLabel */ .chroma .nl { color: #111111 }
+  /* NameNamespace */ .chroma .nn { color: #111111 }
+  /* NameOther */ .chroma .nx { color: #75af00 }
+  /* NameProperty */ .chroma .py { color: #111111 }
+  /* NameTag */ .chroma .nt { color: #f92672 }
+  /* NameVariable */ .chroma .nv { color: #111111 }
+  /* NameVariableClass */ .chroma .vc { color: #111111 }
+  /* NameVariableGlobal */ .chroma .vg { color: #111111 }
+  /* NameVariableInstance */ .chroma .vi { color: #111111 }
+  /* NameVariableMagic */ .chroma .vm { color: #111111 }
+  /* Literal */ .chroma .l { color: #ae81ff }
+  /* LiteralDate */ .chroma .ld { color: #d88200 }
+  /* LiteralString */ .chroma .s { color: #d88200 }
+  /* LiteralStringAffix */ .chroma .sa { color: #d88200 }
+  /* LiteralStringBacktick */ .chroma .sb { color: #d88200 }
+  /* LiteralStringChar */ .chroma .sc { color: #d88200 }
+  /* LiteralStringDelimiter */ .chroma .dl { color: #d88200 }
+  /* LiteralStringDoc */ .chroma .sd { color: #d88200 }
+  /* LiteralStringDouble */ .chroma .s2 { color: #d88200 }
+  /* LiteralStringEscape */ .chroma .se { color: #8045ff }
+  /* LiteralStringHeredoc */ .chroma .sh { color: #d88200 }
+  /* LiteralStringInterpol */ .chroma .si { color: #d88200 }
+  /* LiteralStringOther */ .chroma .sx { color: #d88200 }
+  /* LiteralStringRegex */ .chroma .sr { color: #d88200 }
+  /* LiteralStringSingle */ .chroma .s1 { color: #d88200 }
+  /* LiteralStringSymbol */ .chroma .ss { color: #d88200 }
+  /* LiteralNumber */ .chroma .m { color: #ae81ff }
+  /* LiteralNumberBin */ .chroma .mb { color: #ae81ff }
+  /* LiteralNumberFloat */ .chroma .mf { color: #ae81ff }
+  /* LiteralNumberHex */ .chroma .mh { color: #ae81ff }
+  /* LiteralNumberInteger */ .chroma .mi { color: #ae81ff }
+  /* LiteralNumberIntegerLong */ .chroma .il { color: #ae81ff }
+  /* LiteralNumberOct */ .chroma .mo { color: #ae81ff }
+  /* Operator */ .chroma .o { color: #f92672 }
+  /* OperatorWord */ .chroma .ow { color: #f92672 }
+  /* Punctuation */ .chroma .p { color: #111111 }
+  /* Comment */ .chroma .c { color: #75715e }
+  /* CommentHashbang */ .chroma .ch { color: #75715e }
+  /* CommentMultiline */ .chroma .cm { color: #75715e }
+  /* CommentSingle */ .chroma .c1 { color: #75715e }
+  /* CommentSpecial */ .chroma .cs { color: #75715e }
+  /* CommentPreproc */ .chroma .cp { color: #75715e }
+  /* CommentPreprocFile */ .chroma .cpf { color: #75715e }
+  /* Generic */ .chroma .g {  }
+  /* GenericDeleted */ .chroma .gd {  }
+  /* GenericEmph */ .chroma .ge { font-style: italic }
+  /* GenericError */ .chroma .gr {  }
+  /* GenericHeading */ .chroma .gh {  }
+  /* GenericInserted */ .chroma .gi {  }
+  /* GenericOutput */ .chroma .go {  }
+  /* GenericPrompt */ .chroma .gp {  }
+  /* GenericStrong */ .chroma .gs { font-weight: bold }
+  /* GenericSubheading */ .chroma .gu {  }
+  /* GenericTraceback */ .chroma .gt {  }
+  /* GenericUnderline */ .chroma .gl {  }
+  /* TextWhitespace */ .chroma .w {  }
+}
+
+/* use monokai highlight theme in dark */
+@media (prefers-color-scheme: dark) {
+  /* Background */ .bg { color: #f8f8f2; background-color: #272822; }
+  /* PreWrapper */ .chroma { color: #f8f8f2; background-color: #272822; }
+  /* Other */ .chroma .x {  }
+  /* Error */ .chroma .err { color: #960050; background-color: #1e0010 }
+  /* CodeLine */ .chroma .cl {  }
+  /* LineLink */ .chroma .lnlinks { outline: none; text-decoration: none; color: inherit }
+  /* LineTableTD */ .chroma .lntd { vertical-align: top; padding: 0; margin: 0; border: 0; }
+  /* LineTable */ .chroma .lntable { border-spacing: 0; padding: 0; margin: 0; border: 0; }
+  /* LineHighlight */ .chroma .hl { background-color: #ffffcc }
+  /* LineNumbersTable */ .chroma .lnt { white-space: pre; user-select: none; margin-right: 0.4em; padding: 0 0.4em 0 0.4em;color: #7f7f7f }
+  /* LineNumbers */ .chroma .ln { white-space: pre; user-select: none; margin-right: 0.4em; padding: 0 0.4em 0 0.4em;color: #7f7f7f }
+  /* Line */ .chroma .line { display: flex; }
+  /* Keyword */ .chroma .k { color: #66d9ef }
+  /* KeywordConstant */ .chroma .kc { color: #66d9ef }
+  /* KeywordDeclaration */ .chroma .kd { color: #66d9ef }
+  /* KeywordNamespace */ .chroma .kn { color: #f92672 }
+  /* KeywordPseudo */ .chroma .kp { color: #66d9ef }
+  /* KeywordReserved */ .chroma .kr { color: #66d9ef }
+  /* KeywordType */ .chroma .kt { color: #66d9ef }
+  /* Name */ .chroma .n {  }
+  /* NameAttribute */ .chroma .na { color: #a6e22e }
+  /* NameBuiltin */ .chroma .nb {  }
+  /* NameBuiltinPseudo */ .chroma .bp {  }
+  /* NameClass */ .chroma .nc { color: #a6e22e }
+  /* NameConstant */ .chroma .no { color: #66d9ef }
+  /* NameDecorator */ .chroma .nd { color: #a6e22e }
+  /* NameEntity */ .chroma .ni {  }
+  /* NameException */ .chroma .ne { color: #a6e22e }
+  /* NameFunction */ .chroma .nf { color: #a6e22e }
+  /* NameFunctionMagic */ .chroma .fm {  }
+  /* NameLabel */ .chroma .nl {  }
+  /* NameNamespace */ .chroma .nn {  }
+  /* NameOther */ .chroma .nx { color: #a6e22e }
+  /* NameProperty */ .chroma .py {  }
+  /* NameTag */ .chroma .nt { color: #f92672 }
+  /* NameVariable */ .chroma .nv {  }
+  /* NameVariableClass */ .chroma .vc {  }
+  /* NameVariableGlobal */ .chroma .vg {  }
+  /* NameVariableInstance */ .chroma .vi {  }
+  /* NameVariableMagic */ .chroma .vm {  }
+  /* Literal */ .chroma .l { color: #ae81ff }
+  /* LiteralDate */ .chroma .ld { color: #e6db74 }
+  /* LiteralString */ .chroma .s { color: #e6db74 }
+  /* LiteralStringAffix */ .chroma .sa { color: #e6db74 }
+  /* LiteralStringBacktick */ .chroma .sb { color: #e6db74 }
+  /* LiteralStringChar */ .chroma .sc { color: #e6db74 }
+  /* LiteralStringDelimiter */ .chroma .dl { color: #e6db74 }
+  /* LiteralStringDoc */ .chroma .sd { color: #e6db74 }
+  /* LiteralStringDouble */ .chroma .s2 { color: #e6db74 }
+  /* LiteralStringEscape */ .chroma .se { color: #ae81ff }
+  /* LiteralStringHeredoc */ .chroma .sh { color: #e6db74 }
+  /* LiteralStringInterpol */ .chroma .si { color: #e6db74 }
+  /* LiteralStringOther */ .chroma .sx { color: #e6db74 }
+  /* LiteralStringRegex */ .chroma .sr { color: #e6db74 }
+  /* LiteralStringSingle */ .chroma .s1 { color: #e6db74 }
+  /* LiteralStringSymbol */ .chroma .ss { color: #e6db74 }
+  /* LiteralNumber */ .chroma .m { color: #ae81ff }
+  /* LiteralNumberBin */ .chroma .mb { color: #ae81ff }
+  /* LiteralNumberFloat */ .chroma .mf { color: #ae81ff }
+  /* LiteralNumberHex */ .chroma .mh { color: #ae81ff }
+  /* LiteralNumberInteger */ .chroma .mi { color: #ae81ff }
+  /* LiteralNumberIntegerLong */ .chroma .il { color: #ae81ff }
+  /* LiteralNumberOct */ .chroma .mo { color: #ae81ff }
+  /* Operator */ .chroma .o { color: #f92672 }
+  /* OperatorWord */ .chroma .ow { color: #f92672 }
+  /* Punctuation */ .chroma .p {  }
+  /* Comment */ .chroma .c { color: #75715e }
+  /* CommentHashbang */ .chroma .ch { color: #75715e }
+  /* CommentMultiline */ .chroma .cm { color: #75715e }
+  /* CommentSingle */ .chroma .c1 { color: #75715e }
+  /* CommentSpecial */ .chroma .cs { color: #75715e }
+  /* CommentPreproc */ .chroma .cp { color: #75715e }
+  /* CommentPreprocFile */ .chroma .cpf { color: #75715e }
+  /* Generic */ .chroma .g {  }
+  /* GenericDeleted */ .chroma .gd { color: #f92672 }
+  /* GenericEmph */ .chroma .ge { font-style: italic }
+  /* GenericError */ .chroma .gr {  }
+  /* GenericHeading */ .chroma .gh {  }
+  /* GenericInserted */ .chroma .gi { color: #a6e22e }
+  /* GenericOutput */ .chroma .go {  }
+  /* GenericPrompt */ .chroma .gp {  }
+  /* GenericStrong */ .chroma .gs { font-weight: bold }
+  /* GenericSubheading */ .chroma .gu { color: #75715e }
+  /* GenericTraceback */ .chroma .gt {  }
+  /* GenericUnderline */ .chroma .gl {  }
+  /* TextWhitespace */ .chroma .w {  }
+}

BIN
public/favicon.ico


BIN
public/fonts/FiraMono/FiraMono-Medium.eot


BIN
public/fonts/FiraMono/FiraMono-Medium.otf


BIN
public/fonts/FiraMono/FiraMono-Medium.ttf


BIN
public/fonts/FiraMono/FiraMono-Medium.woff


BIN
public/fonts/FiraMono/FiraMono-Medium.woff2


BIN
public/fonts/OpenSans/OpenSans-Regular.eot


BIN
public/fonts/OpenSans/OpenSans-Regular.ttf


BIN
public/fonts/OpenSans/OpenSans-Regular.woff


BIN
public/images/me_codeskraps.gif


BIN
public/images/sbrowser_logo.webp


BIN
public/images/weekly_weather_logo.webp


+ 133 - 0
public/index.html

@@ -0,0 +1,133 @@
+<!DOCTYPE html>
+<html lang="en-us">
+
+<head>
+    <title>
+        Home | codeskraps
+    </title>
+
+    <meta http-equiv="content-type" content="text/html; charset=utf-8">
+<meta name="viewport" content="width=device-width, initial-scale=1.0">
+<meta name="description" content="Your website description">
+
+<meta name="generator" content="Hugo 0.134.3">
+
+
+<link rel="canonical" href="https://codeskraps.com/" >
+  <link href="https://codeskraps.com/index.xml" rel="alternate" type="application/rss+xml" title="codeskraps" >
+  <link href="https://codeskraps.com/index.xml" rel="feed" type="application/rss+xml" title="codeskraps" >
+
+
+
+
+<link href="/css/style.min.ee0d47e4d4346c71a65a9e873108c81ffae54d60a2fc2338f6df394eb4b25a82.css" rel="stylesheet">
+
+
+
+
+</head>
+
+<body>
+
+    <div class="flexWrapper">
+        <header class="headerWrapper">
+    <div class="header">
+        <div>
+            <a class="terminal" href="https://codeskraps.com/">
+                <span>me@codeskraps.com ~ $</span>
+            </a>
+        </div>
+        <input class="side-menu" type="checkbox" id="side-menu">
+        <label class="hamb" for="side-menu"><span class="hamb-line"></span></label>
+        <nav class="headerLinks">
+            <ul>
+                
+                <li>
+                    <a href="https://codeskraps.com/projects/" title="" >
+                        ~/projects</a>
+                </li>
+                
+                <li>
+                    <a href="https://codeskraps.com/about/" title="" >
+                        ~/about</a>
+                </li>
+                
+                <li>
+                    <a href="https://codeskraps.com/posts/" title="" >
+                        ~/posts</a>
+                </li>
+                
+            </ul>
+        </nav>
+    </divi>
+    
+      <script async src="https://www.googletagmanager.com/gtag/js?id=G-YP8WK3KZF1"></script>
+      <script>
+        var doNotTrack = false;
+        if ( false ) {
+          var dnt = (navigator.doNotTrack || window.doNotTrack || navigator.msDoNotTrack);
+          var doNotTrack = (dnt == "1" || dnt == "yes");
+        }
+        if (!doNotTrack) {
+          window.dataLayer = window.dataLayer || [];
+          function gtag(){dataLayer.push(arguments);}
+          gtag('js', new Date());
+          gtag('config', 'G-YP8WK3KZF1');
+        }
+      </script>
+</header>
+
+
+        <div class="content vertical">
+            <main class="main">
+                <div class="indexWrapper">
+                    <div>
+                        <h1 class="indexHeader">codeskraps</h1>
+                    </div>
+                    
+                        <div class="socialNavbar">
+    <ul>
+        
+        <li>
+            
+                <a href="https://github.com/codeskraps"  target="_blank"  aria-label="GitHub Profile"   >github</a>
+            
+        </li>
+        
+        <li>
+            
+                <a href="https://play.google.com/store/apps/developer?id=Codeskraps"  >google play</a>
+            
+        </li>
+        
+        <li>
+            
+                <a href="https://www.linkedin.com/in/carles-sentis-4a072130"  >linkedin</a>
+            
+        </li>
+        
+        <li>
+            
+                <a href="mailto:me@codeskraps.com"  >email</a>
+            
+        </li>
+        
+    </ul>
+</div>
+
+                    
+                </div>
+            </main>
+        </div>
+
+
+        <footer class="footer">
+    
+        <span>CC 2024, Built with <a href="https://gohugo.io" class="footerLink">Hugo</a> and <a href="https://github.com/LordMathis/hugo-theme-nightfall" class="footerLink">Nightfall</a> theme</span>
+    
+</footer>
+    </div>
+
+</body>
+
+</html>

+ 56 - 0
public/index.xml

@@ -0,0 +1,56 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes"?>
+<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
+  <channel>
+    <title>codeskraps</title>
+    <link>https://codeskraps.com/</link>
+    <description>Recent content on codeskraps</description>
+    <generator>Hugo</generator>
+    <language>en-us</language>
+    <managingEditor>me@codeskraps.com (codeskraps)</managingEditor>
+    <webMaster>me@codeskraps.com (codeskraps)</webMaster>
+    <lastBuildDate>Thu, 03 Oct 2024 17:16:34 +0200</lastBuildDate>
+    <atom:link href="https://codeskraps.com/index.xml" rel="self" type="application/rss+xml" />
+    <item>
+      <title>About Me</title>
+      <link>https://codeskraps.com/about/</link>
+      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><author>me@codeskraps.com (codeskraps)</author>
+      <guid>https://codeskraps.com/about/</guid>
+      <description>&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;  &#xA;  &#xA;  &#xA;      &#xA;      &#xA;  &lt;picture&gt;&#xA;  &lt;img class=&#34;img-fluid&#34; src=&#34;https://codeskraps.com/images/me_codeskraps.gif?v=9df9e0930034eb1e10990a99d3ef1056&#34; alt=&#34;me&#34; loading=&#34;lazy&#34; height=&#34;107&#34; width=&#34;150&#34; /&gt;&#xA;&lt;/picture&gt;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;I&amp;rsquo;m a passionate and highly motivated software engineer with a deep-rooted love for technology that dates back to my first computer, an Amstrad 8256. From those early days of programming as a hobby, I&amp;rsquo;ve turned my passion into a successful career, specializing in mobile development with a focus on Android.&lt;/p&gt;&#xA;&lt;!-- raw HTML omitted --&gt;&#xA;&lt;h2 id=&#34;professional-journey&#34;&gt;Professional Journey&lt;/h2&gt;&#xA;&lt;p&gt;Currently, I&amp;rsquo;m leading the mobile team at Game Golf, where I oversee all aspects of our mobile app development. My experience spans various domains, including:&lt;/p&gt;</description>
+    </item>
+    <item>
+      <title>React Native vs Kotlin Multiplatform</title>
+      <link>https://codeskraps.com/posts/2024/react_vs_kmp/</link>
+      <pubDate>Thu, 03 Oct 2024 17:16:34 +0200</pubDate><author>me@codeskraps.com (codeskraps)</author>
+      <guid>https://codeskraps.com/posts/2024/react_vs_kmp/</guid>
+      <description>&lt;h2 id=&#34;introduction&#34;&gt;Introduction&lt;/h2&gt;&#xA;&lt;p&gt;In the ever-evolving world of mobile app development, choosing the right cross-platform framework can be a game-changer for businesses and developers alike. Two prominent contenders in this space are React Native and Kotlin Multiplatform (KMP). Both offer unique approaches to the challenge of writing code once and deploying it across multiple platforms. This article will dive deep into the strengths and considerations of each, helping you make an informed decision for your next project.&lt;/p&gt;</description>
+    </item>
+    <item>
+      <title>Simplifying MVI Architecture</title>
+      <link>https://codeskraps.com/posts/2024/mvi_architecture/</link>
+      <pubDate>Fri, 27 Sep 2024 13:45:09 +0200</pubDate><author>me@codeskraps.com (codeskraps)</author>
+      <guid>https://codeskraps.com/posts/2024/mvi_architecture/</guid>
+      <description>&lt;p&gt;Model-View-Intent (MVI) is a powerful architectural pattern for building user interfaces, especially in Android development. In this post, we&amp;rsquo;ll explore a helper class that simplifies the implementation of MVI, making it easier to manage state, handle user intents, and emit actions in your application.&lt;/p&gt;</description>
+    </item>
+    <item>
+      <title>When .gitignore Doesnt Seem to Work: A Quick Fix</title>
+      <link>https://codeskraps.com/posts/2024/gitignore_not_working/</link>
+      <pubDate>Sun, 02 Jun 2024 18:14:23 +0200</pubDate><author>me@codeskraps.com (codeskraps)</author>
+      <guid>https://codeskraps.com/posts/2024/gitignore_not_working/</guid>
+      <description>&lt;p&gt;As developers, we&amp;rsquo;ve all been there. You&amp;rsquo;ve added a file or folder to your &lt;code&gt;.gitignore&lt;/code&gt;, but Git keeps tracking it anyway. What gives? Let&amp;rsquo;s dive into why this happens and how to fix it.&lt;/p&gt;</description>
+    </item>
+    <item>
+      <title>Configuring SSH Keys for Individual Git Commands</title>
+      <link>https://codeskraps.com/posts/2024/git_ssh_command/</link>
+      <pubDate>Tue, 02 Apr 2024 16:56:53 +0200</pubDate><author>me@codeskraps.com (codeskraps)</author>
+      <guid>https://codeskraps.com/posts/2024/git_ssh_command/</guid>
+      <description>&lt;p&gt;When working with Git repositories, you often need to authenticate using SSH keys. While you can configure SSH settings globally, there are times when you need to use a specific SSH key for just one command. This is particularly useful when cloning a new repository or adding a submodule, where there isn&amp;rsquo;t yet a local &lt;code&gt;.git/config&lt;/code&gt; file to modify.&lt;/p&gt;</description>
+    </item>
+    <item>
+      <title>Projects</title>
+      <link>https://codeskraps.com/projects/</link>
+      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><author>me@codeskraps.com (codeskraps)</author>
+      <guid>https://codeskraps.com/projects/</guid>
+      <description>&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;  &#xA;  &#xA;  &#xA;      &#xA;      &#xA;  &lt;picture&gt;&#xA;  &lt;img class=&#34;img-fluid&#34; src=&#34;https://codeskraps.com/images/weekly_weather_logo.webp?v=7d09cf4c9c2d09df631c4b261c3b04b0&#34; alt=&#34;weekly_weather_logo&#34; loading=&#34;lazy&#34; height=&#34;192&#34; width=&#34;192&#34; /&gt;&#xA;&lt;/picture&gt;&#xA;&lt;/p&gt;&#xA;&lt;h1 id=&#34;weekly-weatherhttpsgithubcomcodeskrapsweekly-weather&#34;&gt;&lt;a href=&#34;https://github.com/codeskraps/Weekly-Weather&#34;&gt;Weekly Weather&lt;/a&gt;&lt;/h1&gt;&#xA;&lt;p&gt;A quick view of your weekly weather&lt;/p&gt;&#xA;&lt;p&gt;A quick overview of you weekly weather of your current location or search and save your favourite locations for easy access.&lt;/p&gt;&#xA;&lt;p&gt;Save a GPS weather location with a custom name.&lt;/p&gt;&#xA;&lt;p&gt;App translated into 37 languages.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;  &#xA;  &#xA;  &#xA;      &#xA;      &#xA;  &lt;picture&gt;&#xA;  &lt;img class=&#34;img-fluid&#34; src=&#34;https://codeskraps.com/images/sbrowser_logo.webp?v=99f3ce8e863ee001ff5c8a5d2b5b2965&#34; alt=&#34;sbrowser_logo&#34; loading=&#34;lazy&#34; height=&#34;192&#34; width=&#34;192&#34; /&gt;&#xA;&lt;/picture&gt;&#xA;&lt;/p&gt;&#xA;&lt;h1 id=&#34;sbrowserhttpsgithubcomcodeskrapssbrowser&#34;&gt;&lt;a href=&#34;https://github.com/codeskraps/sBrowser&#34;&gt;sBrowser&lt;/a&gt;&lt;/h1&gt;&#xA;&lt;p&gt;This is an app for Android powered devices. sBrowser is a simple Internet broswer specially developed for teaching purposes in a workshop in 091 Labs (091labs.com).&lt;/p&gt;</description>
+    </item>
+  </channel>
+</rss>

+ 36 - 0
public/js/copy-code-block.js

@@ -0,0 +1,36 @@
+/*
+ * Every codeblock has "pre > code" structure, some highlighted codeblocks have
+ * "div.highlight > pre.chroma > code" structure. So, use the simple CSS selector
+ * to query all codeblocks.
+ */
+document.addEventListener("DOMContentLoaded",
+  () => {
+    var codeblocks = document.querySelectorAll(".single .content pre code");
+
+    console.log("codeblocks length:", codeblocks.length);
+
+    codeblocks.forEach(
+      (codeblock) => {
+        let elementPre = codeblock.parentElement;
+
+        let button = document.createElement("div");
+        button.classList.add("copyCodeButton");
+        button.innerHTML = "copy";
+        button.addEventListener("click",
+          () => {
+            navigator.clipboard.writeText(codeblock.textContent);
+
+            button.innerHTML = "copied!";
+            setTimeout(
+              () => { button.innerHTML = "copy"; },
+              1000
+            );
+          }
+        );
+
+        elementPre.appendChild(button);
+      }
+    );
+  }
+);
+

File diff suppressed because it is too large
+ 1 - 0
public/js/mermaid-9.0.0.min.js


+ 96 - 0
public/lib/icofont/demo.html

@@ -0,0 +1,96 @@
+<!DOCTYPE html>
+	<html>
+	<head>
+		<meta charset="utf-8">
+		<title>Examples | IcoFont</title>
+		<link rel="stylesheet" type="text/css" href="./icofont.min.css">
+		<style type="text/css">
+			body {
+				margin: 0;
+				padding: 0;
+				background: #F6F6F9;
+			}
+			.header {
+				border-bottom: 1px solid #DCDCE1;
+				padding: 10px 0;
+				margin-bottom: 10px;
+			}
+			.container {
+				width: 980px;
+				margin: 0 auto;
+			}
+			.ico-title {
+				font-size: 2em;
+			}
+			.iconlist {
+				margin: 0;
+				padding: 0;
+				list-style: none;
+				text-align: center;
+				width: 100%;
+				display: flex;
+				flex-wrap: wrap;
+				flex-direction: row;
+			}
+			.iconlist li {
+				position: relative;
+				margin: 5px;
+				width: 150px;
+				cursor: pointer;
+			}
+			.iconlist li .icon-holder {
+				position: relative;
+				text-align: center;
+				border-radius: 3px;
+				overflow: hidden;
+				padding-bottom: 5px;
+				background: #ffffff;
+				border: 1px solid #E4E5EA;
+				transition: all 0.2s linear 0s;
+			}
+			.iconlist li .icon-holder:hover {
+				background: #00C3DA;
+				color: #ffffff;
+			}
+			.iconlist li .icon-holder:hover .icon i {
+				color: #ffffff;
+			}
+			.iconlist li .icon-holder .icon {
+				padding: 20px;
+				text-align: center;
+			}
+			.iconlist li .icon-holder .icon i {
+				font-size: 3em;
+				color: #1F1142;
+			}
+			.iconlist li .icon-holder span {
+				font-size: 14px;
+				display: block;
+				margin-top: 5px;
+				border-radius: 3px;
+			}
+		</style>
+	</head>
+	<body>
+	<div class="header">
+		<div class="container">
+			<h1 class="ico-title"> IcoFont Icons </h1>
+		</div>
+	</div>
+	<div class="container">
+		<ul class="iconlist">
+		
+		<li>
+			<div class="icon-holder">
+				<div class="icon"> 
+					<i class="icofont-rss"></i>
+				</div> 
+				<span> rss </span>
+			</div>
+		</li>
+		
+		</ul>
+	</div>	
+	</body>
+	</html>
+	

BIN
public/lib/icofont/fonts/icofont.eot


+ 11 - 0
public/lib/icofont/fonts/icofont.svg

@@ -0,0 +1,11 @@
+<?xml version="1.0" standalone="no"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg xmlns="http://www.w3.org/2000/svg">
+<defs>
+<font id="icofont" horiz-adv-x="1000" >
+<font-face font-family="IcoFont" font-weight="400" font-style="Regular" units-per-em="1000" ascent="850" descent="-150" />
+<missing-glyph horiz-adv-x="1000" />
+<glyph glyph-name="rss" horiz-adv-x="1000" unicode="&#xed64;" d="M64 323c109 0 212-43 288-120 77-78 120-181 120-290h168c0 318-258 577-576 577l0-167z m1 297c388 0 703-317 703-707h168c0 482-391 875-871 875l0-168z m232-590c0-65-52-117-117-117-64 0-116 52-116 117s52 116 116 116c65 0 117-52 117-116z" />
+</font>
+</defs>
+</svg>

BIN
public/lib/icofont/fonts/icofont.ttf


BIN
public/lib/icofont/fonts/icofont.woff


BIN
public/lib/icofont/fonts/icofont.woff2


+ 287 - 0
public/lib/icofont/icofont.css

@@ -0,0 +1,287 @@
+/*! 
+* @package IcoFont 
+* @version 1.0.1 
+* @author IcoFont https://icofont.com 
+* @copyright Copyright (c) 2015 - 2022 IcoFont 
+* @license - https://icofont.com/license/
+*/
+
+@font-face
+{
+ 
+  font-family: "IcoFont";
+font-weight: normal;
+font-style: "Regular";
+src: url("./fonts/icofont.woff2") format("woff2"),
+url("./fonts/icofont.woff") format("woff");
+}
+
+[class^="icofont-"], [class*=" icofont-"]
+{
+  font-family: 'IcoFont' !important;
+  speak: none;
+  font-style: normal;
+  font-weight: normal;
+  font-variant: normal;
+  text-transform: none;
+  white-space: nowrap;
+  word-wrap: normal;
+  direction: ltr;
+  line-height: 1;
+/* Better Font Rendering =========== */
+  -webkit-font-feature-settings: "liga";
+  -webkit-font-smoothing: antialiased;
+}
+
+.icofont-rss:before
+{
+  content: "\ed64";
+}
+
+.icofont-xs
+{
+  font-size: .5em;
+}
+
+.icofont-sm
+{
+  font-size: .75em;
+}
+
+.icofont-md
+{
+  font-size: 1.25em;
+}
+
+.icofont-lg
+{
+  font-size: 1.5em;
+}
+
+.icofont-1x
+{
+  font-size: 1em;
+}
+
+.icofont-2x
+{
+  font-size: 2em;
+}
+
+.icofont-3x
+{
+  font-size: 3em;
+}
+
+.icofont-4x
+{
+  font-size: 4em;
+}
+
+.icofont-5x
+{
+  font-size: 5em;
+}
+
+.icofont-6x
+{
+  font-size: 6em;
+}
+
+.icofont-7x
+{
+  font-size: 7em;
+}
+
+.icofont-8x
+{
+  font-size: 8em;
+}
+
+.icofont-9x
+{
+  font-size: 9em;
+}
+
+.icofont-10x
+{
+  font-size: 10em;
+}
+
+.icofont-fw
+{
+  text-align: center;
+  width: 1.25em;
+}
+
+.icofont-ul
+{
+  list-style-type: none;
+  padding-left: 0;
+  margin-left: 0;
+}
+
+.icofont-ul > li
+{
+  position: relative;
+  line-height: 2em;
+}
+
+.icofont-ul > li .icofont
+{
+  display: inline-block;
+  vertical-align: middle;
+}
+
+.icofont-border
+{
+  border: solid 0.08em #f1f1f1;
+  border-radius: .1em;
+  padding: .2em .25em .15em;
+}
+
+.icofont-pull-left
+{
+  float: left;
+}
+
+.icofont-pull-right
+{
+  float: right;
+}
+
+.icofont.icofont-pull-left
+{
+  margin-right: .3em;
+}
+
+.icofont.icofont-pull-right
+{
+  margin-left: .3em;
+}
+
+.icofont-spin
+{
+  -webkit-animation: icofont-spin 2s infinite linear;
+  animation: icofont-spin 2s infinite linear;
+  display: inline-block;
+}
+
+.icofont-pulse
+{
+  -webkit-animation: icofont-spin 1s infinite steps(8);
+  animation: icofont-spin 1s infinite steps(8);
+  display: inline-block;
+}
+
+@-webkit-keyframes icofont-spin
+{
+  0%
+  {
+    -webkit-transform: rotate(0deg);
+    transform: rotate(0deg);
+  }
+
+  100%
+  {
+    -webkit-transform: rotate(360deg);
+    transform: rotate(360deg);
+  }
+}
+
+@keyframes icofont-spin
+{
+  0%
+  {
+    -webkit-transform: rotate(0deg);
+    transform: rotate(0deg);
+  }
+
+  100%
+  {
+    -webkit-transform: rotate(360deg);
+    transform: rotate(360deg);
+  }
+}
+
+.icofont-rotate-90
+{
+  -ms-filter: "progid:DXImageTransform.Microsoft.BasicImage(rotation=1)";
+  -webkit-transform: rotate(90deg);
+  transform: rotate(90deg);
+}
+
+.icofont-rotate-180
+{
+  -ms-filter: "progid:DXImageTransform.Microsoft.BasicImage(rotation=2)";
+  -webkit-transform: rotate(180deg);
+  transform: rotate(180deg);
+}
+
+.icofont-rotate-270
+{
+  -ms-filter: "progid:DXImageTransform.Microsoft.BasicImage(rotation=3)";
+  -webkit-transform: rotate(270deg);
+  transform: rotate(270deg);
+}
+
+.icofont-flip-horizontal
+{
+  -ms-filter: "progid:DXImageTransform.Microsoft.BasicImage(rotation=0, mirror=1)";
+  -webkit-transform: scale(-1, 1);
+  transform: scale(-1, 1);
+}
+
+.icofont-flip-vertical
+{
+  -ms-filter: "progid:DXImageTransform.Microsoft.BasicImage(rotation=2, mirror=1)";
+  -webkit-transform: scale(1, -1);
+  transform: scale(1, -1);
+}
+
+.icofont-flip-horizontal.icofont-flip-vertical
+{
+  -ms-filter: "progid:DXImageTransform.Microsoft.BasicImage(rotation=2, mirror=1)";
+  -webkit-transform: scale(-1, -1);
+  transform: scale(-1, -1);
+}
+
+:root .icofont-rotate-90,
+	:root .icofont-rotate-180,
+	:root .icofont-rotate-270,
+	:root .icofont-flip-horizontal,
+	:root .icofont-flip-vertical
+{
+  -webkit-filter: none;
+  filter: none;
+  display: inline-block;
+}
+
+.icofont-inverse
+{
+  color: #fff;
+}
+
+.sr-only
+{
+  border: 0;
+  clip: rect(0, 0, 0, 0);
+  height: 1px;
+  margin: -1px;
+  overflow: hidden;
+  padding: 0;
+  position: absolute;
+  width: 1px;
+}
+
+.sr-only-focusable:active,
+	.sr-only-focusable:focus
+{
+  clip: auto;
+  height: auto;
+  margin: 0;
+  overflow: visible;
+  position: static;
+  width: auto;
+}
+	

File diff suppressed because it is too large
+ 6 - 0
public/lib/icofont/icofont.min.css


+ 119 - 0
public/lib/katex/README.md

@@ -0,0 +1,119 @@
+# [<img src="https://katex.org/img/katex-logo-black.svg" width="130" alt="KaTeX">](https://katex.org/)
+[![npm](https://img.shields.io/npm/v/katex.svg)](https://www.npmjs.com/package/katex)
+[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release)
+[![CI](https://github.com/KaTeX/KaTeX/workflows/CI/badge.svg?branch=main&event=push)](https://github.com/KaTeX/KaTeX/actions?query=workflow%3ACI)
+[![codecov](https://codecov.io/gh/KaTeX/KaTeX/branch/main/graph/badge.svg)](https://codecov.io/gh/KaTeX/KaTeX)
+[![Discussions](https://img.shields.io/badge/Discussions-join-brightgreen)](https://github.com/KaTeX/KaTeX/discussions)
+[![jsDelivr](https://data.jsdelivr.com/v1/package/npm/katex/badge?style=rounded)](https://www.jsdelivr.com/package/npm/katex)
+![katex.min.js size](https://img.badgesize.io/https://unpkg.com/katex/dist/katex.min.js?compression=gzip)
+[![Gitpod ready-to-code](https://img.shields.io/badge/Gitpod-ready--to--code-blue?logo=gitpod)](https://gitpod.io/#https://github.com/KaTeX/KaTeX)
+[![Financial Contributors on Open Collective](https://opencollective.com/katex/all/badge.svg?label=financial+contributors)](https://opencollective.com/katex)
+
+KaTeX is a fast, easy-to-use JavaScript library for TeX math rendering on the web.
+
+ * **Fast:** KaTeX renders its math synchronously and doesn't need to reflow the page. See how it compares to a competitor in [this speed test](https://www.intmath.com/cg5/katex-mathjax-comparison.php).
+ * **Print quality:** KaTeX's layout is based on Donald Knuth's TeX, the gold standard for math typesetting.
+ * **Self contained:** KaTeX has no dependencies and can easily be bundled with your website resources.
+ * **Server side rendering:** KaTeX produces the same output regardless of browser or environment, so you can pre-render expressions using Node.js and send them as plain HTML.
+
+KaTeX is compatible with all major browsers, including Chrome, Safari, Firefox, Opera, Edge, and IE 11.
+
+KaTeX supports much (but not all) of LaTeX and many LaTeX packages. See the [list of supported functions](https://katex.org/docs/supported.html).
+
+Try out KaTeX [on the demo page](https://katex.org/#demo)!
+
+## Getting started
+
+### Starter template
+
+```html
+<!DOCTYPE html>
+<!-- KaTeX requires the use of the HTML5 doctype. Without it, KaTeX may not render properly -->
+<html>
+  <head>
+    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.16.2/dist/katex.min.css" integrity="sha384-bYdxxUwYipFNohQlHt0bjN/LCpueqWz13HufFEV1SUatKs1cm4L6fFgCi1jT643X" crossorigin="anonymous">
+
+    <!-- The loading of KaTeX is deferred to speed up page rendering -->
+    <script defer src="https://cdn.jsdelivr.net/npm/katex@0.16.2/dist/katex.min.js" integrity="sha384-Qsn9KnoKISj6dI8g7p1HBlNpVx0I8p1SvlwOldgi3IorMle61nQy4zEahWYtljaz" crossorigin="anonymous"></script>
+
+    <!-- To automatically render math in text elements, include the auto-render extension: -->
+    <script defer src="https://cdn.jsdelivr.net/npm/katex@0.16.2/dist/contrib/auto-render.min.js" integrity="sha384-+VBxd3r6XgURycqtZ117nYw44OOcIax56Z4dCRWbxyPt0Koah1uHoK0o4+/RRE05" crossorigin="anonymous"
+        onload="renderMathInElement(document.body);"></script>
+  </head>
+  ...
+</html>
+```
+
+You can also [download KaTeX](https://github.com/KaTeX/KaTeX/releases) and host it yourself.
+
+For details on how to configure auto-render extension, refer to [the documentation](https://katex.org/docs/autorender.html).
+
+### API
+
+Call `katex.render` to render a TeX expression directly into a DOM element.
+For example:
+
+```js
+katex.render("c = \\pm\\sqrt{a^2 + b^2}", element, {
+    throwOnError: false
+});
+```
+
+Call `katex.renderToString` to generate an HTML string of the rendered math,
+e.g., for server-side rendering.  For example:
+
+```js
+var html = katex.renderToString("c = \\pm\\sqrt{a^2 + b^2}", {
+    throwOnError: false
+});
+// '<span class="katex">...</span>'
+```
+
+Make sure to include the CSS and font files in both cases.
+If you are doing all rendering on the server, there is no need to include the
+JavaScript on the client.
+
+The examples above use the `throwOnError: false` option, which renders invalid
+inputs as the TeX source code in red (by default), with the error message as
+hover text.  For other available options, see the
+[API documentation](https://katex.org/docs/api.html),
+[options documentation](https://katex.org/docs/options.html), and
+[handling errors documentation](https://katex.org/docs/error.html).
+
+## Demo and Documentation
+
+Learn more about using KaTeX [on the website](https://katex.org)!
+
+## Contributors
+
+### Code Contributors
+
+This project exists thanks to all the people who contribute code. If you'd like to help, see [our guide to contributing code](CONTRIBUTING.md).
+<a href="https://github.com/KaTeX/KaTeX/graphs/contributors"><img src="https://contributors-svg.opencollective.com/katex/contributors.svg?width=890&button=false" alt="Code contributors" /></a>
+
+### Financial Contributors
+
+Become a financial contributor and help us sustain our community.
+
+#### Individuals
+
+<a href="https://opencollective.com/katex"><img src="https://opencollective.com/katex/individuals.svg?width=890" alt="Contribute on Open Collective"></a>
+
+#### Organizations
+
+Support this project with your organization. Your logo will show up here with a link to your website.
+
+<a href="https://opencollective.com/katex/organization/0/website"><img src="https://opencollective.com/katex/organization/0/avatar.svg" alt="Organization 1"></a>
+<a href="https://opencollective.com/katex/organization/1/website"><img src="https://opencollective.com/katex/organization/1/avatar.svg" alt="Organization 2"></a>
+<a href="https://opencollective.com/katex/organization/2/website"><img src="https://opencollective.com/katex/organization/2/avatar.svg" alt="Organization 3"></a>
+<a href="https://opencollective.com/katex/organization/3/website"><img src="https://opencollective.com/katex/organization/3/avatar.svg" alt="Organization 4"></a>
+<a href="https://opencollective.com/katex/organization/4/website"><img src="https://opencollective.com/katex/organization/4/avatar.svg" alt="Organization 5"></a>
+<a href="https://opencollective.com/katex/organization/5/website"><img src="https://opencollective.com/katex/organization/5/avatar.svg" alt="Organization 6"></a>
+<a href="https://opencollective.com/katex/organization/6/website"><img src="https://opencollective.com/katex/organization/6/avatar.svg" alt="Organization 7"></a>
+<a href="https://opencollective.com/katex/organization/7/website"><img src="https://opencollective.com/katex/organization/7/avatar.svg" alt="Organization 8"></a>
+<a href="https://opencollective.com/katex/organization/8/website"><img src="https://opencollective.com/katex/organization/8/avatar.svg" alt="Organization 9"></a>
+<a href="https://opencollective.com/katex/organization/9/website"><img src="https://opencollective.com/katex/organization/9/avatar.svg" alt="Organization 10"></a>
+
+## License
+
+KaTeX is licensed under the [MIT License](https://opensource.org/licenses/MIT).

+ 349 - 0
public/lib/katex/contrib/auto-render.js

@@ -0,0 +1,349 @@
+(function webpackUniversalModuleDefinition(root, factory) {
+	if(typeof exports === 'object' && typeof module === 'object')
+		module.exports = factory(require("katex"));
+	else if(typeof define === 'function' && define.amd)
+		define(["katex"], factory);
+	else if(typeof exports === 'object')
+		exports["renderMathInElement"] = factory(require("katex"));
+	else
+		root["renderMathInElement"] = factory(root["katex"]);
+})((typeof self !== 'undefined' ? self : this), function(__WEBPACK_EXTERNAL_MODULE__771__) {
+return /******/ (function() { // webpackBootstrap
+/******/ 	"use strict";
+/******/ 	var __webpack_modules__ = ({
+
+/***/ 771:
+/***/ (function(module) {
+
+module.exports = __WEBPACK_EXTERNAL_MODULE__771__;
+
+/***/ })
+
+/******/ 	});
+/************************************************************************/
+/******/ 	// The module cache
+/******/ 	var __webpack_module_cache__ = {};
+/******/ 	
+/******/ 	// The require function
+/******/ 	function __webpack_require__(moduleId) {
+/******/ 		// Check if module is in cache
+/******/ 		var cachedModule = __webpack_module_cache__[moduleId];
+/******/ 		if (cachedModule !== undefined) {
+/******/ 			return cachedModule.exports;
+/******/ 		}
+/******/ 		// Create a new module (and put it into the cache)
+/******/ 		var module = __webpack_module_cache__[moduleId] = {
+/******/ 			// no module.id needed
+/******/ 			// no module.loaded needed
+/******/ 			exports: {}
+/******/ 		};
+/******/ 	
+/******/ 		// Execute the module function
+/******/ 		__webpack_modules__[moduleId](module, module.exports, __webpack_require__);
+/******/ 	
+/******/ 		// Return the exports of the module
+/******/ 		return module.exports;
+/******/ 	}
+/******/ 	
+/************************************************************************/
+/******/ 	/* webpack/runtime/compat get default export */
+/******/ 	!function() {
+/******/ 		// getDefaultExport function for compatibility with non-harmony modules
+/******/ 		__webpack_require__.n = function(module) {
+/******/ 			var getter = module && module.__esModule ?
+/******/ 				function() { return module['default']; } :
+/******/ 				function() { return module; };
+/******/ 			__webpack_require__.d(getter, { a: getter });
+/******/ 			return getter;
+/******/ 		};
+/******/ 	}();
+/******/ 	
+/******/ 	/* webpack/runtime/define property getters */
+/******/ 	!function() {
+/******/ 		// define getter functions for harmony exports
+/******/ 		__webpack_require__.d = function(exports, definition) {
+/******/ 			for(var key in definition) {
+/******/ 				if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
+/******/ 					Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
+/******/ 				}
+/******/ 			}
+/******/ 		};
+/******/ 	}();
+/******/ 	
+/******/ 	/* webpack/runtime/hasOwnProperty shorthand */
+/******/ 	!function() {
+/******/ 		__webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }
+/******/ 	}();
+/******/ 	
+/************************************************************************/
+var __webpack_exports__ = {};
+// This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk.
+!function() {
+
+// EXPORTS
+__webpack_require__.d(__webpack_exports__, {
+  "default": function() { return /* binding */ auto_render; }
+});
+
+// EXTERNAL MODULE: external "katex"
+var external_katex_ = __webpack_require__(771);
+var external_katex_default = /*#__PURE__*/__webpack_require__.n(external_katex_);
+;// CONCATENATED MODULE: ./contrib/auto-render/splitAtDelimiters.js
+/* eslint no-constant-condition:0 */
+var findEndOfMath = function findEndOfMath(delimiter, text, startIndex) {
+  // Adapted from
+  // https://github.com/Khan/perseus/blob/master/src/perseus-markdown.jsx
+  var index = startIndex;
+  var braceLevel = 0;
+  var delimLength = delimiter.length;
+
+  while (index < text.length) {
+    var character = text[index];
+
+    if (braceLevel <= 0 && text.slice(index, index + delimLength) === delimiter) {
+      return index;
+    } else if (character === "\\") {
+      index++;
+    } else if (character === "{") {
+      braceLevel++;
+    } else if (character === "}") {
+      braceLevel--;
+    }
+
+    index++;
+  }
+
+  return -1;
+};
+
+var escapeRegex = function escapeRegex(string) {
+  return string.replace(/[-/\\^$*+?.()|[\]{}]/g, "\\$&");
+};
+
+var amsRegex = /^\\begin{/;
+
+var splitAtDelimiters = function splitAtDelimiters(text, delimiters) {
+  var index;
+  var data = [];
+  var regexLeft = new RegExp("(" + delimiters.map(function (x) {
+    return escapeRegex(x.left);
+  }).join("|") + ")");
+
+  while (true) {
+    index = text.search(regexLeft);
+
+    if (index === -1) {
+      break;
+    }
+
+    if (index > 0) {
+      data.push({
+        type: "text",
+        data: text.slice(0, index)
+      });
+      text = text.slice(index); // now text starts with delimiter
+    } // ... so this always succeeds:
+
+
+    var i = delimiters.findIndex(function (delim) {
+      return text.startsWith(delim.left);
+    });
+    index = findEndOfMath(delimiters[i].right, text, delimiters[i].left.length);
+
+    if (index === -1) {
+      break;
+    }
+
+    var rawData = text.slice(0, index + delimiters[i].right.length);
+    var math = amsRegex.test(rawData) ? rawData : text.slice(delimiters[i].left.length, index);
+    data.push({
+      type: "math",
+      data: math,
+      rawData: rawData,
+      display: delimiters[i].display
+    });
+    text = text.slice(index + delimiters[i].right.length);
+  }
+
+  if (text !== "") {
+    data.push({
+      type: "text",
+      data: text
+    });
+  }
+
+  return data;
+};
+
+/* harmony default export */ var auto_render_splitAtDelimiters = (splitAtDelimiters);
+;// CONCATENATED MODULE: ./contrib/auto-render/auto-render.js
+/* eslint no-console:0 */
+
+
+/* Note: optionsCopy is mutated by this method. If it is ever exposed in the
+ * API, we should copy it before mutating.
+ */
+
+var renderMathInText = function renderMathInText(text, optionsCopy) {
+  var data = auto_render_splitAtDelimiters(text, optionsCopy.delimiters);
+
+  if (data.length === 1 && data[0].type === 'text') {
+    // There is no formula in the text.
+    // Let's return null which means there is no need to replace
+    // the current text node with a new one.
+    return null;
+  }
+
+  var fragment = document.createDocumentFragment();
+
+  for (var i = 0; i < data.length; i++) {
+    if (data[i].type === "text") {
+      fragment.appendChild(document.createTextNode(data[i].data));
+    } else {
+      var span = document.createElement("span");
+      var math = data[i].data; // Override any display mode defined in the settings with that
+      // defined by the text itself
+
+      optionsCopy.displayMode = data[i].display;
+
+      try {
+        if (optionsCopy.preProcess) {
+          math = optionsCopy.preProcess(math);
+        }
+
+        external_katex_default().render(math, span, optionsCopy);
+      } catch (e) {
+        if (!(e instanceof (external_katex_default()).ParseError)) {
+          throw e;
+        }
+
+        optionsCopy.errorCallback("KaTeX auto-render: Failed to parse `" + data[i].data + "` with ", e);
+        fragment.appendChild(document.createTextNode(data[i].rawData));
+        continue;
+      }
+
+      fragment.appendChild(span);
+    }
+  }
+
+  return fragment;
+};
+
+var renderElem = function renderElem(elem, optionsCopy) {
+  for (var i = 0; i < elem.childNodes.length; i++) {
+    var childNode = elem.childNodes[i];
+
+    if (childNode.nodeType === 3) {
+      // Text node
+      // Concatenate all sibling text nodes.
+      // Webkit browsers split very large text nodes into smaller ones,
+      // so the delimiters may be split across different nodes.
+      var textContentConcat = childNode.textContent;
+      var sibling = childNode.nextSibling;
+      var nSiblings = 0;
+
+      while (sibling && sibling.nodeType === Node.TEXT_NODE) {
+        textContentConcat += sibling.textContent;
+        sibling = sibling.nextSibling;
+        nSiblings++;
+      }
+
+      var frag = renderMathInText(textContentConcat, optionsCopy);
+
+      if (frag) {
+        // Remove extra text nodes
+        for (var j = 0; j < nSiblings; j++) {
+          childNode.nextSibling.remove();
+        }
+
+        i += frag.childNodes.length - 1;
+        elem.replaceChild(frag, childNode);
+      } else {
+        // If the concatenated text does not contain math
+        // the siblings will not either
+        i += nSiblings;
+      }
+    } else if (childNode.nodeType === 1) {
+      (function () {
+        // Element node
+        var className = ' ' + childNode.className + ' ';
+        var shouldRender = optionsCopy.ignoredTags.indexOf(childNode.nodeName.toLowerCase()) === -1 && optionsCopy.ignoredClasses.every(function (x) {
+          return className.indexOf(' ' + x + ' ') === -1;
+        });
+
+        if (shouldRender) {
+          renderElem(childNode, optionsCopy);
+        }
+      })();
+    } // Otherwise, it's something else, and ignore it.
+
+  }
+};
+
+var renderMathInElement = function renderMathInElement(elem, options) {
+  if (!elem) {
+    throw new Error("No element provided to render");
+  }
+
+  var optionsCopy = {}; // Object.assign(optionsCopy, option)
+
+  for (var option in options) {
+    if (options.hasOwnProperty(option)) {
+      optionsCopy[option] = options[option];
+    }
+  } // default options
+
+
+  optionsCopy.delimiters = optionsCopy.delimiters || [{
+    left: "$$",
+    right: "$$",
+    display: true
+  }, {
+    left: "\\(",
+    right: "\\)",
+    display: false
+  }, // LaTeX uses $…$, but it ruins the display of normal `$` in text:
+  // {left: "$", right: "$", display: false},
+  // $ must come after $$
+  // Render AMS environments even if outside $$…$$ delimiters.
+  {
+    left: "\\begin{equation}",
+    right: "\\end{equation}",
+    display: true
+  }, {
+    left: "\\begin{align}",
+    right: "\\end{align}",
+    display: true
+  }, {
+    left: "\\begin{alignat}",
+    right: "\\end{alignat}",
+    display: true
+  }, {
+    left: "\\begin{gather}",
+    right: "\\end{gather}",
+    display: true
+  }, {
+    left: "\\begin{CD}",
+    right: "\\end{CD}",
+    display: true
+  }, {
+    left: "\\[",
+    right: "\\]",
+    display: true
+  }];
+  optionsCopy.ignoredTags = optionsCopy.ignoredTags || ["script", "noscript", "style", "textarea", "pre", "code", "option"];
+  optionsCopy.ignoredClasses = optionsCopy.ignoredClasses || [];
+  optionsCopy.errorCallback = optionsCopy.errorCallback || console.error; // Enable sharing of global macros defined via `\gdef` between different
+  // math elements within a single call to `renderMathInElement`.
+
+  optionsCopy.macros = optionsCopy.macros || {};
+  renderElem(elem, optionsCopy);
+};
+
+/* harmony default export */ var auto_render = (renderMathInElement);
+}();
+__webpack_exports__ = __webpack_exports__["default"];
+/******/ 	return __webpack_exports__;
+/******/ })()
+;
+});

File diff suppressed because it is too large
+ 0 - 0
public/lib/katex/contrib/auto-render.min.js


+ 244 - 0
public/lib/katex/contrib/auto-render.mjs

@@ -0,0 +1,244 @@
+import katex from '../katex.mjs';
+
+/* eslint no-constant-condition:0 */
+var findEndOfMath = function findEndOfMath(delimiter, text, startIndex) {
+  // Adapted from
+  // https://github.com/Khan/perseus/blob/master/src/perseus-markdown.jsx
+  var index = startIndex;
+  var braceLevel = 0;
+  var delimLength = delimiter.length;
+
+  while (index < text.length) {
+    var character = text[index];
+
+    if (braceLevel <= 0 && text.slice(index, index + delimLength) === delimiter) {
+      return index;
+    } else if (character === "\\") {
+      index++;
+    } else if (character === "{") {
+      braceLevel++;
+    } else if (character === "}") {
+      braceLevel--;
+    }
+
+    index++;
+  }
+
+  return -1;
+};
+
+var escapeRegex = function escapeRegex(string) {
+  return string.replace(/[-/\\^$*+?.()|[\]{}]/g, "\\$&");
+};
+
+var amsRegex = /^\\begin{/;
+
+var splitAtDelimiters = function splitAtDelimiters(text, delimiters) {
+  var index;
+  var data = [];
+  var regexLeft = new RegExp("(" + delimiters.map(x => escapeRegex(x.left)).join("|") + ")");
+
+  while (true) {
+    index = text.search(regexLeft);
+
+    if (index === -1) {
+      break;
+    }
+
+    if (index > 0) {
+      data.push({
+        type: "text",
+        data: text.slice(0, index)
+      });
+      text = text.slice(index); // now text starts with delimiter
+    } // ... so this always succeeds:
+
+
+    var i = delimiters.findIndex(delim => text.startsWith(delim.left));
+    index = findEndOfMath(delimiters[i].right, text, delimiters[i].left.length);
+
+    if (index === -1) {
+      break;
+    }
+
+    var rawData = text.slice(0, index + delimiters[i].right.length);
+    var math = amsRegex.test(rawData) ? rawData : text.slice(delimiters[i].left.length, index);
+    data.push({
+      type: "math",
+      data: math,
+      rawData,
+      display: delimiters[i].display
+    });
+    text = text.slice(index + delimiters[i].right.length);
+  }
+
+  if (text !== "") {
+    data.push({
+      type: "text",
+      data: text
+    });
+  }
+
+  return data;
+};
+
+/* eslint no-console:0 */
+/* Note: optionsCopy is mutated by this method. If it is ever exposed in the
+ * API, we should copy it before mutating.
+ */
+
+var renderMathInText = function renderMathInText(text, optionsCopy) {
+  var data = splitAtDelimiters(text, optionsCopy.delimiters);
+
+  if (data.length === 1 && data[0].type === 'text') {
+    // There is no formula in the text.
+    // Let's return null which means there is no need to replace
+    // the current text node with a new one.
+    return null;
+  }
+
+  var fragment = document.createDocumentFragment();
+
+  for (var i = 0; i < data.length; i++) {
+    if (data[i].type === "text") {
+      fragment.appendChild(document.createTextNode(data[i].data));
+    } else {
+      var span = document.createElement("span");
+      var math = data[i].data; // Override any display mode defined in the settings with that
+      // defined by the text itself
+
+      optionsCopy.displayMode = data[i].display;
+
+      try {
+        if (optionsCopy.preProcess) {
+          math = optionsCopy.preProcess(math);
+        }
+
+        katex.render(math, span, optionsCopy);
+      } catch (e) {
+        if (!(e instanceof katex.ParseError)) {
+          throw e;
+        }
+
+        optionsCopy.errorCallback("KaTeX auto-render: Failed to parse `" + data[i].data + "` with ", e);
+        fragment.appendChild(document.createTextNode(data[i].rawData));
+        continue;
+      }
+
+      fragment.appendChild(span);
+    }
+  }
+
+  return fragment;
+};
+
+var renderElem = function renderElem(elem, optionsCopy) {
+  for (var i = 0; i < elem.childNodes.length; i++) {
+    var childNode = elem.childNodes[i];
+
+    if (childNode.nodeType === 3) {
+      // Text node
+      // Concatenate all sibling text nodes.
+      // Webkit browsers split very large text nodes into smaller ones,
+      // so the delimiters may be split across different nodes.
+      var textContentConcat = childNode.textContent;
+      var sibling = childNode.nextSibling;
+      var nSiblings = 0;
+
+      while (sibling && sibling.nodeType === Node.TEXT_NODE) {
+        textContentConcat += sibling.textContent;
+        sibling = sibling.nextSibling;
+        nSiblings++;
+      }
+
+      var frag = renderMathInText(textContentConcat, optionsCopy);
+
+      if (frag) {
+        // Remove extra text nodes
+        for (var j = 0; j < nSiblings; j++) {
+          childNode.nextSibling.remove();
+        }
+
+        i += frag.childNodes.length - 1;
+        elem.replaceChild(frag, childNode);
+      } else {
+        // If the concatenated text does not contain math
+        // the siblings will not either
+        i += nSiblings;
+      }
+    } else if (childNode.nodeType === 1) {
+      (function () {
+        // Element node
+        var className = ' ' + childNode.className + ' ';
+        var shouldRender = optionsCopy.ignoredTags.indexOf(childNode.nodeName.toLowerCase()) === -1 && optionsCopy.ignoredClasses.every(x => className.indexOf(' ' + x + ' ') === -1);
+
+        if (shouldRender) {
+          renderElem(childNode, optionsCopy);
+        }
+      })();
+    } // Otherwise, it's something else, and ignore it.
+
+  }
+};
+
+var renderMathInElement = function renderMathInElement(elem, options) {
+  if (!elem) {
+    throw new Error("No element provided to render");
+  }
+
+  var optionsCopy = {}; // Object.assign(optionsCopy, option)
+
+  for (var option in options) {
+    if (options.hasOwnProperty(option)) {
+      optionsCopy[option] = options[option];
+    }
+  } // default options
+
+
+  optionsCopy.delimiters = optionsCopy.delimiters || [{
+    left: "$$",
+    right: "$$",
+    display: true
+  }, {
+    left: "\\(",
+    right: "\\)",
+    display: false
+  }, // LaTeX uses $…$, but it ruins the display of normal `$` in text:
+  // {left: "$", right: "$", display: false},
+  // $ must come after $$
+  // Render AMS environments even if outside $$…$$ delimiters.
+  {
+    left: "\\begin{equation}",
+    right: "\\end{equation}",
+    display: true
+  }, {
+    left: "\\begin{align}",
+    right: "\\end{align}",
+    display: true
+  }, {
+    left: "\\begin{alignat}",
+    right: "\\end{alignat}",
+    display: true
+  }, {
+    left: "\\begin{gather}",
+    right: "\\end{gather}",
+    display: true
+  }, {
+    left: "\\begin{CD}",
+    right: "\\end{CD}",
+    display: true
+  }, {
+    left: "\\[",
+    right: "\\]",
+    display: true
+  }];
+  optionsCopy.ignoredTags = optionsCopy.ignoredTags || ["script", "noscript", "style", "textarea", "pre", "code", "option"];
+  optionsCopy.ignoredClasses = optionsCopy.ignoredClasses || [];
+  optionsCopy.errorCallback = optionsCopy.errorCallback || console.error; // Enable sharing of global macros defined via `\gdef` between different
+  // math elements within a single call to `renderMathInElement`.
+
+  optionsCopy.macros = optionsCopy.macros || {};
+  renderElem(elem, optionsCopy);
+};
+
+export { renderMathInElement as default };

+ 130 - 0
public/lib/katex/contrib/copy-tex.js

@@ -0,0 +1,130 @@
+(function webpackUniversalModuleDefinition(root, factory) {
+	if(typeof exports === 'object' && typeof module === 'object')
+		module.exports = factory();
+	else if(typeof define === 'function' && define.amd)
+		define([], factory);
+	else {
+		var a = factory();
+		for(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];
+	}
+})((typeof self !== 'undefined' ? self : this), function() {
+return /******/ (function() { // webpackBootstrap
+/******/ 	"use strict";
+var __webpack_exports__ = {};
+
+;// CONCATENATED MODULE: ./contrib/copy-tex/katex2tex.js
+// Set these to how you want inline and display math to be delimited.
+var defaultCopyDelimiters = {
+  inline: ['$', '$'],
+  // alternative: ['\(', '\)']
+  display: ['$$', '$$'] // alternative: ['\[', '\]']
+
+}; // Replace .katex elements with their TeX source (<annotation> element).
+// Modifies fragment in-place.  Useful for writing your own 'copy' handler,
+// as in copy-tex.js.
+
+function katexReplaceWithTex(fragment, copyDelimiters) {
+  if (copyDelimiters === void 0) {
+    copyDelimiters = defaultCopyDelimiters;
+  }
+
+  // Remove .katex-html blocks that are preceded by .katex-mathml blocks
+  // (which will get replaced below).
+  var katexHtml = fragment.querySelectorAll('.katex-mathml + .katex-html');
+
+  for (var i = 0; i < katexHtml.length; i++) {
+    var element = katexHtml[i];
+
+    if (element.remove) {
+      element.remove();
+    } else if (element.parentNode) {
+      element.parentNode.removeChild(element);
+    }
+  } // Replace .katex-mathml elements with their annotation (TeX source)
+  // descendant, with inline delimiters.
+
+
+  var katexMathml = fragment.querySelectorAll('.katex-mathml');
+
+  for (var _i = 0; _i < katexMathml.length; _i++) {
+    var _element = katexMathml[_i];
+
+    var texSource = _element.querySelector('annotation');
+
+    if (texSource) {
+      if (_element.replaceWith) {
+        _element.replaceWith(texSource);
+      } else if (_element.parentNode) {
+        _element.parentNode.replaceChild(texSource, _element);
+      }
+
+      texSource.innerHTML = copyDelimiters.inline[0] + texSource.innerHTML + copyDelimiters.inline[1];
+    }
+  } // Switch display math to display delimiters.
+
+
+  var displays = fragment.querySelectorAll('.katex-display annotation');
+
+  for (var _i2 = 0; _i2 < displays.length; _i2++) {
+    var _element2 = displays[_i2];
+    _element2.innerHTML = copyDelimiters.display[0] + _element2.innerHTML.substr(copyDelimiters.inline[0].length, _element2.innerHTML.length - copyDelimiters.inline[0].length - copyDelimiters.inline[1].length) + copyDelimiters.display[1];
+  }
+
+  return fragment;
+}
+/* harmony default export */ var katex2tex = (katexReplaceWithTex);
+;// CONCATENATED MODULE: ./contrib/copy-tex/copy-tex.js
+ // Return <div class="katex"> element containing node, or null if not found.
+
+function closestKatex(node) {
+  // If node is a Text Node, for example, go up to containing Element,
+  // where we can apply the `closest` method.
+  var element = node instanceof Element ? node : node.parentElement;
+  return element && element.closest('.katex');
+} // Global copy handler to modify behavior on/within .katex elements.
+
+
+document.addEventListener('copy', function (event) {
+  var selection = window.getSelection();
+
+  if (selection.isCollapsed || !event.clipboardData) {
+    return; // default action OK if selection is empty or unchangeable
+  }
+
+  var clipboardData = event.clipboardData;
+  var range = selection.getRangeAt(0); // When start point is within a formula, expand to entire formula.
+
+  var startKatex = closestKatex(range.startContainer);
+
+  if (startKatex) {
+    range.setStartBefore(startKatex);
+  } // Similarly, when end point is within a formula, expand to entire formula.
+
+
+  var endKatex = closestKatex(range.endContainer);
+
+  if (endKatex) {
+    range.setEndAfter(endKatex);
+  }
+
+  var fragment = range.cloneContents();
+
+  if (!fragment.querySelector('.katex-mathml')) {
+    return; // default action OK if no .katex-mathml elements
+  }
+
+  var htmlContents = Array.prototype.map.call(fragment.childNodes, function (el) {
+    return el instanceof Text ? el.textContent : el.outerHTML;
+  }).join(''); // Preserve usual HTML copy/paste behavior.
+
+  clipboardData.setData('text/html', htmlContents); // Rewrite plain-text version.
+
+  clipboardData.setData('text/plain', katex2tex(fragment).textContent); // Prevent normal copy handling.
+
+  event.preventDefault();
+});
+__webpack_exports__ = __webpack_exports__["default"];
+/******/ 	return __webpack_exports__;
+/******/ })()
+;
+});

+ 1 - 0
public/lib/katex/contrib/copy-tex.min.js

@@ -0,0 +1 @@
+!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var n=t();for(var r in n)("object"==typeof exports?exports:e)[r]=n[r]}}("undefined"!=typeof self?self:this,(function(){return function(){"use strict";var e={},t={inline:["$","$"],display:["$$","$$"]};var n=function(e,n){void 0===n&&(n=t);for(var r=e.querySelectorAll(".katex-mathml + .katex-html"),a=0;a<r.length;a++){var o=r[a];o.remove?o.remove():o.parentNode&&o.parentNode.removeChild(o)}for(var i=e.querySelectorAll(".katex-mathml"),l=0;l<i.length;l++){var f=i[l],c=f.querySelector("annotation");c&&(f.replaceWith?f.replaceWith(c):f.parentNode&&f.parentNode.replaceChild(c,f),c.innerHTML=n.inline[0]+c.innerHTML+n.inline[1])}for(var d=e.querySelectorAll(".katex-display annotation"),s=0;s<d.length;s++){var p=d[s];p.innerHTML=n.display[0]+p.innerHTML.substr(n.inline[0].length,p.innerHTML.length-n.inline[0].length-n.inline[1].length)+n.display[1]}return e};function r(e){var t=e instanceof Element?e:e.parentElement;return t&&t.closest(".katex")}return document.addEventListener("copy",(function(e){var t=window.getSelection();if(!t.isCollapsed&&e.clipboardData){var a=e.clipboardData,o=t.getRangeAt(0),i=r(o.startContainer);i&&o.setStartBefore(i);var l=r(o.endContainer);l&&o.setEndAfter(l);var f=o.cloneContents();if(f.querySelector(".katex-mathml")){var c=Array.prototype.map.call(f.childNodes,(function(e){return e instanceof Text?e.textContent:e.outerHTML})).join("");a.setData("text/html",c),a.setData("text/plain",n(f).textContent),e.preventDefault()}}})),e=e.default}()}));

+ 105 - 0
public/lib/katex/contrib/copy-tex.mjs

@@ -0,0 +1,105 @@
+// Set these to how you want inline and display math to be delimited.
+var defaultCopyDelimiters = {
+  inline: ['$', '$'],
+  // alternative: ['\(', '\)']
+  display: ['$$', '$$'] // alternative: ['\[', '\]']
+
+}; // Replace .katex elements with their TeX source (<annotation> element).
+// Modifies fragment in-place.  Useful for writing your own 'copy' handler,
+// as in copy-tex.js.
+
+function katexReplaceWithTex(fragment, copyDelimiters) {
+  if (copyDelimiters === void 0) {
+    copyDelimiters = defaultCopyDelimiters;
+  }
+
+  // Remove .katex-html blocks that are preceded by .katex-mathml blocks
+  // (which will get replaced below).
+  var katexHtml = fragment.querySelectorAll('.katex-mathml + .katex-html');
+
+  for (var i = 0; i < katexHtml.length; i++) {
+    var element = katexHtml[i];
+
+    if (element.remove) {
+      element.remove();
+    } else if (element.parentNode) {
+      element.parentNode.removeChild(element);
+    }
+  } // Replace .katex-mathml elements with their annotation (TeX source)
+  // descendant, with inline delimiters.
+
+
+  var katexMathml = fragment.querySelectorAll('.katex-mathml');
+
+  for (var _i = 0; _i < katexMathml.length; _i++) {
+    var _element = katexMathml[_i];
+
+    var texSource = _element.querySelector('annotation');
+
+    if (texSource) {
+      if (_element.replaceWith) {
+        _element.replaceWith(texSource);
+      } else if (_element.parentNode) {
+        _element.parentNode.replaceChild(texSource, _element);
+      }
+
+      texSource.innerHTML = copyDelimiters.inline[0] + texSource.innerHTML + copyDelimiters.inline[1];
+    }
+  } // Switch display math to display delimiters.
+
+
+  var displays = fragment.querySelectorAll('.katex-display annotation');
+
+  for (var _i2 = 0; _i2 < displays.length; _i2++) {
+    var _element2 = displays[_i2];
+    _element2.innerHTML = copyDelimiters.display[0] + _element2.innerHTML.substr(copyDelimiters.inline[0].length, _element2.innerHTML.length - copyDelimiters.inline[0].length - copyDelimiters.inline[1].length) + copyDelimiters.display[1];
+  }
+
+  return fragment;
+}
+
+function closestKatex(node) {
+  // If node is a Text Node, for example, go up to containing Element,
+  // where we can apply the `closest` method.
+  var element = node instanceof Element ? node : node.parentElement;
+  return element && element.closest('.katex');
+} // Global copy handler to modify behavior on/within .katex elements.
+
+
+document.addEventListener('copy', function (event) {
+  var selection = window.getSelection();
+
+  if (selection.isCollapsed || !event.clipboardData) {
+    return; // default action OK if selection is empty or unchangeable
+  }
+
+  var clipboardData = event.clipboardData;
+  var range = selection.getRangeAt(0); // When start point is within a formula, expand to entire formula.
+
+  var startKatex = closestKatex(range.startContainer);
+
+  if (startKatex) {
+    range.setStartBefore(startKatex);
+  } // Similarly, when end point is within a formula, expand to entire formula.
+
+
+  var endKatex = closestKatex(range.endContainer);
+
+  if (endKatex) {
+    range.setEndAfter(endKatex);
+  }
+
+  var fragment = range.cloneContents();
+
+  if (!fragment.querySelector('.katex-mathml')) {
+    return; // default action OK if no .katex-mathml elements
+  }
+
+  var htmlContents = Array.prototype.map.call(fragment.childNodes, el => el instanceof Text ? el.textContent : el.outerHTML).join(''); // Preserve usual HTML copy/paste behavior.
+
+  clipboardData.setData('text/html', htmlContents); // Rewrite plain-text version.
+
+  clipboardData.setData('text/plain', katexReplaceWithTex(fragment).textContent); // Prevent normal copy handling.
+
+  event.preventDefault();
+});

+ 112 - 0
public/lib/katex/contrib/mathtex-script-type.js

@@ -0,0 +1,112 @@
+(function webpackUniversalModuleDefinition(root, factory) {
+	if(typeof exports === 'object' && typeof module === 'object')
+		module.exports = factory(require("katex"));
+	else if(typeof define === 'function' && define.amd)
+		define(["katex"], factory);
+	else {
+		var a = typeof exports === 'object' ? factory(require("katex")) : factory(root["katex"]);
+		for(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];
+	}
+})((typeof self !== 'undefined' ? self : this), function(__WEBPACK_EXTERNAL_MODULE__771__) {
+return /******/ (function() { // webpackBootstrap
+/******/ 	"use strict";
+/******/ 	var __webpack_modules__ = ({
+
+/***/ 771:
+/***/ (function(module) {
+
+module.exports = __WEBPACK_EXTERNAL_MODULE__771__;
+
+/***/ })
+
+/******/ 	});
+/************************************************************************/
+/******/ 	// The module cache
+/******/ 	var __webpack_module_cache__ = {};
+/******/ 	
+/******/ 	// The require function
+/******/ 	function __webpack_require__(moduleId) {
+/******/ 		// Check if module is in cache
+/******/ 		var cachedModule = __webpack_module_cache__[moduleId];
+/******/ 		if (cachedModule !== undefined) {
+/******/ 			return cachedModule.exports;
+/******/ 		}
+/******/ 		// Create a new module (and put it into the cache)
+/******/ 		var module = __webpack_module_cache__[moduleId] = {
+/******/ 			// no module.id needed
+/******/ 			// no module.loaded needed
+/******/ 			exports: {}
+/******/ 		};
+/******/ 	
+/******/ 		// Execute the module function
+/******/ 		__webpack_modules__[moduleId](module, module.exports, __webpack_require__);
+/******/ 	
+/******/ 		// Return the exports of the module
+/******/ 		return module.exports;
+/******/ 	}
+/******/ 	
+/************************************************************************/
+/******/ 	/* webpack/runtime/compat get default export */
+/******/ 	!function() {
+/******/ 		// getDefaultExport function for compatibility with non-harmony modules
+/******/ 		__webpack_require__.n = function(module) {
+/******/ 			var getter = module && module.__esModule ?
+/******/ 				function() { return module['default']; } :
+/******/ 				function() { return module; };
+/******/ 			__webpack_require__.d(getter, { a: getter });
+/******/ 			return getter;
+/******/ 		};
+/******/ 	}();
+/******/ 	
+/******/ 	/* webpack/runtime/define property getters */
+/******/ 	!function() {
+/******/ 		// define getter functions for harmony exports
+/******/ 		__webpack_require__.d = function(exports, definition) {
+/******/ 			for(var key in definition) {
+/******/ 				if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
+/******/ 					Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
+/******/ 				}
+/******/ 			}
+/******/ 		};
+/******/ 	}();
+/******/ 	
+/******/ 	/* webpack/runtime/hasOwnProperty shorthand */
+/******/ 	!function() {
+/******/ 		__webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }
+/******/ 	}();
+/******/ 	
+/************************************************************************/
+var __webpack_exports__ = {};
+// This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk.
+!function() {
+/* harmony import */ var katex__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(771);
+/* harmony import */ var katex__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(katex__WEBPACK_IMPORTED_MODULE_0__);
+
+var scripts = document.body.getElementsByTagName("script");
+scripts = Array.prototype.slice.call(scripts);
+scripts.forEach(function (script) {
+  if (!script.type || !script.type.match(/math\/tex/i)) {
+    return -1;
+  }
+
+  var display = script.type.match(/mode\s*=\s*display(;|\s|\n|$)/) != null;
+  var katexElement = document.createElement(display ? "div" : "span");
+  katexElement.setAttribute("class", display ? "equation" : "inline-equation");
+
+  try {
+    katex__WEBPACK_IMPORTED_MODULE_0___default().render(script.text, katexElement, {
+      displayMode: display
+    });
+  } catch (err) {
+    //console.error(err); linter doesn't like this
+    katexElement.textContent = script.text;
+  }
+
+  script.parentNode.replaceChild(katexElement, script);
+});
+}();
+__webpack_exports__ = __webpack_exports__["default"];
+/******/ 	return __webpack_exports__;
+/******/ })()
+;
+});

+ 1 - 0
public/lib/katex/contrib/mathtex-script-type.min.js

@@ -0,0 +1 @@
+!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("katex"));else if("function"==typeof define&&define.amd)define(["katex"],t);else{var r="object"==typeof exports?t(require("katex")):t(e.katex);for(var n in r)("object"==typeof exports?exports:e)[n]=r[n]}}("undefined"!=typeof self?self:this,(function(e){return function(){"use strict";var t={771:function(t){t.exports=e}},r={};function n(e){var o=r[e];if(void 0!==o)return o.exports;var i=r[e]={exports:{}};return t[e](i,i.exports,n),i.exports}n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,{a:t}),t},n.d=function(e,t){for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)};var o,i,a,u={};return o=n(771),i=n.n(o),a=document.body.getElementsByTagName("script"),(a=Array.prototype.slice.call(a)).forEach((function(e){if(!e.type||!e.type.match(/math\/tex/i))return-1;var t=null!=e.type.match(/mode\s*=\s*display(;|\s|\n|$)/),r=document.createElement(t?"div":"span");r.setAttribute("class",t?"equation":"inline-equation");try{i().render(e.text,r,{displayMode:t})}catch(t){r.textContent=e.text}e.parentNode.replaceChild(r,e)})),u=u.default}()}));

+ 24 - 0
public/lib/katex/contrib/mathtex-script-type.mjs

@@ -0,0 +1,24 @@
+import katex from '../katex.mjs';
+
+var scripts = document.body.getElementsByTagName("script");
+scripts = Array.prototype.slice.call(scripts);
+scripts.forEach(function (script) {
+  if (!script.type || !script.type.match(/math\/tex/i)) {
+    return -1;
+  }
+
+  var display = script.type.match(/mode\s*=\s*display(;|\s|\n|$)/) != null;
+  var katexElement = document.createElement(display ? "div" : "span");
+  katexElement.setAttribute("class", display ? "equation" : "inline-equation");
+
+  try {
+    katex.render(script.text, katexElement, {
+      displayMode: display
+    });
+  } catch (err) {
+    //console.error(err); linter doesn't like this
+    katexElement.textContent = script.text;
+  }
+
+  script.parentNode.replaceChild(katexElement, script);
+});

+ 3216 - 0
public/lib/katex/contrib/mhchem.js

@@ -0,0 +1,3216 @@
+(function webpackUniversalModuleDefinition(root, factory) {
+	if(typeof exports === 'object' && typeof module === 'object')
+		module.exports = factory(require("katex"));
+	else if(typeof define === 'function' && define.amd)
+		define(["katex"], factory);
+	else {
+		var a = typeof exports === 'object' ? factory(require("katex")) : factory(root["katex"]);
+		for(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];
+	}
+})((typeof self !== 'undefined' ? self : this), function(__WEBPACK_EXTERNAL_MODULE__771__) {
+return /******/ (function() { // webpackBootstrap
+/******/ 	"use strict";
+/******/ 	var __webpack_modules__ = ({
+
+/***/ 771:
+/***/ (function(module) {
+
+module.exports = __WEBPACK_EXTERNAL_MODULE__771__;
+
+/***/ })
+
+/******/ 	});
+/************************************************************************/
+/******/ 	// The module cache
+/******/ 	var __webpack_module_cache__ = {};
+/******/ 	
+/******/ 	// The require function
+/******/ 	function __webpack_require__(moduleId) {
+/******/ 		// Check if module is in cache
+/******/ 		var cachedModule = __webpack_module_cache__[moduleId];
+/******/ 		if (cachedModule !== undefined) {
+/******/ 			return cachedModule.exports;
+/******/ 		}
+/******/ 		// Create a new module (and put it into the cache)
+/******/ 		var module = __webpack_module_cache__[moduleId] = {
+/******/ 			// no module.id needed
+/******/ 			// no module.loaded needed
+/******/ 			exports: {}
+/******/ 		};
+/******/ 	
+/******/ 		// Execute the module function
+/******/ 		__webpack_modules__[moduleId](module, module.exports, __webpack_require__);
+/******/ 	
+/******/ 		// Return the exports of the module
+/******/ 		return module.exports;
+/******/ 	}
+/******/ 	
+/************************************************************************/
+/******/ 	/* webpack/runtime/compat get default export */
+/******/ 	!function() {
+/******/ 		// getDefaultExport function for compatibility with non-harmony modules
+/******/ 		__webpack_require__.n = function(module) {
+/******/ 			var getter = module && module.__esModule ?
+/******/ 				function() { return module['default']; } :
+/******/ 				function() { return module; };
+/******/ 			__webpack_require__.d(getter, { a: getter });
+/******/ 			return getter;
+/******/ 		};
+/******/ 	}();
+/******/ 	
+/******/ 	/* webpack/runtime/define property getters */
+/******/ 	!function() {
+/******/ 		// define getter functions for harmony exports
+/******/ 		__webpack_require__.d = function(exports, definition) {
+/******/ 			for(var key in definition) {
+/******/ 				if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
+/******/ 					Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
+/******/ 				}
+/******/ 			}
+/******/ 		};
+/******/ 	}();
+/******/ 	
+/******/ 	/* webpack/runtime/hasOwnProperty shorthand */
+/******/ 	!function() {
+/******/ 		__webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }
+/******/ 	}();
+/******/ 	
+/************************************************************************/
+var __webpack_exports__ = {};
+// This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk.
+!function() {
+/* harmony import */ var katex__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(771);
+/* harmony import */ var katex__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(katex__WEBPACK_IMPORTED_MODULE_0__);
+/* eslint-disable */
+
+/* -*- Mode: Javascript; indent-tabs-mode:nil; js-indent-level: 2 -*- */
+
+/* vim: set ts=2 et sw=2 tw=80: */
+
+/*************************************************************
+ *
+ *  KaTeX mhchem.js
+ *
+ *  This file implements a KaTeX version of mhchem version 3.3.0.
+ *  It is adapted from MathJax/extensions/TeX/mhchem.js
+ *  It differs from the MathJax version as follows:
+ *    1. The interface is changed so that it can be called from KaTeX, not MathJax.
+ *    2. \rlap and \llap are replaced with \mathrlap and \mathllap.
+ *    3. Four lines of code are edited in order to use \raisebox instead of \raise.
+ *    4. The reaction arrow code is simplified. All reaction arrows are rendered
+ *       using KaTeX extensible arrows instead of building non-extensible arrows.
+ *    5. \tripledash vertical alignment is slightly adjusted.
+ *
+ *    This code, as other KaTeX code, is released under the MIT license.
+ * 
+ * /*************************************************************
+ *
+ *  MathJax/extensions/TeX/mhchem.js
+ *
+ *  Implements the \ce command for handling chemical formulas
+ *  from the mhchem LaTeX package.
+ *
+ *  ---------------------------------------------------------------------
+ *
+ *  Copyright (c) 2011-2015 The MathJax Consortium
+ *  Copyright (c) 2015-2018 Martin Hensel
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+//
+// Coding Style
+//   - use '' for identifiers that can by minified/uglified
+//   - use "" for strings that need to stay untouched
+// version: "3.3.0" for MathJax and KaTeX
+// Add \ce, \pu, and \tripledash to the KaTeX macros.
+katex__WEBPACK_IMPORTED_MODULE_0___default().__defineMacro("\\ce", function (context) {
+  return chemParse(context.consumeArgs(1)[0], "ce");
+});
+
+katex__WEBPACK_IMPORTED_MODULE_0___default().__defineMacro("\\pu", function (context) {
+  return chemParse(context.consumeArgs(1)[0], "pu");
+}); //  Needed for \bond for the ~ forms
+//  Raise by 2.56mu, not 2mu. We're raising a hyphen-minus, U+002D, not 
+//  a mathematical minus, U+2212. So we need that extra 0.56.
+
+
+katex__WEBPACK_IMPORTED_MODULE_0___default().__defineMacro("\\tripledash", "{\\vphantom{-}\\raisebox{2.56mu}{$\\mkern2mu" + "\\tiny\\text{-}\\mkern1mu\\text{-}\\mkern1mu\\text{-}\\mkern2mu$}}");
+
+ //
+//  This is the main function for handing the \ce and \pu commands.
+//  It takes the argument to \ce or \pu and returns the corresponding TeX string.
+//
+
+var chemParse = function chemParse(tokens, stateMachine) {
+  // Recreate the argument string from KaTeX's array of tokens.
+  var str = "";
+  var expectedLoc = tokens.length && tokens[tokens.length - 1].loc.start;
+
+  for (var i = tokens.length - 1; i >= 0; i--) {
+    if (tokens[i].loc.start > expectedLoc) {
+      // context.consumeArgs has eaten a space.
+      str += " ";
+      expectedLoc = tokens[i].loc.start;
+    }
+
+    str += tokens[i].text;
+    expectedLoc += tokens[i].text.length;
+  }
+
+  var tex = texify.go(mhchemParser.go(str, stateMachine));
+  return tex;
+}; //
+// Core parser for mhchem syntax  (recursive)
+//
+
+/** @type {MhchemParser} */
+
+
+var mhchemParser = {
+  //
+  // Parses mchem \ce syntax
+  //
+  // Call like
+  //   go("H2O");
+  //
+  go: function go(input, stateMachine) {
+    if (!input) {
+      return [];
+    }
+
+    if (stateMachine === undefined) {
+      stateMachine = 'ce';
+    }
+
+    var state = '0'; //
+    // String buffers for parsing:
+    //
+    // buffer.a == amount
+    // buffer.o == element
+    // buffer.b == left-side superscript
+    // buffer.p == left-side subscript
+    // buffer.q == right-side subscript
+    // buffer.d == right-side superscript
+    //
+    // buffer.r == arrow
+    // buffer.rdt == arrow, script above, type
+    // buffer.rd == arrow, script above, content
+    // buffer.rqt == arrow, script below, type
+    // buffer.rq == arrow, script below, content
+    //
+    // buffer.text_
+    // buffer.rm
+    // etc.
+    //
+    // buffer.parenthesisLevel == int, starting at 0
+    // buffer.sb == bool, space before
+    // buffer.beginsWithBond == bool
+    //
+    // These letters are also used as state names.
+    //
+    // Other states:
+    // 0 == begin of main part (arrow/operator unlikely)
+    // 1 == next entity
+    // 2 == next entity (arrow/operator unlikely)
+    // 3 == next atom
+    // c == macro
+    //
+
+    /** @type {Buffer} */
+
+    var buffer = {};
+    buffer['parenthesisLevel'] = 0;
+    input = input.replace(/\n/g, " ");
+    input = input.replace(/[\u2212\u2013\u2014\u2010]/g, "-");
+    input = input.replace(/[\u2026]/g, "..."); //
+    // Looks through mhchemParser.transitions, to execute a matching action
+    // (recursive)
+    //
+
+    var lastInput;
+    var watchdog = 10;
+    /** @type {ParserOutput[]} */
+
+    var output = [];
+
+    while (true) {
+      if (lastInput !== input) {
+        watchdog = 10;
+        lastInput = input;
+      } else {
+        watchdog--;
+      } //
+      // Find actions in transition table
+      //
+
+
+      var machine = mhchemParser.stateMachines[stateMachine];
+      var t = machine.transitions[state] || machine.transitions['*'];
+
+      iterateTransitions: for (var i = 0; i < t.length; i++) {
+        var matches = mhchemParser.patterns.match_(t[i].pattern, input);
+
+        if (matches) {
+          //
+          // Execute actions
+          //
+          var task = t[i].task;
+
+          for (var iA = 0; iA < task.action_.length; iA++) {
+            var o; //
+            // Find and execute action
+            //
+
+            if (machine.actions[task.action_[iA].type_]) {
+              o = machine.actions[task.action_[iA].type_](buffer, matches.match_, task.action_[iA].option);
+            } else if (mhchemParser.actions[task.action_[iA].type_]) {
+              o = mhchemParser.actions[task.action_[iA].type_](buffer, matches.match_, task.action_[iA].option);
+            } else {
+              throw ["MhchemBugA", "mhchem bug A. Please report. (" + task.action_[iA].type_ + ")"]; // Trying to use non-existing action
+            } //
+            // Add output
+            //
+
+
+            mhchemParser.concatArray(output, o);
+          } //
+          // Set next state,
+          // Shorten input,
+          // Continue with next character
+          //   (= apply only one transition per position)
+          //
+
+
+          state = task.nextState || state;
+
+          if (input.length > 0) {
+            if (!task.revisit) {
+              input = matches.remainder;
+            }
+
+            if (!task.toContinue) {
+              break iterateTransitions;
+            }
+          } else {
+            return output;
+          }
+        }
+      } //
+      // Prevent infinite loop
+      //
+
+
+      if (watchdog <= 0) {
+        throw ["MhchemBugU", "mhchem bug U. Please report."]; // Unexpected character
+      }
+    }
+  },
+  concatArray: function concatArray(a, b) {
+    if (b) {
+      if (Array.isArray(b)) {
+        for (var iB = 0; iB < b.length; iB++) {
+          a.push(b[iB]);
+        }
+      } else {
+        a.push(b);
+      }
+    }
+  },
+  patterns: {
+    //
+    // Matching patterns
+    // either regexps or function that return null or {match_:"a", remainder:"bc"}
+    //
+    patterns: {
+      // property names must not look like integers ("2") for correct property traversal order, later on
+      'empty': /^$/,
+      'else': /^./,
+      'else2': /^./,
+      'space': /^\s/,
+      'space A': /^\s(?=[A-Z\\$])/,
+      'space$': /^\s$/,
+      'a-z': /^[a-z]/,
+      'x': /^x/,
+      'x$': /^x$/,
+      'i$': /^i$/,
+      'letters': /^(?:[a-zA-Z\u03B1-\u03C9\u0391-\u03A9?@]|(?:\\(?:alpha|beta|gamma|delta|epsilon|zeta|eta|theta|iota|kappa|lambda|mu|nu|xi|omicron|pi|rho|sigma|tau|upsilon|phi|chi|psi|omega|Gamma|Delta|Theta|Lambda|Xi|Pi|Sigma|Upsilon|Phi|Psi|Omega)(?:\s+|\{\}|(?![a-zA-Z]))))+/,
+      '\\greek': /^\\(?:alpha|beta|gamma|delta|epsilon|zeta|eta|theta|iota|kappa|lambda|mu|nu|xi|omicron|pi|rho|sigma|tau|upsilon|phi|chi|psi|omega|Gamma|Delta|Theta|Lambda|Xi|Pi|Sigma|Upsilon|Phi|Psi|Omega)(?:\s+|\{\}|(?![a-zA-Z]))/,
+      'one lowercase latin letter $': /^(?:([a-z])(?:$|[^a-zA-Z]))$/,
+      '$one lowercase latin letter$ $': /^\$(?:([a-z])(?:$|[^a-zA-Z]))\$$/,
+      'one lowercase greek letter $': /^(?:\$?[\u03B1-\u03C9]\$?|\$?\\(?:alpha|beta|gamma|delta|epsilon|zeta|eta|theta|iota|kappa|lambda|mu|nu|xi|omicron|pi|rho|sigma|tau|upsilon|phi|chi|psi|omega)\s*\$?)(?:\s+|\{\}|(?![a-zA-Z]))$/,
+      'digits': /^[0-9]+/,
+      '-9.,9': /^[+\-]?(?:[0-9]+(?:[,.][0-9]+)?|[0-9]*(?:\.[0-9]+))/,
+      '-9.,9 no missing 0': /^[+\-]?[0-9]+(?:[.,][0-9]+)?/,
+      '(-)(9.,9)(e)(99)': function e99(input) {
+        var m = input.match(/^(\+\-|\+\/\-|\+|\-|\\pm\s?)?([0-9]+(?:[,.][0-9]+)?|[0-9]*(?:\.[0-9]+))?(\((?:[0-9]+(?:[,.][0-9]+)?|[0-9]*(?:\.[0-9]+))\))?(?:([eE]|\s*(\*|x|\\times|\u00D7)\s*10\^)([+\-]?[0-9]+|\{[+\-]?[0-9]+\}))?/);
+
+        if (m && m[0]) {
+          return {
+            match_: m.splice(1),
+            remainder: input.substr(m[0].length)
+          };
+        }
+
+        return null;
+      },
+      '(-)(9)^(-9)': function _(input) {
+        var m = input.match(/^(\+\-|\+\/\-|\+|\-|\\pm\s?)?([0-9]+(?:[,.][0-9]+)?|[0-9]*(?:\.[0-9]+)?)\^([+\-]?[0-9]+|\{[+\-]?[0-9]+\})/);
+
+        if (m && m[0]) {
+          return {
+            match_: m.splice(1),
+            remainder: input.substr(m[0].length)
+          };
+        }
+
+        return null;
+      },
+      'state of aggregation $': function stateOfAggregation$(input) {
+        // ... or crystal system
+        var a = mhchemParser.patterns.findObserveGroups(input, "", /^\([a-z]{1,3}(?=[\),])/, ")", ""); // (aq), (aq,$\infty$), (aq, sat)
+
+        if (a && a.remainder.match(/^($|[\s,;\)\]\}])/)) {
+          return a;
+        } //  AND end of 'phrase'
+
+
+        var m = input.match(/^(?:\((?:\\ca\s?)?\$[amothc]\$\))/); // OR crystal system ($o$) (\ca$c$)
+
+        if (m) {
+          return {
+            match_: m[0],
+            remainder: input.substr(m[0].length)
+          };
+        }
+
+        return null;
+      },
+      '_{(state of aggregation)}$': /^_\{(\([a-z]{1,3}\))\}/,
+      '{[(': /^(?:\\\{|\[|\()/,
+      ')]}': /^(?:\)|\]|\\\})/,
+      ', ': /^[,;]\s*/,
+      ',': /^[,;]/,
+      '.': /^[.]/,
+      '. ': /^([.\u22C5\u00B7\u2022])\s*/,
+      '...': /^\.\.\.(?=$|[^.])/,
+      '* ': /^([*])\s*/,
+      '^{(...)}': function _(input) {
+        return mhchemParser.patterns.findObserveGroups(input, "^{", "", "", "}");
+      },
+      '^($...$)': function $$(input) {
+        return mhchemParser.patterns.findObserveGroups(input, "^", "$", "$", "");
+      },
+      '^a': /^\^([0-9]+|[^\\_])/,
+      '^\\x{}{}': function x(input) {
+        return mhchemParser.patterns.findObserveGroups(input, "^", /^\\[a-zA-Z]+\{/, "}", "", "", "{", "}", "", true);
+      },
+      '^\\x{}': function x(input) {
+        return mhchemParser.patterns.findObserveGroups(input, "^", /^\\[a-zA-Z]+\{/, "}", "");
+      },
+      '^\\x': /^\^(\\[a-zA-Z]+)\s*/,
+      '^(-1)': /^\^(-?\d+)/,
+      '\'': /^'/,
+      '_{(...)}': function _(input) {
+        return mhchemParser.patterns.findObserveGroups(input, "_{", "", "", "}");
+      },
+      '_($...$)': function _$$(input) {
+        return mhchemParser.patterns.findObserveGroups(input, "_", "$", "$", "");
+      },
+      '_9': /^_([+\-]?[0-9]+|[^\\])/,
+      '_\\x{}{}': function _X(input) {
+        return mhchemParser.patterns.findObserveGroups(input, "_", /^\\[a-zA-Z]+\{/, "}", "", "", "{", "}", "", true);
+      },
+      '_\\x{}': function _X(input) {
+        return mhchemParser.patterns.findObserveGroups(input, "_", /^\\[a-zA-Z]+\{/, "}", "");
+      },
+      '_\\x': /^_(\\[a-zA-Z]+)\s*/,
+      '^_': /^(?:\^(?=_)|\_(?=\^)|[\^_]$)/,
+      '{}': /^\{\}/,
+      '{...}': function _(input) {
+        return mhchemParser.patterns.findObserveGroups(input, "", "{", "}", "");
+      },
+      '{(...)}': function _(input) {
+        return mhchemParser.patterns.findObserveGroups(input, "{", "", "", "}");
+      },
+      '$...$': function $$(input) {
+        return mhchemParser.patterns.findObserveGroups(input, "", "$", "$", "");
+      },
+      '${(...)}$': function $$(input) {
+        return mhchemParser.patterns.findObserveGroups(input, "${", "", "", "}$");
+      },
+      '$(...)$': function $$(input) {
+        return mhchemParser.patterns.findObserveGroups(input, "$", "", "", "$");
+      },
+      '=<>': /^[=<>]/,
+      '#': /^[#\u2261]/,
+      '+': /^\+/,
+      '-$': /^-(?=[\s_},;\]/]|$|\([a-z]+\))/,
+      // -space -, -; -] -/ -$ -state-of-aggregation
+      '-9': /^-(?=[0-9])/,
+      '- orbital overlap': /^-(?=(?:[spd]|sp)(?:$|[\s,;\)\]\}]))/,
+      '-': /^-/,
+      'pm-operator': /^(?:\\pm|\$\\pm\$|\+-|\+\/-)/,
+      'operator': /^(?:\+|(?:[\-=<>]|<<|>>|\\approx|\$\\approx\$)(?=\s|$|-?[0-9]))/,
+      'arrowUpDown': /^(?:v|\(v\)|\^|\(\^\))(?=$|[\s,;\)\]\}])/,
+      '\\bond{(...)}': function bond(input) {
+        return mhchemParser.patterns.findObserveGroups(input, "\\bond{", "", "", "}");
+      },
+      '->': /^(?:<->|<-->|->|<-|<=>>|<<=>|<=>|[\u2192\u27F6\u21CC])/,
+      'CMT': /^[CMT](?=\[)/,
+      '[(...)]': function _(input) {
+        return mhchemParser.patterns.findObserveGroups(input, "[", "", "", "]");
+      },
+      '1st-level escape': /^(&|\\\\|\\hline)\s*/,
+      '\\,': /^(?:\\[,\ ;:])/,
+      // \\x - but output no space before
+      '\\x{}{}': function x(input) {
+        return mhchemParser.patterns.findObserveGroups(input, "", /^\\[a-zA-Z]+\{/, "}", "", "", "{", "}", "", true);
+      },
+      '\\x{}': function x(input) {
+        return mhchemParser.patterns.findObserveGroups(input, "", /^\\[a-zA-Z]+\{/, "}", "");
+      },
+      '\\ca': /^\\ca(?:\s+|(?![a-zA-Z]))/,
+      '\\x': /^(?:\\[a-zA-Z]+\s*|\\[_&{}%])/,
+      'orbital': /^(?:[0-9]{1,2}[spdfgh]|[0-9]{0,2}sp)(?=$|[^a-zA-Z])/,
+      // only those with numbers in front, because the others will be formatted correctly anyway
+      'others': /^[\/~|]/,
+      '\\frac{(...)}': function frac(input) {
+        return mhchemParser.patterns.findObserveGroups(input, "\\frac{", "", "", "}", "{", "", "", "}");
+      },
+      '\\overset{(...)}': function overset(input) {
+        return mhchemParser.patterns.findObserveGroups(input, "\\overset{", "", "", "}", "{", "", "", "}");
+      },
+      "\\underset{(...)}": function underset(input) {
+        return mhchemParser.patterns.findObserveGroups(input, "\\underset{", "", "", "}", "{", "", "", "}");
+      },
+      "\\underbrace{(...)}": function underbrace(input) {
+        return mhchemParser.patterns.findObserveGroups(input, "\\underbrace{", "", "", "}_", "{", "", "", "}");
+      },
+      '\\color{(...)}0': function color0(input) {
+        return mhchemParser.patterns.findObserveGroups(input, "\\color{", "", "", "}");
+      },
+      '\\color{(...)}{(...)}1': function color1(input) {
+        return mhchemParser.patterns.findObserveGroups(input, "\\color{", "", "", "}", "{", "", "", "}");
+      },
+      '\\color(...){(...)}2': function color2(input) {
+        return mhchemParser.patterns.findObserveGroups(input, "\\color", "\\", "", /^(?=\{)/, "{", "", "", "}");
+      },
+      '\\ce{(...)}': function ce(input) {
+        return mhchemParser.patterns.findObserveGroups(input, "\\ce{", "", "", "}");
+      },
+      'oxidation$': /^(?:[+-][IVX]+|\\pm\s*0|\$\\pm\$\s*0)$/,
+      'd-oxidation$': /^(?:[+-]?\s?[IVX]+|\\pm\s*0|\$\\pm\$\s*0)$/,
+      // 0 could be oxidation or charge
+      'roman numeral': /^[IVX]+/,
+      '1/2$': /^[+\-]?(?:[0-9]+|\$[a-z]\$|[a-z])\/[0-9]+(?:\$[a-z]\$|[a-z])?$/,
+      'amount': function amount(input) {
+        var match; // e.g. 2, 0.5, 1/2, -2, n/2, +;  $a$ could be added later in parsing
+
+        match = input.match(/^(?:(?:(?:\([+\-]?[0-9]+\/[0-9]+\)|[+\-]?(?:[0-9]+|\$[a-z]\$|[a-z])\/[0-9]+|[+\-]?[0-9]+[.,][0-9]+|[+\-]?\.[0-9]+|[+\-]?[0-9]+)(?:[a-z](?=\s*[A-Z]))?)|[+\-]?[a-z](?=\s*[A-Z])|\+(?!\s))/);
+
+        if (match) {
+          return {
+            match_: match[0],
+            remainder: input.substr(match[0].length)
+          };
+        }
+
+        var a = mhchemParser.patterns.findObserveGroups(input, "", "$", "$", "");
+
+        if (a) {
+          // e.g. $2n-1$, $-$
+          match = a.match_.match(/^\$(?:\(?[+\-]?(?:[0-9]*[a-z]?[+\-])?[0-9]*[a-z](?:[+\-][0-9]*[a-z]?)?\)?|\+|-)\$$/);
+
+          if (match) {
+            return {
+              match_: match[0],
+              remainder: input.substr(match[0].length)
+            };
+          }
+        }
+
+        return null;
+      },
+      'amount2': function amount2(input) {
+        return this['amount'](input);
+      },
+      '(KV letters),': /^(?:[A-Z][a-z]{0,2}|i)(?=,)/,
+      'formula$': function formula$(input) {
+        if (input.match(/^\([a-z]+\)$/)) {
+          return null;
+        } // state of aggregation = no formula
+
+
+        var match = input.match(/^(?:[a-z]|(?:[0-9\ \+\-\,\.\(\)]+[a-z])+[0-9\ \+\-\,\.\(\)]*|(?:[a-z][0-9\ \+\-\,\.\(\)]+)+[a-z]?)$/);
+
+        if (match) {
+          return {
+            match_: match[0],
+            remainder: input.substr(match[0].length)
+          };
+        }
+
+        return null;
+      },
+      'uprightEntities': /^(?:pH|pOH|pC|pK|iPr|iBu)(?=$|[^a-zA-Z])/,
+      '/': /^\s*(\/)\s*/,
+      '//': /^\s*(\/\/)\s*/,
+      '*': /^\s*[*.]\s*/
+    },
+    findObserveGroups: function findObserveGroups(input, begExcl, begIncl, endIncl, endExcl, beg2Excl, beg2Incl, end2Incl, end2Excl, combine) {
+      /** @type {{(input: string, pattern: string | RegExp): string | string[] | null;}} */
+      var _match = function _match(input, pattern) {
+        if (typeof pattern === "string") {
+          if (input.indexOf(pattern) !== 0) {
+            return null;
+          }
+
+          return pattern;
+        } else {
+          var match = input.match(pattern);
+
+          if (!match) {
+            return null;
+          }
+
+          return match[0];
+        }
+      };
+      /** @type {{(input: string, i: number, endChars: string | RegExp): {endMatchBegin: number, endMatchEnd: number} | null;}} */
+
+
+      var _findObserveGroups = function _findObserveGroups(input, i, endChars) {
+        var braces = 0;
+
+        while (i < input.length) {
+          var a = input.charAt(i);
+
+          var match = _match(input.substr(i), endChars);
+
+          if (match !== null && braces === 0) {
+            return {
+              endMatchBegin: i,
+              endMatchEnd: i + match.length
+            };
+          } else if (a === "{") {
+            braces++;
+          } else if (a === "}") {
+            if (braces === 0) {
+              throw ["ExtraCloseMissingOpen", "Extra close brace or missing open brace"];
+            } else {
+              braces--;
+            }
+          }
+
+          i++;
+        }
+
+        if (braces > 0) {
+          return null;
+        }
+
+        return null;
+      };
+
+      var match = _match(input, begExcl);
+
+      if (match === null) {
+        return null;
+      }
+
+      input = input.substr(match.length);
+      match = _match(input, begIncl);
+
+      if (match === null) {
+        return null;
+      }
+
+      var e = _findObserveGroups(input, match.length, endIncl || endExcl);
+
+      if (e === null) {
+        return null;
+      }
+
+      var match1 = input.substring(0, endIncl ? e.endMatchEnd : e.endMatchBegin);
+
+      if (!(beg2Excl || beg2Incl)) {
+        return {
+          match_: match1,
+          remainder: input.substr(e.endMatchEnd)
+        };
+      } else {
+        var group2 = this.findObserveGroups(input.substr(e.endMatchEnd), beg2Excl, beg2Incl, end2Incl, end2Excl);
+
+        if (group2 === null) {
+          return null;
+        }
+        /** @type {string[]} */
+
+
+        var matchRet = [match1, group2.match_];
+        return {
+          match_: combine ? matchRet.join("") : matchRet,
+          remainder: group2.remainder
+        };
+      }
+    },
+    //
+    // Matching function
+    // e.g. match("a", input) will look for the regexp called "a" and see if it matches
+    // returns null or {match_:"a", remainder:"bc"}
+    //
+    match_: function match_(m, input) {
+      var pattern = mhchemParser.patterns.patterns[m];
+
+      if (pattern === undefined) {
+        throw ["MhchemBugP", "mhchem bug P. Please report. (" + m + ")"]; // Trying to use non-existing pattern
+      } else if (typeof pattern === "function") {
+        return mhchemParser.patterns.patterns[m](input); // cannot use cached var pattern here, because some pattern functions need this===mhchemParser
+      } else {
+        // RegExp
+        var match = input.match(pattern);
+
+        if (match) {
+          var mm;
+
+          if (match[2]) {
+            mm = [match[1], match[2]];
+          } else if (match[1]) {
+            mm = match[1];
+          } else {
+            mm = match[0];
+          }
+
+          return {
+            match_: mm,
+            remainder: input.substr(match[0].length)
+          };
+        }
+
+        return null;
+      }
+    }
+  },
+  //
+  // Generic state machine actions
+  //
+  actions: {
+    'a=': function a(buffer, m) {
+      buffer.a = (buffer.a || "") + m;
+    },
+    'b=': function b(buffer, m) {
+      buffer.b = (buffer.b || "") + m;
+    },
+    'p=': function p(buffer, m) {
+      buffer.p = (buffer.p || "") + m;
+    },
+    'o=': function o(buffer, m) {
+      buffer.o = (buffer.o || "") + m;
+    },
+    'q=': function q(buffer, m) {
+      buffer.q = (buffer.q || "") + m;
+    },
+    'd=': function d(buffer, m) {
+      buffer.d = (buffer.d || "") + m;
+    },
+    'rm=': function rm(buffer, m) {
+      buffer.rm = (buffer.rm || "") + m;
+    },
+    'text=': function text(buffer, m) {
+      buffer.text_ = (buffer.text_ || "") + m;
+    },
+    'insert': function insert(buffer, m, a) {
+      return {
+        type_: a
+      };
+    },
+    'insert+p1': function insertP1(buffer, m, a) {
+      return {
+        type_: a,
+        p1: m
+      };
+    },
+    'insert+p1+p2': function insertP1P2(buffer, m, a) {
+      return {
+        type_: a,
+        p1: m[0],
+        p2: m[1]
+      };
+    },
+    'copy': function copy(buffer, m) {
+      return m;
+    },
+    'rm': function rm(buffer, m) {
+      return {
+        type_: 'rm',
+        p1: m || ""
+      };
+    },
+    'text': function text(buffer, m) {
+      return mhchemParser.go(m, 'text');
+    },
+    '{text}': function text(buffer, m) {
+      var ret = ["{"];
+      mhchemParser.concatArray(ret, mhchemParser.go(m, 'text'));
+      ret.push("}");
+      return ret;
+    },
+    'tex-math': function texMath(buffer, m) {
+      return mhchemParser.go(m, 'tex-math');
+    },
+    'tex-math tight': function texMathTight(buffer, m) {
+      return mhchemParser.go(m, 'tex-math tight');
+    },
+    'bond': function bond(buffer, m, k) {
+      return {
+        type_: 'bond',
+        kind_: k || m
+      };
+    },
+    'color0-output': function color0Output(buffer, m) {
+      return {
+        type_: 'color0',
+        color: m[0]
+      };
+    },
+    'ce': function ce(buffer, m) {
+      return mhchemParser.go(m);
+    },
+    '1/2': function _(buffer, m) {
+      /** @type {ParserOutput[]} */
+      var ret = [];
+
+      if (m.match(/^[+\-]/)) {
+        ret.push(m.substr(0, 1));
+        m = m.substr(1);
+      }
+
+      var n = m.match(/^([0-9]+|\$[a-z]\$|[a-z])\/([0-9]+)(\$[a-z]\$|[a-z])?$/);
+      n[1] = n[1].replace(/\$/g, "");
+      ret.push({
+        type_: 'frac',
+        p1: n[1],
+        p2: n[2]
+      });
+
+      if (n[3]) {
+        n[3] = n[3].replace(/\$/g, "");
+        ret.push({
+          type_: 'tex-math',
+          p1: n[3]
+        });
+      }
+
+      return ret;
+    },
+    '9,9': function _(buffer, m) {
+      return mhchemParser.go(m, '9,9');
+    }
+  },
+  //
+  // createTransitions
+  // convert  { 'letter': { 'state': { action_: 'output' } } }  to  { 'state' => [ { pattern: 'letter', task: { action_: [{type_: 'output'}] } } ] }
+  // with expansion of 'a|b' to 'a' and 'b' (at 2 places)
+  //
+  createTransitions: function createTransitions(o) {
+    var pattern, state;
+    /** @type {string[]} */
+
+    var stateArray;
+    var i; //
+    // 1. Collect all states
+    //
+
+    /** @type {Transitions} */
+
+    var transitions = {};
+
+    for (pattern in o) {
+      for (state in o[pattern]) {
+        stateArray = state.split("|");
+        o[pattern][state].stateArray = stateArray;
+
+        for (i = 0; i < stateArray.length; i++) {
+          transitions[stateArray[i]] = [];
+        }
+      }
+    } //
+    // 2. Fill states
+    //
+
+
+    for (pattern in o) {
+      for (state in o[pattern]) {
+        stateArray = o[pattern][state].stateArray || [];
+
+        for (i = 0; i < stateArray.length; i++) {
+          //
+          // 2a. Normalize actions into array:  'text=' ==> [{type_:'text='}]
+          // (Note to myself: Resolving the function here would be problematic. It would need .bind (for *this*) and currying (for *option*).)
+          //
+
+          /** @type {any} */
+          var p = o[pattern][state];
+
+          if (p.action_) {
+            p.action_ = [].concat(p.action_);
+
+            for (var k = 0; k < p.action_.length; k++) {
+              if (typeof p.action_[k] === "string") {
+                p.action_[k] = {
+                  type_: p.action_[k]
+                };
+              }
+            }
+          } else {
+            p.action_ = [];
+          } //
+          // 2.b Multi-insert
+          //
+
+
+          var patternArray = pattern.split("|");
+
+          for (var j = 0; j < patternArray.length; j++) {
+            if (stateArray[i] === '*') {
+              // insert into all
+              for (var t in transitions) {
+                transitions[t].push({
+                  pattern: patternArray[j],
+                  task: p
+                });
+              }
+            } else {
+              transitions[stateArray[i]].push({
+                pattern: patternArray[j],
+                task: p
+              });
+            }
+          }
+        }
+      }
+    }
+
+    return transitions;
+  },
+  stateMachines: {}
+}; //
+// Definition of state machines
+//
+
+mhchemParser.stateMachines = {
+  //
+  // \ce state machines
+  //
+  //#region ce
+  'ce': {
+    // main parser
+    transitions: mhchemParser.createTransitions({
+      'empty': {
+        '*': {
+          action_: 'output'
+        }
+      },
+      'else': {
+        '0|1|2': {
+          action_: 'beginsWithBond=false',
+          revisit: true,
+          toContinue: true
+        }
+      },
+      'oxidation$': {
+        '0': {
+          action_: 'oxidation-output'
+        }
+      },
+      'CMT': {
+        'r': {
+          action_: 'rdt=',
+          nextState: 'rt'
+        },
+        'rd': {
+          action_: 'rqt=',
+          nextState: 'rdt'
+        }
+      },
+      'arrowUpDown': {
+        '0|1|2|as': {
+          action_: ['sb=false', 'output', 'operator'],
+          nextState: '1'
+        }
+      },
+      'uprightEntities': {
+        '0|1|2': {
+          action_: ['o=', 'output'],
+          nextState: '1'
+        }
+      },
+      'orbital': {
+        '0|1|2|3': {
+          action_: 'o=',
+          nextState: 'o'
+        }
+      },
+      '->': {
+        '0|1|2|3': {
+          action_: 'r=',
+          nextState: 'r'
+        },
+        'a|as': {
+          action_: ['output', 'r='],
+          nextState: 'r'
+        },
+        '*': {
+          action_: ['output', 'r='],
+          nextState: 'r'
+        }
+      },
+      '+': {
+        'o': {
+          action_: 'd= kv',
+          nextState: 'd'
+        },
+        'd|D': {
+          action_: 'd=',
+          nextState: 'd'
+        },
+        'q': {
+          action_: 'd=',
+          nextState: 'qd'
+        },
+        'qd|qD': {
+          action_: 'd=',
+          nextState: 'qd'
+        },
+        'dq': {
+          action_: ['output', 'd='],
+          nextState: 'd'
+        },
+        '3': {
+          action_: ['sb=false', 'output', 'operator'],
+          nextState: '0'
+        }
+      },
+      'amount': {
+        '0|2': {
+          action_: 'a=',
+          nextState: 'a'
+        }
+      },
+      'pm-operator': {
+        '0|1|2|a|as': {
+          action_: ['sb=false', 'output', {
+            type_: 'operator',
+            option: '\\pm'
+          }],
+          nextState: '0'
+        }
+      },
+      'operator': {
+        '0|1|2|a|as': {
+          action_: ['sb=false', 'output', 'operator'],
+          nextState: '0'
+        }
+      },
+      '-$': {
+        'o|q': {
+          action_: ['charge or bond', 'output'],
+          nextState: 'qd'
+        },
+        'd': {
+          action_: 'd=',
+          nextState: 'd'
+        },
+        'D': {
+          action_: ['output', {
+            type_: 'bond',
+            option: "-"
+          }],
+          nextState: '3'
+        },
+        'q': {
+          action_: 'd=',
+          nextState: 'qd'
+        },
+        'qd': {
+          action_: 'd=',
+          nextState: 'qd'
+        },
+        'qD|dq': {
+          action_: ['output', {
+            type_: 'bond',
+            option: "-"
+          }],
+          nextState: '3'
+        }
+      },
+      '-9': {
+        '3|o': {
+          action_: ['output', {
+            type_: 'insert',
+            option: 'hyphen'
+          }],
+          nextState: '3'
+        }
+      },
+      '- orbital overlap': {
+        'o': {
+          action_: ['output', {
+            type_: 'insert',
+            option: 'hyphen'
+          }],
+          nextState: '2'
+        },
+        'd': {
+          action_: ['output', {
+            type_: 'insert',
+            option: 'hyphen'
+          }],
+          nextState: '2'
+        }
+      },
+      '-': {
+        '0|1|2': {
+          action_: [{
+            type_: 'output',
+            option: 1
+          }, 'beginsWithBond=true', {
+            type_: 'bond',
+            option: "-"
+          }],
+          nextState: '3'
+        },
+        '3': {
+          action_: {
+            type_: 'bond',
+            option: "-"
+          }
+        },
+        'a': {
+          action_: ['output', {
+            type_: 'insert',
+            option: 'hyphen'
+          }],
+          nextState: '2'
+        },
+        'as': {
+          action_: [{
+            type_: 'output',
+            option: 2
+          }, {
+            type_: 'bond',
+            option: "-"
+          }],
+          nextState: '3'
+        },
+        'b': {
+          action_: 'b='
+        },
+        'o': {
+          action_: {
+            type_: '- after o/d',
+            option: false
+          },
+          nextState: '2'
+        },
+        'q': {
+          action_: {
+            type_: '- after o/d',
+            option: false
+          },
+          nextState: '2'
+        },
+        'd|qd|dq': {
+          action_: {
+            type_: '- after o/d',
+            option: true
+          },
+          nextState: '2'
+        },
+        'D|qD|p': {
+          action_: ['output', {
+            type_: 'bond',
+            option: "-"
+          }],
+          nextState: '3'
+        }
+      },
+      'amount2': {
+        '1|3': {
+          action_: 'a=',
+          nextState: 'a'
+        }
+      },
+      'letters': {
+        '0|1|2|3|a|as|b|p|bp|o': {
+          action_: 'o=',
+          nextState: 'o'
+        },
+        'q|dq': {
+          action_: ['output', 'o='],
+          nextState: 'o'
+        },
+        'd|D|qd|qD': {
+          action_: 'o after d',
+          nextState: 'o'
+        }
+      },
+      'digits': {
+        'o': {
+          action_: 'q=',
+          nextState: 'q'
+        },
+        'd|D': {
+          action_: 'q=',
+          nextState: 'dq'
+        },
+        'q': {
+          action_: ['output', 'o='],
+          nextState: 'o'
+        },
+        'a': {
+          action_: 'o=',
+          nextState: 'o'
+        }
+      },
+      'space A': {
+        'b|p|bp': {}
+      },
+      'space': {
+        'a': {
+          nextState: 'as'
+        },
+        '0': {
+          action_: 'sb=false'
+        },
+        '1|2': {
+          action_: 'sb=true'
+        },
+        'r|rt|rd|rdt|rdq': {
+          action_: 'output',
+          nextState: '0'
+        },
+        '*': {
+          action_: ['output', 'sb=true'],
+          nextState: '1'
+        }
+      },
+      '1st-level escape': {
+        '1|2': {
+          action_: ['output', {
+            type_: 'insert+p1',
+            option: '1st-level escape'
+          }]
+        },
+        '*': {
+          action_: ['output', {
+            type_: 'insert+p1',
+            option: '1st-level escape'
+          }],
+          nextState: '0'
+        }
+      },
+      '[(...)]': {
+        'r|rt': {
+          action_: 'rd=',
+          nextState: 'rd'
+        },
+        'rd|rdt': {
+          action_: 'rq=',
+          nextState: 'rdq'
+        }
+      },
+      '...': {
+        'o|d|D|dq|qd|qD': {
+          action_: ['output', {
+            type_: 'bond',
+            option: "..."
+          }],
+          nextState: '3'
+        },
+        '*': {
+          action_: [{
+            type_: 'output',
+            option: 1
+          }, {
+            type_: 'insert',
+            option: 'ellipsis'
+          }],
+          nextState: '1'
+        }
+      },
+      '. |* ': {
+        '*': {
+          action_: ['output', {
+            type_: 'insert',
+            option: 'addition compound'
+          }],
+          nextState: '1'
+        }
+      },
+      'state of aggregation $': {
+        '*': {
+          action_: ['output', 'state of aggregation'],
+          nextState: '1'
+        }
+      },
+      '{[(': {
+        'a|as|o': {
+          action_: ['o=', 'output', 'parenthesisLevel++'],
+          nextState: '2'
+        },
+        '0|1|2|3': {
+          action_: ['o=', 'output', 'parenthesisLevel++'],
+          nextState: '2'
+        },
+        '*': {
+          action_: ['output', 'o=', 'output', 'parenthesisLevel++'],
+          nextState: '2'
+        }
+      },
+      ')]}': {
+        '0|1|2|3|b|p|bp|o': {
+          action_: ['o=', 'parenthesisLevel--'],
+          nextState: 'o'
+        },
+        'a|as|d|D|q|qd|qD|dq': {
+          action_: ['output', 'o=', 'parenthesisLevel--'],
+          nextState: 'o'
+        }
+      },
+      ', ': {
+        '*': {
+          action_: ['output', 'comma'],
+          nextState: '0'
+        }
+      },
+      '^_': {
+        // ^ and _ without a sensible argument
+        '*': {}
+      },
+      '^{(...)}|^($...$)': {
+        '0|1|2|as': {
+          action_: 'b=',
+          nextState: 'b'
+        },
+        'p': {
+          action_: 'b=',
+          nextState: 'bp'
+        },
+        '3|o': {
+          action_: 'd= kv',
+          nextState: 'D'
+        },
+        'q': {
+          action_: 'd=',
+          nextState: 'qD'
+        },
+        'd|D|qd|qD|dq': {
+          action_: ['output', 'd='],
+          nextState: 'D'
+        }
+      },
+      '^a|^\\x{}{}|^\\x{}|^\\x|\'': {
+        '0|1|2|as': {
+          action_: 'b=',
+          nextState: 'b'
+        },
+        'p': {
+          action_: 'b=',
+          nextState: 'bp'
+        },
+        '3|o': {
+          action_: 'd= kv',
+          nextState: 'd'
+        },
+        'q': {
+          action_: 'd=',
+          nextState: 'qd'
+        },
+        'd|qd|D|qD': {
+          action_: 'd='
+        },
+        'dq': {
+          action_: ['output', 'd='],
+          nextState: 'd'
+        }
+      },
+      '_{(state of aggregation)}$': {
+        'd|D|q|qd|qD|dq': {
+          action_: ['output', 'q='],
+          nextState: 'q'
+        }
+      },
+      '_{(...)}|_($...$)|_9|_\\x{}{}|_\\x{}|_\\x': {
+        '0|1|2|as': {
+          action_: 'p=',
+          nextState: 'p'
+        },
+        'b': {
+          action_: 'p=',
+          nextState: 'bp'
+        },
+        '3|o': {
+          action_: 'q=',
+          nextState: 'q'
+        },
+        'd|D': {
+          action_: 'q=',
+          nextState: 'dq'
+        },
+        'q|qd|qD|dq': {
+          action_: ['output', 'q='],
+          nextState: 'q'
+        }
+      },
+      '=<>': {
+        '0|1|2|3|a|as|o|q|d|D|qd|qD|dq': {
+          action_: [{
+            type_: 'output',
+            option: 2
+          }, 'bond'],
+          nextState: '3'
+        }
+      },
+      '#': {
+        '0|1|2|3|a|as|o': {
+          action_: [{
+            type_: 'output',
+            option: 2
+          }, {
+            type_: 'bond',
+            option: "#"
+          }],
+          nextState: '3'
+        }
+      },
+      '{}': {
+        '*': {
+          action_: {
+            type_: 'output',
+            option: 1
+          },
+          nextState: '1'
+        }
+      },
+      '{...}': {
+        '0|1|2|3|a|as|b|p|bp': {
+          action_: 'o=',
+          nextState: 'o'
+        },
+        'o|d|D|q|qd|qD|dq': {
+          action_: ['output', 'o='],
+          nextState: 'o'
+        }
+      },
+      '$...$': {
+        'a': {
+          action_: 'a='
+        },
+        // 2$n$
+        '0|1|2|3|as|b|p|bp|o': {
+          action_: 'o=',
+          nextState: 'o'
+        },
+        // not 'amount'
+        'as|o': {
+          action_: 'o='
+        },
+        'q|d|D|qd|qD|dq': {
+          action_: ['output', 'o='],
+          nextState: 'o'
+        }
+      },
+      '\\bond{(...)}': {
+        '*': {
+          action_: [{
+            type_: 'output',
+            option: 2
+          }, 'bond'],
+          nextState: "3"
+        }
+      },
+      '\\frac{(...)}': {
+        '*': {
+          action_: [{
+            type_: 'output',
+            option: 1
+          }, 'frac-output'],
+          nextState: '3'
+        }
+      },
+      '\\overset{(...)}': {
+        '*': {
+          action_: [{
+            type_: 'output',
+            option: 2
+          }, 'overset-output'],
+          nextState: '3'
+        }
+      },
+      "\\underset{(...)}": {
+        '*': {
+          action_: [{
+            type_: 'output',
+            option: 2
+          }, 'underset-output'],
+          nextState: '3'
+        }
+      },
+      "\\underbrace{(...)}": {
+        '*': {
+          action_: [{
+            type_: 'output',
+            option: 2
+          }, 'underbrace-output'],
+          nextState: '3'
+        }
+      },
+      '\\color{(...)}{(...)}1|\\color(...){(...)}2': {
+        '*': {
+          action_: [{
+            type_: 'output',
+            option: 2
+          }, 'color-output'],
+          nextState: '3'
+        }
+      },
+      '\\color{(...)}0': {
+        '*': {
+          action_: [{
+            type_: 'output',
+            option: 2
+          }, 'color0-output']
+        }
+      },
+      '\\ce{(...)}': {
+        '*': {
+          action_: [{
+            type_: 'output',
+            option: 2
+          }, 'ce'],
+          nextState: '3'
+        }
+      },
+      '\\,': {
+        '*': {
+          action_: [{
+            type_: 'output',
+            option: 1
+          }, 'copy'],
+          nextState: '1'
+        }
+      },
+      '\\x{}{}|\\x{}|\\x': {
+        '0|1|2|3|a|as|b|p|bp|o|c0': {
+          action_: ['o=', 'output'],
+          nextState: '3'
+        },
+        '*': {
+          action_: ['output', 'o=', 'output'],
+          nextState: '3'
+        }
+      },
+      'others': {
+        '*': {
+          action_: [{
+            type_: 'output',
+            option: 1
+          }, 'copy'],
+          nextState: '3'
+        }
+      },
+      'else2': {
+        'a': {
+          action_: 'a to o',
+          nextState: 'o',
+          revisit: true
+        },
+        'as': {
+          action_: ['output', 'sb=true'],
+          nextState: '1',
+          revisit: true
+        },
+        'r|rt|rd|rdt|rdq': {
+          action_: ['output'],
+          nextState: '0',
+          revisit: true
+        },
+        '*': {
+          action_: ['output', 'copy'],
+          nextState: '3'
+        }
+      }
+    }),
+    actions: {
+      'o after d': function oAfterD(buffer, m) {
+        var ret;
+
+        if ((buffer.d || "").match(/^[0-9]+$/)) {
+          var tmp = buffer.d;
+          buffer.d = undefined;
+          ret = this['output'](buffer);
+          buffer.b = tmp;
+        } else {
+          ret = this['output'](buffer);
+        }
+
+        mhchemParser.actions['o='](buffer, m);
+        return ret;
+      },
+      'd= kv': function dKv(buffer, m) {
+        buffer.d = m;
+        buffer.dType = 'kv';
+      },
+      'charge or bond': function chargeOrBond(buffer, m) {
+        if (buffer['beginsWithBond']) {
+          /** @type {ParserOutput[]} */
+          var ret = [];
+          mhchemParser.concatArray(ret, this['output'](buffer));
+          mhchemParser.concatArray(ret, mhchemParser.actions['bond'](buffer, m, "-"));
+          return ret;
+        } else {
+          buffer.d = m;
+        }
+      },
+      '- after o/d': function afterOD(buffer, m, isAfterD) {
+        var c1 = mhchemParser.patterns.match_('orbital', buffer.o || "");
+        var c2 = mhchemParser.patterns.match_('one lowercase greek letter $', buffer.o || "");
+        var c3 = mhchemParser.patterns.match_('one lowercase latin letter $', buffer.o || "");
+        var c4 = mhchemParser.patterns.match_('$one lowercase latin letter$ $', buffer.o || "");
+        var hyphenFollows = m === "-" && (c1 && c1.remainder === "" || c2 || c3 || c4);
+
+        if (hyphenFollows && !buffer.a && !buffer.b && !buffer.p && !buffer.d && !buffer.q && !c1 && c3) {
+          buffer.o = '$' + buffer.o + '$';
+        }
+        /** @type {ParserOutput[]} */
+
+
+        var ret = [];
+
+        if (hyphenFollows) {
+          mhchemParser.concatArray(ret, this['output'](buffer));
+          ret.push({
+            type_: 'hyphen'
+          });
+        } else {
+          c1 = mhchemParser.patterns.match_('digits', buffer.d || "");
+
+          if (isAfterD && c1 && c1.remainder === '') {
+            mhchemParser.concatArray(ret, mhchemParser.actions['d='](buffer, m));
+            mhchemParser.concatArray(ret, this['output'](buffer));
+          } else {
+            mhchemParser.concatArray(ret, this['output'](buffer));
+            mhchemParser.concatArray(ret, mhchemParser.actions['bond'](buffer, m, "-"));
+          }
+        }
+
+        return ret;
+      },
+      'a to o': function aToO(buffer) {
+        buffer.o = buffer.a;
+        buffer.a = undefined;
+      },
+      'sb=true': function sbTrue(buffer) {
+        buffer.sb = true;
+      },
+      'sb=false': function sbFalse(buffer) {
+        buffer.sb = false;
+      },
+      'beginsWithBond=true': function beginsWithBondTrue(buffer) {
+        buffer['beginsWithBond'] = true;
+      },
+      'beginsWithBond=false': function beginsWithBondFalse(buffer) {
+        buffer['beginsWithBond'] = false;
+      },
+      'parenthesisLevel++': function parenthesisLevel(buffer) {
+        buffer['parenthesisLevel']++;
+      },
+      'parenthesisLevel--': function parenthesisLevel(buffer) {
+        buffer['parenthesisLevel']--;
+      },
+      'state of aggregation': function stateOfAggregation(buffer, m) {
+        return {
+          type_: 'state of aggregation',
+          p1: mhchemParser.go(m, 'o')
+        };
+      },
+      'comma': function comma(buffer, m) {
+        var a = m.replace(/\s*$/, '');
+        var withSpace = a !== m;
+
+        if (withSpace && buffer['parenthesisLevel'] === 0) {
+          return {
+            type_: 'comma enumeration L',
+            p1: a
+          };
+        } else {
+          return {
+            type_: 'comma enumeration M',
+            p1: a
+          };
+        }
+      },
+      'output': function output(buffer, m, entityFollows) {
+        // entityFollows:
+        //   undefined = if we have nothing else to output, also ignore the just read space (buffer.sb)
+        //   1 = an entity follows, never omit the space if there was one just read before (can only apply to state 1)
+        //   2 = 1 + the entity can have an amount, so output a\, instead of converting it to o (can only apply to states a|as)
+
+        /** @type {ParserOutput | ParserOutput[]} */
+        var ret;
+
+        if (!buffer.r) {
+          ret = [];
+
+          if (!buffer.a && !buffer.b && !buffer.p && !buffer.o && !buffer.q && !buffer.d && !entityFollows) {//ret = [];
+          } else {
+            if (buffer.sb) {
+              ret.push({
+                type_: 'entitySkip'
+              });
+            }
+
+            if (!buffer.o && !buffer.q && !buffer.d && !buffer.b && !buffer.p && entityFollows !== 2) {
+              buffer.o = buffer.a;
+              buffer.a = undefined;
+            } else if (!buffer.o && !buffer.q && !buffer.d && (buffer.b || buffer.p)) {
+              buffer.o = buffer.a;
+              buffer.d = buffer.b;
+              buffer.q = buffer.p;
+              buffer.a = buffer.b = buffer.p = undefined;
+            } else {
+              if (buffer.o && buffer.dType === 'kv' && mhchemParser.patterns.match_('d-oxidation$', buffer.d || "")) {
+                buffer.dType = 'oxidation';
+              } else if (buffer.o && buffer.dType === 'kv' && !buffer.q) {
+                buffer.dType = undefined;
+              }
+            }
+
+            ret.push({
+              type_: 'chemfive',
+              a: mhchemParser.go(buffer.a, 'a'),
+              b: mhchemParser.go(buffer.b, 'bd'),
+              p: mhchemParser.go(buffer.p, 'pq'),
+              o: mhchemParser.go(buffer.o, 'o'),
+              q: mhchemParser.go(buffer.q, 'pq'),
+              d: mhchemParser.go(buffer.d, buffer.dType === 'oxidation' ? 'oxidation' : 'bd'),
+              dType: buffer.dType
+            });
+          }
+        } else {
+          // r
+
+          /** @type {ParserOutput[]} */
+          var rd;
+
+          if (buffer.rdt === 'M') {
+            rd = mhchemParser.go(buffer.rd, 'tex-math');
+          } else if (buffer.rdt === 'T') {
+            rd = [{
+              type_: 'text',
+              p1: buffer.rd || ""
+            }];
+          } else {
+            rd = mhchemParser.go(buffer.rd);
+          }
+          /** @type {ParserOutput[]} */
+
+
+          var rq;
+
+          if (buffer.rqt === 'M') {
+            rq = mhchemParser.go(buffer.rq, 'tex-math');
+          } else if (buffer.rqt === 'T') {
+            rq = [{
+              type_: 'text',
+              p1: buffer.rq || ""
+            }];
+          } else {
+            rq = mhchemParser.go(buffer.rq);
+          }
+
+          ret = {
+            type_: 'arrow',
+            r: buffer.r,
+            rd: rd,
+            rq: rq
+          };
+        }
+
+        for (var p in buffer) {
+          if (p !== 'parenthesisLevel' && p !== 'beginsWithBond') {
+            delete buffer[p];
+          }
+        }
+
+        return ret;
+      },
+      'oxidation-output': function oxidationOutput(buffer, m) {
+        var ret = ["{"];
+        mhchemParser.concatArray(ret, mhchemParser.go(m, 'oxidation'));
+        ret.push("}");
+        return ret;
+      },
+      'frac-output': function fracOutput(buffer, m) {
+        return {
+          type_: 'frac-ce',
+          p1: mhchemParser.go(m[0]),
+          p2: mhchemParser.go(m[1])
+        };
+      },
+      'overset-output': function oversetOutput(buffer, m) {
+        return {
+          type_: 'overset',
+          p1: mhchemParser.go(m[0]),
+          p2: mhchemParser.go(m[1])
+        };
+      },
+      'underset-output': function undersetOutput(buffer, m) {
+        return {
+          type_: 'underset',
+          p1: mhchemParser.go(m[0]),
+          p2: mhchemParser.go(m[1])
+        };
+      },
+      'underbrace-output': function underbraceOutput(buffer, m) {
+        return {
+          type_: 'underbrace',
+          p1: mhchemParser.go(m[0]),
+          p2: mhchemParser.go(m[1])
+        };
+      },
+      'color-output': function colorOutput(buffer, m) {
+        return {
+          type_: 'color',
+          color1: m[0],
+          color2: mhchemParser.go(m[1])
+        };
+      },
+      'r=': function r(buffer, m) {
+        buffer.r = m;
+      },
+      'rdt=': function rdt(buffer, m) {
+        buffer.rdt = m;
+      },
+      'rd=': function rd(buffer, m) {
+        buffer.rd = m;
+      },
+      'rqt=': function rqt(buffer, m) {
+        buffer.rqt = m;
+      },
+      'rq=': function rq(buffer, m) {
+        buffer.rq = m;
+      },
+      'operator': function operator(buffer, m, p1) {
+        return {
+          type_: 'operator',
+          kind_: p1 || m
+        };
+      }
+    }
+  },
+  'a': {
+    transitions: mhchemParser.createTransitions({
+      'empty': {
+        '*': {}
+      },
+      '1/2$': {
+        '0': {
+          action_: '1/2'
+        }
+      },
+      'else': {
+        '0': {
+          nextState: '1',
+          revisit: true
+        }
+      },
+      '$(...)$': {
+        '*': {
+          action_: 'tex-math tight',
+          nextState: '1'
+        }
+      },
+      ',': {
+        '*': {
+          action_: {
+            type_: 'insert',
+            option: 'commaDecimal'
+          }
+        }
+      },
+      'else2': {
+        '*': {
+          action_: 'copy'
+        }
+      }
+    }),
+    actions: {}
+  },
+  'o': {
+    transitions: mhchemParser.createTransitions({
+      'empty': {
+        '*': {}
+      },
+      '1/2$': {
+        '0': {
+          action_: '1/2'
+        }
+      },
+      'else': {
+        '0': {
+          nextState: '1',
+          revisit: true
+        }
+      },
+      'letters': {
+        '*': {
+          action_: 'rm'
+        }
+      },
+      '\\ca': {
+        '*': {
+          action_: {
+            type_: 'insert',
+            option: 'circa'
+          }
+        }
+      },
+      '\\x{}{}|\\x{}|\\x': {
+        '*': {
+          action_: 'copy'
+        }
+      },
+      '${(...)}$|$(...)$': {
+        '*': {
+          action_: 'tex-math'
+        }
+      },
+      '{(...)}': {
+        '*': {
+          action_: '{text}'
+        }
+      },
+      'else2': {
+        '*': {
+          action_: 'copy'
+        }
+      }
+    }),
+    actions: {}
+  },
+  'text': {
+    transitions: mhchemParser.createTransitions({
+      'empty': {
+        '*': {
+          action_: 'output'
+        }
+      },
+      '{...}': {
+        '*': {
+          action_: 'text='
+        }
+      },
+      '${(...)}$|$(...)$': {
+        '*': {
+          action_: 'tex-math'
+        }
+      },
+      '\\greek': {
+        '*': {
+          action_: ['output', 'rm']
+        }
+      },
+      '\\,|\\x{}{}|\\x{}|\\x': {
+        '*': {
+          action_: ['output', 'copy']
+        }
+      },
+      'else': {
+        '*': {
+          action_: 'text='
+        }
+      }
+    }),
+    actions: {
+      'output': function output(buffer) {
+        if (buffer.text_) {
+          /** @type {ParserOutput} */
+          var ret = {
+            type_: 'text',
+            p1: buffer.text_
+          };
+
+          for (var p in buffer) {
+            delete buffer[p];
+          }
+
+          return ret;
+        }
+      }
+    }
+  },
+  'pq': {
+    transitions: mhchemParser.createTransitions({
+      'empty': {
+        '*': {}
+      },
+      'state of aggregation $': {
+        '*': {
+          action_: 'state of aggregation'
+        }
+      },
+      'i$': {
+        '0': {
+          nextState: '!f',
+          revisit: true
+        }
+      },
+      '(KV letters),': {
+        '0': {
+          action_: 'rm',
+          nextState: '0'
+        }
+      },
+      'formula$': {
+        '0': {
+          nextState: 'f',
+          revisit: true
+        }
+      },
+      '1/2$': {
+        '0': {
+          action_: '1/2'
+        }
+      },
+      'else': {
+        '0': {
+          nextState: '!f',
+          revisit: true
+        }
+      },
+      '${(...)}$|$(...)$': {
+        '*': {
+          action_: 'tex-math'
+        }
+      },
+      '{(...)}': {
+        '*': {
+          action_: 'text'
+        }
+      },
+      'a-z': {
+        'f': {
+          action_: 'tex-math'
+        }
+      },
+      'letters': {
+        '*': {
+          action_: 'rm'
+        }
+      },
+      '-9.,9': {
+        '*': {
+          action_: '9,9'
+        }
+      },
+      ',': {
+        '*': {
+          action_: {
+            type_: 'insert+p1',
+            option: 'comma enumeration S'
+          }
+        }
+      },
+      '\\color{(...)}{(...)}1|\\color(...){(...)}2': {
+        '*': {
+          action_: 'color-output'
+        }
+      },
+      '\\color{(...)}0': {
+        '*': {
+          action_: 'color0-output'
+        }
+      },
+      '\\ce{(...)}': {
+        '*': {
+          action_: 'ce'
+        }
+      },
+      '\\,|\\x{}{}|\\x{}|\\x': {
+        '*': {
+          action_: 'copy'
+        }
+      },
+      'else2': {
+        '*': {
+          action_: 'copy'
+        }
+      }
+    }),
+    actions: {
+      'state of aggregation': function stateOfAggregation(buffer, m) {
+        return {
+          type_: 'state of aggregation subscript',
+          p1: mhchemParser.go(m, 'o')
+        };
+      },
+      'color-output': function colorOutput(buffer, m) {
+        return {
+          type_: 'color',
+          color1: m[0],
+          color2: mhchemParser.go(m[1], 'pq')
+        };
+      }
+    }
+  },
+  'bd': {
+    transitions: mhchemParser.createTransitions({
+      'empty': {
+        '*': {}
+      },
+      'x$': {
+        '0': {
+          nextState: '!f',
+          revisit: true
+        }
+      },
+      'formula$': {
+        '0': {
+          nextState: 'f',
+          revisit: true
+        }
+      },
+      'else': {
+        '0': {
+          nextState: '!f',
+          revisit: true
+        }
+      },
+      '-9.,9 no missing 0': {
+        '*': {
+          action_: '9,9'
+        }
+      },
+      '.': {
+        '*': {
+          action_: {
+            type_: 'insert',
+            option: 'electron dot'
+          }
+        }
+      },
+      'a-z': {
+        'f': {
+          action_: 'tex-math'
+        }
+      },
+      'x': {
+        '*': {
+          action_: {
+            type_: 'insert',
+            option: 'KV x'
+          }
+        }
+      },
+      'letters': {
+        '*': {
+          action_: 'rm'
+        }
+      },
+      '\'': {
+        '*': {
+          action_: {
+            type_: 'insert',
+            option: 'prime'
+          }
+        }
+      },
+      '${(...)}$|$(...)$': {
+        '*': {
+          action_: 'tex-math'
+        }
+      },
+      '{(...)}': {
+        '*': {
+          action_: 'text'
+        }
+      },
+      '\\color{(...)}{(...)}1|\\color(...){(...)}2': {
+        '*': {
+          action_: 'color-output'
+        }
+      },
+      '\\color{(...)}0': {
+        '*': {
+          action_: 'color0-output'
+        }
+      },
+      '\\ce{(...)}': {
+        '*': {
+          action_: 'ce'
+        }
+      },
+      '\\,|\\x{}{}|\\x{}|\\x': {
+        '*': {
+          action_: 'copy'
+        }
+      },
+      'else2': {
+        '*': {
+          action_: 'copy'
+        }
+      }
+    }),
+    actions: {
+      'color-output': function colorOutput(buffer, m) {
+        return {
+          type_: 'color',
+          color1: m[0],
+          color2: mhchemParser.go(m[1], 'bd')
+        };
+      }
+    }
+  },
+  'oxidation': {
+    transitions: mhchemParser.createTransitions({
+      'empty': {
+        '*': {}
+      },
+      'roman numeral': {
+        '*': {
+          action_: 'roman-numeral'
+        }
+      },
+      '${(...)}$|$(...)$': {
+        '*': {
+          action_: 'tex-math'
+        }
+      },
+      'else': {
+        '*': {
+          action_: 'copy'
+        }
+      }
+    }),
+    actions: {
+      'roman-numeral': function romanNumeral(buffer, m) {
+        return {
+          type_: 'roman numeral',
+          p1: m || ""
+        };
+      }
+    }
+  },
+  'tex-math': {
+    transitions: mhchemParser.createTransitions({
+      'empty': {
+        '*': {
+          action_: 'output'
+        }
+      },
+      '\\ce{(...)}': {
+        '*': {
+          action_: ['output', 'ce']
+        }
+      },
+      '{...}|\\,|\\x{}{}|\\x{}|\\x': {
+        '*': {
+          action_: 'o='
+        }
+      },
+      'else': {
+        '*': {
+          action_: 'o='
+        }
+      }
+    }),
+    actions: {
+      'output': function output(buffer) {
+        if (buffer.o) {
+          /** @type {ParserOutput} */
+          var ret = {
+            type_: 'tex-math',
+            p1: buffer.o
+          };
+
+          for (var p in buffer) {
+            delete buffer[p];
+          }
+
+          return ret;
+        }
+      }
+    }
+  },
+  'tex-math tight': {
+    transitions: mhchemParser.createTransitions({
+      'empty': {
+        '*': {
+          action_: 'output'
+        }
+      },
+      '\\ce{(...)}': {
+        '*': {
+          action_: ['output', 'ce']
+        }
+      },
+      '{...}|\\,|\\x{}{}|\\x{}|\\x': {
+        '*': {
+          action_: 'o='
+        }
+      },
+      '-|+': {
+        '*': {
+          action_: 'tight operator'
+        }
+      },
+      'else': {
+        '*': {
+          action_: 'o='
+        }
+      }
+    }),
+    actions: {
+      'tight operator': function tightOperator(buffer, m) {
+        buffer.o = (buffer.o || "") + "{" + m + "}";
+      },
+      'output': function output(buffer) {
+        if (buffer.o) {
+          /** @type {ParserOutput} */
+          var ret = {
+            type_: 'tex-math',
+            p1: buffer.o
+          };
+
+          for (var p in buffer) {
+            delete buffer[p];
+          }
+
+          return ret;
+        }
+      }
+    }
+  },
+  '9,9': {
+    transitions: mhchemParser.createTransitions({
+      'empty': {
+        '*': {}
+      },
+      ',': {
+        '*': {
+          action_: 'comma'
+        }
+      },
+      'else': {
+        '*': {
+          action_: 'copy'
+        }
+      }
+    }),
+    actions: {
+      'comma': function comma() {
+        return {
+          type_: 'commaDecimal'
+        };
+      }
+    }
+  },
+  //#endregion
+  //
+  // \pu state machines
+  //
+  //#region pu
+  'pu': {
+    transitions: mhchemParser.createTransitions({
+      'empty': {
+        '*': {
+          action_: 'output'
+        }
+      },
+      'space$': {
+        '*': {
+          action_: ['output', 'space']
+        }
+      },
+      '{[(|)]}': {
+        '0|a': {
+          action_: 'copy'
+        }
+      },
+      '(-)(9)^(-9)': {
+        '0': {
+          action_: 'number^',
+          nextState: 'a'
+        }
+      },
+      '(-)(9.,9)(e)(99)': {
+        '0': {
+          action_: 'enumber',
+          nextState: 'a'
+        }
+      },
+      'space': {
+        '0|a': {}
+      },
+      'pm-operator': {
+        '0|a': {
+          action_: {
+            type_: 'operator',
+            option: '\\pm'
+          },
+          nextState: '0'
+        }
+      },
+      'operator': {
+        '0|a': {
+          action_: 'copy',
+          nextState: '0'
+        }
+      },
+      '//': {
+        'd': {
+          action_: 'o=',
+          nextState: '/'
+        }
+      },
+      '/': {
+        'd': {
+          action_: 'o=',
+          nextState: '/'
+        }
+      },
+      '{...}|else': {
+        '0|d': {
+          action_: 'd=',
+          nextState: 'd'
+        },
+        'a': {
+          action_: ['space', 'd='],
+          nextState: 'd'
+        },
+        '/|q': {
+          action_: 'q=',
+          nextState: 'q'
+        }
+      }
+    }),
+    actions: {
+      'enumber': function enumber(buffer, m) {
+        /** @type {ParserOutput[]} */
+        var ret = [];
+
+        if (m[0] === "+-" || m[0] === "+/-") {
+          ret.push("\\pm ");
+        } else if (m[0]) {
+          ret.push(m[0]);
+        }
+
+        if (m[1]) {
+          mhchemParser.concatArray(ret, mhchemParser.go(m[1], 'pu-9,9'));
+
+          if (m[2]) {
+            if (m[2].match(/[,.]/)) {
+              mhchemParser.concatArray(ret, mhchemParser.go(m[2], 'pu-9,9'));
+            } else {
+              ret.push(m[2]);
+            }
+          }
+
+          m[3] = m[4] || m[3];
+
+          if (m[3]) {
+            m[3] = m[3].trim();
+
+            if (m[3] === "e" || m[3].substr(0, 1) === "*") {
+              ret.push({
+                type_: 'cdot'
+              });
+            } else {
+              ret.push({
+                type_: 'times'
+              });
+            }
+          }
+        }
+
+        if (m[3]) {
+          ret.push("10^{" + m[5] + "}");
+        }
+
+        return ret;
+      },
+      'number^': function number(buffer, m) {
+        /** @type {ParserOutput[]} */
+        var ret = [];
+
+        if (m[0] === "+-" || m[0] === "+/-") {
+          ret.push("\\pm ");
+        } else if (m[0]) {
+          ret.push(m[0]);
+        }
+
+        mhchemParser.concatArray(ret, mhchemParser.go(m[1], 'pu-9,9'));
+        ret.push("^{" + m[2] + "}");
+        return ret;
+      },
+      'operator': function operator(buffer, m, p1) {
+        return {
+          type_: 'operator',
+          kind_: p1 || m
+        };
+      },
+      'space': function space() {
+        return {
+          type_: 'pu-space-1'
+        };
+      },
+      'output': function output(buffer) {
+        /** @type {ParserOutput | ParserOutput[]} */
+        var ret;
+        var md = mhchemParser.patterns.match_('{(...)}', buffer.d || "");
+
+        if (md && md.remainder === '') {
+          buffer.d = md.match_;
+        }
+
+        var mq = mhchemParser.patterns.match_('{(...)}', buffer.q || "");
+
+        if (mq && mq.remainder === '') {
+          buffer.q = mq.match_;
+        }
+
+        if (buffer.d) {
+          buffer.d = buffer.d.replace(/\u00B0C|\^oC|\^{o}C/g, "{}^{\\circ}C");
+          buffer.d = buffer.d.replace(/\u00B0F|\^oF|\^{o}F/g, "{}^{\\circ}F");
+        }
+
+        if (buffer.q) {
+          // fraction
+          buffer.q = buffer.q.replace(/\u00B0C|\^oC|\^{o}C/g, "{}^{\\circ}C");
+          buffer.q = buffer.q.replace(/\u00B0F|\^oF|\^{o}F/g, "{}^{\\circ}F");
+          var b5 = {
+            d: mhchemParser.go(buffer.d, 'pu'),
+            q: mhchemParser.go(buffer.q, 'pu')
+          };
+
+          if (buffer.o === '//') {
+            ret = {
+              type_: 'pu-frac',
+              p1: b5.d,
+              p2: b5.q
+            };
+          } else {
+            ret = b5.d;
+
+            if (b5.d.length > 1 || b5.q.length > 1) {
+              ret.push({
+                type_: ' / '
+              });
+            } else {
+              ret.push({
+                type_: '/'
+              });
+            }
+
+            mhchemParser.concatArray(ret, b5.q);
+          }
+        } else {
+          // no fraction
+          ret = mhchemParser.go(buffer.d, 'pu-2');
+        }
+
+        for (var p in buffer) {
+          delete buffer[p];
+        }
+
+        return ret;
+      }
+    }
+  },
+  'pu-2': {
+    transitions: mhchemParser.createTransitions({
+      'empty': {
+        '*': {
+          action_: 'output'
+        }
+      },
+      '*': {
+        '*': {
+          action_: ['output', 'cdot'],
+          nextState: '0'
+        }
+      },
+      '\\x': {
+        '*': {
+          action_: 'rm='
+        }
+      },
+      'space': {
+        '*': {
+          action_: ['output', 'space'],
+          nextState: '0'
+        }
+      },
+      '^{(...)}|^(-1)': {
+        '1': {
+          action_: '^(-1)'
+        }
+      },
+      '-9.,9': {
+        '0': {
+          action_: 'rm=',
+          nextState: '0'
+        },
+        '1': {
+          action_: '^(-1)',
+          nextState: '0'
+        }
+      },
+      '{...}|else': {
+        '*': {
+          action_: 'rm=',
+          nextState: '1'
+        }
+      }
+    }),
+    actions: {
+      'cdot': function cdot() {
+        return {
+          type_: 'tight cdot'
+        };
+      },
+      '^(-1)': function _(buffer, m) {
+        buffer.rm += "^{" + m + "}";
+      },
+      'space': function space() {
+        return {
+          type_: 'pu-space-2'
+        };
+      },
+      'output': function output(buffer) {
+        /** @type {ParserOutput | ParserOutput[]} */
+        var ret = [];
+
+        if (buffer.rm) {
+          var mrm = mhchemParser.patterns.match_('{(...)}', buffer.rm || "");
+
+          if (mrm && mrm.remainder === '') {
+            ret = mhchemParser.go(mrm.match_, 'pu');
+          } else {
+            ret = {
+              type_: 'rm',
+              p1: buffer.rm
+            };
+          }
+        }
+
+        for (var p in buffer) {
+          delete buffer[p];
+        }
+
+        return ret;
+      }
+    }
+  },
+  'pu-9,9': {
+    transitions: mhchemParser.createTransitions({
+      'empty': {
+        '0': {
+          action_: 'output-0'
+        },
+        'o': {
+          action_: 'output-o'
+        }
+      },
+      ',': {
+        '0': {
+          action_: ['output-0', 'comma'],
+          nextState: 'o'
+        }
+      },
+      '.': {
+        '0': {
+          action_: ['output-0', 'copy'],
+          nextState: 'o'
+        }
+      },
+      'else': {
+        '*': {
+          action_: 'text='
+        }
+      }
+    }),
+    actions: {
+      'comma': function comma() {
+        return {
+          type_: 'commaDecimal'
+        };
+      },
+      'output-0': function output0(buffer) {
+        /** @type {ParserOutput[]} */
+        var ret = [];
+        buffer.text_ = buffer.text_ || "";
+
+        if (buffer.text_.length > 4) {
+          var a = buffer.text_.length % 3;
+
+          if (a === 0) {
+            a = 3;
+          }
+
+          for (var i = buffer.text_.length - 3; i > 0; i -= 3) {
+            ret.push(buffer.text_.substr(i, 3));
+            ret.push({
+              type_: '1000 separator'
+            });
+          }
+
+          ret.push(buffer.text_.substr(0, a));
+          ret.reverse();
+        } else {
+          ret.push(buffer.text_);
+        }
+
+        for (var p in buffer) {
+          delete buffer[p];
+        }
+
+        return ret;
+      },
+      'output-o': function outputO(buffer) {
+        /** @type {ParserOutput[]} */
+        var ret = [];
+        buffer.text_ = buffer.text_ || "";
+
+        if (buffer.text_.length > 4) {
+          var a = buffer.text_.length - 3;
+
+          for (var i = 0; i < a; i += 3) {
+            ret.push(buffer.text_.substr(i, 3));
+            ret.push({
+              type_: '1000 separator'
+            });
+          }
+
+          ret.push(buffer.text_.substr(i));
+        } else {
+          ret.push(buffer.text_);
+        }
+
+        for (var p in buffer) {
+          delete buffer[p];
+        }
+
+        return ret;
+      }
+    }
+  } //#endregion
+
+}; //
+// texify: Take MhchemParser output and convert it to TeX
+//
+
+/** @type {Texify} */
+
+var texify = {
+  go: function go(input, isInner) {
+    // (recursive, max 4 levels)
+    if (!input) {
+      return "";
+    }
+
+    var res = "";
+    var cee = false;
+
+    for (var i = 0; i < input.length; i++) {
+      var inputi = input[i];
+
+      if (typeof inputi === "string") {
+        res += inputi;
+      } else {
+        res += texify._go2(inputi);
+
+        if (inputi.type_ === '1st-level escape') {
+          cee = true;
+        }
+      }
+    }
+
+    if (!isInner && !cee && res) {
+      res = "{" + res + "}";
+    }
+
+    return res;
+  },
+  _goInner: function _goInner(input) {
+    if (!input) {
+      return input;
+    }
+
+    return texify.go(input, true);
+  },
+  _go2: function _go2(buf) {
+    /** @type {undefined | string} */
+    var res;
+
+    switch (buf.type_) {
+      case 'chemfive':
+        res = "";
+        var b5 = {
+          a: texify._goInner(buf.a),
+          b: texify._goInner(buf.b),
+          p: texify._goInner(buf.p),
+          o: texify._goInner(buf.o),
+          q: texify._goInner(buf.q),
+          d: texify._goInner(buf.d)
+        }; //
+        // a
+        //
+
+        if (b5.a) {
+          if (b5.a.match(/^[+\-]/)) {
+            b5.a = "{" + b5.a + "}";
+          }
+
+          res += b5.a + "\\,";
+        } //
+        // b and p
+        //
+
+
+        if (b5.b || b5.p) {
+          res += "{\\vphantom{X}}";
+          res += "^{\\hphantom{" + (b5.b || "") + "}}_{\\hphantom{" + (b5.p || "") + "}}";
+          res += "{\\vphantom{X}}";
+          res += "^{\\smash[t]{\\vphantom{2}}\\mathllap{" + (b5.b || "") + "}}";
+          res += "_{\\vphantom{2}\\mathllap{\\smash[t]{" + (b5.p || "") + "}}}";
+        } //
+        // o
+        //
+
+
+        if (b5.o) {
+          if (b5.o.match(/^[+\-]/)) {
+            b5.o = "{" + b5.o + "}";
+          }
+
+          res += b5.o;
+        } //
+        // q and d
+        //
+
+
+        if (buf.dType === 'kv') {
+          if (b5.d || b5.q) {
+            res += "{\\vphantom{X}}";
+          }
+
+          if (b5.d) {
+            res += "^{" + b5.d + "}";
+          }
+
+          if (b5.q) {
+            res += "_{\\smash[t]{" + b5.q + "}}";
+          }
+        } else if (buf.dType === 'oxidation') {
+          if (b5.d) {
+            res += "{\\vphantom{X}}";
+            res += "^{" + b5.d + "}";
+          }
+
+          if (b5.q) {
+            res += "{\\vphantom{X}}";
+            res += "_{\\smash[t]{" + b5.q + "}}";
+          }
+        } else {
+          if (b5.q) {
+            res += "{\\vphantom{X}}";
+            res += "_{\\smash[t]{" + b5.q + "}}";
+          }
+
+          if (b5.d) {
+            res += "{\\vphantom{X}}";
+            res += "^{" + b5.d + "}";
+          }
+        }
+
+        break;
+
+      case 'rm':
+        res = "\\mathrm{" + buf.p1 + "}";
+        break;
+
+      case 'text':
+        if (buf.p1.match(/[\^_]/)) {
+          buf.p1 = buf.p1.replace(" ", "~").replace("-", "\\text{-}");
+          res = "\\mathrm{" + buf.p1 + "}";
+        } else {
+          res = "\\text{" + buf.p1 + "}";
+        }
+
+        break;
+
+      case 'roman numeral':
+        res = "\\mathrm{" + buf.p1 + "}";
+        break;
+
+      case 'state of aggregation':
+        res = "\\mskip2mu " + texify._goInner(buf.p1);
+        break;
+
+      case 'state of aggregation subscript':
+        res = "\\mskip1mu " + texify._goInner(buf.p1);
+        break;
+
+      case 'bond':
+        res = texify._getBond(buf.kind_);
+
+        if (!res) {
+          throw ["MhchemErrorBond", "mhchem Error. Unknown bond type (" + buf.kind_ + ")"];
+        }
+
+        break;
+
+      case 'frac':
+        var c = "\\frac{" + buf.p1 + "}{" + buf.p2 + "}";
+        res = "\\mathchoice{\\textstyle" + c + "}{" + c + "}{" + c + "}{" + c + "}";
+        break;
+
+      case 'pu-frac':
+        var d = "\\frac{" + texify._goInner(buf.p1) + "}{" + texify._goInner(buf.p2) + "}";
+        res = "\\mathchoice{\\textstyle" + d + "}{" + d + "}{" + d + "}{" + d + "}";
+        break;
+
+      case 'tex-math':
+        res = buf.p1 + " ";
+        break;
+
+      case 'frac-ce':
+        res = "\\frac{" + texify._goInner(buf.p1) + "}{" + texify._goInner(buf.p2) + "}";
+        break;
+
+      case 'overset':
+        res = "\\overset{" + texify._goInner(buf.p1) + "}{" + texify._goInner(buf.p2) + "}";
+        break;
+
+      case 'underset':
+        res = "\\underset{" + texify._goInner(buf.p1) + "}{" + texify._goInner(buf.p2) + "}";
+        break;
+
+      case 'underbrace':
+        res = "\\underbrace{" + texify._goInner(buf.p1) + "}_{" + texify._goInner(buf.p2) + "}";
+        break;
+
+      case 'color':
+        res = "{\\color{" + buf.color1 + "}{" + texify._goInner(buf.color2) + "}}";
+        break;
+
+      case 'color0':
+        res = "\\color{" + buf.color + "}";
+        break;
+
+      case 'arrow':
+        var b6 = {
+          rd: texify._goInner(buf.rd),
+          rq: texify._goInner(buf.rq)
+        };
+
+        var arrow = "\\x" + texify._getArrow(buf.r);
+
+        if (b6.rq) {
+          arrow += "[{" + b6.rq + "}]";
+        }
+
+        if (b6.rd) {
+          arrow += "{" + b6.rd + "}";
+        } else {
+          arrow += "{}";
+        }
+
+        res = arrow;
+        break;
+
+      case 'operator':
+        res = texify._getOperator(buf.kind_);
+        break;
+
+      case '1st-level escape':
+        res = buf.p1 + " "; // &, \\\\, \\hlin
+
+        break;
+
+      case 'space':
+        res = " ";
+        break;
+
+      case 'entitySkip':
+        res = "~";
+        break;
+
+      case 'pu-space-1':
+        res = "~";
+        break;
+
+      case 'pu-space-2':
+        res = "\\mkern3mu ";
+        break;
+
+      case '1000 separator':
+        res = "\\mkern2mu ";
+        break;
+
+      case 'commaDecimal':
+        res = "{,}";
+        break;
+
+      case 'comma enumeration L':
+        res = "{" + buf.p1 + "}\\mkern6mu ";
+        break;
+
+      case 'comma enumeration M':
+        res = "{" + buf.p1 + "}\\mkern3mu ";
+        break;
+
+      case 'comma enumeration S':
+        res = "{" + buf.p1 + "}\\mkern1mu ";
+        break;
+
+      case 'hyphen':
+        res = "\\text{-}";
+        break;
+
+      case 'addition compound':
+        res = "\\,{\\cdot}\\,";
+        break;
+
+      case 'electron dot':
+        res = "\\mkern1mu \\bullet\\mkern1mu ";
+        break;
+
+      case 'KV x':
+        res = "{\\times}";
+        break;
+
+      case 'prime':
+        res = "\\prime ";
+        break;
+
+      case 'cdot':
+        res = "\\cdot ";
+        break;
+
+      case 'tight cdot':
+        res = "\\mkern1mu{\\cdot}\\mkern1mu ";
+        break;
+
+      case 'times':
+        res = "\\times ";
+        break;
+
+      case 'circa':
+        res = "{\\sim}";
+        break;
+
+      case '^':
+        res = "uparrow";
+        break;
+
+      case 'v':
+        res = "downarrow";
+        break;
+
+      case 'ellipsis':
+        res = "\\ldots ";
+        break;
+
+      case '/':
+        res = "/";
+        break;
+
+      case ' / ':
+        res = "\\,/\\,";
+        break;
+
+      default:
+        assertNever(buf);
+        throw ["MhchemBugT", "mhchem bug T. Please report."];
+      // Missing texify rule or unknown MhchemParser output
+    }
+
+    assertString(res);
+    return res;
+  },
+  _getArrow: function _getArrow(a) {
+    switch (a) {
+      case "->":
+        return "rightarrow";
+
+      case "\u2192":
+        return "rightarrow";
+
+      case "\u27F6":
+        return "rightarrow";
+
+      case "<-":
+        return "leftarrow";
+
+      case "<->":
+        return "leftrightarrow";
+
+      case "<-->":
+        return "rightleftarrows";
+
+      case "<=>":
+        return "rightleftharpoons";
+
+      case "\u21CC":
+        return "rightleftharpoons";
+
+      case "<=>>":
+        return "rightequilibrium";
+
+      case "<<=>":
+        return "leftequilibrium";
+
+      default:
+        assertNever(a);
+        throw ["MhchemBugT", "mhchem bug T. Please report."];
+    }
+  },
+  _getBond: function _getBond(a) {
+    switch (a) {
+      case "-":
+        return "{-}";
+
+      case "1":
+        return "{-}";
+
+      case "=":
+        return "{=}";
+
+      case "2":
+        return "{=}";
+
+      case "#":
+        return "{\\equiv}";
+
+      case "3":
+        return "{\\equiv}";
+
+      case "~":
+        return "{\\tripledash}";
+
+      case "~-":
+        return "{\\mathrlap{\\raisebox{-.1em}{$-$}}\\raisebox{.1em}{$\\tripledash$}}";
+
+      case "~=":
+        return "{\\mathrlap{\\raisebox{-.2em}{$-$}}\\mathrlap{\\raisebox{.2em}{$\\tripledash$}}-}";
+
+      case "~--":
+        return "{\\mathrlap{\\raisebox{-.2em}{$-$}}\\mathrlap{\\raisebox{.2em}{$\\tripledash$}}-}";
+
+      case "-~-":
+        return "{\\mathrlap{\\raisebox{-.2em}{$-$}}\\mathrlap{\\raisebox{.2em}{$-$}}\\tripledash}";
+
+      case "...":
+        return "{{\\cdot}{\\cdot}{\\cdot}}";
+
+      case "....":
+        return "{{\\cdot}{\\cdot}{\\cdot}{\\cdot}}";
+
+      case "->":
+        return "{\\rightarrow}";
+
+      case "<-":
+        return "{\\leftarrow}";
+
+      case "<":
+        return "{<}";
+
+      case ">":
+        return "{>}";
+
+      default:
+        assertNever(a);
+        throw ["MhchemBugT", "mhchem bug T. Please report."];
+    }
+  },
+  _getOperator: function _getOperator(a) {
+    switch (a) {
+      case "+":
+        return " {}+{} ";
+
+      case "-":
+        return " {}-{} ";
+
+      case "=":
+        return " {}={} ";
+
+      case "<":
+        return " {}<{} ";
+
+      case ">":
+        return " {}>{} ";
+
+      case "<<":
+        return " {}\\ll{} ";
+
+      case ">>":
+        return " {}\\gg{} ";
+
+      case "\\pm":
+        return " {}\\pm{} ";
+
+      case "\\approx":
+        return " {}\\approx{} ";
+
+      case "$\\approx$":
+        return " {}\\approx{} ";
+
+      case "v":
+        return " \\downarrow{} ";
+
+      case "(v)":
+        return " \\downarrow{} ";
+
+      case "^":
+        return " \\uparrow{} ";
+
+      case "(^)":
+        return " \\uparrow{} ";
+
+      default:
+        assertNever(a);
+        throw ["MhchemBugT", "mhchem bug T. Please report."];
+    }
+  }
+}; //
+// Helpers for code anaylsis
+// Will show type error at calling position
+//
+
+/** @param {number} a */
+
+function assertNever(a) {}
+/** @param {string} a */
+
+
+function assertString(a) {}
+}();
+__webpack_exports__ = __webpack_exports__["default"];
+/******/ 	return __webpack_exports__;
+/******/ })()
+;
+});

File diff suppressed because it is too large
+ 0 - 0
public/lib/katex/contrib/mhchem.min.js


+ 3109 - 0
public/lib/katex/contrib/mhchem.mjs

@@ -0,0 +1,3109 @@
+import katex from '../katex.mjs';
+
+/* eslint-disable */
+
+/* -*- Mode: Javascript; indent-tabs-mode:nil; js-indent-level: 2 -*- */
+
+/* vim: set ts=2 et sw=2 tw=80: */
+
+/*************************************************************
+ *
+ *  KaTeX mhchem.js
+ *
+ *  This file implements a KaTeX version of mhchem version 3.3.0.
+ *  It is adapted from MathJax/extensions/TeX/mhchem.js
+ *  It differs from the MathJax version as follows:
+ *    1. The interface is changed so that it can be called from KaTeX, not MathJax.
+ *    2. \rlap and \llap are replaced with \mathrlap and \mathllap.
+ *    3. Four lines of code are edited in order to use \raisebox instead of \raise.
+ *    4. The reaction arrow code is simplified. All reaction arrows are rendered
+ *       using KaTeX extensible arrows instead of building non-extensible arrows.
+ *    5. \tripledash vertical alignment is slightly adjusted.
+ *
+ *    This code, as other KaTeX code, is released under the MIT license.
+ * 
+ * /*************************************************************
+ *
+ *  MathJax/extensions/TeX/mhchem.js
+ *
+ *  Implements the \ce command for handling chemical formulas
+ *  from the mhchem LaTeX package.
+ *
+ *  ---------------------------------------------------------------------
+ *
+ *  Copyright (c) 2011-2015 The MathJax Consortium
+ *  Copyright (c) 2015-2018 Martin Hensel
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+//
+// Coding Style
+//   - use '' for identifiers that can by minified/uglified
+//   - use "" for strings that need to stay untouched
+// version: "3.3.0" for MathJax and KaTeX
+// Add \ce, \pu, and \tripledash to the KaTeX macros.
+katex.__defineMacro("\\ce", function (context) {
+  return chemParse(context.consumeArgs(1)[0], "ce");
+});
+
+katex.__defineMacro("\\pu", function (context) {
+  return chemParse(context.consumeArgs(1)[0], "pu");
+}); //  Needed for \bond for the ~ forms
+//  Raise by 2.56mu, not 2mu. We're raising a hyphen-minus, U+002D, not 
+//  a mathematical minus, U+2212. So we need that extra 0.56.
+
+
+katex.__defineMacro("\\tripledash", "{\\vphantom{-}\\raisebox{2.56mu}{$\\mkern2mu" + "\\tiny\\text{-}\\mkern1mu\\text{-}\\mkern1mu\\text{-}\\mkern2mu$}}");
+//  This is the main function for handing the \ce and \pu commands.
+//  It takes the argument to \ce or \pu and returns the corresponding TeX string.
+//
+
+var chemParse = function chemParse(tokens, stateMachine) {
+  // Recreate the argument string from KaTeX's array of tokens.
+  var str = "";
+  var expectedLoc = tokens.length && tokens[tokens.length - 1].loc.start;
+
+  for (var i = tokens.length - 1; i >= 0; i--) {
+    if (tokens[i].loc.start > expectedLoc) {
+      // context.consumeArgs has eaten a space.
+      str += " ";
+      expectedLoc = tokens[i].loc.start;
+    }
+
+    str += tokens[i].text;
+    expectedLoc += tokens[i].text.length;
+  }
+
+  var tex = texify.go(mhchemParser.go(str, stateMachine));
+  return tex;
+}; //
+// Core parser for mhchem syntax  (recursive)
+//
+
+/** @type {MhchemParser} */
+
+
+var mhchemParser = {
+  //
+  // Parses mchem \ce syntax
+  //
+  // Call like
+  //   go("H2O");
+  //
+  go: function go(input, stateMachine) {
+    if (!input) {
+      return [];
+    }
+
+    if (stateMachine === undefined) {
+      stateMachine = 'ce';
+    }
+
+    var state = '0'; //
+    // String buffers for parsing:
+    //
+    // buffer.a == amount
+    // buffer.o == element
+    // buffer.b == left-side superscript
+    // buffer.p == left-side subscript
+    // buffer.q == right-side subscript
+    // buffer.d == right-side superscript
+    //
+    // buffer.r == arrow
+    // buffer.rdt == arrow, script above, type
+    // buffer.rd == arrow, script above, content
+    // buffer.rqt == arrow, script below, type
+    // buffer.rq == arrow, script below, content
+    //
+    // buffer.text_
+    // buffer.rm
+    // etc.
+    //
+    // buffer.parenthesisLevel == int, starting at 0
+    // buffer.sb == bool, space before
+    // buffer.beginsWithBond == bool
+    //
+    // These letters are also used as state names.
+    //
+    // Other states:
+    // 0 == begin of main part (arrow/operator unlikely)
+    // 1 == next entity
+    // 2 == next entity (arrow/operator unlikely)
+    // 3 == next atom
+    // c == macro
+    //
+
+    /** @type {Buffer} */
+
+    var buffer = {};
+    buffer['parenthesisLevel'] = 0;
+    input = input.replace(/\n/g, " ");
+    input = input.replace(/[\u2212\u2013\u2014\u2010]/g, "-");
+    input = input.replace(/[\u2026]/g, "..."); //
+    // Looks through mhchemParser.transitions, to execute a matching action
+    // (recursive)
+    //
+
+    var lastInput;
+    var watchdog = 10;
+    /** @type {ParserOutput[]} */
+
+    var output = [];
+
+    while (true) {
+      if (lastInput !== input) {
+        watchdog = 10;
+        lastInput = input;
+      } else {
+        watchdog--;
+      } //
+      // Find actions in transition table
+      //
+
+
+      var machine = mhchemParser.stateMachines[stateMachine];
+      var t = machine.transitions[state] || machine.transitions['*'];
+
+      iterateTransitions: for (var i = 0; i < t.length; i++) {
+        var matches = mhchemParser.patterns.match_(t[i].pattern, input);
+
+        if (matches) {
+          //
+          // Execute actions
+          //
+          var task = t[i].task;
+
+          for (var iA = 0; iA < task.action_.length; iA++) {
+            var o; //
+            // Find and execute action
+            //
+
+            if (machine.actions[task.action_[iA].type_]) {
+              o = machine.actions[task.action_[iA].type_](buffer, matches.match_, task.action_[iA].option);
+            } else if (mhchemParser.actions[task.action_[iA].type_]) {
+              o = mhchemParser.actions[task.action_[iA].type_](buffer, matches.match_, task.action_[iA].option);
+            } else {
+              throw ["MhchemBugA", "mhchem bug A. Please report. (" + task.action_[iA].type_ + ")"]; // Trying to use non-existing action
+            } //
+            // Add output
+            //
+
+
+            mhchemParser.concatArray(output, o);
+          } //
+          // Set next state,
+          // Shorten input,
+          // Continue with next character
+          //   (= apply only one transition per position)
+          //
+
+
+          state = task.nextState || state;
+
+          if (input.length > 0) {
+            if (!task.revisit) {
+              input = matches.remainder;
+            }
+
+            if (!task.toContinue) {
+              break iterateTransitions;
+            }
+          } else {
+            return output;
+          }
+        }
+      } //
+      // Prevent infinite loop
+      //
+
+
+      if (watchdog <= 0) {
+        throw ["MhchemBugU", "mhchem bug U. Please report."]; // Unexpected character
+      }
+    }
+  },
+  concatArray: function concatArray(a, b) {
+    if (b) {
+      if (Array.isArray(b)) {
+        for (var iB = 0; iB < b.length; iB++) {
+          a.push(b[iB]);
+        }
+      } else {
+        a.push(b);
+      }
+    }
+  },
+  patterns: {
+    //
+    // Matching patterns
+    // either regexps or function that return null or {match_:"a", remainder:"bc"}
+    //
+    patterns: {
+      // property names must not look like integers ("2") for correct property traversal order, later on
+      'empty': /^$/,
+      'else': /^./,
+      'else2': /^./,
+      'space': /^\s/,
+      'space A': /^\s(?=[A-Z\\$])/,
+      'space$': /^\s$/,
+      'a-z': /^[a-z]/,
+      'x': /^x/,
+      'x$': /^x$/,
+      'i$': /^i$/,
+      'letters': /^(?:[a-zA-Z\u03B1-\u03C9\u0391-\u03A9?@]|(?:\\(?:alpha|beta|gamma|delta|epsilon|zeta|eta|theta|iota|kappa|lambda|mu|nu|xi|omicron|pi|rho|sigma|tau|upsilon|phi|chi|psi|omega|Gamma|Delta|Theta|Lambda|Xi|Pi|Sigma|Upsilon|Phi|Psi|Omega)(?:\s+|\{\}|(?![a-zA-Z]))))+/,
+      '\\greek': /^\\(?:alpha|beta|gamma|delta|epsilon|zeta|eta|theta|iota|kappa|lambda|mu|nu|xi|omicron|pi|rho|sigma|tau|upsilon|phi|chi|psi|omega|Gamma|Delta|Theta|Lambda|Xi|Pi|Sigma|Upsilon|Phi|Psi|Omega)(?:\s+|\{\}|(?![a-zA-Z]))/,
+      'one lowercase latin letter $': /^(?:([a-z])(?:$|[^a-zA-Z]))$/,
+      '$one lowercase latin letter$ $': /^\$(?:([a-z])(?:$|[^a-zA-Z]))\$$/,
+      'one lowercase greek letter $': /^(?:\$?[\u03B1-\u03C9]\$?|\$?\\(?:alpha|beta|gamma|delta|epsilon|zeta|eta|theta|iota|kappa|lambda|mu|nu|xi|omicron|pi|rho|sigma|tau|upsilon|phi|chi|psi|omega)\s*\$?)(?:\s+|\{\}|(?![a-zA-Z]))$/,
+      'digits': /^[0-9]+/,
+      '-9.,9': /^[+\-]?(?:[0-9]+(?:[,.][0-9]+)?|[0-9]*(?:\.[0-9]+))/,
+      '-9.,9 no missing 0': /^[+\-]?[0-9]+(?:[.,][0-9]+)?/,
+      '(-)(9.,9)(e)(99)': function e99(input) {
+        var m = input.match(/^(\+\-|\+\/\-|\+|\-|\\pm\s?)?([0-9]+(?:[,.][0-9]+)?|[0-9]*(?:\.[0-9]+))?(\((?:[0-9]+(?:[,.][0-9]+)?|[0-9]*(?:\.[0-9]+))\))?(?:([eE]|\s*(\*|x|\\times|\u00D7)\s*10\^)([+\-]?[0-9]+|\{[+\-]?[0-9]+\}))?/);
+
+        if (m && m[0]) {
+          return {
+            match_: m.splice(1),
+            remainder: input.substr(m[0].length)
+          };
+        }
+
+        return null;
+      },
+      '(-)(9)^(-9)': function _(input) {
+        var m = input.match(/^(\+\-|\+\/\-|\+|\-|\\pm\s?)?([0-9]+(?:[,.][0-9]+)?|[0-9]*(?:\.[0-9]+)?)\^([+\-]?[0-9]+|\{[+\-]?[0-9]+\})/);
+
+        if (m && m[0]) {
+          return {
+            match_: m.splice(1),
+            remainder: input.substr(m[0].length)
+          };
+        }
+
+        return null;
+      },
+      'state of aggregation $': function stateOfAggregation$(input) {
+        // ... or crystal system
+        var a = mhchemParser.patterns.findObserveGroups(input, "", /^\([a-z]{1,3}(?=[\),])/, ")", ""); // (aq), (aq,$\infty$), (aq, sat)
+
+        if (a && a.remainder.match(/^($|[\s,;\)\]\}])/)) {
+          return a;
+        } //  AND end of 'phrase'
+
+
+        var m = input.match(/^(?:\((?:\\ca\s?)?\$[amothc]\$\))/); // OR crystal system ($o$) (\ca$c$)
+
+        if (m) {
+          return {
+            match_: m[0],
+            remainder: input.substr(m[0].length)
+          };
+        }
+
+        return null;
+      },
+      '_{(state of aggregation)}$': /^_\{(\([a-z]{1,3}\))\}/,
+      '{[(': /^(?:\\\{|\[|\()/,
+      ')]}': /^(?:\)|\]|\\\})/,
+      ', ': /^[,;]\s*/,
+      ',': /^[,;]/,
+      '.': /^[.]/,
+      '. ': /^([.\u22C5\u00B7\u2022])\s*/,
+      '...': /^\.\.\.(?=$|[^.])/,
+      '* ': /^([*])\s*/,
+      '^{(...)}': function _(input) {
+        return mhchemParser.patterns.findObserveGroups(input, "^{", "", "", "}");
+      },
+      '^($...$)': function $$(input) {
+        return mhchemParser.patterns.findObserveGroups(input, "^", "$", "$", "");
+      },
+      '^a': /^\^([0-9]+|[^\\_])/,
+      '^\\x{}{}': function x(input) {
+        return mhchemParser.patterns.findObserveGroups(input, "^", /^\\[a-zA-Z]+\{/, "}", "", "", "{", "}", "", true);
+      },
+      '^\\x{}': function x(input) {
+        return mhchemParser.patterns.findObserveGroups(input, "^", /^\\[a-zA-Z]+\{/, "}", "");
+      },
+      '^\\x': /^\^(\\[a-zA-Z]+)\s*/,
+      '^(-1)': /^\^(-?\d+)/,
+      '\'': /^'/,
+      '_{(...)}': function _(input) {
+        return mhchemParser.patterns.findObserveGroups(input, "_{", "", "", "}");
+      },
+      '_($...$)': function _$$(input) {
+        return mhchemParser.patterns.findObserveGroups(input, "_", "$", "$", "");
+      },
+      '_9': /^_([+\-]?[0-9]+|[^\\])/,
+      '_\\x{}{}': function _X(input) {
+        return mhchemParser.patterns.findObserveGroups(input, "_", /^\\[a-zA-Z]+\{/, "}", "", "", "{", "}", "", true);
+      },
+      '_\\x{}': function _X(input) {
+        return mhchemParser.patterns.findObserveGroups(input, "_", /^\\[a-zA-Z]+\{/, "}", "");
+      },
+      '_\\x': /^_(\\[a-zA-Z]+)\s*/,
+      '^_': /^(?:\^(?=_)|\_(?=\^)|[\^_]$)/,
+      '{}': /^\{\}/,
+      '{...}': function _(input) {
+        return mhchemParser.patterns.findObserveGroups(input, "", "{", "}", "");
+      },
+      '{(...)}': function _(input) {
+        return mhchemParser.patterns.findObserveGroups(input, "{", "", "", "}");
+      },
+      '$...$': function $$(input) {
+        return mhchemParser.patterns.findObserveGroups(input, "", "$", "$", "");
+      },
+      '${(...)}$': function $$(input) {
+        return mhchemParser.patterns.findObserveGroups(input, "${", "", "", "}$");
+      },
+      '$(...)$': function $$(input) {
+        return mhchemParser.patterns.findObserveGroups(input, "$", "", "", "$");
+      },
+      '=<>': /^[=<>]/,
+      '#': /^[#\u2261]/,
+      '+': /^\+/,
+      '-$': /^-(?=[\s_},;\]/]|$|\([a-z]+\))/,
+      // -space -, -; -] -/ -$ -state-of-aggregation
+      '-9': /^-(?=[0-9])/,
+      '- orbital overlap': /^-(?=(?:[spd]|sp)(?:$|[\s,;\)\]\}]))/,
+      '-': /^-/,
+      'pm-operator': /^(?:\\pm|\$\\pm\$|\+-|\+\/-)/,
+      'operator': /^(?:\+|(?:[\-=<>]|<<|>>|\\approx|\$\\approx\$)(?=\s|$|-?[0-9]))/,
+      'arrowUpDown': /^(?:v|\(v\)|\^|\(\^\))(?=$|[\s,;\)\]\}])/,
+      '\\bond{(...)}': function bond(input) {
+        return mhchemParser.patterns.findObserveGroups(input, "\\bond{", "", "", "}");
+      },
+      '->': /^(?:<->|<-->|->|<-|<=>>|<<=>|<=>|[\u2192\u27F6\u21CC])/,
+      'CMT': /^[CMT](?=\[)/,
+      '[(...)]': function _(input) {
+        return mhchemParser.patterns.findObserveGroups(input, "[", "", "", "]");
+      },
+      '1st-level escape': /^(&|\\\\|\\hline)\s*/,
+      '\\,': /^(?:\\[,\ ;:])/,
+      // \\x - but output no space before
+      '\\x{}{}': function x(input) {
+        return mhchemParser.patterns.findObserveGroups(input, "", /^\\[a-zA-Z]+\{/, "}", "", "", "{", "}", "", true);
+      },
+      '\\x{}': function x(input) {
+        return mhchemParser.patterns.findObserveGroups(input, "", /^\\[a-zA-Z]+\{/, "}", "");
+      },
+      '\\ca': /^\\ca(?:\s+|(?![a-zA-Z]))/,
+      '\\x': /^(?:\\[a-zA-Z]+\s*|\\[_&{}%])/,
+      'orbital': /^(?:[0-9]{1,2}[spdfgh]|[0-9]{0,2}sp)(?=$|[^a-zA-Z])/,
+      // only those with numbers in front, because the others will be formatted correctly anyway
+      'others': /^[\/~|]/,
+      '\\frac{(...)}': function frac(input) {
+        return mhchemParser.patterns.findObserveGroups(input, "\\frac{", "", "", "}", "{", "", "", "}");
+      },
+      '\\overset{(...)}': function overset(input) {
+        return mhchemParser.patterns.findObserveGroups(input, "\\overset{", "", "", "}", "{", "", "", "}");
+      },
+      '\\underset{(...)}': function underset(input) {
+        return mhchemParser.patterns.findObserveGroups(input, "\\underset{", "", "", "}", "{", "", "", "}");
+      },
+      '\\underbrace{(...)}': function underbrace(input) {
+        return mhchemParser.patterns.findObserveGroups(input, "\\underbrace{", "", "", "}_", "{", "", "", "}");
+      },
+      '\\color{(...)}0': function color0(input) {
+        return mhchemParser.patterns.findObserveGroups(input, "\\color{", "", "", "}");
+      },
+      '\\color{(...)}{(...)}1': function color1(input) {
+        return mhchemParser.patterns.findObserveGroups(input, "\\color{", "", "", "}", "{", "", "", "}");
+      },
+      '\\color(...){(...)}2': function color2(input) {
+        return mhchemParser.patterns.findObserveGroups(input, "\\color", "\\", "", /^(?=\{)/, "{", "", "", "}");
+      },
+      '\\ce{(...)}': function ce(input) {
+        return mhchemParser.patterns.findObserveGroups(input, "\\ce{", "", "", "}");
+      },
+      'oxidation$': /^(?:[+-][IVX]+|\\pm\s*0|\$\\pm\$\s*0)$/,
+      'd-oxidation$': /^(?:[+-]?\s?[IVX]+|\\pm\s*0|\$\\pm\$\s*0)$/,
+      // 0 could be oxidation or charge
+      'roman numeral': /^[IVX]+/,
+      '1/2$': /^[+\-]?(?:[0-9]+|\$[a-z]\$|[a-z])\/[0-9]+(?:\$[a-z]\$|[a-z])?$/,
+      'amount': function amount(input) {
+        var match; // e.g. 2, 0.5, 1/2, -2, n/2, +;  $a$ could be added later in parsing
+
+        match = input.match(/^(?:(?:(?:\([+\-]?[0-9]+\/[0-9]+\)|[+\-]?(?:[0-9]+|\$[a-z]\$|[a-z])\/[0-9]+|[+\-]?[0-9]+[.,][0-9]+|[+\-]?\.[0-9]+|[+\-]?[0-9]+)(?:[a-z](?=\s*[A-Z]))?)|[+\-]?[a-z](?=\s*[A-Z])|\+(?!\s))/);
+
+        if (match) {
+          return {
+            match_: match[0],
+            remainder: input.substr(match[0].length)
+          };
+        }
+
+        var a = mhchemParser.patterns.findObserveGroups(input, "", "$", "$", "");
+
+        if (a) {
+          // e.g. $2n-1$, $-$
+          match = a.match_.match(/^\$(?:\(?[+\-]?(?:[0-9]*[a-z]?[+\-])?[0-9]*[a-z](?:[+\-][0-9]*[a-z]?)?\)?|\+|-)\$$/);
+
+          if (match) {
+            return {
+              match_: match[0],
+              remainder: input.substr(match[0].length)
+            };
+          }
+        }
+
+        return null;
+      },
+      'amount2': function amount2(input) {
+        return this['amount'](input);
+      },
+      '(KV letters),': /^(?:[A-Z][a-z]{0,2}|i)(?=,)/,
+      'formula$': function formula$(input) {
+        if (input.match(/^\([a-z]+\)$/)) {
+          return null;
+        } // state of aggregation = no formula
+
+
+        var match = input.match(/^(?:[a-z]|(?:[0-9\ \+\-\,\.\(\)]+[a-z])+[0-9\ \+\-\,\.\(\)]*|(?:[a-z][0-9\ \+\-\,\.\(\)]+)+[a-z]?)$/);
+
+        if (match) {
+          return {
+            match_: match[0],
+            remainder: input.substr(match[0].length)
+          };
+        }
+
+        return null;
+      },
+      'uprightEntities': /^(?:pH|pOH|pC|pK|iPr|iBu)(?=$|[^a-zA-Z])/,
+      '/': /^\s*(\/)\s*/,
+      '//': /^\s*(\/\/)\s*/,
+      '*': /^\s*[*.]\s*/
+    },
+    findObserveGroups: function findObserveGroups(input, begExcl, begIncl, endIncl, endExcl, beg2Excl, beg2Incl, end2Incl, end2Excl, combine) {
+      /** @type {{(input: string, pattern: string | RegExp): string | string[] | null;}} */
+      var _match = function _match(input, pattern) {
+        if (typeof pattern === "string") {
+          if (input.indexOf(pattern) !== 0) {
+            return null;
+          }
+
+          return pattern;
+        } else {
+          var match = input.match(pattern);
+
+          if (!match) {
+            return null;
+          }
+
+          return match[0];
+        }
+      };
+      /** @type {{(input: string, i: number, endChars: string | RegExp): {endMatchBegin: number, endMatchEnd: number} | null;}} */
+
+
+      var _findObserveGroups = function _findObserveGroups(input, i, endChars) {
+        var braces = 0;
+
+        while (i < input.length) {
+          var a = input.charAt(i);
+
+          var match = _match(input.substr(i), endChars);
+
+          if (match !== null && braces === 0) {
+            return {
+              endMatchBegin: i,
+              endMatchEnd: i + match.length
+            };
+          } else if (a === "{") {
+            braces++;
+          } else if (a === "}") {
+            if (braces === 0) {
+              throw ["ExtraCloseMissingOpen", "Extra close brace or missing open brace"];
+            } else {
+              braces--;
+            }
+          }
+
+          i++;
+        }
+
+        if (braces > 0) {
+          return null;
+        }
+
+        return null;
+      };
+
+      var match = _match(input, begExcl);
+
+      if (match === null) {
+        return null;
+      }
+
+      input = input.substr(match.length);
+      match = _match(input, begIncl);
+
+      if (match === null) {
+        return null;
+      }
+
+      var e = _findObserveGroups(input, match.length, endIncl || endExcl);
+
+      if (e === null) {
+        return null;
+      }
+
+      var match1 = input.substring(0, endIncl ? e.endMatchEnd : e.endMatchBegin);
+
+      if (!(beg2Excl || beg2Incl)) {
+        return {
+          match_: match1,
+          remainder: input.substr(e.endMatchEnd)
+        };
+      } else {
+        var group2 = this.findObserveGroups(input.substr(e.endMatchEnd), beg2Excl, beg2Incl, end2Incl, end2Excl);
+
+        if (group2 === null) {
+          return null;
+        }
+        /** @type {string[]} */
+
+
+        var matchRet = [match1, group2.match_];
+        return {
+          match_: combine ? matchRet.join("") : matchRet,
+          remainder: group2.remainder
+        };
+      }
+    },
+    //
+    // Matching function
+    // e.g. match("a", input) will look for the regexp called "a" and see if it matches
+    // returns null or {match_:"a", remainder:"bc"}
+    //
+    match_: function match_(m, input) {
+      var pattern = mhchemParser.patterns.patterns[m];
+
+      if (pattern === undefined) {
+        throw ["MhchemBugP", "mhchem bug P. Please report. (" + m + ")"]; // Trying to use non-existing pattern
+      } else if (typeof pattern === "function") {
+        return mhchemParser.patterns.patterns[m](input); // cannot use cached var pattern here, because some pattern functions need this===mhchemParser
+      } else {
+        // RegExp
+        var match = input.match(pattern);
+
+        if (match) {
+          var mm;
+
+          if (match[2]) {
+            mm = [match[1], match[2]];
+          } else if (match[1]) {
+            mm = match[1];
+          } else {
+            mm = match[0];
+          }
+
+          return {
+            match_: mm,
+            remainder: input.substr(match[0].length)
+          };
+        }
+
+        return null;
+      }
+    }
+  },
+  //
+  // Generic state machine actions
+  //
+  actions: {
+    'a=': function a(buffer, m) {
+      buffer.a = (buffer.a || "") + m;
+    },
+    'b=': function b(buffer, m) {
+      buffer.b = (buffer.b || "") + m;
+    },
+    'p=': function p(buffer, m) {
+      buffer.p = (buffer.p || "") + m;
+    },
+    'o=': function o(buffer, m) {
+      buffer.o = (buffer.o || "") + m;
+    },
+    'q=': function q(buffer, m) {
+      buffer.q = (buffer.q || "") + m;
+    },
+    'd=': function d(buffer, m) {
+      buffer.d = (buffer.d || "") + m;
+    },
+    'rm=': function rm(buffer, m) {
+      buffer.rm = (buffer.rm || "") + m;
+    },
+    'text=': function text(buffer, m) {
+      buffer.text_ = (buffer.text_ || "") + m;
+    },
+    'insert': function insert(buffer, m, a) {
+      return {
+        type_: a
+      };
+    },
+    'insert+p1': function insertP1(buffer, m, a) {
+      return {
+        type_: a,
+        p1: m
+      };
+    },
+    'insert+p1+p2': function insertP1P2(buffer, m, a) {
+      return {
+        type_: a,
+        p1: m[0],
+        p2: m[1]
+      };
+    },
+    'copy': function copy(buffer, m) {
+      return m;
+    },
+    'rm': function rm(buffer, m) {
+      return {
+        type_: 'rm',
+        p1: m || ""
+      };
+    },
+    'text': function text(buffer, m) {
+      return mhchemParser.go(m, 'text');
+    },
+    '{text}': function text(buffer, m) {
+      var ret = ["{"];
+      mhchemParser.concatArray(ret, mhchemParser.go(m, 'text'));
+      ret.push("}");
+      return ret;
+    },
+    'tex-math': function texMath(buffer, m) {
+      return mhchemParser.go(m, 'tex-math');
+    },
+    'tex-math tight': function texMathTight(buffer, m) {
+      return mhchemParser.go(m, 'tex-math tight');
+    },
+    'bond': function bond(buffer, m, k) {
+      return {
+        type_: 'bond',
+        kind_: k || m
+      };
+    },
+    'color0-output': function color0Output(buffer, m) {
+      return {
+        type_: 'color0',
+        color: m[0]
+      };
+    },
+    'ce': function ce(buffer, m) {
+      return mhchemParser.go(m);
+    },
+    '1/2': function _(buffer, m) {
+      /** @type {ParserOutput[]} */
+      var ret = [];
+
+      if (m.match(/^[+\-]/)) {
+        ret.push(m.substr(0, 1));
+        m = m.substr(1);
+      }
+
+      var n = m.match(/^([0-9]+|\$[a-z]\$|[a-z])\/([0-9]+)(\$[a-z]\$|[a-z])?$/);
+      n[1] = n[1].replace(/\$/g, "");
+      ret.push({
+        type_: 'frac',
+        p1: n[1],
+        p2: n[2]
+      });
+
+      if (n[3]) {
+        n[3] = n[3].replace(/\$/g, "");
+        ret.push({
+          type_: 'tex-math',
+          p1: n[3]
+        });
+      }
+
+      return ret;
+    },
+    '9,9': function _(buffer, m) {
+      return mhchemParser.go(m, '9,9');
+    }
+  },
+  //
+  // createTransitions
+  // convert  { 'letter': { 'state': { action_: 'output' } } }  to  { 'state' => [ { pattern: 'letter', task: { action_: [{type_: 'output'}] } } ] }
+  // with expansion of 'a|b' to 'a' and 'b' (at 2 places)
+  //
+  createTransitions: function createTransitions(o) {
+    var pattern, state;
+    /** @type {string[]} */
+
+    var stateArray;
+    var i; //
+    // 1. Collect all states
+    //
+
+    /** @type {Transitions} */
+
+    var transitions = {};
+
+    for (pattern in o) {
+      for (state in o[pattern]) {
+        stateArray = state.split("|");
+        o[pattern][state].stateArray = stateArray;
+
+        for (i = 0; i < stateArray.length; i++) {
+          transitions[stateArray[i]] = [];
+        }
+      }
+    } //
+    // 2. Fill states
+    //
+
+
+    for (pattern in o) {
+      for (state in o[pattern]) {
+        stateArray = o[pattern][state].stateArray || [];
+
+        for (i = 0; i < stateArray.length; i++) {
+          //
+          // 2a. Normalize actions into array:  'text=' ==> [{type_:'text='}]
+          // (Note to myself: Resolving the function here would be problematic. It would need .bind (for *this*) and currying (for *option*).)
+          //
+
+          /** @type {any} */
+          var p = o[pattern][state];
+
+          if (p.action_) {
+            p.action_ = [].concat(p.action_);
+
+            for (var k = 0; k < p.action_.length; k++) {
+              if (typeof p.action_[k] === "string") {
+                p.action_[k] = {
+                  type_: p.action_[k]
+                };
+              }
+            }
+          } else {
+            p.action_ = [];
+          } //
+          // 2.b Multi-insert
+          //
+
+
+          var patternArray = pattern.split("|");
+
+          for (var j = 0; j < patternArray.length; j++) {
+            if (stateArray[i] === '*') {
+              // insert into all
+              for (var t in transitions) {
+                transitions[t].push({
+                  pattern: patternArray[j],
+                  task: p
+                });
+              }
+            } else {
+              transitions[stateArray[i]].push({
+                pattern: patternArray[j],
+                task: p
+              });
+            }
+          }
+        }
+      }
+    }
+
+    return transitions;
+  },
+  stateMachines: {}
+}; //
+// Definition of state machines
+//
+
+mhchemParser.stateMachines = {
+  //
+  // \ce state machines
+  //
+  //#region ce
+  'ce': {
+    // main parser
+    transitions: mhchemParser.createTransitions({
+      'empty': {
+        '*': {
+          action_: 'output'
+        }
+      },
+      'else': {
+        '0|1|2': {
+          action_: 'beginsWithBond=false',
+          revisit: true,
+          toContinue: true
+        }
+      },
+      'oxidation$': {
+        '0': {
+          action_: 'oxidation-output'
+        }
+      },
+      'CMT': {
+        'r': {
+          action_: 'rdt=',
+          nextState: 'rt'
+        },
+        'rd': {
+          action_: 'rqt=',
+          nextState: 'rdt'
+        }
+      },
+      'arrowUpDown': {
+        '0|1|2|as': {
+          action_: ['sb=false', 'output', 'operator'],
+          nextState: '1'
+        }
+      },
+      'uprightEntities': {
+        '0|1|2': {
+          action_: ['o=', 'output'],
+          nextState: '1'
+        }
+      },
+      'orbital': {
+        '0|1|2|3': {
+          action_: 'o=',
+          nextState: 'o'
+        }
+      },
+      '->': {
+        '0|1|2|3': {
+          action_: 'r=',
+          nextState: 'r'
+        },
+        'a|as': {
+          action_: ['output', 'r='],
+          nextState: 'r'
+        },
+        '*': {
+          action_: ['output', 'r='],
+          nextState: 'r'
+        }
+      },
+      '+': {
+        'o': {
+          action_: 'd= kv',
+          nextState: 'd'
+        },
+        'd|D': {
+          action_: 'd=',
+          nextState: 'd'
+        },
+        'q': {
+          action_: 'd=',
+          nextState: 'qd'
+        },
+        'qd|qD': {
+          action_: 'd=',
+          nextState: 'qd'
+        },
+        'dq': {
+          action_: ['output', 'd='],
+          nextState: 'd'
+        },
+        '3': {
+          action_: ['sb=false', 'output', 'operator'],
+          nextState: '0'
+        }
+      },
+      'amount': {
+        '0|2': {
+          action_: 'a=',
+          nextState: 'a'
+        }
+      },
+      'pm-operator': {
+        '0|1|2|a|as': {
+          action_: ['sb=false', 'output', {
+            type_: 'operator',
+            option: '\\pm'
+          }],
+          nextState: '0'
+        }
+      },
+      'operator': {
+        '0|1|2|a|as': {
+          action_: ['sb=false', 'output', 'operator'],
+          nextState: '0'
+        }
+      },
+      '-$': {
+        'o|q': {
+          action_: ['charge or bond', 'output'],
+          nextState: 'qd'
+        },
+        'd': {
+          action_: 'd=',
+          nextState: 'd'
+        },
+        'D': {
+          action_: ['output', {
+            type_: 'bond',
+            option: "-"
+          }],
+          nextState: '3'
+        },
+        'q': {
+          action_: 'd=',
+          nextState: 'qd'
+        },
+        'qd': {
+          action_: 'd=',
+          nextState: 'qd'
+        },
+        'qD|dq': {
+          action_: ['output', {
+            type_: 'bond',
+            option: "-"
+          }],
+          nextState: '3'
+        }
+      },
+      '-9': {
+        '3|o': {
+          action_: ['output', {
+            type_: 'insert',
+            option: 'hyphen'
+          }],
+          nextState: '3'
+        }
+      },
+      '- orbital overlap': {
+        'o': {
+          action_: ['output', {
+            type_: 'insert',
+            option: 'hyphen'
+          }],
+          nextState: '2'
+        },
+        'd': {
+          action_: ['output', {
+            type_: 'insert',
+            option: 'hyphen'
+          }],
+          nextState: '2'
+        }
+      },
+      '-': {
+        '0|1|2': {
+          action_: [{
+            type_: 'output',
+            option: 1
+          }, 'beginsWithBond=true', {
+            type_: 'bond',
+            option: "-"
+          }],
+          nextState: '3'
+        },
+        '3': {
+          action_: {
+            type_: 'bond',
+            option: "-"
+          }
+        },
+        'a': {
+          action_: ['output', {
+            type_: 'insert',
+            option: 'hyphen'
+          }],
+          nextState: '2'
+        },
+        'as': {
+          action_: [{
+            type_: 'output',
+            option: 2
+          }, {
+            type_: 'bond',
+            option: "-"
+          }],
+          nextState: '3'
+        },
+        'b': {
+          action_: 'b='
+        },
+        'o': {
+          action_: {
+            type_: '- after o/d',
+            option: false
+          },
+          nextState: '2'
+        },
+        'q': {
+          action_: {
+            type_: '- after o/d',
+            option: false
+          },
+          nextState: '2'
+        },
+        'd|qd|dq': {
+          action_: {
+            type_: '- after o/d',
+            option: true
+          },
+          nextState: '2'
+        },
+        'D|qD|p': {
+          action_: ['output', {
+            type_: 'bond',
+            option: "-"
+          }],
+          nextState: '3'
+        }
+      },
+      'amount2': {
+        '1|3': {
+          action_: 'a=',
+          nextState: 'a'
+        }
+      },
+      'letters': {
+        '0|1|2|3|a|as|b|p|bp|o': {
+          action_: 'o=',
+          nextState: 'o'
+        },
+        'q|dq': {
+          action_: ['output', 'o='],
+          nextState: 'o'
+        },
+        'd|D|qd|qD': {
+          action_: 'o after d',
+          nextState: 'o'
+        }
+      },
+      'digits': {
+        'o': {
+          action_: 'q=',
+          nextState: 'q'
+        },
+        'd|D': {
+          action_: 'q=',
+          nextState: 'dq'
+        },
+        'q': {
+          action_: ['output', 'o='],
+          nextState: 'o'
+        },
+        'a': {
+          action_: 'o=',
+          nextState: 'o'
+        }
+      },
+      'space A': {
+        'b|p|bp': {}
+      },
+      'space': {
+        'a': {
+          nextState: 'as'
+        },
+        '0': {
+          action_: 'sb=false'
+        },
+        '1|2': {
+          action_: 'sb=true'
+        },
+        'r|rt|rd|rdt|rdq': {
+          action_: 'output',
+          nextState: '0'
+        },
+        '*': {
+          action_: ['output', 'sb=true'],
+          nextState: '1'
+        }
+      },
+      '1st-level escape': {
+        '1|2': {
+          action_: ['output', {
+            type_: 'insert+p1',
+            option: '1st-level escape'
+          }]
+        },
+        '*': {
+          action_: ['output', {
+            type_: 'insert+p1',
+            option: '1st-level escape'
+          }],
+          nextState: '0'
+        }
+      },
+      '[(...)]': {
+        'r|rt': {
+          action_: 'rd=',
+          nextState: 'rd'
+        },
+        'rd|rdt': {
+          action_: 'rq=',
+          nextState: 'rdq'
+        }
+      },
+      '...': {
+        'o|d|D|dq|qd|qD': {
+          action_: ['output', {
+            type_: 'bond',
+            option: "..."
+          }],
+          nextState: '3'
+        },
+        '*': {
+          action_: [{
+            type_: 'output',
+            option: 1
+          }, {
+            type_: 'insert',
+            option: 'ellipsis'
+          }],
+          nextState: '1'
+        }
+      },
+      '. |* ': {
+        '*': {
+          action_: ['output', {
+            type_: 'insert',
+            option: 'addition compound'
+          }],
+          nextState: '1'
+        }
+      },
+      'state of aggregation $': {
+        '*': {
+          action_: ['output', 'state of aggregation'],
+          nextState: '1'
+        }
+      },
+      '{[(': {
+        'a|as|o': {
+          action_: ['o=', 'output', 'parenthesisLevel++'],
+          nextState: '2'
+        },
+        '0|1|2|3': {
+          action_: ['o=', 'output', 'parenthesisLevel++'],
+          nextState: '2'
+        },
+        '*': {
+          action_: ['output', 'o=', 'output', 'parenthesisLevel++'],
+          nextState: '2'
+        }
+      },
+      ')]}': {
+        '0|1|2|3|b|p|bp|o': {
+          action_: ['o=', 'parenthesisLevel--'],
+          nextState: 'o'
+        },
+        'a|as|d|D|q|qd|qD|dq': {
+          action_: ['output', 'o=', 'parenthesisLevel--'],
+          nextState: 'o'
+        }
+      },
+      ', ': {
+        '*': {
+          action_: ['output', 'comma'],
+          nextState: '0'
+        }
+      },
+      '^_': {
+        // ^ and _ without a sensible argument
+        '*': {}
+      },
+      '^{(...)}|^($...$)': {
+        '0|1|2|as': {
+          action_: 'b=',
+          nextState: 'b'
+        },
+        'p': {
+          action_: 'b=',
+          nextState: 'bp'
+        },
+        '3|o': {
+          action_: 'd= kv',
+          nextState: 'D'
+        },
+        'q': {
+          action_: 'd=',
+          nextState: 'qD'
+        },
+        'd|D|qd|qD|dq': {
+          action_: ['output', 'd='],
+          nextState: 'D'
+        }
+      },
+      '^a|^\\x{}{}|^\\x{}|^\\x|\'': {
+        '0|1|2|as': {
+          action_: 'b=',
+          nextState: 'b'
+        },
+        'p': {
+          action_: 'b=',
+          nextState: 'bp'
+        },
+        '3|o': {
+          action_: 'd= kv',
+          nextState: 'd'
+        },
+        'q': {
+          action_: 'd=',
+          nextState: 'qd'
+        },
+        'd|qd|D|qD': {
+          action_: 'd='
+        },
+        'dq': {
+          action_: ['output', 'd='],
+          nextState: 'd'
+        }
+      },
+      '_{(state of aggregation)}$': {
+        'd|D|q|qd|qD|dq': {
+          action_: ['output', 'q='],
+          nextState: 'q'
+        }
+      },
+      '_{(...)}|_($...$)|_9|_\\x{}{}|_\\x{}|_\\x': {
+        '0|1|2|as': {
+          action_: 'p=',
+          nextState: 'p'
+        },
+        'b': {
+          action_: 'p=',
+          nextState: 'bp'
+        },
+        '3|o': {
+          action_: 'q=',
+          nextState: 'q'
+        },
+        'd|D': {
+          action_: 'q=',
+          nextState: 'dq'
+        },
+        'q|qd|qD|dq': {
+          action_: ['output', 'q='],
+          nextState: 'q'
+        }
+      },
+      '=<>': {
+        '0|1|2|3|a|as|o|q|d|D|qd|qD|dq': {
+          action_: [{
+            type_: 'output',
+            option: 2
+          }, 'bond'],
+          nextState: '3'
+        }
+      },
+      '#': {
+        '0|1|2|3|a|as|o': {
+          action_: [{
+            type_: 'output',
+            option: 2
+          }, {
+            type_: 'bond',
+            option: "#"
+          }],
+          nextState: '3'
+        }
+      },
+      '{}': {
+        '*': {
+          action_: {
+            type_: 'output',
+            option: 1
+          },
+          nextState: '1'
+        }
+      },
+      '{...}': {
+        '0|1|2|3|a|as|b|p|bp': {
+          action_: 'o=',
+          nextState: 'o'
+        },
+        'o|d|D|q|qd|qD|dq': {
+          action_: ['output', 'o='],
+          nextState: 'o'
+        }
+      },
+      '$...$': {
+        'a': {
+          action_: 'a='
+        },
+        // 2$n$
+        '0|1|2|3|as|b|p|bp|o': {
+          action_: 'o=',
+          nextState: 'o'
+        },
+        // not 'amount'
+        'as|o': {
+          action_: 'o='
+        },
+        'q|d|D|qd|qD|dq': {
+          action_: ['output', 'o='],
+          nextState: 'o'
+        }
+      },
+      '\\bond{(...)}': {
+        '*': {
+          action_: [{
+            type_: 'output',
+            option: 2
+          }, 'bond'],
+          nextState: "3"
+        }
+      },
+      '\\frac{(...)}': {
+        '*': {
+          action_: [{
+            type_: 'output',
+            option: 1
+          }, 'frac-output'],
+          nextState: '3'
+        }
+      },
+      '\\overset{(...)}': {
+        '*': {
+          action_: [{
+            type_: 'output',
+            option: 2
+          }, 'overset-output'],
+          nextState: '3'
+        }
+      },
+      '\\underset{(...)}': {
+        '*': {
+          action_: [{
+            type_: 'output',
+            option: 2
+          }, 'underset-output'],
+          nextState: '3'
+        }
+      },
+      '\\underbrace{(...)}': {
+        '*': {
+          action_: [{
+            type_: 'output',
+            option: 2
+          }, 'underbrace-output'],
+          nextState: '3'
+        }
+      },
+      '\\color{(...)}{(...)}1|\\color(...){(...)}2': {
+        '*': {
+          action_: [{
+            type_: 'output',
+            option: 2
+          }, 'color-output'],
+          nextState: '3'
+        }
+      },
+      '\\color{(...)}0': {
+        '*': {
+          action_: [{
+            type_: 'output',
+            option: 2
+          }, 'color0-output']
+        }
+      },
+      '\\ce{(...)}': {
+        '*': {
+          action_: [{
+            type_: 'output',
+            option: 2
+          }, 'ce'],
+          nextState: '3'
+        }
+      },
+      '\\,': {
+        '*': {
+          action_: [{
+            type_: 'output',
+            option: 1
+          }, 'copy'],
+          nextState: '1'
+        }
+      },
+      '\\x{}{}|\\x{}|\\x': {
+        '0|1|2|3|a|as|b|p|bp|o|c0': {
+          action_: ['o=', 'output'],
+          nextState: '3'
+        },
+        '*': {
+          action_: ['output', 'o=', 'output'],
+          nextState: '3'
+        }
+      },
+      'others': {
+        '*': {
+          action_: [{
+            type_: 'output',
+            option: 1
+          }, 'copy'],
+          nextState: '3'
+        }
+      },
+      'else2': {
+        'a': {
+          action_: 'a to o',
+          nextState: 'o',
+          revisit: true
+        },
+        'as': {
+          action_: ['output', 'sb=true'],
+          nextState: '1',
+          revisit: true
+        },
+        'r|rt|rd|rdt|rdq': {
+          action_: ['output'],
+          nextState: '0',
+          revisit: true
+        },
+        '*': {
+          action_: ['output', 'copy'],
+          nextState: '3'
+        }
+      }
+    }),
+    actions: {
+      'o after d': function oAfterD(buffer, m) {
+        var ret;
+
+        if ((buffer.d || "").match(/^[0-9]+$/)) {
+          var tmp = buffer.d;
+          buffer.d = undefined;
+          ret = this['output'](buffer);
+          buffer.b = tmp;
+        } else {
+          ret = this['output'](buffer);
+        }
+
+        mhchemParser.actions['o='](buffer, m);
+        return ret;
+      },
+      'd= kv': function dKv(buffer, m) {
+        buffer.d = m;
+        buffer.dType = 'kv';
+      },
+      'charge or bond': function chargeOrBond(buffer, m) {
+        if (buffer['beginsWithBond']) {
+          /** @type {ParserOutput[]} */
+          var ret = [];
+          mhchemParser.concatArray(ret, this['output'](buffer));
+          mhchemParser.concatArray(ret, mhchemParser.actions['bond'](buffer, m, "-"));
+          return ret;
+        } else {
+          buffer.d = m;
+        }
+      },
+      '- after o/d': function afterOD(buffer, m, isAfterD) {
+        var c1 = mhchemParser.patterns.match_('orbital', buffer.o || "");
+        var c2 = mhchemParser.patterns.match_('one lowercase greek letter $', buffer.o || "");
+        var c3 = mhchemParser.patterns.match_('one lowercase latin letter $', buffer.o || "");
+        var c4 = mhchemParser.patterns.match_('$one lowercase latin letter$ $', buffer.o || "");
+        var hyphenFollows = m === "-" && (c1 && c1.remainder === "" || c2 || c3 || c4);
+
+        if (hyphenFollows && !buffer.a && !buffer.b && !buffer.p && !buffer.d && !buffer.q && !c1 && c3) {
+          buffer.o = '$' + buffer.o + '$';
+        }
+        /** @type {ParserOutput[]} */
+
+
+        var ret = [];
+
+        if (hyphenFollows) {
+          mhchemParser.concatArray(ret, this['output'](buffer));
+          ret.push({
+            type_: 'hyphen'
+          });
+        } else {
+          c1 = mhchemParser.patterns.match_('digits', buffer.d || "");
+
+          if (isAfterD && c1 && c1.remainder === '') {
+            mhchemParser.concatArray(ret, mhchemParser.actions['d='](buffer, m));
+            mhchemParser.concatArray(ret, this['output'](buffer));
+          } else {
+            mhchemParser.concatArray(ret, this['output'](buffer));
+            mhchemParser.concatArray(ret, mhchemParser.actions['bond'](buffer, m, "-"));
+          }
+        }
+
+        return ret;
+      },
+      'a to o': function aToO(buffer) {
+        buffer.o = buffer.a;
+        buffer.a = undefined;
+      },
+      'sb=true': function sbTrue(buffer) {
+        buffer.sb = true;
+      },
+      'sb=false': function sbFalse(buffer) {
+        buffer.sb = false;
+      },
+      'beginsWithBond=true': function beginsWithBondTrue(buffer) {
+        buffer['beginsWithBond'] = true;
+      },
+      'beginsWithBond=false': function beginsWithBondFalse(buffer) {
+        buffer['beginsWithBond'] = false;
+      },
+      'parenthesisLevel++': function parenthesisLevel(buffer) {
+        buffer['parenthesisLevel']++;
+      },
+      'parenthesisLevel--': function parenthesisLevel(buffer) {
+        buffer['parenthesisLevel']--;
+      },
+      'state of aggregation': function stateOfAggregation(buffer, m) {
+        return {
+          type_: 'state of aggregation',
+          p1: mhchemParser.go(m, 'o')
+        };
+      },
+      'comma': function comma(buffer, m) {
+        var a = m.replace(/\s*$/, '');
+        var withSpace = a !== m;
+
+        if (withSpace && buffer['parenthesisLevel'] === 0) {
+          return {
+            type_: 'comma enumeration L',
+            p1: a
+          };
+        } else {
+          return {
+            type_: 'comma enumeration M',
+            p1: a
+          };
+        }
+      },
+      'output': function output(buffer, m, entityFollows) {
+        // entityFollows:
+        //   undefined = if we have nothing else to output, also ignore the just read space (buffer.sb)
+        //   1 = an entity follows, never omit the space if there was one just read before (can only apply to state 1)
+        //   2 = 1 + the entity can have an amount, so output a\, instead of converting it to o (can only apply to states a|as)
+
+        /** @type {ParserOutput | ParserOutput[]} */
+        var ret;
+
+        if (!buffer.r) {
+          ret = [];
+
+          if (!buffer.a && !buffer.b && !buffer.p && !buffer.o && !buffer.q && !buffer.d && !entityFollows) ; else {
+            if (buffer.sb) {
+              ret.push({
+                type_: 'entitySkip'
+              });
+            }
+
+            if (!buffer.o && !buffer.q && !buffer.d && !buffer.b && !buffer.p && entityFollows !== 2) {
+              buffer.o = buffer.a;
+              buffer.a = undefined;
+            } else if (!buffer.o && !buffer.q && !buffer.d && (buffer.b || buffer.p)) {
+              buffer.o = buffer.a;
+              buffer.d = buffer.b;
+              buffer.q = buffer.p;
+              buffer.a = buffer.b = buffer.p = undefined;
+            } else {
+              if (buffer.o && buffer.dType === 'kv' && mhchemParser.patterns.match_('d-oxidation$', buffer.d || "")) {
+                buffer.dType = 'oxidation';
+              } else if (buffer.o && buffer.dType === 'kv' && !buffer.q) {
+                buffer.dType = undefined;
+              }
+            }
+
+            ret.push({
+              type_: 'chemfive',
+              a: mhchemParser.go(buffer.a, 'a'),
+              b: mhchemParser.go(buffer.b, 'bd'),
+              p: mhchemParser.go(buffer.p, 'pq'),
+              o: mhchemParser.go(buffer.o, 'o'),
+              q: mhchemParser.go(buffer.q, 'pq'),
+              d: mhchemParser.go(buffer.d, buffer.dType === 'oxidation' ? 'oxidation' : 'bd'),
+              dType: buffer.dType
+            });
+          }
+        } else {
+          // r
+
+          /** @type {ParserOutput[]} */
+          var rd;
+
+          if (buffer.rdt === 'M') {
+            rd = mhchemParser.go(buffer.rd, 'tex-math');
+          } else if (buffer.rdt === 'T') {
+            rd = [{
+              type_: 'text',
+              p1: buffer.rd || ""
+            }];
+          } else {
+            rd = mhchemParser.go(buffer.rd);
+          }
+          /** @type {ParserOutput[]} */
+
+
+          var rq;
+
+          if (buffer.rqt === 'M') {
+            rq = mhchemParser.go(buffer.rq, 'tex-math');
+          } else if (buffer.rqt === 'T') {
+            rq = [{
+              type_: 'text',
+              p1: buffer.rq || ""
+            }];
+          } else {
+            rq = mhchemParser.go(buffer.rq);
+          }
+
+          ret = {
+            type_: 'arrow',
+            r: buffer.r,
+            rd: rd,
+            rq: rq
+          };
+        }
+
+        for (var p in buffer) {
+          if (p !== 'parenthesisLevel' && p !== 'beginsWithBond') {
+            delete buffer[p];
+          }
+        }
+
+        return ret;
+      },
+      'oxidation-output': function oxidationOutput(buffer, m) {
+        var ret = ["{"];
+        mhchemParser.concatArray(ret, mhchemParser.go(m, 'oxidation'));
+        ret.push("}");
+        return ret;
+      },
+      'frac-output': function fracOutput(buffer, m) {
+        return {
+          type_: 'frac-ce',
+          p1: mhchemParser.go(m[0]),
+          p2: mhchemParser.go(m[1])
+        };
+      },
+      'overset-output': function oversetOutput(buffer, m) {
+        return {
+          type_: 'overset',
+          p1: mhchemParser.go(m[0]),
+          p2: mhchemParser.go(m[1])
+        };
+      },
+      'underset-output': function undersetOutput(buffer, m) {
+        return {
+          type_: 'underset',
+          p1: mhchemParser.go(m[0]),
+          p2: mhchemParser.go(m[1])
+        };
+      },
+      'underbrace-output': function underbraceOutput(buffer, m) {
+        return {
+          type_: 'underbrace',
+          p1: mhchemParser.go(m[0]),
+          p2: mhchemParser.go(m[1])
+        };
+      },
+      'color-output': function colorOutput(buffer, m) {
+        return {
+          type_: 'color',
+          color1: m[0],
+          color2: mhchemParser.go(m[1])
+        };
+      },
+      'r=': function r(buffer, m) {
+        buffer.r = m;
+      },
+      'rdt=': function rdt(buffer, m) {
+        buffer.rdt = m;
+      },
+      'rd=': function rd(buffer, m) {
+        buffer.rd = m;
+      },
+      'rqt=': function rqt(buffer, m) {
+        buffer.rqt = m;
+      },
+      'rq=': function rq(buffer, m) {
+        buffer.rq = m;
+      },
+      'operator': function operator(buffer, m, p1) {
+        return {
+          type_: 'operator',
+          kind_: p1 || m
+        };
+      }
+    }
+  },
+  'a': {
+    transitions: mhchemParser.createTransitions({
+      'empty': {
+        '*': {}
+      },
+      '1/2$': {
+        '0': {
+          action_: '1/2'
+        }
+      },
+      'else': {
+        '0': {
+          nextState: '1',
+          revisit: true
+        }
+      },
+      '$(...)$': {
+        '*': {
+          action_: 'tex-math tight',
+          nextState: '1'
+        }
+      },
+      ',': {
+        '*': {
+          action_: {
+            type_: 'insert',
+            option: 'commaDecimal'
+          }
+        }
+      },
+      'else2': {
+        '*': {
+          action_: 'copy'
+        }
+      }
+    }),
+    actions: {}
+  },
+  'o': {
+    transitions: mhchemParser.createTransitions({
+      'empty': {
+        '*': {}
+      },
+      '1/2$': {
+        '0': {
+          action_: '1/2'
+        }
+      },
+      'else': {
+        '0': {
+          nextState: '1',
+          revisit: true
+        }
+      },
+      'letters': {
+        '*': {
+          action_: 'rm'
+        }
+      },
+      '\\ca': {
+        '*': {
+          action_: {
+            type_: 'insert',
+            option: 'circa'
+          }
+        }
+      },
+      '\\x{}{}|\\x{}|\\x': {
+        '*': {
+          action_: 'copy'
+        }
+      },
+      '${(...)}$|$(...)$': {
+        '*': {
+          action_: 'tex-math'
+        }
+      },
+      '{(...)}': {
+        '*': {
+          action_: '{text}'
+        }
+      },
+      'else2': {
+        '*': {
+          action_: 'copy'
+        }
+      }
+    }),
+    actions: {}
+  },
+  'text': {
+    transitions: mhchemParser.createTransitions({
+      'empty': {
+        '*': {
+          action_: 'output'
+        }
+      },
+      '{...}': {
+        '*': {
+          action_: 'text='
+        }
+      },
+      '${(...)}$|$(...)$': {
+        '*': {
+          action_: 'tex-math'
+        }
+      },
+      '\\greek': {
+        '*': {
+          action_: ['output', 'rm']
+        }
+      },
+      '\\,|\\x{}{}|\\x{}|\\x': {
+        '*': {
+          action_: ['output', 'copy']
+        }
+      },
+      'else': {
+        '*': {
+          action_: 'text='
+        }
+      }
+    }),
+    actions: {
+      'output': function output(buffer) {
+        if (buffer.text_) {
+          /** @type {ParserOutput} */
+          var ret = {
+            type_: 'text',
+            p1: buffer.text_
+          };
+
+          for (var p in buffer) {
+            delete buffer[p];
+          }
+
+          return ret;
+        }
+      }
+    }
+  },
+  'pq': {
+    transitions: mhchemParser.createTransitions({
+      'empty': {
+        '*': {}
+      },
+      'state of aggregation $': {
+        '*': {
+          action_: 'state of aggregation'
+        }
+      },
+      'i$': {
+        '0': {
+          nextState: '!f',
+          revisit: true
+        }
+      },
+      '(KV letters),': {
+        '0': {
+          action_: 'rm',
+          nextState: '0'
+        }
+      },
+      'formula$': {
+        '0': {
+          nextState: 'f',
+          revisit: true
+        }
+      },
+      '1/2$': {
+        '0': {
+          action_: '1/2'
+        }
+      },
+      'else': {
+        '0': {
+          nextState: '!f',
+          revisit: true
+        }
+      },
+      '${(...)}$|$(...)$': {
+        '*': {
+          action_: 'tex-math'
+        }
+      },
+      '{(...)}': {
+        '*': {
+          action_: 'text'
+        }
+      },
+      'a-z': {
+        'f': {
+          action_: 'tex-math'
+        }
+      },
+      'letters': {
+        '*': {
+          action_: 'rm'
+        }
+      },
+      '-9.,9': {
+        '*': {
+          action_: '9,9'
+        }
+      },
+      ',': {
+        '*': {
+          action_: {
+            type_: 'insert+p1',
+            option: 'comma enumeration S'
+          }
+        }
+      },
+      '\\color{(...)}{(...)}1|\\color(...){(...)}2': {
+        '*': {
+          action_: 'color-output'
+        }
+      },
+      '\\color{(...)}0': {
+        '*': {
+          action_: 'color0-output'
+        }
+      },
+      '\\ce{(...)}': {
+        '*': {
+          action_: 'ce'
+        }
+      },
+      '\\,|\\x{}{}|\\x{}|\\x': {
+        '*': {
+          action_: 'copy'
+        }
+      },
+      'else2': {
+        '*': {
+          action_: 'copy'
+        }
+      }
+    }),
+    actions: {
+      'state of aggregation': function stateOfAggregation(buffer, m) {
+        return {
+          type_: 'state of aggregation subscript',
+          p1: mhchemParser.go(m, 'o')
+        };
+      },
+      'color-output': function colorOutput(buffer, m) {
+        return {
+          type_: 'color',
+          color1: m[0],
+          color2: mhchemParser.go(m[1], 'pq')
+        };
+      }
+    }
+  },
+  'bd': {
+    transitions: mhchemParser.createTransitions({
+      'empty': {
+        '*': {}
+      },
+      'x$': {
+        '0': {
+          nextState: '!f',
+          revisit: true
+        }
+      },
+      'formula$': {
+        '0': {
+          nextState: 'f',
+          revisit: true
+        }
+      },
+      'else': {
+        '0': {
+          nextState: '!f',
+          revisit: true
+        }
+      },
+      '-9.,9 no missing 0': {
+        '*': {
+          action_: '9,9'
+        }
+      },
+      '.': {
+        '*': {
+          action_: {
+            type_: 'insert',
+            option: 'electron dot'
+          }
+        }
+      },
+      'a-z': {
+        'f': {
+          action_: 'tex-math'
+        }
+      },
+      'x': {
+        '*': {
+          action_: {
+            type_: 'insert',
+            option: 'KV x'
+          }
+        }
+      },
+      'letters': {
+        '*': {
+          action_: 'rm'
+        }
+      },
+      '\'': {
+        '*': {
+          action_: {
+            type_: 'insert',
+            option: 'prime'
+          }
+        }
+      },
+      '${(...)}$|$(...)$': {
+        '*': {
+          action_: 'tex-math'
+        }
+      },
+      '{(...)}': {
+        '*': {
+          action_: 'text'
+        }
+      },
+      '\\color{(...)}{(...)}1|\\color(...){(...)}2': {
+        '*': {
+          action_: 'color-output'
+        }
+      },
+      '\\color{(...)}0': {
+        '*': {
+          action_: 'color0-output'
+        }
+      },
+      '\\ce{(...)}': {
+        '*': {
+          action_: 'ce'
+        }
+      },
+      '\\,|\\x{}{}|\\x{}|\\x': {
+        '*': {
+          action_: 'copy'
+        }
+      },
+      'else2': {
+        '*': {
+          action_: 'copy'
+        }
+      }
+    }),
+    actions: {
+      'color-output': function colorOutput(buffer, m) {
+        return {
+          type_: 'color',
+          color1: m[0],
+          color2: mhchemParser.go(m[1], 'bd')
+        };
+      }
+    }
+  },
+  'oxidation': {
+    transitions: mhchemParser.createTransitions({
+      'empty': {
+        '*': {}
+      },
+      'roman numeral': {
+        '*': {
+          action_: 'roman-numeral'
+        }
+      },
+      '${(...)}$|$(...)$': {
+        '*': {
+          action_: 'tex-math'
+        }
+      },
+      'else': {
+        '*': {
+          action_: 'copy'
+        }
+      }
+    }),
+    actions: {
+      'roman-numeral': function romanNumeral(buffer, m) {
+        return {
+          type_: 'roman numeral',
+          p1: m || ""
+        };
+      }
+    }
+  },
+  'tex-math': {
+    transitions: mhchemParser.createTransitions({
+      'empty': {
+        '*': {
+          action_: 'output'
+        }
+      },
+      '\\ce{(...)}': {
+        '*': {
+          action_: ['output', 'ce']
+        }
+      },
+      '{...}|\\,|\\x{}{}|\\x{}|\\x': {
+        '*': {
+          action_: 'o='
+        }
+      },
+      'else': {
+        '*': {
+          action_: 'o='
+        }
+      }
+    }),
+    actions: {
+      'output': function output(buffer) {
+        if (buffer.o) {
+          /** @type {ParserOutput} */
+          var ret = {
+            type_: 'tex-math',
+            p1: buffer.o
+          };
+
+          for (var p in buffer) {
+            delete buffer[p];
+          }
+
+          return ret;
+        }
+      }
+    }
+  },
+  'tex-math tight': {
+    transitions: mhchemParser.createTransitions({
+      'empty': {
+        '*': {
+          action_: 'output'
+        }
+      },
+      '\\ce{(...)}': {
+        '*': {
+          action_: ['output', 'ce']
+        }
+      },
+      '{...}|\\,|\\x{}{}|\\x{}|\\x': {
+        '*': {
+          action_: 'o='
+        }
+      },
+      '-|+': {
+        '*': {
+          action_: 'tight operator'
+        }
+      },
+      'else': {
+        '*': {
+          action_: 'o='
+        }
+      }
+    }),
+    actions: {
+      'tight operator': function tightOperator(buffer, m) {
+        buffer.o = (buffer.o || "") + "{" + m + "}";
+      },
+      'output': function output(buffer) {
+        if (buffer.o) {
+          /** @type {ParserOutput} */
+          var ret = {
+            type_: 'tex-math',
+            p1: buffer.o
+          };
+
+          for (var p in buffer) {
+            delete buffer[p];
+          }
+
+          return ret;
+        }
+      }
+    }
+  },
+  '9,9': {
+    transitions: mhchemParser.createTransitions({
+      'empty': {
+        '*': {}
+      },
+      ',': {
+        '*': {
+          action_: 'comma'
+        }
+      },
+      'else': {
+        '*': {
+          action_: 'copy'
+        }
+      }
+    }),
+    actions: {
+      'comma': function comma() {
+        return {
+          type_: 'commaDecimal'
+        };
+      }
+    }
+  },
+  //#endregion
+  //
+  // \pu state machines
+  //
+  //#region pu
+  'pu': {
+    transitions: mhchemParser.createTransitions({
+      'empty': {
+        '*': {
+          action_: 'output'
+        }
+      },
+      'space$': {
+        '*': {
+          action_: ['output', 'space']
+        }
+      },
+      '{[(|)]}': {
+        '0|a': {
+          action_: 'copy'
+        }
+      },
+      '(-)(9)^(-9)': {
+        '0': {
+          action_: 'number^',
+          nextState: 'a'
+        }
+      },
+      '(-)(9.,9)(e)(99)': {
+        '0': {
+          action_: 'enumber',
+          nextState: 'a'
+        }
+      },
+      'space': {
+        '0|a': {}
+      },
+      'pm-operator': {
+        '0|a': {
+          action_: {
+            type_: 'operator',
+            option: '\\pm'
+          },
+          nextState: '0'
+        }
+      },
+      'operator': {
+        '0|a': {
+          action_: 'copy',
+          nextState: '0'
+        }
+      },
+      '//': {
+        'd': {
+          action_: 'o=',
+          nextState: '/'
+        }
+      },
+      '/': {
+        'd': {
+          action_: 'o=',
+          nextState: '/'
+        }
+      },
+      '{...}|else': {
+        '0|d': {
+          action_: 'd=',
+          nextState: 'd'
+        },
+        'a': {
+          action_: ['space', 'd='],
+          nextState: 'd'
+        },
+        '/|q': {
+          action_: 'q=',
+          nextState: 'q'
+        }
+      }
+    }),
+    actions: {
+      'enumber': function enumber(buffer, m) {
+        /** @type {ParserOutput[]} */
+        var ret = [];
+
+        if (m[0] === "+-" || m[0] === "+/-") {
+          ret.push("\\pm ");
+        } else if (m[0]) {
+          ret.push(m[0]);
+        }
+
+        if (m[1]) {
+          mhchemParser.concatArray(ret, mhchemParser.go(m[1], 'pu-9,9'));
+
+          if (m[2]) {
+            if (m[2].match(/[,.]/)) {
+              mhchemParser.concatArray(ret, mhchemParser.go(m[2], 'pu-9,9'));
+            } else {
+              ret.push(m[2]);
+            }
+          }
+
+          m[3] = m[4] || m[3];
+
+          if (m[3]) {
+            m[3] = m[3].trim();
+
+            if (m[3] === "e" || m[3].substr(0, 1) === "*") {
+              ret.push({
+                type_: 'cdot'
+              });
+            } else {
+              ret.push({
+                type_: 'times'
+              });
+            }
+          }
+        }
+
+        if (m[3]) {
+          ret.push("10^{" + m[5] + "}");
+        }
+
+        return ret;
+      },
+      'number^': function number(buffer, m) {
+        /** @type {ParserOutput[]} */
+        var ret = [];
+
+        if (m[0] === "+-" || m[0] === "+/-") {
+          ret.push("\\pm ");
+        } else if (m[0]) {
+          ret.push(m[0]);
+        }
+
+        mhchemParser.concatArray(ret, mhchemParser.go(m[1], 'pu-9,9'));
+        ret.push("^{" + m[2] + "}");
+        return ret;
+      },
+      'operator': function operator(buffer, m, p1) {
+        return {
+          type_: 'operator',
+          kind_: p1 || m
+        };
+      },
+      'space': function space() {
+        return {
+          type_: 'pu-space-1'
+        };
+      },
+      'output': function output(buffer) {
+        /** @type {ParserOutput | ParserOutput[]} */
+        var ret;
+        var md = mhchemParser.patterns.match_('{(...)}', buffer.d || "");
+
+        if (md && md.remainder === '') {
+          buffer.d = md.match_;
+        }
+
+        var mq = mhchemParser.patterns.match_('{(...)}', buffer.q || "");
+
+        if (mq && mq.remainder === '') {
+          buffer.q = mq.match_;
+        }
+
+        if (buffer.d) {
+          buffer.d = buffer.d.replace(/\u00B0C|\^oC|\^{o}C/g, "{}^{\\circ}C");
+          buffer.d = buffer.d.replace(/\u00B0F|\^oF|\^{o}F/g, "{}^{\\circ}F");
+        }
+
+        if (buffer.q) {
+          // fraction
+          buffer.q = buffer.q.replace(/\u00B0C|\^oC|\^{o}C/g, "{}^{\\circ}C");
+          buffer.q = buffer.q.replace(/\u00B0F|\^oF|\^{o}F/g, "{}^{\\circ}F");
+          var b5 = {
+            d: mhchemParser.go(buffer.d, 'pu'),
+            q: mhchemParser.go(buffer.q, 'pu')
+          };
+
+          if (buffer.o === '//') {
+            ret = {
+              type_: 'pu-frac',
+              p1: b5.d,
+              p2: b5.q
+            };
+          } else {
+            ret = b5.d;
+
+            if (b5.d.length > 1 || b5.q.length > 1) {
+              ret.push({
+                type_: ' / '
+              });
+            } else {
+              ret.push({
+                type_: '/'
+              });
+            }
+
+            mhchemParser.concatArray(ret, b5.q);
+          }
+        } else {
+          // no fraction
+          ret = mhchemParser.go(buffer.d, 'pu-2');
+        }
+
+        for (var p in buffer) {
+          delete buffer[p];
+        }
+
+        return ret;
+      }
+    }
+  },
+  'pu-2': {
+    transitions: mhchemParser.createTransitions({
+      'empty': {
+        '*': {
+          action_: 'output'
+        }
+      },
+      '*': {
+        '*': {
+          action_: ['output', 'cdot'],
+          nextState: '0'
+        }
+      },
+      '\\x': {
+        '*': {
+          action_: 'rm='
+        }
+      },
+      'space': {
+        '*': {
+          action_: ['output', 'space'],
+          nextState: '0'
+        }
+      },
+      '^{(...)}|^(-1)': {
+        '1': {
+          action_: '^(-1)'
+        }
+      },
+      '-9.,9': {
+        '0': {
+          action_: 'rm=',
+          nextState: '0'
+        },
+        '1': {
+          action_: '^(-1)',
+          nextState: '0'
+        }
+      },
+      '{...}|else': {
+        '*': {
+          action_: 'rm=',
+          nextState: '1'
+        }
+      }
+    }),
+    actions: {
+      'cdot': function cdot() {
+        return {
+          type_: 'tight cdot'
+        };
+      },
+      '^(-1)': function _(buffer, m) {
+        buffer.rm += "^{" + m + "}";
+      },
+      'space': function space() {
+        return {
+          type_: 'pu-space-2'
+        };
+      },
+      'output': function output(buffer) {
+        /** @type {ParserOutput | ParserOutput[]} */
+        var ret = [];
+
+        if (buffer.rm) {
+          var mrm = mhchemParser.patterns.match_('{(...)}', buffer.rm || "");
+
+          if (mrm && mrm.remainder === '') {
+            ret = mhchemParser.go(mrm.match_, 'pu');
+          } else {
+            ret = {
+              type_: 'rm',
+              p1: buffer.rm
+            };
+          }
+        }
+
+        for (var p in buffer) {
+          delete buffer[p];
+        }
+
+        return ret;
+      }
+    }
+  },
+  'pu-9,9': {
+    transitions: mhchemParser.createTransitions({
+      'empty': {
+        '0': {
+          action_: 'output-0'
+        },
+        'o': {
+          action_: 'output-o'
+        }
+      },
+      ',': {
+        '0': {
+          action_: ['output-0', 'comma'],
+          nextState: 'o'
+        }
+      },
+      '.': {
+        '0': {
+          action_: ['output-0', 'copy'],
+          nextState: 'o'
+        }
+      },
+      'else': {
+        '*': {
+          action_: 'text='
+        }
+      }
+    }),
+    actions: {
+      'comma': function comma() {
+        return {
+          type_: 'commaDecimal'
+        };
+      },
+      'output-0': function output0(buffer) {
+        /** @type {ParserOutput[]} */
+        var ret = [];
+        buffer.text_ = buffer.text_ || "";
+
+        if (buffer.text_.length > 4) {
+          var a = buffer.text_.length % 3;
+
+          if (a === 0) {
+            a = 3;
+          }
+
+          for (var i = buffer.text_.length - 3; i > 0; i -= 3) {
+            ret.push(buffer.text_.substr(i, 3));
+            ret.push({
+              type_: '1000 separator'
+            });
+          }
+
+          ret.push(buffer.text_.substr(0, a));
+          ret.reverse();
+        } else {
+          ret.push(buffer.text_);
+        }
+
+        for (var p in buffer) {
+          delete buffer[p];
+        }
+
+        return ret;
+      },
+      'output-o': function outputO(buffer) {
+        /** @type {ParserOutput[]} */
+        var ret = [];
+        buffer.text_ = buffer.text_ || "";
+
+        if (buffer.text_.length > 4) {
+          var a = buffer.text_.length - 3;
+
+          for (var i = 0; i < a; i += 3) {
+            ret.push(buffer.text_.substr(i, 3));
+            ret.push({
+              type_: '1000 separator'
+            });
+          }
+
+          ret.push(buffer.text_.substr(i));
+        } else {
+          ret.push(buffer.text_);
+        }
+
+        for (var p in buffer) {
+          delete buffer[p];
+        }
+
+        return ret;
+      }
+    }
+  } //#endregion
+
+}; //
+// texify: Take MhchemParser output and convert it to TeX
+//
+
+/** @type {Texify} */
+
+var texify = {
+  go: function go(input, isInner) {
+    // (recursive, max 4 levels)
+    if (!input) {
+      return "";
+    }
+
+    var res = "";
+    var cee = false;
+
+    for (var i = 0; i < input.length; i++) {
+      var inputi = input[i];
+
+      if (typeof inputi === "string") {
+        res += inputi;
+      } else {
+        res += texify._go2(inputi);
+
+        if (inputi.type_ === '1st-level escape') {
+          cee = true;
+        }
+      }
+    }
+
+    if (!isInner && !cee && res) {
+      res = "{" + res + "}";
+    }
+
+    return res;
+  },
+  _goInner: function _goInner(input) {
+    if (!input) {
+      return input;
+    }
+
+    return texify.go(input, true);
+  },
+  _go2: function _go2(buf) {
+    /** @type {undefined | string} */
+    var res;
+
+    switch (buf.type_) {
+      case 'chemfive':
+        res = "";
+        var b5 = {
+          a: texify._goInner(buf.a),
+          b: texify._goInner(buf.b),
+          p: texify._goInner(buf.p),
+          o: texify._goInner(buf.o),
+          q: texify._goInner(buf.q),
+          d: texify._goInner(buf.d)
+        }; //
+        // a
+        //
+
+        if (b5.a) {
+          if (b5.a.match(/^[+\-]/)) {
+            b5.a = "{" + b5.a + "}";
+          }
+
+          res += b5.a + "\\,";
+        } //
+        // b and p
+        //
+
+
+        if (b5.b || b5.p) {
+          res += "{\\vphantom{X}}";
+          res += "^{\\hphantom{" + (b5.b || "") + "}}_{\\hphantom{" + (b5.p || "") + "}}";
+          res += "{\\vphantom{X}}";
+          res += "^{\\smash[t]{\\vphantom{2}}\\mathllap{" + (b5.b || "") + "}}";
+          res += "_{\\vphantom{2}\\mathllap{\\smash[t]{" + (b5.p || "") + "}}}";
+        } //
+        // o
+        //
+
+
+        if (b5.o) {
+          if (b5.o.match(/^[+\-]/)) {
+            b5.o = "{" + b5.o + "}";
+          }
+
+          res += b5.o;
+        } //
+        // q and d
+        //
+
+
+        if (buf.dType === 'kv') {
+          if (b5.d || b5.q) {
+            res += "{\\vphantom{X}}";
+          }
+
+          if (b5.d) {
+            res += "^{" + b5.d + "}";
+          }
+
+          if (b5.q) {
+            res += "_{\\smash[t]{" + b5.q + "}}";
+          }
+        } else if (buf.dType === 'oxidation') {
+          if (b5.d) {
+            res += "{\\vphantom{X}}";
+            res += "^{" + b5.d + "}";
+          }
+
+          if (b5.q) {
+            res += "{\\vphantom{X}}";
+            res += "_{\\smash[t]{" + b5.q + "}}";
+          }
+        } else {
+          if (b5.q) {
+            res += "{\\vphantom{X}}";
+            res += "_{\\smash[t]{" + b5.q + "}}";
+          }
+
+          if (b5.d) {
+            res += "{\\vphantom{X}}";
+            res += "^{" + b5.d + "}";
+          }
+        }
+
+        break;
+
+      case 'rm':
+        res = "\\mathrm{" + buf.p1 + "}";
+        break;
+
+      case 'text':
+        if (buf.p1.match(/[\^_]/)) {
+          buf.p1 = buf.p1.replace(" ", "~").replace("-", "\\text{-}");
+          res = "\\mathrm{" + buf.p1 + "}";
+        } else {
+          res = "\\text{" + buf.p1 + "}";
+        }
+
+        break;
+
+      case 'roman numeral':
+        res = "\\mathrm{" + buf.p1 + "}";
+        break;
+
+      case 'state of aggregation':
+        res = "\\mskip2mu " + texify._goInner(buf.p1);
+        break;
+
+      case 'state of aggregation subscript':
+        res = "\\mskip1mu " + texify._goInner(buf.p1);
+        break;
+
+      case 'bond':
+        res = texify._getBond(buf.kind_);
+
+        if (!res) {
+          throw ["MhchemErrorBond", "mhchem Error. Unknown bond type (" + buf.kind_ + ")"];
+        }
+
+        break;
+
+      case 'frac':
+        var c = "\\frac{" + buf.p1 + "}{" + buf.p2 + "}";
+        res = "\\mathchoice{\\textstyle" + c + "}{" + c + "}{" + c + "}{" + c + "}";
+        break;
+
+      case 'pu-frac':
+        var d = "\\frac{" + texify._goInner(buf.p1) + "}{" + texify._goInner(buf.p2) + "}";
+        res = "\\mathchoice{\\textstyle" + d + "}{" + d + "}{" + d + "}{" + d + "}";
+        break;
+
+      case 'tex-math':
+        res = buf.p1 + " ";
+        break;
+
+      case 'frac-ce':
+        res = "\\frac{" + texify._goInner(buf.p1) + "}{" + texify._goInner(buf.p2) + "}";
+        break;
+
+      case 'overset':
+        res = "\\overset{" + texify._goInner(buf.p1) + "}{" + texify._goInner(buf.p2) + "}";
+        break;
+
+      case 'underset':
+        res = "\\underset{" + texify._goInner(buf.p1) + "}{" + texify._goInner(buf.p2) + "}";
+        break;
+
+      case 'underbrace':
+        res = "\\underbrace{" + texify._goInner(buf.p1) + "}_{" + texify._goInner(buf.p2) + "}";
+        break;
+
+      case 'color':
+        res = "{\\color{" + buf.color1 + "}{" + texify._goInner(buf.color2) + "}}";
+        break;
+
+      case 'color0':
+        res = "\\color{" + buf.color + "}";
+        break;
+
+      case 'arrow':
+        var b6 = {
+          rd: texify._goInner(buf.rd),
+          rq: texify._goInner(buf.rq)
+        };
+
+        var arrow = "\\x" + texify._getArrow(buf.r);
+
+        if (b6.rq) {
+          arrow += "[{" + b6.rq + "}]";
+        }
+
+        if (b6.rd) {
+          arrow += "{" + b6.rd + "}";
+        } else {
+          arrow += "{}";
+        }
+
+        res = arrow;
+        break;
+
+      case 'operator':
+        res = texify._getOperator(buf.kind_);
+        break;
+
+      case '1st-level escape':
+        res = buf.p1 + " "; // &, \\\\, \\hlin
+
+        break;
+
+      case 'space':
+        res = " ";
+        break;
+
+      case 'entitySkip':
+        res = "~";
+        break;
+
+      case 'pu-space-1':
+        res = "~";
+        break;
+
+      case 'pu-space-2':
+        res = "\\mkern3mu ";
+        break;
+
+      case '1000 separator':
+        res = "\\mkern2mu ";
+        break;
+
+      case 'commaDecimal':
+        res = "{,}";
+        break;
+
+      case 'comma enumeration L':
+        res = "{" + buf.p1 + "}\\mkern6mu ";
+        break;
+
+      case 'comma enumeration M':
+        res = "{" + buf.p1 + "}\\mkern3mu ";
+        break;
+
+      case 'comma enumeration S':
+        res = "{" + buf.p1 + "}\\mkern1mu ";
+        break;
+
+      case 'hyphen':
+        res = "\\text{-}";
+        break;
+
+      case 'addition compound':
+        res = "\\,{\\cdot}\\,";
+        break;
+
+      case 'electron dot':
+        res = "\\mkern1mu \\bullet\\mkern1mu ";
+        break;
+
+      case 'KV x':
+        res = "{\\times}";
+        break;
+
+      case 'prime':
+        res = "\\prime ";
+        break;
+
+      case 'cdot':
+        res = "\\cdot ";
+        break;
+
+      case 'tight cdot':
+        res = "\\mkern1mu{\\cdot}\\mkern1mu ";
+        break;
+
+      case 'times':
+        res = "\\times ";
+        break;
+
+      case 'circa':
+        res = "{\\sim}";
+        break;
+
+      case '^':
+        res = "uparrow";
+        break;
+
+      case 'v':
+        res = "downarrow";
+        break;
+
+      case 'ellipsis':
+        res = "\\ldots ";
+        break;
+
+      case '/':
+        res = "/";
+        break;
+
+      case ' / ':
+        res = "\\,/\\,";
+        break;
+
+      default:
+        throw ["MhchemBugT", "mhchem bug T. Please report."];
+      // Missing texify rule or unknown MhchemParser output
+    }
+    return res;
+  },
+  _getArrow: function _getArrow(a) {
+    switch (a) {
+      case "->":
+        return "rightarrow";
+
+      case "\u2192":
+        return "rightarrow";
+
+      case "\u27F6":
+        return "rightarrow";
+
+      case "<-":
+        return "leftarrow";
+
+      case "<->":
+        return "leftrightarrow";
+
+      case "<-->":
+        return "rightleftarrows";
+
+      case "<=>":
+        return "rightleftharpoons";
+
+      case "\u21CC":
+        return "rightleftharpoons";
+
+      case "<=>>":
+        return "rightequilibrium";
+
+      case "<<=>":
+        return "leftequilibrium";
+
+      default:
+        throw ["MhchemBugT", "mhchem bug T. Please report."];
+    }
+  },
+  _getBond: function _getBond(a) {
+    switch (a) {
+      case "-":
+        return "{-}";
+
+      case "1":
+        return "{-}";
+
+      case "=":
+        return "{=}";
+
+      case "2":
+        return "{=}";
+
+      case "#":
+        return "{\\equiv}";
+
+      case "3":
+        return "{\\equiv}";
+
+      case "~":
+        return "{\\tripledash}";
+
+      case "~-":
+        return "{\\mathrlap{\\raisebox{-.1em}{$-$}}\\raisebox{.1em}{$\\tripledash$}}";
+
+      case "~=":
+        return "{\\mathrlap{\\raisebox{-.2em}{$-$}}\\mathrlap{\\raisebox{.2em}{$\\tripledash$}}-}";
+
+      case "~--":
+        return "{\\mathrlap{\\raisebox{-.2em}{$-$}}\\mathrlap{\\raisebox{.2em}{$\\tripledash$}}-}";
+
+      case "-~-":
+        return "{\\mathrlap{\\raisebox{-.2em}{$-$}}\\mathrlap{\\raisebox{.2em}{$-$}}\\tripledash}";
+
+      case "...":
+        return "{{\\cdot}{\\cdot}{\\cdot}}";
+
+      case "....":
+        return "{{\\cdot}{\\cdot}{\\cdot}{\\cdot}}";
+
+      case "->":
+        return "{\\rightarrow}";
+
+      case "<-":
+        return "{\\leftarrow}";
+
+      case "<":
+        return "{<}";
+
+      case ">":
+        return "{>}";
+
+      default:
+        throw ["MhchemBugT", "mhchem bug T. Please report."];
+    }
+  },
+  _getOperator: function _getOperator(a) {
+    switch (a) {
+      case "+":
+        return " {}+{} ";
+
+      case "-":
+        return " {}-{} ";
+
+      case "=":
+        return " {}={} ";
+
+      case "<":
+        return " {}<{} ";
+
+      case ">":
+        return " {}>{} ";
+
+      case "<<":
+        return " {}\\ll{} ";
+
+      case ">>":
+        return " {}\\gg{} ";
+
+      case "\\pm":
+        return " {}\\pm{} ";
+
+      case "\\approx":
+        return " {}\\approx{} ";
+
+      case "$\\approx$":
+        return " {}\\approx{} ";
+
+      case "v":
+        return " \\downarrow{} ";
+
+      case "(v)":
+        return " \\downarrow{} ";
+
+      case "^":
+        return " \\uparrow{} ";
+
+      case "(^)":
+        return " \\uparrow{} ";
+
+      default:
+        throw ["MhchemBugT", "mhchem bug T. Please report."];
+    }
+  }
+}; //

+ 881 - 0
public/lib/katex/contrib/render-a11y-string.js

@@ -0,0 +1,881 @@
+(function webpackUniversalModuleDefinition(root, factory) {
+	if(typeof exports === 'object' && typeof module === 'object')
+		module.exports = factory(require("katex"));
+	else if(typeof define === 'function' && define.amd)
+		define(["katex"], factory);
+	else {
+		var a = typeof exports === 'object' ? factory(require("katex")) : factory(root["katex"]);
+		for(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];
+	}
+})((typeof self !== 'undefined' ? self : this), function(__WEBPACK_EXTERNAL_MODULE__771__) {
+return /******/ (function() { // webpackBootstrap
+/******/ 	"use strict";
+/******/ 	var __webpack_modules__ = ({
+
+/***/ 771:
+/***/ (function(module) {
+
+module.exports = __WEBPACK_EXTERNAL_MODULE__771__;
+
+/***/ })
+
+/******/ 	});
+/************************************************************************/
+/******/ 	// The module cache
+/******/ 	var __webpack_module_cache__ = {};
+/******/ 	
+/******/ 	// The require function
+/******/ 	function __webpack_require__(moduleId) {
+/******/ 		// Check if module is in cache
+/******/ 		var cachedModule = __webpack_module_cache__[moduleId];
+/******/ 		if (cachedModule !== undefined) {
+/******/ 			return cachedModule.exports;
+/******/ 		}
+/******/ 		// Create a new module (and put it into the cache)
+/******/ 		var module = __webpack_module_cache__[moduleId] = {
+/******/ 			// no module.id needed
+/******/ 			// no module.loaded needed
+/******/ 			exports: {}
+/******/ 		};
+/******/ 	
+/******/ 		// Execute the module function
+/******/ 		__webpack_modules__[moduleId](module, module.exports, __webpack_require__);
+/******/ 	
+/******/ 		// Return the exports of the module
+/******/ 		return module.exports;
+/******/ 	}
+/******/ 	
+/************************************************************************/
+/******/ 	/* webpack/runtime/compat get default export */
+/******/ 	!function() {
+/******/ 		// getDefaultExport function for compatibility with non-harmony modules
+/******/ 		__webpack_require__.n = function(module) {
+/******/ 			var getter = module && module.__esModule ?
+/******/ 				function() { return module['default']; } :
+/******/ 				function() { return module; };
+/******/ 			__webpack_require__.d(getter, { a: getter });
+/******/ 			return getter;
+/******/ 		};
+/******/ 	}();
+/******/ 	
+/******/ 	/* webpack/runtime/define property getters */
+/******/ 	!function() {
+/******/ 		// define getter functions for harmony exports
+/******/ 		__webpack_require__.d = function(exports, definition) {
+/******/ 			for(var key in definition) {
+/******/ 				if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
+/******/ 					Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
+/******/ 				}
+/******/ 			}
+/******/ 		};
+/******/ 	}();
+/******/ 	
+/******/ 	/* webpack/runtime/hasOwnProperty shorthand */
+/******/ 	!function() {
+/******/ 		__webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }
+/******/ 	}();
+/******/ 	
+/************************************************************************/
+var __webpack_exports__ = {};
+// This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk.
+!function() {
+/* harmony import */ var katex__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(771);
+/* harmony import */ var katex__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(katex__WEBPACK_IMPORTED_MODULE_0__);
+/**
+ * renderA11yString returns a readable string.
+ *
+ * In some cases the string will have the proper semantic math
+ * meaning,:
+ *   renderA11yString("\\frac{1}{2}"")
+ *   -> "start fraction, 1, divided by, 2, end fraction"
+ *
+ * However, other cases do not:
+ *   renderA11yString("f(x) = x^2")
+ *   -> "f, left parenthesis, x, right parenthesis, equals, x, squared"
+ *
+ * The commas in the string aim to increase ease of understanding
+ * when read by a screenreader.
+ */
+// NOTE: since we're importing types here these files won't actually be
+// included in the build.
+// $FlowIgnore: we import the types directly anyways
+
+var stringMap = {
+  "(": "left parenthesis",
+  ")": "right parenthesis",
+  "[": "open bracket",
+  "]": "close bracket",
+  "\\{": "left brace",
+  "\\}": "right brace",
+  "\\lvert": "open vertical bar",
+  "\\rvert": "close vertical bar",
+  "|": "vertical bar",
+  "\\uparrow": "up arrow",
+  "\\Uparrow": "up arrow",
+  "\\downarrow": "down arrow",
+  "\\Downarrow": "down arrow",
+  "\\updownarrow": "up down arrow",
+  "\\leftarrow": "left arrow",
+  "\\Leftarrow": "left arrow",
+  "\\rightarrow": "right arrow",
+  "\\Rightarrow": "right arrow",
+  "\\langle": "open angle",
+  "\\rangle": "close angle",
+  "\\lfloor": "open floor",
+  "\\rfloor": "close floor",
+  "\\int": "integral",
+  "\\intop": "integral",
+  "\\lim": "limit",
+  "\\ln": "natural log",
+  "\\log": "log",
+  "\\sin": "sine",
+  "\\cos": "cosine",
+  "\\tan": "tangent",
+  "\\cot": "cotangent",
+  "\\sum": "sum",
+  "/": "slash",
+  ",": "comma",
+  ".": "point",
+  "-": "negative",
+  "+": "plus",
+  "~": "tilde",
+  ":": "colon",
+  "?": "question mark",
+  "'": "apostrophe",
+  "\\%": "percent",
+  " ": "space",
+  "\\ ": "space",
+  "\\$": "dollar sign",
+  "\\angle": "angle",
+  "\\degree": "degree",
+  "\\circ": "circle",
+  "\\vec": "vector",
+  "\\triangle": "triangle",
+  "\\pi": "pi",
+  "\\prime": "prime",
+  "\\infty": "infinity",
+  "\\alpha": "alpha",
+  "\\beta": "beta",
+  "\\gamma": "gamma",
+  "\\omega": "omega",
+  "\\theta": "theta",
+  "\\sigma": "sigma",
+  "\\lambda": "lambda",
+  "\\tau": "tau",
+  "\\Delta": "delta",
+  "\\delta": "delta",
+  "\\mu": "mu",
+  "\\rho": "rho",
+  "\\nabla": "del",
+  "\\ell": "ell",
+  "\\ldots": "dots",
+  // TODO: add entries for all accents
+  "\\hat": "hat",
+  "\\acute": "acute"
+};
+var powerMap = {
+  "prime": "prime",
+  "degree": "degrees",
+  "circle": "degrees",
+  "2": "squared",
+  "3": "cubed"
+};
+var openMap = {
+  "|": "open vertical bar",
+  ".": ""
+};
+var closeMap = {
+  "|": "close vertical bar",
+  ".": ""
+};
+var binMap = {
+  "+": "plus",
+  "-": "minus",
+  "\\pm": "plus minus",
+  "\\cdot": "dot",
+  "*": "times",
+  "/": "divided by",
+  "\\times": "times",
+  "\\div": "divided by",
+  "\\circ": "circle",
+  "\\bullet": "bullet"
+};
+var relMap = {
+  "=": "equals",
+  "\\approx": "approximately equals",
+  "≠": "does not equal",
+  "\\geq": "is greater than or equal to",
+  "\\ge": "is greater than or equal to",
+  "\\leq": "is less than or equal to",
+  "\\le": "is less than or equal to",
+  ">": "is greater than",
+  "<": "is less than",
+  "\\leftarrow": "left arrow",
+  "\\Leftarrow": "left arrow",
+  "\\rightarrow": "right arrow",
+  "\\Rightarrow": "right arrow",
+  ":": "colon"
+};
+var accentUnderMap = {
+  "\\underleftarrow": "left arrow",
+  "\\underrightarrow": "right arrow",
+  "\\underleftrightarrow": "left-right arrow",
+  "\\undergroup": "group",
+  "\\underlinesegment": "line segment",
+  "\\utilde": "tilde"
+};
+
+var buildString = function buildString(str, type, a11yStrings) {
+  if (!str) {
+    return;
+  }
+
+  var ret;
+
+  if (type === "open") {
+    ret = str in openMap ? openMap[str] : stringMap[str] || str;
+  } else if (type === "close") {
+    ret = str in closeMap ? closeMap[str] : stringMap[str] || str;
+  } else if (type === "bin") {
+    ret = binMap[str] || str;
+  } else if (type === "rel") {
+    ret = relMap[str] || str;
+  } else {
+    ret = stringMap[str] || str;
+  } // If the text to add is a number and there is already a string
+  // in the list and the last string is a number then we should
+  // combine them into a single number
+
+
+  if (/^\d+$/.test(ret) && a11yStrings.length > 0 && // TODO(kevinb): check that the last item in a11yStrings is a string
+  // I think we might be able to drop the nested arrays, which would make
+  // this easier to type
+  // $FlowFixMe
+  /^\d+$/.test(a11yStrings[a11yStrings.length - 1])) {
+    a11yStrings[a11yStrings.length - 1] += ret;
+  } else if (ret) {
+    a11yStrings.push(ret);
+  }
+};
+
+var buildRegion = function buildRegion(a11yStrings, callback) {
+  var regionStrings = [];
+  a11yStrings.push(regionStrings);
+  callback(regionStrings);
+};
+
+var handleObject = function handleObject(tree, a11yStrings, atomType) {
+  // Everything else is assumed to be an object...
+  switch (tree.type) {
+    case "accent":
+      {
+        buildRegion(a11yStrings, function (a11yStrings) {
+          buildA11yStrings(tree.base, a11yStrings, atomType);
+          a11yStrings.push("with");
+          buildString(tree.label, "normal", a11yStrings);
+          a11yStrings.push("on top");
+        });
+        break;
+      }
+
+    case "accentUnder":
+      {
+        buildRegion(a11yStrings, function (a11yStrings) {
+          buildA11yStrings(tree.base, a11yStrings, atomType);
+          a11yStrings.push("with");
+          buildString(accentUnderMap[tree.label], "normal", a11yStrings);
+          a11yStrings.push("underneath");
+        });
+        break;
+      }
+
+    case "accent-token":
+      {
+        // Used internally by accent symbols.
+        break;
+      }
+
+    case "atom":
+      {
+        var text = tree.text;
+
+        switch (tree.family) {
+          case "bin":
+            {
+              buildString(text, "bin", a11yStrings);
+              break;
+            }
+
+          case "close":
+            {
+              buildString(text, "close", a11yStrings);
+              break;
+            }
+          // TODO(kevinb): figure out what should be done for inner
+
+          case "inner":
+            {
+              buildString(tree.text, "inner", a11yStrings);
+              break;
+            }
+
+          case "open":
+            {
+              buildString(text, "open", a11yStrings);
+              break;
+            }
+
+          case "punct":
+            {
+              buildString(text, "punct", a11yStrings);
+              break;
+            }
+
+          case "rel":
+            {
+              buildString(text, "rel", a11yStrings);
+              break;
+            }
+
+          default:
+            {
+              tree.family;
+              throw new Error("\"" + tree.family + "\" is not a valid atom type");
+            }
+        }
+
+        break;
+      }
+
+    case "color":
+      {
+        var color = tree.color.replace(/katex-/, "");
+        buildRegion(a11yStrings, function (regionStrings) {
+          regionStrings.push("start color " + color);
+          buildA11yStrings(tree.body, regionStrings, atomType);
+          regionStrings.push("end color " + color);
+        });
+        break;
+      }
+
+    case "color-token":
+      {
+        // Used by \color, \colorbox, and \fcolorbox but not directly rendered.
+        // It's a leaf node and has no children so just break.
+        break;
+      }
+
+    case "delimsizing":
+      {
+        if (tree.delim && tree.delim !== ".") {
+          buildString(tree.delim, "normal", a11yStrings);
+        }
+
+        break;
+      }
+
+    case "genfrac":
+      {
+        buildRegion(a11yStrings, function (regionStrings) {
+          // genfrac can have unbalanced delimiters
+          var leftDelim = tree.leftDelim,
+              rightDelim = tree.rightDelim; // NOTE: Not sure if this is a safe assumption
+          // hasBarLine true -> fraction, false -> binomial
+
+          if (tree.hasBarLine) {
+            regionStrings.push("start fraction");
+            leftDelim && buildString(leftDelim, "open", regionStrings);
+            buildA11yStrings(tree.numer, regionStrings, atomType);
+            regionStrings.push("divided by");
+            buildA11yStrings(tree.denom, regionStrings, atomType);
+            rightDelim && buildString(rightDelim, "close", regionStrings);
+            regionStrings.push("end fraction");
+          } else {
+            regionStrings.push("start binomial");
+            leftDelim && buildString(leftDelim, "open", regionStrings);
+            buildA11yStrings(tree.numer, regionStrings, atomType);
+            regionStrings.push("over");
+            buildA11yStrings(tree.denom, regionStrings, atomType);
+            rightDelim && buildString(rightDelim, "close", regionStrings);
+            regionStrings.push("end binomial");
+          }
+        });
+        break;
+      }
+
+    case "hbox":
+      {
+        buildA11yStrings(tree.body, a11yStrings, atomType);
+        break;
+      }
+
+    case "kern":
+      {
+        // No op: we don't attempt to present kerning information
+        // to the screen reader.
+        break;
+      }
+
+    case "leftright":
+      {
+        buildRegion(a11yStrings, function (regionStrings) {
+          buildString(tree.left, "open", regionStrings);
+          buildA11yStrings(tree.body, regionStrings, atomType);
+          buildString(tree.right, "close", regionStrings);
+        });
+        break;
+      }
+
+    case "leftright-right":
+      {
+        // TODO: double check that this is a no-op
+        break;
+      }
+
+    case "lap":
+      {
+        buildA11yStrings(tree.body, a11yStrings, atomType);
+        break;
+      }
+
+    case "mathord":
+      {
+        buildString(tree.text, "normal", a11yStrings);
+        break;
+      }
+
+    case "op":
+      {
+        var body = tree.body,
+            name = tree.name;
+
+        if (body) {
+          buildA11yStrings(body, a11yStrings, atomType);
+        } else if (name) {
+          buildString(name, "normal", a11yStrings);
+        }
+
+        break;
+      }
+
+    case "op-token":
+      {
+        // Used internally by operator symbols.
+        buildString(tree.text, atomType, a11yStrings);
+        break;
+      }
+
+    case "ordgroup":
+      {
+        buildA11yStrings(tree.body, a11yStrings, atomType);
+        break;
+      }
+
+    case "overline":
+      {
+        buildRegion(a11yStrings, function (a11yStrings) {
+          a11yStrings.push("start overline");
+          buildA11yStrings(tree.body, a11yStrings, atomType);
+          a11yStrings.push("end overline");
+        });
+        break;
+      }
+
+    case "pmb":
+      {
+        a11yStrings.push("bold");
+        break;
+      }
+
+    case "phantom":
+      {
+        a11yStrings.push("empty space");
+        break;
+      }
+
+    case "raisebox":
+      {
+        buildA11yStrings(tree.body, a11yStrings, atomType);
+        break;
+      }
+
+    case "rule":
+      {
+        a11yStrings.push("rectangle");
+        break;
+      }
+
+    case "sizing":
+      {
+        buildA11yStrings(tree.body, a11yStrings, atomType);
+        break;
+      }
+
+    case "spacing":
+      {
+        a11yStrings.push("space");
+        break;
+      }
+
+    case "styling":
+      {
+        // We ignore the styling and just pass through the contents
+        buildA11yStrings(tree.body, a11yStrings, atomType);
+        break;
+      }
+
+    case "sqrt":
+      {
+        buildRegion(a11yStrings, function (regionStrings) {
+          var body = tree.body,
+              index = tree.index;
+
+          if (index) {
+            var indexString = flatten(buildA11yStrings(index, [], atomType)).join(",");
+
+            if (indexString === "3") {
+              regionStrings.push("cube root of");
+              buildA11yStrings(body, regionStrings, atomType);
+              regionStrings.push("end cube root");
+              return;
+            }
+
+            regionStrings.push("root");
+            regionStrings.push("start index");
+            buildA11yStrings(index, regionStrings, atomType);
+            regionStrings.push("end index");
+            return;
+          }
+
+          regionStrings.push("square root of");
+          buildA11yStrings(body, regionStrings, atomType);
+          regionStrings.push("end square root");
+        });
+        break;
+      }
+
+    case "supsub":
+      {
+        var base = tree.base,
+            sub = tree.sub,
+            sup = tree.sup;
+        var isLog = false;
+
+        if (base) {
+          buildA11yStrings(base, a11yStrings, atomType);
+          isLog = base.type === "op" && base.name === "\\log";
+        }
+
+        if (sub) {
+          var regionName = isLog ? "base" : "subscript";
+          buildRegion(a11yStrings, function (regionStrings) {
+            regionStrings.push("start " + regionName);
+            buildA11yStrings(sub, regionStrings, atomType);
+            regionStrings.push("end " + regionName);
+          });
+        }
+
+        if (sup) {
+          buildRegion(a11yStrings, function (regionStrings) {
+            var supString = flatten(buildA11yStrings(sup, [], atomType)).join(",");
+
+            if (supString in powerMap) {
+              regionStrings.push(powerMap[supString]);
+              return;
+            }
+
+            regionStrings.push("start superscript");
+            buildA11yStrings(sup, regionStrings, atomType);
+            regionStrings.push("end superscript");
+          });
+        }
+
+        break;
+      }
+
+    case "text":
+      {
+        // TODO: handle other fonts
+        if (tree.font === "\\textbf") {
+          buildRegion(a11yStrings, function (regionStrings) {
+            regionStrings.push("start bold text");
+            buildA11yStrings(tree.body, regionStrings, atomType);
+            regionStrings.push("end bold text");
+          });
+          break;
+        }
+
+        buildRegion(a11yStrings, function (regionStrings) {
+          regionStrings.push("start text");
+          buildA11yStrings(tree.body, regionStrings, atomType);
+          regionStrings.push("end text");
+        });
+        break;
+      }
+
+    case "textord":
+      {
+        buildString(tree.text, atomType, a11yStrings);
+        break;
+      }
+
+    case "smash":
+      {
+        buildA11yStrings(tree.body, a11yStrings, atomType);
+        break;
+      }
+
+    case "enclose":
+      {
+        // TODO: create a map for these.
+        // TODO: differentiate between a body with a single atom, e.g.
+        // "cancel a" instead of "start cancel, a, end cancel"
+        if (/cancel/.test(tree.label)) {
+          buildRegion(a11yStrings, function (regionStrings) {
+            regionStrings.push("start cancel");
+            buildA11yStrings(tree.body, regionStrings, atomType);
+            regionStrings.push("end cancel");
+          });
+          break;
+        } else if (/box/.test(tree.label)) {
+          buildRegion(a11yStrings, function (regionStrings) {
+            regionStrings.push("start box");
+            buildA11yStrings(tree.body, regionStrings, atomType);
+            regionStrings.push("end box");
+          });
+          break;
+        } else if (/sout/.test(tree.label)) {
+          buildRegion(a11yStrings, function (regionStrings) {
+            regionStrings.push("start strikeout");
+            buildA11yStrings(tree.body, regionStrings, atomType);
+            regionStrings.push("end strikeout");
+          });
+          break;
+        } else if (/phase/.test(tree.label)) {
+          buildRegion(a11yStrings, function (regionStrings) {
+            regionStrings.push("start phase angle");
+            buildA11yStrings(tree.body, regionStrings, atomType);
+            regionStrings.push("end phase angle");
+          });
+          break;
+        }
+
+        throw new Error("KaTeX-a11y: enclose node with " + tree.label + " not supported yet");
+      }
+
+    case "vcenter":
+      {
+        buildA11yStrings(tree.body, a11yStrings, atomType);
+        break;
+      }
+
+    case "vphantom":
+      {
+        throw new Error("KaTeX-a11y: vphantom not implemented yet");
+      }
+
+    case "hphantom":
+      {
+        throw new Error("KaTeX-a11y: hphantom not implemented yet");
+      }
+
+    case "operatorname":
+      {
+        buildA11yStrings(tree.body, a11yStrings, atomType);
+        break;
+      }
+
+    case "array":
+      {
+        throw new Error("KaTeX-a11y: array not implemented yet");
+      }
+
+    case "raw":
+      {
+        throw new Error("KaTeX-a11y: raw not implemented yet");
+      }
+
+    case "size":
+      {
+        // Although there are nodes of type "size" in the parse tree, they have
+        // no semantic meaning and should be ignored.
+        break;
+      }
+
+    case "url":
+      {
+        throw new Error("KaTeX-a11y: url not implemented yet");
+      }
+
+    case "tag":
+      {
+        throw new Error("KaTeX-a11y: tag not implemented yet");
+      }
+
+    case "verb":
+      {
+        buildString("start verbatim", "normal", a11yStrings);
+        buildString(tree.body, "normal", a11yStrings);
+        buildString("end verbatim", "normal", a11yStrings);
+        break;
+      }
+
+    case "environment":
+      {
+        throw new Error("KaTeX-a11y: environment not implemented yet");
+      }
+
+    case "horizBrace":
+      {
+        buildString("start " + tree.label.slice(1), "normal", a11yStrings);
+        buildA11yStrings(tree.base, a11yStrings, atomType);
+        buildString("end " + tree.label.slice(1), "normal", a11yStrings);
+        break;
+      }
+
+    case "infix":
+      {
+        // All infix nodes are replace with other nodes.
+        break;
+      }
+
+    case "includegraphics":
+      {
+        throw new Error("KaTeX-a11y: includegraphics not implemented yet");
+      }
+
+    case "font":
+      {
+        // TODO: callout the start/end of specific fonts
+        // TODO: map \BBb{N} to "the naturals" or something like that
+        buildA11yStrings(tree.body, a11yStrings, atomType);
+        break;
+      }
+
+    case "href":
+      {
+        throw new Error("KaTeX-a11y: href not implemented yet");
+      }
+
+    case "cr":
+      {
+        // This is used by environments.
+        throw new Error("KaTeX-a11y: cr not implemented yet");
+      }
+
+    case "underline":
+      {
+        buildRegion(a11yStrings, function (a11yStrings) {
+          a11yStrings.push("start underline");
+          buildA11yStrings(tree.body, a11yStrings, atomType);
+          a11yStrings.push("end underline");
+        });
+        break;
+      }
+
+    case "xArrow":
+      {
+        throw new Error("KaTeX-a11y: xArrow not implemented yet");
+      }
+
+    case "cdlabel":
+      {
+        throw new Error("KaTeX-a11y: cdlabel not implemented yet");
+      }
+
+    case "cdlabelparent":
+      {
+        throw new Error("KaTeX-a11y: cdlabelparent not implemented yet");
+      }
+
+    case "mclass":
+      {
+        // \neq and \ne are macros so we let "htmlmathml" render the mathmal
+        // side of things and extract the text from that.
+        var _atomType = tree.mclass.slice(1); // $FlowFixMe: drop the leading "m" from the values in mclass
+
+
+        buildA11yStrings(tree.body, a11yStrings, _atomType);
+        break;
+      }
+
+    case "mathchoice":
+      {
+        // TODO: track which which style we're using, e.g. dispaly, text, etc.
+        // default to text style if even that may not be the correct style
+        buildA11yStrings(tree.text, a11yStrings, atomType);
+        break;
+      }
+
+    case "htmlmathml":
+      {
+        buildA11yStrings(tree.mathml, a11yStrings, atomType);
+        break;
+      }
+
+    case "middle":
+      {
+        buildString(tree.delim, atomType, a11yStrings);
+        break;
+      }
+
+    case "internal":
+      {
+        // internal nodes are never included in the parse tree
+        break;
+      }
+
+    case "html":
+      {
+        buildA11yStrings(tree.body, a11yStrings, atomType);
+        break;
+      }
+
+    default:
+      tree.type;
+      throw new Error("KaTeX a11y un-recognized type: " + tree.type);
+  }
+};
+
+var buildA11yStrings = function buildA11yStrings(tree, a11yStrings, atomType) {
+  if (a11yStrings === void 0) {
+    a11yStrings = [];
+  }
+
+  if (tree instanceof Array) {
+    for (var i = 0; i < tree.length; i++) {
+      buildA11yStrings(tree[i], a11yStrings, atomType);
+    }
+  } else {
+    handleObject(tree, a11yStrings, atomType);
+  }
+
+  return a11yStrings;
+};
+
+var flatten = function flatten(array) {
+  var result = [];
+  array.forEach(function (item) {
+    if (item instanceof Array) {
+      result = result.concat(flatten(item));
+    } else {
+      result.push(item);
+    }
+  });
+  return result;
+};
+
+var renderA11yString = function renderA11yString(text, settings) {
+  var tree = katex__WEBPACK_IMPORTED_MODULE_0___default().__parse(text, settings);
+
+  var a11yStrings = buildA11yStrings(tree, [], "normal");
+  return flatten(a11yStrings).join(", ");
+};
+
+/* harmony default export */ __webpack_exports__["default"] = (renderA11yString);
+}();
+__webpack_exports__ = __webpack_exports__["default"];
+/******/ 	return __webpack_exports__;
+/******/ })()
+;
+});

File diff suppressed because it is too large
+ 0 - 0
public/lib/katex/contrib/render-a11y-string.min.js


+ 800 - 0
public/lib/katex/contrib/render-a11y-string.mjs

@@ -0,0 +1,800 @@
+import katex from '../katex.mjs';
+
+/**
+ * renderA11yString returns a readable string.
+ *
+ * In some cases the string will have the proper semantic math
+ * meaning,:
+ *   renderA11yString("\\frac{1}{2}"")
+ *   -> "start fraction, 1, divided by, 2, end fraction"
+ *
+ * However, other cases do not:
+ *   renderA11yString("f(x) = x^2")
+ *   -> "f, left parenthesis, x, right parenthesis, equals, x, squared"
+ *
+ * The commas in the string aim to increase ease of understanding
+ * when read by a screenreader.
+ */
+var stringMap = {
+  "(": "left parenthesis",
+  ")": "right parenthesis",
+  "[": "open bracket",
+  "]": "close bracket",
+  "\\{": "left brace",
+  "\\}": "right brace",
+  "\\lvert": "open vertical bar",
+  "\\rvert": "close vertical bar",
+  "|": "vertical bar",
+  "\\uparrow": "up arrow",
+  "\\Uparrow": "up arrow",
+  "\\downarrow": "down arrow",
+  "\\Downarrow": "down arrow",
+  "\\updownarrow": "up down arrow",
+  "\\leftarrow": "left arrow",
+  "\\Leftarrow": "left arrow",
+  "\\rightarrow": "right arrow",
+  "\\Rightarrow": "right arrow",
+  "\\langle": "open angle",
+  "\\rangle": "close angle",
+  "\\lfloor": "open floor",
+  "\\rfloor": "close floor",
+  "\\int": "integral",
+  "\\intop": "integral",
+  "\\lim": "limit",
+  "\\ln": "natural log",
+  "\\log": "log",
+  "\\sin": "sine",
+  "\\cos": "cosine",
+  "\\tan": "tangent",
+  "\\cot": "cotangent",
+  "\\sum": "sum",
+  "/": "slash",
+  ",": "comma",
+  ".": "point",
+  "-": "negative",
+  "+": "plus",
+  "~": "tilde",
+  ":": "colon",
+  "?": "question mark",
+  "'": "apostrophe",
+  "\\%": "percent",
+  " ": "space",
+  "\\ ": "space",
+  "\\$": "dollar sign",
+  "\\angle": "angle",
+  "\\degree": "degree",
+  "\\circ": "circle",
+  "\\vec": "vector",
+  "\\triangle": "triangle",
+  "\\pi": "pi",
+  "\\prime": "prime",
+  "\\infty": "infinity",
+  "\\alpha": "alpha",
+  "\\beta": "beta",
+  "\\gamma": "gamma",
+  "\\omega": "omega",
+  "\\theta": "theta",
+  "\\sigma": "sigma",
+  "\\lambda": "lambda",
+  "\\tau": "tau",
+  "\\Delta": "delta",
+  "\\delta": "delta",
+  "\\mu": "mu",
+  "\\rho": "rho",
+  "\\nabla": "del",
+  "\\ell": "ell",
+  "\\ldots": "dots",
+  // TODO: add entries for all accents
+  "\\hat": "hat",
+  "\\acute": "acute"
+};
+var powerMap = {
+  "prime": "prime",
+  "degree": "degrees",
+  "circle": "degrees",
+  "2": "squared",
+  "3": "cubed"
+};
+var openMap = {
+  "|": "open vertical bar",
+  ".": ""
+};
+var closeMap = {
+  "|": "close vertical bar",
+  ".": ""
+};
+var binMap = {
+  "+": "plus",
+  "-": "minus",
+  "\\pm": "plus minus",
+  "\\cdot": "dot",
+  "*": "times",
+  "/": "divided by",
+  "\\times": "times",
+  "\\div": "divided by",
+  "\\circ": "circle",
+  "\\bullet": "bullet"
+};
+var relMap = {
+  "=": "equals",
+  "\\approx": "approximately equals",
+  "≠": "does not equal",
+  "\\geq": "is greater than or equal to",
+  "\\ge": "is greater than or equal to",
+  "\\leq": "is less than or equal to",
+  "\\le": "is less than or equal to",
+  ">": "is greater than",
+  "<": "is less than",
+  "\\leftarrow": "left arrow",
+  "\\Leftarrow": "left arrow",
+  "\\rightarrow": "right arrow",
+  "\\Rightarrow": "right arrow",
+  ":": "colon"
+};
+var accentUnderMap = {
+  "\\underleftarrow": "left arrow",
+  "\\underrightarrow": "right arrow",
+  "\\underleftrightarrow": "left-right arrow",
+  "\\undergroup": "group",
+  "\\underlinesegment": "line segment",
+  "\\utilde": "tilde"
+};
+
+var buildString = (str, type, a11yStrings) => {
+  if (!str) {
+    return;
+  }
+
+  var ret;
+
+  if (type === "open") {
+    ret = str in openMap ? openMap[str] : stringMap[str] || str;
+  } else if (type === "close") {
+    ret = str in closeMap ? closeMap[str] : stringMap[str] || str;
+  } else if (type === "bin") {
+    ret = binMap[str] || str;
+  } else if (type === "rel") {
+    ret = relMap[str] || str;
+  } else {
+    ret = stringMap[str] || str;
+  } // If the text to add is a number and there is already a string
+  // in the list and the last string is a number then we should
+  // combine them into a single number
+
+
+  if (/^\d+$/.test(ret) && a11yStrings.length > 0 && // TODO(kevinb): check that the last item in a11yStrings is a string
+  // I think we might be able to drop the nested arrays, which would make
+  // this easier to type
+  // $FlowFixMe
+  /^\d+$/.test(a11yStrings[a11yStrings.length - 1])) {
+    a11yStrings[a11yStrings.length - 1] += ret;
+  } else if (ret) {
+    a11yStrings.push(ret);
+  }
+};
+
+var buildRegion = (a11yStrings, callback) => {
+  var regionStrings = [];
+  a11yStrings.push(regionStrings);
+  callback(regionStrings);
+};
+
+var handleObject = (tree, a11yStrings, atomType) => {
+  // Everything else is assumed to be an object...
+  switch (tree.type) {
+    case "accent":
+      {
+        buildRegion(a11yStrings, a11yStrings => {
+          buildA11yStrings(tree.base, a11yStrings, atomType);
+          a11yStrings.push("with");
+          buildString(tree.label, "normal", a11yStrings);
+          a11yStrings.push("on top");
+        });
+        break;
+      }
+
+    case "accentUnder":
+      {
+        buildRegion(a11yStrings, a11yStrings => {
+          buildA11yStrings(tree.base, a11yStrings, atomType);
+          a11yStrings.push("with");
+          buildString(accentUnderMap[tree.label], "normal", a11yStrings);
+          a11yStrings.push("underneath");
+        });
+        break;
+      }
+
+    case "accent-token":
+      {
+        // Used internally by accent symbols.
+        break;
+      }
+
+    case "atom":
+      {
+        var {
+          text
+        } = tree;
+
+        switch (tree.family) {
+          case "bin":
+            {
+              buildString(text, "bin", a11yStrings);
+              break;
+            }
+
+          case "close":
+            {
+              buildString(text, "close", a11yStrings);
+              break;
+            }
+          // TODO(kevinb): figure out what should be done for inner
+
+          case "inner":
+            {
+              buildString(tree.text, "inner", a11yStrings);
+              break;
+            }
+
+          case "open":
+            {
+              buildString(text, "open", a11yStrings);
+              break;
+            }
+
+          case "punct":
+            {
+              buildString(text, "punct", a11yStrings);
+              break;
+            }
+
+          case "rel":
+            {
+              buildString(text, "rel", a11yStrings);
+              break;
+            }
+
+          default:
+            {
+              tree.family;
+              throw new Error("\"" + tree.family + "\" is not a valid atom type");
+            }
+        }
+
+        break;
+      }
+
+    case "color":
+      {
+        var color = tree.color.replace(/katex-/, "");
+        buildRegion(a11yStrings, regionStrings => {
+          regionStrings.push("start color " + color);
+          buildA11yStrings(tree.body, regionStrings, atomType);
+          regionStrings.push("end color " + color);
+        });
+        break;
+      }
+
+    case "color-token":
+      {
+        // Used by \color, \colorbox, and \fcolorbox but not directly rendered.
+        // It's a leaf node and has no children so just break.
+        break;
+      }
+
+    case "delimsizing":
+      {
+        if (tree.delim && tree.delim !== ".") {
+          buildString(tree.delim, "normal", a11yStrings);
+        }
+
+        break;
+      }
+
+    case "genfrac":
+      {
+        buildRegion(a11yStrings, regionStrings => {
+          // genfrac can have unbalanced delimiters
+          var {
+            leftDelim,
+            rightDelim
+          } = tree; // NOTE: Not sure if this is a safe assumption
+          // hasBarLine true -> fraction, false -> binomial
+
+          if (tree.hasBarLine) {
+            regionStrings.push("start fraction");
+            leftDelim && buildString(leftDelim, "open", regionStrings);
+            buildA11yStrings(tree.numer, regionStrings, atomType);
+            regionStrings.push("divided by");
+            buildA11yStrings(tree.denom, regionStrings, atomType);
+            rightDelim && buildString(rightDelim, "close", regionStrings);
+            regionStrings.push("end fraction");
+          } else {
+            regionStrings.push("start binomial");
+            leftDelim && buildString(leftDelim, "open", regionStrings);
+            buildA11yStrings(tree.numer, regionStrings, atomType);
+            regionStrings.push("over");
+            buildA11yStrings(tree.denom, regionStrings, atomType);
+            rightDelim && buildString(rightDelim, "close", regionStrings);
+            regionStrings.push("end binomial");
+          }
+        });
+        break;
+      }
+
+    case "hbox":
+      {
+        buildA11yStrings(tree.body, a11yStrings, atomType);
+        break;
+      }
+
+    case "kern":
+      {
+        // No op: we don't attempt to present kerning information
+        // to the screen reader.
+        break;
+      }
+
+    case "leftright":
+      {
+        buildRegion(a11yStrings, regionStrings => {
+          buildString(tree.left, "open", regionStrings);
+          buildA11yStrings(tree.body, regionStrings, atomType);
+          buildString(tree.right, "close", regionStrings);
+        });
+        break;
+      }
+
+    case "leftright-right":
+      {
+        // TODO: double check that this is a no-op
+        break;
+      }
+
+    case "lap":
+      {
+        buildA11yStrings(tree.body, a11yStrings, atomType);
+        break;
+      }
+
+    case "mathord":
+      {
+        buildString(tree.text, "normal", a11yStrings);
+        break;
+      }
+
+    case "op":
+      {
+        var {
+          body,
+          name
+        } = tree;
+
+        if (body) {
+          buildA11yStrings(body, a11yStrings, atomType);
+        } else if (name) {
+          buildString(name, "normal", a11yStrings);
+        }
+
+        break;
+      }
+
+    case "op-token":
+      {
+        // Used internally by operator symbols.
+        buildString(tree.text, atomType, a11yStrings);
+        break;
+      }
+
+    case "ordgroup":
+      {
+        buildA11yStrings(tree.body, a11yStrings, atomType);
+        break;
+      }
+
+    case "overline":
+      {
+        buildRegion(a11yStrings, function (a11yStrings) {
+          a11yStrings.push("start overline");
+          buildA11yStrings(tree.body, a11yStrings, atomType);
+          a11yStrings.push("end overline");
+        });
+        break;
+      }
+
+    case "pmb":
+      {
+        a11yStrings.push("bold");
+        break;
+      }
+
+    case "phantom":
+      {
+        a11yStrings.push("empty space");
+        break;
+      }
+
+    case "raisebox":
+      {
+        buildA11yStrings(tree.body, a11yStrings, atomType);
+        break;
+      }
+
+    case "rule":
+      {
+        a11yStrings.push("rectangle");
+        break;
+      }
+
+    case "sizing":
+      {
+        buildA11yStrings(tree.body, a11yStrings, atomType);
+        break;
+      }
+
+    case "spacing":
+      {
+        a11yStrings.push("space");
+        break;
+      }
+
+    case "styling":
+      {
+        // We ignore the styling and just pass through the contents
+        buildA11yStrings(tree.body, a11yStrings, atomType);
+        break;
+      }
+
+    case "sqrt":
+      {
+        buildRegion(a11yStrings, regionStrings => {
+          var {
+            body,
+            index
+          } = tree;
+
+          if (index) {
+            var indexString = flatten(buildA11yStrings(index, [], atomType)).join(",");
+
+            if (indexString === "3") {
+              regionStrings.push("cube root of");
+              buildA11yStrings(body, regionStrings, atomType);
+              regionStrings.push("end cube root");
+              return;
+            }
+
+            regionStrings.push("root");
+            regionStrings.push("start index");
+            buildA11yStrings(index, regionStrings, atomType);
+            regionStrings.push("end index");
+            return;
+          }
+
+          regionStrings.push("square root of");
+          buildA11yStrings(body, regionStrings, atomType);
+          regionStrings.push("end square root");
+        });
+        break;
+      }
+
+    case "supsub":
+      {
+        var {
+          base,
+          sub,
+          sup
+        } = tree;
+        var isLog = false;
+
+        if (base) {
+          buildA11yStrings(base, a11yStrings, atomType);
+          isLog = base.type === "op" && base.name === "\\log";
+        }
+
+        if (sub) {
+          var regionName = isLog ? "base" : "subscript";
+          buildRegion(a11yStrings, function (regionStrings) {
+            regionStrings.push("start " + regionName);
+            buildA11yStrings(sub, regionStrings, atomType);
+            regionStrings.push("end " + regionName);
+          });
+        }
+
+        if (sup) {
+          buildRegion(a11yStrings, function (regionStrings) {
+            var supString = flatten(buildA11yStrings(sup, [], atomType)).join(",");
+
+            if (supString in powerMap) {
+              regionStrings.push(powerMap[supString]);
+              return;
+            }
+
+            regionStrings.push("start superscript");
+            buildA11yStrings(sup, regionStrings, atomType);
+            regionStrings.push("end superscript");
+          });
+        }
+
+        break;
+      }
+
+    case "text":
+      {
+        // TODO: handle other fonts
+        if (tree.font === "\\textbf") {
+          buildRegion(a11yStrings, function (regionStrings) {
+            regionStrings.push("start bold text");
+            buildA11yStrings(tree.body, regionStrings, atomType);
+            regionStrings.push("end bold text");
+          });
+          break;
+        }
+
+        buildRegion(a11yStrings, function (regionStrings) {
+          regionStrings.push("start text");
+          buildA11yStrings(tree.body, regionStrings, atomType);
+          regionStrings.push("end text");
+        });
+        break;
+      }
+
+    case "textord":
+      {
+        buildString(tree.text, atomType, a11yStrings);
+        break;
+      }
+
+    case "smash":
+      {
+        buildA11yStrings(tree.body, a11yStrings, atomType);
+        break;
+      }
+
+    case "enclose":
+      {
+        // TODO: create a map for these.
+        // TODO: differentiate between a body with a single atom, e.g.
+        // "cancel a" instead of "start cancel, a, end cancel"
+        if (/cancel/.test(tree.label)) {
+          buildRegion(a11yStrings, function (regionStrings) {
+            regionStrings.push("start cancel");
+            buildA11yStrings(tree.body, regionStrings, atomType);
+            regionStrings.push("end cancel");
+          });
+          break;
+        } else if (/box/.test(tree.label)) {
+          buildRegion(a11yStrings, function (regionStrings) {
+            regionStrings.push("start box");
+            buildA11yStrings(tree.body, regionStrings, atomType);
+            regionStrings.push("end box");
+          });
+          break;
+        } else if (/sout/.test(tree.label)) {
+          buildRegion(a11yStrings, function (regionStrings) {
+            regionStrings.push("start strikeout");
+            buildA11yStrings(tree.body, regionStrings, atomType);
+            regionStrings.push("end strikeout");
+          });
+          break;
+        } else if (/phase/.test(tree.label)) {
+          buildRegion(a11yStrings, function (regionStrings) {
+            regionStrings.push("start phase angle");
+            buildA11yStrings(tree.body, regionStrings, atomType);
+            regionStrings.push("end phase angle");
+          });
+          break;
+        }
+
+        throw new Error("KaTeX-a11y: enclose node with " + tree.label + " not supported yet");
+      }
+
+    case "vcenter":
+      {
+        buildA11yStrings(tree.body, a11yStrings, atomType);
+        break;
+      }
+
+    case "vphantom":
+      {
+        throw new Error("KaTeX-a11y: vphantom not implemented yet");
+      }
+
+    case "hphantom":
+      {
+        throw new Error("KaTeX-a11y: hphantom not implemented yet");
+      }
+
+    case "operatorname":
+      {
+        buildA11yStrings(tree.body, a11yStrings, atomType);
+        break;
+      }
+
+    case "array":
+      {
+        throw new Error("KaTeX-a11y: array not implemented yet");
+      }
+
+    case "raw":
+      {
+        throw new Error("KaTeX-a11y: raw not implemented yet");
+      }
+
+    case "size":
+      {
+        // Although there are nodes of type "size" in the parse tree, they have
+        // no semantic meaning and should be ignored.
+        break;
+      }
+
+    case "url":
+      {
+        throw new Error("KaTeX-a11y: url not implemented yet");
+      }
+
+    case "tag":
+      {
+        throw new Error("KaTeX-a11y: tag not implemented yet");
+      }
+
+    case "verb":
+      {
+        buildString("start verbatim", "normal", a11yStrings);
+        buildString(tree.body, "normal", a11yStrings);
+        buildString("end verbatim", "normal", a11yStrings);
+        break;
+      }
+
+    case "environment":
+      {
+        throw new Error("KaTeX-a11y: environment not implemented yet");
+      }
+
+    case "horizBrace":
+      {
+        buildString("start " + tree.label.slice(1), "normal", a11yStrings);
+        buildA11yStrings(tree.base, a11yStrings, atomType);
+        buildString("end " + tree.label.slice(1), "normal", a11yStrings);
+        break;
+      }
+
+    case "infix":
+      {
+        // All infix nodes are replace with other nodes.
+        break;
+      }
+
+    case "includegraphics":
+      {
+        throw new Error("KaTeX-a11y: includegraphics not implemented yet");
+      }
+
+    case "font":
+      {
+        // TODO: callout the start/end of specific fonts
+        // TODO: map \BBb{N} to "the naturals" or something like that
+        buildA11yStrings(tree.body, a11yStrings, atomType);
+        break;
+      }
+
+    case "href":
+      {
+        throw new Error("KaTeX-a11y: href not implemented yet");
+      }
+
+    case "cr":
+      {
+        // This is used by environments.
+        throw new Error("KaTeX-a11y: cr not implemented yet");
+      }
+
+    case "underline":
+      {
+        buildRegion(a11yStrings, function (a11yStrings) {
+          a11yStrings.push("start underline");
+          buildA11yStrings(tree.body, a11yStrings, atomType);
+          a11yStrings.push("end underline");
+        });
+        break;
+      }
+
+    case "xArrow":
+      {
+        throw new Error("KaTeX-a11y: xArrow not implemented yet");
+      }
+
+    case "cdlabel":
+      {
+        throw new Error("KaTeX-a11y: cdlabel not implemented yet");
+      }
+
+    case "cdlabelparent":
+      {
+        throw new Error("KaTeX-a11y: cdlabelparent not implemented yet");
+      }
+
+    case "mclass":
+      {
+        // \neq and \ne are macros so we let "htmlmathml" render the mathmal
+        // side of things and extract the text from that.
+        var _atomType = tree.mclass.slice(1); // $FlowFixMe: drop the leading "m" from the values in mclass
+
+
+        buildA11yStrings(tree.body, a11yStrings, _atomType);
+        break;
+      }
+
+    case "mathchoice":
+      {
+        // TODO: track which which style we're using, e.g. dispaly, text, etc.
+        // default to text style if even that may not be the correct style
+        buildA11yStrings(tree.text, a11yStrings, atomType);
+        break;
+      }
+
+    case "htmlmathml":
+      {
+        buildA11yStrings(tree.mathml, a11yStrings, atomType);
+        break;
+      }
+
+    case "middle":
+      {
+        buildString(tree.delim, atomType, a11yStrings);
+        break;
+      }
+
+    case "internal":
+      {
+        // internal nodes are never included in the parse tree
+        break;
+      }
+
+    case "html":
+      {
+        buildA11yStrings(tree.body, a11yStrings, atomType);
+        break;
+      }
+
+    default:
+      tree.type;
+      throw new Error("KaTeX a11y un-recognized type: " + tree.type);
+  }
+};
+
+var buildA11yStrings = function buildA11yStrings(tree, a11yStrings, atomType) {
+  if (a11yStrings === void 0) {
+    a11yStrings = [];
+  }
+
+  if (tree instanceof Array) {
+    for (var i = 0; i < tree.length; i++) {
+      buildA11yStrings(tree[i], a11yStrings, atomType);
+    }
+  } else {
+    handleObject(tree, a11yStrings, atomType);
+  }
+
+  return a11yStrings;
+};
+
+var flatten = function flatten(array) {
+  var result = [];
+  array.forEach(function (item) {
+    if (item instanceof Array) {
+      result = result.concat(flatten(item));
+    } else {
+      result.push(item);
+    }
+  });
+  return result;
+};
+
+var renderA11yString = function renderA11yString(text, settings) {
+  var tree = katex.__parse(text, settings);
+
+  var a11yStrings = buildA11yStrings(tree, [], "normal");
+  return flatten(a11yStrings).join(", ");
+};
+
+export { renderA11yString as default };

BIN
public/lib/katex/fonts/KaTeX_AMS-Regular.ttf


BIN
public/lib/katex/fonts/KaTeX_AMS-Regular.woff


BIN
public/lib/katex/fonts/KaTeX_AMS-Regular.woff2


BIN
public/lib/katex/fonts/KaTeX_Caligraphic-Bold.ttf


BIN
public/lib/katex/fonts/KaTeX_Caligraphic-Bold.woff


BIN
public/lib/katex/fonts/KaTeX_Caligraphic-Bold.woff2


BIN
public/lib/katex/fonts/KaTeX_Caligraphic-Regular.ttf


BIN
public/lib/katex/fonts/KaTeX_Caligraphic-Regular.woff


BIN
public/lib/katex/fonts/KaTeX_Caligraphic-Regular.woff2


BIN
public/lib/katex/fonts/KaTeX_Fraktur-Bold.ttf


BIN
public/lib/katex/fonts/KaTeX_Fraktur-Bold.woff


BIN
public/lib/katex/fonts/KaTeX_Fraktur-Bold.woff2


BIN
public/lib/katex/fonts/KaTeX_Fraktur-Regular.ttf


BIN
public/lib/katex/fonts/KaTeX_Fraktur-Regular.woff


BIN
public/lib/katex/fonts/KaTeX_Fraktur-Regular.woff2


BIN
public/lib/katex/fonts/KaTeX_Main-Bold.ttf


BIN
public/lib/katex/fonts/KaTeX_Main-Bold.woff


BIN
public/lib/katex/fonts/KaTeX_Main-Bold.woff2


BIN
public/lib/katex/fonts/KaTeX_Main-BoldItalic.ttf


BIN
public/lib/katex/fonts/KaTeX_Main-BoldItalic.woff


BIN
public/lib/katex/fonts/KaTeX_Main-BoldItalic.woff2


BIN
public/lib/katex/fonts/KaTeX_Main-Italic.ttf


BIN
public/lib/katex/fonts/KaTeX_Main-Italic.woff


BIN
public/lib/katex/fonts/KaTeX_Main-Italic.woff2


BIN
public/lib/katex/fonts/KaTeX_Main-Regular.ttf


BIN
public/lib/katex/fonts/KaTeX_Main-Regular.woff


BIN
public/lib/katex/fonts/KaTeX_Main-Regular.woff2


BIN
public/lib/katex/fonts/KaTeX_Math-BoldItalic.ttf


BIN
public/lib/katex/fonts/KaTeX_Math-BoldItalic.woff


BIN
public/lib/katex/fonts/KaTeX_Math-BoldItalic.woff2


BIN
public/lib/katex/fonts/KaTeX_Math-Italic.ttf


BIN
public/lib/katex/fonts/KaTeX_Math-Italic.woff


BIN
public/lib/katex/fonts/KaTeX_Math-Italic.woff2


BIN
public/lib/katex/fonts/KaTeX_SansSerif-Bold.ttf


BIN
public/lib/katex/fonts/KaTeX_SansSerif-Bold.woff


BIN
public/lib/katex/fonts/KaTeX_SansSerif-Bold.woff2


BIN
public/lib/katex/fonts/KaTeX_SansSerif-Italic.ttf


BIN
public/lib/katex/fonts/KaTeX_SansSerif-Italic.woff


BIN
public/lib/katex/fonts/KaTeX_SansSerif-Italic.woff2


BIN
public/lib/katex/fonts/KaTeX_SansSerif-Regular.ttf


BIN
public/lib/katex/fonts/KaTeX_SansSerif-Regular.woff


BIN
public/lib/katex/fonts/KaTeX_SansSerif-Regular.woff2


BIN
public/lib/katex/fonts/KaTeX_Script-Regular.ttf


BIN
public/lib/katex/fonts/KaTeX_Script-Regular.woff


BIN
public/lib/katex/fonts/KaTeX_Script-Regular.woff2


BIN
public/lib/katex/fonts/KaTeX_Size1-Regular.ttf


BIN
public/lib/katex/fonts/KaTeX_Size1-Regular.woff


BIN
public/lib/katex/fonts/KaTeX_Size1-Regular.woff2


BIN
public/lib/katex/fonts/KaTeX_Size2-Regular.ttf


Some files were not shown because too many files changed in this diff