@univerjs/sheets-conditional-formatting 0.15.4 → 0.15.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/es/index.js CHANGED
@@ -1,16 +1,16 @@
1
1
  var H2 = Object.defineProperty;
2
2
  var j2 = (s, r, t) => r in s ? H2(s, r, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[r] = t;
3
3
  var m = (s, r, t) => j2(s, typeof r != "symbol" ? r + "" : r, t);
4
- import { generateRandomId as X2, Tools as J, CommandType as O, IUndoRedoService as e2, ICommandService as W, IUniverInstanceService as q, ObjectMatrix as V, Range as T, sequenceExecute as B2, Inject as b, Disposable as x2, RefAlias as K2, CellValueType as M, BooleanNumber as N2, LRUMap as T2, ColorKit as U2, dayjs as v, Injector as M2, RTree as Y2, IResourceManagerService as J2, merge as V2, UniverInstanceType as D2, isInternalEditorID as z2, Rectangle as n2, DependentOn as Q2, IConfigService as e0, Plugin as t0, touchDependencies as n0 } from "@univerjs/core";
5
- import { isRangesEqual as X1 } from "@univerjs/core";
6
- import { getSheetCommandTarget as t2, SheetsSelectionsService as r0, findAllRectangle as s0, createTopMatrixFromMatrix as i0, SheetInterceptorService as a0, RemoveSheetCommand as l0, CopySheetCommand as o0, ReorderRangeMutation as u0, MoveRangeMutation as c0, MoveColsMutation as d0, MoveRowsMutation as h0, InsertRowMutation as g0, RemoveRowMutation as C0, RemoveColMutation as f0, InsertColMutation as D0, SetRangeValuesMutation as m0 } from "@univerjs/sheets";
7
- import { Subject as d2, BehaviorSubject as F0 } from "rxjs";
8
- import { RegisterOtherFormulaService as w0, FormulaResultStatus as p, OtherFormulaBizType as v0, ERROR_TYPE_SET as R2, BooleanValue as I2, UniverFormulaEnginePlugin as p0 } from "@univerjs/engine-formula";
9
- import { distinctUntilChanged as E0, bufferTime as A0, filter as _0, map as x0 } from "rxjs/operators";
10
- import { isObject as M0, SpreadsheetExtensionRegistry as O2, SheetExtension as $2, FIX_ONE_PIXEL_BLUR_OFFSET as y0 } from "@univerjs/engine-render";
4
+ import { generateRandomId as K2, Tools as z, CommandType as $, IUndoRedoService as t2, ICommandService as q, IUniverInstanceService as Z, ObjectMatrix as O, Range as U, sequenceExecute as k2, Inject as b, Disposable as x2, RefAlias as Y2, CellValueType as y, BooleanNumber as B2, LRUMap as N2, ColorKit as T2, dayjs as v, Injector as _2, RTree as X2, IResourceManagerService as J2, merge as U2, UniverInstanceType as V2, isInternalEditorID as z2, Rectangle as n2, DependentOn as Q2, IConfigService as e0, Plugin as t0, touchDependencies as n0 } from "@univerjs/core";
5
+ import { isRangesEqual as H1 } from "@univerjs/core";
6
+ import { getSheetCommandTarget as k, SheetsSelectionsService as r0, findAllRectangle as s0, createTopMatrixFromMatrix as i0, SheetInterceptorService as a0, RemoveSheetCommand as l0, CopySheetCommand as o0, ReorderRangeMutation as u0, MoveRangeMutation as c0, MoveColsMutation as d0, MoveRowsMutation as h0, InsertRowMutation as g0, RemoveRowMutation as C0, RemoveColMutation as f0, InsertColMutation as D0, SetRangeValuesMutation as m0 } from "@univerjs/sheets";
7
+ import { Subject as d2, BehaviorSubject as w0 } from "rxjs";
8
+ import { RegisterOtherFormulaService as F0, FormulaResultStatus as p, OtherFormulaBizType as v0, ERROR_TYPE_SET as M2, BooleanValue as R2, UniverFormulaEnginePlugin as p0 } from "@univerjs/engine-formula";
9
+ import { distinctUntilChanged as E0, bufferTime as A0, filter as x0, map as _0 } from "rxjs/operators";
10
+ import { isObject as y0, SpreadsheetExtensionRegistry as O2, SheetExtension as $2, FIX_ONE_PIXEL_BLUR_OFFSET as M0 } from "@univerjs/engine-render";
11
11
  const P2 = "SHEET_CONDITIONAL_FORMATTING_PLUGIN";
12
- var B = /* @__PURE__ */ ((s) => (s.beginsWith = "beginsWith", s.endsWith = "endsWith", s.containsText = "containsText", s.notContainsText = "notContainsText", s.equal = "equal", s.notEqual = "notEqual", s.containsBlanks = "containsBlanks", s.notContainsBlanks = "notContainsBlanks", s.containsErrors = "containsErrors", s.notContainsErrors = "notContainsErrors", s))(B || {}), N = /* @__PURE__ */ ((s) => (s.today = "today", s.yesterday = "yesterday", s.tomorrow = "tomorrow", s.last7Days = "last7Days", s.thisMonth = "thisMonth", s.lastMonth = "lastMonth", s.nextMonth = "nextMonth", s.thisWeek = "thisWeek", s.lastWeek = "lastWeek", s.nextWeek = "nextWeek", s))(N || {}), w = /* @__PURE__ */ ((s) => (s.greaterThan = "greaterThan", s.greaterThanOrEqual = "greaterThanOrEqual", s.lessThan = "lessThan", s.lessThanOrEqual = "lessThanOrEqual", s.notBetween = "notBetween", s.between = "between", s.equal = "equal", s.notEqual = "notEqual", s))(w || {}), y = /* @__PURE__ */ ((s) => (s.highlightCell = "highlightCell", s.dataBar = "dataBar", s.colorScale = "colorScale", s.iconSet = "iconSet", s))(y || {}), _ = /* @__PURE__ */ ((s) => (s.uniqueValues = "uniqueValues", s.duplicateValues = "duplicateValues", s.rank = "rank", s.text = "text", s.timePeriod = "timePeriod", s.number = "number", s.average = "average", s.formula = "formula", s))(_ || {}), L = /* @__PURE__ */ ((s) => (s.num = "num", s.min = "min", s.max = "max", s.percent = "percent", s.percentile = "percentile", s.formula = "formula", s))(L || {});
13
- const V1 = "#fff", O1 = "#000000", $1 = () => ({
12
+ var N = /* @__PURE__ */ ((s) => (s.beginsWith = "beginsWith", s.endsWith = "endsWith", s.containsText = "containsText", s.notContainsText = "notContainsText", s.equal = "equal", s.notEqual = "notEqual", s.containsBlanks = "containsBlanks", s.notContainsBlanks = "notContainsBlanks", s.containsErrors = "containsErrors", s.notContainsErrors = "notContainsErrors", s))(N || {}), T = /* @__PURE__ */ ((s) => (s.today = "today", s.yesterday = "yesterday", s.tomorrow = "tomorrow", s.last7Days = "last7Days", s.thisMonth = "thisMonth", s.lastMonth = "lastMonth", s.nextMonth = "nextMonth", s.thisWeek = "thisWeek", s.lastWeek = "lastWeek", s.nextWeek = "nextWeek", s))(T || {}), F = /* @__PURE__ */ ((s) => (s.greaterThan = "greaterThan", s.greaterThanOrEqual = "greaterThanOrEqual", s.lessThan = "lessThan", s.lessThanOrEqual = "lessThanOrEqual", s.notBetween = "notBetween", s.between = "between", s.equal = "equal", s.notEqual = "notEqual", s))(F || {}), M = /* @__PURE__ */ ((s) => (s.highlightCell = "highlightCell", s.dataBar = "dataBar", s.colorScale = "colorScale", s.iconSet = "iconSet", s))(M || {}), x = /* @__PURE__ */ ((s) => (s.uniqueValues = "uniqueValues", s.duplicateValues = "duplicateValues", s.rank = "rank", s.text = "text", s.timePeriod = "timePeriod", s.number = "number", s.average = "average", s.formula = "formula", s))(x || {}), L = /* @__PURE__ */ ((s) => (s.num = "num", s.min = "min", s.max = "max", s.percent = "percent", s.percentile = "percentile", s.formula = "formula", s))(L || {});
13
+ const T1 = "#fff", U1 = "#000000", V1 = () => ({
14
14
  cfId: void 0,
15
15
  ranges: [],
16
16
  stopIfTrue: !1,
@@ -20,7 +20,7 @@ const V1 = "#fff", O1 = "#000000", $1 = () => ({
20
20
  operator: "containsText"
21
21
  /* containsText */
22
22
  }
23
- }), P1 = (s, r) => {
23
+ }), O1 = (s, r) => {
24
24
  switch (s) {
25
25
  case "text": {
26
26
  if ([
@@ -43,7 +43,7 @@ const V1 = "#fff", O1 = "#000000", $1 = () => ({
43
43
  ].includes(r) ? [10, 100] : 10;
44
44
  }
45
45
  return "";
46
- }, W1 = (s, r) => {
46
+ }, $1 = (s, r) => {
47
47
  switch (s) {
48
48
  case "formula":
49
49
  return "=";
@@ -56,7 +56,7 @@ const V1 = "#fff", O1 = "#000000", $1 = () => ({
56
56
  return r !== void 0 ? r : 10;
57
57
  }
58
58
  return "";
59
- }, X = (s, r, t) => {
59
+ }, Y = (s, r, t) => {
60
60
  if (!r)
61
61
  return null;
62
62
  const e = r.findIndex((n) => t(n) === s.id);
@@ -73,12 +73,12 @@ const V1 = "#fff", O1 = "#000000", $1 = () => ({
73
73
  }, R0 = (s, r, t, e) => {
74
74
  if (!t)
75
75
  return null;
76
- const n = X(s, t, e);
77
- let i = X(r, t, e);
76
+ const n = Y(s, t, e);
77
+ let i = Y(r, t, e);
78
78
  if (n === null || i === null || n === i)
79
79
  return;
80
80
  const a = t.splice(n, 1)[0];
81
- switch (n < i && (i = X(r, t, e)), r.type) {
81
+ switch (n < i && (i = Y(r, t, e)), r.type) {
82
82
  case "before": {
83
83
  t.splice(i + 1, 0, a);
84
84
  break;
@@ -94,7 +94,7 @@ const V1 = "#fff", O1 = "#000000", $1 = () => ({
94
94
  return [s, r];
95
95
  const n = { ...s }, i = { ...r };
96
96
  if (n.type !== "after") {
97
- const a = X(n, t, e);
97
+ const a = Y(n, t, e);
98
98
  if (a === null)
99
99
  return null;
100
100
  if (a - 1 < 0) {
@@ -109,7 +109,7 @@ const V1 = "#fff", O1 = "#000000", $1 = () => ({
109
109
  }
110
110
  }
111
111
  if (!["after", "before"].includes(i.type)) {
112
- const a = X(i, t, e);
112
+ const a = Y(i, t, e);
113
113
  if (a === null)
114
114
  return null;
115
115
  if (a === 0)
@@ -132,7 +132,7 @@ const V1 = "#fff", O1 = "#000000", $1 = () => ({
132
132
  return [r, { ...s, type: "self" }];
133
133
  }
134
134
  return null;
135
- }, q1 = (s, r) => s.id === r.id && s.type === r.type, S0 = () => `${X2(8)}`;
135
+ }, P1 = (s, r) => s.id === r.id && s.type === r.type, S0 = () => `${K2(8)}`;
136
136
  class R {
137
137
  constructor() {
138
138
  // Map<unitID ,<sheetId ,IConditionFormattingRule[]>>
@@ -173,7 +173,7 @@ class R {
173
173
  setRule(r, t, e, n) {
174
174
  const a = this._ensureList(r, t).find((c) => c.cfId === n);
175
175
  if (a) {
176
- const c = J.deepClone(a);
176
+ const c = z.deepClone(a);
177
177
  Object.assign(a, e), this._ruleChange$.next({ rule: a, subUnitId: t, unitId: r, type: "set", oldRule: c });
178
178
  }
179
179
  }
@@ -186,11 +186,11 @@ class R {
186
186
  * if targetId does not exist, it defaults to top
187
187
  */
188
188
  moveRulePriority(r, t, e, n) {
189
- const i = this._ensureList(r, t), a = X(e, i, (o) => o.cfId), c = X(n, i, (o) => o.cfId);
189
+ const i = this._ensureList(r, t), a = Y(e, i, (l) => l.cfId), c = Y(n, i, (l) => l.cfId);
190
190
  if (c === null || a === null || c === a)
191
191
  return;
192
- const l = i[a];
193
- l && (R0(e, n, i, (o) => o.cfId), this._ruleChange$.next({ rule: l, subUnitId: t, unitId: r, type: "sort" }));
192
+ const o = i[a];
193
+ o && (R0(e, n, i, (l) => l.cfId), this._ruleChange$.next({ rule: o, subUnitId: t, unitId: r, type: "sort" }));
194
194
  }
195
195
  createCfId(r, t) {
196
196
  return S0();
@@ -200,7 +200,7 @@ class R {
200
200
  }
201
201
  }
202
202
  const i2 = {
203
- type: O.MUTATION,
203
+ type: $.MUTATION,
204
204
  id: "sheet.mutation.move-conditional-rule",
205
205
  handler(s, r) {
206
206
  if (!r)
@@ -216,17 +216,17 @@ const i2 = {
216
216
  return [
217
217
  { id: i2.id, params: { unitId: r, subUnitId: t, start: n, end: i } }
218
218
  ];
219
- }, m2 = (s, r) => {
220
- const t = s.get(R), { unitId: e, subUnitId: n, cfId: i } = r, a = [...t.getSubunitRules(e, n) || []], c = a.findIndex((o) => o.cfId === i), l = a[c - 1];
219
+ }, D2 = (s, r) => {
220
+ const t = s.get(R), { unitId: e, subUnitId: n, cfId: i } = r, a = [...t.getSubunitRules(e, n) || []], c = a.findIndex((l) => l.cfId === i), o = a[c - 1];
221
221
  if (c > -1) {
222
- const o = a[c], d = [{
222
+ const l = a[c], d = [{
223
223
  id: a2.id,
224
- params: { unitId: e, subUnitId: n, rule: J.deepClone(o) }
224
+ params: { unitId: e, subUnitId: n, rule: z.deepClone(l) }
225
225
  }];
226
226
  if (a.splice(c, 1), c !== 0) {
227
227
  const u = a[0];
228
228
  if (u) {
229
- const h = W2({ id: u.cfId, type: "before" }, { id: l.cfId, type: "after" }, a, (F) => F.cfId);
229
+ const h = W2({ id: u.cfId, type: "before" }, { id: o.cfId, type: "after" }, a, (w) => w.cfId);
230
230
  if (!h)
231
231
  return d;
232
232
  const [g, f] = h, D = {
@@ -241,8 +241,8 @@ const i2 = {
241
241
  return d;
242
242
  }
243
243
  return [];
244
- }, K = {
245
- type: O.MUTATION,
244
+ }, X = {
245
+ type: $.MUTATION,
246
246
  id: "sheet.mutation.delete-conditional-rule",
247
247
  handler(s, r) {
248
248
  if (!r)
@@ -250,8 +250,8 @@ const i2 = {
250
250
  const { unitId: t, subUnitId: e, cfId: n } = r;
251
251
  return s.get(R).deleteRule(t, e, n), !0;
252
252
  }
253
- }, q2 = (s, r) => ({ id: K.id, params: { unitId: r.unitId, subUnitId: r.subUnitId, cfId: r.rule.cfId } }), a2 = {
254
- type: O.MUTATION,
253
+ }, q2 = (s, r) => ({ id: X.id, params: { unitId: r.unitId, subUnitId: r.subUnitId, cfId: r.rule.cfId } }), a2 = {
254
+ type: $.MUTATION,
255
255
  id: "sheet.mutation.add-conditional-rule",
256
256
  handler(s, r) {
257
257
  if (!r)
@@ -260,22 +260,22 @@ const i2 = {
260
260
  return s.get(R).addRule(t, e, n), !0;
261
261
  }
262
262
  }, L0 = {
263
- type: O.COMMAND,
263
+ type: $.COMMAND,
264
264
  id: "sheet.command.add-conditional-rule",
265
265
  handler(s, r) {
266
266
  if (!r)
267
267
  return !1;
268
- const { rule: t } = r, e = s.get(e2), n = s.get(W), i = s.get(R), a = s.get(q), c = t2(a, r);
268
+ const { rule: t } = r, e = s.get(t2), n = s.get(q), i = s.get(R), a = s.get(Z), c = k(a, r);
269
269
  if (!c) return !1;
270
- const { unitId: l, subUnitId: o } = c, d = i.createCfId(l, o), u = { unitId: l, subUnitId: o, rule: { ...t, cfId: t.cfId || d } }, h = q2(s, u), g = n.syncExecuteCommand(a2.id, u);
270
+ const { unitId: o, subUnitId: l } = c, d = i.createCfId(o, l), u = { unitId: o, subUnitId: l, rule: { ...t, cfId: t.cfId || d } }, h = q2(s, u), g = n.syncExecuteCommand(a2.id, u);
271
271
  return g && e.pushUndoRedo({
272
- unitID: l,
272
+ unitID: o,
273
273
  redoMutations: [{ id: a2.id, params: u }],
274
274
  undoMutations: [h]
275
275
  }), g;
276
276
  }
277
277
  }, l2 = {
278
- type: O.MUTATION,
278
+ type: $.MUTATION,
279
279
  id: "sheet.mutation.set-conditional-rule",
280
280
  handler(s, r) {
281
281
  if (!r)
@@ -291,59 +291,59 @@ const i2 = {
291
291
  unitId: e,
292
292
  subUnitId: n,
293
293
  cfId: i,
294
- rule: J.deepClone(a)
294
+ rule: z.deepClone(a)
295
295
  }
296
296
  }] : [];
297
297
  }, k0 = {
298
- type: O.COMMAND,
298
+ type: $.COMMAND,
299
299
  id: "sheet.command.clear-range-conditional-rule",
300
300
  handler(s, r) {
301
301
  var D;
302
302
  if (!r)
303
303
  return !1;
304
- const t = s.get(R), e = s.get(q), n = s.get(W), i = s.get(e2), a = s.get(r0), c = t2(e, r);
304
+ const t = s.get(R), e = s.get(Z), n = s.get(q), i = s.get(t2), a = s.get(r0), c = k(e, r);
305
305
  if (!c) return !1;
306
- const { unitId: l, subUnitId: o } = c, d = ((D = a.getCurrentSelections()) == null ? void 0 : D.map((F) => F.range)) || [], u = t.getSubunitRules(l, o);
306
+ const { unitId: o, subUnitId: l } = c, d = ((D = a.getCurrentSelections()) == null ? void 0 : D.map((w) => w.range)) || [], u = t.getSubunitRules(o, l);
307
307
  if (!(u != null && u.length) || !d.length)
308
308
  return !1;
309
309
  const h = [], g = [];
310
- u.forEach((F) => {
311
- const E = new V();
312
- F.ranges.forEach((A) => {
313
- T.foreach(A, (S, k) => {
314
- E.setValue(S, k, 1);
310
+ u.forEach((w) => {
311
+ const E = new O();
312
+ w.ranges.forEach((A) => {
313
+ U.foreach(A, (S, B) => {
314
+ E.setValue(S, B, 1);
315
315
  });
316
316
  }), d.forEach((A) => {
317
- T.foreach(A, (S, k) => {
318
- E.realDeleteValue(S, k);
317
+ U.foreach(A, (S, B) => {
318
+ E.realDeleteValue(S, B);
319
319
  });
320
320
  });
321
321
  const I = s0(i0(E));
322
322
  if (I.length) {
323
- const A = { ...F, ranges: I }, S = { unitId: l, subUnitId: o, rule: A }, k = Z2(s, S);
324
- h.push({ id: l2.id, params: S }), g.push(...k);
323
+ const A = { ...w, ranges: I }, S = { unitId: o, subUnitId: l, rule: A }, B = Z2(s, S);
324
+ h.push({ id: l2.id, params: S }), g.push(...B);
325
325
  } else {
326
- const A = { unitId: l, subUnitId: o, cfId: F.cfId }, S = m2(s, A);
327
- h.push({ id: K.id, params: A }), g.push(...S);
326
+ const A = { unitId: o, subUnitId: l, cfId: w.cfId }, S = D2(s, A);
327
+ h.push({ id: X.id, params: A }), g.push(...S);
328
328
  }
329
329
  });
330
- const f = B2(h, n).result;
330
+ const f = k2(h, n).result;
331
331
  return f && i.pushUndoRedo({
332
- unitID: l,
332
+ unitID: o,
333
333
  redoMutations: h,
334
334
  undoMutations: g
335
335
  }), f;
336
336
  }
337
337
  }, B0 = {
338
- type: O.COMMAND,
338
+ type: $.COMMAND,
339
339
  id: "sheet.command.clear-worksheet-conditional-rule",
340
340
  handler(s, r) {
341
- const t = s.get(R), e = s.get(q), n = s.get(W), i = s.get(e2), a = t2(e, r);
341
+ const t = s.get(R), e = s.get(Z), n = s.get(q), i = s.get(t2), a = k(e, r);
342
342
  if (!a) return !1;
343
- const { unitId: c, subUnitId: l } = a, o = t.getSubunitRules(c, l);
344
- if (!(o != null && o.length))
343
+ const { unitId: c, subUnitId: o } = a, l = t.getSubunitRules(c, o);
344
+ if (!(l != null && l.length))
345
345
  return !1;
346
- const d = o.map((f) => ({ cfId: f.cfId, unitId: c, subUnitId: l })), u = d.map((f) => ({ id: K.id, params: f })), h = d.map((f) => m2(s, f)[0]), g = B2(u, n).result;
346
+ const d = l.map((f) => ({ cfId: f.cfId, unitId: c, subUnitId: o })), u = d.map((f) => ({ id: X.id, params: f })), h = d.map((f) => D2(s, f)[0]), g = k2(u, n).result;
347
347
  return g && i.pushUndoRedo({
348
348
  unitID: c,
349
349
  redoMutations: u,
@@ -351,28 +351,28 @@ const i2 = {
351
351
  }), g;
352
352
  }
353
353
  }, N0 = {
354
- type: O.COMMAND,
354
+ type: $.COMMAND,
355
355
  id: "sheet.command.delete-conditional-rule",
356
356
  handler(s, r) {
357
357
  if (!r)
358
358
  return !1;
359
- const t = s.get(e2), e = s.get(W), n = s.get(q), i = t2(n, r);
359
+ const t = s.get(t2), e = s.get(q), n = s.get(Z), i = k(n, r);
360
360
  if (!i) return !1;
361
- const { unitId: a, subUnitId: c } = i, l = { unitId: a, subUnitId: c, cfId: r.cfId }, o = m2(s, l), d = e.syncExecuteCommand(K.id, l);
362
- return d && t.pushUndoRedo({ unitID: a, undoMutations: o, redoMutations: [{ id: K.id, params: l }] }), d;
361
+ const { unitId: a, subUnitId: c } = i, o = { unitId: a, subUnitId: c, cfId: r.cfId }, l = D2(s, o), d = e.syncExecuteCommand(X.id, o);
362
+ return d && t.pushUndoRedo({ unitID: a, undoMutations: l, redoMutations: [{ id: X.id, params: o }] }), d;
363
363
  }
364
364
  }, T0 = {
365
- type: O.COMMAND,
365
+ type: $.COMMAND,
366
366
  id: "sheet.command.move-conditional-rule",
367
367
  handler(s, r) {
368
368
  if (!r)
369
369
  return !1;
370
- const t = s.get(e2), e = s.get(W), n = s.get(q), i = s.get(R), a = t2(n, r);
370
+ const t = s.get(t2), e = s.get(q), n = s.get(Z), i = s.get(R), a = k(n, r);
371
371
  if (!a) return !1;
372
- const { unitId: c, subUnitId: l } = a, o = W2(r.start, r.end, i.getSubunitRules(c, l) || [], (D) => D.cfId);
373
- if (!o)
372
+ const { unitId: c, subUnitId: o } = a, l = W2(r.start, r.end, i.getSubunitRules(c, o) || [], (D) => D.cfId);
373
+ if (!l)
374
374
  return !1;
375
- const [d, u] = o, h = { unitId: c, subUnitId: l, start: d, end: u }, g = b0(h), f = e.syncExecuteCommand(i2.id, h);
375
+ const [d, u] = l, h = { unitId: c, subUnitId: o, start: d, end: u }, g = b0(h), f = e.syncExecuteCommand(i2.id, h);
376
376
  return f && t.pushUndoRedo({
377
377
  unitID: c,
378
378
  redoMutations: [{ id: i2.id, params: h }],
@@ -380,23 +380,23 @@ const i2 = {
380
380
  }), f;
381
381
  }
382
382
  }, U0 = {
383
- type: O.COMMAND,
383
+ type: $.COMMAND,
384
384
  id: "sheet.command.set-conditional-rule",
385
385
  handler(s, r) {
386
386
  if (!r)
387
387
  return !1;
388
- const t = s.get(e2), e = s.get(W), n = s.get(q), i = t2(n, r);
388
+ const t = s.get(t2), e = s.get(q), n = s.get(Z), i = k(n, r);
389
389
  if (!i) return !1;
390
- const { unitId: a, subUnitId: c } = i, l = { unitId: a, subUnitId: c, rule: r.rule, cfId: r.cfId }, o = Z2(s, l), d = e.syncExecuteCommand(l2.id, l);
391
- return d && t.pushUndoRedo({ unitID: a, undoMutations: o, redoMutations: [{ id: l2.id, params: l }] }), d;
390
+ const { unitId: a, subUnitId: c } = i, o = { unitId: a, subUnitId: c, rule: r.rule, cfId: r.cfId }, l = Z2(s, o), d = e.syncExecuteCommand(l2.id, o);
391
+ return d && t.pushUndoRedo({ unitID: a, undoMutations: l, redoMutations: [{ id: l2.id, params: o }] }), d;
392
392
  }
393
393
  };
394
394
  var V0 = Object.getOwnPropertyDescriptor, O0 = (s, r, t, e) => {
395
395
  for (var n = e > 1 ? void 0 : e ? V0(r, t) : r, i = s.length - 1, a; i >= 0; i--)
396
396
  (a = s[i]) && (n = a(n) || n);
397
397
  return n;
398
- }, S2 = (s, r) => (t, e) => r(t, e, s);
399
- let z = class extends x2 {
398
+ }, I2 = (s, r) => (t, e) => r(t, e, s);
399
+ let Q = class extends x2 {
400
400
  constructor(r, t) {
401
401
  super();
402
402
  // Cache Formula ID and formula mapping.
@@ -408,11 +408,11 @@ let z = class extends x2 {
408
408
  _initRuleChange() {
409
409
  const r = (t) => {
410
410
  switch (t.type) {
411
- case y.colorScale:
411
+ case M.colorScale:
412
412
  return t.config.some((e) => e.value.type === L.formula);
413
- case y.dataBar:
413
+ case M.dataBar:
414
414
  return [t.config.max, t.config.min].some((e) => e.type === L.formula);
415
- case y.iconSet:
415
+ case M.iconSet:
416
416
  return t.config.some((e) => e.value.type === L.formula);
417
417
  }
418
418
  };
@@ -426,8 +426,8 @@ let z = class extends x2 {
426
426
  */
427
427
  _registerRuleFormulas(r, t, e) {
428
428
  switch (e.rule.type) {
429
- case y.highlightCell: {
430
- if (e.rule.subType === _.formula) {
429
+ case M.highlightCell: {
430
+ if (e.rule.subType === x.formula) {
431
431
  const n = e.rule.value;
432
432
  n && this.registerFormulaWithRange(
433
433
  r,
@@ -450,11 +450,11 @@ let z = class extends x2 {
450
450
  const a = this._ensureSubunitFormulaMap(t, e).getValue(i.formulaId, ["formulaId"]);
451
451
  if (!a)
452
452
  continue;
453
- const l = this._getAllFormulaResultByCfId(t, e, a.cfId).every((o) => {
454
- const d = this._registerOtherFormulaService.getFormulaValueSync(t, e, o.formulaId);
453
+ const o = this._getAllFormulaResultByCfId(t, e, a.cfId).every((l) => {
454
+ const d = this._registerOtherFormulaService.getFormulaValueSync(t, e, l.formulaId);
455
455
  return (d == null ? void 0 : d.status) === p.SUCCESS;
456
456
  });
457
- this._result$.next({ ...a, isAllFinished: l });
457
+ this._result$.next({ ...a, isAllFinished: o });
458
458
  }
459
459
  }
460
460
  }));
@@ -463,7 +463,7 @@ let z = class extends x2 {
463
463
  let e = this._formulaMap.get(r);
464
464
  e || (e = /* @__PURE__ */ new Map(), this._formulaMap.set(r, e));
465
465
  let n = e.get(t);
466
- return n || (n = new K2([], ["formulaId", "id"]), e.set(t, n)), n;
466
+ return n || (n = new Y2([], ["formulaId", "id"]), e.set(t, n)), n;
467
467
  }
468
468
  getSubUnitFormulaMap(r, t) {
469
469
  var e;
@@ -473,14 +473,14 @@ let z = class extends x2 {
473
473
  const a = this._ensureSubunitFormulaMap(r, t), c = this.createCFormulaId(e, n);
474
474
  if (a.getValue(c, ["id"]))
475
475
  return;
476
- const l = this._registerOtherFormulaService.registerFormulaWithRange(r, t, n, i, void 0, v0.CONDITIONAL_FORMATTING, e);
476
+ const o = this._registerOtherFormulaService.registerFormulaWithRange(r, t, n, i, void 0, v0.CONDITIONAL_FORMATTING, e);
477
477
  a.addValue({
478
478
  formulaText: n,
479
479
  unitId: r,
480
480
  subUnitId: t,
481
481
  cfId: e,
482
482
  id: c,
483
- formulaId: l
483
+ formulaId: o
484
484
  });
485
485
  }
486
486
  _removeFormulaByCfId(r, t, e) {
@@ -492,17 +492,17 @@ let z = class extends x2 {
492
492
  const c = this.getSubUnitFormulaMap(r, t);
493
493
  if (!c)
494
494
  return { status: p.NOT_REGISTER };
495
- const l = c.getValue(this.createCFormulaId(e, n), ["id"]);
496
- if (!l)
497
- return { status: p.NOT_REGISTER };
498
- const o = this._registerOtherFormulaService.getFormulaValueSync(r, t, l.formulaId);
495
+ const o = c.getValue(this.createCFormulaId(e, n), ["id"]);
499
496
  if (!o)
500
497
  return { status: p.NOT_REGISTER };
501
- if (o.status === p.SUCCESS && o.result) {
502
- const u = (d = o.result[i]) == null ? void 0 : d[a];
498
+ const l = this._registerOtherFormulaService.getFormulaValueSync(r, t, o.formulaId);
499
+ if (!l)
500
+ return { status: p.NOT_REGISTER };
501
+ if (l.status === p.SUCCESS && l.result) {
502
+ const u = (d = l.result[i]) == null ? void 0 : d[a];
503
503
  return { result: this._getCellValue(u), status: p.SUCCESS };
504
504
  }
505
- return { status: o.status };
505
+ return { status: l.status };
506
506
  }
507
507
  getFormulaMatrix(r, t, e, n) {
508
508
  const i = this.getSubUnitFormulaMap(r, t);
@@ -515,10 +515,10 @@ let z = class extends x2 {
515
515
  if (!c)
516
516
  return { status: p.NOT_REGISTER };
517
517
  if (c.status === p.SUCCESS && c.result) {
518
- const l = new V();
519
- return new V(c.result).forValue((d, u, h) => {
520
- l.setValue(d, u, this._getCellValue(h));
521
- }), { result: l, status: p.SUCCESS };
518
+ const o = new O();
519
+ return new O(c.result).forValue((d, u, h) => {
520
+ o.setValue(d, u, this._getCellValue(h));
521
+ }), { result: o, status: p.SUCCESS };
522
522
  }
523
523
  return { status: c.status };
524
524
  }
@@ -526,7 +526,7 @@ let z = class extends x2 {
526
526
  if (!r || !r[0] || !r[0][0])
527
527
  return !1;
528
528
  const t = r[0][0];
529
- return (t == null ? void 0 : t.t) === M.BOOLEAN ? t.v === N2.TRUE || t.v === !0 : t == null ? void 0 : t.v;
529
+ return (t == null ? void 0 : t.t) === y.BOOLEAN ? t.v === B2.TRUE || t.v === !0 : t == null ? void 0 : t.v;
530
530
  }
531
531
  /**
532
532
  * If `formulaText` is not provided, then all caches related to `cfId` will be deleted.
@@ -556,18 +556,18 @@ let z = class extends x2 {
556
556
  return `${r}_${t}`;
557
557
  }
558
558
  };
559
- z = O0([
560
- S2(0, b(w0)),
561
- S2(1, b(R))
562
- ], z);
563
- var U = /* @__PURE__ */ ((s) => (s.preComputingStart = "preComputingStart", s.preComputing = "preComputing", s.preComputingEnd = "preComputingEnd", s.preComputingError = "preComputingError", s))(U || {});
564
- class F2 {
559
+ Q = O0([
560
+ I2(0, b(F0)),
561
+ I2(1, b(R))
562
+ ], Q);
563
+ var V = /* @__PURE__ */ ((s) => (s.preComputingStart = "preComputingStart", s.preComputing = "preComputing", s.preComputingEnd = "preComputingEnd", s.preComputingError = "preComputingError", s))(V || {});
564
+ class m2 {
565
565
  constructor(r) {
566
566
  /**
567
567
  * 3nd-level cache
568
568
  */
569
569
  m(this, "_cache");
570
- m(this, "_preComputingStatus$", new F0(
570
+ m(this, "_preComputingStatus$", new w0(
571
571
  "preComputingStart"
572
572
  /* preComputingStart */
573
573
  ));
@@ -577,7 +577,7 @@ class F2 {
577
577
  */
578
578
  m(this, "_preComputingCache");
579
579
  m(this, "_rule");
580
- this._context = r, this._cache = new T2(r.limit), this._rule = r.rule, this._preComputingCache = null, this._initClearCacheListener();
580
+ this._context = r, this._cache = new N2(r.limit), this._rule = r.rule, this._preComputingCache = null, this._initClearCacheListener();
581
581
  }
582
582
  setCacheLength(r) {
583
583
  this._cache.limit = r;
@@ -634,47 +634,47 @@ class F2 {
634
634
  });
635
635
  }
636
636
  }
637
- class $0 extends F2 {
637
+ class $0 extends m2 {
638
638
  preComputing(r, t, e) {
639
- const n = e.rule, i = e.worksheet, a = new V();
639
+ const n = e.rule, i = e.worksheet, a = new O();
640
640
  !n.rule.config.every((d) => d.value.type === L.num) && w2(n.ranges, i.getMaxRows() - 1, i.getMaxColumns() - 1).forEach((u) => {
641
- T.foreach(u, (h, g) => {
641
+ U.foreach(u, (h, g) => {
642
642
  const f = e.getCellValue(h, g), D = f && f.v;
643
- if (!x(D) && (f == null ? void 0 : f.t) === M.NUMBER) {
644
- const F = Number(D);
645
- !Number.isNaN(F) && a.setValue(h, g, F);
643
+ if (!_(D) && (f == null ? void 0 : f.t) === y.NUMBER) {
644
+ const w = Number(D);
645
+ !Number.isNaN(w) && a.setValue(h, g, w);
646
646
  }
647
647
  });
648
648
  });
649
- const l = [...n.rule.config].sort((d, u) => d.index - u.index).map((d) => ({
649
+ const o = [...n.rule.config].sort((d, u) => d.index - u.index).map((d) => ({
650
650
  value: g2(d.value, a, {
651
651
  ...e,
652
652
  cfId: n.cfId
653
653
  }),
654
- color: new U2(d.color)
654
+ color: new T2(d.color)
655
655
  }));
656
- if (!l.some((d) => M0(d.value) ? d.value.status !== p.SUCCESS : !1)) {
657
- const d = l.map((u) => u.color).reduce((u, h, g) => (u.result.push({ color: h, value: u.sortValue[g] }), u), {
656
+ if (!o.some((d) => y0(d.value) ? d.value.status !== p.SUCCESS : !1)) {
657
+ const d = o.map((u) => u.color).reduce((u, h, g) => (u.result.push({ color: h, value: u.sortValue[g] }), u), {
658
658
  result: [],
659
- sortValue: l.map((u) => u.value.result).sort((u, h) => u - h)
659
+ sortValue: o.map((u) => u.value.result).sort((u, h) => u - h)
660
660
  }).result;
661
- this.setPreComputingCache(d), this._preComputingStatus$.next(U.preComputingEnd);
661
+ this.setPreComputingCache(d), this._preComputingStatus$.next(V.preComputingEnd);
662
662
  return;
663
663
  }
664
- this._preComputingStatus$.next(U.preComputing);
664
+ this._preComputingStatus$.next(V.preComputing);
665
665
  }
666
666
  getCellResult(r, t, e, n) {
667
667
  if (!e)
668
668
  return null;
669
669
  const i = n.getCellValue(r, t);
670
- if (i.t === M.NUMBER) {
670
+ if (i.t === y.NUMBER) {
671
671
  const a = Number(i.v);
672
672
  if (!Number.isNaN(a))
673
673
  return n1(e, a);
674
674
  }
675
675
  }
676
676
  }
677
- const P0 = "sheet-conditional-rule-data-bar", b2 = "#ffbe38", L2 = "#abd91a", W0 = "#000", q0 = 34, Z0 = (s) => {
677
+ const P0 = "sheet-conditional-rule-data-bar", S2 = "#ffbe38", b2 = "#abd91a", W0 = "#000", q0 = 34, Z0 = (s) => {
678
678
  const { startRow: r, endRow: t, startColumn: e, endColumn: n } = s;
679
679
  return `${r}-${t}-${e}-${n}`;
680
680
  };
@@ -693,72 +693,72 @@ class G0 extends $2 {
693
693
  if (!a)
694
694
  return !1;
695
695
  const c = /* @__PURE__ */ new Set();
696
- t.save(), T.foreach(n.rowColumnSegment, (l, o) => {
697
- if (!a.getRowVisible(l) || !a.getColVisible(o))
696
+ t.save(), U.foreach(n.rowColumnSegment, (o, l) => {
697
+ if (!a.getRowVisible(o) || !a.getColVisible(l))
698
698
  return;
699
- const d = n.getCellWithCoordByIndex(l, o, !1), { isMerged: u, isMergedMainCell: h, mergeInfo: g } = d;
700
- let f = a.getCell(l, o);
699
+ const d = n.getCellWithCoordByIndex(o, l, !1), { isMerged: u, isMergedMainCell: h, mergeInfo: g } = d;
700
+ let f = a.getCell(o, l);
701
701
  if (u && (f = a.getCell(g.startRow, g.startColumn)), !(f != null && f.dataBar) || !this.isRenderDiffRangesByCell(g, i))
702
702
  return;
703
703
  if (u || h) {
704
- const $ = Z0(g);
705
- if (c.has($))
704
+ const P = Z0(g);
705
+ if (c.has(P))
706
706
  return;
707
- c.add($);
707
+ c.add(P);
708
708
  }
709
- const { color: D, value: F, startPoint: E, isGradient: I } = f.dataBar, { startX: A, endX: S, startY: k, endY: v2 } = u || h ? g : d, o2 = S - A, p2 = v2 + y0 - k, Z = o2 - this._paddingRightAndLeft * 2, y2 = p2 - this._paddingTopAndBottom * 2;
710
- if (F > 0) {
711
- const $ = Math.max(Z * (1 - E / 100) * F / 100, 1), G = A + this._paddingRightAndLeft + E / 100 * Z, H = k + this._paddingTopAndBottom;
709
+ const { color: D, value: w, startPoint: E, isGradient: I } = f.dataBar, { startX: A, endX: S, startY: B, endY: F2 } = u || h ? g : d, o2 = S - A, v2 = F2 + M0 - B, G = o2 - this._paddingRightAndLeft * 2, y2 = v2 - this._paddingTopAndBottom * 2;
710
+ if (w > 0) {
711
+ const P = Math.max(G * (1 - E / 100) * w / 100, 1), H = A + this._paddingRightAndLeft + E / 100 * G, j = B + this._paddingTopAndBottom;
712
712
  if (I) {
713
- const j = t.createLinearGradient(G, H, G + $, H);
714
- j.addColorStop(0, D), j.addColorStop(1, "rgb(255 255 255)"), t.fillStyle = j, t.strokeStyle = D, t.lineWidth = 1;
713
+ const K = t.createLinearGradient(H, j, H + P, j);
714
+ K.addColorStop(0, D), K.addColorStop(1, "rgb(255 255 255)"), t.fillStyle = K, t.strokeStyle = D, t.lineWidth = 1;
715
715
  } else
716
716
  t.fillStyle = D;
717
- this._drawRectWithRoundedCorner(t, G, H, $, y2, !1, !0, !0, !1), I && t.stroke();
717
+ this._drawRectWithRoundedCorner(t, H, j, P, y2, !1, !0, !0, !1), I && t.stroke();
718
718
  } else {
719
- const $ = Math.max(Z * E / 100 * Math.abs(F) / 100, 1), G = A + this._paddingRightAndLeft + E / 100 * Z - $, H = k + this._paddingTopAndBottom;
719
+ const P = Math.max(G * E / 100 * Math.abs(w) / 100, 1), H = A + this._paddingRightAndLeft + E / 100 * G - P, j = B + this._paddingTopAndBottom;
720
720
  if (I) {
721
- const j = t.createLinearGradient(G, H, G + $, H);
722
- j.addColorStop(0, "rgb(255 255 255)"), j.addColorStop(1, D), t.fillStyle = j, t.strokeStyle = D, t.lineWidth = 1;
721
+ const K = t.createLinearGradient(H, j, H + P, j);
722
+ K.addColorStop(0, "rgb(255 255 255)"), K.addColorStop(1, D), t.fillStyle = K, t.strokeStyle = D, t.lineWidth = 1;
723
723
  } else
724
724
  t.fillStyle = D;
725
- this._drawRectWithRoundedCorner(t, G, H, $, y2, !0, !1, !1, !0), I && t.stroke();
725
+ this._drawRectWithRoundedCorner(t, H, j, P, y2, !0, !1, !1, !0), I && t.stroke();
726
726
  }
727
727
  }), t.restore();
728
728
  }
729
- _drawRectWithRoundedCorner(t, e, n, i, a, c, l, o, d) {
729
+ _drawRectWithRoundedCorner(t, e, n, i, a, c, o, l, d) {
730
730
  const u = this._radius;
731
- !a || !i || (t.beginPath(), t.moveTo(e + u, n), t.lineTo(e + i - u, n), l ? t.arcTo(e + i, n, e + i, n + u, u) : t.lineTo(e + i, n), t.lineTo(e + i, n + a - u), o ? t.arcTo(e + i, n + a, e + i - u, n + a, u) : t.lineTo(e + i, n + a), t.lineTo(e + u, n + a), d ? t.arcTo(e, n + a, e, n + a - u, u) : t.lineTo(e, n + a), t.lineTo(e, n + u), c ? t.arcTo(e, n, e + u, n, u) : t.lineTo(e, n), t.closePath(), t.fill());
731
+ !a || !i || (t.beginPath(), t.moveTo(e + u, n), t.lineTo(e + i - u, n), o ? t.arcTo(e + i, n, e + i, n + u, u) : t.lineTo(e + i, n), t.lineTo(e + i, n + a - u), l ? t.arcTo(e + i, n + a, e + i - u, n + a, u) : t.lineTo(e + i, n + a), t.lineTo(e + u, n + a), d ? t.arcTo(e, n + a, e, n + a - u, u) : t.lineTo(e, n + a), t.lineTo(e, n + u), c ? t.arcTo(e, n, e + u, n, u) : t.lineTo(e, n), t.closePath(), t.fill());
732
732
  }
733
733
  }
734
734
  O2.add(G0);
735
735
  const u2 = (s) => Math.max(Math.min(100, s), 0), H0 = (s, r, t) => {
736
736
  const e = t(s, r);
737
- if (e && e.t === M.NUMBER) {
737
+ if (e && e.t === y.NUMBER) {
738
738
  const n = Number(e.v);
739
739
  return Number.isNaN(n) ? null : n;
740
740
  }
741
741
  return null;
742
742
  };
743
- class j0 extends F2 {
743
+ class j0 extends m2 {
744
744
  preComputing(r, t, e) {
745
- const n = e.rule, i = n.rule, a = e.worksheet, c = new V();
745
+ const n = e.rule, i = n.rule, a = e.worksheet, c = new O();
746
746
  ![n.rule.config.max, n.rule.config.min].every((g) => g.type === L.num) && w2(n.ranges, a.getMaxRows() - 1, a.getMaxColumns() - 1).forEach((f) => {
747
- T.foreach(f, (D, F) => {
748
- const E = e.getCellValue(D, F), I = E && E.v;
749
- if (!x(I) && (E == null ? void 0 : E.t) === M.NUMBER) {
747
+ U.foreach(f, (D, w) => {
748
+ const E = e.getCellValue(D, w), I = E && E.v;
749
+ if (!_(I) && (E == null ? void 0 : E.t) === y.NUMBER) {
750
750
  const A = Number(I);
751
- !Number.isNaN(A) && c.setValue(D, F, A);
751
+ !Number.isNaN(A) && c.setValue(D, w, A);
752
752
  }
753
753
  });
754
754
  });
755
- const o = g2(i.config.min, c, { ...e, cfId: n.cfId }), d = g2(i.config.max, c, { ...e, cfId: n.cfId });
755
+ const l = g2(i.config.min, c, { ...e, cfId: n.cfId }), d = g2(i.config.max, c, { ...e, cfId: n.cfId });
756
756
  let u = 0, h = 0;
757
- if (o.status === p.SUCCESS) {
758
- const g = Number(o.result);
757
+ if (l.status === p.SUCCESS) {
758
+ const g = Number(l.result);
759
759
  u = Number.isNaN(g) ? 0 : g;
760
760
  } else {
761
- this._preComputingStatus$.next(U.preComputing);
761
+ this._preComputingStatus$.next(V.preComputing);
762
762
  return;
763
763
  }
764
764
  if (d.status === p.SUCCESS) {
@@ -768,94 +768,94 @@ class j0 extends F2 {
768
768
  if (u < 0 && h <= 0)
769
769
  D = 100;
770
770
  else if (u < 0 && h > 0) {
771
- const F = Math.abs(h) + Math.abs(u);
772
- D = Math.abs(u) / F * 100;
771
+ const w = Math.abs(h) + Math.abs(u);
772
+ D = Math.abs(u) / w * 100;
773
773
  } else u >= 0 && h > 0 && (D = 0);
774
- this.setPreComputingCache({ min: u, max: h, startPoint: D }), this._preComputingStatus$.next(U.preComputingEnd);
774
+ this.setPreComputingCache({ min: u, max: h, startPoint: D }), this._preComputingStatus$.next(V.preComputingEnd);
775
775
  return;
776
776
  }
777
- this._preComputingStatus$.next(U.preComputing);
777
+ this._preComputingStatus$.next(V.preComputing);
778
778
  }
779
779
  // eslint-disable-next-line complexity
780
780
  getCellResult(r, t, e, n) {
781
- const { min: i, max: a, startPoint: c } = e, o = n.rule.rule, d = o.isShowValue, u = o.config.isGradient, h = H0(r, t, n.getCellValue);
781
+ const { min: i, max: a, startPoint: c } = e, l = n.rule.rule, d = l.isShowValue, u = l.config.isGradient, h = H0(r, t, n.getCellValue);
782
782
  if (!(h === null || h < i || i === a || a < i)) {
783
783
  if (h === 0)
784
784
  return { color: W0, startPoint: c, value: 0, isGradient: u, isShowValue: d };
785
785
  if (i < 0 && a <= 0) {
786
786
  const g = a - i, f = u2((a - h) / g * 100);
787
- return f === 0 ? void 0 : { color: o.config.nativeColor || L2, startPoint: c, value: -f, isGradient: u, isShowValue: d };
787
+ return f === 0 ? void 0 : { color: l.config.nativeColor || b2, startPoint: c, value: -f, isGradient: u, isShowValue: d };
788
788
  } else if (i < 0 && a > 0)
789
789
  if (h > 0) {
790
790
  const g = u2(Math.min(h / a, 1) * 100);
791
- return g === 0 ? void 0 : { color: o.config.positiveColor || b2, startPoint: c, value: g, isGradient: u, isShowValue: d };
791
+ return g === 0 ? void 0 : { color: l.config.positiveColor || S2, startPoint: c, value: g, isGradient: u, isShowValue: d };
792
792
  } else {
793
793
  const g = u2(Math.min(Math.abs(h) / Math.abs(i), 1) * 100);
794
- return g === 0 ? void 0 : { color: o.config.nativeColor || L2, startPoint: c, value: -g, isGradient: u, isShowValue: d };
794
+ return g === 0 ? void 0 : { color: l.config.nativeColor || b2, startPoint: c, value: -g, isGradient: u, isShowValue: d };
795
795
  }
796
796
  else if (i >= 0 && a > 0) {
797
797
  const g = a - i, f = 0, D = u2((1 - (a - h) / g) * 100);
798
- return D === 0 ? void 0 : { color: o.config.positiveColor || b2, startPoint: f, value: D, isGradient: u, isShowValue: d };
798
+ return D === 0 ? void 0 : { color: l.config.positiveColor || S2, startPoint: f, value: D, isGradient: u, isShowValue: d };
799
799
  }
800
800
  }
801
801
  }
802
802
  }
803
- class X0 extends F2 {
803
+ class K0 extends m2 {
804
804
  // eslint-disable-next-line max-lines-per-function
805
805
  preComputing(r, t, e) {
806
806
  const n = e.rule.rule, i = w2(e.rule.ranges, e.worksheet.getMaxRows() - 1, e.worksheet.getMaxColumns() - 1), c = (() => {
807
807
  switch (n.subType) {
808
- case _.average: {
809
- let l = 0, o = 0;
808
+ case x.average: {
809
+ let o = 0, l = 0;
810
810
  return i.forEach((d) => {
811
- T.foreach(d, (u, h) => {
812
- const g = e.getCellValue(u, h), f = P(g);
813
- g && g.t === M.NUMBER && !x(f) && (l += Number(f) || 0, o++);
811
+ U.foreach(d, (u, h) => {
812
+ const g = e.getCellValue(u, h), f = W(g);
813
+ g && g.t === y.NUMBER && !_(f) && (o += Number(f) || 0, l++);
814
814
  });
815
- }), { value: l / o, type: n.subType };
815
+ }), { value: o / l, type: n.subType };
816
816
  }
817
- case _.uniqueValues:
818
- case _.duplicateValues: {
819
- const l = /* @__PURE__ */ new Map();
820
- return i.forEach((o) => {
821
- T.foreach(o, (d, u) => {
822
- const h = e.getCellValue(d, u), g = P(h);
823
- if (!x(g)) {
824
- const f = l.get(g);
825
- f ? l.set(g, f + 1) : l.set(g, 1);
817
+ case x.uniqueValues:
818
+ case x.duplicateValues: {
819
+ const o = /* @__PURE__ */ new Map();
820
+ return i.forEach((l) => {
821
+ U.foreach(l, (d, u) => {
822
+ const h = e.getCellValue(d, u), g = W(h);
823
+ if (!_(g)) {
824
+ const f = o.get(g);
825
+ f ? o.set(g, f + 1) : o.set(g, 1);
826
826
  }
827
827
  });
828
- }), { value: l, type: n.subType };
828
+ }), { value: o, type: n.subType };
829
829
  }
830
- case _.rank: {
831
- let l = [];
830
+ case x.rank: {
831
+ let o = [];
832
832
  i.forEach((u) => {
833
- T.foreach(u, (h, g) => {
834
- const f = e.getCellValue(h, g), D = P(f);
835
- f && f.t === M.NUMBER && !x(D) && l.push(Number(D) || 0);
833
+ U.foreach(u, (h, g) => {
834
+ const f = e.getCellValue(h, g), D = W(f);
835
+ f && f.t === y.NUMBER && !_(D) && o.push(Number(D) || 0);
836
836
  });
837
- }), l.sort((u, h) => h - u);
838
- const o = e.rule.rule;
839
- if (o.isPercent) {
840
- o.isBottom && (l = l.toReversed());
841
- const u = J.clamp(o.value, 0, 100) / 100, h = Math.floor(u * l.length), g = J.clamp(h - 1, 0, l.length - 1);
842
- return { value: l[g], type: n.subType };
837
+ }), o.sort((u, h) => h - u);
838
+ const l = e.rule.rule;
839
+ if (l.isPercent) {
840
+ l.isBottom && (o = o.toReversed());
841
+ const u = z.clamp(l.value, 0, 100) / 100, h = Math.floor(u * o.length), g = z.clamp(h - 1, 0, o.length - 1);
842
+ return { value: o[g], type: n.subType };
843
843
  }
844
- const d = Math.floor(J.clamp(o.isBottom ? o.value - 1 : o.value, 0, l.length));
845
- return o.isBottom ? { value: l[l.length - d - 1], type: n.subType } : { value: l[Math.max(d - 1, 0)], type: n.subType };
844
+ const d = Math.floor(z.clamp(l.isBottom ? l.value - 1 : l.value, 0, o.length));
845
+ return l.isBottom ? { value: o[o.length - d - 1], type: n.subType } : { value: o[Math.max(d - 1, 0)], type: n.subType };
846
846
  }
847
- case _.formula: {
848
- const l = n, o = e.accessor.get(z);
849
- o.registerFormulaWithRange(e.unitId, e.subUnitId, e.rule.cfId, l.value, e.rule.ranges);
850
- const d = o.getFormulaMatrix(e.unitId, e.subUnitId, e.rule.cfId, l.value);
851
- return d && d.status === p.SUCCESS ? (this._preComputingStatus$.next(U.preComputingEnd), {
847
+ case x.formula: {
848
+ const o = n, l = e.accessor.get(Q);
849
+ l.registerFormulaWithRange(e.unitId, e.subUnitId, e.rule.cfId, o.value, e.rule.ranges);
850
+ const d = l.getFormulaMatrix(e.unitId, e.subUnitId, e.rule.cfId, o.value);
851
+ return d && d.status === p.SUCCESS ? (this._preComputingStatus$.next(V.preComputingEnd), {
852
852
  value: d.result,
853
853
  type: n.subType
854
- }) : (this._preComputingStatus$.next(U.preComputing), null);
854
+ }) : (this._preComputingStatus$.next(V.preComputing), null);
855
855
  }
856
- case _.timePeriod:
856
+ case x.timePeriod:
857
857
  switch (n.operator) {
858
- case N.last7Days:
858
+ case T.last7Days:
859
859
  return {
860
860
  value: {
861
861
  start: v().subtract(7, "day").valueOf(),
@@ -863,7 +863,7 @@ class X0 extends F2 {
863
863
  },
864
864
  type: n.subType
865
865
  };
866
- case N.lastMonth:
866
+ case T.lastMonth:
867
867
  return {
868
868
  value: {
869
869
  start: v().startOf("month").subtract(1, "month").valueOf(),
@@ -871,7 +871,7 @@ class X0 extends F2 {
871
871
  },
872
872
  type: n.subType
873
873
  };
874
- case N.lastWeek:
874
+ case T.lastWeek:
875
875
  return {
876
876
  value: {
877
877
  start: v().startOf("week").subtract(1, "week").valueOf(),
@@ -879,7 +879,7 @@ class X0 extends F2 {
879
879
  },
880
880
  type: n.subType
881
881
  };
882
- case N.nextMonth:
882
+ case T.nextMonth:
883
883
  return {
884
884
  value: {
885
885
  start: v().startOf("month").add(1, "month").valueOf(),
@@ -887,7 +887,7 @@ class X0 extends F2 {
887
887
  },
888
888
  type: n.subType
889
889
  };
890
- case N.nextWeek:
890
+ case T.nextWeek:
891
891
  return {
892
892
  value: {
893
893
  start: v().startOf("week").add(1, "week").valueOf(),
@@ -895,7 +895,7 @@ class X0 extends F2 {
895
895
  },
896
896
  type: n.subType
897
897
  };
898
- case N.thisMonth:
898
+ case T.thisMonth:
899
899
  return {
900
900
  value: {
901
901
  start: v().startOf("month").valueOf(),
@@ -903,7 +903,7 @@ class X0 extends F2 {
903
903
  },
904
904
  type: n.subType
905
905
  };
906
- case N.thisWeek:
906
+ case T.thisWeek:
907
907
  return {
908
908
  value: {
909
909
  start: v().startOf("week").valueOf(),
@@ -911,7 +911,7 @@ class X0 extends F2 {
911
911
  },
912
912
  type: n.subType
913
913
  };
914
- case N.today:
914
+ case T.today:
915
915
  return {
916
916
  value: {
917
917
  start: v().startOf("day").valueOf(),
@@ -919,7 +919,7 @@ class X0 extends F2 {
919
919
  },
920
920
  type: n.subType
921
921
  };
922
- case N.tomorrow:
922
+ case T.tomorrow:
923
923
  return {
924
924
  value: {
925
925
  start: v().startOf("day").add(1, "day").valueOf(),
@@ -927,7 +927,7 @@ class X0 extends F2 {
927
927
  },
928
928
  type: n.subType
929
929
  };
930
- case N.yesterday:
930
+ case T.yesterday:
931
931
  return {
932
932
  value: {
933
933
  start: v().startOf("day").subtract(1, "day").valueOf(),
@@ -945,91 +945,91 @@ class X0 extends F2 {
945
945
  const i = n.getCellValue(r, t), a = n.rule.rule;
946
946
  return (() => {
947
947
  switch (a.subType) {
948
- case _.number: {
949
- const o = i && Number(i.v), d = (i == null ? void 0 : i.t) === M.NUMBER, u = a;
950
- return d ? x(o) || Number.isNaN(o) ? void 0 : r2({ operator: u.operator, value: u.value || 0 }, o || 0) : !![w.notEqual, w.notBetween].includes(u.operator);
948
+ case x.number: {
949
+ const l = i && Number(i.v), d = (i == null ? void 0 : i.t) === y.NUMBER, u = a;
950
+ return d ? _(l) || Number.isNaN(l) ? void 0 : r2({ operator: u.operator, value: u.value || 0 }, l || 0) : !![F.notEqual, F.notBetween].includes(u.operator);
951
951
  }
952
- case _.text: {
953
- const o = a, d = P(i), u = x(d) ? "" : String(d), h = o.value || "";
954
- switch (o.operator) {
955
- case B.beginsWith:
952
+ case x.text: {
953
+ const l = a, d = W(i), u = _(d) ? "" : String(d), h = l.value || "";
954
+ switch (l.operator) {
955
+ case N.beginsWith:
956
956
  return u.startsWith(h);
957
- case B.containsBlanks:
957
+ case N.containsBlanks:
958
958
  return /^\s*$/.test(u);
959
- case B.notContainsBlanks:
959
+ case N.notContainsBlanks:
960
960
  return !/^\s*$/.test(u);
961
- case B.containsErrors:
962
- return R2.has(u);
963
- case B.notContainsErrors:
964
- return !R2.has(u);
965
- case B.containsText:
961
+ case N.containsErrors:
962
+ return M2.has(u);
963
+ case N.notContainsErrors:
964
+ return !M2.has(u);
965
+ case N.containsText:
966
966
  return u.indexOf(h) > -1;
967
- case B.notContainsText:
967
+ case N.notContainsText:
968
968
  return u.indexOf(h) === -1;
969
- case B.endsWith:
969
+ case N.endsWith:
970
970
  return u.endsWith(h);
971
- case B.equal:
971
+ case N.equal:
972
972
  return u === h;
973
- case B.notEqual:
973
+ case N.notEqual:
974
974
  return u !== h;
975
975
  default:
976
976
  return !1;
977
977
  }
978
978
  }
979
- case _.timePeriod: {
980
- const o = P(i);
981
- if (x(o) || Number.isNaN(Number(o)) || (i == null ? void 0 : i.t) !== M.NUMBER || !e)
979
+ case x.timePeriod: {
980
+ const l = W(i);
981
+ if (_(l) || Number.isNaN(Number(l)) || (i == null ? void 0 : i.t) !== y.NUMBER || !e)
982
982
  return;
983
- const d = e1(Number(o)), { start: u, end: h } = e.value;
983
+ const d = e1(Number(l)), { start: u, end: h } = e.value;
984
984
  return d >= u && d <= h;
985
985
  }
986
- case _.average: {
987
- const o = i && i.v, d = Number(o), u = (i == null ? void 0 : i.t) === M.NUMBER, h = a;
986
+ case x.average: {
987
+ const l = i && i.v, d = Number(l), u = (i == null ? void 0 : i.t) === y.NUMBER, h = a;
988
988
  if (!u)
989
- return w.notEqual === h.operator;
990
- if (x(o) || Number.isNaN(d) || !e)
989
+ return F.notEqual === h.operator;
990
+ if (_(l) || Number.isNaN(d) || !e)
991
991
  return !1;
992
992
  const g = e.value;
993
993
  switch (h.operator) {
994
- case w.greaterThan:
994
+ case F.greaterThan:
995
995
  return d > g;
996
- case w.greaterThanOrEqual:
996
+ case F.greaterThanOrEqual:
997
997
  return d >= g;
998
- case w.lessThan:
998
+ case F.lessThan:
999
999
  return d < g;
1000
- case w.lessThanOrEqual:
1000
+ case F.lessThanOrEqual:
1001
1001
  return d <= g;
1002
- case w.equal:
1002
+ case F.equal:
1003
1003
  return h2(d, g);
1004
- case w.notEqual:
1004
+ case F.notEqual:
1005
1005
  return !h2(d, g);
1006
1006
  default:
1007
1007
  return !1;
1008
1008
  }
1009
1009
  }
1010
- case _.rank: {
1011
- const o = P(i), d = Number(o);
1012
- if (x(o) || Number.isNaN(d) || (i == null ? void 0 : i.t) !== M.NUMBER || !e)
1010
+ case x.rank: {
1011
+ const l = W(i), d = Number(l);
1012
+ if (_(l) || Number.isNaN(d) || (i == null ? void 0 : i.t) !== y.NUMBER || !e)
1013
1013
  return !1;
1014
1014
  const u = e.value;
1015
1015
  return a.isBottom ? d <= u : d >= u;
1016
1016
  }
1017
- case _.uniqueValues: {
1018
- const o = P(i);
1019
- return x(o) || !e ? !1 : e.value.get(o) === 1;
1017
+ case x.uniqueValues: {
1018
+ const l = W(i);
1019
+ return _(l) || !e ? !1 : e.value.get(l) === 1;
1020
1020
  }
1021
- case _.duplicateValues: {
1022
- const o = P(i);
1023
- if (x(o) || !e)
1021
+ case x.duplicateValues: {
1022
+ const l = W(i);
1023
+ if (_(l) || !e)
1024
1024
  return !1;
1025
- const d = e.value.get(o);
1025
+ const d = e.value.get(l);
1026
1026
  return d && d !== 1;
1027
1027
  }
1028
- case _.formula: {
1029
- const o = e == null ? void 0 : e.value;
1030
- if (o) {
1028
+ case x.formula: {
1029
+ const l = e == null ? void 0 : e.value;
1030
+ if (l) {
1031
1031
  const d = n.rule.ranges[0], u = r - d.startRow, h = t - d.startColumn;
1032
- return o.getValue(u, h) === !0;
1032
+ return l.getValue(u, h) === !0;
1033
1033
  }
1034
1034
  return !1;
1035
1035
  }
@@ -1037,29 +1037,29 @@ class X0 extends F2 {
1037
1037
  })() ? a.style : {};
1038
1038
  }
1039
1039
  }
1040
- const K0 = (s, r, t) => {
1040
+ const Y0 = (s, r, t) => {
1041
1041
  const e = t(s, r);
1042
- if (e && e.t === M.NUMBER) {
1042
+ if (e && e.t === y.NUMBER) {
1043
1043
  const n = Number(e.v);
1044
1044
  return Number.isNaN(n) ? null : n;
1045
1045
  }
1046
1046
  return null;
1047
1047
  };
1048
- class Y0 extends F2 {
1048
+ class X0 extends m2 {
1049
1049
  preComputing(r, t, e) {
1050
- const n = e.rule.rule, i = e.worksheet, a = new V();
1050
+ const n = e.rule.rule, i = e.worksheet, a = new O();
1051
1051
  !n.config.every((d) => d.value.type === L.num) && w2(e.rule.ranges, i.getMaxRows() - 1, i.getMaxColumns() - 1).forEach((u) => {
1052
- T.foreach(u, (h, g) => {
1052
+ U.foreach(u, (h, g) => {
1053
1053
  const f = e.getCellValue(h, g), D = f && f.v;
1054
- if (!x(D) && (f == null ? void 0 : f.t) === M.NUMBER) {
1055
- const F = Number(D);
1056
- !Number.isNaN(F) && a.setValue(h, g, F);
1054
+ if (!_(D) && (f == null ? void 0 : f.t) === y.NUMBER) {
1055
+ const w = Number(D);
1056
+ !Number.isNaN(w) && a.setValue(h, g, w);
1057
1057
  }
1058
1058
  });
1059
1059
  });
1060
- const l = n.config.map((d) => g2(d.value, a, { ...e, cfId: e.rule.cfId }));
1061
- if (!l.some((d) => d.status !== p.SUCCESS)) {
1062
- const d = l.map((u, h) => ({
1060
+ const o = n.config.map((d) => g2(d.value, a, { ...e, cfId: e.rule.cfId }));
1061
+ if (!o.some((d) => d.status !== p.SUCCESS)) {
1062
+ const d = o.map((u, h) => ({
1063
1063
  operator: n.config[h].operator,
1064
1064
  value: Number(u.result) || 0
1065
1065
  })).reduce((u, h, g, f) => {
@@ -1067,33 +1067,33 @@ class Y0 extends F2 {
1067
1067
  if (!g || g === f.length - 1)
1068
1068
  u.push({ ...h, iconId: D.iconId, iconType: D.iconType });
1069
1069
  else {
1070
- const F = f[g - 1];
1071
- r2(F, h.value) || u.push({ ...h, iconId: D.iconId, iconType: D.iconType });
1070
+ const w = f[g - 1];
1071
+ r2(w, h.value) || u.push({ ...h, iconId: D.iconId, iconType: D.iconType });
1072
1072
  }
1073
1073
  return u;
1074
1074
  }, []);
1075
- this.setPreComputingCache(d), this._preComputingStatus$.next(U.preComputingEnd);
1075
+ this.setPreComputingCache(d), this._preComputingStatus$.next(V.preComputingEnd);
1076
1076
  return;
1077
1077
  }
1078
- this._preComputingStatus$.next(U.preComputing);
1078
+ this._preComputingStatus$.next(V.preComputing);
1079
1079
  }
1080
1080
  getCellResult(r, t, e, n) {
1081
1081
  if (!e)
1082
1082
  return null;
1083
- const i = K0(r, t, n.getCellValue);
1083
+ const i = Y0(r, t, n.getCellValue);
1084
1084
  if (i === null)
1085
1085
  return;
1086
1086
  const a = n.rule.rule, c = a.isShowValue === void 0 ? !0 : !!a.isShowValue;
1087
- for (let l = 0; l < e.length; l++) {
1088
- const o = e[l], d = { ...o }, u = { ...o }, { iconId: h, iconType: g } = o;
1089
- if (l === 0) {
1090
- if (r2(o, i))
1087
+ for (let o = 0; o < e.length; o++) {
1088
+ const l = e[o], d = { ...l }, u = { ...l }, { iconId: h, iconType: g } = l;
1089
+ if (o === 0) {
1090
+ if (r2(l, i))
1091
1091
  return { iconId: h, iconType: g, isShowValue: c };
1092
1092
  } else {
1093
- if (l === e.length - 1)
1093
+ if (o === e.length - 1)
1094
1094
  return { iconId: h, iconType: g, isShowValue: c };
1095
1095
  {
1096
- const f = e[l - 1];
1096
+ const f = e[o - 1];
1097
1097
  if (u.operator = t1(f.operator), u.value = f.value, r2(d, i) && r2(u, i))
1098
1098
  return { iconId: h, iconType: g, isShowValue: c };
1099
1099
  }
@@ -1106,17 +1106,17 @@ var J0 = Object.getOwnPropertyDescriptor, z0 = (s, r, t, e) => {
1106
1106
  (a = s[i]) && (n = a(n) || n);
1107
1107
  return n;
1108
1108
  }, c2 = (s, r) => (t, e) => r(t, e, s);
1109
- const E2 = 1e3 * 3 * 3;
1110
- let Q = class extends x2 {
1109
+ const p2 = 1e3 * 3 * 3;
1110
+ let e2 = class extends x2 {
1111
1111
  constructor(r, t, e, n) {
1112
1112
  super();
1113
1113
  // Map<unitID ,<sheetId ,ObjectMatrix>>
1114
1114
  m(this, "_calculateUnitManagers", /* @__PURE__ */ new Map());
1115
- m(this, "_rTreeManager", new Y2());
1115
+ m(this, "_rTreeManager", new X2());
1116
1116
  /**
1117
1117
  * 1nd-level cache
1118
1118
  */
1119
- m(this, "_cellCache", new T2(E2));
1119
+ m(this, "_cellCache", new N2(p2));
1120
1120
  m(this, "_markDirty$", new d2());
1121
1121
  /**
1122
1122
  * The rendering layer listens to this variable to determine whether a reRender is necessary.
@@ -1150,13 +1150,13 @@ let Q = class extends x2 {
1150
1150
  */
1151
1151
  m(this, "markRuleDirty", (() => {
1152
1152
  const r = new d2();
1153
- return this.disposeWithMe(r.pipe(A0(100), _0((t) => !!t.length), x0((t) => {
1153
+ return this.disposeWithMe(r.pipe(A0(100), x0((t) => !!t.length), _0((t) => {
1154
1154
  const e = /* @__PURE__ */ new Set(), n = [];
1155
1155
  return t.forEach((i) => {
1156
1156
  const a = `${i.unitId}_${i.subUnitId}_${i.cfId}`;
1157
1157
  if (e.has(a)) {
1158
1158
  if (i.isNeedResetPreComputingCache) {
1159
- const c = n.find((l) => l.cfId === i.cfId);
1159
+ const c = n.find((o) => o.cfId === i.cfId);
1160
1160
  c.isNeedResetPreComputingCache = !0;
1161
1161
  }
1162
1162
  return;
@@ -1189,8 +1189,8 @@ let Q = class extends x2 {
1189
1189
  }
1190
1190
  _getCellCfs(r, t, e, n) {
1191
1191
  var d;
1192
- const i = (d = this._conditionalFormattingRuleModel.getSubunitRules(r, t)) != null ? d : [], a = this._ensureCalculateUnitManager(r, t), c = this._rTreeManager.bulkSearch([{ unitId: r, sheetId: t, range: { startColumn: n, endColumn: n, startRow: e, endRow: e } }]), l = i.filter((u) => c.has(u.cfId));
1193
- return l.length ? l.map((u) => {
1192
+ const i = (d = this._conditionalFormattingRuleModel.getSubunitRules(r, t)) != null ? d : [], a = this._ensureCalculateUnitManager(r, t), c = this._rTreeManager.bulkSearch([{ unitId: r, sheetId: t, range: { startColumn: n, endColumn: n, startRow: e, endRow: e } }]), o = i.filter((u) => c.has(u.cfId));
1193
+ return o.length ? o.map((u) => {
1194
1194
  const h = a.get(u.cfId);
1195
1195
  return h ? {
1196
1196
  cfId: u.cfId,
@@ -1199,14 +1199,17 @@ let Q = class extends x2 {
1199
1199
  }).filter((u) => !!u).map((u, h) => ({ ...u, priority: h })) : [];
1200
1200
  }
1201
1201
  dispose() {
1202
- this._calculateUnitManagers.clear(), this._cellCache.clear(), this._rTreeManager.clear(), super.dispose();
1202
+ this.clearCache(), super.dispose();
1203
+ }
1204
+ clearCache() {
1205
+ this._calculateUnitManagers.clear(), this._cellCache.clear(), this._rTreeManager.clear();
1203
1206
  }
1204
1207
  _handleCustomFormulasSeparately() {
1205
1208
  this.disposeWithMe(
1206
1209
  this._conditionalFormattingRuleModel.$ruleChange.subscribe((r) => {
1207
1210
  if (r.type === "set") {
1208
1211
  const { unitId: t, subUnitId: e } = r, n = r.oldRule;
1209
- n.rule.type === y.highlightCell && n.rule.subType === _.formula && this._conditionalFormattingFormulaService.deleteCache(t, e, n.cfId);
1212
+ n.rule.type === M.highlightCell && n.rule.subType === x.formula && this._conditionalFormattingFormulaService.deleteCache(t, e, n.cfId);
1210
1213
  }
1211
1214
  })
1212
1215
  );
@@ -1217,29 +1220,29 @@ let Q = class extends x2 {
1217
1220
  const { unitId: t, subUnitId: e, rule: n } = r, { cfId: i, ranges: a } = n, c = this._ensureCalculateUnitManager(t, e);
1218
1221
  switch (this.markRuleDirty(t, e, i), r.type) {
1219
1222
  case "add": {
1220
- this._rTreeManager.bulkInsert(a.map((o) => ({ unitId: t, sheetId: e, id: i, range: o })));
1221
- const l = this._createRuleCalculateUnitInstance(t, e, n);
1222
- if (!l)
1223
+ this._rTreeManager.bulkInsert(a.map((l) => ({ unitId: t, sheetId: e, id: i, range: l })));
1224
+ const o = this._createRuleCalculateUnitInstance(t, e, n);
1225
+ if (!o)
1223
1226
  return;
1224
- c.set(n.cfId, l);
1227
+ c.set(n.cfId, o);
1225
1228
  break;
1226
1229
  }
1227
1230
  case "delete": {
1228
- this._rTreeManager.bulkRemove(a.map((l) => ({ unitId: t, sheetId: e, id: i, range: l }))), c.delete(n.cfId);
1231
+ this._rTreeManager.bulkRemove(a.map((o) => ({ unitId: t, sheetId: e, id: i, range: o }))), c.delete(n.cfId);
1229
1232
  break;
1230
1233
  }
1231
1234
  case "set": {
1232
- const l = r.oldRule;
1233
- if (this._rTreeManager.bulkRemove(l.ranges.map((o) => ({ unitId: t, sheetId: e, id: l.cfId, range: o }))), this._rTreeManager.bulkInsert(a.map((o) => ({ unitId: t, sheetId: e, id: i, range: o }))), l.rule.type !== n.rule.type) {
1234
- const o = this._createRuleCalculateUnitInstance(t, e, n);
1235
- if (!o)
1235
+ const o = r.oldRule;
1236
+ if (this._rTreeManager.bulkRemove(o.ranges.map((l) => ({ unitId: t, sheetId: e, id: o.cfId, range: l }))), this._rTreeManager.bulkInsert(a.map((l) => ({ unitId: t, sheetId: e, id: i, range: l }))), o.rule.type !== n.rule.type) {
1237
+ const l = this._createRuleCalculateUnitInstance(t, e, n);
1238
+ if (!l)
1236
1239
  return;
1237
- c.delete(l.cfId), c.set(n.cfId, o);
1240
+ c.delete(o.cfId), c.set(n.cfId, l);
1238
1241
  } else {
1239
- const o = c.get(l.cfId);
1240
- if (!o)
1242
+ const l = c.get(o.cfId);
1243
+ if (!l)
1241
1244
  return;
1242
- o.updateRule(n);
1245
+ l.updateRule(n);
1243
1246
  }
1244
1247
  }
1245
1248
  }
@@ -1263,24 +1266,24 @@ let Q = class extends x2 {
1263
1266
  subUnitId: t,
1264
1267
  accessor: this._injector,
1265
1268
  rule: e,
1266
- limit: E2,
1267
- getCellValue: (c, l) => i.getCellRaw(c, l) || {}
1269
+ limit: p2,
1270
+ getCellValue: (c, o) => i.getCellRaw(c, o) || {}
1268
1271
  };
1269
1272
  switch (e.rule.type) {
1270
- case y.colorScale:
1273
+ case M.colorScale:
1271
1274
  return new $0(a);
1272
- case y.dataBar:
1275
+ case M.dataBar:
1273
1276
  return new j0(a);
1274
- case y.highlightCell:
1277
+ case M.highlightCell:
1278
+ return new K0(a);
1279
+ case M.iconSet:
1275
1280
  return new X0(a);
1276
- case y.iconSet:
1277
- return new Y0(a);
1278
1281
  }
1279
1282
  }
1280
1283
  _createCacheKey(r, t, e, n) {
1281
1284
  return `${r}_${t}_${e}_${n}`;
1282
1285
  }
1283
- setCacheLength(r = E2) {
1286
+ setCacheLength(r = p2) {
1284
1287
  this._cellCache.limit !== r && (this._cellCache.limit = r, this._calculateUnitManagers.forEach((t) => {
1285
1288
  t.forEach((e) => {
1286
1289
  e.forEach((n) => {
@@ -1290,24 +1293,24 @@ let Q = class extends x2 {
1290
1293
  }));
1291
1294
  }
1292
1295
  };
1293
- Q = z0([
1294
- c2(0, b(M2)),
1296
+ e2 = z0([
1297
+ c2(0, b(_2)),
1295
1298
  c2(1, b(R)),
1296
- c2(2, b(z)),
1297
- c2(3, q)
1298
- ], Q);
1299
+ c2(2, b(Q)),
1300
+ c2(3, Z)
1301
+ ], e2);
1299
1302
  function h2(s, r) {
1300
1303
  return Math.abs(s - r) < Number.EPSILON;
1301
1304
  }
1302
- const x = (s) => s == null || typeof s == "string" && s.trim() === "", P = (s) => {
1305
+ const _ = (s) => s == null || typeof s == "string" && s.trim() === "", W = (s) => {
1303
1306
  var e, n;
1304
1307
  if (!s)
1305
1308
  return null;
1306
- if (s.t === M.BOOLEAN)
1307
- return s.v === N2.TRUE ? I2.TRUE : I2.FALSE;
1309
+ if (s.t === y.BOOLEAN)
1310
+ return s.v === B2.TRUE ? R2.TRUE : R2.FALSE;
1308
1311
  const r = s.v, t = (n = (e = s.p) == null ? void 0 : e.body) == null ? void 0 : n.dataStream.replace(/\r\n$/, "");
1309
- return x(r) ? x(t) ? null : t : r;
1310
- }, A2 = 86400;
1312
+ return _(r) ? _(t) ? null : t : r;
1313
+ }, E2 = 86400;
1311
1314
  function Q0(s, r = !0) {
1312
1315
  if (r && s >= 0) {
1313
1316
  if (s === 0)
@@ -1329,11 +1332,11 @@ function Q0(s, r = !0) {
1329
1332
  }
1330
1333
  const e1 = (s) => {
1331
1334
  let r = s | 0;
1332
- const t = A2 * (s - r);
1335
+ const t = E2 * (s - r);
1333
1336
  let e = Math.floor(t);
1334
- t - e > 0.9999 && (e += 1, e === A2 && (e = 0, r += 1));
1335
- const n = e < 0 ? A2 + e : e, [i, a, c] = Q0(s, !0), l = Math.floor(n / 60 / 60) % 60, o = Math.floor(n / 60) % 60, d = Math.floor(n) % 60;
1336
- return v(`${i}/${a}/${c} ${l}:${o}:${d}`).valueOf();
1337
+ t - e > 0.9999 && (e += 1, e === E2 && (e = 0, r += 1));
1338
+ const n = e < 0 ? E2 + e : e, [i, a, c] = Q0(s, !0), o = Math.floor(n / 60 / 60) % 60, l = Math.floor(n / 60) % 60, d = Math.floor(n) % 60;
1339
+ return v(`${i}/${a}/${c} ${o}:${l}:${d}`).valueOf();
1337
1340
  }, g2 = (s, r, t) => {
1338
1341
  switch (s.type) {
1339
1342
  case L.max: {
@@ -1356,8 +1359,8 @@ const e1 = (s) => {
1356
1359
  }
1357
1360
  case L.percent: {
1358
1361
  let e, n;
1359
- r.forValue((c, l, o) => {
1360
- (e === void 0 || n === void 0) && (e = o, n = o), o > e && (e = o), o < n && (n = o);
1362
+ r.forValue((c, o, l) => {
1363
+ (e === void 0 || n === void 0) && (e = l, n = l), l > e && (e = l), l < n && (n = l);
1361
1364
  });
1362
1365
  const i = (e || 0) - (n || 0), a = Math.max(Math.min(Number(s.value) || 0, 100), 0);
1363
1366
  return {
@@ -1366,15 +1369,15 @@ const e1 = (s) => {
1366
1369
  };
1367
1370
  }
1368
1371
  case L.percentile: {
1369
- const e = r.toNativeArray().sort((o, d) => o - d), n = Math.max(Math.min(Number(s.value) || 0, 100), 0), i = (e.length - 1) * n / 100, a = Math.floor(i), c = i - a, l = e[a] + (e[Math.min(a + 1, e.length - 1)] - e[a]) * c;
1372
+ const e = r.toNativeArray().sort((l, d) => l - d), n = Math.max(Math.min(Number(s.value) || 0, 100), 0), i = (e.length - 1) * n / 100, a = Math.floor(i), c = i - a, o = e[a] + (e[Math.min(a + 1, e.length - 1)] - e[a]) * c;
1370
1373
  return {
1371
1374
  status: p.SUCCESS,
1372
- result: l
1375
+ result: o
1373
1376
  };
1374
1377
  }
1375
1378
  case L.formula: {
1376
- const { accessor: e, unitId: n, subUnitId: i, cfId: a } = t, c = String(s.value), l = e.get(z);
1377
- return l.registerFormulaWithRange(n, i, a, c), l.getFormulaResultWithCoords(n, i, a, c);
1379
+ const { accessor: e, unitId: n, subUnitId: i, cfId: a } = t, c = String(s.value), o = e.get(Q);
1380
+ return o.registerFormulaWithRange(n, i, a, c), o.getFormulaResultWithCoords(n, i, a, c);
1378
1381
  }
1379
1382
  case L.num:
1380
1383
  default: {
@@ -1385,52 +1388,52 @@ const e1 = (s) => {
1385
1388
  };
1386
1389
  }
1387
1390
  }
1388
- }, Z1 = (s, r, t, e) => {
1389
- const { accessor: n } = e, i = n.get(Q), a = new V();
1391
+ }, W1 = (s, r, t, e) => {
1392
+ const { accessor: n } = e, i = n.get(e2), a = new O();
1390
1393
  return t.ranges.forEach((c) => {
1391
- T.foreach(c, (l, o) => {
1392
- const d = i.getCellCfs(s, r, l, o);
1394
+ U.foreach(c, (o, l) => {
1395
+ const d = i.getCellCfs(s, r, o, l);
1393
1396
  if (d) {
1394
1397
  const u = d.find((h) => h.cfId === t.cfId);
1395
- u != null && u.result && a.setValue(l, o, u.result);
1398
+ u != null && u.result && a.setValue(o, l, u.result);
1396
1399
  }
1397
1400
  });
1398
1401
  }), a;
1399
1402
  }, r2 = (s, r) => {
1400
1403
  switch (s.operator) {
1401
- case w.between: {
1404
+ case F.between: {
1402
1405
  if (typeof s.value != "object" || !s.value.length)
1403
1406
  return;
1404
1407
  const t = Math.min(...s.value), e = Math.max(...s.value);
1405
1408
  return r >= t && r <= e;
1406
1409
  }
1407
- case w.notBetween: {
1410
+ case F.notBetween: {
1408
1411
  if (typeof s.value != "object" || !s.value.length)
1409
1412
  return;
1410
1413
  const t = Math.min(...s.value), e = Math.max(...s.value);
1411
1414
  return !(r >= t && r <= e);
1412
1415
  }
1413
- case w.equal: {
1416
+ case F.equal: {
1414
1417
  const t = s.value || 0;
1415
1418
  return h2(t, r);
1416
1419
  }
1417
- case w.notEqual: {
1420
+ case F.notEqual: {
1418
1421
  const t = s.value || 0;
1419
1422
  return !h2(t, r);
1420
1423
  }
1421
- case w.greaterThan: {
1424
+ case F.greaterThan: {
1422
1425
  const t = s.value || 0;
1423
1426
  return r > t;
1424
1427
  }
1425
- case w.greaterThanOrEqual: {
1428
+ case F.greaterThanOrEqual: {
1426
1429
  const t = s.value || 0;
1427
1430
  return r >= t;
1428
1431
  }
1429
- case w.lessThan: {
1432
+ case F.lessThan: {
1430
1433
  const t = s.value || 0;
1431
1434
  return r < t;
1432
1435
  }
1433
- case w.lessThanOrEqual: {
1436
+ case F.lessThanOrEqual: {
1434
1437
  const t = s.value || 0;
1435
1438
  return r <= t;
1436
1439
  }
@@ -1439,14 +1442,14 @@ const e1 = (s) => {
1439
1442
  }
1440
1443
  }, t1 = (s) => {
1441
1444
  switch (s) {
1442
- case w.greaterThan:
1443
- return w.lessThanOrEqual;
1444
- case w.greaterThanOrEqual:
1445
- return w.lessThan;
1446
- case w.lessThan:
1447
- return w.greaterThanOrEqual;
1448
- case w.lessThanOrEqual:
1449
- return w.greaterThan;
1445
+ case F.greaterThan:
1446
+ return F.lessThanOrEqual;
1447
+ case F.greaterThanOrEqual:
1448
+ return F.lessThan;
1449
+ case F.lessThan:
1450
+ return F.greaterThanOrEqual;
1451
+ case F.lessThanOrEqual:
1452
+ return F.greaterThan;
1450
1453
  }
1451
1454
  return s;
1452
1455
  }, n1 = (s, r) => {
@@ -1456,11 +1459,11 @@ const e1 = (s) => {
1456
1459
  if (n >= 0) {
1457
1460
  const i = s[n], a = s[e];
1458
1461
  if (i.color.isValid && a.color.isValid) {
1459
- const c = t(i.color.toRgb()), l = t(a.color.toRgb()), o = a.value - i.value, d = (r - i.value) / o, u = ["r", "g", "b", "a"].reduce((g, f) => {
1462
+ const c = t(i.color.toRgb()), o = t(a.color.toRgb()), l = a.value - i.value, d = (r - i.value) / l, u = ["r", "g", "b", "a"].reduce((g, f) => {
1460
1463
  const D = c[f];
1461
- return g[f] = (l[f] - D) * d + D, g;
1464
+ return g[f] = (o[f] - D) * d + D, g;
1462
1465
  }, {});
1463
- return new U2(u).toRgbString();
1466
+ return new T2(u).toRgbString();
1464
1467
  }
1465
1468
  } else
1466
1469
  return s[s.length - 1].color.toRgbString();
@@ -1470,9 +1473,9 @@ const e1 = (s) => {
1470
1473
  const n = { ...e };
1471
1474
  return n.endRow = Math.min(n.endRow, r), n.endColumn = Math.min(n.endColumn, t), n;
1472
1475
  }).filter((e) => !!e);
1473
- function G1(s) {
1476
+ function q1(s) {
1474
1477
  let r = 0;
1475
- return new V(s).forValue((t, e, n) => {
1478
+ return new O(s).forValue((t, e, n) => {
1476
1479
  r = Math.max(Number.isNaN(r) ? 0 : r, Number(n));
1477
1480
  }), r;
1478
1481
  }
@@ -1578,39 +1581,39 @@ for (const s in C2) {
1578
1581
  const r = C2[s];
1579
1582
  Object.freeze(r);
1580
1583
  }
1581
- const C1 = "EMPTY_ICON_TYPE", f1 = "ssheets-conditional-formatting.config", k2 = {};
1584
+ const C1 = "EMPTY_ICON_TYPE", f1 = "ssheets-conditional-formatting.config", L2 = {};
1582
1585
  var D1 = Object.getOwnPropertyDescriptor, m1 = (s, r, t, e) => {
1583
1586
  for (var n = e > 1 ? void 0 : e ? D1(r, t) : r, i = s.length - 1, a; i >= 0; i--)
1584
1587
  (a = s[i]) && (n = a(n) || n);
1585
1588
  return n;
1586
- }, Y = (s, r) => (t, e) => r(t, e, s);
1589
+ }, J = (s, r) => (t, e) => r(t, e, s);
1587
1590
  let s2 = class extends x2 {
1588
1591
  constructor(s, r, t, e, n, i) {
1589
1592
  super(), this._conditionalFormattingRuleModel = s, this._injector = r, this._univerInstanceService = t, this._resourceManagerService = e, this._sheetInterceptorService = n, this._commandService = i, this._initCellChange(), this._initSnapshot(), this._initSheetChange();
1590
1593
  }
1591
1594
  get _conditionalFormattingViewModelV2() {
1592
- return this._injector.get(Q);
1595
+ return this._injector.get(e2);
1593
1596
  }
1594
1597
  composeStyle(s, r, t, e) {
1595
1598
  const n = this._conditionalFormattingViewModelV2.getCellCfs(s, r, t, e);
1596
1599
  if (n && (n != null && n.length)) {
1597
- const i = n.map((l) => this._conditionalFormattingRuleModel.getRule(s, r, l.cfId)).filter((l) => !!l).reverse(), a = i.findIndex((l) => l == null ? void 0 : l.stopIfTrue);
1598
- return a > -1 && i.splice(a + 1), i.reduce((l, o) => {
1600
+ const i = n.map((o) => this._conditionalFormattingRuleModel.getRule(s, r, o.cfId)).filter((o) => !!o).reverse(), a = i.findIndex((o) => o == null ? void 0 : o.stopIfTrue);
1601
+ return a > -1 && i.splice(a + 1), i.reduce((o, l) => {
1599
1602
  var h;
1600
- const d = o.rule.type, u = n.find((g) => g.cfId === o.cfId);
1601
- if (d === y.highlightCell)
1602
- u.result && V2(l, { style: u.result });
1603
- else if (d === y.colorScale) {
1603
+ const d = l.rule.type, u = n.find((g) => g.cfId === l.cfId);
1604
+ if (d === M.highlightCell)
1605
+ u.result && U2(o, { style: u.result });
1606
+ else if (d === M.colorScale) {
1604
1607
  const g = u == null ? void 0 : u.result;
1605
- g && typeof g == "string" && (l.style = { ...(h = l.style) != null ? h : {}, bg: { rgb: g } });
1606
- } else if (d === y.dataBar) {
1608
+ g && typeof g == "string" && (o.style = { ...(h = o.style) != null ? h : {}, bg: { rgb: g } });
1609
+ } else if (d === M.dataBar) {
1607
1610
  const g = u == null ? void 0 : u.result;
1608
- g && (l.dataBar = g, l.isShowValue = g.isShowValue);
1609
- } else if (d === y.iconSet) {
1611
+ g && (o.dataBar = g, o.isShowValue = g.isShowValue);
1612
+ } else if (d === M.iconSet) {
1610
1613
  const g = u == null ? void 0 : u.result;
1611
- g && (l.iconSet = g, l.isShowValue = g.isShowValue);
1614
+ g && (o.iconSet = g, o.isShowValue = g.isShowValue);
1612
1615
  }
1613
- return l;
1616
+ return o;
1614
1617
  }, {});
1615
1618
  }
1616
1619
  return null;
@@ -1633,11 +1636,11 @@ let s2 = class extends x2 {
1633
1636
  this.disposeWithMe(
1634
1637
  this._resourceManagerService.registerPluginResource({
1635
1638
  pluginName: P2,
1636
- businesses: [D2.UNIVER_SHEET],
1639
+ businesses: [V2.UNIVER_SHEET],
1637
1640
  toJson: (t) => s(t),
1638
1641
  parseJson: (t) => r(t),
1639
1642
  onUnLoad: (t) => {
1640
- this._conditionalFormattingRuleModel.deleteUnitId(t), !z2(t) && this._conditionalFormattingViewModelV2.dispose();
1643
+ this._conditionalFormattingRuleModel.deleteUnitId(t), !z2(t) && this._conditionalFormattingViewModelV2.clearCache();
1641
1644
  },
1642
1645
  onLoad: (t, e) => {
1643
1646
  Object.keys(e).forEach((n) => {
@@ -1654,46 +1657,46 @@ let s2 = class extends x2 {
1654
1657
  this._sheetInterceptorService.interceptCommand({
1655
1658
  getMutations: (s) => {
1656
1659
  if (s.id === l0.id) {
1657
- const r = s.params, t = r.unitId || F1(this._univerInstanceService), e = r.subUnitId || w1(this._univerInstanceService);
1658
- if (!e)
1660
+ const r = s.params, t = k(this._univerInstanceService, r);
1661
+ if (!t)
1659
1662
  return { redos: [], undos: [] };
1660
- const n = this._conditionalFormattingRuleModel.getSubunitRules(t, e);
1661
- if (!n)
1663
+ const { unitId: e, subUnitId: n } = t, i = this._conditionalFormattingRuleModel.getSubunitRules(e, n);
1664
+ if (!i)
1662
1665
  return { redos: [], undos: [] };
1663
- const i = [], a = [];
1664
- return n.forEach((c) => {
1666
+ const a = [], c = [];
1667
+ return i.forEach((o) => {
1665
1668
  const l = {
1666
- unitId: t,
1667
- subUnitId: e,
1668
- cfId: c.cfId
1669
+ unitId: e,
1670
+ subUnitId: n,
1671
+ cfId: o.cfId
1669
1672
  };
1670
- i.push({
1671
- id: K.id,
1673
+ a.push({
1674
+ id: X.id,
1672
1675
  params: l
1673
- }), a.push(...m2(this._injector, l));
1676
+ }), c.push(...D2(this._injector, l));
1674
1677
  }), {
1675
- redos: i,
1676
- undos: a
1678
+ redos: a,
1679
+ undos: c
1677
1680
  };
1678
1681
  } else if (s.id === o0.id) {
1679
- const r = s.params, { unitId: t, subUnitId: e, targetSubUnitId: n } = r;
1680
- if (!t || !e || !n)
1682
+ const r = s.params, t = k(this._univerInstanceService, r);
1683
+ if (!t)
1681
1684
  return { redos: [], undos: [] };
1682
- const i = this._conditionalFormattingRuleModel.getSubunitRules(t, e);
1683
- if (!i)
1685
+ const { unitId: e, subUnitId: n } = t, { targetSubUnitId: i } = r, a = this._conditionalFormattingRuleModel.getSubunitRules(e, n);
1686
+ if (!a)
1684
1687
  return { redos: [], undos: [] };
1685
- const a = [], c = [];
1686
- return i.forEach((l) => {
1687
- const o = {
1688
- unitId: t,
1689
- subUnitId: n,
1688
+ const c = [], o = [];
1689
+ return a.forEach((l) => {
1690
+ const d = {
1691
+ unitId: e,
1692
+ subUnitId: i,
1690
1693
  rule: {
1691
1694
  ...l,
1692
- cfId: this._conditionalFormattingRuleModel.createCfId(t, n)
1695
+ cfId: this._conditionalFormattingRuleModel.createCfId(e, i)
1693
1696
  }
1694
1697
  };
1695
- a.push({ id: a2.id, params: o }), c.push(q2(this._injector, o));
1696
- }), { redos: a, undos: c };
1698
+ c.push({ id: a2.id, params: d }), o.push(q2(this._injector, d));
1699
+ }), { redos: c, undos: o };
1697
1700
  }
1698
1701
  return { redos: [], undos: [] };
1699
1702
  }
@@ -1708,67 +1711,75 @@ let s2 = class extends x2 {
1708
1711
  const r = (t, e, n) => {
1709
1712
  const i = /* @__PURE__ */ new Set();
1710
1713
  return n.forEach(([a, c]) => {
1711
- const l = this._conditionalFormattingViewModelV2.getCellCfs(t, e, a, c);
1712
- l == null || l.forEach((o) => i.add(o.cfId));
1714
+ const o = this._conditionalFormattingViewModelV2.getCellCfs(t, e, a, c);
1715
+ o == null || o.forEach((l) => i.add(l.cfId));
1713
1716
  }), [...i].map((a) => this._conditionalFormattingRuleModel.getRule(t, e, a)).filter((a) => !!a);
1714
1717
  };
1715
1718
  switch (s.id) {
1716
1719
  case m0.id: {
1717
1720
  const t = s.params, { subUnitId: e, unitId: n, cellValue: i } = t, a = [];
1718
- new V(i).forValue((l, o, d) => {
1719
- d && Object.keys(d).some((h) => ["p", "v"].includes(h)) && a.push([l, o]);
1720
- }), r(n, e, a).forEach((l) => {
1721
- this._conditionalFormattingViewModelV2.markRuleDirty(n, e, l.cfId);
1721
+ new O(i).forValue((o, l, d) => {
1722
+ d && Object.keys(d).some((h) => ["p", "v"].includes(h)) && a.push([o, l]);
1723
+ }), r(n, e, a).forEach((o) => {
1724
+ this._conditionalFormattingViewModelV2.markRuleDirty(n, e, o.cfId);
1722
1725
  });
1723
1726
  break;
1724
1727
  }
1725
1728
  case D0.id:
1726
1729
  case f0.id: {
1727
- const { range: t, unitId: e, subUnitId: n } = s.params, i = this._conditionalFormattingRuleModel.getSubunitRules(e, n), a = { ...t, endColumn: Number.MAX_SAFE_INTEGER };
1728
- i && i.filter((l) => l.ranges.some((o) => n2.intersects(o, a))).forEach((l) => {
1729
- this._conditionalFormattingViewModelV2.markRuleDirty(e, n, l.cfId);
1730
+ const t = s.params, e = k(this._univerInstanceService, t);
1731
+ if (!e) return;
1732
+ const { worksheet: n, unitId: i, subUnitId: a } = e, { range: c } = t, o = { ...c, endColumn: n.getColumnCount() - 1 }, l = this._conditionalFormattingRuleModel.getSubunitRules(i, a);
1733
+ l && l.filter((u) => u.ranges.some((h) => n2.intersects(h, o))).forEach((u) => {
1734
+ this._conditionalFormattingViewModelV2.markRuleDirty(i, a, u.cfId);
1730
1735
  });
1731
1736
  break;
1732
1737
  }
1733
1738
  case C0.id:
1734
1739
  case g0.id: {
1735
- const { range: t, unitId: e, subUnitId: n } = s.params, i = this._conditionalFormattingRuleModel.getSubunitRules(e, n), a = { ...t, endRow: Number.MAX_SAFE_INTEGER };
1736
- i && i.filter((l) => l.ranges.some((o) => n2.intersects(o, a))).forEach((l) => {
1737
- this._conditionalFormattingViewModelV2.markRuleDirty(e, n, l.cfId);
1740
+ const t = s.params, e = k(this._univerInstanceService, t);
1741
+ if (!e) return;
1742
+ const { worksheet: n, unitId: i, subUnitId: a } = e, { range: c } = t, o = { ...c, endRow: n.getRowCount() - 1 }, l = this._conditionalFormattingRuleModel.getSubunitRules(i, a);
1743
+ l && l.filter((u) => u.ranges.some((h) => n2.intersects(h, o))).forEach((u) => {
1744
+ this._conditionalFormattingViewModelV2.markRuleDirty(i, a, u.cfId);
1738
1745
  });
1739
1746
  break;
1740
1747
  }
1741
1748
  case h0.id: {
1742
- const { sourceRange: t, targetRange: e, unitId: n, subUnitId: i } = s.params, a = this._conditionalFormattingRuleModel.getSubunitRules(n, i), c = {
1743
- startRow: Math.min(t.startRow, e.startRow),
1744
- endRow: Number.MAX_SAFE_INTEGER,
1749
+ const t = s.params, e = k(this._univerInstanceService, t);
1750
+ if (!e) return;
1751
+ const { worksheet: n, unitId: i, subUnitId: a } = e, { sourceRange: c, targetRange: o } = t, l = {
1752
+ startRow: Math.min(c.startRow, o.startRow),
1753
+ endRow: n.getRowCount() - 1,
1745
1754
  startColumn: 0,
1746
- endColumn: Number.MAX_SAFE_INTEGER
1747
- };
1748
- a && a.filter((o) => o.ranges.some((d) => n2.intersects(d, c))).forEach((o) => {
1749
- this._conditionalFormattingViewModelV2.markRuleDirty(n, i, o.cfId);
1755
+ endColumn: n.getColumnCount() - 1
1756
+ }, d = this._conditionalFormattingRuleModel.getSubunitRules(i, a);
1757
+ d && d.filter((h) => h.ranges.some((g) => n2.intersects(g, l))).forEach((h) => {
1758
+ this._conditionalFormattingViewModelV2.markRuleDirty(i, a, h.cfId);
1750
1759
  });
1751
1760
  break;
1752
1761
  }
1753
1762
  case d0.id: {
1754
- const { sourceRange: t, targetRange: e, unitId: n, subUnitId: i } = s.params, a = this._conditionalFormattingRuleModel.getSubunitRules(n, i), c = {
1763
+ const t = s.params, e = k(this._univerInstanceService, t);
1764
+ if (!e) return;
1765
+ const { worksheet: n, unitId: i, subUnitId: a } = e, { sourceRange: c, targetRange: o } = t, l = {
1755
1766
  startRow: 0,
1756
- endRow: Number.MAX_SAFE_INTEGER,
1757
- startColumn: Math.min(t.startColumn, e.startColumn),
1758
- endColumn: Number.MAX_SAFE_INTEGER
1759
- };
1760
- a && a.filter((o) => o.ranges.some((d) => n2.intersects(d, c))).forEach((o) => {
1761
- this._conditionalFormattingViewModelV2.markRuleDirty(n, i, o.cfId);
1767
+ endRow: n.getRowCount() - 1,
1768
+ startColumn: Math.min(c.startColumn, o.startColumn),
1769
+ endColumn: n.getColumnCount() - 1
1770
+ }, d = this._conditionalFormattingRuleModel.getSubunitRules(i, a);
1771
+ d && d.filter((h) => h.ranges.some((g) => n2.intersects(g, l))).forEach((h) => {
1772
+ this._conditionalFormattingViewModelV2.markRuleDirty(i, a, h.cfId);
1762
1773
  });
1763
1774
  break;
1764
1775
  }
1765
1776
  case c0.id: {
1766
1777
  const { unitId: t, to: e, from: n } = s.params, i = (a) => {
1767
1778
  const c = [];
1768
- new V(a.value).forValue((o, d) => {
1769
- c.push([o, d]);
1770
- }), r(t, a.subUnitId, c).forEach((o) => {
1771
- this._conditionalFormattingViewModelV2.markRuleDirty(t, a.subUnitId, o.cfId);
1779
+ new O(a.value).forValue((l, d) => {
1780
+ c.push([l, d]);
1781
+ }), r(t, a.subUnitId, c).forEach((l) => {
1782
+ this._conditionalFormattingViewModelV2.markRuleDirty(t, a.subUnitId, l.cfId);
1772
1783
  });
1773
1784
  };
1774
1785
  i(e), i(n);
@@ -1776,7 +1787,7 @@ let s2 = class extends x2 {
1776
1787
  }
1777
1788
  case u0.id: {
1778
1789
  const { range: t, unitId: e, subUnitId: n } = s.params, i = this._conditionalFormattingRuleModel.getSubunitRules(e, n);
1779
- i && i.filter((c) => c.ranges.some((l) => n2.intersects(l, t))).forEach((c) => {
1790
+ i && i.filter((c) => c.ranges.some((o) => n2.intersects(o, t))).forEach((c) => {
1780
1791
  this._conditionalFormattingViewModelV2.markRuleDirty(e, n, c.cfId);
1781
1792
  });
1782
1793
  break;
@@ -1787,35 +1798,31 @@ let s2 = class extends x2 {
1787
1798
  }
1788
1799
  };
1789
1800
  s2 = m1([
1790
- Y(0, b(R)),
1791
- Y(1, b(M2)),
1792
- Y(2, b(q)),
1793
- Y(3, b(J2)),
1794
- Y(4, b(a0)),
1795
- Y(5, b(W))
1801
+ J(0, b(R)),
1802
+ J(1, b(_2)),
1803
+ J(2, b(Z)),
1804
+ J(3, b(J2)),
1805
+ J(4, b(a0)),
1806
+ J(5, b(q))
1796
1807
  ], s2);
1797
- const F1 = (s) => s.getCurrentUnitForType(D2.UNIVER_SHEET).getUnitId(), w1 = (s) => {
1798
- var r;
1799
- return (r = s.getCurrentUnitForType(D2.UNIVER_SHEET).getActiveSheet()) == null ? void 0 : r.getSheetId();
1800
- };
1801
- var v1 = Object.defineProperty, p1 = Object.getOwnPropertyDescriptor, E1 = (s, r, t) => r in s ? v1(s, r, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[r] = t, A1 = (s, r, t, e) => {
1802
- for (var n = e > 1 ? void 0 : e ? p1(r, t) : r, i = s.length - 1, a; i >= 0; i--)
1808
+ var w1 = Object.defineProperty, F1 = Object.getOwnPropertyDescriptor, v1 = (s, r, t) => r in s ? w1(s, r, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[r] = t, p1 = (s, r, t, e) => {
1809
+ for (var n = e > 1 ? void 0 : e ? F1(r, t) : r, i = s.length - 1, a; i >= 0; i--)
1803
1810
  (a = s[i]) && (n = a(n) || n);
1804
1811
  return n;
1805
- }, _2 = (s, r) => (t, e) => r(t, e, s), G2 = (s, r, t) => E1(s, typeof r != "symbol" ? r + "" : r, t);
1812
+ }, A2 = (s, r) => (t, e) => r(t, e, s), G2 = (s, r, t) => v1(s, typeof r != "symbol" ? r + "" : r, t);
1806
1813
  let f2 = class extends t0 {
1807
- constructor(s = k2, r, t, e) {
1814
+ constructor(s = L2, r, t, e) {
1808
1815
  super(), this._config = s, this._injector = r, this._commandService = t, this._configService = e;
1809
- const { ...n } = V2(
1816
+ const { ...n } = U2(
1810
1817
  {},
1811
- k2,
1818
+ L2,
1812
1819
  this._config
1813
1820
  );
1814
1821
  this._configService.setConfig(f1, n), [
1815
1822
  [s2],
1816
- [z],
1823
+ [Q],
1817
1824
  [R],
1818
- [Q]
1825
+ [e2]
1819
1826
  ].forEach((i) => {
1820
1827
  this._injector.add(i);
1821
1828
  }), [
@@ -1826,7 +1833,7 @@ let f2 = class extends t0 {
1826
1833
  T0,
1827
1834
  U0,
1828
1835
  a2,
1829
- K,
1836
+ X,
1830
1837
  l2,
1831
1838
  i2
1832
1839
  ].forEach((i) => {
@@ -1836,30 +1843,30 @@ let f2 = class extends t0 {
1836
1843
  onStarting() {
1837
1844
  this._injector.get(s2), n0(this._injector, [
1838
1845
  [s2],
1839
- [Q]
1846
+ [e2]
1840
1847
  ]);
1841
1848
  }
1842
1849
  };
1843
1850
  G2(f2, "pluginName", P2);
1844
- G2(f2, "type", D2.UNIVER_SHEET);
1845
- f2 = A1([
1851
+ G2(f2, "type", V2.UNIVER_SHEET);
1852
+ f2 = p1([
1846
1853
  Q2(p0),
1847
- _2(1, b(M2)),
1848
- _2(2, b(W)),
1849
- _2(3, e0)
1854
+ A2(1, b(_2)),
1855
+ A2(2, b(q)),
1856
+ A2(3, e0)
1850
1857
  ], f2);
1851
- const _1 = "sheet-conditional-rule-icon", x1 = 35, M1 = 15, y1 = 2, R1 = (s) => {
1858
+ const E1 = "sheet-conditional-rule-icon", A1 = 35, x1 = 15, _1 = 2, y1 = (s) => {
1852
1859
  const { startRow: r, endRow: t, startColumn: e, endColumn: n } = s;
1853
1860
  return `${r}-${t}-${e}-${n}`;
1854
1861
  };
1855
- class I1 extends $2 {
1862
+ class M1 extends $2 {
1856
1863
  constructor() {
1857
1864
  super();
1858
- m(this, "_paddingRightAndLeft", y1);
1859
- m(this, "_width", M1);
1865
+ m(this, "_paddingRightAndLeft", _1);
1866
+ m(this, "_width", x1);
1860
1867
  m(this, "_imageMap", /* @__PURE__ */ new Map());
1861
- m(this, "uKey", _1);
1862
- m(this, "Z_INDEX", x1);
1868
+ m(this, "uKey", E1);
1869
+ m(this, "Z_INDEX", A1);
1863
1870
  m(this, "_radius", 1);
1864
1871
  this._init();
1865
1872
  }
@@ -1868,30 +1875,30 @@ class I1 extends $2 {
1868
1875
  if (!a)
1869
1876
  return !1;
1870
1877
  const c = /* @__PURE__ */ new Set();
1871
- t.save(), T.foreach(n.rowColumnSegment, (l, o) => {
1872
- if (!a.getRowVisible(l) || !a.getColVisible(o))
1878
+ t.save(), U.foreach(n.rowColumnSegment, (o, l) => {
1879
+ if (!a.getRowVisible(o) || !a.getColVisible(l))
1873
1880
  return;
1874
- const d = n.getCellWithCoordByIndex(l, o, !1), { isMerged: u, isMergedMainCell: h, mergeInfo: g } = d;
1875
- let f = a.getCell(l, o);
1881
+ const d = n.getCellWithCoordByIndex(o, l, !1), { isMerged: u, isMergedMainCell: h, mergeInfo: g } = d;
1882
+ let f = a.getCell(o, l);
1876
1883
  if (u && (f = a.getCell(g.startRow, g.startColumn)), !(f != null && f.iconSet))
1877
1884
  return;
1878
- const { iconType: D, iconId: F } = f.iconSet;
1885
+ const { iconType: D, iconId: w } = f.iconSet;
1879
1886
  if (D === C1)
1880
1887
  return;
1881
- const E = this._imageMap.get(this._createKey(D, F));
1888
+ const E = this._imageMap.get(this._createKey(D, w));
1882
1889
  if (!E || !this.isRenderDiffRangesByCell(g, i))
1883
1890
  return;
1884
1891
  if (u || h) {
1885
- const Z = R1(g);
1886
- if (c.has(Z))
1892
+ const G = y1(g);
1893
+ if (c.has(G))
1887
1894
  return;
1888
- c.add(Z);
1895
+ c.add(G);
1889
1896
  }
1890
- const { startX: I, endX: A, startY: S, endY: k } = u || h ? g : d, v2 = A - I, o2 = k - S;
1891
- if (this._width > o2 || this._width > v2 + this._paddingRightAndLeft * 2)
1897
+ const { startX: I, endX: A, startY: S, endY: B } = u || h ? g : d, F2 = A - I, o2 = B - S;
1898
+ if (this._width > o2 || this._width > F2 + this._paddingRightAndLeft * 2)
1892
1899
  return;
1893
- const p2 = (o2 - this._width) / 2 + S;
1894
- t.drawImage(E, I + this._paddingRightAndLeft, p2, this._width, this._width);
1900
+ const v2 = (o2 - this._width) / 2 + S;
1901
+ t.drawImage(E, I + this._paddingRightAndLeft, v2, this._width, this._width);
1895
1902
  }), t.restore();
1896
1903
  }
1897
1904
  _init() {
@@ -1907,14 +1914,14 @@ class I1 extends $2 {
1907
1914
  return `${t}_${e}`;
1908
1915
  }
1909
1916
  }
1910
- O2.add(I1);
1911
- function S1(s) {
1917
+ O2.add(M1);
1918
+ function R1(s) {
1912
1919
  if (typeof s != "object" || s === null)
1913
1920
  return s;
1914
1921
  const r = {};
1915
1922
  for (const t in s)
1916
1923
  if (s.hasOwnProperty(t)) {
1917
- const e = S1(s[t]);
1924
+ const e = R1(s[t]);
1918
1925
  e !== void 0 && (r[t] = e);
1919
1926
  }
1920
1927
  return r;
@@ -1923,30 +1930,30 @@ export {
1923
1930
  L0 as AddCfCommand,
1924
1931
  a2 as AddConditionalRuleMutation,
1925
1932
  q2 as AddConditionalRuleMutationUndoFactory,
1926
- w as CFNumberOperator,
1927
- y as CFRuleType,
1928
- _ as CFSubRuleType,
1929
- B as CFTextOperator,
1930
- N as CFTimePeriodOperator,
1933
+ F as CFNumberOperator,
1934
+ M as CFRuleType,
1935
+ x as CFSubRuleType,
1936
+ N as CFTextOperator,
1937
+ T as CFTimePeriodOperator,
1931
1938
  L as CFValueType,
1932
- E2 as CONDITIONAL_FORMATTING_VIEWPORT_CACHE_LENGTH,
1939
+ p2 as CONDITIONAL_FORMATTING_VIEWPORT_CACHE_LENGTH,
1933
1940
  k0 as ClearRangeCfCommand,
1934
1941
  B0 as ClearWorksheetCfCommand,
1935
- z as ConditionalFormattingFormulaService,
1936
- I1 as ConditionalFormattingIcon,
1942
+ Q as ConditionalFormattingFormulaService,
1943
+ M1 as ConditionalFormattingIcon,
1937
1944
  R as ConditionalFormattingRuleModel,
1938
1945
  s2 as ConditionalFormattingService,
1939
- Q as ConditionalFormattingViewModel,
1940
- V1 as DEFAULT_BG_COLOR,
1941
- O1 as DEFAULT_FONT_COLOR,
1942
- y1 as DEFAULT_PADDING,
1943
- M1 as DEFAULT_WIDTH,
1946
+ e2 as ConditionalFormattingViewModel,
1947
+ T1 as DEFAULT_BG_COLOR,
1948
+ U1 as DEFAULT_FONT_COLOR,
1949
+ _1 as DEFAULT_PADDING,
1950
+ x1 as DEFAULT_WIDTH,
1944
1951
  G0 as DataBar,
1945
1952
  N0 as DeleteCfCommand,
1946
- K as DeleteConditionalRuleMutation,
1947
- m2 as DeleteConditionalRuleMutationUndoFactory,
1953
+ X as DeleteConditionalRuleMutation,
1954
+ D2 as DeleteConditionalRuleMutationUndoFactory,
1948
1955
  C1 as EMPTY_ICON_TYPE,
1949
- _1 as IconUKey,
1956
+ E1 as IconUKey,
1950
1957
  T0 as MoveCfCommand,
1951
1958
  i2 as MoveConditionalRuleMutation,
1952
1959
  b0 as MoveConditionalRuleMutationUndoFactory,
@@ -1957,29 +1964,29 @@ export {
1957
1964
  I0 as anchorUndoFactory,
1958
1965
  r2 as compareWithNumber,
1959
1966
  S0 as createCfId,
1960
- $1 as createDefaultRule,
1961
- P1 as createDefaultValue,
1962
- W1 as createDefaultValueByValueType,
1967
+ V1 as createDefaultRule,
1968
+ O1 as createDefaultValue,
1969
+ $1 as createDefaultValueByValueType,
1963
1970
  P0 as dataBarUKey,
1964
- L2 as defaultDataBarNativeColor,
1965
- b2 as defaultDataBarPositiveColor,
1971
+ b2 as defaultDataBarNativeColor,
1972
+ S2 as defaultDataBarPositiveColor,
1966
1973
  W0 as defaultPlaceholderColor,
1967
1974
  w2 as filterRange,
1968
- X as findIndexByAnchor,
1969
- Z1 as getCacheStyleMatrix,
1970
- P as getCellValue,
1975
+ Y as findIndexByAnchor,
1976
+ W1 as getCacheStyleMatrix,
1977
+ W as getCellValue,
1971
1978
  n1 as getColorScaleFromValue,
1972
- G1 as getMaxInFormulaResult,
1979
+ q1 as getMaxInFormulaResult,
1973
1980
  t1 as getOppositeOperator,
1974
1981
  g2 as getValueByType,
1975
1982
  g1 as iconGroup,
1976
1983
  C2 as iconMap,
1977
- q1 as isAnchorEqual,
1984
+ P1 as isAnchorEqual,
1978
1985
  h2 as isFloatsEqual,
1979
- x as isNullable,
1980
- X1 as isRangesEqual,
1986
+ _ as isNullable,
1987
+ H1 as isRangesEqual,
1981
1988
  R0 as moveByAnchor,
1982
- S1 as removeUndefinedAttr,
1989
+ R1 as removeUndefinedAttr,
1983
1990
  e1 as serialTimeToTimestamp,
1984
1991
  Z2 as setConditionalRuleMutationUndoFactory,
1985
1992
  Q0 as toYMD_1900,