katex 0.16.32 → 0.16.34

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (126) hide show
  1. package/README.md +3 -3
  2. package/contrib/auto-render/{auto-render.js → auto-render.ts} +41 -19
  3. package/contrib/auto-render/{splitAtDelimiters.js → splitAtDelimiters.ts} +18 -4
  4. package/contrib/auto-render/test/{auto-render-spec.js → auto-render-spec.ts} +10 -2
  5. package/contrib/copy-tex/README.md +2 -2
  6. package/contrib/copy-tex/{copy-tex.js → copy-tex.ts} +4 -6
  7. package/contrib/copy-tex/{katex2tex.js → katex2tex.ts} +2 -3
  8. package/contrib/mathtex-script-type/README.md +5 -5
  9. package/contrib/mhchem/README.md +1 -1
  10. package/contrib/render-a11y-string/{render-a11y-string.js → render-a11y-string.ts} +18 -33
  11. package/contrib/render-a11y-string/test/{render-a11y-string-spec.js → render-a11y-string-spec.ts} +0 -1
  12. package/dist/README.md +3 -3
  13. package/dist/contrib/auto-render.js +24 -57
  14. package/dist/contrib/auto-render.min.js +1 -1
  15. package/dist/contrib/auto-render.mjs +16586 -210
  16. package/dist/contrib/copy-tex.js +23 -37
  17. package/dist/contrib/copy-tex.min.js +1 -1
  18. package/dist/contrib/copy-tex.mjs +77 -95
  19. package/dist/contrib/mathtex-script-type.js +0 -3
  20. package/dist/contrib/mathtex-script-type.mjs +16427 -4
  21. package/dist/contrib/mhchem.js +55 -303
  22. package/dist/contrib/mhchem.mjs +12884 -723
  23. package/dist/contrib/render-a11y-string.js +13 -108
  24. package/dist/contrib/render-a11y-string.min.js +1 -1
  25. package/dist/contrib/render-a11y-string.mjs +17020 -760
  26. package/dist/katex-swap.css +2 -1
  27. package/dist/katex-swap.min.css +1 -1
  28. package/dist/katex.css +2 -1
  29. package/dist/katex.js +4547 -5680
  30. package/dist/katex.min.css +1 -1
  31. package/dist/katex.min.js +1 -1
  32. package/dist/katex.mjs +11854 -13828
  33. package/{katex.js → katex.ts} +8 -5
  34. package/package.json +34 -31
  35. package/src/{Lexer.js → Lexer.ts} +1 -2
  36. package/src/{MacroExpander.js → MacroExpander.ts} +11 -15
  37. package/src/{Namespace.js → Namespace.ts} +4 -6
  38. package/src/{Options.js → Options.ts} +7 -12
  39. package/src/{ParseError.js → ParseError.ts} +16 -26
  40. package/src/{Parser.js → Parser.ts} +68 -56
  41. package/src/{Settings.js → Settings.ts} +70 -70
  42. package/src/{SourceLocation.js → SourceLocation.ts} +6 -7
  43. package/src/{Style.js → Style.ts} +4 -5
  44. package/src/{Token.js → Token.ts} +8 -6
  45. package/src/{buildCommon.js → buildCommon.ts} +62 -55
  46. package/src/{buildHTML.js → buildHTML.ts} +29 -25
  47. package/src/{buildMathML.js → buildMathML.ts} +15 -13
  48. package/src/{buildTree.js → buildTree.ts} +1 -2
  49. package/src/{defineEnvironment.js → defineEnvironment.ts} +26 -27
  50. package/src/{defineFunction.js → defineFunction.ts} +54 -56
  51. package/src/{defineMacro.js → defineMacro.ts} +12 -13
  52. package/src/{delimiter.js → delimiter.ts} +19 -17
  53. package/src/{domTree.js → domTree.ts} +94 -103
  54. package/src/environments/{array.js → array.ts} +109 -99
  55. package/src/environments/{cd.js → cd.ts} +9 -11
  56. package/src/{environments.js → environments.ts} +0 -1
  57. package/src/{fontMetrics.js → fontMetrics.ts} +10 -12
  58. package/src/fontMetricsData.d.ts +3 -0
  59. package/src/functions/{accent.js → accent.ts} +1 -2
  60. package/src/functions/{accentunder.js → accentunder.ts} +0 -1
  61. package/src/functions/{arrow.js → arrow.ts} +4 -6
  62. package/src/functions/{char.js → char.ts} +0 -1
  63. package/src/functions/{color.js → color.ts} +5 -6
  64. package/src/functions/{cr.js → cr.ts} +0 -1
  65. package/src/functions/{def.js → def.ts} +9 -7
  66. package/src/functions/{delimsizing.js → delimsizing.ts} +11 -9
  67. package/src/functions/{enclose.js → enclose.ts} +3 -4
  68. package/src/functions/{environment.js → environment.ts} +2 -3
  69. package/src/functions/{font.js → font.ts} +4 -4
  70. package/src/functions/{genfrac.js → genfrac.ts} +14 -15
  71. package/src/functions/{hbox.js → hbox.ts} +0 -1
  72. package/src/functions/{horizBrace.js → horizBrace.ts} +4 -5
  73. package/src/functions/{href.js → href.ts} +4 -4
  74. package/src/functions/{html.js → html.ts} +3 -3
  75. package/src/functions/{htmlmathml.js → htmlmathml.ts} +0 -1
  76. package/src/functions/{includegraphics.js → includegraphics.ts} +0 -1
  77. package/src/functions/{kern.js → kern.ts} +0 -1
  78. package/src/functions/{lap.js → lap.ts} +0 -1
  79. package/src/functions/{math.js → math.ts} +0 -1
  80. package/src/functions/{mathchoice.js → mathchoice.ts} +2 -2
  81. package/src/functions/{mclass.js → mclass.ts} +5 -6
  82. package/src/functions/{op.js → op.ts} +9 -11
  83. package/src/functions/{operatorname.js → operatorname.ts} +4 -7
  84. package/src/functions/{ordgroup.js → ordgroup.ts} +0 -2
  85. package/src/functions/{overline.js → overline.ts} +0 -1
  86. package/src/functions/{phantom.js → phantom.ts} +0 -1
  87. package/src/functions/{pmb.js → pmb.ts} +0 -1
  88. package/src/functions/{raisebox.js → raisebox.ts} +0 -1
  89. package/src/functions/{relax.js → relax.ts} +0 -1
  90. package/src/functions/{rule.js → rule.ts} +0 -1
  91. package/src/functions/{sizing.js → sizing.ts} +0 -1
  92. package/src/functions/{smash.js → smash.ts} +2 -4
  93. package/src/functions/{sqrt.js → sqrt.ts} +0 -1
  94. package/src/functions/{styling.js → styling.ts} +3 -3
  95. package/src/functions/{supsub.js → supsub.ts} +6 -8
  96. package/src/functions/{symbolsOp.js → symbolsOp.ts} +0 -2
  97. package/src/functions/{symbolsOrd.js → symbolsOrd.ts} +1 -2
  98. package/src/functions/{symbolsSpacing.js → symbolsSpacing.ts} +2 -3
  99. package/src/functions/{tag.js → tag.ts} +0 -2
  100. package/src/functions/{text.js → text.ts} +7 -6
  101. package/src/functions/{underline.js → underline.ts} +0 -1
  102. package/src/functions/utils/{assembleSupSub.js → assembleSupSub.ts} +2 -3
  103. package/src/functions/{vcenter.js → vcenter.ts} +0 -2
  104. package/src/functions/{verb.js → verb.ts} +0 -1
  105. package/src/{functions.js → functions.ts} +0 -1
  106. package/src/{macros.js → macros.ts} +10 -8
  107. package/src/{mathMLTree.js → mathMLTree.ts} +5 -6
  108. package/src/parseNode.ts +522 -0
  109. package/src/{parseTree.js → parseTree.ts} +5 -3
  110. package/src/{spacingData.js → spacingData.ts} +11 -12
  111. package/src/{stretchy.js → stretchy.ts} +7 -7
  112. package/src/styles/katex-swap.scss +1 -4
  113. package/src/styles/katex.scss +9 -0
  114. package/src/{svgGeometry.js → svgGeometry.ts} +1 -2
  115. package/src/{symbols.js → symbols.ts} +6 -6
  116. package/src/{tree.js → tree.ts} +5 -7
  117. package/src/{types.js → types.ts} +1 -2
  118. package/src/unicodeAccents.js +4 -1
  119. package/src/{unicodeScripts.js → unicodeScripts.ts} +1 -3
  120. package/src/{unicodeSupOrSub.js → unicodeSupOrSub.ts} +1 -1
  121. package/src/unicodeSymbols.js +4 -3
  122. package/src/{units.js → units.ts} +2 -4
  123. package/src/{utils.js → utils.ts} +2 -3
  124. package/src/{wide-character.js → wide-character.ts} +8 -10
  125. package/types/katex.d.ts +13 -12
  126. package/src/parseNode.js +0 -523
@@ -86,18 +86,17 @@ __webpack_require__.d(__webpack_exports__, {
86
86
  // EXTERNAL MODULE: external "katex"
87
87
  var external_katex_ = __webpack_require__(757);
88
88
  var external_katex_default = /*#__PURE__*/__webpack_require__.n(external_katex_);
89
- ;// ./contrib/auto-render/splitAtDelimiters.js
89
+ ;// ./contrib/auto-render/splitAtDelimiters.ts
90
90
  /* eslint no-constant-condition:0 */
91
+
91
92
  const findEndOfMath = function (delimiter, text, startIndex) {
92
93
  // Adapted from
93
94
  // https://github.com/Khan/perseus/blob/master/src/perseus-markdown.jsx
94
95
  let index = startIndex;
95
96
  let braceLevel = 0;
96
97
  const delimLength = delimiter.length;
97
-
98
98
  while (index < text.length) {
99
99
  const character = text[index];
100
-
101
100
  if (braceLevel <= 0 && text.slice(index, index + delimLength) === delimiter) {
102
101
  return index;
103
102
  } else if (character === "\\") {
@@ -107,47 +106,36 @@ const findEndOfMath = function (delimiter, text, startIndex) {
107
106
  } else if (character === "}") {
108
107
  braceLevel--;
109
108
  }
110
-
111
109
  index++;
112
110
  }
113
-
114
111
  return -1;
115
112
  };
116
-
117
113
  const escapeRegex = function (string) {
118
114
  return string.replace(/[-/\\^$*+?.()|[\]{}]/g, "\\$&");
119
115
  };
120
-
121
116
  const amsRegex = /^\\begin{/;
122
-
123
117
  const splitAtDelimiters = function (text, delimiters) {
124
118
  let index;
125
119
  const data = [];
126
120
  const regexLeft = new RegExp("(" + delimiters.map(x => escapeRegex(x.left)).join("|") + ")");
127
-
128
121
  while (true) {
129
122
  index = text.search(regexLeft);
130
-
131
123
  if (index === -1) {
132
124
  break;
133
125
  }
134
-
135
126
  if (index > 0) {
136
127
  data.push({
137
128
  type: "text",
138
129
  data: text.slice(0, index)
139
130
  });
140
131
  text = text.slice(index); // now text starts with delimiter
141
- } // ... so this always succeeds:
142
-
143
-
132
+ }
133
+ // ... so this always succeeds:
144
134
  const i = delimiters.findIndex(delim => text.startsWith(delim.left));
145
135
  index = findEndOfMath(delimiters[i].right, text, delimiters[i].left.length);
146
-
147
136
  if (index === -1) {
148
137
  break;
149
138
  }
150
-
151
139
  const rawData = text.slice(0, index + delimiters[i].right.length);
152
140
  const math = amsRegex.test(rawData) ? rawData : text.slice(delimiters[i].left.length, index);
153
141
  data.push({
@@ -158,98 +146,83 @@ const splitAtDelimiters = function (text, delimiters) {
158
146
  });
159
147
  text = text.slice(index + delimiters[i].right.length);
160
148
  }
161
-
162
149
  if (text !== "") {
163
150
  data.push({
164
151
  type: "text",
165
152
  data: text
166
153
  });
167
154
  }
168
-
169
155
  return data;
170
156
  };
171
-
172
157
  /* harmony default export */ var auto_render_splitAtDelimiters = (splitAtDelimiters);
173
- ;// ./contrib/auto-render/auto-render.js
158
+ ;// ./contrib/auto-render/auto-render.ts
174
159
  /* eslint no-console:0 */
175
160
 
176
161
 
162
+
177
163
  /* Note: optionsCopy is mutated by this method. If it is ever exposed in the
178
164
  * API, we should copy it before mutating.
179
165
  */
180
-
181
166
  const renderMathInText = function (text, optionsCopy) {
182
167
  const data = auto_render_splitAtDelimiters(text, optionsCopy.delimiters);
183
-
184
168
  if (data.length === 1 && data[0].type === 'text') {
185
169
  // There is no formula in the text.
186
170
  // Let's return null which means there is no need to replace
187
171
  // the current text node with a new one.
188
172
  return null;
189
173
  }
190
-
191
174
  const fragment = document.createDocumentFragment();
192
-
193
175
  for (let i = 0; i < data.length; i++) {
194
176
  if (data[i].type === "text") {
195
177
  fragment.appendChild(document.createTextNode(data[i].data));
196
178
  } else {
197
179
  const span = document.createElement("span");
198
- let math = data[i].data; // Override any display mode defined in the settings with that
180
+ let math = data[i].data;
181
+ // Override any display mode defined in the settings with that
199
182
  // defined by the text itself
200
-
201
183
  optionsCopy.displayMode = data[i].display;
202
-
203
184
  try {
204
185
  if (optionsCopy.preProcess) {
205
186
  math = optionsCopy.preProcess(math);
206
187
  }
207
-
208
188
  external_katex_default().render(math, span, optionsCopy);
209
189
  } catch (e) {
210
190
  if (!(e instanceof (external_katex_default()).ParseError)) {
211
191
  throw e;
212
192
  }
213
-
214
193
  optionsCopy.errorCallback("KaTeX auto-render: Failed to parse `" + data[i].data + "` with ", e);
215
194
  fragment.appendChild(document.createTextNode(data[i].rawData));
216
195
  continue;
217
196
  }
218
-
219
197
  fragment.appendChild(span);
220
198
  }
221
199
  }
222
-
223
200
  return fragment;
224
201
  };
225
-
226
202
  const renderElem = function (elem, optionsCopy) {
227
203
  for (let i = 0; i < elem.childNodes.length; i++) {
228
204
  const childNode = elem.childNodes[i];
229
-
230
205
  if (childNode.nodeType === 3) {
206
+ var _childNode$textConten;
231
207
  // Text node
232
208
  // Concatenate all sibling text nodes.
233
209
  // Webkit browsers split very large text nodes into smaller ones,
234
210
  // so the delimiters may be split across different nodes.
235
- let textContentConcat = childNode.textContent;
211
+ let textContentConcat = (_childNode$textConten = childNode.textContent) != null ? _childNode$textConten : "";
236
212
  let sibling = childNode.nextSibling;
237
213
  let nSiblings = 0;
238
-
239
214
  while (sibling && sibling.nodeType === Node.TEXT_NODE) {
240
- textContentConcat += sibling.textContent;
215
+ var _sibling$textContent;
216
+ textContentConcat += (_sibling$textContent = sibling.textContent) != null ? _sibling$textContent : "";
241
217
  sibling = sibling.nextSibling;
242
218
  nSiblings++;
243
219
  }
244
-
245
220
  const frag = renderMathInText(textContentConcat, optionsCopy);
246
-
247
221
  if (frag) {
248
222
  // Remove extra text nodes
249
223
  for (let j = 0; j < nSiblings; j++) {
250
224
  childNode.nextSibling.remove();
251
225
  }
252
-
253
226
  i += frag.childNodes.length - 1;
254
227
  elem.replaceChild(frag, childNode);
255
228
  } else {
@@ -261,29 +234,21 @@ const renderElem = function (elem, optionsCopy) {
261
234
  // Element node
262
235
  const className = ' ' + childNode.className + ' ';
263
236
  const shouldRender = !optionsCopy.ignoredTags.has(childNode.nodeName.toLowerCase()) && optionsCopy.ignoredClasses.every(x => !className.includes(' ' + x + ' '));
264
-
265
237
  if (shouldRender) {
266
238
  renderElem(childNode, optionsCopy);
267
239
  }
268
- } // Otherwise, it's something else, and ignore it.
269
-
240
+ }
241
+ // Otherwise, it's something else, and ignore it.
270
242
  }
271
243
  };
272
-
273
244
  const renderMathInElement = function (elem, options) {
274
245
  if (!elem) {
275
246
  throw new Error("No element provided to render");
276
247
  }
248
+ const optionsCopy = {};
249
+ Object.assign(optionsCopy, options);
277
250
 
278
- const optionsCopy = {}; // Object.assign(optionsCopy, option)
279
-
280
- for (const option in options) {
281
- if (options.hasOwnProperty(option)) {
282
- optionsCopy[option] = options[option];
283
- }
284
- } // default options
285
-
286
-
251
+ // default options
287
252
  optionsCopy.delimiters = optionsCopy.delimiters || [{
288
253
  left: "$$",
289
254
  right: "$$",
@@ -292,9 +257,11 @@ const renderMathInElement = function (elem, options) {
292
257
  left: "\\(",
293
258
  right: "\\)",
294
259
  display: false
295
- }, // LaTeX uses $…$, but it ruins the display of normal `$` in text:
260
+ },
261
+ // LaTeX uses $…$, but it ruins the display of normal `$` in text:
296
262
  // {left: "$", right: "$", display: false},
297
263
  // $ must come after $$
264
+
298
265
  // Render AMS environments even if outside $$…$$ delimiters.
299
266
  {
300
267
  left: "\\begin{equation}",
@@ -321,15 +288,15 @@ const renderMathInElement = function (elem, options) {
321
288
  right: "\\]",
322
289
  display: true
323
290
  }];
324
- optionsCopy.ignoredTags = new Set(optionsCopy.ignoredTags || ["script", "noscript", "style", "textarea", "pre", "code", "option"]);
291
+ optionsCopy.ignoredTags = new Set((options == null ? void 0 : options.ignoredTags) || ["script", "noscript", "style", "textarea", "pre", "code", "option"]);
325
292
  optionsCopy.ignoredClasses = optionsCopy.ignoredClasses || [];
326
- optionsCopy.errorCallback = optionsCopy.errorCallback || console.error; // Enable sharing of global macros defined via `\gdef` between different
327
- // math elements within a single call to `renderMathInElement`.
293
+ optionsCopy.errorCallback = optionsCopy.errorCallback || console.error;
328
294
 
295
+ // Enable sharing of global macros defined via `\gdef` between different
296
+ // math elements within a single call to `renderMathInElement`.
329
297
  optionsCopy.macros = optionsCopy.macros || {};
330
298
  renderElem(elem, optionsCopy);
331
299
  };
332
-
333
300
  /* harmony default export */ var auto_render = (renderMathInElement);
334
301
  __webpack_exports__ = __webpack_exports__["default"];
335
302
  /******/ return __webpack_exports__;
@@ -1 +1 @@
1
- !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("katex")):"function"==typeof define&&define.amd?define(["katex"],t):"object"==typeof exports?exports.renderMathInElement=t(require("katex")):e.renderMathInElement=t(e.katex)}("undefined"!=typeof self?self:this,function(e){return function(){"use strict";var t={757:function(t){t.exports=e}},n={};function r(e){var o=n[e];if(void 0!==o)return o.exports;var i=n[e]={exports:{}};return t[e](i,i.exports,r),i.exports}r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,{a:t}),t},r.d=function(e,t){for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)};var o={};r.d(o,{default:function(){return p}});var i=r(757),a=r.n(i);const l=function(e,t,n){let r=n,o=0;const i=e.length;for(;r<t.length;){const n=t[r];if(o<=0&&t.slice(r,r+i)===e)return r;"\\"===n?r++:"{"===n?o++:"}"===n&&o--,r++}return-1},s=/^\\begin{/;var d=function(e,t){let n;const r=[],o=new RegExp("("+t.map(e=>e.left.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")).join("|")+")");for(;n=e.search(o),-1!==n;){n>0&&(r.push({type:"text",data:e.slice(0,n)}),e=e.slice(n));const o=t.findIndex(t=>e.startsWith(t.left));if(n=l(t[o].right,e,t[o].left.length),-1===n)break;const i=e.slice(0,n+t[o].right.length),a=s.test(i)?i:e.slice(t[o].left.length,n);r.push({type:"math",data:a,rawData:i,display:t[o].display}),e=e.slice(n+t[o].right.length)}return""!==e&&r.push({type:"text",data:e}),r};const c=function(e,t){const n=d(e,t.delimiters);if(1===n.length&&"text"===n[0].type)return null;const r=document.createDocumentFragment();for(let e=0;e<n.length;e++)if("text"===n[e].type)r.appendChild(document.createTextNode(n[e].data));else{const o=document.createElement("span");let i=n[e].data;t.displayMode=n[e].display;try{t.preProcess&&(i=t.preProcess(i)),a().render(i,o,t)}catch(o){if(!(o instanceof a().ParseError))throw o;t.errorCallback("KaTeX auto-render: Failed to parse `"+n[e].data+"` with ",o),r.appendChild(document.createTextNode(n[e].rawData));continue}r.appendChild(o)}return r},f=function(e,t){for(let n=0;n<e.childNodes.length;n++){const r=e.childNodes[n];if(3===r.nodeType){let o=r.textContent,i=r.nextSibling,a=0;for(;i&&i.nodeType===Node.TEXT_NODE;)o+=i.textContent,i=i.nextSibling,a++;const l=c(o,t);if(l){for(let e=0;e<a;e++)r.nextSibling.remove();n+=l.childNodes.length-1,e.replaceChild(l,r)}else n+=a}else if(1===r.nodeType){const e=" "+r.className+" ";!t.ignoredTags.has(r.nodeName.toLowerCase())&&t.ignoredClasses.every(t=>!e.includes(" "+t+" "))&&f(r,t)}}};var p=function(e,t){if(!e)throw new Error("No element provided to render");const n={};for(const e in t)t.hasOwnProperty(e)&&(n[e]=t[e]);n.delimiters=n.delimiters||[{left:"$$",right:"$$",display:!0},{left:"\\(",right:"\\)",display:!1},{left:"\\begin{equation}",right:"\\end{equation}",display:!0},{left:"\\begin{align}",right:"\\end{align}",display:!0},{left:"\\begin{alignat}",right:"\\end{alignat}",display:!0},{left:"\\begin{gather}",right:"\\end{gather}",display:!0},{left:"\\begin{CD}",right:"\\end{CD}",display:!0},{left:"\\[",right:"\\]",display:!0}],n.ignoredTags=new Set(n.ignoredTags||["script","noscript","style","textarea","pre","code","option"]),n.ignoredClasses=n.ignoredClasses||[],n.errorCallback=n.errorCallback||console.error,n.macros=n.macros||{},f(e,n)};return o=o.default}()});
1
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("katex")):"function"==typeof define&&define.amd?define(["katex"],t):"object"==typeof exports?exports.renderMathInElement=t(require("katex")):e.renderMathInElement=t(e.katex)}("undefined"!=typeof self?self:this,function(e){return function(){"use strict";var t={757:function(t){t.exports=e}},n={};function r(e){var o=n[e];if(void 0!==o)return o.exports;var i=n[e]={exports:{}};return t[e](i,i.exports,r),i.exports}r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,{a:t}),t},r.d=function(e,t){for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)};var o={};r.d(o,{default:function(){return p}});var i=r(757),a=r.n(i);const l=function(e,t,n){let r=n,o=0;const i=e.length;for(;r<t.length;){const n=t[r];if(o<=0&&t.slice(r,r+i)===e)return r;"\\"===n?r++:"{"===n?o++:"}"===n&&o--,r++}return-1},s=/^\\begin{/;var d=function(e,t){let n;const r=[],o=new RegExp("("+t.map(e=>e.left.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")).join("|")+")");for(;n=e.search(o),-1!==n;){n>0&&(r.push({type:"text",data:e.slice(0,n)}),e=e.slice(n));const o=t.findIndex(t=>e.startsWith(t.left));if(n=l(t[o].right,e,t[o].left.length),-1===n)break;const i=e.slice(0,n+t[o].right.length),a=s.test(i)?i:e.slice(t[o].left.length,n);r.push({type:"math",data:a,rawData:i,display:t[o].display}),e=e.slice(n+t[o].right.length)}return""!==e&&r.push({type:"text",data:e}),r};const c=function(e,t){const n=d(e,t.delimiters);if(1===n.length&&"text"===n[0].type)return null;const r=document.createDocumentFragment();for(let e=0;e<n.length;e++)if("text"===n[e].type)r.appendChild(document.createTextNode(n[e].data));else{const o=document.createElement("span");let i=n[e].data;t.displayMode=n[e].display;try{t.preProcess&&(i=t.preProcess(i)),a().render(i,o,t)}catch(o){if(!(o instanceof a().ParseError))throw o;t.errorCallback("KaTeX auto-render: Failed to parse `"+n[e].data+"` with ",o),r.appendChild(document.createTextNode(n[e].rawData));continue}r.appendChild(o)}return r},f=function(e,t){for(let o=0;o<e.childNodes.length;o++){const i=e.childNodes[o];if(3===i.nodeType){var n;let a=null!=(n=i.textContent)?n:"",l=i.nextSibling,s=0;for(;l&&l.nodeType===Node.TEXT_NODE;){var r;a+=null!=(r=l.textContent)?r:"",l=l.nextSibling,s++}const d=c(a,t);if(d){for(let e=0;e<s;e++)i.nextSibling.remove();o+=d.childNodes.length-1,e.replaceChild(d,i)}else o+=s}else if(1===i.nodeType){const e=" "+i.className+" ";!t.ignoredTags.has(i.nodeName.toLowerCase())&&t.ignoredClasses.every(t=>!e.includes(" "+t+" "))&&f(i,t)}}};var p=function(e,t){if(!e)throw new Error("No element provided to render");const n={};Object.assign(n,t),n.delimiters=n.delimiters||[{left:"$$",right:"$$",display:!0},{left:"\\(",right:"\\)",display:!1},{left:"\\begin{equation}",right:"\\end{equation}",display:!0},{left:"\\begin{align}",right:"\\end{align}",display:!0},{left:"\\begin{alignat}",right:"\\end{alignat}",display:!0},{left:"\\begin{gather}",right:"\\end{gather}",display:!0},{left:"\\begin{CD}",right:"\\end{CD}",display:!0},{left:"\\[",right:"\\]",display:!0}],n.ignoredTags=new Set((null==t?void 0:t.ignoredTags)||["script","noscript","style","textarea","pre","code","option"]),n.ignoredClasses=n.ignoredClasses||[],n.errorCallback=n.errorCallback||console.error,n.macros=n.macros||{},f(e,n)};return o=o.default}()});