@burdenoff/microfe-support 2026.1115.1 → 2026.1118.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (90) hide show
  1. package/dist/support/components/careers/RichTextEditor.js +31 -31
  2. package/dist/support/components/careers/RichTextEditor.js.map +1 -1
  3. package/package.json +1 -1
  4. package/dist/_virtual/_rolldown/runtime.js +0 -6
  5. package/dist/node_modules/@tiptap/core/dist/index.js +0 -3491
  6. package/dist/node_modules/@tiptap/core/dist/index.js.map +0 -1
  7. package/dist/node_modules/@tiptap/core/dist/jsx-runtime/jsx-runtime.js +0 -44
  8. package/dist/node_modules/@tiptap/core/dist/jsx-runtime/jsx-runtime.js.map +0 -1
  9. package/dist/node_modules/@tiptap/core/dist/rolldown-runtime-D7D4PA-g.js +0 -12
  10. package/dist/node_modules/@tiptap/core/dist/rolldown-runtime-D7D4PA-g.js.map +0 -1
  11. package/dist/node_modules/@tiptap/extension-blockquote/dist/index.js +0 -75
  12. package/dist/node_modules/@tiptap/extension-blockquote/dist/index.js.map +0 -1
  13. package/dist/node_modules/@tiptap/extension-bold/dist/index.js +0 -73
  14. package/dist/node_modules/@tiptap/extension-bold/dist/index.js.map +0 -1
  15. package/dist/node_modules/@tiptap/extension-code/dist/index.js +0 -78
  16. package/dist/node_modules/@tiptap/extension-code/dist/index.js.map +0 -1
  17. package/dist/node_modules/@tiptap/extension-code-block/dist/index.js +0 -157
  18. package/dist/node_modules/@tiptap/extension-code-block/dist/index.js.map +0 -1
  19. package/dist/node_modules/@tiptap/extension-document/dist/index.js +0 -11
  20. package/dist/node_modules/@tiptap/extension-document/dist/index.js.map +0 -1
  21. package/dist/node_modules/@tiptap/extension-hard-break/dist/index.js +0 -50
  22. package/dist/node_modules/@tiptap/extension-hard-break/dist/index.js.map +0 -1
  23. package/dist/node_modules/@tiptap/extension-heading/dist/index.js +0 -70
  24. package/dist/node_modules/@tiptap/extension-heading/dist/index.js.map +0 -1
  25. package/dist/node_modules/@tiptap/extension-horizontal-rule/dist/index.js +0 -49
  26. package/dist/node_modules/@tiptap/extension-horizontal-rule/dist/index.js.map +0 -1
  27. package/dist/node_modules/@tiptap/extension-italic/dist/index.js +0 -70
  28. package/dist/node_modules/@tiptap/extension-italic/dist/index.js.map +0 -1
  29. package/dist/node_modules/@tiptap/extension-link/dist/index.js +0 -389
  30. package/dist/node_modules/@tiptap/extension-link/dist/index.js.map +0 -1
  31. package/dist/node_modules/@tiptap/extension-list/dist/index.js +0 -967
  32. package/dist/node_modules/@tiptap/extension-list/dist/index.js.map +0 -1
  33. package/dist/node_modules/@tiptap/extension-paragraph/dist/index.js +0 -46
  34. package/dist/node_modules/@tiptap/extension-paragraph/dist/index.js.map +0 -1
  35. package/dist/node_modules/@tiptap/extension-placeholder/dist/index.js +0 -6
  36. package/dist/node_modules/@tiptap/extension-placeholder/dist/index.js.map +0 -1
  37. package/dist/node_modules/@tiptap/extension-strike/dist/index.js +0 -55
  38. package/dist/node_modules/@tiptap/extension-strike/dist/index.js.map +0 -1
  39. package/dist/node_modules/@tiptap/extension-text/dist/index.js +0 -14
  40. package/dist/node_modules/@tiptap/extension-text/dist/index.js.map +0 -1
  41. package/dist/node_modules/@tiptap/extension-underline/dist/index.js +0 -72
  42. package/dist/node_modules/@tiptap/extension-underline/dist/index.js.map +0 -1
  43. package/dist/node_modules/@tiptap/extensions/dist/index.js +0 -457
  44. package/dist/node_modules/@tiptap/extensions/dist/index.js.map +0 -1
  45. package/dist/node_modules/@tiptap/react/dist/index.js +0 -332
  46. package/dist/node_modules/@tiptap/react/dist/index.js.map +0 -1
  47. package/dist/node_modules/@tiptap/starter-kit/dist/index.js +0 -28
  48. package/dist/node_modules/@tiptap/starter-kit/dist/index.js.map +0 -1
  49. package/dist/node_modules/fast-equals/dist/es/index.js +0 -298
  50. package/dist/node_modules/fast-equals/dist/es/index.js.map +0 -1
  51. package/dist/node_modules/linkifyjs/dist/linkify.js +0 -527
  52. package/dist/node_modules/linkifyjs/dist/linkify.js.map +0 -1
  53. package/dist/node_modules/orderedmap/dist/index.js +0 -68
  54. package/dist/node_modules/orderedmap/dist/index.js.map +0 -1
  55. package/dist/node_modules/prosemirror-commands/dist/index.js +0 -334
  56. package/dist/node_modules/prosemirror-commands/dist/index.js.map +0 -1
  57. package/dist/node_modules/prosemirror-dropcursor/dist/index.js +0 -112
  58. package/dist/node_modules/prosemirror-dropcursor/dist/index.js.map +0 -1
  59. package/dist/node_modules/prosemirror-gapcursor/dist/index.js +0 -168
  60. package/dist/node_modules/prosemirror-gapcursor/dist/index.js.map +0 -1
  61. package/dist/node_modules/prosemirror-history/dist/index.js +0 -219
  62. package/dist/node_modules/prosemirror-history/dist/index.js.map +0 -1
  63. package/dist/node_modules/prosemirror-keymap/dist/index.js +0 -51
  64. package/dist/node_modules/prosemirror-keymap/dist/index.js.map +0 -1
  65. package/dist/node_modules/prosemirror-model/dist/index.js +0 -1775
  66. package/dist/node_modules/prosemirror-model/dist/index.js.map +0 -1
  67. package/dist/node_modules/prosemirror-schema-list/dist/index.js +0 -77
  68. package/dist/node_modules/prosemirror-schema-list/dist/index.js.map +0 -1
  69. package/dist/node_modules/prosemirror-state/dist/index.js +0 -526
  70. package/dist/node_modules/prosemirror-state/dist/index.js.map +0 -1
  71. package/dist/node_modules/prosemirror-transform/dist/index.js +0 -1204
  72. package/dist/node_modules/prosemirror-transform/dist/index.js.map +0 -1
  73. package/dist/node_modules/prosemirror-view/dist/index.js +0 -3355
  74. package/dist/node_modules/prosemirror-view/dist/index.js.map +0 -1
  75. package/dist/node_modules/rope-sequence/dist/index.js +0 -84
  76. package/dist/node_modules/rope-sequence/dist/index.js.map +0 -1
  77. package/dist/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js +0 -55
  78. package/dist/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js.map +0 -1
  79. package/dist/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.production.js +0 -53
  80. package/dist/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.production.js.map +0 -1
  81. package/dist/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js +0 -53
  82. package/dist/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js.map +0 -1
  83. package/dist/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.js +0 -45
  84. package/dist/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.js.map +0 -1
  85. package/dist/node_modules/use-sync-external-store/shim/index.js +0 -11
  86. package/dist/node_modules/use-sync-external-store/shim/index.js.map +0 -1
  87. package/dist/node_modules/use-sync-external-store/shim/with-selector.js +0 -11
  88. package/dist/node_modules/use-sync-external-store/shim/with-selector.js.map +0 -1
  89. package/dist/node_modules/w3c-keyname/index.js +0 -89
  90. package/dist/node_modules/w3c-keyname/index.js.map +0 -1
@@ -1,1204 +0,0 @@
1
- import { Fragment as e, Mark as t, MarkType as n, ReplaceError as r, Slice as i } from "../../prosemirror-model/dist/index.js";
2
- // node_modules/prosemirror-transform/dist/index.js
3
- var a = 65535, o = 2 ** 16;
4
- function s(e, t) {
5
- return e + t * o;
6
- }
7
- function c(e) {
8
- return e & a;
9
- }
10
- function l(e) {
11
- return (e - (e & a)) / o;
12
- }
13
- var u = 1, d = 2, f = 4, p = 8, m = class {
14
- constructor(e, t, n) {
15
- this.pos = e, this.delInfo = t, this.recover = n;
16
- }
17
- get deleted() {
18
- return (this.delInfo & p) > 0;
19
- }
20
- get deletedBefore() {
21
- return (this.delInfo & 5) > 0;
22
- }
23
- get deletedAfter() {
24
- return (this.delInfo & 6) > 0;
25
- }
26
- get deletedAcross() {
27
- return (this.delInfo & f) > 0;
28
- }
29
- }, h = class e {
30
- constructor(t, n = !1) {
31
- if (this.ranges = t, this.inverted = n, !t.length && e.empty) return e.empty;
32
- }
33
- recover(e) {
34
- let t = 0, n = c(e);
35
- if (!this.inverted) for (let e = 0; e < n; e++) t += this.ranges[e * 3 + 2] - this.ranges[e * 3 + 1];
36
- return this.ranges[n * 3] + t + l(e);
37
- }
38
- mapResult(e, t = 1) {
39
- return this._map(e, t, !1);
40
- }
41
- map(e, t = 1) {
42
- return this._map(e, t, !0);
43
- }
44
- _map(e, t, n) {
45
- let r = 0, i = this.inverted ? 2 : 1, a = this.inverted ? 1 : 2;
46
- for (let o = 0; o < this.ranges.length; o += 3) {
47
- let c = this.ranges[o] - (this.inverted ? r : 0);
48
- if (c > e) break;
49
- let l = this.ranges[o + i], h = this.ranges[o + a], g = c + l;
50
- if (e <= g) {
51
- let i = l ? e == c ? -1 : e == g ? 1 : t : t, a = c + r + (i < 0 ? 0 : h);
52
- if (n) return a;
53
- let _ = e == (t < 0 ? c : g) ? null : s(o / 3, e - c), v = 0;
54
- return l && (v |= e == c ? d : e == g ? u : f, (t < 0 ? e != c : e != g) && (v |= p)), new m(a, v, _);
55
- }
56
- r += h - l;
57
- }
58
- return n ? e + r : new m(e + r, 0, null);
59
- }
60
- touches(e, t) {
61
- let n = 0, r = c(t), i = this.inverted ? 2 : 1, a = this.inverted ? 1 : 2;
62
- for (let t = 0; t < this.ranges.length; t += 3) {
63
- let o = this.ranges[t] - (this.inverted ? n : 0);
64
- if (o > e) break;
65
- let s = this.ranges[t + i];
66
- if (e <= o + s && t == r * 3) return !0;
67
- n += this.ranges[t + a] - s;
68
- }
69
- return !1;
70
- }
71
- forEach(e) {
72
- let t = this.inverted ? 2 : 1, n = this.inverted ? 1 : 2;
73
- for (let r = 0, i = 0; r < this.ranges.length; r += 3) {
74
- let a = this.ranges[r], o = a - (this.inverted ? i : 0), s = a + (this.inverted ? 0 : i), c = this.ranges[r + t], l = this.ranges[r + n];
75
- e(o, o + c, s, s + l), i += l - c;
76
- }
77
- }
78
- invert() {
79
- return new e(this.ranges, !this.inverted);
80
- }
81
- toString() {
82
- return (this.inverted ? "-" : "") + JSON.stringify(this.ranges);
83
- }
84
- static offset(t) {
85
- return t == 0 ? e.empty : new e(t < 0 ? [
86
- 0,
87
- -t,
88
- 0
89
- ] : [
90
- 0,
91
- 0,
92
- t
93
- ]);
94
- }
95
- };
96
- h.empty = new h([]);
97
- var g = class e {
98
- constructor(e, t, n = 0, r = e ? e.length : 0) {
99
- this.mirror = t, this.from = n, this.to = r, this._maps = e || [], this.ownData = !(e || t);
100
- }
101
- get maps() {
102
- return this._maps;
103
- }
104
- slice(t = 0, n = this.maps.length) {
105
- return new e(this._maps, this.mirror, t, n);
106
- }
107
- appendMap(e, t) {
108
- this.ownData ||= (this._maps = this._maps.slice(), this.mirror = this.mirror && this.mirror.slice(), !0), this.to = this._maps.push(e), t != null && this.setMirror(this._maps.length - 1, t);
109
- }
110
- appendMapping(e) {
111
- for (let t = 0, n = this._maps.length; t < e._maps.length; t++) {
112
- let r = e.getMirror(t);
113
- this.appendMap(e._maps[t], r != null && r < t ? n + r : void 0);
114
- }
115
- }
116
- getMirror(e) {
117
- if (this.mirror) {
118
- for (let t = 0; t < this.mirror.length; t++) if (this.mirror[t] == e) return this.mirror[t + (t % 2 ? -1 : 1)];
119
- }
120
- }
121
- setMirror(e, t) {
122
- this.mirror ||= [], this.mirror.push(e, t);
123
- }
124
- appendMappingInverted(e) {
125
- for (let t = e.maps.length - 1, n = this._maps.length + e._maps.length; t >= 0; t--) {
126
- let r = e.getMirror(t);
127
- this.appendMap(e._maps[t].invert(), r != null && r > t ? n - r - 1 : void 0);
128
- }
129
- }
130
- invert() {
131
- let t = new e();
132
- return t.appendMappingInverted(this), t;
133
- }
134
- map(e, t = 1) {
135
- if (this.mirror) return this._map(e, t, !0);
136
- for (let n = this.from; n < this.to; n++) e = this._maps[n].map(e, t);
137
- return e;
138
- }
139
- mapResult(e, t = 1) {
140
- return this._map(e, t, !1);
141
- }
142
- _map(e, t, n) {
143
- let r = 0;
144
- for (let n = this.from; n < this.to; n++) {
145
- let i = this._maps[n].mapResult(e, t);
146
- if (i.recover != null) {
147
- let t = this.getMirror(n);
148
- if (t != null && t > n && t < this.to) {
149
- n = t, e = this._maps[t].recover(i.recover);
150
- continue;
151
- }
152
- }
153
- r |= i.delInfo, e = i.pos;
154
- }
155
- return n ? e : new m(e, r, null);
156
- }
157
- }, _ = Object.create(null), v = class {
158
- getMap() {
159
- return h.empty;
160
- }
161
- merge(e) {
162
- return null;
163
- }
164
- static fromJSON(e, t) {
165
- if (!t || !t.stepType) throw RangeError("Invalid input for Step.fromJSON");
166
- let n = _[t.stepType];
167
- if (!n) throw RangeError(`No step type ${t.stepType} defined`);
168
- return n.fromJSON(e, t);
169
- }
170
- static jsonID(e, t) {
171
- if (e in _) throw RangeError("Duplicate use of step JSON ID " + e);
172
- return _[e] = t, t.prototype.jsonID = e, t;
173
- }
174
- }, y = class e {
175
- constructor(e, t) {
176
- this.doc = e, this.failed = t;
177
- }
178
- static ok(t) {
179
- return new e(t, null);
180
- }
181
- static fail(t) {
182
- return new e(null, t);
183
- }
184
- static fromReplace(t, n, i, a) {
185
- try {
186
- return e.ok(t.replace(n, i, a));
187
- } catch (t) {
188
- if (t instanceof r) return e.fail(t.message);
189
- throw t;
190
- }
191
- }
192
- };
193
- function b(t, n, r) {
194
- let i = [];
195
- for (let e = 0; e < t.childCount; e++) {
196
- let a = t.child(e);
197
- a.content.size && (a = a.copy(b(a.content, n, a))), a.isInline && (a = n(a, r, e)), i.push(a);
198
- }
199
- return e.fromArray(i);
200
- }
201
- var x = class e extends v {
202
- constructor(e, t, n) {
203
- super(), this.from = e, this.to = t, this.mark = n;
204
- }
205
- apply(e) {
206
- let t = e.slice(this.from, this.to), n = e.resolve(this.from), r = n.node(n.sharedDepth(this.to)), a = new i(b(t.content, (e, t) => !e.isAtom || !t.type.allowsMarkType(this.mark.type) ? e : e.mark(this.mark.addToSet(e.marks)), r), t.openStart, t.openEnd);
207
- return y.fromReplace(e, this.from, this.to, a);
208
- }
209
- invert(n) {
210
- let r = [];
211
- return n.nodesBetween(this.from, this.to, (n, i) => {
212
- if (n.isInline && n.isAtom) {
213
- let a = this.mark.addToSet(n.marks);
214
- if (!t.sameSet(a, n.marks)) {
215
- let t = Math.max(this.from, i), o = Math.min(this.to, i + n.nodeSize);
216
- C(S, t, o, this.mark, r);
217
- for (let i of n.marks) i.isInSet(a) || C(e, t, o, i, r);
218
- }
219
- }
220
- }), r.length == 1 ? r[0] : new w(r);
221
- }
222
- map(t) {
223
- let n = t.map(this.from, 1), r = t.map(this.to, -1);
224
- return n >= r ? null : new e(n, r, this.mark);
225
- }
226
- merge(t) {
227
- return t instanceof e && t.mark.eq(this.mark) && this.from <= t.to && this.to >= t.from ? new e(Math.min(this.from, t.from), Math.max(this.to, t.to), this.mark) : null;
228
- }
229
- toJSON() {
230
- return {
231
- stepType: "addMark",
232
- mark: this.mark.toJSON(),
233
- from: this.from,
234
- to: this.to
235
- };
236
- }
237
- static fromJSON(t, n) {
238
- if (typeof n.from != "number" || typeof n.to != "number") throw RangeError("Invalid input for AddMarkStep.fromJSON");
239
- return new e(n.from, n.to, t.markFromJSON(n.mark));
240
- }
241
- };
242
- v.jsonID("addMark", x);
243
- var S = class e extends v {
244
- constructor(e, t, n) {
245
- super(), this.from = e, this.to = t, this.mark = n;
246
- }
247
- apply(e) {
248
- let t = e.slice(this.from, this.to), n = new i(b(t.content, (e) => e.mark(this.mark.removeFromSet(e.marks)), e), t.openStart, t.openEnd);
249
- return y.fromReplace(e, this.from, this.to, n);
250
- }
251
- invert(e) {
252
- let t = [];
253
- return e.nodesBetween(this.from, this.to, (e, n) => {
254
- e.isInline && e.isAtom && this.mark.isInSet(e.marks) && C(x, Math.max(this.from, n), Math.min(this.to, n + e.nodeSize), this.mark, t);
255
- }), t.length == 1 ? t[0] : new w(t);
256
- }
257
- map(t) {
258
- let n = t.map(this.from, 1), r = t.map(this.to, -1);
259
- return n >= r ? null : new e(n, r, this.mark);
260
- }
261
- merge(t) {
262
- return t instanceof e && t.mark.eq(this.mark) && this.from <= t.to && this.to >= t.from ? new e(Math.min(this.from, t.from), Math.max(this.to, t.to), this.mark) : null;
263
- }
264
- toJSON() {
265
- return {
266
- stepType: "removeMark",
267
- mark: this.mark.toJSON(),
268
- from: this.from,
269
- to: this.to
270
- };
271
- }
272
- static fromJSON(t, n) {
273
- if (typeof n.from != "number" || typeof n.to != "number") throw RangeError("Invalid input for RemoveMarkStep.fromJSON");
274
- return new e(n.from, n.to, t.markFromJSON(n.mark));
275
- }
276
- };
277
- v.jsonID("removeMark", S);
278
- function C(e, t, n, r, i) {
279
- let a = i.length ? i[i.length - 1] : null;
280
- a && a instanceof e && a.to == t && a.mark.eq(r) ? i[i.length - 1] = new e(a.from, n, r) : i.push(new e(t, n, r));
281
- }
282
- var w = class e extends v {
283
- constructor(e) {
284
- super(), this.steps = e;
285
- }
286
- apply(e) {
287
- for (let t of this.steps) {
288
- let n = t.apply(e);
289
- if (!n.doc) return n;
290
- e = n.doc;
291
- }
292
- return new y(e, null);
293
- }
294
- invert(t) {
295
- return new e(this.steps.map((e) => e.invert(t)));
296
- }
297
- map(t) {
298
- let n = [];
299
- for (let e of this.steps) {
300
- let r = e.map(t);
301
- r && n.push(r);
302
- }
303
- return n.length ? new e(n) : null;
304
- }
305
- toJSON() {
306
- return {
307
- stepType: "markSet",
308
- steps: this.steps.map((e) => e.toJSON())
309
- };
310
- }
311
- static fromJSON(t, n) {
312
- if (!Array.isArray(n.steps) || !n.steps.every((e) => e.stepType == "addMark" || e.stepType == "removeMark")) throw RangeError("Invalid JSON for MarkSetStep");
313
- return new e(n.steps.map((e) => v.fromJSON(t, e)));
314
- }
315
- };
316
- v.jsonID("markSet", w);
317
- var T = class t extends v {
318
- constructor(e, t) {
319
- super(), this.pos = e, this.mark = t;
320
- }
321
- apply(t) {
322
- let n = t.nodeAt(this.pos);
323
- if (!n) return y.fail("No node at mark step's position");
324
- let r = n.type.create(n.attrs, null, this.mark.addToSet(n.marks));
325
- return y.fromReplace(t, this.pos, this.pos + 1, new i(e.from(r), 0, +!n.isLeaf));
326
- }
327
- invert(e) {
328
- let n = e.nodeAt(this.pos);
329
- if (n) {
330
- let e = this.mark.addToSet(n.marks);
331
- if (e.length == n.marks.length) {
332
- for (let r = 0; r < n.marks.length; r++) if (!n.marks[r].isInSet(e)) return new t(this.pos, n.marks[r]);
333
- return new t(this.pos, this.mark);
334
- }
335
- }
336
- return new E(this.pos, this.mark);
337
- }
338
- map(e) {
339
- let n = e.mapResult(this.pos, 1);
340
- return n.deletedAfter ? null : new t(n.pos, this.mark);
341
- }
342
- toJSON() {
343
- return {
344
- stepType: "addNodeMark",
345
- pos: this.pos,
346
- mark: this.mark.toJSON()
347
- };
348
- }
349
- static fromJSON(e, n) {
350
- if (typeof n.pos != "number") throw RangeError("Invalid input for AddNodeMarkStep.fromJSON");
351
- return new t(n.pos, e.markFromJSON(n.mark));
352
- }
353
- };
354
- v.jsonID("addNodeMark", T);
355
- var E = class t extends v {
356
- constructor(e, t) {
357
- super(), this.pos = e, this.mark = t;
358
- }
359
- apply(t) {
360
- let n = t.nodeAt(this.pos);
361
- if (!n) return y.fail("No node at mark step's position");
362
- let r = n.type.create(n.attrs, null, this.mark.removeFromSet(n.marks));
363
- return y.fromReplace(t, this.pos, this.pos + 1, new i(e.from(r), 0, +!n.isLeaf));
364
- }
365
- invert(e) {
366
- let t = e.nodeAt(this.pos);
367
- return !t || !this.mark.isInSet(t.marks) ? this : new T(this.pos, this.mark);
368
- }
369
- map(e) {
370
- let n = e.mapResult(this.pos, 1);
371
- return n.deletedAfter ? null : new t(n.pos, this.mark);
372
- }
373
- toJSON() {
374
- return {
375
- stepType: "removeNodeMark",
376
- pos: this.pos,
377
- mark: this.mark.toJSON()
378
- };
379
- }
380
- static fromJSON(e, n) {
381
- if (typeof n.pos != "number") throw RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");
382
- return new t(n.pos, e.markFromJSON(n.mark));
383
- }
384
- };
385
- v.jsonID("removeNodeMark", E);
386
- var D = class e extends v {
387
- constructor(e, t, n, r = !1) {
388
- super(), this.from = e, this.to = t, this.slice = n, this.structure = r;
389
- }
390
- apply(e) {
391
- return this.structure && k(e, this.from, this.to) ? y.fail("Structure replace would overwrite content") : y.fromReplace(e, this.from, this.to, this.slice);
392
- }
393
- getMap() {
394
- return new h([
395
- this.from,
396
- this.to - this.from,
397
- this.slice.size
398
- ]);
399
- }
400
- invert(t) {
401
- return new e(this.from, this.from + this.slice.size, t.slice(this.from, this.to));
402
- }
403
- map(t) {
404
- let n = t.mapResult(this.to, -1), r = this.from == this.to && e.MAP_BIAS < 0 ? n : t.mapResult(this.from, 1);
405
- return r.deletedAcross && n.deletedAcross ? null : new e(r.pos, Math.max(r.pos, n.pos), this.slice, this.structure);
406
- }
407
- merge(t) {
408
- if (!(t instanceof e) || t.structure || this.structure) return null;
409
- if (this.from + this.slice.size == t.from && !this.slice.openEnd && !t.slice.openStart) {
410
- let n = this.slice.size + t.slice.size == 0 ? i.empty : new i(this.slice.content.append(t.slice.content), this.slice.openStart, t.slice.openEnd);
411
- return new e(this.from, this.to + (t.to - t.from), n, this.structure);
412
- }
413
- if (t.to == this.from && !this.slice.openStart && !t.slice.openEnd) {
414
- let n = this.slice.size + t.slice.size == 0 ? i.empty : new i(t.slice.content.append(this.slice.content), t.slice.openStart, this.slice.openEnd);
415
- return new e(t.from, this.to, n, this.structure);
416
- }
417
- return null;
418
- }
419
- toJSON() {
420
- let e = {
421
- stepType: "replace",
422
- from: this.from,
423
- to: this.to
424
- };
425
- return this.slice.size && (e.slice = this.slice.toJSON()), this.structure && (e.structure = !0), e;
426
- }
427
- static fromJSON(t, n) {
428
- if (typeof n.from != "number" || typeof n.to != "number") throw RangeError("Invalid input for ReplaceStep.fromJSON");
429
- return new e(n.from, n.to, i.fromJSON(t, n.slice), !!n.structure);
430
- }
431
- };
432
- D.MAP_BIAS = 1, v.jsonID("replace", D);
433
- var O = class e extends v {
434
- constructor(e, t, n, r, i, a, o = !1) {
435
- super(), this.from = e, this.to = t, this.gapFrom = n, this.gapTo = r, this.slice = i, this.insert = a, this.structure = o;
436
- }
437
- apply(e) {
438
- if (this.structure && (k(e, this.from, this.gapFrom) || k(e, this.gapTo, this.to))) return y.fail("Structure gap-replace would overwrite content");
439
- let t = e.slice(this.gapFrom, this.gapTo);
440
- if (t.openStart || t.openEnd) return y.fail("Gap is not a flat range");
441
- let n = this.slice.insertAt(this.insert, t.content);
442
- return n ? y.fromReplace(e, this.from, this.to, n) : y.fail("Content does not fit in gap");
443
- }
444
- getMap() {
445
- return new h([
446
- this.from,
447
- this.gapFrom - this.from,
448
- this.insert,
449
- this.gapTo,
450
- this.to - this.gapTo,
451
- this.slice.size - this.insert
452
- ]);
453
- }
454
- invert(t) {
455
- let n = this.gapTo - this.gapFrom;
456
- return new e(this.from, this.from + this.slice.size + n, this.from + this.insert, this.from + this.insert + n, t.slice(this.from, this.to).removeBetween(this.gapFrom - this.from, this.gapTo - this.from), this.gapFrom - this.from, this.structure);
457
- }
458
- map(t) {
459
- let n = t.mapResult(this.from, 1), r = t.mapResult(this.to, -1), i = this.from == this.gapFrom ? n.pos : t.map(this.gapFrom, -1), a = this.to == this.gapTo ? r.pos : t.map(this.gapTo, 1);
460
- return n.deletedAcross && r.deletedAcross || i < n.pos || a > r.pos || i > a ? null : new e(n.pos, r.pos, i, a, this.slice, this.insert, this.structure);
461
- }
462
- toJSON() {
463
- let e = {
464
- stepType: "replaceAround",
465
- from: this.from,
466
- to: this.to,
467
- gapFrom: this.gapFrom,
468
- gapTo: this.gapTo,
469
- insert: this.insert
470
- };
471
- return this.slice.size && (e.slice = this.slice.toJSON()), this.structure && (e.structure = !0), e;
472
- }
473
- static fromJSON(t, n) {
474
- if (typeof n.from != "number" || typeof n.to != "number" || typeof n.gapFrom != "number" || typeof n.gapTo != "number" || typeof n.insert != "number") throw RangeError("Invalid input for ReplaceAroundStep.fromJSON");
475
- return new e(n.from, n.to, n.gapFrom, n.gapTo, i.fromJSON(t, n.slice), n.insert, !!n.structure);
476
- }
477
- };
478
- v.jsonID("replaceAround", O);
479
- function k(e, t, n) {
480
- let r = e.resolve(t), i = n - t, a = r.depth;
481
- for (; i > 0 && a > 0 && r.indexAfter(a) == r.node(a).childCount;) a--, i--;
482
- if (i > 0) {
483
- let e = r.node(a).maybeChild(r.indexAfter(a));
484
- for (; i > 0;) {
485
- if (!e || e.isLeaf) return !0;
486
- e = e.firstChild, i--;
487
- }
488
- }
489
- return !1;
490
- }
491
- function ee(e, t, n, r) {
492
- let i = [];
493
- e.doc.nodesBetween(t, n, (e, a, o) => {
494
- if (!e.isInline) return;
495
- let s = e.marks;
496
- !r.isInSet(s) && o.type.allowsMarkType(r.type) && C(x, Math.max(a, t), Math.min(a + e.nodeSize, n), r, i);
497
- }), i.forEach((t) => e.step(t));
498
- }
499
- function te(e, t, r, i) {
500
- let a = [], o = 0;
501
- e.doc.nodesBetween(t, r, (e, s) => {
502
- if (!e.isInline || !e.isAtom) return;
503
- o++;
504
- let c = null;
505
- if (i instanceof n) {
506
- let t = e.marks, n;
507
- for (; n = i.isInSet(t);) (c ||= []).push(n), t = n.removeFromSet(t);
508
- } else i ? i.isInSet(e.marks) && (c = [i]) : c = e.marks;
509
- if (c && c.length) {
510
- let n = Math.min(s + e.nodeSize, r);
511
- for (let e = 0; e < c.length; e++) {
512
- let r = c[e], i;
513
- for (let e = 0; e < a.length; e++) {
514
- let t = a[e];
515
- t.step == o - 1 && r.eq(a[e].style) && (i = t);
516
- }
517
- i ? (i.to = n, i.step = o) : a.push({
518
- style: r,
519
- from: Math.max(s, t),
520
- to: n,
521
- step: o
522
- });
523
- }
524
- }
525
- }), a.forEach((t) => e.step(new S(t.from, t.to, t.style)));
526
- }
527
- function A(t, n, r, a = r.contentMatch, o = !0) {
528
- let s = t.doc.nodeAt(n), c = [], l = n + 1;
529
- for (let n = 0; n < s.childCount; n++) {
530
- let u = s.child(n), d = l + u.nodeSize, f = a.matchType(u.type);
531
- if (!f) c.push(new D(l, d, i.empty));
532
- else {
533
- a = f;
534
- for (let e = 0; e < u.marks.length; e++) r.allowsMarkType(u.marks[e].type) || t.step(new S(l, d, u.marks[e]));
535
- if (o && u.isText && r.whitespace != "pre") {
536
- let t, n = /\r?\n|\r/g, a;
537
- for (; t = n.exec(u.text);) a ||= new i(e.from(r.schema.text(" ", r.allowedMarks(u.marks))), 0, 0), c.push(new D(l + t.index, l + t.index + t[0].length, a));
538
- }
539
- }
540
- l = d;
541
- }
542
- if (!a.validEnd) {
543
- let n = a.fillBefore(e.empty, !0);
544
- t.replace(l, l, new i(n, 0, 0));
545
- }
546
- for (let e = c.length - 1; e >= 0; e--) t.step(c[e]);
547
- }
548
- function ne(e, t, n) {
549
- return (t == 0 || e.canReplace(t, e.childCount)) && (n == e.childCount || e.canReplace(0, n));
550
- }
551
- function re(e) {
552
- let t = e.parent.content.cutByIndex(e.startIndex, e.endIndex);
553
- for (let n = e.depth, r = 0, i = 0;; --n) {
554
- let a = e.$from.node(n), o = e.$from.index(n) + r, s = e.$to.indexAfter(n) - i;
555
- if (n < e.depth && a.canReplace(o, s, t)) return n;
556
- if (n == 0 || a.type.spec.isolating || !ne(a, o, s)) break;
557
- o && (r = 1), s < a.childCount && (i = 1);
558
- }
559
- return null;
560
- }
561
- function ie(t, n, r) {
562
- let { $from: a, $to: o, depth: s } = n, c = a.before(s + 1), l = o.after(s + 1), u = c, d = l, f = e.empty, p = 0;
563
- for (let t = s, n = !1; t > r; t--) n || a.index(t) > 0 ? (n = !0, f = e.from(a.node(t).copy(f)), p++) : u--;
564
- let m = e.empty, h = 0;
565
- for (let t = s, n = !1; t > r; t--) n || o.after(t + 1) < o.end(t) ? (n = !0, m = e.from(o.node(t).copy(m)), h++) : d++;
566
- t.step(new O(u, d, c, l, new i(f.append(m), p, h), f.size - p, !0));
567
- }
568
- function ae(e, t, n = null, r = e) {
569
- let i = oe(e, t), a = i && M(r, t);
570
- return a ? i.map(j).concat({
571
- type: t,
572
- attrs: n
573
- }).concat(a.map(j)) : null;
574
- }
575
- function j(e) {
576
- return {
577
- type: e,
578
- attrs: null
579
- };
580
- }
581
- function oe(e, t) {
582
- let { parent: n, startIndex: r, endIndex: i } = e, a = n.contentMatchAt(r).findWrapping(t);
583
- if (!a) return null;
584
- let o = a.length ? a[0] : t;
585
- return n.canReplaceWith(r, i, o) ? a : null;
586
- }
587
- function M(e, t) {
588
- let { parent: n, startIndex: r, endIndex: i } = e, a = n.child(r), o = t.contentMatch.findWrapping(a.type);
589
- if (!o) return null;
590
- let s = (o.length ? o[o.length - 1] : t).contentMatch;
591
- for (let e = r; s && e < i; e++) s = s.matchType(n.child(e).type);
592
- return !s || !s.validEnd ? null : o;
593
- }
594
- function se(t, n, r) {
595
- let a = e.empty;
596
- for (let t = r.length - 1; t >= 0; t--) {
597
- if (a.size) {
598
- let e = r[t].type.contentMatch.matchFragment(a);
599
- if (!e || !e.validEnd) throw RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper");
600
- }
601
- a = e.from(r[t].type.create(r[t].attrs, a));
602
- }
603
- let o = n.start, s = n.end;
604
- t.step(new O(o, s, o, s, new i(a, 0, 0), r.length, !0));
605
- }
606
- function N(t, n, r, a, o) {
607
- if (!a.isTextblock) throw RangeError("Type given to setBlockType should be a textblock");
608
- let s = t.steps.length;
609
- t.doc.nodesBetween(n, r, (n, r) => {
610
- let c = typeof o == "function" ? o(n) : o;
611
- if (n.isTextblock && !n.hasMarkup(a, c) && ce(t.doc, t.mapping.slice(s).map(r), a)) {
612
- let o = null;
613
- if (a.schema.linebreakReplacement) {
614
- let e = a.whitespace == "pre", t = !!a.contentMatch.matchType(a.schema.linebreakReplacement);
615
- e && !t ? o = !1 : !e && t && (o = !0);
616
- }
617
- o === !1 && F(t, n, r, s), A(t, t.mapping.slice(s).map(r, 1), a, void 0, o === null);
618
- let l = t.mapping.slice(s), u = l.map(r, 1), d = l.map(r + n.nodeSize, 1);
619
- return t.step(new O(u, d, u + 1, d - 1, new i(e.from(a.create(c, null, n.marks)), 0, 0), 1, !0)), o === !0 && P(t, n, r, s), !1;
620
- }
621
- });
622
- }
623
- function P(e, t, n, r) {
624
- t.forEach((i, a) => {
625
- if (i.isText) {
626
- let o, s = /\r?\n|\r/g;
627
- for (; o = s.exec(i.text);) {
628
- let i = e.mapping.slice(r).map(n + 1 + a + o.index);
629
- e.replaceWith(i, i + 1, t.type.schema.linebreakReplacement.create());
630
- }
631
- }
632
- });
633
- }
634
- function F(e, t, n, r) {
635
- t.forEach((i, a) => {
636
- if (i.type == i.type.schema.linebreakReplacement) {
637
- let i = e.mapping.slice(r).map(n + 1 + a);
638
- e.replaceWith(i, i + 1, t.type.schema.text("\n"));
639
- }
640
- });
641
- }
642
- function ce(e, t, n) {
643
- let r = e.resolve(t), i = r.index();
644
- return r.parent.canReplaceWith(i, i + 1, n);
645
- }
646
- function le(t, n, r, a, o) {
647
- let s = t.doc.nodeAt(n);
648
- if (!s) throw RangeError("No node at given position");
649
- r ||= s.type;
650
- let c = r.create(a, null, o || s.marks);
651
- if (s.isLeaf) return t.replaceWith(n, n + s.nodeSize, c);
652
- if (!r.validContent(s.content)) throw RangeError("Invalid content for node type " + r.name);
653
- t.step(new O(n, n + s.nodeSize, n + 1, n + s.nodeSize - 1, new i(e.from(c), 0, 0), 1, !0));
654
- }
655
- function ue(e, t, n = 1, r) {
656
- let i = e.resolve(t), a = i.depth - n, o = r && r[r.length - 1] || i.parent;
657
- if (a < 0 || i.parent.type.spec.isolating || !i.parent.canReplace(i.index(), i.parent.childCount) || !o.type.validContent(i.parent.content.cutByIndex(i.index(), i.parent.childCount))) return !1;
658
- for (let e = i.depth - 1, t = n - 2; e > a; e--, t--) {
659
- let n = i.node(e), a = i.index(e);
660
- if (n.type.spec.isolating) return !1;
661
- let o = n.content.cutByIndex(a, n.childCount), s = r && r[t + 1];
662
- s && (o = o.replaceChild(0, s.type.create(s.attrs)));
663
- let c = r && r[t] || n;
664
- if (!n.canReplace(a + 1, n.childCount) || !c.type.validContent(o)) return !1;
665
- }
666
- let s = i.indexAfter(a), c = r && r[0];
667
- return i.node(a).canReplaceWith(s, s, c ? c.type : i.node(a + 1).type);
668
- }
669
- function de(t, n, r = 1, a) {
670
- let o = t.doc.resolve(n), s = e.empty, c = e.empty;
671
- for (let t = o.depth, n = o.depth - r, i = r - 1; t > n; t--, i--) {
672
- s = e.from(o.node(t).copy(s));
673
- let n = a && a[i];
674
- c = e.from(n ? n.type.create(n.attrs, c) : o.node(t).copy(c));
675
- }
676
- t.step(new D(n, n, new i(s.append(c), r, r), !0));
677
- }
678
- function fe(e, t) {
679
- let n = e.resolve(t), r = n.index();
680
- return I(n.nodeBefore, n.nodeAfter) && n.parent.canReplace(r, r + 1);
681
- }
682
- function pe(e, t) {
683
- t.content.size || e.type.compatibleContent(t.type);
684
- let n = e.contentMatchAt(e.childCount), { linebreakReplacement: r } = e.type.schema;
685
- for (let i = 0; i < t.childCount; i++) {
686
- let a = t.child(i), o = a.type == r ? e.type.schema.nodes.text : a.type;
687
- if (n = n.matchType(o), !n || !e.type.allowsMarks(a.marks)) return !1;
688
- }
689
- return n.validEnd;
690
- }
691
- function I(e, t) {
692
- return !!(e && t && !e.isLeaf && pe(e, t));
693
- }
694
- function L(e, t, n = -1) {
695
- let r = e.resolve(t);
696
- for (let e = r.depth;; e--) {
697
- let i, a, o = r.index(e);
698
- if (e == r.depth ? (i = r.nodeBefore, a = r.nodeAfter) : n > 0 ? (i = r.node(e + 1), o++, a = r.node(e).maybeChild(o)) : (i = r.node(e).maybeChild(o - 1), a = r.node(e + 1)), i && !i.isTextblock && I(i, a) && r.node(e).canReplace(o, o + 1)) return t;
699
- if (e == 0) break;
700
- t = n < 0 ? r.before(e) : r.after(e);
701
- }
702
- }
703
- function R(e, t, n) {
704
- let r = null, { linebreakReplacement: a } = e.doc.type.schema, o = e.doc.resolve(t - n), s = o.node().type;
705
- if (a && s.inlineContent) {
706
- let e = s.whitespace == "pre", t = !!s.contentMatch.matchType(a);
707
- e && !t ? r = !1 : !e && t && (r = !0);
708
- }
709
- let c = e.steps.length;
710
- if (r === !1) {
711
- let r = e.doc.resolve(t + n);
712
- F(e, r.node(), r.before(), c);
713
- }
714
- s.inlineContent && A(e, t + n - 1, s, o.node().contentMatchAt(o.index()), r == null);
715
- let l = e.mapping.slice(c), u = l.map(t - n);
716
- if (e.step(new D(u, l.map(t + n, -1), i.empty, !0)), r === !0) {
717
- let t = e.doc.resolve(u);
718
- P(e, t.node(), t.before(), e.steps.length);
719
- }
720
- return e;
721
- }
722
- function z(e, t, n) {
723
- let r = e.resolve(t);
724
- if (r.parent.canReplaceWith(r.index(), r.index(), n)) return t;
725
- if (r.parentOffset == 0) for (let e = r.depth - 1; e >= 0; e--) {
726
- let t = r.index(e);
727
- if (r.node(e).canReplaceWith(t, t, n)) return r.before(e + 1);
728
- if (t > 0) return null;
729
- }
730
- if (r.parentOffset == r.parent.content.size) for (let e = r.depth - 1; e >= 0; e--) {
731
- let t = r.indexAfter(e);
732
- if (r.node(e).canReplaceWith(t, t, n)) return r.after(e + 1);
733
- if (t < r.node(e).childCount) return null;
734
- }
735
- return null;
736
- }
737
- function B(e, t, n) {
738
- let r = e.resolve(t);
739
- if (!n.content.size) return t;
740
- let i = n.content;
741
- for (let e = 0; e < n.openStart; e++) i = i.firstChild.content;
742
- for (let e = 1; e <= (n.openStart == 0 && n.size ? 2 : 1); e++) for (let t = r.depth; t >= 0; t--) {
743
- let n = t == r.depth ? 0 : r.pos <= (r.start(t + 1) + r.end(t + 1)) / 2 ? -1 : 1, a = r.index(t) + +(n > 0), o = r.node(t), s = !1;
744
- if (e == 1) s = o.canReplace(a, a, i);
745
- else {
746
- let e = o.contentMatchAt(a).findWrapping(i.firstChild.type);
747
- s = e && o.canReplaceWith(a, a, e[0]);
748
- }
749
- if (s) return n == 0 ? r.pos : n < 0 ? r.before(t + 1) : r.after(t + 1);
750
- }
751
- return null;
752
- }
753
- function V(e, t, n = t, r = i.empty) {
754
- if (t == n && !r.size) return null;
755
- let a = e.resolve(t), o = e.resolve(n);
756
- return H(a, o, r) ? new D(t, n, r) : new me(a, o, r).fit();
757
- }
758
- function H(e, t, n) {
759
- return !n.openStart && !n.openEnd && e.start() == t.start() && e.parent.canReplace(e.index(), t.index(), n.content);
760
- }
761
- var me = class {
762
- constructor(t, n, r) {
763
- this.$from = t, this.$to = n, this.unplaced = r, this.frontier = [], this.placed = e.empty;
764
- for (let e = 0; e <= t.depth; e++) {
765
- let n = t.node(e);
766
- this.frontier.push({
767
- type: n.type,
768
- match: n.contentMatchAt(t.indexAfter(e))
769
- });
770
- }
771
- for (let n = t.depth; n > 0; n--) this.placed = e.from(t.node(n).copy(this.placed));
772
- }
773
- get depth() {
774
- return this.frontier.length - 1;
775
- }
776
- fit() {
777
- for (; this.unplaced.size;) {
778
- let e = this.findFittable();
779
- e ? this.placeNodes(e) : this.openMore() || this.dropNode();
780
- }
781
- let e = this.mustMoveInline(), t = this.placed.size - this.depth - this.$from.depth, n = this.$from, r = this.close(e < 0 ? this.$to : n.doc.resolve(e));
782
- if (!r) return null;
783
- let a = this.placed, o = n.depth, s = r.depth;
784
- for (; o && s && a.childCount == 1;) a = a.firstChild.content, o--, s--;
785
- let c = new i(a, o, s);
786
- return e > -1 ? new O(n.pos, e, this.$to.pos, this.$to.end(), c, t) : c.size || n.pos != this.$to.pos ? new D(n.pos, r.pos, c) : null;
787
- }
788
- findFittable() {
789
- let t = this.unplaced.openStart;
790
- for (let e = this.unplaced.content, n = 0, r = this.unplaced.openEnd; n < t; n++) {
791
- let i = e.firstChild;
792
- if (e.childCount > 1 && (r = 0), i.type.spec.isolating && r <= n) {
793
- t = n;
794
- break;
795
- }
796
- e = i.content;
797
- }
798
- for (let n = 1; n <= 2; n++) for (let r = n == 1 ? t : this.unplaced.openStart; r >= 0; r--) {
799
- let t, i = null;
800
- r ? (i = G(this.unplaced.content, r - 1).firstChild, t = i.content) : t = this.unplaced.content;
801
- let a = t.firstChild;
802
- for (let t = this.depth; t >= 0; t--) {
803
- let { type: o, match: s } = this.frontier[t], c, l = null;
804
- if (n == 1 && (a ? s.matchType(a.type) || (l = s.fillBefore(e.from(a), !1)) : i && o.compatibleContent(i.type))) return {
805
- sliceDepth: r,
806
- frontierDepth: t,
807
- parent: i,
808
- inject: l
809
- };
810
- if (n == 2 && a && (c = s.findWrapping(a.type))) return {
811
- sliceDepth: r,
812
- frontierDepth: t,
813
- parent: i,
814
- wrap: c
815
- };
816
- if (i && s.matchType(i.type)) break;
817
- }
818
- }
819
- }
820
- openMore() {
821
- let { content: e, openStart: t, openEnd: n } = this.unplaced;
822
- return J(e, -1) <= t ? !1 : (this.unplaced.size > 1 && J(e, 1) > n && n++, this.unplaced = new i(e, t + 1, n), !0);
823
- }
824
- dropNode() {
825
- let { content: e, openStart: t, openEnd: n } = this.unplaced, r = G(e, t);
826
- if (r.childCount <= 1 && t > 0) {
827
- let a = e.size - t <= t + r.size;
828
- this.unplaced = new i(U(e, t - 1, 1), t - 1, a ? t - 1 : n);
829
- } else this.unplaced = new i(U(e, t, 1), t, n);
830
- }
831
- placeNodes({ sliceDepth: t, frontierDepth: n, parent: r, inject: a, wrap: o }) {
832
- for (; this.depth > n;) this.closeFrontierNode();
833
- if (o) for (let e = 0; e < o.length; e++) this.openFrontierNode(o[e]);
834
- let s = this.unplaced, c = r ? r.content : s.content, l = s.openStart - t, u = 0, d = [], { match: f, type: p } = this.frontier[n];
835
- if (a) {
836
- for (let e = 0; e < a.childCount; e++) d.push(a.child(e));
837
- f = f.matchFragment(a);
838
- }
839
- let m = c.size + t - (s.content.size - s.openEnd);
840
- for (; u < c.childCount;) {
841
- let e = c.child(u), t = f.matchType(e.type);
842
- if (!t) break;
843
- u++, (u > 1 || l == 0 || e.content.size) && (f = t, d.push(K(e.mark(p.allowedMarks(e.marks)), u == 1 ? l : 0, u == c.childCount ? m : -1)));
844
- }
845
- let h = u == c.childCount;
846
- h || (m = -1), this.placed = W(this.placed, n, e.from(d)), this.frontier[n].match = f, h && m < 0 && r && r.type == this.frontier[this.depth].type && this.frontier.length > 1 && this.closeFrontierNode();
847
- for (let e = 0, t = d[d.length - 1]; t && e < m; e++) this.frontier.push({
848
- type: t.type,
849
- match: t.contentMatchAt(t.childCount)
850
- }), t = t.lastChild;
851
- this.unplaced = h ? t == 0 ? i.empty : new i(U(s.content, t - 1, 1), t - 1, m < 0 ? s.openEnd : t - 1) : new i(U(s.content, t, u), t, s.openEnd);
852
- }
853
- mustMoveInline() {
854
- if (!this.$to.parent.isTextblock) return -1;
855
- let e = this.frontier[this.depth], t;
856
- if (!e.type.isTextblock || !q(this.$to, this.$to.depth, e.type, e.match, !1) || this.$to.depth == this.depth && (t = this.findCloseLevel(this.$to)) && t.depth == this.depth) return -1;
857
- let { depth: n } = this.$to, r = this.$to.after(n);
858
- for (; n > 1 && r == this.$to.end(--n);) ++r;
859
- return r;
860
- }
861
- findCloseLevel(e) {
862
- scan: for (let t = Math.min(this.depth, e.depth); t >= 0; t--) {
863
- let { match: n, type: r } = this.frontier[t], i = t < e.depth && e.end(t + 1) == e.pos + (e.depth - (t + 1)), a = q(e, t, r, n, i);
864
- if (a) {
865
- for (let n = t - 1; n >= 0; n--) {
866
- let { match: t, type: r } = this.frontier[n], i = q(e, n, r, t, !0);
867
- if (!i || i.childCount) continue scan;
868
- }
869
- return {
870
- depth: t,
871
- fit: a,
872
- move: i ? e.doc.resolve(e.after(t + 1)) : e
873
- };
874
- }
875
- }
876
- }
877
- close(e) {
878
- let t = this.findCloseLevel(e);
879
- if (!t) return null;
880
- for (; this.depth > t.depth;) this.closeFrontierNode();
881
- t.fit.childCount && (this.placed = W(this.placed, t.depth, t.fit)), e = t.move;
882
- for (let n = t.depth + 1; n <= e.depth; n++) {
883
- let t = e.node(n), r = t.type.contentMatch.fillBefore(t.content, !0, e.index(n));
884
- this.openFrontierNode(t.type, t.attrs, r);
885
- }
886
- return e;
887
- }
888
- openFrontierNode(t, n = null, r) {
889
- let i = this.frontier[this.depth];
890
- i.match = i.match.matchType(t), this.placed = W(this.placed, this.depth, e.from(t.create(n, r))), this.frontier.push({
891
- type: t,
892
- match: t.contentMatch
893
- });
894
- }
895
- closeFrontierNode() {
896
- let t = this.frontier.pop().match.fillBefore(e.empty, !0);
897
- t.childCount && (this.placed = W(this.placed, this.frontier.length, t));
898
- }
899
- };
900
- function U(e, t, n) {
901
- return t == 0 ? e.cutByIndex(n, e.childCount) : e.replaceChild(0, e.firstChild.copy(U(e.firstChild.content, t - 1, n)));
902
- }
903
- function W(e, t, n) {
904
- return t == 0 ? e.append(n) : e.replaceChild(e.childCount - 1, e.lastChild.copy(W(e.lastChild.content, t - 1, n)));
905
- }
906
- function G(e, t) {
907
- for (let n = 0; n < t; n++) e = e.firstChild.content;
908
- return e;
909
- }
910
- function K(t, n, r) {
911
- if (n <= 0) return t;
912
- let i = t.content;
913
- return n > 1 && (i = i.replaceChild(0, K(i.firstChild, n - 1, i.childCount == 1 ? r - 1 : 0))), n > 0 && (i = t.type.contentMatch.fillBefore(i).append(i), r <= 0 && (i = i.append(t.type.contentMatch.matchFragment(i).fillBefore(e.empty, !0)))), t.copy(i);
914
- }
915
- function q(e, t, n, r, i) {
916
- let a = e.node(t), o = i ? e.indexAfter(t) : e.index(t);
917
- if (o == a.childCount && !n.compatibleContent(a.type)) return null;
918
- let s = r.fillBefore(a.content, !0, o);
919
- return s && !he(n, a.content, o) ? s : null;
920
- }
921
- function he(e, t, n) {
922
- for (let r = n; r < t.childCount; r++) if (!e.allowsMarks(t.child(r).marks)) return !0;
923
- return !1;
924
- }
925
- function ge(e) {
926
- return e.spec.defining || e.spec.definingForContent;
927
- }
928
- function J(e, t) {
929
- for (let n = 0;; n++) {
930
- let r = t < 0 ? e.firstChild : e.lastChild;
931
- if (!r || r.isAtom) return n;
932
- e = r.content;
933
- }
934
- }
935
- function _e(e, t, n, r) {
936
- if (!r.size) return e.deleteRange(t, n);
937
- let a = e.doc.resolve(t), o = e.doc.resolve(n);
938
- if (H(a, o, r)) return e.step(new D(t, n, r));
939
- let s = X(a, o);
940
- s[s.length - 1] == 0 && s.pop();
941
- let c = -(a.depth + 1);
942
- s.unshift(c);
943
- for (let e = a.depth, t = a.pos - 1; e > 0; e--, t--) {
944
- let n = a.node(e).type.spec;
945
- if (n.defining || n.definingAsContext || n.isolating) break;
946
- s.indexOf(e) > -1 ? c = e : a.before(e) == t && s.splice(1, 0, -e);
947
- }
948
- let l = s.indexOf(c), u = [], d = r.openStart;
949
- for (let e = r.content, t = 0;; t++) {
950
- let n = e.firstChild;
951
- if (u.push(n), t == r.openStart) break;
952
- e = n.content;
953
- }
954
- for (let e = d - 1; e >= 0; e--) {
955
- let t = u[e], n = ge(t.type);
956
- if (n && !t.sameMarkup(a.node(Math.abs(c) - 1))) d = e;
957
- else if (n || !t.type.isTextblock) break;
958
- }
959
- for (let t = r.openStart; t >= 0; t--) {
960
- let c = (t + d + 1) % (r.openStart + 1), f = u[c];
961
- if (f) for (let t = 0; t < s.length; t++) {
962
- let u = s[(t + l) % s.length], d = !0;
963
- u < 0 && (d = !1, u = -u);
964
- let p = a.node(u - 1), m = a.index(u - 1);
965
- if (p.canReplaceWith(m, m, f.type, f.marks)) return e.replace(a.before(u), d ? o.after(u) : n, new i(Y(r.content, 0, r.openStart, c), c, r.openEnd));
966
- }
967
- }
968
- let f = e.steps.length;
969
- for (let i = s.length - 1; i >= 0 && (e.replace(t, n, r), !(e.steps.length > f)); i--) {
970
- let e = s[i];
971
- e < 0 || (t = a.before(e), n = o.after(e));
972
- }
973
- }
974
- function Y(t, n, r, i, a) {
975
- if (n < r) {
976
- let e = t.firstChild;
977
- t = t.replaceChild(0, e.copy(Y(e.content, n + 1, r, i, e)));
978
- }
979
- if (n > i) {
980
- let n = a.contentMatchAt(0), r = n.fillBefore(t).append(t);
981
- t = r.append(n.matchFragment(r).fillBefore(e.empty, !0));
982
- }
983
- return t;
984
- }
985
- function ve(t, n, r, a) {
986
- if (!a.isInline && n == r && t.doc.resolve(n).parent.content.size) {
987
- let e = z(t.doc, n, a.type);
988
- e != null && (n = r = e);
989
- }
990
- t.replaceRange(n, r, new i(e.from(a), 0, 0));
991
- }
992
- function ye(e, t, n) {
993
- let r = e.doc.resolve(t), i = e.doc.resolve(n);
994
- if (r.parent.isTextblock && i.parent.isTextblock && r.start() != i.start() && r.parentOffset == 0 && i.parentOffset == 0) {
995
- let a = r.sharedDepth(n), o = !1;
996
- for (let e = r.depth; e > a; e--) r.node(e).type.spec.isolating && (o = !0);
997
- for (let e = i.depth; e > a; e--) i.node(e).type.spec.isolating && (o = !0);
998
- if (!o) {
999
- for (let e = r.depth; e > 0 && t == r.start(e); e--) t = r.before(e);
1000
- for (let e = i.depth; e > 0 && n == i.start(e); e--) n = i.before(e);
1001
- r = e.doc.resolve(t), i = e.doc.resolve(n);
1002
- }
1003
- }
1004
- let a = X(r, i);
1005
- for (let t = 0; t < a.length; t++) {
1006
- let n = a[t], o = t == a.length - 1;
1007
- if (o && n == 0 || r.node(n).type.contentMatch.validEnd) return e.delete(r.start(n), i.end(n));
1008
- if (n > 0 && (o || r.node(n - 1).canReplace(r.index(n - 1), i.indexAfter(n - 1)))) return e.delete(r.before(n), i.after(n));
1009
- }
1010
- for (let a = 1; a <= r.depth && a <= i.depth; a++) if (t - r.start(a) == r.depth - a && n > r.end(a) && i.end(a) - n != i.depth - a && r.start(a - 1) == i.start(a - 1) && r.node(a - 1).canReplace(r.index(a - 1), i.index(a - 1))) return e.delete(r.before(a), n);
1011
- e.delete(t, n);
1012
- }
1013
- function X(e, t) {
1014
- let n = [], r = Math.min(e.depth, t.depth);
1015
- for (let i = r; i >= 0; i--) {
1016
- let r = e.start(i);
1017
- if (r < e.pos - (e.depth - i) || t.end(i) > t.pos + (t.depth - i) || e.node(i).type.spec.isolating || t.node(i).type.spec.isolating) break;
1018
- (r == t.start(i) || i == e.depth && i == t.depth && e.parent.inlineContent && t.parent.inlineContent && i && t.start(i - 1) == r - 1) && n.push(i);
1019
- }
1020
- return n;
1021
- }
1022
- var Z = class t extends v {
1023
- constructor(e, t, n) {
1024
- super(), this.pos = e, this.attr = t, this.value = n;
1025
- }
1026
- apply(t) {
1027
- let n = t.nodeAt(this.pos);
1028
- if (!n) return y.fail("No node at attribute step's position");
1029
- let r = Object.create(null);
1030
- for (let e in n.attrs) r[e] = n.attrs[e];
1031
- r[this.attr] = this.value;
1032
- let a = n.type.create(r, null, n.marks);
1033
- return y.fromReplace(t, this.pos, this.pos + 1, new i(e.from(a), 0, +!n.isLeaf));
1034
- }
1035
- getMap() {
1036
- return h.empty;
1037
- }
1038
- invert(e) {
1039
- return new t(this.pos, this.attr, e.nodeAt(this.pos).attrs[this.attr]);
1040
- }
1041
- map(e) {
1042
- let n = e.mapResult(this.pos, 1);
1043
- return n.deletedAfter ? null : new t(n.pos, this.attr, this.value);
1044
- }
1045
- toJSON() {
1046
- return {
1047
- stepType: "attr",
1048
- pos: this.pos,
1049
- attr: this.attr,
1050
- value: this.value
1051
- };
1052
- }
1053
- static fromJSON(e, n) {
1054
- if (typeof n.pos != "number" || typeof n.attr != "string") throw RangeError("Invalid input for AttrStep.fromJSON");
1055
- return new t(n.pos, n.attr, n.value);
1056
- }
1057
- };
1058
- v.jsonID("attr", Z);
1059
- var Q = class e extends v {
1060
- constructor(e, t) {
1061
- super(), this.attr = e, this.value = t;
1062
- }
1063
- apply(e) {
1064
- let t = Object.create(null);
1065
- for (let n in e.attrs) t[n] = e.attrs[n];
1066
- t[this.attr] = this.value;
1067
- let n = e.type.create(t, e.content, e.marks);
1068
- return y.ok(n);
1069
- }
1070
- getMap() {
1071
- return h.empty;
1072
- }
1073
- invert(t) {
1074
- return new e(this.attr, t.attrs[this.attr]);
1075
- }
1076
- map(e) {
1077
- return this;
1078
- }
1079
- toJSON() {
1080
- return {
1081
- stepType: "docAttr",
1082
- attr: this.attr,
1083
- value: this.value
1084
- };
1085
- }
1086
- static fromJSON(t, n) {
1087
- if (typeof n.attr != "string") throw RangeError("Invalid input for DocAttrStep.fromJSON");
1088
- return new e(n.attr, n.value);
1089
- }
1090
- };
1091
- v.jsonID("docAttr", Q);
1092
- var $ = class extends Error {};
1093
- $ = function e(t) {
1094
- let n = Error.call(this, t);
1095
- return n.__proto__ = e.prototype, n;
1096
- }, $.prototype = Object.create(Error.prototype), $.prototype.constructor = $, $.prototype.name = "TransformError";
1097
- var be = class {
1098
- constructor(e) {
1099
- this.doc = e, this.steps = [], this.docs = [], this.mapping = new g();
1100
- }
1101
- get before() {
1102
- return this.docs.length ? this.docs[0] : this.doc;
1103
- }
1104
- step(e) {
1105
- let t = this.maybeStep(e);
1106
- if (t.failed) throw new $(t.failed);
1107
- return this;
1108
- }
1109
- maybeStep(e) {
1110
- let t = e.apply(this.doc);
1111
- return t.failed || this.addStep(e, t.doc), t;
1112
- }
1113
- get docChanged() {
1114
- return this.steps.length > 0;
1115
- }
1116
- changedRange() {
1117
- let e = 1e9, t = -1e9;
1118
- for (let n = 0; n < this.mapping.maps.length; n++) {
1119
- let r = this.mapping.maps[n];
1120
- n && (e = r.map(e, 1), t = r.map(t, -1)), r.forEach((n, r, i, a) => {
1121
- e = Math.min(e, i), t = Math.max(t, a);
1122
- });
1123
- }
1124
- return e == 1e9 ? null : {
1125
- from: e,
1126
- to: t
1127
- };
1128
- }
1129
- addStep(e, t) {
1130
- this.docs.push(this.doc), this.steps.push(e), this.mapping.appendMap(e.getMap()), this.doc = t;
1131
- }
1132
- replace(e, t = e, n = i.empty) {
1133
- let r = V(this.doc, e, t, n);
1134
- return r && this.step(r), this;
1135
- }
1136
- replaceWith(t, n, r) {
1137
- return this.replace(t, n, new i(e.from(r), 0, 0));
1138
- }
1139
- delete(e, t) {
1140
- return this.replace(e, t, i.empty);
1141
- }
1142
- insert(e, t) {
1143
- return this.replaceWith(e, e, t);
1144
- }
1145
- replaceRange(e, t, n) {
1146
- return _e(this, e, t, n), this;
1147
- }
1148
- replaceRangeWith(e, t, n) {
1149
- return ve(this, e, t, n), this;
1150
- }
1151
- deleteRange(e, t) {
1152
- return ye(this, e, t), this;
1153
- }
1154
- lift(e, t) {
1155
- return ie(this, e, t), this;
1156
- }
1157
- join(e, t = 1) {
1158
- return R(this, e, t), this;
1159
- }
1160
- wrap(e, t) {
1161
- return se(this, e, t), this;
1162
- }
1163
- setBlockType(e, t = e, n, r = null) {
1164
- return N(this, e, t, n, r), this;
1165
- }
1166
- setNodeMarkup(e, t, n = null, r) {
1167
- return le(this, e, t, n, r), this;
1168
- }
1169
- setNodeAttribute(e, t, n) {
1170
- return this.step(new Z(e, t, n)), this;
1171
- }
1172
- setDocAttribute(e, t) {
1173
- return this.step(new Q(e, t)), this;
1174
- }
1175
- addNodeMark(e, t) {
1176
- return this.step(new T(e, t)), this;
1177
- }
1178
- removeNodeMark(e, n) {
1179
- let r = this.doc.nodeAt(e);
1180
- if (!r) throw RangeError("No node at position " + e);
1181
- if (n instanceof t) n.isInSet(r.marks) && this.step(new E(e, n));
1182
- else {
1183
- let t = r.marks, i, a = [];
1184
- for (; i = n.isInSet(t);) a.push(new E(e, i)), t = i.removeFromSet(t);
1185
- for (let e = a.length - 1; e >= 0; e--) this.step(a[e]);
1186
- }
1187
- return this;
1188
- }
1189
- split(e, t = 1, n) {
1190
- return de(this, e, t, n), this;
1191
- }
1192
- addMark(e, t, n) {
1193
- return ee(this, e, t, n), this;
1194
- }
1195
- removeMark(e, t, n) {
1196
- return te(this, e, t, n), this;
1197
- }
1198
- clearIncompatible(e, t, n) {
1199
- return A(this, e, t, n), this;
1200
- }
1201
- };
1202
- export { x as AddMarkStep, T as AddNodeMarkStep, Z as AttrStep, Q as DocAttrStep, m as MapResult, g as Mapping, S as RemoveMarkStep, E as RemoveNodeMarkStep, O as ReplaceAroundStep, D as ReplaceStep, v as Step, h as StepMap, y as StepResult, be as Transform, $ as TransformError, fe as canJoin, ue as canSplit, B as dropPoint, ae as findWrapping, z as insertPoint, L as joinPoint, re as liftTarget, V as replaceStep };
1203
-
1204
- //# sourceMappingURL=index.js.map