@bytechain.cn/colamd 2.7.11 → 2.7.12

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 (92) hide show
  1. package/README.md +4 -3
  2. package/README_CN.md +4 -3
  3. package/dist/main/index.js +2 -1
  4. package/dist/renderer/assets/{2DXBBFLN-BffjYiBQ.js → 2DXBBFLN-BJduq_n1.js} +4 -4
  5. package/dist/renderer/assets/{46IJ22JX-Cqs6Q0nk.js → 46IJ22JX-Dl5oABYC.js} +5 -5
  6. package/dist/renderer/assets/{4TTDE5I4-Di9dPHLj.js → 4TTDE5I4-D0OZH30N.js} +3 -3
  7. package/dist/renderer/assets/{4UF3HTLV-8gLxIs2l.js → 4UF3HTLV-B9lH7CBB.js} +4 -4
  8. package/dist/renderer/assets/{AAXQQPKT-FysWbA2A.js → AAXQQPKT-eq8R1-i0.js} +8 -8
  9. package/dist/renderer/assets/{AKE5O7KZ-B3IOPa-c.js → AKE5O7KZ-BPFFZy5e.js} +5 -5
  10. package/dist/renderer/assets/{BNMLP6AG-D0ug7dDI.js → BNMLP6AG-DvupnLHN.js} +7 -7
  11. package/dist/renderer/assets/{DR6PKOQU-oitmLyhZ.js → DR6PKOQU-DXqY3tAL.js} +3 -3
  12. package/dist/renderer/assets/{E4RJ7UJB-B8xlSgyM.js → E4RJ7UJB-B3-v1GGn.js} +6 -6
  13. package/dist/renderer/assets/{ELSXBIJH-6mTmrNHq.js → ELSXBIJH-W0-fIyGs.js} +1 -1
  14. package/dist/renderer/assets/{ERTIBQVS-Dd68dFC-.js → ERTIBQVS-Cjo8zCEV.js} +4 -4
  15. package/dist/renderer/assets/{F653G4FO-Bu2Zxw-j.js → F653G4FO-t4kGthl5.js} +8 -8
  16. package/dist/renderer/assets/{FKCDD66M-Ba7w0jUC.js → FKCDD66M-CqwX5T9T.js} +1 -1
  17. package/dist/renderer/assets/{FP7KDXVC-Do8T7Drp.js → FP7KDXVC-SqJKRKSf.js} +6 -6
  18. package/dist/renderer/assets/{FT5I3RHX-Cw6_nFK5.js → FT5I3RHX-B1_XlJMF.js} +7 -7
  19. package/dist/renderer/assets/{GY35JXOZ-BgICGoQK.js → GY35JXOZ-D_hAOI09.js} +4 -4
  20. package/dist/renderer/assets/{H5EEJPP2-BhAIE8Iv.js → H5EEJPP2-Dh0ee_t_.js} +9 -9
  21. package/dist/renderer/assets/{HWDLEDTA-LoeArK7M.js → HWDLEDTA-BfmnLbys.js} +1 -1
  22. package/dist/renderer/assets/{JZWSX6AR-D32ich7B.js → JZWSX6AR-DibCj0_r.js} +2 -2
  23. package/dist/renderer/assets/{KQOEJWJY-BjdpuYRt.js → KQOEJWJY-CYbDpxpS.js} +1 -1
  24. package/dist/renderer/assets/{KS3BB3KE-SuIaBOey.js → KS3BB3KE-BKXN5GEp.js} +5 -5
  25. package/dist/renderer/assets/{KXJRRZHI-dzerQwX8.js → KXJRRZHI-Dd9nToeE.js} +3 -3
  26. package/dist/renderer/assets/{MFVI5XKI-Ccq0m553.js → MFVI5XKI-yEhNzg_a.js} +1 -1
  27. package/dist/renderer/assets/{MWY2J62P-BoC73bt9.js → MWY2J62P-PD0ivp8r.js} +5 -5
  28. package/dist/renderer/assets/{MXGNCBL2-BZCuhQ_f.js → MXGNCBL2-CrYuCAhj.js} +5 -5
  29. package/dist/renderer/assets/{N6DAJLIZ-D3lshlWR.js → N6DAJLIZ-CsI-0Pob.js} +2 -2
  30. package/dist/renderer/assets/{NU5M23IW-D8B7aP1M.js → NU5M23IW-BRouDTU6.js} +5 -5
  31. package/dist/renderer/assets/{NV4XNBIS-CG86dKnS.js → NV4XNBIS-BDKWqPgJ.js} +7 -7
  32. package/dist/renderer/assets/{OGLU4SIR-D-dckdGc.js → OGLU4SIR-e03S5CRP.js} +5 -5
  33. package/dist/renderer/assets/{OUNS5N76-BxpcyMgv.js → OUNS5N76-DXs9fuRM.js} +6 -6
  34. package/dist/renderer/assets/{PU4ISKXV-2blQCsO8.js → PU4ISKXV-DHAw3ojo.js} +5 -5
  35. package/dist/renderer/assets/{PUZGS23X-pDG4u-84.js → PUZGS23X-BJvqqbjA.js} +1 -1
  36. package/dist/renderer/assets/{Q3IYVLG5-CzhiDBWC.js → Q3IYVLG5-BBP8APVJ.js} +5 -5
  37. package/dist/renderer/assets/{QYHQDLKZ-CPbJy_Nw.js → QYHQDLKZ-Dk9FA6iI.js} +9 -9
  38. package/dist/renderer/assets/{RZSVICHU-BBonevo2.js → RZSVICHU-DQMvf7FW.js} +1 -1
  39. package/dist/renderer/assets/{UEXXS2NB-D54VDoFS.js → UEXXS2NB-pjQFygyK.js} +1 -1
  40. package/dist/renderer/assets/{UHTQJXKL-XbjCRArY.js → UHTQJXKL-BCjkwDC-.js} +5 -5
  41. package/dist/renderer/assets/{URA2L2QI-DWXUka6_.js → URA2L2QI-DOqGA-7p.js} +1 -1
  42. package/dist/renderer/assets/{UXCHDUKG-HEug3chN.js → UXCHDUKG-P-ssqnp6.js} +5 -5
  43. package/dist/renderer/assets/{VKNV3BUX-CgpUwi-P.js → VKNV3BUX-S-I5Vkej.js} +6 -6
  44. package/dist/renderer/assets/{VMV7XPHP-Bv6BQock.js → VMV7XPHP-CBEFwbRj.js} +1 -1
  45. package/dist/renderer/assets/{WEVWDWVA-Cl6MdVFH.js → WEVWDWVA-NETs7zG0.js} +1 -1
  46. package/dist/renderer/assets/{XRRJ35LF-DA5B5ZaK.js → XRRJ35LF-ChlUj7II.js} +4 -4
  47. package/dist/renderer/assets/{YFKBLVVN-CZTsSDev.js → YFKBLVVN-a23ZlMUZ.js} +4 -4
  48. package/dist/renderer/assets/{YHRE5QGZ-poL0u1Hk.js → YHRE5QGZ-B4WFiwFa.js} +7 -7
  49. package/dist/renderer/assets/{ZF3OVT4B-Csajz0OL.js → ZF3OVT4B-D99LRppp.js} +3 -3
  50. package/dist/renderer/assets/{index-DVUqWypj.js → index-9wJDFDHb.js} +1 -1
  51. package/dist/renderer/assets/{index-OQWi5Igb.js → index-B-sTajw0.js} +1 -1
  52. package/dist/renderer/assets/{index-B2k43UK4.js → index-B3xEpmeL.js} +1 -1
  53. package/dist/renderer/assets/{index-CSXoVyN0.js → index-B7a6ecSB.js} +1 -1
  54. package/dist/renderer/assets/{index-IgLPrOn8.js → index-BQRkI4XZ.js} +3 -3
  55. package/dist/renderer/assets/{index-Dx_w36Cl.js → index-BUMCX36l.js} +1 -1
  56. package/dist/renderer/assets/{index-Lj__gZ6c.js → index-BXMm6of_.js} +1 -1
  57. package/dist/renderer/assets/{index-u6ZCoBKY.js → index-BgaTyTt4.js} +1 -1
  58. package/dist/renderer/assets/{index-DrTzZcbo.js → index-C5S7E_iS.js} +3 -3
  59. package/dist/renderer/assets/{index-B90RKaFh.js → index-CBsqa7KF.js} +1 -1
  60. package/dist/renderer/assets/{index-DtaUmWot.js → index-CFd49PzX.js} +1 -1
  61. package/dist/renderer/assets/{index-CZLcUFAS.js → index-CX3eLmnK.js} +1 -1
  62. package/dist/renderer/assets/{index-D0-6r8OY.js → index-CizbQ4B2.js} +1 -1
  63. package/dist/renderer/assets/{index-Mp0fGNKU.js → index-Cl38Mcu3.js} +1 -1
  64. package/dist/renderer/assets/{index-C6upWLHM.js → index-CmCG8RWM.js} +1 -1
  65. package/dist/renderer/assets/{index-Duagl4VH.js → index-Cr5af8vL.js} +1 -1
  66. package/dist/renderer/assets/{index-r0CaOFQM.js → index-DNKeYHeb.js} +1 -1
  67. package/dist/renderer/assets/{index-CDNRUOxY.js → index-DShnMzLx.js} +449 -161
  68. package/dist/renderer/assets/{index-DHfl2nIi.js → index-DurJ4oOc.js} +3 -3
  69. package/dist/renderer/assets/{index-eX6agtDo.js → index-WU2bjQIt.js} +1 -1
  70. package/dist/renderer/assets/{index-BBpT3mZJ.css → index-Xe00ZDVa.css} +6 -5
  71. package/dist/renderer/assets/{index-OVUeW-Iw.js → index-j9IOhwim.js} +1 -1
  72. package/dist/renderer/assets/{lazy-DNVZaEmQ.js → lazy-C5_LqPMG.js} +3 -3
  73. package/dist/renderer/assets/{web-BOPg29Xm.js → web-C4L7HQnE.js} +2 -2
  74. package/dist/renderer/assets/{web-C5AimWCG.js → web-ClAYTlQS.js} +1 -1
  75. package/dist/renderer/assets/{web-nxbmgoyN.js → web-DJNzGtPV.js} +1 -1
  76. package/dist/renderer/index.html +2 -2
  77. package/package.json +2 -1
  78. package/themes/README.md +30 -0
  79. package/themes/bear.css +1 -1
  80. package/themes/contract.json +1 -1
  81. package/themes/dark.css +9 -1
  82. package/themes/dracula.css +1 -5
  83. package/themes/elegant.css +5 -12
  84. package/themes/gruvbox.css +1 -5
  85. package/themes/light.css +1 -1
  86. package/themes/midnight.css +7 -3
  87. package/themes/nord.css +1 -5
  88. package/themes/notion.css +9 -11
  89. package/themes/sepia.css +3 -6
  90. package/themes/solarized-dark.css +1 -1
  91. package/themes/writer.css +9 -1
  92. package/dist/renderer/assets/index-BkfZmH8n.js +0 -110
@@ -33237,7 +33237,7 @@ const PRINT_PALETTE = {
33237
33237
  };
33238
33238
  let pele = null;
33239
33239
  function loadPele() {
33240
- pele ??= __vitePreload(() => import("./lazy-DNVZaEmQ.js").then((n) => n.l), true ? [] : void 0, import.meta.url);
33240
+ pele ??= __vitePreload(() => import("./lazy-C5_LqPMG.js").then((n) => n.l), true ? [] : void 0, import.meta.url);
33241
33241
  return pele;
33242
33242
  }
33243
33243
  function withPrintPalette(svg, palette) {
@@ -33406,7 +33406,14 @@ function pushBlockLines(state, from, to, className, ranges) {
33406
33406
  ranges.push({ from: lineFrom, to: lineFrom, deco: BLOCK(className) });
33407
33407
  }
33408
33408
  }
33409
+ const QUOTE_PREFIX_RE$2 = /^(?:[ \t]*> ?)+/;
33410
+ function hasListSpace(state, markTo) {
33411
+ const ch = markTo < state.doc.length ? state.doc.sliceString(markTo, markTo + 1) : "";
33412
+ return ch === " " || ch === " ";
33413
+ }
33409
33414
  function pushListItemLines(state, node, ranges) {
33415
+ const selfMark = node.getChild("ListMark");
33416
+ if (!selfMark || !hasListSpace(state, selfMark.to)) return;
33410
33417
  const className = `cm-md-li cm-md-li-${Math.min(listDepth$1(node), 6)}`;
33411
33418
  const tree = syntaxTree(state);
33412
33419
  const path2 = [];
@@ -33433,12 +33440,19 @@ function pushListItemLines(state, node, ranges) {
33433
33440
  const last2 = node.nextSibling?.name === "ListItem" ? state.doc.lineAt(node.nextSibling.from).number - 1 : ownLast;
33434
33441
  for (let n = first; n <= last2; n++) {
33435
33442
  const line = state.doc.line(n);
33443
+ if (n > first && n <= ownLast && line.to <= ownEnd) {
33444
+ const body = line.text.replace(QUOTE_PREFIX_RE$2, "");
33445
+ if (body.trim() !== "" && !/^[ \t]/.test(body)) break;
33446
+ }
33436
33447
  if (n <= ownLast && line.to > ownEnd) {
33437
- const indent = /^[ \t]*/.exec(line.text)?.[0].length ?? 0;
33438
- const at = Math.min(line.from + indent, line.to);
33448
+ const quoteLen = QUOTE_PREFIX_RE$2.exec(line.text)?.[0].length ?? 0;
33449
+ const indent = /^[ \t]*/.exec(line.text.slice(quoteLen))?.[0].length ?? 0;
33450
+ const at = Math.min(line.from + quoteLen + indent, line.to);
33439
33451
  let owner = tree.resolveInner(at, 1);
33440
33452
  while (owner && owner.name !== "ListItem") owner = owner.parent;
33441
33453
  if (!owner || owner.from !== node.from) continue;
33454
+ const body = line.text.slice(quoteLen);
33455
+ if (body.trim() !== "" && !/^[ \t]/.test(body)) break;
33442
33456
  }
33443
33457
  const paragraph = paragraphs.find((block) => block.from <= line.to && block.to > line.from);
33444
33458
  ranges.push({ from: line.from, to: line.from, deco: Decoration.line({ class: className, attributes: {
@@ -33489,6 +33503,7 @@ function remeasureAfterDraw() {
33489
33503
  const dom = view.contentDOM;
33490
33504
  dom.style.minHeight = "0";
33491
33505
  view.requestMeasure({
33506
+ read: () => null,
33492
33507
  write: () => {
33493
33508
  dom.style.minHeight = "";
33494
33509
  }
@@ -33548,9 +33563,13 @@ class ImageWidget extends WidgetType {
33548
33563
  const img = document.createElement("img");
33549
33564
  img.src = this.src;
33550
33565
  img.alt = this.alt;
33566
+ img.addEventListener("load", () => {
33567
+ remeasureAfterDraw();
33568
+ });
33551
33569
  img.addEventListener("error", () => {
33552
33570
  wrap.classList.add("cm-md-image-failed");
33553
33571
  wrap.textContent = this.source;
33572
+ remeasureAfterDraw();
33554
33573
  });
33555
33574
  wrap.appendChild(img);
33556
33575
  return wrap;
@@ -33627,10 +33646,9 @@ function listDepth$1(node) {
33627
33646
  }
33628
33647
  return depth;
33629
33648
  }
33630
- function collectMath(state, ranges) {
33631
- const text2 = state.doc.toString();
33632
- const excluded = excludedRanges(text2, syntaxTree(state));
33649
+ function collectMath(state, text2, excluded, ranges, zones) {
33633
33650
  for (const range of scanMath(text2, excluded)) {
33651
+ if (range.block) zones.push({ from: range.from, to: range.to, kind: "block" });
33634
33652
  if (isActiveLine(state, range.from) || range.block && isBlockActive(state, range.from, range.to)) {
33635
33653
  const delim = range.block ? 2 : 1;
33636
33654
  ranges.push({ from: range.from, to: range.from + delim, deco: MARK({ class: "cm-md-marker" }) });
@@ -33640,13 +33658,18 @@ function collectMath(state, ranges) {
33640
33658
  ranges.push({
33641
33659
  from: range.from,
33642
33660
  to: range.to,
33643
- deco: Decoration.replace({ widget: new MathWidget(range.code, range.block, range.from, range.to) })
33661
+ // 跨行 replace 必须是 block 装饰(CM6 约束):inline 跨行 replace 只有初次
33662
+ // 构建能画出来,增量更新(源码退出 → 重新渲染)时 widget 永远不会被重建,
33663
+ // 块级公式表现为「点进去改完再点走,公式整块消失」。只对整行覆盖的范围加。
33664
+ deco: Decoration.replace({
33665
+ widget: new MathWidget(range.code, range.block, range.from, range.to),
33666
+ block: range.block && state.doc.lineAt(range.from).from === range.from && state.doc.lineAt(Math.min(range.to, state.doc.length)).to === range.to
33667
+ })
33644
33668
  });
33645
33669
  }
33646
33670
  }
33647
33671
  const HIGHLIGHT_RE = /(?<![=])==(?!=)([^=\n]+?)==(?!=)/g;
33648
- function collectHighlight(state, ranges, excluded) {
33649
- const text2 = state.doc.toString();
33672
+ function collectHighlight(state, text2, ranges, excluded) {
33650
33673
  const inExcluded = (pos) => excluded.some((e) => pos >= e.from && pos < e.to);
33651
33674
  HIGHLIGHT_RE.lastIndex = 0;
33652
33675
  let match;
@@ -33737,28 +33760,34 @@ const POINTER_EVENTS = /* @__PURE__ */ new Set([
33737
33760
  "touchstart",
33738
33761
  "touchend"
33739
33762
  ]);
33740
- function collectMermaid(state, ranges, front) {
33741
- const text2 = state.doc.toString();
33763
+ function collectMermaid(state, text2, ranges, front, zones) {
33742
33764
  iterateContent(state, front, (node) => {
33743
33765
  if (node.name !== "FencedCode") return;
33744
33766
  const firstLineEnd = text2.indexOf("\n", node.from);
33745
33767
  if (firstLineEnd === -1) return;
33746
33768
  const opening = text2.slice(node.from, firstLineEnd).trim();
33747
33769
  if (!/^(`{3,}|~{3,})\s*mermaid\s*$/.test(opening)) return;
33748
- if (isBlockActive(state, node.from, node.to)) return;
33749
33770
  const bodyStart2 = firstLineEnd + 1;
33750
33771
  const lastLineStart = text2.lastIndexOf("\n", node.to - 1);
33751
33772
  const code = text2.slice(bodyStart2, lastLineStart === -1 ? node.to : lastLineStart);
33752
33773
  if (!code.trim()) return;
33774
+ zones.push({ from: node.from, to: node.to, kind: "block" });
33775
+ if (isBlockActive(state, node.from, node.to)) return;
33753
33776
  ranges.push({
33754
33777
  from: node.from,
33755
33778
  to: node.to,
33756
- deco: Decoration.replace({ widget: new MermaidWidget(code, `${node.from}:${code.length}`, node.from, node.to) })
33779
+ // fence 恒为整行 → 恒为 block 装饰:跨行 inline replace 在增量更新时
33780
+ // widget 不会被重建,「点图进源码、点走再渲染」的图会整块消失(见 collectMath)。
33781
+ deco: Decoration.replace({
33782
+ widget: new MermaidWidget(code, `${node.from}:${code.length}`, node.from, node.to),
33783
+ block: true
33784
+ })
33757
33785
  });
33758
33786
  });
33759
33787
  }
33760
- function collectFrontmatter(state, ranges, front) {
33788
+ function collectFrontmatter(state, ranges, front, zones) {
33761
33789
  if (!front) return;
33790
+ zones.push({ from: front.from, to: front.to, kind: "frontmatter" });
33762
33791
  const editing = state.selection.ranges.some(
33763
33792
  (range) => range.empty && range.head >= front.from && range.head <= front.to
33764
33793
  );
@@ -33920,9 +33949,10 @@ function appendInline(parent, text2, base2) {
33920
33949
  }
33921
33950
  if (last2 < text2.length) write(parent, last2, text2.length);
33922
33951
  }
33923
- function collectTables(state, ranges, front) {
33952
+ function collectTables(state, ranges, front, zones) {
33924
33953
  iterateContent(state, front, (node) => {
33925
33954
  if (node.name !== "Table") return;
33955
+ zones.push({ from: node.from, to: node.to, kind: "block" });
33926
33956
  if (isBlockActive(state, node.from, node.to)) {
33927
33957
  pushBlockLines(state, node.from, node.to, "cm-md-table", ranges);
33928
33958
  return false;
@@ -33981,8 +34011,7 @@ class FootnoteRefWidget extends WidgetType {
33981
34011
  return sup2;
33982
34012
  }
33983
34013
  }
33984
- function collectFootnotes(state, ranges, front) {
33985
- const text2 = state.doc.toString();
34014
+ function collectFootnotes(state, text2, ranges, front) {
33986
34015
  const numbers = footnoteNumbers(text2);
33987
34016
  const definitions = footnoteDefinitions(text2);
33988
34017
  FOOTNOTE_REF_RE.lastIndex = 0;
@@ -34024,11 +34053,12 @@ class HTMLWidget extends WidgetType {
34024
34053
  return wrap;
34025
34054
  }
34026
34055
  }
34027
- function collectHTML(state, ranges, front) {
34056
+ function collectHTML(state, ranges, front, zones) {
34028
34057
  const paired = /* @__PURE__ */ new Set();
34029
34058
  iterateContent(state, front, (node) => {
34030
34059
  const block = node.name === "HTMLBlock";
34031
34060
  if (!block && node.name !== "HTMLTag") return;
34061
+ if (block) zones.push({ from: node.from, to: node.to, kind: "block" });
34032
34062
  if (block ? isBlockActive(state, node.from, node.to) : isActiveLine(state, node.from)) return false;
34033
34063
  if (!block) {
34034
34064
  if (paired.has(node.from)) return false;
@@ -34125,8 +34155,11 @@ function collectBlocks(state, ranges, front) {
34125
34155
  break;
34126
34156
  }
34127
34157
  case "ListMark": {
34128
- const lead = node.from - state.doc.lineAt(node.from).from;
34129
- if (lead > 0) ranges.push({ from: node.from - lead, to: node.from, deco: hide(node.from - lead, node.from) });
34158
+ if (!hasListSpace(state, node.to)) break;
34159
+ const line = state.doc.lineAt(node.from);
34160
+ const quoteLen = QUOTE_PREFIX_RE$2.exec(state.doc.sliceString(line.from, node.from))?.[0].length ?? 0;
34161
+ const hideFrom = line.from + quoteLen;
34162
+ if (node.from > hideFrom) ranges.push({ from: hideFrom, to: node.from, deco: hide(hideFrom, node.from) });
34130
34163
  const raw = state.doc.sliceString(node.from, node.to).trim();
34131
34164
  const after = state.doc.sliceString(node.to, node.to + 4);
34132
34165
  if (/^\s+\[[ xX]\]/.test(after)) {
@@ -34270,8 +34303,25 @@ function collectPages(state, ranges, front) {
34270
34303
  }
34271
34304
  const headingFlashEffect = StateEffect.define();
34272
34305
  let currentFlash = null;
34306
+ const zonesByDeco = /* @__PURE__ */ new WeakMap();
34307
+ function activeZonesKey(state, zones) {
34308
+ if (zones.length === 0) return "";
34309
+ const main2 = state.selection.main;
34310
+ const parts = [];
34311
+ for (let i = 0; i < zones.length; i++) {
34312
+ const z = zones[i];
34313
+ if (z.kind === "frontmatter") {
34314
+ const hit = state.selection.ranges.some((r) => r.empty && r.head >= z.from && r.head <= z.to);
34315
+ if (hit) parts.push(`f:${z.from}:${z.to}`);
34316
+ } else if (main2.from >= z.from && main2.to <= z.to) {
34317
+ parts.push(`b:${z.from}:${z.to}`);
34318
+ }
34319
+ }
34320
+ return parts.join("|");
34321
+ }
34273
34322
  function buildDecorations(state, flash) {
34274
34323
  const ranges = [];
34324
+ const zones = [];
34275
34325
  const text2 = state.doc.toString();
34276
34326
  const excluded = excludedRanges(text2, syntaxTree(state));
34277
34327
  const front = frontmatterRange(text2);
@@ -34280,21 +34330,23 @@ function buildDecorations(state, flash) {
34280
34330
  }
34281
34331
  collectBlocks(state, ranges, front);
34282
34332
  collectLinks(state, ranges, front);
34283
- collectFootnotes(state, ranges, front);
34284
- collectHTML(state, ranges, front);
34333
+ collectFootnotes(state, text2, ranges, front);
34334
+ collectHTML(state, ranges, front, zones);
34285
34335
  collectImages(state, ranges, front);
34286
34336
  collectPages(state, ranges, front);
34287
34337
  collectInline(state, ranges, front);
34288
- collectFrontmatter(state, ranges, front);
34289
- collectTables(state, ranges, front);
34338
+ collectFrontmatter(state, ranges, front, zones);
34339
+ collectTables(state, ranges, front, zones);
34290
34340
  collectTaskItems(state, ranges, front);
34291
- collectMermaid(state, ranges, front);
34292
- collectHighlight(state, ranges, excluded);
34293
- collectMath(state, ranges);
34341
+ collectMermaid(state, text2, ranges, front, zones);
34342
+ collectHighlight(state, text2, ranges, excluded);
34343
+ collectMath(state, text2, excluded, ranges, zones);
34294
34344
  ranges.sort((a, b) => a.from - b.from || a.deco.startSide - b.deco.startSide || a.to - b.to);
34295
34345
  const builder = new RangeSetBuilder();
34296
34346
  for (const r of ranges) builder.add(r.from, r.to, r.deco);
34297
- return builder.finish();
34347
+ const deco = builder.finish();
34348
+ zonesByDeco.set(deco, zones);
34349
+ return deco;
34298
34350
  }
34299
34351
  const livePreviewField = StateField.define({
34300
34352
  create: (state) => buildDecorations(state, null),
@@ -34304,11 +34356,15 @@ const livePreviewField = StateField.define({
34304
34356
  if (flash) currentFlash = flashValue;
34305
34357
  const parsed = tr.effects.some((effect) => effect.is(decorationsRefreshEffect));
34306
34358
  const rebased = tr.effects.some((effect) => effect.is(setDocumentFileUrlEffect));
34307
- const focused = tr.state.field(editorFocusField, false) ?? false;
34308
- const wasFocused = tr.startState.field(editorFocusField, false) ?? false;
34309
34359
  const clean = tr.state.field(cleanExportField, false) ?? false;
34310
34360
  const wasClean = tr.startState.field(cleanExportField, false) ?? false;
34311
- if (!tr.docChanged && !tr.selection && !flash && !parsed && !rebased && focused === wasFocused && clean === wasClean) return deco;
34361
+ if (!tr.docChanged && !flash && !parsed && !rebased && clean === wasClean) {
34362
+ if (!tr.selection) return deco;
34363
+ const zones = zonesByDeco.get(deco) ?? [];
34364
+ if (activeZonesKey(tr.state, zones) === activeZonesKey(tr.startState, zones)) {
34365
+ return deco;
34366
+ }
34367
+ }
34312
34368
  return buildDecorations(tr.state, flashValue);
34313
34369
  },
34314
34370
  provide: (field) => EditorView.decorations.from(field)
@@ -41779,90 +41835,187 @@ const index$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePrope
41779
41835
  markdownLanguage,
41780
41836
  pasteURLAsLink
41781
41837
  }, Symbol.toStringTag, { value: "Module" }));
41782
- const LIST_RE = /^([ \t]*)(?:([-*+])|(\d+)([.)]))([ \t]+)(\[[ xX]\][ \t]+)?/;
41783
- function deleteAtLineStart(view) {
41838
+ const QUOTE_PREFIX_RE$1 = /^(?:[ \t]*> ?)+/;
41839
+ const LIST_BODY_RE = /^([ \t]*)(?:([-*+])|(\d+)([.)]))([ \t]+)(\[[ xX]\][ \t]+)?/;
41840
+ const INDENT = " ";
41841
+ function countQuotes(prefix) {
41842
+ let count2 = 0;
41843
+ for (let i = 0; i < prefix.length; i++) {
41844
+ if (prefix[i] === ">") count2++;
41845
+ }
41846
+ return count2;
41847
+ }
41848
+ function parseListLine(text2) {
41849
+ const quotePrefix = QUOTE_PREFIX_RE$1.exec(text2)?.[0] ?? "";
41850
+ const quoteLen = quotePrefix.length;
41851
+ const match = LIST_BODY_RE.exec(text2.slice(quoteLen));
41852
+ if (!match) return null;
41853
+ const lead = match[1].length;
41854
+ const box = match[6] ?? "";
41855
+ const width = match[0].length - lead - box.length;
41856
+ return {
41857
+ quoteLen,
41858
+ quoteDepth: countQuotes(quotePrefix),
41859
+ lead,
41860
+ width,
41861
+ digits: match[3] ?? "",
41862
+ box,
41863
+ contentOffset: quoteLen + match[0].length
41864
+ };
41865
+ }
41866
+ const continueMarkup = insertNewlineContinueMarkupCommand({ nonTightLists: false });
41867
+ function handleEnter(view) {
41784
41868
  const { state } = view;
41785
41869
  const range = state.selection.main;
41786
41870
  if (!range.empty) return false;
41787
41871
  const line = state.doc.lineAt(range.head);
41788
- if (range.head !== line.from) {
41789
- if (!/^#{1,6}[ \t]?/.test(line.text) && !/^>[ \t]?/.test(line.text)) return false;
41872
+ if (/^[ \t]*(?:>[ \t]*)+$/.test(line.text)) {
41873
+ const lastGt = line.text.lastIndexOf(">");
41874
+ if (range.head >= line.from + lastGt + 1) {
41875
+ const depth = countQuotes(line.text);
41876
+ const delFrom = depth <= 1 ? line.from : line.from + line.text.slice(0, lastGt).replace(/[ \t]+$/, "").length;
41877
+ view.dispatch({
41878
+ changes: { from: delFrom, to: line.to, insert: "" },
41879
+ selection: { anchor: delFrom },
41880
+ scrollIntoView: true,
41881
+ userEvent: "input"
41882
+ });
41883
+ return true;
41884
+ }
41790
41885
  }
41791
- const self2 = listLine(line.text);
41792
- if (self2) {
41886
+ if (!QUOTE_PREFIX_RE$1.test(line.text) && !parseListLine(line.text) && !/^[ \t]/.test(line.text)) {
41887
+ return false;
41888
+ }
41889
+ return continueMarkup(view);
41890
+ }
41891
+ function deleteTaskBox(view) {
41892
+ const { state } = view;
41893
+ const range = state.selection.main;
41894
+ if (!range.empty) return false;
41895
+ const line = state.doc.lineAt(range.head);
41896
+ const self2 = parseListLine(line.text);
41897
+ if (!self2 || !self2.box) return false;
41898
+ const contentStart = line.from + self2.contentOffset;
41899
+ if (range.head !== contentStart) return false;
41900
+ const boxStart = contentStart - self2.box.length;
41901
+ view.dispatch({
41902
+ changes: { from: boxStart, to: contentStart, insert: "" },
41903
+ selection: { anchor: boxStart },
41904
+ userEvent: "delete"
41905
+ });
41906
+ return true;
41907
+ }
41908
+ function deleteAtLineStart(view) {
41909
+ const { state } = view;
41910
+ const range = state.selection.main;
41911
+ if (!range.empty) return false;
41912
+ const line = state.doc.lineAt(range.head);
41913
+ const self2 = parseListLine(line.text);
41914
+ if (self2 && range.head <= line.from + self2.contentOffset) {
41793
41915
  if (self2.lead > 0) return indentListItem(view, -1);
41794
- const match = LIST_RE.exec(line.text);
41795
- const marker = match[0].length;
41916
+ const from = line.from + self2.quoteLen;
41917
+ const to = line.from + self2.contentOffset;
41796
41918
  view.dispatch({
41797
- changes: { from: line.from, to: line.from + marker, insert: "" },
41798
- selection: { anchor: line.from },
41919
+ changes: { from, to, insert: "" },
41920
+ selection: { anchor: from },
41799
41921
  userEvent: "delete"
41800
41922
  });
41801
41923
  return true;
41802
41924
  }
41803
- const head = /^#{1,6}[ \t]?/.exec(line.text);
41804
- if (head && head[0].length > 0 && range.head <= line.from + head[0].length) {
41925
+ const quotePrefix = QUOTE_PREFIX_RE$1.exec(line.text)?.[0] ?? "";
41926
+ const quoteLen = quotePrefix.length;
41927
+ const head = /^#{1,6}[ \t]?/.exec(line.text.slice(quoteLen));
41928
+ if (head && head[0].length > 0 && range.head >= line.from + quoteLen && range.head <= line.from + quoteLen + head[0].length) {
41929
+ const from = line.from + quoteLen;
41805
41930
  view.dispatch({
41806
- changes: { from: line.from, to: line.from + head[0].length, insert: "" },
41807
- selection: { anchor: line.from },
41931
+ changes: { from, to: from + head[0].length, insert: "" },
41932
+ selection: { anchor: from },
41808
41933
  userEvent: "delete"
41809
41934
  });
41810
41935
  return true;
41811
41936
  }
41812
- const quote = /^>[ \t]?/.exec(line.text);
41813
- if (quote && line.text.length > quote[0].length && range.head <= line.from + quote[0].length) {
41814
- view.dispatch({
41815
- changes: { from: line.from, to: line.from + quote[0].length, insert: "" },
41816
- selection: { anchor: line.from },
41817
- userEvent: "delete"
41818
- });
41819
- return true;
41937
+ if (quoteLen > 0 && range.head <= line.from + quoteLen) {
41938
+ if (line.text.length > quoteLen || range.head > line.from) {
41939
+ const innerMatch = /[ \t]*> ?$/.exec(quotePrefix);
41940
+ const delFrom = innerMatch ? line.from + quoteLen - innerMatch[0].length : line.from;
41941
+ view.dispatch({
41942
+ changes: { from: delFrom, to: line.from + quoteLen, insert: "" },
41943
+ selection: { anchor: delFrom },
41944
+ userEvent: "delete"
41945
+ });
41946
+ return true;
41947
+ }
41820
41948
  }
41821
41949
  return false;
41822
41950
  }
41823
- const INDENT = " ";
41824
41951
  function indentListItem(view, direction) {
41825
41952
  const { state } = view;
41826
41953
  const range = state.selection.main;
41827
41954
  if (!range.empty) return false;
41828
41955
  const line = state.doc.lineAt(range.head);
41829
- const self2 = listLine(line.text);
41830
- if (!self2) return false;
41956
+ const self2 = parseListLine(line.text);
41957
+ if (!self2) {
41958
+ const quotePrefix = QUOTE_PREFIX_RE$1.exec(line.text)?.[0];
41959
+ if (!quotePrefix) return false;
41960
+ const bodyFrom2 = line.from + quotePrefix.length;
41961
+ if (direction === 1) {
41962
+ const at = Math.max(range.head, bodyFrom2);
41963
+ view.dispatch({
41964
+ changes: { from: at, to: at, insert: INDENT },
41965
+ selection: { anchor: at + INDENT.length },
41966
+ scrollIntoView: true,
41967
+ userEvent: "input"
41968
+ });
41969
+ return true;
41970
+ }
41971
+ const spaces2 = /^[ \t]+/.exec(line.text.slice(quotePrefix.length))?.[0] ?? "";
41972
+ if (!spaces2) return true;
41973
+ const remove2 = Math.min(spaces2.length, INDENT.length);
41974
+ view.dispatch({
41975
+ changes: { from: bodyFrom2, to: bodyFrom2 + remove2, insert: "" },
41976
+ selection: { anchor: Math.max(bodyFrom2, range.head - remove2) },
41977
+ scrollIntoView: true,
41978
+ userEvent: "input"
41979
+ });
41980
+ return true;
41981
+ }
41982
+ const bodyFrom = line.from + self2.quoteLen;
41831
41983
  if (direction === 1) {
41832
- const parent2 = parentItem(state, line, self2.lead);
41984
+ const parent2 = parentItem(state, line, self2.lead, self2.quoteDepth);
41833
41985
  const target = parent2 ? parent2.lead + parent2.width : self2.lead + self2.width;
41834
41986
  const lead2 = Math.max(target, self2.lead + INDENT.length);
41835
- const change = freshSublist(state, line, lead2) ? { from: line.from, to: line.from + self2.lead + self2.digits.length, insert: `${" ".repeat(lead2)}1` } : { from: line.from, insert: " ".repeat(lead2 - self2.lead) };
41987
+ const change = freshSublist(state, line, lead2, self2) ? { from: bodyFrom, to: bodyFrom + self2.lead + self2.digits.length, insert: `${" ".repeat(lead2)}1` } : { from: bodyFrom, insert: " ".repeat(lead2 - self2.lead) };
41836
41988
  const changes = state.changes(change);
41837
41989
  view.dispatch({
41838
41990
  changes,
41839
- // 新子列表会把多位序号改成 1,光标要按整笔替换映射,不能只加缩进宽度。
41840
41991
  selection: { anchor: changes.mapPos(range.head, 1) },
41841
41992
  scrollIntoView: true,
41842
41993
  userEvent: "input"
41843
41994
  });
41844
41995
  return true;
41845
41996
  }
41846
- const parent = parentItem(state, line, self2.lead - 1);
41997
+ const parent = parentItem(state, line, self2.lead - 1, self2.quoteDepth);
41847
41998
  const lead = parent ? parent.lead : 0;
41848
41999
  if (lead >= self2.lead) return false;
41849
42000
  view.dispatch({
41850
- changes: { from: line.from, to: line.from + self2.lead, insert: " ".repeat(lead) },
41851
- selection: { anchor: Math.max(line.from + lead, range.head - (self2.lead - lead)) },
42001
+ changes: { from: bodyFrom, to: bodyFrom + self2.lead, insert: " ".repeat(lead) },
42002
+ selection: { anchor: Math.max(bodyFrom + lead, range.head - (self2.lead - lead)) },
41852
42003
  scrollIntoView: true,
41853
42004
  userEvent: "input"
41854
42005
  });
41855
42006
  return true;
41856
42007
  }
41857
- function freshSublist(state, line, depth) {
41858
- const self2 = listLine(line.text);
41859
- if (!self2 || !self2.digits) return false;
42008
+ function freshSublist(state, line, depth, self2) {
42009
+ if (!self2.digits) return false;
41860
42010
  for (let number2 = line.number - 1; number2 >= 1; number2--) {
41861
42011
  const prev = state.doc.line(number2);
41862
- if (prev.text.trim() === "") break;
41863
- const prevLine = listLine(prev.text);
42012
+ const prevQuote = QUOTE_PREFIX_RE$1.exec(prev.text)?.[0] ?? "";
42013
+ if (countQuotes(prevQuote) !== self2.quoteDepth) break;
42014
+ const rest = prev.text.slice(prevQuote.length);
42015
+ if (rest.trim() === "") break;
42016
+ const prevLine = parseListLine(prev.text);
41864
42017
  if (!prevLine) {
41865
- if (/^[ \t]*/.exec(prev.text)[0].length > depth) continue;
42018
+ if (/^[ \t]*/.exec(rest)[0].length > depth) continue;
41866
42019
  break;
41867
42020
  }
41868
42021
  if (prevLine.lead === depth) return false;
@@ -41870,28 +42023,25 @@ function freshSublist(state, line, depth) {
41870
42023
  }
41871
42024
  return true;
41872
42025
  }
41873
- function listLine(text2) {
41874
- const match = LIST_RE.exec(text2);
41875
- if (!match) return null;
41876
- const lead = match[1].length;
41877
- const width = match[0].length - lead - (match[6]?.length ?? 0);
41878
- return { lead, width, digits: match[3] ?? "" };
41879
- }
41880
- function parentItem(state, line, lead) {
42026
+ function parentItem(state, line, lead, quoteDepth) {
41881
42027
  for (let number2 = line.number - 1; number2 >= 1; number2--) {
41882
42028
  const prev = state.doc.line(number2);
41883
- if (prev.text.trim() === "") return null;
41884
- const prevLine = listLine(prev.text);
42029
+ const prevQuote = QUOTE_PREFIX_RE$1.exec(prev.text)?.[0] ?? "";
42030
+ if (countQuotes(prevQuote) !== quoteDepth) return null;
42031
+ const rest = prev.text.slice(prevQuote.length);
42032
+ if (rest.trim() === "") return null;
42033
+ const prevLine = parseListLine(prev.text);
41885
42034
  if (prevLine) {
41886
42035
  if (prevLine.lead <= lead) return prevLine;
41887
42036
  continue;
41888
42037
  }
41889
- if (/^[ \t]*/.exec(prev.text)[0].length <= lead) return null;
42038
+ if (/^[ \t]*/.exec(rest)[0].length <= lead) return null;
41890
42039
  }
41891
42040
  return null;
41892
42041
  }
41893
42042
  const listInput = Prec.high(keymap.of([
41894
- { key: "Enter", run: insertNewlineContinueMarkupCommand({ nonTightLists: false }) },
42043
+ { key: "Enter", run: handleEnter },
42044
+ { key: "Backspace", run: deleteTaskBox },
41895
42045
  { key: "Backspace", run: deleteAtLineStart },
41896
42046
  { key: "Backspace", run: deleteMarkupBackward },
41897
42047
  { key: "Tab", run: (view) => indentListItem(view, 1) },
@@ -41912,7 +42062,7 @@ function legacy(parser2) {
41912
42062
  return new LanguageSupport(StreamLanguage.define(parser2));
41913
42063
  }
41914
42064
  function sql(dialectName) {
41915
- return __vitePreload(() => import("./index-B90RKaFh.js"), true ? [] : void 0, import.meta.url).then((m) => m.sql({ dialect: m[dialectName] }));
42065
+ return __vitePreload(() => import("./index-CBsqa7KF.js"), true ? [] : void 0, import.meta.url).then((m) => m.sql({ dialect: m[dialectName] }));
41916
42066
  }
41917
42067
  const languages = [
41918
42068
  // New-style language modes
@@ -41920,7 +42070,7 @@ const languages = [
41920
42070
  name: "C",
41921
42071
  extensions: ["c", "h", "ino"],
41922
42072
  load() {
41923
- return __vitePreload(() => import("./index-CSXoVyN0.js"), true ? [] : void 0, import.meta.url).then((m) => m.cpp());
42073
+ return __vitePreload(() => import("./index-B7a6ecSB.js"), true ? [] : void 0, import.meta.url).then((m) => m.cpp());
41924
42074
  }
41925
42075
  }),
41926
42076
  /* @__PURE__ */ LanguageDescription.of({
@@ -41928,7 +42078,7 @@ const languages = [
41928
42078
  alias: ["cpp"],
41929
42079
  extensions: ["cpp", "c++", "cc", "cxx", "hpp", "h++", "hh", "hxx"],
41930
42080
  load() {
41931
- return __vitePreload(() => import("./index-CSXoVyN0.js"), true ? [] : void 0, import.meta.url).then((m) => m.cpp());
42081
+ return __vitePreload(() => import("./index-B7a6ecSB.js"), true ? [] : void 0, import.meta.url).then((m) => m.cpp());
41932
42082
  }
41933
42083
  }),
41934
42084
  /* @__PURE__ */ LanguageDescription.of({
@@ -41950,7 +42100,7 @@ const languages = [
41950
42100
  name: "Go",
41951
42101
  extensions: ["go"],
41952
42102
  load() {
41953
- return __vitePreload(() => import("./index-B2k43UK4.js"), true ? [] : void 0, import.meta.url).then((m) => m.go());
42103
+ return __vitePreload(() => import("./index-B3xEpmeL.js"), true ? [] : void 0, import.meta.url).then((m) => m.go());
41954
42104
  }
41955
42105
  }),
41956
42106
  /* @__PURE__ */ LanguageDescription.of({
@@ -41965,7 +42115,7 @@ const languages = [
41965
42115
  name: "Java",
41966
42116
  extensions: ["java"],
41967
42117
  load() {
41968
- return __vitePreload(() => import("./index-OQWi5Igb.js"), true ? [] : void 0, import.meta.url).then((m) => m.java());
42118
+ return __vitePreload(() => import("./index-B-sTajw0.js"), true ? [] : void 0, import.meta.url).then((m) => m.java());
41969
42119
  }
41970
42120
  }),
41971
42121
  /* @__PURE__ */ LanguageDescription.of({
@@ -41980,7 +42130,7 @@ const languages = [
41980
42130
  name: "Jinja",
41981
42131
  extensions: ["j2", "jinja", "jinja2"],
41982
42132
  load() {
41983
- return __vitePreload(() => import("./index-DtaUmWot.js"), true ? [] : void 0, import.meta.url).then((m) => m.jinja());
42133
+ return __vitePreload(() => import("./index-CFd49PzX.js"), true ? [] : void 0, import.meta.url).then((m) => m.jinja());
41984
42134
  }
41985
42135
  }),
41986
42136
  /* @__PURE__ */ LanguageDescription.of({
@@ -41988,7 +42138,7 @@ const languages = [
41988
42138
  alias: ["json5"],
41989
42139
  extensions: ["json", "map"],
41990
42140
  load() {
41991
- return __vitePreload(() => import("./index-Mp0fGNKU.js"), true ? [] : void 0, import.meta.url).then((m) => m.json());
42141
+ return __vitePreload(() => import("./index-Cl38Mcu3.js"), true ? [] : void 0, import.meta.url).then((m) => m.json());
41992
42142
  }
41993
42143
  }),
41994
42144
  /* @__PURE__ */ LanguageDescription.of({
@@ -42002,14 +42152,14 @@ const languages = [
42002
42152
  name: "LESS",
42003
42153
  extensions: ["less"],
42004
42154
  load() {
42005
- return __vitePreload(() => import("./index-eX6agtDo.js"), true ? [] : void 0, import.meta.url).then((m) => m.less());
42155
+ return __vitePreload(() => import("./index-WU2bjQIt.js"), true ? [] : void 0, import.meta.url).then((m) => m.less());
42006
42156
  }
42007
42157
  }),
42008
42158
  /* @__PURE__ */ LanguageDescription.of({
42009
42159
  name: "Liquid",
42010
42160
  extensions: ["liquid"],
42011
42161
  load() {
42012
- return __vitePreload(() => import("./index-Lj__gZ6c.js"), true ? [] : void 0, import.meta.url).then((m) => m.liquid());
42162
+ return __vitePreload(() => import("./index-BXMm6of_.js"), true ? [] : void 0, import.meta.url).then((m) => m.liquid());
42013
42163
  }
42014
42164
  }),
42015
42165
  /* @__PURE__ */ LanguageDescription.of({
@@ -42041,7 +42191,7 @@ const languages = [
42041
42191
  name: "PHP",
42042
42192
  extensions: ["php", "php3", "php4", "php5", "php7", "phtml"],
42043
42193
  load() {
42044
- return __vitePreload(() => import("./index-u6ZCoBKY.js"), true ? [] : void 0, import.meta.url).then((m) => m.php());
42194
+ return __vitePreload(() => import("./index-BgaTyTt4.js"), true ? [] : void 0, import.meta.url).then((m) => m.php());
42045
42195
  }
42046
42196
  }),
42047
42197
  /* @__PURE__ */ LanguageDescription.of({
@@ -42062,28 +42212,28 @@ const languages = [
42062
42212
  extensions: ["BUILD", "bzl", "py", "pyw"],
42063
42213
  filename: /^(BUCK|BUILD)$/,
42064
42214
  load() {
42065
- return __vitePreload(() => import("./index-Duagl4VH.js"), true ? [] : void 0, import.meta.url).then((m) => m.python());
42215
+ return __vitePreload(() => import("./index-Cr5af8vL.js"), true ? [] : void 0, import.meta.url).then((m) => m.python());
42066
42216
  }
42067
42217
  }),
42068
42218
  /* @__PURE__ */ LanguageDescription.of({
42069
42219
  name: "Rust",
42070
42220
  extensions: ["rs"],
42071
42221
  load() {
42072
- return __vitePreload(() => import("./index-r0CaOFQM.js"), true ? [] : void 0, import.meta.url).then((m) => m.rust());
42222
+ return __vitePreload(() => import("./index-DNKeYHeb.js"), true ? [] : void 0, import.meta.url).then((m) => m.rust());
42073
42223
  }
42074
42224
  }),
42075
42225
  /* @__PURE__ */ LanguageDescription.of({
42076
42226
  name: "Sass",
42077
42227
  extensions: ["sass"],
42078
42228
  load() {
42079
- return __vitePreload(() => import("./index-D0-6r8OY.js"), true ? [] : void 0, import.meta.url).then((m) => m.sass({ indented: true }));
42229
+ return __vitePreload(() => import("./index-CizbQ4B2.js"), true ? [] : void 0, import.meta.url).then((m) => m.sass({ indented: true }));
42080
42230
  }
42081
42231
  }),
42082
42232
  /* @__PURE__ */ LanguageDescription.of({
42083
42233
  name: "SCSS",
42084
42234
  extensions: ["scss"],
42085
42235
  load() {
42086
- return __vitePreload(() => import("./index-D0-6r8OY.js"), true ? [] : void 0, import.meta.url).then((m) => m.sass());
42236
+ return __vitePreload(() => import("./index-CizbQ4B2.js"), true ? [] : void 0, import.meta.url).then((m) => m.sass());
42087
42237
  }
42088
42238
  }),
42089
42239
  /* @__PURE__ */ LanguageDescription.of({
@@ -42118,7 +42268,7 @@ const languages = [
42118
42268
  name: "WebAssembly",
42119
42269
  extensions: ["wat", "wast"],
42120
42270
  load() {
42121
- return __vitePreload(() => import("./index-Dx_w36Cl.js"), true ? [] : void 0, import.meta.url).then((m) => m.wast());
42271
+ return __vitePreload(() => import("./index-BUMCX36l.js"), true ? [] : void 0, import.meta.url).then((m) => m.wast());
42122
42272
  }
42123
42273
  }),
42124
42274
  /* @__PURE__ */ LanguageDescription.of({
@@ -42126,7 +42276,7 @@ const languages = [
42126
42276
  alias: ["rss", "wsdl", "xsd"],
42127
42277
  extensions: ["xml", "xsl", "xsd", "svg"],
42128
42278
  load() {
42129
- return __vitePreload(() => import("./index-DVUqWypj.js"), true ? [] : void 0, import.meta.url).then((m) => m.xml());
42279
+ return __vitePreload(() => import("./index-9wJDFDHb.js"), true ? [] : void 0, import.meta.url).then((m) => m.xml());
42130
42280
  }
42131
42281
  }),
42132
42282
  /* @__PURE__ */ LanguageDescription.of({
@@ -42134,7 +42284,7 @@ const languages = [
42134
42284
  alias: ["yml"],
42135
42285
  extensions: ["yaml", "yml"],
42136
42286
  load() {
42137
- return __vitePreload(() => import("./index-OVUeW-Iw.js"), true ? [] : void 0, import.meta.url).then((m) => m.yaml());
42287
+ return __vitePreload(() => import("./index-j9IOhwim.js"), true ? [] : void 0, import.meta.url).then((m) => m.yaml());
42138
42288
  }
42139
42289
  }),
42140
42290
  // Legacy modes ported from CodeMirror 5
@@ -42923,13 +43073,13 @@ const languages = [
42923
43073
  name: "Vue",
42924
43074
  extensions: ["vue"],
42925
43075
  load() {
42926
- return __vitePreload(() => import("./index-C6upWLHM.js"), true ? [] : void 0, import.meta.url).then((m) => m.vue());
43076
+ return __vitePreload(() => import("./index-CmCG8RWM.js"), true ? [] : void 0, import.meta.url).then((m) => m.vue());
42927
43077
  }
42928
43078
  }),
42929
43079
  /* @__PURE__ */ LanguageDescription.of({
42930
43080
  name: "Angular Template",
42931
43081
  load() {
42932
- return __vitePreload(() => import("./index-CZLcUFAS.js"), true ? [] : void 0, import.meta.url).then((m) => m.angular());
43082
+ return __vitePreload(() => import("./index-CX3eLmnK.js"), true ? [] : void 0, import.meta.url).then((m) => m.angular());
42933
43083
  }
42934
43084
  })
42935
43085
  ];
@@ -42988,8 +43138,9 @@ const editorTheme = EditorView.theme({
42988
43138
  ".cm-searchMatch": { backgroundColor: "var(--search-match-bg, color-mix(in srgb, var(--text-color) 16%, transparent))" },
42989
43139
  ".cm-searchMatch-selected": { backgroundColor: "var(--search-current-bg, color-mix(in srgb, var(--text-color) 26%, transparent))" }
42990
43140
  });
42991
- const LIST_LINE = /^[ \t]*(?:[-*+]|\d+[.)])[ \t]/;
42992
- const INDENTED = /^[ \t]/;
43141
+ const QUOTE_PREFIX_RE = /^(?:[ \t]*> ?)+/;
43142
+ const LIST_LINE = /^(?:[ \t]*> ?)*[ \t]*(?:[-*+]|\d+[.)])[ \t]/;
43143
+ const INDENTED = /^(?:[ \t]*> ?)*[ \t]/;
42993
43144
  const MAX_SCAN_LINES = 5e3;
42994
43145
  let patching = false;
42995
43146
  const renumberLists = EditorState.transactionFilter.of((tr) => {
@@ -42998,17 +43149,20 @@ const renumberLists = EditorState.transactionFilter.of((tr) => {
42998
43149
  if (!event || event.startsWith("undo") || event.startsWith("redo")) return tr;
42999
43150
  const before = syntaxTree(tr.startState);
43000
43151
  if (!touchesOrderedList(before, tr.changes)) return tr;
43001
- const range = affectedRange(tr, before);
43002
- const slice = tr.newDoc.sliceString(range.from, range.to);
43152
+ const { oldRange, newRange } = affectedRanges(tr, before);
43153
+ const beforeSlice = tr.startState.doc.sliceString(oldRange.from, oldRange.to);
43154
+ const oldLists = orderedLists(markdownParser.parse(beforeSlice), beforeSlice);
43155
+ const slice = tr.newDoc.sliceString(newRange.from, newRange.to);
43003
43156
  const changes = [];
43004
- for (const list of orderedLists(markdownParser.parse(slice))) {
43005
- if (!needsRenumbering(list, before, tr.changes, range.from)) continue;
43006
- const start = Number.parseInt(slice.slice(list.marks[0].from, list.marks[0].to), 10);
43157
+ for (const list of orderedLists(markdownParser.parse(slice), slice)) {
43158
+ const plan = renumberPlan(list, oldLists, tr.changes, newRange.from, oldRange.from);
43159
+ if (!plan.run) continue;
43160
+ const start = plan.resetToOne ? 1 : Number.parseInt(slice.slice(list.marks[0].from, list.marks[0].to), 10);
43007
43161
  if (!Number.isFinite(start)) continue;
43008
43162
  list.marks.forEach((mark, index2) => {
43009
43163
  const now = slice.slice(mark.from, mark.to);
43010
43164
  const want = `${start + index2}${now.endsWith(")") ? ")" : "."}`;
43011
- if (now !== want) changes.push({ from: range.from + mark.from, to: range.from + mark.to, insert: want });
43165
+ if (now !== want) changes.push({ from: newRange.from + mark.from, to: newRange.from + mark.to, insert: want });
43012
43166
  });
43013
43167
  }
43014
43168
  if (changes.length === 0) return tr;
@@ -43029,18 +43183,47 @@ const renumberLists = EditorState.transactionFilter.of((tr) => {
43029
43183
  patching = false;
43030
43184
  }
43031
43185
  });
43032
- function orderedLists(tree) {
43186
+ function itemHasLazyBreak(item, slice) {
43187
+ let ownEnd = item.to;
43188
+ for (let child = item.firstChild; child; child = child.nextSibling) {
43189
+ if (child.name === "BulletList" || child.name === "OrderedList") {
43190
+ ownEnd = child.from;
43191
+ break;
43192
+ }
43193
+ }
43194
+ const lines = slice.slice(item.from, ownEnd).split("\n");
43195
+ for (let i = 1; i < lines.length; i++) {
43196
+ const body = lines[i].replace(QUOTE_PREFIX_RE, "");
43197
+ if (body.trim() !== "" && !/^[ \t]/.test(body)) return true;
43198
+ }
43199
+ return false;
43200
+ }
43201
+ function orderedLists(tree, slice) {
43033
43202
  const lists = [];
43034
43203
  tree.iterate({
43035
43204
  enter(node) {
43036
43205
  if (node.name !== "OrderedList") return;
43037
- const marks = [];
43206
+ let marks = [];
43207
+ let segFrom = node.from;
43208
+ let segTo = node.from;
43209
+ let splitFromAbove = false;
43210
+ const flush = (nextSplit) => {
43211
+ if (marks.length > 0) lists.push({ from: segFrom, to: segTo, splitFromAbove, marks });
43212
+ marks = [];
43213
+ if (nextSplit) splitFromAbove = true;
43214
+ };
43038
43215
  for (let item = node.node.firstChild; item; item = item.nextSibling) {
43039
43216
  if (item.name !== "ListItem") continue;
43040
43217
  const mark = item.getChild("ListMark");
43041
- if (mark) marks.push({ from: mark.from, to: mark.to });
43218
+ if (!mark) continue;
43219
+ const after = slice[mark.to];
43220
+ if (after !== " " && after !== " ") continue;
43221
+ if (marks.length === 0) segFrom = item.from;
43222
+ marks.push({ from: mark.from, to: mark.to });
43223
+ segTo = item.to;
43224
+ if (itemHasLazyBreak(item, slice)) flush(true);
43042
43225
  }
43043
- if (marks.length > 0) lists.push({ from: node.from, to: node.to, marks });
43226
+ flush(false);
43044
43227
  }
43045
43228
  });
43046
43229
  return lists;
@@ -43067,17 +43250,29 @@ function enclosingOrderedList(tree, pos, side) {
43067
43250
  }
43068
43251
  return null;
43069
43252
  }
43070
- function affectedRange(tr, before) {
43253
+ function affectedRanges(tr, before) {
43071
43254
  let first = -1;
43072
43255
  tr.changes.iterChangedRanges((fromA) => {
43073
43256
  if (first < 0) first = fromA;
43074
43257
  });
43075
- if (first < 0) return { from: 0, to: tr.newDoc.length };
43258
+ if (first < 0) {
43259
+ return {
43260
+ oldRange: { from: 0, to: tr.startState.doc.length },
43261
+ newRange: { from: 0, to: tr.newDoc.length }
43262
+ };
43263
+ }
43076
43264
  let block = before.resolveInner(first, 1);
43077
43265
  while (block && block.parent && block.parent.name !== "Document") block = block.parent;
43078
- const mapped = block ? tr.changes.mapPos(block.from, -1) : first;
43079
- const from = tr.newDoc.lineAt(Math.min(Math.max(mapped, 0), tr.newDoc.length)).from;
43080
- return { from, to: listClusterEnd(tr.newDoc, from) };
43266
+ const oldBase = block ? block.from : first;
43267
+ const oldFrom = tr.startState.doc.lineAt(Math.min(Math.max(oldBase, 0), tr.startState.doc.length)).from;
43268
+ const oldTo = listClusterEnd(tr.startState.doc, oldFrom);
43269
+ const mapped = tr.changes.mapPos(oldBase, -1);
43270
+ const newFrom = tr.newDoc.lineAt(Math.min(Math.max(mapped, 0), tr.newDoc.length)).from;
43271
+ const newTo = listClusterEnd(tr.newDoc, newFrom);
43272
+ return {
43273
+ oldRange: { from: oldFrom, to: oldTo },
43274
+ newRange: { from: newFrom, to: newTo }
43275
+ };
43081
43276
  }
43082
43277
  function listClusterEnd(doc2, from) {
43083
43278
  const first = doc2.lineAt(from);
@@ -43086,7 +43281,8 @@ function listClusterEnd(doc2, from) {
43086
43281
  const stop = Math.min(doc2.lines, first.number + MAX_SCAN_LINES);
43087
43282
  for (let number2 = first.number + 1; number2 <= stop; number2++) {
43088
43283
  const line = doc2.line(number2);
43089
- if (line.text.trim() === "") {
43284
+ const stripped = line.text.replace(QUOTE_PREFIX_RE, "");
43285
+ if (stripped.trim() === "") {
43090
43286
  blank = true;
43091
43287
  end = line.to;
43092
43288
  continue;
@@ -43097,32 +43293,41 @@ function listClusterEnd(doc2, from) {
43097
43293
  }
43098
43294
  return end;
43099
43295
  }
43100
- function needsRenumbering(list, before, changes, offset) {
43101
- const old = enclosingOrderedList(before, changes.mapPos(offset + list.from, -1), 1);
43102
- if (old === null) return true;
43103
- if (countItems(old) !== list.marks.length) return true;
43104
- return touchedMark(changes, old);
43105
- }
43106
- function countItems(list) {
43107
- let count2 = 0;
43108
- for (let item = list.firstChild; item; item = item.nextSibling) {
43109
- if (item.name === "ListItem") count2++;
43296
+ function renumberPlan(list, oldLists, changes, newOffset, oldOffset) {
43297
+ const listNewFrom = newOffset + list.from;
43298
+ const listNewTo = newOffset + list.to;
43299
+ const old = oldLists.find((item) => {
43300
+ const mappedFrom = changes.mapPos(oldOffset + item.from, 1);
43301
+ const mappedTo = changes.mapPos(oldOffset + item.to, -1);
43302
+ return mappedTo >= listNewFrom && mappedFrom <= listNewTo;
43303
+ });
43304
+ if (list.splitFromAbove && old) {
43305
+ const oldFirstMapped = changes.mapPos(oldOffset + old.marks[0].from, 1);
43306
+ if (oldFirstMapped < newOffset + list.marks[0].from) {
43307
+ return { run: true, resetToOne: true };
43308
+ }
43110
43309
  }
43111
- return count2;
43310
+ let touchedThisSegment = false;
43311
+ changes.iterChangedRanges((_fromA, _toA, fromB, toB) => {
43312
+ if (toB >= listNewFrom - 1 && fromB <= listNewTo + 1) touchedThisSegment = true;
43313
+ });
43314
+ if (!touchedThisSegment) return { run: false, resetToOne: false };
43315
+ if (!old) return { run: true, resetToOne: false };
43316
+ if (old.marks.length !== list.marks.length) return { run: true, resetToOne: false };
43317
+ return { run: touchedMark(changes, old, oldOffset), resetToOne: false };
43112
43318
  }
43113
- function touchedMark(changes, list) {
43319
+ function touchedMark(changes, list, oldOffset) {
43114
43320
  let hit = false;
43115
43321
  changes.iterChangedRanges((fromA, toA) => {
43116
43322
  if (hit) return;
43117
- for (let item = list.firstChild; item; item = item.nextSibling) {
43118
- if (item.name !== "ListItem") continue;
43119
- const mark = item.getChild("ListMark");
43120
- if (!mark) continue;
43121
- if (fromA <= mark.from && toA >= mark.from) {
43323
+ for (const raw of list.marks) {
43324
+ const markFrom = oldOffset + raw.from;
43325
+ const markTo = oldOffset + raw.to;
43326
+ if (fromA <= markFrom && toA >= markFrom) {
43122
43327
  hit = true;
43123
43328
  return;
43124
43329
  }
43125
- if (fromA < mark.to && toA > mark.from) {
43330
+ if (fromA < markTo && toA > markFrom) {
43126
43331
  hit = true;
43127
43332
  return;
43128
43333
  }
@@ -43223,7 +43428,9 @@ const taskMarkerAtomicRanges = EditorView.atomicRanges.of((view) => {
43223
43428
  if (node.name !== "TaskMarker") return;
43224
43429
  const line = doc2.lineAt(node.from);
43225
43430
  const prefix = doc2.sliceString(line.from, node.from);
43226
- const from = /^[ \t]*(?:[-*+]|\d+[.)])[ \t]+$/.test(prefix) ? line.from : node.from;
43431
+ const quoteLen = /^(?:[ \t]*> ?)+/.exec(prefix)?.[0].length ?? 0;
43432
+ const listPart = prefix.slice(quoteLen);
43433
+ const from = /^[ \t]*(?:[-*+]|\d+[.)])[ \t]+$/.test(listPart) ? line.from + quoteLen : node.from;
43227
43434
  const trailing = doc2.sliceString(node.to, Math.min(node.to + 1, line.to)) === " " ? node.to + 1 : node.to;
43228
43435
  ranges.push({ from, to: trailing });
43229
43436
  }
@@ -44027,7 +44234,6 @@ async function copyText(text2) {
44027
44234
  const FOOTNOTE_PREVIEW_DELAY = 300;
44028
44235
  const FOOTNOTE_HIDE_GRACE = 120;
44029
44236
  function selectionRendered(view) {
44030
- if (view.contentDOM.querySelector(".cm-gap")) return false;
44031
44237
  const viewport = view.viewport;
44032
44238
  return view.state.selection.ranges.every(
44033
44239
  (range) => range.empty || range.from >= viewport.from && range.to <= viewport.to
@@ -44074,9 +44280,13 @@ function setupRichCopy(root) {
44074
44280
  if (selectionRendered(view)) {
44075
44281
  const html2 = selectionHTML(view, ranges);
44076
44282
  if (html2) event.clipboardData?.setData("text/html", html2);
44283
+ event.preventDefault();
44284
+ return;
44285
+ }
44286
+ if (view.state.doc.length > MAX_RICH_COPY_CHARS) {
44287
+ event.preventDefault();
44077
44288
  return;
44078
44289
  }
44079
- if (view.state.doc.length > MAX_RICH_COPY_CHARS) return;
44080
44290
  event.preventDefault();
44081
44291
  void writeRichCopy(view, ranges, text2);
44082
44292
  });
@@ -44163,7 +44373,7 @@ function setupFootnotePreview(root) {
44163
44373
  }, { passive: true });
44164
44374
  window.addEventListener("resize", hide2);
44165
44375
  }
44166
- const TASK_RE = /^([ \t]*(?:[-*+]|\d+[.)])[ \t]+\[)([ xX])(\])/;
44376
+ const TASK_RE = /^((?:[ \t]*> ?)*[ \t]*(?:[-*+]|\d+[.)])[ \t]+\[)([ xX])(\])/;
44167
44377
  function sourceFromTaskClick(view, e) {
44168
44378
  if (!(e.target instanceof HTMLElement)) return null;
44169
44379
  if (!e.target.closest(".cm-md-task")) return null;
@@ -45896,6 +46106,24 @@ window.__colamdNativeResult = (tag, payload) => {
45896
46106
  function callNative(tag) {
45897
46107
  return new Promise((resolve) => nativeResolvers.set(tag, resolve));
45898
46108
  }
46109
+ window.__colamdIntentFile = (json) => {
46110
+ try {
46111
+ const parsed = JSON.parse(json);
46112
+ if (typeof parsed?.name === "string" && typeof parsed.content === "string") {
46113
+ nativeLog(`intent file received: ${parsed.name} (${parsed.content.length} chars)`);
46114
+ emitFileOpened(parsed.name, parsed.content);
46115
+ return true;
46116
+ }
46117
+ nativeLog(`intent file payload incomplete: ${JSON.stringify(parsed).slice(0, 200)}`);
46118
+ return false;
46119
+ } catch (e) {
46120
+ nativeLog(`intent file JSON parse failed: ${String(e)}`);
46121
+ return false;
46122
+ }
46123
+ };
46124
+ window.__colamdIntentError = (reason) => {
46125
+ nativeLog(`intent read failed: ${reason}`);
46126
+ };
45899
46127
  function nativeBridge() {
45900
46128
  const bridge = window.ColaMDNative;
45901
46129
  if (!bridge || typeof bridge.printDocument !== "function") return null;
@@ -45957,13 +46185,11 @@ async function capModule(name2) {
45957
46185
  try {
45958
46186
  switch (name2) {
45959
46187
  case "@capacitor/filesystem":
45960
- return await __vitePreload(() => import("./index-DrTzZcbo.js"), true ? [] : void 0, import.meta.url);
46188
+ return await __vitePreload(() => import("./index-C5S7E_iS.js"), true ? [] : void 0, import.meta.url);
45961
46189
  case "@capacitor/share":
45962
- return await __vitePreload(() => import("./index-DHfl2nIi.js"), true ? [] : void 0, import.meta.url);
46190
+ return await __vitePreload(() => import("./index-DurJ4oOc.js"), true ? [] : void 0, import.meta.url);
45963
46191
  case "@capacitor/app":
45964
- return await __vitePreload(() => import("./index-IgLPrOn8.js"), true ? [] : void 0, import.meta.url);
45965
- case "@capawesome/capacitor-file-picker":
45966
- return await __vitePreload(() => import("./index-BkfZmH8n.js"), true ? [] : void 0, import.meta.url);
46192
+ return await __vitePreload(() => import("./index-BQRkI4XZ.js"), true ? [] : void 0, import.meta.url);
45967
46193
  default:
45968
46194
  return null;
45969
46195
  }
@@ -45984,21 +46210,13 @@ function createCapacitorAPI() {
45984
46210
  const api = {
45985
46211
  // ── 文件通道(真实现:Documents/colamd/ 虚拟路径) ──
45986
46212
  openFile: async () => {
45987
- const picker = await capModule("@capawesome/capacitor-file-picker");
45988
- if (!picker) return null;
45989
- const picked = await picker.FilePicker.pickFiles({ types: ["text/markdown", "text/plain"], multiple: false, readData: true });
45990
- const file = picked.files[0];
45991
- if (!file) return null;
45992
- let content2 = "";
45993
- if (file.blob) content2 = await file.blob.text();
45994
- else if (file.path) {
45995
- const f = await fs();
45996
- if (!f) return null;
45997
- content2 = (await f.Filesystem.readFile({ path: file.path, directory: f.Directory.Cache })).data;
45998
- }
45999
- const name2 = file.name || "document.md";
46000
- emitFileOpened(name2, content2);
46001
- return { path: `${DOCS_DIR}/${name2}`, content: content2 };
46213
+ const bridge = window.ColaMDNative;
46214
+ if (bridge?.openFilePicker) {
46215
+ bridge.openFilePicker();
46216
+ } else {
46217
+ nativeLog("openFile: openFilePicker bridge unavailable");
46218
+ }
46219
+ return null;
46002
46220
  },
46003
46221
  openFilePath: async (path2) => {
46004
46222
  const f = await fs();
@@ -46013,7 +46231,7 @@ function createCapacitorAPI() {
46013
46231
  getFileManagerName: async () => "system",
46014
46232
  revealFile: noopTrue,
46015
46233
  showEntryContextMenu: noopVoid,
46016
- showTabContextMenu: noopVoid,
46234
+ showTabContextMenu: async (menu) => showTabMenu(menu),
46017
46235
  onTabMenuAction: (cb) => onEvent("tab-menu-action", cb),
46018
46236
  listSiblings: async () => {
46019
46237
  const f = await fs();
@@ -46382,6 +46600,70 @@ function closeMenu() {
46382
46600
  if (panel) panel.classList.remove("open");
46383
46601
  window.setTimeout(() => root.remove(), 200);
46384
46602
  }
46603
+ const TAB_MENU_STYLE_ID = "cola-tab-menu-style";
46604
+ function ensureTabMenuStyle() {
46605
+ if (document.getElementById(TAB_MENU_STYLE_ID)) return;
46606
+ const style = document.createElement("style");
46607
+ style.id = TAB_MENU_STYLE_ID;
46608
+ style.textContent = `
46609
+ .cola-tcm-root { position: fixed; inset: 0; z-index: 2147483000; }
46610
+ .cola-tcm-panel { position: absolute; min-width: 168px; padding: 6px;
46611
+ background: var(--bg-color, #fff); color: var(--text-color, #222);
46612
+ border: 1px solid var(--border-color, #e0e0e0); border-radius: 12px;
46613
+ box-shadow: 0 8px 28px rgba(0, 0, 0, 0.22); font-size: 15px; }
46614
+ .cola-tcm-item { display: block; width: 100%; min-height: 44px; padding: 8px 14px; border: 0; border-radius: 9px;
46615
+ background: transparent; color: inherit; font: inherit; text-align: left; }
46616
+ .cola-tcm-item:active { background: color-mix(in srgb, var(--text-color) 10%, transparent); }
46617
+ .cola-tcm-item[disabled] { opacity: 0.4; }
46618
+ `;
46619
+ document.head.appendChild(style);
46620
+ }
46621
+ let tabMenuEl = null;
46622
+ function closeTabMenu() {
46623
+ tabMenuEl?.remove();
46624
+ tabMenuEl = null;
46625
+ }
46626
+ function showTabMenu(menu) {
46627
+ closeTabMenu();
46628
+ ensureTabMenuStyle();
46629
+ const zh = isChinese();
46630
+ const root = document.createElement("div");
46631
+ root.className = "cola-tcm-root";
46632
+ const panel = document.createElement("div");
46633
+ panel.className = "cola-tcm-panel";
46634
+ const items = [
46635
+ { label: zh ? "关闭" : "Close", action: "close", disabled: false },
46636
+ { label: zh ? "关闭其他" : "Close others", action: "close-others", disabled: !menu.canCloseOthers },
46637
+ { label: zh ? "关闭右侧" : "Close to the right", action: "close-right", disabled: !menu.canCloseRight }
46638
+ ];
46639
+ for (const item of items) {
46640
+ const btn = document.createElement("button");
46641
+ btn.type = "button";
46642
+ btn.className = "cola-tcm-item";
46643
+ btn.textContent = item.label;
46644
+ if (item.disabled) btn.disabled = true;
46645
+ btn.addEventListener("click", () => {
46646
+ closeTabMenu();
46647
+ emitEvent("tab-menu-action", { action: item.action, tabId: menu.tabId });
46648
+ });
46649
+ panel.appendChild(btn);
46650
+ }
46651
+ panel.addEventListener("click", (e) => e.stopPropagation());
46652
+ root.addEventListener("click", closeTabMenu);
46653
+ root.appendChild(panel);
46654
+ document.body.appendChild(root);
46655
+ tabMenuEl = root;
46656
+ const entry = document.querySelector(`.tab-entry[data-tab-id="${menu.tabId}"]`);
46657
+ const rect = entry?.getBoundingClientRect();
46658
+ const pw = panel.offsetWidth;
46659
+ if (rect) {
46660
+ panel.style.left = `${Math.round(Math.min(Math.max(8, rect.left + rect.width / 2 - pw / 2), window.innerWidth - pw - 8))}px`;
46661
+ panel.style.top = `${Math.round(rect.bottom + 4)}px`;
46662
+ } else {
46663
+ panel.style.left = `${Math.round((window.innerWidth - pw) / 2)}px`;
46664
+ panel.style.top = "80px";
46665
+ }
46666
+ }
46385
46667
  installCapacitorAPI();
46386
46668
  startIntentPolling();
46387
46669
  if (isAndroidApp()) {
@@ -46672,10 +46954,16 @@ function plusGlyph() {
46672
46954
  return svg;
46673
46955
  }
46674
46956
  function renderTabBar() {
46957
+ if (isAndroidApp()) {
46958
+ tabBarEl().hidden = true;
46959
+ return;
46960
+ }
46675
46961
  captureActiveTab();
46676
46962
  const bar = tabBarEl();
46677
46963
  bar.hidden = false;
46678
- document.documentElement.style.setProperty("--tab-bar-height", "0px");
46964
+ if (!isAndroidApp()) {
46965
+ document.documentElement.style.setProperty("--tab-bar-height", "0px");
46966
+ }
46679
46967
  document.documentElement.style.setProperty("--editor-top-gap", "0px");
46680
46968
  bar.innerHTML = "";
46681
46969
  hideTabTip();