@univerjs/thread-comment-ui 0.5.3 → 0.5.4-experimental.20250114-7c09c35

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/es/index.js CHANGED
@@ -1,29 +1,27 @@
1
- var ze = Object.defineProperty;
2
- var qe = (t, e, n) => e in t ? ze(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
3
- var B = (t, e, n) => qe(t, typeof e != "symbol" ? e + "" : e, n);
4
- import { Inject as Ne, Disposable as Ze, UniverInstanceType as he, IUniverInstanceService as Je, CommandType as Te, DependentOn as Ge, Injector as Ke, Plugin as Ye, merge as Qe, mergeOverrideWithDependencies as Xe, ICommandService as ie, IConfigService as et, CustomRangeType as tt, useDependency as _, IMentionIOService as nt, LocaleService as pe, UserManagerService as ge, generateRandomId as rt } from "@univerjs/core";
5
- import { UniverThreadCommentPlugin as it, ThreadCommentModel as Ee, getDT as ot, AddCommentCommand as st, UpdateCommentCommand as at, ResolveCommentCommand as lt, DeleteCommentTreeCommand as Oe, DeleteCommentCommand as dt } from "@univerjs/thread-comment";
6
- import { ISidebarService as Ue, useObservable as F } from "@univerjs/ui";
7
- import { BehaviorSubject as Ie, filter as mt, debounceTime as ct } from "rxjs";
8
- import ut, { forwardRef as k, useRef as re, createElement as z, useState as A, useImperativeHandle as ht, useMemo as de, useEffect as fe } from "react";
9
- import { Mentions as vt, Mention as Ct, Button as me, Tooltip as ft, DropdownLegacy as pt, Menu as gt, MenuItem as xe, Select as be } from "@univerjs/design";
10
- import { DocSelectionManagerService as It } from "@univerjs/docs";
11
- import { DocSelectionRenderService as xt } from "@univerjs/docs-ui";
12
- import { IRenderManagerService as bt } from "@univerjs/engine-render";
13
- var _t = Object.defineProperty, St = Object.getOwnPropertyDescriptor, yt = (t, e, n, r) => {
14
- for (var i = r > 1 ? void 0 : r ? St(e, n) : e, s = t.length - 1, d; s >= 0; s--)
15
- (d = t[s]) && (i = (r ? d(e, n, i) : d(i)) || i);
16
- return r && i && _t(e, n, i), i;
17
- }, _e = (t, e) => (n, r) => e(n, r, t);
18
- let J = class extends Ze {
1
+ var qe = Object.defineProperty;
2
+ var Ze = (t, e, n) => e in t ? qe(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
3
+ var V = (t, e, n) => Ze(t, typeof e != "symbol" ? e + "" : e, n);
4
+ import { Inject as Ue, Disposable as Je, UniverInstanceType as he, IUniverInstanceService as Ke, CommandType as Pe, DependentOn as Ge, Injector as Ye, Plugin as Qe, merge as Xe, mergeOverrideWithDependencies as et, ICommandService as oe, IConfigService as tt, useDependency as U, LocaleService as pe, DOCS_NORMAL_EDITOR_UNIT_ID_KEY as nt, BuildTextUtils as Ce, Tools as rt, CustomRangeType as ot, getBodySlice as it, UserManagerService as ge, generateRandomId as at } from "@univerjs/core";
5
+ import { UniverThreadCommentPlugin as st, ThreadCommentModel as Oe, getDT as dt, AddCommentCommand as lt, UpdateCommentCommand as mt, ResolveCommentCommand as ct, DeleteCommentTreeCommand as Re, DeleteCommentCommand as ut } from "@univerjs/thread-comment";
6
+ import { ISidebarService as $e, KeyCode as Ie, useObservable as B } from "@univerjs/ui";
7
+ import { BehaviorSubject as xe, filter as ht, debounceTime as Ct } from "rxjs";
8
+ import ft, { forwardRef as L, useRef as re, createElement as W, useState as k, useEffect as me, useMemo as ne, useImperativeHandle as vt } from "react";
9
+ import { Button as ce, Tooltip as pt, DropdownLegacy as gt, Menu as It, MenuItem as be, Select as _e } from "@univerjs/design";
10
+ import { IEditorService as xt, BreakLineCommand as bt, RichTextEditor as _t } from "@univerjs/docs-ui";
11
+ var St = Object.defineProperty, yt = Object.getOwnPropertyDescriptor, Tt = (t, e, n, r) => {
12
+ for (var o = r > 1 ? void 0 : r ? yt(e, n) : e, s = t.length - 1, l; s >= 0; s--)
13
+ (l = t[s]) && (o = (r ? l(e, n, o) : l(o)) || o);
14
+ return r && o && St(e, n, o), o;
15
+ }, Se = (t, e) => (n, r) => e(n, r, t);
16
+ let J = class extends Je {
19
17
  constructor(e, n) {
20
18
  super();
21
- B(this, "_panelVisible", !1);
22
- B(this, "_panelVisible$", new Ie(!1));
23
- B(this, "_activeCommentId");
24
- B(this, "_activeCommentId$", new Ie(void 0));
25
- B(this, "panelVisible$", this._panelVisible$.asObservable());
26
- B(this, "activeCommentId$", this._activeCommentId$.asObservable());
19
+ V(this, "_panelVisible", !1);
20
+ V(this, "_panelVisible$", new xe(!1));
21
+ V(this, "_activeCommentId");
22
+ V(this, "_activeCommentId$", new xe(void 0));
23
+ V(this, "panelVisible$", this._panelVisible$.asObservable());
24
+ V(this, "activeCommentId$", this._activeCommentId$.asObservable());
27
25
  this._sidebarService = e, this._univerInstanceService = n, this._init(), this.disposeWithMe(() => {
28
26
  this._activeCommentId$.complete(), this._panelVisible$.complete();
29
27
  });
@@ -34,7 +32,7 @@ let J = class extends Ze {
34
32
  e.visible || this.setPanelVisible(!1);
35
33
  })
36
34
  ), this.disposeWithMe(
37
- this._univerInstanceService.getCurrentTypeOfUnit$(he.UNIVER_SHEET).pipe(mt((e) => !e)).subscribe(() => {
35
+ this._univerInstanceService.getCurrentTypeOfUnit$(he.UNIVER_SHEET).pipe(ht((e) => !e)).subscribe(() => {
38
36
  this._sidebarService.close();
39
37
  })
40
38
  );
@@ -52,63 +50,63 @@ let J = class extends Ze {
52
50
  this._activeCommentId = e, this._activeCommentId$.next(e);
53
51
  }
54
52
  };
55
- J = yt([
56
- _e(0, Ne(Ue)),
57
- _e(1, Je)
53
+ J = Tt([
54
+ Se(0, Ue($e)),
55
+ Se(1, Ke)
58
56
  ], J);
59
- const jt = "thread-comment-panel", Nt = "UNIVER_THREAD_COMMENT_UI_PLUGIN", Tt = {
57
+ const jt = "thread-comment-panel", Nt = "UNIVER_THREAD_COMMENT_UI_PLUGIN", Et = {
60
58
  id: "thread-comment-ui.operation.toggle-panel",
61
- type: Te.OPERATION,
59
+ type: Pe.OPERATION,
62
60
  handler(t) {
63
- const e = t.get(Ue), n = t.get(J);
61
+ const e = t.get($e), n = t.get(J);
64
62
  return n.panelVisible ? (e.close(), n.setPanelVisible(!1)) : (e.open({
65
63
  header: { title: "threadCommentUI.panel.title" },
66
64
  children: { label: jt },
67
65
  width: 330
68
66
  }), n.setPanelVisible(!0)), !0;
69
67
  }
70
- }, W = {
68
+ }, F = {
71
69
  id: "thread-comment-ui.operation.set-active-comment",
72
- type: Te.OPERATION,
70
+ type: Pe.OPERATION,
73
71
  handler(t, e) {
74
72
  return t.get(J).setActiveComment(e), !0;
75
73
  }
76
- }, Et = "thread-comment-ui.config", Se = {};
77
- var Pe = Object.defineProperty, Ot = Object.getOwnPropertyDescriptor, Ut = (t, e, n) => e in t ? Pe(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n, Pt = (t, e, n, r) => {
78
- for (var i = r > 1 ? void 0 : r ? Ot(e, n) : e, s = t.length - 1, d; s >= 0; s--)
79
- (d = t[s]) && (i = (r ? d(e, n, i) : d(i)) || i);
80
- return r && i && Pe(e, n, i), i;
81
- }, ve = (t, e) => (n, r) => e(n, r, t), Re = (t, e, n) => Ut(t, typeof e != "symbol" ? e + "" : e, n);
82
- let ce = class extends Ye {
83
- constructor(t = Se, e, n, r) {
74
+ }, Ut = "thread-comment-ui.config", ye = {};
75
+ var De = Object.defineProperty, Pt = Object.getOwnPropertyDescriptor, Ot = (t, e, n) => e in t ? De(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n, Rt = (t, e, n, r) => {
76
+ for (var o = r > 1 ? void 0 : r ? Pt(e, n) : e, s = t.length - 1, l; s >= 0; s--)
77
+ (l = t[s]) && (o = (r ? l(e, n, o) : l(o)) || o);
78
+ return r && o && De(e, n, o), o;
79
+ }, fe = (t, e) => (n, r) => e(n, r, t), He = (t, e, n) => Ot(t, typeof e != "symbol" ? e + "" : e, n);
80
+ let ue = class extends Qe {
81
+ constructor(t = ye, e, n, r) {
84
82
  super(), this._config = t, this._injector = e, this._commandService = n, this._configService = r;
85
- const { menu: i, ...s } = Qe(
83
+ const { menu: o, ...s } = Xe(
86
84
  {},
87
- Se,
85
+ ye,
88
86
  this._config
89
87
  );
90
- i && this._configService.setConfig("menu", i, { merge: !0 }), this._configService.setConfig(Et, s);
88
+ o && this._configService.setConfig("menu", o, { merge: !0 }), this._configService.setConfig(Ut, s);
91
89
  }
92
90
  onStarting() {
93
91
  var t;
94
- Xe([
92
+ et([
95
93
  [J]
96
94
  ], (t = this._config) == null ? void 0 : t.overrides).forEach((e) => {
97
95
  this._injector.add(e);
98
- }), [Tt, W].forEach((e) => {
96
+ }), [Et, F].forEach((e) => {
99
97
  this._commandService.registerCommand(e);
100
98
  });
101
99
  }
102
100
  };
103
- Re(ce, "pluginName", Nt);
104
- Re(ce, "type", he.UNIVER_UNKNOWN);
105
- ce = Pt([
106
- Ge(it),
107
- ve(1, Ne(Ke)),
108
- ve(2, ie),
109
- ve(3, et)
110
- ], ce);
111
- var Ce = { exports: {} }, te = {};
101
+ He(ue, "pluginName", Nt);
102
+ He(ue, "type", he.UNIVER_UNKNOWN);
103
+ ue = Rt([
104
+ Ge(st),
105
+ fe(1, Ue(Ye)),
106
+ fe(2, oe),
107
+ fe(3, tt)
108
+ ], ue);
109
+ var ve = { exports: {} }, ee = {};
112
110
  /**
113
111
  * @license React
114
112
  * react-jsx-runtime.production.min.js
@@ -118,181 +116,252 @@ var Ce = { exports: {} }, te = {};
118
116
  * This source code is licensed under the MIT license found in the
119
117
  * LICENSE file in the root directory of this source tree.
120
118
  */
121
- var ye;
122
- function Rt() {
123
- if (ye) return te;
124
- ye = 1;
125
- var t = ut, e = Symbol.for("react.element"), n = Symbol.for("react.fragment"), r = Object.prototype.hasOwnProperty, i = t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, s = { key: !0, ref: !0, __self: !0, __source: !0 };
126
- function d(u, m, y) {
127
- var h, v = {}, C = null, b = null;
128
- y !== void 0 && (C = "" + y), m.key !== void 0 && (C = "" + m.key), m.ref !== void 0 && (b = m.ref);
129
- for (h in m) r.call(m, h) && !s.hasOwnProperty(h) && (v[h] = m[h]);
130
- if (u && u.defaultProps) for (h in m = u.defaultProps, m) v[h] === void 0 && (v[h] = m[h]);
131
- return { $$typeof: e, type: u, key: C, ref: b, props: v, _owner: i.current };
119
+ var Te;
120
+ function $t() {
121
+ if (Te) return ee;
122
+ Te = 1;
123
+ var t = ft, e = Symbol.for("react.element"), n = Symbol.for("react.fragment"), r = Object.prototype.hasOwnProperty, o = t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, s = { key: !0, ref: !0, __self: !0, __source: !0 };
124
+ function l(h, c, x) {
125
+ var C, T = {}, b = null, _ = null;
126
+ x !== void 0 && (b = "" + x), c.key !== void 0 && (b = "" + c.key), c.ref !== void 0 && (_ = c.ref);
127
+ for (C in c) r.call(c, C) && !s.hasOwnProperty(C) && (T[C] = c[C]);
128
+ if (h && h.defaultProps) for (C in c = h.defaultProps, c) T[C] === void 0 && (T[C] = c[C]);
129
+ return { $$typeof: e, type: h, key: b, ref: _, props: T, _owner: o.current };
132
130
  }
133
- return te.Fragment = n, te.jsx = d, te.jsxs = d, te;
131
+ return ee.Fragment = n, ee.jsx = l, ee.jsxs = l, ee;
134
132
  }
135
133
  var je;
136
- function Mt() {
137
- return je || (je = 1, Ce.exports = Rt()), Ce.exports;
134
+ function Dt() {
135
+ return je || (je = 1, ve.exports = $t()), ve.exports;
138
136
  }
139
- var o = Mt(), U = function() {
140
- return U = Object.assign || function(t) {
137
+ var i = Dt(), $ = function() {
138
+ return $ = Object.assign || function(t) {
141
139
  for (var e, n = 1, r = arguments.length; n < r; n++) {
142
140
  e = arguments[n];
143
- for (var i in e) Object.prototype.hasOwnProperty.call(e, i) && (t[i] = e[i]);
141
+ for (var o in e) Object.prototype.hasOwnProperty.call(e, o) && (t[o] = e[o]);
144
142
  }
145
143
  return t;
146
- }, U.apply(this, arguments);
147
- }, $t = function(t, e) {
144
+ }, $.apply(this, arguments);
145
+ }, Ht = function(t, e) {
148
146
  var n = {};
149
147
  for (var r in t) Object.prototype.hasOwnProperty.call(t, r) && e.indexOf(r) < 0 && (n[r] = t[r]);
150
148
  if (t != null && typeof Object.getOwnPropertySymbols == "function")
151
- for (var i = 0, r = Object.getOwnPropertySymbols(t); i < r.length; i++)
152
- e.indexOf(r[i]) < 0 && Object.prototype.propertyIsEnumerable.call(t, r[i]) && (n[r[i]] = t[r[i]]);
149
+ for (var o = 0, r = Object.getOwnPropertySymbols(t); o < r.length; o++)
150
+ e.indexOf(r[o]) < 0 && Object.prototype.propertyIsEnumerable.call(t, r[o]) && (n[r[o]] = t[r[o]]);
153
151
  return n;
154
- }, q = k(function(t, e) {
155
- var n = t.icon, r = t.id, i = t.className, s = t.extend, d = $t(t, ["icon", "id", "className", "extend"]), u = "univerjs-icon univerjs-icon-".concat(r, " ").concat(i || "").trim(), m = re("_".concat(Dt()));
156
- return Me(n, "".concat(r), { defIds: n.defIds, idSuffix: m.current }, U({ ref: e, className: u }, d), s);
152
+ }, z = L(function(t, e) {
153
+ var n = t.icon, r = t.id, o = t.className, s = t.extend, l = Ht(t, ["icon", "id", "className", "extend"]), h = "univerjs-icon univerjs-icon-".concat(r, " ").concat(o || "").trim(), c = re("_".concat(kt()));
154
+ return Me(n, "".concat(r), { defIds: n.defIds, idSuffix: c.current }, $({ ref: e, className: h }, l), s);
157
155
  });
158
- function Me(t, e, n, r, i) {
159
- return z(t.tag, U(U({ key: e }, wt(t, n, i)), r), (Ht(t, n).children || []).map(function(s, d) {
160
- return Me(s, "".concat(e, "-").concat(t.tag, "-").concat(d), n, void 0, i);
156
+ function Me(t, e, n, r, o) {
157
+ return W(t.tag, $($({ key: e }, Mt(t, n, o)), r), (wt(t, n).children || []).map(function(s, l) {
158
+ return Me(s, "".concat(e, "-").concat(t.tag, "-").concat(l), n, void 0, o);
161
159
  }));
162
160
  }
163
- function wt(t, e, n) {
164
- var r = U({}, t.attrs);
161
+ function Mt(t, e, n) {
162
+ var r = $({}, t.attrs);
165
163
  n != null && n.colorChannel1 && r.fill === "colorChannel1" && (r.fill = n.colorChannel1);
166
- var i = e.defIds;
167
- return !i || i.length === 0 || (t.tag === "use" && r["xlink:href"] && (r["xlink:href"] = r["xlink:href"] + e.idSuffix), Object.entries(r).forEach(function(s) {
168
- var d = s[0], u = s[1];
169
- typeof u == "string" && (r[d] = u.replace(/url\(#(.*)\)/, "url(#$1".concat(e.idSuffix, ")")));
164
+ var o = e.defIds;
165
+ return !o || o.length === 0 || (t.tag === "use" && r["xlink:href"] && (r["xlink:href"] = r["xlink:href"] + e.idSuffix), Object.entries(r).forEach(function(s) {
166
+ var l = s[0], h = s[1];
167
+ typeof h == "string" && (r[l] = h.replace(/url\(#(.*)\)/, "url(#$1".concat(e.idSuffix, ")")));
170
168
  })), r;
171
169
  }
172
- function Ht(t, e) {
170
+ function wt(t, e) {
173
171
  var n, r = e.defIds;
174
- return !r || r.length === 0 ? t : t.tag === "defs" && (!((n = t.children) === null || n === void 0) && n.length) ? U(U({}, t), { children: t.children.map(function(i) {
175
- return typeof i.attrs.id == "string" && r && r.indexOf(i.attrs.id) > -1 ? U(U({}, i), { attrs: U(U({}, i.attrs), { id: i.attrs.id + e.idSuffix }) }) : i;
172
+ return !r || r.length === 0 ? t : t.tag === "defs" && (!((n = t.children) === null || n === void 0) && n.length) ? $($({}, t), { children: t.children.map(function(o) {
173
+ return typeof o.attrs.id == "string" && r && r.indexOf(o.attrs.id) > -1 ? $($({}, o), { attrs: $($({}, o.attrs), { id: o.attrs.id + e.idSuffix }) }) : o;
176
174
  }) }) : t;
177
175
  }
178
- function Dt() {
176
+ function kt() {
179
177
  return Math.random().toString(36).substring(2, 8);
180
178
  }
181
- q.displayName = "UniverIcon";
182
- var At = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M5.3313 1.4667C5.3313 1.13533 5.59993.866699 5.9313.866699H10.069C10.4004.866699 10.669 1.13533 10.669 1.4667 10.669 1.79807 10.4004 2.0667 10.069 2.0667H5.9313C5.59993 2.0667 5.3313 1.79807 5.3313 1.4667zM1.09985 3.64443C1.09985 3.31306 1.36848 3.04443 1.69985 3.04443H14.2999C14.6312 3.04443 14.8999 3.31306 14.8999 3.64443 14.8999 3.9758 14.6312 4.24443 14.2999 4.24443H1.69985C1.36848 4.24443 1.09985 3.9758 1.09985 3.64443zM6.12398 8.30171C6.35829 8.0674 6.73819 8.0674 6.97251 8.30171L8.00007 9.32928 9.02764 8.30171C9.26195 8.0674 9.64185 8.0674 9.87617 8.30171 10.1105 8.53603 10.1105 8.91593 9.87617 9.15024L8.8486 10.1778 9.87617 11.2054C10.1105 11.4397 10.1105 11.8196 9.87617 12.0539 9.64185 12.2882 9.26195 12.2882 9.02764 12.0539L8.00007 11.0263 6.97251 12.0539C6.73819 12.2882 6.35829 12.2882 6.12398 12.0539 5.88966 11.8196 5.88966 11.4397 6.12398 11.2054L7.15154 10.1778 6.12398 9.15024C5.88966 8.91593 5.88966 8.53603 6.12398 8.30171z" } }, { tag: "path", attrs: { fill: "currentColor", d: "M4.75332 5.22217C3.86966 5.22217 3.15332 5.93851 3.15332 6.82217V12.5331C3.15332 13.9691 4.31738 15.1332 5.75332 15.1332H10.2465C11.6825 15.1332 12.8465 13.9691 12.8465 12.5331V6.82217C12.8465 5.93851 12.1302 5.22217 11.2465 5.22217H4.75332ZM4.35332 6.82217C4.35332 6.60125 4.53241 6.42217 4.75332 6.42217H11.2465C11.4674 6.42217 11.6465 6.60125 11.6465 6.82217V12.5331C11.6465 13.3063 11.0197 13.9332 10.2465 13.9332H5.75332C4.98012 13.9332 4.35332 13.3063 4.35332 12.5331V6.82217Z", fillRule: "evenodd", clipRule: "evenodd" } }] }, $e = k(function(t, e) {
183
- return z(q, Object.assign({}, t, {
179
+ z.displayName = "UniverIcon";
180
+ var Lt = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M5.3313 1.4667C5.3313 1.13533 5.59993.866699 5.9313.866699H10.069C10.4004.866699 10.669 1.13533 10.669 1.4667 10.669 1.79807 10.4004 2.0667 10.069 2.0667H5.9313C5.59993 2.0667 5.3313 1.79807 5.3313 1.4667zM1.09985 3.64443C1.09985 3.31306 1.36848 3.04443 1.69985 3.04443H14.2999C14.6312 3.04443 14.8999 3.31306 14.8999 3.64443 14.8999 3.9758 14.6312 4.24443 14.2999 4.24443H1.69985C1.36848 4.24443 1.09985 3.9758 1.09985 3.64443zM6.12398 8.30171C6.35829 8.0674 6.73819 8.0674 6.97251 8.30171L8.00007 9.32928 9.02764 8.30171C9.26195 8.0674 9.64185 8.0674 9.87617 8.30171 10.1105 8.53603 10.1105 8.91593 9.87617 9.15024L8.8486 10.1778 9.87617 11.2054C10.1105 11.4397 10.1105 11.8196 9.87617 12.0539 9.64185 12.2882 9.26195 12.2882 9.02764 12.0539L8.00007 11.0263 6.97251 12.0539C6.73819 12.2882 6.35829 12.2882 6.12398 12.0539 5.88966 11.8196 5.88966 11.4397 6.12398 11.2054L7.15154 10.1778 6.12398 9.15024C5.88966 8.91593 5.88966 8.53603 6.12398 8.30171z" } }, { tag: "path", attrs: { fill: "currentColor", d: "M4.75332 5.22217C3.86966 5.22217 3.15332 5.93851 3.15332 6.82217V12.5331C3.15332 13.9691 4.31738 15.1332 5.75332 15.1332H10.2465C11.6825 15.1332 12.8465 13.9691 12.8465 12.5331V6.82217C12.8465 5.93851 12.1302 5.22217 11.2465 5.22217H4.75332ZM4.35332 6.82217C4.35332 6.60125 4.53241 6.42217 4.75332 6.42217H11.2465C11.4674 6.42217 11.6465 6.60125 11.6465 6.82217V12.5331C11.6465 13.3063 11.0197 13.9332 10.2465 13.9332H5.75332C4.98012 13.9332 4.35332 13.3063 4.35332 12.5331V6.82217Z", fillRule: "evenodd", clipRule: "evenodd" } }] }, we = L(function(t, e) {
181
+ return W(z, Object.assign({}, t, {
184
182
  id: "delete-single",
185
183
  ref: e,
186
- icon: At
184
+ icon: Lt
187
185
  }));
188
186
  });
189
- $e.displayName = "DeleteSingle";
190
- var kt = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M8.6 1.99991C8.60001 1.66854 8.33138 1.39991 8.00001 1.3999C7.66864 1.3999 7.40001 1.66853 7.4 1.9999L7.39996 7.3999H1.9999C1.66853 7.3999 1.3999 7.66853 1.3999 7.9999C1.3999 8.33127 1.66853 8.5999 1.9999 8.5999H7.39995L7.3999 13.9999C7.3999 14.3313 7.66853 14.5999 7.9999 14.5999C8.33127 14.5999 8.5999 14.3313 8.5999 13.9999L8.59995 8.5999H13.9999C14.3313 8.5999 14.5999 8.33127 14.5999 7.9999C14.5999 7.66853 14.3313 7.3999 13.9999 7.3999H8.59996L8.6 1.99991Z" } }] }, we = k(function(t, e) {
191
- return z(q, Object.assign({}, t, {
187
+ we.displayName = "DeleteSingle";
188
+ var At = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M8.6 1.99991C8.60001 1.66854 8.33138 1.39991 8.00001 1.3999C7.66864 1.3999 7.40001 1.66853 7.4 1.9999L7.39996 7.3999H1.9999C1.66853 7.3999 1.3999 7.66853 1.3999 7.9999C1.3999 8.33127 1.66853 8.5999 1.9999 8.5999H7.39995L7.3999 13.9999C7.3999 14.3313 7.66853 14.5999 7.9999 14.5999C8.33127 14.5999 8.5999 14.3313 8.5999 13.9999L8.59995 8.5999H13.9999C14.3313 8.5999 14.5999 8.33127 14.5999 7.9999C14.5999 7.66853 14.3313 7.3999 13.9999 7.3999H8.59996L8.6 1.99991Z" } }] }, ke = L(function(t, e) {
189
+ return W(z, Object.assign({}, t, {
192
190
  id: "increase-single",
193
191
  ref: e,
194
- icon: kt
192
+ icon: At
195
193
  }));
196
194
  });
197
- we.displayName = "IncreaseSingle";
198
- var Lt = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M3 9C3.55228 9 4 8.55228 4 8 4 7.44772 3.55228 7 3 7 2.44772 7 2 7.44772 2 8 2 8.55228 2.44772 9 3 9zM8 9C8.55228 9 9 8.55228 9 8 9 7.44772 8.55228 7 8 7 7.44772 7 7 7.44772 7 8 7 8.55228 7.44772 9 8 9zM13 9C13.5523 9 14 8.55228 14 8 14 7.44772 13.5523 7 13 7 12.4477 7 12 7.44772 12 8 12 8.55228 12.4477 9 13 9z" } }] }, He = k(function(t, e) {
199
- return z(q, Object.assign({}, t, {
195
+ ke.displayName = "IncreaseSingle";
196
+ var Vt = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M3 9C3.55228 9 4 8.55228 4 8 4 7.44772 3.55228 7 3 7 2.44772 7 2 7.44772 2 8 2 8.55228 2.44772 9 3 9zM8 9C8.55228 9 9 8.55228 9 8 9 7.44772 8.55228 7 8 7 7.44772 7 7 7.44772 7 8 7 8.55228 7.44772 9 8 9zM13 9C13.5523 9 14 8.55228 14 8 14 7.44772 13.5523 7 13 7 12.4477 7 12 7.44772 12 8 12 8.55228 12.4477 9 13 9z" } }] }, Le = L(function(t, e) {
197
+ return W(z, Object.assign({}, t, {
200
198
  id: "more-horizontal-single",
201
199
  ref: e,
202
- icon: Lt
200
+ icon: Vt
203
201
  }));
204
202
  });
205
- He.displayName = "MoreHorizontalSingle";
206
- var Vt = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { stroke: "currentColor", d: "M7.48389 10.3267V12.1905C7.48389 12.7428 7.9316 13.1905 8.48389 13.1905H11.2216L12.2955 14.2644L13.3695 13.1905H14.1593C14.7116 13.1905 15.1593 12.7428 15.1593 12.1905V8.46289C15.1593 7.91061 14.7116 7.46289 14.1593 7.46289H12.2955", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 1.2 } }, { tag: "path", attrs: { stroke: "currentColor", d: "M0.840332 3.73535C0.840332 2.63078 1.73576 1.73535 2.84033 1.73535H10.2955C11.4001 1.73535 12.2955 2.63078 12.2955 3.73535V8.32676C12.2955 9.43132 11.4001 10.3268 10.2955 10.3268H5.6014L4.1695 11.7587L3.05978 10.3268H2.84033C1.73576 10.3268 0.840332 9.43133 0.840332 8.32676V3.73535Z", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 1.2 } }, { tag: "path", attrs: { stroke: "currentColor", d: "M6.41016 6.1311H6.76813M8.91626 6.1311H9.27424M3.90454 6.1311H4.26252", strokeLinecap: "round", strokeWidth: 1.2 } }] }, De = k(function(t, e) {
207
- return z(q, Object.assign({}, t, {
203
+ Le.displayName = "MoreHorizontalSingle";
204
+ var Bt = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { stroke: "currentColor", d: "M7.48389 10.3267V12.1905C7.48389 12.7428 7.9316 13.1905 8.48389 13.1905H11.2216L12.2955 14.2644L13.3695 13.1905H14.1593C14.7116 13.1905 15.1593 12.7428 15.1593 12.1905V8.46289C15.1593 7.91061 14.7116 7.46289 14.1593 7.46289H12.2955", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 1.2 } }, { tag: "path", attrs: { stroke: "currentColor", d: "M0.840332 3.73535C0.840332 2.63078 1.73576 1.73535 2.84033 1.73535H10.2955C11.4001 1.73535 12.2955 2.63078 12.2955 3.73535V8.32676C12.2955 9.43132 11.4001 10.3268 10.2955 10.3268H5.6014L4.1695 11.7587L3.05978 10.3268H2.84033C1.73576 10.3268 0.840332 9.43133 0.840332 8.32676V3.73535Z", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 1.2 } }, { tag: "path", attrs: { stroke: "currentColor", d: "M6.41016 6.1311H6.76813M8.91626 6.1311H9.27424M3.90454 6.1311H4.26252", strokeLinecap: "round", strokeWidth: 1.2 } }] }, Ae = L(function(t, e) {
205
+ return W(z, Object.assign({}, t, {
208
206
  id: "reply-to-comment-single",
209
207
  ref: e,
210
- icon: Vt
208
+ icon: Bt
211
209
  }));
212
210
  });
213
- De.displayName = "ReplyToCommentSingle";
214
- var Bt = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 17 17", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M8.6106 15.4036C12.4766 15.4036 15.6106 12.2696 15.6106 8.40356C15.6106 4.53757 12.4766 1.40356 8.6106 1.40356C4.7446 1.40356 1.6106 4.53757 1.6106 8.40356C1.6106 12.2696 4.7446 15.4036 8.6106 15.4036ZM12.3351 6.82773C12.5694 6.59342 12.5694 6.21352 12.3351 5.9792C12.1007 5.74489 11.7208 5.74489 11.4865 5.9792L7.91079 9.55494L6.33506 7.9792C6.10074 7.74489 5.72084 7.74489 5.48653 7.9792C5.25221 8.21352 5.25221 8.59342 5.48653 8.82773L7.48653 10.8277C7.72084 11.062 8.10074 11.062 8.33506 10.8277L12.3351 6.82773Z", fillRule: "evenodd", clipRule: "evenodd" } }] }, Ae = k(function(t, e) {
215
- return z(q, Object.assign({}, t, {
211
+ Ae.displayName = "ReplyToCommentSingle";
212
+ var Ft = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 17 17", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M8.6106 15.4036C12.4766 15.4036 15.6106 12.2696 15.6106 8.40356C15.6106 4.53757 12.4766 1.40356 8.6106 1.40356C4.7446 1.40356 1.6106 4.53757 1.6106 8.40356C1.6106 12.2696 4.7446 15.4036 8.6106 15.4036ZM12.3351 6.82773C12.5694 6.59342 12.5694 6.21352 12.3351 5.9792C12.1007 5.74489 11.7208 5.74489 11.4865 5.9792L7.91079 9.55494L6.33506 7.9792C6.10074 7.74489 5.72084 7.74489 5.48653 7.9792C5.25221 8.21352 5.25221 8.59342 5.48653 8.82773L7.48653 10.8277C7.72084 11.062 8.10074 11.062 8.33506 10.8277L12.3351 6.82773Z", fillRule: "evenodd", clipRule: "evenodd" } }] }, Ve = L(function(t, e) {
213
+ return W(z, Object.assign({}, t, {
216
214
  id: "resolved-single",
217
215
  ref: e,
218
- icon: Bt
216
+ icon: Ft
219
217
  }));
220
218
  });
221
- Ae.displayName = "ResolvedSingle";
222
- var Ft = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 17 17", width: "1em", height: "1em" }, children: [{ tag: "circle", attrs: { cx: 8.73, cy: 8.4, r: 6.4, stroke: "currentColor", strokeWidth: 1.2 } }, { tag: "path", attrs: { stroke: "currentColor", d: "M6.02637 8.40356L8.02637 10.4036L12.0264 6.40356", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 1.2 } }] }, ke = k(function(t, e) {
223
- return z(q, Object.assign({}, t, {
219
+ Ve.displayName = "ResolvedSingle";
220
+ var Wt = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 17 17", width: "1em", height: "1em" }, children: [{ tag: "circle", attrs: { cx: 8.73, cy: 8.4, r: 6.4, stroke: "currentColor", strokeWidth: 1.2 } }, { tag: "path", attrs: { stroke: "currentColor", d: "M6.02637 8.40356L8.02637 10.4036L12.0264 6.40356", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 1.2 } }] }, Be = L(function(t, e) {
221
+ return W(z, Object.assign({}, t, {
224
222
  id: "solve-single",
225
223
  ref: e,
226
- icon: Ft
224
+ icon: Wt
227
225
  }));
228
226
  });
229
- ke.displayName = "SolveSingle";
230
- function Le(t) {
227
+ Be.displayName = "SolveSingle";
228
+ function Fe(t) {
231
229
  var e, n, r = "";
232
230
  if (typeof t == "string" || typeof t == "number") r += t;
233
231
  else if (typeof t == "object") if (Array.isArray(t)) {
234
- var i = t.length;
235
- for (e = 0; e < i; e++) t[e] && (n = Le(t[e])) && (r && (r += " "), r += n);
232
+ var o = t.length;
233
+ for (e = 0; e < o; e++) t[e] && (n = Fe(t[e])) && (r && (r += " "), r += n);
236
234
  } else for (n in t) t[n] && (r && (r += " "), r += n);
237
235
  return r;
238
236
  }
239
- function Wt() {
240
- for (var t, e, n = 0, r = "", i = arguments.length; n < i; n++) (t = arguments[n]) && (e = Le(t)) && (r && (r += " "), r += e);
237
+ function zt() {
238
+ for (var t, e, n = 0, r = "", o = arguments.length; n < o; n++) (t = arguments[n]) && (e = Fe(t)) && (r && (r += " "), r += e);
241
239
  return r;
242
240
  }
243
- const zt = "univer-thread-comment-editor-buttons", qt = "univer-thread-comment-editor-suggestion", Zt = "univer-thread-comment-editor-suggestionActive", Jt = "univer-thread-comment-editor-suggestion-icon", ue = {
244
- threadCommentEditorButtons: zt,
245
- threadCommentEditorSuggestion: qt,
246
- threadCommentEditorSuggestionActive: Zt,
247
- threadCommentEditorSuggestionIcon: Jt
248
- }, Gt = (t) => {
249
- const e = /@\[(.*?)\]\((.*?)\)|(\w+)/g;
250
- let n, r = 0;
251
- const i = [];
252
- for (; (n = e.exec(t)) !== null; )
253
- n.index > r && i.push({
254
- type: "text",
255
- content: t.substring(r, n.index)
256
- }), n[1] && n[2] ? i.push({
257
- type: "mention",
258
- content: {
259
- label: n[1],
260
- id: n[2]
241
+ const qt = "univer-thread-comment-editor-buttons", Zt = "univer-thread-comment-editor-suggestion", Jt = "univer-thread-comment-editor-suggestionActive", Kt = "univer-thread-comment-editor-suggestion-icon", Ne = {
242
+ threadCommentEditorButtons: qt,
243
+ threadCommentEditorSuggestion: Zt,
244
+ threadCommentEditorSuggestionActive: Jt,
245
+ threadCommentEditorSuggestionIcon: Kt
246
+ };
247
+ function Ee(t) {
248
+ return {
249
+ id: "d",
250
+ body: t,
251
+ documentStyle: {}
252
+ };
253
+ }
254
+ const We = L((t, e) => {
255
+ var M;
256
+ const { comment: n, onSave: r, id: o, onCancel: s, autoFocus: l, unitId: h, type: c } = t, x = U(oe), C = U(pe), [T, b] = k(!1), _ = U(xt), u = re(null), g = c === he.UNIVER_SHEET ? nt : h, [O, j] = k(() => {
257
+ var m, f, I;
258
+ return Ce.transform.getPlainText((I = (f = (m = u.current) == null ? void 0 : m.getDocumentData().body) == null ? void 0 : f.dataStream) != null ? I : "");
259
+ });
260
+ me(() => {
261
+ var f, I, d, v;
262
+ j(Ce.transform.getPlainText((d = (I = (f = u.current) == null ? void 0 : f.getDocumentData().body) == null ? void 0 : I.dataStream) != null ? d : ""));
263
+ const m = (v = u.current) == null ? void 0 : v.selectionChange$.subscribe(() => {
264
+ var q, N, y;
265
+ j(Ce.transform.getPlainText((y = (N = (q = u.current) == null ? void 0 : q.getDocumentData().body) == null ? void 0 : N.dataStream) != null ? y : ""));
266
+ });
267
+ return () => m == null ? void 0 : m.unsubscribe();
268
+ }, [(M = u.current) == null ? void 0 : M.selectionChange$]);
269
+ const D = ne(() => ({
270
+ keyCodes: [{ keyCode: Ie.ENTER }],
271
+ handler: (m) => {
272
+ m === Ie.ENTER && x.executeCommand(
273
+ bt.id
274
+ );
275
+ }
276
+ }), [x]);
277
+ vt(e, () => ({
278
+ reply(m) {
279
+ var f, I;
280
+ (f = u.current) == null || f.focus(), (I = u.current) == null || I.setDocumentData(Ee(m));
281
+ }
282
+ }));
283
+ const S = () => {
284
+ if (u.current) {
285
+ const m = rt.deepClone(u.current.getDocumentData().body);
286
+ b(!1), r == null || r({
287
+ ...n,
288
+ text: m
289
+ }), u.current.replaceText(""), setTimeout(() => {
290
+ var f, I;
291
+ (f = u.current) == null || f.setSelectionRanges([]), (I = u.current) == null || I.blur();
292
+ }, 10);
293
+ }
294
+ };
295
+ return /* @__PURE__ */ i.jsxs("div", { className: Ne.threadCommentEditor, onClick: (m) => m.preventDefault(), children: [
296
+ /* @__PURE__ */ i.jsx(
297
+ _t,
298
+ {
299
+ ref: u,
300
+ autoFocus: l,
301
+ style: { width: "100%" },
302
+ keyboardEventConfig: D,
303
+ placeholder: C.t("threadCommentUI.editor.placeholder"),
304
+ initialValue: (n == null ? void 0 : n.text) && Ee(n.text),
305
+ onFocusChange: (m) => m && b(m),
306
+ isSingle: !1,
307
+ maxHeight: 64,
308
+ onClickOutside: () => {
309
+ setTimeout(() => {
310
+ _.focus(g);
311
+ }, 30);
312
+ }
261
313
  }
262
- }) : n[3] && i.push({
263
- type: "text",
264
- content: n[3]
265
- }), r = e.lastIndex;
266
- return r < t.length && i.push({
267
- type: "text",
268
- content: t.substring(r)
269
- }), i;
270
- }, Kt = (t) => t.map((e) => {
271
- switch (e.type) {
272
- case "mention":
273
- return `@[${e.content.label}](${e.content.id})`;
274
- default:
275
- return e.content;
276
- }
277
- }).join(""), Ve = (t) => {
278
- const { dataStream: e, customRanges: n } = t, r = e.length - 2, i = [];
314
+ ),
315
+ T ? /* @__PURE__ */ i.jsxs("div", { className: Ne.threadCommentEditorButtons, children: [
316
+ /* @__PURE__ */ i.jsx(
317
+ ce,
318
+ {
319
+ style: { marginRight: 12 },
320
+ onClick: () => {
321
+ var m;
322
+ s == null || s(), b(!1), (m = u.current) == null || m.replaceText("", !0), x.executeCommand(F.id);
323
+ },
324
+ children: C.t("threadCommentUI.editor.cancel")
325
+ }
326
+ ),
327
+ /* @__PURE__ */ i.jsx(
328
+ ce,
329
+ {
330
+ type: "primary",
331
+ disabled: !O,
332
+ onClick: S,
333
+ children: C.t(o ? "threadCommentUI.editor.save" : "threadCommentUI.editor.reply")
334
+ }
335
+ )
336
+ ] }) : null
337
+ ] });
338
+ }), Gt = (t) => {
339
+ const { dataStream: e, customRanges: n } = t, r = e.endsWith(`\r
340
+ `) ? e.length - 2 : e.length, o = [];
279
341
  let s = 0;
280
- return n == null || n.forEach((d) => {
281
- s < d.startIndex && i.push({
342
+ return n == null || n.forEach((l) => {
343
+ s < l.startIndex && o.push({
282
344
  type: "text",
283
- content: e.slice(s, d.startIndex)
284
- }), i.push({
345
+ content: e.slice(s, l.startIndex)
346
+ }), o.push({
285
347
  type: "mention",
286
348
  content: {
287
- label: e.slice(d.startIndex, d.endIndex).slice(1, -1),
288
- id: d.rangeId
349
+ label: e.slice(l.startIndex, l.endIndex + 1),
350
+ id: l.rangeId
289
351
  }
290
- }), s = d.endIndex;
291
- }), i.push({
352
+ }), s = l.endIndex + 1;
353
+ }), o.push({
292
354
  type: "text",
293
355
  content: e.slice(s, r)
294
- }), i;
295
- }, Be = (t) => {
356
+ }), o;
357
+ }, Yt = (t) => {
358
+ const { paragraphs: e = [] } = t;
359
+ let n = 0;
360
+ return e.map((r) => {
361
+ const o = it(t, n, r.startIndex);
362
+ return n = r.startIndex + 1, Gt(o);
363
+ });
364
+ }, Qt = (t) => {
296
365
  let e = "";
297
366
  const n = [];
298
367
  return t.forEach((r) => {
@@ -301,13 +370,13 @@ const zt = "univer-thread-comment-editor-buttons", qt = "univer-thread-comment-e
301
370
  e += r.content;
302
371
  break;
303
372
  case "mention": {
304
- const i = e.length;
305
- e += `${r.content.label}`;
306
- const s = e.length;
373
+ const o = e.length;
374
+ e += r.content.label;
375
+ const s = e.length - 1;
307
376
  n.push({
308
377
  rangeId: r.content.id,
309
- rangeType: tt.MENTION,
310
- startIndex: i,
378
+ rangeType: ot.MENTION,
379
+ startIndex: o,
311
380
  endIndex: s,
312
381
  properties: {}
313
382
  });
@@ -331,417 +400,335 @@ const zt = "univer-thread-comment-editor-buttons", qt = "univer-thread-comment-e
331
400
  dataStream: e,
332
401
  customRanges: n
333
402
  };
334
- }, Yt = (t, e, n, r, i) => {
335
- var d, u;
336
- const s = (d = t.raw) == null ? void 0 : d.icon;
337
- return /* @__PURE__ */ o.jsxs("div", { className: ue.threadCommentEditorSuggestion, children: [
338
- s ? /* @__PURE__ */ o.jsx("img", { className: ue.threadCommentEditorSuggestionIcon, src: s }) : null,
339
- /* @__PURE__ */ o.jsx("div", { children: (u = t.display) != null ? u : t.id })
340
- ] });
341
- }, Fe = k((t, e) => {
342
- var w;
343
- const { comment: n, onSave: r, id: i, onCancel: s, autoFocus: d, unitId: u } = t, m = _(nt), y = _(ie), h = _(pe), [v, C] = A({ ...n }), [b, f] = A(!1), I = re(null), P = _(It), N = (w = _(bt).getCurrentTypeOfRenderer(he.UNIVER_DOC)) == null ? void 0 : w.with(xt);
344
- ht(e, () => ({
345
- reply(c) {
346
- var x;
347
- C({
348
- ...n,
349
- text: c,
350
- attachments: []
351
- }), (x = I.current) == null || x.inputElement.focus();
352
- }
353
- }));
354
- const g = () => {
355
- var c;
356
- v.text && (r == null || r({
357
- ...v,
358
- text: v.text
359
- }), f(!1), C({ text: void 0 }), (c = I.current) == null || c.inputElement.blur());
360
- };
361
- return /* @__PURE__ */ o.jsxs("div", { className: ue.threadCommentEditor, onClick: (c) => c.preventDefault(), children: [
362
- /* @__PURE__ */ o.jsx(
363
- vt,
364
- {
365
- ref: I,
366
- autoFocus: d,
367
- style: { width: "100%" },
368
- placeholder: h.t("threadCommentUI.editor.placeholder"),
369
- value: v != null && v.text ? Kt(Ve(v.text)) : "",
370
- onChange: (c) => {
371
- c.target.value || C({ ...n, text: void 0 }), C == null || C({ ...n, text: Be(Gt(c.target.value)) });
372
- },
373
- onFocus: () => {
374
- const c = P.getActiveTextRange();
375
- c && c.collapsed && (N == null || N.removeAllRanges()), N == null || N.blur(), f(!0);
376
- },
377
- children: /* @__PURE__ */ o.jsx(
378
- Ct,
379
- {
380
- trigger: "@",
381
- data: (c, x) => m.list({ search: c, unitId: u }).then((l) => l.list.map(
382
- (R) => R.mentions.map(
383
- (S) => ({
384
- id: S.objectId,
385
- display: S.label,
386
- raw: S
387
- })
388
- )
389
- ).flat()).then(x),
390
- displayTransform: (c, x) => `@${x} `,
391
- renderSuggestion: Yt
392
- },
393
- "@"
394
- )
395
- }
396
- ),
397
- b ? /* @__PURE__ */ o.jsxs("div", { className: ue.threadCommentEditorButtons, children: [
398
- /* @__PURE__ */ o.jsx(
399
- me,
400
- {
401
- style: { marginRight: 12 },
402
- onClick: () => {
403
- s == null || s(), f(!1), C({ text: void 0 }), y.executeCommand(W.id);
404
- },
405
- children: h.t("threadCommentUI.editor.cancel")
406
- }
407
- ),
408
- /* @__PURE__ */ o.jsx(
409
- me,
410
- {
411
- type: "primary",
412
- disabled: !v.text,
413
- onClick: g,
414
- children: h.t(i ? "threadCommentUI.editor.save" : "threadCommentUI.editor.reply")
415
- }
416
- )
417
- ] }) : null
418
- ] });
419
- }), Qt = "univer-thread-comment", Xt = "univer-thread-comment-active", en = "univer-thread-comment-content", tn = "univer-thread-comment-highlight", nn = "univer-thread-comment-icon-container", rn = "univer-thread-comment-icon", on = "univer-thread-comment-title", sn = "univer-thread-comment-title-position", an = "univer-thread-comment-title-highlight", ln = "univer-thread-comment-title-position-text", dn = "univer-thread-comment-username", mn = "univer-thread-comment-item", cn = "univer-thread-comment-item-head", un = "univer-thread-comment-item-title", hn = "univer-thread-comment-item-title-position", vn = "univer-thread-comment-item-title-highlight", Cn = "univer-thread-comment-item-time", fn = "univer-thread-comment-item-content", pn = "univer-thread-comment-item-at", p = {
420
- threadComment: Qt,
421
- threadCommentActive: Xt,
422
- threadCommentContent: en,
423
- threadCommentHighlight: tn,
424
- threadCommentIconContainer: nn,
425
- threadCommentIcon: rn,
426
- threadCommentTitle: on,
403
+ }, Xt = "univer-thread-comment", en = "univer-thread-comment-active", tn = "univer-thread-comment-content", nn = "univer-thread-comment-highlight", rn = "univer-thread-comment-icon-container", on = "univer-thread-comment-icon", an = "univer-thread-comment-title", sn = "univer-thread-comment-title-position", dn = "univer-thread-comment-title-highlight", ln = "univer-thread-comment-title-position-text", mn = "univer-thread-comment-username", cn = "univer-thread-comment-item", un = "univer-thread-comment-item-head", hn = "univer-thread-comment-item-title", Cn = "univer-thread-comment-item-title-position", fn = "univer-thread-comment-item-title-highlight", vn = "univer-thread-comment-item-time", pn = "univer-thread-comment-item-content", gn = "univer-thread-comment-item-at", p = {
404
+ threadComment: Xt,
405
+ threadCommentActive: en,
406
+ threadCommentContent: tn,
407
+ threadCommentHighlight: nn,
408
+ threadCommentIconContainer: rn,
409
+ threadCommentIcon: on,
410
+ threadCommentTitle: an,
427
411
  threadCommentTitlePosition: sn,
428
- threadCommentTitleHighlight: an,
412
+ threadCommentTitleHighlight: dn,
429
413
  threadCommentTitlePositionText: ln,
430
- threadCommentUsername: dn,
431
- threadCommentItem: mn,
432
- threadCommentItemHead: cn,
433
- threadCommentItemTitle: un,
434
- threadCommentItemTitlePosition: hn,
435
- threadCommentItemTitleHighlight: vn,
436
- threadCommentItemTime: Cn,
437
- threadCommentItemContent: fn,
438
- threadCommentItemAt: pn
439
- }, We = "__mock__", gn = (t) => {
440
- const { item: e, unitId: n, subUnitId: r, editing: i, onEditingChange: s, onReply: d, resolved: u, isRoot: m, onClose: y, onDeleteComment: h } = t, v = _(ie), C = _(pe), b = _(ge), f = b.getUser(e.personId), I = F(b.currentUser$), P = (I == null ? void 0 : I.userID) === e.personId, j = e.id === We, [N, g] = A(!1), w = () => {
441
- (h == null ? void 0 : h(e)) !== !1 && (v.executeCommand(
442
- m ? Oe.id : dt.id,
414
+ threadCommentUsername: mn,
415
+ threadCommentItem: cn,
416
+ threadCommentItemHead: un,
417
+ threadCommentItemTitle: hn,
418
+ threadCommentItemTitlePosition: Cn,
419
+ threadCommentItemTitleHighlight: fn,
420
+ threadCommentItemTime: vn,
421
+ threadCommentItemContent: pn,
422
+ threadCommentItemAt: gn
423
+ }, ze = "__mock__", In = (t) => {
424
+ const { item: e, unitId: n, subUnitId: r, editing: o, onEditingChange: s, onReply: l, resolved: h, isRoot: c, onClose: x, onDeleteComment: C, type: T } = t, b = U(oe), _ = U(pe), u = U(ge), g = u.getUser(e.personId), O = B(u.currentUser$), j = (O == null ? void 0 : O.userID) === e.personId, D = e.id === ze, [S, M] = k(!1), m = () => {
425
+ (C == null ? void 0 : C(e)) !== !1 && (b.executeCommand(
426
+ c ? Re.id : ut.id,
443
427
  {
444
428
  unitId: n,
445
429
  subUnitId: r,
446
430
  commentId: e.id
447
431
  }
448
- ), m && (y == null || y()));
432
+ ), c && (x == null || x()));
449
433
  };
450
- return /* @__PURE__ */ o.jsxs("div", { className: p.threadCommentItem, onMouseLeave: () => g(!1), onMouseEnter: () => g(!0), children: [
451
- /* @__PURE__ */ o.jsx("img", { className: p.threadCommentItemHead, src: f == null ? void 0 : f.avatar }),
452
- /* @__PURE__ */ o.jsxs("div", { className: p.threadCommentItemTitle, children: [
453
- /* @__PURE__ */ o.jsx("div", { className: p.threadCommentUsername, children: (f == null ? void 0 : f.name) || " " }),
454
- /* @__PURE__ */ o.jsxs("div", { children: [
455
- j || u ? null : N ? /* @__PURE__ */ o.jsx("div", { className: p.threadCommentIcon, onClick: () => d(f), children: /* @__PURE__ */ o.jsx(De, {}) }) : null,
456
- P && !j && !u ? /* @__PURE__ */ o.jsx(
457
- pt,
434
+ return /* @__PURE__ */ i.jsxs("div", { className: p.threadCommentItem, onMouseLeave: () => M(!1), onMouseEnter: () => M(!0), children: [
435
+ /* @__PURE__ */ i.jsx("img", { className: p.threadCommentItemHead, src: g == null ? void 0 : g.avatar }),
436
+ /* @__PURE__ */ i.jsxs("div", { className: p.threadCommentItemTitle, children: [
437
+ /* @__PURE__ */ i.jsx("div", { className: p.threadCommentUsername, children: (g == null ? void 0 : g.name) || " " }),
438
+ /* @__PURE__ */ i.jsxs("div", { children: [
439
+ D || h ? null : S ? /* @__PURE__ */ i.jsx("div", { className: p.threadCommentIcon, onClick: () => l(g), children: /* @__PURE__ */ i.jsx(Ae, {}) }) : null,
440
+ j && !D && !h ? /* @__PURE__ */ i.jsx(
441
+ gt,
458
442
  {
459
- overlay: /* @__PURE__ */ o.jsxs(gt, { children: [
460
- /* @__PURE__ */ o.jsx(xe, { onClick: () => s == null ? void 0 : s(!0), children: C.t("threadCommentUI.item.edit") }, "edit"),
461
- /* @__PURE__ */ o.jsx(xe, { onClick: w, children: C.t("threadCommentUI.item.delete") }, "delete")
443
+ overlay: /* @__PURE__ */ i.jsxs(It, { children: [
444
+ /* @__PURE__ */ i.jsx(be, { onClick: () => s == null ? void 0 : s(!0), children: _.t("threadCommentUI.item.edit") }, "edit"),
445
+ /* @__PURE__ */ i.jsx(be, { onClick: m, children: _.t("threadCommentUI.item.delete") }, "delete")
462
446
  ] }),
463
- children: /* @__PURE__ */ o.jsx("div", { className: p.threadCommentIcon, children: /* @__PURE__ */ o.jsx(He, {}) })
447
+ children: /* @__PURE__ */ i.jsx("div", { className: p.threadCommentIcon, children: /* @__PURE__ */ i.jsx(Le, {}) })
464
448
  }
465
449
  ) : null
466
450
  ] })
467
451
  ] }),
468
- /* @__PURE__ */ o.jsx("div", { className: p.threadCommentItemTime, children: e.dT }),
469
- i ? /* @__PURE__ */ o.jsx(
470
- Fe,
452
+ /* @__PURE__ */ i.jsx("div", { className: p.threadCommentItemTime, children: e.dT }),
453
+ o ? /* @__PURE__ */ i.jsx(
454
+ We,
471
455
  {
456
+ type: T,
472
457
  id: e.id,
473
458
  comment: e,
474
459
  onCancel: () => s == null ? void 0 : s(!1),
475
460
  autoFocus: !0,
476
461
  unitId: n,
477
462
  subUnitId: r,
478
- onSave: ({ text: c, attachments: x }) => {
479
- s == null || s(!1), v.executeCommand(
480
- at.id,
463
+ onSave: ({ text: f, attachments: I }) => {
464
+ s == null || s(!1), b.executeCommand(
465
+ mt.id,
481
466
  {
482
467
  unitId: n,
483
468
  subUnitId: r,
484
469
  payload: {
485
470
  commentId: e.id,
486
- text: c,
487
- attachments: x
471
+ text: f,
472
+ attachments: I
488
473
  }
489
474
  }
490
475
  );
491
476
  }
492
477
  }
493
- ) : /* @__PURE__ */ o.jsx("div", { className: p.threadCommentItemContent, children: Ve(e.text).map((c, x) => {
494
- switch (c.type) {
478
+ ) : /* @__PURE__ */ i.jsx("div", { className: p.threadCommentItemContent, children: Yt(e.text).map((f, I) => /* @__PURE__ */ i.jsx("div", { children: f.map((d, v) => {
479
+ switch (d.type) {
495
480
  case "mention":
496
- return /* @__PURE__ */ o.jsxs("a", { className: p.threadCommentItemAt, children: [
497
- "@",
498
- c.content.label,
481
+ return /* @__PURE__ */ i.jsxs("a", { className: p.threadCommentItemAt, children: [
482
+ d.content.label,
499
483
  " "
500
- ] }, x);
484
+ ] }, v);
501
485
  default:
502
- return c.content;
486
+ return d.content;
503
487
  }
504
- }) })
488
+ }) }, I)) })
505
489
  ] });
506
- }, In = (t) => {
507
- var se, Q, X;
490
+ }, xn = (t) => {
491
+ var Q, X, se;
508
492
  const {
509
493
  id: e,
510
494
  unitId: n,
511
495
  subUnitId: r,
512
- refStr: i,
496
+ refStr: o,
513
497
  showEdit: s = !0,
514
- onClick: d,
515
- showHighlight: u,
516
- onClose: m,
517
- getSubUnitName: y,
518
- prefix: h,
519
- autoFocus: v,
520
- onMouseEnter: C,
521
- onMouseLeave: b,
522
- onAddComment: f,
523
- onDeleteComment: I,
524
- onResolve: P
525
- } = t, j = _(Ee), [N, g] = A(!1), [w, c] = A(""), x = de(() => j.commentUpdate$.pipe(ct(16)), [j]);
526
- F(x);
527
- const l = e ? j.getCommentWithChildren(n, r, e) : null, R = _(ie), S = _(ge), M = l == null ? void 0 : l.root.resolved, O = F(S.currentUser$), G = re(null), K = [
528
- ...l ? [l.root] : (
498
+ onClick: l,
499
+ showHighlight: h,
500
+ onClose: c,
501
+ getSubUnitName: x,
502
+ prefix: C,
503
+ autoFocus: T,
504
+ onMouseEnter: b,
505
+ onMouseLeave: _,
506
+ onAddComment: u,
507
+ onDeleteComment: g,
508
+ onResolve: O,
509
+ type: j
510
+ } = t, D = U(Oe), [S, M] = k(!1), [m, f] = k(""), I = ne(() => D.commentUpdate$.pipe(Ct(16)), [D]);
511
+ B(I);
512
+ const d = e ? D.getCommentWithChildren(n, r, e) : null, v = U(oe), q = U(ge), N = d == null ? void 0 : d.root.resolved, y = B(q.currentUser$), Z = re(null), ie = [
513
+ ...d ? [d.root] : (
529
514
  // mock empty comment
530
515
  [{
531
- id: We,
516
+ id: ze,
532
517
  text: {
533
518
  dataStream: `
534
519
  \r`
535
520
  },
536
- personId: (se = O == null ? void 0 : O.userID) != null ? se : "",
537
- ref: i != null ? i : "",
521
+ personId: (Q = y == null ? void 0 : y.userID) != null ? Q : "",
522
+ ref: o != null ? o : "",
538
523
  dT: "",
539
524
  unitId: n,
540
525
  subUnitId: r,
541
526
  threadId: ""
542
527
  }]
543
528
  ),
544
- ...(Q = l == null ? void 0 : l.children) != null ? Q : []
545
- ], L = re(null), H = (T) => {
546
- T.stopPropagation(), M ? R.executeCommand(W.id, {
529
+ ...(X = d == null ? void 0 : d.children) != null ? X : []
530
+ ], R = re(null), K = (E) => {
531
+ E.stopPropagation(), N ? v.executeCommand(F.id, {
547
532
  unitId: n,
548
533
  subUnitId: r,
549
534
  commentId: e
550
- }) : R.executeCommand(W.id), R.executeCommand(lt.id, {
535
+ }) : v.executeCommand(F.id), v.executeCommand(ct.id, {
551
536
  unitId: n,
552
537
  subUnitId: r,
553
538
  commentId: e,
554
- resolved: !M
555
- }), P == null || P(!M);
556
- }, Y = (T) => {
557
- T.stopPropagation(), R.executeCommand(W.id), !(l != null && l.root && (I == null ? void 0 : I(l.root)) === !1) && (R.executeCommand(
558
- Oe.id,
539
+ resolved: !N
540
+ }), O == null || O(!N);
541
+ }, w = (E) => {
542
+ E.stopPropagation(), v.executeCommand(F.id), !(d != null && d.root && (g == null ? void 0 : g(d.root)) === !1) && (v.executeCommand(
543
+ Re.id,
559
544
  {
560
545
  unitId: n,
561
546
  subUnitId: r,
562
547
  commentId: e
563
548
  }
564
- ), m == null || m());
549
+ ), c == null || c());
565
550
  };
566
- fe(() => b == null ? void 0 : b(), []);
567
- const D = y((X = l == null ? void 0 : l.root.subUnitId) != null ? X : r), oe = s && !w && !M, Z = `${i || (l == null ? void 0 : l.root.ref) || ""}${D ? " · " : ""}${D}`;
568
- return /* @__PURE__ */ o.jsxs(
551
+ me(() => _ == null ? void 0 : _(), []);
552
+ const G = x((se = d == null ? void 0 : d.root.subUnitId) != null ? se : r), Y = s && !m && !N, ae = `${o || (d == null ? void 0 : d.root.ref) || ""}${G ? " · " : ""}${G}`;
553
+ return /* @__PURE__ */ i.jsxs(
569
554
  "div",
570
555
  {
571
- className: Wt(p.threadComment, {
572
- [p.threadCommentActive]: !M && (u || N || h === "cell")
556
+ className: zt(p.threadComment, {
557
+ [p.threadCommentActive]: !N && (h || S || C === "cell")
573
558
  }),
574
- onClick: d,
575
- id: `${h}-${n}-${r}-${e}`,
559
+ onClick: l,
560
+ id: `${C}-${n}-${r}-${e}`,
576
561
  onMouseEnter: () => {
577
- C == null || C(), g(!0);
562
+ b == null || b(), M(!0);
578
563
  },
579
564
  onMouseLeave: () => {
580
- b == null || b(), g(!1);
565
+ _ == null || _(), M(!1);
581
566
  },
582
567
  children: [
583
- !M && u ? /* @__PURE__ */ o.jsx("div", { className: p.threadCommentHighlight }) : null,
584
- /* @__PURE__ */ o.jsxs("div", { className: p.threadCommentTitle, children: [
585
- /* @__PURE__ */ o.jsxs("div", { className: p.threadCommentTitlePosition, children: [
586
- /* @__PURE__ */ o.jsx("div", { className: p.threadCommentTitleHighlight }),
587
- /* @__PURE__ */ o.jsx(ft, { showIfEllipsis: !0, title: Z, children: /* @__PURE__ */ o.jsx("div", { className: p.threadCommentTitlePositionText, children: Z }) })
568
+ !N && h ? /* @__PURE__ */ i.jsx("div", { className: p.threadCommentHighlight }) : null,
569
+ /* @__PURE__ */ i.jsxs("div", { className: p.threadCommentTitle, children: [
570
+ /* @__PURE__ */ i.jsxs("div", { className: p.threadCommentTitlePosition, children: [
571
+ /* @__PURE__ */ i.jsx("div", { className: p.threadCommentTitleHighlight }),
572
+ /* @__PURE__ */ i.jsx(pt, { showIfEllipsis: !0, title: ae, children: /* @__PURE__ */ i.jsx("div", { className: p.threadCommentTitlePositionText, children: ae }) })
588
573
  ] }),
589
- l ? /* @__PURE__ */ o.jsxs("div", { className: p.threadCommentIconContainer, children: [
590
- /* @__PURE__ */ o.jsx(
574
+ d ? /* @__PURE__ */ i.jsxs("div", { className: p.threadCommentIconContainer, children: [
575
+ /* @__PURE__ */ i.jsx(
591
576
  "div",
592
577
  {
593
- onClick: H,
578
+ onClick: K,
594
579
  className: p.threadCommentIcon,
595
- style: { color: M ? "rgb(var(--green-500))" : "" },
596
- children: M ? /* @__PURE__ */ o.jsx(Ae, {}) : /* @__PURE__ */ o.jsx(ke, {})
580
+ style: { color: N ? "rgb(var(--green-500))" : "" },
581
+ children: N ? /* @__PURE__ */ i.jsx(Ve, {}) : /* @__PURE__ */ i.jsx(Be, {})
597
582
  }
598
583
  ),
599
- (O == null ? void 0 : O.userID) === l.root.personId ? /* @__PURE__ */ o.jsx("div", { className: p.threadCommentIcon, onClick: Y, children: /* @__PURE__ */ o.jsx($e, {}) }) : null
584
+ (y == null ? void 0 : y.userID) === d.root.personId ? /* @__PURE__ */ i.jsx("div", { className: p.threadCommentIcon, onClick: w, children: /* @__PURE__ */ i.jsx(we, {}) }) : null
600
585
  ] }) : null
601
586
  ] }),
602
- /* @__PURE__ */ o.jsx("div", { className: p.threadCommentContent, ref: L, children: K.map(
603
- (T) => /* @__PURE__ */ o.jsx(
604
- gn,
587
+ /* @__PURE__ */ i.jsx("div", { className: p.threadCommentContent, ref: R, children: ie.map(
588
+ (E) => /* @__PURE__ */ i.jsx(
589
+ In,
605
590
  {
606
- onClose: m,
591
+ onClose: c,
607
592
  unitId: n,
608
593
  subUnitId: r,
609
- item: T,
610
- isRoot: T.id === (l == null ? void 0 : l.root.id),
611
- editing: w === T.id,
612
- resolved: l == null ? void 0 : l.root.resolved,
613
- onEditingChange: ($) => {
614
- c($ ? T.id : "");
594
+ item: E,
595
+ isRoot: E.id === (d == null ? void 0 : d.root.id),
596
+ editing: m === E.id,
597
+ resolved: d == null ? void 0 : d.root.resolved,
598
+ type: j,
599
+ onEditingChange: (a) => {
600
+ f(a ? E.id : "");
615
601
  },
616
- onReply: ($) => {
617
- $ && requestAnimationFrame(() => {
618
- var a;
619
- (a = G.current) == null || a.reply(Be([{
602
+ onReply: (a) => {
603
+ a && requestAnimationFrame(() => {
604
+ var H;
605
+ (H = Z.current) == null || H.reply(Qt([{
620
606
  type: "mention",
621
607
  content: {
622
- id: $.userID,
623
- label: $.name
608
+ id: a.userID,
609
+ label: a.name
624
610
  }
625
611
  }]));
626
612
  });
627
613
  },
628
- onAddComment: f,
629
- onDeleteComment: I
614
+ onAddComment: u,
615
+ onDeleteComment: g
630
616
  },
631
- T.id
617
+ E.id
632
618
  )
633
619
  ) }),
634
- oe ? /* @__PURE__ */ o.jsx("div", { children: /* @__PURE__ */ o.jsx(
635
- Fe,
620
+ Y ? /* @__PURE__ */ i.jsx("div", { children: /* @__PURE__ */ i.jsx(
621
+ We,
636
622
  {
637
- ref: G,
623
+ ref: Z,
624
+ type: j,
638
625
  unitId: n,
639
626
  subUnitId: r,
640
- onSave: async ({ text: T, attachments: $ }) => {
641
- const a = {
642
- text: T,
643
- attachments: $,
644
- dT: ot(),
645
- id: rt(),
646
- ref: i,
647
- personId: O == null ? void 0 : O.userID,
648
- parentId: l == null ? void 0 : l.root.id,
627
+ onSave: async ({ text: E, attachments: a }) => {
628
+ const H = {
629
+ text: E,
630
+ attachments: a,
631
+ dT: dt(),
632
+ id: at(),
633
+ ref: o,
634
+ personId: y == null ? void 0 : y.userID,
635
+ parentId: d == null ? void 0 : d.root.id,
649
636
  unitId: n,
650
637
  subUnitId: r,
651
- threadId: l == null ? void 0 : l.root.threadId
638
+ threadId: d == null ? void 0 : d.root.threadId
652
639
  };
653
- (f == null ? void 0 : f(a)) !== !1 && (await R.executeCommand(
654
- st.id,
640
+ (u == null ? void 0 : u(H)) !== !1 && (await v.executeCommand(
641
+ lt.id,
655
642
  {
656
643
  unitId: n,
657
644
  subUnitId: r,
658
- comment: a
645
+ comment: H
659
646
  }
660
- ), L.current && (L.current.scrollTop = L.current.scrollHeight));
647
+ ), R.current && (R.current.scrollTop = R.current.scrollHeight));
661
648
  },
662
- autoFocus: v || !l,
649
+ autoFocus: T || !d,
663
650
  onCancel: () => {
664
- l || m == null || m();
651
+ d || c == null || c();
665
652
  }
666
653
  },
667
- `${v}`
654
+ `${T}`
668
655
  ) }) : null
669
656
  ]
670
657
  }
671
658
  );
672
- }, xn = "univer-thread-comment-panel", bn = "univer-thread-comment", _n = "univer-thread-comment-panel-forms", Sn = "univer-select", yn = "univer-thread-comment-panel-empty", jn = "univer-thread-comment-panel-add", Nn = "univer-thread-comment-panel-solved", ne = {
673
- threadCommentPanel: xn,
674
- threadComment: bn,
675
- threadCommentPanelForms: _n,
676
- select: Sn,
677
- threadCommentPanelEmpty: yn,
659
+ }, bn = "univer-thread-comment-panel", _n = "univer-thread-comment", Sn = "univer-thread-comment-panel-forms", yn = "univer-select", Tn = "univer-thread-comment-panel-empty", jn = "univer-thread-comment-panel-add", Nn = "univer-thread-comment-panel-solved", te = {
660
+ threadCommentPanel: bn,
661
+ threadComment: _n,
662
+ threadCommentPanelForms: Sn,
663
+ select: yn,
664
+ threadCommentPanelEmpty: Tn,
678
665
  threadCommentPanelAdd: jn,
679
666
  threadCommentPanelSolved: Nn
680
- }, Dn = (t) => {
667
+ }, Mn = (t) => {
681
668
  const {
682
669
  unitId: e,
683
670
  subUnitId$: n,
684
671
  type: r,
685
- onAdd: i,
672
+ onAdd: o,
686
673
  getSubUnitName: s,
687
- onResolve: d,
688
- sortComments: u,
689
- onItemLeave: m,
690
- onItemEnter: y,
691
- disableAdd: h,
692
- tempComment: v,
693
- onAddComment: C,
694
- onDeleteComment: b,
695
- showComments: f
696
- } = t, [I, P] = A("all"), [j, N] = A("all"), g = _(pe), w = _(ge), c = _(Ee), [x, l] = A(() => c.getUnit(e)), R = _(J), S = F(R.activeCommentId$), M = F(c.commentUpdate$), O = _(ie), G = F(n), K = re(!0), L = "panel", H = F(w.currentUser$), Y = de(() => {
674
+ onResolve: l,
675
+ sortComments: h,
676
+ onItemLeave: c,
677
+ onItemEnter: x,
678
+ disableAdd: C,
679
+ tempComment: T,
680
+ onAddComment: b,
681
+ onDeleteComment: _,
682
+ showComments: u
683
+ } = t, [g, O] = k("all"), [j, D] = k("all"), S = U(pe), M = U(ge), m = U(Oe), [f, I] = k(() => m.getUnit(e)), d = U(J), v = B(d.activeCommentId$), q = B(m.commentUpdate$), N = U(oe), y = B(n), Z = re(!0), ie = "panel", R = B(M.currentUser$), K = ne(() => {
697
684
  var le;
698
- const a = I === "all" ? x : (le = x.filter((E) => E.subUnitId === G)) != null ? le : [], ee = u != null ? u : (E) => E, ae = a.map((E) => {
699
- var V;
700
- return { ...E.root, children: (V = E.children) != null ? V : [], users: E.relativeUsers };
685
+ const a = g === "all" ? f : (le = f.filter((P) => P.subUnitId === y)) != null ? le : [], H = h != null ? h : (P) => P, de = a.map((P) => {
686
+ var A;
687
+ return { ...P.root, children: (A = P.children) != null ? A : [], users: P.relativeUsers };
701
688
  });
702
- if (f) {
703
- const E = /* @__PURE__ */ new Map();
704
- return ae.forEach((V) => {
705
- E.set(V.id, V);
706
- }), [...f, ""].map((V) => E.get(V)).filter(Boolean);
689
+ if (u) {
690
+ const P = /* @__PURE__ */ new Map();
691
+ return de.forEach((A) => {
692
+ P.set(A.id, A);
693
+ }), [...u, ""].map((A) => P.get(A)).filter(Boolean);
707
694
  } else
708
- return ee(ae);
709
- }, [f, I, x, u, G]), D = de(() => [
710
- ...Y.filter((a) => !a.resolved),
711
- ...Y.filter((a) => a.resolved)
712
- ], [Y]), oe = de(() => j === "resolved" ? D.filter((a) => a.resolved) : j === "unsolved" ? D.filter((a) => !a.resolved) : j === "concern_me" && H != null && H.userID ? D.filter((a) => a == null ? void 0 : a.users.has(H.userID)) : D, [D, H == null ? void 0 : H.userID, j]), Z = v ? [v, ...oe] : oe, se = Z.filter((a) => !a.resolved), Q = Z.filter((a) => a.resolved), X = j !== "all" || I !== "all", T = () => {
713
- N("all"), P("all");
695
+ return H(de);
696
+ }, [u, g, f, h, y]), w = ne(() => [
697
+ ...K.filter((a) => !a.resolved),
698
+ ...K.filter((a) => a.resolved)
699
+ ], [K]), G = ne(() => j === "resolved" ? w.filter((a) => a.resolved) : j === "unsolved" ? w.filter((a) => !a.resolved) : j === "concern_me" && R != null && R.userID ? w.filter((a) => a == null ? void 0 : a.users.has(R.userID)) : w, [w, R == null ? void 0 : R.userID, j]), Y = T ? [T, ...G] : G, ae = Y.filter((a) => !a.resolved), Q = Y.filter((a) => a.resolved), X = j !== "all" || g !== "all", se = () => {
700
+ D("all"), O("all");
714
701
  };
715
- fe(() => {
716
- e && l(
717
- c.getUnit(e)
702
+ me(() => {
703
+ e && I(
704
+ m.getUnit(e)
718
705
  );
719
- }, [e, c, M]), fe(() => {
720
- var E;
721
- if (!S)
706
+ }, [e, m, q]), me(() => {
707
+ var P;
708
+ if (!v)
722
709
  return;
723
- if (!K.current) {
724
- K.current = !0;
710
+ if (!Z.current) {
711
+ Z.current = !0;
725
712
  return;
726
713
  }
727
- const { unitId: a, subUnitId: ee, commentId: ae } = S, le = `${L}-${a}-${ee}-${ae}`;
728
- (E = document.getElementById(le)) == null || E.scrollIntoView({ block: "center" });
729
- }, [S]);
730
- const $ = (a) => /* @__PURE__ */ o.jsx(
731
- In,
714
+ const { unitId: a, subUnitId: H, commentId: de } = v, le = `${ie}-${a}-${H}-${de}`;
715
+ (P = document.getElementById(le)) == null || P.scrollIntoView({ block: "center" });
716
+ }, [v]);
717
+ const E = (a) => /* @__PURE__ */ i.jsx(
718
+ xn,
732
719
  {
733
- prefix: L,
720
+ prefix: ie,
734
721
  getSubUnitName: s,
735
722
  id: a.id,
736
723
  unitId: a.unitId,
737
724
  subUnitId: a.subUnitId,
738
725
  refStr: a.ref,
739
726
  type: r,
740
- showEdit: (S == null ? void 0 : S.commentId) === a.id,
741
- showHighlight: (S == null ? void 0 : S.commentId) === a.id,
727
+ showEdit: (v == null ? void 0 : v.commentId) === a.id,
728
+ showHighlight: (v == null ? void 0 : v.commentId) === a.id,
742
729
  onClick: () => {
743
- K.current = !1, a.resolved ? O.executeCommand(W.id) : O.executeCommand(
744
- W.id,
730
+ Z.current = !1, a.resolved ? N.executeCommand(F.id) : N.executeCommand(
731
+ F.id,
745
732
  {
746
733
  unitId: a.unitId,
747
734
  subUnitId: a.subUnitId,
@@ -750,84 +737,84 @@ const zt = "univer-thread-comment-editor-buttons", qt = "univer-thread-comment-e
750
737
  }
751
738
  );
752
739
  },
753
- onMouseEnter: () => y == null ? void 0 : y(a),
754
- onMouseLeave: () => m == null ? void 0 : m(a),
755
- onAddComment: C,
756
- onDeleteComment: b,
757
- onResolve: (ee) => d == null ? void 0 : d(a.id, ee)
740
+ onMouseEnter: () => x == null ? void 0 : x(a),
741
+ onMouseLeave: () => c == null ? void 0 : c(a),
742
+ onAddComment: b,
743
+ onDeleteComment: _,
744
+ onResolve: (H) => l == null ? void 0 : l(a.id, H)
758
745
  },
759
746
  a.id
760
747
  );
761
- return /* @__PURE__ */ o.jsxs("div", { className: ne.threadCommentPanel, children: [
762
- /* @__PURE__ */ o.jsxs("div", { className: ne.threadCommentPanelForms, children: [
763
- r === he.UNIVER_SHEET ? /* @__PURE__ */ o.jsx(
764
- be,
748
+ return /* @__PURE__ */ i.jsxs("div", { className: te.threadCommentPanel, children: [
749
+ /* @__PURE__ */ i.jsxs("div", { className: te.threadCommentPanelForms, children: [
750
+ r === he.UNIVER_SHEET ? /* @__PURE__ */ i.jsx(
751
+ _e,
765
752
  {
766
753
  borderless: !0,
767
- value: I,
768
- onChange: (a) => P(a),
754
+ value: g,
755
+ onChange: (a) => O(a),
769
756
  options: [
770
757
  {
771
758
  value: "current",
772
- label: g.t("threadCommentUI.filter.sheet.current")
759
+ label: S.t("threadCommentUI.filter.sheet.current")
773
760
  },
774
761
  {
775
762
  value: "all",
776
- label: g.t("threadCommentUI.filter.sheet.all")
763
+ label: S.t("threadCommentUI.filter.sheet.all")
777
764
  }
778
765
  ]
779
766
  }
780
767
  ) : null,
781
- /* @__PURE__ */ o.jsx(
782
- be,
768
+ /* @__PURE__ */ i.jsx(
769
+ _e,
783
770
  {
784
771
  borderless: !0,
785
772
  value: j,
786
- onChange: (a) => N(a),
773
+ onChange: (a) => D(a),
787
774
  options: [
788
775
  {
789
776
  value: "all",
790
- label: g.t("threadCommentUI.filter.status.all")
777
+ label: S.t("threadCommentUI.filter.status.all")
791
778
  },
792
779
  {
793
780
  value: "resolved",
794
- label: g.t("threadCommentUI.filter.status.resolved")
781
+ label: S.t("threadCommentUI.filter.status.resolved")
795
782
  },
796
783
  {
797
784
  value: "unsolved",
798
- label: g.t("threadCommentUI.filter.status.unsolved")
785
+ label: S.t("threadCommentUI.filter.status.unsolved")
799
786
  },
800
787
  {
801
788
  value: "concern_me",
802
- label: g.t("threadCommentUI.filter.status.concernMe")
789
+ label: S.t("threadCommentUI.filter.status.concernMe")
803
790
  }
804
791
  ]
805
792
  }
806
793
  )
807
794
  ] }),
808
- se.map($),
809
- Q.length ? /* @__PURE__ */ o.jsx("div", { className: ne.threadCommentPanelSolved, children: "已解决" }) : null,
810
- Q.map($),
811
- Z.length ? null : /* @__PURE__ */ o.jsxs("div", { className: ne.threadCommentPanelEmpty, children: [
812
- X ? g.t("threadCommentUI.panel.filterEmpty") : g.t("threadCommentUI.panel.empty"),
813
- X ? /* @__PURE__ */ o.jsx(
814
- me,
795
+ ae.map(E),
796
+ Q.length ? /* @__PURE__ */ i.jsx("div", { className: te.threadCommentPanelSolved, children: "已解决" }) : null,
797
+ Q.map(E),
798
+ Y.length ? null : /* @__PURE__ */ i.jsxs("div", { className: te.threadCommentPanelEmpty, children: [
799
+ X ? S.t("threadCommentUI.panel.filterEmpty") : S.t("threadCommentUI.panel.empty"),
800
+ X ? /* @__PURE__ */ i.jsx(
801
+ ce,
815
802
  {
816
- onClick: T,
803
+ onClick: se,
817
804
  type: "link",
818
- children: g.t("threadCommentUI.panel.reset")
805
+ children: S.t("threadCommentUI.panel.reset")
819
806
  }
820
- ) : /* @__PURE__ */ o.jsxs(
821
- me,
807
+ ) : /* @__PURE__ */ i.jsxs(
808
+ ce,
822
809
  {
823
810
  id: "thread-comment-add",
824
- className: ne.threadCommentPanelAdd,
811
+ className: te.threadCommentPanelAdd,
825
812
  type: "primary",
826
- onClick: i,
827
- disabled: h,
813
+ onClick: o,
814
+ disabled: C,
828
815
  children: [
829
- /* @__PURE__ */ o.jsx(we, {}),
830
- g.t("threadCommentUI.panel.addComment")
816
+ /* @__PURE__ */ i.jsx(ke, {}),
817
+ S.t("threadCommentUI.panel.addComment")
831
818
  ]
832
819
  }
833
820
  )
@@ -835,11 +822,11 @@ const zt = "univer-thread-comment-editor-buttons", qt = "univer-thread-comment-e
835
822
  ] });
836
823
  };
837
824
  export {
838
- W as SetActiveCommentOperation,
825
+ F as SetActiveCommentOperation,
839
826
  jt as THREAD_COMMENT_PANEL,
840
- Dn as ThreadCommentPanel,
827
+ Mn as ThreadCommentPanel,
841
828
  J as ThreadCommentPanelService,
842
- In as ThreadCommentTree,
843
- Tt as ToggleSheetCommentPanelOperation,
844
- ce as UniverThreadCommentUIPlugin
829
+ xn as ThreadCommentTree,
830
+ Et as ToggleSheetCommentPanelOperation,
831
+ ue as UniverThreadCommentUIPlugin
845
832
  };