@bytechain.cn/colamd 2.7.12 → 2.7.13

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 (80) hide show
  1. package/README.md +3 -1
  2. package/README_CN.md +3 -1
  3. package/dist/lib/colamd-renderer.js +18407 -18302
  4. package/dist/lib/colamd.css +1 -1
  5. package/dist/main/chunks/docx-export.js +5 -2
  6. package/dist/renderer/assets/{2DXBBFLN-BJduq_n1.js → 2DXBBFLN-ALNXA0ap.js} +4 -4
  7. package/dist/renderer/assets/{46IJ22JX-Dl5oABYC.js → 46IJ22JX-CwxSS7s2.js} +5 -5
  8. package/dist/renderer/assets/{4TTDE5I4-D0OZH30N.js → 4TTDE5I4-CCaQ-Qhr.js} +3 -3
  9. package/dist/renderer/assets/{4UF3HTLV-B9lH7CBB.js → 4UF3HTLV-DZOYgtOD.js} +4 -4
  10. package/dist/renderer/assets/{AAXQQPKT-eq8R1-i0.js → AAXQQPKT-C-1s3Dqf.js} +8 -8
  11. package/dist/renderer/assets/{AKE5O7KZ-BPFFZy5e.js → AKE5O7KZ-BWT9NTVZ.js} +5 -5
  12. package/dist/renderer/assets/{BNMLP6AG-DvupnLHN.js → BNMLP6AG-ByQWPes6.js} +7 -7
  13. package/dist/renderer/assets/{DR6PKOQU-DXqY3tAL.js → DR6PKOQU-BJHswFty.js} +3 -3
  14. package/dist/renderer/assets/{E4RJ7UJB-B3-v1GGn.js → E4RJ7UJB-1Eo8TOcw.js} +6 -6
  15. package/dist/renderer/assets/{ELSXBIJH-W0-fIyGs.js → ELSXBIJH-CTihDDj-.js} +1 -1
  16. package/dist/renderer/assets/{ERTIBQVS-Cjo8zCEV.js → ERTIBQVS-VlP2Fl8s.js} +4 -4
  17. package/dist/renderer/assets/{F653G4FO-t4kGthl5.js → F653G4FO-BfRMrcT2.js} +8 -8
  18. package/dist/renderer/assets/{FKCDD66M-CqwX5T9T.js → FKCDD66M-Dx6nCace.js} +1 -1
  19. package/dist/renderer/assets/{FP7KDXVC-SqJKRKSf.js → FP7KDXVC-JX4wVWHb.js} +6 -6
  20. package/dist/renderer/assets/{FT5I3RHX-B1_XlJMF.js → FT5I3RHX-BKmbu0Ww.js} +7 -7
  21. package/dist/renderer/assets/{GY35JXOZ-D_hAOI09.js → GY35JXOZ-BVBmqsqd.js} +4 -4
  22. package/dist/renderer/assets/{H5EEJPP2-Dh0ee_t_.js → H5EEJPP2-BiAAKO-B.js} +9 -9
  23. package/dist/renderer/assets/{HWDLEDTA-BfmnLbys.js → HWDLEDTA-gm8E-Yqq.js} +1 -1
  24. package/dist/renderer/assets/{JZWSX6AR-DibCj0_r.js → JZWSX6AR-B3v8qMsV.js} +2 -2
  25. package/dist/renderer/assets/{KQOEJWJY-CYbDpxpS.js → KQOEJWJY-BMTjDHaU.js} +1 -1
  26. package/dist/renderer/assets/{KS3BB3KE-BKXN5GEp.js → KS3BB3KE-UNhg0tjp.js} +5 -5
  27. package/dist/renderer/assets/{KXJRRZHI-Dd9nToeE.js → KXJRRZHI-BkjpheXn.js} +3 -3
  28. package/dist/renderer/assets/{MFVI5XKI-yEhNzg_a.js → MFVI5XKI-BKnsNeAu.js} +1 -1
  29. package/dist/renderer/assets/{MWY2J62P-PD0ivp8r.js → MWY2J62P-C2fXJt2z.js} +5 -5
  30. package/dist/renderer/assets/{MXGNCBL2-CrYuCAhj.js → MXGNCBL2-OdlMkSYe.js} +5 -5
  31. package/dist/renderer/assets/{N6DAJLIZ-CsI-0Pob.js → N6DAJLIZ-DZk90zfQ.js} +2 -2
  32. package/dist/renderer/assets/{NU5M23IW-BRouDTU6.js → NU5M23IW-CqrkpDmA.js} +5 -5
  33. package/dist/renderer/assets/{NV4XNBIS-BDKWqPgJ.js → NV4XNBIS-CEOfa376.js} +7 -7
  34. package/dist/renderer/assets/{OGLU4SIR-e03S5CRP.js → OGLU4SIR-CXCAJdcN.js} +5 -5
  35. package/dist/renderer/assets/{OUNS5N76-DXs9fuRM.js → OUNS5N76-CaxK8E0B.js} +6 -6
  36. package/dist/renderer/assets/{PU4ISKXV-DHAw3ojo.js → PU4ISKXV-CkQL-IWp.js} +5 -5
  37. package/dist/renderer/assets/{PUZGS23X-BJvqqbjA.js → PUZGS23X-B-CGNpKZ.js} +1 -1
  38. package/dist/renderer/assets/{Q3IYVLG5-BBP8APVJ.js → Q3IYVLG5-CmIlJsgG.js} +5 -5
  39. package/dist/renderer/assets/{QYHQDLKZ-Dk9FA6iI.js → QYHQDLKZ-Br57AbVX.js} +9 -9
  40. package/dist/renderer/assets/{RZSVICHU-DQMvf7FW.js → RZSVICHU-DD3CK-Lf.js} +1 -1
  41. package/dist/renderer/assets/{UEXXS2NB-pjQFygyK.js → UEXXS2NB-BNdzFN7f.js} +1 -1
  42. package/dist/renderer/assets/{UHTQJXKL-BCjkwDC-.js → UHTQJXKL-Bsu9QNn2.js} +5 -5
  43. package/dist/renderer/assets/{URA2L2QI-DOqGA-7p.js → URA2L2QI-BeIBFAAP.js} +1 -1
  44. package/dist/renderer/assets/{UXCHDUKG-P-ssqnp6.js → UXCHDUKG-BIB6A9DU.js} +5 -5
  45. package/dist/renderer/assets/{VKNV3BUX-S-I5Vkej.js → VKNV3BUX-C_MjwJ6m.js} +6 -6
  46. package/dist/renderer/assets/{VMV7XPHP-CBEFwbRj.js → VMV7XPHP-D0cww3Fb.js} +1 -1
  47. package/dist/renderer/assets/{WEVWDWVA-NETs7zG0.js → WEVWDWVA-CCDvMBKl.js} +1 -1
  48. package/dist/renderer/assets/{XRRJ35LF-ChlUj7II.js → XRRJ35LF-CRwwhzJ0.js} +4 -4
  49. package/dist/renderer/assets/{YFKBLVVN-a23ZlMUZ.js → YFKBLVVN-CH_wsIFW.js} +4 -4
  50. package/dist/renderer/assets/{YHRE5QGZ-B4WFiwFa.js → YHRE5QGZ-_1I4H-Cd.js} +7 -7
  51. package/dist/renderer/assets/{ZF3OVT4B-D99LRppp.js → ZF3OVT4B-BqoSMdR7.js} +3 -3
  52. package/dist/renderer/assets/{index-DNKeYHeb.js → index-9gnHkoK7.js} +1 -1
  53. package/dist/renderer/assets/{index-BUMCX36l.js → index-B9mxJmxP.js} +1 -1
  54. package/dist/renderer/assets/{index-B-sTajw0.js → index-BXn8SSRO.js} +1 -1
  55. package/dist/renderer/assets/{index-CizbQ4B2.js → index-BgSGixdO.js} +1 -1
  56. package/dist/renderer/assets/{index-BQRkI4XZ.js → index-BpqOaUd_.js} +3 -3
  57. package/dist/renderer/assets/{index-B7a6ecSB.js → index-C3jLCWOv.js} +1 -1
  58. package/dist/renderer/assets/{index-j9IOhwim.js → index-CGWaYts7.js} +1 -1
  59. package/dist/renderer/assets/{index-BXMm6of_.js → index-CU4eUjnS.js} +1 -1
  60. package/dist/renderer/assets/{index-CmCG8RWM.js → index-CtO7mpP3.js} +1 -1
  61. package/dist/renderer/assets/{index-DurJ4oOc.js → index-CwH04Tq_.js} +3 -3
  62. package/dist/renderer/assets/{index-Xe00ZDVa.css → index-D6SLND4G.css} +1164 -21
  63. package/dist/renderer/assets/{index-CX3eLmnK.js → index-DDMRqKv0.js} +1 -1
  64. package/dist/renderer/assets/{index-CBsqa7KF.js → index-DN-WehV_.js} +1 -1
  65. package/dist/renderer/assets/{index-DShnMzLx.js → index-Dct5tTjE.js} +1755 -1095
  66. package/dist/renderer/assets/{index-BgaTyTt4.js → index-DjTtBl71.js} +1 -1
  67. package/dist/renderer/assets/{index-Cl38Mcu3.js → index-DtH-vuwI.js} +1 -1
  68. package/dist/renderer/assets/{index-CFd49PzX.js → index-Du6z3bAn.js} +1 -1
  69. package/dist/renderer/assets/{index-9wJDFDHb.js → index-Dz7ZQeU1.js} +1 -1
  70. package/dist/renderer/assets/{index-Cr5af8vL.js → index-QzYbuPVg.js} +1 -1
  71. package/dist/renderer/assets/{index-WU2bjQIt.js → index-alRdsw6J.js} +1 -1
  72. package/dist/renderer/assets/{index-B3xEpmeL.js → index-cLTU2RS5.js} +1 -1
  73. package/dist/renderer/assets/{index-C5S7E_iS.js → index-gvL3lkzR.js} +3 -3
  74. package/dist/renderer/assets/{lazy-C5_LqPMG.js → lazy-DVWnMOaz.js} +3 -3
  75. package/dist/renderer/assets/{web-DJNzGtPV.js → web-BBDWek-d.js} +1 -1
  76. package/dist/renderer/assets/{web-C4L7HQnE.js → web-Cmk7I-i1.js} +2 -2
  77. package/dist/renderer/assets/{web-ClAYTlQS.js → web-DkHfYGAr.js} +1 -1
  78. package/dist/renderer/index.html +3 -3
  79. package/package.json +9 -3
  80. package/themes/contract.json +1 -1
@@ -2957,10 +2957,10 @@ class RangeSet {
2957
2957
  for (; ; ) {
2958
2958
  let curTo = Math.min(cursor.to, to);
2959
2959
  if (cursor.point) {
2960
- let active = cursor.activeForPoint(cursor.to);
2961
- let openCount = cursor.pointFrom < from ? active.length + 1 : cursor.point.startSide < 0 ? active.length : Math.min(active.length, openRanges);
2962
- iterator.point(pos, curTo, cursor.point, active, openCount, cursor.pointRank);
2963
- openRanges = Math.min(cursor.openEnd(curTo), active.length);
2960
+ let active2 = cursor.activeForPoint(cursor.to);
2961
+ let openCount = cursor.pointFrom < from ? active2.length + 1 : cursor.point.startSide < 0 ? active2.length : Math.min(active2.length, openRanges);
2962
+ iterator.point(pos, curTo, cursor.point, active2, openCount, cursor.pointRank);
2963
+ openRanges = Math.min(cursor.openEnd(curTo), active2.length);
2964
2964
  } else if (curTo > pos) {
2965
2965
  iterator.span(pos, curTo, cursor.active, openRanges);
2966
2966
  openRanges = cursor.openEnd(curTo);
@@ -3374,14 +3374,14 @@ class SpanCursor {
3374
3374
  activeForPoint(to) {
3375
3375
  if (!this.active.length)
3376
3376
  return this.active;
3377
- let active = [];
3377
+ let active2 = [];
3378
3378
  for (let i = this.active.length - 1; i >= 0; i--) {
3379
3379
  if (this.activeRank[i] < this.pointRank)
3380
3380
  break;
3381
3381
  if (this.activeTo[i] > to || this.activeTo[i] == to && this.active[i].endSide >= this.point.endSide)
3382
- active.push(this.active[i]);
3382
+ active2.push(this.active[i]);
3383
3383
  }
3384
- return active.reverse();
3384
+ return active2.reverse();
3385
3385
  }
3386
3386
  openEnd(to) {
3387
3387
  let open2 = 0;
@@ -3710,7 +3710,7 @@ const ie_upto10 = /* @__PURE__ */ /MSIE \d/.test(nav.userAgent);
3710
3710
  const ie_11up = /* @__PURE__ */ /Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(nav.userAgent);
3711
3711
  const ie = !!(ie_upto10 || ie_11up || ie_edge);
3712
3712
  const gecko = !ie && /* @__PURE__ */ /gecko\/(\d+)/i.test(nav.userAgent);
3713
- const chrome = !ie && /* @__PURE__ */ /Chrome\/(\d+)/.exec(nav.userAgent);
3713
+ const chrome$1 = !ie && /* @__PURE__ */ /Chrome\/(\d+)/.exec(nav.userAgent);
3714
3714
  const webkit = "webkitFontSmoothing" in doc.documentElement.style;
3715
3715
  const safari = !ie && /* @__PURE__ */ /Apple Computer/.test(nav.vendor);
3716
3716
  const ios = safari && (/* @__PURE__ */ /Mobile\/\w+/.test(nav.userAgent) || nav.maxTouchPoints > 2);
@@ -3722,8 +3722,8 @@ var browser = {
3722
3722
  ie_version: ie_upto10 ? doc.documentMode || 6 : ie_11up ? +ie_11up[1] : ie_edge ? +ie_edge[1] : 0,
3723
3723
  gecko,
3724
3724
  gecko_version: gecko ? +(/* @__PURE__ */ /Firefox\/(\d+)/.exec(nav.userAgent) || [0, 0])[1] : 0,
3725
- chrome: !!chrome,
3726
- chrome_version: chrome ? +chrome[1] : 0,
3725
+ chrome: !!chrome$1,
3726
+ chrome_version: chrome$1 ? +chrome$1[1] : 0,
3727
3727
  ios,
3728
3728
  android: /* @__PURE__ */ /Android\b/.test(nav.userAgent),
3729
3729
  webkit,
@@ -4861,9 +4861,9 @@ class ScrollTarget {
4861
4861
  const scrollIntoView = /* @__PURE__ */ StateEffect.define({ map: (t2, ch) => t2.map(ch) });
4862
4862
  const setEditContextFormatting = /* @__PURE__ */ StateEffect.define();
4863
4863
  function logException(state, exception, context) {
4864
- let handler = state.facet(exceptionSink);
4865
- if (handler.length)
4866
- handler[0](exception);
4864
+ let handler2 = state.facet(exceptionSink);
4865
+ if (handler2.length)
4866
+ handler2[0](exception);
4867
4867
  else if (window.onerror && window.onerror(String(exception), context, void 0, void 0, exception)) ;
4868
4868
  else if (context)
4869
4869
  console.error(context + ":", exception);
@@ -4991,11 +4991,11 @@ function getIsolatedRanges(view, line) {
4991
4991
  RangeSet.spans(sets, line.from, line.to, {
4992
4992
  point() {
4993
4993
  },
4994
- span(fromDoc, toDoc, active, open2) {
4994
+ span(fromDoc, toDoc, active2, open2) {
4995
4995
  let from = fromDoc - line.from, to = toDoc - line.from;
4996
4996
  let level = result;
4997
- for (let i = active.length - 1; i >= 0; i--, open2--) {
4998
- let direction = active[i].spec.bidiIsolate, update;
4997
+ for (let i = active2.length - 1; i >= 0; i--, open2--) {
4998
+ let direction = active2[i].spec.bidiIsolate, update;
4999
4999
  if (direction == null)
5000
5000
  direction = autoDirection(line.text, from, to);
5001
5001
  if (open2 > 0 && level.length && (update = level[level.length - 1]).to == from && update.direction == direction) {
@@ -6225,7 +6225,7 @@ class TileUpdate {
6225
6225
  let pendingLineAttrs = null;
6226
6226
  let b = this.builder, markCount = -1;
6227
6227
  let openEnd = RangeSet.spans(this.decorations, from, to, {
6228
- point: (from2, to2, deco, active, openStart, index2) => {
6228
+ point: (from2, to2, deco, active2, openStart, index2) => {
6229
6229
  if (deco instanceof PointDecoration) {
6230
6230
  if (this.disallowBlockEffectsFor[index2]) {
6231
6231
  if (deco.block)
@@ -6233,8 +6233,8 @@ class TileUpdate {
6233
6233
  if (to2 > this.view.state.doc.lineAt(from2).to)
6234
6234
  throw new RangeError("Decorations that replace line breaks may not be specified via plugins");
6235
6235
  }
6236
- markCount = active.length;
6237
- if (openStart > active.length) {
6236
+ markCount = active2.length;
6237
+ if (openStart > active2.length) {
6238
6238
  b.continueWidget(to2 - from2);
6239
6239
  } else {
6240
6240
  let widget = deco.widget || (deco.block ? NullWidget.block : NullWidget.inline);
@@ -6246,7 +6246,7 @@ class TileUpdate {
6246
6246
  b.addBlockWidget(tile);
6247
6247
  } else {
6248
6248
  b.ensureLine(pendingLineAttrs);
6249
- b.addInlineWidget(tile, active, openStart);
6249
+ b.addInlineWidget(tile, active2, openStart);
6250
6250
  }
6251
6251
  }
6252
6252
  pendingLineAttrs = null;
@@ -6256,7 +6256,7 @@ class TileUpdate {
6256
6256
  if (to2 > from2)
6257
6257
  this.text.skip(to2 - from2);
6258
6258
  },
6259
- span: (from2, to2, active, openStart) => {
6259
+ span: (from2, to2, active2, openStart) => {
6260
6260
  for (let pos = from2; pos < to2; ) {
6261
6261
  let chars = this.text.next(Math.min(512, to2 - pos));
6262
6262
  if (chars == null) {
@@ -6265,12 +6265,12 @@ class TileUpdate {
6265
6265
  pos++;
6266
6266
  } else {
6267
6267
  b.ensureLine(pendingLineAttrs);
6268
- b.addText(chars, active, pos == from2 ? openStart : active.length);
6268
+ b.addText(chars, active2, pos == from2 ? openStart : active2.length);
6269
6269
  pos += chars.length;
6270
6270
  }
6271
6271
  pendingLineAttrs = null;
6272
6272
  }
6273
- markCount = active.length;
6273
+ markCount = active2.length;
6274
6274
  }
6275
6275
  });
6276
6276
  if (markCount > -1)
@@ -6867,9 +6867,9 @@ class DocView {
6867
6867
  this.view.scrollDOM.scrollLeft = target.xMargin;
6868
6868
  return;
6869
6869
  }
6870
- for (let handler of this.view.state.facet(scrollHandler)) {
6870
+ for (let handler2 of this.view.state.facet(scrollHandler)) {
6871
6871
  try {
6872
- if (handler(this.view, target.range, target))
6872
+ if (handler2(this.view, target.range, target))
6873
6873
  return true;
6874
6874
  } catch (e) {
6875
6875
  logException(this.view.state, e, "scroll handler");
@@ -7872,10 +7872,10 @@ class InputState {
7872
7872
  if (handlers2) {
7873
7873
  for (let observer of handlers2.observers)
7874
7874
  observer(this.view, event);
7875
- for (let handler of handlers2.handlers) {
7875
+ for (let handler2 of handlers2.handlers) {
7876
7876
  if (event.defaultPrevented)
7877
7877
  break;
7878
- if (handler(this.view, event)) {
7878
+ if (handler2(this.view, event)) {
7879
7879
  event.preventDefault();
7880
7880
  break;
7881
7881
  }
@@ -7970,10 +7970,10 @@ function iosVirtualKeyboardOpen(win) {
7970
7970
  return false;
7971
7971
  return win.visualViewport.height * win.visualViewport.scale / win.document.documentElement.clientHeight < 0.85;
7972
7972
  }
7973
- function bindHandler(plugin, handler) {
7973
+ function bindHandler(plugin, handler2) {
7974
7974
  return (view, event) => {
7975
7975
  try {
7976
- return handler.call(plugin, event, view);
7976
+ return handler2.call(plugin, event, view);
7977
7977
  } catch (e) {
7978
7978
  logException(view.state, e);
7979
7979
  }
@@ -8258,9 +8258,9 @@ handlers.mousedown = (view, event) => {
8258
8258
  if (mustFocus)
8259
8259
  view.observer.ignore(() => {
8260
8260
  focusPreventScroll(view.contentDOM);
8261
- let active = view.root.activeElement;
8262
- if (active && !active.contains(view.contentDOM))
8263
- active.blur();
8261
+ let active2 = view.root.activeElement;
8262
+ if (active2 && !active2.contains(view.contentDOM))
8263
+ active2.blur();
8264
8264
  });
8265
8265
  let mouseSel = view.inputState.mouseSelection;
8266
8266
  if (mouseSel) {
@@ -18664,15 +18664,16 @@ function getImplicitDefault(type) {
18664
18664
  }
18665
18665
  }
18666
18666
  function getDefaultValue(schema) {
18667
- if (schema.default !== void 0) {
18667
+ if (Object.prototype.hasOwnProperty.call(schema, "default") && schema.default !== void 0) {
18668
18668
  return schema.default;
18669
18669
  }
18670
18670
  var type = Array.isArray(schema.type) ? schema.type[0] : schema.type;
18671
18671
  return getImplicitDefault(type);
18672
18672
  }
18673
18673
  function applySetting(target, prop, options2, schema) {
18674
- var optionValue = options2[prop];
18675
- target[prop] = optionValue !== void 0 ? schema.processor ? schema.processor(optionValue) : optionValue : getDefaultValue(schema);
18674
+ var optionValue = Object.prototype.hasOwnProperty.call(options2, prop) ? options2[prop] : void 0;
18675
+ var processor = Object.prototype.hasOwnProperty.call(schema, "processor") ? schema.processor : void 0;
18676
+ target[prop] = optionValue !== void 0 ? processor ? processor(optionValue) : optionValue : getDefaultValue(schema);
18676
18677
  }
18677
18678
  class Settings {
18678
18679
  constructor(options2) {
@@ -18701,54 +18702,6 @@ class Settings {
18701
18702
  }
18702
18703
  }
18703
18704
  }
18704
- /**
18705
- * Report nonstrict (non-LaTeX-compatible) input.
18706
- * Can safely not be called if `this.strict` is false in JavaScript.
18707
- */
18708
- reportNonstrict(errorCode, errorMsg, token) {
18709
- var strict = this.strict;
18710
- if (typeof strict === "function") {
18711
- strict = strict(errorCode, errorMsg, token);
18712
- }
18713
- if (!strict || strict === "ignore") {
18714
- return;
18715
- } else if (strict === true || strict === "error") {
18716
- throw new ParseError("LaTeX-incompatible input and strict mode is set to 'error': " + (errorMsg + " [" + errorCode + "]"), token);
18717
- } else if (strict === "warn") {
18718
- typeof console !== "undefined" && console.warn("LaTeX-incompatible input and strict mode is set to 'warn': " + (errorMsg + " [" + errorCode + "]"));
18719
- } else {
18720
- typeof console !== "undefined" && console.warn("LaTeX-incompatible input and strict mode is set to " + ("unrecognized '" + strict + "': " + errorMsg + " [" + errorCode + "]"));
18721
- }
18722
- }
18723
- /**
18724
- * Check whether to apply strict (LaTeX-adhering) behavior for unusual
18725
- * input (like `\\`). Unlike `nonstrict`, will not throw an error;
18726
- * instead, "error" translates to a return value of `true`, while "ignore"
18727
- * translates to a return value of `false`. May still print a warning:
18728
- * "warn" prints a warning and returns `false`.
18729
- * This is for the second category of `errorCode`s listed in the README.
18730
- */
18731
- useStrictBehavior(errorCode, errorMsg, token) {
18732
- var strict = this.strict;
18733
- if (typeof strict === "function") {
18734
- try {
18735
- strict = strict(errorCode, errorMsg, token);
18736
- } catch (error) {
18737
- strict = "error";
18738
- }
18739
- }
18740
- if (!strict || strict === "ignore") {
18741
- return false;
18742
- } else if (strict === true || strict === "error") {
18743
- return true;
18744
- } else if (strict === "warn") {
18745
- typeof console !== "undefined" && console.warn("LaTeX-incompatible input and strict mode is set to 'warn': " + (errorMsg + " [" + errorCode + "]"));
18746
- return false;
18747
- } else {
18748
- typeof console !== "undefined" && console.warn("LaTeX-incompatible input and strict mode is set to " + ("unrecognized '" + strict + "': " + errorMsg + " [" + errorCode + "]"));
18749
- return false;
18750
- }
18751
- }
18752
18705
  /**
18753
18706
  * Check whether to test potentially dangerous input, and return
18754
18707
  * `true` (trusted) or `false` (untrusted). The sole argument `context`
@@ -21851,10 +21804,8 @@ function getGlobalMetrics(size) {
21851
21804
  var metrics = fontMetricsBySizeIndex[sizeIndex] = {
21852
21805
  cssEmPerMu: sigmasAndXis.quad[sizeIndex] / 18
21853
21806
  };
21854
- for (var key in sigmasAndXis) {
21855
- if (sigmasAndXis.hasOwnProperty(key)) {
21856
- metrics[key] = sigmasAndXis[key][sizeIndex];
21857
- }
21807
+ for (var key of Object.keys(sigmasAndXis)) {
21808
+ metrics[key] = sigmasAndXis[key][sizeIndex];
21858
21809
  }
21859
21810
  }
21860
21811
  return fontMetricsBySizeIndex[sizeIndex];
@@ -22717,6 +22668,43 @@ var wideCharacterFont = (wideChar2) => {
22717
22668
  throw new ParseError("Unsupported character: " + wideChar2);
22718
22669
  }
22719
22670
  };
22671
+ function handleStrict(params) {
22672
+ var strict = params.strict, errorCode = params.errorCode, errorMsg = params.errorMsg, token = params.token, report = params.report;
22673
+ var behavior = strict;
22674
+ if (typeof strict === "function") {
22675
+ if (report) {
22676
+ behavior = strict(errorCode, errorMsg, token);
22677
+ } else {
22678
+ try {
22679
+ behavior = strict(errorCode, errorMsg, token);
22680
+ } catch (error) {
22681
+ behavior = "error";
22682
+ }
22683
+ }
22684
+ }
22685
+ switch (behavior) {
22686
+ case true:
22687
+ case "error":
22688
+ if (report) {
22689
+ throw new ParseError("LaTeX-incompatible input and strict mode is set to 'error': " + (errorMsg + " [" + errorCode + "]"), token);
22690
+ } else {
22691
+ return true;
22692
+ }
22693
+ case false:
22694
+ case "ignore":
22695
+ if (!report) {
22696
+ return false;
22697
+ }
22698
+ break;
22699
+ case "warn":
22700
+ default:
22701
+ typeof console !== "undefined" && console.warn("LaTeX-incompatible input and strict mode is set to 'warn': " + (errorMsg + " [" + errorCode + "]"));
22702
+ if (!report) {
22703
+ return false;
22704
+ }
22705
+ break;
22706
+ }
22707
+ }
22720
22708
  var lookupSymbol = function lookupSymbol2(value, fontName, mode) {
22721
22709
  if (symbols[mode][value]) {
22722
22710
  var replacement = symbols[mode][value].replace;
@@ -22741,18 +22729,21 @@ var makeSymbol = function makeSymbol2(value, fontName, mode, options2, classes)
22741
22729
  }
22742
22730
  symbolNode = new SymbolNode(value, metrics.height, metrics.depth, italic2, metrics.skew, metrics.width, classes);
22743
22731
  } else {
22744
- typeof console !== "undefined" && console.warn("No character metrics " + ("for '" + value + "' in style '" + fontName + "' and mode '" + mode + "'"));
22732
+ handleStrict({
22733
+ strict: options2.strict,
22734
+ errorCode: "symbolNotInFont",
22735
+ errorMsg: "No character metrics for '" + value + "' in style '" + fontName + "' and mode '" + mode + "'",
22736
+ report: true
22737
+ });
22745
22738
  symbolNode = new SymbolNode(value, 0, 0, 0, 0, 0, classes);
22746
22739
  }
22747
- if (options2) {
22748
- symbolNode.maxFontSize = options2.sizeMultiplier;
22749
- if (options2.style.isTight()) {
22750
- symbolNode.classes.push("mtight");
22751
- }
22752
- var color2 = options2.getColor();
22753
- if (color2) {
22754
- symbolNode.style.color = color2;
22755
- }
22740
+ symbolNode.maxFontSize = options2.sizeMultiplier;
22741
+ if (options2.style.isTight()) {
22742
+ symbolNode.classes.push("mtight");
22743
+ }
22744
+ var color2 = options2.getColor();
22745
+ if (color2) {
22746
+ symbolNode.style.color = color2;
22756
22747
  }
22757
22748
  return symbolNode;
22758
22749
  };
@@ -22781,16 +22772,12 @@ var boldSymbol = function boldSymbol2(value, mode, type) {
22781
22772
  };
22782
22773
  }
22783
22774
  };
22784
- var makeOrd = function makeOrd2(group, options2, type) {
22775
+ var makeOrd = function makeOrd2(group, options2) {
22776
+ var type = group.type === "mathord" ? "mathord" : "textord";
22785
22777
  var mode = group.mode;
22786
22778
  var text2 = group.text;
22787
22779
  var classes = ["mord"];
22788
- var {
22789
- font,
22790
- fontFamily,
22791
- fontWeight,
22792
- fontShape
22793
- } = options2;
22780
+ var font = options2.font, fontFamily = options2.fontFamily, fontWeight = options2.fontWeight, fontShape = options2.fontShape;
22794
22781
  var useFont = mode === "math" || mode === "text" && !!font;
22795
22782
  var fontOrFamily = useFont ? font : fontFamily;
22796
22783
  var wideFontName = "";
@@ -22818,7 +22805,7 @@ var makeOrd = function makeOrd2(group, options2, type) {
22818
22805
  }
22819
22806
  if (lookupSymbol(text2, fontName, mode).metrics) {
22820
22807
  return makeSymbol(text2, fontName, mode, options2, classes.concat(fontClasses));
22821
- } else if (ligatures.hasOwnProperty(text2) && fontName.slice(0, 10) === "Typewriter") {
22808
+ } else if (Object.prototype.hasOwnProperty.call(ligatures, text2) && fontName.slice(0, 10) === "Typewriter") {
22822
22809
  var parts = [];
22823
22810
  for (var i = 0; i < text2.length; i++) {
22824
22811
  parts.push(makeSymbol(text2[i], fontName, mode, options2, classes.concat(fontClasses)));
@@ -22980,10 +22967,7 @@ var getVListChildrenAndDepth = function getVListChildrenAndDepth2(params) {
22980
22967
  };
22981
22968
  };
22982
22969
  var makeVList = function makeVList2(params, options2) {
22983
- var {
22984
- children,
22985
- depth
22986
- } = getVListChildrenAndDepth(params);
22970
+ var _getVListChildrenAndD = getVListChildrenAndDepth(params), children = _getVListChildrenAndD.children, depth = _getVListChildrenAndD.depth;
22987
22971
  var pstrutSize = 0;
22988
22972
  for (var i = 0; i < children.length; i++) {
22989
22973
  var child = children[i];
@@ -23143,7 +23127,7 @@ var svgData = {
23143
23127
  oiiintSize2: ["oiiintSize2", 1.98, 0.659]
23144
23128
  };
23145
23129
  var staticSvg = function staticSvg2(value, options2) {
23146
- var [pathName, width, height] = svgData[value];
23130
+ var _svgData$value = svgData[value], pathName = _svgData$value[0], width = _svgData$value[1], height = _svgData$value[2];
23147
23131
  var path2 = new PathNode(pathName);
23148
23132
  var svgNode = new SvgNode([path2], {
23149
23133
  "width": makeEm(width),
@@ -23153,7 +23137,7 @@ var staticSvg = function staticSvg2(value, options2) {
23153
23137
  "viewBox": "0 0 " + 1e3 * width + " " + 1e3 * height,
23154
23138
  "preserveAspectRatio": "xMinYMin"
23155
23139
  });
23156
- var span = makeSvgSpan(["overlay"], [svgNode], options2);
23140
+ var span = makeSvgSpan(["katex-overlay"], [svgNode], options2);
23157
23141
  span.height = height;
23158
23142
  span.style.height = makeEm(height);
23159
23143
  span.style.width = makeEm(width);
@@ -23244,27 +23228,8 @@ var tightSpacings = {
23244
23228
  var _functions = {};
23245
23229
  var _htmlGroupBuilders = {};
23246
23230
  var _mathmlGroupBuilders = {};
23247
- function defineFunction(_ref) {
23248
- var {
23249
- type,
23250
- names,
23251
- props,
23252
- handler,
23253
- htmlBuilder: htmlBuilder3,
23254
- mathmlBuilder: mathmlBuilder3
23255
- } = _ref;
23256
- var data2 = {
23257
- type,
23258
- numArgs: props.numArgs,
23259
- argTypes: props.argTypes,
23260
- allowedInArgument: !!props.allowedInArgument,
23261
- allowedInText: !!props.allowedInText,
23262
- allowedInMath: props.allowedInMath === void 0 ? true : props.allowedInMath,
23263
- numOptionalArgs: props.numOptionalArgs || 0,
23264
- infix: !!props.infix,
23265
- primitive: !!props.primitive,
23266
- handler
23267
- };
23231
+ function defineFunction(data2) {
23232
+ var type = data2.type, names = data2.names, htmlBuilder3 = data2.htmlBuilder, mathmlBuilder3 = data2.mathmlBuilder;
23268
23233
  for (var i = 0; i < names.length; ++i) {
23269
23234
  _functions[names[i]] = data2;
23270
23235
  }
@@ -23277,24 +23242,14 @@ function defineFunction(_ref) {
23277
23242
  }
23278
23243
  }
23279
23244
  }
23280
- function defineFunctionBuilders(_ref2) {
23281
- var {
23282
- type,
23283
- htmlBuilder: htmlBuilder3,
23284
- mathmlBuilder: mathmlBuilder3
23285
- } = _ref2;
23286
- defineFunction({
23287
- type,
23288
- names: [],
23289
- props: {
23290
- numArgs: 0
23291
- },
23292
- handler() {
23293
- throw new Error("Should never be called.");
23294
- },
23295
- htmlBuilder: htmlBuilder3,
23296
- mathmlBuilder: mathmlBuilder3
23297
- });
23245
+ function defineFunctionBuilders(_ref) {
23246
+ var type = _ref.type, htmlBuilder3 = _ref.htmlBuilder, mathmlBuilder3 = _ref.mathmlBuilder;
23247
+ if (htmlBuilder3) {
23248
+ _htmlGroupBuilders[type] = htmlBuilder3;
23249
+ }
23250
+ if (mathmlBuilder3) {
23251
+ _mathmlGroupBuilders[type] = mathmlBuilder3;
23252
+ }
23298
23253
  }
23299
23254
  var normalizeArgument = function normalizeArgument2(arg) {
23300
23255
  return arg.type === "ordgroup" && arg.body.length === 1 ? arg.body[0] : arg;
@@ -23400,7 +23355,7 @@ var _traverseNonSpaceNodes = function traverseNonSpaceNodes(nodes, callback, pre
23400
23355
  }
23401
23356
  if (nonspace) {
23402
23357
  prev.node = node;
23403
- } else if (isRoot && node.hasClass("newline")) {
23358
+ } else if (isRoot && node.hasClass("katex-newline")) {
23404
23359
  prev.node = makeSpan(["leftmost"]);
23405
23360
  }
23406
23361
  prev.insertAfter = /* @__PURE__ */ ((index2) => (n) => {
@@ -23464,8 +23419,8 @@ var buildGroup$1 = function buildGroup(group, options2, baseOptions) {
23464
23419
  }
23465
23420
  };
23466
23421
  function buildHTMLUnbreakable(children, options2) {
23467
- var body = makeSpan(["base"], children, options2);
23468
- var strut = makeSpan(["strut"]);
23422
+ var body = makeSpan(["katex-base"], children, options2);
23423
+ var strut = makeSpan(["katex-strut"]);
23469
23424
  strut.style.height = makeEm(body.height + body.depth);
23470
23425
  if (body.depth) {
23471
23426
  strut.style.verticalAlign = makeEm(-body.depth);
@@ -23481,7 +23436,7 @@ function buildHTML(tree, options2) {
23481
23436
  }
23482
23437
  var expression = buildExpression$1(tree, options2, "root");
23483
23438
  var eqnNum;
23484
- if (expression.length === 2 && expression[1].hasClass("tag")) {
23439
+ if (expression.length === 2 && expression[1].hasClass("katex-tag")) {
23485
23440
  eqnNum = expression.pop();
23486
23441
  }
23487
23442
  var children = [];
@@ -23490,7 +23445,7 @@ function buildHTML(tree, options2) {
23490
23445
  parts.push(expression[i]);
23491
23446
  if (expression[i].hasClass("mbin") || expression[i].hasClass("mrel") || expression[i].hasClass("allowbreak")) {
23492
23447
  var nobreak = false;
23493
- while (i < expression.length - 1 && expression[i + 1].hasClass("mspace") && !expression[i + 1].hasClass("newline")) {
23448
+ while (i < expression.length - 1 && expression[i + 1].hasClass("mspace") && !expression[i + 1].hasClass("katex-newline")) {
23494
23449
  i++;
23495
23450
  parts.push(expression[i]);
23496
23451
  if (expression[i].hasClass("nobreak")) {
@@ -23501,7 +23456,7 @@ function buildHTML(tree, options2) {
23501
23456
  children.push(buildHTMLUnbreakable(parts, options2));
23502
23457
  parts = [];
23503
23458
  }
23504
- } else if (expression[i].hasClass("newline")) {
23459
+ } else if (expression[i].hasClass("katex-newline")) {
23505
23460
  parts.pop();
23506
23461
  if (parts.length > 0) {
23507
23462
  children.push(buildHTMLUnbreakable(parts, options2));
@@ -23516,7 +23471,7 @@ function buildHTML(tree, options2) {
23516
23471
  var tagChild;
23517
23472
  if (tag) {
23518
23473
  tagChild = buildHTMLUnbreakable(buildExpression$1(tag, options2, true), options2);
23519
- tagChild.classes = ["tag"];
23474
+ tagChild.classes = ["katex-tag"];
23520
23475
  children.push(tagChild);
23521
23476
  } else if (eqnNum) {
23522
23477
  children.push(eqnNum);
@@ -23564,10 +23519,10 @@ class MathNode {
23564
23519
  */
23565
23520
  toNode() {
23566
23521
  var node = document.createElementNS("http://www.w3.org/1998/Math/MathML", this.type);
23567
- for (var attr in this.attributes) {
23568
- if (Object.prototype.hasOwnProperty.call(this.attributes, attr)) {
23569
- node.setAttribute(attr, this.attributes[attr]);
23570
- }
23522
+ for (var _ref2 of Object.entries(this.attributes)) {
23523
+ var attr = _ref2[0];
23524
+ var value = _ref2[1];
23525
+ node.setAttribute(attr, value);
23571
23526
  }
23572
23527
  if (this.classes.length > 0) {
23573
23528
  node.className = createClass(this.classes);
@@ -23590,12 +23545,12 @@ class MathNode {
23590
23545
  */
23591
23546
  toMarkup() {
23592
23547
  var markup = "<" + this.type;
23593
- for (var attr in this.attributes) {
23594
- if (Object.prototype.hasOwnProperty.call(this.attributes, attr)) {
23595
- markup += " " + attr + '="';
23596
- markup += escape$1(this.attributes[attr]);
23597
- markup += '"';
23598
- }
23548
+ for (var _ref4 of Object.entries(this.attributes)) {
23549
+ var attr = _ref4[0];
23550
+ var value = _ref4[1];
23551
+ markup += " " + attr + '="';
23552
+ markup += escape$1(value);
23553
+ markup += '"';
23599
23554
  }
23600
23555
  if (this.classes.length > 0) {
23601
23556
  markup += ' class ="' + escape$1(createClass(this.classes)) + '"';
@@ -23704,7 +23659,8 @@ class SpaceNode {
23704
23659
  var noVariantSymbols = /* @__PURE__ */ new Set(["\\imath", "\\jmath"]);
23705
23660
  var rowLikeTypes = /* @__PURE__ */ new Set(["mrow", "mtable"]);
23706
23661
  var makeText = function makeText2(text2, mode, options2) {
23707
- if (symbols[mode][text2] && symbols[mode][text2].replace && text2.charCodeAt(0) !== 55349 && !(ligatures.hasOwnProperty(text2) && options2 && (options2.fontFamily && options2.fontFamily.slice(4, 6) === "tt" || options2.font && options2.font.slice(4, 6) === "tt"))) {
23662
+ var _options$fontFamily, _options$font;
23663
+ if (symbols[mode][text2] && symbols[mode][text2].replace && text2.charCodeAt(0) !== 55349 && !(Object.prototype.hasOwnProperty.call(ligatures, text2) && ((options2 == null || (_options$fontFamily = options2.fontFamily) == null ? void 0 : _options$fontFamily.slice(4, 6)) === "tt" || (options2 == null || (_options$font = options2.font) == null ? void 0 : _options$font.slice(4, 6)) === "tt"))) {
23708
23664
  text2 = symbols[mode][text2].replace;
23709
23665
  }
23710
23666
  return new TextNode2(text2);
@@ -23928,6 +23884,7 @@ class Options {
23928
23884
  this.maxSize = void 0;
23929
23885
  this.minRuleThickness = void 0;
23930
23886
  this._fontMetrics = void 0;
23887
+ this.strict = void 0;
23931
23888
  this.style = data2.style;
23932
23889
  this.color = data2.color;
23933
23890
  this.size = data2.size || Options.BASESIZE;
@@ -23940,6 +23897,7 @@ class Options {
23940
23897
  this.sizeMultiplier = sizeMultipliers[this.size - 1];
23941
23898
  this.maxSize = data2.maxSize;
23942
23899
  this.minRuleThickness = data2.minRuleThickness;
23900
+ this.strict = data2.strict;
23943
23901
  this._fontMetrics = void 0;
23944
23902
  }
23945
23903
  /**
@@ -23958,7 +23916,8 @@ class Options {
23958
23916
  fontWeight: this.fontWeight,
23959
23917
  fontShape: this.fontShape,
23960
23918
  maxSize: this.maxSize,
23961
- minRuleThickness: this.minRuleThickness
23919
+ minRuleThickness: this.minRuleThickness,
23920
+ strict: this.strict
23962
23921
  };
23963
23922
  Object.assign(data2, extension);
23964
23923
  return new Options(data2);
@@ -24097,7 +24056,7 @@ class Options {
24097
24056
  */
24098
24057
  sizingClasses(oldOptions) {
24099
24058
  if (oldOptions.size !== this.size) {
24100
- return ["sizing", "reset-size" + oldOptions.size, "size" + this.size];
24059
+ return ["katex-sizing", "reset-size" + oldOptions.size, "size" + this.size];
24101
24060
  } else {
24102
24061
  return [];
24103
24062
  }
@@ -24108,7 +24067,7 @@ class Options {
24108
24067
  */
24109
24068
  baseSizingClasses() {
24110
24069
  if (this.size !== Options.BASESIZE) {
24111
- return ["sizing", "reset-size" + this.size, "size" + Options.BASESIZE];
24070
+ return ["katex-sizing", "reset-size" + this.size, "size" + Options.BASESIZE];
24112
24071
  } else {
24113
24072
  return [];
24114
24073
  }
@@ -24134,13 +24093,12 @@ class Options {
24134
24093
  }
24135
24094
  }
24136
24095
  Options.BASESIZE = 6;
24137
- var optionsFromSettings = function optionsFromSettings2(settings) {
24138
- return new Options({
24139
- style: settings.displayMode ? Style$1.DISPLAY : Style$1.TEXT,
24140
- maxSize: settings.maxSize,
24141
- minRuleThickness: settings.minRuleThickness
24142
- });
24143
- };
24096
+ var optionsFromSettings = (settings) => new Options({
24097
+ style: settings.displayMode ? Style$1.DISPLAY : Style$1.TEXT,
24098
+ maxSize: settings.maxSize,
24099
+ minRuleThickness: settings.minRuleThickness,
24100
+ strict: settings.strict
24101
+ });
24144
24102
  var displayWrap = function displayWrap2(node, settings) {
24145
24103
  if (settings.displayMode) {
24146
24104
  var classes = ["katex-display"];
@@ -24169,7 +24127,7 @@ var buildTree = function buildTree2(tree, expression, settings) {
24169
24127
  }
24170
24128
  return displayWrap(katexNode, settings);
24171
24129
  };
24172
- var buildHTMLTree = function buildHTMLTree2(tree, expression, settings) {
24130
+ var buildHTMLTree = function buildHTMLTree2(tree, settings) {
24173
24131
  var options2 = optionsFromSettings(settings);
24174
24132
  var htmlNode = buildHTML(tree, options2);
24175
24133
  var katexNode = makeSpan(["katex"], [htmlNode]);
@@ -24332,7 +24290,7 @@ var stretchySvg = function stretchySvg2(group, options2) {
24332
24290
  if (!data2) {
24333
24291
  throw new Error('No SVG data for "' + label + '".');
24334
24292
  }
24335
- var [paths, _minWidth, _viewBoxHeight] = data2;
24293
+ var paths = data2[0], _minWidth = data2[1], _viewBoxHeight = data2[2];
24336
24294
  var _height2 = _viewBoxHeight / 1e3;
24337
24295
  var numSvgChildren = paths.length;
24338
24296
  var widthClasses;
@@ -24373,17 +24331,13 @@ var stretchySvg = function stretchySvg2(group, options2) {
24373
24331
  }
24374
24332
  }
24375
24333
  return {
24376
- span: makeSpan(["stretchy"], spans, options2),
24334
+ span: makeSpan(["katex-stretchy"], spans, options2),
24377
24335
  minWidth: _minWidth,
24378
24336
  height: _height2
24379
24337
  };
24380
24338
  }
24381
24339
  }
24382
- var {
24383
- span,
24384
- minWidth,
24385
- height
24386
- } = buildSvgSpan_();
24340
+ var _buildSvgSpan_ = buildSvgSpan_(), span = _buildSvgSpan_.span, minWidth = _buildSvgSpan_.minWidth, height = _buildSvgSpan_.height;
24387
24341
  span.height = height;
24388
24342
  span.style.height = makeEm(height);
24389
24343
  if (minWidth > 0) {
@@ -24395,7 +24349,7 @@ var stretchyEnclose = function stretchyEnclose2(inner2, label, topPad, bottomPad
24395
24349
  var img;
24396
24350
  var totalHeight = inner2.height + inner2.depth + topPad + bottomPad;
24397
24351
  if (/fbox|color|angl/.test(label)) {
24398
- img = makeSpan(["stretchy", label], [], options2);
24352
+ img = makeSpan(["katex-stretchy", label], [], options2);
24399
24353
  if (label === "fbox") {
24400
24354
  var color2 = options2.color && options2.getColor();
24401
24355
  if (color2) {
@@ -24432,23 +24386,12 @@ var stretchyEnclose = function stretchyEnclose2(inner2, label, topPad, bottomPad
24432
24386
  img.style.height = makeEm(totalHeight);
24433
24387
  return img;
24434
24388
  };
24435
- var ATOMS = {
24436
- "bin": 1,
24437
- "close": 1,
24438
- "inner": 1,
24439
- "open": 1,
24440
- "punct": 1,
24441
- "rel": 1
24442
- };
24443
- var NON_ATOMS = {
24444
- "accent-token": 1,
24445
- "mathord": 1,
24446
- "op-token": 1,
24447
- "spacing": 1,
24448
- "textord": 1
24449
- };
24389
+ var atomList = ["bin", "close", "inner", "open", "punct", "rel"];
24390
+ var nonAtomList = ["accent-token", "mathord", "op-token", "spacing", "textord"];
24391
+ var Atoms = new Set(atomList);
24392
+ var NonAtoms = new Set(nonAtomList);
24450
24393
  function isAtom(value) {
24451
- return value in ATOMS;
24394
+ return Atoms.has(value);
24452
24395
  }
24453
24396
  function assertNodeType(node, type) {
24454
24397
  if (!node || node.type !== type) {
@@ -24464,11 +24407,24 @@ function assertSymbolNodeType(node) {
24464
24407
  return typedNode;
24465
24408
  }
24466
24409
  function checkSymbolNodeType(node) {
24467
- if (node && (node.type === "atom" || NON_ATOMS.hasOwnProperty(node.type))) {
24410
+ if (node.type === "atom" || NonAtoms.has(node.type)) {
24468
24411
  return node;
24469
24412
  }
24470
24413
  return null;
24471
24414
  }
24415
+ function assertCharacterGroup(group, errorMessage, allowSpaces) {
24416
+ var text2 = "";
24417
+ for (var node of group.body) {
24418
+ if (node.type === "textord") {
24419
+ text2 += node.text;
24420
+ } else if (allowSpaces && node.type === "spacing" && node.text === " ") {
24421
+ text2 += " ";
24422
+ } else {
24423
+ throw new ParseError(errorMessage, group);
24424
+ }
24425
+ }
24426
+ return text2;
24427
+ }
24472
24428
  var getBaseSymbol = (group) => {
24473
24429
  if (group instanceof SymbolNode) {
24474
24430
  return group;
@@ -24509,9 +24465,10 @@ var htmlBuilder$a = (grp, options2) => {
24509
24465
  width = svgData.vec[1];
24510
24466
  } else {
24511
24467
  accent2 = makeOrd({
24468
+ type: "textord",
24512
24469
  mode: group.mode,
24513
24470
  text: group.label
24514
- }, options2, "textord");
24471
+ }, options2);
24515
24472
  accent2 = assertSymbolDomNode(accent2);
24516
24473
  accent2.italic = 0;
24517
24474
  width = accent2.width;
@@ -24564,7 +24521,7 @@ var htmlBuilder$a = (grp, options2) => {
24564
24521
  }]
24565
24522
  });
24566
24523
  }
24567
- var accentWrap = makeSpan(["mord", "accent"], [accentBody], options2);
24524
+ var accentWrap = makeSpan(["mord", "katex-accent"], [accentBody], options2);
24568
24525
  if (supSubGroup) {
24569
24526
  supSubGroup.children[0] = accentWrap;
24570
24527
  supSubGroup.height = Math.max(accentWrap.height, supSubGroup.height);
@@ -24584,9 +24541,7 @@ var NON_STRETCHY_ACCENT_REGEX = new RegExp(["\\acute", "\\grave", "\\ddot", "\\t
24584
24541
  defineFunction({
24585
24542
  type: "accent",
24586
24543
  names: ["\\acute", "\\grave", "\\ddot", "\\tilde", "\\bar", "\\breve", "\\check", "\\hat", "\\vec", "\\dot", "\\mathring", "\\widecheck", "\\widehat", "\\widetilde", "\\overrightarrow", "\\overleftarrow", "\\Overrightarrow", "\\overleftrightarrow", "\\overgroup", "\\overlinesegment", "\\overleftharpoon", "\\overrightharpoon"],
24587
- props: {
24588
- numArgs: 1
24589
- },
24544
+ numArgs: 1,
24590
24545
  handler: (context, args) => {
24591
24546
  var base2 = normalizeArgument(args[0]);
24592
24547
  var isStretchy = !NON_STRETCHY_ACCENT_REGEX.test(context.funcName);
@@ -24606,18 +24561,21 @@ defineFunction({
24606
24561
  defineFunction({
24607
24562
  type: "accent",
24608
24563
  names: ["\\'", "\\`", "\\^", "\\~", "\\=", "\\u", "\\.", '\\"', "\\c", "\\r", "\\H", "\\v", "\\textcircled"],
24609
- props: {
24610
- numArgs: 1,
24611
- allowedInText: true,
24612
- allowedInMath: true,
24613
- // unless in strict mode
24614
- argTypes: ["primitive"]
24615
- },
24564
+ numArgs: 1,
24565
+ allowedInText: true,
24566
+ allowedInMath: true,
24567
+ // unless in strict mode
24568
+ argTypes: ["primitive"],
24616
24569
  handler: (context, args) => {
24617
24570
  var base2 = args[0];
24618
24571
  var mode = context.parser.mode;
24619
24572
  if (mode === "math") {
24620
- context.parser.settings.reportNonstrict("mathVsTextAccents", "LaTeX's accent " + context.funcName + " works only in text mode");
24573
+ handleStrict({
24574
+ strict: context.parser.settings.strict,
24575
+ errorCode: "mathVsTextAccents",
24576
+ errorMsg: "LaTeX's accent " + context.funcName + " works only in text mode",
24577
+ report: true
24578
+ });
24621
24579
  mode = "text";
24622
24580
  }
24623
24581
  return {
@@ -24628,21 +24586,14 @@ defineFunction({
24628
24586
  isShifty: true,
24629
24587
  base: base2
24630
24588
  };
24631
- },
24632
- htmlBuilder: htmlBuilder$a,
24633
- mathmlBuilder: mathmlBuilder$9
24589
+ }
24634
24590
  });
24635
24591
  defineFunction({
24636
24592
  type: "accentUnder",
24637
24593
  names: ["\\underleftarrow", "\\underrightarrow", "\\underleftrightarrow", "\\undergroup", "\\underlinesegment", "\\utilde"],
24638
- props: {
24639
- numArgs: 1
24640
- },
24594
+ numArgs: 1,
24641
24595
  handler: (_ref, args) => {
24642
- var {
24643
- parser: parser2,
24644
- funcName
24645
- } = _ref;
24596
+ var parser2 = _ref.parser, funcName = _ref.funcName;
24646
24597
  var base2 = args[0];
24647
24598
  return {
24648
24599
  type: "accentUnder",
@@ -24717,15 +24668,10 @@ defineFunction({
24717
24668
  "\\\\cdleftarrow",
24718
24669
  "\\\\cdlongequal"
24719
24670
  ],
24720
- props: {
24721
- numArgs: 1,
24722
- numOptionalArgs: 1
24723
- },
24671
+ numArgs: 1,
24672
+ numOptionalArgs: 1,
24724
24673
  handler(_ref, args, optArgs) {
24725
- var {
24726
- parser: parser2,
24727
- funcName
24728
- } = _ref;
24674
+ var parser2 = _ref.parser, funcName = _ref.funcName;
24729
24675
  return {
24730
24676
  type: "xArrow",
24731
24677
  mode: parser2.mode,
@@ -24843,9 +24789,6 @@ function mathmlBuilder$8(group, options2) {
24843
24789
  } else if (group.mclass === "mopen" || group.mclass === "mclose") {
24844
24790
  node.attributes.lspace = "0em";
24845
24791
  node.attributes.rspace = "0em";
24846
- } else if (group.mclass === "minner") {
24847
- node.attributes.lspace = "0.0556em";
24848
- node.attributes.width = "+0.1111em";
24849
24792
  }
24850
24793
  }
24851
24794
  return node;
@@ -24853,21 +24796,15 @@ function mathmlBuilder$8(group, options2) {
24853
24796
  defineFunction({
24854
24797
  type: "mclass",
24855
24798
  names: ["\\mathord", "\\mathbin", "\\mathrel", "\\mathopen", "\\mathclose", "\\mathpunct", "\\mathinner"],
24856
- props: {
24857
- numArgs: 1,
24858
- primitive: true
24859
- },
24799
+ numArgs: 1,
24800
+ primitive: true,
24860
24801
  handler(_ref, args) {
24861
- var {
24862
- parser: parser2,
24863
- funcName
24864
- } = _ref;
24802
+ var parser2 = _ref.parser, funcName = _ref.funcName;
24865
24803
  var body = args[0];
24866
24804
  return {
24867
24805
  type: "mclass",
24868
24806
  mode: parser2.mode,
24869
24807
  mclass: "m" + funcName.slice(5),
24870
- // TODO(kevinb): don't prefix with 'm'
24871
24808
  body: ordargument(body),
24872
24809
  isCharacterBox: isCharacterBox(body)
24873
24810
  };
@@ -24886,13 +24823,9 @@ var binrelClass = (arg) => {
24886
24823
  defineFunction({
24887
24824
  type: "mclass",
24888
24825
  names: ["\\@binrel"],
24889
- props: {
24890
- numArgs: 2
24891
- },
24826
+ numArgs: 2,
24892
24827
  handler(_ref2, args) {
24893
- var {
24894
- parser: parser2
24895
- } = _ref2;
24828
+ var parser2 = _ref2.parser;
24896
24829
  return {
24897
24830
  type: "mclass",
24898
24831
  mode: parser2.mode,
@@ -24905,14 +24838,9 @@ defineFunction({
24905
24838
  defineFunction({
24906
24839
  type: "mclass",
24907
24840
  names: ["\\stackrel", "\\overset", "\\underset"],
24908
- props: {
24909
- numArgs: 2
24910
- },
24841
+ numArgs: 2,
24911
24842
  handler(_ref3, args) {
24912
- var {
24913
- parser: parser2,
24914
- funcName
24915
- } = _ref3;
24843
+ var parser2 = _ref3.parser, funcName = _ref3.funcName;
24916
24844
  var baseArg = args[1];
24917
24845
  var shiftedArg = args[0];
24918
24846
  var mclass;
@@ -24931,12 +24859,16 @@ defineFunction({
24931
24859
  suppressBaseShift: funcName !== "\\stackrel",
24932
24860
  body: ordargument(baseArg)
24933
24861
  };
24934
- var supsub = {
24862
+ var supsub = funcName === "\\underset" ? {
24935
24863
  type: "supsub",
24936
24864
  mode: shiftedArg.mode,
24937
24865
  base: baseOp,
24938
- sup: funcName === "\\underset" ? null : shiftedArg,
24939
- sub: funcName === "\\underset" ? shiftedArg : null
24866
+ sub: shiftedArg
24867
+ } : {
24868
+ type: "supsub",
24869
+ mode: shiftedArg.mode,
24870
+ base: baseOp,
24871
+ sup: shiftedArg
24940
24872
  };
24941
24873
  return {
24942
24874
  type: "mclass",
@@ -24945,21 +24877,15 @@ defineFunction({
24945
24877
  body: [supsub],
24946
24878
  isCharacterBox: isCharacterBox(supsub)
24947
24879
  };
24948
- },
24949
- htmlBuilder: htmlBuilder$9,
24950
- mathmlBuilder: mathmlBuilder$8
24880
+ }
24951
24881
  });
24952
24882
  defineFunction({
24953
24883
  type: "pmb",
24954
24884
  names: ["\\pmb"],
24955
- props: {
24956
- numArgs: 1,
24957
- allowedInText: true
24958
- },
24885
+ numArgs: 1,
24886
+ allowedInText: true,
24959
24887
  handler(_ref, args) {
24960
- var {
24961
- parser: parser2
24962
- } = _ref;
24888
+ var parser2 = _ref.parser;
24963
24889
  return {
24964
24890
  type: "pmb",
24965
24891
  mode: parser2.mode,
@@ -25158,14 +25084,9 @@ function parseCD(parser2) {
25158
25084
  defineFunction({
25159
25085
  type: "cdlabel",
25160
25086
  names: ["\\\\cdleft", "\\\\cdright"],
25161
- props: {
25162
- numArgs: 1
25163
- },
25087
+ numArgs: 1,
25164
25088
  handler(_ref, args) {
25165
- var {
25166
- parser: parser2,
25167
- funcName
25168
- } = _ref;
25089
+ var parser2 = _ref.parser, funcName = _ref.funcName;
25169
25090
  return {
25170
25091
  type: "cdlabel",
25171
25092
  mode: parser2.mode,
@@ -25199,13 +25120,9 @@ defineFunction({
25199
25120
  defineFunction({
25200
25121
  type: "cdlabelparent",
25201
25122
  names: ["\\\\cdparent"],
25202
- props: {
25203
- numArgs: 1
25204
- },
25123
+ numArgs: 1,
25205
25124
  handler(_ref2, args) {
25206
- var {
25207
- parser: parser2
25208
- } = _ref2;
25125
+ var parser2 = _ref2.parser;
25209
25126
  return {
25210
25127
  type: "cdlabelparent",
25211
25128
  mode: parser2.mode,
@@ -25224,26 +25141,17 @@ defineFunction({
25224
25141
  defineFunction({
25225
25142
  type: "textord",
25226
25143
  names: ["\\@char"],
25227
- props: {
25228
- numArgs: 1,
25229
- allowedInText: true
25230
- },
25144
+ numArgs: 1,
25145
+ allowedInText: true,
25231
25146
  handler(_ref, args) {
25232
- var {
25233
- parser: parser2
25234
- } = _ref;
25147
+ var parser2 = _ref.parser;
25235
25148
  var arg = assertNodeType(args[0], "ordgroup");
25236
- var group = arg.body;
25237
- var number2 = "";
25238
- for (var i = 0; i < group.length; i++) {
25239
- var node = assertNodeType(group[i], "textord");
25240
- number2 += node.text;
25241
- }
25149
+ var number2 = assertCharacterGroup(arg, "\\@char has non-numeric argument");
25242
25150
  var code = parseInt(number2);
25243
25151
  var text2;
25244
25152
  if (isNaN(code)) {
25245
25153
  throw new ParseError("\\@char has non-numeric argument " + number2);
25246
- } else if (code < 0 || code >= 1114111) {
25154
+ } else if (code < 0 || code > 1114111) {
25247
25155
  throw new ParseError("\\@char with invalid code point " + number2);
25248
25156
  } else if (code <= 65535) {
25249
25157
  text2 = String.fromCharCode(code);
@@ -25271,15 +25179,11 @@ var mathmlBuilder$7 = (group, options2) => {
25271
25179
  defineFunction({
25272
25180
  type: "color",
25273
25181
  names: ["\\textcolor"],
25274
- props: {
25275
- numArgs: 2,
25276
- allowedInText: true,
25277
- argTypes: ["color", "original"]
25278
- },
25182
+ numArgs: 2,
25183
+ allowedInText: true,
25184
+ argTypes: ["color", "original"],
25279
25185
  handler(_ref, args) {
25280
- var {
25281
- parser: parser2
25282
- } = _ref;
25186
+ var parser2 = _ref.parser;
25283
25187
  var color2 = assertNodeType(args[0], "color-token").color;
25284
25188
  var body = args[1];
25285
25189
  return {
@@ -25295,16 +25199,11 @@ defineFunction({
25295
25199
  defineFunction({
25296
25200
  type: "color",
25297
25201
  names: ["\\color"],
25298
- props: {
25299
- numArgs: 1,
25300
- allowedInText: true,
25301
- argTypes: ["color"]
25302
- },
25202
+ numArgs: 1,
25203
+ allowedInText: true,
25204
+ argTypes: ["color"],
25303
25205
  handler(_ref2, args) {
25304
- var {
25305
- parser: parser2,
25306
- breakOnTokenText
25307
- } = _ref2;
25206
+ var parser2 = _ref2.parser, breakOnTokenText = _ref2.breakOnTokenText;
25308
25207
  var color2 = assertNodeType(args[0], "color-token").color;
25309
25208
  parser2.gullet.macros.set("\\current@color", color2);
25310
25209
  var body = parser2.parseExpression(true, breakOnTokenText);
@@ -25314,24 +25213,23 @@ defineFunction({
25314
25213
  color: color2,
25315
25214
  body
25316
25215
  };
25317
- },
25318
- htmlBuilder: htmlBuilder$8,
25319
- mathmlBuilder: mathmlBuilder$7
25216
+ }
25320
25217
  });
25321
25218
  defineFunction({
25322
25219
  type: "cr",
25323
25220
  names: ["\\\\"],
25324
- props: {
25325
- numArgs: 0,
25326
- numOptionalArgs: 0,
25327
- allowedInText: true
25328
- },
25329
- handler(_ref, args, optArgs) {
25330
- var {
25331
- parser: parser2
25332
- } = _ref;
25221
+ numArgs: 0,
25222
+ numOptionalArgs: 0,
25223
+ allowedInText: true,
25224
+ handler(_ref) {
25225
+ var parser2 = _ref.parser;
25333
25226
  var size = parser2.gullet.future().text === "[" ? parser2.parseSizeGroup(true) : null;
25334
- var newLine = !parser2.settings.displayMode || !parser2.settings.useStrictBehavior("newLineInDisplayMode", "In LaTeX, \\\\ or \\newline does nothing in display mode");
25227
+ var newLine = !parser2.settings.displayMode || !handleStrict({
25228
+ strict: parser2.settings.strict,
25229
+ errorCode: "newLineInDisplayMode",
25230
+ errorMsg: "In LaTeX, \\\\ or \\newline does nothing in display mode",
25231
+ report: false
25232
+ });
25335
25233
  return {
25336
25234
  type: "cr",
25337
25235
  mode: parser2.mode,
@@ -25344,7 +25242,7 @@ defineFunction({
25344
25242
  htmlBuilder(group, options2) {
25345
25243
  var span = makeSpan(["mspace"], [], options2);
25346
25244
  if (group.newLine) {
25347
- span.classes.push("newline");
25245
+ span.classes.push("katex-newline");
25348
25246
  if (group.size) {
25349
25247
  span.style.marginTop = makeEm(calculateSize(group.size, options2));
25350
25248
  }
@@ -25411,15 +25309,10 @@ defineFunction({
25411
25309
  "\\\\globallong"
25412
25310
  // can’t be entered directly
25413
25311
  ],
25414
- props: {
25415
- numArgs: 0,
25416
- allowedInText: true
25417
- },
25312
+ numArgs: 0,
25313
+ allowedInText: true,
25418
25314
  handler(_ref) {
25419
- var {
25420
- parser: parser2,
25421
- funcName
25422
- } = _ref;
25315
+ var parser2 = _ref.parser, funcName = _ref.funcName;
25423
25316
  parser2.consumeSpaces();
25424
25317
  var token = parser2.fetch();
25425
25318
  if (globalMap[token.text]) {
@@ -25434,16 +25327,11 @@ defineFunction({
25434
25327
  defineFunction({
25435
25328
  type: "internal",
25436
25329
  names: ["\\def", "\\gdef", "\\edef", "\\xdef"],
25437
- props: {
25438
- numArgs: 0,
25439
- allowedInText: true,
25440
- primitive: true
25441
- },
25330
+ numArgs: 0,
25331
+ allowedInText: true,
25332
+ primitive: true,
25442
25333
  handler(_ref2) {
25443
- var {
25444
- parser: parser2,
25445
- funcName
25446
- } = _ref2;
25334
+ var parser2 = _ref2.parser, funcName = _ref2.funcName;
25447
25335
  var tok = parser2.gullet.popToken();
25448
25336
  var name2 = tok.text;
25449
25337
  if (/^(?:[\\{}$&#^_]|EOF)$/.test(name2)) {
@@ -25475,9 +25363,7 @@ defineFunction({
25475
25363
  delimiters2[numArgs].push(tok.text);
25476
25364
  }
25477
25365
  }
25478
- var {
25479
- tokens
25480
- } = parser2.gullet.consumeArg();
25366
+ var _parser$gullet$consum = parser2.gullet.consumeArg(), tokens = _parser$gullet$consum.tokens;
25481
25367
  if (insert2) {
25482
25368
  tokens.unshift(insert2);
25483
25369
  }
@@ -25503,16 +25389,11 @@ defineFunction({
25503
25389
  "\\\\globallet"
25504
25390
  // can’t be entered directly
25505
25391
  ],
25506
- props: {
25507
- numArgs: 0,
25508
- allowedInText: true,
25509
- primitive: true
25510
- },
25392
+ numArgs: 0,
25393
+ allowedInText: true,
25394
+ primitive: true,
25511
25395
  handler(_ref3) {
25512
- var {
25513
- parser: parser2,
25514
- funcName
25515
- } = _ref3;
25396
+ var parser2 = _ref3.parser, funcName = _ref3.funcName;
25516
25397
  var name2 = checkControlSequence(parser2.gullet.popToken());
25517
25398
  parser2.gullet.consumeSpaces();
25518
25399
  var tok = getRHS(parser2);
@@ -25530,16 +25411,11 @@ defineFunction({
25530
25411
  "\\\\globalfuture"
25531
25412
  // can’t be entered directly
25532
25413
  ],
25533
- props: {
25534
- numArgs: 0,
25535
- allowedInText: true,
25536
- primitive: true
25537
- },
25414
+ numArgs: 0,
25415
+ allowedInText: true,
25416
+ primitive: true,
25538
25417
  handler(_ref4) {
25539
- var {
25540
- parser: parser2,
25541
- funcName
25542
- } = _ref4;
25418
+ var parser2 = _ref4.parser, funcName = _ref4.funcName;
25543
25419
  var name2 = checkControlSequence(parser2.gullet.popToken());
25544
25420
  var middle = parser2.gullet.popToken();
25545
25421
  var tok = parser2.gullet.popToken();
@@ -25596,14 +25472,14 @@ var makeLargeDelim = function makeLargeDelim2(delim, size, center, options2, mod
25596
25472
  }
25597
25473
  return span;
25598
25474
  };
25599
- var makeGlyphSpan = function makeGlyphSpan2(symbol, font, mode) {
25475
+ var makeGlyphSpan = function makeGlyphSpan2(symbol, font, mode, options2) {
25600
25476
  var sizeClass;
25601
25477
  if (font === "Size1-Regular") {
25602
25478
  sizeClass = "delim-size1";
25603
25479
  } else {
25604
25480
  sizeClass = "delim-size4";
25605
25481
  }
25606
- var corner = makeSpan(["delimsizinginner", sizeClass], [makeSpan([], [makeSymbol(symbol, font, mode)])]);
25482
+ var corner = makeSpan(["delimsizinginner", sizeClass], [makeSpan([], [makeSymbol(symbol, font, mode, options2)])]);
25607
25483
  return {
25608
25484
  type: "elem",
25609
25485
  elem: corner
@@ -25798,7 +25674,7 @@ var makeStackedDelim = function makeStackedDelim2(delim, heightTotal, center, op
25798
25674
  elem: wrapper
25799
25675
  });
25800
25676
  } else {
25801
- stack.push(makeGlyphSpan(bottom, font, mode));
25677
+ stack.push(makeGlyphSpan(bottom, font, mode, options2));
25802
25678
  stack.push(lap);
25803
25679
  if (middle === null) {
25804
25680
  var innerHeight = realHeightTotal - topHeightTotal - bottomHeightTotal + 2 * lapInEms;
@@ -25807,12 +25683,12 @@ var makeStackedDelim = function makeStackedDelim2(delim, heightTotal, center, op
25807
25683
  var _innerHeight = (realHeightTotal - topHeightTotal - bottomHeightTotal - middleHeightTotal) / 2 + 2 * lapInEms;
25808
25684
  stack.push(makeInner(repeat, _innerHeight, options2));
25809
25685
  stack.push(lap);
25810
- stack.push(makeGlyphSpan(middle, font, mode));
25686
+ stack.push(makeGlyphSpan(middle, font, mode, options2));
25811
25687
  stack.push(lap);
25812
25688
  stack.push(makeInner(repeat, _innerHeight, options2));
25813
25689
  }
25814
25690
  stack.push(lap);
25815
- stack.push(makeGlyphSpan(top2, font, mode));
25691
+ stack.push(makeGlyphSpan(top2, font, mode, options2));
25816
25692
  }
25817
25693
  var newOptions = options2.havingBaseStyle(Style$1.TEXT);
25818
25694
  var inner2 = makeVList({
@@ -26118,12 +25994,10 @@ function checkDelimiter(delim, context) {
26118
25994
  defineFunction({
26119
25995
  type: "delimsizing",
26120
25996
  names: ["\\bigl", "\\Bigl", "\\biggl", "\\Biggl", "\\bigr", "\\Bigr", "\\biggr", "\\Biggr", "\\bigm", "\\Bigm", "\\biggm", "\\Biggm", "\\big", "\\Big", "\\bigg", "\\Bigg"],
26121
- props: {
26122
- numArgs: 1,
26123
- argTypes: ["primitive"]
26124
- },
25997
+ numArgs: 1,
25998
+ argTypes: ["primitive"],
26125
25999
  handler: (context, args) => {
26126
- var delim = checkDelimiter(args[0], context);
26000
+ var delim = checkDelimiter(normalizeArgument(args[0]), context);
26127
26001
  return {
26128
26002
  type: "delimsizing",
26129
26003
  mode: context.parser.mode,
@@ -26164,10 +26038,8 @@ function assertParsed(group) {
26164
26038
  defineFunction({
26165
26039
  type: "leftright-right",
26166
26040
  names: ["\\right"],
26167
- props: {
26168
- numArgs: 1,
26169
- primitive: true
26170
- },
26041
+ numArgs: 1,
26042
+ primitive: true,
26171
26043
  handler: (context, args) => {
26172
26044
  var color2 = context.parser.gullet.macros.get("\\current@color");
26173
26045
  if (color2 && typeof color2 !== "string") {
@@ -26185,10 +26057,8 @@ defineFunction({
26185
26057
  defineFunction({
26186
26058
  type: "leftright",
26187
26059
  names: ["\\left"],
26188
- props: {
26189
- numArgs: 1,
26190
- primitive: true
26191
- },
26060
+ numArgs: 1,
26061
+ primitive: true,
26192
26062
  handler: (context, args) => {
26193
26063
  var delim = checkDelimiter(args[0], context);
26194
26064
  var parser2 = context.parser;
@@ -26271,10 +26141,8 @@ defineFunction({
26271
26141
  defineFunction({
26272
26142
  type: "middle",
26273
26143
  names: ["\\middle"],
26274
- props: {
26275
- numArgs: 1,
26276
- primitive: true
26277
- },
26144
+ numArgs: 1,
26145
+ primitive: true,
26278
26146
  handler: (context, args) => {
26279
26147
  var delim = checkDelimiter(args[0], context);
26280
26148
  if (!context.parser.leftrightDepth) {
@@ -26316,7 +26184,7 @@ var htmlBuilder$7 = (group, options2) => {
26316
26184
  var imgShift;
26317
26185
  var isSingleChar = isCharacterBox(group.body);
26318
26186
  if (label === "sout") {
26319
- img = makeSpan(["stretchy", "sout"]);
26187
+ img = makeSpan(["katex-stretchy", "katex-sout"]);
26320
26188
  img.height = options2.fontMetrics().defaultRuleThickness / scale;
26321
26189
  imgShift = -0.5 * options2.fontMetrics().xHeight;
26322
26190
  } else if (label === "phase") {
@@ -26486,16 +26354,11 @@ var mathmlBuilder$6 = (group, options2) => {
26486
26354
  defineFunction({
26487
26355
  type: "enclose",
26488
26356
  names: ["\\colorbox"],
26489
- props: {
26490
- numArgs: 2,
26491
- allowedInText: true,
26492
- argTypes: ["color", "hbox"]
26493
- },
26357
+ numArgs: 2,
26358
+ allowedInText: true,
26359
+ argTypes: ["color", "hbox"],
26494
26360
  handler(_ref, args, optArgs) {
26495
- var {
26496
- parser: parser2,
26497
- funcName
26498
- } = _ref;
26361
+ var parser2 = _ref.parser, funcName = _ref.funcName;
26499
26362
  var color2 = assertNodeType(args[0], "color-token").color;
26500
26363
  var body = args[1];
26501
26364
  return {
@@ -26512,16 +26375,11 @@ defineFunction({
26512
26375
  defineFunction({
26513
26376
  type: "enclose",
26514
26377
  names: ["\\fcolorbox"],
26515
- props: {
26516
- numArgs: 3,
26517
- allowedInText: true,
26518
- argTypes: ["color", "color", "hbox"]
26519
- },
26378
+ numArgs: 3,
26379
+ allowedInText: true,
26380
+ argTypes: ["color", "color", "hbox"],
26520
26381
  handler(_ref2, args, optArgs) {
26521
- var {
26522
- parser: parser2,
26523
- funcName
26524
- } = _ref2;
26382
+ var parser2 = _ref2.parser, funcName = _ref2.funcName;
26525
26383
  var borderColor = assertNodeType(args[0], "color-token").color;
26526
26384
  var backgroundColor = assertNodeType(args[1], "color-token").color;
26527
26385
  var body = args[2];
@@ -26533,22 +26391,16 @@ defineFunction({
26533
26391
  borderColor,
26534
26392
  body
26535
26393
  };
26536
- },
26537
- htmlBuilder: htmlBuilder$7,
26538
- mathmlBuilder: mathmlBuilder$6
26394
+ }
26539
26395
  });
26540
26396
  defineFunction({
26541
26397
  type: "enclose",
26542
26398
  names: ["\\fbox"],
26543
- props: {
26544
- numArgs: 1,
26545
- argTypes: ["hbox"],
26546
- allowedInText: true
26547
- },
26399
+ numArgs: 1,
26400
+ argTypes: ["hbox"],
26401
+ allowedInText: true,
26548
26402
  handler(_ref3, args) {
26549
- var {
26550
- parser: parser2
26551
- } = _ref3;
26403
+ var parser2 = _ref3.parser;
26552
26404
  return {
26553
26405
  type: "enclose",
26554
26406
  mode: parser2.mode,
@@ -26560,14 +26412,9 @@ defineFunction({
26560
26412
  defineFunction({
26561
26413
  type: "enclose",
26562
26414
  names: ["\\cancel", "\\bcancel", "\\xcancel", "\\phase"],
26563
- props: {
26564
- numArgs: 1
26565
- },
26415
+ numArgs: 1,
26566
26416
  handler(_ref4, args) {
26567
- var {
26568
- parser: parser2,
26569
- funcName
26570
- } = _ref4;
26417
+ var parser2 = _ref4.parser, funcName = _ref4.funcName;
26571
26418
  var body = args[0];
26572
26419
  return {
26573
26420
  type: "enclose",
@@ -26575,24 +26422,22 @@ defineFunction({
26575
26422
  label: funcName,
26576
26423
  body
26577
26424
  };
26578
- },
26579
- htmlBuilder: htmlBuilder$7,
26580
- mathmlBuilder: mathmlBuilder$6
26425
+ }
26581
26426
  });
26582
26427
  defineFunction({
26583
26428
  type: "enclose",
26584
26429
  names: ["\\sout"],
26585
- props: {
26586
- numArgs: 1,
26587
- allowedInText: true
26588
- },
26430
+ numArgs: 1,
26431
+ allowedInText: true,
26589
26432
  handler(_ref5, args) {
26590
- var {
26591
- parser: parser2,
26592
- funcName
26593
- } = _ref5;
26433
+ var parser2 = _ref5.parser, funcName = _ref5.funcName;
26594
26434
  if (parser2.mode === "math") {
26595
- parser2.settings.reportNonstrict("mathVsSout", "LaTeX's \\sout works only in text mode");
26435
+ handleStrict({
26436
+ strict: parser2.settings.strict,
26437
+ errorCode: "mathVsSout",
26438
+ errorMsg: "LaTeX's \\sout works only in text mode",
26439
+ report: true
26440
+ });
26596
26441
  }
26597
26442
  var body = args[0];
26598
26443
  return {
@@ -26601,22 +26446,16 @@ defineFunction({
26601
26446
  label: funcName,
26602
26447
  body
26603
26448
  };
26604
- },
26605
- htmlBuilder: htmlBuilder$7,
26606
- mathmlBuilder: mathmlBuilder$6
26449
+ }
26607
26450
  });
26608
26451
  defineFunction({
26609
26452
  type: "enclose",
26610
26453
  names: ["\\angl"],
26611
- props: {
26612
- numArgs: 1,
26613
- argTypes: ["hbox"],
26614
- allowedInText: false
26615
- },
26454
+ numArgs: 1,
26455
+ argTypes: ["hbox"],
26456
+ allowedInText: false,
26616
26457
  handler(_ref6, args) {
26617
- var {
26618
- parser: parser2
26619
- } = _ref6;
26458
+ var parser2 = _ref6.parser;
26620
26459
  return {
26621
26460
  type: "enclose",
26622
26461
  mode: parser2.mode,
@@ -26627,20 +26466,13 @@ defineFunction({
26627
26466
  });
26628
26467
  var _environments = {};
26629
26468
  function defineEnvironment(_ref) {
26630
- var {
26631
- type,
26632
- names,
26633
- props,
26634
- handler,
26635
- htmlBuilder: htmlBuilder3,
26636
- mathmlBuilder: mathmlBuilder3
26637
- } = _ref;
26469
+ var type = _ref.type, names = _ref.names, props = _ref.props, handler2 = _ref.handler, htmlBuilder3 = _ref.htmlBuilder, mathmlBuilder3 = _ref.mathmlBuilder;
26638
26470
  var data2 = {
26639
26471
  type,
26640
26472
  numArgs: props.numArgs || 0,
26641
26473
  allowedInText: false,
26642
26474
  numOptionalArgs: 0,
26643
- handler
26475
+ handler: handler2
26644
26476
  };
26645
26477
  for (var i = 0; i < names.length; ++i) {
26646
26478
  _environments[names[i]] = data2;
@@ -26732,18 +26564,7 @@ function getAutoTag(name2) {
26732
26564
  }
26733
26565
  }
26734
26566
  function parseArray(parser2, _ref, style) {
26735
- var {
26736
- hskipBeforeAndAfter,
26737
- addJot,
26738
- cols,
26739
- arraystretch,
26740
- colSeparationType,
26741
- autoTag,
26742
- singleRow,
26743
- emptySingleRow,
26744
- maxNumCols,
26745
- leqno
26746
- } = _ref;
26567
+ var hskipBeforeAndAfter = _ref.hskipBeforeAndAfter, addJot = _ref.addJot, cols = _ref.cols, arraystretch = _ref.arraystretch, colSeparationType = _ref.colSeparationType, autoTag = _ref.autoTag, singleRow = _ref.singleRow, emptySingleRow = _ref.emptySingleRow, maxNumCols = _ref.maxNumCols, leqno = _ref.leqno;
26747
26568
  parser2.gullet.beginGroup();
26748
26569
  if (!singleRow) {
26749
26570
  parser2.gullet.macros.set("\\cr", "\\\\\\relax");
@@ -26807,13 +26628,18 @@ function parseArray(parser2, _ref, style) {
26807
26628
  if (singleRow || colSeparationType) {
26808
26629
  throw new ParseError("Too many tab characters: &", parser2.nextToken);
26809
26630
  } else {
26810
- parser2.settings.reportNonstrict("textEnv", "Too few columns specified in the {array} column argument.");
26631
+ handleStrict({
26632
+ strict: parser2.settings.strict,
26633
+ errorCode: "textEnv",
26634
+ errorMsg: "Too few columns specified in the {array} column argument.",
26635
+ report: true
26636
+ });
26811
26637
  }
26812
26638
  }
26813
26639
  parser2.consume();
26814
26640
  } else if (next === "\\end") {
26815
26641
  endRow();
26816
- if (row.length === 1 && cell.type === "styling" && cell.body.length === 1 && cell.body[0].type === "ordgroup" && cell.body[0].body.length === 0 && (body.length > 1 || !emptySingleRow)) {
26642
+ if (row.length === 1 && cell.type === "styling" && cell.body.length === 1 && cell.body[0].type === "ordgroup" && cell.body[0].body.length === 0 && (body.length > 1 || !emptySingleRow) && !Array.isArray(tags2 == null ? void 0 : tags2[tags2.length - 1]) && !(autoTag && (tags2 == null ? void 0 : tags2[tags2.length - 1]) === true)) {
26817
26643
  body.pop();
26818
26644
  }
26819
26645
  if (hLinesBeforeRow.length < body.length + 1) {
@@ -27057,8 +26883,8 @@ var htmlBuilder$6 = function htmlBuilder(group, options2) {
27057
26883
  }
27058
26884
  var tableBody = makeSpan(["mtable"], cols);
27059
26885
  if (hlines.length > 0) {
27060
- var line = makeLineSpan("hline", options2, ruleThickness);
27061
- var dashes = makeLineSpan("hdashline", options2, ruleThickness);
26886
+ var line = makeLineSpan("katex-hline", options2, ruleThickness);
26887
+ var dashes = makeLineSpan("katex-hdashline", options2, ruleThickness);
27062
26888
  var vListElems = [{
27063
26889
  type: "elem",
27064
26890
  elem: tableBody,
@@ -27093,7 +26919,7 @@ var htmlBuilder$6 = function htmlBuilder(group, options2) {
27093
26919
  positionType: "individualShift",
27094
26920
  children: tagSpans
27095
26921
  });
27096
- var tagCol = makeSpan(["tag"], [eqnNumCol], options2);
26922
+ var tagCol = makeSpan(["katex-tag"], [eqnNumCol], options2);
27097
26923
  return makeFragment([tableBody, tagCol]);
27098
26924
  }
27099
26925
  };
@@ -27203,14 +27029,13 @@ var alignedHandler = function alignedHandler2(context, args) {
27203
27029
  validateAmsEnvironmentContext(context);
27204
27030
  }
27205
27031
  var cols = [];
27206
- var separationType = context.envName.includes("at") ? "alignat" : "align";
27207
27032
  var isSplit = context.envName === "split";
27208
27033
  var res = parseArray(context.parser, {
27209
27034
  cols,
27210
27035
  addJot: true,
27211
27036
  autoTag: isSplit ? void 0 : getAutoTag(context.envName),
27212
27037
  emptySingleRow: true,
27213
- colSeparationType: separationType,
27038
+ colSeparationType: context.envName.includes("at") ? "alignat" : "align",
27214
27039
  maxNumCols: isSplit ? 2 : void 0,
27215
27040
  leqno: context.parser.settings.leqno
27216
27041
  }, "display");
@@ -27222,18 +27047,18 @@ var alignedHandler = function alignedHandler2(context, args) {
27222
27047
  body: []
27223
27048
  };
27224
27049
  if (args[0] && args[0].type === "ordgroup") {
27225
- var arg0 = "";
27226
- for (var i = 0; i < args[0].body.length; i++) {
27227
- var textord2 = assertNodeType(args[0].body[i], "textord");
27228
- arg0 += textord2.text;
27050
+ var message = "Number of columns should be a positive integer";
27051
+ var numColumns = assertCharacterGroup(args[0], message);
27052
+ if (!/^[0-9]+$/.test(numColumns) || Number(numColumns) < 1) {
27053
+ throw new ParseError(message, args[0]);
27229
27054
  }
27230
- numMaths = Number(arg0);
27055
+ numMaths = Number(numColumns);
27231
27056
  numCols = numMaths * 2;
27232
27057
  }
27233
27058
  var isAligned = !numCols;
27234
27059
  res.body.forEach(function(row) {
27235
- for (var _i4 = 1; _i4 < row.length; _i4 += 2) {
27236
- var styling = assertNodeType(row[_i4], "styling");
27060
+ for (var i2 = 1; i2 < row.length; i2 += 2) {
27061
+ var styling = assertNodeType(row[i2], "styling");
27237
27062
  var ordgroup = assertNodeType(styling.body[0], "ordgroup");
27238
27063
  ordgroup.body.unshift(emptyGroup);
27239
27064
  }
@@ -27246,15 +27071,15 @@ var alignedHandler = function alignedHandler2(context, args) {
27246
27071
  numCols = row.length;
27247
27072
  }
27248
27073
  });
27249
- for (var _i5 = 0; _i5 < numCols; ++_i5) {
27074
+ for (var i = 0; i < numCols; ++i) {
27250
27075
  var align = "r";
27251
27076
  var pregap = 0;
27252
- if (_i5 % 2 === 1) {
27077
+ if (i % 2 === 1) {
27253
27078
  align = "l";
27254
- } else if (_i5 > 0 && isAligned) {
27079
+ } else if (i > 0 && isAligned) {
27255
27080
  pregap = 1;
27256
27081
  }
27257
- cols[_i5] = {
27082
+ cols[i] = {
27258
27083
  type: "align",
27259
27084
  align,
27260
27085
  pregap,
@@ -27545,11 +27370,9 @@ defineFunction({
27545
27370
  type: "text",
27546
27371
  // Doesn't matter what this is.
27547
27372
  names: ["\\hline", "\\hdashline"],
27548
- props: {
27549
- numArgs: 0,
27550
- allowedInText: true,
27551
- allowedInMath: true
27552
- },
27373
+ numArgs: 0,
27374
+ allowedInText: true,
27375
+ allowedInMath: true,
27553
27376
  handler(context, args) {
27554
27377
  throw new ParseError(context.funcName + " valid only within array environment");
27555
27378
  }
@@ -27558,32 +27381,21 @@ var environments = _environments;
27558
27381
  defineFunction({
27559
27382
  type: "environment",
27560
27383
  names: ["\\begin", "\\end"],
27561
- props: {
27562
- numArgs: 1,
27563
- argTypes: ["text"]
27564
- },
27384
+ numArgs: 1,
27385
+ argTypes: ["text"],
27565
27386
  handler(_ref, args) {
27566
- var {
27567
- parser: parser2,
27568
- funcName
27569
- } = _ref;
27387
+ var parser2 = _ref.parser, funcName = _ref.funcName;
27570
27388
  var nameGroup = args[0];
27571
27389
  if (nameGroup.type !== "ordgroup") {
27572
27390
  throw new ParseError("Invalid environment name", nameGroup);
27573
27391
  }
27574
- var envName = "";
27575
- for (var i = 0; i < nameGroup.body.length; ++i) {
27576
- envName += assertNodeType(nameGroup.body[i], "textord").text;
27577
- }
27392
+ var envName = assertCharacterGroup(nameGroup, "Environment name should contain only text characters and spaces", true);
27578
27393
  if (funcName === "\\begin") {
27579
- if (!environments.hasOwnProperty(envName)) {
27394
+ if (!Object.prototype.hasOwnProperty.call(environments, envName)) {
27580
27395
  throw new ParseError("No such environment: " + envName, nameGroup);
27581
27396
  }
27582
27397
  var env = environments[envName];
27583
- var {
27584
- args: _args,
27585
- optArgs
27586
- } = parser2.parseArguments("\\begin{" + envName + "}", env);
27398
+ var _parser$parseArgument = parser2.parseArguments("\\begin{" + envName + "}", env), _args = _parser$parseArgument.args, optArgs = _parser$parseArgument.optArgs;
27587
27399
  var context = {
27588
27400
  mode: parser2.mode,
27589
27401
  envName,
@@ -27642,20 +27454,12 @@ defineFunction({
27642
27454
  "\\bold",
27643
27455
  "\\frak"
27644
27456
  ],
27645
- props: {
27646
- numArgs: 1,
27647
- allowedInArgument: true
27648
- },
27457
+ numArgs: 1,
27458
+ allowedInArgument: true,
27649
27459
  handler: (_ref, args) => {
27650
- var {
27651
- parser: parser2,
27652
- funcName
27653
- } = _ref;
27460
+ var parser2 = _ref.parser, funcName = _ref.funcName;
27654
27461
  var body = normalizeArgument(args[0]);
27655
- var func = funcName;
27656
- if (func in fontAliases) {
27657
- func = fontAliases[func];
27658
- }
27462
+ var func = funcName in fontAliases ? fontAliases[funcName] : funcName;
27659
27463
  return {
27660
27464
  type: "font",
27661
27465
  mode: parser2.mode,
@@ -27669,13 +27473,9 @@ defineFunction({
27669
27473
  defineFunction({
27670
27474
  type: "mclass",
27671
27475
  names: ["\\boldsymbol", "\\bm"],
27672
- props: {
27673
- numArgs: 1
27674
- },
27476
+ numArgs: 1,
27675
27477
  handler: (_ref2, args) => {
27676
- var {
27677
- parser: parser2
27678
- } = _ref2;
27478
+ var parser2 = _ref2.parser;
27679
27479
  var body = args[0];
27680
27480
  return {
27681
27481
  type: "mclass",
@@ -27694,19 +27494,11 @@ defineFunction({
27694
27494
  defineFunction({
27695
27495
  type: "font",
27696
27496
  names: ["\\rm", "\\sf", "\\tt", "\\bf", "\\it", "\\cal"],
27697
- props: {
27698
- numArgs: 0,
27699
- allowedInText: true
27700
- },
27497
+ numArgs: 0,
27498
+ allowedInText: true,
27701
27499
  handler: (_ref3, args) => {
27702
- var {
27703
- parser: parser2,
27704
- funcName,
27705
- breakOnTokenText
27706
- } = _ref3;
27707
- var {
27708
- mode
27709
- } = parser2;
27500
+ var parser2 = _ref3.parser, funcName = _ref3.funcName, breakOnTokenText = _ref3.breakOnTokenText;
27501
+ var mode = parser2.mode;
27710
27502
  var body = parser2.parseExpression(true, breakOnTokenText);
27711
27503
  return {
27712
27504
  type: "font",
@@ -27718,9 +27510,7 @@ defineFunction({
27718
27510
  body
27719
27511
  }
27720
27512
  };
27721
- },
27722
- htmlBuilder: htmlBuilder$5,
27723
- mathmlBuilder: mathmlBuilder$4
27513
+ }
27724
27514
  });
27725
27515
  var htmlBuilder$4 = (group, options2) => {
27726
27516
  var style = options2.style;
@@ -27900,15 +27690,10 @@ defineFunction({
27900
27690
  "\\\\brackfrac"
27901
27691
  // ditto
27902
27692
  ],
27903
- props: {
27904
- numArgs: 2,
27905
- allowedInArgument: true
27906
- },
27693
+ numArgs: 2,
27694
+ allowedInArgument: true,
27907
27695
  handler: (_ref, args) => {
27908
- var {
27909
- parser: parser2,
27910
- funcName
27911
- } = _ref;
27696
+ var parser2 = _ref.parser, funcName = _ref.funcName;
27912
27697
  var numer = args[0];
27913
27698
  var denom = args[1];
27914
27699
  var hasBarLine;
@@ -27969,16 +27754,10 @@ defineFunction({
27969
27754
  defineFunction({
27970
27755
  type: "infix",
27971
27756
  names: ["\\over", "\\choose", "\\atop", "\\brace", "\\brack"],
27972
- props: {
27973
- numArgs: 0,
27974
- infix: true
27975
- },
27757
+ numArgs: 0,
27758
+ infix: true,
27976
27759
  handler(_ref2) {
27977
- var {
27978
- parser: parser2,
27979
- funcName,
27980
- token
27981
- } = _ref2;
27760
+ var parser2 = _ref2.parser, funcName = _ref2.funcName, token = _ref2.token;
27982
27761
  var replaceWith;
27983
27762
  switch (funcName) {
27984
27763
  case "\\over":
@@ -28019,15 +27798,11 @@ var delimFromValue = function delimFromValue2(delimString) {
28019
27798
  defineFunction({
28020
27799
  type: "genfrac",
28021
27800
  names: ["\\genfrac"],
28022
- props: {
28023
- numArgs: 6,
28024
- allowedInArgument: true,
28025
- argTypes: ["math", "math", "size", "text", "math", "math"]
28026
- },
27801
+ numArgs: 6,
27802
+ allowedInArgument: true,
27803
+ argTypes: ["math", "math", "size", "text", "math", "math"],
28027
27804
  handler(_ref3, args) {
28028
- var {
28029
- parser: parser2
28030
- } = _ref3;
27805
+ var parser2 = _ref3.parser;
28031
27806
  var numer = args[4];
28032
27807
  var denom = args[5];
28033
27808
  var leftNode = normalizeArgument(args[0]);
@@ -28070,17 +27845,13 @@ defineFunction({
28070
27845
  defineFunction({
28071
27846
  type: "infix",
28072
27847
  names: ["\\above"],
28073
- props: {
28074
- numArgs: 1,
28075
- argTypes: ["size"],
28076
- infix: true
28077
- },
27848
+ numArgs: 1,
27849
+ argTypes: ["size"],
27850
+ infix: true,
28078
27851
  handler(_ref4, args) {
28079
- var {
28080
- parser: parser2,
28081
- funcName,
28082
- token
28083
- } = _ref4;
27852
+ var parser2 = _ref4.parser;
27853
+ _ref4.funcName;
27854
+ var token = _ref4.token;
28084
27855
  return {
28085
27856
  type: "infix",
28086
27857
  mode: parser2.mode,
@@ -28093,15 +27864,11 @@ defineFunction({
28093
27864
  defineFunction({
28094
27865
  type: "genfrac",
28095
27866
  names: ["\\\\abovefrac"],
28096
- props: {
28097
- numArgs: 3,
28098
- argTypes: ["math", "size", "math"]
28099
- },
27867
+ numArgs: 3,
27868
+ argTypes: ["math", "size", "math"],
28100
27869
  handler: (_ref5, args) => {
28101
- var {
28102
- parser: parser2,
28103
- funcName
28104
- } = _ref5;
27870
+ var parser2 = _ref5.parser;
27871
+ _ref5.funcName;
28105
27872
  var numer = args[0];
28106
27873
  var barSize = assertNodeType(args[1], "infix").size;
28107
27874
  if (!barSize) {
@@ -28209,14 +27976,9 @@ var mathmlBuilder$2 = (group, options2) => {
28209
27976
  defineFunction({
28210
27977
  type: "horizBrace",
28211
27978
  names: ["\\overbrace", "\\underbrace", "\\overbracket", "\\underbracket"],
28212
- props: {
28213
- numArgs: 1
28214
- },
27979
+ numArgs: 1,
28215
27980
  handler(_ref, args) {
28216
- var {
28217
- parser: parser2,
28218
- funcName
28219
- } = _ref;
27981
+ var parser2 = _ref.parser, funcName = _ref.funcName;
28220
27982
  return {
28221
27983
  type: "horizBrace",
28222
27984
  mode: parser2.mode,
@@ -28231,15 +27993,11 @@ defineFunction({
28231
27993
  defineFunction({
28232
27994
  type: "href",
28233
27995
  names: ["\\href"],
28234
- props: {
28235
- numArgs: 2,
28236
- argTypes: ["url", "original"],
28237
- allowedInText: true
28238
- },
27996
+ numArgs: 2,
27997
+ argTypes: ["url", "original"],
27998
+ allowedInText: true,
28239
27999
  handler: (_ref, args) => {
28240
- var {
28241
- parser: parser2
28242
- } = _ref;
28000
+ var parser2 = _ref.parser;
28243
28001
  var body = args[1];
28244
28002
  var href = assertNodeType(args[0], "url").url;
28245
28003
  if (!parser2.settings.isTrusted({
@@ -28271,15 +28029,11 @@ defineFunction({
28271
28029
  defineFunction({
28272
28030
  type: "href",
28273
28031
  names: ["\\url"],
28274
- props: {
28275
- numArgs: 1,
28276
- argTypes: ["url"],
28277
- allowedInText: true
28278
- },
28032
+ numArgs: 1,
28033
+ argTypes: ["url"],
28034
+ allowedInText: true,
28279
28035
  handler: (_ref2, args) => {
28280
- var {
28281
- parser: parser2
28282
- } = _ref2;
28036
+ var parser2 = _ref2.parser;
28283
28037
  var href = assertNodeType(args[0], "url").url;
28284
28038
  if (!parser2.settings.isTrusted({
28285
28039
  command: "\\url",
@@ -28316,16 +28070,12 @@ defineFunction({
28316
28070
  defineFunction({
28317
28071
  type: "hbox",
28318
28072
  names: ["\\hbox"],
28319
- props: {
28320
- numArgs: 1,
28321
- argTypes: ["text"],
28322
- allowedInText: true,
28323
- primitive: true
28324
- },
28073
+ numArgs: 1,
28074
+ argTypes: ["text"],
28075
+ allowedInText: true,
28076
+ primitive: true,
28325
28077
  handler(_ref, args) {
28326
- var {
28327
- parser: parser2
28328
- } = _ref;
28078
+ var parser2 = _ref.parser;
28329
28079
  return {
28330
28080
  type: "hbox",
28331
28081
  mode: parser2.mode,
@@ -28343,21 +28093,21 @@ defineFunction({
28343
28093
  defineFunction({
28344
28094
  type: "html",
28345
28095
  names: ["\\htmlClass", "\\htmlId", "\\htmlStyle", "\\htmlData"],
28346
- props: {
28347
- numArgs: 2,
28348
- argTypes: ["raw", "original"],
28349
- allowedInText: true
28350
- },
28096
+ numArgs: 2,
28097
+ argTypes: ["raw", "original"],
28098
+ allowedInText: true,
28351
28099
  handler: (_ref, args) => {
28352
- var {
28353
- parser: parser2,
28354
- funcName,
28355
- token
28356
- } = _ref;
28100
+ var parser2 = _ref.parser, funcName = _ref.funcName;
28101
+ _ref.token;
28357
28102
  var value = assertNodeType(args[0], "raw").string;
28358
28103
  var body = args[1];
28359
28104
  if (parser2.settings.strict) {
28360
- parser2.settings.reportNonstrict("htmlExtension", "HTML extension is disabled on strict mode");
28105
+ handleStrict({
28106
+ strict: parser2.settings.strict,
28107
+ errorCode: "htmlExtension",
28108
+ errorMsg: "HTML extension is disabled on strict mode",
28109
+ report: true
28110
+ });
28361
28111
  }
28362
28112
  var trustContext;
28363
28113
  var attributes = {};
@@ -28384,9 +28134,23 @@ defineFunction({
28384
28134
  };
28385
28135
  break;
28386
28136
  case "\\htmlData": {
28387
- var data2 = value.split(",");
28388
- for (var i = 0; i < data2.length; i++) {
28389
- var item = data2[i];
28137
+ var ESCAPED_COMMA = "{,}";
28138
+ var data2 = [];
28139
+ var current = "";
28140
+ for (var i = 0; i < value.length; i++) {
28141
+ if (value.startsWith(ESCAPED_COMMA, i)) {
28142
+ current += ",";
28143
+ i += ESCAPED_COMMA.length - 1;
28144
+ } else if (value[i] === ",") {
28145
+ data2.push(current);
28146
+ current = "";
28147
+ } else {
28148
+ current += value[i];
28149
+ }
28150
+ }
28151
+ data2.push(current);
28152
+ for (var _i = 0; _i < data2.length; _i++) {
28153
+ var item = data2[_i];
28390
28154
  var firstEquals = item.indexOf("=");
28391
28155
  if (firstEquals < 0) {
28392
28156
  throw new ParseError("\\htmlData key/value '" + item + "' missing equals sign");
@@ -28421,9 +28185,11 @@ defineFunction({
28421
28185
  classes.push(...group.attributes.class.trim().split(/\s+/));
28422
28186
  }
28423
28187
  var span = makeSpan(classes, elements, options2);
28424
- for (var attr in group.attributes) {
28425
- if (attr !== "class" && group.attributes.hasOwnProperty(attr)) {
28426
- span.setAttribute(attr, group.attributes[attr]);
28188
+ for (var _ref3 of Object.entries(group.attributes)) {
28189
+ var attr = _ref3[0];
28190
+ var value = _ref3[1];
28191
+ if (attr !== "class") {
28192
+ span.setAttribute(attr, value);
28427
28193
  }
28428
28194
  }
28429
28195
  return span;
@@ -28435,15 +28201,11 @@ defineFunction({
28435
28201
  defineFunction({
28436
28202
  type: "htmlmathml",
28437
28203
  names: ["\\html@mathml"],
28438
- props: {
28439
- numArgs: 2,
28440
- allowedInArgument: true,
28441
- allowedInText: true
28442
- },
28204
+ numArgs: 2,
28205
+ allowedInArgument: true,
28206
+ allowedInText: true,
28443
28207
  handler: (_ref, args) => {
28444
- var {
28445
- parser: parser2
28446
- } = _ref;
28208
+ var parser2 = _ref.parser;
28447
28209
  return {
28448
28210
  type: "htmlmathml",
28449
28211
  mode: parser2.mode,
@@ -28484,16 +28246,12 @@ var sizeData = function sizeData2(str) {
28484
28246
  defineFunction({
28485
28247
  type: "includegraphics",
28486
28248
  names: ["\\includegraphics"],
28487
- props: {
28488
- numArgs: 1,
28489
- numOptionalArgs: 1,
28490
- argTypes: ["raw", "url"],
28491
- allowedInText: false
28492
- },
28249
+ numArgs: 1,
28250
+ numOptionalArgs: 1,
28251
+ argTypes: ["raw", "url"],
28252
+ allowedInText: false,
28493
28253
  handler: (_ref, args, optArgs) => {
28494
- var {
28495
- parser: parser2
28496
- } = _ref;
28254
+ var parser2 = _ref.parser;
28497
28255
  var width = {
28498
28256
  number: 0,
28499
28257
  unit: "em"
@@ -28600,31 +28358,41 @@ defineFunction({
28600
28358
  defineFunction({
28601
28359
  type: "kern",
28602
28360
  names: ["\\kern", "\\mkern", "\\hskip", "\\mskip"],
28603
- props: {
28604
- numArgs: 1,
28605
- argTypes: ["size"],
28606
- primitive: true,
28607
- allowedInText: true
28608
- },
28361
+ numArgs: 1,
28362
+ argTypes: ["size"],
28363
+ primitive: true,
28364
+ allowedInText: true,
28609
28365
  handler(_ref, args) {
28610
- var {
28611
- parser: parser2,
28612
- funcName
28613
- } = _ref;
28366
+ var parser2 = _ref.parser, funcName = _ref.funcName;
28614
28367
  var size = assertNodeType(args[0], "size");
28615
28368
  if (parser2.settings.strict) {
28616
28369
  var mathFunction = funcName[1] === "m";
28617
28370
  var muUnit = size.value.unit === "mu";
28618
28371
  if (mathFunction) {
28619
28372
  if (!muUnit) {
28620
- parser2.settings.reportNonstrict("mathVsTextUnits", "LaTeX's " + funcName + " supports only mu units, " + ("not " + size.value.unit + " units"));
28373
+ handleStrict({
28374
+ strict: parser2.settings.strict,
28375
+ errorCode: "mathVsTextUnits",
28376
+ errorMsg: "LaTeX's " + funcName + " supports only mu units, " + ("not " + size.value.unit + " units"),
28377
+ report: true
28378
+ });
28621
28379
  }
28622
28380
  if (parser2.mode !== "math") {
28623
- parser2.settings.reportNonstrict("mathVsTextUnits", "LaTeX's " + funcName + " works only in math mode");
28381
+ handleStrict({
28382
+ strict: parser2.settings.strict,
28383
+ errorCode: "mathVsTextUnits",
28384
+ errorMsg: "LaTeX's " + funcName + " works only in math mode",
28385
+ report: true
28386
+ });
28624
28387
  }
28625
28388
  } else {
28626
28389
  if (muUnit) {
28627
- parser2.settings.reportNonstrict("mathVsTextUnits", "LaTeX's " + funcName + " doesn't support mu units");
28390
+ handleStrict({
28391
+ strict: parser2.settings.strict,
28392
+ errorCode: "mathVsTextUnits",
28393
+ errorMsg: "LaTeX's " + funcName + " doesn't support mu units",
28394
+ report: true
28395
+ });
28628
28396
  }
28629
28397
  }
28630
28398
  }
@@ -28645,15 +28413,10 @@ defineFunction({
28645
28413
  defineFunction({
28646
28414
  type: "lap",
28647
28415
  names: ["\\mathllap", "\\mathrlap", "\\mathclap"],
28648
- props: {
28649
- numArgs: 1,
28650
- allowedInText: true
28651
- },
28416
+ numArgs: 1,
28417
+ allowedInText: true,
28652
28418
  handler: (_ref, args) => {
28653
- var {
28654
- parser: parser2,
28655
- funcName
28656
- } = _ref;
28419
+ var parser2 = _ref.parser, funcName = _ref.funcName;
28657
28420
  var body = args[0];
28658
28421
  return {
28659
28422
  type: "lap",
@@ -28666,20 +28429,20 @@ defineFunction({
28666
28429
  var inner2;
28667
28430
  if (group.alignment === "clap") {
28668
28431
  inner2 = makeSpan([], [buildGroup$1(group.body, options2)]);
28669
- inner2 = makeSpan(["inner"], [inner2], options2);
28432
+ inner2 = makeSpan(["katex-inner"], [inner2], options2);
28670
28433
  } else {
28671
- inner2 = makeSpan(["inner"], [buildGroup$1(group.body, options2)]);
28434
+ inner2 = makeSpan(["katex-inner"], [buildGroup$1(group.body, options2)]);
28672
28435
  }
28673
- var fix = makeSpan(["fix"], []);
28436
+ var fix = makeSpan(["katex-fix"], []);
28674
28437
  var node = makeSpan([group.alignment], [inner2, fix], options2);
28675
- var strut = makeSpan(["strut"]);
28438
+ var strut = makeSpan(["katex-strut"]);
28676
28439
  strut.style.height = makeEm(node.height + node.depth);
28677
28440
  if (node.depth) {
28678
28441
  strut.style.verticalAlign = makeEm(-node.depth);
28679
28442
  }
28680
28443
  node.children.unshift(strut);
28681
- node = makeSpan(["thinbox"], [node], options2);
28682
- return makeSpan(["mord", "vbox"], [node], options2);
28444
+ node = makeSpan(["katex-thinbox"], [node], options2);
28445
+ return makeSpan(["mord", "katex-vbox"], [node], options2);
28683
28446
  },
28684
28447
  mathmlBuilder: (group, options2) => {
28685
28448
  var node = new MathNode("mpadded", [buildGroup2(group.body, options2)]);
@@ -28694,16 +28457,11 @@ defineFunction({
28694
28457
  defineFunction({
28695
28458
  type: "styling",
28696
28459
  names: ["\\(", "$"],
28697
- props: {
28698
- numArgs: 0,
28699
- allowedInText: true,
28700
- allowedInMath: false
28701
- },
28460
+ numArgs: 0,
28461
+ allowedInText: true,
28462
+ allowedInMath: false,
28702
28463
  handler(_ref, args) {
28703
- var {
28704
- funcName,
28705
- parser: parser2
28706
- } = _ref;
28464
+ var funcName = _ref.funcName, parser2 = _ref.parser;
28707
28465
  var outerMode = parser2.mode;
28708
28466
  parser2.switchMode("math");
28709
28467
  var close2 = funcName === "\\(" ? "\\)" : "$";
@@ -28723,11 +28481,9 @@ defineFunction({
28723
28481
  type: "text",
28724
28482
  // Doesn't matter what this is.
28725
28483
  names: ["\\)", "\\]"],
28726
- props: {
28727
- numArgs: 0,
28728
- allowedInText: true,
28729
- allowedInMath: false
28730
- },
28484
+ numArgs: 0,
28485
+ allowedInText: true,
28486
+ allowedInMath: false,
28731
28487
  handler(context, args) {
28732
28488
  throw new ParseError("Mismatched " + context.funcName);
28733
28489
  }
@@ -28749,14 +28505,10 @@ var chooseMathStyle = (group, options2) => {
28749
28505
  defineFunction({
28750
28506
  type: "mathchoice",
28751
28507
  names: ["\\mathchoice"],
28752
- props: {
28753
- numArgs: 4,
28754
- primitive: true
28755
- },
28508
+ numArgs: 4,
28509
+ primitive: true,
28756
28510
  handler: (_ref, args) => {
28757
- var {
28758
- parser: parser2
28759
- } = _ref;
28511
+ var parser2 = _ref.parser;
28760
28512
  return {
28761
28513
  type: "mathchoice",
28762
28514
  mode: parser2.mode,
@@ -28994,14 +28746,9 @@ var singleCharBigOps = {
28994
28746
  defineFunction({
28995
28747
  type: "op",
28996
28748
  names: ["\\coprod", "\\bigvee", "\\bigwedge", "\\biguplus", "\\bigcap", "\\bigcup", "\\intop", "\\prod", "\\sum", "\\bigotimes", "\\bigoplus", "\\bigodot", "\\bigsqcup", "\\smallint", "∏", "∐", "∑", "⋀", "⋁", "⋂", "⋃", "⨀", "⨁", "⨂", "⨄", "⨆"],
28997
- props: {
28998
- numArgs: 0
28999
- },
28749
+ numArgs: 0,
29000
28750
  handler: (_ref, args) => {
29001
- var {
29002
- parser: parser2,
29003
- funcName
29004
- } = _ref;
28751
+ var parser2 = _ref.parser, funcName = _ref.funcName;
29005
28752
  var fName = funcName;
29006
28753
  if (fName.length === 1) {
29007
28754
  fName = singleCharBigOps[fName];
@@ -29021,14 +28768,10 @@ defineFunction({
29021
28768
  defineFunction({
29022
28769
  type: "op",
29023
28770
  names: ["\\mathop"],
29024
- props: {
29025
- numArgs: 1,
29026
- primitive: true
29027
- },
28771
+ numArgs: 1,
28772
+ primitive: true,
29028
28773
  handler: (_ref2, args) => {
29029
- var {
29030
- parser: parser2
29031
- } = _ref2;
28774
+ var parser2 = _ref2.parser;
29032
28775
  var body = args[0];
29033
28776
  return {
29034
28777
  type: "op",
@@ -29038,9 +28781,7 @@ defineFunction({
29038
28781
  symbol: false,
29039
28782
  body: ordargument(body)
29040
28783
  };
29041
- },
29042
- htmlBuilder: htmlBuilder$2,
29043
- mathmlBuilder: mathmlBuilder$1
28784
+ }
29044
28785
  });
29045
28786
  var singleCharIntegrals = {
29046
28787
  "∫": "\\int",
@@ -29053,14 +28794,9 @@ var singleCharIntegrals = {
29053
28794
  defineFunction({
29054
28795
  type: "op",
29055
28796
  names: ["\\arcsin", "\\arccos", "\\arctan", "\\arctg", "\\arcctg", "\\arg", "\\ch", "\\cos", "\\cosec", "\\cosh", "\\cot", "\\cotg", "\\coth", "\\csc", "\\ctg", "\\cth", "\\deg", "\\dim", "\\exp", "\\hom", "\\ker", "\\lg", "\\ln", "\\log", "\\sec", "\\sin", "\\sinh", "\\sh", "\\tan", "\\tanh", "\\tg", "\\th"],
29056
- props: {
29057
- numArgs: 0
29058
- },
28797
+ numArgs: 0,
29059
28798
  handler(_ref3) {
29060
- var {
29061
- parser: parser2,
29062
- funcName
29063
- } = _ref3;
28799
+ var parser2 = _ref3.parser, funcName = _ref3.funcName;
29064
28800
  return {
29065
28801
  type: "op",
29066
28802
  mode: parser2.mode,
@@ -29069,21 +28805,14 @@ defineFunction({
29069
28805
  symbol: false,
29070
28806
  name: funcName
29071
28807
  };
29072
- },
29073
- htmlBuilder: htmlBuilder$2,
29074
- mathmlBuilder: mathmlBuilder$1
28808
+ }
29075
28809
  });
29076
28810
  defineFunction({
29077
28811
  type: "op",
29078
28812
  names: ["\\det", "\\gcd", "\\inf", "\\lim", "\\max", "\\min", "\\Pr", "\\sup"],
29079
- props: {
29080
- numArgs: 0
29081
- },
28813
+ numArgs: 0,
29082
28814
  handler(_ref4) {
29083
- var {
29084
- parser: parser2,
29085
- funcName
29086
- } = _ref4;
28815
+ var parser2 = _ref4.parser, funcName = _ref4.funcName;
29087
28816
  return {
29088
28817
  type: "op",
29089
28818
  mode: parser2.mode,
@@ -29092,22 +28821,15 @@ defineFunction({
29092
28821
  symbol: false,
29093
28822
  name: funcName
29094
28823
  };
29095
- },
29096
- htmlBuilder: htmlBuilder$2,
29097
- mathmlBuilder: mathmlBuilder$1
28824
+ }
29098
28825
  });
29099
28826
  defineFunction({
29100
28827
  type: "op",
29101
28828
  names: ["\\int", "\\iint", "\\iiint", "\\oint", "\\oiint", "\\oiiint", "∫", "∬", "∭", "∮", "∯", "∰"],
29102
- props: {
29103
- numArgs: 0,
29104
- allowedInArgument: true
29105
- },
28829
+ numArgs: 0,
28830
+ allowedInArgument: true,
29106
28831
  handler(_ref5) {
29107
- var {
29108
- parser: parser2,
29109
- funcName
29110
- } = _ref5;
28832
+ var parser2 = _ref5.parser, funcName = _ref5.funcName;
29111
28833
  var fName = funcName;
29112
28834
  if (fName.length === 1) {
29113
28835
  fName = singleCharIntegrals[fName];
@@ -29120,9 +28842,7 @@ defineFunction({
29120
28842
  symbol: true,
29121
28843
  name: fName
29122
28844
  };
29123
- },
29124
- htmlBuilder: htmlBuilder$2,
29125
- mathmlBuilder: mathmlBuilder$1
28845
+ }
29126
28846
  });
29127
28847
  var htmlBuilder$1 = (grp, options2) => {
29128
28848
  var supGroup;
@@ -29214,14 +28934,9 @@ var mathmlBuilder2 = (group, options2) => {
29214
28934
  defineFunction({
29215
28935
  type: "operatorname",
29216
28936
  names: ["\\operatorname@", "\\operatornamewithlimits"],
29217
- props: {
29218
- numArgs: 1
29219
- },
28937
+ numArgs: 1,
29220
28938
  handler: (_ref, args) => {
29221
- var {
29222
- parser: parser2,
29223
- funcName
29224
- } = _ref;
28939
+ var parser2 = _ref.parser, funcName = _ref.funcName;
29225
28940
  var body = args[0];
29226
28941
  return {
29227
28942
  type: "operatorname",
@@ -29251,13 +28966,9 @@ defineFunctionBuilders({
29251
28966
  defineFunction({
29252
28967
  type: "overline",
29253
28968
  names: ["\\overline"],
29254
- props: {
29255
- numArgs: 1
29256
- },
28969
+ numArgs: 1,
29257
28970
  handler(_ref, args) {
29258
- var {
29259
- parser: parser2
29260
- } = _ref;
28971
+ var parser2 = _ref.parser;
29261
28972
  var body = args[0];
29262
28973
  return {
29263
28974
  type: "overline",
@@ -29285,7 +28996,7 @@ defineFunction({
29285
28996
  size: defaultRuleThickness
29286
28997
  }]
29287
28998
  });
29288
- return makeSpan(["mord", "overline"], [vlist], options2);
28999
+ return makeSpan(["mord", "katex-overline"], [vlist], options2);
29289
29000
  },
29290
29001
  mathmlBuilder(group, options2) {
29291
29002
  var operator2 = new MathNode("mo", [new TextNode2("‾")]);
@@ -29298,14 +29009,10 @@ defineFunction({
29298
29009
  defineFunction({
29299
29010
  type: "phantom",
29300
29011
  names: ["\\phantom"],
29301
- props: {
29302
- numArgs: 1,
29303
- allowedInText: true
29304
- },
29012
+ numArgs: 1,
29013
+ allowedInText: true,
29305
29014
  handler: (_ref, args) => {
29306
- var {
29307
- parser: parser2
29308
- } = _ref;
29015
+ var parser2 = _ref.parser;
29309
29016
  var body = args[0];
29310
29017
  return {
29311
29018
  type: "phantom",
@@ -29326,14 +29033,10 @@ defineMacro("\\hphantom", "\\smash{\\phantom{#1}}");
29326
29033
  defineFunction({
29327
29034
  type: "vphantom",
29328
29035
  names: ["\\vphantom"],
29329
- props: {
29330
- numArgs: 1,
29331
- allowedInText: true
29332
- },
29036
+ numArgs: 1,
29037
+ allowedInText: true,
29333
29038
  handler: (_ref2, args) => {
29334
- var {
29335
- parser: parser2
29336
- } = _ref2;
29039
+ var parser2 = _ref2.parser;
29337
29040
  var body = args[0];
29338
29041
  return {
29339
29042
  type: "vphantom",
@@ -29342,8 +29045,8 @@ defineFunction({
29342
29045
  };
29343
29046
  },
29344
29047
  htmlBuilder: (group, options2) => {
29345
- var inner2 = makeSpan(["inner"], [buildGroup$1(group.body, options2.withPhantom())]);
29346
- var fix = makeSpan(["fix"], []);
29048
+ var inner2 = makeSpan(["katex-inner"], [buildGroup$1(group.body, options2.withPhantom())]);
29049
+ var fix = makeSpan(["katex-fix"], []);
29347
29050
  return makeSpan(["mord", "rlap"], [inner2, fix], options2);
29348
29051
  },
29349
29052
  mathmlBuilder: (group, options2) => {
@@ -29357,15 +29060,11 @@ defineFunction({
29357
29060
  defineFunction({
29358
29061
  type: "raisebox",
29359
29062
  names: ["\\raisebox"],
29360
- props: {
29361
- numArgs: 2,
29362
- argTypes: ["size", "hbox"],
29363
- allowedInText: true
29364
- },
29063
+ numArgs: 2,
29064
+ argTypes: ["size", "hbox"],
29065
+ allowedInText: true,
29365
29066
  handler(_ref, args) {
29366
- var {
29367
- parser: parser2
29368
- } = _ref;
29067
+ var parser2 = _ref.parser;
29369
29068
  var amount = assertNodeType(args[0], "size").value;
29370
29069
  var body = args[1];
29371
29070
  return {
@@ -29394,18 +29093,43 @@ defineFunction({
29394
29093
  return node;
29395
29094
  }
29396
29095
  });
29096
+ var handler = (_ref, args) => {
29097
+ var parser2 = _ref.parser;
29098
+ return {
29099
+ type: "reflectbox",
29100
+ mode: parser2.mode,
29101
+ body: args[0]
29102
+ };
29103
+ };
29104
+ defineFunction({
29105
+ type: "reflectbox",
29106
+ names: ["\\reflectbox"],
29107
+ numArgs: 1,
29108
+ argTypes: ["hbox"],
29109
+ allowedInText: true,
29110
+ handler,
29111
+ htmlBuilder(group, options2) {
29112
+ return makeSpan(["mord", "reflectbox"], [buildGroup$1(group.body, options2)], options2);
29113
+ },
29114
+ mathmlBuilder(group, options2) {
29115
+ return buildGroup2(group.body, options2);
29116
+ }
29117
+ });
29118
+ defineFunction({
29119
+ type: "reflectbox",
29120
+ names: ["\\mathreflectbox"],
29121
+ numArgs: 1,
29122
+ argTypes: ["math"],
29123
+ handler
29124
+ });
29397
29125
  defineFunction({
29398
29126
  type: "internal",
29399
29127
  names: ["\\relax"],
29400
- props: {
29401
- numArgs: 0,
29402
- allowedInText: true,
29403
- allowedInArgument: true
29404
- },
29128
+ numArgs: 0,
29129
+ allowedInText: true,
29130
+ allowedInArgument: true,
29405
29131
  handler(_ref) {
29406
- var {
29407
- parser: parser2
29408
- } = _ref;
29132
+ var parser2 = _ref.parser;
29409
29133
  return {
29410
29134
  type: "internal",
29411
29135
  mode: parser2.mode
@@ -29415,17 +29139,13 @@ defineFunction({
29415
29139
  defineFunction({
29416
29140
  type: "rule",
29417
29141
  names: ["\\rule"],
29418
- props: {
29419
- numArgs: 2,
29420
- numOptionalArgs: 1,
29421
- allowedInText: true,
29422
- allowedInMath: true,
29423
- argTypes: ["size", "size", "size"]
29424
- },
29142
+ numArgs: 2,
29143
+ numOptionalArgs: 1,
29144
+ allowedInText: true,
29145
+ allowedInMath: true,
29146
+ argTypes: ["size", "size", "size"],
29425
29147
  handler(_ref, args, optArgs) {
29426
- var {
29427
- parser: parser2
29428
- } = _ref;
29148
+ var parser2 = _ref.parser;
29429
29149
  var shift2 = optArgs[0];
29430
29150
  var width = assertNodeType(args[0], "size");
29431
29151
  var height = assertNodeType(args[1], "size");
@@ -29438,7 +29158,7 @@ defineFunction({
29438
29158
  };
29439
29159
  },
29440
29160
  htmlBuilder(group, options2) {
29441
- var rule = makeSpan(["mord", "rule"], [], options2);
29161
+ var rule = makeSpan(["mord", "katex-rule"], [], options2);
29442
29162
  var width = calculateSize(group.width, options2);
29443
29163
  var height = calculateSize(group.height, options2);
29444
29164
  var shift2 = group.shift ? calculateSize(group.shift, options2) : 0;
@@ -29475,7 +29195,7 @@ function sizingGroup(value, options2, baseOptions) {
29475
29195
  var inner2 = buildExpression$1(value, options2, false);
29476
29196
  var multiplier = options2.sizeMultiplier / baseOptions.sizeMultiplier;
29477
29197
  for (var i = 0; i < inner2.length; i++) {
29478
- var pos = inner2[i].classes.indexOf("sizing");
29198
+ var pos = inner2[i].classes.indexOf("katex-sizing");
29479
29199
  if (pos < 0) {
29480
29200
  Array.prototype.push.apply(inner2[i].classes, options2.sizingClasses(baseOptions));
29481
29201
  } else if (inner2[i].classes[pos + 1] === "reset-size" + options2.size) {
@@ -29494,16 +29214,10 @@ var htmlBuilder2 = (group, options2) => {
29494
29214
  defineFunction({
29495
29215
  type: "sizing",
29496
29216
  names: sizeFuncs,
29497
- props: {
29498
- numArgs: 0,
29499
- allowedInText: true
29500
- },
29217
+ numArgs: 0,
29218
+ allowedInText: true,
29501
29219
  handler: (_ref, args) => {
29502
- var {
29503
- breakOnTokenText,
29504
- funcName,
29505
- parser: parser2
29506
- } = _ref;
29220
+ var breakOnTokenText = _ref.breakOnTokenText, funcName = _ref.funcName, parser2 = _ref.parser;
29507
29221
  var body = parser2.parseExpression(false, breakOnTokenText);
29508
29222
  return {
29509
29223
  type: "sizing",
@@ -29525,15 +29239,11 @@ defineFunction({
29525
29239
  defineFunction({
29526
29240
  type: "smash",
29527
29241
  names: ["\\smash"],
29528
- props: {
29529
- numArgs: 1,
29530
- numOptionalArgs: 1,
29531
- allowedInText: true
29532
- },
29242
+ numArgs: 1,
29243
+ numOptionalArgs: 1,
29244
+ allowedInText: true,
29533
29245
  handler: (_ref, args, optArgs) => {
29534
- var {
29535
- parser: parser2
29536
- } = _ref;
29246
+ var parser2 = _ref.parser;
29537
29247
  var smashHeight = false;
29538
29248
  var smashDepth = false;
29539
29249
  var tbArg = optArgs[0] && assertNodeType(optArgs[0], "ordgroup");
@@ -29577,7 +29287,7 @@ defineFunction({
29577
29287
  node.depth = 0;
29578
29288
  }
29579
29289
  if (group.smashHeight && group.smashDepth) {
29580
- return makeSpan(["mord", "smash"], [node], options2);
29290
+ return makeSpan(["mord", "katex-smash"], [node], options2);
29581
29291
  }
29582
29292
  if (node.children) {
29583
29293
  for (var i = 0; i < node.children.length; i++) {
@@ -29612,14 +29322,10 @@ defineFunction({
29612
29322
  defineFunction({
29613
29323
  type: "sqrt",
29614
29324
  names: ["\\sqrt"],
29615
- props: {
29616
- numArgs: 1,
29617
- numOptionalArgs: 1
29618
- },
29325
+ numArgs: 1,
29326
+ numOptionalArgs: 1,
29619
29327
  handler(_ref, args, optArgs) {
29620
- var {
29621
- parser: parser2
29622
- } = _ref;
29328
+ var parser2 = _ref.parser;
29623
29329
  var index2 = optArgs[0];
29624
29330
  var body = args[0];
29625
29331
  return {
@@ -29643,11 +29349,7 @@ defineFunction({
29643
29349
  }
29644
29350
  var lineClearance = theta + phi / 4;
29645
29351
  var minDelimiterHeight = inner2.height + inner2.depth + lineClearance + theta;
29646
- var {
29647
- span: img,
29648
- ruleWidth,
29649
- advanceWidth
29650
- } = makeSqrtImage(minDelimiterHeight, options2);
29352
+ var _makeSqrtImage = makeSqrtImage(minDelimiterHeight, options2), img = _makeSqrtImage.span, ruleWidth = _makeSqrtImage.ruleWidth, advanceWidth = _makeSqrtImage.advanceWidth;
29651
29353
  var delimDepth = img.height - ruleWidth;
29652
29354
  if (delimDepth > inner2.height + inner2.depth + lineClearance) {
29653
29355
  lineClearance = (lineClearance + delimDepth - inner2.height - inner2.depth) / 2;
@@ -29685,15 +29387,12 @@ defineFunction({
29685
29387
  elem: rootm
29686
29388
  }]
29687
29389
  });
29688
- var rootVListWrap = makeSpan(["root"], [rootVList]);
29390
+ var rootVListWrap = makeSpan(["katex-root"], [rootVList]);
29689
29391
  return makeSpan(["mord", "sqrt"], [rootVListWrap, body], options2);
29690
29392
  }
29691
29393
  },
29692
29394
  mathmlBuilder(group, options2) {
29693
- var {
29694
- body,
29695
- index: index2
29696
- } = group;
29395
+ var body = group.body, index2 = group.index;
29697
29396
  return index2 ? new MathNode("mroot", [buildGroup2(body, options2), buildGroup2(index2, options2)]) : new MathNode("msqrt", [buildGroup2(body, options2)]);
29698
29397
  }
29699
29398
  });
@@ -29709,17 +29408,11 @@ function isStyleStr(s) {
29709
29408
  defineFunction({
29710
29409
  type: "styling",
29711
29410
  names: ["\\displaystyle", "\\textstyle", "\\scriptstyle", "\\scriptscriptstyle"],
29712
- props: {
29713
- numArgs: 0,
29714
- allowedInText: true,
29715
- primitive: true
29716
- },
29411
+ numArgs: 0,
29412
+ allowedInText: true,
29413
+ primitive: true,
29717
29414
  handler(_ref, args) {
29718
- var {
29719
- breakOnTokenText,
29720
- funcName,
29721
- parser: parser2
29722
- } = _ref;
29415
+ var breakOnTokenText = _ref.breakOnTokenText, funcName = _ref.funcName, parser2 = _ref.parser;
29723
29416
  var body = parser2.parseExpression(true, breakOnTokenText);
29724
29417
  var style = funcName.slice(1, funcName.length - 5);
29725
29418
  if (!isStyleStr(style)) {
@@ -29788,11 +29481,7 @@ defineFunctionBuilders({
29788
29481
  if (builderDelegate) {
29789
29482
  return builderDelegate(group, options2);
29790
29483
  }
29791
- var {
29792
- base: valueBase,
29793
- sup: valueSup,
29794
- sub: valueSub
29795
- } = group;
29484
+ var valueBase = group.base, valueSup = group.sup, valueSub = group.sub;
29796
29485
  var base2 = buildGroup$1(valueBase, options2);
29797
29486
  var supm;
29798
29487
  var subm;
@@ -29975,7 +29664,7 @@ var defaultVariant = {
29975
29664
  defineFunctionBuilders({
29976
29665
  type: "mathord",
29977
29666
  htmlBuilder(group, options2) {
29978
- return makeOrd(group, options2, "mathord");
29667
+ return makeOrd(group, options2);
29979
29668
  },
29980
29669
  mathmlBuilder(group, options2) {
29981
29670
  var node = new MathNode("mi", [makeText(group.text, group.mode, options2)]);
@@ -29989,7 +29678,7 @@ defineFunctionBuilders({
29989
29678
  defineFunctionBuilders({
29990
29679
  type: "textord",
29991
29680
  htmlBuilder(group, options2) {
29992
- return makeOrd(group, options2, "textord");
29681
+ return makeOrd(group, options2);
29993
29682
  },
29994
29683
  mathmlBuilder(group, options2) {
29995
29684
  var text2 = makeText(group.text, group.mode, options2);
@@ -30010,44 +29699,37 @@ defineFunctionBuilders({
30010
29699
  return node;
30011
29700
  }
30012
29701
  });
30013
- var cssSpace = {
30014
- "\\nobreak": "nobreak",
30015
- "\\allowbreak": "allowbreak"
30016
- };
30017
- var regularSpace = {
30018
- " ": {},
30019
- "\\ ": {},
30020
- "~": {
30021
- className: "nobreak"
30022
- },
30023
- "\\space": {},
30024
- "\\nobreakspace": {
30025
- className: "nobreak"
30026
- }
30027
- };
29702
+ var cssSpace = /* @__PURE__ */ new Map([["\\nobreak", "nobreak"], ["\\allowbreak", "allowbreak"]]);
29703
+ var regularSpace = /* @__PURE__ */ new Map([[" ", {}], ["\\ ", {}], ["~", {
29704
+ className: "nobreak"
29705
+ }], ["\\space", {}], ["\\nobreakspace", {
29706
+ className: "nobreak"
29707
+ }]]);
30028
29708
  defineFunctionBuilders({
30029
29709
  type: "spacing",
30030
29710
  htmlBuilder(group, options2) {
30031
- if (regularSpace.hasOwnProperty(group.text)) {
30032
- var className = regularSpace[group.text].className || "";
29711
+ var regularSpaceItem = regularSpace.get(group.text);
29712
+ var cssSpaceClass = cssSpace.get(group.text);
29713
+ if (regularSpaceItem) {
29714
+ var className = regularSpaceItem.className || "";
30033
29715
  if (group.mode === "text") {
30034
- var ord = makeOrd(group, options2, "textord");
29716
+ var ord = makeOrd(group, options2);
30035
29717
  ord.classes.push(className);
30036
29718
  return ord;
30037
29719
  } else {
30038
29720
  return makeSpan(["mspace", className], [mathsym(group.text, group.mode, options2)], options2);
30039
29721
  }
30040
- } else if (cssSpace.hasOwnProperty(group.text)) {
30041
- return makeSpan(["mspace", cssSpace[group.text]], [], options2);
29722
+ } else if (cssSpaceClass) {
29723
+ return makeSpan(["mspace", cssSpaceClass], [], options2);
30042
29724
  } else {
30043
29725
  throw new ParseError('Unknown type of space "' + group.text + '"');
30044
29726
  }
30045
29727
  },
30046
29728
  mathmlBuilder(group, options2) {
30047
29729
  var node;
30048
- if (regularSpace.hasOwnProperty(group.text)) {
29730
+ if (regularSpace.has(group.text)) {
30049
29731
  node = new MathNode("mtext", [new TextNode2(" ")]);
30050
- } else if (cssSpace.hasOwnProperty(group.text)) {
29732
+ } else if (cssSpace.has(group.text)) {
30051
29733
  return new MathNode("mspace");
30052
29734
  } else {
30053
29735
  throw new ParseError('Unknown type of space "' + group.text + '"');
@@ -30113,17 +29795,12 @@ defineFunction({
30113
29795
  "\\textup",
30114
29796
  "\\emph"
30115
29797
  ],
30116
- props: {
30117
- numArgs: 1,
30118
- argTypes: ["text"],
30119
- allowedInArgument: true,
30120
- allowedInText: true
30121
- },
29798
+ numArgs: 1,
29799
+ argTypes: ["text"],
29800
+ allowedInArgument: true,
29801
+ allowedInText: true,
30122
29802
  handler(_ref, args) {
30123
- var {
30124
- parser: parser2,
30125
- funcName
30126
- } = _ref;
29803
+ var parser2 = _ref.parser, funcName = _ref.funcName;
30127
29804
  var body = args[0];
30128
29805
  return {
30129
29806
  type: "text",
@@ -30145,14 +29822,10 @@ defineFunction({
30145
29822
  defineFunction({
30146
29823
  type: "underline",
30147
29824
  names: ["\\underline"],
30148
- props: {
30149
- numArgs: 1,
30150
- allowedInText: true
30151
- },
29825
+ numArgs: 1,
29826
+ allowedInText: true,
30152
29827
  handler(_ref, args) {
30153
- var {
30154
- parser: parser2
30155
- } = _ref;
29828
+ var parser2 = _ref.parser;
30156
29829
  return {
30157
29830
  type: "underline",
30158
29831
  mode: parser2.mode,
@@ -30180,7 +29853,7 @@ defineFunction({
30180
29853
  elem: innerGroup
30181
29854
  }]
30182
29855
  });
30183
- return makeSpan(["mord", "underline"], [vlist], options2);
29856
+ return makeSpan(["mord", "katex-underline"], [vlist], options2);
30184
29857
  },
30185
29858
  mathmlBuilder(group, options2) {
30186
29859
  var operator2 = new MathNode("mo", [new TextNode2("‾")]);
@@ -30193,16 +29866,12 @@ defineFunction({
30193
29866
  defineFunction({
30194
29867
  type: "vcenter",
30195
29868
  names: ["\\vcenter"],
30196
- props: {
30197
- numArgs: 1,
30198
- argTypes: ["original"],
30199
- // In LaTeX, \vcenter can act only on a box.
30200
- allowedInText: false
30201
- },
29869
+ numArgs: 1,
29870
+ argTypes: ["original"],
29871
+ // In LaTeX, \vcenter can act only on a box.
29872
+ allowedInText: false,
30202
29873
  handler(_ref, args) {
30203
- var {
30204
- parser: parser2
30205
- } = _ref;
29874
+ var parser2 = _ref.parser;
30206
29875
  return {
30207
29876
  type: "vcenter",
30208
29877
  mode: parser2.mode,
@@ -30230,10 +29899,8 @@ defineFunction({
30230
29899
  defineFunction({
30231
29900
  type: "verb",
30232
29901
  names: ["\\verb"],
30233
- props: {
30234
- numArgs: 0,
30235
- allowedInText: true
30236
- },
29902
+ numArgs: 0,
29903
+ allowedInText: true,
30237
29904
  handler(context, args, optArgs) {
30238
29905
  throw new ParseError("\\verb ended by end of line instead of matching delimiter");
30239
29906
  },
@@ -30312,7 +29979,12 @@ class Lexer {
30312
29979
  var nlIndex = input.indexOf("\n", this.tokenRegex.lastIndex);
30313
29980
  if (nlIndex === -1) {
30314
29981
  this.tokenRegex.lastIndex = input.length;
30315
- this.settings.reportNonstrict("commentAtEnd", "% comment has no terminating newline; LaTeX would fail because of commenting the end of math mode (e.g. $)");
29982
+ handleStrict({
29983
+ strict: this.settings.strict,
29984
+ errorCode: "commentAtEnd",
29985
+ errorMsg: "% comment has no terminating newline; LaTeX would fail because of commenting the end of math mode (e.g. $)",
29986
+ report: true
29987
+ });
30316
29988
  } else {
30317
29989
  this.tokenRegex.lastIndex = nlIndex + 1;
30318
29990
  }
@@ -30356,13 +30028,11 @@ class Namespace {
30356
30028
  throw new ParseError("Unbalanced namespace destruction: attempt to pop global namespace; please report this as a bug");
30357
30029
  }
30358
30030
  var undefs = this.undefStack.pop();
30359
- for (var undef in undefs) {
30360
- if (undefs.hasOwnProperty(undef)) {
30361
- if (undefs[undef] == null) {
30362
- delete this.current[undef];
30363
- } else {
30364
- this.current[undef] = undefs[undef];
30365
- }
30031
+ for (var key of Object.keys(undefs)) {
30032
+ if (undefs[key] === void 0) {
30033
+ delete this.current[key];
30034
+ } else {
30035
+ this.current[key] = undefs[key];
30366
30036
  }
30367
30037
  }
30368
30038
  }
@@ -30380,7 +30050,7 @@ class Namespace {
30380
30050
  * `get(name) != null`.
30381
30051
  */
30382
30052
  has(name2) {
30383
- return this.current.hasOwnProperty(name2) || this.builtins.hasOwnProperty(name2);
30053
+ return Object.prototype.hasOwnProperty.call(this.current, name2) || Object.prototype.hasOwnProperty.call(this.builtins, name2);
30384
30054
  }
30385
30055
  /**
30386
30056
  * Get the current value of a name, or `undefined` if there is no value.
@@ -30391,10 +30061,12 @@ class Namespace {
30391
30061
  * `if (namespace.has(...))`.
30392
30062
  */
30393
30063
  get(name2) {
30394
- if (this.current.hasOwnProperty(name2)) {
30064
+ if (Object.prototype.hasOwnProperty.call(this.current, name2)) {
30395
30065
  return this.current[name2];
30396
- } else {
30066
+ } else if (Object.prototype.hasOwnProperty.call(this.builtins, name2)) {
30397
30067
  return this.builtins[name2];
30068
+ } else {
30069
+ return void 0;
30398
30070
  }
30399
30071
  }
30400
30072
  /**
@@ -30417,8 +30089,8 @@ class Namespace {
30417
30089
  }
30418
30090
  } else {
30419
30091
  var top2 = this.undefStack[this.undefStack.length - 1];
30420
- if (top2 && !top2.hasOwnProperty(name2)) {
30421
- top2[name2] = this.current[name2];
30092
+ if (top2 && !Object.prototype.hasOwnProperty.call(top2, name2)) {
30093
+ top2[name2] = Object.prototype.hasOwnProperty.call(this.current, name2) ? this.current[name2] : void 0;
30422
30094
  }
30423
30095
  }
30424
30096
  if (value == null) {
@@ -30910,6 +30582,8 @@ defineMacro("⟦", "\\llbracket");
30910
30582
  defineMacro("⟧", "\\rrbracket");
30911
30583
  defineMacro("\\lBrace", "\\html@mathml{\\mathopen{\\{\\mkern-3.2mu[}}{\\mathopen{\\char`⦃}}");
30912
30584
  defineMacro("\\rBrace", "\\html@mathml{\\mathclose{]\\mkern-3.2mu\\}}}{\\mathclose{\\char`⦄}}");
30585
+ defineMacro("↤", "\\mapsfrom");
30586
+ defineMacro("\\mapsfrom", "\\html@mathml{\\mathrel{\\mathreflectbox{\\mapsto}}}{\\mathrel{\\char`↤}}");
30913
30587
  defineMacro("⦃", "\\lBrace");
30914
30588
  defineMacro("⦄", "\\rBrace");
30915
30589
  defineMacro("\\minuso", "\\mathbin{\\html@mathml{{\\mathrlap{\\mathchoice{\\kern{0.145em}}{\\kern{0.145em}}{\\kern{0.1015em}}{\\kern{0.0725em}}\\circ}{-}}}{\\char`⦵}}");
@@ -31193,16 +30867,14 @@ class MacroExpander {
31193
30867
  return null;
31194
30868
  }
31195
30869
  start = this.popToken();
31196
- ({
31197
- tokens,
31198
- end
31199
- } = this.consumeArg(["]"]));
30870
+ var _this$consumeArg = this.consumeArg(["]"]);
30871
+ tokens = _this$consumeArg.tokens;
30872
+ end = _this$consumeArg.end;
31200
30873
  } else {
31201
- ({
31202
- tokens,
31203
- start,
31204
- end
31205
- } = this.consumeArg());
30874
+ var _this$consumeArg2 = this.consumeArg();
30875
+ tokens = _this$consumeArg2.tokens;
30876
+ start = _this$consumeArg2.start;
30877
+ end = _this$consumeArg2.end;
31206
30878
  }
31207
30879
  this.pushToken(new Token("EOF", end.loc));
31208
30880
  this.pushTokens(tokens);
@@ -31471,14 +31143,17 @@ class MacroExpander {
31471
31143
  * `implicitCommands`.
31472
31144
  */
31473
31145
  isDefined(name2) {
31474
- return this.macros.has(name2) || functions.hasOwnProperty(name2) || symbols.math.hasOwnProperty(name2) || symbols.text.hasOwnProperty(name2) || implicitCommands.hasOwnProperty(name2);
31146
+ return this.macros.has(name2) || Object.prototype.hasOwnProperty.call(functions, name2) || Object.prototype.hasOwnProperty.call(symbols.math, name2) || Object.prototype.hasOwnProperty.call(symbols.text, name2) || Object.prototype.hasOwnProperty.call(implicitCommands, name2);
31475
31147
  }
31476
31148
  /**
31477
31149
  * Determine whether a command is expandable.
31478
31150
  */
31479
31151
  isExpandable(name2) {
31480
31152
  var macro = this.macros.get(name2);
31481
- return macro != null ? typeof macro === "string" || typeof macro === "function" || !macro.unexpandable : functions.hasOwnProperty(name2) && !functions[name2].primitive;
31153
+ if (macro != null) {
31154
+ return typeof macro === "string" || typeof macro === "function" || !macro.unexpandable;
31155
+ }
31156
+ return Object.prototype.hasOwnProperty.call(functions, name2) && !functions[name2].primitive;
31482
31157
  }
31483
31158
  }
31484
31159
  var unicodeSubRegEx = /^[₊₋₌₍₎₀₁₂₃₄₅₆₇₈₉ₐₑₕᵢⱼₖₗₘₙₒₚᵣₛₜᵤᵥₓᵦᵧᵨᵩᵪ]/;
@@ -32223,8 +31898,7 @@ class Parser2 {
32223
31898
  var lex = this.fetch();
32224
31899
  if (lex.text === "\\limits" || lex.text === "\\nolimits") {
32225
31900
  if (base2 && base2.type === "op") {
32226
- var limits = lex.text === "\\limits";
32227
- base2.limits = limits;
31901
+ base2.limits = lex.text === "\\limits";
32228
31902
  base2.alwaysHandleSupSub = true;
32229
31903
  } else if (base2 && base2.type === "operatorname") {
32230
31904
  if (base2.alwaysHandleSupSub) {
@@ -32301,7 +31975,7 @@ class Parser2 {
32301
31975
  break;
32302
31976
  }
32303
31977
  }
32304
- if (superscript || subscript) {
31978
+ if (superscript && subscript) {
32305
31979
  return {
32306
31980
  type: "supsub",
32307
31981
  mode: this.mode,
@@ -32309,6 +31983,20 @@ class Parser2 {
32309
31983
  sup: superscript,
32310
31984
  sub: subscript
32311
31985
  };
31986
+ } else if (superscript) {
31987
+ return {
31988
+ type: "supsub",
31989
+ mode: this.mode,
31990
+ base: base2,
31991
+ sup: superscript
31992
+ };
31993
+ } else if (subscript) {
31994
+ return {
31995
+ type: "supsub",
31996
+ mode: this.mode,
31997
+ base: base2,
31998
+ sub: subscript
31999
+ };
32312
32000
  } else {
32313
32001
  return base2;
32314
32002
  }
@@ -32331,10 +32019,7 @@ class Parser2 {
32331
32019
  } else if (this.mode === "math" && funcData.allowedInMath === false) {
32332
32020
  throw new ParseError("Can't use function '" + func + "' in math mode", token);
32333
32021
  }
32334
- var {
32335
- args,
32336
- optArgs
32337
- } = this.parseArguments(func, funcData);
32022
+ var _this$parseArguments = this.parseArguments(func, funcData), args = _this$parseArguments.args, optArgs = _this$parseArguments.optArgs;
32338
32023
  return this.callFunction(func, args, optArgs, token, breakOnTokenText);
32339
32024
  }
32340
32025
  /**
@@ -32358,7 +32043,9 @@ class Parser2 {
32358
32043
  * Parses the arguments of a function or environment
32359
32044
  */
32360
32045
  parseArguments(func, funcData) {
32361
- var totalArgs = funcData.numArgs + funcData.numOptionalArgs;
32046
+ var _funcData$numOptional;
32047
+ var numOptionalArgs = (_funcData$numOptional = funcData.numOptionalArgs) != null ? _funcData$numOptional : 0;
32048
+ var totalArgs = funcData.numArgs + numOptionalArgs;
32362
32049
  if (totalArgs === 0) {
32363
32050
  return {
32364
32051
  args: [],
@@ -32368,8 +32055,9 @@ class Parser2 {
32368
32055
  var args = [];
32369
32056
  var optArgs = [];
32370
32057
  for (var i = 0; i < totalArgs; i++) {
32371
- var argType = funcData.argTypes && funcData.argTypes[i];
32372
- var isOptional = i < funcData.numOptionalArgs;
32058
+ var _funcData$argTypes;
32059
+ var argType = (_funcData$argTypes = funcData.argTypes) == null ? void 0 : _funcData$argTypes[i];
32060
+ var isOptional = i < numOptionalArgs;
32373
32061
  if ("primitive" in funcData && funcData.primitive && argType == null || // \sqrt expands into primitive if optional argument doesn't exist
32374
32062
  funcData.type === "sqrt" && i === 1 && optArgs[0] == null) {
32375
32063
  argType = "primitive";
@@ -32414,7 +32102,11 @@ class Parser2 {
32414
32102
  } : null;
32415
32103
  }
32416
32104
  case "raw": {
32417
- var token = this.parseStringGroup("raw", optional);
32105
+ this.gullet.consumeSpaces();
32106
+ var percentCatcode = this.gullet.lexer.catcodes["%"];
32107
+ this.gullet.lexer.setCatcode("%", 12);
32108
+ var token = this.parseStringGroup(optional);
32109
+ this.gullet.lexer.setCatcode("%", percentCatcode);
32418
32110
  return token != null ? {
32419
32111
  type: "raw",
32420
32112
  mode: "text",
@@ -32432,7 +32124,6 @@ class Parser2 {
32432
32124
  return _group2;
32433
32125
  }
32434
32126
  case "original":
32435
- case null:
32436
32127
  case void 0:
32437
32128
  return this.parseArgumentGroup(optional);
32438
32129
  default:
@@ -32451,7 +32142,7 @@ class Parser2 {
32451
32142
  * Parses a group, essentially returning the string formed by the
32452
32143
  * brace-enclosed tokens plus some position information.
32453
32144
  */
32454
- parseStringGroup(modeName, optional) {
32145
+ parseStringGroup(optional) {
32455
32146
  var argToken = this.gullet.scanArgument(optional);
32456
32147
  if (argToken == null) {
32457
32148
  return null;
@@ -32490,7 +32181,7 @@ class Parser2 {
32490
32181
  * Parses a color description.
32491
32182
  */
32492
32183
  parseColorGroup(optional) {
32493
- var res = this.parseStringGroup("color", optional);
32184
+ var res = this.parseStringGroup(optional);
32494
32185
  if (res == null) {
32495
32186
  return null;
32496
32187
  }
@@ -32518,7 +32209,7 @@ class Parser2 {
32518
32209
  if (!optional && this.gullet.future().text !== "{") {
32519
32210
  res = this.parseRegexGroup(/^[-+]? *(?:$|\d+|\d+\.\d*|\.\d*) *[a-z]{0,2} *$/, "size");
32520
32211
  } else {
32521
- res = this.parseStringGroup("size", optional);
32212
+ res = this.parseStringGroup(optional);
32522
32213
  }
32523
32214
  if (!res) {
32524
32215
  return null;
@@ -32551,11 +32242,13 @@ class Parser2 {
32551
32242
  * and setting the catcode of % as an active character (as in \hyperref).
32552
32243
  */
32553
32244
  parseUrlGroup(optional) {
32245
+ var percentCatcode = this.gullet.lexer.catcodes["%"];
32246
+ var tildeCatcode = this.gullet.lexer.catcodes["~"];
32554
32247
  this.gullet.lexer.setCatcode("%", 13);
32555
32248
  this.gullet.lexer.setCatcode("~", 12);
32556
- var res = this.parseStringGroup("url", optional);
32557
- this.gullet.lexer.setCatcode("%", 14);
32558
- this.gullet.lexer.setCatcode("~", 13);
32249
+ var res = this.parseStringGroup(optional);
32250
+ this.gullet.lexer.setCatcode("%", percentCatcode);
32251
+ this.gullet.lexer.setCatcode("~", tildeCatcode);
32559
32252
  if (res == null) {
32560
32253
  return null;
32561
32254
  }
@@ -32624,7 +32317,7 @@ class Parser2 {
32624
32317
  };
32625
32318
  } else {
32626
32319
  result = this.parseFunction(breakOnTokenText, name2) || this.parseSymbol();
32627
- if (result == null && text2[0] === "\\" && !implicitCommands.hasOwnProperty(text2)) {
32320
+ if (result == null && text2[0] === "\\" && !Object.prototype.hasOwnProperty.call(implicitCommands, text2)) {
32628
32321
  if (this.settings.throwOnError) {
32629
32322
  throw new ParseError("Undefined control sequence: " + text2, firstToken);
32630
32323
  }
@@ -32710,9 +32403,15 @@ class Parser2 {
32710
32403
  star: star2
32711
32404
  };
32712
32405
  }
32713
- if (unicodeSymbols.hasOwnProperty(text2[0]) && !symbols[this.mode][text2[0]]) {
32406
+ if (Object.prototype.hasOwnProperty.call(unicodeSymbols, text2[0]) && !symbols[this.mode][text2[0]]) {
32714
32407
  if (this.settings.strict && this.mode === "math") {
32715
- this.settings.reportNonstrict("unicodeTextInMathMode", 'Accented Unicode text character "' + text2[0] + '" used in math mode', nucleus);
32408
+ handleStrict({
32409
+ strict: this.settings.strict,
32410
+ errorCode: "unicodeTextInMathMode",
32411
+ errorMsg: 'Accented Unicode text character "' + text2[0] + '" used in math mode',
32412
+ report: true,
32413
+ token: nucleus
32414
+ });
32716
32415
  }
32717
32416
  text2 = unicodeSymbols[text2[0]] + text2.slice(1);
32718
32417
  }
@@ -32728,7 +32427,13 @@ class Parser2 {
32728
32427
  var symbol;
32729
32428
  if (symbols[this.mode][text2]) {
32730
32429
  if (this.settings.strict && this.mode === "math" && extraLatin.includes(text2)) {
32731
- this.settings.reportNonstrict("unicodeTextInMathMode", 'Latin-1/Unicode text character "' + text2[0] + '" used in math mode', nucleus);
32430
+ handleStrict({
32431
+ strict: this.settings.strict,
32432
+ errorCode: "unicodeTextInMathMode",
32433
+ errorMsg: 'Latin-1/Unicode text character "' + text2[0] + '" used in math mode',
32434
+ report: true,
32435
+ token: nucleus
32436
+ });
32732
32437
  }
32733
32438
  var group = symbols[this.mode][text2].group;
32734
32439
  var loc = SourceLocation.range(nucleus);
@@ -32753,9 +32458,21 @@ class Parser2 {
32753
32458
  } else if (text2.charCodeAt(0) >= 128) {
32754
32459
  if (this.settings.strict) {
32755
32460
  if (!supportedCodepoint(text2.charCodeAt(0))) {
32756
- this.settings.reportNonstrict("unknownSymbol", 'Unrecognized Unicode character "' + text2[0] + '"' + (" (" + text2.charCodeAt(0) + ")"), nucleus);
32461
+ handleStrict({
32462
+ strict: this.settings.strict,
32463
+ errorCode: "unknownSymbol",
32464
+ errorMsg: 'Unrecognized Unicode character "' + text2[0] + '"' + (" (" + text2.charCodeAt(0) + ")"),
32465
+ report: true,
32466
+ token: nucleus
32467
+ });
32757
32468
  } else if (this.mode === "math") {
32758
- this.settings.reportNonstrict("unicodeTextInMathMode", 'Unicode text character "' + text2[0] + '" used in math mode', nucleus);
32469
+ handleStrict({
32470
+ strict: this.settings.strict,
32471
+ errorCode: "unicodeTextInMathMode",
32472
+ errorMsg: 'Unicode text character "' + text2[0] + '" used in math mode',
32473
+ report: true,
32474
+ token: nucleus
32475
+ });
32759
32476
  }
32760
32477
  }
32761
32478
  symbol = {
@@ -32858,12 +32575,12 @@ var renderToHTMLTree = function renderToHTMLTree2(expression, options2) {
32858
32575
  var settings = new Settings(options2);
32859
32576
  try {
32860
32577
  var tree = parseTree(expression, settings);
32861
- return buildHTMLTree(tree, expression, settings);
32578
+ return buildHTMLTree(tree, settings);
32862
32579
  } catch (error) {
32863
32580
  return renderError(error, expression, settings);
32864
32581
  }
32865
32582
  };
32866
- var version = "0.16.47";
32583
+ var version = "0.19.1";
32867
32584
  var __domTree = {
32868
32585
  Span,
32869
32586
  Anchor,
@@ -33237,7 +32954,7 @@ const PRINT_PALETTE = {
33237
32954
  };
33238
32955
  let pele = null;
33239
32956
  function loadPele() {
33240
- pele ??= __vitePreload(() => import("./lazy-C5_LqPMG.js").then((n) => n.l), true ? [] : void 0, import.meta.url);
32957
+ pele ??= __vitePreload(() => import("./lazy-DVWnMOaz.js").then((n) => n.l), true ? [] : void 0, import.meta.url);
33241
32958
  return pele;
33242
32959
  }
33243
32960
  function withPrintPalette(svg, palette) {
@@ -33261,43 +32978,49 @@ const zoomHosts = /* @__PURE__ */ new Set();
33261
32978
  function isZoomed(record) {
33262
32979
  return !!record.zoom && record.zoom.scale > record.zoom.fit * 1.001;
33263
32980
  }
33264
- function isDiagramZoomed(host) {
33265
- const record = zooms.get(host);
32981
+ function isDiagramZoomed(host2) {
32982
+ const record = zooms.get(host2);
33266
32983
  return !!record && isZoomed(record);
33267
32984
  }
33268
- function attachDiagramZoom(host) {
33269
- if (zooms.has(host)) return;
32985
+ function attachDiagramZoom(host2) {
32986
+ if (zooms.has(host2)) return;
33270
32987
  const record = { zoom: null };
33271
- zooms.set(host, record);
33272
- zoomHosts.add(host);
32988
+ zooms.set(host2, record);
32989
+ zoomHosts.add(host2);
33273
32990
  void loadPele().then(({ enableZoom }) => {
33274
- if (!host.isConnected) return;
33275
- record.zoom = enableZoom(host, {
32991
+ if (!host2.isConnected) return;
32992
+ record.zoom = enableZoom(host2, {
33276
32993
  labels: isChinese$1() ? { zoomIn: "放大", zoomOut: "缩小", reset: "还原到适合宽度" } : { zoomIn: "Zoom in", zoomOut: "Zoom out", reset: "Reset zoom" }
33277
32994
  });
33278
32995
  });
33279
32996
  }
33280
- function detachDiagramZoom(host) {
33281
- const record = zooms.get(host);
32997
+ function detachDiagramZoom(host2) {
32998
+ const record = zooms.get(host2);
33282
32999
  if (!record) return;
33283
- zooms.delete(host);
33284
- zoomHosts.delete(host);
33000
+ zooms.delete(host2);
33001
+ zoomHosts.delete(host2);
33285
33002
  record.zoom?.destroy();
33286
33003
  }
33287
- function withDiagramZoomPaused(run) {
33004
+ function pauseDiagramZoom() {
33288
33005
  const hidden = [];
33289
- for (const host of zoomHosts) {
33290
- zooms.get(host)?.zoom?.reset();
33291
- const controls = host.querySelector(".pele-zoom");
33006
+ for (const host2 of zoomHosts) {
33007
+ zooms.get(host2)?.zoom?.reset();
33008
+ const controls = host2.querySelector(".pele-zoom");
33292
33009
  if (controls && controls.style.display !== "none") {
33293
33010
  hidden.push({ element: controls, display: controls.style.display });
33294
33011
  controls.style.display = "none";
33295
33012
  }
33296
33013
  }
33014
+ return () => {
33015
+ for (const item of hidden) item.element.style.display = item.display;
33016
+ };
33017
+ }
33018
+ function withDiagramZoomPaused(run) {
33019
+ const restore = pauseDiagramZoom();
33297
33020
  try {
33298
33021
  return run();
33299
33022
  } finally {
33300
- for (const item of hidden) item.element.style.display = item.display;
33023
+ restore();
33301
33024
  }
33302
33025
  }
33303
33026
  const BLOCKED_TAGS = /* @__PURE__ */ new Set([
@@ -33467,13 +33190,13 @@ function hideMarker(state, from, to, ranges, visible = false) {
33467
33190
  const end = next === " " || next === " " ? to + 1 : to;
33468
33191
  ranges.push({ from, to: end, deco: visible ? MARK({ class: "cm-md-marker" }) : hide() });
33469
33192
  }
33470
- function inRange(range, pos) {
33193
+ function inRange$1(range, pos) {
33471
33194
  return !!range && pos >= range.from && pos < range.to;
33472
33195
  }
33473
- function iterateContent(state, front, enter) {
33196
+ function iterateContent$1(state, front, enter) {
33474
33197
  syntaxTree(state).iterate({
33475
33198
  enter: (node) => {
33476
- if (front && node.name !== "Document" && inRange(front, node.from)) return false;
33199
+ if (front && node.name !== "Document" && inRange$1(front, node.from)) return false;
33477
33200
  return enter(node);
33478
33201
  }
33479
33202
  });
@@ -33595,6 +33318,7 @@ function isActiveRange(_state, _from, _to) {
33595
33318
  return false;
33596
33319
  }
33597
33320
  function isBlockActive(state, from, to) {
33321
+ if (exportingCleanly(state)) return false;
33598
33322
  const sel = state.selection.main;
33599
33323
  return sel.from >= from && sel.to <= to;
33600
33324
  }
@@ -33699,7 +33423,7 @@ class TaskCheckboxWidget extends WidgetType {
33699
33423
  }
33700
33424
  }
33701
33425
  function collectTaskItems(state, ranges, front) {
33702
- iterateContent(state, front, (node) => {
33426
+ iterateContent$1(state, front, (node) => {
33703
33427
  if (node.name !== "TaskMarker") return;
33704
33428
  const raw = state.doc.sliceString(node.from, node.to);
33705
33429
  const checked = /x/i.test(raw);
@@ -33746,8 +33470,8 @@ class MermaidWidget extends WidgetType {
33746
33470
  const target = event.target;
33747
33471
  if (!(target instanceof Element)) return false;
33748
33472
  if (target.closest(".pele-zoom")) return true;
33749
- const host = target.closest(".cm-md-mermaid");
33750
- return !!host && isDiagramZoomed(host);
33473
+ const host2 = target.closest(".cm-md-mermaid");
33474
+ return !!host2 && isDiagramZoomed(host2);
33751
33475
  }
33752
33476
  }
33753
33477
  const POINTER_EVENTS = /* @__PURE__ */ new Set([
@@ -33761,7 +33485,7 @@ const POINTER_EVENTS = /* @__PURE__ */ new Set([
33761
33485
  "touchend"
33762
33486
  ]);
33763
33487
  function collectMermaid(state, text2, ranges, front, zones) {
33764
- iterateContent(state, front, (node) => {
33488
+ iterateContent$1(state, front, (node) => {
33765
33489
  if (node.name !== "FencedCode") return;
33766
33490
  const firstLineEnd = text2.indexOf("\n", node.from);
33767
33491
  if (firstLineEnd === -1) return;
@@ -33950,7 +33674,7 @@ function appendInline(parent, text2, base2) {
33950
33674
  if (last2 < text2.length) write(parent, last2, text2.length);
33951
33675
  }
33952
33676
  function collectTables(state, ranges, front, zones) {
33953
- iterateContent(state, front, (node) => {
33677
+ iterateContent$1(state, front, (node) => {
33954
33678
  if (node.name !== "Table") return;
33955
33679
  zones.push({ from: node.from, to: node.to, kind: "block" });
33956
33680
  if (isBlockActive(state, node.from, node.to)) {
@@ -33960,20 +33684,23 @@ function collectTables(state, ranges, front, zones) {
33960
33684
  ranges.push({
33961
33685
  from: node.from,
33962
33686
  to: node.to,
33687
+ // 表格恒为整行 → 恒为 block 装饰:跨行 inline replace 在增量更新时
33688
+ // widget 不会被重建,改完表格退出源码后整块会消失(见 collectMath)。
33963
33689
  deco: Decoration.replace({
33964
33690
  widget: new TableWidget(
33965
33691
  state.doc.sliceString(node.from, node.to),
33966
33692
  state.field(documentFileUrlField, false) ?? documentFileUrl,
33967
33693
  node.from,
33968
33694
  node.to
33969
- )
33695
+ ),
33696
+ block: true
33970
33697
  })
33971
33698
  });
33972
33699
  return false;
33973
33700
  });
33974
33701
  }
33975
33702
  function collectLinks(state, ranges, front) {
33976
- iterateContent(state, front, (node) => {
33703
+ iterateContent$1(state, front, (node) => {
33977
33704
  if (node.name !== "Link") return;
33978
33705
  const url = node.node.getChild("URL");
33979
33706
  if (!url) return false;
@@ -34019,7 +33746,7 @@ function collectFootnotes(state, text2, ranges, front) {
34019
33746
  while ((match = FOOTNOTE_REF_RE.exec(text2)) !== null) {
34020
33747
  const from = match.index;
34021
33748
  const to = from + match[0].length;
34022
- if (front && inRange(front, from)) continue;
33749
+ if (front && inRange$1(front, from)) continue;
34023
33750
  if (definitions.has(match[1]) === false && numbers.has(match[1]) === false) continue;
34024
33751
  ranges.push({
34025
33752
  from,
@@ -34030,7 +33757,7 @@ function collectFootnotes(state, text2, ranges, front) {
34030
33757
  for (let n = 1; n <= state.doc.lines; n++) {
34031
33758
  const line = state.doc.line(n);
34032
33759
  if (!/^ {0,3}\[\^[^\]\s]+\]:/.test(line.text)) continue;
34033
- if (front && inRange(front, line.from)) continue;
33760
+ if (front && inRange$1(front, line.from)) continue;
34034
33761
  ranges.push({ from: line.from, to: line.from, deco: BLOCK("cm-md-footnote-def") });
34035
33762
  }
34036
33763
  }
@@ -34055,7 +33782,7 @@ class HTMLWidget extends WidgetType {
34055
33782
  }
34056
33783
  function collectHTML(state, ranges, front, zones) {
34057
33784
  const paired = /* @__PURE__ */ new Set();
34058
- iterateContent(state, front, (node) => {
33785
+ iterateContent$1(state, front, (node) => {
34059
33786
  const block = node.name === "HTMLBlock";
34060
33787
  if (!block && node.name !== "HTMLTag") return;
34061
33788
  if (block) zones.push({ from: node.from, to: node.to, kind: "block" });
@@ -34076,7 +33803,12 @@ function collectHTML(state, ranges, front, zones) {
34076
33803
  ranges.push({
34077
33804
  from: node.from,
34078
33805
  to: node.to,
34079
- deco: Decoration.replace({ widget: new HTMLWidget(state.doc.sliceString(node.from, node.to), block, node.from, node.to) })
33806
+ // HTML 块跨行 → block 装饰:跨行 inline replace 在增量更新时 widget 不会
33807
+ // 被重建,退出源码后整块消失(见 collectMath)。行内标签不跨行,保持 inline。
33808
+ deco: Decoration.replace({
33809
+ widget: new HTMLWidget(state.doc.sliceString(node.from, node.to), block, node.from, node.to),
33810
+ block: block && state.doc.lineAt(node.from).from === node.from && state.doc.lineAt(Math.min(node.to, state.doc.length)).to === node.to
33811
+ })
34080
33812
  });
34081
33813
  return false;
34082
33814
  });
@@ -34125,7 +33857,7 @@ function codeInsideFence(state, node) {
34125
33857
  }
34126
33858
  function collectImages(state, ranges, front) {
34127
33859
  const base2 = state.field(documentFileUrlField, false) ?? documentFileUrl;
34128
- iterateContent(state, front, (node) => {
33860
+ iterateContent$1(state, front, (node) => {
34129
33861
  if (node.name !== "Image") return;
34130
33862
  if (isActiveRange(state, node.from, node.to)) ;
34131
33863
  const source = state.doc.sliceString(node.from, node.to);
@@ -34140,7 +33872,7 @@ function collectImages(state, ranges, front) {
34140
33872
  });
34141
33873
  }
34142
33874
  function collectBlocks(state, ranges, front) {
34143
- iterateContent(state, front, (node) => {
33875
+ iterateContent$1(state, front, (node) => {
34144
33876
  switch (node.name) {
34145
33877
  case "Blockquote": {
34146
33878
  pushBlockLines(state, node.from, node.to, "cm-md-blockquote", ranges);
@@ -34219,10 +33951,10 @@ function collectBlocks(state, ranges, front) {
34219
33951
  }
34220
33952
  const URL_STOP = /[\u2E80-\u30FF\u3400-\u4DBF\u4E00-\u9FFF\uF900-\uFAFF\u3000-\u303F\uFF00-\uFFEF]/;
34221
33953
  function collectInline(state, ranges, front) {
34222
- iterateContent(state, front, (node) => {
33954
+ iterateContent$1(state, front, (node) => {
34223
33955
  const from = node.from;
34224
33956
  const to = node.to;
34225
- const active = isActiveLine();
33957
+ const active2 = isActiveLine();
34226
33958
  switch (node.name) {
34227
33959
  case "ATXHeading1":
34228
33960
  case "ATXHeading2":
@@ -34248,7 +33980,7 @@ function collectInline(state, ranges, front) {
34248
33980
  break;
34249
33981
  }
34250
33982
  case "HeaderMark": {
34251
- hideMarker(state, from, to, ranges, active);
33983
+ hideMarker(state, from, to, ranges, active2);
34252
33984
  break;
34253
33985
  }
34254
33986
  case "InlineCode": {
@@ -34281,7 +34013,7 @@ const PAGE_CLASS_PREFIX = "cm-md-page-";
34281
34013
  const PAGE_START_CLASS = "cm-md-page-start";
34282
34014
  function collectPages(state, ranges, front) {
34283
34015
  const breaks = [];
34284
- iterateContent(state, front, (node) => {
34016
+ iterateContent$1(state, front, (node) => {
34285
34017
  if (node.name !== "HorizontalRule") return;
34286
34018
  breaks.push(state.doc.lineAt(node.from).number);
34287
34019
  });
@@ -34319,7 +34051,7 @@ function activeZonesKey(state, zones) {
34319
34051
  }
34320
34052
  return parts.join("|");
34321
34053
  }
34322
- function buildDecorations(state, flash) {
34054
+ function buildDecorations$1(state, flash) {
34323
34055
  const ranges = [];
34324
34056
  const zones = [];
34325
34057
  const text2 = state.doc.toString();
@@ -34349,7 +34081,7 @@ function buildDecorations(state, flash) {
34349
34081
  return deco;
34350
34082
  }
34351
34083
  const livePreviewField = StateField.define({
34352
- create: (state) => buildDecorations(state, null),
34084
+ create: (state) => buildDecorations$1(state, null),
34353
34085
  update(deco, tr) {
34354
34086
  const flash = tr.effects.find((effect) => effect.is(headingFlashEffect));
34355
34087
  const flashValue = flash ? flash.value : currentFlash;
@@ -34365,7 +34097,7 @@ const livePreviewField = StateField.define({
34365
34097
  return deco;
34366
34098
  }
34367
34099
  }
34368
- return buildDecorations(tr.state, flashValue);
34100
+ return buildDecorations$1(tr.state, flashValue);
34369
34101
  },
34370
34102
  provide: (field) => EditorView.decorations.from(field)
34371
34103
  });
@@ -34751,9 +34483,9 @@ let fieldMarker = /* @__PURE__ */ Decoration.widget({ widget: /* @__PURE__ */ ne
34751
34483
  }() });
34752
34484
  let fieldRange = /* @__PURE__ */ Decoration.mark({ class: "cm-snippetField" });
34753
34485
  class ActiveSnippet {
34754
- constructor(ranges, active) {
34486
+ constructor(ranges, active2) {
34755
34487
  this.ranges = ranges;
34756
- this.active = active;
34488
+ this.active = active2;
34757
34489
  this.deco = Decoration.set(ranges.map((r) => (r.from == r.to ? fieldMarker : fieldRange).range(r.from, r.to)), true);
34758
34490
  }
34759
34491
  map(changes) {
@@ -34811,8 +34543,8 @@ function snippet(template) {
34811
34543
  if (ranges.length)
34812
34544
  spec.selection = fieldSelection(ranges, 0);
34813
34545
  if (ranges.some((r) => r.field > 0)) {
34814
- let active = new ActiveSnippet(ranges, 0);
34815
- let effects = spec.effects = [setActive.of(active)];
34546
+ let active2 = new ActiveSnippet(ranges, 0);
34547
+ let effects = spec.effects = [setActive.of(active2)];
34816
34548
  if (editor.state.field(snippetState, false) === void 0)
34817
34549
  effects.push(StateEffect.appendConfig.of([snippetState, addSnippetKeymap, snippetPointerHandler, baseTheme]));
34818
34550
  }
@@ -34821,21 +34553,21 @@ function snippet(template) {
34821
34553
  }
34822
34554
  function moveField(dir) {
34823
34555
  return ({ state, dispatch }) => {
34824
- let active = state.field(snippetState, false);
34825
- if (!active || dir < 0 && active.active == 0)
34556
+ let active2 = state.field(snippetState, false);
34557
+ if (!active2 || dir < 0 && active2.active == 0)
34826
34558
  return false;
34827
- let next = active.active + dir, last2 = dir > 0 && !active.ranges.some((r) => r.field == next + dir);
34559
+ let next = active2.active + dir, last2 = dir > 0 && !active2.ranges.some((r) => r.field == next + dir);
34828
34560
  dispatch(state.update({
34829
- selection: fieldSelection(active.ranges, next),
34830
- effects: setActive.of(last2 ? null : new ActiveSnippet(active.ranges, next)),
34561
+ selection: fieldSelection(active2.ranges, next),
34562
+ effects: setActive.of(last2 ? null : new ActiveSnippet(active2.ranges, next)),
34831
34563
  scrollIntoView: true
34832
34564
  }));
34833
34565
  return true;
34834
34566
  };
34835
34567
  }
34836
34568
  const clearSnippet = ({ state, dispatch }) => {
34837
- let active = state.field(snippetState, false);
34838
- if (!active)
34569
+ let active2 = state.field(snippetState, false);
34570
+ if (!active2)
34839
34571
  return false;
34840
34572
  dispatch(state.update({ effects: setActive.of(null) }));
34841
34573
  return true;
@@ -34857,15 +34589,15 @@ function snippetCompletion(template, completion) {
34857
34589
  }
34858
34590
  const snippetPointerHandler = /* @__PURE__ */ EditorView.domEventHandlers({
34859
34591
  mousedown(event, view) {
34860
- let active = view.state.field(snippetState, false), pos;
34861
- if (!active || (pos = view.posAtCoords({ x: event.clientX, y: event.clientY })) == null)
34592
+ let active2 = view.state.field(snippetState, false), pos;
34593
+ if (!active2 || (pos = view.posAtCoords({ x: event.clientX, y: event.clientY })) == null)
34862
34594
  return false;
34863
- let match = active.ranges.find((r) => r.from <= pos && r.to >= pos);
34864
- if (!match || match.field == active.active)
34595
+ let match = active2.ranges.find((r) => r.from <= pos && r.to >= pos);
34596
+ if (!match || match.field == active2.active)
34865
34597
  return false;
34866
34598
  view.dispatch({
34867
- selection: fieldSelection(active.ranges, match.field),
34868
- effects: setActive.of(active.ranges.some((r) => r.field > match.field) ? new ActiveSnippet(active.ranges, match.field) : null),
34599
+ selection: fieldSelection(active2.ranges, match.field),
34600
+ effects: setActive.of(active2.ranges.some((r) => r.field > match.field) ? new ActiveSnippet(active2.ranges, match.field) : null),
34869
34601
  scrollIntoView: true
34870
34602
  });
34871
34603
  return true;
@@ -35695,11 +35427,11 @@ class BlockContext {
35695
35427
  this.absoluteLineEnd = end;
35696
35428
  line.reset(text2);
35697
35429
  for (; line.depth < this.stack.length; line.depth++) {
35698
- let cx = this.stack[line.depth], handler = this.parser.skipContextMarkup[cx.type];
35699
- if (!handler)
35430
+ let cx = this.stack[line.depth], handler2 = this.parser.skipContextMarkup[cx.type];
35431
+ if (!handler2)
35700
35432
  throw new Error("Unhandled block context " + Type[cx.type]);
35701
35433
  let marks = this.line.markers.length;
35702
- if (!handler(cx, this, line)) {
35434
+ if (!handler2(cx, this, line)) {
35703
35435
  if (this.line.markers.length > marks)
35704
35436
  cx.end = this.line.markers[this.line.markers.length - 1].to;
35705
35437
  line.forward();
@@ -42062,7 +41794,7 @@ function legacy(parser2) {
42062
41794
  return new LanguageSupport(StreamLanguage.define(parser2));
42063
41795
  }
42064
41796
  function sql(dialectName) {
42065
- return __vitePreload(() => import("./index-CBsqa7KF.js"), true ? [] : void 0, import.meta.url).then((m) => m.sql({ dialect: m[dialectName] }));
41797
+ return __vitePreload(() => import("./index-DN-WehV_.js"), true ? [] : void 0, import.meta.url).then((m) => m.sql({ dialect: m[dialectName] }));
42066
41798
  }
42067
41799
  const languages = [
42068
41800
  // New-style language modes
@@ -42070,7 +41802,7 @@ const languages = [
42070
41802
  name: "C",
42071
41803
  extensions: ["c", "h", "ino"],
42072
41804
  load() {
42073
- return __vitePreload(() => import("./index-B7a6ecSB.js"), true ? [] : void 0, import.meta.url).then((m) => m.cpp());
41805
+ return __vitePreload(() => import("./index-C3jLCWOv.js"), true ? [] : void 0, import.meta.url).then((m) => m.cpp());
42074
41806
  }
42075
41807
  }),
42076
41808
  /* @__PURE__ */ LanguageDescription.of({
@@ -42078,7 +41810,7 @@ const languages = [
42078
41810
  alias: ["cpp"],
42079
41811
  extensions: ["cpp", "c++", "cc", "cxx", "hpp", "h++", "hh", "hxx"],
42080
41812
  load() {
42081
- return __vitePreload(() => import("./index-B7a6ecSB.js"), true ? [] : void 0, import.meta.url).then((m) => m.cpp());
41813
+ return __vitePreload(() => import("./index-C3jLCWOv.js"), true ? [] : void 0, import.meta.url).then((m) => m.cpp());
42082
41814
  }
42083
41815
  }),
42084
41816
  /* @__PURE__ */ LanguageDescription.of({
@@ -42100,7 +41832,7 @@ const languages = [
42100
41832
  name: "Go",
42101
41833
  extensions: ["go"],
42102
41834
  load() {
42103
- return __vitePreload(() => import("./index-B3xEpmeL.js"), true ? [] : void 0, import.meta.url).then((m) => m.go());
41835
+ return __vitePreload(() => import("./index-cLTU2RS5.js"), true ? [] : void 0, import.meta.url).then((m) => m.go());
42104
41836
  }
42105
41837
  }),
42106
41838
  /* @__PURE__ */ LanguageDescription.of({
@@ -42115,7 +41847,7 @@ const languages = [
42115
41847
  name: "Java",
42116
41848
  extensions: ["java"],
42117
41849
  load() {
42118
- return __vitePreload(() => import("./index-B-sTajw0.js"), true ? [] : void 0, import.meta.url).then((m) => m.java());
41850
+ return __vitePreload(() => import("./index-BXn8SSRO.js"), true ? [] : void 0, import.meta.url).then((m) => m.java());
42119
41851
  }
42120
41852
  }),
42121
41853
  /* @__PURE__ */ LanguageDescription.of({
@@ -42130,7 +41862,7 @@ const languages = [
42130
41862
  name: "Jinja",
42131
41863
  extensions: ["j2", "jinja", "jinja2"],
42132
41864
  load() {
42133
- return __vitePreload(() => import("./index-CFd49PzX.js"), true ? [] : void 0, import.meta.url).then((m) => m.jinja());
41865
+ return __vitePreload(() => import("./index-Du6z3bAn.js"), true ? [] : void 0, import.meta.url).then((m) => m.jinja());
42134
41866
  }
42135
41867
  }),
42136
41868
  /* @__PURE__ */ LanguageDescription.of({
@@ -42138,7 +41870,7 @@ const languages = [
42138
41870
  alias: ["json5"],
42139
41871
  extensions: ["json", "map"],
42140
41872
  load() {
42141
- return __vitePreload(() => import("./index-Cl38Mcu3.js"), true ? [] : void 0, import.meta.url).then((m) => m.json());
41873
+ return __vitePreload(() => import("./index-DtH-vuwI.js"), true ? [] : void 0, import.meta.url).then((m) => m.json());
42142
41874
  }
42143
41875
  }),
42144
41876
  /* @__PURE__ */ LanguageDescription.of({
@@ -42152,14 +41884,14 @@ const languages = [
42152
41884
  name: "LESS",
42153
41885
  extensions: ["less"],
42154
41886
  load() {
42155
- return __vitePreload(() => import("./index-WU2bjQIt.js"), true ? [] : void 0, import.meta.url).then((m) => m.less());
41887
+ return __vitePreload(() => import("./index-alRdsw6J.js"), true ? [] : void 0, import.meta.url).then((m) => m.less());
42156
41888
  }
42157
41889
  }),
42158
41890
  /* @__PURE__ */ LanguageDescription.of({
42159
41891
  name: "Liquid",
42160
41892
  extensions: ["liquid"],
42161
41893
  load() {
42162
- return __vitePreload(() => import("./index-BXMm6of_.js"), true ? [] : void 0, import.meta.url).then((m) => m.liquid());
41894
+ return __vitePreload(() => import("./index-CU4eUjnS.js"), true ? [] : void 0, import.meta.url).then((m) => m.liquid());
42163
41895
  }
42164
41896
  }),
42165
41897
  /* @__PURE__ */ LanguageDescription.of({
@@ -42191,7 +41923,7 @@ const languages = [
42191
41923
  name: "PHP",
42192
41924
  extensions: ["php", "php3", "php4", "php5", "php7", "phtml"],
42193
41925
  load() {
42194
- return __vitePreload(() => import("./index-BgaTyTt4.js"), true ? [] : void 0, import.meta.url).then((m) => m.php());
41926
+ return __vitePreload(() => import("./index-DjTtBl71.js"), true ? [] : void 0, import.meta.url).then((m) => m.php());
42195
41927
  }
42196
41928
  }),
42197
41929
  /* @__PURE__ */ LanguageDescription.of({
@@ -42212,28 +41944,28 @@ const languages = [
42212
41944
  extensions: ["BUILD", "bzl", "py", "pyw"],
42213
41945
  filename: /^(BUCK|BUILD)$/,
42214
41946
  load() {
42215
- return __vitePreload(() => import("./index-Cr5af8vL.js"), true ? [] : void 0, import.meta.url).then((m) => m.python());
41947
+ return __vitePreload(() => import("./index-QzYbuPVg.js"), true ? [] : void 0, import.meta.url).then((m) => m.python());
42216
41948
  }
42217
41949
  }),
42218
41950
  /* @__PURE__ */ LanguageDescription.of({
42219
41951
  name: "Rust",
42220
41952
  extensions: ["rs"],
42221
41953
  load() {
42222
- return __vitePreload(() => import("./index-DNKeYHeb.js"), true ? [] : void 0, import.meta.url).then((m) => m.rust());
41954
+ return __vitePreload(() => import("./index-9gnHkoK7.js"), true ? [] : void 0, import.meta.url).then((m) => m.rust());
42223
41955
  }
42224
41956
  }),
42225
41957
  /* @__PURE__ */ LanguageDescription.of({
42226
41958
  name: "Sass",
42227
41959
  extensions: ["sass"],
42228
41960
  load() {
42229
- return __vitePreload(() => import("./index-CizbQ4B2.js"), true ? [] : void 0, import.meta.url).then((m) => m.sass({ indented: true }));
41961
+ return __vitePreload(() => import("./index-BgSGixdO.js"), true ? [] : void 0, import.meta.url).then((m) => m.sass({ indented: true }));
42230
41962
  }
42231
41963
  }),
42232
41964
  /* @__PURE__ */ LanguageDescription.of({
42233
41965
  name: "SCSS",
42234
41966
  extensions: ["scss"],
42235
41967
  load() {
42236
- return __vitePreload(() => import("./index-CizbQ4B2.js"), true ? [] : void 0, import.meta.url).then((m) => m.sass());
41968
+ return __vitePreload(() => import("./index-BgSGixdO.js"), true ? [] : void 0, import.meta.url).then((m) => m.sass());
42237
41969
  }
42238
41970
  }),
42239
41971
  /* @__PURE__ */ LanguageDescription.of({
@@ -42268,7 +42000,7 @@ const languages = [
42268
42000
  name: "WebAssembly",
42269
42001
  extensions: ["wat", "wast"],
42270
42002
  load() {
42271
- return __vitePreload(() => import("./index-BUMCX36l.js"), true ? [] : void 0, import.meta.url).then((m) => m.wast());
42003
+ return __vitePreload(() => import("./index-B9mxJmxP.js"), true ? [] : void 0, import.meta.url).then((m) => m.wast());
42272
42004
  }
42273
42005
  }),
42274
42006
  /* @__PURE__ */ LanguageDescription.of({
@@ -42276,7 +42008,7 @@ const languages = [
42276
42008
  alias: ["rss", "wsdl", "xsd"],
42277
42009
  extensions: ["xml", "xsl", "xsd", "svg"],
42278
42010
  load() {
42279
- return __vitePreload(() => import("./index-9wJDFDHb.js"), true ? [] : void 0, import.meta.url).then((m) => m.xml());
42011
+ return __vitePreload(() => import("./index-Dz7ZQeU1.js"), true ? [] : void 0, import.meta.url).then((m) => m.xml());
42280
42012
  }
42281
42013
  }),
42282
42014
  /* @__PURE__ */ LanguageDescription.of({
@@ -42284,7 +42016,7 @@ const languages = [
42284
42016
  alias: ["yml"],
42285
42017
  extensions: ["yaml", "yml"],
42286
42018
  load() {
42287
- return __vitePreload(() => import("./index-j9IOhwim.js"), true ? [] : void 0, import.meta.url).then((m) => m.yaml());
42019
+ return __vitePreload(() => import("./index-CGWaYts7.js"), true ? [] : void 0, import.meta.url).then((m) => m.yaml());
42288
42020
  }
42289
42021
  }),
42290
42022
  // Legacy modes ported from CodeMirror 5
@@ -43073,13 +42805,13 @@ const languages = [
43073
42805
  name: "Vue",
43074
42806
  extensions: ["vue"],
43075
42807
  load() {
43076
- return __vitePreload(() => import("./index-CmCG8RWM.js"), true ? [] : void 0, import.meta.url).then((m) => m.vue());
42808
+ return __vitePreload(() => import("./index-CtO7mpP3.js"), true ? [] : void 0, import.meta.url).then((m) => m.vue());
43077
42809
  }
43078
42810
  }),
43079
42811
  /* @__PURE__ */ LanguageDescription.of({
43080
42812
  name: "Angular Template",
43081
42813
  load() {
43082
- return __vitePreload(() => import("./index-CX3eLmnK.js"), true ? [] : void 0, import.meta.url).then((m) => m.angular());
42814
+ return __vitePreload(() => import("./index-DDMRqKv0.js"), true ? [] : void 0, import.meta.url).then((m) => m.angular());
43083
42815
  }
43084
42816
  })
43085
42817
  ];
@@ -43415,6 +43147,573 @@ const cursorColors = [
43415
43147
  return classes.length ? { class: classes.join(" ") } : {};
43416
43148
  })
43417
43149
  ];
43150
+ const LAYOUT_RE = /^<!--\s*slide\s*:\s*([a-z][a-z0-9-]*)\b([\s\S]*?)-->$/;
43151
+ const DECK_BLOCK_RE = /^<!--\s*deck(?:\s+([\s\S]*?))?-->$/;
43152
+ const PAGE_FIELD_RE = /^([a-z][a-z0-9-]*)\s*:\s*(.+)$/;
43153
+ const PAGE_FIELD_KEYS = /* @__PURE__ */ new Set(["kicker", "label", "chapter"]);
43154
+ const DECK_FIELD_KEYS = /* @__PURE__ */ new Set(["logo", "brand", "title", "meta"]);
43155
+ const CSS_RE = /^<!--\s*slide-css\b\s*([\s\S]*?)-->$/;
43156
+ const JS_RE = /^<!--\s*slide-js\b\s*([\s\S]*?)-->$/;
43157
+ const PAGE_KEY_RE = /^<!--\s*slide-(kicker|label|chapter)\s*:\s*([\s\S]*?)-->$/;
43158
+ const DECK_RE = /^<!--\s*deck-(logo|brand|title|meta)\s*:\s*([\s\S]*?)-->$/;
43159
+ function inRange(range, at) {
43160
+ return at >= range.from && at < range.to;
43161
+ }
43162
+ function iterateContent(state, front, enter) {
43163
+ syntaxTree(state).iterate({
43164
+ enter: (node) => {
43165
+ if (front && node.name !== "Document" && inRange(front, node.from)) return false;
43166
+ return enter(node);
43167
+ }
43168
+ });
43169
+ }
43170
+ function pageOfLines(state, front) {
43171
+ const breaks = [];
43172
+ iterateContent(state, front, (node) => {
43173
+ if (node.name !== "HorizontalRule") return;
43174
+ breaks.push(state.doc.lineAt(node.from).number);
43175
+ });
43176
+ const pageOf = new Array(state.doc.lines);
43177
+ let page = 0;
43178
+ let nextBreak = 0;
43179
+ for (let n = 1; n <= state.doc.lines; n++) {
43180
+ pageOf[n - 1] = page;
43181
+ if (nextBreak < breaks.length && breaks[nextBreak] === n) {
43182
+ page++;
43183
+ nextBreak++;
43184
+ }
43185
+ }
43186
+ return pageOf;
43187
+ }
43188
+ function firstContentLines(state, pageOf, commentLines) {
43189
+ const first = /* @__PURE__ */ new Map();
43190
+ for (let n = 1; n <= state.doc.lines; n++) {
43191
+ const page = pageOf[n - 1];
43192
+ if (first.has(page)) continue;
43193
+ if (state.doc.line(n).text.trim() === "") continue;
43194
+ if (/^ {0,3}(?:---|\*\*\*|___)\s*$/.test(state.doc.line(n).text)) continue;
43195
+ if (commentLines.has(n)) continue;
43196
+ first.set(page, n);
43197
+ }
43198
+ return first;
43199
+ }
43200
+ function lineRange(fromLine, toLine) {
43201
+ const lines = [];
43202
+ for (let n = fromLine; n <= toLine; n++) lines.push(n);
43203
+ return lines;
43204
+ }
43205
+ function isNestedBlock(node) {
43206
+ let parent = node.node.parent;
43207
+ while (parent) {
43208
+ if (parent.name === "ListItem" || parent.name === "Blockquote" || parent.name === "Table") return true;
43209
+ parent = parent.parent;
43210
+ }
43211
+ return false;
43212
+ }
43213
+ function collectRoles(state, front, pageOf, directives) {
43214
+ const headings = /* @__PURE__ */ new Map();
43215
+ const paragraphs = /* @__PURE__ */ new Map();
43216
+ iterateContent(state, front, (node) => {
43217
+ const isHeading2 = /^ATXHeading[1-6]$/.test(node.name);
43218
+ if (!isHeading2 && node.name !== "Paragraph") return;
43219
+ if (isNestedBlock(node)) return;
43220
+ const fromLine = state.doc.lineAt(node.from).number;
43221
+ const toLine = state.doc.lineAt(Math.max(node.from, node.to - 1)).number;
43222
+ const page = pageOf[fromLine - 1];
43223
+ const range = { from: node.from, to: node.to, fromLine, toLine };
43224
+ if (isHeading2) {
43225
+ if (!headings.has(page)) headings.set(page, range);
43226
+ return;
43227
+ }
43228
+ const list = paragraphs.get(page);
43229
+ if (list) list.push(range);
43230
+ else paragraphs.set(page, [range]);
43231
+ });
43232
+ const roles = /* @__PURE__ */ new Map();
43233
+ for (const [page, heading2] of headings) {
43234
+ const paras = paragraphs.get(page) ?? [];
43235
+ const lead = paras.find((p) => p.from > heading2.to);
43236
+ const before = paras.filter((p) => p.to < heading2.from).pop();
43237
+ const role = {
43238
+ titleLines: lineRange(heading2.fromLine, heading2.toLine),
43239
+ leadLines: lead ? lineRange(lead.fromLine, lead.toLine) : [],
43240
+ kickerLines: []
43241
+ };
43242
+ const dirs = directives.get(page);
43243
+ if (!dirs?.kicker && before) {
43244
+ const text2 = state.doc.lineAt(before.from).text.trim();
43245
+ if (text2) {
43246
+ ensure(directives, page).kicker = text2;
43247
+ role.kickerLines = lineRange(before.fromLine, before.toLine);
43248
+ }
43249
+ }
43250
+ roles.set(page, role);
43251
+ }
43252
+ return roles;
43253
+ }
43254
+ function applyFields(source, keys2, apply) {
43255
+ for (const raw of source.split("\n")) {
43256
+ const line = raw.trim();
43257
+ if (!line) continue;
43258
+ const hit = PAGE_FIELD_RE.exec(line);
43259
+ if (!hit || !keys2.has(hit[1])) continue;
43260
+ const value = hit[2].replace(/-->\s*$/, "").trim();
43261
+ if (value) apply(hit[1], value);
43262
+ }
43263
+ }
43264
+ function scanSlideDirectives(state) {
43265
+ const text2 = state.doc.toString();
43266
+ const front = frontmatterRange(text2);
43267
+ const pageOf = pageOfLines(state, front);
43268
+ const directives = /* @__PURE__ */ new Map();
43269
+ const linesByPage = /* @__PURE__ */ new Map();
43270
+ const directiveLines = [];
43271
+ const deck = {};
43272
+ const comments = [];
43273
+ const commentLines = /* @__PURE__ */ new Set();
43274
+ for (let n = 1; n <= state.doc.lines; n++) {
43275
+ const page = pageOf[n - 1];
43276
+ const list = linesByPage.get(page);
43277
+ if (list) list.push(n);
43278
+ else linesByPage.set(page, [n]);
43279
+ }
43280
+ iterateContent(state, front, (node) => {
43281
+ if (node.name !== "CommentBlock" && node.name !== "HTMLBlock") return;
43282
+ const source = state.doc.sliceString(node.from, node.to).trim();
43283
+ if (!source.startsWith("<!--")) return;
43284
+ const fromLine = state.doc.lineAt(node.from).number;
43285
+ const toLine = state.doc.lineAt(Math.max(node.from, node.to - 1)).number;
43286
+ comments.push({ source, from: node.from, to: node.to, fromLine, toLine, page: pageOf[fromLine - 1] });
43287
+ for (let n = fromLine; n <= toLine; n++) commentLines.add(n);
43288
+ });
43289
+ const firstContent = firstContentLines(state, pageOf, commentLines);
43290
+ for (const comment2 of comments) {
43291
+ const { source, fromLine, toLine, page } = comment2;
43292
+ const layout2 = LAYOUT_RE.exec(source);
43293
+ if (layout2) {
43294
+ pushAll(directiveLines, fromLine, toLine);
43295
+ const content2 = firstContent.get(page);
43296
+ if (content2 === void 0 || fromLine < content2) {
43297
+ const dirs = ensure(directives, page);
43298
+ dirs.layout = layout2[1];
43299
+ applyFields(layout2[2], PAGE_FIELD_KEYS, (key, value) => {
43300
+ dirs[key] = value;
43301
+ });
43302
+ }
43303
+ continue;
43304
+ }
43305
+ const deckBlock = DECK_BLOCK_RE.exec(source);
43306
+ if (deckBlock) {
43307
+ pushAll(directiveLines, fromLine, toLine);
43308
+ applyFields(deckBlock[1] ?? "", DECK_FIELD_KEYS, (key, value) => {
43309
+ deck[key] = value;
43310
+ });
43311
+ continue;
43312
+ }
43313
+ const pageKey = PAGE_KEY_RE.exec(source);
43314
+ if (pageKey) {
43315
+ pushAll(directiveLines, fromLine, toLine);
43316
+ ensure(directives, page)[pageKey[1]] = pageKey[2].replace(/\s+/g, " ").trim();
43317
+ continue;
43318
+ }
43319
+ const deckHit = DECK_RE.exec(source);
43320
+ if (deckHit) {
43321
+ pushAll(directiveLines, fromLine, toLine);
43322
+ deck[deckHit[1]] = deckHit[2].trim();
43323
+ continue;
43324
+ }
43325
+ const css2 = CSS_RE.exec(source);
43326
+ if (css2) {
43327
+ pushAll(directiveLines, fromLine, toLine);
43328
+ ensure(directives, page).css.push(css2[1].trim());
43329
+ continue;
43330
+ }
43331
+ const js = JS_RE.exec(source);
43332
+ if (js) {
43333
+ pushAll(directiveLines, fromLine, toLine);
43334
+ ensure(directives, page).js.push(js[1].trim());
43335
+ }
43336
+ }
43337
+ const roles = collectRoles(state, front, pageOf, directives);
43338
+ return { directives, linesByPage, directiveLines, deck, roles };
43339
+ }
43340
+ function pushAll(lines, fromLine, toLine) {
43341
+ for (let n = fromLine; n <= toLine; n++) lines.push(n);
43342
+ }
43343
+ function ensure(map, page) {
43344
+ let dirs = map.get(page);
43345
+ if (!dirs) {
43346
+ dirs = { css: [], js: [] };
43347
+ map.set(page, dirs);
43348
+ }
43349
+ return dirs;
43350
+ }
43351
+ let snapshot = /* @__PURE__ */ new Map();
43352
+ let deckSnapshot = {};
43353
+ let pageCountSnapshot = 0;
43354
+ let documentBaseSnapshot = null;
43355
+ function publishSlideDirectives(directives) {
43356
+ snapshot = directives;
43357
+ }
43358
+ function getSlideDirectives() {
43359
+ return snapshot;
43360
+ }
43361
+ function publishDeckChrome(deck, pageCount) {
43362
+ deckSnapshot = deck;
43363
+ pageCountSnapshot = pageCount;
43364
+ }
43365
+ function getDeckChrome() {
43366
+ return deckSnapshot;
43367
+ }
43368
+ function getDeckPageCount() {
43369
+ return pageCountSnapshot;
43370
+ }
43371
+ function publishDocumentBase(url) {
43372
+ documentBaseSnapshot = url;
43373
+ }
43374
+ function getDocumentBase() {
43375
+ return documentBaseSnapshot;
43376
+ }
43377
+ const SAFE_PROPERTY = /* @__PURE__ */ new Set([
43378
+ "text-align",
43379
+ "text-decoration",
43380
+ "text-transform",
43381
+ "text-indent",
43382
+ "text-shadow",
43383
+ "text-underline-offset",
43384
+ "text-justify",
43385
+ "text-orientation",
43386
+ "text-rendering",
43387
+ "color",
43388
+ "opacity",
43389
+ "visibility",
43390
+ "filter",
43391
+ "backdrop-filter",
43392
+ "mix-blend-mode",
43393
+ "isolation",
43394
+ "background",
43395
+ "background-color",
43396
+ "background-image",
43397
+ "background-size",
43398
+ "background-position",
43399
+ "background-repeat",
43400
+ "background-clip",
43401
+ "background-origin",
43402
+ "background-blend-mode",
43403
+ "font",
43404
+ "font-size",
43405
+ "font-family",
43406
+ "font-weight",
43407
+ "font-style",
43408
+ "font-variant",
43409
+ "font-stretch",
43410
+ "line-height",
43411
+ "letter-spacing",
43412
+ "word-spacing",
43413
+ "white-space",
43414
+ "word-break",
43415
+ "overflow-wrap",
43416
+ "margin",
43417
+ "margin-top",
43418
+ "margin-right",
43419
+ "margin-bottom",
43420
+ "margin-left",
43421
+ "padding",
43422
+ "padding-top",
43423
+ "padding-right",
43424
+ "padding-bottom",
43425
+ "padding-left",
43426
+ "border",
43427
+ "border-top",
43428
+ "border-right",
43429
+ "border-bottom",
43430
+ "border-left",
43431
+ "border-width",
43432
+ "border-style",
43433
+ "border-color",
43434
+ "border-radius",
43435
+ "border-image",
43436
+ "border-top-width",
43437
+ "border-right-width",
43438
+ "border-bottom-width",
43439
+ "border-left-width",
43440
+ "border-top-color",
43441
+ "border-right-color",
43442
+ "border-bottom-color",
43443
+ "border-left-color",
43444
+ "border-top-style",
43445
+ "border-right-style",
43446
+ "border-bottom-style",
43447
+ "border-left-style",
43448
+ "border-top-left-radius",
43449
+ "border-top-right-radius",
43450
+ "border-bottom-left-radius",
43451
+ "border-bottom-right-radius",
43452
+ "outline",
43453
+ "outline-width",
43454
+ "outline-style",
43455
+ "outline-color",
43456
+ "outline-offset",
43457
+ "width",
43458
+ "height",
43459
+ "min-width",
43460
+ "min-height",
43461
+ "max-width",
43462
+ "max-height",
43463
+ "top",
43464
+ "right",
43465
+ "bottom",
43466
+ "left",
43467
+ "inset",
43468
+ "position",
43469
+ "display",
43470
+ "float",
43471
+ "clear",
43472
+ "vertical-align",
43473
+ "overflow",
43474
+ "clip",
43475
+ "flex",
43476
+ "flex-direction",
43477
+ "flex-wrap",
43478
+ "flex-flow",
43479
+ "flex-grow",
43480
+ "flex-shrink",
43481
+ "flex-basis",
43482
+ "order",
43483
+ "align-items",
43484
+ "align-self",
43485
+ "align-content",
43486
+ "justify-content",
43487
+ "justify-items",
43488
+ "justify-self",
43489
+ "gap",
43490
+ "row-gap",
43491
+ "column-gap",
43492
+ "place-items",
43493
+ "place-content",
43494
+ "place-self",
43495
+ "grid",
43496
+ "grid-area",
43497
+ "grid-template",
43498
+ "grid-template-columns",
43499
+ "grid-template-rows",
43500
+ "grid-template-areas",
43501
+ "grid-auto-columns",
43502
+ "grid-auto-rows",
43503
+ "grid-auto-flow",
43504
+ "grid-column",
43505
+ "grid-row",
43506
+ "grid-column-start",
43507
+ "grid-column-end",
43508
+ "grid-row-start",
43509
+ "grid-row-end",
43510
+ "columns",
43511
+ "column-count",
43512
+ "column-width",
43513
+ "column-gap",
43514
+ "column-rule",
43515
+ "column-fill",
43516
+ "column-span",
43517
+ "transform",
43518
+ "transform-origin",
43519
+ "transform-style",
43520
+ "perspective",
43521
+ "perspective-origin",
43522
+ "rotate",
43523
+ "scale",
43524
+ "translate",
43525
+ "animation",
43526
+ "animation-name",
43527
+ "animation-duration",
43528
+ "animation-timing-function",
43529
+ "animation-delay",
43530
+ "animation-iteration-count",
43531
+ "animation-direction",
43532
+ "animation-fill-mode",
43533
+ "animation-play-state",
43534
+ "transition",
43535
+ "transition-property",
43536
+ "transition-duration",
43537
+ "transition-timing-function",
43538
+ "transition-delay",
43539
+ "box-shadow",
43540
+ "clip-path",
43541
+ "object-fit",
43542
+ "object-position",
43543
+ "list-style",
43544
+ "list-style-type",
43545
+ "list-style-position",
43546
+ "list-style-image",
43547
+ "counter-reset",
43548
+ "counter-increment",
43549
+ "content",
43550
+ "quotes",
43551
+ "aspect-ratio",
43552
+ "box-sizing",
43553
+ "resize",
43554
+ "user-select",
43555
+ "pointer-events",
43556
+ "touch-action",
43557
+ "mask",
43558
+ "mask-image",
43559
+ "mask-size",
43560
+ "mask-position",
43561
+ "mask-repeat"
43562
+ ]);
43563
+ const UNSAFE_VALUE = /expression\s*\(|javascript\s*:|vbscript\s*:|data:text\/html|behavior\s*:/i;
43564
+ const UNSAFE_POSITION = /^(?:absolute|fixed)$/i;
43565
+ function safeDeclaration(raw) {
43566
+ const colon2 = raw.indexOf(":");
43567
+ if (colon2 <= 0) return null;
43568
+ const prop = raw.slice(0, colon2).trim().toLowerCase();
43569
+ const value = raw.slice(colon2 + 1).trim();
43570
+ if (!prop || !value) return null;
43571
+ if (!SAFE_PROPERTY.has(prop)) return null;
43572
+ if (UNSAFE_VALUE.test(value)) return null;
43573
+ if (prop === "position" && UNSAFE_POSITION.test(value)) return null;
43574
+ return `${prop}: ${value}`;
43575
+ }
43576
+ function scopeDeclarations(body) {
43577
+ const kept = [];
43578
+ for (const raw of body.split(";")) {
43579
+ if (!raw.trim()) continue;
43580
+ const safe = safeDeclaration(raw);
43581
+ if (safe) kept.push(safe);
43582
+ }
43583
+ return kept.join(";\n");
43584
+ }
43585
+ function scopeSlideCSS(css2, pageClass, guard) {
43586
+ const out = scopeBlock(css2.trim(), pageClass, guard, 0);
43587
+ return out.filter(Boolean).join("\n");
43588
+ }
43589
+ function scopeBlock(css2, pageClass, guard, depth) {
43590
+ if (depth > 8) return [];
43591
+ const out = [];
43592
+ let i = 0;
43593
+ while (i < css2.length) {
43594
+ const open2 = css2.indexOf("{", i);
43595
+ if (open2 === -1) break;
43596
+ const head = css2.slice(i, open2).trim();
43597
+ let level = 1;
43598
+ let close2 = open2 + 1;
43599
+ while (close2 < css2.length && level > 0) {
43600
+ const ch = css2[close2];
43601
+ if (ch === "{") level++;
43602
+ else if (ch === "}") level--;
43603
+ close2++;
43604
+ }
43605
+ if (level !== 0) return [];
43606
+ const body = css2.slice(open2 + 1, close2 - 1);
43607
+ i = close2;
43608
+ if (head.startsWith("@")) {
43609
+ const at = head.toLowerCase();
43610
+ if (at.startsWith("@media") || at.startsWith("@supports")) {
43611
+ const inner2 = scopeBlock(body, pageClass, guard, depth + 1);
43612
+ if (inner2.length > 0) out.push(`${head} {
43613
+ ${inner2.join("\n")}
43614
+ }`);
43615
+ } else if (at.startsWith("@keyframes") || at.startsWith("@counter-style")) {
43616
+ const kept2 = scopeKeyframes(body);
43617
+ if (kept2) out.push(`${head} {
43618
+ ${kept2}
43619
+ }`);
43620
+ }
43621
+ continue;
43622
+ }
43623
+ const selectors = head.split(",").map((s) => s.trim()).filter(Boolean).map((s) => `${guard} .${pageClass} ${s}`);
43624
+ const kept = scopeDeclarations(body);
43625
+ if (selectors.length > 0 && kept) {
43626
+ out.push(`${selectors.join(", ")} {
43627
+ ${kept}
43628
+ }`);
43629
+ }
43630
+ }
43631
+ return out;
43632
+ }
43633
+ function scopeKeyframes(body) {
43634
+ const out = [];
43635
+ let i = 0;
43636
+ while (i < body.length) {
43637
+ const open2 = body.indexOf("{", i);
43638
+ if (open2 === -1) break;
43639
+ const head = body.slice(i, open2).trim();
43640
+ const close2 = body.indexOf("}", open2);
43641
+ if (close2 === -1) return null;
43642
+ const kept = scopeDeclarations(body.slice(open2 + 1, close2));
43643
+ if (head && kept) out.push(`${head} {
43644
+ ${kept}
43645
+ }`);
43646
+ i = close2 + 1;
43647
+ }
43648
+ return out.length > 0 ? out.join("\n") : null;
43649
+ }
43650
+ const SLIDE_CLASS_PREFIX = "cm-md-slide-";
43651
+ const DIRECTIVE_CLASS = "cm-md-slide-directive";
43652
+ function layoutClass(name2) {
43653
+ return /^[a-z][a-z0-9-]*$/.test(name2) ? `${SLIDE_CLASS_PREFIX}${name2}` : null;
43654
+ }
43655
+ function buildDecorations(state) {
43656
+ const scan = scanSlideDirectives(state);
43657
+ publishSlideDirectives(scan.directives);
43658
+ publishDeckChrome(scan.deck, scan.linesByPage.size);
43659
+ publishDocumentBase(state.field(documentFileUrlField, false) ?? null);
43660
+ const specs = /* @__PURE__ */ new Map();
43661
+ const add = (from, cls, attrs) => {
43662
+ let spec = specs.get(from);
43663
+ if (!spec) {
43664
+ spec = { classes: /* @__PURE__ */ new Set(), attributes: {} };
43665
+ specs.set(from, spec);
43666
+ }
43667
+ if (cls) spec.classes.add(cls);
43668
+ if (attrs) Object.assign(spec.attributes, attrs);
43669
+ };
43670
+ for (const [page, dirs] of scan.directives) {
43671
+ if (!dirs.layout) continue;
43672
+ const cls = layoutClass(dirs.layout);
43673
+ if (!cls) continue;
43674
+ const lines = scan.linesByPage.get(page);
43675
+ if (!lines) continue;
43676
+ for (const n of lines) add(state.doc.line(n).from, cls);
43677
+ }
43678
+ for (const [page, lines] of scan.linesByPage) {
43679
+ if (scan.directives.get(page)?.layout) continue;
43680
+ for (const n of lines) add(state.doc.line(n).from, "cm-md-page-default");
43681
+ }
43682
+ for (const n of scan.directiveLines) add(state.doc.line(n).from, DIRECTIVE_CLASS);
43683
+ for (const [page, role] of scan.roles) {
43684
+ const kicker = scan.directives.get(page)?.kicker?.replace(/\s+/g, " ").trim();
43685
+ for (const n of role.titleLines) {
43686
+ const from = state.doc.line(n).from;
43687
+ add(from, "cm-md-page-title", kicker ? { "data-slide-kicker": kicker } : void 0);
43688
+ }
43689
+ for (const n of role.leadLines) add(state.doc.line(n).from, "cm-md-page-lead");
43690
+ for (const n of role.kickerLines) add(state.doc.line(n).from, "cm-md-page-kicker");
43691
+ }
43692
+ const builder = new RangeSetBuilder();
43693
+ const pending = [...specs.entries()].sort((a, b) => a[0] - b[0]);
43694
+ for (const [from, spec] of pending) {
43695
+ builder.add(
43696
+ from,
43697
+ from,
43698
+ Decoration.line({
43699
+ class: [...spec.classes].join(" "),
43700
+ attributes: Object.keys(spec.attributes).length > 0 ? spec.attributes : void 0
43701
+ })
43702
+ );
43703
+ }
43704
+ return builder.finish();
43705
+ }
43706
+ const slideLayoutField = StateField.define({
43707
+ create: (state) => buildDecorations(state),
43708
+ update: (_value, tr) => {
43709
+ if (!tr.docChanged && !tr.effects.some((effect) => effect.is(decorationsRefreshEffect))) {
43710
+ return _value;
43711
+ }
43712
+ return buildDecorations(tr.state);
43713
+ },
43714
+ provide: (field) => EditorView.decorations.from(field)
43715
+ });
43716
+ const slideLayout = [slideLayoutField];
43418
43717
  let handle$1 = null;
43419
43718
  function getEditorHandle() {
43420
43719
  return handle$1;
@@ -43459,6 +43758,9 @@ function editorExtensions(sourceMode, editable2, onChange) {
43459
43758
  // 「没改过的字节不许变」这条纪律。源码模式把它收起来,剩下的就是带 markdown
43460
43759
  // 语法高亮的原文(高亮在 state.ts 的 markdown 扩展里,跟模式无关)。
43461
43760
  livePreviewCompartment.of(sourceMode ? [] : livePreview),
43761
+ // 幻灯片版式:独立于 live-preview 的行装饰(slide-layout.ts),给声明了版式的
43762
+ // 页打 cm-md-slide-* 类。常驻安装:样式只在放映/导出时命中,平时零影响。
43763
+ slideLayout,
43462
43764
  // 焦点变化要重算装饰:只有**正在编辑**的那一行才显示源码(见 live-preview 的 setEditorFocus)。
43463
43765
  // 用 DOM 事件而不是 EditorView.focusChangeEffect,是因为后者在创建时就已带焦点的编辑器上
43464
43766
  // 不会触发;下面创建完 view 之后补了一次初始值。
@@ -44447,6 +44749,10 @@ function jumpToLine(line) {
44447
44749
  flashLine(view, target.from, target.to);
44448
44750
  }
44449
44751
  const MERMAID_FENCE = /^([ \t]*)```[ \t]*mermaid[ \t]*\r?\n([\s\S]*?)^\1```[ \t]*$/gm;
44752
+ function isDarkHex(hex) {
44753
+ const channel = (index2) => (Number.parseInt(hex.slice(index2, index2 + 2), 16) || 0) / 255;
44754
+ return 0.2126 * channel(0) + 0.7152 * channel(2) + 0.0722 * channel(4) < 0.5;
44755
+ }
44450
44756
  function mixSrgb(a, b, weightA) {
44451
44757
  const parse = (hex) => [0, 2, 4].map((index2) => Number.parseInt(hex.slice(index2, index2 + 2), 16) || 0);
44452
44758
  const [ra, ga, ba] = parse(a);
@@ -44455,8 +44761,9 @@ function mixSrgb(a, b, weightA) {
44455
44761
  return [mix(ra, rb), mix(ga, gb), mix(ba, bb)].map((value) => value.toString(16).padStart(2, "0")).join("").toUpperCase();
44456
44762
  }
44457
44763
  function diagramPrintPalette(style) {
44458
- const bg = style.codeBlockBackground;
44459
- const fg = style.codeBlockText;
44764
+ const darkCodeBlock = isDarkHex(style.codeBlockBackground);
44765
+ const bg = darkCodeBlock ? "FFFFFF" : style.codeBlockBackground;
44766
+ const fg = darkCodeBlock ? style.text : style.codeBlockText;
44460
44767
  return {
44461
44768
  "--pele-bg": `#${bg}`,
44462
44769
  "--pele-fg": `#${fg}`,
@@ -44502,6 +44809,7 @@ async function markdownForWord(markdown2, chinese, palette = diagramPrintPalette
44502
44809
  // 与 docx-style.ts 的 LIGHT 常量同源:没有样式令牌时(脚本/兜底场景)按浅色画。
44503
44810
  codeBlockBackground: "F6F8FA",
44504
44811
  codeBlockText: "24292F",
44812
+ text: "24292F",
44505
44813
  link: "0969DA"
44506
44814
  })) {
44507
44815
  const fences = [];
@@ -44741,10 +45049,11 @@ function readDocxStyle() {
44741
45049
  lineHeight: 1.75
44742
45050
  };
44743
45051
  }
44744
- const PRESENTING_CLASS = "presenting";
44745
- const RULE_STYLE_ID = "slideshow-rules";
45052
+ const PRESENTING_CLASS$1 = "presenting";
45053
+ const RULE_STYLE_ID$1 = "slideshow-rules";
44746
45054
  const DRAG_SLOP = 4;
44747
45055
  let presenting = false;
45056
+ let starting = false;
44748
45057
  let pages = [];
44749
45058
  let index = 0;
44750
45059
  let rules = null;
@@ -44773,6 +45082,9 @@ function pageNumbers(root) {
44773
45082
  const page = pageOfLine$1(line);
44774
45083
  if (page === null) continue;
44775
45084
  if (line.classList.contains("cm-md-hr")) continue;
45085
+ const text2 = (line.textContent ?? "").trim();
45086
+ const visual = line.querySelector("img, svg, .cm-md-mermaid, .cm-md-image, .katex");
45087
+ if (!text2 && !visual) continue;
44776
45088
  found.add(page);
44777
45089
  }
44778
45090
  return [...found].sort((a, b) => a - b);
@@ -44781,6 +45093,23 @@ function deckPages() {
44781
45093
  const root = documentRoot$1();
44782
45094
  return root ? pageNumbers(root) : [];
44783
45095
  }
45096
+ function tagBlockWidgets(root) {
45097
+ for (const child of Array.from(root.children)) {
45098
+ if (child.classList.contains("cm-line")) continue;
45099
+ for (const cls of Array.from(child.classList)) {
45100
+ if (cls.startsWith(PAGE_CLASS_PREFIX)) child.classList.remove(cls);
45101
+ }
45102
+ }
45103
+ let page = null;
45104
+ for (const child of Array.from(root.children)) {
45105
+ const own = Array.from(child.classList).find((cls) => cls.startsWith(PAGE_CLASS_PREFIX));
45106
+ if (own) {
45107
+ page = own;
45108
+ continue;
45109
+ }
45110
+ if (page) child.classList.add(page);
45111
+ }
45112
+ }
44784
45113
  function firstLineOf(page) {
44785
45114
  const root = documentRoot$1();
44786
45115
  if (!root) return null;
@@ -44799,7 +45128,7 @@ function pageAtCaret(root) {
44799
45128
  function applyPage() {
44800
45129
  if (!rules) return;
44801
45130
  const page = pages[index];
44802
- rules.textContent = `body.${PRESENTING_CLASS} #editor .cm-content > :not(.${PAGE_CLASS_PREFIX}${page}) { display: none !important; }
45131
+ rules.textContent = `body.${PRESENTING_CLASS$1} #editor .cm-content > :not(.${PAGE_CLASS_PREFIX}${page}) { display: none !important; }
44803
45132
  `;
44804
45133
  }
44805
45134
  function show(next) {
@@ -44875,13 +45204,26 @@ function onContextMenu(event) {
44875
45204
  event.stopPropagation();
44876
45205
  show(index - 1);
44877
45206
  }
44878
- function startSlideshow(next = {}) {
44879
- if (presenting) return true;
45207
+ async function startSlideshow(next = {}) {
45208
+ if (presenting || starting) return presenting;
45209
+ starting = true;
45210
+ try {
45211
+ return await beginSlideshow(next);
45212
+ } finally {
45213
+ starting = false;
45214
+ }
45215
+ }
45216
+ async function beginSlideshow(next = {}) {
44880
45217
  const editor = editorElement();
44881
45218
  const root = documentRoot$1();
44882
45219
  if (!editor || !root) return false;
45220
+ await renderWholeDocument();
45221
+ tagBlockWidgets(root);
44883
45222
  const deck = pageNumbers(root);
44884
- if (deck.length === 0) return false;
45223
+ if (deck.length === 0) {
45224
+ restoreViewport();
45225
+ return false;
45226
+ }
44885
45227
  pages = deck;
44886
45228
  options = next;
44887
45229
  index = pageAtCaret(root);
@@ -44891,10 +45233,10 @@ function startSlideshow(next = {}) {
44891
45233
  });
44892
45234
  watch.observe(root, { childList: true });
44893
45235
  rules = document.createElement("style");
44894
- rules.id = RULE_STYLE_ID;
45236
+ rules.id = RULE_STYLE_ID$1;
44895
45237
  document.head.appendChild(rules);
44896
45238
  applyPage();
44897
- document.body.classList.add(PRESENTING_CLASS);
45239
+ document.body.classList.add(PRESENTING_CLASS$1);
44898
45240
  layout();
44899
45241
  const scroll = scroller$1();
44900
45242
  if (scroll) scroll.scrollTop = 0;
@@ -44917,7 +45259,8 @@ function stopSlideshow() {
44917
45259
  window.removeEventListener("resize", layout);
44918
45260
  watch?.disconnect();
44919
45261
  watch = null;
44920
- document.body.classList.remove(PRESENTING_CLASS);
45262
+ restoreViewport();
45263
+ document.body.classList.remove(PRESENTING_CLASS$1);
44921
45264
  rules?.remove();
44922
45265
  rules = null;
44923
45266
  const editor = editorElement();
@@ -44937,12 +45280,11 @@ function stopSlideshow() {
44937
45280
  const PAGE_WIDTH_INCHES = 13.3333;
44938
45281
  const PAGE_HEIGHT_INCHES = 7.5;
44939
45282
  const PX_PER_INCH = 96;
44940
- const PAGE_WIDTH_PX = Math.round(PAGE_WIDTH_INCHES * PX_PER_INCH);
44941
45283
  const PAGE_HEIGHT_PX = Math.round(PAGE_HEIGHT_INCHES * PX_PER_INCH);
44942
- const COLUMN_EM = 38;
44943
- const FONT_SIZE_PX = 20;
45284
+ const FONT_SIZE_PX = 24;
45285
+ const PAGE_MARGIN_PX = 77;
44944
45286
  const SAFETY_PX = 4;
44945
- const PRINT_CLASS = "slides-printing";
45287
+ const PRINT_CLASS$1 = "slides-printing";
44946
45288
  const STYLE_ID = "slides-print-style";
44947
45289
  let sheetStyle = null;
44948
45290
  let restoreScrollTop = 0;
@@ -44957,37 +45299,39 @@ function pageOfLine(line) {
44957
45299
  return match ? Number(match[1]) : null;
44958
45300
  }
44959
45301
  function layoutRules(background) {
45302
+ const softened = `color-mix(in srgb, ${background} 95%, var(--pele-accent))`;
44960
45303
  return `/* The sheet is the page: what margins exist in here are the document's own. */
44961
- @page { size: ${PAGE_WIDTH_INCHES}in ${PAGE_HEIGHT_INCHES}in; margin: 0; background: ${background}; }
44962
- html, body { display: block !important; height: auto !important; overflow: visible !important; background: ${background} !important; }
44963
- body.${PRINT_CLASS} #editor {
45304
+ @page { size: ${PAGE_WIDTH_INCHES}in ${PAGE_HEIGHT_INCHES}in; margin: 0; background: ${background}; background: ${softened}; }
45305
+ html, body { display: block !important; height: auto !important; overflow: visible !important; background: ${background} !important; background: ${softened} !important; }
45306
+ body.${PRINT_CLASS$1} #editor {
44964
45307
  position: static !important;
44965
45308
  inset: auto !important;
44966
45309
  height: auto !important;
44967
45310
  overflow: visible !important;
44968
45311
  padding: 0 !important;
44969
45312
  background: ${background} !important;
45313
+ background: ${softened} !important;
44970
45314
  }
44971
45315
  /* 纸是普通的块流:CM6 的编辑器/滚动容器都是 flex 或 auto 高度,强制断开的分页在
44972
45316
  它们里面不会生效,所以这里把它们摊平成块。 */
44973
- body.${PRINT_CLASS} #editor .cm-editor { height: auto !important; }
44974
- body.${PRINT_CLASS} #editor .cm-scroller { display: block !important; height: auto !important; overflow: visible !important; }
44975
- body.${PRINT_CLASS} #editor .cm-content {
45317
+ body.${PRINT_CLASS$1} #editor .cm-editor { height: auto !important; }
45318
+ body.${PRINT_CLASS$1} #editor .cm-scroller { display: block !important; height: auto !important; overflow: visible !important; }
45319
+ body.${PRINT_CLASS$1} #editor .cm-content {
44976
45320
  display: block !important;
44977
- width: min(${COLUMN_EM}em, ${Math.round(PAGE_WIDTH_PX * 0.86)}px) !important;
45321
+ width: auto !important;
44978
45322
  max-width: none !important;
44979
- margin: 0 auto !important;
44980
- padding: 0 !important;
45323
+ margin: 0 !important;
45324
+ padding: 0 ${PAGE_MARGIN_PX}px !important;
44981
45325
  font-size: ${FONT_SIZE_PX}px !important;
44982
- line-height: 1.6;
45326
+ line-height: 1.7;
44983
45327
  }
44984
45328
  /* 分隔线是分页边界,不是正文里的一行。 */
44985
- body.${PRINT_CLASS} #editor .cm-line.cm-md-hr { display: none !important; }
45329
+ body.${PRINT_CLASS$1} #editor .cm-line.cm-md-hr { display: none !important; }
44986
45330
  /* Nothing may be cut off at the sheet's edge: code and cells wrap, a diagram or
44987
45331
  a photo shrinks to fit the page it landed on. */
44988
- body.${PRINT_CLASS} #editor .cm-md-codeblock { white-space: pre-wrap !important; overflow-wrap: anywhere !important; }
44989
- body.${PRINT_CLASS} #editor .cm-md-table-widget th, body.${PRINT_CLASS} #editor .cm-md-table-widget td { overflow-wrap: anywhere !important; word-break: break-word !important; }
44990
- body.${PRINT_CLASS} #editor img, body.${PRINT_CLASS} #editor svg { max-height: ${Math.round(PAGE_HEIGHT_PX * 0.72)}px; }
45332
+ body.${PRINT_CLASS$1} #editor .cm-md-codeblock { white-space: pre-wrap !important; overflow-wrap: anywhere !important; }
45333
+ body.${PRINT_CLASS$1} #editor .cm-md-table-widget th, body.${PRINT_CLASS$1} #editor .cm-md-table-widget td { overflow-wrap: anywhere !important; word-break: break-word !important; }
45334
+ body.${PRINT_CLASS$1} #editor img, body.${PRINT_CLASS$1} #editor svg { max-height: ${Math.round(PAGE_HEIGHT_PX * 0.72)}px; }
44991
45335
  `;
44992
45336
  }
44993
45337
  async function enterPrintLayout$1() {
@@ -44999,11 +45343,12 @@ async function enterPrintLayout$1() {
44999
45343
  sheet.id = STYLE_ID;
45000
45344
  sheet.textContent = layoutRules(background);
45001
45345
  document.head.appendChild(sheet);
45002
- document.body.classList.add(PRINT_CLASS);
45346
+ document.body.classList.add(PRINT_CLASS$1);
45003
45347
  sheetStyle = sheet;
45004
45348
  restoreScrollTop = scroller()?.scrollTop ?? 0;
45005
45349
  root.getBoundingClientRect();
45006
45350
  await renderWholeDocument();
45351
+ tagBlockWidgets(root);
45007
45352
  const deck = deckPages();
45008
45353
  if (deck.length === 0) {
45009
45354
  exitPrintLayout();
@@ -45020,11 +45365,13 @@ async function enterPrintLayout$1() {
45020
45365
  const ownMargin = parseFloat(getComputedStyle(first).marginTop);
45021
45366
  const owned = last2.getBoundingClientRect().bottom - first.getBoundingClientRect().top;
45022
45367
  const used = owned + (Number.isFinite(ownMargin) ? ownMargin : 0);
45023
- const above = Math.max(0, Math.floor((PAGE_HEIGHT_PX - SAFETY_PX - used) / 2));
45368
+ const layout2 = getSlideDirectives().get(page)?.layout;
45369
+ const hero = layout2 === "cover" || layout2 === "section" || layout2 === "closing" || layout2 === "quote";
45370
+ const above = hero ? Math.max(0, Math.floor((PAGE_HEIGHT_PX - SAFETY_PX - used) / 2)) : 0;
45024
45371
  const target = `.cm-content > .${PAGE_CLASS_PREFIX}${page}.${PAGE_START_CLASS}`;
45025
- if (order > 0) rules2.push(`body.${PRINT_CLASS} #editor ${target} { break-before: page; }`);
45372
+ if (order > 0) rules2.push(`body.${PRINT_CLASS$1} #editor ${target} { break-before: page; }`);
45026
45373
  if (above > 0) {
45027
- rules2.push(`body.${PRINT_CLASS} #editor ${target}::before { content: ''; display: block; height: ${above}px; }`);
45374
+ rules2.push(`body.${PRINT_CLASS$1} #editor ${target}::before { content: ''; display: block; height: ${above}px; }`);
45028
45375
  }
45029
45376
  });
45030
45377
  sheet.textContent = layoutRules(background) + rules2.join("\n") + "\n";
@@ -45035,7 +45382,7 @@ function exitPrintLayout() {
45035
45382
  if (!sheetStyle) return;
45036
45383
  sheetStyle.remove();
45037
45384
  sheetStyle = null;
45038
- document.body.classList.remove(PRINT_CLASS);
45385
+ document.body.classList.remove(PRINT_CLASS$1);
45039
45386
  const scroll = scroller();
45040
45387
  if (scroll) scroll.scrollTop = restoreScrollTop;
45041
45388
  }
@@ -45274,10 +45621,10 @@ function applyTheme(name2, customCSS) {
45274
45621
  window.electronAPI?.reportTheme?.(name2);
45275
45622
  const bar = document.getElementById("titlebar");
45276
45623
  if (bar) {
45277
- const surface = getComputedStyle(bar).backgroundColor;
45624
+ const surface2 = getComputedStyle(bar).backgroundColor;
45278
45625
  const iconEl = document.getElementById("file-toggle-btn") ?? document.body;
45279
45626
  const icon = getComputedStyle(iconEl).color;
45280
- const surfaceHex = painted(surface, "#ffffff");
45627
+ const surfaceHex = painted(surface2, "#ffffff");
45281
45628
  window.electronAPI?.reportTitlebarColors?.({ background: surfaceHex, symbol: painted(icon, surfaceHex) });
45282
45629
  }
45283
45630
  window.dispatchEvent(new CustomEvent("colamd:theme-applied"));
@@ -45553,6 +45900,302 @@ function showFontSettingsModal() {
45553
45900
  });
45554
45901
  familyInput.focus();
45555
45902
  }
45903
+ const PRESENTING_CLASS = "presenting";
45904
+ const PRINT_CLASS = "slides-printing";
45905
+ const RULE_STYLE_ID = "slideshow-rules";
45906
+ const PAGE_CSS_ID = "slideshow-page-css";
45907
+ const PRINT_CSS_ID = "slides-page-css";
45908
+ const PAGE_IN_RULES = /cm-md-page-(\d+)/;
45909
+ function surface() {
45910
+ return document.getElementById("editor");
45911
+ }
45912
+ const SAFE_NAME = /^[a-zA-Z][a-zA-Z0-9-]*$/;
45913
+ let active = false;
45914
+ let printing = false;
45915
+ let currentPage = 0;
45916
+ let pageStyle = null;
45917
+ let printStyle = null;
45918
+ let host = null;
45919
+ let hostUrl = null;
45920
+ const appliedClasses = /* @__PURE__ */ new Set();
45921
+ const appliedVars = /* @__PURE__ */ new Set();
45922
+ let initialized = false;
45923
+ function initSlidesEnhance() {
45924
+ if (initialized) return;
45925
+ initialized = true;
45926
+ const onBodyClass = () => {
45927
+ const presenting2 = document.body.classList.contains(PRESENTING_CLASS);
45928
+ if (presenting2 && !active) enterPresentation();
45929
+ if (!presenting2 && active) exitPresentation();
45930
+ const printingNow = document.body.classList.contains(PRINT_CLASS);
45931
+ if (printingNow && !printing) mountPrintCss();
45932
+ if (!printingNow && printing) unmountPrintCss();
45933
+ };
45934
+ new MutationObserver(onBodyClass).observe(document.body, {
45935
+ attributes: true,
45936
+ attributeFilter: ["class"],
45937
+ childList: true,
45938
+ subtree: true
45939
+ });
45940
+ onBodyClass();
45941
+ }
45942
+ let pageWatcher = null;
45943
+ function watchRuleStyle() {
45944
+ pageWatcher?.disconnect();
45945
+ pageWatcher = null;
45946
+ const rules2 = document.getElementById(RULE_STYLE_ID);
45947
+ if (!rules2) return;
45948
+ syncPageFrom(rules2.textContent);
45949
+ pageWatcher = new MutationObserver(() => syncPageFrom(rules2.textContent));
45950
+ pageWatcher.observe(rules2, { characterData: true, childList: true, subtree: true });
45951
+ }
45952
+ function syncPageFrom(text2) {
45953
+ const found = text2?.match(PAGE_IN_RULES);
45954
+ if (!found) return;
45955
+ const page = Number(found[1]);
45956
+ if (page === currentPage) return;
45957
+ currentPage = page;
45958
+ if (active) applyCurrentPage();
45959
+ }
45960
+ function enterPresentation() {
45961
+ active = true;
45962
+ pageStyle = document.createElement("style");
45963
+ pageStyle.id = PAGE_CSS_ID;
45964
+ document.head.appendChild(pageStyle);
45965
+ watchRuleStyle();
45966
+ applyCurrentPage();
45967
+ }
45968
+ function exitPresentation() {
45969
+ active = false;
45970
+ pageWatcher?.disconnect();
45971
+ pageWatcher = null;
45972
+ pageStyle?.remove();
45973
+ pageStyle = null;
45974
+ teardownHost();
45975
+ resetApplied();
45976
+ surface()?.removeAttribute("data-slide-layout");
45977
+ }
45978
+ function applyCurrentPage() {
45979
+ const dirs = getSlideDirectives().get(currentPage);
45980
+ if (pageStyle) {
45981
+ const css2 = (dirs?.css ?? []).map((block) => scopeSlideCSS(block, `${PAGE_CLASS_PREFIX}${currentPage}`, `body.${PRESENTING_CLASS} #editor`));
45982
+ pageStyle.textContent = css2.join("\n");
45983
+ }
45984
+ syncChrome();
45985
+ const name2 = dirs?.layout ?? "";
45986
+ const surface_ = surface();
45987
+ if (surface_) {
45988
+ if (name2 && SAFE_NAME.test(name2)) surface_.dataset.slideLayout = name2;
45989
+ else surface_.removeAttribute("data-slide-layout");
45990
+ }
45991
+ teardownHost();
45992
+ resetApplied();
45993
+ const js = dirs?.js.join("\n;\n");
45994
+ if (js) mountHost(js);
45995
+ }
45996
+ let chrome = null;
45997
+ let chromeLogo = null;
45998
+ let foot = null;
45999
+ let ghost = null;
46000
+ function ensureChromeDom() {
46001
+ if (chrome && foot && ghost) return;
46002
+ chrome = document.createElement("div");
46003
+ chrome.id = "slideshow-chrome";
46004
+ chrome.className = "slide-chrome";
46005
+ chrome.setAttribute("aria-hidden", "true");
46006
+ const left = document.createElement("div");
46007
+ left.className = "slide-chrome-left";
46008
+ const right = document.createElement("div");
46009
+ right.className = "slide-chrome-right";
46010
+ chrome.append(left, right);
46011
+ foot = document.createElement("div");
46012
+ foot.id = "slideshow-foot";
46013
+ foot.className = "slide-foot";
46014
+ foot.setAttribute("aria-hidden", "true");
46015
+ ghost = document.createElement("div");
46016
+ ghost.className = "slide-ghost";
46017
+ ghost.setAttribute("aria-hidden", "true");
46018
+ document.body.append(chrome, foot, ghost);
46019
+ }
46020
+ const pad2 = (n) => String(n).padStart(2, "0");
46021
+ function resolveAsset(raw) {
46022
+ const value = raw.trim().replace(/^<|>$/g, "");
46023
+ if (/^(?:https?:|file:|data:|blob:)/i.test(value)) return value;
46024
+ const base2 = getDocumentBase();
46025
+ if (!base2) return value;
46026
+ try {
46027
+ return new URL(value.replaceAll("\\", "/"), base2).href;
46028
+ } catch {
46029
+ return value;
46030
+ }
46031
+ }
46032
+ function syncChrome() {
46033
+ ensureChromeDom();
46034
+ const deck = getDeckChrome();
46035
+ const dirs = getSlideDirectives().get(currentPage);
46036
+ const pages2 = deckPages();
46037
+ const total = Math.max(pages2.length || getDeckPageCount(), 1);
46038
+ const at = pages2.indexOf(currentPage);
46039
+ const ordinal = at >= 0 ? at + 1 : currentPage + 1;
46040
+ const label = (printing ? deck.title : dirs?.label || deck.title) ?? "";
46041
+ const chapter = (printing ? deck.meta : dirs?.chapter || deck.meta) ?? "";
46042
+ const left = chrome.firstElementChild;
46043
+ const right = chrome.lastElementChild;
46044
+ left.textContent = "";
46045
+ right.textContent = "";
46046
+ if (deck.logo) {
46047
+ if (!chromeLogo) {
46048
+ chromeLogo = document.createElement("img");
46049
+ chromeLogo.className = "slide-chrome-logo";
46050
+ chromeLogo.alt = "";
46051
+ }
46052
+ chromeLogo.src = resolveAsset(deck.logo);
46053
+ left.appendChild(chromeLogo);
46054
+ } else {
46055
+ chromeLogo = null;
46056
+ }
46057
+ if (label) {
46058
+ const t2 = document.createElement("span");
46059
+ t2.className = "slide-chrome-title";
46060
+ t2.textContent = label;
46061
+ left.appendChild(t2);
46062
+ }
46063
+ if (chapter) {
46064
+ const m = document.createElement("span");
46065
+ m.className = "slide-chrome-meta";
46066
+ m.textContent = chapter;
46067
+ right.appendChild(m);
46068
+ }
46069
+ chrome.style.display = deck.logo || label || chapter ? "" : "none";
46070
+ foot.textContent = "";
46071
+ if (deck.brand) {
46072
+ const b = document.createElement("span");
46073
+ b.className = "slide-foot-brand";
46074
+ b.textContent = deck.brand;
46075
+ foot.appendChild(b);
46076
+ }
46077
+ const num = document.createElement("span");
46078
+ num.className = "slide-foot-num";
46079
+ num.textContent = `${pad2(ordinal)} / ${pad2(total)}`;
46080
+ foot.appendChild(num);
46081
+ ghost.textContent = pad2(ordinal);
46082
+ }
46083
+ function newToken() {
46084
+ return Math.random().toString(36).slice(2) + Date.now().toString(36);
46085
+ }
46086
+ let bridgeToken = "";
46087
+ function bootHtml(token) {
46088
+ return `<!doctype html><html><body><script>
46089
+ (function () {
46090
+ var TOKEN = ${JSON.stringify(token)};
46091
+ var slide = {
46092
+ setClass: function (name, value) {
46093
+ parent.postMessage({ __colamdSlide: 1, token: TOKEN, kind: 'class', name: name, value: value }, '*');
46094
+ },
46095
+ setVar: function (name, value) {
46096
+ parent.postMessage({ __colamdSlide: 1, token: TOKEN, kind: 'var', name: name, value: value }, '*');
46097
+ },
46098
+ setTimeout: function (fn, ms) { return setTimeout(fn, ms); },
46099
+ requestAnimationFrame: function (fn) { return requestAnimationFrame(fn); }
46100
+ };
46101
+ window.addEventListener('message', function (event) {
46102
+ var data = event.data;
46103
+ if (!data || data.__colamdSlideRun !== 1 || data.token !== TOKEN) return;
46104
+ try { (new Function('slide', data.code))(slide); }
46105
+ catch (err) { console.warn('[slide-js]', err); }
46106
+ });
46107
+ parent.postMessage({ __colamdSlide: 1, token: TOKEN, ready: true }, '*');
46108
+ })();
46109
+ <\/script></body></html>`;
46110
+ }
46111
+ function mountHost(code) {
46112
+ const target = surface();
46113
+ if (!target) return;
46114
+ bridgeToken = newToken();
46115
+ const html2 = bootHtml(bridgeToken);
46116
+ const blob = new Blob([html2], { type: "text/html" });
46117
+ hostUrl = URL.createObjectURL(blob);
46118
+ host = document.createElement("iframe");
46119
+ host.setAttribute("sandbox", "allow-scripts");
46120
+ host.setAttribute("aria-hidden", "true");
46121
+ host.title = "slide script host";
46122
+ host.style.display = "none";
46123
+ host.src = hostUrl;
46124
+ pendingCode = code;
46125
+ window.addEventListener("message", onBridgeMessage);
46126
+ target.appendChild(host);
46127
+ }
46128
+ let pendingCode = "";
46129
+ function teardownHost() {
46130
+ window.removeEventListener("message", onBridgeMessage);
46131
+ if (host) {
46132
+ host.remove();
46133
+ host = null;
46134
+ }
46135
+ if (hostUrl) {
46136
+ URL.revokeObjectURL(hostUrl);
46137
+ hostUrl = null;
46138
+ }
46139
+ pendingCode = "";
46140
+ }
46141
+ function onBridgeMessage(event) {
46142
+ const data2 = event.data;
46143
+ if (!data2 || data2.__colamdSlide !== 1 || data2.token !== bridgeToken) return;
46144
+ if (event.source !== host?.contentWindow) return;
46145
+ if (data2.ready) {
46146
+ host?.contentWindow?.postMessage({ __colamdSlideRun: 1, token: bridgeToken, code: pendingCode }, "*");
46147
+ return;
46148
+ }
46149
+ if (data2.kind === "class") applyClass(String(data2.name ?? ""), Boolean(data2.value));
46150
+ if (data2.kind === "var") applyVar(String(data2.name ?? ""), data2.value);
46151
+ }
46152
+ function applyClass(name2, value) {
46153
+ if (!SAFE_NAME.test(name2)) return;
46154
+ const surface_ = surface();
46155
+ if (!surface_) return;
46156
+ const cls = `slide-${name2}`;
46157
+ surface_.classList.toggle(cls, value);
46158
+ if (value) appliedClasses.add(cls);
46159
+ else appliedClasses.delete(cls);
46160
+ }
46161
+ function applyVar(name2, value) {
46162
+ if (!SAFE_NAME.test(name2)) return;
46163
+ const surface_ = surface();
46164
+ if (!surface_) return;
46165
+ const prop = `--slide-${name2}`;
46166
+ surface_.style.setProperty(prop, String(value));
46167
+ appliedVars.add(prop);
46168
+ }
46169
+ function resetApplied() {
46170
+ const surface_ = surface();
46171
+ if (surface_) {
46172
+ for (const cls of appliedClasses) surface_.classList.remove(cls);
46173
+ for (const prop of appliedVars) surface_.style.removeProperty(prop);
46174
+ }
46175
+ appliedClasses.clear();
46176
+ appliedVars.clear();
46177
+ }
46178
+ function mountPrintCss() {
46179
+ printing = true;
46180
+ const rules2 = [];
46181
+ for (const [page, dirs] of getSlideDirectives()) {
46182
+ for (const block of dirs.css) {
46183
+ rules2.push(scopeSlideCSS(block, `${PAGE_CLASS_PREFIX}${page}`, `body.${PRINT_CLASS} #editor`));
46184
+ }
46185
+ }
46186
+ printStyle = document.createElement("style");
46187
+ printStyle.id = PRINT_CSS_ID;
46188
+ printStyle.textContent = rules2.join("\n");
46189
+ document.head.appendChild(printStyle);
46190
+ syncChrome();
46191
+ }
46192
+ function unmountPrintCss() {
46193
+ printing = false;
46194
+ printStyle?.remove();
46195
+ printStyle = null;
46196
+ }
46197
+ if (document.body) initSlidesEnhance();
46198
+ else document.addEventListener("DOMContentLoaded", initSlidesEnhance, { once: true });
45556
46199
  /*! Capacitor: https://capacitorjs.com/ - MIT License */
45557
46200
  const createCapacitorPlatforms = (win) => {
45558
46201
  const defaultPlatformMap = /* @__PURE__ */ new Map();
@@ -46154,7 +46797,15 @@ function enterPrintLayout() {
46154
46797
  overflow: "visible"
46155
46798
  });
46156
46799
  override("#editor, .cm-editor, .cm-scroller", { height: "auto", overflow: "visible" });
46157
- return () => undo2.forEach(({ el, cssText }) => el.style.cssText = cssText);
46800
+ const zoomStyle = document.createElement("style");
46801
+ zoomStyle.textContent = ".pele-zoom { display: none !important; }";
46802
+ document.head.append(zoomStyle);
46803
+ const restoreZoom = pauseDiagramZoom();
46804
+ return () => {
46805
+ restoreZoom();
46806
+ zoomStyle.remove();
46807
+ undo2.forEach(({ el, cssText }) => el.style.cssText = cssText);
46808
+ };
46158
46809
  }
46159
46810
  function exportBaseName() {
46160
46811
  const title = (document.title || "").trim();
@@ -46166,13 +46817,14 @@ function isChinese() {
46166
46817
  }
46167
46818
  function defaultBaseName() {
46168
46819
  const d = /* @__PURE__ */ new Date();
46169
- const pad2 = (n) => String(n).padStart(2, "0");
46170
- const stamp = `${d.getFullYear()}${pad2(d.getMonth() + 1)}${pad2(d.getDate())}-${pad2(d.getHours())}${pad2(d.getMinutes())}${pad2(d.getSeconds())}`;
46820
+ const pad3 = (n) => String(n).padStart(2, "0");
46821
+ const stamp = `${d.getFullYear()}${pad3(d.getMonth() + 1)}${pad3(d.getDate())}-${pad3(d.getHours())}${pad3(d.getMinutes())}${pad3(d.getSeconds())}`;
46171
46822
  return `${isChinese() ? "未命名" : "Untitled"}-${stamp}`;
46172
46823
  }
46173
46824
  function escapeHTML(value) {
46174
46825
  return value.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;");
46175
46826
  }
46827
+ const PRINT_FALLBACK_TIMEOUT_MS = 18e4;
46176
46828
  async function shareFile(f, path2, title) {
46177
46829
  try {
46178
46830
  const uri = await f.Filesystem.getUri({ path: path2, directory: f.Directory.Documents });
@@ -46185,11 +46837,11 @@ async function capModule(name2) {
46185
46837
  try {
46186
46838
  switch (name2) {
46187
46839
  case "@capacitor/filesystem":
46188
- return await __vitePreload(() => import("./index-C5S7E_iS.js"), true ? [] : void 0, import.meta.url);
46840
+ return await __vitePreload(() => import("./index-gvL3lkzR.js"), true ? [] : void 0, import.meta.url);
46189
46841
  case "@capacitor/share":
46190
- return await __vitePreload(() => import("./index-DurJ4oOc.js"), true ? [] : void 0, import.meta.url);
46842
+ return await __vitePreload(() => import("./index-CwH04Tq_.js"), true ? [] : void 0, import.meta.url);
46191
46843
  case "@capacitor/app":
46192
- return await __vitePreload(() => import("./index-BQRkI4XZ.js"), true ? [] : void 0, import.meta.url);
46844
+ return await __vitePreload(() => import("./index-BpqOaUd_.js"), true ? [] : void 0, import.meta.url);
46193
46845
  default:
46194
46846
  return null;
46195
46847
  }
@@ -46300,38 +46952,46 @@ function createCapacitorAPI() {
46300
46952
  const bridge = nativeBridge();
46301
46953
  if (!bridge) return false;
46302
46954
  const restore = enterPrintLayout();
46955
+ setCleanExport(true);
46303
46956
  try {
46957
+ await renderWholeDocument();
46304
46958
  await new Promise((resolve) => {
46305
46959
  requestAnimationFrame(() => requestAnimationFrame(() => resolve()));
46306
46960
  });
46961
+ const finishedP = callNative("printDocument");
46307
46962
  bridge.printDocument(exportBaseName());
46963
+ await Promise.race([
46964
+ finishedP,
46965
+ new Promise((resolve) => setTimeout(() => resolve(null), PRINT_FALLBACK_TIMEOUT_MS))
46966
+ ]);
46308
46967
  return true;
46309
46968
  } finally {
46310
- setTimeout(restore, 3e3);
46969
+ restore();
46970
+ setCleanExport(false);
46311
46971
  }
46312
46972
  },
46313
- exportHTML: async (snapshot) => {
46973
+ exportHTML: async (snapshot2) => {
46314
46974
  const f = await fs();
46315
46975
  if (!f) return false;
46316
46976
  const base2 = exportBaseName().replace(/[\\/:*?"<>|]/g, "_");
46317
46977
  const fileName = `${base2}-${Date.now()}.html`;
46318
46978
  const target = `${DOCS_DIR}/exports/${fileName}`;
46319
46979
  const title = escapeHTML(base2);
46320
- const renderedContent = snapshot.document || snapshot.html || `<pre>${escapeHTML(snapshot.content)}</pre>`;
46980
+ const renderedContent = snapshot2.document || snapshot2.html || `<pre>${escapeHTML(snapshot2.content)}</pre>`;
46321
46981
  const documentHTML = `<!doctype html>
46322
46982
  <html lang="zh-CN">
46323
46983
  <head>
46324
46984
  <meta charset="UTF-8">
46325
46985
  <meta name="viewport" content="width=device-width, initial-scale=1">
46326
46986
  <title>${title}</title>
46327
- <style>${snapshot.styles || ""}
46987
+ <style>${snapshot2.styles || ""}
46328
46988
  html, body { height: auto; overflow: visible; }
46329
46989
  body { min-width: 320px; }
46330
46990
  #titlebar, #file-panel { display: none !important; }
46331
46991
  #editor { height: auto !important; min-height: 100vh; overflow: visible !important; padding: 0 !important; }
46332
46992
  </style>
46333
46993
  </head>
46334
- <body class="${escapeHTML(snapshot.bodyClass || "")}">
46994
+ <body class="${escapeHTML(snapshot2.bodyClass || "")}">
46335
46995
  <article class="colamd-document">${renderedContent}</article>
46336
46996
  </body>
46337
46997
  </html>
@@ -46999,8 +47659,8 @@ function renderTabBar() {
46999
47659
  add.addEventListener("mouseenter", () => scheduleTip(add, isChinese$1() ? "新建标签页 · ⌘T" : "New tab · ⌘T", "below", TAB_TIP_DELAY));
47000
47660
  add.addEventListener("mouseleave", hideTip);
47001
47661
  bar.after(add);
47002
- const active = bar.querySelector(".tab-entry.active");
47003
- active?.scrollIntoView({ block: "nearest", inline: "nearest" });
47662
+ const active2 = bar.querySelector(".tab-entry.active");
47663
+ active2?.scrollIntoView({ block: "nearest", inline: "nearest" });
47004
47664
  window.electronAPI.setTabFiles(tabs.map((tab) => tab.filePath).filter((path2) => !!path2));
47005
47665
  }
47006
47666
  function showBlankDocument() {
@@ -47551,8 +48211,8 @@ function applyOutlineActive() {
47551
48211
  buttons.forEach((button, index2) => {
47552
48212
  button.classList.toggle("active", index2 === outlineActiveIndex);
47553
48213
  });
47554
- const active = buttons[outlineActiveIndex];
47555
- if (active) revealOutlineEntry(active);
48214
+ const active2 = buttons[outlineActiveIndex];
48215
+ if (active2) revealOutlineEntry(active2);
47556
48216
  }
47557
48217
  function revealOutlineEntry(button) {
47558
48218
  const panel = filePanelEl();
@@ -47909,7 +48569,7 @@ async function toggleSlideshow() {
47909
48569
  requestAnimationFrame(() => requestAnimationFrame(() => resolve()));
47910
48570
  });
47911
48571
  }
47912
- const started = startSlideshow({
48572
+ const started = await startSlideshow({
47913
48573
  onStart: () => {
47914
48574
  setEditorEditable(false);
47915
48575
  void window.electronAPI.setSlideshowFullscreen(true);