@univerjs/find-replace 0.5.5 → 0.6.0-alpha.0

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,91 +1,92 @@
1
- var at = Object.defineProperty;
2
- var ot = (t, e, n) => e in t ? at(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
3
- var l = (t, e, n) => ot(t, typeof e != "symbol" ? e + "" : e, n);
4
- import { createIdentifier as ct, Inject as F, Injector as Q, Disposable as X, DisposableCollection as lt, toDisposable as $, IUniverInstanceService as ge, IContextService as ee, CommandType as y, LocaleService as w, useDependency as C, ICommandService as te, FOCUSING_SHEET as me, EDITOR_ACTIVATED as ve, UniverInstanceType as dt, RxDisposable as ut, Plugin as ht, merge as ft, IConfigService as pt } from "@univerjs/core";
5
- import { IConfirmService as _t, IMessageService as Se, useObservable as D, ILayoutService as Ce, KeyCode as b, MetaKeys as x, MenuItemType as gt, getMenuHiddenObservable as mt, RibbonStartGroup as vt, ComponentManager as St, IMenuManagerService as Ct, IShortcutService as Rt, IDialogService as Mt } from "@univerjs/ui";
6
- import { throttleTime as bt, BehaviorSubject as P, combineLatest as Re, debounceTime as xt, Subject as Me, fromEvent as yt, map as It, takeUntil as oe } from "rxjs";
7
- import { MessageType as E, InputWithSlot as Ft, Pager as Dt, Button as N, FormLayout as M, Input as Pt, Select as G, FormDualColumnLayout as ce, Checkbox as le } from "@univerjs/design";
8
- import { RENDER_RAW_FORMULA_KEY as Ot } from "@univerjs/engine-render";
9
- import Tt, { forwardRef as U, useRef as H, createElement as be, useCallback as p, useEffect as A, useMemo as ie, useImperativeHandle as Et } from "react";
10
- const Nt = "find-replace.config", de = {};
11
- var g = function() {
12
- return g = Object.assign || function(t) {
1
+ var rt = Object.defineProperty;
2
+ var st = (t, e, n) => e in t ? rt(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
3
+ var o = (t, e, n) => st(t, typeof e != "symbol" ? e + "" : e, n);
4
+ import { createIdentifier as at, Inject as D, Injector as Q, Disposable as X, DisposableCollection as ot, toDisposable as A, IUniverInstanceService as pe, IContextService as ee, CommandType as y, LocaleService as B, useDependency as S, ICommandService as te, FOCUSING_SHEET as _e, EDITOR_ACTIVATED as ge, UniverInstanceType as ct, RxDisposable as lt, Plugin as dt, merge as ht, IConfigService as ut } from "@univerjs/core";
5
+ import { IConfirmService as ft, IMessageService as me, useObservable as F, ILayoutService as Se, KeyCode as M, MetaKeys as I, MenuItemType as pt, getMenuHiddenObservable as _t, RibbonStartGroup as gt, ComponentManager as mt, IMenuManagerService as St, IShortcutService as vt, IDialogService as Ct } from "@univerjs/ui";
6
+ import { throttleTime as Rt, BehaviorSubject as P, combineLatest as ve, debounceTime as Mt, Subject as Ce, fromEvent as bt, map as It, takeUntil as oe } from "rxjs";
7
+ import { MessageType as E, InputWithSlot as yt, Pager as Dt, Button as N, FormLayout as R, Input as Ft, Select as V, FormDualColumnLayout as ce, Checkbox as le } from "@univerjs/design";
8
+ import { RENDER_RAW_FORMULA_KEY as Pt } from "@univerjs/engine-render";
9
+ import { jsx as l, jsxs as b, Fragment as $ } from "react/jsx-runtime";
10
+ import { forwardRef as W, useRef as H, createElement as Re, useCallback as u, useEffect as L, useMemo as ie, useImperativeHandle as xt } from "react";
11
+ const Tt = "find-replace.config", de = {};
12
+ var _ = function() {
13
+ return _ = Object.assign || function(t) {
13
14
  for (var e, n = 1, i = arguments.length; n < i; n++) {
14
15
  e = arguments[n];
15
16
  for (var r in e) Object.prototype.hasOwnProperty.call(e, r) && (t[r] = e[r]);
16
17
  }
17
18
  return t;
18
- }, g.apply(this, arguments);
19
- }, $t = function(t, e) {
19
+ }, _.apply(this, arguments);
20
+ }, Ot = function(t, e) {
20
21
  var n = {};
21
22
  for (var i in t) Object.prototype.hasOwnProperty.call(t, i) && e.indexOf(i) < 0 && (n[i] = t[i]);
22
23
  if (t != null && typeof Object.getOwnPropertySymbols == "function")
23
24
  for (var r = 0, i = Object.getOwnPropertySymbols(t); r < i.length; r++)
24
25
  e.indexOf(i[r]) < 0 && Object.prototype.propertyIsEnumerable.call(t, i[r]) && (n[i[r]] = t[i[r]]);
25
26
  return n;
26
- }, xe = U(function(t, e) {
27
- var n = t.icon, i = t.id, r = t.className, s = t.extend, a = $t(t, ["icon", "id", "className", "extend"]), d = "univerjs-icon univerjs-icon-".concat(i, " ").concat(r || "").trim(), c = H("_".concat(jt()));
28
- return ye(n, "".concat(i), { defIds: n.defIds, idSuffix: c.current }, g({ ref: e, className: d }, a), s);
27
+ }, Me = W(function(t, e) {
28
+ var n = t.icon, i = t.id, r = t.className, s = t.extend, a = Ot(t, ["icon", "id", "className", "extend"]), c = "univerjs-icon univerjs-icon-".concat(i, " ").concat(r || "").trim(), d = H("_".concat($t()));
29
+ return be(n, "".concat(i), { defIds: n.defIds, idSuffix: d.current }, _({ ref: e, className: c }, a), s);
29
30
  });
30
- function ye(t, e, n, i, r) {
31
- return be(t.tag, g(g({ key: e }, At(t, n, r)), i), (Lt(t, n).children || []).map(function(s, a) {
32
- return ye(s, "".concat(e, "-").concat(t.tag, "-").concat(a), n, void 0, r);
31
+ function be(t, e, n, i, r) {
32
+ return Re(t.tag, _(_({ key: e }, Et(t, n, r)), i), (Nt(t, n).children || []).map(function(s, a) {
33
+ return be(s, "".concat(e, "-").concat(t.tag, "-").concat(a), n, void 0, r);
33
34
  }));
34
35
  }
35
- function At(t, e, n) {
36
- var i = g({}, t.attrs);
36
+ function Et(t, e, n) {
37
+ var i = _({}, t.attrs);
37
38
  n != null && n.colorChannel1 && i.fill === "colorChannel1" && (i.fill = n.colorChannel1);
38
39
  var r = e.defIds;
39
40
  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) {
40
- var a = s[0], d = s[1];
41
- typeof d == "string" && (i[a] = d.replace(/url\(#(.*)\)/, "url(#$1".concat(e.idSuffix, ")")));
41
+ var a = s[0], c = s[1];
42
+ typeof c == "string" && (i[a] = c.replace(/url\(#(.*)\)/, "url(#$1".concat(e.idSuffix, ")")));
42
43
  })), i;
43
44
  }
44
- function Lt(t, e) {
45
+ function Nt(t, e) {
45
46
  var n, i = e.defIds;
46
- 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(r) {
47
- return typeof r.attrs.id == "string" && i && i.indexOf(r.attrs.id) > -1 ? g(g({}, r), { attrs: g(g({}, r.attrs), { id: r.attrs.id + e.idSuffix }) }) : r;
47
+ return !i || i.length === 0 ? t : t.tag === "defs" && (!((n = t.children) === null || n === void 0) && n.length) ? _(_({}, t), { children: t.children.map(function(r) {
48
+ return typeof r.attrs.id == "string" && i && i.indexOf(r.attrs.id) > -1 ? _(_({}, r), { attrs: _(_({}, r.attrs), { id: r.attrs.id + e.idSuffix }) }) : r;
48
49
  }) }) : t;
49
50
  }
50
- function jt() {
51
+ function $t() {
51
52
  return Math.random().toString(36).substring(2, 8);
52
53
  }
53
- xe.displayName = "UniverIcon";
54
- var wt = { 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" } }] }] }, Ie = U(function(t, e) {
55
- return be(xe, Object.assign({}, t, {
54
+ Me.displayName = "UniverIcon";
55
+ var At = { 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" } }] }] }, Ie = W(function(t, e) {
56
+ return Re(Me, Object.assign({}, t, {
56
57
  id: "search-single-16",
57
58
  ref: e,
58
- icon: wt
59
+ icon: At
59
60
  }));
60
61
  });
61
62
  Ie.displayName = "SearchSingle16";
62
- const Fe = "FIND_REPLACE_INPUT_FOCUS", De = "FIND_REPLACE_DIALOG_FOCUS", Pe = "FIND_REPLACE_REPLACE_REVEALED";
63
- var Ut = Object.defineProperty, Bt = Object.getOwnPropertyDescriptor, Oe = (t, e, n, i) => {
64
- for (var r = i > 1 ? void 0 : i ? Bt(e, n) : e, s = t.length - 1, a; s >= 0; s--)
63
+ const ye = "FIND_REPLACE_INPUT_FOCUS", De = "FIND_REPLACE_DIALOG_FOCUS", Fe = "FIND_REPLACE_REPLACE_REVEALED";
64
+ var Lt = Object.defineProperty, wt = Object.getOwnPropertyDescriptor, Pe = (t, e, n, i) => {
65
+ for (var r = i > 1 ? void 0 : i ? wt(e, n) : e, s = t.length - 1, a; s >= 0; s--)
65
66
  (a = t[s]) && (r = (i ? a(e, n, r) : a(r)) || r);
66
- return i && r && Ut(e, n, r), r;
67
- }, q = (t, e) => (n, i) => e(n, i, t);
68
- class Di extends X {
67
+ return i && r && Lt(e, n, r), r;
68
+ }, K = (t, e) => (n, i) => e(n, i, t);
69
+ class Ii extends X {
69
70
  }
70
- const m = ct("find-replace.service");
71
- function Wt(t) {
71
+ const g = at("find-replace.service");
72
+ function Ut(t) {
72
73
  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";
73
74
  }
74
- let J = class extends X {
75
+ let z = class extends X {
75
76
  constructor(e, n, i) {
76
77
  super();
77
- l(this, "currentMatch$", new P(null));
78
- l(this, "replaceables$", new P([]));
78
+ o(this, "currentMatch$", new P(null));
79
+ o(this, "replaceables$", new P([]));
79
80
  /** All find models returned by providers. */
80
- l(this, "_findModels", []);
81
+ o(this, "_findModels", []);
81
82
  /** The find model that the current match is from. */
82
- l(this, "_matchingModel", null);
83
- l(this, "_matches", []);
84
- l(this, "_currentSearchingDisposables", null);
83
+ o(this, "_matchingModel", null);
84
+ o(this, "_matches", []);
85
+ o(this, "_currentSearchingDisposables", null);
85
86
  this._state = e, this._providers = n, this._univerInstanceService = i, this.disposeWithMe(
86
- this._state.stateUpdates$.pipe(bt(200, void 0, { leading: !0, trailing: !0 })).subscribe(async (r) => {
87
+ this._state.stateUpdates$.pipe(Rt(200, void 0, { leading: !0, trailing: !0 })).subscribe(async (r) => {
87
88
  const s = this._state.state;
88
- Wt(r) && (s.findString !== "" && !s.replaceRevealed ? (await this._startSearching(), this._state.changeState({ findCompleted: !0 })) : r.replaceRevealed !== !0 && this._stopSearching());
89
+ Ut(r) && (s.findString !== "" && !s.replaceRevealed ? (await this._startSearching(), this._state.changeState({ findCompleted: !0 })) : r.replaceRevealed !== !0 && this._stopSearching());
89
90
  })
90
91
  );
91
92
  }
@@ -129,14 +130,14 @@ let J = class extends X {
129
130
  }
130
131
  // When a document's content changes, we should reset all matches and try to move to the next match.
131
132
  _subscribeToModelsChanges(e) {
132
- const n = this._currentSearchingDisposables = new lt(), i = Re(e.map((r) => r.matchesUpdate$)).pipe(xt(220)).subscribe(([...r]) => {
133
+ const n = this._currentSearchingDisposables = new ot(), i = ve(e.map((r) => r.matchesUpdate$)).pipe(Mt(220)).subscribe(([...r]) => {
133
134
  const s = this._matches = r.flat();
134
135
  s.length ? (this._moveToInitialMatch(this._findModels, !0), this._state.changeState({ matchesCount: s.length }), this.replaceables$.next(s.filter((a) => a.replaceable))) : (this._state.changeState({ matchesCount: 0, matchesPosition: 0 }), this.replaceables$.next([]));
135
136
  });
136
- e.forEach((r) => n.add($(r.activelyChangingMatch$.subscribe((s) => {
137
- const a = this._matches.findIndex((d) => d === s);
137
+ e.forEach((r) => n.add(A(r.activelyChangingMatch$.subscribe((s) => {
138
+ const a = this._matches.findIndex((c) => c === s);
138
139
  this._state.changeState({ matchesPosition: a + 1 });
139
- })))), n.add($(i));
140
+ })))), n.add(A(i));
140
141
  }
141
142
  async replace() {
142
143
  return this._matchingModel ? this._matchingModel.replace(this._state.replaceString) : !1;
@@ -186,9 +187,9 @@ let J = class extends X {
186
187
  } else {
187
188
  const i = this._findModels.length, r = this._findModels.findIndex((a) => a === this._matchingModel);
188
189
  for (let a = (r - 1 + i) % i; a !== r; ) {
189
- const d = this._findModels[a], c = d.moveToPreviousMatch({ ignoreSelection: !0 });
190
- if (c)
191
- return this._matchingModel = d, this._markMatch(c), c;
190
+ const c = this._findModels[a], d = c.moveToPreviousMatch({ ignoreSelection: !0 });
191
+ if (d)
192
+ return this._matchingModel = c, this._markMatch(d), d;
192
193
  a = (a - 1) % i;
193
194
  }
194
195
  const s = this._matchingModel.moveToPreviousMatch({ ignoreSelection: !0 });
@@ -210,10 +211,10 @@ let J = class extends X {
210
211
  return this._moveToNextUnitMatch(r), 0;
211
212
  }
212
213
  };
213
- J = Oe([
214
- q(2, ge)
215
- ], J);
216
- var K = /* @__PURE__ */ ((t) => (t.ROW = "row", t.COLUMN = "column", t))(K || {}), z = /* @__PURE__ */ ((t) => (t.VALUE = "value", t.FORMULA = "formula", t))(z || {}), Y = /* @__PURE__ */ ((t) => (t.SUBUNIT = "subunit", t.UNIT = "unit", t))(Y || {});
214
+ z = Pe([
215
+ K(2, pe)
216
+ ], z);
217
+ var q = /* @__PURE__ */ ((t) => (t.ROW = "row", t.COLUMN = "column", t))(q || {}), Y = /* @__PURE__ */ ((t) => (t.VALUE = "value", t.FORMULA = "formula", t))(Y || {}), Z = /* @__PURE__ */ ((t) => (t.SUBUNIT = "subunit", t.UNIT = "unit", t))(Z || {});
217
218
  function ne() {
218
219
  return {
219
220
  caseSensitive: !1,
@@ -231,25 +232,25 @@ function ne() {
231
232
  revealed: !0
232
233
  };
233
234
  }
234
- class Gt {
235
+ class Bt {
235
236
  constructor() {
236
- l(this, "_stateUpdates$", new Me());
237
- l(this, "stateUpdates$", this._stateUpdates$.asObservable());
238
- l(this, "_state$", new P(ne()));
239
- l(this, "state$", this._state$.asObservable());
240
- l(this, "_findString", "");
241
- l(this, "_inputtingFindString", "");
242
- l(this, "_replaceString", "");
243
- l(this, "_revealed", !1);
244
- l(this, "_replaceRevealed", !1);
245
- l(this, "_matchesPosition", 0);
246
- l(this, "_matchesCount", 0);
247
- l(this, "_caseSensitive", !0);
248
- l(this, "_matchesTheWholeCell", !1);
249
- l(this, "_findDirection", "row");
250
- l(this, "_findScope", "subunit");
251
- l(this, "_findBy", "value");
252
- l(this, "_findCompleted", !1);
237
+ o(this, "_stateUpdates$", new Ce());
238
+ o(this, "stateUpdates$", this._stateUpdates$.asObservable());
239
+ o(this, "_state$", new P(ne()));
240
+ o(this, "state$", this._state$.asObservable());
241
+ o(this, "_findString", "");
242
+ o(this, "_inputtingFindString", "");
243
+ o(this, "_replaceString", "");
244
+ o(this, "_revealed", !1);
245
+ o(this, "_replaceRevealed", !1);
246
+ o(this, "_matchesPosition", 0);
247
+ o(this, "_matchesCount", 0);
248
+ o(this, "_caseSensitive", !0);
249
+ o(this, "_matchesTheWholeCell", !1);
250
+ o(this, "_findDirection", "row");
251
+ o(this, "_findScope", "subunit");
252
+ o(this, "_findBy", "value");
253
+ o(this, "_findCompleted", !1);
253
254
  }
254
255
  get state() {
255
256
  return this._state$.getValue();
@@ -313,18 +314,18 @@ class Gt {
313
314
  }), this._stateUpdates$.next(i));
314
315
  }
315
316
  }
316
- let Z = class extends X {
317
+ let J = class extends X {
317
318
  constructor(e, n) {
318
319
  super();
319
- l(this, "_providers", /* @__PURE__ */ new Set());
320
- l(this, "_state", new Gt());
321
- l(this, "_model");
322
- l(this, "_currentMatch$", new P(null));
323
- l(this, "currentMatch$", this._currentMatch$.asObservable());
324
- l(this, "_replaceables$", new P([]));
325
- l(this, "replaceables$", this._replaceables$.asObservable());
326
- l(this, "_focusSignal$", new Me());
327
- l(this, "focusSignal$", this._focusSignal$.asObservable());
320
+ o(this, "_providers", /* @__PURE__ */ new Set());
321
+ o(this, "_state", new Bt());
322
+ o(this, "_model");
323
+ o(this, "_currentMatch$", new P(null));
324
+ o(this, "currentMatch$", this._currentMatch$.asObservable());
325
+ o(this, "_replaceables$", new P([]));
326
+ o(this, "replaceables$", this._replaceables$.asObservable());
327
+ o(this, "_focusSignal$", new Ce());
328
+ o(this, "focusSignal$", this._focusSignal$.asObservable());
328
329
  this._injector = e, this._contextService = n;
329
330
  }
330
331
  get stateUpdates$() {
@@ -402,7 +403,7 @@ let Z = class extends X {
402
403
  start(e = !1) {
403
404
  if (this._providers.size === 0)
404
405
  return !1;
405
- this._model = this._injector.createInstance(J, this._state, this._providers), this._model.currentMatch$.subscribe((i) => this._currentMatch$.next(i)), this._model.replaceables$.subscribe((i) => this._replaceables$.next(i));
406
+ this._model = this._injector.createInstance(z, this._state, this._providers), this._model.currentMatch$.subscribe((i) => this._currentMatch$.next(i)), this._model.replaceables$.subscribe((i) => this._replaceables$.next(i));
406
407
  const n = ne();
407
408
  return e && (n.replaceRevealed = !0), this._state.changeState(n), this._toggleRevealReplace(e), !0;
408
409
  }
@@ -415,396 +416,366 @@ let Z = class extends X {
415
416
  (e = this._model) == null || e.dispose(), this._model = null, this._toggleDisplayRawFormula(!1), this._toggleRevealReplace(!1);
416
417
  }
417
418
  registerFindReplaceProvider(e) {
418
- return this._providers.add(e), $(() => this._providers.delete(e));
419
+ return this._providers.add(e), A(() => this._providers.delete(e));
419
420
  }
420
421
  _toggleRevealReplace(e) {
421
- this._contextService.setContextValue(Pe, e);
422
+ this._contextService.setContextValue(Fe, e);
422
423
  }
423
424
  _toggleDisplayRawFormula(e) {
424
- this._contextService.setContextValue(Ot, e);
425
+ this._contextService.setContextValue(Pt, e);
425
426
  }
426
427
  };
427
- Z = Oe([
428
- q(0, F(Q)),
429
- q(1, ee)
430
- ], Z);
431
- const Te = {
428
+ J = Pe([
429
+ K(0, D(Q)),
430
+ K(1, ee)
431
+ ], J);
432
+ const xe = {
432
433
  id: "ui.command.replace-current-match",
433
434
  type: y.COMMAND,
434
- handler: (t) => t.get(m).replace()
435
- }, kt = "CONFIRM_REPLACE_ALL", Ee = {
435
+ handler: (t) => t.get(g).replace()
436
+ }, Wt = "CONFIRM_REPLACE_ALL", Te = {
436
437
  id: "ui.command.replace-all-matches",
437
438
  type: y.COMMAND,
438
439
  handler: async (t) => {
439
- const e = t.get(_t), n = t.get(w), i = t.get(Se);
440
+ const e = t.get(ft), n = t.get(B), i = t.get(me);
440
441
  if (!await e.confirm({
441
- id: kt,
442
+ id: Wt,
442
443
  title: { title: n.t("find-replace.replace.confirm.title") },
443
444
  cancelText: n.t("button.cancel"),
444
445
  confirmText: n.t("button.confirm")
445
446
  }))
446
447
  return !1;
447
- const s = await t.get(m).replaceAll(), { success: a, failure: d } = s;
448
- return d > 0 ? (a === 0 ? i.show({
448
+ const s = await t.get(g).replaceAll(), { success: a, failure: c } = s;
449
+ return c > 0 ? (a === 0 ? i.show({
449
450
  type: E.Error,
450
451
  content: n.t("find-replace.replace.all-failure")
451
452
  }) : i.show({
452
453
  type: E.Warning,
453
- content: n.t("find-replace.replace.partial-success", `${a}`, `${d}`)
454
+ content: n.t("find-replace.replace.partial-success", `${a}`, `${c}`)
454
455
  }), !1) : (i.show({
455
456
  type: E.Success,
456
457
  content: n.t("find-replace.replace.all-success", `${a}`)
457
458
  }), !0);
458
459
  }
459
- }, O = {
460
+ }, x = {
460
461
  id: "ui.operation.open-find-dialog",
461
462
  type: y.OPERATION,
462
463
  handler: (t) => {
463
- const e = t.get(m);
464
+ const e = t.get(g);
464
465
  return e.revealed ? e.focusFindInput() : e.start(), !0;
465
466
  }
466
467
  }, re = {
467
468
  id: "ui.operation.open-replace-dialog",
468
469
  type: y.OPERATION,
469
470
  handler: (t) => {
470
- const e = t.get(m);
471
+ const e = t.get(g);
471
472
  return e.revealed ? e.replaceRevealed ? e.focusFindInput() : e.revealReplace() : e.start(!0), !0;
472
473
  }
473
- }, Ne = {
474
+ }, Oe = {
474
475
  type: y.OPERATION,
475
476
  id: "ui.operation.go-to-next-match",
476
- handler: (t) => (t.get(m).moveToNextMatch(), !0)
477
- }, $e = {
477
+ handler: (t) => (t.get(g).moveToNextMatch(), !0)
478
+ }, Ee = {
478
479
  type: y.OPERATION,
479
480
  id: "ui.operation.go-to-previous-match",
480
- handler: (t) => (t.get(m).moveToPreviousMatch(), !0)
481
+ handler: (t) => (t.get(g).moveToPreviousMatch(), !0)
482
+ }, jt = "univer-find-replace-dialog-container", Gt = "univer-find-replace-expand-container", Vt = "univer-button-text", kt = "univer-find-replace-buttons-group", Ht = "univer-find-replace-buttons-group-right", w = {
483
+ findReplaceDialogContainer: jt,
484
+ findReplaceExpandContainer: Gt,
485
+ buttonText: Vt,
486
+ findReplaceButtonsGroup: kt,
487
+ findReplaceButtonsGroupRight: Ht
481
488
  };
482
- var k = { exports: {} }, I = {};
483
- /**
484
- * @license React
485
- * react-jsx-runtime.production.min.js
486
- *
487
- * Copyright (c) Facebook, Inc. and its affiliates.
488
- *
489
- * This source code is licensed under the MIT license found in the
490
- * LICENSE file in the root directory of this source tree.
491
- */
492
- var ue;
493
- function Vt() {
494
- if (ue) return I;
495
- ue = 1;
496
- var t = Tt, e = Symbol.for("react.element"), n = Symbol.for("react.fragment"), i = Object.prototype.hasOwnProperty, r = t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, s = { key: !0, ref: !0, __self: !0, __source: !0 };
497
- function a(d, c, _) {
498
- var u, h = {}, R = null, v = null;
499
- _ !== void 0 && (R = "" + _), c.key !== void 0 && (R = "" + c.key), c.ref !== void 0 && (v = c.ref);
500
- for (u in c) i.call(c, u) && !s.hasOwnProperty(u) && (h[u] = c[u]);
501
- if (d && d.defaultProps) for (u in c = d.defaultProps, c) h[u] === void 0 && (h[u] = c[u]);
502
- return { $$typeof: e, type: d, key: R, ref: v, props: h, _owner: r.current };
503
- }
504
- return I.Fragment = n, I.jsx = a, I.jsxs = a, I;
505
- }
506
- var he;
507
- function Ht() {
508
- return he || (he = 1, k.exports = Vt()), k.exports;
509
- }
510
- var o = Ht();
511
- const qt = "univer-find-replace-dialog-container", Jt = "univer-find-replace-expand-container", Kt = "univer-button-text", zt = "univer-find-replace-buttons-group", Yt = "univer-find-replace-buttons-group-right", L = {
512
- findReplaceDialogContainer: qt,
513
- findReplaceExpandContainer: Jt,
514
- buttonText: Kt,
515
- findReplaceButtonsGroup: zt,
516
- findReplaceButtonsGroupRight: Yt
517
- };
518
- function Ae(t) {
519
- const { findCompleted: e, localeService: n, matchesCount: i, matchesPosition: r, findString: s, findReplaceService: a, onChange: d, ...c } = t, u = e && i === 0 ? n.t("find-replace.dialog.no-result") : i === 0 ? " " : void 0;
520
- return /* @__PURE__ */ o.jsx(
521
- Ft,
489
+ function Ne(t) {
490
+ const { findCompleted: e, localeService: n, matchesCount: i, matchesPosition: r, findString: s, findReplaceService: a, onChange: c, ...d } = t, f = e && i === 0 ? n.t("find-replace.dialog.no-result") : i === 0 ? " " : void 0;
491
+ return /* @__PURE__ */ l(
492
+ yt,
522
493
  {
523
494
  autoFocus: !0,
524
495
  placeholder: n.t("find-replace.dialog.find-placeholder"),
525
- slot: /* @__PURE__ */ o.jsx(
496
+ slot: /* @__PURE__ */ l(
526
497
  Dt,
527
498
  {
528
499
  loop: !0,
529
- text: u,
500
+ text: f,
530
501
  value: r,
531
502
  total: i,
532
- onChange: (h) => {
533
- r === i && h === 1 ? a.moveToNextMatch() : r === 1 && h === i || h < r ? a.moveToPreviousMatch() : a.moveToNextMatch();
503
+ onChange: (p) => {
504
+ r === i && p === 1 ? a.moveToNextMatch() : r === 1 && p === i || p < r ? a.moveToPreviousMatch() : a.moveToNextMatch();
534
505
  }
535
506
  }
536
507
  ),
537
508
  value: s,
538
- onChange: (h) => d == null ? void 0 : d(h),
539
- ...c
509
+ onChange: (p) => c == null ? void 0 : c(p),
510
+ ...d
540
511
  }
541
512
  );
542
513
  }
543
- function Le(t, e) {
544
- const n = p(() => {
514
+ function $e(t, e) {
515
+ const n = u(() => {
545
516
  var r;
546
517
  (r = document.querySelector(".univer-find-input input")) == null || r.focus();
547
- }, []), i = p(() => {
518
+ }, []), i = u(() => {
548
519
  const r = document.querySelectorAll(".univer-find-replace-dialog-container .univer-select-selection-search-input");
549
520
  return Array.from(r).some((s) => s === document.activeElement);
550
521
  }, []);
551
- return Et(e, () => ({ focus: n, selectHasFocus: i })), A(() => {
522
+ return xt(e, () => ({ focus: n, selectHasFocus: i })), L(() => {
552
523
  const r = t.focusSignal$.subscribe(() => n());
553
524
  return () => r.unsubscribe();
554
525
  }, [t, n]), { focus: n, selectHasFocus: i };
555
526
  }
556
- const Zt = U(function(e, n) {
557
- const i = C(w), r = C(m), s = C(te), a = D(r.state$, void 0, !0), { findCompleted: d, findString: c, matchesCount: _, matchesPosition: u } = a, h = p(() => {
527
+ const Kt = W(function(e, n) {
528
+ const i = S(B), r = S(g), s = S(te), a = F(r.state$, void 0, !0), { findCompleted: c, findString: d, matchesCount: v, matchesPosition: f } = a, p = u(() => {
558
529
  s.executeCommand(re.id);
559
- }, [s]), R = p((v) => r.changeFindString(v), [r]);
560
- return Le(r, n), /* @__PURE__ */ o.jsxs(o.Fragment, { children: [
561
- /* @__PURE__ */ o.jsx(
562
- Ae,
530
+ }, [s]), O = u((C) => r.changeFindString(C), [r]);
531
+ return $e(r, n), /* @__PURE__ */ b($, { children: [
532
+ /* @__PURE__ */ l(
533
+ Ne,
563
534
  {
564
- findCompleted: d,
535
+ findCompleted: c,
565
536
  className: "univer-find-input",
566
- matchesCount: _,
567
- matchesPosition: u,
537
+ matchesCount: v,
538
+ matchesPosition: f,
568
539
  findReplaceService: r,
569
540
  localeService: i,
570
- findString: c,
571
- onChange: R
541
+ findString: d,
542
+ onChange: O
572
543
  }
573
544
  ),
574
- /* @__PURE__ */ o.jsx("div", { className: L.findReplaceExpandContainer, children: /* @__PURE__ */ o.jsx(N, { type: "text", size: "small", onClick: h, children: i.t("find-replace.dialog.advanced-finding") }) })
545
+ /* @__PURE__ */ l("div", { className: w.findReplaceExpandContainer, children: /* @__PURE__ */ l(N, { type: "text", size: "small", onClick: p, children: i.t("find-replace.dialog.advanced-finding") }) })
575
546
  ] });
576
- }), Qt = U(function(e, n) {
577
- const i = C(m), r = C(w), s = C(te), a = C(Se), d = D(i.currentMatch$, void 0, !0), c = D(i.replaceables$, void 0, !0), _ = D(i.state$, void 0, !0), {
578
- matchesCount: u,
579
- matchesPosition: h,
580
- findString: R,
581
- inputtingFindString: v,
582
- replaceString: Ue,
583
- caseSensitive: Be,
584
- matchesTheWholeCell: We,
585
- findDirection: Ge,
586
- findScope: ke,
587
- findBy: Ve,
588
- findCompleted: W
589
- } = _, He = v.length === 0, qe = u === 0 || !(d != null && d.replaceable), Je = c.length === 0, Ke = p(
590
- (f) => i.changeInputtingFindString(f),
547
+ }), zt = W(function(e, n) {
548
+ const i = S(g), r = S(B), s = S(te), a = S(me), c = F(i.currentMatch$, void 0, !0), d = F(i.replaceables$, void 0, !0), v = F(i.state$, void 0, !0), {
549
+ matchesCount: f,
550
+ matchesPosition: p,
551
+ findString: O,
552
+ inputtingFindString: C,
553
+ replaceString: we,
554
+ caseSensitive: Ue,
555
+ matchesTheWholeCell: Be,
556
+ findDirection: We,
557
+ findScope: je,
558
+ findBy: Ge,
559
+ findCompleted: G
560
+ } = v, Ve = C.length === 0, ke = f === 0 || !(c != null && c.replaceable), He = d.length === 0, Ke = u(
561
+ (h) => i.changeInputtingFindString(h),
591
562
  [i]
592
- ), ze = p(
593
- (f) => i.changeReplaceString(f),
563
+ ), ze = u(
564
+ (h) => i.changeReplaceString(h),
594
565
  [i]
595
- ), { focus: Ye } = Le(i, n), Ze = p(() => {
596
- R === v ? i.moveToNextMatch() : (i.changeFindString(v), i.find());
597
- }, [R, v, i]), Qe = p(() => s.executeCommand(Te.id), [s]), Xe = p(async () => {
598
- await s.executeCommand(Ee.id), Ye();
599
- }, [s]), et = p((f) => {
600
- i.changeFindDirection(f);
601
- }, [i]), tt = p((f) => {
602
- i.changeFindScope(f);
603
- }, [i]), it = p((f) => {
604
- i.changeFindBy(f);
605
- }, [i]), nt = ei(r), rt = ti(r), st = ii(r);
606
- return A(() => {
607
- W && u === 0 && a.show({
566
+ ), { focus: qe } = $e(i, n), Ye = u(() => {
567
+ O === C ? i.moveToNextMatch() : (i.changeFindString(C), i.find());
568
+ }, [O, C, i]), Ze = u(() => s.executeCommand(xe.id), [s]), Je = u(async () => {
569
+ await s.executeCommand(Te.id), qe();
570
+ }, [s]), Qe = u((h) => {
571
+ i.changeFindDirection(h);
572
+ }, [i]), Xe = u((h) => {
573
+ i.changeFindScope(h);
574
+ }, [i]), et = u((h) => {
575
+ i.changeFindBy(h);
576
+ }, [i]), tt = Yt(r), it = Zt(r), nt = Jt(r);
577
+ return L(() => {
578
+ G && f === 0 && a.show({
608
579
  content: r.t("find-replace.dialog.no-match"),
609
580
  type: E.Warning,
610
581
  duration: 5e3
611
582
  });
612
- }, [W, u, a, r]), /* @__PURE__ */ o.jsxs(o.Fragment, { children: [
613
- /* @__PURE__ */ o.jsx(M, { label: r.t("find-replace.dialog.find"), children: /* @__PURE__ */ o.jsx(
614
- Ae,
583
+ }, [G, f, a, r]), /* @__PURE__ */ b($, { children: [
584
+ /* @__PURE__ */ l(R, { label: r.t("find-replace.dialog.find"), children: /* @__PURE__ */ l(
585
+ Ne,
615
586
  {
616
- findCompleted: W,
587
+ findCompleted: G,
617
588
  className: "univer-find-input",
618
- matchesCount: u,
619
- matchesPosition: h,
589
+ matchesCount: f,
590
+ matchesPosition: p,
620
591
  findReplaceService: i,
621
592
  localeService: r,
622
- findString: v,
593
+ findString: C,
623
594
  onChange: Ke
624
595
  }
625
596
  ) }),
626
- /* @__PURE__ */ o.jsx(M, { label: r.t("find-replace.dialog.replace"), children: /* @__PURE__ */ o.jsx(
627
- Pt,
597
+ /* @__PURE__ */ l(R, { label: r.t("find-replace.dialog.replace"), children: /* @__PURE__ */ l(
598
+ Ft,
628
599
  {
629
600
  placeholder: r.t("find-replace.dialog.replace-placeholder"),
630
- value: Ue,
631
- onChange: (f) => ze(f)
601
+ value: we,
602
+ onChange: (h) => ze(h)
632
603
  }
633
604
  ) }),
634
- /* @__PURE__ */ o.jsx(M, { label: r.t("find-replace.dialog.find-direction.title"), children: /* @__PURE__ */ o.jsx(G, { value: Ge, options: rt, onChange: et }) }),
635
- /* @__PURE__ */ o.jsx(ce, { children: /* @__PURE__ */ o.jsxs(o.Fragment, { children: [
636
- /* @__PURE__ */ o.jsx(M, { label: r.t("find-replace.dialog.find-scope.title"), children: /* @__PURE__ */ o.jsx(G, { value: ke, options: nt, onChange: tt }) }),
637
- /* @__PURE__ */ o.jsx(M, { label: r.t("find-replace.dialog.find-by.title"), children: /* @__PURE__ */ o.jsx(G, { value: Ve, options: st, onChange: it }) })
605
+ /* @__PURE__ */ l(R, { label: r.t("find-replace.dialog.find-direction.title"), children: /* @__PURE__ */ l(V, { value: We, options: it, onChange: Qe }) }),
606
+ /* @__PURE__ */ l(ce, { children: /* @__PURE__ */ b($, { children: [
607
+ /* @__PURE__ */ l(R, { label: r.t("find-replace.dialog.find-scope.title"), children: /* @__PURE__ */ l(V, { value: je, options: tt, onChange: Xe }) }),
608
+ /* @__PURE__ */ l(R, { label: r.t("find-replace.dialog.find-by.title"), children: /* @__PURE__ */ l(V, { value: Ge, options: nt, onChange: et }) })
638
609
  ] }) }),
639
- /* @__PURE__ */ o.jsx(ce, { children: /* @__PURE__ */ o.jsxs(o.Fragment, { children: [
640
- /* @__PURE__ */ o.jsx(M, { children: /* @__PURE__ */ o.jsx(
610
+ /* @__PURE__ */ l(ce, { children: /* @__PURE__ */ b($, { children: [
611
+ /* @__PURE__ */ l(R, { children: /* @__PURE__ */ l(
641
612
  le,
642
613
  {
643
- checked: Be,
644
- onChange: (f) => {
645
- i.changeCaseSensitive(f);
614
+ checked: Ue,
615
+ onChange: (h) => {
616
+ i.changeCaseSensitive(h);
646
617
  },
647
618
  children: r.t("find-replace.dialog.case-sensitive")
648
619
  }
649
620
  ) }),
650
- /* @__PURE__ */ o.jsx(M, { children: /* @__PURE__ */ o.jsx(
621
+ /* @__PURE__ */ l(R, { children: /* @__PURE__ */ l(
651
622
  le,
652
623
  {
653
- checked: We,
654
- onChange: (f) => {
655
- i.changeMatchesTheWholeCell(f);
624
+ checked: Be,
625
+ onChange: (h) => {
626
+ i.changeMatchesTheWholeCell(h);
656
627
  },
657
628
  children: r.t("find-replace.dialog.match-the-whole-cell")
658
629
  }
659
630
  ) })
660
631
  ] }) }),
661
- /* @__PURE__ */ o.jsxs("div", { className: L.findReplaceButtonsGroup, children: [
662
- /* @__PURE__ */ o.jsx(N, { type: "primary", onClick: Ze, disabled: He, children: r.t("find-replace.dialog.find") }),
663
- /* @__PURE__ */ o.jsxs("span", { className: L.findReplaceButtonsGroupRight, children: [
664
- /* @__PURE__ */ o.jsx(N, { disabled: qe, onClick: Qe, children: r.t("find-replace.dialog.replace") }),
665
- /* @__PURE__ */ o.jsx(N, { disabled: Je, onClick: Xe, children: r.t("find-replace.dialog.replace-all") })
632
+ /* @__PURE__ */ b("div", { className: w.findReplaceButtonsGroup, children: [
633
+ /* @__PURE__ */ l(N, { type: "primary", onClick: Ye, disabled: Ve, children: r.t("find-replace.dialog.find") }),
634
+ /* @__PURE__ */ b("span", { className: w.findReplaceButtonsGroupRight, children: [
635
+ /* @__PURE__ */ l(N, { disabled: ke, onClick: Ze, children: r.t("find-replace.dialog.replace") }),
636
+ /* @__PURE__ */ l(N, { disabled: He, onClick: Je, children: r.t("find-replace.dialog.replace-all") })
666
637
  ] })
667
638
  ] })
668
639
  ] });
669
640
  });
670
- function Xt() {
671
- const t = C(m), e = C(Ce), n = C(ee), i = D(t.state$, void 0, !0), r = H(null);
672
- A(() => {
673
- let c;
674
- return r.current && (c = e.registerContainerElement(r.current)), () => c == null ? void 0 : c.dispose();
641
+ function qt() {
642
+ const t = S(g), e = S(Se), n = S(ee), i = F(t.state$, void 0, !0), r = H(null);
643
+ L(() => {
644
+ let d;
645
+ return r.current && (d = e.registerContainerElement(r.current)), () => d == null ? void 0 : d.dispose();
675
646
  }, [e]);
676
- const s = H(null), a = p(
677
- (c) => n.setContextValue(De, c),
647
+ const s = H(null), a = u(
648
+ (d) => n.setContextValue(De, d),
678
649
  [n]
679
- ), d = p(
680
- (c) => n.setContextValue(Fe, c),
650
+ ), c = u(
651
+ (d) => n.setContextValue(ye, d),
681
652
  [n]
682
653
  );
683
- return A(() => {
684
- var _;
685
- const c = yt(document, "focusin").subscribe((u) => {
686
- var h;
687
- u.target && ((h = r.current) != null && h.contains(u.target)) ? a(!0) : a(!1), !s.current || !s.current.selectHasFocus() ? d(!0) : d(!1);
654
+ return L(() => {
655
+ var v;
656
+ const d = bt(document, "focusin").subscribe((f) => {
657
+ var p;
658
+ f.target && ((p = r.current) != null && p.contains(f.target)) ? a(!0) : a(!1), !s.current || !s.current.selectHasFocus() ? c(!0) : c(!1);
688
659
  });
689
- return (_ = s.current) == null || _.focus(), a(!0), d(!0), () => {
690
- c.unsubscribe(), a(!1);
660
+ return (v = s.current) == null || v.focus(), a(!0), c(!0), () => {
661
+ d.unsubscribe(), a(!1);
691
662
  };
692
- }, [a, d]), /* @__PURE__ */ o.jsx("div", { className: L.findReplaceDialogContainer, ref: r, children: i.replaceRevealed ? /* @__PURE__ */ o.jsx(Qt, { ref: s }) : /* @__PURE__ */ o.jsx(Zt, { ref: s }) });
663
+ }, [a, c]), /* @__PURE__ */ l("div", { className: w.findReplaceDialogContainer, ref: r, children: i.replaceRevealed ? /* @__PURE__ */ l(zt, { ref: s }) : /* @__PURE__ */ l(Kt, { ref: s }) });
693
664
  }
694
- function ei(t) {
665
+ function Yt(t) {
695
666
  const e = t.getCurrentLocale();
696
667
  return ie(() => [
697
- { label: t.t("find-replace.dialog.find-scope.current-sheet"), value: Y.SUBUNIT },
698
- { label: t.t("find-replace.dialog.find-scope.workbook"), value: Y.UNIT }
668
+ { label: t.t("find-replace.dialog.find-scope.current-sheet"), value: Z.SUBUNIT },
669
+ { label: t.t("find-replace.dialog.find-scope.workbook"), value: Z.UNIT }
699
670
  ], [e]);
700
671
  }
701
- function ti(t) {
672
+ function Zt(t) {
702
673
  const e = t.getCurrentLocale();
703
674
  return ie(() => [
704
- { label: t.t("find-replace.dialog.find-direction.row"), value: K.ROW },
705
- { label: t.t("find-replace.dialog.find-direction.column"), value: K.COLUMN }
675
+ { label: t.t("find-replace.dialog.find-direction.row"), value: q.ROW },
676
+ { label: t.t("find-replace.dialog.find-direction.column"), value: q.COLUMN }
706
677
  ], [e]);
707
678
  }
708
- function ii(t) {
679
+ function Jt(t) {
709
680
  const e = t.getCurrentLocale();
710
681
  return ie(() => [
711
- { label: t.t("find-replace.dialog.find-by.value"), value: z.VALUE },
712
- { label: t.t("find-replace.dialog.find-by.formula"), value: z.FORMULA }
682
+ { label: t.t("find-replace.dialog.find-by.value"), value: Y.VALUE },
683
+ { label: t.t("find-replace.dialog.find-by.formula"), value: Y.FORMULA }
713
684
  ], [e]);
714
685
  }
715
686
  function T(t) {
716
687
  return t.getContextValue(De);
717
688
  }
718
- function ni(t) {
719
- return t.getContextValue(Pe);
720
- }
721
- function je(t) {
689
+ function Qt(t) {
722
690
  return t.getContextValue(Fe);
723
691
  }
724
- const B = "7_find-replace-shortcuts";
692
+ function Ae(t) {
693
+ return t.getContextValue(ye);
694
+ }
695
+ const j = "7_find-replace-shortcuts";
725
696
  function se(t) {
726
- return t.getContextValue(me);
697
+ return t.getContextValue(_e);
727
698
  }
728
699
  function ae(t) {
729
- return !t.getContextValue(ve);
700
+ return !t.getContextValue(ge);
730
701
  }
731
- const ri = {
732
- id: O.id,
702
+ const Xt = {
703
+ id: x.id,
733
704
  description: "find-replace.shortcut.open-find-dialog",
734
- binding: b.F | x.CTRL_COMMAND,
735
- group: B,
705
+ binding: M.F | I.CTRL_COMMAND,
706
+ group: j,
736
707
  preconditions(t) {
737
708
  return !T(t) && se(t) && ae(t);
738
709
  }
739
- }, si = {
740
- id: O.id,
710
+ }, ei = {
711
+ id: x.id,
741
712
  description: "find-replace.shortcut.open-find-dialog",
742
- binding: b.F | x.CTRL_COMMAND,
743
- mac: b.F | x.MAC_CTRL,
713
+ binding: M.F | I.CTRL_COMMAND,
714
+ mac: M.F | I.MAC_CTRL,
744
715
  preconditions(t) {
745
716
  return !T(t) && se(t) && ae(t);
746
717
  }
747
- }, ai = {
718
+ }, ti = {
748
719
  id: re.id,
749
720
  description: "find-replace.shortcut.open-replace-dialog",
750
- binding: b.H | x.CTRL_COMMAND,
751
- mac: b.H | x.MAC_CTRL,
752
- group: B,
721
+ binding: M.H | I.CTRL_COMMAND,
722
+ mac: M.H | I.MAC_CTRL,
723
+ group: j,
753
724
  preconditions(t) {
754
- return se(t) && ae(t) && (!T(t) || !ni(t));
725
+ return se(t) && ae(t) && (!T(t) || !Qt(t));
755
726
  }
756
- }, oi = {
757
- id: Ne.id,
727
+ }, ii = {
728
+ id: Oe.id,
758
729
  description: "find-replace.shortcut.go-to-next-match",
759
- binding: b.ENTER,
760
- group: B,
730
+ binding: M.ENTER,
731
+ group: j,
761
732
  priority: 1e3,
762
733
  preconditions(t) {
763
- return je(t) && T(t);
734
+ return Ae(t) && T(t);
764
735
  }
765
- }, ci = {
766
- id: $e.id,
736
+ }, ni = {
737
+ id: Ee.id,
767
738
  description: "find-replace.shortcut.go-to-previous-match",
768
- binding: b.ENTER | x.SHIFT,
769
- group: B,
739
+ binding: M.ENTER | I.SHIFT,
740
+ group: j,
770
741
  priority: 1e3,
771
742
  preconditions(t) {
772
- return je(t) && T(t);
743
+ return Ae(t) && T(t);
773
744
  }
774
745
  };
775
- function li(t) {
746
+ function ri(t) {
776
747
  const e = t.get(ee);
777
748
  return {
778
- id: O.id,
749
+ id: x.id,
779
750
  icon: "SearchIcon",
780
751
  tooltip: "find-replace.toolbar",
781
- type: gt.BUTTON,
782
- hidden$: mt(t, dt.UNIVER_SHEET),
783
- disabled$: Re([
784
- e.subscribeContextValue$(ve),
785
- e.subscribeContextValue$(me)
752
+ type: pt.BUTTON,
753
+ hidden$: _t(t, ct.UNIVER_SHEET),
754
+ disabled$: ve([
755
+ e.subscribeContextValue$(ge),
756
+ e.subscribeContextValue$(_e)
786
757
  ]).pipe(It(([n, i]) => n || !i))
787
758
  };
788
759
  }
789
- const di = {
790
- [vt.OTHERS]: {
791
- [O.id]: {
760
+ const si = {
761
+ [gt.OTHERS]: {
762
+ [x.id]: {
792
763
  order: 2,
793
- menuItemFactory: li
764
+ menuItemFactory: ri
794
765
  }
795
766
  }
796
767
  };
797
- var ui = Object.defineProperty, hi = Object.getOwnPropertyDescriptor, fi = (t, e, n, i) => {
798
- for (var r = i > 1 ? void 0 : i ? hi(e, n) : e, s = t.length - 1, a; s >= 0; s--)
768
+ var ai = Object.defineProperty, oi = Object.getOwnPropertyDescriptor, ci = (t, e, n, i) => {
769
+ for (var r = i > 1 ? void 0 : i ? oi(e, n) : e, s = t.length - 1, a; s >= 0; s--)
799
770
  (a = t[s]) && (r = (i ? a(e, n, r) : a(r)) || r);
800
- return i && r && ui(e, n, r), r;
801
- }, S = (t, e) => (n, i) => e(n, i, t);
802
- const fe = "DESKTOP_FIND_REPLACE_DIALOG", we = 350, pi = 20, _i = -90;
803
- let j = class extends ut {
804
- constructor(e, n, i, r, s, a, d, c, _, u) {
771
+ return i && r && ai(e, n, r), r;
772
+ }, m = (t, e) => (n, i) => e(n, i, t);
773
+ const he = "DESKTOP_FIND_REPLACE_DIALOG", Le = 350, li = 20, di = -90;
774
+ let U = class extends lt {
775
+ constructor(e, n, i, r, s, a, c, d, v, f) {
805
776
  super();
806
- l(this, "_closingListenerDisposable");
807
- this._univerInstanceService = e, this._menuManagerService = n, this._shortcutService = i, this._commandService = r, this._findReplaceService = s, this._dialogService = a, this._layoutService = d, this._localeService = c, this._componentManager = _, this._injector = u, this._initCommands(), this._initUI(), this._initShortcuts();
777
+ o(this, "_closingListenerDisposable");
778
+ this._univerInstanceService = e, this._menuManagerService = n, this._shortcutService = i, this._commandService = r, this._findReplaceService = s, this._dialogService = a, this._layoutService = c, this._localeService = d, this._componentManager = v, this._injector = f, this._initCommands(), this._initUI(), this._initShortcuts();
808
779
  }
809
780
  dispose() {
810
781
  var e;
@@ -812,111 +783,111 @@ let j = class extends ut {
812
783
  }
813
784
  _initCommands() {
814
785
  [
815
- O,
786
+ x,
816
787
  re,
817
- Ne,
818
- $e,
788
+ Oe,
819
789
  Ee,
820
- Te
790
+ Te,
791
+ xe
821
792
  ].forEach((e) => {
822
793
  this.disposeWithMe(this._commandService.registerCommand(e));
823
794
  });
824
795
  }
825
796
  _initShortcuts() {
826
797
  [
827
- ai,
828
- ri,
829
- si,
830
- ci,
831
- oi
798
+ ti,
799
+ Xt,
800
+ ei,
801
+ ni,
802
+ ii
832
803
  ].forEach((e) => this.disposeWithMe(this._shortcutService.registerShortcut(e)));
833
804
  }
834
805
  _initUI() {
835
- this.disposeWithMe(this._componentManager.register("FindReplaceDialog", Xt)), this.disposeWithMe(this._componentManager.register("SearchIcon", Ie)), this._menuManagerService.mergeMenu(di), this._findReplaceService.stateUpdates$.pipe(oe(this.dispose$)).subscribe((e) => {
806
+ this.disposeWithMe(this._componentManager.register("FindReplaceDialog", qt)), this.disposeWithMe(this._componentManager.register("SearchIcon", Ie)), this._menuManagerService.mergeMenu(si), this._findReplaceService.stateUpdates$.pipe(oe(this.dispose$)).subscribe((e) => {
836
807
  e.revealed === !0 && this._openPanel();
837
808
  });
838
809
  }
839
810
  _openPanel() {
840
811
  this._dialogService.open({
841
- id: fe,
812
+ id: he,
842
813
  draggable: !0,
843
- width: we,
814
+ width: Le,
844
815
  title: { title: this._localeService.t("find-replace.dialog.title") },
845
816
  children: { label: "FindReplaceDialog" },
846
817
  destroyOnClose: !0,
847
- defaultPosition: gi(),
818
+ defaultPosition: hi(),
848
819
  preservePositionOnDestroy: !0,
849
820
  onClose: () => this.closePanel()
850
- }), this._closingListenerDisposable = $(this._univerInstanceService.focused$.pipe(oe(this.dispose$)).subscribe((e) => {
821
+ }), this._closingListenerDisposable = A(this._univerInstanceService.focused$.pipe(oe(this.dispose$)).subscribe((e) => {
851
822
  (!e || !this._univerInstanceService.getUniverSheetInstance(e)) && this.closePanel();
852
823
  }));
853
824
  }
854
825
  closePanel() {
855
- this._closingListenerDisposable && (this._closingListenerDisposable.dispose(), this._closingListenerDisposable = null, this._dialogService.close(fe), this._findReplaceService.terminate(), queueMicrotask(() => this._layoutService.focus()));
826
+ this._closingListenerDisposable && (this._closingListenerDisposable.dispose(), this._closingListenerDisposable = null, this._dialogService.close(he), this._findReplaceService.terminate(), queueMicrotask(() => this._layoutService.focus()));
856
827
  }
857
828
  };
858
- j = fi([
859
- S(0, ge),
860
- S(1, Ct),
861
- S(2, Rt),
862
- S(3, te),
863
- S(4, m),
864
- S(5, Mt),
865
- S(6, Ce),
866
- S(7, F(w)),
867
- S(8, F(St)),
868
- S(9, F(Q))
869
- ], j);
870
- function gi() {
829
+ U = ci([
830
+ m(0, pe),
831
+ m(1, St),
832
+ m(2, vt),
833
+ m(3, te),
834
+ m(4, g),
835
+ m(5, Ct),
836
+ m(6, Se),
837
+ m(7, D(B)),
838
+ m(8, D(mt)),
839
+ m(9, D(Q))
840
+ ], U);
841
+ function hi() {
871
842
  const { innerWidth: t } = window;
872
- return { x: (t - we) / 2 - pi, y: _i };
843
+ return { x: (t - Le) / 2 - li, y: di };
873
844
  }
874
- var mi = Object.defineProperty, vi = Object.getOwnPropertyDescriptor, Si = (t, e, n, i) => {
875
- for (var r = i > 1 ? void 0 : i ? vi(e, n) : e, s = t.length - 1, a; s >= 0; s--)
845
+ var ui = Object.defineProperty, fi = Object.getOwnPropertyDescriptor, pi = (t, e, n, i) => {
846
+ for (var r = i > 1 ? void 0 : i ? fi(e, n) : e, s = t.length - 1, a; s >= 0; s--)
876
847
  (a = t[s]) && (r = (i ? a(e, n, r) : a(r)) || r);
877
- return i && r && mi(e, n, r), r;
878
- }, pe = (t, e) => (n, i) => e(n, i, t);
879
- const Ci = "UNIVER_FIND_REPLACE_PLUGIN";
880
- var V;
881
- let _e = (V = class extends ht {
848
+ return i && r && ui(e, n, r), r;
849
+ }, ue = (t, e) => (n, i) => e(n, i, t);
850
+ const _i = "UNIVER_FIND_REPLACE_PLUGIN";
851
+ var k;
852
+ let fe = (k = class extends dt {
882
853
  constructor(t = de, e, n) {
883
854
  super(), this._config = t, this._injector = e, this._configService = n;
884
- const { ...i } = ft(
855
+ const { ...i } = ht(
885
856
  {},
886
857
  de,
887
858
  this._config
888
859
  );
889
- this._configService.setConfig(Nt, i);
860
+ this._configService.setConfig(Tt, i);
890
861
  }
891
862
  onStarting() {
892
863
  [
893
- [j],
894
- [m, { useClass: Z }]
864
+ [U],
865
+ [g, { useClass: J }]
895
866
  ].forEach((t) => this._injector.add(t));
896
867
  }
897
868
  onRendered() {
898
- this._injector.get(j);
869
+ this._injector.get(U);
899
870
  }
900
- }, l(V, "pluginName", Ci), V);
901
- _e = Si([
902
- pe(1, F(Q)),
903
- pe(2, pt)
904
- ], _e);
871
+ }, o(k, "pluginName", _i), k);
872
+ fe = pi([
873
+ ue(1, D(Q)),
874
+ ue(2, ut)
875
+ ], fe);
905
876
  export {
906
- z as FindBy,
907
- K as FindDirection,
908
- Di as FindModel,
909
- j as FindReplaceController,
910
- J as FindReplaceModel,
911
- Gt as FindReplaceState,
912
- Y as FindScope,
913
- Ne as GoToNextMatchOperation,
914
- $e as GoToPreviousMatchOperation,
915
- m as IFindReplaceService,
916
- O as OpenFindDialogOperation,
877
+ Y as FindBy,
878
+ q as FindDirection,
879
+ Ii as FindModel,
880
+ U as FindReplaceController,
881
+ z as FindReplaceModel,
882
+ Bt as FindReplaceState,
883
+ Z as FindScope,
884
+ Oe as GoToNextMatchOperation,
885
+ Ee as GoToPreviousMatchOperation,
886
+ g as IFindReplaceService,
887
+ x as OpenFindDialogOperation,
917
888
  re as OpenReplaceDialogOperation,
918
- Ee as ReplaceAllMatchesCommand,
919
- Te as ReplaceCurrentMatchCommand,
920
- _e as UniverFindReplacePlugin,
889
+ Te as ReplaceAllMatchesCommand,
890
+ xe as ReplaceCurrentMatchCommand,
891
+ fe as UniverFindReplacePlugin,
921
892
  ne as createInitFindReplaceState
922
893
  };