@clevertask/scribe 0.1.32 → 0.1.33

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 (46) hide show
  1. package/dist/{BarMenu-Bm5IfWVV.js → BarMenu-KDCTLxwU.js} +1 -1
  2. package/dist/components/Menu/BarMenu.js +1 -1
  3. package/dist/components/Menu/BubbleMenu.js +2 -2
  4. package/dist/components/Menu/CalloutBubbleMenu.js +2 -2
  5. package/dist/components/Menu/LinkBubbleMenu.js +2 -2
  6. package/dist/components/Menu/Mobile/ListOptionBar.js +1 -1
  7. package/dist/components/Menu/TableBubbleMenu.js +3 -3
  8. package/dist/components/Menu/TableHeightSettings.js +1 -1
  9. package/dist/components/Menu/linkBubbleMenuPlugin.js +1 -1
  10. package/dist/components/Scribe/extension/callout.js +1 -1
  11. package/dist/components/Scribe/extension/emoji/suggest.js +1 -1
  12. package/dist/components/Scribe/extension/extension-link.js +1 -1
  13. package/dist/components/Scribe/extension/extension-markdown-paste.js +2 -2
  14. package/dist/components/Scribe/extension/extension-selectedText.js +1 -1
  15. package/dist/components/Scribe/extension/external-link-preview/commands.js +1 -1
  16. package/dist/components/Scribe/extension/external-link-preview/render-html.js +1 -1
  17. package/dist/components/Scribe/extension/external-link-preview/schema.js +1 -1
  18. package/dist/components/Scribe/extension/index.js +1 -1
  19. package/dist/components/Scribe/extension/resizable-table.js +2 -2
  20. package/dist/components/Scribe/extension/slashCommand/SlashCommandList.js +3 -3
  21. package/dist/components/Scribe/extension/slashCommand/index.js +2 -2
  22. package/dist/components/Scribe/extension/slashCommand/renderItems.js +1 -1
  23. package/dist/components/Scribe/extension/table-layout.js +1 -1
  24. package/dist/components/Scribe/extension/tableOfContents.js +1 -1
  25. package/dist/components/Scribe/index.js +4 -4
  26. package/dist/{dist-BoAzo5MN.js → dist-B0QTAeBQ.js} +816 -644
  27. package/dist/{dist-SM4NoN4h.js → dist-D2ylH0wL.js} +144 -126
  28. package/dist/{dist-BqlzKS-_.js → dist-Dn1WHiQf.js} +2 -2
  29. package/dist/document-node-capabilities.js +1 -1
  30. package/dist/{extension-dz0CIf3r.js → extension-BpvJtqXe.js} +2 -2
  31. package/dist/{extension-link-DxIXGCtV.js → extension-link-DvMmKOua.js} +2 -2
  32. package/dist/{html-to-markdown-DeRG9OPm.js → html-to-markdown-CsSZIegJ.js} +1 -1
  33. package/dist/main.js +2 -2
  34. package/dist/{markdown-to-html-tCPjQ5u6.js → markdown-to-html-YkhBwkrX.js} +225 -217
  35. package/dist/{menus-BKxcTUsl.js → menus-DcCI3Z7f.js} +5 -5
  36. package/dist/purify.es-BpCmlcgS.js +877 -0
  37. package/dist/{rolldown-runtime-CtkjhSXr.js → rolldown-runtime-gFifre8I.js} +1 -1
  38. package/dist/{schema-extensions-B9hR1VrD.js → schema-extensions-CROueYL8.js} +6 -6
  39. package/dist/schema-extensions.js +1 -1
  40. package/dist/schema.js +1 -1
  41. package/dist/{table-layout-ClqaGg1E.js → table-layout-CARP38M-.js} +2 -2
  42. package/dist/utils/html-to-markdown.js +1 -1
  43. package/dist/utils/index.js +4 -4
  44. package/dist/utils/markdown-to-html.js +1 -1
  45. package/package.json +52 -52
  46. package/dist/purify.es-CSWcs7f1.js +0 -844
@@ -1,23 +1,23 @@
1
1
  import { AllSelection as e, EditorState as t, NodeSelection as n, Plugin as r, PluginKey as i, Selection as a, TextSelection as o } from "@tiptap/pm/state";
2
2
  import { RemoveMarkStep as s, ReplaceAroundStep as c, ReplaceStep as l, Transform as u, canJoin as d, canSplit as f, findWrapping as p, joinPoint as m, liftTarget as h } from "@tiptap/pm/transform";
3
- import { createParagraphNear as g, exitCode as _, joinBackward as v, joinDown as y, joinForward as b, joinTextblockBackward as x, joinTextblockForward as ee, joinUp as te, lift as S, liftEmptyBlock as ne, newlineInCode as C, selectNodeBackward as re, selectNodeForward as ie, selectParentNode as ae, selectTextblockEnd as oe, selectTextblockStart as se, setBlockType as ce, wrapIn as le } from "@tiptap/pm/commands";
4
- import { DOMParser as ue, DOMSerializer as de, Fragment as w, Schema as fe, Slice as pe } from "@tiptap/pm/model";
5
- import { liftListItem as me, sinkListItem as he, wrapInList as ge } from "@tiptap/pm/schema-list";
6
- import { DecorationSet as T, EditorView as _e } from "@tiptap/pm/view";
7
- import { keymap as ve } from "@tiptap/pm/keymap";
8
- import { closeHistory as ye } from "@tiptap/pm/history";
9
- //#region node_modules/.pnpm/@tiptap+core@3.31.4_@tiptap+pm@3.31.4/node_modules/@tiptap/core/dist/rolldown-runtime-D7D4PA-g.js
10
- var be = Object.defineProperty, xe = (e, t) => {
3
+ import { createParagraphNear as g, exitCode as _, joinBackward as v, joinDown as y, joinForward as b, joinTextblockBackward as x, joinTextblockForward as S, joinUp as ee, lift as te, liftEmptyBlock as C, newlineInCode as ne, selectNodeBackward as w, selectNodeForward as re, selectParentNode as ie, selectTextblockEnd as ae, selectTextblockStart as oe, setBlockType as se, wrapIn as ce } from "@tiptap/pm/commands";
4
+ import { DOMParser as le, DOMSerializer as ue, Fragment as T, Schema as E, Slice as de } from "@tiptap/pm/model";
5
+ import { liftListItem as fe, sinkListItem as pe, wrapInList as me } from "@tiptap/pm/schema-list";
6
+ import { DecorationSet as D, EditorView as he } from "@tiptap/pm/view";
7
+ import { keymap as ge } from "@tiptap/pm/keymap";
8
+ import { closeHistory as _e } from "@tiptap/pm/history";
9
+ //#region node_modules/.pnpm/@tiptap+core@3.32.0_@tiptap+pm@3.32.0/node_modules/@tiptap/core/dist/rolldown-runtime-D7D4PA-g.js
10
+ var ve = Object.defineProperty, ye = (e, t) => {
11
11
  let n = {};
12
- for (var r in e) be(n, r, {
12
+ for (var r in e) ve(n, r, {
13
13
  get: e[r],
14
14
  enumerable: !0
15
15
  });
16
- return t || be(n, Symbol.toStringTag, { value: "Module" }), n;
16
+ return t || ve(n, Symbol.toStringTag, { value: "Module" }), n;
17
17
  };
18
18
  //#endregion
19
- //#region node_modules/.pnpm/@tiptap+core@3.31.4_@tiptap+pm@3.31.4/node_modules/@tiptap/core/dist/index.js
20
- function E(e) {
19
+ //#region node_modules/.pnpm/@tiptap+core@3.32.0_@tiptap+pm@3.32.0/node_modules/@tiptap/core/dist/index.js
20
+ function be(e) {
21
21
  let { state: t, transaction: n } = e, { selection: r } = n, { doc: i } = n, { storedMarks: a } = n;
22
22
  return {
23
23
  ...t,
@@ -41,7 +41,7 @@ function E(e) {
41
41
  }
42
42
  };
43
43
  }
44
- var D = class e {
44
+ var O = class e {
45
45
  constructor(e) {
46
46
  this.editor = e.editor, this.rawCommands = this.editor.extensionManager.commands, this.customState = e.state;
47
47
  }
@@ -101,7 +101,7 @@ var D = class e {
101
101
  tr: e,
102
102
  editor: r,
103
103
  view: a,
104
- state: E({
104
+ state: be({
105
105
  state: i,
106
106
  transaction: e
107
107
  }),
@@ -114,12 +114,12 @@ var D = class e {
114
114
  };
115
115
  return o;
116
116
  }
117
- }, Se = () => ({ editor: e, view: t }) => (requestAnimationFrame(() => {
117
+ }, xe = () => ({ editor: e, view: t }) => (requestAnimationFrame(() => {
118
118
  if (!e.isDestroyed) {
119
119
  var n;
120
120
  t.dom.blur(), (n = window) == null || (n = n.getSelection()) == null || n.removeAllRanges();
121
121
  }
122
- }), !0), Ce = (e = !0) => ({ commands: t }) => t.setContent("", { emitUpdate: e }), we = () => ({ state: e, tr: t, dispatch: n }) => {
122
+ }), !0), Se = (e = !0) => ({ commands: t }) => t.setContent("", { emitUpdate: e }), Ce = () => ({ state: e, tr: t, dispatch: n }) => {
123
123
  let { selection: r } = t, { ranges: i } = r;
124
124
  return n && i.forEach(({ $from: n, $to: r }) => {
125
125
  e.doc.nodesBetween(n.pos, r.pos, (e, n) => {
@@ -134,12 +134,12 @@ var D = class e {
134
134
  (c || c === 0) && t.lift(s, c);
135
135
  });
136
136
  }), !0;
137
- }, Te = (e) => (t) => e(t), Ee = () => ({ state: e, dispatch: t }) => g(e, t), De = (e, t) => ({ editor: n, tr: r }) => {
137
+ }, we = (e) => (t) => e(t), Te = () => ({ state: e, dispatch: t }) => g(e, t), Ee = (e, t) => ({ editor: n, tr: r }) => {
138
138
  let { state: i } = n, a = i.doc.slice(e.from, e.to);
139
139
  r.deleteRange(e.from, e.to);
140
140
  let s = r.mapping.map(t);
141
141
  return r.insert(s, a.content), r.setSelection(new o(r.doc.resolve(Math.max(s - 1, 0)))), !0;
142
- }, Oe = () => ({ tr: e, dispatch: t }) => {
142
+ }, De = () => ({ tr: e, dispatch: t }) => {
143
143
  let { selection: n } = e, r = n.$anchor.node();
144
144
  if (r.content.size > 0) return !1;
145
145
  let i = e.selection.$anchor;
@@ -152,15 +152,15 @@ var D = class e {
152
152
  }
153
153
  return !1;
154
154
  };
155
- function O(e, t) {
155
+ function k(e, t) {
156
156
  if (typeof e == "string") {
157
157
  if (!t.nodes[e]) throw Error(`There is no node type named '${e}'. Maybe you forgot to add the extension?`);
158
158
  return t.nodes[e];
159
159
  }
160
160
  return e;
161
161
  }
162
- var ke = (e) => ({ tr: t, state: n, dispatch: r }) => {
163
- let i = O(e, n.schema), a = t.selection.$anchor;
162
+ var Oe = (e) => ({ tr: t, state: n, dispatch: r }) => {
163
+ let i = k(e, n.schema), a = t.selection.$anchor;
164
164
  for (let e = a.depth; e > 0; --e) if (a.node(e).type === i) {
165
165
  if (r) {
166
166
  let n = a.before(e), r = a.after(e);
@@ -169,41 +169,41 @@ var ke = (e) => ({ tr: t, state: n, dispatch: r }) => {
169
169
  return !0;
170
170
  }
171
171
  return !1;
172
- }, Ae = (e) => ({ tr: t, dispatch: n }) => {
172
+ }, ke = (e) => ({ tr: t, dispatch: n }) => {
173
173
  let { from: r, to: i } = e;
174
174
  return n && t.delete(r, i), !0;
175
- }, je = (e) => e.content ? /^text(\*|\+)/.test(e.content) : !1, Me = (e, t, n) => {
175
+ }, Ae = (e) => e.content ? /^text(\*|\+)/.test(e.content) : !1, je = (e, t, n) => {
176
176
  if (!e.parent.isInline || n === "left" && e.pos > e.start() || n === "right" && e.pos < e.end()) return e.pos;
177
177
  let r = t.nodes[e.parent.type.name].spec;
178
- return je(r) ? n === "left" ? e.start() - 1 : e.end() + 1 : e.pos;
179
- }, Ne = (e, t, n) => ({
180
- from: Me(e, n, "left"),
181
- to: Me(t, n, "right")
182
- }), Pe = () => ({ state: e, dispatch: t }) => {
178
+ return Ae(r) ? n === "left" ? e.start() - 1 : e.end() + 1 : e.pos;
179
+ }, Me = (e, t, n) => ({
180
+ from: je(e, n, "left"),
181
+ to: je(t, n, "right")
182
+ }), Ne = () => ({ state: e, dispatch: t }) => {
183
183
  if (e.selection.empty) return !1;
184
184
  if (t) {
185
185
  let n = e.tr, { ranges: r } = e.selection, i = n.steps.length;
186
186
  r.forEach((t) => {
187
- let r = n.mapping.slice(i), { from: a, to: o } = Ne(n.doc.resolve(r.map(t.$from.pos)), n.doc.resolve(r.map(t.$to.pos)), e.schema);
187
+ let r = n.mapping.slice(i), { from: a, to: o } = Me(n.doc.resolve(r.map(t.$from.pos)), n.doc.resolve(r.map(t.$to.pos)), e.schema);
188
188
  n.deleteRange(a, o);
189
189
  }), n.selection.empty || n.setSelection(o.near(n.doc.resolve(n.selection.from))), n.scrollIntoView(), t(n);
190
190
  }
191
191
  return !0;
192
- }, Fe = () => ({ commands: e }) => e.keyboardShortcut("Enter"), Ie = () => ({ state: e, dispatch: t }) => _(e, t);
193
- function Le(e) {
192
+ }, Pe = () => ({ commands: e }) => e.keyboardShortcut("Enter"), Fe = () => ({ state: e, dispatch: t }) => _(e, t);
193
+ function Ie(e) {
194
194
  return Object.prototype.toString.call(e) === "[object RegExp]";
195
195
  }
196
- function Re(e, t, n = { strict: !0 }) {
196
+ function A(e, t, n = { strict: !0 }) {
197
197
  let r = Object.keys(t);
198
- return !r.length || r.every((r) => n.strict ? t[r] === e[r] : Le(t[r]) ? t[r].test(e[r]) : t[r] === e[r]);
198
+ return !r.length || r.every((r) => n.strict ? t[r] === e[r] : Ie(t[r]) ? t[r].test(e[r]) : t[r] === e[r]);
199
199
  }
200
- function ze(e, t, n = {}) {
201
- return e.find((e) => e.type === t && Re(Object.fromEntries(Object.keys(n).map((t) => [t, e.attrs[t]])), n));
200
+ function Le(e, t, n = {}) {
201
+ return e.find((e) => e.type === t && A(Object.fromEntries(Object.keys(n).map((t) => [t, e.attrs[t]])), n));
202
202
  }
203
- function Be(e, t, n = {}) {
204
- return !!ze(e, t, n);
203
+ function Re(e, t, n = {}) {
204
+ return !!Le(e, t, n);
205
205
  }
206
- function k(e, t, n) {
206
+ function ze(e, t, n) {
207
207
  if (!e || !t) return;
208
208
  let r = e.parent.childAfter(e.parentOffset);
209
209
  if ((!r.node || !r.node.marks.some((e) => e.type === t)) && (r = e.parent.childBefore(e.parentOffset)), !r.node || !r.node.marks.some((e) => e.type === t)) return;
@@ -211,55 +211,55 @@ function k(e, t, n) {
211
211
  let e = r.node.marks.find((e) => e.type === t);
212
212
  e && (n = e.attrs);
213
213
  }
214
- if (!ze([...r.node.marks], t, n)) return;
214
+ if (!Le([...r.node.marks], t, n)) return;
215
215
  let i = r.index, a = e.start() + r.offset, o = i + 1, s = a + r.node.nodeSize;
216
- for (; i > 0 && Be([...e.parent.child(i - 1).marks], t, n);) --i, a -= e.parent.child(i).nodeSize;
217
- for (; o < e.parent.childCount && Be([...e.parent.child(o).marks], t, n);) s += e.parent.child(o).nodeSize, o += 1;
216
+ for (; i > 0 && Re([...e.parent.child(i - 1).marks], t, n);) --i, a -= e.parent.child(i).nodeSize;
217
+ for (; o < e.parent.childCount && Re([...e.parent.child(o).marks], t, n);) s += e.parent.child(o).nodeSize, o += 1;
218
218
  return {
219
219
  from: a,
220
220
  to: s
221
221
  };
222
222
  }
223
- function A(e, t) {
223
+ function j(e, t) {
224
224
  if (typeof e == "string") {
225
225
  if (!t.marks[e]) throw Error(`There is no mark type named '${e}'. Maybe you forgot to add the extension?`);
226
226
  return t.marks[e];
227
227
  }
228
228
  return e;
229
229
  }
230
- var Ve = (e, t) => ({ tr: n, state: r, dispatch: i }) => {
231
- let a = A(e, r.schema), { doc: s, selection: c } = n, { $from: l, from: u, to: d } = c;
230
+ var Be = (e, t) => ({ tr: n, state: r, dispatch: i }) => {
231
+ let a = j(e, r.schema), { doc: s, selection: c } = n, { $from: l, from: u, to: d } = c;
232
232
  if (i) {
233
- let e = k(l, a, t);
233
+ let e = ze(l, a, t);
234
234
  if (e && e.from <= u && e.to >= d) {
235
235
  let t = o.create(s, e.from, e.to);
236
236
  n.setSelection(t);
237
237
  }
238
238
  }
239
239
  return !0;
240
- }, He = (e) => (t) => {
240
+ }, Ve = (e) => (t) => {
241
241
  let n = typeof e == "function" ? e(t) : e;
242
242
  for (let e = 0; e < n.length; e += 1) if (n[e](t)) return !0;
243
243
  return !1;
244
244
  };
245
- function Ue(e) {
245
+ function He(e) {
246
246
  return e instanceof o;
247
247
  }
248
- function j(e = 0, t = 0, n = 0) {
248
+ function M(e = 0, t = 0, n = 0) {
249
249
  return Math.min(Math.max(e, t), n);
250
250
  }
251
- function We(e, t = null) {
251
+ function Ue(e, t = null) {
252
252
  if (!t) return null;
253
253
  let n = a.atStart(e), r = a.atEnd(e);
254
254
  if (t === "start" || t === !0) return n;
255
255
  if (t === "end") return r;
256
256
  let i = n.from, s = r.to;
257
- return t === "all" ? o.create(e, j(0, i, s), j(e.content.size, i, s)) : o.create(e, j(t, i, s), j(t, i, s));
257
+ return t === "all" ? o.create(e, M(0, i, s), M(e.content.size, i, s)) : o.create(e, M(t, i, s), M(t, i, s));
258
258
  }
259
- function Ge() {
259
+ function We() {
260
260
  return ["Android"].includes(navigator.platform) || /android/i.test(navigator.userAgent);
261
261
  }
262
- function M() {
262
+ function N() {
263
263
  return [
264
264
  "iPad Simulator",
265
265
  "iPhone Simulator",
@@ -269,16 +269,16 @@ function M() {
269
269
  "iPod"
270
270
  ].includes(navigator.platform) || navigator.userAgent.includes("Mac") && "ontouchend" in document;
271
271
  }
272
- function Ke() {
272
+ function Ge() {
273
273
  return typeof navigator < "u" && /^((?!chrome|android).)*safari/i.test(navigator.userAgent);
274
274
  }
275
- var qe = (e = null, t = {}) => ({ editor: n, view: r, tr: i, dispatch: a }) => {
275
+ var Ke = (e = null, t = {}) => ({ editor: n, view: r, tr: i, dispatch: a }) => {
276
276
  t = {
277
277
  scrollIntoView: !0,
278
278
  ...t
279
279
  };
280
280
  let o = () => {
281
- (M() || Ge()) && r.dom.focus(), Ke() && !M() && !Ge() && r.dom.focus({ preventScroll: !0 }), requestAnimationFrame(() => {
281
+ (N() || We()) && r.dom.focus(), Ge() && !N() && !We() && r.dom.focus({ preventScroll: !0 }), requestAnimationFrame(() => {
282
282
  n.isDestroyed || (r.focus(), t?.scrollIntoView && n.commands.scrollIntoView());
283
283
  });
284
284
  };
@@ -287,33 +287,33 @@ var qe = (e = null, t = {}) => ({ editor: n, view: r, tr: i, dispatch: a }) => {
287
287
  } catch {
288
288
  return !1;
289
289
  }
290
- if (a && e === null && !Ue(n.state.selection)) return o(), !0;
291
- let s = We(i.doc, e) || n.state.selection, c = n.state.selection.eq(s);
290
+ if (a && e === null && !He(n.state.selection)) return o(), !0;
291
+ let s = Ue(i.doc, e) || n.state.selection, c = n.state.selection.eq(s);
292
292
  return a && (c || i.setSelection(s), c && i.storedMarks && i.setStoredMarks(i.storedMarks), o()), !0;
293
- }, Je = (e, t) => (n) => e.every((e, r) => t(e, {
293
+ }, qe = (e, t) => (n) => e.every((e, r) => t(e, {
294
294
  ...n,
295
295
  index: r
296
- })), Ye = (e, t) => ({ tr: n, commands: r }) => r.insertContentAt({
296
+ })), Je = (e, t) => ({ tr: n, commands: r }) => r.insertContentAt({
297
297
  from: n.selection.from,
298
298
  to: n.selection.to
299
- }, e, t), Xe = (e) => {
299
+ }, e, t), Ye = (e) => {
300
300
  let t = e.childNodes;
301
301
  for (let n = t.length - 1; n >= 0; --n) {
302
302
  let r = t[n];
303
- r.nodeType === 3 && r.nodeValue && /^(\n\s\s|\n)$/.test(r.nodeValue) ? e.removeChild(r) : r.nodeType === 1 && Xe(r);
303
+ r.nodeType === 3 && r.nodeValue && /^(\n\s\s|\n)$/.test(r.nodeValue) ? e.removeChild(r) : r.nodeType === 1 && Ye(r);
304
304
  }
305
305
  return e;
306
306
  };
307
- function N(e) {
307
+ function P(e) {
308
308
  if (typeof window > "u") throw Error("[tiptap error]: there is no window object available, so this function cannot be used");
309
309
  let t = `<body>${e}</body>`, n = new window.DOMParser().parseFromString(t, "text/html").body;
310
- return Xe(n);
310
+ return Ye(n);
311
311
  }
312
- function Ze(e) {
312
+ function Xe(e) {
313
313
  return typeof e?.nodesBetween == "function";
314
314
  }
315
- function P(e, t, n) {
316
- if (Ze(e)) return e;
315
+ function F(e, t, n) {
316
+ if (Xe(e)) return e;
317
317
  let r = typeof e == "object" && !!e;
318
318
  n = {
319
319
  slice: !0,
@@ -322,16 +322,16 @@ function P(e, t, n) {
322
322
  };
323
323
  let i = typeof e == "string";
324
324
  if (r) try {
325
- if (Array.isArray(e) && e.length > 0) return w.fromArray(e.map((e) => t.nodeFromJSON(e)));
325
+ if (Array.isArray(e) && e.length > 0) return T.fromArray(e.map((e) => t.nodeFromJSON(e)));
326
326
  let r = t.nodeFromJSON(e);
327
327
  return n.errorOnInvalidContent && r.check(), r;
328
328
  } catch (r) {
329
329
  if (n.errorOnInvalidContent) throw Error("[tiptap error]: Invalid JSON content", { cause: r });
330
- return console.warn("[tiptap warn]: Invalid content.", "Passed value:", e, "Error:", r), P("", t, n);
330
+ return console.warn("[tiptap warn]: Invalid content.", "Passed value:", e, "Error:", r), F("", t, n);
331
331
  }
332
332
  if (i) {
333
333
  if (n.errorOnInvalidContent) {
334
- let r = !1, i = "", a = new fe({
334
+ let r = !1, i = "", a = new E({
335
335
  topNode: t.spec.topNode,
336
336
  marks: t.spec.marks,
337
337
  nodes: t.spec.nodes.append({ __tiptap__private__unknown__catch__all__node: {
@@ -343,17 +343,17 @@ function P(e, t, n) {
343
343
  }]
344
344
  } })
345
345
  });
346
- if (n.slice ? ue.fromSchema(a).parseSlice(N(e), n.parseOptions) : ue.fromSchema(a).parse(N(e), n.parseOptions), n.errorOnInvalidContent && r) throw Error("[tiptap error]: Invalid HTML content", { cause: /* @__PURE__ */ Error(`Invalid element found: ${i}`) });
346
+ if (n.slice ? le.fromSchema(a).parseSlice(P(e), n.parseOptions) : le.fromSchema(a).parse(P(e), n.parseOptions), n.errorOnInvalidContent && r) throw Error("[tiptap error]: Invalid HTML content", { cause: /* @__PURE__ */ Error(`Invalid element found: ${i}`) });
347
347
  }
348
- let r = ue.fromSchema(t);
349
- return n.slice ? r.parseSlice(N(e), n.parseOptions).content : r.parse(N(e), n.parseOptions);
348
+ let r = le.fromSchema(t);
349
+ return n.slice ? r.parseSlice(P(e), n.parseOptions).content : r.parse(P(e), n.parseOptions);
350
350
  }
351
- return P("", t, n);
351
+ return F("", t, n);
352
352
  }
353
- function Qe(e) {
353
+ function Ze(e) {
354
354
  return !("type" in e);
355
355
  }
356
- function $e(e, t, n) {
356
+ function Qe(e, t, n) {
357
357
  let r = e.steps.length - 1;
358
358
  if (r < t) return;
359
359
  let i = e.steps[r];
@@ -363,7 +363,7 @@ function $e(e, t, n) {
363
363
  s === 0 && (s = r);
364
364
  }), e.setSelection(a.near(e.doc.resolve(s), n));
365
365
  }
366
- var et = (e, t, n) => ({ tr: r, dispatch: i, editor: a }) => {
366
+ var $e = (e, t, n) => ({ tr: r, dispatch: i, editor: a }) => {
367
367
  if (i) {
368
368
  n = {
369
369
  parseOptions: a.options.parseOptions,
@@ -385,7 +385,7 @@ var et = (e, t, n) => ({ tr: r, dispatch: i, editor: a }) => {
385
385
  ...n.parseOptions
386
386
  };
387
387
  if (!n.errorOnInvalidContent && !a.options.enableContentCheck && a.options.emitContentError) try {
388
- P(t, a.schema, {
388
+ F(t, a.schema, {
389
389
  parseOptions: s,
390
390
  errorOnInvalidContent: !0
391
391
  });
@@ -393,7 +393,7 @@ var et = (e, t, n) => ({ tr: r, dispatch: i, editor: a }) => {
393
393
  o(e);
394
394
  }
395
395
  try {
396
- i = P(t, a.schema, {
396
+ i = F(t, a.schema, {
397
397
  parseOptions: s,
398
398
  errorOnInvalidContent: n.errorOnInvalidContent ?? a.options.enableContentCheck
399
399
  });
@@ -406,7 +406,7 @@ var et = (e, t, n) => ({ tr: r, dispatch: i, editor: a }) => {
406
406
  } : {
407
407
  from: e.from,
408
408
  to: e.to
409
- }, u = !0, d = !0, f = Qe(i) ? i.content : [i];
409
+ }, u = !0, d = !0, f = Ze(i) ? i.content : [i];
410
410
  if (f.forEach((e) => {
411
411
  e.check(), u = u ? e.isText && e.marks.length === 0 : !1, d = d ? e.isBlock : !1;
412
412
  }), c === l && d) {
@@ -414,13 +414,13 @@ var et = (e, t, n) => ({ tr: r, dispatch: i, editor: a }) => {
414
414
  e.isTextblock && !e.type.spec.code && !e.childCount && (--c, l += 1);
415
415
  }
416
416
  let p;
417
- if (u) p = Array.isArray(t) ? t.map((e) => e.text || "").join("") : Ze(t) ? f.map((e) => e.text ?? "").join("") : typeof t == "object" && t && t.text ? t.text : t, r.insertText(p, c, l);
417
+ if (u) p = Array.isArray(t) ? t.map((e) => e.text || "").join("") : Xe(t) ? f.map((e) => e.text ?? "").join("") : typeof t == "object" && t && t.text ? t.text : t, r.insertText(p, c, l);
418
418
  else {
419
- p = w.from(f);
419
+ p = T.from(f);
420
420
  let e = r.doc.resolve(c), t = e.node(), n = e.parentOffset === 0, i = t.isText || t.isTextblock, a = t.content.size > 0;
421
421
  n && i && a && d && (c = Math.max(0, c - 1)), r.replaceWith(c, l, f);
422
422
  }
423
- n.updateSelection && $e(r, r.steps.length - 1, -1), n.applyInputRules && r.setMeta("applyInputRules", {
423
+ n.updateSelection && Qe(r, r.steps.length - 1, -1), n.applyInputRules && r.setMeta("applyInputRules", {
424
424
  from: c,
425
425
  text: p
426
426
  }), n.applyPasteRules && r.setMeta("applyPasteRules", {
@@ -430,46 +430,46 @@ var et = (e, t, n) => ({ tr: r, dispatch: i, editor: a }) => {
430
430
  }
431
431
  return !0;
432
432
  };
433
- function tt(e) {
433
+ function et(e) {
434
434
  for (let t = 0; t < e.edgeCount; t += 1) {
435
435
  let { type: n } = e.edge(t);
436
436
  if (n.isTextblock && !n.hasRequiredAttrs()) return n;
437
437
  }
438
438
  return null;
439
439
  }
440
- var nt = (e = {}) => ({ tr: t, dispatch: n, editor: r }) => {
440
+ var tt = (e = {}) => ({ tr: t, dispatch: n, editor: r }) => {
441
441
  let { pos: i, attrs: a, content: o, updateSelection: s = !0 } = e, c;
442
442
  c = typeof i == "number" ? t.doc.resolve(i) : i || t.selection.$from;
443
- let l = tt(c.parent.contentMatchAt(c.index()));
443
+ let l = et(c.parent.contentMatchAt(c.index()));
444
444
  if (!l) return !1;
445
445
  let u = Object.keys(l.spec.attrs || {}), d = a ? Object.fromEntries(Object.entries(a).filter(([e]) => u.includes(e))) : {}, f;
446
446
  if (o) {
447
- let e = P(o, r.schema);
447
+ let e = F(o, r.schema);
448
448
  f = l.createAndFill(d, e);
449
449
  } else f = l.createAndFill(d);
450
- return f ? (n && (t.insert(c.pos, f), s && $e(t, t.steps.length - 1, -1)), !0) : !1;
451
- }, rt = () => ({ state: e, dispatch: t }) => te(e, t), it = () => ({ state: e, dispatch: t }) => y(e, t), at = () => ({ state: e, dispatch: t }) => v(e, t), ot = () => ({ state: e, dispatch: t }) => b(e, t), st = (e, t) => {
450
+ return f ? (n && (t.insert(c.pos, f), s && Qe(t, t.steps.length - 1, -1)), !0) : !1;
451
+ }, nt = () => ({ state: e, dispatch: t }) => ee(e, t), rt = () => ({ state: e, dispatch: t }) => y(e, t), it = () => ({ state: e, dispatch: t }) => v(e, t), at = () => ({ state: e, dispatch: t }) => b(e, t), ot = (e, t) => {
452
452
  let n = e.resolve(t), r = n.nodeBefore, i = n.nodeAfter;
453
453
  return !r || !i ? !1 : !r.type.spec.isolating && !i.type.spec.isolating;
454
- }, ct = () => ({ state: e, dispatch: t, tr: n }) => {
454
+ }, st = () => ({ state: e, dispatch: t, tr: n }) => {
455
455
  try {
456
456
  let r = m(e.doc, e.selection.$from.pos, -1);
457
- return r == null || !st(e.doc, r) ? !1 : (n.join(r, 2), t && t(n), !0);
457
+ return r == null || !ot(e.doc, r) ? !1 : (n.join(r, 2), t && t(n), !0);
458
458
  } catch {
459
459
  return !1;
460
460
  }
461
- }, lt = () => ({ state: e, dispatch: t, tr: n }) => {
461
+ }, ct = () => ({ state: e, dispatch: t, tr: n }) => {
462
462
  try {
463
463
  let r = m(e.doc, e.selection.$from.pos, 1);
464
- return r == null || !st(e.doc, r) ? !1 : (n.join(r, 2), t && t(n), !0);
464
+ return r == null || !ot(e.doc, r) ? !1 : (n.join(r, 2), t && t(n), !0);
465
465
  } catch {
466
466
  return !1;
467
467
  }
468
- }, ut = () => ({ state: e, dispatch: t }) => x(e, t), dt = () => ({ state: e, dispatch: t }) => ee(e, t);
469
- function ft() {
468
+ }, lt = () => ({ state: e, dispatch: t }) => x(e, t), ut = () => ({ state: e, dispatch: t }) => S(e, t);
469
+ function dt() {
470
470
  return typeof navigator < "u" && /Mac/.test(navigator.platform);
471
471
  }
472
- function pt(e) {
472
+ function ft(e) {
473
473
  let t = e.split(/-(?!$)/), n = t[t.length - 1];
474
474
  n === "Space" && (n = " ");
475
475
  let r, i, a, o;
@@ -479,13 +479,13 @@ function pt(e) {
479
479
  else if (/^a(lt)?$/i.test(n)) r = !0;
480
480
  else if (/^(c|ctrl|control)$/i.test(n)) i = !0;
481
481
  else if (/^s(hift)?$/i.test(n)) a = !0;
482
- else if (/^mod$/i.test(n)) M() || ft() ? o = !0 : i = !0;
482
+ else if (/^mod$/i.test(n)) N() || dt() ? o = !0 : i = !0;
483
483
  else throw Error(`Unrecognized modifier name: ${n}`);
484
484
  }
485
485
  return r && (n = `Alt-${n}`), i && (n = `Ctrl-${n}`), o && (n = `Meta-${n}`), a && (n = `Shift-${n}`), n;
486
486
  }
487
- var mt = (e) => ({ editor: t, view: n, tr: r, dispatch: i }) => {
488
- let a = pt(e).split(/-(?!$)/), o = a.find((e) => ![
487
+ var pt = (e) => ({ editor: t, view: n, tr: r, dispatch: i }) => {
488
+ let a = ft(e).split(/-(?!$)/), o = a.find((e) => ![
489
489
  "Alt",
490
490
  "Ctrl",
491
491
  "Meta",
@@ -506,8 +506,8 @@ var mt = (e) => ({ editor: t, view: n, tr: r, dispatch: i }) => {
506
506
  t && i && r.maybeStep(t);
507
507
  }), !0;
508
508
  };
509
- function F(e, t, n = {}) {
510
- let { from: r, to: i, empty: a } = e.selection, o = t ? O(t, e.schema) : null, s = [];
509
+ function I(e, t, n = {}) {
510
+ let { from: r, to: i, empty: a } = e.selection, o = t ? k(t, e.schema) : null, s = [];
511
511
  e.doc.nodesBetween(r, i, (e, t) => {
512
512
  if (e.isText) return;
513
513
  let n = Math.max(r, t), a = Math.min(i, t + e.nodeSize);
@@ -517,14 +517,14 @@ function F(e, t, n = {}) {
517
517
  to: a
518
518
  });
519
519
  });
520
- let c = i - r, l = s.filter((e) => !o || o.name === e.node.type.name).filter((e) => Re(e.node.attrs, n, { strict: !1 }));
520
+ let c = i - r, l = s.filter((e) => !o || o.name === e.node.type.name).filter((e) => A(e.node.attrs, n, { strict: !1 }));
521
521
  return a ? !!l.length : l.reduce((e, t) => e + t.to - t.from, 0) >= c;
522
522
  }
523
- var ht = (e, t = {}) => ({ state: n, dispatch: r }) => F(n, O(e, n.schema), t) ? S(n, r) : !1, gt = () => ({ state: e, dispatch: t }) => ne(e, t), _t = (e) => ({ state: t, dispatch: n }) => {
524
- let r = O(e, t.schema);
525
- return me(r)(t, n);
526
- }, vt = () => ({ state: e, dispatch: t }) => C(e, t);
527
- function I(e, t) {
523
+ var mt = (e, t = {}) => ({ state: n, dispatch: r }) => I(n, k(e, n.schema), t) ? te(n, r) : !1, ht = () => ({ state: e, dispatch: t }) => C(e, t), gt = (e) => ({ state: t, dispatch: n }) => {
524
+ let r = k(e, t.schema);
525
+ return fe(r)(t, n);
526
+ }, _t = () => ({ state: e, dispatch: t }) => ne(e, t);
527
+ function vt(e, t) {
528
528
  return t.nodes[e] ? "node" : t.marks[e] ? "mark" : null;
529
529
  }
530
530
  function yt(e, t) {
@@ -532,9 +532,9 @@ function yt(e, t) {
532
532
  return Object.keys(e).reduce((t, r) => (n.includes(r) || (t[r] = e[r]), t), {});
533
533
  }
534
534
  var bt = (e, t) => ({ tr: n, state: r, dispatch: i }) => {
535
- let a = null, o = null, s = I(typeof e == "string" ? e : e.name, r.schema);
535
+ let a = null, o = null, s = vt(typeof e == "string" ? e : e.name, r.schema);
536
536
  if (!s) return !1;
537
- s === "node" && (a = O(e, r.schema)), s === "mark" && (o = A(e, r.schema));
537
+ s === "node" && (a = k(e, r.schema)), s === "mark" && (o = j(e, r.schema));
538
538
  let c = !1;
539
539
  return n.selection.ranges.forEach((e) => {
540
540
  r.doc.nodesBetween(e.$from.pos, e.$to.pos, (e, r) => {
@@ -549,9 +549,9 @@ var bt = (e, t) => ({ tr: n, state: r, dispatch: i }) => {
549
549
  t.setSelection(n);
550
550
  }
551
551
  return !0;
552
- }, Ct = () => ({ state: e, dispatch: t }) => re(e, t), wt = () => ({ state: e, dispatch: t }) => ie(e, t), Tt = () => ({ state: e, dispatch: t }) => ae(e, t), Et = () => ({ state: e, dispatch: t }) => oe(e, t), Dt = () => ({ state: e, dispatch: t }) => se(e, t);
552
+ }, Ct = () => ({ state: e, dispatch: t }) => w(e, t), wt = () => ({ state: e, dispatch: t }) => re(e, t), Tt = () => ({ state: e, dispatch: t }) => ie(e, t), Et = () => ({ state: e, dispatch: t }) => ae(e, t), Dt = () => ({ state: e, dispatch: t }) => oe(e, t);
553
553
  function Ot(e, t, n = {}, r = {}) {
554
- return P(e, t, {
554
+ return F(e, t, {
555
555
  slice: !1,
556
556
  parseOptions: n,
557
557
  errorOnInvalidContent: r.errorOnInvalidContent
@@ -562,7 +562,7 @@ var kt = (e, { errorOnInvalidContent: t, emitUpdate: n = !0, parseOptions: r = {
562
562
  if (r.preserveWhitespace !== "full") {
563
563
  let s = Ot(e, i.schema, r, { errorOnInvalidContent: t ?? i.options.enableContentCheck });
564
564
  if (o) {
565
- let e = Qe(s) ? s.content : [s];
565
+ let e = Ze(s) ? s.content : [s];
566
566
  a.replaceWith(0, c.content.size, e).setMeta("preventUpdate", !n);
567
567
  }
568
568
  return !0;
@@ -576,7 +576,7 @@ var kt = (e, { errorOnInvalidContent: t, emitUpdate: n = !0, parseOptions: r = {
576
576
  });
577
577
  };
578
578
  function At(e, t) {
579
- let n = A(t, e.schema), { from: r, to: i, empty: a } = e.selection, o = [];
579
+ let n = j(t, e.schema), { from: r, to: i, empty: a } = e.selection, o = [];
580
580
  a ? (e.storedMarks && o.push(...e.storedMarks), o.push(...e.selection.$head.marks())) : e.doc.nodesBetween(r, i, (e) => {
581
581
  o.push(...e.marks);
582
582
  });
@@ -611,47 +611,120 @@ function Nt(e, t) {
611
611
  };
612
612
  }
613
613
  }
614
- function L(e) {
614
+ function Pt(e) {
615
615
  return (t) => Nt(t.$from, e);
616
616
  }
617
- function R(e, t, n) {
618
- return e.config[t] === void 0 && e.parent ? R(e.parent, t, n) : typeof e.config[t] == "function" ? e.config[t].bind({
617
+ function L(e, t, n) {
618
+ return e.config[t] === void 0 && e.parent ? L(e.parent, t, n) : typeof e.config[t] == "function" ? e.config[t].bind({
619
619
  ...n,
620
- parent: e.parent ? R(e.parent, t, n) : null
620
+ parent: e.parent ? L(e.parent, t, n) : null
621
621
  }) : e.config[t];
622
622
  }
623
- function Pt(e) {
623
+ function Ft(e) {
624
624
  return e.map((e) => {
625
- let t = R(e, "addExtensions", {
625
+ let t = L(e, "addExtensions", {
626
626
  name: e.name,
627
627
  options: e.options,
628
628
  storage: e.storage
629
629
  });
630
- return t ? [e, ...Pt(t())] : e;
630
+ return t ? [e, ...Ft(t())] : e;
631
631
  }).flat(10);
632
632
  }
633
- function Ft(e, t) {
634
- let n = de.fromSchema(t).serializeFragment(e), r = document.implementation.createHTMLDocument().createElement("div");
633
+ function It(e, t) {
634
+ let n = ue.fromSchema(t).serializeFragment(e), r = document.implementation.createHTMLDocument().createElement("div");
635
635
  return r.appendChild(n), r.innerHTML;
636
636
  }
637
- function It(e) {
638
- return typeof e == "function";
637
+ function Lt(e, t) {
638
+ let n = /* @__PURE__ */ new Map();
639
+ for (let t of e) {
640
+ let e = n.get(t.type) ?? /* @__PURE__ */ new Map();
641
+ e.set(t.name, t), n.set(t.type, e);
642
+ }
643
+ return [...Object.values(t.nodes), ...Object.values(t.marks)].flatMap((e) => Object.entries(e.spec.attrs ?? {}).map(([t, r]) => {
644
+ let i = n.get(e.name)?.get(t), a = Object.hasOwn(r, "default");
645
+ return {
646
+ type: e.name,
647
+ name: t,
648
+ attribute: {
649
+ rendered: !0,
650
+ renderHTML: null,
651
+ parseHTML: null,
652
+ keepOnSplit: !0,
653
+ ...i?.attribute,
654
+ default: r.default,
655
+ isRequired: !a,
656
+ validate: r.validate
657
+ }
658
+ };
659
+ }));
639
660
  }
640
- function z(e, t = void 0, ...n) {
641
- return It(e) ? t ? e.bind(t)(...n) : e(...n) : e;
661
+ var Rt = {
662
+ content: "string",
663
+ marks: "string",
664
+ group: "string",
665
+ inline: "boolean",
666
+ atom: "boolean",
667
+ selectable: "boolean",
668
+ draggable: "boolean",
669
+ code: "boolean",
670
+ whitespace: ["pre", "normal"],
671
+ definingAsContext: "boolean",
672
+ definingForContent: "boolean",
673
+ defining: "boolean",
674
+ isolating: "boolean",
675
+ linebreakReplacement: "boolean"
676
+ }, zt = {
677
+ inclusive: "boolean",
678
+ excludes: "string",
679
+ group: "string",
680
+ spanning: "boolean",
681
+ code: "boolean"
682
+ };
683
+ function Bt(e, t, n) {
684
+ return Object.fromEntries(Object.entries(t).flatMap(([t, r]) => {
685
+ let i = e[t];
686
+ if (i === void 0) return [];
687
+ if (!(typeof r == "string" ? typeof i === r : typeof i == "string" && r.includes(i))) throw RangeError(`Invalid schemaSpec field '${n}.${t}'`);
688
+ return [[t, i]];
689
+ }));
642
690
  }
643
- function Lt(e = {}) {
644
- return Object.keys(e).length === 0 && e.constructor === Object;
691
+ function Vt(e, t, n, r) {
692
+ return {
693
+ ...Object.fromEntries(Object.entries(t).filter(([e]) => e !== "attrs" && !Object.hasOwn(r, e))),
694
+ ...Bt(n, r, e),
695
+ attrs: n.attrs
696
+ };
697
+ }
698
+ function Ht(e, t, n) {
699
+ for (let r of Object.keys(t)) if (!Object.hasOwn(e, r)) throw RangeError(`schemaSpec requires a local ${n} extension named '${r}'`);
700
+ for (let r of Object.keys(e)) if (!Object.hasOwn(t, r)) throw RangeError(`Local ${n} extension '${r}' is not in schemaSpec`);
701
+ }
702
+ function Ut(e, t) {
703
+ Ht(e.nodes, t.nodes, "node"), Ht(e.marks, t.marks, "mark");
704
+ let n = t.spec.nodes, r = t.spec.marks;
705
+ return t.spec.nodes.forEach((t, r) => {
706
+ n = n.update(t, Vt(t, e.nodes[t], r, Rt));
707
+ }), t.spec.marks.forEach((t, n) => {
708
+ r = r.update(t, Vt(t, e.marks[t], n, zt));
709
+ }), {
710
+ topNode: t.topNodeType.name,
711
+ nodes: n,
712
+ marks: r
713
+ };
645
714
  }
646
- function B(e) {
715
+ function Wt(e) {
716
+ let t = e.filter((t, n) => e.indexOf(t) !== n);
717
+ return Array.from(new Set(t));
718
+ }
719
+ function R(e) {
647
720
  return {
648
721
  baseExtensions: e.filter((e) => e.type === "extension"),
649
722
  nodeExtensions: e.filter((e) => e.type === "node"),
650
723
  markExtensions: e.filter((e) => e.type === "mark")
651
724
  };
652
725
  }
653
- function Rt(e) {
654
- let t = [], { nodeExtensions: n, markExtensions: r } = B(e), i = [...n, ...r], a = {
726
+ function Gt(e) {
727
+ let t = [], { nodeExtensions: n, markExtensions: r } = R(e), i = [...n, ...r], a = {
655
728
  default: null,
656
729
  validate: void 0,
657
730
  rendered: !0,
@@ -661,7 +734,7 @@ function Rt(e) {
661
734
  isRequired: !1
662
735
  }, o = n.filter((e) => e.name !== "text").map((e) => e.name), s = r.map((e) => e.name), c = [...o, ...s];
663
736
  return e.forEach((e) => {
664
- let n = R(e, "addGlobalAttributes", {
737
+ let n = L(e, "addGlobalAttributes", {
665
738
  name: e.name,
666
739
  options: e.options,
667
740
  storage: e.storage,
@@ -683,7 +756,7 @@ function Rt(e) {
683
756
  });
684
757
  });
685
758
  }), i.forEach((e) => {
686
- let n = R(e, "addAttributes", {
759
+ let n = L(e, "addAttributes", {
687
760
  name: e.name,
688
761
  options: e.options,
689
762
  storage: e.storage
@@ -703,7 +776,16 @@ function Rt(e) {
703
776
  });
704
777
  }), t;
705
778
  }
706
- function zt(e) {
779
+ function Kt(e) {
780
+ return typeof e == "function";
781
+ }
782
+ function z(e, t = void 0, ...n) {
783
+ return Kt(e) ? t ? e.bind(t)(...n) : e(...n) : e;
784
+ }
785
+ function qt(e = {}) {
786
+ return Object.keys(e).length === 0 && e.constructor === Object;
787
+ }
788
+ function Jt(e) {
707
789
  let t = [], n = "", r = !1, i = !1, a = 0, o = e.length;
708
790
  for (let s = 0; s < o; s += 1) {
709
791
  let o = e[s];
@@ -729,8 +811,8 @@ function zt(e) {
729
811
  }
730
812
  return n && t.push(n), t;
731
813
  }
732
- function Bt(e) {
733
- let t = [], n = zt(e || ""), r = n.length;
814
+ function Yt(e) {
815
+ let t = [], n = Jt(e || ""), r = n.length;
734
816
  for (let e = 0; e < r; e += 1) {
735
817
  let r = n[e], i = r.indexOf(":");
736
818
  if (i === -1) continue;
@@ -739,7 +821,7 @@ function Bt(e) {
739
821
  }
740
822
  return t;
741
823
  }
742
- function Vt(...e) {
824
+ function Xt(...e) {
743
825
  return e.filter((e) => !!e).reduce((e, t) => {
744
826
  let n = { ...e };
745
827
  return Object.entries(t).forEach(([e, t]) => {
@@ -754,26 +836,26 @@ function Vt(...e) {
754
836
  let r = t ? String(t).split(" ") : [], i = n[e] ? n[e].split(" ") : [], a = r.filter((e) => !i.includes(e));
755
837
  n[e] = [...i, ...a].join(" ");
756
838
  } else if (e === "style") {
757
- let r = new Map([...Bt(n[e]), ...Bt(t)]);
839
+ let r = new Map([...Yt(n[e]), ...Yt(t)]);
758
840
  n[e] = Array.from(r.entries()).map(([e, t]) => `${e}: ${t}`).join("; ");
759
841
  } else n[e] = t;
760
842
  }), n;
761
843
  }, {});
762
844
  }
763
- function V(e, t) {
764
- return t.filter((t) => t.type === e.type.name).filter((e) => e.attribute.rendered).map((t) => t.attribute.renderHTML ? t.attribute.renderHTML(e.attrs) || {} : { [t.name]: e.attrs[t.name] }).reduce((e, t) => Vt(e, t), {});
845
+ function B(e, t) {
846
+ return t.filter((t) => t.type === e.type.name).filter((e) => e.attribute.rendered).map((t) => t.attribute.renderHTML ? t.attribute.renderHTML(e.attrs) || {} : { [t.name]: e.attrs[t.name] }).reduce((e, t) => Xt(e, t), {});
765
847
  }
766
- function Ht(e) {
848
+ function Zt(e) {
767
849
  return typeof e == "string" ? e.match(/^[+-]?(?:\d*\.)?\d+$/) ? Number(e) : e === "true" || e !== "false" && e : e;
768
850
  }
769
- function Ut(e, t) {
851
+ function Qt(e, t) {
770
852
  return "style" in e ? e : {
771
853
  ...e,
772
854
  getAttrs: (n) => {
773
855
  let r = e.getAttrs ? e.getAttrs(n) : e.attrs;
774
856
  if (r === !1) return !1;
775
857
  let i = t.reduce((e, t) => {
776
- let r = t.attribute.parseHTML ? t.attribute.parseHTML(n) : Ht(n.getAttribute(t.name));
858
+ let r = t.attribute.parseHTML ? t.attribute.parseHTML(n) : Zt(n.getAttribute(t.name));
777
859
  return r == null ? e : {
778
860
  ...e,
779
861
  [t.name]: r
@@ -786,100 +868,103 @@ function Ut(e, t) {
786
868
  }
787
869
  };
788
870
  }
789
- function Wt(e) {
790
- return Object.fromEntries(Object.entries(e).filter(([e, t]) => e === "attrs" && Lt(t) ? !1 : t != null));
871
+ function $t(e) {
872
+ return Object.fromEntries(Object.entries(e).filter(([e, t]) => e === "attrs" && qt(t) ? !1 : t != null));
791
873
  }
792
- function Gt(e) {
874
+ function en(e) {
793
875
  var t, n;
794
876
  let r = {};
795
877
  return !(e != null && (t = e.attribute) != null && t.isRequired) && "default" in (e?.attribute || {}) && (r.default = e.attribute.default), (e == null || (n = e.attribute) == null ? void 0 : n.validate) !== void 0 && (r.validate = e.attribute.validate), [e.name, r];
796
878
  }
797
- function Kt(e, t) {
798
- let n = Rt(e), { nodeExtensions: r, markExtensions: i } = B(e), a = r.find((e) => R(e, "topNode"))?.name, o = Object.fromEntries(r.map((r) => {
799
- let i = n.filter((e) => e.type === r.name), a = {
800
- name: r.name,
801
- options: r.options,
802
- storage: r.storage,
803
- editor: t
804
- }, o = Wt({
805
- ...e.reduce((e, t) => {
806
- let n = R(t, "extendNodeSchema", a);
807
- return {
808
- ...e,
809
- ...n ? n(r) : {}
810
- };
811
- }, {}),
812
- content: z(R(r, "content", a)),
813
- marks: z(R(r, "marks", a)),
814
- group: z(R(r, "group", a)),
815
- inline: z(R(r, "inline", a)),
816
- atom: z(R(r, "atom", a)),
817
- selectable: z(R(r, "selectable", a)),
818
- draggable: z(R(r, "draggable", a)),
819
- code: z(R(r, "code", a)),
820
- whitespace: z(R(r, "whitespace", a)),
821
- linebreakReplacement: z(R(r, "linebreakReplacement", a)),
822
- defining: z(R(r, "defining", a)),
823
- isolating: z(R(r, "isolating", a)),
824
- attrs: Object.fromEntries(i.map(Gt))
825
- }), s = z(R(r, "parseHTML", a));
826
- s && (o.parseDOM = s.map((e) => Ut(e, i)));
827
- let c = R(r, "renderHTML", a);
828
- c && (o.toDOM = (e) => c({
829
- node: e,
830
- HTMLAttributes: V(e, i)
831
- }));
832
- let l = R(r, "renderText", a);
833
- return l && (o.toText = l), [r.name, o];
834
- })), s = Object.fromEntries(i.map((r) => {
835
- let i = n.filter((e) => e.type === r.name), a = {
836
- name: r.name,
837
- options: r.options,
838
- storage: r.storage,
839
- editor: t
840
- }, o = Wt({
841
- ...e.reduce((e, t) => {
842
- let n = R(t, "extendMarkSchema", a);
843
- return {
844
- ...e,
845
- ...n ? n(r) : {}
846
- };
847
- }, {}),
848
- inclusive: z(R(r, "inclusive", a)),
849
- excludes: z(R(r, "excludes", a)),
850
- group: z(R(r, "group", a)),
851
- spanning: z(R(r, "spanning", a)),
852
- code: z(R(r, "code", a)),
853
- attrs: Object.fromEntries(i.map(Gt))
854
- }), s = z(R(r, "parseHTML", a));
855
- s && (o.parseDOM = s.map((e) => Ut(e, i)));
856
- let c = R(r, "renderHTML", a);
857
- return c && (o.toDOM = (e) => c({
858
- mark: e,
859
- HTMLAttributes: V(e, i)
860
- })), [r.name, o];
861
- }));
862
- return new fe({
863
- topNode: a,
864
- nodes: o,
865
- marks: s
866
- });
879
+ function tn(e, t, n = Gt(e)) {
880
+ let { nodeExtensions: r, markExtensions: i } = R(e);
881
+ return {
882
+ topNode: r.find((e) => L(e, "topNode"))?.name,
883
+ nodes: Object.fromEntries(r.map((r) => {
884
+ let i = n.filter((e) => e.type === r.name), a = {
885
+ name: r.name,
886
+ options: r.options,
887
+ storage: r.storage,
888
+ editor: t
889
+ }, o = $t({
890
+ ...e.reduce((e, t) => {
891
+ let n = L(t, "extendNodeSchema", a);
892
+ return {
893
+ ...e,
894
+ ...n ? n(r) : {}
895
+ };
896
+ }, {}),
897
+ content: z(L(r, "content", a)),
898
+ marks: z(L(r, "marks", a)),
899
+ group: z(L(r, "group", a)),
900
+ inline: z(L(r, "inline", a)),
901
+ atom: z(L(r, "atom", a)),
902
+ selectable: z(L(r, "selectable", a)),
903
+ draggable: z(L(r, "draggable", a)),
904
+ code: z(L(r, "code", a)),
905
+ whitespace: z(L(r, "whitespace", a)),
906
+ linebreakReplacement: z(L(r, "linebreakReplacement", a)),
907
+ defining: z(L(r, "defining", a)),
908
+ isolating: z(L(r, "isolating", a)),
909
+ attrs: Object.fromEntries(i.map(en))
910
+ }), s = z(L(r, "parseHTML", a));
911
+ s && (o.parseDOM = s.map((e) => Qt(e, i)));
912
+ let c = L(r, "renderHTML", a);
913
+ c && (o.toDOM = (e) => c({
914
+ node: e,
915
+ HTMLAttributes: B(e, i)
916
+ }));
917
+ let l = L(r, "renderText", a);
918
+ return l && (o.toText = l), [r.name, o];
919
+ })),
920
+ marks: Object.fromEntries(i.map((r) => {
921
+ let i = n.filter((e) => e.type === r.name), a = {
922
+ name: r.name,
923
+ options: r.options,
924
+ storage: r.storage,
925
+ editor: t
926
+ }, o = $t({
927
+ ...e.reduce((e, t) => {
928
+ let n = L(t, "extendMarkSchema", a);
929
+ return {
930
+ ...e,
931
+ ...n ? n(r) : {}
932
+ };
933
+ }, {}),
934
+ inclusive: z(L(r, "inclusive", a)),
935
+ excludes: z(L(r, "excludes", a)),
936
+ group: z(L(r, "group", a)),
937
+ spanning: z(L(r, "spanning", a)),
938
+ code: z(L(r, "code", a)),
939
+ attrs: Object.fromEntries(i.map(en))
940
+ }), s = z(L(r, "parseHTML", a));
941
+ s && (o.parseDOM = s.map((e) => Qt(e, i)));
942
+ let c = L(r, "renderHTML", a);
943
+ return c && (o.toDOM = (e) => c({
944
+ mark: e,
945
+ HTMLAttributes: B(e, i)
946
+ })), [r.name, o];
947
+ }))
948
+ };
867
949
  }
868
- function qt(e) {
869
- let t = e.filter((t, n) => e.indexOf(t) !== n);
870
- return Array.from(new Set(t));
950
+ function nn(e, t, n) {
951
+ if (n === void 0) return new E(tn(e, t));
952
+ let r = Wt(e.filter((e) => e.type !== "extension").map((e) => e.name));
953
+ if (r.length) throw RangeError(`Duplicate local schema types: ${r.join(", ")}`);
954
+ let i = new E(n), a = tn(e, t, Lt(Gt(e), i));
955
+ return new E(Ut(a, i));
871
956
  }
872
- function H(e) {
957
+ function V(e) {
873
958
  return e.sort((e, t) => {
874
- let n = R(e, "priority") || 100, r = R(t, "priority") || 100;
959
+ let n = L(e, "priority") || 100, r = L(t, "priority") || 100;
875
960
  return n > r ? -1 : +(n < r);
876
961
  });
877
962
  }
878
- function Jt(e) {
879
- let t = H(Pt(e)), n = qt(t.map((e) => e.name));
963
+ function rn(e) {
964
+ let t = V(Ft(e)), n = Wt(t.map((e) => e.name));
880
965
  return n.length && console.warn(`[tiptap warn]: Duplicate extension names found: [${n.map((e) => `'${e}'`).join(", ")}]. This can lead to issues.`), t;
881
966
  }
882
- function Yt(e, t, n) {
967
+ function an(e, t, n) {
883
968
  let { from: r, to: i } = t, { blockSeparator: a = "\n\n", textSerializers: o = {} } = n || {}, s = "";
884
969
  return e.nodesBetween(r, i, (e, n, c, l) => {
885
970
  e.isBlock && n > r && (s += a);
@@ -897,39 +982,39 @@ function Yt(e, t, n) {
897
982
  }
898
983
  }), s;
899
984
  }
900
- function Xt(e, t) {
901
- return Yt(e, {
985
+ function on(e, t) {
986
+ return an(e, {
902
987
  from: 0,
903
988
  to: e.content.size
904
989
  }, t);
905
990
  }
906
- function Zt(e) {
991
+ function sn(e) {
907
992
  return Object.fromEntries(Object.entries(e.nodes).filter(([, e]) => e.spec.toText).map(([e, t]) => [e, t.spec.toText]));
908
993
  }
909
- function Qt(e, t) {
910
- let n = O(t, e.schema), { from: r, to: i } = e.selection, a = [];
994
+ function cn(e, t) {
995
+ let n = k(t, e.schema), { from: r, to: i } = e.selection, a = [];
911
996
  e.doc.nodesBetween(r, i, (e) => {
912
997
  a.push(e);
913
998
  });
914
999
  let o = a.reverse().find((e) => e.type.name === n.name);
915
1000
  return o ? { ...o.attrs } : {};
916
1001
  }
917
- function $t(e, t) {
918
- let n = I(typeof t == "string" ? t : t.name, e.schema);
919
- return n === "node" ? Qt(e, t) : n === "mark" ? At(e, t) : {};
1002
+ function ln(e, t) {
1003
+ let n = vt(typeof t == "string" ? t : t.name, e.schema);
1004
+ return n === "node" ? cn(e, t) : n === "mark" ? At(e, t) : {};
920
1005
  }
921
- function en(e, t = JSON.stringify) {
1006
+ function un(e, t = JSON.stringify) {
922
1007
  let n = {};
923
1008
  return e.filter((e) => {
924
1009
  let r = t(e);
925
1010
  return Object.prototype.hasOwnProperty.call(n, r) ? !1 : n[r] = !0;
926
1011
  });
927
1012
  }
928
- function tn(e) {
929
- let t = en(e);
1013
+ function dn(e) {
1014
+ let t = un(e);
930
1015
  return t.length === 1 ? t : t.filter((e, n) => !t.filter((e, t) => t !== n).some((t) => e.oldRange.from >= t.oldRange.from && e.oldRange.to <= t.oldRange.to && e.newRange.from >= t.newRange.from && e.newRange.to <= t.newRange.to));
931
1016
  }
932
- function nn(e) {
1017
+ function fn(e) {
933
1018
  let { mapping: t, steps: n } = e, r = [];
934
1019
  return t.maps.forEach((e, i) => {
935
1020
  let a = [];
@@ -960,12 +1045,12 @@ function nn(e) {
960
1045
  }
961
1046
  });
962
1047
  });
963
- }), tn(r);
1048
+ }), dn(r);
964
1049
  }
965
- function rn(e, t, n) {
1050
+ function pn(e, t, n) {
966
1051
  let r = [];
967
1052
  return e === t ? n.resolve(e).marks().forEach((t) => {
968
- let i = k(n.resolve(e), t.type);
1053
+ let i = ze(n.resolve(e), t.type);
969
1054
  i && r.push({
970
1055
  mark: t,
971
1056
  ...i
@@ -978,29 +1063,29 @@ function rn(e, t, n) {
978
1063
  })));
979
1064
  }), r;
980
1065
  }
981
- var an = (e, t, n, r = 20) => {
1066
+ var mn = (e, t, n, r = 20) => {
982
1067
  let i = e.doc.resolve(n), a = r, o = null;
983
1068
  for (; a > 0 && o === null;) {
984
1069
  let e = i.node(a);
985
1070
  e?.type.name === t ? o = e : --a;
986
1071
  }
987
1072
  return [o, a];
988
- }, on = (e) => {
1073
+ }, hn = (e) => {
989
1074
  let t = e.depth - 1;
990
1075
  if (t < 0) return null;
991
1076
  let n = e.index(t);
992
1077
  return n === 0 ? null : e.node(t).child(n - 1);
993
1078
  };
994
- function U(e, t) {
1079
+ function H(e, t) {
995
1080
  return t.nodes[e] || t.marks[e] || null;
996
1081
  }
997
- function W(e, t, n) {
1082
+ function U(e, t, n) {
998
1083
  return Object.fromEntries(Object.entries(n).filter(([n]) => {
999
1084
  let r = e.find((e) => e.type === t && e.name === n);
1000
1085
  return r ? r.attribute.keepOnSplit : !1;
1001
1086
  }));
1002
1087
  }
1003
- var sn = (e, t = 500) => {
1088
+ var gn = (e, t = 500) => {
1004
1089
  let n = "", r = e.parentOffset;
1005
1090
  return e.parent.nodesBetween(Math.max(0, r - t), r, (e, t, i, a) => {
1006
1091
  var o;
@@ -1013,9 +1098,9 @@ var sn = (e, t = 500) => {
1013
1098
  n += e.isAtom && !e.isText ? s : s.slice(0, Math.max(0, r - t));
1014
1099
  }), n;
1015
1100
  };
1016
- function cn(e, t, n = {}) {
1017
- let { empty: r, ranges: i } = e.selection, a = t ? A(t, e.schema) : null;
1018
- if (r) return !!(e.storedMarks || e.selection.$from.marks()).filter((e) => !a || a.name === e.type.name).find((e) => Re(e.attrs, n, { strict: !1 }));
1101
+ function _n(e, t, n = {}) {
1102
+ let { empty: r, ranges: i } = e.selection, a = t ? j(t, e.schema) : null;
1103
+ if (r) return !!(e.storedMarks || e.selection.$from.marks()).filter((e) => !a || a.name === e.type.name).find((e) => A(e.attrs, n, { strict: !1 }));
1019
1104
  let o = 0, s = [];
1020
1105
  if (i.forEach(({ $from: t, $to: n }) => {
1021
1106
  let r = t.pos, i = n.pos;
@@ -1030,34 +1115,34 @@ function cn(e, t, n = {}) {
1030
1115
  })));
1031
1116
  });
1032
1117
  }), o === 0) return !1;
1033
- let c = s.filter((e) => !a || a.name === e.mark.type.name).filter((e) => Re(e.mark.attrs, n, { strict: !1 })).reduce((e, t) => e + t.to - t.from, 0), l = s.filter((e) => !a || e.mark.type !== a && e.mark.type.excludes(a)).reduce((e, t) => e + t.to - t.from, 0);
1118
+ let c = s.filter((e) => !a || a.name === e.mark.type.name).filter((e) => A(e.mark.attrs, n, { strict: !1 })).reduce((e, t) => e + t.to - t.from, 0), l = s.filter((e) => !a || e.mark.type !== a && e.mark.type.excludes(a)).reduce((e, t) => e + t.to - t.from, 0);
1034
1119
  return (c > 0 ? c + l : c) >= o;
1035
1120
  }
1036
- function ln(e, t, n = {}) {
1037
- if (!t) return F(e, null, n) || cn(e, null, n);
1038
- let r = I(t, e.schema);
1039
- return r === "node" ? F(e, t, n) : r === "mark" && cn(e, t, n);
1121
+ function vn(e, t, n = {}) {
1122
+ if (!t) return I(e, null, n) || _n(e, null, n);
1123
+ let r = vt(t, e.schema);
1124
+ return r === "node" ? I(e, t, n) : r === "mark" && _n(e, t, n);
1040
1125
  }
1041
- var un = (e, t) => {
1126
+ var yn = (e, t) => {
1042
1127
  let { $from: n, $to: r, $anchor: i } = e.selection;
1043
1128
  if (t) {
1044
- let n = L((e) => e.type.name === t)(e.selection);
1129
+ let n = Pt((e) => e.type.name === t)(e.selection);
1045
1130
  if (!n) return !1;
1046
1131
  let r = e.doc.resolve(n.pos + 1);
1047
1132
  return i.pos + 1 === r.end();
1048
1133
  }
1049
1134
  return !(r.parentOffset < r.parent.nodeSize - 2 || n.pos !== r.pos);
1050
- }, dn = (e) => {
1135
+ }, bn = (e) => {
1051
1136
  let { $from: t, $to: n } = e.selection;
1052
1137
  return !(t.parentOffset > 0 || t.pos !== n.pos);
1053
1138
  };
1054
- function fn(e, t) {
1139
+ function xn(e, t) {
1055
1140
  return Array.isArray(t) ? t.some((t) => (typeof t == "string" ? t : t.name) === e.name) : t;
1056
1141
  }
1057
- function pn(e, t) {
1058
- let { nodeExtensions: n } = B(t), r = n.find((t) => t.name === e);
1142
+ function W(e, t) {
1143
+ let { nodeExtensions: n } = R(t), r = n.find((t) => t.name === e);
1059
1144
  if (!r) return !1;
1060
- let i = z(R(r, "group", {
1145
+ let i = z(L(r, "group", {
1061
1146
  name: r.name,
1062
1147
  options: r.options,
1063
1148
  storage: r.storage
@@ -1083,10 +1168,22 @@ function G(e, { checkChildren: t = !0, ignoreWhitespace: n = !1 } = {}) {
1083
1168
  }
1084
1169
  return !1;
1085
1170
  }
1086
- function mn(e) {
1171
+ function Sn(e) {
1087
1172
  return e instanceof n;
1088
1173
  }
1089
- var hn = class e {
1174
+ function Cn(e) {
1175
+ if (typeof e != "object" || !e) return !1;
1176
+ let t = e;
1177
+ return typeof t.apply == "function" && typeof t.getMap == "function" && typeof t.invert == "function" && typeof t.map == "function" && typeof t.merge == "function" && typeof t.toJSON == "function";
1178
+ }
1179
+ function wn(e) {
1180
+ if (typeof e != "object" || !e) return !1;
1181
+ let t = e;
1182
+ if (!Cn(t)) return !1;
1183
+ let n = t.toJSON();
1184
+ return !(typeof n != "object" || !n || n.stepType !== "replace");
1185
+ }
1186
+ var Tn = class e {
1090
1187
  constructor(e) {
1091
1188
  this.position = e;
1092
1189
  }
@@ -1097,18 +1194,18 @@ var hn = class e {
1097
1194
  return { position: this.position };
1098
1195
  }
1099
1196
  };
1100
- function gn(e, t) {
1197
+ function En(e, t) {
1101
1198
  let n = t.mapping.mapResult(e.position);
1102
1199
  return {
1103
- position: new hn(n.pos),
1200
+ position: new Tn(n.pos),
1104
1201
  mapResult: n
1105
1202
  };
1106
1203
  }
1107
- function _n(e) {
1108
- return new hn(e);
1204
+ function Dn(e) {
1205
+ return new Tn(e);
1109
1206
  }
1110
- function vn(e, t, n) {
1111
- let r = e.state.doc.content.size, i = j(t, 0, r), a = j(n, 0, r), o = e.coordsAtPos(i), s = e.coordsAtPos(a, -1), c = Math.min(o.top, s.top), l = Math.max(o.bottom, s.bottom), u = Math.min(o.left, s.left), d = Math.max(o.right, s.right), f = {
1207
+ function On(e, t, n) {
1208
+ let r = e.state.doc.content.size, i = M(t, 0, r), a = M(n, 0, r), o = e.coordsAtPos(i), s = e.coordsAtPos(a, -1), c = Math.min(o.top, s.top), l = Math.max(o.bottom, s.bottom), u = Math.min(o.left, s.left), d = Math.max(o.right, s.right), f = {
1112
1209
  top: c,
1113
1210
  bottom: l,
1114
1211
  left: u,
@@ -1123,9 +1220,9 @@ function vn(e, t, n) {
1123
1220
  toJSON: () => f
1124
1221
  };
1125
1222
  }
1126
- function yn(e, t, n) {
1223
+ function kn(e, t, n) {
1127
1224
  let { selection: r } = t, i = null;
1128
- if (Ue(r) && (i = r.$cursor), i) {
1225
+ if (He(r) && (i = r.$cursor), i) {
1129
1226
  let t = e.storedMarks ?? i.marks();
1130
1227
  return i.parent.type.allowsMarkType(n) && (!!n.isInSet(t) || !t.some((e) => e.type.excludes(n)));
1131
1228
  }
@@ -1142,8 +1239,8 @@ function yn(e, t, n) {
1142
1239
  }), i;
1143
1240
  });
1144
1241
  }
1145
- var bn = (e, t = {}) => ({ tr: n, state: r, dispatch: i }) => {
1146
- let { selection: a } = n, { empty: o, ranges: s } = a, c = A(e, r.schema);
1242
+ var An = (e, t = {}) => ({ tr: n, state: r, dispatch: i }) => {
1243
+ let { selection: a } = n, { empty: o, ranges: s } = a, c = j(e, r.schema);
1147
1244
  if (i) {
1148
1245
  if (o) {
1149
1246
  let e = At(r, c);
@@ -1164,23 +1261,23 @@ var bn = (e, t = {}) => ({ tr: n, state: r, dispatch: i }) => {
1164
1261
  });
1165
1262
  });
1166
1263
  }
1167
- return yn(r, n, c);
1168
- }, xn = (e, t) => ({ tr: n }) => (n.setMeta(e, t), !0), Sn = (e, t = {}) => ({ state: n, dispatch: r, chain: i }) => {
1169
- let a = O(e, n.schema), o;
1170
- return n.selection.$anchor.sameParent(n.selection.$head) && (o = n.selection.$anchor.parent.attrs), a.isTextblock ? i().command(({ commands: e }) => ce(a, {
1264
+ return kn(r, n, c);
1265
+ }, jn = (e, t) => ({ tr: n }) => (n.setMeta(e, t), !0), Mn = (e, t = {}) => ({ state: n, dispatch: r, chain: i }) => {
1266
+ let a = k(e, n.schema), o;
1267
+ return n.selection.$anchor.sameParent(n.selection.$head) && (o = n.selection.$anchor.parent.attrs), a.isTextblock ? i().command(({ commands: e }) => se(a, {
1171
1268
  ...o,
1172
1269
  ...t
1173
- })(n) ? !0 : e.clearNodes()).command(({ state: e }) => ce(a, {
1270
+ })(n) ? !0 : e.clearNodes()).command(({ state: e }) => se(a, {
1174
1271
  ...o,
1175
1272
  ...t
1176
1273
  })(e, r)).run() : (console.warn("[tiptap warn]: Currently \"setNode()\" only supports text block nodes."), !1);
1177
- }, Cn = (e) => ({ tr: t, dispatch: r }) => {
1274
+ }, Nn = (e) => ({ tr: t, dispatch: r }) => {
1178
1275
  if (r) {
1179
- let { doc: r } = t, i = j(e, 0, r.content.size), a = n.create(r, i);
1276
+ let { doc: r } = t, i = M(e, 0, r.content.size), a = n.create(r, i);
1180
1277
  t.setSelection(a);
1181
1278
  }
1182
1279
  return !0;
1183
- }, wn = (e, t) => ({ tr: n, state: r, dispatch: i }) => {
1280
+ }, Pn = (e, t) => ({ tr: n, state: r, dispatch: i }) => {
1184
1281
  let { selection: a } = r, o, s;
1185
1282
  return typeof t == "number" ? (o = t, s = t) : t && "from" in t && "to" in t ? (o = t.from, s = t.to) : (o = a.from, s = a.to), i && n.doc.nodesBetween(o, s, (t, r) => {
1186
1283
  t.isText || n.setNodeMarkup(r, void 0, {
@@ -1188,31 +1285,31 @@ var bn = (e, t = {}) => ({ tr: n, state: r, dispatch: i }) => {
1188
1285
  dir: e
1189
1286
  });
1190
1287
  }), !0;
1191
- }, Tn = (e) => ({ tr: t, dispatch: n }) => {
1288
+ }, Fn = (e) => ({ tr: t, dispatch: n }) => {
1192
1289
  if (n) {
1193
1290
  let { doc: n } = t, { from: r, to: i } = typeof e == "number" ? {
1194
1291
  from: e,
1195
1292
  to: e
1196
- } : e, a = o.atStart(n).from, s = o.atEnd(n).to, c = j(r, a, s), l = j(i, a, s), u = o.create(n, c, l);
1293
+ } : e, a = o.atStart(n).from, s = o.atEnd(n).to, c = M(r, a, s), l = M(i, a, s), u = o.create(n, c, l);
1197
1294
  t.setSelection(u);
1198
1295
  }
1199
1296
  return !0;
1200
- }, En = (e) => ({ state: t, dispatch: n }) => {
1201
- let r = O(e, t.schema);
1202
- return he(r)(t, n);
1297
+ }, In = (e) => ({ state: t, dispatch: n }) => {
1298
+ let r = k(e, t.schema);
1299
+ return pe(r)(t, n);
1203
1300
  };
1204
- function Dn(e, t) {
1301
+ function Ln(e, t) {
1205
1302
  let n = e.storedMarks || e.selection.$to.parentOffset && e.selection.$from.marks();
1206
1303
  if (n) {
1207
1304
  let r = n.filter((e) => t?.includes(e.type.name));
1208
1305
  e.tr.ensureMarks(r);
1209
1306
  }
1210
1307
  }
1211
- var On = ({ keepMarks: e = !0 } = {}) => ({ tr: r, state: i, dispatch: a, editor: s }) => {
1212
- let { selection: c, doc: l } = r, { $from: u, $to: d } = c, p = s.extensionManager.attributes, m = W(p, u.node().type.name, u.node().attrs);
1213
- if (c instanceof n && c.node.isBlock) return !u.parentOffset || !f(l, u.pos) ? !1 : (a && (e && Dn(i, s.extensionManager.splittableMarks), r.split(u.pos).scrollIntoView()), !0);
1308
+ var Rn = ({ keepMarks: e = !0 } = {}) => ({ tr: r, state: i, dispatch: a, editor: s }) => {
1309
+ let { selection: c, doc: l } = r, { $from: u, $to: d } = c, p = s.extensionManager.attributes, m = U(p, u.node().type.name, u.node().attrs);
1310
+ if (c instanceof n && c.node.isBlock) return !u.parentOffset || !f(l, u.pos) ? !1 : (a && (e && Ln(i, s.extensionManager.splittableMarks), r.split(u.pos).scrollIntoView()), !0);
1214
1311
  if (!u.parent.isBlock) return !1;
1215
- let h = d.parentOffset === d.parent.content.size, g = u.depth === 0 ? void 0 : tt(u.node(-1).contentMatchAt(u.indexAfter(-1))), _ = h && g ? [{
1312
+ let h = d.parentOffset === d.parent.content.size, g = u.depth === 0 ? void 0 : et(u.node(-1).contentMatchAt(u.indexAfter(-1))), _ = h && g ? [{
1216
1313
  type: g,
1217
1314
  attrs: m
1218
1315
  }] : void 0, v = c instanceof o && !c.empty ? t.create({
@@ -1230,11 +1327,11 @@ var On = ({ keepMarks: e = !0 } = {}) => ({ tr: r, state: i, dispatch: a, editor
1230
1327
  u.node(-1).canReplaceWith(n.index(), n.index() + 1, g) && r.setNodeMarkup(r.mapping.slice(e).map(u.before()), g);
1231
1328
  }
1232
1329
  }
1233
- e && Dn(i, s.extensionManager.splittableMarks), r.scrollIntoView();
1330
+ e && Ln(i, s.extensionManager.splittableMarks), r.scrollIntoView();
1234
1331
  }
1235
1332
  return x;
1236
- }, kn = (e, t = {}) => ({ tr: n, state: r, dispatch: i, editor: a }) => {
1237
- let s = O(e, r.schema), { $from: c, $to: l } = r.selection, u = r.selection.node;
1333
+ }, zn = (e, t = {}) => ({ tr: n, state: r, dispatch: i, editor: a }) => {
1334
+ let s = k(e, r.schema), { $from: c, $to: l } = r.selection, u = r.selection.node;
1238
1335
  if (u && u.isBlock || c.depth < 2 || !c.sameParent(l)) return !1;
1239
1336
  let d = c.node(-1);
1240
1337
  if (d.type !== s) return !1;
@@ -1242,15 +1339,15 @@ var On = ({ keepMarks: e = !0 } = {}) => ({ tr: r, state: i, dispatch: a, editor
1242
1339
  if (c.parent.content.size === 0 && c.node(-1).childCount === c.indexAfter(-1)) {
1243
1340
  if (c.depth === 2 || c.node(-3).type !== s || c.index(-2) !== c.node(-2).childCount - 1) return !1;
1244
1341
  if (i) {
1245
- let e = w.empty, r = c.index(-1) ? 1 : c.index(-2) ? 2 : 3;
1246
- for (let t = c.depth - r; t >= c.depth - 3; --t) e = w.from(c.node(t).copy(e));
1342
+ let e = T.empty, r = c.index(-1) ? 1 : c.index(-2) ? 2 : 3;
1343
+ for (let t = c.depth - r; t >= c.depth - 3; --t) e = T.from(c.node(t).copy(e));
1247
1344
  let i = c.indexAfter(-1) < c.node(-2).childCount ? 1 : c.indexAfter(-2) < c.node(-3).childCount ? 2 : 3, a = {
1248
- ...W(p, c.node().type.name, c.node().attrs),
1345
+ ...U(p, c.node().type.name, c.node().attrs),
1249
1346
  ...t
1250
1347
  }, l = s.contentMatch.defaultType?.createAndFill(a) || void 0;
1251
- e = e.append(w.from(s.createAndFill(null, l) || void 0));
1348
+ e = e.append(T.from(s.createAndFill(null, l) || void 0));
1252
1349
  let u = c.before(c.depth - (r - 1));
1253
- n.replace(u, c.after(-i), new pe(e, 4 - r, 0));
1350
+ n.replace(u, c.after(-i), new de(e, 4 - r, 0));
1254
1351
  let d = -1;
1255
1352
  n.doc.nodesBetween(u, n.doc.content.size, (e, t) => {
1256
1353
  if (d > -1) return !1;
@@ -1260,10 +1357,10 @@ var On = ({ keepMarks: e = !0 } = {}) => ({ tr: r, state: i, dispatch: a, editor
1260
1357
  return !0;
1261
1358
  }
1262
1359
  let m = l.pos === c.end() ? d.contentMatchAt(0).defaultType : null, h = {
1263
- ...W(p, d.type.name, d.attrs),
1360
+ ...U(p, d.type.name, d.attrs),
1264
1361
  ...t
1265
1362
  }, g = {
1266
- ...W(p, c.node().type.name, c.node().attrs),
1363
+ ...U(p, c.node().type.name, c.node().attrs),
1267
1364
  ...t
1268
1365
  }, _ = c.parentOffset === 0 && c.index(-1) === 0, v = c.before(-1);
1269
1366
  n.delete(c.pos, l.pos);
@@ -1286,65 +1383,137 @@ var On = ({ keepMarks: e = !0 } = {}) => ({ tr: r, state: i, dispatch: a, editor
1286
1383
  }
1287
1384
  return !0;
1288
1385
  };
1289
- function An(e) {
1386
+ function Bn(e, t, n) {
1387
+ if (!e.validContent(t)) return null;
1388
+ try {
1389
+ return e.create(n, t);
1390
+ } catch {
1391
+ return null;
1392
+ }
1393
+ }
1394
+ function Vn(e, t) {
1395
+ if (e.pendingContent.length === 0) return !0;
1396
+ let n = Bn(t, T.from(e.pendingContent));
1397
+ return n ? (e.items.push(n), e.pendingContent = [], !0) : !1;
1398
+ }
1399
+ function Hn(e, t, n) {
1400
+ return n.validContent(T.from([...t.pendingContent, e])) ? (t.pendingContent.push(e), !0) : !Vn(t, n) || !n.validContent(T.from(e)) ? !1 : (t.pendingContent.push(e), !0);
1401
+ }
1402
+ function Un(e, t, n, r) {
1403
+ let i = r(e, n);
1404
+ if (!i) return !1;
1405
+ let a = Bn(n.listType, T.from(i), e.attrs);
1406
+ return a ? n.itemType.validContent(T.from([...t.pendingContent, a])) ? (t.pendingContent.push(a), !0) : Vn(t, n.itemType) ? (t.items.push(...i), !0) : !1 : !1;
1407
+ }
1408
+ function Wn(e, t, n) {
1409
+ let r = {
1410
+ items: [],
1411
+ pendingContent: []
1412
+ };
1413
+ for (let i = 0; i < e.childCount; i += 1) {
1414
+ let a = e.child(i);
1415
+ if (!(t.isListNode(a) ? Un(a, r, t, n) : Hn(a, r, t.itemType))) return null;
1416
+ }
1417
+ return Vn(r, t.itemType) ? r.items : null;
1418
+ }
1419
+ function Gn(e, t) {
1420
+ let n = [];
1421
+ for (let r = 0; r < e.childCount; r += 1) {
1422
+ let i = Wn(e.child(r), t, Gn);
1423
+ if (!i) return null;
1424
+ n.push(...i);
1425
+ }
1426
+ return n;
1427
+ }
1428
+ function Kn(e, t) {
1429
+ let n = null;
1430
+ return e.descendants((e, r) => e !== t || (n = r, !1)), n;
1431
+ }
1432
+ function qn(e) {
1290
1433
  return !e || e === "1" ? null : e;
1291
1434
  }
1292
- function jn(e, t) {
1293
- return An(e) === An(t);
1435
+ function Jn(e, t) {
1436
+ return qn(e) === qn(t);
1294
1437
  }
1295
- var Mn = (e, t) => {
1296
- let n = L((e) => e.type === t)(e.selection);
1438
+ var K = (e, t) => {
1439
+ let n = Pt((e) => e.type === t)(e.selection);
1297
1440
  if (!n) return !0;
1298
1441
  let r = e.doc.resolve(Math.max(0, n.pos - 1)).before(n.depth);
1299
1442
  if (r === void 0) return !0;
1300
1443
  let i = e.doc.nodeAt(r);
1301
- return !(n.node.type === i?.type && d(e.doc, n.pos)) || !jn(n.node.attrs.type, i?.attrs.type) || e.join(n.pos), !0;
1302
- }, Nn = (e, t) => {
1303
- let n = L((e) => e.type === t)(e.selection);
1444
+ return !(n.node.type === i?.type && d(e.doc, n.pos)) || !Jn(n.node.attrs.type, i?.attrs.type) || e.join(n.pos), !0;
1445
+ }, q = (e, t) => {
1446
+ let n = Pt((e) => e.type === t)(e.selection);
1304
1447
  if (!n) return !0;
1305
1448
  let r = e.doc.resolve(n.start).after(n.depth);
1306
1449
  if (r === void 0) return !0;
1307
1450
  let i = e.doc.nodeAt(r);
1308
- return !(n.node.type === i?.type && d(e.doc, r)) || !jn(n.node.attrs.type, i?.attrs.type) || e.join(r), !0;
1451
+ return !(n.node.type === i?.type && d(e.doc, r)) || !Jn(n.node.attrs.type, i?.attrs.type) || e.join(r), !0;
1309
1452
  };
1310
- function Pn(e) {
1453
+ function Yn(e) {
1311
1454
  let t = e.doc, n = t.firstChild;
1312
1455
  if (!n) return null;
1313
1456
  let r = t.resolve(1), i = t.resolve(n.nodeSize - 1);
1314
1457
  return o.between(r, i);
1315
1458
  }
1316
- var Fn = (e, t, n, r = {}) => ({ editor: i, tr: a, state: o, dispatch: s, chain: c, commands: l, can: u }) => {
1317
- let { extensions: d, splittableMarks: f } = i.extensionManager, p = O(e, o.schema), m = O(t, o.schema), { selection: h, storedMarks: g } = o, { $from: _, $to: v } = h, y = _.blockRange(v), b = g || h.$to.parentOffset && h.$from.marks();
1318
- if (!y) return !1;
1319
- let x = L((e) => pn(e.type.name, d))(h), ee = h.from === 0 && h.to === o.doc.content.size, te = o.doc.content.content, S = te.length === 1 ? te[0] : null, ne = ee && S && pn(S.type.name, d) ? {
1320
- node: S,
1459
+ var Xn = (e, t, n, r = {}) => ({ editor: i, tr: a, state: s, dispatch: c, chain: l, commands: u, can: d }) => {
1460
+ let { extensions: f, splittableMarks: p } = i.extensionManager, m = k(e, s.schema), h = k(t, s.schema), { selection: g, storedMarks: _ } = s, { $from: v, $to: y } = g, b = v.blockRange(y), x = _ || g.$to.parentOffset && g.$from.marks();
1461
+ if (!b) return !1;
1462
+ let S = Pt((e) => W(e.type.name, f))(g), ee = g.from === 0 && g.to === s.doc.content.size, te = s.doc.content.content, C = te.length === 1 ? te[0] : null, ne = ee && C && W(C.type.name, f) ? {
1463
+ node: C,
1321
1464
  pos: 0,
1322
1465
  depth: 0
1323
- } : null, C = x ?? ne, re = !!x && y.depth >= 1 && y.depth - x.depth <= 1, ie = !!ne;
1324
- if ((re || ie) && C) {
1325
- if (C.node.type === p) return ee && ie ? c().command(({ tr: e, dispatch: t }) => {
1326
- let n = Pn(e);
1466
+ } : null, w = S ?? ne, re = !!S && b.depth >= 1 && b.depth - S.depth <= 1, ie = !!ne;
1467
+ if ((re || ie) && w) {
1468
+ if (w.node.type === m) return ee && ie ? l().command(({ tr: e, dispatch: t }) => {
1469
+ let n = Yn(e);
1327
1470
  return n ? (e.setSelection(n), t && t(e), !0) : !1;
1328
- }).liftListItem(m).run() : l.liftListItem(m);
1329
- if (pn(C.node.type.name, d) && p.validContent(C.node.content)) return c().command(() => (a.setNodeMarkup(C.pos, p), !0)).command(() => Mn(a, p)).command(() => Nn(a, p)).run();
1330
- }
1331
- return !n || !b || !s ? c().command(() => u().wrapInList(p, r) ? !0 : l.clearNodes()).wrapInList(p, r).command(() => Mn(a, p)).command(() => Nn(a, p)).run() : c().command(() => {
1332
- let e = u().wrapInList(p, r), t = b.filter((e) => f.includes(e.type.name));
1333
- return a.ensureMarks(t), e ? !0 : l.clearNodes();
1334
- }).wrapInList(p, r).command(() => Mn(a, p)).command(() => Nn(a, p)).run();
1335
- }, In = (e, t = {}, n = {}) => ({ state: r, commands: i }) => {
1336
- let { extendEmptyMarkRange: a = !1 } = n, o = A(e, r.schema);
1337
- return cn(r, o, t) ? i.unsetMark(o, { extendEmptyMarkRange: a }) : i.setMark(o, t);
1338
- }, Ln = (e, t, n = {}) => ({ state: r, commands: i }) => {
1339
- let a = O(e, r.schema), o = O(t, r.schema), s = F(r, a, n), c;
1471
+ }).liftListItem(h).run() : u.liftListItem(h);
1472
+ if (W(w.node.type.name, f) && m.validContent(w.node.content)) return l().command(() => (a.setNodeMarkup(w.pos, m), !0)).command(() => K(a, m)).command(() => q(a, m)).run();
1473
+ if (W(w.node.type.name, f)) {
1474
+ let e = w.node.firstChild?.type;
1475
+ if (e && e !== h) {
1476
+ let e = Gn(w.node, {
1477
+ listType: m,
1478
+ itemType: h,
1479
+ isListNode: (e) => W(e.type.name, f)
1480
+ }), t = e ? T.from(e) : null;
1481
+ return !t || !m.validContent(t) ? !1 : l().command(() => {
1482
+ let { $anchor: e, $head: n } = a.selection, i = e.parent, s = n.parent, c = e.parentOffset, l = n.parentOffset, u;
1483
+ try {
1484
+ u = m.create(r, t);
1485
+ } catch {
1486
+ return !1;
1487
+ }
1488
+ if (a.replaceWith(w.pos, w.pos + w.node.nodeSize, u), i.inlineContent && s.inlineContent) {
1489
+ let e = Kn(u, i), t = Kn(u, s);
1490
+ if (e !== null && t !== null) {
1491
+ let n = w.pos + e + 2 + c, r = w.pos + t + 2 + l;
1492
+ a.setSelection(o.create(a.doc, n, r));
1493
+ }
1494
+ }
1495
+ return !0;
1496
+ }).command(() => K(a, m)).command(() => q(a, m)).run();
1497
+ }
1498
+ }
1499
+ }
1500
+ return !n || !x || !c ? l().command(() => d().wrapInList(m, r) ? !0 : u.clearNodes()).wrapInList(m, r).command(() => K(a, m)).command(() => q(a, m)).run() : l().command(() => {
1501
+ let e = d().wrapInList(m, r), t = x.filter((e) => p.includes(e.type.name));
1502
+ return a.ensureMarks(t), e ? !0 : u.clearNodes();
1503
+ }).wrapInList(m, r).command(() => K(a, m)).command(() => q(a, m)).run();
1504
+ }, Zn = (e, t = {}, n = {}) => ({ state: r, commands: i }) => {
1505
+ let { extendEmptyMarkRange: a = !1 } = n, o = j(e, r.schema);
1506
+ return _n(r, o, t) ? i.unsetMark(o, { extendEmptyMarkRange: a }) : i.setMark(o, t);
1507
+ }, Qn = (e, t, n = {}) => ({ state: r, commands: i }) => {
1508
+ let a = k(e, r.schema), o = k(t, r.schema), s = I(r, a, n), c;
1340
1509
  return r.selection.$anchor.sameParent(r.selection.$head) && (c = r.selection.$anchor.parent.attrs), s ? i.setNode(o, c) : i.setNode(a, {
1341
1510
  ...c,
1342
1511
  ...n
1343
1512
  });
1344
- }, Rn = (e, t = {}) => ({ state: n, commands: r }) => {
1345
- let i = O(e, n.schema);
1346
- return F(n, i, t) ? r.lift(i) : r.wrapIn(i, t);
1347
- }, zn = () => ({ state: e, dispatch: t }) => {
1513
+ }, $n = (e, t = {}) => ({ state: n, commands: r }) => {
1514
+ let i = k(e, n.schema);
1515
+ return I(n, i, t) ? r.lift(i) : r.wrapIn(i, t);
1516
+ }, er = () => ({ state: e, dispatch: t }) => {
1348
1517
  let n = e.plugins;
1349
1518
  for (let r = 0; r < n.length; r += 1) {
1350
1519
  let i = n[r], a;
@@ -1361,7 +1530,7 @@ var Fn = (e, t, n, r = {}) => ({ editor: i, tr: a, state: o, dispatch: s, chain:
1361
1530
  }
1362
1531
  }
1363
1532
  return !1;
1364
- }, Bn = (e = {}) => ({ tr: t, dispatch: n, editor: r }) => {
1533
+ }, tr = (e = {}) => ({ tr: t, dispatch: n, editor: r }) => {
1365
1534
  let { ignoreClearable: i = !1 } = e, { selection: a } = t, { empty: o, ranges: s } = a;
1366
1535
  if (o) return !0;
1367
1536
  let { nonClearableMarks: c } = r.extensionManager;
@@ -1372,27 +1541,27 @@ var Fn = (e, t, n, r = {}) => ({ editor: i, tr: a, state: o, dispatch: s, chain:
1372
1541
  });
1373
1542
  }
1374
1543
  return !0;
1375
- }, Vn = (e, t = {}) => ({ tr: n, state: r, dispatch: i }) => {
1376
- let { extendEmptyMarkRange: a = !1 } = t, { selection: o } = n, s = A(e, r.schema), { $from: c, empty: l, ranges: u } = o;
1544
+ }, nr = (e, t = {}) => ({ tr: n, state: r, dispatch: i }) => {
1545
+ let { extendEmptyMarkRange: a = !1 } = t, { selection: o } = n, s = j(e, r.schema), { $from: c, empty: l, ranges: u } = o;
1377
1546
  if (!i) return !0;
1378
1547
  if (l && a) {
1379
- let { from: e, to: t } = o, r = k(c, s, c.marks().find((e) => e.type === s)?.attrs);
1548
+ let { from: e, to: t } = o, r = ze(c, s, c.marks().find((e) => e.type === s)?.attrs);
1380
1549
  r && (e = r.from, t = r.to), n.removeMark(e, t, s);
1381
1550
  } else u.forEach((e) => {
1382
1551
  n.removeMark(e.$from.pos, e.$to.pos, s);
1383
1552
  });
1384
1553
  return n.removeStoredMark(s), !0;
1385
- }, Hn = (e) => ({ tr: t, state: n, dispatch: r }) => {
1554
+ }, rr = (e) => ({ tr: t, state: n, dispatch: r }) => {
1386
1555
  let { selection: i } = n, a, o;
1387
1556
  return typeof e == "number" ? (a = e, o = e) : e && "from" in e && "to" in e ? (a = e.from, o = e.to) : (a = i.from, o = i.to), r && t.doc.nodesBetween(a, o, (e, n) => {
1388
1557
  if (e.isText) return;
1389
1558
  let r = { ...e.attrs };
1390
1559
  delete r.dir, t.setNodeMarkup(n, void 0, r);
1391
1560
  }), !0;
1392
- }, Un = (e, t = {}) => ({ tr: n, state: r, dispatch: i }) => {
1393
- let a = null, o = null, s = I(typeof e == "string" ? e : e.name, r.schema);
1561
+ }, ir = (e, t = {}) => ({ tr: n, state: r, dispatch: i }) => {
1562
+ let a = null, o = null, s = vt(typeof e == "string" ? e : e.name, r.schema);
1394
1563
  if (!s) return !1;
1395
- s === "node" && (a = O(e, r.schema)), s === "mark" && (o = A(e, r.schema));
1564
+ s === "node" && (a = k(e, r.schema)), s === "mark" && (o = j(e, r.schema));
1396
1565
  let c = !1;
1397
1566
  return n.selection.ranges.forEach((e) => {
1398
1567
  let s = e.$from.pos, l = e.$to.pos, u, d, f, p;
@@ -1421,48 +1590,48 @@ var Fn = (e, t, n, r = {}) => ({ editor: i, tr: a, state: o, dispatch: s, chain:
1421
1590
  }));
1422
1591
  }));
1423
1592
  }), c;
1424
- }, K = new i("__tiptap_decorations__"), Wn = (e) => ({ tr: t, dispatch: n }) => (n && t.setMeta(K, {
1593
+ }, J = new i("__tiptap_decorations__"), ar = (e) => ({ tr: t, dispatch: n }) => (n && t.setMeta(J, {
1425
1594
  type: "force",
1426
1595
  name: e
1427
- }), !0), Gn = (e, t = {}) => ({ state: n, dispatch: r }) => {
1428
- let i = O(e, n.schema);
1429
- return le(i, t)(n, r);
1430
- }, Kn = (e, t = {}) => ({ state: n, dispatch: r }) => {
1431
- let i = O(e, n.schema);
1432
- return ge(i, t)(n, r);
1433
- }, qn = /* @__PURE__ */ xe({
1434
- blur: () => Se,
1435
- clearContent: () => Ce,
1436
- clearNodes: () => we,
1437
- command: () => Te,
1438
- createParagraphNear: () => Ee,
1439
- cut: () => De,
1440
- deleteCurrentNode: () => Oe,
1441
- deleteNode: () => ke,
1442
- deleteRange: () => Ae,
1443
- deleteSelection: () => Pe,
1444
- enter: () => Fe,
1445
- exitCode: () => Ie,
1446
- extendMarkRange: () => Ve,
1447
- first: () => He,
1448
- focus: () => qe,
1449
- forEach: () => Je,
1450
- insertContent: () => Ye,
1451
- insertContentAt: () => et,
1452
- insertDefaultBlock: () => nt,
1453
- joinBackward: () => at,
1454
- joinDown: () => it,
1455
- joinForward: () => ot,
1456
- joinItemBackward: () => ct,
1457
- joinItemForward: () => lt,
1458
- joinTextblockBackward: () => ut,
1459
- joinTextblockForward: () => dt,
1460
- joinUp: () => rt,
1461
- keyboardShortcut: () => mt,
1462
- lift: () => ht,
1463
- liftEmptyBlock: () => gt,
1464
- liftListItem: () => _t,
1465
- newlineInCode: () => vt,
1596
+ }), !0), or = (e, t = {}) => ({ state: n, dispatch: r }) => {
1597
+ let i = k(e, n.schema);
1598
+ return ce(i, t)(n, r);
1599
+ }, sr = (e, t = {}) => ({ state: n, dispatch: r }) => {
1600
+ let i = k(e, n.schema);
1601
+ return me(i, t)(n, r);
1602
+ }, cr = /* @__PURE__ */ ye({
1603
+ blur: () => xe,
1604
+ clearContent: () => Se,
1605
+ clearNodes: () => Ce,
1606
+ command: () => we,
1607
+ createParagraphNear: () => Te,
1608
+ cut: () => Ee,
1609
+ deleteCurrentNode: () => De,
1610
+ deleteNode: () => Oe,
1611
+ deleteRange: () => ke,
1612
+ deleteSelection: () => Ne,
1613
+ enter: () => Pe,
1614
+ exitCode: () => Fe,
1615
+ extendMarkRange: () => Be,
1616
+ first: () => Ve,
1617
+ focus: () => Ke,
1618
+ forEach: () => qe,
1619
+ insertContent: () => Je,
1620
+ insertContentAt: () => $e,
1621
+ insertDefaultBlock: () => tt,
1622
+ joinBackward: () => it,
1623
+ joinDown: () => rt,
1624
+ joinForward: () => at,
1625
+ joinItemBackward: () => st,
1626
+ joinItemForward: () => ct,
1627
+ joinTextblockBackward: () => lt,
1628
+ joinTextblockForward: () => ut,
1629
+ joinUp: () => nt,
1630
+ keyboardShortcut: () => pt,
1631
+ lift: () => mt,
1632
+ liftEmptyBlock: () => ht,
1633
+ liftListItem: () => gt,
1634
+ newlineInCode: () => _t,
1466
1635
  resetAttributes: () => bt,
1467
1636
  scrollIntoView: () => xt,
1468
1637
  selectAll: () => St,
@@ -1472,41 +1641,41 @@ var Fn = (e, t, n, r = {}) => ({ editor: i, tr: a, state: o, dispatch: s, chain:
1472
1641
  selectTextblockEnd: () => Et,
1473
1642
  selectTextblockStart: () => Dt,
1474
1643
  setContent: () => kt,
1475
- setMark: () => bn,
1476
- setMeta: () => xn,
1477
- setNode: () => Sn,
1478
- setNodeSelection: () => Cn,
1479
- setTextDirection: () => wn,
1480
- setTextSelection: () => Tn,
1481
- sinkListItem: () => En,
1482
- splitBlock: () => On,
1483
- splitListItem: () => kn,
1484
- toggleList: () => Fn,
1485
- toggleMark: () => In,
1486
- toggleNode: () => Ln,
1487
- toggleWrap: () => Rn,
1488
- undoInputRule: () => zn,
1489
- unsetAllMarks: () => Bn,
1490
- unsetMark: () => Vn,
1491
- unsetTextDirection: () => Hn,
1492
- updateAttributes: () => Un,
1493
- updateDecorations: () => Wn,
1494
- wrapIn: () => Gn,
1495
- wrapInList: () => Kn
1496
- }), q = /* @__PURE__ */ new WeakMap();
1497
- function Jn(e, t) {
1498
- q.set(e, (q.get(e) ?? 0) + 1);
1644
+ setMark: () => An,
1645
+ setMeta: () => jn,
1646
+ setNode: () => Mn,
1647
+ setNodeSelection: () => Nn,
1648
+ setTextDirection: () => Pn,
1649
+ setTextSelection: () => Fn,
1650
+ sinkListItem: () => In,
1651
+ splitBlock: () => Rn,
1652
+ splitListItem: () => zn,
1653
+ toggleList: () => Xn,
1654
+ toggleMark: () => Zn,
1655
+ toggleNode: () => Qn,
1656
+ toggleWrap: () => $n,
1657
+ undoInputRule: () => er,
1658
+ unsetAllMarks: () => tr,
1659
+ unsetMark: () => nr,
1660
+ unsetTextDirection: () => rr,
1661
+ updateAttributes: () => ir,
1662
+ updateDecorations: () => ar,
1663
+ wrapIn: () => or,
1664
+ wrapInList: () => sr
1665
+ }), Y = /* @__PURE__ */ new WeakMap();
1666
+ function lr(e, t) {
1667
+ Y.set(e, (Y.get(e) ?? 0) + 1);
1499
1668
  try {
1500
1669
  return t();
1501
1670
  } finally {
1502
- let t = (q.get(e) ?? 1) - 1;
1503
- t > 0 ? q.set(e, t) : q.delete(e);
1671
+ let t = (Y.get(e) ?? 1) - 1;
1672
+ t > 0 ? Y.set(e, t) : Y.delete(e);
1504
1673
  }
1505
1674
  }
1506
- function Yn(e) {
1507
- return q.has(e);
1675
+ function ur(e) {
1676
+ return Y.has(e);
1508
1677
  }
1509
- var Xn = class {
1678
+ var dr = class {
1510
1679
  constructor() {
1511
1680
  this.callbacks = {};
1512
1681
  }
@@ -1530,44 +1699,44 @@ var Xn = class {
1530
1699
  removeAllListeners() {
1531
1700
  this.callbacks = {};
1532
1701
  }
1533
- }, Zn = typeof process < "u" && process.env.NODE_ENV !== "production";
1534
- function Qn(e) {
1702
+ }, fr = typeof process < "u" && process.env.NODE_ENV !== "production";
1703
+ function pr(e) {
1535
1704
  return e.kind === "widget";
1536
1705
  }
1537
- function $n(e, t) {
1706
+ function mr(e, t) {
1538
1707
  let n = [], r = /* @__PURE__ */ new Set();
1539
- for (let i of e) i.kind === "widget" && Qn(i) && r.add(i.key), n.push(i.toPMDecoration(t));
1708
+ for (let i of e) i.kind === "widget" && pr(i) && r.add(i.key), n.push(i.toPMDecoration(t));
1540
1709
  return {
1541
1710
  decorations: n,
1542
1711
  widgetKeys: r
1543
1712
  };
1544
1713
  }
1545
- function er(e, t, n) {
1546
- let { decorations: r, widgetKeys: i } = $n(t, n);
1714
+ function hr(e, t, n) {
1715
+ let { decorations: r, widgetKeys: i } = mr(t, n);
1547
1716
  return {
1548
- set: T.create(e, r),
1717
+ set: D.create(e, r),
1549
1718
  widgetKeys: i
1550
1719
  };
1551
1720
  }
1552
- function tr({ position: e, from: t, to: n, docSize: r }) {
1721
+ function gr({ position: e, from: t, to: n, docSize: r }) {
1553
1722
  return e < t ? !1 : e < n || e === n && n === r;
1554
1723
  }
1555
- function nr({ decorations: e, from: t, to: n, docSize: r, extensionName: i, warnedExtensions: a }) {
1556
- return e.filter((e) => tr({
1724
+ function _r({ decorations: e, from: t, to: n, docSize: r, extensionName: i, warnedExtensions: a }) {
1725
+ return e.filter((e) => gr({
1557
1726
  position: e.anchor,
1558
1727
  from: t,
1559
1728
  to: n,
1560
1729
  docSize: r
1561
1730
  }) ? !0 : (e.anchor === n || a.has(i) || (a.add(i), console.warn(`[tiptap warn]: Extension "${i}" returned a decoration outside the requested range [${t}, ${n}). It was ignored.`)), !1));
1562
1731
  }
1563
- function rr(e) {
1732
+ function vr(e) {
1564
1733
  let t = e.spec?.key;
1565
1734
  return typeof t == "string" ? t : void 0;
1566
1735
  }
1567
- function ir(e) {
1736
+ function yr(e) {
1568
1737
  let t = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map();
1569
1738
  for (let r of e.find()) {
1570
- let e = rr(r);
1739
+ let e = vr(r);
1571
1740
  if (!e) continue;
1572
1741
  let i = r.spec.extensionName ?? "unknown", a = t.get(e) ?? /* @__PURE__ */ new Set();
1573
1742
  a.add(i), t.set(e, a), n.set(e, (n.get(e) ?? 0) + 1);
@@ -1577,18 +1746,18 @@ function ir(e) {
1577
1746
  extensions: t
1578
1747
  })).filter(({ key: e }) => (n.get(e) ?? 0) > 1);
1579
1748
  }
1580
- function ar(e) {
1749
+ function br(e) {
1581
1750
  return e.jsonID === "attr";
1582
1751
  }
1583
- function or(e) {
1752
+ function xr(e) {
1584
1753
  let t = !1;
1585
1754
  if (e.getMap().forEach(() => {
1586
1755
  t = !0;
1587
- }), t || ar(e)) return !0;
1756
+ }), t || br(e)) return !0;
1588
1757
  let n = e;
1589
1758
  return typeof n.from == "number" && typeof n.to == "number";
1590
1759
  }
1591
- function sr(e, t) {
1760
+ function Sr(e, t) {
1592
1761
  let n = null, r = 0, i = 0;
1593
1762
  for (let a = 0; a < e.childCount && !(i > t.to); a += 1) {
1594
1763
  let o = i + e.child(a).nodeSize;
@@ -1599,11 +1768,11 @@ function sr(e, t) {
1599
1768
  to: r
1600
1769
  };
1601
1770
  }
1602
- function cr(e, t) {
1603
- if (e.steps.some((e) => !or(e))) return { type: "full" };
1604
- let n = nn(e).map(({ newRange: e }) => e);
1771
+ function Cr(e, t) {
1772
+ if (e.steps.some((e) => !xr(e))) return { type: "full" };
1773
+ let n = fn(e).map(({ newRange: e }) => e);
1605
1774
  e.steps.forEach((t, r) => {
1606
- if (!ar(t)) return;
1775
+ if (!br(t)) return;
1607
1776
  let i = e.mapping.slice(r);
1608
1777
  n.push({
1609
1778
  from: i.map(t.pos, -1),
@@ -1612,7 +1781,7 @@ function cr(e, t) {
1612
1781
  });
1613
1782
  let r = [];
1614
1783
  for (let e of n) {
1615
- let n = sr(t, e);
1784
+ let n = Sr(t, e);
1616
1785
  n && r.push(n);
1617
1786
  }
1618
1787
  r.sort((e, t) => e.from - t.from);
@@ -1626,29 +1795,29 @@ function cr(e, t) {
1626
1795
  ranges: i
1627
1796
  };
1628
1797
  }
1629
- function lr(e, t, n, r) {
1798
+ function wr(e, t, n, r) {
1630
1799
  return e.map(t, n, { onRemove: (e) => {
1631
1800
  let t = e?.key;
1632
1801
  typeof t == "string" && r.delete(t);
1633
1802
  } });
1634
1803
  }
1635
- function ur(e, t, n) {
1636
- let r = t.decorationSetsByExtension[e] ?? T.empty, i = new Set(t.widgetKeysByExtension[e] ?? []);
1804
+ function Tr(e, t, n) {
1805
+ let r = t.decorationSetsByExtension[e] ?? D.empty, i = new Set(t.widgetKeysByExtension[e] ?? []);
1637
1806
  return {
1638
- set: lr(r, n.mapping, n.doc, i),
1807
+ set: wr(r, n.mapping, n.doc, i),
1639
1808
  widgetKeys: i
1640
1809
  };
1641
1810
  }
1642
- function dr(e, t) {
1811
+ function Er(e, t) {
1643
1812
  let n = Object.values(t).flatMap((e) => e.find());
1644
- return T.create(e, n);
1813
+ return D.create(e, n);
1645
1814
  }
1646
- function fr(e) {
1815
+ function Dr(e) {
1647
1816
  let t = /* @__PURE__ */ new Set();
1648
1817
  for (let n of Object.values(e)) for (let e of n) t.add(e);
1649
1818
  return t;
1650
1819
  }
1651
- function pr(e, t) {
1820
+ function Or(e, t) {
1652
1821
  switch (t.update ?? "document") {
1653
1822
  case "document":
1654
1823
  if (t.createInRange) throw Error(`[tiptap error]: Extension "${e}" provides createInRange() but does not use the "changedRanges" decoration update strategy.`);
@@ -1663,21 +1832,21 @@ function pr(e, t) {
1663
1832
  default: throw Error(`[tiptap error]: Extension "${e}" uses an unknown decoration update strategy. Expected "document", "changedRanges", or "manual".`);
1664
1833
  }
1665
1834
  }
1666
- function mr(e, t, n) {
1835
+ function kr(e, t, n) {
1667
1836
  return n ? !0 : e.update === "manual" ? !1 : e.shouldUpdate ? e.shouldUpdate(t) : t.tr.docChanged;
1668
1837
  }
1669
- var hr = /* @__PURE__ */ new Set(), gr = class {
1838
+ var Ar = /* @__PURE__ */ new Set(), jr = class {
1670
1839
  constructor(e) {
1671
1840
  this.warnedWidgetKeys = /* @__PURE__ */ new Set(), this.warnedOutOfRangeExtensions = /* @__PURE__ */ new Set(), this.handleBeforeTransaction = ({ nextState: e }) => {
1672
- let t = K.getState(e);
1841
+ let t = J.getState(e);
1673
1842
  t && this.warnDuplicateWidgetKeys(t);
1674
- }, this.editor = e.editor, this.entries = this.resolveEntries(e.entries), this.entries.forEach(({ name: e, spec: t }) => pr(e, t)), this.plugin = this.entries.length > 0 ? this.createPlugin() : null, this.editor.on("beforeTransaction", this.handleBeforeTransaction);
1843
+ }, this.editor = e.editor, this.entries = this.resolveEntries(e.entries), this.entries.forEach(({ name: e, spec: t }) => Or(e, t)), this.plugin = this.entries.length > 0 ? this.createPlugin() : null, this.editor.on("beforeTransaction", this.handleBeforeTransaction);
1675
1844
  }
1676
1845
  destroy() {
1677
1846
  this.editor.off("beforeTransaction", this.handleBeforeTransaction);
1678
1847
  }
1679
1848
  liveWidgetKeys() {
1680
- return K.getState(this.editor.state)?.widgetKeys ?? hr;
1849
+ return J.getState(this.editor.state)?.widgetKeys ?? Ar;
1681
1850
  }
1682
1851
  get mountedView() {
1683
1852
  return this.editor.isDestroyed ? null : this.editor.view;
@@ -1696,7 +1865,7 @@ var hr = /* @__PURE__ */ new Set(), gr = class {
1696
1865
  createPlugin() {
1697
1866
  let { editor: e, entries: t } = this;
1698
1867
  return new r({
1699
- key: K,
1868
+ key: J,
1700
1869
  state: {
1701
1870
  init: (e, n) => {
1702
1871
  let r = {}, i = {};
@@ -1708,22 +1877,22 @@ var hr = /* @__PURE__ */ new Set(), gr = class {
1708
1877
  decorationSetsByExtension: r,
1709
1878
  widgetKeysByExtension: i,
1710
1879
  mergedDecorationSet: this.buildMergedSet(n.doc, r),
1711
- widgetKeys: fr(i)
1880
+ widgetKeys: Dr(i)
1712
1881
  };
1713
1882
  return this.warnDuplicateWidgetKeys(a), a;
1714
1883
  },
1715
1884
  apply: (n, r, i, a) => {
1716
- let o = n.getMeta(K), s = o?.type === "force" && !o.name, c = o?.type === "force" ? o.name : void 0, l = {}, u = {}, d = /* @__PURE__ */ new Set();
1717
- return Jn(e, () => {
1885
+ let o = n.getMeta(J), s = o?.type === "force" && !o.name, c = o?.type === "force" ? o.name : void 0, l = {}, u = {}, d = /* @__PURE__ */ new Set();
1886
+ return lr(e, () => {
1718
1887
  for (let { name: o, spec: f } of t) {
1719
1888
  let t = s || c === o;
1720
- if (!mr(f, {
1889
+ if (!kr(f, {
1721
1890
  editor: e,
1722
1891
  tr: n,
1723
1892
  oldState: i,
1724
1893
  newState: a
1725
1894
  }, t)) {
1726
- let e = ur(o, r, n);
1895
+ let e = Tr(o, r, n);
1727
1896
  l[o] = e.set, u[o] = e.widgetKeys;
1728
1897
  } else if (f.update === "changedRanges" && n.docChanged && !t) {
1729
1898
  let e = this.applyChangedRangesRecompute(o, f, r, n, a);
@@ -1743,34 +1912,34 @@ var hr = /* @__PURE__ */ new Set(), gr = class {
1743
1912
  decorationSetsByExtension: l,
1744
1913
  recomputedNames: d
1745
1914
  }),
1746
- widgetKeys: fr(u)
1915
+ widgetKeys: Dr(u)
1747
1916
  };
1748
1917
  }
1749
1918
  },
1750
1919
  props: { decorations(e) {
1751
- return K.getState(e)?.mergedDecorationSet ?? T.empty;
1920
+ return J.getState(e)?.mergedDecorationSet ?? D.empty;
1752
1921
  } }
1753
1922
  });
1754
1923
  }
1755
1924
  applyChangedRangesRecompute(e, t, n, r, i) {
1756
- let a = cr(r, i.doc);
1925
+ let a = Cr(r, i.doc);
1757
1926
  return a.type === "full" ? this.buildFullSet(e, t, i) : this.rebuildRanges(e, t, n, r, i, a.ranges);
1758
1927
  }
1759
1928
  rebuildRanges(e, t, n, r, i, a) {
1760
- let o = n.decorationSetsByExtension[e] ?? T.empty, s = new Set(n.widgetKeysByExtension[e] ?? []), c = lr(o, r.mapping, r.doc, s), l = i.doc.content.size;
1929
+ let o = n.decorationSetsByExtension[e] ?? D.empty, s = new Set(n.widgetKeysByExtension[e] ?? []), c = wr(o, r.mapping, r.doc, s), l = i.doc.content.size;
1761
1930
  for (let { from: n, to: r } of a) {
1762
- let a = c.find(n, r).filter((e) => tr({
1931
+ let a = c.find(n, r).filter((e) => gr({
1763
1932
  position: e.from,
1764
1933
  from: n,
1765
1934
  to: r,
1766
1935
  docSize: l
1767
1936
  }));
1768
1937
  for (let e of a) {
1769
- let t = rr(e);
1938
+ let t = vr(e);
1770
1939
  t && s.delete(t);
1771
1940
  }
1772
1941
  c = c.remove(a);
1773
- let { decorations: o, widgetKeys: u } = $n(nr({
1942
+ let { decorations: o, widgetKeys: u } = mr(_r({
1774
1943
  decorations: this.runCreate(e, "createInRange", () => t.createInRange({
1775
1944
  editor: this.editor,
1776
1945
  state: i,
@@ -1798,7 +1967,7 @@ var hr = /* @__PURE__ */ new Set(), gr = class {
1798
1967
  state: n,
1799
1968
  view: this.mountedView
1800
1969
  }));
1801
- return er(n.doc, r, e);
1970
+ return hr(n.doc, r, e);
1802
1971
  }
1803
1972
  runCreate(e, t, n) {
1804
1973
  try {
@@ -1808,12 +1977,12 @@ var hr = /* @__PURE__ */ new Set(), gr = class {
1808
1977
  }
1809
1978
  }
1810
1979
  warnDuplicateWidgetKeys(e) {
1811
- if (!Zn) return;
1980
+ if (!fr) return;
1812
1981
  if (e.widgetKeys.size === 0) {
1813
1982
  this.warnedWidgetKeys.clear();
1814
1983
  return;
1815
1984
  }
1816
- let t = ir(e.mergedDecorationSet), n = new Set(t.map(({ key: e }) => e));
1985
+ let t = yr(e.mergedDecorationSet), n = new Set(t.map(({ key: e }) => e));
1817
1986
  for (let { key: e, extensions: n } of t) {
1818
1987
  if (this.warnedWidgetKeys.has(e)) continue;
1819
1988
  let t = Array.from(n).map((e) => `"${e}"`).join(", ");
@@ -1823,13 +1992,13 @@ var hr = /* @__PURE__ */ new Set(), gr = class {
1823
1992
  }
1824
1993
  buildMergedSet(e, t) {
1825
1994
  let n = Object.keys(t);
1826
- return n.length === 1 ? t[n[0]] : dr(e, t);
1995
+ return n.length === 1 ? t[n[0]] : Er(e, t);
1827
1996
  }
1828
1997
  mergeAfterApply({ entries: e, previous: t, tr: n, decorationSetsByExtension: r, recomputedNames: i }) {
1829
- return e.length === 1 ? r[e[0].name] : i.size === 0 ? t.mergedDecorationSet.map(n.mapping, n.doc) : dr(n.doc, r);
1998
+ return e.length === 1 ? r[e[0].name] : i.size === 0 ? t.mergedDecorationSet.map(n.mapping, n.doc) : Er(n.doc, r);
1830
1999
  }
1831
2000
  };
1832
- function _r(e, t) {
2001
+ function Mr(e, t) {
1833
2002
  let { selection: r } = e, { $from: i } = r;
1834
2003
  if (r instanceof n) {
1835
2004
  let e = i.index();
@@ -1843,16 +2012,16 @@ function _r(e, t) {
1843
2012
  }
1844
2013
  return !1;
1845
2014
  }
1846
- function vr(e, t, n) {
2015
+ function Nr(e, t, n) {
1847
2016
  let r = document.querySelector(`style[data-tiptap-style${n ? `-${n}` : ""}]`);
1848
2017
  if (r !== null) return r;
1849
2018
  let i = document.createElement("style");
1850
2019
  return t && i.setAttribute("nonce", t), i.setAttribute(`data-tiptap-style${n ? `-${n}` : ""}`, ""), i.innerHTML = e, document.getElementsByTagName("head")[0].appendChild(i), i;
1851
2020
  }
1852
- function yr(e) {
2021
+ function Pr(e) {
1853
2022
  return e.replace(/[-/\\^$*+?.()|[\]{}]/g, "\\$&");
1854
2023
  }
1855
- function br(e, t) {
2024
+ function Fr(e, t) {
1856
2025
  let n = e.getAttribute("style");
1857
2026
  if (!n) return null;
1858
2027
  let r = n.split(";").map((e) => e.trim()).filter(Boolean), i = t.toLowerCase();
@@ -1862,22 +2031,22 @@ function br(e, t) {
1862
2031
  }
1863
2032
  return null;
1864
2033
  }
1865
- function xr() {
2034
+ function Ir() {
1866
2035
  return typeof navigator < "u" && /Firefox/.test(navigator.userAgent);
1867
2036
  }
1868
- function Sr(e) {
2037
+ function Lr(e) {
1869
2038
  return typeof e == "number";
1870
2039
  }
1871
- function Cr(e) {
2040
+ function Rr(e) {
1872
2041
  return Object.prototype.toString.call(e).slice(8, -1);
1873
2042
  }
1874
- function J(e) {
1875
- return Cr(e) === "Object" && e.constructor === Object && Object.getPrototypeOf(e) === Object.prototype;
2043
+ function X(e) {
2044
+ return Rr(e) === "Object" && e.constructor === Object && Object.getPrototypeOf(e) === Object.prototype;
1876
2045
  }
1877
- function wr(e) {
2046
+ function zr(e) {
1878
2047
  return typeof e == "string" && e.trim().length > 0 && !/[;{}]/.test(e);
1879
2048
  }
1880
- function Tr(e, t, n) {
2049
+ function Br(e, t, n) {
1881
2050
  let r = e.split("\n"), i = [], a = "", o = 0, s = t.baseIndentSize || 2;
1882
2051
  for (; o < r.length;) {
1883
2052
  let e = r[o], u = e.match(t.itemPattern);
@@ -1921,13 +2090,13 @@ function Tr(e, t, n) {
1921
2090
  raw: a
1922
2091
  };
1923
2092
  }
1924
- var Er = 4;
1925
- function Dr(e) {
2093
+ var Vr = 4;
2094
+ function Hr(e) {
1926
2095
  let t = 0;
1927
- for (let n of e) t = n === " " ? t + Er - t % Er : t + 1;
2096
+ for (let n of e) t = n === " " ? t + Vr - t % Vr : t + 1;
1928
2097
  return t;
1929
2098
  }
1930
- function Or(e, t, n, r, i) {
2099
+ function Ur(e, t, n, r, i) {
1931
2100
  if (!e || !Array.isArray(e.content)) return "";
1932
2101
  let a = typeof n == "function" ? n(r) : n, [o, ...s] = e.content, c = `${a}${t.renderChildren([o])}`;
1933
2102
  return s && s.length > 0 && s.forEach((e, n) => {
@@ -1935,20 +2104,20 @@ function Or(e, t, n, r, i) {
1935
2104
  if (r != null) {
1936
2105
  let n = (e) => {
1937
2106
  if (!i?.alignNestedToPrefix) return t.indent(e);
1938
- let n = t.indent(""), r = Dr(a);
1939
- return (Dr(n) >= r ? n : " ".repeat(r)) + e;
2107
+ let n = t.indent(""), r = Hr(a);
2108
+ return (Hr(n) >= r ? n : " ".repeat(r)) + e;
1940
2109
  }, o = r.split("\n").map((e) => n(e || "")).join("\n");
1941
2110
  c += e.type === "paragraph" ? `\n\n${o}` : `\n${o}`;
1942
2111
  }
1943
2112
  }), c;
1944
2113
  }
1945
- function kr(e, t) {
2114
+ function Wr(e, t) {
1946
2115
  let n = { ...e };
1947
- return J(e) && J(t) && Object.keys(t).forEach((r) => {
1948
- J(t[r]) && J(e[r]) ? n[r] = kr(e[r], t[r]) : n[r] = t[r];
2116
+ return X(e) && X(t) && Object.keys(t).forEach((r) => {
2117
+ X(t[r]) && X(e[r]) ? n[r] = Wr(e[r], t[r]) : n[r] = t[r];
1949
2118
  }), n;
1950
2119
  }
1951
- function Ar(e, t, n = {}) {
2120
+ function Gr(e, t, n = {}) {
1952
2121
  let { state: r } = t, { doc: i, tr: a } = r, o = e;
1953
2122
  i.descendants((t, r) => {
1954
2123
  let i = a.mapping.map(r), s = a.mapping.map(r) + t.nodeSize, c = null;
@@ -1968,18 +2137,18 @@ function Ar(e, t, n = {}) {
1968
2137
  }
1969
2138
  }), a.docChanged && t.view.dispatch(a);
1970
2139
  }
1971
- var Y = class {
2140
+ var Z = class {
1972
2141
  constructor(e) {
1973
2142
  this.find = e.find, this.handler = e.handler, this.undoable = e.undoable ?? !0;
1974
2143
  }
1975
- }, jr = (e, t) => {
1976
- if (Le(t)) return t.exec(e);
2144
+ }, Kr = (e, t) => {
2145
+ if (Ie(t)) return t.exec(e);
1977
2146
  let n = t(e);
1978
2147
  if (!n) return null;
1979
2148
  let r = [n.text];
1980
2149
  return r.index = n.index, r.input = e, r.data = n.data, n.replaceWith && (n.text.includes(n.replaceWith) || console.warn("[tiptap warn]: \"inputRuleMatch.replaceWith\" must be part of \"inputRuleMatch.text\"."), r.push(n.replaceWith)), r;
1981
2150
  };
1982
- function Mr(e) {
2151
+ function qr(e) {
1983
2152
  let { editor: n, from: r, to: i, text: a, insertText: o } = e;
1984
2153
  if (!o) return {
1985
2154
  inputTransaction: null,
@@ -1995,20 +2164,20 @@ function Mr(e) {
1995
2164
  }).tr
1996
2165
  };
1997
2166
  }
1998
- function Nr(e) {
1999
- let { editor: t, from: n, to: r, text: i, rule: a, match: o, plugin: s, insertText: c } = e, { view: l } = t, { inputTransaction: u, tr: d } = Mr({
2167
+ function Jr(e) {
2168
+ let { editor: t, from: n, to: r, text: i, rule: a, match: o, plugin: s, insertText: c } = e, { view: l } = t, { inputTransaction: u, tr: d } = qr({
2000
2169
  editor: t,
2001
2170
  from: n,
2002
2171
  to: r,
2003
2172
  text: i,
2004
2173
  insertText: c
2005
- }), f = u ? n + i.length : r, p = E({
2174
+ }), f = u ? n + i.length : r, p = be({
2006
2175
  state: l.state,
2007
2176
  transaction: d
2008
2177
  }), m = {
2009
2178
  from: n - (o[0].length - i.length),
2010
2179
  to: f
2011
- }, { commands: h, chain: g, can: _ } = new D({
2180
+ }, { commands: h, chain: g, can: _ } = new O({
2012
2181
  editor: t,
2013
2182
  state: p
2014
2183
  });
@@ -2019,28 +2188,28 @@ function Nr(e) {
2019
2188
  commands: h,
2020
2189
  chain: g,
2021
2190
  can: _
2022
- }) === null || !d.steps.length ? !1 : (u && (l.dispatch(u), !l.state.doc.eq(u.doc)) || (ye(d), d.setMeta("inputRule", !0), a.undoable && d.setMeta(s, {
2191
+ }) === null || !d.steps.length ? !1 : (u && (l.dispatch(u), !l.state.doc.eq(u.doc)) || (_e(d), d.setMeta("inputRule", !0), a.undoable && d.setMeta(s, {
2023
2192
  transform: d,
2024
2193
  from: n,
2025
2194
  to: f,
2026
2195
  text: i
2027
2196
  }), l.dispatch(d)), !0);
2028
2197
  }
2029
- function Pr(e, t, n) {
2198
+ function Yr(e, t, n) {
2030
2199
  let r = t[0].length - n.length;
2031
2200
  if (r <= 0) return !0;
2032
2201
  let i = e.parentOffset - r;
2033
2202
  return i >= 0 && e.parent.textBetween(i, e.parentOffset) === t[0].slice(0, r);
2034
2203
  }
2035
- function X(e) {
2204
+ function Xr(e) {
2036
2205
  let { editor: t, from: n, to: r, text: i, rules: a, plugin: o, insertText: s } = e, { view: c } = t;
2037
2206
  if (c.composing) return !1;
2038
2207
  let l = c.state.doc.resolve(n);
2039
2208
  if (l.parent.type.spec.code || (l.nodeBefore || l.nodeAfter)?.marks.find((e) => e.type.spec.code)) return !1;
2040
- let u = sn(l) + i;
2209
+ let u = gn(l) + i;
2041
2210
  for (let e of a) {
2042
- let a = jr(u, e.find);
2043
- if (a && Pr(l, a, i) && Nr({
2211
+ let a = Kr(u, e.find);
2212
+ if (a && Yr(l, a, i) && Jr({
2044
2213
  editor: t,
2045
2214
  from: n,
2046
2215
  to: r,
@@ -2053,7 +2222,7 @@ function X(e) {
2053
2222
  }
2054
2223
  return !1;
2055
2224
  }
2056
- function Fr(e) {
2225
+ function Zr(e) {
2057
2226
  let { editor: t, rules: n } = e, i = new r({
2058
2227
  state: {
2059
2228
  init() {
@@ -2065,9 +2234,9 @@ function Fr(e) {
2065
2234
  let s = e.getMeta("applyInputRules");
2066
2235
  return s && setTimeout(() => {
2067
2236
  let { text: e } = s;
2068
- e = typeof e == "string" ? e : Ft(w.from(e), a.schema);
2237
+ e = typeof e == "string" ? e : It(T.from(e), a.schema);
2069
2238
  let { from: r } = s, o = r + e.length;
2070
- X({
2239
+ Xr({
2071
2240
  editor: t,
2072
2241
  from: r,
2073
2242
  to: o,
@@ -2080,7 +2249,7 @@ function Fr(e) {
2080
2249
  },
2081
2250
  props: {
2082
2251
  handleTextInput(e, r, a, o) {
2083
- return X({
2252
+ return Xr({
2084
2253
  editor: t,
2085
2254
  from: r,
2086
2255
  to: a,
@@ -2092,7 +2261,7 @@ function Fr(e) {
2092
2261
  },
2093
2262
  handleDOMEvents: { compositionend: (e) => (setTimeout(() => {
2094
2263
  let { $cursor: r } = e.state.selection;
2095
- r && X({
2264
+ r && Xr({
2096
2265
  editor: t,
2097
2266
  from: r.pos,
2098
2267
  to: r.pos,
@@ -2104,7 +2273,7 @@ function Fr(e) {
2104
2273
  handleKeyDown(e, r) {
2105
2274
  if (r.key !== "Enter") return !1;
2106
2275
  let { $cursor: a } = e.state.selection;
2107
- return a ? X({
2276
+ return a ? Xr({
2108
2277
  editor: t,
2109
2278
  from: a.pos,
2110
2279
  to: a.pos,
@@ -2118,7 +2287,7 @@ function Fr(e) {
2118
2287
  });
2119
2288
  return i;
2120
2289
  }
2121
- var Ir = class {
2290
+ var Qr = class {
2122
2291
  constructor(e = {}) {
2123
2292
  this.type = "extendable", this.parent = null, this.child = null, this.name = "", this.config = { name: this.name }, this.config = {
2124
2293
  ...this.config,
@@ -2126,10 +2295,10 @@ var Ir = class {
2126
2295
  }, this.name = this.config.name;
2127
2296
  }
2128
2297
  get options() {
2129
- return { ...z(R(this, "addOptions", { name: this.name })) };
2298
+ return { ...z(L(this, "addOptions", { name: this.name })) };
2130
2299
  }
2131
2300
  get storage() {
2132
- return { ...z(R(this, "addStorage", {
2301
+ return { ...z(L(this, "addStorage", {
2133
2302
  name: this.name,
2134
2303
  options: this.options
2135
2304
  })) };
@@ -2137,7 +2306,7 @@ var Ir = class {
2137
2306
  configure(e = {}) {
2138
2307
  let t = this.extend({
2139
2308
  ...this.config,
2140
- addOptions: () => kr(this.options, e)
2309
+ addOptions: () => Wr(this.options, e)
2141
2310
  });
2142
2311
  return t.name = this.name, t.parent = this.parent, this.child = null, t;
2143
2312
  }
@@ -2148,7 +2317,7 @@ var Ir = class {
2148
2317
  });
2149
2318
  return t.parent = this, this.child = t, t.name = "name" in e ? e.name : t.parent.name, t;
2150
2319
  }
2151
- }, Lr = class e extends Ir {
2320
+ }, $r = class e extends Qr {
2152
2321
  constructor(...e) {
2153
2322
  super(...e), this.type = "mark";
2154
2323
  }
@@ -2173,20 +2342,20 @@ var Ir = class {
2173
2342
  let t = typeof e == "function" ? e() : e;
2174
2343
  return super.extend(t);
2175
2344
  }
2176
- }, Rr = class {
2345
+ }, ei = class {
2177
2346
  constructor(e) {
2178
2347
  this.find = e.find, this.handler = e.handler;
2179
2348
  }
2180
- }, zr = (e, t, n) => {
2181
- if (Le(t)) return [...e.matchAll(t)];
2349
+ }, ti = (e, t, n) => {
2350
+ if (Ie(t)) return [...e.matchAll(t)];
2182
2351
  let r = t(e, n);
2183
2352
  return r ? r.map((t) => {
2184
2353
  let n = [t.text];
2185
2354
  return n.index = t.index, n.input = e, n.data = t.data, t.replaceWith && (t.text.includes(t.replaceWith) || console.warn("[tiptap warn]: \"pasteRuleMatch.replaceWith\" must be part of \"pasteRuleMatch.text\"."), n.push(t.replaceWith)), n;
2186
2355
  }) : [];
2187
2356
  };
2188
- function Br(e) {
2189
- let { editor: t, state: n, from: r, to: i, rule: a, pasteEvent: o, dropEvent: s } = e, { commands: c, chain: l, can: u } = new D({
2357
+ function ni(e) {
2358
+ let { editor: t, state: n, from: r, to: i, rule: a, pasteEvent: o, dropEvent: s } = e, { commands: c, chain: l, can: u } = new O({
2190
2359
  editor: t,
2191
2360
  state: n
2192
2361
  }), d = [];
@@ -2194,7 +2363,7 @@ function Br(e) {
2194
2363
  var f;
2195
2364
  if ((f = e.type) != null && (f = f.spec) != null && f.code || !(e.isText || e.isTextblock || e.isInline)) return;
2196
2365
  let p = e.content?.size ?? e.nodeSize ?? 0, m = Math.max(r, t), h = Math.min(i, t + p);
2197
- m >= h || zr(e.isText ? e.text || "" : e.textBetween(m - t, h - t, void 0, ""), a.find, o).forEach((e) => {
2366
+ m >= h || ti(e.isText ? e.text || "" : e.textBetween(m - t, h - t, void 0, ""), a.find, o).forEach((e) => {
2198
2367
  if (e.index === void 0) return;
2199
2368
  let t = m + e.index + 1, r = t + e[0].length, i = {
2200
2369
  from: n.tr.mapping.map(t),
@@ -2213,12 +2382,12 @@ function Br(e) {
2213
2382
  });
2214
2383
  }), d.every((e) => e !== null);
2215
2384
  }
2216
- var Z = null, Vr = (e) => {
2385
+ var Q = null, ri = (e) => {
2217
2386
  var t;
2218
2387
  let n = new ClipboardEvent("paste", { clipboardData: new DataTransfer() });
2219
2388
  return (t = n.clipboardData) == null || t.setData("text/html", e), n;
2220
2389
  };
2221
- function Hr(e) {
2390
+ function ii(e) {
2222
2391
  let { editor: t, rules: n } = e, i = null, a = !1, o = !1, s = typeof ClipboardEvent < "u" ? new ClipboardEvent("paste") : null, c;
2223
2392
  try {
2224
2393
  c = typeof DragEvent < "u" ? new DragEvent("drop") : null;
@@ -2226,11 +2395,11 @@ function Hr(e) {
2226
2395
  c = null;
2227
2396
  }
2228
2397
  let l = ({ state: e, from: n, to: r, rule: i, pasteEvt: a }) => {
2229
- let o = e.tr, l = E({
2398
+ let o = e.tr, l = be({
2230
2399
  state: e,
2231
2400
  transaction: o
2232
2401
  });
2233
- if (Br({
2402
+ if (ni({
2234
2403
  editor: t,
2235
2404
  state: l,
2236
2405
  from: Math.max(n - 1, 0),
@@ -2248,13 +2417,13 @@ function Hr(e) {
2248
2417
  }
2249
2418
  };
2250
2419
  return t.on("destroy", () => {
2251
- Z === t && (Z = null);
2420
+ Q === t && (Q = null);
2252
2421
  }), n.map((e) => new r({
2253
2422
  view(e) {
2254
2423
  let n = (n) => {
2255
- i = e.dom.parentElement?.contains(n.target) ? e.dom.parentElement : null, i && (Z = t);
2424
+ i = e.dom.parentElement?.contains(n.target) ? e.dom.parentElement : null, i && (Q = t);
2256
2425
  }, r = () => {
2257
- Z &&= null;
2426
+ Q &&= null;
2258
2427
  };
2259
2428
  return window.addEventListener("dragstart", n), window.addEventListener("dragend", r), { destroy() {
2260
2429
  window.removeEventListener("dragstart", n), window.removeEventListener("dragend", r);
@@ -2263,7 +2432,7 @@ function Hr(e) {
2263
2432
  props: { handleDOMEvents: {
2264
2433
  drop: (e, t) => {
2265
2434
  if (o = i === e.dom.parentElement, c = t, !o) {
2266
- let e = Z;
2435
+ let e = Q;
2267
2436
  e?.isEditable && setTimeout(() => {
2268
2437
  if (e.isDestroyed) return;
2269
2438
  let t = e.state.selection;
@@ -2285,8 +2454,8 @@ function Hr(e) {
2285
2454
  if (!c && !u && !f) return;
2286
2455
  if (f) {
2287
2456
  let { text: t } = d;
2288
- t = typeof t == "string" ? t : Ft(w.from(t), r.schema);
2289
- let { from: n } = d, i = n + t.length, a = Vr(t);
2457
+ t = typeof t == "string" ? t : It(T.from(t), r.schema);
2458
+ let { from: n } = d, i = n + t.length, a = ri(t);
2290
2459
  return l({
2291
2460
  rule: e,
2292
2461
  state: r,
@@ -2296,7 +2465,7 @@ function Hr(e) {
2296
2465
  });
2297
2466
  }
2298
2467
  let p = n.doc.content.findDiffStart(r.doc.content), m = n.doc.content.findDiffEnd(r.doc.content);
2299
- if (Sr(p) && m && p !== m.b) return l({
2468
+ if (Lr(p) && m && p !== m.b) return l({
2300
2469
  rule: e,
2301
2470
  state: r,
2302
2471
  from: p,
@@ -2306,18 +2475,18 @@ function Hr(e) {
2306
2475
  }
2307
2476
  }));
2308
2477
  }
2309
- var Q = class {
2478
+ var ai = class {
2310
2479
  constructor(e, t) {
2311
- this.splittableMarks = [], this.nonClearableMarks = [], this.decorationManager = null, this.editor = t, this.baseExtensions = e, this.extensions = Jt(e), this.schema = Kt(this.extensions, t), this.setupExtensions();
2480
+ this.splittableMarks = [], this.nonClearableMarks = [], this.decorationManager = null, this.editor = t, this.baseExtensions = e, this.extensions = rn(e), this.hasSchemaSpec = t.options.schemaSpec !== void 0, this.schema = nn(this.extensions, t, t.options.schemaSpec), this.setupExtensions();
2312
2481
  }
2313
2482
  get commands() {
2314
2483
  return this.extensions.reduce((e, t) => {
2315
- let n = R(t, "addCommands", {
2484
+ let n = L(t, "addCommands", {
2316
2485
  name: t.name,
2317
2486
  options: t.options,
2318
2487
  storage: this.editor.extensionStorage[t.name],
2319
2488
  editor: this.editor,
2320
- type: U(t.name, this.schema)
2489
+ type: H(t.name, this.schema)
2321
2490
  });
2322
2491
  return n ? {
2323
2492
  ...e,
@@ -2326,15 +2495,15 @@ var Q = class {
2326
2495
  }, {});
2327
2496
  }
2328
2497
  get plugins() {
2329
- let { editor: e } = this, t = H([...this.extensions].reverse()).flatMap((t) => {
2498
+ let { editor: e } = this, t = V([...this.extensions].reverse()).flatMap((t) => {
2330
2499
  let n = {
2331
2500
  name: t.name,
2332
2501
  options: t.options,
2333
2502
  storage: this.editor.extensionStorage[t.name],
2334
2503
  editor: e,
2335
- type: U(t.name, this.schema)
2336
- }, r = [], i = R(t, "addKeyboardShortcuts", n), a = {};
2337
- if (t.type === "mark" && R(t, "exitable", n) && (a.ArrowRight = () => Lr.handleExit({
2504
+ type: H(t.name, this.schema)
2505
+ }, r = [], i = L(t, "addKeyboardShortcuts", n), a = {};
2506
+ if (t.type === "mark" && L(t, "exitable", n) && (a.ArrowRight = () => $r.handleExit({
2338
2507
  editor: e,
2339
2508
  mark: t
2340
2509
  })), i) {
@@ -2344,31 +2513,31 @@ var Q = class {
2344
2513
  ...t
2345
2514
  };
2346
2515
  }
2347
- let o = ve(a);
2516
+ let o = ge(a);
2348
2517
  r.push(o);
2349
- let s = R(t, "addInputRules", n);
2350
- if (fn(t, e.options.enableInputRules) && s) {
2518
+ let s = L(t, "addInputRules", n);
2519
+ if (xn(t, e.options.enableInputRules) && s) {
2351
2520
  let t = s();
2352
2521
  if (t && t.length) {
2353
- let n = Fr({
2522
+ let n = Zr({
2354
2523
  editor: e,
2355
2524
  rules: t
2356
2525
  }), i = Array.isArray(n) ? n : [n];
2357
2526
  r.push(...i);
2358
2527
  }
2359
2528
  }
2360
- let c = R(t, "addPasteRules", n);
2361
- if (fn(t, e.options.enablePasteRules) && c) {
2529
+ let c = L(t, "addPasteRules", n);
2530
+ if (xn(t, e.options.enablePasteRules) && c) {
2362
2531
  let t = c();
2363
2532
  if (t && t.length) {
2364
- let n = Hr({
2533
+ let n = ii({
2365
2534
  editor: e,
2366
2535
  rules: t
2367
2536
  });
2368
2537
  r.push(...n);
2369
2538
  }
2370
2539
  }
2371
- let l = R(t, "addProseMirrorPlugins", n);
2540
+ let l = L(t, "addProseMirrorPlugins", n);
2372
2541
  if (l) {
2373
2542
  let e = l();
2374
2543
  r.push(...e);
@@ -2383,39 +2552,40 @@ var Q = class {
2383
2552
  (e = this.decorationManager) == null || e.destroy();
2384
2553
  let n = [];
2385
2554
  return this.extensions.forEach((e) => {
2386
- let r = R(e, "addDecorations", {
2555
+ let r = L(e, "addDecorations", {
2387
2556
  name: e.name,
2388
2557
  options: e.options,
2389
2558
  storage: this.editor.extensionStorage[e.name],
2390
2559
  editor: t,
2391
- type: U(e.name, this.schema)
2560
+ type: H(e.name, this.schema)
2392
2561
  });
2393
2562
  r && n.push({
2394
2563
  name: e.name,
2395
2564
  addDecorations: r
2396
2565
  });
2397
- }), this.decorationManager = new gr({
2566
+ }), this.decorationManager = new jr({
2398
2567
  editor: t,
2399
2568
  entries: n
2400
2569
  }), this.decorationManager.plugin;
2401
2570
  }
2402
2571
  get attributes() {
2403
- return Rt(this.extensions);
2572
+ let e = Gt(this.extensions);
2573
+ return this.hasSchemaSpec ? Lt(e, this.schema) : e;
2404
2574
  }
2405
2575
  get nodeViews() {
2406
- let { editor: e } = this, { nodeExtensions: t } = B(this.extensions);
2407
- return Object.fromEntries(t.filter((e) => !!R(e, "addNodeView")).map((t) => {
2408
- let n = this.attributes.filter((e) => e.type === t.name), r = R(t, "addNodeView", {
2576
+ let { editor: e } = this, { nodeExtensions: t } = R(this.extensions);
2577
+ return Object.fromEntries(t.filter((e) => !!L(e, "addNodeView")).map((t) => {
2578
+ let n = this.attributes.filter((e) => e.type === t.name), r = L(t, "addNodeView", {
2409
2579
  name: t.name,
2410
2580
  options: t.options,
2411
2581
  storage: this.editor.extensionStorage[t.name],
2412
2582
  editor: e,
2413
- type: O(t.name, this.schema)
2583
+ type: k(t.name, this.schema)
2414
2584
  });
2415
2585
  if (!r) return [];
2416
2586
  let i = r();
2417
2587
  return i ? [t.name, (r, a, o, s, c) => {
2418
- let l = V(r, n);
2588
+ let l = B(r, n);
2419
2589
  return i({
2420
2590
  node: r,
2421
2591
  view: a,
@@ -2431,14 +2601,14 @@ var Q = class {
2431
2601
  }
2432
2602
  dispatchTransaction(e) {
2433
2603
  let { editor: t } = this;
2434
- return H([...this.extensions].reverse()).reduceRight((e, n) => {
2604
+ return V([...this.extensions].reverse()).reduceRight((e, n) => {
2435
2605
  let r = {
2436
2606
  name: n.name,
2437
2607
  options: n.options,
2438
2608
  storage: this.editor.extensionStorage[n.name],
2439
2609
  editor: t,
2440
- type: U(n.name, this.schema)
2441
- }, i = R(n, "dispatchTransaction", r);
2610
+ type: H(n.name, this.schema)
2611
+ }, i = L(n, "dispatchTransaction", r);
2442
2612
  return i ? (t) => {
2443
2613
  i.call(r, {
2444
2614
  transaction: t,
@@ -2449,14 +2619,14 @@ var Q = class {
2449
2619
  }
2450
2620
  transformPastedHTML(e) {
2451
2621
  let { editor: t } = this;
2452
- return H([...this.extensions]).reduce((e, n) => {
2622
+ return V([...this.extensions]).reduce((e, n) => {
2453
2623
  let r = {
2454
2624
  name: n.name,
2455
2625
  options: n.options,
2456
2626
  storage: this.editor.extensionStorage[n.name],
2457
2627
  editor: t,
2458
- type: U(n.name, this.schema)
2459
- }, i = R(n, "transformPastedHTML", r);
2628
+ type: H(n.name, this.schema)
2629
+ }, i = L(n, "transformPastedHTML", r);
2460
2630
  return i ? (t, n) => {
2461
2631
  let a = e(t, n);
2462
2632
  return i.call(r, a);
@@ -2464,17 +2634,17 @@ var Q = class {
2464
2634
  }, e || ((e) => e));
2465
2635
  }
2466
2636
  get markViews() {
2467
- let { editor: e } = this, { markExtensions: t } = B(this.extensions);
2468
- return Object.fromEntries(t.filter((e) => !!R(e, "addMarkView")).map((t) => {
2469
- let n = this.attributes.filter((e) => e.type === t.name), r = R(t, "addMarkView", {
2637
+ let { editor: e } = this, { markExtensions: t } = R(this.extensions);
2638
+ return Object.fromEntries(t.filter((e) => !!L(e, "addMarkView")).map((t) => {
2639
+ let n = this.attributes.filter((e) => e.type === t.name), r = L(t, "addMarkView", {
2470
2640
  name: t.name,
2471
2641
  options: t.options,
2472
2642
  storage: this.editor.extensionStorage[t.name],
2473
2643
  editor: e,
2474
- type: A(t.name, this.schema)
2644
+ type: j(t.name, this.schema)
2475
2645
  });
2476
2646
  return r ? [t.name, (i, a, o) => {
2477
- let s = V(i, n);
2647
+ let s = B(i, n);
2478
2648
  return r()({
2479
2649
  mark: i,
2480
2650
  view: a,
@@ -2483,7 +2653,7 @@ var Q = class {
2483
2653
  extension: t,
2484
2654
  HTMLAttributes: s,
2485
2655
  updateAttributes: (t) => {
2486
- Ar(i, e, t);
2656
+ Gr(i, e, t);
2487
2657
  }
2488
2658
  });
2489
2659
  }] : [];
@@ -2507,16 +2677,16 @@ var Q = class {
2507
2677
  options: e.options,
2508
2678
  storage: this.editor.extensionStorage[e.name],
2509
2679
  editor: this.editor,
2510
- type: U(e.name, this.schema)
2680
+ type: H(e.name, this.schema)
2511
2681
  };
2512
- e.type === "mark" && ((z(R(e, "keepOnSplit", t)) ?? !0) && this.splittableMarks.push(e.name), (z(R(e, "clearable", t)) ?? !0) || this.nonClearableMarks.push(e.name));
2513
- let n = R(e, "onBeforeCreate", t), r = R(e, "onCreate", t), i = R(e, "onUpdate", t), a = R(e, "onSelectionUpdate", t), o = R(e, "onTransaction", t), s = R(e, "onFocus", t), c = R(e, "onBlur", t), l = R(e, "onDestroy", t);
2682
+ e.type === "mark" && ((z(L(e, "keepOnSplit", t)) ?? !0) && this.splittableMarks.push(e.name), (z(L(e, "clearable", t)) ?? !0) || this.nonClearableMarks.push(e.name));
2683
+ let n = L(e, "onBeforeCreate", t), r = L(e, "onCreate", t), i = L(e, "onUpdate", t), a = L(e, "onSelectionUpdate", t), o = L(e, "onTransaction", t), s = L(e, "onFocus", t), c = L(e, "onBlur", t), l = L(e, "onDestroy", t);
2514
2684
  n && this.editor.on("beforeCreate", n), r && this.editor.on("create", r), i && this.editor.on("update", i), a && this.editor.on("selectionUpdate", a), o && this.editor.on("transaction", o), s && this.editor.on("focus", s), c && this.editor.on("blur", c), l && this.editor.on("destroy", l);
2515
2685
  });
2516
2686
  }
2517
2687
  };
2518
- Q.resolve = Jt, Q.sort = H, Q.flatten = Pt;
2519
- var $ = class e extends Ir {
2688
+ ai.resolve = rn, ai.sort = V, ai.flatten = Ft;
2689
+ var $ = class e extends Qr {
2520
2690
  constructor(...e) {
2521
2691
  super(...e), this.type = "extension";
2522
2692
  }
@@ -2531,7 +2701,7 @@ var $ = class e extends Ir {
2531
2701
  let t = typeof e == "function" ? e() : e;
2532
2702
  return super.extend(t);
2533
2703
  }
2534
- }, Ur = $.create({
2704
+ }, oi = $.create({
2535
2705
  name: "clipboardTextSerializer",
2536
2706
  addOptions() {
2537
2707
  return { blockSeparator: void 0 };
@@ -2540,23 +2710,23 @@ var $ = class e extends Ir {
2540
2710
  return [new r({
2541
2711
  key: new i("clipboardTextSerializer"),
2542
2712
  props: { clipboardTextSerializer: () => {
2543
- let { editor: e } = this, { state: t, schema: n } = e, { doc: r, selection: i } = t, a = Zt(n), { blockSeparator: o } = this.options, s = {
2713
+ let { editor: e } = this, { state: t, schema: n } = e, { doc: r, selection: i } = t, a = sn(n), { blockSeparator: o } = this.options, s = {
2544
2714
  ...o === void 0 ? {} : { blockSeparator: o },
2545
2715
  textSerializers: a
2546
2716
  };
2547
- return [...i.ranges].sort((e, t) => e.$from.pos - t.$from.pos).map(({ $from: e, $to: t }) => Yt(r, {
2717
+ return [...i.ranges].sort((e, t) => e.$from.pos - t.$from.pos).map(({ $from: e, $to: t }) => an(r, {
2548
2718
  from: e.pos,
2549
2719
  to: t.pos
2550
2720
  }, s)).join(o ?? "\n\n");
2551
2721
  } }
2552
2722
  })];
2553
2723
  }
2554
- }), Wr = $.create({
2724
+ }), si = $.create({
2555
2725
  name: "commands",
2556
2726
  addCommands() {
2557
- return { ...qn };
2727
+ return { ...cr };
2558
2728
  }
2559
- }), Gr = $.create({
2729
+ }), ci = $.create({
2560
2730
  name: "delete",
2561
2731
  onUpdate({ transaction: e, appendedTransactions: t }) {
2562
2732
  var n;
@@ -2564,7 +2734,7 @@ var $ = class e extends Ir {
2564
2734
  var n, r;
2565
2735
  if (((n = this.editor.options.coreExtensionOptions) == null || (n = n.delete) == null || (r = n.filterTransaction) == null ? void 0 : r.call(n, e)) ?? e.getMeta("y-sync$")) return;
2566
2736
  let i = jt(e.before, [e, ...t]);
2567
- nn(i).forEach((t) => {
2737
+ fn(i).forEach((t) => {
2568
2738
  i.mapping.mapResult(t.oldRange.from).deletedAfter && i.mapping.mapResult(t.oldRange.to).deletedBefore && i.before.nodesBetween(t.oldRange.from, t.oldRange.to, (n, r) => {
2569
2739
  let a = r + n.nodeSize - 2, o = t.oldRange.from <= r && a <= t.oldRange.to;
2570
2740
  this.editor.emit("delete", {
@@ -2610,7 +2780,7 @@ var $ = class e extends Ir {
2610
2780
  };
2611
2781
  ((n = this.editor.options.coreExtensionOptions) == null || (n = n.delete) == null ? void 0 : n.async) ?? !0 ? setTimeout(r, 0) : r();
2612
2782
  }
2613
- }), Kr = $.create({
2783
+ }), li = $.create({
2614
2784
  name: "drop",
2615
2785
  addProseMirrorPlugins() {
2616
2786
  return [new r({
@@ -2625,7 +2795,7 @@ var $ = class e extends Ir {
2625
2795
  } }
2626
2796
  })];
2627
2797
  }
2628
- }), qr = $.create({
2798
+ }), ui = $.create({
2629
2799
  name: "editable",
2630
2800
  addProseMirrorPlugins() {
2631
2801
  return [new r({
@@ -2633,12 +2803,12 @@ var $ = class e extends Ir {
2633
2803
  props: { editable: () => this.editor.options.editable }
2634
2804
  })];
2635
2805
  }
2636
- }), Jr = new i("focusEvents"), Yr = $.create({
2806
+ }), di = new i("focusEvents"), fi = $.create({
2637
2807
  name: "focusEvents",
2638
2808
  addProseMirrorPlugins() {
2639
2809
  let { editor: e } = this;
2640
2810
  return [new r({
2641
- key: Jr,
2811
+ key: di,
2642
2812
  props: { handleDOMEvents: {
2643
2813
  focus: (t, n) => {
2644
2814
  e.isFocused = !0;
@@ -2653,7 +2823,7 @@ var $ = class e extends Ir {
2653
2823
  } }
2654
2824
  })];
2655
2825
  }
2656
- }), Xr = $.create({
2826
+ }), pi = $.create({
2657
2827
  name: "keymap",
2658
2828
  addKeyboardShortcuts() {
2659
2829
  let e = () => this.editor.commands.first(({ commands: e }) => [
@@ -2695,7 +2865,7 @@ var $ = class e extends Ir {
2695
2865
  "Ctrl-a": () => this.editor.commands.selectTextblockStart(),
2696
2866
  "Ctrl-e": () => this.editor.commands.selectTextblockEnd()
2697
2867
  };
2698
- return M() || ft() ? i : r;
2868
+ return N() || dt() ? i : r;
2699
2869
  },
2700
2870
  addProseMirrorPlugins() {
2701
2871
  return [new r({
@@ -2706,10 +2876,10 @@ var $ = class e extends Ir {
2706
2876
  if (!r || i) return;
2707
2877
  let { empty: o, from: s, to: c } = t.selection, l = a.atStart(t.doc).from, u = a.atEnd(t.doc).to;
2708
2878
  if (o || s !== l || c !== u || !G(n.doc)) return;
2709
- let d = n.tr, f = E({
2879
+ let d = n.tr, f = be({
2710
2880
  state: n,
2711
2881
  transaction: d
2712
- }), { commands: p } = new D({
2882
+ }), { commands: p } = new O({
2713
2883
  editor: this.editor,
2714
2884
  state: f
2715
2885
  });
@@ -2717,7 +2887,7 @@ var $ = class e extends Ir {
2717
2887
  }
2718
2888
  })];
2719
2889
  }
2720
- }), Zr = $.create({
2890
+ }), mi = $.create({
2721
2891
  name: "paste",
2722
2892
  addProseMirrorPlugins() {
2723
2893
  return [new r({
@@ -2731,7 +2901,7 @@ var $ = class e extends Ir {
2731
2901
  } }
2732
2902
  })];
2733
2903
  }
2734
- }), Qr = $.create({
2904
+ }), hi = $.create({
2735
2905
  name: "tabindex",
2736
2906
  addOptions() {
2737
2907
  return { value: void 0 };
@@ -2742,14 +2912,14 @@ var $ = class e extends Ir {
2742
2912
  props: { attributes: () => !this.editor.isEditable && this.options.value === void 0 ? {} : { tabindex: this.options.value ?? "0" } }
2743
2913
  })];
2744
2914
  }
2745
- }), $r = $.create({
2915
+ }), gi = $.create({
2746
2916
  name: "textDirection",
2747
2917
  addOptions() {
2748
2918
  return { direction: void 0 };
2749
2919
  },
2750
2920
  addGlobalAttributes() {
2751
2921
  if (!this.options.direction) return [];
2752
- let { nodeExtensions: e } = B(this.extensions);
2922
+ let { nodeExtensions: e } = R(this.extensions);
2753
2923
  return [{
2754
2924
  types: e.filter((e) => e.name !== "text").map((e) => e.name),
2755
2925
  attributes: { dir: {
@@ -2771,22 +2941,24 @@ var $ = class e extends Ir {
2771
2941
  } }
2772
2942
  })];
2773
2943
  }
2774
- }), ei = !1;
2775
- function ti(e) {
2776
- if (ei) return;
2777
- ei = !0;
2944
+ }), _i = !1;
2945
+ function vi(e) {
2946
+ if (_i) return;
2947
+ _i = !0;
2778
2948
  let t;
2779
2949
  try {
2780
- t = l.fromJSON(e, {
2950
+ let n = l.fromJSON(e, {
2781
2951
  from: 0,
2782
2952
  to: 0
2783
- }).slice.content;
2953
+ });
2954
+ if (!wn(n)) return;
2955
+ t = n.slice.content;
2784
2956
  } catch {
2785
2957
  return;
2786
2958
  }
2787
- t instanceof w || console.warn("[tiptap warn]: prosemirror-model is loaded more than once. Wrapping and splitting nodes will fail. Deduplicate it in your lock file, or alias it to a single copy in your bundler.");
2959
+ t instanceof T || console.warn("[tiptap warn]: prosemirror-model is loaded more than once. Wrapping and splitting nodes will fail. Deduplicate it in your lock file, or alias it to a single copy in your bundler.");
2788
2960
  }
2789
- var ni = class e {
2961
+ var yi = class e {
2790
2962
  get name() {
2791
2963
  return this.node.type.name;
2792
2964
  }
@@ -2908,7 +3080,7 @@ var ni = class e {
2908
3080
  ...e
2909
3081
  }), this.editor.view.dispatch(t);
2910
3082
  }
2911
- }, ri = ".ProseMirror {\n position: relative;\n}\n\n.ProseMirror {\n word-wrap: break-word;\n white-space: pre-wrap;\n white-space: break-spaces;\n -webkit-font-variant-ligatures: none;\n font-variant-ligatures: none;\n font-feature-settings: \"liga\" 0; /* the above doesn't seem to work in Edge */\n}\n\n.ProseMirror [contenteditable=\"false\"] {\n white-space: normal;\n}\n\n.ProseMirror [contenteditable=\"false\"] [contenteditable=\"true\"] {\n white-space: pre-wrap;\n}\n\n.ProseMirror pre {\n white-space: pre-wrap;\n}\n\nimg.ProseMirror-separator {\n display: inline !important;\n border: none !important;\n margin: 0 !important;\n width: 0 !important;\n height: 0 !important;\n}\n\n.ProseMirror-gapcursor {\n display: none;\n pointer-events: none;\n position: absolute;\n margin: 0;\n}\n\n.ProseMirror-gapcursor:after {\n content: \"\";\n display: block;\n position: absolute;\n top: -2px;\n width: 20px;\n border-top: 1px solid black;\n animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;\n}\n\n@keyframes ProseMirror-cursor-blink {\n to {\n visibility: hidden;\n }\n}\n\n.ProseMirror-hideselection *::selection {\n background: transparent;\n}\n\n.ProseMirror-hideselection *::-moz-selection {\n background: transparent;\n}\n\n.ProseMirror-hideselection * {\n caret-color: transparent;\n}\n\n.ProseMirror-focused .ProseMirror-gapcursor {\n display: block;\n}", ii = class extends Xn {
3083
+ }, bi = ".ProseMirror {\n position: relative;\n}\n\n.ProseMirror {\n word-wrap: break-word;\n white-space: pre-wrap;\n white-space: break-spaces;\n -webkit-font-variant-ligatures: none;\n font-variant-ligatures: none;\n font-feature-settings: \"liga\" 0; /* the above doesn't seem to work in Edge */\n}\n\n.ProseMirror [contenteditable=\"false\"] {\n white-space: normal;\n}\n\n.ProseMirror [contenteditable=\"false\"] [contenteditable=\"true\"] {\n white-space: pre-wrap;\n}\n\n.ProseMirror pre {\n white-space: pre-wrap;\n}\n\nimg.ProseMirror-separator {\n display: inline !important;\n border: none !important;\n margin: 0 !important;\n width: 0 !important;\n height: 0 !important;\n}\n\n.ProseMirror-gapcursor {\n display: none;\n pointer-events: none;\n position: absolute;\n margin: 0;\n}\n\n.ProseMirror-gapcursor:after {\n content: \"\";\n display: block;\n position: absolute;\n top: -2px;\n width: 20px;\n border-top: 1px solid black;\n animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;\n}\n\n@keyframes ProseMirror-cursor-blink {\n to {\n visibility: hidden;\n }\n}\n\n.ProseMirror-hideselection *::selection {\n background: transparent;\n}\n\n.ProseMirror-hideselection *::-moz-selection {\n background: transparent;\n}\n\n.ProseMirror-hideselection * {\n caret-color: transparent;\n}\n\n.ProseMirror-focused .ProseMirror-gapcursor {\n display: block;\n}", xi = class extends dr {
2912
3084
  constructor(e = {}) {
2913
3085
  super(), this.css = null, this.className = "tiptap", this.editorView = null, this.isFocused = !1, this.destroyed = !1, this.isInitialized = !1, this.extensionStorage = {}, this.instanceId = Math.random().toString(36).slice(2, 9), this.hasWarnedStaleDecorationRead = !1, this.options = {
2914
3086
  element: typeof document < "u" ? document.createElement("div") : null,
@@ -2945,19 +3117,19 @@ var ni = class e {
2945
3117
  onDelete: () => null,
2946
3118
  enableExtensionDispatchTransaction: !0
2947
3119
  }, this.isCapturingTransaction = !1, this.capturedTransaction = null, this.utils = {
2948
- getUpdatedPosition: gn,
2949
- createMappablePosition: _n
3120
+ getUpdatedPosition: En,
3121
+ createMappablePosition: Dn
2950
3122
  }, this.setOptions(e), this.createExtensionManager(), this.createCommandManager(), this.createSchema(), this.on("beforeCreate", this.options.onBeforeCreate), this.emit("beforeCreate", { editor: this }), this.on("mount", this.options.onMount), this.on("unmount", this.options.onUnmount), this.on("contentError", this.options.onContentError), this.on("create", this.options.onCreate), this.on("update", this.options.onUpdate), this.on("selectionUpdate", this.options.onSelectionUpdate), this.on("transaction", this.options.onTransaction), this.on("focus", this.options.onFocus), this.on("blur", this.options.onBlur), this.on("destroy", this.options.onDestroy), this.on("drop", ({ event: e, slice: t, moved: n }) => this.options.onDrop(e, t, n)), this.on("paste", ({ event: e, slice: t }) => this.options.onPaste(e, t)), this.on("delete", this.options.onDelete);
2951
3123
  let n = this.createDoc();
2952
3124
  if (!this.editorState) {
2953
- let e = We(n, this.options.autofocus);
3125
+ let e = Ue(n, this.options.autofocus);
2954
3126
  this.editorState = t.create({
2955
3127
  doc: n,
2956
3128
  schema: this.schema,
2957
3129
  selection: e || void 0
2958
3130
  });
2959
3131
  }
2960
- ti(this.schema), this.options.element && this.mount(this.options.element);
3132
+ vi(this.schema), this.options.element && this.mount(this.options.element);
2961
3133
  }
2962
3134
  mount(e) {
2963
3135
  if (typeof document > "u") throw Error("[tiptap error]: The editor cannot be mounted because there is no 'document' defined in this environment.");
@@ -2985,13 +3157,13 @@ var ni = class e {
2985
3157
  return this.commandManager.commands;
2986
3158
  }
2987
3159
  chain() {
2988
- return this.commandManager ? this.commandManager.chain() : D.createFakeChain();
3160
+ return this.commandManager ? this.commandManager.chain() : O.createFakeChain();
2989
3161
  }
2990
3162
  can() {
2991
- return this.commandManager ? this.commandManager.can() : D.createFallbackCan();
3163
+ return this.commandManager ? this.commandManager.can() : O.createFallbackCan();
2992
3164
  }
2993
3165
  injectCSS() {
2994
- this.options.injectCSS && typeof document < "u" && (this.css = vr(ri, this.options.injectNonce));
3166
+ this.options.injectCSS && typeof document < "u" && (this.css = Nr(bi, this.options.injectNonce));
2995
3167
  }
2996
3168
  setOptions(e = {}) {
2997
3169
  this.options = {
@@ -3033,10 +3205,10 @@ var ni = class e {
3033
3205
  } });
3034
3206
  }
3035
3207
  get state() {
3036
- return Zn && !this.hasWarnedStaleDecorationRead && Yn(this) && (this.hasWarnedStaleDecorationRead = !0, console.warn("[tiptap warn]: `editor.state` was read while decoration `create()` was running. It returns the pre-transaction document. Use the `state` argument passed to `create()` instead. Helpers like `editor.isActive()` read `editor.state` too, so pass `state` to their standalone versions instead of calling them on the editor.")), this.editorView && (this.editorState = this.view.state), this.editorState;
3208
+ return fr && !this.hasWarnedStaleDecorationRead && ur(this) && (this.hasWarnedStaleDecorationRead = !0, console.warn("[tiptap warn]: `editor.state` was read while decoration `create()` was running. It returns the pre-transaction document. Use the `state` argument passed to `create()` instead. Helpers like `editor.isActive()` read `editor.state` too, so pass `state` to their standalone versions instead of calling them on the editor.")), this.editorView && (this.editorState = this.view.state), this.editorState;
3037
3209
  }
3038
3210
  registerPlugin(e, t) {
3039
- let n = It(t) ? t(e, [...this.state.plugins]) : [...this.state.plugins, e], r = this.state.reconfigure({ plugins: n });
3211
+ let n = Kt(t) ? t(e, [...this.state.plugins]) : [...this.state.plugins, e], r = this.state.reconfigure({ plugins: n });
3040
3212
  return this.view.updateState(r), r;
3041
3213
  }
3042
3214
  unregisterPlugin(e) {
@@ -3052,25 +3224,25 @@ var ni = class e {
3052
3224
  createExtensionManager() {
3053
3225
  var e, t;
3054
3226
  let n = [...this.options.enableCoreExtensions ? [
3055
- qr,
3056
- Ur.configure({ blockSeparator: (e = this.options.coreExtensionOptions) == null || (e = e.clipboardTextSerializer) == null ? void 0 : e.blockSeparator }),
3057
- Wr,
3058
- Yr,
3059
- Xr,
3060
- Qr.configure({ value: (t = this.options.coreExtensionOptions) == null || (t = t.tabindex) == null ? void 0 : t.value }),
3061
- Kr,
3062
- Zr,
3063
- Gr,
3064
- $r.configure({ direction: this.options.textDirection })
3227
+ ui,
3228
+ oi.configure({ blockSeparator: (e = this.options.coreExtensionOptions) == null || (e = e.clipboardTextSerializer) == null ? void 0 : e.blockSeparator }),
3229
+ si,
3230
+ fi,
3231
+ pi,
3232
+ hi.configure({ value: (t = this.options.coreExtensionOptions) == null || (t = t.tabindex) == null ? void 0 : t.value }),
3233
+ li,
3234
+ mi,
3235
+ ci,
3236
+ gi.configure({ direction: this.options.textDirection })
3065
3237
  ].filter((e) => typeof this.options.enableCoreExtensions != "object" || this.options.enableCoreExtensions[e.name] !== !1) : [], ...this.options.extensions].filter((e) => [
3066
3238
  "extension",
3067
3239
  "node",
3068
3240
  "mark"
3069
3241
  ].includes(e?.type));
3070
- this.extensionManager = new Q(n, this);
3242
+ this.extensionManager = new ai(n, this);
3071
3243
  }
3072
3244
  createCommandManager() {
3073
- this.commandManager = new D({ editor: this });
3245
+ this.commandManager = new O({ editor: this });
3074
3246
  }
3075
3247
  createSchema() {
3076
3248
  this.schema = this.extensionManager.schema;
@@ -3085,7 +3257,7 @@ var ni = class e {
3085
3257
  return this.editorState = t.create({
3086
3258
  doc: n,
3087
3259
  schema: this.schema,
3088
- selection: We(n, this.options.autofocus) || void 0
3260
+ selection: Ue(n, this.options.autofocus) || void 0
3089
3261
  }), this.emit("contentError", {
3090
3262
  editor: this,
3091
3263
  error: e,
@@ -3098,7 +3270,7 @@ var ni = class e {
3098
3270
  }
3099
3271
  getEditorViewAttributes() {
3100
3272
  let e = this.options.editorProps?.attributes;
3101
- return It(e) ? (t) => ({
3273
+ return Kt(e) ? (t) => ({
3102
3274
  role: "textbox",
3103
3275
  ...e(t)
3104
3276
  }) : {
@@ -3108,7 +3280,7 @@ var ni = class e {
3108
3280
  }
3109
3281
  createView(e) {
3110
3282
  let { editorProps: t, enableExtensionDispatchTransaction: n } = this.options, r = t.dispatchTransaction || this.dispatchTransaction.bind(this), i = n ? this.extensionManager.dispatchTransaction(r) : r, a = t.transformPastedHTML, o = this.extensionManager.transformPastedHTML(a);
3111
- this.editorView = new _e(e, {
3283
+ this.editorView = new he(e, {
3112
3284
  ...t,
3113
3285
  attributes: this.getEditorViewAttributes(),
3114
3286
  dispatchTransaction: i,
@@ -3176,24 +3348,24 @@ var ni = class e {
3176
3348
  });
3177
3349
  }
3178
3350
  getAttributes(e) {
3179
- return $t(this.state, e);
3351
+ return ln(this.state, e);
3180
3352
  }
3181
3353
  isActive(e, t) {
3182
3354
  let n = typeof e == "string" ? e : null, r = typeof e == "string" ? t : e;
3183
- return ln(this.state, n, r);
3355
+ return vn(this.state, n, r);
3184
3356
  }
3185
3357
  getJSON() {
3186
3358
  return this.state.doc.toJSON();
3187
3359
  }
3188
3360
  getHTML() {
3189
- return Ft(this.state.doc.content, this.schema);
3361
+ return It(this.state.doc.content, this.schema);
3190
3362
  }
3191
3363
  getText(e) {
3192
3364
  let { blockSeparator: t = "\n\n", textSerializers: n = {} } = e || {};
3193
- return Xt(this.state.doc, {
3365
+ return on(this.state.doc, {
3194
3366
  blockSeparator: t,
3195
3367
  textSerializers: {
3196
- ...Zt(this.schema),
3368
+ ...sn(this.schema),
3197
3369
  ...n
3198
3370
  }
3199
3371
  });
@@ -3215,14 +3387,14 @@ var ni = class e {
3215
3387
  }
3216
3388
  $pos(e) {
3217
3389
  let t = this.state.doc.resolve(e), n = e > 0 && t.nodeAfter && !t.nodeAfter.isText && t.nodeAfter.isAtom ? t.nodeAfter : null;
3218
- return new ni(t, this, !1, n);
3390
+ return new yi(t, this, !1, n);
3219
3391
  }
3220
3392
  get $doc() {
3221
3393
  return this.$pos(0);
3222
3394
  }
3223
3395
  };
3224
- function ai(e) {
3225
- return new Y({
3396
+ function Si(e) {
3397
+ return new Z({
3226
3398
  find: e.find,
3227
3399
  handler: ({ state: t, range: n, match: r }) => {
3228
3400
  let i = z(e.getAttributes, void 0, r);
@@ -3230,7 +3402,7 @@ function ai(e) {
3230
3402
  let { tr: a } = t, o = r[r.length - 1], s = r[0];
3231
3403
  if (o) {
3232
3404
  let r = s.search(/\S/), c = n.from + s.indexOf(o), l = c + o.length;
3233
- if (rn(n.from, n.to, t.doc).filter((t) => t.mark.type.excluded.find((n) => n === e.type && n !== t.mark.type)).filter((e) => e.to > c).length) return null;
3405
+ if (pn(n.from, n.to, t.doc).filter((t) => t.mark.type.excluded.find((n) => n === e.type && n !== t.mark.type)).filter((e) => e.to > c).length) return null;
3234
3406
  l < n.to && a.delete(l, n.to), c > n.from && a.delete(n.from + r, c);
3235
3407
  let u = n.from + r + o.length;
3236
3408
  a.addMark(n.from + r, u, e.type.create(i || {})), a.removeStoredMark(e.type);
@@ -3239,8 +3411,8 @@ function ai(e) {
3239
3411
  undoable: e.undoable
3240
3412
  });
3241
3413
  }
3242
- function oi(e) {
3243
- return new Y({
3414
+ function Ci(e) {
3415
+ return new Z({
3244
3416
  find: e.find,
3245
3417
  handler: ({ state: t, range: n, match: r }) => {
3246
3418
  let i = z(e.getAttributes, void 0, r) || {}, { tr: a } = t, o = n.from, s = n.to, c = e.type.create(i);
@@ -3258,8 +3430,8 @@ function oi(e) {
3258
3430
  undoable: e.undoable
3259
3431
  });
3260
3432
  }
3261
- function si(e) {
3262
- return new Y({
3433
+ function wi(e) {
3434
+ return new Z({
3263
3435
  find: e.find,
3264
3436
  handler: ({ state: t, range: n, match: r }) => {
3265
3437
  let i = t.doc.resolve(n.from), a = z(e.getAttributes, void 0, r) || {};
@@ -3269,8 +3441,8 @@ function si(e) {
3269
3441
  undoable: e.undoable
3270
3442
  });
3271
3443
  }
3272
- function ci(e) {
3273
- return new Y({
3444
+ function Ti(e) {
3445
+ return new Z({
3274
3446
  find: e.find,
3275
3447
  handler: ({ state: t, range: n, match: r }) => {
3276
3448
  let i = e.replace, a = n.from, o = n.to;
@@ -3285,8 +3457,8 @@ function ci(e) {
3285
3457
  undoable: e.undoable
3286
3458
  });
3287
3459
  }
3288
- function li(e) {
3289
- return new Y({
3460
+ function Ei(e) {
3461
+ return new Z({
3290
3462
  find: e.find,
3291
3463
  handler: ({ state: t, range: n, match: r, chain: i }) => {
3292
3464
  let a = z(e.getAttributes, void 0, r) || {}, o = t.tr.delete(n.from, n.to), s = o.doc.resolve(n.from).blockRange(), c = s && p(s, e.type, a);
@@ -3308,7 +3480,7 @@ function li(e) {
3308
3480
  undoable: e.undoable
3309
3481
  });
3310
3482
  }
3311
- var ui = (e) => "touches" in e, di = class {
3483
+ var Di = (e) => "touches" in e, Oi = class {
3312
3484
  constructor(e) {
3313
3485
  var t;
3314
3486
  this.directions = [
@@ -3398,7 +3570,7 @@ var ui = (e) => "touches" in e, di = class {
3398
3570
  e ? (this.element.style.width = `${e}px`, this.initialWidth = e) : this.initialWidth = this.element.offsetWidth, t ? (this.element.style.height = `${t}px`, this.initialHeight = t) : this.initialHeight = this.element.offsetHeight, this.initialWidth > 0 && this.initialHeight > 0 && (this.aspectRatio = this.initialWidth / this.initialHeight);
3399
3571
  }
3400
3572
  handleResizeStart(e, t) {
3401
- e.preventDefault(), e.stopPropagation(), this.isResizing = !0, this.activeHandle = t, ui(e) ? (this.startX = e.touches[0].clientX, this.startY = e.touches[0].clientY) : (this.startX = e.clientX, this.startY = e.clientY), this.startWidth = this.element.offsetWidth, this.startHeight = this.element.offsetHeight, this.startWidth > 0 && this.startHeight > 0 && (this.aspectRatio = this.startWidth / this.startHeight), this.getPos(), this.container.dataset.resizeState = "true", this.classNames.resizing && this.container.classList.add(this.classNames.resizing), document.addEventListener("mousemove", this.handleMouseMove), document.addEventListener("touchmove", this.handleTouchMove), document.addEventListener("mouseup", this.handleMouseUp), document.addEventListener("keydown", this.handleKeyDown), document.addEventListener("keyup", this.handleKeyUp);
3573
+ e.preventDefault(), e.stopPropagation(), this.isResizing = !0, this.activeHandle = t, Di(e) ? (this.startX = e.touches[0].clientX, this.startY = e.touches[0].clientY) : (this.startX = e.clientX, this.startY = e.clientY), this.startWidth = this.element.offsetWidth, this.startHeight = this.element.offsetHeight, this.startWidth > 0 && this.startHeight > 0 && (this.aspectRatio = this.startWidth / this.startHeight), this.getPos(), this.container.dataset.resizeState = "true", this.classNames.resizing && this.container.classList.add(this.classNames.resizing), document.addEventListener("mousemove", this.handleMouseMove), document.addEventListener("touchmove", this.handleTouchMove), document.addEventListener("mouseup", this.handleMouseUp), document.addEventListener("keydown", this.handleKeyDown), document.addEventListener("keyup", this.handleKeyUp);
3402
3574
  }
3403
3575
  handleResize(e, t) {
3404
3576
  if (!this.activeHandle) return;
@@ -3438,7 +3610,7 @@ var ui = (e) => "touches" in e, di = class {
3438
3610
  height: e / this.aspectRatio
3439
3611
  };
3440
3612
  }
3441
- }, fi = class e extends Ir {
3613
+ }, ki = class e extends Qr {
3442
3614
  constructor(...e) {
3443
3615
  super(...e), this.type = "node";
3444
3616
  }
@@ -3454,8 +3626,8 @@ var ui = (e) => "touches" in e, di = class {
3454
3626
  return super.extend(t);
3455
3627
  }
3456
3628
  };
3457
- function pi(e) {
3458
- return new Rr({
3629
+ function Ai(e) {
3630
+ return new ei({
3459
3631
  find: e.find,
3460
3632
  handler: ({ state: t, range: n, match: r, pasteEvent: i }) => {
3461
3633
  let a = z(e.getAttributes, void 0, r, i);
@@ -3463,11 +3635,11 @@ function pi(e) {
3463
3635
  let { tr: o } = t, s = r[r.length - 1], c = r[0], l = n.to;
3464
3636
  if (s) {
3465
3637
  let i = c.search(/\S/), u = n.from + c.indexOf(s), d = u + s.length;
3466
- if (rn(n.from, n.to, t.doc).filter((t) => t.mark.type.excluded.find((n) => n === e.type && n !== t.mark.type)).filter((e) => e.to > u).length) return null;
3638
+ if (pn(n.from, n.to, t.doc).filter((t) => t.mark.type.excluded.find((n) => n === e.type && n !== t.mark.type)).filter((e) => e.to > u).length) return null;
3467
3639
  d < n.to && o.delete(d, n.to), u > n.from && o.delete(n.from + i, u), l = n.from + i + s.length, o.addMark(n.from + i, l, e.type.create(a || {})), r.index !== void 0 && r.input !== void 0 && r.index + r[0].length >= r.input.length || o.removeStoredMark(e.type);
3468
3640
  }
3469
3641
  }
3470
3642
  });
3471
3643
  }
3472
3644
  //#endregion
3473
- export { dn as A, Vt as B, on as C, Zt as D, Xt as E, Ue as F, ci as G, Tr as H, wr as I, si as K, M as L, F as M, G as N, Ge as O, mn as P, ai as R, O as S, br as T, vn as U, oi as V, Or as W, R as _, fi as a, rn as b, z as c, qn as d, yr as f, nn as g, $t as h, Lr as i, xr as j, un as k, _r as l, Nt as m, $ as n, Rr as o, Mt as p, li as q, Y as r, di as s, ii as t, jt as u, k as v, V as w, an as x, A as y, pi as z };
3645
+ export { bn as A, Xt as B, hn as C, sn as D, on as E, He as F, Ti as G, Br as H, zr as I, wi as K, N as L, I as M, G as N, We as O, Sn as P, Si as R, k as S, Fr as T, On as U, Ci as V, Ur as W, L as _, ki as a, pn as b, z as c, cr as d, Pr as f, fn as g, ln as h, $r as i, Ir as j, yn as k, Mr as l, Nt as m, $ as n, ei as o, Mt as p, Ei as q, Z as r, Oi as s, xi as t, jt as u, ze as v, B as w, mn as x, j as y, Ai as z };