tiptap-extension-code-block-shiki 0.6.0 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,12 +1,12 @@
1
- import { Plugin as P, PluginKey as N, Selection as O, TextSelection as b, NodeSelection as ce } from "@tiptap/pm/state";
2
- import { DecorationSet as Se, Decoration as ee } from "@tiptap/pm/view";
1
+ import { Plugin as P, PluginKey as N, Selection as O, TextSelection as C, NodeSelection as de } from "@tiptap/pm/state";
2
+ import { DecorationSet as be, Decoration as _ } from "@tiptap/pm/view";
3
3
  import "@tiptap/pm/keymap";
4
- import { Fragment as L, Slice as be, DOMParser as Me } from "@tiptap/pm/model";
5
- import { liftTarget as Ae, joinPoint as le, canSplit as R, ReplaceStep as Te, ReplaceAroundStep as Ce, canJoin as de } from "@tiptap/pm/transform";
6
- import { createParagraphNear as Ee, deleteSelection as Be, exitCode as ve, joinUp as $e, joinDown as Ie, joinBackward as Pe, joinForward as Ne, joinTextblockBackward as Oe, joinTextblockForward as je, lift as Fe, liftEmptyBlock as Le, newlineInCode as Re, selectNodeBackward as De, selectNodeForward as ze, selectParentNode as We, selectTextblockEnd as He, selectTextblockStart as Ke, setBlockType as te, wrapIn as Ve } from "@tiptap/pm/commands";
7
- import { liftListItem as _e, sinkListItem as Je, wrapInList as Ue } from "@tiptap/pm/schema-list";
8
- import { bundledThemes as ue, bundledLanguages as fe, createHighlighter as Ge } from "shiki";
9
- function pe(e) {
4
+ import { Fragment as L, Slice as Me, DOMParser as Te } from "@tiptap/pm/model";
5
+ import { liftTarget as Ae, joinPoint as ue, canSplit as R, ReplaceStep as Ce, ReplaceAroundStep as Ee, canJoin as fe } from "@tiptap/pm/transform";
6
+ import { createParagraphNear as Be, deleteSelection as ve, exitCode as $e, joinUp as Ie, joinDown as Pe, joinBackward as Ne, joinForward as Oe, joinTextblockBackward as je, joinTextblockForward as Fe, lift as Le, liftEmptyBlock as Re, newlineInCode as ze, selectNodeBackward as De, selectNodeForward as We, selectParentNode as He, selectTextblockEnd as Ke, selectTextblockStart as Ve, setBlockType as ne, wrapIn as _e } from "@tiptap/pm/commands";
7
+ import { liftListItem as Je, sinkListItem as Ue, wrapInList as Ge } from "@tiptap/pm/schema-list";
8
+ import { bundledThemes as pe, bundledLanguages as me, createHighlighter as qe } from "shiki";
9
+ function he(e) {
10
10
  const { state: t, transaction: n } = e;
11
11
  let { selection: o } = n, { doc: r } = n, { storedMarks: s } = n;
12
12
  return {
@@ -31,7 +31,7 @@ function pe(e) {
31
31
  }
32
32
  };
33
33
  }
34
- class qe {
34
+ class Qe {
35
35
  constructor(t) {
36
36
  this.editor = t.editor, this.rawCommands = this.editor.extensionManager.commands, this.customState = t.state;
37
37
  }
@@ -43,9 +43,9 @@ class qe {
43
43
  }
44
44
  get commands() {
45
45
  const { rawCommands: t, editor: n, state: o } = this, { view: r } = n, { tr: s } = o, a = this.buildProps(s);
46
- return Object.fromEntries(Object.entries(t).map(([i, c]) => [i, (...u) => {
47
- const l = c(...u)(a);
48
- return !s.getMeta("preventDispatch") && !this.hasCustomState && r.dispatch(s), l;
46
+ return Object.fromEntries(Object.entries(t).map(([i, c]) => [i, (...p) => {
47
+ const d = c(...p)(a);
48
+ return !s.getMeta("preventDispatch") && !this.hasCustomState && r.dispatch(s), d;
49
49
  }]));
50
50
  }
51
51
  get chain() {
@@ -55,19 +55,19 @@ class qe {
55
55
  return () => this.createCan();
56
56
  }
57
57
  createChain(t, n = !0) {
58
- const { rawCommands: o, editor: r, state: s } = this, { view: a } = r, i = [], c = !!t, d = t || s.tr, u = () => (!c && n && !d.getMeta("preventDispatch") && !this.hasCustomState && a.dispatch(d), i.every((f) => f === !0)), l = {
59
- ...Object.fromEntries(Object.entries(o).map(([f, p]) => [f, (...h) => {
60
- const g = this.buildProps(d, n), k = p(...h)(g);
61
- return i.push(k), l;
58
+ const { rawCommands: o, editor: r, state: s } = this, { view: a } = r, i = [], c = !!t, l = t || s.tr, p = () => (!c && n && !l.getMeta("preventDispatch") && !this.hasCustomState && a.dispatch(l), i.every((u) => u === !0)), d = {
59
+ ...Object.fromEntries(Object.entries(o).map(([u, f]) => [u, (...h) => {
60
+ const g = this.buildProps(l, n), k = f(...h)(g);
61
+ return i.push(k), d;
62
62
  }])),
63
- run: u
63
+ run: p
64
64
  };
65
- return l;
65
+ return d;
66
66
  }
67
67
  createCan(t) {
68
68
  const { rawCommands: n, state: o } = this, r = !1, s = t || o.tr, a = this.buildProps(s, r);
69
69
  return {
70
- ...Object.fromEntries(Object.entries(n).map(([c, d]) => [c, (...u) => d(...u)({ ...a, dispatch: void 0 })])),
70
+ ...Object.fromEntries(Object.entries(n).map(([c, l]) => [c, (...p) => l(...p)({ ...a, dispatch: void 0 })])),
71
71
  chain: () => this.createChain(s, r)
72
72
  };
73
73
  }
@@ -76,7 +76,7 @@ class qe {
76
76
  tr: t,
77
77
  editor: r,
78
78
  view: a,
79
- state: pe({
79
+ state: he({
80
80
  state: s,
81
81
  transaction: t
82
82
  }),
@@ -85,19 +85,19 @@ class qe {
85
85
  chain: () => this.createChain(t, n),
86
86
  can: () => this.createCan(t),
87
87
  get commands() {
88
- return Object.fromEntries(Object.entries(o).map(([c, d]) => [c, (...u) => d(...u)(i)]));
88
+ return Object.fromEntries(Object.entries(o).map(([c, l]) => [c, (...p) => l(...p)(i)]));
89
89
  }
90
90
  };
91
91
  return i;
92
92
  }
93
93
  }
94
- function w(e, t, n) {
95
- return e.config[t] === void 0 && e.parent ? w(e.parent, t, n) : typeof e.config[t] == "function" ? e.config[t].bind({
94
+ function b(e, t, n) {
95
+ return e.config[t] === void 0 && e.parent ? b(e.parent, t, n) : typeof e.config[t] == "function" ? e.config[t].bind({
96
96
  ...n,
97
- parent: e.parent ? w(e.parent, t, n) : null
97
+ parent: e.parent ? b(e.parent, t, n) : null
98
98
  }) : e.config[t];
99
99
  }
100
- function Qe(e) {
100
+ function Xe(e) {
101
101
  const t = e.filter((r) => r.type === "extension"), n = e.filter((r) => r.type === "node"), o = e.filter((r) => r.type === "mark");
102
102
  return {
103
103
  baseExtensions: t,
@@ -105,7 +105,7 @@ function Qe(e) {
105
105
  markExtensions: o
106
106
  };
107
107
  }
108
- function y(e, t) {
108
+ function x(e, t) {
109
109
  if (typeof e == "string") {
110
110
  if (!t.nodes[e])
111
111
  throw Error(`There is no node type named '${e}'. Maybe you forgot to add the extension?`);
@@ -113,7 +113,7 @@ function y(e, t) {
113
113
  }
114
114
  return e;
115
115
  }
116
- function Xe(...e) {
116
+ function Ye(...e) {
117
117
  return e.filter((t) => !!t).reduce((t, n) => {
118
118
  const o = { ...t };
119
119
  return Object.entries(n).forEach(([r, s]) => {
@@ -122,40 +122,40 @@ function Xe(...e) {
122
122
  return;
123
123
  }
124
124
  if (r === "class") {
125
- const i = s ? s.split(" ") : [], c = o[r] ? o[r].split(" ") : [], d = i.filter((u) => !c.includes(u));
126
- o[r] = [...c, ...d].join(" ");
125
+ const i = s ? s.split(" ") : [], c = o[r] ? o[r].split(" ") : [], l = i.filter((p) => !c.includes(p));
126
+ o[r] = [...c, ...l].join(" ");
127
127
  } else
128
128
  r === "style" ? o[r] = [o[r], s].join("; ") : o[r] = s;
129
129
  }), o;
130
130
  }, {});
131
131
  }
132
- function Ye(e) {
132
+ function Ze(e) {
133
133
  return typeof e == "function";
134
134
  }
135
- function x(e, t = void 0, ...n) {
136
- return Ye(e) ? t ? e.bind(t)(...n) : e(...n) : e;
135
+ function M(e, t = void 0, ...n) {
136
+ return Ze(e) ? t ? e.bind(t)(...n) : e(...n) : e;
137
137
  }
138
- function Ze(e) {
138
+ function et(e) {
139
139
  return Object.prototype.toString.call(e) === "[object RegExp]";
140
140
  }
141
- class et {
141
+ class tt {
142
142
  constructor(t) {
143
143
  this.find = t.find, this.handler = t.handler;
144
144
  }
145
145
  }
146
- function tt(e) {
146
+ function nt(e) {
147
147
  return Object.prototype.toString.call(e).slice(8, -1);
148
148
  }
149
- function V(e) {
150
- return tt(e) !== "Object" ? !1 : e.constructor === Object && Object.getPrototypeOf(e) === Object.prototype;
149
+ function J(e) {
150
+ return nt(e) !== "Object" ? !1 : e.constructor === Object && Object.getPrototypeOf(e) === Object.prototype;
151
151
  }
152
- function Q(e, t) {
152
+ function Y(e, t) {
153
153
  const n = { ...e };
154
- return V(e) && V(t) && Object.keys(t).forEach((o) => {
155
- V(t[o]) ? o in e ? n[o] = Q(e[o], t[o]) : Object.assign(n, { [o]: t[o] }) : Object.assign(n, { [o]: t[o] });
154
+ return J(e) && J(t) && Object.keys(t).forEach((o) => {
155
+ J(t[o]) ? o in e ? n[o] = Y(e[o], t[o]) : Object.assign(n, { [o]: t[o] }) : Object.assign(n, { [o]: t[o] });
156
156
  }), n;
157
157
  }
158
- class C {
158
+ class B {
159
159
  constructor(t = {}) {
160
160
  this.type = "extension", this.name = "extension", this.parent = null, this.child = null, this.config = {
161
161
  name: this.name,
@@ -163,56 +163,56 @@ class C {
163
163
  }, this.config = {
164
164
  ...this.config,
165
165
  ...t
166
- }, this.name = this.config.name, t.defaultOptions && Object.keys(t.defaultOptions).length > 0 && console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`), this.options = this.config.defaultOptions, this.config.addOptions && (this.options = x(w(this, "addOptions", {
166
+ }, this.name = this.config.name, t.defaultOptions && Object.keys(t.defaultOptions).length > 0 && console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`), this.options = this.config.defaultOptions, this.config.addOptions && (this.options = M(b(this, "addOptions", {
167
167
  name: this.name
168
- }))), this.storage = x(w(this, "addStorage", {
168
+ }))), this.storage = M(b(this, "addStorage", {
169
169
  name: this.name,
170
170
  options: this.options
171
171
  })) || {};
172
172
  }
173
173
  static create(t = {}) {
174
- return new C(t);
174
+ return new B(t);
175
175
  }
176
176
  configure(t = {}) {
177
177
  const n = this.extend();
178
- return n.options = Q(this.options, t), n.storage = x(w(n, "addStorage", {
178
+ return n.options = Y(this.options, t), n.storage = M(b(n, "addStorage", {
179
179
  name: n.name,
180
180
  options: n.options
181
181
  })), n;
182
182
  }
183
183
  extend(t = {}) {
184
- const n = new C({ ...this.config, ...t });
185
- return n.parent = this, this.child = n, n.name = t.name ? t.name : n.parent.name, t.defaultOptions && console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${n.name}".`), n.options = x(w(n, "addOptions", {
184
+ const n = new B({ ...this.config, ...t });
185
+ return n.parent = this, this.child = n, n.name = t.name ? t.name : n.parent.name, t.defaultOptions && console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${n.name}".`), n.options = M(b(n, "addOptions", {
186
186
  name: n.name
187
- })), n.storage = x(w(n, "addStorage", {
187
+ })), n.storage = M(b(n, "addStorage", {
188
188
  name: n.name,
189
189
  options: n.options
190
190
  })), n;
191
191
  }
192
192
  }
193
- function nt(e, t, n) {
193
+ function ot(e, t, n) {
194
194
  const { from: o, to: r } = t, { blockSeparator: s = `
195
195
 
196
196
  `, textSerializers: a = {} } = n || {};
197
197
  let i = "", c = !0;
198
- return e.nodesBetween(o, r, (d, u, l, f) => {
199
- var p;
200
- const m = a == null ? void 0 : a[d.type.name];
198
+ return e.nodesBetween(o, r, (l, p, d, u) => {
199
+ var f;
200
+ const m = a == null ? void 0 : a[l.type.name];
201
201
  if (m)
202
- return d.isBlock && !c && (i += s, c = !0), l && (i += m({
203
- node: d,
204
- pos: u,
205
- parent: l,
206
- index: f,
202
+ return l.isBlock && !c && (i += s, c = !0), d && (i += m({
203
+ node: l,
204
+ pos: p,
205
+ parent: d,
206
+ index: u,
207
207
  range: t
208
208
  })), !1;
209
- d.isText ? (i += (p = d == null ? void 0 : d.text) === null || p === void 0 ? void 0 : p.slice(Math.max(o, u) - u, r - u), c = !1) : d.isBlock && !c && (i += s, c = !0);
209
+ l.isText ? (i += (f = l == null ? void 0 : l.text) === null || f === void 0 ? void 0 : f.slice(Math.max(o, p) - p, r - p), c = !1) : l.isBlock && !c && (i += s, c = !0);
210
210
  }), i;
211
211
  }
212
- function ot(e) {
212
+ function rt(e) {
213
213
  return Object.fromEntries(Object.entries(e.nodes).filter(([, t]) => t.spec.toText).map(([t, n]) => [t, n.spec.toText]));
214
214
  }
215
- C.create({
215
+ B.create({
216
216
  name: "clipboardTextSerializer",
217
217
  addOptions() {
218
218
  return {
@@ -225,8 +225,8 @@ C.create({
225
225
  key: new N("clipboardTextSerializer"),
226
226
  props: {
227
227
  clipboardTextSerializer: () => {
228
- const { editor: e } = this, { state: t, schema: n } = e, { doc: o, selection: r } = t, { ranges: s } = r, a = Math.min(...s.map((u) => u.$from.pos)), i = Math.max(...s.map((u) => u.$to.pos)), c = ot(n);
229
- return nt(o, { from: a, to: i }, {
228
+ const { editor: e } = this, { state: t, schema: n } = e, { doc: o, selection: r } = t, { ranges: s } = r, a = Math.min(...s.map((p) => p.$from.pos)), i = Math.max(...s.map((p) => p.$to.pos)), c = rt(n);
229
+ return ot(o, { from: a, to: i }, {
230
230
  ...this.options.blockSeparator !== void 0 ? { blockSeparator: this.options.blockSeparator } : {},
231
231
  textSerializers: c
232
232
  });
@@ -236,32 +236,32 @@ C.create({
236
236
  ];
237
237
  }
238
238
  });
239
- const rt = () => ({ editor: e, view: t }) => (requestAnimationFrame(() => {
239
+ const st = () => ({ editor: e, view: t }) => (requestAnimationFrame(() => {
240
240
  var n;
241
241
  e.isDestroyed || (t.dom.blur(), (n = window == null ? void 0 : window.getSelection()) === null || n === void 0 || n.removeAllRanges());
242
- }), !0), st = (e = !1) => ({ commands: t }) => t.setContent("", e), it = () => ({ state: e, tr: t, dispatch: n }) => {
242
+ }), !0), it = (e = !1) => ({ commands: t }) => t.setContent("", e), at = () => ({ state: e, tr: t, dispatch: n }) => {
243
243
  const { selection: o } = t, { ranges: r } = o;
244
244
  return n && r.forEach(({ $from: s, $to: a }) => {
245
245
  e.doc.nodesBetween(s.pos, a.pos, (i, c) => {
246
246
  if (i.type.isText)
247
247
  return;
248
- const { doc: d, mapping: u } = t, l = d.resolve(u.map(c)), f = d.resolve(u.map(c + i.nodeSize)), p = l.blockRange(f);
249
- if (!p)
248
+ const { doc: l, mapping: p } = t, d = l.resolve(p.map(c)), u = l.resolve(p.map(c + i.nodeSize)), f = d.blockRange(u);
249
+ if (!f)
250
250
  return;
251
- const m = Ae(p);
251
+ const m = Ae(f);
252
252
  if (i.type.isTextblock) {
253
- const { defaultType: h } = l.parent.contentMatchAt(l.index());
254
- t.setNodeMarkup(p.start, h);
253
+ const { defaultType: h } = d.parent.contentMatchAt(d.index());
254
+ t.setNodeMarkup(f.start, h);
255
255
  }
256
- (m || m === 0) && t.lift(p, m);
256
+ (m || m === 0) && t.lift(f, m);
257
257
  });
258
258
  }), !0;
259
- }, at = (e) => (t) => e(t), ct = () => ({ state: e, dispatch: t }) => Ee(e, t), lt = (e, t) => ({ editor: n, tr: o }) => {
259
+ }, ct = (e) => (t) => e(t), lt = () => ({ state: e, dispatch: t }) => Be(e, t), dt = (e, t) => ({ editor: n, tr: o }) => {
260
260
  const { state: r } = n, s = r.doc.slice(e.from, e.to);
261
261
  o.deleteRange(e.from, e.to);
262
262
  const a = o.mapping.map(t);
263
- return o.insert(a, s.content), o.setSelection(new b(o.doc.resolve(a - 1))), !0;
264
- }, dt = () => ({ tr: e, dispatch: t }) => {
263
+ return o.insert(a, s.content), o.setSelection(new C(o.doc.resolve(a - 1))), !0;
264
+ }, ut = () => ({ tr: e, dispatch: t }) => {
265
265
  const { selection: n } = e, o = n.$anchor.node();
266
266
  if (o.content.size > 0)
267
267
  return !1;
@@ -275,44 +275,44 @@ const rt = () => ({ editor: e, view: t }) => (requestAnimationFrame(() => {
275
275
  return !0;
276
276
  }
277
277
  return !1;
278
- }, ut = (e) => ({ tr: t, state: n, dispatch: o }) => {
279
- const r = y(e, n.schema), s = t.selection.$anchor;
278
+ }, ft = (e) => ({ tr: t, state: n, dispatch: o }) => {
279
+ const r = x(e, n.schema), s = t.selection.$anchor;
280
280
  for (let a = s.depth; a > 0; a -= 1)
281
281
  if (s.node(a).type === r) {
282
282
  if (o) {
283
- const c = s.before(a), d = s.after(a);
284
- t.delete(c, d).scrollIntoView();
283
+ const c = s.before(a), l = s.after(a);
284
+ t.delete(c, l).scrollIntoView();
285
285
  }
286
286
  return !0;
287
287
  }
288
288
  return !1;
289
- }, ft = (e) => ({ tr: t, dispatch: n }) => {
289
+ }, pt = (e) => ({ tr: t, dispatch: n }) => {
290
290
  const { from: o, to: r } = e;
291
291
  return n && t.delete(o, r), !0;
292
- }, pt = () => ({ state: e, dispatch: t }) => Be(e, t), mt = () => ({ commands: e }) => e.keyboardShortcut("Enter"), ht = () => ({ state: e, dispatch: t }) => ve(e, t);
293
- function z(e, t, n = { strict: !0 }) {
292
+ }, mt = () => ({ state: e, dispatch: t }) => ve(e, t), ht = () => ({ commands: e }) => e.keyboardShortcut("Enter"), gt = () => ({ state: e, dispatch: t }) => $e(e, t);
293
+ function W(e, t, n = { strict: !0 }) {
294
294
  const o = Object.keys(t);
295
- return o.length ? o.every((r) => n.strict ? t[r] === e[r] : Ze(t[r]) ? t[r].test(e[r]) : t[r] === e[r]) : !0;
295
+ return o.length ? o.every((r) => n.strict ? t[r] === e[r] : et(t[r]) ? t[r].test(e[r]) : t[r] === e[r]) : !0;
296
296
  }
297
- function q(e, t, n = {}) {
298
- return e.find((o) => o.type === t && z(o.attrs, n));
297
+ function X(e, t, n = {}) {
298
+ return e.find((o) => o.type === t && W(o.attrs, n));
299
299
  }
300
- function gt(e, t, n = {}) {
301
- return !!q(e, t, n);
300
+ function kt(e, t, n = {}) {
301
+ return !!X(e, t, n);
302
302
  }
303
- function me(e, t, n = {}) {
303
+ function ge(e, t, n = {}) {
304
304
  if (!e || !t)
305
305
  return;
306
306
  let o = e.parent.childAfter(e.parentOffset);
307
307
  if (e.parentOffset === o.offset && o.offset !== 0 && (o = e.parent.childBefore(e.parentOffset)), !o.node)
308
308
  return;
309
- const r = q([...o.node.marks], t, n);
309
+ const r = X([...o.node.marks], t, n);
310
310
  if (!r)
311
311
  return;
312
312
  let s = o.index, a = e.start() + o.offset, i = s + 1, c = a + o.node.nodeSize;
313
- for (q([...o.node.marks], t, n); s > 0 && r.isInSet(e.parent.child(s - 1).marks); )
313
+ for (X([...o.node.marks], t, n); s > 0 && r.isInSet(e.parent.child(s - 1).marks); )
314
314
  s -= 1, a -= e.parent.child(s).nodeSize;
315
- for (; i < e.parent.childCount && gt([...e.parent.child(i).marks], t, n); )
315
+ for (; i < e.parent.childCount && kt([...e.parent.child(i).marks], t, n); )
316
316
  c += e.parent.child(i).nodeSize, i += 1;
317
317
  return {
318
318
  from: a,
@@ -327,30 +327,30 @@ function $(e, t) {
327
327
  }
328
328
  return e;
329
329
  }
330
- const kt = (e, t = {}) => ({ tr: n, state: o, dispatch: r }) => {
331
- const s = $(e, o.schema), { doc: a, selection: i } = n, { $from: c, from: d, to: u } = i;
330
+ const yt = (e, t = {}) => ({ tr: n, state: o, dispatch: r }) => {
331
+ const s = $(e, o.schema), { doc: a, selection: i } = n, { $from: c, from: l, to: p } = i;
332
332
  if (r) {
333
- const l = me(c, s, t);
334
- if (l && l.from <= d && l.to >= u) {
335
- const f = b.create(a, l.from, l.to);
336
- n.setSelection(f);
333
+ const d = ge(c, s, t);
334
+ if (d && d.from <= l && d.to >= p) {
335
+ const u = C.create(a, d.from, d.to);
336
+ n.setSelection(u);
337
337
  }
338
338
  }
339
339
  return !0;
340
- }, yt = (e) => (t) => {
340
+ }, wt = (e) => (t) => {
341
341
  const n = typeof e == "function" ? e(t) : e;
342
342
  for (let o = 0; o < n.length; o += 1)
343
343
  if (n[o](t))
344
344
  return !0;
345
345
  return !1;
346
346
  };
347
- function he(e) {
348
- return e instanceof b;
347
+ function ke(e) {
348
+ return e instanceof C;
349
349
  }
350
350
  function I(e = 0, t = 0, n = 0) {
351
351
  return Math.min(Math.max(e, t), n);
352
352
  }
353
- function wt(e, t = null) {
353
+ function xt(e, t = null) {
354
354
  if (!t)
355
355
  return null;
356
356
  const n = O.atStart(e), o = O.atEnd(e);
@@ -359,9 +359,9 @@ function wt(e, t = null) {
359
359
  if (t === "end")
360
360
  return o;
361
361
  const r = n.from, s = o.to;
362
- return t === "all" ? b.create(e, I(0, r, s), I(e.content.size, r, s)) : b.create(e, I(t, r, s), I(t, r, s));
362
+ return t === "all" ? C.create(e, I(0, r, s), I(e.content.size, r, s)) : C.create(e, I(t, r, s), I(t, r, s));
363
363
  }
364
- function X() {
364
+ function Z() {
365
365
  return [
366
366
  "iPad Simulator",
367
367
  "iPhone Simulator",
@@ -371,35 +371,35 @@ function X() {
371
371
  "iPod"
372
372
  ].includes(navigator.platform) || navigator.userAgent.includes("Mac") && "ontouchend" in document;
373
373
  }
374
- const xt = (e = null, t = {}) => ({ editor: n, view: o, tr: r, dispatch: s }) => {
374
+ const St = (e = null, t = {}) => ({ editor: n, view: o, tr: r, dispatch: s }) => {
375
375
  t = {
376
376
  scrollIntoView: !0,
377
377
  ...t
378
378
  };
379
379
  const a = () => {
380
- X() && o.dom.focus(), requestAnimationFrame(() => {
380
+ Z() && o.dom.focus(), requestAnimationFrame(() => {
381
381
  n.isDestroyed || (o.focus(), t != null && t.scrollIntoView && n.commands.scrollIntoView());
382
382
  });
383
383
  };
384
384
  if (o.hasFocus() && e === null || e === !1)
385
385
  return !0;
386
- if (s && e === null && !he(n.state.selection))
386
+ if (s && e === null && !ke(n.state.selection))
387
387
  return a(), !0;
388
- const i = wt(r.doc, e) || n.state.selection, c = n.state.selection.eq(i);
388
+ const i = xt(r.doc, e) || n.state.selection, c = n.state.selection.eq(i);
389
389
  return s && (c || r.setSelection(i), c && r.storedMarks && r.setStoredMarks(r.storedMarks), a()), !0;
390
- }, St = (e, t) => (n) => e.every((o, r) => t(o, { ...n, index: r })), bt = (e, t) => ({ tr: n, commands: o }) => o.insertContentAt({ from: n.selection.from, to: n.selection.to }, e, t), ge = (e) => {
390
+ }, bt = (e, t) => (n) => e.every((o, r) => t(o, { ...n, index: r })), Mt = (e, t) => ({ tr: n, commands: o }) => o.insertContentAt({ from: n.selection.from, to: n.selection.to }, e, t), ye = (e) => {
391
391
  const t = e.childNodes;
392
392
  for (let n = t.length - 1; n >= 0; n -= 1) {
393
393
  const o = t[n];
394
- o.nodeType === 3 && o.nodeValue && /^(\n\s\s|\n)$/.test(o.nodeValue) ? e.removeChild(o) : o.nodeType === 1 && ge(o);
394
+ o.nodeType === 3 && o.nodeValue && /^(\n\s\s|\n)$/.test(o.nodeValue) ? e.removeChild(o) : o.nodeType === 1 && ye(o);
395
395
  }
396
396
  return e;
397
397
  };
398
- function ne(e) {
398
+ function oe(e) {
399
399
  const t = `<body>${e}</body>`, n = new window.DOMParser().parseFromString(t, "text/html").body;
400
- return ge(n);
400
+ return ye(n);
401
401
  }
402
- function W(e, t, n) {
402
+ function H(e, t, n) {
403
403
  if (n = {
404
404
  slice: !0,
405
405
  parseOptions: {},
@@ -408,28 +408,28 @@ function W(e, t, n) {
408
408
  try {
409
409
  return Array.isArray(e) && e.length > 0 ? L.fromArray(e.map((o) => t.nodeFromJSON(o))) : t.nodeFromJSON(e);
410
410
  } catch (o) {
411
- return console.warn("[tiptap warn]: Invalid content.", "Passed value:", e, "Error:", o), W("", t, n);
411
+ return console.warn("[tiptap warn]: Invalid content.", "Passed value:", e, "Error:", o), H("", t, n);
412
412
  }
413
413
  if (typeof e == "string") {
414
- const o = Me.fromSchema(t);
415
- return n.slice ? o.parseSlice(ne(e), n.parseOptions).content : o.parse(ne(e), n.parseOptions);
414
+ const o = Te.fromSchema(t);
415
+ return n.slice ? o.parseSlice(oe(e), n.parseOptions).content : o.parse(oe(e), n.parseOptions);
416
416
  }
417
- return W("", t, n);
417
+ return H("", t, n);
418
418
  }
419
- function Mt(e, t, n) {
419
+ function Tt(e, t, n) {
420
420
  const o = e.steps.length - 1;
421
421
  if (o < t)
422
422
  return;
423
423
  const r = e.steps[o];
424
- if (!(r instanceof Te || r instanceof Ce))
424
+ if (!(r instanceof Ce || r instanceof Ee))
425
425
  return;
426
426
  const s = e.mapping.maps[o];
427
427
  let a = 0;
428
- s.forEach((i, c, d, u) => {
429
- a === 0 && (a = u);
428
+ s.forEach((i, c, l, p) => {
429
+ a === 0 && (a = p);
430
430
  }), e.setSelection(O.near(e.doc.resolve(a), n));
431
431
  }
432
- const At = (e) => e.toString().startsWith("<"), Tt = (e, t, n) => ({ tr: o, dispatch: r, editor: s }) => {
432
+ const At = (e) => e.toString().startsWith("<"), Ct = (e, t, n) => ({ tr: o, dispatch: r, editor: s }) => {
433
433
  if (r) {
434
434
  n = {
435
435
  parseOptions: {},
@@ -438,7 +438,7 @@ const At = (e) => e.toString().startsWith("<"), Tt = (e, t, n) => ({ tr: o, disp
438
438
  applyPasteRules: !1,
439
439
  ...n
440
440
  };
441
- const a = W(t, s.schema, {
441
+ const a = H(t, s.schema, {
442
442
  parseOptions: {
443
443
  preserveWhitespace: "full",
444
444
  ...n.parseOptions
@@ -446,36 +446,36 @@ const At = (e) => e.toString().startsWith("<"), Tt = (e, t, n) => ({ tr: o, disp
446
446
  });
447
447
  if (a.toString() === "<>")
448
448
  return !0;
449
- let { from: i, to: c } = typeof e == "number" ? { from: e, to: e } : { from: e.from, to: e.to }, d = !0, u = !0;
450
- if ((At(a) ? a : [a]).forEach((p) => {
451
- p.check(), d = d ? p.isText && p.marks.length === 0 : !1, u = u ? p.isBlock : !1;
452
- }), i === c && u) {
453
- const { parent: p } = o.doc.resolve(i);
454
- p.isTextblock && !p.type.spec.code && !p.childCount && (i -= 1, c += 1);
449
+ let { from: i, to: c } = typeof e == "number" ? { from: e, to: e } : { from: e.from, to: e.to }, l = !0, p = !0;
450
+ if ((At(a) ? a : [a]).forEach((f) => {
451
+ f.check(), l = l ? f.isText && f.marks.length === 0 : !1, p = p ? f.isBlock : !1;
452
+ }), i === c && p) {
453
+ const { parent: f } = o.doc.resolve(i);
454
+ f.isTextblock && !f.type.spec.code && !f.childCount && (i -= 1, c += 1);
455
455
  }
456
- let f;
457
- d ? (Array.isArray(t) ? f = t.map((p) => p.text || "").join("") : typeof t == "object" && t && t.text ? f = t.text : f = t, o.insertText(f, i, c)) : (f = a, o.replaceWith(i, c, f)), n.updateSelection && Mt(o, o.steps.length - 1, -1), n.applyInputRules && o.setMeta("applyInputRules", { from: i, text: f }), n.applyPasteRules && o.setMeta("applyPasteRules", { from: i, text: f });
456
+ let u;
457
+ l ? (Array.isArray(t) ? u = t.map((f) => f.text || "").join("") : typeof t == "object" && t && t.text ? u = t.text : u = t, o.insertText(u, i, c)) : (u = a, o.replaceWith(i, c, u)), n.updateSelection && Tt(o, o.steps.length - 1, -1), n.applyInputRules && o.setMeta("applyInputRules", { from: i, text: u }), n.applyPasteRules && o.setMeta("applyPasteRules", { from: i, text: u });
458
458
  }
459
459
  return !0;
460
- }, Ct = () => ({ state: e, dispatch: t }) => $e(e, t), Et = () => ({ state: e, dispatch: t }) => Ie(e, t), Bt = () => ({ state: e, dispatch: t }) => Pe(e, t), vt = () => ({ state: e, dispatch: t }) => Ne(e, t), $t = () => ({ tr: e, state: t, dispatch: n }) => {
460
+ }, Et = () => ({ state: e, dispatch: t }) => Ie(e, t), Bt = () => ({ state: e, dispatch: t }) => Pe(e, t), vt = () => ({ state: e, dispatch: t }) => Ne(e, t), $t = () => ({ state: e, dispatch: t }) => Oe(e, t), It = () => ({ tr: e, state: t, dispatch: n }) => {
461
461
  try {
462
- const o = le(t.doc, t.selection.$from.pos, -1);
462
+ const o = ue(t.doc, t.selection.$from.pos, -1);
463
463
  return o == null ? !1 : (e.join(o, 2), n && n(e), !0);
464
464
  } catch {
465
465
  return !1;
466
466
  }
467
- }, It = () => ({ state: e, dispatch: t, tr: n }) => {
467
+ }, Pt = () => ({ state: e, dispatch: t, tr: n }) => {
468
468
  try {
469
- const o = le(e.doc, e.selection.$from.pos, 1);
469
+ const o = ue(e.doc, e.selection.$from.pos, 1);
470
470
  return o == null ? !1 : (n.join(o, 2), t && t(n), !0);
471
471
  } catch {
472
472
  return !1;
473
473
  }
474
- }, Pt = () => ({ state: e, dispatch: t }) => Oe(e, t), Nt = () => ({ state: e, dispatch: t }) => je(e, t);
475
- function ke() {
474
+ }, Nt = () => ({ state: e, dispatch: t }) => je(e, t), Ot = () => ({ state: e, dispatch: t }) => Fe(e, t);
475
+ function we() {
476
476
  return typeof navigator < "u" ? /Mac/.test(navigator.platform) : !1;
477
477
  }
478
- function Ot(e) {
478
+ function jt(e) {
479
479
  const t = e.split(/-(?!$)/);
480
480
  let n = t[t.length - 1];
481
481
  n === "Space" && (n = " ");
@@ -491,14 +491,14 @@ function Ot(e) {
491
491
  else if (/^s(hift)?$/i.test(c))
492
492
  s = !0;
493
493
  else if (/^mod$/i.test(c))
494
- X() || ke() ? a = !0 : r = !0;
494
+ Z() || we() ? a = !0 : r = !0;
495
495
  else
496
496
  throw new Error(`Unrecognized modifier name: ${c}`);
497
497
  }
498
498
  return o && (n = `Alt-${n}`), r && (n = `Ctrl-${n}`), a && (n = `Meta-${n}`), s && (n = `Shift-${n}`), n;
499
499
  }
500
- const jt = (e) => ({ editor: t, view: n, tr: o, dispatch: r }) => {
501
- const s = Ot(e).split(/-(?!$)/), a = s.find((d) => !["Alt", "Ctrl", "Meta", "Shift"].includes(d)), i = new KeyboardEvent("keydown", {
500
+ const Ft = (e) => ({ editor: t, view: n, tr: o, dispatch: r }) => {
501
+ const s = jt(e).split(/-(?!$)/), a = s.find((l) => !["Alt", "Ctrl", "Meta", "Shift"].includes(l)), i = new KeyboardEvent("keydown", {
502
502
  key: a === "Space" ? " " : a,
503
503
  altKey: s.includes("Alt"),
504
504
  ctrlKey: s.includes("Ctrl"),
@@ -507,64 +507,64 @@ const jt = (e) => ({ editor: t, view: n, tr: o, dispatch: r }) => {
507
507
  bubbles: !0,
508
508
  cancelable: !0
509
509
  }), c = t.captureTransaction(() => {
510
- n.someProp("handleKeyDown", (d) => d(n, i));
510
+ n.someProp("handleKeyDown", (l) => l(n, i));
511
511
  });
512
- return c == null || c.steps.forEach((d) => {
513
- const u = d.map(o.mapping);
514
- u && r && o.maybeStep(u);
512
+ return c == null || c.steps.forEach((l) => {
513
+ const p = l.map(o.mapping);
514
+ p && r && o.maybeStep(p);
515
515
  }), !0;
516
516
  };
517
- function Y(e, t, n = {}) {
518
- const { from: o, to: r, empty: s } = e.selection, a = t ? y(t, e.schema) : null, i = [];
519
- e.doc.nodesBetween(o, r, (l, f) => {
520
- if (l.isText)
517
+ function ee(e, t, n = {}) {
518
+ const { from: o, to: r, empty: s } = e.selection, a = t ? x(t, e.schema) : null, i = [];
519
+ e.doc.nodesBetween(o, r, (d, u) => {
520
+ if (d.isText)
521
521
  return;
522
- const p = Math.max(o, f), m = Math.min(r, f + l.nodeSize);
522
+ const f = Math.max(o, u), m = Math.min(r, u + d.nodeSize);
523
523
  i.push({
524
- node: l,
525
- from: p,
524
+ node: d,
525
+ from: f,
526
526
  to: m
527
527
  });
528
528
  });
529
- const c = r - o, d = i.filter((l) => a ? a.name === l.node.type.name : !0).filter((l) => z(l.node.attrs, n, { strict: !1 }));
530
- return s ? !!d.length : d.reduce((l, f) => l + f.to - f.from, 0) >= c;
529
+ const c = r - o, l = i.filter((d) => a ? a.name === d.node.type.name : !0).filter((d) => W(d.node.attrs, n, { strict: !1 }));
530
+ return s ? !!l.length : l.reduce((d, u) => d + u.to - u.from, 0) >= c;
531
531
  }
532
- const Ft = (e, t = {}) => ({ state: n, dispatch: o }) => {
533
- const r = y(e, n.schema);
534
- return Y(n, r, t) ? Fe(n, o) : !1;
535
- }, Lt = () => ({ state: e, dispatch: t }) => Le(e, t), Rt = (e) => ({ state: t, dispatch: n }) => {
536
- const o = y(e, t.schema);
537
- return _e(o)(t, n);
538
- }, Dt = () => ({ state: e, dispatch: t }) => Re(e, t);
539
- function ye(e, t) {
532
+ const Lt = (e, t = {}) => ({ state: n, dispatch: o }) => {
533
+ const r = x(e, n.schema);
534
+ return ee(n, r, t) ? Le(n, o) : !1;
535
+ }, Rt = () => ({ state: e, dispatch: t }) => Re(e, t), zt = (e) => ({ state: t, dispatch: n }) => {
536
+ const o = x(e, t.schema);
537
+ return Je(o)(t, n);
538
+ }, Dt = () => ({ state: e, dispatch: t }) => ze(e, t);
539
+ function xe(e, t) {
540
540
  return t.nodes[e] ? "node" : t.marks[e] ? "mark" : null;
541
541
  }
542
- function oe(e, t) {
542
+ function re(e, t) {
543
543
  const n = typeof t == "string" ? [t] : t;
544
544
  return Object.keys(e).reduce((o, r) => (n.includes(r) || (o[r] = e[r]), o), {});
545
545
  }
546
- const zt = (e, t) => ({ tr: n, state: o, dispatch: r }) => {
546
+ const Wt = (e, t) => ({ tr: n, state: o, dispatch: r }) => {
547
547
  let s = null, a = null;
548
- const i = ye(typeof e == "string" ? e : e.name, o.schema);
549
- return i ? (i === "node" && (s = y(e, o.schema)), i === "mark" && (a = $(e, o.schema)), r && n.selection.ranges.forEach((c) => {
550
- o.doc.nodesBetween(c.$from.pos, c.$to.pos, (d, u) => {
551
- s && s === d.type && n.setNodeMarkup(u, void 0, oe(d.attrs, t)), a && d.marks.length && d.marks.forEach((l) => {
552
- a === l.type && n.addMark(u, u + d.nodeSize, a.create(oe(l.attrs, t)));
548
+ const i = xe(typeof e == "string" ? e : e.name, o.schema);
549
+ return i ? (i === "node" && (s = x(e, o.schema)), i === "mark" && (a = $(e, o.schema)), r && n.selection.ranges.forEach((c) => {
550
+ o.doc.nodesBetween(c.$from.pos, c.$to.pos, (l, p) => {
551
+ s && s === l.type && n.setNodeMarkup(p, void 0, re(l.attrs, t)), a && l.marks.length && l.marks.forEach((d) => {
552
+ a === d.type && n.addMark(p, p + l.nodeSize, a.create(re(d.attrs, t)));
553
553
  });
554
554
  });
555
555
  }), !0) : !1;
556
- }, Wt = () => ({ tr: e, dispatch: t }) => (t && e.scrollIntoView(), !0), Ht = () => ({ tr: e, commands: t }) => t.setTextSelection({
556
+ }, Ht = () => ({ tr: e, dispatch: t }) => (t && e.scrollIntoView(), !0), Kt = () => ({ tr: e, commands: t }) => t.setTextSelection({
557
557
  from: 0,
558
558
  to: e.doc.content.size
559
- }), Kt = () => ({ state: e, dispatch: t }) => De(e, t), Vt = () => ({ state: e, dispatch: t }) => ze(e, t), _t = () => ({ state: e, dispatch: t }) => We(e, t), Jt = () => ({ state: e, dispatch: t }) => He(e, t), Ut = () => ({ state: e, dispatch: t }) => Ke(e, t);
560
- function Gt(e, t, n = {}) {
561
- return W(e, t, { slice: !1, parseOptions: n });
559
+ }), Vt = () => ({ state: e, dispatch: t }) => De(e, t), _t = () => ({ state: e, dispatch: t }) => We(e, t), Jt = () => ({ state: e, dispatch: t }) => He(e, t), Ut = () => ({ state: e, dispatch: t }) => Ke(e, t), Gt = () => ({ state: e, dispatch: t }) => Ve(e, t);
560
+ function qt(e, t, n = {}) {
561
+ return H(e, t, { slice: !1, parseOptions: n });
562
562
  }
563
- const qt = (e, t = !1, n = {}) => ({ tr: o, editor: r, dispatch: s }) => {
564
- const { doc: a } = o, i = Gt(e, r.schema, n);
563
+ const Qt = (e, t = !1, n = {}) => ({ tr: o, editor: r, dispatch: s }) => {
564
+ const { doc: a } = o, i = qt(e, r.schema, n);
565
565
  return s && o.replaceWith(0, a.content.size, i).setMeta("preventUpdate", !t), !0;
566
566
  };
567
- function Qt(e, t) {
567
+ function Xt(e, t) {
568
568
  const n = $(t, e.schema), { from: o, to: r, empty: s } = e.selection, a = [];
569
569
  s ? (e.storedMarks && a.push(...e.storedMarks), a.push(...e.selection.$head.marks())) : e.doc.nodesBetween(o, r, (c) => {
570
570
  a.push(...c.marks);
@@ -572,7 +572,7 @@ function Qt(e, t) {
572
572
  const i = a.find((c) => c.type.name === n.name);
573
573
  return i ? { ...i.attrs } : {};
574
574
  }
575
- function Xt(e) {
575
+ function Yt(e) {
576
576
  for (let t = 0; t < e.edgeCount; t += 1) {
577
577
  const { type: n } = e.edge(t);
578
578
  if (n.isTextblock && !n.hasRequiredAttrs())
@@ -589,7 +589,7 @@ function F(e, t) {
589
589
  });
590
590
  }), n;
591
591
  }
592
- function Yt(e, t) {
592
+ function Zt(e, t) {
593
593
  for (let n = e.depth; n > 0; n -= 1) {
594
594
  const o = e.node(n);
595
595
  if (t(o))
@@ -601,86 +601,86 @@ function Yt(e, t) {
601
601
  };
602
602
  }
603
603
  }
604
- function Z(e) {
605
- return (t) => Yt(t.$from, e);
604
+ function te(e) {
605
+ return (t) => Zt(t.$from, e);
606
606
  }
607
- function D(e, t, n) {
607
+ function z(e, t, n) {
608
608
  return Object.fromEntries(Object.entries(n).filter(([o]) => {
609
609
  const r = e.find((s) => s.type === t && s.name === o);
610
610
  return r ? r.attribute.keepOnSplit : !1;
611
611
  }));
612
612
  }
613
- function Zt(e, t, n = {}) {
613
+ function en(e, t, n = {}) {
614
614
  const { empty: o, ranges: r } = e.selection, s = t ? $(t, e.schema) : null;
615
615
  if (o)
616
- return !!(e.storedMarks || e.selection.$from.marks()).filter((l) => s ? s.name === l.type.name : !0).find((l) => z(l.attrs, n, { strict: !1 }));
616
+ return !!(e.storedMarks || e.selection.$from.marks()).filter((d) => s ? s.name === d.type.name : !0).find((d) => W(d.attrs, n, { strict: !1 }));
617
617
  let a = 0;
618
618
  const i = [];
619
- if (r.forEach(({ $from: l, $to: f }) => {
620
- const p = l.pos, m = f.pos;
621
- e.doc.nodesBetween(p, m, (h, g) => {
619
+ if (r.forEach(({ $from: d, $to: u }) => {
620
+ const f = d.pos, m = u.pos;
621
+ e.doc.nodesBetween(f, m, (h, g) => {
622
622
  if (!h.isText && !h.marks.length)
623
623
  return;
624
- const k = Math.max(p, g), E = Math.min(m, g + h.nodeSize), M = E - k;
625
- a += M, i.push(...h.marks.map((B) => ({
626
- mark: B,
624
+ const k = Math.max(f, g), y = Math.min(m, g + h.nodeSize), w = y - k;
625
+ a += w, i.push(...h.marks.map((T) => ({
626
+ mark: T,
627
627
  from: k,
628
- to: E
628
+ to: y
629
629
  })));
630
630
  });
631
631
  }), a === 0)
632
632
  return !1;
633
- const c = i.filter((l) => s ? s.name === l.mark.type.name : !0).filter((l) => z(l.mark.attrs, n, { strict: !1 })).reduce((l, f) => l + f.to - f.from, 0), d = i.filter((l) => s ? l.mark.type !== s && l.mark.type.excludes(s) : !0).reduce((l, f) => l + f.to - f.from, 0);
634
- return (c > 0 ? c + d : c) >= a;
633
+ const c = i.filter((d) => s ? s.name === d.mark.type.name : !0).filter((d) => W(d.mark.attrs, n, { strict: !1 })).reduce((d, u) => d + u.to - u.from, 0), l = i.filter((d) => s ? d.mark.type !== s && d.mark.type.excludes(s) : !0).reduce((d, u) => d + u.to - u.from, 0);
634
+ return (c > 0 ? c + l : c) >= a;
635
635
  }
636
- function re(e, t) {
637
- const { nodeExtensions: n } = Qe(t), o = n.find((a) => a.name === e);
636
+ function se(e, t) {
637
+ const { nodeExtensions: n } = Xe(t), o = n.find((a) => a.name === e);
638
638
  if (!o)
639
639
  return !1;
640
640
  const r = {
641
641
  name: o.name,
642
642
  options: o.options,
643
643
  storage: o.storage
644
- }, s = x(w(o, "group", r));
644
+ }, s = M(b(o, "group", r));
645
645
  return typeof s != "string" ? !1 : s.split(" ").includes("list");
646
646
  }
647
- function en(e, t, n) {
647
+ function tn(e, t, n) {
648
648
  var o;
649
649
  const { selection: r } = t;
650
650
  let s = null;
651
- if (he(r) && (s = r.$cursor), s) {
651
+ if (ke(r) && (s = r.$cursor), s) {
652
652
  const i = (o = e.storedMarks) !== null && o !== void 0 ? o : s.marks();
653
653
  return !!n.isInSet(i) || !i.some((c) => c.type.excludes(n));
654
654
  }
655
655
  const { ranges: a } = r;
656
656
  return a.some(({ $from: i, $to: c }) => {
657
- let d = i.depth === 0 ? e.doc.inlineContent && e.doc.type.allowsMarkType(n) : !1;
658
- return e.doc.nodesBetween(i.pos, c.pos, (u, l, f) => {
659
- if (d)
657
+ let l = i.depth === 0 ? e.doc.inlineContent && e.doc.type.allowsMarkType(n) : !1;
658
+ return e.doc.nodesBetween(i.pos, c.pos, (p, d, u) => {
659
+ if (l)
660
660
  return !1;
661
- if (u.isInline) {
662
- const p = !f || f.type.allowsMarkType(n), m = !!n.isInSet(u.marks) || !u.marks.some((h) => h.type.excludes(n));
663
- d = p && m;
661
+ if (p.isInline) {
662
+ const f = !u || u.type.allowsMarkType(n), m = !!n.isInSet(p.marks) || !p.marks.some((h) => h.type.excludes(n));
663
+ l = f && m;
664
664
  }
665
- return !d;
666
- }), d;
665
+ return !l;
666
+ }), l;
667
667
  });
668
668
  }
669
- const tn = (e, t = {}) => ({ tr: n, state: o, dispatch: r }) => {
669
+ const nn = (e, t = {}) => ({ tr: n, state: o, dispatch: r }) => {
670
670
  const { selection: s } = n, { empty: a, ranges: i } = s, c = $(e, o.schema);
671
671
  if (r)
672
672
  if (a) {
673
- const d = Qt(o, c);
673
+ const l = Xt(o, c);
674
674
  n.addStoredMark(c.create({
675
- ...d,
675
+ ...l,
676
676
  ...t
677
677
  }));
678
678
  } else
679
- i.forEach((d) => {
680
- const u = d.$from.pos, l = d.$to.pos;
681
- o.doc.nodesBetween(u, l, (f, p) => {
682
- const m = Math.max(p, u), h = Math.min(p + f.nodeSize, l);
683
- f.marks.find((k) => k.type === c) ? f.marks.forEach((k) => {
679
+ i.forEach((l) => {
680
+ const p = l.$from.pos, d = l.$to.pos;
681
+ o.doc.nodesBetween(p, d, (u, f) => {
682
+ const m = Math.max(f, p), h = Math.min(f + u.nodeSize, d);
683
+ u.marks.find((k) => k.type === c) ? u.marks.forEach((k) => {
684
684
  c === k.type && n.addMark(m, h, c.create({
685
685
  ...k.attrs,
686
686
  ...t
@@ -688,70 +688,70 @@ const tn = (e, t = {}) => ({ tr: n, state: o, dispatch: r }) => {
688
688
  }) : n.addMark(m, h, c.create(t));
689
689
  });
690
690
  });
691
- return en(o, n, c);
692
- }, nn = (e, t) => ({ tr: n }) => (n.setMeta(e, t), !0), on = (e, t = {}) => ({ state: n, dispatch: o, chain: r }) => {
693
- const s = y(e, n.schema);
694
- return s.isTextblock ? r().command(({ commands: a }) => te(s, t)(n) ? !0 : a.clearNodes()).command(({ state: a }) => te(s, t)(a, o)).run() : (console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'), !1);
695
- }, rn = (e) => ({ tr: t, dispatch: n }) => {
691
+ return tn(o, n, c);
692
+ }, on = (e, t) => ({ tr: n }) => (n.setMeta(e, t), !0), rn = (e, t = {}) => ({ state: n, dispatch: o, chain: r }) => {
693
+ const s = x(e, n.schema);
694
+ return s.isTextblock ? r().command(({ commands: a }) => ne(s, t)(n) ? !0 : a.clearNodes()).command(({ state: a }) => ne(s, t)(a, o)).run() : (console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'), !1);
695
+ }, sn = (e) => ({ tr: t, dispatch: n }) => {
696
696
  if (n) {
697
- const { doc: o } = t, r = I(e, 0, o.content.size), s = ce.create(o, r);
697
+ const { doc: o } = t, r = I(e, 0, o.content.size), s = de.create(o, r);
698
698
  t.setSelection(s);
699
699
  }
700
700
  return !0;
701
- }, sn = (e) => ({ tr: t, dispatch: n }) => {
701
+ }, an = (e) => ({ tr: t, dispatch: n }) => {
702
702
  if (n) {
703
- const { doc: o } = t, { from: r, to: s } = typeof e == "number" ? { from: e, to: e } : e, a = b.atStart(o).from, i = b.atEnd(o).to, c = I(r, a, i), d = I(s, a, i), u = b.create(o, c, d);
704
- t.setSelection(u);
703
+ const { doc: o } = t, { from: r, to: s } = typeof e == "number" ? { from: e, to: e } : e, a = C.atStart(o).from, i = C.atEnd(o).to, c = I(r, a, i), l = I(s, a, i), p = C.create(o, c, l);
704
+ t.setSelection(p);
705
705
  }
706
706
  return !0;
707
- }, an = (e) => ({ state: t, dispatch: n }) => {
708
- const o = y(e, t.schema);
709
- return Je(o)(t, n);
707
+ }, cn = (e) => ({ state: t, dispatch: n }) => {
708
+ const o = x(e, t.schema);
709
+ return Ue(o)(t, n);
710
710
  };
711
- function se(e, t) {
711
+ function ie(e, t) {
712
712
  const n = e.storedMarks || e.selection.$to.parentOffset && e.selection.$from.marks();
713
713
  if (n) {
714
714
  const o = n.filter((r) => t == null ? void 0 : t.includes(r.type.name));
715
715
  e.tr.ensureMarks(o);
716
716
  }
717
717
  }
718
- const cn = ({ keepMarks: e = !0 } = {}) => ({ tr: t, state: n, dispatch: o, editor: r }) => {
719
- const { selection: s, doc: a } = t, { $from: i, $to: c } = s, d = r.extensionManager.attributes, u = D(d, i.node().type.name, i.node().attrs);
720
- if (s instanceof ce && s.node.isBlock)
721
- return !i.parentOffset || !R(a, i.pos) ? !1 : (o && (e && se(n, r.extensionManager.splittableMarks), t.split(i.pos).scrollIntoView()), !0);
718
+ const ln = ({ keepMarks: e = !0 } = {}) => ({ tr: t, state: n, dispatch: o, editor: r }) => {
719
+ const { selection: s, doc: a } = t, { $from: i, $to: c } = s, l = r.extensionManager.attributes, p = z(l, i.node().type.name, i.node().attrs);
720
+ if (s instanceof de && s.node.isBlock)
721
+ return !i.parentOffset || !R(a, i.pos) ? !1 : (o && (e && ie(n, r.extensionManager.splittableMarks), t.split(i.pos).scrollIntoView()), !0);
722
722
  if (!i.parent.isBlock)
723
723
  return !1;
724
724
  if (o) {
725
- const l = c.parentOffset === c.parent.content.size;
726
- s instanceof b && t.deleteSelection();
727
- const f = i.depth === 0 ? void 0 : Xt(i.node(-1).contentMatchAt(i.indexAfter(-1)));
728
- let p = l && f ? [
725
+ const d = c.parentOffset === c.parent.content.size;
726
+ s instanceof C && t.deleteSelection();
727
+ const u = i.depth === 0 ? void 0 : Yt(i.node(-1).contentMatchAt(i.indexAfter(-1)));
728
+ let f = d && u ? [
729
729
  {
730
- type: f,
731
- attrs: u
730
+ type: u,
731
+ attrs: p
732
732
  }
733
- ] : void 0, m = R(t.doc, t.mapping.map(i.pos), 1, p);
734
- if (!p && !m && R(t.doc, t.mapping.map(i.pos), 1, f ? [{ type: f }] : void 0) && (m = !0, p = f ? [
733
+ ] : void 0, m = R(t.doc, t.mapping.map(i.pos), 1, f);
734
+ if (!f && !m && R(t.doc, t.mapping.map(i.pos), 1, u ? [{ type: u }] : void 0) && (m = !0, f = u ? [
735
735
  {
736
- type: f,
737
- attrs: u
736
+ type: u,
737
+ attrs: p
738
738
  }
739
- ] : void 0), m && (t.split(t.mapping.map(i.pos), 1, p), f && !l && !i.parentOffset && i.parent.type !== f)) {
739
+ ] : void 0), m && (t.split(t.mapping.map(i.pos), 1, f), u && !d && !i.parentOffset && i.parent.type !== u)) {
740
740
  const h = t.mapping.map(i.before()), g = t.doc.resolve(h);
741
- i.node(-1).canReplaceWith(g.index(), g.index() + 1, f) && t.setNodeMarkup(t.mapping.map(i.before()), f);
741
+ i.node(-1).canReplaceWith(g.index(), g.index() + 1, u) && t.setNodeMarkup(t.mapping.map(i.before()), u);
742
742
  }
743
- e && se(n, r.extensionManager.splittableMarks), t.scrollIntoView();
743
+ e && ie(n, r.extensionManager.splittableMarks), t.scrollIntoView();
744
744
  }
745
745
  return !0;
746
- }, ln = (e) => ({ tr: t, state: n, dispatch: o, editor: r }) => {
746
+ }, dn = (e) => ({ tr: t, state: n, dispatch: o, editor: r }) => {
747
747
  var s;
748
- const a = y(e, n.schema), { $from: i, $to: c } = n.selection, d = n.selection.node;
749
- if (d && d.isBlock || i.depth < 2 || !i.sameParent(c))
748
+ const a = x(e, n.schema), { $from: i, $to: c } = n.selection, l = n.selection.node;
749
+ if (l && l.isBlock || i.depth < 2 || !i.sameParent(c))
750
750
  return !1;
751
- const u = i.node(-1);
752
- if (u.type !== a)
751
+ const p = i.node(-1);
752
+ if (p.type !== a)
753
753
  return !1;
754
- const l = r.extensionManager.attributes;
754
+ const d = r.extensionManager.attributes;
755
755
  if (i.parent.content.size === 0 && i.node(-1).childCount === i.indexAfter(-1)) {
756
756
  if (i.depth === 2 || i.node(-3).type !== a || i.index(-2) !== i.node(-2).childCount - 1)
757
757
  return !1;
@@ -760,78 +760,78 @@ const cn = ({ keepMarks: e = !0 } = {}) => ({ tr: t, state: n, dispatch: o, edit
760
760
  const k = i.index(-1) ? 1 : i.index(-2) ? 2 : 3;
761
761
  for (let v = i.depth - k; v >= i.depth - 3; v -= 1)
762
762
  g = L.from(i.node(v).copy(g));
763
- const E = i.indexAfter(-1) < i.node(-2).childCount ? 1 : i.indexAfter(-2) < i.node(-3).childCount ? 2 : 3, M = D(l, i.node().type.name, i.node().attrs), B = ((s = a.contentMatch.defaultType) === null || s === void 0 ? void 0 : s.createAndFill(M)) || void 0;
764
- g = g.append(L.from(a.createAndFill(null, B) || void 0));
763
+ const y = i.indexAfter(-1) < i.node(-2).childCount ? 1 : i.indexAfter(-2) < i.node(-3).childCount ? 2 : 3, w = z(d, i.node().type.name, i.node().attrs), T = ((s = a.contentMatch.defaultType) === null || s === void 0 ? void 0 : s.createAndFill(w)) || void 0;
764
+ g = g.append(L.from(a.createAndFill(null, T) || void 0));
765
765
  const S = i.before(i.depth - (k - 1));
766
- t.replace(S, i.after(-E), new be(g, 4 - k, 0));
767
- let T = -1;
768
- t.doc.nodesBetween(S, t.doc.content.size, (v, K) => {
769
- if (T > -1)
766
+ t.replace(S, i.after(-y), new Me(g, 4 - k, 0));
767
+ let A = -1;
768
+ t.doc.nodesBetween(S, t.doc.content.size, (v, V) => {
769
+ if (A > -1)
770
770
  return !1;
771
- v.isTextblock && v.content.size === 0 && (T = K + 1);
772
- }), T > -1 && t.setSelection(b.near(t.doc.resolve(T))), t.scrollIntoView();
771
+ v.isTextblock && v.content.size === 0 && (A = V + 1);
772
+ }), A > -1 && t.setSelection(C.near(t.doc.resolve(A))), t.scrollIntoView();
773
773
  }
774
774
  return !0;
775
775
  }
776
- const f = c.pos === i.end() ? u.contentMatchAt(0).defaultType : null, p = D(l, u.type.name, u.attrs), m = D(l, i.node().type.name, i.node().attrs);
776
+ const u = c.pos === i.end() ? p.contentMatchAt(0).defaultType : null, f = z(d, p.type.name, p.attrs), m = z(d, i.node().type.name, i.node().attrs);
777
777
  t.delete(i.pos, c.pos);
778
- const h = f ? [
779
- { type: a, attrs: p },
780
- { type: f, attrs: m }
781
- ] : [{ type: a, attrs: p }];
778
+ const h = u ? [
779
+ { type: a, attrs: f },
780
+ { type: u, attrs: m }
781
+ ] : [{ type: a, attrs: f }];
782
782
  if (!R(t.doc, i.pos, 2))
783
783
  return !1;
784
784
  if (o) {
785
- const { selection: g, storedMarks: k } = n, { splittableMarks: E } = r.extensionManager, M = k || g.$to.parentOffset && g.$from.marks();
786
- if (t.split(i.pos, 2, h).scrollIntoView(), !M || !o)
785
+ const { selection: g, storedMarks: k } = n, { splittableMarks: y } = r.extensionManager, w = k || g.$to.parentOffset && g.$from.marks();
786
+ if (t.split(i.pos, 2, h).scrollIntoView(), !w || !o)
787
787
  return !0;
788
- const B = M.filter((S) => E.includes(S.type.name));
789
- t.ensureMarks(B);
788
+ const T = w.filter((S) => y.includes(S.type.name));
789
+ t.ensureMarks(T);
790
790
  }
791
791
  return !0;
792
- }, _ = (e, t) => {
793
- const n = Z((a) => a.type === t)(e.selection);
792
+ }, U = (e, t) => {
793
+ const n = te((a) => a.type === t)(e.selection);
794
794
  if (!n)
795
795
  return !0;
796
796
  const o = e.doc.resolve(Math.max(0, n.pos - 1)).before(n.depth);
797
797
  if (o === void 0)
798
798
  return !0;
799
799
  const r = e.doc.nodeAt(o);
800
- return n.node.type === (r == null ? void 0 : r.type) && de(e.doc, n.pos) && e.join(n.pos), !0;
801
- }, J = (e, t) => {
802
- const n = Z((a) => a.type === t)(e.selection);
800
+ return n.node.type === (r == null ? void 0 : r.type) && fe(e.doc, n.pos) && e.join(n.pos), !0;
801
+ }, G = (e, t) => {
802
+ const n = te((a) => a.type === t)(e.selection);
803
803
  if (!n)
804
804
  return !0;
805
805
  const o = e.doc.resolve(n.start).after(n.depth);
806
806
  if (o === void 0)
807
807
  return !0;
808
808
  const r = e.doc.nodeAt(o);
809
- return n.node.type === (r == null ? void 0 : r.type) && de(e.doc, o) && e.join(o), !0;
810
- }, dn = (e, t, n, o = {}) => ({ editor: r, tr: s, state: a, dispatch: i, chain: c, commands: d, can: u }) => {
811
- const { extensions: l, splittableMarks: f } = r.extensionManager, p = y(e, a.schema), m = y(t, a.schema), { selection: h, storedMarks: g } = a, { $from: k, $to: E } = h, M = k.blockRange(E), B = g || h.$to.parentOffset && h.$from.marks();
812
- if (!M)
809
+ return n.node.type === (r == null ? void 0 : r.type) && fe(e.doc, o) && e.join(o), !0;
810
+ }, un = (e, t, n, o = {}) => ({ editor: r, tr: s, state: a, dispatch: i, chain: c, commands: l, can: p }) => {
811
+ const { extensions: d, splittableMarks: u } = r.extensionManager, f = x(e, a.schema), m = x(t, a.schema), { selection: h, storedMarks: g } = a, { $from: k, $to: y } = h, w = k.blockRange(y), T = g || h.$to.parentOffset && h.$from.marks();
812
+ if (!w)
813
813
  return !1;
814
- const S = Z((T) => re(T.type.name, l))(h);
815
- if (M.depth >= 1 && S && M.depth - S.depth <= 1) {
816
- if (S.node.type === p)
817
- return d.liftListItem(m);
818
- if (re(S.node.type.name, l) && p.validContent(S.node.content) && i)
819
- return c().command(() => (s.setNodeMarkup(S.pos, p), !0)).command(() => _(s, p)).command(() => J(s, p)).run();
814
+ const S = te((A) => se(A.type.name, d))(h);
815
+ if (w.depth >= 1 && S && w.depth - S.depth <= 1) {
816
+ if (S.node.type === f)
817
+ return l.liftListItem(m);
818
+ if (se(S.node.type.name, d) && f.validContent(S.node.content) && i)
819
+ return c().command(() => (s.setNodeMarkup(S.pos, f), !0)).command(() => U(s, f)).command(() => G(s, f)).run();
820
820
  }
821
- return !n || !B || !i ? c().command(() => u().wrapInList(p, o) ? !0 : d.clearNodes()).wrapInList(p, o).command(() => _(s, p)).command(() => J(s, p)).run() : c().command(() => {
822
- const T = u().wrapInList(p, o), v = B.filter((K) => f.includes(K.type.name));
823
- return s.ensureMarks(v), T ? !0 : d.clearNodes();
824
- }).wrapInList(p, o).command(() => _(s, p)).command(() => J(s, p)).run();
825
- }, un = (e, t = {}, n = {}) => ({ state: o, commands: r }) => {
821
+ return !n || !T || !i ? c().command(() => p().wrapInList(f, o) ? !0 : l.clearNodes()).wrapInList(f, o).command(() => U(s, f)).command(() => G(s, f)).run() : c().command(() => {
822
+ const A = p().wrapInList(f, o), v = T.filter((V) => u.includes(V.type.name));
823
+ return s.ensureMarks(v), A ? !0 : l.clearNodes();
824
+ }).wrapInList(f, o).command(() => U(s, f)).command(() => G(s, f)).run();
825
+ }, fn = (e, t = {}, n = {}) => ({ state: o, commands: r }) => {
826
826
  const { extendEmptyMarkRange: s = !1 } = n, a = $(e, o.schema);
827
- return Zt(o, a, t) ? r.unsetMark(a, { extendEmptyMarkRange: s }) : r.setMark(a, t);
828
- }, fn = (e, t, n = {}) => ({ state: o, commands: r }) => {
829
- const s = y(e, o.schema), a = y(t, o.schema);
830
- return Y(o, s, n) ? r.setNode(a) : r.setNode(s, n);
831
- }, pn = (e, t = {}) => ({ state: n, commands: o }) => {
832
- const r = y(e, n.schema);
833
- return Y(n, r, t) ? o.lift(r) : o.wrapIn(r, t);
834
- }, mn = () => ({ state: e, dispatch: t }) => {
827
+ return en(o, a, t) ? r.unsetMark(a, { extendEmptyMarkRange: s }) : r.setMark(a, t);
828
+ }, pn = (e, t, n = {}) => ({ state: o, commands: r }) => {
829
+ const s = x(e, o.schema), a = x(t, o.schema);
830
+ return ee(o, s, n) ? r.setNode(a) : r.setNode(s, n);
831
+ }, mn = (e, t = {}) => ({ state: n, commands: o }) => {
832
+ const r = x(e, n.schema);
833
+ return ee(n, r, t) ? o.lift(r) : o.wrapIn(r, t);
834
+ }, hn = () => ({ state: e, dispatch: t }) => {
835
835
  const n = e.plugins;
836
836
  for (let o = 0; o < n.length; o += 1) {
837
837
  const r = n[o];
@@ -851,122 +851,122 @@ const cn = ({ keepMarks: e = !0 } = {}) => ({ tr: t, state: n, dispatch: o, edit
851
851
  }
852
852
  }
853
853
  return !1;
854
- }, hn = () => ({ tr: e, dispatch: t }) => {
854
+ }, gn = () => ({ tr: e, dispatch: t }) => {
855
855
  const { selection: n } = e, { empty: o, ranges: r } = n;
856
856
  return o || t && r.forEach((s) => {
857
857
  e.removeMark(s.$from.pos, s.$to.pos);
858
858
  }), !0;
859
- }, gn = (e, t = {}) => ({ tr: n, state: o, dispatch: r }) => {
859
+ }, kn = (e, t = {}) => ({ tr: n, state: o, dispatch: r }) => {
860
860
  var s;
861
- const { extendEmptyMarkRange: a = !1 } = t, { selection: i } = n, c = $(e, o.schema), { $from: d, empty: u, ranges: l } = i;
861
+ const { extendEmptyMarkRange: a = !1 } = t, { selection: i } = n, c = $(e, o.schema), { $from: l, empty: p, ranges: d } = i;
862
862
  if (!r)
863
863
  return !0;
864
- if (u && a) {
865
- let { from: f, to: p } = i;
866
- const m = (s = d.marks().find((g) => g.type === c)) === null || s === void 0 ? void 0 : s.attrs, h = me(d, c, m);
867
- h && (f = h.from, p = h.to), n.removeMark(f, p, c);
864
+ if (p && a) {
865
+ let { from: u, to: f } = i;
866
+ const m = (s = l.marks().find((g) => g.type === c)) === null || s === void 0 ? void 0 : s.attrs, h = ge(l, c, m);
867
+ h && (u = h.from, f = h.to), n.removeMark(u, f, c);
868
868
  } else
869
- l.forEach((f) => {
870
- n.removeMark(f.$from.pos, f.$to.pos, c);
869
+ d.forEach((u) => {
870
+ n.removeMark(u.$from.pos, u.$to.pos, c);
871
871
  });
872
872
  return n.removeStoredMark(c), !0;
873
- }, kn = (e, t = {}) => ({ tr: n, state: o, dispatch: r }) => {
873
+ }, yn = (e, t = {}) => ({ tr: n, state: o, dispatch: r }) => {
874
874
  let s = null, a = null;
875
- const i = ye(typeof e == "string" ? e : e.name, o.schema);
876
- return i ? (i === "node" && (s = y(e, o.schema)), i === "mark" && (a = $(e, o.schema)), r && n.selection.ranges.forEach((c) => {
877
- const d = c.$from.pos, u = c.$to.pos;
878
- o.doc.nodesBetween(d, u, (l, f) => {
879
- s && s === l.type && n.setNodeMarkup(f, void 0, {
880
- ...l.attrs,
875
+ const i = xe(typeof e == "string" ? e : e.name, o.schema);
876
+ return i ? (i === "node" && (s = x(e, o.schema)), i === "mark" && (a = $(e, o.schema)), r && n.selection.ranges.forEach((c) => {
877
+ const l = c.$from.pos, p = c.$to.pos;
878
+ o.doc.nodesBetween(l, p, (d, u) => {
879
+ s && s === d.type && n.setNodeMarkup(u, void 0, {
880
+ ...d.attrs,
881
881
  ...t
882
- }), a && l.marks.length && l.marks.forEach((p) => {
883
- if (a === p.type) {
884
- const m = Math.max(f, d), h = Math.min(f + l.nodeSize, u);
882
+ }), a && d.marks.length && d.marks.forEach((f) => {
883
+ if (a === f.type) {
884
+ const m = Math.max(u, l), h = Math.min(u + d.nodeSize, p);
885
885
  n.addMark(m, h, a.create({
886
- ...p.attrs,
886
+ ...f.attrs,
887
887
  ...t
888
888
  }));
889
889
  }
890
890
  });
891
891
  });
892
892
  }), !0) : !1;
893
- }, yn = (e, t = {}) => ({ state: n, dispatch: o }) => {
894
- const r = y(e, n.schema);
895
- return Ve(r, t)(n, o);
896
893
  }, wn = (e, t = {}) => ({ state: n, dispatch: o }) => {
897
- const r = y(e, n.schema);
898
- return Ue(r, t)(n, o);
894
+ const r = x(e, n.schema);
895
+ return _e(r, t)(n, o);
896
+ }, xn = (e, t = {}) => ({ state: n, dispatch: o }) => {
897
+ const r = x(e, n.schema);
898
+ return Ge(r, t)(n, o);
899
899
  };
900
- var xn = /* @__PURE__ */ Object.freeze({
900
+ var Sn = /* @__PURE__ */ Object.freeze({
901
901
  __proto__: null,
902
- blur: rt,
903
- clearContent: st,
904
- clearNodes: it,
905
- command: at,
906
- createParagraphNear: ct,
907
- cut: lt,
908
- deleteCurrentNode: dt,
909
- deleteNode: ut,
910
- deleteRange: ft,
911
- deleteSelection: pt,
912
- enter: mt,
913
- exitCode: ht,
914
- extendMarkRange: kt,
915
- first: yt,
916
- focus: xt,
917
- forEach: St,
918
- insertContent: bt,
919
- insertContentAt: Tt,
920
- joinUp: Ct,
921
- joinDown: Et,
922
- joinBackward: Bt,
923
- joinForward: vt,
924
- joinItemBackward: $t,
925
- joinItemForward: It,
926
- joinTextblockBackward: Pt,
927
- joinTextblockForward: Nt,
928
- keyboardShortcut: jt,
929
- lift: Ft,
930
- liftEmptyBlock: Lt,
931
- liftListItem: Rt,
902
+ blur: st,
903
+ clearContent: it,
904
+ clearNodes: at,
905
+ command: ct,
906
+ createParagraphNear: lt,
907
+ cut: dt,
908
+ deleteCurrentNode: ut,
909
+ deleteNode: ft,
910
+ deleteRange: pt,
911
+ deleteSelection: mt,
912
+ enter: ht,
913
+ exitCode: gt,
914
+ extendMarkRange: yt,
915
+ first: wt,
916
+ focus: St,
917
+ forEach: bt,
918
+ insertContent: Mt,
919
+ insertContentAt: Ct,
920
+ joinUp: Et,
921
+ joinDown: Bt,
922
+ joinBackward: vt,
923
+ joinForward: $t,
924
+ joinItemBackward: It,
925
+ joinItemForward: Pt,
926
+ joinTextblockBackward: Nt,
927
+ joinTextblockForward: Ot,
928
+ keyboardShortcut: Ft,
929
+ lift: Lt,
930
+ liftEmptyBlock: Rt,
931
+ liftListItem: zt,
932
932
  newlineInCode: Dt,
933
- resetAttributes: zt,
934
- scrollIntoView: Wt,
935
- selectAll: Ht,
936
- selectNodeBackward: Kt,
937
- selectNodeForward: Vt,
938
- selectParentNode: _t,
939
- selectTextblockEnd: Jt,
940
- selectTextblockStart: Ut,
941
- setContent: qt,
942
- setMark: tn,
943
- setMeta: nn,
944
- setNode: on,
945
- setNodeSelection: rn,
946
- setTextSelection: sn,
947
- sinkListItem: an,
948
- splitBlock: cn,
949
- splitListItem: ln,
950
- toggleList: dn,
951
- toggleMark: un,
952
- toggleNode: fn,
953
- toggleWrap: pn,
954
- undoInputRule: mn,
955
- unsetAllMarks: hn,
956
- unsetMark: gn,
957
- updateAttributes: kn,
958
- wrapIn: yn,
959
- wrapInList: wn
933
+ resetAttributes: Wt,
934
+ scrollIntoView: Ht,
935
+ selectAll: Kt,
936
+ selectNodeBackward: Vt,
937
+ selectNodeForward: _t,
938
+ selectParentNode: Jt,
939
+ selectTextblockEnd: Ut,
940
+ selectTextblockStart: Gt,
941
+ setContent: Qt,
942
+ setMark: nn,
943
+ setMeta: on,
944
+ setNode: rn,
945
+ setNodeSelection: sn,
946
+ setTextSelection: an,
947
+ sinkListItem: cn,
948
+ splitBlock: ln,
949
+ splitListItem: dn,
950
+ toggleList: un,
951
+ toggleMark: fn,
952
+ toggleNode: pn,
953
+ toggleWrap: mn,
954
+ undoInputRule: hn,
955
+ unsetAllMarks: gn,
956
+ unsetMark: kn,
957
+ updateAttributes: yn,
958
+ wrapIn: wn,
959
+ wrapInList: xn
960
960
  });
961
- C.create({
961
+ B.create({
962
962
  name: "commands",
963
963
  addCommands() {
964
964
  return {
965
- ...xn
965
+ ...Sn
966
966
  };
967
967
  }
968
968
  });
969
- C.create({
969
+ B.create({
970
970
  name: "editable",
971
971
  addProseMirrorPlugins() {
972
972
  return [
@@ -979,7 +979,7 @@ C.create({
979
979
  ];
980
980
  }
981
981
  });
982
- C.create({
982
+ B.create({
983
983
  name: "focusEvents",
984
984
  addProseMirrorPlugins() {
985
985
  const { editor: e } = this;
@@ -1004,15 +1004,15 @@ C.create({
1004
1004
  ];
1005
1005
  }
1006
1006
  });
1007
- C.create({
1007
+ B.create({
1008
1008
  name: "keymap",
1009
1009
  addKeyboardShortcuts() {
1010
1010
  const e = () => this.editor.commands.first(({ commands: a }) => [
1011
1011
  () => a.undoInputRule(),
1012
1012
  // maybe convert first text block node to default node
1013
1013
  () => a.command(({ tr: i }) => {
1014
- const { selection: c, doc: d } = i, { empty: u, $anchor: l } = c, { pos: f, parent: p } = l, m = l.parent.isTextblock && f > 0 ? i.doc.resolve(f - 1) : l, h = m.parent.type.spec.isolating, g = l.pos - l.parentOffset, k = h && m.parent.childCount === 1 ? g === l.pos : O.atStart(d).from === f;
1015
- return !u || !k || !p.type.isTextblock || p.textContent.length ? !1 : a.clearNodes();
1014
+ const { selection: c, doc: l } = i, { empty: p, $anchor: d } = c, { pos: u, parent: f } = d, m = d.parent.isTextblock && u > 0 ? i.doc.resolve(u - 1) : d, h = m.parent.type.spec.isolating, g = d.pos - d.parentOffset, k = h && m.parent.childCount === 1 ? g === d.pos : O.atStart(l).from === u;
1015
+ return !p || !k || !f.type.isTextblock || f.textContent.length ? !1 : a.clearNodes();
1016
1016
  }),
1017
1017
  () => a.deleteSelection(),
1018
1018
  () => a.joinBackward(),
@@ -1049,7 +1049,7 @@ C.create({
1049
1049
  "Ctrl-a": () => this.editor.commands.selectTextblockStart(),
1050
1050
  "Ctrl-e": () => this.editor.commands.selectTextblockEnd()
1051
1051
  };
1052
- return X() || ke() ? s : r;
1052
+ return Z() || we() ? s : r;
1053
1053
  },
1054
1054
  addProseMirrorPlugins() {
1055
1055
  return [
@@ -1066,21 +1066,21 @@ C.create({
1066
1066
  const { empty: r, from: s, to: a } = t.selection, i = O.atStart(t.doc).from, c = O.atEnd(t.doc).to;
1067
1067
  if (r || !(s === i && a === c) || !(n.doc.textBetween(0, n.doc.content.size, " ", " ").length === 0))
1068
1068
  return;
1069
- const l = n.tr, f = pe({
1069
+ const d = n.tr, u = he({
1070
1070
  state: n,
1071
- transaction: l
1072
- }), { commands: p } = new qe({
1071
+ transaction: d
1072
+ }), { commands: f } = new Qe({
1073
1073
  editor: this.editor,
1074
- state: f
1074
+ state: u
1075
1075
  });
1076
- if (p.clearNodes(), !!l.steps.length)
1077
- return l;
1076
+ if (f.clearNodes(), !!d.steps.length)
1077
+ return d;
1078
1078
  }
1079
1079
  })
1080
1080
  ];
1081
1081
  }
1082
1082
  });
1083
- C.create({
1083
+ B.create({
1084
1084
  name: "tabindex",
1085
1085
  addProseMirrorPlugins() {
1086
1086
  return [
@@ -1093,18 +1093,18 @@ C.create({
1093
1093
  ];
1094
1094
  }
1095
1095
  });
1096
- function ie(e) {
1097
- return new et({
1096
+ function ae(e) {
1097
+ return new tt({
1098
1098
  find: e.find,
1099
1099
  handler: ({ state: t, range: n, match: o }) => {
1100
- const r = t.doc.resolve(n.from), s = x(e.getAttributes, void 0, o) || {};
1100
+ const r = t.doc.resolve(n.from), s = M(e.getAttributes, void 0, o) || {};
1101
1101
  if (!r.node(-1).canReplaceWith(r.index(-1), r.indexAfter(-1), e.type))
1102
1102
  return null;
1103
1103
  t.tr.delete(n.from, n.to).setBlockType(n.from, n.from, e.type, s);
1104
1104
  }
1105
1105
  });
1106
1106
  }
1107
- class H {
1107
+ class K {
1108
1108
  constructor(t = {}) {
1109
1109
  this.type = "node", this.name = "node", this.parent = null, this.child = null, this.config = {
1110
1110
  name: this.name,
@@ -1112,34 +1112,34 @@ class H {
1112
1112
  }, this.config = {
1113
1113
  ...this.config,
1114
1114
  ...t
1115
- }, this.name = this.config.name, t.defaultOptions && Object.keys(t.defaultOptions).length > 0 && console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`), this.options = this.config.defaultOptions, this.config.addOptions && (this.options = x(w(this, "addOptions", {
1115
+ }, this.name = this.config.name, t.defaultOptions && Object.keys(t.defaultOptions).length > 0 && console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`), this.options = this.config.defaultOptions, this.config.addOptions && (this.options = M(b(this, "addOptions", {
1116
1116
  name: this.name
1117
- }))), this.storage = x(w(this, "addStorage", {
1117
+ }))), this.storage = M(b(this, "addStorage", {
1118
1118
  name: this.name,
1119
1119
  options: this.options
1120
1120
  })) || {};
1121
1121
  }
1122
1122
  static create(t = {}) {
1123
- return new H(t);
1123
+ return new K(t);
1124
1124
  }
1125
1125
  configure(t = {}) {
1126
1126
  const n = this.extend();
1127
- return n.options = Q(this.options, t), n.storage = x(w(n, "addStorage", {
1127
+ return n.options = Y(this.options, t), n.storage = M(b(n, "addStorage", {
1128
1128
  name: n.name,
1129
1129
  options: n.options
1130
1130
  })), n;
1131
1131
  }
1132
1132
  extend(t = {}) {
1133
- const n = new H({ ...this.config, ...t });
1134
- return n.parent = this, this.child = n, n.name = t.name ? t.name : n.parent.name, t.defaultOptions && console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${n.name}".`), n.options = x(w(n, "addOptions", {
1133
+ const n = new K({ ...this.config, ...t });
1134
+ return n.parent = this, this.child = n, n.name = t.name ? t.name : n.parent.name, t.defaultOptions && console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${n.name}".`), n.options = M(b(n, "addOptions", {
1135
1135
  name: n.name
1136
- })), n.storage = x(w(n, "addStorage", {
1136
+ })), n.storage = M(b(n, "addStorage", {
1137
1137
  name: n.name,
1138
1138
  options: n.options
1139
1139
  })), n;
1140
1140
  }
1141
1141
  }
1142
- const Sn = /^```([a-z]+)?[\s\n]$/, bn = /^~~~([a-z]+)?[\s\n]$/, Mn = H.create({
1142
+ const bn = /^```([a-z]+)?[\s\n]$/, Mn = /^~~~([a-z]+)?[\s\n]$/, Tn = K.create({
1143
1143
  name: "codeBlock",
1144
1144
  addOptions() {
1145
1145
  return {
@@ -1178,7 +1178,7 @@ const Sn = /^```([a-z]+)?[\s\n]$/, bn = /^~~~([a-z]+)?[\s\n]$/, Mn = H.create({
1178
1178
  renderHTML({ node: e, HTMLAttributes: t }) {
1179
1179
  return [
1180
1180
  "pre",
1181
- Xe(this.options.HTMLAttributes, t),
1181
+ Ye(this.options.HTMLAttributes, t),
1182
1182
  [
1183
1183
  "code",
1184
1184
  {
@@ -1228,15 +1228,15 @@ const Sn = /^```([a-z]+)?[\s\n]$/, bn = /^~~~([a-z]+)?[\s\n]$/, Mn = H.create({
1228
1228
  },
1229
1229
  addInputRules() {
1230
1230
  return [
1231
- ie({
1232
- find: Sn,
1231
+ ae({
1232
+ find: bn,
1233
1233
  type: this.type,
1234
1234
  getAttributes: (e) => ({
1235
1235
  language: e[1]
1236
1236
  })
1237
1237
  }),
1238
- ie({
1239
- find: bn,
1238
+ ae({
1239
+ find: Mn,
1240
1240
  type: this.type,
1241
1241
  getAttributes: (e) => ({
1242
1242
  language: e[1]
@@ -1258,7 +1258,7 @@ const Sn = /^```([a-z]+)?[\s\n]$/, bn = /^~~~([a-z]+)?[\s\n]$/, Mn = H.create({
1258
1258
  if (!n || !s)
1259
1259
  return !1;
1260
1260
  const { tr: a } = e.state;
1261
- return a.replaceSelectionWith(this.type.create({ language: s })), a.setSelection(b.near(a.doc.resolve(Math.max(0, a.selection.from - 2)))), a.insertText(n.replace(/\r\n?/g, `
1261
+ return a.replaceSelectionWith(this.type.create({ language: s })), a.setSelection(C.near(a.doc.resolve(Math.max(0, a.selection.from - 2)))), a.insertText(n.replace(/\r\n?/g, `
1262
1262
  `)), a.setMeta("paste", !0), e.dispatch(a), !0;
1263
1263
  }
1264
1264
  }
@@ -1266,92 +1266,129 @@ const Sn = /^```([a-z]+)?[\s\n]$/, bn = /^~~~([a-z]+)?[\s\n]$/, Mn = H.create({
1266
1266
  ];
1267
1267
  }
1268
1268
  });
1269
- let A, j;
1270
- const U = /* @__PURE__ */ new Set(), G = /* @__PURE__ */ new Set();
1269
+ let E, j;
1270
+ const q = /* @__PURE__ */ new Set(), Q = /* @__PURE__ */ new Set();
1271
1271
  function An() {
1272
- return A;
1272
+ return E;
1273
1273
  }
1274
- function Tn(e) {
1275
- if (!A && !j) {
1274
+ function Cn(e) {
1275
+ if (!E && !j) {
1276
1276
  const t = e.themes.filter(
1277
- (o) => !!o && o in ue
1277
+ (o) => !!o && o in pe
1278
1278
  ), n = e.languages.filter(
1279
- (o) => !!o && o in fe
1279
+ (o) => !!o && o in me
1280
1280
  );
1281
- return j = Ge({ themes: t, langs: n }).then((o) => {
1282
- A = o;
1281
+ return j = qe({ themes: t, langs: n }).then((o) => {
1282
+ E = o;
1283
1283
  }), j;
1284
1284
  }
1285
1285
  if (j)
1286
1286
  return j;
1287
1287
  }
1288
- async function we(e) {
1289
- return A && !A.getLoadedThemes().includes(e) && !G.has(e) && e in ue ? (G.add(e), await A.loadTheme(e), G.delete(e), !0) : !1;
1288
+ async function D(e) {
1289
+ return E && !E.getLoadedThemes().includes(e) && !Q.has(e) && e in pe ? (Q.add(e), await E.loadTheme(e), Q.delete(e), !0) : !1;
1290
1290
  }
1291
- async function xe(e) {
1292
- return A && !A.getLoadedLanguages().includes(e) && !U.has(e) && e in fe ? (U.add(e), await A.loadLanguage(e), U.delete(e), !0) : !1;
1291
+ async function Se(e) {
1292
+ return E && !E.getLoadedLanguages().includes(e) && !q.has(e) && e in me ? (q.add(e), await E.loadLanguage(e), q.delete(e), !0) : !1;
1293
1293
  }
1294
- async function Cn({
1294
+ async function En({
1295
1295
  doc: e,
1296
1296
  name: t,
1297
1297
  defaultTheme: n,
1298
- defaultLanguage: o
1298
+ defaultLanguage: o,
1299
+ themeModes: r
1299
1300
  }) {
1300
- const r = F(e, (i) => i.type.name === t), s = [
1301
- ...r.map((i) => i.node.attrs.theme),
1301
+ const s = F(e, (c) => c.type.name === t), a = [
1302
+ ...s.map((c) => c.node.attrs.theme),
1302
1303
  n
1303
- ], a = [
1304
- ...r.map((i) => i.node.attrs.language),
1304
+ ], i = [
1305
+ ...s.map((c) => c.node.attrs.language),
1305
1306
  o
1306
1307
  ];
1307
- A ? await Promise.all([
1308
- ...s.flatMap((i) => we(i)),
1309
- ...a.flatMap((i) => !!i && xe(i))
1310
- ]) : await Tn({ languages: a, themes: s });
1308
+ if (E)
1309
+ await Promise.all([
1310
+ ...a.flatMap((c) => D(c)),
1311
+ ...i.flatMap((c) => !!c && Se(c))
1312
+ ]);
1313
+ else {
1314
+ const c = [...a];
1315
+ r && (r.light && !c.includes(r.light) && c.push(r.light), r.dark && !c.includes(r.dark) && c.push(r.dark)), await Cn({
1316
+ languages: i,
1317
+ themes: c
1318
+ });
1319
+ }
1320
+ }
1321
+ function ce(e) {
1322
+ return Object.entries(e || {}).map(([t, n]) => `${t}:${n}`).join(";");
1311
1323
  }
1312
- function ae({
1324
+ function le({
1313
1325
  doc: e,
1314
1326
  name: t,
1315
1327
  defaultTheme: n,
1316
- defaultLanguage: o
1328
+ defaultLanguage: o,
1329
+ themes: r
1317
1330
  }) {
1318
- const r = [];
1319
- return F(e, (a) => a.type.name === t).forEach((a) => {
1320
- let i = a.pos + 1, c = a.node.attrs.language || o, d = a.node.attrs.theme || n;
1321
- const u = An();
1322
- if (!u)
1331
+ const s = [];
1332
+ return F(e, (i) => i.type.name === t).forEach((i) => {
1333
+ var g, k;
1334
+ let c = i.pos + 1, l = i.node.attrs.language || o, p = i.node.attrs.theme || n, d = ((g = i.node.attrs.themes) == null ? void 0 : g.light) || (r == null ? void 0 : r.light), u = ((k = i.node.attrs.themes) == null ? void 0 : k.dark) || (r == null ? void 0 : r.dark);
1335
+ const f = An();
1336
+ if (!f)
1323
1337
  return;
1324
- u.getLoadedLanguages().includes(c) || (c = "plaintext");
1325
- const l = u.getLoadedThemes().includes(d) ? d : u.getLoadedThemes()[0], f = u.getTheme(l);
1326
- r.push(
1327
- ee.node(a.pos, a.pos + a.node.nodeSize, {
1328
- style: `background-color: ${f.bg}`
1329
- })
1330
- );
1331
- const p = u.codeToTokensBase(a.node.textContent, {
1332
- lang: c,
1333
- theme: l
1334
- });
1335
- for (const m of p) {
1336
- for (const h of m) {
1337
- const g = i + h.content.length, k = ee.inline(i, g, {
1338
- style: `color: ${h.color}`
1338
+ f.getLoadedLanguages().includes(l) || (l = "plaintext");
1339
+ const m = (y) => f.getLoadedThemes().includes(y) ? y : f.getLoadedThemes()[0];
1340
+ let h;
1341
+ if (r) {
1342
+ h = f.codeToTokens(i.node.textContent, {
1343
+ lang: l,
1344
+ themes: {
1345
+ light: m(d),
1346
+ dark: m(u)
1347
+ }
1348
+ });
1349
+ const y = {};
1350
+ h.bg && (y["background-color"] = h.bg), h.fg && (y.color = h.fg), s.push(
1351
+ _.node(i.pos, i.pos + i.node.nodeSize, {
1352
+ style: ce(y),
1353
+ class: "shiki"
1354
+ })
1355
+ );
1356
+ } else {
1357
+ h = f.codeToTokens(i.node.textContent, {
1358
+ lang: l,
1359
+ theme: m(p)
1360
+ });
1361
+ const y = f.getLoadedThemes().includes(p) ? p : f.getLoadedThemes()[0], w = f.getTheme(y);
1362
+ s.push(
1363
+ _.node(i.pos, i.pos + i.node.nodeSize, {
1364
+ style: `background-color: ${w.bg}`
1365
+ })
1366
+ );
1367
+ }
1368
+ for (const y of h.tokens) {
1369
+ for (const w of y) {
1370
+ const T = c + w.content.length;
1371
+ let S = "";
1372
+ r ? S = ce(w.htmlStyle || {}) : S = `color: ${w.color}`;
1373
+ const A = _.inline(c, T, {
1374
+ style: S
1339
1375
  });
1340
- r.push(k), i = g;
1376
+ s.push(A), c = T;
1341
1377
  }
1342
- i += 1;
1378
+ c += 1;
1343
1379
  }
1344
- }), Se.create(e, r);
1380
+ }), be.create(e, s);
1345
1381
  }
1346
- function En({
1382
+ function Bn({
1347
1383
  name: e,
1348
1384
  defaultLanguage: t,
1349
- defaultTheme: n
1385
+ defaultTheme: n,
1386
+ themes: o
1350
1387
  }) {
1351
- const o = new P({
1388
+ const r = new P({
1352
1389
  key: new N("shiki"),
1353
- view(r) {
1354
- class s {
1390
+ view(s) {
1391
+ class a {
1355
1392
  constructor() {
1356
1393
  this.initDecorations();
1357
1394
  }
@@ -1362,77 +1399,88 @@ function En({
1362
1399
  }
1363
1400
  // Initialize shiki async, and then highlight initial document
1364
1401
  async initDecorations() {
1365
- const i = r.state.doc;
1366
- await Cn({ doc: i, name: e, defaultLanguage: t, defaultTheme: n });
1367
- const c = r.state.tr.setMeta("shikiPluginForceDecoration", !0);
1368
- r.dispatch(c);
1402
+ const c = s.state.doc;
1403
+ await En({
1404
+ doc: c,
1405
+ name: e,
1406
+ defaultLanguage: t,
1407
+ defaultTheme: n,
1408
+ themeModes: o
1409
+ });
1410
+ const l = s.state.tr.setMeta("shikiPluginForceDecoration", !0);
1411
+ s.dispatch(l);
1369
1412
  }
1370
1413
  // When new codeblocks were added and they have missing themes or
1371
1414
  // languages, load those and then add code decorations once again.
1372
1415
  async checkUndecoratedBlocks() {
1373
- const i = F(
1374
- r.state.doc,
1416
+ const c = F(
1417
+ s.state.doc,
1375
1418
  (u) => u.type.name === e
1376
- );
1419
+ ), l = (u) => {
1420
+ var m, h;
1421
+ const f = [Se(u.node.attrs.language)];
1422
+ return o ? (f.push(
1423
+ D(((m = u.node.attrs.themes) == null ? void 0 : m.light) || o.light)
1424
+ ), f.push(D(((h = u.node.attrs.themes) == null ? void 0 : h.dark) || o.dark))) : f.push(D(u.node.attrs.theme)), f;
1425
+ };
1377
1426
  if ((await Promise.all(
1378
- i.flatMap((u) => [
1379
- we(u.node.attrs.theme),
1380
- xe(u.node.attrs.language)
1381
- ])
1427
+ c.flatMap((u) => l(u))
1382
1428
  )).includes(!0)) {
1383
- const u = r.state.tr.setMeta("shikiPluginForceDecoration", !0);
1384
- r.dispatch(u);
1429
+ const u = s.state.tr.setMeta("shikiPluginForceDecoration", !0);
1430
+ s.dispatch(u);
1385
1431
  }
1386
1432
  }
1387
1433
  }
1388
- return new s();
1434
+ return new a();
1389
1435
  },
1390
1436
  state: {
1391
- init: (r, { doc: s }) => ae({
1392
- doc: s,
1437
+ init: (s, { doc: a }) => le({
1438
+ doc: a,
1393
1439
  name: e,
1394
1440
  defaultLanguage: t,
1395
- defaultTheme: n
1441
+ defaultTheme: n,
1442
+ themes: o
1396
1443
  }),
1397
- apply: (r, s, a, i) => {
1398
- const c = a.selection.$head.parent.type.name, d = i.selection.$head.parent.type.name, u = F(
1399
- a.doc,
1400
- (p) => p.type.name === e
1401
- ), l = F(
1444
+ apply: (s, a, i, c) => {
1445
+ const l = i.selection.$head.parent.type.name, p = c.selection.$head.parent.type.name, d = F(
1402
1446
  i.doc,
1403
- (p) => p.type.name === e
1404
- ), f = r.docChanged && // Apply decorations if:
1447
+ (m) => m.type.name === e
1448
+ ), u = F(
1449
+ c.doc,
1450
+ (m) => m.type.name === e
1451
+ ), f = s.docChanged && // Apply decorations if:
1405
1452
  // selection includes named node,
1406
- ([c, d].includes(e) || // OR transaction adds/removes named node,
1407
- l.length !== u.length || // OR transaction has changes that completely encapsulte a node
1453
+ ([l, p].includes(e) || // OR transaction adds/removes named node,
1454
+ u.length !== d.length || // OR transaction has changes that completely encapsulte a node
1408
1455
  // (for example, a transaction that affects the entire document).
1409
1456
  // Such transactions can happen during collab syncing via y-prosemirror, for example.
1410
- r.steps.some((p) => (
1457
+ s.steps.some((m) => (
1411
1458
  // @ts-ignore
1412
- p.from !== void 0 && // @ts-ignore
1413
- p.to !== void 0 && u.some((m) => (
1459
+ m.from !== void 0 && // @ts-ignore
1460
+ m.to !== void 0 && d.some((h) => (
1414
1461
  // @ts-ignore
1415
- m.pos >= p.from && // @ts-ignore
1416
- m.pos + m.node.nodeSize <= p.to
1462
+ h.pos >= m.from && // @ts-ignore
1463
+ h.pos + h.node.nodeSize <= m.to
1417
1464
  ))
1418
1465
  )));
1419
- return r.getMeta("shikiPluginForceDecoration") || f ? ae({
1420
- doc: r.doc,
1466
+ return s.getMeta("shikiPluginForceDecoration") || f ? le({
1467
+ doc: s.doc,
1421
1468
  name: e,
1422
1469
  defaultLanguage: t,
1423
- defaultTheme: n
1424
- }) : s.map(r.mapping, r.doc);
1470
+ defaultTheme: n,
1471
+ themes: o
1472
+ }) : a.map(s.mapping, s.doc);
1425
1473
  }
1426
1474
  },
1427
1475
  props: {
1428
- decorations(r) {
1429
- return o.getState(r);
1476
+ decorations(s) {
1477
+ return r.getState(s);
1430
1478
  }
1431
1479
  }
1432
1480
  });
1433
- return o;
1481
+ return r;
1434
1482
  }
1435
- const Fn = Mn.extend({
1483
+ const Ln = Tn.extend({
1436
1484
  addOptions() {
1437
1485
  var e;
1438
1486
  return {
@@ -1445,15 +1493,16 @@ const Fn = Mn.extend({
1445
1493
  var e;
1446
1494
  return [
1447
1495
  ...((e = this.parent) == null ? void 0 : e.call(this)) || [],
1448
- En({
1496
+ Bn({
1449
1497
  name: this.name,
1450
1498
  defaultLanguage: this.options.defaultLanguage,
1451
- defaultTheme: this.options.defaultTheme
1499
+ defaultTheme: this.options.defaultTheme,
1500
+ themes: this.options.themes
1452
1501
  })
1453
1502
  ];
1454
1503
  }
1455
1504
  });
1456
1505
  export {
1457
- Fn as CodeBlockShiki,
1458
- Fn as default
1506
+ Ln as CodeBlockShiki,
1507
+ Ln as default
1459
1508
  };