@opengis/form 0.1.35 → 0.1.36

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (32) hide show
  1. package/README.md +61 -61
  2. package/dist/api/suggest/suggestions_list.json +7 -7
  3. package/dist/{index-nwT42SeC.js → index-B3dhJa9_.js} +4052 -4052
  4. package/dist/index-B9CEJ-PZ.js +187 -0
  5. package/dist/{index-B1zV9Aax.js → index-Bh8_Wx51.js} +434 -477
  6. package/dist/index-CHHagWDa.js +2794 -0
  7. package/dist/{index-W4UOw8lU.js → index-CMmJu2Ql.js} +428 -505
  8. package/dist/{index-RwV1hx3A.js → index-CQZi4RyF.js} +21 -19
  9. package/dist/index-C_6bjz0U.js +138 -0
  10. package/dist/index-D3gVZYzr.js +78 -0
  11. package/dist/index-DJVijc0x.js +47 -0
  12. package/dist/{index-B3op5uFx.js → index-DQur75TQ.js} +29 -28
  13. package/dist/{index-sFkGqyu8.js → index-DsT4tZvp.js} +16 -20
  14. package/dist/{index-qhd_7MCX.js → index-DspmCbXc.js} +16 -20
  15. package/dist/index-z-RdtcIQ.js +11862 -0
  16. package/dist/index.css +1 -1
  17. package/dist/index.js +1 -1
  18. package/dist/index.umd.cjs +86 -86
  19. package/dist/src/components/inputs/date/datepicker/Datepicker.vue.d.ts.map +1 -1
  20. package/dist/src/composables/useInputOptions.d.ts +2 -2
  21. package/dist/src/composables/useInputOptions.d.ts.map +1 -1
  22. package/dist/src/utils/file.api.d.ts.map +1 -1
  23. package/dist/{vs-richtext-BFTDMrhE.js → vs-richtext-K83Az119.js} +22 -22
  24. package/locales/en.json +39 -39
  25. package/locales/uk.json +39 -39
  26. package/package.json +93 -93
  27. package/dist/index-BABsOLAW.js +0 -3085
  28. package/dist/index-CkUvn8lm.js +0 -153
  29. package/dist/index-D49VHc9h.js +0 -237
  30. package/dist/index-DZ7xh8lh.js +0 -50
  31. package/dist/index-MfTTOwHR.js +0 -89
  32. package/dist/index-pYkcVgEL.js +0 -12134
@@ -0,0 +1,2794 @@
1
+ import { N as T, w as $, m as b, T as A, M as j, a as D, b as B, P as I, d as R, t as de, S as z, n as Ye, x as Ze, y as Te, h as ie, z as Ce, E as w, A as U, B as Qe, C as et, F as tt, G as nt, H as rt, c as st, J as pe, K as it, k as ot, D as E, f as J, L as at, j as lt, l as ct, O as xe, q as ut } from "./index-z-RdtcIQ.js";
2
+ import { Slice as oe, Fragment as K } from "./index-ietpNeqa.js";
3
+ import { Heading as dt } from "./index-DQur75TQ.js";
4
+ import { Link as pt } from "./index-CMmJu2Ql.js";
5
+ import { Paragraph as ft } from "./index-DJVijc0x.js";
6
+ const Ie = /* @__PURE__ */ new WeakSet(), Ae = /* @__PURE__ */ new WeakSet();
7
+ function N(e) {
8
+ const t = e;
9
+ return Ie.add(t), t;
10
+ }
11
+ function ne(e) {
12
+ return Array.isArray(e) && Ie.has(e);
13
+ }
14
+ function Se(e) {
15
+ return e.flatMap((t) => t == null ? [] : Array.isArray(t) && Ae.has(t) && !ne(t) ? Se(t) : [t]);
16
+ }
17
+ function ht(e, t) {
18
+ if (e === "slot") return 0;
19
+ if (e instanceof Function) {
20
+ const s = e(t);
21
+ return Array.isArray(s) && !ne(s) && !Ae.has(s) ? N(s) : s;
22
+ }
23
+ const { children: n, ...r } = t ?? {};
24
+ if (e === "svg") throw new Error("SVG elements are not supported in the JSX syntax, use the array syntax instead");
25
+ if (Array.isArray(n)) {
26
+ if (ne(n)) return N([
27
+ e,
28
+ r,
29
+ n
30
+ ]);
31
+ if (n.length === 0) return N([e, r]);
32
+ const s = Se(n);
33
+ return s.length === 0 ? N([e, r]) : N([
34
+ e,
35
+ r,
36
+ ...s
37
+ ]);
38
+ }
39
+ return n != null ? N([
40
+ e,
41
+ r,
42
+ n
43
+ ]) : N([e, r]);
44
+ }
45
+ const G = (e, t) => ht(e, t), mt = (e, t) => {
46
+ var n;
47
+ const { state: r } = e, { selection: s } = r;
48
+ if (!s.empty) return !1;
49
+ const { $from: i } = s;
50
+ if (i.parentOffset !== 0) return !1;
51
+ const o = i.depth - 1;
52
+ if (o < 0) return !1;
53
+ const a = i.node(o), l = i.index(o);
54
+ if (l === 0) return !1;
55
+ if (a.type === t) return e.commands.lift(t.name);
56
+ const u = a.child(l - 1);
57
+ if (u.type !== t || !(!((n = u.lastChild) === null || n === void 0) && n.isTextblock)) return !1;
58
+ const d = i.before() - 1 - 1;
59
+ return e.commands.command(({ tr: c, dispatch: p }) => {
60
+ if (!p) return !0;
61
+ const f = i.parent.content, h = new oe(f, 0, 0);
62
+ return c.replace(d, i.after(), h), c.setSelection(A.create(c.doc, d + f.size)), c.scrollIntoView(), p(c), !0;
63
+ });
64
+ }, gt = /^\s*>\s$/, yt = T.create({
65
+ name: "blockquote",
66
+ addOptions() {
67
+ return { HTMLAttributes: {} };
68
+ },
69
+ content: "block+",
70
+ group: "block",
71
+ defining: !0,
72
+ parseHTML() {
73
+ return [{ tag: "blockquote" }];
74
+ },
75
+ renderHTML({ HTMLAttributes: e }) {
76
+ return /* @__PURE__ */ G("blockquote", {
77
+ ...b(this.options.HTMLAttributes, e),
78
+ children: /* @__PURE__ */ G("slot", {})
79
+ });
80
+ },
81
+ parseMarkdown: (e, t) => {
82
+ var n;
83
+ const r = (n = t.parseBlockChildren) !== null && n !== void 0 ? n : t.parseChildren;
84
+ return t.createNode("blockquote", void 0, r(e.tokens || []));
85
+ },
86
+ renderMarkdown: (e, t) => {
87
+ if (!e.content) return "";
88
+ const n = ">", r = [];
89
+ return e.content.forEach((s, i) => {
90
+ var o, a;
91
+ const l = ((o = (a = t.renderChild) === null || a === void 0 ? void 0 : a.call(t, s, i)) !== null && o !== void 0 ? o : t.renderChildren([s])).split(`
92
+ `).map((u) => u.trim() === "" ? n : `${n} ${u}`);
93
+ r.push(l.join(`
94
+ `));
95
+ }), r.join(`
96
+ ${n}
97
+ `);
98
+ },
99
+ addCommands() {
100
+ return {
101
+ setBlockquote: () => ({ commands: e }) => e.wrapIn(this.name),
102
+ toggleBlockquote: () => ({ commands: e }) => e.toggleWrap(this.name),
103
+ unsetBlockquote: () => ({ commands: e }) => e.lift(this.name)
104
+ };
105
+ },
106
+ addKeyboardShortcuts() {
107
+ return {
108
+ "Mod-Shift-b": () => this.editor.commands.toggleBlockquote(),
109
+ Backspace: () => mt(this.editor, this.type)
110
+ };
111
+ },
112
+ addInputRules() {
113
+ return [$({
114
+ find: gt,
115
+ type: this.type
116
+ })];
117
+ }
118
+ }), kt = /(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/, vt = /(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g, bt = /(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/, wt = /(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g, Mt = j.create({
119
+ name: "bold",
120
+ addOptions() {
121
+ return { HTMLAttributes: {} };
122
+ },
123
+ parseHTML() {
124
+ return [
125
+ { tag: "strong" },
126
+ {
127
+ tag: "b",
128
+ getAttrs: (e) => e.style.fontWeight !== "normal" && null
129
+ },
130
+ {
131
+ style: "font-weight=400",
132
+ clearMark: (e) => e.type.name === this.name
133
+ },
134
+ {
135
+ style: "font-weight",
136
+ getAttrs: (e) => /^(bold(er)?|[5-9]\d{2,})$/.test(e) && null
137
+ }
138
+ ];
139
+ },
140
+ renderHTML({ HTMLAttributes: e }) {
141
+ return /* @__PURE__ */ G("strong", {
142
+ ...b(this.options.HTMLAttributes, e),
143
+ children: /* @__PURE__ */ G("slot", {})
144
+ });
145
+ },
146
+ markdownTokenName: "strong",
147
+ parseMarkdown: (e, t) => t.applyMark("bold", t.parseInline(e.tokens || [])),
148
+ markdownOptions: { htmlReopen: {
149
+ open: "<strong>",
150
+ close: "</strong>"
151
+ } },
152
+ renderMarkdown: (e, t) => `**${t.renderChildren(e)}**`,
153
+ addCommands() {
154
+ return {
155
+ setBold: () => ({ commands: e }) => e.setMark(this.name),
156
+ toggleBold: () => ({ commands: e }) => e.toggleMark(this.name),
157
+ unsetBold: () => ({ commands: e }) => e.unsetMark(this.name)
158
+ };
159
+ },
160
+ addKeyboardShortcuts() {
161
+ return {
162
+ "Mod-b": () => this.editor.commands.toggleBold(),
163
+ "Mod-B": () => this.editor.commands.toggleBold()
164
+ };
165
+ },
166
+ addInputRules() {
167
+ return [B({
168
+ find: kt,
169
+ type: this.type
170
+ }), B({
171
+ find: bt,
172
+ type: this.type
173
+ })];
174
+ },
175
+ addPasteRules() {
176
+ return [D({
177
+ find: vt,
178
+ type: this.type
179
+ }), D({
180
+ find: wt,
181
+ type: this.type
182
+ })];
183
+ }
184
+ }), Lt = (e) => {
185
+ const t = /`([^`]+)`(?!`)$/.exec(e);
186
+ return !t || t.index > 0 && e[t.index - 1] === "`" ? null : {
187
+ index: t.index,
188
+ text: t[0],
189
+ replaceWith: t[1]
190
+ };
191
+ }, Tt = (e) => {
192
+ const t = /`([^`]+)`(?!`)/g, n = [];
193
+ let r;
194
+ for (; (r = t.exec(e)) !== null; )
195
+ r.index > 0 && e[r.index - 1] === "`" || n.push({
196
+ index: r.index,
197
+ text: r[0],
198
+ replaceWith: r[1]
199
+ });
200
+ return n;
201
+ }, Ct = j.create({
202
+ name: "code",
203
+ addOptions() {
204
+ return { HTMLAttributes: {} };
205
+ },
206
+ excludes: "_",
207
+ code: !0,
208
+ exitable: !0,
209
+ parseHTML() {
210
+ return [{ tag: "code" }];
211
+ },
212
+ renderHTML({ HTMLAttributes: e }) {
213
+ return [
214
+ "code",
215
+ b(this.options.HTMLAttributes, e),
216
+ 0
217
+ ];
218
+ },
219
+ markdownTokenName: "codespan",
220
+ parseMarkdown: (e, t) => t.applyMark("code", [{
221
+ type: "text",
222
+ text: e.text || ""
223
+ }]),
224
+ renderMarkdown: (e, t) => e.content ? `\`${t.renderChildren(e.content)}\`` : "",
225
+ addCommands() {
226
+ return {
227
+ setCode: () => ({ commands: e }) => e.setMark(this.name),
228
+ toggleCode: () => ({ commands: e }) => e.toggleMark(this.name),
229
+ unsetCode: () => ({ commands: e }) => e.unsetMark(this.name)
230
+ };
231
+ },
232
+ addKeyboardShortcuts() {
233
+ return { "Mod-e": () => this.editor.commands.toggleCode() };
234
+ },
235
+ addInputRules() {
236
+ return [B({
237
+ find: Lt,
238
+ type: this.type
239
+ })];
240
+ },
241
+ addPasteRules() {
242
+ return [D({
243
+ find: Tt,
244
+ type: this.type
245
+ })];
246
+ }
247
+ }), Q = 4, xt = /^```([a-z]+)?[\s\n]$/, It = /^~~~([a-z]+)?[\s\n]$/, At = T.create({
248
+ name: "codeBlock",
249
+ addOptions() {
250
+ return {
251
+ languageClassPrefix: "language-",
252
+ exitOnTripleEnter: !0,
253
+ exitOnArrowDown: !0,
254
+ exitOnArrowUp: !0,
255
+ defaultLanguage: null,
256
+ enableTabIndentation: !1,
257
+ tabSize: Q,
258
+ HTMLAttributes: {}
259
+ };
260
+ },
261
+ content: "text*",
262
+ marks: "",
263
+ group: "block",
264
+ code: !0,
265
+ defining: !0,
266
+ addAttributes() {
267
+ return { language: {
268
+ default: this.options.defaultLanguage,
269
+ parseHTML: (e) => {
270
+ var t;
271
+ const { languageClassPrefix: n } = this.options;
272
+ if (!n) return null;
273
+ const r = [...((t = e.firstElementChild) === null || t === void 0 ? void 0 : t.classList) || []].filter((s) => s.startsWith(n)).map((s) => s.replace(n, ""))[0];
274
+ return r || null;
275
+ },
276
+ rendered: !1
277
+ } };
278
+ },
279
+ parseHTML() {
280
+ return [{
281
+ tag: "pre",
282
+ preserveWhitespace: "full"
283
+ }];
284
+ },
285
+ renderHTML({ node: e, HTMLAttributes: t }) {
286
+ return [
287
+ "pre",
288
+ b(this.options.HTMLAttributes, t),
289
+ [
290
+ "code",
291
+ { class: e.attrs.language ? this.options.languageClassPrefix + e.attrs.language : null },
292
+ 0
293
+ ]
294
+ ];
295
+ },
296
+ markdownTokenName: "code",
297
+ parseMarkdown: (e, t) => {
298
+ var n, r;
299
+ return ((n = e.raw) === null || n === void 0 ? void 0 : n.startsWith("```")) === !1 && ((r = e.raw) === null || r === void 0 ? void 0 : r.startsWith("~~~")) === !1 && e.codeBlockStyle !== "indented" ? [] : t.createNode("codeBlock", { language: e.lang || null }, e.text ? [t.createTextNode(e.text)] : []);
300
+ },
301
+ renderMarkdown: (e, t) => {
302
+ var n;
303
+ let r = "";
304
+ const s = ((n = e.attrs) === null || n === void 0 ? void 0 : n.language) || "";
305
+ return e.content ? r = [
306
+ `\`\`\`${s}`,
307
+ t.renderChildren(e.content),
308
+ "```"
309
+ ].join(`
310
+ `) : r = `\`\`\`${s}
311
+
312
+ \`\`\``, r;
313
+ },
314
+ addCommands() {
315
+ return {
316
+ setCodeBlock: (e) => ({ commands: t }) => t.setNode(this.name, e),
317
+ toggleCodeBlock: (e) => ({ commands: t }) => t.toggleNode(this.name, "paragraph", e)
318
+ };
319
+ },
320
+ addKeyboardShortcuts() {
321
+ return {
322
+ "Mod-Alt-c": () => this.editor.commands.toggleCodeBlock(),
323
+ Backspace: () => {
324
+ const { empty: e, $anchor: t } = this.editor.state.selection, n = t.pos === 1;
325
+ return !e || t.parent.type.name !== this.name ? !1 : n || !t.parent.textContent.length ? this.editor.commands.clearNodes() : !1;
326
+ },
327
+ Tab: ({ editor: e }) => {
328
+ var t;
329
+ if (!this.options.enableTabIndentation) return !1;
330
+ const n = (t = this.options.tabSize) !== null && t !== void 0 ? t : Q, { state: r } = e, { selection: s } = r, { $from: i, empty: o } = s;
331
+ if (i.parent.type !== this.type) return !1;
332
+ const a = " ".repeat(n);
333
+ return o ? e.commands.insertContent(a) : e.commands.command(({ tr: l }) => {
334
+ const { from: u, to: d } = s, c = r.doc.textBetween(u, d, `
335
+ `, `
336
+ `).split(`
337
+ `).map((p) => a + p).join(`
338
+ `);
339
+ return l.replaceWith(u, d, r.schema.text(c)), !0;
340
+ });
341
+ },
342
+ "Shift-Tab": ({ editor: e }) => {
343
+ var t;
344
+ if (!this.options.enableTabIndentation) return !1;
345
+ const n = (t = this.options.tabSize) !== null && t !== void 0 ? t : Q, { state: r } = e, { selection: s } = r, { $from: i, empty: o } = s;
346
+ return i.parent.type !== this.type ? !1 : o ? e.commands.command(({ tr: a }) => {
347
+ var l;
348
+ const { pos: u } = i, d = i.start(), c = i.end(), p = r.doc.textBetween(d, c, `
349
+ `, `
350
+ `).split(`
351
+ `);
352
+ let f = 0, h = 0;
353
+ const m = u - d;
354
+ for (let M = 0; M < p.length; M += 1) {
355
+ if (h + p[M].length >= m) {
356
+ f = M;
357
+ break;
358
+ }
359
+ h += p[M].length + 1;
360
+ }
361
+ const g = ((l = p[f].match(/^ */)) === null || l === void 0 ? void 0 : l[0]) || "", C = Math.min(g.length, n);
362
+ if (C === 0) return !0;
363
+ let v = d;
364
+ for (let M = 0; M < f; M += 1) v += p[M].length + 1;
365
+ return a.delete(v, v + C), u - v <= C && a.setSelection(A.create(a.doc, v)), !0;
366
+ }) : e.commands.command(({ tr: a }) => {
367
+ const { from: l, to: u } = s, d = r.doc.textBetween(l, u, `
368
+ `, `
369
+ `).split(`
370
+ `).map((c) => {
371
+ var p;
372
+ const f = ((p = c.match(/^ */)) === null || p === void 0 ? void 0 : p[0]) || "", h = Math.min(f.length, n);
373
+ return c.slice(h);
374
+ }).join(`
375
+ `);
376
+ return a.replaceWith(l, u, r.schema.text(d)), !0;
377
+ });
378
+ },
379
+ Enter: ({ editor: e }) => {
380
+ if (!this.options.exitOnTripleEnter) return !1;
381
+ const { state: t } = e, { selection: n } = t, { $from: r, empty: s } = n;
382
+ if (!s || r.parent.type !== this.type) return !1;
383
+ const i = r.parentOffset === r.parent.nodeSize - 2, o = r.parent.textContent.endsWith(`
384
+
385
+ `);
386
+ return !i || !o ? !1 : e.chain().command(({ tr: a }) => (a.delete(r.pos - 2, r.pos), !0)).exitCode().run();
387
+ },
388
+ ArrowUp: ({ editor: e }) => {
389
+ if (!this.options.exitOnArrowUp) return !1;
390
+ const { state: t } = e, { selection: n } = t, { $from: r, empty: s } = n;
391
+ if (!s || r.parent.type !== this.type || r.parentOffset !== 0) return !1;
392
+ const i = r.before();
393
+ return i > 0 ? !1 : e.commands.insertDefaultBlock({ pos: i });
394
+ },
395
+ ArrowDown: ({ editor: e }) => {
396
+ if (!this.options.exitOnArrowDown) return !1;
397
+ const { state: t } = e, { selection: n, doc: r } = t, { $from: s, empty: i } = n;
398
+ if (!i || s.parent.type !== this.type || s.parentOffset !== s.parent.nodeSize - 2) return !1;
399
+ const o = s.after();
400
+ return o === void 0 ? !1 : r.nodeAt(o) ? e.commands.command(({ tr: a }) => (a.setSelection(z.near(r.resolve(o))), !0)) : e.commands.exitCode();
401
+ }
402
+ };
403
+ },
404
+ addInputRules() {
405
+ return [de({
406
+ find: xt,
407
+ type: this.type,
408
+ getAttributes: (e) => ({ language: e[1] })
409
+ }), de({
410
+ find: It,
411
+ type: this.type,
412
+ getAttributes: (e) => ({ language: e[1] })
413
+ })];
414
+ },
415
+ addProseMirrorPlugins() {
416
+ return [new I({
417
+ key: new R("codeBlockVSCodeHandler"),
418
+ props: { handlePaste: (e, t) => {
419
+ if (!t.clipboardData || this.editor.isActive(this.type.name)) return !1;
420
+ const n = t.clipboardData.getData("text/plain"), r = t.clipboardData.getData("vscode-editor-data"), s = r ? JSON.parse(r) : void 0, i = s?.mode;
421
+ if (!n || !i) return !1;
422
+ const { tr: o, schema: a } = e.state, l = a.text(n.replace(/\r\n?/g, `
423
+ `));
424
+ return o.replaceSelectionWith(this.type.create({ language: i }, l)), o.selection.$from.parent.type !== this.type && o.setSelection(A.near(o.doc.resolve(Math.max(0, o.selection.from - 2)))), o.setMeta("paste", !0), e.dispatch(o), !0;
425
+ } }
426
+ })];
427
+ }
428
+ }), St = T.create({
429
+ name: "doc",
430
+ topNode: !0,
431
+ content: "block+",
432
+ renderMarkdown: (e, t) => e.content ? t.renderChildren(e.content, `
433
+
434
+ `) : ""
435
+ }), Et = T.create({
436
+ name: "hardBreak",
437
+ markdownTokenName: "br",
438
+ addOptions() {
439
+ return {
440
+ keepMarks: !0,
441
+ HTMLAttributes: {}
442
+ };
443
+ },
444
+ inline: !0,
445
+ group: "inline",
446
+ selectable: !1,
447
+ linebreakReplacement: !0,
448
+ parseHTML() {
449
+ return [{ tag: "br" }];
450
+ },
451
+ renderHTML({ HTMLAttributes: e }) {
452
+ return ["br", b(this.options.HTMLAttributes, e)];
453
+ },
454
+ renderText() {
455
+ return `
456
+ `;
457
+ },
458
+ renderMarkdown: () => `
459
+ `,
460
+ parseMarkdown: () => ({ type: "hardBreak" }),
461
+ addCommands() {
462
+ return { setHardBreak: () => ({ commands: e, chain: t, state: n, editor: r }) => e.first([() => e.exitCode(), () => e.command(() => {
463
+ const { selection: s, storedMarks: i } = n;
464
+ if (s.$from.parent.type.spec.isolating) return !1;
465
+ const { keepMarks: o } = this.options, { splittableMarks: a } = r.extensionManager, l = i || s.$to.parentOffset && s.$from.marks();
466
+ return t().insertContent({ type: this.name }).command(({ tr: u, dispatch: d }) => {
467
+ if (d && l && o) {
468
+ const c = l.filter((p) => a.includes(p.type.name));
469
+ u.ensureMarks(c);
470
+ }
471
+ return !0;
472
+ }).scrollIntoView().run();
473
+ })]) };
474
+ },
475
+ addKeyboardShortcuts() {
476
+ return {
477
+ "Mod-Enter": () => this.editor.commands.setHardBreak(),
478
+ "Shift-Enter": () => this.editor.commands.setHardBreak()
479
+ };
480
+ }
481
+ }), Rt = T.create({
482
+ name: "horizontalRule",
483
+ addOptions() {
484
+ return {
485
+ HTMLAttributes: {},
486
+ nextNodeType: "paragraph"
487
+ };
488
+ },
489
+ group: "block",
490
+ parseHTML() {
491
+ return [{ tag: "hr" }];
492
+ },
493
+ renderHTML({ HTMLAttributes: e }) {
494
+ return ["hr", b(this.options.HTMLAttributes, e)];
495
+ },
496
+ markdownTokenName: "hr",
497
+ parseMarkdown: (e, t) => t.createNode("horizontalRule"),
498
+ renderMarkdown: () => "---",
499
+ addCommands() {
500
+ return { setHorizontalRule: () => ({ chain: e, state: t }) => {
501
+ if (!Ze(t, t.schema.nodes[this.name])) return !1;
502
+ const { selection: n } = t, { $to: r } = n, s = e();
503
+ return Te(n) ? s.insertContentAt(r.pos, { type: this.name }) : s.insertContent({ type: this.name }), s.command(({ state: i, tr: o, dispatch: a }) => {
504
+ if (a) {
505
+ const { $to: l } = o.selection, u = l.end();
506
+ if (l.nodeAfter)
507
+ l.nodeAfter.isTextblock ? o.setSelection(A.create(o.doc, l.pos + 1)) : l.nodeAfter.isBlock ? o.setSelection(ie.create(o.doc, l.pos)) : o.setSelection(A.create(o.doc, l.pos));
508
+ else {
509
+ const d = i.schema.nodes[this.options.nextNodeType] || l.parent.type.contentMatch.defaultType, c = d?.create();
510
+ c && (o.insert(u, c), o.setSelection(A.create(o.doc, u + 1)));
511
+ }
512
+ o.scrollIntoView();
513
+ }
514
+ return !0;
515
+ }).run();
516
+ } };
517
+ },
518
+ addInputRules() {
519
+ return [Ye({
520
+ find: /^(?:---|—-|___\s|\*\*\*\s)$/,
521
+ type: this.type
522
+ })];
523
+ }
524
+ }), Nt = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/, Pt = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g, Ot = /(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/, $t = /(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g, Dt = j.create({
525
+ name: "italic",
526
+ addOptions() {
527
+ return { HTMLAttributes: {} };
528
+ },
529
+ parseHTML() {
530
+ return [
531
+ { tag: "em" },
532
+ {
533
+ tag: "i",
534
+ getAttrs: (e) => e.style.fontStyle !== "normal" && null
535
+ },
536
+ {
537
+ style: "font-style=normal",
538
+ clearMark: (e) => e.type.name === this.name
539
+ },
540
+ { style: "font-style=italic" }
541
+ ];
542
+ },
543
+ renderHTML({ HTMLAttributes: e }) {
544
+ return [
545
+ "em",
546
+ b(this.options.HTMLAttributes, e),
547
+ 0
548
+ ];
549
+ },
550
+ addCommands() {
551
+ return {
552
+ setItalic: () => ({ commands: e }) => e.setMark(this.name),
553
+ toggleItalic: () => ({ commands: e }) => e.toggleMark(this.name),
554
+ unsetItalic: () => ({ commands: e }) => e.unsetMark(this.name)
555
+ };
556
+ },
557
+ markdownTokenName: "em",
558
+ parseMarkdown: (e, t) => t.applyMark("italic", t.parseInline(e.tokens || [])),
559
+ markdownOptions: { htmlReopen: {
560
+ open: "<em>",
561
+ close: "</em>"
562
+ } },
563
+ renderMarkdown: (e, t) => `*${t.renderChildren(e)}*`,
564
+ addKeyboardShortcuts() {
565
+ return {
566
+ "Mod-i": () => this.editor.commands.toggleItalic(),
567
+ "Mod-I": () => this.editor.commands.toggleItalic()
568
+ };
569
+ },
570
+ addInputRules() {
571
+ return [B({
572
+ find: Nt,
573
+ type: this.type
574
+ }), B({
575
+ find: Ot,
576
+ type: this.type
577
+ })];
578
+ },
579
+ addPasteRules() {
580
+ return [D({
581
+ find: Pt,
582
+ type: this.type
583
+ }), D({
584
+ find: $t,
585
+ type: this.type
586
+ })];
587
+ }
588
+ }), Bt = "listItem", fe = "textStyle", he = /^\s*([-+*])\s$/, Ee = T.create({
589
+ name: "bulletList",
590
+ addOptions() {
591
+ return {
592
+ itemTypeName: "listItem",
593
+ HTMLAttributes: {},
594
+ keepMarks: !1,
595
+ keepAttributes: !1
596
+ };
597
+ },
598
+ group: "block list",
599
+ content() {
600
+ return `${this.options.itemTypeName}+`;
601
+ },
602
+ parseHTML() {
603
+ return [{ tag: "ul" }];
604
+ },
605
+ renderHTML({ HTMLAttributes: e }) {
606
+ return [
607
+ "ul",
608
+ b(this.options.HTMLAttributes, e),
609
+ 0
610
+ ];
611
+ },
612
+ markdownTokenName: "list",
613
+ parseMarkdown: (e, t) => e.type !== "list" || e.ordered ? [] : {
614
+ type: "bulletList",
615
+ content: e.items ? t.parseChildren(e.items) : []
616
+ },
617
+ renderMarkdown: (e, t) => e.content ? t.renderChildren(e.content, `
618
+ `) : "",
619
+ markdownOptions: { indentsContent: !0 },
620
+ addCommands() {
621
+ return { toggleBulletList: () => ({ commands: e, chain: t }) => this.options.keepAttributes ? t().toggleList(this.name, this.options.itemTypeName, this.options.keepMarks).updateAttributes(Bt, this.editor.getAttributes(fe)).run() : e.toggleList(this.name, this.options.itemTypeName, this.options.keepMarks) };
622
+ },
623
+ addKeyboardShortcuts() {
624
+ return { "Mod-Shift-8": () => this.editor.commands.toggleBulletList() };
625
+ },
626
+ addInputRules() {
627
+ let e = $({
628
+ find: he,
629
+ type: this.type
630
+ });
631
+ return (this.options.keepMarks || this.options.keepAttributes) && (e = $({
632
+ find: he,
633
+ type: this.type,
634
+ keepMarks: this.options.keepMarks,
635
+ keepAttributes: this.options.keepAttributes,
636
+ getAttributes: () => this.editor.getAttributes(fe),
637
+ editor: this.editor
638
+ })), [e];
639
+ }
640
+ }), Ht = (e, t, n) => {
641
+ const { selection: r } = e;
642
+ if (!r.empty) return null;
643
+ const { $from: s } = r;
644
+ if (!s.parent.isTextblock || s.parentOffset !== s.parent.content.size) return null;
645
+ let i = -1;
646
+ for (let f = s.depth; f > 0; f -= 1) if (s.node(f).type.name === t) {
647
+ i = f;
648
+ break;
649
+ }
650
+ if (i < 0) return null;
651
+ const o = s.node(i), a = s.index(i);
652
+ if (a + 1 >= o.childCount) return null;
653
+ const l = o.child(a + 1);
654
+ if (!n.includes(l.type.name)) return null;
655
+ const u = e.schema.nodes[t];
656
+ let d = !1;
657
+ if (l.forEach((f) => {
658
+ f.type === u && f.childCount > 1 && (d = !0);
659
+ }), !d) return null;
660
+ const c = e.doc.resolve(s.after()).nodeAfter;
661
+ if (!c || !n.includes(c.type.name)) return null;
662
+ const p = [];
663
+ return c.forEach((f) => {
664
+ p.push(f);
665
+ }), p.length === 0 ? null : {
666
+ listItemDepth: i,
667
+ nestedList: c,
668
+ nestedListPos: s.after(),
669
+ insertPos: s.after(i),
670
+ items: p
671
+ };
672
+ }, _t = (e, t, n, r) => {
673
+ const s = Ht(e, n, r);
674
+ if (!s) return !1;
675
+ const { selection: i } = e, { nestedList: o, nestedListPos: a, insertPos: l, items: u } = s, d = e.tr;
676
+ d.delete(a, a + o.nodeSize);
677
+ const c = d.mapping.map(l);
678
+ return d.insert(c, K.from(u)), d.setSelection(i.map(d.doc, d.mapping)), t && t(d), !0;
679
+ }, zt = (e, t, n) => _t(e.state, e.view.dispatch, t, n), Re = (e, t) => w.create({
680
+ name: `${e}BranchingDeleteKeymap`,
681
+ priority: 101,
682
+ addKeyboardShortcuts() {
683
+ const n = () => zt(this.editor, e, t);
684
+ return {
685
+ Delete: n,
686
+ "Mod-Delete": n
687
+ };
688
+ }
689
+ }), Ne = [
690
+ [1e3, "m"],
691
+ [900, "cm"],
692
+ [500, "d"],
693
+ [400, "cd"],
694
+ [100, "c"],
695
+ [90, "xc"],
696
+ [50, "l"],
697
+ [40, "xl"],
698
+ [10, "x"],
699
+ [9, "ix"],
700
+ [5, "v"],
701
+ [4, "iv"],
702
+ [1, "i"]
703
+ ], F = "abcdefghijklmnopqrstuvwxyz", Pe = String.raw`\d+|[ivxlcdmIVXLCDM]+|${"[a-zA-Z]{1,2}"}`;
704
+ function Y(e) {
705
+ let t = e, n = "";
706
+ for (const [r, s] of Ne) for (; t >= r; )
707
+ n += s, t -= r;
708
+ return n;
709
+ }
710
+ function ae(e) {
711
+ return Y(e).toUpperCase();
712
+ }
713
+ function Oe(e) {
714
+ const t = e.toLowerCase();
715
+ let n = 0, r = 0;
716
+ for (; n < t.length; ) {
717
+ let s = !1;
718
+ for (const [i, o] of Ne) if (t.startsWith(o, n)) {
719
+ r += i, n += o.length, s = !0;
720
+ break;
721
+ }
722
+ if (!s) return 0;
723
+ }
724
+ return r;
725
+ }
726
+ function Kt(e) {
727
+ if (!/^[ivxlcdmIVXLCDM]+$/.test(e)) return !1;
728
+ const t = Oe(e);
729
+ return t <= 0 ? !1 : (e === e.toLowerCase() ? Y(t) : ae(t)) === e;
730
+ }
731
+ function jt(e) {
732
+ const t = e.toLowerCase();
733
+ if (t.length === 1) return t.charCodeAt(0) - 97 + 1;
734
+ if (t.length === 2) {
735
+ const n = t.charCodeAt(0) - 97, r = t.charCodeAt(1) - 97;
736
+ return (n + 1) * 26 + r + 1;
737
+ }
738
+ return 0;
739
+ }
740
+ function X(e) {
741
+ if (e <= 26) return F[e - 1];
742
+ const t = Math.floor((e - 1) / 26) - 1, n = (e - 1) % 26;
743
+ return t < 0 ? F[n] : F[t] + F[n];
744
+ }
745
+ function Z(e) {
746
+ if (!(!e || /^\d+$/.test(e))) {
747
+ if (Kt(e)) return e === e.toLowerCase() ? "i" : "I";
748
+ if (/^[a-z]{1,2}$/.test(e)) return "a";
749
+ if (/^[A-Z]{1,2}$/.test(e)) return "A";
750
+ }
751
+ }
752
+ function le(e) {
753
+ if (/^\d+$/.test(e)) return parseInt(e, 10);
754
+ const t = Z(e);
755
+ if (t === "i" || t === "I") return Oe(e);
756
+ if (t === "a" || t === "A") {
757
+ const r = jt(e);
758
+ return r > 0 ? r : 1;
759
+ }
760
+ const n = parseInt(e, 10);
761
+ return Number.isNaN(n) ? 1 : n;
762
+ }
763
+ function Ft(e, t) {
764
+ if (e === "numeric") return String(t);
765
+ switch (e) {
766
+ case "a":
767
+ return X(t);
768
+ case "A":
769
+ return X(t).toUpperCase();
770
+ case "i":
771
+ return Y(t);
772
+ case "I":
773
+ return ae(t);
774
+ default:
775
+ return String(t);
776
+ }
777
+ }
778
+ function Vt(e) {
779
+ var t;
780
+ if (e.length === 0) return !1;
781
+ const n = (t = Z(e[0])) !== null && t !== void 0 ? t : "numeric", r = le(e[0]);
782
+ if (r < 1) return !1;
783
+ for (let s = 0; s < e.length; s++) {
784
+ const i = Ft(n, r + s);
785
+ if (e[s] !== i) return !1;
786
+ }
787
+ return !0;
788
+ }
789
+ function Wt(e) {
790
+ return {
791
+ type: Z(e),
792
+ start: le(e)
793
+ };
794
+ }
795
+ function Ut(e) {
796
+ const { type: t, start: n } = Wt(e), r = {};
797
+ return t && (r.type = t), n !== 1 && (r.start = n), r;
798
+ }
799
+ function Gt(e, t, n = ". ") {
800
+ const r = t + 1;
801
+ if (!e || e === "1") return `${r}${n}`;
802
+ switch (e) {
803
+ case "a":
804
+ return `${X(r)}${n}`;
805
+ case "A":
806
+ return `${X(r).toUpperCase()}${n}`;
807
+ case "i":
808
+ return `${Y(r)}${n}`;
809
+ case "I":
810
+ return `${ae(r)}${n}`;
811
+ default:
812
+ return `${r}${n}`;
813
+ }
814
+ }
815
+ function Xt(e) {
816
+ var t, n;
817
+ const r = (t = e.tokens) === null || t === void 0 ? void 0 : t[0];
818
+ return !!(e.text && ((n = e.tokens) === null || n === void 0 ? void 0 : n.length) === 1 && r?.type === "list" && r.ordered && r.raw === e.text);
819
+ }
820
+ function qt(e, t) {
821
+ return t.tokenizeInline ? t.parseInline(t.tokenizeInline(e)) : t.parseInline([{
822
+ type: "text",
823
+ raw: e,
824
+ text: e
825
+ }]);
826
+ }
827
+ const $e = T.create({
828
+ name: "listItem",
829
+ addOptions() {
830
+ return {
831
+ HTMLAttributes: {},
832
+ bulletListTypeName: "bulletList",
833
+ orderedListTypeName: "orderedList"
834
+ };
835
+ },
836
+ content: "paragraph block*",
837
+ defining: !0,
838
+ parseHTML() {
839
+ return [{ tag: "li" }];
840
+ },
841
+ renderHTML({ HTMLAttributes: e }) {
842
+ return [
843
+ "li",
844
+ b(this.options.HTMLAttributes, e),
845
+ 0
846
+ ];
847
+ },
848
+ markdownTokenName: "list_item",
849
+ parseMarkdown: (e, t) => {
850
+ var n;
851
+ if (e.type !== "list_item") return [];
852
+ const r = (n = t.parseBlockChildren) !== null && n !== void 0 ? n : t.parseChildren;
853
+ let s = [];
854
+ if (e.tokens && e.tokens.length > 0) {
855
+ if (Xt(e)) return {
856
+ type: "listItem",
857
+ content: [{
858
+ type: "paragraph",
859
+ content: qt(e.text || "", t)
860
+ }]
861
+ };
862
+ if (e.tokens.some((i) => i.type === "paragraph")) s = r(e.tokens);
863
+ else {
864
+ const i = e.tokens[0];
865
+ if (i && i.type === "text" && i.tokens && i.tokens.length > 0) {
866
+ if (s = [{
867
+ type: "paragraph",
868
+ content: t.parseInline(i.tokens)
869
+ }], e.tokens.length > 1) {
870
+ const o = r(e.tokens.slice(1));
871
+ s.push(...o);
872
+ }
873
+ } else s = r(e.tokens);
874
+ }
875
+ }
876
+ return s.length === 0 && (s = [{
877
+ type: "paragraph",
878
+ content: []
879
+ }]), {
880
+ type: "listItem",
881
+ content: s
882
+ };
883
+ },
884
+ renderMarkdown: (e, t, n) => Ce(e, t, (r) => {
885
+ if (r.parentType === "bulletList") return "- ";
886
+ if (r.parentType === "orderedList") {
887
+ var s, i;
888
+ const o = ((s = r.meta) === null || s === void 0 || (s = s.parentAttrs) === null || s === void 0 ? void 0 : s.start) || 1;
889
+ return Gt((i = r.meta) === null || i === void 0 || (i = i.parentAttrs) === null || i === void 0 ? void 0 : i.type, o - 1 + (r.index || 0), ". ");
890
+ }
891
+ return "- ";
892
+ }, n, { alignNestedToPrefix: n?.parentType === "orderedList" }),
893
+ addExtensions() {
894
+ return [Re(this.name, [this.options.bulletListTypeName, this.options.orderedListTypeName])];
895
+ },
896
+ addKeyboardShortcuts() {
897
+ return {
898
+ Enter: () => this.editor.commands.splitListItem(this.name),
899
+ Tab: () => this.editor.commands.sinkListItem(this.name),
900
+ "Shift-Tab": () => this.editor.commands.liftListItem(this.name)
901
+ };
902
+ }
903
+ }), ce = (e, t) => {
904
+ const { $from: n } = t.selection, r = rt(e, t.schema);
905
+ let s = null, i = n.depth, o = n.pos, a = null;
906
+ for (; i > 0 && a === null; )
907
+ s = n.node(i), s.type === r ? a = i : (i -= 1, o -= 1);
908
+ return a === null ? null : {
909
+ $pos: t.doc.resolve(o),
910
+ depth: a
911
+ };
912
+ }, De = (e, t) => {
913
+ const n = ce(e, t);
914
+ if (!n) return !1;
915
+ const [, r] = nt(t, e, n.$pos.pos + 4);
916
+ return r;
917
+ }, Jt = (e, t, n) => {
918
+ const { $anchor: r } = e.selection, s = Math.max(0, r.pos - 2), i = e.doc.resolve(s).node();
919
+ return !(!i || !n.includes(i.type.name));
920
+ }, me = (e, t, n) => {
921
+ if (e.commands.undoInputRule()) return !0;
922
+ if (e.state.selection.from !== e.state.selection.to) return !1;
923
+ if (!U(e.state, t) && Jt(e.state, t, n)) {
924
+ const { $anchor: i } = e.state.selection, o = e.state.doc.resolve(i.before() - 1), a = [];
925
+ o.node().descendants((d, c) => {
926
+ d.type.name === t && a.push({
927
+ node: d,
928
+ pos: c
929
+ });
930
+ });
931
+ const l = a.at(-1);
932
+ if (!l) return !1;
933
+ const u = e.state.doc.resolve(o.start() + l.pos + 1);
934
+ return e.chain().cut({
935
+ from: i.start() - 1,
936
+ to: i.end() + 1
937
+ }, u.end()).joinForward().run();
938
+ }
939
+ if (!U(e.state, t) || !et(e.state)) return !1;
940
+ const { $from: r } = e.state.selection, s = r.depth - 1;
941
+ return r.node(s).type !== e.schema.nodes[t] || r.index(s) !== 0 ? !1 : e.chain().liftListItem(t).run();
942
+ }, Yt = (e, t) => {
943
+ const n = De(e, t), r = ce(e, t);
944
+ return !r || !n ? !1 : n > r.depth;
945
+ }, Zt = (e, t) => {
946
+ const n = De(e, t), r = ce(e, t);
947
+ return !r || !n ? !1 : n < r.depth;
948
+ }, ge = (e, t) => {
949
+ if (!U(e.state, t) || !tt(e.state, t)) return !1;
950
+ const { selection: n } = e.state, { $from: r, $to: s } = n;
951
+ return !n.empty && r.sameParent(s) ? !1 : Yt(t, e.state) ? e.chain().focus(e.state.selection.from + 4).lift(t).joinBackward().run() : Zt(t, e.state) ? e.chain().joinForward().joinBackward().run() : e.commands.joinItemForward();
952
+ }, Qt = (e, t, n) => {
953
+ const { state: r } = e, { selection: s } = r;
954
+ if (!s.empty) return !1;
955
+ const { $from: i } = s;
956
+ if (i.parentOffset !== 0 || !i.parent.isTextblock || U(r, t)) return !1;
957
+ const o = Qe(i);
958
+ if (!o || !n.includes(o.type.name)) return !1;
959
+ const a = o.lastChild;
960
+ if (!a || a.type.name !== t) return !1;
961
+ const l = i.parent;
962
+ if (!a.canReplace(a.childCount, a.childCount, K.from(l))) return !1;
963
+ const u = i.before(), d = i.after(), c = u - 2;
964
+ return e.commands.command(({ tr: p, dispatch: f }) => (f && (p.delete(u, d).insert(c, K.from(l)), p.setSelection(A.create(p.doc, c + 1)), p.scrollIntoView()), !0));
965
+ }, Be = w.create({
966
+ name: "listKeymap",
967
+ addOptions() {
968
+ return { listTypes: [{
969
+ itemName: "listItem",
970
+ wrapperNames: ["bulletList", "orderedList"]
971
+ }, {
972
+ itemName: "taskItem",
973
+ wrapperNames: ["taskList"]
974
+ }] };
975
+ },
976
+ addKeyboardShortcuts() {
977
+ return {
978
+ Delete: ({ editor: e }) => {
979
+ let t = !1;
980
+ return this.options.listTypes.forEach(({ itemName: n }) => {
981
+ e.state.schema.nodes[n] !== void 0 && ge(e, n) && (t = !0);
982
+ }), t;
983
+ },
984
+ "Mod-Delete": ({ editor: e }) => {
985
+ let t = !1;
986
+ return this.options.listTypes.forEach(({ itemName: n }) => {
987
+ e.state.schema.nodes[n] !== void 0 && ge(e, n) && (t = !0);
988
+ }), t;
989
+ },
990
+ Backspace: ({ editor: e }) => {
991
+ let t = !1;
992
+ return this.options.listTypes.forEach(({ itemName: n, wrapperNames: r }) => {
993
+ e.state.schema.nodes[n] !== void 0 && me(e, n, r) && (t = !0);
994
+ }), t;
995
+ },
996
+ "Mod-Backspace": ({ editor: e }) => {
997
+ let t = !1;
998
+ return this.options.listTypes.forEach(({ itemName: n, wrapperNames: r }) => {
999
+ e.state.schema.nodes[n] !== void 0 && me(e, n, r) && (t = !0);
1000
+ }), t;
1001
+ },
1002
+ Tab: ({ editor: e }) => {
1003
+ for (const { itemName: t, wrapperNames: n } of this.options.listTypes)
1004
+ if (e.state.schema.nodes[t] !== void 0 && Qt(e, t, n))
1005
+ return !0;
1006
+ return !1;
1007
+ }
1008
+ };
1009
+ }
1010
+ }), re = new RegExp(`^(\\s*)(${Pe})([.)])\\s+(.*)$`), en = /^\s/, O = {
1011
+ heading: /^#{1,6}(?:\s|$)/,
1012
+ bulletItem: /^[-+*]\s+/,
1013
+ codeFence: /^(?:```|~~~)/,
1014
+ blockMath: /^\$\$/,
1015
+ thematicBreak: /^(?:(?:-[ \t]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})$/
1016
+ };
1017
+ function tn(e) {
1018
+ return re.test(e.trimStart());
1019
+ }
1020
+ function nn(e) {
1021
+ const t = e.trimStart();
1022
+ return O.bulletItem.test(t) || tn(t) || O.heading.test(t) || O.thematicBreak.test(t) && !t.startsWith("-") || /^>\s?/.test(t) || O.codeFence.test(t) || O.blockMath.test(t);
1023
+ }
1024
+ function rn(e) {
1025
+ return Object.values(O).some((t) => t.test(e));
1026
+ }
1027
+ function sn(e) {
1028
+ const t = [], n = [];
1029
+ let r = !1;
1030
+ return e.forEach((s) => {
1031
+ if (r) {
1032
+ n.push(s);
1033
+ return;
1034
+ }
1035
+ if (s.trim() === "") {
1036
+ r = !0, n.push(s);
1037
+ return;
1038
+ }
1039
+ if (t.length > 0 && nn(s)) {
1040
+ r = !0, n.push(s);
1041
+ return;
1042
+ }
1043
+ t.push(s);
1044
+ }), {
1045
+ paragraphLines: t,
1046
+ blockLines: n
1047
+ };
1048
+ }
1049
+ function on(e) {
1050
+ const t = [];
1051
+ let n = 0, r = 0;
1052
+ for (; n < e.length; ) {
1053
+ const s = e[n], i = s.match(re);
1054
+ if (!i) break;
1055
+ const [, o, a, l, u] = i, d = o.length, c = parseInt(a, 10), p = isNaN(c) ? Z(a) : void 0, f = isNaN(c) ? le(a) : c, h = [u];
1056
+ let m = n + 1;
1057
+ const g = [s];
1058
+ let C = !1;
1059
+ for (; m < e.length; ) {
1060
+ const v = e[m];
1061
+ if (v.match(re)) break;
1062
+ if (v.trim() === "")
1063
+ g.push(v), h.push(""), C = !0, m += 1;
1064
+ else if (v.match(en)) {
1065
+ const M = v.length - v.trimStart().length, Je = d + a.length + 1;
1066
+ g.push(v), h.push(v.slice(Math.min(M, Je))), m += 1;
1067
+ } else {
1068
+ if (C || rn(v)) break;
1069
+ g.push(v), h.push(v), m += 1;
1070
+ }
1071
+ }
1072
+ t.push({
1073
+ indent: d,
1074
+ number: f,
1075
+ type: p,
1076
+ content: h.join(`
1077
+ `).trim(),
1078
+ contentLines: h,
1079
+ raw: g.join(`
1080
+ `)
1081
+ }), r = m, n = m;
1082
+ }
1083
+ return [t, r];
1084
+ }
1085
+ const an = new RegExp(`^(${Pe})([.)])\\s+(.+)$`);
1086
+ function ln(e) {
1087
+ const t = e.split(`
1088
+ `).filter((r) => r.trim().length > 0);
1089
+ if (t.length === 0) return null;
1090
+ const n = [];
1091
+ for (const r of t) {
1092
+ const s = r.trim().match(an);
1093
+ if (!s) return null;
1094
+ n.push({
1095
+ marker: s[1],
1096
+ content: s[3]
1097
+ });
1098
+ }
1099
+ return Vt(n.map((r) => r.marker)) ? {
1100
+ type: "orderedList",
1101
+ attrs: Ut(n[0].marker),
1102
+ content: n.map((r) => ({
1103
+ type: "listItem",
1104
+ content: [{
1105
+ type: "paragraph",
1106
+ content: [{
1107
+ type: "text",
1108
+ text: r.content
1109
+ }]
1110
+ }]
1111
+ }))
1112
+ } : null;
1113
+ }
1114
+ function He(e, t, n) {
1115
+ const r = [];
1116
+ let s = 0;
1117
+ for (; s < e.length; ) {
1118
+ const i = e[s];
1119
+ if (i.indent === t) {
1120
+ const { paragraphLines: o, blockLines: a } = sn(i.contentLines), l = o.join(`
1121
+ `).trim(), u = [];
1122
+ l && u.push({
1123
+ type: "paragraph",
1124
+ raw: l,
1125
+ tokens: n.inlineTokens(l)
1126
+ });
1127
+ const d = a.join(`
1128
+ `).trim();
1129
+ if (d) {
1130
+ const f = n.blockTokens(d);
1131
+ u.push(...f);
1132
+ }
1133
+ let c = s + 1;
1134
+ const p = [];
1135
+ for (; c < e.length && e[c].indent > t; )
1136
+ p.push(e[c]), c += 1;
1137
+ if (p.length > 0) {
1138
+ const f = He(p, Math.min(...p.map((h) => h.indent)), n);
1139
+ u.push({
1140
+ type: "list",
1141
+ ordered: !0,
1142
+ start: p[0].number,
1143
+ typeMarker: p[0].type,
1144
+ items: f,
1145
+ raw: p.map((h) => h.raw).join(`
1146
+ `)
1147
+ });
1148
+ }
1149
+ r.push({
1150
+ type: "list_item",
1151
+ raw: i.raw,
1152
+ tokens: u
1153
+ }), s = c;
1154
+ } else s += 1;
1155
+ }
1156
+ return r;
1157
+ }
1158
+ function cn(e, t) {
1159
+ return e.map((n) => {
1160
+ if (n.type !== "list_item") return t.parseChildren([n])[0];
1161
+ const r = [];
1162
+ return n.tokens && n.tokens.length > 0 && n.tokens.forEach((s) => {
1163
+ if (s.type === "paragraph" || s.type === "list" || s.type === "blockquote" || s.type === "code") r.push(...t.parseChildren([s]));
1164
+ else if (s.type === "text" && s.tokens) {
1165
+ const i = t.parseChildren([s]);
1166
+ r.push({
1167
+ type: "paragraph",
1168
+ content: i
1169
+ });
1170
+ } else {
1171
+ const i = t.parseChildren([s]);
1172
+ i.length > 0 && r.push(...i);
1173
+ }
1174
+ }), {
1175
+ type: "listItem",
1176
+ content: r
1177
+ };
1178
+ });
1179
+ }
1180
+ const un = "listItem", ye = "textStyle", ke = /^(\d+)\.\s$/;
1181
+ function ve(e) {
1182
+ const t = e.match(/list-style-type\s*:\s*([^;]+)/i);
1183
+ if (!t) return null;
1184
+ switch (t[1].trim().toLowerCase()) {
1185
+ case "upper-roman":
1186
+ return "I";
1187
+ case "lower-roman":
1188
+ return "i";
1189
+ case "upper-alpha":
1190
+ case "upper-latin":
1191
+ return "A";
1192
+ case "lower-alpha":
1193
+ case "lower-latin":
1194
+ return "a";
1195
+ default:
1196
+ return null;
1197
+ }
1198
+ }
1199
+ const _e = T.create({
1200
+ name: "orderedList",
1201
+ addOptions() {
1202
+ return {
1203
+ itemTypeName: "listItem",
1204
+ HTMLAttributes: {},
1205
+ keepMarks: !1,
1206
+ keepAttributes: !1
1207
+ };
1208
+ },
1209
+ group: "block list",
1210
+ content() {
1211
+ return `${this.options.itemTypeName}+`;
1212
+ },
1213
+ addAttributes() {
1214
+ return {
1215
+ start: {
1216
+ default: 1,
1217
+ parseHTML: (e) => e.hasAttribute("start") ? parseInt(e.getAttribute("start") || "", 10) : 1
1218
+ },
1219
+ type: {
1220
+ default: null,
1221
+ parseHTML: (e) => {
1222
+ const t = e.getAttribute("type");
1223
+ if (t) return t;
1224
+ const n = e.getAttribute("style");
1225
+ if (n) {
1226
+ const s = ve(n);
1227
+ if (s) return s;
1228
+ }
1229
+ const r = e.querySelector("li");
1230
+ if (r) {
1231
+ const s = r.getAttribute("style");
1232
+ if (s) {
1233
+ const i = ve(s);
1234
+ if (i) return i;
1235
+ }
1236
+ }
1237
+ return null;
1238
+ }
1239
+ }
1240
+ };
1241
+ },
1242
+ parseHTML() {
1243
+ return [{ tag: "ol" }];
1244
+ },
1245
+ renderHTML({ HTMLAttributes: e }) {
1246
+ const { start: t, type: n, ...r } = e, s = b(this.options.HTMLAttributes, r);
1247
+ return t !== 1 && (s.start = t), n && n !== "1" && (s.type = n), [
1248
+ "ol",
1249
+ s,
1250
+ 0
1251
+ ];
1252
+ },
1253
+ markdownTokenName: "list",
1254
+ parseMarkdown: (e, t) => {
1255
+ if (e.type !== "list" || !e.ordered) return [];
1256
+ const n = e.start || 1, r = e.typeMarker, s = e.items ? cn(e.items, t) : [], i = {};
1257
+ return n !== 1 && (i.start = n), r && (i.type = r), Object.keys(i).length > 0 ? {
1258
+ type: "orderedList",
1259
+ attrs: i,
1260
+ content: s
1261
+ } : {
1262
+ type: "orderedList",
1263
+ content: s
1264
+ };
1265
+ },
1266
+ renderMarkdown: (e, t) => e.content ? t.renderChildren(e.content, `
1267
+ `) : "",
1268
+ markdownTokenizer: {
1269
+ name: "orderedList",
1270
+ level: "block",
1271
+ start: () => -1,
1272
+ tokenize: (e, t, n) => {
1273
+ var r, s;
1274
+ const i = e.split(`
1275
+ `), [o, a] = on(i);
1276
+ if (o.length === 0) return;
1277
+ const l = He(o, o[0].indent, n);
1278
+ if (l.length !== 0)
1279
+ return {
1280
+ type: "list",
1281
+ ordered: !0,
1282
+ start: ((r = o[0]) === null || r === void 0 ? void 0 : r.number) || 1,
1283
+ typeMarker: (s = o[0]) === null || s === void 0 ? void 0 : s.type,
1284
+ items: l,
1285
+ raw: i.slice(0, a).join(`
1286
+ `)
1287
+ };
1288
+ }
1289
+ },
1290
+ markdownOptions: { indentsContent: !0 },
1291
+ addCommands() {
1292
+ return { toggleOrderedList: () => ({ commands: e, chain: t }) => this.options.keepAttributes ? t().toggleList(this.name, this.options.itemTypeName, this.options.keepMarks).updateAttributes(un, this.editor.getAttributes(ye)).run() : e.toggleList(this.name, this.options.itemTypeName, this.options.keepMarks) };
1293
+ },
1294
+ addKeyboardShortcuts() {
1295
+ return { "Mod-Shift-7": () => this.editor.commands.toggleOrderedList() };
1296
+ },
1297
+ addProseMirrorPlugins() {
1298
+ return [new I({ props: { handlePaste: (e, t) => {
1299
+ var n, r;
1300
+ const s = (n = t.clipboardData) === null || n === void 0 ? void 0 : n.getData("text/html");
1301
+ if (s?.trim()) return !1;
1302
+ const i = (r = t.clipboardData) === null || r === void 0 ? void 0 : r.getData("text/plain");
1303
+ if (!i) return !1;
1304
+ const o = ln(i);
1305
+ if (!o) return !1;
1306
+ try {
1307
+ const a = e.state.schema.nodeFromJSON(o), l = e.state.tr.replaceSelectionWith(a);
1308
+ return e.dispatch(l), !0;
1309
+ } catch {
1310
+ return !1;
1311
+ }
1312
+ } } })];
1313
+ },
1314
+ addInputRules() {
1315
+ const e = (n, r) => (!r.attrs.type || r.attrs.type === "1") && r.childCount + r.attrs.start === +n[1];
1316
+ let t = $({
1317
+ find: ke,
1318
+ type: this.type,
1319
+ getAttributes: (n) => ({ start: +n[1] }),
1320
+ joinPredicate: e
1321
+ });
1322
+ return (this.options.keepMarks || this.options.keepAttributes) && (t = $({
1323
+ find: ke,
1324
+ type: this.type,
1325
+ keepMarks: this.options.keepMarks,
1326
+ keepAttributes: this.options.keepAttributes,
1327
+ getAttributes: (n) => ({
1328
+ start: +n[1],
1329
+ ...this.editor.getAttributes(ye)
1330
+ }),
1331
+ joinPredicate: e,
1332
+ editor: this.editor
1333
+ })), [t];
1334
+ }
1335
+ }), dn = /^\s*(\[([( |x])?\])\s$/, pn = "position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0", fn = (e, t, n) => {
1336
+ var r;
1337
+ return (n == null || (r = n.checkboxLabel) === null || r === void 0 ? void 0 : r.call(n, e, t)) || `Task item checkbox for ${e.textContent || "empty task item"}`;
1338
+ }, hn = T.create({
1339
+ name: "taskItem",
1340
+ addOptions() {
1341
+ return {
1342
+ nested: !1,
1343
+ HTMLAttributes: {},
1344
+ taskListTypeName: "taskList",
1345
+ a11y: void 0
1346
+ };
1347
+ },
1348
+ content() {
1349
+ return this.options.nested ? "paragraph block*" : "paragraph+";
1350
+ },
1351
+ defining: !0,
1352
+ addAttributes() {
1353
+ return { checked: {
1354
+ default: !1,
1355
+ keepOnSplit: !1,
1356
+ parseHTML: (e) => {
1357
+ const t = e.getAttribute("data-checked");
1358
+ return t === "" || t === "true";
1359
+ },
1360
+ renderHTML: (e) => ({ "data-checked": e.checked })
1361
+ } };
1362
+ },
1363
+ parseHTML() {
1364
+ return [{
1365
+ tag: `li[data-type="${this.name}"]`,
1366
+ priority: 51,
1367
+ contentElement: (e) => {
1368
+ var t;
1369
+ return (t = e.querySelector("div")) !== null && t !== void 0 ? t : e;
1370
+ }
1371
+ }];
1372
+ },
1373
+ renderHTML({ node: e, HTMLAttributes: t }) {
1374
+ return [
1375
+ "li",
1376
+ b(this.options.HTMLAttributes, t, { "data-type": this.name }),
1377
+ [
1378
+ "label",
1379
+ ["input", {
1380
+ type: "checkbox",
1381
+ checked: e.attrs.checked ? "checked" : null
1382
+ }],
1383
+ ["span"]
1384
+ ],
1385
+ ["div", 0]
1386
+ ];
1387
+ },
1388
+ parseMarkdown: (e, t) => {
1389
+ const n = [];
1390
+ if (e.tokens && e.tokens.length > 0 ? n.push(t.createNode("paragraph", {}, t.parseInline(e.tokens))) : e.text ? n.push(t.createNode("paragraph", {}, [t.createNode("text", { text: e.text })])) : n.push(t.createNode("paragraph", {}, [])), e.nestedTokens && e.nestedTokens.length > 0) {
1391
+ const r = t.parseChildren(e.nestedTokens);
1392
+ n.push(...r);
1393
+ }
1394
+ return t.createNode("taskItem", { checked: e.checked || !1 }, n);
1395
+ },
1396
+ renderMarkdown: (e, t) => {
1397
+ var n;
1398
+ const r = `- [${!((n = e.attrs) === null || n === void 0) && n.checked ? "x" : " "}] `;
1399
+ return Ce(e, t, r);
1400
+ },
1401
+ addExtensions() {
1402
+ return this.options.nested ? [Re(this.name, [this.options.taskListTypeName])] : [];
1403
+ },
1404
+ addKeyboardShortcuts() {
1405
+ const e = {
1406
+ Enter: () => this.editor.commands.splitListItem(this.name),
1407
+ "Shift-Tab": () => this.editor.commands.liftListItem(this.name)
1408
+ };
1409
+ return this.options.nested ? {
1410
+ ...e,
1411
+ Tab: () => this.editor.commands.sinkListItem(this.name)
1412
+ } : e;
1413
+ },
1414
+ addNodeView() {
1415
+ return ({ node: e, HTMLAttributes: t, getPos: n, editor: r }) => {
1416
+ const s = document.createElement("li"), i = document.createElement("label"), o = document.createElement("span"), a = document.createElement("input"), l = document.createElement("div");
1417
+ o.style.cssText = pn;
1418
+ const u = (c) => {
1419
+ const p = fn(c, c.attrs.checked, this.options.a11y);
1420
+ a.setAttribute("aria-label", p), o.textContent = p;
1421
+ };
1422
+ u(e), i.contentEditable = "false", a.type = "checkbox", a.addEventListener("mousedown", (c) => c.preventDefault()), a.addEventListener("change", (c) => {
1423
+ if (!r.isEditable && !this.options.onReadOnlyChecked) {
1424
+ a.checked = !a.checked;
1425
+ return;
1426
+ }
1427
+ const { checked: p } = c.target;
1428
+ r.isEditable && typeof n == "function" && r.chain().focus(void 0, { scrollIntoView: !1 }).command(({ tr: f }) => {
1429
+ const h = n();
1430
+ if (typeof h != "number") return !1;
1431
+ const m = f.doc.nodeAt(h);
1432
+ return f.setNodeMarkup(h, void 0, {
1433
+ ...m?.attrs,
1434
+ checked: p
1435
+ }), !0;
1436
+ }).run(), !r.isEditable && this.options.onReadOnlyChecked && (this.options.onReadOnlyChecked(e, p) || (a.checked = !a.checked));
1437
+ }), Object.entries(this.options.HTMLAttributes).forEach(([c, p]) => {
1438
+ s.setAttribute(c, p);
1439
+ }), s.dataset.checked = e.attrs.checked, a.checked = e.attrs.checked, i.append(a, o), s.append(i, l), Object.entries(t).forEach(([c, p]) => {
1440
+ s.setAttribute(c, p);
1441
+ });
1442
+ let d = new Set(Object.keys(t));
1443
+ return {
1444
+ dom: s,
1445
+ contentDOM: l,
1446
+ update: (c) => {
1447
+ if (c.type !== this.type) return !1;
1448
+ s.dataset.checked = c.attrs.checked, a.checked = c.attrs.checked, u(c);
1449
+ const p = r.extensionManager.attributes, f = st(c, p), h = new Set(Object.keys(f)), m = this.options.HTMLAttributes;
1450
+ return d.forEach((g) => {
1451
+ h.has(g) || (g in m ? s.setAttribute(g, m[g]) : s.removeAttribute(g));
1452
+ }), Object.entries(f).forEach(([g, C]) => {
1453
+ C == null ? g in m ? s.setAttribute(g, m[g]) : s.removeAttribute(g) : s.setAttribute(g, C);
1454
+ }), d = h, !0;
1455
+ }
1456
+ };
1457
+ };
1458
+ },
1459
+ addInputRules() {
1460
+ return [$({
1461
+ find: dn,
1462
+ type: this.type,
1463
+ getAttributes: (e) => ({ checked: e[e.length - 1] === "x" })
1464
+ })];
1465
+ }
1466
+ }), mn = T.create({
1467
+ name: "taskList",
1468
+ addOptions() {
1469
+ return {
1470
+ itemTypeName: "taskItem",
1471
+ HTMLAttributes: {}
1472
+ };
1473
+ },
1474
+ group: "block list",
1475
+ content() {
1476
+ return `${this.options.itemTypeName}+`;
1477
+ },
1478
+ parseHTML() {
1479
+ return [{
1480
+ tag: `ul[data-type="${this.name}"]`,
1481
+ priority: 51
1482
+ }];
1483
+ },
1484
+ renderHTML({ HTMLAttributes: e }) {
1485
+ return [
1486
+ "ul",
1487
+ b(this.options.HTMLAttributes, e, { "data-type": this.name }),
1488
+ 0
1489
+ ];
1490
+ },
1491
+ parseMarkdown: (e, t) => t.createNode("taskList", {}, t.parseChildren(e.items || [])),
1492
+ renderMarkdown: (e, t) => e.content ? t.renderChildren(e.content, `
1493
+ `) : "",
1494
+ markdownTokenizer: {
1495
+ name: "taskList",
1496
+ level: "block",
1497
+ start(e) {
1498
+ var t;
1499
+ const n = (t = e.match(/^\s*[-+*]\s+\[([ xX])\]\s+/)) === null || t === void 0 ? void 0 : t.index;
1500
+ return n !== void 0 ? n : -1;
1501
+ },
1502
+ tokenize(e, t, n) {
1503
+ const r = (i) => {
1504
+ const o = pe(i, {
1505
+ itemPattern: /^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,
1506
+ extractItemData: (a) => ({
1507
+ indentLevel: a[1].length,
1508
+ mainContent: a[4],
1509
+ checked: a[3].toLowerCase() === "x"
1510
+ }),
1511
+ createToken: (a, l) => ({
1512
+ type: "taskItem",
1513
+ raw: "",
1514
+ mainContent: a.mainContent,
1515
+ indentLevel: a.indentLevel,
1516
+ checked: a.checked,
1517
+ text: a.mainContent,
1518
+ tokens: n.inlineTokens(a.mainContent),
1519
+ nestedTokens: l
1520
+ }),
1521
+ customNestedParser: r
1522
+ }, n);
1523
+ if (o) {
1524
+ const a = {
1525
+ type: "taskList",
1526
+ raw: o.raw,
1527
+ items: o.items
1528
+ }, l = i.slice(o.raw.length);
1529
+ return l.trim() ? [a, ...n.blockTokens(l)] : [a];
1530
+ }
1531
+ return n.blockTokens(i);
1532
+ }, s = pe(e, {
1533
+ itemPattern: /^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,
1534
+ extractItemData: (i) => ({
1535
+ indentLevel: i[1].length,
1536
+ mainContent: i[4],
1537
+ checked: i[3].toLowerCase() === "x"
1538
+ }),
1539
+ createToken: (i, o) => ({
1540
+ type: "taskItem",
1541
+ raw: "",
1542
+ mainContent: i.mainContent,
1543
+ indentLevel: i.indentLevel,
1544
+ checked: i.checked,
1545
+ text: i.mainContent,
1546
+ tokens: n.inlineTokens(i.mainContent),
1547
+ nestedTokens: o
1548
+ }),
1549
+ customNestedParser: r
1550
+ }, n);
1551
+ if (s)
1552
+ return {
1553
+ type: "taskList",
1554
+ raw: s.raw,
1555
+ items: s.items
1556
+ };
1557
+ }
1558
+ },
1559
+ markdownOptions: { indentsContent: !0 },
1560
+ addCommands() {
1561
+ return { toggleTaskList: () => ({ commands: e }) => e.toggleList(this.name, this.options.itemTypeName) };
1562
+ },
1563
+ addKeyboardShortcuts() {
1564
+ return { "Mod-Shift-9": () => this.editor.commands.toggleTaskList() };
1565
+ }
1566
+ });
1567
+ w.create({
1568
+ name: "listKit",
1569
+ addExtensions() {
1570
+ const e = [];
1571
+ return this.options.bulletList !== !1 && e.push(Ee.configure(this.options.bulletList)), this.options.listItem !== !1 && e.push($e.configure(this.options.listItem)), this.options.listKeymap !== !1 && e.push(Be.configure(this.options.listKeymap)), this.options.orderedList !== !1 && e.push(_e.configure(this.options.orderedList)), this.options.taskItem !== !1 && e.push(hn.configure(this.options.taskItem)), this.options.taskList !== !1 && e.push(mn.configure(this.options.taskList)), e;
1572
+ }
1573
+ });
1574
+ const gn = /(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/, yn = /(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g, kn = j.create({
1575
+ name: "strike",
1576
+ addOptions() {
1577
+ return { HTMLAttributes: {} };
1578
+ },
1579
+ parseHTML() {
1580
+ return [
1581
+ { tag: "s" },
1582
+ { tag: "del" },
1583
+ { tag: "strike" },
1584
+ {
1585
+ style: "text-decoration",
1586
+ consuming: !1,
1587
+ getAttrs: (e) => e.includes("line-through") ? {} : !1
1588
+ }
1589
+ ];
1590
+ },
1591
+ renderHTML({ HTMLAttributes: e }) {
1592
+ return [
1593
+ "s",
1594
+ b(this.options.HTMLAttributes, e),
1595
+ 0
1596
+ ];
1597
+ },
1598
+ markdownTokenName: "del",
1599
+ parseMarkdown: (e, t) => t.applyMark("strike", t.parseInline(e.tokens || [])),
1600
+ renderMarkdown: (e, t) => `~~${t.renderChildren(e)}~~`,
1601
+ addCommands() {
1602
+ return {
1603
+ setStrike: () => ({ commands: e }) => e.setMark(this.name),
1604
+ toggleStrike: () => ({ commands: e }) => e.toggleMark(this.name),
1605
+ unsetStrike: () => ({ commands: e }) => e.unsetMark(this.name)
1606
+ };
1607
+ },
1608
+ addKeyboardShortcuts() {
1609
+ return { "Mod-Shift-s": () => this.editor.commands.toggleStrike() };
1610
+ },
1611
+ addInputRules() {
1612
+ return [B({
1613
+ find: gn,
1614
+ type: this.type
1615
+ })];
1616
+ },
1617
+ addPasteRules() {
1618
+ return [D({
1619
+ find: yn,
1620
+ type: this.type
1621
+ })];
1622
+ }
1623
+ }), vn = T.create({
1624
+ name: "text",
1625
+ group: "inline",
1626
+ parseMarkdown: (e) => ({
1627
+ type: "text",
1628
+ text: e.text || ""
1629
+ }),
1630
+ renderMarkdown: (e) => e.text || ""
1631
+ }), bn = j.create({
1632
+ name: "underline",
1633
+ addOptions() {
1634
+ return { HTMLAttributes: {} };
1635
+ },
1636
+ parseHTML() {
1637
+ return [{ tag: "u" }, {
1638
+ style: "text-decoration",
1639
+ consuming: !1,
1640
+ getAttrs: (e) => e.includes("underline") ? {} : !1
1641
+ }];
1642
+ },
1643
+ renderHTML({ HTMLAttributes: e }) {
1644
+ return [
1645
+ "u",
1646
+ b(this.options.HTMLAttributes, e),
1647
+ 0
1648
+ ];
1649
+ },
1650
+ parseMarkdown(e, t) {
1651
+ return t.applyMark(this.name || "underline", t.parseInline(e.tokens || []));
1652
+ },
1653
+ renderMarkdown(e, t) {
1654
+ return `++${t.renderChildren(e)}++`;
1655
+ },
1656
+ markdownTokenizer: {
1657
+ name: "underline",
1658
+ level: "inline",
1659
+ start(e) {
1660
+ return e.indexOf("++");
1661
+ },
1662
+ tokenize(e, t, n) {
1663
+ const r = /^(\+\+)([\s\S]+?)(\+\+)/.exec(e);
1664
+ if (!r) return;
1665
+ const s = r[2].trim();
1666
+ return {
1667
+ type: "underline",
1668
+ raw: r[0],
1669
+ text: s,
1670
+ tokens: n.inlineTokens(s)
1671
+ };
1672
+ }
1673
+ },
1674
+ addCommands() {
1675
+ return {
1676
+ setUnderline: () => ({ commands: e }) => e.setMark(this.name),
1677
+ toggleUnderline: () => ({ commands: e }) => e.toggleMark(this.name),
1678
+ unsetUnderline: () => ({ commands: e }) => e.unsetMark(this.name)
1679
+ };
1680
+ },
1681
+ addKeyboardShortcuts() {
1682
+ return {
1683
+ "Mod-u": () => this.editor.commands.toggleUnderline(),
1684
+ "Mod-U": () => this.editor.commands.toggleUnderline()
1685
+ };
1686
+ }
1687
+ });
1688
+ function wn(e = {}) {
1689
+ return new I({
1690
+ view(t) {
1691
+ return new Mn(t, e);
1692
+ }
1693
+ });
1694
+ }
1695
+ class Mn {
1696
+ constructor(t, n) {
1697
+ var r;
1698
+ this.editorView = t, this.cursorPos = null, this.element = null, this.timeout = -1, this.lastDragEvent = null, this.width = (r = n.width) !== null && r !== void 0 ? r : 1, this.color = n.color === !1 ? void 0 : n.color || "black", this.class = n.class, this.handlers = ["dragover", "dragend", "drop", "dragleave"].map((s) => {
1699
+ let i = (o) => {
1700
+ this[s](o);
1701
+ };
1702
+ return t.dom.addEventListener(s, i), { name: s, handler: i };
1703
+ });
1704
+ }
1705
+ destroy() {
1706
+ this.handlers.forEach(({ name: t, handler: n }) => this.editorView.dom.removeEventListener(t, n));
1707
+ }
1708
+ update(t, n) {
1709
+ if (this.cursorPos != null && n.doc != t.state.doc)
1710
+ if (this.lastDragEvent) {
1711
+ let r = this.computeTarget(this.lastDragEvent);
1712
+ r == this.cursorPos ? this.updateOverlay() : this.setCursor(r);
1713
+ } else
1714
+ this.updateOverlay();
1715
+ }
1716
+ setCursor(t) {
1717
+ t != this.cursorPos && (this.cursorPos = t, t == null ? (this.element.parentNode.removeChild(this.element), this.element = null) : this.updateOverlay());
1718
+ }
1719
+ updateOverlay() {
1720
+ let t = this.editorView.state.doc.resolve(this.cursorPos), n = !t.parent.inlineContent, r, s = this.editorView.dom, i = s.getBoundingClientRect(), o = i.width / s.offsetWidth, a = i.height / s.offsetHeight;
1721
+ if (n) {
1722
+ let c = t.nodeBefore, p = t.nodeAfter;
1723
+ if (c || p) {
1724
+ let f = this.editorView.nodeDOM(this.cursorPos - (c ? c.nodeSize : 0));
1725
+ if (f) {
1726
+ let h = f.getBoundingClientRect(), m = c ? h.bottom : h.top;
1727
+ c && p && (m = (m + this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top) / 2);
1728
+ let g = this.width / 2 * a;
1729
+ r = { left: h.left, right: h.right, top: m - g, bottom: m + g };
1730
+ }
1731
+ }
1732
+ }
1733
+ if (!r) {
1734
+ let c = this.editorView.coordsAtPos(this.cursorPos), p = this.width / 2 * o;
1735
+ r = { left: c.left - p, right: c.left + p, top: c.top, bottom: c.bottom };
1736
+ }
1737
+ let l = this.editorView.dom.offsetParent;
1738
+ this.element || (this.element = l.appendChild(document.createElement("div")), this.class && (this.element.className = this.class), this.element.style.cssText = "position: absolute; z-index: 50; pointer-events: none;", this.color && (this.element.style.backgroundColor = this.color)), this.element.classList.toggle("prosemirror-dropcursor-block", n), this.element.classList.toggle("prosemirror-dropcursor-inline", !n);
1739
+ let u, d;
1740
+ if (!l || l == document.body && getComputedStyle(l).position == "static")
1741
+ u = -pageXOffset, d = -pageYOffset;
1742
+ else {
1743
+ let c = l.getBoundingClientRect(), p = c.width / l.offsetWidth, f = c.height / l.offsetHeight;
1744
+ u = c.left - l.scrollLeft * p, d = c.top - l.scrollTop * f;
1745
+ }
1746
+ this.element.style.left = (r.left - u) / o + "px", this.element.style.top = (r.top - d) / a + "px", this.element.style.width = (r.right - r.left) / o + "px", this.element.style.height = (r.bottom - r.top) / a + "px";
1747
+ }
1748
+ scheduleRemoval(t) {
1749
+ clearTimeout(this.timeout), this.timeout = setTimeout(() => this.setCursor(null), t);
1750
+ }
1751
+ computeTarget(t) {
1752
+ let n = this.editorView.posAtCoords({ left: t.clientX, top: t.clientY }), r = n && n.inside >= 0 && this.editorView.state.doc.nodeAt(n.inside), s = r && r.type.spec.disableDropCursor, i = typeof s == "function" ? s(this.editorView, n, t) : s;
1753
+ if (!n || i)
1754
+ return null;
1755
+ let o = n.pos;
1756
+ if (this.editorView.dragging && this.editorView.dragging.slice) {
1757
+ let a = it(this.editorView.state.doc, o, this.editorView.dragging.slice);
1758
+ a != null && (o = a);
1759
+ }
1760
+ return o;
1761
+ }
1762
+ dragover(t) {
1763
+ if (!this.editorView.editable)
1764
+ return;
1765
+ this.lastDragEvent = t;
1766
+ let n = this.computeTarget(t);
1767
+ n != null && (this.setCursor(n), this.scheduleRemoval(5e3));
1768
+ }
1769
+ dragend() {
1770
+ this.scheduleRemoval(20);
1771
+ }
1772
+ drop() {
1773
+ this.scheduleRemoval(20);
1774
+ }
1775
+ dragleave(t) {
1776
+ this.editorView.dom.contains(t.relatedTarget) || this.setCursor(null);
1777
+ }
1778
+ }
1779
+ class y extends z {
1780
+ /**
1781
+ Create a gap cursor.
1782
+ */
1783
+ constructor(t) {
1784
+ super(t, t);
1785
+ }
1786
+ map(t, n) {
1787
+ let r = t.resolve(n.map(this.head));
1788
+ return y.valid(r) ? new y(r) : z.near(r);
1789
+ }
1790
+ content() {
1791
+ return oe.empty;
1792
+ }
1793
+ eq(t) {
1794
+ return t instanceof y && t.head == this.head;
1795
+ }
1796
+ toJSON() {
1797
+ return { type: "gapcursor", pos: this.head };
1798
+ }
1799
+ /**
1800
+ @internal
1801
+ */
1802
+ static fromJSON(t, n) {
1803
+ if (typeof n.pos != "number")
1804
+ throw new RangeError("Invalid input for GapCursor.fromJSON");
1805
+ return new y(t.resolve(n.pos));
1806
+ }
1807
+ /**
1808
+ @internal
1809
+ */
1810
+ getBookmark() {
1811
+ return new ue(this.anchor);
1812
+ }
1813
+ /**
1814
+ @internal
1815
+ */
1816
+ static valid(t) {
1817
+ let n = t.parent;
1818
+ if (n.inlineContent || !Ln(t) || !Tn(t))
1819
+ return !1;
1820
+ let r = n.type.spec.allowGapCursor;
1821
+ if (r != null)
1822
+ return r;
1823
+ let s = n.contentMatchAt(t.index()).defaultType;
1824
+ return s && s.isTextblock;
1825
+ }
1826
+ /**
1827
+ @internal
1828
+ */
1829
+ static findGapCursorFrom(t, n, r = !1) {
1830
+ e: for (; ; ) {
1831
+ if (!r && y.valid(t))
1832
+ return t;
1833
+ let s = t.pos, i = null;
1834
+ for (let o = t.depth; ; o--) {
1835
+ let a = t.node(o);
1836
+ if (n > 0 ? t.indexAfter(o) < a.childCount : t.index(o) > 0) {
1837
+ i = a.child(n > 0 ? t.indexAfter(o) : t.index(o) - 1);
1838
+ break;
1839
+ } else if (o == 0)
1840
+ return null;
1841
+ s += n;
1842
+ let l = t.doc.resolve(s);
1843
+ if (y.valid(l))
1844
+ return l;
1845
+ }
1846
+ for (; ; ) {
1847
+ let o = n > 0 ? i.firstChild : i.lastChild;
1848
+ if (!o) {
1849
+ if (i.isAtom && !i.isText && !ie.isSelectable(i)) {
1850
+ t = t.doc.resolve(s + i.nodeSize * n), r = !1;
1851
+ continue e;
1852
+ }
1853
+ break;
1854
+ }
1855
+ i = o, s += n;
1856
+ let a = t.doc.resolve(s);
1857
+ if (y.valid(a))
1858
+ return a;
1859
+ }
1860
+ return null;
1861
+ }
1862
+ }
1863
+ }
1864
+ y.prototype.visible = !1;
1865
+ y.findFrom = y.findGapCursorFrom;
1866
+ z.jsonID("gapcursor", y);
1867
+ class ue {
1868
+ constructor(t) {
1869
+ this.pos = t;
1870
+ }
1871
+ map(t) {
1872
+ return new ue(t.map(this.pos));
1873
+ }
1874
+ resolve(t) {
1875
+ let n = t.resolve(this.pos);
1876
+ return y.valid(n) ? new y(n) : z.near(n);
1877
+ }
1878
+ }
1879
+ function ze(e) {
1880
+ return e.isAtom || e.spec.isolating || e.spec.createGapCursor;
1881
+ }
1882
+ function Ln(e) {
1883
+ for (let t = e.depth; t >= 0; t--) {
1884
+ let n = e.index(t), r = e.node(t);
1885
+ if (n == 0) {
1886
+ if (r.type.spec.isolating)
1887
+ return !0;
1888
+ continue;
1889
+ }
1890
+ for (let s = r.child(n - 1); ; s = s.lastChild) {
1891
+ if (s.childCount == 0 && !s.inlineContent || ze(s.type))
1892
+ return !0;
1893
+ if (s.inlineContent)
1894
+ return !1;
1895
+ }
1896
+ }
1897
+ return !0;
1898
+ }
1899
+ function Tn(e) {
1900
+ for (let t = e.depth; t >= 0; t--) {
1901
+ let n = e.indexAfter(t), r = e.node(t);
1902
+ if (n == r.childCount) {
1903
+ if (r.type.spec.isolating)
1904
+ return !0;
1905
+ continue;
1906
+ }
1907
+ for (let s = r.child(n); ; s = s.firstChild) {
1908
+ if (s.childCount == 0 && !s.inlineContent || ze(s.type))
1909
+ return !0;
1910
+ if (s.inlineContent)
1911
+ return !1;
1912
+ }
1913
+ }
1914
+ return !0;
1915
+ }
1916
+ function Cn() {
1917
+ return new I({
1918
+ props: {
1919
+ decorations: Sn,
1920
+ createSelectionBetween(e, t, n) {
1921
+ return t.pos == n.pos && y.valid(n) ? new y(n) : null;
1922
+ },
1923
+ handleClick: In,
1924
+ handleKeyDown: xn,
1925
+ handleDOMEvents: { beforeinput: An }
1926
+ }
1927
+ });
1928
+ }
1929
+ const xn = ot({
1930
+ ArrowLeft: V("horiz", -1),
1931
+ ArrowRight: V("horiz", 1),
1932
+ ArrowUp: V("vert", -1),
1933
+ ArrowDown: V("vert", 1)
1934
+ });
1935
+ function V(e, t) {
1936
+ const n = e == "vert" ? t > 0 ? "down" : "up" : t > 0 ? "right" : "left";
1937
+ return function(r, s, i) {
1938
+ let o = r.selection, a = t > 0 ? o.$to : o.$from, l = o.empty;
1939
+ if (o instanceof A) {
1940
+ if (!i.endOfTextblock(n) || a.depth == 0)
1941
+ return !1;
1942
+ l = !1, a = r.doc.resolve(t > 0 ? a.after() : a.before());
1943
+ }
1944
+ let u = y.findGapCursorFrom(a, t, l);
1945
+ return u ? (s && s(r.tr.setSelection(new y(u))), !0) : !1;
1946
+ };
1947
+ }
1948
+ function In(e, t, n) {
1949
+ if (!e || !e.editable)
1950
+ return !1;
1951
+ let r = e.state.doc.resolve(t);
1952
+ if (!y.valid(r))
1953
+ return !1;
1954
+ let s = e.posAtCoords({ left: n.clientX, top: n.clientY });
1955
+ return s && s.inside > -1 && ie.isSelectable(e.state.doc.nodeAt(s.inside)) ? !1 : (e.dispatch(e.state.tr.setSelection(new y(r))), !0);
1956
+ }
1957
+ function An(e, t) {
1958
+ if (t.inputType != "insertCompositionText" || !(e.state.selection instanceof y))
1959
+ return !1;
1960
+ let { $from: n } = e.state.selection, r = n.parent.contentMatchAt(n.index()).findWrapping(e.state.schema.nodes.text);
1961
+ if (!r)
1962
+ return !1;
1963
+ let s = K.empty;
1964
+ for (let o = r.length - 1; o >= 0; o--)
1965
+ s = K.from(r[o].createAndFill(null, s));
1966
+ let i = e.state.tr.replace(n.pos, n.pos, new oe(s, 0, 0));
1967
+ return i.setSelection(A.near(i.doc.resolve(n.pos + 1))), e.dispatch(i), !1;
1968
+ }
1969
+ function Sn(e) {
1970
+ if (!(e.selection instanceof y))
1971
+ return null;
1972
+ let t = document.createElement("div");
1973
+ return t.className = "ProseMirror-gapcursor", E.create(e.doc, [J.widget(e.selection.head, t, { key: "gapcursor" })]);
1974
+ }
1975
+ var q = 200, k = function() {
1976
+ };
1977
+ k.prototype.append = function(t) {
1978
+ return t.length ? (t = k.from(t), !this.length && t || t.length < q && this.leafAppend(t) || this.length < q && t.leafPrepend(this) || this.appendInner(t)) : this;
1979
+ };
1980
+ k.prototype.prepend = function(t) {
1981
+ return t.length ? k.from(t).append(this) : this;
1982
+ };
1983
+ k.prototype.appendInner = function(t) {
1984
+ return new En(this, t);
1985
+ };
1986
+ k.prototype.slice = function(t, n) {
1987
+ return t === void 0 && (t = 0), n === void 0 && (n = this.length), t >= n ? k.empty : this.sliceInner(Math.max(0, t), Math.min(this.length, n));
1988
+ };
1989
+ k.prototype.get = function(t) {
1990
+ if (!(t < 0 || t >= this.length))
1991
+ return this.getInner(t);
1992
+ };
1993
+ k.prototype.forEach = function(t, n, r) {
1994
+ n === void 0 && (n = 0), r === void 0 && (r = this.length), n <= r ? this.forEachInner(t, n, r, 0) : this.forEachInvertedInner(t, n, r, 0);
1995
+ };
1996
+ k.prototype.map = function(t, n, r) {
1997
+ n === void 0 && (n = 0), r === void 0 && (r = this.length);
1998
+ var s = [];
1999
+ return this.forEach(function(i, o) {
2000
+ return s.push(t(i, o));
2001
+ }, n, r), s;
2002
+ };
2003
+ k.from = function(t) {
2004
+ return t instanceof k ? t : t && t.length ? new Ke(t) : k.empty;
2005
+ };
2006
+ var Ke = /* @__PURE__ */ (function(e) {
2007
+ function t(r) {
2008
+ e.call(this), this.values = r;
2009
+ }
2010
+ e && (t.__proto__ = e), t.prototype = Object.create(e && e.prototype), t.prototype.constructor = t;
2011
+ var n = { length: { configurable: !0 }, depth: { configurable: !0 } };
2012
+ return t.prototype.flatten = function() {
2013
+ return this.values;
2014
+ }, t.prototype.sliceInner = function(s, i) {
2015
+ return s == 0 && i == this.length ? this : new t(this.values.slice(s, i));
2016
+ }, t.prototype.getInner = function(s) {
2017
+ return this.values[s];
2018
+ }, t.prototype.forEachInner = function(s, i, o, a) {
2019
+ for (var l = i; l < o; l++)
2020
+ if (s(this.values[l], a + l) === !1)
2021
+ return !1;
2022
+ }, t.prototype.forEachInvertedInner = function(s, i, o, a) {
2023
+ for (var l = i - 1; l >= o; l--)
2024
+ if (s(this.values[l], a + l) === !1)
2025
+ return !1;
2026
+ }, t.prototype.leafAppend = function(s) {
2027
+ if (this.length + s.length <= q)
2028
+ return new t(this.values.concat(s.flatten()));
2029
+ }, t.prototype.leafPrepend = function(s) {
2030
+ if (this.length + s.length <= q)
2031
+ return new t(s.flatten().concat(this.values));
2032
+ }, n.length.get = function() {
2033
+ return this.values.length;
2034
+ }, n.depth.get = function() {
2035
+ return 0;
2036
+ }, Object.defineProperties(t.prototype, n), t;
2037
+ })(k);
2038
+ k.empty = new Ke([]);
2039
+ var En = /* @__PURE__ */ (function(e) {
2040
+ function t(n, r) {
2041
+ e.call(this), this.left = n, this.right = r, this.length = n.length + r.length, this.depth = Math.max(n.depth, r.depth) + 1;
2042
+ }
2043
+ return e && (t.__proto__ = e), t.prototype = Object.create(e && e.prototype), t.prototype.constructor = t, t.prototype.flatten = function() {
2044
+ return this.left.flatten().concat(this.right.flatten());
2045
+ }, t.prototype.getInner = function(r) {
2046
+ return r < this.left.length ? this.left.get(r) : this.right.get(r - this.left.length);
2047
+ }, t.prototype.forEachInner = function(r, s, i, o) {
2048
+ var a = this.left.length;
2049
+ if (s < a && this.left.forEachInner(r, s, Math.min(i, a), o) === !1 || i > a && this.right.forEachInner(r, Math.max(s - a, 0), Math.min(this.length, i) - a, o + a) === !1)
2050
+ return !1;
2051
+ }, t.prototype.forEachInvertedInner = function(r, s, i, o) {
2052
+ var a = this.left.length;
2053
+ if (s > a && this.right.forEachInvertedInner(r, s - a, Math.max(i, a) - a, o + a) === !1 || i < a && this.left.forEachInvertedInner(r, Math.min(s, a), i, o) === !1)
2054
+ return !1;
2055
+ }, t.prototype.sliceInner = function(r, s) {
2056
+ if (r == 0 && s == this.length)
2057
+ return this;
2058
+ var i = this.left.length;
2059
+ return s <= i ? this.left.slice(r, s) : r >= i ? this.right.slice(r - i, s - i) : this.left.slice(r, i).append(this.right.slice(0, s - i));
2060
+ }, t.prototype.leafAppend = function(r) {
2061
+ var s = this.right.leafAppend(r);
2062
+ if (s)
2063
+ return new t(this.left, s);
2064
+ }, t.prototype.leafPrepend = function(r) {
2065
+ var s = this.left.leafPrepend(r);
2066
+ if (s)
2067
+ return new t(s, this.right);
2068
+ }, t.prototype.appendInner = function(r) {
2069
+ return this.left.depth >= Math.max(this.right.depth, r.depth) + 1 ? new t(this.left, new t(this.right, r)) : new t(this, r);
2070
+ }, t;
2071
+ })(k);
2072
+ const Rn = 500;
2073
+ class L {
2074
+ constructor(t, n) {
2075
+ this.items = t, this.eventCount = n;
2076
+ }
2077
+ // Pop the latest event off the branch's history and apply it
2078
+ // to a document transform.
2079
+ popEvent(t, n) {
2080
+ if (this.eventCount == 0)
2081
+ return null;
2082
+ let r = this.items.length;
2083
+ for (; ; r--)
2084
+ if (this.items.get(r - 1).selection) {
2085
+ --r;
2086
+ break;
2087
+ }
2088
+ let s, i;
2089
+ n && (s = this.remapping(r, this.items.length), i = s.maps.length);
2090
+ let o = t.tr, a, l, u = [], d = [];
2091
+ return this.items.forEach((c, p) => {
2092
+ if (!c.step) {
2093
+ s || (s = this.remapping(r, p + 1), i = s.maps.length), i--, d.push(c);
2094
+ return;
2095
+ }
2096
+ if (s) {
2097
+ d.push(new x(c.map));
2098
+ let f = c.step.map(s.slice(i)), h;
2099
+ f && o.maybeStep(f).doc && (h = o.mapping.maps[o.mapping.maps.length - 1], u.push(new x(h, void 0, void 0, u.length + d.length))), i--, h && s.appendMap(h, i);
2100
+ } else
2101
+ o.maybeStep(c.step);
2102
+ if (c.selection)
2103
+ return a = s ? c.selection.map(s.slice(i)) : c.selection, l = new L(this.items.slice(0, r).append(d.reverse().concat(u)), this.eventCount - 1), !1;
2104
+ }, this.items.length, 0), { remaining: l, transform: o, selection: a };
2105
+ }
2106
+ // Create a new branch with the given transform added.
2107
+ addTransform(t, n, r, s) {
2108
+ let i = [], o = this.eventCount, a = this.items, l = !s && a.length ? a.get(a.length - 1) : null;
2109
+ for (let d = 0; d < t.steps.length; d++) {
2110
+ let c = t.steps[d].invert(t.docs[d]), p = new x(t.mapping.maps[d], c, n), f;
2111
+ (f = l && l.merge(p)) && (p = f, d ? i.pop() : a = a.slice(0, a.length - 1)), i.push(p), n && (o++, n = void 0), s || (l = p);
2112
+ }
2113
+ let u = o - r.depth;
2114
+ return u > Pn && (a = Nn(a, u), o -= u), new L(a.append(i), o);
2115
+ }
2116
+ remapping(t, n) {
2117
+ let r = new at();
2118
+ return this.items.forEach((s, i) => {
2119
+ let o = s.mirrorOffset != null && i - s.mirrorOffset >= t ? r.maps.length - s.mirrorOffset : void 0;
2120
+ r.appendMap(s.map, o);
2121
+ }, t, n), r;
2122
+ }
2123
+ addMaps(t) {
2124
+ return this.eventCount == 0 ? this : new L(this.items.append(t.map((n) => new x(n))), this.eventCount);
2125
+ }
2126
+ // When the collab module receives remote changes, the history has
2127
+ // to know about those, so that it can adjust the steps that were
2128
+ // rebased on top of the remote changes, and include the position
2129
+ // maps for the remote changes in its array of items.
2130
+ rebased(t, n) {
2131
+ if (!this.eventCount)
2132
+ return this;
2133
+ let r = [], s = Math.max(0, this.items.length - n), i = t.mapping, o = t.steps.length, a = this.eventCount;
2134
+ this.items.forEach((p) => {
2135
+ p.selection && a--;
2136
+ }, s);
2137
+ let l = n;
2138
+ this.items.forEach((p) => {
2139
+ let f = i.getMirror(--l);
2140
+ if (f == null)
2141
+ return;
2142
+ o = Math.min(o, f);
2143
+ let h = i.maps[f];
2144
+ if (p.step) {
2145
+ let m = t.steps[f].invert(t.docs[f]), g = p.selection && p.selection.map(i.slice(l + 1, f));
2146
+ g && a++, r.push(new x(h, m, g));
2147
+ } else
2148
+ r.push(new x(h));
2149
+ }, s);
2150
+ let u = [];
2151
+ for (let p = n; p < o; p++)
2152
+ u.push(new x(i.maps[p]));
2153
+ let d = this.items.slice(0, s).append(u).append(r), c = new L(d, a);
2154
+ return c.emptyItemCount() > Rn && (c = c.compress(this.items.length - r.length)), c;
2155
+ }
2156
+ emptyItemCount() {
2157
+ let t = 0;
2158
+ return this.items.forEach((n) => {
2159
+ n.step || t++;
2160
+ }), t;
2161
+ }
2162
+ // Compressing a branch means rewriting it to push the air (map-only
2163
+ // items) out. During collaboration, these naturally accumulate
2164
+ // because each remote change adds one. The `upto` argument is used
2165
+ // to ensure that only the items below a given level are compressed,
2166
+ // because `rebased` relies on a clean, untouched set of items in
2167
+ // order to associate old items with rebased steps.
2168
+ compress(t = this.items.length) {
2169
+ let n = this.remapping(0, t), r = n.maps.length, s = [], i = 0;
2170
+ return this.items.forEach((o, a) => {
2171
+ if (a >= t)
2172
+ s.push(o), o.selection && i++;
2173
+ else if (o.step) {
2174
+ let l = o.step.map(n.slice(r)), u = l && l.getMap();
2175
+ if (r--, u && n.appendMap(u, r), l) {
2176
+ let d = o.selection && o.selection.map(n.slice(r));
2177
+ d && i++;
2178
+ let c = new x(u.invert(), l, d), p, f = s.length - 1;
2179
+ (p = s.length && s[f].merge(c)) ? s[f] = p : s.push(c);
2180
+ }
2181
+ } else o.map && r--;
2182
+ }, this.items.length, 0), new L(k.from(s.reverse()), i);
2183
+ }
2184
+ }
2185
+ L.empty = new L(k.empty, 0);
2186
+ function Nn(e, t) {
2187
+ let n;
2188
+ return e.forEach((r, s) => {
2189
+ if (r.selection && t-- == 0)
2190
+ return n = s, !1;
2191
+ }), e.slice(n);
2192
+ }
2193
+ class x {
2194
+ constructor(t, n, r, s) {
2195
+ this.map = t, this.step = n, this.selection = r, this.mirrorOffset = s;
2196
+ }
2197
+ merge(t) {
2198
+ if (this.step && t.step && !t.selection) {
2199
+ let n = t.step.merge(this.step);
2200
+ if (n)
2201
+ return new x(n.getMap().invert(), n, this.selection);
2202
+ }
2203
+ }
2204
+ }
2205
+ class S {
2206
+ constructor(t, n, r, s, i) {
2207
+ this.done = t, this.undone = n, this.prevRanges = r, this.prevTime = s, this.prevComposition = i;
2208
+ }
2209
+ }
2210
+ const Pn = 20;
2211
+ function On(e, t, n, r) {
2212
+ let s = n.getMeta(P), i;
2213
+ if (s)
2214
+ return s.historyState;
2215
+ n.getMeta(Bn) && (e = new S(e.done, e.undone, null, 0, -1));
2216
+ let o = n.getMeta("appendedTransaction");
2217
+ if (n.steps.length == 0)
2218
+ return e;
2219
+ if (o && o.getMeta(P))
2220
+ return o.getMeta(P).redo ? new S(e.done.addTransform(n, void 0, r, W(t)), e.undone, be(n.mapping.maps), e.prevTime, e.prevComposition) : new S(e.done, e.undone.addTransform(n, void 0, r, W(t)), null, e.prevTime, e.prevComposition);
2221
+ if (n.getMeta("addToHistory") !== !1 && !(o && o.getMeta("addToHistory") === !1)) {
2222
+ let a = n.getMeta("composition"), l = e.prevTime == 0 || !o && e.prevComposition != a && (e.prevTime < (n.time || 0) - r.newGroupDelay || !$n(n, e.prevRanges)), u = o ? ee(e.prevRanges, n.mapping) : be(n.mapping.maps);
2223
+ return new S(e.done.addTransform(n, l ? t.selection.getBookmark() : void 0, r, W(t)), L.empty, u, n.time, a ?? e.prevComposition);
2224
+ } else return (i = n.getMeta("rebased")) ? new S(e.done.rebased(n, i), e.undone.rebased(n, i), ee(e.prevRanges, n.mapping), e.prevTime, e.prevComposition) : new S(e.done.addMaps(n.mapping.maps), e.undone.addMaps(n.mapping.maps), ee(e.prevRanges, n.mapping), e.prevTime, e.prevComposition);
2225
+ }
2226
+ function $n(e, t) {
2227
+ if (!t)
2228
+ return !1;
2229
+ if (!e.docChanged)
2230
+ return !0;
2231
+ let n = !1;
2232
+ return e.mapping.maps[0].forEach((r, s) => {
2233
+ for (let i = 0; i < t.length; i += 2)
2234
+ r <= t[i + 1] && s >= t[i] && (n = !0);
2235
+ }), n;
2236
+ }
2237
+ function be(e) {
2238
+ let t = [];
2239
+ for (let n = e.length - 1; n >= 0 && t.length == 0; n--)
2240
+ e[n].forEach((r, s, i, o) => t.push(i, o));
2241
+ return t;
2242
+ }
2243
+ function ee(e, t) {
2244
+ if (!e)
2245
+ return null;
2246
+ let n = [];
2247
+ for (let r = 0; r < e.length; r += 2) {
2248
+ let s = t.map(e[r], 1), i = t.map(e[r + 1], -1);
2249
+ s <= i && n.push(s, i);
2250
+ }
2251
+ return n;
2252
+ }
2253
+ function Dn(e, t, n) {
2254
+ let r = W(t), s = P.get(t).spec.config, i = (n ? e.undone : e.done).popEvent(t, r);
2255
+ if (!i)
2256
+ return null;
2257
+ let o = i.selection.resolve(i.transform.doc), a = (n ? e.done : e.undone).addTransform(i.transform, t.selection.getBookmark(), s, r), l = new S(n ? a : i.remaining, n ? i.remaining : a, null, 0, -1);
2258
+ return i.transform.setSelection(o).setMeta(P, { redo: n, historyState: l });
2259
+ }
2260
+ let te = !1, we = null;
2261
+ function W(e) {
2262
+ let t = e.plugins;
2263
+ if (we != t) {
2264
+ te = !1, we = t;
2265
+ for (let n = 0; n < t.length; n++)
2266
+ if (t[n].spec.historyPreserveItems) {
2267
+ te = !0;
2268
+ break;
2269
+ }
2270
+ }
2271
+ return te;
2272
+ }
2273
+ const P = new R("history"), Bn = new R("closeHistory");
2274
+ function Hn(e = {}) {
2275
+ return e = {
2276
+ depth: e.depth || 100,
2277
+ newGroupDelay: e.newGroupDelay || 500
2278
+ }, new I({
2279
+ key: P,
2280
+ state: {
2281
+ init() {
2282
+ return new S(L.empty, L.empty, null, 0, -1);
2283
+ },
2284
+ apply(t, n, r) {
2285
+ return On(n, r, t, e);
2286
+ }
2287
+ },
2288
+ config: e,
2289
+ props: {
2290
+ handleDOMEvents: {
2291
+ beforeinput(t, n) {
2292
+ let r = n.inputType, s = r == "historyUndo" ? Fe : r == "historyRedo" ? Ve : null;
2293
+ return !s || !t.editable ? !1 : (n.preventDefault(), s(t.state, t.dispatch));
2294
+ }
2295
+ }
2296
+ }
2297
+ });
2298
+ }
2299
+ function je(e, t) {
2300
+ return (n, r) => {
2301
+ let s = P.getState(n);
2302
+ if (!s || (e ? s.undone : s.done).eventCount == 0)
2303
+ return !1;
2304
+ if (r) {
2305
+ let i = Dn(s, n, e);
2306
+ i && r(t ? i.scrollIntoView() : i);
2307
+ }
2308
+ return !0;
2309
+ };
2310
+ }
2311
+ const Fe = je(!1, !0), Ve = je(!0, !0);
2312
+ w.create({
2313
+ name: "characterCount",
2314
+ addOptions() {
2315
+ return {
2316
+ limit: null,
2317
+ autoTrim: !0,
2318
+ mode: "textSize",
2319
+ textCounter: (e) => e.length,
2320
+ wordCounter: (e) => e.split(" ").filter((t) => t !== "").length
2321
+ };
2322
+ },
2323
+ addStorage() {
2324
+ return {
2325
+ characters: () => 0,
2326
+ words: () => 0
2327
+ };
2328
+ },
2329
+ onBeforeCreate() {
2330
+ this.storage.characters = (e) => {
2331
+ const t = e?.node || this.editor.state.doc;
2332
+ if ((e?.mode || this.options.mode) === "textSize") {
2333
+ const n = t.textBetween(0, t.content.size, void 0, " ");
2334
+ return this.options.textCounter(n);
2335
+ }
2336
+ return t.nodeSize;
2337
+ }, this.storage.words = (e) => {
2338
+ const t = e?.node || this.editor.state.doc, n = t.textBetween(0, t.content.size, " ", " ");
2339
+ return this.options.wordCounter(n);
2340
+ };
2341
+ },
2342
+ addProseMirrorPlugins() {
2343
+ let e = !1;
2344
+ return [new I({
2345
+ key: new R("characterCount"),
2346
+ appendTransaction: (t, n, r) => {
2347
+ if (e) return;
2348
+ const s = this.options.limit, i = this.options.autoTrim;
2349
+ if (s == null || s === 0 || i === !1) {
2350
+ e = !0;
2351
+ return;
2352
+ }
2353
+ const o = this.storage.characters({ node: r.doc });
2354
+ if (o > s) {
2355
+ const a = o - s, l = 0, u = a;
2356
+ console.warn(`[CharacterCount] Initial content exceeded limit of ${s} characters. Content was automatically trimmed.`);
2357
+ const d = r.tr.deleteRange(l, u);
2358
+ return e = !0, d;
2359
+ }
2360
+ e = !0;
2361
+ },
2362
+ filterTransaction: (t, n) => {
2363
+ const r = this.options.limit;
2364
+ if (!t.docChanged || r === 0 || r === null || r === void 0) return !0;
2365
+ const s = this.storage.characters({ node: n.doc }), i = this.storage.characters({ node: t.doc });
2366
+ if (i <= r || s > r && i > r && i <= s) return !0;
2367
+ if (s > r && i > r && i > s || !t.getMeta("paste")) return !1;
2368
+ const o = t.selection.$head.pos, a = o - (i - r), l = o;
2369
+ return t.deleteRange(a, l), !(this.storage.characters({ node: t.doc }) > r);
2370
+ }
2371
+ })];
2372
+ }
2373
+ });
2374
+ const _n = w.create({
2375
+ name: "dropCursor",
2376
+ addOptions() {
2377
+ return {
2378
+ color: "currentColor",
2379
+ width: 1,
2380
+ class: void 0
2381
+ };
2382
+ },
2383
+ addProseMirrorPlugins() {
2384
+ return [wn(this.options)];
2385
+ }
2386
+ });
2387
+ w.create({
2388
+ name: "focus",
2389
+ addOptions() {
2390
+ return {
2391
+ className: "has-focus",
2392
+ mode: "all"
2393
+ };
2394
+ },
2395
+ addProseMirrorPlugins() {
2396
+ return [new I({
2397
+ key: new R("focus"),
2398
+ props: { decorations: ({ doc: e, selection: t }) => {
2399
+ const { isEditable: n, isFocused: r } = this.editor, { anchor: s } = t, i = [];
2400
+ if (!n || !r) return E.create(e, []);
2401
+ let o = 0;
2402
+ this.options.mode === "deepest" && e.descendants((l, u) => {
2403
+ if (!l.isText) {
2404
+ if (!(s >= u && s <= u + l.nodeSize - 1)) return !1;
2405
+ o += 1;
2406
+ }
2407
+ });
2408
+ let a = 0;
2409
+ return e.descendants((l, u) => {
2410
+ if (l.isText || !(s >= u && s <= u + l.nodeSize - 1)) return !1;
2411
+ if (a += 1, this.options.mode === "deepest" && o - a > 0 || this.options.mode === "shallowest" && a > 1) return this.options.mode === "deepest";
2412
+ i.push(J.node(u, u + l.nodeSize, { class: this.options.className }));
2413
+ }), E.create(e, i);
2414
+ } }
2415
+ })];
2416
+ }
2417
+ });
2418
+ const zn = w.create({
2419
+ name: "gapCursor",
2420
+ addProseMirrorPlugins() {
2421
+ return [Cn()];
2422
+ },
2423
+ extendNodeSchema(e) {
2424
+ var t;
2425
+ const n = {
2426
+ name: e.name,
2427
+ options: e.options,
2428
+ storage: e.storage
2429
+ };
2430
+ return { allowGapCursor: (t = lt(ct(e, "allowGapCursor", n))) !== null && t !== void 0 ? t : null };
2431
+ }
2432
+ }), We = "placeholder", Me = new R("tiptap__placeholder");
2433
+ function Ue(e) {
2434
+ const { editor: t, placeholder: n, dataAttribute: r, pos: s, node: i, isEmptyDoc: o, hasAnchor: a, classes: { emptyNode: l, emptyEditor: u } } = e, d = [l];
2435
+ return o && d.push(u), J.node(s, s + i.nodeSize, {
2436
+ class: d.join(" "),
2437
+ [r]: typeof n == "function" ? n({
2438
+ editor: t,
2439
+ node: i,
2440
+ pos: s,
2441
+ hasAnchor: a
2442
+ }) : n
2443
+ });
2444
+ }
2445
+ function Ge(e, t) {
2446
+ return typeof e == "function" ? e(t) : e;
2447
+ }
2448
+ function Xe({ editor: e, options: t, dataAttribute: n, doc: r, selection: s, from: i, to: o }) {
2449
+ const { anchor: a } = s, l = [], u = e.isEmpty;
2450
+ return r.nodesBetween(i, o, (d, c) => {
2451
+ const p = a >= c && a <= c + d.nodeSize, f = !d.isLeaf && xe(d);
2452
+ return d.type.isTextblock && (p || !t.showOnlyCurrent) && f && l.push(Ue({
2453
+ editor: e,
2454
+ isEmptyDoc: u,
2455
+ dataAttribute: n,
2456
+ hasAnchor: p,
2457
+ placeholder: t.placeholder,
2458
+ classes: {
2459
+ emptyEditor: t.emptyEditorClass,
2460
+ emptyNode: Ge(t.emptyNodeClass, {
2461
+ editor: e,
2462
+ node: d,
2463
+ pos: c,
2464
+ hasAnchor: p
2465
+ })
2466
+ },
2467
+ node: d,
2468
+ pos: c
2469
+ })), t.includeChildren;
2470
+ }), l;
2471
+ }
2472
+ function qe({ editor: e, options: t, dataAttribute: n, doc: r, selection: s }) {
2473
+ if (!(e.isEditable || !t.showOnlyWhenEditable)) return null;
2474
+ const { anchor: i } = s, o = [], a = e.isEmpty;
2475
+ if (t.showOnlyCurrent && !t.includeChildren) {
2476
+ const l = r.resolve(i), u = l.depth > 0 ? l.node(1) : l.nodeAfter, d = l.depth > 0 ? l.before(1) : i;
2477
+ if (u && u.type.isTextblock && xe(u)) {
2478
+ const c = i >= d && i <= d + u.nodeSize;
2479
+ o.push(Ue({
2480
+ editor: e,
2481
+ isEmptyDoc: a,
2482
+ dataAttribute: n,
2483
+ hasAnchor: c,
2484
+ placeholder: t.placeholder,
2485
+ classes: {
2486
+ emptyEditor: t.emptyEditorClass,
2487
+ emptyNode: Ge(t.emptyNodeClass, {
2488
+ editor: e,
2489
+ node: u,
2490
+ pos: d,
2491
+ hasAnchor: c
2492
+ })
2493
+ },
2494
+ node: u,
2495
+ pos: d
2496
+ }));
2497
+ }
2498
+ } else o.push(...Xe({
2499
+ editor: e,
2500
+ options: t,
2501
+ dataAttribute: n,
2502
+ doc: r,
2503
+ selection: s,
2504
+ from: 0,
2505
+ to: r.content.size
2506
+ }));
2507
+ return E.create(r, o);
2508
+ }
2509
+ function H(e, t) {
2510
+ const n = e.resolve(t);
2511
+ if (n.depth === 0) {
2512
+ var r;
2513
+ const i = (r = n.nodeAfter) !== null && r !== void 0 ? r : n.nodeBefore;
2514
+ if (!i) return {
2515
+ from: t,
2516
+ to: t
2517
+ };
2518
+ const o = n.nodeAfter ? t : t - i.nodeSize;
2519
+ return {
2520
+ from: o,
2521
+ to: o + i.nodeSize
2522
+ };
2523
+ }
2524
+ const s = n.before(1);
2525
+ return {
2526
+ from: s,
2527
+ to: s + n.node(1).nodeSize
2528
+ };
2529
+ }
2530
+ function _(e, t) {
2531
+ return {
2532
+ from: Math.max(0, t.from - 1),
2533
+ to: Math.min(e.content.size, t.to - 1)
2534
+ };
2535
+ }
2536
+ function Kn(e, t, n) {
2537
+ const r = [];
2538
+ return e.forEach((s, i) => {
2539
+ const o = i, a = o + s.nodeSize, l = o + 1, u = a + 1;
2540
+ l < n && u > t && r.push({
2541
+ from: o,
2542
+ to: a
2543
+ });
2544
+ }), r;
2545
+ }
2546
+ function jn(e) {
2547
+ if (e.length === 0) return [];
2548
+ const t = [...e].sort((r, s) => r.from - s.from), n = [{ ...t[0] }];
2549
+ for (let r = 1; r < t.length; r += 1) {
2550
+ const s = n[n.length - 1], i = t[r];
2551
+ i.from <= s.to ? s.to = Math.max(s.to, i.to) : n.push({ ...i });
2552
+ }
2553
+ return n;
2554
+ }
2555
+ function Fn(e, t) {
2556
+ const n = Kn(e, t.from, t.to);
2557
+ return n.push(_(e, H(e, t.from))), t.to > t.from ? n.push(_(e, H(e, Math.min(t.to, e.content.size + 1) - 1))) : t.from < e.content.size + 1 && n.push(_(e, H(e, Math.min(t.from + 1, e.content.size)))), n;
2558
+ }
2559
+ function Vn(e, t, n) {
2560
+ const r = [];
2561
+ if (e.docChanged) {
2562
+ const s = ut(e);
2563
+ for (const i of s) r.push(...Fn(n.doc, i.newRange));
2564
+ }
2565
+ return e.selectionSet && (r.push(_(n.doc, H(n.doc, e.mapping.map(t.selection.anchor)))), r.push(_(n.doc, H(n.doc, n.selection.anchor)))), jn(r);
2566
+ }
2567
+ function Wn(e, t, n) {
2568
+ const r = Math.max(0, Math.min(e, n.content.size));
2569
+ return {
2570
+ from: r,
2571
+ to: Math.max(r, Math.min(t, n.content.size))
2572
+ };
2573
+ }
2574
+ function Un({ decorations: e, ranges: t, editor: n, options: r, dataAttribute: s, doc: i, selection: o }) {
2575
+ let a = e;
2576
+ for (const l of t) {
2577
+ const { from: u, to: d } = Wn(l.from, l.to, i), c = a.find(u, d).filter((f) => f.from >= u && f.to <= d);
2578
+ c.length && (a = a.remove(c));
2579
+ const p = Xe({
2580
+ editor: n,
2581
+ options: r,
2582
+ dataAttribute: s,
2583
+ doc: i,
2584
+ selection: o,
2585
+ from: u,
2586
+ to: d
2587
+ });
2588
+ p.length && (a = a.add(i, p));
2589
+ }
2590
+ return a;
2591
+ }
2592
+ function Gn({ editor: e, options: t, dataAttribute: n }) {
2593
+ return {
2594
+ init(r, s) {
2595
+ const i = qe({
2596
+ editor: e,
2597
+ options: t,
2598
+ dataAttribute: n,
2599
+ doc: s.doc,
2600
+ selection: s.selection
2601
+ });
2602
+ return i ?? E.empty;
2603
+ },
2604
+ apply(r, s, i, o) {
2605
+ return !r.docChanged && !r.selectionSet ? s : Un({
2606
+ decorations: s.map(r.mapping, r.doc),
2607
+ ranges: Vn(r, i, o),
2608
+ editor: e,
2609
+ options: t,
2610
+ dataAttribute: n,
2611
+ doc: o.doc,
2612
+ selection: o.selection
2613
+ });
2614
+ }
2615
+ };
2616
+ }
2617
+ function Xn(e) {
2618
+ return e.replace(/\s+/g, "-").replace(/[^a-zA-Z0-9-]/g, "").replace(/^[0-9-]+/, "").replace(/^-+/, "").toLowerCase();
2619
+ }
2620
+ function qn({ editor: e, options: t }) {
2621
+ const n = t.dataAttribute ? `data-${Xn(t.dataAttribute)}` : `data-${We}`, r = t.showOnlyCurrent && !t.includeChildren;
2622
+ return new I({
2623
+ key: Me,
2624
+ ...r ? {} : { state: Gn({
2625
+ editor: e,
2626
+ options: t,
2627
+ dataAttribute: n
2628
+ }) },
2629
+ props: { decorations: r ? ({ doc: s, selection: i }) => qe({
2630
+ editor: e,
2631
+ options: t,
2632
+ dataAttribute: n,
2633
+ doc: s,
2634
+ selection: i
2635
+ }) : (s) => {
2636
+ var i;
2637
+ return t.showOnlyWhenEditable && !e.isEditable ? E.empty : (i = Me.getState(s)) !== null && i !== void 0 ? i : E.empty;
2638
+ } }
2639
+ });
2640
+ }
2641
+ w.create({
2642
+ name: "placeholder",
2643
+ addOptions() {
2644
+ return {
2645
+ emptyEditorClass: "is-editor-empty",
2646
+ emptyNodeClass: "is-empty",
2647
+ dataAttribute: We,
2648
+ placeholder: "Write something …",
2649
+ showOnlyWhenEditable: !0,
2650
+ showOnlyCurrent: !0,
2651
+ includeChildren: !1
2652
+ };
2653
+ },
2654
+ addProseMirrorPlugins() {
2655
+ return [qn({
2656
+ editor: this.editor,
2657
+ options: this.options
2658
+ })];
2659
+ }
2660
+ });
2661
+ function se(e, t) {
2662
+ return !e.selection.empty && !Te(e.selection) && t.isEditable;
2663
+ }
2664
+ function Jn(e, t) {
2665
+ return se(e, t) && !t.isFocused && !t.view.dragging;
2666
+ }
2667
+ function Yn() {
2668
+ var e;
2669
+ (e = window.getSelection()) === null || e === void 0 || e.removeAllRanges();
2670
+ }
2671
+ function Zn(e) {
2672
+ e.focus();
2673
+ }
2674
+ w.create({
2675
+ name: "selection",
2676
+ addOptions() {
2677
+ return { className: "selection" };
2678
+ },
2679
+ addProseMirrorPlugins() {
2680
+ const { editor: e, options: t } = this;
2681
+ return [new I({
2682
+ key: new R("selection"),
2683
+ props: {
2684
+ decorations(n) {
2685
+ return Jn(n, e) ? E.create(n.doc, [J.inline(n.selection.from, n.selection.to, { class: t.className })]) : null;
2686
+ },
2687
+ handleDOMEvents: {
2688
+ blur(n) {
2689
+ return se(n.state, e) && Yn(), !1;
2690
+ },
2691
+ focus(n) {
2692
+ return se(n.state, e) && requestAnimationFrame(() => {
2693
+ !e.isDestroyed && n.hasFocus() && Zn(n);
2694
+ }), !1;
2695
+ }
2696
+ }
2697
+ }
2698
+ })];
2699
+ }
2700
+ });
2701
+ function Le({ types: e, node: t }) {
2702
+ return t && Array.isArray(e) && e.includes(t.type) || t?.type === e;
2703
+ }
2704
+ const Qn = w.create({
2705
+ name: "trailingNode",
2706
+ addOptions() {
2707
+ return {
2708
+ node: void 0,
2709
+ notAfter: []
2710
+ };
2711
+ },
2712
+ addProseMirrorPlugins() {
2713
+ var e;
2714
+ const t = new R(this.name), n = this.options.node || ((e = this.editor.schema.topNodeType.contentMatch.defaultType) === null || e === void 0 ? void 0 : e.name) || "paragraph", r = Object.entries(this.editor.schema.nodes).map(([, s]) => s).filter((s) => (this.options.notAfter || []).concat(n).includes(s.name));
2715
+ return [new I({
2716
+ key: t,
2717
+ appendTransaction: (s, i, o) => {
2718
+ const { doc: a, tr: l, schema: u } = o, d = t.getState(o), c = a.content.size, p = u.nodes[n];
2719
+ if (!s.some((f) => f.getMeta("skipTrailingNode")) && d)
2720
+ return l.insert(c, p.create());
2721
+ },
2722
+ state: {
2723
+ init: (s, i) => {
2724
+ const o = i.tr.doc.lastChild;
2725
+ return !Le({
2726
+ node: o,
2727
+ types: r
2728
+ });
2729
+ },
2730
+ apply: (s, i) => {
2731
+ if (!s.docChanged || s.getMeta("__uniqueIDTransaction")) return i;
2732
+ const o = s.doc.lastChild;
2733
+ return !Le({
2734
+ node: o,
2735
+ types: r
2736
+ });
2737
+ }
2738
+ }
2739
+ })];
2740
+ }
2741
+ }), er = w.create({
2742
+ name: "undoRedo",
2743
+ addOptions() {
2744
+ return {
2745
+ depth: 100,
2746
+ newGroupDelay: 500
2747
+ };
2748
+ },
2749
+ addCommands() {
2750
+ return {
2751
+ undo: () => ({ state: e, dispatch: t }) => Fe(e, t),
2752
+ redo: () => ({ state: e, dispatch: t }) => Ve(e, t)
2753
+ };
2754
+ },
2755
+ addProseMirrorPlugins() {
2756
+ return [Hn(this.options)];
2757
+ },
2758
+ addKeyboardShortcuts() {
2759
+ return {
2760
+ "Mod-z": () => this.editor.commands.undo(),
2761
+ "Shift-Mod-z": () => this.editor.commands.redo(),
2762
+ "Mod-y": () => this.editor.commands.redo(),
2763
+ "Mod-я": () => this.editor.commands.undo(),
2764
+ "Shift-Mod-я": () => this.editor.commands.redo()
2765
+ };
2766
+ }
2767
+ }), tr = w.create({
2768
+ name: "starterKit",
2769
+ addExtensions() {
2770
+ const e = [];
2771
+ if (this.options.bold !== !1 && e.push(Mt.configure(this.options.bold)), this.options.blockquote !== !1 && e.push(yt.configure(this.options.blockquote)), this.options.bulletList !== !1 && e.push(Ee.configure(this.options.bulletList)), this.options.code !== !1 && e.push(Ct.configure(this.options.code)), this.options.codeBlock !== !1 && e.push(At.configure(this.options.codeBlock)), this.options.document !== !1 && e.push(St.configure(this.options.document)), this.options.dropcursor !== !1 && e.push(_n.configure(this.options.dropcursor)), this.options.gapcursor !== !1 && e.push(zn.configure(this.options.gapcursor)), this.options.hardBreak !== !1 && e.push(Et.configure(this.options.hardBreak)), this.options.heading !== !1 && e.push(dt.configure(this.options.heading)), this.options.undoRedo !== !1 && e.push(er.configure(this.options.undoRedo)), this.options.horizontalRule !== !1 && e.push(Rt.configure(this.options.horizontalRule)), this.options.italic !== !1 && e.push(Dt.configure(this.options.italic)), this.options.listItem !== !1 && e.push($e.configure(this.options.listItem)), this.options.listKeymap !== !1) {
2772
+ var t;
2773
+ e.push(Be.configure((t = this.options) === null || t === void 0 ? void 0 : t.listKeymap));
2774
+ }
2775
+ if (this.options.link !== !1) {
2776
+ var n;
2777
+ e.push(pt.configure((n = this.options) === null || n === void 0 ? void 0 : n.link));
2778
+ }
2779
+ if (this.options.orderedList !== !1 && e.push(_e.configure(this.options.orderedList)), this.options.paragraph !== !1 && e.push(ft.configure(this.options.paragraph)), this.options.strike !== !1 && e.push(kn.configure(this.options.strike)), this.options.text !== !1 && e.push(vn.configure(this.options.text)), this.options.underline !== !1) {
2780
+ var r;
2781
+ e.push(bn.configure((r = this.options) === null || r === void 0 ? void 0 : r.underline));
2782
+ }
2783
+ if (this.options.trailingNode !== !1) {
2784
+ var s;
2785
+ e.push(Qn.configure((s = this.options) === null || s === void 0 ? void 0 : s.trailingNode));
2786
+ }
2787
+ return e;
2788
+ }
2789
+ });
2790
+ var ar = tr;
2791
+ export {
2792
+ tr as StarterKit,
2793
+ ar as default
2794
+ };