@blocknote/core 0.53.0 → 0.54.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (197) hide show
  1. package/dist/BlockNoteExtension-BJCLnwrE.cjs +2 -0
  2. package/dist/BlockNoteExtension-BJCLnwrE.cjs.map +1 -0
  3. package/dist/BlockNoteExtension-CbvDA0F7.js +80 -0
  4. package/dist/BlockNoteExtension-CbvDA0F7.js.map +1 -0
  5. package/dist/{UserStore-QbbPFj0z.js → UserStore-C4TzkGEn.js} +3 -3
  6. package/dist/{UserStore-DCG6lsla.cjs.map → UserStore-C4TzkGEn.js.map} +1 -1
  7. package/dist/{UserStore-DCG6lsla.cjs → UserStore-mj3fXW4D.cjs} +2 -2
  8. package/dist/UserStore-mj3fXW4D.cjs.map +1 -0
  9. package/dist/blocknote.cjs +1 -1
  10. package/dist/blocknote.js +6 -6
  11. package/dist/{blocks-BEJW9OM_.js → blocks-CzQLehlc.js} +571 -568
  12. package/dist/blocks-CzQLehlc.js.map +1 -0
  13. package/dist/blocks-CzkqclGj.cjs +12 -0
  14. package/dist/blocks-CzkqclGj.cjs.map +1 -0
  15. package/dist/blocks.cjs +1 -1
  16. package/dist/blocks.js +2 -2
  17. package/dist/comments.cjs +1 -1
  18. package/dist/comments.cjs.map +1 -1
  19. package/dist/comments.js +7 -7
  20. package/dist/comments.js.map +1 -1
  21. package/dist/en-BuzSuuTq.cjs +2 -0
  22. package/dist/en-BuzSuuTq.cjs.map +1 -0
  23. package/dist/{en-CGKXfWma.js → en-uzHzj6eH.js} +10 -1
  24. package/dist/en-uzHzj6eH.js.map +1 -0
  25. package/dist/extensions-CSB9ZvuL.cjs +58 -0
  26. package/dist/extensions-CSB9ZvuL.cjs.map +1 -0
  27. package/dist/{extensions-BR5hkAio.js → extensions-DGuhtOgB.js} +662 -427
  28. package/dist/extensions-DGuhtOgB.js.map +1 -0
  29. package/dist/extensions.cjs +1 -1
  30. package/dist/extensions.js +4 -4
  31. package/dist/locales.cjs +1 -1
  32. package/dist/locales.cjs.map +1 -1
  33. package/dist/locales.js +199 -1
  34. package/dist/locales.js.map +1 -1
  35. package/dist/{src-BUXut68d.js → src-BkfZVfaO.js} +967 -899
  36. package/dist/src-BkfZVfaO.js.map +1 -0
  37. package/dist/src-DM3syMdf.cjs +23 -0
  38. package/dist/src-DM3syMdf.cjs.map +1 -0
  39. package/dist/style.css +1 -1
  40. package/dist/webpack-stats.json +1 -1
  41. package/dist/y.cjs +1 -1
  42. package/dist/y.cjs.map +1 -1
  43. package/dist/y.js +59 -56
  44. package/dist/y.js.map +1 -1
  45. package/dist/yjs.cjs +1 -1
  46. package/dist/yjs.cjs.map +1 -1
  47. package/dist/yjs.js +88 -76
  48. package/dist/yjs.js.map +1 -1
  49. package/package.json +17 -18
  50. package/src/api/blockManipulation/commands/updateBlock/__snapshots__/updateBlock.test.ts.snap +2505 -763
  51. package/src/api/blockManipulation/commands/updateBlock/updateBlock.test.ts +42 -0
  52. package/src/api/blockManipulation/commands/updateBlock/updateBlock.ts +16 -4
  53. package/src/api/exporters/markdown/htmlToMarkdown.ts +45 -10
  54. package/src/api/nodeConversions/blockToNode.ts +5 -1
  55. package/src/api/nodeConversions/nodeToBlock.ts +3 -0
  56. package/src/api/pmUtil.ts +16 -8
  57. package/src/blocks/Code/CodeBlockOptions.ts +83 -0
  58. package/src/blocks/Code/block.test.ts +1 -1
  59. package/src/blocks/Code/block.ts +29 -281
  60. package/src/blocks/Code/helpers/extensions/CodeKeyboardShortcutsExtension.ts +120 -0
  61. package/src/blocks/Code/helpers/parse/parsePreCode.ts +45 -0
  62. package/src/blocks/Code/helpers/render/createCodeBlock.ts +98 -0
  63. package/src/blocks/Code/helpers/toExternalHTML/createPreCode.ts +14 -0
  64. package/src/blocks/index.ts +3 -0
  65. package/src/comments/extension.ts +2 -4
  66. package/src/editor/Block.css +273 -2
  67. package/src/editor/BlockNoteEditor.ts +25 -4
  68. package/src/editor/BlockNoteExtension.ts +1 -1
  69. package/src/editor/managers/ExtensionManager/extensions.ts +6 -0
  70. package/src/exporter/ExportImage.ts +50 -0
  71. package/src/exporter/Exporter.test.ts +48 -0
  72. package/src/exporter/Exporter.ts +46 -12
  73. package/src/exporter/index.ts +1 -0
  74. package/src/exporter/mapping.ts +4 -1
  75. package/src/extensions/FormattingToolbar/FormattingToolbar.ts +10 -8
  76. package/src/extensions/InlineContentBoundaryEdit/InlineContentBoundaryEdit.ts +109 -0
  77. package/src/extensions/SourceBlockWithPreview/SourceBlockWithPreview.ts +192 -0
  78. package/src/extensions/SourceInlineContentWithPreview/SourceInlineContentWithPreview.ts +142 -0
  79. package/src/extensions/SyntaxHighlighting/SyntaxHighlighting.test.ts +120 -0
  80. package/src/extensions/SyntaxHighlighting/SyntaxHighlighting.ts +89 -0
  81. package/src/extensions/SyntaxHighlighting/inlineHighlight.test.ts +135 -0
  82. package/src/extensions/SyntaxHighlighting/shiki.ts +116 -0
  83. package/src/extensions/Versioning/inMemoryVersioning.ts +13 -3
  84. package/src/extensions/index.ts +4 -0
  85. package/src/extensions/tiptap-extensions/KeyboardShortcuts/KeyboardShortcutsExtension.test.ts +51 -2
  86. package/src/extensions/tiptap-extensions/KeyboardShortcuts/KeyboardShortcutsExtension.ts +22 -2
  87. package/src/i18n/locales/ar.ts +9 -0
  88. package/src/i18n/locales/de.ts +9 -0
  89. package/src/i18n/locales/en.ts +9 -0
  90. package/src/i18n/locales/es.ts +9 -0
  91. package/src/i18n/locales/fa.ts +9 -0
  92. package/src/i18n/locales/fr.ts +9 -0
  93. package/src/i18n/locales/he.ts +9 -0
  94. package/src/i18n/locales/hr.ts +9 -0
  95. package/src/i18n/locales/is.ts +9 -0
  96. package/src/i18n/locales/it.ts +9 -0
  97. package/src/i18n/locales/ja.ts +9 -0
  98. package/src/i18n/locales/ko.ts +9 -0
  99. package/src/i18n/locales/nl.ts +9 -0
  100. package/src/i18n/locales/no.ts +9 -0
  101. package/src/i18n/locales/pl.ts +9 -0
  102. package/src/i18n/locales/pt.ts +9 -0
  103. package/src/i18n/locales/ru.ts +9 -0
  104. package/src/i18n/locales/sk.ts +9 -0
  105. package/src/i18n/locales/uk.ts +9 -0
  106. package/src/i18n/locales/uz.ts +9 -0
  107. package/src/i18n/locales/vi.ts +9 -0
  108. package/src/i18n/locales/zh-tw.ts +9 -0
  109. package/src/i18n/locales/zh.ts +9 -0
  110. package/src/index.ts +5 -1
  111. package/src/schema/blocks/createSpec.ts +2 -3
  112. package/src/schema/blocks/types.ts +53 -3
  113. package/src/schema/contentTypePropagation.test.ts +1 -1
  114. package/src/schema/inlineContent/createSpec.test.ts +161 -0
  115. package/src/schema/inlineContent/createSpec.ts +171 -12
  116. package/src/schema/inlineContent/internal.ts +21 -2
  117. package/src/schema/inlineContent/types.ts +35 -5
  118. package/src/user/UserStore.ts +1 -1
  119. package/src/util/Store.test.ts +132 -0
  120. package/src/util/Store.ts +135 -0
  121. package/src/y/extensions/AttributionExtension.test.ts +10 -0
  122. package/src/y/extensions/Versioning.test.ts +20 -7
  123. package/src/yjs/comments/RESTYjsThreadStore.test.ts +85 -0
  124. package/src/yjs/comments/RESTYjsThreadStore.ts +7 -1
  125. package/src/yjs/extensions/ForkYDoc.test.ts +37 -0
  126. package/src/yjs/extensions/ForkYDoc.ts +26 -1
  127. package/src/yjs/extensions/RelativePositionMapping.ts +8 -2
  128. package/src/yjs/extensions/Versioning.test.ts +17 -5
  129. package/types/src/api/pmUtil.d.ts +7 -7
  130. package/types/src/blocks/Code/CodeBlockOptions.d.ts +61 -0
  131. package/types/src/blocks/Code/block.d.ts +3 -53
  132. package/types/src/blocks/Code/helpers/extensions/CodeKeyboardShortcutsExtension.d.ts +35 -0
  133. package/types/src/blocks/Code/helpers/parse/parsePreCode.d.ts +8 -0
  134. package/types/src/blocks/Code/helpers/render/createCodeBlock.d.ts +18 -0
  135. package/types/src/blocks/Code/helpers/toExternalHTML/createPreCode.d.ts +5 -0
  136. package/types/src/blocks/index.d.ts +3 -0
  137. package/types/src/comments/extension.d.ts +1 -15
  138. package/types/src/editor/BlockNoteEditor.d.ts +3 -3
  139. package/types/src/editor/BlockNoteExtension.d.ts +1 -1
  140. package/types/src/exporter/ExportImage.d.ts +36 -0
  141. package/types/src/exporter/Exporter.d.ts +21 -0
  142. package/types/src/exporter/Exporter.test.d.ts +1 -0
  143. package/types/src/exporter/index.d.ts +1 -0
  144. package/types/src/exporter/mapping.d.ts +1 -1
  145. package/types/src/extensions/FilePanel/FilePanel.d.ts +1 -1
  146. package/types/src/extensions/FormattingToolbar/FormattingToolbar.d.ts +1 -1
  147. package/types/src/extensions/InlineContentBoundaryEdit/InlineContentBoundaryEdit.d.ts +5 -0
  148. package/types/src/extensions/ShowSelection/ShowSelection.d.ts +1 -5
  149. package/types/src/extensions/SideMenu/SideMenu.d.ts +1 -1
  150. package/types/src/extensions/SourceBlockWithPreview/SourceBlockWithPreview.d.ts +45 -0
  151. package/types/src/extensions/SourceInlineContentWithPreview/SourceInlineContentWithPreview.d.ts +49 -0
  152. package/types/src/extensions/SuggestionMenu/SuggestionMenu.d.ts +1 -11
  153. package/types/src/extensions/SyntaxHighlighting/SyntaxHighlighting.d.ts +44 -0
  154. package/types/src/extensions/SyntaxHighlighting/SyntaxHighlighting.test.d.ts +1 -0
  155. package/types/src/extensions/SyntaxHighlighting/inlineHighlight.test.d.ts +1 -0
  156. package/types/src/extensions/SyntaxHighlighting/shiki.d.ts +13 -0
  157. package/types/src/extensions/TableHandles/TableHandles.d.ts +1 -1
  158. package/types/src/extensions/Versioning/Versioning.d.ts +1 -35
  159. package/types/src/extensions/index.d.ts +4 -0
  160. package/types/src/i18n/locales/en.d.ts +9 -0
  161. package/types/src/i18n/locales/fa.d.ts +9 -0
  162. package/types/src/i18n/locales/sk.d.ts +9 -0
  163. package/types/src/index.d.ts +2 -1
  164. package/types/src/schema/blocks/types.d.ts +36 -3
  165. package/types/src/schema/inlineContent/createSpec.d.ts +35 -3
  166. package/types/src/schema/inlineContent/createSpec.test.d.ts +1 -0
  167. package/types/src/schema/inlineContent/internal.d.ts +3 -2
  168. package/types/src/schema/inlineContent/types.d.ts +22 -3
  169. package/types/src/user/UserStore.d.ts +1 -1
  170. package/types/src/util/Store.d.ts +45 -0
  171. package/types/src/util/Store.test.d.ts +1 -0
  172. package/types/src/y/extensions/AttributionExtension.d.ts +1 -1
  173. package/types/src/y/extensions/DiffVersioningExtension.d.ts +1 -1
  174. package/types/src/y/extensions/ForkYDoc.d.ts +1 -5
  175. package/types/src/y/extensions/index.d.ts +2 -10
  176. package/types/src/yjs/comments/RESTYjsThreadStore.test.d.ts +1 -0
  177. package/types/src/yjs/extensions/ForkYDoc.d.ts +1 -5
  178. package/types/src/yjs/extensions/index.d.ts +1 -5
  179. package/dist/BlockNoteExtension-B_IEJHS8.js +0 -38
  180. package/dist/BlockNoteExtension-B_IEJHS8.js.map +0 -1
  181. package/dist/BlockNoteExtension-M0znTzxP.cjs +0 -2
  182. package/dist/BlockNoteExtension-M0znTzxP.cjs.map +0 -1
  183. package/dist/UserStore-QbbPFj0z.js.map +0 -1
  184. package/dist/blocks-BEJW9OM_.js.map +0 -1
  185. package/dist/blocks-BPmJglFo.cjs +0 -12
  186. package/dist/blocks-BPmJglFo.cjs.map +0 -1
  187. package/dist/en-C5Z4Ag9_.cjs +0 -2
  188. package/dist/en-C5Z4Ag9_.cjs.map +0 -1
  189. package/dist/en-CGKXfWma.js.map +0 -1
  190. package/dist/extensions-AitWbYdJ.cjs +0 -52
  191. package/dist/extensions-AitWbYdJ.cjs.map +0 -1
  192. package/dist/extensions-BR5hkAio.js.map +0 -1
  193. package/dist/src-BHPuOo7W.cjs +0 -21
  194. package/dist/src-BHPuOo7W.cjs.map +0 -1
  195. package/dist/src-BUXut68d.js.map +0 -1
  196. package/src/blocks/Code/shiki.ts +0 -73
  197. package/types/src/blocks/Code/shiki.d.ts +0 -4
@@ -1,61 +1,63 @@
1
- import { At as e, Bt as t, Ft as n, Ht as r, It as i, Lt as a, Nt as o, Pt as s, Rt as c, Sn as l, Ut as u, Vt as d, Wt as f, _ as p, g as m, jt as h, nr as g, r as ee, v as _, xn as v, zn as te, zt as ne } from "./blocks-BEJW9OM_.js";
2
- import { n as y, t as b } from "./BlockNoteExtension-B_IEJHS8.js";
3
- import { n as re } from "./UserStore-QbbPFj0z.js";
4
- import { DOMSerializer as ie, Fragment as ae, Slice as oe } from "prosemirror-model";
5
- import { Mapping as x, dropPoint as se } from "prosemirror-transform";
1
+ import { Bt as e, En as t, Ft as n, Gt as r, Ht as i, Jt as a, Kt as o, Lt as s, Pt as c, Rt as l, Tn as u, Un as d, Ut as f, Vt as p, Wt as m, _ as h, g, or as _, qt as ee, r as te, v, zt as ne } from "./blocks-CzQLehlc.js";
2
+ import { n as y, t as b } from "./BlockNoteExtension-CbvDA0F7.js";
3
+ import { n as re } from "./UserStore-C4TzkGEn.js";
4
+ import { DOMSerializer as ie, Fragment as x, Slice as ae } from "prosemirror-model";
5
+ import { Mapping as oe, dropPoint as se } from "prosemirror-transform";
6
6
  import { combineTransactionSteps as ce, findChildrenInRange as S, posToDOMRect as le } from "@tiptap/core";
7
7
  import { uuidv4 as ue } from "lib0/random";
8
- import { NodeSelection as de, Plugin as C, PluginKey as w, Selection as T, TextSelection as fe } from "prosemirror-state";
9
- import { DOMParser as pe, Slice as me } from "@tiptap/pm/model";
10
- import { CellSelection as he, addColumnAfter as ge, addColumnBefore as _e, addRowAfter as ve, addRowBefore as ye, deleteColumn as be, deleteRow as xe, mergeCells as Se, splitCell as Ce } from "prosemirror-tables";
11
- import { Plugin as we, PluginKey as Te, TextSelection as Ee } from "@tiptap/pm/state";
12
- import { Decoration as E, DecorationSet as D } from "prosemirror-view";
13
- import De from "fast-deep-equal";
14
- import { history as Oe, redo as ke, undo as Ae } from "@tiptap/pm/history";
15
- function je(e) {
8
+ import { NodeSelection as de, Plugin as C, PluginKey as w, Selection as T, TextSelection as E } from "prosemirror-state";
9
+ import { DOMParser as fe, Slice as pe } from "@tiptap/pm/model";
10
+ import { CellSelection as me, addColumnAfter as he, addColumnBefore as ge, addRowAfter as _e, addRowBefore as ve, deleteColumn as ye, deleteRow as be, mergeCells as xe, splitCell as Se } from "prosemirror-tables";
11
+ import { Plugin as Ce, PluginKey as we, TextSelection as Te } from "@tiptap/pm/state";
12
+ import { Decoration as D, DecorationSet as O } from "prosemirror-view";
13
+ import Ee from "fast-deep-equal";
14
+ import { history as De, redo as Oe, undo as ke } from "@tiptap/pm/history";
15
+ import { createHighlightPlugin as Ae } from "prosemirror-highlight";
16
+ import { createParser as je } from "prosemirror-highlight/shiki";
17
+ function Me(e) {
16
18
  let t = Array.from(e.classList).filter((e) => !e.startsWith("bn-")) || [];
17
19
  t.length > 0 ? e.className = t.join(" ") : e.removeAttribute("class");
18
20
  }
19
- function Me(e, t, n, r) {
20
- let i;
21
- if (!t) throw Error("blockContent is required");
22
- if (typeof t == "string") i = o([t], e.pmSchema, r?.blockType);
23
- else if (Array.isArray(t)) i = o(t, e.pmSchema, r?.blockType);
24
- else if (t.type === "tableContent") i = s(t, e.pmSchema);
25
- else throw new te(t.type);
26
- let a = (r?.document ?? document).createDocumentFragment();
27
- for (let t of i) if (t.type.name !== "text" && e.schema.inlineContentSchema[t.type.name]) {
28
- let i = e.schema.inlineContentSpecs[t.type.name].implementation;
29
- if (i) {
30
- let o = l(t, e.schema.inlineContentSchema, e.schema.styleSchema), s = i.toExternalHTML ? i.toExternalHTML(o, e) : i.render.call({
21
+ function Ne(e, n, r, i) {
22
+ let a;
23
+ if (!n) throw Error("blockContent is required");
24
+ if (typeof n == "string") a = s([n], e.pmSchema, i?.blockType);
25
+ else if (Array.isArray(n)) a = s(n, e.pmSchema, i?.blockType);
26
+ else if (n.type === "tableContent") a = l(n, e.pmSchema);
27
+ else throw new d(n.type);
28
+ let o = (i?.document ?? document).createDocumentFragment();
29
+ for (let n of a) if (n.type.name !== "text" && e.schema.inlineContentSchema[n.type.name]) {
30
+ let a = e.schema.inlineContentSpecs[n.type.name].implementation;
31
+ if (a) {
32
+ let s = t(n, e.schema.inlineContentSchema, e.schema.styleSchema), c = a.toExternalHTML ? a.toExternalHTML(s, e) : a.render.call({
31
33
  renderType: "dom",
32
34
  props: void 0
33
- }, o, () => {}, e);
34
- if (s) {
35
- if (a.appendChild(s.dom), s.contentDOM) {
36
- let e = n.serializeFragment(t.content, r);
37
- s.contentDOM.dataset.editable = "", s.contentDOM.appendChild(e);
35
+ }, s, () => {}, e);
36
+ if (c) {
37
+ if (o.appendChild(c.dom), c.contentDOM) {
38
+ let e = r.serializeFragment(n.content, i);
39
+ c.contentDOM.dataset.editable = "", c.contentDOM.appendChild(e);
38
40
  }
39
41
  continue;
40
42
  }
41
43
  }
42
- } else if (t.type.name === "text") {
43
- let n = document.createTextNode(t.textContent);
44
- for (let r of t.marks.toReversed()) if (r.type.name in e.schema.styleSpecs) {
45
- let t = (e.schema.styleSpecs[r.type.name].implementation.toExternalHTML ?? e.schema.styleSpecs[r.type.name].implementation.render)(r.attrs.stringValue, e);
46
- t.contentDOM.appendChild(n), n = t.dom;
44
+ } else if (n.type.name === "text") {
45
+ let t = document.createTextNode(n.textContent);
46
+ for (let r of n.marks.toReversed()) if (r.type.name in e.schema.styleSpecs) {
47
+ let n = (e.schema.styleSpecs[r.type.name].implementation.toExternalHTML ?? e.schema.styleSpecs[r.type.name].implementation.render)(r.attrs.stringValue, e);
48
+ n.contentDOM.appendChild(t), t = n.dom;
47
49
  } else {
48
- let e = r.type.spec.toDOM(r, !0), t = ie.renderSpec(document, e);
49
- t.contentDOM.appendChild(n), n = t.dom;
50
+ let e = r.type.spec.toDOM(r, !0), n = ie.renderSpec(document, e);
51
+ n.contentDOM.appendChild(t), t = n.dom;
50
52
  }
51
- a.appendChild(n);
53
+ o.appendChild(t);
52
54
  } else {
53
- let e = n.serializeFragment(ae.from([t]), r);
54
- a.appendChild(e);
55
+ let e = r.serializeFragment(x.from([n]), i);
56
+ o.appendChild(e);
55
57
  }
56
- return a.childNodes.length === 1 && a.firstChild?.nodeType === 1 && je(a.firstChild), a;
58
+ return o.childNodes.length === 1 && o.firstChild?.nodeType === 1 && Me(o.firstChild), o;
57
59
  }
58
- function Ne(e, t, n, r, i, a, o, s) {
60
+ function Pe(e, t, n, r, i, a, o, s) {
59
61
  let c = s?.document ?? document, l = t.pmSchema.nodes.blockContainer, u = n.props || {};
60
62
  for (let [e, r] of Object.entries(t.schema.blockSchema[n.type].propSchema)) !(e in u) && r.default !== void 0 && (u[e] = r.default);
61
63
  let d = l.spec?.toDOM?.(l.create({
@@ -71,11 +73,11 @@ function Ne(e, t, n, r, i, a, o, s) {
71
73
  if (m.dom.classList.contains("bn-block-content")) {
72
74
  let e = [...f, ...Array.from(m.dom.attributes)].filter((e) => e.name.startsWith("data") && e.name !== "data-content-type" && e.name !== "data-file-block" && e.name !== "data-node-view-wrapper" && e.name !== "data-node-type" && e.name !== "data-id" && e.name !== "data-editable");
73
75
  for (let t of e) m.dom.firstChild.setAttribute(t.name, t.value);
74
- je(m.dom.firstChild), o > 0 && m.dom.firstChild.setAttribute("data-nesting-level", o.toString()), h.append(...Array.from(m.dom.childNodes));
76
+ Me(m.dom.firstChild), o > 0 && m.dom.firstChild.setAttribute("data-nesting-level", o.toString()), h.append(...Array.from(m.dom.childNodes));
75
77
  } else h.append(m.dom), o > 0 && m.dom.setAttribute("data-nesting-level", o.toString());
76
78
  if (m.contentDOM) {
77
79
  if (n.content) {
78
- let e = Me(t, n.content, r, {
80
+ let e = Ne(t, n.content, r, {
79
81
  ...s,
80
82
  blockType: n.type
81
83
  });
@@ -94,20 +96,20 @@ function Ne(e, t, n, r, i, a, o, s) {
94
96
  } else e.append(h);
95
97
  if (n.children && n.children.length > 0) {
96
98
  let l = c.createDocumentFragment();
97
- if (O(l, t, n.children, r, i, a, o + 1, s), e.lastChild?.nodeName === "UL" || e.lastChild?.nodeName === "OL") for (; l.firstChild?.nodeName === "UL" || l.firstChild?.nodeName === "OL";) e.lastChild.lastChild.appendChild(l.firstChild);
99
+ if (Fe(l, t, n.children, r, i, a, o + 1, s), e.lastChild?.nodeName === "UL" || e.lastChild?.nodeName === "OL") for (; l.firstChild?.nodeName === "UL" || l.firstChild?.nodeName === "OL";) e.lastChild.lastChild.appendChild(l.firstChild);
98
100
  "childrenDOM" in m && m.childrenDOM ? m.childrenDOM.append(l) : t.pmSchema.nodes[n.type].isInGroup("blockContent") ? e.append(l) : m.contentDOM?.append(l);
99
101
  }
100
102
  }
101
- var O = (e, t, n, r, i, a, o = 0, s) => {
102
- for (let c of n) Ne(e, t, c, r, i, a, o, s);
103
- }, Pe = (e, t, n, r, i, a) => {
103
+ var Fe = (e, t, n, r, i, a, o = 0, s) => {
104
+ for (let c of n) Pe(e, t, c, r, i, a, o, s);
105
+ }, Ie = (e, t, n, r, i, a) => {
104
106
  let o = (a?.document ?? document).createDocumentFragment();
105
- return O(o, e, t, n, r, i, 0, a), o;
107
+ return Fe(o, e, t, n, r, i, 0, a), o;
106
108
  }, k = (e, t) => {
107
109
  let n = ie.fromSchema(e);
108
110
  return {
109
111
  exportBlocks: (e, r) => {
110
- let i = Pe(t, e, n, new Set(["numberedListItem"]), new Set([
112
+ let i = Ie(t, e, n, /* @__PURE__ */ new Set(["numberedListItem"]), /* @__PURE__ */ new Set([
111
113
  "bulletListItem",
112
114
  "checkListItem",
113
115
  "toggleListItem"
@@ -115,41 +117,41 @@ var O = (e, t, n, r, i, a, o = 0, s) => {
115
117
  return a.append(i), a.innerHTML;
116
118
  },
117
119
  exportInlineContent: (e, r) => {
118
- let i = Me(t, e, n, r), a = document.createElement("div");
120
+ let i = Ne(t, e, n, r), a = document.createElement("div");
119
121
  return a.append(i.cloneNode(!0)), a.innerHTML;
120
122
  }
121
123
  };
122
124
  };
123
125
  //#endregion
124
126
  //#region src/api/getBlocksChangedByTransaction.ts
125
- function Fe(e, t) {
127
+ function Le(e, t) {
126
128
  if (t === 0) return;
127
- let n = e.resolve(t);
128
- for (let t = n.depth; t > 0; t--) {
129
- let r = n.node(t);
130
- if (h(r)) return g(r, e);
129
+ let r = e.resolve(t);
130
+ for (let t = r.depth; t > 0; t--) {
131
+ let i = r.node(t);
132
+ if (n(i)) return _(i, e);
131
133
  }
132
134
  }
133
- function Ie(e) {
135
+ function Re(e) {
134
136
  return e.getMeta("paste") ? { type: "paste" } : e.getMeta("uiEvent") === "drop" ? { type: "drop" } : e.getMeta("history$") ? { type: e.getMeta("history$").redo ? "redo" : "undo" } : e.getMeta("y-sync$") ? e.getMeta("y-sync$").isUndoRedoOperation ? { type: "undo-redo" } : { type: "yjs-remote" } : { type: "local" };
135
137
  }
136
- function A(e) {
137
- let t = {}, n = {};
138
- return e.descendants((r, i) => {
139
- if (!h(r)) return !0;
140
- let a = Fe(e, i), o = a ?? "__root__";
141
- n[o] || (n[o] = []);
142
- let s = v(r, e), c = g(r, e);
143
- return t[c] = {
144
- block: s,
145
- parentId: a
146
- }, n[o].push(c), !0;
138
+ function ze(e) {
139
+ let t = {}, r = {};
140
+ return e.descendants((i, a) => {
141
+ if (!n(i)) return !0;
142
+ let o = Le(e, a), s = o ?? "__root__";
143
+ r[s] || (r[s] = []);
144
+ let c = u(i, e), l = _(i, e);
145
+ return t[l] = {
146
+ block: c,
147
+ parentId: o
148
+ }, r[s].push(l), !0;
147
149
  }), {
148
150
  byId: t,
149
- childrenByParent: n
151
+ childrenByParent: r
150
152
  };
151
153
  }
152
- function Le(e, t) {
154
+ function Be(e, t) {
153
155
  let n = /* @__PURE__ */ new Set();
154
156
  if (!e || !t) return n;
155
157
  let r = new Set(e), i = t.filter((e) => r.has(e)), a = e.filter((e) => i.includes(e));
@@ -173,8 +175,8 @@ function Le(e, t) {
173
175
  for (let e = 0; e < i.length; e++) p.has(e) || n.add(i[e]);
174
176
  return n;
175
177
  }
176
- function Re(e, t = []) {
177
- let n = Ie(e), r = ce(e.before, [e, ...t]), i = A(r.before), a = A(r.doc), o = [], s = /* @__PURE__ */ new Set();
178
+ function Ve(e, t = []) {
179
+ let n = Re(e), r = ce(e.before, [e, ...t]), i = ze(r.before), a = ze(r.doc), o = [], s = /* @__PURE__ */ new Set();
178
180
  Object.keys(a.byId).filter((e) => !(e in i.byId)).forEach((e) => {
179
181
  o.push({
180
182
  type: "insert",
@@ -191,7 +193,7 @@ function Re(e, t = []) {
191
193
  }), s.add(e);
192
194
  }), Object.keys(a.byId).filter((e) => e in i.byId).forEach((e) => {
193
195
  let t = i.byId[e], r = a.byId[e];
194
- t.parentId === r.parentId ? De({
196
+ t.parentId === r.parentId ? Ee({
195
197
  ...t.block,
196
198
  children: void 0
197
199
  }, {
@@ -211,9 +213,9 @@ function Re(e, t = []) {
211
213
  currentParent: r.parentId ? a.byId[r.parentId]?.block : void 0
212
214
  }), s.add(e));
213
215
  });
214
- let c = i.childrenByParent, l = a.childrenByParent, u = new Set([...Object.keys(c), ...Object.keys(l)]), d = /* @__PURE__ */ new Set();
216
+ let c = i.childrenByParent, l = a.childrenByParent, u = /* @__PURE__ */ new Set([...Object.keys(c), ...Object.keys(l)]), d = /* @__PURE__ */ new Set();
215
217
  return u.forEach((e) => {
216
- let t = Le(c[e], l[e]);
218
+ let t = Be(c[e], l[e]);
217
219
  t.size !== 0 && t.forEach((t) => {
218
220
  let r = i.byId[t], c = a.byId[t];
219
221
  !r || !c || r.parentId === c.parentId && (s.has(t) || (r.parentId ?? "__root__") === e && (d.has(t) || (d.add(t), o.push({
@@ -229,7 +231,7 @@ function Re(e, t = []) {
229
231
  }
230
232
  //#endregion
231
233
  //#region src/extensions/BlockChange/BlockChange.ts
232
- var ze = b(() => {
234
+ var He = b(() => {
233
235
  let e = [];
234
236
  return {
235
237
  key: "blockChange",
@@ -239,7 +241,7 @@ var ze = b(() => {
239
241
  let n;
240
242
  return e.reduce((e, r) => e === !1 ? e : r({
241
243
  getChanges() {
242
- return n || (n = Re(t), n);
244
+ return n || (n = Ve(t), n);
243
245
  },
244
246
  tr: t
245
247
  }) !== !1, !0);
@@ -254,10 +256,10 @@ var ze = b(() => {
254
256
  });
255
257
  //#endregion
256
258
  //#region src/extensions/DropCursor/utils.ts
257
- function Be(e, t) {
259
+ function Ue(e, t) {
258
260
  return !e || !t ? !1 : !!e.closest(`.${t}`);
259
261
  }
260
- function Ve(e, t, n, r, i) {
262
+ function We(e, t, n, r, i) {
261
263
  let a = e.state.doc.resolve(t.pos);
262
264
  if (a.parent.inlineContent || t.orientation === "inline") return null;
263
265
  let o = a.nodeBefore, s = a.nodeAfter;
@@ -284,7 +286,7 @@ function Ve(e, t, n, r, i) {
284
286
  bottom: f + p
285
287
  };
286
288
  }
287
- function He(e, t, n, r) {
289
+ function Ge(e, t, n, r) {
288
290
  let i = e.coordsAtPos(t.pos), a = n / 2 * r;
289
291
  return {
290
292
  left: i.left - a,
@@ -293,10 +295,10 @@ function He(e, t, n, r) {
293
295
  bottom: i.bottom
294
296
  };
295
297
  }
296
- function Ue(e, t) {
298
+ function Ke(e, t) {
297
299
  e.classList.toggle("prosemirror-dropcursor-inline", t === "inline"), e.classList.toggle("prosemirror-dropcursor-block-horizontal", t === "block-horizontal"), e.classList.toggle("prosemirror-dropcursor-block-vertical-left", t === "block-vertical-left"), e.classList.toggle("prosemirror-dropcursor-block-vertical-right", t === "block-vertical-right"), e.classList.toggle("prosemirror-dropcursor-block", t === "block-horizontal"), e.classList.toggle("prosemirror-dropcursor-vertical", t === "block-vertical-left" || t === "block-vertical-right");
298
300
  }
299
- function We(e) {
301
+ function qe(e) {
300
302
  if (!e || e === document.body && getComputedStyle(e).position === "static") return {
301
303
  parentLeft: -window.pageXOffset,
302
304
  parentTop: -window.pageYOffset
@@ -309,19 +311,19 @@ function We(e) {
309
311
  }
310
312
  //#endregion
311
313
  //#region src/extensions/DropCursor/DropCursor.ts
312
- var Ge = "bn-drag-exclude", Ke = b(({ editor: e, options: t }) => {
314
+ var Je = "bn-drag-exclude", Ye = b(({ editor: e, options: t }) => {
313
315
  let n = null, r = null, i = -1, a = null, o = {
314
316
  width: t.dropCursor?.width ?? 5,
315
317
  color: t.dropCursor?.color ?? "#ddeeff",
316
318
  exclude: t.dropCursor?.exclude ?? "bn-drag-exclude",
317
319
  hooks: t.dropCursor?.hooks
318
320
  }, s = (e) => {
319
- e?.pos === n?.pos && e?.orientation === n?.orientation || (n = e, e == null ? (r && r.parentNode && r.parentNode.removeChild(r), r = null) : c());
321
+ (e?.pos !== n?.pos || e?.orientation !== n?.orientation) && (n = e, e == null ? (r && r.parentNode && r.parentNode.removeChild(r), r = null) : c());
320
322
  }, c = () => {
321
323
  if (!n) return;
322
- let t = e.prosemirrorView, i = t.dom, a = i.getBoundingClientRect(), s = a.width / i.offsetWidth, c = a.height / i.offsetHeight, l = Ve(t, n, o.width, s, c) ?? He(t, n, o.width, s), u = t.dom.offsetParent;
323
- r || (r = u.appendChild(document.createElement("div")), r.style.cssText = "position: absolute; z-index: 50; pointer-events: none;", o.color && (r.style.backgroundColor = o.color)), Ue(r, n.orientation);
324
- let { parentLeft: d, parentTop: f } = We(u);
324
+ let t = e.prosemirrorView, i = t.dom, a = i.getBoundingClientRect(), s = a.width / i.offsetWidth, c = a.height / i.offsetHeight, l = We(t, n, o.width, s, c) ?? Ge(t, n, o.width, s), u = t.dom.offsetParent;
325
+ r || (r = u.appendChild(document.createElement("div")), r.style.cssText = "position: absolute; z-index: 50; pointer-events: none;", o.color && (r.style.backgroundColor = o.color)), Ke(r, n.orientation);
326
+ let { parentLeft: d, parentTop: f } = qe(u);
325
327
  r.style.left = (l.left - d) / s + "px", r.style.top = (l.top - f) / c + "px", r.style.width = (l.right - l.left) / s + "px", r.style.height = (l.bottom - l.top) / c + "px";
326
328
  }, l = (e) => {
327
329
  clearTimeout(i), i = window.setTimeout(() => s(null), e);
@@ -330,7 +332,7 @@ var Ge = "bn-drag-exclude", Ke = b(({ editor: e, options: t }) => {
330
332
  a = t.target instanceof Element ? t.target : null;
331
333
  }, d = (t) => {
332
334
  let n = t;
333
- if (a && Be(a, o.exclude) || n.target instanceof Element && Be(n.target, o.exclude)) return;
335
+ if (a && Ue(a, o.exclude) || n.target instanceof Element && Ue(n.target, o.exclude)) return;
334
336
  let r = e.prosemirrorView;
335
337
  if (!r.editable) return;
336
338
  let i = r.posAtCoords({
@@ -381,12 +383,43 @@ var Ge = "bn-drag-exclude", Ke = b(({ editor: e, options: t }) => {
381
383
  });
382
384
  }
383
385
  };
384
- }), qe = b(() => ({
386
+ }), Xe = b(() => ({
385
387
  key: "history",
386
- prosemirrorPlugins: [Oe()],
387
- undoCommand: Ae,
388
- redoCommand: ke
389
- })), Je = b(({ editor: e }) => {
388
+ prosemirrorPlugins: [De()],
389
+ undoCommand: ke,
390
+ redoCommand: Oe
391
+ })), Ze = new w("inline-content-boundary-edit");
392
+ function Qe(e, t, n) {
393
+ if (!e.empty) return e.from <= n.from && e.to >= n.to;
394
+ let r = n.to - n.from === 1;
395
+ return t === "Backspace" ? r && e.from === n.to : r && e.from === n.from;
396
+ }
397
+ var $e = b(() => ({
398
+ key: "inlineContentBoundaryEdit",
399
+ prosemirrorPlugins: [new C({
400
+ key: Ze,
401
+ props: { handleKeyDown: (e, t) => {
402
+ if (!e.editable) return !1;
403
+ let n = t.key.length === 1 && !t.ctrlKey && !t.metaKey;
404
+ if (!n && t.key !== "Backspace" && t.key !== "Delete") return !1;
405
+ let { selection: r } = e.state, i = r.$from.node();
406
+ if (!i.type.spec.inline) return !1;
407
+ let a = r.$from.before(), o = a + 1, s = a + 1 + i.content.size;
408
+ if (n && i.content.size === 0) {
409
+ let n = e.state.tr.insert(o, e.state.schema.text(t.key));
410
+ return n.setSelection(E.create(n.doc, o + t.key.length)), e.dispatch(n), !0;
411
+ }
412
+ if (i.content.size > 0 && Qe(r, t.key, {
413
+ from: o,
414
+ to: s
415
+ })) {
416
+ let t = e.state.tr.delete(o, s);
417
+ return t.setSelection(E.create(t.doc, o)), e.dispatch(t), !0;
418
+ }
419
+ return !1;
420
+ } }
421
+ })]
422
+ })), et = b(({ editor: e }) => {
390
423
  function t(t) {
391
424
  let n = e.prosemirrorView.nodeDOM(t);
392
425
  for (; n && n.parentElement;) {
@@ -433,7 +466,7 @@ var Ge = "bn-drag-exclude", Ke = b(({ editor: e, options: t }) => {
433
466
  e.deleteLink(t);
434
467
  }
435
468
  };
436
- }), Ye = [
469
+ }), tt = [
437
470
  "http",
438
471
  "https",
439
472
  "ftp",
@@ -444,28 +477,28 @@ var Ge = "bn-drag-exclude", Ke = b(({ editor: e, options: t }) => {
444
477
  "sms",
445
478
  "cid",
446
479
  "xmpp"
447
- ], Xe = "https", Ze = new w("node-selection-keyboard"), Qe = b(() => ({
480
+ ], nt = "https", rt = new w("node-selection-keyboard"), it = b(() => ({
448
481
  key: "nodeSelectionKeyboard",
449
482
  prosemirrorPlugins: [new C({
450
- key: Ze,
483
+ key: rt,
451
484
  props: { handleKeyDown: (e, t) => {
452
485
  if ("node" in e.state.selection) {
453
486
  if (t.ctrlKey || t.metaKey) return !1;
454
487
  if (t.key.length === 1) return t.preventDefault(), !0;
455
488
  if (t.key === "Enter" && !t.isComposing && !t.shiftKey && !t.altKey && !t.ctrlKey && !t.metaKey) {
456
489
  let t = e.state.tr;
457
- return e.dispatch(t.insert(e.state.tr.selection.$to.after(), e.state.schema.nodes.paragraph.createChecked()).setSelection(new fe(t.doc.resolve(e.state.tr.selection.$to.after() + 1)))), !0;
490
+ return e.dispatch(t.insert(e.state.tr.selection.$to.after(), e.state.schema.nodes.paragraph.createChecked()).setSelection(new E(t.doc.resolve(e.state.tr.selection.$to.after() + 1)))), !0;
458
491
  }
459
492
  }
460
493
  return !1;
461
494
  } }
462
495
  })]
463
- })), $e = new w("blocknote-placeholder"), et = b(({ editor: e, options: t }) => {
496
+ })), at = new w("blocknote-placeholder"), ot = b(({ editor: e, options: t }) => {
464
497
  let n = t.placeholders;
465
498
  return {
466
499
  key: "placeholder",
467
500
  prosemirrorPlugins: [new C({
468
- key: $e,
501
+ key: at,
469
502
  view: (t) => {
470
503
  let r = `placeholder-selector-${ue()}`;
471
504
  t.dom.classList.add(r);
@@ -490,20 +523,20 @@ var Ge = "bn-drag-exclude", Ke = b(({ editor: e, options: t }) => {
490
523
  let { doc: n, selection: r } = t;
491
524
  if (!e.isEditable || !r.empty || r.$from.parent.type.spec.code) return;
492
525
  let i = [];
493
- t.doc.content.size === 6 && i.push(E.node(2, 4, { "data-is-only-empty-block": "true" }));
526
+ t.doc.content.size === 6 && i.push(D.node(2, 4, { "data-is-only-empty-block": "true" }));
494
527
  let a = r.$anchor, o = a.parent;
495
528
  if (o.content.size === 0) {
496
529
  let e = a.before();
497
- i.push(E.node(e, e + o.nodeSize, { "data-is-empty-and-focused": "true" }));
530
+ i.push(D.node(e, e + o.nodeSize, { "data-is-empty-and-focused": "true" }));
498
531
  }
499
- return D.create(n, i);
532
+ return O.create(n, i);
500
533
  } }
501
534
  })]
502
535
  };
503
- }), tt = b(({ editor: e }) => {
504
- let t = new x(), n = 0;
536
+ }), st = b(({ editor: e }) => {
537
+ let t = new oe(), n = 0;
505
538
  function r() {
506
- t = new x(), n = 0;
539
+ t = new oe(), n = 0;
507
540
  }
508
541
  let i = typeof FinalizationRegistry < "u" ? new FinalizationRegistry(() => {
509
542
  n--, n === 0 && r();
@@ -522,23 +555,23 @@ var Ge = "bn-drag-exclude", Ke = b(({ editor: e, options: t }) => {
522
555
  return i && i.register(o, void 0), o;
523
556
  }
524
557
  };
525
- }), nt = new w("previous-blocks"), rt = {
558
+ }), A = new w("previous-blocks"), ct = {
526
559
  index: "index",
527
560
  level: "level",
528
561
  type: "type",
529
562
  depth: "depth",
530
563
  "depth-change": "depth-change"
531
- }, it = b(() => {
564
+ }, lt = b(() => {
532
565
  let e;
533
566
  return {
534
567
  key: "previousBlockType",
535
568
  prosemirrorPlugins: [new C({
536
- key: nt,
569
+ key: A,
537
570
  view(t) {
538
571
  return {
539
572
  update: async (t, n) => {
540
573
  this.key?.getState(t.state).updatedBlocks.size > 0 && (e = setTimeout(() => {
541
- t.dispatch(t.state.tr.setMeta(nt, { clearUpdate: !0 }));
574
+ t.dispatch(t.state.tr.setMeta(A, { clearUpdate: !0 }));
542
575
  }, 0));
543
576
  },
544
577
  destroy: () => {
@@ -561,9 +594,9 @@ var Ge = "bn-drag-exclude", Ke = b(({ editor: e, options: t }) => {
561
594
  let a = e.mapping.invert(), o = {
562
595
  from: a.map(i.from, -1),
563
596
  to: a.map(i.to, 1)
564
- }, s = {}, c = S(n.doc, o, (e) => e.attrs.id), l = new Map(c.map((e) => [g(e.node, n.doc), e])), u = S(r.doc, i, (e) => e.attrs.id);
597
+ }, s = {}, c = S(n.doc, o, (e) => e.attrs.id), l = new Map(c.map((e) => [_(e.node, n.doc), e])), u = S(r.doc, i, (e) => e.attrs.id);
565
598
  for (let e of u) {
566
- let i = g(e.node, r.doc), a = l.get(i), o = a?.node.firstChild, c = e.node.firstChild;
599
+ let i = _(e.node, r.doc), a = l.get(i), o = a?.node.firstChild, c = e.node.firstChild;
567
600
  if (a && o && c) {
568
601
  let l = {
569
602
  index: c.attrs.index,
@@ -588,19 +621,19 @@ var Ge = "bn-drag-exclude", Ke = b(({ editor: e, options: t }) => {
588
621
  let n = [];
589
622
  return e.doc.descendants((r, i) => {
590
623
  if (!r.attrs.id) return;
591
- let a = g(r, e.doc);
624
+ let a = _(r, e.doc);
592
625
  if (!t.updatedBlocks.has(a)) return;
593
626
  let o = t.currentTransactionOldBlockAttrs[a], s = {};
594
- for (let [e, t] of Object.entries(o)) s["data-prev-" + rt[e]] = t || "none";
595
- n.push(E.node(i, i + r.nodeSize, { ...s }));
596
- }), D.create(e.doc, n);
627
+ for (let [e, t] of Object.entries(o)) s["data-prev-" + ct[e]] = t || "none";
628
+ n.push(D.node(i, i + r.nodeSize, { ...s }));
629
+ }), O.create(e.doc, n);
597
630
  } }
598
631
  })]
599
632
  };
600
633
  });
601
634
  //#endregion
602
635
  //#region src/extensions/getDraggableBlockFromElement.ts
603
- function at(e, t) {
636
+ function ut(e, t) {
604
637
  for (; e && e.parentElement && e.parentElement !== t.dom && e.getAttribute?.("data-node-type") !== "blockContainer";) e = e.parentElement;
605
638
  if (e.getAttribute?.("data-node-type") === "blockContainer") return {
606
639
  node: e,
@@ -609,7 +642,7 @@ function at(e, t) {
609
642
  }
610
643
  //#endregion
611
644
  //#region src/api/exporters/markdown/htmlToMarkdown.ts
612
- function ot(e) {
645
+ function dt(e) {
613
646
  let t = document.createElement("div");
614
647
  return t.innerHTML = e, j(t, {
615
648
  indent: "",
@@ -629,40 +662,41 @@ function M(e, t) {
629
662
  if (e.nodeType !== 1) return "";
630
663
  let n = e;
631
664
  switch (n.tagName.toLowerCase()) {
632
- case "p": return st(n, t);
665
+ case "p": return ft(n, t);
633
666
  case "h1":
634
667
  case "h2":
635
668
  case "h3":
636
669
  case "h4":
637
670
  case "h5":
638
- case "h6": return ct(n, t);
639
- case "blockquote": return lt(n, t);
640
- case "pre": return ut(n, t);
641
- case "ul": return pt(n, t);
642
- case "ol": return mt(n, t);
643
- case "table": return _t(n, t);
671
+ case "h6": return pt(n, t);
672
+ case "blockquote": return mt(n, t);
673
+ case "pre": return ht(n, t);
674
+ case "ul": return bt(n, t);
675
+ case "ol": return xt(n, t);
676
+ case "table": return wt(n, t);
644
677
  case "hr": return t.indent + "***\n\n";
645
- case "img": return yt(n, t);
646
- case "video": return bt(n, t);
647
- case "audio": return xt(n, t);
648
- case "embed": return St(n, t);
649
- case "figure": return Ct(n, t);
650
- case "a": return L(n, t);
651
- case "details": return Et(n, t);
678
+ case "math": return _t(n, t);
679
+ case "img": return Dt(n, t);
680
+ case "video": return Ot(n, t);
681
+ case "audio": return kt(n, t);
682
+ case "embed": return At(n, t);
683
+ case "figure": return jt(n, t);
684
+ case "a": return I(n, t);
685
+ case "details": return Pt(n, t);
652
686
  case "div": return j(n, t);
653
687
  case "br": return "";
654
688
  default: return j(n, t);
655
689
  }
656
690
  }
657
- function st(e, t) {
658
- let n = Dt(z(e));
691
+ function ft(e, t) {
692
+ let n = Ft(R(e));
659
693
  return t.inListItem ? n : t.indent + n + "\n\n";
660
694
  }
661
- function ct(e, t) {
662
- let n = parseInt(e.tagName[1], 10), r = "#".repeat(n) + " ", i = z(e);
695
+ function pt(e, t) {
696
+ let n = parseInt(e.tagName[1], 10), r = "#".repeat(n) + " ", i = R(e);
663
697
  return t.indent + r + i + "\n\n";
664
698
  }
665
- function lt(e, t) {
699
+ function mt(e, t) {
666
700
  let n = Array.from(e.children).filter((e) => {
667
701
  let t = e.tagName.toLowerCase();
668
702
  return [
@@ -677,43 +711,57 @@ function lt(e, t) {
677
711
  }), r;
678
712
  if (n.length > 0) {
679
713
  let e = [];
680
- for (let t of n) t.tagName.toLowerCase() === "p" ? e.push(z(t)) : e.push(M(t, {
714
+ for (let t of n) t.tagName.toLowerCase() === "p" ? e.push(R(t)) : e.push(M(t, {
681
715
  indent: "",
682
716
  inListItem: !1
683
717
  }).trim());
684
718
  r = e.join("\n\n");
685
- } else r = z(e);
719
+ } else r = R(e);
686
720
  return r.split("\n").map((e) => t.indent + "> " + e).join("\n") + "\n\n";
687
721
  }
688
- function ut(e, t) {
722
+ function ht(e, t) {
689
723
  let n = e.querySelector("code");
690
724
  if (!n) return "";
691
- let r = n.getAttribute("data-language") || ft(n.className) || "", i = dt(n), a = Math.max(0, ...(i.match(/`+/g) ?? []).map((e) => e.length)), o = "`".repeat(Math.max(3, a + 1));
692
- return i ? t.indent + o + r + "\n" + i + (i.endsWith("\n") ? "" : "\n") + o + "\n\n" : t.indent + o + r + "\n" + o + "\n\n";
725
+ let r = n.getAttribute("data-language") || yt(n.className) || "", i = vt(n), a = Math.max(0, ...(i.match(/`+/g) ?? []).map((e) => e.length)), o = "`".repeat(Math.max(3, a + 1));
726
+ return i ? [
727
+ o + r,
728
+ ...(i.endsWith("\n") ? i.slice(0, -1) : i).split("\n"),
729
+ o
730
+ ].map((e) => e && t.indent + e).join("\n") + "\n\n" : t.indent + o + r + "\n" + t.indent + o + "\n\n";
693
731
  }
694
- function dt(e) {
732
+ function gt(e) {
733
+ return (e.querySelector("annotation[encoding=\"application/x-tex\"]")?.textContent ?? e.textContent ?? "").trim();
734
+ }
735
+ function _t(e, t) {
736
+ return [
737
+ "$$",
738
+ ...gt(e).split("\n"),
739
+ "$$"
740
+ ].map((e) => e && t.indent + e).join("\n") + "\n\n";
741
+ }
742
+ function vt(e) {
695
743
  let t = "";
696
- for (let n of Array.from(e.childNodes)) n.nodeType === 3 ? t += n.textContent || "" : n.nodeType === 1 && (n.tagName.toLowerCase() === "br" ? t += "\n" : t += dt(n));
744
+ for (let n of Array.from(e.childNodes)) n.nodeType === 3 ? t += n.textContent || "" : n.nodeType === 1 && (n.tagName.toLowerCase() === "br" ? t += "\n" : t += vt(n));
697
745
  return t;
698
746
  }
699
- function ft(e) {
747
+ function yt(e) {
700
748
  let t = e.match(/language-(\S+)/);
701
749
  return t ? t[1] : "";
702
750
  }
703
- function pt(e, t) {
751
+ function bt(e, t) {
704
752
  let n = "", r = Array.from(e.children).filter((e) => e.tagName.toLowerCase() === "li");
705
- for (let e of r) n += ht(e, "bullet", t);
753
+ for (let e of r) n += St(e, "bullet", t);
706
754
  return t.inListItem || (n += "\n"), n;
707
755
  }
708
- function mt(e, t) {
756
+ function xt(e, t) {
709
757
  let n = "", r = Array.from(e.children).filter((e) => e.tagName.toLowerCase() === "li"), i = parseInt(e.getAttribute("start") || "1", 10);
710
758
  for (let e = 0; e < r.length; e++) {
711
759
  let a = i + e;
712
- n += ht(r[e], "ordered", t, a);
760
+ n += St(r[e], "ordered", t, a);
713
761
  }
714
762
  return t.inListItem || (n += "\n"), n;
715
763
  }
716
- function ht(e, t, n, r) {
764
+ function St(e, t, n, r) {
717
765
  let i = null, a = null;
718
766
  for (let t of Array.from(e.children)) {
719
767
  let e = t.tagName.toLowerCase();
@@ -724,31 +772,35 @@ function ht(e, t, n, r) {
724
772
  let c, l;
725
773
  if (a) {
726
774
  let e = a.querySelector("summary")?.querySelector("p");
727
- l = a, c = e ? z(e) : "";
728
- } else l = gt(e, i), c = l ? z(l) : "";
775
+ l = a, c = e ? R(e) : "";
776
+ } else l = Ct(e, i), c = l ? R(l) : "";
729
777
  let u = n.indent + o + c + "\n", d = n.indent + " ".repeat(s), f = {
730
778
  indent: d,
731
779
  inListItem: !0
732
780
  };
733
781
  if (a) {
734
782
  let e = a.querySelector("summary");
735
- for (let t of Array.from(a.children)) if (t !== e) if (t.tagName.toLowerCase() === "p") {
736
- let e = z(t);
737
- u += "\n" + d + e + "\n";
738
- } else u += M(t, f);
783
+ for (let t of Array.from(a.children)) if (t !== e) {
784
+ if (t.tagName.toLowerCase() === "p") {
785
+ let e = R(t);
786
+ u += "\n" + d + e + "\n";
787
+ } else u += M(t, f);
788
+ }
739
789
  }
740
790
  let p = Array.from(e.children);
741
791
  for (let e of p) {
742
792
  let t = e.tagName.toLowerCase();
743
- if (!(e === l || e === i) && t !== "input") if (t === "ul" || t === "ol") u += M(e, f);
744
- else if (t === "p") {
745
- let t = z(e);
746
- u += "\n" + d + t + "\n";
747
- } else u += "\n" + M(e, f);
793
+ if (e !== l && e !== i && t !== "input") {
794
+ if (t === "ul" || t === "ol") u += M(e, f);
795
+ else if (t === "p") {
796
+ let t = R(e);
797
+ u += "\n" + d + t + "\n";
798
+ } else u += "\n" + M(e, f);
799
+ }
748
800
  }
749
801
  return u;
750
802
  }
751
- function gt(e, t) {
803
+ function Ct(e, t) {
752
804
  for (let n of Array.from(e.children)) {
753
805
  if (n === t || n.tagName.toLowerCase() === "input") continue;
754
806
  let e = n.tagName.toLowerCase();
@@ -756,7 +808,7 @@ function gt(e, t) {
756
808
  }
757
809
  return null;
758
810
  }
759
- function _t(e, t) {
811
+ function wt(e, t) {
760
812
  let n = e.querySelector("colgroup"), r = 0;
761
813
  n && (r = n.querySelectorAll("col").length);
762
814
  let i = [], a = !1, o = e.querySelectorAll("tr"), s = [];
@@ -766,7 +818,7 @@ function _t(e, t) {
766
818
  n.forEach((e) => {
767
819
  for (; s[t][i] !== void 0;) i++;
768
820
  t === 0 && e.tagName.toLowerCase() === "th" && (a = !0);
769
- let n = vt(z(e).trim()), r = parseInt(e.getAttribute("colspan") || "1", 10), o = parseInt(e.getAttribute("rowspan") || "1", 10);
821
+ let n = Tt(R(e).trim()), r = parseInt(e.getAttribute("colspan") || "1", 10), o = parseInt(e.getAttribute("rowspan") || "1", 10);
770
822
  for (let e = 0; e < o; e++) for (let a = 0; a < r; a++) {
771
823
  let r = t + e;
772
824
  s[r] || (s[r] = []), s[r][i + a] = e === 0 && a === 0 ? n : "";
@@ -791,16 +843,16 @@ function _t(e, t) {
791
843
  }
792
844
  let l = "";
793
845
  if (a) {
794
- l += t.indent + N(i[0], c, r) + "\n", l += t.indent + P(c, r) + "\n";
846
+ l += t.indent + N(i[0], c, r) + "\n", l += t.indent + Et(c, r) + "\n";
795
847
  for (let e = 1; e < i.length; e++) l += t.indent + N(i[e], c, r) + "\n";
796
848
  } else {
797
849
  let e = Array(r).fill("");
798
- l += t.indent + N(e, c, r) + "\n", l += t.indent + P(c, r) + "\n";
850
+ l += t.indent + N(e, c, r) + "\n", l += t.indent + Et(c, r) + "\n";
799
851
  for (let e of i) l += t.indent + N(e, c, r) + "\n";
800
852
  }
801
853
  return l += "\n", l;
802
854
  }
803
- function vt(e) {
855
+ function Tt(e) {
804
856
  return e.replace(/\|/g, "\\|");
805
857
  }
806
858
  function N(e, t, n) {
@@ -811,65 +863,65 @@ function N(e, t, n) {
811
863
  }
812
864
  return "|" + r.join("|") + "|";
813
865
  }
814
- function P(e, t) {
866
+ function Et(e, t) {
815
867
  let n = [];
816
868
  for (let r = 0; r < t; r++) n.push(" " + "-".repeat(e[r]) + " ");
817
869
  return "|" + n.join("|") + "|";
818
870
  }
819
- function yt(e, t) {
871
+ function Dt(e, t) {
820
872
  let n = e.getAttribute("src") || "", r = e.getAttribute("alt") || "";
821
873
  return n ? t.indent + `![${r}](${n})\n\n` : "\n\n";
822
874
  }
823
- function bt(e, t) {
875
+ function Ot(e, t) {
824
876
  let n = e.getAttribute("src") || e.getAttribute("data-url") || "", r = e.getAttribute("data-name") || e.getAttribute("title") || "";
825
877
  return n ? t.indent + `![${r}](${n})\n\n` : "\n\n";
826
878
  }
827
- function xt(e, t) {
879
+ function kt(e, t) {
828
880
  let n = e.getAttribute("src") || "";
829
- return n ? t.indent + `<audio src="${I(n)}" controls></audio>\n\n` : "\n\n";
881
+ return n ? t.indent + `<audio src="${F(n)}" controls></audio>\n\n` : "\n\n";
830
882
  }
831
- function St(e, t) {
883
+ function At(e, t) {
832
884
  let n = e.getAttribute("src") || "";
833
885
  return n ? t.indent + `[](${n})\n\n` : "\n\n";
834
886
  }
835
- function Ct(e, t) {
887
+ function jt(e, t) {
836
888
  let n = e.querySelector("img"), r = e.querySelector("video"), i = e.querySelector("audio"), a = e.querySelector("a"), o = e.querySelector("figcaption")?.textContent?.trim() || "";
837
- return n ? F("img", n.getAttribute("src") || "", n.getAttribute("alt") || "", o, t) : r ? F("video", r.getAttribute("src") || r.getAttribute("data-url") || "", r.getAttribute("data-name") || r.getAttribute("title") || "", o, t) : i ? F("audio", i.getAttribute("src") || "", "", o, t) : a ? L(a, t) : "";
889
+ return n ? P("img", n.getAttribute("src") || "", n.getAttribute("alt") || "", o, t) : r ? P("video", r.getAttribute("src") || r.getAttribute("data-url") || "", r.getAttribute("data-name") || r.getAttribute("title") || "", o, t) : i ? P("audio", i.getAttribute("src") || "", "", o, t) : a ? I(a, t) : "";
838
890
  }
839
- function F(e, t, n, r, i) {
891
+ function P(e, t, n, r, i) {
840
892
  if (!t) return "";
841
893
  if (!r && e !== "audio") return i.indent + `![${n}](${t})\n\n`;
842
- let a = n && n !== r ? e === "img" ? ` alt="${I(n)}"` : e === "video" ? ` data-name="${I(n)}"` : "" : "", o = e === "img" ? `<img${a} src="${I(t)}">` : `<${e} src="${I(t)}"${a} controls></${e}>`, s = r ? `<figcaption>${wt(r)}</figcaption>` : "";
894
+ let a = n && n !== r ? e === "img" ? ` alt="${F(n)}"` : e === "video" ? ` data-name="${F(n)}"` : "" : "", o = e === "img" ? `<img${a} src="${F(t)}">` : `<${e} src="${F(t)}"${a} controls></${e}>`, s = r ? `<figcaption>${Mt(r)}</figcaption>` : "";
843
895
  return i.indent + `<figure>${o}${s}</figure>\n\n`;
844
896
  }
845
- function I(e) {
897
+ function F(e) {
846
898
  return e.replace(/&/g, "&amp;").replace(/"/g, "&quot;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
847
899
  }
848
- function wt(e) {
900
+ function Mt(e) {
849
901
  return e.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
850
902
  }
851
- function L(e, t) {
903
+ function I(e, t) {
852
904
  let n = e.getAttribute("href") || "", r = e.textContent?.trim() || "";
853
- return n ? t.indent + R(r, n) + "\n\n" : t.indent + r + "\n\n";
905
+ return n ? t.indent + L(r, n) + "\n\n" : t.indent + r + "\n\n";
854
906
  }
855
- function R(e, t) {
856
- return !e || e === t ? t : `[${e}](${Tt(t)})`;
907
+ function L(e, t) {
908
+ return !e || e === t ? t : `[${e}](${Nt(t)})`;
857
909
  }
858
- function Tt(e) {
910
+ function Nt(e) {
859
911
  return e.replace(/[\\()]/g, "\\$&");
860
912
  }
861
- function Et(e, t) {
913
+ function Pt(e, t) {
862
914
  let n = e.querySelector("summary");
863
915
  if (!n) return j(e, t);
864
916
  let r = n.querySelector("h1, h2, h3, h4, h5, h6");
865
917
  if (r) {
866
- let i = ct(r, t);
918
+ let i = pt(r, t);
867
919
  for (let r of Array.from(e.children)) r !== n && (i += M(r, t));
868
920
  return i;
869
921
  }
870
922
  return j(n, t);
871
923
  }
872
- function z(e) {
924
+ function R(e) {
873
925
  let t = "";
874
926
  for (let n of Array.from(e.childNodes)) if (n.nodeType === 3) t += n.textContent || "";
875
927
  else if (n.nodeType === 1) {
@@ -877,19 +929,19 @@ function z(e) {
877
929
  switch (e.tagName.toLowerCase()) {
878
930
  case "strong":
879
931
  case "b": {
880
- let { content: n, trailing: r } = B(z(e));
881
- n ? t += `**${n}**${r}` : t += r;
932
+ let { content: n, trailing: r } = z(R(e));
933
+ t += n ? `**${n}**${r}` : r;
882
934
  break;
883
935
  }
884
936
  case "em":
885
937
  case "i": {
886
- let { content: n, trailing: r } = B(z(e));
887
- n ? t += `*${n}*${r}` : t += r;
938
+ let { content: n, trailing: r } = z(R(e));
939
+ t += n ? `*${n}*${r}` : r;
888
940
  break;
889
941
  }
890
942
  case "s":
891
943
  case "del":
892
- t += `~~${z(e)}~~`;
944
+ t += `~~${R(e)}~~`;
893
945
  break;
894
946
  case "code": {
895
947
  let n = e.textContent || "", r = Math.max(0, ...(n.match(/`+/g) ?? []).map((e) => e.length)), i = "`".repeat(r + 1), a = n.startsWith("`") || n.endsWith("`");
@@ -897,18 +949,23 @@ function z(e) {
897
949
  break;
898
950
  }
899
951
  case "u":
900
- t += z(e);
952
+ t += R(e);
901
953
  break;
902
954
  case "a": {
903
- let n = e.getAttribute("href") || "", r = z(e);
904
- t += R(r, n);
955
+ let n = e.getAttribute("href") || "", r = R(e);
956
+ t += L(r, n);
905
957
  break;
906
958
  }
907
959
  case "br":
908
960
  t += "\\\n";
909
961
  break;
962
+ case "math": {
963
+ let n = gt(e).split("\n").map((e) => e.trim()).join(" ");
964
+ t += `$${n}$`;
965
+ break;
966
+ }
910
967
  case "span":
911
- t += z(e);
968
+ t += R(e);
912
969
  break;
913
970
  case "img": {
914
971
  let n = e.getAttribute("src") || "", r = e.getAttribute("alt") || "";
@@ -921,17 +978,15 @@ function z(e) {
921
978
  break;
922
979
  }
923
980
  case "p":
924
- t += z(e);
981
+ t += R(e);
925
982
  break;
926
983
  case "input": break;
927
- default:
928
- t += z(e);
929
- break;
984
+ default: t += R(e);
930
985
  }
931
986
  }
932
987
  return t;
933
988
  }
934
- function B(e) {
989
+ function z(e) {
935
990
  let t = e.match(/^(.*?)(\s*)$/);
936
991
  return t ? {
937
992
  content: t[1],
@@ -941,29 +996,29 @@ function B(e) {
941
996
  trailing: ""
942
997
  };
943
998
  }
944
- function Dt(e) {
999
+ function Ft(e) {
945
1000
  let t = e.replace(/^(\\\n)+/, "");
946
1001
  return t = t.replace(/(\\\n)+$/, ""), t;
947
1002
  }
948
1003
  //#endregion
949
1004
  //#region src/api/exporters/markdown/markdownExporter.ts
950
- function V(e) {
951
- return ot(e.split("").join(""));
1005
+ function B(e) {
1006
+ return dt(e.split("").join(""));
952
1007
  }
953
- function Ot(e, t, n, r) {
954
- return V(k(t, n).exportBlocks(e, r));
1008
+ function It(e, t, n, r) {
1009
+ return B(k(t, n).exportBlocks(e, r));
955
1010
  }
956
1011
  //#endregion
957
1012
  //#region src/api/nodeConversions/fragmentToBlocks.ts
958
- function kt(e) {
1013
+ function Lt(e) {
959
1014
  let t = [];
960
1015
  return e.descendants((e) => e.type.name === "blockContainer" && e.firstChild?.type.name === "blockGroup" ? !0 : e.type.name === "columnList" && e.childCount === 1 ? (e.firstChild?.forEach((n) => {
961
- t.push(v(n, e));
962
- }), !1) : e.type.isInGroup("bnBlock") ? (t.push(v(e, e)), !1) : !0), t;
1016
+ t.push(u(n, e));
1017
+ }), !1) : !e.type.isInGroup("bnBlock") || (t.push(u(e, e)), !1)), t;
963
1018
  }
964
1019
  //#endregion
965
1020
  //#region src/extensions/SideMenu/MultipleNodeSelection.ts
966
- var H = class e extends T {
1021
+ var V = class e extends T {
967
1022
  nodes;
968
1023
  constructor(e, t) {
969
1024
  super(e, t);
@@ -976,7 +1031,7 @@ var H = class e extends T {
976
1031
  return new e(t.resolve(n), t.resolve(r));
977
1032
  }
978
1033
  content() {
979
- return new oe(ae.from(this.nodes), 0, 0);
1034
+ return new ae(x.from(this.nodes), 0, 0);
980
1035
  }
981
1036
  eq(t) {
982
1037
  if (!(t instanceof e) || this.nodes.length !== t.nodes.length || this.from !== t.from || this.to !== t.to) return !1;
@@ -995,11 +1050,11 @@ var H = class e extends T {
995
1050
  };
996
1051
  }
997
1052
  };
998
- T.jsonID("multiple-node", H);
1053
+ T.jsonID("multiple-node", V);
999
1054
  //#endregion
1000
1055
  //#region src/extensions/SideMenu/dragging.ts
1001
- var U;
1002
- function At(e, t) {
1056
+ var H;
1057
+ function Rt(e, t) {
1003
1058
  let n, r, i = t.resolve(e.from).node().type.spec.group === "blockContent", a = t.resolve(e.to).node().type.spec.group === "blockContent", o = Math.min(e.$anchor.depth, e.$head.depth);
1004
1059
  if (i && a) {
1005
1060
  let i = e.$from.start(o - 1), a = e.$to.end(o - 1);
@@ -1010,51 +1065,51 @@ function At(e, t) {
1010
1065
  to: r
1011
1066
  };
1012
1067
  }
1013
- function jt(e, t, n = t) {
1068
+ function zt(e, t, n = t) {
1014
1069
  t === n && (n += e.state.doc.resolve(t + 1).node().nodeSize);
1015
1070
  let r = e.domAtPos(t).node.cloneNode(!0), i = e.domAtPos(t).node, a = (e, t) => Array.prototype.indexOf.call(e.children, t), o = a(i, e.domAtPos(t + 1).node.parentElement), s = a(i, e.domAtPos(n - 1).node.parentElement);
1016
1071
  for (let e = i.childElementCount - 1; e >= 0; e--) (e > s || e < o) && r.removeChild(r.children[e]);
1017
- Mt(e.root), U = r, U.querySelectorAll("iframe, embed, object").forEach((e) => e.parentElement?.removeChild(e));
1072
+ Bt(e.root), H = r, H.querySelectorAll("iframe, embed, object").forEach((e) => e.parentElement?.removeChild(e));
1018
1073
  let c = e.dom.className.split(" ").filter((e) => e !== "ProseMirror" && e !== "bn-root" && e !== "bn-editor").join(" ");
1019
- U.className = U.className + " bn-drag-preview " + c, e.root instanceof ShadowRoot ? e.root.appendChild(U) : e.root.body.appendChild(U);
1020
- }
1021
- function Mt(e) {
1022
- U !== void 0 && (e instanceof ShadowRoot ? e.removeChild(U) : e.body.removeChild(U), U = void 0);
1023
- }
1024
- function Nt(t, n, r) {
1025
- if (!t.dataTransfer || r.headless) return;
1026
- let i = r.prosemirrorView, a = e(n.id, i.state.doc);
1027
- if (!a) throw Error(`Block with ID ${n.id} not found`);
1028
- let o = a.posBeforeNode;
1029
- if (o != null) {
1030
- let e = i.state.selection, n = i.state.doc, { from: a, to: s } = At(e, n), c = a <= o && o < s, l = e.$anchor.node() !== e.$head.node() || e instanceof H;
1031
- c && l ? (i.dispatch(i.state.tr.setSelection(H.create(n, a, s))), jt(i, a, s)) : (i.dispatch(i.state.tr.setSelection(de.create(i.state.doc, o))), jt(i, o));
1032
- let u = i.state.selection.content(), d = r.pmSchema, f = i.serializeForClipboard(u).dom.innerHTML, p = k(d, r), m = kt(u.content), h = p.exportBlocks(m, {}), g = V(h);
1033
- t.dataTransfer.clearData(), t.dataTransfer.setData("blocknote/html", f), t.dataTransfer.setData("text/html", h), t.dataTransfer.setData("text/plain", g), t.dataTransfer.effectAllowed = "move", t.dataTransfer.setDragImage(U, 0, 0);
1074
+ H.className = H.className + " bn-drag-preview " + c, e.root instanceof ShadowRoot ? e.root.appendChild(H) : e.root.body.appendChild(H);
1075
+ }
1076
+ function Bt(e) {
1077
+ H !== void 0 && (e instanceof ShadowRoot ? e.removeChild(H) : e.body.removeChild(H), H = void 0);
1078
+ }
1079
+ function Vt(e, t, n) {
1080
+ if (!e.dataTransfer || n.headless) return;
1081
+ let r = n.prosemirrorView, i = c(t.id, r.state.doc);
1082
+ if (!i) throw Error(`Block with ID ${t.id} not found`);
1083
+ let a = i.posBeforeNode;
1084
+ if (a != null) {
1085
+ let t = r.state.selection, i = r.state.doc, { from: o, to: s } = Rt(t, i), c = o <= a && a < s, l = t.$anchor.node() !== t.$head.node() || t instanceof V;
1086
+ c && l ? (r.dispatch(r.state.tr.setSelection(V.create(i, o, s))), zt(r, o, s)) : (r.dispatch(r.state.tr.setSelection(de.create(r.state.doc, a))), zt(r, a));
1087
+ let u = r.state.selection.content(), d = n.pmSchema, f = r.serializeForClipboard(u).dom.innerHTML, p = k(d, n), m = Lt(u.content), h = p.exportBlocks(m, {}), g = B(h);
1088
+ e.dataTransfer.clearData(), e.dataTransfer.setData("blocknote/html", f), e.dataTransfer.setData("text/html", h), e.dataTransfer.setData("text/plain", g), e.dataTransfer.effectAllowed = "move", e.dataTransfer.setDragImage(H, 0, 0);
1034
1089
  }
1035
1090
  }
1036
1091
  //#endregion
1037
1092
  //#region src/extensions/SideMenu/SideMenu.ts
1038
- var Pt = 250;
1039
- function W(e, t, n = !0) {
1093
+ var Ht = 250;
1094
+ function U(e, t, n = !0) {
1040
1095
  let r = e.root.elementsFromPoint(t.left, t.top);
1041
- for (let i of r) if (e.dom.contains(i)) return n && i.closest("[data-node-type=columnList]") ? W(e, {
1096
+ for (let i of r) if (e.dom.contains(i)) return n && i.closest("[data-node-type=columnList]") ? U(e, {
1042
1097
  left: t.left + 50,
1043
1098
  top: t.top
1044
- }, !1) : at(i, e);
1099
+ }, !1) : ut(i, e);
1045
1100
  }
1046
- function Ft(e, t) {
1101
+ function Ut(e, t) {
1047
1102
  if (!t.dom.firstChild) return;
1048
- let n = t.dom.firstChild.getBoundingClientRect(), r = W(t, {
1103
+ let n = t.dom.firstChild.getBoundingClientRect(), r = U(t, {
1049
1104
  left: Math.min(Math.max(n.left + 10, e.x), n.right - 10),
1050
1105
  top: e.y
1051
1106
  });
1052
- if (r) return W(t, {
1107
+ if (r) return U(t, {
1053
1108
  left: r.node.getBoundingClientRect().right - 10,
1054
1109
  top: e.y
1055
1110
  }, !1);
1056
1111
  }
1057
- var It = class {
1112
+ var Wt = class {
1058
1113
  editor;
1059
1114
  pmView;
1060
1115
  state;
@@ -1078,11 +1133,11 @@ var It = class {
1078
1133
  clientX: this.mousePos.x,
1079
1134
  clientY: this.mousePos.y
1080
1135
  });
1081
- if (e?.element !== this.pmView.dom || e.distance > Pt) {
1136
+ if (e?.element !== this.pmView.dom || e.distance > Ht) {
1082
1137
  this.state?.show && (this.state.show = !1, this.updateState(this.state));
1083
1138
  return;
1084
1139
  }
1085
- let t = Ft(this.mousePos, this.pmView);
1140
+ let t = Ut(this.mousePos, this.pmView);
1086
1141
  if (!t || !this.editor.isEditable) {
1087
1142
  this.state?.show && (this.state.show = !1, this.updateState(this.state));
1088
1143
  return;
@@ -1105,9 +1160,9 @@ var It = class {
1105
1160
  if (!t || this.pmView.dragging) return;
1106
1161
  let n = document.createElement("div");
1107
1162
  n.innerHTML = t;
1108
- let r = pe.fromSchema(this.pmView.state.schema).parse(n, { topNode: this.pmView.state.schema.nodes.blockGroup.create() });
1163
+ let r = fe.fromSchema(this.pmView.state.schema).parse(n, { topNode: this.pmView.state.schema.nodes.blockGroup.create() });
1109
1164
  this.pmView.dragging = {
1110
- slice: new me(r.content, 0, 0),
1165
+ slice: new pe(r.content, 0, 0),
1111
1166
  move: !0
1112
1167
  };
1113
1168
  };
@@ -1139,7 +1194,7 @@ var It = class {
1139
1194
  getDragEventContext = (e) => {
1140
1195
  if (!(this.pmView.dragging !== null || this.isDragOrigin || e.dataTransfer?.types.includes("blocknote/html") || e.target instanceof Node && this.pmView.dom.contains(e.target))) return;
1141
1196
  let t = !e.dataTransfer?.types.includes("blocknote/html") && !!this.pmView.dragging, n = !!this.isDragOrigin, r = t || n, i = this.findClosestEditorElement(e);
1142
- if (!i || i.distance > Pt) return;
1197
+ if (!i || i.distance > Ht) return;
1143
1198
  let a = i.element === this.pmView.dom, o = a && i.distance === 0;
1144
1199
  if (!(!a && !r)) return {
1145
1200
  isDropPoint: a,
@@ -1157,9 +1212,10 @@ var It = class {
1157
1212
  let { isDropPoint: n, isDropWithinEditorBounds: r, isDragOrigin: i } = t;
1158
1213
  if (!r && n && this.dispatchSyntheticEvent(e), n) {
1159
1214
  if (this.pmView.dragging) return;
1160
- this.pmView.dispatch(this.pmView.state.tr.setSelection(Ee.create(this.pmView.state.tr.doc, this.pmView.state.tr.selection.anchor)));
1215
+ this.pmView.dispatch(this.pmView.state.tr.setSelection(Te.create(this.pmView.state.tr.doc, this.pmView.state.tr.selection.anchor)));
1161
1216
  return;
1162
- } else if (i) {
1217
+ }
1218
+ if (i) {
1163
1219
  setTimeout(() => this.pmView.dispatch(this.pmView.state.tr.deleteSelection()), 0);
1164
1220
  return;
1165
1221
  }
@@ -1193,22 +1249,22 @@ var It = class {
1193
1249
  destroy() {
1194
1250
  this.state?.show && (this.state.show = !1, this.emitUpdate(this.state)), this.pmView.root.removeEventListener("mousemove", this.onMouseMove, !0), this.pmView.root.removeEventListener("dragstart", this.onDragStart), this.pmView.root.removeEventListener("dragover", this.onDragOver), this.pmView.root.removeEventListener("drop", this.onDrop, !0), this.pmView.root.removeEventListener("dragend", this.onDragEnd, !0), this.pmView.root.removeEventListener("keydown", this.onKeyDown, !0);
1195
1251
  }
1196
- }, Lt = new Te("SideMenuPlugin"), Rt = b(({ editor: e }) => {
1252
+ }, Gt = new we("SideMenuPlugin"), Kt = b(({ editor: e }) => {
1197
1253
  let t, n = y(void 0);
1198
1254
  return {
1199
1255
  key: "sideMenu",
1200
1256
  store: n,
1201
- prosemirrorPlugins: [new we({
1202
- key: Lt,
1203
- view: (r) => (t = new It(e, r, (e) => {
1257
+ prosemirrorPlugins: [new Ce({
1258
+ key: Gt,
1259
+ view: (r) => (t = new Wt(e, r, (e) => {
1204
1260
  n.setState({ ...e });
1205
1261
  }), t)
1206
1262
  })],
1207
1263
  blockDragStart(n, r) {
1208
- t && (t.isDragOrigin = !0), Nt(n, r, e);
1264
+ t && (t.isDragOrigin = !0), Vt(n, r, e);
1209
1265
  },
1210
1266
  blockDragEnd() {
1211
- Mt(e.prosemirrorView.root), t && (t.isDragOrigin = !1), e.blur();
1267
+ Bt(e.prosemirrorView.root), t && (t.isDragOrigin = !1), e.blur();
1212
1268
  },
1213
1269
  get menuFrozen() {
1214
1270
  return t.menuFrozen;
@@ -1223,8 +1279,172 @@ var It = class {
1223
1279
  !t.menuFrozen && t.state?.show && (t.state.show = !1, t.emitUpdate(t.state));
1224
1280
  }
1225
1281
  };
1226
- }), G;
1227
- async function zt() {
1282
+ }), qt = b(({ editor: e }) => {
1283
+ let t = y({
1284
+ popupOpen: void 0,
1285
+ selected: void 0
1286
+ }), n = (t) => !!e.schema.blockSpecs[t.type]?.implementation?.meta?.hasPreview, r = (e) => ({ editor: r }) => {
1287
+ let { block: i, prevBlock: a, nextBlock: o } = r.getTextCursorPosition();
1288
+ if (!n(i) || t.state.popupOpen === i.id) return !1;
1289
+ let s = e === "prev" ? a : o;
1290
+ return s ? (r.setTextCursorPosition(s.id, e === "prev" ? "end" : "start"), !0) : !1;
1291
+ };
1292
+ return {
1293
+ key: "sourceBlockWithPreview",
1294
+ store: t,
1295
+ keyboardShortcuts: {
1296
+ Enter: ({ editor: e }) => {
1297
+ let { block: r } = e.getTextCursorPosition();
1298
+ if (!n(r)) return !1;
1299
+ if (t.state.popupOpen === r.id && e.schema.blockSpecs[r.type]?.implementation?.meta?.hardBreakShortcut === "enter") {
1300
+ let t = e.prosemirrorView;
1301
+ return t.dispatch(t.state.tr.insertText("\n")), !0;
1302
+ }
1303
+ return e.setTextCursorPosition(r.id, "end"), t.setState((e) => ({
1304
+ ...e,
1305
+ popupOpen: t.state.popupOpen === r.id ? void 0 : r.id
1306
+ })), !0;
1307
+ },
1308
+ Escape: ({ editor: e }) => {
1309
+ let { block: r } = e.getTextCursorPosition();
1310
+ return !n(r) || t.state.popupOpen !== r.id ? !1 : (e.setTextCursorPosition(r.id, "end"), t.setState((e) => ({
1311
+ ...e,
1312
+ popupOpen: void 0
1313
+ })), !0);
1314
+ },
1315
+ "Mod-a": ({ editor: e }) => {
1316
+ let { block: r } = e.getTextCursorPosition();
1317
+ if (!n(r) || t.state.popupOpen !== r.id) return !1;
1318
+ let i = e.prosemirrorView, { $from: a } = i.state.selection;
1319
+ return a.parent.type.name === r.type && (i.dispatch(i.state.tr.setSelection(E.create(i.state.doc, a.start(), a.end()))), !0);
1320
+ },
1321
+ ArrowUp: r("prev"),
1322
+ ArrowLeft: r("prev"),
1323
+ ArrowDown: r("next"),
1324
+ ArrowRight: r("next")
1325
+ },
1326
+ mount: ({ dom: r, signal: i }) => {
1327
+ let a = e.onSelectionChange(() => {
1328
+ let { block: r } = e.getTextCursorPosition(), i = n(r) ? r.id : void 0, a = t.state.popupOpen && t.state.popupOpen !== r.id ? void 0 : t.state.popupOpen;
1329
+ (i !== t.state.selected || a !== t.state.popupOpen) && t.setState((e) => ({
1330
+ ...e,
1331
+ selected: i,
1332
+ popupOpen: a
1333
+ }));
1334
+ });
1335
+ i.addEventListener("abort", a), r.addEventListener("keydown", (r) => {
1336
+ if (!e.isEditable) return;
1337
+ let { block: i } = e.getTextCursorPosition();
1338
+ if (!(!n(i) || t.state.popupOpen === i.id)) {
1339
+ if (r.key === "Backspace" || r.key === "Delete") {
1340
+ r.preventDefault(), r.stopImmediatePropagation(), e.removeBlocks([i.id]);
1341
+ return;
1342
+ }
1343
+ (r.key.length === 1 && !r.ctrlKey && !r.metaKey || r.key === "Tab") && (r.preventDefault(), r.stopImmediatePropagation());
1344
+ }
1345
+ }, {
1346
+ capture: !0,
1347
+ signal: i
1348
+ }), r.addEventListener("blur", () => t.setState((e) => ({
1349
+ ...e,
1350
+ popupOpen: void 0
1351
+ })), {
1352
+ capture: !0,
1353
+ signal: i
1354
+ });
1355
+ }
1356
+ };
1357
+ }), Jt = b(({ editor: e }) => {
1358
+ let t = y({ selected: void 0 }), n = (t) => !!e.schema.inlineContentSpecs[t]?.implementation?.meta?.hasPreview, r = (e) => ({ editor: t }) => {
1359
+ let { $from: r } = t.prosemirrorState.selection, i = r.node();
1360
+ if (!n(i.type.name)) return !1;
1361
+ let a = t.prosemirrorView, o = T.near(a.state.doc.resolve(e === "before" ? r.before() : r.after()), e === "before" ? -1 : 1);
1362
+ return a.dispatch(a.state.tr.setSelection(o)), !0;
1363
+ };
1364
+ return {
1365
+ key: "sourceInlineContentWithPreview",
1366
+ store: t,
1367
+ keyboardShortcuts: {
1368
+ Enter: r("after"),
1369
+ "Shift-Enter": r("after"),
1370
+ Escape: r("after"),
1371
+ ArrowUp: r("before"),
1372
+ ArrowDown: r("after"),
1373
+ "Mod-a": ({ editor: e }) => {
1374
+ let { $from: t } = e.prosemirrorState.selection;
1375
+ if (!n(t.node().type.name)) return !1;
1376
+ let r = e.prosemirrorView;
1377
+ return r.dispatch(r.state.tr.setSelection(E.create(r.state.doc, t.start(), t.end()))), !0;
1378
+ }
1379
+ },
1380
+ mount: ({ dom: r, signal: i }) => {
1381
+ let a = e.onSelectionChange(() => {
1382
+ let { $from: r } = e.prosemirrorState.selection, i = r.node();
1383
+ t.setState({ selected: n(i.type.name) ? r.before() : void 0 });
1384
+ });
1385
+ i.addEventListener("abort", a), r.addEventListener("keydown", (t) => {
1386
+ if (t.key !== "ArrowUp" && t.key !== "ArrowDown") return;
1387
+ let { $from: i } = e.prosemirrorState.selection;
1388
+ n(i.node().type.name) || (r.classList.add("bn-suppress-source-popup-caret"), requestAnimationFrame(() => r.classList.remove("bn-suppress-source-popup-caret")));
1389
+ }, {
1390
+ capture: !0,
1391
+ signal: i
1392
+ }), r.addEventListener("blur", () => t.setState({ selected: void 0 }), {
1393
+ capture: !0,
1394
+ signal: i
1395
+ });
1396
+ }
1397
+ };
1398
+ }), Yt = Symbol.for("blocknote.shikiParser"), W = Symbol.for("blocknote.shikiHighlighterPromise"), Xt = [
1399
+ "text",
1400
+ "none",
1401
+ "plaintext",
1402
+ "txt"
1403
+ ];
1404
+ function Zt(e, t, n) {
1405
+ let r = globalThis, i, a, o = /* @__PURE__ */ new Set();
1406
+ return Ae({
1407
+ parser: (t) => {
1408
+ if (!e.createHighlighter) return [];
1409
+ if (!i) return r[W] = r[W] || e.createHighlighter(), r[W].then((e) => {
1410
+ i = e;
1411
+ });
1412
+ let n = t.language;
1413
+ return !n || Xt.includes(n) || o.has(n) ? [] : i.getLoadedLanguages().includes(n) ? (a || (a = r[Yt] || je(i, Qt(i)), r[Yt] = a), a(t)) : i.loadLanguage(n).catch(() => {
1414
+ o.add(n);
1415
+ });
1416
+ },
1417
+ languageExtractor: (e) => {
1418
+ let t = {
1419
+ type: e.type.name,
1420
+ props: e.attrs
1421
+ };
1422
+ return (n.blockSpecs[t.type] || n.inlineContentSpecs[t.type])?.implementation?.meta?.highlight?.(t) ?? void 0;
1423
+ },
1424
+ nodeTypes: t
1425
+ });
1426
+ }
1427
+ function Qt(e) {
1428
+ let t = e.getLoadedThemes(), n = t.find((e) => /light/i.test(e)), r = t.find((e) => /dark/i.test(e));
1429
+ if (n && r) return {
1430
+ themes: {
1431
+ light: n,
1432
+ dark: r
1433
+ },
1434
+ defaultColor: !1
1435
+ };
1436
+ }
1437
+ //#endregion
1438
+ //#region src/extensions/SyntaxHighlighting/SyntaxHighlighting.ts
1439
+ function $t(e) {
1440
+ let t = Object.values(e.blockSpecs).filter((e) => typeof e?.config == "object" && e.config.content === "plain" && !!e.implementation?.meta?.highlight).map((e) => e.config.type), n = Object.values(e.inlineContentSpecs).filter((e) => typeof e?.config == "object" && e.config.content === "plain" && !!e.implementation?.meta?.highlight).map((e) => e.config.type);
1441
+ return [...t, ...n];
1442
+ }
1443
+ var en = b(({ editor: e, options: t }) => ({
1444
+ key: "syntaxHighlighting",
1445
+ prosemirrorPlugins: [Zt(t, $t(e.schema), e.schema)]
1446
+ })), G;
1447
+ async function tn() {
1228
1448
  return G || (G = (async () => {
1229
1449
  let [e, t] = await Promise.all([import("emoji-mart"), import("@emoji-mart/data")]), n = "default" in e ? e.default : e, r = "default" in t ? t.default : t;
1230
1450
  return await n.init({ data: r }), {
@@ -1233,9 +1453,9 @@ async function zt() {
1233
1453
  };
1234
1454
  })(), G);
1235
1455
  }
1236
- async function Bt(e, t) {
1237
- if (!("text" in e.schema.inlineContentSchema) || e.schema.inlineContentSchema.text !== ee.text) return [];
1238
- let { emojiData: n, emojiMart: r } = await zt();
1456
+ async function nn(e, t) {
1457
+ if (!("text" in e.schema.inlineContentSchema) || e.schema.inlineContentSchema.text !== te.text) return [];
1458
+ let { emojiData: n, emojiMart: r } = await tn();
1239
1459
  return (t.trim() === "" ? Object.values(n.emojis) : await r.SearchIndex.search(t)).map((t) => ({
1240
1460
  id: t.skins[0].native,
1241
1461
  onItemClick: () => e.insertInlineContent(t.skins[0].native + " ")
@@ -1244,16 +1464,16 @@ async function Bt(e, t) {
1244
1464
  //#endregion
1245
1465
  //#region src/extensions/TableHandles/TableHandles.ts
1246
1466
  var K;
1247
- function Vt(e) {
1467
+ function rn(e) {
1248
1468
  K || (K = document.createElement("div"), K.innerHTML = "_", K.style.opacity = "0", K.style.height = "1px", K.style.width = "1px", e instanceof Document ? e.body.appendChild(K) : e.appendChild(K));
1249
1469
  }
1250
- function Ht(e) {
1470
+ function an(e) {
1251
1471
  K &&= (e instanceof Document ? e.body.removeChild(K) : e.removeChild(K), void 0);
1252
1472
  }
1253
1473
  function q(e) {
1254
1474
  return Array.prototype.indexOf.call(e.parentElement.childNodes, e);
1255
1475
  }
1256
- function Ut(e) {
1476
+ function on(e) {
1257
1477
  let t = e;
1258
1478
  for (; t && t.nodeName !== "TD" && t.nodeName !== "TH" && !t.classList.contains("tableWrapper");) {
1259
1479
  if (t.classList.contains("ProseMirror")) return;
@@ -1271,11 +1491,11 @@ function Ut(e) {
1271
1491
  tbodyNode: t.querySelector("tbody")
1272
1492
  };
1273
1493
  }
1274
- function Wt(e, t) {
1494
+ function sn(e, t) {
1275
1495
  let n = t.querySelectorAll(e);
1276
1496
  for (let e = 0; e < n.length; e++) n[e].style.visibility = "hidden";
1277
1497
  }
1278
- var Gt = class {
1498
+ var cn = class {
1279
1499
  editor;
1280
1500
  pmView;
1281
1501
  state;
@@ -1297,57 +1517,57 @@ var Gt = class {
1297
1517
  mouseUpHandler = (e) => {
1298
1518
  this.mouseState = "up", this.mouseMoveHandler(e);
1299
1519
  };
1300
- mouseMoveHandler = (t) => {
1301
- if (this.menuFrozen || this.mouseState === "selecting" || !(t.target instanceof Element) || !this.pmView.dom.contains(t.target)) return;
1302
- let n = Ut(t.target);
1303
- if (n?.type === "cell" && this.mouseState === "down" && !this.state?.draggingState) {
1520
+ mouseMoveHandler = (e) => {
1521
+ if (this.menuFrozen || this.mouseState === "selecting" || !(e.target instanceof Element) || !this.pmView.dom.contains(e.target)) return;
1522
+ let t = on(e.target);
1523
+ if (t?.type === "cell" && this.mouseState === "down" && !this.state?.draggingState) {
1304
1524
  this.mouseState = "selecting", this.state?.show && (this.state.show = !1, this.state.showAddOrRemoveRowsButton = !1, this.state.showAddOrRemoveColumnsButton = !1, this.emitUpdate());
1305
1525
  return;
1306
1526
  }
1307
- if (!n || !this.editor.isEditable) {
1527
+ if (!t || !this.editor.isEditable) {
1308
1528
  this.state?.show && (this.state.show = !1, this.state.showAddOrRemoveRowsButton = !1, this.state.showAddOrRemoveColumnsButton = !1, this.emitUpdate());
1309
1529
  return;
1310
1530
  }
1311
- if (!n.tbodyNode) return;
1312
- let r = n.tbodyNode.getBoundingClientRect(), i = at(n.domNode, this.pmView);
1313
- if (!i) return;
1314
- this.tableElement = i.node;
1315
- let a, { pmNodeInfo: o, doc: s } = this.editor.transact((t) => ({
1316
- pmNodeInfo: e(i.id, t.doc),
1317
- doc: t.doc
1531
+ if (!t.tbodyNode) return;
1532
+ let n = t.tbodyNode.getBoundingClientRect(), r = ut(t.domNode, this.pmView);
1533
+ if (!r) return;
1534
+ this.tableElement = r.node;
1535
+ let i, { pmNodeInfo: a, doc: o } = this.editor.transact((e) => ({
1536
+ pmNodeInfo: c(r.id, e.doc),
1537
+ doc: e.doc
1318
1538
  }));
1319
- if (!o) throw Error(`Block with ID ${i.id} not found`);
1320
- let c = v(o.node, s);
1321
- if (m(this.editor, "table") && (this.tablePos = o.posBeforeNode + 1, a = c), !a) return;
1322
- this.tableId = i.id;
1323
- let l = n.domNode.closest(".tableWrapper")?.querySelector(".table-widgets-container");
1324
- if (n?.type === "wrapper") {
1325
- let e = t.clientY >= r.bottom - 1 && t.clientY < r.bottom + 20, n = t.clientX >= r.right - 1 && t.clientX < r.right + 20, i = this.state?.block?.id !== a.id || t.clientX > r.right || t.clientY > r.bottom;
1539
+ if (!a) throw Error(`Block with ID ${r.id} not found`);
1540
+ let s = u(a.node, o);
1541
+ if (g(this.editor, "table") && (this.tablePos = a.posBeforeNode + 1, i = s), !i) return;
1542
+ this.tableId = r.id;
1543
+ let l = t.domNode.closest(".tableWrapper")?.querySelector(".table-widgets-container");
1544
+ if (t?.type === "wrapper") {
1545
+ let t = e.clientY >= n.bottom - 1 && e.clientY < n.bottom + 20, r = e.clientX >= n.right - 1 && e.clientX < n.right + 20, a = this.state?.block?.id !== i.id || e.clientX > n.right || e.clientY > n.bottom;
1326
1546
  this.state = {
1327
1547
  ...this.state,
1328
1548
  show: !0,
1329
- showAddOrRemoveRowsButton: e,
1330
- showAddOrRemoveColumnsButton: n,
1331
- referencePosTable: r,
1332
- block: a,
1549
+ showAddOrRemoveRowsButton: t,
1550
+ showAddOrRemoveColumnsButton: r,
1551
+ referencePosTable: n,
1552
+ block: i,
1333
1553
  widgetContainer: l,
1334
- colIndex: i ? void 0 : this.state?.colIndex,
1335
- rowIndex: i ? void 0 : this.state?.rowIndex,
1336
- referencePosCell: i ? void 0 : this.state?.referencePosCell
1554
+ colIndex: a ? void 0 : this.state?.colIndex,
1555
+ rowIndex: a ? void 0 : this.state?.rowIndex,
1556
+ referencePosCell: a ? void 0 : this.state?.referencePosCell
1337
1557
  };
1338
1558
  } else {
1339
- let e = q(n.domNode), t = q(n.domNode.parentElement), o = n.domNode.getBoundingClientRect();
1340
- if (this.state !== void 0 && this.state.show && this.tableId === i.id && this.state.rowIndex === t && this.state.colIndex === e) return;
1559
+ let e = q(t.domNode), a = q(t.domNode.parentElement), o = t.domNode.getBoundingClientRect();
1560
+ if (this.state !== void 0 && this.state.show && this.tableId === r.id && this.state.rowIndex === a && this.state.colIndex === e) return;
1341
1561
  this.state = {
1342
1562
  show: !0,
1343
- showAddOrRemoveColumnsButton: e === a.content.rows[0].cells.length - 1,
1344
- showAddOrRemoveRowsButton: t === a.content.rows.length - 1,
1345
- referencePosTable: r,
1346
- block: a,
1563
+ showAddOrRemoveColumnsButton: e === i.content.rows[0].cells.length - 1,
1564
+ showAddOrRemoveRowsButton: a === i.content.rows.length - 1,
1565
+ referencePosTable: n,
1566
+ block: i,
1347
1567
  draggingState: void 0,
1348
1568
  referencePosCell: o,
1349
1569
  colIndex: e,
1350
- rowIndex: t,
1570
+ rowIndex: a,
1351
1571
  widgetContainer: l
1352
1572
  };
1353
1573
  }
@@ -1355,7 +1575,7 @@ var Gt = class {
1355
1575
  };
1356
1576
  dragOverHandler = (e) => {
1357
1577
  if (this.state?.draggingState === void 0) return;
1358
- e.preventDefault(), e.dataTransfer.dropEffect = "move", Wt(".prosemirror-dropcursor-block, .prosemirror-dropcursor-inline", this.pmView.root);
1578
+ e.preventDefault(), e.dataTransfer.dropEffect = "move", sn(".prosemirror-dropcursor-block, .prosemirror-dropcursor-inline", this.pmView.root);
1359
1579
  let t = {
1360
1580
  left: Math.min(Math.max(e.clientX, this.state.referencePosTable.left + 1), this.state.referencePosTable.right - 1),
1361
1581
  top: Math.min(Math.max(e.clientY, this.state.referencePosTable.top + 1), this.state.referencePosTable.bottom - 1)
@@ -1372,10 +1592,10 @@ var Gt = class {
1372
1592
  e.preventDefault();
1373
1593
  let { draggingState: t, colIndex: n, rowIndex: r } = this.state;
1374
1594
  this.state.draggingState = void 0;
1375
- let i = this.state.block.content.columnWidths;
1595
+ let o = this.state.block.content.columnWidths;
1376
1596
  if (t.draggedCellOrientation === "row") {
1377
- if (!c(this.state.block, t.originalIndex, r)) return !1;
1378
- let e = f(this.state.block, t.originalIndex, r);
1597
+ if (!i(this.state.block, t.originalIndex, r)) return !1;
1598
+ let e = a(this.state.block, t.originalIndex, r);
1379
1599
  this.editor.updateBlock(this.state.block, {
1380
1600
  type: "table",
1381
1601
  content: {
@@ -1384,13 +1604,13 @@ var Gt = class {
1384
1604
  }
1385
1605
  });
1386
1606
  } else {
1387
- if (!a(this.state.block, t.originalIndex, n)) return !1;
1388
- let e = u(this.state.block, t.originalIndex, n), [r] = i.splice(t.originalIndex, 1);
1389
- i.splice(n, 0, r), this.editor.updateBlock(this.state.block, {
1607
+ if (!p(this.state.block, t.originalIndex, n)) return !1;
1608
+ let e = ee(this.state.block, t.originalIndex, n), [r] = o.splice(t.originalIndex, 1);
1609
+ o.splice(n, 0, r), this.editor.updateBlock(this.state.block, {
1390
1610
  type: "table",
1391
1611
  content: {
1392
1612
  ...this.state.block.content,
1393
- columnWidths: i,
1613
+ columnWidths: o,
1394
1614
  rows: e
1395
1615
  }
1396
1616
  });
@@ -1405,142 +1625,154 @@ var Gt = class {
1405
1625
  return;
1406
1626
  }
1407
1627
  this.state.block = e;
1408
- let { height: t, width: n } = r(this.state.block);
1628
+ let { height: t, width: n } = o(this.state.block);
1409
1629
  this.state.rowIndex !== void 0 && this.state.colIndex !== void 0 && (this.state.rowIndex >= t && (this.state.rowIndex = t - 1), this.state.colIndex >= n && (this.state.colIndex = n - 1));
1410
- let i = this.tableElement.querySelector("tbody");
1411
- if (!i) throw Error("Table block does not contain a 'tbody' HTML element. This should never happen.");
1630
+ let r = this.tableElement.querySelector("tbody");
1631
+ if (!r) throw Error("Table block does not contain a 'tbody' HTML element. This should never happen.");
1412
1632
  if (this.state.rowIndex !== void 0 && this.state.colIndex !== void 0) {
1413
- let e = i.children[this.state.rowIndex].children[this.state.colIndex];
1633
+ let e = r.children[this.state.rowIndex].children[this.state.colIndex];
1414
1634
  e ? this.state.referencePosCell = e.getBoundingClientRect() : (this.state.rowIndex = void 0, this.state.colIndex = void 0);
1415
1635
  }
1416
- this.state.referencePosTable = i.getBoundingClientRect(), this.emitUpdate();
1636
+ this.state.referencePosTable = r.getBoundingClientRect(), this.emitUpdate();
1417
1637
  }
1418
1638
  destroy() {
1419
1639
  this.pmView.dom.removeEventListener("mousemove", this.mouseMoveHandler), window.removeEventListener("mouseup", this.mouseUpHandler), this.pmView.dom.removeEventListener("mousedown", this.viewMousedownHandler), this.pmView.root.removeEventListener("dragover", this.dragOverHandler), this.pmView.root.removeEventListener("drop", this.dropHandler);
1420
1640
  }
1421
- }, J = new w("TableHandlesPlugin"), Kt = b(({ editor: e }) => {
1422
- let r, o = y(void 0);
1641
+ }, J = new w("TableHandlesPlugin"), ln = b(({ editor: t }) => {
1642
+ let n, a = y(void 0);
1423
1643
  return {
1424
1644
  key: "tableHandles",
1425
- store: o,
1645
+ store: a,
1426
1646
  prosemirrorPlugins: [new C({
1427
1647
  key: J,
1428
- view: (t) => (r = new Gt(e, t, (e) => {
1429
- o.setState(e?.block ? {
1648
+ view: (e) => (n = new cn(t, e, (e) => {
1649
+ a.setState(e?.block ? {
1430
1650
  ...e,
1431
1651
  draggingState: e.draggingState ? { ...e.draggingState } : void 0
1432
1652
  } : void 0);
1433
- }), r),
1653
+ }), n),
1434
1654
  props: { decorations: (e) => {
1435
- if (r === void 0 || r.state === void 0 || r.state.draggingState === void 0 || r.tablePos === void 0) return;
1436
- let n = r.state.draggingState.draggedCellOrientation === "row" ? r.state.rowIndex : r.state.colIndex;
1437
- if (n === void 0) return;
1438
- let i = [], { block: o, draggingState: s } = r.state, { originalIndex: l, draggedCellOrientation: u } = s;
1439
- if (n === l || !o || u === "row" && !c(o, l, n) || u === "col" && !a(o, l, n)) return D.create(e.doc, i);
1440
- let f = e.doc.resolve(r.tablePos + 1);
1441
- return r.state.draggingState.draggedCellOrientation === "row" ? d(r.state.block, n).forEach(({ row: t, col: r }) => {
1442
- let a = e.doc.resolve(f.posAtIndex(t) + 1), o = e.doc.resolve(a.posAtIndex(r) + 1), s = o.node(), c = o.pos + (n > l ? s.nodeSize - 2 : 0);
1443
- i.push(E.widget(c, () => {
1655
+ if (n === void 0 || n.state === void 0 || n.state.draggingState === void 0 || n.tablePos === void 0) return;
1656
+ let t = n.state.draggingState.draggedCellOrientation === "row" ? n.state.rowIndex : n.state.colIndex;
1657
+ if (t === void 0) return;
1658
+ let a = [], { block: o, draggingState: s } = n.state, { originalIndex: c, draggedCellOrientation: l } = s;
1659
+ if (t === c || !o || l === "row" && !i(o, c, t) || l === "col" && !p(o, c, t)) return O.create(e.doc, a);
1660
+ let u = e.doc.resolve(n.tablePos + 1);
1661
+ return n.state.draggingState.draggedCellOrientation === "row" ? r(n.state.block, t).forEach(({ row: n, col: r }) => {
1662
+ let i = e.doc.resolve(u.posAtIndex(n) + 1), o = e.doc.resolve(i.posAtIndex(r) + 1), s = o.node(), l = o.pos + (t > c ? s.nodeSize - 2 : 0);
1663
+ a.push(D.widget(l, () => {
1444
1664
  let e = document.createElement("div");
1445
- return e.className = "bn-table-drop-cursor", e.style.left = "0", e.style.right = "0", n > l ? e.style.bottom = "-2px" : e.style.top = "-3px", e.style.height = "4px", e;
1665
+ return e.className = "bn-table-drop-cursor", e.style.left = "0", e.style.right = "0", t > c ? e.style.bottom = "-2px" : e.style.top = "-3px", e.style.height = "4px", e;
1446
1666
  }));
1447
- }) : t(r.state.block, n).forEach(({ row: t, col: r }) => {
1448
- let a = e.doc.resolve(f.posAtIndex(t) + 1), o = e.doc.resolve(a.posAtIndex(r) + 1), s = o.node(), c = o.pos + (n > l ? s.nodeSize - 2 : 0);
1449
- i.push(E.widget(c, () => {
1667
+ }) : m(n.state.block, t).forEach(({ row: n, col: r }) => {
1668
+ let i = e.doc.resolve(u.posAtIndex(n) + 1), o = e.doc.resolve(i.posAtIndex(r) + 1), s = o.node(), l = o.pos + (t > c ? s.nodeSize - 2 : 0);
1669
+ a.push(D.widget(l, () => {
1450
1670
  let e = document.createElement("div");
1451
- return e.className = "bn-table-drop-cursor", e.style.top = "0", e.style.bottom = "0", n > l ? e.style.right = "-2px" : e.style.left = "-3px", e.style.width = "4px", e;
1671
+ return e.className = "bn-table-drop-cursor", e.style.top = "0", e.style.bottom = "0", t > c ? e.style.right = "-2px" : e.style.left = "-3px", e.style.width = "4px", e;
1452
1672
  }));
1453
- }), D.create(e.doc, i);
1673
+ }), O.create(e.doc, a);
1454
1674
  } }
1455
1675
  })],
1456
- colDragStart(t) {
1457
- if (r === void 0 || r.state === void 0 || r.state.colIndex === void 0) throw Error("Attempted to drag table column, but no table block was hovered prior.");
1458
- r.state.draggingState = {
1676
+ colDragStart(e) {
1677
+ if (n === void 0 || n.state === void 0 || n.state.colIndex === void 0) throw Error("Attempted to drag table column, but no table block was hovered prior.");
1678
+ n.state.draggingState = {
1459
1679
  draggedCellOrientation: "col",
1460
- originalIndex: r.state.colIndex,
1461
- mousePos: t.clientX
1462
- }, r.emitUpdate(), e.transact((e) => e.setMeta(J, {
1463
- draggedCellOrientation: r.state.draggingState.draggedCellOrientation,
1464
- originalIndex: r.state.colIndex,
1465
- newIndex: r.state.colIndex,
1466
- tablePos: r.tablePos
1467
- })), !e.headless && (Vt(e.prosemirrorView.root), t.dataTransfer.setDragImage(K, 0, 0), t.dataTransfer.effectAllowed = "move");
1680
+ originalIndex: n.state.colIndex,
1681
+ mousePos: e.clientX
1682
+ }, n.emitUpdate(), t.transact((e) => e.setMeta(J, {
1683
+ draggedCellOrientation: n.state.draggingState.draggedCellOrientation,
1684
+ originalIndex: n.state.colIndex,
1685
+ newIndex: n.state.colIndex,
1686
+ tablePos: n.tablePos
1687
+ })), !t.headless && (rn(t.prosemirrorView.root), e.dataTransfer.setDragImage(K, 0, 0), e.dataTransfer.effectAllowed = "move");
1468
1688
  },
1469
- rowDragStart(t) {
1470
- if (r.state === void 0 || r.state.rowIndex === void 0) throw Error("Attempted to drag table row, but no table block was hovered prior.");
1471
- r.state.draggingState = {
1689
+ rowDragStart(e) {
1690
+ if (n.state === void 0 || n.state.rowIndex === void 0) throw Error("Attempted to drag table row, but no table block was hovered prior.");
1691
+ n.state.draggingState = {
1472
1692
  draggedCellOrientation: "row",
1473
- originalIndex: r.state.rowIndex,
1474
- mousePos: t.clientY
1475
- }, r.emitUpdate(), e.transact((e) => e.setMeta(J, {
1476
- draggedCellOrientation: r.state.draggingState.draggedCellOrientation,
1477
- originalIndex: r.state.rowIndex,
1478
- newIndex: r.state.rowIndex,
1479
- tablePos: r.tablePos
1480
- })), !e.headless && (Vt(e.prosemirrorView.root), t.dataTransfer.setDragImage(K, 0, 0), t.dataTransfer.effectAllowed = "copyMove");
1693
+ originalIndex: n.state.rowIndex,
1694
+ mousePos: e.clientY
1695
+ }, n.emitUpdate(), t.transact((e) => e.setMeta(J, {
1696
+ draggedCellOrientation: n.state.draggingState.draggedCellOrientation,
1697
+ originalIndex: n.state.rowIndex,
1698
+ newIndex: n.state.rowIndex,
1699
+ tablePos: n.tablePos
1700
+ })), !t.headless && (rn(t.prosemirrorView.root), e.dataTransfer.setDragImage(K, 0, 0), e.dataTransfer.effectAllowed = "copyMove");
1481
1701
  },
1482
1702
  dragEnd() {
1483
- if (r.state === void 0) throw Error("Attempted to drag table row, but no table block was hovered prior.");
1484
- r.state.draggingState = void 0, r.emitUpdate(), e.transact((e) => e.setMeta(J, null)), !e.headless && Ht(e.prosemirrorView.root);
1703
+ if (n.state === void 0) throw Error("Attempted to drag table row, but no table block was hovered prior.");
1704
+ n.state.draggingState = void 0, n.emitUpdate(), t.transact((e) => e.setMeta(J, null)), !t.headless && an(t.prosemirrorView.root);
1485
1705
  },
1486
1706
  freezeHandles() {
1487
- r.menuFrozen = !0;
1707
+ n.menuFrozen = !0;
1488
1708
  },
1489
1709
  unfreezeHandles() {
1490
- r.menuFrozen = !1;
1710
+ n.menuFrozen = !1;
1491
1711
  },
1492
1712
  hideHandlesIfNotFrozen() {
1493
- !r.menuFrozen && r.state?.show && (r.state.show = !1, r.state.showAddOrRemoveRowsButton = !1, r.state.showAddOrRemoveColumnsButton = !1, r.emitUpdate());
1713
+ !n.menuFrozen && n.state?.show && (n.state.show = !1, n.state.showAddOrRemoveRowsButton = !1, n.state.showAddOrRemoveColumnsButton = !1, n.emitUpdate());
1494
1714
  },
1495
1715
  getCellsAtRowHandle(e, t) {
1496
- return d(e, t);
1716
+ return r(e, t);
1497
1717
  },
1498
- getCellsAtColumnHandle(e, n) {
1499
- return t(e, n);
1718
+ getCellsAtColumnHandle(e, t) {
1719
+ return m(e, t);
1500
1720
  },
1501
- setCellSelection(e, t, n = t) {
1502
- if (!r) throw Error("Table handles view not initialized");
1503
- let i = e.doc.resolve(r.tablePos + 1), a = e.doc.resolve(i.posAtIndex(t.row) + 1), o = e.doc.resolve(a.posAtIndex(t.col)), s = e.doc.resolve(i.posAtIndex(n.row) + 1), c = e.doc.resolve(s.posAtIndex(n.col)), l = e.tr;
1504
- return l.setSelection(new he(o, c)), e.apply(l);
1721
+ setCellSelection(e, t, r = t) {
1722
+ if (!n) throw Error("Table handles view not initialized");
1723
+ let i = e.doc.resolve(n.tablePos + 1), a = e.doc.resolve(i.posAtIndex(t.row) + 1), o = e.doc.resolve(a.posAtIndex(t.col)), s = e.doc.resolve(i.posAtIndex(r.row) + 1), c = e.doc.resolve(s.posAtIndex(r.col)), l = e.tr;
1724
+ return l.setSelection(new me(o, c)), e.apply(l);
1505
1725
  },
1506
- addRowOrColumn(t, n) {
1507
- e.exec((e, r) => {
1508
- let i = this.setCellSelection(e, n.orientation === "row" ? {
1509
- row: t,
1726
+ addRowOrColumn(e, n) {
1727
+ t.exec((t, r) => {
1728
+ let i = this.setCellSelection(t, n.orientation === "row" ? {
1729
+ row: e,
1510
1730
  col: 0
1511
1731
  } : {
1512
1732
  row: 0,
1513
- col: t
1733
+ col: e
1514
1734
  });
1515
- return n.orientation === "row" ? n.side === "above" ? ye(i, r) : ve(i, r) : n.side === "left" ? _e(i, r) : ge(i, r);
1735
+ return n.orientation === "row" ? n.side === "above" ? ve(i, r) : _e(i, r) : n.side === "left" ? ge(i, r) : he(i, r);
1516
1736
  });
1517
1737
  },
1518
- removeRowOrColumn(t, n) {
1519
- return n === "row" ? e.exec((e, n) => xe(this.setCellSelection(e, {
1520
- row: t,
1521
- col: 0
1522
- }), n)) : e.exec((e, n) => be(this.setCellSelection(e, {
1523
- row: 0,
1524
- col: t
1525
- }), n));
1738
+ removeRowOrColumn(e, n) {
1739
+ return n === "row" ? t.exec((t, n) => {
1740
+ let r = this.setCellSelection(t, {
1741
+ row: e,
1742
+ col: 0
1743
+ });
1744
+ return be(r, n);
1745
+ }) : t.exec((t, n) => {
1746
+ let r = this.setCellSelection(t, {
1747
+ row: 0,
1748
+ col: e
1749
+ });
1750
+ return ye(r, n);
1751
+ });
1526
1752
  },
1527
- mergeCells(t) {
1528
- return e.exec((e, n) => Se(t ? this.setCellSelection(e, t.relativeStartCell, t.relativeEndCell) : e, n));
1753
+ mergeCells(e) {
1754
+ return t.exec((t, n) => {
1755
+ let r = e ? this.setCellSelection(t, e.relativeStartCell, e.relativeEndCell) : t;
1756
+ return xe(r, n);
1757
+ });
1529
1758
  },
1530
- splitCell(t) {
1531
- return e.exec((e, n) => Ce(t ? this.setCellSelection(e, t) : e, n));
1759
+ splitCell(e) {
1760
+ return t.exec((t, n) => {
1761
+ let r = e ? this.setCellSelection(t, e) : t;
1762
+ return Se(r, n);
1763
+ });
1532
1764
  },
1533
1765
  getCellSelection() {
1534
- return e.transact((e) => {
1766
+ return t.transact((e) => {
1535
1767
  let t = e.selection, n = t.$from, r = t.$to;
1536
- if (_(t)) {
1768
+ if (v(t)) {
1537
1769
  let { ranges: e } = t;
1538
1770
  e.forEach((e) => {
1539
1771
  n = e.$from.min(n ?? e.$from), r = e.$to.max(r ?? e.$to);
1540
1772
  });
1541
1773
  } else {
1542
1774
  let i = t.$from.pos - t.$from.parentOffset - 1, a = t.$to.pos - t.$to.parentOffset - 1;
1543
- if (i < 0 || a < 0 || (n = e.doc.resolve(i), r = e.doc.resolve(a), !p(n.parent) || !p(r.parent))) return;
1775
+ if (i < 0 || a < 0 || (n = e.doc.resolve(i), r = e.doc.resolve(a), !h(n.parent) || !h(r.parent))) return;
1544
1776
  }
1545
1777
  let i = e.doc.resolve(n.pos - n.parentOffset - 1), a = e.doc.resolve(r.pos - r.parentOffset - 1), o = e.doc.resolve(i.pos - i.parentOffset - 1), s = n.index(i.depth), c = i.index(o.depth), l = r.index(a.depth), u = a.index(o.depth), d = [];
1546
1778
  for (let e = c; e <= u; e++) for (let t = s; t <= l; t++) d.push({
@@ -1560,37 +1792,37 @@ var Gt = class {
1560
1792
  };
1561
1793
  });
1562
1794
  },
1563
- getMergeDirection(t) {
1564
- return e.transact((e) => {
1565
- let n = _(e.selection) ? e.selection : void 0;
1566
- if (!n || !t || n.ranges.length <= 1) return;
1567
- let r = this.getCellSelection();
1568
- if (r) return i(r.from, r.to, t) ? "vertical" : "horizontal";
1795
+ getMergeDirection(n) {
1796
+ return t.transact((t) => {
1797
+ let r = v(t.selection) ? t.selection : void 0;
1798
+ if (!r || !n || r.ranges.length <= 1) return;
1799
+ let i = this.getCellSelection();
1800
+ if (i) return e(i.from, i.to, n) ? "vertical" : "horizontal";
1569
1801
  });
1570
1802
  },
1571
1803
  cropEmptyRowsOrColumns(e, t) {
1572
- return ne(e, t);
1804
+ return f(e, t);
1573
1805
  },
1574
- addRowsOrColumns(e, t, r) {
1575
- return n(e, t, r);
1806
+ addRowsOrColumns(e, t, n) {
1807
+ return ne(e, t, n);
1576
1808
  }
1577
1809
  };
1578
1810
  }), Y = new w("trailingNode");
1579
1811
  function X(e) {
1580
1812
  let t = e.lastChild, n = t?.firstChild;
1581
- return !(t?.type.name === "blockContainer" && n?.type.name === "paragraph" && n.content.size === 0);
1813
+ return t?.type.name !== "blockContainer" || n?.type.name !== "paragraph" || n.content.size !== 0;
1582
1814
  }
1583
- function qt(e) {
1815
+ function un(e) {
1584
1816
  if (!e.type.schema.nodes.column) {
1585
1817
  let t = e.lastChild;
1586
1818
  return t && X(t) ? [e.content.size - 1] : [];
1587
1819
  }
1588
1820
  let t = [];
1589
- return e.descendants((e, n, r) => e.isTextblock ? !1 : ((e.type.name === "column" || e.type.name === "blockGroup" && r?.type.name === "doc") && X(e) && t.push(n + e.nodeSize - 1), !0)), t;
1821
+ return e.descendants((e, n, r) => !e.isTextblock && ((e.type.name === "column" || e.type.name === "blockGroup" && r?.type.name === "doc") && X(e) && t.push(n + e.nodeSize - 1), !0)), t;
1590
1822
  }
1591
- var Jt = b(({ editor: e }) => {
1823
+ var dn = b(({ editor: e }) => {
1592
1824
  function t(t) {
1593
- return E.widget(t, () => {
1825
+ return D.widget(t, () => {
1594
1826
  let t = document.createElement("div");
1595
1827
  return t.className = "bn-trailing-block", t.contentEditable = "false", t.addEventListener("mousedown", (n) => {
1596
1828
  n.preventDefault();
@@ -1605,7 +1837,7 @@ var Jt = b(({ editor: e }) => {
1605
1837
  }, { side: 1 });
1606
1838
  }
1607
1839
  function n(e, n, r) {
1608
- let i = n.map(e.mapping, e.doc), a = new Set(r ? qt(e.doc) : []), o = /* @__PURE__ */ new Set(), s = [];
1840
+ let i = n.map(e.mapping, e.doc), a = new Set(r ? un(e.doc) : []), o = /* @__PURE__ */ new Set(), s = [];
1609
1841
  for (let e of i.find()) a.has(e.from) && !o.has(e.from) ? o.add(e.from) : s.push(e);
1610
1842
  let c = [...a].filter((e) => !o.has(e)), l = i;
1611
1843
  return s.length > 0 && (l = l.remove(s)), c.length > 0 && (l = l.add(e.doc, c.map(t))), l;
@@ -1615,7 +1847,7 @@ var Jt = b(({ editor: e }) => {
1615
1847
  prosemirrorPlugins: [new C({
1616
1848
  key: Y,
1617
1849
  state: {
1618
- init: (t, r) => n(r.tr, D.empty, e.isEditable),
1850
+ init: (t, r) => n(r.tr, O.empty, e.isEditable),
1619
1851
  apply: (t, r) => !t.docChanged && !t.getMeta(Y) ? r : n(t, r, e.isEditable)
1620
1852
  },
1621
1853
  view(e) {
@@ -1646,7 +1878,7 @@ function $(e) {
1646
1878
  let t = typeof e == "object" ? e.id : e;
1647
1879
  throw Error(`Snapshot not found: ${String(t)}`);
1648
1880
  }
1649
- var Yt = b(({ options: e, editor: t }) => {
1881
+ var fn = b(({ options: e, editor: t }) => {
1650
1882
  let { endpoints: n, preview: r, getCurrentDocument: i, serializeCurrentContent: a, resolveUsers: o } = typeof e == "function" ? e(t) : e, s = typeof n == "function" ? n(t) : n, c = re(o), l = y({
1651
1883
  snapshots: [],
1652
1884
  previewedSnapshotId: void 0,
@@ -1762,10 +1994,10 @@ var Yt = b(({ options: e, editor: t }) => {
1762
1994
  });
1763
1995
  //#endregion
1764
1996
  //#region src/extensions/Versioning/inMemoryVersioning.ts
1765
- function Xt(e) {
1997
+ function pn(e) {
1766
1998
  return e.id === Z ? "Current version" : e.name ?? "Unnamed version";
1767
1999
  }
1768
- function Zt(e) {
2000
+ function mn(e) {
1769
2001
  let t, n = !1, r = (t) => {
1770
2002
  e.replaceBlocks(e.document, t);
1771
2003
  }, i = () => e.getExtension("diffVersioning");
@@ -1777,7 +2009,7 @@ function Zt(e) {
1777
2009
  t === void 0 && (t = e.document);
1778
2010
  let l = i();
1779
2011
  if (o && l) {
1780
- l.renderDiff(a, o, c && Xt(c.snapshot)), n = !0;
2012
+ l.renderDiff(a, o, c && pn(c.snapshot)), n = !0;
1781
2013
  return;
1782
2014
  }
1783
2015
  n = !1, r(a);
@@ -1794,32 +2026,35 @@ function Zt(e) {
1794
2026
  }
1795
2027
  };
1796
2028
  }
1797
- function Qt() {
1798
- let e = [], t = /* @__PURE__ */ new Map(), n = 1;
2029
+ function hn() {
2030
+ let e = [], t = /* @__PURE__ */ new Map(), n = 1, r = 0;
2031
+ function i() {
2032
+ return r = Math.max(Date.now(), r + 1), r;
2033
+ }
1799
2034
  return {
1800
2035
  async list() {
1801
2036
  return Q([...e]);
1802
2037
  },
1803
- async create(r, i) {
1804
- let a = Date.now(), o = String(n++), s = {
1805
- id: o,
1806
- name: i?.name,
1807
- createdAt: a,
1808
- updatedAt: a
2038
+ async create(r, a) {
2039
+ let o = i(), s = String(n++), c = {
2040
+ id: s,
2041
+ name: a?.name,
2042
+ createdAt: o,
2043
+ updatedAt: o
1809
2044
  };
1810
- return e.push(s), t.set(o, structuredClone(r)), s;
2045
+ return e.push(c), t.set(s, structuredClone(r)), c;
1811
2046
  },
1812
- async restore(r, i) {
1813
- let a = String(i.id), o = t.get(a);
1814
- if (!o) throw Error(`Snapshot ${a} not found`);
1815
- let s = Date.now(), c = String(n++), l = {
1816
- id: c,
2047
+ async restore(r, a) {
2048
+ let o = String(a.id), s = t.get(o);
2049
+ if (!s) throw Error(`Snapshot ${o} not found`);
2050
+ let c = i(), l = String(n++), u = {
2051
+ id: l,
1817
2052
  name: "Before restore",
1818
- createdAt: s,
1819
- updatedAt: s,
1820
- restoredFromSnapshotId: a
2053
+ createdAt: c,
2054
+ updatedAt: c,
2055
+ restoredFromSnapshotId: o
1821
2056
  };
1822
- return e.push(l), t.set(c, structuredClone(r)), structuredClone(o);
2057
+ return e.push(u), t.set(l, structuredClone(r)), structuredClone(s);
1823
2058
  },
1824
2059
  async getContent(e) {
1825
2060
  let n = String(e.id), r = t.get(n);
@@ -1829,7 +2064,7 @@ function Qt() {
1829
2064
  async rename(t, n) {
1830
2065
  let r = e.find((e) => e.id === t.id);
1831
2066
  if (!r) throw Error(`Snapshot ${String(t.id)} not found`);
1832
- r.name = n, r.updatedAt = Date.now();
2067
+ r.name = n, r.updatedAt = i();
1833
2068
  },
1834
2069
  async remove(n) {
1835
2070
  let r = e.findIndex((e) => e.id === n.id);
@@ -1838,8 +2073,8 @@ function Qt() {
1838
2073
  }
1839
2074
  };
1840
2075
  }
1841
- function $t(e) {
1842
- let t = Qt();
2076
+ function gn(e) {
2077
+ let t = hn();
1843
2078
  return {
1844
2079
  endpoints: {
1845
2080
  ...t,
@@ -1849,12 +2084,12 @@ function $t(e) {
1849
2084
  updatedAt: Date.now()
1850
2085
  }, ...await t.list()]
1851
2086
  },
1852
- preview: Zt(e),
2087
+ preview: mn(e),
1853
2088
  getCurrentDocument: () => e.document,
1854
2089
  serializeCurrentContent: () => e.document
1855
2090
  };
1856
2091
  }
1857
2092
  //#endregion
1858
- export { k as A, Ye as C, Ke as D, Ge as E, ze as O, Xe as S, qe as T, V as _, Yt as a, et as b, Kt as c, Bt as d, Rt as f, Ot as g, kt as h, Z as i, Re as k, Gt as l, Lt as m, $t as n, Q as o, It as p, Qt as r, Jt as s, Zt as t, J as u, it as v, Je as w, Qe as x, tt as y };
2093
+ export { Xe as A, st as C, tt as D, nt as E, k as F, Ye as M, He as N, et as O, Ve as P, lt as S, it as T, Wt as _, fn as a, It as b, ln as c, nn as d, en as f, Kt as g, qt as h, Z as i, Je as j, $e as k, cn as l, Jt as m, gn as n, Q as o, $t as p, hn as r, dn as s, mn as t, J as u, Gt as v, ot as w, B as x, Lt as y };
1859
2094
 
1860
- //# sourceMappingURL=extensions-BR5hkAio.js.map
2095
+ //# sourceMappingURL=extensions-DGuhtOgB.js.map