@univerjs/core 0.3.0 → 0.4.0-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/es/index.js CHANGED
@@ -2,11 +2,11 @@ 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
7
  import { Tools as Tools$1, normalizeTextRuns as normalizeTextRuns$1, generateRandomId as generateRandomId$1, DataStreamTreeTokenType as DataStreamTreeTokenType$1 } from "@univerjs/core";
8
+ import * as React from "react";
9
+ import React__default, { useState, useEffect, useRef, useMemo, createContext, useCallback, useContext } from "react";
10
10
  function _mergeNamespaces(n, m) {
11
11
  for (var i = 0; i < m.length; i++) {
12
12
  const e = m[i];
@@ -1483,8 +1483,8 @@ var IdleValue = (
1483
1483
  };
1484
1484
  return cb.apply(void 0, __spreadArray$2([accessor], args, !1));
1485
1485
  }, 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;
1486
+ var _a11;
1487
+ return this.dependencyCollection.has(id) || ((_a11 = this.parent) === null || _a11 === void 0 ? void 0 : _a11.has(id)) || !1;
1488
1488
  }, Injector2.prototype.get = function(id, quantityOrLookup, lookUp) {
1489
1489
  this._ensureInjectorNotDisposed();
1490
1490
  var newResult = this._get(id, quantityOrLookup, lookUp);
@@ -1555,7 +1555,7 @@ var IdleValue = (
1555
1555
  thing = this._resolveClassImpl(item);
1556
1556
  return id && shouldCache && this.resolvedDependencyCollection.add(id, thing), thing;
1557
1557
  }, Injector2.prototype._resolveClassImpl = function(item) {
1558
- for (var _a13, extraParams = [], _i = 1; _i < arguments.length; _i++)
1558
+ for (var _a11, extraParams = [], _i = 1; _i < arguments.length; _i++)
1559
1559
  extraParams[_i - 1] = arguments[_i];
1560
1560
  var ctor = item.useClass;
1561
1561
  this.markNewResolution(ctor);
@@ -1579,9 +1579,9 @@ var IdleValue = (
1579
1579
  delta > 0 ? args = __spreadArray$2(__spreadArray$2([], args, !0), new Array(delta).fill(void 0), !0) : args = args.slice(0, firstDependencyArgIndex);
1580
1580
  }
1581
1581
  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;
1582
+ return (_a11 = item == null ? void 0 : item.onInstantiation) === null || _a11 === void 0 || _a11.call(item, thing), this.markResolutionCompleted(), thing;
1583
1583
  }, Injector2.prototype._resolveFactory = function(id, item, shouldCache) {
1584
- var _a13;
1584
+ var _a11;
1585
1585
  this.markNewResolution(id);
1586
1586
  for (var declaredDependencies = normalizeFactoryDeps(item.deps), resolvedArgs = [], _i = 0, declaredDependencies_2 = declaredDependencies; _i < declaredDependencies_2.length; _i++) {
1587
1587
  var dep = declaredDependencies_2[_i];
@@ -1593,7 +1593,7 @@ var IdleValue = (
1593
1593
  }
1594
1594
  }
1595
1595
  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;
1596
+ 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
1597
  }, Injector2.prototype._resolveAsync = function(id, item) {
1598
1598
  var _this = this, asyncLoader = {
1599
1599
  __symbol: AsyncHookSymbol,
@@ -1728,8 +1728,8 @@ function RediInjector(props) {
1728
1728
  var children = props.children, dependencies = props.dependencies, childInjectorRef = React.useRef(null);
1729
1729
  return React.useEffect(function() {
1730
1730
  return function() {
1731
- var _a13;
1732
- return (_a13 = childInjectorRef.current) === null || _a13 === void 0 ? void 0 : _a13.dispose();
1731
+ var _a11;
1732
+ return (_a11 = childInjectorRef.current) === null || _a11 === void 0 ? void 0 : _a11.dispose();
1733
1733
  };
1734
1734
  }, []), React.createElement(RediConsumer, null, function(context) {
1735
1735
  var childInjector;
@@ -1804,7 +1804,7 @@ var __spreadArray$1 = /* @__PURE__ */ __name(function(to, from, pack) {
1804
1804
  return to.concat(ar || Array.prototype.slice.call(from));
1805
1805
  }, "__spreadArray$1");
1806
1806
  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];
1807
+ var firstValue = depValue$ instanceof BehaviorSubject && typeof defaultValue > "u" ? depValue$.getValue() : defaultValue, _a11 = useState(firstValue), value = _a11[0], setValue = _a11[1];
1808
1808
  return useEffect(function() {
1809
1809
  var subscription = depValue$.subscribe(function(val) {
1810
1810
  return setValue(val);
@@ -1824,9 +1824,9 @@ function useObservable(observable, defaultValue, shouldHaveSyncValue, deps) {
1824
1824
  throw new RediError("Expected deps to be provided when observable is a function!");
1825
1825
  var observableRef = useRef(null), initializedRef = useRef(!1), destObservable = useMemo(function() {
1826
1826
  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() {
1827
+ }, __spreadArray$1([], typeof deps < "u" ? deps : [observable], !0)), _a11 = useState(0);
1828
+ _a11[0];
1829
+ var setRenderCounter = _a11[1], valueRef = useRef(function() {
1830
1830
  var innerDefaultValue;
1831
1831
  if (destObservable) {
1832
1832
  var sub = unwrap(destObservable).subscribe(function(value) {
@@ -1851,7 +1851,7 @@ function useObservable(observable, defaultValue, shouldHaveSyncValue, deps) {
1851
1851
  }
1852
1852
  __name(useObservable, "useObservable");
1853
1853
  function useUpdateBinder(update$) {
1854
- var _a13 = useState(0), dumpSet = _a13[1];
1854
+ var _a11 = useState(0), dumpSet = _a11[1];
1855
1855
  useEffect(function() {
1856
1856
  var subscription = update$.subscribe(function() {
1857
1857
  return dumpSet(function(prev) {
@@ -1884,6 +1884,16 @@ function useDependencyContextValue(depValue$) {
1884
1884
  return useContext(context);
1885
1885
  }
1886
1886
  __name(useDependencyContextValue, "useDependencyContextValue");
1887
+ function registerDependencies(injector, dependencies) {
1888
+ dependencies.forEach((d) => injector.add(d));
1889
+ }
1890
+ __name(registerDependencies, "registerDependencies");
1891
+ function touchDependencies(injector, dependencies) {
1892
+ dependencies.forEach(([d]) => {
1893
+ injector.has(d) && injector.get(d);
1894
+ });
1895
+ }
1896
+ __name(touchDependencies, "touchDependencies");
1887
1897
  function shallowEqual(objA, objB) {
1888
1898
  if (Object.is(objA, objB))
1889
1899
  return !0;
@@ -1956,8 +1966,8 @@ const composeInterceptors = /* @__PURE__ */ __name((interceptors) => function(in
1956
1966
  return interceptors.push(interceptor), this._interceptorsByName.set(
1957
1967
  key,
1958
1968
  interceptors.sort((a, b) => {
1959
- var _a13, _b2;
1960
- return ((_a13 = b.priority) != null ? _a13 : 0) - ((_b2 = a.priority) != null ? _b2 : 0);
1969
+ var _a11, _b2;
1970
+ return ((_a11 = b.priority) != null ? _a11 : 0) - ((_b2 = a.priority) != null ? _b2 : 0);
1961
1971
  })
1962
1972
  // from large to small
1963
1973
  ), () => remove(this._interceptorsByName.get(key), interceptor);
@@ -2163,7 +2173,7 @@ var Subscription = function() {
2163
2173
  this.initialTeardown = initialTeardown, this.closed = !1, this._parentage = null, this._finalizers = null;
2164
2174
  }
2165
2175
  return __name(Subscription2, "Subscription"), Subscription2.prototype.unsubscribe = function() {
2166
- var e_1, _a13, e_2, _b2, errors;
2176
+ var e_1, _a11, e_2, _b2, errors;
2167
2177
  if (!this.closed) {
2168
2178
  this.closed = !0;
2169
2179
  var _parentage = this._parentage;
@@ -2178,7 +2188,7 @@ var Subscription = function() {
2178
2188
  e_1 = { error: e_1_1 };
2179
2189
  } finally {
2180
2190
  try {
2181
- _parentage_1_1 && !_parentage_1_1.done && (_a13 = _parentage_1.return) && _a13.call(_parentage_1);
2191
+ _parentage_1_1 && !_parentage_1_1.done && (_a11 = _parentage_1.return) && _a11.call(_parentage_1);
2182
2192
  } finally {
2183
2193
  if (e_1) throw e_1.error;
2184
2194
  }
@@ -2218,7 +2228,7 @@ var Subscription = function() {
2218
2228
  throw new UnsubscriptionError(errors);
2219
2229
  }
2220
2230
  }, Subscription2.prototype.add = function(teardown) {
2221
- var _a13;
2231
+ var _a11;
2222
2232
  if (teardown && teardown !== this)
2223
2233
  if (this.closed)
2224
2234
  execFinalizer(teardown);
@@ -2228,7 +2238,7 @@ var Subscription = function() {
2228
2238
  return;
2229
2239
  teardown._addParent(this);
2230
2240
  }
2231
- (this._finalizers = (_a13 = this._finalizers) !== null && _a13 !== void 0 ? _a13 : []).push(teardown);
2241
+ (this._finalizers = (_a11 = this._finalizers) !== null && _a11 !== void 0 ? _a11 : []).push(teardown);
2232
2242
  }
2233
2243
  }, Subscription2.prototype._hasParent = function(parent) {
2234
2244
  var _parentage = this._parentage;
@@ -2351,8 +2361,8 @@ const IContextService = createIdentifier("univer.context-service"), _ContextServ
2351
2361
  super.dispose(), this._contextChanged$.complete();
2352
2362
  }
2353
2363
  getContextValue(key) {
2354
- var _a13;
2355
- return (_a13 = this._contextMap.get(key)) != null ? _a13 : !1;
2364
+ var _a11;
2365
+ return (_a11 = this._contextMap.get(key)) != null ? _a11 : !1;
2356
2366
  }
2357
2367
  setContextValue(key, value) {
2358
2368
  this._contextMap.set(key, value), this._contextChanged$.next({ [key]: value });
@@ -2394,11 +2404,11 @@ const ILogService = createIdentifier("univer.log"), _DesktopLogService = class _
2394
2404
  };
2395
2405
  __name(_DesktopLogService, "DesktopLogService");
2396
2406
  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--)
2407
+ var __defProp$7 = Object.defineProperty, __getOwnPropDesc$7 = Object.getOwnPropertyDescriptor, __decorateClass$7 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
2408
+ for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$7(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
2399
2409
  (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 || {});
2410
+ return kind && result && __defProp$7(target, key, result), result;
2411
+ }, "__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
2412
  const ICommandService = createIdentifier("anywhere.command-service"), _CommandRegistry = class _CommandRegistry {
2403
2413
  constructor() {
2404
2414
  __publicField(this, "_commands", /* @__PURE__ */ new Map());
@@ -2483,13 +2493,13 @@ let CommandService = (_a = class extends Disposable {
2483
2493
  }
2484
2494
  throw new Error(`[CommandService]: command "${id}" is not registered.`);
2485
2495
  } catch (error) {
2486
- if (error instanceof CustomCommandExecutionError)
2496
+ if (this._logService.error(error), error instanceof CustomCommandExecutionError)
2487
2497
  return !1;
2488
- throw this._logService.error(error), error;
2498
+ throw error;
2489
2499
  }
2490
2500
  }
2491
2501
  syncExecuteCommand(id, params, options) {
2492
- var _a13;
2502
+ var _a11;
2493
2503
  try {
2494
2504
  const item = this._commandRegistry.getCommand(id);
2495
2505
  if (item) {
@@ -2504,7 +2514,7 @@ let CommandService = (_a = class extends Disposable {
2504
2514
  (item2) => item2.type === 0
2505
2515
  /* COMMAND */
2506
2516
  );
2507
- triggerCommand && (commandInfo.params = (_a13 = commandInfo.params) != null ? _a13 : {}, commandInfo.params.trigger = triggerCommand.id);
2517
+ triggerCommand && (commandInfo.params = (_a11 = commandInfo.params) != null ? _a11 : {}, commandInfo.params.trigger = triggerCommand.id);
2508
2518
  }
2509
2519
  const stackItemDisposable = this._pushCommandExecutionStack(commandInfo);
2510
2520
  this._beforeCommandExecutionListeners.forEach((listener) => listener(commandInfo, options));
@@ -2541,8 +2551,8 @@ let CommandService = (_a = class extends Disposable {
2541
2551
  }
2542
2552
  const implementationDisposable = multiCommand.registerImplementation(command);
2543
2553
  return toDisposable(() => {
2544
- var _a13;
2545
- implementationDisposable.dispose(), multiCommand.hasImplementations() || (_a13 = this._multiCommandDisposables.get(command.id)) == null || _a13.dispose();
2554
+ var _a11;
2555
+ implementationDisposable.dispose(), multiCommand.hasImplementations() || (_a11 = this._multiCommandDisposables.get(command.id)) == null || _a11.dispose();
2546
2556
  });
2547
2557
  }
2548
2558
  async _execute(command, params, options) {
@@ -2574,7 +2584,7 @@ let CommandService = (_a = class extends Disposable {
2574
2584
  return result;
2575
2585
  }
2576
2586
  }, __name(_a, "CommandService"), _a);
2577
- CommandService = __decorateClass$8([
2587
+ CommandService = __decorateClass$7([
2578
2588
  __decorateParam$7(0, Inject(Injector)),
2579
2589
  __decorateParam$7(1, ILogService)
2580
2590
  ], CommandService);
@@ -2712,7 +2722,7 @@ function getReverseDirection(direction) {
2712
2722
  }
2713
2723
  }
2714
2724
  __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 || {});
2725
+ 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
2726
  const urlAlphabet = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";
2717
2727
  let random = /* @__PURE__ */ __name((bytes) => crypto.getRandomValues(new Uint8Array(bytes)), "random"), customRandom = /* @__PURE__ */ __name((alphabet, defaultSize, getRandom) => {
2718
2728
  let mask = (2 << Math.log(alphabet.length - 1) / Math.LN2) - 1, step = -~(1.6 * mask * defaultSize / alphabet.length);
@@ -3122,9 +3132,9 @@ const rmsPrefix = /^-ms-/, rDashAlpha = /-([a-z])/g, alphabets = [
3122
3132
  sources.forEach((item) => item && deepItem(item));
3123
3133
  function deepArray(array, to) {
3124
3134
  array.forEach((value, key) => {
3125
- var _a13, _b2;
3135
+ var _a11, _b2;
3126
3136
  if (_Tools.isArray(value)) {
3127
- const origin = (_a13 = to[key]) != null ? _a13 : [];
3137
+ const origin = (_a11 = to[key]) != null ? _a11 : [];
3128
3138
  to[key] = origin, deepArray(value, origin);
3129
3139
  return;
3130
3140
  }
@@ -3139,10 +3149,10 @@ const rmsPrefix = /^-ms-/, rDashAlpha = /-([a-z])/g, alphabets = [
3139
3149
  __name(deepArray, "deepArray");
3140
3150
  function deepObject(object, to) {
3141
3151
  Object.keys(object).forEach((key) => {
3142
- var _a13, _b2;
3152
+ var _a11, _b2;
3143
3153
  const value = object[key];
3144
3154
  if (_Tools.isObject(value)) {
3145
- const origin = (_a13 = to[key]) != null ? _a13 : {};
3155
+ const origin = (_a11 = to[key]) != null ? _a11 : {};
3146
3156
  to[key] = origin, deepObject(value, origin);
3147
3157
  return;
3148
3158
  }
@@ -3157,10 +3167,10 @@ const rmsPrefix = /^-ms-/, rDashAlpha = /-([a-z])/g, alphabets = [
3157
3167
  __name(deepObject, "deepObject");
3158
3168
  function deepItem(item) {
3159
3169
  Object.keys(item).forEach((key) => {
3160
- var _a13, _b2;
3170
+ var _a11, _b2;
3161
3171
  const value = item[key];
3162
3172
  if (_Tools.isArray(value)) {
3163
- const origin = (_a13 = target[key]) != null ? _a13 : [];
3173
+ const origin = (_a11 = target[key]) != null ? _a11 : [];
3164
3174
  target[key] = origin, deepArray(value, origin);
3165
3175
  return;
3166
3176
  }
@@ -3184,7 +3194,7 @@ const rmsPrefix = /^-ms-/, rDashAlpha = /-([a-z])/g, alphabets = [
3184
3194
  }
3185
3195
  __name(diffValue, "diffValue");
3186
3196
  function diffArrays(oneArray, towArray) {
3187
- if (one.length !== tow.length)
3197
+ if (oneArray.length !== towArray.length)
3188
3198
  return !1;
3189
3199
  for (let i = 0, len = oneArray.length; i < len; i++) {
3190
3200
  const oneValue = oneArray[i], towValue = towArray[i];
@@ -3480,8 +3490,8 @@ function getBodySliceHtml(body, startIndex, endIndex) {
3480
3490
  }
3481
3491
  __name(getBodySliceHtml, "getBodySliceHtml");
3482
3492
  function convertBodyToHtml(body, withParagraphInfo = !0) {
3483
- var _a13;
3484
- if (withParagraphInfo && ((_a13 = body.paragraphs) != null && _a13.length)) {
3493
+ var _a11;
3494
+ if (withParagraphInfo && ((_a11 = body.paragraphs) != null && _a11.length)) {
3485
3495
  const { dataStream, paragraphs = [] } = body;
3486
3496
  let result = "", cursorIndex = -1;
3487
3497
  for (const paragraph of paragraphs) {
@@ -3932,9 +3942,9 @@ const RGB_PAREN = "rgb(", RGBA_PAREN = "rgba(", COLORS = {
3932
3942
  this._rgbColor = rgbColorObject, this._isValid = !0;
3933
3943
  }
3934
3944
  static mix(color1, color2, amount) {
3935
- var _a13, _b2;
3945
+ var _a11, _b2;
3936
3946
  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 = {
3947
+ 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
3948
  r: (rgb2.r - rgb1.r) * amount + rgb1.r,
3939
3949
  g: (rgb2.g - rgb1.g) * amount + rgb1.g,
3940
3950
  b: (rgb2.b - rgb1.b) * amount + rgb1.b,
@@ -3994,8 +4004,8 @@ const RGB_PAREN = "rgb(", RGBA_PAREN = "rgba(", COLORS = {
3994
4004
  return (r * 299 + g * 587 + b * 114) / 1e3;
3995
4005
  }
3996
4006
  getAlpha() {
3997
- var _a13;
3998
- return (_a13 = this._color.a) != null ? _a13 : 1;
4007
+ var _a11;
4008
+ return (_a11 = this._color.a) != null ? _a11 : 1;
3999
4009
  }
4000
4010
  isDark() {
4001
4011
  return this.getBrightness() < 128;
@@ -4333,8 +4343,8 @@ function makeCellRangeToRangeData(cellInfo) {
4333
4343
  }
4334
4344
  __name(makeCellRangeToRangeData, "makeCellRangeToRangeData");
4335
4345
  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;
4346
+ var _a11;
4347
+ return !cell || (((_a11 = cell == null ? void 0 : cell.v) == null ? void 0 : _a11.toString()) || "").length === 0 && !cell.p;
4338
4348
  }
4339
4349
  __name(isEmptyCell, "isEmptyCell");
4340
4350
  function isCellCoverable(cell) {
@@ -4360,7 +4370,7 @@ function isFormulaId(value) {
4360
4370
  }
4361
4371
  __name(isFormulaId, "isFormulaId");
4362
4372
  function handleStyleToString(style, isCell = !1) {
4363
- var _a13;
4373
+ var _a11;
4364
4374
  let str = "";
4365
4375
  const styleMap = /* @__PURE__ */ new Map([
4366
4376
  [
@@ -4393,22 +4403,22 @@ function handleStyleToString(style, isCell = !1) {
4393
4403
  [
4394
4404
  "ul",
4395
4405
  () => {
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} `));
4406
+ var _a12;
4407
+ (_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
4408
  }
4399
4409
  ],
4400
4410
  [
4401
4411
  "st",
4402
4412
  () => {
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} `));
4413
+ var _a12;
4414
+ (_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
4415
  }
4406
4416
  ],
4407
4417
  [
4408
4418
  "ol",
4409
4419
  () => {
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} `));
4420
+ var _a12;
4421
+ (_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
4422
  }
4413
4423
  ],
4414
4424
  [
@@ -4420,8 +4430,8 @@ function handleStyleToString(style, isCell = !1) {
4420
4430
  [
4421
4431
  "bd",
4422
4432
  () => {
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 : ""}; `);
4433
+ var _a12, _b2, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
4434
+ (_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
4435
  }
4426
4436
  ],
4427
4437
  [
@@ -4445,8 +4455,8 @@ function handleStyleToString(style, isCell = !1) {
4445
4455
  [
4446
4456
  "tr",
4447
4457
  () => {
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}` : ""});`);
4458
+ var _a12, _b2, _c;
4459
+ 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
4460
  }
4451
4461
  ],
4452
4462
  [
@@ -4470,14 +4480,14 @@ function handleStyleToString(style, isCell = !1) {
4470
4480
  [
4471
4481
  "pd",
4472
4482
  () => {
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`;
4483
+ var _a12, _b2, _c, _d, _e, _f, _g, _h;
4484
+ 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
4485
  (_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
4486
  }
4477
4487
  ]
4478
4488
  ]), cellSkip = ["bd", "tr", "tb"];
4479
4489
  for (const k in style)
4480
- isCell && cellSkip.includes(k) || (_a13 = styleMap.get(k)) == null || _a13();
4490
+ isCell && cellSkip.includes(k) || (_a11 = styleMap.get(k)) == null || _a11();
4481
4491
  return str;
4482
4492
  }
4483
4493
  __name(handleStyleToString, "handleStyleToString");
@@ -4575,8 +4585,8 @@ function checkParagraphHasIndent(paragraph) {
4575
4585
  }
4576
4586
  __name(checkParagraphHasIndent, "checkParagraphHasIndent");
4577
4587
  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);
4588
+ var _a11;
4589
+ return !(paragraphStyle == null || (paragraphStyle.indentStart == null || paragraphStyle.indentStart.v === 0) && paragraphStyle.hanging == null || ((_a11 = paragraphStyle.hanging) == null ? void 0 : _a11.v) === 0);
4580
4590
  }
4581
4591
  __name(checkParagraphHasIndentByStyle, "checkParagraphHasIndentByStyle");
4582
4592
  function insertTextToContent(content, start, text) {
@@ -5715,8 +5725,8 @@ const _ObjectMatrix = class _ObjectMatrix {
5715
5725
  return !1;
5716
5726
  }
5717
5727
  getValue(row, column) {
5718
- var _a13, _b2;
5719
- return (_b2 = (_a13 = this._matrix) == null ? void 0 : _a13[row]) == null ? void 0 : _b2[column];
5728
+ var _a11, _b2;
5729
+ return (_b2 = (_a11 = this._matrix) == null ? void 0 : _a11[row]) == null ? void 0 : _b2[column];
5720
5730
  }
5721
5731
  setValue(row, column, value) {
5722
5732
  const objectArray = this.getRowOrCreate(row);
@@ -5728,12 +5738,12 @@ const _ObjectMatrix = class _ObjectMatrix {
5728
5738
  * @deprecated use `realDelete` or `splice`
5729
5739
  */
5730
5740
  deleteValue(row, column) {
5731
- var _a13, _b2;
5732
- (_b2 = (_a13 = this._matrix) == null ? void 0 : _a13[row]) == null || delete _b2[column];
5741
+ var _a11, _b2;
5742
+ (_b2 = (_a11 = this._matrix) == null ? void 0 : _a11[row]) == null || delete _b2[column];
5733
5743
  }
5734
5744
  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)) {
5745
+ var _a11, _b2, _c;
5746
+ if ((_b2 = (_a11 = this._matrix) == null ? void 0 : _a11[row]) == null || delete _b2[column], this.getRow(row)) {
5737
5747
  const objectArray = this.getRow(row);
5738
5748
  if (objectArray == null)
5739
5749
  return;
@@ -6203,9 +6213,9 @@ const _Range = class _Range {
6203
6213
  const styles = this._deps.getStyles();
6204
6214
  return this.getValues().map(
6205
6215
  (row) => row.map((cell) => {
6206
- var _a13;
6216
+ var _a11;
6207
6217
  const rgbColor = styles.getStyleByCell(cell);
6208
- return ((_a13 = rgbColor == null ? void 0 : rgbColor.bg) == null ? void 0 : _a13.rgb) || DEFAULT_STYLES.bg.rgb;
6218
+ return ((_a11 = rgbColor == null ? void 0 : rgbColor.bg) == null ? void 0 : _a11.rgb) || DEFAULT_STYLES.bg.rgb;
6209
6219
  })
6210
6220
  );
6211
6221
  }
@@ -6246,13 +6256,13 @@ const _Range = class _Range {
6246
6256
  * @returns Returns a value in object format
6247
6257
  */
6248
6258
  getObjectValues(options = {}) {
6249
- var _a13;
6259
+ var _a11;
6250
6260
  const { startRow, endRow, startColumn, endColumn } = this._range, values = this._worksheet.getCellMatrix().getFragment(startRow, endRow, startColumn, endColumn).getData();
6251
6261
  if (options.isIncludeStyle) {
6252
6262
  const style = this._deps.getStyles();
6253
6263
  for (let r = 0; r <= endRow - startRow; r++)
6254
6264
  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)
6265
+ if (values == null || ((_a11 = values == null ? void 0 : values[r]) == null ? void 0 : _a11[c]) == null)
6256
6266
  continue;
6257
6267
  const s = values[r][c].s;
6258
6268
  s && (values[r][c].s = style.get(s));
@@ -6273,9 +6283,9 @@ const _Range = class _Range {
6273
6283
  const styles = this._deps.getStyles();
6274
6284
  return this.getValues().map(
6275
6285
  (row) => row.map((cell) => {
6276
- var _a13;
6286
+ var _a11;
6277
6287
  const cellStyle = styles.getStyleByCell(cell);
6278
- return ((_a13 = cellStyle == null ? void 0 : cellStyle.cl) == null ? void 0 : _a13.rgb) || DEFAULT_STYLES.cl.rgb;
6288
+ return ((_a11 = cellStyle == null ? void 0 : cellStyle.cl) == null ? void 0 : _a11.rgb) || DEFAULT_STYLES.cl.rgb;
6279
6289
  })
6280
6290
  );
6281
6291
  }
@@ -6301,8 +6311,8 @@ const _Range = class _Range {
6301
6311
  * Returns the underline of the cells in the range.
6302
6312
  */
6303
6313
  getUnderline() {
6304
- var _a13, _b2;
6305
- const { p } = (_a13 = this.getValue()) != null ? _a13 : {};
6314
+ var _a11, _b2;
6315
+ const { p } = (_a11 = this.getValue()) != null ? _a11 : {};
6306
6316
  return p && Array.isArray((_b2 = p.body) == null ? void 0 : _b2.textRuns) && p.body.textRuns.length > 0 ? isAllFormatInTextRuns("ul", p.body) === BooleanNumber.TRUE ? {
6307
6317
  s: BooleanNumber.TRUE
6308
6318
  } : {
@@ -6325,8 +6335,8 @@ const _Range = class _Range {
6325
6335
  * Returns the strikeThrough of the cells in the range.
6326
6336
  */
6327
6337
  getStrikeThrough() {
6328
- var _a13, _b2;
6329
- const { p } = (_a13 = this.getValue()) != null ? _a13 : {};
6338
+ var _a11, _b2;
6339
+ const { p } = (_a11 = this.getValue()) != null ? _a11 : {};
6330
6340
  return p && Array.isArray((_b2 = p.body) == null ? void 0 : _b2.textRuns) && p.body.textRuns.length > 0 ? isAllFormatInTextRuns("st", p.body) === BooleanNumber.TRUE ? {
6331
6341
  s: BooleanNumber.TRUE
6332
6342
  } : {
@@ -6343,14 +6353,14 @@ const _Range = class _Range {
6343
6353
  * Returns the font size in point size of the cell in the top-left corner of the range.
6344
6354
  */
6345
6355
  getFontSize() {
6346
- var _a13, _b2;
6347
- const p = ((_a13 = this.getValue()) == null ? void 0 : _a13.p) || {};
6356
+ var _a11, _b2;
6357
+ const p = ((_a11 = this.getValue()) == null ? void 0 : _a11.p) || {};
6348
6358
  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;
6359
+ var _a12;
6360
+ return ((_a12 = textRun == null ? void 0 : textRun.ts) == null ? void 0 : _a12.fs) != null;
6351
6361
  }) ? 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;
6362
+ var _a12;
6363
+ return ((_a12 = textRun == null ? void 0 : textRun.ts) == null ? void 0 : _a12.fs) || 0;
6354
6364
  })) : this.getFontSizes()[0][0] : this.getFontSizes()[0][0];
6355
6365
  }
6356
6366
  /**
@@ -6372,8 +6382,8 @@ const _Range = class _Range {
6372
6382
  * Returns the font style ('italic' or 'normal') of the cell in the top-left corner of the range.
6373
6383
  */
6374
6384
  getFontStyle() {
6375
- var _a13, _b2;
6376
- const { p } = (_a13 = this.getValue()) != null ? _a13 : {};
6385
+ var _a11, _b2;
6386
+ const { p } = (_a11 = this.getValue()) != null ? _a11 : {};
6377
6387
  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
6388
  }
6379
6389
  /**
@@ -6389,8 +6399,8 @@ const _Range = class _Range {
6389
6399
  * otherwise return FontWeight.NORMAL.
6390
6400
  */
6391
6401
  getFontWeight() {
6392
- var _a13, _b2;
6393
- const { p } = (_a13 = this.getValue()) != null ? _a13 : {};
6402
+ var _a11, _b2;
6403
+ const { p } = (_a11 = this.getValue()) != null ? _a11 : {};
6394
6404
  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
6405
  }
6396
6406
  /**
@@ -6684,6 +6694,56 @@ function multiSubtractSingleRange(ranges, toDelete) {
6684
6694
  }), Rectangle.mergeRanges(res);
6685
6695
  }
6686
6696
  __name(multiSubtractSingleRange, "multiSubtractSingleRange");
6697
+ function getIntersectRange(src, target) {
6698
+ const rowOverlap = getOverlap1D(
6699
+ src.startRow,
6700
+ src.endRow,
6701
+ target.startRow,
6702
+ target.endRow
6703
+ ), colOverlap = getOverlap1D(
6704
+ src.startColumn,
6705
+ src.endColumn,
6706
+ target.startColumn,
6707
+ target.endColumn
6708
+ );
6709
+ if (!rowOverlap || !colOverlap)
6710
+ return null;
6711
+ const [startRow, endRow] = rowOverlap, [startColumn, endColumn] = colOverlap, rangeType = determineRangeType(
6712
+ src.rangeType,
6713
+ target.rangeType,
6714
+ startRow,
6715
+ endRow,
6716
+ startColumn,
6717
+ endColumn
6718
+ );
6719
+ return {
6720
+ startRow,
6721
+ endRow,
6722
+ startColumn,
6723
+ endColumn,
6724
+ rangeType
6725
+ };
6726
+ }
6727
+ __name(getIntersectRange, "getIntersectRange");
6728
+ function getOverlap1D(start1, end1, start2, end2) {
6729
+ 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);
6730
+ if (start <= end) {
6731
+ const resultStart = start === -1 / 0 ? Number.NaN : start, resultEnd = end === 1 / 0 ? Number.NaN : end;
6732
+ return [resultStart, resultEnd];
6733
+ } else
6734
+ return null;
6735
+ }
6736
+ __name(getOverlap1D, "getOverlap1D");
6737
+ function determineRangeType(srcType, targetType, startRow, endRow, startColumn, endColumn) {
6738
+ const resolvedSrcType = srcType !== void 0 ? srcType : inferRangeType(startRow, endRow, startColumn, endColumn), resolvedTargetType = targetType !== void 0 ? targetType : inferRangeType(startRow, endRow, startColumn, endColumn);
6739
+ 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);
6740
+ }
6741
+ __name(determineRangeType, "determineRangeType");
6742
+ function inferRangeType(startRow, endRow, startColumn, endColumn) {
6743
+ const hasRow = !isNaN(startRow) && !isNaN(endRow), hasColumn = !isNaN(startColumn) && !isNaN(endColumn);
6744
+ return hasRow && hasColumn ? RANGE_TYPE.NORMAL : hasRow ? RANGE_TYPE.ROW : hasColumn ? RANGE_TYPE.COLUMN : RANGE_TYPE.ALL;
6745
+ }
6746
+ __name(inferRangeType, "inferRangeType");
6687
6747
  const _Rectangle = class _Rectangle {
6688
6748
  static clone(src) {
6689
6749
  return src.rangeType !== void 0 ? {
@@ -6723,6 +6783,10 @@ const _Rectangle = class _Rectangle {
6723
6783
  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
6784
  return zx <= x && zy <= y;
6725
6785
  }
6786
+ /**
6787
+ *
6788
+ * @deprecated use `getIntersectRange` instead. This method does not handle NaN and does not return the correct rangeType
6789
+ */
6726
6790
  static getIntersects(src, target) {
6727
6791
  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
6792
  let startColumn, startRow, endColumn, endRow;
@@ -6997,8 +7061,8 @@ const _RefAlias = class _RefAlias {
6997
7061
  return this._values;
6998
7062
  }
6999
7063
  getKeyMap(key) {
7000
- var _a13;
7001
- return [...((_a13 = this._keyMaps.get(key)) == null ? void 0 : _a13.keys()) || []];
7064
+ var _a11;
7065
+ return [...((_a11 = this._keyMaps.get(key)) == null ? void 0 : _a11.keys()) || []];
7002
7066
  }
7003
7067
  clear() {
7004
7068
  this._values = [], this._keys = [], this._keyMaps.clear();
@@ -8187,8 +8251,8 @@ __name(requireDist, "requireDist");
8187
8251
  const anyComponent = /* @__PURE__ */ __name((op, fn) => op.some((c) => typeof c == "object" && (Array.isArray(c) ? anyComponent(c, fn) : fn(c))), "anyComponent");
8188
8252
  function makeInvertible(op, doc) {
8189
8253
  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;
8254
+ var _a11;
8255
+ return c.r !== void 0 || ((_a11 = getEditType(c)) === null || _a11 === void 0 ? void 0 : _a11.makeInvertible) != null;
8192
8256
  })) return op;
8193
8257
  const r = new cursor_js_1.ReadCursor(op), w = new cursor_js_1.WriteCursor();
8194
8258
  let hasEdits = !1;
@@ -8839,13 +8903,13 @@ function normalizeTextRuns(textRuns) {
8839
8903
  }
8840
8904
  __name(normalizeTextRuns, "normalizeTextRuns");
8841
8905
  function insertTextRuns(body, insertBody, textLength, currentIndex) {
8842
- var _a13;
8906
+ var _a11;
8843
8907
  const { textRuns } = body;
8844
8908
  if (textRuns == null)
8845
8909
  return;
8846
8910
  const newTextRuns = [], len = textRuns.length;
8847
8911
  let hasInserted = !1;
8848
- const insertTextRuns2 = (_a13 = insertBody.textRuns) != null ? _a13 : [];
8912
+ const insertTextRuns2 = (_a11 = insertBody.textRuns) != null ? _a11 : [];
8849
8913
  if (insertTextRuns2.length)
8850
8914
  for (const insertTextRun of insertTextRuns2)
8851
8915
  insertTextRun.st += currentIndex, insertTextRun.ed += currentIndex;
@@ -9038,7 +9102,7 @@ function insertCustomDecorations(body, insertBody, textLength, currentIndex) {
9038
9102
  }
9039
9103
  __name(insertCustomDecorations, "insertCustomDecorations");
9040
9104
  function deleteTextRuns(body, textLength, currentIndex) {
9041
- var _a13;
9105
+ var _a11;
9042
9106
  const { textRuns } = body, startIndex = currentIndex, endIndex = currentIndex + textLength, removeTextRuns = [];
9043
9107
  if (startIndex === endIndex && (textRuns != null && textRuns.find((t) => t.st === currentIndex && t.ed === currentIndex))) {
9044
9108
  const textRun = textRuns.find((t) => t.st === currentIndex && t.ed === currentIndex);
@@ -9046,7 +9110,7 @@ function deleteTextRuns(body, textLength, currentIndex) {
9046
9110
  ...textRun,
9047
9111
  st: textRun.st - currentIndex,
9048
9112
  ed: textRun.ed - currentIndex
9049
- }), body.textRuns = (_a13 = body.textRuns) == null ? void 0 : _a13.filter((t) => t !== textRun), removeTextRuns;
9113
+ }), body.textRuns = (_a11 = body.textRuns) == null ? void 0 : _a11.filter((t) => t !== textRun), removeTextRuns;
9050
9114
  }
9051
9115
  if (textRuns) {
9052
9116
  const newTextRuns = [];
@@ -9441,7 +9505,7 @@ function updateCustomDecorations(body, updateBody, textLength, currentIndex, cov
9441
9505
  __name(updateCustomDecorations, "updateCustomDecorations");
9442
9506
  var SliceBodyType = /* @__PURE__ */ ((SliceBodyType2) => (SliceBodyType2[SliceBodyType2.copy = 0] = "copy", SliceBodyType2[SliceBodyType2.cut = 1] = "cut", SliceBodyType2))(SliceBodyType || {});
9443
9507
  function getBodySlice(body, startOffset, endOffset, returnEmptyTextRun = !1, type2 = 1) {
9444
- const { dataStream, textRuns = [], paragraphs = [], customBlocks = [], tables = [] } = body, docBody = {
9508
+ const { dataStream, textRuns = [], paragraphs = [], customBlocks = [], tables = [], sectionBreaks = [] } = body, docBody = {
9445
9509
  dataStream: dataStream.slice(startOffset, endOffset)
9446
9510
  }, newTextRuns = [];
9447
9511
  for (const textRun of textRuns) {
@@ -9486,6 +9550,15 @@ function getBodySlice(body, startOffset, endOffset, returnEmptyTextRun = !1, typ
9486
9550
  newParagraphs.length && (docBody.paragraphs = newParagraphs.map((p) => ({
9487
9551
  ...p,
9488
9552
  startIndex: p.startIndex - startOffset
9553
+ })));
9554
+ const newSectionBreaks = [];
9555
+ for (const sectionBreak of sectionBreaks) {
9556
+ const { startIndex } = sectionBreak;
9557
+ startIndex >= startOffset && startIndex <= endOffset && newSectionBreaks.push(Tools.deepClone(sectionBreak));
9558
+ }
9559
+ newSectionBreaks.length && (docBody.sectionBreaks = newSectionBreaks.map((sb) => ({
9560
+ ...sb,
9561
+ startIndex: sb.startIndex - startOffset
9489
9562
  }))), type2 === 1 && (docBody.customDecorations = getCustomDecorationSlice(body, startOffset, endOffset));
9490
9563
  const { customRanges } = getCustomRangeSlice(body, startOffset, endOffset);
9491
9564
  docBody.customRanges = customRanges;
@@ -9883,12 +9956,12 @@ const _TextX = class _TextX {
9883
9956
  return this._transform(otherActions, thisActions, priority === "left" ? "right" : "left");
9884
9957
  }
9885
9958
  static _transform(thisActions, otherActions, priority = "right") {
9886
- var _a13;
9959
+ var _a11;
9887
9960
  const thisIter = new ActionIterator(thisActions), otherIter = new ActionIterator(otherActions), textX = new _TextX();
9888
9961
  for (; thisIter.hasNext() || otherIter.hasNext(); )
9889
9962
  if (thisIter.peekType() === TextXActionType.INSERT && (priority === "left" || otherIter.peekType() !== TextXActionType.INSERT)) {
9890
9963
  const thisAction = thisIter.next();
9891
- textX.retain(thisAction.len, (_a13 = thisAction.segmentId) != null ? _a13 : "");
9964
+ textX.retain(thisAction.len, (_a11 = thisAction.segmentId) != null ? _a11 : "");
9892
9965
  } else if (otherIter.peekType() === TextXActionType.INSERT)
9893
9966
  textX.push(otherIter.next());
9894
9967
  else {
@@ -10056,8 +10129,8 @@ Object.defineProperty(TextX, "name", {
10056
10129
  });
10057
10130
  const _JSONX = class _JSONX {
10058
10131
  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));
10132
+ var _a11;
10133
+ 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
10134
  }
10062
10135
  static apply(doc, actions) {
10063
10136
  if (!dist$1.type.isNoop(actions))
@@ -10110,20 +10183,20 @@ const DEFAULT_DOC = {
10110
10183
  documentStyle: {}
10111
10184
  }, _DocumentDataModelSimple = class _DocumentDataModelSimple extends UnitModel {
10112
10185
  constructor(snapshot) {
10113
- var _a13;
10186
+ var _a11;
10114
10187
  super();
10115
10188
  __publicField(this, "type", I.UNIVER_DOC);
10116
10189
  __publicField(this, "_name$", new BehaviorSubject(""));
10117
10190
  __publicField(this, "name$", this._name$.asObservable());
10118
10191
  __publicField(this, "snapshot");
10119
- this.snapshot = { ...DEFAULT_DOC, ...snapshot }, this._name$.next((_a13 = this.snapshot.title) != null ? _a13 : "No Title");
10192
+ this.snapshot = { ...DEFAULT_DOC, ...snapshot }, this._name$.next((_a11 = this.snapshot.title) != null ? _a11 : "No Title");
10120
10193
  }
10121
10194
  getUnitId() {
10122
10195
  throw new Error("Method not implemented.");
10123
10196
  }
10124
10197
  getRev() {
10125
- var _a13;
10126
- return (_a13 = this.snapshot.rev) != null ? _a13 : 1;
10198
+ var _a11;
10199
+ return (_a11 = this.snapshot.rev) != null ? _a11 : 1;
10127
10200
  }
10128
10201
  incrementRev() {
10129
10202
  this.snapshot.rev = this.getRev() + 1;
@@ -10144,8 +10217,8 @@ const DEFAULT_DOC = {
10144
10217
  return this.snapshot.lists;
10145
10218
  }
10146
10219
  get zoomRatio() {
10147
- var _a13;
10148
- return ((_a13 = this.snapshot.settings) == null ? void 0 : _a13.zoomRatio) || 1;
10220
+ var _a11;
10221
+ return ((_a11 = this.snapshot.settings) == null ? void 0 : _a11.zoomRatio) || 1;
10149
10222
  }
10150
10223
  resetDrawing(drawings, drawingsOrder) {
10151
10224
  this.snapshot.drawings = drawings, this.snapshot.drawingsOrder = drawingsOrder;
@@ -10157,8 +10230,8 @@ const DEFAULT_DOC = {
10157
10230
  return this.snapshot;
10158
10231
  }
10159
10232
  getBulletPresetList() {
10160
- var _a13;
10161
- const customLists = (_a13 = this.snapshot.lists) != null ? _a13 : {};
10233
+ var _a11;
10234
+ const customLists = (_a11 = this.snapshot.lists) != null ? _a11 : {};
10162
10235
  return {
10163
10236
  ...PRESET_LIST_TYPE,
10164
10237
  ...customLists
@@ -10212,13 +10285,13 @@ __name(_DocumentDataModelSimple, "DocumentDataModelSimple");
10212
10285
  let DocumentDataModelSimple = _DocumentDataModelSimple;
10213
10286
  const _DocumentDataModel = class _DocumentDataModel extends DocumentDataModelSimple {
10214
10287
  constructor(snapshot) {
10215
- var _a13, _b2;
10288
+ var _a11, _b2;
10216
10289
  super(Tools.isEmptyObject(snapshot) ? getEmptySnapshot$1() : snapshot);
10217
10290
  __publicField(this, "_unitId");
10218
10291
  __publicField(this, "headerModelMap", /* @__PURE__ */ new Map());
10219
10292
  __publicField(this, "footerModelMap", /* @__PURE__ */ new Map());
10220
10293
  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 : "");
10294
+ 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
10295
  }
10223
10296
  dispose() {
10224
10297
  super.dispose(), this.headerModelMap.forEach((header) => {
@@ -10234,12 +10307,12 @@ const _DocumentDataModel = class _DocumentDataModel extends DocumentDataModelSim
10234
10307
  return this.snapshot.drawingsOrder;
10235
10308
  }
10236
10309
  getCustomRanges() {
10237
- var _a13;
10238
- return (_a13 = this.snapshot.body) == null ? void 0 : _a13.customRanges;
10310
+ var _a11;
10311
+ return (_a11 = this.snapshot.body) == null ? void 0 : _a11.customRanges;
10239
10312
  }
10240
10313
  getCustomDecorations() {
10241
- var _a13;
10242
- return (_a13 = this.snapshot.body) == null ? void 0 : _a13.customDecorations;
10314
+ var _a11;
10315
+ return (_a11 = this.snapshot.body) == null ? void 0 : _a11.customDecorations;
10243
10316
  }
10244
10317
  getSettings() {
10245
10318
  return this.snapshot.settings;
@@ -10367,7 +10440,7 @@ const tags = [
10367
10440
  const text = dataStream.endsWith(`\r
10368
10441
  `) ? dataStream.slice(0, -2) : dataStream;
10369
10442
  return tags.reduce((res, curr) => res.replaceAll(curr, ""), text);
10370
- }, "getPlainText"), fromPlainText = /* @__PURE__ */ __name((text) => {
10443
+ }, "getPlainText"), isEmptyDocument = /* @__PURE__ */ __name((dataStream) => dataStream ? getPlainText(dataStream).replaceAll("\r", "") === "" : !0, "isEmptyDocument"), fromPlainText = /* @__PURE__ */ __name((text) => {
10371
10444
  const dataStream = text.replace(/\n/g, "\r"), paragraphs = [], customRanges = [];
10372
10445
  let cursor2 = 0, newDataStream = "", linkCount = 0;
10373
10446
  const loopParagraph = /* @__PURE__ */ __name((i, insertP = !0) => {
@@ -10425,7 +10498,7 @@ function getSelectionWithSymbolMax(selection, body) {
10425
10498
  }
10426
10499
  __name(getSelectionWithSymbolMax, "getSelectionWithSymbolMax");
10427
10500
  function getDeleteSelection(selection, body, direction = DeleteDirection.LEFT) {
10428
- var _a13;
10501
+ var _a11;
10429
10502
  let { startOffset, endOffset, collapsed } = normalizeSelection(selection);
10430
10503
  if (collapsed)
10431
10504
  if (direction === DeleteDirection.LEFT)
@@ -10439,7 +10512,7 @@ function getDeleteSelection(selection, body, direction = DeleteDirection.LEFT) {
10439
10512
  startOffset = selectionWithSymbolMax.startOffset, endOffset = selectionWithSymbolMax.endOffset;
10440
10513
  }
10441
10514
  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));
10515
+ 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
10516
  return customRanges != null && customRanges.length && customRanges.forEach((range) => {
10444
10517
  startOffset = Math.min(range.startIndex, startOffset), endOffset = Math.max(range.endIndex + 1, endOffset);
10445
10518
  }), {
@@ -10522,8 +10595,8 @@ function isSegmentIntersects(start, end, start2, end2) {
10522
10595
  }
10523
10596
  __name(isSegmentIntersects, "isSegmentIntersects");
10524
10597
  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();
10598
+ var _a11;
10599
+ 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
10600
  relativeCustomRanges == null || relativeCustomRanges.forEach((range2) => {
10528
10601
  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
10602
  }), textStart > 0 && dos.push({
@@ -10558,8 +10631,8 @@ function getRetainAndDeleteFromReplace(range, segmentId = "", memoryCursor, body
10558
10631
  }
10559
10632
  __name(getRetainAndDeleteFromReplace, "getRetainAndDeleteFromReplace");
10560
10633
  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);
10634
+ var _a11, _b2;
10635
+ 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
10636
  if (!range)
10564
10637
  return !1;
10565
10638
  const { startIndex, endIndex } = range, textX = new TextX(), len = endIndex - startIndex + 1;
@@ -10572,7 +10645,7 @@ function deleteCustomRangeTextX(accessor, params) {
10572
10645
  len: 1,
10573
10646
  segmentId,
10574
10647
  line: 0
10575
- }), len - 2 > 0 && textX.push({
10648
+ }), textRange && textRange.index > startIndex && textRange.index--, len - 2 > 0 && textX.push({
10576
10649
  t: TextXActionType.RETAIN,
10577
10650
  len: len - 2,
10578
10651
  segmentId
@@ -10581,21 +10654,21 @@ function deleteCustomRangeTextX(accessor, params) {
10581
10654
  len: 1,
10582
10655
  segmentId,
10583
10656
  line: 0
10584
- }), insert && textX.push({
10657
+ }), textRange && textRange.index > endIndex && textRange.index--, insert && (textX.push({
10585
10658
  body: insert,
10586
10659
  t: TextXActionType.INSERT,
10587
10660
  len: insert.dataStream.length,
10588
10661
  segmentId,
10589
10662
  line: 1
10590
- }), textX;
10663
+ }), textRange && textRange.index > endIndex && (textRange.index += insert.dataStream.length)), textX;
10591
10664
  }
10592
10665
  __name(deleteCustomRangeTextX, "deleteCustomRangeTextX");
10593
10666
  function addCustomRangeTextX(param) {
10594
- var _a13, _b2;
10667
+ var _a11, _b2;
10595
10668
  const { range, rangeId, rangeType, segmentId, wholeEntity, properties, body } = param, actualRange = getSelectionForAddCustomRange(range, body);
10596
10669
  if (!actualRange || !body)
10597
10670
  return !1;
10598
- const { startOffset, endOffset } = actualRange, customRanges = (_a13 = body.customRanges) != null ? _a13 : [];
10671
+ const { startOffset, endOffset } = actualRange, customRanges = (_a11 = body.customRanges) != null ? _a11 : [];
10599
10672
  let cursor2 = 0;
10600
10673
  const textX = new TextX(), addCustomRange = /* @__PURE__ */ __name((startIndex, endIndex, index2) => {
10601
10674
  const relativeCustomRanges = [];
@@ -10664,10 +10737,10 @@ function addCustomRangeTextX(param) {
10664
10737
  }
10665
10738
  __name(addCustomRangeTextX, "addCustomRangeTextX");
10666
10739
  function getRetainAndDeleteAndExcludeLineBreak(selection, body, segmentId = "", memoryCursor = 0, preserveLineBreak = !0) {
10667
- var _a13;
10740
+ var _a11;
10668
10741
  const { startOffset, endOffset } = getDeleteSelection(selection, body), dos = [], { paragraphs = [], dataStream } = body, textStart = startOffset - memoryCursor, textEnd = endOffset - memoryCursor, paragraphInRange = paragraphs == null ? void 0 : paragraphs.find(
10669
10742
  (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();
10743
+ ), 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
10744
  if (relativeCustomRanges == null || relativeCustomRanges.forEach((range) => {
10672
10745
  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
10746
  }), textStart > 0 && dos.push({
@@ -10701,8 +10774,8 @@ function getRetainAndDeleteAndExcludeLineBreak(selection, body, segmentId = "",
10701
10774
  }
10702
10775
  __name(getRetainAndDeleteAndExcludeLineBreak, "getRetainAndDeleteAndExcludeLineBreak");
10703
10776
  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();
10777
+ var _a11;
10778
+ const { selection, body: insertBody, doc } = params, segmentId = selection.segmentId, body = (_a11 = doc.getSelfOrHeaderFooterModel(segmentId)) == null ? void 0 : _a11.getBody();
10706
10779
  if (!body) return !1;
10707
10780
  const textX = new TextX(), deleteActions = getRetainAndDeleteAndExcludeLineBreak(selection, body, segmentId);
10708
10781
  return deleteActions.length && textX.push(...deleteActions), textX.push({
@@ -10733,7 +10806,8 @@ __name(_BuildTextUtils, "BuildTextUtils"), __publicField(_BuildTextUtils, "custo
10733
10806
  isIntersects: isSegmentIntersects
10734
10807
  }), __publicField(_BuildTextUtils, "transform", {
10735
10808
  getPlainText,
10736
- fromPlainText
10809
+ fromPlainText,
10810
+ isEmptyDocument
10737
10811
  });
10738
10812
  let BuildTextUtils = _BuildTextUtils;
10739
10813
  function replaceInDocumentBody(body, query, target) {
@@ -10806,23 +10880,23 @@ const _EventSubject = class _EventSubject extends Subject {
10806
10880
  typeof observer == "function" ? ob = { next: /* @__PURE__ */ __name(([evt, state]) => observer(evt, state), "next") } : ob = observer;
10807
10881
  const subscription = super.subscribe(ob);
10808
10882
  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);
10883
+ var _a11, _b2;
10884
+ return ((_a11 = a.priority) != null ? _a11 : 0) - ((_b2 = b.priority) != null ? _b2 : 0);
10811
10885
  }), subscription.add(() => this._sortedObservers = this._sortedObservers.filter((o) => o !== ob)), subscription;
10812
10886
  }
10813
10887
  clearObservers() {
10814
10888
  this._sortedObservers.forEach((observer) => {
10815
- var _a13;
10816
- return (_a13 = observer.complete) == null ? void 0 : _a13.call(observer);
10889
+ var _a11;
10890
+ return (_a11 = observer.complete) == null ? void 0 : _a11.call(observer);
10817
10891
  }), this._sortedObservers.length = 0;
10818
10892
  }
10819
10893
  emitEvent(event) {
10820
- var _a13;
10894
+ var _a11;
10821
10895
  if (!this.closed) {
10822
10896
  const state = new EventState();
10823
10897
  state.lastReturnValue = event;
10824
10898
  for (const observer of this._sortedObservers) {
10825
- const value = (_a13 = observer.next) == null ? void 0 : _a13.call(observer, [event, state]);
10899
+ const value = (_a11 = observer.next) == null ? void 0 : _a11.call(observer, [event, state]);
10826
10900
  if (state.lastReturnValue = value, state.skipNextObservers)
10827
10901
  return {
10828
10902
  handled: !0,
@@ -10850,25 +10924,7 @@ function fromEventSubject(subject$) {
10850
10924
  });
10851
10925
  }
10852
10926
  __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 = {
10927
+ const IResourceManagerService = createIdentifier("core.resource-manager.service"), nameMap = {
10872
10928
  [G.Editor]: "Editor",
10873
10929
  [G.Owner]: "Owner",
10874
10930
  [G.Reader]: "Reader",
@@ -10883,13 +10939,7 @@ const nameMap = {
10883
10939
  avatar: "",
10884
10940
  anonymous: !0,
10885
10941
  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 {
10942
+ }, "createDefaultUser"), isDevRole = /* @__PURE__ */ __name((userId, type2) => userId.startsWith(nameMap[type2]), "isDevRole"), _UserManagerService = class _UserManagerService {
10893
10943
  constructor() {
10894
10944
  __publicField(this, "_model", /* @__PURE__ */ new Map());
10895
10945
  __publicField(this, "_userChange$", new Subject());
@@ -10926,16 +10976,15 @@ let UserManagerService = (_a3 = class {
10926
10976
  list() {
10927
10977
  return Array.from(this._model.values());
10928
10978
  }
10929
- }, __name(_a3, "UserManagerService"), _a3);
10930
- UserManagerService = __decorateClass$7([
10931
- OnLifecycle(LifecycleStages.Starting, UserManagerService)
10932
- ], UserManagerService);
10979
+ };
10980
+ __name(_UserManagerService, "UserManagerService");
10981
+ let UserManagerService = _UserManagerService;
10933
10982
  var __defProp$6 = Object.defineProperty, __getOwnPropDesc$6 = Object.getOwnPropertyDescriptor, __decorateClass$6 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
10934
10983
  for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$6(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
10935
10984
  (decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
10936
10985
  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 {
10986
+ }, "__decorateClass$6"), __decorateParam$6 = /* @__PURE__ */ __name((index2, decorator) => (target, key) => decorator(target, key, index2), "__decorateParam$6"), _a3;
10987
+ let AuthzIoLocalService = (_a3 = class {
10939
10988
  // private _sheetPermissionPointMap: Map<string, { action: UnitAction; allowed: boolean }[]> = new Map();
10940
10989
  constructor(_resourceManagerService, _userManagerService) {
10941
10990
  __publicField(this, "_permissionMap", /* @__PURE__ */ new Map([]));
@@ -11077,7 +11126,7 @@ let AuthzIoLocalService = (_a4 = class {
11077
11126
  }
11078
11127
  async putCollaborators(config) {
11079
11128
  }
11080
- }, __name(_a4, "AuthzIoLocalService"), _a4);
11129
+ }, __name(_a3, "AuthzIoLocalService"), _a3);
11081
11130
  AuthzIoLocalService = __decorateClass$6([
11082
11131
  __decorateParam$6(0, IResourceManagerService),
11083
11132
  __decorateParam$6(1, Inject(UserManagerService))
@@ -11090,8 +11139,8 @@ const IAuthzIoService = createIdentifier("IAuthzIoIoService"), IConfigService =
11090
11139
  return this._config.get(id);
11091
11140
  }
11092
11141
  setConfig(id, value, options) {
11093
- var _a13;
11094
- const { merge: merge2 = !1 } = options || {}, existingValue = (_a13 = this._config.get(id)) != null ? _a13 : {};
11142
+ var _a11;
11143
+ const { merge: merge2 = !1 } = options || {}, existingValue = (_a11 = this._config.get(id)) != null ? _a11 : {};
11095
11144
  if (merge2) {
11096
11145
  this._config.set(id, Tools.deepMerge(existingValue, value));
11097
11146
  return;
@@ -11119,7 +11168,7 @@ const FOCUSING_UNIT = "FOCUSING_UNIT", FOCUSING_SHEET = "FOCUSING_SHEET", FOCUSI
11119
11168
  };
11120
11169
  __name(_ErrorService, "ErrorService");
11121
11170
  let ErrorService = _ErrorService;
11122
- const version = "0.3.0";
11171
+ const version = "0.4.0-alpha.0";
11123
11172
  function getEmptySnapshot(unitID = "", locale = LocaleType.ZH_CN, name = "") {
11124
11173
  return {
11125
11174
  id: unitID,
@@ -11558,6 +11607,15 @@ const _SpanModel = class _SpanModel extends Disposable {
11558
11607
  const index2 = this._getMergeDataIndex(row, column);
11559
11608
  return index2 !== -1 ? this._mergeData[index2] : null;
11560
11609
  }
11610
+ /**
11611
+ * Return index of merge data if (row,col) is in merge range. -1 means not in merge range.
11612
+ * @param row
11613
+ * @param column
11614
+ * @returns {number} index of merge range.
11615
+ */
11616
+ getMergeDataIndex(row, column) {
11617
+ return this._getMergeDataIndex(row, column);
11618
+ }
11561
11619
  isRowContainsMergedCell(row) {
11562
11620
  return this._hasAll || !Tools.isEmptyObject(this._columnCache) ? !0 : this._mergeData.some((mergedCell) => mergedCell.startRow <= row && row <= mergedCell.endRow);
11563
11621
  }
@@ -11635,7 +11693,7 @@ const _SpanModel = class _SpanModel extends Disposable {
11635
11693
  return ranges;
11636
11694
  }
11637
11695
  _getMergeDataIndex(row, column) {
11638
- var _a13;
11696
+ var _a11;
11639
11697
  if (this._hasAll)
11640
11698
  return this._allIndex;
11641
11699
  if (this._hasRow) {
@@ -11648,7 +11706,7 @@ const _SpanModel = class _SpanModel extends Disposable {
11648
11706
  if (columnValue !== void 0)
11649
11707
  return columnValue;
11650
11708
  }
11651
- const cellValue = (_a13 = this._cellCache.get(row)) == null ? void 0 : _a13.get(column);
11709
+ const cellValue = (_a11 = this._cellCache.get(row)) == null ? void 0 : _a11.get(column);
11652
11710
  return cellValue !== void 0 ? cellValue : -1;
11653
11711
  }
11654
11712
  getMergeDataSnapshot() {
@@ -11680,8 +11738,8 @@ const _SheetViewModel = class _SheetViewModel extends Disposable {
11680
11738
  return this._cellContentInterceptor ? this._cellContentInterceptor.getCell(row, col, InterceptorEffectEnum.Style) : this.getRawCell(row, col);
11681
11739
  }
11682
11740
  getRowFiltered(row) {
11683
- var _a13, _b2;
11684
- return (_b2 = (_a13 = this._rowFilteredInterceptor) == null ? void 0 : _a13.getRowFiltered(row)) != null ? _b2 : !1;
11741
+ var _a11, _b2;
11742
+ return (_b2 = (_a11 = this._rowFilteredInterceptor) == null ? void 0 : _a11.getRowFiltered(row)) != null ? _b2 : !1;
11685
11743
  }
11686
11744
  registerCellContentInterceptor(interceptor) {
11687
11745
  if (this._cellContentInterceptor)
@@ -11705,10 +11763,10 @@ const _Worksheet = class _Worksheet {
11705
11763
  __publicField(this, "_columnManager");
11706
11764
  __publicField(this, "_viewModel");
11707
11765
  __publicField(this, "_spanModel");
11708
- var _a13;
11766
+ var _a11;
11709
11767
  this.unitId = unitId, this._styles = _styles, this._snapshot = mergeWorksheetSnapshotWithDefault(snapshot);
11710
11768
  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);
11769
+ 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
11770
  }
11713
11771
  /**
11714
11772
  * @internal
@@ -11818,7 +11876,7 @@ const _Worksheet = class _Worksheet {
11818
11876
  return this._spanModel.getMergedCell(row, col);
11819
11877
  }
11820
11878
  /**
11821
- * Get the merged cell info list which has intersection with the given range.
11879
+ * Get the merged cell info list which has intersection with the given range.
11822
11880
  * @param {number} startRow The start row index of the range
11823
11881
  * @param {number} startColumn The start column index of the range
11824
11882
  * @param {number} endRow The end row index of the range
@@ -12224,10 +12282,10 @@ const _Worksheet = class _Worksheet {
12224
12282
  __name(_Worksheet, "Worksheet");
12225
12283
  let Worksheet = _Worksheet;
12226
12284
  function extractPureTextFromCell(cell) {
12227
- var _a13, _b2;
12285
+ var _a11, _b2;
12228
12286
  if (!cell)
12229
12287
  return "";
12230
- const richTextValue = (_b2 = (_a13 = cell.p) == null ? void 0 : _a13.body) == null ? void 0 : _b2.dataStream;
12288
+ const richTextValue = (_b2 = (_a11 = cell.p) == null ? void 0 : _a11.body) == null ? void 0 : _b2.dataStream;
12231
12289
  if (richTextValue)
12232
12290
  return BuildTextUtils.transform.getPlainText(richTextValue);
12233
12291
  const rawValue = cell.v;
@@ -12256,8 +12314,8 @@ function getWorksheetUID(workbook, worksheet) {
12256
12314
  return `${workbook.getUnitId()}|${worksheet.getSheetId()}`;
12257
12315
  }
12258
12316
  __name(getWorksheetUID, "getWorksheetUID");
12259
- var _a5;
12260
- let Workbook = (_a5 = class extends UnitModel {
12317
+ var _a4;
12318
+ let Workbook = (_a4 = class extends UnitModel {
12261
12319
  constructor(workbookData = {}, _logService) {
12262
12320
  super();
12263
12321
  __publicField(this, "type", I.UNIVER_SHEET);
@@ -12333,8 +12391,8 @@ let Workbook = (_a5 = class extends UnitModel {
12333
12391
  return this._unitId;
12334
12392
  }
12335
12393
  getRev() {
12336
- var _a13;
12337
- return (_a13 = this._snapshot.rev) != null ? _a13 : 1;
12394
+ var _a11;
12395
+ return (_a11 = this._snapshot.rev) != null ? _a11 : 1;
12338
12396
  }
12339
12397
  incrementRev() {
12340
12398
  this._snapshot.rev = this.getRev() + 1;
@@ -12497,13 +12555,13 @@ let Workbook = (_a5 = class extends UnitModel {
12497
12555
  }
12498
12556
  this.ensureActiveSheet();
12499
12557
  }
12500
- }, __name(_a5, "Workbook"), _a5);
12558
+ }, __name(_a4, "Workbook"), _a4);
12501
12559
  Workbook = __decorateClass$5([
12502
12560
  __decorateParam$5(1, ILogService)
12503
12561
  ], Workbook);
12504
12562
  const _SlideDataModel = class _SlideDataModel extends UnitModel {
12505
12563
  constructor(snapshot) {
12506
- var _a13;
12564
+ var _a11;
12507
12565
  super();
12508
12566
  __publicField(this, "type", I.UNIVER_SLIDE);
12509
12567
  __publicField(this, "_activePage$", new BehaviorSubject(null));
@@ -12512,20 +12570,20 @@ const _SlideDataModel = class _SlideDataModel extends UnitModel {
12512
12570
  __publicField(this, "name$");
12513
12571
  __publicField(this, "_snapshot");
12514
12572
  __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();
12573
+ 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
12574
  }
12517
12575
  get _activePage() {
12518
- var _a13, _b2;
12576
+ var _a11, _b2;
12519
12577
  const activePage = this._activePage$.getValue();
12520
12578
  if (!activePage) {
12521
- const activePageId = (_a13 = this.getPageOrder()) == null ? void 0 : _a13[0];
12579
+ const activePageId = (_a11 = this.getPageOrder()) == null ? void 0 : _a11[0];
12522
12580
  return activePageId ? (_b2 = this.getPages()) == null ? void 0 : _b2[activePageId] : null;
12523
12581
  }
12524
12582
  return activePage;
12525
12583
  }
12526
12584
  setName(name) {
12527
- var _a13;
12528
- this._snapshot.title = name, this._name$.next(name), this._unitId = (_a13 = this._snapshot.id) != null ? _a13 : generateRandomId(6);
12585
+ var _a11;
12586
+ this._snapshot.title = name, this._name$.next(name), this._unitId = (_a11 = this._snapshot.id) != null ? _a11 : generateRandomId(6);
12529
12587
  }
12530
12588
  getRev() {
12531
12589
  return 0;
@@ -12541,24 +12599,24 @@ const _SlideDataModel = class _SlideDataModel extends UnitModel {
12541
12599
  return this._unitId;
12542
12600
  }
12543
12601
  getPages() {
12544
- var _a13;
12545
- return (_a13 = this._snapshot.body) == null ? void 0 : _a13.pages;
12602
+ var _a11;
12603
+ return (_a11 = this._snapshot.body) == null ? void 0 : _a11.pages;
12546
12604
  }
12547
12605
  getPageOrder() {
12548
- var _a13;
12549
- return (_a13 = this._snapshot.body) == null ? void 0 : _a13.pageOrder;
12606
+ var _a11;
12607
+ return (_a11 = this._snapshot.body) == null ? void 0 : _a11.pageOrder;
12550
12608
  }
12551
12609
  getPage(pageId) {
12552
12610
  const pages = this.getPages();
12553
12611
  return pages == null ? void 0 : pages[pageId];
12554
12612
  }
12555
12613
  getElementsByPage(pageId) {
12556
- var _a13;
12557
- return (_a13 = this.getPage(pageId)) == null ? void 0 : _a13.pageElements;
12614
+ var _a11;
12615
+ return (_a11 = this.getPage(pageId)) == null ? void 0 : _a11.pageElements;
12558
12616
  }
12559
12617
  getElement(pageId, elementId) {
12560
- var _a13;
12561
- return (_a13 = this.getElementsByPage(pageId)) == null ? void 0 : _a13[elementId];
12618
+ var _a11;
12619
+ return (_a11 = this.getElementsByPage(pageId)) == null ? void 0 : _a11[elementId];
12562
12620
  }
12563
12621
  getPageSize() {
12564
12622
  return this._snapshot.pageSize;
@@ -12587,10 +12645,10 @@ const _SlideDataModel = class _SlideDataModel extends UnitModel {
12587
12645
  this._snapshot.body && (this._snapshot.body.pages[pageId] = page);
12588
12646
  }
12589
12647
  appendPage(page) {
12590
- var _a13;
12648
+ var _a11;
12591
12649
  if (!this._snapshot.body) return;
12592
12650
  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 : "");
12651
+ const activePage = this._activePage, index2 = this._snapshot.body.pageOrder.indexOf((_a11 = activePage == null ? void 0 : activePage.id) != null ? _a11 : "");
12594
12652
  this._snapshot.body.pageOrder.splice(index2 + 1, 0, page.id);
12595
12653
  }
12596
12654
  };
@@ -12602,8 +12660,8 @@ var __defProp$4 = Object.defineProperty, __getOwnPropDesc$4 = Object.getOwnPrope
12602
12660
  return kind && result && __defProp$4(target, key, result), result;
12603
12661
  }, "__decorateClass$4"), __decorateParam$4 = /* @__PURE__ */ __name((index2, decorator) => (target, key) => decorator(target, key, index2), "__decorateParam$4");
12604
12662
  const IUniverInstanceService = createIdentifier("univer.current");
12605
- var _a6;
12606
- let UniverInstanceService = (_a6 = class extends Disposable {
12663
+ var _a5;
12664
+ let UniverInstanceService = (_a5 = class extends Disposable {
12607
12665
  constructor(_injector, _contextService) {
12608
12666
  super();
12609
12667
  __publicField(this, "_unitsByType", /* @__PURE__ */ new Map());
@@ -12638,8 +12696,8 @@ let UniverInstanceService = (_a6 = class extends Disposable {
12638
12696
  }
12639
12697
  getCurrentTypeOfUnit$(type2) {
12640
12698
  return this.currentUnits$.pipe(map((units) => {
12641
- var _a13;
12642
- return (_a13 = units.get(type2)) != null ? _a13 : null;
12699
+ var _a11;
12700
+ return (_a11 = units.get(type2)) != null ? _a11 : null;
12643
12701
  }), distinctUntilChanged());
12644
12702
  }
12645
12703
  getCurrentUnitForType(type2) {
@@ -12661,20 +12719,20 @@ let UniverInstanceService = (_a6 = class extends Disposable {
12661
12719
  * @param unit The unit to be added.
12662
12720
  */
12663
12721
  __addUnit(unit, options) {
12664
- var _a13;
12722
+ var _a11;
12665
12723
  const type2 = unit.type;
12666
12724
  this._unitsByType.has(type2) || this._unitsByType.set(type2, []);
12667
12725
  const units = this._unitsByType.get(type2), newUnitId = unit.getUnitId();
12668
12726
  if (units.findIndex((u) => u.getUnitId() === newUnitId) !== -1)
12669
12727
  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());
12728
+ units.push(unit), this._unitAdded$.next(unit), ((_a11 = options == null ? void 0 : options.makeCurrent) == null || _a11) && this.setCurrentUnitForType(unit.getUnitId());
12671
12729
  }
12672
12730
  getTypeOfUnitDisposed$(type2) {
12673
12731
  return this.unitDisposed$.pipe(filter((unit) => unit.type === type2));
12674
12732
  }
12675
12733
  getUnit(id, type2) {
12676
- var _a13;
12677
- const unit = (_a13 = this._getUnitById(id)) == null ? void 0 : _a13[0];
12734
+ var _a11;
12735
+ const unit = (_a11 = this._getUnitById(id)) == null ? void 0 : _a11[0];
12678
12736
  return type2 && (unit == null ? void 0 : unit.type) !== type2 ? null : unit;
12679
12737
  }
12680
12738
  getCurrentUniverDocInstance() {
@@ -12687,8 +12745,8 @@ let UniverInstanceService = (_a6 = class extends Disposable {
12687
12745
  return this.getUnit(unitId, I.UNIVER_SHEET);
12688
12746
  }
12689
12747
  getAllUnitsForType(type2) {
12690
- var _a13;
12691
- return (_a13 = this._unitsByType.get(type2)) != null ? _a13 : [];
12748
+ var _a11;
12749
+ return (_a11 = this._unitsByType.get(type2)) != null ? _a11 : [];
12692
12750
  }
12693
12751
  changeDoc(unitId, doc) {
12694
12752
  const allDocs = this.getAllUnitsForType(I.UNIVER_DOC), oldDoc = allDocs.find((doc2) => doc2.getUnitId() === unitId);
@@ -12699,9 +12757,9 @@ let UniverInstanceService = (_a6 = class extends Disposable {
12699
12757
  this.__addUnit(doc);
12700
12758
  }
12701
12759
  get focused() {
12702
- var _a13;
12760
+ var _a11;
12703
12761
  const id = this._focused$.getValue();
12704
- return id ? (_a13 = this._getUnitById(id)) == null ? void 0 : _a13[0] : null;
12762
+ return id ? (_a11 = this._getUnitById(id)) == null ? void 0 : _a11[0] : null;
12705
12763
  }
12706
12764
  focusUnit(id) {
12707
12765
  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 +12782,8 @@ let UniverInstanceService = (_a6 = class extends Disposable {
12724
12782
  (current == null ? void 0 : current.getUnitId()) === unitId && (this._currentUnits.set(type2, null), this._currentUnits$.next(this._currentUnits));
12725
12783
  }
12726
12784
  _tryBlurUnitOnRemoval(unitId) {
12727
- var _a13;
12728
- ((_a13 = this.focused) == null ? void 0 : _a13.getUnitId()) === unitId && this._focused$.next(null);
12785
+ var _a11;
12786
+ ((_a11 = this.focused) == null ? void 0 : _a11.getUnitId()) === unitId && this._focused$.next(null);
12729
12787
  }
12730
12788
  _getUnitById(unitId) {
12731
12789
  for (const [type2, units] of this._unitsByType) {
@@ -12734,17 +12792,24 @@ let UniverInstanceService = (_a6 = class extends Disposable {
12734
12792
  return [unit, type2];
12735
12793
  }
12736
12794
  }
12737
- }, __name(_a6, "UniverInstanceService"), _a6);
12795
+ }, __name(_a5, "UniverInstanceService"), _a5);
12738
12796
  UniverInstanceService = __decorateClass$4([
12739
12797
  __decorateParam$4(0, Inject(Injector)),
12740
12798
  __decorateParam$4(1, IContextService)
12741
12799
  ], UniverInstanceService);
12800
+ 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 || {});
12801
+ const LifecycleNameMap = {
12802
+ 0: "Starting",
12803
+ 1: "Ready",
12804
+ 2: "Rendered",
12805
+ 3: "Steady"
12806
+ };
12742
12807
  var __defProp$3 = Object.defineProperty, __getOwnPropDesc$3 = Object.getOwnPropertyDescriptor, __decorateClass$3 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
12743
12808
  for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$3(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
12744
12809
  (decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
12745
12810
  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 {
12811
+ }, "__decorateClass$3"), __decorateParam$3 = /* @__PURE__ */ __name((index2, decorator) => (target, key) => decorator(target, key, index2), "__decorateParam$3"), _a6;
12812
+ let LifecycleService = (_a6 = class extends Disposable {
12748
12813
  constructor(_logService) {
12749
12814
  super();
12750
12815
  __publicField(this, "_lifecycle$", new BehaviorSubject(LifecycleStages.Starting));
@@ -12774,27 +12839,10 @@ let LifecycleService = (_a7 = class extends Disposable {
12774
12839
  _reportProgress(stage) {
12775
12840
  this._logService.debug("[LifecycleService]", `lifecycle progressed to "${LifecycleNameMap[stage]}".`);
12776
12841
  }
12777
- }, __name(_a7, "LifecycleService"), _a7);
12842
+ }, __name(_a6, "LifecycleService"), _a6);
12778
12843
  LifecycleService = __decorateClass$3([
12779
12844
  __decorateParam$3(0, ILogService)
12780
12845
  ], 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
12846
  function getLifecycleStagesAndBefore(lifecycleStage) {
12799
12847
  switch (lifecycleStage) {
12800
12848
  case LifecycleStages.Starting:
@@ -12867,15 +12915,15 @@ const ILocalStorageService = createIdentifier("ILocalStorageService"), _LocaleSe
12867
12915
  * @param locales - Locale object
12868
12916
  */
12869
12917
  load(locales) {
12870
- var _a13;
12871
- this._locales = Tools.deepMerge((_a13 = this._locales) != null ? _a13 : {}, locales);
12918
+ var _a11;
12919
+ this._locales = Tools.deepMerge((_a11 = this._locales) != null ? _a11 : {}, locales);
12872
12920
  }
12873
12921
  setLocale(locale) {
12874
12922
  this._currentLocale$.next(locale), this.localeChanged$.next();
12875
12923
  }
12876
12924
  getLocales() {
12877
- var _a13;
12878
- return (_a13 = this._locales) == null ? void 0 : _a13[this._currentLocale];
12925
+ var _a11;
12926
+ return (_a11 = this._locales) == null ? void 0 : _a11[this._currentLocale];
12879
12927
  }
12880
12928
  getCurrentLocale() {
12881
12929
  return this._currentLocale;
@@ -12892,9 +12940,7 @@ const ILocalStorageService = createIdentifier("ILocalStorageService"), _LocaleSe
12892
12940
  __name(_LocaleService, "LocaleService");
12893
12941
  let LocaleService = _LocaleService;
12894
12942
  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 {
12943
+ const IPermissionService = createIdentifier("univer.permission-service"), _PermissionService = class _PermissionService extends Disposable {
12898
12944
  constructor() {
12899
12945
  super(...arguments);
12900
12946
  __publicField(this, "_permissionPointMap", /* @__PURE__ */ new Map());
@@ -12935,8 +12981,8 @@ const _PermissionService = class _PermissionService extends Disposable {
12935
12981
  }
12936
12982
  composePermission$(permissionIdList) {
12937
12983
  const subjectList = permissionIdList.map((id) => {
12938
- var _a13;
12939
- const subject = (_a13 = this._permissionPointMap) == null ? void 0 : _a13.get(id);
12984
+ var _a11;
12985
+ const subject = (_a11 = this._permissionPointMap) == null ? void 0 : _a11.get(id);
12940
12986
  if (!subject)
12941
12987
  throw new Error(`[PermissionService]: ${id} permissionPoint does not exist!`);
12942
12988
  return subject.asObservable();
@@ -12948,8 +12994,8 @@ const _PermissionService = class _PermissionService extends Disposable {
12948
12994
  }
12949
12995
  composePermission(permissionIdList) {
12950
12996
  return permissionIdList.map((id) => {
12951
- var _a13;
12952
- const subject = (_a13 = this._permissionPointMap) == null ? void 0 : _a13.get(id);
12997
+ var _a11;
12998
+ const subject = (_a11 = this._permissionPointMap) == null ? void 0 : _a11.get(id);
12953
12999
  if (!subject)
12954
13000
  throw new Error(`[PermissionService]: ${id} permissionPoint does not exist!`);
12955
13001
  return subject.getValue();
@@ -12965,7 +13011,7 @@ const _PermissionService = class _PermissionService extends Disposable {
12965
13011
  __name(_PermissionService, "PermissionService");
12966
13012
  let PermissionService = _PermissionService;
12967
13013
  const DependentOnSymbol = Symbol("DependentOn"), _Plugin = class _Plugin extends Disposable {
12968
- onStarting(_injector) {
13014
+ onStarting() {
12969
13015
  }
12970
13016
  onReady() {
12971
13017
  }
@@ -13028,8 +13074,8 @@ function DependentOn(...plugins) {
13028
13074
  };
13029
13075
  }
13030
13076
  __name(DependentOn, "DependentOn");
13031
- var _a9;
13032
- let PluginService = (_a9 = class {
13077
+ var _a7;
13078
+ let PluginService = (_a7 = class {
13033
13079
  constructor(_injector) {
13034
13080
  __publicField(this, "_pluginHolderForUniver");
13035
13081
  __publicField(this, "_pluginHoldersForTypes", /* @__PURE__ */ new Map());
@@ -13039,7 +13085,7 @@ let PluginService = (_a9 = class {
13039
13085
  PluginHolder,
13040
13086
  this._checkPluginSeen.bind(this),
13041
13087
  this._immediateInitPlugin.bind(this)
13042
- ), this._pluginHolderForUniver.start();
13088
+ ), this._pluginHoldersForTypes.set(I.UNIVER_UNKNOWN, this._pluginHolderForUniver), this._pluginHolderForUniver.start();
13043
13089
  }
13044
13090
  dispose() {
13045
13091
  this._clearFlushTimer();
@@ -13099,13 +13145,13 @@ let PluginService = (_a9 = class {
13099
13145
  for (const [_, holder] of this._pluginHoldersForTypes)
13100
13146
  holder.started && holder.flush();
13101
13147
  }
13102
- }, __name(_a9, "PluginService"), _a9);
13148
+ }, __name(_a7, "PluginService"), _a7);
13103
13149
  PluginService = __decorateClass$2([
13104
13150
  __decorateParam$2(0, Inject(Injector))
13105
13151
  ], PluginService);
13106
- var _a10;
13107
- let PluginHolder = (_a10 = class extends Disposable {
13108
- constructor(_checkPluginRegistered, _registerPlugin, _logService, _injector, _lifecycleService, _lifecycleInitializerService) {
13152
+ var _a8;
13153
+ let PluginHolder = (_a8 = class extends Disposable {
13154
+ constructor(_checkPluginRegistered, _registerPlugin, _logService, _injector, _lifecycleService) {
13109
13155
  super();
13110
13156
  __publicField(this, "_started", !1);
13111
13157
  __publicField(this, "_warnedAboutOnStartingDeprecation", !1);
@@ -13113,16 +13159,17 @@ let PluginHolder = (_a10 = class extends Disposable {
13113
13159
  __publicField(this, "_pluginRegistry", new PluginRegistry());
13114
13160
  /** Stores initialized plugin instances. */
13115
13161
  __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));
13162
+ /** Plugins instances as they are registered in batches. */
13163
+ __publicField(this, "_pluginsInBatches", []);
13164
+ 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) => {
13165
+ this._pluginsInBatches.forEach((plugins) => this._runStage(plugins, stage));
13119
13166
  }));
13120
13167
  }
13121
13168
  get started() {
13122
13169
  return this._started;
13123
13170
  }
13124
13171
  dispose() {
13125
- super.dispose(), this._pluginStore.forEachPlugin((plugin) => plugin.dispose()), this._pluginStore.removePlugins(), this._pluginRegistry.removePlugins(), this._awaitingPlugins.length = 0;
13172
+ super.dispose(), this._pluginStore.forEachPlugin((plugin) => plugin.dispose()), this._pluginStore.removePlugins(), this._pluginRegistry.removePlugins(), this._pluginsInBatches.length = 0;
13126
13173
  }
13127
13174
  register(pluginCtor, config) {
13128
13175
  this._pluginRegistry.registerPlugin(pluginCtor, config);
@@ -13160,17 +13207,13 @@ let PluginHolder = (_a10 = class extends Disposable {
13160
13207
  // Here we should be careful with the sequence of which plugin should run first. We should manually add a queue here.
13161
13208
  // Because lately registered plugins may get executed first.
13162
13209
  _pluginsRunLifecycle(plugins) {
13163
- getLifecycleStagesAndBefore(this._lifecycleService.stage).subscribe((stage) => this._runStage(plugins, stage)), this._awaitingPlugins.push(plugins);
13210
+ getLifecycleStagesAndBefore(this._lifecycleService.stage).subscribe((stage) => this._runStage(plugins, stage)), this._pluginsInBatches.push(plugins);
13164
13211
  }
13165
13212
  _runStage(plugins, stage) {
13166
13213
  plugins.forEach((p) => {
13167
13214
  switch (stage) {
13168
13215
  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);
13216
+ p.onStarting();
13174
13217
  break;
13175
13218
  case LifecycleStages.Ready:
13176
13219
  p.onReady();
@@ -13182,14 +13225,13 @@ let PluginHolder = (_a10 = class extends Disposable {
13182
13225
  p.onSteady();
13183
13226
  break;
13184
13227
  }
13185
- }), this._lifecycleInitializerService.initModulesOnStage(stage);
13228
+ });
13186
13229
  }
13187
- }, __name(_a10, "PluginHolder"), _a10);
13230
+ }, __name(_a8, "PluginHolder"), _a8);
13188
13231
  PluginHolder = __decorateClass$2([
13189
13232
  __decorateParam$2(2, ILogService),
13190
13233
  __decorateParam$2(3, Inject(Injector)),
13191
- __decorateParam$2(4, Inject(LifecycleService)),
13192
- __decorateParam$2(5, Inject(LifecycleInitializerService))
13234
+ __decorateParam$2(4, Inject(LifecycleService))
13193
13235
  ], PluginHolder);
13194
13236
  function mergeOverrideWithDependencies(dependencies, override) {
13195
13237
  if (!override) return dependencies;
@@ -13205,9 +13247,7 @@ function mergeOverrideWithDependencies(dependencies, override) {
13205
13247
  return result;
13206
13248
  }
13207
13249
  __name(mergeOverrideWithDependencies, "mergeOverrideWithDependencies");
13208
- const IResourceLoaderService = createIdentifier("resource-loader-service");
13209
- runOnLifecycle(LifecycleStages.Ready, IResourceLoaderService);
13210
- const _ResourceManagerService = class _ResourceManagerService extends Disposable {
13250
+ const IResourceLoaderService = createIdentifier("resource-loader-service"), _ResourceManagerService = class _ResourceManagerService extends Disposable {
13211
13251
  constructor() {
13212
13252
  super(...arguments);
13213
13253
  __publicField(this, "_resourceMap", /* @__PURE__ */ new Map());
@@ -13246,8 +13286,8 @@ const _ResourceManagerService = class _ResourceManagerService extends Disposable
13246
13286
  }
13247
13287
  loadResources(unitId, resources) {
13248
13288
  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;
13289
+ var _a11;
13290
+ const data = (_a11 = resources == null ? void 0 : resources.find((resource) => resource.name === hook.pluginName)) == null ? void 0 : _a11.data;
13251
13291
  if (data)
13252
13292
  try {
13253
13293
  const model = hook.parseJson(data);
@@ -13328,8 +13368,8 @@ const RedoCommandId = "univer.command.redo", UndoCommandId = "univer.command.und
13328
13368
  return sequenceExecute(element.redoMutations, commandService) ? (undoRedoService.popRedoToUndo(), !0) : !1;
13329
13369
  }
13330
13370
  }();
13331
- var _a11;
13332
- let LocalUndoRedoService = (_a11 = class extends Disposable {
13371
+ var _a9;
13372
+ let LocalUndoRedoService = (_a9 = class extends Disposable {
13333
13373
  constructor(_univerInstanceService, _commandService, _contextService) {
13334
13374
  super();
13335
13375
  __publicField(this, "undoRedoStatus$");
@@ -13396,8 +13436,8 @@ let LocalUndoRedoService = (_a11 = class extends Disposable {
13396
13436
  ), toDisposable(() => this._batchingStatus.delete(unitId));
13397
13437
  }
13398
13438
  _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;
13439
+ var _a11, _b2;
13440
+ 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
13441
  this._undoRedoStatus$.next({
13402
13442
  undos,
13403
13443
  redos
@@ -13427,12 +13467,12 @@ let LocalUndoRedoService = (_a11 = class extends Disposable {
13427
13467
  item.redoMutations.push(...newItem.redoMutations), item.undoMutations.push(...newItem.undoMutations);
13428
13468
  }
13429
13469
  _getFocusedUnitId() {
13430
- var _a13, _b2, _c, _d;
13470
+ var _a11, _b2, _c, _d;
13431
13471
  let unitID = "";
13432
13472
  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;
13473
+ 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
13474
  }
13435
- }, __name(_a11, "LocalUndoRedoService"), _a11);
13475
+ }, __name(_a9, "LocalUndoRedoService"), _a9);
13436
13476
  LocalUndoRedoService = __decorateClass$1([
13437
13477
  __decorateParam$1(0, IUniverInstanceService),
13438
13478
  __decorateParam$1(1, ICommandService),
@@ -13450,12 +13490,405 @@ const isRangesEqual = /* @__PURE__ */ __name((oldRanges, ranges) => ranges.lengt
13450
13490
  const current = ranges[i];
13451
13491
  return current.unitId === oldRange.unitId && current.sheetId === oldRange.sheetId && Rectangle.equals(oldRange.range, current.range);
13452
13492
  }), "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) => {
13493
+ 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 || {});
13494
+ function quickselect(arr, k, left = 0, right = arr.length - 1, compare = defaultCompare) {
13495
+ for (; right > left; ) {
13496
+ if (right - left > 600) {
13497
+ 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));
13498
+ quickselect(arr, k, newLeft, newRight, compare);
13499
+ }
13500
+ const t = arr[k];
13501
+ let i = left, j = right;
13502
+ for (swap(arr, left, k), compare(arr[right], t) > 0 && swap(arr, left, right); i < j; ) {
13503
+ for (swap(arr, i, j), i++, j--; compare(arr[i], t) < 0; ) i++;
13504
+ for (; compare(arr[j], t) > 0; ) j--;
13505
+ }
13506
+ compare(arr[left], t) === 0 ? swap(arr, left, j) : (j++, swap(arr, j, right)), j <= k && (left = j + 1), k <= j && (right = j - 1);
13507
+ }
13508
+ }
13509
+ __name(quickselect, "quickselect");
13510
+ function swap(arr, i, j) {
13511
+ const tmp = arr[i];
13512
+ arr[i] = arr[j], arr[j] = tmp;
13513
+ }
13514
+ __name(swap, "swap");
13515
+ function defaultCompare(a, b) {
13516
+ return a < b ? -1 : a > b ? 1 : 0;
13517
+ }
13518
+ __name(defaultCompare, "defaultCompare");
13519
+ const _RBush = class _RBush {
13520
+ constructor(maxEntries = 9) {
13521
+ this._maxEntries = Math.max(4, maxEntries), this._minEntries = Math.max(2, Math.ceil(this._maxEntries * 0.4)), this.clear();
13522
+ }
13523
+ all() {
13524
+ return this._all(this.data, []);
13525
+ }
13526
+ search(bbox) {
13527
+ let node = this.data;
13528
+ const result = [];
13529
+ if (!intersects(bbox, node)) return result;
13530
+ const toBBox = this.toBBox, nodesToSearch = [];
13531
+ for (; node; ) {
13532
+ for (let i = 0; i < node.children.length; i++) {
13533
+ const child = node.children[i], childBBox = node.leaf ? toBBox(child) : child;
13534
+ intersects(bbox, childBBox) && (node.leaf ? result.push(child) : contains(bbox, childBBox) ? this._all(child, result) : nodesToSearch.push(child));
13535
+ }
13536
+ node = nodesToSearch.pop();
13537
+ }
13538
+ return result;
13539
+ }
13540
+ collides(bbox) {
13541
+ let node = this.data;
13542
+ if (!intersects(bbox, node)) return !1;
13543
+ const nodesToSearch = [];
13544
+ for (; node; ) {
13545
+ for (let i = 0; i < node.children.length; i++) {
13546
+ const child = node.children[i], childBBox = node.leaf ? this.toBBox(child) : child;
13547
+ if (intersects(bbox, childBBox)) {
13548
+ if (node.leaf || contains(bbox, childBBox)) return !0;
13549
+ nodesToSearch.push(child);
13550
+ }
13551
+ }
13552
+ node = nodesToSearch.pop();
13553
+ }
13554
+ return !1;
13555
+ }
13556
+ load(data) {
13557
+ if (!(data && data.length)) return this;
13558
+ if (data.length < this._minEntries) {
13559
+ for (let i = 0; i < data.length; i++)
13560
+ this.insert(data[i]);
13561
+ return this;
13562
+ }
13563
+ let node = this._build(data.slice(), 0, data.length - 1, 0);
13564
+ if (!this.data.children.length)
13565
+ this.data = node;
13566
+ else if (this.data.height === node.height)
13567
+ this._splitRoot(this.data, node);
13568
+ else {
13569
+ if (this.data.height < node.height) {
13570
+ const tmpNode = this.data;
13571
+ this.data = node, node = tmpNode;
13572
+ }
13573
+ this._insert(node, this.data.height - node.height - 1, !0);
13574
+ }
13575
+ return this;
13576
+ }
13577
+ insert(item) {
13578
+ return item && this._insert(item, this.data.height - 1), this;
13579
+ }
13580
+ clear() {
13581
+ return this.data = createNode([]), this;
13582
+ }
13583
+ remove(item, equalsFn) {
13584
+ if (!item) return this;
13585
+ let node = this.data;
13586
+ const bbox = this.toBBox(item), path = [], indexes = [];
13587
+ let i, parent, goingUp;
13588
+ for (; node || path.length; ) {
13589
+ if (node || (node = path.pop(), parent = path[path.length - 1], i = indexes.pop(), goingUp = !0), node.leaf) {
13590
+ const index2 = findItem(item, node.children, equalsFn);
13591
+ if (index2 !== -1)
13592
+ return node.children.splice(index2, 1), path.push(node), this._condense(path), this;
13593
+ }
13594
+ !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;
13595
+ }
13596
+ return this;
13597
+ }
13598
+ toBBox(item) {
13599
+ return item;
13600
+ }
13601
+ compareMinX(a, b) {
13602
+ return a.minX - b.minX;
13603
+ }
13604
+ compareMinY(a, b) {
13605
+ return a.minY - b.minY;
13606
+ }
13607
+ toJSON() {
13608
+ return this.data;
13609
+ }
13610
+ fromJSON(data) {
13611
+ return this.data = data, this;
13612
+ }
13613
+ _all(node, result) {
13614
+ const nodesToSearch = [];
13615
+ for (; node; )
13616
+ node.leaf ? result.push(...node.children) : nodesToSearch.push(...node.children), node = nodesToSearch.pop();
13617
+ return result;
13618
+ }
13619
+ _build(items, left, right, height) {
13620
+ const N = right - left + 1;
13621
+ let M = this._maxEntries, node;
13622
+ if (N <= M)
13623
+ return node = createNode(items.slice(left, right + 1)), calcBBox(node, this.toBBox), node;
13624
+ 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;
13625
+ const N2 = Math.ceil(N / M), N1 = N2 * Math.ceil(Math.sqrt(M));
13626
+ multiSelect(items, left, right, N1, this.compareMinX);
13627
+ for (let i = left; i <= right; i += N1) {
13628
+ const right2 = Math.min(i + N1 - 1, right);
13629
+ multiSelect(items, i, right2, N2, this.compareMinY);
13630
+ for (let j = i; j <= right2; j += N2) {
13631
+ const right3 = Math.min(j + N2 - 1, right2);
13632
+ node.children.push(this._build(items, j, right3, height - 1));
13633
+ }
13634
+ }
13635
+ return calcBBox(node, this.toBBox), node;
13636
+ }
13637
+ _chooseSubtree(bbox, node, level, path) {
13638
+ for (; path.push(node), !(node.leaf || path.length - 1 === level); ) {
13639
+ let minArea = 1 / 0, minEnlargement = 1 / 0, targetNode;
13640
+ for (let i = 0; i < node.children.length; i++) {
13641
+ const child = node.children[i], area = bboxArea(child), enlargement = enlargedArea(bbox, child) - area;
13642
+ enlargement < minEnlargement ? (minEnlargement = enlargement, minArea = area < minArea ? area : minArea, targetNode = child) : enlargement === minEnlargement && area < minArea && (minArea = area, targetNode = child);
13643
+ }
13644
+ node = targetNode || node.children[0];
13645
+ }
13646
+ return node;
13647
+ }
13648
+ _insert(item, level, isNode2) {
13649
+ const bbox = isNode2 ? item : this.toBBox(item), insertPath = [], node = this._chooseSubtree(bbox, this.data, level, insertPath);
13650
+ for (node.children.push(item), extend(node, bbox); level >= 0 && insertPath[level].children.length > this._maxEntries; )
13651
+ this._split(insertPath, level), level--;
13652
+ this._adjustParentBBoxes(bbox, insertPath, level);
13653
+ }
13654
+ // split overflowed node into two
13655
+ _split(insertPath, level) {
13656
+ const node = insertPath[level], M = node.children.length, m = this._minEntries;
13657
+ this._chooseSplitAxis(node, m, M);
13658
+ const splitIndex = this._chooseSplitIndex(node, m, M), newNode = createNode(node.children.splice(splitIndex, node.children.length - splitIndex));
13659
+ 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);
13660
+ }
13661
+ _splitRoot(node, newNode) {
13662
+ this.data = createNode([node, newNode]), this.data.height = node.height + 1, this.data.leaf = !1, calcBBox(this.data, this.toBBox);
13663
+ }
13664
+ _chooseSplitIndex(node, m, M) {
13665
+ let index2, minOverlap = 1 / 0, minArea = 1 / 0;
13666
+ for (let i = m; i <= M - m; i++) {
13667
+ const bbox1 = distBBox(node, 0, i, this.toBBox), bbox2 = distBBox(node, i, M, this.toBBox), overlap = intersectionArea(bbox1, bbox2), area = bboxArea(bbox1) + bboxArea(bbox2);
13668
+ overlap < minOverlap ? (minOverlap = overlap, index2 = i, minArea = area < minArea ? area : minArea) : overlap === minOverlap && area < minArea && (minArea = area, index2 = i);
13669
+ }
13670
+ return index2 || M - m;
13671
+ }
13672
+ // sorts node children by the best axis for split
13673
+ _chooseSplitAxis(node, m, M) {
13674
+ 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);
13675
+ xMargin < yMargin && node.children.sort(compareMinX);
13676
+ }
13677
+ // total margin of all possible split distributions where each node is at least m full
13678
+ _allDistMargin(node, m, M, compare) {
13679
+ node.children.sort(compare);
13680
+ const toBBox = this.toBBox, leftBBox = distBBox(node, 0, m, toBBox), rightBBox = distBBox(node, M - m, M, toBBox);
13681
+ let margin = bboxMargin(leftBBox) + bboxMargin(rightBBox);
13682
+ for (let i = m; i < M - m; i++) {
13683
+ const child = node.children[i];
13684
+ extend(leftBBox, node.leaf ? toBBox(child) : child), margin += bboxMargin(leftBBox);
13685
+ }
13686
+ for (let i = M - m - 1; i >= m; i--) {
13687
+ const child = node.children[i];
13688
+ extend(rightBBox, node.leaf ? toBBox(child) : child), margin += bboxMargin(rightBBox);
13689
+ }
13690
+ return margin;
13691
+ }
13692
+ _adjustParentBBoxes(bbox, path, level) {
13693
+ for (let i = level; i >= 0; i--)
13694
+ extend(path[i], bbox);
13695
+ }
13696
+ _condense(path) {
13697
+ for (let i = path.length - 1, siblings; i >= 0; i--)
13698
+ 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);
13699
+ }
13700
+ };
13701
+ __name(_RBush, "RBush");
13702
+ let RBush = _RBush;
13703
+ function findItem(item, items, equalsFn) {
13704
+ if (!equalsFn) return items.indexOf(item);
13705
+ for (let i = 0; i < items.length; i++)
13706
+ if (equalsFn(item, items[i])) return i;
13707
+ return -1;
13708
+ }
13709
+ __name(findItem, "findItem");
13710
+ function calcBBox(node, toBBox) {
13711
+ distBBox(node, 0, node.children.length, toBBox, node);
13712
+ }
13713
+ __name(calcBBox, "calcBBox");
13714
+ function distBBox(node, k, p, toBBox, destNode) {
13715
+ destNode || (destNode = createNode(null)), destNode.minX = 1 / 0, destNode.minY = 1 / 0, destNode.maxX = -1 / 0, destNode.maxY = -1 / 0;
13716
+ for (let i = k; i < p; i++) {
13717
+ const child = node.children[i];
13718
+ extend(destNode, node.leaf ? toBBox(child) : child);
13719
+ }
13720
+ return destNode;
13721
+ }
13722
+ __name(distBBox, "distBBox");
13723
+ function extend(a, b) {
13724
+ 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;
13725
+ }
13726
+ __name(extend, "extend");
13727
+ function compareNodeMinX(a, b) {
13728
+ return a.minX - b.minX;
13729
+ }
13730
+ __name(compareNodeMinX, "compareNodeMinX");
13731
+ function compareNodeMinY(a, b) {
13732
+ return a.minY - b.minY;
13733
+ }
13734
+ __name(compareNodeMinY, "compareNodeMinY");
13735
+ function bboxArea(a) {
13736
+ return (a.maxX - a.minX) * (a.maxY - a.minY);
13737
+ }
13738
+ __name(bboxArea, "bboxArea");
13739
+ function bboxMargin(a) {
13740
+ return a.maxX - a.minX + (a.maxY - a.minY);
13741
+ }
13742
+ __name(bboxMargin, "bboxMargin");
13743
+ function enlargedArea(a, b) {
13744
+ 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));
13745
+ }
13746
+ __name(enlargedArea, "enlargedArea");
13747
+ function intersectionArea(a, b) {
13748
+ 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);
13749
+ return Math.max(0, maxX - minX) * Math.max(0, maxY - minY);
13750
+ }
13751
+ __name(intersectionArea, "intersectionArea");
13752
+ function contains(a, b) {
13753
+ return a.minX <= b.minX && a.minY <= b.minY && b.maxX <= a.maxX && b.maxY <= a.maxY;
13754
+ }
13755
+ __name(contains, "contains");
13756
+ function intersects(a, b) {
13757
+ return b.minX <= a.maxX && b.minY <= a.maxY && b.maxX >= a.minX && b.maxY >= a.minY;
13758
+ }
13759
+ __name(intersects, "intersects");
13760
+ function createNode(children) {
13761
+ return {
13762
+ children,
13763
+ height: 1,
13764
+ leaf: !0,
13765
+ minX: 1 / 0,
13766
+ minY: 1 / 0,
13767
+ maxX: -1 / 0,
13768
+ maxY: -1 / 0
13769
+ };
13770
+ }
13771
+ __name(createNode, "createNode");
13772
+ function multiSelect(arr, left, right, n, compare) {
13773
+ const stack = [left, right];
13774
+ for (; stack.length; ) {
13775
+ if (right = stack.pop(), left = stack.pop(), right - left <= n) continue;
13776
+ const mid = left + Math.ceil((right - left) / n / 2) * n;
13777
+ quickselect(arr, mid, left, right, compare), stack.push(left, mid, mid, right);
13778
+ }
13779
+ }
13780
+ __name(multiSelect, "multiSelect");
13781
+ const _RTree = class _RTree {
13782
+ constructor() {
13783
+ __publicField(this, "_tree", /* @__PURE__ */ new Map());
13784
+ }
13785
+ dispose() {
13786
+ this.clear();
13787
+ }
13788
+ getTree(unitId, subUnitId) {
13789
+ 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);
13790
+ }
13791
+ insert(item) {
13792
+ const { unitId, sheetId: subUnitId, range, id } = item;
13793
+ if (!unitId || unitId.length === 0)
13794
+ return;
13795
+ const tree = this.getTree(unitId, subUnitId);
13796
+ let { startRow: rangeStartRow, endRow: rangeEndRow, startColumn: rangeStartColumn, endColumn: rangeEndColumn } = range;
13797
+ 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({
13798
+ minX: rangeStartColumn,
13799
+ minY: rangeStartRow,
13800
+ maxX: rangeEndColumn,
13801
+ maxY: rangeEndRow,
13802
+ id
13803
+ });
13804
+ }
13805
+ bulkInsert(items) {
13806
+ for (const item of items)
13807
+ this.insert(item);
13808
+ }
13809
+ search(search) {
13810
+ var _a11;
13811
+ const { unitId, sheetId: subUnitId, range } = search, tree = (_a11 = this._tree.get(unitId)) == null ? void 0 : _a11.get(subUnitId);
13812
+ if (!tree)
13813
+ return /* @__PURE__ */ new Map();
13814
+ const result = /* @__PURE__ */ new Map();
13815
+ return tree.search({
13816
+ minX: range.startColumn,
13817
+ minY: range.startRow,
13818
+ maxX: range.endColumn,
13819
+ maxY: range.endRow
13820
+ }).forEach((item) => {
13821
+ result.set(item.id, {
13822
+ unitId,
13823
+ sheetId: subUnitId,
13824
+ id: item.id,
13825
+ range: {
13826
+ startColumn: item.minX,
13827
+ startRow: item.minY,
13828
+ endColumn: item.maxX,
13829
+ endRow: item.maxY
13830
+ }
13831
+ });
13832
+ }), result;
13833
+ }
13834
+ bulkSearch(searchList) {
13835
+ const result = /* @__PURE__ */ new Map();
13836
+ for (const search of searchList) {
13837
+ const items = this.search(search);
13838
+ items.forEach((value, key) => {
13839
+ result.set(key, value);
13840
+ }), items.clear();
13841
+ }
13842
+ return result;
13843
+ }
13844
+ removeById(unitId, subUnitId) {
13845
+ var _a11;
13846
+ subUnitId ? (_a11 = this._tree.get(unitId)) == null || _a11.delete(subUnitId) : this._tree.delete(unitId);
13847
+ }
13848
+ remove(search) {
13849
+ const { unitId, sheetId: subUnitId, range, id } = search;
13850
+ this.getTree(unitId, subUnitId).remove({
13851
+ minX: range.startColumn,
13852
+ minY: range.startRow,
13853
+ maxX: range.endColumn,
13854
+ maxY: range.endRow,
13855
+ id
13856
+ });
13857
+ }
13858
+ bulkRemove(searchList) {
13859
+ for (const search of searchList)
13860
+ this.remove(search);
13861
+ }
13862
+ clear() {
13863
+ this._tree.clear();
13864
+ }
13865
+ toJSON() {
13866
+ const result = {};
13867
+ return this._tree.forEach((subTree, unitId) => {
13868
+ result[unitId] = {}, subTree.forEach((tree, subUnitId) => {
13869
+ result[unitId][subUnitId] = tree.toJSON();
13870
+ });
13871
+ }), result;
13872
+ }
13873
+ fromJSON(data) {
13874
+ this._tree.clear();
13875
+ for (const unitId in data) {
13876
+ this._tree.set(unitId, /* @__PURE__ */ new Map());
13877
+ for (const subUnitId in data[unitId]) {
13878
+ const tree = new RBush();
13879
+ tree.fromJSON(data[unitId][subUnitId]), this._tree.get(unitId).set(subUnitId, tree);
13880
+ }
13881
+ }
13882
+ }
13883
+ };
13884
+ __name(_RTree, "RTree");
13885
+ let RTree = _RTree;
13886
+ var __defProp2 = Object.defineProperty, __getOwnPropDesc = Object.getOwnPropertyDescriptor, __decorateClass = /* @__PURE__ */ __name((decorators, target, key, kind) => {
13454
13887
  for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
13455
13888
  (decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
13456
13889
  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 {
13890
+ }, "__decorateClass"), __decorateParam = /* @__PURE__ */ __name((index2, decorator) => (target, key) => decorator(target, key, index2), "__decorateParam"), _a10;
13891
+ let ResourceLoaderService = (_a10 = class extends Disposable {
13459
13892
  constructor(_resourceManagerService, _univerInstanceService) {
13460
13893
  super(), this._resourceManagerService = _resourceManagerService, this._univerInstanceService = _univerInstanceService, this._init();
13461
13894
  }
@@ -13519,7 +13952,7 @@ let ResourceLoaderService = (_a12 = class extends Disposable {
13519
13952
  const resources = this._resourceManagerService.getResources(unitId, unit.type), snapshot = Tools.deepClone(unit.getSnapshot());
13520
13953
  return snapshot.resources = resources, snapshot;
13521
13954
  }
13522
- }, __name(_a12, "ResourceLoaderService"), _a12);
13955
+ }, __name(_a10, "ResourceLoaderService"), _a10);
13523
13956
  ResourceLoaderService = __decorateClass([
13524
13957
  __decorateParam(0, Inject(IResourceManagerService)),
13525
13958
  __decorateParam(1, Inject(IUniverInstanceService))
@@ -13605,7 +14038,6 @@ function createUniverInjector(parentInjector, override) {
13605
14038
  [LocaleService],
13606
14039
  [ThemeService],
13607
14040
  [LifecycleService],
13608
- [LifecycleInitializerService],
13609
14041
  [PluginService],
13610
14042
  [UserManagerService],
13611
14043
  // abstract services
@@ -13619,8 +14051,11 @@ function createUniverInjector(parentInjector, override) {
13619
14051
  [IResourceManagerService, { useClass: ResourceManagerService, lazy: !0 }],
13620
14052
  [IResourceLoaderService, { useClass: ResourceLoaderService, lazy: !0 }],
13621
14053
  [IAuthzIoService, { useClass: AuthzIoLocalService, lazy: !0 }]
13622
- ], override);
13623
- return parentInjector ? parentInjector.createChild(dependencies) : new Injector(dependencies);
14054
+ ], override), injector = parentInjector ? parentInjector.createChild(dependencies) : new Injector(dependencies);
14055
+ return touchDependencies(injector, [
14056
+ [UserManagerService],
14057
+ [IResourceLoaderService]
14058
+ ]), injector;
13624
14059
  }
13625
14060
  __name(createUniverInjector, "createUniverInjector");
13626
14061
  installShims();
@@ -13750,7 +14185,6 @@ export {
13750
14185
  JSONX,
13751
14186
  LRUHelper,
13752
14187
  LRUMap,
13753
- LifecycleInitializerService,
13754
14188
  LifecycleService,
13755
14189
  LifecycleStages,
13756
14190
  LocalUndoRedoService,
@@ -13767,7 +14201,6 @@ export {
13767
14201
  ObjectMatrix,
13768
14202
  ObjectRelativeFromH,
13769
14203
  ObjectRelativeFromV,
13770
- OnLifecycle,
13771
14204
  Optional,
13772
14205
  OtherShapes,
13773
14206
  PRESET_LIST_TYPE,
@@ -13791,6 +14224,7 @@ export {
13791
14224
  RGBA_PAREN,
13792
14225
  RGB_PAREN,
13793
14226
  ROTATE_BUFFER_VALUE,
14227
+ RTree,
13794
14228
  Range,
13795
14229
  Rectangle,
13796
14230
  RediConsumer,
@@ -13894,6 +14328,7 @@ export {
13894
14328
  getCustomDecorationSlice,
13895
14329
  getCustomRangeSlice,
13896
14330
  getDocsUpdateBody,
14331
+ getIntersectRange,
13897
14332
  getOriginCellValue,
13898
14333
  getReverseDirection,
13899
14334
  getWorksheetUID,
@@ -13948,12 +14383,12 @@ export {
13948
14383
  numfmt,
13949
14384
  orderSearchArray,
13950
14385
  queryObjectMatrix,
14386
+ registerDependencies,
13951
14387
  remove,
13952
14388
  repeatStringNumTimes,
13953
14389
  replaceInDocumentBody,
13954
14390
  requestImmediateMacroTask,
13955
14391
  rotate,
13956
- runOnLifecycle,
13957
14392
  searchArray,
13958
14393
  selectionToArray,
13959
14394
  sequence,
@@ -13973,6 +14408,7 @@ export {
13973
14408
  takeAfter,
13974
14409
  throttle,
13975
14410
  toDisposable,
14411
+ touchDependencies,
13976
14412
  updateAttributeByDelete,
13977
14413
  updateAttributeByInsert,
13978
14414
  useDependency,