@templatical/editor 0.15.0 → 0.16.0

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