@univerjs/find-replace 0.21.0 → 0.21.1-insiders.20260509-bf98cad

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/README.md CHANGED
@@ -1,35 +1,42 @@
1
1
  # @univerjs/find-replace
2
2
 
3
+ [![npm version](https://img.shields.io/npm/v/@univerjs/find-replace?style=flat-square)](https://npmjs.com/package/@univerjs/find-replace)
4
+ [![license](https://img.shields.io/npm/l/@univerjs/find-replace?style=flat-square)](https://npmjs.com/package/@univerjs/find-replace)
5
+ [![downloads](https://img.shields.io/npm/dm/@univerjs/find-replace?style=flat-square)](https://npmjs.com/package/@univerjs/find-replace)
6
+
7
+ `@univerjs/find-replace` provides shared find and replace services and UI infrastructure that product-specific packages can extend.
8
+
3
9
  ## Package Overview
4
10
 
5
- | Package Name | UMD Namespace | Version | License | Downloads | Contains CSS | Contains i18n locales |
6
- | --- | --- | --- | --- | --- | :---: | :---: |
7
- | `@univerjs/find-replace` | `UniverFindReplace` | [![][npm-version-shield]][npm-version-link] | ![][npm-license-shield] | ![][npm-downloads-shield] | ⭕️ | ⭕️ |
11
+ | Package | UMD global | CSS | Locales | Facade entry |
12
+ | --- | --- | :---: | :---: | :---: |
13
+ | `@univerjs/find-replace` | `UniverFindReplace` | Yes | Yes | No |
14
+
15
+ ## Installation
8
16
 
9
- ## Introduction
17
+ ```sh
18
+ pnpm add @univerjs/find-replace
19
+ # or
20
+ npm install @univerjs/find-replace
21
+ ```
10
22
 
11
- This package provides the basic ability to support find and replace. With other plugins, such as `@univerjs/sheets-find-replace`, you can find and replace text in different types of files at the same time.
23
+ Keep all `@univerjs/*` packages on the same version.
12
24
 
13
25
  ## Usage
14
26
 
15
27
  ```ts
28
+ import '@univerjs/find-replace/lib/index.css';
29
+ import EnUS from '@univerjs/find-replace/locale/en-US';
16
30
  import { UniverFindReplacePlugin } from '@univerjs/find-replace';
17
31
 
18
32
  univer.registerPlugin(UniverFindReplacePlugin);
19
- ```
20
33
 
21
- ### Installation
34
+ // Merge EnUS into your Univer locale map when this package contributes UI text.
35
+ ```
22
36
 
23
- ```shell
24
- # Using npm
25
- npm install @univerjs/find-replace
37
+ ## Resources
26
38
 
27
- # Using pnpm
28
- pnpm add @univerjs/find-replace
29
- ```
39
+ - [Documentation](https://docs.univer.ai)
40
+ - [NPM package](https://npmjs.com/package/@univerjs/find-replace)
41
+ - [GitHub repository](https://github.com/dream-num/univer)
30
42
 
31
- <!-- Links -->
32
- [npm-version-shield]: https://img.shields.io/npm/v/@univerjs/find-replace?style=flat-square
33
- [npm-version-link]: https://npmjs.com/package/@univerjs/find-replace
34
- [npm-license-shield]: https://img.shields.io/npm/l/@univerjs/find-replace?style=flat-square
35
- [npm-downloads-shield]: https://img.shields.io/npm/dm/@univerjs/find-replace?style=flat-square
package/lib/cjs/index.js CHANGED
@@ -35,7 +35,7 @@ const FIND_REPLACE_DIALOG_FOCUS = "FIND_REPLACE_DIALOG_FOCUS";
35
35
  const FIND_REPLACE_REPLACE_REVEALED = "FIND_REPLACE_REPLACE_REVEALED";
36
36
 
37
37
  //#endregion
38
- //#region \0@oxc-project+runtime@0.124.0/helpers/typeof.js
38
+ //#region \0@oxc-project+runtime@0.129.0/helpers/typeof.js
39
39
  function _typeof(o) {
40
40
  "@babel/helpers - typeof";
41
41
  return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
@@ -46,7 +46,7 @@ function _typeof(o) {
46
46
  }
47
47
 
48
48
  //#endregion
49
- //#region \0@oxc-project+runtime@0.124.0/helpers/toPrimitive.js
49
+ //#region \0@oxc-project+runtime@0.129.0/helpers/toPrimitive.js
50
50
  function toPrimitive(t, r) {
51
51
  if ("object" != _typeof(t) || !t) return t;
52
52
  var e = t[Symbol.toPrimitive];
@@ -59,14 +59,14 @@ function toPrimitive(t, r) {
59
59
  }
60
60
 
61
61
  //#endregion
62
- //#region \0@oxc-project+runtime@0.124.0/helpers/toPropertyKey.js
62
+ //#region \0@oxc-project+runtime@0.129.0/helpers/toPropertyKey.js
63
63
  function toPropertyKey(t) {
64
64
  var i = toPrimitive(t, "string");
65
65
  return "symbol" == _typeof(i) ? i : i + "";
66
66
  }
67
67
 
68
68
  //#endregion
69
- //#region \0@oxc-project+runtime@0.124.0/helpers/defineProperty.js
69
+ //#region \0@oxc-project+runtime@0.129.0/helpers/defineProperty.js
70
70
  function _defineProperty(e, r, t) {
71
71
  return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
72
72
  value: t,
@@ -77,7 +77,7 @@ function _defineProperty(e, r, t) {
77
77
  }
78
78
 
79
79
  //#endregion
80
- //#region \0@oxc-project+runtime@0.124.0/helpers/decorateParam.js
80
+ //#region \0@oxc-project+runtime@0.129.0/helpers/decorateParam.js
81
81
  function __decorateParam(paramIndex, decorator) {
82
82
  return function(target, key) {
83
83
  decorator(target, key, paramIndex);
@@ -85,7 +85,7 @@ function __decorateParam(paramIndex, decorator) {
85
85
  }
86
86
 
87
87
  //#endregion
88
- //#region \0@oxc-project+runtime@0.124.0/helpers/decorate.js
88
+ //#region \0@oxc-project+runtime@0.129.0/helpers/decorate.js
89
89
  function __decorate(decorators, target, key, desc) {
90
90
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
91
91
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
@@ -349,10 +349,10 @@ let FindScope = /* @__PURE__ */ function(FindScope) {
349
349
  function createInitFindReplaceState() {
350
350
  return {
351
351
  caseSensitive: false,
352
- findBy: FindBy.VALUE,
352
+ findBy: "value",
353
353
  findCompleted: false,
354
- findDirection: FindDirection.ROW,
355
- findScope: FindScope.SUBUNIT,
354
+ findDirection: "row",
355
+ findScope: "subunit",
356
356
  findString: "",
357
357
  inputtingFindString: "",
358
358
  matchesCount: 0,
@@ -383,9 +383,9 @@ var FindReplaceState = class {
383
383
  _defineProperty(this, "_matchesCount", 0);
384
384
  _defineProperty(this, "_caseSensitive", true);
385
385
  _defineProperty(this, "_matchesTheWholeCell", false);
386
- _defineProperty(this, "_findDirection", FindDirection.ROW);
387
- _defineProperty(this, "_findScope", FindScope.SUBUNIT);
388
- _defineProperty(this, "_findBy", FindBy.VALUE);
386
+ _defineProperty(this, "_findDirection", "row");
387
+ _defineProperty(this, "_findScope", "subunit");
388
+ _defineProperty(this, "_findBy", "value");
389
389
  _defineProperty(this, "_findCompleted", false);
390
390
  }
391
391
  get state() {
@@ -586,7 +586,7 @@ let FindReplaceService = class FindReplaceService extends _univerjs_core.Disposa
586
586
  }
587
587
  changeFindBy(findBy) {
588
588
  this._state.changeState({ findBy });
589
- this._toggleDisplayRawFormula(findBy === FindBy.FORMULA);
589
+ this._toggleDisplayRawFormula(findBy === "formula");
590
590
  }
591
591
  changeFindScope(scope) {
592
592
  this._state.changeState({ findScope: scope });
@@ -1040,10 +1040,10 @@ function useFindScopeOptions(localeService) {
1040
1040
  return (0, react.useMemo)(() => {
1041
1041
  return [{
1042
1042
  label: localeService.t("find-replace.dialog.find-scope.current-sheet"),
1043
- value: FindScope.SUBUNIT
1043
+ value: "subunit"
1044
1044
  }, {
1045
1045
  label: localeService.t("find-replace.dialog.find-scope.workbook"),
1046
- value: FindScope.UNIT
1046
+ value: "unit"
1047
1047
  }];
1048
1048
  }, [localeService.getCurrentLocale()]);
1049
1049
  }
@@ -1051,10 +1051,10 @@ function useFindDirectionOptions(localeService) {
1051
1051
  return (0, react.useMemo)(() => {
1052
1052
  return [{
1053
1053
  label: localeService.t("find-replace.dialog.find-direction.row"),
1054
- value: FindDirection.ROW
1054
+ value: "row"
1055
1055
  }, {
1056
1056
  label: localeService.t("find-replace.dialog.find-direction.column"),
1057
- value: FindDirection.COLUMN
1057
+ value: "column"
1058
1058
  }];
1059
1059
  }, [localeService.getCurrentLocale()]);
1060
1060
  }
@@ -1062,10 +1062,10 @@ function useFindByOptions(localeService) {
1062
1062
  return (0, react.useMemo)(() => {
1063
1063
  return [{
1064
1064
  label: localeService.t("find-replace.dialog.find-by.value"),
1065
- value: FindBy.VALUE
1065
+ value: "value"
1066
1066
  }, {
1067
1067
  label: localeService.t("find-replace.dialog.find-by.formula"),
1068
- value: FindBy.FORMULA
1068
+ value: "formula"
1069
1069
  }];
1070
1070
  }, [localeService.getCurrentLocale()]);
1071
1071
  }
@@ -1257,7 +1257,7 @@ function getFindReplaceDialogDefaultPosition() {
1257
1257
  //#endregion
1258
1258
  //#region package.json
1259
1259
  var name = "@univerjs/find-replace";
1260
- var version = "0.21.0";
1260
+ var version = "0.21.1-insiders.20260509-bf98cad";
1261
1261
 
1262
1262
  //#endregion
1263
1263
  //#region src/config/config.ts
package/lib/es/index.js CHANGED
@@ -34,7 +34,7 @@ const FIND_REPLACE_DIALOG_FOCUS = "FIND_REPLACE_DIALOG_FOCUS";
34
34
  const FIND_REPLACE_REPLACE_REVEALED = "FIND_REPLACE_REPLACE_REVEALED";
35
35
 
36
36
  //#endregion
37
- //#region \0@oxc-project+runtime@0.124.0/helpers/typeof.js
37
+ //#region \0@oxc-project+runtime@0.129.0/helpers/typeof.js
38
38
  function _typeof(o) {
39
39
  "@babel/helpers - typeof";
40
40
  return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
@@ -45,7 +45,7 @@ function _typeof(o) {
45
45
  }
46
46
 
47
47
  //#endregion
48
- //#region \0@oxc-project+runtime@0.124.0/helpers/toPrimitive.js
48
+ //#region \0@oxc-project+runtime@0.129.0/helpers/toPrimitive.js
49
49
  function toPrimitive(t, r) {
50
50
  if ("object" != _typeof(t) || !t) return t;
51
51
  var e = t[Symbol.toPrimitive];
@@ -58,14 +58,14 @@ function toPrimitive(t, r) {
58
58
  }
59
59
 
60
60
  //#endregion
61
- //#region \0@oxc-project+runtime@0.124.0/helpers/toPropertyKey.js
61
+ //#region \0@oxc-project+runtime@0.129.0/helpers/toPropertyKey.js
62
62
  function toPropertyKey(t) {
63
63
  var i = toPrimitive(t, "string");
64
64
  return "symbol" == _typeof(i) ? i : i + "";
65
65
  }
66
66
 
67
67
  //#endregion
68
- //#region \0@oxc-project+runtime@0.124.0/helpers/defineProperty.js
68
+ //#region \0@oxc-project+runtime@0.129.0/helpers/defineProperty.js
69
69
  function _defineProperty(e, r, t) {
70
70
  return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
71
71
  value: t,
@@ -76,7 +76,7 @@ function _defineProperty(e, r, t) {
76
76
  }
77
77
 
78
78
  //#endregion
79
- //#region \0@oxc-project+runtime@0.124.0/helpers/decorateParam.js
79
+ //#region \0@oxc-project+runtime@0.129.0/helpers/decorateParam.js
80
80
  function __decorateParam(paramIndex, decorator) {
81
81
  return function(target, key) {
82
82
  decorator(target, key, paramIndex);
@@ -84,7 +84,7 @@ function __decorateParam(paramIndex, decorator) {
84
84
  }
85
85
 
86
86
  //#endregion
87
- //#region \0@oxc-project+runtime@0.124.0/helpers/decorate.js
87
+ //#region \0@oxc-project+runtime@0.129.0/helpers/decorate.js
88
88
  function __decorate(decorators, target, key, desc) {
89
89
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
90
90
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
@@ -348,10 +348,10 @@ let FindScope = /* @__PURE__ */ function(FindScope) {
348
348
  function createInitFindReplaceState() {
349
349
  return {
350
350
  caseSensitive: false,
351
- findBy: FindBy.VALUE,
351
+ findBy: "value",
352
352
  findCompleted: false,
353
- findDirection: FindDirection.ROW,
354
- findScope: FindScope.SUBUNIT,
353
+ findDirection: "row",
354
+ findScope: "subunit",
355
355
  findString: "",
356
356
  inputtingFindString: "",
357
357
  matchesCount: 0,
@@ -382,9 +382,9 @@ var FindReplaceState = class {
382
382
  _defineProperty(this, "_matchesCount", 0);
383
383
  _defineProperty(this, "_caseSensitive", true);
384
384
  _defineProperty(this, "_matchesTheWholeCell", false);
385
- _defineProperty(this, "_findDirection", FindDirection.ROW);
386
- _defineProperty(this, "_findScope", FindScope.SUBUNIT);
387
- _defineProperty(this, "_findBy", FindBy.VALUE);
385
+ _defineProperty(this, "_findDirection", "row");
386
+ _defineProperty(this, "_findScope", "subunit");
387
+ _defineProperty(this, "_findBy", "value");
388
388
  _defineProperty(this, "_findCompleted", false);
389
389
  }
390
390
  get state() {
@@ -585,7 +585,7 @@ let FindReplaceService = class FindReplaceService extends Disposable {
585
585
  }
586
586
  changeFindBy(findBy) {
587
587
  this._state.changeState({ findBy });
588
- this._toggleDisplayRawFormula(findBy === FindBy.FORMULA);
588
+ this._toggleDisplayRawFormula(findBy === "formula");
589
589
  }
590
590
  changeFindScope(scope) {
591
591
  this._state.changeState({ findScope: scope });
@@ -1039,10 +1039,10 @@ function useFindScopeOptions(localeService) {
1039
1039
  return useMemo(() => {
1040
1040
  return [{
1041
1041
  label: localeService.t("find-replace.dialog.find-scope.current-sheet"),
1042
- value: FindScope.SUBUNIT
1042
+ value: "subunit"
1043
1043
  }, {
1044
1044
  label: localeService.t("find-replace.dialog.find-scope.workbook"),
1045
- value: FindScope.UNIT
1045
+ value: "unit"
1046
1046
  }];
1047
1047
  }, [localeService.getCurrentLocale()]);
1048
1048
  }
@@ -1050,10 +1050,10 @@ function useFindDirectionOptions(localeService) {
1050
1050
  return useMemo(() => {
1051
1051
  return [{
1052
1052
  label: localeService.t("find-replace.dialog.find-direction.row"),
1053
- value: FindDirection.ROW
1053
+ value: "row"
1054
1054
  }, {
1055
1055
  label: localeService.t("find-replace.dialog.find-direction.column"),
1056
- value: FindDirection.COLUMN
1056
+ value: "column"
1057
1057
  }];
1058
1058
  }, [localeService.getCurrentLocale()]);
1059
1059
  }
@@ -1061,10 +1061,10 @@ function useFindByOptions(localeService) {
1061
1061
  return useMemo(() => {
1062
1062
  return [{
1063
1063
  label: localeService.t("find-replace.dialog.find-by.value"),
1064
- value: FindBy.VALUE
1064
+ value: "value"
1065
1065
  }, {
1066
1066
  label: localeService.t("find-replace.dialog.find-by.formula"),
1067
- value: FindBy.FORMULA
1067
+ value: "formula"
1068
1068
  }];
1069
1069
  }, [localeService.getCurrentLocale()]);
1070
1070
  }
@@ -1256,7 +1256,7 @@ function getFindReplaceDialogDefaultPosition() {
1256
1256
  //#endregion
1257
1257
  //#region package.json
1258
1258
  var name = "@univerjs/find-replace";
1259
- var version = "0.21.0";
1259
+ var version = "0.21.1-insiders.20260509-bf98cad";
1260
1260
 
1261
1261
  //#endregion
1262
1262
  //#region src/config/config.ts
package/lib/index.js CHANGED
@@ -34,7 +34,7 @@ const FIND_REPLACE_DIALOG_FOCUS = "FIND_REPLACE_DIALOG_FOCUS";
34
34
  const FIND_REPLACE_REPLACE_REVEALED = "FIND_REPLACE_REPLACE_REVEALED";
35
35
 
36
36
  //#endregion
37
- //#region \0@oxc-project+runtime@0.124.0/helpers/typeof.js
37
+ //#region \0@oxc-project+runtime@0.129.0/helpers/typeof.js
38
38
  function _typeof(o) {
39
39
  "@babel/helpers - typeof";
40
40
  return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
@@ -45,7 +45,7 @@ function _typeof(o) {
45
45
  }
46
46
 
47
47
  //#endregion
48
- //#region \0@oxc-project+runtime@0.124.0/helpers/toPrimitive.js
48
+ //#region \0@oxc-project+runtime@0.129.0/helpers/toPrimitive.js
49
49
  function toPrimitive(t, r) {
50
50
  if ("object" != _typeof(t) || !t) return t;
51
51
  var e = t[Symbol.toPrimitive];
@@ -58,14 +58,14 @@ function toPrimitive(t, r) {
58
58
  }
59
59
 
60
60
  //#endregion
61
- //#region \0@oxc-project+runtime@0.124.0/helpers/toPropertyKey.js
61
+ //#region \0@oxc-project+runtime@0.129.0/helpers/toPropertyKey.js
62
62
  function toPropertyKey(t) {
63
63
  var i = toPrimitive(t, "string");
64
64
  return "symbol" == _typeof(i) ? i : i + "";
65
65
  }
66
66
 
67
67
  //#endregion
68
- //#region \0@oxc-project+runtime@0.124.0/helpers/defineProperty.js
68
+ //#region \0@oxc-project+runtime@0.129.0/helpers/defineProperty.js
69
69
  function _defineProperty(e, r, t) {
70
70
  return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
71
71
  value: t,
@@ -76,7 +76,7 @@ function _defineProperty(e, r, t) {
76
76
  }
77
77
 
78
78
  //#endregion
79
- //#region \0@oxc-project+runtime@0.124.0/helpers/decorateParam.js
79
+ //#region \0@oxc-project+runtime@0.129.0/helpers/decorateParam.js
80
80
  function __decorateParam(paramIndex, decorator) {
81
81
  return function(target, key) {
82
82
  decorator(target, key, paramIndex);
@@ -84,7 +84,7 @@ function __decorateParam(paramIndex, decorator) {
84
84
  }
85
85
 
86
86
  //#endregion
87
- //#region \0@oxc-project+runtime@0.124.0/helpers/decorate.js
87
+ //#region \0@oxc-project+runtime@0.129.0/helpers/decorate.js
88
88
  function __decorate(decorators, target, key, desc) {
89
89
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
90
90
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
@@ -348,10 +348,10 @@ let FindScope = /* @__PURE__ */ function(FindScope) {
348
348
  function createInitFindReplaceState() {
349
349
  return {
350
350
  caseSensitive: false,
351
- findBy: FindBy.VALUE,
351
+ findBy: "value",
352
352
  findCompleted: false,
353
- findDirection: FindDirection.ROW,
354
- findScope: FindScope.SUBUNIT,
353
+ findDirection: "row",
354
+ findScope: "subunit",
355
355
  findString: "",
356
356
  inputtingFindString: "",
357
357
  matchesCount: 0,
@@ -382,9 +382,9 @@ var FindReplaceState = class {
382
382
  _defineProperty(this, "_matchesCount", 0);
383
383
  _defineProperty(this, "_caseSensitive", true);
384
384
  _defineProperty(this, "_matchesTheWholeCell", false);
385
- _defineProperty(this, "_findDirection", FindDirection.ROW);
386
- _defineProperty(this, "_findScope", FindScope.SUBUNIT);
387
- _defineProperty(this, "_findBy", FindBy.VALUE);
385
+ _defineProperty(this, "_findDirection", "row");
386
+ _defineProperty(this, "_findScope", "subunit");
387
+ _defineProperty(this, "_findBy", "value");
388
388
  _defineProperty(this, "_findCompleted", false);
389
389
  }
390
390
  get state() {
@@ -585,7 +585,7 @@ let FindReplaceService = class FindReplaceService extends Disposable {
585
585
  }
586
586
  changeFindBy(findBy) {
587
587
  this._state.changeState({ findBy });
588
- this._toggleDisplayRawFormula(findBy === FindBy.FORMULA);
588
+ this._toggleDisplayRawFormula(findBy === "formula");
589
589
  }
590
590
  changeFindScope(scope) {
591
591
  this._state.changeState({ findScope: scope });
@@ -1039,10 +1039,10 @@ function useFindScopeOptions(localeService) {
1039
1039
  return useMemo(() => {
1040
1040
  return [{
1041
1041
  label: localeService.t("find-replace.dialog.find-scope.current-sheet"),
1042
- value: FindScope.SUBUNIT
1042
+ value: "subunit"
1043
1043
  }, {
1044
1044
  label: localeService.t("find-replace.dialog.find-scope.workbook"),
1045
- value: FindScope.UNIT
1045
+ value: "unit"
1046
1046
  }];
1047
1047
  }, [localeService.getCurrentLocale()]);
1048
1048
  }
@@ -1050,10 +1050,10 @@ function useFindDirectionOptions(localeService) {
1050
1050
  return useMemo(() => {
1051
1051
  return [{
1052
1052
  label: localeService.t("find-replace.dialog.find-direction.row"),
1053
- value: FindDirection.ROW
1053
+ value: "row"
1054
1054
  }, {
1055
1055
  label: localeService.t("find-replace.dialog.find-direction.column"),
1056
- value: FindDirection.COLUMN
1056
+ value: "column"
1057
1057
  }];
1058
1058
  }, [localeService.getCurrentLocale()]);
1059
1059
  }
@@ -1061,10 +1061,10 @@ function useFindByOptions(localeService) {
1061
1061
  return useMemo(() => {
1062
1062
  return [{
1063
1063
  label: localeService.t("find-replace.dialog.find-by.value"),
1064
- value: FindBy.VALUE
1064
+ value: "value"
1065
1065
  }, {
1066
1066
  label: localeService.t("find-replace.dialog.find-by.formula"),
1067
- value: FindBy.FORMULA
1067
+ value: "formula"
1068
1068
  }];
1069
1069
  }, [localeService.getCurrentLocale()]);
1070
1070
  }
@@ -1256,7 +1256,7 @@ function getFindReplaceDialogDefaultPosition() {
1256
1256
  //#endregion
1257
1257
  //#region package.json
1258
1258
  var name = "@univerjs/find-replace";
1259
- var version = "0.21.0";
1259
+ var version = "0.21.1-insiders.20260509-bf98cad";
1260
1260
 
1261
1261
  //#endregion
1262
1262
  //#region src/config/config.ts
package/lib/umd/index.js CHANGED
@@ -1 +1 @@
1
- (function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require(`@univerjs/core`),require(`@univerjs/design`),require(`@univerjs/ui`),require(`@univerjs/engine-render`),require(`rxjs`),require(`react`),require(`react/jsx-runtime`)):typeof define==`function`&&define.amd?define([`exports`,`@univerjs/core`,`@univerjs/design`,`@univerjs/ui`,`@univerjs/engine-render`,`rxjs`,`react`,`react/jsx-runtime`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.UniverFindReplace={},e.UniverCore,e.UniverDesign,e.UniverUi,e.UniverEngineRender,e.rxjs,e.React,e.React))})(this,function(e,t,n,r,i,a,o,s){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});let c=`FIND_REPLACE_INPUT_FOCUS`,l=`FIND_REPLACE_DIALOG_FOCUS`,u=`FIND_REPLACE_REPLACE_REVEALED`;function d(e){"@babel/helpers - typeof";return d=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},d(e)}function f(e,t){if(d(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(d(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function p(e){var t=f(e,`string`);return d(t)==`symbol`?t:t+``}function m(e,t,n){return(t=p(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function h(e,t){return function(n,r){t(n,r,e)}}function g(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a}var _=class extends t.Disposable{};let v=(0,t.createIdentifier)(`find-replace.service`);function y(e){return e.findString!==void 0||e.inputtingFindString!==void 0||e.findDirection!==void 0||e.matchesTheWholeCell!==void 0||e.caseSensitive!==void 0||e.findScope!==void 0||e.findBy!==void 0}let b=class extends t.Disposable{get searched(){return this._findModels.length>0}constructor(e,t,n,r){super(),this._state=e,this._providers=t,this._univerInstanceService=n,this._commandService=r,m(this,`currentMatch$`,new a.BehaviorSubject(null)),m(this,`replaceables$`,new a.BehaviorSubject([])),m(this,`_findModels`,[]),m(this,`_matchingModel`,null),m(this,`_matches`,[]),m(this,`_currentSearchingDisposables`,null),this.disposeWithMe(this._state.stateUpdates$.pipe((0,a.throttleTime)(200,void 0,{leading:!0,trailing:!0})).subscribe(async e=>{let t=this._state.state;y(e)&&(t.findString!==``&&!t.replaceRevealed?(await this._startSearching(),this._state.changeState({findCompleted:!0})):e.replaceRevealed!==!0&&this._stopSearching())}))}dispose(){super.dispose(),this._stopSearching(),this.currentMatch$.complete(),this.replaceables$.complete(),this._state.changeState({...w(),revealed:!1})}async start(){if(!this._state.findString)return{results:[]};let e=await this._startSearching();return this._state.changeState({findCompleted:!0}),e}focusSelection(){var e;(e=this._matchingModel)==null||e.focusSelection()}async _startSearching(){if(!this._state.findString)return{results:[]};let e=Array.from(this._providers),t=this._findModels=(await Promise.all(e.map(e=>e.find({findString:this._state.findString,findDirection:this._state.findDirection,findScope:this._state.findScope,findBy:this._state.findBy,replaceRevealed:this._state.replaceRevealed,caseSensitive:this._state.caseSensitive,matchesTheWholeCell:this._state.matchesTheWholeCell})))).flat();this._subscribeToModelsChanges(t);let n=this._matches=t.map(e=>e.getMatches()).flat();return this.replaceables$.next(n.filter(e=>e.replaceable)),n.length?(this._moveToInitialMatch(t),this._state.changeState({matchesCount:n.length}),{results:n}):(this._state.changeState({matchesCount:0,matchesPosition:0}),{results:[]})}_stopSearching(){var e;this._providers.forEach(e=>e.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({findCompleted:!1,matchesCount:0,matchesPosition:0})}_subscribeToModelsChanges(e){let n=this._currentSearchingDisposables=new t.DisposableCollection,r=(0,a.combineLatest)(e.map(e=>e.matchesUpdate$)).pipe((0,a.debounceTime)(220)).subscribe(([...e])=>{let t=this._matches=e.flat();t.length?(this._moveToInitialMatch(this._findModels,!0),this._state.changeState({matchesCount:t.length}),this.replaceables$.next(t.filter(e=>e.replaceable))):(this._state.changeState({matchesCount:0,matchesPosition:0}),this.replaceables$.next([]))});e.forEach(e=>n.add((0,t.toDisposable)(e.activelyChangingMatch$.subscribe(e=>{let t=this._matches.findIndex(t=>t===e);this._state.changeState({matchesPosition:t+1})})))),n.add((0,t.toDisposable)(r))}async replace(){return this._matchingModel?this._matchingModel.replace(this._state.replaceString):!1}async replaceAll(){let e=await Promise.all(this._findModels.map(e=>e.replaceAll(this._state.replaceString))).then(e=>e.reduce((e,t)=>(e.success+=t.success,e.failure+=t.failure,e),{success:0,failure:0}));return e.failure===0&&this._stopSearching(),e}getCurrentMatch(){return this._state.matchesPosition>0?this._matches[this._state.matchesPosition-1]:null}_markMatch(e){let t=this._matches.findIndex(t=>t===e);this.currentMatch$.next(e),this._state.changeState({matchesPosition:t+1})}moveToNextMatch(){if(!this._matchingModel)return;let e=this._findModels.length===1,t=this._matchingModel.moveToNextMatch({loop:e});if(t)return this._markMatch(t),t;{let e=this._findModels.findIndex(e=>e===this._matchingModel);return this._moveToNextUnitMatch(e)}}_moveToNextUnitMatch(e){let t=this._findModels.length;for(let n=(e+1)%t;n!==e;){let e=this._findModels[n],r=e.moveToNextMatch({ignoreSelection:!0});if(r)return this._matchingModel=e,this._markMatch(r),r;n=(n+1)%t}if(this._matchingModel){let e=this._matchingModel.moveToNextMatch({ignoreSelection:!0});return e&&this._markMatch(e),e}}moveToPreviousMatch(){if(!this._matchingModel)return;let e=this._findModels.length===1,t=this._matchingModel.moveToPreviousMatch({loop:e});if(t){let e=this._matches.findIndex(e=>e===t);return this.currentMatch$.next(t),this._state.changeState({matchesPosition:e+1}),t}else{let e=this._findModels.length,t=this._findModels.findIndex(e=>e===this._matchingModel);for(let n=(t-1+e)%e;n!==t;){let t=this._findModels[n],r=t.moveToPreviousMatch({ignoreSelection:!0});if(r)return this._matchingModel=t,this._markMatch(r),r;n=(n-1)%e}let n=this._matchingModel.moveToPreviousMatch({ignoreSelection:!0});return n&&this._markMatch(n),n}}_moveToInitialMatch(e,t=!1){var n;let r=(n=this._univerInstanceService.getFocusedUnit())==null?void 0:n.getUnitId();if(!r)return-1;let i=e.findIndex(e=>e.unitId===r);if(i!==-1){this._matchingModel=e[i];let n=this._matchingModel.moveToNextMatch({stayIfOnMatch:!0,noFocus:t});if(n)return this._markMatch(n),i}return this._moveToNextUnitMatch(i),0}};b=g([h(2,t.IUniverInstanceService),h(3,t.ICommandService)],b);let x=function(e){return e.ROW=`row`,e.COLUMN=`column`,e}({}),S=function(e){return e.VALUE=`value`,e.FORMULA=`formula`,e}({}),C=function(e){return e.SUBUNIT=`subunit`,e.UNIT=`unit`,e}({});function w(){return{caseSensitive:!1,findBy:S.VALUE,findCompleted:!1,findDirection:x.ROW,findScope:C.SUBUNIT,findString:``,inputtingFindString:``,matchesCount:0,matchesPosition:0,matchesTheWholeCell:!1,replaceRevealed:!1,replaceString:``,revealed:!0}}var T=class{constructor(){m(this,`_stateUpdates$`,new a.Subject),m(this,`stateUpdates$`,this._stateUpdates$.asObservable()),m(this,`_state$`,new a.BehaviorSubject(w())),m(this,`state$`,this._state$.asObservable()),m(this,`_findString`,``),m(this,`_inputtingFindString`,``),m(this,`_replaceString`,``),m(this,`_revealed`,!1),m(this,`_replaceRevealed`,!1),m(this,`_matchesPosition`,0),m(this,`_matchesCount`,0),m(this,`_caseSensitive`,!0),m(this,`_matchesTheWholeCell`,!1),m(this,`_findDirection`,x.ROW),m(this,`_findScope`,C.SUBUNIT),m(this,`_findBy`,S.VALUE),m(this,`_findCompleted`,!1)}get state(){return this._state$.getValue()}get inputtingFindString(){return this._inputtingFindString}get findString(){return this._findString}get revealed(){return this._revealed}get replaceRevealed(){return this._replaceRevealed}get matchesPosition(){return this._matchesPosition}get matchesCount(){return this._matchesCount}get replaceString(){return this._replaceString}get caseSensitive(){return this._caseSensitive}get matchesTheWholeCell(){return this._matchesTheWholeCell}get findDirection(){return this._findDirection}get findScope(){return this._findScope}get findBy(){return this._findBy}get findCompleted(){return this._findCompleted}changeState(e){let t=!1,n={};e.findString!==void 0&&e.findString!==this._findString&&(this._findString=e.findString,n.findString=this._findString,t=!0),e.revealed!==void 0&&e.revealed!==this._revealed&&(this._revealed=e.revealed,n.revealed=e.revealed,t=!0),e.replaceRevealed!==void 0&&e.replaceRevealed!==this._replaceRevealed&&(this._replaceRevealed=e.replaceRevealed,n.replaceRevealed=e.replaceRevealed,t=!0),e.replaceString!==void 0&&e.replaceString!==this._replaceString&&(this._replaceString=e.replaceString,n.replaceString=e.replaceString,t=!0),e.matchesCount!==void 0&&e.matchesCount!==this._matchesCount&&(this._matchesCount=e.matchesCount,n.matchesCount=e.matchesCount,t=!0),e.matchesPosition!==void 0&&e.matchesPosition!==this._matchesPosition&&(this._matchesPosition=e.matchesPosition,n.matchesPosition=e.matchesPosition,t=!0),e.findBy!==void 0&&e.findBy!==this._findBy&&(this._findBy=e.findBy,n.findBy=e.findBy,t=!0),e.findScope!==void 0&&e.findScope!==this._findScope&&(this._findScope=e.findScope,n.findScope=e.findScope,t=!0),e.findDirection!==void 0&&e.findDirection!==this._findDirection&&(this._findDirection=e.findDirection,n.findDirection=e.findDirection,t=!0),e.caseSensitive!==void 0&&e.caseSensitive!==this._caseSensitive&&(this._caseSensitive=e.caseSensitive,n.caseSensitive=e.caseSensitive,t=!0),e.matchesTheWholeCell!==void 0&&e.matchesTheWholeCell!==this._matchesTheWholeCell&&(this._matchesTheWholeCell=e.matchesTheWholeCell,n.matchesTheWholeCell=e.matchesTheWholeCell,t=!0),e.inputtingFindString!==void 0&&e.inputtingFindString!==this._inputtingFindString&&(this._inputtingFindString=e.inputtingFindString,n.inputtingFindString=e.inputtingFindString,t=!0),e.findCompleted!==void 0&&e.findCompleted!==this._findCompleted&&(this._findCompleted=e.findCompleted,n.findCompleted=e.findCompleted,t=!0),t&&(this._state$.next({caseSensitive:this._caseSensitive,findBy:this._findBy,findCompleted:this._findCompleted,findDirection:this._findDirection,findScope:this._findScope,findString:this._findString,inputtingFindString:this._inputtingFindString,matchesCount:this._matchesCount,matchesPosition:this._matchesPosition,matchesTheWholeCell:this._matchesTheWholeCell,replaceRevealed:this._replaceRevealed,revealed:this._revealed}),this._stateUpdates$.next(n))}};let E=class extends t.Disposable{get stateUpdates$(){return this._state.stateUpdates$}get state$(){return this._state.state$}get revealed(){return this._state.revealed}get replaceRevealed(){return this._state.replaceRevealed}constructor(e,t){super(),this._injector=e,this._contextService=t,m(this,`_providers`,new Set),m(this,`_state`,new T),m(this,`_model`,void 0),m(this,`_currentMatch$`,new a.BehaviorSubject(null)),m(this,`currentMatch$`,this._currentMatch$.asObservable()),m(this,`_replaceables$`,new a.BehaviorSubject([])),m(this,`replaceables$`,this._replaceables$.asObservable()),m(this,`_focusSignal$`,new a.Subject),m(this,`focusSignal$`,this._focusSignal$.asObservable())}dispose(){super.dispose(),this._currentMatch$.next(null),this._currentMatch$.complete(),this._replaceables$.next([]),this._replaceables$.complete(),this._focusSignal$.complete()}getProviders(){return this._providers}getCurrentMatch(){var e;return(e=this._model)==null?void 0:e.getCurrentMatch()}getFindString(){return this._state.findString}changeFindString(e){this._state.changeState({findString:e})}focusFindInput(){this._focusSignal$.next()}changeInputtingFindString(e){e?this._state.changeState({inputtingFindString:e}):this._state.changeState({inputtingFindString:``,findString:``})}changeReplaceString(e){this._state.changeState({replaceString:e})}changeMatchesTheWholeCell(e){this._state.changeState({matchesTheWholeCell:e})}changeCaseSensitive(e){this._state.changeState({caseSensitive:e})}changeFindBy(e){this._state.changeState({findBy:e}),this._toggleDisplayRawFormula(e===S.FORMULA)}changeFindScope(e){this._state.changeState({findScope:e})}changeFindDirection(e){this._state.changeState({findDirection:e})}moveToNextMatch(){this._model&&(this._state.replaceRevealed&&!this._model.searched?(this._state.changeState({findString:this._state.inputtingFindString}),this._model.start()):this._model.moveToNextMatch(),this._focusSignal$.next())}moveToPreviousMatch(){this._model&&(this._state.replaceRevealed&&!this._model.searched?(this._state.changeState({findString:this._state.inputtingFindString}),this._model.start()):this._model.moveToPreviousMatch(),this._focusSignal$.next())}async replace(){return this._model?this._model.replace():!1}async replaceAll(){if(!this._model)throw Error(`[FindReplaceService] replaceAll: model is not initialized!`);return this._model.replaceAll()}revealReplace(){this._state.changeState({replaceRevealed:!0,inputtingFindString:this._state.findString}),this._toggleRevealReplace(!0)}focusSelection(){var e;(e=this._model)==null||e.focusSelection()}start(e=!1){if(this._providers.size===0)return!1;this._model=this._injector.createInstance(b,this._state,this._providers),this._model.currentMatch$.subscribe(e=>this._currentMatch$.next(e)),this._model.replaceables$.subscribe(e=>this._replaceables$.next(e));let t=w();return e&&(t.replaceRevealed=!0),this._state.changeState(t),this._toggleRevealReplace(e),!0}find(){var e;(e=this._model)==null||e.start()}terminate(){var e;(e=this._model)==null||e.dispose(),this._model=null,this._toggleDisplayRawFormula(!1),this._toggleRevealReplace(!1)}registerFindReplaceProvider(e){return this._providers.add(e),(0,t.toDisposable)(()=>this._providers.delete(e))}_toggleRevealReplace(e){this._contextService.setContextValue(u,e)}_toggleDisplayRawFormula(e){this._contextService.setContextValue(i.RENDER_RAW_FORMULA_KEY,e)}};E=g([h(0,(0,t.Inject)(t.Injector)),h(1,t.IContextService)],E);let D={id:`ui.command.replace-current-match`,type:t.CommandType.COMMAND,handler:e=>e.get(v).replace()},O={id:`ui.command.replace-all-matches`,type:t.CommandType.COMMAND,handler:async e=>{let i=e.get(t.IConfirmService),a=e.get(t.LocaleService),o=e.get(r.IMessageService);if(!await i.confirm({id:`CONFIRM_REPLACE_ALL`,title:{title:a.t(`find-replace.replace.confirm.title`)},cancelText:a.t(`button.cancel`),confirmText:a.t(`button.confirm`)}))return!1;let{success:s,failure:c}=await e.get(v).replaceAll();return c>0?(s===0?o.show({type:n.MessageType.Error,content:a.t(`find-replace.replace.all-failure`)}):o.show({type:n.MessageType.Warning,content:a.t(`find-replace.replace.partial-success`,`${s}`,`${c}`)}),!1):(o.show({type:n.MessageType.Success,content:a.t(`find-replace.replace.all-success`,`${s}`)}),!0)}},k={id:`ui.operation.open-find-dialog`,type:t.CommandType.OPERATION,handler:e=>{let t=e.get(v);return t.revealed?t.focusFindInput():t.start(),!0}},A={id:`ui.operation.open-replace-dialog`,type:t.CommandType.OPERATION,handler:e=>{let t=e.get(v);return t.revealed?t.replaceRevealed?t.focusFindInput():t.revealReplace():t.start(!0),!0}},j={type:t.CommandType.OPERATION,id:`ui.operation.go-to-next-match`,handler:e=>(e.get(v).moveToNextMatch(),!0)},M={type:t.CommandType.OPERATION,id:`ui.operation.go-to-previous-match`,handler:e=>(e.get(v).moveToPreviousMatch(),!0)},N={type:t.CommandType.OPERATION,id:`ui.operation.focus-selection`,handler:e=>(e.get(v).focusSelection(),!0)};function P({ref:e,...t}){let{icon:n,id:r,className:i,extend:a,...s}=t,c=`univerjs-icon univerjs-icon-${r} ${i||``}`.trim(),l=(0,o.useRef)(`_${R()}`);return F(n,`${r}`,{defIds:n.defIds,idSuffix:l.current},{ref:e,className:c,...s},a)}function F(e,t,n,r,i){return(0,o.createElement)(e.tag,{key:t,...I(e,n,i),...r},(L(e,n).children||[]).map((r,a)=>F(r,`${t}-${e.tag}-${a}`,n,void 0,i)))}function I(e,t,n){let r={...e.attrs};n!=null&&n.colorChannel1&&r.fill===`colorChannel1`&&(r.fill=n.colorChannel1),e.tag===`mask`&&r.id&&(r.id+=t.idSuffix),Object.entries(r).forEach(([e,n])=>{e===`mask`&&typeof n==`string`&&(r[e]=n.replace(/url\(#(.*)\)/,`url(#$1${t.idSuffix})`))});let{defIds:i}=t;return!i||i.length===0?r:(e.tag===`use`&&r[`xlink:href`]&&(r[`xlink:href`]+=t.idSuffix),Object.entries(r).forEach(([e,n])=>{typeof n==`string`&&(r[e]=n.replace(/url\(#(.*)\)/,`url(#$1${t.idSuffix})`))}),r)}function L(e,t){var n;let{defIds:r}=t;return!r||r.length===0?e:e.tag===`defs`&&(n=e.children)!=null&&n.length?{...e,children:e.children.map(e=>typeof e.attrs.id==`string`&&r&&r.includes(e.attrs.id)?{...e,attrs:{...e.attrs,id:e.attrs.id+t.idSuffix}}:e)}:e}function R(){return Math.random().toString(36).substring(2,8)}P.displayName=`UniverIcon`;let z={tag:`svg`,attrs:{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 16 16`,width:`1em`,height:`1em`},children:[{tag:`path`,attrs:{fill:`currentColor`,d:`M7.71899 1.36938C4.37604 1.36938 1.66602 4.07941 1.66602 7.42236C1.66602 10.7653 4.37604 13.4753 7.71899 13.4753C9.16744 13.4753 10.4971 12.9666 11.5389 12.118L13.6598 14.4109C13.8848 14.6542 14.2644 14.669 14.5077 14.444C14.7509 14.219 14.7657 13.8393 14.5407 13.5961L12.3906 11.2716C13.2536 10.2254 13.772 8.88442 13.772 7.42236C13.772 4.07941 11.0619 1.36938 7.71899 1.36938ZM2.86602 7.42236C2.86602 4.74215 5.03878 2.56938 7.71899 2.56938C10.3992 2.56938 12.572 4.74215 12.572 7.42236C12.572 10.1026 10.3992 12.2753 7.71899 12.2753C5.03878 12.2753 2.86602 10.1026 2.86602 7.42236Z`,fillRule:`evenodd`,clipRule:`evenodd`}}]},B=(0,o.forwardRef)(function(e,t){return(0,o.createElement)(P,Object.assign({},e,{id:`search-icon`,ref:t,icon:z}))});B.displayName=`SearchIcon`;function V(e){let n=e.get(t.IContextService);return{id:k.id,icon:`SearchIcon`,tooltip:`find-replace.toolbar`,type:r.MenuItemType.BUTTON,hidden$:(0,r.getMenuHiddenObservable)(e,t.UniverInstanceType.UNIVER_SHEET),disabled$:(0,a.combineLatest)([n.subscribeContextValue$(t.EDITOR_ACTIVATED),n.subscribeContextValue$(t.FOCUSING_SHEET)]).pipe((0,a.map)(([e,t])=>e||!t))}}let ee={[r.RibbonDataGroup.ORGANIZATION]:{[k.id]:{order:2,menuItemFactory:V}}};function H(e){let{findCompleted:t,localeService:r,matchesCount:i,matchesPosition:a,initialFindString:c,findReplaceService:l,onChange:u,...d}=e,[f,p]=(0,o.useState)(c),m=t&&i===0?r.t(`find-replace.dialog.no-result`):i===0?` `:void 0;function h(e){a===i&&e===1?l.moveToNextMatch():a===1&&e===i||e<a?l.moveToPreviousMatch():l.moveToNextMatch()}return(0,s.jsx)(`div`,{className:`univer-relative univer-flex univer-items-center univer-gap-2`,onDrag:e=>e.stopPropagation(),children:(0,s.jsx)(n.Input,{"data-u-comp":`search-input`,autoFocus:!0,placeholder:r.t(`find-replace.dialog.find-placeholder`),value:f,onChange:e=>{p(e),u==null||u(e)},slot:(0,s.jsx)(n.Pager,{loop:!0,text:m,value:a,total:i,onChange:h}),...d})})}function U(e,t){let n=(0,o.useCallback)(()=>{var e;(e=document.querySelector(`.univer-find-input input`))==null||e.focus()},[]),r=(0,o.useCallback)(()=>{let e=document.querySelectorAll(`[data-u-comp=find-replace-dialog] [data-u-comp=search-input]`);return Array.from(e).some(e=>e===document.activeElement)},[]);return(0,o.useImperativeHandle)(t,()=>({focus:n,selectHasFocus:r})),(0,o.useEffect)(()=>{let t=e.focusSignal$.subscribe(()=>n());return()=>t.unsubscribe()},[e,n]),{focus:n,selectHasFocus:r}}let te=(0,o.forwardRef)(function(e,n){let i=(0,r.useDependency)(t.LocaleService),a=(0,r.useDependency)(v),c=(0,r.useDependency)(t.ICommandService),{findCompleted:l,findString:u,matchesCount:d,matchesPosition:f}=(0,r.useObservable)(a.state$,void 0,!0),p=(0,o.useCallback)(()=>{c.executeCommand(A.id)},[c]),m=(0,r.useDebounceFn)(e=>a.changeFindString(e),500);return U(a,n),(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(H,{findCompleted:l,matchesCount:d,matchesPosition:f,findReplaceService:a,localeService:i,initialFindString:u,onChange:m}),(0,s.jsx)(`div`,{className:`univer-mt-4 univer-text-center`,children:(0,s.jsx)(`a`,{className:`hover:univer-text-primary-500/80 univer-cursor-pointer univer-text-sm univer-text-primary-500 univer-transition-colors`,onClick:p,children:i.t(`find-replace.dialog.advanced-finding`)})})]})}),ne=(0,o.forwardRef)(function(e,i){let a=(0,r.useDependency)(v),c=(0,r.useDependency)(t.LocaleService),l=(0,r.useDependency)(t.ICommandService),u=(0,r.useDependency)(r.IMessageService),d=(0,r.useObservable)(a.currentMatch$,void 0,!0),f=(0,r.useObservable)(a.replaceables$,void 0,!0),{matchesCount:p,matchesPosition:m,findString:h,inputtingFindString:g,replaceString:_,caseSensitive:y,matchesTheWholeCell:b,findDirection:x,findScope:S,findBy:C,findCompleted:w}=(0,r.useObservable)(a.state$,void 0,!0),T=g.length===0,E=p===0||!(d!=null&&d.replaceable),k=f.length===0,A=(0,o.useCallback)(e=>a.changeInputtingFindString(e),[a]),j=(0,o.useCallback)(e=>a.changeReplaceString(e),[a]),{focus:M}=U(a,i),N=(0,o.useCallback)(()=>{h===g?a.moveToNextMatch():(a.changeFindString(g),a.find())},[h,g,a]),P=(0,o.useCallback)(()=>l.executeCommand(D.id),[l]),F=(0,o.useCallback)(async()=>{await l.executeCommand(O.id),M()},[l]),I=(0,o.useCallback)(e=>{a.changeFindDirection(e)},[a]),L=(0,o.useCallback)(e=>{a.changeFindScope(e)},[a]),R=(0,o.useCallback)(e=>{a.changeFindBy(e)},[a]),z=ie(c),B=ae(c),V=oe(c);return(0,o.useEffect)(()=>{w&&p===0&&u.show({content:c.t(`find-replace.dialog.no-match`),type:n.MessageType.Warning,duration:5e3})},[w,p,u,c]),(0,s.jsxs)(`div`,{children:[(0,s.jsx)(n.FormLayout,{label:c.t(`find-replace.dialog.find`),children:(0,s.jsx)(H,{findCompleted:w,className:`univer-find-input`,matchesCount:p,matchesPosition:m,findReplaceService:a,localeService:c,initialFindString:g,onChange:A})}),(0,s.jsx)(n.FormLayout,{label:c.t(`find-replace.dialog.replace`),children:(0,s.jsx)(n.Input,{placeholder:c.t(`find-replace.dialog.replace-placeholder`),value:_,onChange:e=>j(e)})}),(0,s.jsx)(n.FormLayout,{label:c.t(`find-replace.dialog.find-direction.title`),children:(0,s.jsx)(n.Select,{value:x,options:B,onChange:I})}),(0,s.jsx)(n.FormDualColumnLayout,{children:(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(n.FormLayout,{label:c.t(`find-replace.dialog.find-scope.title`),children:(0,s.jsx)(n.Select,{value:S,options:z,onChange:L})}),(0,s.jsx)(n.FormLayout,{label:c.t(`find-replace.dialog.find-by.title`),children:(0,s.jsx)(n.Select,{value:C,options:V,onChange:R})})]})}),(0,s.jsx)(n.FormDualColumnLayout,{children:(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(n.FormLayout,{children:(0,s.jsx)(n.Checkbox,{checked:y,onChange:e=>{a.changeCaseSensitive(e)},children:c.t(`find-replace.dialog.case-sensitive`)})}),(0,s.jsx)(n.FormLayout,{children:(0,s.jsx)(n.Checkbox,{checked:b,onChange:e=>{a.changeMatchesTheWholeCell(e)},children:c.t(`find-replace.dialog.match-the-whole-cell`)})})]})}),(0,s.jsxs)(`div`,{className:`univer-mt-6 univer-flex univer-justify-between`,children:[(0,s.jsx)(n.Button,{variant:`primary`,onClick:N,disabled:T,children:c.t(`find-replace.dialog.find`)}),(0,s.jsxs)(`span`,{className:`univer-inline-flex univer-gap-2`,children:[(0,s.jsx)(n.Button,{disabled:E,onClick:P,children:c.t(`find-replace.dialog.replace`)}),(0,s.jsx)(n.Button,{disabled:k,onClick:F,children:c.t(`find-replace.dialog.replace-all`)})]})]})]})});function re(){let e=(0,r.useDependency)(v),n=(0,r.useDependency)(r.ILayoutService),i=(0,r.useDependency)(t.IContextService),u=(0,r.useObservable)(e.state$,void 0,!0),d=(0,o.useRef)(null);(0,o.useEffect)(()=>{let e;return d.current&&(e=n.registerContainerElement(d.current)),()=>e==null?void 0:e.dispose()},[n]);let f=(0,o.useRef)(null),p=(0,o.useCallback)(e=>i.setContextValue(l,e),[i]),m=(0,o.useCallback)(e=>i.setContextValue(c,e),[i]);return(0,o.useEffect)(()=>{var e;let t=(0,a.fromEvent)(document,`focusin`).subscribe(e=>{var t;e.target&&(t=d.current)!=null&&t.contains(e.target)?p(!0):p(!1),!f.current||!f.current.selectHasFocus()?m(!1):m(!0)});return(e=f.current)==null||e.focus(),p(!0),m(!0),()=>{t.unsubscribe(),p(!1)}},[p,m]),(0,s.jsx)(`div`,{ref:d,"data-u-comp":`find-replace-dialog`,children:u.replaceRevealed?(0,s.jsx)(ne,{ref:f}):(0,s.jsx)(te,{ref:f})})}function ie(e){return(0,o.useMemo)(()=>[{label:e.t(`find-replace.dialog.find-scope.current-sheet`),value:C.SUBUNIT},{label:e.t(`find-replace.dialog.find-scope.workbook`),value:C.UNIT}],[e.getCurrentLocale()])}function ae(e){return(0,o.useMemo)(()=>[{label:e.t(`find-replace.dialog.find-direction.row`),value:x.ROW},{label:e.t(`find-replace.dialog.find-direction.column`),value:x.COLUMN}],[e.getCurrentLocale()])}function oe(e){return(0,o.useMemo)(()=>[{label:e.t(`find-replace.dialog.find-by.value`),value:S.VALUE},{label:e.t(`find-replace.dialog.find-by.formula`),value:S.FORMULA}],[e.getCurrentLocale()])}function W(e){return e.getContextValue(l)}function se(e){return e.getContextValue(u)}function G(e){return e.getContextValue(c)}let K=`7_find-replace-shortcuts`;function q(e){return e.getContextValue(t.FOCUSING_SHEET)}function J(e){return!e.getContextValue(t.EDITOR_ACTIVATED)}let ce={id:k.id,description:`find-replace.shortcut.open-find-dialog`,binding:r.KeyCode.F|r.MetaKeys.CTRL_COMMAND,group:K,preconditions(e){return!W(e)&&q(e)&&J(e)}},le={id:k.id,description:`find-replace.shortcut.open-find-dialog`,binding:r.KeyCode.F|r.MetaKeys.CTRL_COMMAND,mac:r.KeyCode.F|r.MetaKeys.MAC_CTRL,preconditions(e){return!W(e)&&q(e)&&J(e)}},ue={id:A.id,description:`find-replace.shortcut.open-replace-dialog`,binding:r.KeyCode.H|r.MetaKeys.CTRL_COMMAND,mac:r.KeyCode.H|r.MetaKeys.MAC_CTRL,group:K,preconditions(e){return q(e)&&J(e)&&(!W(e)||!se(e))}},de={id:j.id,description:`find-replace.shortcut.go-to-next-match`,binding:r.KeyCode.ENTER,group:K,priority:1e3,preconditions(e){return G(e)&&W(e)}},fe={id:M.id,description:`find-replace.shortcut.go-to-previous-match`,binding:r.KeyCode.ENTER|r.MetaKeys.SHIFT,group:K,priority:1e3,preconditions(e){return G(e)&&W(e)}},pe={id:N.id,description:`find-replace.shortcut.focus-selection`,binding:r.KeyCode.ESC,group:K,priority:1e3,preconditions(e){return W(e)}},Y=`DESKTOP_FIND_REPLACE_DIALOG`,X=class extends t.RxDisposable{constructor(e,t,n,r,i,a,o,s,c){super(),this._univerInstanceService=e,this._menuManagerService=t,this._shortcutService=n,this._commandService=r,this._findReplaceService=i,this._dialogService=a,this._layoutService=o,this._localeService=s,this._componentManager=c,m(this,`_closingListenerDisposable`,void 0),this._initCommands(),this._initUI(),this._initShortcuts()}dispose(){var e;super.dispose(),(e=this._closingListenerDisposable)==null||e.dispose(),this._closingListenerDisposable=null}_initCommands(){[k,A,j,M,O,D,N].forEach(e=>{this.disposeWithMe(this._commandService.registerCommand(e))})}_initShortcuts(){[ue,ce,le,fe,de,pe].forEach(e=>this.disposeWithMe(this._shortcutService.registerShortcut(e)))}_initUI(){[[`FindReplaceDialog`,re],[`SearchIcon`,B]].forEach(([e,t])=>{this.disposeWithMe(this._componentManager.register(e,t))}),this._menuManagerService.mergeMenu(ee),this._findReplaceService.stateUpdates$.pipe((0,a.takeUntil)(this.dispose$)).subscribe(e=>{e.revealed===!0&&this._openPanel()})}_openPanel(){this._dialogService.open({id:Y,draggable:!0,width:350,title:{title:this._localeService.t(`find-replace.dialog.title`)},children:{label:`FindReplaceDialog`},destroyOnClose:!0,mask:!1,maskClosable:!1,defaultPosition:me(),preservePositionOnDestroy:!0,onClose:()=>this.closePanel()}),this._closingListenerDisposable=(0,t.toDisposable)(this._univerInstanceService.focused$.pipe((0,a.takeUntil)(this.dispose$)).subscribe(e=>{(!e||!this._univerInstanceService.getUniverSheetInstance(e))&&this.closePanel()}))}closePanel(){this._closingListenerDisposable&&(this._closingListenerDisposable.dispose(),this._closingListenerDisposable=null,this._dialogService.close(Y),this._findReplaceService.terminate(),queueMicrotask(()=>this._layoutService.focus()))}};X=g([h(0,t.IUniverInstanceService),h(1,r.IMenuManagerService),h(2,r.IShortcutService),h(3,t.ICommandService),h(4,v),h(5,r.IDialogService),h(6,r.ILayoutService),h(7,(0,t.Inject)(t.LocaleService)),h(8,(0,t.Inject)(r.ComponentManager))],X);function me(){let{innerWidth:e}=window;return{x:e-350-20,y:64}}var he=`@univerjs/find-replace`,ge=`0.21.0`;let Z=`find-replace.config`;Symbol(Z);let Q={},$=class extends t.Plugin{constructor(e=Q,n,r){super(),this._config=e,this._injector=n,this._configService=r;let{...i}=(0,t.merge)({},Q,this._config);this._configService.setConfig(Z,i)}onStarting(){[[X],[v,{useClass:E}]].forEach(e=>this._injector.add(e))}onRendered(){this._injector.get(X)}};m($,`pluginName`,`UNIVER_FIND_REPLACE_PLUGIN`),m($,`packageName`,he),m($,`version`,ge),$=g([h(1,(0,t.Inject)(t.Injector)),h(2,t.IConfigService)],$),e.FindBy=S,e.FindDirection=x,e.FindModel=_,Object.defineProperty(e,`FindReplaceController`,{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,`FindReplaceModel`,{enumerable:!0,get:function(){return b}}),e.FindReplaceState=T,e.FindScope=C,e.GoToNextMatchOperation=j,e.GoToPreviousMatchOperation=M,e.IFindReplaceService=v,e.OpenFindDialogOperation=k,e.OpenReplaceDialogOperation=A,e.ReplaceAllMatchesCommand=O,e.ReplaceCurrentMatchCommand=D,Object.defineProperty(e,`UniverFindReplacePlugin`,{enumerable:!0,get:function(){return $}}),e.createInitFindReplaceState=w});
1
+ (function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require(`@univerjs/core`),require(`@univerjs/design`),require(`@univerjs/ui`),require(`@univerjs/engine-render`),require(`rxjs`),require(`react`),require(`react/jsx-runtime`)):typeof define==`function`&&define.amd?define([`exports`,`@univerjs/core`,`@univerjs/design`,`@univerjs/ui`,`@univerjs/engine-render`,`rxjs`,`react`,`react/jsx-runtime`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.UniverFindReplace={},e.UniverCore,e.UniverDesign,e.UniverUi,e.UniverEngineRender,e.rxjs,e.React,e.React))})(this,function(e,t,n,r,i,a,o,s){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});let c=`FIND_REPLACE_INPUT_FOCUS`,l=`FIND_REPLACE_DIALOG_FOCUS`,u=`FIND_REPLACE_REPLACE_REVEALED`;function d(e){"@babel/helpers - typeof";return d=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},d(e)}function f(e,t){if(d(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(d(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function p(e){var t=f(e,`string`);return d(t)==`symbol`?t:t+``}function m(e,t,n){return(t=p(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function h(e,t){return function(n,r){t(n,r,e)}}function g(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a}var _=class extends t.Disposable{};let v=(0,t.createIdentifier)(`find-replace.service`);function y(e){return e.findString!==void 0||e.inputtingFindString!==void 0||e.findDirection!==void 0||e.matchesTheWholeCell!==void 0||e.caseSensitive!==void 0||e.findScope!==void 0||e.findBy!==void 0}let b=class extends t.Disposable{get searched(){return this._findModels.length>0}constructor(e,t,n,r){super(),this._state=e,this._providers=t,this._univerInstanceService=n,this._commandService=r,m(this,`currentMatch$`,new a.BehaviorSubject(null)),m(this,`replaceables$`,new a.BehaviorSubject([])),m(this,`_findModels`,[]),m(this,`_matchingModel`,null),m(this,`_matches`,[]),m(this,`_currentSearchingDisposables`,null),this.disposeWithMe(this._state.stateUpdates$.pipe((0,a.throttleTime)(200,void 0,{leading:!0,trailing:!0})).subscribe(async e=>{let t=this._state.state;y(e)&&(t.findString!==``&&!t.replaceRevealed?(await this._startSearching(),this._state.changeState({findCompleted:!0})):e.replaceRevealed!==!0&&this._stopSearching())}))}dispose(){super.dispose(),this._stopSearching(),this.currentMatch$.complete(),this.replaceables$.complete(),this._state.changeState({...w(),revealed:!1})}async start(){if(!this._state.findString)return{results:[]};let e=await this._startSearching();return this._state.changeState({findCompleted:!0}),e}focusSelection(){var e;(e=this._matchingModel)==null||e.focusSelection()}async _startSearching(){if(!this._state.findString)return{results:[]};let e=Array.from(this._providers),t=this._findModels=(await Promise.all(e.map(e=>e.find({findString:this._state.findString,findDirection:this._state.findDirection,findScope:this._state.findScope,findBy:this._state.findBy,replaceRevealed:this._state.replaceRevealed,caseSensitive:this._state.caseSensitive,matchesTheWholeCell:this._state.matchesTheWholeCell})))).flat();this._subscribeToModelsChanges(t);let n=this._matches=t.map(e=>e.getMatches()).flat();return this.replaceables$.next(n.filter(e=>e.replaceable)),n.length?(this._moveToInitialMatch(t),this._state.changeState({matchesCount:n.length}),{results:n}):(this._state.changeState({matchesCount:0,matchesPosition:0}),{results:[]})}_stopSearching(){var e;this._providers.forEach(e=>e.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({findCompleted:!1,matchesCount:0,matchesPosition:0})}_subscribeToModelsChanges(e){let n=this._currentSearchingDisposables=new t.DisposableCollection,r=(0,a.combineLatest)(e.map(e=>e.matchesUpdate$)).pipe((0,a.debounceTime)(220)).subscribe(([...e])=>{let t=this._matches=e.flat();t.length?(this._moveToInitialMatch(this._findModels,!0),this._state.changeState({matchesCount:t.length}),this.replaceables$.next(t.filter(e=>e.replaceable))):(this._state.changeState({matchesCount:0,matchesPosition:0}),this.replaceables$.next([]))});e.forEach(e=>n.add((0,t.toDisposable)(e.activelyChangingMatch$.subscribe(e=>{let t=this._matches.findIndex(t=>t===e);this._state.changeState({matchesPosition:t+1})})))),n.add((0,t.toDisposable)(r))}async replace(){return this._matchingModel?this._matchingModel.replace(this._state.replaceString):!1}async replaceAll(){let e=await Promise.all(this._findModels.map(e=>e.replaceAll(this._state.replaceString))).then(e=>e.reduce((e,t)=>(e.success+=t.success,e.failure+=t.failure,e),{success:0,failure:0}));return e.failure===0&&this._stopSearching(),e}getCurrentMatch(){return this._state.matchesPosition>0?this._matches[this._state.matchesPosition-1]:null}_markMatch(e){let t=this._matches.findIndex(t=>t===e);this.currentMatch$.next(e),this._state.changeState({matchesPosition:t+1})}moveToNextMatch(){if(!this._matchingModel)return;let e=this._findModels.length===1,t=this._matchingModel.moveToNextMatch({loop:e});if(t)return this._markMatch(t),t;{let e=this._findModels.findIndex(e=>e===this._matchingModel);return this._moveToNextUnitMatch(e)}}_moveToNextUnitMatch(e){let t=this._findModels.length;for(let n=(e+1)%t;n!==e;){let e=this._findModels[n],r=e.moveToNextMatch({ignoreSelection:!0});if(r)return this._matchingModel=e,this._markMatch(r),r;n=(n+1)%t}if(this._matchingModel){let e=this._matchingModel.moveToNextMatch({ignoreSelection:!0});return e&&this._markMatch(e),e}}moveToPreviousMatch(){if(!this._matchingModel)return;let e=this._findModels.length===1,t=this._matchingModel.moveToPreviousMatch({loop:e});if(t){let e=this._matches.findIndex(e=>e===t);return this.currentMatch$.next(t),this._state.changeState({matchesPosition:e+1}),t}else{let e=this._findModels.length,t=this._findModels.findIndex(e=>e===this._matchingModel);for(let n=(t-1+e)%e;n!==t;){let t=this._findModels[n],r=t.moveToPreviousMatch({ignoreSelection:!0});if(r)return this._matchingModel=t,this._markMatch(r),r;n=(n-1)%e}let n=this._matchingModel.moveToPreviousMatch({ignoreSelection:!0});return n&&this._markMatch(n),n}}_moveToInitialMatch(e,t=!1){var n;let r=(n=this._univerInstanceService.getFocusedUnit())==null?void 0:n.getUnitId();if(!r)return-1;let i=e.findIndex(e=>e.unitId===r);if(i!==-1){this._matchingModel=e[i];let n=this._matchingModel.moveToNextMatch({stayIfOnMatch:!0,noFocus:t});if(n)return this._markMatch(n),i}return this._moveToNextUnitMatch(i),0}};b=g([h(2,t.IUniverInstanceService),h(3,t.ICommandService)],b);let x=function(e){return e.ROW=`row`,e.COLUMN=`column`,e}({}),S=function(e){return e.VALUE=`value`,e.FORMULA=`formula`,e}({}),C=function(e){return e.SUBUNIT=`subunit`,e.UNIT=`unit`,e}({});function w(){return{caseSensitive:!1,findBy:`value`,findCompleted:!1,findDirection:`row`,findScope:`subunit`,findString:``,inputtingFindString:``,matchesCount:0,matchesPosition:0,matchesTheWholeCell:!1,replaceRevealed:!1,replaceString:``,revealed:!0}}var T=class{constructor(){m(this,`_stateUpdates$`,new a.Subject),m(this,`stateUpdates$`,this._stateUpdates$.asObservable()),m(this,`_state$`,new a.BehaviorSubject(w())),m(this,`state$`,this._state$.asObservable()),m(this,`_findString`,``),m(this,`_inputtingFindString`,``),m(this,`_replaceString`,``),m(this,`_revealed`,!1),m(this,`_replaceRevealed`,!1),m(this,`_matchesPosition`,0),m(this,`_matchesCount`,0),m(this,`_caseSensitive`,!0),m(this,`_matchesTheWholeCell`,!1),m(this,`_findDirection`,`row`),m(this,`_findScope`,`subunit`),m(this,`_findBy`,`value`),m(this,`_findCompleted`,!1)}get state(){return this._state$.getValue()}get inputtingFindString(){return this._inputtingFindString}get findString(){return this._findString}get revealed(){return this._revealed}get replaceRevealed(){return this._replaceRevealed}get matchesPosition(){return this._matchesPosition}get matchesCount(){return this._matchesCount}get replaceString(){return this._replaceString}get caseSensitive(){return this._caseSensitive}get matchesTheWholeCell(){return this._matchesTheWholeCell}get findDirection(){return this._findDirection}get findScope(){return this._findScope}get findBy(){return this._findBy}get findCompleted(){return this._findCompleted}changeState(e){let t=!1,n={};e.findString!==void 0&&e.findString!==this._findString&&(this._findString=e.findString,n.findString=this._findString,t=!0),e.revealed!==void 0&&e.revealed!==this._revealed&&(this._revealed=e.revealed,n.revealed=e.revealed,t=!0),e.replaceRevealed!==void 0&&e.replaceRevealed!==this._replaceRevealed&&(this._replaceRevealed=e.replaceRevealed,n.replaceRevealed=e.replaceRevealed,t=!0),e.replaceString!==void 0&&e.replaceString!==this._replaceString&&(this._replaceString=e.replaceString,n.replaceString=e.replaceString,t=!0),e.matchesCount!==void 0&&e.matchesCount!==this._matchesCount&&(this._matchesCount=e.matchesCount,n.matchesCount=e.matchesCount,t=!0),e.matchesPosition!==void 0&&e.matchesPosition!==this._matchesPosition&&(this._matchesPosition=e.matchesPosition,n.matchesPosition=e.matchesPosition,t=!0),e.findBy!==void 0&&e.findBy!==this._findBy&&(this._findBy=e.findBy,n.findBy=e.findBy,t=!0),e.findScope!==void 0&&e.findScope!==this._findScope&&(this._findScope=e.findScope,n.findScope=e.findScope,t=!0),e.findDirection!==void 0&&e.findDirection!==this._findDirection&&(this._findDirection=e.findDirection,n.findDirection=e.findDirection,t=!0),e.caseSensitive!==void 0&&e.caseSensitive!==this._caseSensitive&&(this._caseSensitive=e.caseSensitive,n.caseSensitive=e.caseSensitive,t=!0),e.matchesTheWholeCell!==void 0&&e.matchesTheWholeCell!==this._matchesTheWholeCell&&(this._matchesTheWholeCell=e.matchesTheWholeCell,n.matchesTheWholeCell=e.matchesTheWholeCell,t=!0),e.inputtingFindString!==void 0&&e.inputtingFindString!==this._inputtingFindString&&(this._inputtingFindString=e.inputtingFindString,n.inputtingFindString=e.inputtingFindString,t=!0),e.findCompleted!==void 0&&e.findCompleted!==this._findCompleted&&(this._findCompleted=e.findCompleted,n.findCompleted=e.findCompleted,t=!0),t&&(this._state$.next({caseSensitive:this._caseSensitive,findBy:this._findBy,findCompleted:this._findCompleted,findDirection:this._findDirection,findScope:this._findScope,findString:this._findString,inputtingFindString:this._inputtingFindString,matchesCount:this._matchesCount,matchesPosition:this._matchesPosition,matchesTheWholeCell:this._matchesTheWholeCell,replaceRevealed:this._replaceRevealed,revealed:this._revealed}),this._stateUpdates$.next(n))}};let E=class extends t.Disposable{get stateUpdates$(){return this._state.stateUpdates$}get state$(){return this._state.state$}get revealed(){return this._state.revealed}get replaceRevealed(){return this._state.replaceRevealed}constructor(e,t){super(),this._injector=e,this._contextService=t,m(this,`_providers`,new Set),m(this,`_state`,new T),m(this,`_model`,void 0),m(this,`_currentMatch$`,new a.BehaviorSubject(null)),m(this,`currentMatch$`,this._currentMatch$.asObservable()),m(this,`_replaceables$`,new a.BehaviorSubject([])),m(this,`replaceables$`,this._replaceables$.asObservable()),m(this,`_focusSignal$`,new a.Subject),m(this,`focusSignal$`,this._focusSignal$.asObservable())}dispose(){super.dispose(),this._currentMatch$.next(null),this._currentMatch$.complete(),this._replaceables$.next([]),this._replaceables$.complete(),this._focusSignal$.complete()}getProviders(){return this._providers}getCurrentMatch(){var e;return(e=this._model)==null?void 0:e.getCurrentMatch()}getFindString(){return this._state.findString}changeFindString(e){this._state.changeState({findString:e})}focusFindInput(){this._focusSignal$.next()}changeInputtingFindString(e){e?this._state.changeState({inputtingFindString:e}):this._state.changeState({inputtingFindString:``,findString:``})}changeReplaceString(e){this._state.changeState({replaceString:e})}changeMatchesTheWholeCell(e){this._state.changeState({matchesTheWholeCell:e})}changeCaseSensitive(e){this._state.changeState({caseSensitive:e})}changeFindBy(e){this._state.changeState({findBy:e}),this._toggleDisplayRawFormula(e===`formula`)}changeFindScope(e){this._state.changeState({findScope:e})}changeFindDirection(e){this._state.changeState({findDirection:e})}moveToNextMatch(){this._model&&(this._state.replaceRevealed&&!this._model.searched?(this._state.changeState({findString:this._state.inputtingFindString}),this._model.start()):this._model.moveToNextMatch(),this._focusSignal$.next())}moveToPreviousMatch(){this._model&&(this._state.replaceRevealed&&!this._model.searched?(this._state.changeState({findString:this._state.inputtingFindString}),this._model.start()):this._model.moveToPreviousMatch(),this._focusSignal$.next())}async replace(){return this._model?this._model.replace():!1}async replaceAll(){if(!this._model)throw Error(`[FindReplaceService] replaceAll: model is not initialized!`);return this._model.replaceAll()}revealReplace(){this._state.changeState({replaceRevealed:!0,inputtingFindString:this._state.findString}),this._toggleRevealReplace(!0)}focusSelection(){var e;(e=this._model)==null||e.focusSelection()}start(e=!1){if(this._providers.size===0)return!1;this._model=this._injector.createInstance(b,this._state,this._providers),this._model.currentMatch$.subscribe(e=>this._currentMatch$.next(e)),this._model.replaceables$.subscribe(e=>this._replaceables$.next(e));let t=w();return e&&(t.replaceRevealed=!0),this._state.changeState(t),this._toggleRevealReplace(e),!0}find(){var e;(e=this._model)==null||e.start()}terminate(){var e;(e=this._model)==null||e.dispose(),this._model=null,this._toggleDisplayRawFormula(!1),this._toggleRevealReplace(!1)}registerFindReplaceProvider(e){return this._providers.add(e),(0,t.toDisposable)(()=>this._providers.delete(e))}_toggleRevealReplace(e){this._contextService.setContextValue(u,e)}_toggleDisplayRawFormula(e){this._contextService.setContextValue(i.RENDER_RAW_FORMULA_KEY,e)}};E=g([h(0,(0,t.Inject)(t.Injector)),h(1,t.IContextService)],E);let D={id:`ui.command.replace-current-match`,type:t.CommandType.COMMAND,handler:e=>e.get(v).replace()},O={id:`ui.command.replace-all-matches`,type:t.CommandType.COMMAND,handler:async e=>{let i=e.get(t.IConfirmService),a=e.get(t.LocaleService),o=e.get(r.IMessageService);if(!await i.confirm({id:`CONFIRM_REPLACE_ALL`,title:{title:a.t(`find-replace.replace.confirm.title`)},cancelText:a.t(`button.cancel`),confirmText:a.t(`button.confirm`)}))return!1;let{success:s,failure:c}=await e.get(v).replaceAll();return c>0?(s===0?o.show({type:n.MessageType.Error,content:a.t(`find-replace.replace.all-failure`)}):o.show({type:n.MessageType.Warning,content:a.t(`find-replace.replace.partial-success`,`${s}`,`${c}`)}),!1):(o.show({type:n.MessageType.Success,content:a.t(`find-replace.replace.all-success`,`${s}`)}),!0)}},k={id:`ui.operation.open-find-dialog`,type:t.CommandType.OPERATION,handler:e=>{let t=e.get(v);return t.revealed?t.focusFindInput():t.start(),!0}},A={id:`ui.operation.open-replace-dialog`,type:t.CommandType.OPERATION,handler:e=>{let t=e.get(v);return t.revealed?t.replaceRevealed?t.focusFindInput():t.revealReplace():t.start(!0),!0}},j={type:t.CommandType.OPERATION,id:`ui.operation.go-to-next-match`,handler:e=>(e.get(v).moveToNextMatch(),!0)},M={type:t.CommandType.OPERATION,id:`ui.operation.go-to-previous-match`,handler:e=>(e.get(v).moveToPreviousMatch(),!0)},N={type:t.CommandType.OPERATION,id:`ui.operation.focus-selection`,handler:e=>(e.get(v).focusSelection(),!0)};function P({ref:e,...t}){let{icon:n,id:r,className:i,extend:a,...s}=t,c=`univerjs-icon univerjs-icon-${r} ${i||``}`.trim(),l=(0,o.useRef)(`_${R()}`);return F(n,`${r}`,{defIds:n.defIds,idSuffix:l.current},{ref:e,className:c,...s},a)}function F(e,t,n,r,i){return(0,o.createElement)(e.tag,{key:t,...I(e,n,i),...r},(L(e,n).children||[]).map((r,a)=>F(r,`${t}-${e.tag}-${a}`,n,void 0,i)))}function I(e,t,n){let r={...e.attrs};n!=null&&n.colorChannel1&&r.fill===`colorChannel1`&&(r.fill=n.colorChannel1),e.tag===`mask`&&r.id&&(r.id+=t.idSuffix),Object.entries(r).forEach(([e,n])=>{e===`mask`&&typeof n==`string`&&(r[e]=n.replace(/url\(#(.*)\)/,`url(#$1${t.idSuffix})`))});let{defIds:i}=t;return!i||i.length===0?r:(e.tag===`use`&&r[`xlink:href`]&&(r[`xlink:href`]+=t.idSuffix),Object.entries(r).forEach(([e,n])=>{typeof n==`string`&&(r[e]=n.replace(/url\(#(.*)\)/,`url(#$1${t.idSuffix})`))}),r)}function L(e,t){var n;let{defIds:r}=t;return!r||r.length===0?e:e.tag===`defs`&&(n=e.children)!=null&&n.length?{...e,children:e.children.map(e=>typeof e.attrs.id==`string`&&r&&r.includes(e.attrs.id)?{...e,attrs:{...e.attrs,id:e.attrs.id+t.idSuffix}}:e)}:e}function R(){return Math.random().toString(36).substring(2,8)}P.displayName=`UniverIcon`;let z={tag:`svg`,attrs:{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 16 16`,width:`1em`,height:`1em`},children:[{tag:`path`,attrs:{fill:`currentColor`,d:`M7.71899 1.36938C4.37604 1.36938 1.66602 4.07941 1.66602 7.42236C1.66602 10.7653 4.37604 13.4753 7.71899 13.4753C9.16744 13.4753 10.4971 12.9666 11.5389 12.118L13.6598 14.4109C13.8848 14.6542 14.2644 14.669 14.5077 14.444C14.7509 14.219 14.7657 13.8393 14.5407 13.5961L12.3906 11.2716C13.2536 10.2254 13.772 8.88442 13.772 7.42236C13.772 4.07941 11.0619 1.36938 7.71899 1.36938ZM2.86602 7.42236C2.86602 4.74215 5.03878 2.56938 7.71899 2.56938C10.3992 2.56938 12.572 4.74215 12.572 7.42236C12.572 10.1026 10.3992 12.2753 7.71899 12.2753C5.03878 12.2753 2.86602 10.1026 2.86602 7.42236Z`,fillRule:`evenodd`,clipRule:`evenodd`}}]},B=(0,o.forwardRef)(function(e,t){return(0,o.createElement)(P,Object.assign({},e,{id:`search-icon`,ref:t,icon:z}))});B.displayName=`SearchIcon`;function V(e){let n=e.get(t.IContextService);return{id:k.id,icon:`SearchIcon`,tooltip:`find-replace.toolbar`,type:r.MenuItemType.BUTTON,hidden$:(0,r.getMenuHiddenObservable)(e,t.UniverInstanceType.UNIVER_SHEET),disabled$:(0,a.combineLatest)([n.subscribeContextValue$(t.EDITOR_ACTIVATED),n.subscribeContextValue$(t.FOCUSING_SHEET)]).pipe((0,a.map)(([e,t])=>e||!t))}}let ee={[r.RibbonDataGroup.ORGANIZATION]:{[k.id]:{order:2,menuItemFactory:V}}};function H(e){let{findCompleted:t,localeService:r,matchesCount:i,matchesPosition:a,initialFindString:c,findReplaceService:l,onChange:u,...d}=e,[f,p]=(0,o.useState)(c),m=t&&i===0?r.t(`find-replace.dialog.no-result`):i===0?` `:void 0;function h(e){a===i&&e===1?l.moveToNextMatch():a===1&&e===i||e<a?l.moveToPreviousMatch():l.moveToNextMatch()}return(0,s.jsx)(`div`,{className:`univer-relative univer-flex univer-items-center univer-gap-2`,onDrag:e=>e.stopPropagation(),children:(0,s.jsx)(n.Input,{"data-u-comp":`search-input`,autoFocus:!0,placeholder:r.t(`find-replace.dialog.find-placeholder`),value:f,onChange:e=>{p(e),u==null||u(e)},slot:(0,s.jsx)(n.Pager,{loop:!0,text:m,value:a,total:i,onChange:h}),...d})})}function U(e,t){let n=(0,o.useCallback)(()=>{var e;(e=document.querySelector(`.univer-find-input input`))==null||e.focus()},[]),r=(0,o.useCallback)(()=>{let e=document.querySelectorAll(`[data-u-comp=find-replace-dialog] [data-u-comp=search-input]`);return Array.from(e).some(e=>e===document.activeElement)},[]);return(0,o.useImperativeHandle)(t,()=>({focus:n,selectHasFocus:r})),(0,o.useEffect)(()=>{let t=e.focusSignal$.subscribe(()=>n());return()=>t.unsubscribe()},[e,n]),{focus:n,selectHasFocus:r}}let te=(0,o.forwardRef)(function(e,n){let i=(0,r.useDependency)(t.LocaleService),a=(0,r.useDependency)(v),c=(0,r.useDependency)(t.ICommandService),{findCompleted:l,findString:u,matchesCount:d,matchesPosition:f}=(0,r.useObservable)(a.state$,void 0,!0),p=(0,o.useCallback)(()=>{c.executeCommand(A.id)},[c]),m=(0,r.useDebounceFn)(e=>a.changeFindString(e),500);return U(a,n),(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(H,{findCompleted:l,matchesCount:d,matchesPosition:f,findReplaceService:a,localeService:i,initialFindString:u,onChange:m}),(0,s.jsx)(`div`,{className:`univer-mt-4 univer-text-center`,children:(0,s.jsx)(`a`,{className:`hover:univer-text-primary-500/80 univer-cursor-pointer univer-text-sm univer-text-primary-500 univer-transition-colors`,onClick:p,children:i.t(`find-replace.dialog.advanced-finding`)})})]})}),ne=(0,o.forwardRef)(function(e,i){let a=(0,r.useDependency)(v),c=(0,r.useDependency)(t.LocaleService),l=(0,r.useDependency)(t.ICommandService),u=(0,r.useDependency)(r.IMessageService),d=(0,r.useObservable)(a.currentMatch$,void 0,!0),f=(0,r.useObservable)(a.replaceables$,void 0,!0),{matchesCount:p,matchesPosition:m,findString:h,inputtingFindString:g,replaceString:_,caseSensitive:y,matchesTheWholeCell:b,findDirection:x,findScope:S,findBy:C,findCompleted:w}=(0,r.useObservable)(a.state$,void 0,!0),T=g.length===0,E=p===0||!(d!=null&&d.replaceable),k=f.length===0,A=(0,o.useCallback)(e=>a.changeInputtingFindString(e),[a]),j=(0,o.useCallback)(e=>a.changeReplaceString(e),[a]),{focus:M}=U(a,i),N=(0,o.useCallback)(()=>{h===g?a.moveToNextMatch():(a.changeFindString(g),a.find())},[h,g,a]),P=(0,o.useCallback)(()=>l.executeCommand(D.id),[l]),F=(0,o.useCallback)(async()=>{await l.executeCommand(O.id),M()},[l]),I=(0,o.useCallback)(e=>{a.changeFindDirection(e)},[a]),L=(0,o.useCallback)(e=>{a.changeFindScope(e)},[a]),R=(0,o.useCallback)(e=>{a.changeFindBy(e)},[a]),z=ie(c),B=ae(c),V=oe(c);return(0,o.useEffect)(()=>{w&&p===0&&u.show({content:c.t(`find-replace.dialog.no-match`),type:n.MessageType.Warning,duration:5e3})},[w,p,u,c]),(0,s.jsxs)(`div`,{children:[(0,s.jsx)(n.FormLayout,{label:c.t(`find-replace.dialog.find`),children:(0,s.jsx)(H,{findCompleted:w,className:`univer-find-input`,matchesCount:p,matchesPosition:m,findReplaceService:a,localeService:c,initialFindString:g,onChange:A})}),(0,s.jsx)(n.FormLayout,{label:c.t(`find-replace.dialog.replace`),children:(0,s.jsx)(n.Input,{placeholder:c.t(`find-replace.dialog.replace-placeholder`),value:_,onChange:e=>j(e)})}),(0,s.jsx)(n.FormLayout,{label:c.t(`find-replace.dialog.find-direction.title`),children:(0,s.jsx)(n.Select,{value:x,options:B,onChange:I})}),(0,s.jsx)(n.FormDualColumnLayout,{children:(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(n.FormLayout,{label:c.t(`find-replace.dialog.find-scope.title`),children:(0,s.jsx)(n.Select,{value:S,options:z,onChange:L})}),(0,s.jsx)(n.FormLayout,{label:c.t(`find-replace.dialog.find-by.title`),children:(0,s.jsx)(n.Select,{value:C,options:V,onChange:R})})]})}),(0,s.jsx)(n.FormDualColumnLayout,{children:(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(n.FormLayout,{children:(0,s.jsx)(n.Checkbox,{checked:y,onChange:e=>{a.changeCaseSensitive(e)},children:c.t(`find-replace.dialog.case-sensitive`)})}),(0,s.jsx)(n.FormLayout,{children:(0,s.jsx)(n.Checkbox,{checked:b,onChange:e=>{a.changeMatchesTheWholeCell(e)},children:c.t(`find-replace.dialog.match-the-whole-cell`)})})]})}),(0,s.jsxs)(`div`,{className:`univer-mt-6 univer-flex univer-justify-between`,children:[(0,s.jsx)(n.Button,{variant:`primary`,onClick:N,disabled:T,children:c.t(`find-replace.dialog.find`)}),(0,s.jsxs)(`span`,{className:`univer-inline-flex univer-gap-2`,children:[(0,s.jsx)(n.Button,{disabled:E,onClick:P,children:c.t(`find-replace.dialog.replace`)}),(0,s.jsx)(n.Button,{disabled:k,onClick:F,children:c.t(`find-replace.dialog.replace-all`)})]})]})]})});function re(){let e=(0,r.useDependency)(v),n=(0,r.useDependency)(r.ILayoutService),i=(0,r.useDependency)(t.IContextService),u=(0,r.useObservable)(e.state$,void 0,!0),d=(0,o.useRef)(null);(0,o.useEffect)(()=>{let e;return d.current&&(e=n.registerContainerElement(d.current)),()=>e==null?void 0:e.dispose()},[n]);let f=(0,o.useRef)(null),p=(0,o.useCallback)(e=>i.setContextValue(l,e),[i]),m=(0,o.useCallback)(e=>i.setContextValue(c,e),[i]);return(0,o.useEffect)(()=>{var e;let t=(0,a.fromEvent)(document,`focusin`).subscribe(e=>{var t;e.target&&(t=d.current)!=null&&t.contains(e.target)?p(!0):p(!1),!f.current||!f.current.selectHasFocus()?m(!1):m(!0)});return(e=f.current)==null||e.focus(),p(!0),m(!0),()=>{t.unsubscribe(),p(!1)}},[p,m]),(0,s.jsx)(`div`,{ref:d,"data-u-comp":`find-replace-dialog`,children:u.replaceRevealed?(0,s.jsx)(ne,{ref:f}):(0,s.jsx)(te,{ref:f})})}function ie(e){return(0,o.useMemo)(()=>[{label:e.t(`find-replace.dialog.find-scope.current-sheet`),value:`subunit`},{label:e.t(`find-replace.dialog.find-scope.workbook`),value:`unit`}],[e.getCurrentLocale()])}function ae(e){return(0,o.useMemo)(()=>[{label:e.t(`find-replace.dialog.find-direction.row`),value:`row`},{label:e.t(`find-replace.dialog.find-direction.column`),value:`column`}],[e.getCurrentLocale()])}function oe(e){return(0,o.useMemo)(()=>[{label:e.t(`find-replace.dialog.find-by.value`),value:`value`},{label:e.t(`find-replace.dialog.find-by.formula`),value:`formula`}],[e.getCurrentLocale()])}function W(e){return e.getContextValue(l)}function se(e){return e.getContextValue(u)}function G(e){return e.getContextValue(c)}let K=`7_find-replace-shortcuts`;function q(e){return e.getContextValue(t.FOCUSING_SHEET)}function J(e){return!e.getContextValue(t.EDITOR_ACTIVATED)}let ce={id:k.id,description:`find-replace.shortcut.open-find-dialog`,binding:r.KeyCode.F|r.MetaKeys.CTRL_COMMAND,group:K,preconditions(e){return!W(e)&&q(e)&&J(e)}},le={id:k.id,description:`find-replace.shortcut.open-find-dialog`,binding:r.KeyCode.F|r.MetaKeys.CTRL_COMMAND,mac:r.KeyCode.F|r.MetaKeys.MAC_CTRL,preconditions(e){return!W(e)&&q(e)&&J(e)}},ue={id:A.id,description:`find-replace.shortcut.open-replace-dialog`,binding:r.KeyCode.H|r.MetaKeys.CTRL_COMMAND,mac:r.KeyCode.H|r.MetaKeys.MAC_CTRL,group:K,preconditions(e){return q(e)&&J(e)&&(!W(e)||!se(e))}},de={id:j.id,description:`find-replace.shortcut.go-to-next-match`,binding:r.KeyCode.ENTER,group:K,priority:1e3,preconditions(e){return G(e)&&W(e)}},fe={id:M.id,description:`find-replace.shortcut.go-to-previous-match`,binding:r.KeyCode.ENTER|r.MetaKeys.SHIFT,group:K,priority:1e3,preconditions(e){return G(e)&&W(e)}},pe={id:N.id,description:`find-replace.shortcut.focus-selection`,binding:r.KeyCode.ESC,group:K,priority:1e3,preconditions(e){return W(e)}},Y=`DESKTOP_FIND_REPLACE_DIALOG`,X=class extends t.RxDisposable{constructor(e,t,n,r,i,a,o,s,c){super(),this._univerInstanceService=e,this._menuManagerService=t,this._shortcutService=n,this._commandService=r,this._findReplaceService=i,this._dialogService=a,this._layoutService=o,this._localeService=s,this._componentManager=c,m(this,`_closingListenerDisposable`,void 0),this._initCommands(),this._initUI(),this._initShortcuts()}dispose(){var e;super.dispose(),(e=this._closingListenerDisposable)==null||e.dispose(),this._closingListenerDisposable=null}_initCommands(){[k,A,j,M,O,D,N].forEach(e=>{this.disposeWithMe(this._commandService.registerCommand(e))})}_initShortcuts(){[ue,ce,le,fe,de,pe].forEach(e=>this.disposeWithMe(this._shortcutService.registerShortcut(e)))}_initUI(){[[`FindReplaceDialog`,re],[`SearchIcon`,B]].forEach(([e,t])=>{this.disposeWithMe(this._componentManager.register(e,t))}),this._menuManagerService.mergeMenu(ee),this._findReplaceService.stateUpdates$.pipe((0,a.takeUntil)(this.dispose$)).subscribe(e=>{e.revealed===!0&&this._openPanel()})}_openPanel(){this._dialogService.open({id:Y,draggable:!0,width:350,title:{title:this._localeService.t(`find-replace.dialog.title`)},children:{label:`FindReplaceDialog`},destroyOnClose:!0,mask:!1,maskClosable:!1,defaultPosition:me(),preservePositionOnDestroy:!0,onClose:()=>this.closePanel()}),this._closingListenerDisposable=(0,t.toDisposable)(this._univerInstanceService.focused$.pipe((0,a.takeUntil)(this.dispose$)).subscribe(e=>{(!e||!this._univerInstanceService.getUniverSheetInstance(e))&&this.closePanel()}))}closePanel(){this._closingListenerDisposable&&(this._closingListenerDisposable.dispose(),this._closingListenerDisposable=null,this._dialogService.close(Y),this._findReplaceService.terminate(),queueMicrotask(()=>this._layoutService.focus()))}};X=g([h(0,t.IUniverInstanceService),h(1,r.IMenuManagerService),h(2,r.IShortcutService),h(3,t.ICommandService),h(4,v),h(5,r.IDialogService),h(6,r.ILayoutService),h(7,(0,t.Inject)(t.LocaleService)),h(8,(0,t.Inject)(r.ComponentManager))],X);function me(){let{innerWidth:e}=window;return{x:e-350-20,y:64}}var he=`@univerjs/find-replace`,ge=`0.21.1-insiders.20260509-bf98cad`;let Z=`find-replace.config`;Symbol(Z);let Q={},$=class extends t.Plugin{constructor(e=Q,n,r){super(),this._config=e,this._injector=n,this._configService=r;let{...i}=(0,t.merge)({},Q,this._config);this._configService.setConfig(Z,i)}onStarting(){[[X],[v,{useClass:E}]].forEach(e=>this._injector.add(e))}onRendered(){this._injector.get(X)}};m($,`pluginName`,`UNIVER_FIND_REPLACE_PLUGIN`),m($,`packageName`,he),m($,`version`,ge),$=g([h(1,(0,t.Inject)(t.Injector)),h(2,t.IConfigService)],$),e.FindBy=S,e.FindDirection=x,e.FindModel=_,Object.defineProperty(e,`FindReplaceController`,{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,`FindReplaceModel`,{enumerable:!0,get:function(){return b}}),e.FindReplaceState=T,e.FindScope=C,e.GoToNextMatchOperation=j,e.GoToPreviousMatchOperation=M,e.IFindReplaceService=v,e.OpenFindDialogOperation=k,e.OpenReplaceDialogOperation=A,e.ReplaceAllMatchesCommand=O,e.ReplaceCurrentMatchCommand=D,Object.defineProperty(e,`UniverFindReplacePlugin`,{enumerable:!0,get:function(){return $}}),e.createInitFindReplaceState=w});
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "@univerjs/find-replace",
3
- "version": "0.21.0",
3
+ "version": "0.21.1-insiders.20260509-bf98cad",
4
4
  "private": false,
5
- "description": "",
6
- "author": "DreamNum <developer@univer.ai>",
5
+ "description": "Shared find and replace services and UI infrastructure for Univer.",
6
+ "author": "DreamNum Co., Ltd. <developer@univer.ai>",
7
7
  "license": "Apache-2.0",
8
8
  "funding": {
9
9
  "type": "opencollective",
@@ -18,7 +18,11 @@
18
18
  "url": "https://github.com/dream-num/univer/issues"
19
19
  },
20
20
  "keywords": [
21
- "univer"
21
+ "univer",
22
+ "find-replace",
23
+ "search",
24
+ "replace",
25
+ "plugin"
22
26
  ],
23
27
  "exports": {
24
28
  ".": {
@@ -55,19 +59,19 @@
55
59
  },
56
60
  "dependencies": {
57
61
  "@univerjs/icons": "^1.1.1",
58
- "@univerjs/core": "0.21.0",
59
- "@univerjs/design": "0.21.0",
60
- "@univerjs/engine-render": "0.21.0",
61
- "@univerjs/ui": "0.21.0"
62
+ "@univerjs/core": "0.21.1-insiders.20260509-bf98cad",
63
+ "@univerjs/design": "0.21.1-insiders.20260509-bf98cad",
64
+ "@univerjs/engine-render": "0.21.1-insiders.20260509-bf98cad",
65
+ "@univerjs/ui": "0.21.1-insiders.20260509-bf98cad"
62
66
  },
63
67
  "devDependencies": {
64
- "postcss": "^8.5.10",
68
+ "postcss": "^8.5.14",
65
69
  "react": "18.3.1",
66
70
  "rxjs": "^7.8.2",
67
71
  "tailwindcss": "3.4.18",
68
- "typescript": "^6.0.2",
69
- "vitest": "^4.1.4",
70
- "@univerjs-infra/shared": "0.21.0"
72
+ "typescript": "^6.0.3",
73
+ "vitest": "^4.1.5",
74
+ "@univerjs-infra/shared": "0.21.1"
71
75
  },
72
76
  "scripts": {
73
77
  "test": "vitest run",
package/LICENSE DELETED
@@ -1,176 +0,0 @@
1
- Apache License
2
- Version 2.0, January 2004
3
- http://www.apache.org/licenses/
4
-
5
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
-
7
- 1. Definitions.
8
-
9
- "License" shall mean the terms and conditions for use, reproduction,
10
- and distribution as defined by Sections 1 through 9 of this document.
11
-
12
- "Licensor" shall mean the copyright owner or entity authorized by
13
- the copyright owner that is granting the License.
14
-
15
- "Legal Entity" shall mean the union of the acting entity and all
16
- other entities that control, are controlled by, or are under common
17
- control with that entity. For the purposes of this definition,
18
- "control" means (i) the power, direct or indirect, to cause the
19
- direction or management of such entity, whether by contract or
20
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
- outstanding shares, or (iii) beneficial ownership of such entity.
22
-
23
- "You" (or "Your") shall mean an individual or Legal Entity
24
- exercising permissions granted by this License.
25
-
26
- "Source" form shall mean the preferred form for making modifications,
27
- including but not limited to software source code, documentation
28
- source, and configuration files.
29
-
30
- "Object" form shall mean any form resulting from mechanical
31
- transformation or translation of a Source form, including but
32
- not limited to compiled object code, generated documentation,
33
- and conversions to other media types.
34
-
35
- "Work" shall mean the work of authorship, whether in Source or
36
- Object form, made available under the License, as indicated by a
37
- copyright notice that is included in or attached to the work
38
- (an example is provided in the Appendix below).
39
-
40
- "Derivative Works" shall mean any work, whether in Source or Object
41
- form, that is based on (or derived from) the Work and for which the
42
- editorial revisions, annotations, elaborations, or other modifications
43
- represent, as a whole, an original work of authorship. For the purposes
44
- of this License, Derivative Works shall not include works that remain
45
- separable from, or merely link (or bind by name) to the interfaces of,
46
- the Work and Derivative Works thereof.
47
-
48
- "Contribution" shall mean any work of authorship, including
49
- the original version of the Work and any modifications or additions
50
- to that Work or Derivative Works thereof, that is intentionally
51
- submitted to Licensor for inclusion in the Work by the copyright owner
52
- or by an individual or Legal Entity authorized to submit on behalf of
53
- the copyright owner. For the purposes of this definition, "submitted"
54
- means any form of electronic, verbal, or written communication sent
55
- to the Licensor or its representatives, including but not limited to
56
- communication on electronic mailing lists, source code control systems,
57
- and issue tracking systems that are managed by, or on behalf of, the
58
- Licensor for the purpose of discussing and improving the Work, but
59
- excluding communication that is conspicuously marked or otherwise
60
- designated in writing by the copyright owner as "Not a Contribution."
61
-
62
- "Contributor" shall mean Licensor and any individual or Legal Entity
63
- on behalf of whom a Contribution has been received by Licensor and
64
- subsequently incorporated within the Work.
65
-
66
- 2. Grant of Copyright License. Subject to the terms and conditions of
67
- this License, each Contributor hereby grants to You a perpetual,
68
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
- copyright license to reproduce, prepare Derivative Works of,
70
- publicly display, publicly perform, sublicense, and distribute the
71
- Work and such Derivative Works in Source or Object form.
72
-
73
- 3. Grant of Patent License. Subject to the terms and conditions of
74
- this License, each Contributor hereby grants to You a perpetual,
75
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
- (except as stated in this section) patent license to make, have made,
77
- use, offer to sell, sell, import, and otherwise transfer the Work,
78
- where such license applies only to those patent claims licensable
79
- by such Contributor that are necessarily infringed by their
80
- Contribution(s) alone or by combination of their Contribution(s)
81
- with the Work to which such Contribution(s) was submitted. If You
82
- institute patent litigation against any entity (including a
83
- cross-claim or counterclaim in a lawsuit) alleging that the Work
84
- or a Contribution incorporated within the Work constitutes direct
85
- or contributory patent infringement, then any patent licenses
86
- granted to You under this License for that Work shall terminate
87
- as of the date such litigation is filed.
88
-
89
- 4. Redistribution. You may reproduce and distribute copies of the
90
- Work or Derivative Works thereof in any medium, with or without
91
- modifications, and in Source or Object form, provided that You
92
- meet the following conditions:
93
-
94
- (a) You must give any other recipients of the Work or
95
- Derivative Works a copy of this License; and
96
-
97
- (b) You must cause any modified files to carry prominent notices
98
- stating that You changed the files; and
99
-
100
- (c) You must retain, in the Source form of any Derivative Works
101
- that You distribute, all copyright, patent, trademark, and
102
- attribution notices from the Source form of the Work,
103
- excluding those notices that do not pertain to any part of
104
- the Derivative Works; and
105
-
106
- (d) If the Work includes a "NOTICE" text file as part of its
107
- distribution, then any Derivative Works that You distribute must
108
- include a readable copy of the attribution notices contained
109
- within such NOTICE file, excluding those notices that do not
110
- pertain to any part of the Derivative Works, in at least one
111
- of the following places: within a NOTICE text file distributed
112
- as part of the Derivative Works; within the Source form or
113
- documentation, if provided along with the Derivative Works; or,
114
- within a display generated by the Derivative Works, if and
115
- wherever such third-party notices normally appear. The contents
116
- of the NOTICE file are for informational purposes only and
117
- do not modify the License. You may add Your own attribution
118
- notices within Derivative Works that You distribute, alongside
119
- or as an addendum to the NOTICE text from the Work, provided
120
- that such additional attribution notices cannot be construed
121
- as modifying the License.
122
-
123
- You may add Your own copyright statement to Your modifications and
124
- may provide additional or different license terms and conditions
125
- for use, reproduction, or distribution of Your modifications, or
126
- for any such Derivative Works as a whole, provided Your use,
127
- reproduction, and distribution of the Work otherwise complies with
128
- the conditions stated in this License.
129
-
130
- 5. Submission of Contributions. Unless You explicitly state otherwise,
131
- any Contribution intentionally submitted for inclusion in the Work
132
- by You to the Licensor shall be under the terms and conditions of
133
- this License, without any additional terms or conditions.
134
- Notwithstanding the above, nothing herein shall supersede or modify
135
- the terms of any separate license agreement you may have executed
136
- with Licensor regarding such Contributions.
137
-
138
- 6. Trademarks. This License does not grant permission to use the trade
139
- names, trademarks, service marks, or product names of the Licensor,
140
- except as required for reasonable and customary use in describing the
141
- origin of the Work and reproducing the content of the NOTICE file.
142
-
143
- 7. Disclaimer of Warranty. Unless required by applicable law or
144
- agreed to in writing, Licensor provides the Work (and each
145
- Contributor provides its Contributions) on an "AS IS" BASIS,
146
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
- implied, including, without limitation, any warranties or conditions
148
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
- PARTICULAR PURPOSE. You are solely responsible for determining the
150
- appropriateness of using or redistributing the Work and assume any
151
- risks associated with Your exercise of permissions under this License.
152
-
153
- 8. Limitation of Liability. In no event and under no legal theory,
154
- whether in tort (including negligence), contract, or otherwise,
155
- unless required by applicable law (such as deliberate and grossly
156
- negligent acts) or agreed to in writing, shall any Contributor be
157
- liable to You for damages, including any direct, indirect, special,
158
- incidental, or consequential damages of any character arising as a
159
- result of this License or out of the use or inability to use the
160
- Work (including but not limited to damages for loss of goodwill,
161
- work stoppage, computer failure or malfunction, or any and all
162
- other commercial damages or losses), even if such Contributor
163
- has been advised of the possibility of such damages.
164
-
165
- 9. Accepting Warranty or Additional Liability. While redistributing
166
- the Work or Derivative Works thereof, You may choose to offer,
167
- and charge a fee for, acceptance of support, warranty, indemnity,
168
- or other liability obligations and/or rights consistent with this
169
- License. However, in accepting such obligations, You may act only
170
- on Your own behalf and on Your sole responsibility, not on behalf
171
- of any other Contributor, and only if You agree to indemnify,
172
- defend, and hold each Contributor harmless for any liability
173
- incurred by, or claims asserted against, such Contributor by reason
174
- of your accepting any such warranty or additional liability.
175
-
176
- END OF TERMS AND CONDITIONS