@burdenoff/microfe-support 2026.819.3 → 2026.819.4

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 (95) hide show
  1. package/dist/_virtual/_rolldown/runtime.js +7 -0
  2. package/dist/microfe-support.css +1 -1
  3. package/dist/node_modules/@tiptap/core/dist/index.js +3453 -0
  4. package/dist/node_modules/@tiptap/core/dist/index.js.map +1 -0
  5. package/dist/node_modules/@tiptap/core/dist/jsx-runtime/jsx-runtime.js +21 -0
  6. package/dist/node_modules/@tiptap/core/dist/jsx-runtime/jsx-runtime.js.map +1 -0
  7. package/dist/node_modules/@tiptap/extension-blockquote/dist/index.js +76 -0
  8. package/dist/node_modules/@tiptap/extension-blockquote/dist/index.js.map +1 -0
  9. package/dist/node_modules/@tiptap/extension-bold/dist/index.js +74 -0
  10. package/dist/node_modules/@tiptap/extension-bold/dist/index.js.map +1 -0
  11. package/dist/node_modules/@tiptap/extension-code/dist/index.js +68 -0
  12. package/dist/node_modules/@tiptap/extension-code/dist/index.js.map +1 -0
  13. package/dist/node_modules/@tiptap/extension-code-block/dist/index.js +160 -0
  14. package/dist/node_modules/@tiptap/extension-code-block/dist/index.js.map +1 -0
  15. package/dist/node_modules/@tiptap/extension-document/dist/index.js +12 -0
  16. package/dist/node_modules/@tiptap/extension-document/dist/index.js.map +1 -0
  17. package/dist/node_modules/@tiptap/extension-hard-break/dist/index.js +51 -0
  18. package/dist/node_modules/@tiptap/extension-hard-break/dist/index.js.map +1 -0
  19. package/dist/node_modules/@tiptap/extension-heading/dist/index.js +68 -0
  20. package/dist/node_modules/@tiptap/extension-heading/dist/index.js.map +1 -0
  21. package/dist/node_modules/@tiptap/extension-horizontal-rule/dist/index.js +50 -0
  22. package/dist/node_modules/@tiptap/extension-horizontal-rule/dist/index.js.map +1 -0
  23. package/dist/node_modules/@tiptap/extension-italic/dist/index.js +71 -0
  24. package/dist/node_modules/@tiptap/extension-italic/dist/index.js.map +1 -0
  25. package/dist/node_modules/@tiptap/extension-link/dist/index.js +373 -0
  26. package/dist/node_modules/@tiptap/extension-link/dist/index.js.map +1 -0
  27. package/dist/node_modules/@tiptap/extension-list/dist/index.js +964 -0
  28. package/dist/node_modules/@tiptap/extension-list/dist/index.js.map +1 -0
  29. package/dist/node_modules/@tiptap/extension-paragraph/dist/index.js +46 -0
  30. package/dist/node_modules/@tiptap/extension-paragraph/dist/index.js.map +1 -0
  31. package/dist/node_modules/@tiptap/extension-placeholder/dist/index.js +7 -0
  32. package/dist/node_modules/@tiptap/extension-placeholder/dist/index.js.map +1 -0
  33. package/dist/node_modules/@tiptap/extension-strike/dist/index.js +56 -0
  34. package/dist/node_modules/@tiptap/extension-strike/dist/index.js.map +1 -0
  35. package/dist/node_modules/@tiptap/extension-text/dist/index.js +15 -0
  36. package/dist/node_modules/@tiptap/extension-text/dist/index.js.map +1 -0
  37. package/dist/node_modules/@tiptap/extension-underline/dist/index.js +63 -0
  38. package/dist/node_modules/@tiptap/extension-underline/dist/index.js.map +1 -0
  39. package/dist/node_modules/@tiptap/extensions/dist/index.js +459 -0
  40. package/dist/node_modules/@tiptap/extensions/dist/index.js.map +1 -0
  41. package/dist/node_modules/@tiptap/react/dist/index.js +316 -0
  42. package/dist/node_modules/@tiptap/react/dist/index.js.map +1 -0
  43. package/dist/node_modules/@tiptap/starter-kit/dist/index.js +29 -0
  44. package/dist/node_modules/@tiptap/starter-kit/dist/index.js.map +1 -0
  45. package/dist/node_modules/fast-equals/dist/es/index.js +267 -0
  46. package/dist/node_modules/fast-equals/dist/es/index.js.map +1 -0
  47. package/dist/node_modules/linkifyjs/dist/linkify.js +514 -0
  48. package/dist/node_modules/linkifyjs/dist/linkify.js.map +1 -0
  49. package/dist/node_modules/orderedmap/dist/index.js +69 -0
  50. package/dist/node_modules/orderedmap/dist/index.js.map +1 -0
  51. package/dist/node_modules/prosemirror-commands/dist/index.js +335 -0
  52. package/dist/node_modules/prosemirror-commands/dist/index.js.map +1 -0
  53. package/dist/node_modules/prosemirror-dropcursor/dist/index.js +113 -0
  54. package/dist/node_modules/prosemirror-dropcursor/dist/index.js.map +1 -0
  55. package/dist/node_modules/prosemirror-gapcursor/dist/index.js +173 -0
  56. package/dist/node_modules/prosemirror-gapcursor/dist/index.js.map +1 -0
  57. package/dist/node_modules/prosemirror-history/dist/index.js +214 -0
  58. package/dist/node_modules/prosemirror-history/dist/index.js.map +1 -0
  59. package/dist/node_modules/prosemirror-keymap/dist/index.js +52 -0
  60. package/dist/node_modules/prosemirror-keymap/dist/index.js.map +1 -0
  61. package/dist/node_modules/prosemirror-model/dist/index.js +1786 -0
  62. package/dist/node_modules/prosemirror-model/dist/index.js.map +1 -0
  63. package/dist/node_modules/prosemirror-schema-list/dist/index.js +75 -0
  64. package/dist/node_modules/prosemirror-schema-list/dist/index.js.map +1 -0
  65. package/dist/node_modules/prosemirror-state/dist/index.js +527 -0
  66. package/dist/node_modules/prosemirror-state/dist/index.js.map +1 -0
  67. package/dist/node_modules/prosemirror-transform/dist/index.js +1153 -0
  68. package/dist/node_modules/prosemirror-transform/dist/index.js.map +1 -0
  69. package/dist/node_modules/prosemirror-view/dist/index.js +3296 -0
  70. package/dist/node_modules/prosemirror-view/dist/index.js.map +1 -0
  71. package/dist/node_modules/rope-sequence/dist/index.js +85 -0
  72. package/dist/node_modules/rope-sequence/dist/index.js.map +1 -0
  73. package/dist/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js +56 -0
  74. package/dist/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js.map +1 -0
  75. package/dist/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.production.js +54 -0
  76. package/dist/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.production.js.map +1 -0
  77. package/dist/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js +54 -0
  78. package/dist/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js.map +1 -0
  79. package/dist/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.js +46 -0
  80. package/dist/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.js.map +1 -0
  81. package/dist/node_modules/use-sync-external-store/shim/index.js +12 -0
  82. package/dist/node_modules/use-sync-external-store/shim/index.js.map +1 -0
  83. package/dist/node_modules/use-sync-external-store/shim/with-selector.js +12 -0
  84. package/dist/node_modules/use-sync-external-store/shim/with-selector.js.map +1 -0
  85. package/dist/node_modules/w3c-keyname/index.js +90 -0
  86. package/dist/node_modules/w3c-keyname/index.js.map +1 -0
  87. package/dist/support/components/careers/RichTextEditor.d.ts +16 -0
  88. package/dist/support/components/careers/RichTextEditor.js +87 -0
  89. package/dist/support/components/careers/RichTextEditor.js.map +1 -0
  90. package/dist/support/pages/JobApplicationDetailPage.d.ts +1 -0
  91. package/dist/support/pages/JobApplicationDetailPage.js +338 -336
  92. package/dist/support/pages/JobApplicationDetailPage.js.map +1 -1
  93. package/dist/support/pages/JobPostingDetailPage.js +310 -303
  94. package/dist/support/pages/JobPostingDetailPage.js.map +1 -1
  95. package/package.json +4 -1
@@ -0,0 +1,1786 @@
1
+ import e from "../../orderedmap/dist/index.js";
2
+ //#region node_modules/prosemirror-model/dist/index.js
3
+ function t(e, n, a) {
4
+ for (let o = 0;; o++) {
5
+ if (o == e.childCount || o == n.childCount) return e.childCount == n.childCount ? null : a;
6
+ let s = e.child(o), c = n.child(o);
7
+ if (s == c) {
8
+ a += s.nodeSize;
9
+ continue;
10
+ }
11
+ if (!s.sameMarkup(c)) return a;
12
+ if (s.isText && s.text != c.text) {
13
+ let e = s.text, t = c.text, n = 0;
14
+ for (; e[n] == t[n]; n++) a++;
15
+ return n && n < e.length && n < t.length && i(e.charCodeAt(n - 1)) && r(e.charCodeAt(n)) && a--, a;
16
+ }
17
+ if (s.content.size || c.content.size) {
18
+ let e = t(s.content, c.content, a + 1);
19
+ if (e != null) return e;
20
+ }
21
+ a += s.nodeSize;
22
+ }
23
+ }
24
+ function n(e, t, a, o) {
25
+ for (let s = e.childCount, c = t.childCount;;) {
26
+ if (s == 0 || c == 0) return s == c ? null : {
27
+ a,
28
+ b: o
29
+ };
30
+ let l = e.child(--s), u = t.child(--c), d = l.nodeSize;
31
+ if (l == u) {
32
+ a -= d, o -= d;
33
+ continue;
34
+ }
35
+ if (!l.sameMarkup(u)) return {
36
+ a,
37
+ b: o
38
+ };
39
+ if (l.isText && l.text != u.text) {
40
+ let e = l.text, t = u.text, n = e.length, s = t.length;
41
+ for (; n > 0 && s > 0 && e[n - 1] == t[s - 1];) n--, s--, a--, o--;
42
+ return n && s && n < e.length && i(e.charCodeAt(n - 1)) && r(e.charCodeAt(n)) && (a++, o++), {
43
+ a,
44
+ b: o
45
+ };
46
+ }
47
+ if (l.content.size || u.content.size) {
48
+ let e = n(l.content, u.content, a - 1, o - 1);
49
+ if (e) return e;
50
+ }
51
+ a -= d, o -= d;
52
+ }
53
+ }
54
+ function r(e) {
55
+ return e >= 56320 && e < 57344;
56
+ }
57
+ function i(e) {
58
+ return e >= 55296 && e < 56320;
59
+ }
60
+ var a = class e {
61
+ constructor(e, t) {
62
+ if (this.content = e, this.size = t || 0, t == null) for (let t = 0; t < e.length; t++) this.size += e[t].nodeSize;
63
+ }
64
+ nodesBetween(e, t, n, r = 0, i) {
65
+ for (let a = 0, o = 0; o < t; a++) {
66
+ let s = this.content[a], c = o + s.nodeSize;
67
+ if (c > e && n(s, r + o, i || null, a) !== !1 && s.content.size) {
68
+ let i = o + 1;
69
+ s.nodesBetween(Math.max(0, e - i), Math.min(s.content.size, t - i), n, r + i);
70
+ }
71
+ o = c;
72
+ }
73
+ }
74
+ descendants(e) {
75
+ this.nodesBetween(0, this.size, e);
76
+ }
77
+ textBetween(e, t, n, r) {
78
+ let i = "", a = !0;
79
+ return this.nodesBetween(e, t, (o, s) => {
80
+ let c = o.isText ? o.text.slice(Math.max(e, s) - s, t - s) : o.isLeaf ? r ? typeof r == "function" ? r(o) : r : o.type.spec.leafText ? o.type.spec.leafText(o) : "" : "";
81
+ o.isBlock && (o.isLeaf && c || o.isTextblock) && n && (a ? a = !1 : i += n), i += c;
82
+ }, 0), i;
83
+ }
84
+ append(t) {
85
+ if (!t.size) return this;
86
+ if (!this.size) return t;
87
+ let n = this.lastChild, r = t.firstChild, i = this.content.slice(), a = 0;
88
+ for (n.isText && n.sameMarkup(r) && (i[i.length - 1] = n.withText(n.text + r.text), a = 1); a < t.content.length; a++) i.push(t.content[a]);
89
+ return new e(i, this.size + t.size);
90
+ }
91
+ cut(t, n = this.size) {
92
+ if (t == 0 && n == this.size) return this;
93
+ let r = [], i = 0;
94
+ if (n > t) for (let e = 0, a = 0; a < n; e++) {
95
+ let o = this.content[e], s = a + o.nodeSize;
96
+ s > t && ((a < t || s > n) && (o = o.isText ? o.cut(Math.max(0, t - a), Math.min(o.text.length, n - a)) : o.cut(Math.max(0, t - a - 1), Math.min(o.content.size, n - a - 1))), r.push(o), i += o.nodeSize), a = s;
97
+ }
98
+ return new e(r, i);
99
+ }
100
+ cutByIndex(t, n) {
101
+ return t == n ? e.empty : t == 0 && n == this.content.length ? this : new e(this.content.slice(t, n));
102
+ }
103
+ replaceChild(t, n) {
104
+ let r = this.content[t];
105
+ if (r == n) return this;
106
+ let i = this.content.slice(), a = this.size + n.nodeSize - r.nodeSize;
107
+ return i[t] = n, new e(i, a);
108
+ }
109
+ addToStart(t) {
110
+ return new e([t].concat(this.content), this.size + t.nodeSize);
111
+ }
112
+ addToEnd(t) {
113
+ return new e(this.content.concat(t), this.size + t.nodeSize);
114
+ }
115
+ eq(e) {
116
+ if (this.content.length != e.content.length) return !1;
117
+ for (let t = 0; t < this.content.length; t++) if (!this.content[t].eq(e.content[t])) return !1;
118
+ return !0;
119
+ }
120
+ get firstChild() {
121
+ return this.content.length ? this.content[0] : null;
122
+ }
123
+ get lastChild() {
124
+ return this.content.length ? this.content[this.content.length - 1] : null;
125
+ }
126
+ get childCount() {
127
+ return this.content.length;
128
+ }
129
+ child(e) {
130
+ let t = this.content[e];
131
+ if (!t) throw RangeError("Index " + e + " out of range for " + this);
132
+ return t;
133
+ }
134
+ maybeChild(e) {
135
+ return this.content[e] || null;
136
+ }
137
+ forEach(e) {
138
+ for (let t = 0, n = 0; t < this.content.length; t++) {
139
+ let r = this.content[t];
140
+ e(r, n, t), n += r.nodeSize;
141
+ }
142
+ }
143
+ findDiffStart(e, n = 0) {
144
+ return t(this, e, n);
145
+ }
146
+ findDiffEnd(e, t = this.size, r = e.size) {
147
+ return n(this, e, t, r);
148
+ }
149
+ findIndex(e) {
150
+ if (e == 0) return s(0, e);
151
+ if (e == this.size) return s(this.content.length, e);
152
+ if (e > this.size || e < 0) throw RangeError(`Position ${e} outside of fragment (${this})`);
153
+ for (let t = 0, n = 0;; t++) {
154
+ let r = this.child(t), i = n + r.nodeSize;
155
+ if (i >= e) return i == e ? s(t + 1, i) : s(t, n);
156
+ n = i;
157
+ }
158
+ }
159
+ toString() {
160
+ return "<" + this.toStringInner() + ">";
161
+ }
162
+ toStringInner() {
163
+ return this.content.join(", ");
164
+ }
165
+ toJSON() {
166
+ return this.content.length ? this.content.map((e) => e.toJSON()) : null;
167
+ }
168
+ static fromJSON(t, n) {
169
+ if (!n) return e.empty;
170
+ if (!Array.isArray(n)) throw RangeError("Invalid input for Fragment.fromJSON");
171
+ return e.fromArray(n.map(t.nodeFromJSON));
172
+ }
173
+ static fromArray(t) {
174
+ if (!t.length) return e.empty;
175
+ let n, r = 0;
176
+ for (let e = 0; e < t.length; e++) {
177
+ let i = t[e];
178
+ r += i.nodeSize, e && i.isText && t[e - 1].sameMarkup(i) ? (n ||= t.slice(0, e), n[n.length - 1] = i.withText(n[n.length - 1].text + i.text)) : n && n.push(i);
179
+ }
180
+ return new e(n || t, r);
181
+ }
182
+ static from(t) {
183
+ if (!t) return e.empty;
184
+ if (t instanceof e) return t;
185
+ if (Array.isArray(t)) return this.fromArray(t);
186
+ if (t.attrs) return new e([t], t.nodeSize);
187
+ throw RangeError("Can not convert " + t + " to a Fragment" + (t.nodesBetween ? " (looks like multiple versions of prosemirror-model were loaded)" : ""));
188
+ }
189
+ };
190
+ a.empty = new a([], 0);
191
+ var o = {
192
+ index: 0,
193
+ offset: 0
194
+ };
195
+ function s(e, t) {
196
+ return o.index = e, o.offset = t, o;
197
+ }
198
+ function c(e, t) {
199
+ if (e === t) return !0;
200
+ if (!(e && typeof e == "object") || !(t && typeof t == "object")) return !1;
201
+ let n = Array.isArray(e);
202
+ if (Array.isArray(t) != n) return !1;
203
+ if (n) {
204
+ if (e.length != t.length) return !1;
205
+ for (let n = 0; n < e.length; n++) if (!c(e[n], t[n])) return !1;
206
+ } else {
207
+ for (let n in e) if (!(n in t) || !c(e[n], t[n])) return !1;
208
+ for (let n in t) if (!(n in e)) return !1;
209
+ }
210
+ return !0;
211
+ }
212
+ var l = class e {
213
+ constructor(e, t) {
214
+ this.type = e, this.attrs = t;
215
+ }
216
+ addToSet(e) {
217
+ let t, n = !1;
218
+ for (let r = 0; r < e.length; r++) {
219
+ let i = e[r];
220
+ if (this.eq(i)) return e;
221
+ if (this.type.excludes(i.type)) t ||= e.slice(0, r);
222
+ else if (i.type.excludes(this.type)) return e;
223
+ else !n && i.type.rank > this.type.rank && (t ||= e.slice(0, r), t.push(this), n = !0), t && t.push(i);
224
+ }
225
+ return t ||= e.slice(), n || t.push(this), t;
226
+ }
227
+ removeFromSet(e) {
228
+ for (let t = 0; t < e.length; t++) if (this.eq(e[t])) return e.slice(0, t).concat(e.slice(t + 1));
229
+ return e;
230
+ }
231
+ isInSet(e) {
232
+ for (let t = 0; t < e.length; t++) if (this.eq(e[t])) return !0;
233
+ return !1;
234
+ }
235
+ eq(e) {
236
+ return this == e || this.type == e.type && c(this.attrs, e.attrs);
237
+ }
238
+ toJSON() {
239
+ let e = { type: this.type.name };
240
+ for (let t in this.attrs) {
241
+ e.attrs = this.attrs;
242
+ break;
243
+ }
244
+ return e;
245
+ }
246
+ static fromJSON(e, t) {
247
+ if (!t) throw RangeError("Invalid input for Mark.fromJSON");
248
+ let n = e.marks[t.type];
249
+ if (!n) throw RangeError(`There is no mark type ${t.type} in this schema`);
250
+ let r = n.create(t.attrs);
251
+ return n.checkAttrs(r.attrs), r;
252
+ }
253
+ static sameSet(e, t) {
254
+ if (e == t) return !0;
255
+ if (e.length != t.length) return !1;
256
+ for (let n = 0; n < e.length; n++) if (!e[n].eq(t[n])) return !1;
257
+ return !0;
258
+ }
259
+ static setFrom(t) {
260
+ if (!t || Array.isArray(t) && t.length == 0) return e.none;
261
+ if (t instanceof e) return [t];
262
+ let n = t.slice();
263
+ return n.sort((e, t) => e.type.rank - t.type.rank), n;
264
+ }
265
+ };
266
+ l.none = [];
267
+ var u = class extends Error {}, d = class e {
268
+ constructor(e, t, n) {
269
+ this.content = e, this.openStart = t, this.openEnd = n;
270
+ }
271
+ get size() {
272
+ return this.content.size - this.openStart - this.openEnd;
273
+ }
274
+ insertAt(t, n) {
275
+ let r = p(this.content, t + this.openStart, n, this.openStart + 1, this.openEnd + 1);
276
+ return r && new e(r, this.openStart, this.openEnd);
277
+ }
278
+ removeBetween(t, n) {
279
+ return new e(f(this.content, t + this.openStart, n + this.openStart), this.openStart, this.openEnd);
280
+ }
281
+ eq(e) {
282
+ return this.content.eq(e.content) && this.openStart == e.openStart && this.openEnd == e.openEnd;
283
+ }
284
+ toString() {
285
+ return this.content + "(" + this.openStart + "," + this.openEnd + ")";
286
+ }
287
+ toJSON() {
288
+ if (!this.content.size) return null;
289
+ let e = { content: this.content.toJSON() };
290
+ return this.openStart > 0 && (e.openStart = this.openStart), this.openEnd > 0 && (e.openEnd = this.openEnd), e;
291
+ }
292
+ static fromJSON(t, n) {
293
+ if (!n) return e.empty;
294
+ let r = n.openStart || 0, i = n.openEnd || 0;
295
+ if (typeof r != "number" || typeof i != "number") throw RangeError("Invalid input for Slice.fromJSON");
296
+ return new e(a.fromJSON(t, n.content), r, i);
297
+ }
298
+ static maxOpen(t, n = !0) {
299
+ let r = 0, i = 0;
300
+ for (let e = t.firstChild; e && !e.isLeaf && (n || !e.type.spec.isolating); e = e.firstChild) r++;
301
+ for (let e = t.lastChild; e && !e.isLeaf && (n || !e.type.spec.isolating); e = e.lastChild) i++;
302
+ return new e(t, r, i);
303
+ }
304
+ };
305
+ d.empty = new d(a.empty, 0, 0);
306
+ function f(e, t, n) {
307
+ let { index: r, offset: i } = e.findIndex(t), a = e.maybeChild(r), { index: o, offset: s } = e.findIndex(n);
308
+ if (i == t || a.isText) {
309
+ if (s != n && !e.child(o).isText) throw RangeError("Removing non-flat range");
310
+ return e.cut(0, t).append(e.cut(n));
311
+ }
312
+ if (r != o) throw RangeError("Removing non-flat range");
313
+ return e.replaceChild(r, a.copy(f(a.content, t - i - 1, n - i - 1)));
314
+ }
315
+ function p(e, t, n, r, i, a) {
316
+ let { index: o, offset: s } = e.findIndex(t), c = e.maybeChild(o);
317
+ if (s == t || c.isText) return a && r <= 0 && i <= 0 && !a.canReplace(o, o, n) ? null : e.cut(0, t).append(n).append(e.cut(t));
318
+ let l = p(c.content, t - s - 1, n, o == 0 ? r - 1 : 0, o == e.childCount - 1 ? i - 1 : 0, c);
319
+ return l && e.replaceChild(o, c.copy(l));
320
+ }
321
+ function ee(e, t, n) {
322
+ if (n.openStart > e.depth) throw new u("Inserted content deeper than insertion position");
323
+ if (e.depth - n.openStart != t.depth - n.openEnd) throw new u("Inconsistent open depths");
324
+ return m(e, t, n, 0);
325
+ }
326
+ function m(e, t, n, r) {
327
+ let i = e.index(r), a = e.node(r);
328
+ if (i == t.index(r) && r < e.depth - n.openStart) {
329
+ let o = m(e, t, n, r + 1);
330
+ return a.copy(a.content.replaceChild(i, o));
331
+ }
332
+ if (!n.content.size) return y(a, x(e, t, r));
333
+ if (!n.openStart && !n.openEnd && e.depth == r && t.depth == r) {
334
+ let r = e.parent, i = r.content;
335
+ return y(r, i.cut(0, e.parentOffset).append(n.content).append(i.cut(t.parentOffset)));
336
+ }
337
+ {
338
+ let { start: i, end: o } = te(n, e);
339
+ return y(a, b(e, i, o, t, r));
340
+ }
341
+ }
342
+ function h(e, t) {
343
+ if (!t.type.compatibleContent(e.type)) throw new u("Cannot join " + t.type.name + " onto " + e.type.name);
344
+ }
345
+ function g(e, t, n) {
346
+ let r = e.node(n);
347
+ return h(r, t.node(n)), r;
348
+ }
349
+ function _(e, t) {
350
+ let n = t.length - 1;
351
+ n >= 0 && e.isText && e.sameMarkup(t[n]) ? t[n] = e.withText(t[n].text + e.text) : t.push(e);
352
+ }
353
+ function v(e, t, n, r) {
354
+ let i = (t || e).node(n), a = 0, o = t ? t.index(n) : i.childCount;
355
+ e && (a = e.index(n), e.depth > n ? a++ : e.textOffset && (_(e.nodeAfter, r), a++));
356
+ for (let e = a; e < o; e++) _(i.child(e), r);
357
+ t && t.depth == n && t.textOffset && _(t.nodeBefore, r);
358
+ }
359
+ function y(e, t) {
360
+ if (!e.type.validContent(t)) throw new u("Invalid content for node " + e.type.name);
361
+ return e.copy(t);
362
+ }
363
+ function b(e, t, n, r, i) {
364
+ let o = e.depth > i && g(e, t, i + 1), s = r.depth > i && g(n, r, i + 1), c = [];
365
+ return v(null, e, i, c), o && s && t.index(i) == n.index(i) ? (h(o, s), _(y(o, b(e, t, n, r, i + 1)), c)) : (o && _(y(o, x(e, t, i + 1)), c), v(t, n, i, c), s && _(y(s, x(n, r, i + 1)), c)), v(r, null, i, c), new a(c);
366
+ }
367
+ function x(e, t, n) {
368
+ let r = [];
369
+ return v(null, e, n, r), e.depth > n && _(y(g(e, t, n + 1), x(e, t, n + 1)), r), v(t, null, n, r), new a(r);
370
+ }
371
+ function te(e, t) {
372
+ let n = t.depth - e.openStart, r = t.node(n).copy(e.content);
373
+ for (let e = n - 1; e >= 0; e--) r = t.node(e).copy(a.from(r));
374
+ return {
375
+ start: r.resolveNoCache(e.openStart + n),
376
+ end: r.resolveNoCache(r.content.size - e.openEnd - n)
377
+ };
378
+ }
379
+ var S = class e {
380
+ constructor(e, t, n) {
381
+ this.pos = e, this.path = t, this.parentOffset = n, this.depth = t.length / 3 - 1;
382
+ }
383
+ resolveDepth(e) {
384
+ return e == null ? this.depth : e < 0 ? this.depth + e : e;
385
+ }
386
+ get parent() {
387
+ return this.node(this.depth);
388
+ }
389
+ get doc() {
390
+ return this.node(0);
391
+ }
392
+ node(e) {
393
+ return this.path[this.resolveDepth(e) * 3];
394
+ }
395
+ index(e) {
396
+ return this.path[this.resolveDepth(e) * 3 + 1];
397
+ }
398
+ indexAfter(e) {
399
+ return e = this.resolveDepth(e), this.index(e) + (e == this.depth && !this.textOffset ? 0 : 1);
400
+ }
401
+ start(e) {
402
+ return e = this.resolveDepth(e), e == 0 ? 0 : this.path[e * 3 - 1] + 1;
403
+ }
404
+ end(e) {
405
+ return e = this.resolveDepth(e), this.start(e) + this.node(e).content.size;
406
+ }
407
+ before(e) {
408
+ if (e = this.resolveDepth(e), !e) throw RangeError("There is no position before the top-level node");
409
+ return e == this.depth + 1 ? this.pos : this.path[e * 3 - 1];
410
+ }
411
+ after(e) {
412
+ if (e = this.resolveDepth(e), !e) throw RangeError("There is no position after the top-level node");
413
+ return e == this.depth + 1 ? this.pos : this.path[e * 3 - 1] + this.path[e * 3].nodeSize;
414
+ }
415
+ get textOffset() {
416
+ return this.pos - this.path[this.path.length - 1];
417
+ }
418
+ get nodeAfter() {
419
+ let e = this.parent, t = this.index(this.depth);
420
+ if (t == e.childCount) return null;
421
+ let n = this.pos - this.path[this.path.length - 1], r = e.child(t);
422
+ return n ? e.child(t).cut(n) : r;
423
+ }
424
+ get nodeBefore() {
425
+ let e = this.index(this.depth), t = this.pos - this.path[this.path.length - 1];
426
+ return t ? this.parent.child(e).cut(0, t) : e == 0 ? null : this.parent.child(e - 1);
427
+ }
428
+ posAtIndex(e, t) {
429
+ t = this.resolveDepth(t);
430
+ let n = this.path[t * 3], r = t == 0 ? 0 : this.path[t * 3 - 1] + 1;
431
+ for (let t = 0; t < e; t++) r += n.child(t).nodeSize;
432
+ return r;
433
+ }
434
+ marks() {
435
+ let e = this.parent, t = this.index();
436
+ if (e.content.size == 0) return l.none;
437
+ if (this.textOffset) return e.child(t).marks;
438
+ let n = e.maybeChild(t - 1), r = e.maybeChild(t);
439
+ if (!n) {
440
+ let e = n;
441
+ n = r, r = e;
442
+ }
443
+ let i = n.marks;
444
+ for (var a = 0; a < i.length; a++) i[a].type.spec.inclusive === !1 && (!r || !i[a].isInSet(r.marks)) && (i = i[a--].removeFromSet(i));
445
+ return i;
446
+ }
447
+ marksAcross(e) {
448
+ let t = this.parent.maybeChild(this.index());
449
+ if (!t || !t.isInline) return null;
450
+ let n = t.marks, r = e.parent.maybeChild(e.index());
451
+ for (var i = 0; i < n.length; i++) n[i].type.spec.inclusive === !1 && (!r || !n[i].isInSet(r.marks)) && (n = n[i--].removeFromSet(n));
452
+ return n;
453
+ }
454
+ sharedDepth(e) {
455
+ for (let t = this.depth; t > 0; t--) if (this.start(t) <= e && this.end(t) >= e) return t;
456
+ return 0;
457
+ }
458
+ blockRange(e = this, t) {
459
+ if (e.pos < this.pos) return e.blockRange(this);
460
+ for (let n = this.depth - (this.parent.inlineContent || this.pos == e.pos ? 1 : 0); n >= 0; n--) if (e.pos <= this.end(n) && (!t || t(this.node(n)))) return new w(this, e, n);
461
+ return null;
462
+ }
463
+ sameParent(e) {
464
+ return this.pos - this.parentOffset == e.pos - e.parentOffset;
465
+ }
466
+ max(e) {
467
+ return e.pos > this.pos ? e : this;
468
+ }
469
+ min(e) {
470
+ return e.pos < this.pos ? e : this;
471
+ }
472
+ toString() {
473
+ let e = "";
474
+ for (let t = 1; t <= this.depth; t++) e += (e ? "/" : "") + this.node(t).type.name + "_" + this.index(t - 1);
475
+ return e + ":" + this.parentOffset;
476
+ }
477
+ static resolve(t, n) {
478
+ if (!(n >= 0 && n <= t.content.size)) throw RangeError("Position " + n + " out of range");
479
+ let r = [], i = 0, a = n;
480
+ for (let e = t;;) {
481
+ let { index: t, offset: n } = e.content.findIndex(a), o = a - n;
482
+ if (r.push(e, t, i + n), !o || (e = e.child(t), e.isText)) break;
483
+ a = o - 1, i += n + 1;
484
+ }
485
+ return new e(n, r, a);
486
+ }
487
+ static resolveCached(t, n) {
488
+ let r = C.get(t);
489
+ if (r) for (let e = 0; e < r.elts.length; e++) {
490
+ let t = r.elts[e];
491
+ if (t.pos == n) return t;
492
+ }
493
+ else C.set(t, r = new ne());
494
+ let i = r.elts[r.i] = e.resolve(t, n);
495
+ return r.i = (r.i + 1) % re, i;
496
+ }
497
+ }, ne = class {
498
+ constructor() {
499
+ this.elts = [], this.i = 0;
500
+ }
501
+ }, re = 12, C = /* @__PURE__ */ new WeakMap(), w = class {
502
+ constructor(e, t, n) {
503
+ this.$from = e, this.$to = t, this.depth = n;
504
+ }
505
+ get start() {
506
+ return this.$from.before(this.depth + 1);
507
+ }
508
+ get end() {
509
+ return this.$to.after(this.depth + 1);
510
+ }
511
+ get parent() {
512
+ return this.$from.node(this.depth);
513
+ }
514
+ get startIndex() {
515
+ return this.$from.index(this.depth);
516
+ }
517
+ get endIndex() {
518
+ return this.$to.indexAfter(this.depth);
519
+ }
520
+ }, ie = Object.create(null), T = class e {
521
+ constructor(e, t, n, r = l.none) {
522
+ this.type = e, this.attrs = t, this.marks = r, this.content = n || a.empty;
523
+ }
524
+ get children() {
525
+ return this.content.content;
526
+ }
527
+ get nodeSize() {
528
+ return this.isLeaf ? 1 : 2 + this.content.size;
529
+ }
530
+ get childCount() {
531
+ return this.content.childCount;
532
+ }
533
+ child(e) {
534
+ return this.content.child(e);
535
+ }
536
+ maybeChild(e) {
537
+ return this.content.maybeChild(e);
538
+ }
539
+ forEach(e) {
540
+ this.content.forEach(e);
541
+ }
542
+ nodesBetween(e, t, n, r = 0) {
543
+ this.content.nodesBetween(e, t, n, r, this);
544
+ }
545
+ descendants(e) {
546
+ this.nodesBetween(0, this.content.size, e);
547
+ }
548
+ get textContent() {
549
+ return this.isLeaf && this.type.spec.leafText ? this.type.spec.leafText(this) : this.textBetween(0, this.content.size, "");
550
+ }
551
+ textBetween(e, t, n, r) {
552
+ return this.content.textBetween(e, t, n, r);
553
+ }
554
+ get firstChild() {
555
+ return this.content.firstChild;
556
+ }
557
+ get lastChild() {
558
+ return this.content.lastChild;
559
+ }
560
+ eq(e) {
561
+ return this == e || this.sameMarkup(e) && this.content.eq(e.content);
562
+ }
563
+ sameMarkup(e) {
564
+ return this.hasMarkup(e.type, e.attrs, e.marks);
565
+ }
566
+ hasMarkup(e, t, n) {
567
+ return this.type == e && c(this.attrs, t || e.defaultAttrs || ie) && l.sameSet(this.marks, n || l.none);
568
+ }
569
+ copy(t = null) {
570
+ return t == this.content ? this : new e(this.type, this.attrs, t, this.marks);
571
+ }
572
+ mark(t) {
573
+ return t == this.marks ? this : new e(this.type, this.attrs, this.content, t);
574
+ }
575
+ cut(e, t = this.content.size) {
576
+ return e == 0 && t == this.content.size ? this : this.copy(this.content.cut(e, t));
577
+ }
578
+ slice(e, t = this.content.size, n = !1) {
579
+ if (e == t) return d.empty;
580
+ let r = this.resolve(e), i = this.resolve(t), a = n ? 0 : r.sharedDepth(t), o = r.start(a);
581
+ return new d(r.node(a).content.cut(r.pos - o, i.pos - o), r.depth - a, i.depth - a);
582
+ }
583
+ replace(e, t, n) {
584
+ return ee(this.resolve(e), this.resolve(t), n);
585
+ }
586
+ nodeAt(e) {
587
+ for (let t = this;;) {
588
+ let { index: n, offset: r } = t.content.findIndex(e);
589
+ if (t = t.maybeChild(n), !t) return null;
590
+ if (r == e || t.isText) return t;
591
+ e -= r + 1;
592
+ }
593
+ }
594
+ childAfter(e) {
595
+ let { index: t, offset: n } = this.content.findIndex(e);
596
+ return {
597
+ node: this.content.maybeChild(t),
598
+ index: t,
599
+ offset: n
600
+ };
601
+ }
602
+ childBefore(e) {
603
+ if (e == 0) return {
604
+ node: null,
605
+ index: 0,
606
+ offset: 0
607
+ };
608
+ let { index: t, offset: n } = this.content.findIndex(e);
609
+ if (n < e) return {
610
+ node: this.content.child(t),
611
+ index: t,
612
+ offset: n
613
+ };
614
+ let r = this.content.child(t - 1);
615
+ return {
616
+ node: r,
617
+ index: t - 1,
618
+ offset: n - r.nodeSize
619
+ };
620
+ }
621
+ resolve(e) {
622
+ return S.resolveCached(this, e);
623
+ }
624
+ resolveNoCache(e) {
625
+ return S.resolve(this, e);
626
+ }
627
+ rangeHasMark(e, t, n) {
628
+ let r = !1;
629
+ return t > e && this.nodesBetween(e, t, (e) => (n.isInSet(e.marks) && (r = !0), !r)), r;
630
+ }
631
+ get isBlock() {
632
+ return this.type.isBlock;
633
+ }
634
+ get isTextblock() {
635
+ return this.type.isTextblock;
636
+ }
637
+ get inlineContent() {
638
+ return this.type.inlineContent;
639
+ }
640
+ get isInline() {
641
+ return this.type.isInline;
642
+ }
643
+ get isText() {
644
+ return this.type.isText;
645
+ }
646
+ get isLeaf() {
647
+ return this.type.isLeaf;
648
+ }
649
+ get isAtom() {
650
+ return this.type.isAtom;
651
+ }
652
+ toString() {
653
+ if (this.type.spec.toDebugString) return this.type.spec.toDebugString(this);
654
+ let e = this.type.name;
655
+ return this.content.size && (e += "(" + this.content.toStringInner() + ")"), E(this.marks, e);
656
+ }
657
+ contentMatchAt(e) {
658
+ let t = this.type.contentMatch.matchFragment(this.content, 0, e);
659
+ if (!t) throw Error("Called contentMatchAt on a node with invalid content");
660
+ return t;
661
+ }
662
+ canReplace(e, t, n = a.empty, r = 0, i = n.childCount) {
663
+ let o = this.contentMatchAt(e).matchFragment(n, r, i), s = o && o.matchFragment(this.content, t);
664
+ if (!s || !s.validEnd) return !1;
665
+ for (let e = r; e < i; e++) if (!this.type.allowsMarks(n.child(e).marks)) return !1;
666
+ return !0;
667
+ }
668
+ canReplaceWith(e, t, n, r) {
669
+ if (r && !this.type.allowsMarks(r)) return !1;
670
+ let i = this.contentMatchAt(e).matchType(n), a = i && i.matchFragment(this.content, t);
671
+ return a ? a.validEnd : !1;
672
+ }
673
+ canAppend(e) {
674
+ return e.content.size ? this.canReplace(this.childCount, this.childCount, e.content) : this.type.compatibleContent(e.type);
675
+ }
676
+ check() {
677
+ this.type.checkContent(this.content), this.type.checkAttrs(this.attrs);
678
+ let e = l.none;
679
+ for (let t = 0; t < this.marks.length; t++) {
680
+ let n = this.marks[t];
681
+ n.type.checkAttrs(n.attrs), e = n.addToSet(e);
682
+ }
683
+ if (!l.sameSet(e, this.marks)) throw RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map((e) => e.type.name)}`);
684
+ this.content.forEach((e) => e.check());
685
+ }
686
+ toJSON() {
687
+ let e = { type: this.type.name };
688
+ for (let t in this.attrs) {
689
+ e.attrs = this.attrs;
690
+ break;
691
+ }
692
+ return this.content.size && (e.content = this.content.toJSON()), this.marks.length && (e.marks = this.marks.map((e) => e.toJSON())), e;
693
+ }
694
+ static fromJSON(e, t) {
695
+ if (!t) throw RangeError("Invalid input for Node.fromJSON");
696
+ let n;
697
+ if (t.marks) {
698
+ if (!Array.isArray(t.marks)) throw RangeError("Invalid mark data for Node.fromJSON");
699
+ n = t.marks.map(e.markFromJSON);
700
+ }
701
+ if (t.type == "text") {
702
+ if (typeof t.text != "string") throw RangeError("Invalid text node in JSON");
703
+ return e.text(t.text, n);
704
+ }
705
+ let r = a.fromJSON(e, t.content), i = e.nodeType(t.type).create(t.attrs, r, n);
706
+ return i.type.checkAttrs(i.attrs), i;
707
+ }
708
+ };
709
+ T.prototype.text = void 0;
710
+ var ae = class e extends T {
711
+ constructor(e, t, n, r) {
712
+ if (super(e, t, null, r), !n) throw RangeError("Empty text nodes are not allowed");
713
+ this.text = n;
714
+ }
715
+ toString() {
716
+ return this.type.spec.toDebugString ? this.type.spec.toDebugString(this) : E(this.marks, JSON.stringify(this.text));
717
+ }
718
+ get textContent() {
719
+ return this.text;
720
+ }
721
+ textBetween(e, t) {
722
+ return this.text.slice(e, t);
723
+ }
724
+ get nodeSize() {
725
+ return this.text.length;
726
+ }
727
+ mark(t) {
728
+ return t == this.marks ? this : new e(this.type, this.attrs, this.text, t);
729
+ }
730
+ withText(t) {
731
+ return t == this.text ? this : new e(this.type, this.attrs, t, this.marks);
732
+ }
733
+ cut(e = 0, t = this.text.length) {
734
+ return e == 0 && t == this.text.length ? this : this.withText(this.text.slice(e, t));
735
+ }
736
+ eq(e) {
737
+ return this.sameMarkup(e) && this.text == e.text;
738
+ }
739
+ toJSON() {
740
+ let e = super.toJSON();
741
+ return e.text = this.text, e;
742
+ }
743
+ };
744
+ function E(e, t) {
745
+ for (let n = e.length - 1; n >= 0; n--) t = e[n].type.name + "(" + t + ")";
746
+ return t;
747
+ }
748
+ var D = class e {
749
+ constructor(e) {
750
+ this.validEnd = e, this.next = [], this.wrapCache = [];
751
+ }
752
+ static parse(t, n) {
753
+ let r = new oe(t, n);
754
+ if (r.next == null) return e.empty;
755
+ let i = O(r);
756
+ r.next && r.err("Unexpected trailing text");
757
+ let a = pe(fe(i));
758
+ return me(a, r), a;
759
+ }
760
+ matchType(e) {
761
+ for (let t = 0; t < this.next.length; t++) if (this.next[t].type == e) return this.next[t].next;
762
+ return null;
763
+ }
764
+ matchFragment(e, t = 0, n = e.childCount) {
765
+ let r = this;
766
+ for (let i = t; r && i < n; i++) r = r.matchType(e.child(i).type);
767
+ return r;
768
+ }
769
+ get inlineContent() {
770
+ return this.next.length != 0 && this.next[0].type.isInline;
771
+ }
772
+ get defaultType() {
773
+ for (let e = 0; e < this.next.length; e++) {
774
+ let { type: t } = this.next[e];
775
+ if (!(t.isText || t.hasRequiredAttrs())) return t;
776
+ }
777
+ return null;
778
+ }
779
+ compatible(e) {
780
+ for (let t = 0; t < this.next.length; t++) for (let n = 0; n < e.next.length; n++) if (this.next[t].type == e.next[n].type) return !0;
781
+ return !1;
782
+ }
783
+ fillBefore(e, t = !1, n = 0) {
784
+ let r = [this];
785
+ function i(o, s) {
786
+ let c = o.matchFragment(e, n);
787
+ if (c && (!t || c.validEnd)) return a.from(s.map((e) => e.createAndFill()));
788
+ for (let e = 0; e < o.next.length; e++) {
789
+ let { type: t, next: n } = o.next[e];
790
+ if (!(t.isText || t.hasRequiredAttrs()) && r.indexOf(n) == -1) {
791
+ r.push(n);
792
+ let e = i(n, s.concat(t));
793
+ if (e) return e;
794
+ }
795
+ }
796
+ return null;
797
+ }
798
+ return i(this, []);
799
+ }
800
+ findWrapping(e) {
801
+ for (let t = 0; t < this.wrapCache.length; t += 2) if (this.wrapCache[t] == e) return this.wrapCache[t + 1];
802
+ let t = this.computeWrapping(e);
803
+ return this.wrapCache.push(e, t), t;
804
+ }
805
+ computeWrapping(e) {
806
+ let t = Object.create(null), n = [{
807
+ match: this,
808
+ type: null,
809
+ via: null
810
+ }];
811
+ for (; n.length;) {
812
+ let r = n.shift(), i = r.match;
813
+ if (i.matchType(e)) {
814
+ let e = [];
815
+ for (let t = r; t.type; t = t.via) e.push(t.type);
816
+ return e.reverse();
817
+ }
818
+ for (let e = 0; e < i.next.length; e++) {
819
+ let { type: a, next: o } = i.next[e];
820
+ !a.isLeaf && !a.hasRequiredAttrs() && !(a.name in t) && (!r.type || o.validEnd) && (n.push({
821
+ match: a.contentMatch,
822
+ type: a,
823
+ via: r
824
+ }), t[a.name] = !0);
825
+ }
826
+ }
827
+ return null;
828
+ }
829
+ get edgeCount() {
830
+ return this.next.length;
831
+ }
832
+ edge(e) {
833
+ if (e >= this.next.length) throw RangeError(`There's no ${e}th edge in this content match`);
834
+ return this.next[e];
835
+ }
836
+ toString() {
837
+ let e = [];
838
+ function t(n) {
839
+ e.push(n);
840
+ for (let r = 0; r < n.next.length; r++) e.indexOf(n.next[r].next) == -1 && t(n.next[r].next);
841
+ }
842
+ return t(this), e.map((t, n) => {
843
+ let r = n + (t.validEnd ? "*" : " ") + " ";
844
+ for (let n = 0; n < t.next.length; n++) r += (n ? ", " : "") + t.next[n].type.name + "->" + e.indexOf(t.next[n].next);
845
+ return r;
846
+ }).join("\n");
847
+ }
848
+ };
849
+ D.empty = new D(!0);
850
+ var oe = class {
851
+ constructor(e, t) {
852
+ this.string = e, this.nodeTypes = t, this.inline = null, this.pos = 0, this.tokens = e.split(/\s*(?=\b|\W|$)/), this.tokens[this.tokens.length - 1] == "" && this.tokens.pop(), this.tokens[0] == "" && this.tokens.shift();
853
+ }
854
+ get next() {
855
+ return this.tokens[this.pos];
856
+ }
857
+ eat(e) {
858
+ return this.next == e && (this.pos++ || !0);
859
+ }
860
+ err(e) {
861
+ throw SyntaxError(e + " (in content expression '" + this.string + "')");
862
+ }
863
+ };
864
+ function O(e) {
865
+ let t = [];
866
+ do
867
+ t.push(se(e));
868
+ while (e.eat("|"));
869
+ return t.length == 1 ? t[0] : {
870
+ type: "choice",
871
+ exprs: t
872
+ };
873
+ }
874
+ function se(e) {
875
+ let t = [];
876
+ do
877
+ t.push(ce(e));
878
+ while (e.next && e.next != ")" && e.next != "|");
879
+ return t.length == 1 ? t[0] : {
880
+ type: "seq",
881
+ exprs: t
882
+ };
883
+ }
884
+ function ce(e) {
885
+ let t = de(e);
886
+ for (;;) if (e.eat("+")) t = {
887
+ type: "plus",
888
+ expr: t
889
+ };
890
+ else if (e.eat("*")) t = {
891
+ type: "star",
892
+ expr: t
893
+ };
894
+ else if (e.eat("?")) t = {
895
+ type: "opt",
896
+ expr: t
897
+ };
898
+ else if (e.eat("{")) t = le(e, t);
899
+ else break;
900
+ return t;
901
+ }
902
+ function k(e) {
903
+ /\D/.test(e.next) && e.err("Expected number, got '" + e.next + "'");
904
+ let t = Number(e.next);
905
+ return e.pos++, t;
906
+ }
907
+ function le(e, t) {
908
+ let n = k(e), r = n;
909
+ return e.eat(",") && (r = e.next == "}" ? -1 : k(e)), e.eat("}") || e.err("Unclosed braced range"), {
910
+ type: "range",
911
+ min: n,
912
+ max: r,
913
+ expr: t
914
+ };
915
+ }
916
+ function ue(e, t) {
917
+ let n = e.nodeTypes, r = n[t];
918
+ if (r) return [r];
919
+ let i = [];
920
+ for (let e in n) {
921
+ let r = n[e];
922
+ r.isInGroup(t) && i.push(r);
923
+ }
924
+ return i.length == 0 && e.err("No node type or group '" + t + "' found"), i;
925
+ }
926
+ function de(e) {
927
+ if (e.eat("(")) {
928
+ let t = O(e);
929
+ return e.eat(")") || e.err("Missing closing paren"), t;
930
+ }
931
+ if (/\W/.test(e.next)) e.err("Unexpected token '" + e.next + "'");
932
+ else {
933
+ let t = ue(e, e.next).map((t) => (e.inline == null ? e.inline = t.isInline : e.inline != t.isInline && e.err("Mixing inline and block content"), {
934
+ type: "name",
935
+ value: t
936
+ }));
937
+ return e.pos++, t.length == 1 ? t[0] : {
938
+ type: "choice",
939
+ exprs: t
940
+ };
941
+ }
942
+ }
943
+ function fe(e) {
944
+ let t = [[]];
945
+ return i(a(e, 0), n()), t;
946
+ function n() {
947
+ return t.push([]) - 1;
948
+ }
949
+ function r(e, n, r) {
950
+ let i = {
951
+ term: r,
952
+ to: n
953
+ };
954
+ return t[e].push(i), i;
955
+ }
956
+ function i(e, t) {
957
+ e.forEach((e) => e.to = t);
958
+ }
959
+ function a(e, t) {
960
+ if (e.type == "choice") return e.exprs.reduce((e, n) => e.concat(a(n, t)), []);
961
+ if (e.type == "seq") for (let r = 0;; r++) {
962
+ let o = a(e.exprs[r], t);
963
+ if (r == e.exprs.length - 1) return o;
964
+ i(o, t = n());
965
+ }
966
+ else if (e.type == "star") {
967
+ let o = n();
968
+ return r(t, o), i(a(e.expr, o), o), [r(o)];
969
+ } else if (e.type == "plus") {
970
+ let o = n();
971
+ return i(a(e.expr, t), o), i(a(e.expr, o), o), [r(o)];
972
+ } else if (e.type == "opt") return [r(t)].concat(a(e.expr, t));
973
+ else if (e.type == "range") {
974
+ let o = t;
975
+ for (let t = 0; t < e.min; t++) {
976
+ let t = n();
977
+ i(a(e.expr, o), t), o = t;
978
+ }
979
+ if (e.max == -1) i(a(e.expr, o), o);
980
+ else for (let t = e.min; t < e.max; t++) {
981
+ let t = n();
982
+ r(o, t), i(a(e.expr, o), t), o = t;
983
+ }
984
+ return [r(o)];
985
+ } else if (e.type == "name") return [r(t, void 0, e.value)];
986
+ else throw Error("Unknown expr type");
987
+ }
988
+ }
989
+ function A(e, t) {
990
+ return t - e;
991
+ }
992
+ function j(e, t) {
993
+ let n = [];
994
+ return r(t), n.sort(A);
995
+ function r(t) {
996
+ let i = e[t];
997
+ if (i.length == 1 && !i[0].term) return r(i[0].to);
998
+ n.push(t);
999
+ for (let e = 0; e < i.length; e++) {
1000
+ let { term: t, to: a } = i[e];
1001
+ !t && n.indexOf(a) == -1 && r(a);
1002
+ }
1003
+ }
1004
+ }
1005
+ function pe(e) {
1006
+ let t = Object.create(null);
1007
+ return n(j(e, 0));
1008
+ function n(r) {
1009
+ let i = [];
1010
+ r.forEach((t) => {
1011
+ e[t].forEach(({ term: t, to: n }) => {
1012
+ if (!t) return;
1013
+ let r;
1014
+ for (let e = 0; e < i.length; e++) i[e][0] == t && (r = i[e][1]);
1015
+ j(e, n).forEach((e) => {
1016
+ r || i.push([t, r = []]), r.indexOf(e) == -1 && r.push(e);
1017
+ });
1018
+ });
1019
+ });
1020
+ let a = t[r.join(",")] = new D(r.indexOf(e.length - 1) > -1);
1021
+ for (let e = 0; e < i.length; e++) {
1022
+ let r = i[e][1].sort(A);
1023
+ a.next.push({
1024
+ type: i[e][0],
1025
+ next: t[r.join(",")] || n(r)
1026
+ });
1027
+ }
1028
+ return a;
1029
+ }
1030
+ }
1031
+ function me(e, t) {
1032
+ for (let n = 0, r = [e]; n < r.length; n++) {
1033
+ let e = r[n], i = !e.validEnd, a = [];
1034
+ for (let t = 0; t < e.next.length; t++) {
1035
+ let { type: n, next: o } = e.next[t];
1036
+ a.push(n.name), i && !(n.isText || n.hasRequiredAttrs()) && (i = !1), r.indexOf(o) == -1 && r.push(o);
1037
+ }
1038
+ i && t.err("Only non-generatable nodes (" + a.join(", ") + ") in a required position (see https://prosemirror.net/docs/guide/#generatable)");
1039
+ }
1040
+ }
1041
+ function M(e) {
1042
+ let t = Object.create(null);
1043
+ for (let n in e) {
1044
+ let r = e[n];
1045
+ if (!r.hasDefault) return null;
1046
+ t[n] = r.default;
1047
+ }
1048
+ return t;
1049
+ }
1050
+ function N(e, t) {
1051
+ let n = Object.create(null);
1052
+ for (let r in e) {
1053
+ let i = t && t[r];
1054
+ if (i === void 0) {
1055
+ let t = e[r];
1056
+ if (t.hasDefault) i = t.default;
1057
+ else throw RangeError("No value supplied for attribute " + r);
1058
+ }
1059
+ n[r] = i;
1060
+ }
1061
+ return n;
1062
+ }
1063
+ function P(e, t, n, r) {
1064
+ for (let i in t) if (!(i in e)) throw RangeError(`Unsupported attribute ${i} for ${n} of type ${r}`);
1065
+ for (let n in e) e[n].validate && e[n].validate(t[n]);
1066
+ }
1067
+ function F(e, t) {
1068
+ let n = Object.create(null);
1069
+ if (t) for (let r in t) n[r] = new L(e, r, t[r]);
1070
+ return n;
1071
+ }
1072
+ var I = class e {
1073
+ constructor(e, t, n) {
1074
+ this.name = e, this.schema = t, this.spec = n, this.markSet = null, this.groups = n.group ? n.group.split(" ") : [], this.attrs = F(e, n.attrs), this.defaultAttrs = M(this.attrs), this.contentMatch = null, this.inlineContent = null, this.isBlock = !(n.inline || e == "text"), this.isText = e == "text";
1075
+ }
1076
+ get isInline() {
1077
+ return !this.isBlock;
1078
+ }
1079
+ get isTextblock() {
1080
+ return this.isBlock && this.inlineContent;
1081
+ }
1082
+ get isLeaf() {
1083
+ return this.contentMatch == D.empty;
1084
+ }
1085
+ get isAtom() {
1086
+ return this.isLeaf || !!this.spec.atom;
1087
+ }
1088
+ isInGroup(e) {
1089
+ return this.groups.indexOf(e) > -1;
1090
+ }
1091
+ get whitespace() {
1092
+ return this.spec.whitespace || (this.spec.code ? "pre" : "normal");
1093
+ }
1094
+ hasRequiredAttrs() {
1095
+ for (let e in this.attrs) if (this.attrs[e].isRequired) return !0;
1096
+ return !1;
1097
+ }
1098
+ compatibleContent(e) {
1099
+ return this == e || this.contentMatch.compatible(e.contentMatch);
1100
+ }
1101
+ computeAttrs(e) {
1102
+ return !e && this.defaultAttrs ? this.defaultAttrs : N(this.attrs, e);
1103
+ }
1104
+ create(e = null, t, n) {
1105
+ if (this.isText) throw Error("NodeType.create can't construct text nodes");
1106
+ return new T(this, this.computeAttrs(e), a.from(t), l.setFrom(n));
1107
+ }
1108
+ createChecked(e = null, t, n) {
1109
+ return t = a.from(t), this.checkContent(t), new T(this, this.computeAttrs(e), t, l.setFrom(n));
1110
+ }
1111
+ createAndFill(e = null, t, n) {
1112
+ if (e = this.computeAttrs(e), t = a.from(t), t.size) {
1113
+ let e = this.contentMatch.fillBefore(t);
1114
+ if (!e) return null;
1115
+ t = e.append(t);
1116
+ }
1117
+ let r = this.contentMatch.matchFragment(t), i = r && r.fillBefore(a.empty, !0);
1118
+ return i ? new T(this, e, t.append(i), l.setFrom(n)) : null;
1119
+ }
1120
+ validContent(e) {
1121
+ let t = this.contentMatch.matchFragment(e);
1122
+ if (!t || !t.validEnd) return !1;
1123
+ for (let t = 0; t < e.childCount; t++) if (!this.allowsMarks(e.child(t).marks)) return !1;
1124
+ return !0;
1125
+ }
1126
+ checkContent(e) {
1127
+ if (!this.validContent(e)) throw RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0, 50)}`);
1128
+ }
1129
+ checkAttrs(e) {
1130
+ P(this.attrs, e, "node", this.name);
1131
+ }
1132
+ allowsMarkType(e) {
1133
+ return this.markSet == null || this.markSet.indexOf(e) > -1;
1134
+ }
1135
+ allowsMarks(e) {
1136
+ if (this.markSet == null) return !0;
1137
+ for (let t = 0; t < e.length; t++) if (!this.allowsMarkType(e[t].type)) return !1;
1138
+ return !0;
1139
+ }
1140
+ allowedMarks(e) {
1141
+ if (this.markSet == null) return e;
1142
+ let t;
1143
+ for (let n = 0; n < e.length; n++) this.allowsMarkType(e[n].type) ? t && t.push(e[n]) : t ||= e.slice(0, n);
1144
+ return t ? t.length ? t : l.none : e;
1145
+ }
1146
+ static compile(t, n) {
1147
+ let r = Object.create(null);
1148
+ t.forEach((t, i) => r[t] = new e(t, n, i));
1149
+ let i = n.spec.topNode || "doc";
1150
+ if (!r[i]) throw RangeError("Schema is missing its top node type ('" + i + "')");
1151
+ if (!r.text) throw RangeError("Every schema needs a 'text' type");
1152
+ for (let e in r.text.attrs) throw RangeError("The text node type should not have attributes");
1153
+ return r;
1154
+ }
1155
+ };
1156
+ function he(e, t, n) {
1157
+ let r = n.split("|");
1158
+ return (n) => {
1159
+ let i = n === null ? "null" : typeof n;
1160
+ if (r.indexOf(i) < 0) throw RangeError(`Expected value of type ${r} for attribute ${t} on type ${e}, got ${i}`);
1161
+ };
1162
+ }
1163
+ var L = class {
1164
+ constructor(e, t, n) {
1165
+ this.hasDefault = Object.prototype.hasOwnProperty.call(n, "default"), this.default = n.default, this.validate = typeof n.validate == "string" ? he(e, t, n.validate) : n.validate;
1166
+ }
1167
+ get isRequired() {
1168
+ return !this.hasDefault;
1169
+ }
1170
+ }, R = class e {
1171
+ constructor(e, t, n, r) {
1172
+ this.name = e, this.rank = t, this.schema = n, this.spec = r, this.attrs = F(e, r.attrs), this.excluded = null;
1173
+ let i = M(this.attrs);
1174
+ this.instance = i ? new l(this, i) : null;
1175
+ }
1176
+ create(e = null) {
1177
+ return !e && this.instance ? this.instance : new l(this, N(this.attrs, e));
1178
+ }
1179
+ static compile(t, n) {
1180
+ let r = Object.create(null), i = 0;
1181
+ return t.forEach((t, a) => r[t] = new e(t, i++, n, a)), r;
1182
+ }
1183
+ removeFromSet(e) {
1184
+ for (var t = 0; t < e.length; t++) e[t].type == this && (e = e.slice(0, t).concat(e.slice(t + 1)), t--);
1185
+ return e;
1186
+ }
1187
+ isInSet(e) {
1188
+ for (let t = 0; t < e.length; t++) if (e[t].type == this) return e[t];
1189
+ }
1190
+ checkAttrs(e) {
1191
+ P(this.attrs, e, "mark", this.name);
1192
+ }
1193
+ excludes(e) {
1194
+ return this.excluded.indexOf(e) > -1;
1195
+ }
1196
+ }, ge = class {
1197
+ constructor(t) {
1198
+ this.linebreakReplacement = null, this.cached = Object.create(null);
1199
+ let n = this.spec = {};
1200
+ for (let e in t) n[e] = t[e];
1201
+ n.nodes = e.from(t.nodes), n.marks = e.from(t.marks || {}), this.nodes = I.compile(this.spec.nodes, this), this.marks = R.compile(this.spec.marks, this);
1202
+ let r = Object.create(null);
1203
+ for (let e in this.nodes) {
1204
+ if (e in this.marks) throw RangeError(e + " can not be both a node and a mark");
1205
+ let t = this.nodes[e], n = t.spec.content || "", i = t.spec.marks;
1206
+ if (t.contentMatch = r[n] || (r[n] = D.parse(n, this.nodes)), t.inlineContent = t.contentMatch.inlineContent, t.spec.linebreakReplacement) {
1207
+ if (this.linebreakReplacement) throw RangeError("Multiple linebreak nodes defined");
1208
+ if (!t.isInline || !t.isLeaf) throw RangeError("Linebreak replacement nodes must be inline leaf nodes");
1209
+ this.linebreakReplacement = t;
1210
+ }
1211
+ t.markSet = i == "_" ? null : i ? z(this, i.split(" ")) : i == "" || !t.inlineContent ? [] : null;
1212
+ }
1213
+ for (let e in this.marks) {
1214
+ let t = this.marks[e], n = t.spec.excludes;
1215
+ t.excluded = n == null ? [t] : n == "" ? [] : z(this, n.split(" "));
1216
+ }
1217
+ this.nodeFromJSON = (e) => T.fromJSON(this, e), this.markFromJSON = (e) => l.fromJSON(this, e), this.topNodeType = this.nodes[this.spec.topNode || "doc"], this.cached.wrappings = Object.create(null);
1218
+ }
1219
+ node(e, t = null, n, r) {
1220
+ if (typeof e == "string") e = this.nodeType(e);
1221
+ else if (!(e instanceof I)) throw RangeError("Invalid node type: " + e);
1222
+ else if (e.schema != this) throw RangeError("Node type from different schema used (" + e.name + ")");
1223
+ return e.createChecked(t, n, r);
1224
+ }
1225
+ text(e, t) {
1226
+ let n = this.nodes.text;
1227
+ return new ae(n, n.defaultAttrs, e, l.setFrom(t));
1228
+ }
1229
+ mark(e, t) {
1230
+ return typeof e == "string" && (e = this.marks[e]), e.create(t);
1231
+ }
1232
+ nodeType(e) {
1233
+ let t = this.nodes[e];
1234
+ if (!t) throw RangeError("Unknown node type: " + e);
1235
+ return t;
1236
+ }
1237
+ };
1238
+ function z(e, t) {
1239
+ let n = [];
1240
+ for (let r = 0; r < t.length; r++) {
1241
+ let i = t[r], a = e.marks[i], o = a;
1242
+ if (a) n.push(a);
1243
+ else for (let t in e.marks) {
1244
+ let r = e.marks[t];
1245
+ (i == "_" || r.spec.group && r.spec.group.split(" ").indexOf(i) > -1) && n.push(o = r);
1246
+ }
1247
+ if (!o) throw SyntaxError("Unknown mark type: '" + t[r] + "'");
1248
+ }
1249
+ return n;
1250
+ }
1251
+ function _e(e) {
1252
+ return e.tag != null;
1253
+ }
1254
+ function ve(e) {
1255
+ return e.style != null;
1256
+ }
1257
+ var ye = class e {
1258
+ constructor(e, t) {
1259
+ this.schema = e, this.rules = t, this.tags = [], this.styles = [];
1260
+ let n = this.matchedStyles = [];
1261
+ t.forEach((e) => {
1262
+ if (_e(e)) this.tags.push(e);
1263
+ else if (ve(e)) {
1264
+ let t = /[^=]*/.exec(e.style)[0];
1265
+ n.indexOf(t) < 0 && n.push(t), this.styles.push(e);
1266
+ }
1267
+ }), this.normalizeLists = !this.tags.some((t) => {
1268
+ if (!/^(ul|ol)\b/.test(t.tag) || !t.node) return !1;
1269
+ let n = e.nodes[t.node];
1270
+ return n.contentMatch.matchType(n);
1271
+ });
1272
+ }
1273
+ parse(e, t = {}) {
1274
+ let n = new q(this, t, !1);
1275
+ return n.addAll(e, l.none, t.from, t.to), n.finish();
1276
+ }
1277
+ parseSlice(e, t = {}) {
1278
+ let n = new q(this, t, !0);
1279
+ return n.addAll(e, l.none, t.from, t.to), d.maxOpen(n.finish());
1280
+ }
1281
+ matchTag(e, t, n) {
1282
+ for (let r = n ? this.tags.indexOf(n) + 1 : 0; r < this.tags.length; r++) {
1283
+ let n = this.tags[r];
1284
+ if (Se(e, n.tag) && (n.namespace === void 0 || e.namespaceURI == n.namespace) && (!n.context || t.matchesContext(n.context))) {
1285
+ if (n.getAttrs) {
1286
+ let t = n.getAttrs(e);
1287
+ if (t === !1) continue;
1288
+ n.attrs = t || void 0;
1289
+ }
1290
+ return n;
1291
+ }
1292
+ }
1293
+ }
1294
+ matchStyle(e, t, n, r) {
1295
+ for (let i = r ? this.styles.indexOf(r) + 1 : 0; i < this.styles.length; i++) {
1296
+ let r = this.styles[i], a = r.style;
1297
+ if (!(a.indexOf(e) != 0 || r.context && !n.matchesContext(r.context) || a.length > e.length && (a.charCodeAt(e.length) != 61 || a.slice(e.length + 1) != t))) {
1298
+ if (r.getAttrs) {
1299
+ let e = r.getAttrs(t);
1300
+ if (e === !1) continue;
1301
+ r.attrs = e || void 0;
1302
+ }
1303
+ return r;
1304
+ }
1305
+ }
1306
+ }
1307
+ static schemaRules(e) {
1308
+ let t = [];
1309
+ function n(e) {
1310
+ let n = e.priority == null ? 50 : e.priority, r = 0;
1311
+ for (; r < t.length; r++) {
1312
+ let e = t[r];
1313
+ if ((e.priority == null ? 50 : e.priority) < n) break;
1314
+ }
1315
+ t.splice(r, 0, e);
1316
+ }
1317
+ for (let t in e.marks) {
1318
+ let r = e.marks[t].spec.parseDOM;
1319
+ r && r.forEach((e) => {
1320
+ n(e = J(e)), e.mark || e.ignore || e.clearMark || (e.mark = t);
1321
+ });
1322
+ }
1323
+ for (let t in e.nodes) {
1324
+ let r = e.nodes[t].spec.parseDOM;
1325
+ r && r.forEach((e) => {
1326
+ n(e = J(e)), e.node || e.ignore || e.mark || (e.node = t);
1327
+ });
1328
+ }
1329
+ return t;
1330
+ }
1331
+ static fromSchema(t) {
1332
+ return t.cached.domParser || (t.cached.domParser = new e(t, e.schemaRules(t)));
1333
+ }
1334
+ }, B = {
1335
+ address: !0,
1336
+ article: !0,
1337
+ aside: !0,
1338
+ blockquote: !0,
1339
+ body: !0,
1340
+ canvas: !0,
1341
+ dd: !0,
1342
+ div: !0,
1343
+ dl: !0,
1344
+ fieldset: !0,
1345
+ figcaption: !0,
1346
+ figure: !0,
1347
+ footer: !0,
1348
+ form: !0,
1349
+ h1: !0,
1350
+ h2: !0,
1351
+ h3: !0,
1352
+ h4: !0,
1353
+ h5: !0,
1354
+ h6: !0,
1355
+ header: !0,
1356
+ hgroup: !0,
1357
+ hr: !0,
1358
+ li: !0,
1359
+ noscript: !0,
1360
+ ol: !0,
1361
+ output: !0,
1362
+ p: !0,
1363
+ pre: !0,
1364
+ section: !0,
1365
+ table: !0,
1366
+ tfoot: !0,
1367
+ ul: !0
1368
+ }, be = {
1369
+ head: !0,
1370
+ noscript: !0,
1371
+ object: !0,
1372
+ script: !0,
1373
+ style: !0,
1374
+ title: !0
1375
+ }, V = {
1376
+ ol: !0,
1377
+ ul: !0
1378
+ }, H = 1, U = 2, W = 4;
1379
+ function G(e, t, n) {
1380
+ return t == null ? e && e.whitespace == "pre" ? 3 : n & -5 : (t ? H : 0) | (t === "full" ? U : 0);
1381
+ }
1382
+ var K = class {
1383
+ constructor(e, t, n, r, i, a) {
1384
+ this.type = e, this.attrs = t, this.marks = n, this.solid = r, this.options = a, this.content = [], this.activeMarks = l.none, this.match = i || (a & W ? null : e.contentMatch);
1385
+ }
1386
+ findWrapping(e) {
1387
+ if (!this.match) {
1388
+ if (!this.type) return [];
1389
+ let t = this.type.contentMatch.fillBefore(a.from(e));
1390
+ if (t) this.match = this.type.contentMatch.matchFragment(t);
1391
+ else {
1392
+ let t = this.type.contentMatch, n;
1393
+ return (n = t.findWrapping(e.type)) ? (this.match = t, n) : null;
1394
+ }
1395
+ }
1396
+ return this.match.findWrapping(e.type);
1397
+ }
1398
+ finish(e) {
1399
+ if (!(this.options & H)) {
1400
+ let e = this.content[this.content.length - 1], t;
1401
+ if (e && e.isText && (t = /[ \t\r\n\u000c]+$/.exec(e.text))) {
1402
+ let n = e;
1403
+ e.text.length == t[0].length ? this.content.pop() : this.content[this.content.length - 1] = n.withText(n.text.slice(0, n.text.length - t[0].length));
1404
+ }
1405
+ }
1406
+ let t = a.from(this.content);
1407
+ return !e && this.match && (t = t.append(this.match.fillBefore(a.empty, !0))), this.type ? this.type.create(this.attrs, t, this.marks) : t;
1408
+ }
1409
+ inlineContext(e) {
1410
+ return this.type ? this.type.inlineContent : this.content.length ? this.content[0].isInline : e.parentNode && !B.hasOwnProperty(e.parentNode.nodeName.toLowerCase());
1411
+ }
1412
+ }, q = class {
1413
+ constructor(e, t, n) {
1414
+ this.parser = e, this.options = t, this.isOpen = n, this.open = 0, this.localPreserveWS = !1;
1415
+ let r = t.topNode, i, a = G(null, t.preserveWhitespace, 0) | (n ? W : 0);
1416
+ i = r ? new K(r.type, r.attrs, l.none, !0, t.topMatch || r.type.contentMatch, a) : n ? new K(null, null, l.none, !0, null, a) : new K(e.schema.topNodeType, null, l.none, !0, null, a), this.nodes = [i], this.find = t.findPositions, this.needsBlock = !1;
1417
+ }
1418
+ get top() {
1419
+ return this.nodes[this.open];
1420
+ }
1421
+ addDOM(e, t) {
1422
+ e.nodeType == 3 ? this.addTextNode(e, t) : e.nodeType == 1 && this.addElement(e, t);
1423
+ }
1424
+ addTextNode(e, t) {
1425
+ let n = e.nodeValue, r = this.top, i = r.options & U ? "full" : this.localPreserveWS || (r.options & H) > 0, { schema: a } = this.parser;
1426
+ if (i === "full" || r.inlineContext(e) || /[^ \t\r\n\u000c]/.test(n)) {
1427
+ if (!i) {
1428
+ if (n = n.replace(/[ \t\r\n\u000c]+/g, " "), /^[ \t\r\n\u000c]/.test(n) && this.open == this.nodes.length - 1) {
1429
+ let t = r.content[r.content.length - 1], i = e.previousSibling;
1430
+ (!t || i && i.nodeName == "BR" || t.isText && /[ \t\r\n\u000c]$/.test(t.text)) && (n = n.slice(1));
1431
+ }
1432
+ } else if (i === "full") n = n.replace(/\r\n?/g, "\n");
1433
+ else if (a.linebreakReplacement && /[\r\n]/.test(n) && this.top.findWrapping(a.linebreakReplacement.create())) {
1434
+ let e = n.split(/\r?\n|\r/);
1435
+ for (let n = 0; n < e.length; n++) n && this.insertNode(a.linebreakReplacement.create(), t, !0), e[n] && this.insertNode(a.text(e[n]), t, !/\S/.test(e[n]));
1436
+ n = "";
1437
+ } else n = n.replace(/\r?\n|\r/g, " ");
1438
+ n && this.insertNode(a.text(n), t, !/\S/.test(n)), this.findInText(e);
1439
+ } else this.findInside(e);
1440
+ }
1441
+ addElement(e, t, n) {
1442
+ let r = this.localPreserveWS, i = this.top;
1443
+ (e.tagName == "PRE" || /pre/.test(e.style && e.style.whiteSpace)) && (this.localPreserveWS = !0);
1444
+ let a = e.nodeName.toLowerCase(), o;
1445
+ V.hasOwnProperty(a) && this.parser.normalizeLists && xe(e);
1446
+ let s = this.options.ruleFromNode && this.options.ruleFromNode(e) || (o = this.parser.matchTag(e, this, n));
1447
+ out: if (s ? s.ignore : be.hasOwnProperty(a)) this.findInside(e), this.ignoreFallback(e, t);
1448
+ else if (!s || s.skip || s.closeParent) {
1449
+ s && s.closeParent ? this.open = Math.max(0, this.open - 1) : s && s.skip.nodeType && (e = s.skip);
1450
+ let n, r = this.needsBlock;
1451
+ if (B.hasOwnProperty(a)) i.content.length && i.content[0].isInline && this.open && (this.open--, i = this.top), n = !0, i.type || (this.needsBlock = !0);
1452
+ else if (!e.firstChild) {
1453
+ this.leafFallback(e, t);
1454
+ break out;
1455
+ }
1456
+ let o = s && s.skip ? t : this.readStyles(e, t);
1457
+ o && this.addAll(e, o), n && this.sync(i), this.needsBlock = r;
1458
+ } else {
1459
+ let n = this.readStyles(e, t);
1460
+ n && this.addElementByRule(e, s, n, s.consuming === !1 ? o : void 0);
1461
+ }
1462
+ this.localPreserveWS = r;
1463
+ }
1464
+ leafFallback(e, t) {
1465
+ e.nodeName == "BR" && this.top.type && this.top.type.inlineContent && this.addTextNode(e.ownerDocument.createTextNode("\n"), t);
1466
+ }
1467
+ ignoreFallback(e, t) {
1468
+ e.nodeName == "BR" && (!this.top.type || !this.top.type.inlineContent) && this.findPlace(this.parser.schema.text("-"), t, !0);
1469
+ }
1470
+ readStyles(e, t) {
1471
+ let n = e.style;
1472
+ if (n && n.length) for (let e = 0; e < this.parser.matchedStyles.length; e++) {
1473
+ let r = this.parser.matchedStyles[e], i = n.getPropertyValue(r);
1474
+ if (i) for (let e;;) {
1475
+ let n = this.parser.matchStyle(r, i, this, e);
1476
+ if (!n) break;
1477
+ if (n.ignore) return null;
1478
+ if (t = n.clearMark ? t.filter((e) => !n.clearMark(e)) : t.concat(this.parser.schema.marks[n.mark].create(n.attrs)), n.consuming === !1) e = n;
1479
+ else break;
1480
+ }
1481
+ }
1482
+ return t;
1483
+ }
1484
+ addElementByRule(e, t, n, r) {
1485
+ let i, a;
1486
+ if (t.node) {
1487
+ if (a = this.parser.schema.nodes[t.node], a.isLeaf) this.insertNode(a.create(t.attrs), n, e.nodeName == "BR") || this.leafFallback(e, n);
1488
+ else {
1489
+ let e = this.enter(a, t.attrs || null, n, t.preserveWhitespace);
1490
+ e && (i = !0, n = e);
1491
+ }
1492
+ } else {
1493
+ let e = this.parser.schema.marks[t.mark];
1494
+ n = n.concat(e.create(t.attrs));
1495
+ }
1496
+ let o = this.top;
1497
+ if (a && a.isLeaf) this.findInside(e);
1498
+ else if (r) this.addElement(e, n, r);
1499
+ else if (t.getContent) this.findInside(e), t.getContent(e, this.parser.schema).forEach((e) => this.insertNode(e, n, !1));
1500
+ else {
1501
+ let r = e;
1502
+ typeof t.contentElement == "string" ? r = e.querySelector(t.contentElement) : typeof t.contentElement == "function" ? r = t.contentElement(e) : t.contentElement && (r = t.contentElement), this.findAround(e, r, !0), this.addAll(r, n), this.findAround(e, r, !1);
1503
+ }
1504
+ i && this.sync(o) && this.open--;
1505
+ }
1506
+ addAll(e, t, n, r) {
1507
+ let i = n || 0;
1508
+ for (let a = n ? e.childNodes[n] : e.firstChild, o = r == null ? null : e.childNodes[r]; a != o; a = a.nextSibling, ++i) this.findAtPoint(e, i), this.addDOM(a, t);
1509
+ this.findAtPoint(e, i);
1510
+ }
1511
+ findPlace(e, t, n) {
1512
+ let r, i;
1513
+ for (let t = this.open, a = 0; t >= 0; t--) {
1514
+ let o = this.nodes[t], s = o.findWrapping(e);
1515
+ if (s && (!r || r.length > s.length + a) && (r = s, i = o, !s.length)) break;
1516
+ if (o.solid) {
1517
+ if (n) break;
1518
+ a += 2;
1519
+ }
1520
+ }
1521
+ if (!r) return null;
1522
+ this.sync(i);
1523
+ for (let e = 0; e < r.length; e++) t = this.enterInner(r[e], null, t, !1);
1524
+ return t;
1525
+ }
1526
+ insertNode(e, t, n) {
1527
+ if (e.isInline && this.needsBlock && !this.top.type) {
1528
+ let e = this.textblockFromContext();
1529
+ e && (t = this.enterInner(e, null, t));
1530
+ }
1531
+ let r = this.findPlace(e, t, n);
1532
+ if (r) {
1533
+ this.closeExtra();
1534
+ let t = this.top;
1535
+ t.match &&= t.match.matchType(e.type);
1536
+ let n = l.none;
1537
+ for (let i of r.concat(e.marks)) (t.type ? t.type.allowsMarkType(i.type) : Y(i.type, e.type)) && (n = i.addToSet(n));
1538
+ return t.content.push(e.mark(n)), !0;
1539
+ }
1540
+ return !1;
1541
+ }
1542
+ enter(e, t, n, r) {
1543
+ let i = this.findPlace(e.create(t), n, !1);
1544
+ return i &&= this.enterInner(e, t, n, !0, r), i;
1545
+ }
1546
+ enterInner(e, t, n, r = !1, i) {
1547
+ this.closeExtra();
1548
+ let a = this.top;
1549
+ a.match = a.match && a.match.matchType(e);
1550
+ let o = G(e, i, a.options);
1551
+ a.options & W && a.content.length == 0 && (o |= W);
1552
+ let s = l.none;
1553
+ return n = n.filter((t) => !(a.type ? a.type.allowsMarkType(t.type) : Y(t.type, e)) || (s = t.addToSet(s), !1)), this.nodes.push(new K(e, t, s, r, null, o)), this.open++, n;
1554
+ }
1555
+ closeExtra(e = !1) {
1556
+ let t = this.nodes.length - 1;
1557
+ if (t > this.open) {
1558
+ for (; t > this.open; t--) this.nodes[t - 1].content.push(this.nodes[t].finish(e));
1559
+ this.nodes.length = this.open + 1;
1560
+ }
1561
+ }
1562
+ finish() {
1563
+ return this.open = 0, this.closeExtra(this.isOpen), this.nodes[0].finish(!!(this.isOpen || this.options.topOpen));
1564
+ }
1565
+ sync(e) {
1566
+ for (let t = this.open; t >= 0; t--) if (this.nodes[t] == e) return this.open = t, !0;
1567
+ else this.localPreserveWS && (this.nodes[t].options |= H);
1568
+ return !1;
1569
+ }
1570
+ get currentPos() {
1571
+ this.closeExtra();
1572
+ let e = 0;
1573
+ for (let t = this.open; t >= 0; t--) {
1574
+ let n = this.nodes[t].content;
1575
+ for (let t = n.length - 1; t >= 0; t--) e += n[t].nodeSize;
1576
+ t && e++;
1577
+ }
1578
+ return e;
1579
+ }
1580
+ findAtPoint(e, t) {
1581
+ if (this.find) for (let n = 0; n < this.find.length; n++) this.find[n].node == e && this.find[n].offset == t && (this.find[n].pos = this.currentPos);
1582
+ }
1583
+ findInside(e) {
1584
+ if (this.find) for (let t = 0; t < this.find.length; t++) this.find[t].pos == null && e.nodeType == 1 && e.contains(this.find[t].node) && (this.find[t].pos = this.currentPos);
1585
+ }
1586
+ findAround(e, t, n) {
1587
+ if (e != t && this.find) for (let r = 0; r < this.find.length; r++) this.find[r].pos == null && e.nodeType == 1 && e.contains(this.find[r].node) && t.compareDocumentPosition(this.find[r].node) & (n ? 2 : 4) && (this.find[r].pos = this.currentPos);
1588
+ }
1589
+ findInText(e) {
1590
+ if (this.find) for (let t = 0; t < this.find.length; t++) this.find[t].node == e && (this.find[t].pos = this.currentPos - (e.nodeValue.length - this.find[t].offset));
1591
+ }
1592
+ matchesContext(e) {
1593
+ if (e.indexOf("|") > -1) return e.split(/\s*\|\s*/).some(this.matchesContext, this);
1594
+ let t = e.split("/"), n = this.options.context, r = !this.isOpen && (!n || n.parent.type == this.nodes[0].type), i = -(n ? n.depth + 1 : 0) + +!r, a = (e, o) => {
1595
+ for (; e >= 0; e--) {
1596
+ let s = t[e];
1597
+ if (s == "") {
1598
+ if (e == t.length - 1 || e == 0) continue;
1599
+ for (; o >= i; o--) if (a(e - 1, o)) return !0;
1600
+ return !1;
1601
+ }
1602
+ {
1603
+ let e = o > 0 || o == 0 && r ? this.nodes[o].type : n && o >= i ? n.node(o - i).type : null;
1604
+ if (!e || e.name != s && !e.isInGroup(s)) return !1;
1605
+ o--;
1606
+ }
1607
+ }
1608
+ return !0;
1609
+ };
1610
+ return a(t.length - 1, this.open);
1611
+ }
1612
+ textblockFromContext() {
1613
+ let e = this.options.context;
1614
+ if (e) for (let t = e.depth; t >= 0; t--) {
1615
+ let n = e.node(t).contentMatchAt(e.indexAfter(t)).defaultType;
1616
+ if (n && n.isTextblock && n.defaultAttrs) return n;
1617
+ }
1618
+ for (let e in this.parser.schema.nodes) {
1619
+ let t = this.parser.schema.nodes[e];
1620
+ if (t.isTextblock && t.defaultAttrs) return t;
1621
+ }
1622
+ }
1623
+ };
1624
+ function xe(e) {
1625
+ for (let t = e.firstChild, n = null; t; t = t.nextSibling) {
1626
+ let e = t.nodeType == 1 ? t.nodeName.toLowerCase() : null;
1627
+ e && V.hasOwnProperty(e) && n ? (n.appendChild(t), t = n) : e == "li" ? n = t : e && (n = null);
1628
+ }
1629
+ }
1630
+ function Se(e, t) {
1631
+ return (e.matches || e.msMatchesSelector || e.webkitMatchesSelector || e.mozMatchesSelector).call(e, t);
1632
+ }
1633
+ function J(e) {
1634
+ let t = {};
1635
+ for (let n in e) t[n] = e[n];
1636
+ return t;
1637
+ }
1638
+ function Y(e, t) {
1639
+ let n = t.schema.nodes;
1640
+ for (let r in n) {
1641
+ let i = n[r];
1642
+ if (!i.allowsMarkType(e)) continue;
1643
+ let a = [], o = (e) => {
1644
+ a.push(e);
1645
+ for (let n = 0; n < e.edgeCount; n++) {
1646
+ let { type: r, next: i } = e.edge(n);
1647
+ if (r == t || a.indexOf(i) < 0 && o(i)) return !0;
1648
+ }
1649
+ };
1650
+ if (o(i.contentMatch)) return !0;
1651
+ }
1652
+ }
1653
+ var Ce = class e {
1654
+ constructor(e, t) {
1655
+ this.nodes = e, this.marks = t;
1656
+ }
1657
+ serializeFragment(e, t = {}, n) {
1658
+ n ||= Z(t).createDocumentFragment();
1659
+ let r = n, i = [];
1660
+ return e.forEach((e) => {
1661
+ if (i.length || e.marks.length) {
1662
+ let n = 0, a = 0;
1663
+ for (; n < i.length && a < e.marks.length;) {
1664
+ let t = e.marks[a];
1665
+ if (!this.marks[t.type.name]) {
1666
+ a++;
1667
+ continue;
1668
+ }
1669
+ if (!t.eq(i[n][0]) || t.type.spec.spanning === !1) break;
1670
+ n++, a++;
1671
+ }
1672
+ for (; n < i.length;) r = i.pop()[1];
1673
+ for (; a < e.marks.length;) {
1674
+ let n = e.marks[a++], o = this.serializeMark(n, e.isInline, t);
1675
+ o && (i.push([n, r]), r.appendChild(o.dom), r = o.contentDOM || o.dom);
1676
+ }
1677
+ }
1678
+ r.appendChild(this.serializeNodeInner(e, t));
1679
+ }), n;
1680
+ }
1681
+ serializeNodeInner(e, t) {
1682
+ if (e.isText) return Z(t).createTextNode(e.text);
1683
+ let { dom: n, contentDOM: r } = $(Z(t), this.nodes[e.type.name](e), null, e.attrs);
1684
+ if (r) {
1685
+ if (e.isLeaf) throw RangeError("Content hole not allowed in a leaf node spec");
1686
+ this.serializeFragment(e.content, t, r);
1687
+ }
1688
+ return n;
1689
+ }
1690
+ serializeNode(e, t = {}) {
1691
+ let n = this.serializeNodeInner(e, t);
1692
+ for (let r = e.marks.length - 1; r >= 0; r--) {
1693
+ let i = this.serializeMark(e.marks[r], e.isInline, t);
1694
+ i && ((i.contentDOM || i.dom).appendChild(n), n = i.dom);
1695
+ }
1696
+ return n;
1697
+ }
1698
+ serializeMark(e, t, n = {}) {
1699
+ let r = this.marks[e.type.name];
1700
+ return r && $(Z(n), r(e, t), null, e.attrs);
1701
+ }
1702
+ static renderSpec(e, t, n = null, r) {
1703
+ return typeof t == "string" ? { dom: e.createTextNode(t) } : $(e, t, n, r);
1704
+ }
1705
+ static fromSchema(t) {
1706
+ return t.cached.domSerializer || (t.cached.domSerializer = new e(this.nodesFromSchema(t), this.marksFromSchema(t)));
1707
+ }
1708
+ static nodesFromSchema(e) {
1709
+ let t = X(e.nodes);
1710
+ return t.text ||= (e) => e.text, t;
1711
+ }
1712
+ static marksFromSchema(e) {
1713
+ return X(e.marks);
1714
+ }
1715
+ };
1716
+ function X(e) {
1717
+ let t = {};
1718
+ for (let n in e) {
1719
+ let r = e[n].spec.toDOM;
1720
+ r && (t[n] = r);
1721
+ }
1722
+ return t;
1723
+ }
1724
+ function Z(e) {
1725
+ return e.document || window.document;
1726
+ }
1727
+ var Q = /* @__PURE__ */ new WeakMap();
1728
+ function we(e) {
1729
+ let t = Q.get(e);
1730
+ return t === void 0 && Q.set(e, t = Te(e)), t;
1731
+ }
1732
+ function Te(e) {
1733
+ let t = null;
1734
+ function n(e) {
1735
+ if (e && typeof e == "object") {
1736
+ if (Array.isArray(e)) {
1737
+ if (typeof e[0] == "string") t ||= [], t.push(e);
1738
+ else for (let t = 0; t < e.length; t++) n(e[t]);
1739
+ } else for (let t in e) n(e[t]);
1740
+ }
1741
+ }
1742
+ return n(e), t;
1743
+ }
1744
+ function $(e, t, n, r) {
1745
+ if (t.nodeType == 1) return { dom: t };
1746
+ if (t.dom && t.dom.nodeType == 1) return t;
1747
+ let i = t[0], a;
1748
+ if (typeof i != "string") throw RangeError("Invalid array passed to renderSpec");
1749
+ if (r && (a = we(r)) && a.indexOf(t) > -1) throw RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");
1750
+ let o = i.indexOf(" ");
1751
+ o > 0 && (n = i.slice(0, o), i = i.slice(o + 1));
1752
+ let s, c = n ? e.createElementNS(n, i) : e.createElement(i), l = t[1], u = 1;
1753
+ if (l && typeof l == "object" && l.nodeType == null && !Array.isArray(l)) {
1754
+ u = 2;
1755
+ for (let e in l) if (l[e] != null) {
1756
+ let t = e.indexOf(" ");
1757
+ t > 0 ? c.setAttributeNS(e.slice(0, t), e.slice(t + 1), l[e]) : e == "style" && c.style ? c.style.cssText = l[e] : c.setAttribute(e, l[e]);
1758
+ }
1759
+ }
1760
+ for (let i = u; i < t.length; i++) {
1761
+ let a = t[i];
1762
+ if (a === 0) {
1763
+ if (i < t.length - 1 || i > u) throw RangeError("Content hole must be the only child of its parent node");
1764
+ return {
1765
+ dom: c,
1766
+ contentDOM: c
1767
+ };
1768
+ }
1769
+ if (typeof a == "string") c.appendChild(e.createTextNode(a));
1770
+ else {
1771
+ let { dom: t, contentDOM: i } = $(e, a, n, r);
1772
+ if (c.appendChild(t), i) {
1773
+ if (s) throw RangeError("Multiple content holes");
1774
+ s = i;
1775
+ }
1776
+ }
1777
+ }
1778
+ return {
1779
+ dom: c,
1780
+ contentDOM: s
1781
+ };
1782
+ }
1783
+ //#endregion
1784
+ export { D as ContentMatch, ye as DOMParser, Ce as DOMSerializer, a as Fragment, l as Mark, R as MarkType, T as Node, w as NodeRange, I as NodeType, u as ReplaceError, S as ResolvedPos, ge as Schema, d as Slice };
1785
+
1786
+ //# sourceMappingURL=index.js.map