@jinntec/jinntap 1.9.0 → 1.9.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -236,6 +236,10 @@ tei-ref {
236
236
  cursor: pointer;
237
237
  }
238
238
 
239
+ .ProseMirror-selectednode {
240
+ outline: 2px solid var(--pico-primary);
241
+ }
242
+
239
243
  .debug tei-div, .debug tei-p, .debug tei-item {
240
244
  margin-right: 2px;
241
245
  padding-right: 2px;
@@ -650,18 +650,18 @@ function Wi(r, e, t, n) {
650
650
  } else if (t.content.size)
651
651
  if (!t.openStart && !t.openEnd && r.depth == n && e.depth == n) {
652
652
  let o = r.parent, l = o.content;
653
- return Le(o, l.cut(0, r.parentOffset).append(t.content).append(l.cut(e.parentOffset)));
653
+ return Fe(o, l.cut(0, r.parentOffset).append(t.content).append(l.cut(e.parentOffset)));
654
654
  } else {
655
655
  let { start: o, end: l } = Do(t, r);
656
- return Le(s, qi(r, o, l, e, n));
656
+ return Fe(s, qi(r, o, l, e, n));
657
657
  }
658
- else return Le(s, qt(r, e, n));
658
+ else return Fe(s, qt(r, e, n));
659
659
  }
660
660
  function Ji(r, e) {
661
661
  if (!e.type.compatibleContent(r.type))
662
662
  throw new Jt("Cannot join " + e.type.name + " onto " + r.type.name);
663
663
  }
664
- function Ln(r, e, t) {
664
+ function Fn(r, e, t) {
665
665
  let n = r.node(t);
666
666
  return Ji(n, e.node(t)), n;
667
667
  }
@@ -676,18 +676,18 @@ function dt(r, e, t, n) {
676
676
  ze(i.child(l), n);
677
677
  e && e.depth == t && e.textOffset && ze(e.nodeBefore, n);
678
678
  }
679
- function Le(r, e) {
679
+ function Fe(r, e) {
680
680
  return r.type.checkContent(e), r.copy(e);
681
681
  }
682
682
  function qi(r, e, t, n, i) {
683
- let s = r.depth > i && Ln(r, e, i + 1), o = n.depth > i && Ln(t, n, i + 1), l = [];
684
- return dt(null, r, i, l), s && o && e.index(i) == t.index(i) ? (Ji(s, o), ze(Le(s, qi(r, e, t, n, i + 1)), l)) : (s && ze(Le(s, qt(r, e, i + 1)), l), dt(e, t, i, l), o && ze(Le(o, qt(t, n, i + 1)), l)), dt(n, null, i, l), new b(l);
683
+ let s = r.depth > i && Fn(r, e, i + 1), o = n.depth > i && Fn(t, n, i + 1), l = [];
684
+ return dt(null, r, i, l), s && o && e.index(i) == t.index(i) ? (Ji(s, o), ze(Fe(s, qi(r, e, t, n, i + 1)), l)) : (s && ze(Fe(s, qt(r, e, i + 1)), l), dt(e, t, i, l), o && ze(Fe(o, qt(t, n, i + 1)), l)), dt(n, null, i, l), new b(l);
685
685
  }
686
686
  function qt(r, e, t) {
687
687
  let n = [];
688
688
  if (dt(null, r, t, n), r.depth > t) {
689
- let i = Ln(r, e, t + 1);
690
- ze(Le(i, qt(r, e, t + 1)), n);
689
+ let i = Fn(r, e, t + 1);
690
+ ze(Fe(i, qt(r, e, t + 1)), n);
691
691
  }
692
692
  return dt(e, null, t, n), new b(n);
693
693
  }
@@ -994,7 +994,7 @@ class Kt {
994
994
  }
995
995
  }
996
996
  const Ro = /* @__PURE__ */ Object.create(null);
997
- let ue = class Fn {
997
+ let ue = class Ln {
998
998
  /**
999
999
  @internal
1000
1000
  */
@@ -1119,14 +1119,14 @@ let ue = class Fn {
1119
1119
  the given content (or empty, if no content is given).
1120
1120
  */
1121
1121
  copy(e = null) {
1122
- return e == this.content ? this : new Fn(this.type, this.attrs, e, this.marks);
1122
+ return e == this.content ? this : new Ln(this.type, this.attrs, e, this.marks);
1123
1123
  }
1124
1124
  /**
1125
1125
  Create a copy of this node, with the given set of marks instead
1126
1126
  of the node's own marks.
1127
1127
  */
1128
1128
  mark(e) {
1129
- return e == this.marks ? this : new Fn(this.type, this.attrs, this.content, e);
1129
+ return e == this.marks ? this : new Ln(this.type, this.attrs, this.content, e);
1130
1130
  }
1131
1131
  /**
1132
1132
  Create a copy of this node with only the content between the
@@ -1594,11 +1594,11 @@ function Ui(r) {
1594
1594
  function zo(r) {
1595
1595
  let e = [];
1596
1596
  do
1597
- e.push(Lo(r));
1597
+ e.push(Fo(r));
1598
1598
  while (r.next && r.next != ")" && r.next != "|");
1599
1599
  return e.length == 1 ? e[0] : { type: "seq", exprs: e };
1600
1600
  }
1601
- function Lo(r) {
1601
+ function Fo(r) {
1602
1602
  let e = Vo(r);
1603
1603
  for (; ; )
1604
1604
  if (r.eat("+"))
@@ -1608,7 +1608,7 @@ function Lo(r) {
1608
1608
  else if (r.eat("?"))
1609
1609
  e = { type: "opt", expr: e };
1610
1610
  else if (r.eat("{"))
1611
- e = Fo(r, e);
1611
+ e = Lo(r, e);
1612
1612
  else
1613
1613
  break;
1614
1614
  return e;
@@ -1618,7 +1618,7 @@ function Ar(r) {
1618
1618
  let e = Number(r.next);
1619
1619
  return r.pos++, e;
1620
1620
  }
1621
- function Fo(r, e) {
1621
+ function Lo(r, e) {
1622
1622
  let t = Ar(r), n = t;
1623
1623
  return r.eat(",") && (r.next != "}" ? n = Ar(r) : n = -1), r.eat("}") || r.err("Unclosed braced range"), { type: "range", min: t, max: n, expr: e };
1624
1624
  }
@@ -2301,13 +2301,13 @@ const ts = {
2301
2301
  script: !0,
2302
2302
  style: !0,
2303
2303
  title: !0
2304
- }, ns = { ol: !0, ul: !0 }, yt = 1, Vn = 2, Ft = 4;
2304
+ }, ns = { ol: !0, ul: !0 }, yt = 1, Vn = 2, Lt = 4;
2305
2305
  function Pr(r, e, t) {
2306
2306
  return e != null ? (e ? yt : 0) | (e === "full" ? Vn : 0) : r && r.whitespace == "pre" ? yt | Vn : t & -5;
2307
2307
  }
2308
2308
  class Pt {
2309
2309
  constructor(e, t, n, i, s, o) {
2310
- this.type = e, this.attrs = t, this.marks = n, this.solid = i, this.options = o, this.content = [], this.activeMarks = v.none, this.match = s || (o & Ft ? null : e.contentMatch);
2310
+ this.type = e, this.attrs = t, this.marks = n, this.solid = i, this.options = o, this.content = [], this.activeMarks = v.none, this.match = s || (o & Lt ? null : e.contentMatch);
2311
2311
  }
2312
2312
  findWrapping(e) {
2313
2313
  if (!this.match) {
@@ -2341,7 +2341,7 @@ class Pt {
2341
2341
  class Rr {
2342
2342
  constructor(e, t, n) {
2343
2343
  this.parser = e, this.options = t, this.isOpen = n, this.open = 0, this.localPreserveWS = !1;
2344
- let i = t.topNode, s, o = Pr(null, t.preserveWhitespace, 0) | (n ? Ft : 0);
2344
+ let i = t.topNode, s, o = Pr(null, t.preserveWhitespace, 0) | (n ? Lt : 0);
2345
2345
  i ? s = new Pt(i.type, i.attrs, v.none, !0, t.topMatch || i.type.contentMatch, o) : n ? s = new Pt(null, null, v.none, !0, null, o) : s = new Pt(e.schema.topNodeType, null, v.none, !0, null, o), this.nodes = [s], this.find = t.findPositions, this.needsBlock = !1;
2346
2346
  }
2347
2347
  get top() {
@@ -2511,7 +2511,7 @@ class Rr {
2511
2511
  let o = this.top;
2512
2512
  o.match = o.match && o.match.matchType(e);
2513
2513
  let l = Pr(e, s, o.options);
2514
- o.options & Ft && o.content.length == 0 && (l |= Ft);
2514
+ o.options & Lt && o.content.length == 0 && (l |= Lt);
2515
2515
  let a = v.none;
2516
2516
  return n = n.filter((c) => (o.type ? o.type.allowsMarkType(c.type) : zr(c.type, e)) ? (a = c.addToSet(a), !1) : !0), this.nodes.push(new Pt(e, t, a, i, null, l)), this.open++, n;
2517
2517
  }
@@ -2734,17 +2734,17 @@ class Je {
2734
2734
  This can be useful as a base to build a custom serializer from.
2735
2735
  */
2736
2736
  static nodesFromSchema(e) {
2737
- let t = Lr(e.nodes);
2737
+ let t = Fr(e.nodes);
2738
2738
  return t.text || (t.text = (n) => n.text), t;
2739
2739
  }
2740
2740
  /**
2741
2741
  Gather the serializers in a schema's mark specs into an object.
2742
2742
  */
2743
2743
  static marksFromSchema(e) {
2744
- return Lr(e.marks);
2744
+ return Fr(e.marks);
2745
2745
  }
2746
2746
  }
2747
- function Lr(r) {
2747
+ function Fr(r) {
2748
2748
  let e = {};
2749
2749
  for (let t in r) {
2750
2750
  let n = r[t].spec.toDOM;
@@ -2755,10 +2755,10 @@ function Lr(r) {
2755
2755
  function yn(r) {
2756
2756
  return r.document || window.document;
2757
2757
  }
2758
- const Fr = /* @__PURE__ */ new WeakMap();
2758
+ const Lr = /* @__PURE__ */ new WeakMap();
2759
2759
  function Xo(r) {
2760
- let e = Fr.get(r);
2761
- return e === void 0 && Fr.set(r, e = Zo(r)), e;
2760
+ let e = Lr.get(r);
2761
+ return e === void 0 && Lr.set(r, e = Zo(r)), e;
2762
2762
  }
2763
2763
  function Zo(r) {
2764
2764
  let e = null;
@@ -5241,7 +5241,7 @@ function zl(r) {
5241
5241
  function fe(r, e) {
5242
5242
  return typeof r == "number" ? r : r[e];
5243
5243
  }
5244
- function Ll(r) {
5244
+ function Fl(r) {
5245
5245
  let e = r.getBoundingClientRect(), t = e.width / r.offsetWidth || 1, n = e.height / r.offsetHeight || 1;
5246
5246
  return {
5247
5247
  left: e.left,
@@ -5257,7 +5257,7 @@ function Yr(r, e, t) {
5257
5257
  o = nt(o);
5258
5258
  continue;
5259
5259
  }
5260
- let l = o, a = l == s.body, c = a ? zl(s) : Ll(l), u = 0, d = 0;
5260
+ let l = o, a = l == s.body, c = a ? zl(s) : Fl(l), u = 0, d = 0;
5261
5261
  if (e.top < c.top + fe(n, "top") ? d = -(c.top - e.top + fe(i, "top")) : e.bottom > c.bottom - fe(n, "bottom") && (d = e.bottom - e.top > c.bottom - c.top ? e.top + fe(i, "top") - c.top : e.bottom - c.bottom + fe(i, "bottom")), e.left < c.left + fe(n, "left") ? u = -(c.left - e.left + fe(i, "left")) : e.right > c.right - fe(n, "right") && (u = e.right - c.right + fe(i, "right")), u || d)
5262
5262
  if (a)
5263
5263
  s.defaultView.scrollBy(u, d);
@@ -5273,7 +5273,7 @@ function Yr(r, e, t) {
5273
5273
  o = h == "absolute" ? o.offsetParent : nt(o);
5274
5274
  }
5275
5275
  }
5276
- function Fl(r) {
5276
+ function Ll(r) {
5277
5277
  let e = r.dom.getBoundingClientRect(), t = Math.max(0, e.top), n, i;
5278
5278
  for (let s = (e.left + e.right) / 2, o = t + 1; o < Math.min(innerHeight, e.bottom); o += 5) {
5279
5279
  let l = r.root.elementFromPoint(s, o);
@@ -7043,11 +7043,11 @@ function ya(r, e) {
7043
7043
  let a = i.findWrapping(l.type), c;
7044
7044
  if (!a)
7045
7045
  return o = null;
7046
- if (c = o.length && s.length && Fs(a, s, l, o[o.length - 1], 0))
7046
+ if (c = o.length && s.length && Ls(a, s, l, o[o.length - 1], 0))
7047
7047
  o[o.length - 1] = c;
7048
7048
  else {
7049
7049
  o.length && (o[o.length - 1] = $s(o[o.length - 1], s.length));
7050
- let u = Ls(l, a);
7050
+ let u = Fs(l, a);
7051
7051
  o.push(u), i = i.matchType(u.type), s = a;
7052
7052
  }
7053
7053
  }), o)
@@ -7055,18 +7055,18 @@ function ya(r, e) {
7055
7055
  }
7056
7056
  return r;
7057
7057
  }
7058
- function Ls(r, e, t = 0) {
7058
+ function Fs(r, e, t = 0) {
7059
7059
  for (let n = e.length - 1; n >= t; n--)
7060
7060
  r = e[n].create(null, b.from(r));
7061
7061
  return r;
7062
7062
  }
7063
- function Fs(r, e, t, n, i) {
7063
+ function Ls(r, e, t, n, i) {
7064
7064
  if (i < r.length && i < e.length && r[i] == e[i]) {
7065
- let s = Fs(r, e, t, n.lastChild, i + 1);
7065
+ let s = Ls(r, e, t, n.lastChild, i + 1);
7066
7066
  if (s)
7067
7067
  return n.copy(n.content.replaceChild(n.childCount - 1, s));
7068
7068
  if (n.contentMatchAt(n.childCount).matchType(i == r.length - 1 ? t.type : r[i + 1]))
7069
- return n.copy(n.content.append(b.from(Ls(t, r, i + 1))));
7069
+ return n.copy(n.content.append(b.from(Fs(t, r, i + 1))));
7070
7070
  }
7071
7071
  }
7072
7072
  function $s(r, e) {
@@ -7382,10 +7382,10 @@ function Js(r, e) {
7382
7382
  clearTimeout(r.input.composingTimeout), e > -1 && (r.input.composingTimeout = setTimeout(() => Yt(r), e));
7383
7383
  }
7384
7384
  function qs(r) {
7385
- for (r.composing && (r.input.composing = !1, r.input.compositionEndedAt = Fa()); r.input.compositionNodes.length > 0; )
7385
+ for (r.composing && (r.input.composing = !1, r.input.compositionEndedAt = La()); r.input.compositionNodes.length > 0; )
7386
7386
  r.input.compositionNodes.pop().markParentsDirty();
7387
7387
  }
7388
- function La(r) {
7388
+ function Fa(r) {
7389
7389
  let e = r.domSelectionRange();
7390
7390
  if (!e.focusNode)
7391
7391
  return null;
@@ -7404,7 +7404,7 @@ function La(r) {
7404
7404
  }
7405
7405
  return t || n;
7406
7406
  }
7407
- function Fa() {
7407
+ function La() {
7408
7408
  let r = document.createEvent("Event");
7409
7409
  return r.initEvent("event", !0, !0), r.timeStamp;
7410
7410
  }
@@ -7578,7 +7578,7 @@ function Ct(r, e) {
7578
7578
  }
7579
7579
  class Xt {
7580
7580
  constructor(e, t) {
7581
- this.toDOM = e, this.spec = t || Fe, this.side = this.spec.side || 0;
7581
+ this.toDOM = e, this.spec = t || Le, this.side = this.spec.side || 0;
7582
7582
  }
7583
7583
  map(e, t, n, i) {
7584
7584
  let { pos: s, deleted: o } = e.mapResult(t.from + i, this.side < 0 ? -1 : 1);
@@ -7596,7 +7596,7 @@ class Xt {
7596
7596
  }
7597
7597
  class Oe {
7598
7598
  constructor(e, t) {
7599
- this.attrs = e, this.spec = t || Fe;
7599
+ this.attrs = e, this.spec = t || Le;
7600
7600
  }
7601
7601
  map(e, t, n, i) {
7602
7602
  let s = e.map(t.from + i, this.spec.inclusiveStart ? -1 : 1) - n, o = e.map(t.to + i, this.spec.inclusiveEnd ? 1 : -1) - n;
@@ -7616,7 +7616,7 @@ class Oe {
7616
7616
  }
7617
7617
  class mr {
7618
7618
  constructor(e, t) {
7619
- this.attrs = e, this.spec = t || Fe;
7619
+ this.attrs = e, this.spec = t || Le;
7620
7620
  }
7621
7621
  map(e, t, n, i) {
7622
7622
  let s = e.mapResult(t.from + i, 1);
@@ -7706,7 +7706,7 @@ class re {
7706
7706
  return this.type instanceof Xt;
7707
7707
  }
7708
7708
  }
7709
- const _e = [], Fe = {};
7709
+ const _e = [], Le = {};
7710
7710
  class B {
7711
7711
  /**
7712
7712
  @internal
@@ -7720,7 +7720,7 @@ class B {
7720
7720
  you must make a copy if you want need to preserve that.
7721
7721
  */
7722
7722
  static create(e, t) {
7723
- return t.length ? Zt(t, e, 0, Fe) : W;
7723
+ return t.length ? Zt(t, e, 0, Le) : W;
7724
7724
  }
7725
7725
  /**
7726
7726
  Find all decorations in this set which touch the given range
@@ -7750,7 +7750,7 @@ class B {
7750
7750
  document.
7751
7751
  */
7752
7752
  map(e, t, n) {
7753
- return this == W || e.maps.length == 0 ? this : this.mapInner(e, t, 0, 0, n || Fe);
7753
+ return this == W || e.maps.length == 0 ? this : this.mapInner(e, t, 0, 0, n || Le);
7754
7754
  }
7755
7755
  /**
7756
7756
  @internal
@@ -7779,7 +7779,7 @@ class B {
7779
7779
  if (u = Ys(t, l, c)) {
7780
7780
  for (i || (i = this.children.slice()); s < i.length && i[s] < a; )
7781
7781
  s += 3;
7782
- i[s] == a ? i[s + 2] = i[s + 2].addInner(l, u, c + 1) : i.splice(s, 0, a, a + l.nodeSize, Zt(u, l, c + 1, Fe)), s += 3;
7782
+ i[s] == a ? i[s + 2] = i[s + 2].addInner(l, u, c + 1) : i.splice(s, 0, a, a + l.nodeSize, Zt(u, l, c + 1, Le)), s += 3;
7783
7783
  }
7784
7784
  });
7785
7785
  let o = _s(s ? Xs(t) : t, -n);
@@ -7886,7 +7886,7 @@ class Se {
7886
7886
  this.members = e;
7887
7887
  }
7888
7888
  map(e, t) {
7889
- const n = this.members.map((i) => i.map(e, t, Fe));
7889
+ const n = this.members.map((i) => i.map(e, t, Le));
7890
7890
  return Se.from(n);
7891
7891
  }
7892
7892
  forChild(e, t) {
@@ -8531,13 +8531,13 @@ class sc {
8531
8531
  (l || t.handleDOMEvents != this._props.handleDOMEvents) && Zn(this), this.editable = Mi(this), wi(this);
8532
8532
  let a = On(this), c = Ci(this), u = i.plugins != e.plugins && !i.doc.eq(e.doc) ? "reset" : e.scrollToSelection > i.scrollToSelection ? "to selection" : "preserve", d = s || !this.docView.matchesNode(e.doc, c, a);
8533
8533
  (d || !e.selection.eq(i.selection)) && (o = !0);
8534
- let h = u == "preserve" && o && this.dom.style.overflowAnchor == null && Fl(this);
8534
+ let h = u == "preserve" && o && this.dom.style.overflowAnchor == null && Ll(this);
8535
8535
  if (o) {
8536
8536
  this.domObserver.stop();
8537
8537
  let f = d && (Y || J) && !this.composing && !i.selection.empty && !e.selection.empty && oc(i.selection, e.selection);
8538
8538
  if (d) {
8539
8539
  let p = J ? this.trackWrites = this.domSelectionRange().focusNode : null;
8540
- this.composing && (this.input.compositionNode = La(this)), (s || !this.docView.update(e.doc, c, a, this)) && (this.docView.updateOuterDeco(c), this.docView.destroy(), this.docView = ni(e.doc, c, a, this.dom, this)), p && !this.trackWrites && (f = !0);
8540
+ this.composing && (this.input.compositionNode = Fa(this)), (s || !this.docView.update(e.doc, c, a, this)) && (this.docView.updateOuterDeco(c), this.docView.destroy(), this.docView = ni(e.doc, c, a, this.dom, this)), p && !this.trackWrites && (f = !0);
8541
8541
  }
8542
8542
  f || !(this.input.mouseDown && this.domObserver.currentSelection.eq(this.domSelectionRange()) && aa(this)) ? ye(this, f) : (Ps(this, e.selection), this.domObserver.setCurSelection()), this.domObserver.start();
8543
8543
  }
@@ -9609,7 +9609,7 @@ function uo(r) {
9609
9609
  });
9610
9610
  }), e;
9611
9611
  }
9612
- function F(r, e) {
9612
+ function L(r, e) {
9613
9613
  if (typeof r == "string") {
9614
9614
  if (!e.nodes[r])
9615
9615
  throw Error(`There is no node type named '${r}'. Maybe you forgot to add the extension?`);
@@ -9617,7 +9617,7 @@ function F(r, e) {
9617
9617
  }
9618
9618
  return r;
9619
9619
  }
9620
- function Lc(...r) {
9620
+ function Fc(...r) {
9621
9621
  return r.filter((e) => !!e).reduce((e, t) => {
9622
9622
  const n = { ...e };
9623
9623
  return Object.entries(t).forEach(([i, s]) => {
@@ -9645,7 +9645,7 @@ function Lc(...r) {
9645
9645
  function Qn(r, e) {
9646
9646
  return e.filter((t) => t.type === r.type.name).filter((t) => t.attribute.rendered).map((t) => t.attribute.renderHTML ? t.attribute.renderHTML(r.attrs) || {} : {
9647
9647
  [t.name]: r.attrs[t.name]
9648
- }).reduce((t, n) => Lc(t, n), {});
9648
+ }).reduce((t, n) => Fc(t, n), {});
9649
9649
  }
9650
9650
  function ho(r) {
9651
9651
  return typeof r == "function";
@@ -9653,7 +9653,7 @@ function ho(r) {
9653
9653
  function N(r, e = void 0, ...t) {
9654
9654
  return ho(r) ? e ? r.bind(e)(...t) : r(...t) : r;
9655
9655
  }
9656
- function Fc(r = {}) {
9656
+ function Lc(r = {}) {
9657
9657
  return Object.keys(r).length === 0 && r.constructor === Object;
9658
9658
  }
9659
9659
  function $c(r) {
@@ -9680,7 +9680,7 @@ function Ni(r, e) {
9680
9680
  function Ai(r) {
9681
9681
  return Object.fromEntries(
9682
9682
  // @ts-ignore
9683
- Object.entries(r).filter(([e, t]) => e === "attrs" && Fc(t) ? !1 : t != null)
9683
+ Object.entries(r).filter(([e, t]) => e === "attrs" && Lc(t) ? !1 : t != null)
9684
9684
  );
9685
9685
  }
9686
9686
  function Vc(r, e) {
@@ -10242,7 +10242,7 @@ class Xe {
10242
10242
  options: n.options,
10243
10243
  storage: n.storage,
10244
10244
  editor: e,
10245
- type: F(n.name, this.schema)
10245
+ type: L(n.name, this.schema)
10246
10246
  }, o = x(n, "addNodeView", s);
10247
10247
  if (!o)
10248
10248
  return [];
@@ -10406,7 +10406,7 @@ const Zc = q.create({
10406
10406
  }
10407
10407
  return !1;
10408
10408
  }, ou = (r) => ({ tr: e, state: t, dispatch: n }) => {
10409
- const i = F(r, t.schema), s = e.selection.$anchor;
10409
+ const i = L(r, t.schema), s = e.selection.$anchor;
10410
10410
  for (let o = s.depth; o > 0; o -= 1)
10411
10411
  if (s.node(o).type === i) {
10412
10412
  if (n) {
@@ -10530,7 +10530,7 @@ const pu = (r = null, e = {}) => ({ editor: t, view: n, tr: i, dispatch: s }) =>
10530
10530
  }
10531
10531
  return r;
10532
10532
  };
10533
- function Lt(r) {
10533
+ function Ft(r) {
10534
10534
  const e = `<body>${r}</body>`, t = new window.DOMParser().parseFromString(e, "text/html").body;
10535
10535
  return bo(t);
10536
10536
  }
@@ -10575,11 +10575,11 @@ function Mt(r, e, t) {
10575
10575
  }
10576
10576
  })
10577
10577
  });
10578
- if (t.slice ? ht.fromSchema(a).parseSlice(Lt(r), t.parseOptions) : ht.fromSchema(a).parse(Lt(r), t.parseOptions), t.errorOnInvalidContent && o)
10578
+ if (t.slice ? ht.fromSchema(a).parseSlice(Ft(r), t.parseOptions) : ht.fromSchema(a).parse(Ft(r), t.parseOptions), t.errorOnInvalidContent && o)
10579
10579
  throw new Error("[tiptap error]: Invalid HTML content", { cause: new Error(`Invalid element found: ${l}`) });
10580
10580
  }
10581
10581
  const s = ht.fromSchema(e);
10582
- return t.slice ? s.parseSlice(Lt(r), t.parseOptions).content : s.parse(Lt(r), t.parseOptions);
10582
+ return t.slice ? s.parseSlice(Ft(r), t.parseOptions).content : s.parse(Ft(r), t.parseOptions);
10583
10583
  }
10584
10584
  return Mt("", e, t);
10585
10585
  }
@@ -10705,7 +10705,7 @@ const Au = (r) => ({ editor: e, view: t, tr: n, dispatch: i }) => {
10705
10705
  }), !0;
10706
10706
  };
10707
10707
  function Et(r, e, t = {}) {
10708
- const { from: n, to: i, empty: s } = r.selection, o = e ? F(e, r.schema) : null, l = [];
10708
+ const { from: n, to: i, empty: s } = r.selection, o = e ? L(e, r.schema) : null, l = [];
10709
10709
  r.doc.nodesBetween(n, i, (d, h) => {
10710
10710
  if (d.isText)
10711
10711
  return;
@@ -10720,10 +10720,10 @@ function Et(r, e, t = {}) {
10720
10720
  return s ? !!c.length : c.reduce((d, h) => d + h.to - h.from, 0) >= a;
10721
10721
  }
10722
10722
  const vu = (r, e = {}) => ({ state: t, dispatch: n }) => {
10723
- const i = F(r, t.schema);
10723
+ const i = L(r, t.schema);
10724
10724
  return Et(t, i, e) ? xc(t, n) : !1;
10725
10725
  }, Du = () => ({ state: r, dispatch: e }) => lo(r, e), Iu = (r) => ({ state: e, dispatch: t }) => {
10726
- const n = F(r, e.schema);
10726
+ const n = L(r, e.schema);
10727
10727
  return Ic(n)(e, t);
10728
10728
  }, Pu = () => ({ state: r, dispatch: e }) => so(r, e);
10729
10729
  function pn(r, e) {
@@ -10736,7 +10736,7 @@ function Ii(r, e) {
10736
10736
  const Ru = (r, e) => ({ tr: t, state: n, dispatch: i }) => {
10737
10737
  let s = null, o = null;
10738
10738
  const l = pn(typeof r == "string" ? r : r.name, n.schema);
10739
- return l ? (l === "node" && (s = F(r, n.schema)), l === "mark" && (o = ve(r, n.schema)), i && t.selection.ranges.forEach((a) => {
10739
+ return l ? (l === "node" && (s = L(r, n.schema)), l === "mark" && (o = ve(r, n.schema)), i && t.selection.ranges.forEach((a) => {
10740
10740
  n.doc.nodesBetween(a.$from.pos, a.$to.pos, (c, u) => {
10741
10741
  s && s === c.type && t.setNodeMarkup(u, void 0, Ii(c.attrs, e)), o && c.marks.length && c.marks.forEach((d) => {
10742
10742
  o === d.type && t.addMark(u, u + c.nodeSize, o.create(Ii(d.attrs, e)));
@@ -10749,7 +10749,7 @@ const Ru = (r, e) => ({ tr: t, state: n, dispatch: i }) => {
10749
10749
  r.setSelection(t);
10750
10750
  }
10751
10751
  return !0;
10752
- }, Lu = () => ({ state: r, dispatch: e }) => to(r, e), Fu = () => ({ state: r, dispatch: e }) => io(r, e), $u = () => ({ state: r, dispatch: e }) => Mc(r, e), Vu = () => ({ state: r, dispatch: e }) => Oc(r, e), ju = () => ({ state: r, dispatch: e }) => Tc(r, e);
10752
+ }, Fu = () => ({ state: r, dispatch: e }) => to(r, e), Lu = () => ({ state: r, dispatch: e }) => io(r, e), $u = () => ({ state: r, dispatch: e }) => Mc(r, e), Vu = () => ({ state: r, dispatch: e }) => Oc(r, e), ju = () => ({ state: r, dispatch: e }) => Tc(r, e);
10753
10753
  function er(r, e, t = {}, n = {}) {
10754
10754
  return Mt(r, e, {
10755
10755
  slice: !1,
@@ -10810,7 +10810,7 @@ function Ju(r, e) {
10810
10810
  return fo(r, t, e);
10811
10811
  }
10812
10812
  function qu(r, e) {
10813
- const t = F(e, r.schema), { from: n, to: i } = r.selection, s = [];
10813
+ const t = L(e, r.schema), { from: n, to: i } = r.selection, s = [];
10814
10814
  r.doc.nodesBetween(n, i, (l) => {
10815
10815
  s.push(l);
10816
10816
  });
@@ -10935,7 +10935,7 @@ const _u = (r, e = {}) => ({ tr: t, state: n, dispatch: i }) => {
10935
10935
  });
10936
10936
  return Gu(n, t, a);
10937
10937
  }, Yu = (r, e) => ({ tr: t }) => (t.setMeta(r, e), !0), Xu = (r, e = {}) => ({ state: t, dispatch: n, chain: i }) => {
10938
- const s = F(r, t.schema);
10938
+ const s = L(r, t.schema);
10939
10939
  let o;
10940
10940
  return t.selection.$anchor.sameParent(t.selection.$head) && (o = t.selection.$anchor.parent.attrs), s.isTextblock ? i().command(({ commands: l }) => Oi(s, { ...o, ...e })(t) ? !0 : l.clearNodes()).command(({ state: l }) => Oi(s, { ...o, ...e })(l, n)).run() : (console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'), !1);
10941
10941
  }, Zu = (r) => ({ tr: e, dispatch: t }) => {
@@ -10951,7 +10951,7 @@ const _u = (r, e = {}) => ({ tr: t, state: n, dispatch: i }) => {
10951
10951
  }
10952
10952
  return !0;
10953
10953
  }, ed = (r) => ({ state: e, dispatch: t }) => {
10954
- const n = F(r, e.schema);
10954
+ const n = L(r, e.schema);
10955
10955
  return Bc(n)(e, t);
10956
10956
  };
10957
10957
  function Ri(r, e) {
@@ -10989,7 +10989,7 @@ const td = ({ keepMarks: r = !0 } = {}) => ({ tr: e, state: t, dispatch: n, edit
10989
10989
  return p;
10990
10990
  }, nd = (r, e = {}) => ({ tr: t, state: n, dispatch: i, editor: s }) => {
10991
10991
  var o;
10992
- const l = F(r, n.schema), { $from: a, $to: c } = n.selection, u = n.selection.node;
10992
+ const l = L(r, n.schema), { $from: a, $to: c } = n.selection, u = n.selection.node;
10993
10993
  if (u && u.isBlock || a.depth < 2 || !a.sameParent(c))
10994
10994
  return !1;
10995
10995
  const d = a.node(-1);
@@ -11061,7 +11061,7 @@ const td = ({ keepMarks: r = !0 } = {}) => ({ tr: e, state: t, dispatch: n, edit
11061
11061
  const i = r.doc.nodeAt(n);
11062
11062
  return t.node.type === (i == null ? void 0 : i.type) && qe(r.doc, n) && r.join(n), !0;
11063
11063
  }, rd = (r, e, t, n = {}) => ({ editor: i, tr: s, state: o, dispatch: l, chain: a, commands: c, can: u }) => {
11064
- const { extensions: d, splittableMarks: h } = i.extensionManager, f = F(r, o.schema), p = F(e, o.schema), { selection: m, storedMarks: g } = o, { $from: y, $to: S } = m, w = y.blockRange(S), D = g || m.$to.parentOffset && m.$from.marks();
11064
+ const { extensions: d, splittableMarks: h } = i.extensionManager, f = L(r, o.schema), p = L(e, o.schema), { selection: m, storedMarks: g } = o, { $from: y, $to: S } = m, w = y.blockRange(S), D = g || m.$to.parentOffset && m.$from.marks();
11065
11065
  if (!w)
11066
11066
  return !1;
11067
11067
  const A = Tr((M) => Pi(M.type.name, d))(m);
@@ -11079,11 +11079,11 @@ const td = ({ keepMarks: r = !0 } = {}) => ({ tr: e, state: t, dispatch: n, edit
11079
11079
  const { extendEmptyMarkRange: s = !1 } = t, o = ve(r, n.schema);
11080
11080
  return tr(n, o, e) ? i.unsetMark(o, { extendEmptyMarkRange: s }) : i.setMark(o, e);
11081
11081
  }, sd = (r, e, t = {}) => ({ state: n, commands: i }) => {
11082
- const s = F(r, n.schema), o = F(e, n.schema), l = Et(n, s, t);
11082
+ const s = L(r, n.schema), o = L(e, n.schema), l = Et(n, s, t);
11083
11083
  let a;
11084
11084
  return n.selection.$anchor.sameParent(n.selection.$head) && (a = n.selection.$anchor.parent.attrs), l ? i.setNode(o, a) : i.setNode(s, { ...a, ...t });
11085
11085
  }, od = (r, e = {}) => ({ state: t, commands: n }) => {
11086
- const i = F(r, t.schema);
11086
+ const i = L(r, t.schema);
11087
11087
  return Et(t, i, e) ? n.lift(i) : n.wrapIn(i, e);
11088
11088
  }, ld = () => ({ state: r, dispatch: e }) => {
11089
11089
  const t = r.plugins;
@@ -11127,7 +11127,7 @@ const td = ({ keepMarks: r = !0 } = {}) => ({ tr: e, state: t, dispatch: n, edit
11127
11127
  }, ud = (r, e = {}) => ({ tr: t, state: n, dispatch: i }) => {
11128
11128
  let s = null, o = null;
11129
11129
  const l = pn(typeof r == "string" ? r : r.name, n.schema);
11130
- return l ? (l === "node" && (s = F(r, n.schema)), l === "mark" && (o = ve(r, n.schema)), i && t.selection.ranges.forEach((a) => {
11130
+ return l ? (l === "node" && (s = L(r, n.schema)), l === "mark" && (o = ve(r, n.schema)), i && t.selection.ranges.forEach((a) => {
11131
11131
  const c = a.$from.pos, u = a.$to.pos;
11132
11132
  let d, h, f, p;
11133
11133
  t.selection.empty ? n.doc.nodesBetween(c, u, (m, g) => {
@@ -11156,10 +11156,10 @@ const td = ({ keepMarks: r = !0 } = {}) => ({ tr: e, state: t, dispatch: n, edit
11156
11156
  }));
11157
11157
  }), !0) : !1;
11158
11158
  }, dd = (r, e = {}) => ({ state: t, dispatch: n }) => {
11159
- const i = F(r, t.schema);
11159
+ const i = L(r, t.schema);
11160
11160
  return Nc(i, e)(t, n);
11161
11161
  }, hd = (r, e = {}) => ({ state: t, dispatch: n }) => {
11162
- const i = F(r, t.schema);
11162
+ const i = L(r, t.schema);
11163
11163
  return Ac(i, e)(t, n);
11164
11164
  };
11165
11165
  var fd = /* @__PURE__ */ Object.freeze({
@@ -11198,8 +11198,8 @@ var fd = /* @__PURE__ */ Object.freeze({
11198
11198
  resetAttributes: Ru,
11199
11199
  scrollIntoView: Bu,
11200
11200
  selectAll: zu,
11201
- selectNodeBackward: Lu,
11202
- selectNodeForward: Fu,
11201
+ selectNodeBackward: Fu,
11202
+ selectNodeForward: Lu,
11203
11203
  selectParentNode: $u,
11204
11204
  selectTextblockEnd: Vu,
11205
11205
  selectTextblockStart: ju,
@@ -11996,36 +11996,36 @@ let Or = class nr {
11996
11996
  })), t;
11997
11997
  }
11998
11998
  };
11999
- var tn = 200, L = function() {
11999
+ var tn = 200, F = function() {
12000
12000
  };
12001
- L.prototype.append = function(e) {
12002
- return e.length ? (e = L.from(e), !this.length && e || e.length < tn && this.leafAppend(e) || this.length < tn && e.leafPrepend(this) || this.appendInner(e)) : this;
12001
+ F.prototype.append = function(e) {
12002
+ return e.length ? (e = F.from(e), !this.length && e || e.length < tn && this.leafAppend(e) || this.length < tn && e.leafPrepend(this) || this.appendInner(e)) : this;
12003
12003
  };
12004
- L.prototype.prepend = function(e) {
12005
- return e.length ? L.from(e).append(this) : this;
12004
+ F.prototype.prepend = function(e) {
12005
+ return e.length ? F.from(e).append(this) : this;
12006
12006
  };
12007
- L.prototype.appendInner = function(e) {
12007
+ F.prototype.appendInner = function(e) {
12008
12008
  return new Ed(this, e);
12009
12009
  };
12010
- L.prototype.slice = function(e, t) {
12011
- return e === void 0 && (e = 0), t === void 0 && (t = this.length), e >= t ? L.empty : this.sliceInner(Math.max(0, e), Math.min(this.length, t));
12010
+ F.prototype.slice = function(e, t) {
12011
+ return e === void 0 && (e = 0), t === void 0 && (t = this.length), e >= t ? F.empty : this.sliceInner(Math.max(0, e), Math.min(this.length, t));
12012
12012
  };
12013
- L.prototype.get = function(e) {
12013
+ F.prototype.get = function(e) {
12014
12014
  if (!(e < 0 || e >= this.length))
12015
12015
  return this.getInner(e);
12016
12016
  };
12017
- L.prototype.forEach = function(e, t, n) {
12017
+ F.prototype.forEach = function(e, t, n) {
12018
12018
  t === void 0 && (t = 0), n === void 0 && (n = this.length), t <= n ? this.forEachInner(e, t, n, 0) : this.forEachInvertedInner(e, t, n, 0);
12019
12019
  };
12020
- L.prototype.map = function(e, t, n) {
12020
+ F.prototype.map = function(e, t, n) {
12021
12021
  t === void 0 && (t = 0), n === void 0 && (n = this.length);
12022
12022
  var i = [];
12023
12023
  return this.forEach(function(s, o) {
12024
12024
  return i.push(e(s, o));
12025
12025
  }, t, n), i;
12026
12026
  };
12027
- L.from = function(e) {
12028
- return e instanceof L ? e : e && e.length ? new Co(e) : L.empty;
12027
+ F.from = function(e) {
12028
+ return e instanceof F ? e : e && e.length ? new Co(e) : F.empty;
12029
12029
  };
12030
12030
  var Co = /* @__PURE__ */ function(r) {
12031
12031
  function e(n) {
@@ -12058,8 +12058,8 @@ var Co = /* @__PURE__ */ function(r) {
12058
12058
  }, t.depth.get = function() {
12059
12059
  return 0;
12060
12060
  }, Object.defineProperties(e.prototype, t), e;
12061
- }(L);
12062
- L.empty = new Co([]);
12061
+ }(F);
12062
+ F.empty = new Co([]);
12063
12063
  var Ed = /* @__PURE__ */ function(r) {
12064
12064
  function e(t, n) {
12065
12065
  r.call(this), this.left = t, this.right = n, this.length = t.length + n.length, this.depth = Math.max(t.depth, n.depth) + 1;
@@ -12092,7 +12092,7 @@ var Ed = /* @__PURE__ */ function(r) {
12092
12092
  }, e.prototype.appendInner = function(n) {
12093
12093
  return this.left.depth >= Math.max(this.right.depth, n.depth) + 1 ? new e(this.left, new e(this.right, n)) : new e(this, n);
12094
12094
  }, e;
12095
- }(L);
12095
+ }(F);
12096
12096
  const Td = 500;
12097
12097
  class se {
12098
12098
  constructor(e, t) {
@@ -12203,10 +12203,10 @@ class se {
12203
12203
  (h = i.length && i[f].merge(d)) ? i[f] = h : i.push(d);
12204
12204
  }
12205
12205
  } else o.map && n--;
12206
- }, this.items.length, 0), new se(L.from(i.reverse()), s);
12206
+ }, this.items.length, 0), new se(F.from(i.reverse()), s);
12207
12207
  }
12208
12208
  }
12209
- se.empty = new se(L.empty, 0);
12209
+ se.empty = new se(F.empty, 0);
12210
12210
  function Od(r, e) {
12211
12211
  let t;
12212
12212
  return r.forEach((n, i) => {
@@ -12407,7 +12407,7 @@ const Mo = wo(!1, !0), Eo = wo(!0, !0), Rd = q.create({
12407
12407
  ];
12408
12408
  }
12409
12409
  });
12410
- function Li(r) {
12410
+ function Fi(r) {
12411
12411
  const t = r.state.doc.toJSON(), n = new zd(r);
12412
12412
  let i = [];
12413
12413
  return t.content.forEach((s) => {
@@ -12470,11 +12470,11 @@ class zd {
12470
12470
  }), this.openMarks = [], e;
12471
12471
  }
12472
12472
  }
12473
- const Ld = Or.create({
12473
+ const Fd = Or.create({
12474
12474
  name: "doc",
12475
12475
  topNode: !0,
12476
12476
  content: "block+"
12477
- }), Fd = Or.create({
12477
+ }), Ld = Or.create({
12478
12478
  name: "text",
12479
12479
  group: "inline"
12480
12480
  }), $d = wt.create({
@@ -12650,7 +12650,8 @@ const To = vt.extend({
12650
12650
  return e.classList.add("empty-element"), e.innerHTML = this.options.label, Object.entries(r.attrs).forEach(([t, n]) => {
12651
12651
  n && e.setAttribute(t, n);
12652
12652
  }), e.addEventListener("click", () => {
12653
- this.editor.options.element.dispatchEvent(new CustomEvent("empty-element-clicked", { detail: { node: r } }));
12653
+ const t = this.editor.view.posAtDOM(e);
12654
+ this.editor.options.element.dispatchEvent(new CustomEvent("empty-element-clicked", { detail: { node: r, pos: t } }));
12654
12655
  }), {
12655
12656
  dom: e,
12656
12657
  update: (t) => {
@@ -12675,7 +12676,7 @@ const To = vt.extend({
12675
12676
  }), r;
12676
12677
  }
12677
12678
  });
12678
- function Fi() {
12679
+ function Li() {
12679
12680
  const r = Date.now().toString(36), e = Math.random().toString(36).substring(2, 8);
12680
12681
  return `fn-${r}-${e}`;
12681
12682
  }
@@ -12775,7 +12776,7 @@ const Ud = To.extend({
12775
12776
  return { id: e.id };
12776
12777
  },
12777
12778
  parseHTML(e) {
12778
- return e.getAttribute("id") || Fi();
12779
+ return e.getAttribute("id") || Li();
12779
12780
  }
12780
12781
  },
12781
12782
  _timestamp: {
@@ -12803,7 +12804,7 @@ const Ud = To.extend({
12803
12804
  type: this.name,
12804
12805
  attrs: {
12805
12806
  ...r,
12806
- id: Fi()
12807
+ id: Li()
12807
12808
  }
12808
12809
  }),
12809
12810
  gotoNote: (r) => ({ commands: e, editor: t }) => {
@@ -12913,11 +12914,13 @@ const Ud = To.extend({
12913
12914
  }), _d = vt.extend({
12914
12915
  name: "graphic",
12915
12916
  content: "",
12917
+ selectable: !0,
12916
12918
  addNodeView() {
12917
12919
  return ({ node: r }) => {
12918
12920
  const e = document.createElement("img");
12919
12921
  return e.src = r.attrs.url, e.addEventListener("click", () => {
12920
- this.editor.options.element.dispatchEvent(new CustomEvent("empty-element-clicked", { detail: { node: r } }));
12922
+ const t = this.editor.view.posAtDOM(e);
12923
+ this.editor.options.element.dispatchEvent(new CustomEvent("empty-element-clicked", { detail: { node: r, pos: t } }));
12921
12924
  }), {
12922
12925
  dom: e
12923
12926
  };
@@ -12927,7 +12930,7 @@ const Ud = To.extend({
12927
12930
  function Yd(r) {
12928
12931
  const e = [
12929
12932
  Xd,
12930
- Fd
12933
+ Ld
12931
12934
  ];
12932
12935
  return Object.entries(r.schema).forEach(([t, n]) => {
12933
12936
  let i;
@@ -12984,7 +12987,7 @@ function Yd(r) {
12984
12987
  }));
12985
12988
  }), e;
12986
12989
  }
12987
- const Xd = Ld.extend({
12990
+ const Xd = Fd.extend({
12988
12991
  content: "block+ noteGrp?"
12989
12992
  }), Zd = So({
12990
12993
  find: /---|–-/,
@@ -13124,7 +13127,8 @@ class lh {
13124
13127
  }), this.editor.on("update", ({ editor: e }) => {
13125
13128
  this.updatePanelForCurrentPosition(e);
13126
13129
  }), this.editor.options.element.addEventListener("empty-element-clicked", ({ detail: e }) => {
13127
- this.showNodeAttributes(e.node);
13130
+ const { node: t, pos: n } = e;
13131
+ this.editor.chain().focus().setNodeSelection(n).run(), this.showNodeAttributes(t);
13128
13132
  });
13129
13133
  }
13130
13134
  updatePanelForCurrentPosition(e) {
@@ -13586,7 +13590,7 @@ const dh = {
13586
13590
  select: "Textcritical",
13587
13591
  label: "<i class='bi bi-three-dots'></i>"
13588
13592
  },
13589
- "figure/graphic": {
13593
+ Figure: {
13590
13594
  command: "insertFigure",
13591
13595
  label: "<i class='bi bi-images'></i>",
13592
13596
  select: "Blocks"
@@ -14328,7 +14332,7 @@ class mh extends HTMLElement {
14328
14332
  this.dispatchEvent(new CustomEvent("content-change", {
14329
14333
  detail: {
14330
14334
  content: this.editor.getText(),
14331
- xml: Li(this.editor)
14335
+ xml: Fi(this.editor)
14332
14336
  }
14333
14337
  }));
14334
14338
  }
@@ -14342,7 +14346,7 @@ class mh extends HTMLElement {
14342
14346
  }
14343
14347
  // Getter for the TEI XML content
14344
14348
  get xml() {
14345
- return Li(this.editor);
14349
+ return Fi(this.editor);
14346
14350
  }
14347
14351
  // Method to focus the editor
14348
14352
  focus() {
@@ -87,7 +87,7 @@ img.ProseMirror-separator {
87
87
  }`;function pd(r,e,t){const n=document.querySelector("style[data-tiptap-style]");if(n!==null)return n;const i=document.createElement("style");return e&&i.setAttribute("nonce",e),i.setAttribute("data-tiptap-style",""),i.innerHTML=r,document.getElementsByTagName("head")[0].appendChild(i),i}class md extends Lc{constructor(e={}){super(),this.isFocused=!1,this.isInitialized=!1,this.extensionStorage={},this.options={element:document.createElement("div"),content:"",injectCSS:!0,injectNonce:void 0,extensions:[],autofocus:!1,editable:!0,editorProps:{},parseOptions:{},coreExtensionOptions:{},enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!0,enableContentCheck:!1,onBeforeCreate:()=>null,onCreate:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null,onContentError:({error:t})=>{throw t},onPaste:()=>null,onDrop:()=>null},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.setOptions(e),this.createExtensionManager(),this.createCommandManager(),this.createSchema(),this.on("beforeCreate",this.options.onBeforeCreate),this.emit("beforeCreate",{editor:this}),this.on("contentError",this.options.onContentError),this.createView(),this.injectCSS(),this.on("create",this.options.onCreate),this.on("update",this.options.onUpdate),this.on("selectionUpdate",this.options.onSelectionUpdate),this.on("transaction",this.options.onTransaction),this.on("focus",this.options.onFocus),this.on("blur",this.options.onBlur),this.on("destroy",this.options.onDestroy),this.on("drop",({event:t,slice:n,moved:i})=>this.options.onDrop(t,n,i)),this.on("paste",({event:t,slice:n})=>this.options.onPaste(t,n)),window.setTimeout(()=>{this.isDestroyed||(this.commands.focus(this.options.autofocus),this.emit("create",{editor:this}),this.isInitialized=!0)},0)}get storage(){return this.extensionStorage}get commands(){return this.commandManager.commands}chain(){return this.commandManager.chain()}can(){return this.commandManager.can()}injectCSS(){this.options.injectCSS&&document&&(this.css=pd(fd,this.options.injectNonce))}setOptions(e={}){this.options={...this.options,...e},!(!this.view||!this.state||this.isDestroyed)&&(this.options.editorProps&&this.view.setProps(this.options.editorProps),this.view.updateState(this.state))}setEditable(e,t=!0){this.setOptions({editable:e}),t&&this.emit("update",{editor:this,transaction:this.state.tr})}get isEditable(){return this.options.editable&&this.view&&this.view.editable}get state(){return this.view.state}registerPlugin(e,t){const n=eo(t)?t(e,[...this.state.plugins]):[...this.state.plugins,e],i=this.state.reconfigure({plugins:n});return this.view.updateState(i),i}unregisterPlugin(e){if(this.isDestroyed)return;const t=this.state.plugins;let n=t;if([].concat(e).forEach(s=>{const o=typeof s=="string"?`${s}$`:s.key;n=t.filter(l=>!l.key.startsWith(o))}),t.length===n.length)return;const i=this.state.reconfigure({plugins:n});return this.view.updateState(i),i}createExtensionManager(){var e,t;const i=[...this.options.enableCoreExtensions?[ld,Qc.configure({blockSeparator:(t=(e=this.options.coreExtensionOptions)===null||e===void 0?void 0:e.clipboardTextSerializer)===null||t===void 0?void 0:t.blockSeparator}),sd,cd,ud,hd,od,dd].filter(s=>typeof this.options.enableCoreExtensions=="object"?this.options.enableCoreExtensions[s.name]!==!1:!0):[],...this.options.extensions].filter(s=>["extension","node","mark"].includes(s==null?void 0:s.type));this.extensionManager=new ot(i,this)}createCommandManager(){this.commandManager=new nn({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createView(){var e;let t;try{t=mr(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:this.options.enableContentCheck})}catch(o){if(!(o instanceof Error)||!["[tiptap error]: Invalid JSON content","[tiptap error]: Invalid HTML content"].includes(o.message))throw o;this.emit("contentError",{editor:this,error:o,disableCollaboration:()=>{this.storage.collaboration&&(this.storage.collaboration.isDisabled=!0),this.options.extensions=this.options.extensions.filter(l=>l.name!=="collaboration"),this.createExtensionManager()}}),t=mr(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}const n=co(t,this.options.autofocus);this.view=new oc(this.options.element,{...this.options.editorProps,attributes:{role:"textbox",...(e=this.options.editorProps)===null||e===void 0?void 0:e.attributes},dispatchTransaction:this.dispatchTransaction.bind(this),state:Ze.create({doc:t,selection:n||void 0})});const i=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(i),this.createNodeViews(),this.prependClass();const s=this.view.dom;s.editor=this}createNodeViews(){this.view.isDestroyed||this.view.setProps({nodeViews:this.extensionManager.nodeViews})}prependClass(){this.view.dom.className=`tiptap ${this.view.dom.className}`}captureTransaction(e){this.isCapturingTransaction=!0,e(),this.isCapturingTransaction=!1;const t=this.capturedTransaction;return this.capturedTransaction=null,t}dispatchTransaction(e){if(this.view.isDestroyed)return;if(this.isCapturingTransaction){if(!this.capturedTransaction){this.capturedTransaction=e;return}e.steps.forEach(o=>{var l;return(l=this.capturedTransaction)===null||l===void 0?void 0:l.step(o)});return}const t=this.state.apply(e),n=!this.state.selection.eq(t.selection);this.emit("beforeTransaction",{editor:this,transaction:e,nextState:t}),this.view.updateState(t),this.emit("transaction",{editor:this,transaction:e}),n&&this.emit("selectionUpdate",{editor:this,transaction:e});const i=e.getMeta("focus"),s=e.getMeta("blur");i&&this.emit("focus",{editor:this,event:i.event,transaction:e}),s&&this.emit("blur",{editor:this,event:s.event,transaction:e}),!(!e.docChanged||e.getMeta("preventUpdate"))&&this.emit("update",{editor:this,transaction:e})}getAttributes(e){return Uu(this.state,e)}isActive(e,t){const n=typeof e=="string"?e:null,i=typeof e=="string"?t:e;return Gu(this.state,n,i)}getJSON(){return this.state.doc.toJSON()}getHTML(){return dr(this.state.doc.content,this.schema)}getText(e){const{blockSeparator:t=`
88
88
 
89
89
  `,textSerializers:n={}}=e||{};return qu(this.state.doc,{blockSeparator:t,textSerializers:{...so(this.schema),...n}})}get isEmpty(){return fn(this.state.doc)}getCharacterCount(){return console.warn('[tiptap warn]: "editor.getCharacterCount()" is deprecated. Please use "editor.storage.characterCount.characters()" instead.'),this.state.doc.content.size-2}destroy(){if(this.emit("destroy"),this.view){const e=this.view.dom;e&&e.editor&&delete e.editor,this.view.destroy()}this.removeAllListeners()}get isDestroyed(){var e;return!(!((e=this.view)===null||e===void 0)&&e.docView)}$node(e,t){var n;return((n=this.$doc)===null||n===void 0?void 0:n.querySelector(e,t))||null}$nodes(e,t){var n;return((n=this.$doc)===null||n===void 0?void 0:n.querySelectorAll(e,t))||null}$pos(e){const t=this.state.doc.resolve(e);return new Je(t,this)}get $doc(){return this.$pos(0)}}function yo(r){return new Wc({find:r.find,handler:({state:e,range:t,match:n})=>{let i=r.replace,s=t.from;const o=t.to;if(n[1]){const l=n[0].lastIndexOf(n[1]);i+=n[0].slice(l+n[1].length),s+=l;const a=s-o;a>0&&(i=n[0].slice(l-a,l)+i,s=o)}e.tr.insertText(i,s,o)}})}let xr=class Nr{constructor(e={}){this.type="node",this.name="node",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...e},this.name=this.config.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: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=N(x(this,"addOptions",{name:this.name}))),this.storage=N(x(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new Nr(e)}configure(e={}){const t=this.extend({...this.config,addOptions:()=>ln(this.options,e)});return t.name=this.name,t.parent=this.parent,t}extend(e={}){const t=new Nr(e);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(x(t,"addOptions",{name:t.name})),t.storage=N(x(t,"addStorage",{name:t.name,options:t.options})),t}};var pn=200,$=function(){};$.prototype.append=function(e){return e.length?(e=$.from(e),!this.length&&e||e.length<pn&&this.leafAppend(e)||this.length<pn&&e.leafPrepend(this)||this.appendInner(e)):this},$.prototype.prepend=function(e){return e.length?$.from(e).append(this):this},$.prototype.appendInner=function(e){return new gd(this,e)},$.prototype.slice=function(e,t){return e===void 0&&(e=0),t===void 0&&(t=this.length),e>=t?$.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))},$.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)},$.prototype.forEach=function(e,t,n){t===void 0&&(t=0),n===void 0&&(n=this.length),t<=n?this.forEachInner(e,t,n,0):this.forEachInvertedInner(e,t,n,0)},$.prototype.map=function(e,t,n){t===void 0&&(t=0),n===void 0&&(n=this.length);var i=[];return this.forEach(function(s,o){return i.push(e(s,o))},t,n),i},$.from=function(e){return e instanceof $?e:e&&e.length?new bo(e):$.empty};var bo=function(r){function e(n){r.call(this),this.values=n}r&&(e.__proto__=r),e.prototype=Object.create(r&&r.prototype),e.prototype.constructor=e;var t={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(i,s){return i==0&&s==this.length?this:new e(this.values.slice(i,s))},e.prototype.getInner=function(i){return this.values[i]},e.prototype.forEachInner=function(i,s,o,l){for(var a=s;a<o;a++)if(i(this.values[a],l+a)===!1)return!1},e.prototype.forEachInvertedInner=function(i,s,o,l){for(var a=s-1;a>=o;a--)if(i(this.values[a],l+a)===!1)return!1},e.prototype.leafAppend=function(i){if(this.length+i.length<=pn)return new e(this.values.concat(i.flatten()))},e.prototype.leafPrepend=function(i){if(this.length+i.length<=pn)return new e(i.flatten().concat(this.values))},t.length.get=function(){return this.values.length},t.depth.get=function(){return 0},Object.defineProperties(e.prototype,t),e}($);$.empty=new bo([]);var gd=function(r){function e(t,n){r.call(this),this.left=t,this.right=n,this.length=t.length+n.length,this.depth=Math.max(t.depth,n.depth)+1}return r&&(e.__proto__=r),e.prototype=Object.create(r&&r.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(n){return n<this.left.length?this.left.get(n):this.right.get(n-this.left.length)},e.prototype.forEachInner=function(n,i,s,o){var l=this.left.length;if(i<l&&this.left.forEachInner(n,i,Math.min(s,l),o)===!1||s>l&&this.right.forEachInner(n,Math.max(i-l,0),Math.min(this.length,s)-l,o+l)===!1)return!1},e.prototype.forEachInvertedInner=function(n,i,s,o){var l=this.left.length;if(i>l&&this.right.forEachInvertedInner(n,i-l,Math.max(s,l)-l,o+l)===!1||s<l&&this.left.forEachInvertedInner(n,Math.min(i,l),s,o)===!1)return!1},e.prototype.sliceInner=function(n,i){if(n==0&&i==this.length)return this;var s=this.left.length;return i<=s?this.left.slice(n,i):n>=s?this.right.slice(n-s,i-s):this.left.slice(n,s).append(this.right.slice(0,i-s))},e.prototype.leafAppend=function(n){var i=this.right.leafAppend(n);if(i)return new e(this.left,i)},e.prototype.leafPrepend=function(n){var i=this.left.leafPrepend(n);if(i)return new e(i,this.right)},e.prototype.appendInner=function(n){return this.left.depth>=Math.max(this.right.depth,n.depth)+1?new e(this.left,new e(this.right,n)):new e(this,n)},e}($);const yd=500;class le{constructor(e,t){this.items=e,this.eventCount=t}popEvent(e,t){if(this.eventCount==0)return null;let n=this.items.length;for(;;n--)if(this.items.get(n-1).selection){--n;break}let i,s;t&&(i=this.remapping(n,this.items.length),s=i.maps.length);let o=e.tr,l,a,c=[],u=[];return this.items.forEach((d,h)=>{if(!d.step){i||(i=this.remapping(n,h+1),s=i.maps.length),s--,u.push(d);return}if(i){u.push(new he(d.map));let f=d.step.map(i.slice(s)),p;f&&o.maybeStep(f).doc&&(p=o.mapping.maps[o.mapping.maps.length-1],c.push(new he(p,void 0,void 0,c.length+u.length))),s--,p&&i.appendMap(p,s)}else o.maybeStep(d.step);if(d.selection)return l=i?d.selection.map(i.slice(s)):d.selection,a=new le(this.items.slice(0,n).append(u.reverse().concat(c)),this.eventCount-1),!1},this.items.length,0),{remaining:a,transform:o,selection:l}}addTransform(e,t,n,i){let s=[],o=this.eventCount,l=this.items,a=!i&&l.length?l.get(l.length-1):null;for(let u=0;u<e.steps.length;u++){let d=e.steps[u].invert(e.docs[u]),h=new he(e.mapping.maps[u],d,t),f;(f=a&&a.merge(h))&&(h=f,u?s.pop():l=l.slice(0,l.length-1)),s.push(h),t&&(o++,t=void 0),i||(a=h)}let c=o-n.depth;return c>kd&&(l=bd(l,c),o-=c),new le(l.append(s),o)}remapping(e,t){let n=new dt;return this.items.forEach((i,s)=>{let o=i.mirrorOffset!=null&&s-i.mirrorOffset>=e?n.maps.length-i.mirrorOffset:void 0;n.appendMap(i.map,o)},e,t),n}addMaps(e){return this.eventCount==0?this:new le(this.items.append(e.map(t=>new he(t))),this.eventCount)}rebased(e,t){if(!this.eventCount)return this;let n=[],i=Math.max(0,this.items.length-t),s=e.mapping,o=e.steps.length,l=this.eventCount;this.items.forEach(h=>{h.selection&&l--},i);let a=t;this.items.forEach(h=>{let f=s.getMirror(--a);if(f==null)return;o=Math.min(o,f);let p=s.maps[f];if(h.step){let m=e.steps[f].invert(e.docs[f]),g=h.selection&&h.selection.map(s.slice(a+1,f));g&&l++,n.push(new he(p,m,g))}else n.push(new he(p))},i);let c=[];for(let h=t;h<o;h++)c.push(new he(s.maps[h]));let u=this.items.slice(0,i).append(c).append(n),d=new le(u,l);return d.emptyItemCount()>yd&&(d=d.compress(this.items.length-n.length)),d}emptyItemCount(){let e=0;return this.items.forEach(t=>{t.step||e++}),e}compress(e=this.items.length){let t=this.remapping(0,e),n=t.maps.length,i=[],s=0;return this.items.forEach((o,l)=>{if(l>=e)i.push(o),o.selection&&s++;else if(o.step){let a=o.step.map(t.slice(n)),c=a&&a.getMap();if(n--,c&&t.appendMap(c,n),a){let u=o.selection&&o.selection.map(t.slice(n));u&&s++;let d=new he(c.invert(),a,u),h,f=i.length-1;(h=i.length&&i[f].merge(d))?i[f]=h:i.push(d)}}else o.map&&n--},this.items.length,0),new le($.from(i.reverse()),s)}}le.empty=new le($.empty,0);function bd(r,e){let t;return r.forEach((n,i)=>{if(n.selection&&e--==0)return t=i,!1}),r.slice(t)}class he{constructor(e,t,n,i){this.map=e,this.step=t,this.selection=n,this.mirrorOffset=i}merge(e){if(this.step&&e.step&&!e.selection){let t=e.step.merge(this.step);if(t)return new he(t.getMap().invert(),t,this.selection)}}}class ve{constructor(e,t,n,i,s){this.done=e,this.undone=t,this.prevRanges=n,this.prevTime=i,this.prevComposition=s}}const kd=20;function xd(r,e,t,n){let i=t.getMeta(qe),s;if(i)return i.historyState;t.getMeta(wd)&&(r=new ve(r.done,r.undone,null,0,-1));let o=t.getMeta("appendedTransaction");if(t.steps.length==0)return r;if(o&&o.getMeta(qe))return o.getMeta(qe).redo?new ve(r.done.addTransform(t,void 0,n,mn(e)),r.undone,ko(t.mapping.maps),r.prevTime,r.prevComposition):new ve(r.done,r.undone.addTransform(t,void 0,n,mn(e)),null,r.prevTime,r.prevComposition);if(t.getMeta("addToHistory")!==!1&&!(o&&o.getMeta("addToHistory")===!1)){let l=t.getMeta("composition"),a=r.prevTime==0||!o&&r.prevComposition!=l&&(r.prevTime<(t.time||0)-n.newGroupDelay||!Sd(t,r.prevRanges)),c=o?Sr(r.prevRanges,t.mapping):ko(t.mapping.maps);return new ve(r.done.addTransform(t,a?e.selection.getBookmark():void 0,n,mn(e)),le.empty,c,t.time,l??r.prevComposition)}else return(s=t.getMeta("rebased"))?new ve(r.done.rebased(t,s),r.undone.rebased(t,s),Sr(r.prevRanges,t.mapping),r.prevTime,r.prevComposition):new ve(r.done.addMaps(t.mapping.maps),r.undone.addMaps(t.mapping.maps),Sr(r.prevRanges,t.mapping),r.prevTime,r.prevComposition)}function Sd(r,e){if(!e)return!1;if(!r.docChanged)return!0;let t=!1;return r.mapping.maps[0].forEach((n,i)=>{for(let s=0;s<e.length;s+=2)n<=e[s+1]&&i>=e[s]&&(t=!0)}),t}function ko(r){let e=[];for(let t=r.length-1;t>=0&&e.length==0;t--)r[t].forEach((n,i,s,o)=>e.push(s,o));return e}function Sr(r,e){if(!r)return null;let t=[];for(let n=0;n<r.length;n+=2){let i=e.map(r[n],1),s=e.map(r[n+1],-1);i<=s&&t.push(i,s)}return t}function Cd(r,e,t){let n=mn(e),i=qe.get(e).spec.config,s=(t?r.undone:r.done).popEvent(e,n);if(!s)return null;let o=s.selection.resolve(s.transform.doc),l=(t?r.done:r.undone).addTransform(s.transform,e.selection.getBookmark(),i,n),a=new ve(t?l:s.remaining,t?s.remaining:l,null,0,-1);return s.transform.setSelection(o).setMeta(qe,{redo:t,historyState:a})}let Cr=!1,xo=null;function mn(r){let e=r.plugins;if(xo!=e){Cr=!1,xo=e;for(let t=0;t<e.length;t++)if(e[t].spec.historyPreserveItems){Cr=!0;break}}return Cr}const qe=new se("history"),wd=new se("closeHistory");function Md(r={}){return r={depth:r.depth||100,newGroupDelay:r.newGroupDelay||500},new Q({key:qe,state:{init(){return new ve(le.empty,le.empty,null,0,-1)},apply(e,t,n){return xd(t,n,e,r)}},config:r,props:{handleDOMEvents:{beforeinput(e,t){let n=t.inputType,i=n=="historyUndo"?Co:n=="historyRedo"?wo:null;return i?(t.preventDefault(),i(e.state,e.dispatch)):!1}}}})}function So(r,e){return(t,n)=>{let i=qe.getState(t);if(!i||(r?i.undone:i.done).eventCount==0)return!1;if(n){let s=Cd(i,t,r);s&&n(e?s.scrollIntoView():s)}return!0}}const Co=So(!1,!0),wo=So(!0,!0),Ed=q.create({name:"history",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:r,dispatch:e})=>Co(r,e),redo:()=>({state:r,dispatch:e})=>wo(r,e)}},addProseMirrorPlugins(){return[Md(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-я":()=>this.editor.commands.undo(),"Shift-Mod-я":()=>this.editor.commands.redo()}}}),Td=q.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[new Q({key:new se("placeholder"),props:{decorations:({doc:r,selection:e})=>{const t=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:n}=e,i=[];if(!t)return null;const s=this.editor.isEmpty;return r.descendants((o,l)=>{const a=n>=l&&n<=l+o.nodeSize,c=!o.isLeaf&&fn(o);if((a||!this.options.showOnlyCurrent)&&c){const u=[this.options.emptyNodeClass];s&&u.push(this.options.emptyEditorClass);const d=re.node(l,l+o.nodeSize,{class:u.join(" "),"data-placeholder":typeof this.options.placeholder=="function"?this.options.placeholder({editor:this.editor,node:o,pos:l,hasAnchor:a}):this.options.placeholder});i.push(d)}return this.options.includeChildren}),z.create(r,i)}}})]}});function Mo(r){const t=r.state.doc.toJSON(),n=new Od(r);let i=[];return t.content.forEach(s=>{i.push(n.serialize(s))}),i.join(`
90
- `)}function At(r,e){return r.type===e.type&&JSON.stringify(r.attrs)===JSON.stringify(e.attrs)}class Od{constructor(e){this.editor=e,this.openMarks=[]}serialize(e,t,n){if(e.type==="text"){let l="";if(e.marks&&e.marks.length>0){t!=null&&t.marks&&t.marks.forEach(c=>{if(!e.marks.some(d=>At(d,c))){const d=this.openMarks.pop();At(d,c)||console.error("Serialization mismatch"),l+=`</${c.type}>`}});let a=[];e.marks.forEach(c=>{var d;((d=t==null?void 0:t.marks)==null?void 0:d.some(h=>At(h,c)))||a.push(c)}),a.sort((c,u)=>{var f,p;const d=(f=n==null?void 0:n.marks)!=null&&f.some(m=>At(m,c))?1:0;return((p=n==null?void 0:n.marks)!=null&&p.some(m=>At(m,u))?1:0)-d}),a.forEach(c=>{this.openMarks.push(c);const u=c.type,d=c.attrs?Object.entries(c.attrs).filter(([h,f])=>f!==null).map(([h,f])=>`${h}="${f}"`).join(" "):"";l+=`<${u}${d?" "+d:""}>`}),l+=e.text,n||(this.openMarks.reverse().forEach(c=>{l+=`</${c.type}>`}),this.openMarks=[])}else this.openMarks.reverse().forEach(a=>{l+=`</${a.type}>`}),this.openMarks=[],l+=e.text;return l}const i=e.type,s=e.attrs?Object.entries(e.attrs).filter(([l,a])=>a!==null&&!l.startsWith("_")).map(([l,a])=>l==="id"?`xml:id="${a}"`:`${l}="${a}"`).join(" "):"";let o="";if(e.content)for(let l=0;l<e.content.length;l++){const a=e.content[l],c=l>0?e.content[l-1]:null,u=l<e.content.length-1?e.content[l+1]:null;o+=this.serialize(a,c,u)}return o?`<${i}${s?" "+s:""}>${o}</${i}>`:`<${i}${s?" "+s:""}/>`}closeMarks(){let e="";return this.openMarks.forEach(t=>{const n=t.type;e+=`</${n}>`}),this.openMarks=[],e}}const Nd=xr.create({name:"doc",topNode:!0,content:"block+"}),Ad=xr.create({name:"text",group:"inline"}),vd=Et.create({name:"inline",addOptions(){return{tag:`tei-${this.name}`,shortcuts:{},attributes:{}}},parseHTML(){return[{tag:this.options.tag}]},renderHTML({HTMLAttributes:r}){return this.name==="ref"?[this.options.tag,{...r,role:"link",tabindex:"0",onclick:"window.open(this.getAttribute('target'), '_blank', 'noopener,noreferrer')",onkeypress:"if(event.key === 'Enter') window.open(this.getAttribute('target'), '_blank', 'noopener,noreferrer')",rel:"noopener noreferrer"},0]:[this.options.tag,r,0]},addAttributes(){const r={};return this.options.attributes&&Object.entries(this.options.attributes).forEach(([e,t])=>{r[e]={default:t.default||null,parseHTML:n=>n.getAttribute(e),renderHTML:n=>n[e]?{[e]:n[e]}:{}}}),r},addKeyboardShortcuts(){const r={};return this.options.shortcuts&&Object.entries(this.options.shortcuts).forEach(([e,t])=>{r[e]=()=>this.editor.commands.toggleMark(this.name,t.attributes)}),r},addCommands(){return{[`toggle${this.name.charAt(0).toUpperCase()+this.name.slice(1)}`]:()=>({commands:r,attributes:e})=>r.toggleMark(this.name,e)}}}),vt=xr.create({name:"block",group:"block",content:"inline*",addOptions(){return{tag:`tei-${this.name}`,shortcuts:{},attributes:{}}},parseHTML(){return[{tag:this.options.tag}]},renderHTML({HTMLAttributes:r}){return[this.options.tag,r,0]},addAttributes(){const r={};return this.options.attributes&&Object.entries(this.options.attributes).forEach(([e,t])=>{r[e]={default:t.default||null,parseHTML:n=>n.getAttribute(e),renderHTML:n=>n[e]?{[e]:n[e]}:{}}}),r},addKeyboardShortcuts(){const r={};return this.options.shortcuts&&Object.entries(this.options.shortcuts).forEach(([e,t])=>{t.command?r[e]=()=>this.editor.commands[t.command](this.name,t.attributes):r[e]=()=>this.editor.commands.setNode(this.name,t.attributes)}),r},addCommands(){return{[`wrap${this.name.charAt(0).toUpperCase()+this.name.slice(1)}`]:()=>({commands:e,attributes:t})=>e.wrapIn(this.name,t)}}}),Dd=vt.extend({name:"list",content:"head? item+",group:"block",defining:!0,inline:!1,addCommands(){return{[`toggle${this.name.charAt(0).toUpperCase()+this.name.slice(1)}`]:e=>({commands:t,editor:n})=>{const{state:i}=n,{selection:s}=i,{$from:o}=s;return Nt(o,a=>a.type.name===this.name)?t.liftListItem(this.name):t.wrapInList(this.name,e)},transformToHead:()=>({commands:e,state:t,tr:n})=>{const{selection:i}=t,{$from:s}=i,o=Nt(s,d=>d.type.name==="item");if(!o)return!1;const l=Nt(s,d=>d.type.name==="list");if(!l||!(l.node.firstChild===o.node))return!1;const c=o.node.firstChild;if(!c)return!1;const u=t.schema.nodes.head.create({},c.content);return n.replaceWith(o.pos,o.pos+o.node.nodeSize,u),!0}}},addKeyboardShortcuts(){const r={};return this.options.shortcuts&&Object.entries(this.options.shortcuts).forEach(([e,t])=>{const n=this.name.charAt(0).toUpperCase()+this.name.slice(1);r[e]=()=>this.editor.commands[`toggle${n}`](this.name)}),r}}),Id=vt.extend({name:"item",content:"p block*",group:"item",defining:!1,addKeyboardShortcuts(){return{Enter:()=>{const{state:r}=this.editor,{selection:e}=r,{$from:t}=e,n=t.node();return t.parentOffset===0&&n.content.size===0?this.editor.commands.liftListItem(this.name):this.editor.commands.splitListItem(this.name)},Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name),"Mod-Alt-1":()=>this.editor.commands.transformToHead()}}});function Pd(r){return Object.entries(r||{}).map(([e,t])=>`${e}="${t}"`).join(" ")}const Eo=vt.extend({name:"emptyElement",group:"inline",content:"",inline:!0,addOptions(){return{tag:`tei-${this.name}`,shortcuts:{},attributes:{},label:"Empty Element"}},parseHTML(){return[{tag:this.options.tag}]},addNodeView(){return({node:r})=>{const e=document.createElement(`tei-${this.name}`);return e.classList.add("empty-element"),e.innerHTML=this.options.label,Object.entries(r.attrs).forEach(([t,n])=>{n&&e.setAttribute(t,n)}),e.addEventListener("click",()=>{this.editor.options.element.dispatchEvent(new CustomEvent("empty-element-clicked",{detail:{node:r}}))}),{dom:e,update:t=>{if(t.type!==r.type)return!1;r.attrs=t.attrs;const n=Pd(t.attrs);return n&&e.setAttribute("data-tooltip",n),Object.entries(r.attrs).forEach(([i,s])=>{s?e.setAttribute(i,s):e.removeAttribute(i)}),!0}}}},addKeyboardShortcuts(){const r={};return this.options.shortcuts&&Object.entries(this.options.shortcuts).forEach(([e,t])=>{r[e]=()=>this.editor.commands.insertContent({type:this.name,attrs:t.attributes})}),r}});function To(){const r=Date.now().toString(36),e=Math.random().toString(36).substring(2,8);return`fn-${r}-${e}`}const wr=new Map;function Rd(r){const e=[];return r.nodesBetween(0,r.content.size,(t,n)=>{t.type.name==="anchor"&&e.push({node:t,pos:n})}),e.sort((t,n)=>t.pos-n.pos),wr.clear(),e.forEach((t,n)=>{const i=n+1;wr.set(t.node.attrs.id,i)}),e}function Dt(r){return wr.get(r)||-1}function Bd(r,e){return e.nodesBetween(0,e.content.size,(t,n)=>{if(t.type.name==="note"){const i=t.attrs.target;if(i&&i.startsWith("#")){const s=i.substring(1),o=Dt(s);o>0&&(r=r.setNodeMarkup(n,null,{...t.attrs,_reference:o.toString(),_timestamp:Date.now()}))}}}),r}function zd(r,e,t=null){let n=null;if(e.descendants((c,u)=>{if(c.type.name==="noteGrp")return n=u,!1}),n===null)return r;const i=e.nodeAt(n);if(!i)return r;const s=[];let o=-1;i.content.forEach((c,u)=>{if(c.type.name==="note"){const d=c.attrs.target;if(d&&d.startsWith("#")){const h=d.substring(1),f=Dt(h);s.push({node:c,reference:f,originalIndex:s.length}),t&&d===`#${t}`&&(o=s.length-1)}}}),s.sort((c,u)=>c.reference-u.reference);let l=-1;o!==-1&&(l=s.findIndex(c=>c.originalIndex===o));const a=i.type.create(i.attrs,s.map(c=>c.node));if(r=r.replaceWith(n,n+i.nodeSize,a),l!==-1){let u=n+1;for(let d=0;d<l;d++){const h=r.doc.nodeAt(u);h&&(u+=h.nodeSize)}r=r.setSelection(E.create(r.doc,u+1))}return r}function Ld(r,e){const t=Date.now();return e.nodesBetween(0,e.content.size,(n,i)=>{if(n.type.name==="anchor"){const s=Dt(n.attrs.id),o=`${t}-${i}`;r=r.setNodeMarkup(i,null,{...n.attrs,_timestamp:o,_reference:s})}}),r}const Fd=Eo.extend({name:"anchor",group:"inline",content:"",inline:!0,atom:!0,addAttributes(){const r={id:{isRequired:!0,type:"string",renderHTML(e){return{id:e.id}},parseHTML(e){return e.getAttribute("id")||To()}},_timestamp:{default:null,renderHTML:()=>({})},_reference:{default:null,renderHTML:()=>({})}};return this.options.attributes&&Object.entries(this.options.attributes).forEach(([e,t])=>{r[e]={default:t.default||null,parseHTML:n=>n.getAttribute(e),renderHTML:n=>n[e]?{[e]:n[e]}:{}}}),r},addCommands(){return{addAnchor:r=>({commands:e})=>e.insertContent({type:this.name,attrs:{...r,id:To()}}),gotoNote:r=>({commands:e,editor:t})=>{const n=`tei-note[target="#${r}"]`,i=t.view.dom.querySelector(n);if(i){i.scrollIntoView({behavior:"smooth",block:"center"});const s=this.editor.view.posAtDOM(i,0);return e.setTextSelection(s),!0}return!1}}},addNodeView(){return({node:r,editor:e})=>{const t=document.createElement(`tei-${this.name}`);Object.entries(r.attrs).forEach(([i,s])=>{s&&t.setAttribute(i,s)});const n=Dt(r.attrs.id);return t.textContent=n>0?n.toString():"",t.addEventListener("click",()=>{e.commands.gotoNote(r.attrs.id)}),{dom:t,update:i=>{if(i.type!==r.type)return!1;Object.entries(i.attrs).forEach(([o,l])=>{l?t.setAttribute(o,l):t.removeAttribute(o)});const s=Dt(i.attrs.id);return t.textContent=s>0?s.toString():"",!0}}}}}),$d=q.create({name:"footnoteRules",priority:1e3,addProseMirrorPlugins(){return[new Q({key:new se("footnoteRules"),appendTransaction(r,e,t){let n=t.tr,i=null,s=!1,o=new Set;if(r.some(a=>a.steps.some(c=>c instanceof B?c.from===0&&c.to===e.doc.content.size:!1)))s=!0;else for(let a of r)if(a.docChanged)for(let c of a.steps){if(!(c instanceof B))continue;c.slice.size>0&&c.slice.content.descendants((m,g)=>{if((m==null?void 0:m.type.name)=="anchor")return i=m.attrs.id,s=!0,!1});const d=a.docs[0],h=a.doc,f=new Map,p=new Map;d.descendants((m,g)=>{m.type.name==="anchor"&&f.set(m.attrs.id,g)}),h.descendants((m,g)=>{m.type.name==="anchor"&&p.set(m.attrs.id,g)});for(const[m,g]of f)p.has(m)||(o.add(m),s=!0);(f.size!==p.size||Array.from(f.entries()).some(([m,g])=>p.get(m)!==g))&&(s=!0)}if(o.size>0&&t.doc.descendants((a,c)=>{if(a.type.name==="note"){const u=a.attrs.target;if(u&&u.startsWith("#")){const d=u.substring(1);o.has(d)&&(n=n.delete(c,c+a.nodeSize))}}}),i){let a=!1;if(t.doc.descendants((m,g)=>{if(m.type.name==="note"&&m.attrs.target===`#${i}`)return console.log("note found",m),a=!0,!1}),a)return null;let c=null;t.doc.descendants((m,g)=>{if(m.type.name==="noteGrp")return c=g,!1}),c===null&&(c=t.doc.content.size,n=n.insert(c,t.schema.nodes.noteGrp.create()));const u=n.doc.nodeAt(c);if(!u)return null;const d=t.schema.nodes.note.create({target:`#${i}`,_reference:"1"}),h=c+u.nodeSize-1;n=n.insert(h,d);const f=h;n.doc.nodeAt(f)&&(n=n.setSelection(E.create(n.doc,f+1)))}return s&&(Rd(n.doc),n=Ld(n,n.doc),n=Bd(n,n.doc),n=zd(n,n.doc,i)),n}})]}}),Vd=vt.extend({name:"graphic",content:"",addNodeView(){return({node:r})=>{const e=document.createElement("img");return e.src=r.attrs.url,e.addEventListener("click",()=>{this.editor.options.element.dispatchEvent(new CustomEvent("empty-element-clicked",{detail:{node:r}}))}),{dom:e}}}});function jd(r){const e=[Hd,Ad];return Object.entries(r.schema).forEach(([t,n])=>{let i;switch(n.type){case"inline":i=vd.extend({name:t});break;case"anchor":i=Fd.extend({name:t});break;case"empty":i=Eo.extend({name:t});break;case"list":i=Dd.extend({name:t,content:n.content||"item+"});break;case"listItem":i=Id.extend({name:t,content:n.content||"p block*"});break;case"block":i=vt.extend({name:t,group:n.group||"block",defining:n.defining,isolating:n.isolating,priority:n.priority,inline:n.inline,content:n.content});break;case"graphic":i=Vd.extend({name:t});break}const s={...r.attributes,...n.attributes};e.push(i.configure({shortcuts:n.keyboard,attributes:s,label:n.label}))}),e}const Hd=Nd.extend({content:"block+ noteGrp?"}),Wd=yo({find:/---|–-/,replace:"—"}),Jd=yo({find:/--(?!-)/,replace:"–"}),qd=q.create({name:"inputRules",addInputRules(){return[Wd,Jd]}}),Kd=q.create({name:"jinnTapCommands",addCommands(){return{moveUp:()=>({commands:r,state:e})=>{const{from:t}=e.selection,i=e.doc.resolve(t).node();r.lift(i.type,i.attrs)},insertSnippet:r=>({state:e,dispatch:t})=>{const{from:n,to:i}=e.selection,s=e.doc.textBetween(n,i);let o=r,l=0;if(r.includes("{")){const d=/\{([^}]*)\}/g;let h,f=0,p="";for(;(h=d.exec(r))!==null;){p+=r.slice(f,h.index);const m=l===0&&s||h[1];p+=m,f=h.index+h[0].length,l++}p+=r.slice(f),o=p}const a=Tt(o,e.schema),c=e.tr;c.replaceWith(n,i,a);const u=c.mapping.map(i);return c.doc.nodesBetween(n,u,(d,h)=>{d.type.name==="text"&&d.text!==s&&c.setSelection(e.selection.constructor.create(c.doc,h,h+d.nodeSize))}),t(c),!0},insertFigure:r=>({state:e,commands:t})=>(t.insertContent({type:"figure",attrs:{},content:[{type:"graphic",attrs:{url:"https://placehold.co/320x200"}},{type:"figDesc",content:[{type:"text",text:"Description"}]}]}),!0)}}});function Oo(r,e,t){let n=null;return r.state.doc.nodesBetween(e,t,(i,s,o,l)=>{i.isText&&(n==null?n=i.marks.map(a=>({mark:a,pos:s})):n=n.filter(a=>i.marks.find(c=>c.type.name===a.mark.type.name)))}),n&&(n=n.map(i=>{const s=r.state.doc.resolve(i.pos),o=fr(s,i.mark.type,i.mark.attrs);return i.text=r.state.doc.textBetween(o.from,o.to,""," "),i}),n.sort((i,s)=>{var o,l;return(((o=s.text)==null?void 0:o.length)||0)-(((l=i.text)==null?void 0:l.length)||0)})),n}function Ud(r,e=[]){const t={},n=[];return r.state.doc.nodesBetween(0,r.state.doc.content.size,(i,s)=>{i.isText&&e.forEach(o=>{const l=i.text.indexOf(o);if(l!==-1){const a={pos:s,index:l,length:o.length};n.some(u=>u.pos<=a.pos&&u.pos+u.index+u.length>=a.pos+a.index+a.length)||(t[o]=[...t[o]||[],a],n.push(a))}})}),t}function Gd(r){const t=new DOMParser().parseFromString(r,"application/xml"),n=t.querySelector("parsererror");return n?(console.error("XML Parsing Error:",n.textContent),null):t}function _d(r){if(!r)return"";const e=[],t=r.querySelectorAll("text > body > *"),n=i=>{if(i.nodeType===Node.ELEMENT_NODE){const s=document.createElement(`tei-${i.tagName}`);for(const o of i.attributes)o.name==="xml:id"?s.setAttribute("id",o.value):s.setAttribute(o.name,o.value);for(const o of i.childNodes)s.appendChild(n(o));return s}else return i.cloneNode()};return t.forEach(i=>{const s=n(i);e.push(s.outerHTML)}),e.join("")}function Yd(r){const e=Gd(r);return e.documentElement.namespaceURI==="http://www.tei-c.org/ns/1.0"?_d(e):xml}function Xd(r,e,t,n=3){let i=e-1,s=0;for(;i>=0;){if(/[\p{P}\s]/.test(r.charAt(i))){for(;i>1&&/[\p{P}\s]/.test(r.charAt(i-1));)i-=1;if(s+=1,s===n)break}i-=1}let o=t+1;for(s=0;o<r.length;){if(/[\p{P}\s]/.test(r.charAt(o))){for(;o<r.length-1&&/[\p{P}\s]/.test(r.charAt(o+1));)o+=1;if(s+=1,s===n)break}o+=1}return`&#8230; ${r.substring(i,e)}<mark>${r.substring(e,t)}</mark>${r.substring(t,o+1)} &#8230;`}class Zd{constructor(e,t){this.editor=e.tiptap,this.schemaDef=t,this.panel=e.querySelector(".attribute-panel"),this.currentElement=null,this.currentMark=null,this.setupEventListeners(),this.overlay=document.createElement("div"),this.overlay.className="jinn-tap overlay",this.overlay.style.display="block",this.overlay.style.position="fixed",this.overlay.style.pointerEvents="none",this.overlay.style.zIndex="1000",this.overlay.style.display="none"}setupEventListeners(){this.editor.on("selectionUpdate",({editor:e})=>{this.updatePanelForCurrentPosition(e)}),this.editor.on("update",({editor:e})=>{this.updatePanelForCurrentPosition(e)}),this.editor.options.element.addEventListener("empty-element-clicked",({detail:e})=>{this.showNodeAttributes(e.node)})}updatePanelForCurrentPosition(e){var l;const{from:t,to:n}=e.state.selection,i=Oo(e,t,n);if(i&&i.length>0){this.currentElement=null;const a=i[i.length-1];((l=this.currentMark)==null?void 0:l.mark)!=a.mark&&this.showMarkAttributes(a.mark,a.text),this.currentMark=a;return}const o=e.state.doc.resolve(t).node();if(this.currentMark=null,o&&Object.keys(this.schemaDef.schema).includes(o.type.name)){if(this.currentElement==o)return;this.currentElement=o,this.currentAttributes={...o.attrs},this.showNodeAttributes(o)}else this.currentElement=null,this.currentAttributes={},this.hidePanel()}showMarkAttributes(e,t){this.updatePanel(e,t)}showNodeAttributes(e){this.updatePanel(e)}hidePanel(){this.updatePanel()}createAttributeInput(e,t,n,i,s=""){const o=document.createElement("label");o.textContent=t;let l;if(n.enum)if(n.open){l=document.createElement("input"),l.type="text",l.setAttribute("list",`${t}-list`);const a=document.createElement("datalist");a.id=`${t}-list`,n.enum.forEach(c=>{const u=document.createElement("option");u.value=c,a.appendChild(u)}),e.appendChild(a)}else l=document.createElement("select"),n.enum.forEach(a=>{const c=document.createElement("option");c.value=a,c.textContent=a,l.appendChild(c)});else l=document.createElement("input"),l.type="text";return l.placeholder=s,l.value=i||n.default||"",l.name=t,o.appendChild(l),e.appendChild(o),l}updatePanel(e,t){if(!this.panel)return;if(this.panel.innerHTML="",!e){this.panel.innerHTML="<p>Select text or a node to edit attributes</p>";return}const n=this.schemaDef.schema[e.type.name];if(!n){this.panel.innerHTML="";return}const i=document.createElement("h4");i.textContent=e.type.name,this.panel.appendChild(i);const s=document.createElement("div");this.panel.appendChild(s);const o=document.createElement("form");this.panel.appendChild(o);const l={...this.schemaDef.attributes,...n.attributes};if(Object.entries(l).forEach(([a,c])=>{if(!a.startsWith("_"))if(c.connector){const u=this.createAttributeInput(o,a,c,e.attrs[a],"No reference assigned");u.readOnly=!0;const d=document.createElement("details");d.open=!e.attrs[a];const h=document.createElement("summary");h.textContent="Lookup",d.appendChild(h);const f=document.createElement("pb-authority-lookup");f.setAttribute("type",c.connector.type),f.setAttribute("query",t),f.setAttribute("auto",e.attrs[a]?"true":"false"),f.setAttribute("no-occurrences",!0);const p=document.createElement("pb-authority");if(p.setAttribute("connector",c.connector.name),p.setAttribute("name",c.connector.type),c.connector.user&&p.setAttribute("user",c.connector.user),f.appendChild(p),document.addEventListener("pb-authority-select",m=>{const g=`${c.connector.prefix}-${m.detail.properties.ref}`;u.value=g,d.open=!1,this.handleAttributeUpdate(e,{[a]:g})}),d.appendChild(f),o.appendChild(d),e.attrs[a]){const m=e.attrs[a].substring(e.attrs[a].indexOf("-")+1);f.lookup(c.connector.type,m,s).then(g=>{const y=g.strings;y.sort((S,w)=>w.length-S.length),y.unshift(t),this.updateOccurrences(this.editor,e,y)})}}else this.createAttributeInput(o,a,c,e.attrs[a])}),Object.keys(l).length>0&&!(Object.keys(l).length===1&&l[Object.keys(l)[0]].connector)){const a=document.createElement("button");a.dataset.tooltip="Apply Changes",a.type="submit",a.innerHTML=`
90
+ `)}function At(r,e){return r.type===e.type&&JSON.stringify(r.attrs)===JSON.stringify(e.attrs)}class Od{constructor(e){this.editor=e,this.openMarks=[]}serialize(e,t,n){if(e.type==="text"){let l="";if(e.marks&&e.marks.length>0){t!=null&&t.marks&&t.marks.forEach(c=>{if(!e.marks.some(d=>At(d,c))){const d=this.openMarks.pop();At(d,c)||console.error("Serialization mismatch"),l+=`</${c.type}>`}});let a=[];e.marks.forEach(c=>{var d;((d=t==null?void 0:t.marks)==null?void 0:d.some(h=>At(h,c)))||a.push(c)}),a.sort((c,u)=>{var f,p;const d=(f=n==null?void 0:n.marks)!=null&&f.some(m=>At(m,c))?1:0;return((p=n==null?void 0:n.marks)!=null&&p.some(m=>At(m,u))?1:0)-d}),a.forEach(c=>{this.openMarks.push(c);const u=c.type,d=c.attrs?Object.entries(c.attrs).filter(([h,f])=>f!==null).map(([h,f])=>`${h}="${f}"`).join(" "):"";l+=`<${u}${d?" "+d:""}>`}),l+=e.text,n||(this.openMarks.reverse().forEach(c=>{l+=`</${c.type}>`}),this.openMarks=[])}else this.openMarks.reverse().forEach(a=>{l+=`</${a.type}>`}),this.openMarks=[],l+=e.text;return l}const i=e.type,s=e.attrs?Object.entries(e.attrs).filter(([l,a])=>a!==null&&!l.startsWith("_")).map(([l,a])=>l==="id"?`xml:id="${a}"`:`${l}="${a}"`).join(" "):"";let o="";if(e.content)for(let l=0;l<e.content.length;l++){const a=e.content[l],c=l>0?e.content[l-1]:null,u=l<e.content.length-1?e.content[l+1]:null;o+=this.serialize(a,c,u)}return o?`<${i}${s?" "+s:""}>${o}</${i}>`:`<${i}${s?" "+s:""}/>`}closeMarks(){let e="";return this.openMarks.forEach(t=>{const n=t.type;e+=`</${n}>`}),this.openMarks=[],e}}const Nd=xr.create({name:"doc",topNode:!0,content:"block+"}),Ad=xr.create({name:"text",group:"inline"}),vd=Et.create({name:"inline",addOptions(){return{tag:`tei-${this.name}`,shortcuts:{},attributes:{}}},parseHTML(){return[{tag:this.options.tag}]},renderHTML({HTMLAttributes:r}){return this.name==="ref"?[this.options.tag,{...r,role:"link",tabindex:"0",onclick:"window.open(this.getAttribute('target'), '_blank', 'noopener,noreferrer')",onkeypress:"if(event.key === 'Enter') window.open(this.getAttribute('target'), '_blank', 'noopener,noreferrer')",rel:"noopener noreferrer"},0]:[this.options.tag,r,0]},addAttributes(){const r={};return this.options.attributes&&Object.entries(this.options.attributes).forEach(([e,t])=>{r[e]={default:t.default||null,parseHTML:n=>n.getAttribute(e),renderHTML:n=>n[e]?{[e]:n[e]}:{}}}),r},addKeyboardShortcuts(){const r={};return this.options.shortcuts&&Object.entries(this.options.shortcuts).forEach(([e,t])=>{r[e]=()=>this.editor.commands.toggleMark(this.name,t.attributes)}),r},addCommands(){return{[`toggle${this.name.charAt(0).toUpperCase()+this.name.slice(1)}`]:()=>({commands:r,attributes:e})=>r.toggleMark(this.name,e)}}}),vt=xr.create({name:"block",group:"block",content:"inline*",addOptions(){return{tag:`tei-${this.name}`,shortcuts:{},attributes:{}}},parseHTML(){return[{tag:this.options.tag}]},renderHTML({HTMLAttributes:r}){return[this.options.tag,r,0]},addAttributes(){const r={};return this.options.attributes&&Object.entries(this.options.attributes).forEach(([e,t])=>{r[e]={default:t.default||null,parseHTML:n=>n.getAttribute(e),renderHTML:n=>n[e]?{[e]:n[e]}:{}}}),r},addKeyboardShortcuts(){const r={};return this.options.shortcuts&&Object.entries(this.options.shortcuts).forEach(([e,t])=>{t.command?r[e]=()=>this.editor.commands[t.command](this.name,t.attributes):r[e]=()=>this.editor.commands.setNode(this.name,t.attributes)}),r},addCommands(){return{[`wrap${this.name.charAt(0).toUpperCase()+this.name.slice(1)}`]:()=>({commands:e,attributes:t})=>e.wrapIn(this.name,t)}}}),Dd=vt.extend({name:"list",content:"head? item+",group:"block",defining:!0,inline:!1,addCommands(){return{[`toggle${this.name.charAt(0).toUpperCase()+this.name.slice(1)}`]:e=>({commands:t,editor:n})=>{const{state:i}=n,{selection:s}=i,{$from:o}=s;return Nt(o,a=>a.type.name===this.name)?t.liftListItem(this.name):t.wrapInList(this.name,e)},transformToHead:()=>({commands:e,state:t,tr:n})=>{const{selection:i}=t,{$from:s}=i,o=Nt(s,d=>d.type.name==="item");if(!o)return!1;const l=Nt(s,d=>d.type.name==="list");if(!l||!(l.node.firstChild===o.node))return!1;const c=o.node.firstChild;if(!c)return!1;const u=t.schema.nodes.head.create({},c.content);return n.replaceWith(o.pos,o.pos+o.node.nodeSize,u),!0}}},addKeyboardShortcuts(){const r={};return this.options.shortcuts&&Object.entries(this.options.shortcuts).forEach(([e,t])=>{const n=this.name.charAt(0).toUpperCase()+this.name.slice(1);r[e]=()=>this.editor.commands[`toggle${n}`](this.name)}),r}}),Id=vt.extend({name:"item",content:"p block*",group:"item",defining:!1,addKeyboardShortcuts(){return{Enter:()=>{const{state:r}=this.editor,{selection:e}=r,{$from:t}=e,n=t.node();return t.parentOffset===0&&n.content.size===0?this.editor.commands.liftListItem(this.name):this.editor.commands.splitListItem(this.name)},Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name),"Mod-Alt-1":()=>this.editor.commands.transformToHead()}}});function Pd(r){return Object.entries(r||{}).map(([e,t])=>`${e}="${t}"`).join(" ")}const Eo=vt.extend({name:"emptyElement",group:"inline",content:"",inline:!0,addOptions(){return{tag:`tei-${this.name}`,shortcuts:{},attributes:{},label:"Empty Element"}},parseHTML(){return[{tag:this.options.tag}]},addNodeView(){return({node:r})=>{const e=document.createElement(`tei-${this.name}`);return e.classList.add("empty-element"),e.innerHTML=this.options.label,Object.entries(r.attrs).forEach(([t,n])=>{n&&e.setAttribute(t,n)}),e.addEventListener("click",()=>{const t=this.editor.view.posAtDOM(e);this.editor.options.element.dispatchEvent(new CustomEvent("empty-element-clicked",{detail:{node:r,pos:t}}))}),{dom:e,update:t=>{if(t.type!==r.type)return!1;r.attrs=t.attrs;const n=Pd(t.attrs);return n&&e.setAttribute("data-tooltip",n),Object.entries(r.attrs).forEach(([i,s])=>{s?e.setAttribute(i,s):e.removeAttribute(i)}),!0}}}},addKeyboardShortcuts(){const r={};return this.options.shortcuts&&Object.entries(this.options.shortcuts).forEach(([e,t])=>{r[e]=()=>this.editor.commands.insertContent({type:this.name,attrs:t.attributes})}),r}});function To(){const r=Date.now().toString(36),e=Math.random().toString(36).substring(2,8);return`fn-${r}-${e}`}const wr=new Map;function Rd(r){const e=[];return r.nodesBetween(0,r.content.size,(t,n)=>{t.type.name==="anchor"&&e.push({node:t,pos:n})}),e.sort((t,n)=>t.pos-n.pos),wr.clear(),e.forEach((t,n)=>{const i=n+1;wr.set(t.node.attrs.id,i)}),e}function Dt(r){return wr.get(r)||-1}function Bd(r,e){return e.nodesBetween(0,e.content.size,(t,n)=>{if(t.type.name==="note"){const i=t.attrs.target;if(i&&i.startsWith("#")){const s=i.substring(1),o=Dt(s);o>0&&(r=r.setNodeMarkup(n,null,{...t.attrs,_reference:o.toString(),_timestamp:Date.now()}))}}}),r}function zd(r,e,t=null){let n=null;if(e.descendants((c,u)=>{if(c.type.name==="noteGrp")return n=u,!1}),n===null)return r;const i=e.nodeAt(n);if(!i)return r;const s=[];let o=-1;i.content.forEach((c,u)=>{if(c.type.name==="note"){const d=c.attrs.target;if(d&&d.startsWith("#")){const h=d.substring(1),f=Dt(h);s.push({node:c,reference:f,originalIndex:s.length}),t&&d===`#${t}`&&(o=s.length-1)}}}),s.sort((c,u)=>c.reference-u.reference);let l=-1;o!==-1&&(l=s.findIndex(c=>c.originalIndex===o));const a=i.type.create(i.attrs,s.map(c=>c.node));if(r=r.replaceWith(n,n+i.nodeSize,a),l!==-1){let u=n+1;for(let d=0;d<l;d++){const h=r.doc.nodeAt(u);h&&(u+=h.nodeSize)}r=r.setSelection(E.create(r.doc,u+1))}return r}function Ld(r,e){const t=Date.now();return e.nodesBetween(0,e.content.size,(n,i)=>{if(n.type.name==="anchor"){const s=Dt(n.attrs.id),o=`${t}-${i}`;r=r.setNodeMarkup(i,null,{...n.attrs,_timestamp:o,_reference:s})}}),r}const Fd=Eo.extend({name:"anchor",group:"inline",content:"",inline:!0,atom:!0,addAttributes(){const r={id:{isRequired:!0,type:"string",renderHTML(e){return{id:e.id}},parseHTML(e){return e.getAttribute("id")||To()}},_timestamp:{default:null,renderHTML:()=>({})},_reference:{default:null,renderHTML:()=>({})}};return this.options.attributes&&Object.entries(this.options.attributes).forEach(([e,t])=>{r[e]={default:t.default||null,parseHTML:n=>n.getAttribute(e),renderHTML:n=>n[e]?{[e]:n[e]}:{}}}),r},addCommands(){return{addAnchor:r=>({commands:e})=>e.insertContent({type:this.name,attrs:{...r,id:To()}}),gotoNote:r=>({commands:e,editor:t})=>{const n=`tei-note[target="#${r}"]`,i=t.view.dom.querySelector(n);if(i){i.scrollIntoView({behavior:"smooth",block:"center"});const s=this.editor.view.posAtDOM(i,0);return e.setTextSelection(s),!0}return!1}}},addNodeView(){return({node:r,editor:e})=>{const t=document.createElement(`tei-${this.name}`);Object.entries(r.attrs).forEach(([i,s])=>{s&&t.setAttribute(i,s)});const n=Dt(r.attrs.id);return t.textContent=n>0?n.toString():"",t.addEventListener("click",()=>{e.commands.gotoNote(r.attrs.id)}),{dom:t,update:i=>{if(i.type!==r.type)return!1;Object.entries(i.attrs).forEach(([o,l])=>{l?t.setAttribute(o,l):t.removeAttribute(o)});const s=Dt(i.attrs.id);return t.textContent=s>0?s.toString():"",!0}}}}}),$d=q.create({name:"footnoteRules",priority:1e3,addProseMirrorPlugins(){return[new Q({key:new se("footnoteRules"),appendTransaction(r,e,t){let n=t.tr,i=null,s=!1,o=new Set;if(r.some(a=>a.steps.some(c=>c instanceof B?c.from===0&&c.to===e.doc.content.size:!1)))s=!0;else for(let a of r)if(a.docChanged)for(let c of a.steps){if(!(c instanceof B))continue;c.slice.size>0&&c.slice.content.descendants((m,g)=>{if((m==null?void 0:m.type.name)=="anchor")return i=m.attrs.id,s=!0,!1});const d=a.docs[0],h=a.doc,f=new Map,p=new Map;d.descendants((m,g)=>{m.type.name==="anchor"&&f.set(m.attrs.id,g)}),h.descendants((m,g)=>{m.type.name==="anchor"&&p.set(m.attrs.id,g)});for(const[m,g]of f)p.has(m)||(o.add(m),s=!0);(f.size!==p.size||Array.from(f.entries()).some(([m,g])=>p.get(m)!==g))&&(s=!0)}if(o.size>0&&t.doc.descendants((a,c)=>{if(a.type.name==="note"){const u=a.attrs.target;if(u&&u.startsWith("#")){const d=u.substring(1);o.has(d)&&(n=n.delete(c,c+a.nodeSize))}}}),i){let a=!1;if(t.doc.descendants((m,g)=>{if(m.type.name==="note"&&m.attrs.target===`#${i}`)return console.log("note found",m),a=!0,!1}),a)return null;let c=null;t.doc.descendants((m,g)=>{if(m.type.name==="noteGrp")return c=g,!1}),c===null&&(c=t.doc.content.size,n=n.insert(c,t.schema.nodes.noteGrp.create()));const u=n.doc.nodeAt(c);if(!u)return null;const d=t.schema.nodes.note.create({target:`#${i}`,_reference:"1"}),h=c+u.nodeSize-1;n=n.insert(h,d);const f=h;n.doc.nodeAt(f)&&(n=n.setSelection(E.create(n.doc,f+1)))}return s&&(Rd(n.doc),n=Ld(n,n.doc),n=Bd(n,n.doc),n=zd(n,n.doc,i)),n}})]}}),Vd=vt.extend({name:"graphic",content:"",selectable:!0,addNodeView(){return({node:r})=>{const e=document.createElement("img");return e.src=r.attrs.url,e.addEventListener("click",()=>{const t=this.editor.view.posAtDOM(e);this.editor.options.element.dispatchEvent(new CustomEvent("empty-element-clicked",{detail:{node:r,pos:t}}))}),{dom:e}}}});function jd(r){const e=[Hd,Ad];return Object.entries(r.schema).forEach(([t,n])=>{let i;switch(n.type){case"inline":i=vd.extend({name:t});break;case"anchor":i=Fd.extend({name:t});break;case"empty":i=Eo.extend({name:t});break;case"list":i=Dd.extend({name:t,content:n.content||"item+"});break;case"listItem":i=Id.extend({name:t,content:n.content||"p block*"});break;case"block":i=vt.extend({name:t,group:n.group||"block",defining:n.defining,isolating:n.isolating,priority:n.priority,inline:n.inline,content:n.content});break;case"graphic":i=Vd.extend({name:t});break}const s={...r.attributes,...n.attributes};e.push(i.configure({shortcuts:n.keyboard,attributes:s,label:n.label}))}),e}const Hd=Nd.extend({content:"block+ noteGrp?"}),Wd=yo({find:/---|–-/,replace:"—"}),Jd=yo({find:/--(?!-)/,replace:"–"}),qd=q.create({name:"inputRules",addInputRules(){return[Wd,Jd]}}),Kd=q.create({name:"jinnTapCommands",addCommands(){return{moveUp:()=>({commands:r,state:e})=>{const{from:t}=e.selection,i=e.doc.resolve(t).node();r.lift(i.type,i.attrs)},insertSnippet:r=>({state:e,dispatch:t})=>{const{from:n,to:i}=e.selection,s=e.doc.textBetween(n,i);let o=r,l=0;if(r.includes("{")){const d=/\{([^}]*)\}/g;let h,f=0,p="";for(;(h=d.exec(r))!==null;){p+=r.slice(f,h.index);const m=l===0&&s||h[1];p+=m,f=h.index+h[0].length,l++}p+=r.slice(f),o=p}const a=Tt(o,e.schema),c=e.tr;c.replaceWith(n,i,a);const u=c.mapping.map(i);return c.doc.nodesBetween(n,u,(d,h)=>{d.type.name==="text"&&d.text!==s&&c.setSelection(e.selection.constructor.create(c.doc,h,h+d.nodeSize))}),t(c),!0},insertFigure:r=>({state:e,commands:t})=>(t.insertContent({type:"figure",attrs:{},content:[{type:"graphic",attrs:{url:"https://placehold.co/320x200"}},{type:"figDesc",content:[{type:"text",text:"Description"}]}]}),!0)}}});function Oo(r,e,t){let n=null;return r.state.doc.nodesBetween(e,t,(i,s,o,l)=>{i.isText&&(n==null?n=i.marks.map(a=>({mark:a,pos:s})):n=n.filter(a=>i.marks.find(c=>c.type.name===a.mark.type.name)))}),n&&(n=n.map(i=>{const s=r.state.doc.resolve(i.pos),o=fr(s,i.mark.type,i.mark.attrs);return i.text=r.state.doc.textBetween(o.from,o.to,""," "),i}),n.sort((i,s)=>{var o,l;return(((o=s.text)==null?void 0:o.length)||0)-(((l=i.text)==null?void 0:l.length)||0)})),n}function Ud(r,e=[]){const t={},n=[];return r.state.doc.nodesBetween(0,r.state.doc.content.size,(i,s)=>{i.isText&&e.forEach(o=>{const l=i.text.indexOf(o);if(l!==-1){const a={pos:s,index:l,length:o.length};n.some(u=>u.pos<=a.pos&&u.pos+u.index+u.length>=a.pos+a.index+a.length)||(t[o]=[...t[o]||[],a],n.push(a))}})}),t}function Gd(r){const t=new DOMParser().parseFromString(r,"application/xml"),n=t.querySelector("parsererror");return n?(console.error("XML Parsing Error:",n.textContent),null):t}function _d(r){if(!r)return"";const e=[],t=r.querySelectorAll("text > body > *"),n=i=>{if(i.nodeType===Node.ELEMENT_NODE){const s=document.createElement(`tei-${i.tagName}`);for(const o of i.attributes)o.name==="xml:id"?s.setAttribute("id",o.value):s.setAttribute(o.name,o.value);for(const o of i.childNodes)s.appendChild(n(o));return s}else return i.cloneNode()};return t.forEach(i=>{const s=n(i);e.push(s.outerHTML)}),e.join("")}function Yd(r){const e=Gd(r);return e.documentElement.namespaceURI==="http://www.tei-c.org/ns/1.0"?_d(e):xml}function Xd(r,e,t,n=3){let i=e-1,s=0;for(;i>=0;){if(/[\p{P}\s]/.test(r.charAt(i))){for(;i>1&&/[\p{P}\s]/.test(r.charAt(i-1));)i-=1;if(s+=1,s===n)break}i-=1}let o=t+1;for(s=0;o<r.length;){if(/[\p{P}\s]/.test(r.charAt(o))){for(;o<r.length-1&&/[\p{P}\s]/.test(r.charAt(o+1));)o+=1;if(s+=1,s===n)break}o+=1}return`&#8230; ${r.substring(i,e)}<mark>${r.substring(e,t)}</mark>${r.substring(t,o+1)} &#8230;`}class Zd{constructor(e,t){this.editor=e.tiptap,this.schemaDef=t,this.panel=e.querySelector(".attribute-panel"),this.currentElement=null,this.currentMark=null,this.setupEventListeners(),this.overlay=document.createElement("div"),this.overlay.className="jinn-tap overlay",this.overlay.style.display="block",this.overlay.style.position="fixed",this.overlay.style.pointerEvents="none",this.overlay.style.zIndex="1000",this.overlay.style.display="none"}setupEventListeners(){this.editor.on("selectionUpdate",({editor:e})=>{this.updatePanelForCurrentPosition(e)}),this.editor.on("update",({editor:e})=>{this.updatePanelForCurrentPosition(e)}),this.editor.options.element.addEventListener("empty-element-clicked",({detail:e})=>{const{node:t,pos:n}=e;this.editor.chain().focus().setNodeSelection(n).run(),this.showNodeAttributes(t)})}updatePanelForCurrentPosition(e){var l;const{from:t,to:n}=e.state.selection,i=Oo(e,t,n);if(i&&i.length>0){this.currentElement=null;const a=i[i.length-1];((l=this.currentMark)==null?void 0:l.mark)!=a.mark&&this.showMarkAttributes(a.mark,a.text),this.currentMark=a;return}const o=e.state.doc.resolve(t).node();if(this.currentMark=null,o&&Object.keys(this.schemaDef.schema).includes(o.type.name)){if(this.currentElement==o)return;this.currentElement=o,this.currentAttributes={...o.attrs},this.showNodeAttributes(o)}else this.currentElement=null,this.currentAttributes={},this.hidePanel()}showMarkAttributes(e,t){this.updatePanel(e,t)}showNodeAttributes(e){this.updatePanel(e)}hidePanel(){this.updatePanel()}createAttributeInput(e,t,n,i,s=""){const o=document.createElement("label");o.textContent=t;let l;if(n.enum)if(n.open){l=document.createElement("input"),l.type="text",l.setAttribute("list",`${t}-list`);const a=document.createElement("datalist");a.id=`${t}-list`,n.enum.forEach(c=>{const u=document.createElement("option");u.value=c,a.appendChild(u)}),e.appendChild(a)}else l=document.createElement("select"),n.enum.forEach(a=>{const c=document.createElement("option");c.value=a,c.textContent=a,l.appendChild(c)});else l=document.createElement("input"),l.type="text";return l.placeholder=s,l.value=i||n.default||"",l.name=t,o.appendChild(l),e.appendChild(o),l}updatePanel(e,t){if(!this.panel)return;if(this.panel.innerHTML="",!e){this.panel.innerHTML="<p>Select text or a node to edit attributes</p>";return}const n=this.schemaDef.schema[e.type.name];if(!n){this.panel.innerHTML="";return}const i=document.createElement("h4");i.textContent=e.type.name,this.panel.appendChild(i);const s=document.createElement("div");this.panel.appendChild(s);const o=document.createElement("form");this.panel.appendChild(o);const l={...this.schemaDef.attributes,...n.attributes};if(Object.entries(l).forEach(([a,c])=>{if(!a.startsWith("_"))if(c.connector){const u=this.createAttributeInput(o,a,c,e.attrs[a],"No reference assigned");u.readOnly=!0;const d=document.createElement("details");d.open=!e.attrs[a];const h=document.createElement("summary");h.textContent="Lookup",d.appendChild(h);const f=document.createElement("pb-authority-lookup");f.setAttribute("type",c.connector.type),f.setAttribute("query",t),f.setAttribute("auto",e.attrs[a]?"true":"false"),f.setAttribute("no-occurrences",!0);const p=document.createElement("pb-authority");if(p.setAttribute("connector",c.connector.name),p.setAttribute("name",c.connector.type),c.connector.user&&p.setAttribute("user",c.connector.user),f.appendChild(p),document.addEventListener("pb-authority-select",m=>{const g=`${c.connector.prefix}-${m.detail.properties.ref}`;u.value=g,d.open=!1,this.handleAttributeUpdate(e,{[a]:g})}),d.appendChild(f),o.appendChild(d),e.attrs[a]){const m=e.attrs[a].substring(e.attrs[a].indexOf("-")+1);f.lookup(c.connector.type,m,s).then(g=>{const y=g.strings;y.sort((S,w)=>w.length-S.length),y.unshift(t),this.updateOccurrences(this.editor,e,y)})}}else this.createAttributeInput(o,a,c,e.attrs[a])}),Object.keys(l).length>0&&!(Object.keys(l).length===1&&l[Object.keys(l)[0]].connector)){const a=document.createElement("button");a.dataset.tooltip="Apply Changes",a.type="submit",a.innerHTML=`
91
91
  <svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="currentColor" class="bi bi-check2-circle" viewBox="0 0 16 16">
92
92
  <path d="M2.5 8a5.5 5.5 0 0 1 8.25-4.764.5.5 0 0 0 .5-.866A6.5 6.5 0 1 0 14.5 8a.5.5 0 0 0-1 0 5.5 5.5 0 1 1-11 0"/>
93
93
  <path d="M15.354 3.354a.5.5 0 0 0-.708-.708L8 9.293 5.354 6.646a.5.5 0 1 0-.708.708l3 3a.5.5 0 0 0 .708 0z"/>
@@ -113,7 +113,7 @@ img.ProseMirror-separator {
113
113
 
114
114
  ${n.join(`
115
115
  `)}
116
- `}const No={attributes:{rend:{type:"string"},id:{type:"string"}},toolbar:{"Move Up":{command:"moveUp",label:"<i class='bi bi-unindent'></i>"},"choice/abbr/expan":{command:"insertSnippet",args:["<tei-choice><tei-abbr>{abbrev}</tei-abbr><tei-expan>{expansion}</tei-expan></tei-choice>"],select:"Textcritical",label:"<i class='bi bi-three-dots'></i>"},"figure/graphic":{command:"insertFigure",label:"<i class='bi bi-images'></i>",select:"Blocks"}},selects:{Blocks:{label:"<i class='bi bi-text-paragraph'></i>",order:0},Textcritical:{label:"<i class='bi bi-highlighter'></i>",order:9}},schema:{div:{type:"block",defining:!0,content:"heading* block*",attributes:{type:{type:"string"},n:{type:"string"}},keyboard:{"Mod-Shift-e":{attributes:{},command:"wrapDiv"}},toolbar:{Division:{select:"Blocks",attributes:{},command:"wrapDiv",label:"<i class='bi bi-body-text'></i>"}}},hi:{type:"inline",attributes:{rend:{type:"string",default:"i",enum:["i","b","u","code"]}},keyboard:{"Cmd-b":{attributes:{rend:"b"}},"Cmd-i":{attributes:{rend:"i"}},"Cmd-u":{attributes:{rend:"u"}}},toolbar:{Bold:{attributes:{rend:"b"},label:"<i class='bi bi-type-bold'></i>",order:1},Italic:{attributes:{rend:"i"},label:"<i class='bi bi-type-italic'></i>",order:1},Underline:{attributes:{rend:"u"},label:"<i class='bi bi-type-underline'></i>",order:1}}},ref:{type:"inline",attributes:{target:{type:"string"}},keyboard:{"Alt-Shift-r":{attributes:{}}},toolbar:{Reference:{attributes:{},label:"<i class='bi bi-link'></i>",order:2}}},title:{type:"inline",attributes:{level:{type:"string",enum:["m","s","a"]}},keyboard:{"Mod-Alt-t":{attributes:{level:"m"}}},toolbar:{Title:{attributes:{level:"m"},label:"<i class='bi bi-quote'></i>",select:"Textcritical",order:2}}},figure:{type:"block",content:"(graphic|figDesc)*"},figDesc:{type:"block",content:"inline*"},graphic:{type:"graphic",attributes:{url:{type:"string",default:"https://placehold.co/320x200"}},toolbar:{Graphic:{label:"<i class='bi bi-image'></i>",select:"Blocks"}}},persName:{type:"inline",attributes:{key:{connector:{name:"GND",type:"person",prefix:"gnd"},type:"string"}},keyboard:{"Mod-Shift-p":{attributes:{}}},toolbar:{Person:{attributes:{},label:"<i class='bi bi-person'></i>",order:11}}},orgName:{type:"inline",attributes:{key:{connector:{name:"GND",type:"organization",prefix:"gnd"},type:"string"}},toolbar:{Organization:{attributes:{},label:"<i class='bi bi-people'></i>",order:11}}},placeName:{type:"inline",attributes:{key:{type:"string",connector:{name:"GeoNames",type:"place",prefix:"geo",user:"existdb"}}},keyboard:{"Mod-Shift-h":{attributes:{}}},toolbar:{Place:{attributes:{},label:"<i class='bi bi-geo-alt'></i>",order:11}}},term:{type:"inline",attributes:{key:{type:"string",connector:{name:"GND",type:"term",prefix:"gnd"}}},keyboard:{"Mod-Shift-t":{attributes:{}}},toolbar:{Term:{attributes:{},label:"<i class='bi bi-bookmark'></i>",order:11}}},date:{type:"inline",attributes:{when:{type:"string"},"not-before":{type:"string"},"not-after":{type:"string"},from:{type:"string"},to:{type:"string"}},toolbar:{Date:{attributes:{},label:"<i class='bi bi-calendar-date'></i>",order:12}}},p:{type:"block",priority:100,toolbar:{Paragraph:{select:"Blocks",attributes:{},label:"<i class='bi bi-paragraph'></i>"}}},head:{type:"block",group:"heading",attributes:{type:{type:"string"},n:{type:"string"}},keyboard:{"Shift-Mod-1":{attributes:{n:"1"}}},toolbar:{Head:{select:"Blocks",attributes:{},label:"<i class='bi bi-type-h1'></i>"}}},item:{type:"listItem"},list:{type:"list",content:"heading* item+",attributes:{rend:{type:"string",enum:["ordered","unordered"],open:!0}},keyboard:{"Mod-Shift-l":{attributes:{}}},toolbar:{List:{select:"Blocks",attributes:{rend:"unordered"},label:"<i class='bi bi-list-ul'></i>"},"Numbered list":{select:"Blocks",attributes:{rend:"ordered"},label:"<i class='bi bi-list-ol'></i>"}}},opener:{type:"block",content:"block*",toolbar:{Opener:{select:"Blocks",attributes:{},label:"<i class='bi bi-envelope-open'></i>"}}},closer:{type:"block",content:"block*",toolbar:{Closer:{select:"Blocks",attributes:{},label:"<i class='bi bi-envelope'></i>"}}},noteGrp:{type:"list",group:"",defining:!0,content:"note+",keyboard:{"Mod-Shift-u":{attributes:{}}}},note:{type:"listItem",content:"inline*",defining:!0,isolating:!0,attributes:{target:{type:"string"},_reference:{type:"string"}}},anchor:{type:"anchor",attributes:{type:{type:"string",default:"note"}},toolbar:{Footnote:{attributes:{type:"note"},label:"<i class='bi bi-123'></i>",order:2}}},choice:{type:"inline",content:"abbr expan",toolbar:{Choice:{select:"Textcritical",label:"<i class='bi bi-alt'></i>"}}},abbr:{type:"inline",toolbar:{Abbreviation:{select:"Textcritical",label:"<i class='bi bi-three-dots'></i>"}}},expan:{type:"inline",toolbar:{Expansion:{select:"Textcritical",label:"<i class='bi bi-arrows-expand-vertical'></i>"}}},gap:{type:"empty",label:"[...]",attributes:{unit:{type:"string",default:"chars",enum:["chars","lines","words"]},quantity:{type:"string"}},toolbar:{Gap:{select:"Textcritical",label:"<i class='bi bi-braces-asterisk'></i>"}}},unclear:{type:"inline",attributes:{rend:{type:"string",default:"unclear"}},toolbar:{Unclear:{select:"Textcritical",label:"<i class='bi bi-patch-question'></i>"}}},supplied:{type:"inline",attributes:{reason:{type:"string"}},toolbar:{Supplied:{select:"Textcritical",label:"<i class='bi bi-plus-circle-dotted'></i>"}}},pb:{type:"empty",label:"pb",attributes:{n:{type:"string"}},keyboard:{"Mod-Alt-p":{attributes:{n:"22"}}},toolbar:{PageBreak:{attributes:{n:"22"},label:"<i class='bi bi-file-earmark-break'></i>",order:3}}},lb:{type:"empty",label:"&#x21B5;",attributes:{n:{type:"string"}},toolbar:{LineBreak:{attributes:{},label:"<i class='bi bi-arrow-return-left'></i>",order:3}}}}},Mr=document.createElement("style");Mr.textContent=`
116
+ `}const No={attributes:{rend:{type:"string"},id:{type:"string"}},toolbar:{"Move Up":{command:"moveUp",label:"<i class='bi bi-unindent'></i>"},"choice/abbr/expan":{command:"insertSnippet",args:["<tei-choice><tei-abbr>{abbrev}</tei-abbr><tei-expan>{expansion}</tei-expan></tei-choice>"],select:"Textcritical",label:"<i class='bi bi-three-dots'></i>"},Figure:{command:"insertFigure",label:"<i class='bi bi-images'></i>",select:"Blocks"}},selects:{Blocks:{label:"<i class='bi bi-text-paragraph'></i>",order:0},Textcritical:{label:"<i class='bi bi-highlighter'></i>",order:9}},schema:{div:{type:"block",defining:!0,content:"heading* block*",attributes:{type:{type:"string"},n:{type:"string"}},keyboard:{"Mod-Shift-e":{attributes:{},command:"wrapDiv"}},toolbar:{Division:{select:"Blocks",attributes:{},command:"wrapDiv",label:"<i class='bi bi-body-text'></i>"}}},hi:{type:"inline",attributes:{rend:{type:"string",default:"i",enum:["i","b","u","code"]}},keyboard:{"Cmd-b":{attributes:{rend:"b"}},"Cmd-i":{attributes:{rend:"i"}},"Cmd-u":{attributes:{rend:"u"}}},toolbar:{Bold:{attributes:{rend:"b"},label:"<i class='bi bi-type-bold'></i>",order:1},Italic:{attributes:{rend:"i"},label:"<i class='bi bi-type-italic'></i>",order:1},Underline:{attributes:{rend:"u"},label:"<i class='bi bi-type-underline'></i>",order:1}}},ref:{type:"inline",attributes:{target:{type:"string"}},keyboard:{"Alt-Shift-r":{attributes:{}}},toolbar:{Reference:{attributes:{},label:"<i class='bi bi-link'></i>",order:2}}},title:{type:"inline",attributes:{level:{type:"string",enum:["m","s","a"]}},keyboard:{"Mod-Alt-t":{attributes:{level:"m"}}},toolbar:{Title:{attributes:{level:"m"},label:"<i class='bi bi-quote'></i>",select:"Textcritical",order:2}}},figure:{type:"block",content:"(graphic|figDesc)*"},figDesc:{type:"block",content:"inline*"},graphic:{type:"graphic",attributes:{url:{type:"string",default:"https://placehold.co/320x200"}},toolbar:{Graphic:{label:"<i class='bi bi-image'></i>",select:"Blocks"}}},persName:{type:"inline",attributes:{key:{connector:{name:"GND",type:"person",prefix:"gnd"},type:"string"}},keyboard:{"Mod-Shift-p":{attributes:{}}},toolbar:{Person:{attributes:{},label:"<i class='bi bi-person'></i>",order:11}}},orgName:{type:"inline",attributes:{key:{connector:{name:"GND",type:"organization",prefix:"gnd"},type:"string"}},toolbar:{Organization:{attributes:{},label:"<i class='bi bi-people'></i>",order:11}}},placeName:{type:"inline",attributes:{key:{type:"string",connector:{name:"GeoNames",type:"place",prefix:"geo",user:"existdb"}}},keyboard:{"Mod-Shift-h":{attributes:{}}},toolbar:{Place:{attributes:{},label:"<i class='bi bi-geo-alt'></i>",order:11}}},term:{type:"inline",attributes:{key:{type:"string",connector:{name:"GND",type:"term",prefix:"gnd"}}},keyboard:{"Mod-Shift-t":{attributes:{}}},toolbar:{Term:{attributes:{},label:"<i class='bi bi-bookmark'></i>",order:11}}},date:{type:"inline",attributes:{when:{type:"string"},"not-before":{type:"string"},"not-after":{type:"string"},from:{type:"string"},to:{type:"string"}},toolbar:{Date:{attributes:{},label:"<i class='bi bi-calendar-date'></i>",order:12}}},p:{type:"block",priority:100,toolbar:{Paragraph:{select:"Blocks",attributes:{},label:"<i class='bi bi-paragraph'></i>"}}},head:{type:"block",group:"heading",attributes:{type:{type:"string"},n:{type:"string"}},keyboard:{"Shift-Mod-1":{attributes:{n:"1"}}},toolbar:{Head:{select:"Blocks",attributes:{},label:"<i class='bi bi-type-h1'></i>"}}},item:{type:"listItem"},list:{type:"list",content:"heading* item+",attributes:{rend:{type:"string",enum:["ordered","unordered"],open:!0}},keyboard:{"Mod-Shift-l":{attributes:{}}},toolbar:{List:{select:"Blocks",attributes:{rend:"unordered"},label:"<i class='bi bi-list-ul'></i>"},"Numbered list":{select:"Blocks",attributes:{rend:"ordered"},label:"<i class='bi bi-list-ol'></i>"}}},opener:{type:"block",content:"block*",toolbar:{Opener:{select:"Blocks",attributes:{},label:"<i class='bi bi-envelope-open'></i>"}}},closer:{type:"block",content:"block*",toolbar:{Closer:{select:"Blocks",attributes:{},label:"<i class='bi bi-envelope'></i>"}}},noteGrp:{type:"list",group:"",defining:!0,content:"note+",keyboard:{"Mod-Shift-u":{attributes:{}}}},note:{type:"listItem",content:"inline*",defining:!0,isolating:!0,attributes:{target:{type:"string"},_reference:{type:"string"}}},anchor:{type:"anchor",attributes:{type:{type:"string",default:"note"}},toolbar:{Footnote:{attributes:{type:"note"},label:"<i class='bi bi-123'></i>",order:2}}},choice:{type:"inline",content:"abbr expan",toolbar:{Choice:{select:"Textcritical",label:"<i class='bi bi-alt'></i>"}}},abbr:{type:"inline",toolbar:{Abbreviation:{select:"Textcritical",label:"<i class='bi bi-three-dots'></i>"}}},expan:{type:"inline",toolbar:{Expansion:{select:"Textcritical",label:"<i class='bi bi-arrows-expand-vertical'></i>"}}},gap:{type:"empty",label:"[...]",attributes:{unit:{type:"string",default:"chars",enum:["chars","lines","words"]},quantity:{type:"string"}},toolbar:{Gap:{select:"Textcritical",label:"<i class='bi bi-braces-asterisk'></i>"}}},unclear:{type:"inline",attributes:{rend:{type:"string",default:"unclear"}},toolbar:{Unclear:{select:"Textcritical",label:"<i class='bi bi-patch-question'></i>"}}},supplied:{type:"inline",attributes:{reason:{type:"string"}},toolbar:{Supplied:{select:"Textcritical",label:"<i class='bi bi-plus-circle-dotted'></i>"}}},pb:{type:"empty",label:"pb",attributes:{n:{type:"string"}},keyboard:{"Mod-Alt-p":{attributes:{n:"22"}}},toolbar:{PageBreak:{attributes:{n:"22"},label:"<i class='bi bi-file-earmark-break'></i>",order:3}}},lb:{type:"empty",label:"&#x21B5;",attributes:{n:{type:"string"}},toolbar:{LineBreak:{attributes:{},label:"<i class='bi bi-arrow-return-left'></i>",order:3}}}}},Mr=document.createElement("style");Mr.textContent=`
117
117
  jinn-tap {
118
118
  display: grid;
119
119
  grid-template-rows: min-content 1fr;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jinntec/jinntap",
3
- "version": "1.9.0",
3
+ "version": "1.9.1",
4
4
  "type": "module",
5
5
  "main": "./dist/jinn-tap.umd.js",
6
6
  "module": "./dist/jinn-tap.es.js",