@milkdown/preset-commonmark 7.1.0 → 7.1.1

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.
package/lib/index.es.js CHANGED
@@ -1,107 +1,108 @@
1
- import { $markAttr as K, $markSchema as E, $command as p, $useKeymap as k, $node as te, $nodeAttr as y, $nodeSchema as M, $ctx as F, $inputRule as b, pipe as We, $prose as N, $remark as $ } from "@milkdown/utils";
1
+ import { $markAttr as K, $markSchema as B, $command as p, $useKeymap as k, $node as te, $nodeAttr as y, $nodeSchema as M, $ctx as F, $inputRule as b, pipe as We, $prose as v, $remark as $ } from "@milkdown/utils";
2
2
  import { commandsCtx as g, editorViewCtx as q, serializerCtx as qe, parserCtx as Fe } from "@milkdown/core";
3
- import { toggleMark as V, setBlockType as S, wrapIn as G } from "@milkdown/prose/commands";
4
- import { Fragment as re } from "@milkdown/prose/model";
5
- import { expectDomTypeError as w } from "@milkdown/exception";
6
- import { textblockTypeInputRule as ne, wrappingInputRule as j, InputRule as oe } from "@milkdown/prose/inputrules";
7
- import { TextSelection as ae, Selection as se, PluginKey as v, Plugin as C } from "@milkdown/prose/state";
8
- import { findSelectedNodeOfType as Ve } from "@milkdown/prose";
9
- import { sinkListItem as Ge, liftListItem as je, splitListItem as ze } from "@milkdown/prose/schema-list";
10
- import { ReplaceStep as Ue, AddMarkStep as Ye } from "@milkdown/prose/transform";
3
+ import { toggleMark as V, setBlockType as T, wrapIn as z } from "@milkdown/prose/commands";
4
+ import { Fragment as Ve } from "@milkdown/prose/model";
5
+ import { TextSelection as re, Selection as ne, PluginKey as C, Plugin as x } from "@milkdown/prose/state";
6
+ import { expectDomTypeError as N } from "@milkdown/exception";
7
+ import { textblockTypeInputRule as oe, wrappingInputRule as G, InputRule as ae } from "@milkdown/prose/inputrules";
8
+ import ze from "@sindresorhus/slugify";
9
+ import { findSelectedNodeOfType as Ge } from "@milkdown/prose";
10
+ import { sinkListItem as je, liftListItem as Ue, splitListItem as Ye } from "@milkdown/prose/schema-list";
11
+ import { ReplaceStep as Je, AddMarkStep as Qe } from "@milkdown/prose/transform";
11
12
  import { Decoration as Z, DecorationSet as ee } from "@milkdown/prose/view";
12
- import { visit as le } from "unist-util-visit";
13
- import Je from "remark-inline-links";
14
- const ce = K("emphasis"), ie = E("emphasis", (r) => ({
13
+ import { visit as se } from "unist-util-visit";
14
+ import Xe from "remark-inline-links";
15
+ const le = K("emphasis"), ce = B("emphasis", (t) => ({
15
16
  inclusive: !1,
16
17
  parseDOM: [
17
18
  { tag: "i" },
18
19
  { tag: "em" },
19
20
  { style: "font-style", getAttrs: (e) => e === "italic" }
20
21
  ],
21
- toDOM: (e) => ["em", r.get(ce.key)(e)],
22
+ toDOM: (e) => ["em", t.get(le.key)(e)],
22
23
  parseMarkdown: {
23
24
  match: (e) => e.type === "emphasis",
24
- runner: (e, t, n) => {
25
- e.openMark(n), e.next(t.children), e.closeMark(n);
25
+ runner: (e, r, n) => {
26
+ e.openMark(n), e.next(r.children), e.closeMark(n);
26
27
  }
27
28
  },
28
29
  toMarkdown: {
29
30
  match: (e) => e.type.name === "emphasis",
30
- runner: (e, t) => {
31
- e.withMark(t, "emphasis");
31
+ runner: (e, r) => {
32
+ e.withMark(r, "emphasis");
32
33
  }
33
34
  }
34
- })), ue = p("ToggleEmphasis", () => () => V(ie.type())), Qe = k("emphasisKeymap", {
35
+ })), ie = p("ToggleEmphasis", () => () => V(ce.type())), Ze = k("emphasisKeymap", {
35
36
  ToggleEmphasis: {
36
37
  shortcuts: "Mod-i",
37
- command: (r) => {
38
- const e = r.get(g);
39
- return () => e.call(ue.key);
38
+ command: (t) => {
39
+ const e = t.get(g);
40
+ return () => e.call(ie.key);
40
41
  }
41
42
  }
42
- }), de = K("strong"), me = E("strong", (r) => ({
43
+ }), de = K("strong"), ue = B("strong", (t) => ({
43
44
  inclusive: !1,
44
45
  parseDOM: [
45
46
  { tag: "b" },
46
47
  { tag: "strong" },
47
48
  { style: "font-style", getAttrs: (e) => e === "bold" }
48
49
  ],
49
- toDOM: (e) => ["strong", r.get(de.key)(e)],
50
+ toDOM: (e) => ["strong", t.get(de.key)(e)],
50
51
  parseMarkdown: {
51
52
  match: (e) => e.type === "strong",
52
- runner: (e, t, n) => {
53
- e.openMark(n), e.next(t.children), e.closeMark(n);
53
+ runner: (e, r, n) => {
54
+ e.openMark(n), e.next(r.children), e.closeMark(n);
54
55
  }
55
56
  },
56
57
  toMarkdown: {
57
58
  match: (e) => e.type.name === "strong",
58
- runner: (e, t) => {
59
- e.withMark(t, "strong");
59
+ runner: (e, r) => {
60
+ e.withMark(r, "strong");
60
61
  }
61
62
  }
62
- })), pe = p("ToggleStrong", () => () => V(me.type())), Xe = k("strongKeymap", {
63
+ })), me = p("ToggleStrong", () => () => V(ue.type())), et = k("strongKeymap", {
63
64
  ToggleBold: {
64
65
  shortcuts: ["Mod-b"],
65
- command: (r) => {
66
- const e = r.get(g);
67
- return () => e.call(pe.key);
66
+ command: (t) => {
67
+ const e = t.get(g);
68
+ return () => e.call(me.key);
68
69
  }
69
70
  }
70
- }), ge = K("inlineCode"), x = E("inlineCode", (r) => ({
71
+ }), pe = K("inlineCode"), A = B("inlineCode", (t) => ({
71
72
  priority: 100,
72
73
  code: !0,
73
74
  inclusive: !1,
74
75
  parseDOM: [{ tag: "code" }],
75
- toDOM: (e) => ["code", r.get(ge.key)(e)],
76
+ toDOM: (e) => ["code", t.get(pe.key)(e)],
76
77
  parseMarkdown: {
77
78
  match: (e) => e.type === "inlineCode",
78
- runner: (e, t, n) => {
79
- e.openMark(n), e.addText(t.value), e.closeMark(n);
79
+ runner: (e, r, n) => {
80
+ e.openMark(n), e.addText(r.value), e.closeMark(n);
80
81
  }
81
82
  },
82
83
  toMarkdown: {
83
84
  match: (e) => e.type.name === "inlineCode",
84
- runner: (e, t, n) => {
85
- e.withMark(t, "inlineCode", n.text || "");
85
+ runner: (e, r, n) => {
86
+ e.withMark(r, "inlineCode", n.text || "");
86
87
  }
87
88
  }
88
- })), fe = p("ToggleInlineCode", () => () => (r, e) => {
89
- const { selection: t, tr: n } = r;
90
- if (t.empty)
89
+ })), ge = p("ToggleInlineCode", () => () => (t, e) => {
90
+ const { selection: r, tr: n } = t;
91
+ if (r.empty)
91
92
  return !1;
92
- const { from: o, to: a } = t;
93
- return r.doc.rangeHasMark(o, a, x.type()) ? (e == null || e(n.removeMark(o, a, x.type())), !0) : (Object.keys(r.schema.marks).filter((c) => c !== x.type.name).map((c) => r.schema.marks[c]).forEach((c) => {
93
+ const { from: o, to: a } = r;
94
+ return t.doc.rangeHasMark(o, a, A.type()) ? (e == null || e(n.removeMark(o, a, A.type())), !0) : (Object.keys(t.schema.marks).filter((c) => c !== A.type.name).map((c) => t.schema.marks[c]).forEach((c) => {
94
95
  n.removeMark(o, a, c);
95
- }), e == null || e(n.addMark(o, a, x.type().create())), !0);
96
- }), Ze = k("inlineCodeKeymap", {
96
+ }), e == null || e(n.addMark(o, a, A.type().create())), !0);
97
+ }), tt = k("inlineCodeKeymap", {
97
98
  ToggleInlineCode: {
98
99
  shortcuts: "Mod-e",
99
- command: (r) => {
100
- const e = r.get(g);
101
- return () => e.call(fe.key);
100
+ command: (t) => {
101
+ const e = t.get(g);
102
+ return () => e.call(ge.key);
102
103
  }
103
104
  }
104
- }), he = K("link"), A = E("link", (r) => ({
105
+ }), fe = K("link"), L = B("link", (t) => ({
105
106
  attrs: {
106
107
  href: {},
107
108
  title: { default: null }
@@ -111,94 +112,96 @@ const ce = K("emphasis"), ie = E("emphasis", (r) => ({
111
112
  tag: "a[href]",
112
113
  getAttrs: (e) => {
113
114
  if (!(e instanceof HTMLElement))
114
- throw w(e);
115
+ throw N(e);
115
116
  return { href: e.getAttribute("href"), title: e.getAttribute("title") };
116
117
  }
117
118
  }
118
119
  ],
119
- toDOM: (e) => ["a", { ...r.get(he.key)(e), ...e.attrs }],
120
+ toDOM: (e) => ["a", { ...t.get(fe.key)(e), ...e.attrs }],
120
121
  parseMarkdown: {
121
122
  match: (e) => e.type === "link",
122
- runner: (e, t, n) => {
123
- const o = t.url, a = t.title;
124
- e.openMark(n, { href: o, title: a }), e.next(t.children), e.closeMark(n);
123
+ runner: (e, r, n) => {
124
+ const o = r.url, a = r.title;
125
+ e.openMark(n, { href: o, title: a }), e.next(r.children), e.closeMark(n);
125
126
  }
126
127
  },
127
128
  toMarkdown: {
128
129
  match: (e) => e.type.name === "link",
129
- runner: (e, t) => {
130
- e.withMark(t, "link", void 0, {
131
- title: t.attrs.title,
132
- url: t.attrs.href
130
+ runner: (e, r) => {
131
+ e.withMark(r, "link", void 0, {
132
+ title: r.attrs.title,
133
+ url: r.attrs.href
133
134
  });
134
135
  }
135
136
  }
136
- })), et = p("ToggleLink", () => (r = {}) => V(A.type(), r)), tt = p("UpdateLink", () => (r = {}) => (e, t) => {
137
- if (!t)
137
+ })), rt = p("ToggleLink", () => (t = {}) => V(L.type(), t)), nt = p("UpdateLink", () => (t = {}) => (e, r) => {
138
+ if (!r)
138
139
  return !1;
139
140
  let n, o = -1;
140
141
  const { selection: a } = e, { from: l, to: s } = a;
141
142
  if (e.doc.nodesBetween(l, l === s ? s + 1 : s, (m, h) => {
142
- if (A.type().isInSet(m.marks))
143
+ if (L.type().isInSet(m.marks))
143
144
  return n = m, o = h, !1;
144
145
  }), !n)
145
146
  return !1;
146
- const c = n.marks.find(({ type: m }) => m === A.type());
147
+ const c = n.marks.find(({ type: m }) => m === L.type());
147
148
  if (!c)
148
149
  return !1;
149
- const i = o, u = o + n.nodeSize, { tr: d } = e, f = A.type().create({ ...c.attrs, ...r });
150
- return f ? (t(
151
- d.removeMark(i, u, c).addMark(i, u, f).setSelection(new ae(d.selection.$anchor)).scrollIntoView()
150
+ const i = o, d = o + n.nodeSize, { tr: u } = e, f = L.type().create({ ...c.attrs, ...t });
151
+ return f ? (r(
152
+ u.removeMark(i, d, c).addMark(i, d, f).setSelection(new re(u.selection.$anchor)).scrollIntoView()
152
153
  ), !0) : !1;
153
- }), rt = te("doc", () => ({
154
+ }), ot = te("doc", () => ({
154
155
  content: "block+",
155
156
  parseMarkdown: {
156
- match: ({ type: r }) => r === "root",
157
- runner: (r, e, t) => {
158
- r.injectRoot(e, t);
157
+ match: ({ type: t }) => t === "root",
158
+ runner: (t, e, r) => {
159
+ t.injectRoot(e, r);
159
160
  }
160
161
  },
161
162
  toMarkdown: {
162
- match: (r) => r.type.name === "doc",
163
- runner: (r, e) => {
164
- r.openNode("root"), r.next(e.content);
163
+ match: (t) => t.type.name === "doc",
164
+ runner: (t, e) => {
165
+ t.openNode("root"), t.next(e.content);
165
166
  }
166
167
  }
167
- })), ke = y("paragraph"), T = M("paragraph", (r) => ({
168
+ })), he = (t, e) => {
169
+ var o;
170
+ if (!(e.childCount >= 1 && ((o = e.lastChild) == null ? void 0 : o.type) === w.type())) {
171
+ t.next(e.content);
172
+ return;
173
+ }
174
+ const n = [];
175
+ e.content.forEach((a, l, s) => {
176
+ s !== e.childCount - 1 && n.push(a);
177
+ }), t.next(Ve.fromArray(n));
178
+ }, ke = y("paragraph"), S = M("paragraph", (t) => ({
168
179
  content: "inline*",
169
180
  group: "block",
170
181
  parseDOM: [{ tag: "p" }],
171
- toDOM: (e) => ["p", r.get(ke.key)(e), 0],
182
+ toDOM: (e) => ["p", t.get(ke.key)(e), 0],
172
183
  parseMarkdown: {
173
184
  match: (e) => e.type === "paragraph",
174
- runner: (e, t, n) => {
175
- e.openNode(n), t.children ? e.next(t.children) : e.addText(t.value || ""), e.closeNode();
185
+ runner: (e, r, n) => {
186
+ e.openNode(n), r.children ? e.next(r.children) : e.addText(r.value || ""), e.closeNode();
176
187
  }
177
188
  },
178
189
  toMarkdown: {
179
190
  match: (e) => e.type.name === "paragraph",
180
- runner: (e, t) => {
181
- var o;
182
- if (e.openNode("paragraph"), t.childCount >= 1 && ((o = t.lastChild) == null ? void 0 : o.type.name) === "hardbreak") {
183
- const a = [];
184
- t.content.forEach((l, s, c) => {
185
- c !== t.childCount - 1 && a.push(l);
186
- }), e.next(re.fromArray(a));
187
- } else
188
- e.next(t.content);
189
- e.closeNode();
191
+ runner: (e, r) => {
192
+ e.openNode("paragraph"), he(e, r), e.closeNode();
190
193
  }
191
194
  }
192
- })), ye = p("TurnIntoText", () => () => S(T.type())), nt = k("paragraphKeymap", {
195
+ })), ye = p("TurnIntoText", () => () => T(S.type())), at = k("paragraphKeymap", {
193
196
  TurnIntoText: {
194
197
  shortcuts: "Mod-Alt-0",
195
- command: (r) => {
196
- const e = r.get(g);
198
+ command: (t) => {
199
+ const e = t.get(g);
197
200
  return () => e.call(ye.key);
198
201
  }
199
202
  }
200
- }), ot = Array(6).fill(0).map((r, e) => e + 1), at = (r) => r.textContent.replace(/[\p{P}\p{S}]/gu, "").replace(/\s/g, "-").toLowerCase().trim(), z = F(at, "headingIdGenerator"), Me = y("heading"), D = M("heading", (r) => {
201
- const e = r.get(z.key);
203
+ }), st = Array(6).fill(0).map((t, e) => e + 1), lt = (t) => ze(t.textContent), j = F(lt, "headingIdGenerator"), Me = y("heading"), D = M("heading", (t) => {
204
+ const e = t.get(j.key);
202
205
  return {
203
206
  content: "inline*",
204
207
  group: "block",
@@ -211,143 +214,135 @@ const ce = K("emphasis"), ie = E("emphasis", (r) => ({
211
214
  default: 1
212
215
  }
213
216
  },
214
- parseDOM: ot.map((t) => ({
215
- tag: `h${t}`,
217
+ parseDOM: st.map((r) => ({
218
+ tag: `h${r}`,
216
219
  getAttrs: (n) => {
217
220
  if (!(n instanceof HTMLElement))
218
- throw w(n);
219
- return { level: t, id: n.id };
221
+ throw N(n);
222
+ return { level: r, id: n.id };
220
223
  }
221
224
  })),
222
- toDOM: (t) => [
223
- `h${t.attrs.level}`,
225
+ toDOM: (r) => [
226
+ `h${r.attrs.level}`,
224
227
  {
225
- ...r.get(Me.key)(t),
226
- id: t.attrs.id || e(t)
228
+ ...t.get(Me.key)(r),
229
+ id: r.attrs.id || e(r)
227
230
  },
228
231
  0
229
232
  ],
230
233
  parseMarkdown: {
231
- match: ({ type: t }) => t === "heading",
232
- runner: (t, n, o) => {
234
+ match: ({ type: r }) => r === "heading",
235
+ runner: (r, n, o) => {
233
236
  const a = n.depth;
234
- t.openNode(o, { level: a }), t.next(n.children), t.closeNode();
237
+ r.openNode(o, { level: a }), r.next(n.children), r.closeNode();
235
238
  }
236
239
  },
237
240
  toMarkdown: {
238
- match: (t) => t.type.name === "heading",
239
- runner: (t, n) => {
240
- var a;
241
- if (t.openNode("heading", void 0, { depth: n.attrs.level }), n.childCount >= 1 && ((a = n.lastChild) == null ? void 0 : a.type.name) === "hardbreak") {
242
- const l = [];
243
- n.content.forEach((s, c, i) => {
244
- i !== n.childCount - 1 && l.push(s);
245
- }), t.next(re.fromArray(l));
246
- } else
247
- t.next(n.content);
248
- t.closeNode();
241
+ match: (r) => r.type.name === "heading",
242
+ runner: (r, n) => {
243
+ r.openNode("heading", void 0, { depth: n.attrs.level }), he(r, n), r.closeNode();
249
244
  }
250
245
  }
251
246
  };
252
- }), st = b((r) => ne(/^(?<hashes>#+)\s$/, D.type(), (e) => {
247
+ }), ct = b((t) => oe(/^(?<hashes>#+)\s$/, D.type(), (e) => {
253
248
  var l, s;
254
- const t = ((s = (l = e.groups) == null ? void 0 : l.hashes) == null ? void 0 : s.length) || 0, n = r.get(q), { $from: o } = n.state.selection, a = o.node();
249
+ const r = ((s = (l = e.groups) == null ? void 0 : l.hashes) == null ? void 0 : s.length) || 0, n = t.get(q), { $from: o } = n.state.selection, a = o.node();
255
250
  if (a.type.name === "heading") {
256
- let c = Number(a.attrs.level) + Number(t);
251
+ let c = Number(a.attrs.level) + Number(r);
257
252
  return c > 6 && (c = 6), { level: c };
258
253
  }
259
- return { level: t };
260
- })), I = p("WrapInHeading", () => (r) => (r ?? (r = 1), r < 1 ? S(T.type()) : S(D.type(), { level: r }))), Ie = p("DowngradeHeading", () => () => (r, e, t) => {
261
- const { $from: n } = r.selection, o = n.node();
262
- if (o.type !== D.type() || !r.selection.empty || n.parentOffset !== 0)
254
+ return { level: r };
255
+ })), I = p("WrapInHeading", () => (t) => (t ?? (t = 1), t < 1 ? T(S.type()) : T(D.type(), { level: t }))), Ie = p("DowngradeHeading", () => () => (t, e, r) => {
256
+ const { $from: n } = t.selection, o = n.node();
257
+ if (o.type !== D.type() || !t.selection.empty || n.parentOffset !== 0)
263
258
  return !1;
264
259
  const a = o.attrs.level - 1;
265
260
  return a ? (e == null || e(
266
- r.tr.setNodeMarkup(r.selection.$from.before(), void 0, {
261
+ t.tr.setNodeMarkup(t.selection.$from.before(), void 0, {
267
262
  ...o.attrs,
268
263
  level: a
269
264
  })
270
- ), !0) : S(T.type())(r, e, t);
271
- }), lt = k("headingKeymap", {
265
+ ), !0) : T(S.type())(t, e, r);
266
+ }), it = k("headingKeymap", {
272
267
  TurnIntoH1: {
273
268
  shortcuts: "Mod-Alt-1",
274
- command: (r) => {
275
- const e = r.get(g);
269
+ command: (t) => {
270
+ const e = t.get(g);
276
271
  return () => e.call(I.key, 1);
277
272
  }
278
273
  },
279
274
  TurnIntoH2: {
280
275
  shortcuts: "Mod-Alt-2",
281
- command: (r) => {
282
- const e = r.get(g);
276
+ command: (t) => {
277
+ const e = t.get(g);
283
278
  return () => e.call(I.key, 2);
284
279
  }
285
280
  },
286
281
  TurnIntoH3: {
287
282
  shortcuts: "Mod-Alt-3",
288
- command: (r) => {
289
- const e = r.get(g);
283
+ command: (t) => {
284
+ const e = t.get(g);
290
285
  return () => e.call(I.key, 3);
291
286
  }
292
287
  },
293
288
  TurnIntoH4: {
294
289
  shortcuts: "Mod-Alt-4",
295
- command: (r) => {
296
- const e = r.get(g);
290
+ command: (t) => {
291
+ const e = t.get(g);
297
292
  return () => e.call(I.key, 3);
298
293
  }
299
294
  },
300
295
  TurnIntoH5: {
301
296
  shortcuts: "Mod-Alt-5",
302
- command: (r) => {
303
- const e = r.get(g);
297
+ command: (t) => {
298
+ const e = t.get(g);
304
299
  return () => e.call(I.key, 3);
305
300
  }
306
301
  },
307
302
  TurnIntoH6: {
308
303
  shortcuts: "Mod-Alt-6",
309
- command: (r) => {
310
- const e = r.get(g);
304
+ command: (t) => {
305
+ const e = t.get(g);
311
306
  return () => e.call(I.key, 3);
312
307
  }
313
308
  },
314
309
  DowngradeHeading: {
315
310
  shortcuts: ["Delete", "Backspace"],
316
- command: (r) => {
317
- const e = r.get(g);
311
+ command: (t) => {
312
+ const e = t.get(g);
318
313
  return () => e.call(Ie.key);
319
314
  }
320
315
  }
321
- }), be = y("blockquote"), U = M("blockquote", (r) => ({
316
+ }), be = y("blockquote"), U = M("blockquote", (t) => ({
322
317
  content: "block+",
323
318
  group: "block",
324
319
  defining: !0,
325
320
  parseDOM: [{ tag: "blockquote" }],
326
- toDOM: (e) => ["blockquote", r.get(be.key)(e), 0],
321
+ toDOM: (e) => ["blockquote", t.get(be.key)(e), 0],
327
322
  parseMarkdown: {
328
323
  match: ({ type: e }) => e === "blockquote",
329
- runner: (e, t, n) => {
330
- e.openNode(n).next(t.children).closeNode();
324
+ runner: (e, r, n) => {
325
+ e.openNode(n).next(r.children).closeNode();
331
326
  }
332
327
  },
333
328
  toMarkdown: {
334
329
  match: (e) => e.type.name === "blockquote",
335
- runner: (e, t) => {
336
- e.openNode("blockquote").next(t.content).closeNode();
330
+ runner: (e, r) => {
331
+ e.openNode("blockquote").next(r.content).closeNode();
337
332
  }
338
333
  }
339
- })), ct = b(() => j(/^\s*>\s$/, U.type())), we = p("WrapInBlockquote", () => () => G(U.type())), it = k("blockquoteKeymap", {
334
+ })), dt = b(() => G(/^\s*>\s$/, U.type())), Ne = p("WrapInBlockquote", () => () => z(U.type())), ut = k("blockquoteKeymap", {
340
335
  WrapInBlockquote: {
341
336
  shortcuts: "Mod-Shift-b",
342
- command: (r) => {
343
- const e = r.get(g);
344
- return () => e.call(we.key);
337
+ command: (t) => {
338
+ const e = t.get(g);
339
+ return () => e.call(Ne.key);
345
340
  }
346
341
  }
347
- }), Ne = y("codeBlock", () => ({
342
+ }), we = y("codeBlock", () => ({
348
343
  pre: {},
349
344
  code: {}
350
- })), Y = M("code_block", (r) => ({
345
+ })), Y = M("code_block", (t) => ({
351
346
  content: "text*",
352
347
  group: "block",
353
348
  marks: "",
@@ -364,52 +359,52 @@ const ce = K("emphasis"), ie = E("emphasis", (r) => ({
364
359
  preserveWhitespace: "full",
365
360
  getAttrs: (e) => {
366
361
  if (!(e instanceof HTMLElement))
367
- throw w(e);
362
+ throw N(e);
368
363
  return { language: e.dataset.language };
369
364
  }
370
365
  }
371
366
  ],
372
367
  toDOM: (e) => {
373
- const t = r.get(Ne.key)(e);
368
+ const r = t.get(we.key)(e);
374
369
  return [
375
370
  "pre",
376
371
  {
377
- ...t.pre,
372
+ ...r.pre,
378
373
  "data-language": e.attrs.language
379
374
  },
380
- ["code", t.code, 0]
375
+ ["code", r.code, 0]
381
376
  ];
382
377
  },
383
378
  parseMarkdown: {
384
379
  match: ({ type: e }) => e === "code",
385
- runner: (e, t, n) => {
386
- const o = t.lang, a = t.value;
380
+ runner: (e, r, n) => {
381
+ const o = r.lang, a = r.value;
387
382
  e.openNode(n, { language: o }), a && e.addText(a), e.closeNode();
388
383
  }
389
384
  },
390
385
  toMarkdown: {
391
386
  match: (e) => e.type.name === "code_block",
392
- runner: (e, t) => {
387
+ runner: (e, r) => {
393
388
  var n;
394
- e.addNode("code", void 0, ((n = t.content.firstChild) == null ? void 0 : n.text) || "", {
395
- lang: t.attrs.language
389
+ e.addNode("code", void 0, ((n = r.content.firstChild) == null ? void 0 : n.text) || "", {
390
+ lang: r.attrs.language
396
391
  });
397
392
  }
398
393
  }
399
- })), ut = b(() => ne(/^```(?<language>[a-z]*)?[\s\n]$/, Y.type(), (r) => {
394
+ })), mt = b(() => oe(/^```(?<language>[a-z]*)?[\s\n]$/, Y.type(), (t) => {
400
395
  var e;
401
396
  return {
402
- language: ((e = r.groups) == null ? void 0 : e.language) ?? ""
397
+ language: ((e = t.groups) == null ? void 0 : e.language) ?? ""
403
398
  };
404
- })), ve = p("CreateCodeBlock", () => (r = "") => S(Y.type(), { language: r })), kr = p("UpdateCodeBlockLanguage", () => ({ pos: r, language: e } = { pos: -1, language: "" }) => (t, n) => r >= 0 ? (n == null || n(t.tr.setNodeAttribute(r, "language", e)), !0) : !1), dt = k("codeBlockKeymap", {
399
+ })), ve = p("CreateCodeBlock", () => (t = "") => T(Y.type(), { language: t })), Ir = p("UpdateCodeBlockLanguage", () => ({ pos: t, language: e } = { pos: -1, language: "" }) => (r, n) => t >= 0 ? (n == null || n(r.tr.setNodeAttribute(t, "language", e)), !0) : !1), pt = k("codeBlockKeymap", {
405
400
  CreateCodeBlock: {
406
401
  shortcuts: "Mod-Alt-c",
407
- command: (r) => {
408
- const e = r.get(g);
402
+ command: (t) => {
403
+ const e = t.get(g);
409
404
  return () => e.call(ve.key);
410
405
  }
411
406
  }
412
- }), Ce = y("image"), B = M("image", (r) => ({
407
+ }), Ce = y("image"), E = M("image", (t) => ({
413
408
  inline: !0,
414
409
  group: "inline",
415
410
  selectable: !0,
@@ -428,7 +423,7 @@ const ce = K("emphasis"), ie = E("emphasis", (r) => ({
428
423
  tag: "img[src]",
429
424
  getAttrs: (e) => {
430
425
  if (!(e instanceof HTMLElement))
431
- throw w(e);
426
+ throw N(e);
432
427
  return {
433
428
  src: e.getAttribute("src") || "",
434
429
  alt: e.getAttribute("alt") || "",
@@ -437,11 +432,11 @@ const ce = K("emphasis"), ie = E("emphasis", (r) => ({
437
432
  }
438
433
  }
439
434
  ],
440
- toDOM: (e) => ["img", { ...r.get(Ce.key)(e), ...e.attrs }],
435
+ toDOM: (e) => ["img", { ...t.get(Ce.key)(e), ...e.attrs }],
441
436
  parseMarkdown: {
442
437
  match: ({ type: e }) => e === "image",
443
- runner: (e, t, n) => {
444
- const o = t.url, a = t.alt, l = t.title;
438
+ runner: (e, r, n) => {
439
+ const o = r.url, a = r.alt, l = r.title;
445
440
  e.addNode(n, {
446
441
  src: o,
447
442
  alt: a,
@@ -451,34 +446,34 @@ const ce = K("emphasis"), ie = E("emphasis", (r) => ({
451
446
  },
452
447
  toMarkdown: {
453
448
  match: (e) => e.type.name === "image",
454
- runner: (e, t) => {
449
+ runner: (e, r) => {
455
450
  e.addNode("image", void 0, void 0, {
456
- title: t.attrs.title,
457
- url: t.attrs.src,
458
- alt: t.attrs.alt
451
+ title: r.attrs.title,
452
+ url: r.attrs.src,
453
+ alt: r.attrs.alt
459
454
  });
460
455
  }
461
456
  }
462
- })), mt = p("InsertImage", () => (r = {}) => (e, t) => {
463
- if (!t)
457
+ })), gt = p("InsertImage", () => (t = {}) => (e, r) => {
458
+ if (!r)
464
459
  return !0;
465
- const { src: n = "", alt: o = "", title: a = "" } = r, l = B.type().create({ src: n, alt: o, title: a });
466
- return l && t(e.tr.replaceSelectionWith(l).scrollIntoView()), !0;
467
- }), pt = p("UpdateImage", () => (r = {}) => (e, t) => {
468
- const n = Ve(e.selection, B.type());
460
+ const { src: n = "", alt: o = "", title: a = "" } = t, l = E.type().create({ src: n, alt: o, title: a });
461
+ return l && r(e.tr.replaceSelectionWith(l).scrollIntoView()), !0;
462
+ }), ft = p("UpdateImage", () => (t = {}) => (e, r) => {
463
+ const n = Ge(e.selection, E.type());
469
464
  if (!n)
470
465
  return !1;
471
- const { node: o, pos: a } = n, l = { ...o.attrs }, { src: s, alt: c, title: i } = r;
472
- return s !== void 0 && (l.src = s), c !== void 0 && (l.alt = c), i !== void 0 && (l.title = i), t == null || t(e.tr.setNodeMarkup(a, void 0, l).scrollIntoView()), !0;
473
- }), yr = b(() => new oe(
466
+ const { node: o, pos: a } = n, l = { ...o.attrs }, { src: s, alt: c, title: i } = t;
467
+ return s !== void 0 && (l.src = s), c !== void 0 && (l.alt = c), i !== void 0 && (l.title = i), r == null || r(e.tr.setNodeMarkup(a, void 0, l).scrollIntoView()), !0;
468
+ }), br = b(() => new ae(
474
469
  /!\[(?<alt>.*?)]\((?<filename>.*?)\s*(?="|\))"?(?<title>[^"]+)?"?\)/,
475
- (r, e, t, n) => {
470
+ (t, e, r, n) => {
476
471
  const [o, a, l = "", s] = e;
477
- return o ? r.tr.replaceWith(t, n, B.type().create({ src: l, alt: a, title: s })) : null;
472
+ return o ? t.tr.replaceWith(r, n, E.type().create({ src: l, alt: a, title: s })) : null;
478
473
  }
479
- )), xe = y("hardbreak", (r) => ({
480
- "data-is-inline": r.attrs.isInline
481
- })), L = M("hardbreak", (r) => ({
474
+ )), xe = y("hardbreak", (t) => ({
475
+ "data-is-inline": t.attrs.isInline
476
+ })), w = M("hardbreak", (t) => ({
482
477
  inline: !0,
483
478
  group: "inline",
484
479
  attrs: {
@@ -488,47 +483,49 @@ const ce = K("emphasis"), ie = E("emphasis", (r) => ({
488
483
  },
489
484
  selectable: !1,
490
485
  parseDOM: [{ tag: "br" }],
491
- toDOM: (e) => ["br", r.get(xe.key)(e)],
486
+ toDOM: (e) => ["br", t.get(xe.key)(e)],
492
487
  parseMarkdown: {
493
488
  match: ({ type: e }) => e === "break",
494
- runner: (e, t, n) => {
489
+ runner: (e, r, n) => {
495
490
  var o;
496
- e.addNode(n, { isInline: Boolean((o = t.data) == null ? void 0 : o.isInline) });
491
+ e.addNode(n, { isInline: Boolean((o = r.data) == null ? void 0 : o.isInline) });
497
492
  }
498
493
  },
494
+ leafText: () => `
495
+ `,
499
496
  toMarkdown: {
500
497
  match: (e) => e.type.name === "hardbreak",
501
- runner: (e, t) => {
502
- t.attrs.isInline ? e.addNode("text", void 0, `
498
+ runner: (e, r) => {
499
+ r.attrs.isInline ? e.addNode("text", void 0, `
503
500
  `) : e.addNode("break");
504
501
  }
505
502
  }
506
- })), Ae = p("InsertHardbreak", () => () => (r, e) => {
503
+ })), Ae = p("InsertHardbreak", () => () => (t, e) => {
507
504
  var o;
508
- const { selection: t, tr: n } = r;
509
- if (t.empty) {
510
- const a = t.$from.node();
505
+ const { selection: r, tr: n } = t;
506
+ if (r.empty) {
507
+ const a = r.$from.node();
511
508
  if (a.childCount > 0 && ((o = a.lastChild) == null ? void 0 : o.type.name) === "hardbreak")
512
509
  return e == null || e(
513
- n.replaceRangeWith(t.to - 1, t.to, r.schema.node("paragraph")).setSelection(se.near(n.doc.resolve(t.to))).scrollIntoView()
510
+ n.replaceRangeWith(r.to - 1, r.to, t.schema.node("paragraph")).setSelection(ne.near(n.doc.resolve(r.to))).scrollIntoView()
514
511
  ), !0;
515
512
  }
516
- return e == null || e(n.setMeta("hardbreak", !0).replaceSelectionWith(L.type().create()).scrollIntoView()), !0;
517
- }), gt = k("hardbreakKeymap", {
513
+ return e == null || e(n.setMeta("hardbreak", !0).replaceSelectionWith(w.type().create()).scrollIntoView()), !0;
514
+ }), ht = k("hardbreakKeymap", {
518
515
  InsertHardbreak: {
519
516
  shortcuts: "Shift-Enter",
520
- command: (r) => {
521
- const e = r.get(g);
517
+ command: (t) => {
518
+ const e = t.get(g);
522
519
  return () => e.call(Ae.key);
523
520
  }
524
521
  }
525
- }), Le = y("hr"), J = M("hr", (r) => ({
522
+ }), Le = y("hr"), J = M("hr", (t) => ({
526
523
  group: "block",
527
524
  parseDOM: [{ tag: "hr" }],
528
- toDOM: (e) => ["hr", r.get(Le.key)(e)],
525
+ toDOM: (e) => ["hr", t.get(Le.key)(e)],
529
526
  parseMarkdown: {
530
527
  match: ({ type: e }) => e === "thematicBreak",
531
- runner: (e, t, n) => {
528
+ runner: (e, r, n) => {
532
529
  e.addNode(n);
533
530
  }
534
531
  },
@@ -538,21 +535,21 @@ const ce = K("emphasis"), ie = E("emphasis", (r) => ({
538
535
  e.addNode("thematicBreak");
539
536
  }
540
537
  }
541
- })), ft = b(() => new oe(
538
+ })), kt = b(() => new ae(
542
539
  /^(?:---|___\s|\*\*\*\s)$/,
543
- (r, e, t, n) => {
544
- const { tr: o } = r;
545
- return e[0] && o.replaceWith(t - 1, n, J.type().create()), o;
540
+ (t, e, r, n) => {
541
+ const { tr: o } = t;
542
+ return e[0] && o.replaceWith(r - 1, n, J.type().create()), o;
546
543
  }
547
- )), ht = p("InsertHr", () => () => (r, e) => {
544
+ )), yt = p("InsertHr", () => () => (t, e) => {
548
545
  if (!e)
549
546
  return !0;
550
- const t = T.node.type().create(), { tr: n, selection: o } = r, { from: a } = o, l = J.type().create();
547
+ const r = S.node.type().create(), { tr: n, selection: o } = t, { from: a } = o, l = J.type().create();
551
548
  if (!l)
552
549
  return !0;
553
- const s = n.replaceSelectionWith(l).insert(a, t), c = se.findFrom(s.doc.resolve(a), 1, !0);
550
+ const s = n.replaceSelectionWith(l).insert(a, r), c = ne.findFrom(s.doc.resolve(a), 1, !0);
554
551
  return c && e(s.setSelection(c).scrollIntoView()), !0;
555
- }), Se = y("bulletList"), R = M("bullet_list", (r) => ({
552
+ }), Te = y("bulletList"), R = M("bullet_list", (t) => ({
556
553
  content: "listItem+",
557
554
  group: "block",
558
555
  attrs: {
@@ -565,7 +562,7 @@ const ce = K("emphasis"), ie = E("emphasis", (r) => ({
565
562
  tag: "ul",
566
563
  getAttrs: (e) => {
567
564
  if (!(e instanceof HTMLElement))
568
- throw w(e);
565
+ throw N(e);
569
566
  return {
570
567
  spread: e.dataset.spread
571
568
  };
@@ -575,33 +572,33 @@ const ce = K("emphasis"), ie = E("emphasis", (r) => ({
575
572
  toDOM: (e) => [
576
573
  "ul",
577
574
  {
578
- ...r.get(Se.key)(e),
575
+ ...t.get(Te.key)(e),
579
576
  "data-spread": e.attrs.spread
580
577
  },
581
578
  0
582
579
  ],
583
580
  parseMarkdown: {
584
- match: ({ type: e, ordered: t }) => e === "list" && !t,
585
- runner: (e, t, n) => {
586
- const o = t.spread != null ? `${t.spread}` : "false";
587
- e.openNode(n, { spread: o }).next(t.children).closeNode();
581
+ match: ({ type: e, ordered: r }) => e === "list" && !r,
582
+ runner: (e, r, n) => {
583
+ const o = r.spread != null ? `${r.spread}` : "false";
584
+ e.openNode(n, { spread: o }).next(r.children).closeNode();
588
585
  }
589
586
  },
590
587
  toMarkdown: {
591
588
  match: (e) => e.type.name === "bullet_list",
592
- runner: (e, t) => {
593
- e.openNode("list", void 0, { ordered: !1, spread: t.attrs.spread === "true" }).next(t.content).closeNode();
589
+ runner: (e, r) => {
590
+ e.openNode("list", void 0, { ordered: !1, spread: r.attrs.spread === "true" }).next(r.content).closeNode();
594
591
  }
595
592
  }
596
- })), kt = b(() => j(/^\s*([-+*])\s$/, R.type())), Te = p("WrapInBulletList", () => () => G(R.type())), yt = k("bulletListKeymap", {
593
+ })), Mt = b(() => G(/^\s*([-+*])\s$/, R.type())), Se = p("WrapInBulletList", () => () => z(R.type())), It = k("bulletListKeymap", {
597
594
  WrapInBulletList: {
598
595
  shortcuts: "Mod-Alt-8",
599
- command: (r) => {
600
- const e = r.get(g);
601
- return () => e.call(Te.key);
596
+ command: (t) => {
597
+ const e = t.get(g);
598
+ return () => e.call(Se.key);
602
599
  }
603
600
  }
604
- }), De = y("orderedList"), P = M("ordered_list", (r) => ({
601
+ }), De = y("orderedList"), P = M("ordered_list", (t) => ({
605
602
  content: "listItem+",
606
603
  group: "block",
607
604
  attrs: {
@@ -617,7 +614,7 @@ const ce = K("emphasis"), ie = E("emphasis", (r) => ({
617
614
  tag: "ol",
618
615
  getAttrs: (e) => {
619
616
  if (!(e instanceof HTMLElement))
620
- throw w(e);
617
+ throw N(e);
621
618
  return {
622
619
  spread: e.dataset.spread,
623
620
  order: e.hasAttribute("start") ? Number(e.getAttribute("start")) : 1
@@ -628,39 +625,39 @@ const ce = K("emphasis"), ie = E("emphasis", (r) => ({
628
625
  toDOM: (e) => [
629
626
  "ol",
630
627
  {
631
- ...r.get(De.key)(e),
628
+ ...t.get(De.key)(e),
632
629
  ...e.attrs.order === 1 ? {} : e.attrs.order,
633
630
  "data-spread": e.attrs.spread
634
631
  },
635
632
  0
636
633
  ],
637
634
  parseMarkdown: {
638
- match: ({ type: e, ordered: t }) => e === "list" && !!t,
639
- runner: (e, t, n) => {
640
- const o = t.spread != null ? `${t.spread}` : "true";
641
- e.openNode(n, { spread: o }).next(t.children).closeNode();
635
+ match: ({ type: e, ordered: r }) => e === "list" && !!r,
636
+ runner: (e, r, n) => {
637
+ const o = r.spread != null ? `${r.spread}` : "true";
638
+ e.openNode(n, { spread: o }).next(r.children).closeNode();
642
639
  }
643
640
  },
644
641
  toMarkdown: {
645
642
  match: (e) => e.type.name === "ordered_list",
646
- runner: (e, t) => {
647
- e.openNode("list", void 0, { ordered: !0, start: 1, spread: t.attrs.spread === "true" }), e.next(t.content), e.closeNode();
643
+ runner: (e, r) => {
644
+ e.openNode("list", void 0, { ordered: !0, start: 1, spread: r.attrs.spread === "true" }), e.next(r.content), e.closeNode();
648
645
  }
649
646
  }
650
- })), Mt = b(() => j(
647
+ })), bt = b(() => G(
651
648
  /^\s*(\d+)\.\s$/,
652
649
  P.type(),
653
- (r) => ({ order: Number(r[1]) }),
654
- (r, e) => e.childCount + e.attrs.order === Number(r[1])
655
- )), Oe = p("WrapInOrderedList", () => () => G(P.type())), It = k("orderedListKeymap", {
650
+ (t) => ({ order: Number(t[1]) }),
651
+ (t, e) => e.childCount + e.attrs.order === Number(t[1])
652
+ )), Oe = p("WrapInOrderedList", () => () => z(P.type())), Nt = k("orderedListKeymap", {
656
653
  WrapInOrderedList: {
657
654
  shortcuts: "Mod-Alt-7",
658
- command: (r) => {
659
- const e = r.get(g);
655
+ command: (t) => {
656
+ const e = t.get(g);
660
657
  return () => e.call(Oe.key);
661
658
  }
662
659
  }
663
- }), He = y("listItem"), O = M("list_item", (r) => ({
660
+ }), He = y("listItem"), O = M("list_item", (t) => ({
664
661
  group: "listItem",
665
662
  content: "paragraph block*",
666
663
  attrs: {
@@ -680,7 +677,7 @@ const ce = K("emphasis"), ie = E("emphasis", (r) => ({
680
677
  tag: "li",
681
678
  getAttrs: (e) => {
682
679
  if (!(e instanceof HTMLElement))
683
- throw w(e);
680
+ throw N(e);
684
681
  return {
685
682
  label: e.dataset.label,
686
683
  listType: e.dataset["list-type"],
@@ -692,7 +689,7 @@ const ce = K("emphasis"), ie = E("emphasis", (r) => ({
692
689
  toDOM: (e) => [
693
690
  "li",
694
691
  {
695
- ...r.get(He.key)(e),
692
+ ...t.get(He.key)(e),
696
693
  "data-label": e.attrs.label,
697
694
  "data-list-type": e.attrs.listType,
698
695
  "data-spread": e.attrs.spread
@@ -701,54 +698,54 @@ const ce = K("emphasis"), ie = E("emphasis", (r) => ({
701
698
  ],
702
699
  parseMarkdown: {
703
700
  match: ({ type: e }) => e === "listItem",
704
- runner: (e, t, n) => {
705
- const o = t.label != null ? `${t.label}.` : "•", a = t.label != null ? "ordered" : "bullet", l = t.spread != null ? `${t.spread}` : "true";
706
- e.openNode(n, { label: o, listType: a, spread: l }), e.next(t.children), e.closeNode();
701
+ runner: (e, r, n) => {
702
+ const o = r.label != null ? `${r.label}.` : "•", a = r.label != null ? "ordered" : "bullet", l = r.spread != null ? `${r.spread}` : "true";
703
+ e.openNode(n, { label: o, listType: a, spread: l }), e.next(r.children), e.closeNode();
707
704
  }
708
705
  },
709
706
  toMarkdown: {
710
707
  match: (e) => e.type.name === "list_item",
711
- runner: (e, t) => {
712
- e.openNode("listItem", void 0, { spread: t.attrs.spread === "true" }), e.next(t.content), e.closeNode();
708
+ runner: (e, r) => {
709
+ e.openNode("listItem", void 0, { spread: r.attrs.spread === "true" }), e.next(r.content), e.closeNode();
713
710
  }
714
711
  }
715
- })), _e = p("SinkListItem", () => () => Ge(O.type())), Ke = p("SplitListItem", () => () => je(O.type())), Ee = p("SplitListItem", () => () => ze(O.type())), bt = k("listItemKeymap", {
712
+ })), _e = p("SinkListItem", () => () => je(O.type())), Ke = p("SplitListItem", () => () => Ue(O.type())), Be = p("SplitListItem", () => () => Ye(O.type())), wt = k("listItemKeymap", {
716
713
  NextListItem: {
717
714
  shortcuts: "Enter",
718
- command: (r) => {
719
- const e = r.get(g);
720
- return () => e.call(Ee.key);
715
+ command: (t) => {
716
+ const e = t.get(g);
717
+ return () => e.call(Be.key);
721
718
  }
722
719
  },
723
720
  SinkListItem: {
724
721
  shortcuts: ["Tab", "Mod-]"],
725
- command: (r) => {
726
- const e = r.get(g);
722
+ command: (t) => {
723
+ const e = t.get(g);
727
724
  return () => e.call(_e.key);
728
725
  }
729
726
  },
730
727
  LiftListItem: {
731
728
  shortcuts: ["Shift-Tab", "Mod-["],
732
- command: (r) => {
733
- const e = r.get(g);
729
+ command: (t) => {
730
+ const e = t.get(g);
734
731
  return () => e.call(Ke.key);
735
732
  }
736
733
  }
737
- }), wt = te("text", () => ({
734
+ }), vt = te("text", () => ({
738
735
  group: "inline",
739
736
  parseMarkdown: {
740
- match: ({ type: r }) => r === "text",
741
- runner: (r, e) => {
742
- r.addText(e.value);
737
+ match: ({ type: t }) => t === "text",
738
+ runner: (t, e) => {
739
+ t.addText(e.value);
743
740
  }
744
741
  },
745
742
  toMarkdown: {
746
- match: (r) => r.type.name === "text",
747
- runner: (r, e) => {
748
- r.addNode("text", void 0, e.text);
743
+ match: (t) => t.type.name === "text",
744
+ runner: (t, e) => {
745
+ t.addNode("text", void 0, e.text);
749
746
  }
750
747
  }
751
- })), $e = y("html"), Nt = M("html", (r) => ({
748
+ })), $e = y("html"), Ct = M("html", (t) => ({
752
749
  atom: !0,
753
750
  group: "inline",
754
751
  inline: !0,
@@ -758,12 +755,12 @@ const ce = K("emphasis"), ie = E("emphasis", (r) => ({
758
755
  }
759
756
  },
760
757
  toDOM: (e) => {
761
- const t = document.createElement("span"), n = {
762
- ...r.get($e.key)(e),
758
+ const r = document.createElement("span"), n = {
759
+ ...t.get($e.key)(e),
763
760
  "data-value": e.attrs.value,
764
761
  "data-type": "html"
765
762
  };
766
- return t.textContent = e.attrs.value, ["span", n, e.attrs.value];
763
+ return r.textContent = e.attrs.value, ["span", n, e.attrs.value];
767
764
  },
768
765
  parseDOM: [{
769
766
  tag: 'span[data-type="html"]',
@@ -773,162 +770,162 @@ const ce = K("emphasis"), ie = E("emphasis", (r) => ({
773
770
  }],
774
771
  parseMarkdown: {
775
772
  match: ({ type: e }) => Boolean(e === "html"),
776
- runner: (e, t, n) => {
777
- e.addNode(n, { value: t.value });
773
+ runner: (e, r, n) => {
774
+ e.addNode(n, { value: r.value });
778
775
  }
779
776
  },
780
777
  toMarkdown: {
781
778
  match: (e) => e.type.name === "html",
782
- runner: (e, t) => {
783
- e.addNode("html", void 0, t.attrs.value);
779
+ runner: (e, r) => {
780
+ e.addNode("html", void 0, r.attrs.value);
784
781
  }
785
782
  }
786
- })), vt = [
787
- rt,
783
+ })), xt = [
784
+ ot,
788
785
  ke,
789
- T,
790
- z,
786
+ S,
787
+ j,
791
788
  Me,
792
789
  D,
793
790
  xe,
794
- L,
791
+ w,
795
792
  be,
796
793
  U,
797
- Ne,
794
+ we,
798
795
  Y,
799
796
  Le,
800
797
  J,
801
798
  Ce,
802
- B,
803
- Se,
799
+ E,
800
+ Te,
804
801
  R,
805
802
  De,
806
803
  P,
807
804
  He,
808
805
  O,
806
+ le,
809
807
  ce,
810
- ie,
811
808
  de,
812
- me,
813
- ge,
814
- x,
815
- he,
809
+ ue,
810
+ pe,
816
811
  A,
812
+ fe,
813
+ L,
817
814
  $e,
818
- Nt,
819
- wt
820
- ].flat(), Ct = [
821
- ct,
822
- kt,
815
+ Ct,
816
+ vt
817
+ ].flat(), At = [
818
+ dt,
823
819
  Mt,
824
- ut,
825
- ft,
826
- st
827
- ].flat(), xt = [
820
+ bt,
821
+ mt,
822
+ kt,
823
+ ct
824
+ ].flat(), Lt = [
828
825
  ye,
829
- we,
826
+ Ne,
830
827
  I,
831
828
  Ie,
832
829
  ve,
833
830
  Ae,
834
- ht,
835
- mt,
836
- pt,
831
+ yt,
832
+ gt,
833
+ ft,
837
834
  Oe,
838
- Te,
835
+ Se,
839
836
  _e,
840
- Ee,
837
+ Be,
841
838
  Ke,
842
- ue,
843
- fe,
844
- pe,
845
- et,
846
- tt
847
- ], At = [
839
+ ie,
840
+ ge,
841
+ me,
842
+ rt,
843
+ nt
844
+ ], Tt = [
845
+ ut,
846
+ pt,
847
+ ht,
848
848
  it,
849
- dt,
850
- gt,
851
- lt,
852
- bt,
849
+ wt,
850
+ Nt,
853
851
  It,
854
- yt,
855
- nt,
856
- Qe,
852
+ at,
857
853
  Ze,
858
- Xe
859
- ].flat(), W = /\[(?<span>((www|https:\/\/|http:\/\/)[^\s\]]+))]\((?<url>[^\s\]]+)\)/, Lt = (r) => new RegExp(`\\\\(?=[^\\w\\s${r}\\\\]|_)`, "g"), St = (r) => {
860
- let e = r, t = e.match(W);
861
- for (; t && t.groups; ) {
862
- const { span: n } = t.groups;
863
- e = e.replace(W, n), t = e.match(W);
854
+ tt,
855
+ et
856
+ ].flat(), W = /\[(?<span>((www|https:\/\/|http:\/\/)[^\s\]]+))]\((?<url>[^\s\]]+)\)/, St = (t) => new RegExp(`\\\\(?=[^\\w\\s${t}\\\\]|_)`, "g"), Dt = (t) => {
857
+ let e = t, r = e.match(W);
858
+ for (; r && r.groups; ) {
859
+ const { span: n } = r.groups;
860
+ e = e.replace(W, n), r = e.match(W);
864
861
  }
865
862
  return e;
866
- }, Tt = (r, e, t) => {
867
- const n = r.split(""), o = n[e];
868
- return n[e] && n[t] && (n[e] = n[t], n[t] = o), n.join("").toString();
869
- }, Dt = (r) => (e) => e.replace(Lt(r), ""), Ot = (r) => (e) => {
870
- const t = e.indexOf(r.hole), n = e.charAt(t - 1), o = e.charAt(t + 1), a = /[^\w]|_/;
871
- return o ? n && a.test(n) && a.test(o) ? r.punctuation : r.char : r.punctuation;
872
- }, Ht = (r, e, t) => {
863
+ }, Ot = (t, e, r) => {
864
+ const n = t.split(""), o = n[e];
865
+ return n[e] && n[r] && (n[e] = n[r], n[r] = o), n.join("").toString();
866
+ }, Ht = (t) => (e) => e.replace(St(t), ""), _t = (t) => (e) => {
867
+ const r = e.indexOf(t.hole), n = e.charAt(r - 1), o = e.charAt(r + 1), a = /[^\w]|_/;
868
+ return o ? n && a.test(n) && a.test(o) ? t.punctuation : t.char : t.punctuation;
869
+ }, Kt = (t, e, r) => {
873
870
  let n = e, o = !1;
874
- return r.descendants((a) => {
871
+ return t.descendants((a) => {
875
872
  var l;
876
873
  if (o)
877
874
  return !1;
878
875
  if (a.isText) {
879
- const s = (l = a.text) == null ? void 0 : l.indexOf(t);
876
+ const s = (l = a.text) == null ? void 0 : l.indexOf(r);
880
877
  if (s != null && s >= 0)
881
878
  return o = !0, n += s, !1;
882
879
  }
883
880
  n += a.nodeSize;
884
881
  }), n;
885
- }, _t = {
882
+ }, Bt = {
886
883
  placeholderConfig: {
887
884
  hole: "∅",
888
885
  punctuation: "⁂",
889
886
  char: "∴"
890
887
  },
891
888
  globalNodes: ["footnote_definition"],
892
- shouldSyncNode: ({ prevNode: r, nextNode: e }) => r.inlineContent && e && r.type === e.type && !r.eq(e),
893
- movePlaceholder: (r, e) => {
894
- const t = ["*", "_"];
895
- let n = e.indexOf(r);
896
- for (; t.includes(e[n - 1] || "") && t.includes(e[n + 1] || ""); )
897
- e = Tt(e, n, n + 1), n = n + 1;
889
+ shouldSyncNode: ({ prevNode: t, nextNode: e }) => t.inlineContent && e && t.type === e.type && !t.eq(e),
890
+ movePlaceholder: (t, e) => {
891
+ const r = ["*", "_"];
892
+ let n = e.indexOf(t);
893
+ for (; r.includes(e[n - 1] || "") && r.includes(e[n + 1] || ""); )
894
+ e = Ot(e, n, n + 1), n = n + 1;
898
895
  return e;
899
896
  }
900
- }, H = F(_t, "inlineSyncConfig"), Kt = (r) => r.selection.$from.node(), Et = (r, e, t, n) => {
901
- const o = r.get(qe), a = e.schema.topNodeType.create(void 0, [t, ...n]);
897
+ }, H = F(Bt, "inlineSyncConfig"), $t = (t) => t.selection.$from.node(), Et = (t, e, r, n) => {
898
+ const o = t.get(qe), a = e.schema.topNodeType.create(void 0, [r, ...n]);
902
899
  return o(a);
903
- }, $t = (r, e) => {
904
- const t = r.get(H.key), n = t.placeholderConfig.hole, [o = "", ...a] = e.split(`
900
+ }, Rt = (t, e) => {
901
+ const r = t.get(H.key), n = r.placeholderConfig.hole, [o = "", ...a] = e.split(`
905
902
 
906
- `), l = (u) => t.movePlaceholder(n, u);
907
- let c = We(Dt(n), l, St)(o);
908
- const i = Ot(t.placeholderConfig)(c);
903
+ `), l = (d) => r.movePlaceholder(n, d);
904
+ let c = We(Ht(n), l, Dt)(o);
905
+ const i = _t(r.placeholderConfig)(c);
909
906
  return c = c.replace(n, i), c = [c, ...a].join(`
910
907
 
911
908
  `), [c, i];
912
- }, Bt = (r, e) => {
913
- const n = r.get(Fe)(e);
909
+ }, Pt = (t, e) => {
910
+ const n = t.get(Fe)(e);
914
911
  return n ? n.firstChild : null;
915
- }, Rt = (r, e) => {
916
- const { globalNodes: t } = r.get(H.key), n = [];
912
+ }, Wt = (t, e) => {
913
+ const { globalNodes: r } = t.get(H.key), n = [];
917
914
  return e.doc.descendants((o) => {
918
- if (t.includes(o.type.name) || t.includes(o.type))
915
+ if (r.includes(o.type.name) || r.includes(o.type))
919
916
  return n.push(o), !1;
920
917
  }), n;
921
- }, Pt = (r) => r.split(`
918
+ }, qt = (t) => t.split(`
922
919
 
923
- `)[0] || "", Wt = (r) => r.childCount === 1 && r.child(0).type.name === "html", Be = (r, e) => {
920
+ `)[0] || "", Ft = (t) => t.childCount === 1 && t.child(0).type.name === "html", Ee = (t, e) => {
924
921
  try {
925
- const t = Rt(r, e), n = Kt(e), o = Et(r, e, n, t), [a, l] = $t(r, o), s = Bt(r, a);
926
- return !s || n.type !== s.type || Wt(s) ? null : (s.attrs = { ...n.attrs }, s.descendants((c) => {
927
- var d;
928
- const u = c.marks.find((f) => f.type.name === "link");
929
- u && ((d = c.text) == null ? void 0 : d.includes(l)) && u.attrs.href.includes(l) && (u.attrs.href = u.attrs.href.replace(l, ""));
922
+ const r = Wt(t, e), n = $t(e), o = Et(t, e, n, r), [a, l] = Rt(t, o), s = Pt(t, a);
923
+ return !s || n.type !== s.type || Ft(s) ? null : (s.attrs = { ...n.attrs }, s.descendants((c) => {
924
+ var u;
925
+ const d = c.marks.find((f) => f.type.name === "link");
926
+ d && ((u = c.text) == null ? void 0 : u.includes(l)) && d.attrs.href.includes(l) && (d.attrs.href = d.attrs.href.replace(l, ""));
930
927
  }), {
931
- text: Pt(a),
928
+ text: qt(a),
932
929
  prevNode: n,
933
930
  nextNode: s,
934
931
  placeholder: l
@@ -936,77 +933,77 @@ const ce = K("emphasis"), ie = E("emphasis", (r) => ({
936
933
  } catch {
937
934
  return null;
938
935
  }
939
- }, qt = (r, e, t, n, o) => {
940
- const { placeholderConfig: a } = r.get(H.key), l = a.hole;
941
- let s = t.tr.setMeta(e, !0).insertText(l, t.selection.from);
942
- const c = t.apply(s), i = Be(r, c);
936
+ }, Vt = (t, e, r, n, o) => {
937
+ const { placeholderConfig: a } = t.get(H.key), l = a.hole;
938
+ let s = r.tr.setMeta(e, !0).insertText(l, r.selection.from);
939
+ const c = r.apply(s), i = Ee(t, c);
943
940
  if (!i)
944
941
  return;
945
- const { $from: u } = c.selection, d = u.before(), f = u.after(), m = Ht(i.nextNode, d, i.placeholder);
946
- s = s.replaceWith(d, f, i.nextNode).setNodeMarkup(d, void 0, o).delete(m + 1, m + 2), s = s.setSelection(ae.near(s.doc.resolve(m + 1))), n(s);
947
- }, Ft = N((r) => {
942
+ const { $from: d } = c.selection, u = d.before(), f = d.after(), m = Kt(i.nextNode, u, i.placeholder);
943
+ s = s.replaceWith(u, f, i.nextNode).setNodeMarkup(u, void 0, o).delete(m + 1, m + 2), s = s.setSelection(re.near(s.doc.resolve(m + 1))), n(s);
944
+ }, zt = v((t) => {
948
945
  let e = null;
949
- const t = new v("MILKDOWN_INLINE_SYNC");
950
- return new C({
951
- key: t,
946
+ const r = new C("MILKDOWN_INLINE_SYNC");
947
+ return new x({
948
+ key: r,
952
949
  state: {
953
950
  init: () => null,
954
951
  apply: (n, o, a, l) => {
955
952
  var h;
956
- const s = r.get(q);
957
- if (!((h = s.hasFocus) != null && h.call(s)) || !s.editable || !n.docChanged || n.getMeta(t))
953
+ const s = t.get(q);
954
+ if (!((h = s.hasFocus) != null && h.call(s)) || !s.editable || !n.docChanged || n.getMeta(r))
958
955
  return null;
959
- const i = Be(r, l);
956
+ const i = Ee(t, l);
960
957
  if (!i)
961
958
  return null;
962
959
  e && (cancelAnimationFrame(e), e = null);
963
- const { prevNode: u, nextNode: d, text: f } = i, { shouldSyncNode: m } = r.get(H.key);
964
- return m({ prevNode: u, nextNode: d, ctx: r, tr: n, text: f }) && (e = requestAnimationFrame(() => {
960
+ const { prevNode: d, nextNode: u, text: f } = i, { shouldSyncNode: m } = t.get(H.key);
961
+ return m({ prevNode: d, nextNode: u, ctx: t, tr: n, text: f }) && (e = requestAnimationFrame(() => {
965
962
  e = null;
966
- const { dispatch: _, state: Q } = r.get(q);
967
- qt(r, t, Q, _, u.attrs);
968
- })), null;
963
+ const { dispatch: _, state: Q } = t.get(q);
964
+ Vt(t, r, Q, _, d.attrs);
965
+ }), n.setMeta("addToHistory", !1)), null;
969
966
  }
970
967
  }
971
968
  });
972
- }), Vt = $(() => () => (r) => {
973
- le(r, "list", (e) => {
969
+ }), Gt = $(() => () => (t) => {
970
+ se(t, "list", (e) => {
974
971
  if (e.ordered) {
975
- const t = e.start ?? 1;
972
+ const r = e.start ?? 1;
976
973
  e.children.forEach((n, o) => {
977
- n.label = o + t;
974
+ n.label = o + r;
978
975
  });
979
976
  }
980
977
  });
981
- }), Gt = $(() => () => (r) => {
978
+ }), jt = $(() => () => (t) => {
982
979
  const e = /[\t ]*(?:\r?\n|\r)/g;
983
- le(r, "text", (t, n, o) => {
984
- if (!t.value || typeof t.value != "string")
980
+ se(t, "text", (r, n, o) => {
981
+ if (!r.value || typeof r.value != "string")
985
982
  return;
986
983
  const a = [];
987
984
  let l = 0;
988
985
  e.lastIndex = 0;
989
- let s = e.exec(t.value);
986
+ let s = e.exec(r.value);
990
987
  for (; s; ) {
991
988
  const i = s.index;
992
- l !== i && a.push({ type: "text", value: t.value.slice(l, i) }), a.push({ type: "break", data: { isInline: !0 } }), l = i + s[0].length, s = e.exec(t.value);
989
+ l !== i && a.push({ type: "text", value: r.value.slice(l, i) }), a.push({ type: "break", data: { isInline: !0 } }), l = i + s[0].length, s = e.exec(r.value);
993
990
  }
994
991
  if (!!(a.length > 0 && o && typeof n == "number"))
995
- return l < t.value.length && a.push({ type: "text", value: t.value.slice(l) }), o.children.splice(n, 1, ...a), n + a.length;
992
+ return l < r.value.length && a.push({ type: "text", value: r.value.slice(l) }), o.children.splice(n, 1, ...a), n + a.length;
996
993
  });
997
- }), jt = $(() => Je), zt = (r) => !!r.children, Ut = (r) => r.type === "html";
998
- function Yt(r, e) {
999
- return t(r, 0, null)[0];
1000
- function t(n, o, a) {
1001
- if (zt(n)) {
994
+ }), Ut = $(() => Xe), Yt = (t) => !!t.children, Jt = (t) => t.type === "html";
995
+ function Qt(t, e) {
996
+ return r(t, 0, null)[0];
997
+ function r(n, o, a) {
998
+ if (Yt(n)) {
1002
999
  const l = [];
1003
1000
  for (let s = 0, c = n.children.length; s < c; s++) {
1004
1001
  const i = n.children[s];
1005
1002
  if (i) {
1006
- const u = t(i, s, n);
1007
- if (u)
1008
- for (let d = 0, f = u.length; d < f; d++) {
1009
- const m = u[d];
1003
+ const d = r(i, s, n);
1004
+ if (d)
1005
+ for (let u = 0, f = d.length; u < f; u++) {
1006
+ const m = d[u];
1010
1007
  m && l.push(m);
1011
1008
  }
1012
1009
  }
@@ -1016,11 +1013,11 @@ function Yt(r, e) {
1016
1013
  return e(n, o, a);
1017
1014
  }
1018
1015
  }
1019
- const Jt = $(() => () => (r) => {
1020
- Yt(r, (e, t, n) => Ut(e) ? ((n == null ? void 0 : n.type) === "root" && (e.children = [{ ...e }], delete e.value, e.type = "paragraph"), [e]) : [e]);
1021
- }), Qt = N(() => {
1022
- let r = !1;
1023
- const e = new v("MILKDOWN_INLINE_NODES_CURSOR"), t = new C({
1016
+ const Xt = $(() => () => (t) => {
1017
+ Qt(t, (e, r, n) => Jt(e) ? ((n == null ? void 0 : n.type) === "root" && (e.children = [{ ...e }], delete e.value, e.type = "paragraph"), [e]) : [e]);
1018
+ }), Zt = v(() => {
1019
+ let t = !1;
1020
+ const e = new C("MILKDOWN_INLINE_NODES_CURSOR"), r = new x({
1024
1021
  key: e,
1025
1022
  state: {
1026
1023
  init() {
@@ -1035,15 +1032,15 @@ const Jt = $(() => () => (r) => {
1035
1032
  },
1036
1033
  props: {
1037
1034
  handleDOMEvents: {
1038
- compositionend: (n, o) => r ? (r = !1, requestAnimationFrame(() => {
1039
- if (t.getState(n.state)) {
1035
+ compositionend: (n, o) => t ? (t = !1, requestAnimationFrame(() => {
1036
+ if (r.getState(n.state)) {
1040
1037
  const l = n.state.selection.from;
1041
1038
  o.preventDefault(), n.dispatch(n.state.tr.insertText(o.data || "", l));
1042
1039
  }
1043
1040
  }), !0) : !1,
1044
- compositionstart: (n) => (t.getState(n.state) && (r = !0), !1),
1041
+ compositionstart: (n) => (r.getState(n.state) && (t = !0), !1),
1045
1042
  beforeinput: (n, o) => {
1046
- if (t.getState(n.state) && o instanceof InputEvent && o.data && !r) {
1043
+ if (r.getState(n.state) && o instanceof InputEvent && o.data && !t) {
1047
1044
  const l = n.state.selection.from;
1048
1045
  return o.preventDefault(), n.dispatch(n.state.tr.insertText(o.data || "", l)), !0;
1049
1046
  }
@@ -1051,48 +1048,48 @@ const Jt = $(() => () => (r) => {
1051
1048
  }
1052
1049
  },
1053
1050
  decorations(n) {
1054
- if (t.getState(n)) {
1051
+ if (r.getState(n)) {
1055
1052
  const l = n.selection.$from.pos, s = document.createElement("span"), c = Z.widget(l, s, {
1056
1053
  side: -1
1057
- }), i = document.createElement("span"), u = Z.widget(l, i);
1054
+ }), i = document.createElement("span"), d = Z.widget(l, i);
1058
1055
  return setTimeout(() => {
1059
1056
  s.contentEditable = "true", i.contentEditable = "true";
1060
- }), ee.create(n.doc, [c, u]);
1057
+ }), ee.create(n.doc, [c, d]);
1061
1058
  }
1062
1059
  return ee.empty;
1063
1060
  }
1064
1061
  }
1065
1062
  });
1066
- return t;
1067
- }), Xt = N(() => new C({
1068
- key: new v("MILKDOWN_HARDBREAK_MARKS"),
1069
- appendTransaction: (r, e, t) => {
1070
- if (!r.length)
1063
+ return r;
1064
+ }), er = v(() => new x({
1065
+ key: new C("MILKDOWN_HARDBREAK_MARKS"),
1066
+ appendTransaction: (t, e, r) => {
1067
+ if (!t.length)
1071
1068
  return;
1072
- const [n] = r;
1069
+ const [n] = t;
1073
1070
  if (!n)
1074
1071
  return;
1075
1072
  const [o] = n.steps;
1076
1073
  if (n.getMeta("hardbreak")) {
1077
- if (!(o instanceof Ue))
1074
+ if (!(o instanceof Je))
1078
1075
  return;
1079
1076
  const { from: s } = o;
1080
- return t.tr.setNodeMarkup(s, L.type(), void 0, []);
1077
+ return r.tr.setNodeMarkup(s, w.type(), void 0, []);
1081
1078
  }
1082
- if (o instanceof Ye) {
1083
- let s = t.tr;
1079
+ if (o instanceof Qe) {
1080
+ let s = r.tr;
1084
1081
  const { from: c, to: i } = o;
1085
- return t.doc.nodesBetween(c, i, (u, d) => {
1086
- u.type === L.type() && (s = s.setNodeMarkup(d, L.type(), void 0, []));
1082
+ return r.doc.nodesBetween(c, i, (d, u) => {
1083
+ d.type === w.type() && (s = s.setNodeMarkup(u, w.type(), void 0, []));
1087
1084
  }), s;
1088
1085
  }
1089
1086
  }
1090
- })), Re = F(["table", "code_block"], "hardbreakFilterNodes"), Zt = N((r) => {
1091
- const e = r.get(Re.key);
1092
- return new C({
1093
- key: new v("MILKDOWN_HARDBREAK_FILTER"),
1094
- filterTransaction: (t, n) => {
1095
- const o = t.getMeta("hardbreak"), [a] = t.steps;
1087
+ })), Re = F(["table", "code_block"], "hardbreakFilterNodes"), tr = v((t) => {
1088
+ const e = t.get(Re.key);
1089
+ return new x({
1090
+ key: new C("MILKDOWN_HARDBREAK_FILTER"),
1091
+ filterTransaction: (r, n) => {
1092
+ const o = r.getMeta("hardbreak"), [a] = r.steps;
1096
1093
  if (o && a) {
1097
1094
  const { from: l } = a, s = n.doc.resolve(l);
1098
1095
  let c = s.depth, i = !0;
@@ -1103,171 +1100,171 @@ const Jt = $(() => () => (r) => {
1103
1100
  return !0;
1104
1101
  }
1105
1102
  });
1106
- }), er = N((r) => {
1107
- const e = new v("MILKDOWN_HEADING_ID"), t = (n) => {
1103
+ }), rr = v((t) => {
1104
+ const e = new C("MILKDOWN_HEADING_ID"), r = (n) => {
1108
1105
  if (n.composing || !n.editable)
1109
1106
  return;
1110
- const o = r.get(z.key), a = n.state.tr.setMeta("addToHistory", !1);
1107
+ const o = t.get(j.key), a = n.state.tr.setMeta("addToHistory", !1);
1111
1108
  let l = !1;
1112
1109
  n.state.doc.descendants((s, c) => {
1113
1110
  if (s.type === D.type()) {
1114
1111
  if (s.textContent.trim().length === 0)
1115
1112
  return;
1116
- const i = s.attrs, u = o(s);
1117
- i.id !== u && (l = !0, a.setMeta(e, !0).setNodeMarkup(c, void 0, {
1113
+ const i = s.attrs, d = o(s);
1114
+ i.id !== d && (l = !0, a.setMeta(e, !0).setNodeMarkup(c, void 0, {
1118
1115
  ...i,
1119
- id: u
1116
+ id: d
1120
1117
  }));
1121
1118
  }
1122
1119
  }), l && n.dispatch(a);
1123
1120
  };
1124
- return new C({
1121
+ return new x({
1125
1122
  key: e,
1126
- view: (n) => (t(n), {
1123
+ view: (n) => (r(n), {
1127
1124
  update: (o) => {
1128
- t(o);
1125
+ r(o);
1129
1126
  }
1130
1127
  })
1131
1128
  });
1132
- }), tr = N(() => {
1133
- const r = (e) => {
1129
+ }), nr = v(() => {
1130
+ const t = (e) => {
1134
1131
  if (e.composing || !e.editable)
1135
1132
  return;
1136
- const t = P.type(), n = R.type(), o = O.type(), a = e.state, l = (i, u) => {
1137
- let d = !1;
1138
- const f = `${u + 1}.`;
1139
- return i.label !== f && (i.label = f, d = !0), d;
1133
+ const r = P.type(), n = R.type(), o = O.type(), a = e.state, l = (i, d) => {
1134
+ let u = !1;
1135
+ const f = `${d + 1}.`;
1136
+ return i.label !== f && (i.label = f, u = !0), u;
1140
1137
  };
1141
1138
  let s = a.tr, c = !1;
1142
- a.doc.descendants((i, u, d, f) => {
1139
+ a.doc.descendants((i, d, u, f) => {
1143
1140
  if (i.type === n) {
1144
1141
  const m = i.maybeChild(0);
1145
- (m == null ? void 0 : m.type) === o && m.attrs.listType === "ordered" && (c = !0, s.setNodeMarkup(u, t, { spread: "true" }), i.descendants((h, _, Q, Pe) => {
1142
+ (m == null ? void 0 : m.type) === o && m.attrs.listType === "ordered" && (c = !0, s.setNodeMarkup(d, r, { spread: "true" }), i.descendants((h, _, Q, Pe) => {
1146
1143
  if (h.type === o) {
1147
1144
  const X = { ...h.attrs };
1148
1145
  l(X, Pe) && (s = s.setNodeMarkup(_, void 0, X));
1149
1146
  }
1150
1147
  return !1;
1151
1148
  }));
1152
- } else if (i.type === o && (d == null ? void 0 : d.type) === t) {
1149
+ } else if (i.type === o && (u == null ? void 0 : u.type) === r) {
1153
1150
  const m = { ...i.attrs };
1154
1151
  let h = !1;
1155
- m.listType !== "ordered" && (m.listType = "ordered", h = !0), (d == null ? void 0 : d.maybeChild(0)) && (h = l(m, f)), h && (s = s.setNodeMarkup(u, void 0, m), c = !0);
1152
+ m.listType !== "ordered" && (m.listType = "ordered", h = !0), (u == null ? void 0 : u.maybeChild(0)) && (h = l(m, f)), h && (s = s.setNodeMarkup(d, void 0, m), c = !0);
1156
1153
  }
1157
1154
  }), c && e.dispatch(s.setMeta("addToHistory", !1));
1158
1155
  };
1159
- return new C({
1160
- key: new v("MILKDOWN_KEEP_LIST_ORDER"),
1161
- view: (e) => (r(e), {
1162
- update: (t) => {
1163
- r(t);
1156
+ return new x({
1157
+ key: new C("MILKDOWN_KEEP_LIST_ORDER"),
1158
+ view: (e) => (t(e), {
1159
+ update: (r) => {
1160
+ t(r);
1164
1161
  }
1165
1162
  })
1166
1163
  });
1167
- }), rr = [
1164
+ }), or = [
1168
1165
  H,
1169
- Ft,
1170
- Xt,
1166
+ zt,
1167
+ er,
1171
1168
  Re,
1169
+ tr,
1172
1170
  Zt,
1173
- Qt,
1174
- Vt,
1175
- jt,
1176
1171
  Gt,
1177
- Jt,
1178
- er,
1179
- tr
1180
- ], Mr = [vt, Ct, xt, At, rr].flat();
1172
+ Ut,
1173
+ jt,
1174
+ Xt,
1175
+ rr,
1176
+ nr
1177
+ ], Nr = [xt, At, Lt, Tt, or].flat();
1181
1178
  export {
1182
1179
  be as blockquoteAttr,
1183
- it as blockquoteKeymap,
1180
+ ut as blockquoteKeymap,
1184
1181
  U as blockquoteSchema,
1185
- Se as bulletListAttr,
1186
- yt as bulletListKeymap,
1182
+ Te as bulletListAttr,
1183
+ It as bulletListKeymap,
1187
1184
  R as bulletListSchema,
1188
- Ne as codeBlockAttr,
1189
- dt as codeBlockKeymap,
1185
+ we as codeBlockAttr,
1186
+ pt as codeBlockKeymap,
1190
1187
  Y as codeBlockSchema,
1191
- xt as commands,
1192
- Mr as commonmark,
1188
+ Lt as commands,
1189
+ Nr as commonmark,
1193
1190
  ve as createCodeBlockCommand,
1194
- ut as createCodeBlockInputRule,
1195
- _t as defaultConfig,
1196
- rt as docSchema,
1191
+ mt as createCodeBlockInputRule,
1192
+ Bt as defaultConfig,
1193
+ ot as docSchema,
1197
1194
  Ie as downgradeHeadingCommand,
1198
- ce as emphasisAttr,
1199
- Qe as emphasisKeymap,
1200
- ie as emphasisSchema,
1195
+ le as emphasisAttr,
1196
+ Ze as emphasisKeymap,
1197
+ ce as emphasisSchema,
1201
1198
  xe as hardbreakAttr,
1202
- Xt as hardbreakClearMarkPlugin,
1199
+ er as hardbreakClearMarkPlugin,
1203
1200
  Re as hardbreakFilterNodes,
1204
- Zt as hardbreakFilterPlugin,
1205
- gt as hardbreakKeymap,
1206
- L as hardbreakSchema,
1201
+ tr as hardbreakFilterPlugin,
1202
+ ht as hardbreakKeymap,
1203
+ w as hardbreakSchema,
1207
1204
  Me as headingAttr,
1208
- z as headingIdGenerator,
1209
- lt as headingKeymap,
1205
+ j as headingIdGenerator,
1206
+ it as headingKeymap,
1210
1207
  D as headingSchema,
1211
1208
  Le as hrAttr,
1212
1209
  J as hrSchema,
1213
1210
  $e as htmlAttr,
1214
- Nt as htmlSchema,
1211
+ Ct as htmlSchema,
1215
1212
  Ce as imageAttr,
1216
- B as imageSchema,
1217
- ge as inlineCodeAttr,
1218
- Ze as inlineCodeKeymap,
1219
- x as inlineCodeSchema,
1220
- Qt as inlineNodesCursorPlugin,
1213
+ E as imageSchema,
1214
+ pe as inlineCodeAttr,
1215
+ tt as inlineCodeKeymap,
1216
+ A as inlineCodeSchema,
1217
+ Zt as inlineNodesCursorPlugin,
1221
1218
  H as inlineSyncConfig,
1222
- Ft as inlineSyncPlugin,
1223
- Ct as inputrules,
1219
+ zt as inlineSyncPlugin,
1220
+ At as inputrules,
1224
1221
  Ae as insertHardbreakCommand,
1225
- ht as insertHrCommand,
1226
- ft as insertHrInputRule,
1227
- mt as insertImageCommand,
1228
- yr as insertImageInputRule,
1229
- At as keymap,
1222
+ yt as insertHrCommand,
1223
+ kt as insertHrInputRule,
1224
+ gt as insertImageCommand,
1225
+ br as insertImageInputRule,
1226
+ Tt as keymap,
1230
1227
  Ke as liftListItemCommand,
1231
- he as linkAttr,
1232
- A as linkSchema,
1228
+ fe as linkAttr,
1229
+ L as linkSchema,
1233
1230
  He as listItemAttr,
1234
- bt as listItemKeymap,
1231
+ wt as listItemKeymap,
1235
1232
  O as listItemSchema,
1236
1233
  De as orderedListAttr,
1237
- It as orderedListKeymap,
1234
+ Nt as orderedListKeymap,
1238
1235
  P as orderedListSchema,
1239
1236
  ke as paragraphAttr,
1240
- nt as paragraphKeymap,
1241
- T as paragraphSchema,
1242
- rr as plugins,
1243
- Vt as remarkAddOrderInListPlugin,
1244
- Jt as remarkHtmlTransformer,
1245
- jt as remarkInlineLinkPlugin,
1246
- Gt as remarkLineBreak,
1247
- vt as schema,
1237
+ at as paragraphKeymap,
1238
+ S as paragraphSchema,
1239
+ or as plugins,
1240
+ Gt as remarkAddOrderInListPlugin,
1241
+ Xt as remarkHtmlTransformer,
1242
+ Ut as remarkInlineLinkPlugin,
1243
+ jt as remarkLineBreak,
1244
+ xt as schema,
1248
1245
  _e as sinkListItemCommand,
1249
- Ee as splitListItemCommand,
1246
+ Be as splitListItemCommand,
1250
1247
  de as strongAttr,
1251
- Xe as strongKeymap,
1252
- me as strongSchema,
1253
- er as syncHeadingIdPlugin,
1254
- tr as syncListOrderPlugin,
1255
- wt as textSchema,
1256
- ue as toggleEmphasisCommand,
1257
- fe as toggleInlineCodeCommand,
1258
- et as toggleLinkCommand,
1259
- pe as toggleStrongCommand,
1248
+ et as strongKeymap,
1249
+ ue as strongSchema,
1250
+ rr as syncHeadingIdPlugin,
1251
+ nr as syncListOrderPlugin,
1252
+ vt as textSchema,
1253
+ ie as toggleEmphasisCommand,
1254
+ ge as toggleInlineCodeCommand,
1255
+ rt as toggleLinkCommand,
1256
+ me as toggleStrongCommand,
1260
1257
  ye as turnIntoTextCommand,
1261
- kr as updateCodeBlockLanguageCommand,
1262
- pt as updateImageCommand,
1263
- tt as updateLinkCommand,
1264
- we as wrapInBlockquoteCommand,
1265
- ct as wrapInBlockquoteInputRule,
1266
- Te as wrapInBulletListCommand,
1267
- kt as wrapInBulletListInputRule,
1258
+ Ir as updateCodeBlockLanguageCommand,
1259
+ ft as updateImageCommand,
1260
+ nt as updateLinkCommand,
1261
+ Ne as wrapInBlockquoteCommand,
1262
+ dt as wrapInBlockquoteInputRule,
1263
+ Se as wrapInBulletListCommand,
1264
+ Mt as wrapInBulletListInputRule,
1268
1265
  I as wrapInHeadingCommand,
1269
- st as wrapInHeadingInputRule,
1266
+ ct as wrapInHeadingInputRule,
1270
1267
  Oe as wrapInOrderedListCommand,
1271
- Mt as wrapInOrderedListInputRule
1268
+ bt as wrapInOrderedListInputRule
1272
1269
  };
1273
1270
  //# sourceMappingURL=index.es.js.map