@univerjs/core 0.3.0 → 0.4.0-alpha.1

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.
Files changed (30) hide show
  1. package/lib/cjs/index.js +8 -8
  2. package/lib/es/index.js +740 -305
  3. package/lib/types/common/di.d.ts +13 -15
  4. package/lib/types/docs/data-model/text-x/build-utils/custom-range.d.ts +4 -2
  5. package/lib/types/docs/data-model/text-x/build-utils/index.d.ts +1 -0
  6. package/lib/types/docs/data-model/text-x/build-utils/parse.d.ts +1 -0
  7. package/lib/types/docs/data-model/text-x/build-utils/text-x-utils.d.ts +4 -1
  8. package/lib/types/docs/data-model/text-x/transform-utils.d.ts +2 -1
  9. package/lib/types/docs/data-model/text-x/utils.d.ts +1 -1
  10. package/lib/types/index.d.ts +3 -2
  11. package/lib/types/services/__tests__/index.d.ts +3 -2
  12. package/lib/types/services/lifecycle/lifecycle.d.ts +15 -42
  13. package/lib/types/services/lifecycle/lifecycle.service.d.ts +0 -13
  14. package/lib/types/services/permission/permission.service.d.ts +1 -1
  15. package/lib/types/services/permission/type.d.ts +2 -2
  16. package/lib/types/services/plugin/plugin.d.ts +2 -2
  17. package/lib/types/services/plugin/plugin.service.d.ts +6 -6
  18. package/lib/types/services/resource-loader/type.d.ts +1 -1
  19. package/lib/types/services/resource-manager/type.d.ts +1 -1
  20. package/lib/types/shared/r-tree.d.ts +29 -0
  21. package/lib/types/shared/range.d.ts +11 -0
  22. package/lib/types/shared/rectangle.d.ts +5 -1
  23. package/lib/types/sheets/range.d.ts +2 -2
  24. package/lib/types/sheets/span-model.d.ts +8 -1
  25. package/lib/types/sheets/workbook.d.ts +2 -2
  26. package/lib/types/sheets/worksheet.d.ts +4 -4
  27. package/lib/types/types/enum/locale-type.d.ts +2 -1
  28. package/lib/types/univer.d.ts +4 -4
  29. package/lib/umd/index.js +6 -6
  30. package/package.json +9 -9
package/lib/es/index.js CHANGED
@@ -2,11 +2,10 @@ var __defProp = Object.defineProperty;
2
2
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: !0, configurable: !0, writable: !0, value }) : obj[key] = value;
3
3
  var __name = (target, value) => __defProp(target, "name", { value, configurable: !0 });
4
4
  var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key != "symbol" ? key + "" : key, value);
5
- import * as React from "react";
6
- import React__default, { useState, useEffect, useRef, useMemo, createContext, useCallback, useContext } from "react";
7
5
  import { BehaviorSubject, Subject, Observable, filter, merge as merge$1, timer, map, distinctUntilChanged, skip, of, combineLatest } from "rxjs";
8
6
  import { filter as filter$1, debounceTime, first, map as map$1 } from "rxjs/operators";
9
- import { Tools as Tools$1, normalizeTextRuns as normalizeTextRuns$1, generateRandomId as generateRandomId$1, DataStreamTreeTokenType as DataStreamTreeTokenType$1 } from "@univerjs/core";
7
+ import * as React from "react";
8
+ import React__default, { useState, useEffect, useRef, useMemo, createContext, useCallback, useContext } from "react";
10
9
  function _mergeNamespaces(n, m) {
11
10
  for (var i = 0; i < m.length; i++) {
12
11
  const e = m[i];
@@ -1483,8 +1482,8 @@ var IdleValue = (
1483
1482
  };
1484
1483
  return cb.apply(void 0, __spreadArray$2([accessor], args, !1));
1485
1484
  }, Injector2.prototype.has = function(id) {
1486
- var _a13;
1487
- return this.dependencyCollection.has(id) || ((_a13 = this.parent) === null || _a13 === void 0 ? void 0 : _a13.has(id)) || !1;
1485
+ var _a11;
1486
+ return this.dependencyCollection.has(id) || ((_a11 = this.parent) === null || _a11 === void 0 ? void 0 : _a11.has(id)) || !1;
1488
1487
  }, Injector2.prototype.get = function(id, quantityOrLookup, lookUp) {
1489
1488
  this._ensureInjectorNotDisposed();
1490
1489
  var newResult = this._get(id, quantityOrLookup, lookUp);
@@ -1555,7 +1554,7 @@ var IdleValue = (
1555
1554
  thing = this._resolveClassImpl(item);
1556
1555
  return id && shouldCache && this.resolvedDependencyCollection.add(id, thing), thing;
1557
1556
  }, Injector2.prototype._resolveClassImpl = function(item) {
1558
- for (var _a13, extraParams = [], _i = 1; _i < arguments.length; _i++)
1557
+ for (var _a11, extraParams = [], _i = 1; _i < arguments.length; _i++)
1559
1558
  extraParams[_i - 1] = arguments[_i];
1560
1559
  var ctor = item.useClass;
1561
1560
  this.markNewResolution(ctor);
@@ -1579,9 +1578,9 @@ var IdleValue = (
1579
1578
  delta > 0 ? args = __spreadArray$2(__spreadArray$2([], args, !0), new Array(delta).fill(void 0), !0) : args = args.slice(0, firstDependencyArgIndex);
1580
1579
  }
1581
1580
  var thing = new (ctor.bind.apply(ctor, __spreadArray$2(__spreadArray$2([void 0], args, !1), resolvedArgs, !1)))();
1582
- return (_a13 = item == null ? void 0 : item.onInstantiation) === null || _a13 === void 0 || _a13.call(item, thing), this.markResolutionCompleted(), thing;
1581
+ return (_a11 = item == null ? void 0 : item.onInstantiation) === null || _a11 === void 0 || _a11.call(item, thing), this.markResolutionCompleted(), thing;
1583
1582
  }, Injector2.prototype._resolveFactory = function(id, item, shouldCache) {
1584
- var _a13;
1583
+ var _a11;
1585
1584
  this.markNewResolution(id);
1586
1585
  for (var declaredDependencies = normalizeFactoryDeps(item.deps), resolvedArgs = [], _i = 0, declaredDependencies_2 = declaredDependencies; _i < declaredDependencies_2.length; _i++) {
1587
1586
  var dep = declaredDependencies_2[_i];
@@ -1593,7 +1592,7 @@ var IdleValue = (
1593
1592
  }
1594
1593
  }
1595
1594
  var thing = item.useFactory.apply(null, resolvedArgs);
1596
- return shouldCache && this.resolvedDependencyCollection.add(id, thing), this.markResolutionCompleted(), (_a13 = item == null ? void 0 : item.onInstantiation) === null || _a13 === void 0 || _a13.call(item, thing), thing;
1595
+ return shouldCache && this.resolvedDependencyCollection.add(id, thing), this.markResolutionCompleted(), (_a11 = item == null ? void 0 : item.onInstantiation) === null || _a11 === void 0 || _a11.call(item, thing), thing;
1597
1596
  }, Injector2.prototype._resolveAsync = function(id, item) {
1598
1597
  var _this = this, asyncLoader = {
1599
1598
  __symbol: AsyncHookSymbol,
@@ -1728,8 +1727,8 @@ function RediInjector(props) {
1728
1727
  var children = props.children, dependencies = props.dependencies, childInjectorRef = React.useRef(null);
1729
1728
  return React.useEffect(function() {
1730
1729
  return function() {
1731
- var _a13;
1732
- return (_a13 = childInjectorRef.current) === null || _a13 === void 0 ? void 0 : _a13.dispose();
1730
+ var _a11;
1731
+ return (_a11 = childInjectorRef.current) === null || _a11 === void 0 ? void 0 : _a11.dispose();
1733
1732
  };
1734
1733
  }, []), React.createElement(RediConsumer, null, function(context) {
1735
1734
  var childInjector;
@@ -1804,7 +1803,7 @@ var __spreadArray$1 = /* @__PURE__ */ __name(function(to, from, pack) {
1804
1803
  return to.concat(ar || Array.prototype.slice.call(from));
1805
1804
  }, "__spreadArray$1");
1806
1805
  function useDependencyValue(depValue$, defaultValue) {
1807
- var firstValue = depValue$ instanceof BehaviorSubject && typeof defaultValue > "u" ? depValue$.getValue() : defaultValue, _a13 = useState(firstValue), value = _a13[0], setValue = _a13[1];
1806
+ var firstValue = depValue$ instanceof BehaviorSubject && typeof defaultValue > "u" ? depValue$.getValue() : defaultValue, _a11 = useState(firstValue), value = _a11[0], setValue = _a11[1];
1808
1807
  return useEffect(function() {
1809
1808
  var subscription = depValue$.subscribe(function(val) {
1810
1809
  return setValue(val);
@@ -1824,9 +1823,9 @@ function useObservable(observable, defaultValue, shouldHaveSyncValue, deps) {
1824
1823
  throw new RediError("Expected deps to be provided when observable is a function!");
1825
1824
  var observableRef = useRef(null), initializedRef = useRef(!1), destObservable = useMemo(function() {
1826
1825
  return observable;
1827
- }, __spreadArray$1([], typeof deps < "u" ? deps : [observable], !0)), _a13 = useState(0);
1828
- _a13[0];
1829
- var setRenderCounter = _a13[1], valueRef = useRef(function() {
1826
+ }, __spreadArray$1([], typeof deps < "u" ? deps : [observable], !0)), _a11 = useState(0);
1827
+ _a11[0];
1828
+ var setRenderCounter = _a11[1], valueRef = useRef(function() {
1830
1829
  var innerDefaultValue;
1831
1830
  if (destObservable) {
1832
1831
  var sub = unwrap(destObservable).subscribe(function(value) {
@@ -1851,7 +1850,7 @@ function useObservable(observable, defaultValue, shouldHaveSyncValue, deps) {
1851
1850
  }
1852
1851
  __name(useObservable, "useObservable");
1853
1852
  function useUpdateBinder(update$) {
1854
- var _a13 = useState(0), dumpSet = _a13[1];
1853
+ var _a11 = useState(0), dumpSet = _a11[1];
1855
1854
  useEffect(function() {
1856
1855
  var subscription = update$.subscribe(function() {
1857
1856
  return dumpSet(function(prev) {
@@ -1884,6 +1883,16 @@ function useDependencyContextValue(depValue$) {
1884
1883
  return useContext(context);
1885
1884
  }
1886
1885
  __name(useDependencyContextValue, "useDependencyContextValue");
1886
+ function registerDependencies(injector, dependencies) {
1887
+ dependencies.forEach((d) => injector.add(d));
1888
+ }
1889
+ __name(registerDependencies, "registerDependencies");
1890
+ function touchDependencies(injector, dependencies) {
1891
+ dependencies.forEach(([d]) => {
1892
+ injector.has(d) && injector.get(d);
1893
+ });
1894
+ }
1895
+ __name(touchDependencies, "touchDependencies");
1887
1896
  function shallowEqual(objA, objB) {
1888
1897
  if (Object.is(objA, objB))
1889
1898
  return !0;
@@ -1956,8 +1965,8 @@ const composeInterceptors = /* @__PURE__ */ __name((interceptors) => function(in
1956
1965
  return interceptors.push(interceptor), this._interceptorsByName.set(
1957
1966
  key,
1958
1967
  interceptors.sort((a, b) => {
1959
- var _a13, _b2;
1960
- return ((_a13 = b.priority) != null ? _a13 : 0) - ((_b2 = a.priority) != null ? _b2 : 0);
1968
+ var _a11, _b2;
1969
+ return ((_a11 = b.priority) != null ? _a11 : 0) - ((_b2 = a.priority) != null ? _b2 : 0);
1961
1970
  })
1962
1971
  // from large to small
1963
1972
  ), () => remove(this._interceptorsByName.get(key), interceptor);
@@ -2163,7 +2172,7 @@ var Subscription = function() {
2163
2172
  this.initialTeardown = initialTeardown, this.closed = !1, this._parentage = null, this._finalizers = null;
2164
2173
  }
2165
2174
  return __name(Subscription2, "Subscription"), Subscription2.prototype.unsubscribe = function() {
2166
- var e_1, _a13, e_2, _b2, errors;
2175
+ var e_1, _a11, e_2, _b2, errors;
2167
2176
  if (!this.closed) {
2168
2177
  this.closed = !0;
2169
2178
  var _parentage = this._parentage;
@@ -2178,7 +2187,7 @@ var Subscription = function() {
2178
2187
  e_1 = { error: e_1_1 };
2179
2188
  } finally {
2180
2189
  try {
2181
- _parentage_1_1 && !_parentage_1_1.done && (_a13 = _parentage_1.return) && _a13.call(_parentage_1);
2190
+ _parentage_1_1 && !_parentage_1_1.done && (_a11 = _parentage_1.return) && _a11.call(_parentage_1);
2182
2191
  } finally {
2183
2192
  if (e_1) throw e_1.error;
2184
2193
  }
@@ -2218,7 +2227,7 @@ var Subscription = function() {
2218
2227
  throw new UnsubscriptionError(errors);
2219
2228
  }
2220
2229
  }, Subscription2.prototype.add = function(teardown) {
2221
- var _a13;
2230
+ var _a11;
2222
2231
  if (teardown && teardown !== this)
2223
2232
  if (this.closed)
2224
2233
  execFinalizer(teardown);
@@ -2228,7 +2237,7 @@ var Subscription = function() {
2228
2237
  return;
2229
2238
  teardown._addParent(this);
2230
2239
  }
2231
- (this._finalizers = (_a13 = this._finalizers) !== null && _a13 !== void 0 ? _a13 : []).push(teardown);
2240
+ (this._finalizers = (_a11 = this._finalizers) !== null && _a11 !== void 0 ? _a11 : []).push(teardown);
2232
2241
  }
2233
2242
  }, Subscription2.prototype._hasParent = function(parent) {
2234
2243
  var _parentage = this._parentage;
@@ -2351,8 +2360,8 @@ const IContextService = createIdentifier("univer.context-service"), _ContextServ
2351
2360
  super.dispose(), this._contextChanged$.complete();
2352
2361
  }
2353
2362
  getContextValue(key) {
2354
- var _a13;
2355
- return (_a13 = this._contextMap.get(key)) != null ? _a13 : !1;
2363
+ var _a11;
2364
+ return (_a11 = this._contextMap.get(key)) != null ? _a11 : !1;
2356
2365
  }
2357
2366
  setContextValue(key, value) {
2358
2367
  this._contextMap.set(key, value), this._contextChanged$.next({ [key]: value });
@@ -2394,11 +2403,11 @@ const ILogService = createIdentifier("univer.log"), _DesktopLogService = class _
2394
2403
  };
2395
2404
  __name(_DesktopLogService, "DesktopLogService");
2396
2405
  let DesktopLogService = _DesktopLogService;
2397
- var __defProp$8 = Object.defineProperty, __getOwnPropDesc$8 = Object.getOwnPropertyDescriptor, __decorateClass$8 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
2398
- for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$8(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
2406
+ var __defProp$7 = Object.defineProperty, __getOwnPropDesc$7 = Object.getOwnPropertyDescriptor, __decorateClass$7 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
2407
+ for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$7(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
2399
2408
  (decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
2400
- return kind && result && __defProp$8(target, key, result), result;
2401
- }, "__decorateClass$8"), __decorateParam$7 = /* @__PURE__ */ __name((index2, decorator) => (target, key) => decorator(target, key, index2), "__decorateParam$7"), CommandType = /* @__PURE__ */ ((CommandType2) => (CommandType2[CommandType2.COMMAND = 0] = "COMMAND", CommandType2[CommandType2.OPERATION = 1] = "OPERATION", CommandType2[CommandType2.MUTATION = 2] = "MUTATION", CommandType2))(CommandType || {});
2409
+ return kind && result && __defProp$7(target, key, result), result;
2410
+ }, "__decorateClass$7"), __decorateParam$7 = /* @__PURE__ */ __name((index2, decorator) => (target, key) => decorator(target, key, index2), "__decorateParam$7"), CommandType = /* @__PURE__ */ ((CommandType2) => (CommandType2[CommandType2.COMMAND = 0] = "COMMAND", CommandType2[CommandType2.OPERATION = 1] = "OPERATION", CommandType2[CommandType2.MUTATION = 2] = "MUTATION", CommandType2))(CommandType || {});
2402
2411
  const ICommandService = createIdentifier("anywhere.command-service"), _CommandRegistry = class _CommandRegistry {
2403
2412
  constructor() {
2404
2413
  __publicField(this, "_commands", /* @__PURE__ */ new Map());
@@ -2483,13 +2492,13 @@ let CommandService = (_a = class extends Disposable {
2483
2492
  }
2484
2493
  throw new Error(`[CommandService]: command "${id}" is not registered.`);
2485
2494
  } catch (error) {
2486
- if (error instanceof CustomCommandExecutionError)
2495
+ if (this._logService.error(error), error instanceof CustomCommandExecutionError)
2487
2496
  return !1;
2488
- throw this._logService.error(error), error;
2497
+ throw error;
2489
2498
  }
2490
2499
  }
2491
2500
  syncExecuteCommand(id, params, options) {
2492
- var _a13;
2501
+ var _a11;
2493
2502
  try {
2494
2503
  const item = this._commandRegistry.getCommand(id);
2495
2504
  if (item) {
@@ -2504,7 +2513,7 @@ let CommandService = (_a = class extends Disposable {
2504
2513
  (item2) => item2.type === 0
2505
2514
  /* COMMAND */
2506
2515
  );
2507
- triggerCommand && (commandInfo.params = (_a13 = commandInfo.params) != null ? _a13 : {}, commandInfo.params.trigger = triggerCommand.id);
2516
+ triggerCommand && (commandInfo.params = (_a11 = commandInfo.params) != null ? _a11 : {}, commandInfo.params.trigger = triggerCommand.id);
2508
2517
  }
2509
2518
  const stackItemDisposable = this._pushCommandExecutionStack(commandInfo);
2510
2519
  this._beforeCommandExecutionListeners.forEach((listener) => listener(commandInfo, options));
@@ -2541,8 +2550,8 @@ let CommandService = (_a = class extends Disposable {
2541
2550
  }
2542
2551
  const implementationDisposable = multiCommand.registerImplementation(command);
2543
2552
  return toDisposable(() => {
2544
- var _a13;
2545
- implementationDisposable.dispose(), multiCommand.hasImplementations() || (_a13 = this._multiCommandDisposables.get(command.id)) == null || _a13.dispose();
2553
+ var _a11;
2554
+ implementationDisposable.dispose(), multiCommand.hasImplementations() || (_a11 = this._multiCommandDisposables.get(command.id)) == null || _a11.dispose();
2546
2555
  });
2547
2556
  }
2548
2557
  async _execute(command, params, options) {
@@ -2574,7 +2583,7 @@ let CommandService = (_a = class extends Disposable {
2574
2583
  return result;
2575
2584
  }
2576
2585
  }, __name(_a, "CommandService"), _a);
2577
- CommandService = __decorateClass$8([
2586
+ CommandService = __decorateClass$7([
2578
2587
  __decorateParam$7(0, Inject(Injector)),
2579
2588
  __decorateParam$7(1, ILogService)
2580
2589
  ], CommandService);
@@ -2712,7 +2721,7 @@ function getReverseDirection(direction) {
2712
2721
  }
2713
2722
  }
2714
2723
  __name(getReverseDirection, "getReverseDirection");
2715
- var FormatType = /* @__PURE__ */ ((FormatType2) => (FormatType2[FormatType2.NUMBER_FORMAT_TYPE_UNSPECIFIED = 0] = "NUMBER_FORMAT_TYPE_UNSPECIFIED", FormatType2[FormatType2.TEXT = 1] = "TEXT", FormatType2[FormatType2.NUMBER = 2] = "NUMBER", FormatType2[FormatType2.PERCENT = 3] = "PERCENT", FormatType2[FormatType2.CURRENCY = 4] = "CURRENCY", FormatType2[FormatType2.DATE = 5] = "DATE", FormatType2[FormatType2.TIME = 6] = "TIME", FormatType2[FormatType2.DATE_TIME = 7] = "DATE_TIME", FormatType2[FormatType2.SCIENTIFIC = 8] = "SCIENTIFIC", FormatType2))(FormatType || {}), InterpolationPointType = /* @__PURE__ */ ((InterpolationPointType2) => (InterpolationPointType2[InterpolationPointType2.INTERPOLATION_POINT_TYPE_UNSPECIFIED = 0] = "INTERPOLATION_POINT_TYPE_UNSPECIFIED", InterpolationPointType2[InterpolationPointType2.MIN = 1] = "MIN", InterpolationPointType2[InterpolationPointType2.MAX = 2] = "MAX", InterpolationPointType2[InterpolationPointType2.NUMBER = 3] = "NUMBER", InterpolationPointType2[InterpolationPointType2.PERCENT = 4] = "PERCENT", InterpolationPointType2[InterpolationPointType2.PERCENTILE = 5] = "PERCENTILE", InterpolationPointType2))(InterpolationPointType || {}), LocaleType = /* @__PURE__ */ ((LocaleType2) => (LocaleType2.EN_US = "enUS", LocaleType2.ZH_CN = "zhCN", LocaleType2.RU_RU = "ruRU", LocaleType2.ZH_TW = "zhTW", LocaleType2.VI_VN = "viVN", LocaleType2))(LocaleType || {}), ProtectionType = /* @__PURE__ */ ((ProtectionType2) => (ProtectionType2[ProtectionType2.RANGE = 0] = "RANGE", ProtectionType2[ProtectionType2.SHEET = 1] = "SHEET", ProtectionType2))(ProtectionType || {}), BasicShapes = /* @__PURE__ */ ((BasicShapes2) => (BasicShapes2.Line = "line", BasicShapes2.LineInv = "lineInv", BasicShapes2.Triangle = "triangle", BasicShapes2.RtTriangle = "rtTriangle", BasicShapes2.Rect = "rect", BasicShapes2.Diamond = "diamond", BasicShapes2.Parallelogram = "parallelogram", BasicShapes2.Trapezoid = "trapezoid", BasicShapes2.NonIsocelesTrapezoid = "nonIsocelesTrapezoid", BasicShapes2.Pentagon = "pentagon", BasicShapes2.Hexagon = "hexagon", BasicShapes2.Heptagon = "heptagon", BasicShapes2.Octagon = "octagon", BasicShapes2.Decagon = "decagon", BasicShapes2.Dodecagon = "dodecagon", BasicShapes2.Star4 = "star4", BasicShapes2.Star5 = "star5", BasicShapes2.Star6 = "star6", BasicShapes2.Star7 = "star7", BasicShapes2.Star8 = "star8", BasicShapes2.Star10 = "star10", BasicShapes2.Star12 = "star12", BasicShapes2.Star16 = "star16", BasicShapes2.Star24 = "star24", BasicShapes2.Star32 = "star32", BasicShapes2.RoundRect = "roundRect", BasicShapes2.Round1Rect = "round1Rect", BasicShapes2.Round2SameRect = "round2SameRect", BasicShapes2.Round2DiagRect = "round2DiagRect", BasicShapes2.Ellipse = "ellipse", BasicShapes2))(BasicShapes || {}), ArrowsAndMarkersShapes = /* @__PURE__ */ ((ArrowsAndMarkersShapes2) => (ArrowsAndMarkersShapes2.RightArrow = "rightArrow", ArrowsAndMarkersShapes2.LeftArrow = "leftArrow", ArrowsAndMarkersShapes2.UpArrow = "upArrow", ArrowsAndMarkersShapes2.DownArrow = "downArrow", ArrowsAndMarkersShapes2.LeftRightArrow = "leftRightArrow", ArrowsAndMarkersShapes2.UpDownArrow = "upDownArrow", ArrowsAndMarkersShapes2.QuadArrow = "quadArrow", ArrowsAndMarkersShapes2.LeftRightUpArrow = "leftRightUpArrow", ArrowsAndMarkersShapes2.BentArrow = "bentArrow", ArrowsAndMarkersShapes2.UturnArrow = "uturnArrow", ArrowsAndMarkersShapes2.CircularArrow = "circularArrow", ArrowsAndMarkersShapes2.NotchedRightArrow = "notchedRightArrow", ArrowsAndMarkersShapes2.HomePlate = "homePlate", ArrowsAndMarkersShapes2.Chevron = "chevron", ArrowsAndMarkersShapes2.LeftCircularArrow = "leftCircularArrow", ArrowsAndMarkersShapes2.LeftRightCircularArrow = "leftRightCircularArrow", ArrowsAndMarkersShapes2))(ArrowsAndMarkersShapes || {}), OtherShapes = /* @__PURE__ */ ((OtherShapes2) => (OtherShapes2.Plaque = "plaque", OtherShapes2.Can = "can", OtherShapes2.Cube = "cube", OtherShapes2.Bevel = "bevel", OtherShapes2.Donut = "donut", OtherShapes2.NoSmoking = "noSmoking", OtherShapes2.BlockArc = "blockArc", OtherShapes2.FoldedCorner = "foldedCorner", OtherShapes2))(OtherShapes || {}), SpecialShapes = /* @__PURE__ */ ((SpecialShapes2) => (SpecialShapes2.SmileyFace = "smileyFace", SpecialShapes2.Heart = "heart", SpecialShapes2.LightningBolt = "lightningBolt", SpecialShapes2.Sun = "sun", SpecialShapes2.Moon = "moon", SpecialShapes2.Cloud = "cloud", SpecialShapes2.Arc = "arc", SpecialShapes2.Backpack = "backpack", SpecialShapes2.Frame = "frame", SpecialShapes2.HalfFrame = "halfFrame", SpecialShapes2.Corner = "corner", SpecialShapes2.Chord = "chord", SpecialShapes2.Pie = "pie", SpecialShapes2.Teardrop = "teardrop", SpecialShapes2.WedgeRectCallout = "wedgeRectCallout", SpecialShapes2.WedgeRRectCallout = "wedgeRRectCallout", SpecialShapes2.WedgeEllipseCallout = "wedgeEllipseCallout", SpecialShapes2.CloudCallout = "cloudCallout", SpecialShapes2.BorderCallout1 = "borderCallout1", SpecialShapes2.BorderCallout2 = "borderCallout2", SpecialShapes2.BorderCallout3 = "borderCallout3", SpecialShapes2.AccentCallout1 = "accentCallout1", SpecialShapes2.AccentCallout2 = "accentCallout2", SpecialShapes2.AccentCallout3 = "accentCallout3", SpecialShapes2.Callout1 = "callout1", SpecialShapes2.Callout2 = "callout2", SpecialShapes2.Callout3 = "callout3", SpecialShapes2.ActionButtonBackPrevious = "actionButtonBackPrevious", SpecialShapes2.ActionButtonEnd = "actionButtonEnd", SpecialShapes2.ActionButtonForwardNext = "actionButtonForwardNext", SpecialShapes2.ActionButtonHelp = "actionButtonHelp", SpecialShapes2.ActionButtonHome = "actionButtonHome", SpecialShapes2.ActionButtonInformation = "actionButtonInformation", SpecialShapes2.ActionButtonMovie = "actionButtonMovie", SpecialShapes2.ActionButtonReturn = "actionButtonReturn", SpecialShapes2.ActionButtonSound = "actionButtonSound", SpecialShapes2))(SpecialShapes || {}), RelativeDate = /* @__PURE__ */ ((RelativeDate2) => (RelativeDate2[RelativeDate2.RELATIVE_DATE_UNSPECIFIED = 0] = "RELATIVE_DATE_UNSPECIFIED", RelativeDate2[RelativeDate2.PAST_YEAR = 1] = "PAST_YEAR", RelativeDate2[RelativeDate2.PAST_MONTH = 2] = "PAST_MONTH", RelativeDate2[RelativeDate2.PAST_WEEK = 3] = "PAST_WEEK", RelativeDate2[RelativeDate2.YESTERDAY = 4] = "YESTERDAY", RelativeDate2[RelativeDate2.TODAY = 5] = "TODAY", RelativeDate2[RelativeDate2.TOMORROW = 6] = "TOMORROW", RelativeDate2))(RelativeDate || {}), SheetTypes = /* @__PURE__ */ ((SheetTypes2) => (SheetTypes2[SheetTypes2.GRID = 0] = "GRID", SheetTypes2[SheetTypes2.KANBAN = 1] = "KANBAN", SheetTypes2[SheetTypes2.GANTT = 2] = "GANTT", SheetTypes2))(SheetTypes || {}), TextDirection = /* @__PURE__ */ ((TextDirection2) => (TextDirection2[TextDirection2.UNSPECIFIED = 0] = "UNSPECIFIED", TextDirection2[TextDirection2.LEFT_TO_RIGHT = 1] = "LEFT_TO_RIGHT", TextDirection2[TextDirection2.RIGHT_TO_LEFT = 2] = "RIGHT_TO_LEFT", TextDirection2))(TextDirection || {}), TextDecoration = /* @__PURE__ */ ((TextDecoration2) => (TextDecoration2[TextDecoration2.DASH = 0] = "DASH", TextDecoration2[TextDecoration2.DASH_DOT_DOT_HEAVY = 1] = "DASH_DOT_DOT_HEAVY", TextDecoration2[TextDecoration2.DASH_DOT_HEAVY = 2] = "DASH_DOT_HEAVY", TextDecoration2[TextDecoration2.DASHED_HEAVY = 3] = "DASHED_HEAVY", TextDecoration2[TextDecoration2.DASH_LONG = 4] = "DASH_LONG", TextDecoration2[TextDecoration2.DASH_LONG_HEAVY = 5] = "DASH_LONG_HEAVY", TextDecoration2[TextDecoration2.DOT_DASH = 6] = "DOT_DASH", TextDecoration2[TextDecoration2.DOT_DOT_DASH = 7] = "DOT_DOT_DASH", TextDecoration2[TextDecoration2.DOTTED = 8] = "DOTTED", TextDecoration2[TextDecoration2.DOTTED_HEAVY = 9] = "DOTTED_HEAVY", TextDecoration2[TextDecoration2.DOUBLE = 10] = "DOUBLE", TextDecoration2[TextDecoration2.NONE = 11] = "NONE", TextDecoration2[TextDecoration2.SINGLE = 12] = "SINGLE", TextDecoration2[TextDecoration2.THICK = 13] = "THICK", TextDecoration2[TextDecoration2.WAVE = 14] = "WAVE", TextDecoration2[TextDecoration2.WAVY_DOUBLE = 15] = "WAVY_DOUBLE", TextDecoration2[TextDecoration2.WAVY_HEAVY = 16] = "WAVY_HEAVY", TextDecoration2[TextDecoration2.WORDS = 17] = "WORDS", TextDecoration2))(TextDecoration || {}), HorizontalAlign = /* @__PURE__ */ ((HorizontalAlign2) => (HorizontalAlign2[HorizontalAlign2.UNSPECIFIED = 0] = "UNSPECIFIED", HorizontalAlign2[HorizontalAlign2.LEFT = 1] = "LEFT", HorizontalAlign2[HorizontalAlign2.CENTER = 2] = "CENTER", HorizontalAlign2[HorizontalAlign2.RIGHT = 3] = "RIGHT", HorizontalAlign2[HorizontalAlign2.JUSTIFIED = 4] = "JUSTIFIED", HorizontalAlign2[HorizontalAlign2.BOTH = 5] = "BOTH", HorizontalAlign2[HorizontalAlign2.DISTRIBUTED = 6] = "DISTRIBUTED", HorizontalAlign2))(HorizontalAlign || {}), VerticalAlign = /* @__PURE__ */ ((VerticalAlign2) => (VerticalAlign2[VerticalAlign2.UNSPECIFIED = 0] = "UNSPECIFIED", VerticalAlign2[VerticalAlign2.TOP = 1] = "TOP", VerticalAlign2[VerticalAlign2.MIDDLE = 2] = "MIDDLE", VerticalAlign2[VerticalAlign2.BOTTOM = 3] = "BOTTOM", VerticalAlign2))(VerticalAlign || {}), WrapStrategy = /* @__PURE__ */ ((WrapStrategy2) => (WrapStrategy2[WrapStrategy2.UNSPECIFIED = 0] = "UNSPECIFIED", WrapStrategy2[WrapStrategy2.OVERFLOW = 1] = "OVERFLOW", WrapStrategy2[WrapStrategy2.CLIP = 2] = "CLIP", WrapStrategy2[WrapStrategy2.WRAP = 3] = "WRAP", WrapStrategy2))(WrapStrategy || {}), FontItalic = /* @__PURE__ */ ((FontItalic2) => (FontItalic2[FontItalic2.NORMAL = 0] = "NORMAL", FontItalic2[FontItalic2.ITALIC = 1] = "ITALIC", FontItalic2))(FontItalic || {}), FontWeight = /* @__PURE__ */ ((FontWeight2) => (FontWeight2[FontWeight2.NORMAL = 0] = "NORMAL", FontWeight2[FontWeight2.BOLD = 1] = "BOLD", FontWeight2))(FontWeight || {}), BaselineOffset = /* @__PURE__ */ ((BaselineOffset2) => (BaselineOffset2[BaselineOffset2.NORMAL = 1] = "NORMAL", BaselineOffset2[BaselineOffset2.SUBSCRIPT = 2] = "SUBSCRIPT", BaselineOffset2[BaselineOffset2.SUPERSCRIPT = 3] = "SUPERSCRIPT", BaselineOffset2))(BaselineOffset || {}), BooleanNumber = /* @__PURE__ */ ((BooleanNumber2) => (BooleanNumber2[BooleanNumber2.FALSE = 0] = "FALSE", BooleanNumber2[BooleanNumber2.TRUE = 1] = "TRUE", BooleanNumber2))(BooleanNumber || {}), CellValueType = /* @__PURE__ */ ((CellValueType2) => (CellValueType2[CellValueType2.STRING = 1] = "STRING", CellValueType2[CellValueType2.NUMBER = 2] = "NUMBER", CellValueType2[CellValueType2.BOOLEAN = 3] = "BOOLEAN", CellValueType2[CellValueType2.FORCE_STRING = 4] = "FORCE_STRING", CellValueType2))(CellValueType || {}), ThemeColorType = /* @__PURE__ */ ((ThemeColorType2) => (ThemeColorType2[ThemeColorType2.DARK1 = 0] = "DARK1", ThemeColorType2[ThemeColorType2.LIGHT1 = 1] = "LIGHT1", ThemeColorType2[ThemeColorType2.DARK2 = 2] = "DARK2", ThemeColorType2[ThemeColorType2.LIGHT2 = 3] = "LIGHT2", ThemeColorType2[ThemeColorType2.ACCENT1 = 4] = "ACCENT1", ThemeColorType2[ThemeColorType2.ACCENT2 = 5] = "ACCENT2", ThemeColorType2[ThemeColorType2.ACCENT3 = 6] = "ACCENT3", ThemeColorType2[ThemeColorType2.ACCENT4 = 7] = "ACCENT4", ThemeColorType2[ThemeColorType2.ACCENT5 = 8] = "ACCENT5", ThemeColorType2[ThemeColorType2.ACCENT6 = 9] = "ACCENT6", ThemeColorType2[ThemeColorType2.HYPERLINK = 10] = "HYPERLINK", ThemeColorType2[ThemeColorType2.FOLLOWED_HYPERLINK = 11] = "FOLLOWED_HYPERLINK", ThemeColorType2))(ThemeColorType || {}), ThemeColors = /* @__PURE__ */ ((ThemeColors2) => (ThemeColors2.OFFICE = "Office", ThemeColors2.OFFICE_2007_2010 = "Office 2007-2010", ThemeColors2.GRAYSCALE = "Grayscale", ThemeColors2.BLUE_WARM = "Blue Warm", ThemeColors2.BLUE = "Blue", ThemeColors2.BLUE_II = "Blue II", ThemeColors2.BLUE_GREEN = "Blue Green", ThemeColors2.GREEN = "Green", ThemeColors2.GREEN_YELLOW = "Green Yellow", ThemeColors2.YELLOW = "Yellow", ThemeColors2.YELLOW_ORANGE = "Yellow Orange", ThemeColors2.ORANGE = "Orange", ThemeColors2.ORANGE_RED = "Orange Red", ThemeColors2.RED_ORANGE = "Red Orange", ThemeColors2.RED = "Red", ThemeColors2.RED_VIOLET = "Red Violet", ThemeColors2.VIOLET = "Violet", ThemeColors2.VIOLET_II = "Violet II", ThemeColors2.MEDIAN = "Median", ThemeColors2.PAPER = "Paper", ThemeColors2.MARQUEE = "Marquee", ThemeColors2.SLIPSTREAM = "Slipstream", ThemeColors2.Aspect = "Aspect", ThemeColors2))(ThemeColors || {});
2724
+ var FormatType = /* @__PURE__ */ ((FormatType2) => (FormatType2[FormatType2.NUMBER_FORMAT_TYPE_UNSPECIFIED = 0] = "NUMBER_FORMAT_TYPE_UNSPECIFIED", FormatType2[FormatType2.TEXT = 1] = "TEXT", FormatType2[FormatType2.NUMBER = 2] = "NUMBER", FormatType2[FormatType2.PERCENT = 3] = "PERCENT", FormatType2[FormatType2.CURRENCY = 4] = "CURRENCY", FormatType2[FormatType2.DATE = 5] = "DATE", FormatType2[FormatType2.TIME = 6] = "TIME", FormatType2[FormatType2.DATE_TIME = 7] = "DATE_TIME", FormatType2[FormatType2.SCIENTIFIC = 8] = "SCIENTIFIC", FormatType2))(FormatType || {}), InterpolationPointType = /* @__PURE__ */ ((InterpolationPointType2) => (InterpolationPointType2[InterpolationPointType2.INTERPOLATION_POINT_TYPE_UNSPECIFIED = 0] = "INTERPOLATION_POINT_TYPE_UNSPECIFIED", InterpolationPointType2[InterpolationPointType2.MIN = 1] = "MIN", InterpolationPointType2[InterpolationPointType2.MAX = 2] = "MAX", InterpolationPointType2[InterpolationPointType2.NUMBER = 3] = "NUMBER", InterpolationPointType2[InterpolationPointType2.PERCENT = 4] = "PERCENT", InterpolationPointType2[InterpolationPointType2.PERCENTILE = 5] = "PERCENTILE", InterpolationPointType2))(InterpolationPointType || {}), LocaleType = /* @__PURE__ */ ((LocaleType2) => (LocaleType2.EN_US = "enUS", LocaleType2.ZH_CN = "zhCN", LocaleType2.RU_RU = "ruRU", LocaleType2.ZH_TW = "zhTW", LocaleType2.VI_VN = "viVN", LocaleType2.FA_IR = "faIR", LocaleType2))(LocaleType || {}), ProtectionType = /* @__PURE__ */ ((ProtectionType2) => (ProtectionType2[ProtectionType2.RANGE = 0] = "RANGE", ProtectionType2[ProtectionType2.SHEET = 1] = "SHEET", ProtectionType2))(ProtectionType || {}), BasicShapes = /* @__PURE__ */ ((BasicShapes2) => (BasicShapes2.Line = "line", BasicShapes2.LineInv = "lineInv", BasicShapes2.Triangle = "triangle", BasicShapes2.RtTriangle = "rtTriangle", BasicShapes2.Rect = "rect", BasicShapes2.Diamond = "diamond", BasicShapes2.Parallelogram = "parallelogram", BasicShapes2.Trapezoid = "trapezoid", BasicShapes2.NonIsocelesTrapezoid = "nonIsocelesTrapezoid", BasicShapes2.Pentagon = "pentagon", BasicShapes2.Hexagon = "hexagon", BasicShapes2.Heptagon = "heptagon", BasicShapes2.Octagon = "octagon", BasicShapes2.Decagon = "decagon", BasicShapes2.Dodecagon = "dodecagon", BasicShapes2.Star4 = "star4", BasicShapes2.Star5 = "star5", BasicShapes2.Star6 = "star6", BasicShapes2.Star7 = "star7", BasicShapes2.Star8 = "star8", BasicShapes2.Star10 = "star10", BasicShapes2.Star12 = "star12", BasicShapes2.Star16 = "star16", BasicShapes2.Star24 = "star24", BasicShapes2.Star32 = "star32", BasicShapes2.RoundRect = "roundRect", BasicShapes2.Round1Rect = "round1Rect", BasicShapes2.Round2SameRect = "round2SameRect", BasicShapes2.Round2DiagRect = "round2DiagRect", BasicShapes2.Ellipse = "ellipse", BasicShapes2))(BasicShapes || {}), ArrowsAndMarkersShapes = /* @__PURE__ */ ((ArrowsAndMarkersShapes2) => (ArrowsAndMarkersShapes2.RightArrow = "rightArrow", ArrowsAndMarkersShapes2.LeftArrow = "leftArrow", ArrowsAndMarkersShapes2.UpArrow = "upArrow", ArrowsAndMarkersShapes2.DownArrow = "downArrow", ArrowsAndMarkersShapes2.LeftRightArrow = "leftRightArrow", ArrowsAndMarkersShapes2.UpDownArrow = "upDownArrow", ArrowsAndMarkersShapes2.QuadArrow = "quadArrow", ArrowsAndMarkersShapes2.LeftRightUpArrow = "leftRightUpArrow", ArrowsAndMarkersShapes2.BentArrow = "bentArrow", ArrowsAndMarkersShapes2.UturnArrow = "uturnArrow", ArrowsAndMarkersShapes2.CircularArrow = "circularArrow", ArrowsAndMarkersShapes2.NotchedRightArrow = "notchedRightArrow", ArrowsAndMarkersShapes2.HomePlate = "homePlate", ArrowsAndMarkersShapes2.Chevron = "chevron", ArrowsAndMarkersShapes2.LeftCircularArrow = "leftCircularArrow", ArrowsAndMarkersShapes2.LeftRightCircularArrow = "leftRightCircularArrow", ArrowsAndMarkersShapes2))(ArrowsAndMarkersShapes || {}), OtherShapes = /* @__PURE__ */ ((OtherShapes2) => (OtherShapes2.Plaque = "plaque", OtherShapes2.Can = "can", OtherShapes2.Cube = "cube", OtherShapes2.Bevel = "bevel", OtherShapes2.Donut = "donut", OtherShapes2.NoSmoking = "noSmoking", OtherShapes2.BlockArc = "blockArc", OtherShapes2.FoldedCorner = "foldedCorner", OtherShapes2))(OtherShapes || {}), SpecialShapes = /* @__PURE__ */ ((SpecialShapes2) => (SpecialShapes2.SmileyFace = "smileyFace", SpecialShapes2.Heart = "heart", SpecialShapes2.LightningBolt = "lightningBolt", SpecialShapes2.Sun = "sun", SpecialShapes2.Moon = "moon", SpecialShapes2.Cloud = "cloud", SpecialShapes2.Arc = "arc", SpecialShapes2.Backpack = "backpack", SpecialShapes2.Frame = "frame", SpecialShapes2.HalfFrame = "halfFrame", SpecialShapes2.Corner = "corner", SpecialShapes2.Chord = "chord", SpecialShapes2.Pie = "pie", SpecialShapes2.Teardrop = "teardrop", SpecialShapes2.WedgeRectCallout = "wedgeRectCallout", SpecialShapes2.WedgeRRectCallout = "wedgeRRectCallout", SpecialShapes2.WedgeEllipseCallout = "wedgeEllipseCallout", SpecialShapes2.CloudCallout = "cloudCallout", SpecialShapes2.BorderCallout1 = "borderCallout1", SpecialShapes2.BorderCallout2 = "borderCallout2", SpecialShapes2.BorderCallout3 = "borderCallout3", SpecialShapes2.AccentCallout1 = "accentCallout1", SpecialShapes2.AccentCallout2 = "accentCallout2", SpecialShapes2.AccentCallout3 = "accentCallout3", SpecialShapes2.Callout1 = "callout1", SpecialShapes2.Callout2 = "callout2", SpecialShapes2.Callout3 = "callout3", SpecialShapes2.ActionButtonBackPrevious = "actionButtonBackPrevious", SpecialShapes2.ActionButtonEnd = "actionButtonEnd", SpecialShapes2.ActionButtonForwardNext = "actionButtonForwardNext", SpecialShapes2.ActionButtonHelp = "actionButtonHelp", SpecialShapes2.ActionButtonHome = "actionButtonHome", SpecialShapes2.ActionButtonInformation = "actionButtonInformation", SpecialShapes2.ActionButtonMovie = "actionButtonMovie", SpecialShapes2.ActionButtonReturn = "actionButtonReturn", SpecialShapes2.ActionButtonSound = "actionButtonSound", SpecialShapes2))(SpecialShapes || {}), RelativeDate = /* @__PURE__ */ ((RelativeDate2) => (RelativeDate2[RelativeDate2.RELATIVE_DATE_UNSPECIFIED = 0] = "RELATIVE_DATE_UNSPECIFIED", RelativeDate2[RelativeDate2.PAST_YEAR = 1] = "PAST_YEAR", RelativeDate2[RelativeDate2.PAST_MONTH = 2] = "PAST_MONTH", RelativeDate2[RelativeDate2.PAST_WEEK = 3] = "PAST_WEEK", RelativeDate2[RelativeDate2.YESTERDAY = 4] = "YESTERDAY", RelativeDate2[RelativeDate2.TODAY = 5] = "TODAY", RelativeDate2[RelativeDate2.TOMORROW = 6] = "TOMORROW", RelativeDate2))(RelativeDate || {}), SheetTypes = /* @__PURE__ */ ((SheetTypes2) => (SheetTypes2[SheetTypes2.GRID = 0] = "GRID", SheetTypes2[SheetTypes2.KANBAN = 1] = "KANBAN", SheetTypes2[SheetTypes2.GANTT = 2] = "GANTT", SheetTypes2))(SheetTypes || {}), TextDirection = /* @__PURE__ */ ((TextDirection2) => (TextDirection2[TextDirection2.UNSPECIFIED = 0] = "UNSPECIFIED", TextDirection2[TextDirection2.LEFT_TO_RIGHT = 1] = "LEFT_TO_RIGHT", TextDirection2[TextDirection2.RIGHT_TO_LEFT = 2] = "RIGHT_TO_LEFT", TextDirection2))(TextDirection || {}), TextDecoration = /* @__PURE__ */ ((TextDecoration2) => (TextDecoration2[TextDecoration2.DASH = 0] = "DASH", TextDecoration2[TextDecoration2.DASH_DOT_DOT_HEAVY = 1] = "DASH_DOT_DOT_HEAVY", TextDecoration2[TextDecoration2.DASH_DOT_HEAVY = 2] = "DASH_DOT_HEAVY", TextDecoration2[TextDecoration2.DASHED_HEAVY = 3] = "DASHED_HEAVY", TextDecoration2[TextDecoration2.DASH_LONG = 4] = "DASH_LONG", TextDecoration2[TextDecoration2.DASH_LONG_HEAVY = 5] = "DASH_LONG_HEAVY", TextDecoration2[TextDecoration2.DOT_DASH = 6] = "DOT_DASH", TextDecoration2[TextDecoration2.DOT_DOT_DASH = 7] = "DOT_DOT_DASH", TextDecoration2[TextDecoration2.DOTTED = 8] = "DOTTED", TextDecoration2[TextDecoration2.DOTTED_HEAVY = 9] = "DOTTED_HEAVY", TextDecoration2[TextDecoration2.DOUBLE = 10] = "DOUBLE", TextDecoration2[TextDecoration2.NONE = 11] = "NONE", TextDecoration2[TextDecoration2.SINGLE = 12] = "SINGLE", TextDecoration2[TextDecoration2.THICK = 13] = "THICK", TextDecoration2[TextDecoration2.WAVE = 14] = "WAVE", TextDecoration2[TextDecoration2.WAVY_DOUBLE = 15] = "WAVY_DOUBLE", TextDecoration2[TextDecoration2.WAVY_HEAVY = 16] = "WAVY_HEAVY", TextDecoration2[TextDecoration2.WORDS = 17] = "WORDS", TextDecoration2))(TextDecoration || {}), HorizontalAlign = /* @__PURE__ */ ((HorizontalAlign2) => (HorizontalAlign2[HorizontalAlign2.UNSPECIFIED = 0] = "UNSPECIFIED", HorizontalAlign2[HorizontalAlign2.LEFT = 1] = "LEFT", HorizontalAlign2[HorizontalAlign2.CENTER = 2] = "CENTER", HorizontalAlign2[HorizontalAlign2.RIGHT = 3] = "RIGHT", HorizontalAlign2[HorizontalAlign2.JUSTIFIED = 4] = "JUSTIFIED", HorizontalAlign2[HorizontalAlign2.BOTH = 5] = "BOTH", HorizontalAlign2[HorizontalAlign2.DISTRIBUTED = 6] = "DISTRIBUTED", HorizontalAlign2))(HorizontalAlign || {}), VerticalAlign = /* @__PURE__ */ ((VerticalAlign2) => (VerticalAlign2[VerticalAlign2.UNSPECIFIED = 0] = "UNSPECIFIED", VerticalAlign2[VerticalAlign2.TOP = 1] = "TOP", VerticalAlign2[VerticalAlign2.MIDDLE = 2] = "MIDDLE", VerticalAlign2[VerticalAlign2.BOTTOM = 3] = "BOTTOM", VerticalAlign2))(VerticalAlign || {}), WrapStrategy = /* @__PURE__ */ ((WrapStrategy2) => (WrapStrategy2[WrapStrategy2.UNSPECIFIED = 0] = "UNSPECIFIED", WrapStrategy2[WrapStrategy2.OVERFLOW = 1] = "OVERFLOW", WrapStrategy2[WrapStrategy2.CLIP = 2] = "CLIP", WrapStrategy2[WrapStrategy2.WRAP = 3] = "WRAP", WrapStrategy2))(WrapStrategy || {}), FontItalic = /* @__PURE__ */ ((FontItalic2) => (FontItalic2[FontItalic2.NORMAL = 0] = "NORMAL", FontItalic2[FontItalic2.ITALIC = 1] = "ITALIC", FontItalic2))(FontItalic || {}), FontWeight = /* @__PURE__ */ ((FontWeight2) => (FontWeight2[FontWeight2.NORMAL = 0] = "NORMAL", FontWeight2[FontWeight2.BOLD = 1] = "BOLD", FontWeight2))(FontWeight || {}), BaselineOffset = /* @__PURE__ */ ((BaselineOffset2) => (BaselineOffset2[BaselineOffset2.NORMAL = 1] = "NORMAL", BaselineOffset2[BaselineOffset2.SUBSCRIPT = 2] = "SUBSCRIPT", BaselineOffset2[BaselineOffset2.SUPERSCRIPT = 3] = "SUPERSCRIPT", BaselineOffset2))(BaselineOffset || {}), BooleanNumber = /* @__PURE__ */ ((BooleanNumber2) => (BooleanNumber2[BooleanNumber2.FALSE = 0] = "FALSE", BooleanNumber2[BooleanNumber2.TRUE = 1] = "TRUE", BooleanNumber2))(BooleanNumber || {}), CellValueType = /* @__PURE__ */ ((CellValueType2) => (CellValueType2[CellValueType2.STRING = 1] = "STRING", CellValueType2[CellValueType2.NUMBER = 2] = "NUMBER", CellValueType2[CellValueType2.BOOLEAN = 3] = "BOOLEAN", CellValueType2[CellValueType2.FORCE_STRING = 4] = "FORCE_STRING", CellValueType2))(CellValueType || {}), ThemeColorType = /* @__PURE__ */ ((ThemeColorType2) => (ThemeColorType2[ThemeColorType2.DARK1 = 0] = "DARK1", ThemeColorType2[ThemeColorType2.LIGHT1 = 1] = "LIGHT1", ThemeColorType2[ThemeColorType2.DARK2 = 2] = "DARK2", ThemeColorType2[ThemeColorType2.LIGHT2 = 3] = "LIGHT2", ThemeColorType2[ThemeColorType2.ACCENT1 = 4] = "ACCENT1", ThemeColorType2[ThemeColorType2.ACCENT2 = 5] = "ACCENT2", ThemeColorType2[ThemeColorType2.ACCENT3 = 6] = "ACCENT3", ThemeColorType2[ThemeColorType2.ACCENT4 = 7] = "ACCENT4", ThemeColorType2[ThemeColorType2.ACCENT5 = 8] = "ACCENT5", ThemeColorType2[ThemeColorType2.ACCENT6 = 9] = "ACCENT6", ThemeColorType2[ThemeColorType2.HYPERLINK = 10] = "HYPERLINK", ThemeColorType2[ThemeColorType2.FOLLOWED_HYPERLINK = 11] = "FOLLOWED_HYPERLINK", ThemeColorType2))(ThemeColorType || {}), ThemeColors = /* @__PURE__ */ ((ThemeColors2) => (ThemeColors2.OFFICE = "Office", ThemeColors2.OFFICE_2007_2010 = "Office 2007-2010", ThemeColors2.GRAYSCALE = "Grayscale", ThemeColors2.BLUE_WARM = "Blue Warm", ThemeColors2.BLUE = "Blue", ThemeColors2.BLUE_II = "Blue II", ThemeColors2.BLUE_GREEN = "Blue Green", ThemeColors2.GREEN = "Green", ThemeColors2.GREEN_YELLOW = "Green Yellow", ThemeColors2.YELLOW = "Yellow", ThemeColors2.YELLOW_ORANGE = "Yellow Orange", ThemeColors2.ORANGE = "Orange", ThemeColors2.ORANGE_RED = "Orange Red", ThemeColors2.RED_ORANGE = "Red Orange", ThemeColors2.RED = "Red", ThemeColors2.RED_VIOLET = "Red Violet", ThemeColors2.VIOLET = "Violet", ThemeColors2.VIOLET_II = "Violet II", ThemeColors2.MEDIAN = "Median", ThemeColors2.PAPER = "Paper", ThemeColors2.MARQUEE = "Marquee", ThemeColors2.SLIPSTREAM = "Slipstream", ThemeColors2.Aspect = "Aspect", ThemeColors2))(ThemeColors || {});
2716
2725
  const urlAlphabet = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";
2717
2726
  let random = /* @__PURE__ */ __name((bytes) => crypto.getRandomValues(new Uint8Array(bytes)), "random"), customRandom = /* @__PURE__ */ __name((alphabet, defaultSize, getRandom) => {
2718
2727
  let mask = (2 << Math.log(alphabet.length - 1) / Math.LN2) - 1, step = -~(1.6 * mask * defaultSize / alphabet.length);
@@ -3122,9 +3131,9 @@ const rmsPrefix = /^-ms-/, rDashAlpha = /-([a-z])/g, alphabets = [
3122
3131
  sources.forEach((item) => item && deepItem(item));
3123
3132
  function deepArray(array, to) {
3124
3133
  array.forEach((value, key) => {
3125
- var _a13, _b2;
3134
+ var _a11, _b2;
3126
3135
  if (_Tools.isArray(value)) {
3127
- const origin = (_a13 = to[key]) != null ? _a13 : [];
3136
+ const origin = (_a11 = to[key]) != null ? _a11 : [];
3128
3137
  to[key] = origin, deepArray(value, origin);
3129
3138
  return;
3130
3139
  }
@@ -3139,10 +3148,10 @@ const rmsPrefix = /^-ms-/, rDashAlpha = /-([a-z])/g, alphabets = [
3139
3148
  __name(deepArray, "deepArray");
3140
3149
  function deepObject(object, to) {
3141
3150
  Object.keys(object).forEach((key) => {
3142
- var _a13, _b2;
3151
+ var _a11, _b2;
3143
3152
  const value = object[key];
3144
3153
  if (_Tools.isObject(value)) {
3145
- const origin = (_a13 = to[key]) != null ? _a13 : {};
3154
+ const origin = (_a11 = to[key]) != null ? _a11 : {};
3146
3155
  to[key] = origin, deepObject(value, origin);
3147
3156
  return;
3148
3157
  }
@@ -3157,10 +3166,10 @@ const rmsPrefix = /^-ms-/, rDashAlpha = /-([a-z])/g, alphabets = [
3157
3166
  __name(deepObject, "deepObject");
3158
3167
  function deepItem(item) {
3159
3168
  Object.keys(item).forEach((key) => {
3160
- var _a13, _b2;
3169
+ var _a11, _b2;
3161
3170
  const value = item[key];
3162
3171
  if (_Tools.isArray(value)) {
3163
- const origin = (_a13 = target[key]) != null ? _a13 : [];
3172
+ const origin = (_a11 = target[key]) != null ? _a11 : [];
3164
3173
  target[key] = origin, deepArray(value, origin);
3165
3174
  return;
3166
3175
  }
@@ -3184,7 +3193,7 @@ const rmsPrefix = /^-ms-/, rDashAlpha = /-([a-z])/g, alphabets = [
3184
3193
  }
3185
3194
  __name(diffValue, "diffValue");
3186
3195
  function diffArrays(oneArray, towArray) {
3187
- if (one.length !== tow.length)
3196
+ if (oneArray.length !== towArray.length)
3188
3197
  return !1;
3189
3198
  for (let i = 0, len = oneArray.length; i < len; i++) {
3190
3199
  const oneValue = oneArray[i], towValue = towArray[i];
@@ -3480,8 +3489,8 @@ function getBodySliceHtml(body, startIndex, endIndex) {
3480
3489
  }
3481
3490
  __name(getBodySliceHtml, "getBodySliceHtml");
3482
3491
  function convertBodyToHtml(body, withParagraphInfo = !0) {
3483
- var _a13;
3484
- if (withParagraphInfo && ((_a13 = body.paragraphs) != null && _a13.length)) {
3492
+ var _a11;
3493
+ if (withParagraphInfo && ((_a11 = body.paragraphs) != null && _a11.length)) {
3485
3494
  const { dataStream, paragraphs = [] } = body;
3486
3495
  let result = "", cursorIndex = -1;
3487
3496
  for (const paragraph of paragraphs) {
@@ -3932,9 +3941,9 @@ const RGB_PAREN = "rgb(", RGBA_PAREN = "rgba(", COLORS = {
3932
3941
  this._rgbColor = rgbColorObject, this._isValid = !0;
3933
3942
  }
3934
3943
  static mix(color1, color2, amount) {
3935
- var _a13, _b2;
3944
+ var _a11, _b2;
3936
3945
  amount = Math.min(1, Math.max(0, amount));
3937
- const rgb1 = new _ColorKit(color1).toRgb(), rgb2 = new _ColorKit(color2).toRgb(), alpha1 = (_a13 = rgb1.a) != null ? _a13 : 1, alpha2 = (_b2 = rgb2.a) != null ? _b2 : 1, rgba = {
3946
+ const rgb1 = new _ColorKit(color1).toRgb(), rgb2 = new _ColorKit(color2).toRgb(), alpha1 = (_a11 = rgb1.a) != null ? _a11 : 1, alpha2 = (_b2 = rgb2.a) != null ? _b2 : 1, rgba = {
3938
3947
  r: (rgb2.r - rgb1.r) * amount + rgb1.r,
3939
3948
  g: (rgb2.g - rgb1.g) * amount + rgb1.g,
3940
3949
  b: (rgb2.b - rgb1.b) * amount + rgb1.b,
@@ -3994,8 +4003,8 @@ const RGB_PAREN = "rgb(", RGBA_PAREN = "rgba(", COLORS = {
3994
4003
  return (r * 299 + g * 587 + b * 114) / 1e3;
3995
4004
  }
3996
4005
  getAlpha() {
3997
- var _a13;
3998
- return (_a13 = this._color.a) != null ? _a13 : 1;
4006
+ var _a11;
4007
+ return (_a11 = this._color.a) != null ? _a11 : 1;
3999
4008
  }
4000
4009
  isDark() {
4001
4010
  return this.getBrightness() < 128;
@@ -4333,8 +4342,8 @@ function makeCellRangeToRangeData(cellInfo) {
4333
4342
  }
4334
4343
  __name(makeCellRangeToRangeData, "makeCellRangeToRangeData");
4335
4344
  function isEmptyCell(cell) {
4336
- var _a13;
4337
- return !cell || (((_a13 = cell == null ? void 0 : cell.v) == null ? void 0 : _a13.toString()) || "").length === 0 && !cell.p;
4345
+ var _a11;
4346
+ return !cell || (((_a11 = cell == null ? void 0 : cell.v) == null ? void 0 : _a11.toString()) || "").length === 0 && !cell.p;
4338
4347
  }
4339
4348
  __name(isEmptyCell, "isEmptyCell");
4340
4349
  function isCellCoverable(cell) {
@@ -4360,7 +4369,7 @@ function isFormulaId(value) {
4360
4369
  }
4361
4370
  __name(isFormulaId, "isFormulaId");
4362
4371
  function handleStyleToString(style, isCell = !1) {
4363
- var _a13;
4372
+ var _a11;
4364
4373
  let str = "";
4365
4374
  const styleMap = /* @__PURE__ */ new Map([
4366
4375
  [
@@ -4393,22 +4402,22 @@ function handleStyleToString(style, isCell = !1) {
4393
4402
  [
4394
4403
  "ul",
4395
4404
  () => {
4396
- var _a14;
4397
- (_a14 = style.ul) != null && _a14.s && (str.indexOf("text-decoration-line") > -1 ? str = str.replace(/(text-decoration-line:\s*[^;]+)(?=;)/g, (_, p1) => `${p1} underline`) : str += "text-decoration: underline; ", style.ul.cl && str.indexOf("text-decoration-color") === -1 && (str += `text-decoration-color: ${getColorStyle(style.ul.cl)}; `), style.ul.t && str.indexOf("text-decoration-style") === -1 && (str += `text-decoration-style: ${style.ul.t} `));
4405
+ var _a12;
4406
+ (_a12 = style.ul) != null && _a12.s && (str.indexOf("text-decoration-line") > -1 ? str = str.replace(/(text-decoration-line:\s*[^;]+)(?=;)/g, (_, p1) => `${p1} underline`) : str += "text-decoration: underline; ", style.ul.cl && str.indexOf("text-decoration-color") === -1 && (str += `text-decoration-color: ${getColorStyle(style.ul.cl)}; `), style.ul.t && str.indexOf("text-decoration-style") === -1 && (str += `text-decoration-style: ${style.ul.t} `));
4398
4407
  }
4399
4408
  ],
4400
4409
  [
4401
4410
  "st",
4402
4411
  () => {
4403
- var _a14;
4404
- (_a14 = style.st) != null && _a14.s && (str.indexOf("text-decoration-line") > -1 ? str = str.replace(/(text-decoration-line:\s*[^;]+)(?=;)/g, (_, p1) => `${p1} line-through`) : str += "text-decoration-line: line-through; ", style.st.cl && str.indexOf("text-decoration-color") === -1 && (str += `text-decoration-color: ${getColorStyle(style.st.cl)}; `), style.st.t && str.indexOf("text-decoration-style") === -1 && (str += `text-decoration-style: ${style.st.t} `));
4412
+ var _a12;
4413
+ (_a12 = style.st) != null && _a12.s && (str.indexOf("text-decoration-line") > -1 ? str = str.replace(/(text-decoration-line:\s*[^;]+)(?=;)/g, (_, p1) => `${p1} line-through`) : str += "text-decoration-line: line-through; ", style.st.cl && str.indexOf("text-decoration-color") === -1 && (str += `text-decoration-color: ${getColorStyle(style.st.cl)}; `), style.st.t && str.indexOf("text-decoration-style") === -1 && (str += `text-decoration-style: ${style.st.t} `));
4405
4414
  }
4406
4415
  ],
4407
4416
  [
4408
4417
  "ol",
4409
4418
  () => {
4410
- var _a14;
4411
- (_a14 = style.ol) != null && _a14.s && (str.indexOf("text-decoration-line") > -1 ? str = str.replace(/(text-decoration-line:\s*[^;]+)(?=;)/g, (_, p1) => `${p1} overline`) : str += "text-decoration-line: overline; ", style.ol.cl && str.indexOf("text-decoration-color") === -1 && (str += `text-decoration-color: ${getColorStyle(style.ol.cl)}; `), style.ol.t && str.indexOf("text-decoration-style") === -1 && (str += `text-decoration-style: ${style.ol.t} `));
4419
+ var _a12;
4420
+ (_a12 = style.ol) != null && _a12.s && (str.indexOf("text-decoration-line") > -1 ? str = str.replace(/(text-decoration-line:\s*[^;]+)(?=;)/g, (_, p1) => `${p1} overline`) : str += "text-decoration-line: overline; ", style.ol.cl && str.indexOf("text-decoration-color") === -1 && (str += `text-decoration-color: ${getColorStyle(style.ol.cl)}; `), style.ol.t && str.indexOf("text-decoration-style") === -1 && (str += `text-decoration-style: ${style.ol.t} `));
4412
4421
  }
4413
4422
  ],
4414
4423
  [
@@ -4420,8 +4429,8 @@ function handleStyleToString(style, isCell = !1) {
4420
4429
  [
4421
4430
  "bd",
4422
4431
  () => {
4423
- var _a14, _b2, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
4424
- (_a14 = style.bd) != null && _a14.b && (str += `border-bottom: ${getBorderStyle((_b2 = style.bd) == null ? void 0 : _b2.b.s)} ${(_c = getColorStyle(style.bd.b.cl)) != null ? _c : ""}; `), (_d = style.bd) != null && _d.t && (str += `border-top: ${getBorderStyle((_e = style.bd) == null ? void 0 : _e.t.s)} ${(_f = getColorStyle(style.bd.t.cl)) != null ? _f : ""}; `), (_g = style.bd) != null && _g.r && (str += `border-right: ${getBorderStyle((_h = style.bd) == null ? void 0 : _h.r.s)} ${(_i = getColorStyle(style.bd.r.cl)) != null ? _i : ""}; `), (_j = style.bd) != null && _j.l && (str += `border-left: ${getBorderStyle((_k = style.bd) == null ? void 0 : _k.l.s)} ${(_l = getColorStyle(style.bd.l.cl)) != null ? _l : ""}; `);
4432
+ var _a12, _b2, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
4433
+ (_a12 = style.bd) != null && _a12.b && (str += `border-bottom: ${getBorderStyle((_b2 = style.bd) == null ? void 0 : _b2.b.s)} ${(_c = getColorStyle(style.bd.b.cl)) != null ? _c : ""}; `), (_d = style.bd) != null && _d.t && (str += `border-top: ${getBorderStyle((_e = style.bd) == null ? void 0 : _e.t.s)} ${(_f = getColorStyle(style.bd.t.cl)) != null ? _f : ""}; `), (_g = style.bd) != null && _g.r && (str += `border-right: ${getBorderStyle((_h = style.bd) == null ? void 0 : _h.r.s)} ${(_i = getColorStyle(style.bd.r.cl)) != null ? _i : ""}; `), (_j = style.bd) != null && _j.l && (str += `border-left: ${getBorderStyle((_k = style.bd) == null ? void 0 : _k.l.s)} ${(_l = getColorStyle(style.bd.l.cl)) != null ? _l : ""}; `);
4425
4434
  }
4426
4435
  ],
4427
4436
  [
@@ -4445,8 +4454,8 @@ function handleStyleToString(style, isCell = !1) {
4445
4454
  [
4446
4455
  "tr",
4447
4456
  () => {
4448
- var _a14, _b2, _c;
4449
- style.tr && (str += `--data-rotate: (${(_a14 = style.tr) == null ? void 0 : _a14.a}deg${(_b2 = style.tr) != null && _b2.v ? ` ,${(_c = style.tr) == null ? void 0 : _c.v}` : ""});`);
4457
+ var _a12, _b2, _c;
4458
+ style.tr && (str += `--data-rotate: (${(_a12 = style.tr) == null ? void 0 : _a12.a}deg${(_b2 = style.tr) != null && _b2.v ? ` ,${(_c = style.tr) == null ? void 0 : _c.v}` : ""});`);
4450
4459
  }
4451
4460
  ],
4452
4461
  [
@@ -4470,14 +4479,14 @@ function handleStyleToString(style, isCell = !1) {
4470
4479
  [
4471
4480
  "pd",
4472
4481
  () => {
4473
- var _a14, _b2, _c, _d, _e, _f, _g, _h;
4474
- const b = `${(_a14 = style.pd) == null ? void 0 : _a14.b}pt`, t = `${(_b2 = style.pd) == null ? void 0 : _b2.t}pt`, l = `${(_c = style.pd) == null ? void 0 : _c.l}pt`, r = `${(_d = style.pd) == null ? void 0 : _d.r}pt`;
4482
+ var _a12, _b2, _c, _d, _e, _f, _g, _h;
4483
+ const b = `${(_a12 = style.pd) == null ? void 0 : _a12.b}pt`, t = `${(_b2 = style.pd) == null ? void 0 : _b2.t}pt`, l = `${(_c = style.pd) == null ? void 0 : _c.l}pt`, r = `${(_d = style.pd) == null ? void 0 : _d.r}pt`;
4475
4484
  (_e = style.pd) != null && _e.b && (str += `padding-bottom: ${b}; `), (_f = style.pd) != null && _f.t && (str += `padding-top: ${t}; `), (_g = style.pd) != null && _g.l && (str += `padding-left: ${l}; `), (_h = style.pd) != null && _h.r && (str += `padding-right: ${r}; `);
4476
4485
  }
4477
4486
  ]
4478
4487
  ]), cellSkip = ["bd", "tr", "tb"];
4479
4488
  for (const k in style)
4480
- isCell && cellSkip.includes(k) || (_a13 = styleMap.get(k)) == null || _a13();
4489
+ isCell && cellSkip.includes(k) || (_a11 = styleMap.get(k)) == null || _a11();
4481
4490
  return str;
4482
4491
  }
4483
4492
  __name(handleStyleToString, "handleStyleToString");
@@ -4575,8 +4584,8 @@ function checkParagraphHasIndent(paragraph) {
4575
4584
  }
4576
4585
  __name(checkParagraphHasIndent, "checkParagraphHasIndent");
4577
4586
  function checkParagraphHasIndentByStyle(paragraphStyle) {
4578
- var _a13;
4579
- return !(paragraphStyle == null || (paragraphStyle.indentStart == null || paragraphStyle.indentStart.v === 0) && paragraphStyle.hanging == null || ((_a13 = paragraphStyle.hanging) == null ? void 0 : _a13.v) === 0);
4587
+ var _a11;
4588
+ return !(paragraphStyle == null || (paragraphStyle.indentStart == null || paragraphStyle.indentStart.v === 0) && paragraphStyle.hanging == null || ((_a11 = paragraphStyle.hanging) == null ? void 0 : _a11.v) === 0);
4580
4589
  }
4581
4590
  __name(checkParagraphHasIndentByStyle, "checkParagraphHasIndentByStyle");
4582
4591
  function insertTextToContent(content, start, text) {
@@ -5715,8 +5724,8 @@ const _ObjectMatrix = class _ObjectMatrix {
5715
5724
  return !1;
5716
5725
  }
5717
5726
  getValue(row, column) {
5718
- var _a13, _b2;
5719
- return (_b2 = (_a13 = this._matrix) == null ? void 0 : _a13[row]) == null ? void 0 : _b2[column];
5727
+ var _a11, _b2;
5728
+ return (_b2 = (_a11 = this._matrix) == null ? void 0 : _a11[row]) == null ? void 0 : _b2[column];
5720
5729
  }
5721
5730
  setValue(row, column, value) {
5722
5731
  const objectArray = this.getRowOrCreate(row);
@@ -5728,12 +5737,12 @@ const _ObjectMatrix = class _ObjectMatrix {
5728
5737
  * @deprecated use `realDelete` or `splice`
5729
5738
  */
5730
5739
  deleteValue(row, column) {
5731
- var _a13, _b2;
5732
- (_b2 = (_a13 = this._matrix) == null ? void 0 : _a13[row]) == null || delete _b2[column];
5740
+ var _a11, _b2;
5741
+ (_b2 = (_a11 = this._matrix) == null ? void 0 : _a11[row]) == null || delete _b2[column];
5733
5742
  }
5734
5743
  realDeleteValue(row, column) {
5735
- var _a13, _b2, _c;
5736
- if ((_b2 = (_a13 = this._matrix) == null ? void 0 : _a13[row]) == null || delete _b2[column], this.getRow(row)) {
5744
+ var _a11, _b2, _c;
5745
+ if ((_b2 = (_a11 = this._matrix) == null ? void 0 : _a11[row]) == null || delete _b2[column], this.getRow(row)) {
5737
5746
  const objectArray = this.getRow(row);
5738
5747
  if (objectArray == null)
5739
5748
  return;
@@ -6203,9 +6212,9 @@ const _Range = class _Range {
6203
6212
  const styles = this._deps.getStyles();
6204
6213
  return this.getValues().map(
6205
6214
  (row) => row.map((cell) => {
6206
- var _a13;
6215
+ var _a11;
6207
6216
  const rgbColor = styles.getStyleByCell(cell);
6208
- return ((_a13 = rgbColor == null ? void 0 : rgbColor.bg) == null ? void 0 : _a13.rgb) || DEFAULT_STYLES.bg.rgb;
6217
+ return ((_a11 = rgbColor == null ? void 0 : rgbColor.bg) == null ? void 0 : _a11.rgb) || DEFAULT_STYLES.bg.rgb;
6209
6218
  })
6210
6219
  );
6211
6220
  }
@@ -6246,13 +6255,13 @@ const _Range = class _Range {
6246
6255
  * @returns Returns a value in object format
6247
6256
  */
6248
6257
  getObjectValues(options = {}) {
6249
- var _a13;
6258
+ var _a11;
6250
6259
  const { startRow, endRow, startColumn, endColumn } = this._range, values = this._worksheet.getCellMatrix().getFragment(startRow, endRow, startColumn, endColumn).getData();
6251
6260
  if (options.isIncludeStyle) {
6252
6261
  const style = this._deps.getStyles();
6253
6262
  for (let r = 0; r <= endRow - startRow; r++)
6254
6263
  for (let c = 0; c <= endColumn - startColumn; c++) {
6255
- if (values == null || ((_a13 = values == null ? void 0 : values[r]) == null ? void 0 : _a13[c]) == null)
6264
+ if (values == null || ((_a11 = values == null ? void 0 : values[r]) == null ? void 0 : _a11[c]) == null)
6256
6265
  continue;
6257
6266
  const s = values[r][c].s;
6258
6267
  s && (values[r][c].s = style.get(s));
@@ -6273,9 +6282,9 @@ const _Range = class _Range {
6273
6282
  const styles = this._deps.getStyles();
6274
6283
  return this.getValues().map(
6275
6284
  (row) => row.map((cell) => {
6276
- var _a13;
6285
+ var _a11;
6277
6286
  const cellStyle = styles.getStyleByCell(cell);
6278
- return ((_a13 = cellStyle == null ? void 0 : cellStyle.cl) == null ? void 0 : _a13.rgb) || DEFAULT_STYLES.cl.rgb;
6287
+ return ((_a11 = cellStyle == null ? void 0 : cellStyle.cl) == null ? void 0 : _a11.rgb) || DEFAULT_STYLES.cl.rgb;
6279
6288
  })
6280
6289
  );
6281
6290
  }
@@ -6301,8 +6310,8 @@ const _Range = class _Range {
6301
6310
  * Returns the underline of the cells in the range.
6302
6311
  */
6303
6312
  getUnderline() {
6304
- var _a13, _b2;
6305
- const { p } = (_a13 = this.getValue()) != null ? _a13 : {};
6313
+ var _a11, _b2;
6314
+ const { p } = (_a11 = this.getValue()) != null ? _a11 : {};
6306
6315
  return p && Array.isArray((_b2 = p.body) == null ? void 0 : _b2.textRuns) && p.body.textRuns.length > 0 ? isAllFormatInTextRuns("ul", p.body) === BooleanNumber.TRUE ? {
6307
6316
  s: BooleanNumber.TRUE
6308
6317
  } : {
@@ -6325,8 +6334,8 @@ const _Range = class _Range {
6325
6334
  * Returns the strikeThrough of the cells in the range.
6326
6335
  */
6327
6336
  getStrikeThrough() {
6328
- var _a13, _b2;
6329
- const { p } = (_a13 = this.getValue()) != null ? _a13 : {};
6337
+ var _a11, _b2;
6338
+ const { p } = (_a11 = this.getValue()) != null ? _a11 : {};
6330
6339
  return p && Array.isArray((_b2 = p.body) == null ? void 0 : _b2.textRuns) && p.body.textRuns.length > 0 ? isAllFormatInTextRuns("st", p.body) === BooleanNumber.TRUE ? {
6331
6340
  s: BooleanNumber.TRUE
6332
6341
  } : {
@@ -6343,14 +6352,14 @@ const _Range = class _Range {
6343
6352
  * Returns the font size in point size of the cell in the top-left corner of the range.
6344
6353
  */
6345
6354
  getFontSize() {
6346
- var _a13, _b2;
6347
- const p = ((_a13 = this.getValue()) == null ? void 0 : _a13.p) || {};
6355
+ var _a11, _b2;
6356
+ const p = ((_a11 = this.getValue()) == null ? void 0 : _a11.p) || {};
6348
6357
  return p && Array.isArray((_b2 = p.body) == null ? void 0 : _b2.textRuns) && p.body.textRuns.length > 0 ? p.body.textRuns.some((textRun) => {
6349
- var _a14;
6350
- return ((_a14 = textRun == null ? void 0 : textRun.ts) == null ? void 0 : _a14.fs) != null;
6358
+ var _a12;
6359
+ return ((_a12 = textRun == null ? void 0 : textRun.ts) == null ? void 0 : _a12.fs) != null;
6351
6360
  }) ? Math.max(...p.body.textRuns.map((textRun) => {
6352
- var _a14;
6353
- return ((_a14 = textRun == null ? void 0 : textRun.ts) == null ? void 0 : _a14.fs) || 0;
6361
+ var _a12;
6362
+ return ((_a12 = textRun == null ? void 0 : textRun.ts) == null ? void 0 : _a12.fs) || 0;
6354
6363
  })) : this.getFontSizes()[0][0] : this.getFontSizes()[0][0];
6355
6364
  }
6356
6365
  /**
@@ -6372,8 +6381,8 @@ const _Range = class _Range {
6372
6381
  * Returns the font style ('italic' or 'normal') of the cell in the top-left corner of the range.
6373
6382
  */
6374
6383
  getFontStyle() {
6375
- var _a13, _b2;
6376
- const { p } = (_a13 = this.getValue()) != null ? _a13 : {};
6384
+ var _a11, _b2;
6385
+ const { p } = (_a11 = this.getValue()) != null ? _a11 : {};
6377
6386
  return p && Array.isArray((_b2 = p.body) == null ? void 0 : _b2.textRuns) && p.body.textRuns.length > 0 ? isAllFormatInTextRuns("it", p.body) === BooleanNumber.TRUE ? FontItalic.ITALIC : FontItalic.NORMAL : this._getFontStyles()[0][0];
6378
6387
  }
6379
6388
  /**
@@ -6389,8 +6398,8 @@ const _Range = class _Range {
6389
6398
  * otherwise return FontWeight.NORMAL.
6390
6399
  */
6391
6400
  getFontWeight() {
6392
- var _a13, _b2;
6393
- const { p } = (_a13 = this.getValue()) != null ? _a13 : {};
6401
+ var _a11, _b2;
6402
+ const { p } = (_a11 = this.getValue()) != null ? _a11 : {};
6394
6403
  return p && Array.isArray((_b2 = p.body) == null ? void 0 : _b2.textRuns) && p.body.textRuns.length > 0 ? isAllFormatInTextRuns("bl", p.body) === BooleanNumber.TRUE ? FontWeight.BOLD : FontWeight.NORMAL : this._getFontWeights()[0][0];
6395
6404
  }
6396
6405
  /**
@@ -6684,6 +6693,56 @@ function multiSubtractSingleRange(ranges, toDelete) {
6684
6693
  }), Rectangle.mergeRanges(res);
6685
6694
  }
6686
6695
  __name(multiSubtractSingleRange, "multiSubtractSingleRange");
6696
+ function getIntersectRange(src, target) {
6697
+ const rowOverlap = getOverlap1D(
6698
+ src.startRow,
6699
+ src.endRow,
6700
+ target.startRow,
6701
+ target.endRow
6702
+ ), colOverlap = getOverlap1D(
6703
+ src.startColumn,
6704
+ src.endColumn,
6705
+ target.startColumn,
6706
+ target.endColumn
6707
+ );
6708
+ if (!rowOverlap || !colOverlap)
6709
+ return null;
6710
+ const [startRow, endRow] = rowOverlap, [startColumn, endColumn] = colOverlap, rangeType = determineRangeType(
6711
+ src.rangeType,
6712
+ target.rangeType,
6713
+ startRow,
6714
+ endRow,
6715
+ startColumn,
6716
+ endColumn
6717
+ );
6718
+ return {
6719
+ startRow,
6720
+ endRow,
6721
+ startColumn,
6722
+ endColumn,
6723
+ rangeType
6724
+ };
6725
+ }
6726
+ __name(getIntersectRange, "getIntersectRange");
6727
+ function getOverlap1D(start1, end1, start2, end2) {
6728
+ const s1 = isNaN(start1) ? -1 / 0 : start1, e1 = isNaN(end1) ? 1 / 0 : end1, s2 = isNaN(start2) ? -1 / 0 : start2, e2 = isNaN(end2) ? 1 / 0 : end2, start = Math.max(s1, s2), end = Math.min(e1, e2);
6729
+ if (start <= end) {
6730
+ const resultStart = start === -1 / 0 ? Number.NaN : start, resultEnd = end === 1 / 0 ? Number.NaN : end;
6731
+ return [resultStart, resultEnd];
6732
+ } else
6733
+ return null;
6734
+ }
6735
+ __name(getOverlap1D, "getOverlap1D");
6736
+ function determineRangeType(srcType, targetType, startRow, endRow, startColumn, endColumn) {
6737
+ const resolvedSrcType = srcType !== void 0 ? srcType : inferRangeType(startRow, endRow, startColumn, endColumn), resolvedTargetType = targetType !== void 0 ? targetType : inferRangeType(startRow, endRow, startColumn, endColumn);
6738
+ return resolvedSrcType === RANGE_TYPE.ALL || resolvedTargetType === RANGE_TYPE.ALL ? resolvedSrcType === resolvedTargetType ? resolvedSrcType : resolvedSrcType === RANGE_TYPE.ALL ? resolvedTargetType : resolvedSrcType : resolvedSrcType === resolvedTargetType ? resolvedSrcType : (resolvedSrcType === RANGE_TYPE.NORMAL || resolvedTargetType === RANGE_TYPE.NORMAL, RANGE_TYPE.NORMAL);
6739
+ }
6740
+ __name(determineRangeType, "determineRangeType");
6741
+ function inferRangeType(startRow, endRow, startColumn, endColumn) {
6742
+ const hasRow = !isNaN(startRow) && !isNaN(endRow), hasColumn = !isNaN(startColumn) && !isNaN(endColumn);
6743
+ return hasRow && hasColumn ? RANGE_TYPE.NORMAL : hasRow ? RANGE_TYPE.ROW : hasColumn ? RANGE_TYPE.COLUMN : RANGE_TYPE.ALL;
6744
+ }
6745
+ __name(inferRangeType, "inferRangeType");
6687
6746
  const _Rectangle = class _Rectangle {
6688
6747
  static clone(src) {
6689
6748
  return src.rangeType !== void 0 ? {
@@ -6723,6 +6782,10 @@ const _Rectangle = class _Rectangle {
6723
6782
  const MAX = Math.floor(Number.MAX_SAFE_INTEGER / 10), currentStartRow = Number.isNaN(src.startRow) ? 0 : src.startRow, currentEndRow = Number.isNaN(src.endRow) ? MAX : src.endRow, currentStartColumn = Number.isNaN(src.startColumn) ? 0 : src.startColumn, currentEndColumn = Number.isNaN(src.endColumn) ? MAX : src.endColumn, incomingStartRow = Number.isNaN(target.startRow) ? 0 : target.startRow, incomingEndRow = Number.isNaN(target.endRow) ? MAX : target.endRow, incomingStartColumn = Number.isNaN(target.startColumn) ? 0 : target.startColumn, incomingEndColumn = Number.isNaN(target.endColumn) ? MAX : target.endColumn, zx = Math.abs(currentStartColumn + currentEndColumn - incomingStartColumn - incomingEndColumn), x = Math.abs(currentStartColumn - currentEndColumn) + Math.abs(incomingStartColumn - incomingEndColumn), zy = Math.abs(currentStartRow + currentEndRow - incomingStartRow - incomingEndRow), y = Math.abs(currentStartRow - currentEndRow) + Math.abs(incomingStartRow - incomingEndRow);
6724
6783
  return zx <= x && zy <= y;
6725
6784
  }
6785
+ /**
6786
+ *
6787
+ * @deprecated use `getIntersectRange` instead. This method does not handle NaN and does not return the correct rangeType
6788
+ */
6726
6789
  static getIntersects(src, target) {
6727
6790
  const currentStartRow = src.startRow, currentEndRow = src.endRow, currentStartColumn = src.startColumn, currentEndColumn = src.endColumn, incomingStartRow = target.startRow, incomingEndRow = target.endRow, incomingStartColumn = target.startColumn, incomingEndColumn = target.endColumn;
6728
6791
  let startColumn, startRow, endColumn, endRow;
@@ -6997,8 +7060,8 @@ const _RefAlias = class _RefAlias {
6997
7060
  return this._values;
6998
7061
  }
6999
7062
  getKeyMap(key) {
7000
- var _a13;
7001
- return [...((_a13 = this._keyMaps.get(key)) == null ? void 0 : _a13.keys()) || []];
7063
+ var _a11;
7064
+ return [...((_a11 = this._keyMaps.get(key)) == null ? void 0 : _a11.keys()) || []];
7002
7065
  }
7003
7066
  clear() {
7004
7067
  this._values = [], this._keys = [], this._keyMaps.clear();
@@ -8187,8 +8250,8 @@ __name(requireDist, "requireDist");
8187
8250
  const anyComponent = /* @__PURE__ */ __name((op, fn) => op.some((c) => typeof c == "object" && (Array.isArray(c) ? anyComponent(c, fn) : fn(c))), "anyComponent");
8188
8251
  function makeInvertible(op, doc) {
8189
8252
  if (op == null || !anyComponent(op, (c) => {
8190
- var _a13;
8191
- return c.r !== void 0 || ((_a13 = getEditType(c)) === null || _a13 === void 0 ? void 0 : _a13.makeInvertible) != null;
8253
+ var _a11;
8254
+ return c.r !== void 0 || ((_a11 = getEditType(c)) === null || _a11 === void 0 ? void 0 : _a11.makeInvertible) != null;
8192
8255
  })) return op;
8193
8256
  const r = new cursor_js_1.ReadCursor(op), w = new cursor_js_1.WriteCursor();
8194
8257
  let hasEdits = !1;
@@ -8839,13 +8902,13 @@ function normalizeTextRuns(textRuns) {
8839
8902
  }
8840
8903
  __name(normalizeTextRuns, "normalizeTextRuns");
8841
8904
  function insertTextRuns(body, insertBody, textLength, currentIndex) {
8842
- var _a13;
8905
+ var _a11;
8843
8906
  const { textRuns } = body;
8844
8907
  if (textRuns == null)
8845
8908
  return;
8846
8909
  const newTextRuns = [], len = textRuns.length;
8847
8910
  let hasInserted = !1;
8848
- const insertTextRuns2 = (_a13 = insertBody.textRuns) != null ? _a13 : [];
8911
+ const insertTextRuns2 = (_a11 = insertBody.textRuns) != null ? _a11 : [];
8849
8912
  if (insertTextRuns2.length)
8850
8913
  for (const insertTextRun of insertTextRuns2)
8851
8914
  insertTextRun.st += currentIndex, insertTextRun.ed += currentIndex;
@@ -9038,7 +9101,7 @@ function insertCustomDecorations(body, insertBody, textLength, currentIndex) {
9038
9101
  }
9039
9102
  __name(insertCustomDecorations, "insertCustomDecorations");
9040
9103
  function deleteTextRuns(body, textLength, currentIndex) {
9041
- var _a13;
9104
+ var _a11;
9042
9105
  const { textRuns } = body, startIndex = currentIndex, endIndex = currentIndex + textLength, removeTextRuns = [];
9043
9106
  if (startIndex === endIndex && (textRuns != null && textRuns.find((t) => t.st === currentIndex && t.ed === currentIndex))) {
9044
9107
  const textRun = textRuns.find((t) => t.st === currentIndex && t.ed === currentIndex);
@@ -9046,7 +9109,7 @@ function deleteTextRuns(body, textLength, currentIndex) {
9046
9109
  ...textRun,
9047
9110
  st: textRun.st - currentIndex,
9048
9111
  ed: textRun.ed - currentIndex
9049
- }), body.textRuns = (_a13 = body.textRuns) == null ? void 0 : _a13.filter((t) => t !== textRun), removeTextRuns;
9112
+ }), body.textRuns = (_a11 = body.textRuns) == null ? void 0 : _a11.filter((t) => t !== textRun), removeTextRuns;
9050
9113
  }
9051
9114
  if (textRuns) {
9052
9115
  const newTextRuns = [];
@@ -9441,7 +9504,7 @@ function updateCustomDecorations(body, updateBody, textLength, currentIndex, cov
9441
9504
  __name(updateCustomDecorations, "updateCustomDecorations");
9442
9505
  var SliceBodyType = /* @__PURE__ */ ((SliceBodyType2) => (SliceBodyType2[SliceBodyType2.copy = 0] = "copy", SliceBodyType2[SliceBodyType2.cut = 1] = "cut", SliceBodyType2))(SliceBodyType || {});
9443
9506
  function getBodySlice(body, startOffset, endOffset, returnEmptyTextRun = !1, type2 = 1) {
9444
- const { dataStream, textRuns = [], paragraphs = [], customBlocks = [], tables = [] } = body, docBody = {
9507
+ const { dataStream, textRuns = [], paragraphs = [], customBlocks = [], tables = [], sectionBreaks = [] } = body, docBody = {
9445
9508
  dataStream: dataStream.slice(startOffset, endOffset)
9446
9509
  }, newTextRuns = [];
9447
9510
  for (const textRun of textRuns) {
@@ -9486,6 +9549,15 @@ function getBodySlice(body, startOffset, endOffset, returnEmptyTextRun = !1, typ
9486
9549
  newParagraphs.length && (docBody.paragraphs = newParagraphs.map((p) => ({
9487
9550
  ...p,
9488
9551
  startIndex: p.startIndex - startOffset
9552
+ })));
9553
+ const newSectionBreaks = [];
9554
+ for (const sectionBreak of sectionBreaks) {
9555
+ const { startIndex } = sectionBreak;
9556
+ startIndex >= startOffset && startIndex <= endOffset && newSectionBreaks.push(Tools.deepClone(sectionBreak));
9557
+ }
9558
+ newSectionBreaks.length && (docBody.sectionBreaks = newSectionBreaks.map((sb) => ({
9559
+ ...sb,
9560
+ startIndex: sb.startIndex - startOffset
9489
9561
  }))), type2 === 1 && (docBody.customDecorations = getCustomDecorationSlice(body, startOffset, endOffset));
9490
9562
  const { customRanges } = getCustomRangeSlice(body, startOffset, endOffset);
9491
9563
  docBody.customRanges = customRanges;
@@ -9712,7 +9784,7 @@ __name(textXApply, "textXApply");
9712
9784
  function transformTextRuns(originTextRuns, targetTextRuns, transformType) {
9713
9785
  if (originTextRuns.length === 0)
9714
9786
  return targetTextRuns;
9715
- targetTextRuns = Tools$1.deepClone(targetTextRuns), originTextRuns = Tools$1.deepClone(originTextRuns);
9787
+ targetTextRuns = Tools.deepClone(targetTextRuns), originTextRuns = Tools.deepClone(originTextRuns);
9716
9788
  const newUpdateTextRuns = [], updateLength = targetTextRuns.length, removeLength = originTextRuns.length;
9717
9789
  let updateIndex = 0, removeIndex = 0, pending = null;
9718
9790
  function pushPendingAndReturnStatus() {
@@ -9756,7 +9828,7 @@ function transformTextRuns(originTextRuns, targetTextRuns, transformType) {
9756
9828
  }
9757
9829
  pushPendingAndReturnStatus();
9758
9830
  const tempTopTextRun = newUpdateTextRuns[newUpdateTextRuns.length - 1], updateLastTextRun = targetTextRuns[updateLength - 1], removeLastTextRun = originTextRuns[removeLength - 1];
9759
- return tempTopTextRun.ed !== Math.max(updateLastTextRun.ed, removeLastTextRun.ed) && (updateLastTextRun.ed > removeLastTextRun.ed ? newUpdateTextRuns.push(updateLastTextRun) : newUpdateTextRuns.push(removeLastTextRun)), normalizeTextRuns$1(newUpdateTextRuns);
9831
+ return tempTopTextRun.ed !== Math.max(updateLastTextRun.ed, removeLastTextRun.ed) && (updateLastTextRun.ed > removeLastTextRun.ed ? newUpdateTextRuns.push(updateLastTextRun) : newUpdateTextRuns.push(removeLastTextRun)), normalizeTextRuns(newUpdateTextRuns);
9760
9832
  }
9761
9833
  __name(transformTextRuns, "transformTextRuns");
9762
9834
  function transformParagraph(originParagraph, targetParagraph, transformType) {
@@ -9819,7 +9891,7 @@ function transformBody(thisAction, otherAction, priority = !1) {
9819
9891
  0
9820
9892
  /* COVER */
9821
9893
  ), paragraphs.push(paragraph), thisIndex++, otherIndex++;
9822
- } else thisStart < otherStart ? thisIndex++ : (paragraphs.push(Tools$1.deepClone(otherParagraph)), otherIndex++);
9894
+ } else thisStart < otherStart ? thisIndex++ : (paragraphs.push(Tools.deepClone(otherParagraph)), otherIndex++);
9823
9895
  }
9824
9896
  return otherIndex < otherParagraphs.length && paragraphs.push(...otherParagraphs.slice(otherIndex)), paragraphs.length && (retBody.paragraphs = paragraphs), retBody;
9825
9897
  }
@@ -9883,12 +9955,12 @@ const _TextX = class _TextX {
9883
9955
  return this._transform(otherActions, thisActions, priority === "left" ? "right" : "left");
9884
9956
  }
9885
9957
  static _transform(thisActions, otherActions, priority = "right") {
9886
- var _a13;
9958
+ var _a11;
9887
9959
  const thisIter = new ActionIterator(thisActions), otherIter = new ActionIterator(otherActions), textX = new _TextX();
9888
9960
  for (; thisIter.hasNext() || otherIter.hasNext(); )
9889
9961
  if (thisIter.peekType() === TextXActionType.INSERT && (priority === "left" || otherIter.peekType() !== TextXActionType.INSERT)) {
9890
9962
  const thisAction = thisIter.next();
9891
- textX.retain(thisAction.len, (_a13 = thisAction.segmentId) != null ? _a13 : "");
9963
+ textX.retain(thisAction.len, (_a11 = thisAction.segmentId) != null ? _a11 : "");
9892
9964
  } else if (otherIter.peekType() === TextXActionType.INSERT)
9893
9965
  textX.push(otherIter.next());
9894
9966
  else {
@@ -10056,8 +10128,8 @@ Object.defineProperty(TextX, "name", {
10056
10128
  });
10057
10129
  const _JSONX = class _JSONX {
10058
10130
  static registerSubtype(subType) {
10059
- var _a13;
10060
- subType == null || this._subTypes.has(subType.name) && ((_a13 = this._subTypes.get(subType.name)) == null ? void 0 : _a13.id) !== TextX.id || (this._subTypes.set(subType.name, subType), dist$1.type.registerSubtype(subType));
10131
+ var _a11;
10132
+ subType == null || this._subTypes.has(subType.name) && ((_a11 = this._subTypes.get(subType.name)) == null ? void 0 : _a11.id) !== TextX.id || (this._subTypes.set(subType.name, subType), dist$1.type.registerSubtype(subType));
10061
10133
  }
10062
10134
  static apply(doc, actions) {
10063
10135
  if (!dist$1.type.isNoop(actions))
@@ -10110,20 +10182,20 @@ const DEFAULT_DOC = {
10110
10182
  documentStyle: {}
10111
10183
  }, _DocumentDataModelSimple = class _DocumentDataModelSimple extends UnitModel {
10112
10184
  constructor(snapshot) {
10113
- var _a13;
10185
+ var _a11;
10114
10186
  super();
10115
10187
  __publicField(this, "type", I.UNIVER_DOC);
10116
10188
  __publicField(this, "_name$", new BehaviorSubject(""));
10117
10189
  __publicField(this, "name$", this._name$.asObservable());
10118
10190
  __publicField(this, "snapshot");
10119
- this.snapshot = { ...DEFAULT_DOC, ...snapshot }, this._name$.next((_a13 = this.snapshot.title) != null ? _a13 : "No Title");
10191
+ this.snapshot = { ...DEFAULT_DOC, ...snapshot }, this._name$.next((_a11 = this.snapshot.title) != null ? _a11 : "No Title");
10120
10192
  }
10121
10193
  getUnitId() {
10122
10194
  throw new Error("Method not implemented.");
10123
10195
  }
10124
10196
  getRev() {
10125
- var _a13;
10126
- return (_a13 = this.snapshot.rev) != null ? _a13 : 1;
10197
+ var _a11;
10198
+ return (_a11 = this.snapshot.rev) != null ? _a11 : 1;
10127
10199
  }
10128
10200
  incrementRev() {
10129
10201
  this.snapshot.rev = this.getRev() + 1;
@@ -10144,8 +10216,8 @@ const DEFAULT_DOC = {
10144
10216
  return this.snapshot.lists;
10145
10217
  }
10146
10218
  get zoomRatio() {
10147
- var _a13;
10148
- return ((_a13 = this.snapshot.settings) == null ? void 0 : _a13.zoomRatio) || 1;
10219
+ var _a11;
10220
+ return ((_a11 = this.snapshot.settings) == null ? void 0 : _a11.zoomRatio) || 1;
10149
10221
  }
10150
10222
  resetDrawing(drawings, drawingsOrder) {
10151
10223
  this.snapshot.drawings = drawings, this.snapshot.drawingsOrder = drawingsOrder;
@@ -10157,8 +10229,8 @@ const DEFAULT_DOC = {
10157
10229
  return this.snapshot;
10158
10230
  }
10159
10231
  getBulletPresetList() {
10160
- var _a13;
10161
- const customLists = (_a13 = this.snapshot.lists) != null ? _a13 : {};
10232
+ var _a11;
10233
+ const customLists = (_a11 = this.snapshot.lists) != null ? _a11 : {};
10162
10234
  return {
10163
10235
  ...PRESET_LIST_TYPE,
10164
10236
  ...customLists
@@ -10212,13 +10284,13 @@ __name(_DocumentDataModelSimple, "DocumentDataModelSimple");
10212
10284
  let DocumentDataModelSimple = _DocumentDataModelSimple;
10213
10285
  const _DocumentDataModel = class _DocumentDataModel extends DocumentDataModelSimple {
10214
10286
  constructor(snapshot) {
10215
- var _a13, _b2;
10287
+ var _a11, _b2;
10216
10288
  super(Tools.isEmptyObject(snapshot) ? getEmptySnapshot$1() : snapshot);
10217
10289
  __publicField(this, "_unitId");
10218
10290
  __publicField(this, "headerModelMap", /* @__PURE__ */ new Map());
10219
10291
  __publicField(this, "footerModelMap", /* @__PURE__ */ new Map());
10220
10292
  const UNIT_ID_LENGTH = 6;
10221
- this._unitId = (_a13 = this.snapshot.id) != null ? _a13 : Tools.generateRandomId(UNIT_ID_LENGTH), this._initializeHeaderFooterModel(), this._name$.next((_b2 = this.snapshot.title) != null ? _b2 : "");
10293
+ this._unitId = (_a11 = this.snapshot.id) != null ? _a11 : Tools.generateRandomId(UNIT_ID_LENGTH), this._initializeHeaderFooterModel(), this._name$.next((_b2 = this.snapshot.title) != null ? _b2 : "");
10222
10294
  }
10223
10295
  dispose() {
10224
10296
  super.dispose(), this.headerModelMap.forEach((header) => {
@@ -10234,12 +10306,12 @@ const _DocumentDataModel = class _DocumentDataModel extends DocumentDataModelSim
10234
10306
  return this.snapshot.drawingsOrder;
10235
10307
  }
10236
10308
  getCustomRanges() {
10237
- var _a13;
10238
- return (_a13 = this.snapshot.body) == null ? void 0 : _a13.customRanges;
10309
+ var _a11;
10310
+ return (_a11 = this.snapshot.body) == null ? void 0 : _a11.customRanges;
10239
10311
  }
10240
10312
  getCustomDecorations() {
10241
- var _a13;
10242
- return (_a13 = this.snapshot.body) == null ? void 0 : _a13.customDecorations;
10313
+ var _a11;
10314
+ return (_a11 = this.snapshot.body) == null ? void 0 : _a11.customDecorations;
10243
10315
  }
10244
10316
  getSettings() {
10245
10317
  return this.snapshot.settings;
@@ -10291,7 +10363,7 @@ const _DocumentDataModel = class _DocumentDataModel extends DocumentDataModelSim
10291
10363
  __name(_DocumentDataModel, "DocumentDataModel");
10292
10364
  let DocumentDataModel = _DocumentDataModel;
10293
10365
  function isCustomRangeSplitSymbol(text) {
10294
- return text === DataStreamTreeTokenType$1.CUSTOM_RANGE_END || text === DataStreamTreeTokenType$1.CUSTOM_RANGE_START;
10366
+ return text === DataStreamTreeTokenType.CUSTOM_RANGE_END || text === DataStreamTreeTokenType.CUSTOM_RANGE_START;
10295
10367
  }
10296
10368
  __name(isCustomRangeSplitSymbol, "isCustomRangeSplitSymbol");
10297
10369
  function isIntersecting(line1Start, line1End, line2Start, line2End) {
@@ -10324,8 +10396,8 @@ function getCustomRangesInterestsWithRange(range, customRanges) {
10324
10396
  __name(getCustomRangesInterestsWithRange, "getCustomRangesInterestsWithRange");
10325
10397
  function copyCustomRange(range) {
10326
10398
  return {
10327
- ...Tools$1.deepClone(range),
10328
- rangeId: generateRandomId$1()
10399
+ ...Tools.deepClone(range),
10400
+ rangeId: generateRandomId()
10329
10401
  };
10330
10402
  }
10331
10403
  __name(copyCustomRange, "copyCustomRange");
@@ -10367,7 +10439,7 @@ const tags = [
10367
10439
  const text = dataStream.endsWith(`\r
10368
10440
  `) ? dataStream.slice(0, -2) : dataStream;
10369
10441
  return tags.reduce((res, curr) => res.replaceAll(curr, ""), text);
10370
- }, "getPlainText"), fromPlainText = /* @__PURE__ */ __name((text) => {
10442
+ }, "getPlainText"), isEmptyDocument = /* @__PURE__ */ __name((dataStream) => dataStream ? getPlainText(dataStream).replaceAll("\r", "") === "" : !0, "isEmptyDocument"), fromPlainText = /* @__PURE__ */ __name((text) => {
10371
10443
  const dataStream = text.replace(/\n/g, "\r"), paragraphs = [], customRanges = [];
10372
10444
  let cursor2 = 0, newDataStream = "", linkCount = 0;
10373
10445
  const loopParagraph = /* @__PURE__ */ __name((i, insertP = !0) => {
@@ -10425,7 +10497,7 @@ function getSelectionWithSymbolMax(selection, body) {
10425
10497
  }
10426
10498
  __name(getSelectionWithSymbolMax, "getSelectionWithSymbolMax");
10427
10499
  function getDeleteSelection(selection, body, direction = DeleteDirection.LEFT) {
10428
- var _a13;
10500
+ var _a11;
10429
10501
  let { startOffset, endOffset, collapsed } = normalizeSelection(selection);
10430
10502
  if (collapsed)
10431
10503
  if (direction === DeleteDirection.LEFT)
@@ -10439,7 +10511,7 @@ function getDeleteSelection(selection, body, direction = DeleteDirection.LEFT) {
10439
10511
  startOffset = selectionWithSymbolMax.startOffset, endOffset = selectionWithSymbolMax.endOffset;
10440
10512
  }
10441
10513
  collapsed = startOffset === endOffset;
10442
- const customRanges = (_a13 = body.customRanges) == null ? void 0 : _a13.filter((range) => !range.wholeEntity || startOffset <= range.startIndex && endOffset > range.endIndex ? !1 : isSegmentIntersects(startOffset, collapsed ? endOffset : endOffset - 1, range.startIndex, range.endIndex));
10514
+ const customRanges = (_a11 = body.customRanges) == null ? void 0 : _a11.filter((range) => !range.wholeEntity || startOffset <= range.startIndex && endOffset > range.endIndex ? !1 : isSegmentIntersects(startOffset, collapsed ? endOffset : endOffset - 1, range.startIndex, range.endIndex));
10443
10515
  return customRanges != null && customRanges.length && customRanges.forEach((range) => {
10444
10516
  startOffset = Math.min(range.startIndex, startOffset), endOffset = Math.max(range.endIndex + 1, endOffset);
10445
10517
  }), {
@@ -10522,8 +10594,8 @@ function isSegmentIntersects(start, end, start2, end2) {
10522
10594
  }
10523
10595
  __name(isSegmentIntersects, "isSegmentIntersects");
10524
10596
  function getRetainAndDeleteFromReplace(range, segmentId = "", memoryCursor, body) {
10525
- var _a13;
10526
- const { startOffset, endOffset } = range, dos = [], textStart = startOffset - memoryCursor, textEnd = endOffset - memoryCursor, dataStream = body.dataStream, relativeCustomRanges = (_a13 = body.customRanges) == null ? void 0 : _a13.filter((customRange) => isIntersecting(customRange.startIndex, customRange.endIndex, startOffset, endOffset)), toDeleteRanges = new Set(relativeCustomRanges == null ? void 0 : relativeCustomRanges.filter((customRange) => shouldDeleteCustomRange(startOffset, endOffset - startOffset, customRange, dataStream))), retainPoints = /* @__PURE__ */ new Set();
10597
+ var _a11;
10598
+ const { startOffset, endOffset } = range, dos = [], textStart = startOffset - memoryCursor, textEnd = endOffset - memoryCursor, dataStream = body.dataStream, relativeCustomRanges = (_a11 = body.customRanges) == null ? void 0 : _a11.filter((customRange) => isIntersecting(customRange.startIndex, customRange.endIndex, startOffset, endOffset)), toDeleteRanges = new Set(relativeCustomRanges == null ? void 0 : relativeCustomRanges.filter((customRange) => shouldDeleteCustomRange(startOffset, endOffset - startOffset, customRange, dataStream))), retainPoints = /* @__PURE__ */ new Set();
10527
10599
  relativeCustomRanges == null || relativeCustomRanges.forEach((range2) => {
10528
10600
  toDeleteRanges.has(range2) || (range2.startIndex - memoryCursor >= textStart && range2.startIndex - memoryCursor < textEnd && range2.endIndex - memoryCursor >= textEnd && retainPoints.add(range2.startIndex), range2.endIndex - memoryCursor >= textStart && range2.endIndex - memoryCursor < textEnd && range2.startIndex - memoryCursor < textStart && retainPoints.add(range2.endIndex));
10529
10601
  }), textStart > 0 && dos.push({
@@ -10558,8 +10630,8 @@ function getRetainAndDeleteFromReplace(range, segmentId = "", memoryCursor, body
10558
10630
  }
10559
10631
  __name(getRetainAndDeleteFromReplace, "getRetainAndDeleteFromReplace");
10560
10632
  function deleteCustomRangeTextX(accessor, params) {
10561
- var _a13, _b2;
10562
- const { rangeId, segmentId, documentDataModel, insert } = params, range = (_b2 = (_a13 = documentDataModel.getSelfOrHeaderFooterModel(segmentId).getBody()) == null ? void 0 : _a13.customRanges) == null ? void 0 : _b2.find((r) => r.rangeId === rangeId);
10633
+ var _a11, _b2;
10634
+ const { rangeId, segmentId, documentDataModel, insert, textRange } = params, range = (_b2 = (_a11 = documentDataModel.getSelfOrHeaderFooterModel(segmentId).getBody()) == null ? void 0 : _a11.customRanges) == null ? void 0 : _b2.find((r) => r.rangeId === rangeId);
10563
10635
  if (!range)
10564
10636
  return !1;
10565
10637
  const { startIndex, endIndex } = range, textX = new TextX(), len = endIndex - startIndex + 1;
@@ -10572,7 +10644,7 @@ function deleteCustomRangeTextX(accessor, params) {
10572
10644
  len: 1,
10573
10645
  segmentId,
10574
10646
  line: 0
10575
- }), len - 2 > 0 && textX.push({
10647
+ }), textRange && textRange.index > startIndex && textRange.index--, len - 2 > 0 && textX.push({
10576
10648
  t: TextXActionType.RETAIN,
10577
10649
  len: len - 2,
10578
10650
  segmentId
@@ -10581,21 +10653,21 @@ function deleteCustomRangeTextX(accessor, params) {
10581
10653
  len: 1,
10582
10654
  segmentId,
10583
10655
  line: 0
10584
- }), insert && textX.push({
10656
+ }), textRange && textRange.index > endIndex && textRange.index--, insert && (textX.push({
10585
10657
  body: insert,
10586
10658
  t: TextXActionType.INSERT,
10587
10659
  len: insert.dataStream.length,
10588
10660
  segmentId,
10589
10661
  line: 1
10590
- }), textX;
10662
+ }), textRange && textRange.index > endIndex && (textRange.index += insert.dataStream.length)), textX;
10591
10663
  }
10592
10664
  __name(deleteCustomRangeTextX, "deleteCustomRangeTextX");
10593
10665
  function addCustomRangeTextX(param) {
10594
- var _a13, _b2;
10666
+ var _a11, _b2;
10595
10667
  const { range, rangeId, rangeType, segmentId, wholeEntity, properties, body } = param, actualRange = getSelectionForAddCustomRange(range, body);
10596
10668
  if (!actualRange || !body)
10597
10669
  return !1;
10598
- const { startOffset, endOffset } = actualRange, customRanges = (_a13 = body.customRanges) != null ? _a13 : [];
10670
+ const { startOffset, endOffset } = actualRange, customRanges = (_a11 = body.customRanges) != null ? _a11 : [];
10599
10671
  let cursor2 = 0;
10600
10672
  const textX = new TextX(), addCustomRange = /* @__PURE__ */ __name((startIndex, endIndex, index2) => {
10601
10673
  const relativeCustomRanges = [];
@@ -10664,10 +10736,10 @@ function addCustomRangeTextX(param) {
10664
10736
  }
10665
10737
  __name(addCustomRangeTextX, "addCustomRangeTextX");
10666
10738
  function getRetainAndDeleteAndExcludeLineBreak(selection, body, segmentId = "", memoryCursor = 0, preserveLineBreak = !0) {
10667
- var _a13;
10739
+ var _a11;
10668
10740
  const { startOffset, endOffset } = getDeleteSelection(selection, body), dos = [], { paragraphs = [], dataStream } = body, textStart = startOffset - memoryCursor, textEnd = endOffset - memoryCursor, paragraphInRange = paragraphs == null ? void 0 : paragraphs.find(
10669
10741
  (p) => p.startIndex - memoryCursor >= textStart && p.startIndex - memoryCursor < textEnd
10670
- ), relativeCustomRanges = (_a13 = body.customRanges) == null ? void 0 : _a13.filter((customRange) => isIntersecting(customRange.startIndex, customRange.endIndex, startOffset, endOffset)), toDeleteRanges = new Set(relativeCustomRanges == null ? void 0 : relativeCustomRanges.filter((customRange) => shouldDeleteCustomRange(startOffset, endOffset - startOffset, customRange, dataStream))), retainPoints = /* @__PURE__ */ new Set();
10742
+ ), relativeCustomRanges = (_a11 = body.customRanges) == null ? void 0 : _a11.filter((customRange) => isIntersecting(customRange.startIndex, customRange.endIndex, startOffset, endOffset)), toDeleteRanges = new Set(relativeCustomRanges == null ? void 0 : relativeCustomRanges.filter((customRange) => shouldDeleteCustomRange(startOffset, endOffset - startOffset, customRange, dataStream))), retainPoints = /* @__PURE__ */ new Set();
10671
10743
  if (relativeCustomRanges == null || relativeCustomRanges.forEach((range) => {
10672
10744
  toDeleteRanges.has(range) || (range.startIndex - memoryCursor >= textStart && range.startIndex - memoryCursor <= textEnd && range.endIndex - memoryCursor > textEnd && retainPoints.add(range.startIndex), range.endIndex - memoryCursor >= textStart && range.endIndex - memoryCursor <= textEnd && range.startIndex < textStart && retainPoints.add(range.endIndex));
10673
10745
  }), textStart > 0 && dos.push({
@@ -10701,8 +10773,8 @@ function getRetainAndDeleteAndExcludeLineBreak(selection, body, segmentId = "",
10701
10773
  }
10702
10774
  __name(getRetainAndDeleteAndExcludeLineBreak, "getRetainAndDeleteAndExcludeLineBreak");
10703
10775
  const replaceSelectionTextX = /* @__PURE__ */ __name((params) => {
10704
- var _a13;
10705
- const { selection, body: insertBody, doc } = params, segmentId = selection.segmentId, body = (_a13 = doc.getSelfOrHeaderFooterModel(segmentId)) == null ? void 0 : _a13.getBody();
10776
+ var _a11;
10777
+ const { selection, body: insertBody, doc } = params, segmentId = selection.segmentId, body = (_a11 = doc.getSelfOrHeaderFooterModel(segmentId)) == null ? void 0 : _a11.getBody();
10706
10778
  if (!body) return !1;
10707
10779
  const textX = new TextX(), deleteActions = getRetainAndDeleteAndExcludeLineBreak(selection, body, segmentId);
10708
10780
  return deleteActions.length && textX.push(...deleteActions), textX.push({
@@ -10733,7 +10805,8 @@ __name(_BuildTextUtils, "BuildTextUtils"), __publicField(_BuildTextUtils, "custo
10733
10805
  isIntersects: isSegmentIntersects
10734
10806
  }), __publicField(_BuildTextUtils, "transform", {
10735
10807
  getPlainText,
10736
- fromPlainText
10808
+ fromPlainText,
10809
+ isEmptyDocument
10737
10810
  });
10738
10811
  let BuildTextUtils = _BuildTextUtils;
10739
10812
  function replaceInDocumentBody(body, query, target) {
@@ -10806,23 +10879,23 @@ const _EventSubject = class _EventSubject extends Subject {
10806
10879
  typeof observer == "function" ? ob = { next: /* @__PURE__ */ __name(([evt, state]) => observer(evt, state), "next") } : ob = observer;
10807
10880
  const subscription = super.subscribe(ob);
10808
10881
  return this._sortedObservers.push(ob), this._sortedObservers.sort((a, b) => {
10809
- var _a13, _b2;
10810
- return ((_a13 = a.priority) != null ? _a13 : 0) - ((_b2 = b.priority) != null ? _b2 : 0);
10882
+ var _a11, _b2;
10883
+ return ((_a11 = a.priority) != null ? _a11 : 0) - ((_b2 = b.priority) != null ? _b2 : 0);
10811
10884
  }), subscription.add(() => this._sortedObservers = this._sortedObservers.filter((o) => o !== ob)), subscription;
10812
10885
  }
10813
10886
  clearObservers() {
10814
10887
  this._sortedObservers.forEach((observer) => {
10815
- var _a13;
10816
- return (_a13 = observer.complete) == null ? void 0 : _a13.call(observer);
10888
+ var _a11;
10889
+ return (_a11 = observer.complete) == null ? void 0 : _a11.call(observer);
10817
10890
  }), this._sortedObservers.length = 0;
10818
10891
  }
10819
10892
  emitEvent(event) {
10820
- var _a13;
10893
+ var _a11;
10821
10894
  if (!this.closed) {
10822
10895
  const state = new EventState();
10823
10896
  state.lastReturnValue = event;
10824
10897
  for (const observer of this._sortedObservers) {
10825
- const value = (_a13 = observer.next) == null ? void 0 : _a13.call(observer, [event, state]);
10898
+ const value = (_a11 = observer.next) == null ? void 0 : _a11.call(observer, [event, state]);
10826
10899
  if (state.lastReturnValue = value, state.skipNextObservers)
10827
10900
  return {
10828
10901
  handled: !0,
@@ -10850,25 +10923,7 @@ function fromEventSubject(subject$) {
10850
10923
  });
10851
10924
  }
10852
10925
  __name(fromEventSubject, "fromEventSubject");
10853
- const IResourceManagerService = createIdentifier("core.resource-manager.service");
10854
- var LifecycleStages = /* @__PURE__ */ ((LifecycleStages2) => (LifecycleStages2[LifecycleStages2.Starting = 0] = "Starting", LifecycleStages2[LifecycleStages2.Ready = 1] = "Ready", LifecycleStages2[LifecycleStages2.Rendered = 2] = "Rendered", LifecycleStages2[LifecycleStages2.Steady = 3] = "Steady", LifecycleStages2))(LifecycleStages || {});
10855
- const LifecycleNameMap = {
10856
- 0: "Starting",
10857
- 1: "Ready",
10858
- 2: "Rendered",
10859
- 3: "Steady"
10860
- }, LifecycleToModules = /* @__PURE__ */ new Map();
10861
- function OnLifecycle(lifecycleStage, identifier) {
10862
- return /* @__PURE__ */ __name(function(_) {
10863
- runOnLifecycle(lifecycleStage, identifier);
10864
- }, "decorator2");
10865
- }
10866
- __name(OnLifecycle, "OnLifecycle");
10867
- function runOnLifecycle(lifecycleStage, identifier) {
10868
- LifecycleToModules.has(lifecycleStage) || LifecycleToModules.set(lifecycleStage, []), LifecycleToModules.get(lifecycleStage).push(identifier);
10869
- }
10870
- __name(runOnLifecycle, "runOnLifecycle");
10871
- const nameMap = {
10926
+ const IResourceManagerService = createIdentifier("core.resource-manager.service"), nameMap = {
10872
10927
  [G.Editor]: "Editor",
10873
10928
  [G.Owner]: "Owner",
10874
10929
  [G.Reader]: "Reader",
@@ -10883,13 +10938,7 @@ const nameMap = {
10883
10938
  avatar: "",
10884
10939
  anonymous: !0,
10885
10940
  canBindAnonymous: !1
10886
- }, "createDefaultUser"), isDevRole = /* @__PURE__ */ __name((userId, type2) => userId.startsWith(nameMap[type2]), "isDevRole");
10887
- var __defProp$7 = Object.defineProperty, __getOwnPropDesc$7 = Object.getOwnPropertyDescriptor, __decorateClass$7 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
10888
- for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$7(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
10889
- (decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
10890
- return kind && result && __defProp$7(target, key, result), result;
10891
- }, "__decorateClass$7"), _a3;
10892
- let UserManagerService = (_a3 = class {
10941
+ }, "createDefaultUser"), isDevRole = /* @__PURE__ */ __name((userId, type2) => userId.startsWith(nameMap[type2]), "isDevRole"), _UserManagerService = class _UserManagerService {
10893
10942
  constructor() {
10894
10943
  __publicField(this, "_model", /* @__PURE__ */ new Map());
10895
10944
  __publicField(this, "_userChange$", new Subject());
@@ -10926,16 +10975,15 @@ let UserManagerService = (_a3 = class {
10926
10975
  list() {
10927
10976
  return Array.from(this._model.values());
10928
10977
  }
10929
- }, __name(_a3, "UserManagerService"), _a3);
10930
- UserManagerService = __decorateClass$7([
10931
- OnLifecycle(LifecycleStages.Starting, UserManagerService)
10932
- ], UserManagerService);
10978
+ };
10979
+ __name(_UserManagerService, "UserManagerService");
10980
+ let UserManagerService = _UserManagerService;
10933
10981
  var __defProp$6 = Object.defineProperty, __getOwnPropDesc$6 = Object.getOwnPropertyDescriptor, __decorateClass$6 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
10934
10982
  for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$6(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
10935
10983
  (decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
10936
10984
  return kind && result && __defProp$6(target, key, result), result;
10937
- }, "__decorateClass$6"), __decorateParam$6 = /* @__PURE__ */ __name((index2, decorator) => (target, key) => decorator(target, key, index2), "__decorateParam$6"), _a4;
10938
- let AuthzIoLocalService = (_a4 = class {
10985
+ }, "__decorateClass$6"), __decorateParam$6 = /* @__PURE__ */ __name((index2, decorator) => (target, key) => decorator(target, key, index2), "__decorateParam$6"), _a3;
10986
+ let AuthzIoLocalService = (_a3 = class {
10939
10987
  // private _sheetPermissionPointMap: Map<string, { action: UnitAction; allowed: boolean }[]> = new Map();
10940
10988
  constructor(_resourceManagerService, _userManagerService) {
10941
10989
  __publicField(this, "_permissionMap", /* @__PURE__ */ new Map([]));
@@ -11077,7 +11125,7 @@ let AuthzIoLocalService = (_a4 = class {
11077
11125
  }
11078
11126
  async putCollaborators(config) {
11079
11127
  }
11080
- }, __name(_a4, "AuthzIoLocalService"), _a4);
11128
+ }, __name(_a3, "AuthzIoLocalService"), _a3);
11081
11129
  AuthzIoLocalService = __decorateClass$6([
11082
11130
  __decorateParam$6(0, IResourceManagerService),
11083
11131
  __decorateParam$6(1, Inject(UserManagerService))
@@ -11090,8 +11138,8 @@ const IAuthzIoService = createIdentifier("IAuthzIoIoService"), IConfigService =
11090
11138
  return this._config.get(id);
11091
11139
  }
11092
11140
  setConfig(id, value, options) {
11093
- var _a13;
11094
- const { merge: merge2 = !1 } = options || {}, existingValue = (_a13 = this._config.get(id)) != null ? _a13 : {};
11141
+ var _a11;
11142
+ const { merge: merge2 = !1 } = options || {}, existingValue = (_a11 = this._config.get(id)) != null ? _a11 : {};
11095
11143
  if (merge2) {
11096
11144
  this._config.set(id, Tools.deepMerge(existingValue, value));
11097
11145
  return;
@@ -11119,7 +11167,7 @@ const FOCUSING_UNIT = "FOCUSING_UNIT", FOCUSING_SHEET = "FOCUSING_SHEET", FOCUSI
11119
11167
  };
11120
11168
  __name(_ErrorService, "ErrorService");
11121
11169
  let ErrorService = _ErrorService;
11122
- const version = "0.3.0";
11170
+ const version = "0.4.0-alpha.1";
11123
11171
  function getEmptySnapshot(unitID = "", locale = LocaleType.ZH_CN, name = "") {
11124
11172
  return {
11125
11173
  id: unitID,
@@ -11558,6 +11606,15 @@ const _SpanModel = class _SpanModel extends Disposable {
11558
11606
  const index2 = this._getMergeDataIndex(row, column);
11559
11607
  return index2 !== -1 ? this._mergeData[index2] : null;
11560
11608
  }
11609
+ /**
11610
+ * Return index of merge data if (row,col) is in merge range. -1 means not in merge range.
11611
+ * @param row
11612
+ * @param column
11613
+ * @returns {number} index of merge range.
11614
+ */
11615
+ getMergeDataIndex(row, column) {
11616
+ return this._getMergeDataIndex(row, column);
11617
+ }
11561
11618
  isRowContainsMergedCell(row) {
11562
11619
  return this._hasAll || !Tools.isEmptyObject(this._columnCache) ? !0 : this._mergeData.some((mergedCell) => mergedCell.startRow <= row && row <= mergedCell.endRow);
11563
11620
  }
@@ -11635,7 +11692,7 @@ const _SpanModel = class _SpanModel extends Disposable {
11635
11692
  return ranges;
11636
11693
  }
11637
11694
  _getMergeDataIndex(row, column) {
11638
- var _a13;
11695
+ var _a11;
11639
11696
  if (this._hasAll)
11640
11697
  return this._allIndex;
11641
11698
  if (this._hasRow) {
@@ -11648,7 +11705,7 @@ const _SpanModel = class _SpanModel extends Disposable {
11648
11705
  if (columnValue !== void 0)
11649
11706
  return columnValue;
11650
11707
  }
11651
- const cellValue = (_a13 = this._cellCache.get(row)) == null ? void 0 : _a13.get(column);
11708
+ const cellValue = (_a11 = this._cellCache.get(row)) == null ? void 0 : _a11.get(column);
11652
11709
  return cellValue !== void 0 ? cellValue : -1;
11653
11710
  }
11654
11711
  getMergeDataSnapshot() {
@@ -11680,8 +11737,8 @@ const _SheetViewModel = class _SheetViewModel extends Disposable {
11680
11737
  return this._cellContentInterceptor ? this._cellContentInterceptor.getCell(row, col, InterceptorEffectEnum.Style) : this.getRawCell(row, col);
11681
11738
  }
11682
11739
  getRowFiltered(row) {
11683
- var _a13, _b2;
11684
- return (_b2 = (_a13 = this._rowFilteredInterceptor) == null ? void 0 : _a13.getRowFiltered(row)) != null ? _b2 : !1;
11740
+ var _a11, _b2;
11741
+ return (_b2 = (_a11 = this._rowFilteredInterceptor) == null ? void 0 : _a11.getRowFiltered(row)) != null ? _b2 : !1;
11685
11742
  }
11686
11743
  registerCellContentInterceptor(interceptor) {
11687
11744
  if (this._cellContentInterceptor)
@@ -11705,10 +11762,10 @@ const _Worksheet = class _Worksheet {
11705
11762
  __publicField(this, "_columnManager");
11706
11763
  __publicField(this, "_viewModel");
11707
11764
  __publicField(this, "_spanModel");
11708
- var _a13;
11765
+ var _a11;
11709
11766
  this.unitId = unitId, this._styles = _styles, this._snapshot = mergeWorksheetSnapshotWithDefault(snapshot);
11710
11767
  const { columnData, rowData, cellData } = this._snapshot;
11711
- this._sheetId = (_a13 = this._snapshot.id) != null ? _a13 : Tools.generateRandomId(6), this._cellData = new ObjectMatrix(cellData), this._viewModel = new SheetViewModel((row, col) => this.getCellRaw(row, col)), this._rowManager = new RowManager(this._snapshot, this._viewModel, rowData), this._columnManager = new ColumnManager(this._snapshot, columnData), this._spanModel = new SpanModel(this._snapshot.mergeData);
11768
+ this._sheetId = (_a11 = this._snapshot.id) != null ? _a11 : Tools.generateRandomId(6), this._cellData = new ObjectMatrix(cellData), this._viewModel = new SheetViewModel((row, col) => this.getCellRaw(row, col)), this._rowManager = new RowManager(this._snapshot, this._viewModel, rowData), this._columnManager = new ColumnManager(this._snapshot, columnData), this._spanModel = new SpanModel(this._snapshot.mergeData);
11712
11769
  }
11713
11770
  /**
11714
11771
  * @internal
@@ -11818,7 +11875,7 @@ const _Worksheet = class _Worksheet {
11818
11875
  return this._spanModel.getMergedCell(row, col);
11819
11876
  }
11820
11877
  /**
11821
- * Get the merged cell info list which has intersection with the given range.
11878
+ * Get the merged cell info list which has intersection with the given range.
11822
11879
  * @param {number} startRow The start row index of the range
11823
11880
  * @param {number} startColumn The start column index of the range
11824
11881
  * @param {number} endRow The end row index of the range
@@ -12224,10 +12281,10 @@ const _Worksheet = class _Worksheet {
12224
12281
  __name(_Worksheet, "Worksheet");
12225
12282
  let Worksheet = _Worksheet;
12226
12283
  function extractPureTextFromCell(cell) {
12227
- var _a13, _b2;
12284
+ var _a11, _b2;
12228
12285
  if (!cell)
12229
12286
  return "";
12230
- const richTextValue = (_b2 = (_a13 = cell.p) == null ? void 0 : _a13.body) == null ? void 0 : _b2.dataStream;
12287
+ const richTextValue = (_b2 = (_a11 = cell.p) == null ? void 0 : _a11.body) == null ? void 0 : _b2.dataStream;
12231
12288
  if (richTextValue)
12232
12289
  return BuildTextUtils.transform.getPlainText(richTextValue);
12233
12290
  const rawValue = cell.v;
@@ -12256,8 +12313,8 @@ function getWorksheetUID(workbook, worksheet) {
12256
12313
  return `${workbook.getUnitId()}|${worksheet.getSheetId()}`;
12257
12314
  }
12258
12315
  __name(getWorksheetUID, "getWorksheetUID");
12259
- var _a5;
12260
- let Workbook = (_a5 = class extends UnitModel {
12316
+ var _a4;
12317
+ let Workbook = (_a4 = class extends UnitModel {
12261
12318
  constructor(workbookData = {}, _logService) {
12262
12319
  super();
12263
12320
  __publicField(this, "type", I.UNIVER_SHEET);
@@ -12333,8 +12390,8 @@ let Workbook = (_a5 = class extends UnitModel {
12333
12390
  return this._unitId;
12334
12391
  }
12335
12392
  getRev() {
12336
- var _a13;
12337
- return (_a13 = this._snapshot.rev) != null ? _a13 : 1;
12393
+ var _a11;
12394
+ return (_a11 = this._snapshot.rev) != null ? _a11 : 1;
12338
12395
  }
12339
12396
  incrementRev() {
12340
12397
  this._snapshot.rev = this.getRev() + 1;
@@ -12497,13 +12554,13 @@ let Workbook = (_a5 = class extends UnitModel {
12497
12554
  }
12498
12555
  this.ensureActiveSheet();
12499
12556
  }
12500
- }, __name(_a5, "Workbook"), _a5);
12557
+ }, __name(_a4, "Workbook"), _a4);
12501
12558
  Workbook = __decorateClass$5([
12502
12559
  __decorateParam$5(1, ILogService)
12503
12560
  ], Workbook);
12504
12561
  const _SlideDataModel = class _SlideDataModel extends UnitModel {
12505
12562
  constructor(snapshot) {
12506
- var _a13;
12563
+ var _a11;
12507
12564
  super();
12508
12565
  __publicField(this, "type", I.UNIVER_SLIDE);
12509
12566
  __publicField(this, "_activePage$", new BehaviorSubject(null));
@@ -12512,20 +12569,20 @@ const _SlideDataModel = class _SlideDataModel extends UnitModel {
12512
12569
  __publicField(this, "name$");
12513
12570
  __publicField(this, "_snapshot");
12514
12571
  __publicField(this, "_unitId");
12515
- this._snapshot = { ...DEFAULT_SLIDE, ...snapshot }, this._unitId = (_a13 = this._snapshot.id) != null ? _a13 : Tools.generateRandomId(6), this._name$ = new BehaviorSubject(this._snapshot.title), this.name$ = this._name$.asObservable();
12572
+ this._snapshot = { ...DEFAULT_SLIDE, ...snapshot }, this._unitId = (_a11 = this._snapshot.id) != null ? _a11 : Tools.generateRandomId(6), this._name$ = new BehaviorSubject(this._snapshot.title), this.name$ = this._name$.asObservable();
12516
12573
  }
12517
12574
  get _activePage() {
12518
- var _a13, _b2;
12575
+ var _a11, _b2;
12519
12576
  const activePage = this._activePage$.getValue();
12520
12577
  if (!activePage) {
12521
- const activePageId = (_a13 = this.getPageOrder()) == null ? void 0 : _a13[0];
12578
+ const activePageId = (_a11 = this.getPageOrder()) == null ? void 0 : _a11[0];
12522
12579
  return activePageId ? (_b2 = this.getPages()) == null ? void 0 : _b2[activePageId] : null;
12523
12580
  }
12524
12581
  return activePage;
12525
12582
  }
12526
12583
  setName(name) {
12527
- var _a13;
12528
- this._snapshot.title = name, this._name$.next(name), this._unitId = (_a13 = this._snapshot.id) != null ? _a13 : generateRandomId(6);
12584
+ var _a11;
12585
+ this._snapshot.title = name, this._name$.next(name), this._unitId = (_a11 = this._snapshot.id) != null ? _a11 : generateRandomId(6);
12529
12586
  }
12530
12587
  getRev() {
12531
12588
  return 0;
@@ -12541,24 +12598,24 @@ const _SlideDataModel = class _SlideDataModel extends UnitModel {
12541
12598
  return this._unitId;
12542
12599
  }
12543
12600
  getPages() {
12544
- var _a13;
12545
- return (_a13 = this._snapshot.body) == null ? void 0 : _a13.pages;
12601
+ var _a11;
12602
+ return (_a11 = this._snapshot.body) == null ? void 0 : _a11.pages;
12546
12603
  }
12547
12604
  getPageOrder() {
12548
- var _a13;
12549
- return (_a13 = this._snapshot.body) == null ? void 0 : _a13.pageOrder;
12605
+ var _a11;
12606
+ return (_a11 = this._snapshot.body) == null ? void 0 : _a11.pageOrder;
12550
12607
  }
12551
12608
  getPage(pageId) {
12552
12609
  const pages = this.getPages();
12553
12610
  return pages == null ? void 0 : pages[pageId];
12554
12611
  }
12555
12612
  getElementsByPage(pageId) {
12556
- var _a13;
12557
- return (_a13 = this.getPage(pageId)) == null ? void 0 : _a13.pageElements;
12613
+ var _a11;
12614
+ return (_a11 = this.getPage(pageId)) == null ? void 0 : _a11.pageElements;
12558
12615
  }
12559
12616
  getElement(pageId, elementId) {
12560
- var _a13;
12561
- return (_a13 = this.getElementsByPage(pageId)) == null ? void 0 : _a13[elementId];
12617
+ var _a11;
12618
+ return (_a11 = this.getElementsByPage(pageId)) == null ? void 0 : _a11[elementId];
12562
12619
  }
12563
12620
  getPageSize() {
12564
12621
  return this._snapshot.pageSize;
@@ -12587,10 +12644,10 @@ const _SlideDataModel = class _SlideDataModel extends UnitModel {
12587
12644
  this._snapshot.body && (this._snapshot.body.pages[pageId] = page);
12588
12645
  }
12589
12646
  appendPage(page) {
12590
- var _a13;
12647
+ var _a11;
12591
12648
  if (!this._snapshot.body) return;
12592
12649
  this._snapshot.body.pages[page.id] = page;
12593
- const activePage = this._activePage, index2 = this._snapshot.body.pageOrder.indexOf((_a13 = activePage == null ? void 0 : activePage.id) != null ? _a13 : "");
12650
+ const activePage = this._activePage, index2 = this._snapshot.body.pageOrder.indexOf((_a11 = activePage == null ? void 0 : activePage.id) != null ? _a11 : "");
12594
12651
  this._snapshot.body.pageOrder.splice(index2 + 1, 0, page.id);
12595
12652
  }
12596
12653
  };
@@ -12602,8 +12659,8 @@ var __defProp$4 = Object.defineProperty, __getOwnPropDesc$4 = Object.getOwnPrope
12602
12659
  return kind && result && __defProp$4(target, key, result), result;
12603
12660
  }, "__decorateClass$4"), __decorateParam$4 = /* @__PURE__ */ __name((index2, decorator) => (target, key) => decorator(target, key, index2), "__decorateParam$4");
12604
12661
  const IUniverInstanceService = createIdentifier("univer.current");
12605
- var _a6;
12606
- let UniverInstanceService = (_a6 = class extends Disposable {
12662
+ var _a5;
12663
+ let UniverInstanceService = (_a5 = class extends Disposable {
12607
12664
  constructor(_injector, _contextService) {
12608
12665
  super();
12609
12666
  __publicField(this, "_unitsByType", /* @__PURE__ */ new Map());
@@ -12638,8 +12695,8 @@ let UniverInstanceService = (_a6 = class extends Disposable {
12638
12695
  }
12639
12696
  getCurrentTypeOfUnit$(type2) {
12640
12697
  return this.currentUnits$.pipe(map((units) => {
12641
- var _a13;
12642
- return (_a13 = units.get(type2)) != null ? _a13 : null;
12698
+ var _a11;
12699
+ return (_a11 = units.get(type2)) != null ? _a11 : null;
12643
12700
  }), distinctUntilChanged());
12644
12701
  }
12645
12702
  getCurrentUnitForType(type2) {
@@ -12661,20 +12718,20 @@ let UniverInstanceService = (_a6 = class extends Disposable {
12661
12718
  * @param unit The unit to be added.
12662
12719
  */
12663
12720
  __addUnit(unit, options) {
12664
- var _a13;
12721
+ var _a11;
12665
12722
  const type2 = unit.type;
12666
12723
  this._unitsByType.has(type2) || this._unitsByType.set(type2, []);
12667
12724
  const units = this._unitsByType.get(type2), newUnitId = unit.getUnitId();
12668
12725
  if (units.findIndex((u) => u.getUnitId() === newUnitId) !== -1)
12669
12726
  throw new Error(`[UniverInstanceService]: cannot create a unit with the same unit id: ${newUnitId}.`);
12670
- units.push(unit), this._unitAdded$.next(unit), ((_a13 = options == null ? void 0 : options.makeCurrent) == null || _a13) && this.setCurrentUnitForType(unit.getUnitId());
12727
+ units.push(unit), this._unitAdded$.next(unit), ((_a11 = options == null ? void 0 : options.makeCurrent) == null || _a11) && this.setCurrentUnitForType(unit.getUnitId());
12671
12728
  }
12672
12729
  getTypeOfUnitDisposed$(type2) {
12673
12730
  return this.unitDisposed$.pipe(filter((unit) => unit.type === type2));
12674
12731
  }
12675
12732
  getUnit(id, type2) {
12676
- var _a13;
12677
- const unit = (_a13 = this._getUnitById(id)) == null ? void 0 : _a13[0];
12733
+ var _a11;
12734
+ const unit = (_a11 = this._getUnitById(id)) == null ? void 0 : _a11[0];
12678
12735
  return type2 && (unit == null ? void 0 : unit.type) !== type2 ? null : unit;
12679
12736
  }
12680
12737
  getCurrentUniverDocInstance() {
@@ -12687,8 +12744,8 @@ let UniverInstanceService = (_a6 = class extends Disposable {
12687
12744
  return this.getUnit(unitId, I.UNIVER_SHEET);
12688
12745
  }
12689
12746
  getAllUnitsForType(type2) {
12690
- var _a13;
12691
- return (_a13 = this._unitsByType.get(type2)) != null ? _a13 : [];
12747
+ var _a11;
12748
+ return (_a11 = this._unitsByType.get(type2)) != null ? _a11 : [];
12692
12749
  }
12693
12750
  changeDoc(unitId, doc) {
12694
12751
  const allDocs = this.getAllUnitsForType(I.UNIVER_DOC), oldDoc = allDocs.find((doc2) => doc2.getUnitId() === unitId);
@@ -12699,9 +12756,9 @@ let UniverInstanceService = (_a6 = class extends Disposable {
12699
12756
  this.__addUnit(doc);
12700
12757
  }
12701
12758
  get focused() {
12702
- var _a13;
12759
+ var _a11;
12703
12760
  const id = this._focused$.getValue();
12704
- return id ? (_a13 = this._getUnitById(id)) == null ? void 0 : _a13[0] : null;
12761
+ return id ? (_a11 = this._getUnitById(id)) == null ? void 0 : _a11[0] : null;
12705
12762
  }
12706
12763
  focusUnit(id) {
12707
12764
  this._focused$.next(id), this.focused instanceof Workbook ? (this._contextService.setContextValue(FOCUSING_UNIT, !0), this._contextService.setContextValue(FOCUSING_DOC, !1), this._contextService.setContextValue(FOCUSING_SHEET, !0), this._contextService.setContextValue(FOCUSING_SLIDE, !1), this.setCurrentUnitForType(id)) : this.focused instanceof DocumentDataModel ? (this._contextService.setContextValue(FOCUSING_UNIT, !0), this._contextService.setContextValue(FOCUSING_DOC, !0), this._contextService.setContextValue(FOCUSING_SHEET, !1), this._contextService.setContextValue(FOCUSING_SLIDE, !1), this.setCurrentUnitForType(id)) : this.focused instanceof SlideDataModel ? (this._contextService.setContextValue(FOCUSING_UNIT, !0), this._contextService.setContextValue(FOCUSING_DOC, !1), this._contextService.setContextValue(FOCUSING_SHEET, !1), this._contextService.setContextValue(FOCUSING_SLIDE, !0), this.setCurrentUnitForType(id)) : (this._contextService.setContextValue(FOCUSING_UNIT, !1), this._contextService.setContextValue(FOCUSING_DOC, !1), this._contextService.setContextValue(FOCUSING_SHEET, !1), this._contextService.setContextValue(FOCUSING_SLIDE, !1));
@@ -12724,8 +12781,8 @@ let UniverInstanceService = (_a6 = class extends Disposable {
12724
12781
  (current == null ? void 0 : current.getUnitId()) === unitId && (this._currentUnits.set(type2, null), this._currentUnits$.next(this._currentUnits));
12725
12782
  }
12726
12783
  _tryBlurUnitOnRemoval(unitId) {
12727
- var _a13;
12728
- ((_a13 = this.focused) == null ? void 0 : _a13.getUnitId()) === unitId && this._focused$.next(null);
12784
+ var _a11;
12785
+ ((_a11 = this.focused) == null ? void 0 : _a11.getUnitId()) === unitId && this._focused$.next(null);
12729
12786
  }
12730
12787
  _getUnitById(unitId) {
12731
12788
  for (const [type2, units] of this._unitsByType) {
@@ -12734,17 +12791,24 @@ let UniverInstanceService = (_a6 = class extends Disposable {
12734
12791
  return [unit, type2];
12735
12792
  }
12736
12793
  }
12737
- }, __name(_a6, "UniverInstanceService"), _a6);
12794
+ }, __name(_a5, "UniverInstanceService"), _a5);
12738
12795
  UniverInstanceService = __decorateClass$4([
12739
12796
  __decorateParam$4(0, Inject(Injector)),
12740
12797
  __decorateParam$4(1, IContextService)
12741
12798
  ], UniverInstanceService);
12799
+ var LifecycleStages = /* @__PURE__ */ ((LifecycleStages2) => (LifecycleStages2[LifecycleStages2.Starting = 0] = "Starting", LifecycleStages2[LifecycleStages2.Ready = 1] = "Ready", LifecycleStages2[LifecycleStages2.Rendered = 2] = "Rendered", LifecycleStages2[LifecycleStages2.Steady = 3] = "Steady", LifecycleStages2))(LifecycleStages || {});
12800
+ const LifecycleNameMap = {
12801
+ 0: "Starting",
12802
+ 1: "Ready",
12803
+ 2: "Rendered",
12804
+ 3: "Steady"
12805
+ };
12742
12806
  var __defProp$3 = Object.defineProperty, __getOwnPropDesc$3 = Object.getOwnPropertyDescriptor, __decorateClass$3 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
12743
12807
  for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$3(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
12744
12808
  (decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
12745
12809
  return kind && result && __defProp$3(target, key, result), result;
12746
- }, "__decorateClass$3"), __decorateParam$3 = /* @__PURE__ */ __name((index2, decorator) => (target, key) => decorator(target, key, index2), "__decorateParam$3"), _a7;
12747
- let LifecycleService = (_a7 = class extends Disposable {
12810
+ }, "__decorateClass$3"), __decorateParam$3 = /* @__PURE__ */ __name((index2, decorator) => (target, key) => decorator(target, key, index2), "__decorateParam$3"), _a6;
12811
+ let LifecycleService = (_a6 = class extends Disposable {
12748
12812
  constructor(_logService) {
12749
12813
  super();
12750
12814
  __publicField(this, "_lifecycle$", new BehaviorSubject(LifecycleStages.Starting));
@@ -12774,27 +12838,10 @@ let LifecycleService = (_a7 = class extends Disposable {
12774
12838
  _reportProgress(stage) {
12775
12839
  this._logService.debug("[LifecycleService]", `lifecycle progressed to "${LifecycleNameMap[stage]}".`);
12776
12840
  }
12777
- }, __name(_a7, "LifecycleService"), _a7);
12841
+ }, __name(_a6, "LifecycleService"), _a6);
12778
12842
  LifecycleService = __decorateClass$3([
12779
12843
  __decorateParam$3(0, ILogService)
12780
12844
  ], LifecycleService);
12781
- var _a8;
12782
- let LifecycleInitializerService = (_a8 = class extends Disposable {
12783
- constructor(_injector) {
12784
- super();
12785
- __publicField(this, "_seenTokens", /* @__PURE__ */ new Set());
12786
- this._injector = _injector;
12787
- }
12788
- initModulesOnStage(stage) {
12789
- var _a13;
12790
- (_a13 = LifecycleToModules.get(stage)) == null || _a13.forEach((m) => {
12791
- this._injector.has(m) && !this._seenTokens.has(m) && (this._injector.get(m), this._seenTokens.add(m));
12792
- });
12793
- }
12794
- }, __name(_a8, "LifecycleInitializerService"), _a8);
12795
- LifecycleInitializerService = __decorateClass$3([
12796
- __decorateParam$3(0, Inject(Injector))
12797
- ], LifecycleInitializerService);
12798
12845
  function getLifecycleStagesAndBefore(lifecycleStage) {
12799
12846
  switch (lifecycleStage) {
12800
12847
  case LifecycleStages.Starting:
@@ -12867,15 +12914,15 @@ const ILocalStorageService = createIdentifier("ILocalStorageService"), _LocaleSe
12867
12914
  * @param locales - Locale object
12868
12915
  */
12869
12916
  load(locales) {
12870
- var _a13;
12871
- this._locales = Tools.deepMerge((_a13 = this._locales) != null ? _a13 : {}, locales);
12917
+ var _a11;
12918
+ this._locales = Tools.deepMerge((_a11 = this._locales) != null ? _a11 : {}, locales);
12872
12919
  }
12873
12920
  setLocale(locale) {
12874
12921
  this._currentLocale$.next(locale), this.localeChanged$.next();
12875
12922
  }
12876
12923
  getLocales() {
12877
- var _a13;
12878
- return (_a13 = this._locales) == null ? void 0 : _a13[this._currentLocale];
12924
+ var _a11;
12925
+ return (_a11 = this._locales) == null ? void 0 : _a11[this._currentLocale];
12879
12926
  }
12880
12927
  getCurrentLocale() {
12881
12928
  return this._currentLocale;
@@ -12892,9 +12939,7 @@ const ILocalStorageService = createIdentifier("ILocalStorageService"), _LocaleSe
12892
12939
  __name(_LocaleService, "LocaleService");
12893
12940
  let LocaleService = _LocaleService;
12894
12941
  var PermissionStatus = /* @__PURE__ */ ((PermissionStatus2) => (PermissionStatus2.INIT = "init", PermissionStatus2.FETCHING = "fetching", PermissionStatus2.DONE = "done", PermissionStatus2))(PermissionStatus || {});
12895
- const IPermissionService = createIdentifier("univer.permission-service");
12896
- runOnLifecycle(LifecycleStages.Starting, IPermissionService);
12897
- const _PermissionService = class _PermissionService extends Disposable {
12942
+ const IPermissionService = createIdentifier("univer.permission-service"), _PermissionService = class _PermissionService extends Disposable {
12898
12943
  constructor() {
12899
12944
  super(...arguments);
12900
12945
  __publicField(this, "_permissionPointMap", /* @__PURE__ */ new Map());
@@ -12935,8 +12980,8 @@ const _PermissionService = class _PermissionService extends Disposable {
12935
12980
  }
12936
12981
  composePermission$(permissionIdList) {
12937
12982
  const subjectList = permissionIdList.map((id) => {
12938
- var _a13;
12939
- const subject = (_a13 = this._permissionPointMap) == null ? void 0 : _a13.get(id);
12983
+ var _a11;
12984
+ const subject = (_a11 = this._permissionPointMap) == null ? void 0 : _a11.get(id);
12940
12985
  if (!subject)
12941
12986
  throw new Error(`[PermissionService]: ${id} permissionPoint does not exist!`);
12942
12987
  return subject.asObservable();
@@ -12948,8 +12993,8 @@ const _PermissionService = class _PermissionService extends Disposable {
12948
12993
  }
12949
12994
  composePermission(permissionIdList) {
12950
12995
  return permissionIdList.map((id) => {
12951
- var _a13;
12952
- const subject = (_a13 = this._permissionPointMap) == null ? void 0 : _a13.get(id);
12996
+ var _a11;
12997
+ const subject = (_a11 = this._permissionPointMap) == null ? void 0 : _a11.get(id);
12953
12998
  if (!subject)
12954
12999
  throw new Error(`[PermissionService]: ${id} permissionPoint does not exist!`);
12955
13000
  return subject.getValue();
@@ -12965,7 +13010,7 @@ const _PermissionService = class _PermissionService extends Disposable {
12965
13010
  __name(_PermissionService, "PermissionService");
12966
13011
  let PermissionService = _PermissionService;
12967
13012
  const DependentOnSymbol = Symbol("DependentOn"), _Plugin = class _Plugin extends Disposable {
12968
- onStarting(_injector) {
13013
+ onStarting() {
12969
13014
  }
12970
13015
  onReady() {
12971
13016
  }
@@ -13028,8 +13073,8 @@ function DependentOn(...plugins) {
13028
13073
  };
13029
13074
  }
13030
13075
  __name(DependentOn, "DependentOn");
13031
- var _a9;
13032
- let PluginService = (_a9 = class {
13076
+ var _a7;
13077
+ let PluginService = (_a7 = class {
13033
13078
  constructor(_injector) {
13034
13079
  __publicField(this, "_pluginHolderForUniver");
13035
13080
  __publicField(this, "_pluginHoldersForTypes", /* @__PURE__ */ new Map());
@@ -13039,7 +13084,7 @@ let PluginService = (_a9 = class {
13039
13084
  PluginHolder,
13040
13085
  this._checkPluginSeen.bind(this),
13041
13086
  this._immediateInitPlugin.bind(this)
13042
- ), this._pluginHolderForUniver.start();
13087
+ ), this._pluginHoldersForTypes.set(I.UNIVER_UNKNOWN, this._pluginHolderForUniver), this._pluginHolderForUniver.start();
13043
13088
  }
13044
13089
  dispose() {
13045
13090
  this._clearFlushTimer();
@@ -13099,13 +13144,13 @@ let PluginService = (_a9 = class {
13099
13144
  for (const [_, holder] of this._pluginHoldersForTypes)
13100
13145
  holder.started && holder.flush();
13101
13146
  }
13102
- }, __name(_a9, "PluginService"), _a9);
13147
+ }, __name(_a7, "PluginService"), _a7);
13103
13148
  PluginService = __decorateClass$2([
13104
13149
  __decorateParam$2(0, Inject(Injector))
13105
13150
  ], PluginService);
13106
- var _a10;
13107
- let PluginHolder = (_a10 = class extends Disposable {
13108
- constructor(_checkPluginRegistered, _registerPlugin, _logService, _injector, _lifecycleService, _lifecycleInitializerService) {
13151
+ var _a8;
13152
+ let PluginHolder = (_a8 = class extends Disposable {
13153
+ constructor(_checkPluginRegistered, _registerPlugin, _logService, _injector, _lifecycleService) {
13109
13154
  super();
13110
13155
  __publicField(this, "_started", !1);
13111
13156
  __publicField(this, "_warnedAboutOnStartingDeprecation", !1);
@@ -13113,16 +13158,17 @@ let PluginHolder = (_a10 = class extends Disposable {
13113
13158
  __publicField(this, "_pluginRegistry", new PluginRegistry());
13114
13159
  /** Stores initialized plugin instances. */
13115
13160
  __publicField(this, "_pluginStore", new PluginStore());
13116
- __publicField(this, "_awaitingPlugins", []);
13117
- this._checkPluginRegistered = _checkPluginRegistered, this._registerPlugin = _registerPlugin, this._logService = _logService, this._injector = _injector, this._lifecycleService = _lifecycleService, this._lifecycleInitializerService = _lifecycleInitializerService, this.disposeWithMe(this._lifecycleService.lifecycle$.pipe(skip(1)).subscribe((stage) => {
13118
- this._awaitingPlugins.forEach((plugins) => this._runStage(plugins, stage));
13161
+ /** Plugins instances as they are registered in batches. */
13162
+ __publicField(this, "_pluginsInBatches", []);
13163
+ this._checkPluginRegistered = _checkPluginRegistered, this._registerPlugin = _registerPlugin, this._logService = _logService, this._injector = _injector, this._lifecycleService = _lifecycleService, this.disposeWithMe(this._lifecycleService.lifecycle$.pipe(skip(1)).subscribe((stage) => {
13164
+ this._pluginsInBatches.forEach((plugins) => this._runStage(plugins, stage));
13119
13165
  }));
13120
13166
  }
13121
13167
  get started() {
13122
13168
  return this._started;
13123
13169
  }
13124
13170
  dispose() {
13125
- super.dispose(), this._pluginStore.forEachPlugin((plugin) => plugin.dispose()), this._pluginStore.removePlugins(), this._pluginRegistry.removePlugins(), this._awaitingPlugins.length = 0;
13171
+ super.dispose(), this._pluginStore.forEachPlugin((plugin) => plugin.dispose()), this._pluginStore.removePlugins(), this._pluginRegistry.removePlugins(), this._pluginsInBatches.length = 0;
13126
13172
  }
13127
13173
  register(pluginCtor, config) {
13128
13174
  this._pluginRegistry.registerPlugin(pluginCtor, config);
@@ -13160,17 +13206,13 @@ let PluginHolder = (_a10 = class extends Disposable {
13160
13206
  // Here we should be careful with the sequence of which plugin should run first. We should manually add a queue here.
13161
13207
  // Because lately registered plugins may get executed first.
13162
13208
  _pluginsRunLifecycle(plugins) {
13163
- getLifecycleStagesAndBefore(this._lifecycleService.stage).subscribe((stage) => this._runStage(plugins, stage)), this._awaitingPlugins.push(plugins);
13209
+ getLifecycleStagesAndBefore(this._lifecycleService.stage).subscribe((stage) => this._runStage(plugins, stage)), this._pluginsInBatches.push(plugins);
13164
13210
  }
13165
13211
  _runStage(plugins, stage) {
13166
13212
  plugins.forEach((p) => {
13167
13213
  switch (stage) {
13168
13214
  case LifecycleStages.Starting:
13169
- p.onStarting.length > 0 && p.onStarting !== Plugin.prototype.onStarting && !this._warnedAboutOnStartingDeprecation && (this._logService.warn(
13170
- "[PluginService]",
13171
- p.onStarting.length,
13172
- `Plugin "${p.getPluginName()}" is using deprecated "onStarting" method with arguments. Please use "this._injector" instead.`
13173
- ), this._warnedAboutOnStartingDeprecation = !0), p.onStarting(this._injector);
13215
+ p.onStarting();
13174
13216
  break;
13175
13217
  case LifecycleStages.Ready:
13176
13218
  p.onReady();
@@ -13182,14 +13224,13 @@ let PluginHolder = (_a10 = class extends Disposable {
13182
13224
  p.onSteady();
13183
13225
  break;
13184
13226
  }
13185
- }), this._lifecycleInitializerService.initModulesOnStage(stage);
13227
+ });
13186
13228
  }
13187
- }, __name(_a10, "PluginHolder"), _a10);
13229
+ }, __name(_a8, "PluginHolder"), _a8);
13188
13230
  PluginHolder = __decorateClass$2([
13189
13231
  __decorateParam$2(2, ILogService),
13190
13232
  __decorateParam$2(3, Inject(Injector)),
13191
- __decorateParam$2(4, Inject(LifecycleService)),
13192
- __decorateParam$2(5, Inject(LifecycleInitializerService))
13233
+ __decorateParam$2(4, Inject(LifecycleService))
13193
13234
  ], PluginHolder);
13194
13235
  function mergeOverrideWithDependencies(dependencies, override) {
13195
13236
  if (!override) return dependencies;
@@ -13205,9 +13246,7 @@ function mergeOverrideWithDependencies(dependencies, override) {
13205
13246
  return result;
13206
13247
  }
13207
13248
  __name(mergeOverrideWithDependencies, "mergeOverrideWithDependencies");
13208
- const IResourceLoaderService = createIdentifier("resource-loader-service");
13209
- runOnLifecycle(LifecycleStages.Ready, IResourceLoaderService);
13210
- const _ResourceManagerService = class _ResourceManagerService extends Disposable {
13249
+ const IResourceLoaderService = createIdentifier("resource-loader-service"), _ResourceManagerService = class _ResourceManagerService extends Disposable {
13211
13250
  constructor() {
13212
13251
  super(...arguments);
13213
13252
  __publicField(this, "_resourceMap", /* @__PURE__ */ new Map());
@@ -13246,8 +13285,8 @@ const _ResourceManagerService = class _ResourceManagerService extends Disposable
13246
13285
  }
13247
13286
  loadResources(unitId, resources) {
13248
13287
  this.getAllResourceHooks().forEach((hook) => {
13249
- var _a13;
13250
- const data = (_a13 = resources == null ? void 0 : resources.find((resource) => resource.name === hook.pluginName)) == null ? void 0 : _a13.data;
13288
+ var _a11;
13289
+ const data = (_a11 = resources == null ? void 0 : resources.find((resource) => resource.name === hook.pluginName)) == null ? void 0 : _a11.data;
13251
13290
  if (data)
13252
13291
  try {
13253
13292
  const model = hook.parseJson(data);
@@ -13328,8 +13367,8 @@ const RedoCommandId = "univer.command.redo", UndoCommandId = "univer.command.und
13328
13367
  return sequenceExecute(element.redoMutations, commandService) ? (undoRedoService.popRedoToUndo(), !0) : !1;
13329
13368
  }
13330
13369
  }();
13331
- var _a11;
13332
- let LocalUndoRedoService = (_a11 = class extends Disposable {
13370
+ var _a9;
13371
+ let LocalUndoRedoService = (_a9 = class extends Disposable {
13333
13372
  constructor(_univerInstanceService, _commandService, _contextService) {
13334
13373
  super();
13335
13374
  __publicField(this, "undoRedoStatus$");
@@ -13396,8 +13435,8 @@ let LocalUndoRedoService = (_a11 = class extends Disposable {
13396
13435
  ), toDisposable(() => this._batchingStatus.delete(unitId));
13397
13436
  }
13398
13437
  _updateStatus() {
13399
- var _a13, _b2;
13400
- const unitID = this._getFocusedUnitId(), undos = unitID && ((_a13 = this._undoStacks.get(unitID)) == null ? void 0 : _a13.length) || 0, redos = unitID && ((_b2 = this._redoStacks.get(unitID)) == null ? void 0 : _b2.length) || 0;
13438
+ var _a11, _b2;
13439
+ const unitID = this._getFocusedUnitId(), undos = unitID && ((_a11 = this._undoStacks.get(unitID)) == null ? void 0 : _a11.length) || 0, redos = unitID && ((_b2 = this._redoStacks.get(unitID)) == null ? void 0 : _b2.length) || 0;
13401
13440
  this._undoRedoStatus$.next({
13402
13441
  undos,
13403
13442
  redos
@@ -13427,12 +13466,12 @@ let LocalUndoRedoService = (_a11 = class extends Disposable {
13427
13466
  item.redoMutations.push(...newItem.redoMutations), item.undoMutations.push(...newItem.undoMutations);
13428
13467
  }
13429
13468
  _getFocusedUnitId() {
13430
- var _a13, _b2, _c, _d;
13469
+ var _a11, _b2, _c, _d;
13431
13470
  let unitID = "";
13432
13471
  const isFocusSheet = this._contextService.getContextValue(FOCUSING_SHEET), isFocusFormulaEditor = this._contextService.getContextValue(FOCUSING_FX_BAR_EDITOR), isFocusEditor = this._contextService.getContextValue(EDITOR_ACTIVATED);
13433
- return isFocusSheet ? isFocusFormulaEditor ? unitID = DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY : isFocusEditor ? unitID = DOCS_NORMAL_EDITOR_UNIT_ID_KEY : unitID = (_b2 = (_a13 = this._univerInstanceService.getFocusedUnit()) == null ? void 0 : _a13.getUnitId()) != null ? _b2 : "" : unitID = (_d = (_c = this._univerInstanceService.getFocusedUnit()) == null ? void 0 : _c.getUnitId()) != null ? _d : "", unitID;
13472
+ return isFocusSheet ? isFocusFormulaEditor ? unitID = DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY : isFocusEditor ? unitID = DOCS_NORMAL_EDITOR_UNIT_ID_KEY : unitID = (_b2 = (_a11 = this._univerInstanceService.getFocusedUnit()) == null ? void 0 : _a11.getUnitId()) != null ? _b2 : "" : unitID = (_d = (_c = this._univerInstanceService.getFocusedUnit()) == null ? void 0 : _c.getUnitId()) != null ? _d : "", unitID;
13434
13473
  }
13435
- }, __name(_a11, "LocalUndoRedoService"), _a11);
13474
+ }, __name(_a9, "LocalUndoRedoService"), _a9);
13436
13475
  LocalUndoRedoService = __decorateClass$1([
13437
13476
  __decorateParam$1(0, IUniverInstanceService),
13438
13477
  __decorateParam$1(1, ICommandService),
@@ -13450,12 +13489,405 @@ const isRangesEqual = /* @__PURE__ */ __name((oldRanges, ranges) => ranges.lengt
13450
13489
  const current = ranges[i];
13451
13490
  return current.unitId === oldRange.unitId && current.sheetId === oldRange.sheetId && Rectangle.equals(oldRange.range, current.range);
13452
13491
  }), "isUnitRangesEqual"), skipParseTagNames = ["script", "style", "meta", "comment", "link"];
13453
- var DataValidationErrorStyle = /* @__PURE__ */ ((DataValidationErrorStyle2) => (DataValidationErrorStyle2[DataValidationErrorStyle2.INFO = 0] = "INFO", DataValidationErrorStyle2[DataValidationErrorStyle2.STOP = 1] = "STOP", DataValidationErrorStyle2[DataValidationErrorStyle2.WARNING = 2] = "WARNING", DataValidationErrorStyle2))(DataValidationErrorStyle || {}), DataValidationImeMode = /* @__PURE__ */ ((DataValidationImeMode2) => (DataValidationImeMode2[DataValidationImeMode2.DISABLED = 0] = "DISABLED", DataValidationImeMode2[DataValidationImeMode2.FULL_ALPHA = 1] = "FULL_ALPHA", DataValidationImeMode2[DataValidationImeMode2.FULL_HANGUL = 2] = "FULL_HANGUL", DataValidationImeMode2[DataValidationImeMode2.FULL_KATAKANA = 3] = "FULL_KATAKANA", DataValidationImeMode2[DataValidationImeMode2.HALF_ALPHA = 4] = "HALF_ALPHA", DataValidationImeMode2[DataValidationImeMode2.HALF_HANGUL = 5] = "HALF_HANGUL", DataValidationImeMode2[DataValidationImeMode2.HALF_KATAKANA = 6] = "HALF_KATAKANA", DataValidationImeMode2[DataValidationImeMode2.HIRAGANA = 7] = "HIRAGANA", DataValidationImeMode2[DataValidationImeMode2.NO_CONTROL = 8] = "NO_CONTROL", DataValidationImeMode2[DataValidationImeMode2.OFF = 9] = "OFF", DataValidationImeMode2[DataValidationImeMode2.ON = 10] = "ON", DataValidationImeMode2))(DataValidationImeMode || {}), DataValidationOperator = /* @__PURE__ */ ((DataValidationOperator2) => (DataValidationOperator2.BETWEEN = "between", DataValidationOperator2.EQUAL = "equal", DataValidationOperator2.GREATER_THAN = "greaterThan", DataValidationOperator2.GREATER_THAN_OR_EQUAL = "greaterThanOrEqual", DataValidationOperator2.LESS_THAN = "lessThan", DataValidationOperator2.LESS_THAN_OR_EQUAL = "lessThanOrEqual", DataValidationOperator2.NOT_BETWEEN = "notBetween", DataValidationOperator2.NOT_EQUAL = "notEqual", DataValidationOperator2))(DataValidationOperator || {}), DataValidationRenderMode = /* @__PURE__ */ ((DataValidationRenderMode2) => (DataValidationRenderMode2[DataValidationRenderMode2.TEXT = 0] = "TEXT", DataValidationRenderMode2[DataValidationRenderMode2.ARROW = 1] = "ARROW", DataValidationRenderMode2[DataValidationRenderMode2.CUSTOM = 2] = "CUSTOM", DataValidationRenderMode2))(DataValidationRenderMode || {}), DataValidationStatus = /* @__PURE__ */ ((DataValidationStatus2) => (DataValidationStatus2.VALID = "valid", DataValidationStatus2.INVALID = "invalid", DataValidationStatus2.VALIDATING = "validating", DataValidationStatus2))(DataValidationStatus || {}), DataValidationType = /* @__PURE__ */ ((DataValidationType2) => (DataValidationType2.CUSTOM = "custom", DataValidationType2.LIST = "list", DataValidationType2.LIST_MULTIPLE = "listMultiple", DataValidationType2.NONE = "none", DataValidationType2.TEXT_LENGTH = "textLength", DataValidationType2.DATE = "date", DataValidationType2.TIME = "time", DataValidationType2.WHOLE = "whole", DataValidationType2.DECIMAL = "decimal", DataValidationType2.CHECKBOX = "checkbox", DataValidationType2))(DataValidationType || {}), __defProp2 = Object.defineProperty, __getOwnPropDesc = Object.getOwnPropertyDescriptor, __decorateClass = /* @__PURE__ */ __name((decorators, target, key, kind) => {
13492
+ var DataValidationErrorStyle = /* @__PURE__ */ ((DataValidationErrorStyle2) => (DataValidationErrorStyle2[DataValidationErrorStyle2.INFO = 0] = "INFO", DataValidationErrorStyle2[DataValidationErrorStyle2.STOP = 1] = "STOP", DataValidationErrorStyle2[DataValidationErrorStyle2.WARNING = 2] = "WARNING", DataValidationErrorStyle2))(DataValidationErrorStyle || {}), DataValidationImeMode = /* @__PURE__ */ ((DataValidationImeMode2) => (DataValidationImeMode2[DataValidationImeMode2.DISABLED = 0] = "DISABLED", DataValidationImeMode2[DataValidationImeMode2.FULL_ALPHA = 1] = "FULL_ALPHA", DataValidationImeMode2[DataValidationImeMode2.FULL_HANGUL = 2] = "FULL_HANGUL", DataValidationImeMode2[DataValidationImeMode2.FULL_KATAKANA = 3] = "FULL_KATAKANA", DataValidationImeMode2[DataValidationImeMode2.HALF_ALPHA = 4] = "HALF_ALPHA", DataValidationImeMode2[DataValidationImeMode2.HALF_HANGUL = 5] = "HALF_HANGUL", DataValidationImeMode2[DataValidationImeMode2.HALF_KATAKANA = 6] = "HALF_KATAKANA", DataValidationImeMode2[DataValidationImeMode2.HIRAGANA = 7] = "HIRAGANA", DataValidationImeMode2[DataValidationImeMode2.NO_CONTROL = 8] = "NO_CONTROL", DataValidationImeMode2[DataValidationImeMode2.OFF = 9] = "OFF", DataValidationImeMode2[DataValidationImeMode2.ON = 10] = "ON", DataValidationImeMode2))(DataValidationImeMode || {}), DataValidationOperator = /* @__PURE__ */ ((DataValidationOperator2) => (DataValidationOperator2.BETWEEN = "between", DataValidationOperator2.EQUAL = "equal", DataValidationOperator2.GREATER_THAN = "greaterThan", DataValidationOperator2.GREATER_THAN_OR_EQUAL = "greaterThanOrEqual", DataValidationOperator2.LESS_THAN = "lessThan", DataValidationOperator2.LESS_THAN_OR_EQUAL = "lessThanOrEqual", DataValidationOperator2.NOT_BETWEEN = "notBetween", DataValidationOperator2.NOT_EQUAL = "notEqual", DataValidationOperator2))(DataValidationOperator || {}), DataValidationRenderMode = /* @__PURE__ */ ((DataValidationRenderMode2) => (DataValidationRenderMode2[DataValidationRenderMode2.TEXT = 0] = "TEXT", DataValidationRenderMode2[DataValidationRenderMode2.ARROW = 1] = "ARROW", DataValidationRenderMode2[DataValidationRenderMode2.CUSTOM = 2] = "CUSTOM", DataValidationRenderMode2))(DataValidationRenderMode || {}), DataValidationStatus = /* @__PURE__ */ ((DataValidationStatus2) => (DataValidationStatus2.VALID = "valid", DataValidationStatus2.INVALID = "invalid", DataValidationStatus2.VALIDATING = "validating", DataValidationStatus2))(DataValidationStatus || {}), DataValidationType = /* @__PURE__ */ ((DataValidationType2) => (DataValidationType2.CUSTOM = "custom", DataValidationType2.LIST = "list", DataValidationType2.LIST_MULTIPLE = "listMultiple", DataValidationType2.NONE = "none", DataValidationType2.TEXT_LENGTH = "textLength", DataValidationType2.DATE = "date", DataValidationType2.TIME = "time", DataValidationType2.WHOLE = "whole", DataValidationType2.DECIMAL = "decimal", DataValidationType2.CHECKBOX = "checkbox", DataValidationType2))(DataValidationType || {});
13493
+ function quickselect(arr, k, left = 0, right = arr.length - 1, compare = defaultCompare) {
13494
+ for (; right > left; ) {
13495
+ if (right - left > 600) {
13496
+ const n = right - left + 1, m = k - left + 1, z = Math.log(n), s = 0.5 * Math.exp(2 * z / 3), sd = 0.5 * Math.sqrt(z * s * (n - s) / n) * (m - n / 2 < 0 ? -1 : 1), newLeft = Math.max(left, Math.floor(k - m * s / n + sd)), newRight = Math.min(right, Math.floor(k + (n - m) * s / n + sd));
13497
+ quickselect(arr, k, newLeft, newRight, compare);
13498
+ }
13499
+ const t = arr[k];
13500
+ let i = left, j = right;
13501
+ for (swap(arr, left, k), compare(arr[right], t) > 0 && swap(arr, left, right); i < j; ) {
13502
+ for (swap(arr, i, j), i++, j--; compare(arr[i], t) < 0; ) i++;
13503
+ for (; compare(arr[j], t) > 0; ) j--;
13504
+ }
13505
+ compare(arr[left], t) === 0 ? swap(arr, left, j) : (j++, swap(arr, j, right)), j <= k && (left = j + 1), k <= j && (right = j - 1);
13506
+ }
13507
+ }
13508
+ __name(quickselect, "quickselect");
13509
+ function swap(arr, i, j) {
13510
+ const tmp = arr[i];
13511
+ arr[i] = arr[j], arr[j] = tmp;
13512
+ }
13513
+ __name(swap, "swap");
13514
+ function defaultCompare(a, b) {
13515
+ return a < b ? -1 : a > b ? 1 : 0;
13516
+ }
13517
+ __name(defaultCompare, "defaultCompare");
13518
+ const _RBush = class _RBush {
13519
+ constructor(maxEntries = 9) {
13520
+ this._maxEntries = Math.max(4, maxEntries), this._minEntries = Math.max(2, Math.ceil(this._maxEntries * 0.4)), this.clear();
13521
+ }
13522
+ all() {
13523
+ return this._all(this.data, []);
13524
+ }
13525
+ search(bbox) {
13526
+ let node = this.data;
13527
+ const result = [];
13528
+ if (!intersects(bbox, node)) return result;
13529
+ const toBBox = this.toBBox, nodesToSearch = [];
13530
+ for (; node; ) {
13531
+ for (let i = 0; i < node.children.length; i++) {
13532
+ const child = node.children[i], childBBox = node.leaf ? toBBox(child) : child;
13533
+ intersects(bbox, childBBox) && (node.leaf ? result.push(child) : contains(bbox, childBBox) ? this._all(child, result) : nodesToSearch.push(child));
13534
+ }
13535
+ node = nodesToSearch.pop();
13536
+ }
13537
+ return result;
13538
+ }
13539
+ collides(bbox) {
13540
+ let node = this.data;
13541
+ if (!intersects(bbox, node)) return !1;
13542
+ const nodesToSearch = [];
13543
+ for (; node; ) {
13544
+ for (let i = 0; i < node.children.length; i++) {
13545
+ const child = node.children[i], childBBox = node.leaf ? this.toBBox(child) : child;
13546
+ if (intersects(bbox, childBBox)) {
13547
+ if (node.leaf || contains(bbox, childBBox)) return !0;
13548
+ nodesToSearch.push(child);
13549
+ }
13550
+ }
13551
+ node = nodesToSearch.pop();
13552
+ }
13553
+ return !1;
13554
+ }
13555
+ load(data) {
13556
+ if (!(data && data.length)) return this;
13557
+ if (data.length < this._minEntries) {
13558
+ for (let i = 0; i < data.length; i++)
13559
+ this.insert(data[i]);
13560
+ return this;
13561
+ }
13562
+ let node = this._build(data.slice(), 0, data.length - 1, 0);
13563
+ if (!this.data.children.length)
13564
+ this.data = node;
13565
+ else if (this.data.height === node.height)
13566
+ this._splitRoot(this.data, node);
13567
+ else {
13568
+ if (this.data.height < node.height) {
13569
+ const tmpNode = this.data;
13570
+ this.data = node, node = tmpNode;
13571
+ }
13572
+ this._insert(node, this.data.height - node.height - 1, !0);
13573
+ }
13574
+ return this;
13575
+ }
13576
+ insert(item) {
13577
+ return item && this._insert(item, this.data.height - 1), this;
13578
+ }
13579
+ clear() {
13580
+ return this.data = createNode([]), this;
13581
+ }
13582
+ remove(item, equalsFn) {
13583
+ if (!item) return this;
13584
+ let node = this.data;
13585
+ const bbox = this.toBBox(item), path = [], indexes = [];
13586
+ let i, parent, goingUp;
13587
+ for (; node || path.length; ) {
13588
+ if (node || (node = path.pop(), parent = path[path.length - 1], i = indexes.pop(), goingUp = !0), node.leaf) {
13589
+ const index2 = findItem(item, node.children, equalsFn);
13590
+ if (index2 !== -1)
13591
+ return node.children.splice(index2, 1), path.push(node), this._condense(path), this;
13592
+ }
13593
+ !goingUp && !node.leaf && contains(node, bbox) ? (path.push(node), indexes.push(i), i = 0, parent = node, node = node.children[0]) : parent ? (i++, node = parent.children[i], goingUp = !1) : node = null;
13594
+ }
13595
+ return this;
13596
+ }
13597
+ toBBox(item) {
13598
+ return item;
13599
+ }
13600
+ compareMinX(a, b) {
13601
+ return a.minX - b.minX;
13602
+ }
13603
+ compareMinY(a, b) {
13604
+ return a.minY - b.minY;
13605
+ }
13606
+ toJSON() {
13607
+ return this.data;
13608
+ }
13609
+ fromJSON(data) {
13610
+ return this.data = data, this;
13611
+ }
13612
+ _all(node, result) {
13613
+ const nodesToSearch = [];
13614
+ for (; node; )
13615
+ node.leaf ? result.push(...node.children) : nodesToSearch.push(...node.children), node = nodesToSearch.pop();
13616
+ return result;
13617
+ }
13618
+ _build(items, left, right, height) {
13619
+ const N = right - left + 1;
13620
+ let M = this._maxEntries, node;
13621
+ if (N <= M)
13622
+ return node = createNode(items.slice(left, right + 1)), calcBBox(node, this.toBBox), node;
13623
+ height || (height = Math.ceil(Math.log(N) / Math.log(M)), M = Math.ceil(N / Math.pow(M, height - 1))), node = createNode([]), node.leaf = !1, node.height = height;
13624
+ const N2 = Math.ceil(N / M), N1 = N2 * Math.ceil(Math.sqrt(M));
13625
+ multiSelect(items, left, right, N1, this.compareMinX);
13626
+ for (let i = left; i <= right; i += N1) {
13627
+ const right2 = Math.min(i + N1 - 1, right);
13628
+ multiSelect(items, i, right2, N2, this.compareMinY);
13629
+ for (let j = i; j <= right2; j += N2) {
13630
+ const right3 = Math.min(j + N2 - 1, right2);
13631
+ node.children.push(this._build(items, j, right3, height - 1));
13632
+ }
13633
+ }
13634
+ return calcBBox(node, this.toBBox), node;
13635
+ }
13636
+ _chooseSubtree(bbox, node, level, path) {
13637
+ for (; path.push(node), !(node.leaf || path.length - 1 === level); ) {
13638
+ let minArea = 1 / 0, minEnlargement = 1 / 0, targetNode;
13639
+ for (let i = 0; i < node.children.length; i++) {
13640
+ const child = node.children[i], area = bboxArea(child), enlargement = enlargedArea(bbox, child) - area;
13641
+ enlargement < minEnlargement ? (minEnlargement = enlargement, minArea = area < minArea ? area : minArea, targetNode = child) : enlargement === minEnlargement && area < minArea && (minArea = area, targetNode = child);
13642
+ }
13643
+ node = targetNode || node.children[0];
13644
+ }
13645
+ return node;
13646
+ }
13647
+ _insert(item, level, isNode2) {
13648
+ const bbox = isNode2 ? item : this.toBBox(item), insertPath = [], node = this._chooseSubtree(bbox, this.data, level, insertPath);
13649
+ for (node.children.push(item), extend(node, bbox); level >= 0 && insertPath[level].children.length > this._maxEntries; )
13650
+ this._split(insertPath, level), level--;
13651
+ this._adjustParentBBoxes(bbox, insertPath, level);
13652
+ }
13653
+ // split overflowed node into two
13654
+ _split(insertPath, level) {
13655
+ const node = insertPath[level], M = node.children.length, m = this._minEntries;
13656
+ this._chooseSplitAxis(node, m, M);
13657
+ const splitIndex = this._chooseSplitIndex(node, m, M), newNode = createNode(node.children.splice(splitIndex, node.children.length - splitIndex));
13658
+ newNode.height = node.height, newNode.leaf = node.leaf, calcBBox(node, this.toBBox), calcBBox(newNode, this.toBBox), level ? insertPath[level - 1].children.push(newNode) : this._splitRoot(node, newNode);
13659
+ }
13660
+ _splitRoot(node, newNode) {
13661
+ this.data = createNode([node, newNode]), this.data.height = node.height + 1, this.data.leaf = !1, calcBBox(this.data, this.toBBox);
13662
+ }
13663
+ _chooseSplitIndex(node, m, M) {
13664
+ let index2, minOverlap = 1 / 0, minArea = 1 / 0;
13665
+ for (let i = m; i <= M - m; i++) {
13666
+ const bbox1 = distBBox(node, 0, i, this.toBBox), bbox2 = distBBox(node, i, M, this.toBBox), overlap = intersectionArea(bbox1, bbox2), area = bboxArea(bbox1) + bboxArea(bbox2);
13667
+ overlap < minOverlap ? (minOverlap = overlap, index2 = i, minArea = area < minArea ? area : minArea) : overlap === minOverlap && area < minArea && (minArea = area, index2 = i);
13668
+ }
13669
+ return index2 || M - m;
13670
+ }
13671
+ // sorts node children by the best axis for split
13672
+ _chooseSplitAxis(node, m, M) {
13673
+ const compareMinX = node.leaf ? this.compareMinX : compareNodeMinX, compareMinY = node.leaf ? this.compareMinY : compareNodeMinY, xMargin = this._allDistMargin(node, m, M, compareMinX), yMargin = this._allDistMargin(node, m, M, compareMinY);
13674
+ xMargin < yMargin && node.children.sort(compareMinX);
13675
+ }
13676
+ // total margin of all possible split distributions where each node is at least m full
13677
+ _allDistMargin(node, m, M, compare) {
13678
+ node.children.sort(compare);
13679
+ const toBBox = this.toBBox, leftBBox = distBBox(node, 0, m, toBBox), rightBBox = distBBox(node, M - m, M, toBBox);
13680
+ let margin = bboxMargin(leftBBox) + bboxMargin(rightBBox);
13681
+ for (let i = m; i < M - m; i++) {
13682
+ const child = node.children[i];
13683
+ extend(leftBBox, node.leaf ? toBBox(child) : child), margin += bboxMargin(leftBBox);
13684
+ }
13685
+ for (let i = M - m - 1; i >= m; i--) {
13686
+ const child = node.children[i];
13687
+ extend(rightBBox, node.leaf ? toBBox(child) : child), margin += bboxMargin(rightBBox);
13688
+ }
13689
+ return margin;
13690
+ }
13691
+ _adjustParentBBoxes(bbox, path, level) {
13692
+ for (let i = level; i >= 0; i--)
13693
+ extend(path[i], bbox);
13694
+ }
13695
+ _condense(path) {
13696
+ for (let i = path.length - 1, siblings; i >= 0; i--)
13697
+ path[i].children.length === 0 ? i > 0 ? (siblings = path[i - 1].children, siblings.splice(siblings.indexOf(path[i]), 1)) : this.clear() : calcBBox(path[i], this.toBBox);
13698
+ }
13699
+ };
13700
+ __name(_RBush, "RBush");
13701
+ let RBush = _RBush;
13702
+ function findItem(item, items, equalsFn) {
13703
+ if (!equalsFn) return items.indexOf(item);
13704
+ for (let i = 0; i < items.length; i++)
13705
+ if (equalsFn(item, items[i])) return i;
13706
+ return -1;
13707
+ }
13708
+ __name(findItem, "findItem");
13709
+ function calcBBox(node, toBBox) {
13710
+ distBBox(node, 0, node.children.length, toBBox, node);
13711
+ }
13712
+ __name(calcBBox, "calcBBox");
13713
+ function distBBox(node, k, p, toBBox, destNode) {
13714
+ destNode || (destNode = createNode(null)), destNode.minX = 1 / 0, destNode.minY = 1 / 0, destNode.maxX = -1 / 0, destNode.maxY = -1 / 0;
13715
+ for (let i = k; i < p; i++) {
13716
+ const child = node.children[i];
13717
+ extend(destNode, node.leaf ? toBBox(child) : child);
13718
+ }
13719
+ return destNode;
13720
+ }
13721
+ __name(distBBox, "distBBox");
13722
+ function extend(a, b) {
13723
+ return a.minX = Math.min(a.minX, b.minX), a.minY = Math.min(a.minY, b.minY), a.maxX = Math.max(a.maxX, b.maxX), a.maxY = Math.max(a.maxY, b.maxY), a;
13724
+ }
13725
+ __name(extend, "extend");
13726
+ function compareNodeMinX(a, b) {
13727
+ return a.minX - b.minX;
13728
+ }
13729
+ __name(compareNodeMinX, "compareNodeMinX");
13730
+ function compareNodeMinY(a, b) {
13731
+ return a.minY - b.minY;
13732
+ }
13733
+ __name(compareNodeMinY, "compareNodeMinY");
13734
+ function bboxArea(a) {
13735
+ return (a.maxX - a.minX) * (a.maxY - a.minY);
13736
+ }
13737
+ __name(bboxArea, "bboxArea");
13738
+ function bboxMargin(a) {
13739
+ return a.maxX - a.minX + (a.maxY - a.minY);
13740
+ }
13741
+ __name(bboxMargin, "bboxMargin");
13742
+ function enlargedArea(a, b) {
13743
+ return (Math.max(b.maxX, a.maxX) - Math.min(b.minX, a.minX)) * (Math.max(b.maxY, a.maxY) - Math.min(b.minY, a.minY));
13744
+ }
13745
+ __name(enlargedArea, "enlargedArea");
13746
+ function intersectionArea(a, b) {
13747
+ const minX = Math.max(a.minX, b.minX), minY = Math.max(a.minY, b.minY), maxX = Math.min(a.maxX, b.maxX), maxY = Math.min(a.maxY, b.maxY);
13748
+ return Math.max(0, maxX - minX) * Math.max(0, maxY - minY);
13749
+ }
13750
+ __name(intersectionArea, "intersectionArea");
13751
+ function contains(a, b) {
13752
+ return a.minX <= b.minX && a.minY <= b.minY && b.maxX <= a.maxX && b.maxY <= a.maxY;
13753
+ }
13754
+ __name(contains, "contains");
13755
+ function intersects(a, b) {
13756
+ return b.minX <= a.maxX && b.minY <= a.maxY && b.maxX >= a.minX && b.maxY >= a.minY;
13757
+ }
13758
+ __name(intersects, "intersects");
13759
+ function createNode(children) {
13760
+ return {
13761
+ children,
13762
+ height: 1,
13763
+ leaf: !0,
13764
+ minX: 1 / 0,
13765
+ minY: 1 / 0,
13766
+ maxX: -1 / 0,
13767
+ maxY: -1 / 0
13768
+ };
13769
+ }
13770
+ __name(createNode, "createNode");
13771
+ function multiSelect(arr, left, right, n, compare) {
13772
+ const stack = [left, right];
13773
+ for (; stack.length; ) {
13774
+ if (right = stack.pop(), left = stack.pop(), right - left <= n) continue;
13775
+ const mid = left + Math.ceil((right - left) / n / 2) * n;
13776
+ quickselect(arr, mid, left, right, compare), stack.push(left, mid, mid, right);
13777
+ }
13778
+ }
13779
+ __name(multiSelect, "multiSelect");
13780
+ const _RTree = class _RTree {
13781
+ constructor() {
13782
+ __publicField(this, "_tree", /* @__PURE__ */ new Map());
13783
+ }
13784
+ dispose() {
13785
+ this.clear();
13786
+ }
13787
+ getTree(unitId, subUnitId) {
13788
+ return this._tree.has(unitId) || this._tree.set(unitId, /* @__PURE__ */ new Map()), this._tree.get(unitId).has(subUnitId) || this._tree.get(unitId).set(subUnitId, new RBush()), this._tree.get(unitId).get(subUnitId);
13789
+ }
13790
+ insert(item) {
13791
+ const { unitId, sheetId: subUnitId, range, id } = item;
13792
+ if (!unitId || unitId.length === 0)
13793
+ return;
13794
+ const tree = this.getTree(unitId, subUnitId);
13795
+ let { startRow: rangeStartRow, endRow: rangeEndRow, startColumn: rangeStartColumn, endColumn: rangeEndColumn } = range;
13796
+ Number.isNaN(rangeStartRow) && (rangeStartRow = 0), Number.isNaN(rangeStartColumn) && (rangeStartColumn = 0), Number.isNaN(rangeEndRow) && (rangeEndRow = Number.POSITIVE_INFINITY), Number.isNaN(rangeEndColumn) && (rangeEndColumn = Number.POSITIVE_INFINITY), tree.insert({
13797
+ minX: rangeStartColumn,
13798
+ minY: rangeStartRow,
13799
+ maxX: rangeEndColumn,
13800
+ maxY: rangeEndRow,
13801
+ id
13802
+ });
13803
+ }
13804
+ bulkInsert(items) {
13805
+ for (const item of items)
13806
+ this.insert(item);
13807
+ }
13808
+ search(search) {
13809
+ var _a11;
13810
+ const { unitId, sheetId: subUnitId, range } = search, tree = (_a11 = this._tree.get(unitId)) == null ? void 0 : _a11.get(subUnitId);
13811
+ if (!tree)
13812
+ return /* @__PURE__ */ new Map();
13813
+ const result = /* @__PURE__ */ new Map();
13814
+ return tree.search({
13815
+ minX: range.startColumn,
13816
+ minY: range.startRow,
13817
+ maxX: range.endColumn,
13818
+ maxY: range.endRow
13819
+ }).forEach((item) => {
13820
+ result.set(item.id, {
13821
+ unitId,
13822
+ sheetId: subUnitId,
13823
+ id: item.id,
13824
+ range: {
13825
+ startColumn: item.minX,
13826
+ startRow: item.minY,
13827
+ endColumn: item.maxX,
13828
+ endRow: item.maxY
13829
+ }
13830
+ });
13831
+ }), result;
13832
+ }
13833
+ bulkSearch(searchList) {
13834
+ const result = /* @__PURE__ */ new Map();
13835
+ for (const search of searchList) {
13836
+ const items = this.search(search);
13837
+ items.forEach((value, key) => {
13838
+ result.set(key, value);
13839
+ }), items.clear();
13840
+ }
13841
+ return result;
13842
+ }
13843
+ removeById(unitId, subUnitId) {
13844
+ var _a11;
13845
+ subUnitId ? (_a11 = this._tree.get(unitId)) == null || _a11.delete(subUnitId) : this._tree.delete(unitId);
13846
+ }
13847
+ remove(search) {
13848
+ const { unitId, sheetId: subUnitId, range, id } = search;
13849
+ this.getTree(unitId, subUnitId).remove({
13850
+ minX: range.startColumn,
13851
+ minY: range.startRow,
13852
+ maxX: range.endColumn,
13853
+ maxY: range.endRow,
13854
+ id
13855
+ });
13856
+ }
13857
+ bulkRemove(searchList) {
13858
+ for (const search of searchList)
13859
+ this.remove(search);
13860
+ }
13861
+ clear() {
13862
+ this._tree.clear();
13863
+ }
13864
+ toJSON() {
13865
+ const result = {};
13866
+ return this._tree.forEach((subTree, unitId) => {
13867
+ result[unitId] = {}, subTree.forEach((tree, subUnitId) => {
13868
+ result[unitId][subUnitId] = tree.toJSON();
13869
+ });
13870
+ }), result;
13871
+ }
13872
+ fromJSON(data) {
13873
+ this._tree.clear();
13874
+ for (const unitId in data) {
13875
+ this._tree.set(unitId, /* @__PURE__ */ new Map());
13876
+ for (const subUnitId in data[unitId]) {
13877
+ const tree = new RBush();
13878
+ tree.fromJSON(data[unitId][subUnitId]), this._tree.get(unitId).set(subUnitId, tree);
13879
+ }
13880
+ }
13881
+ }
13882
+ };
13883
+ __name(_RTree, "RTree");
13884
+ let RTree = _RTree;
13885
+ var __defProp2 = Object.defineProperty, __getOwnPropDesc = Object.getOwnPropertyDescriptor, __decorateClass = /* @__PURE__ */ __name((decorators, target, key, kind) => {
13454
13886
  for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
13455
13887
  (decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
13456
13888
  return kind && result && __defProp2(target, key, result), result;
13457
- }, "__decorateClass"), __decorateParam = /* @__PURE__ */ __name((index2, decorator) => (target, key) => decorator(target, key, index2), "__decorateParam"), _a12;
13458
- let ResourceLoaderService = (_a12 = class extends Disposable {
13889
+ }, "__decorateClass"), __decorateParam = /* @__PURE__ */ __name((index2, decorator) => (target, key) => decorator(target, key, index2), "__decorateParam"), _a10;
13890
+ let ResourceLoaderService = (_a10 = class extends Disposable {
13459
13891
  constructor(_resourceManagerService, _univerInstanceService) {
13460
13892
  super(), this._resourceManagerService = _resourceManagerService, this._univerInstanceService = _univerInstanceService, this._init();
13461
13893
  }
@@ -13519,7 +13951,7 @@ let ResourceLoaderService = (_a12 = class extends Disposable {
13519
13951
  const resources = this._resourceManagerService.getResources(unitId, unit.type), snapshot = Tools.deepClone(unit.getSnapshot());
13520
13952
  return snapshot.resources = resources, snapshot;
13521
13953
  }
13522
- }, __name(_a12, "ResourceLoaderService"), _a12);
13954
+ }, __name(_a10, "ResourceLoaderService"), _a10);
13523
13955
  ResourceLoaderService = __decorateClass([
13524
13956
  __decorateParam(0, Inject(IResourceManagerService)),
13525
13957
  __decorateParam(1, Inject(IUniverInstanceService))
@@ -13605,7 +14037,6 @@ function createUniverInjector(parentInjector, override) {
13605
14037
  [LocaleService],
13606
14038
  [ThemeService],
13607
14039
  [LifecycleService],
13608
- [LifecycleInitializerService],
13609
14040
  [PluginService],
13610
14041
  [UserManagerService],
13611
14042
  // abstract services
@@ -13619,8 +14050,11 @@ function createUniverInjector(parentInjector, override) {
13619
14050
  [IResourceManagerService, { useClass: ResourceManagerService, lazy: !0 }],
13620
14051
  [IResourceLoaderService, { useClass: ResourceLoaderService, lazy: !0 }],
13621
14052
  [IAuthzIoService, { useClass: AuthzIoLocalService, lazy: !0 }]
13622
- ], override);
13623
- return parentInjector ? parentInjector.createChild(dependencies) : new Injector(dependencies);
14053
+ ], override), injector = parentInjector ? parentInjector.createChild(dependencies) : new Injector(dependencies);
14054
+ return touchDependencies(injector, [
14055
+ [UserManagerService],
14056
+ [IResourceLoaderService]
14057
+ ]), injector;
13624
14058
  }
13625
14059
  __name(createUniverInjector, "createUniverInjector");
13626
14060
  installShims();
@@ -13750,7 +14184,6 @@ export {
13750
14184
  JSONX,
13751
14185
  LRUHelper,
13752
14186
  LRUMap,
13753
- LifecycleInitializerService,
13754
14187
  LifecycleService,
13755
14188
  LifecycleStages,
13756
14189
  LocalUndoRedoService,
@@ -13767,7 +14200,6 @@ export {
13767
14200
  ObjectMatrix,
13768
14201
  ObjectRelativeFromH,
13769
14202
  ObjectRelativeFromV,
13770
- OnLifecycle,
13771
14203
  Optional,
13772
14204
  OtherShapes,
13773
14205
  PRESET_LIST_TYPE,
@@ -13791,6 +14223,7 @@ export {
13791
14223
  RGBA_PAREN,
13792
14224
  RGB_PAREN,
13793
14225
  ROTATE_BUFFER_VALUE,
14226
+ RTree,
13794
14227
  Range,
13795
14228
  Rectangle,
13796
14229
  RediConsumer,
@@ -13894,6 +14327,7 @@ export {
13894
14327
  getCustomDecorationSlice,
13895
14328
  getCustomRangeSlice,
13896
14329
  getDocsUpdateBody,
14330
+ getIntersectRange,
13897
14331
  getOriginCellValue,
13898
14332
  getReverseDirection,
13899
14333
  getWorksheetUID,
@@ -13948,12 +14382,12 @@ export {
13948
14382
  numfmt,
13949
14383
  orderSearchArray,
13950
14384
  queryObjectMatrix,
14385
+ registerDependencies,
13951
14386
  remove,
13952
14387
  repeatStringNumTimes,
13953
14388
  replaceInDocumentBody,
13954
14389
  requestImmediateMacroTask,
13955
14390
  rotate,
13956
- runOnLifecycle,
13957
14391
  searchArray,
13958
14392
  selectionToArray,
13959
14393
  sequence,
@@ -13973,6 +14407,7 @@ export {
13973
14407
  takeAfter,
13974
14408
  throttle,
13975
14409
  toDisposable,
14410
+ touchDependencies,
13976
14411
  updateAttributeByDelete,
13977
14412
  updateAttributeByInsert,
13978
14413
  useDependency,