@univerjs/find-replace 0.1.11 → 0.1.13

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,94 +1,94 @@
1
1
  var at = Object.defineProperty;
2
2
  var ot = (t, e, n) => e in t ? at(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
3
3
  var c = (t, e, n) => (ot(t, typeof e != "symbol" ? e + "" : e, n), n);
4
- import { Disposable as ee, IUniverInstanceService as ue, ILogService as pe, toDisposable as z, IContextService as U, DisposableCollection as ct, CommandType as M, LocaleService as D, ICommandService as te, FOCUSING_SHEET as fe, EDITOR_ACTIVATED as _e, UniverInstanceType as lt, RxDisposable as dt, OnLifecycle as ht, LifecycleStages as ut, Plugin as pt } from "@univerjs/core";
5
- import { createIdentifier as ft, Inject as y, Injector as ge } from "@wendellhu/redi";
6
- import { IConfirmService as _t, IMessageService as me, useObservable as I, ILayoutService as ve, KeyCode as b, MetaKeys as x, MenuGroup as gt, MenuItemType as mt, MenuPosition as vt, getMenuHiddenObservable as St, ComponentManager as Ct, IMenuService as Rt, IShortcutService as bt, IDialogService as xt } from "@univerjs/ui";
7
- import { BehaviorSubject as F, Subject as Se, throttleTime as Mt, combineLatest as Ce, debounceTime as yt, fromEvent as It, map as Ft, takeUntil as oe } from "rxjs";
8
- import { RENDER_RAW_FORMULA_KEY as Dt } from "@univerjs/engine-render";
9
- import Pt, { forwardRef as B, useRef as K, createElement as Re, useCallback as _, Fragment as E, useEffect as w, useMemo as ie, useImperativeHandle as Ot } from "react";
10
- import { MessageType as $, InputWithSlot as Tt, Pager as Et, Button as N, FormLayout as R, Input as $t, Select as H, FormDualColumnLayout as ce, Checkbox as le } from "@univerjs/design";
4
+ import { Disposable as X, IUniverInstanceService as pe, ILogService as ct, toDisposable as q, IContextService as ee, DisposableCollection as lt, CommandType as y, LocaleService as D, ICommandService as te, FOCUSING_SHEET as _e, EDITOR_ACTIVATED as ge, UniverInstanceType as dt, RxDisposable as ht, OnLifecycle as ut, LifecycleStages as ft, Plugin as pt, Tools as _t } from "@univerjs/core";
5
+ import { createIdentifier as gt, Inject as x, Injector as ie } from "@wendellhu/redi";
6
+ import { IConfirmService as mt, IMessageService as me, useObservable as I, ILayoutService as ve, KeyCode as M, MetaKeys as b, MenuGroup as vt, MenuItemType as St, MenuPosition as Ct, getMenuHiddenObservable as Rt, ComponentManager as Mt, IMenuService as xt, IShortcutService as bt, IDialogService as yt } from "@univerjs/ui";
7
+ import { BehaviorSubject as P, Subject as Se, throttleTime as It, combineLatest as Ce, debounceTime as Ft, fromEvent as Pt, map as Dt, takeUntil as ce } from "rxjs";
8
+ import { RENDER_RAW_FORMULA_KEY as Ot } from "@univerjs/engine-render";
9
+ import Tt, { forwardRef as U, useRef as z, createElement as Re, useCallback as _, Fragment as $, useEffect as j, useMemo as ne, useImperativeHandle as Et } from "react";
10
+ import { MessageType as N, InputWithSlot as $t, Pager as Nt, Button as A, FormLayout as R, Input as At, Select as k, FormDualColumnLayout as le, Checkbox as de } from "@univerjs/design";
11
11
  import { useDependency as S } from "@wendellhu/redi/react-bindings";
12
- var m = function() {
13
- return m = Object.assign || function(t) {
12
+ var g = function() {
13
+ return g = Object.assign || function(t) {
14
14
  for (var e, n = 1, i = arguments.length; n < i; n++) {
15
15
  e = arguments[n];
16
- for (var r in e)
17
- Object.prototype.hasOwnProperty.call(e, r) && (t[r] = e[r]);
16
+ for (var s in e)
17
+ Object.prototype.hasOwnProperty.call(e, s) && (t[s] = e[s]);
18
18
  }
19
19
  return t;
20
- }, m.apply(this, arguments);
21
- }, Nt = function(t, e) {
20
+ }, g.apply(this, arguments);
21
+ }, jt = function(t, e) {
22
22
  var n = {};
23
23
  for (var i in t)
24
24
  Object.prototype.hasOwnProperty.call(t, i) && e.indexOf(i) < 0 && (n[i] = t[i]);
25
25
  if (t != null && typeof Object.getOwnPropertySymbols == "function")
26
- for (var r = 0, i = Object.getOwnPropertySymbols(t); r < i.length; r++)
27
- e.indexOf(i[r]) < 0 && Object.prototype.propertyIsEnumerable.call(t, i[r]) && (n[i[r]] = t[i[r]]);
26
+ for (var s = 0, i = Object.getOwnPropertySymbols(t); s < i.length; s++)
27
+ e.indexOf(i[s]) < 0 && Object.prototype.propertyIsEnumerable.call(t, i[s]) && (n[i[s]] = t[i[s]]);
28
28
  return n;
29
- }, be = B(function(t, e) {
30
- var n = t.icon, i = t.id, r = t.className, s = t.extend, a = Nt(t, ["icon", "id", "className", "extend"]), o = "univerjs-icon univerjs-icon-".concat(i, " ").concat(r || "").trim(), d = K("_".concat(jt()));
31
- return xe(n, "".concat(i), { defIds: n.defIds, idSuffix: d.current }, m({ ref: e, className: o }, a), s);
29
+ }, Me = U(function(t, e) {
30
+ var n = t.icon, i = t.id, s = t.className, r = t.extend, a = jt(t, ["icon", "id", "className", "extend"]), o = "univerjs-icon univerjs-icon-".concat(i, " ").concat(s || "").trim(), d = z("_".concat(Ut()));
31
+ return xe(n, "".concat(i), { defIds: n.defIds, idSuffix: d.current }, g({ ref: e, className: o }, a), r);
32
32
  });
33
- function xe(t, e, n, i, r) {
34
- return Re(t.tag, m(m({ key: e }, At(t, n, r)), i), (wt(t, n).children || []).map(function(s, a) {
35
- return xe(s, "".concat(e, "-").concat(t.tag, "-").concat(a), n, void 0, r);
33
+ function xe(t, e, n, i, s) {
34
+ return Re(t.tag, g(g({ key: e }, Lt(t, n, s)), i), (wt(t, n).children || []).map(function(r, a) {
35
+ return xe(r, "".concat(e, "-").concat(t.tag, "-").concat(a), n, void 0, s);
36
36
  }));
37
37
  }
38
- function At(t, e, n) {
39
- var i = m({}, t.attrs);
38
+ function Lt(t, e, n) {
39
+ var i = g({}, t.attrs);
40
40
  n != null && n.colorChannel1 && i.fill === "colorChannel1" && (i.fill = n.colorChannel1);
41
- var r = e.defIds;
42
- return !r || r.length === 0 || (t.tag === "use" && i["xlink:href"] && (i["xlink:href"] = i["xlink:href"] + e.idSuffix), Object.entries(i).forEach(function(s) {
43
- var a = s[0], o = s[1];
41
+ var s = e.defIds;
42
+ return !s || s.length === 0 || (t.tag === "use" && i["xlink:href"] && (i["xlink:href"] = i["xlink:href"] + e.idSuffix), Object.entries(i).forEach(function(r) {
43
+ var a = r[0], o = r[1];
44
44
  typeof o == "string" && (i[a] = o.replace(/url\(#(.*)\)/, "url(#$1".concat(e.idSuffix, ")")));
45
45
  })), i;
46
46
  }
47
47
  function wt(t, e) {
48
48
  var n, i = e.defIds;
49
- return !i || i.length === 0 ? t : t.tag === "defs" && (!((n = t.children) === null || n === void 0) && n.length) ? m(m({}, t), { children: t.children.map(function(r) {
50
- return typeof r.attrs.id == "string" && i && i.indexOf(r.attrs.id) > -1 ? m(m({}, r), { attrs: m(m({}, r.attrs), { id: r.attrs.id + e.idSuffix }) }) : r;
49
+ return !i || i.length === 0 ? t : t.tag === "defs" && (!((n = t.children) === null || n === void 0) && n.length) ? g(g({}, t), { children: t.children.map(function(s) {
50
+ return typeof s.attrs.id == "string" && i && i.indexOf(s.attrs.id) > -1 ? g(g({}, s), { attrs: g(g({}, s.attrs), { id: s.attrs.id + e.idSuffix }) }) : s;
51
51
  }) }) : t;
52
52
  }
53
- function jt() {
53
+ function Ut() {
54
54
  return Math.random().toString(36).substring(2, 8);
55
55
  }
56
- be.displayName = "UniverIcon";
57
- var Lt = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 17 17", width: "1em", height: "1em" }, children: [{ tag: "mask", attrs: { id: "mask0_217_40", style: { maskType: "alpha" }, width: 17, height: 17, x: 0, y: 0, maskUnits: "userSpaceOnUse" }, children: [{ tag: "path", attrs: { fill: "#D9D9D9", d: "M0.9 0.09H16.9V16.09H0.9z" } }] }, { tag: "g", attrs: { mask: "url(#mask0_217_40)" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M2.39551 7.37266C2.39551 4.18105 4.98281 1.59375 8.17441 1.59375C11.366 1.59375 13.9533 4.18105 13.9533 7.37266C13.9533 8.72342 13.4898 9.96603 12.7133 10.95L15.1964 13.4331C15.4619 13.6986 15.4619 14.1291 15.1964 14.3946C14.9309 14.6601 14.5004 14.6601 14.2349 14.3946L11.7518 11.9115C10.7678 12.6881 9.52525 13.1516 8.17441 13.1516C4.98281 13.1516 2.39551 10.5642 2.39551 7.37266ZM8.17441 2.95349C5.73378 2.95349 3.75525 4.93202 3.75525 7.37266C3.75525 9.81333 5.73378 11.7918 8.17441 11.7918C10.6151 11.7918 12.5936 9.81333 12.5936 7.37266C12.5936 4.93202 10.6151 2.95349 8.17441 2.95349Z", fillRule: "evenodd", clipRule: "evenodd" } }] }] }, Me = B(function(t, e) {
58
- return Re(be, Object.assign({}, t, {
56
+ Me.displayName = "UniverIcon";
57
+ var Bt = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 17 17", width: "1em", height: "1em" }, children: [{ tag: "mask", attrs: { id: "mask0_217_40", style: { maskType: "alpha" }, width: 17, height: 17, x: 0, y: 0, maskUnits: "userSpaceOnUse" }, children: [{ tag: "path", attrs: { fill: "#D9D9D9", d: "M0.9 0.09H16.9V16.09H0.9z" } }] }, { tag: "g", attrs: { mask: "url(#mask0_217_40)" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M2.39551 7.37266C2.39551 4.18105 4.98281 1.59375 8.17441 1.59375C11.366 1.59375 13.9533 4.18105 13.9533 7.37266C13.9533 8.72342 13.4898 9.96603 12.7133 10.95L15.1964 13.4331C15.4619 13.6986 15.4619 14.1291 15.1964 14.3946C14.9309 14.6601 14.5004 14.6601 14.2349 14.3946L11.7518 11.9115C10.7678 12.6881 9.52525 13.1516 8.17441 13.1516C4.98281 13.1516 2.39551 10.5642 2.39551 7.37266ZM8.17441 2.95349C5.73378 2.95349 3.75525 4.93202 3.75525 7.37266C3.75525 9.81333 5.73378 11.7918 8.17441 11.7918C10.6151 11.7918 12.5936 9.81333 12.5936 7.37266C12.5936 4.93202 10.6151 2.95349 8.17441 2.95349Z", fillRule: "evenodd", clipRule: "evenodd" } }] }] }, be = U(function(t, e) {
58
+ return Re(Me, Object.assign({}, t, {
59
59
  id: "search-single-16",
60
60
  ref: e,
61
- icon: Lt
61
+ icon: Bt
62
62
  }));
63
63
  });
64
- Me.displayName = "SearchSingle16";
64
+ be.displayName = "SearchSingle16";
65
65
  const ye = "FIND_REPLACE_INPUT_FOCUS", Ie = "FIND_REPLACE_DIALOG_FOCUS", Fe = "FIND_REPLACE_REPLACE_REVEALED";
66
- var Ut = Object.defineProperty, Bt = Object.getOwnPropertyDescriptor, De = (t, e, n, i) => {
67
- for (var r = i > 1 ? void 0 : i ? Bt(e, n) : e, s = t.length - 1, a; s >= 0; s--)
68
- (a = t[s]) && (r = (i ? a(e, n, r) : a(r)) || r);
69
- return i && r && Ut(e, n, r), r;
70
- }, j = (t, e) => (n, i) => e(n, i, t);
71
- class Li extends ee {
66
+ var Wt = Object.defineProperty, Gt = Object.getOwnPropertyDescriptor, Pe = (t, e, n, i) => {
67
+ for (var s = i > 1 ? void 0 : i ? Gt(e, n) : e, r = t.length - 1, a; r >= 0; r--)
68
+ (a = t[r]) && (s = (i ? a(e, n, s) : a(s)) || s);
69
+ return i && s && Wt(e, n, s), s;
70
+ }, L = (t, e) => (n, i) => e(n, i, t);
71
+ class ji extends X {
72
72
  }
73
- const v = ft("find-replace.service");
74
- function Wt(t) {
73
+ const m = gt("find-replace.service");
74
+ function Vt(t) {
75
75
  return typeof t.findString < "u" || typeof t.inputtingFindString < "u" || typeof t.findDirection < "u" || typeof t.matchesTheWholeCell < "u" || typeof t.caseSensitive < "u" || typeof t.findScope < "u" || typeof t.findBy < "u";
76
76
  }
77
- let Y = class extends ee {
78
- constructor(e, n, i, r) {
77
+ let K = class extends X {
78
+ constructor(e, n, i, s) {
79
79
  super();
80
- c(this, "currentMatch$", new F(null));
81
- c(this, "replaceables$", new F([]));
80
+ c(this, "currentMatch$", new P(null));
81
+ c(this, "replaceables$", new P([]));
82
82
  /** All find models returned by providers. */
83
83
  c(this, "_findModels", []);
84
84
  /** The find model that the current match is from. */
85
85
  c(this, "_matchingModel", null);
86
86
  c(this, "_matches", []);
87
87
  c(this, "_currentSearchingDisposables", null);
88
- this._state = e, this._providers = n, this._univerInstanceService = i, this._logService = r, this.disposeWithMe(
89
- this._state.stateUpdates$.pipe(Mt(200, void 0, { leading: !0, trailing: !0 })).subscribe(async (s) => {
88
+ this._state = e, this._providers = n, this._univerInstanceService = i, this._logService = s, this.disposeWithMe(
89
+ this._state.stateUpdates$.pipe(It(200, void 0, { leading: !0, trailing: !0 })).subscribe(async (r) => {
90
90
  const a = this._state.state;
91
- Wt(s) && (a.findString !== "" && !a.replaceRevealed ? (await this._startSearching(), this._state.changeState({ findCompleted: !0 })) : s.replaceRevealed !== !0 && this._stopSearching());
91
+ Vt(r) && (a.findString !== "" && !a.replaceRevealed ? (await this._startSearching(), this._state.changeState({ findCompleted: !0 })) : r.replaceRevealed !== !0 && this._stopSearching());
92
92
  })
93
93
  );
94
94
  }
@@ -96,7 +96,7 @@ let Y = class extends ee {
96
96
  return this._findModels.length > 0;
97
97
  }
98
98
  dispose() {
99
- super.dispose(), this._stopSearching(), this.currentMatch$.complete(), this.replaceables$.complete(), this._state.changeState({ ...ne(), revealed: !1 });
99
+ super.dispose(), this._stopSearching(), this.currentMatch$.complete(), this.replaceables$.complete(), this._state.changeState({ ...se(), revealed: !1 });
100
100
  }
101
101
  async start() {
102
102
  if (!this._state.findString)
@@ -108,7 +108,7 @@ let Y = class extends ee {
108
108
  async _startSearching() {
109
109
  if (!this._state.findString)
110
110
  return { results: [] };
111
- const e = Array.from(this._providers), n = this._findModels = (await Promise.all(e.map((s) => s.find({
111
+ const e = Array.from(this._providers), n = this._findModels = (await Promise.all(e.map((r) => r.find({
112
112
  findString: this._state.findString,
113
113
  findDirection: this._state.findDirection,
114
114
  findScope: this._state.findScope,
@@ -118,13 +118,13 @@ let Y = class extends ee {
118
118
  matchesTheWholeCell: this._state.matchesTheWholeCell
119
119
  })))).flat();
120
120
  this._subscribeToModelsChanges(n);
121
- const i = this._matches = n.map((s) => s.getMatches()).flat();
122
- if (this.replaceables$.next(i.filter((s) => s.replaceable)), !i.length)
121
+ const i = this._matches = n.map((r) => r.getMatches()).flat();
122
+ if (this.replaceables$.next(i.filter((r) => r.replaceable)), !i.length)
123
123
  return this._state.changeState({ matchesCount: 0, matchesPosition: 0 }), { results: [] };
124
- const r = this._moveToInitialMatch(n, i);
124
+ const s = this._moveToInitialMatch(n, i);
125
125
  return this._state.changeState({
126
126
  matchesCount: i.length,
127
- matchesPosition: r + 1
127
+ matchesPosition: s + 1
128
128
  // the matches position start from 1
129
129
  }), { results: i };
130
130
  }
@@ -139,24 +139,24 @@ let Y = class extends ee {
139
139
  }
140
140
  // When a document's content changes, we should reset all matches and try to move to the next match.
141
141
  _subscribeToModelsChanges(e) {
142
- const n = this._currentSearchingDisposables = new ct(), i = Ce(e.map((r) => r.matchesUpdate$)).pipe(yt(220)).subscribe(([...r]) => {
143
- const s = this._matches = r.flat();
144
- if (s.length) {
145
- const a = this._moveToInitialMatch(this._findModels, s, !0);
146
- this._state.changeState({ matchesCount: s.length, matchesPosition: a + 1 }), this.replaceables$.next(s.filter((o) => o.replaceable));
142
+ const n = this._currentSearchingDisposables = new lt(), i = Ce(e.map((s) => s.matchesUpdate$)).pipe(Ft(220)).subscribe(([...s]) => {
143
+ const r = this._matches = s.flat();
144
+ if (r.length) {
145
+ const a = this._moveToInitialMatch(this._findModels, r, !0);
146
+ this._state.changeState({ matchesCount: r.length, matchesPosition: a + 1 }), this.replaceables$.next(r.filter((o) => o.replaceable));
147
147
  } else
148
148
  this._state.changeState({ matchesCount: 0, matchesPosition: 0 }), this.replaceables$.next([]);
149
149
  });
150
- e.forEach((r) => n.add(z(r.activelyChangingMatch$.subscribe((s) => {
151
- const a = this._matches.findIndex((o) => o === s);
150
+ e.forEach((s) => n.add(q(s.activelyChangingMatch$.subscribe((r) => {
151
+ const a = this._matches.findIndex((o) => o === r);
152
152
  this._state.changeState({ matchesPosition: a + 1 });
153
- })))), n.add(z(i));
153
+ })))), n.add(q(i));
154
154
  }
155
155
  async replace() {
156
156
  return this._matchingModel ? this._matchingModel.replace(this._state.replaceString) : !1;
157
157
  }
158
158
  async replaceAll() {
159
- const e = await Promise.all(this._findModels.map((n) => n.replaceAll(this._state.replaceString))).then((n) => n.reduce((i, r) => (i.success += r.success, i.failure += r.failure, i), { success: 0, failure: 0 }));
159
+ const e = await Promise.all(this._findModels.map((n) => n.replaceAll(this._state.replaceString))).then((n) => n.reduce((i, s) => (i.success += s.success, i.failure += s.failure, i), { success: 0, failure: 0 }));
160
160
  return e.failure === 0 && this._stopSearching(), e;
161
161
  }
162
162
  getCurrentMatch() {
@@ -167,13 +167,13 @@ let Y = class extends ee {
167
167
  return;
168
168
  const e = this._findModels.length === 1, n = this._matchingModel.moveToNextMatch({ loop: e });
169
169
  if (n) {
170
- const i = this._matches.findIndex((r) => r === n);
170
+ const i = this._matches.findIndex((s) => s === n);
171
171
  this.currentMatch$.next(n), this._state.changeState({
172
172
  matchesPosition: i + 1
173
173
  });
174
174
  } else {
175
- const i = this._findModels.findIndex((o) => o === this._matchingModel), r = this._findModels[(i + 1) % this._findModels.length], s = r.moveToNextMatch(), a = this._matches.findIndex((o) => o === s);
176
- this.currentMatch$.next(s), this._matchingModel = r, this._state.changeState({
175
+ const i = this._findModels.findIndex((o) => o === this._matchingModel), s = this._findModels[(i + 1) % this._findModels.length], r = s.moveToNextMatch(), a = this._matches.findIndex((o) => o === r);
176
+ this.currentMatch$.next(r), this._matchingModel = s, this._state.changeState({
177
177
  matchesPosition: a + 1
178
178
  });
179
179
  }
@@ -183,26 +183,26 @@ let Y = class extends ee {
183
183
  return;
184
184
  const e = this._findModels.length === 1, n = this._matchingModel.moveToPreviousMatch({ loop: e });
185
185
  if (n) {
186
- const i = this._matches.findIndex((r) => r === n);
186
+ const i = this._matches.findIndex((s) => s === n);
187
187
  this.currentMatch$.next(n), this._state.changeState({
188
188
  matchesPosition: i + 1
189
189
  });
190
190
  } else {
191
- const i = this._findModels.findIndex((o) => o === this._matchingModel), r = this._findModels[(i - 1 + this._findModels.length) % this._findModels.length], s = r.moveToPreviousMatch(), a = this._matches.findIndex((o) => o === s);
192
- this.currentMatch$.next(s), this._matchingModel = r, this._state.changeState({
191
+ const i = this._findModels.findIndex((o) => o === this._matchingModel), s = this._findModels[(i - 1 + this._findModels.length) % this._findModels.length], r = s.moveToPreviousMatch(), a = this._matches.findIndex((o) => o === r);
192
+ this.currentMatch$.next(r), this._matchingModel = s, this._state.changeState({
193
193
  matchesPosition: a + 1
194
194
  });
195
195
  }
196
196
  }
197
197
  _moveToInitialMatch(e, n, i = !1) {
198
198
  var d;
199
- const r = (d = this._univerInstanceService.getFocusedUnit()) == null ? void 0 : d.getUnitId();
200
- if (!r)
199
+ const s = (d = this._univerInstanceService.getFocusedUnit()) == null ? void 0 : d.getUnitId();
200
+ if (!s)
201
201
  return -1;
202
- const s = e.find((u) => u.unitId === r);
203
- if (s) {
204
- this._matchingModel = s;
205
- const u = s.moveToNextMatch({ stayIfOnMatch: !0, noFocus: i }), f = n.findIndex((p) => p === u);
202
+ const r = e.find((u) => u.unitId === s);
203
+ if (r) {
204
+ this._matchingModel = r;
205
+ const u = r.moveToNextMatch({ stayIfOnMatch: !0, noFocus: i }), f = n.findIndex((p) => p === u);
206
206
  return this.currentMatch$.next(u), f;
207
207
  }
208
208
  this._matchingModel = e[0];
@@ -210,12 +210,12 @@ let Y = class extends ee {
210
210
  return this.currentMatch$.next(a), o;
211
211
  }
212
212
  };
213
- Y = De([
214
- j(2, ue),
215
- j(3, pe)
216
- ], Y);
217
- var Z = /* @__PURE__ */ ((t) => (t.ROW = "row", t.COLUMN = "column", t))(Z || {}), J = /* @__PURE__ */ ((t) => (t.VALUE = "value", t.FORMULA = "formula", t))(J || {}), Q = /* @__PURE__ */ ((t) => (t.SUBUNIT = "subunit", t.UNIT = "unit", t))(Q || {});
218
- function ne() {
213
+ K = Pe([
214
+ L(2, pe),
215
+ L(3, ct)
216
+ ], K);
217
+ var Y = /* @__PURE__ */ ((t) => (t.ROW = "row", t.COLUMN = "column", t))(Y || {}), Z = /* @__PURE__ */ ((t) => (t.VALUE = "value", t.FORMULA = "formula", t))(Z || {}), J = /* @__PURE__ */ ((t) => (t.SUBUNIT = "subunit", t.UNIT = "unit", t))(J || {});
218
+ function se() {
219
219
  return {
220
220
  caseSensitive: !1,
221
221
  findBy: "value",
@@ -236,7 +236,7 @@ class kt {
236
236
  constructor() {
237
237
  c(this, "_stateUpdates$", new Se());
238
238
  c(this, "stateUpdates$", this._stateUpdates$.asObservable());
239
- c(this, "_state$", new F(ne()));
239
+ c(this, "_state$", new P(se()));
240
240
  c(this, "state$", this._state$.asObservable());
241
241
  c(this, "_findString", "");
242
242
  c(this, "_inputtingFindString", "");
@@ -313,15 +313,15 @@ class kt {
313
313
  }), this._stateUpdates$.next(i));
314
314
  }
315
315
  }
316
- let X = class extends ee {
316
+ let Q = class extends X {
317
317
  constructor(e, n) {
318
318
  super();
319
319
  c(this, "_providers", /* @__PURE__ */ new Set());
320
320
  c(this, "_state", new kt());
321
321
  c(this, "_model");
322
- c(this, "_currentMatch$", new F(null));
322
+ c(this, "_currentMatch$", new P(null));
323
323
  c(this, "currentMatch$", this._currentMatch$.asObservable());
324
- c(this, "_replaceables$", new F([]));
324
+ c(this, "_replaceables$", new P([]));
325
325
  c(this, "replaceables$", this._replaceables$.asObservable());
326
326
  c(this, "_focusSignal$", new Se());
327
327
  c(this, "focusSignal$", this._focusSignal$.asObservable());
@@ -399,8 +399,8 @@ let X = class extends ee {
399
399
  start(e = !1) {
400
400
  if (this._providers.size === 0)
401
401
  return !1;
402
- this._model = this._injector.createInstance(Y, this._state, this._providers), this._model.currentMatch$.subscribe((i) => this._currentMatch$.next(i)), this._model.replaceables$.subscribe((i) => this._replaceables$.next(i));
403
- const n = ne();
402
+ this._model = this._injector.createInstance(K, this._state, this._providers), this._model.currentMatch$.subscribe((i) => this._currentMatch$.next(i)), this._model.replaceables$.subscribe((i) => this._replaceables$.next(i));
403
+ const n = se();
404
404
  return e && (n.replaceRevealed = !0), this._state.changeState(n), this._toggleRevealReplace(e), !0;
405
405
  }
406
406
  find() {
@@ -412,43 +412,43 @@ let X = class extends ee {
412
412
  (e = this._model) == null || e.dispose(), this._model = null, this._toggleDisplayRawFormula(!1), this._toggleRevealReplace(!1);
413
413
  }
414
414
  registerFindReplaceProvider(e) {
415
- return this._providers.add(e), z(() => this._providers.delete(e));
415
+ return this._providers.add(e), q(() => this._providers.delete(e));
416
416
  }
417
417
  _toggleRevealReplace(e) {
418
418
  this._contextService.setContextValue(Fe, e);
419
419
  }
420
420
  _toggleDisplayRawFormula(e) {
421
- this._contextService.setContextValue(Dt, e);
421
+ this._contextService.setContextValue(Ot, e);
422
422
  }
423
423
  };
424
- X = De([
425
- j(0, y(ge)),
426
- j(1, U)
427
- ], X);
428
- const W = {
424
+ Q = Pe([
425
+ L(0, x(ie)),
426
+ L(1, ee)
427
+ ], Q);
428
+ const B = {
429
429
  id: "ui.operation.open-find-dialog",
430
- type: M.OPERATION,
430
+ type: y.OPERATION,
431
431
  handler: (t) => {
432
- const e = t.get(v);
432
+ const e = t.get(m);
433
433
  return e.revealed ? e.focusFindInput() : e.start(), !0;
434
434
  }
435
435
  }, re = {
436
436
  id: "ui.operation.open-replace-dialog",
437
- type: M.OPERATION,
437
+ type: y.OPERATION,
438
438
  handler: (t) => {
439
- const e = t.get(v);
439
+ const e = t.get(m);
440
440
  return e.revealed ? e.replaceRevealed ? e.focusFindInput() : e.revealReplace() : e.start(!0), !0;
441
441
  }
442
- }, Pe = {
443
- type: M.OPERATION,
442
+ }, De = {
443
+ type: y.OPERATION,
444
444
  id: "ui.operation.go-to-next-match",
445
- handler: (t) => (t.get(v).moveToNextMatch(), !0)
445
+ handler: (t) => (t.get(m).moveToNextMatch(), !0)
446
446
  }, Oe = {
447
- type: M.OPERATION,
447
+ type: y.OPERATION,
448
448
  id: "ui.operation.go-to-previous-match",
449
- handler: (t) => (t.get(v).moveToPreviousMatch(), !0)
449
+ handler: (t) => (t.get(m).moveToPreviousMatch(), !0)
450
450
  };
451
- var Te = { exports: {} }, k = {};
451
+ var Te = { exports: {} }, W = {};
452
452
  /**
453
453
  * @license React
454
454
  * react-jsx-runtime.production.min.js
@@ -458,101 +458,101 @@ var Te = { exports: {} }, k = {};
458
458
  * This source code is licensed under the MIT license found in the
459
459
  * LICENSE file in the root directory of this source tree.
460
460
  */
461
- var Gt = Pt, Vt = Symbol.for("react.element"), Ht = Symbol.for("react.fragment"), qt = Object.prototype.hasOwnProperty, zt = Gt.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, Kt = { key: !0, ref: !0, __self: !0, __source: !0 };
461
+ var Ht = Tt, qt = Symbol.for("react.element"), zt = Symbol.for("react.fragment"), Kt = Object.prototype.hasOwnProperty, Yt = Ht.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, Zt = { key: !0, ref: !0, __self: !0, __source: !0 };
462
462
  function Ee(t, e, n) {
463
- var i, r = {}, s = null, a = null;
464
- n !== void 0 && (s = "" + n), e.key !== void 0 && (s = "" + e.key), e.ref !== void 0 && (a = e.ref);
463
+ var i, s = {}, r = null, a = null;
464
+ n !== void 0 && (r = "" + n), e.key !== void 0 && (r = "" + e.key), e.ref !== void 0 && (a = e.ref);
465
465
  for (i in e)
466
- qt.call(e, i) && !Kt.hasOwnProperty(i) && (r[i] = e[i]);
466
+ Kt.call(e, i) && !Zt.hasOwnProperty(i) && (s[i] = e[i]);
467
467
  if (t && t.defaultProps)
468
468
  for (i in e = t.defaultProps, e)
469
- r[i] === void 0 && (r[i] = e[i]);
470
- return { $$typeof: Vt, type: t, key: s, ref: a, props: r, _owner: zt.current };
469
+ s[i] === void 0 && (s[i] = e[i]);
470
+ return { $$typeof: qt, type: t, key: r, ref: a, props: s, _owner: Yt.current };
471
471
  }
472
- k.Fragment = Ht;
473
- k.jsx = Ee;
474
- k.jsxs = Ee;
475
- Te.exports = k;
472
+ W.Fragment = zt;
473
+ W.jsx = Ee;
474
+ W.jsxs = Ee;
475
+ Te.exports = W;
476
476
  var l = Te.exports;
477
477
  const $e = {
478
478
  id: "ui.command.replace-current-match",
479
- type: M.COMMAND,
480
- handler: (t) => t.get(v).replace()
481
- }, Yt = "CONFIRM_REPLACE_ALL", Ne = {
479
+ type: y.COMMAND,
480
+ handler: (t) => t.get(m).replace()
481
+ }, Jt = "CONFIRM_REPLACE_ALL", Ne = {
482
482
  id: "ui.command.replace-all-matches",
483
- type: M.COMMAND,
483
+ type: y.COMMAND,
484
484
  handler: async (t) => {
485
- const e = t.get(_t), n = t.get(D), i = t.get(me);
485
+ const e = t.get(mt), n = t.get(D), i = t.get(me);
486
486
  if (!await e.confirm({
487
- id: Yt,
487
+ id: Jt,
488
488
  title: { title: n.t("find-replace.replace.confirm.title") },
489
489
  cancelText: n.t("button.cancel"),
490
490
  confirmText: n.t("button.confirm")
491
491
  }))
492
492
  return !1;
493
- const s = await t.get(v).replaceAll(), { success: a, failure: o } = s;
493
+ const r = await t.get(m).replaceAll(), { success: a, failure: o } = r;
494
494
  return o > 0 ? (a === 0 ? i.show({
495
- type: $.Error,
495
+ type: N.Error,
496
496
  content: n.t("find-replace.replace.all-failure")
497
497
  }) : i.show({
498
- type: $.Warning,
498
+ type: N.Warning,
499
499
  content: n.t("find-replace.replace.partial-success", `${a}`, `${o}`)
500
500
  }), !1) : (i.show({
501
- type: $.Success,
501
+ type: N.Success,
502
502
  content: n.t("find-replace.replace.all-success", `${a}`)
503
503
  }), !0);
504
504
  }
505
505
  };
506
506
  function Ae(t) {
507
- const { findCompleted: e, localeService: n, matchesCount: i, matchesPosition: r, findString: s, findReplaceService: a, onChange: o, ...d } = t, f = e && i === 0 ? n.t("find-replace.dialog.no-result") : i === 0 ? " " : void 0;
507
+ const { findCompleted: e, localeService: n, matchesCount: i, matchesPosition: s, findString: r, findReplaceService: a, onChange: o, ...d } = t, f = e && i === 0 ? n.t("find-replace.dialog.no-result") : i === 0 ? " " : void 0;
508
508
  return /* @__PURE__ */ l.jsx(
509
- Tt,
509
+ $t,
510
510
  {
511
511
  autoFocus: !0,
512
512
  placeholder: n.t("find-replace.dialog.find-placeholder"),
513
513
  slot: /* @__PURE__ */ l.jsx(
514
- Et,
514
+ Nt,
515
515
  {
516
516
  loop: !0,
517
517
  text: f,
518
- value: r,
518
+ value: s,
519
519
  total: i,
520
520
  onChange: (p) => {
521
- r === i && p === 1 ? a.moveToNextMatch() : r === 1 && p === i || p < r ? a.moveToPreviousMatch() : a.moveToNextMatch();
521
+ s === i && p === 1 ? a.moveToNextMatch() : s === 1 && p === i || p < s ? a.moveToPreviousMatch() : a.moveToNextMatch();
522
522
  }
523
523
  }
524
524
  ),
525
- value: s,
525
+ value: r,
526
526
  onChange: (p) => o == null ? void 0 : o(p),
527
527
  ...d
528
528
  }
529
529
  );
530
530
  }
531
- const Zt = "univer-find-replace-dialog-container", Jt = "univer-find-replace-expand-container", Qt = "univer-button-text", Xt = "univer-find-replace-buttons-group", ei = "univer-find-replace-buttons-group-right", L = {
532
- findReplaceDialogContainer: Zt,
533
- findReplaceExpandContainer: Jt,
534
- buttonText: Qt,
535
- findReplaceButtonsGroup: Xt,
536
- findReplaceButtonsGroupRight: ei
531
+ const Qt = "univer-find-replace-dialog-container", Xt = "univer-find-replace-expand-container", ei = "univer-button-text", ti = "univer-find-replace-buttons-group", ii = "univer-find-replace-buttons-group-right", w = {
532
+ findReplaceDialogContainer: Qt,
533
+ findReplaceExpandContainer: Xt,
534
+ buttonText: ei,
535
+ findReplaceButtonsGroup: ti,
536
+ findReplaceButtonsGroupRight: ii
537
537
  };
538
- function we(t, e) {
538
+ function je(t, e) {
539
539
  const n = _(() => {
540
- var r;
541
- (r = document.querySelector(".univer-find-input input")) == null || r.focus();
540
+ var s;
541
+ (s = document.querySelector(".univer-find-input input")) == null || s.focus();
542
542
  }, []), i = _(() => {
543
- const r = document.querySelectorAll(".univer-find-replace-dialog-container .univer-select-selection-search-input");
544
- return Array.from(r).some((s) => s === document.activeElement);
543
+ const s = document.querySelectorAll(".univer-find-replace-dialog-container .univer-select-selection-search-input");
544
+ return Array.from(s).some((r) => r === document.activeElement);
545
545
  }, []);
546
- return Ot(e, () => ({ focus: n, selectHasFocus: i })), w(() => {
547
- const r = t.focusSignal$.subscribe(() => n());
548
- return () => r.unsubscribe();
546
+ return Et(e, () => ({ focus: n, selectHasFocus: i })), j(() => {
547
+ const s = t.focusSignal$.subscribe(() => n());
548
+ return () => s.unsubscribe();
549
549
  }, [t, n]), { focus: n, selectHasFocus: i };
550
550
  }
551
- const ti = B(function(e, n) {
552
- const i = S(D), r = S(v), s = S(te), a = I(r.state$, void 0, !0), { findCompleted: o, findString: d, matchesCount: u, matchesPosition: f } = a, p = _(() => {
553
- s.executeCommand(re.id);
554
- }, [s]), O = _((C) => r.changeFindString(C), [r]);
555
- return we(r, n), /* @__PURE__ */ l.jsxs(E, { children: [
551
+ const ni = U(function(e, n) {
552
+ const i = S(D), s = S(m), r = S(te), a = I(s.state$, void 0, !0), { findCompleted: o, findString: d, matchesCount: u, matchesPosition: f } = a, p = _(() => {
553
+ r.executeCommand(re.id);
554
+ }, [r]), T = _((C) => s.changeFindString(C), [s]);
555
+ return je(s, n), /* @__PURE__ */ l.jsxs($, { children: [
556
556
  /* @__PURE__ */ l.jsx(
557
557
  Ae,
558
558
  {
@@ -560,26 +560,26 @@ const ti = B(function(e, n) {
560
560
  className: "univer-find-input",
561
561
  matchesCount: u,
562
562
  matchesPosition: f,
563
- findReplaceService: r,
563
+ findReplaceService: s,
564
564
  localeService: i,
565
565
  findString: d,
566
- onChange: O
566
+ onChange: T
567
567
  }
568
568
  ),
569
- /* @__PURE__ */ l.jsx("div", { className: L.findReplaceExpandContainer, children: /* @__PURE__ */ l.jsx(N, { type: "text", size: "small", onClick: p, children: i.t("find-replace.dialog.advanced-finding") }) })
569
+ /* @__PURE__ */ l.jsx("div", { className: w.findReplaceExpandContainer, children: /* @__PURE__ */ l.jsx(A, { type: "text", size: "small", onClick: p, children: i.t("find-replace.dialog.advanced-finding") }) })
570
570
  ] });
571
- }), ii = B(function(e, n) {
572
- const i = S(v), r = S(D), s = S(te), a = S(me), o = I(i.currentMatch$, void 0, !0), d = I(i.replaceables$, void 0, !0), u = I(i.state$, void 0, !0), {
571
+ }), si = U(function(e, n) {
572
+ const i = S(m), s = S(D), r = S(te), a = S(me), o = I(i.currentMatch$, void 0, !0), d = I(i.replaceables$, void 0, !0), u = I(i.state$, void 0, !0), {
573
573
  matchesCount: f,
574
574
  matchesPosition: p,
575
- findString: O,
575
+ findString: T,
576
576
  inputtingFindString: C,
577
577
  replaceString: Ue,
578
578
  caseSensitive: Be,
579
579
  matchesTheWholeCell: We,
580
- findDirection: ke,
581
- findScope: Ge,
582
- findBy: Ve,
580
+ findDirection: Ge,
581
+ findScope: Ve,
582
+ findBy: ke,
583
583
  findCompleted: V
584
584
  } = u, He = C.length === 0, qe = f === 0 || !(o != null && o.replaceable), ze = d.length === 0, Ke = _(
585
585
  (h) => i.changeInputtingFindString(h),
@@ -587,27 +587,27 @@ const ti = B(function(e, n) {
587
587
  ), Ye = _(
588
588
  (h) => i.changeReplaceString(h),
589
589
  [i]
590
- ), { focus: Ze } = we(i, n), Je = _(() => {
591
- O === C ? i.moveToNextMatch() : (i.changeFindString(C), i.find());
592
- }, [O, C, i]), Qe = _(() => s.executeCommand($e.id), [s]), Xe = _(async () => {
593
- await s.executeCommand(Ne.id), Ze();
594
- }, [s]), et = _((h) => {
590
+ ), { focus: Ze } = je(i, n), Je = _(() => {
591
+ T === C ? i.moveToNextMatch() : (i.changeFindString(C), i.find());
592
+ }, [T, C, i]), Qe = _(() => r.executeCommand($e.id), [r]), Xe = _(async () => {
593
+ await r.executeCommand(Ne.id), Ze();
594
+ }, [r]), et = _((h) => {
595
595
  i.changeFindDirection(h);
596
596
  }, [i]), tt = _((h) => {
597
597
  i.changeFindScope(h);
598
598
  }, [i]), it = _((h) => {
599
599
  i.changeFindBy(h);
600
- }, [i]), nt = ri(r), rt = si(r), st = ai(r);
601
- return w(() => {
600
+ }, [i]), nt = ai(s), st = oi(s), rt = ci(s);
601
+ return j(() => {
602
602
  const h = V && f === 0;
603
- let T = null;
604
- return h && (T = a.show({
605
- content: r.t("find-replace.dialog.no-match"),
606
- type: $.Warning,
607
- delay: 5e3
608
- })), () => T == null ? void 0 : T.dispose();
609
- }, [V, f, a, r]), /* @__PURE__ */ l.jsxs(E, { children: [
610
- /* @__PURE__ */ l.jsx(R, { label: r.t("find-replace.dialog.find"), children: /* @__PURE__ */ l.jsx(
603
+ let E = null;
604
+ return h && (E = a.show({
605
+ content: s.t("find-replace.dialog.no-match"),
606
+ type: N.Warning,
607
+ duration: 5e3
608
+ })), () => E == null ? void 0 : E.dispose();
609
+ }, [V, f, a, s]), /* @__PURE__ */ l.jsxs($, { children: [
610
+ /* @__PURE__ */ l.jsx(R, { label: s.t("find-replace.dialog.find"), children: /* @__PURE__ */ l.jsx(
611
611
  Ae,
612
612
  {
613
613
  findCompleted: V,
@@ -615,191 +615,191 @@ const ti = B(function(e, n) {
615
615
  matchesCount: f,
616
616
  matchesPosition: p,
617
617
  findReplaceService: i,
618
- localeService: r,
618
+ localeService: s,
619
619
  findString: C,
620
620
  onChange: Ke
621
621
  }
622
622
  ) }),
623
- /* @__PURE__ */ l.jsx(R, { label: r.t("find-replace.dialog.replace"), children: /* @__PURE__ */ l.jsx(
624
- $t,
623
+ /* @__PURE__ */ l.jsx(R, { label: s.t("find-replace.dialog.replace"), children: /* @__PURE__ */ l.jsx(
624
+ At,
625
625
  {
626
- placeholder: r.t("find-replace.dialog.replace-placeholder"),
626
+ placeholder: s.t("find-replace.dialog.replace-placeholder"),
627
627
  value: Ue,
628
628
  onChange: (h) => Ye(h)
629
629
  }
630
630
  ) }),
631
- /* @__PURE__ */ l.jsx(R, { label: r.t("find-replace.dialog.find-direction.title"), children: /* @__PURE__ */ l.jsx(H, { value: ke, options: rt, onChange: et }) }),
632
- /* @__PURE__ */ l.jsx(ce, { children: /* @__PURE__ */ l.jsxs(E, { children: [
633
- /* @__PURE__ */ l.jsx(R, { label: r.t("find-replace.dialog.find-scope.title"), children: /* @__PURE__ */ l.jsx(H, { value: Ge, options: nt, onChange: tt }) }),
634
- /* @__PURE__ */ l.jsx(R, { label: r.t("find-replace.dialog.find-by.title"), children: /* @__PURE__ */ l.jsx(H, { value: Ve, options: st, onChange: it }) })
631
+ /* @__PURE__ */ l.jsx(R, { label: s.t("find-replace.dialog.find-direction.title"), children: /* @__PURE__ */ l.jsx(k, { value: Ge, options: st, onChange: et }) }),
632
+ /* @__PURE__ */ l.jsx(le, { children: /* @__PURE__ */ l.jsxs($, { children: [
633
+ /* @__PURE__ */ l.jsx(R, { label: s.t("find-replace.dialog.find-scope.title"), children: /* @__PURE__ */ l.jsx(k, { value: Ve, options: nt, onChange: tt }) }),
634
+ /* @__PURE__ */ l.jsx(R, { label: s.t("find-replace.dialog.find-by.title"), children: /* @__PURE__ */ l.jsx(k, { value: ke, options: rt, onChange: it }) })
635
635
  ] }) }),
636
- /* @__PURE__ */ l.jsx(ce, { children: /* @__PURE__ */ l.jsxs(E, { children: [
636
+ /* @__PURE__ */ l.jsx(le, { children: /* @__PURE__ */ l.jsxs($, { children: [
637
637
  /* @__PURE__ */ l.jsx(R, { children: /* @__PURE__ */ l.jsx(
638
- le,
638
+ de,
639
639
  {
640
640
  checked: Be,
641
641
  onChange: (h) => {
642
642
  i.changeCaseSensitive(h);
643
643
  },
644
- children: r.t("find-replace.dialog.case-sensitive")
644
+ children: s.t("find-replace.dialog.case-sensitive")
645
645
  }
646
646
  ) }),
647
647
  /* @__PURE__ */ l.jsx(R, { children: /* @__PURE__ */ l.jsx(
648
- le,
648
+ de,
649
649
  {
650
650
  checked: We,
651
651
  onChange: (h) => {
652
652
  i.changeMatchesTheWholeCell(h);
653
653
  },
654
- children: r.t("find-replace.dialog.match-the-whole-cell")
654
+ children: s.t("find-replace.dialog.match-the-whole-cell")
655
655
  }
656
656
  ) })
657
657
  ] }) }),
658
- /* @__PURE__ */ l.jsxs("div", { className: L.findReplaceButtonsGroup, children: [
659
- /* @__PURE__ */ l.jsx(N, { type: "primary", onClick: Je, disabled: He, children: r.t("find-replace.dialog.find") }),
660
- /* @__PURE__ */ l.jsxs("span", { className: L.findReplaceButtonsGroupRight, children: [
661
- /* @__PURE__ */ l.jsx(N, { disabled: qe, onClick: Qe, children: r.t("find-replace.dialog.replace") }),
662
- /* @__PURE__ */ l.jsx(N, { disabled: ze, onClick: Xe, children: r.t("find-replace.dialog.replace-all") })
658
+ /* @__PURE__ */ l.jsxs("div", { className: w.findReplaceButtonsGroup, children: [
659
+ /* @__PURE__ */ l.jsx(A, { type: "primary", onClick: Je, disabled: He, children: s.t("find-replace.dialog.find") }),
660
+ /* @__PURE__ */ l.jsxs("span", { className: w.findReplaceButtonsGroupRight, children: [
661
+ /* @__PURE__ */ l.jsx(A, { disabled: qe, onClick: Qe, children: s.t("find-replace.dialog.replace") }),
662
+ /* @__PURE__ */ l.jsx(A, { disabled: ze, onClick: Xe, children: s.t("find-replace.dialog.replace-all") })
663
663
  ] })
664
664
  ] })
665
665
  ] });
666
666
  });
667
- function ni() {
668
- const t = S(v), e = S(ve), n = S(U), i = I(t.state$, void 0, !0), r = K(null);
669
- w(() => {
667
+ function ri() {
668
+ const t = S(m), e = S(ve), n = S(ee), i = I(t.state$, void 0, !0), s = z(null);
669
+ j(() => {
670
670
  let d;
671
- return r.current && (d = e.registerContainerElement(r.current)), () => d == null ? void 0 : d.dispose();
671
+ return s.current && (d = e.registerContainerElement(s.current)), () => d == null ? void 0 : d.dispose();
672
672
  }, [e]);
673
- const s = K(null), a = _(
673
+ const r = z(null), a = _(
674
674
  (d) => n.setContextValue(Ie, d),
675
675
  [n]
676
676
  ), o = _(
677
677
  (d) => n.setContextValue(ye, d),
678
678
  [n]
679
679
  );
680
- return w(() => {
680
+ return j(() => {
681
681
  var u;
682
- const d = It(document, "focusin").subscribe((f) => {
682
+ const d = Pt(document, "focusin").subscribe((f) => {
683
683
  var p;
684
- f.target && ((p = r.current) != null && p.contains(f.target)) ? a(!0) : a(!1), !s.current || !s.current.selectHasFocus() ? o(!0) : o(!1);
684
+ f.target && ((p = s.current) != null && p.contains(f.target)) ? a(!0) : a(!1), !r.current || !r.current.selectHasFocus() ? o(!0) : o(!1);
685
685
  });
686
- return (u = s.current) == null || u.focus(), a(!0), o(!0), () => {
686
+ return (u = r.current) == null || u.focus(), a(!0), o(!0), () => {
687
687
  d.unsubscribe(), a(!1);
688
688
  };
689
- }, [a, o]), /* @__PURE__ */ l.jsx("div", { className: L.findReplaceDialogContainer, ref: r, children: i.replaceRevealed ? /* @__PURE__ */ l.jsx(ii, { ref: s }) : /* @__PURE__ */ l.jsx(ti, { ref: s }) });
689
+ }, [a, o]), /* @__PURE__ */ l.jsx("div", { className: w.findReplaceDialogContainer, ref: s, children: i.replaceRevealed ? /* @__PURE__ */ l.jsx(si, { ref: r }) : /* @__PURE__ */ l.jsx(ni, { ref: r }) });
690
690
  }
691
- function ri(t) {
691
+ function ai(t) {
692
692
  const e = t.getCurrentLocale();
693
- return ie(() => [
694
- { label: t.t("find-replace.dialog.find-scope.current-sheet"), value: Q.SUBUNIT },
695
- { label: t.t("find-replace.dialog.find-scope.workbook"), value: Q.UNIT }
693
+ return ne(() => [
694
+ { label: t.t("find-replace.dialog.find-scope.current-sheet"), value: J.SUBUNIT },
695
+ { label: t.t("find-replace.dialog.find-scope.workbook"), value: J.UNIT }
696
696
  ], [e]);
697
697
  }
698
- function si(t) {
698
+ function oi(t) {
699
699
  const e = t.getCurrentLocale();
700
- return ie(() => [
701
- { label: t.t("find-replace.dialog.find-direction.row"), value: Z.ROW },
702
- { label: t.t("find-replace.dialog.find-direction.column"), value: Z.COLUMN }
700
+ return ne(() => [
701
+ { label: t.t("find-replace.dialog.find-direction.row"), value: Y.ROW },
702
+ { label: t.t("find-replace.dialog.find-direction.column"), value: Y.COLUMN }
703
703
  ], [e]);
704
704
  }
705
- function ai(t) {
705
+ function ci(t) {
706
706
  const e = t.getCurrentLocale();
707
- return ie(() => [
708
- { label: t.t("find-replace.dialog.find-by.value"), value: J.VALUE },
709
- { label: t.t("find-replace.dialog.find-by.formula"), value: J.FORMULA }
707
+ return ne(() => [
708
+ { label: t.t("find-replace.dialog.find-by.value"), value: Z.VALUE },
709
+ { label: t.t("find-replace.dialog.find-by.formula"), value: Z.FORMULA }
710
710
  ], [e]);
711
711
  }
712
- function P(t) {
712
+ function O(t) {
713
713
  return t.getContextValue(Ie);
714
714
  }
715
- function oi(t) {
715
+ function li(t) {
716
716
  return t.getContextValue(Fe);
717
717
  }
718
- function je(t) {
718
+ function Le(t) {
719
719
  return t.getContextValue(ye);
720
720
  }
721
721
  const G = "7_find-replace-shortcuts";
722
- function se(t) {
723
- return t.getContextValue(fe);
724
- }
725
722
  function ae(t) {
726
- return !t.getContextValue(_e);
723
+ return t.getContextValue(_e);
724
+ }
725
+ function oe(t) {
726
+ return !t.getContextValue(ge);
727
727
  }
728
- const ci = {
729
- id: W.id,
728
+ const di = {
729
+ id: B.id,
730
730
  description: "find-replace.shortcut.open-find-dialog",
731
- binding: b.F | x.CTRL_COMMAND,
731
+ binding: M.F | b.CTRL_COMMAND,
732
732
  group: G,
733
733
  preconditions(t) {
734
- return !P(t) && se(t) && ae(t);
734
+ return !O(t) && ae(t) && oe(t);
735
735
  }
736
- }, li = {
737
- id: W.id,
736
+ }, hi = {
737
+ id: B.id,
738
738
  description: "find-replace.shortcut.open-find-dialog",
739
- binding: b.F | x.CTRL_COMMAND,
740
- mac: b.F | x.MAC_CTRL,
739
+ binding: M.F | b.CTRL_COMMAND,
740
+ mac: M.F | b.MAC_CTRL,
741
741
  preconditions(t) {
742
- return !P(t) && se(t) && ae(t);
742
+ return !O(t) && ae(t) && oe(t);
743
743
  }
744
- }, di = {
744
+ }, ui = {
745
745
  id: re.id,
746
746
  description: "find-replace.shortcut.open-replace-dialog",
747
- binding: b.H | x.CTRL_COMMAND,
748
- mac: b.H | x.MAC_CTRL,
747
+ binding: M.H | b.CTRL_COMMAND,
748
+ mac: M.H | b.MAC_CTRL,
749
749
  group: G,
750
750
  preconditions(t) {
751
- return se(t) && ae(t) && (!P(t) || !oi(t));
751
+ return ae(t) && oe(t) && (!O(t) || !li(t));
752
752
  }
753
- }, hi = {
754
- id: Pe.id,
753
+ }, fi = {
754
+ id: De.id,
755
755
  description: "find-replace.shortcut.go-to-next-match",
756
- binding: b.ENTER,
756
+ binding: M.ENTER,
757
757
  group: G,
758
758
  priority: 1e3,
759
759
  preconditions(t) {
760
- return je(t) && P(t);
760
+ return Le(t) && O(t);
761
761
  }
762
- }, ui = {
762
+ }, pi = {
763
763
  id: Oe.id,
764
764
  description: "find-replace.shortcut.go-to-previous-match",
765
- binding: b.ENTER | x.SHIFT,
765
+ binding: M.ENTER | b.SHIFT,
766
766
  group: G,
767
767
  priority: 1e3,
768
768
  preconditions(t) {
769
- return je(t) && P(t);
769
+ return Le(t) && O(t);
770
770
  }
771
771
  };
772
- function pi(t) {
773
- const e = t.get(U);
772
+ function _i(t) {
773
+ const e = t.get(ee);
774
774
  return {
775
- id: W.id,
775
+ id: B.id,
776
776
  icon: "SearchIcon",
777
777
  tooltip: "find-replace.toolbar",
778
- group: gt.TOOLBAR_OTHERS,
779
- type: mt.BUTTON,
780
- positions: [vt.TOOLBAR_START],
781
- hidden$: St(t, lt.UNIVER_SHEET),
778
+ group: vt.TOOLBAR_OTHERS,
779
+ type: St.BUTTON,
780
+ positions: [Ct.TOOLBAR_START],
781
+ hidden$: Rt(t, dt.UNIVER_SHEET),
782
782
  disabled$: Ce([
783
- e.subscribeContextValue$(_e),
784
- e.subscribeContextValue$(fe)
785
- ]).pipe(Ft(([n, i]) => n || !i))
783
+ e.subscribeContextValue$(ge),
784
+ e.subscribeContextValue$(_e)
785
+ ]).pipe(Dt(([n, i]) => n || !i))
786
786
  };
787
787
  }
788
- var fi = Object.defineProperty, _i = Object.getOwnPropertyDescriptor, gi = (t, e, n, i) => {
789
- for (var r = i > 1 ? void 0 : i ? _i(e, n) : e, s = t.length - 1, a; s >= 0; s--)
790
- (a = t[s]) && (r = (i ? a(e, n, r) : a(r)) || r);
791
- return i && r && fi(e, n, r), r;
792
- }, g = (t, e) => (n, i) => e(n, i, t);
793
- const de = "DESKTOP_FIND_REPLACE_DIALOG", Le = 350, mi = 20, vi = -90;
794
- let A = class extends dt {
795
- constructor(t, e, n, i, r, s, a, o, d, u, f, p) {
796
- super(), this._univerInstanceService = t, this._menuService = e, this._shortcutService = n, this._commandService = i, this._findReplaceService = r, this._logService = s, this._dialogService = a, this._contextService = o, this._layoutService = d, this._localeService = u, this._componentManager = f, this._injector = p, this._initCommands(), this._initUI(), this._initShortcuts();
788
+ var gi = Object.defineProperty, mi = Object.getOwnPropertyDescriptor, vi = (t, e, n, i) => {
789
+ for (var s = i > 1 ? void 0 : i ? mi(e, n) : e, r = t.length - 1, a; r >= 0; r--)
790
+ (a = t[r]) && (s = (i ? a(e, n, s) : a(s)) || s);
791
+ return i && s && gi(e, n, s), s;
792
+ }, v = (t, e) => (n, i) => e(n, i, t);
793
+ const Si = {}, he = "DESKTOP_FIND_REPLACE_DIALOG", we = 350, Ci = 20, Ri = -90;
794
+ let F = class extends ht {
795
+ constructor(t, e, n, i, s, r, a, o, d, u, f) {
796
+ super(), this._config = t, this._univerInstanceService = e, this._menuService = n, this._shortcutService = i, this._commandService = s, this._findReplaceService = r, this._dialogService = a, this._layoutService = o, this._localeService = d, this._componentManager = u, this._injector = f, this._initCommands(), this._initUI(), this._initShortcuts();
797
797
  }
798
798
  _initCommands() {
799
799
  [
800
- W,
800
+ B,
801
801
  re,
802
- Pe,
802
+ De,
803
803
  Oe,
804
804
  Ne,
805
805
  $e
@@ -809,233 +809,94 @@ let A = class extends dt {
809
809
  }
810
810
  _initShortcuts() {
811
811
  [
812
- di,
813
- ci,
814
- li,
815
812
  ui,
816
- hi
813
+ di,
814
+ hi,
815
+ pi,
816
+ fi
817
817
  ].forEach((t) => this.disposeWithMe(this._shortcutService.registerShortcut(t)));
818
818
  }
819
819
  _initUI() {
820
- this.disposeWithMe(this._menuService.addMenuItem(this._injector.invoke(pi))), this.disposeWithMe(this._componentManager.register("FindReplaceDialog", ni)), this.disposeWithMe(this._componentManager.register("SearchIcon", Me)), this._findReplaceService.stateUpdates$.pipe(oe(this.dispose$)).subscribe((t) => {
821
- t.revealed === !0 && this._openPanel();
820
+ const { menu: t = {} } = this._config;
821
+ this.disposeWithMe(this._menuService.addMenuItem(this._injector.invoke(_i), t)), this.disposeWithMe(this._componentManager.register("FindReplaceDialog", ri)), this.disposeWithMe(this._componentManager.register("SearchIcon", be)), this._findReplaceService.stateUpdates$.pipe(ce(this.dispose$)).subscribe((e) => {
822
+ e.revealed === !0 && this._openPanel();
822
823
  }), this.disposeWithMe(
823
- this._univerInstanceService.focused$.pipe(oe(this.dispose$)).subscribe((t) => {
824
- (!t || !this._univerInstanceService.getUniverSheetInstance(t)) && this.closePanel();
824
+ this._univerInstanceService.focused$.pipe(ce(this.dispose$)).subscribe((e) => {
825
+ (!e || !this._univerInstanceService.getUniverSheetInstance(e)) && this.closePanel();
825
826
  })
826
827
  );
827
828
  }
828
829
  _openPanel() {
829
830
  this._dialogService.open({
830
- id: de,
831
+ id: he,
831
832
  draggable: !0,
832
- width: Le,
833
+ width: we,
833
834
  title: { title: this._localeService.t("find-replace.dialog.title") },
834
835
  children: { label: "FindReplaceDialog" },
835
836
  destroyOnClose: !0,
836
- defaultPosition: Si(),
837
+ defaultPosition: Mi(),
837
838
  preservePositionOnDestroy: !0,
838
839
  onClose: () => this.closePanel()
839
840
  });
840
841
  }
841
842
  closePanel() {
842
- this._dialogService.close(de), this._findReplaceService.terminate(), queueMicrotask(() => this._layoutService.focus());
843
+ this._dialogService.close(he), this._findReplaceService.terminate(), queueMicrotask(() => this._layoutService.focus());
843
844
  }
844
845
  };
845
- A = gi([
846
- ht(ut.Rendered, A),
847
- g(0, ue),
848
- g(1, Rt),
849
- g(2, bt),
850
- g(3, te),
851
- g(4, v),
852
- g(5, pe),
853
- g(6, xt),
854
- g(7, U),
855
- g(8, ve),
856
- g(9, y(D)),
857
- g(10, y(Ct)),
858
- g(11, y(ge))
859
- ], A);
860
- function Si() {
846
+ F = vi([
847
+ ut(ft.Rendered, F),
848
+ v(1, pe),
849
+ v(2, xt),
850
+ v(3, bt),
851
+ v(4, te),
852
+ v(5, m),
853
+ v(6, yt),
854
+ v(7, ve),
855
+ v(8, x(D)),
856
+ v(9, x(Mt)),
857
+ v(10, x(ie))
858
+ ], F);
859
+ function Mi() {
861
860
  const { innerWidth: t } = window;
862
- return { x: (t - Le) / 2 - mi, y: vi };
861
+ return { x: (t - we) / 2 - Ci, y: Ri };
863
862
  }
864
- const Ci = {
865
- "find-replace": {
866
- toolbar: "Find & Replace",
867
- shortcut: {
868
- "open-find-dialog": "Open Find Dialog",
869
- "open-replace-dialog": "Open Replace Dialog",
870
- "close-dialog": "Close Find & Replace Dialog",
871
- "go-to-next-match": "Go to Next Match",
872
- "go-to-previous-match": "Go to Previous Match"
873
- },
874
- dialog: {
875
- title: "Find",
876
- find: "Find",
877
- replace: "Replace",
878
- "replace-all": "Replace All",
879
- "case-sensitive": "Case Sensitive",
880
- "find-placeholder": "Find in this Sheet",
881
- "advanced-finding": "Advanced Searching & Replace",
882
- "replace-placeholder": "Input Replace String",
883
- "match-the-whole-cell": "Match the Whole Cell",
884
- "find-direction": {
885
- title: "Find Direction",
886
- row: "Search by Row",
887
- column: "Search by Column"
888
- },
889
- "find-scope": {
890
- title: "Find Range",
891
- "current-sheet": "Current Sheet",
892
- workbook: "Workbook"
893
- },
894
- "find-by": {
895
- title: "Find By",
896
- value: "Find by Value",
897
- formula: "Find Formula"
898
- },
899
- "no-match": "Finding completed but no match found.",
900
- "no-result": "No Result"
901
- },
902
- replace: {
903
- "all-success": "Replaced all {0} matches",
904
- "all-failure": "Replace failed",
905
- confirm: {
906
- title: "Are you sure to replace all matches?"
907
- }
908
- }
909
- },
910
- "find-replace-shortcuts": "Find & Replace"
911
- }, Ui = Ci, Ri = {
912
- "find-replace": {
913
- toolbar: "查找替换",
914
- shortcut: {
915
- "open-find-dialog": "打开查找对话框",
916
- "open-replace-dialog": "打开替换对话框",
917
- "close-dialog": "关闭查找替换对话框",
918
- "go-to-next-match": "下一个匹配项",
919
- "go-to-previous-match": "下一个匹配项"
920
- },
921
- dialog: {
922
- title: "查找",
923
- find: "查找",
924
- replace: "替换",
925
- "replace-all": "替换全部",
926
- "find-placeholder": "输入查找内容",
927
- "advanced-finding": "替换 / 高级查找",
928
- "replace-placeholder": "输入替换内容",
929
- "case-sensitive": "匹配大小写",
930
- "match-the-whole-cell": "匹配整个单元格",
931
- "find-scope": {
932
- title: "查找范围",
933
- "current-sheet": "当前子表",
934
- workbook: "整个工作簿"
935
- },
936
- "find-direction": {
937
- title: "查找顺序",
938
- column: "按列查找",
939
- row: "按行查找"
940
- },
941
- "find-by": {
942
- title: "查找方式",
943
- formula: "查找公式",
944
- value: "查找值"
945
- },
946
- "no-match": "已完成搜索,但是未找到任何匹配项",
947
- "no-result": "无结果"
948
- },
949
- replace: {
950
- "all-success": "已全部替换 {0} 个匹配项",
951
- "all-failure": "替换失败",
952
- confirm: {
953
- title: "确定要替换所有的匹配项吗?"
954
- }
955
- }
956
- },
957
- "find-replace-shortcuts": "查找替换"
958
- }, bi = Ri, xi = {
959
- "find-replace": {
960
- toolbar: "Найти и заменить",
961
- shortcut: {
962
- "open-find-dialog": "Открыть диалог поиска",
963
- "open-replace-dialog": "Открыть диалог замены",
964
- "close-dialog": "Закрыть диалог поиска и замены",
965
- "go-to-next-match": "Перейти к следующему совпадению",
966
- "go-to-previous-match": "Перейти к предыдущему совпадению"
967
- },
968
- dialog: {
969
- title: "Найти",
970
- find: "Найти",
971
- replace: "Заменить",
972
- "replace-all": "Заменить все",
973
- "case-sensitive": "С учетом регистра",
974
- "find-placeholder": "Найти в этом листе",
975
- "advanced-finding": "Расширенный поиск и замена",
976
- "replace-placeholder": "Введите строку для замены",
977
- "match-the-whole-cell": "Точное совпадение",
978
- "find-direction": {
979
- title: "Направление поиска",
980
- row: "Поиск по строкам",
981
- column: "Поиск по столбцам"
982
- },
983
- "find-scope": {
984
- title: "Область поиска",
985
- "current-sheet": "Текущий лист",
986
- workbook: "Книга"
987
- },
988
- "find-by": {
989
- title: "Поиск по",
990
- value: "Поиск по значению",
991
- formula: "Поиск по формуле"
992
- },
993
- "no-match": "Поиск завершен, совпадений не найдено.",
994
- "no-result": "Нет результатов"
995
- },
996
- replace: {
997
- "all-success": "Заменены все {0} совпадений",
998
- "all-failure": "Не удалось заменить",
999
- confirm: {
1000
- title: "Вы уверены, что хотите заменить все совпадения?"
1001
- }
1002
- }
1003
- },
1004
- "find-replace-shortcuts": "Найти и заменить"
1005
- }, Bi = xi;
1006
- var Mi = Object.defineProperty, yi = Object.getOwnPropertyDescriptor, Ii = (t, e, n, i) => {
1007
- for (var r = i > 1 ? void 0 : i ? yi(e, n) : e, s = t.length - 1, a; s >= 0; s--)
1008
- (a = t[s]) && (r = (i ? a(e, n, r) : a(r)) || r);
1009
- return i && r && Mi(e, n, r), r;
1010
- }, Fi = (t, e) => (n, i) => e(n, i, t);
1011
- const Di = "FIND_REPLACE";
1012
- var q;
1013
- let he = (q = class extends pt {
1014
- constructor(t, e) {
1015
- super(), this._injector = t, this._localeService = e, this._localeService.load({
1016
- zhCN: bi
1017
- });
863
+ var xi = Object.defineProperty, bi = Object.getOwnPropertyDescriptor, yi = (t, e, n, i) => {
864
+ for (var s = i > 1 ? void 0 : i ? bi(e, n) : e, r = t.length - 1, a; r >= 0; r--)
865
+ (a = t[r]) && (s = (i ? a(e, n, s) : a(s)) || s);
866
+ return i && s && xi(e, n, s), s;
867
+ }, ue = (t, e) => (n, i) => e(n, i, t);
868
+ const Ii = "FIND_REPLACE_PLUGIN";
869
+ var H;
870
+ let fe = (H = class extends pt {
871
+ constructor(t = {}, e, n) {
872
+ super(), this._config = t, this._injector = e, this._localeService = n, this._config = _t.deepMerge({}, Si, this._config);
1018
873
  }
1019
874
  onStarting(t) {
1020
- [[A], [v, { useClass: X }]].forEach(
875
+ [
876
+ [
877
+ F,
878
+ {
879
+ useFactory: () => this._injector.createInstance(F, this._config)
880
+ }
881
+ ],
882
+ [m, { useClass: Q }]
883
+ ].forEach(
1021
884
  (e) => {
1022
885
  t.add(e);
1023
886
  }
1024
887
  );
1025
888
  }
1026
- }, c(q, "pluginName", Di), q);
1027
- he = Ii([
1028
- Fi(1, y(D))
1029
- ], he);
889
+ }, c(H, "pluginName", Ii), H);
890
+ fe = yi([
891
+ ue(1, x(ie)),
892
+ ue(2, x(D))
893
+ ], fe);
1030
894
  export {
1031
- J as FindBy,
1032
- Z as FindDirection,
1033
- Li as FindModel,
1034
- A as FindReplaceController,
1035
- Q as FindScope,
1036
- v as IFindReplaceService,
1037
- he as UniverFindReplacePlugin,
1038
- Ui as enUS,
1039
- Bi as ruRU,
1040
- bi as zhCN
895
+ Z as FindBy,
896
+ Y as FindDirection,
897
+ ji as FindModel,
898
+ F as FindReplaceController,
899
+ J as FindScope,
900
+ m as IFindReplaceService,
901
+ fe as UniverFindReplacePlugin
1041
902
  };