ai-word-editor 0.0.76 → 0.0.78

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { useUmoEditor as Vn } from "@umoteam/editor";
2
- import { computed as X, ref as I, watch as ct, nextTick as Ie, openBlock as T, createElementBlock as A, createElementVNode as l, createTextVNode as Ce, toDisplayString as N, createCommentVNode as ft, Fragment as St, renderList as Jt, normalizeClass as Tt, withModifiers as ht, onMounted as Se, createBlock as Rt, Teleport as Te, withDirectives as mn, withKeys as Ee, vModelText as Kn, normalizeStyle as jn, defineComponent as Yn, onUnmounted as Ke, useAttrs as Xn, resolveComponent as Qn, createVNode as Zn, mergeProps as to, withCtx as je, renderSlot as eo, unref as xt, createApp as no, h as oo, vModelCheckbox as ro } from "vue";
3
- import { E as dn, p as fn, m as so, g as Ye, u as io, e as lo, a as Xe, b as ao, c as Qe, s as Ze, C as co, d as dt } from "./wordDocxExport-BcDXFm-b.js";
2
+ import { computed as Z, ref as M, watch as mt, nextTick as Ie, openBlock as S, createElementBlock as I, createElementVNode as l, createTextVNode as Ce, toDisplayString as N, createCommentVNode as ut, Fragment as St, renderList as Jt, normalizeClass as Tt, withModifiers as ht, onMounted as Se, createBlock as Rt, Teleport as Te, withDirectives as mn, withKeys as Ee, vModelText as Kn, normalizeStyle as jn, defineComponent as Yn, onUnmounted as Ke, useAttrs as Xn, resolveComponent as Qn, createVNode as Zn, mergeProps as to, withCtx as je, renderSlot as eo, unref as xt, createApp as no, h as oo, vModelCheckbox as ro } from "vue";
3
+ import { E as dn, p as fn, m as so, g as Ye, u as io, e as lo, a as Xe, b as ao, c as Qe, s as Ze, C as co, d as ft } from "./wordDocxExport-DyFbvZqL.js";
4
4
  import { parseDocxToJson as uo, parseDocxToHtml as mo, parseDocxComments as fo } from "./wordDocxImport.js";
5
5
  const Pt = (s, t) => {
6
6
  const e = s.__vccOpts || s;
@@ -34,20 +34,20 @@ const Pt = (s, t) => {
34
34
  },
35
35
  emits: ["activate", "delete", "resolve"],
36
36
  setup(s, { emit: t }) {
37
- const e = s, n = t, o = X(() => e.comments.filter((d) => !d?.resolved).length), r = I(null), u = (d, m) => d ? d.length > m ? d.slice(0, m) + "…" : d : "", a = (d) => {
37
+ const e = s, n = t, o = Z(() => e.comments.filter((d) => !d?.resolved).length), r = M(null), u = (d, m) => d ? d.length > m ? d.slice(0, m) + "…" : d : "", a = (d) => {
38
38
  n("activate", d);
39
39
  };
40
- return ct(
40
+ return mt(
41
41
  () => e.activeCommentId,
42
42
  async (d) => {
43
43
  if (!d) return;
44
- await Ie(), await new Promise(($) => setTimeout($, 0));
44
+ await Ie(), await new Promise((D) => setTimeout(D, 0));
45
45
  const m = r.value;
46
46
  if (!(m instanceof HTMLElement)) return;
47
47
  const h = m.querySelector(`[data-comment-id="${d}"]`);
48
48
  h instanceof HTMLElement && h.scrollIntoView({ behavior: "smooth", block: "nearest" });
49
49
  }
50
- ), (d, m) => (T(), A("aside", {
50
+ ), (d, m) => (S(), I("aside", {
51
51
  ref_key: "panelRootRef",
52
52
  ref: r,
53
53
  class: "comment-panel"
@@ -55,15 +55,15 @@ const Pt = (s, t) => {
55
55
  l("div", ho, [
56
56
  l("h3", po, [
57
57
  m[0] || (m[0] = Ce(" 批注 ", -1)),
58
- o.value ? (T(), A("span", go, N(o.value), 1)) : ft("", !0)
58
+ o.value ? (S(), I("span", go, N(o.value), 1)) : ut("", !0)
59
59
  ])
60
60
  ]),
61
- s.comments.length === 0 ? (T(), A("div", vo, [...m[1] || (m[1] = [
61
+ s.comments.length === 0 ? (S(), I("div", vo, [...m[1] || (m[1] = [
62
62
  l("div", { class: "comment-panel__empty-icon" }, "💬", -1),
63
63
  l("p", null, "暂无批注", -1),
64
64
  l("p", { class: "comment-panel__empty-hint" }, "选中文本后点击「添加批注」", -1)
65
- ])])) : (T(), A("ul", yo, [
66
- (T(!0), A(St, null, Jt(s.comments, (h) => (T(), A("li", {
65
+ ])])) : (S(), I("ul", yo, [
66
+ (S(!0), I(St, null, Jt(s.comments, (h) => (S(), I("li", {
67
67
  key: h.id,
68
68
  class: Tt(["comment-item", [
69
69
  `comment-item--c${h.colorIndex ?? 0}`,
@@ -73,7 +73,7 @@ const Pt = (s, t) => {
73
73
  }
74
74
  ]]),
75
75
  "data-comment-id": h.id,
76
- onClick: ($) => a(h.id)
76
+ onClick: (D) => a(h.id)
77
77
  }, [
78
78
  l("div", ko, [
79
79
  m[2] || (m[2] = l("span", { class: "comment-item__quote-icon" }, "❝", -1)),
@@ -88,12 +88,12 @@ const Pt = (s, t) => {
88
88
  l("button", {
89
89
  class: "comment-btn comment-btn--resolve",
90
90
  type: "button",
91
- onClick: ht(($) => n("resolve", h.id), ["stop"])
91
+ onClick: ht((D) => n("resolve", h.id), ["stop"])
92
92
  }, N(h.resolved ? "取消解决" : "已解决"), 9, To),
93
93
  l("button", {
94
94
  class: "comment-btn comment-btn--delete",
95
95
  type: "button",
96
- onClick: ht(($) => n("delete", h.id), ["stop"])
96
+ onClick: ht((D) => n("delete", h.id), ["stop"])
97
97
  }, " 删除 ", 8, Eo)
98
98
  ])
99
99
  ], 10, wo))), 128))
@@ -117,14 +117,14 @@ const Pt = (s, t) => {
117
117
  },
118
118
  emits: ["confirm", "cancel"],
119
119
  setup(s, { emit: t }) {
120
- const e = s, n = t, o = I(e.initialNote), r = I(null);
120
+ const e = s, n = t, o = M(e.initialNote), r = M(null);
121
121
  Se(() => {
122
122
  r.value?.focus();
123
123
  });
124
124
  const u = (d, m) => d ? d.length > m ? d.slice(0, m) + "…" : d : "", a = () => {
125
125
  o.value.trim() && (n("confirm", o.value.trim()), o.value = "");
126
126
  };
127
- return (d, m) => (T(), Rt(Te, { to: "body" }, [
127
+ return (d, m) => (S(), Rt(Te, { to: "body" }, [
128
128
  l("div", {
129
129
  class: "dialog-backdrop",
130
130
  onClick: m[4] || (m[4] = ht((h) => d.$emit("cancel"), ["self"]))
@@ -137,10 +137,10 @@ const Pt = (s, t) => {
137
137
  onClick: m[0] || (m[0] = (h) => d.$emit("cancel"))
138
138
  }, "✕")
139
139
  ]),
140
- s.selectedText ? (T(), A("div", Ao, [
140
+ s.selectedText ? (S(), I("div", Ao, [
141
141
  m[6] || (m[6] = l("span", { class: "dialog__quote-label" }, "选中文本", -1)),
142
142
  l("blockquote", Do, N(u(s.selectedText, 120)), 1)
143
- ])) : ft("", !0),
143
+ ])) : ut("", !0),
144
144
  l("div", $o, [
145
145
  m[7] || (m[7] = l("label", {
146
146
  class: "dialog__label",
@@ -201,19 +201,19 @@ const Pt = (s, t) => {
201
201
  if (!a) return "";
202
202
  const m = String(a);
203
203
  return m.length > d ? m.slice(0, d) + "…" : m;
204
- }, n = I([]);
205
- ct(
204
+ }, n = M([]);
205
+ mt(
206
206
  () => ({ anchors: t.anchors, commentsLen: (t.comments || []).length }),
207
207
  ({ anchors: a, commentsLen: d }) => {
208
208
  !a || !a.length || d && (!n.value.length || n.value.length < d) && a.length >= d && (n.value = a.slice());
209
209
  },
210
210
  { immediate: !0 }
211
211
  );
212
- const o = X(() => {
212
+ const o = Z(() => {
213
213
  const a = /* @__PURE__ */ new Map();
214
214
  for (const d of t.comments || []) a.set(d.id, d);
215
215
  return a;
216
- }), r = X(() => {
216
+ }), r = Z(() => {
217
217
  const a = [], d = n.value.length ? n.value : t.anchors || [];
218
218
  for (const m of d) {
219
219
  const h = o.value.get(m.id);
@@ -229,18 +229,18 @@ const Pt = (s, t) => {
229
229
  });
230
230
  }
231
231
  return a.sort((m, h) => m.anchorTop - h.anchorTop);
232
- }), u = X(() => {
232
+ }), u = Z(() => {
233
233
  const a = [];
234
234
  let d = 0;
235
235
  const m = t.itemHeight, h = t.minGap;
236
- for (const $ of r.value) {
237
- const L = $.anchorTop, P = L - d, _ = P > 0 ? P : 0;
238
- a.push({ ...$, marginTop: _ }), d = L + m + h;
236
+ for (const D of r.value) {
237
+ const P = D.anchorTop, H = P - d, V = H > 0 ? H : 0;
238
+ a.push({ ...D, marginTop: V }), d = P + m + h;
239
239
  }
240
240
  return a;
241
241
  });
242
- return (a, d) => (T(), A("div", Lo, [
243
- (T(!0), A(St, null, Jt(u.value, (m) => (T(), A("div", {
242
+ return (a, d) => (S(), I("div", Lo, [
243
+ (S(!0), I(St, null, Jt(u.value, (m) => (S(), I("div", {
244
244
  key: m.id,
245
245
  class: "gutter-item-wrapper",
246
246
  style: jn({ marginTop: `${m.marginTop}px` })
@@ -318,7 +318,7 @@ function pn(s, t, e, n) {
318
318
  e -= d, n -= d;
319
319
  }
320
320
  }
321
- class R {
321
+ class J {
322
322
  /**
323
323
  @internal
324
324
  */
@@ -373,7 +373,7 @@ class R {
373
373
  let e = this.lastChild, n = t.firstChild, o = this.content.slice(), r = 0;
374
374
  for (e.isText && e.sameMarkup(n) && (o[o.length - 1] = e.withText(e.text + n.text), r = 1); r < t.content.length; r++)
375
375
  o.push(t.content[r]);
376
- return new R(o, this.size + t.size);
376
+ return new J(o, this.size + t.size);
377
377
  }
378
378
  /**
379
379
  Cut out the sub-fragment between the two given positions.
@@ -387,13 +387,13 @@ class R {
387
387
  let a = this.content[r], d = u + a.nodeSize;
388
388
  d > t && ((u < t || d > e) && (a.isText ? a = a.cut(Math.max(0, t - u), Math.min(a.text.length, e - u)) : a = a.cut(Math.max(0, t - u - 1), Math.min(a.content.size, e - u - 1))), n.push(a), o += a.nodeSize), u = d;
389
389
  }
390
- return new R(n, o);
390
+ return new J(n, o);
391
391
  }
392
392
  /**
393
393
  @internal
394
394
  */
395
395
  cutByIndex(t, e) {
396
- return t == e ? R.empty : t == 0 && e == this.content.length ? this : new R(this.content.slice(t, e));
396
+ return t == e ? J.empty : t == 0 && e == this.content.length ? this : new J(this.content.slice(t, e));
397
397
  }
398
398
  /**
399
399
  Create a new fragment in which the node at the given index is
@@ -404,21 +404,21 @@ class R {
404
404
  if (n == e)
405
405
  return this;
406
406
  let o = this.content.slice(), r = this.size + e.nodeSize - n.nodeSize;
407
- return o[t] = e, new R(o, r);
407
+ return o[t] = e, new J(o, r);
408
408
  }
409
409
  /**
410
410
  Create a new fragment by prepending the given node to this
411
411
  fragment.
412
412
  */
413
413
  addToStart(t) {
414
- return new R([t].concat(this.content), this.size + t.nodeSize);
414
+ return new J([t].concat(this.content), this.size + t.nodeSize);
415
415
  }
416
416
  /**
417
417
  Create a new fragment by appending the given node to this
418
418
  fragment.
419
419
  */
420
420
  addToEnd(t) {
421
- return new R(this.content.concat(t), this.size + t.nodeSize);
421
+ return new J(this.content.concat(t), this.size + t.nodeSize);
422
422
  }
423
423
  /**
424
424
  Compare this fragment to another one.
@@ -533,10 +533,10 @@ class R {
533
533
  */
534
534
  static fromJSON(t, e) {
535
535
  if (!e)
536
- return R.empty;
536
+ return J.empty;
537
537
  if (!Array.isArray(e))
538
538
  throw new RangeError("Invalid input for Fragment.fromJSON");
539
- return new R(e.map(t.nodeFromJSON));
539
+ return new J(e.map(t.nodeFromJSON));
540
540
  }
541
541
  /**
542
542
  Build a fragment from an array of nodes. Ensures that adjacent
@@ -544,13 +544,13 @@ class R {
544
544
  */
545
545
  static fromArray(t) {
546
546
  if (!t.length)
547
- return R.empty;
547
+ return J.empty;
548
548
  let e, n = 0;
549
549
  for (let o = 0; o < t.length; o++) {
550
550
  let r = t[o];
551
551
  n += r.nodeSize, o && r.isText && t[o - 1].sameMarkup(r) ? (e || (e = t.slice(0, o)), e[e.length - 1] = r.withText(e[e.length - 1].text + r.text)) : e && e.push(r);
552
552
  }
553
- return new R(e || t, n);
553
+ return new J(e || t, n);
554
554
  }
555
555
  /**
556
556
  Create a fragment from something that can be interpreted as a
@@ -560,24 +560,24 @@ class R {
560
560
  */
561
561
  static from(t) {
562
562
  if (!t)
563
- return R.empty;
564
- if (t instanceof R)
563
+ return J.empty;
564
+ if (t instanceof J)
565
565
  return t;
566
566
  if (Array.isArray(t))
567
567
  return this.fromArray(t);
568
568
  if (t.attrs)
569
- return new R([t], t.nodeSize);
569
+ return new J([t], t.nodeSize);
570
570
  throw new RangeError("Can not convert " + t + " to a Fragment" + (t.nodesBetween ? " (looks like multiple versions of prosemirror-model were loaded)" : ""));
571
571
  }
572
572
  }
573
- R.empty = new R([], 0);
573
+ J.empty = new J([], 0);
574
574
  const we = { index: 0, offset: 0 };
575
575
  function te(s, t) {
576
576
  return we.index = s, we.offset = t, we;
577
577
  }
578
578
  class jo extends Error {
579
579
  }
580
- class D {
580
+ class A {
581
581
  /**
582
582
  Create a slice. When specifying a non-zero open depth, you must
583
583
  make sure that there are nodes of at least that depth at the
@@ -604,13 +604,13 @@ class D {
604
604
  */
605
605
  insertAt(t, e) {
606
606
  let n = vn(this.content, t + this.openStart, e);
607
- return n && new D(n, this.openStart, this.openEnd);
607
+ return n && new A(n, this.openStart, this.openEnd);
608
608
  }
609
609
  /**
610
610
  @internal
611
611
  */
612
612
  removeBetween(t, e) {
613
- return new D(gn(this.content, t + this.openStart, e + this.openStart), this.openStart, this.openEnd);
613
+ return new A(gn(this.content, t + this.openStart, e + this.openStart), this.openStart, this.openEnd);
614
614
  }
615
615
  /**
616
616
  Tests whether this slice is equal to another slice.
@@ -638,11 +638,11 @@ class D {
638
638
  */
639
639
  static fromJSON(t, e) {
640
640
  if (!e)
641
- return D.empty;
641
+ return A.empty;
642
642
  let n = e.openStart || 0, o = e.openEnd || 0;
643
643
  if (typeof n != "number" || typeof o != "number")
644
644
  throw new RangeError("Invalid input for Slice.fromJSON");
645
- return new D(R.fromJSON(t, e.content), n, o);
645
+ return new A(J.fromJSON(t, e.content), n, o);
646
646
  }
647
647
  /**
648
648
  Create a slice from a fragment by taking the maximum possible
@@ -654,10 +654,10 @@ class D {
654
654
  n++;
655
655
  for (let r = t.lastChild; r && !r.isLeaf && (e || !r.type.spec.isolating); r = r.lastChild)
656
656
  o++;
657
- return new D(t, n, o);
657
+ return new A(t, n, o);
658
658
  }
659
659
  }
660
- D.empty = new D(R.empty, 0, 0);
660
+ A.empty = new A(J.empty, 0, 0);
661
661
  function gn(s, t, e) {
662
662
  let { index: n, offset: o } = s.findIndex(t), r = s.maybeChild(n), { index: u, offset: a } = s.findIndex(e);
663
663
  if (o == t || r.isText) {
@@ -723,15 +723,15 @@ class en {
723
723
  return (this.delInfo & ne) > 0;
724
724
  }
725
725
  }
726
- class Q {
726
+ class tt {
727
727
  /**
728
728
  Create a position map. The modifications to the document are
729
729
  represented as an array of numbers, in which each group of three
730
730
  represents a modified chunk as `[start, oldSize, newSize]`.
731
731
  */
732
732
  constructor(t, e = !1) {
733
- if (this.ranges = t, this.inverted = e, !t.length && Q.empty)
734
- return Q.empty;
733
+ if (this.ranges = t, this.inverted = e, !t.length && tt.empty)
734
+ return tt.empty;
735
735
  }
736
736
  /**
737
737
  @internal
@@ -758,13 +758,13 @@ class Q {
758
758
  let d = this.ranges[a] - (this.inverted ? o : 0);
759
759
  if (d > t)
760
760
  break;
761
- let m = this.ranges[a + r], h = this.ranges[a + u], $ = d + m;
762
- if (t <= $) {
763
- let L = m ? t == d ? -1 : t == $ ? 1 : e : e, P = d + o + (L < 0 ? 0 : h);
761
+ let m = this.ranges[a + r], h = this.ranges[a + u], D = d + m;
762
+ if (t <= D) {
763
+ let P = m ? t == d ? -1 : t == D ? 1 : e : e, H = d + o + (P < 0 ? 0 : h);
764
764
  if (n)
765
- return P;
766
- let _ = t == (e < 0 ? d : $) ? null : Yo(a / 3, t - d), y = t == d ? _n : t == $ ? kn : ne;
767
- return (e < 0 ? t != d : t != $) && (y |= xn), new en(P, y, _);
765
+ return H;
766
+ let V = t == (e < 0 ? d : D) ? null : Yo(a / 3, t - d), k = t == d ? _n : t == D ? kn : ne;
767
+ return (e < 0 ? t != d : t != D) && (k |= xn), new en(H, k, V);
768
768
  }
769
769
  o += h - m;
770
770
  }
@@ -802,7 +802,7 @@ class Q {
802
802
  map positions in the post-step document to the pre-step document.
803
803
  */
804
804
  invert() {
805
- return new Q(this.ranges, !this.inverted);
805
+ return new tt(this.ranges, !this.inverted);
806
806
  }
807
807
  /**
808
808
  @internal
@@ -816,19 +816,19 @@ class Q {
816
816
  sub-document to a larger document, or vice-versa.
817
817
  */
818
818
  static offset(t) {
819
- return t == 0 ? Q.empty : new Q(t < 0 ? [0, -t, 0] : [0, 0, t]);
819
+ return t == 0 ? tt.empty : new tt(t < 0 ? [0, -t, 0] : [0, 0, t]);
820
820
  }
821
821
  }
822
- Q.empty = new Q([]);
822
+ tt.empty = new tt([]);
823
823
  const ke = /* @__PURE__ */ Object.create(null);
824
- class j {
824
+ class X {
825
825
  /**
826
826
  Get the step map that represents the changes made by this step,
827
827
  and which can be used to transform between positions in the old
828
828
  and the new document.
829
829
  */
830
830
  getMap() {
831
- return Q.empty;
831
+ return tt.empty;
832
832
  }
833
833
  /**
834
834
  Try to merge this step with another one, to be applied directly
@@ -862,7 +862,7 @@ class j {
862
862
  return ke[t] = e, e.prototype.jsonID = t, e;
863
863
  }
864
864
  }
865
- class H {
865
+ class q {
866
866
  /**
867
867
  @internal
868
868
  */
@@ -873,13 +873,13 @@ class H {
873
873
  Create a successful step result.
874
874
  */
875
875
  static ok(t) {
876
- return new H(t, null);
876
+ return new q(t, null);
877
877
  }
878
878
  /**
879
879
  Create a failed step result.
880
880
  */
881
881
  static fail(t) {
882
- return new H(null, t);
882
+ return new q(null, t);
883
883
  }
884
884
  /**
885
885
  Call [`Node.replace`](https://prosemirror.net/docs/ref/#model.Node.replace) with the given
@@ -888,10 +888,10 @@ class H {
888
888
  */
889
889
  static fromReplace(t, e, n, o) {
890
890
  try {
891
- return H.ok(t.replace(e, n, o));
891
+ return q.ok(t.replace(e, n, o));
892
892
  } catch (r) {
893
893
  if (r instanceof jo)
894
- return H.fail(r.message);
894
+ return q.fail(r.message);
895
895
  throw r;
896
896
  }
897
897
  }
@@ -902,9 +902,9 @@ function Oe(s, t, e) {
902
902
  let r = s.child(o);
903
903
  r.content.size && (r = r.copy(Oe(r.content, t, r))), r.isInline && (r = t(r, e, o)), n.push(r);
904
904
  }
905
- return R.fromArray(n);
905
+ return J.fromArray(n);
906
906
  }
907
- class yt extends j {
907
+ class yt extends X {
908
908
  /**
909
909
  Create a mark step.
910
910
  */
@@ -912,8 +912,8 @@ class yt extends j {
912
912
  super(), this.from = t, this.to = e, this.mark = n;
913
913
  }
914
914
  apply(t) {
915
- let e = t.slice(this.from, this.to), n = t.resolve(this.from), o = n.node(n.sharedDepth(this.to)), r = new D(Oe(e.content, (u, a) => !u.isAtom || !a.type.allowsMarkType(this.mark.type) ? u : u.mark(this.mark.addToSet(u.marks)), o), e.openStart, e.openEnd);
916
- return H.fromReplace(t, this.from, this.to, r);
915
+ let e = t.slice(this.from, this.to), n = t.resolve(this.from), o = n.node(n.sharedDepth(this.to)), r = new A(Oe(e.content, (u, a) => !u.isAtom || !a.type.allowsMarkType(this.mark.type) ? u : u.mark(this.mark.addToSet(u.marks)), o), e.openStart, e.openEnd);
916
+ return q.fromReplace(t, this.from, this.to, r);
917
917
  }
918
918
  invert() {
919
919
  return new wt(this.from, this.to, this.mark);
@@ -942,8 +942,8 @@ class yt extends j {
942
942
  return new yt(e.from, e.to, t.markFromJSON(e.mark));
943
943
  }
944
944
  }
945
- j.jsonID("addMark", yt);
946
- class wt extends j {
945
+ X.jsonID("addMark", yt);
946
+ class wt extends X {
947
947
  /**
948
948
  Create a mark-removing step.
949
949
  */
@@ -951,8 +951,8 @@ class wt extends j {
951
951
  super(), this.from = t, this.to = e, this.mark = n;
952
952
  }
953
953
  apply(t) {
954
- let e = t.slice(this.from, this.to), n = new D(Oe(e.content, (o) => o.mark(this.mark.removeFromSet(o.marks)), t), e.openStart, e.openEnd);
955
- return H.fromReplace(t, this.from, this.to, n);
954
+ let e = t.slice(this.from, this.to), n = new A(Oe(e.content, (o) => o.mark(this.mark.removeFromSet(o.marks)), t), e.openStart, e.openEnd);
955
+ return q.fromReplace(t, this.from, this.to, n);
956
956
  }
957
957
  invert() {
958
958
  return new yt(this.from, this.to, this.mark);
@@ -981,8 +981,8 @@ class wt extends j {
981
981
  return new wt(e.from, e.to, t.markFromJSON(e.mark));
982
982
  }
983
983
  }
984
- j.jsonID("removeMark", wt);
985
- class kt extends j {
984
+ X.jsonID("removeMark", wt);
985
+ class kt extends X {
986
986
  /**
987
987
  Create a node mark step.
988
988
  */
@@ -992,9 +992,9 @@ class kt extends j {
992
992
  apply(t) {
993
993
  let e = t.nodeAt(this.pos);
994
994
  if (!e)
995
- return H.fail("No node at mark step's position");
995
+ return q.fail("No node at mark step's position");
996
996
  let n = e.type.create(e.attrs, null, this.mark.addToSet(e.marks));
997
- return H.fromReplace(t, this.pos, this.pos + 1, new D(R.from(n), 0, e.isLeaf ? 0 : 1));
997
+ return q.fromReplace(t, this.pos, this.pos + 1, new A(J.from(n), 0, e.isLeaf ? 0 : 1));
998
998
  }
999
999
  invert(t) {
1000
1000
  let e = t.nodeAt(this.pos);
@@ -1025,8 +1025,8 @@ class kt extends j {
1025
1025
  return new kt(e.pos, t.markFromJSON(e.mark));
1026
1026
  }
1027
1027
  }
1028
- j.jsonID("addNodeMark", kt);
1029
- class Ft extends j {
1028
+ X.jsonID("addNodeMark", kt);
1029
+ class Ft extends X {
1030
1030
  /**
1031
1031
  Create a mark-removing step.
1032
1032
  */
@@ -1036,9 +1036,9 @@ class Ft extends j {
1036
1036
  apply(t) {
1037
1037
  let e = t.nodeAt(this.pos);
1038
1038
  if (!e)
1039
- return H.fail("No node at mark step's position");
1039
+ return q.fail("No node at mark step's position");
1040
1040
  let n = e.type.create(e.attrs, null, this.mark.removeFromSet(e.marks));
1041
- return H.fromReplace(t, this.pos, this.pos + 1, new D(R.from(n), 0, e.isLeaf ? 0 : 1));
1041
+ return q.fromReplace(t, this.pos, this.pos + 1, new A(J.from(n), 0, e.isLeaf ? 0 : 1));
1042
1042
  }
1043
1043
  invert(t) {
1044
1044
  let e = t.nodeAt(this.pos);
@@ -1060,8 +1060,8 @@ class Ft extends j {
1060
1060
  return new Ft(e.pos, t.markFromJSON(e.mark));
1061
1061
  }
1062
1062
  }
1063
- j.jsonID("removeNodeMark", Ft);
1064
- class at extends j {
1063
+ X.jsonID("removeNodeMark", Ft);
1064
+ class ct extends X {
1065
1065
  /**
1066
1066
  The given `slice` should fit the 'gap' between `from` and
1067
1067
  `to`—the depths must line up, and the surrounding nodes must be
@@ -1075,27 +1075,27 @@ class at extends j {
1075
1075
  super(), this.from = t, this.to = e, this.slice = n, this.structure = o;
1076
1076
  }
1077
1077
  apply(t) {
1078
- return this.structure && Ne(t, this.from, this.to) ? H.fail("Structure replace would overwrite content") : H.fromReplace(t, this.from, this.to, this.slice);
1078
+ return this.structure && Ne(t, this.from, this.to) ? q.fail("Structure replace would overwrite content") : q.fromReplace(t, this.from, this.to, this.slice);
1079
1079
  }
1080
1080
  getMap() {
1081
- return new Q([this.from, this.to - this.from, this.slice.size]);
1081
+ return new tt([this.from, this.to - this.from, this.slice.size]);
1082
1082
  }
1083
1083
  invert(t) {
1084
- return new at(this.from, this.from + this.slice.size, t.slice(this.from, this.to));
1084
+ return new ct(this.from, this.from + this.slice.size, t.slice(this.from, this.to));
1085
1085
  }
1086
1086
  map(t) {
1087
1087
  let e = t.mapResult(this.from, 1), n = t.mapResult(this.to, -1);
1088
- return e.deletedAcross && n.deletedAcross ? null : new at(e.pos, Math.max(e.pos, n.pos), this.slice, this.structure);
1088
+ return e.deletedAcross && n.deletedAcross ? null : new ct(e.pos, Math.max(e.pos, n.pos), this.slice, this.structure);
1089
1089
  }
1090
1090
  merge(t) {
1091
- if (!(t instanceof at) || t.structure || this.structure)
1091
+ if (!(t instanceof ct) || t.structure || this.structure)
1092
1092
  return null;
1093
1093
  if (this.from + this.slice.size == t.from && !this.slice.openEnd && !t.slice.openStart) {
1094
- let e = this.slice.size + t.slice.size == 0 ? D.empty : new D(this.slice.content.append(t.slice.content), this.slice.openStart, t.slice.openEnd);
1095
- return new at(this.from, this.to + (t.to - t.from), e, this.structure);
1094
+ let e = this.slice.size + t.slice.size == 0 ? A.empty : new A(this.slice.content.append(t.slice.content), this.slice.openStart, t.slice.openEnd);
1095
+ return new ct(this.from, this.to + (t.to - t.from), e, this.structure);
1096
1096
  } else if (t.to == this.from && !this.slice.openStart && !t.slice.openEnd) {
1097
- let e = this.slice.size + t.slice.size == 0 ? D.empty : new D(t.slice.content.append(this.slice.content), t.slice.openStart, this.slice.openEnd);
1098
- return new at(t.from, this.to, e, this.structure);
1097
+ let e = this.slice.size + t.slice.size == 0 ? A.empty : new A(t.slice.content.append(this.slice.content), t.slice.openStart, this.slice.openEnd);
1098
+ return new ct(t.from, this.to, e, this.structure);
1099
1099
  } else
1100
1100
  return null;
1101
1101
  }
@@ -1109,11 +1109,11 @@ class at extends j {
1109
1109
  static fromJSON(t, e) {
1110
1110
  if (typeof e.from != "number" || typeof e.to != "number")
1111
1111
  throw new RangeError("Invalid input for ReplaceStep.fromJSON");
1112
- return new at(e.from, e.to, D.fromJSON(t, e.slice), !!e.structure);
1112
+ return new ct(e.from, e.to, A.fromJSON(t, e.slice), !!e.structure);
1113
1113
  }
1114
1114
  }
1115
- j.jsonID("replace", at);
1116
- class Et extends j {
1115
+ X.jsonID("replace", ct);
1116
+ class Et extends X {
1117
1117
  /**
1118
1118
  Create a replace-around step with the given range and gap.
1119
1119
  `insert` should be the point in the slice into which the content
@@ -1125,15 +1125,15 @@ class Et extends j {
1125
1125
  }
1126
1126
  apply(t) {
1127
1127
  if (this.structure && (Ne(t, this.from, this.gapFrom) || Ne(t, this.gapTo, this.to)))
1128
- return H.fail("Structure gap-replace would overwrite content");
1128
+ return q.fail("Structure gap-replace would overwrite content");
1129
1129
  let e = t.slice(this.gapFrom, this.gapTo);
1130
1130
  if (e.openStart || e.openEnd)
1131
- return H.fail("Gap is not a flat range");
1131
+ return q.fail("Gap is not a flat range");
1132
1132
  let n = this.slice.insertAt(this.insert, e.content);
1133
- return n ? H.fromReplace(t, this.from, this.to, n) : H.fail("Content does not fit in gap");
1133
+ return n ? q.fromReplace(t, this.from, this.to, n) : q.fail("Content does not fit in gap");
1134
1134
  }
1135
1135
  getMap() {
1136
- return new Q([
1136
+ return new tt([
1137
1137
  this.from,
1138
1138
  this.gapFrom - this.from,
1139
1139
  this.insert,
@@ -1167,10 +1167,10 @@ class Et extends j {
1167
1167
  static fromJSON(t, e) {
1168
1168
  if (typeof e.from != "number" || typeof e.to != "number" || typeof e.gapFrom != "number" || typeof e.gapTo != "number" || typeof e.insert != "number")
1169
1169
  throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");
1170
- return new Et(e.from, e.to, e.gapFrom, e.gapTo, D.fromJSON(t, e.slice), e.insert, !!e.structure);
1170
+ return new Et(e.from, e.to, e.gapFrom, e.gapTo, A.fromJSON(t, e.slice), e.insert, !!e.structure);
1171
1171
  }
1172
1172
  }
1173
- j.jsonID("replaceAround", Et);
1173
+ X.jsonID("replaceAround", Et);
1174
1174
  function Ne(s, t, e) {
1175
1175
  let n = s.resolve(t), o = e - t, r = n.depth;
1176
1176
  for (; o > 0 && r > 0 && n.indexAfter(r) == n.node(r).childCount; )
@@ -1185,7 +1185,7 @@ function Ne(s, t, e) {
1185
1185
  }
1186
1186
  return !1;
1187
1187
  }
1188
- class Bt extends j {
1188
+ class Bt extends X {
1189
1189
  /**
1190
1190
  Construct an attribute step.
1191
1191
  */
@@ -1195,16 +1195,16 @@ class Bt extends j {
1195
1195
  apply(t) {
1196
1196
  let e = t.nodeAt(this.pos);
1197
1197
  if (!e)
1198
- return H.fail("No node at attribute step's position");
1198
+ return q.fail("No node at attribute step's position");
1199
1199
  let n = /* @__PURE__ */ Object.create(null);
1200
1200
  for (let r in e.attrs)
1201
1201
  n[r] = e.attrs[r];
1202
1202
  n[this.attr] = this.value;
1203
1203
  let o = e.type.create(n, null, e.marks);
1204
- return H.fromReplace(t, this.pos, this.pos + 1, new D(R.from(o), 0, e.isLeaf ? 0 : 1));
1204
+ return q.fromReplace(t, this.pos, this.pos + 1, new A(J.from(o), 0, e.isLeaf ? 0 : 1));
1205
1205
  }
1206
1206
  getMap() {
1207
- return Q.empty;
1207
+ return tt.empty;
1208
1208
  }
1209
1209
  invert(t) {
1210
1210
  return new Bt(this.pos, this.attr, t.nodeAt(this.pos).attrs[this.attr]);
@@ -1222,8 +1222,8 @@ class Bt extends j {
1222
1222
  return new Bt(e.pos, e.attr, e.value);
1223
1223
  }
1224
1224
  }
1225
- j.jsonID("attr", Bt);
1226
- class re extends j {
1225
+ X.jsonID("attr", Bt);
1226
+ class re extends X {
1227
1227
  /**
1228
1228
  Construct an attribute step.
1229
1229
  */
@@ -1236,10 +1236,10 @@ class re extends j {
1236
1236
  e[o] = t.attrs[o];
1237
1237
  e[this.attr] = this.value;
1238
1238
  let n = t.type.create(e, t.content, t.marks);
1239
- return H.ok(n);
1239
+ return q.ok(n);
1240
1240
  }
1241
1241
  getMap() {
1242
- return Q.empty;
1242
+ return tt.empty;
1243
1243
  }
1244
1244
  invert(t) {
1245
1245
  return new re(this.attr, t.attrs[this.attr]);
@@ -1256,7 +1256,7 @@ class re extends j {
1256
1256
  return new re(e.attr, e.value);
1257
1257
  }
1258
1258
  }
1259
- j.jsonID("docAttr", re);
1259
+ X.jsonID("docAttr", re);
1260
1260
  let Lt = class extends Error {
1261
1261
  };
1262
1262
  Lt = function s(t) {
@@ -1332,14 +1332,14 @@ class W {
1332
1332
  Replace the selection with a slice or, if no slice is given,
1333
1333
  delete the selection. Will append to the given transaction.
1334
1334
  */
1335
- replace(t, e = D.empty) {
1335
+ replace(t, e = A.empty) {
1336
1336
  let n = e.content.lastChild, o = null;
1337
1337
  for (let a = 0; a < e.openEnd; a++)
1338
1338
  o = n, n = n.lastChild;
1339
1339
  let r = t.steps.length, u = this.ranges;
1340
1340
  for (let a = 0; a < u.length; a++) {
1341
1341
  let { $from: d, $to: m } = u[a], h = t.mapping.slice(r);
1342
- t.replaceRange(h.map(d.pos), h.map(m.pos), a ? D.empty : e), a == 0 && rn(t, r, (n ? n.isInline : o && o.isTextblock) ? -1 : 1);
1342
+ t.replaceRange(h.map(d.pos), h.map(m.pos), a ? A.empty : e), a == 0 && rn(t, r, (n ? n.isInline : o && o.isTextblock) ? -1 : 1);
1343
1343
  }
1344
1344
  }
1345
1345
  /**
@@ -1361,7 +1361,7 @@ class W {
1361
1361
  found.
1362
1362
  */
1363
1363
  static findFrom(t, e, n = !1) {
1364
- let o = t.parent.inlineContent ? new it(t) : Ct(t.node(0), t.parent, t.pos, t.index(), e, n);
1364
+ let o = t.parent.inlineContent ? new lt(t) : Ct(t.node(0), t.parent, t.pos, t.index(), e, n);
1365
1365
  if (o)
1366
1366
  return o;
1367
1367
  for (let r = t.depth - 1; r >= 0; r--) {
@@ -1377,7 +1377,7 @@ class W {
1377
1377
  negative, it will search backwards first.
1378
1378
  */
1379
1379
  static near(t, e = 1) {
1380
- return this.findFrom(t, e) || this.findFrom(t, -e) || new ut(t.node(0));
1380
+ return this.findFrom(t, e) || this.findFrom(t, -e) || new dt(t.node(0));
1381
1381
  }
1382
1382
  /**
1383
1383
  Find the cursor or leaf node selection closest to the start of
@@ -1386,14 +1386,14 @@ class W {
1386
1386
  exists.
1387
1387
  */
1388
1388
  static atStart(t) {
1389
- return Ct(t, t, 0, 0, 1) || new ut(t);
1389
+ return Ct(t, t, 0, 0, 1) || new dt(t);
1390
1390
  }
1391
1391
  /**
1392
1392
  Find the cursor or leaf node selection closest to the end of the
1393
1393
  given document.
1394
1394
  */
1395
1395
  static atEnd(t) {
1396
- return Ct(t, t, t.content.size, t.childCount, -1) || new ut(t);
1396
+ return Ct(t, t, t.content.size, t.childCount, -1) || new dt(t);
1397
1397
  }
1398
1398
  /**
1399
1399
  Deserialize the JSON representation of a selection. Must be
@@ -1428,7 +1428,7 @@ class W {
1428
1428
  returns the bookmark for that.
1429
1429
  */
1430
1430
  getBookmark() {
1431
- return it.between(this.$anchor, this.$head).getBookmark();
1431
+ return lt.between(this.$anchor, this.$head).getBookmark();
1432
1432
  }
1433
1433
  }
1434
1434
  W.prototype.visible = !0;
@@ -1444,7 +1444,7 @@ let nn = !1;
1444
1444
  function on(s) {
1445
1445
  !nn && !s.parent.inlineContent && (nn = !0, console.warn("TextSelection endpoint not pointing into a node with inline content (" + s.parent.type.name + ")"));
1446
1446
  }
1447
- class it extends W {
1447
+ class lt extends W {
1448
1448
  /**
1449
1449
  Construct a text selection between the given points.
1450
1450
  */
@@ -1463,16 +1463,16 @@ class it extends W {
1463
1463
  if (!n.parent.inlineContent)
1464
1464
  return W.near(n);
1465
1465
  let o = t.resolve(e.map(this.anchor));
1466
- return new it(o.parent.inlineContent ? o : n, n);
1466
+ return new lt(o.parent.inlineContent ? o : n, n);
1467
1467
  }
1468
- replace(t, e = D.empty) {
1469
- if (super.replace(t, e), e == D.empty) {
1468
+ replace(t, e = A.empty) {
1469
+ if (super.replace(t, e), e == A.empty) {
1470
1470
  let n = this.$from.marksAcross(this.$to);
1471
1471
  n && t.ensureMarks(n);
1472
1472
  }
1473
1473
  }
1474
1474
  eq(t) {
1475
- return t instanceof it && t.anchor == this.anchor && t.head == this.head;
1475
+ return t instanceof lt && t.anchor == this.anchor && t.head == this.head;
1476
1476
  }
1477
1477
  getBookmark() {
1478
1478
  return new ie(this.anchor, this.head);
@@ -1486,7 +1486,7 @@ class it extends W {
1486
1486
  static fromJSON(t, e) {
1487
1487
  if (typeof e.anchor != "number" || typeof e.head != "number")
1488
1488
  throw new RangeError("Invalid input for TextSelection.fromJSON");
1489
- return new it(t.resolve(e.anchor), t.resolve(e.head));
1489
+ return new lt(t.resolve(e.anchor), t.resolve(e.head));
1490
1490
  }
1491
1491
  /**
1492
1492
  Create a text selection from non-resolved positions.
@@ -1512,10 +1512,10 @@ class it extends W {
1512
1512
  else
1513
1513
  return W.near(e, n);
1514
1514
  }
1515
- return t.parent.inlineContent || (o == 0 ? t = e : (t = (W.findFrom(t, -n, !0) || W.findFrom(t, n, !0)).$anchor, t.pos < e.pos != o < 0 && (t = e))), new it(t, e);
1515
+ return t.parent.inlineContent || (o == 0 ? t = e : (t = (W.findFrom(t, -n, !0) || W.findFrom(t, n, !0)).$anchor, t.pos < e.pos != o < 0 && (t = e))), new lt(t, e);
1516
1516
  }
1517
1517
  }
1518
- W.jsonID("text", it);
1518
+ W.jsonID("text", lt);
1519
1519
  class ie {
1520
1520
  constructor(t, e) {
1521
1521
  this.anchor = t, this.head = e;
@@ -1524,10 +1524,10 @@ class ie {
1524
1524
  return new ie(t.map(this.anchor), t.map(this.head));
1525
1525
  }
1526
1526
  resolve(t) {
1527
- return it.between(t.resolve(this.anchor), t.resolve(this.head));
1527
+ return lt.between(t.resolve(this.anchor), t.resolve(this.head));
1528
1528
  }
1529
1529
  }
1530
- class ot extends W {
1530
+ class rt extends W {
1531
1531
  /**
1532
1532
  Create a node selection. Does not verify the validity of its
1533
1533
  argument.
@@ -1538,13 +1538,13 @@ class ot extends W {
1538
1538
  }
1539
1539
  map(t, e) {
1540
1540
  let { deleted: n, pos: o } = e.mapResult(this.anchor), r = t.resolve(o);
1541
- return n ? W.near(r) : new ot(r);
1541
+ return n ? W.near(r) : new rt(r);
1542
1542
  }
1543
1543
  content() {
1544
- return new D(R.from(this.node), 0, 0);
1544
+ return new A(J.from(this.node), 0, 0);
1545
1545
  }
1546
1546
  eq(t) {
1547
- return t instanceof ot && t.anchor == this.anchor;
1547
+ return t instanceof rt && t.anchor == this.anchor;
1548
1548
  }
1549
1549
  toJSON() {
1550
1550
  return { type: "node", anchor: this.anchor };
@@ -1558,13 +1558,13 @@ class ot extends W {
1558
1558
  static fromJSON(t, e) {
1559
1559
  if (typeof e.anchor != "number")
1560
1560
  throw new RangeError("Invalid input for NodeSelection.fromJSON");
1561
- return new ot(t.resolve(e.anchor));
1561
+ return new rt(t.resolve(e.anchor));
1562
1562
  }
1563
1563
  /**
1564
1564
  Create a node selection from non-resolved positions.
1565
1565
  */
1566
1566
  static create(t, e) {
1567
- return new ot(t.resolve(e));
1567
+ return new rt(t.resolve(e));
1568
1568
  }
1569
1569
  /**
1570
1570
  Determines whether the given node may be selected as a node
@@ -1574,8 +1574,8 @@ class ot extends W {
1574
1574
  return !t.isText && t.type.spec.selectable !== !1;
1575
1575
  }
1576
1576
  }
1577
- ot.prototype.visible = !1;
1578
- W.jsonID("node", ot);
1577
+ rt.prototype.visible = !1;
1578
+ W.jsonID("node", rt);
1579
1579
  class Ae {
1580
1580
  constructor(t) {
1581
1581
  this.anchor = t;
@@ -1586,18 +1586,18 @@ class Ae {
1586
1586
  }
1587
1587
  resolve(t) {
1588
1588
  let e = t.resolve(this.anchor), n = e.nodeAfter;
1589
- return n && ot.isSelectable(n) ? new ot(e) : W.near(e);
1589
+ return n && rt.isSelectable(n) ? new rt(e) : W.near(e);
1590
1590
  }
1591
1591
  }
1592
- class ut extends W {
1592
+ class dt extends W {
1593
1593
  /**
1594
1594
  Create an all-selection over the given document.
1595
1595
  */
1596
1596
  constructor(t) {
1597
1597
  super(t.resolve(0), t.resolve(t.content.size));
1598
1598
  }
1599
- replace(t, e = D.empty) {
1600
- if (e == D.empty) {
1599
+ replace(t, e = A.empty) {
1600
+ if (e == A.empty) {
1601
1601
  t.delete(0, t.doc.content.size);
1602
1602
  let n = W.atStart(t.doc);
1603
1603
  n.eq(t.selection) || t.setSelection(n);
@@ -1611,35 +1611,35 @@ class ut extends W {
1611
1611
  @internal
1612
1612
  */
1613
1613
  static fromJSON(t) {
1614
- return new ut(t);
1614
+ return new dt(t);
1615
1615
  }
1616
1616
  map(t) {
1617
- return new ut(t);
1617
+ return new dt(t);
1618
1618
  }
1619
1619
  eq(t) {
1620
- return t instanceof ut;
1620
+ return t instanceof dt;
1621
1621
  }
1622
1622
  getBookmark() {
1623
1623
  return Zo;
1624
1624
  }
1625
1625
  }
1626
- W.jsonID("all", ut);
1626
+ W.jsonID("all", dt);
1627
1627
  const Zo = {
1628
1628
  map() {
1629
1629
  return this;
1630
1630
  },
1631
1631
  resolve(s) {
1632
- return new ut(s);
1632
+ return new dt(s);
1633
1633
  }
1634
1634
  };
1635
1635
  function Ct(s, t, e, n, o, r = !1) {
1636
1636
  if (t.inlineContent)
1637
- return it.create(s, e);
1637
+ return lt.create(s, e);
1638
1638
  for (let u = n - (o > 0 ? 0 : 1); o > 0 ? u < t.childCount : u >= 0; u += o) {
1639
1639
  let a = t.child(u);
1640
1640
  if (a.isAtom) {
1641
- if (!r && ot.isSelectable(a))
1642
- return ot.create(s, e - (o < 0 ? a.nodeSize : 0));
1641
+ if (!r && rt.isSelectable(a))
1642
+ return rt.create(s, e - (o < 0 ? a.nodeSize : 0));
1643
1643
  } else {
1644
1644
  let d = Ct(s, a, e + o, o < 0 ? a.childCount : 0, o, r);
1645
1645
  if (d)
@@ -1654,7 +1654,7 @@ function rn(s, t, e) {
1654
1654
  if (n < t)
1655
1655
  return;
1656
1656
  let o = s.steps[n];
1657
- if (!(o instanceof at || o instanceof Et))
1657
+ if (!(o instanceof ct || o instanceof Et))
1658
1658
  return;
1659
1659
  let r = s.mapping.maps[n], u;
1660
1660
  r.forEach((a, d, m, h) => {
@@ -1773,15 +1773,15 @@ const nr = new er("commentGutter"), or = dn.create({
1773
1773
  if (u) return u;
1774
1774
  const h = o.dom;
1775
1775
  if (!h) return null;
1776
- const $ = h.closest?.(".umo-zoomable-container") || h.parentElement, L = $?.querySelector?.(".umo-zoomable-content") || $;
1777
- if (!L) return null;
1778
- const P = L.querySelector?.(".umo-watermark.umo-page-content") || L.querySelector?.(".umo-page-content") || null, _ = document.createElement("div");
1779
- if (_.className = "my-comment-gutter-root", (P || L).appendChild(_), u = _, !a && typeof n == "function") {
1776
+ const D = h.closest?.(".umo-zoomable-container") || h.parentElement, P = D?.querySelector?.(".umo-zoomable-content") || D;
1777
+ if (!P) return null;
1778
+ const H = P.querySelector?.(".umo-watermark.umo-page-content") || P.querySelector?.(".umo-page-content") || null, V = document.createElement("div");
1779
+ if (V.className = "my-comment-gutter-root", (H || P).appendChild(V), u = V, !a && typeof n == "function") {
1780
1780
  a = !0;
1781
1781
  try {
1782
1782
  n(u, o);
1783
- } catch (y) {
1784
- console.error("[CommentGutterExtension] mountGutter failed", y);
1783
+ } catch (k) {
1784
+ console.error("[CommentGutterExtension] mountGutter failed", k);
1785
1785
  }
1786
1786
  }
1787
1787
  return u;
@@ -1790,20 +1790,20 @@ const nr = new er("commentGutter"), or = dn.create({
1790
1790
  d();
1791
1791
  const h = o.dom;
1792
1792
  if (!h) return;
1793
- const $ = s?.(), P = t?.() || $ || h, _ = P.getBoundingClientRect(), y = typeof P.scrollTop == "number" ? P.scrollTop : 0, M = h.querySelectorAll(".comment-mark") || [], x = /* @__PURE__ */ new Map();
1794
- M.forEach((q) => {
1795
- const Z = fn(q);
1796
- if (!Z.length) return;
1797
- const E = q.getClientRects()[0] || q.getBoundingClientRect();
1798
- if (!E) return;
1799
- const mt = E.top - _.top + y, qt = E.height || 0;
1800
- for (const Nt of Z) {
1801
- const Ht = x.get(Nt);
1802
- (!Ht || mt < Ht.top) && x.set(Nt, { id: Nt, top: mt, height: qt });
1793
+ const D = s?.(), H = t?.() || D || h, V = H.getBoundingClientRect(), k = typeof H.scrollTop == "number" ? H.scrollTop : 0, y = h.querySelectorAll(".comment-mark") || [], E = /* @__PURE__ */ new Map();
1794
+ y.forEach((R) => {
1795
+ const K = fn(R);
1796
+ if (!K.length) return;
1797
+ const $ = R.getClientRects()[0] || R.getBoundingClientRect();
1798
+ if (!$) return;
1799
+ const Q = $.top - V.top + k, qt = $.height || 0;
1800
+ for (const Nt of K) {
1801
+ const Ht = E.get(Nt);
1802
+ (!Ht || Q < Ht.top) && E.set(Nt, { id: Nt, top: Q, height: qt });
1803
1803
  }
1804
1804
  });
1805
- const Y = Array.from(x.values());
1806
- e?.(Y);
1805
+ const b = Array.from(E.values());
1806
+ e?.(b);
1807
1807
  };
1808
1808
  return {
1809
1809
  update: () => {
@@ -1890,14 +1890,14 @@ function ar(s, t) {
1890
1890
  if (!o) return null;
1891
1891
  let r = null, u = null, a = null;
1892
1892
  return e.doc.descendants((d, m) => {
1893
- if (!d.isText || !d.marks.find((P) => P.type === o && so(P.attrs, n))) return;
1894
- const $ = m, L = m + d.nodeSize;
1893
+ if (!d.isText || !d.marks.find((H) => H.type === o && so(H.attrs, n))) return;
1894
+ const D = m, P = m + d.nodeSize;
1895
1895
  if (r == null) {
1896
- r = $, u = L, a = L;
1896
+ r = D, u = P, a = P;
1897
1897
  return;
1898
1898
  }
1899
- if (a != null && $ <= a + 1) {
1900
- u = Math.max(u ?? L, L), a = L;
1899
+ if (a != null && D <= a + 1) {
1900
+ u = Math.max(u ?? P, P), a = P;
1901
1901
  return;
1902
1902
  }
1903
1903
  }), r != null && u != null && r < u ? { from: r, to: u } : null;
@@ -1981,7 +1981,7 @@ const ur = { class: "app-layout" }, mr = { class: "editor-wrapper" }, dr = { cla
1981
1981
  (c, p) => ([4, 6, 8, 10].includes(p) ? "-" : "") + c.toString(16).padStart(2, "0")
1982
1982
  ).join("");
1983
1983
  }
1984
- const o = I(!1);
1984
+ const o = M(!1);
1985
1985
  function r() {
1986
1986
  o.value = document.fullscreenElement === pt.value;
1987
1987
  }
@@ -1999,16 +1999,16 @@ const ur = { class: "app-layout" }, mr = { class: "editor-wrapper" }, dr = { cla
1999
1999
  }), Ke(() => {
2000
2000
  document.removeEventListener("fullscreenchange", r);
2001
2001
  });
2002
- const a = s, d = e, m = X(() => !!a.enableCommentPanel), h = X(() => !!a.enableCommentBubble), $ = X(() => m.value || h.value), L = Xn();
2003
- function P() {
2004
- V()?.setEditable?.(!!a.editable);
2002
+ const a = s, d = e, m = Z(() => !!a.enableCommentPanel), h = Z(() => !!a.enableCommentBubble), D = Z(() => m.value || h.value), P = Xn();
2003
+ function H() {
2004
+ j()?.setEditable?.(!!a.editable);
2005
2005
  }
2006
- const _ = I(""), y = /* @__PURE__ */ new Map();
2007
- let M = null;
2008
- const x = (i) => {
2009
- clearTimeout(M), M = setTimeout(() => {
2010
- const c = i ?? V();
2011
- if (!c || E.value.length === 0 && y.size === 0) return;
2006
+ const V = M(""), k = /* @__PURE__ */ new Map();
2007
+ let y = null;
2008
+ const E = (i) => {
2009
+ clearTimeout(y), y = setTimeout(() => {
2010
+ const c = i ?? j();
2011
+ if (!c || $.value.length === 0 && k.size === 0) return;
2012
2012
  const p = /* @__PURE__ */ new Set();
2013
2013
  c.state.doc.descendants((f) => {
2014
2014
  f.marks.forEach((v) => {
@@ -2017,17 +2017,17 @@ const ur = { class: "app-layout" }, mr = { class: "editor-wrapper" }, dr = { cla
2017
2017
  p.add(C);
2018
2018
  });
2019
2019
  });
2020
- for (const [f, { comment: v }] of y)
2021
- p.has(f) && (y.delete(f), Nn(f), E.value.push(v));
2022
- E.value.filter(
2023
- (f) => !p.has(f.id) && !y.has(f.id)
2020
+ for (const [f, { comment: v }] of k)
2021
+ p.has(f) && (k.delete(f), Nn(f), $.value.push(v));
2022
+ $.value.filter(
2023
+ (f) => !p.has(f.id) && !k.has(f.id)
2024
2024
  ).forEach((f) => {
2025
- E.value = E.value.filter((v) => v.id !== f.id), y.set(f.id, { comment: { ...f } }), En(f.id);
2025
+ $.value = $.value.filter((v) => v.id !== f.id), k.set(f.id, { comment: { ...f } }), En(f.id);
2026
2026
  });
2027
2027
  }, 500);
2028
- }, Y = (i) => {
2029
- const c = i ?? V();
2030
- if (!c || E.value.length === 0) return;
2028
+ }, b = (i) => {
2029
+ const c = i ?? j();
2030
+ if (!c || $.value.length === 0) return;
2031
2031
  const p = /* @__PURE__ */ new Map();
2032
2032
  c.state.doc.descendants((g) => {
2033
2033
  g.marks.forEach((f) => {
@@ -2035,28 +2035,28 @@ const ur = { class: "app-layout" }, mr = { class: "editor-wrapper" }, dr = { cla
2035
2035
  const v = Ye(f.attrs);
2036
2036
  if (!v.length) return;
2037
2037
  const C = f.attrs.commentColors && typeof f.attrs.commentColors == "object" ? f.attrs.commentColors : {};
2038
- for (const S of v) {
2039
- const b = C[S] != null ? C[S] : f.attrs.colorIndex ?? 0, w = Number.parseInt(b, 10), K = Number.isNaN(w) || !Number.isFinite(w) ? 0 : (w % dt + dt) % dt;
2040
- p.set(S, K);
2038
+ for (const T of v) {
2039
+ const x = C[T] != null ? C[T] : f.attrs.colorIndex ?? 0, w = Number.parseInt(x, 10), Y = Number.isNaN(w) || !Number.isFinite(w) ? 0 : (w % ft + ft) % ft;
2040
+ p.set(T, Y);
2041
2041
  }
2042
2042
  });
2043
- }), p.size !== 0 && (E.value = E.value.map(
2043
+ }), p.size !== 0 && ($.value = $.value.map(
2044
2044
  (g) => p.has(g.id) ? { ...g, colorIndex: p.get(g.id) } : g
2045
2045
  ));
2046
- }, q = I(null);
2047
- let Z = null;
2048
- ct(
2049
- () => q.value,
2050
- () => P(),
2046
+ }, R = M(null);
2047
+ let K = null;
2048
+ mt(
2049
+ () => R.value,
2050
+ () => H(),
2051
2051
  { immediate: !0 }
2052
- ), ct(
2052
+ ), mt(
2053
2053
  () => a.editable,
2054
- () => P(),
2054
+ () => H(),
2055
2055
  { immediate: !0 }
2056
2056
  );
2057
2057
  const {
2058
- comments: E,
2059
- activeCommentId: mt,
2058
+ comments: $,
2059
+ activeCommentId: Q,
2060
2060
  addComment: qt,
2061
2061
  deleteComment: Nt,
2062
2062
  resolveComment: Ht,
@@ -2067,10 +2067,10 @@ const ur = { class: "app-layout" }, mr = { class: "editor-wrapper" }, dr = { cla
2067
2067
  queueDelete: En,
2068
2068
  cancelPendingDelete: Nn
2069
2069
  } = io();
2070
- ct(mt, (i) => {
2070
+ mt(Q, (i) => {
2071
2071
  d("activeCommentChange", i);
2072
2072
  });
2073
- const pt = I(null), ce = I([]), Mn = () => pt.value, In = () => pt.value?.querySelector?.(".umo-scrollable-container") || pt.value?.querySelector?.(".umo-scrollable") || pt.value, On = (i, c) => {
2073
+ const pt = M(null), ce = M([]), Mn = () => pt.value, In = () => pt.value?.querySelector?.(".umo-scrollable-container") || pt.value?.querySelector?.(".umo-scrollable") || pt.value, On = (i, c) => {
2074
2074
  if (!h.value || !i || i.__gutterMounted) return;
2075
2075
  i.__gutterMounted = !0, no({
2076
2076
  setup() {
@@ -2083,61 +2083,61 @@ const ur = { class: "app-layout" }, mr = { class: "editor-wrapper" }, dr = { cla
2083
2083
  };
2084
2084
  return () => oo(Ko, {
2085
2085
  anchors: ce.value,
2086
- comments: E.value,
2087
- activeCommentId: mt.value,
2086
+ comments: $.value,
2087
+ activeCommentId: Q.value,
2088
2088
  formatTime: ae,
2089
2089
  onActivate: g
2090
2090
  });
2091
2091
  }
2092
2092
  }).mount(i);
2093
- }, ue = I(!1), me = I(""), An = I(""), Mt = I(!1);
2093
+ }, ue = M(!1), me = M(""), An = M(""), Mt = M(!1);
2094
2094
  function De(i) {
2095
2095
  return (String(i ?? "").trim() || "文档").replace(/[\\/:*?"<>|]/g, "_");
2096
2096
  }
2097
2097
  const $e = async (i) => {
2098
2098
  if (Mt.value) return;
2099
- const c = V();
2099
+ const c = j();
2100
2100
  Mt.value = !0;
2101
- const p = typeof i == "string" && i.trim() !== "" ? i : null, g = De(p ?? (_.value || "文档"));
2101
+ const p = typeof i == "string" && i.trim() !== "" ? i : null, g = De(p ?? (V.value || "文档"));
2102
2102
  try {
2103
2103
  const f = c?.getJSON?.();
2104
2104
  if (f)
2105
- await lo(f, E.value, g);
2105
+ await lo(f, $.value, g);
2106
2106
  else {
2107
- const v = c?.getHTML() ?? q.value?.getHTML();
2107
+ const v = c?.getHTML() ?? R.value?.getHTML();
2108
2108
  if (!v) throw new Error("编辑器内容为空,无法导出");
2109
- await Xe(v, E.value, g);
2109
+ await Xe(v, $.value, g);
2110
2110
  }
2111
2111
  } catch (f) {
2112
2112
  try {
2113
- const v = c?.getHTML() ?? q.value?.getHTML();
2113
+ const v = c?.getHTML() ?? R.value?.getHTML();
2114
2114
  if (!v) throw f;
2115
- await Xe(v, E.value, g);
2115
+ await Xe(v, $.value, g);
2116
2116
  } catch (v) {
2117
2117
  console.error("导出 Word 失败:", v), alert("导出 Word 失败,请稍后重试");
2118
2118
  }
2119
2119
  } finally {
2120
2120
  Mt.value = !1;
2121
2121
  }
2122
- }, It = I(!1), ze = async (i) => {
2122
+ }, It = M(!1), ze = async (i) => {
2123
2123
  if (It.value) return;
2124
- const c = V();
2124
+ const c = j();
2125
2125
  It.value = !0;
2126
- const p = typeof i == "string" && i.trim() !== "" ? i : null, g = De(p ?? (_.value || "文档"));
2126
+ const p = typeof i == "string" && i.trim() !== "" ? i : null, g = De(p ?? (V.value || "文档"));
2127
2127
  try {
2128
2128
  const f = c?.getJSON?.();
2129
2129
  let v;
2130
2130
  if (f)
2131
- v = await ao(f, E.value, g);
2131
+ v = await ao(f, $.value, g);
2132
2132
  else {
2133
- const C = c?.getHTML() ?? q.value?.getHTML();
2133
+ const C = c?.getHTML() ?? R.value?.getHTML();
2134
2134
  if (!C) throw new Error("编辑器内容为空,无法导出");
2135
2135
  v = await Qe(C, g);
2136
2136
  }
2137
2137
  Ze(v, `${g}.docx`);
2138
2138
  } catch (f) {
2139
2139
  try {
2140
- const v = c?.getHTML() ?? q.value?.getHTML();
2140
+ const v = c?.getHTML() ?? R.value?.getHTML();
2141
2141
  if (!v) throw f;
2142
2142
  const C = await Qe(v, g);
2143
2143
  Ze(C, `${g}.docx`);
@@ -2147,15 +2147,15 @@ const ur = { class: "app-layout" }, mr = { class: "editor-wrapper" }, dr = { cla
2147
2147
  } finally {
2148
2148
  It.value = !1;
2149
2149
  }
2150
- }, Re = I(null), Ut = I(!1), Dn = () => {
2150
+ }, Re = M(null), Ut = M(!1), Dn = () => {
2151
2151
  Re.value?.click();
2152
2152
  }, Je = async (i) => {
2153
2153
  Ut.value = !0;
2154
2154
  try {
2155
2155
  const c = qe.value?.onFileUpload, p = typeof c == "function" ? {
2156
2156
  uploadImageFile: async (w) => {
2157
- const K = await c(w);
2158
- return { url: K?.url ?? "", id: K?.id };
2157
+ const Y = await c(w);
2158
+ return { url: Y?.url ?? "", id: Y?.id };
2159
2159
  }
2160
2160
  } : void 0;
2161
2161
  let g = null;
@@ -2164,9 +2164,9 @@ const ur = { class: "app-layout" }, mr = { class: "editor-wrapper" }, dr = { cla
2164
2164
  } catch {
2165
2165
  g = await mo(i, p);
2166
2166
  }
2167
- let f = V();
2167
+ let f = j();
2168
2168
  for (let w = 0; w < 40 && !f; w++)
2169
- await new Promise((K) => setTimeout(K, 50)), f = V();
2169
+ await new Promise((Y) => setTimeout(Y, 50)), f = j();
2170
2170
  if (!f) throw new Error("编辑器未就绪");
2171
2171
  f.commands.setContent(g, !1);
2172
2172
  const v = f.view.dom;
@@ -2175,16 +2175,16 @@ const ur = { class: "app-layout" }, mr = { class: "editor-wrapper" }, dr = { cla
2175
2175
  if (C.length === 0)
2176
2176
  return;
2177
2177
  await new Promise((w) => setTimeout(w, 100));
2178
- const S = [];
2178
+ const T = [];
2179
2179
  for (const w of C)
2180
- w.selectedText && S.push({
2180
+ w.selectedText && T.push({
2181
2181
  id: n(),
2182
2182
  selectedText: w.selectedText,
2183
2183
  note: w.note,
2184
2184
  author: w.author || "导入",
2185
2185
  preferDel: !!w.containsDelText
2186
2186
  });
2187
- const { applied: b } = await Le(f, S, {
2187
+ const { applied: x } = await Le(f, T, {
2188
2188
  defaultAuthor: "导入",
2189
2189
  source: bt
2190
2190
  });
@@ -2221,88 +2221,88 @@ const ur = { class: "app-layout" }, mr = { class: "editor-wrapper" }, dr = { cla
2221
2221
  const Jn = (i, c, p, g = 0, f = {}) => {
2222
2222
  const v = c.trim();
2223
2223
  if (!v) return null;
2224
- const { doc: C } = i.state, S = Ot(c);
2225
- if (!S) return null;
2226
- const b = !!f.preferDel, w = Number.isFinite(Number(f.preferFrom)) ? Number(f.preferFrom) : 0, K = f.source === bt ? bt : $t, gt = (z) => !z || !z.isText ? !1 : (z.marks || []).some((k) => {
2227
- if (!k || !k.type) return !1;
2228
- if (k.type.name === "strike") return !0;
2229
- if (k.type.name === "textStyle") {
2230
- const O = k.attrs?.style;
2224
+ const { doc: C } = i.state, T = Ot(c);
2225
+ if (!T) return null;
2226
+ const x = !!f.preferDel, w = Number.isFinite(Number(f.preferFrom)) ? Number(f.preferFrom) : 0, Y = f.source === bt ? bt : $t, gt = (z) => !z || !z.isText ? !1 : (z.marks || []).some((_) => {
2227
+ if (!_ || !_.type) return !1;
2228
+ if (_.type.name === "strike") return !0;
2229
+ if (_.type.name === "textStyle") {
2230
+ const O = _.attrs?.style;
2231
2231
  return typeof O == "string" && /line-through/i.test(O);
2232
2232
  }
2233
2233
  return !1;
2234
2234
  }), _t = (z) => !z || z.length !== 1 ? null : z[0] || null, vt = (z) => {
2235
- const F = [];
2236
- return C.descendants((k, O) => {
2237
- if (k.isText && !(z && !gt(k))) {
2238
- if (k.text && k.text.includes(v)) {
2235
+ const L = [];
2236
+ return C.descendants((_, O) => {
2237
+ if (_.isText && !(z && !gt(_))) {
2238
+ if (_.text && _.text.includes(v)) {
2239
2239
  let U = 0;
2240
2240
  for (; ; ) {
2241
- const J = k.text.indexOf(v, U);
2242
- if (J === -1) break;
2243
- F.push({ from: O + J, to: O + J + v.length }), U = J + 1;
2241
+ const B = _.text.indexOf(v, U);
2242
+ if (B === -1) break;
2243
+ L.push({ from: O + B, to: O + B + v.length }), U = B + 1;
2244
2244
  }
2245
2245
  return;
2246
2246
  }
2247
- if (k.text) {
2248
- const U = Ot(k.text);
2249
- if (U && U.includes(S)) {
2250
- let J = 0;
2247
+ if (_.text) {
2248
+ const U = Ot(_.text);
2249
+ if (U && U.includes(T)) {
2250
+ let B = 0;
2251
2251
  for (; ; ) {
2252
- const G = U.indexOf(S, J);
2252
+ const G = U.indexOf(T, B);
2253
2253
  if (G === -1) break;
2254
- const st = O + Pe(k.text, G), tt = O + Pe(k.text, G + S.length);
2255
- F.push({ from: st, to: tt }), J = G + 1;
2254
+ const it = O + Pe(_.text, G), et = O + Pe(_.text, G + T.length);
2255
+ L.push({ from: it, to: et }), B = G + 1;
2256
2256
  }
2257
2257
  }
2258
2258
  }
2259
2259
  }
2260
- }), F;
2261
- }, rt = (z, F) => {
2262
- const k = [];
2263
- if (C.descendants((B, nt) => {
2264
- if (B.isBlock && k.length > 0 && k.push({ char: " ", pos: null }), B.type.name === "hardBreak" && k.push({ char: " ", pos: null }), B.isText) {
2265
- if (F && !gt(B)) return;
2266
- for (let et = 0; et < B.text.length; et++)
2267
- k.push({ char: B.text[et], pos: nt + et });
2260
+ }), L;
2261
+ }, st = (z, L) => {
2262
+ const _ = [];
2263
+ if (C.descendants((F, ot) => {
2264
+ if (F.isBlock && _.length > 0 && _.push({ char: " ", pos: null }), F.type.name === "hardBreak" && _.push({ char: " ", pos: null }), F.isText) {
2265
+ if (L && !gt(F)) return;
2266
+ for (let nt = 0; nt < F.text.length; nt++)
2267
+ _.push({ char: F.text[nt], pos: ot + nt });
2268
2268
  }
2269
- }), !k.length) return [];
2269
+ }), !_.length) return [];
2270
2270
  const O = [];
2271
- let U = "", J = !1;
2272
- for (let B = 0; B < k.length; B++) {
2273
- const nt = Fe(k[B].char);
2274
- nt === " " ? J || (U += " ", O.push(B), J = !0) : (U += nt, O.push(B), J = !1);
2271
+ let U = "", B = !1;
2272
+ for (let F = 0; F < _.length; F++) {
2273
+ const ot = Fe(_[F].char);
2274
+ ot === " " ? B || (U += " ", O.push(F), B = !0) : (U += ot, O.push(F), B = !1);
2275
2275
  }
2276
2276
  const G = Ot(z);
2277
2277
  if (!G) return [];
2278
- const st = [];
2279
- let tt = 0;
2280
- for (; tt = U.indexOf(G, tt), tt !== -1; ) {
2281
- const B = k[O[tt]], nt = k[O[tt + G.length - 1]];
2282
- B && B.pos !== null && nt && nt.pos !== null && st.push({ from: B.pos, to: nt.pos + 1 }), tt = tt + 1;
2278
+ const it = [];
2279
+ let et = 0;
2280
+ for (; et = U.indexOf(G, et), et !== -1; ) {
2281
+ const F = _[O[et]], ot = _[O[et + G.length - 1]];
2282
+ F && F.pos !== null && ot && ot.pos !== null && it.push({ from: F.pos, to: ot.pos + 1 }), et = et + 1;
2283
2283
  }
2284
- if (st.length > 0) return st;
2284
+ if (it.length > 0) return it;
2285
2285
  const Dt = G.replace(/ /g, "");
2286
2286
  if (Dt) {
2287
- const B = [];
2288
- let nt = "";
2289
- for (let lt = 0; lt < O.length; lt++)
2290
- U[lt] !== " " && (nt += U[lt], B.push(lt));
2291
- let et = 0;
2292
- for (; et = nt.indexOf(Dt, et), et !== -1; ) {
2293
- const lt = k[O[B[et]]], ye = k[O[B[et + Dt.length - 1]]];
2294
- lt && lt.pos !== null && ye && ye.pos !== null && st.push({ from: lt.pos, to: ye.pos + 1 }), et = et + 1;
2287
+ const F = [];
2288
+ let ot = "";
2289
+ for (let at = 0; at < O.length; at++)
2290
+ U[at] !== " " && (ot += U[at], F.push(at));
2291
+ let nt = 0;
2292
+ for (; nt = ot.indexOf(Dt, nt), nt !== -1; ) {
2293
+ const at = _[O[F[nt]]], ye = _[O[F[nt + Dt.length - 1]]];
2294
+ at && at.pos !== null && ye && ye.pos !== null && it.push({ from: at.pos, to: ye.pos + 1 }), nt = nt + 1;
2295
2295
  }
2296
2296
  }
2297
- return st;
2297
+ return it;
2298
2298
  }, Qt = Be(p);
2299
2299
  if (Qt) {
2300
- const z = (J) => (J || []).filter((G) => typeof G?.from == "number" && G.from >= w), F = vt(!1), k = rt(S, !1);
2300
+ const z = (B) => (B || []).filter((G) => typeof G?.from == "number" && G.from >= w), L = vt(!1), _ = st(T, !1);
2301
2301
  let O = !1, U = !1;
2302
2302
  try {
2303
- const J = C.textBetween(0, C.content.size, `
2303
+ const B = C.textBetween(0, C.content.size, `
2304
2304
  `, " ");
2305
- O = J.includes(v), U = Ot(J).includes(S);
2305
+ O = B.includes(v), U = Ot(B).includes(T);
2306
2306
  } catch {
2307
2307
  }
2308
2308
  console.log("[comment-match]", p.slice(0, 8), {
@@ -2310,56 +2310,56 @@ const ur = { class: "app-layout" }, mr = { class: "editor-wrapper" }, dr = { cla
2310
2310
  textHead: v.slice(0, 80),
2311
2311
  inDocRaw: O,
2312
2312
  inDocNorm: U,
2313
- node: { n: F.length, afterPrefer: z(F).length },
2314
- across: { n: k.length, afterPrefer: z(k).length }
2313
+ node: { n: L.length, afterPrefer: z(L).length },
2314
+ across: { n: _.length, afterPrefer: z(_).length }
2315
2315
  });
2316
2316
  }
2317
- if (b) {
2318
- const z = vt(!0), F = Gt(i.state, z, w);
2319
- if (F)
2320
- return i.chain().setTextSelection(F).addComment(p, g, K).run(), F;
2317
+ if (x) {
2318
+ const z = vt(!0), L = Gt(i.state, z, w);
2319
+ if (L)
2320
+ return i.chain().setTextSelection(L).addComment(p, g, Y).run(), L;
2321
2321
  }
2322
2322
  const Wn = vt(!1), ge = Gt(i.state, Wn, w);
2323
2323
  if (ge)
2324
- return i.chain().setTextSelection(ge).addComment(p, g, K).run(), ge;
2325
- if (b) {
2326
- const z = rt(S, !0), F = Gt(i.state, z, w);
2327
- if (F)
2328
- return i.chain().setTextSelection(F).addComment(p, g, K).run(), F;
2324
+ return i.chain().setTextSelection(ge).addComment(p, g, Y).run(), ge;
2325
+ if (x) {
2326
+ const z = st(T, !0), L = Gt(i.state, z, w);
2327
+ if (L)
2328
+ return i.chain().setTextSelection(L).addComment(p, g, Y).run(), L;
2329
2329
  }
2330
- let Zt = rt(S, !1);
2330
+ let Zt = st(T, !1);
2331
2331
  const ve = Gt(i.state, Zt, w);
2332
2332
  if (ve)
2333
- return i.chain().setTextSelection(ve).addComment(p, g, K).run(), ve;
2333
+ return i.chain().setTextSelection(ve).addComment(p, g, Y).run(), ve;
2334
2334
  if (f?.disablePrefixFallback) return null;
2335
- const Ve = Math.min(30, Math.max(8, Math.floor(S.length * 0.6)));
2336
- if (Ve < S.length) {
2337
- const z = S.slice(0, Ve);
2338
- if (b) {
2339
- const O = rt(z, !0), U = O.filter((G) => typeof G?.from == "number" && G.from >= w), J = _t(U) ?? _t(O);
2340
- if (J)
2341
- return Qt && console.log("[comment-match] ✅ 策略三(strike前缀)", p.slice(0, 8), { prefix: z, unique: J }), i.chain().setTextSelection(J).addComment(p, g, K).run(), J;
2335
+ const Ve = Math.min(30, Math.max(8, Math.floor(T.length * 0.6)));
2336
+ if (Ve < T.length) {
2337
+ const z = T.slice(0, Ve);
2338
+ if (x) {
2339
+ const O = st(z, !0), U = O.filter((G) => typeof G?.from == "number" && G.from >= w), B = _t(U) ?? _t(O);
2340
+ if (B)
2341
+ return Qt && console.log("[comment-match] ✅ 策略三(strike前缀)", p.slice(0, 8), { prefix: z, unique: B }), i.chain().setTextSelection(B).addComment(p, g, Y).run(), B;
2342
2342
  }
2343
- Zt = rt(z, !1);
2344
- const F = Zt.filter((O) => typeof O?.from == "number" && O.from >= w), k = _t(F) ?? _t(Zt);
2345
- if (k)
2346
- return Qt && console.log("[comment-match] ✅ 策略三(前缀)", p.slice(0, 8), { prefix: z, unique: k }), i.chain().setTextSelection(k).addComment(p, g, K).run(), k;
2343
+ Zt = st(z, !1);
2344
+ const L = Zt.filter((O) => typeof O?.from == "number" && O.from >= w), _ = _t(L) ?? _t(Zt);
2345
+ if (_)
2346
+ return Qt && console.log("[comment-match] ✅ 策略三(前缀)", p.slice(0, 8), { prefix: z, unique: _ }), i.chain().setTextSelection(_).addComment(p, g, Y).run(), _;
2347
2347
  }
2348
2348
  try {
2349
2349
  const z = i.state.doc.textBetween(0, i.state.doc.content.size, `
2350
- `, " "), F = Ot(z), k = F.includes(S), O = S.slice(0, Math.min(30, S.length)), U = F.includes(O), J = {
2350
+ `, " "), L = Ot(z), _ = L.includes(T), O = T.slice(0, Math.min(30, T.length)), U = L.includes(O), B = {
2351
2351
  commentId: p,
2352
2352
  preferFrom: w,
2353
2353
  searchPreview: String(c).slice(0, 80),
2354
- normLen: S.length,
2355
- hasInDocNorm: k,
2354
+ normLen: T.length,
2355
+ hasInDocNorm: _,
2356
2356
  hasPrefixInDocNorm: U
2357
2357
  };
2358
2358
  if (Qt) {
2359
- const G = (Dt) => (Dt || []).filter((B) => typeof B?.from == "number" && B.from >= w), st = vt(!1), tt = rt(S, !1);
2360
- console.warn("[comment-match] 未命中", J, {
2361
- node: { n: st.length, afterPrefer: G(st).length },
2362
- across: { n: tt.length, afterPrefer: G(tt).length }
2359
+ const G = (Dt) => (Dt || []).filter((F) => typeof F?.from == "number" && F.from >= w), it = vt(!1), et = st(T, !1);
2360
+ console.warn("[comment-match] 未命中", B, {
2361
+ node: { n: it.length, afterPrefer: G(it).length },
2362
+ across: { n: et.length, afterPrefer: G(et).length }
2363
2363
  });
2364
2364
  }
2365
2365
  } catch {
@@ -2369,38 +2369,38 @@ const ur = { class: "app-layout" }, mr = { class: "editor-wrapper" }, dr = { cla
2369
2369
  async function Le(i, c, p = {}) {
2370
2370
  const g = p.defaultAuthor ?? "智能审核", f = p.source === bt ? bt : $t;
2371
2371
  let v = 0, C = 0;
2372
- const S = [];
2373
- for (const b of c) {
2374
- const w = b.selectedText;
2372
+ const T = [];
2373
+ for (const x of c) {
2374
+ const w = x.selectedText;
2375
2375
  if (typeof w != "string" || !w.trim()) {
2376
- S.push({ selectedTextPreview: "", reason: "empty_text" });
2376
+ T.push({ selectedTextPreview: "", reason: "empty_text" });
2377
2377
  continue;
2378
2378
  }
2379
- const K = b.id ?? n();
2379
+ const Y = x.id ?? n();
2380
2380
  let gt;
2381
- b.colorIndex != null && !Number.isNaN(Number(b.colorIndex)) ? gt = (Number(b.colorIndex) % dt + dt) % dt : gt = (E.value.length + v) % dt;
2382
- const _t = b.source === bt || b.source === $t ? b.source : f, vt = Jn(i, w, K, gt, {
2383
- preferDel: !!b.preferDel,
2381
+ x.colorIndex != null && !Number.isNaN(Number(x.colorIndex)) ? gt = (Number(x.colorIndex) % ft + ft) % ft : gt = ($.value.length + v) % ft;
2382
+ const _t = x.source === bt || x.source === $t ? x.source : f, vt = Jn(i, w, Y, gt, {
2383
+ preferDel: !!x.preferDel,
2384
2384
  source: _t,
2385
2385
  preferFrom: C
2386
2386
  });
2387
2387
  if (vt)
2388
2388
  C = Math.max(C, Number(vt.to) || C), await qt({
2389
- id: K,
2389
+ id: Y,
2390
2390
  selectedText: w,
2391
- note: b.note,
2392
- author: b.author ?? g,
2391
+ note: x.note,
2392
+ author: x.author ?? g,
2393
2393
  colorIndex: gt
2394
2394
  }), v++;
2395
2395
  else {
2396
- const rt = String(w).slice(0, 50);
2397
- S.push({ selectedTextPreview: rt, reason: "no_match" }), Be(K) && console.warn("[批注] 文字无法匹配而跳过:", { preview: rt, note: String(b.note ?? "").slice(0, 30) });
2396
+ const st = String(w).slice(0, 50);
2397
+ T.push({ selectedTextPreview: st, reason: "no_match" }), Be(Y) && console.warn("[批注] 文字无法匹配而跳过:", { preview: st, note: String(x.note ?? "").slice(0, 30) });
2398
2398
  }
2399
2399
  }
2400
2400
  return {
2401
2401
  applied: v,
2402
2402
  skipped: c.length - v,
2403
- skippedItems: S
2403
+ skippedItems: T
2404
2404
  };
2405
2405
  }
2406
2406
  function Pe(i, c) {
@@ -2417,8 +2417,8 @@ const ur = { class: "app-layout" }, mr = { class: "editor-wrapper" }, dr = { cla
2417
2417
  }
2418
2418
  return i.length;
2419
2419
  }
2420
- const Wt = I(!1), de = I(""), Vt = I(!1), Bn = () => {
2421
- const i = q.value?.getHTML();
2420
+ const Wt = M(!1), de = M(""), Vt = M(!1), Bn = () => {
2421
+ const i = R.value?.getHTML();
2422
2422
  if (!i) {
2423
2423
  alert("编辑器内容为空,无法导出");
2424
2424
  return;
@@ -2430,8 +2430,8 @@ const ur = { class: "app-layout" }, mr = { class: "editor-wrapper" }, dr = { cla
2430
2430
  } catch {
2431
2431
  alert("复制失败,请手动选中后复制");
2432
2432
  }
2433
- }, Kt = I(!1), Ln = async () => {
2434
- const i = q.value?.getHTML();
2433
+ }, Kt = M(!1), Ln = async () => {
2434
+ const i = R.value?.getHTML();
2435
2435
  if (!i) {
2436
2436
  alert("编辑器内容为空");
2437
2437
  return;
@@ -2441,9 +2441,9 @@ const ur = { class: "app-layout" }, mr = { class: "editor-wrapper" }, dr = { cla
2441
2441
  } catch {
2442
2442
  alert("复制失败,请手动操作");
2443
2443
  }
2444
- }, At = I(!1), Pn = async () => {
2444
+ }, At = M(!1), Pn = async () => {
2445
2445
  if (At.value) return;
2446
- const c = V()?.getJSON?.();
2446
+ const c = j()?.getJSON?.();
2447
2447
  if (!c) {
2448
2448
  alert("编辑器内容为空,无法导出");
2449
2449
  return;
@@ -2456,14 +2456,14 @@ const ur = { class: "app-layout" }, mr = { class: "editor-wrapper" }, dr = { cla
2456
2456
  } finally {
2457
2457
  At.value = !1;
2458
2458
  }
2459
- }, jt = I(!1), fe = I(""), Yt = I(!1), qn = async () => {
2459
+ }, jt = M(!1), fe = M(""), Yt = M(!1), qn = async () => {
2460
2460
  try {
2461
2461
  await navigator.clipboard.writeText(fe.value), Yt.value = !0, setTimeout(() => Yt.value = !1, 2e3);
2462
2462
  } catch {
2463
2463
  alert("复制失败,请手动选中后复制");
2464
2464
  }
2465
2465
  };
2466
- I(!1), I("http://your-internal-ai-model/api/annotation");
2466
+ M(!1), M("http://your-internal-ai-model/api/annotation");
2467
2467
  const Hn = () => {
2468
2468
  const i = [co, lr];
2469
2469
  return h.value ? i.push(
@@ -2477,7 +2477,7 @@ const ur = { class: "app-layout" }, mr = { class: "editor-wrapper" }, dr = { cla
2477
2477
  debug: !1
2478
2478
  })
2479
2479
  ) : ce.value = [], i;
2480
- }, Un = X(() => ({
2480
+ }, Un = Z(() => ({
2481
2481
  // 文件上传:由宿主接管(emit + 可选 await 回调)
2482
2482
  // onFileUpload: async (file) => {
2483
2483
  // if (!file) {
@@ -2496,23 +2496,23 @@ const ur = { class: "app-layout" }, mr = { class: "editor-wrapper" }, dr = { cla
2496
2496
  // return await requestSave({ silent: true })
2497
2497
  // },
2498
2498
  onChanged: ({ editor: i }) => {
2499
- x(i);
2499
+ E(i);
2500
2500
  }
2501
- })), qe = X(() => {
2502
- const i = L ?? {}, { class: c, style: p, ...g } = i ?? {}, f = Array.isArray(g.extensions) ? g.extensions : [], v = Hn(), C = [...f, ...v], S = g.cdnUrl ?? "/node_modules/@umoteam/editor-external", b = {
2501
+ })), qe = Z(() => {
2502
+ const i = P ?? {}, { class: c, style: p, ...g } = i ?? {}, f = Array.isArray(g.extensions) ? g.extensions : [], v = Hn(), C = [...f, ...v], T = g.cdnUrl ?? "/node_modules/@umoteam/editor-external", x = {
2503
2503
  ...g,
2504
- cdnUrl: S,
2504
+ cdnUrl: T,
2505
2505
  disableExtensions: ["import-word"],
2506
2506
  extensions: C
2507
2507
  }, w = Un.value;
2508
- return b.onChanged == null && w?.onChanged && (b.onChanged = w.onChanged), b.onSave == null && w?.onSave && (b.onSave = w.onSave), b.onFileUpload == null && w?.onFileUpload && (b.onFileUpload = w.onFileUpload), b.onFileDelete == null && w?.onFileDelete && (b.onFileDelete = w.onFileDelete), b;
2508
+ return x.onChanged == null && w?.onChanged && (x.onChanged = w.onChanged), x.onSave == null && w?.onSave && (x.onSave = w.onSave), x.onFileUpload == null && w?.onFileUpload && (x.onFileUpload = w.onFileUpload), x.onFileDelete == null && w?.onFileDelete && (x.onFileDelete = w.onFileDelete), x;
2509
2509
  });
2510
- function V() {
2511
- const i = q.value;
2510
+ function j() {
2511
+ const i = R.value;
2512
2512
  return i ? typeof i.useEditor == "function" ? i.useEditor() : i.editor ? i.editor : null : null;
2513
2513
  }
2514
2514
  const Xt = (i = "html") => {
2515
- const c = V();
2515
+ const c = j();
2516
2516
  return c ? i === "json" ? c.getJSON?.() ?? null : i === "text" ? c.state?.doc?.textBetween?.(0, c.state.doc.content.size, `
2517
2517
  `, " ") ?? "" : c.getHTML?.() ?? null : null;
2518
2518
  };
@@ -2521,14 +2521,14 @@ const ur = { class: "app-layout" }, mr = { class: "editor-wrapper" }, dr = { cla
2521
2521
  getHTML: () => Xt("html"),
2522
2522
  getJSON: () => Xt("json"),
2523
2523
  getText: () => Xt("text"),
2524
- getEditor: () => V(),
2524
+ getEditor: () => j(),
2525
2525
  importDocxFile: $n,
2526
2526
  setContent: (i, c = !1) => {
2527
- const p = V();
2527
+ const p = j();
2528
2528
  return p?.commands?.setContent ? (p.commands.setContent(i, !!c), !0) : !1;
2529
2529
  },
2530
2530
  setComments: async (i, c) => {
2531
- const p = V(), g = Array.isArray(i) ? i : [];
2531
+ const p = j(), g = Array.isArray(i) ? i : [];
2532
2532
  if (!p)
2533
2533
  return {
2534
2534
  ok: !1,
@@ -2537,16 +2537,16 @@ const ur = { class: "app-layout" }, mr = { class: "editor-wrapper" }, dr = { cla
2537
2537
  skippedItems: []
2538
2538
  };
2539
2539
  if (c?.replace) {
2540
- const S = E.value.map((b) => b.id);
2541
- for (const b of S)
2542
- p.commands.removeComment(b);
2543
- Tn(), y.clear(), le(null), await Sn(void 0, []);
2540
+ const T = $.value.map((x) => x.id);
2541
+ for (const x of T)
2542
+ p.commands.removeComment(x);
2543
+ Tn(), k.clear(), le(null), await Sn(void 0, []);
2544
2544
  }
2545
2545
  const { applied: f, skipped: v, skippedItems: C } = await Le(p, g, {
2546
2546
  defaultAuthor: "智能审核",
2547
2547
  source: $t
2548
2548
  });
2549
- return await Ie(), Y(p), x(p), {
2549
+ return await Ie(), b(p), E(p), {
2550
2550
  ok: !0,
2551
2551
  applied: f,
2552
2552
  skipped: v,
@@ -2559,12 +2559,12 @@ const ur = { class: "app-layout" }, mr = { class: "editor-wrapper" }, dr = { cla
2559
2559
  const g = new Map(
2560
2560
  i.map((f) => [String(f?.id ?? "").trim(), String(f?.note ?? "").trim()]).filter(([f, v]) => f && v)
2561
2561
  );
2562
- g.size && (E.value = E.value.map((f) => {
2562
+ g.size && ($.value = $.value.map((f) => {
2563
2563
  const v = String(f?.id ?? "").trim(), C = g.get(v);
2564
2564
  return !C || p && String(f.note ?? "").trim() ? f : { ...f, note: C };
2565
2565
  }));
2566
2566
  },
2567
- activateCommentInEditor: (i) => un(V(), i),
2567
+ activateCommentInEditor: (i) => un(j(), i),
2568
2568
  exportWord: $e,
2569
2569
  exportWordBlob: ze
2570
2570
  });
@@ -2575,9 +2575,9 @@ const ur = { class: "app-layout" }, mr = { class: "editor-wrapper" }, dr = { cla
2575
2575
  });
2576
2576
  }
2577
2577
  const Gn = async (i) => {
2578
- const c = V();
2578
+ const c = j();
2579
2579
  if (!c) return;
2580
- const p = n(), g = E.value.length % dt;
2580
+ const p = n(), g = $.value.length % ft;
2581
2581
  c.commands.addComment(p, g, $t);
2582
2582
  try {
2583
2583
  await qt({ id: p, selectedText: me.value, note: i, colorIndex: g });
@@ -2586,13 +2586,13 @@ const ur = { class: "app-layout" }, mr = { class: "editor-wrapper" }, dr = { cla
2586
2586
  }
2587
2587
  ue.value = !1, me.value = "";
2588
2588
  }, Ue = async (i) => {
2589
- V()?.commands.removeComment(i), await Nt(i);
2589
+ j()?.commands.removeComment(i), await Nt(i);
2590
2590
  }, Ge = async (i) => {
2591
2591
  await Ht(i);
2592
2592
  }, We = (i) => {
2593
2593
  le(i), he(i);
2594
2594
  }, he = (i) => {
2595
- un(V(), i);
2595
+ un(j(), i);
2596
2596
  }, pe = (i) => {
2597
2597
  const c = i.target;
2598
2598
  if (!(c instanceof Element)) return;
@@ -2600,33 +2600,33 @@ const ur = { class: "app-layout" }, mr = { class: "editor-wrapper" }, dr = { cla
2600
2600
  if (!p) return;
2601
2601
  const g = fn(p);
2602
2602
  if (!g.length) return;
2603
- const f = mt.value, v = f && g.includes(String(f)) ? String(f) : g[0];
2603
+ const f = Q.value, v = f && g.includes(String(f)) ? String(f) : g[0];
2604
2604
  le(v), he(v);
2605
2605
  };
2606
- return ct(
2607
- () => q.value,
2606
+ return mt(
2607
+ () => R.value,
2608
2608
  () => {
2609
- const c = V()?.view?.dom;
2610
- c instanceof HTMLElement && Z !== c && (Z && Z.removeEventListener("click", pe), Z = c, Z.addEventListener("click", pe));
2609
+ const c = j()?.view?.dom;
2610
+ c instanceof HTMLElement && K !== c && (K && K.removeEventListener("click", pe), K = c, K.addEventListener("click", pe));
2611
2611
  },
2612
2612
  { immediate: !0 }
2613
2613
  ), Se(() => {
2614
- _.value || (_.value = "未命名文档");
2614
+ V.value || (V.value = "未命名文档");
2615
2615
  }), Ke(() => {
2616
- clearTimeout(M), Z && (Z.removeEventListener("click", pe), Z = null);
2616
+ clearTimeout(y), K && (K.removeEventListener("click", pe), K = null);
2617
2617
  }), (i, c) => {
2618
2618
  const p = Qn("umo-editor");
2619
- return T(), A("div", ur, [
2619
+ return S(), I("div", ur, [
2620
2620
  l("div", mr, [
2621
2621
  l("div", dr, [
2622
2622
  l("div", {
2623
2623
  ref_key: "editorStageRef",
2624
2624
  ref: pt,
2625
- class: Tt(["umo-editor-stage", { "comment-hidden": !$.value }])
2625
+ class: Tt(["umo-editor-stage", { "comment-hidden": !D.value }])
2626
2626
  }, [
2627
2627
  Zn(p, to({
2628
2628
  ref_key: "editorRef",
2629
- ref: q
2629
+ ref: R
2630
2630
  }, qe.value), {
2631
2631
  toolbar_base: je(() => [
2632
2632
  l("button", {
@@ -2809,7 +2809,7 @@ const ur = { class: "app-layout" }, mr = { class: "editor-wrapper" }, dr = { cla
2809
2809
  onClick: Ln
2810
2810
  }, [
2811
2811
  l("span", kr, [
2812
- (T(), A("svg", _r, [
2812
+ (S(), I("svg", _r, [
2813
2813
  c[12] || (c[12] = l("rect", {
2814
2814
  x: "9",
2815
2815
  y: "9",
@@ -2828,7 +2828,7 @@ const ur = { class: "app-layout" }, mr = { class: "editor-wrapper" }, dr = { cla
2828
2828
  "stroke-linecap": "round",
2829
2829
  "stroke-linejoin": "round"
2830
2830
  }, null, -1)),
2831
- Kt.value ? (T(), A("path", xr)) : ft("", !0)
2831
+ Kt.value ? (S(), I("path", xr)) : ut("", !0)
2832
2832
  ]))
2833
2833
  ]),
2834
2834
  l("span", br, N(Kt.value ? "已复制" : "复制 HTML"), 1)
@@ -2875,27 +2875,27 @@ const ur = { class: "app-layout" }, mr = { class: "editor-wrapper" }, dr = { cla
2875
2875
  ], 2)
2876
2876
  ])
2877
2877
  ]),
2878
- m.value ? (T(), A("div", Tr, [
2878
+ m.value ? (S(), I("div", Tr, [
2879
2879
  i.$slots["comment-panel"] ? eo(i.$slots, "comment-panel", {
2880
2880
  key: 0,
2881
- comments: xt(E),
2882
- activeCommentId: xt(mt),
2881
+ comments: xt($),
2882
+ activeCommentId: xt(Q),
2883
2883
  formatTime: xt(ae),
2884
2884
  activate: We,
2885
2885
  deleteComment: Ue,
2886
2886
  resolveComment: Ge
2887
- }, void 0, !0) : (T(), Rt(Mo, {
2887
+ }, void 0, !0) : (S(), Rt(Mo, {
2888
2888
  key: 1,
2889
- comments: xt(E),
2890
- "active-comment-id": xt(mt),
2889
+ comments: xt($),
2890
+ "active-comment-id": xt(Q),
2891
2891
  "format-time": xt(ae),
2892
2892
  onActivate: We,
2893
2893
  onDelete: Ue,
2894
2894
  onResolve: Ge
2895
2895
  }, null, 8, ["comments", "active-comment-id", "format-time"]))
2896
- ])) : ft("", !0),
2897
- (T(), Rt(Te, { to: "body" }, [
2898
- Wt.value ? (T(), A("div", {
2896
+ ])) : ut("", !0),
2897
+ (S(), Rt(Te, { to: "body" }, [
2898
+ Wt.value ? (S(), I("div", {
2899
2899
  key: 0,
2900
2900
  class: "html-dialog-mask",
2901
2901
  onClick: c[3] || (c[3] = ht((g) => Wt.value = !1, ["self"]))
@@ -2918,10 +2918,10 @@ const ur = { class: "app-layout" }, mr = { class: "editor-wrapper" }, dr = { cla
2918
2918
  l("code", null, N(de.value), 1)
2919
2919
  ])
2920
2920
  ])
2921
- ])) : ft("", !0)
2921
+ ])) : ut("", !0)
2922
2922
  ])),
2923
- (T(), Rt(Te, { to: "body" }, [
2924
- jt.value ? (T(), A("div", {
2923
+ (S(), Rt(Te, { to: "body" }, [
2924
+ jt.value ? (S(), I("div", {
2925
2925
  key: 0,
2926
2926
  class: "html-dialog-mask",
2927
2927
  onClick: c[5] || (c[5] = ht((g) => jt.value = !1, ["self"]))
@@ -2944,15 +2944,15 @@ const ur = { class: "app-layout" }, mr = { class: "editor-wrapper" }, dr = { cla
2944
2944
  l("code", null, N(fe.value), 1)
2945
2945
  ])
2946
2946
  ])
2947
- ])) : ft("", !0)
2947
+ ])) : ut("", !0)
2948
2948
  ])),
2949
- ue.value ? (T(), Rt(Fo, {
2949
+ ue.value ? (S(), Rt(Fo, {
2950
2950
  key: 1,
2951
2951
  "selected-text": me.value,
2952
2952
  "initial-note": An.value,
2953
2953
  onConfirm: Gn,
2954
2954
  onCancel: c[6] || (c[6] = (g) => ue.value = !1)
2955
- }, null, 8, ["selected-text", "initial-note"])) : ft("", !0)
2955
+ }, null, 8, ["selected-text", "initial-note"])) : ut("", !0)
2956
2956
  ]);
2957
2957
  };
2958
2958
  }
@@ -2993,61 +2993,65 @@ const ur = { class: "app-layout" }, mr = { class: "editor-wrapper" }, dr = { cla
2993
2993
  },
2994
2994
  emits: ["activate", "download"],
2995
2995
  setup(s, { emit: t }) {
2996
- const e = s, n = t, o = I(!1), r = I(zt), u = I(null);
2997
- ct(
2996
+ const e = s, n = t, o = M(!1), r = M(zt), u = M(null);
2997
+ mt(
2998
2998
  () => e.items,
2999
2999
  () => {
3000
3000
  r.value = zt;
3001
3001
  }
3002
- ), ct(o, () => {
3002
+ ), mt(o, () => {
3003
3003
  r.value = zt;
3004
3004
  });
3005
- const a = X(() => {
3006
- const _ = [...e.items ?? []];
3007
- return o.value ? _.filter((y) => String(y?.reviewStatus ?? "") === "risk") : _;
3008
- }), d = X(() => {
3009
- const _ = a.value, y = /* @__PURE__ */ new Map(), M = [], x = /* @__PURE__ */ new Set();
3010
- for (const q of _) {
3011
- const E = (q ?? {}).category || "未分类";
3012
- y.set(E, (y.get(E) ?? 0) + 1), x.has(E) || (x.add(E), M.push(E));
3005
+ const a = Z(() => {
3006
+ const k = [...e.items ?? []];
3007
+ return o.value ? k.filter((y) => String(y?.reviewStatus ?? "") === "risk") : k;
3008
+ }), d = Z(() => {
3009
+ const k = a.value, y = /* @__PURE__ */ new Map(), E = [], b = /* @__PURE__ */ new Set();
3010
+ for (const K of k) {
3011
+ const Q = (K ?? {}).category || "未分类";
3012
+ y.set(Q, (y.get(Q) ?? 0) + 1), b.has(Q) || (b.add(Q), E.push(Q));
3013
3013
  }
3014
- const Y = [{ key: zt, label: "全部", count: _.length }];
3015
- for (const q of M)
3016
- Y.push({ key: q, label: q, count: y.get(q) ?? 0 });
3017
- return Y;
3018
- }), m = X(() => {
3019
- let _ = a.value;
3020
- return r.value !== zt && (_ = _.filter((y) => (y?.category || "未分类") === r.value)), _;
3021
- }), h = X(() => {
3022
- const _ = m.value, y = [], M = /* @__PURE__ */ new Map();
3023
- for (const x of _) {
3024
- const Y = x.category || "未分类";
3025
- M.has(Y) || (M.set(Y, []), y.push(Y)), M.get(Y).push(x);
3014
+ const R = [{ key: zt, label: "全部", count: k.length }];
3015
+ for (const K of E)
3016
+ R.push({ key: K, label: K, count: y.get(K) ?? 0 });
3017
+ return R;
3018
+ }), m = Z(() => {
3019
+ let k = a.value;
3020
+ return r.value !== zt && (k = k.filter((y) => (y?.category || "未分类") === r.value)), k;
3021
+ }), h = Z(() => {
3022
+ const k = m.value, y = [], E = /* @__PURE__ */ new Map();
3023
+ for (const b of k) {
3024
+ const R = b.category || "未分类";
3025
+ E.has(R) || (E.set(R, []), y.push(R)), E.get(R).push(b);
3026
3026
  }
3027
- return y.map((x) => ({
3028
- category: x,
3029
- rows: M.get(x)
3027
+ return y.map((b) => ({
3028
+ category: b,
3029
+ rows: E.get(b)
3030
3030
  }));
3031
- }), $ = (_) => {
3032
- const y = String(_ ?? "");
3031
+ }), D = (k) => {
3032
+ const y = String(k ?? "");
3033
3033
  return y === "risk" ? "有风险" : y === "compliance" ? "合规" : y || "—";
3034
- }, L = (_) => {
3035
- const y = String(_ ?? "");
3034
+ }, P = (k) => {
3035
+ const y = String(k ?? "");
3036
3036
  return y === "risk" ? "audit-card__badge--risk" : y === "compliance" ? "audit-card__badge--ok" : "audit-card__badge--muted";
3037
- }, P = (_) => {
3038
- n("activate", _);
3039
3037
  };
3040
- return ct(
3038
+ function H(k) {
3039
+ return (k || "").trim() !== "合同未见相关约定";
3040
+ }
3041
+ const V = (k) => {
3042
+ n("activate", k);
3043
+ };
3044
+ return mt(
3041
3045
  () => e.activeCommentId,
3042
- async (_) => {
3043
- if (!_) return;
3044
- await Ie(), await new Promise((x) => requestAnimationFrame(x)), await new Promise((x) => requestAnimationFrame(x)), await new Promise((x) => setTimeout(x, 0));
3046
+ async (k) => {
3047
+ if (!k) return;
3048
+ await Ie(), await new Promise((b) => requestAnimationFrame(b)), await new Promise((b) => requestAnimationFrame(b)), await new Promise((b) => setTimeout(b, 10));
3045
3049
  const y = u.value;
3046
3050
  if (!(y instanceof HTMLElement)) return;
3047
- const M = y.querySelector(`[data-comment-id="${_}"]`);
3048
- M instanceof HTMLElement && M.scrollIntoView({ behavior: "smooth", block: "nearest" });
3051
+ const E = y.querySelector(`[data-comment-id="${k}"]`);
3052
+ E instanceof HTMLElement && E.scrollIntoView({ behavior: "smooth", block: "nearest" });
3049
3053
  }
3050
- ), (_, y) => (T(), A("aside", {
3054
+ ), (k, y) => (S(), I("aside", {
3051
3055
  ref_key: "panelRootRef",
3052
3056
  ref: u,
3053
3057
  class: "complex-comment-panel"
@@ -3055,20 +3059,20 @@ const ur = { class: "app-layout" }, mr = { class: "editor-wrapper" }, dr = { cla
3055
3059
  l("div", Jr, [
3056
3060
  l("div", Br, [
3057
3061
  l("h3", Fr, N(s.title), 1),
3058
- s.streaming ? (T(), A("div", Lr, [
3062
+ s.streaming ? (S(), I("div", Lr, [
3059
3063
  y[2] || (y[2] = l("span", { class: "review-streaming-dot" }, null, -1)),
3060
3064
  l("span", null, N(s.streamingText || "智能审查持续生成中"), 1)
3061
- ])) : ft("", !0)
3065
+ ])) : ut("", !0)
3062
3066
  ]),
3063
3067
  l("div", Pr, [
3064
3068
  l("button", {
3065
3069
  type: "button",
3066
3070
  class: "complex-comment-panel__download",
3067
- onClick: y[0] || (y[0] = (M) => n("download"))
3071
+ onClick: y[0] || (y[0] = (E) => n("download"))
3068
3072
  }, " 下载 "),
3069
3073
  l("label", qr, [
3070
3074
  mn(l("input", {
3071
- "onUpdate:modelValue": y[1] || (y[1] = (M) => o.value = M),
3075
+ "onUpdate:modelValue": y[1] || (y[1] = (E) => o.value = E),
3072
3076
  type: "checkbox"
3073
3077
  }, null, 512), [
3074
3078
  [ro, o.value]
@@ -3077,61 +3081,62 @@ const ur = { class: "app-layout" }, mr = { class: "editor-wrapper" }, dr = { cla
3077
3081
  ])
3078
3082
  ])
3079
3083
  ]),
3080
- s.items.length === 0 ? (T(), A("div", Hr, [...y[4] || (y[4] = [
3084
+ s.items.length === 0 ? (S(), I("div", Hr, [...y[4] || (y[4] = [
3081
3085
  l("p", null, "暂无审查结果", -1)
3082
- ])])) : (T(), A(St, { key: 1 }, [
3086
+ ])])) : (S(), I(St, { key: 1 }, [
3083
3087
  l("div", Ur, [
3084
- (T(!0), A(St, null, Jt(d.value, (M) => (T(), A("button", {
3085
- key: M.key,
3088
+ (S(!0), I(St, null, Jt(d.value, (E) => (S(), I("button", {
3089
+ key: E.key,
3086
3090
  type: "button",
3087
3091
  role: "tab",
3088
- class: Tt(["complex-comment-panel__tab", { "complex-comment-panel__tab--active": r.value === M.key }]),
3089
- onClick: (x) => r.value = M.key
3090
- }, N(M.label) + " (" + N(M.count) + ") ", 11, Gr))), 128))
3092
+ class: Tt(["complex-comment-panel__tab", { "complex-comment-panel__tab--active": r.value === E.key }]),
3093
+ onClick: (b) => r.value = E.key
3094
+ }, N(E.label) + " (" + N(E.count) + ") ", 11, Gr))), 128))
3091
3095
  ]),
3092
3096
  l("div", Wr, [
3093
- (T(!0), A(St, null, Jt(h.value, (M) => (T(), A("section", {
3094
- key: M.category,
3097
+ (S(!0), I(St, null, Jt(h.value, (E) => (S(), I("section", {
3098
+ key: E.category,
3095
3099
  class: "complex-comment-panel__section"
3096
3100
  }, [
3097
3101
  l("div", Vr, [
3098
- l("span", Kr, N(M.category), 1)
3102
+ l("span", Kr, N(E.category), 1)
3099
3103
  ]),
3100
3104
  l("ul", jr, [
3101
- (T(!0), A(St, null, Jt(M.rows, (x) => (T(), A("li", {
3102
- key: x.id,
3103
- class: Tt(["audit-card", { "audit-card--active": s.activeCommentId === x.id }]),
3104
- "data-comment-id": x.id,
3105
- onClick: (Y) => P(x.id)
3105
+ (S(!0), I(St, null, Jt(E.rows, (b) => (S(), I("li", {
3106
+ key: b.id,
3107
+ class: Tt(["audit-card", { "audit-card--active": s.activeCommentId === b.id }]),
3108
+ "data-comment-id": b.id,
3109
+ onClick: (R) => V(b.id)
3106
3110
  }, [
3107
3111
  l("div", Xr, [
3108
3112
  l("span", {
3109
3113
  class: "audit-card__point",
3110
- title: x.reviewPoint || "(无审查点)"
3111
- }, N(x.reviewPoint || "(无审查点)"), 9, Qr),
3114
+ title: b.reviewPoint || "(无审查点)"
3115
+ }, N(b.reviewPoint || "(无审查点)"), 9, Qr),
3112
3116
  l("span", {
3113
- class: Tt(["audit-card__badge", L(x.reviewStatus)])
3114
- }, N($(x.reviewStatus)), 3)
3117
+ class: Tt(["audit-card__badge", P(b.reviewStatus)])
3118
+ }, N(D(b.reviewStatus)), 3)
3115
3119
  ]),
3116
3120
  l("div", Zr, [
3117
3121
  y[6] || (y[6] = l("div", { class: "audit-card__label" }, "原文内容", -1)),
3118
- l("div", ts, N(x.originalText || "无原文"), 1),
3119
- l("button", {
3122
+ l("div", ts, N(b.originalText || "无原文"), 1),
3123
+ H(b.originalText) ? (S(), I("button", {
3124
+ key: 0,
3120
3125
  type: "button",
3121
3126
  class: "audit-card__locate",
3122
- onClick: ht((Y) => P(x.id), ["stop"])
3127
+ onClick: ht((R) => V(b.id), ["stop"])
3123
3128
  }, [...y[5] || (y[5] = [
3124
3129
  l("span", {
3125
3130
  class: "audit-card__locate-icon",
3126
3131
  "aria-hidden": "true"
3127
3132
  }, "⌖", -1),
3128
3133
  Ce(" 原文定位 ", -1)
3129
- ])], 8, es)
3134
+ ])], 8, es)) : ut("", !0)
3130
3135
  ]),
3131
3136
  y[8] || (y[8] = l("div", { class: "audit-card__divider" }, null, -1)),
3132
3137
  l("div", ns, [
3133
3138
  y[7] || (y[7] = l("div", { class: "audit-card__label audit-card__label--strong" }, "审查说明", -1)),
3134
- l("p", os, N(x.auditDescription || "—"), 1)
3139
+ l("p", os, N(b.auditDescription || "—"), 1)
3135
3140
  ])
3136
3141
  ], 10, Yr))), 128))
3137
3142
  ])
@@ -3140,7 +3145,7 @@ const ur = { class: "app-layout" }, mr = { class: "editor-wrapper" }, dr = { cla
3140
3145
  ], 64))
3141
3146
  ], 512));
3142
3147
  }
3143
- }, ds = /* @__PURE__ */ Pt(rs, [["__scopeId", "data-v-448ac300"]]);
3148
+ }, ds = /* @__PURE__ */ Pt(rs, [["__scopeId", "data-v-e2b29b3d"]]);
3144
3149
  function fs() {
3145
3150
  }
3146
3151
  const hs = {