@univerjs/find-replace 0.5.4 → 0.5.5-experimental.20250122-3362a4a

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,101 @@
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) {
13
- for (var e, n = 1, i = arguments.length; n < i; n++) {
14
- e = arguments[n];
15
- for (var r in e) Object.prototype.hasOwnProperty.call(e, r) && (t[r] = e[r]);
1
+ var __defProp = Object.defineProperty;
2
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: !0, configurable: !0, writable: !0, value }) : obj[key] = value;
3
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: !0 });
4
+ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key != "symbol" ? key + "" : key, value);
5
+ import { createIdentifier, Inject, Injector, Disposable, DisposableCollection, toDisposable, IUniverInstanceService, IContextService, CommandType, LocaleService, useDependency, ICommandService, FOCUSING_SHEET, EDITOR_ACTIVATED, UniverInstanceType, RxDisposable, Plugin, merge, IConfigService } from "@univerjs/core";
6
+ import { IConfirmService, IMessageService, useObservable, ILayoutService, KeyCode, MetaKeys, MenuItemType, getMenuHiddenObservable, RibbonStartGroup, ComponentManager, IMenuManagerService, IShortcutService, IDialogService } from "@univerjs/ui";
7
+ import { throttleTime, BehaviorSubject, combineLatest, debounceTime, Subject, fromEvent, map, takeUntil } from "rxjs";
8
+ import { MessageType, InputWithSlot, Pager, Button, FormLayout, Input, Select, FormDualColumnLayout, Checkbox } from "@univerjs/design";
9
+ import { RENDER_RAW_FORMULA_KEY } from "@univerjs/engine-render";
10
+ import { jsx, jsxs, Fragment } from "react/jsx-runtime";
11
+ import { forwardRef, useRef, createElement, useCallback, useEffect, useMemo, useImperativeHandle } from "react";
12
+ const FIND_REPLACE_PLUGIN_CONFIG_KEY = "find-replace.config", defaultPluginConfig = {};
13
+ var __assign = function() {
14
+ return __assign = Object.assign || function(t) {
15
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
16
+ s = arguments[i];
17
+ for (var p in s) Object.prototype.hasOwnProperty.call(s, p) && (t[p] = s[p]);
16
18
  }
17
19
  return t;
18
- }, g.apply(this, arguments);
19
- }, $t = function(t, e) {
20
- var n = {};
21
- for (var i in t) Object.prototype.hasOwnProperty.call(t, i) && e.indexOf(i) < 0 && (n[i] = t[i]);
22
- if (t != null && typeof Object.getOwnPropertySymbols == "function")
23
- for (var r = 0, i = Object.getOwnPropertySymbols(t); r < i.length; r++)
24
- e.indexOf(i[r]) < 0 && Object.prototype.propertyIsEnumerable.call(t, i[r]) && (n[i[r]] = t[i[r]]);
25
- 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);
20
+ }, __assign.apply(this, arguments);
21
+ }, __rest = function(s, e) {
22
+ var t = {};
23
+ for (var p in s) Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0 && (t[p] = s[p]);
24
+ if (s != null && typeof Object.getOwnPropertySymbols == "function")
25
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++)
26
+ e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]) && (t[p[i]] = s[p[i]]);
27
+ return t;
28
+ }, IconBase = forwardRef(function(props, ref) {
29
+ var icon = props.icon, id = props.id, className = props.className, extend = props.extend, restProps = __rest(props, ["icon", "id", "className", "extend"]), cls = "univerjs-icon univerjs-icon-".concat(id, " ").concat(className || "").trim(), idSuffix = useRef("_".concat(generateShortUuid()));
30
+ return render(icon, "".concat(id), { defIds: icon.defIds, idSuffix: idSuffix.current }, __assign({ ref, className: cls }, restProps), extend);
29
31
  });
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);
32
+ function render(node, id, runtimeProps, rootProps, extend) {
33
+ return createElement(node.tag, __assign(__assign({ key: id }, replaceRuntimeIdsAndExtInAttrs(node, runtimeProps, extend)), rootProps), (replaceRuntimeIdsInDefs(node, runtimeProps).children || []).map(function(child, index) {
34
+ return render(child, "".concat(id, "-").concat(node.tag, "-").concat(index), runtimeProps, void 0, extend);
33
35
  }));
34
36
  }
35
- function At(t, e, n) {
36
- var i = g({}, t.attrs);
37
- n != null && n.colorChannel1 && i.fill === "colorChannel1" && (i.fill = n.colorChannel1);
38
- var r = e.defIds;
39
- 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, ")")));
42
- })), i;
37
+ __name(render, "render");
38
+ function replaceRuntimeIdsAndExtInAttrs(node, runtimeProps, extend) {
39
+ var attrs = __assign({}, node.attrs);
40
+ extend != null && extend.colorChannel1 && attrs.fill === "colorChannel1" && (attrs.fill = extend.colorChannel1);
41
+ var defIds = runtimeProps.defIds;
42
+ return !defIds || defIds.length === 0 || (node.tag === "use" && attrs["xlink:href"] && (attrs["xlink:href"] = attrs["xlink:href"] + runtimeProps.idSuffix), Object.entries(attrs).forEach(function(_a5) {
43
+ var key = _a5[0], value = _a5[1];
44
+ typeof value == "string" && (attrs[key] = value.replace(/url\(#(.*)\)/, "url(#$1".concat(runtimeProps.idSuffix, ")")));
45
+ })), attrs;
43
46
  }
44
- function Lt(t, e) {
45
- 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;
48
- }) }) : t;
47
+ __name(replaceRuntimeIdsAndExtInAttrs, "replaceRuntimeIdsAndExtInAttrs");
48
+ function replaceRuntimeIdsInDefs(node, runtimeProps) {
49
+ var _a5, defIds = runtimeProps.defIds;
50
+ return !defIds || defIds.length === 0 ? node : node.tag === "defs" && (!((_a5 = node.children) === null || _a5 === void 0) && _a5.length) ? __assign(__assign({}, node), { children: node.children.map(function(child) {
51
+ return typeof child.attrs.id == "string" && defIds && defIds.indexOf(child.attrs.id) > -1 ? __assign(__assign({}, child), { attrs: __assign(__assign({}, child.attrs), { id: child.attrs.id + runtimeProps.idSuffix }) }) : child;
52
+ }) }) : node;
49
53
  }
50
- function jt() {
54
+ __name(replaceRuntimeIdsInDefs, "replaceRuntimeIdsInDefs");
55
+ function generateShortUuid() {
51
56
  return Math.random().toString(36).substring(2, 8);
52
57
  }
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, {
58
+ __name(generateShortUuid, "generateShortUuid");
59
+ IconBase.displayName = "UniverIcon";
60
+ var element = { 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" } }] }] }, SearchSingle16 = forwardRef(function(props, ref) {
61
+ return createElement(IconBase, Object.assign({}, props, {
56
62
  id: "search-single-16",
57
- ref: e,
58
- icon: wt
63
+ ref,
64
+ icon: element
59
65
  }));
60
66
  });
61
- 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--)
65
- (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 {
69
- }
70
- const m = ct("find-replace.service");
71
- function Wt(t) {
72
- 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";
67
+ SearchSingle16.displayName = "SearchSingle16";
68
+ const FIND_REPLACE_INPUT_FOCUS = "FIND_REPLACE_INPUT_FOCUS", FIND_REPLACE_DIALOG_FOCUS = "FIND_REPLACE_DIALOG_FOCUS", FIND_REPLACE_REPLACE_REVEALED = "FIND_REPLACE_REPLACE_REVEALED";
69
+ var __defProp$2 = Object.defineProperty, __getOwnPropDesc$2 = Object.getOwnPropertyDescriptor, __decorateClass$2 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
70
+ for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$2(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
71
+ (decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
72
+ return kind && result && __defProp$2(target, key, result), result;
73
+ }, "__decorateClass$2"), __decorateParam$2 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$2");
74
+ const _FindModel = class _FindModel extends Disposable {
75
+ };
76
+ __name(_FindModel, "FindModel");
77
+ let FindModel = _FindModel;
78
+ const IFindReplaceService = createIdentifier("find-replace.service");
79
+ function shouldStateUpdateTriggerResearch(statusUpdate) {
80
+ return typeof statusUpdate.findString < "u" || typeof statusUpdate.inputtingFindString < "u" || typeof statusUpdate.findDirection < "u" || typeof statusUpdate.matchesTheWholeCell < "u" || typeof statusUpdate.caseSensitive < "u" || typeof statusUpdate.findScope < "u" || typeof statusUpdate.findBy < "u";
73
81
  }
74
- let J = class extends X {
75
- constructor(e, n, i) {
82
+ __name(shouldStateUpdateTriggerResearch, "shouldStateUpdateTriggerResearch");
83
+ var _a;
84
+ let FindReplaceModel = (_a = class extends Disposable {
85
+ constructor(_state, _providers, _univerInstanceService) {
76
86
  super();
77
- l(this, "currentMatch$", new P(null));
78
- l(this, "replaceables$", new P([]));
87
+ __publicField(this, "currentMatch$", new BehaviorSubject(null));
88
+ __publicField(this, "replaceables$", new BehaviorSubject([]));
79
89
  /** All find models returned by providers. */
80
- l(this, "_findModels", []);
90
+ __publicField(this, "_findModels", []);
81
91
  /** The find model that the current match is from. */
82
- l(this, "_matchingModel", null);
83
- l(this, "_matches", []);
84
- l(this, "_currentSearchingDisposables", null);
85
- 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
- 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());
92
+ __publicField(this, "_matchingModel", null);
93
+ __publicField(this, "_matches", []);
94
+ __publicField(this, "_currentSearchingDisposables", null);
95
+ this._state = _state, this._providers = _providers, this._univerInstanceService = _univerInstanceService, this.disposeWithMe(
96
+ this._state.stateUpdates$.pipe(throttleTime(200, void 0, { leading: !0, trailing: !0 })).subscribe(async (stateUpdate) => {
97
+ const state = this._state.state;
98
+ shouldStateUpdateTriggerResearch(stateUpdate) && (state.findString !== "" && !state.replaceRevealed ? (await this._startSearching(), this._state.changeState({ findCompleted: !0 })) : stateUpdate.replaceRevealed !== !0 && this._stopSearching());
89
99
  })
90
100
  );
91
101
  }
@@ -93,19 +103,19 @@ let J = class extends X {
93
103
  return this._findModels.length > 0;
94
104
  }
95
105
  dispose() {
96
- super.dispose(), this._stopSearching(), this.currentMatch$.complete(), this.replaceables$.complete(), this._state.changeState({ ...ne(), revealed: !1 });
106
+ super.dispose(), this._stopSearching(), this.currentMatch$.complete(), this.replaceables$.complete(), this._state.changeState({ ...createInitFindReplaceState(), revealed: !1 });
97
107
  }
98
108
  async start() {
99
109
  if (!this._state.findString)
100
110
  return { results: [] };
101
- const e = await this._startSearching();
102
- return this._state.changeState({ findCompleted: !0 }), e;
111
+ const complete = await this._startSearching();
112
+ return this._state.changeState({ findCompleted: !0 }), complete;
103
113
  }
104
114
  /** Call this method to start a `searching`. */
105
115
  async _startSearching() {
106
116
  if (!this._state.findString)
107
117
  return { results: [] };
108
- const e = Array.from(this._providers), n = this._findModels = (await Promise.all(e.map((r) => r.find({
118
+ const providers = Array.from(this._providers), findModels = this._findModels = (await Promise.all(providers.map((provider) => provider.find({
109
119
  findString: this._state.findString,
110
120
  findDirection: this._state.findDirection,
111
121
  findScope: this._state.findScope,
@@ -114,107 +124,107 @@ let J = class extends X {
114
124
  caseSensitive: this._state.caseSensitive,
115
125
  matchesTheWholeCell: this._state.matchesTheWholeCell
116
126
  })))).flat();
117
- this._subscribeToModelsChanges(n);
118
- const i = this._matches = n.map((r) => r.getMatches()).flat();
119
- return this.replaceables$.next(i.filter((r) => r.replaceable)), i.length ? (this._moveToInitialMatch(n), this._state.changeState({ matchesCount: i.length }), { results: i }) : (this._state.changeState({ matchesCount: 0, matchesPosition: 0 }), { results: [] });
127
+ this._subscribeToModelsChanges(findModels);
128
+ const newMatches = this._matches = findModels.map((c) => c.getMatches()).flat();
129
+ return this.replaceables$.next(newMatches.filter((m) => m.replaceable)), newMatches.length ? (this._moveToInitialMatch(findModels), this._state.changeState({ matchesCount: newMatches.length }), { results: newMatches }) : (this._state.changeState({ matchesCount: 0, matchesPosition: 0 }), { results: [] });
120
130
  }
121
131
  /** Terminate the current searching session, when searching string is empty. */
122
132
  _stopSearching() {
123
- var e;
124
- this._providers.forEach((n) => n.terminate()), this._findModels = [], this._matches = [], this._matchingModel = null, (e = this._currentSearchingDisposables) == null || e.dispose(), this._currentSearchingDisposables = null, this.currentMatch$.next(null), this.replaceables$.next([]), this._state.changeState({
133
+ var _a5;
134
+ this._providers.forEach((provider) => provider.terminate()), this._findModels = [], this._matches = [], this._matchingModel = null, (_a5 = this._currentSearchingDisposables) == null || _a5.dispose(), this._currentSearchingDisposables = null, this.currentMatch$.next(null), this.replaceables$.next([]), this._state.changeState({
125
135
  findCompleted: !1,
126
136
  matchesCount: 0,
127
137
  matchesPosition: 0
128
138
  });
129
139
  }
130
140
  // When a document's content changes, we should reset all matches and try to move to the next match.
131
- _subscribeToModelsChanges(e) {
132
- const n = this._currentSearchingDisposables = new lt(), i = Re(e.map((r) => r.matchesUpdate$)).pipe(xt(220)).subscribe(([...r]) => {
133
- const s = this._matches = r.flat();
134
- 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([]));
141
+ _subscribeToModelsChanges(models) {
142
+ const disposables = this._currentSearchingDisposables = new DisposableCollection(), matchesUpdateSubscription = combineLatest(models.map((model) => model.matchesUpdate$)).pipe(debounceTime(220)).subscribe(([...allMatches]) => {
143
+ const newMatches = this._matches = allMatches.flat();
144
+ newMatches.length ? (this._moveToInitialMatch(this._findModels, !0), this._state.changeState({ matchesCount: newMatches.length }), this.replaceables$.next(newMatches.filter((m) => m.replaceable))) : (this._state.changeState({ matchesCount: 0, matchesPosition: 0 }), this.replaceables$.next([]));
135
145
  });
136
- e.forEach((r) => n.add($(r.activelyChangingMatch$.subscribe((s) => {
137
- const a = this._matches.findIndex((d) => d === s);
138
- this._state.changeState({ matchesPosition: a + 1 });
139
- })))), n.add($(i));
146
+ models.forEach((model) => disposables.add(toDisposable(model.activelyChangingMatch$.subscribe((match) => {
147
+ const index = this._matches.findIndex((m) => m === match);
148
+ this._state.changeState({ matchesPosition: index + 1 });
149
+ })))), disposables.add(toDisposable(matchesUpdateSubscription));
140
150
  }
141
151
  async replace() {
142
152
  return this._matchingModel ? this._matchingModel.replace(this._state.replaceString) : !1;
143
153
  }
144
154
  async replaceAll() {
145
- 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 }));
146
- return e.failure === 0 && this._stopSearching(), e;
155
+ const result = await Promise.all(this._findModels.map((m) => m.replaceAll(this._state.replaceString))).then((results) => results.reduce((acc, cur) => (acc.success += cur.success, acc.failure += cur.failure, acc), { success: 0, failure: 0 }));
156
+ return result.failure === 0 && this._stopSearching(), result;
147
157
  }
148
158
  getCurrentMatch() {
149
159
  return this._state.matchesPosition > 0 ? this._matches[this._state.matchesPosition - 1] : null;
150
160
  }
151
- _markMatch(e) {
152
- const n = this._matches.findIndex((i) => i === e);
153
- this.currentMatch$.next(e), this._state.changeState({ matchesPosition: n + 1 });
161
+ _markMatch(match) {
162
+ const index = this._matches.findIndex((value) => value === match);
163
+ this.currentMatch$.next(match), this._state.changeState({ matchesPosition: index + 1 });
154
164
  }
155
165
  moveToNextMatch() {
156
166
  if (!this._matchingModel)
157
167
  return;
158
- const e = this._findModels.length === 1, n = this._matchingModel.moveToNextMatch({ loop: e });
159
- if (n)
160
- return this._markMatch(n), n;
168
+ const loopInCurrentUnit = this._findModels.length === 1, nextMatch = this._matchingModel.moveToNextMatch({ loop: loopInCurrentUnit });
169
+ if (nextMatch)
170
+ return this._markMatch(nextMatch), nextMatch;
161
171
  {
162
- const i = this._findModels.findIndex((r) => r === this._matchingModel);
163
- return this._moveToNextUnitMatch(i);
172
+ const currentModelIndex = this._findModels.findIndex((m) => m === this._matchingModel);
173
+ return this._moveToNextUnitMatch(currentModelIndex);
164
174
  }
165
175
  }
166
- _moveToNextUnitMatch(e) {
167
- const n = this._findModels.length;
168
- for (let i = (e + 1) % n; i !== e; ) {
169
- const r = this._findModels[i], s = r.moveToNextMatch({ ignoreSelection: !0 });
170
- if (s)
171
- return this._matchingModel = r, this._markMatch(s), s;
172
- i = (i + 1) % n;
176
+ _moveToNextUnitMatch(startingIndex) {
177
+ const l = this._findModels.length;
178
+ for (let i = (startingIndex + 1) % l; i !== startingIndex; ) {
179
+ const nextPositionModel = this._findModels[i], nextMatch = nextPositionModel.moveToNextMatch({ ignoreSelection: !0 });
180
+ if (nextMatch)
181
+ return this._matchingModel = nextPositionModel, this._markMatch(nextMatch), nextMatch;
182
+ i = (i + 1) % l;
173
183
  }
174
184
  if (this._matchingModel) {
175
- const i = this._matchingModel.moveToNextMatch({ ignoreSelection: !0 });
176
- return i && this._markMatch(i), i;
185
+ const nextMatch = this._matchingModel.moveToNextMatch({ ignoreSelection: !0 });
186
+ return nextMatch && this._markMatch(nextMatch), nextMatch;
177
187
  }
178
188
  }
179
189
  moveToPreviousMatch() {
180
190
  if (!this._matchingModel)
181
191
  return;
182
- const e = this._findModels.length === 1, n = this._matchingModel.moveToPreviousMatch({ loop: e });
183
- if (n) {
184
- const i = this._matches.findIndex((r) => r === n);
185
- return this.currentMatch$.next(n), this._state.changeState({ matchesPosition: i + 1 }), n;
192
+ const loopInCurrentUnit = this._findModels.length === 1, nextMatch = this._matchingModel.moveToPreviousMatch({ loop: loopInCurrentUnit });
193
+ if (nextMatch) {
194
+ const index = this._matches.findIndex((value) => value === nextMatch);
195
+ return this.currentMatch$.next(nextMatch), this._state.changeState({ matchesPosition: index + 1 }), nextMatch;
186
196
  } else {
187
- const i = this._findModels.length, r = this._findModels.findIndex((a) => a === this._matchingModel);
188
- 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;
192
- a = (a - 1) % i;
197
+ const l = this._findModels.length, currentModelIndex = this._findModels.findIndex((m) => m === this._matchingModel);
198
+ for (let i = (currentModelIndex - 1 + l) % l; i !== currentModelIndex; ) {
199
+ const nextPositionModel = this._findModels[i], nextMatch3 = nextPositionModel.moveToPreviousMatch({ ignoreSelection: !0 });
200
+ if (nextMatch3)
201
+ return this._matchingModel = nextPositionModel, this._markMatch(nextMatch3), nextMatch3;
202
+ i = (i - 1) % l;
193
203
  }
194
- const s = this._matchingModel.moveToPreviousMatch({ ignoreSelection: !0 });
195
- return s && this._markMatch(s), s;
204
+ const nextMatch2 = this._matchingModel.moveToPreviousMatch({ ignoreSelection: !0 });
205
+ return nextMatch2 && this._markMatch(nextMatch2), nextMatch2;
196
206
  }
197
207
  }
198
- _moveToInitialMatch(e, n = !1) {
199
- var s;
200
- const i = (s = this._univerInstanceService.getFocusedUnit()) == null ? void 0 : s.getUnitId();
201
- if (!i)
208
+ _moveToInitialMatch(findModels, noFocus = !1) {
209
+ var _a5;
210
+ const focusedUnitId = (_a5 = this._univerInstanceService.getFocusedUnit()) == null ? void 0 : _a5.getUnitId();
211
+ if (!focusedUnitId)
202
212
  return -1;
203
- const r = e.findIndex((a) => a.unitId === i);
204
- if (r !== -1) {
205
- this._matchingModel = e[r];
206
- const a = this._matchingModel.moveToNextMatch({ stayIfOnMatch: !0, noFocus: n });
207
- if (a)
208
- return this._markMatch(a), r;
213
+ const i = findModels.findIndex((model) => model.unitId === focusedUnitId);
214
+ if (i !== -1) {
215
+ this._matchingModel = findModels[i];
216
+ const nextMatch = this._matchingModel.moveToNextMatch({ stayIfOnMatch: !0, noFocus });
217
+ if (nextMatch)
218
+ return this._markMatch(nextMatch), i;
209
219
  }
210
- return this._moveToNextUnitMatch(r), 0;
211
- }
212
- };
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 || {});
217
- function ne() {
220
+ return this._moveToNextUnitMatch(i), 0;
221
+ }
222
+ }, __name(_a, "FindReplaceModel"), _a);
223
+ FindReplaceModel = __decorateClass$2([
224
+ __decorateParam$2(2, IUniverInstanceService)
225
+ ], FindReplaceModel);
226
+ var FindDirection = /* @__PURE__ */ ((FindDirection2) => (FindDirection2.ROW = "row", FindDirection2.COLUMN = "column", FindDirection2))(FindDirection || {}), FindBy = /* @__PURE__ */ ((FindBy2) => (FindBy2.VALUE = "value", FindBy2.FORMULA = "formula", FindBy2))(FindBy || {}), FindScope = /* @__PURE__ */ ((FindScope2) => (FindScope2.SUBUNIT = "subunit", FindScope2.UNIT = "unit", FindScope2))(FindScope || {});
227
+ function createInitFindReplaceState() {
218
228
  return {
219
229
  caseSensitive: !1,
220
230
  findBy: "value",
@@ -231,25 +241,26 @@ function ne() {
231
241
  revealed: !0
232
242
  };
233
243
  }
234
- class Gt {
244
+ __name(createInitFindReplaceState, "createInitFindReplaceState");
245
+ const _FindReplaceState = class _FindReplaceState {
235
246
  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);
247
+ __publicField(this, "_stateUpdates$", new Subject());
248
+ __publicField(this, "stateUpdates$", this._stateUpdates$.asObservable());
249
+ __publicField(this, "_state$", new BehaviorSubject(createInitFindReplaceState()));
250
+ __publicField(this, "state$", this._state$.asObservable());
251
+ __publicField(this, "_findString", "");
252
+ __publicField(this, "_inputtingFindString", "");
253
+ __publicField(this, "_replaceString", "");
254
+ __publicField(this, "_revealed", !1);
255
+ __publicField(this, "_replaceRevealed", !1);
256
+ __publicField(this, "_matchesPosition", 0);
257
+ __publicField(this, "_matchesCount", 0);
258
+ __publicField(this, "_caseSensitive", !0);
259
+ __publicField(this, "_matchesTheWholeCell", !1);
260
+ __publicField(this, "_findDirection", "row");
261
+ __publicField(this, "_findScope", "subunit");
262
+ __publicField(this, "_findBy", "value");
263
+ __publicField(this, "_findCompleted", !1);
253
264
  }
254
265
  get state() {
255
266
  return this._state$.getValue();
@@ -294,10 +305,10 @@ class Gt {
294
305
  return this._findCompleted;
295
306
  }
296
307
  // eslint-disable-next-line max-lines-per-function, complexity
297
- changeState(e) {
298
- let n = !1;
299
- const i = {};
300
- typeof e.findString < "u" && e.findString !== this._findString && (this._findString = e.findString, i.findString = this._findString, n = !0), typeof e.revealed < "u" && e.revealed !== this._revealed && (this._revealed = e.revealed, i.revealed = e.revealed, n = !0), typeof e.replaceRevealed < "u" && e.replaceRevealed !== this._replaceRevealed && (this._replaceRevealed = e.replaceRevealed, i.replaceRevealed = e.replaceRevealed, n = !0), typeof e.replaceString < "u" && e.replaceString !== this._replaceString && (this._replaceString = e.replaceString, i.replaceString = e.replaceString, n = !0), typeof e.matchesCount < "u" && e.matchesCount !== this._matchesCount && (this._matchesCount = e.matchesCount, i.matchesCount = e.matchesCount, n = !0), typeof e.matchesPosition < "u" && e.matchesPosition !== this._matchesPosition && (this._matchesPosition = e.matchesPosition, i.matchesPosition = e.matchesPosition, n = !0), typeof e.findBy < "u" && e.findBy !== this._findBy && (this._findBy = e.findBy, i.findBy = e.findBy, n = !0), typeof e.findScope < "u" && e.findScope !== this._findScope && (this._findScope = e.findScope, i.findScope = e.findScope, n = !0), typeof e.findDirection < "u" && e.findDirection !== this._findDirection && (this._findDirection = e.findDirection, i.findDirection = e.findDirection, n = !0), typeof e.caseSensitive < "u" && e.caseSensitive !== this._caseSensitive && (this._caseSensitive = e.caseSensitive, i.caseSensitive = e.caseSensitive, n = !0), typeof e.matchesTheWholeCell < "u" && e.matchesTheWholeCell !== this._matchesTheWholeCell && (this._matchesTheWholeCell = e.matchesTheWholeCell, i.matchesTheWholeCell = e.matchesTheWholeCell, n = !0), typeof e.inputtingFindString < "u" && e.inputtingFindString !== this._inputtingFindString && (this._inputtingFindString = e.inputtingFindString, i.inputtingFindString = e.inputtingFindString, n = !0), typeof e.findCompleted < "u" && e.findCompleted !== this._findCompleted && (this._findCompleted = e.findCompleted, i.findCompleted = e.findCompleted, n = !0), n && (this._state$.next({
308
+ changeState(changes) {
309
+ let changed = !1;
310
+ const changedState = {};
311
+ typeof changes.findString < "u" && changes.findString !== this._findString && (this._findString = changes.findString, changedState.findString = this._findString, changed = !0), typeof changes.revealed < "u" && changes.revealed !== this._revealed && (this._revealed = changes.revealed, changedState.revealed = changes.revealed, changed = !0), typeof changes.replaceRevealed < "u" && changes.replaceRevealed !== this._replaceRevealed && (this._replaceRevealed = changes.replaceRevealed, changedState.replaceRevealed = changes.replaceRevealed, changed = !0), typeof changes.replaceString < "u" && changes.replaceString !== this._replaceString && (this._replaceString = changes.replaceString, changedState.replaceString = changes.replaceString, changed = !0), typeof changes.matchesCount < "u" && changes.matchesCount !== this._matchesCount && (this._matchesCount = changes.matchesCount, changedState.matchesCount = changes.matchesCount, changed = !0), typeof changes.matchesPosition < "u" && changes.matchesPosition !== this._matchesPosition && (this._matchesPosition = changes.matchesPosition, changedState.matchesPosition = changes.matchesPosition, changed = !0), typeof changes.findBy < "u" && changes.findBy !== this._findBy && (this._findBy = changes.findBy, changedState.findBy = changes.findBy, changed = !0), typeof changes.findScope < "u" && changes.findScope !== this._findScope && (this._findScope = changes.findScope, changedState.findScope = changes.findScope, changed = !0), typeof changes.findDirection < "u" && changes.findDirection !== this._findDirection && (this._findDirection = changes.findDirection, changedState.findDirection = changes.findDirection, changed = !0), typeof changes.caseSensitive < "u" && changes.caseSensitive !== this._caseSensitive && (this._caseSensitive = changes.caseSensitive, changedState.caseSensitive = changes.caseSensitive, changed = !0), typeof changes.matchesTheWholeCell < "u" && changes.matchesTheWholeCell !== this._matchesTheWholeCell && (this._matchesTheWholeCell = changes.matchesTheWholeCell, changedState.matchesTheWholeCell = changes.matchesTheWholeCell, changed = !0), typeof changes.inputtingFindString < "u" && changes.inputtingFindString !== this._inputtingFindString && (this._inputtingFindString = changes.inputtingFindString, changedState.inputtingFindString = changes.inputtingFindString, changed = !0), typeof changes.findCompleted < "u" && changes.findCompleted !== this._findCompleted && (this._findCompleted = changes.findCompleted, changedState.findCompleted = changes.findCompleted, changed = !0), changed && (this._state$.next({
301
312
  caseSensitive: this._caseSensitive,
302
313
  findBy: this._findBy,
303
314
  findCompleted: this._findCompleted,
@@ -310,22 +321,25 @@ class Gt {
310
321
  matchesTheWholeCell: this._matchesTheWholeCell,
311
322
  replaceRevealed: this._replaceRevealed,
312
323
  revealed: this._revealed
313
- }), this._stateUpdates$.next(i));
324
+ }), this._stateUpdates$.next(changedState));
314
325
  }
315
- }
316
- let Z = class extends X {
317
- constructor(e, n) {
326
+ };
327
+ __name(_FindReplaceState, "FindReplaceState");
328
+ let FindReplaceState = _FindReplaceState;
329
+ var _a2;
330
+ let FindReplaceService = (_a2 = class extends Disposable {
331
+ constructor(_injector, _contextService) {
318
332
  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());
328
- this._injector = e, this._contextService = n;
333
+ __publicField(this, "_providers", /* @__PURE__ */ new Set());
334
+ __publicField(this, "_state", new FindReplaceState());
335
+ __publicField(this, "_model");
336
+ __publicField(this, "_currentMatch$", new BehaviorSubject(null));
337
+ __publicField(this, "currentMatch$", this._currentMatch$.asObservable());
338
+ __publicField(this, "_replaceables$", new BehaviorSubject([]));
339
+ __publicField(this, "replaceables$", this._replaceables$.asObservable());
340
+ __publicField(this, "_focusSignal$", new Subject());
341
+ __publicField(this, "focusSignal$", this._focusSignal$.asObservable());
342
+ this._injector = _injector, this._contextService = _contextService;
329
343
  }
330
344
  get stateUpdates$() {
331
345
  return this._state.stateUpdates$;
@@ -346,41 +360,41 @@ let Z = class extends X {
346
360
  return this._providers;
347
361
  }
348
362
  getCurrentMatch() {
349
- var e;
350
- return (e = this._model) == null ? void 0 : e.getCurrentMatch();
363
+ var _a5;
364
+ return (_a5 = this._model) == null ? void 0 : _a5.getCurrentMatch();
351
365
  }
352
366
  getFindString() {
353
367
  return this._state.findString;
354
368
  }
355
- changeFindString(e) {
356
- this._state.changeState({ findString: e });
369
+ changeFindString(findString) {
370
+ this._state.changeState({ findString });
357
371
  }
358
372
  focusFindInput() {
359
373
  this._focusSignal$.next();
360
374
  }
361
- changeInputtingFindString(e) {
362
- e ? this._state.changeState({ inputtingFindString: e }) : this._state.changeState({ inputtingFindString: "", findString: "" });
375
+ changeInputtingFindString(value) {
376
+ value ? this._state.changeState({ inputtingFindString: value }) : this._state.changeState({ inputtingFindString: "", findString: "" });
363
377
  }
364
- changeReplaceString(e) {
365
- this._state.changeState({ replaceString: e });
378
+ changeReplaceString(replaceString) {
379
+ this._state.changeState({ replaceString });
366
380
  }
367
- changeMatchesTheWholeCell(e) {
368
- this._state.changeState({ matchesTheWholeCell: e });
381
+ changeMatchesTheWholeCell(matchesTheWholeCell) {
382
+ this._state.changeState({ matchesTheWholeCell });
369
383
  }
370
- changeCaseSensitive(e) {
371
- this._state.changeState({ caseSensitive: e });
384
+ changeCaseSensitive(caseSensitive) {
385
+ this._state.changeState({ caseSensitive });
372
386
  }
373
- changeFindBy(e) {
374
- this._state.changeState({ findBy: e }), this._toggleDisplayRawFormula(
375
- e === "formula"
387
+ changeFindBy(findBy) {
388
+ this._state.changeState({ findBy }), this._toggleDisplayRawFormula(
389
+ findBy === "formula"
376
390
  /* FORMULA */
377
391
  );
378
392
  }
379
- changeFindScope(e) {
380
- this._state.changeState({ findScope: e });
393
+ changeFindScope(scope) {
394
+ this._state.changeState({ findScope: scope });
381
395
  }
382
- changeFindDirection(e) {
383
- this._state.changeState({ findDirection: e });
396
+ changeFindDirection(direction) {
397
+ this._state.changeState({ findDirection: direction });
384
398
  }
385
399
  moveToNextMatch() {
386
400
  this._model && (this._state.replaceRevealed && !this._model.searched ? (this._state.changeState({ findString: this._state.inputtingFindString }), this._model.start()) : this._model.moveToNextMatch(), this._focusSignal$.next());
@@ -399,524 +413,508 @@ let Z = class extends X {
399
413
  revealReplace() {
400
414
  this._state.changeState({ replaceRevealed: !0, inputtingFindString: this._state.findString }), this._toggleRevealReplace(!0);
401
415
  }
402
- start(e = !1) {
416
+ start(revealReplace = !1) {
403
417
  if (this._providers.size === 0)
404
418
  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
- const n = ne();
407
- return e && (n.replaceRevealed = !0), this._state.changeState(n), this._toggleRevealReplace(e), !0;
419
+ this._model = this._injector.createInstance(FindReplaceModel, this._state, this._providers), this._model.currentMatch$.subscribe((match) => this._currentMatch$.next(match)), this._model.replaceables$.subscribe((replaceables) => this._replaceables$.next(replaceables));
420
+ const newState = createInitFindReplaceState();
421
+ return revealReplace && (newState.replaceRevealed = !0), this._state.changeState(newState), this._toggleRevealReplace(revealReplace), !0;
408
422
  }
409
423
  find() {
410
- var e;
411
- (e = this._model) == null || e.start();
424
+ var _a5;
425
+ (_a5 = this._model) == null || _a5.start();
412
426
  }
413
427
  terminate() {
414
- var e;
415
- (e = this._model) == null || e.dispose(), this._model = null, this._toggleDisplayRawFormula(!1), this._toggleRevealReplace(!1);
428
+ var _a5;
429
+ (_a5 = this._model) == null || _a5.dispose(), this._model = null, this._toggleDisplayRawFormula(!1), this._toggleRevealReplace(!1);
416
430
  }
417
- registerFindReplaceProvider(e) {
418
- return this._providers.add(e), $(() => this._providers.delete(e));
431
+ registerFindReplaceProvider(provider) {
432
+ return this._providers.add(provider), toDisposable(() => this._providers.delete(provider));
419
433
  }
420
- _toggleRevealReplace(e) {
421
- this._contextService.setContextValue(Pe, e);
434
+ _toggleRevealReplace(revealReplace) {
435
+ this._contextService.setContextValue(FIND_REPLACE_REPLACE_REVEALED, revealReplace);
422
436
  }
423
- _toggleDisplayRawFormula(e) {
424
- this._contextService.setContextValue(Ot, e);
437
+ _toggleDisplayRawFormula(force) {
438
+ this._contextService.setContextValue(RENDER_RAW_FORMULA_KEY, force);
425
439
  }
426
- };
427
- Z = Oe([
428
- q(0, F(Q)),
429
- q(1, ee)
430
- ], Z);
431
- const Te = {
440
+ }, __name(_a2, "FindReplaceService"), _a2);
441
+ FindReplaceService = __decorateClass$2([
442
+ __decorateParam$2(0, Inject(Injector)),
443
+ __decorateParam$2(1, IContextService)
444
+ ], FindReplaceService);
445
+ const ReplaceCurrentMatchCommand = {
432
446
  id: "ui.command.replace-current-match",
433
- type: y.COMMAND,
434
- handler: (t) => t.get(m).replace()
435
- }, kt = "CONFIRM_REPLACE_ALL", Ee = {
447
+ type: CommandType.COMMAND,
448
+ handler: /* @__PURE__ */ __name((accessor) => accessor.get(IFindReplaceService).replace(), "handler")
449
+ }, CONFIRM_REPLACE_ALL_ID = "CONFIRM_REPLACE_ALL", ReplaceAllMatchesCommand = {
436
450
  id: "ui.command.replace-all-matches",
437
- type: y.COMMAND,
438
- handler: async (t) => {
439
- const e = t.get(_t), n = t.get(w), i = t.get(Se);
440
- if (!await e.confirm({
441
- id: kt,
442
- title: { title: n.t("find-replace.replace.confirm.title") },
443
- cancelText: n.t("button.cancel"),
444
- confirmText: n.t("button.confirm")
451
+ type: CommandType.COMMAND,
452
+ handler: /* @__PURE__ */ __name(async (accessor) => {
453
+ const confirmService = accessor.get(IConfirmService), localeService = accessor.get(LocaleService), messageService = accessor.get(IMessageService);
454
+ if (!await confirmService.confirm({
455
+ id: CONFIRM_REPLACE_ALL_ID,
456
+ title: { title: localeService.t("find-replace.replace.confirm.title") },
457
+ cancelText: localeService.t("button.cancel"),
458
+ confirmText: localeService.t("button.confirm")
445
459
  }))
446
460
  return !1;
447
- const s = await t.get(m).replaceAll(), { success: a, failure: d } = s;
448
- return d > 0 ? (a === 0 ? i.show({
449
- type: E.Error,
450
- content: n.t("find-replace.replace.all-failure")
451
- }) : i.show({
452
- type: E.Warning,
453
- content: n.t("find-replace.replace.partial-success", `${a}`, `${d}`)
454
- }), !1) : (i.show({
455
- type: E.Success,
456
- content: n.t("find-replace.replace.all-success", `${a}`)
461
+ const result = await accessor.get(IFindReplaceService).replaceAll(), { success, failure } = result;
462
+ return failure > 0 ? (success === 0 ? messageService.show({
463
+ type: MessageType.Error,
464
+ content: localeService.t("find-replace.replace.all-failure")
465
+ }) : messageService.show({
466
+ type: MessageType.Warning,
467
+ content: localeService.t("find-replace.replace.partial-success", `${success}`, `${failure}`)
468
+ }), !1) : (messageService.show({
469
+ type: MessageType.Success,
470
+ content: localeService.t("find-replace.replace.all-success", `${success}`)
457
471
  }), !0);
458
- }
459
- }, O = {
472
+ }, "handler")
473
+ }, OpenFindDialogOperation = {
460
474
  id: "ui.operation.open-find-dialog",
461
- type: y.OPERATION,
462
- handler: (t) => {
463
- const e = t.get(m);
464
- return e.revealed ? e.focusFindInput() : e.start(), !0;
465
- }
466
- }, re = {
475
+ type: CommandType.OPERATION,
476
+ handler: /* @__PURE__ */ __name((accessor) => {
477
+ const findReplaceService = accessor.get(IFindReplaceService);
478
+ return findReplaceService.revealed ? findReplaceService.focusFindInput() : findReplaceService.start(), !0;
479
+ }, "handler")
480
+ }, OpenReplaceDialogOperation = {
467
481
  id: "ui.operation.open-replace-dialog",
468
- type: y.OPERATION,
469
- handler: (t) => {
470
- const e = t.get(m);
471
- return e.revealed ? e.replaceRevealed ? e.focusFindInput() : e.revealReplace() : e.start(!0), !0;
472
- }
473
- }, Ne = {
474
- type: y.OPERATION,
482
+ type: CommandType.OPERATION,
483
+ handler: /* @__PURE__ */ __name((accessor) => {
484
+ const findReplaceService = accessor.get(IFindReplaceService);
485
+ return findReplaceService.revealed ? findReplaceService.replaceRevealed ? findReplaceService.focusFindInput() : findReplaceService.revealReplace() : findReplaceService.start(!0), !0;
486
+ }, "handler")
487
+ }, GoToNextMatchOperation = {
488
+ type: CommandType.OPERATION,
475
489
  id: "ui.operation.go-to-next-match",
476
- handler: (t) => (t.get(m).moveToNextMatch(), !0)
477
- }, $e = {
478
- type: y.OPERATION,
490
+ handler: /* @__PURE__ */ __name((accessor) => (accessor.get(IFindReplaceService).moveToNextMatch(), !0), "handler")
491
+ }, GoToPreviousMatchOperation = {
492
+ type: CommandType.OPERATION,
479
493
  id: "ui.operation.go-to-previous-match",
480
- handler: (t) => (t.get(m).moveToPreviousMatch(), !0)
481
- };
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
494
+ handler: /* @__PURE__ */ __name((accessor) => (accessor.get(IFindReplaceService).moveToPreviousMatch(), !0), "handler")
495
+ }, findReplaceDialogContainer = "univer-find-replace-dialog-container", findReplaceExpandContainer = "univer-find-replace-expand-container", buttonText = "univer-button-text", findReplaceButtonsGroup = "univer-find-replace-buttons-group", findReplaceButtonsGroupRight = "univer-find-replace-buttons-group-right", styles = {
496
+ findReplaceDialogContainer,
497
+ findReplaceExpandContainer,
498
+ buttonText,
499
+ findReplaceButtonsGroup,
500
+ findReplaceButtonsGroupRight
517
501
  };
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,
502
+ function SearchInput(props) {
503
+ const { findCompleted: findComplete, localeService, matchesCount, matchesPosition, findString, findReplaceService, onChange, ...rest } = props, text = findComplete && matchesCount === 0 ? localeService.t("find-replace.dialog.no-result") : matchesCount === 0 ? " " : void 0;
504
+ return /* @__PURE__ */ jsx(
505
+ InputWithSlot,
522
506
  {
523
507
  autoFocus: !0,
524
- placeholder: n.t("find-replace.dialog.find-placeholder"),
525
- slot: /* @__PURE__ */ o.jsx(
526
- Dt,
508
+ placeholder: localeService.t("find-replace.dialog.find-placeholder"),
509
+ slot: /* @__PURE__ */ jsx(
510
+ Pager,
527
511
  {
528
512
  loop: !0,
529
- text: u,
530
- value: r,
531
- total: i,
532
- onChange: (h) => {
533
- r === i && h === 1 ? a.moveToNextMatch() : r === 1 && h === i || h < r ? a.moveToPreviousMatch() : a.moveToNextMatch();
534
- }
513
+ text,
514
+ value: matchesPosition,
515
+ total: matchesCount,
516
+ onChange: /* @__PURE__ */ __name((newIndex) => {
517
+ matchesPosition === matchesCount && newIndex === 1 ? findReplaceService.moveToNextMatch() : matchesPosition === 1 && newIndex === matchesCount || newIndex < matchesPosition ? findReplaceService.moveToPreviousMatch() : findReplaceService.moveToNextMatch();
518
+ }, "onChange")
535
519
  }
536
520
  ),
537
- value: s,
538
- onChange: (h) => d == null ? void 0 : d(h),
539
- ...c
521
+ value: findString,
522
+ onChange: /* @__PURE__ */ __name((value) => onChange == null ? void 0 : onChange(value), "onChange"),
523
+ ...rest
540
524
  }
541
525
  );
542
526
  }
543
- function Le(t, e) {
544
- const n = p(() => {
545
- var r;
546
- (r = document.querySelector(".univer-find-input input")) == null || r.focus();
547
- }, []), i = p(() => {
548
- const r = document.querySelectorAll(".univer-find-replace-dialog-container .univer-select-selection-search-input");
549
- return Array.from(r).some((s) => s === document.activeElement);
527
+ __name(SearchInput, "SearchInput");
528
+ function useFindInputFocus(findReplaceService, ref) {
529
+ const focus = useCallback(() => {
530
+ var _a5;
531
+ (_a5 = document.querySelector(".univer-find-input input")) == null || _a5.focus();
532
+ }, []), selectHasFocus = useCallback(() => {
533
+ const allInputs = document.querySelectorAll(".univer-find-replace-dialog-container .univer-select-selection-search-input");
534
+ return Array.from(allInputs).some((input) => input === document.activeElement);
550
535
  }, []);
551
- return Et(e, () => ({ focus: n, selectHasFocus: i })), A(() => {
552
- const r = t.focusSignal$.subscribe(() => n());
553
- return () => r.unsubscribe();
554
- }, [t, n]), { focus: n, selectHasFocus: i };
536
+ return useImperativeHandle(ref, () => ({ focus, selectHasFocus })), useEffect(() => {
537
+ const subscription = findReplaceService.focusSignal$.subscribe(() => focus());
538
+ return () => subscription.unsubscribe();
539
+ }, [findReplaceService, focus]), { focus, selectHasFocus };
555
540
  }
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(() => {
558
- 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,
541
+ __name(useFindInputFocus, "useFindInputFocus");
542
+ const FindDialog = forwardRef(/* @__PURE__ */ __name(function(_props, ref) {
543
+ const localeService = useDependency(LocaleService), findReplaceService = useDependency(IFindReplaceService), commandService = useDependency(ICommandService), state = useObservable(findReplaceService.state$, void 0, !0), { findCompleted, findString, matchesCount, matchesPosition } = state, revealReplace = useCallback(() => {
544
+ commandService.executeCommand(OpenReplaceDialogOperation.id);
545
+ }, [commandService]), onFindStringChange = useCallback((findString2) => findReplaceService.changeFindString(findString2), [findReplaceService]);
546
+ return useFindInputFocus(findReplaceService, ref), /* @__PURE__ */ jsxs(Fragment, { children: [
547
+ /* @__PURE__ */ jsx(
548
+ SearchInput,
563
549
  {
564
- findCompleted: d,
550
+ findCompleted,
565
551
  className: "univer-find-input",
566
- matchesCount: _,
567
- matchesPosition: u,
568
- findReplaceService: r,
569
- localeService: i,
570
- findString: c,
571
- onChange: R
552
+ matchesCount,
553
+ matchesPosition,
554
+ findReplaceService,
555
+ localeService,
556
+ findString,
557
+ onChange: onFindStringChange
572
558
  }
573
559
  ),
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") }) })
560
+ /* @__PURE__ */ jsx("div", { className: styles.findReplaceExpandContainer, children: /* @__PURE__ */ jsx(Button, { type: "text", size: "small", onClick: revealReplace, children: localeService.t("find-replace.dialog.advanced-finding") }) })
575
561
  ] });
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),
591
- [i]
592
- ), ze = p(
593
- (f) => i.changeReplaceString(f),
594
- [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({
608
- content: r.t("find-replace.dialog.no-match"),
609
- type: E.Warning,
562
+ }, "FindDialogImpl")), ReplaceDialog = forwardRef(/* @__PURE__ */ __name(function(_props, ref) {
563
+ const findReplaceService = useDependency(IFindReplaceService), localeService = useDependency(LocaleService), commandService = useDependency(ICommandService), messageService = useDependency(IMessageService), currentMatch = useObservable(findReplaceService.currentMatch$, void 0, !0), replaceables = useObservable(findReplaceService.replaceables$, void 0, !0), state = useObservable(findReplaceService.state$, void 0, !0), {
564
+ matchesCount,
565
+ matchesPosition,
566
+ findString,
567
+ inputtingFindString,
568
+ replaceString,
569
+ caseSensitive,
570
+ matchesTheWholeCell,
571
+ findDirection,
572
+ findScope,
573
+ findBy,
574
+ findCompleted
575
+ } = state, findDisabled = inputtingFindString.length === 0, replaceDisabled = matchesCount === 0 || !(currentMatch != null && currentMatch.replaceable), replaceAllDisabled = replaceables.length === 0, onFindStringChange = useCallback(
576
+ (newValue) => findReplaceService.changeInputtingFindString(newValue),
577
+ [findReplaceService]
578
+ ), onReplaceStringChange = useCallback(
579
+ (replaceString2) => findReplaceService.changeReplaceString(replaceString2),
580
+ [findReplaceService]
581
+ ), { focus } = useFindInputFocus(findReplaceService, ref), onClickFindButton = useCallback(() => {
582
+ findString === inputtingFindString ? findReplaceService.moveToNextMatch() : (findReplaceService.changeFindString(inputtingFindString), findReplaceService.find());
583
+ }, [findString, inputtingFindString, findReplaceService]), onClickReplaceButton = useCallback(() => commandService.executeCommand(ReplaceCurrentMatchCommand.id), [commandService]), onClickReplaceAllButton = useCallback(async () => {
584
+ await commandService.executeCommand(ReplaceAllMatchesCommand.id), focus();
585
+ }, [commandService]), onChangeFindDirection = useCallback((findDirection2) => {
586
+ findReplaceService.changeFindDirection(findDirection2);
587
+ }, [findReplaceService]), onChangeFindScope = useCallback((findScope2) => {
588
+ findReplaceService.changeFindScope(findScope2);
589
+ }, [findReplaceService]), onChangeFindBy = useCallback((findBy2) => {
590
+ findReplaceService.changeFindBy(findBy2);
591
+ }, [findReplaceService]), findScopeOptions = useFindScopeOptions(localeService), findDirectionOptions = useFindDirectionOptions(localeService), findByOptions = useFindByOptions(localeService);
592
+ return useEffect(() => {
593
+ findCompleted && matchesCount === 0 && messageService.show({
594
+ content: localeService.t("find-replace.dialog.no-match"),
595
+ type: MessageType.Warning,
610
596
  duration: 5e3
611
597
  });
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,
598
+ }, [findCompleted, matchesCount, messageService, localeService]), /* @__PURE__ */ jsxs(Fragment, { children: [
599
+ /* @__PURE__ */ jsx(FormLayout, { label: localeService.t("find-replace.dialog.find"), children: /* @__PURE__ */ jsx(
600
+ SearchInput,
615
601
  {
616
- findCompleted: W,
602
+ findCompleted,
617
603
  className: "univer-find-input",
618
- matchesCount: u,
619
- matchesPosition: h,
620
- findReplaceService: i,
621
- localeService: r,
622
- findString: v,
623
- onChange: Ke
604
+ matchesCount,
605
+ matchesPosition,
606
+ findReplaceService,
607
+ localeService,
608
+ findString: inputtingFindString,
609
+ onChange: onFindStringChange
624
610
  }
625
611
  ) }),
626
- /* @__PURE__ */ o.jsx(M, { label: r.t("find-replace.dialog.replace"), children: /* @__PURE__ */ o.jsx(
627
- Pt,
612
+ /* @__PURE__ */ jsx(FormLayout, { label: localeService.t("find-replace.dialog.replace"), children: /* @__PURE__ */ jsx(
613
+ Input,
628
614
  {
629
- placeholder: r.t("find-replace.dialog.replace-placeholder"),
630
- value: Ue,
631
- onChange: (f) => ze(f)
615
+ placeholder: localeService.t("find-replace.dialog.replace-placeholder"),
616
+ value: replaceString,
617
+ onChange: /* @__PURE__ */ __name((value) => onReplaceStringChange(value), "onChange")
632
618
  }
633
619
  ) }),
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 }) })
620
+ /* @__PURE__ */ jsx(FormLayout, { label: localeService.t("find-replace.dialog.find-direction.title"), children: /* @__PURE__ */ jsx(Select, { value: findDirection, options: findDirectionOptions, onChange: onChangeFindDirection }) }),
621
+ /* @__PURE__ */ jsx(FormDualColumnLayout, { children: /* @__PURE__ */ jsxs(Fragment, { children: [
622
+ /* @__PURE__ */ jsx(FormLayout, { label: localeService.t("find-replace.dialog.find-scope.title"), children: /* @__PURE__ */ jsx(Select, { value: findScope, options: findScopeOptions, onChange: onChangeFindScope }) }),
623
+ /* @__PURE__ */ jsx(FormLayout, { label: localeService.t("find-replace.dialog.find-by.title"), children: /* @__PURE__ */ jsx(Select, { value: findBy, options: findByOptions, onChange: onChangeFindBy }) })
638
624
  ] }) }),
639
- /* @__PURE__ */ o.jsx(ce, { children: /* @__PURE__ */ o.jsxs(o.Fragment, { children: [
640
- /* @__PURE__ */ o.jsx(M, { children: /* @__PURE__ */ o.jsx(
641
- le,
625
+ /* @__PURE__ */ jsx(FormDualColumnLayout, { children: /* @__PURE__ */ jsxs(Fragment, { children: [
626
+ /* @__PURE__ */ jsx(FormLayout, { children: /* @__PURE__ */ jsx(
627
+ Checkbox,
642
628
  {
643
- checked: Be,
644
- onChange: (f) => {
645
- i.changeCaseSensitive(f);
646
- },
647
- children: r.t("find-replace.dialog.case-sensitive")
629
+ checked: caseSensitive,
630
+ onChange: /* @__PURE__ */ __name((checked) => {
631
+ findReplaceService.changeCaseSensitive(checked);
632
+ }, "onChange"),
633
+ children: localeService.t("find-replace.dialog.case-sensitive")
648
634
  }
649
635
  ) }),
650
- /* @__PURE__ */ o.jsx(M, { children: /* @__PURE__ */ o.jsx(
651
- le,
636
+ /* @__PURE__ */ jsx(FormLayout, { children: /* @__PURE__ */ jsx(
637
+ Checkbox,
652
638
  {
653
- checked: We,
654
- onChange: (f) => {
655
- i.changeMatchesTheWholeCell(f);
656
- },
657
- children: r.t("find-replace.dialog.match-the-whole-cell")
639
+ checked: matchesTheWholeCell,
640
+ onChange: /* @__PURE__ */ __name((checked) => {
641
+ findReplaceService.changeMatchesTheWholeCell(checked);
642
+ }, "onChange"),
643
+ children: localeService.t("find-replace.dialog.match-the-whole-cell")
658
644
  }
659
645
  ) })
660
646
  ] }) }),
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") })
647
+ /* @__PURE__ */ jsxs("div", { className: styles.findReplaceButtonsGroup, children: [
648
+ /* @__PURE__ */ jsx(Button, { type: "primary", onClick: onClickFindButton, disabled: findDisabled, children: localeService.t("find-replace.dialog.find") }),
649
+ /* @__PURE__ */ jsxs("span", { className: styles.findReplaceButtonsGroupRight, children: [
650
+ /* @__PURE__ */ jsx(Button, { disabled: replaceDisabled, onClick: onClickReplaceButton, children: localeService.t("find-replace.dialog.replace") }),
651
+ /* @__PURE__ */ jsx(Button, { disabled: replaceAllDisabled, onClick: onClickReplaceAllButton, children: localeService.t("find-replace.dialog.replace-all") })
666
652
  ] })
667
653
  ] })
668
654
  ] });
669
- });
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();
675
- }, [e]);
676
- const s = H(null), a = p(
677
- (c) => n.setContextValue(De, c),
678
- [n]
679
- ), d = p(
680
- (c) => n.setContextValue(Fe, c),
681
- [n]
655
+ }, "ReplaceDIalogImpl"));
656
+ function FindReplaceDialog() {
657
+ const findReplaceService = useDependency(IFindReplaceService), layoutService = useDependency(ILayoutService), contextService = useDependency(IContextService), state = useObservable(findReplaceService.state$, void 0, !0), dialogContainerRef = useRef(null);
658
+ useEffect(() => {
659
+ let disposable;
660
+ return dialogContainerRef.current && (disposable = layoutService.registerContainerElement(dialogContainerRef.current)), () => disposable == null ? void 0 : disposable.dispose();
661
+ }, [layoutService]);
662
+ const focusRef = useRef(null), setDialogContainerFocus = useCallback(
663
+ (focused) => contextService.setContextValue(FIND_REPLACE_DIALOG_FOCUS, focused),
664
+ [contextService]
665
+ ), setDialogInputFocus = useCallback(
666
+ (focused) => contextService.setContextValue(FIND_REPLACE_INPUT_FOCUS, focused),
667
+ [contextService]
682
668
  );
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);
669
+ return useEffect(() => {
670
+ var _a5;
671
+ const focusSubscription = fromEvent(document, "focusin").subscribe((event) => {
672
+ var _a6;
673
+ event.target && ((_a6 = dialogContainerRef.current) != null && _a6.contains(event.target)) ? setDialogContainerFocus(!0) : setDialogContainerFocus(!1), !focusRef.current || !focusRef.current.selectHasFocus() ? setDialogInputFocus(!0) : setDialogInputFocus(!1);
688
674
  });
689
- return (_ = s.current) == null || _.focus(), a(!0), d(!0), () => {
690
- c.unsubscribe(), a(!1);
675
+ return (_a5 = focusRef.current) == null || _a5.focus(), setDialogContainerFocus(!0), setDialogInputFocus(!0), () => {
676
+ focusSubscription.unsubscribe(), setDialogContainerFocus(!1);
691
677
  };
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 }) });
678
+ }, [setDialogContainerFocus, setDialogInputFocus]), /* @__PURE__ */ jsx("div", { className: styles.findReplaceDialogContainer, ref: dialogContainerRef, children: state.replaceRevealed ? /* @__PURE__ */ jsx(ReplaceDialog, { ref: focusRef }) : /* @__PURE__ */ jsx(FindDialog, { ref: focusRef }) });
693
679
  }
694
- function ei(t) {
695
- const e = t.getCurrentLocale();
696
- 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 }
699
- ], [e]);
680
+ __name(FindReplaceDialog, "FindReplaceDialog");
681
+ function useFindScopeOptions(localeService) {
682
+ const locale = localeService.getCurrentLocale();
683
+ return useMemo(() => [
684
+ { label: localeService.t("find-replace.dialog.find-scope.current-sheet"), value: FindScope.SUBUNIT },
685
+ { label: localeService.t("find-replace.dialog.find-scope.workbook"), value: FindScope.UNIT }
686
+ ], [locale]);
700
687
  }
701
- function ti(t) {
702
- const e = t.getCurrentLocale();
703
- 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 }
706
- ], [e]);
688
+ __name(useFindScopeOptions, "useFindScopeOptions");
689
+ function useFindDirectionOptions(localeService) {
690
+ const locale = localeService.getCurrentLocale();
691
+ return useMemo(() => [
692
+ { label: localeService.t("find-replace.dialog.find-direction.row"), value: FindDirection.ROW },
693
+ { label: localeService.t("find-replace.dialog.find-direction.column"), value: FindDirection.COLUMN }
694
+ ], [locale]);
707
695
  }
708
- function ii(t) {
709
- const e = t.getCurrentLocale();
710
- 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 }
713
- ], [e]);
696
+ __name(useFindDirectionOptions, "useFindDirectionOptions");
697
+ function useFindByOptions(localeService) {
698
+ const locale = localeService.getCurrentLocale();
699
+ return useMemo(() => [
700
+ { label: localeService.t("find-replace.dialog.find-by.value"), value: FindBy.VALUE },
701
+ { label: localeService.t("find-replace.dialog.find-by.formula"), value: FindBy.FORMULA }
702
+ ], [locale]);
714
703
  }
715
- function T(t) {
716
- return t.getContextValue(De);
704
+ __name(useFindByOptions, "useFindByOptions");
705
+ function whenFindReplaceDialogFocused(contextService) {
706
+ return contextService.getContextValue(FIND_REPLACE_DIALOG_FOCUS);
717
707
  }
718
- function ni(t) {
719
- return t.getContextValue(Pe);
708
+ __name(whenFindReplaceDialogFocused, "whenFindReplaceDialogFocused");
709
+ function whenReplaceRevealed(contextService) {
710
+ return contextService.getContextValue(FIND_REPLACE_REPLACE_REVEALED);
720
711
  }
721
- function je(t) {
722
- return t.getContextValue(Fe);
712
+ __name(whenReplaceRevealed, "whenReplaceRevealed");
713
+ function whenFindReplaceInputFocused(contextService) {
714
+ return contextService.getContextValue(FIND_REPLACE_INPUT_FOCUS);
723
715
  }
724
- const B = "7_find-replace-shortcuts";
725
- function se(t) {
726
- return t.getContextValue(me);
716
+ __name(whenFindReplaceInputFocused, "whenFindReplaceInputFocused");
717
+ const FIND_REPLACE_SHORTCUT_GROUP = "7_find-replace-shortcuts";
718
+ function whenSheetFocused(contextService) {
719
+ return contextService.getContextValue(FOCUSING_SHEET);
727
720
  }
728
- function ae(t) {
729
- return !t.getContextValue(ve);
721
+ __name(whenSheetFocused, "whenSheetFocused");
722
+ function whenEditorNotActivated(contextService) {
723
+ return !contextService.getContextValue(EDITOR_ACTIVATED);
730
724
  }
731
- const ri = {
732
- id: O.id,
725
+ __name(whenEditorNotActivated, "whenEditorNotActivated");
726
+ const OpenFindDialogShortcutItem = {
727
+ id: OpenFindDialogOperation.id,
733
728
  description: "find-replace.shortcut.open-find-dialog",
734
- binding: b.F | x.CTRL_COMMAND,
735
- group: B,
736
- preconditions(t) {
737
- return !T(t) && se(t) && ae(t);
729
+ binding: KeyCode.F | MetaKeys.CTRL_COMMAND,
730
+ group: FIND_REPLACE_SHORTCUT_GROUP,
731
+ preconditions(contextService) {
732
+ return !whenFindReplaceDialogFocused(contextService) && whenSheetFocused(contextService) && whenEditorNotActivated(contextService);
738
733
  }
739
- }, si = {
740
- id: O.id,
734
+ }, MacOpenFindDialogShortcutItem = {
735
+ id: OpenFindDialogOperation.id,
741
736
  description: "find-replace.shortcut.open-find-dialog",
742
- binding: b.F | x.CTRL_COMMAND,
743
- mac: b.F | x.MAC_CTRL,
744
- preconditions(t) {
745
- return !T(t) && se(t) && ae(t);
737
+ binding: KeyCode.F | MetaKeys.CTRL_COMMAND,
738
+ mac: KeyCode.F | MetaKeys.MAC_CTRL,
739
+ preconditions(contextService) {
740
+ return !whenFindReplaceDialogFocused(contextService) && whenSheetFocused(contextService) && whenEditorNotActivated(contextService);
746
741
  }
747
- }, ai = {
748
- id: re.id,
742
+ }, OpenReplaceDialogShortcutItem = {
743
+ id: OpenReplaceDialogOperation.id,
749
744
  description: "find-replace.shortcut.open-replace-dialog",
750
- binding: b.H | x.CTRL_COMMAND,
751
- mac: b.H | x.MAC_CTRL,
752
- group: B,
753
- preconditions(t) {
754
- return se(t) && ae(t) && (!T(t) || !ni(t));
755
- }
756
- }, oi = {
757
- id: Ne.id,
745
+ binding: KeyCode.H | MetaKeys.CTRL_COMMAND,
746
+ mac: KeyCode.H | MetaKeys.MAC_CTRL,
747
+ group: FIND_REPLACE_SHORTCUT_GROUP,
748
+ preconditions(contextService) {
749
+ return whenSheetFocused(contextService) && whenEditorNotActivated(contextService) && (!whenFindReplaceDialogFocused(contextService) || !whenReplaceRevealed(contextService));
750
+ }
751
+ }, GoToNextFindMatchShortcutItem = {
752
+ id: GoToNextMatchOperation.id,
758
753
  description: "find-replace.shortcut.go-to-next-match",
759
- binding: b.ENTER,
760
- group: B,
754
+ binding: KeyCode.ENTER,
755
+ group: FIND_REPLACE_SHORTCUT_GROUP,
761
756
  priority: 1e3,
762
- preconditions(t) {
763
- return je(t) && T(t);
757
+ preconditions(contextService) {
758
+ return whenFindReplaceInputFocused(contextService) && whenFindReplaceDialogFocused(contextService);
764
759
  }
765
- }, ci = {
766
- id: $e.id,
760
+ }, GoToPreviousFindMatchShortcutItem = {
761
+ id: GoToPreviousMatchOperation.id,
767
762
  description: "find-replace.shortcut.go-to-previous-match",
768
- binding: b.ENTER | x.SHIFT,
769
- group: B,
763
+ binding: KeyCode.ENTER | MetaKeys.SHIFT,
764
+ group: FIND_REPLACE_SHORTCUT_GROUP,
770
765
  priority: 1e3,
771
- preconditions(t) {
772
- return je(t) && T(t);
766
+ preconditions(contextService) {
767
+ return whenFindReplaceInputFocused(contextService) && whenFindReplaceDialogFocused(contextService);
773
768
  }
774
769
  };
775
- function li(t) {
776
- const e = t.get(ee);
770
+ function FindReplaceMenuItemFactory(accessor) {
771
+ const contextService = accessor.get(IContextService);
777
772
  return {
778
- id: O.id,
773
+ id: OpenFindDialogOperation.id,
779
774
  icon: "SearchIcon",
780
775
  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)
786
- ]).pipe(It(([n, i]) => n || !i))
776
+ type: MenuItemType.BUTTON,
777
+ hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.UNIVER_SHEET),
778
+ disabled$: combineLatest([
779
+ contextService.subscribeContextValue$(EDITOR_ACTIVATED),
780
+ contextService.subscribeContextValue$(FOCUSING_SHEET)
781
+ ]).pipe(map(([editorActivated, focusingSheet]) => editorActivated || !focusingSheet))
787
782
  };
788
783
  }
789
- const di = {
790
- [vt.OTHERS]: {
791
- [O.id]: {
784
+ __name(FindReplaceMenuItemFactory, "FindReplaceMenuItemFactory");
785
+ const menuSchema = {
786
+ [RibbonStartGroup.OTHERS]: {
787
+ [OpenFindDialogOperation.id]: {
792
788
  order: 2,
793
- menuItemFactory: li
789
+ menuItemFactory: FindReplaceMenuItemFactory
794
790
  }
795
791
  }
796
792
  };
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--)
799
- (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) {
793
+ var __defProp$1 = Object.defineProperty, __getOwnPropDesc$1 = Object.getOwnPropertyDescriptor, __decorateClass$1 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
794
+ for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$1(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
795
+ (decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
796
+ return kind && result && __defProp$1(target, key, result), result;
797
+ }, "__decorateClass$1"), __decorateParam$1 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$1");
798
+ const FIND_REPLACE_DIALOG_ID = "DESKTOP_FIND_REPLACE_DIALOG", FIND_REPLACE_PANEL_WIDTH = 350, FIND_REPLACE_PANEL_RIGHT_PADDING = 20, FIND_REPLACE_PANEL_TOP_PADDING = -90;
799
+ var _a3;
800
+ let FindReplaceController = (_a3 = class extends RxDisposable {
801
+ constructor(_univerInstanceService, _menuManagerService, _shortcutService, _commandService, _findReplaceService, _dialogService, _layoutService, _localeService, _componentManager, _injector) {
805
802
  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();
803
+ __publicField(this, "_closingListenerDisposable");
804
+ this._univerInstanceService = _univerInstanceService, this._menuManagerService = _menuManagerService, this._shortcutService = _shortcutService, this._commandService = _commandService, this._findReplaceService = _findReplaceService, this._dialogService = _dialogService, this._layoutService = _layoutService, this._localeService = _localeService, this._componentManager = _componentManager, this._injector = _injector, this._initCommands(), this._initUI(), this._initShortcuts();
808
805
  }
809
806
  dispose() {
810
- var e;
811
- super.dispose(), (e = this._closingListenerDisposable) == null || e.dispose(), this._closingListenerDisposable = null;
807
+ var _a5;
808
+ super.dispose(), (_a5 = this._closingListenerDisposable) == null || _a5.dispose(), this._closingListenerDisposable = null;
812
809
  }
813
810
  _initCommands() {
814
811
  [
815
- O,
816
- re,
817
- Ne,
818
- $e,
819
- Ee,
820
- Te
821
- ].forEach((e) => {
822
- this.disposeWithMe(this._commandService.registerCommand(e));
812
+ OpenFindDialogOperation,
813
+ OpenReplaceDialogOperation,
814
+ GoToNextMatchOperation,
815
+ GoToPreviousMatchOperation,
816
+ ReplaceAllMatchesCommand,
817
+ ReplaceCurrentMatchCommand
818
+ ].forEach((c) => {
819
+ this.disposeWithMe(this._commandService.registerCommand(c));
823
820
  });
824
821
  }
825
822
  _initShortcuts() {
826
823
  [
827
- ai,
828
- ri,
829
- si,
830
- ci,
831
- oi
832
- ].forEach((e) => this.disposeWithMe(this._shortcutService.registerShortcut(e)));
824
+ OpenReplaceDialogShortcutItem,
825
+ OpenFindDialogShortcutItem,
826
+ MacOpenFindDialogShortcutItem,
827
+ GoToPreviousFindMatchShortcutItem,
828
+ GoToNextFindMatchShortcutItem
829
+ ].forEach((s) => this.disposeWithMe(this._shortcutService.registerShortcut(s)));
833
830
  }
834
831
  _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) => {
836
- e.revealed === !0 && this._openPanel();
832
+ this.disposeWithMe(this._componentManager.register("FindReplaceDialog", FindReplaceDialog)), this.disposeWithMe(this._componentManager.register("SearchIcon", SearchSingle16)), this._menuManagerService.mergeMenu(menuSchema), this._findReplaceService.stateUpdates$.pipe(takeUntil(this.dispose$)).subscribe((newState) => {
833
+ newState.revealed === !0 && this._openPanel();
837
834
  });
838
835
  }
839
836
  _openPanel() {
840
837
  this._dialogService.open({
841
- id: fe,
838
+ id: FIND_REPLACE_DIALOG_ID,
842
839
  draggable: !0,
843
- width: we,
840
+ width: FIND_REPLACE_PANEL_WIDTH,
844
841
  title: { title: this._localeService.t("find-replace.dialog.title") },
845
842
  children: { label: "FindReplaceDialog" },
846
843
  destroyOnClose: !0,
847
- defaultPosition: gi(),
844
+ defaultPosition: getFindReplaceDialogDefaultPosition(),
848
845
  preservePositionOnDestroy: !0,
849
- onClose: () => this.closePanel()
850
- }), this._closingListenerDisposable = $(this._univerInstanceService.focused$.pipe(oe(this.dispose$)).subscribe((e) => {
851
- (!e || !this._univerInstanceService.getUniverSheetInstance(e)) && this.closePanel();
846
+ onClose: /* @__PURE__ */ __name(() => this.closePanel(), "onClose")
847
+ }), this._closingListenerDisposable = toDisposable(this._univerInstanceService.focused$.pipe(takeUntil(this.dispose$)).subscribe((focused) => {
848
+ (!focused || !this._univerInstanceService.getUniverSheetInstance(focused)) && this.closePanel();
852
849
  }));
853
850
  }
854
851
  closePanel() {
855
- this._closingListenerDisposable && (this._closingListenerDisposable.dispose(), this._closingListenerDisposable = null, this._dialogService.close(fe), this._findReplaceService.terminate(), queueMicrotask(() => this._layoutService.focus()));
856
- }
857
- };
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() {
871
- const { innerWidth: t } = window;
872
- return { x: (t - we) / 2 - pi, y: _i };
852
+ this._closingListenerDisposable && (this._closingListenerDisposable.dispose(), this._closingListenerDisposable = null, this._dialogService.close(FIND_REPLACE_DIALOG_ID), this._findReplaceService.terminate(), queueMicrotask(() => this._layoutService.focus()));
853
+ }
854
+ }, __name(_a3, "FindReplaceController"), _a3);
855
+ FindReplaceController = __decorateClass$1([
856
+ __decorateParam$1(0, IUniverInstanceService),
857
+ __decorateParam$1(1, IMenuManagerService),
858
+ __decorateParam$1(2, IShortcutService),
859
+ __decorateParam$1(3, ICommandService),
860
+ __decorateParam$1(4, IFindReplaceService),
861
+ __decorateParam$1(5, IDialogService),
862
+ __decorateParam$1(6, ILayoutService),
863
+ __decorateParam$1(7, Inject(LocaleService)),
864
+ __decorateParam$1(8, Inject(ComponentManager)),
865
+ __decorateParam$1(9, Inject(Injector))
866
+ ], FindReplaceController);
867
+ function getFindReplaceDialogDefaultPosition() {
868
+ const { innerWidth } = window;
869
+ return { x: (innerWidth - FIND_REPLACE_PANEL_WIDTH) / 2 - FIND_REPLACE_PANEL_RIGHT_PADDING, y: FIND_REPLACE_PANEL_TOP_PADDING };
873
870
  }
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--)
876
- (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 {
882
- constructor(t = de, e, n) {
883
- super(), this._config = t, this._injector = e, this._configService = n;
884
- const { ...i } = ft(
871
+ __name(getFindReplaceDialogDefaultPosition, "getFindReplaceDialogDefaultPosition");
872
+ var __defProp2 = Object.defineProperty, __getOwnPropDesc = Object.getOwnPropertyDescriptor, __decorateClass = /* @__PURE__ */ __name((decorators, target, key, kind) => {
873
+ for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
874
+ (decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
875
+ return kind && result && __defProp2(target, key, result), result;
876
+ }, "__decorateClass"), __decorateParam = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam");
877
+ const PLUGIN_NAME = "UNIVER_FIND_REPLACE_PLUGIN";
878
+ var _a4;
879
+ let UniverFindReplacePlugin = (_a4 = class extends Plugin {
880
+ constructor(_config = defaultPluginConfig, _injector, _configService) {
881
+ super(), this._config = _config, this._injector = _injector, this._configService = _configService;
882
+ const { ...rest } = merge(
885
883
  {},
886
- de,
884
+ defaultPluginConfig,
887
885
  this._config
888
886
  );
889
- this._configService.setConfig(Nt, i);
887
+ this._configService.setConfig(FIND_REPLACE_PLUGIN_CONFIG_KEY, rest);
890
888
  }
891
889
  onStarting() {
892
890
  [
893
- [j],
894
- [m, { useClass: Z }]
895
- ].forEach((t) => this._injector.add(t));
891
+ [FindReplaceController],
892
+ [IFindReplaceService, { useClass: FindReplaceService }]
893
+ ].forEach((d) => this._injector.add(d));
896
894
  }
897
895
  onRendered() {
898
- this._injector.get(j);
896
+ this._injector.get(FindReplaceController);
899
897
  }
900
- }, l(V, "pluginName", Ci), V);
901
- _e = Si([
902
- pe(1, F(Q)),
903
- pe(2, pt)
904
- ], _e);
898
+ }, __name(_a4, "UniverFindReplacePlugin"), __publicField(_a4, "pluginName", PLUGIN_NAME), _a4);
899
+ UniverFindReplacePlugin = __decorateClass([
900
+ __decorateParam(1, Inject(Injector)),
901
+ __decorateParam(2, IConfigService)
902
+ ], UniverFindReplacePlugin);
905
903
  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,
917
- re as OpenReplaceDialogOperation,
918
- Ee as ReplaceAllMatchesCommand,
919
- Te as ReplaceCurrentMatchCommand,
920
- _e as UniverFindReplacePlugin,
921
- ne as createInitFindReplaceState
904
+ FindBy,
905
+ FindDirection,
906
+ FindModel,
907
+ FindReplaceController,
908
+ FindReplaceModel,
909
+ FindReplaceState,
910
+ FindScope,
911
+ GoToNextMatchOperation,
912
+ GoToPreviousMatchOperation,
913
+ IFindReplaceService,
914
+ OpenFindDialogOperation,
915
+ OpenReplaceDialogOperation,
916
+ ReplaceAllMatchesCommand,
917
+ ReplaceCurrentMatchCommand,
918
+ UniverFindReplacePlugin,
919
+ createInitFindReplaceState
922
920
  };