@univerjs/find-replace 0.2.4 → 0.2.6

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