@lit-pigeon/editor 0.1.2 → 0.1.3

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/dist/rich-text.js CHANGED
@@ -6,7 +6,7 @@ function ig() {
6
6
  }
7
7
  class Ja {
8
8
  constructor() {
9
- this._active = null, this._listeners = /* @__PURE__ */ new Set();
9
+ this._active = null, this._listeners = /* @__PURE__ */ new Set(), this._held = !1;
10
10
  }
11
11
  setActive(e) {
12
12
  if (this._active !== e) {
@@ -18,6 +18,23 @@ class Ja {
18
18
  clearIfActive(e) {
19
19
  this._active === e && this.setActive(null);
20
20
  }
21
+ /**
22
+ * "Focus hold" — set while the user operates a formatting control that lives
23
+ * outside the editable (the bubble's link field, the sidebar format panel's
24
+ * `<select>`/color inputs). Native form controls steal DOM focus, which would
25
+ * otherwise blur the editor and tear it down before the command runs. While
26
+ * held, the editor's blur handler keeps the editor alive and the active
27
+ * binding intact so the command can apply to the preserved selection.
28
+ */
29
+ holdFocus() {
30
+ this._held = !0;
31
+ }
32
+ releaseFocus() {
33
+ this._held = !1;
34
+ }
35
+ isHeld() {
36
+ return this._held;
37
+ }
21
38
  getActive() {
22
39
  return this._active;
23
40
  }
@@ -25,7 +42,7 @@ class Ja {
25
42
  return this._listeners.add(e), () => this._listeners.delete(e);
26
43
  }
27
44
  }
28
- const Ve = new Ja();
45
+ const le = new Ja();
29
46
  function J(n) {
30
47
  this.content = n;
31
48
  }
@@ -2893,15 +2910,15 @@ class yi {
2893
2910
  return (this.delInfo & Rn) > 0;
2894
2911
  }
2895
2912
  }
2896
- class ae {
2913
+ class ce {
2897
2914
  /**
2898
2915
  Create a position map. The modifications to the document are
2899
2916
  represented as an array of numbers, in which each group of three
2900
2917
  represents a modified chunk as `[start, oldSize, newSize]`.
2901
2918
  */
2902
2919
  constructor(e, t = !1) {
2903
- if (this.ranges = e, this.inverted = t, !e.length && ae.empty)
2904
- return ae.empty;
2920
+ if (this.ranges = e, this.inverted = t, !e.length && ce.empty)
2921
+ return ce.empty;
2905
2922
  }
2906
2923
  /**
2907
2924
  @internal
@@ -2972,7 +2989,7 @@ class ae {
2972
2989
  map positions in the post-step document to the pre-step document.
2973
2990
  */
2974
2991
  invert() {
2975
- return new ae(this.ranges, !this.inverted);
2992
+ return new ce(this.ranges, !this.inverted);
2976
2993
  }
2977
2994
  /**
2978
2995
  @internal
@@ -2986,10 +3003,10 @@ class ae {
2986
3003
  sub-document to a larger document, or vice-versa.
2987
3004
  */
2988
3005
  static offset(e) {
2989
- return e == 0 ? ae.empty : new ae(e < 0 ? [0, -e, 0] : [0, 0, e]);
3006
+ return e == 0 ? ce.empty : new ce(e < 0 ? [0, -e, 0] : [0, 0, e]);
2990
3007
  }
2991
3008
  }
2992
- ae.empty = new ae([]);
3009
+ ce.empty = new ce([]);
2993
3010
  class sn {
2994
3011
  /**
2995
3012
  Create a new mapping with the given position maps.
@@ -3105,7 +3122,7 @@ class te {
3105
3122
  and the new document.
3106
3123
  */
3107
3124
  getMap() {
3108
- return ae.empty;
3125
+ return ce.empty;
3109
3126
  }
3110
3127
  /**
3111
3128
  Try to merge this step with another one, to be applied directly
@@ -3193,7 +3210,7 @@ class je extends te {
3193
3210
  return _.fromReplace(e, this.from, this.to, s);
3194
3211
  }
3195
3212
  invert() {
3196
- return new we(this.from, this.to, this.mark);
3213
+ return new Te(this.from, this.to, this.mark);
3197
3214
  }
3198
3215
  map(e) {
3199
3216
  let t = e.mapResult(this.from, 1), r = e.mapResult(this.to, -1);
@@ -3220,7 +3237,7 @@ class je extends te {
3220
3237
  }
3221
3238
  }
3222
3239
  te.jsonID("addMark", je);
3223
- class we extends te {
3240
+ class Te extends te {
3224
3241
  /**
3225
3242
  Create a mark-removing step.
3226
3243
  */
@@ -3236,10 +3253,10 @@ class we extends te {
3236
3253
  }
3237
3254
  map(e) {
3238
3255
  let t = e.mapResult(this.from, 1), r = e.mapResult(this.to, -1);
3239
- return t.deleted && r.deleted || t.pos >= r.pos ? null : new we(t.pos, r.pos, this.mark);
3256
+ return t.deleted && r.deleted || t.pos >= r.pos ? null : new Te(t.pos, r.pos, this.mark);
3240
3257
  }
3241
3258
  merge(e) {
3242
- return e instanceof we && e.mark.eq(this.mark) && this.from <= e.to && this.to >= e.from ? new we(Math.min(this.from, e.from), Math.max(this.to, e.to), this.mark) : null;
3259
+ return e instanceof Te && e.mark.eq(this.mark) && this.from <= e.to && this.to >= e.from ? new Te(Math.min(this.from, e.from), Math.max(this.to, e.to), this.mark) : null;
3243
3260
  }
3244
3261
  toJSON() {
3245
3262
  return {
@@ -3255,10 +3272,10 @@ class we extends te {
3255
3272
  static fromJSON(e, t) {
3256
3273
  if (typeof t.from != "number" || typeof t.to != "number")
3257
3274
  throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");
3258
- return new we(t.from, t.to, e.markFromJSON(t.mark));
3275
+ return new Te(t.from, t.to, e.markFromJSON(t.mark));
3259
3276
  }
3260
3277
  }
3261
- te.jsonID("removeMark", we);
3278
+ te.jsonID("removeMark", Te);
3262
3279
  class We extends te {
3263
3280
  /**
3264
3281
  Create a node mark step.
@@ -3355,7 +3372,7 @@ class $ extends te {
3355
3372
  return this.structure && bi(e, this.from, this.to) ? _.fail("Structure replace would overwrite content") : _.fromReplace(e, this.from, this.to, this.slice);
3356
3373
  }
3357
3374
  getMap() {
3358
- return new ae([this.from, this.to - this.from, this.slice.size]);
3375
+ return new ce([this.from, this.to - this.from, this.slice.size]);
3359
3376
  }
3360
3377
  invert(e) {
3361
3378
  return new $(this.from, this.from + this.slice.size, e.slice(this.from, this.to));
@@ -3411,7 +3428,7 @@ class j extends te {
3411
3428
  return r ? _.fromReplace(e, this.from, this.to, r) : _.fail("Content does not fit in gap");
3412
3429
  }
3413
3430
  getMap() {
3414
- return new ae([
3431
+ return new ce([
3415
3432
  this.from,
3416
3433
  this.gapFrom - this.from,
3417
3434
  this.insert,
@@ -3472,7 +3489,7 @@ function xc(n, e, t, r) {
3472
3489
  if (!r.isInSet(d) && u.type.allowsMarkType(r.type)) {
3473
3490
  let f = Math.max(c, e), h = Math.min(c + a.nodeSize, t), p = r.addToSet(d);
3474
3491
  for (let m = 0; m < d.length; m++)
3475
- d[m].isInSet(p) || (o && o.to == f && o.mark.eq(d[m]) ? o.to = h : i.push(o = new we(f, h, d[m])));
3492
+ d[m].isInSet(p) || (o && o.to == f && o.mark.eq(d[m]) ? o.to = h : i.push(o = new Te(f, h, d[m])));
3476
3493
  l && l.to == f ? l.to = h : s.push(l = new je(f, h, r));
3477
3494
  }
3478
3495
  }), i.forEach((a) => n.step(a)), s.forEach((a) => n.step(a));
@@ -3500,7 +3517,7 @@ function Sc(n, e, t, r) {
3500
3517
  f ? (f.to = c, f.step = s) : i.push({ style: d, from: Math.max(l, e), to: c, step: s });
3501
3518
  }
3502
3519
  }
3503
- }), i.forEach((o) => n.step(new we(o.from, o.to, o.style)));
3520
+ }), i.forEach((o) => n.step(new Te(o.from, o.to, o.style)));
3504
3521
  }
3505
3522
  function Vi(n, e, t, r = t.contentMatch, i = !0) {
3506
3523
  let s = n.doc.nodeAt(e), o = [], l = e + 1;
@@ -3511,7 +3528,7 @@ function Vi(n, e, t, r = t.contentMatch, i = !0) {
3511
3528
  else {
3512
3529
  r = d;
3513
3530
  for (let f = 0; f < c.marks.length; f++)
3514
- t.allowsMarkType(c.marks[f].type) || n.step(new we(l, u, c.marks[f]));
3531
+ t.allowsMarkType(c.marks[f].type) || n.step(new Te(l, u, c.marks[f]));
3515
3532
  if (i && c.isText && t.whitespace != "pre") {
3516
3533
  let f, h = /\r?\n|\r/g, p;
3517
3534
  for (; f = h.exec(c.text); )
@@ -3641,7 +3658,7 @@ function vc(n, e, t, r, i) {
3641
3658
  throw new RangeError("Invalid content for node type " + t.name);
3642
3659
  n.step(new j(e, e + s.nodeSize, e + 1, e + s.nodeSize - 1, new x(b.from(o), 0, 0), 1, !0));
3643
3660
  }
3644
- function Pe(n, e, t = 1, r) {
3661
+ function Le(n, e, t = 1, r) {
3645
3662
  let i = n.resolve(e), s = i.depth - t, o = r && r[r.length - 1] || i.parent;
3646
3663
  if (s < 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)))
3647
3664
  return !1;
@@ -4069,7 +4086,7 @@ class Nt extends te {
4069
4086
  return _.fromReplace(e, this.pos, this.pos + 1, new x(b.from(i), 0, t.isLeaf ? 0 : 1));
4070
4087
  }
4071
4088
  getMap() {
4072
- return ae.empty;
4089
+ return ce.empty;
4073
4090
  }
4074
4091
  invert(e) {
4075
4092
  return new Nt(this.pos, this.attr, e.nodeAt(this.pos).attrs[this.attr]);
@@ -4104,7 +4121,7 @@ class on extends te {
4104
4121
  return _.ok(r);
4105
4122
  }
4106
4123
  getMap() {
4107
- return ae.empty;
4124
+ return ce.empty;
4108
4125
  }
4109
4126
  invert(e) {
4110
4127
  return new on(this.attr, e.attrs[this.attr]);
@@ -4483,7 +4500,7 @@ class A {
4483
4500
  negative, it will search backwards first.
4484
4501
  */
4485
4502
  static near(e, t = 1) {
4486
- return this.findFrom(e, t) || this.findFrom(e, -t) || new ce(e.node(0));
4503
+ return this.findFrom(e, t) || this.findFrom(e, -t) || new ue(e.node(0));
4487
4504
  }
4488
4505
  /**
4489
4506
  Find the cursor or leaf node selection closest to the start of
@@ -4492,14 +4509,14 @@ class A {
4492
4509
  exists.
4493
4510
  */
4494
4511
  static atStart(e) {
4495
- return wt(e, e, 0, 0, 1) || new ce(e);
4512
+ return wt(e, e, 0, 0, 1) || new ue(e);
4496
4513
  }
4497
4514
  /**
4498
4515
  Find the cursor or leaf node selection closest to the end of the
4499
4516
  given document.
4500
4517
  */
4501
4518
  static atEnd(e) {
4502
- return wt(e, e, e.content.size, e.childCount, -1) || new ce(e);
4519
+ return wt(e, e, e.content.size, e.childCount, -1) || new ue(e);
4503
4520
  }
4504
4521
  /**
4505
4522
  Deserialize the JSON representation of a selection. Must be
@@ -4695,7 +4712,7 @@ class Wi {
4695
4712
  return r && C.isSelectable(r) ? new C(t) : A.near(t);
4696
4713
  }
4697
4714
  }
4698
- class ce extends A {
4715
+ class ue extends A {
4699
4716
  /**
4700
4717
  Create an all-selection over the given document.
4701
4718
  */
@@ -4717,25 +4734,25 @@ class ce extends A {
4717
4734
  @internal
4718
4735
  */
4719
4736
  static fromJSON(e) {
4720
- return new ce(e);
4737
+ return new ue(e);
4721
4738
  }
4722
4739
  map(e) {
4723
- return new ce(e);
4740
+ return new ue(e);
4724
4741
  }
4725
4742
  eq(e) {
4726
- return e instanceof ce;
4743
+ return e instanceof ue;
4727
4744
  }
4728
4745
  getBookmark() {
4729
4746
  return Hc;
4730
4747
  }
4731
4748
  }
4732
- A.jsonID("all", ce);
4749
+ A.jsonID("all", ue);
4733
4750
  const Hc = {
4734
4751
  map() {
4735
4752
  return this;
4736
4753
  },
4737
4754
  resolve(n) {
4738
- return new ce(n);
4755
+ return new ue(n);
4739
4756
  }
4740
4757
  };
4741
4758
  function wt(n, e, t, r, i, s = !1) {
@@ -5160,7 +5177,7 @@ const qr = /* @__PURE__ */ Object.create(null);
5160
5177
  function El(n) {
5161
5178
  return n in qr ? n + "$" + ++qr[n] : (qr[n] = 0, n + "$");
5162
5179
  }
5163
- class ue {
5180
+ class de {
5164
5181
  /**
5165
5182
  Create a plugin key.
5166
5183
  */
@@ -5190,7 +5207,7 @@ const G = function(n) {
5190
5207
  return e && e.nodeType == 11 ? e.host : e;
5191
5208
  };
5192
5209
  let ki = null;
5193
- const Ie = function(n, e, t) {
5210
+ const Re = function(n, e, t) {
5194
5211
  let r = ki || (ki = document.createRange());
5195
5212
  return r.setEnd(n, t ?? n.nodeValue.length), r.setStart(n, e || 0), r;
5196
5213
  }, Wc = function() {
@@ -5202,7 +5219,7 @@ function Vs(n, e, t, r, i) {
5202
5219
  for (var s; ; ) {
5203
5220
  if (n == t && e == r)
5204
5221
  return !0;
5205
- if (e == (i < 0 ? 0 : me(n))) {
5222
+ if (e == (i < 0 ? 0 : ge(n))) {
5206
5223
  let o = n.parentNode;
5207
5224
  if (!o || o.nodeType != 1 || mn(n) || Uc.test(n.nodeName) || n.contentEditable == "false")
5208
5225
  return !1;
@@ -5215,12 +5232,12 @@ function Vs(n, e, t, r, i) {
5215
5232
  else
5216
5233
  return !1;
5217
5234
  else
5218
- n = o, e = i < 0 ? me(n) : 0;
5235
+ n = o, e = i < 0 ? ge(n) : 0;
5219
5236
  } else
5220
5237
  return !1;
5221
5238
  }
5222
5239
  }
5223
- function me(n) {
5240
+ function ge(n) {
5224
5241
  return n.nodeType == 3 ? n.nodeValue.length : n.childNodes.length;
5225
5242
  }
5226
5243
  function Kc(n, e) {
@@ -5230,7 +5247,7 @@ function Kc(n, e) {
5230
5247
  if (n.nodeType == 1 && e > 0) {
5231
5248
  if (n.contentEditable == "false")
5232
5249
  return null;
5233
- n = n.childNodes[e - 1], e = me(n);
5250
+ n = n.childNodes[e - 1], e = ge(n);
5234
5251
  } else if (n.parentNode && !mn(n))
5235
5252
  e = G(n), n = n.parentNode;
5236
5253
  else
@@ -5252,13 +5269,13 @@ function qc(n, e) {
5252
5269
  }
5253
5270
  }
5254
5271
  function Jc(n, e, t) {
5255
- for (let r = e == 0, i = e == me(n); r || i; ) {
5272
+ for (let r = e == 0, i = e == ge(n); r || i; ) {
5256
5273
  if (n == t)
5257
5274
  return !0;
5258
5275
  let s = G(n);
5259
5276
  if (n = n.parentNode, !n)
5260
5277
  return !1;
5261
- r = r && s == 0, i = i && s == me(n);
5278
+ r = r && s == 0, i = i && s == ge(n);
5262
5279
  }
5263
5280
  }
5264
5281
  function mn(n) {
@@ -5285,18 +5302,18 @@ function Yc(n, e, t) {
5285
5302
  try {
5286
5303
  let r = n.caretPositionFromPoint(e, t);
5287
5304
  if (r)
5288
- return { node: r.offsetNode, offset: Math.min(me(r.offsetNode), r.offset) };
5305
+ return { node: r.offsetNode, offset: Math.min(ge(r.offsetNode), r.offset) };
5289
5306
  } catch {
5290
5307
  }
5291
5308
  if (n.caretRangeFromPoint) {
5292
5309
  let r = n.caretRangeFromPoint(e, t);
5293
5310
  if (r)
5294
- return { node: r.startContainer, offset: Math.min(me(r.startContainer), r.startOffset) };
5311
+ return { node: r.startContainer, offset: Math.min(ge(r.startContainer), r.startOffset) };
5295
5312
  }
5296
5313
  }
5297
- const Te = typeof navigator < "u" ? navigator : null, js = typeof document < "u" ? document : null, Qe = Te && Te.userAgent || "", xi = /Edge\/(\d+)/.exec(Qe), Ol = /MSIE \d/.exec(Qe), Si = /Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Qe), le = !!(Ol || Si || xi), qe = Ol ? document.documentMode : Si ? +Si[1] : xi ? +xi[1] : 0, ye = !le && /gecko\/(\d+)/i.test(Qe);
5298
- ye && +(/Firefox\/(\d+)/.exec(Qe) || [0, 0])[1];
5299
- const Ci = !le && /Chrome\/(\d+)/.exec(Qe), X = !!Ci, Al = Ci ? +Ci[1] : 0, ee = !le && !!Te && /Apple Computer/.test(Te.vendor), Pt = ee && (/Mobile\/\w+/.test(Qe) || !!Te && Te.maxTouchPoints > 2), pe = Pt || (Te ? /Mac/.test(Te.platform) : !1), vl = Te ? /Win/.test(Te.platform) : !1, Re = /Android \d/.test(Qe), gn = !!js && "webkitFontSmoothing" in js.documentElement.style, Xc = gn ? +(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent) || [0, 0])[1] : 0;
5314
+ const Ee = typeof navigator < "u" ? navigator : null, js = typeof document < "u" ? document : null, Qe = Ee && Ee.userAgent || "", xi = /Edge\/(\d+)/.exec(Qe), Ol = /MSIE \d/.exec(Qe), Si = /Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Qe), ae = !!(Ol || Si || xi), qe = Ol ? document.documentMode : Si ? +Si[1] : xi ? +xi[1] : 0, be = !ae && /gecko\/(\d+)/i.test(Qe);
5315
+ be && +(/Firefox\/(\d+)/.exec(Qe) || [0, 0])[1];
5316
+ const Ci = !ae && /Chrome\/(\d+)/.exec(Qe), X = !!Ci, Al = Ci ? +Ci[1] : 0, ee = !ae && !!Ee && /Apple Computer/.test(Ee.vendor), Pt = ee && (/Mobile\/\w+/.test(Qe) || !!Ee && Ee.maxTouchPoints > 2), me = Pt || (Ee ? /Mac/.test(Ee.platform) : !1), vl = Ee ? /Win/.test(Ee.platform) : !1, Pe = /Android \d/.test(Qe), gn = !!js && "webkitFontSmoothing" in js.documentElement.style, Xc = gn ? +(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent) || [0, 0])[1] : 0;
5300
5317
  function Qc(n) {
5301
5318
  let e = n.defaultView && n.defaultView.visualViewport;
5302
5319
  return e ? {
@@ -5311,7 +5328,7 @@ function Qc(n) {
5311
5328
  bottom: n.documentElement.clientHeight
5312
5329
  };
5313
5330
  }
5314
- function Ae(n, e) {
5331
+ function ve(n, e) {
5315
5332
  return typeof n == "number" ? n : n[e];
5316
5333
  }
5317
5334
  function Zc(n) {
@@ -5331,7 +5348,7 @@ function Ws(n, e, t) {
5331
5348
  continue;
5332
5349
  }
5333
5350
  let l = o, a = l == s.body, c = a ? Qc(s) : Zc(l), u = 0, d = 0;
5334
- if (e.top < c.top + Ae(r, "top") ? d = -(c.top - e.top + Ae(i, "top")) : e.bottom > c.bottom - Ae(r, "bottom") && (d = e.bottom - e.top > c.bottom - c.top ? e.top + Ae(i, "top") - c.top : e.bottom - c.bottom + Ae(i, "bottom")), e.left < c.left + Ae(r, "left") ? u = -(c.left - e.left + Ae(i, "left")) : e.right > c.right - Ae(r, "right") && (u = e.right - c.right + Ae(i, "right")), u || d)
5351
+ if (e.top < c.top + ve(r, "top") ? d = -(c.top - e.top + ve(i, "top")) : e.bottom > c.bottom - ve(r, "bottom") && (d = e.bottom - e.top > c.bottom - c.top ? e.top + ve(i, "top") - c.top : e.bottom - c.bottom + ve(i, "bottom")), e.left < c.left + ve(r, "left") ? u = -(c.left - e.left + ve(i, "left")) : e.right > c.right - ve(r, "right") && (u = e.right - c.right + ve(i, "right")), u || d)
5335
5352
  if (a)
5336
5353
  s.defaultView.scrollBy(u, d);
5337
5354
  else {
@@ -5396,7 +5413,7 @@ function Il(n, e) {
5396
5413
  if (u.nodeType == 1)
5397
5414
  f = u.getClientRects();
5398
5415
  else if (u.nodeType == 3)
5399
- f = Ie(u).getClientRects();
5416
+ f = Re(u).getClientRects();
5400
5417
  else
5401
5418
  continue;
5402
5419
  for (let h = 0; h < f.length; h++) {
@@ -5421,7 +5438,7 @@ function ru(n, e) {
5421
5438
  let t = n.nodeValue.length, r = document.createRange(), i;
5422
5439
  for (let s = 0; s < t; s++) {
5423
5440
  r.setEnd(n, s + 1), r.setStart(n, s);
5424
- let o = ze(r, 1);
5441
+ let o = Fe(r, 1);
5425
5442
  if (o.top != o.bottom && Ui(e, o)) {
5426
5443
  i = { node: n, offset: s + (e.left >= (o.left + o.right) / 2 ? 1 : 0) };
5427
5444
  break;
@@ -5488,7 +5505,7 @@ function lu(n, e) {
5488
5505
  for (let c = o; r && c; c = Rt(c))
5489
5506
  c.draggable && (r = void 0);
5490
5507
  if (o = iu(o, e), r) {
5491
- if (ye && r.nodeType == 1 && (i = Math.min(i, r.childNodes.length), i < r.childNodes.length)) {
5508
+ if (be && r.nodeType == 1 && (i = Math.min(i, r.childNodes.length), i < r.childNodes.length)) {
5492
5509
  let u = r.childNodes[i], d;
5493
5510
  u.nodeName == "IMG" && (d = u.getBoundingClientRect()).right <= e.left && d.bottom > e.top && i++;
5494
5511
  }
@@ -5502,7 +5519,7 @@ function lu(n, e) {
5502
5519
  function Us(n) {
5503
5520
  return n.top < n.bottom || n.left < n.right;
5504
5521
  }
5505
- function ze(n, e) {
5522
+ function Fe(n, e) {
5506
5523
  let t = n.getClientRects();
5507
5524
  if (t.length) {
5508
5525
  let r = t[e < 0 ? 0 : t.length - 1];
@@ -5513,14 +5530,14 @@ function ze(n, e) {
5513
5530
  }
5514
5531
  const au = /[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;
5515
5532
  function Pl(n, e, t) {
5516
- let { node: r, offset: i, atom: s } = n.docView.domFromPos(e, t < 0 ? -1 : 1), o = gn || ye;
5533
+ let { node: r, offset: i, atom: s } = n.docView.domFromPos(e, t < 0 ? -1 : 1), o = gn || be;
5517
5534
  if (r.nodeType == 3)
5518
5535
  if (o && (au.test(r.nodeValue) || (t < 0 ? !i : i == r.nodeValue.length))) {
5519
- let a = ze(Ie(r, i, i), t);
5520
- if (ye && i && /\s/.test(r.nodeValue[i - 1]) && i < r.nodeValue.length) {
5521
- let c = ze(Ie(r, i - 1, i - 1), -1);
5536
+ let a = Fe(Re(r, i, i), t);
5537
+ if (be && i && /\s/.test(r.nodeValue[i - 1]) && i < r.nodeValue.length) {
5538
+ let c = Fe(Re(r, i - 1, i - 1), -1);
5522
5539
  if (c.top == a.top) {
5523
- let u = ze(Ie(r, i, i + 1), -1);
5540
+ let u = Fe(Re(r, i, i + 1), -1);
5524
5541
  if (u.top != a.top)
5525
5542
  return Ft(u, u.left < c.left);
5526
5543
  }
@@ -5528,35 +5545,35 @@ function Pl(n, e, t) {
5528
5545
  return a;
5529
5546
  } else {
5530
5547
  let a = i, c = i, u = t < 0 ? 1 : -1;
5531
- return t < 0 && !i ? (c++, u = -1) : t >= 0 && i == r.nodeValue.length ? (a--, u = 1) : t < 0 ? a-- : c++, Ft(ze(Ie(r, a, c), u), u < 0);
5548
+ return t < 0 && !i ? (c++, u = -1) : t >= 0 && i == r.nodeValue.length ? (a--, u = 1) : t < 0 ? a-- : c++, Ft(Fe(Re(r, a, c), u), u < 0);
5532
5549
  }
5533
5550
  if (!n.state.doc.resolve(e - (s || 0)).parent.inlineContent) {
5534
- if (s == null && i && (t < 0 || i == me(r))) {
5551
+ if (s == null && i && (t < 0 || i == ge(r))) {
5535
5552
  let a = r.childNodes[i - 1];
5536
5553
  if (a.nodeType == 1)
5537
5554
  return Jr(a.getBoundingClientRect(), !1);
5538
5555
  }
5539
- if (s == null && i < me(r)) {
5556
+ if (s == null && i < ge(r)) {
5540
5557
  let a = r.childNodes[i];
5541
5558
  if (a.nodeType == 1)
5542
5559
  return Jr(a.getBoundingClientRect(), !0);
5543
5560
  }
5544
5561
  return Jr(r.getBoundingClientRect(), t >= 0);
5545
5562
  }
5546
- if (s == null && i && (t < 0 || i == me(r))) {
5547
- let a = r.childNodes[i - 1], c = a.nodeType == 3 ? Ie(a, me(a) - (o ? 0 : 1)) : a.nodeType == 1 && (a.nodeName != "BR" || !a.nextSibling) ? a : null;
5563
+ if (s == null && i && (t < 0 || i == ge(r))) {
5564
+ let a = r.childNodes[i - 1], c = a.nodeType == 3 ? Re(a, ge(a) - (o ? 0 : 1)) : a.nodeType == 1 && (a.nodeName != "BR" || !a.nextSibling) ? a : null;
5548
5565
  if (c)
5549
- return Ft(ze(c, 1), !1);
5566
+ return Ft(Fe(c, 1), !1);
5550
5567
  }
5551
- if (s == null && i < me(r)) {
5568
+ if (s == null && i < ge(r)) {
5552
5569
  let a = r.childNodes[i];
5553
5570
  for (; a.pmViewDesc && a.pmViewDesc.ignoreForCoords; )
5554
5571
  a = a.nextSibling;
5555
- let c = a ? a.nodeType == 3 ? Ie(a, 0, o ? 0 : 1) : a.nodeType == 1 ? a : null : null;
5572
+ let c = a ? a.nodeType == 3 ? Re(a, 0, o ? 0 : 1) : a.nodeType == 1 ? a : null : null;
5556
5573
  if (c)
5557
- return Ft(ze(c, -1), !0);
5574
+ return Ft(Fe(c, -1), !0);
5558
5575
  }
5559
- return Ft(ze(r.nodeType == 3 ? Ie(r) : r, -t), t >= 0);
5576
+ return Ft(Fe(r.nodeType == 3 ? Re(r) : r, -t), t >= 0);
5560
5577
  }
5561
5578
  function Ft(n, e) {
5562
5579
  if (n.width == 0)
@@ -5599,7 +5616,7 @@ function cu(n, e, t) {
5599
5616
  if (l.nodeType == 1)
5600
5617
  a = l.getClientRects();
5601
5618
  else if (l.nodeType == 3)
5602
- a = Ie(l, 0, l.nodeValue.length).getClientRects();
5619
+ a = Re(l, 0, l.nodeValue.length).getClientRects();
5603
5620
  else
5604
5621
  continue;
5605
5622
  for (let c = 0; c < a.length; c++) {
@@ -5632,10 +5649,10 @@ let Ks = null, qs = null, Js = !1;
5632
5649
  function fu(n, e, t) {
5633
5650
  return Ks == e && qs == t ? Js : (Ks = e, qs = t, Js = t == "up" || t == "down" ? cu(n, e, t) : du(n, e, t));
5634
5651
  }
5635
- const be = 0, Gs = 1, it = 2, Ee = 3;
5652
+ const ke = 0, Gs = 1, it = 2, Oe = 3;
5636
5653
  class yn {
5637
5654
  constructor(e, t, r, i) {
5638
- this.parent = e, this.children = t, this.dom = r, this.contentDOM = i, this.dirty = be, r.pmViewDesc = this;
5655
+ this.parent = e, this.children = t, this.dom = r, this.contentDOM = i, this.dirty = ke, r.pmViewDesc = this;
5639
5656
  }
5640
5657
  // Used to check whether a given description corresponds to a
5641
5658
  // widget/mark/node.
@@ -5892,7 +5909,7 @@ class yn {
5892
5909
  p = g;
5893
5910
  }
5894
5911
  let l = this.domFromPos(e, e ? -1 : 1), a = t == e ? l : this.domFromPos(t, t ? -1 : 1), c = r.root.getSelection(), u = r.domSelectionRange(), d = !1;
5895
- if ((ye || ee) && e == t) {
5912
+ if ((be || ee) && e == t) {
5896
5913
  let { node: h, offset: p } = l;
5897
5914
  if (h.nodeType == 3) {
5898
5915
  if (d = !!(p && h.nodeValue[p - 1] == `
@@ -5911,14 +5928,14 @@ class yn {
5911
5928
  d = m && (m.nodeName == "BR" || m.contentEditable == "false");
5912
5929
  }
5913
5930
  }
5914
- if (ye && u.focusNode && u.focusNode != a.node && u.focusNode.nodeType == 1) {
5931
+ if (be && u.focusNode && u.focusNode != a.node && u.focusNode.nodeType == 1) {
5915
5932
  let h = u.focusNode.childNodes[u.focusOffset];
5916
5933
  h && h.contentEditable == "false" && (i = !0);
5917
5934
  }
5918
5935
  if (!(i || d && ee) && gt(l.node, l.offset, u.anchorNode, u.anchorOffset) && gt(a.node, a.offset, u.focusNode, u.focusOffset))
5919
5936
  return;
5920
5937
  let f = !1;
5921
- if ((c.extend || e == t) && !(d && ye)) {
5938
+ if ((c.extend || e == t) && !(d && be)) {
5922
5939
  c.collapse(l.node, l.offset);
5923
5940
  try {
5924
5941
  e != t && c.extend(a.node, a.offset), f = !0;
@@ -5948,10 +5965,10 @@ class yn {
5948
5965
  if (r == o ? e <= o && t >= r : e < o && t > r) {
5949
5966
  let l = r + s.border, a = o - s.border;
5950
5967
  if (e >= l && t <= a) {
5951
- this.dirty = e == r || t == o ? it : Gs, e == l && t == a && (s.contentLost || s.dom.parentNode != this.contentDOM) ? s.dirty = Ee : s.markDirty(e - l, t - l);
5968
+ this.dirty = e == r || t == o ? it : Gs, e == l && t == a && (s.contentLost || s.dom.parentNode != this.contentDOM) ? s.dirty = Oe : s.markDirty(e - l, t - l);
5952
5969
  return;
5953
5970
  } else
5954
- s.dirty = s.dom == s.contentDOM && s.dom.parentNode == this.contentDOM && !s.children.length ? it : Ee;
5971
+ s.dirty = s.dom == s.contentDOM && s.dom.parentNode == this.contentDOM && !s.children.length ? it : Oe;
5955
5972
  }
5956
5973
  r = o;
5957
5974
  }
@@ -5995,7 +6012,7 @@ class Bl extends yn {
5995
6012
  super(e, [], o, null), this.widget = t, this.widget = t, s = this;
5996
6013
  }
5997
6014
  matchesWidget(e) {
5998
- return this.dirty == be && e.type.eq(this.widget.type);
6015
+ return this.dirty == ke && e.type.eq(this.widget.type);
5999
6016
  }
6000
6017
  parseRule() {
6001
6018
  return { ignore: !0 };
@@ -6046,17 +6063,17 @@ class yt extends yn {
6046
6063
  return (!o || !o.dom) && (o = kt.renderSpec(document, t.type.spec.toDOM(t, r), null, t.attrs)), new yt(e, t, o.dom, o.contentDOM || o.dom, o);
6047
6064
  }
6048
6065
  parseRule() {
6049
- return this.dirty & Ee || this.mark.type.spec.reparseInView ? null : { mark: this.mark.type.name, attrs: this.mark.attrs, contentElement: this.contentDOM };
6066
+ return this.dirty & Oe || this.mark.type.spec.reparseInView ? null : { mark: this.mark.type.name, attrs: this.mark.attrs, contentElement: this.contentDOM };
6050
6067
  }
6051
6068
  matchesMark(e) {
6052
- return this.dirty != Ee && this.mark.eq(e);
6069
+ return this.dirty != Oe && this.mark.eq(e);
6053
6070
  }
6054
6071
  markDirty(e, t) {
6055
- if (super.markDirty(e, t), this.dirty != be) {
6072
+ if (super.markDirty(e, t), this.dirty != ke) {
6056
6073
  let r = this.parent;
6057
6074
  for (; !r.node; )
6058
6075
  r = r.parent;
6059
- r.dirty < this.dirty && (r.dirty = this.dirty), this.dirty = be;
6076
+ r.dirty < this.dirty && (r.dirty = this.dirty), this.dirty = ke;
6060
6077
  }
6061
6078
  }
6062
6079
  slice(e, t, r) {
@@ -6124,7 +6141,7 @@ class Je extends yn {
6124
6141
  return e;
6125
6142
  }
6126
6143
  matchesNode(e, t, r) {
6127
- return this.dirty == be && e.eq(this.node) && Vn(t, this.outerDeco) && r.eq(this.innerDeco);
6144
+ return this.dirty == ke && e.eq(this.node) && Vn(t, this.outerDeco) && r.eq(this.innerDeco);
6128
6145
  }
6129
6146
  get size() {
6130
6147
  return this.node.nodeSize;
@@ -6176,10 +6193,10 @@ class Je extends yn {
6176
6193
  // If this desc must be updated to match the given node decoration,
6177
6194
  // do so and return true.
6178
6195
  update(e, t, r, i) {
6179
- return this.dirty == Ee || !e.sameMarkup(this.node) ? !1 : (this.updateInner(e, t, r, i), !0);
6196
+ return this.dirty == Oe || !e.sameMarkup(this.node) ? !1 : (this.updateInner(e, t, r, i), !0);
6180
6197
  }
6181
6198
  updateInner(e, t, r, i) {
6182
- this.updateOuterDeco(t), this.node = e, this.innerDeco = r, this.contentDOM && this.updateChildren(i, this.posAtStart), this.dirty = be;
6199
+ this.updateOuterDeco(t), this.node = e, this.innerDeco = r, this.contentDOM && this.updateChildren(i, this.posAtStart), this.dirty = ke;
6183
6200
  }
6184
6201
  updateOuterDeco(e) {
6185
6202
  if (Vn(e, this.outerDeco))
@@ -6215,7 +6232,7 @@ class vr extends Je {
6215
6232
  return { skip: e || !0 };
6216
6233
  }
6217
6234
  update(e, t, r, i) {
6218
- return this.dirty == Ee || this.dirty != be && !this.inParent() || !e.sameMarkup(this.node) ? !1 : (this.updateOuterDeco(t), (this.dirty != be || e.text != this.node.text) && e.text != this.nodeDOM.nodeValue && (this.nodeDOM.nodeValue = e.text, i.trackWrites == this.nodeDOM && (i.trackWrites = null)), this.node = e, this.dirty = be, !0);
6235
+ return this.dirty == Oe || this.dirty != ke && !this.inParent() || !e.sameMarkup(this.node) ? !1 : (this.updateOuterDeco(t), (this.dirty != ke || e.text != this.node.text) && e.text != this.nodeDOM.nodeValue && (this.nodeDOM.nodeValue = e.text, i.trackWrites == this.nodeDOM && (i.trackWrites = null)), this.node = e, this.dirty = ke, !0);
6219
6236
  }
6220
6237
  inParent() {
6221
6238
  let e = this.parent.contentDOM;
@@ -6238,7 +6255,7 @@ class vr extends Je {
6238
6255
  return new vr(this.parent, i, this.outerDeco, this.innerDeco, s, s, r);
6239
6256
  }
6240
6257
  markDirty(e, t) {
6241
- super.markDirty(e, t), this.dom != this.nodeDOM && (e == 0 || t == this.nodeDOM.nodeValue.length) && (this.dirty = Ee);
6258
+ super.markDirty(e, t), this.dom != this.nodeDOM && (e == 0 || t == this.nodeDOM.nodeValue.length) && (this.dirty = Oe);
6242
6259
  }
6243
6260
  get domAtom() {
6244
6261
  return !1;
@@ -6252,7 +6269,7 @@ class zl extends yn {
6252
6269
  return { ignore: !0 };
6253
6270
  }
6254
6271
  matchesHack(e) {
6255
- return this.dirty == be && this.dom.nodeName == e;
6272
+ return this.dirty == ke && this.dom.nodeName == e;
6256
6273
  }
6257
6274
  get domAtom() {
6258
6275
  return !0;
@@ -6269,7 +6286,7 @@ class pu extends Je {
6269
6286
  // through. If it does, and there's a `contentDOM` node, our logic
6270
6287
  // updates the children.
6271
6288
  update(e, t, r, i) {
6272
- if (this.dirty == Ee)
6289
+ if (this.dirty == Oe)
6273
6290
  return !1;
6274
6291
  if (this.spec.update && (this.node.type == e.type || this.spec.multiType)) {
6275
6292
  let s = this.spec.update(e, t, r);
@@ -6410,7 +6427,7 @@ class gu {
6410
6427
  for (; s < l && (s == o - 1 ? this.top : this.stack[s + 1 << 1]).matchesMark(e[s]) && e[s].type.spec.spanning !== !1; )
6411
6428
  s++;
6412
6429
  for (; s < o; )
6413
- this.destroyRest(), this.top.dirty = be, this.index = this.stack.pop(), this.top = this.stack.pop(), o--;
6430
+ this.destroyRest(), this.top.dirty = ke, this.index = this.stack.pop(), this.top = this.stack.pop(), o--;
6414
6431
  for (; o < e.length; ) {
6415
6432
  this.stack.push(this.top, this.index + 1);
6416
6433
  let a = -1, c = this.top.children.length;
@@ -6449,7 +6466,7 @@ class gu {
6449
6466
  }
6450
6467
  updateNodeAt(e, t, r, i, s) {
6451
6468
  let o = this.top.children[i];
6452
- return o.dirty == Ee && o.dom == o.contentDOM && (o.dirty = it), o.update(e, t, r, s) ? (this.destroyBetween(this.index, i), this.index++, !0) : !1;
6469
+ return o.dirty == Oe && o.dom == o.contentDOM && (o.dirty = it), o.update(e, t, r, s) ? (this.destroyBetween(this.index, i), this.index++, !0) : !1;
6453
6470
  }
6454
6471
  findIndexWithChild(e) {
6455
6472
  for (; ; ) {
@@ -6477,11 +6494,11 @@ class gu {
6477
6494
  let c = this.preMatch.matched.get(a);
6478
6495
  if (c != null && c != s)
6479
6496
  return !1;
6480
- let u = a.dom, d, f = this.isLocked(u) && !(e.isText && a.node && a.node.isText && a.nodeDOM.nodeValue == e.text && a.dirty != Ee && Vn(t, a.outerDeco));
6497
+ let u = a.dom, d, f = this.isLocked(u) && !(e.isText && a.node && a.node.isText && a.nodeDOM.nodeValue == e.text && a.dirty != Oe && Vn(t, a.outerDeco));
6481
6498
  if (!f && a.update(e, t, r, i))
6482
6499
  return this.destroyBetween(this.index, l), a.dom != u && (this.changed = !0), this.index++, !0;
6483
6500
  if (!f && (d = this.recreateWrapper(a, e, t, r, i, o)))
6484
- return this.destroyBetween(this.index, l), this.top.children[this.index] = d, d.contentDOM && (d.dirty = it, d.updateChildren(i, o + 1), d.dirty = be), this.changed = !0, this.index++, !0;
6501
+ return this.destroyBetween(this.index, l), this.top.children[this.index] = d, d.contentDOM && (d.dirty = it, d.updateChildren(i, o + 1), d.dirty = ke), this.changed = !0, this.index++, !0;
6485
6502
  break;
6486
6503
  }
6487
6504
  }
@@ -6694,7 +6711,7 @@ function Ki(n, e = null) {
6694
6711
  function Hl(n) {
6695
6712
  return n.editable ? n.hasFocus() : jl(n) && document.activeElement && document.activeElement.contains(n.dom);
6696
6713
  }
6697
- function Le(n, e = !1) {
6714
+ function Be(n, e = !1) {
6698
6715
  let t = n.state.selection;
6699
6716
  if (Vl(n, t), !!Hl(n)) {
6700
6717
  if (!e && n.input.mouseDown && n.input.mouseDown.allowDefault && X) {
@@ -6746,7 +6763,7 @@ function Mu(n) {
6746
6763
  if (!e)
6747
6764
  return;
6748
6765
  let t = n.cursorWrapper.dom, r = t.nodeName == "IMG";
6749
- r ? e.collapse(t.parentNode, G(t) + 1) : e.collapse(t, 0), !r && !n.state.selection.visible && le && qe <= 11 && (t.disabled = !0, t.disabled = !1);
6766
+ r ? e.collapse(t.parentNode, G(t) + 1) : e.collapse(t, 0), !r && !n.state.selection.visible && ae && qe <= 11 && (t.disabled = !0, t.disabled = !1);
6750
6767
  }
6751
6768
  function Vl(n, e) {
6752
6769
  if (e instanceof C) {
@@ -6782,7 +6799,7 @@ function Ti(n, e) {
6782
6799
  let { $anchor: t, $head: r } = n.selection, i = e > 0 ? t.max(r) : t.min(r), s = i.parent.inlineContent ? i.depth ? n.doc.resolve(e > 0 ? i.after() : i.before()) : null : i;
6783
6800
  return s && A.findFrom(s, e);
6784
6801
  }
6785
- function Fe(n, e) {
6802
+ function $e(n, e) {
6786
6803
  return n.dispatch(n.state.tr.setSelection(e).scrollIntoView()), !0;
6787
6804
  }
6788
6805
  function ro(n, e, t) {
@@ -6793,25 +6810,25 @@ function ro(n, e, t) {
6793
6810
  if (!s || s.isText || !s.isLeaf)
6794
6811
  return !1;
6795
6812
  let o = n.state.doc.resolve(i.pos + s.nodeSize * (e < 0 ? -1 : 1));
6796
- return Fe(n, new E(r.$anchor, o));
6813
+ return $e(n, new E(r.$anchor, o));
6797
6814
  } else if (r.empty) {
6798
6815
  if (n.endOfTextblock(e > 0 ? "forward" : "backward")) {
6799
6816
  let i = Ti(n.state, e);
6800
- return i && i instanceof C ? Fe(n, i) : !1;
6801
- } else if (!(pe && t.indexOf("m") > -1)) {
6817
+ return i && i instanceof C ? $e(n, i) : !1;
6818
+ } else if (!(me && t.indexOf("m") > -1)) {
6802
6819
  let i = r.$head, s = i.textOffset ? null : e < 0 ? i.nodeBefore : i.nodeAfter, o;
6803
6820
  if (!s || s.isText)
6804
6821
  return !1;
6805
6822
  let l = e < 0 ? i.pos - s.nodeSize : i.pos;
6806
- return s.isAtom || (o = n.docView.descAt(l)) && !o.contentDOM ? C.isSelectable(s) ? Fe(n, new C(e < 0 ? n.state.doc.resolve(i.pos - s.nodeSize) : i)) : gn ? Fe(n, new E(n.state.doc.resolve(e < 0 ? l : l + s.nodeSize))) : !1 : !1;
6823
+ return s.isAtom || (o = n.docView.descAt(l)) && !o.contentDOM ? C.isSelectable(s) ? $e(n, new C(e < 0 ? n.state.doc.resolve(i.pos - s.nodeSize) : i)) : gn ? $e(n, new E(n.state.doc.resolve(e < 0 ? l : l + s.nodeSize))) : !1 : !1;
6807
6824
  }
6808
6825
  } else return !1;
6809
6826
  else {
6810
6827
  if (r instanceof C && r.node.isInline)
6811
- return Fe(n, new E(e > 0 ? r.$to : r.$from));
6828
+ return $e(n, new E(e > 0 ? r.$to : r.$from));
6812
6829
  {
6813
6830
  let i = Ti(n.state, e);
6814
- return i ? Fe(n, i) : !1;
6831
+ return i ? $e(n, i) : !1;
6815
6832
  }
6816
6833
  }
6817
6834
  }
@@ -6830,7 +6847,7 @@ function Tu(n) {
6830
6847
  if (!t)
6831
6848
  return;
6832
6849
  let i, s, o = !1;
6833
- for (ye && t.nodeType == 1 && r < jn(t) && Gt(t.childNodes[r], -1) && (o = !0); ; )
6850
+ for (be && t.nodeType == 1 && r < jn(t) && Gt(t.childNodes[r], -1) && (o = !0); ; )
6834
6851
  if (r > 0) {
6835
6852
  if (t.nodeType != 1)
6836
6853
  break;
@@ -6936,7 +6953,7 @@ function Ei(n, e, t) {
6936
6953
  n.domObserver.setCurSelection();
6937
6954
  let { state: i } = n;
6938
6955
  setTimeout(() => {
6939
- n.state == i && Le(n);
6956
+ n.state == i && Be(n);
6940
6957
  }, 50);
6941
6958
  }
6942
6959
  function io(n, e) {
@@ -6958,17 +6975,17 @@ function io(n, e) {
6958
6975
  }
6959
6976
  function so(n, e, t) {
6960
6977
  let r = n.state.selection;
6961
- if (r instanceof E && !r.empty || t.indexOf("s") > -1 || pe && t.indexOf("m") > -1)
6978
+ if (r instanceof E && !r.empty || t.indexOf("s") > -1 || me && t.indexOf("m") > -1)
6962
6979
  return !1;
6963
6980
  let { $from: i, $to: s } = r;
6964
6981
  if (!i.parent.inlineContent || n.endOfTextblock(e < 0 ? "up" : "down")) {
6965
6982
  let o = Ti(n.state, e);
6966
6983
  if (o && o instanceof C)
6967
- return Fe(n, o);
6984
+ return $e(n, o);
6968
6985
  }
6969
6986
  if (!i.parent.inlineContent) {
6970
- let o = e < 0 ? i : s, l = r instanceof ce ? A.near(o, e) : A.findFrom(o, e);
6971
- return l ? Fe(n, l) : !1;
6987
+ let o = e < 0 ? i : s, l = r instanceof ue ? A.near(o, e) : A.findFrom(o, e);
6988
+ return l ? $e(n, l) : !1;
6972
6989
  }
6973
6990
  return !1;
6974
6991
  }
@@ -7008,24 +7025,24 @@ function Nu(n) {
7008
7025
  }
7009
7026
  function Du(n, e) {
7010
7027
  let t = e.keyCode, r = Nu(e);
7011
- if (t == 8 || pe && t == 72 && r == "c")
7028
+ if (t == 8 || me && t == 72 && r == "c")
7012
7029
  return oo(n, -1) || Mt(n, -1);
7013
- if (t == 46 && !e.shiftKey || pe && t == 68 && r == "c")
7030
+ if (t == 46 && !e.shiftKey || me && t == 68 && r == "c")
7014
7031
  return oo(n, 1) || Mt(n, 1);
7015
7032
  if (t == 13 || t == 27)
7016
7033
  return !0;
7017
- if (t == 37 || pe && t == 66 && r == "c") {
7034
+ if (t == 37 || me && t == 66 && r == "c") {
7018
7035
  let i = t == 37 ? io(n, n.state.selection.from) == "ltr" ? -1 : 1 : -1;
7019
7036
  return ro(n, i, r) || Mt(n, i);
7020
- } else if (t == 39 || pe && t == 70 && r == "c") {
7037
+ } else if (t == 39 || me && t == 70 && r == "c") {
7021
7038
  let i = t == 39 ? io(n, n.state.selection.from) == "ltr" ? 1 : -1 : 1;
7022
7039
  return ro(n, i, r) || Mt(n, i);
7023
7040
  } else {
7024
- if (t == 38 || pe && t == 80 && r == "c")
7041
+ if (t == 38 || me && t == 80 && r == "c")
7025
7042
  return so(n, -1, r) || Mt(n, -1);
7026
- if (t == 40 || pe && t == 78 && r == "c")
7043
+ if (t == 40 || me && t == 78 && r == "c")
7027
7044
  return vu(n) || so(n, 1, r) || Mt(n, 1);
7028
- if (r == (pe ? "m" : "c") && (t == 66 || t == 73 || t == 89 || t == 90))
7045
+ if (r == (me ? "m" : "c") && (t == 66 || t == 73 || t == 89 || t == 90))
7029
7046
  return !0;
7030
7047
  }
7031
7048
  return !1;
@@ -7271,7 +7288,7 @@ function ju(n, e) {
7271
7288
  }
7272
7289
  re.keydown = (n, e) => {
7273
7290
  let t = e;
7274
- if (n.input.shiftKey = t.keyCode == 16 || t.shiftKey, !Ql(n, t) && (n.input.lastKeyCode = t.keyCode, n.input.lastKeyCodeTime = Date.now(), !(Re && X && t.keyCode == 13)))
7291
+ if (n.input.shiftKey = t.keyCode == 16 || t.shiftKey, !Ql(n, t) && (n.input.lastKeyCode = t.keyCode, n.input.lastKeyCodeTime = Date.now(), !(Pe && X && t.keyCode == 13)))
7275
7292
  if (t.keyCode != 229 && n.domObserver.forceFlush(), Pt && t.keyCode == 13 && !t.ctrlKey && !t.altKey && !t.metaKey) {
7276
7293
  let r = Date.now();
7277
7294
  n.input.lastIOSEnter = r, n.input.lastIOSEnterFallbackTimeout = setTimeout(() => {
@@ -7284,7 +7301,7 @@ re.keyup = (n, e) => {
7284
7301
  };
7285
7302
  re.keypress = (n, e) => {
7286
7303
  let t = e;
7287
- if (Ql(n, t) || !t.charCode || t.ctrlKey && !t.altKey || pe && t.metaKey)
7304
+ if (Ql(n, t) || !t.charCode || t.ctrlKey && !t.altKey || me && t.metaKey)
7288
7305
  return;
7289
7306
  if (n.someProp("handleKeyPress", (i) => i(n, t))) {
7290
7307
  t.preventDefault();
@@ -7369,7 +7386,7 @@ function Yu(n, e, t) {
7369
7386
  function Xi(n) {
7370
7387
  return Wn(n);
7371
7388
  }
7372
- const Xl = pe ? "metaKey" : "ctrlKey";
7389
+ const Xl = me ? "metaKey" : "ctrlKey";
7373
7390
  ne.mousedown = (n, e) => {
7374
7391
  let t = e;
7375
7392
  n.input.shiftKey = t.shiftKey;
@@ -7395,13 +7412,13 @@ class Xu {
7395
7412
  node: s,
7396
7413
  pos: o,
7397
7414
  addAttr: !!(this.target && !this.target.draggable),
7398
- setUneditable: !!(this.target && ye && !this.target.hasAttribute("contentEditable"))
7415
+ setUneditable: !!(this.target && be && !this.target.hasAttribute("contentEditable"))
7399
7416
  }), this.target && this.mightDrag && (this.mightDrag.addAttr || this.mightDrag.setUneditable) && (this.view.domObserver.stop(), this.mightDrag.addAttr && (this.target.draggable = !0), this.mightDrag.setUneditable && setTimeout(() => {
7400
7417
  this.view.input.mouseDown == this && this.target.setAttribute("contentEditable", "false");
7401
7418
  }, 20), this.view.domObserver.start()), e.root.addEventListener("mouseup", this.up = this.up.bind(this)), e.root.addEventListener("mousemove", this.move = this.move.bind(this)), Ue(e, "pointer");
7402
7419
  }
7403
7420
  done() {
7404
- this.view.root.removeEventListener("mouseup", this.up), this.view.root.removeEventListener("mousemove", this.move), this.mightDrag && this.target && (this.view.domObserver.stop(), this.mightDrag.addAttr && this.target.removeAttribute("draggable"), this.mightDrag.setUneditable && this.target.removeAttribute("contentEditable"), this.view.domObserver.start()), this.delayedSelectionSync && setTimeout(() => Le(this.view)), this.view.input.mouseDown = null;
7421
+ this.view.root.removeEventListener("mouseup", this.up), this.view.root.removeEventListener("mousemove", this.move), this.mightDrag && this.target && (this.view.domObserver.stop(), this.mightDrag.addAttr && this.target.removeAttribute("draggable"), this.mightDrag.setUneditable && this.target.removeAttribute("contentEditable"), this.view.domObserver.start()), this.delayedSelectionSync && setTimeout(() => Be(this.view)), this.view.input.mouseDown = null;
7405
7422
  }
7406
7423
  up(e) {
7407
7424
  if (this.done(), !this.view.dom.contains(e.target))
@@ -7434,14 +7451,14 @@ ne.contextmenu = (n) => Xi(n);
7434
7451
  function Ql(n, e) {
7435
7452
  return n.composing ? !0 : ee && Math.abs(e.timeStamp - n.input.compositionEndedAt) < 500 ? (n.input.compositionEndedAt = -2e8, !0) : !1;
7436
7453
  }
7437
- const Qu = Re ? 5e3 : -1;
7454
+ const Qu = Pe ? 5e3 : -1;
7438
7455
  re.compositionstart = re.compositionupdate = (n) => {
7439
7456
  if (!n.composing) {
7440
7457
  n.domObserver.flush();
7441
7458
  let { state: e } = n, t = e.selection.$to;
7442
7459
  if (e.selection instanceof E && (e.storedMarks || !t.textOffset && t.parentOffset && t.nodeBefore.marks.some((r) => r.type.spec.inclusive === !1) || X && vl && Zu(n)))
7443
7460
  n.markCursor = n.state.storedMarks || t.marks(), Wn(n, !0), n.markCursor = null;
7444
- else if (Wn(n, !e.selection.empty), ye && e.selection.empty && t.parentOffset && !t.textOffset && t.nodeBefore.marks.length) {
7461
+ else if (Wn(n, !e.selection.empty), be && e.selection.empty && t.parentOffset && !t.textOffset && t.nodeBefore.marks.length) {
7445
7462
  let r = n.domSelectionRange();
7446
7463
  for (let i = r.focusNode, s = r.focusOffset; i && i.nodeType == 1 && s != 0; ) {
7447
7464
  let o = s < 0 ? i.lastChild : i.childNodes[s - 1];
@@ -7500,7 +7517,7 @@ function td() {
7500
7517
  return n.initEvent("event", !0, !0), n.timeStamp;
7501
7518
  }
7502
7519
  function Wn(n, e = !1) {
7503
- if (!(Re && n.domObserver.flushingSoon >= 0)) {
7520
+ if (!(Pe && n.domObserver.flushingSoon >= 0)) {
7504
7521
  if (n.domObserver.forceFlush(), ea(n), e || n.docView && n.docView.dirty) {
7505
7522
  let t = Ki(n), r = n.state.selection;
7506
7523
  return t && !t.eq(r) ? n.dispatch(n.state.tr.setSelection(t)) : (n.markCursor || e) && !r.$from.node(r.$from.sharedDepth(r.to)).inlineContent ? n.dispatch(n.state.tr.deleteSelection()) : n.updateState(n.state), !0;
@@ -7518,7 +7535,7 @@ function nd(n, e) {
7518
7535
  t.parentNode && t.parentNode.removeChild(t), n.focus();
7519
7536
  }, 50);
7520
7537
  }
7521
- const ln = le && qe < 15 || Pt && Xc < 604;
7538
+ const ln = ae && qe < 15 || Pt && Xc < 604;
7522
7539
  ne.copy = re.cut = (n, e) => {
7523
7540
  let t = e, r = n.state.selection, i = t.type == "cut";
7524
7541
  if (r.empty)
@@ -7557,7 +7574,7 @@ function ta(n) {
7557
7574
  }
7558
7575
  re.paste = (n, e) => {
7559
7576
  let t = e;
7560
- if (n.composing && !Re)
7577
+ if (n.composing && !Pe)
7561
7578
  return;
7562
7579
  let r = ln ? null : t.clipboardData, i = n.input.shiftKey && n.input.lastKeyCode != 45;
7563
7580
  r && an(n, ta(r), r.getData("text/html"), i, t) ? t.preventDefault() : id(n, t);
@@ -7567,7 +7584,7 @@ class na {
7567
7584
  this.slice = e, this.move = t, this.node = r;
7568
7585
  }
7569
7586
  }
7570
- const sd = pe ? "altKey" : "ctrlKey";
7587
+ const sd = me ? "altKey" : "ctrlKey";
7571
7588
  function ra(n, e) {
7572
7589
  let t;
7573
7590
  return n.someProp("dragCopies", (r) => {
@@ -7643,7 +7660,7 @@ function od(n, e, t) {
7643
7660
  }
7644
7661
  ne.focus = (n) => {
7645
7662
  n.input.lastFocus = Date.now(), n.focused || (n.domObserver.stop(), n.dom.classList.add("ProseMirror-focused"), n.domObserver.start(), n.focused = !0, setTimeout(() => {
7646
- n.docView && n.hasFocus() && !n.domObserver.currentSelection.eq(n.domSelectionRange()) && Le(n);
7663
+ n.docView && n.hasFocus() && !n.domObserver.currentSelection.eq(n.domSelectionRange()) && Be(n);
7647
7664
  }, 20));
7648
7665
  };
7649
7666
  ne.blur = (n, e) => {
@@ -7651,7 +7668,7 @@ ne.blur = (n, e) => {
7651
7668
  n.focused && (n.domObserver.stop(), n.dom.classList.remove("ProseMirror-focused"), n.domObserver.start(), t.relatedTarget && n.dom.contains(t.relatedTarget) && n.domObserver.currentSelection.clear(), n.focused = !1);
7652
7669
  };
7653
7670
  ne.beforeinput = (n, e) => {
7654
- if (X && Re && e.inputType == "deleteContentBackward") {
7671
+ if (X && Pe && e.inputType == "deleteContentBackward") {
7655
7672
  n.domObserver.flushSoon();
7656
7673
  let { domChangeCount: r } = n.input;
7657
7674
  setTimeout(() => {
@@ -7681,7 +7698,7 @@ class Un {
7681
7698
  }
7682
7699
  map(e, t, r, i) {
7683
7700
  let { pos: s, deleted: o } = e.mapResult(t.from + i, this.side < 0 ? -1 : 1);
7684
- return o ? null : new ge(s - r, s - r, this);
7701
+ return o ? null : new ye(s - r, s - r, this);
7685
7702
  }
7686
7703
  valid() {
7687
7704
  return !0;
@@ -7699,7 +7716,7 @@ class Ge {
7699
7716
  }
7700
7717
  map(e, t, r, i) {
7701
7718
  let s = e.map(t.from + i, this.spec.inclusiveStart ? -1 : 1) - r, o = e.map(t.to + i, this.spec.inclusiveEnd ? 1 : -1) - r;
7702
- return s >= o ? null : new ge(s, o, this);
7719
+ return s >= o ? null : new ye(s, o, this);
7703
7720
  }
7704
7721
  valid(e, t) {
7705
7722
  return t.from < t.to;
@@ -7722,7 +7739,7 @@ class Qi {
7722
7739
  if (s.deleted)
7723
7740
  return null;
7724
7741
  let o = e.mapResult(t.to + i, -1);
7725
- return o.deleted || o.pos <= s.pos ? null : new ge(s.pos - r, o.pos - r, this);
7742
+ return o.deleted || o.pos <= s.pos ? null : new ye(s.pos - r, o.pos - r, this);
7726
7743
  }
7727
7744
  valid(e, t) {
7728
7745
  let { index: r, offset: i } = e.content.findIndex(t.from), s;
@@ -7734,7 +7751,7 @@ class Qi {
7734
7751
  destroy() {
7735
7752
  }
7736
7753
  }
7737
- class ge {
7754
+ class ye {
7738
7755
  /**
7739
7756
  @internal
7740
7757
  */
@@ -7745,7 +7762,7 @@ class ge {
7745
7762
  @internal
7746
7763
  */
7747
7764
  copy(e, t) {
7748
- return new ge(e, t, this.type);
7765
+ return new ye(e, t, this.type);
7749
7766
  }
7750
7767
  /**
7751
7768
  @internal
@@ -7768,14 +7785,14 @@ class ge {
7768
7785
  widget's current document position.
7769
7786
  */
7770
7787
  static widget(e, t, r) {
7771
- return new ge(e, e, new Un(t, r));
7788
+ return new ye(e, e, new Un(t, r));
7772
7789
  }
7773
7790
  /**
7774
7791
  Creates an inline decoration, which adds the given attributes to
7775
7792
  each inline node between `from` and `to`.
7776
7793
  */
7777
7794
  static inline(e, t, r, i) {
7778
- return new ge(e, t, new Ge(r, i));
7795
+ return new ye(e, t, new Ge(r, i));
7779
7796
  }
7780
7797
  /**
7781
7798
  Creates a node decoration. `from` and `to` should point precisely
@@ -7783,7 +7800,7 @@ class ge {
7783
7800
  node, will receive the given attributes.
7784
7801
  */
7785
7802
  static node(e, t, r, i) {
7786
- return new ge(e, t, new Qi(r, i));
7803
+ return new ye(e, t, new Qi(r, i));
7787
7804
  }
7788
7805
  /**
7789
7806
  The spec provided when creating this decoration. Can be useful
@@ -7934,7 +7951,7 @@ class V {
7934
7951
  }
7935
7952
  if (i) {
7936
7953
  let l = new V(i.sort(ft), Tt);
7937
- return r ? new He([l, r]) : l;
7954
+ return r ? new Ve([l, r]) : l;
7938
7955
  }
7939
7956
  return r || Z;
7940
7957
  }
@@ -7980,13 +7997,13 @@ class V {
7980
7997
  V.empty = new V([], []);
7981
7998
  V.removeOverlap = Zi;
7982
7999
  const Z = V.empty;
7983
- class He {
8000
+ class Ve {
7984
8001
  constructor(e) {
7985
8002
  this.members = e;
7986
8003
  }
7987
8004
  map(e, t) {
7988
8005
  const r = this.members.map((i) => i.map(e, t, dt));
7989
- return He.from(r);
8006
+ return Ve.from(r);
7990
8007
  }
7991
8008
  forChild(e, t) {
7992
8009
  if (t.isLeaf)
@@ -7994,12 +8011,12 @@ class He {
7994
8011
  let r = [];
7995
8012
  for (let i = 0; i < this.members.length; i++) {
7996
8013
  let s = this.members[i].forChild(e, t);
7997
- s != Z && (s instanceof He ? r = r.concat(s.members) : r.push(s));
8014
+ s != Z && (s instanceof Ve ? r = r.concat(s.members) : r.push(s));
7998
8015
  }
7999
- return He.from(r);
8016
+ return Ve.from(r);
8000
8017
  }
8001
8018
  eq(e) {
8002
- if (!(e instanceof He) || e.members.length != this.members.length)
8019
+ if (!(e instanceof Ve) || e.members.length != this.members.length)
8003
8020
  return !1;
8004
8021
  for (let t = 0; t < this.members.length; t++)
8005
8022
  if (!this.members[t].eq(e.members[t]))
@@ -8030,7 +8047,7 @@ class He {
8030
8047
  case 1:
8031
8048
  return e[0];
8032
8049
  default:
8033
- return new He(e.every((t) => t instanceof V) ? e : e.reduce((t, r) => t.concat(r instanceof V ? r : r.members), []));
8050
+ return new Ve(e.every((t) => t instanceof V) ? e : e.reduce((t, r) => t.concat(r instanceof V ? r : r.members), []));
8034
8051
  }
8035
8052
  }
8036
8053
  forEachSet(e) {
@@ -8093,7 +8110,7 @@ function ia(n, e) {
8093
8110
  let t = [];
8094
8111
  for (let r = 0; r < n.length; r++) {
8095
8112
  let i = n[r];
8096
- t.push(new ge(i.from + e, i.to + e, i.type));
8113
+ t.push(new ye(i.from + e, i.to + e, i.type));
8097
8114
  }
8098
8115
  return t;
8099
8116
  }
@@ -8170,7 +8187,7 @@ function Xr(n) {
8170
8187
  return n.someProp("decorations", (t) => {
8171
8188
  let r = t(n.state);
8172
8189
  r && r != Z && e.push(r);
8173
- }), n.cursorWrapper && e.push(V.create(n.state.doc, [n.cursorWrapper.deco])), He.from(e);
8190
+ }), n.cursorWrapper && e.push(V.create(n.state.doc, [n.cursorWrapper.deco])), Ve.from(e);
8174
8191
  }
8175
8192
  const cd = {
8176
8193
  childList: !0,
@@ -8179,7 +8196,7 @@ const cd = {
8179
8196
  attributes: !0,
8180
8197
  attributeOldValue: !0,
8181
8198
  subtree: !0
8182
- }, ud = le && qe <= 11;
8199
+ }, ud = ae && qe <= 11;
8183
8200
  class dd {
8184
8201
  constructor() {
8185
8202
  this.anchorNode = null, this.anchorOffset = 0, this.focusNode = null, this.focusOffset = 0;
@@ -8199,7 +8216,7 @@ class fd {
8199
8216
  this.view = e, this.handleDOMChange = t, this.queue = [], this.flushingSoon = -1, this.observer = null, this.currentSelection = new dd(), this.onCharData = null, this.suppressingSelectionUpdates = !1, this.lastChangedTextNode = null, this.observer = window.MutationObserver && new window.MutationObserver((r) => {
8200
8217
  for (let i = 0; i < r.length; i++)
8201
8218
  this.queue.push(r[i]);
8202
- le && qe <= 11 && r.some((i) => i.type == "childList" && i.removedNodes.length || i.type == "characterData" && i.oldValue.length > i.target.nodeValue.length) ? this.flushSoon() : ee && e.composing && r.some((i) => i.type == "childList" && i.target.nodeName == "TR") ? (e.input.badSafariComposition = !0, this.flushSoon()) : this.flush();
8219
+ ae && qe <= 11 && r.some((i) => i.type == "childList" && i.removedNodes.length || i.type == "characterData" && i.oldValue.length > i.target.nodeValue.length) ? this.flushSoon() : ee && e.composing && r.some((i) => i.type == "childList" && i.target.nodeName == "TR") ? (e.input.badSafariComposition = !0, this.flushSoon()) : this.flush();
8203
8220
  }), ud && (this.onCharData = (r) => {
8204
8221
  this.queue.push({ target: r.target, type: "characterData", oldValue: r.prevValue }), this.flushSoon();
8205
8222
  }), this.onSelectionChange = this.onSelectionChange.bind(this);
@@ -8239,8 +8256,8 @@ class fd {
8239
8256
  onSelectionChange() {
8240
8257
  if (no(this.view)) {
8241
8258
  if (this.suppressingSelectionUpdates)
8242
- return Le(this.view);
8243
- if (le && qe <= 11 && !this.view.state.selection.empty) {
8259
+ return Be(this.view);
8260
+ if (ae && qe <= 11 && !this.view.state.selection.empty) {
8244
8261
  let e = this.view.domSelectionRange();
8245
8262
  if (e.focusNode && gt(e.focusNode, e.focusOffset, e.anchorNode, e.anchorOffset))
8246
8263
  return this.flushSoon();
@@ -8299,7 +8316,7 @@ class fd {
8299
8316
  d = d.firstChild;
8300
8317
  }
8301
8318
  }
8302
- } else if (ye && a.length) {
8319
+ } else if (be && a.length) {
8303
8320
  let u = a.filter((d) => d.nodeName == "BR");
8304
8321
  if (u.length == 2) {
8305
8322
  let [d, f] = u;
@@ -8313,7 +8330,7 @@ class fd {
8313
8330
  }
8314
8331
  }
8315
8332
  let c = null;
8316
- s < 0 && i && e.input.lastFocus > Date.now() - 200 && Math.max(e.input.lastTouch, e.input.lastClick.time) < Date.now() - 300 && Ar(r) && (c = Ki(e)) && c.eq(A.near(e.state.doc.resolve(0), 1)) ? (e.input.lastFocus = 0, Le(e), this.currentSelection.set(r), e.scrollToSelection()) : (s > -1 || i) && (s > -1 && (e.docView.markDirty(s, o), hd(e)), e.input.badSafariComposition && (e.input.badSafariComposition = !1, gd(e, a)), this.handleDOMChange(s, o, l, a), e.docView && e.docView.dirty ? e.updateState(e.state) : this.currentSelection.eq(r) || Le(e), this.currentSelection.set(r));
8333
+ s < 0 && i && e.input.lastFocus > Date.now() - 200 && Math.max(e.input.lastTouch, e.input.lastClick.time) < Date.now() - 300 && Ar(r) && (c = Ki(e)) && c.eq(A.near(e.state.doc.resolve(0), 1)) ? (e.input.lastFocus = 0, Be(e), this.currentSelection.set(r), e.scrollToSelection()) : (s > -1 || i) && (s > -1 && (e.docView.markDirty(s, o), hd(e)), e.input.badSafariComposition && (e.input.badSafariComposition = !1, gd(e, a)), this.handleDOMChange(s, o, l, a), e.docView && e.docView.dirty ? e.updateState(e.state) : this.currentSelection.eq(r) || Be(e), this.currentSelection.set(r));
8317
8334
  }
8318
8335
  registerMutation(e, t) {
8319
8336
  if (t.indexOf(e.target) > -1)
@@ -8330,7 +8347,7 @@ class fd {
8330
8347
  if (r.contentDOM && r.contentDOM != r.dom && !r.contentDOM.contains(e.target))
8331
8348
  return { from: r.posBefore, to: r.posAfter };
8332
8349
  let i = e.previousSibling, s = e.nextSibling;
8333
- if (le && qe <= 11 && e.addedNodes.length)
8350
+ if (ae && qe <= 11 && e.addedNodes.length)
8334
8351
  for (let u = 0; u < e.addedNodes.length; u++) {
8335
8352
  let { previousSibling: d, nextSibling: f } = e.addedNodes[u];
8336
8353
  (!d || Array.prototype.indexOf.call(e.addedNodes, d) < 0) && (i = d), (!f || Array.prototype.indexOf.call(e.addedNodes, f) < 0) && (s = f);
@@ -8351,7 +8368,7 @@ class fd {
8351
8368
  let fo = /* @__PURE__ */ new WeakMap(), ho = !1;
8352
8369
  function hd(n) {
8353
8370
  if (!fo.has(n) && (fo.set(n, null), ["normal", "nowrap", "pre-line"].indexOf(getComputedStyle(n.dom).whiteSpace) !== -1)) {
8354
- if (n.requiresGeckoHackNode = ye, ho)
8371
+ if (n.requiresGeckoHackNode = be, ho)
8355
8372
  return;
8356
8373
  console.warn("ProseMirror expects the CSS white-space property to be set, preferably to 'pre-wrap'. It is recommended to load style/prosemirror.css from the prosemirror-view package."), ho = !0;
8357
8374
  }
@@ -8450,7 +8467,7 @@ function xd(n, e, t, r, i) {
8450
8467
  if (n.input.compositionPendingChanges = 0, e < 0) {
8451
8468
  let T = n.input.lastSelectionTime > Date.now() - 50 ? n.input.lastSelectionOrigin : null, I = Ki(n, T);
8452
8469
  if (I && !n.state.selection.eq(I)) {
8453
- if (X && Re && n.input.lastKeyCode === 13 && Date.now() - 100 < n.input.lastKeyCodeTime && n.someProp("handleKeyDown", (bn) => bn(n, nt(13, "Enter"))))
8470
+ if (X && Pe && n.input.lastKeyCode === 13 && Date.now() - 100 < n.input.lastKeyCodeTime && n.someProp("handleKeyDown", (bn) => bn(n, nt(13, "Enter"))))
8454
8471
  return;
8455
8472
  let F = n.state.tr.setSelection(I);
8456
8473
  T == "pointer" ? F.setMeta("pointer", !0) : T == "key" && F.scrollIntoView(), s && F.setMeta("composition", s), n.dispatch(F);
@@ -8462,7 +8479,7 @@ function xd(n, e, t, r, i) {
8462
8479
  let a = n.state.selection, c = yd(n, e, t), u = n.state.doc, d = u.slice(c.from, c.to), f, h;
8463
8480
  n.input.lastKeyCode === 8 && Date.now() - 100 < n.input.lastKeyCodeTime ? (f = n.state.selection.to, h = "end") : (f = n.state.selection.from, h = "start"), n.input.lastKeyCode = null;
8464
8481
  let p = Md(d.content, c.doc.content, c.from, f, h);
8465
- if (p && n.input.domChangeCount++, (Pt && n.input.lastIOSEnter > Date.now() - 225 || Re) && i.some((T) => T.nodeType == 1 && !kd.test(T.nodeName)) && (!p || p.endA >= p.endB) && n.someProp("handleKeyDown", (T) => T(n, nt(13, "Enter")))) {
8482
+ if (p && n.input.domChangeCount++, (Pt && n.input.lastIOSEnter > Date.now() - 225 || Pe) && i.some((T) => T.nodeType == 1 && !kd.test(T.nodeName)) && (!p || p.endA >= p.endB) && n.someProp("handleKeyDown", (T) => T(n, nt(13, "Enter")))) {
8466
8483
  n.input.lastIOSEnter = 0;
8467
8484
  return;
8468
8485
  }
@@ -8479,17 +8496,17 @@ function xd(n, e, t, r, i) {
8479
8496
  }
8480
8497
  return;
8481
8498
  }
8482
- n.state.selection.from < n.state.selection.to && p.start == p.endB && n.state.selection instanceof E && (p.start > n.state.selection.from && p.start <= n.state.selection.from + 2 && n.state.selection.from >= c.from ? p.start = n.state.selection.from : p.endA < n.state.selection.to && p.endA >= n.state.selection.to - 2 && n.state.selection.to <= c.to && (p.endB += n.state.selection.to - p.endA, p.endA = n.state.selection.to)), le && qe <= 11 && p.endB == p.start + 1 && p.endA == p.start && p.start > c.from && c.doc.textBetween(p.start - c.from - 1, p.start - c.from + 1) == "  " && (p.start--, p.endA--, p.endB--);
8499
+ n.state.selection.from < n.state.selection.to && p.start == p.endB && n.state.selection instanceof E && (p.start > n.state.selection.from && p.start <= n.state.selection.from + 2 && n.state.selection.from >= c.from ? p.start = n.state.selection.from : p.endA < n.state.selection.to && p.endA >= n.state.selection.to - 2 && n.state.selection.to <= c.to && (p.endB += n.state.selection.to - p.endA, p.endA = n.state.selection.to)), ae && qe <= 11 && p.endB == p.start + 1 && p.endA == p.start && p.start > c.from && c.doc.textBetween(p.start - c.from - 1, p.start - c.from + 1) == "  " && (p.start--, p.endA--, p.endB--);
8483
8500
  let m = c.doc.resolveNoCache(p.start - c.from), g = c.doc.resolveNoCache(p.endB - c.from), y = u.resolve(p.start), M = m.sameParent(g) && m.parent.inlineContent && y.end() >= p.endA;
8484
8501
  if ((Pt && n.input.lastIOSEnter > Date.now() - 225 && (!M || i.some((T) => T.nodeName == "DIV" || T.nodeName == "P")) || !M && m.pos < c.doc.content.size && (!m.sameParent(g) || !m.parent.inlineContent) && m.pos < g.pos && !/\S/.test(c.doc.textBetween(m.pos, g.pos, "", ""))) && n.someProp("handleKeyDown", (T) => T(n, nt(13, "Enter")))) {
8485
8502
  n.input.lastIOSEnter = 0;
8486
8503
  return;
8487
8504
  }
8488
8505
  if (n.state.selection.anchor > p.start && Cd(u, p.start, p.endA, m, g) && n.someProp("handleKeyDown", (T) => T(n, nt(8, "Backspace")))) {
8489
- Re && X && n.domObserver.suppressSelectionUpdates();
8506
+ Pe && X && n.domObserver.suppressSelectionUpdates();
8490
8507
  return;
8491
8508
  }
8492
- X && p.endB == p.start && (n.input.lastChromeDelete = Date.now()), Re && !M && m.start() != g.start() && g.parentOffset == 0 && m.depth == g.depth && c.sel && c.sel.anchor == c.sel.head && c.sel.head == p.endA && (p.endB -= 2, g = c.doc.resolveNoCache(p.endB - c.from), setTimeout(() => {
8509
+ X && p.endB == p.start && (n.input.lastChromeDelete = Date.now()), Pe && !M && m.start() != g.start() && g.parentOffset == 0 && m.depth == g.depth && c.sel && c.sel.anchor == c.sel.head && c.sel.head == p.endA && (p.endB -= 2, g = c.doc.resolveNoCache(p.endB - c.from), setTimeout(() => {
8493
8510
  n.someProp("handleKeyDown", function(T) {
8494
8511
  return T(n, nt(13, "Enter"));
8495
8512
  });
@@ -8498,13 +8515,13 @@ function xd(n, e, t, r, i) {
8498
8515
  let I = T || n.state.tr.replace(w, O, c.doc.slice(p.start - c.from, p.endB - c.from));
8499
8516
  if (c.sel) {
8500
8517
  let F = mo(n, I.doc, c.sel);
8501
- F && !(X && n.composing && F.empty && (p.start != p.endB || n.input.lastChromeDelete < Date.now() - 100) && (F.head == w || F.head == I.mapping.map(O) - 1) || le && F.empty && F.head == w) && I.setSelection(F);
8518
+ F && !(X && n.composing && F.empty && (p.start != p.endB || n.input.lastChromeDelete < Date.now() - 100) && (F.head == w || F.head == I.mapping.map(O) - 1) || ae && F.empty && F.head == w) && I.setSelection(F);
8502
8519
  }
8503
8520
  return s && I.setMeta("composition", s), I.scrollIntoView();
8504
8521
  }, L;
8505
8522
  if (M)
8506
8523
  if (m.pos == g.pos) {
8507
- le && qe <= 11 && m.parentOffset == 0 && (n.domObserver.suppressSelectionUpdates(), setTimeout(() => Le(n), 20));
8524
+ ae && qe <= 11 && m.parentOffset == 0 && (n.domObserver.suppressSelectionUpdates(), setTimeout(() => Be(n), 20));
8508
8525
  let T = D(n.state.tr.delete(w, O)), I = u.resolve(p.start).marksAcross(u.resolve(p.endA));
8509
8526
  I && T.ensureMarks(I), n.dispatch(T);
8510
8527
  } else if (
@@ -8671,12 +8688,12 @@ class la {
8671
8688
  let f = u == "preserve" && o && this.dom.style.overflowAnchor == null && eu(this);
8672
8689
  if (o) {
8673
8690
  this.domObserver.stop();
8674
- let h = d && (le || X) && !this.composing && !i.selection.empty && !e.selection.empty && wd(i.selection, e.selection);
8691
+ let h = d && (ae || X) && !this.composing && !i.selection.empty && !e.selection.empty && wd(i.selection, e.selection);
8675
8692
  if (d) {
8676
8693
  let p = X ? this.trackWrites = this.domSelectionRange().focusNode : null;
8677
8694
  this.composing && (this.input.compositionNode = ed(this)), (s || !this.docView.update(e.doc, c, a, this)) && (this.docView.updateOuterDeco(c), this.docView.destroy(), this.docView = Ys(e.doc, c, a, this.dom, this)), p && (!this.trackWrites || !this.dom.contains(this.trackWrites)) && (h = !0);
8678
8695
  }
8679
- h || !(this.input.mouseDown && this.domObserver.currentSelection.eq(this.domSelectionRange()) && wu(this)) ? Le(this, h) : (Vl(this, e.selection), this.domObserver.setCurSelection()), this.domObserver.start();
8696
+ h || !(this.input.mouseDown && this.domObserver.currentSelection.eq(this.domSelectionRange()) && wu(this)) ? Be(this, h) : (Vl(this, e.selection), this.domObserver.setCurSelection()), this.domObserver.start();
8680
8697
  }
8681
8698
  this.updatePluginViews(i), !((r = this.dragging) === null || r === void 0) && r.node && !i.doc.eq(e.doc) && this.updateDraggedNode(this.dragging, i), u == "reset" ? this.dom.scrollTop = 0 : u == "to selection" ? this.scrollToSelection() : f && tu(f);
8682
8699
  }
@@ -8746,7 +8763,7 @@ class la {
8746
8763
  Query whether the view has focus.
8747
8764
  */
8748
8765
  hasFocus() {
8749
- if (le) {
8766
+ if (ae) {
8750
8767
  let e = this.root.activeElement;
8751
8768
  if (e == this.dom)
8752
8769
  return !0;
@@ -8765,7 +8782,7 @@ class la {
8765
8782
  Focus the editor.
8766
8783
  */
8767
8784
  focus() {
8768
- this.domObserver.stop(), this.editable && nu(this.dom), Le(this), this.domObserver.start();
8785
+ this.domObserver.stop(), this.editable && nu(this.dom), Be(this), this.domObserver.start();
8769
8786
  }
8770
8787
  /**
8771
8788
  Get the document root in which the editor exists. This will
@@ -8936,12 +8953,12 @@ function yo(n) {
8936
8953
  if (typeof t == "function" && (t = t(n.state)), t)
8937
8954
  for (let r in t)
8938
8955
  r == "class" ? e.class += " " + t[r] : r == "style" ? e.style = (e.style ? e.style + ";" : "") + t[r] : !e[r] && r != "contenteditable" && r != "nodeName" && (e[r] = String(t[r]));
8939
- }), e.translate || (e.translate = "no"), [ge.node(0, n.state.doc.content.size, e)];
8956
+ }), e.translate || (e.translate = "no"), [ye.node(0, n.state.doc.content.size, e)];
8940
8957
  }
8941
8958
  function bo(n) {
8942
8959
  if (n.markCursor) {
8943
8960
  let e = document.createElement("img");
8944
- e.className = "ProseMirror-separator", e.setAttribute("mark-placeholder", "true"), e.setAttribute("alt", ""), n.cursorWrapper = { dom: e, deco: ge.widget(n.state.selection.from, e, { raw: !0, marks: n.markCursor }) };
8961
+ e.className = "ProseMirror-separator", e.setAttribute("mark-placeholder", "true"), e.setAttribute("alt", ""), n.cursorWrapper = { dom: e, deco: ye.widget(n.state.selection.from, e, { raw: !0, marks: n.markCursor }) };
8945
8962
  } else
8946
8963
  n.cursorWrapper = null;
8947
8964
  }
@@ -9322,7 +9339,7 @@ const $d = (n, e) => {
9322
9339
  return !0;
9323
9340
  }, ya = (n, e) => {
9324
9341
  let t = n.selection, { $from: r, $to: i } = t;
9325
- if (t instanceof ce || r.parent.inlineContent || i.parent.inlineContent)
9342
+ if (t instanceof ue || r.parent.inlineContent || i.parent.inlineContent)
9326
9343
  return !1;
9327
9344
  let s = rs(i.parent.contentMatchAt(i.indexAfter()));
9328
9345
  if (!s || !s.isTextblock)
@@ -9338,7 +9355,7 @@ const $d = (n, e) => {
9338
9355
  return !1;
9339
9356
  if (t.depth > 1 && t.after() != t.end(-1)) {
9340
9357
  let s = t.before();
9341
- if (Pe(n.doc, s))
9358
+ if (Le(n.doc, s))
9342
9359
  return e && e(n.tr.split(s).scrollIntoView()), !0;
9343
9360
  }
9344
9361
  let r = t.blockRange(), i = r && zt(r);
@@ -9348,7 +9365,7 @@ function _d(n) {
9348
9365
  return (e, t) => {
9349
9366
  let { $from: r, $to: i } = e.selection;
9350
9367
  if (e.selection instanceof C && e.selection.node.isBlock)
9351
- return !r.parentOffset || !Pe(e.doc, r.pos) ? !1 : (t && t(e.tr.split(r.pos).scrollIntoView()), !0);
9368
+ return !r.parentOffset || !Le(e.doc, r.pos) ? !1 : (t && t(e.tr.split(r.pos).scrollIntoView()), !0);
9352
9369
  if (!r.depth)
9353
9370
  return !1;
9354
9371
  let s = [], o, l, a = !1, c = !1;
@@ -9362,9 +9379,9 @@ function _d(n) {
9362
9379
  s.unshift(null);
9363
9380
  }
9364
9381
  let u = e.tr;
9365
- (e.selection instanceof E || e.selection instanceof ce) && u.deleteSelection();
9366
- let d = u.mapping.map(r.pos), f = Pe(u.doc, d, s.length, s);
9367
- if (f || (s[0] = l ? { type: l } : null, f = Pe(u.doc, d, s.length, s)), !f)
9382
+ (e.selection instanceof E || e.selection instanceof ue) && u.deleteSelection();
9383
+ let d = u.mapping.map(r.pos), f = Le(u.doc, d, s.length, s);
9384
+ if (f || (s[0] = l ? { type: l } : null, f = Le(u.doc, d, s.length, s)), !f)
9368
9385
  return !1;
9369
9386
  if (u.split(d, s.length, s), !a && c && r.node(o).type != l) {
9370
9387
  let h = u.mapping.map(r.before(o)), p = u.doc.resolve(h);
@@ -9510,7 +9527,7 @@ function Gd(n, e, t, r, i) {
9510
9527
  t[u].type == i && (o = u + 1);
9511
9528
  let l = t.length - o, a = e.start + t.length - (r ? 2 : 0), c = e.parent;
9512
9529
  for (let u = e.startIndex, d = e.endIndex, f = !0; u < d; u++, f = !1)
9513
- !f && Pe(n.doc, a, l) && (n.split(a, l), a += 2 * l), a += c.child(u).nodeSize;
9530
+ !f && Le(n.doc, a, l) && (n.split(a, l), a += 2 * l), a += c.child(u).nodeSize;
9514
9531
  return n;
9515
9532
  }
9516
9533
  function Yd(n) {
@@ -10059,7 +10076,7 @@ function Lr(n, e) {
10059
10076
  Tn(e[r]) && Tn(n[r]) ? t[r] = Lr(n[r], e[r]) : t[r] = e[r];
10060
10077
  }), t;
10061
10078
  }
10062
- class xe {
10079
+ class Se {
10063
10080
  constructor(e = {}) {
10064
10081
  this.type = "mark", this.name = "mark", this.parent = null, this.child = null, this.config = {
10065
10082
  name: this.name,
@@ -10075,7 +10092,7 @@ class xe {
10075
10092
  })) || {};
10076
10093
  }
10077
10094
  static create(e = {}) {
10078
- return new xe(e);
10095
+ return new Se(e);
10079
10096
  }
10080
10097
  configure(e = {}) {
10081
10098
  const t = this.extend({
@@ -10085,7 +10102,7 @@ class xe {
10085
10102
  return t.name = this.name, t.parent = this.parent, t;
10086
10103
  }
10087
10104
  extend(e = {}) {
10088
- const t = new xe(e);
10105
+ const t = new Se(e);
10089
10106
  return t.parent = this, this.child = t, t.name = e.name ? e.name : t.parent.name, e.defaultOptions && Object.keys(e.defaultOptions).length > 0 && console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${t.name}".`), t.options = N(S(t, "addOptions", {
10090
10107
  name: t.name
10091
10108
  })), t.storage = N(S(t, "addStorage", {
@@ -10328,7 +10345,7 @@ class At {
10328
10345
  type: ti(o.name, this.schema)
10329
10346
  }, a = [], c = S(o, "addKeyboardShortcuts", l);
10330
10347
  let u = {};
10331
- if (o.type === "mark" && S(o, "exitable", l) && (u.ArrowRight = () => xe.handleExit({ editor: e, mark: o })), c) {
10348
+ if (o.type === "mark" && S(o, "exitable", l) && (u.ArrowRight = () => Se.handleExit({ editor: e, mark: o })), c) {
10332
10349
  const m = Object.fromEntries(Object.entries(c()).map(([g, y]) => [g, () => y({ editor: e })]));
10333
10350
  u = { ...u, ...m };
10334
10351
  }
@@ -10487,7 +10504,7 @@ const gf = K.create({
10487
10504
  addProseMirrorPlugins() {
10488
10505
  return [
10489
10506
  new Q({
10490
- key: new ue("clipboardTextSerializer"),
10507
+ key: new de("clipboardTextSerializer"),
10491
10508
  props: {
10492
10509
  clipboardTextSerializer: () => {
10493
10510
  const { editor: n } = this, { state: e, schema: t } = n, { doc: r, selection: i } = e, { ranges: s } = i, o = Math.min(...s.map((u) => u.$from.pos)), l = Math.max(...s.map((u) => u.$to.pos)), a = wa(t);
@@ -10894,7 +10911,7 @@ const Qf = (n, e) => ({ tr: t, state: r, dispatch: i }) => {
10894
10911
  }), !0) : !1;
10895
10912
  }, Zf = () => ({ tr: n, dispatch: e }) => (e && n.scrollIntoView(), !0), eh = () => ({ tr: n, dispatch: e }) => {
10896
10913
  if (e) {
10897
- const t = new ce(n.doc);
10914
+ const t = new ue(n.doc);
10898
10915
  n.setSelection(t);
10899
10916
  }
10900
10917
  return !0;
@@ -11189,7 +11206,7 @@ function No(n, e) {
11189
11206
  const Th = ({ keepMarks: n = !0 } = {}) => ({ tr: e, state: t, dispatch: r, editor: i }) => {
11190
11207
  const { selection: s, doc: o } = e, { $from: l, $to: a } = s, c = i.extensionManager.attributes, u = Pn(c, l.node().type.name, l.node().attrs);
11191
11208
  if (s instanceof C && s.node.isBlock)
11192
- return !l.parentOffset || !Pe(o, l.pos) ? !1 : (r && (n && No(t, i.extensionManager.splittableMarks), e.split(l.pos).scrollIntoView()), !0);
11209
+ return !l.parentOffset || !Le(o, l.pos) ? !1 : (r && (n && No(t, i.extensionManager.splittableMarks), e.split(l.pos).scrollIntoView()), !0);
11193
11210
  if (!l.parent.isBlock)
11194
11211
  return !1;
11195
11212
  const d = a.parentOffset === a.parent.content.size, f = l.depth === 0 ? void 0 : ah(l.node(-1).contentMatchAt(l.indexAfter(-1)));
@@ -11198,8 +11215,8 @@ const Th = ({ keepMarks: n = !0 } = {}) => ({ tr: e, state: t, dispatch: r, edit
11198
11215
  type: f,
11199
11216
  attrs: u
11200
11217
  }
11201
- ] : void 0, p = Pe(e.doc, e.mapping.map(l.pos), 1, h);
11202
- if (!h && !p && Pe(e.doc, e.mapping.map(l.pos), 1, f ? [{ type: f }] : void 0) && (p = !0, h = f ? [
11218
+ ] : void 0, p = Le(e.doc, e.mapping.map(l.pos), 1, h);
11219
+ if (!h && !p && Le(e.doc, e.mapping.map(l.pos), 1, f ? [{ type: f }] : void 0) && (p = !0, h = f ? [
11203
11220
  {
11204
11221
  type: f,
11205
11222
  attrs: u
@@ -11257,7 +11274,7 @@ const Th = ({ keepMarks: n = !0 } = {}) => ({ tr: e, state: t, dispatch: r, edit
11257
11274
  { type: l, attrs: p },
11258
11275
  { type: h, attrs: m }
11259
11276
  ] : [{ type: l, attrs: p }];
11260
- if (!Pe(t.doc, a.pos, 2))
11277
+ if (!Le(t.doc, a.pos, 2))
11261
11278
  return !1;
11262
11279
  if (i) {
11263
11280
  const { selection: y, storedMarks: M } = r, { splittableMarks: w } = s.extensionManager, O = M || y.$to.parentOffset && y.$from.marks();
@@ -11460,7 +11477,7 @@ const Fh = K.create({
11460
11477
  addProseMirrorPlugins() {
11461
11478
  return [
11462
11479
  new Q({
11463
- key: new ue("tiptapDrop"),
11480
+ key: new de("tiptapDrop"),
11464
11481
  props: {
11465
11482
  handleDrop: (n, e, t, r) => {
11466
11483
  this.editor.emit("drop", {
@@ -11479,14 +11496,14 @@ const Fh = K.create({
11479
11496
  addProseMirrorPlugins() {
11480
11497
  return [
11481
11498
  new Q({
11482
- key: new ue("editable"),
11499
+ key: new de("editable"),
11483
11500
  props: {
11484
11501
  editable: () => this.editor.options.editable
11485
11502
  }
11486
11503
  })
11487
11504
  ];
11488
11505
  }
11489
- }), Hh = new ue("focusEvents"), Vh = K.create({
11506
+ }), Hh = new de("focusEvents"), Vh = K.create({
11490
11507
  name: "focusEvents",
11491
11508
  addProseMirrorPlugins() {
11492
11509
  const { editor: n } = this;
@@ -11565,7 +11582,7 @@ const Fh = K.create({
11565
11582
  // This is an alternative to ProseMirror's `AllSelection`, which doesn’t work well
11566
11583
  // with many other commands.
11567
11584
  new Q({
11568
- key: new ue("clearDocument"),
11585
+ key: new de("clearDocument"),
11569
11586
  appendTransaction: (n, e, t) => {
11570
11587
  if (n.some((m) => m.getMeta("composition")))
11571
11588
  return;
@@ -11593,7 +11610,7 @@ const Fh = K.create({
11593
11610
  addProseMirrorPlugins() {
11594
11611
  return [
11595
11612
  new Q({
11596
- key: new ue("tiptapPaste"),
11613
+ key: new de("tiptapPaste"),
11597
11614
  props: {
11598
11615
  handlePaste: (n, e, t) => {
11599
11616
  this.editor.emit("paste", {
@@ -11611,7 +11628,7 @@ const Fh = K.create({
11611
11628
  addProseMirrorPlugins() {
11612
11629
  return [
11613
11630
  new Q({
11614
- key: new ue("tabindex"),
11631
+ key: new de("tabindex"),
11615
11632
  props: {
11616
11633
  attributes: () => this.editor.isEditable ? { tabindex: "0" } : {}
11617
11634
  }
@@ -12354,7 +12371,7 @@ const Xh = /^\s*>\s$/, Qh = ie.create({
12354
12371
  })
12355
12372
  ];
12356
12373
  }
12357
- }), Zh = /(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/, ep = /(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g, tp = /(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/, np = /(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g, rp = xe.create({
12374
+ }), Zh = /(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/, ep = /(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g, tp = /(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/, np = /(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g, rp = Se.create({
12358
12375
  name: "bold",
12359
12376
  addOptions() {
12360
12377
  return {
@@ -12468,7 +12485,7 @@ const Xh = /^\s*>\s$/, Qh = ie.create({
12468
12485
  n
12469
12486
  ];
12470
12487
  }
12471
- }), op = /(^|[^`])`([^`]+)`(?!`)/, lp = /(^|[^`])`([^`]+)`(?!`)/g, ap = xe.create({
12488
+ }), op = /(^|[^`])`([^`]+)`(?!`)/, lp = /(^|[^`])`([^`]+)`(?!`)/g, ap = Se.create({
12472
12489
  name: "code",
12473
12490
  addOptions() {
12474
12491
  return {
@@ -12625,7 +12642,7 @@ const Xh = /^\s*>\s$/, Qh = ie.create({
12625
12642
  // this plugin creates a code block for pasted content from VS Code
12626
12643
  // we can also detect the copied code language
12627
12644
  new Q({
12628
- key: new ue("codeBlockVSCodeHandler"),
12645
+ key: new de("codeBlockVSCodeHandler"),
12629
12646
  props: {
12630
12647
  handlePaste: (n, e) => {
12631
12648
  if (!e.clipboardData || this.editor.isActive(this.type.name))
@@ -12936,7 +12953,7 @@ function Cp(n) {
12936
12953
  if (!(n.selection instanceof z))
12937
12954
  return null;
12938
12955
  let e = document.createElement("div");
12939
- return e.className = "ProseMirror-gapcursor", V.create(n.doc, [ge.widget(n.selection.head, e, { key: "gapcursor" })]);
12956
+ return e.className = "ProseMirror-gapcursor", V.create(n.doc, [ye.widget(n.selection.head, e, { key: "gapcursor" })]);
12940
12957
  }
12941
12958
  const Mp = K.create({
12942
12959
  name: "gapCursor",
@@ -13154,7 +13171,7 @@ var Ep = /* @__PURE__ */ function(n) {
13154
13171
  }, e;
13155
13172
  }(W);
13156
13173
  const Op = 500;
13157
- class ke {
13174
+ class xe {
13158
13175
  constructor(e, t) {
13159
13176
  this.items = e, this.eventCount = t;
13160
13177
  }
@@ -13178,24 +13195,24 @@ class ke {
13178
13195
  return;
13179
13196
  }
13180
13197
  if (i) {
13181
- u.push(new Se(d.map));
13198
+ u.push(new Ce(d.map));
13182
13199
  let h = d.step.map(i.slice(s)), p;
13183
- h && o.maybeStep(h).doc && (p = o.mapping.maps[o.mapping.maps.length - 1], c.push(new Se(p, void 0, void 0, c.length + u.length))), s--, p && i.appendMap(p, s);
13200
+ h && o.maybeStep(h).doc && (p = o.mapping.maps[o.mapping.maps.length - 1], c.push(new Ce(p, void 0, void 0, c.length + u.length))), s--, p && i.appendMap(p, s);
13184
13201
  } else
13185
13202
  o.maybeStep(d.step);
13186
13203
  if (d.selection)
13187
- return l = i ? d.selection.map(i.slice(s)) : d.selection, a = new ke(this.items.slice(0, r).append(u.reverse().concat(c)), this.eventCount - 1), !1;
13204
+ return l = i ? d.selection.map(i.slice(s)) : d.selection, a = new xe(this.items.slice(0, r).append(u.reverse().concat(c)), this.eventCount - 1), !1;
13188
13205
  }, this.items.length, 0), { remaining: a, transform: o, selection: l };
13189
13206
  }
13190
13207
  // Create a new branch with the given transform added.
13191
13208
  addTransform(e, t, r, i) {
13192
13209
  let s = [], o = this.eventCount, l = this.items, a = !i && l.length ? l.get(l.length - 1) : null;
13193
13210
  for (let u = 0; u < e.steps.length; u++) {
13194
- let d = e.steps[u].invert(e.docs[u]), f = new Se(e.mapping.maps[u], d, t), h;
13211
+ let d = e.steps[u].invert(e.docs[u]), f = new Ce(e.mapping.maps[u], d, t), h;
13195
13212
  (h = a && a.merge(f)) && (f = h, u ? s.pop() : l = l.slice(0, l.length - 1)), s.push(f), t && (o++, t = void 0), i || (a = f);
13196
13213
  }
13197
13214
  let c = o - r.depth;
13198
- return c > vp && (l = Ap(l, c), o -= c), new ke(l.append(s), o);
13215
+ return c > vp && (l = Ap(l, c), o -= c), new xe(l.append(s), o);
13199
13216
  }
13200
13217
  remapping(e, t) {
13201
13218
  let r = new sn();
@@ -13205,7 +13222,7 @@ class ke {
13205
13222
  }, e, t), r;
13206
13223
  }
13207
13224
  addMaps(e) {
13208
- return this.eventCount == 0 ? this : new ke(this.items.append(e.map((t) => new Se(t))), this.eventCount);
13225
+ return this.eventCount == 0 ? this : new xe(this.items.append(e.map((t) => new Ce(t))), this.eventCount);
13209
13226
  }
13210
13227
  // When the collab module receives remote changes, the history has
13211
13228
  // to know about those, so that it can adjust the steps that were
@@ -13227,14 +13244,14 @@ class ke {
13227
13244
  let p = s.maps[h];
13228
13245
  if (f.step) {
13229
13246
  let m = e.steps[h].invert(e.docs[h]), g = f.selection && f.selection.map(s.slice(a + 1, h));
13230
- g && l++, r.push(new Se(p, m, g));
13247
+ g && l++, r.push(new Ce(p, m, g));
13231
13248
  } else
13232
- r.push(new Se(p));
13249
+ r.push(new Ce(p));
13233
13250
  }, i);
13234
13251
  let c = [];
13235
13252
  for (let f = t; f < o; f++)
13236
- c.push(new Se(s.maps[f]));
13237
- let u = this.items.slice(0, i).append(c).append(r), d = new ke(u, l);
13253
+ c.push(new Ce(s.maps[f]));
13254
+ let u = this.items.slice(0, i).append(c).append(r), d = new xe(u, l);
13238
13255
  return d.emptyItemCount() > Op && (d = d.compress(this.items.length - r.length)), d;
13239
13256
  }
13240
13257
  emptyItemCount() {
@@ -13259,14 +13276,14 @@ class ke {
13259
13276
  if (r--, c && t.appendMap(c, r), a) {
13260
13277
  let u = o.selection && o.selection.map(t.slice(r));
13261
13278
  u && s++;
13262
- let d = new Se(c.invert(), a, u), f, h = i.length - 1;
13279
+ let d = new Ce(c.invert(), a, u), f, h = i.length - 1;
13263
13280
  (f = i.length && i[h].merge(d)) ? i[h] = f : i.push(d);
13264
13281
  }
13265
13282
  } else o.map && r--;
13266
- }, this.items.length, 0), new ke(W.from(i.reverse()), s);
13283
+ }, this.items.length, 0), new xe(W.from(i.reverse()), s);
13267
13284
  }
13268
13285
  }
13269
- ke.empty = new ke(W.empty, 0);
13286
+ xe.empty = new xe(W.empty, 0);
13270
13287
  function Ap(n, e) {
13271
13288
  let t;
13272
13289
  return n.forEach((r, i) => {
@@ -13274,7 +13291,7 @@ function Ap(n, e) {
13274
13291
  return t = i, !1;
13275
13292
  }), n.slice(t);
13276
13293
  }
13277
- class Se {
13294
+ class Ce {
13278
13295
  constructor(e, t, r, i) {
13279
13296
  this.map = e, this.step = t, this.selection = r, this.mirrorOffset = i;
13280
13297
  }
@@ -13282,11 +13299,11 @@ class Se {
13282
13299
  if (this.step && e.step && !e.selection) {
13283
13300
  let t = e.step.merge(this.step);
13284
13301
  if (t)
13285
- return new Se(t.getMap().invert(), t, this.selection);
13302
+ return new Ce(t.getMap().invert(), t, this.selection);
13286
13303
  }
13287
13304
  }
13288
13305
  }
13289
- class $e {
13306
+ class _e {
13290
13307
  constructor(e, t, r, i, s) {
13291
13308
  this.done = e, this.undone = t, this.prevRanges = r, this.prevTime = i, this.prevComposition = s;
13292
13309
  }
@@ -13296,16 +13313,16 @@ function Np(n, e, t, r) {
13296
13313
  let i = t.getMeta(ht), s;
13297
13314
  if (i)
13298
13315
  return i.historyState;
13299
- t.getMeta(Rp) && (n = new $e(n.done, n.undone, null, 0, -1));
13316
+ t.getMeta(Rp) && (n = new _e(n.done, n.undone, null, 0, -1));
13300
13317
  let o = t.getMeta("appendedTransaction");
13301
13318
  if (t.steps.length == 0)
13302
13319
  return n;
13303
13320
  if (o && o.getMeta(ht))
13304
- return o.getMeta(ht).redo ? new $e(n.done.addTransform(t, void 0, r, Ln(e)), n.undone, Ro(t.mapping.maps), n.prevTime, n.prevComposition) : new $e(n.done, n.undone.addTransform(t, void 0, r, Ln(e)), null, n.prevTime, n.prevComposition);
13321
+ return o.getMeta(ht).redo ? new _e(n.done.addTransform(t, void 0, r, Ln(e)), n.undone, Ro(t.mapping.maps), n.prevTime, n.prevComposition) : new _e(n.done, n.undone.addTransform(t, void 0, r, Ln(e)), null, n.prevTime, n.prevComposition);
13305
13322
  if (t.getMeta("addToHistory") !== !1 && !(o && o.getMeta("addToHistory") === !1)) {
13306
13323
  let l = t.getMeta("composition"), a = n.prevTime == 0 || !o && n.prevComposition != l && (n.prevTime < (t.time || 0) - r.newGroupDelay || !Dp(t, n.prevRanges)), c = o ? ii(n.prevRanges, t.mapping) : Ro(t.mapping.maps);
13307
- return new $e(n.done.addTransform(t, a ? e.selection.getBookmark() : void 0, r, Ln(e)), ke.empty, c, t.time, l ?? n.prevComposition);
13308
- } else return (s = t.getMeta("rebased")) ? new $e(n.done.rebased(t, s), n.undone.rebased(t, s), ii(n.prevRanges, t.mapping), n.prevTime, n.prevComposition) : new $e(n.done.addMaps(t.mapping.maps), n.undone.addMaps(t.mapping.maps), ii(n.prevRanges, t.mapping), n.prevTime, n.prevComposition);
13324
+ return new _e(n.done.addTransform(t, a ? e.selection.getBookmark() : void 0, r, Ln(e)), xe.empty, c, t.time, l ?? n.prevComposition);
13325
+ } else return (s = t.getMeta("rebased")) ? new _e(n.done.rebased(t, s), n.undone.rebased(t, s), ii(n.prevRanges, t.mapping), n.prevTime, n.prevComposition) : new _e(n.done.addMaps(t.mapping.maps), n.undone.addMaps(t.mapping.maps), ii(n.prevRanges, t.mapping), n.prevTime, n.prevComposition);
13309
13326
  }
13310
13327
  function Dp(n, e) {
13311
13328
  if (!e)
@@ -13338,7 +13355,7 @@ function Ip(n, e, t) {
13338
13355
  let r = Ln(e), i = ht.get(e).spec.config, s = (t ? n.undone : n.done).popEvent(e, r);
13339
13356
  if (!s)
13340
13357
  return null;
13341
- let o = s.selection.resolve(s.transform.doc), l = (t ? n.done : n.undone).addTransform(s.transform, e.selection.getBookmark(), i, r), a = new $e(t ? l : s.remaining, t ? s.remaining : l, null, 0, -1);
13358
+ let o = s.selection.resolve(s.transform.doc), l = (t ? n.done : n.undone).addTransform(s.transform, e.selection.getBookmark(), i, r), a = new _e(t ? l : s.remaining, t ? s.remaining : l, null, 0, -1);
13342
13359
  return s.transform.setSelection(o).setMeta(ht, { redo: t, historyState: a });
13343
13360
  }
13344
13361
  let si = !1, Po = null;
@@ -13354,7 +13371,7 @@ function Ln(n) {
13354
13371
  }
13355
13372
  return si;
13356
13373
  }
13357
- const ht = new ue("history"), Rp = new ue("closeHistory");
13374
+ const ht = new de("history"), Rp = new de("closeHistory");
13358
13375
  function Pp(n = {}) {
13359
13376
  return n = {
13360
13377
  depth: n.depth || 100,
@@ -13363,7 +13380,7 @@ function Pp(n = {}) {
13363
13380
  key: ht,
13364
13381
  state: {
13365
13382
  init() {
13366
- return new $e(ke.empty, ke.empty, null, 0, -1);
13383
+ return new _e(xe.empty, xe.empty, null, 0, -1);
13367
13384
  },
13368
13385
  apply(e, t, r) {
13369
13386
  return Np(t, r, e, n);
@@ -13473,7 +13490,7 @@ const La = Pa(!1, !0), Ba = Pa(!0, !0), Lp = K.create({
13473
13490
  })
13474
13491
  ];
13475
13492
  }
13476
- }), zp = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/, Fp = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g, $p = /(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/, _p = /(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g, Hp = xe.create({
13493
+ }), zp = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/, Fp = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g, $p = /(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/, _p = /(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g, Hp = Se.create({
13477
13494
  name: "italic",
13478
13495
  addOptions() {
13479
13496
  return {
@@ -13660,7 +13677,7 @@ const La = Pa(!1, !0), Ba = Pa(!0, !0), Lp = K.create({
13660
13677
  "Mod-Alt-0": () => this.editor.commands.setParagraph()
13661
13678
  };
13662
13679
  }
13663
- }), Kp = /(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/, qp = /(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g, Jp = xe.create({
13680
+ }), Kp = /(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/, qp = /(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g, Jp = Se.create({
13664
13681
  name: "strike",
13665
13682
  addOptions() {
13666
13683
  return {
@@ -13725,7 +13742,7 @@ const La = Pa(!1, !0), Ba = Pa(!0, !0), Lp = K.create({
13725
13742
  const n = [];
13726
13743
  return this.options.bold !== !1 && n.push(rp.configure(this.options.bold)), this.options.blockquote !== !1 && n.push(Qh.configure(this.options.blockquote)), this.options.bulletList !== !1 && n.push(sp.configure(this.options.bulletList)), this.options.code !== !1 && n.push(ap.configure(this.options.code)), this.options.codeBlock !== !1 && n.push(dp.configure(this.options.codeBlock)), this.options.document !== !1 && n.push(fp.configure(this.options.document)), this.options.dropcursor !== !1 && n.push(mp.configure(this.options.dropcursor)), this.options.gapcursor !== !1 && n.push(Mp.configure(this.options.gapcursor)), this.options.hardBreak !== !1 && n.push(wp.configure(this.options.hardBreak)), this.options.heading !== !1 && n.push(Tp.configure(this.options.heading)), this.options.history !== !1 && n.push(Lp.configure(this.options.history)), this.options.horizontalRule !== !1 && n.push(Bp.configure(this.options.horizontalRule)), this.options.italic !== !1 && n.push(Hp.configure(this.options.italic)), this.options.listItem !== !1 && n.push(Vp.configure(this.options.listItem)), this.options.orderedList !== !1 && n.push(Wp.configure(this.options.orderedList)), this.options.paragraph !== !1 && n.push(Up.configure(this.options.paragraph)), this.options.strike !== !1 && n.push(Jp.configure(this.options.strike)), this.options.text !== !1 && n.push(Gp.configure(this.options.text)), n;
13727
13744
  }
13728
- }), Xp = xe.create({
13745
+ }), Xp = Se.create({
13729
13746
  name: "underline",
13730
13747
  addOptions() {
13731
13748
  return {
@@ -13769,7 +13786,7 @@ const La = Pa(!1, !0), Ba = Pa(!0, !0), Lp = K.create({
13769
13786
  const s = t.getAttribute("style"), o = (i = (r = t.parentElement) === null || r === void 0 ? void 0 : r.closest("span")) === null || i === void 0 ? void 0 : i.getAttribute("style");
13770
13787
  t.setAttribute("style", `${o};${s}`);
13771
13788
  });
13772
- }, Zp = xe.create({
13789
+ }, Zp = Se.create({
13773
13790
  name: "textStyle",
13774
13791
  priority: 101,
13775
13792
  addOptions() {
@@ -14028,7 +14045,7 @@ oe.prototype = {
14028
14045
  return i.j[n] = o, o;
14029
14046
  }
14030
14047
  };
14031
- const v = (n, e, t, r, i) => n.ta(e, t, r, i), B = (n, e, t, r, i) => n.tr(e, t, r, i), zo = (n, e, t, r, i) => n.ts(e, t, r, i), k = (n, e, t, r, i) => n.tt(e, t, r, i), De = "WORD", zi = "UWORD", Fa = "ASCIINUMERICAL", $a = "ALPHANUMERICAL", hn = "LOCALHOST", Fi = "TLD", $i = "UTLD", Bn = "SCHEME", Et = "SLASH_SCHEME", hs = "NUM", _i = "WS", ps = "NL", Xt = "OPENBRACE", Qt = "CLOSEBRACE", Xn = "OPENBRACKET", Qn = "CLOSEBRACKET", Zn = "OPENPAREN", er = "CLOSEPAREN", tr = "OPENANGLEBRACKET", nr = "CLOSEANGLEBRACKET", rr = "FULLWIDTHLEFTPAREN", ir = "FULLWIDTHRIGHTPAREN", sr = "LEFTCORNERBRACKET", or = "RIGHTCORNERBRACKET", lr = "LEFTWHITECORNERBRACKET", ar = "RIGHTWHITECORNERBRACKET", cr = "FULLWIDTHLESSTHAN", ur = "FULLWIDTHGREATERTHAN", dr = "AMPERSAND", fr = "APOSTROPHE", hr = "ASTERISK", _e = "AT", pr = "BACKSLASH", mr = "BACKTICK", gr = "CARET", at = "COLON", ms = "COMMA", yr = "DOLLAR", Ce = "DOT", br = "EQUALS", gs = "EXCLAMATION", he = "HYPHEN", Zt = "PERCENT", kr = "PIPE", xr = "PLUS", Sr = "POUND", en = "QUERY", ys = "QUOTE", _a = "FULLWIDTHMIDDLEDOT", bs = "SEMI", Me = "SLASH", tn = "TILDE", Cr = "UNDERSCORE", Ha = "EMOJI", Mr = "SYM";
14048
+ const v = (n, e, t, r, i) => n.ta(e, t, r, i), B = (n, e, t, r, i) => n.tr(e, t, r, i), zo = (n, e, t, r, i) => n.ts(e, t, r, i), k = (n, e, t, r, i) => n.tt(e, t, r, i), Ie = "WORD", zi = "UWORD", Fa = "ASCIINUMERICAL", $a = "ALPHANUMERICAL", hn = "LOCALHOST", Fi = "TLD", $i = "UTLD", Bn = "SCHEME", Et = "SLASH_SCHEME", hs = "NUM", _i = "WS", ps = "NL", Xt = "OPENBRACE", Qt = "CLOSEBRACE", Xn = "OPENBRACKET", Qn = "CLOSEBRACKET", Zn = "OPENPAREN", er = "CLOSEPAREN", tr = "OPENANGLEBRACKET", nr = "CLOSEANGLEBRACKET", rr = "FULLWIDTHLEFTPAREN", ir = "FULLWIDTHRIGHTPAREN", sr = "LEFTCORNERBRACKET", or = "RIGHTCORNERBRACKET", lr = "LEFTWHITECORNERBRACKET", ar = "RIGHTWHITECORNERBRACKET", cr = "FULLWIDTHLESSTHAN", ur = "FULLWIDTHGREATERTHAN", dr = "AMPERSAND", fr = "APOSTROPHE", hr = "ASTERISK", He = "AT", pr = "BACKSLASH", mr = "BACKTICK", gr = "CARET", at = "COLON", ms = "COMMA", yr = "DOLLAR", Me = "DOT", br = "EQUALS", gs = "EXCLAMATION", pe = "HYPHEN", Zt = "PERCENT", kr = "PIPE", xr = "PLUS", Sr = "POUND", en = "QUERY", ys = "QUOTE", _a = "FULLWIDTHMIDDLEDOT", bs = "SEMI", we = "SLASH", tn = "TILDE", Cr = "UNDERSCORE", Ha = "EMOJI", Mr = "SYM";
14032
14049
  var Va = /* @__PURE__ */ Object.freeze({
14033
14050
  __proto__: null,
14034
14051
  ALPHANUMERICAL: $a,
@@ -14036,7 +14053,7 @@ var Va = /* @__PURE__ */ Object.freeze({
14036
14053
  APOSTROPHE: fr,
14037
14054
  ASCIINUMERICAL: Fa,
14038
14055
  ASTERISK: hr,
14039
- AT: _e,
14056
+ AT: He,
14040
14057
  BACKSLASH: pr,
14041
14058
  BACKTICK: mr,
14042
14059
  CARET: gr,
@@ -14047,7 +14064,7 @@ var Va = /* @__PURE__ */ Object.freeze({
14047
14064
  COLON: at,
14048
14065
  COMMA: ms,
14049
14066
  DOLLAR: yr,
14050
- DOT: Ce,
14067
+ DOT: Me,
14051
14068
  EMOJI: Ha,
14052
14069
  EQUALS: br,
14053
14070
  EXCLAMATION: gs,
@@ -14056,7 +14073,7 @@ var Va = /* @__PURE__ */ Object.freeze({
14056
14073
  FULLWIDTHLESSTHAN: cr,
14057
14074
  FULLWIDTHMIDDLEDOT: _a,
14058
14075
  FULLWIDTHRIGHTPAREN: ir,
14059
- HYPHEN: he,
14076
+ HYPHEN: pe,
14060
14077
  LEFTCORNERBRACKET: sr,
14061
14078
  LEFTWHITECORNERBRACKET: lr,
14062
14079
  LOCALHOST: hn,
@@ -14076,7 +14093,7 @@ var Va = /* @__PURE__ */ Object.freeze({
14076
14093
  RIGHTWHITECORNERBRACKET: ar,
14077
14094
  SCHEME: Bn,
14078
14095
  SEMI: bs,
14079
- SLASH: Me,
14096
+ SLASH: we,
14080
14097
  SLASH_SCHEME: Et,
14081
14098
  SYM: Mr,
14082
14099
  TILDE: tn,
@@ -14084,33 +14101,33 @@ var Va = /* @__PURE__ */ Object.freeze({
14084
14101
  UNDERSCORE: Cr,
14085
14102
  UTLD: $i,
14086
14103
  UWORD: zi,
14087
- WORD: De,
14104
+ WORD: Ie,
14088
14105
  WS: _i
14089
14106
  });
14090
- const ve = /[a-z]/, $t = new RegExp("\\p{L}", "u"), li = new RegExp("\\p{Emoji}", "u"), Ne = /\d/, ai = /\s/, Fo = "\r", ci = `
14107
+ const Ne = /[a-z]/, $t = new RegExp("\\p{L}", "u"), li = new RegExp("\\p{Emoji}", "u"), De = /\d/, ai = /\s/, Fo = "\r", ci = `
14091
14108
  `, cm = "️", um = "‍", ui = "";
14092
14109
  let vn = null, Nn = null;
14093
14110
  function dm(n = []) {
14094
14111
  const e = {};
14095
14112
  oe.groups = e;
14096
14113
  const t = new oe();
14097
- vn == null && (vn = $o(rm)), Nn == null && (Nn = $o(im)), k(t, "'", fr), k(t, "{", Xt), k(t, "}", Qt), k(t, "[", Xn), k(t, "]", Qn), k(t, "(", Zn), k(t, ")", er), k(t, "<", tr), k(t, ">", nr), k(t, "(", rr), k(t, ")", ir), k(t, "「", sr), k(t, "」", or), k(t, "『", lr), k(t, "』", ar), k(t, "<", cr), k(t, ">", ur), k(t, "&", dr), k(t, "*", hr), k(t, "@", _e), k(t, "`", mr), k(t, "^", gr), k(t, ":", at), k(t, ",", ms), k(t, "$", yr), k(t, ".", Ce), k(t, "=", br), k(t, "!", gs), k(t, "-", he), k(t, "%", Zt), k(t, "|", kr), k(t, "+", xr), k(t, "#", Sr), k(t, "?", en), k(t, '"', ys), k(t, "/", Me), k(t, ";", bs), k(t, "~", tn), k(t, "_", Cr), k(t, "\\", pr), k(t, "・", _a);
14098
- const r = B(t, Ne, hs, {
14114
+ vn == null && (vn = $o(rm)), Nn == null && (Nn = $o(im)), k(t, "'", fr), k(t, "{", Xt), k(t, "}", Qt), k(t, "[", Xn), k(t, "]", Qn), k(t, "(", Zn), k(t, ")", er), k(t, "<", tr), k(t, ">", nr), k(t, "(", rr), k(t, ")", ir), k(t, "「", sr), k(t, "」", or), k(t, "『", lr), k(t, "』", ar), k(t, "<", cr), k(t, ">", ur), k(t, "&", dr), k(t, "*", hr), k(t, "@", He), k(t, "`", mr), k(t, "^", gr), k(t, ":", at), k(t, ",", ms), k(t, "$", yr), k(t, ".", Me), k(t, "=", br), k(t, "!", gs), k(t, "-", pe), k(t, "%", Zt), k(t, "|", kr), k(t, "+", xr), k(t, "#", Sr), k(t, "?", en), k(t, '"', ys), k(t, "/", we), k(t, ";", bs), k(t, "~", tn), k(t, "_", Cr), k(t, "\\", pr), k(t, "・", _a);
14115
+ const r = B(t, De, hs, {
14099
14116
  [Ri]: !0
14100
14117
  });
14101
- B(r, Ne, r);
14102
- const i = B(r, ve, Fa, {
14118
+ B(r, De, r);
14119
+ const i = B(r, Ne, Fa, {
14103
14120
  [Yt]: !0
14104
14121
  }), s = B(r, $t, $a, {
14105
14122
  [jt]: !0
14106
- }), o = B(t, ve, De, {
14123
+ }), o = B(t, Ne, Ie, {
14107
14124
  [Pi]: !0
14108
14125
  });
14109
- B(o, Ne, i), B(o, ve, o), B(i, Ne, i), B(i, ve, i);
14126
+ B(o, De, i), B(o, Ne, o), B(i, De, i), B(i, Ne, i);
14110
14127
  const l = B(t, $t, zi, {
14111
14128
  [Li]: !0
14112
14129
  });
14113
- B(l, ve), B(l, Ne, s), B(l, $t, l), B(s, Ne, s), B(s, ve), B(s, $t, s);
14130
+ B(l, Ne), B(l, De, s), B(l, $t, l), B(s, De, s), B(s, Ne), B(s, $t, s);
14114
14131
  const a = k(t, ci, ps, {
14115
14132
  [oi]: !0
14116
14133
  }), c = k(t, Fo, _i, {
@@ -14125,18 +14142,18 @@ function dm(n = []) {
14125
14142
  k(d, "#"), B(d, li, d), k(d, cm, d);
14126
14143
  const f = k(d, um);
14127
14144
  k(f, "#"), B(f, li, d);
14128
- const h = [[ve, o], [Ne, i]], p = [[ve, null], [$t, l], [Ne, s]];
14145
+ const h = [[Ne, o], [De, i]], p = [[Ne, null], [$t, l], [De, s]];
14129
14146
  for (let m = 0; m < vn.length; m++)
14130
- Be(t, vn[m], Fi, De, h);
14147
+ ze(t, vn[m], Fi, Ie, h);
14131
14148
  for (let m = 0; m < Nn.length; m++)
14132
- Be(t, Nn[m], $i, zi, p);
14149
+ ze(t, Nn[m], $i, zi, p);
14133
14150
  lt(Fi, {
14134
14151
  tld: !0,
14135
14152
  ascii: !0
14136
14153
  }, e), lt($i, {
14137
14154
  utld: !0,
14138
14155
  alpha: !0
14139
- }, e), Be(t, "file", Bn, De, h), Be(t, "mailto", Bn, De, h), Be(t, "http", Et, De, h), Be(t, "https", Et, De, h), Be(t, "ftp", Et, De, h), Be(t, "ftps", Et, De, h), lt(Bn, {
14156
+ }, e), ze(t, "file", Bn, Ie, h), ze(t, "mailto", Bn, Ie, h), ze(t, "http", Et, Ie, h), ze(t, "https", Et, Ie, h), ze(t, "ftp", Et, Ie, h), ze(t, "ftps", Et, Ie, h), lt(Bn, {
14140
14157
  scheme: !0,
14141
14158
  ascii: !0
14142
14159
  }, e), lt(Et, {
@@ -14149,7 +14166,7 @@ function dm(n = []) {
14149
14166
  } : {
14150
14167
  [om]: !0
14151
14168
  };
14152
- g.indexOf("-") >= 0 ? M[Bi] = !0 : ve.test(g) ? Ne.test(g) ? M[Yt] = !0 : M[Pi] = !0 : M[Ri] = !0, zo(t, g, g, M);
14169
+ g.indexOf("-") >= 0 ? M[Bi] = !0 : Ne.test(g) ? De.test(g) ? M[Yt] = !0 : M[Pi] = !0 : M[Ri] = !0, zo(t, g, g, M);
14153
14170
  }
14154
14171
  return zo(t, "localhost", hn, {
14155
14172
  ascii: !0
@@ -14189,7 +14206,7 @@ function fm(n) {
14189
14206
  }
14190
14207
  return e;
14191
14208
  }
14192
- function Be(n, e, t, r, i) {
14209
+ function ze(n, e, t, r, i) {
14193
14210
  let s;
14194
14211
  const o = e.length;
14195
14212
  for (let l = 0; l < o - 1; l++) {
@@ -14446,36 +14463,36 @@ const hm = zr("email", {
14446
14463
  const n = this.tk;
14447
14464
  return n.length >= 2 && n[0].t !== hn && n[1].t === at;
14448
14465
  }
14449
- }), fe = (n) => new oe(n);
14466
+ }), he = (n) => new oe(n);
14450
14467
  function mm({
14451
14468
  groups: n
14452
14469
  }) {
14453
- const e = n.domain.concat([dr, hr, _e, pr, mr, gr, yr, br, he, hs, Zt, kr, xr, Sr, Me, Mr, tn, Cr]), t = [fr, at, ms, Ce, gs, Zt, en, ys, bs, tr, nr, Xt, Qt, Qn, Xn, Zn, er, rr, ir, sr, or, lr, ar, cr, ur], r = [dr, fr, hr, pr, mr, gr, yr, br, he, Xt, Qt, Zt, kr, xr, Sr, en, Me, Mr, tn, Cr], i = fe(), s = k(i, tn);
14470
+ const e = n.domain.concat([dr, hr, He, pr, mr, gr, yr, br, pe, hs, Zt, kr, xr, Sr, we, Mr, tn, Cr]), t = [fr, at, ms, Me, gs, Zt, en, ys, bs, tr, nr, Xt, Qt, Qn, Xn, Zn, er, rr, ir, sr, or, lr, ar, cr, ur], r = [dr, fr, hr, pr, mr, gr, yr, br, pe, Xt, Qt, Zt, kr, xr, Sr, en, we, Mr, tn, Cr], i = he(), s = k(i, tn);
14454
14471
  v(s, r, s), v(s, n.domain, s);
14455
- const o = fe(), l = fe(), a = fe();
14472
+ const o = he(), l = he(), a = he();
14456
14473
  v(i, n.domain, o), v(i, n.scheme, l), v(i, n.slashscheme, a), v(o, r, s), v(o, n.domain, o);
14457
- const c = k(o, _e);
14458
- k(s, _e, c), k(l, _e, c), k(a, _e, c);
14459
- const u = k(s, Ce);
14474
+ const c = k(o, He);
14475
+ k(s, He, c), k(l, He, c), k(a, He, c);
14476
+ const u = k(s, Me);
14460
14477
  v(u, r, s), v(u, n.domain, s);
14461
- const d = fe();
14478
+ const d = he();
14462
14479
  v(c, n.domain, d), v(d, n.domain, d);
14463
- const f = k(d, Ce);
14480
+ const f = k(d, Me);
14464
14481
  v(f, n.domain, d);
14465
- const h = fe(hm);
14482
+ const h = he(hm);
14466
14483
  v(f, n.tld, h), v(f, n.utld, h), k(c, hn, h);
14467
- const p = k(d, he);
14468
- k(p, he, p), v(p, n.domain, d), v(h, n.domain, d), k(h, Ce, f), k(h, he, p);
14469
- const m = k(o, he), g = k(o, Ce);
14470
- k(m, he, m), v(m, n.domain, o), v(g, r, s), v(g, n.domain, o);
14471
- const y = fe(Dn);
14472
- v(g, n.tld, y), v(g, n.utld, y), v(y, n.domain, o), v(y, r, s), k(y, Ce, g), k(y, he, m), k(y, _e, c);
14473
- const M = k(y, at), w = fe(Dn);
14484
+ const p = k(d, pe);
14485
+ k(p, pe, p), v(p, n.domain, d), v(h, n.domain, d), k(h, Me, f), k(h, pe, p);
14486
+ const m = k(o, pe), g = k(o, Me);
14487
+ k(m, pe, m), v(m, n.domain, o), v(g, r, s), v(g, n.domain, o);
14488
+ const y = he(Dn);
14489
+ v(g, n.tld, y), v(g, n.utld, y), v(y, n.domain, o), v(y, r, s), k(y, Me, g), k(y, pe, m), k(y, He, c);
14490
+ const M = k(y, at), w = he(Dn);
14474
14491
  v(M, n.numeric, w);
14475
- const O = fe(Dn), D = fe();
14476
- v(O, e, O), v(O, t, D), v(D, e, O), v(D, t, D), k(y, Me, O), k(w, Me, O);
14477
- const L = k(l, at), T = k(a, at), I = k(T, Me), F = k(I, Me);
14478
- v(l, n.domain, o), k(l, Ce, g), k(l, he, m), v(a, n.domain, o), k(a, Ce, g), k(a, he, m), v(L, n.domain, O), k(L, Me, O), k(L, en, O), v(F, n.domain, O), v(F, e, O), k(F, Me, O);
14492
+ const O = he(Dn), D = he();
14493
+ v(O, e, O), v(O, t, D), v(D, e, O), v(D, t, D), k(y, we, O), k(w, we, O);
14494
+ const L = k(l, at), T = k(a, at), I = k(T, we), F = k(I, we);
14495
+ v(l, n.domain, o), k(l, Me, g), k(l, pe, m), v(a, n.domain, o), k(a, Me, g), k(a, pe, m), v(L, n.domain, O), k(L, we, O), k(L, en, O), v(F, n.domain, O), v(F, e, O), k(F, we, O);
14479
14496
  const bn = [
14480
14497
  [Xt, Qt],
14481
14498
  // {}
@@ -14497,9 +14514,9 @@ function mm({
14497
14514
  for (let Fr = 0; Fr < bn.length; Fr++) {
14498
14515
  const [Cs, $r] = bn[Fr], kn = k(O, Cs);
14499
14516
  k(D, Cs, kn);
14500
- const xt = fe(Dn);
14517
+ const xt = he(Dn);
14501
14518
  v(kn, e, xt);
14502
- const St = fe();
14519
+ const St = he();
14503
14520
  v(kn, t, St), k(kn, $r, O), v(xt, e, xt), v(xt, t, St), v(St, e, xt), v(St, t, St), k(xt, $r, O), k(St, $r, O);
14504
14521
  }
14505
14522
  return k(i, hn, y), k(i, ps, pm), {
@@ -14586,7 +14603,7 @@ function wm(n) {
14586
14603
  }
14587
14604
  function Tm(n) {
14588
14605
  return new Q({
14589
- key: new ue("autolink"),
14606
+ key: new de("autolink"),
14590
14607
  appendTransaction: (e, t, r) => {
14591
14608
  const i = e.some((c) => c.docChanged) && !t.doc.eq(r.doc), s = e.some((c) => c.getMeta("preventAutolink"));
14592
14609
  if (!i || s)
@@ -14630,7 +14647,7 @@ function Tm(n) {
14630
14647
  }
14631
14648
  function Em(n) {
14632
14649
  return new Q({
14633
- key: new ue("handleClickLink"),
14650
+ key: new de("handleClickLink"),
14634
14651
  props: {
14635
14652
  handleClick: (e, t, r) => {
14636
14653
  var i, s;
@@ -14650,7 +14667,7 @@ function Em(n) {
14650
14667
  }
14651
14668
  function Om(n) {
14652
14669
  return new Q({
14653
- key: new ue("handlePasteLink"),
14670
+ key: new de("handlePasteLink"),
14654
14671
  props: {
14655
14672
  handlePaste: (e, t, r) => {
14656
14673
  const { state: i } = e, { selection: s } = i, { empty: o } = s;
@@ -14690,7 +14707,7 @@ function tt(n, e) {
14690
14707
  "i"
14691
14708
  ));
14692
14709
  }
14693
- const Am = xe.create({
14710
+ const Am = Se.create({
14694
14711
  name: "link",
14695
14712
  priority: 1e3,
14696
14713
  keepOnSplit: !1,
@@ -15021,12 +15038,12 @@ function Ka(n) {
15021
15038
  }
15022
15039
  }
15023
15040
  });
15024
- return e.on("focus", ({ editor: t }) => Ve.setActive(t)), e.on("blur", ({ editor: t }) => {
15041
+ return e.on("focus", ({ editor: t }) => le.setActive(t)), e.on("blur", ({ editor: t }) => {
15025
15042
  var r;
15026
- Ve.clearIfActive(t), (r = n.onBlur) == null || r.call(n, jo(t.getHTML()));
15027
- }), e.on("destroy", () => Ve.clearIfActive(e)), n.onUpdate && e.on("update", ({ editor: t }) => n.onUpdate(jo(t.getHTML()))), Ve.setActive(e), e;
15043
+ le.isHeld() || (le.clearIfActive(t), (r = n.onBlur) == null || r.call(n, jo(t.getHTML())));
15044
+ }), e.on("destroy", () => le.clearIfActive(e)), n.onUpdate && e.on("update", ({ editor: t }) => n.onUpdate(jo(t.getHTML()))), le.setActive(e), e;
15028
15045
  }
15029
- var Jm = Object.defineProperty, Gm = Object.getOwnPropertyDescriptor, de = (n, e, t, r) => {
15046
+ var Jm = Object.defineProperty, Gm = Object.getOwnPropertyDescriptor, fe = (n, e, t, r) => {
15030
15047
  for (var i = r > 1 ? void 0 : r ? Gm(e, t) : e, s = n.length - 1, o; s >= 0; s--)
15031
15048
  (o = n[s]) && (i = (r ? o(e, t, i) : o(i)) || i);
15032
15049
  return r && i && Jm(e, t, i), i;
@@ -15034,13 +15051,13 @@ var Jm = Object.defineProperty, Gm = Object.getOwnPropertyDescriptor, de = (n, e
15034
15051
  let se = class extends Uo {
15035
15052
  constructor() {
15036
15053
  super(...arguments), this.editor = null, this._visible = !1, this._top = 0, this._left = 0, this._activeBold = !1, this._activeItalic = !1, this._activeUnderline = !1, this._activeStrike = !1, this._activeCode = !1, this._activeLink = !1, this._linkPopoverOpen = !1, this._linkValue = "", this._onSelectionUpdate = () => this._sync(), this._onBlur = () => {
15037
- this._visible = !1, this._linkPopoverOpen = !1;
15038
- }, this._unsubscribe = null;
15054
+ le.isHeld() || (this._visible = !1, this._linkPopoverOpen = !1);
15055
+ }, this._unsubscribe = null, this._preventBlur = (n) => n.preventDefault();
15039
15056
  }
15040
15057
  connectedCallback() {
15041
- super.connectedCallback(), this._unsubscribe = Ve.subscribe((n) => {
15058
+ super.connectedCallback(), this._unsubscribe = le.subscribe((n) => {
15042
15059
  this._bindEditor(n);
15043
- }), this._bindEditor(Ve.getActive());
15060
+ }), this._bindEditor(le.getActive());
15044
15061
  }
15045
15062
  disconnectedCallback() {
15046
15063
  var n;
@@ -15055,7 +15072,7 @@ let se = class extends Uo {
15055
15072
  render() {
15056
15073
  const n = `top: ${this._top}px; left: ${this._left}px;`;
15057
15074
  return vt`
15058
- <div class="bar" style=${n}>
15075
+ <div class="bar" style=${n} @mousedown=${this._preventBlur}>
15059
15076
  <button title="Bold (Cmd+B)" ?data-active=${this._activeBold} @click=${() => this._toggle("toggleBold")}>B</button>
15060
15077
  <button title="Italic (Cmd+I)" ?data-active=${this._activeItalic} @click=${() => this._toggle("toggleItalic")}><em>I</em></button>
15061
15078
  <button title="Underline (Cmd+U)" ?data-active=${this._activeUnderline} @click=${() => this._toggle("toggleUnderline")}><u>U</u></button>
@@ -15069,11 +15086,17 @@ let se = class extends Uo {
15069
15086
  }
15070
15087
  _renderLinkPopover() {
15071
15088
  return vt`
15072
- <div class="link-popover" @click=${(n) => n.stopPropagation()}>
15089
+ <div
15090
+ class="link-popover"
15091
+ @click=${(n) => n.stopPropagation()}
15092
+ @mousedown=${(n) => n.stopPropagation()}
15093
+ >
15073
15094
  <input
15074
15095
  type="url"
15075
15096
  placeholder="https://…"
15076
15097
  .value=${this._linkValue}
15098
+ @mousedown=${() => le.holdFocus()}
15099
+ @blur=${() => le.releaseFocus()}
15077
15100
  @input=${(n) => this._linkValue = n.target.value}
15078
15101
  @keydown=${(n) => n.key === "Enter" && this._applyLink()}
15079
15102
  />
@@ -15139,6 +15162,11 @@ se.styles = Wo`
15139
15162
  }
15140
15163
 
15141
15164
  .bar {
15165
+ /* Fixed so the inline top/left (viewport coords from coordsAtPos) take
15166
+ effect; the translate below anchors the bar's bottom-centre to the
15167
+ selection. Without an explicit position the coords are ignored and the
15168
+ bar collapses to the host's top-left corner. */
15169
+ position: fixed;
15142
15170
  pointer-events: auto;
15143
15171
  display: inline-flex;
15144
15172
  align-items: center;
@@ -15221,43 +15249,43 @@ se.styles = Wo`
15221
15249
  color: var(--pigeon-primary-foreground, #ffffff);
15222
15250
  }
15223
15251
  `;
15224
- de([
15252
+ fe([
15225
15253
  qa({ attribute: !1 })
15226
15254
  ], se.prototype, "editor", 2);
15227
- de([
15255
+ fe([
15228
15256
  q()
15229
15257
  ], se.prototype, "_visible", 2);
15230
- de([
15258
+ fe([
15231
15259
  q()
15232
15260
  ], se.prototype, "_top", 2);
15233
- de([
15261
+ fe([
15234
15262
  q()
15235
15263
  ], se.prototype, "_left", 2);
15236
- de([
15264
+ fe([
15237
15265
  q()
15238
15266
  ], se.prototype, "_activeBold", 2);
15239
- de([
15267
+ fe([
15240
15268
  q()
15241
15269
  ], se.prototype, "_activeItalic", 2);
15242
- de([
15270
+ fe([
15243
15271
  q()
15244
15272
  ], se.prototype, "_activeUnderline", 2);
15245
- de([
15273
+ fe([
15246
15274
  q()
15247
15275
  ], se.prototype, "_activeStrike", 2);
15248
- de([
15276
+ fe([
15249
15277
  q()
15250
15278
  ], se.prototype, "_activeCode", 2);
15251
- de([
15279
+ fe([
15252
15280
  q()
15253
15281
  ], se.prototype, "_activeLink", 2);
15254
- de([
15282
+ fe([
15255
15283
  q()
15256
15284
  ], se.prototype, "_linkPopoverOpen", 2);
15257
- de([
15285
+ fe([
15258
15286
  q()
15259
15287
  ], se.prototype, "_linkValue", 2);
15260
- se = de([
15288
+ se = fe([
15261
15289
  Ko("pigeon-rich-text-bubble")
15262
15290
  ], se);
15263
15291
  var Ym = Object.defineProperty, Xm = Object.getOwnPropertyDescriptor, et = (n, e, t, r) => {
@@ -15275,9 +15303,11 @@ const Qm = [
15275
15303
  '"Times New Roman", serif',
15276
15304
  '"Courier New", monospace'
15277
15305
  ], Zm = ["", "10px", "12px", "14px", "16px", "18px", "24px", "32px", "48px"];
15278
- let Oe = class extends Uo {
15306
+ let Ae = class extends Uo {
15279
15307
  constructor() {
15280
- super(...arguments), this._editor = null, this._color = "#000000", this._fontFamily = "", this._fontSize = "", this._heading = "", this._activeBullet = !1, this._activeNumber = !1, this._unsubscribe = null, this._onSelectionUpdate = () => this._syncFromEditor(), this._onHeadingChange = (n) => {
15308
+ super(...arguments), this._editor = null, this._color = "#000000", this._fontFamily = "", this._fontSize = "", this._heading = "", this._activeBullet = !1, this._activeNumber = !1, this._unsubscribe = null, this._onSelectionUpdate = () => this._syncFromEditor(), this._holdFocus = () => {
15309
+ le.holdFocus(), setTimeout(() => le.releaseFocus(), 0);
15310
+ }, this._onHeadingChange = (n) => {
15281
15311
  const e = this._editor;
15282
15312
  if (!e) return;
15283
15313
  const t = n.target.value;
@@ -15311,7 +15341,7 @@ let Oe = class extends Uo {
15311
15341
  };
15312
15342
  }
15313
15343
  connectedCallback() {
15314
- super.connectedCallback(), this._unsubscribe = Ve.subscribe((n) => this._bind(n)), this._bind(Ve.getActive());
15344
+ super.connectedCallback(), this._unsubscribe = le.subscribe((n) => this._bind(n)), this._bind(le.getActive());
15315
15345
  }
15316
15346
  disconnectedCallback() {
15317
15347
  var n;
@@ -15320,7 +15350,7 @@ let Oe = class extends Uo {
15320
15350
  render() {
15321
15351
  const n = this._editor !== null;
15322
15352
  return vt`
15323
- <div class="section" ?hidden=${!n}>
15353
+ <div class="section" ?hidden=${!n} @pointerdown=${this._holdFocus}>
15324
15354
  <h4>Format</h4>
15325
15355
 
15326
15356
  <div class="field">
@@ -15383,7 +15413,7 @@ let Oe = class extends Uo {
15383
15413
  this._color = t.color || "#000000", this._fontFamily = t.fontFamily || "", this._fontSize = t.fontSize || "";
15384
15414
  }
15385
15415
  };
15386
- Oe.styles = Wo`
15416
+ Ae.styles = Wo`
15387
15417
  :host {
15388
15418
  display: block;
15389
15419
  }
@@ -15472,28 +15502,28 @@ Oe.styles = Wo`
15472
15502
  `;
15473
15503
  et([
15474
15504
  q()
15475
- ], Oe.prototype, "_editor", 2);
15505
+ ], Ae.prototype, "_editor", 2);
15476
15506
  et([
15477
15507
  q()
15478
- ], Oe.prototype, "_color", 2);
15508
+ ], Ae.prototype, "_color", 2);
15479
15509
  et([
15480
15510
  q()
15481
- ], Oe.prototype, "_fontFamily", 2);
15511
+ ], Ae.prototype, "_fontFamily", 2);
15482
15512
  et([
15483
15513
  q()
15484
- ], Oe.prototype, "_fontSize", 2);
15514
+ ], Ae.prototype, "_fontSize", 2);
15485
15515
  et([
15486
15516
  q()
15487
- ], Oe.prototype, "_heading", 2);
15517
+ ], Ae.prototype, "_heading", 2);
15488
15518
  et([
15489
15519
  q()
15490
- ], Oe.prototype, "_activeBullet", 2);
15520
+ ], Ae.prototype, "_activeBullet", 2);
15491
15521
  et([
15492
15522
  q()
15493
- ], Oe.prototype, "_activeNumber", 2);
15494
- Oe = et([
15523
+ ], Ae.prototype, "_activeNumber", 2);
15524
+ Ae = et([
15495
15525
  Ko("pigeon-rich-text-format")
15496
- ], Oe);
15526
+ ], Ae);
15497
15527
  const eg = { createEditor: Ka }, tg = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
15498
15528
  __proto__: null,
15499
15529
  createEditor: Ka,
@@ -15501,5 +15531,5 @@ const eg = { createEditor: Ka }, tg = /* @__PURE__ */ Object.freeze(/* @__PURE__
15501
15531
  }, Symbol.toStringTag, { value: "Module" }));
15502
15532
  export {
15503
15533
  ig as l,
15504
- Ve as r
15534
+ le as r
15505
15535
  };