editate 0.6.21 → 0.6.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/index.js CHANGED
@@ -1,12 +1,12 @@
1
- var {min: t, max: e} = Math, {keys: n, is: o} = Object, r = t => "string" == typeof t, c = t => "function" == typeof t, s = c(queueMicrotask) ? queueMicrotask : t => {
1
+ var {min: t, max: e} = Math, {keys: n, is: r} = Object, o = t => "string" == typeof t, c = t => "function" == typeof t, s = c(queueMicrotask) ? queueMicrotask : t => {
2
2
  Promise.resolve().then(t);
3
3
  }, i = t => "text" in t, l = t => "children" in t, a = t => t.some(l), f = /* @__PURE__ */ new WeakMap, u = ({children: t}, e = 0, n = t.length) => {
4
- let o = 0, r = 0;
4
+ let r = 0, o = 0;
5
5
  for (let c = e; c < n; c++) {
6
6
  const e = t[c];
7
- o += d(e), 0 !== r && l(e) && o++, r++;
7
+ r += d(e), 0 !== o && l(e) && r++, o++;
8
8
  }
9
- return o;
9
+ return r;
10
10
  }, d = t => {
11
11
  if (l(t)) {
12
12
  let e = f.get(t);
@@ -14,35 +14,47 @@ var {min: t, max: e} = Math, {keys: n, is: o} = Object, r = t => "string" == typ
14
14
  }
15
15
  return i(t) ? t.text.length : 1;
16
16
  }, p = ({children: t}, e, n) => {
17
- const o = t.length;
18
- for (let r = 0; r < o; r++) {
19
- const o = t[r], c = l(o);
20
- let s = d(o);
17
+ const r = t.length;
18
+ for (let o = 0; o < r; o++) {
19
+ const r = t[o], c = l(r);
20
+ let s = d(r);
21
21
  const i = 0 === s;
22
- if (c && s++, s > e || s === e && !c && (n || i)) return [ o, e, r ];
22
+ if (c && s++, s > e || s === e && !c && (n || i)) return [ r, e, o ];
23
23
  e -= s;
24
24
  }
25
25
  return null;
26
26
  }, h = (t, e) => {
27
27
  const n = [];
28
28
  for (;t; ) {
29
- const o = p(t, e);
30
- if (!o) break;
31
- const r = o[0];
32
- if (!l(r)) break;
33
- e = o[1], t = r, n.push(o[2]);
29
+ const r = p(t, e);
30
+ if (!r) break;
31
+ const o = r[0];
32
+ if (!l(o)) break;
33
+ e = r[1], t = o, n.push(r[2]);
34
34
  }
35
35
  return [ t, e, n ];
36
36
  }, y = (t, e, n) => {
37
- const [o, r, c] = h(t, e), s = p(o, r, n);
37
+ const [r, o, c] = h(t, e), s = p(r, o, n);
38
38
  return s ? (c.push(s[2]), [ s[0], s[1], c ]) : null;
39
+ }, k = (t, e) => {
40
+ let n = 0, r = 0;
41
+ for (const o of t.children) {
42
+ const t = l(o);
43
+ if (t && 0 !== r && n++, o === e) return n;
44
+ if (t) {
45
+ const t = k(o, e);
46
+ if (null != t) return n + t;
47
+ }
48
+ n += d(o), r++;
49
+ }
50
+ return null;
39
51
  }, m = (t, e) => {
40
- const n = t.children, o = p(t, e);
41
- if (o) {
42
- const [e, r, c] = o;
52
+ const n = t.children, r = p(t, e);
53
+ if (r) {
54
+ const [e, o, c] = r;
43
55
  if (l(e)) {
44
- const [o, s] = m(e, r), i = n.slice(0, c), l = n.slice(c + 1);
45
- return i.push(o), l.unshift(s), [ {
56
+ const [r, s] = m(e, o), i = n.slice(0, c), l = n.slice(c + 1);
57
+ return i.push(r), l.unshift(s), [ {
46
58
  ...t,
47
59
  children: i
48
60
  }, {
@@ -51,10 +63,10 @@ var {min: t, max: e} = Math, {keys: n, is: o} = Object, r = t => "string" == typ
51
63
  } ];
52
64
  }
53
65
  {
54
- const o = n.slice(0, c), s = n.slice(c + 1);
66
+ const r = n.slice(0, c), s = n.slice(c + 1);
55
67
  if (i(e)) {
56
- const t = e.text.slice(0, r), n = e.text.slice(r);
57
- !t && o.length || o.push({
68
+ const t = e.text.slice(0, o), n = e.text.slice(o);
69
+ !t && r.length || r.push({
58
70
  ...e,
59
71
  text: t
60
72
  }), !n && s.length || s.unshift({
@@ -64,40 +76,40 @@ var {min: t, max: e} = Math, {keys: n, is: o} = Object, r = t => "string" == typ
64
76
  } else s.unshift(e);
65
77
  return [ {
66
78
  ...t,
67
- children: o
79
+ children: r
68
80
  }, {
69
81
  ...t,
70
82
  children: s
71
83
  } ];
72
84
  }
73
85
  }
74
- const r = n[n.length - 1];
86
+ const o = n[n.length - 1];
75
87
  return [ t, {
76
88
  ...t,
77
- children: i(r) ? [ {
78
- ...r,
89
+ children: i(o) ? [ {
90
+ ...o,
79
91
  text: ""
80
92
  } ] : []
81
93
  } ];
82
94
  }, g = (t, [e, n]) => {
83
- let o = 0;
84
- for (const r of e) o += u(t, 0, r), 0 !== r && o++, t = t.children[r];
85
- return o + n;
86
- }, k = (t, e) => {
87
- const [, n, o] = h(t, e);
88
- return [ o, n ];
89
- }, _ = (t, [e, n]) => [ g(t, e), g(t, n) ];
95
+ let r = 0;
96
+ for (const o of e) r += u(t, 0, o), 0 !== o && r++, t = t.children[o];
97
+ return r + n;
98
+ }, _ = (t, e) => {
99
+ const [, n, r] = h(t, e);
100
+ return [ r, n ];
101
+ }, b = (t, [e, n]) => [ g(t, e), g(t, n) ];
90
102
 
91
103
  function* x(t, [e, n]) {
92
104
  if (e >= n) return;
93
105
  if (!l(t)) return;
94
- const o = p(t, e);
95
- if (o) {
96
- let r = e - o[1], c = o[2];
106
+ const r = p(t, e);
107
+ if (r) {
108
+ let o = e - r[1], c = r[2];
97
109
  const s = t.children, i = s.length;
98
- for (;r <= n && c < i; ) {
110
+ for (;o <= n && c < i; ) {
99
111
  const t = s[c];
100
- yield [ t, r ], c++, r += d(t), l(t) && r++;
112
+ yield [ t, o ], c++, o += d(t), l(t) && o++;
101
113
  }
102
114
  }
103
115
  }
@@ -109,41 +121,128 @@ function* v(t, e) {
109
121
  } else yield [ t, 0 ];
110
122
  }
111
123
 
112
- function* b(t, e) {
113
- if (l(t)) for (const [n, o] of x(t, e)) for (const t of b(n, [ 0, d(n) ])) t[1] += o,
124
+ function* T(t, e) {
125
+ if (l(t)) for (const [n, r] of x(t, e)) for (const t of T(n, [ 0, d(n) ])) t[1] += r,
114
126
  yield t; else yield [ t, 0 ];
115
127
  }
116
128
 
117
- var T = (n, o = 0, r = 1 / 0, c) => {
118
- let s = "", l = o;
119
- for (const [a, f] of b(n, [ o, r ])) {
129
+ var E = (n, r = 0, o = 1 / 0, c) => {
130
+ let s = "", l = r;
131
+ for (const [a, f] of T(n, [ r, o ])) {
120
132
  for (let t = f - l; t > 0; t--) s += "\n";
121
133
  const n = d(a), u = f + n;
122
134
  if (i(a)) {
123
- const c = e(f, o) - f, i = t(u, r) - f;
135
+ const c = e(f, r) - f, i = t(u, o) - f;
124
136
  s += 0 === c && i === n ? a.text : a.text.slice(c, i);
125
137
  } else c && (s += c(a));
126
138
  l = u;
127
139
  }
128
- for (let e = t(r, d(n)) - l; e > 0; e--) s += "\n";
140
+ for (let e = t(o, d(n)) - l; e > 0; e--) s += "\n";
129
141
  return s;
130
- }, E = (t, e, n) => e >= n ? [] : m(m(t, n)[0], e)[1].children, M = ([t, e]) => t > e ? [ e, t ] : [ t, e ], S = ([t, e]) => t === e, w = ([t, e], [n, o]) => t < o && n < e;
142
+ }, M = (t, e, n) => e >= n ? [] : m(m(t, n)[0], e)[1].children, w = (t, e, n) => t.split("\n").map(t => ({
143
+ ...n,
144
+ children: [ {
145
+ ...e,
146
+ text: t
147
+ } ]
148
+ })), S = "delete", A = "insert_text", O = "insert_node", R = (t, e) => {
149
+ const o = n(t);
150
+ return o.length === n(e).length && o.every(n => n in e && ("text" === n || r(t[n], e[n])));
151
+ }, D = (t, e) => {
152
+ if (e.length) {
153
+ const n = t.length;
154
+ if (t.push(...e), n) {
155
+ const e = t[n - 1], r = t[n], o = l(e), c = l(r);
156
+ o ? c && ((t, e = 0, n = t.length - 1) => {
157
+ let r = e + 1;
158
+ for (;r <= n; ) {
159
+ const e = t[r - 1], o = t[r];
160
+ t[r - 1] = B(e, o), t.splice(r, 1), n--;
161
+ }
162
+ })(t, n - 1, n) : o || c || ((t, e = 0, n = t.length - 1) => {
163
+ let r = e + 1;
164
+ for (;r <= n; ) {
165
+ const e = t[r - 1], o = t[r];
166
+ i(e) && i(o) && R(e, o) ? (t[r - 1] = {
167
+ ...e,
168
+ text: e.text + o.text
169
+ }, t.splice(r, 1), n--) : r++;
170
+ }
171
+ for (r = e; r <= n; ) {
172
+ const e = t[r];
173
+ i(e) && !e.text && t.length > 1 ? (t.splice(r, 1), n--) : r++;
174
+ }
175
+ })(t, n - 1, n);
176
+ }
177
+ }
178
+ t.length || t.push({
179
+ text: ""
180
+ });
181
+ }, B = (...t) => ({
182
+ ...t[0],
183
+ children: t.reduce((t, e) => (D(t, e.children), t), [])
184
+ }), I = (t, e, n, r = 0) => {
185
+ if (r < e.length) {
186
+ const o = e[r], c = t.children, s = c.slice();
187
+ return s.splice(o, 1, I(c[o], e, n, r + 1)), {
188
+ ...t,
189
+ children: s
190
+ };
191
+ }
192
+ return n;
193
+ }, L = (t, e, n, r) => {
194
+ const [o, c] = m(t, e), s = e < n ? m(t, n)[1] : c, i = a(t.children);
195
+ a(r) ? i || (r = B(...r).children) : i && (r = [ {
196
+ children: r
197
+ } ]);
198
+ const l = o.children.slice();
199
+ return D(l, r), D(l, s.children), {
200
+ ...t,
201
+ children: l
202
+ };
203
+ }, P = (t, e) => e >= 0 && e <= d(t), H = (t, e) => e.reduce((t, e) => N(t, e), t), N = (t, e, n) => {
204
+ switch (e.type) {
205
+ case S:
206
+ {
207
+ const [n, r] = e.range;
208
+ if (t >= n) return r >= t ? n : t + n - r;
209
+ break;
210
+ }
211
+
212
+ case A:
213
+ {
214
+ const {at: r, text: o} = e;
215
+ if (n ? t > r : t >= r) return t + o.length;
216
+ break;
217
+ }
218
+
219
+ case O:
220
+ {
221
+ const {at: r, fragment: o} = e;
222
+ if (n ? t > r : t >= r) return t + d({
223
+ children: o
224
+ });
225
+ break;
226
+ }
227
+ }
228
+ return t;
229
+ }, C = ([t, e], n) => [ N(t, n), N(e, n) ], W = ([t, e]) => t > e ? [ e, t ] : [ t, e ], F = ([t, e]) => t === e, U = ([t, e], [n, r]) => t < r && n < e;
131
230
 
132
- function* A(t, e = M(t.selection)) {
133
- if (S(e)) {
231
+ function* V(t, e = W(t.selection)) {
232
+ if (F(e)) {
134
233
  const n = y(t.doc, e[0])?.[0];
135
234
  n && (yield n);
136
- } else for (const [n, o] of b(t.doc, e)) w(e, [ o, o + d(n) ]) && (yield n);
235
+ } else for (const [n, r] of T(t.doc, e)) U(e, [ r, r + d(n) ]) && (yield n);
137
236
  }
138
237
 
139
- function O(t, e = M(t.selection)) {
238
+ function q(t, e = W(t.selection)) {
140
239
  t.apply({
141
240
  type: "delete",
142
241
  range: e
143
242
  });
144
243
  }
145
244
 
146
- function R(t, e, n = t.selection[0]) {
245
+ function z(t, e, n = t.selection[0]) {
147
246
  t.apply({
148
247
  type: "insert_text",
149
248
  at: n,
@@ -151,7 +250,7 @@ function R(t, e, n = t.selection[0]) {
151
250
  });
152
251
  }
153
252
 
154
- function D(t, e, n = t.selection[0]) {
253
+ function G(t, e, n = t.selection[0]) {
155
254
  t.apply({
156
255
  type: "insert_node",
157
256
  at: n,
@@ -161,7 +260,7 @@ function D(t, e, n = t.selection[0]) {
161
260
  });
162
261
  }
163
262
 
164
- function B(t, e, n = M(t.selection)) {
263
+ function J(t, e, n = W(t.selection)) {
165
264
  t.apply({
166
265
  type: "delete",
167
266
  range: n
@@ -172,7 +271,7 @@ function B(t, e, n = M(t.selection)) {
172
271
  });
173
272
  }
174
273
 
175
- function I(t, e) {
274
+ function Y(t, e) {
176
275
  t.apply({
177
276
  type: "patch_node",
178
277
  path: [],
@@ -181,94 +280,94 @@ function I(t, e) {
181
280
  });
182
281
  }
183
282
 
184
- function L(t, e, n, o = M(t.selection)) {
283
+ function X(t, e, n, r = W(t.selection)) {
185
284
  t.apply({
186
285
  type: "format",
187
- range: o,
286
+ range: r,
188
287
  key: e,
189
288
  value: n
190
289
  });
191
290
  }
192
291
 
193
- function P(t, e, n = M(t.selection)) {
194
- let o = !1, r = !1;
195
- for (const c of t.exec(A, n)) if (i(c) && (r = !0, !c[e])) {
196
- o = !0;
292
+ function Z(t, e, n = W(t.selection)) {
293
+ let r = !1, o = !1;
294
+ for (const c of t.exec(V, n)) if (i(c) && (o = !0, !c[e])) {
295
+ r = !0;
197
296
  break;
198
297
  }
199
- r && t.apply({
298
+ o && t.apply({
200
299
  type: "format",
201
300
  range: n,
202
301
  key: e,
203
- value: o
302
+ value: r
204
303
  });
205
304
  }
206
305
 
207
- function H(t, e, n, o = t.selection[0]) {
208
- const r = h(t.doc, o)[2];
306
+ function j(t, e, n, r = t.selection[0]) {
307
+ const o = h(t.doc, r)[2];
209
308
  t.apply({
210
309
  type: "patch_node",
211
- path: r,
310
+ path: o,
212
311
  key: e,
213
312
  value: n
214
313
  });
215
314
  }
216
315
 
217
- function N(t, e, n, o, r = t.selection[0]) {
218
- const [c, , s] = h(t.doc, r);
316
+ function K(t, e, n, r, o = t.selection[0]) {
317
+ const [c, , s] = h(t.doc, o);
219
318
  t.apply({
220
319
  type: "patch_node",
221
320
  path: s,
222
321
  key: e,
223
- value: c[e] === n ? o : n
322
+ value: c[e] === n ? r : n
224
323
  });
225
324
  }
226
325
 
227
- function C(t, e, n, o = t.selection[0]) {
228
- const r = y(t.doc, o, !0);
229
- r && !i(r[0]) && t.apply({
326
+ function Q(t, e, n, r = t.selection[0]) {
327
+ const o = y(t.doc, r, !0);
328
+ o && !i(o[0]) && t.apply({
230
329
  type: "patch_node",
231
- path: r[2],
330
+ path: o[2],
232
331
  key: e,
233
332
  value: n
234
333
  });
235
334
  }
236
335
 
237
- var W = t => 1 === t.nodeType, F = t => 8 === t.nodeType, U = new Map([ [ "BR", 1 ], [ "WBR", 1 ], [ "AREA", 2 ], [ "BASE", 2 ], [ "DATALIST", 2 ], [ "HEAD", 2 ], [ "LINK", 2 ], [ "META", 2 ], [ "RP", 2 ], [ "SCRIPT", 2 ], [ "STYLE", 2 ], [ "TEMPLATE", 2 ], [ "TITLE", 2 ], [ "COLGROUP", 2 ], [ "HR", 3 ], [ "AUDIO", 3 ], [ "CANVAS", 3 ], [ "EMBED", 3 ], [ "IFRAME", 3 ], [ "IMG", 3 ], [ "OBJECT", 3 ], [ "PICTURE", 3 ], [ "VIDEO", 3 ], [ "SVG", 3 ], [ "MATH", 3 ], [ "BUTTON", 3 ], [ "INPUT", 3 ], [ "METER", 3 ], [ "PROGRESS", 3 ], [ "SELECT", 3 ], [ "TEXTAREA", 3 ] ]), V = new Set([ "DIV", "H1", "H2", "H3", "H4", "H5", "H6", "P", "PRE", "LI", "DT", "DD", "TH", "TD" ]), q = t => V.has(t.tagName), z = (t, e) => t.compareDocumentPosition(e), G = t => t.ownerDocument, J = t => G(t).getSelection(), Y = (t, e) => {
336
+ var $ = t => 1 === t.nodeType, tt = t => 8 === t.nodeType, et = new Map([ [ "BR", 1 ], [ "WBR", 1 ], [ "AREA", 2 ], [ "BASE", 2 ], [ "DATALIST", 2 ], [ "HEAD", 2 ], [ "LINK", 2 ], [ "META", 2 ], [ "RP", 2 ], [ "SCRIPT", 2 ], [ "STYLE", 2 ], [ "TEMPLATE", 2 ], [ "TITLE", 2 ], [ "COLGROUP", 2 ], [ "HR", 3 ], [ "AUDIO", 3 ], [ "CANVAS", 3 ], [ "EMBED", 3 ], [ "IFRAME", 3 ], [ "IMG", 3 ], [ "OBJECT", 3 ], [ "PICTURE", 3 ], [ "VIDEO", 3 ], [ "SVG", 3 ], [ "MATH", 3 ], [ "BUTTON", 3 ], [ "INPUT", 3 ], [ "METER", 3 ], [ "PROGRESS", 3 ], [ "SELECT", 3 ], [ "TEXTAREA", 3 ] ]), nt = new Set([ "DIV", "H1", "H2", "H3", "H4", "H5", "H6", "P", "PRE", "LI", "DT", "DD", "TH", "TD" ]), rt = t => nt.has(t.tagName), ot = (t, e) => t.compareDocumentPosition(e), ct = t => t.ownerDocument, st = t => ct(t).getSelection(), it = (t, e) => {
238
337
  if (t.rangeCount) {
239
338
  const n = t.getRangeAt(0);
240
339
  if (e.contains(n.commonAncestorContainer)) return n;
241
340
  }
242
- }, X = (t, e, n, o) => {
243
- const [r, c] = ((t, [e, n]) => [ k(t, e), k(t, n) ])(n, o), s = G(t), i = S(o), l = o[0] - o[1] > 0, a = l ? r : c, f = j(t, e, l ? c : r), u = i ? f : j(t, e, a), d = s.createRange(), [p, h] = f, [y, m] = u;
244
- return W(p) && t !== p ? h < 1 ? d.setStartBefore(p) : d.setStartAfter(p) : d.setStart(p, h),
245
- W(y) && t !== y ? m < 1 ? d.setEndBefore(y) : d.setEndAfter(y) : d.setEnd(y, m),
341
+ }, lt = (t, e, n, r) => {
342
+ const [o, c] = ((t, [e, n]) => [ _(t, e), _(t, n) ])(n, r), s = ct(t), i = F(r), l = r[0] - r[1] > 0, a = l ? o : c, f = ft(t, e, l ? c : o), u = i ? f : ft(t, e, a), d = s.createRange(), [p, h] = f, [y, k] = u;
343
+ return $(p) && t !== p ? h < 1 ? d.setStartBefore(p) : d.setStartAfter(p) : d.setStart(p, h),
344
+ $(y) && t !== y ? k < 1 ? d.setEndBefore(y) : d.setEndAfter(y) : d.setEnd(y, k),
246
345
  d;
247
- }, Z = (t, e, n, o, r) => {
248
- const c = J(t);
249
- if (r || Y(c, t)) {
250
- const r = X(t, e, n, o), s = o[0] - o[1] > 0;
251
- c.removeAllRanges(), c.addRange(r), s && (c.collapseToEnd(), c.extend(r.startContainer, r.startOffset));
346
+ }, at = (t, e, n, r, o) => {
347
+ const c = st(t);
348
+ if (o || it(c, t)) {
349
+ const o = lt(t, e, n, r), s = r[0] - r[1] > 0;
350
+ c.removeAllRanges(), c.addRange(o), s && (c.collapseToEnd(), c.extend(o.startContainer, o.startOffset));
252
351
  }
253
- }, j = (t, e, [n, o]) => e(({t: e, o: r, i: c, l: s}) => {
352
+ }, ft = (t, e, [n, r]) => e(({t: e, o, i: c, l: s}) => {
254
353
  let i, l = 0;
255
354
  for (;i = e(); ) if (4 === i) {
256
- if (l < n.length) for (let t = n[l++]; t > 0; t--) r();
355
+ if (l < n.length) for (let t = n[l++]; t > 0; t--) o();
257
356
  } else {
258
357
  const t = s();
259
- if (o <= t) return [ c(), o ];
260
- o -= t;
358
+ if (r <= t) return [ c(), r ];
359
+ r -= t;
261
360
  }
262
361
  return [ t, 0 ];
263
- }, t), K = (e, n, o, r) => {
362
+ }, t), ut = (e, n, r, o) => {
264
363
  let c = !0;
265
- if (e === o && !o.hasChildNodes()) return [ [], 0 ];
266
- if (W(o) && o.hasChildNodes()) {
267
- const e = t(r, o.childNodes.length - 1);
268
- o = o.childNodes[e], c = e === r, r = 0;
364
+ if (e === r && !r.hasChildNodes()) return [ [], 0 ];
365
+ if ($(r) && r.hasChildNodes()) {
366
+ const e = t(o, r.childNodes.length - 1);
367
+ r = r.childNodes[e], c = e === o, o = 0;
269
368
  }
270
- return n(({t, u: s, p: i, h: l, i: a, l: f, m: u}) => {
271
- s(o), 4 !== u() && i();
369
+ return n(({t, u: s, p: i, h: l, i: a, l: f, k: u}) => {
370
+ s(r), 4 !== u() && i();
272
371
  const d = n(() => {
273
372
  const t = [];
274
373
  for (;u() && a() !== e; ) {
@@ -280,108 +379,21 @@ var W = t => 1 === t.nodeType, F = t => 8 === t.nodeType, U = new Map([ [ "BR",
280
379
  });
281
380
  let p = 0;
282
381
  for (;t(); ) {
283
- const t = z(o, a());
382
+ const t = ot(r, a());
284
383
  if (0 === t || 16 & t) {
285
384
  if (c) break;
286
385
  } else if (4 & t) break;
287
386
  p += f();
288
387
  }
289
- return [ d, p + r ];
388
+ return [ d, p + o ];
290
389
  }, e);
291
- }, Q = (t, e, {startOffset: n, startContainer: o, endOffset: r, endContainer: c}) => {
292
- const s = K(t, e, o, n);
293
- return [ s, o === c && n === r ? s : K(t, e, c, r) ];
294
- }, $ = (t, e, n) => t.split("\n").map(t => ({
295
- ...n,
296
- children: [ {
297
- ...e,
298
- text: t
299
- } ]
300
- })), tt = "delete", et = "insert_text", nt = "insert_node", ot = (t, e) => {
301
- const r = n(t);
302
- return r.length === n(e).length && r.every(n => n in e && ("text" === n || o(t[n], e[n])));
303
- }, rt = (t, e) => {
304
- if (e.length) {
305
- const n = t.length;
306
- if (t.push(...e), n) {
307
- const e = t[n - 1], o = t[n], r = l(e), c = l(o);
308
- r ? c && ((t, e = 0, n = t.length - 1) => {
309
- let o = e + 1;
310
- for (;o <= n; ) {
311
- const e = t[o - 1], r = t[o];
312
- t[o - 1] = ct(e, r), t.splice(o, 1), n--;
313
- }
314
- })(t, n - 1, n) : r || c || ((t, e = 0, n = t.length - 1) => {
315
- let o = e + 1;
316
- for (;o <= n; ) {
317
- const e = t[o - 1], r = t[o];
318
- i(e) && i(r) && ot(e, r) ? (t[o - 1] = {
319
- ...e,
320
- text: e.text + r.text
321
- }, t.splice(o, 1), n--) : o++;
322
- }
323
- for (o = e; o <= n; ) {
324
- const e = t[o];
325
- i(e) && !e.text && t.length > 1 ? (t.splice(o, 1), n--) : o++;
326
- }
327
- })(t, n - 1, n);
328
- }
329
- }
330
- t.length || t.push({
331
- text: ""
332
- });
333
- }, ct = (...t) => ({
334
- ...t[0],
335
- children: t.reduce((t, e) => (rt(t, e.children), t), [])
336
- }), st = (t, e, n, o = 0) => {
337
- if (o < e.length) {
338
- const r = e[o], c = t.children, s = c.slice();
339
- return s.splice(r, 1, st(c[r], e, n, o + 1)), {
340
- ...t,
341
- children: s
342
- };
343
- }
344
- return n;
345
- }, it = (t, e, n, o) => {
346
- const [r, c] = m(t, e), s = e < n ? m(t, n)[1] : c, i = a(t.children);
347
- a(o) ? i || (o = ct(...o).children) : i && (o = [ {
348
- children: o
349
- } ]);
350
- const l = r.children.slice();
351
- return rt(l, o), rt(l, s.children), {
352
- ...t,
353
- children: l
354
- };
355
- }, lt = (t, e) => e >= 0 && e <= d(t), at = (t, e) => e.reduce((t, e) => ft(t, e), t), ft = (t, e) => {
356
- switch (e.type) {
357
- case tt:
358
- {
359
- const [n, o] = e.range;
360
- if (t >= n) return o >= t ? n : t + n - o;
361
- break;
362
- }
363
-
364
- case et:
365
- {
366
- const {at: n, text: o} = e;
367
- if (t >= n) return t + o.length;
368
- break;
369
- }
370
-
371
- case nt:
372
- {
373
- const {at: n, fragment: o} = e;
374
- if (t >= n) return t + d({
375
- children: o
376
- });
377
- break;
378
- }
379
- }
380
- return t;
381
- }, ut = ([t, e], n) => [ ft(t, n), ft(e, n) ], dt = "undefined" != typeof navigator && /Mac|iP(hone|od|ad)/.test(navigator.platform), pt = (t, e) => {
382
- const n = t.endsWith("+"), o = (n ? t.slice(0, -2) : t).split("+"), r = n ? "+" : o.pop(), c = "Space" === r ? " " : r.toLowerCase();
390
+ }, dt = (t, e, {startOffset: n, startContainer: r, endOffset: o, endContainer: c}) => {
391
+ const s = ut(t, e, r, n);
392
+ return [ s, r === c && n === o ? s : ut(t, e, c, o) ];
393
+ }, pt = "undefined" != typeof navigator && /Mac|iP(hone|od|ad)/.test(navigator.platform), ht = (t, e) => {
394
+ const n = t.endsWith("+"), r = (n ? t.slice(0, -2) : t).split("+"), o = n ? "+" : r.pop(), c = "Space" === o ? " " : o.toLowerCase();
383
395
  let s = !1, i = !1, l = !1, a = !1;
384
- return o.forEach(t => {
396
+ return r.forEach(t => {
385
397
  switch (t) {
386
398
  case "Ctrl":
387
399
  i = !0;
@@ -392,7 +404,7 @@ var W = t => 1 === t.nodeType, F = t => 8 === t.nodeType, U = new Map([ [ "BR",
392
404
  break;
393
405
 
394
406
  case "Mod":
395
- dt ? l = !0 : i = !0;
407
+ pt ? l = !0 : i = !0;
396
408
  break;
397
409
 
398
410
  case "Alt":
@@ -407,18 +419,18 @@ var W = t => 1 === t.nodeType, F = t => 8 === t.nodeType, U = new Map([ [ "BR",
407
419
  };
408
420
  };
409
421
 
410
- function ht(t) {
411
- let e = 0, o = 0, r = !1;
422
+ function yt(t) {
423
+ let e = 0, r = 0, o = !1;
412
424
  const c = Date.now, s = [ [ t.doc, t.selection, [] ] ], i = () => s[e], l = () => e > 0, a = () => e < s.length - 1, f = e => {
413
- t.exec(I, e.children);
414
- const o = e, r = t.doc;
415
- for (const c of n(o)) "children" !== c && r[c] !== o[c] && t.apply({
425
+ t.exec(Y, e.children);
426
+ const r = e, o = t.doc;
427
+ for (const c of n(r)) "children" !== c && o[c] !== r[c] && t.apply({
416
428
  type: "patch_node",
417
429
  path: [],
418
430
  key: c,
419
- value: o[c]
431
+ value: r[c]
420
432
  });
421
- for (const c of n(r)) "children" === c || c in o || t.apply({
433
+ for (const c of n(o)) "children" === c || c in r || t.apply({
422
434
  type: "patch_node",
423
435
  path: [],
424
436
  key: c,
@@ -428,33 +440,33 @@ function ht(t) {
428
440
  if (l()) {
429
441
  const n = i()[1];
430
442
  e--;
431
- const o = t.doc;
432
- r = !0, f(i()[0]), r = !1, o !== t.doc && (t.selection = n);
443
+ const r = t.doc;
444
+ o = !0, f(i()[0]), o = !1, r !== t.doc && (t.selection = n);
433
445
  }
434
446
  }, d = () => {
435
447
  if (a()) {
436
448
  e++;
437
- const [n, o, c] = i(), s = t.doc;
438
- r = !0, f(n), r = !1, s !== t.doc && (t.selection = [ at(o[0], c), at(o[1], c) ]);
449
+ const [n, r, c] = i(), s = t.doc;
450
+ o = !0, f(n), o = !1, s !== t.doc && (t.selection = [ H(r[0], c), H(r[1], c) ]);
439
451
  }
440
452
  };
441
453
  t.hook("apply", (n, i) => {
442
- if (r) return;
454
+ if (o) return;
443
455
  const l = t.doc, a = t.selection;
444
456
  i(n);
445
457
  const f = t.doc;
446
458
  if (l !== f) {
447
459
  const t = c();
448
- if (0 === e || t - o >= 500) {
460
+ if (0 === e || t - r >= 500) {
449
461
  e++;
450
462
  const t = [ l, a, [] ];
451
463
  e >= s.length ? s.push(t) : s[e] = t;
452
464
  }
453
- o = t, s[e][0] = f, s[e][2].push(n), s.length > e + 1 && (s.length = e + 1), e > 500 && (e--,
465
+ r = t, s[e][0] = f, s[e][2].push(n), s.length > e + 1 && (s.length = e + 1), e > 500 && (e--,
454
466
  s.shift());
455
467
  }
456
- }), t.hook("keyboard", pt("Mod+Z", u)), t.hook("keyboard", pt("Shift+Mod+Z", d)),
457
- t.set(ht, {
468
+ }), t.hook("keyboard", ht("Mod+Z", u)), t.hook("keyboard", ht("Shift+Mod+Z", d)),
469
+ t.set(yt, {
458
470
  undo: u,
459
471
  redo: d,
460
472
  undoable: l,
@@ -462,25 +474,25 @@ function ht(t) {
462
474
  });
463
475
  }
464
476
 
465
- function yt(t) {
466
- t.get(ht).undo();
477
+ function kt(t) {
478
+ t.get(yt).undo();
467
479
  }
468
480
 
469
481
  function mt(t) {
470
- t.get(ht).redo();
482
+ t.get(yt).redo();
471
483
  }
472
484
 
473
485
  function gt(t) {
474
- return t.get(ht).undoable();
486
+ return t.get(yt).undoable();
475
487
  }
476
488
 
477
- function kt(t) {
478
- return t.get(ht).redoable();
489
+ function _t(t) {
490
+ return t.get(yt).redoable();
479
491
  }
480
492
 
481
- var _t = [], xt = () => {}, vt = t => {
493
+ var bt = [], xt = () => {}, vt = t => {
482
494
  throw Error(t);
483
- }, bt = ({doc: t, readonly: e = !1, schema: n, isBlock: o = q, onWarn: a = console.warn, onError: f = vt}) => {
495
+ }, Tt = ({doc: t, readonly: e = !1, schema: n, isBlock: r = rt, onWarn: a = console.warn, onError: f = vt}) => {
484
496
  let u = [ 0, 0 ];
485
497
  const d = t => {
486
498
  if (!n) return a("An unsafe operation was detected. We recommend using schema option."),
@@ -493,69 +505,69 @@ var _t = [], xt = () => {}, vt = t => {
493
505
  return !1;
494
506
  };
495
507
  n && !d(t) && f("Invalid document");
496
- const y = /* @__PURE__ */ new Map, m = /* @__PURE__ */ new WeakMap, k = t => y.get(t) || _t, x = /* @__PURE__ */ new Map, v = /* @__PURE__ */ new Set, b = t => {
497
- const e = x.get(t);
498
- e && (v.size || s(() => {
499
- v.forEach(t => {
508
+ const y = /* @__PURE__ */ new Map, k = /* @__PURE__ */ new WeakMap, m = t => y.get(t) || bt, _ = /* @__PURE__ */ new Map, x = /* @__PURE__ */ new Set, v = t => {
509
+ const e = _.get(t);
510
+ e && (x.size || s(() => {
511
+ x.forEach(t => {
500
512
  t();
501
- }), v.clear();
513
+ }), x.clear();
502
514
  }), e.forEach(t => {
503
- v.add(t);
515
+ x.add(t);
504
516
  }));
505
517
  }, T = t => {
506
- if (!e) if (Array.isArray(t)) for (const e of t) w(e); else w(t);
507
- return O;
508
- }, w = e => {
509
- const n = t, o = k("apply"), r = o.length;
518
+ if (!e) if (Array.isArray(t)) for (const e of t) E(e); else E(t);
519
+ return D;
520
+ }, E = e => {
521
+ const n = t, r = m("apply"), o = r.length;
510
522
  let c = 0;
511
523
  const s = () => {
512
- if (c < r) {
524
+ if (c < o) {
513
525
  const t = c;
514
- o[c](e, f), t === c && f();
515
- } else if (c === r) {
526
+ r[c](e, f), t === c && f(e);
527
+ } else if (c === o) {
516
528
  c++;
517
529
  try {
518
- const [n, o] = ((t, e, n) => {
530
+ const [n, r] = ((t, e, n) => {
519
531
  switch (n.type) {
520
- case tt:
532
+ case S:
521
533
  {
522
- const [o, r] = n.range;
523
- lt(t, o) && lt(t, r) && o < r && (t = it(t, o, r, []), e = ut(e, n));
534
+ const [r, o] = n.range;
535
+ P(t, r) && P(t, o) && r < o && (t = L(t, r, o, []), e = C(e, n));
524
536
  break;
525
537
  }
526
538
 
527
- case et:
539
+ case A:
528
540
  {
529
- const {at: o, text: r} = n;
530
- if (lt(t, o) && r) {
531
- const [c, s] = h(t, o), l = p(c, s, !0);
541
+ const {at: r, text: o} = n;
542
+ if (P(t, r) && o) {
543
+ const [c, s] = h(t, r), l = p(c, s, !0);
532
544
  let a;
533
545
  if (l) {
534
546
  const t = l[0];
535
547
  i(t) && (a = t);
536
548
  }
537
- t = it(t, o, o, $(r, a, c)), e = ut(e, n);
549
+ t = L(t, r, r, w(o, a, c)), e = C(e, n);
538
550
  }
539
551
  break;
540
552
  }
541
553
 
542
- case nt:
554
+ case O:
543
555
  {
544
- const {at: o, fragment: r} = n;
545
- lt(t, o) && r.length && (t = it(t, o, o, r), e = ut(e, n));
556
+ const {at: r, fragment: o} = n;
557
+ P(t, r) && o.length && (t = L(t, r, r, o), e = C(e, n));
546
558
  break;
547
559
  }
548
560
 
549
561
  case "format":
550
562
  {
551
- const {range: [e, o], key: r, value: c} = n;
552
- if (lt(t, e) && lt(t, o) && e <= o) if (e === o) {
553
- const [{children: n}, , o] = h(t, e);
563
+ const {range: [e, r], key: o, value: c} = n;
564
+ if (P(t, e) && P(t, r) && e <= r) if (e === r) {
565
+ const [{children: n}, , r] = h(t, e);
554
566
  if (1 === n.length) {
555
567
  const e = n[0];
556
- i(e) && !e.text && (t = st(t, [ ...o, 0 ], {
568
+ i(e) && !e.text && (t = I(t, [ ...r, 0 ], {
557
569
  ...e,
558
- [r]: c
570
+ [o]: c
559
571
  }));
560
572
  }
561
573
  } else {
@@ -564,41 +576,41 @@ var _t = [], xt = () => {}, vt = t => {
564
576
  children: t.children.map(n)
565
577
  } : i(t) ? {
566
578
  ...t,
567
- [r]: c
579
+ [o]: c
568
580
  } : t;
569
- t = it(t, e, o, E(t, e, o).map(n));
581
+ t = L(t, e, r, M(t, e, r).map(n));
570
582
  }
571
583
  break;
572
584
  }
573
585
 
574
586
  case "patch_node":
575
587
  {
576
- const {path: e, key: o, value: r} = n, c = ((t, e) => {
588
+ const {path: e, key: r, value: o} = n, c = ((t, e) => {
577
589
  for (let n = 0; n < e.length; n++) t = t.children[e[n]];
578
590
  return t;
579
591
  })(t, e);
580
- c && (t = st(t, e, {
592
+ c && (t = I(t, e, {
581
593
  ...c,
582
- [o]: r
594
+ [r]: o
583
595
  }));
584
596
  break;
585
597
  }
586
598
  }
587
599
  return [ t, e ];
588
600
  })(t, u, e);
589
- (({type: t}) => t !== et && t !== tt)(e) && !d(n) || (t = n, A(o));
601
+ (({type: t}) => t !== A && t !== S)(e) && !d(n) || (t = n, R(r));
590
602
  } catch (n) {
591
603
  a("rollback operation: " + n);
592
604
  }
593
605
  }
594
606
  }, f = t => {
595
- t && (e = t), c++, s();
607
+ null != t ? (e = t, c++, s()) : c = o + 1;
596
608
  };
597
- s(), n !== t && b("change");
598
- }, A = e => {
599
- !((t, [e, n]) => lt(t, e) && lt(t, n))(t, e) || u[0] === e[0] && u[1] === e[1] || (u = e,
600
- b("selectionchange"));
601
- }, O = {
609
+ s(), n !== t && v("change");
610
+ }, R = e => {
611
+ !((t, [e, n]) => P(t, e) && P(t, n))(t, e) || u[0] === e[0] && u[1] === e[1] || (u = e,
612
+ v("selectionchange"));
613
+ }, D = {
602
614
  get doc() {
603
615
  return t;
604
616
  },
@@ -606,18 +618,18 @@ var _t = [], xt = () => {}, vt = t => {
606
618
  return u;
607
619
  },
608
620
  set selection(t) {
609
- A(t);
621
+ R(t);
610
622
  },
611
623
  get readonly() {
612
624
  return e;
613
625
  },
614
626
  set readonly(t) {
615
- e = t, b("readonly");
627
+ e = t, v("readonly");
616
628
  },
617
629
  apply: T,
618
630
  on: (t, e) => {
619
- let n = x.get(t);
620
- return n || x.set(t, n = /* @__PURE__ */ new Set), n.add(e), () => {
631
+ let n = _.get(t);
632
+ return n || _.set(t, n = /* @__PURE__ */ new Set), n.add(e), () => {
621
633
  n.delete(e);
622
634
  };
623
635
  },
@@ -629,47 +641,47 @@ var _t = [], xt = () => {}, vt = t => {
629
641
  };
630
642
  },
631
643
  exec: (t, ...e) => {
632
- const n = t(O, ...e);
633
- return void 0 === n ? O : n;
644
+ const n = t(D, ...e);
645
+ return void 0 === n ? D : n;
634
646
  },
635
- get: t => (m.has(t) || f("No value found for key"), m.get(t)),
636
- set: (t, e) => (m.set(t, e), O),
647
+ get: t => (k.has(t) || f("No value found for key"), k.get(t)),
648
+ set: (t, e) => (k.set(t, e), D),
637
649
  input: n => {
638
650
  if (!window.InputEvent || !c(InputEvent.prototype.getTargetRanges)) return a("beforeinput event is not supported."),
639
651
  xt;
640
652
  const {contentEditable: s, role: i, ariaMultiLine: l, ariaReadOnly: f} = n, d = n.style.whiteSpace;
641
653
  n.role = "textbox", n.style.whiteSpace = "pre-wrap", n.ariaMultiLine = "true";
642
- let p = !1, h = null, y = !1, m = !1, x = !1, v = u, b = null;
643
- const E = G(n), w = ((t, e) => {
644
- let n = null, o = null, r = null;
654
+ let p = !1, h = null, y = !1, k = !1, _ = !1, x = u, v = null;
655
+ const E = ct(n), M = ((t, e) => {
656
+ let n = null, r = null, o = null;
645
657
  const c = () => {
646
- if (null != r) return r;
647
- if (o) if ((t => 3 === t.nodeType)(o)) {
648
- const t = o.data;
649
- if (t) return r = "\n" === t ? i() ? 3 : 5 : 1;
650
- } else if (W(o)) {
651
- if ("false" === o.contentEditable) return r = 2;
658
+ if (null != o) return o;
659
+ if (r) if ((t => 3 === t.nodeType)(r)) {
660
+ const t = r.data;
661
+ if (t) return o = "\n" === t ? i() ? 3 : 5 : 1;
662
+ } else if ($(r)) {
663
+ if ("false" === r.contentEditable) return o = 2;
652
664
  {
653
- const t = U.get(o.tagName);
654
- if (null != t) return r = 1 === t ? i() ? 3 : 5 : 3 === t ? 2 : 6;
655
- if (e(o)) return r = 4;
665
+ const t = et.get(r.tagName);
666
+ if (null != t) return o = 1 === t ? i() ? 3 : 5 : 3 === t ? 2 : 6;
667
+ if (e(r)) return o = 4;
656
668
  }
657
- } else if (!(t => 11 === t.nodeType)(o)) return r = 6;
658
- return r = 0;
669
+ } else if (!(t => 11 === t.nodeType)(r)) return o = 6;
670
+ return o = 0;
659
671
  }, s = () => {
660
672
  const t = c();
661
- if (r = null, 2 === t || 6 === t) {
662
- const t = o;
663
- if (o = n.nextSibling(), !o) for (;(o = n.nextNode()) && t.contains(o); ) ;
664
- return o;
673
+ if (o = null, 2 === t || 6 === t) {
674
+ const t = r;
675
+ if (r = n.nextSibling(), !r) for (;(r = n.nextNode()) && t.contains(r); ) ;
676
+ return r;
665
677
  }
666
- return o = n.nextNode();
678
+ return r = n.nextNode();
667
679
  }, i = () => {
668
- const t = o.parentNode;
680
+ const t = r.parentNode;
669
681
  return a(() => {
670
- for (r = 0; s(); ) {
682
+ for (o = 0; s(); ) {
671
683
  if (c()) return !0;
672
- if (!t.contains(o)) break;
684
+ if (!t.contains(r)) break;
673
685
  }
674
686
  return !1;
675
687
  });
@@ -680,67 +692,67 @@ var _t = [], xt = () => {}, vt = t => {
680
692
  if (t && 6 !== t) return t;
681
693
  }
682
694
  },
683
- m: c,
684
- i: () => o,
695
+ k: c,
696
+ i: () => r,
685
697
  l: () => {
686
698
  const t = c();
687
- return 1 === t ? o.data.length : 2 === t ? 1 : 0;
699
+ return 1 === t ? r.data.length : 2 === t ? 1 : 0;
688
700
  },
689
701
  u: t => {
690
- r = null, n.currentNode = o = t;
702
+ o = null, n.currentNode = r = t;
691
703
  },
692
704
  h: () => {
693
- for (;(r = null) || (o = n.previousSibling()); ) if (4 === c()) return;
705
+ for (;(o = null) || (r = n.previousSibling()); ) if (4 === c()) return;
694
706
  },
695
707
  o: () => {
696
- for (;(r = null) || (o = n.nextSibling()); ) if (4 === c()) return;
708
+ for (;(o = null) || (r = n.nextSibling()); ) if (4 === c()) return;
697
709
  },
698
710
  p: () => {
699
- for (;(r = null) || (o = n.parentNode()); ) if (4 === c()) return;
711
+ for (;(o = null) || (r = n.parentNode()); ) if (4 === c()) return;
700
712
  }
701
713
  }, a = (e, c) => {
702
- const s = n, i = o, a = r;
714
+ const s = n, i = r, a = o;
703
715
  try {
704
- return n || (n = t.createTreeWalker(o = c, 5)), e(l);
716
+ return n || (n = t.createTreeWalker(r = c, 5)), e(l);
705
717
  } finally {
706
- n = s, o = i, r = a, n && i && (n.currentNode = i);
718
+ n = s, r = i, o = a, n && i && (n.currentNode = i);
707
719
  }
708
720
  };
709
721
  return a;
710
- })(E, o), R = () => {
722
+ })(E, r), w = () => {
711
723
  n.contentEditable = e ? "false" : "true", n.ariaReadOnly = e ? "true" : null;
712
724
  };
713
- R();
714
- const D = () => {
715
- m || n.focus({
725
+ w();
726
+ const S = () => {
727
+ k || n.focus({
716
728
  preventScroll: !0
717
729
  });
718
- }, B = () => {
719
- b = null, u[0] === v[0] && u[1] === v[1] || (Z(n, w, t, u), v = u);
720
- }, I = () => {
721
- null != b && clearTimeout(b);
722
- }, L = O.on("change", () => {
723
- m || requestAnimationFrame(D);
724
- }), P = O.on("selectionchange", () => {
725
- u[0] === v[0] && u[1] === v[1] || (I(), b = setTimeout(B, 50));
726
- }), H = O.on("readonly", R), N = t => {
727
- for (const e of k("paste")) {
730
+ }, A = () => {
731
+ v = null, u[0] === x[0] && u[1] === x[1] || (at(n, M, t, u), x = u);
732
+ }, O = () => {
733
+ null != v && clearTimeout(v);
734
+ }, B = D.on("change", () => {
735
+ k || requestAnimationFrame(S);
736
+ }), I = D.on("selectionchange", () => {
737
+ u[0] === x[0] && u[1] === x[1] || (O(), v = setTimeout(A, 50));
738
+ }), L = D.on("readonly", w), P = t => {
739
+ for (const e of m("paste")) {
728
740
  const n = e(t);
729
741
  if (n) return n;
730
742
  }
731
743
  a("failed to serialize pasted data");
732
- }, C = ((t, e) => {
733
- let n = !1, o = [];
734
- const r = t => {
735
- n && o.push(...t);
744
+ }, N = ((t, e) => {
745
+ let n = !1, r = [];
746
+ const o = t => {
747
+ n && r.push(...t);
736
748
  }, c = new MutationObserver(t => {
737
- r(t), n || e();
749
+ o(t), n || e();
738
750
  }), s = () => {
739
- r(c.takeRecords());
751
+ o(c.takeRecords());
740
752
  }, i = () => {
741
753
  s();
742
- const t = o;
743
- return o = [], t;
754
+ const t = r;
755
+ return r = [], t;
744
756
  };
745
757
  return c.observe(t, {
746
758
  characterData: !0,
@@ -748,12 +760,12 @@ var _t = [], xt = () => {}, vt = t => {
748
760
  childList: !0,
749
761
  subtree: !0
750
762
  }), {
751
- k: t => {
763
+ m: t => {
752
764
  let e;
753
765
  for (;e = t.pop(); ) if ("childList" === e.type) {
754
- const {target: t, removedNodes: n, addedNodes: o, nextSibling: r} = e;
755
- for (let e = n.length - 1; e >= 0; e--) t.insertBefore(n[e], r);
756
- for (let e = o.length - 1; e >= 0; e--) t.removeChild(o[e]);
766
+ const {target: t, removedNodes: n, addedNodes: r, nextSibling: o} = e;
767
+ for (let e = n.length - 1; e >= 0; e--) t.insertBefore(n[e], o);
768
+ for (let e = r.length - 1; e >= 0; e--) t.removeChild(r[e]);
757
769
  } else e.target.data = e.oldValue;
758
770
  i();
759
771
  },
@@ -762,42 +774,42 @@ var _t = [], xt = () => {}, vt = t => {
762
774
  },
763
775
  v: i,
764
776
  T: () => {
765
- o.length = 0, c.disconnect();
777
+ r.length = 0, c.disconnect();
766
778
  }
767
779
  };
768
780
  })(n, () => {
769
- I(), Z(n, w, t, u);
770
- }), F = () => {
771
- A(v = _(t, ((t, e) => {
772
- const n = J(t), o = Y(n, t);
773
- if (!o) return [ [ [ 0 ], 0 ], [ [ 0 ], 0 ] ];
774
- const r = Q(t, e, o), c = z(n.anchorNode, n.focusNode);
775
- return (0 === c ? n.anchorOffset > n.focusOffset : 2 & c) ? [ r[1], r[0] ] : r;
776
- })(n, w)));
777
- }, V = () => {
778
- const e = C.v();
779
- C._(!1), e.length && (C.k(e), E.removeEventListener("selectionchange", ot), Z(n, w, t, u, !0),
780
- E.addEventListener("selectionchange", ot)), h && (A(h[1]), T(h[0]), h = null), y = !1;
781
- }, q = t => {
782
- if (!y) for (const e of k("keyboard")) if (e(t)) return t.preventDefault(), void C._(!1);
783
- }, X = () => {
784
- y || V();
785
- }, j = e => {
781
+ O(), at(n, M, t, u);
782
+ }), C = () => {
783
+ R(x = b(t, ((t, e) => {
784
+ const n = st(t), r = it(n, t);
785
+ if (!r) return [ [ [ 0 ], 0 ], [ [ 0 ], 0 ] ];
786
+ const o = dt(t, e, r), c = ot(n.anchorNode, n.focusNode);
787
+ return (0 === c ? n.anchorOffset > n.focusOffset : 2 & c) ? [ o[1], o[0] ] : o;
788
+ })(n, M)));
789
+ }, U = () => {
790
+ const e = N.v();
791
+ N._(!1), e.length && (N.m(e), E.removeEventListener("selectionchange", Z), at(n, M, t, u, !0),
792
+ E.addEventListener("selectionchange", Z)), h && (R(h[1]), T(h[0]), h = null), y = !1;
793
+ }, V = t => {
794
+ if (!y) for (const e of m("keyboard")) if (e(t)) return t.preventDefault(), void N._(!1);
795
+ }, q = () => {
796
+ y || U();
797
+ }, z = e => {
786
798
  e.preventDefault();
787
- const o = e.inputType;
788
- if (o.startsWith("format")) return;
789
- if ("historyUndo" === o || "historyRedo" === o) return;
790
- y ? C._(!0) : F();
791
- const r = e.getTargetRanges()[0];
792
- if (r) {
793
- let c = "insertParagraph" === o || "insertLineBreak" === o ? "\n" : e.data;
799
+ const r = e.inputType;
800
+ if (r.startsWith("format")) return;
801
+ if ("historyUndo" === r || "historyRedo" === r) return;
802
+ y ? N._(!0) : C();
803
+ const o = e.getTargetRanges()[0];
804
+ if (o) {
805
+ let c = "insertParagraph" === r || "insertLineBreak" === r ? "\n" : e.data;
794
806
  if (null == c) {
795
807
  const t = e.dataTransfer;
796
808
  t && (c = t.getData("text/plain"));
797
809
  }
798
810
  h || (h = [ [], u ]);
799
- const s = h[0], i = _(t, Q(n, w, r));
800
- S(i) || s.push({
811
+ const s = h[0], i = b(t, dt(n, M, o));
812
+ F(i) || s.push({
801
813
  type: "delete",
802
814
  range: i
803
815
  }), c && s.push({
@@ -806,35 +818,35 @@ var _t = [], xt = () => {}, vt = t => {
806
818
  text: c
807
819
  });
808
820
  }
809
- y || V();
810
- }, $ = () => {
811
- y || F(), y = !0;
812
- }, tt = () => {
813
- V();
814
- }, et = () => {
815
- m = !0, F();
816
- }, nt = () => {
817
- m = !1;
818
- }, ot = () => {
819
- !m || y || x || F();
820
- }, rt = t => {
821
- if (F(), !S(u)) for (const e of k("copy")) e(t);
822
- }, ct = t => {
823
- t.preventDefault(), rt(t.clipboardData);
824
- }, st = t => {
825
- t.preventDefault(), e || (rt(t.clipboardData), T({
821
+ y || U();
822
+ }, G = () => {
823
+ y || C(), y = !0;
824
+ }, J = () => {
825
+ U();
826
+ }, Y = () => {
827
+ k = !0, C();
828
+ }, X = () => {
829
+ k = !1;
830
+ }, Z = () => {
831
+ !k || y || _ || C();
832
+ }, j = t => {
833
+ if (C(), !F(u)) for (const e of m("copy")) e(t);
834
+ }, K = t => {
835
+ t.preventDefault(), j(t.clipboardData);
836
+ }, Q = t => {
837
+ t.preventDefault(), e || (j(t.clipboardData), T({
826
838
  type: "delete",
827
- range: M(u)
839
+ range: W(u)
828
840
  }));
829
- }, it = t => {
841
+ }, tt = t => {
830
842
  t.preventDefault();
831
- const e = N(t.clipboardData);
843
+ const e = P(t.clipboardData);
832
844
  if (e) {
833
- const t = M(u), n = t[0], o = [ {
845
+ const t = W(u), n = t[0], r = [ {
834
846
  type: "delete",
835
847
  range: t
836
848
  } ];
837
- o.push(r(e) ? {
849
+ r.push(o(e) ? {
838
850
  type: "insert_text",
839
851
  at: n,
840
852
  text: e
@@ -842,31 +854,31 @@ var _t = [], xt = () => {}, vt = t => {
842
854
  type: "insert_node",
843
855
  at: n,
844
856
  fragment: e
845
- }), T(o);
857
+ }), T(r);
846
858
  }
847
- }, lt = e => {
859
+ }, nt = e => {
848
860
  e.preventDefault();
849
- const o = e.dataTransfer, c = ((t, e, {clientX: n, clientY: o}) => {
850
- const r = G(t);
851
- if (r.caretPositionFromPoint) {
852
- const c = r.caretPositionFromPoint(n, o);
853
- if (c) return K(t, e, c.offsetNode, c.offset);
854
- } else if (r.caretRangeFromPoint) {
855
- const c = r.caretRangeFromPoint(n, o);
856
- if (c) return K(t, e, c.startContainer, c.startOffset);
861
+ const r = e.dataTransfer, c = ((t, e, {clientX: n, clientY: r}) => {
862
+ const o = ct(t);
863
+ if (o.caretPositionFromPoint) {
864
+ const c = o.caretPositionFromPoint(n, r);
865
+ if (c) return ut(t, e, c.offsetNode, c.offset);
866
+ } else if (o.caretRangeFromPoint) {
867
+ const c = o.caretRangeFromPoint(n, r);
868
+ if (c) return ut(t, e, c.startContainer, c.startOffset);
857
869
  }
858
- })(n, w, e);
859
- if (o && c) {
870
+ })(n, M, e);
871
+ if (r && c) {
860
872
  let e;
861
873
  const n = [];
862
- x && n.push({
874
+ _ && n.push({
863
875
  type: "delete",
864
- range: M(u)
876
+ range: W(u)
865
877
  });
866
- const s = N(o);
878
+ const s = P(r);
867
879
  if (s) {
868
- const o = g(t, c), i = at(o, n);
869
- n.push(r(s) ? {
880
+ const r = g(t, c), i = H(r, n);
881
+ n.push(o(s) ? {
870
882
  type: "insert_text",
871
883
  at: i,
872
884
  text: s
@@ -874,40 +886,40 @@ var _t = [], xt = () => {}, vt = t => {
874
886
  type: "insert_node",
875
887
  at: i,
876
888
  fragment: s
877
- }), e = [ i, at(o, n) ];
889
+ }), e = [ i, H(r, n) ];
878
890
  }
879
- T(n), e && A(e);
891
+ T(n), e && R(e);
880
892
  }
881
- x = !1;
882
- }, ft = t => {
883
- x = !0, rt(t.dataTransfer);
884
- }, ut = () => {
885
- x = !1;
893
+ _ = !1;
894
+ }, rt = t => {
895
+ _ = !0, j(t.dataTransfer);
896
+ }, lt = () => {
897
+ _ = !1;
886
898
  };
887
- E.addEventListener("selectionchange", ot), n.addEventListener("keydown", q), n.addEventListener("input", X),
888
- n.addEventListener("beforeinput", j), n.addEventListener("compositionstart", $),
889
- n.addEventListener("compositionend", tt), n.addEventListener("focus", et), n.addEventListener("blur", nt),
890
- n.addEventListener("copy", ct), n.addEventListener("cut", st), n.addEventListener("paste", it),
891
- n.addEventListener("drop", lt), n.addEventListener("dragstart", ft), n.addEventListener("dragend", ut);
892
- const dt = [];
893
- return k("mount").forEach(t => {
894
- const e = t(n, w);
895
- e && dt.push(e);
899
+ E.addEventListener("selectionchange", Z), n.addEventListener("keydown", V), n.addEventListener("input", q),
900
+ n.addEventListener("beforeinput", z), n.addEventListener("compositionstart", G),
901
+ n.addEventListener("compositionend", J), n.addEventListener("focus", Y), n.addEventListener("blur", X),
902
+ n.addEventListener("copy", K), n.addEventListener("cut", Q), n.addEventListener("paste", tt),
903
+ n.addEventListener("drop", nt), n.addEventListener("dragstart", rt), n.addEventListener("dragend", lt);
904
+ const ft = [];
905
+ return m("mount").forEach(t => {
906
+ const e = t(n, M);
907
+ e && ft.push(e);
896
908
  }), () => {
897
- p || (p = !0, L(), P(), H(), n.contentEditable = s, n.role = i, n.ariaMultiLine = l,
898
- n.ariaReadOnly = f, n.style.whiteSpace = d, C.T(), E.removeEventListener("selectionchange", ot),
899
- n.removeEventListener("keydown", q), n.removeEventListener("input", X), n.removeEventListener("beforeinput", j),
900
- n.removeEventListener("compositionstart", $), n.removeEventListener("compositionend", tt),
901
- n.removeEventListener("focus", et), n.removeEventListener("blur", nt), n.removeEventListener("copy", ct),
902
- n.removeEventListener("cut", st), n.removeEventListener("paste", it), n.removeEventListener("drop", lt),
903
- n.removeEventListener("dragstart", ft), n.removeEventListener("dragend", ut), dt.forEach(t => {
909
+ p || (p = !0, B(), I(), L(), n.contentEditable = s, n.role = i, n.ariaMultiLine = l,
910
+ n.ariaReadOnly = f, n.style.whiteSpace = d, N.T(), E.removeEventListener("selectionchange", Z),
911
+ n.removeEventListener("keydown", V), n.removeEventListener("input", q), n.removeEventListener("beforeinput", z),
912
+ n.removeEventListener("compositionstart", G), n.removeEventListener("compositionend", J),
913
+ n.removeEventListener("focus", Y), n.removeEventListener("blur", X), n.removeEventListener("copy", K),
914
+ n.removeEventListener("cut", Q), n.removeEventListener("paste", tt), n.removeEventListener("drop", nt),
915
+ n.removeEventListener("dragstart", rt), n.removeEventListener("dragend", lt), ft.forEach(t => {
904
916
  t();
905
917
  }));
906
918
  };
907
919
  }
908
920
  };
909
- return O.exec(ht), O;
910
- }, Tt = (t, e) => {
921
+ return D.exec(yt), D;
922
+ }, Et = (t, e) => {
911
923
  t.hook("paste", t => {
912
924
  for (const n of t.items) if ("file" === n.kind) {
913
925
  const t = e[n.type];
@@ -922,22 +934,22 @@ var _t = [], xt = () => {}, vt = t => {
922
934
  });
923
935
  };
924
936
 
925
- function Et(t, e) {
937
+ function Mt(t, e) {
926
938
  const n = e && e.voidToString;
927
939
  t.hook("copy", e => {
928
- e.setData("text/plain", T(t.doc, ...M(t.selection), n));
940
+ e.setData("text/plain", E(t.doc, ...W(t.selection), n));
929
941
  }), t.hook("paste", t => t.getData("text/plain"));
930
942
  }
931
943
 
932
- function Mt(t, e) {
933
- t.hook("mount", (n, o) => {
934
- const r = t.hook("copy", t => {
944
+ function wt(t, e) {
945
+ t.hook("mount", (n, r) => {
946
+ const o = t.hook("copy", t => {
935
947
  const e = document.createElement("div");
936
- e.appendChild(Y(J(n), n).cloneContents()), t.setData("text/html", e.innerHTML);
948
+ e.appendChild(it(st(n), n).cloneContents()), t.setData("text/html", e.innerHTML);
937
949
  }), c = t.hook("paste", t => {
938
950
  const n = t.getData("text/html");
939
951
  return n ? ((t, e, n) => {
940
- const o = n.text, r = t => {
952
+ const r = n.text, o = t => {
941
953
  const e = n[t.tagName.toLowerCase()];
942
954
  if (e) {
943
955
  const n = e(t);
@@ -945,12 +957,12 @@ function Mt(t, e) {
945
957
  }
946
958
  };
947
959
  let c = (new DOMParser).parseFromString(t, "text/html").body, s = !1;
948
- for (const i of [ ...c.childNodes ]) F(i) ? "StartFragment" === i.data ? (s = !0,
960
+ for (const i of [ ...c.childNodes ]) tt(i) ? "StartFragment" === i.data ? (s = !0,
949
961
  c = new DocumentFragment) : "EndFragment" === i.data && (s = !1) : s && c.appendChild(i);
950
962
  return e(({t, i: e}) => {
951
963
  let n, c = null, s = "", i = !1;
952
964
  const l = [], a = () => {
953
- s && (c || (c = []), c.push(o(s)), s = "");
965
+ s && (c || (c = []), c.push(r(s)), s = "");
954
966
  }, f = () => {
955
967
  a(), !c && i && (c = []), c && l.push({
956
968
  children: c
@@ -958,26 +970,26 @@ function Mt(t, e) {
958
970
  };
959
971
  for (;n = t(); ) if (4 === n) f(); else if (i = !0, 1 === n) s += e().data; else if (2 === n) {
960
972
  a();
961
- const t = r(e());
973
+ const t = o(e());
962
974
  t && c.push(t);
963
975
  } else 3 === n && f();
964
976
  return f(), l.length || l.push({
965
977
  children: []
966
978
  }), l;
967
979
  }, c);
968
- })(n, o, e.serializers) : null;
980
+ })(n, r, e.serializers) : null;
969
981
  });
970
982
  return () => {
971
- r(), c();
983
+ o(), c();
972
984
  };
973
985
  });
974
986
  }
975
987
 
976
988
  var St = "application/x-editate-editor";
977
989
 
978
- function wt(t) {
990
+ function At(t) {
979
991
  t.hook("copy", e => {
980
- e.setData(St, JSON.stringify(E(t.doc, ...M(t.selection))));
992
+ e.setData(St, JSON.stringify(M(t.doc, ...W(t.selection))));
981
993
  }), t.hook("paste", t => {
982
994
  try {
983
995
  return JSON.parse(t.getData(St));
@@ -987,7 +999,64 @@ function wt(t) {
987
999
  });
988
1000
  }
989
1001
 
990
- function At(t) {
1002
+ function Ot(t, e) {
1003
+ const n = e.isLocked, r = e => n(h(t.doc, e)[0]), o = (e, r) => {
1004
+ const [o, c] = e;
1005
+ for (const [s, i] of v(t.doc, e)) {
1006
+ const t = i + d(s);
1007
+ if ((r ? c >= i && o <= t : c > i && o < t) && n(s)) return !0;
1008
+ }
1009
+ return !1;
1010
+ };
1011
+ let c = !1;
1012
+ t.hook("apply", (e, i) => {
1013
+ const a = c;
1014
+ switch (c = !1, e.type) {
1015
+ case "delete":
1016
+ if (o(W(e.range), !0)) return c = !0, s(() => {
1017
+ c = !1;
1018
+ }), i(null);
1019
+ break;
1020
+
1021
+ case "insert_text":
1022
+ case "insert_node":
1023
+ if (a || r(e.at)) return i(null);
1024
+ break;
1025
+
1026
+ case "format":
1027
+ {
1028
+ const t = W(e.range);
1029
+ if (F(t) ? r(t[0]) : o(t, !1)) return i(null);
1030
+ break;
1031
+ }
1032
+
1033
+ case "patch_node":
1034
+ {
1035
+ const r = e.path;
1036
+ let o = t.doc;
1037
+ for (let t = 0; t < r.length; t++) {
1038
+ const e = o.children?.[r[t]];
1039
+ if (!e) break;
1040
+ if (o = e, t < r.length - 1 && l(o) && n(o)) return i(null);
1041
+ }
1042
+ if (o !== t.doc && l(o) && n(o) && n({
1043
+ ...o,
1044
+ [e.key]: e.value
1045
+ })) return i(null);
1046
+ break;
1047
+ }
1048
+ }
1049
+ i(e);
1050
+ }), t.set(Ot, {
1051
+ locked: t => F(t) ? r(t[0]) : o(t, !0)
1052
+ });
1053
+ }
1054
+
1055
+ function Rt(t, e = W(t.selection)) {
1056
+ return t.get(Ot).locked(e);
1057
+ }
1058
+
1059
+ function Dt(t) {
991
1060
  t.hook("apply", t => {
992
1061
  console.log("apply", t);
993
1062
  }), t.on("change", () => {
@@ -997,55 +1066,55 @@ function At(t) {
997
1066
  });
998
1067
  }
999
1068
 
1000
- function Ot(t, e) {
1069
+ function Bt(t, e) {
1001
1070
  n(e).forEach(n => {
1002
- const o = e[n];
1003
- t.hook("keyboard", pt(n, o));
1071
+ const r = e[n];
1072
+ t.hook("keyboard", ht(n, r));
1004
1073
  });
1005
1074
  }
1006
1075
 
1007
- var Rt = (t, e) => {
1076
+ var It = (t, e) => {
1008
1077
  const n = parseFloat(t);
1009
1078
  return n ? t.endsWith("%") ? n / 100 * e : n : 0;
1010
- }, Dt = (t, e, n, o) => [ t + Rt(n, e), t + e - Rt(o, e) ], Bt = (t, e, [n, o]) => t < n ? t - n : e > o ? e - o : 0, It = (t, e, n) => Math.max(-e, Math.min(t, n - e)), Lt = (t, {smooth: e} = {}) => {
1011
- const n = e ? "smooth" : "auto";
1012
- t.hook("mount", (e, o) => {
1013
- const r = G(e), c = r.defaultView, s = ((t, e, n) => {
1014
- const {body: o, documentElement: r} = e;
1079
+ }, Lt = (t, e, n, r) => [ t + It(n, e), t + e - It(r, e) ], Pt = (t, e, [n, r]) => t < n ? t - n : e > r ? e - r : 0, Ht = (t, e, n) => Math.max(-e, Math.min(t, n - e)), Nt = t => {
1080
+ const e = "auto";
1081
+ t.hook("mount", (n, r) => {
1082
+ const o = ct(n), c = o.defaultView, s = ((t, e, n) => {
1083
+ const {body: r, documentElement: o} = e;
1015
1084
  let c = t;
1016
- for (;c && c !== o && c !== r; ) {
1085
+ for (;c && c !== r && c !== o; ) {
1017
1086
  const {overflowY: t} = n.getComputedStyle(c);
1018
1087
  if ("auto" === t || "scroll" === t || "overlay" === t) return c;
1019
1088
  c = c.parentElement;
1020
1089
  }
1021
1090
  return null;
1022
- })(e, r, c);
1091
+ })(n, o, c);
1023
1092
  let i = null;
1024
1093
  const l = t.on("change", () => {
1025
1094
  null == i && (i = setTimeout(() => {
1026
1095
  i = null;
1027
- const r = X(e, o, t.doc, t.selection);
1028
- let l = r.getBoundingClientRect();
1096
+ const o = lt(n, r, t.doc, t.selection);
1097
+ let l = o.getBoundingClientRect();
1029
1098
  if (!l.height) {
1030
- const t = r.startContainer, e = W(t) ? t : t.parentElement;
1099
+ const t = o.startContainer, e = $(t) ? t : t.parentElement;
1031
1100
  e && (l = e.getBoundingClientRect());
1032
1101
  }
1033
- const a = s ? ((t, e, n, o) => {
1034
- const {scrollLeft: r, scrollTop: c, scrollWidth: s, scrollHeight: i, clientLeft: l, clientTop: a, clientWidth: f, clientHeight: u} = e, d = e.getBoundingClientRect(), p = t.getComputedStyle(e), h = It(Bt(n.top, n.bottom, Dt(d.top + a, u, p.scrollPaddingTop, p.scrollPaddingBottom)), c, i - u), y = It(Bt(n.left, n.right, Dt(d.left + l, f, p.scrollPaddingLeft, p.scrollPaddingRight)), r, s - f);
1102
+ const a = s ? ((t, e, n, r) => {
1103
+ const {scrollLeft: o, scrollTop: c, scrollWidth: s, scrollHeight: i, clientLeft: l, clientTop: a, clientWidth: f, clientHeight: u} = e, d = e.getBoundingClientRect(), p = t.getComputedStyle(e), h = Ht(Pt(n.top, n.bottom, Lt(d.top + a, u, p.scrollPaddingTop, p.scrollPaddingBottom)), c, i - u), y = Ht(Pt(n.left, n.right, Lt(d.left + l, f, p.scrollPaddingLeft, p.scrollPaddingRight)), o, s - f);
1035
1104
  return (h || y) && e.scrollBy({
1036
1105
  top: h,
1037
1106
  left: y,
1038
- behavior: o
1107
+ behavior: r
1039
1108
  }), [ y, h ];
1040
- })(c, s, l, n) : [ 0, 0 ];
1041
- ((t, e, [n, o], r) => {
1042
- const {documentElement: c} = t.document, {clientWidth: s, clientHeight: i} = c, l = t.getComputedStyle(c), a = Bt(e.top - o, e.bottom - o, Dt(0, i, l.scrollPaddingTop, l.scrollPaddingBottom)), f = Bt(e.left - n, e.right - n, Dt(0, s, l.scrollPaddingLeft, l.scrollPaddingRight));
1109
+ })(c, s, l, e) : [ 0, 0 ];
1110
+ ((t, e, [n, r], o) => {
1111
+ const {documentElement: c} = t.document, {clientWidth: s, clientHeight: i} = c, l = t.getComputedStyle(c), a = Pt(e.top - r, e.bottom - r, Lt(0, i, l.scrollPaddingTop, l.scrollPaddingBottom)), f = Pt(e.left - n, e.right - n, Lt(0, s, l.scrollPaddingLeft, l.scrollPaddingRight));
1043
1112
  (a || f) && t.scrollBy({
1044
1113
  top: a,
1045
1114
  left: f,
1046
- behavior: r
1115
+ behavior: o
1047
1116
  });
1048
- })(c, l, a, n);
1117
+ })(c, l, a, e);
1049
1118
  }, 50));
1050
1119
  });
1051
1120
  return () => {
@@ -1054,24 +1123,24 @@ var Rt = (t, e) => {
1054
1123
  });
1055
1124
  };
1056
1125
 
1057
- function Pt(t, e) {
1058
- t.hook("mount", (n, o) => {
1059
- let r = !0, c = !1;
1126
+ function Ct(t, e) {
1127
+ t.hook("mount", (n, r) => {
1128
+ let o = !0, c = !1;
1060
1129
  const s = t.on("selectionchange", () => {
1061
1130
  c || (c = !0, requestAnimationFrame(() => {
1062
- c = !1, r && e(() => {
1131
+ c = !1, o && e(() => {
1063
1132
  const e = t.selection;
1064
- return X(n, o, t.doc, e).getBoundingClientRect();
1133
+ return lt(n, r, t.doc, e).getBoundingClientRect();
1065
1134
  });
1066
1135
  }));
1067
1136
  });
1068
1137
  return () => {
1069
- r = !1, s();
1138
+ o = !1, s();
1070
1139
  };
1071
1140
  });
1072
1141
  }
1073
1142
 
1074
- function Ht(t) {
1143
+ function Wt(t) {
1075
1144
  t.hook("mount", t => {
1076
1145
  t.ariaMultiLine = null;
1077
1146
  }), t.hook("apply", (t, e) => {
@@ -1082,24 +1151,24 @@ function Ht(t) {
1082
1151
  const e = t.fragment;
1083
1152
  t = {
1084
1153
  ...t,
1085
- fragment: a(e) ? [ ct(...e) ] : e
1154
+ fragment: a(e) ? [ B(...e) ] : e
1086
1155
  };
1087
1156
  }
1088
1157
  e(t);
1089
1158
  });
1090
1159
  }
1091
1160
 
1092
- var Nt = ({text: t, singleline: e, onChange: n, ...o}) => {
1093
- const r = bt({
1094
- ...o,
1161
+ var Ft = ({text: t, singleline: e, onChange: n, ...r}) => {
1162
+ const o = Tt({
1163
+ ...r,
1095
1164
  doc: {
1096
- children: $(t)
1165
+ children: w(t)
1097
1166
  }
1098
- }).exec(Et);
1099
- return e && r.exec(Ht), r.on("change", () => {
1100
- n(T(r.doc));
1101
- }), r;
1167
+ }).exec(Mt);
1168
+ return e && o.exec(Wt), o.on("change", () => {
1169
+ n(E(o.doc));
1170
+ }), o;
1102
1171
  };
1103
1172
 
1104
- export { O as Delete, L as Format, D as InsertNode, R as InsertText, A as LeavesInRange, mt as Redo, kt as Redoable, I as ReplaceDoc, B as ReplaceText, H as SetBlockAttr, C as SetVoidAttr, N as ToggleBlockAttr, P as ToggleFormat, yt as Undo, gt as Undoable, bt as createEditor, Nt as createPlainEditor, At as debugPlugin, Tt as fileTransferPlugin, p as getChildAt, y as getLeafAt, h as getLeafBlockAt, d as getNodeSize, Mt as htmlTransferPlugin, wt as internalTranferPlugin, v as iterLeafBlocks, b as iterLeaves, Ot as keymapPlugin, Et as plainTransferPlugin, Lt as scrollToSelectionPlugin, Pt as selectionRectPlugin, Ht as singlelinePlugin, T as sliceText };
1173
+ export { q as Delete, X as Format, G as InsertNode, z as InsertText, V as LeavesInRange, Rt as LockedInRange, mt as Redo, _t as Redoable, Y as ReplaceDoc, J as ReplaceText, j as SetBlockAttr, Q as SetVoidAttr, K as ToggleBlockAttr, Z as ToggleFormat, kt as Undo, gt as Undoable, Ot as blockLockPlugin, Tt as createEditor, Ft as createPlainEditor, Dt as debugPlugin, Et as fileTransferPlugin, p as getChildAt, y as getLeafAt, h as getLeafBlockAt, k as getNodeOffset, d as getNodeSize, wt as htmlTransferPlugin, At as internalTransferPlugin, v as iterLeafBlocks, T as iterLeaves, Bt as keymapPlugin, N as mapPosition, Mt as plainTransferPlugin, Nt as scrollToSelectionPlugin, Ct as selectionRectPlugin, Wt as singlelinePlugin, E as sliceText };
1105
1174
  //# sourceMappingURL=index.js.map