@univerjs/sheets-find-replace 0.3.0-alpha.1 → 0.3.0-nightly.202410101606

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,631 +1 @@
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 { CommandType, IUndoRedoService, ICommandService, Rectangle, OnLifecycle, LifecycleStages, Inject, Injector, ThemeService, Disposable, EDITOR_ACTIVATED, IContextService, IUniverInstanceService, UniverInstanceType, fromCallback, ColorKit, rotate, groupBy, ObjectMatrix, Tools, replaceInDocumentBody, DependentOn, Plugin, IConfigService } from "@univerjs/core";
6
- import { FindReplaceController, IFindReplaceService, FindModel, FindBy, FindScope, FindDirection, UniverFindReplacePlugin } from "@univerjs/find-replace";
7
- import { SetRangeValuesCommand, SheetsSelectionsService, SetWorksheetActiveOperation, SetSelectionsOperation, SetWorksheetActivateCommand, UniverSheetsPlugin } from "@univerjs/sheets";
8
- import { Shape, Rect, IRenderManagerService, RENDER_RAW_FORMULA_KEY } from "@univerjs/engine-render";
9
- import { SheetSkeletonManagerService, getCoordByCell, getSheetObject, ScrollToCellCommand } from "@univerjs/sheets-ui";
10
- import { filter, Subject, throttleTime, merge, skip, debounceTime } from "rxjs";
11
- const _SheetFindReplaceHighlightShape = class _SheetFindReplaceHighlightShape extends Shape {
12
- constructor(key, props) {
13
- super(key, props);
14
- __publicField(this, "_activated", !1);
15
- __publicField(this, "_inHiddenRange", !1);
16
- __publicField(this, "_color");
17
- props && this.setShapeProps(props);
18
- }
19
- setShapeProps(props) {
20
- this._activated = !!props.activated, typeof props.inHiddenRange < "u" && (this._inHiddenRange = props.inHiddenRange), typeof props.color < "u" && (this._color = props.color), this.transformByState({
21
- width: props.width,
22
- height: props.height
23
- });
24
- }
25
- _draw(ctx) {
26
- const activated = this._activated, color = `rgba(${this._color.r}, ${this._color.g}, ${this._color.b}, 0.35)`, borderColor = `rgb(${this._color.r}, ${this._color.g}, ${this._color.b})`;
27
- Rect.drawWith(ctx, {
28
- width: this.width,
29
- height: this.height,
30
- fill: color,
31
- stroke: activated ? borderColor : void 0,
32
- strokeWidth: activated ? 2 : 0,
33
- evented: !1
34
- });
35
- }
36
- };
37
- __name(_SheetFindReplaceHighlightShape, "SheetFindReplaceHighlightShape");
38
- let SheetFindReplaceHighlightShape = _SheetFindReplaceHighlightShape;
39
- const SheetReplaceCommand = {
40
- id: "sheet.command.replace",
41
- type: CommandType.COMMAND,
42
- handler: /* @__PURE__ */ __name(async (accessor, params) => {
43
- const undoRedoService = accessor.get(IUndoRedoService), commandService = accessor.get(ICommandService), { unitId, replacements } = params, disposeBatchingHandler = undoRedoService.__tempBatchingUndoRedo(unitId), results = await Promise.all(replacements.map((replacement) => commandService.executeCommand(SetRangeValuesCommand.id, {
44
- unitId,
45
- subUnitId: replacement.subUnitId,
46
- value: replacement.value
47
- })));
48
- return disposeBatchingHandler.dispose(), getReplaceAllResult(results, replacements);
49
- }, "handler")
50
- };
51
- function getReplaceAllResult(results, replacements) {
52
- let success = 0, failure = 0;
53
- return results.forEach((r, index) => {
54
- const count = replacements[index].count;
55
- r ? success += count : failure += count;
56
- }), { success, failure };
57
- }
58
- __name(getReplaceAllResult, "getReplaceAllResult");
59
- function isSamePosition(range1, range2) {
60
- return range1.startRow === range2.startRow && range1.startColumn === range2.startColumn;
61
- }
62
- __name(isSamePosition, "isSamePosition");
63
- function isBehindPositionWithRowPriority(range1, range2) {
64
- return range1.startRow < range2.startRow || range1.startRow === range2.startRow && range1.startColumn <= range2.startColumn;
65
- }
66
- __name(isBehindPositionWithRowPriority, "isBehindPositionWithRowPriority");
67
- function isBehindPositionWithColumnPriority(range1, range2) {
68
- return range1.startColumn < range2.startColumn || range1.startColumn === range2.startColumn && range1.startRow <= range2.startRow;
69
- }
70
- __name(isBehindPositionWithColumnPriority, "isBehindPositionWithColumnPriority");
71
- function isBeforePositionWithRowPriority(range1, range2) {
72
- return range1.startRow > range2.startRow || range1.startRow === range2.startRow && range1.startColumn >= range2.startColumn;
73
- }
74
- __name(isBeforePositionWithRowPriority, "isBeforePositionWithRowPriority");
75
- function isBeforePositionWithColumnPriority(range1, range2) {
76
- return range1.startColumn > range2.startColumn || range1.startColumn === range2.startColumn && range1.startRow >= range2.startRow;
77
- }
78
- __name(isBeforePositionWithColumnPriority, "isBeforePositionWithColumnPriority");
79
- function isSelectionSingleCell(selection, worksheet) {
80
- const { range } = selection, { startRow, startColumn } = range, hasMergedCell = worksheet.getMergedCell(startRow, startColumn);
81
- return hasMergedCell ? Rectangle.equals(range, hasMergedCell) : range.endRow === range.startRow && range.endColumn === range.startColumn;
82
- }
83
- __name(isSelectionSingleCell, "isSelectionSingleCell");
84
- var __defProp$1 = Object.defineProperty, __getOwnPropDesc$1 = Object.getOwnPropertyDescriptor, __decorateClass$1 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
85
- for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$1(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
86
- (decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
87
- return kind && result && __defProp$1(target, key, result), result;
88
- }, "__decorateClass$1"), __decorateParam$1 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$1"), _a;
89
- let SheetsFindReplaceController = (_a = class extends Disposable {
90
- constructor(_injector, _findReplaceController, _contextService, _findReplaceService, _commandService) {
91
- super();
92
- __publicField(this, "_provider");
93
- this._injector = _injector, this._findReplaceController = _findReplaceController, this._contextService = _contextService, this._findReplaceService = _findReplaceService, this._commandService = _commandService, this._init(), this._initCommands();
94
- }
95
- dispose() {
96
- super.dispose(), this._findReplaceController.closePanel(), this._provider.dispose();
97
- }
98
- _init() {
99
- const provider = this._injector.createInstance(SheetsFindReplaceProvider);
100
- this._provider = provider, this.disposeWithMe(this._findReplaceService.registerFindReplaceProvider(provider)), this.disposeWithMe(this._contextService.subscribeContextValue$(EDITOR_ACTIVATED).pipe(filter((v) => !!v)).subscribe(() => this._findReplaceController.closePanel()));
101
- }
102
- _initCommands() {
103
- [SheetReplaceCommand].forEach((command) => this.disposeWithMe(this._commandService.registerCommand(command)));
104
- }
105
- }, __name(_a, "SheetsFindReplaceController"), _a);
106
- SheetsFindReplaceController = __decorateClass$1([
107
- OnLifecycle(LifecycleStages.Steady, SheetsFindReplaceController),
108
- __decorateParam$1(0, Inject(Injector)),
109
- __decorateParam$1(1, Inject(FindReplaceController)),
110
- __decorateParam$1(2, IContextService),
111
- __decorateParam$1(3, IFindReplaceService),
112
- __decorateParam$1(4, ICommandService)
113
- ], SheetsFindReplaceController);
114
- const SHEETS_FIND_REPLACE_PROVIDER_NAME = "sheets-find-replace-provider", FIND_REPLACE_Z_INDEX = 1e4;
115
- var _a2;
116
- let SheetFindModel = (_a2 = class extends FindModel {
117
- constructor(_workbook, _sheetSkeletonManagerService, _univerInstanceService, _renderManagerService, _commandService, _contextService, _themeService, _selectionManagerService) {
118
- super();
119
- // We can directly inject the `FindReplaceService` here, and call its methods instead of using the observables.
120
- __publicField(this, "_matchesUpdate$", new Subject());
121
- __publicField(this, "matchesUpdate$", this._matchesUpdate$.asObservable());
122
- __publicField(this, "_activelyChangingMatch$", new Subject());
123
- __publicField(this, "activelyChangingMatch$", this._activelyChangingMatch$.asObservable());
124
- /** Hold matches by the worksheet they are in. Make it easier to track the next (or previous) match when searching in the whole workbook. */
125
- __publicField(this, "_matchesByWorksheet", /* @__PURE__ */ new Map());
126
- /** Hold all matches in the currently searching scope. */
127
- __publicField(this, "_matches", []);
128
- /** Position of the current focused ISheetCellMatch, starting from 1. */
129
- __publicField(this, "_matchesPosition", 0);
130
- __publicField(this, "_activeHighlightIndex", -1);
131
- __publicField(this, "_highlightShapes", []);
132
- __publicField(this, "_currentHighlightShape", null);
133
- /** This properties holds the query params during this searching session. */
134
- __publicField(this, "_query", null);
135
- __publicField(this, "_workbookSelections");
136
- this._workbook = _workbook, this._sheetSkeletonManagerService = _sheetSkeletonManagerService, this._univerInstanceService = _univerInstanceService, this._renderManagerService = _renderManagerService, this._commandService = _commandService, this._contextService = _contextService, this._themeService = _themeService, this._workbookSelections = _selectionManagerService.getWorkbookSelections(this.unitId);
137
- }
138
- get _matchesCount() {
139
- return this._matches.length;
140
- }
141
- get unitId() {
142
- return this._workbook.getUnitId();
143
- }
144
- get matchesCount() {
145
- return this._matchesCount;
146
- }
147
- get matchesPosition() {
148
- return this._matchesPosition;
149
- }
150
- get currentMatch() {
151
- return this._matchesPosition > 0 ? this._matches[this._matchesPosition - 1] : null;
152
- }
153
- dispose() {
154
- super.dispose(), this._disposeHighlights(), this._toggleDisplayRawFormula(!1);
155
- }
156
- getMatches() {
157
- return this._matches;
158
- }
159
- start(query) {
160
- switch (this._query = query, query.findBy === FindBy.FORMULA ? this._toggleDisplayRawFormula(!0) : this._toggleDisplayRawFormula(!1), query.findScope) {
161
- case FindScope.UNIT:
162
- this.findInWorkbook(query);
163
- break;
164
- case FindScope.SUBUNIT:
165
- default:
166
- this.findInActiveWorksheet(query);
167
- break;
168
- }
169
- }
170
- _toggleDisplayRawFormula(force) {
171
- this._contextService.setContextValue(RENDER_RAW_FORMULA_KEY, force);
172
- }
173
- /**
174
- * Find all matches in the current workbook no matter which worksheet is activated.
175
- * @param query the query object
176
- * @returns the query complete event
177
- */
178
- findInWorkbook(query) {
179
- const unitId = this._workbook.getUnitId();
180
- let complete, firstSearch = !0;
181
- const findInWorkbook = /* @__PURE__ */ __name(() => {
182
- const allCompletes = this._workbook.getSheets().filter((worksheet) => !worksheet.isSheetHidden()).map((worksheet) => {
183
- const complete2 = this._findInWorksheet(worksheet, query, unitId), sheetId = worksheet.getSheetId(), { results } = complete2;
184
- return results.length ? this._matchesByWorksheet.set(sheetId, complete2.results) : this._matchesByWorksheet.delete(sheetId), complete2;
185
- });
186
- this._matches = allCompletes.map((c) => c.results).flat(), this._updateFindHighlight(), firstSearch ? (complete = { results: this._matches }, firstSearch = !1) : this._matchesUpdate$.next(this._matches);
187
- }, "findInWorkbook");
188
- return this.disposeWithMe(this._sheetSkeletonManagerService.currentSkeleton$.subscribe(() => {
189
- this._updateFindHighlight(), this._updateCurrentHighlightShape(this._activeHighlightIndex);
190
- })), this.disposeWithMe(
191
- fromCallback(this._commandService.onCommandExecuted.bind(this._commandService)).pipe(filter(([command, options]) => command.id === SetWorksheetActiveOperation.id && !(options != null && options.fromFindReplace))).subscribe(() => {
192
- const activeSheet = this._workbook.getActiveSheet();
193
- if (!activeSheet)
194
- return;
195
- const activeSheetId = activeSheet.getSheetId();
196
- this._matchesByWorksheet.has(activeSheetId) && this._findNextMatchOnActiveSheetChange(activeSheet);
197
- })
198
- ), this.disposeWithMe(
199
- fromCallback(this._commandService.onCommandExecuted.bind(this._commandService)).pipe(
200
- filter(
201
- ([command]) => command.type === CommandType.MUTATION && command.params.unitId === this._workbook.getUnitId()
202
- ),
203
- throttleTime(600, void 0, { leading: !1, trailing: !0 })
204
- ).subscribe(() => findInWorkbook())
205
- ), findInWorkbook(), complete;
206
- }
207
- /**
208
- * This method is used in `findInWorkbook`. When the active sheet changes, this method helps to find the next match
209
- * in the new worksheet.
210
- */
211
- _findNextMatchOnActiveSheetChange(activeSheet) {
212
- let match, index, globalIndex = 0;
213
- const matchesByWorksheet = this._matchesByWorksheet.get(activeSheet.getSheetId()), selections = this._workbookSelections.getCurrentSelections();
214
- selections != null && selections.length ? ([match, globalIndex] = this._findNextMatchByRange(matchesByWorksheet, selections[0].range), index = matchesByWorksheet.findIndex((m) => m === match)) : (match = matchesByWorksheet[0], index = 0, globalIndex = this._matches.findIndex((m) => m === match)), this._matchesPosition = globalIndex + 1, this._activelyChangingMatch$.next(match), this._activeHighlightIndex = index, this._updateFindHighlight(), this._updateCurrentHighlightShape(index);
215
- }
216
- /**
217
- * Find all matches (only) in the currently activated worksheet.
218
- * @param query the query object
219
- * @returns the query complete event
220
- */
221
- findInActiveWorksheet(query) {
222
- const unitId = this._workbook.getUnitId(), checkShouldFindInSelections = /* @__PURE__ */ __name(() => {
223
- var _a5;
224
- const currentWorksheet = this._workbook.getActiveSheet();
225
- if (!currentWorksheet) return !1;
226
- const currentSelections = this._workbookSelections.getCurrentSelections();
227
- return (_a5 = currentSelections == null ? void 0 : currentSelections.some((selection) => !isSelectionSingleCell(selection, currentWorksheet))) != null ? _a5 : !1;
228
- }, "checkShouldFindInSelections");
229
- let complete, firstSearch = !0, findBySelections = !1;
230
- const performFindInWorksheet = /* @__PURE__ */ __name(() => {
231
- const currentWorksheet = this._workbook.getActiveSheet();
232
- if (!currentWorksheet) return { results: [] };
233
- const lastMatch = this.currentMatch;
234
- findBySelections = checkShouldFindInSelections();
235
- const currentSelections = this._workbookSelections.getCurrentSelections(), newComplete = findBySelections ? this._findInSelections(currentWorksheet, currentSelections, query, unitId) : this._findInWorksheet(currentWorksheet, query, unitId);
236
- return this._matches = newComplete.results, this._matchesPosition = this._tryRestoreLastMatchesPosition(lastMatch, this._matches), firstSearch ? (complete = newComplete, firstSearch = !1) : this._matchesUpdate$.next(this._matches), this._updateFindHighlight(), newComplete;
237
- }, "performFindInWorksheet");
238
- return this.disposeWithMe(this._sheetSkeletonManagerService.currentSkeleton$.subscribe(() => this._updateFindHighlight())), this.disposeWithMe(
239
- merge(
240
- fromCallback(this._commandService.onCommandExecuted.bind(this._commandService)).pipe(
241
- filter(([command]) => {
242
- if (command.type === CommandType.MUTATION && command.params.unitId === this._workbook.getUnitId())
243
- return !0;
244
- if (command.id === SetSelectionsOperation.id && command.params.unitId === unitId) {
245
- const shouldFindBySelections = checkShouldFindInSelections();
246
- return shouldFindBySelections === !1 && findBySelections === !1 ? !1 : (findBySelections = shouldFindBySelections, !0);
247
- }
248
- return !1;
249
- })
250
- ),
251
- // activeSheet$ is a BehaviorSubject, so we need to skip the first
252
- this._workbook.activeSheet$.pipe(skip(1))
253
- ).pipe(debounceTime(200)).subscribe(() => performFindInWorksheet())
254
- ), performFindInWorksheet(), complete;
255
- }
256
- _findInRange(worksheet, query, range, unitId, dedupeFn) {
257
- const results = [], subUnitId = worksheet.getSheetId(), iter = (query.findDirection === FindDirection.COLUMN ? worksheet.iterateByColumn : worksheet.iterateByRow).bind(worksheet)(range);
258
- for (const value of iter) {
259
- const { row, col, colSpan, rowSpan, value: cellData } = value;
260
- if (dedupeFn != null && dedupeFn(row, col) || !cellData || worksheet.getRowFiltered(row))
261
- continue;
262
- const { hit, replaceable, isFormula } = hitCell(worksheet, row, col, query, cellData);
263
- if (hit) {
264
- const result = {
265
- provider: SHEETS_FIND_REPLACE_PROVIDER_NAME,
266
- unitId,
267
- replaceable,
268
- isFormula,
269
- range: {
270
- subUnitId,
271
- range: {
272
- startRow: row,
273
- startColumn: col,
274
- endColumn: col + (colSpan != null ? colSpan : 1) - 1,
275
- endRow: row + (rowSpan != null ? rowSpan : 1) - 1
276
- }
277
- }
278
- };
279
- results.push(result);
280
- }
281
- }
282
- return { results };
283
- }
284
- _findInSelections(worksheet, selections, query, unitId) {
285
- const { findDirection } = query, sortFn = findDirection === FindDirection.ROW ? isBehindPositionWithRowPriority : isBehindPositionWithColumnPriority, dedupeSet = /* @__PURE__ */ new Set();
286
- return { results: selections.map((selection) => this._findInRange(
287
- worksheet,
288
- query,
289
- selection.range,
290
- unitId,
291
- (row, col) => {
292
- const key = `${row}-${col}`;
293
- return dedupeSet.has(key) ? !0 : (dedupeSet.add(key), !1);
294
- }
295
- ).results).flat().sort((a, b) => sortFn(a.range.range, b.range.range) ? -1 : 1) };
296
- }
297
- /** Find matches in a given worksheet. */
298
- _findInWorksheet(worksheet, query, unitId) {
299
- const rowCount = worksheet.getRowCount(), colCount = worksheet.getColumnCount(), range = { startRow: 0, startColumn: 0, endRow: rowCount - 1, endColumn: colCount - 1 };
300
- return this._findInRange(worksheet, query, range, unitId);
301
- }
302
- _disposeHighlights() {
303
- var _a5;
304
- this._highlightShapes.forEach((shape) => {
305
- var _a6;
306
- (_a6 = shape.getScene()) == null || _a6.makeDirty(), shape.dispose();
307
- }), this._highlightShapes = [], (_a5 = this._currentHighlightShape) == null || _a5.dispose(), this._currentHighlightShape = null;
308
- }
309
- _updateFindHighlight() {
310
- var _a5;
311
- this._disposeHighlights();
312
- const skeleton = (_a5 = this._sheetSkeletonManagerService.getCurrent()) == null ? void 0 : _a5.skeleton;
313
- if (!skeleton)
314
- return;
315
- const unitId = this._workbook.getUnitId(), currentRender = this._renderManagerService.getRenderById(unitId);
316
- if (currentRender == null)
317
- return;
318
- const { scene } = currentRender, matches = this._matches, searchBackgroundColor = this._themeService.getCurrentTheme().gold400, color = new ColorKit(searchBackgroundColor).toRgb(), worksheet = this._workbook.getActiveSheet();
319
- if (!worksheet)
320
- return;
321
- const activeSheetId = worksheet.getSheetId(), highlightShapes = matches.filter((match) => match.range.subUnitId === activeSheetId).map((find, index) => {
322
- const { startColumn, startRow, endColumn, endRow } = find.range.range, startPosition = getCoordByCell(startRow, startColumn, scene, skeleton), endPosition = getCoordByCell(endRow, endColumn, scene, skeleton), { startX, startY } = startPosition, { endX, endY } = endPosition, rowHidden = !worksheet.getRowRawVisible(startRow), columnHidden = !worksheet.getColVisible(startColumn), inHiddenRange = rowHidden || columnHidden, width = columnHidden ? 2 : endX - startX, height = rowHidden ? 2 : endY - startY, props = {
323
- left: startX,
324
- top: startY,
325
- color,
326
- width,
327
- height,
328
- evented: !1,
329
- inHiddenRange,
330
- zIndex: FIND_REPLACE_Z_INDEX
331
- };
332
- return new SheetFindReplaceHighlightShape(`find-highlight-${index}`, props);
333
- });
334
- scene.addObjects(highlightShapes), this._highlightShapes = highlightShapes, scene.makeDirty();
335
- }
336
- _updateCurrentHighlightShape(matchIndex) {
337
- var _a5;
338
- if ((_a5 = this._currentHighlightShape) == null || _a5.setShapeProps({ activated: !1 }), this._currentHighlightShape = null, matchIndex !== void 0) {
339
- const shape = this._highlightShapes[matchIndex];
340
- if (!shape)
341
- return;
342
- this._currentHighlightShape = shape, shape.setShapeProps({ activated: !0 });
343
- }
344
- }
345
- _getSheetObject() {
346
- return getSheetObject(this._univerInstanceService, this._renderManagerService);
347
- }
348
- _focusMatch(match) {
349
- var _a5;
350
- const subUnitId = match.range.subUnitId;
351
- subUnitId !== ((_a5 = this._workbook.getActiveSheet()) == null ? void 0 : _a5.getSheetId()) && this._commandService.executeCommand(
352
- SetWorksheetActivateCommand.id,
353
- { unitId: this._workbook.getUnitId(), subUnitId },
354
- { fromFindReplace: !0 }
355
- ), this._commandService.executeCommand(
356
- ScrollToCellCommand.id,
357
- { range: match.range.range },
358
- { fromFindReplace: !0 }
359
- );
360
- }
361
- _tryRestoreLastMatchesPosition(lastMatch, newMatches) {
362
- if (!lastMatch) return 0;
363
- const { subUnitId: lastSubUnitId } = lastMatch.range, { startColumn: lastStartColumn, startRow: lastStartRow } = lastMatch.range.range, index = newMatches.findIndex((match) => {
364
- if (lastSubUnitId !== match.range.subUnitId)
365
- return !1;
366
- const { startColumn, startRow } = match.range.range;
367
- return startColumn === lastStartColumn && startRow === lastStartRow;
368
- });
369
- return index > -1 ? index + 1 : 0;
370
- }
371
- moveToNextMatch(params) {
372
- var _a5, _b, _c, _d, _e;
373
- if (!this._matches.length)
374
- return null;
375
- const loop = (_a5 = params == null ? void 0 : params.loop) != null ? _a5 : !1, stayIfOnMatch = (_b = params == null ? void 0 : params.stayIfOnMatch) != null ? _b : !1, noFocus = (_c = params == null ? void 0 : params.noFocus) != null ? _c : !1, ignoreSelection = (_d = params == null ? void 0 : params.ignoreSelection) != null ? _d : !1, matchToMove = this._findNextMatch(loop, stayIfOnMatch, ignoreSelection);
376
- if (matchToMove) {
377
- const [match, index] = matchToMove;
378
- return this._matchesPosition = index + 1, this._query.findScope === FindScope.UNIT ? this._activeHighlightIndex = this._matchesByWorksheet.get(match.range.subUnitId).findIndex((m) => m === match) : this._activeHighlightIndex = index, noFocus || this._focusMatch(match), ((_e = this._workbook.getActiveSheet()) == null ? void 0 : _e.getSheetId()) === match.range.subUnitId && this._updateCurrentHighlightShape(this._activeHighlightIndex), match;
379
- }
380
- return this._matchesPosition = 0, this._updateCurrentHighlightShape(), null;
381
- }
382
- moveToPreviousMatch(params) {
383
- var _a5, _b, _c, _d, _e;
384
- if (!this._matches.length)
385
- return null;
386
- const loop = (_a5 = params == null ? void 0 : params.loop) != null ? _a5 : !1, stayIfOnMatch = (_b = params == null ? void 0 : params.stayIfOnMatch) != null ? _b : !1, noFocus = (_c = params == null ? void 0 : params.noFocus) != null ? _c : !1, ignoreSelection = (_d = params == null ? void 0 : params.ignoreSelection) != null ? _d : !1, matchToMove = this._findPreviousMatch(loop, stayIfOnMatch, ignoreSelection);
387
- if (matchToMove) {
388
- const [match, index] = matchToMove;
389
- return this._matchesPosition = index + 1, this._query.findScope === FindScope.UNIT ? this._activeHighlightIndex = this._matchesByWorksheet.get(match.range.subUnitId).findIndex((m) => m === match) : this._activeHighlightIndex = index, noFocus || this._focusMatch(match), ((_e = this._workbook.getActiveSheet()) == null ? void 0 : _e.getSheetId()) === match.range.subUnitId && this._updateCurrentHighlightShape(this._activeHighlightIndex), match;
390
- }
391
- return this._matchesPosition = 0, this._updateCurrentHighlightShape(), null;
392
- }
393
- _findPreviousMatch(loop = !1, stayIfOnMatch = !1, ignoreSelection = !1) {
394
- var _a5;
395
- if (this.currentMatch) {
396
- const currentMatchIndex = this._matches.findIndex((match) => match === this.currentMatch);
397
- if (stayIfOnMatch)
398
- return [this.currentMatch, currentMatchIndex];
399
- const nextMatchIndex = currentMatchIndex - 1;
400
- if (!loop && nextMatchIndex < 0)
401
- return null;
402
- const length = this._matches.length, modded = (nextMatchIndex + length) % length;
403
- return [this._matches[modded], modded];
404
- }
405
- const lastSelection = this._workbookSelections.getCurrentLastSelection();
406
- if (ignoreSelection || !lastSelection) {
407
- const lastIndex = this._matches.length - 1;
408
- return [this._matches[lastIndex], lastIndex];
409
- }
410
- if (this._query.findScope !== FindScope.UNIT)
411
- return this._findPreviousMatchByRange(this._matches, lastSelection.range);
412
- const currentSheetId = (_a5 = this._workbook.getActiveSheet()) == null ? void 0 : _a5.getSheetId();
413
- if (!currentSheetId)
414
- return null;
415
- const worksheetThatHasMatch = this._findPreviousWorksheetThatHasAMatch(currentSheetId, loop);
416
- return worksheetThatHasMatch ? this._findPreviousMatchByRange(this._matchesByWorksheet.get(worksheetThatHasMatch), lastSelection.range) : null;
417
- }
418
- _findNextMatch(loop = !1, stayIfOnMatch = !1, ignoreSelection = !1) {
419
- var _a5;
420
- if (this.currentMatch) {
421
- const currentMatchIndex = this._matches.findIndex((match) => match === this.currentMatch);
422
- if (stayIfOnMatch)
423
- return [this.currentMatch, currentMatchIndex];
424
- const nextMatchIndex = currentMatchIndex + 1, length = this._matches.length;
425
- if (!loop && nextMatchIndex >= length)
426
- return null;
427
- const modded = nextMatchIndex % length;
428
- return [this._matches[modded], modded];
429
- }
430
- const last = this._workbookSelections.getCurrentLastSelection();
431
- if (ignoreSelection || !last)
432
- return [this._matches[0], 0];
433
- if (this._query.findScope !== FindScope.UNIT)
434
- return this._findNextMatchByRange(this._matches, last.range, stayIfOnMatch);
435
- const currentSheetId = (_a5 = this._workbook.getActiveSheet()) == null ? void 0 : _a5.getSheetId();
436
- if (!currentSheetId)
437
- return null;
438
- const worksheetThatHasMatch = this._findNextWorksheetThatHasAMatch(currentSheetId, loop);
439
- return worksheetThatHasMatch ? this._findNextMatchByRange(this._matchesByWorksheet.get(worksheetThatHasMatch), last.range) : null;
440
- }
441
- _findPreviousWorksheetThatHasAMatch(currentWorksheet, loop = !1) {
442
- const rawWorksheetsInOrder = this._workbook.getSheetOrders(), currentSheetIndex = rawWorksheetsInOrder.findIndex((sheet) => sheet === currentWorksheet), first = (loop ? rotate(rawWorksheetsInOrder, currentSheetIndex + 1) : rawWorksheetsInOrder.slice(0, currentSheetIndex + 1)).findLast((worksheet) => this._matchesByWorksheet.has(worksheet));
443
- return first != null ? first : null;
444
- }
445
- _findNextWorksheetThatHasAMatch(currentWorksheet, loop = !1) {
446
- const rawWorksheetsInOrder = this._workbook.getSheetOrders(), currentSheetIndex = rawWorksheetsInOrder.findIndex((sheet) => sheet === currentWorksheet), first = (loop ? rotate(rawWorksheetsInOrder, currentSheetIndex) : rawWorksheetsInOrder.slice(currentSheetIndex)).find((worksheet) => this._matchesByWorksheet.has(worksheet));
447
- return first != null ? first : null;
448
- }
449
- _findNextMatchByRange(matches, range, stayIfOnMatch = !1) {
450
- const findByRow = this._query.findDirection === FindDirection.ROW;
451
- let index = matches.findIndex((match2) => {
452
- const matchRange = match2.range.range;
453
- if (!(findByRow ? isBehindPositionWithRowPriority(range, matchRange) : isBehindPositionWithColumnPriority(range, matchRange)))
454
- return !1;
455
- const isSame = isSamePosition(range, matchRange);
456
- return stayIfOnMatch ? isSame : !isSame;
457
- });
458
- index === -1 && (index = matches.length - 1);
459
- const match = matches[index];
460
- return [match, this._matches.findIndex((m) => m === match)];
461
- }
462
- _findPreviousMatchByRange(matches, range, stayIfOnMatch = !1) {
463
- const findByRow = this._query.findDirection === FindDirection.ROW;
464
- let index = this._matches.findLastIndex((match2) => {
465
- const matchRange = match2.range.range;
466
- if (!(findByRow ? isBeforePositionWithRowPriority(range, matchRange) : isBeforePositionWithColumnPriority(range, matchRange)))
467
- return !1;
468
- const isSame = isSamePosition(range, matchRange);
469
- return stayIfOnMatch ? isSame : !isSame;
470
- });
471
- index === -1 && (index = 0);
472
- const match = matches[index];
473
- return [match, this._matches.findIndex((m) => m === match)];
474
- }
475
- async replace(replaceString) {
476
- if (this._matchesCount === 0 || !this.currentMatch || !this._query || !this.currentMatch.replaceable)
477
- return !1;
478
- const range = this.currentMatch.range, targetWorksheet = this._workbook.getSheetBySheetId(this.currentMatch.range.subUnitId), newContent = this._getReplacedCellData(
479
- this.currentMatch,
480
- targetWorksheet,
481
- this._query.findBy === FindBy.FORMULA,
482
- this._query.findString,
483
- replaceString,
484
- this._query.caseSensitive ? "g" : "ig"
485
- ), params = {
486
- unitId: this.currentMatch.unitId,
487
- subUnitId: range.subUnitId,
488
- value: {
489
- [range.range.startRow]: {
490
- [range.range.startColumn]: newContent
491
- }
492
- }
493
- };
494
- return this._commandService.executeCommand(SetRangeValuesCommand.id, params);
495
- }
496
- async replaceAll(replaceString) {
497
- if (this._matchesCount === 0 || !this._query)
498
- return { success: 0, failure: 0 };
499
- const unitId = this._workbook.getUnitId(), { findString, caseSensitive, findBy } = this._query, shouldReplaceFormula = findBy === FindBy.FORMULA, replaceFlag = caseSensitive ? "g" : "ig", replacements = [];
500
- return groupBy(this._matches.filter((m) => m.replaceable), (match) => match.range.subUnitId).forEach((matches, subUnitId) => {
501
- const matrix = new ObjectMatrix(), worksheet = this._workbook.getSheetBySheetId(subUnitId);
502
- matches.forEach((match) => {
503
- const { startColumn, startRow } = match.range.range, newCellData = this._getReplacedCellData(match, worksheet, shouldReplaceFormula, findString, replaceString, replaceFlag);
504
- newCellData && matrix.setValue(startRow, startColumn, newCellData);
505
- }), replacements.push({
506
- count: matches.length,
507
- subUnitId,
508
- value: matrix.getMatrix()
509
- });
510
- }), replacements ? this._commandService.executeCommand(SheetReplaceCommand.id, {
511
- unitId,
512
- replacements
513
- }) : { success: 0, failure: 0 };
514
- }
515
- _getReplacedCellData(match, worksheet, shouldReplaceFormula, findString, replaceString, replaceFlag) {
516
- var _a5;
517
- const range = match.range.range, { startRow, startColumn } = range, currentContent = worksheet.getCellRaw(startRow, startColumn);
518
- if (match.isFormula)
519
- return shouldReplaceFormula ? { f: currentContent.f.replace(new RegExp(escapeRegExp(findString), replaceFlag), replaceString), v: null } : null;
520
- if (!!((_a5 = currentContent.p) != null && _a5.body)) {
521
- const clonedRichText = Tools.deepClone(currentContent.p);
522
- return replaceInDocumentBody(clonedRichText.body, findString, replaceString), { p: clonedRichText };
523
- }
524
- return { v: currentContent.v.toString().replace(new RegExp(escapeRegExp(findString), replaceFlag), replaceString) };
525
- }
526
- }, __name(_a2, "SheetFindModel"), _a2);
527
- SheetFindModel = __decorateClass$1([
528
- __decorateParam$1(2, IUniverInstanceService),
529
- __decorateParam$1(3, IRenderManagerService),
530
- __decorateParam$1(4, ICommandService),
531
- __decorateParam$1(5, IContextService),
532
- __decorateParam$1(6, Inject(ThemeService)),
533
- __decorateParam$1(7, Inject(SheetsSelectionsService))
534
- ], SheetFindModel);
535
- function escapeRegExp(text) {
536
- return text.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
537
- }
538
- __name(escapeRegExp, "escapeRegExp");
539
- var _a3;
540
- let SheetsFindReplaceProvider = (_a3 = class extends Disposable {
541
- constructor(_univerInstanceService, _renderManagerService, _injector) {
542
- super();
543
- /**
544
- * Hold all find results in this kind of univer business instances (Workbooks).
545
- */
546
- __publicField(this, "_findModelsByUnitId", /* @__PURE__ */ new Map());
547
- this._univerInstanceService = _univerInstanceService, this._renderManagerService = _renderManagerService, this._injector = _injector;
548
- }
549
- async find(query) {
550
- this._terminate();
551
- const allWorkbooks = this._univerInstanceService.getAllUnitsForType(UniverInstanceType.UNIVER_SHEET), parsedQuery = this._preprocessQuery(query);
552
- return allWorkbooks.map((workbook) => {
553
- const skeletonManagerService = this._renderManagerService.getRenderById(workbook.getUnitId()).with(SheetSkeletonManagerService), sheetFind = this._injector.createInstance(SheetFindModel, workbook, skeletonManagerService);
554
- return this._findModelsByUnitId.set(workbook.getUnitId(), sheetFind), sheetFind.start(parsedQuery), sheetFind;
555
- });
556
- }
557
- terminate() {
558
- this._terminate();
559
- }
560
- _terminate() {
561
- this._findModelsByUnitId.forEach((model) => model.dispose()), this._findModelsByUnitId.clear();
562
- }
563
- /**
564
- * Parsed the query object before do actual searching in favor of performance.
565
- * @param query the raw query object
566
- * @returns the parsed query object
567
- */
568
- _preprocessQuery(query) {
569
- let findString = query.caseSensitive ? query.findString : query.findString.toLowerCase();
570
- return findString = findString.trim(), {
571
- ...query,
572
- findString
573
- };
574
- }
575
- }, __name(_a3, "SheetsFindReplaceProvider"), _a3);
576
- SheetsFindReplaceProvider = __decorateClass$1([
577
- __decorateParam$1(0, IUniverInstanceService),
578
- __decorateParam$1(1, IRenderManagerService),
579
- __decorateParam$1(2, Inject(Injector))
580
- ], SheetsFindReplaceProvider);
581
- const VALUE_PASSING_OBJECT = { hit: !1, replaceable: !1, isFormula: !1, rawData: null };
582
- function hitCell(worksheet, row, col, query, cellData) {
583
- const { findBy } = query, findByFormula = findBy === FindBy.FORMULA, rawData = worksheet.getCellRaw(row, col);
584
- return VALUE_PASSING_OBJECT.rawData = rawData, !(rawData != null && rawData.f) ? (VALUE_PASSING_OBJECT.isFormula = !1, matchCellData(cellData, query) ? rawData ? (VALUE_PASSING_OBJECT.hit = !0, VALUE_PASSING_OBJECT.replaceable = !0) : (VALUE_PASSING_OBJECT.hit = !0, VALUE_PASSING_OBJECT.replaceable = !1) : (VALUE_PASSING_OBJECT.hit = !1, VALUE_PASSING_OBJECT.replaceable = !1), VALUE_PASSING_OBJECT) : (VALUE_PASSING_OBJECT.isFormula = !0, findByFormula ? matchCellData({ v: rawData.f }, query) ? (VALUE_PASSING_OBJECT.hit = !0, VALUE_PASSING_OBJECT.replaceable = !0, VALUE_PASSING_OBJECT) : (VALUE_PASSING_OBJECT.hit = !1, VALUE_PASSING_OBJECT.replaceable = !1, VALUE_PASSING_OBJECT) : (VALUE_PASSING_OBJECT.replaceable = !1, matchCellData(cellData, query) ? VALUE_PASSING_OBJECT.hit = !0 : VALUE_PASSING_OBJECT.hit = !1, VALUE_PASSING_OBJECT));
585
- }
586
- __name(hitCell, "hitCell");
587
- function matchCellData(cellData, query) {
588
- let value = extractPureValue(cellData);
589
- return value ? query.matchesTheWholeCell ? (value = trimLeadingTrailingWhitespace(value), query.caseSensitive ? value === query.findString : value.toLowerCase() === query.findString) : query.caseSensitive ? value.indexOf(query.findString) > -1 : value.toLowerCase().indexOf(query.findString) > -1 : !1;
590
- }
591
- __name(matchCellData, "matchCellData");
592
- function extractPureValue(cell) {
593
- var _a5, _b, _c;
594
- const rawValue = (_c = (_b = (_a5 = cell == null ? void 0 : cell.p) == null ? void 0 : _a5.body) == null ? void 0 : _b.dataStream) != null ? _c : cell == null ? void 0 : cell.v;
595
- return typeof rawValue == "number" ? `${rawValue}` : typeof rawValue == "boolean" ? rawValue ? "1" : "0" : rawValue;
596
- }
597
- __name(extractPureValue, "extractPureValue");
598
- function trimLeadingTrailingWhitespace(value) {
599
- return value.replace(/^ +/g, "").replace(/ +$/g, "");
600
- }
601
- __name(trimLeadingTrailingWhitespace, "trimLeadingTrailingWhitespace");
602
- const PLUGIN_CONFIG_KEY = "sheets-find-replace.config", defaultPluginConfig = {};
603
- var __defProp2 = Object.defineProperty, __getOwnPropDesc = Object.getOwnPropertyDescriptor, __defNormalProp2 = /* @__PURE__ */ __name((obj, key, value) => key in obj ? __defProp2(obj, key, { enumerable: !0, configurable: !0, writable: !0, value }) : obj[key] = value, "__defNormalProp"), __decorateClass = /* @__PURE__ */ __name((decorators, target, key, kind) => {
604
- for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
605
- (decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
606
- return kind && result && __defProp2(target, key, result), result;
607
- }, "__decorateClass"), __decorateParam = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam"), __publicField2 = /* @__PURE__ */ __name((obj, key, value) => __defNormalProp2(obj, typeof key != "symbol" ? key + "" : key, value), "__publicField");
608
- const NAME = "SHEET_FIND_REPLACE_PLUGIN";
609
- var _a4;
610
- let UniverSheetsFindReplacePlugin = (_a4 = class extends Plugin {
611
- constructor(_config = defaultPluginConfig, _injector, _configService) {
612
- super(), this._config = _config, this._injector = _injector, this._configService = _configService;
613
- const { ...rest } = this._config;
614
- this._configService.setConfig(PLUGIN_CONFIG_KEY, rest);
615
- }
616
- onStarting() {
617
- [[SheetsFindReplaceController]].forEach((d) => this._injector.add(d));
618
- }
619
- }, __name(_a4, "UniverSheetsFindReplacePlugin"), _a4);
620
- __publicField2(UniverSheetsFindReplacePlugin, "pluginName", NAME);
621
- __publicField2(UniverSheetsFindReplacePlugin, "type", UniverInstanceType.UNIVER_SHEET);
622
- UniverSheetsFindReplacePlugin = __decorateClass([
623
- DependentOn(UniverSheetsPlugin, UniverSheetsPlugin, UniverFindReplacePlugin),
624
- __decorateParam(1, Inject(Injector)),
625
- __decorateParam(2, IConfigService)
626
- ], UniverSheetsFindReplacePlugin);
627
- export {
628
- SheetReplaceCommand,
629
- SheetsFindReplaceController,
630
- UniverSheetsFindReplacePlugin
631
- };
1
+ const _0xf634ac=_0x22eb;(function(_0x5d04a4,_0x2b3229){const _0x2fe413=_0x22eb,_0x157399=_0x5d04a4();while(!![]){try{const _0x3ac7eb=parseInt(_0x2fe413(0x1a3))/0x1*(-parseInt(_0x2fe413(0x135))/0x2)+-parseInt(_0x2fe413(0x1d8))/0x3*(parseInt(_0x2fe413(0x1db))/0x4)+parseInt(_0x2fe413(0x19c))/0x5+parseInt(_0x2fe413(0x170))/0x6*(-parseInt(_0x2fe413(0x186))/0x7)+-parseInt(_0x2fe413(0x173))/0x8*(parseInt(_0x2fe413(0x1ac))/0x9)+-parseInt(_0x2fe413(0x1a6))/0xa+parseInt(_0x2fe413(0x13e))/0xb*(parseInt(_0x2fe413(0x17a))/0xc);if(_0x3ac7eb===_0x2b3229)break;else _0x157399['push'](_0x157399['shift']());}catch(_0x46ac2a){_0x157399['push'](_0x157399['shift']());}}}(_0x34c3,0x4f716));var __defProp=Object['defineProperty'],__defNormalProp=(_0x41683f,_0x18925d,_0xee74d0)=>_0x18925d in _0x41683f?__defProp(_0x41683f,_0x18925d,{'enumerable':!0x0,'configurable':!0x0,'writable':!0x0,'value':_0xee74d0}):_0x41683f[_0x18925d]=_0xee74d0,__name=(_0x34ecec,_0x4e251d)=>__defProp(_0x34ecec,_0xf634ac(0x15b),{'value':_0x4e251d,'configurable':!0x0}),__publicField=(_0x42ba83,_0x48667c,_0x451aed)=>__defNormalProp(_0x42ba83,typeof _0x48667c!=_0xf634ac(0x153)?_0x48667c+'':_0x48667c,_0x451aed);import{CommandType,IUndoRedoService,ICommandService,Rectangle,Inject,Injector,ThemeService,Disposable,EDITOR_ACTIVATED,IContextService,IUniverInstanceService,UniverInstanceType,fromCallback,ColorKit,rotate,groupBy,ObjectMatrix,Tools,replaceInDocumentBody,DependentOn,Plugin,IConfigService}from'@univerjs/core';import{FindReplaceController,IFindReplaceService,FindModel,FindBy,FindScope,FindDirection,UniverFindReplacePlugin}from'@univerjs/find-replace';import{SetRangeValuesCommand,SheetsSelectionsService,SetWorksheetActiveOperation,SetSelectionsOperation,SetWorksheetActivateCommand,UniverSheetsPlugin}from'@univerjs/sheets';import{Shape,Rect,IRenderManagerService,RENDER_RAW_FORMULA_KEY}from'@univerjs/engine-render';import{SheetSkeletonManagerService,getCoordByCell,getSheetObject,ScrollToCellCommand}from'@univerjs/sheets-ui';import{filter,Subject,throttleTime,merge,skip,debounceTime}from'rxjs';const PLUGIN_CONFIG_KEY='sheets-find-replace.config',defaultPluginConfig={},SheetReplaceCommand={'id':_0xf634ac(0x167),'type':CommandType[_0xf634ac(0x1b6)],'handler':__name(async(_0x28fea0,_0x3eb2f9)=>{const _0x568790=_0xf634ac,_0x4f68f0=_0x28fea0[_0x568790(0x148)](IUndoRedoService),_0x2815bb=_0x28fea0[_0x568790(0x148)](ICommandService),{unitId:_0x2f05ec,replacements:_0x461289}=_0x3eb2f9,_0x36bb33=_0x4f68f0[_0x568790(0x19a)](_0x2f05ec),_0x283b52=await Promise[_0x568790(0x1f2)](_0x461289['map'](_0x16c687=>_0x2815bb[_0x568790(0x17e)](SetRangeValuesCommand['id'],{'unitId':_0x2f05ec,'subUnitId':_0x16c687['subUnitId'],'value':_0x16c687[_0x568790(0x1ef)]})));return _0x36bb33[_0x568790(0x1d3)](),getReplaceAllResult(_0x283b52,_0x461289);},'handler')};function getReplaceAllResult(_0x11a7d6,_0x44e345){let _0x18abd5=0x0,_0x165aed=0x0;return _0x11a7d6['forEach']((_0xd8fd3e,_0x5ab2be)=>{const _0x173906=_0x22eb,_0xda557b=_0x44e345[_0x5ab2be][_0x173906(0x134)];_0xd8fd3e?_0x18abd5+=_0xda557b:_0x165aed+=_0xda557b;}),{'success':_0x18abd5,'failure':_0x165aed};}__name(getReplaceAllResult,_0xf634ac(0x191));const _SheetFindReplaceHighlightShape=class _SheetFindReplaceHighlightShape extends Shape{constructor(_0x2238ba,_0x5ce32d){const _0x3161da=_0xf634ac;super(_0x2238ba,_0x5ce32d),__publicField(this,'_activated',!0x1),__publicField(this,_0x3161da(0x12a),!0x1),__publicField(this,_0x3161da(0x136)),_0x5ce32d&&this[_0x3161da(0x130)](_0x5ce32d);}[_0xf634ac(0x130)](_0x26a929){const _0x3e9f2b=_0xf634ac;this[_0x3e9f2b(0x189)]=!!_0x26a929[_0x3e9f2b(0x177)],typeof _0x26a929[_0x3e9f2b(0x132)]<'u'&&(this['_inHiddenRange']=_0x26a929[_0x3e9f2b(0x132)]),typeof _0x26a929[_0x3e9f2b(0x1e9)]<'u'&&(this[_0x3e9f2b(0x136)]=_0x26a929[_0x3e9f2b(0x1e9)]),this['transformByState']({'width':_0x26a929[_0x3e9f2b(0x157)],'height':_0x26a929[_0x3e9f2b(0x195)]});}[_0xf634ac(0x137)](_0x25accc){const _0x3124f0=_0xf634ac,_0x12dfab=this[_0x3124f0(0x189)],_0x33f59c=_0x3124f0(0x12d)+this[_0x3124f0(0x136)]['r']+',\x20'+this[_0x3124f0(0x136)]['g']+',\x20'+this['_color']['b']+_0x3124f0(0x166),_0x18b326='rgb('+this[_0x3124f0(0x136)]['r']+',\x20'+this[_0x3124f0(0x136)]['g']+',\x20'+this[_0x3124f0(0x136)]['b']+')';Rect['drawWith'](_0x25accc,{'width':this['width'],'height':this[_0x3124f0(0x195)],'fill':_0x33f59c,'stroke':_0x12dfab?_0x18b326:void 0x0,'strokeWidth':_0x12dfab?0x2:0x0,'evented':!0x1});}};__name(_SheetFindReplaceHighlightShape,'SheetFindReplaceHighlightShape');let SheetFindReplaceHighlightShape=_SheetFindReplaceHighlightShape;function isSamePosition(_0x50072a,_0x599859){const _0x154a35=_0xf634ac;return _0x50072a[_0x154a35(0x1cd)]===_0x599859[_0x154a35(0x1cd)]&&_0x50072a[_0x154a35(0x131)]===_0x599859[_0x154a35(0x131)];}__name(isSamePosition,_0xf634ac(0x126));function isBehindPositionWithRowPriority(_0x9c228f,_0x438047){const _0x3f26a7=_0xf634ac;return _0x9c228f[_0x3f26a7(0x1cd)]<_0x438047[_0x3f26a7(0x1cd)]||_0x9c228f[_0x3f26a7(0x1cd)]===_0x438047[_0x3f26a7(0x1cd)]&&_0x9c228f[_0x3f26a7(0x131)]<=_0x438047[_0x3f26a7(0x131)];}__name(isBehindPositionWithRowPriority,_0xf634ac(0x15c));function isBehindPositionWithColumnPriority(_0x4caf2f,_0x115a19){const _0x240bc2=_0xf634ac;return _0x4caf2f['startColumn']<_0x115a19[_0x240bc2(0x131)]||_0x4caf2f[_0x240bc2(0x131)]===_0x115a19[_0x240bc2(0x131)]&&_0x4caf2f[_0x240bc2(0x1cd)]<=_0x115a19[_0x240bc2(0x1cd)];}__name(isBehindPositionWithColumnPriority,_0xf634ac(0x1c0));function isBeforePositionWithRowPriority(_0x444340,_0x2e1973){const _0x59036a=_0xf634ac;return _0x444340[_0x59036a(0x1cd)]>_0x2e1973['startRow']||_0x444340['startRow']===_0x2e1973[_0x59036a(0x1cd)]&&_0x444340[_0x59036a(0x131)]>=_0x2e1973[_0x59036a(0x131)];}__name(isBeforePositionWithRowPriority,_0xf634ac(0x1d2));function isBeforePositionWithColumnPriority(_0x5bd686,_0x2b8ff2){const _0x4af8b4=_0xf634ac;return _0x5bd686['startColumn']>_0x2b8ff2[_0x4af8b4(0x131)]||_0x5bd686[_0x4af8b4(0x131)]===_0x2b8ff2[_0x4af8b4(0x131)]&&_0x5bd686['startRow']>=_0x2b8ff2[_0x4af8b4(0x1cd)];}__name(isBeforePositionWithColumnPriority,_0xf634ac(0x1a8));function isSelectionSingleCell(_0x599694,_0x36f438){const _0x564779=_0xf634ac,{range:_0x4e9b36}=_0x599694,{startRow:_0x373df2,startColumn:_0x335bca}=_0x4e9b36,_0x30c85d=_0x36f438[_0x564779(0x1dc)](_0x373df2,_0x335bca);return _0x30c85d?Rectangle[_0x564779(0x16c)](_0x4e9b36,_0x30c85d):_0x4e9b36[_0x564779(0x155)]===_0x4e9b36[_0x564779(0x1cd)]&&_0x4e9b36[_0x564779(0x196)]===_0x4e9b36[_0x564779(0x131)];}__name(isSelectionSingleCell,_0xf634ac(0x181));var __defProp$1=Object['defineProperty'],__getOwnPropDesc$1=Object[_0xf634ac(0x1df)],__decorateClass$1=__name((_0x163835,_0x389b08,_0x4fd793,_0x3f83fa)=>{const _0xdc0a24=_0xf634ac;for(var _0x332862=_0x3f83fa>0x1?void 0x0:_0x3f83fa?__getOwnPropDesc$1(_0x389b08,_0x4fd793):_0x389b08,_0xa8a712=_0x163835[_0xdc0a24(0x16a)]-0x1,_0x5486fb;_0xa8a712>=0x0;_0xa8a712--)(_0x5486fb=_0x163835[_0xa8a712])&&(_0x332862=(_0x3f83fa?_0x5486fb(_0x389b08,_0x4fd793,_0x332862):_0x5486fb(_0x332862))||_0x332862);return _0x3f83fa&&_0x332862&&__defProp$1(_0x389b08,_0x4fd793,_0x332862),_0x332862;},_0xf634ac(0x199)),__decorateParam$1=__name((_0x147be8,_0x4f1a52)=>(_0x557f24,_0x2438c0)=>_0x4f1a52(_0x557f24,_0x2438c0,_0x147be8),_0xf634ac(0x1ab)),_a;function _0x22eb(_0x5ea48f,_0x416cf1){const _0x34c3d5=_0x34c3();return _0x22eb=function(_0x22ebb7,_0x2d443d){_0x22ebb7=_0x22ebb7-0x123;let _0x12d104=_0x34c3d5[_0x22ebb7];return _0x12d104;},_0x22eb(_0x5ea48f,_0x416cf1);}let SheetsFindReplaceController=(_a=class extends Disposable{constructor(_0x5d3c00,_0x2a78d5,_0x43450,_0x4c0b9b,_0x26d4de){const _0x23eb25=_0xf634ac;super(),__publicField(this,_0x23eb25(0x17d)),(this[_0x23eb25(0x1eb)]=_0x5d3c00,this[_0x23eb25(0x175)]=_0x2a78d5,this[_0x23eb25(0x1cf)]=_0x43450,this[_0x23eb25(0x1cb)]=_0x4c0b9b,this[_0x23eb25(0x1a0)]=_0x26d4de,this[_0x23eb25(0x1b5)](),this[_0x23eb25(0x13b)]());}[_0xf634ac(0x1d3)](){const _0x46d540=_0xf634ac;super[_0x46d540(0x1d3)](),this['_findReplaceController'][_0x46d540(0x138)](),this['_provider'][_0x46d540(0x1d3)]();}[_0xf634ac(0x1b5)](){const _0x7c1174=_0xf634ac,_0x106a40=this[_0x7c1174(0x1eb)][_0x7c1174(0x197)](SheetsFindReplaceProvider);this[_0x7c1174(0x17d)]=_0x106a40,this[_0x7c1174(0x162)](this[_0x7c1174(0x1cb)][_0x7c1174(0x1af)](_0x106a40)),this[_0x7c1174(0x162)](this[_0x7c1174(0x1cf)][_0x7c1174(0x1d0)](EDITOR_ACTIVATED)['pipe'](filter(_0x5d5f26=>!!_0x5d5f26))[_0x7c1174(0x123)](()=>this['_findReplaceController'][_0x7c1174(0x138)]()));}[_0xf634ac(0x13b)](){const _0x164ec5=_0xf634ac;[SheetReplaceCommand]['forEach'](_0xe61a85=>this[_0x164ec5(0x162)](this[_0x164ec5(0x1a0)][_0x164ec5(0x147)](_0xe61a85)));}},__name(_a,_0xf634ac(0x14f)),_a);SheetsFindReplaceController=__decorateClass$1([__decorateParam$1(0x0,Inject(Injector)),__decorateParam$1(0x1,Inject(FindReplaceController)),__decorateParam$1(0x2,IContextService),__decorateParam$1(0x3,IFindReplaceService),__decorateParam$1(0x4,ICommandService)],SheetsFindReplaceController);const SHEETS_FIND_REPLACE_PROVIDER_NAME=_0xf634ac(0x1c7),FIND_REPLACE_Z_INDEX=0x2710;var _a2;let SheetFindModel=(_a2=class extends FindModel{constructor(_0x9561c5,_0x1cc93c,_0x553e8,_0x184f6d,_0x40e3aa,_0x4d9f74,_0x290f40,_0x52cc93){const _0x35334e=_0xf634ac;super(),__publicField(this,_0x35334e(0x198),new Subject()),__publicField(this,_0x35334e(0x19b),this[_0x35334e(0x198)][_0x35334e(0x169)]()),__publicField(this,_0x35334e(0x1b0),new Subject()),__publicField(this,_0x35334e(0x1c5),this['_activelyChangingMatch$'][_0x35334e(0x169)]()),__publicField(this,_0x35334e(0x1f0),new Map()),__publicField(this,_0x35334e(0x1c1),[]),__publicField(this,_0x35334e(0x14c),0x0),__publicField(this,'_activeHighlightIndex',-0x1),__publicField(this,_0x35334e(0x1a1),[]),__publicField(this,_0x35334e(0x174),null),__publicField(this,_0x35334e(0x1f1),null),__publicField(this,'_workbookSelections'),(this[_0x35334e(0x18e)]=_0x9561c5,this[_0x35334e(0x143)]=_0x1cc93c,this[_0x35334e(0x1a9)]=_0x553e8,this['_renderManagerService']=_0x184f6d,this[_0x35334e(0x1a0)]=_0x40e3aa,this[_0x35334e(0x1cf)]=_0x4d9f74,this[_0x35334e(0x1ad)]=_0x290f40,this[_0x35334e(0x1b4)]=_0x52cc93[_0x35334e(0x141)](this[_0x35334e(0x15a)]));}get[_0xf634ac(0x125)](){const _0x40ee0e=_0xf634ac;return this[_0x40ee0e(0x1c1)][_0x40ee0e(0x16a)];}get['unitId'](){return this['_workbook']['getUnitId']();}get[_0xf634ac(0x1ed)](){const _0x1f0d1f=_0xf634ac;return this[_0x1f0d1f(0x125)];}get['matchesPosition'](){return this['_matchesPosition'];}get[_0xf634ac(0x15d)](){const _0x516bf8=_0xf634ac;return this[_0x516bf8(0x14c)]>0x0?this[_0x516bf8(0x1c1)][this[_0x516bf8(0x14c)]-0x1]:null;}['dispose'](){const _0x383724=_0xf634ac;super['dispose'](),this[_0x383724(0x1a5)](),this[_0x383724(0x180)](!0x1);}[_0xf634ac(0x16d)](){const _0x3e9ec7=_0xf634ac;return this[_0x3e9ec7(0x1c1)];}[_0xf634ac(0x16f)](_0x27ce70){const _0x4cea18=_0xf634ac;switch(this[_0x4cea18(0x1f1)]=_0x27ce70,_0x27ce70[_0x4cea18(0x149)]===FindBy[_0x4cea18(0x17f)]?this['_toggleDisplayRawFormula'](!0x0):this['_toggleDisplayRawFormula'](!0x1),_0x27ce70[_0x4cea18(0x19e)]){case FindScope[_0x4cea18(0x184)]:this['findInWorkbook'](_0x27ce70);break;case FindScope['SUBUNIT']:default:this[_0x4cea18(0x1f5)](_0x27ce70);break;}}[_0xf634ac(0x180)](_0x554f3d){this['_contextService']['setContextValue'](RENDER_RAW_FORMULA_KEY,_0x554f3d);}[_0xf634ac(0x187)](_0x40f57e){const _0x4a9081=_0xf634ac,_0x3d8cac=this[_0x4a9081(0x18e)][_0x4a9081(0x193)]();let _0x12ba43,_0x5233f8=!0x0;const _0x3dda77=__name(()=>{const _0x28f970=_0x4a9081,_0x93427f=this[_0x28f970(0x18e)]['getSheets']()[_0x28f970(0x1c2)](_0x57cfde=>!_0x57cfde[_0x28f970(0x1d5)]())[_0x28f970(0x165)](_0x18123e=>{const _0x299e22=_0x28f970,_0xa3c9aa=this[_0x299e22(0x1da)](_0x18123e,_0x40f57e,_0x3d8cac),_0x1e6b08=_0x18123e[_0x299e22(0x12f)](),{results:_0x414b88}=_0xa3c9aa;return _0x414b88['length']?this[_0x299e22(0x1f0)][_0x299e22(0x14d)](_0x1e6b08,_0xa3c9aa[_0x299e22(0x1b1)]):this[_0x299e22(0x1f0)][_0x299e22(0x18c)](_0x1e6b08),_0xa3c9aa;});this[_0x28f970(0x1c1)]=_0x93427f[_0x28f970(0x165)](_0x38e923=>_0x38e923['results'])[_0x28f970(0x14a)](),this[_0x28f970(0x146)](),_0x5233f8?(_0x12ba43={'results':this['_matches']},_0x5233f8=!0x1):this[_0x28f970(0x198)][_0x28f970(0x1e1)](this['_matches']);},_0x4a9081(0x187));return this[_0x4a9081(0x162)](this['_sheetSkeletonManagerService'][_0x4a9081(0x1e8)][_0x4a9081(0x123)](()=>{const _0x4aff70=_0x4a9081;this['_updateFindHighlight'](),this[_0x4aff70(0x151)](this['_activeHighlightIndex']);})),this[_0x4a9081(0x162)](fromCallback(this[_0x4a9081(0x1a0)][_0x4a9081(0x15e)][_0x4a9081(0x178)](this[_0x4a9081(0x1a0)]))[_0x4a9081(0x1d9)](filter(([_0x5f196f,_0x1d0759])=>_0x5f196f['id']===SetWorksheetActiveOperation['id']&&!(_0x1d0759!=null&&_0x1d0759[_0x4a9081(0x18f)])))[_0x4a9081(0x123)](()=>{const _0x540de8=_0x4a9081,_0x518325=this[_0x540de8(0x18e)][_0x540de8(0x1bc)]();if(!_0x518325)return;const _0x32d600=_0x518325[_0x540de8(0x12f)]();this['_matchesByWorksheet'][_0x540de8(0x1bb)](_0x32d600)&&this[_0x540de8(0x18a)](_0x518325);})),this[_0x4a9081(0x162)](fromCallback(this[_0x4a9081(0x1a0)][_0x4a9081(0x15e)][_0x4a9081(0x178)](this[_0x4a9081(0x1a0)]))[_0x4a9081(0x1d9)](filter(([_0x428494])=>_0x428494[_0x4a9081(0x139)]===CommandType[_0x4a9081(0x1be)]&&_0x428494[_0x4a9081(0x1c4)][_0x4a9081(0x15a)]===this['_workbook'][_0x4a9081(0x193)]()),throttleTime(0x258,void 0x0,{'leading':!0x1,'trailing':!0x0}))['subscribe'](()=>_0x3dda77())),_0x3dda77(),_0x12ba43;}[_0xf634ac(0x18a)](_0xf0e52){const _0x523f97=_0xf634ac;let _0x1c3d42,_0x2306dc,_0x39650d=0x0;const _0x5081eb=this[_0x523f97(0x1f0)][_0x523f97(0x148)](_0xf0e52['getSheetId']()),_0x4a217f=this['_workbookSelections'][_0x523f97(0x1ea)]();_0x4a217f!=null&&_0x4a217f[_0x523f97(0x16a)]?([_0x1c3d42,_0x39650d]=this[_0x523f97(0x1dd)](_0x5081eb,_0x4a217f[0x0]['range']),_0x2306dc=_0x5081eb[_0x523f97(0x188)](_0x19bdbd=>_0x19bdbd===_0x1c3d42)):(_0x1c3d42=_0x5081eb[0x0],_0x2306dc=0x0,_0x39650d=this[_0x523f97(0x1c1)][_0x523f97(0x188)](_0x3a37db=>_0x3a37db===_0x1c3d42)),this[_0x523f97(0x14c)]=_0x39650d+0x1,this[_0x523f97(0x1b0)][_0x523f97(0x1e1)](_0x1c3d42),this[_0x523f97(0x192)]=_0x2306dc,this[_0x523f97(0x146)](),this[_0x523f97(0x151)](_0x2306dc);}['findInActiveWorksheet'](_0x42ca3c){const _0x520e2c=_0xf634ac,_0x303bac=this['_workbook'][_0x520e2c(0x193)](),_0x5eb21b=__name(()=>{const _0x258f3e=_0x520e2c;var _0x1402e8;const _0x337412=this[_0x258f3e(0x18e)][_0x258f3e(0x1bc)]();if(!_0x337412)return!0x1;const _0x6433f0=this['_workbookSelections'][_0x258f3e(0x1ea)]();return(_0x1402e8=_0x6433f0==null?void 0x0:_0x6433f0['some'](_0xe22876=>!isSelectionSingleCell(_0xe22876,_0x337412)))!=null?_0x1402e8:!0x1;},_0x520e2c(0x1ae));let _0x5b6590,_0x5dffec=!0x0,_0xa2c8e7=!0x1;const _0x4069b3=__name(()=>{const _0x5e7818=_0x520e2c,_0x1aeff4=this[_0x5e7818(0x18e)][_0x5e7818(0x1bc)]();if(!_0x1aeff4)return{'results':[]};const _0x4239a8=this[_0x5e7818(0x15d)];_0xa2c8e7=_0x5eb21b();const _0x471f02=this[_0x5e7818(0x1b4)]['getCurrentSelections'](),_0x1cacca=_0xa2c8e7?this[_0x5e7818(0x1e2)](_0x1aeff4,_0x471f02,_0x42ca3c,_0x303bac):this[_0x5e7818(0x1da)](_0x1aeff4,_0x42ca3c,_0x303bac);return this[_0x5e7818(0x1c1)]=_0x1cacca[_0x5e7818(0x1b1)],this[_0x5e7818(0x14c)]=this[_0x5e7818(0x1e7)](_0x4239a8,this['_matches']),_0x5dffec?(_0x5b6590=_0x1cacca,_0x5dffec=!0x1):this['_matchesUpdate$'][_0x5e7818(0x1e1)](this[_0x5e7818(0x1c1)]),this[_0x5e7818(0x146)](),_0x1cacca;},_0x520e2c(0x127));return this[_0x520e2c(0x162)](this[_0x520e2c(0x143)][_0x520e2c(0x1e8)]['subscribe'](()=>this[_0x520e2c(0x146)]())),this['disposeWithMe'](merge(fromCallback(this[_0x520e2c(0x1a0)][_0x520e2c(0x15e)][_0x520e2c(0x178)](this['_commandService']))[_0x520e2c(0x1d9)](filter(([_0xe87ee9])=>{const _0x1f762f=_0x520e2c;if(_0xe87ee9[_0x1f762f(0x139)]===CommandType[_0x1f762f(0x1be)]&&_0xe87ee9[_0x1f762f(0x1c4)][_0x1f762f(0x15a)]===this[_0x1f762f(0x18e)][_0x1f762f(0x193)]())return!0x0;if(_0xe87ee9['id']===SetSelectionsOperation['id']&&_0xe87ee9[_0x1f762f(0x1c4)][_0x1f762f(0x15a)]===_0x303bac){const _0x2fe636=_0x5eb21b();return _0x2fe636===!0x1&&_0xa2c8e7===!0x1?!0x1:(_0xa2c8e7=_0x2fe636,!0x0);}return!0x1;})),this[_0x520e2c(0x18e)][_0x520e2c(0x1e5)][_0x520e2c(0x1d9)](skip(0x1)))['pipe'](debounceTime(0xc8))['subscribe'](()=>_0x4069b3())),_0x4069b3(),_0x5b6590;}['_findInRange'](_0xe95731,_0x4ad754,_0x3de756,_0x18fe64,_0x54aea8){const _0x55bd3f=_0xf634ac,_0x1c577d=[],_0x333ae8=_0xe95731[_0x55bd3f(0x12f)](),_0x55ea1a=(_0x4ad754[_0x55bd3f(0x1e0)]===FindDirection['COLUMN']?_0xe95731[_0x55bd3f(0x14e)]:_0xe95731[_0x55bd3f(0x13d)])[_0x55bd3f(0x178)](_0xe95731)(_0x3de756);for(const _0x410bf3 of _0x55ea1a){const {row:_0x94922f,col:_0x120d7a,colSpan:_0x45a24c,rowSpan:_0x3c1f07,value:_0x5782c2}=_0x410bf3;if(_0x54aea8!=null&&_0x54aea8(_0x94922f,_0x120d7a)||!_0x5782c2||_0xe95731[_0x55bd3f(0x13f)](_0x94922f))continue;const {hit:_0x5c8757,replaceable:_0x237ece,isFormula:_0x360db2}=hitCell(_0xe95731,_0x94922f,_0x120d7a,_0x4ad754,_0x5782c2);if(_0x5c8757){const _0x25551e={'provider':SHEETS_FIND_REPLACE_PROVIDER_NAME,'unitId':_0x18fe64,'replaceable':_0x237ece,'isFormula':_0x360db2,'range':{'subUnitId':_0x333ae8,'range':{'startRow':_0x94922f,'startColumn':_0x120d7a,'endColumn':_0x120d7a+(_0x45a24c!=null?_0x45a24c:0x1)-0x1,'endRow':_0x94922f+(_0x3c1f07!=null?_0x3c1f07:0x1)-0x1}}};_0x1c577d[_0x55bd3f(0x15f)](_0x25551e);}}return{'results':_0x1c577d};}[_0xf634ac(0x1e2)](_0xffc059,_0x33952b,_0x2ffb3c,_0x443886){const _0x8d244a=_0xf634ac,{findDirection:_0x3321af}=_0x2ffb3c,_0x560017=_0x3321af===FindDirection[_0x8d244a(0x190)]?isBehindPositionWithRowPriority:isBehindPositionWithColumnPriority,_0x16774a=new Set();return{'results':_0x33952b['map'](_0x363947=>this[_0x8d244a(0x1b9)](_0xffc059,_0x2ffb3c,_0x363947[_0x8d244a(0x16b)],_0x443886,(_0x56f7cb,_0x4f03eb)=>{const _0x480704=_0x8d244a,_0x2f1a8e=_0x56f7cb+'-'+_0x4f03eb;return _0x16774a[_0x480704(0x1bb)](_0x2f1a8e)?!0x0:(_0x16774a['add'](_0x2f1a8e),!0x1);})['results'])['flat']()[_0x8d244a(0x176)]((_0x521302,_0x47526e)=>_0x560017(_0x521302[_0x8d244a(0x16b)][_0x8d244a(0x16b)],_0x47526e[_0x8d244a(0x16b)][_0x8d244a(0x16b)])?-0x1:0x1)};}[_0xf634ac(0x1da)](_0x21ed4a,_0x4d3eae,_0x13ac3c){const _0xfc8d68=_0xf634ac,_0x4d2e97=_0x21ed4a['getRowCount'](),_0x4900df=_0x21ed4a[_0xfc8d68(0x160)](),_0x4b6e6d={'startRow':0x0,'startColumn':0x0,'endRow':_0x4d2e97-0x1,'endColumn':_0x4900df-0x1};return this[_0xfc8d68(0x1b9)](_0x21ed4a,_0x4d3eae,_0x4b6e6d,_0x13ac3c);}[_0xf634ac(0x1a5)](){const _0x4ad3dd=_0xf634ac;var _0x28fc60;this['_highlightShapes'][_0x4ad3dd(0x133)](_0x5c0604=>{var _0x4a3a03;(_0x4a3a03=_0x5c0604['getScene']())==null||_0x4a3a03['makeDirty'](),_0x5c0604['dispose']();}),this[_0x4ad3dd(0x1a1)]=[],(_0x28fc60=this[_0x4ad3dd(0x174)])==null||_0x28fc60[_0x4ad3dd(0x1d3)](),this[_0x4ad3dd(0x174)]=null;}[_0xf634ac(0x146)](){const _0x2c9885=_0xf634ac;var _0x275f31;this['_disposeHighlights']();const _0x4db08e=(_0x275f31=this['_sheetSkeletonManagerService']['getCurrent']())==null?void 0x0:_0x275f31[_0x2c9885(0x1bf)];if(!_0x4db08e)return;const _0x2446d2=this[_0x2c9885(0x18e)]['getUnitId'](),_0x4b1213=this[_0x2c9885(0x1b3)][_0x2c9885(0x168)](_0x2446d2);if(_0x4b1213==null)return;const {scene:_0x589311}=_0x4b1213,_0x644916=this[_0x2c9885(0x1c1)],_0x1be309=this[_0x2c9885(0x1ad)]['getCurrentTheme']()[_0x2c9885(0x1b8)],_0x7f37ae=new ColorKit(_0x1be309)['toRgb'](),_0x2d311b=this[_0x2c9885(0x18e)][_0x2c9885(0x1bc)]();if(!_0x2d311b)return;const _0x2840cf=_0x2d311b['getSheetId'](),_0x16473d=_0x644916[_0x2c9885(0x1c2)](_0x4a06f6=>_0x4a06f6[_0x2c9885(0x16b)][_0x2c9885(0x14b)]===_0x2840cf)[_0x2c9885(0x165)]((_0x5f1b51,_0x3f18f9)=>{const _0x2f5583=_0x2c9885,{startColumn:_0x1c62ef,startRow:_0x5385f7,endColumn:_0x5ae8fd,endRow:_0x891ce5}=_0x5f1b51[_0x2f5583(0x16b)]['range'],_0x7d3b80=getCoordByCell(_0x5385f7,_0x1c62ef,_0x589311,_0x4db08e),_0x391186=getCoordByCell(_0x891ce5,_0x5ae8fd,_0x589311,_0x4db08e),{startX:_0x38526e,startY:_0x2cff9a}=_0x7d3b80,{endX:_0x4eb456,endY:_0xdcae96}=_0x391186,_0x201d3b=!_0x2d311b[_0x2f5583(0x1cc)](_0x5385f7),_0x259264=!_0x2d311b[_0x2f5583(0x1e6)](_0x1c62ef),_0x5b8ffe=_0x201d3b||_0x259264,_0x1ce7f2=_0x259264?0x2:_0x4eb456-_0x38526e,_0x3a5a77=_0x201d3b?0x2:_0xdcae96-_0x2cff9a,_0x80fc72={'left':_0x38526e,'top':_0x2cff9a,'color':_0x7f37ae,'width':_0x1ce7f2,'height':_0x3a5a77,'evented':!0x1,'inHiddenRange':_0x5b8ffe,'zIndex':FIND_REPLACE_Z_INDEX};return new SheetFindReplaceHighlightShape(_0x2f5583(0x152)+_0x3f18f9,_0x80fc72);});_0x589311[_0x2c9885(0x142)](_0x16473d),this[_0x2c9885(0x1a1)]=_0x16473d,_0x589311[_0x2c9885(0x1bd)]();}[_0xf634ac(0x151)](_0x138833){const _0x38194d=_0xf634ac;var _0x1976e0;if((_0x1976e0=this[_0x38194d(0x174)])==null||_0x1976e0[_0x38194d(0x130)]({'activated':!0x1}),this[_0x38194d(0x174)]=null,_0x138833!==void 0x0){const _0x5e3c56=this[_0x38194d(0x1a1)][_0x138833];if(!_0x5e3c56)return;this[_0x38194d(0x174)]=_0x5e3c56,_0x5e3c56[_0x38194d(0x130)]({'activated':!0x0});}}['_getSheetObject'](){const _0x34207e=_0xf634ac;return getSheetObject(this[_0x34207e(0x1a9)],this[_0x34207e(0x1b3)]);}['_focusMatch'](_0x124649){const _0x1b9606=_0xf634ac;var _0x5c5054;const _0x31f849=_0x124649[_0x1b9606(0x16b)][_0x1b9606(0x14b)];_0x31f849!==((_0x5c5054=this[_0x1b9606(0x18e)][_0x1b9606(0x1bc)]())==null?void 0x0:_0x5c5054[_0x1b9606(0x12f)]())&&this[_0x1b9606(0x1a0)][_0x1b9606(0x17e)](SetWorksheetActivateCommand['id'],{'unitId':this[_0x1b9606(0x18e)][_0x1b9606(0x193)](),'subUnitId':_0x31f849},{'fromFindReplace':!0x0}),this[_0x1b9606(0x1a0)][_0x1b9606(0x17e)](ScrollToCellCommand['id'],{'range':_0x124649[_0x1b9606(0x16b)]['range']},{'fromFindReplace':!0x0});}[_0xf634ac(0x1e7)](_0x3085d2,_0x54452c){const _0x14b5ba=_0xf634ac;if(!_0x3085d2)return 0x0;const {subUnitId:_0x3eb479}=_0x3085d2[_0x14b5ba(0x16b)],{startColumn:_0x2b91a7,startRow:_0x409a40}=_0x3085d2['range'][_0x14b5ba(0x16b)],_0x4375a9=_0x54452c[_0x14b5ba(0x188)](_0x2a7dab=>{const _0x2ce08e=_0x14b5ba;if(_0x3eb479!==_0x2a7dab['range']['subUnitId'])return!0x1;const {startColumn:_0x4a5cca,startRow:_0x10daaf}=_0x2a7dab[_0x2ce08e(0x16b)][_0x2ce08e(0x16b)];return _0x4a5cca===_0x2b91a7&&_0x10daaf===_0x409a40;});return _0x4375a9>-0x1?_0x4375a9+0x1:0x0;}[_0xf634ac(0x1c9)](_0x483358){const _0x4c04ce=_0xf634ac;var _0xa5e6af,_0x3d9d21,_0x8db4c3,_0x5bef0b,_0x3e19a5;if(!this[_0x4c04ce(0x1c1)][_0x4c04ce(0x16a)])return null;const _0x16b7a4=(_0xa5e6af=_0x483358==null?void 0x0:_0x483358['loop'])!=null?_0xa5e6af:!0x1,_0x10ab72=(_0x3d9d21=_0x483358==null?void 0x0:_0x483358[_0x4c04ce(0x1aa)])!=null?_0x3d9d21:!0x1,_0x1305f7=(_0x8db4c3=_0x483358==null?void 0x0:_0x483358['noFocus'])!=null?_0x8db4c3:!0x1,_0x3fa5a2=(_0x5bef0b=_0x483358==null?void 0x0:_0x483358[_0x4c04ce(0x1a2)])!=null?_0x5bef0b:!0x1,_0x3111d3=this['_findNextMatch'](_0x16b7a4,_0x10ab72,_0x3fa5a2);if(_0x3111d3){const [_0x533a25,_0x5a67de]=_0x3111d3;return this[_0x4c04ce(0x14c)]=_0x5a67de+0x1,this[_0x4c04ce(0x1f1)][_0x4c04ce(0x19e)]===FindScope[_0x4c04ce(0x184)]?this['_activeHighlightIndex']=this[_0x4c04ce(0x1f0)][_0x4c04ce(0x148)](_0x533a25[_0x4c04ce(0x16b)][_0x4c04ce(0x14b)])[_0x4c04ce(0x188)](_0x4e04df=>_0x4e04df===_0x533a25):this[_0x4c04ce(0x192)]=_0x5a67de,_0x1305f7||this['_focusMatch'](_0x533a25),((_0x3e19a5=this[_0x4c04ce(0x18e)][_0x4c04ce(0x1bc)]())==null?void 0x0:_0x3e19a5[_0x4c04ce(0x12f)]())===_0x533a25[_0x4c04ce(0x16b)][_0x4c04ce(0x14b)]&&this['_updateCurrentHighlightShape'](this[_0x4c04ce(0x192)]),_0x533a25;}return this[_0x4c04ce(0x14c)]=0x0,this[_0x4c04ce(0x151)](),null;}[_0xf634ac(0x194)](_0x551623){const _0x2983a9=_0xf634ac;var _0x36003d,_0x6ba6d7,_0x51c5fb,_0x5ba813,_0x5d5b14;if(!this[_0x2983a9(0x1c1)][_0x2983a9(0x16a)])return null;const _0x1dbd7a=(_0x36003d=_0x551623==null?void 0x0:_0x551623['loop'])!=null?_0x36003d:!0x1,_0x2d6df5=(_0x6ba6d7=_0x551623==null?void 0x0:_0x551623['stayIfOnMatch'])!=null?_0x6ba6d7:!0x1,_0xbf19b8=(_0x51c5fb=_0x551623==null?void 0x0:_0x551623[_0x2983a9(0x1c8)])!=null?_0x51c5fb:!0x1,_0x2006af=(_0x5ba813=_0x551623==null?void 0x0:_0x551623[_0x2983a9(0x1a2)])!=null?_0x5ba813:!0x1,_0x45a305=this[_0x2983a9(0x154)](_0x1dbd7a,_0x2d6df5,_0x2006af);if(_0x45a305){const [_0x14e1a7,_0x292bf5]=_0x45a305;return this[_0x2983a9(0x14c)]=_0x292bf5+0x1,this[_0x2983a9(0x1f1)][_0x2983a9(0x19e)]===FindScope['UNIT']?this[_0x2983a9(0x192)]=this[_0x2983a9(0x1f0)][_0x2983a9(0x148)](_0x14e1a7[_0x2983a9(0x16b)][_0x2983a9(0x14b)])[_0x2983a9(0x188)](_0x489790=>_0x489790===_0x14e1a7):this[_0x2983a9(0x192)]=_0x292bf5,_0xbf19b8||this[_0x2983a9(0x159)](_0x14e1a7),((_0x5d5b14=this[_0x2983a9(0x18e)][_0x2983a9(0x1bc)]())==null?void 0x0:_0x5d5b14[_0x2983a9(0x12f)]())===_0x14e1a7[_0x2983a9(0x16b)][_0x2983a9(0x14b)]&&this[_0x2983a9(0x151)](this[_0x2983a9(0x192)]),_0x14e1a7;}return this[_0x2983a9(0x14c)]=0x0,this[_0x2983a9(0x151)](),null;}['_findPreviousMatch'](_0x590a94=!0x1,_0x1568d2=!0x1,_0x3ad20b=!0x1){const _0x3f18d5=_0xf634ac;var _0x19575b;if(this[_0x3f18d5(0x15d)]){const _0x1042a5=this[_0x3f18d5(0x1c1)]['findIndex'](_0x5ee337=>_0x5ee337===this['currentMatch']);if(_0x1568d2)return[this[_0x3f18d5(0x15d)],_0x1042a5];const _0x3d5795=_0x1042a5-0x1;if(!_0x590a94&&_0x3d5795<0x0)return null;const _0x1148df=this[_0x3f18d5(0x1c1)]['length'],_0x46abd7=(_0x3d5795+_0x1148df)%_0x1148df;return[this[_0x3f18d5(0x1c1)][_0x46abd7],_0x46abd7];}const _0x180c98=this['_workbookSelections'][_0x3f18d5(0x1b7)]();if(_0x3ad20b||!_0x180c98){const _0x45db1f=this[_0x3f18d5(0x1c1)][_0x3f18d5(0x16a)]-0x1;return[this[_0x3f18d5(0x1c1)][_0x45db1f],_0x45db1f];}if(this['_query'][_0x3f18d5(0x19e)]!==FindScope[_0x3f18d5(0x184)])return this[_0x3f18d5(0x13c)](this[_0x3f18d5(0x1c1)],_0x180c98[_0x3f18d5(0x16b)]);const _0x2b3ba5=(_0x19575b=this[_0x3f18d5(0x18e)][_0x3f18d5(0x1bc)]())==null?void 0x0:_0x19575b['getSheetId']();if(!_0x2b3ba5)return null;const _0x583928=this[_0x3f18d5(0x171)](_0x2b3ba5,_0x590a94);return _0x583928?this[_0x3f18d5(0x13c)](this['_matchesByWorksheet']['get'](_0x583928),_0x180c98[_0x3f18d5(0x16b)]):null;}['_findNextMatch'](_0x1cf1ff=!0x1,_0x174d69=!0x1,_0x56dcb8=!0x1){const _0x508dee=_0xf634ac;var _0xafd9a8;if(this[_0x508dee(0x15d)]){const _0x1e2702=this[_0x508dee(0x1c1)][_0x508dee(0x188)](_0xa60040=>_0xa60040===this[_0x508dee(0x15d)]);if(_0x174d69)return[this[_0x508dee(0x15d)],_0x1e2702];const _0x3ef2e9=_0x1e2702+0x1,_0x458515=this[_0x508dee(0x1c1)][_0x508dee(0x16a)];if(!_0x1cf1ff&&_0x3ef2e9>=_0x458515)return null;const _0x1e5046=_0x3ef2e9%_0x458515;return[this[_0x508dee(0x1c1)][_0x1e5046],_0x1e5046];}const _0x1b168c=this['_workbookSelections'][_0x508dee(0x1b7)]();if(_0x56dcb8||!_0x1b168c)return[this[_0x508dee(0x1c1)][0x0],0x0];if(this[_0x508dee(0x1f1)]['findScope']!==FindScope[_0x508dee(0x184)])return this[_0x508dee(0x1dd)](this[_0x508dee(0x1c1)],_0x1b168c['range'],_0x174d69);const _0x5f4c58=(_0xafd9a8=this[_0x508dee(0x18e)][_0x508dee(0x1bc)]())==null?void 0x0:_0xafd9a8[_0x508dee(0x12f)]();if(!_0x5f4c58)return null;const _0x383add=this[_0x508dee(0x1ec)](_0x5f4c58,_0x1cf1ff);return _0x383add?this[_0x508dee(0x1dd)](this[_0x508dee(0x1f0)]['get'](_0x383add),_0x1b168c[_0x508dee(0x16b)]):null;}[_0xf634ac(0x171)](_0x369746,_0x1bb51e=!0x1){const _0x45bc16=_0xf634ac,_0x455fce=this[_0x45bc16(0x18e)][_0x45bc16(0x150)](),_0x30ee29=_0x455fce['findIndex'](_0x1e48e9=>_0x1e48e9===_0x369746),_0x5e4bed=(_0x1bb51e?rotate(_0x455fce,_0x30ee29+0x1):_0x455fce[_0x45bc16(0x1f4)](0x0,_0x30ee29+0x1))[_0x45bc16(0x1ee)](_0x4180b7=>this[_0x45bc16(0x1f0)][_0x45bc16(0x1bb)](_0x4180b7));return _0x5e4bed!=null?_0x5e4bed:null;}['_findNextWorksheetThatHasAMatch'](_0x4ddbdf,_0x1a7d54=!0x1){const _0x4cf970=_0xf634ac,_0x1469f2=this[_0x4cf970(0x18e)][_0x4cf970(0x150)](),_0x525e0e=_0x1469f2[_0x4cf970(0x188)](_0x54ae2c=>_0x54ae2c===_0x4ddbdf),_0x2c7965=(_0x1a7d54?rotate(_0x1469f2,_0x525e0e):_0x1469f2[_0x4cf970(0x1f4)](_0x525e0e))[_0x4cf970(0x129)](_0x5da01c=>this[_0x4cf970(0x1f0)][_0x4cf970(0x1bb)](_0x5da01c));return _0x2c7965!=null?_0x2c7965:null;}[_0xf634ac(0x1dd)](_0x260512,_0x120357,_0x42c387=!0x1){const _0x5da3fa=_0xf634ac,_0x4401a5=this[_0x5da3fa(0x1f1)][_0x5da3fa(0x1e0)]===FindDirection['ROW'];let _0x2de058=_0x260512[_0x5da3fa(0x188)](_0x4794be=>{const _0x87166b=_0x5da3fa,_0x3a3c32=_0x4794be[_0x87166b(0x16b)][_0x87166b(0x16b)];if(!(_0x4401a5?isBehindPositionWithRowPriority(_0x120357,_0x3a3c32):isBehindPositionWithColumnPriority(_0x120357,_0x3a3c32)))return!0x1;const _0x4af785=isSamePosition(_0x120357,_0x3a3c32);return _0x42c387?_0x4af785:!_0x4af785;});_0x2de058===-0x1&&(_0x2de058=_0x260512[_0x5da3fa(0x16a)]-0x1);const _0x9e894e=_0x260512[_0x2de058];return[_0x9e894e,this['_matches'][_0x5da3fa(0x188)](_0x54a5e2=>_0x54a5e2===_0x9e894e)];}[_0xf634ac(0x13c)](_0x5eda7c,_0x38e7a8,_0x3f8d03=!0x1){const _0x398cb8=_0xf634ac,_0x122d4e=this[_0x398cb8(0x1f1)][_0x398cb8(0x1e0)]===FindDirection[_0x398cb8(0x190)];let _0x2957f8=this[_0x398cb8(0x1c1)][_0x398cb8(0x19f)](_0x5272c0=>{const _0x3c8209=_0x398cb8,_0x30841c=_0x5272c0[_0x3c8209(0x16b)][_0x3c8209(0x16b)];if(!(_0x122d4e?isBeforePositionWithRowPriority(_0x38e7a8,_0x30841c):isBeforePositionWithColumnPriority(_0x38e7a8,_0x30841c)))return!0x1;const _0x1e497b=isSamePosition(_0x38e7a8,_0x30841c);return _0x3f8d03?_0x1e497b:!_0x1e497b;});_0x2957f8===-0x1&&(_0x2957f8=0x0);const _0x53e7f3=_0x5eda7c[_0x2957f8];return[_0x53e7f3,this[_0x398cb8(0x1c1)][_0x398cb8(0x188)](_0x31a907=>_0x31a907===_0x53e7f3)];}async[_0xf634ac(0x19d)](_0x27629a){const _0x309076=_0xf634ac;if(this['_matchesCount']===0x0||!this[_0x309076(0x15d)]||!this[_0x309076(0x1f1)]||!this['currentMatch']['replaceable'])return!0x1;const _0x2d65e6=this[_0x309076(0x15d)][_0x309076(0x16b)],_0x17aba7=this[_0x309076(0x18e)][_0x309076(0x140)](this[_0x309076(0x15d)][_0x309076(0x16b)][_0x309076(0x14b)]),_0x3128d2=this[_0x309076(0x1f3)](this['currentMatch'],_0x17aba7,this[_0x309076(0x1f1)][_0x309076(0x149)]===FindBy[_0x309076(0x17f)],this[_0x309076(0x1f1)][_0x309076(0x1de)],_0x27629a,this[_0x309076(0x1f1)][_0x309076(0x1c6)]?'g':'ig'),_0x33e06b={'unitId':this[_0x309076(0x15d)][_0x309076(0x15a)],'subUnitId':_0x2d65e6[_0x309076(0x14b)],'value':{[_0x2d65e6[_0x309076(0x16b)]['startRow']]:{[_0x2d65e6[_0x309076(0x16b)]['startColumn']]:_0x3128d2}}};return this[_0x309076(0x1a0)][_0x309076(0x17e)](SetRangeValuesCommand['id'],_0x33e06b);}async['replaceAll'](_0x2b72b6){const _0x507b9e=_0xf634ac;if(this[_0x507b9e(0x125)]===0x0||!this['_query'])return{'success':0x0,'failure':0x0};const _0x267b51=this[_0x507b9e(0x18e)][_0x507b9e(0x193)](),{findString:_0x187c07,caseSensitive:_0x2137da,findBy:_0x477098}=this[_0x507b9e(0x1f1)],_0x8fbaae=_0x477098===FindBy[_0x507b9e(0x17f)],_0x1b2404=_0x2137da?'g':'ig',_0x39bf65=[];return groupBy(this[_0x507b9e(0x1c1)][_0x507b9e(0x1c2)](_0x12fc43=>_0x12fc43[_0x507b9e(0x179)]),_0x1a3668=>_0x1a3668[_0x507b9e(0x16b)][_0x507b9e(0x14b)])[_0x507b9e(0x133)]((_0x378778,_0x13bccb)=>{const _0x5af1ed=_0x507b9e,_0x33242c=new ObjectMatrix(),_0x57b421=this[_0x5af1ed(0x18e)][_0x5af1ed(0x140)](_0x13bccb);_0x378778[_0x5af1ed(0x133)](_0x5d2ac8=>{const _0x9fb652=_0x5af1ed,{startColumn:_0x85ad5e,startRow:_0x3e46ef}=_0x5d2ac8[_0x9fb652(0x16b)][_0x9fb652(0x16b)],_0x50f4fa=this['_getReplacedCellData'](_0x5d2ac8,_0x57b421,_0x8fbaae,_0x187c07,_0x2b72b6,_0x1b2404);_0x50f4fa&&_0x33242c[_0x9fb652(0x1ca)](_0x3e46ef,_0x85ad5e,_0x50f4fa);}),_0x39bf65[_0x5af1ed(0x15f)]({'count':_0x378778[_0x5af1ed(0x16a)],'subUnitId':_0x13bccb,'value':_0x33242c['getMatrix']()});}),_0x39bf65?this[_0x507b9e(0x1a0)][_0x507b9e(0x17e)](SheetReplaceCommand['id'],{'unitId':_0x267b51,'replacements':_0x39bf65}):{'success':0x0,'failure':0x0};}[_0xf634ac(0x1f3)](_0x4774a2,_0x3841f4,_0x4e1ce1,_0x48bfe1,_0x963e91,_0x5d65ca){const _0x38f1de=_0xf634ac;var _0x45d9a8;const _0xdfe320=_0x4774a2[_0x38f1de(0x16b)][_0x38f1de(0x16b)],{startRow:_0x163cb9,startColumn:_0x3f0c31}=_0xdfe320,_0x2dc0be=_0x3841f4['getCellRaw'](_0x163cb9,_0x3f0c31);if(_0x4774a2[_0x38f1de(0x17c)])return _0x4e1ce1?{'f':_0x2dc0be['f'][_0x38f1de(0x19d)](new RegExp(escapeRegExp(_0x48bfe1),_0x5d65ca),_0x963e91),'v':null}:null;if(!!((_0x45d9a8=_0x2dc0be['p'])!=null&&_0x45d9a8[_0x38f1de(0x163)])){const _0x299591=Tools[_0x38f1de(0x12e)](_0x2dc0be['p']);return replaceInDocumentBody(_0x299591['body'],_0x48bfe1,_0x963e91),{'p':_0x299591};}return{'v':_0x2dc0be['v'][_0x38f1de(0x1d7)]()[_0x38f1de(0x19d)](new RegExp(escapeRegExp(_0x48bfe1),_0x5d65ca),_0x963e91)};}},__name(_a2,_0xf634ac(0x1b2)),_a2);SheetFindModel=__decorateClass$1([__decorateParam$1(0x2,IUniverInstanceService),__decorateParam$1(0x3,IRenderManagerService),__decorateParam$1(0x4,ICommandService),__decorateParam$1(0x5,IContextService),__decorateParam$1(0x6,Inject(ThemeService)),__decorateParam$1(0x7,Inject(SheetsSelectionsService))],SheetFindModel);function escapeRegExp(_0x66086){const _0x1d4557=_0xf634ac;return _0x66086[_0x1d4557(0x19d)](/[-[\]{}()*+?.,\\^$|#\s]/g,_0x1d4557(0x158));}__name(escapeRegExp,'escapeRegExp');var _a3;let SheetsFindReplaceProvider=(_a3=class extends Disposable{constructor(_0x3d9a27,_0x179b0b,_0x9a915f){const _0x1336be=_0xf634ac;super(),__publicField(this,_0x1336be(0x1d4),new Map()),(this['_univerInstanceService']=_0x3d9a27,this[_0x1336be(0x1b3)]=_0x179b0b,this[_0x1336be(0x1eb)]=_0x9a915f);}async[_0xf634ac(0x129)](_0xb8d737){const _0x9496cb=_0xf634ac;this['_terminate']();const _0x561fec=this[_0x9496cb(0x1a9)]['getAllUnitsForType'](UniverInstanceType[_0x9496cb(0x161)]),_0x30d397=this[_0x9496cb(0x1c3)](_0xb8d737);return _0x561fec['map'](_0x21dc5e=>{const _0x5f4289=_0x9496cb,_0x53fac7=this['_renderManagerService']['getRenderById'](_0x21dc5e['getUnitId']())[_0x5f4289(0x183)](SheetSkeletonManagerService),_0x53d9ae=this['_injector'][_0x5f4289(0x197)](SheetFindModel,_0x21dc5e,_0x53fac7);return this[_0x5f4289(0x1d4)]['set'](_0x21dc5e[_0x5f4289(0x193)](),_0x53d9ae),_0x53d9ae[_0x5f4289(0x16f)](_0x30d397),_0x53d9ae;});}[_0xf634ac(0x18b)](){const _0x2419dd=_0xf634ac;this[_0x2419dd(0x145)]();}[_0xf634ac(0x145)](){const _0x523015=_0xf634ac;this[_0x523015(0x1d4)][_0x523015(0x133)](_0x311b1d=>_0x311b1d[_0x523015(0x1d3)]()),this[_0x523015(0x1d4)]['clear']();}[_0xf634ac(0x1c3)](_0x480c95){const _0x48aaff=_0xf634ac;let _0x277e6a=_0x480c95[_0x48aaff(0x1c6)]?_0x480c95[_0x48aaff(0x1de)]:_0x480c95['findString']['toLowerCase']();return _0x277e6a=_0x277e6a['trim'](),{..._0x480c95,'findString':_0x277e6a};}},__name(_a3,_0xf634ac(0x1d1)),_a3);SheetsFindReplaceProvider=__decorateClass$1([__decorateParam$1(0x0,IUniverInstanceService),__decorateParam$1(0x1,IRenderManagerService),__decorateParam$1(0x2,Inject(Injector))],SheetsFindReplaceProvider);const VALUE_PASSING_OBJECT={'hit':!0x1,'replaceable':!0x1,'isFormula':!0x1,'rawData':null};function hitCell(_0x567c12,_0x178e72,_0x5db60,_0x2d1501,_0x28cc00){const _0x19e9af=_0xf634ac,{findBy:_0x5827d9}=_0x2d1501,_0x3c00fc=_0x5827d9===FindBy[_0x19e9af(0x17f)],_0x11451c=_0x567c12[_0x19e9af(0x1e3)](_0x178e72,_0x5db60);return VALUE_PASSING_OBJECT['rawData']=_0x11451c,!(_0x11451c!=null&&_0x11451c['f'])?(VALUE_PASSING_OBJECT['isFormula']=!0x1,matchCellData(_0x28cc00,_0x2d1501)?_0x11451c?(VALUE_PASSING_OBJECT[_0x19e9af(0x1ce)]=!0x0,VALUE_PASSING_OBJECT[_0x19e9af(0x179)]=!0x0):(VALUE_PASSING_OBJECT[_0x19e9af(0x1ce)]=!0x0,VALUE_PASSING_OBJECT[_0x19e9af(0x179)]=!0x1):(VALUE_PASSING_OBJECT[_0x19e9af(0x1ce)]=!0x1,VALUE_PASSING_OBJECT['replaceable']=!0x1),VALUE_PASSING_OBJECT):(VALUE_PASSING_OBJECT[_0x19e9af(0x17c)]=!0x0,_0x3c00fc?matchCellData({'v':_0x11451c['f']},_0x2d1501)?(VALUE_PASSING_OBJECT[_0x19e9af(0x1ce)]=!0x0,VALUE_PASSING_OBJECT[_0x19e9af(0x179)]=!0x0,VALUE_PASSING_OBJECT):(VALUE_PASSING_OBJECT['hit']=!0x1,VALUE_PASSING_OBJECT[_0x19e9af(0x179)]=!0x1,VALUE_PASSING_OBJECT):(VALUE_PASSING_OBJECT[_0x19e9af(0x179)]=!0x1,matchCellData(_0x28cc00,_0x2d1501)?VALUE_PASSING_OBJECT[_0x19e9af(0x1ce)]=!0x0:VALUE_PASSING_OBJECT[_0x19e9af(0x1ce)]=!0x1,VALUE_PASSING_OBJECT));}__name(hitCell,_0xf634ac(0x12c));function matchCellData(_0x30970b,_0x1e431a){const _0x1c6c50=_0xf634ac;let _0x5a42a9=extractPureValue(_0x30970b);return _0x5a42a9?_0x1e431a['matchesTheWholeCell']?(_0x5a42a9=trimLeadingTrailingWhitespace(_0x5a42a9),_0x1e431a[_0x1c6c50(0x1c6)]?_0x5a42a9===_0x1e431a['findString']:_0x5a42a9['toLowerCase']()===_0x1e431a[_0x1c6c50(0x1de)]):_0x1e431a[_0x1c6c50(0x1c6)]?_0x5a42a9[_0x1c6c50(0x16e)](_0x1e431a[_0x1c6c50(0x1de)])>-0x1:_0x5a42a9[_0x1c6c50(0x18d)]()[_0x1c6c50(0x16e)](_0x1e431a[_0x1c6c50(0x1de)])>-0x1:!0x1;}__name(matchCellData,_0xf634ac(0x156));function extractPureValue(_0x500361){const _0x3c5df3=_0xf634ac;var _0x34b1a2,_0x5ea8ba,_0x2576aa;const _0x1694ca=(_0x2576aa=(_0x5ea8ba=(_0x34b1a2=_0x500361==null?void 0x0:_0x500361['p'])==null?void 0x0:_0x34b1a2[_0x3c5df3(0x163)])==null?void 0x0:_0x5ea8ba[_0x3c5df3(0x1e4)])!=null?_0x2576aa:_0x500361==null?void 0x0:_0x500361['v'];return typeof _0x1694ca==_0x3c5df3(0x172)?''+_0x1694ca:typeof _0x1694ca==_0x3c5df3(0x124)?_0x1694ca?'1':'0':_0x1694ca;}__name(extractPureValue,'extractPureValue');function trimLeadingTrailingWhitespace(_0x4da344){const _0x2bbcea=_0xf634ac;return _0x4da344[_0x2bbcea(0x19d)](/^ +/g,'')[_0x2bbcea(0x19d)](/ +$/g,'');}__name(trimLeadingTrailingWhitespace,_0xf634ac(0x1ba));var __defProp2=Object[_0xf634ac(0x128)],__getOwnPropDesc=Object[_0xf634ac(0x1df)],__defNormalProp2=__name((_0x46cfdd,_0x18be43,_0x3339fd)=>_0x18be43 in _0x46cfdd?__defProp2(_0x46cfdd,_0x18be43,{'enumerable':!0x0,'configurable':!0x0,'writable':!0x0,'value':_0x3339fd}):_0x46cfdd[_0x18be43]=_0x3339fd,_0xf634ac(0x12b)),__decorateClass=__name((_0x5f1fad,_0x2d467f,_0x1e647d,_0x5c3fcd)=>{for(var _0x320517=_0x5c3fcd>0x1?void 0x0:_0x5c3fcd?__getOwnPropDesc(_0x2d467f,_0x1e647d):_0x2d467f,_0x3439a6=_0x5f1fad['length']-0x1,_0x132b67;_0x3439a6>=0x0;_0x3439a6--)(_0x132b67=_0x5f1fad[_0x3439a6])&&(_0x320517=(_0x5c3fcd?_0x132b67(_0x2d467f,_0x1e647d,_0x320517):_0x132b67(_0x320517))||_0x320517);return _0x5c3fcd&&_0x320517&&__defProp2(_0x2d467f,_0x1e647d,_0x320517),_0x320517;},_0xf634ac(0x1a4)),__decorateParam=__name((_0x4784cf,_0x2a6386)=>(_0x2ac0c9,_0x9428d)=>_0x2a6386(_0x2ac0c9,_0x9428d,_0x4784cf),_0xf634ac(0x1a7)),__publicField2=__name((_0x3b8589,_0x35fc90,_0x456db1)=>__defNormalProp2(_0x3b8589,typeof _0x35fc90!=_0xf634ac(0x153)?_0x35fc90+'':_0x35fc90,_0x456db1),_0xf634ac(0x13a));const NAME='SHEET_FIND_REPLACE_PLUGIN';var _a4;let UniverSheetsFindReplacePlugin=(_a4=class extends Plugin{constructor(_0x2ca647=defaultPluginConfig,_0x59328c,_0x4a1ba3){const _0x260ddf=_0xf634ac;super(),this[_0x260ddf(0x164)]=_0x2ca647,this[_0x260ddf(0x1eb)]=_0x59328c,this['_configService']=_0x4a1ba3;const {..._0x49edaf}=this[_0x260ddf(0x164)];this[_0x260ddf(0x185)][_0x260ddf(0x182)](PLUGIN_CONFIG_KEY,_0x49edaf);}['onStarting'](){const _0xfe0e6f=_0xf634ac;[[SheetsFindReplaceController]][_0xfe0e6f(0x133)](_0x12c2a8=>this[_0xfe0e6f(0x1eb)][_0xfe0e6f(0x144)](_0x12c2a8));}[_0xf634ac(0x17b)](){const _0x753fb=_0xf634ac;this[_0x753fb(0x1eb)]['get'](SheetsFindReplaceController);}},__name(_a4,_0xf634ac(0x1d6)),_a4);__publicField2(UniverSheetsFindReplacePlugin,'pluginName',NAME),__publicField2(UniverSheetsFindReplacePlugin,_0xf634ac(0x139),UniverInstanceType['UNIVER_SHEET']),UniverSheetsFindReplacePlugin=__decorateClass([DependentOn(UniverSheetsPlugin,UniverSheetsPlugin,UniverFindReplacePlugin),__decorateParam(0x1,Inject(Injector)),__decorateParam(0x2,IConfigService)],UniverSheetsFindReplacePlugin);export{SheetReplaceCommand,SheetsFindReplaceController,UniverSheetsFindReplacePlugin};function _0x34c3(){const _0x1d7acc=['subscribe','boolean','_matchesCount','isSamePosition','performFindInWorksheet','defineProperty','find','_inHiddenRange','__defNormalProp','hitCell','rgba(','deepClone','getSheetId','setShapeProps','startColumn','inHiddenRange','forEach','count','386258mhgXba','_color','_draw','closePanel','type','__publicField','_initCommands','_findPreviousMatchByRange','iterateByRow','14267CbtGBS','getRowFiltered','getSheetBySheetId','getWorkbookSelections','addObjects','_sheetSkeletonManagerService','add','_terminate','_updateFindHighlight','registerCommand','get','findBy','flat','subUnitId','_matchesPosition','set','iterateByColumn','SheetsFindReplaceController','getSheetOrders','_updateCurrentHighlightShape','find-highlight-','symbol','_findPreviousMatch','endRow','matchCellData','width','\x5c$&','_focusMatch','unitId','name','isBehindPositionWithRowPriority','currentMatch','onCommandExecuted','push','getColumnCount','UNIVER_SHEET','disposeWithMe','body','_config','map',',\x200.35)','sheet.command.replace','getRenderById','asObservable','length','range','equals','getMatches','indexOf','start','6PdEAuD','_findPreviousWorksheetThatHasAMatch','number','19784EynfdN','_currentHighlightShape','_findReplaceController','sort','activated','bind','replaceable','23988YdJkgT','onSteady','isFormula','_provider','executeCommand','FORMULA','_toggleDisplayRawFormula','isSelectionSingleCell','setConfig','with','UNIT','_configService','1950277bJuiAg','findInWorkbook','findIndex','_activated','_findNextMatchOnActiveSheetChange','terminate','delete','toLowerCase','_workbook','fromFindReplace','ROW','getReplaceAllResult','_activeHighlightIndex','getUnitId','moveToPreviousMatch','height','endColumn','createInstance','_matchesUpdate$','__decorateClass$1','__tempBatchingUndoRedo','matchesUpdate$','342910fRPBYr','replace','findScope','findLastIndex','_commandService','_highlightShapes','ignoreSelection','3VxfwAY','__decorateClass','_disposeHighlights','3960240cBBRiZ','__decorateParam','isBeforePositionWithColumnPriority','_univerInstanceService','stayIfOnMatch','__decorateParam$1','1971qcXoFN','_themeService','checkShouldFindInSelections','registerFindReplaceProvider','_activelyChangingMatch$','results','SheetFindModel','_renderManagerService','_workbookSelections','_init','COMMAND','getCurrentLastSelection','gold400','_findInRange','trimLeadingTrailingWhitespace','has','getActiveSheet','makeDirty','MUTATION','skeleton','isBehindPositionWithColumnPriority','_matches','filter','_preprocessQuery','params','activelyChangingMatch$','caseSensitive','sheets-find-replace-provider','noFocus','moveToNextMatch','setValue','_findReplaceService','getRowRawVisible','startRow','hit','_contextService','subscribeContextValue$','SheetsFindReplaceProvider','isBeforePositionWithRowPriority','dispose','_findModelsByUnitId','isSheetHidden','UniverSheetsFindReplacePlugin','toString','810417zOJTva','pipe','_findInWorksheet','8dnoBwv','getMergedCell','_findNextMatchByRange','findString','getOwnPropertyDescriptor','findDirection','next','_findInSelections','getCellRaw','dataStream','activeSheet$','getColVisible','_tryRestoreLastMatchesPosition','currentSkeleton$','color','getCurrentSelections','_injector','_findNextWorksheetThatHasAMatch','matchesCount','findLast','value','_matchesByWorksheet','_query','all','_getReplacedCellData','slice','findInActiveWorksheet'];_0x34c3=function(){return _0x1d7acc;};return _0x34c3();}