@sheetxl/sdk 0.7.28-beta.4 → 0.8.0-beta.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (565) hide show
  1. package/THIRD-PARTY-NOTICES.md +1 -1
  2. package/browser/esm/{DBIu6NUHIcxOOBQp.mjs → BEAY9XgKNx-bakXW.mjs} +2 -2
  3. package/browser/esm/BbSmt62FpFIpoVzu.mjs +392 -0
  4. package/browser/esm/BcHmrKHwMMOlzc9_.mjs +357 -0
  5. package/browser/esm/BgcZ-CoTbMfmyDJL.mjs +412 -0
  6. package/browser/esm/Bk7xxbdDpa7-sIwd.mjs +7 -0
  7. package/browser/esm/BqskM7wA8oPfFQue.mjs +20 -0
  8. package/browser/esm/Btg43M1Bf-ENDreu.mjs +540 -0
  9. package/browser/esm/BzLfNyc6OOShIErH.mjs +598 -0
  10. package/browser/esm/C9B0djuUarfNdoj0.mjs +466 -0
  11. package/browser/esm/{CHSahmMFYNB0Ajkf.mjs → CSx9ed1JOs7K5BXO.mjs} +2 -2
  12. package/browser/esm/CYyv6uGjo10ig5FP.mjs +142 -0
  13. package/browser/esm/CZ5oa92wZEAXebgk.mjs +622 -0
  14. package/browser/esm/CdLZWVcH8cncBUPJ.mjs +849 -0
  15. package/browser/esm/Cgd5BnM3hg9RyUel.mjs +171 -0
  16. package/browser/esm/CjsUGJEQSbGjnH6R.mjs +1001 -0
  17. package/browser/esm/ClB5ix51roQOpZEr.mjs +7402 -0
  18. package/browser/esm/{CKk58ZLcrllMzfou.mjs → Cqr3knDsBvoVZ6MN.mjs} +179 -202
  19. package/browser/esm/D4uVlrG0xEFctsSM.mjs +905 -0
  20. package/browser/esm/DOMHmhYzPcLVcpAW.mjs +7 -0
  21. package/browser/esm/DUvUK61b2_4pf4tG.mjs +484 -0
  22. package/browser/esm/De175LygU7ot4nQm.mjs +441 -0
  23. package/browser/esm/DhKkrCVASZ6Isvz6.mjs +527 -0
  24. package/browser/esm/Di58Ji1n--3Mgc_2.mjs +607 -0
  25. package/browser/esm/Dtoyt8q5RyGAlxCp.mjs +1141 -0
  26. package/browser/esm/Y79I7Sm8kjaYexhf.mjs +167 -0
  27. package/browser/esm/index.mjs +1472 -1023
  28. package/browser/esm/o8MFgcVXns987D6_.mjs +400 -0
  29. package/browser/esm/zqJOaweiXE9D8RY1.mjs +66681 -0
  30. package/licenses/dependencies.txt +209 -209
  31. package/node/esm/B6D7sSetrcOWLsKj.mjs +1135 -0
  32. package/node/esm/B9ljpEIZg6wOTzRE.mjs +142 -0
  33. package/node/esm/BH1v-E4Ro3bR7Znw.mjs +962 -0
  34. package/node/esm/BN9j8V9gCExMjVtJ.mjs +540 -0
  35. package/node/esm/{DUYP6faJJHCaW1Xf.mjs → Bh4dv6tMjXX3X4nI.mjs} +1 -1
  36. package/node/esm/Bqd62L8KFgdS0Vou.mjs +7 -0
  37. package/node/esm/Bsx9uijd4X_SKV3L.mjs +360 -0
  38. package/node/esm/BtuY37FumvLE7EBo.mjs +629 -0
  39. package/node/esm/C6ZXsNyLXI6zA63X.mjs +402 -0
  40. package/node/esm/CCouEwT37f08qO3V.mjs +7 -0
  41. package/node/esm/CD9wbvufChVYYkrI.mjs +451 -0
  42. package/node/esm/CImNvdz1iP-lUlro.mjs +610 -0
  43. package/node/esm/CT0CN82y0_Qgoryk.mjs +7568 -0
  44. package/node/esm/CUQi5ZtMO02nhG0W.mjs +596 -0
  45. package/node/esm/CUUoseJmFsCf82bb.mjs +28 -0
  46. package/node/esm/CnSQ7MTXAUAyBOoS.mjs +911 -0
  47. package/node/esm/D7MfcID2Wf6l6VpC.mjs +171 -0
  48. package/node/esm/DCplLG93GfTs1vNw.mjs +1860 -0
  49. package/node/esm/DHUADiCmxNQS1ARz.mjs +417 -0
  50. package/node/esm/DMD12JUh7HJw2-jl.mjs +638 -0
  51. package/node/esm/DdFgXl-Ux2cMBTs_.mjs +15 -0
  52. package/node/esm/DefYISWfdZJFx57m.mjs +255 -0
  53. package/node/esm/Ds0d8zXzmgOu3MGx.mjs +403 -0
  54. package/node/esm/MiU4rDOiocmJ-9Ry.mjs +1783 -0
  55. package/node/esm/index.mjs +49153 -36824
  56. package/package.json +15 -16
  57. package/resources/contents.json +64 -0
  58. package/resources/fonts/arial-bold-italic.metrics.json +139 -0
  59. package/resources/fonts/arial-bold.metrics.json +139 -0
  60. package/resources/fonts/arial-italic.metrics.json +139 -0
  61. package/resources/fonts/arial-regular.metrics.json +139 -0
  62. package/resources/fonts/calibri-bold-italic.metrics.json +137 -0
  63. package/resources/fonts/calibri-bold.metrics.json +137 -0
  64. package/resources/fonts/calibri-italic.metrics.json +137 -0
  65. package/resources/fonts/calibri-regular.metrics.json +137 -0
  66. package/resources/fonts/cambria-bold-italic.metrics.json +66 -0
  67. package/resources/fonts/cambria-bold.metrics.json +66 -0
  68. package/resources/fonts/cambria-italic.metrics.json +66 -0
  69. package/resources/fonts/cambria-regular.metrics.json +66 -0
  70. package/resources/fonts/contents.json +126 -0
  71. package/resources/fonts/courier-new-bold-italic.metrics.json +143 -0
  72. package/resources/fonts/courier-new-bold.metrics.json +143 -0
  73. package/resources/fonts/courier-new-italic.metrics.json +143 -0
  74. package/resources/fonts/courier-new-regular.metrics.json +143 -0
  75. package/resources/fonts/times-new-roman-bold-italic.metrics.json +141 -0
  76. package/resources/fonts/times-new-roman-bold.metrics.json +141 -0
  77. package/resources/fonts/times-new-roman-italic.metrics.json +143 -0
  78. package/resources/fonts/times-new-roman-regular.metrics.json +141 -0
  79. package/resources/locales/de/model.msg.json +112 -12
  80. package/resources/locales/en/model.msg.json +119 -13
  81. package/types/scripting-api.json +8048 -0
  82. package/types/scripting-enums.json +277 -106
  83. package/types/scripting.d.ts +18126 -7971
  84. package/types/src/anchored/AbstractAnchored.d.ts +18 -8
  85. package/types/src/anchored/AnchoredMap.d.ts +2 -0
  86. package/types/src/anchored/IAnchoredMap.d.ts +52 -4
  87. package/types/src/autoFill/AutoFill.d.ts +316 -32
  88. package/types/src/autoFill/IAutoFill.d.ts +232 -15
  89. package/types/src/border/{IBorder.d.ts → IBorders.d.ts} +42 -41
  90. package/types/src/border/index.d.ts +1 -1
  91. package/types/src/calculation/Calculation.d.ts +759 -49
  92. package/types/src/calculation/ExternalBookBindings.d.ts +118 -0
  93. package/types/src/calculation/FormulaText.d.ts +82 -0
  94. package/types/src/calculation/ICalculation.d.ts +318 -81
  95. package/types/src/calculation/INamedFormulasCollection.d.ts +5 -8
  96. package/types/src/calculation/NamedFormulaCollection.d.ts +139 -107
  97. package/types/src/calculation/NamedLambdaFunction.d.ts +28 -0
  98. package/types/src/calculation/TokenType.d.ts +9 -0
  99. package/types/src/calculation/Types.d.ts +83 -2
  100. package/types/src/calculation/_CloneBoundary.d.ts +80 -0
  101. package/types/src/calculation/_TableRename.d.ts +13 -0
  102. package/types/src/calculation/compiler/ASTTypes.d.ts +71 -0
  103. package/types/src/calculation/compiler/CompilerUtils.d.ts +135 -44
  104. package/types/src/calculation/compiler/FormulaCompiler.d.ts +29 -4
  105. package/types/src/calculation/compiler/FormulaParser.d.ts +1 -2
  106. package/types/src/calculation/compiler/LiteTransform.d.ts +17 -0
  107. package/types/src/calculation/compiler/ParserUtils.d.ts +26 -1
  108. package/types/src/calculation/compiler/SRParser.d.ts +2 -1
  109. package/types/src/calculation/compiler/Types.d.ts +79 -9
  110. package/types/src/calculation/executor/CalcExecutor.d.ts +422 -34
  111. package/types/src/calculation/executor/CalcExecutorUtils.d.ts +43 -2
  112. package/types/src/calculation/executor/CircularReference.d.ts +2 -0
  113. package/types/src/calculation/formula/Formula.d.ts +58 -21
  114. package/types/src/calculation/formula/FormulaBlock.d.ts +125 -23
  115. package/types/src/calculation/formula/FormulaRecordView.d.ts +79 -0
  116. package/types/src/calculation/formula/FunctionValues.d.ts +10 -0
  117. package/types/src/calculation/formula/IFormulaBlock.d.ts +261 -67
  118. package/types/src/calculation/formula/LambdaValue.d.ts +46 -23
  119. package/types/src/calculation/formula/LazyValue.d.ts +96 -0
  120. package/types/src/calculation/formula/TokenUtils.d.ts +25 -1
  121. package/types/src/calculation/formula/index.d.ts +1 -0
  122. package/types/src/calculation/functions/FunctionDeclarations.d.ts +31 -0
  123. package/types/src/calculation/functions/Operators.d.ts +8 -0
  124. package/types/src/calculation/functions/initializeFunctions.d.ts +15 -2
  125. package/types/src/calculation/grid/CalcGrid.d.ts +407 -158
  126. package/types/src/calculation/grid/CalcGridBackend.d.ts +493 -0
  127. package/types/src/calculation/grid/CalcGridProxy.d.ts +133 -0
  128. package/types/src/calculation/grid/CalcGridUtils.d.ts +62 -12
  129. package/types/src/calculation/grid/FormulaEntry.d.ts +129 -0
  130. package/types/src/calculation/grid/FormulaHost.d.ts +239 -0
  131. package/types/src/calculation/grid/ICalcGrid.d.ts +499 -141
  132. package/types/src/calculation/grid/_CalcRequest.d.ts +289 -0
  133. package/types/src/calculation/grid/index.d.ts +4 -0
  134. package/types/src/calculation/index.d.ts +2 -0
  135. package/types/src/calculation/spatial/ContentfulSpatialValue.d.ts +6 -2
  136. package/types/src/calculation/spatial/FormulaSpatialValue.d.ts +339 -11
  137. package/types/src/calculation/spatial/SpillEntry.d.ts +20 -5
  138. package/types/src/calculation/spatial/TouchedWindows.d.ts +86 -0
  139. package/types/src/calculation/spatial/index.d.ts +1 -0
  140. package/types/src/calculation/state/CalcInputs.d.ts +41 -0
  141. package/types/src/calculation/state/CalcNode.d.ts +160 -29
  142. package/types/src/calculation/state/CalcScope.d.ts +37 -0
  143. package/types/src/calculation/state/CalcState.d.ts +22 -1
  144. package/types/src/calculation/state/CalculationContext.d.ts +53 -4
  145. package/types/src/calculation/state/IContextContainer.d.ts +159 -26
  146. package/types/src/calculation/state/_PendingOverlayGrid.d.ts +163 -0
  147. package/types/src/calculation/state/_ReadObservedGrid.d.ts +74 -8
  148. package/types/src/calculation/state/index.d.ts +1 -0
  149. package/types/src/calculation/symbol/ExternalSheetSymbols.d.ts +80 -0
  150. package/types/src/calculation/symbol/ISymbolRegistry.d.ts +23 -0
  151. package/types/src/calculation/symbol/IndirectSymbolProvider.d.ts +16 -2
  152. package/types/src/calculation/symbol/SheetSymbolProvider.d.ts +63 -3
  153. package/types/src/calculation/symbol/SymbolRegistry.d.ts +20 -0
  154. package/types/src/calculation/symbol/index.d.ts +3 -2
  155. package/types/src/cell/ICell.d.ts +104 -29
  156. package/types/src/cell/ICellHeader.d.ts +24 -2
  157. package/types/src/cell/ICellProtection.d.ts +50 -10
  158. package/types/src/cellRange/ICellRange.d.ts +458 -97
  159. package/types/src/cellRange/ICellRanges.d.ts +23 -21
  160. package/types/src/chart/Chart.d.ts +41 -13
  161. package/types/src/chart/ChartCollection.d.ts +26 -0
  162. package/types/src/chart/IChart.d.ts +166 -12
  163. package/types/src/chart/IChartCollection.d.ts +25 -0
  164. package/types/src/chart/_ChartXml.d.ts +70 -0
  165. package/types/src/chart/index.d.ts +1 -3
  166. package/types/src/collections/ArraysGrid.d.ts +1 -1
  167. package/types/src/collections/IGrid.d.ts +1 -1
  168. package/types/src/collections/ISparseGrid.d.ts +9 -0
  169. package/types/src/collections/ISpatialMap.d.ts +59 -21
  170. package/types/src/collections/ImmutableList.d.ts +28 -0
  171. package/types/src/collections/MixedTypedArrayList.d.ts +168 -108
  172. package/types/src/collections/OverlappingRangeIterator.d.ts +13 -17
  173. package/types/src/collections/RepeatingList.d.ts +7 -0
  174. package/types/src/collections/ScalarGrid.d.ts +50 -0
  175. package/types/src/collections/SparseGrid.d.ts +1 -1
  176. package/types/src/collections/SpatialMap.d.ts +13 -21
  177. package/types/src/collections/Tuple.d.ts +128 -16
  178. package/types/src/collections/_GridUtils.d.ts +19 -6
  179. package/types/src/collections/_RangeSweep.d.ts +97 -0
  180. package/types/src/collections/_SpatialUtils.d.ts +20 -2
  181. package/types/src/collections/index.d.ts +1 -0
  182. package/types/src/color/_BuiltInIndexDefs.d.ts +6 -0
  183. package/types/src/comment/Comment.d.ts +223 -0
  184. package/types/src/comment/CommentCollection.d.ts +40 -0
  185. package/types/src/comment/IComment.d.ts +340 -50
  186. package/types/src/comment/ICommentCollection.d.ts +90 -0
  187. package/types/src/comment/NoteMovable.d.ts +26 -0
  188. package/types/src/comment/_CommentUtils.d.ts +50 -0
  189. package/types/src/comment/_NoteBox.d.ts +50 -0
  190. package/types/src/comment/index.d.ts +1 -0
  191. package/types/src/condition/AnchoredConditional.d.ts +82 -17
  192. package/types/src/condition/BuiltInOperators/AbstractOperator.d.ts +42 -12
  193. package/types/src/condition/BuiltInOperators/AfterEqualToOperator.d.ts +2 -0
  194. package/types/src/condition/BuiltInOperators/AfterOperator.d.ts +2 -0
  195. package/types/src/condition/BuiltInOperators/AndOperator.d.ts +3 -1
  196. package/types/src/condition/BuiltInOperators/AverageOperator.d.ts +2 -0
  197. package/types/src/condition/BuiltInOperators/BeforeEqualToOperator.d.ts +2 -0
  198. package/types/src/condition/BuiltInOperators/BeforeOperator.d.ts +2 -0
  199. package/types/src/condition/BuiltInOperators/BetweenOperator.d.ts +2 -0
  200. package/types/src/condition/BuiltInOperators/ColorOperator.d.ts +4 -0
  201. package/types/src/condition/BuiltInOperators/ContainsOperator.d.ts +2 -0
  202. package/types/src/condition/BuiltInOperators/EndsWithOperator.d.ts +2 -0
  203. package/types/src/condition/BuiltInOperators/EqualToOperator.d.ts +4 -1
  204. package/types/src/condition/BuiltInOperators/ExpressionOperator.d.ts +5 -6
  205. package/types/src/condition/BuiltInOperators/GreaterThanEqualToOperator.d.ts +2 -0
  206. package/types/src/condition/BuiltInOperators/GreaterThanOperator.d.ts +2 -0
  207. package/types/src/condition/BuiltInOperators/IconOperator.d.ts +4 -0
  208. package/types/src/condition/BuiltInOperators/InSetOperator.d.ts +22 -5
  209. package/types/src/condition/BuiltInOperators/LessThanEqualToOperator.d.ts +2 -0
  210. package/types/src/condition/BuiltInOperators/LessThanOperator.d.ts +2 -0
  211. package/types/src/condition/BuiltInOperators/NotOperator.d.ts +2 -0
  212. package/types/src/condition/BuiltInOperators/OrOperator.d.ts +3 -1
  213. package/types/src/condition/BuiltInOperators/StartsWithOperator.d.ts +2 -0
  214. package/types/src/condition/BuiltInOperators/TimePeriodOperator.d.ts +2 -0
  215. package/types/src/condition/BuiltInOperators/TopNOperator.d.ts +6 -0
  216. package/types/src/condition/BuiltinSelectors/BaseSelector.d.ts +21 -6
  217. package/types/src/condition/BuiltinSelectors/DateSelector.d.ts +4 -5
  218. package/types/src/condition/BuiltinSelectors/DisplaySelector.d.ts +20 -0
  219. package/types/src/condition/BuiltinSelectors/TextLengthSelector.d.ts +7 -5
  220. package/types/src/condition/BuiltinSelectors/TimeSelector.d.ts +3 -5
  221. package/types/src/condition/BuiltinSelectors/WholeSelector.d.ts +3 -5
  222. package/types/src/condition/BuiltinSelectors/index.d.ts +12 -6
  223. package/types/src/condition/Condition.d.ts +19 -1
  224. package/types/src/condition/ICondition.d.ts +293 -73
  225. package/types/src/condition/_ConditionFormula.d.ts +152 -0
  226. package/types/src/condition/_ConditionUtils.d.ts +167 -13
  227. package/types/src/conditionalFormat/ConditionalEntry.d.ts +3 -3
  228. package/types/src/conditionalFormat/ConditionalFormat.d.ts +25 -14
  229. package/types/src/conditionalFormat/ConditionalFormatCollection.d.ts +19 -8
  230. package/types/src/conditionalFormat/IConditionalFormat.d.ts +12 -10
  231. package/types/src/conditionalFormat/IConditionalFormatCollection.d.ts +2 -0
  232. package/types/src/dataValidation/DataValidation.d.ts +69 -3
  233. package/types/src/dataValidation/DataValidationCollection.d.ts +20 -9
  234. package/types/src/dataValidation/IDataValidation.d.ts +149 -30
  235. package/types/src/dataValidation/IDataValidationCollection.d.ts +10 -2
  236. package/types/src/date/DateUtils.d.ts +20 -0
  237. package/types/src/date/_DateUtils.d.ts +91 -7
  238. package/types/src/externalBook/ExternalBookCollection.d.ts +145 -12
  239. package/types/src/externalBook/ExternalBookName.d.ts +96 -0
  240. package/types/src/externalBook/IExternalBook.d.ts +170 -18
  241. package/types/src/externalBook/IExternalBookCollection.d.ts +79 -7
  242. package/types/src/externalBook/index.d.ts +1 -0
  243. package/types/src/{lib/file → file}/file.browser.d.ts +22 -8
  244. package/types/src/{lib/file → file}/file.node.d.ts +7 -2
  245. package/types/src/fill/IEffect.d.ts +5 -5
  246. package/types/src/fill/IFill.d.ts +123 -78
  247. package/types/src/fill/IStroke.d.ts +190 -64
  248. package/types/src/fill/RectAlignment.d.ts +20 -0
  249. package/types/src/fill/_Fills.d.ts +187 -0
  250. package/types/src/fill/_Stroke.d.ts +89 -0
  251. package/types/src/fill/index.d.ts +1 -0
  252. package/types/src/filter/IFilter.d.ts +188 -5
  253. package/types/src/font/AdvanceBuilder.d.ts +25 -0
  254. package/types/src/font/AdvanceTable.d.ts +114 -0
  255. package/types/src/font/FontCollection.d.ts +57 -0
  256. package/types/src/font/IFont.d.ts +17 -0
  257. package/types/src/font/IFontCollection.d.ts +120 -22
  258. package/types/src/font/TableFileAdvanceBuilder.d.ts +27 -0
  259. package/types/src/font/_BuiltinFontTables.d.ts +10 -0
  260. package/types/src/font/index.d.ts +4 -1
  261. package/types/src/group/Group.d.ts +136 -0
  262. package/types/src/group/GroupMovableCollection.d.ts +37 -0
  263. package/types/src/group/IGroup.d.ts +129 -0
  264. package/types/src/group/index.d.ts +2 -0
  265. package/types/src/history/IHistory.d.ts +3 -2
  266. package/types/src/hyperlink/IHyperlink.d.ts +13 -0
  267. package/types/src/hyperlink/_Hyperlink.d.ts +5 -1
  268. package/types/src/i18n/LanguagePack.d.ts +12 -4
  269. package/types/src/index.d.ts +5 -0
  270. package/types/src/io/AbstractBackingStore.d.ts +24 -1
  271. package/types/src/io/ArrayBackingStore.d.ts +1 -1
  272. package/types/src/io/EmbeddedPart.d.ts +20 -0
  273. package/types/src/io/IEmbeddedPart.d.ts +63 -0
  274. package/types/src/io/IWorkbookIO.d.ts +185 -18
  275. package/types/src/io/WorkbookIO.d.ts +9 -0
  276. package/types/src/io/WorkbookOrigin.d.ts +20 -11
  277. package/types/src/io/WorkbookOriginProvider.d.ts +46 -0
  278. package/types/src/io/_XmlFragment.d.ts +49 -0
  279. package/types/src/io/index.d.ts +1 -0
  280. package/types/src/license/LicenseDetails.d.ts +1 -0
  281. package/types/src/license/LicenseManager.d.ts +4 -1
  282. package/types/src/license/Types.d.ts +38 -0
  283. package/types/src/license/_Utils.d.ts +22 -0
  284. package/types/src/license/details.d.ts +24 -0
  285. package/types/src/license/license-key.d.ts +49 -2
  286. package/types/src/license/runtime.browser.d.ts +41 -0
  287. package/types/src/{lib/utils/utils.node.d.ts → license/runtime.node.d.ts} +9 -12
  288. package/types/src/listener/IListener.d.ts +12 -7
  289. package/types/src/listener/ListenerEmitter.d.ts +46 -5
  290. package/types/src/model/AbstractModel.d.ts +14 -5
  291. package/types/src/movable/AbstractMovableContent.d.ts +182 -0
  292. package/types/src/movable/CustomElement.d.ts +4 -5
  293. package/types/src/movable/ErrorContent.d.ts +49 -0
  294. package/types/src/movable/FormControl.d.ts +285 -0
  295. package/types/src/movable/GroupMember.d.ts +87 -0
  296. package/types/src/movable/ICustomElement.d.ts +7 -2
  297. package/types/src/movable/IErrorContent.d.ts +23 -0
  298. package/types/src/movable/IFormControl.d.ts +455 -0
  299. package/types/src/movable/IMovable.d.ts +378 -46
  300. package/types/src/movable/IMovableCollection.d.ts +63 -3
  301. package/types/src/movable/Movable.d.ts +149 -49
  302. package/types/src/movable/MovableCollection.d.ts +15 -8
  303. package/types/src/movable/MovableContentRegistry.d.ts +113 -0
  304. package/types/src/movable/_BuiltInContents.d.ts +14 -0
  305. package/types/src/movable/_ContentFactory.d.ts +35 -0
  306. package/types/src/movable/_DrawnBounds.d.ts +37 -0
  307. package/types/src/movable/_InsertableCollection.d.ts +28 -0
  308. package/types/src/movable/_MovableUtils.d.ts +5 -0
  309. package/types/src/movable/_PendingContent.d.ts +25 -0
  310. package/types/src/movable/_PlacementUtils.d.ts +55 -0
  311. package/types/src/movable/_RotatedFrame.d.ts +20 -0
  312. package/types/src/movable/index.d.ts +7 -1
  313. package/types/src/named/AbstractNamed.d.ts +1 -1
  314. package/types/src/named/INamed.d.ts +4 -1
  315. package/types/src/named/INamedCollection.d.ts +26 -0
  316. package/types/src/named/NamedCollection.d.ts +16 -15
  317. package/types/src/numFmt/BuiltInFormats.d.ts +20 -7
  318. package/types/src/numFmt/IFormatEngine.d.ts +2 -0
  319. package/types/src/numFmt/NumfmtFormatEngine.d.ts +2 -0
  320. package/types/src/numFmt/_FormatCell.d.ts +11 -2
  321. package/types/src/numFmt/_NumFmtUtils.d.ts +0 -1
  322. package/types/src/numFmt/vendor/numfmt/_sheetxl.d.ts +6 -0
  323. package/types/src/outline/IOutline.d.ts +186 -0
  324. package/types/src/outline/Outline.d.ts +157 -0
  325. package/types/src/outline/index.d.ts +2 -0
  326. package/types/src/person/IPerson.d.ts +99 -0
  327. package/types/src/person/IPersonCollection.d.ts +51 -0
  328. package/types/src/person/Person.d.ts +32 -0
  329. package/types/src/person/PersonCollection.d.ts +49 -0
  330. package/types/src/person/index.d.ts +4 -0
  331. package/types/src/picture/IPicture.d.ts +33 -3
  332. package/types/src/picture/Picture.d.ts +33 -13
  333. package/types/src/pivot/IPivotTable.d.ts +72 -0
  334. package/types/src/pivot/IPivotTableCollection.d.ts +25 -0
  335. package/types/src/pivot/PivotCache.d.ts +34 -0
  336. package/types/src/pivot/PivotTable.d.ts +61 -0
  337. package/types/src/pivot/PivotTableCollection.d.ts +25 -0
  338. package/types/src/pivot/_PivotXml.d.ts +24 -0
  339. package/types/src/pivot/index.d.ts +6 -0
  340. package/types/src/primitives/CompositeRangeStats.d.ts +2 -0
  341. package/types/src/primitives/Criteria.d.ts +1 -1
  342. package/types/src/primitives/Grouping.d.ts +65 -0
  343. package/types/src/primitives/LambdaBrand.d.ts +26 -0
  344. package/types/src/primitives/PrimitiveUtils.d.ts +60 -21
  345. package/types/src/primitives/Range.d.ts +136 -26
  346. package/types/src/primitives/RangeStats.d.ts +30 -2
  347. package/types/src/primitives/ReferenceRange.d.ts +44 -0
  348. package/types/src/primitives/Runtime.d.ts +15 -2
  349. package/types/src/primitives/environment.browser.d.ts +9 -0
  350. package/types/src/primitives/environment.node.d.ts +10 -0
  351. package/types/src/primitives/stats/AggregateStats.d.ts +49 -15
  352. package/types/src/primitives/stats/Cancellation.d.ts +13 -0
  353. package/types/src/primitives/stats/FrequencyStats.d.ts +10 -1
  354. package/types/src/primitives/stats/LookupIndex.d.ts +46 -0
  355. package/types/src/primitives/stats/Ranked.d.ts +1 -1
  356. package/types/src/primitives/stats/SortedNumbers.d.ts +4 -2
  357. package/types/src/primitives/stats/index.d.ts +1 -0
  358. package/types/src/print/IPrint.d.ts +0 -22
  359. package/types/src/protectedRange/IProtectedRange.d.ts +4 -0
  360. package/types/src/protectedRange/IProtectedRangeCollection.d.ts +2 -0
  361. package/types/src/protectedRange/ProtectedRange.d.ts +1 -4
  362. package/types/src/protectedRange/ProtectedRangeCollection.d.ts +19 -8
  363. package/types/src/protection/DefaultProtection.d.ts +12 -1
  364. package/types/src/protection/IProtection.d.ts +36 -2
  365. package/types/src/reference/ReferenceUtils.d.ts +80 -0
  366. package/types/src/reference/index.d.ts +2 -0
  367. package/types/src/resource/IResource.d.ts +21 -1
  368. package/types/src/resource/IResourceCollection.d.ts +9 -1
  369. package/types/src/resource/ResourceCollection.d.ts +6 -6
  370. package/types/src/scripting/FunctionArguments.d.ts +22 -0
  371. package/types/src/scripting/FunctionCollection.d.ts +49 -15
  372. package/types/src/scripting/IFunctionCollection.d.ts +62 -32
  373. package/types/src/scripting/IModule.d.ts +25 -0
  374. package/types/src/scripting/IModuleCollection.d.ts +17 -0
  375. package/types/src/scripting/IScript.d.ts +28 -26
  376. package/types/src/scripting/Module.d.ts +34 -6
  377. package/types/src/scripting/ModuleCollection.d.ts +17 -12
  378. package/types/src/scripting/Runtime.d.ts +15 -0
  379. package/types/src/scripting/Scripts.d.ts +3 -7
  380. package/types/src/scripting/TypedFunction.d.ts +200 -4
  381. package/types/src/scripting/_FunctionIndex.d.ts +8 -3
  382. package/types/src/scripting/_ModuleUtils.d.ts +11 -1
  383. package/types/src/scripting/_ScriptUtils.d.ts +3 -0
  384. package/types/src/scripting/declarations.browser.d.ts +10 -0
  385. package/types/src/scripting/declarations.d.ts +49 -0
  386. package/types/src/scripting/declarations.node.d.ts +9 -0
  387. package/types/src/scripting/index.d.ts +3 -0
  388. package/types/src/selection/IMovableSelection.d.ts +148 -0
  389. package/types/src/selection/IRangeSelection.d.ts +9 -4
  390. package/types/src/selection/MovableSelection.d.ts +48 -0
  391. package/types/src/selection/RangeSelection.d.ts +15 -0
  392. package/types/src/selection/index.d.ts +1 -0
  393. package/types/src/shape/GeometryPreset.d.ts +197 -0
  394. package/types/src/shape/IGeometry.d.ts +380 -0
  395. package/types/src/shape/IShape.d.ts +341 -194
  396. package/types/src/shape/IShapeStyle.d.ts +135 -0
  397. package/types/src/shape/Shape.d.ts +107 -21
  398. package/types/src/shape/ShapeStyleUtils.d.ts +54 -0
  399. package/types/src/shape/_ConnectorFrame.d.ts +32 -0
  400. package/types/src/shape/_ConnectorRoute.d.ts +33 -0
  401. package/types/src/shape/_Connectors.d.ts +108 -0
  402. package/types/src/shape/_Geometry.d.ts +14 -0
  403. package/types/src/shape/_GeometryLoader.d.ts +21 -0
  404. package/types/src/shape/_ShapeStyle.d.ts +70 -0
  405. package/types/src/shape/_builtIn/_BuiltInChunks.d.ts +10 -0
  406. package/types/src/shape/_builtIn/_BuiltInDef.d.ts +9 -0
  407. package/types/src/shape/_builtIn/arrows.d.ts +6 -0
  408. package/types/src/shape/_builtIn/basic.d.ts +6 -0
  409. package/types/src/shape/_builtIn/callouts.d.ts +6 -0
  410. package/types/src/shape/_builtIn/flowchart.d.ts +6 -0
  411. package/types/src/shape/_builtIn/lines.d.ts +6 -0
  412. package/types/src/shape/_builtIn/math.d.ts +6 -0
  413. package/types/src/shape/_builtIn/other.d.ts +6 -0
  414. package/types/src/shape/_builtIn/rectangles.d.ts +6 -0
  415. package/types/src/shape/_builtIn/starsBanners.d.ts +6 -0
  416. package/types/src/shape/geometry/_strokeEnds.d.ts +7 -0
  417. package/types/src/shape/geometry/format.d.ts +3 -0
  418. package/types/src/shape/geometry/geometry.d.ts +85 -0
  419. package/types/src/shape/geometry/guides.d.ts +54 -0
  420. package/types/src/shape/geometry/handles.d.ts +14 -0
  421. package/types/src/shape/geometry/index.d.ts +7 -0
  422. package/types/src/shape/geometry/lineEnds.d.ts +54 -0
  423. package/types/src/shape/geometry/paths.d.ts +35 -0
  424. package/types/src/shape/geometry/segments.d.ts +114 -0
  425. package/types/src/shape/index.d.ts +3 -0
  426. package/types/src/sheet/CellRegion.d.ts +6 -0
  427. package/types/src/sheet/ICellContainerOptions.d.ts +50 -0
  428. package/types/src/sheet/ISheet.d.ts +197 -50
  429. package/types/src/sheet/ISheetCollection.d.ts +2 -5
  430. package/types/src/sheet/NamedCellRange.d.ts +16 -7
  431. package/types/src/sheet/NamedRange.d.ts +8 -0
  432. package/types/src/sheet/Sheet.d.ts +923 -138
  433. package/types/src/sheet/SheetCell.d.ts +92 -32
  434. package/types/src/sheet/SheetCollection.d.ts +19 -8
  435. package/types/src/sheet/SheetRange.d.ts +92 -17
  436. package/types/src/sheet/SheetRanges.d.ts +22 -9
  437. package/types/src/sheet/_CellBuffer.d.ts +214 -0
  438. package/types/src/sheet/_HeldFormula.d.ts +69 -0
  439. package/types/src/sheet/_InvalidSheetRange.d.ts +7 -7
  440. package/types/src/sheet/_ListenerAnchor.d.ts +104 -0
  441. package/types/src/sheet/_RangeStateSweep.d.ts +16 -0
  442. package/types/src/sheet/_ScalarListFactory.d.ts +61 -0
  443. package/types/src/sheet/_SheetAutoFillUtils.d.ts +74 -0
  444. package/types/src/sheet/_SheetAutoFitUtils.d.ts +28 -0
  445. package/types/src/sheet/_SheetEvents.d.ts +43 -0
  446. package/types/src/sheet/_SheetFilterUtils.d.ts +49 -1
  447. package/types/src/sheet/_SheetIntents.d.ts +296 -0
  448. package/types/src/sheet/_SheetMutations.d.ts +182 -62
  449. package/types/src/sheet/_SheetStateReader.d.ts +19 -13
  450. package/types/src/sheet/_SheetStateTypes.d.ts +83 -78
  451. package/types/src/sheet/_SheetUtils.d.ts +39 -22
  452. package/types/src/sheet/_WatchAnchor.d.ts +93 -0
  453. package/types/src/sheet/spatial/HeldFormulaEntry.d.ts +36 -0
  454. package/types/src/sheet/spatial/index.d.ts +1 -0
  455. package/types/src/sheet/style/SheetCellStyle.d.ts +209 -304
  456. package/types/src/sheet/style/SheetDirectStyle.d.ts +30 -19
  457. package/types/src/sheet/style/SheetNamedStyle.d.ts +17 -17
  458. package/types/src/sheet/style/SheetTableStyle.d.ts +5 -5
  459. package/types/src/sheet/style/_Resolvers.d.ts +14 -8
  460. package/types/src/sheet/style/_StyleUtils.d.ts +38 -8
  461. package/types/src/sheetHeader/ISheetHeader.d.ts +94 -53
  462. package/types/src/sheetHeader/SheetCellHeader.d.ts +4 -0
  463. package/types/src/sheetHeader/SheetHeader.d.ts +42 -22
  464. package/types/src/sheetHeader/_HeaderMetrics.d.ts +37 -0
  465. package/types/src/sheetHeader/_HeaderUtils.d.ts +5 -3
  466. package/types/src/sheetProtection/ISheetProtection.d.ts +41 -7
  467. package/types/src/sheetProtection/SheetProtection.d.ts +12 -0
  468. package/types/src/sheetView/ISheetView.d.ts +69 -15
  469. package/types/src/sheetView/SheetView.d.ts +20 -11
  470. package/types/src/slicer/ISlicer.d.ts +304 -17
  471. package/types/src/slicer/ISlicerStyle.d.ts +109 -0
  472. package/types/src/slicer/Slicer.d.ts +128 -13
  473. package/types/src/slicer/SlicerStyle.d.ts +25 -0
  474. package/types/src/slicer/_BuiltInSlicerStyles.d.ts +13 -0
  475. package/types/src/slicer/_SlicerUtils.d.ts +30 -0
  476. package/types/src/slicer/index.d.ts +1 -0
  477. package/types/src/sort/ISort.d.ts +4 -2
  478. package/types/src/string/IStringCollection.d.ts +5 -0
  479. package/types/src/string/StringCollection.d.ts +6 -6
  480. package/types/src/style/{IStyle.d.ts → ICellStyle.d.ts} +72 -52
  481. package/types/src/style/INamedStyleCollection.d.ts +72 -0
  482. package/types/src/style/ISlicerStyleCollection.d.ts +77 -0
  483. package/types/src/style/IStyleCollection.d.ts +91 -60
  484. package/types/src/style/ITableStyleCollection.d.ts +89 -0
  485. package/types/src/style/NamedStyleCollection.d.ts +39 -0
  486. package/types/src/style/SlicerStyleCollection.d.ts +46 -0
  487. package/types/src/style/StyleCollection.d.ts +81 -26
  488. package/types/src/style/TableStyleCollection.d.ts +49 -0
  489. package/types/src/style/_BuiltInStyleDefs.d.ts +6 -6
  490. package/types/src/style/_BuiltInStyleNames.d.ts +2 -2
  491. package/types/src/style/index.d.ts +7 -1
  492. package/types/src/table/AnchoredTable.d.ts +701 -72
  493. package/types/src/table/AutoTable.d.ts +7 -5
  494. package/types/src/table/ITable.d.ts +261 -34
  495. package/types/src/table/ITableCollection.d.ts +12 -0
  496. package/types/src/table/ITableStyle.d.ts +37 -37
  497. package/types/src/table/TableCollection.d.ts +19 -8
  498. package/types/src/table/_FilterField.d.ts +19 -6
  499. package/types/src/table/_NamedTable.d.ts +17 -1
  500. package/types/src/table/_NamedTableSource.d.ts +1 -0
  501. package/types/src/table/_SortField.d.ts +2 -0
  502. package/types/src/table/_TableColumn.d.ts +13 -2
  503. package/types/src/table/_TableMessages.d.ts +1 -0
  504. package/types/src/table/_TableUtils.d.ts +40 -0
  505. package/types/src/text/Bullet.d.ts +4 -0
  506. package/types/src/text/IText.d.ts +182 -0
  507. package/types/src/text/ITextFrame.d.ts +110 -1
  508. package/types/src/text/TextBoxAlignment.d.ts +25 -16
  509. package/types/src/text/TextFrame.d.ts +4 -0
  510. package/types/src/text/TextLine.d.ts +4 -0
  511. package/types/src/text/TextParagraph.d.ts +4 -0
  512. package/types/src/text/TextRotation.d.ts +3 -3
  513. package/types/src/text/TextRun.d.ts +9 -0
  514. package/types/src/text/TextStacked.d.ts +83 -0
  515. package/types/src/text/index.d.ts +1 -0
  516. package/types/src/text/richtext/IRichText.d.ts +36 -0
  517. package/types/src/text/richtext/IStyledFont.d.ts +18 -18
  518. package/types/src/text/richtext/index.d.ts +1 -0
  519. package/types/src/theme/ITheme.d.ts +45 -4
  520. package/types/src/theme/IThemeCollection.d.ts +2 -0
  521. package/types/src/theme/ThemeCollection.d.ts +11 -7
  522. package/types/src/theme/_OfficeFormatScheme.d.ts +3 -0
  523. package/types/src/transaction/ITransaction.d.ts +258 -45
  524. package/types/src/transaction/Transaction.d.ts +101 -11
  525. package/types/src/transaction/TransactionUndoManager.d.ts +4 -1
  526. package/types/src/type/AbstractCollection.d.ts +101 -0
  527. package/types/src/type/ICollection.d.ts +117 -0
  528. package/types/src/type/ITypes.d.ts +9 -7
  529. package/types/src/type/index.d.ts +1 -0
  530. package/types/src/utils/_CSSUtils.d.ts +3 -3
  531. package/types/src/wasm/_sdkWasm.d.ts +7 -0
  532. package/types/src/wasm/index.d.ts +2 -0
  533. package/types/src/wasm/sdkWasm.d.ts +29 -0
  534. package/types/src/workbook/IWorkbook.d.ts +180 -40
  535. package/types/src/workbook/Workbook.d.ts +123 -10
  536. package/types/src/workbook/_WorkbookIntents.d.ts +36 -0
  537. package/types/src/workbookProtection/IWorkbookProtection.d.ts +7 -0
  538. package/types/src/workbookProtection/WorkbookProtection.d.ts +3 -0
  539. package/types/src/workbookView/IWorkbookView.d.ts +12 -0
  540. package/types/src/workbookView/WorkbookView.d.ts +5 -0
  541. package/browser/cjs/B7_pDFYCVzt-3hUs.cjs +0 -1
  542. package/browser/cjs/BF14ZEAnaqxXroSj.cjs +0 -1
  543. package/browser/cjs/BXtvdT1Z-MsB_o5F.cjs +0 -1
  544. package/browser/cjs/Bc4JjVVZfFo3R4He.cjs +0 -33
  545. package/browser/cjs/CD2RXdnfqSYNc6gX.cjs +0 -57
  546. package/browser/cjs/DcLpXGexEtOxi-dD.cjs +0 -1
  547. package/browser/cjs/Dv3x6zut1ZRUt3IF.cjs +0 -10
  548. package/browser/cjs/index.cjs +0 -3
  549. package/browser/esm/0Mj5WKM362q6CECb.mjs +0 -824
  550. package/browser/esm/CPTtL2f6_4iblmFM.mjs +0 -4436
  551. package/browser/esm/CoA-sUxjiIUIpTUF.mjs +0 -109
  552. package/browser/esm/Dy4Sdpju1T2icURu.mjs +0 -50854
  553. package/node/esm/BtGxbEbBm79YvF_k.mjs +0 -843
  554. package/node/esm/DqgWsVXROpSgKq6c.mjs +0 -114
  555. package/types/src/cellRange/_GraphNode.d.ts +0 -38
  556. package/types/src/condition/BuiltinSelectors/ListSelector.d.ts +0 -12
  557. package/types/src/dataValidation/_Utils.d.ts +0 -10
  558. package/types/src/lib/utils/_Utils.d.ts +0 -20
  559. package/types/src/lib/utils/utils.browser.d.ts +0 -33
  560. package/types/src/movable/IGroup.d.ts +0 -30
  561. package/types/src/movable/IMovableSelection.d.ts +0 -49
  562. package/types/src/sheet/listener/RangesListener.d.ts +0 -32
  563. package/types/src/sheet/listener/RangesListenerEntry.d.ts +0 -19
  564. package/types/src/sheet/listener/index.d.ts +0 -3
  565. /package/types/src/{lib/utils → license}/banner.d.ts +0 -0
@@ -0,0 +1,911 @@
1
+ /**
2
+ * @license @sheetxl/sdk - SDK - A high-performance, embeddable spreadsheet engine. - v0.8.0-beta.10
3
+ *
4
+ * (C) 2026-present SheetXL Inc. & Michael T. Ford
5
+ * License: The license can be found at https://www.sheetxl.com/license.
6
+ */
7
+ import { CommonUtils as t, ProtectedError as e, messageKey as s, t as i } from "@sheetxl/utils";
8
+ var n = (t, e) => {
9
+ const s = /* @__PURE__ */ new Map();
10
+ return t.forEach((t, i) => {
11
+ e.get(i) !== t && s.set(i, t);
12
+ }), s;
13
+ }, r = !1, o = 0, a = (t) => {
14
+ if ("string" != typeof t) throw new Error("A stateId (string) is required. Register with 'ITransaction.IStore.create'.");
15
+ return t;
16
+ }, h = class extends Error {
17
+ constructor(t, e, s) {
18
+ super("open" === t ? `Transaction conflict: a transaction is already open (expected commit '${e}').` : `Transaction conflict: expected commit '${e}' but current is '${s}'.`), this.name = "TransactionConflictError", this.reason = t, this.expectedCommitId = e, this.actualCommitId = s;
19
+ }
20
+ }, c = class {
21
+ constructor(t) {
22
+ this._record = t;
23
+ }
24
+ getId() {
25
+ return this._record.id;
26
+ }
27
+ getDescription() {
28
+ return this._record.description;
29
+ }
30
+ getMeta() {
31
+ return Object.freeze(this._record.meta);
32
+ }
33
+ getAuthor() {
34
+ return this._record.author;
35
+ }
36
+ getTimestamp() {
37
+ return this._record.timestamp;
38
+ }
39
+ getOperation() {
40
+ return this._record.operation;
41
+ }
42
+ getIntents() {
43
+ return Object.freeze({ ...this._record.intents });
44
+ }
45
+ }, l = class {
46
+ constructor(t) {
47
+ this._listeners = /* @__PURE__ */ new Set(), this._listenersState = /* @__PURE__ */ new Map(), this._commits = /* @__PURE__ */ new Map(), this._locked = !1, this._pending = null, this._versionCounter = 0, this._flushOnRead = 0, this._isSync = t?.sync ?? r, this._isTransient = t?.transient ?? !1, this._author = t?.author, this._maxCommits = t?.maxCommits ?? 1e3;
48
+ const e = {
49
+ id: "0",
50
+ description: "initial",
51
+ meta: {},
52
+ author: this._author,
53
+ timestamp: Date.now(),
54
+ states: /* @__PURE__ */ new Map(),
55
+ intents: {},
56
+ intentWrites: [],
57
+ version: 0,
58
+ previousId: null
59
+ }, s = {
60
+ record: e,
61
+ commit: new c(e)
62
+ };
63
+ this._current = s, this._cacheId = null, this._cacheState = null, this._states = e.states, this._transactionStack = [], this._restoring = !1;
64
+ const i = /* @__PURE__ */ new Map();
65
+ i.set(e.id, s), this._commits = i, this._tipId = e.id;
66
+ }
67
+ static {
68
+ this.setDefaultSync = (t) => {
69
+ r = t;
70
+ };
71
+ }
72
+ getLog(t, e = 100) {
73
+ const s = [];
74
+ let i = t;
75
+ do {
76
+ const t = this._commits.get(i);
77
+ if (!t) throw new Error(`Invalid commit id: '${i}'`);
78
+ if (s.push(t.commit), i = t.record.previousId, !i) return s;
79
+ } while (s.length < e);
80
+ return s;
81
+ }
82
+ getCommitCount() {
83
+ return this._commits.size;
84
+ }
85
+ isOpenTransaction() {
86
+ return this._transactionStack.length > 0;
87
+ }
88
+ isRestoring() {
89
+ return this._restoring;
90
+ }
91
+ isAmendingOtherCommit() {
92
+ const t = this._transactionStack[0];
93
+ return t instanceof d && t._isRetargeted();
94
+ }
95
+ getPendingTransaction() {
96
+ return this._transactionStack[0] ?? null;
97
+ }
98
+ getCurrentTransaction() {
99
+ const t = this._transactionStack;
100
+ return t[t.length - 1] ?? null;
101
+ }
102
+ amend(t, e) {
103
+ const s = this.beginCommit(), i = 0 === s.getDepth() ? this._commits.get(t) : void 0;
104
+ 0 === s.getDepth() && (s._setAmendOf(t), i && i !== this._current && s._retarget(i));
105
+ try {
106
+ const t = e(i ? i.commit : this._current.commit);
107
+ return s.commit(), t;
108
+ } catch (t) {
109
+ throw s.rollback(), t;
110
+ }
111
+ }
112
+ _squashTip(t) {
113
+ if (this._transactionStack.length > 0) return !1;
114
+ const e = this._commits.get(this._tipId), s = e?.record.previousId;
115
+ if (!e || !s) return !1;
116
+ const i = this._commits.get(s);
117
+ return !!i && (i.record.states = e.record.states, i.record.intents = t(i.record.intents, e.record.intents), i.record.timestamp = e.record.timestamp, this._commits.delete(e.record.id), this._tipId = s, this._current === e && (this._current = i, this._states = i.record.states, this._cacheId = null, this._cacheState = null), !0);
118
+ }
119
+ create(e) {
120
+ const s = t.uuidV4();
121
+ if (void 0 !== e) {
122
+ const t = this.beginCommit();
123
+ try {
124
+ t.updateState(s, e), t.commit();
125
+ } catch (e) {
126
+ throw t.rollback(), e;
127
+ }
128
+ }
129
+ return s;
130
+ }
131
+ getStateAt(t, e) {
132
+ return a(e), this._commits.get(t)?.record.states.get(e);
133
+ }
134
+ getState(t) {
135
+ a(t);
136
+ const e = this._transactionStack;
137
+ if (0 === e.length) {
138
+ if (this._cacheId === t) return this._cacheState;
139
+ const e = this._states.get(t);
140
+ return this._cacheId = t, this._cacheState = e, e;
141
+ }
142
+ if (this._flushOnRead > 0) for (let s = e.length - 1; s >= 0; s--) e[s]._isFlushedBy(t) && e[s]._flush();
143
+ return e[e.length - 1].getState(t);
144
+ }
145
+ getCurrentCommit(t = !0) {
146
+ return (t ? this._pending?.commit : null) ?? this._current.commit;
147
+ }
148
+ getTipCommit() {
149
+ return this._commits.get(this._tipId).commit;
150
+ }
151
+ getVersionId(t) {
152
+ return a(t), this._states.get(t)?.version ?? 0;
153
+ }
154
+ restore(t, e) {
155
+ const s = this._getCommitContainer(t, e);
156
+ if (this._current.commit.getId() === s.commit.getId()) return s.commit;
157
+ const i = n(s.record.states, this._current.record.states);
158
+ this._notifyStates("onBeforeCommitStart", this._current, i, !0, !1, !1, s), this._current = s, this._states = this._current.record.states, this._cacheId = null, this._cacheState = null, this._notifyStates("onAfterStateChange", s, i, !1, !0, !0), this._notify("onCommitChange", s.commit, !0), this._restoring = !0;
159
+ try {
160
+ this._notifyStates("onRestoreOrRevert", s, s.record.states, !1, !0);
161
+ } finally {
162
+ this._restoring = !1;
163
+ }
164
+ return s.commit;
165
+ }
166
+ revert(t, e) {
167
+ const s = this._getCommitContainer(t, e), i = this._commits.get(s.record.previousId);
168
+ if (!i) throw new Error(`Invalid commit id: '${s.record.previousId}'`);
169
+ const r = n(i.record.states, this._current.record.states);
170
+ this._notifyStates("onBeforeCommitStart", this._current, r, !0, !1, !1, s), this._current = i, this._states = this._current.record.states, this._cacheId = null, this._cacheState = null, this._notifyStates("onAfterStateChange", i, r, !0, !1, !0, s), this._notify("onCommitChange", i.commit, !0), this._restoring = !0;
171
+ try {
172
+ this._notifyStates("onRestoreOrRevert", i, i.record.states, !0, !0, !1, s);
173
+ } finally {
174
+ this._restoring = !1;
175
+ }
176
+ return i.commit;
177
+ }
178
+ _getCommitContainer(t, e) {
179
+ const s = this._commits.get(t);
180
+ if (!s) throw new Error(`Invalid commit id: '${t}'`);
181
+ if (this._isTransient) throw new Error("Cannot revert transient store");
182
+ if (e?.force && this._transactionStack.length > 0 && this._transactionStack[0].rollback(), 0 !== this._transactionStack.length) throw new Error("Open transactions.");
183
+ return s;
184
+ }
185
+ _pruneForwards(t) {
186
+ let e = this._tipId;
187
+ for (; e && e !== t;) {
188
+ const t = this._commits.get(e);
189
+ if (!t) break;
190
+ this._commits.delete(e), e = t.record.previousId;
191
+ }
192
+ }
193
+ _trimOldest() {
194
+ if (this._commits.size <= this._maxCommits) return;
195
+ const t = this._commits.keys();
196
+ for (; this._commits.size > this._maxCommits;) this._commits.delete(t.next().value);
197
+ const e = this._commits.get(t.next().value);
198
+ e && (e.record.previousId = null);
199
+ }
200
+ beginCommit(e, s) {
201
+ const i = this._transactionStack;
202
+ i.length > 0 && i[i.length - 1]._flush();
203
+ const n = i.length;
204
+ "string" == typeof e && (e = { description: e });
205
+ const r = e?.expectedCommitId;
206
+ if (void 0 !== r) {
207
+ const t = this._current.record.id;
208
+ if (n > 0 || this._restoring) throw new h("open", r, t);
209
+ if (t !== r) throw new h("stale", r, t);
210
+ }
211
+ if (this._locked) throw console.warn("TransactionStore locked", i), /* @__PURE__ */ new Error(`TransactionStore is locked by '${i[n - 1].getDescription()}`);
212
+ const o = e?.preventFurtherTransactions, a = this, l = (t, e, i) => {
213
+ const r = a._transactionStack;
214
+ n !== r.length - 1 && console.warn("Transaction stack out of sync", n, r.length, r), o && (this._locked = !1), r.pop(), t._isFlushedOnRead() && a._flushOnRead--, s?.(t, e, i), 0 === r.length && (a._pending = null, a._notifyClose(t._getCommit(), e, t._isElided(), t._isAmendClose()));
215
+ };
216
+ let _;
217
+ if (0 === i.length) {
218
+ const s = this._current.record, i = {
219
+ states: /* @__PURE__ */ new Map(),
220
+ id: t.uuidV4(),
221
+ description: "string" == typeof e ? e : e?.description ?? null,
222
+ meta: {},
223
+ timestamp: Date.now(),
224
+ author: ("object" == typeof e ? e?.author : void 0) ?? this._author ?? null,
225
+ version: s.version + 1,
226
+ previousId: s.id,
227
+ intents: {},
228
+ intentWrites: [],
229
+ operation: e?.operation
230
+ }, n = {
231
+ record: i,
232
+ commit: new c(i)
233
+ };
234
+ this._pending = n, this._notify("onCommitStart", n.commit), _ = new d(this, n, s?.states, e, l);
235
+ } else _ = i[i.length - 1].beginTransaction(e, l);
236
+ return o && (this._locked = !0), this._transactionStack.push(_), _._isFlushedOnRead() && this._flushOnRead++, _;
237
+ }
238
+ doBatch(t, e, s) {
239
+ let i;
240
+ const n = this.beginCommit(e, s), r = this.getCurrentCommit();
241
+ try {
242
+ i = t?.(r);
243
+ const s = () => {
244
+ n.commit(e);
245
+ };
246
+ if (i && "function" == typeof i.then) return new Promise((t, e) => {
247
+ i.then((i) => {
248
+ try {
249
+ s(), t(i);
250
+ } catch (t) {
251
+ e(t);
252
+ }
253
+ }).catch((t) => {
254
+ n.rollback(), e(t);
255
+ });
256
+ });
257
+ s();
258
+ } catch (t) {
259
+ throw n.rollback(), t;
260
+ }
261
+ return i;
262
+ }
263
+ remove(t) {
264
+ a(t);
265
+ let e = !1;
266
+ const s = this._listenersState.get(t);
267
+ if (s) {
268
+ const i = this.getCurrentCommit();
269
+ s.forEach((t) => {
270
+ t.onClose?.(i);
271
+ }), this._listenersState.delete(t), e = !0;
272
+ }
273
+ this._current.record.states.delete(t) && (e = !0), this._commits.forEach((s) => {
274
+ s.record.states.delete(t) && (e = !0);
275
+ });
276
+ const i = this._transactionStack;
277
+ return i.length > 0 && i[0]._purgeState(t), this._cacheId = null, this._cacheState = null, e;
278
+ }
279
+ addListener(t) {
280
+ const e = this._listeners;
281
+ return e.add(t), () => {
282
+ e.delete(t);
283
+ };
284
+ }
285
+ addStateListener(t, e) {
286
+ if (a(t), !e) throw new Error("Listener is required");
287
+ let s = this._listenersState.get(t);
288
+ s || (s = /* @__PURE__ */ new Set(), this._listenersState.set(t, s));
289
+ return s.add(e), () => {
290
+ s.delete(e), 0 === s.size && this._listenersState.delete(t);
291
+ };
292
+ }
293
+ dispatchEvents(t, e = !1) {
294
+ !e || this._isSync ? t() : setTimeout(t, 0);
295
+ }
296
+ _commitRecord(e, s, i) {
297
+ let n = e.record, r = e.commit;
298
+ const o = e, a = ++this._versionCounter;
299
+ if (s.forEach((t, e) => {
300
+ null != t && ((t, e, s) => {
301
+ Object.defineProperty(t, "id", {
302
+ value: e,
303
+ enumerable: !1,
304
+ configurable: !0,
305
+ writable: !1
306
+ }), Object.defineProperty(t, "version", {
307
+ value: s,
308
+ enumerable: !1,
309
+ configurable: !0,
310
+ writable: !1
311
+ });
312
+ })(t, e, a);
313
+ }), !this._isTransient) {
314
+ let s = !1;
315
+ if (null !== i) {
316
+ const a = this._current, h = this._commits.get(i) ?? a, c = h.record, l = h !== a, _ = l ? c.states : a.record.states;
317
+ if (n.states.forEach((t, e) => {
318
+ _.set(e, t);
319
+ }), ((t, e) => {
320
+ for (let s = 0; s < e.length; s++) {
321
+ const [i, n] = e[s];
322
+ t[i] = "function" == typeof n ? n(t[i]) : n;
323
+ }
324
+ })(c.intents, n.intentWrites), c.meta = {
325
+ ...c.meta,
326
+ ...n.meta
327
+ }, c.timestamp = n.timestamp, s = !0, l) return void (o.record.intentWrites = t.EmptyArray);
328
+ n = a.record, r = a.commit, e = a;
329
+ }
330
+ this._commits.set(n.id, e), s || (n.previousId !== this._tipId && this._pruneForwards(n.previousId), this._tipId = n.id, this._trimOldest());
331
+ }
332
+ this._current = e, this._states = this._current.record.states, this._cacheId = null, this._cacheState = null, o.record.intentWrites = t.EmptyArray, null === i && this._notify("onCommitChange", r), this._notifyStates("onAfterStateChange", e, s, !1, !1, !0, o), this._notify(null === i ? "onCommitEnd" : "onAmendEnd", r, !0);
333
+ }
334
+ _notifyStates(t, e, s, i = !1, n = !1, r = !1, o = e) {
335
+ const a = e.commit, h = o.record.intents, c = this._listenersState;
336
+ s.forEach((e, s) => {
337
+ const o = c.get(s);
338
+ o && this.dispatchEvents(() => {
339
+ o.forEach((s) => {
340
+ s[t]?.(e, a, i, n, h);
341
+ });
342
+ }, r);
343
+ });
344
+ }
345
+ _notifyClose(t, e, s = !1, i = !1) {
346
+ this._listeners.forEach((n) => {
347
+ n.onCommitClose?.(t, e, s, i);
348
+ });
349
+ }
350
+ _notify(t, e, s = !1) {
351
+ return this.dispatchEvents(() => {
352
+ this._listeners.forEach((s) => {
353
+ s[t]?.(e);
354
+ });
355
+ }, s);
356
+ }
357
+ }, _ = class {
358
+ constructor(t, e, s) {
359
+ if (this._children = /* @__PURE__ */ new Set(), this._depth = 0, this._closed = !1, this._isAmend = !1, this._readOnly = !1, this._hooks = null, this._flushing = !1, this._outcomes = null, this._store = t, this._container = e, s = "string" == typeof s ? { description: s } : s, this._description = s?.description ?? "", this._operation = s?.operation ?? null, this._readOnly = s?.readOnly ?? !1, s?.flush || s?.onCommit || s?.onRollback) {
360
+ const t = {
361
+ flush: s.flush,
362
+ writes: s.writes,
363
+ onCommit: s.onCommit,
364
+ onRollback: s.onRollback
365
+ };
366
+ this._hooks = t, (t.onCommit || t.onRollback) && (this._outcomes = [t]);
367
+ }
368
+ }
369
+ _isFlushedOnRead() {
370
+ return !(!this._hooks?.flush || !this._hooks.writes?.length);
371
+ }
372
+ _isFlushedBy(t) {
373
+ const e = this._hooks?.writes;
374
+ return !!e && e.includes(t);
375
+ }
376
+ _flush() {
377
+ const t = this._hooks?.flush;
378
+ if (t && !this._flushing) {
379
+ this._flushing = !0;
380
+ try {
381
+ t();
382
+ } finally {
383
+ this._flushing = !1;
384
+ }
385
+ }
386
+ }
387
+ _settle(t) {
388
+ const e = this._children;
389
+ for (; e.size > 0;) e.values().next().value.commit(t);
390
+ this._flush();
391
+ }
392
+ _adoptOutcomes(t) {
393
+ const e = t._outcomes;
394
+ if (e) if (this._outcomes) for (let t = 0; t < e.length; t++) this._outcomes.push(e[t]);
395
+ else this._outcomes = e;
396
+ }
397
+ _notifyOutcome(t) {
398
+ const e = this._outcomes;
399
+ if (e) {
400
+ this._outcomes = null;
401
+ for (let s = 0; s < e.length; s++) try {
402
+ t ? e[s].onCommit?.(t) : e[s].onRollback?.();
403
+ } catch (t) {
404
+ console.warn(t);
405
+ }
406
+ }
407
+ }
408
+ _getCommit() {
409
+ return this._container.commit;
410
+ }
411
+ _isElided() {
412
+ return !1;
413
+ }
414
+ _setAmendOf(t) {
415
+ this._container.amendOf = t;
416
+ }
417
+ _isAmendClose() {
418
+ return this._isAmend || void 0 !== this._container.amendOf;
419
+ }
420
+ getIntent(t) {
421
+ return this._container.record.intents?.[t];
422
+ }
423
+ setIntent(t, e) {
424
+ const s = this._container.record, i = s.intents ??= {};
425
+ i[t] = "function" == typeof e ? e(i[t]) : e, (s.intentWrites ??= []).push([t, e]);
426
+ }
427
+ getDepth() {
428
+ return this._depth;
429
+ }
430
+ getDescription() {
431
+ return this._description;
432
+ }
433
+ getOperation() {
434
+ return this._operation;
435
+ }
436
+ getStates() {
437
+ return this._states;
438
+ }
439
+ beginTransaction(t, e) {
440
+ this._ensureOpen();
441
+ const s = new u(this._store, this, this._container, "string" == typeof t ? { description: t } : t, e);
442
+ return this._children || this._children, this._children.add(s), s;
443
+ }
444
+ isReadOnly() {
445
+ return this._readOnly;
446
+ }
447
+ updateState(t, e) {
448
+ if (this._ensureOpen(), a(t), this._readOnly) throw new Error("Transaction is read-only" + (this._description ? `: '${this._description}'` : ""));
449
+ const s = this.getState(t);
450
+ let i;
451
+ if ("function" == typeof e) {
452
+ if (i = e(s), i === s) return s;
453
+ i && (i = { ...i });
454
+ } else {
455
+ if (void 0 === e) return s;
456
+ i = {
457
+ ...s,
458
+ ...e
459
+ };
460
+ }
461
+ if (i) {
462
+ let e = this._states;
463
+ e || (e = /* @__PURE__ */ new Map(), this._states = e), e.set(t, i);
464
+ }
465
+ return i;
466
+ }
467
+ amend(t) {
468
+ return this._isAmend = !0, this.commit(t);
469
+ }
470
+ commit(e) {
471
+ return this._ensureOpen(), "string" == typeof e && (e = { description: e }), e && (e.description && (this._description = e.description), e.meta && (this._meta = t.mergeContentful(e.meta, this._meta))), this._children && this._children.forEach((t) => {
472
+ t.commit(e);
473
+ }), this;
474
+ }
475
+ isClose() {
476
+ return this._closed;
477
+ }
478
+ _ensureOpen() {
479
+ if (this._closed) throw this._descriptions ? console.warn(`stack: [${this._descriptions.join(",")}]`) : this._description && console.warn(`description: [${this._description}]`), /* @__PURE__ */ new Error("Transaction already closed");
480
+ }
481
+ _removeChild(t, e = !1) {
482
+ this._children.delete(t), e || this._mergeStates(t._states);
483
+ }
484
+ _purgeState(t) {
485
+ this._states?.delete(t), this._children.forEach((e) => {
486
+ e._purgeState(t);
487
+ });
488
+ }
489
+ _mergeStates(t) {
490
+ if (!t || 0 === t.size) return;
491
+ let e = this._states;
492
+ return e ? (t.forEach((t, s) => {
493
+ e.set(s, t);
494
+ }), e) : (this._states = t, t);
495
+ }
496
+ get isITransaction() {
497
+ return !0;
498
+ }
499
+ }, d = class extends _ {
500
+ constructor(t, e, s, i, n) {
501
+ super(t, e, i), this._retargeted = !1, this._elided = !1, this._prevStates = s, this._onClose = n, this._states = /* @__PURE__ */ new Map(), this._meta = e.record.meta;
502
+ }
503
+ _isElided() {
504
+ return this._elided;
505
+ }
506
+ _retarget(t) {
507
+ this._prevStates = t.record.states, this._retargeted = !0;
508
+ }
509
+ _isRetargeted() {
510
+ return this._retargeted;
511
+ }
512
+ getId() {
513
+ return this._container.commit.getId();
514
+ }
515
+ getSavepointId() {
516
+ return this.getId();
517
+ }
518
+ getParent() {
519
+ return this;
520
+ }
521
+ commit(t) {
522
+ this._ensureOpen(), this._settle(t);
523
+ const e = this._states, s = this._container;
524
+ if (this._store._notifyStates("onBeforeCommitStart", s, e, !1, !1), super.commit(t), 0 === this._states.size) return this._closed = !0, this._elided = !0, this._onClose?.(this, !1, t), this._notifyOutcome(s.commit), this;
525
+ this._store._notifyStates("onBeforeCommitEnd", s, e, !1, !1), this._settle(t);
526
+ const i = new Map(this._prevStates);
527
+ this._states.forEach((t, e) => {
528
+ null === t ? i.delete(e) : i.set(e, t);
529
+ }), this._states = i, this._description && (s.record.description = this._description), this._meta && (s.record.meta = this._meta), s.record.states = i, this._closed = !0, this._onClose?.(this, !1, t);
530
+ const n = s.amendOf ?? (this._isAmend ? s.record.previousId : null);
531
+ return this._store._commitRecord(s, e, n), this._notifyOutcome(s.commit), this;
532
+ }
533
+ rollback() {
534
+ return this._ensureOpen(), this._children && this._children.forEach((t) => {
535
+ t.rollback();
536
+ }), this._notifyOutcome(null), this._closed = !0, this._onClose?.(this, !0, null), this;
537
+ }
538
+ updateState(t, e) {
539
+ const s = this.getState(t), i = super.updateState(t, e);
540
+ return i === s || this._states.set(t, i), i;
541
+ }
542
+ getState(t) {
543
+ a(t);
544
+ let e = this._states.get(t);
545
+ return e || (e = this._prevStates.get(t)), e;
546
+ }
547
+ }, u = class extends _ {
548
+ constructor(t, e, s, i, n) {
549
+ if (super(t, s, i), this._savepointId = null, !e) throw new Error("Parent transaction required");
550
+ this._parent = e, this._depth = this._parent.getDepth() + 1, !1 !== ("string" == typeof i ? void 0 : i?.savepoint) && (this._savepointId = `${e.getId()}:${++o}`), e.isReadOnly() && (this._readOnly = !0), this._onClose = n;
551
+ }
552
+ getId() {
553
+ return this._parent.getId();
554
+ }
555
+ getSavepointId() {
556
+ return this._savepointId ?? this._parent.getSavepointId();
557
+ }
558
+ getParent() {
559
+ return this._parent;
560
+ }
561
+ getState(t) {
562
+ if (this._states) {
563
+ const e = this._states.get(t);
564
+ if (void 0 !== e) return e;
565
+ }
566
+ return this._parent.getState(t);
567
+ }
568
+ commit(t) {
569
+ return this._ensureOpen(), this._settle(t), super.commit(t), this._parent._removeChild(this), this._parent._adoptOutcomes(this), this._closed = !0, this._onClose?.(this, !1, t), this._parent ?? this;
570
+ }
571
+ rollback() {
572
+ return this._ensureOpen(), this._children && this._children.forEach((t) => {
573
+ t.rollback();
574
+ }), this._notifyOutcome(null), this._parent._removeChild(this, !0), this._closed = !0, this._onClose?.(this, !0, null), this._parent ?? this;
575
+ }
576
+ }, m = (t, e, ...s) => {
577
+ const i = globalThis.__SXL_LOG_EVENTS;
578
+ i && ("string" != typeof i || t.includes(i)) && console.log(`[sxl:${t}] ${e}`, ...s);
579
+ }, p = class {
580
+ constructor(t, e) {
581
+ this._listeners = /* @__PURE__ */ new Set(), this._pending = null, this._landing = null, this._listeners = /* @__PURE__ */ new Set(), this._transactions = e ?? new l({ transient: !0 }), this._stateId = this._transactions.create(), this._src = t;
582
+ const s = this, i = () => {
583
+ const t = s._landing;
584
+ if (m(s._label(), `drain landing=${t ? t.length : "null"}`), !t) return;
585
+ s._landing = null;
586
+ const e = /* @__PURE__ */ new Set(), i = t.length;
587
+ for (let n = 0; n < i; n++) {
588
+ const i = t[n];
589
+ s._doNotify(i.listeners, i.removes, i.options, e);
590
+ }
591
+ };
592
+ this._transactionsRemoveListener = this._transactions.addListener({
593
+ onCommitClose(t, e, n) {
594
+ const r = s._pending;
595
+ m(s._label(), `commitClose rollback=${e} elided=${n} pending=${r ? r.length : "null"}`), s._pending = null, e || (r && (s._landing ? s._landing.push(...r) : s._landing = r), n && i());
596
+ },
597
+ onCommitEnd: i,
598
+ onAmendEnd: i
599
+ });
600
+ }
601
+ _label() {
602
+ return this._src?.constructor?.name ?? "unknown";
603
+ }
604
+ _inOperation() {
605
+ return this._transactions.isOpenTransaction() || this._transactions.isRestoring();
606
+ }
607
+ addListeners(t, e) {
608
+ const s = e?.transactional ?? this._inOperation(), i = { listeners: t }, n = this, r = () => {
609
+ s ? n._updateEntries((t) => {
610
+ t.delete(i);
611
+ }) : n._listeners.delete(i);
612
+ };
613
+ return i.remove = e?.once ? r : null, s ? n._updateEntries((t) => {
614
+ t.add(i);
615
+ }) : n._listeners.add(i), r;
616
+ }
617
+ _updateEntries(t) {
618
+ const e = this._transactions, s = e.getState(this._stateId)?.listeners, i = new Set(s);
619
+ t(i);
620
+ const n = e.beginCommit();
621
+ try {
622
+ n.updateState(this._stateId, { listeners: i }), n.amend();
623
+ } catch (t) {
624
+ throw n.rollback(), t;
625
+ }
626
+ }
627
+ async _doNotify(t, e = null, s, i) {
628
+ const n = s?.source ?? this._src, r = [], o = s?.params, a = t.length;
629
+ for (let e = 0; e < a; e++) {
630
+ const s = t[e];
631
+ i && i.has(s) || (i?.add(s), r.push(s(n, o)));
632
+ }
633
+ let h = null;
634
+ if (e && (h = () => {
635
+ const t = e.length;
636
+ for (let s = 0; s < t; s++) e[s]();
637
+ }), s?.async) return new Promise(async (t, e) => {
638
+ try {
639
+ const e = await Promise.all(r);
640
+ h?.(), t(e);
641
+ } catch (t) {
642
+ h?.(), e(t);
643
+ }
644
+ });
645
+ h?.();
646
+ }
647
+ _collect(t, e) {
648
+ if (!t) return null;
649
+ let s = null, i = null;
650
+ return t.forEach((t) => {
651
+ const n = t.listeners[e];
652
+ n && ((s ??= []).push(n), t.remove && (i ??= []).push(t.remove));
653
+ }), s ? {
654
+ listeners: s,
655
+ removes: i
656
+ } : null;
657
+ }
658
+ notify(t, e) {
659
+ const s = this._transactions, i = e?.transactional ?? this._inOperation();
660
+ if (i) {
661
+ const i = this._collect(s.getState(this._stateId)?.listeners, t);
662
+ i && this._doNotify(i.listeners, i.removes, e);
663
+ }
664
+ const n = this._collect(this._listeners, t);
665
+ if (n) return !i || s.isRestoring() || e?.async ? (m(this._label(), `notify ${String(t)} delivered to ${n.listeners.length}`), this._doNotify(n.listeners, n.removes, e)) : ((this._pending ??= []).push({
666
+ listeners: n.listeners,
667
+ removes: n.removes,
668
+ options: e
669
+ }), void m(this._label(), `notify ${String(t)} QUEUED (open transaction) pending=${this._pending.length}`));
670
+ m(this._label(), `notify ${String(t)} inOperation=${i} listeners=0`);
671
+ }
672
+ close() {
673
+ this._transactions.remove(this._stateId), this._transactionsRemoveListener(), this._listeners.clear(), this._pending = null, this._landing = null;
674
+ }
675
+ }, g = "Item has been closed. No further operations are allowed.", f = (t = s("op.update")) => i("error.anchor.protected", { description: i(t) }), S = class {
676
+ constructor(t) {
677
+ this._closed = !1, this._options = { ...t };
678
+ const e = this;
679
+ this._transactions = this._options?.transactions ?? new l({ transient: !0 }), this._id = this._transactions.create({ isDeleted: !1 }), this._emitter = new p(this, this._transactions), t?.json && this._fromJSON(t.json), this._options?.setContainerReadOnlyCallback?.(() => {
680
+ e._processOnContainerReadOnly();
681
+ }), this._transactionsRemoveListener = this._transactions.addStateListener(this._id, {
682
+ onAfterStateChange(t, s) {
683
+ e._processAfterStateChange(t, s);
684
+ },
685
+ onRestoreOrRevert(t, s) {
686
+ e._processRestoreOrRevert(t, s);
687
+ }
688
+ }), this._processInit();
689
+ }
690
+ _fromJSON(t) {}
691
+ isReadOnly() {
692
+ return this._options.isReadOnly?.() ?? !1;
693
+ }
694
+ isDeleted() {
695
+ const t = this._getState();
696
+ return void 0 === t || (t.isDeleted ?? !1);
697
+ }
698
+ getType() {
699
+ return this._options.type;
700
+ }
701
+ get isIModel() {
702
+ return !0;
703
+ }
704
+ _processTransactionDone(t) {}
705
+ _getActionDescription(t) {
706
+ return null;
707
+ }
708
+ _getState() {
709
+ if (this._closed) throw new Error(i("error.model.modelClosed"));
710
+ return this._transactions.getState(this._id);
711
+ }
712
+ _beginCommit(t) {
713
+ return this._transactions.beginCommit("string" == typeof t ? { description: t } : t);
714
+ }
715
+ _getTransactions() {
716
+ return this._transactions;
717
+ }
718
+ _updateState(t, e, s) {
719
+ return this._writeState(t, e, s, !1);
720
+ }
721
+ _amendState(t, e, s) {
722
+ return this._writeState(t, e, s, !0);
723
+ }
724
+ _writeState(t, e, s, n = !1) {
725
+ if (this._closed) throw new Error(i("error.model.modelClosed"));
726
+ if (!t) return this;
727
+ const r = this._beginCommit(e?.description);
728
+ try {
729
+ r.updateState(this._id, t);
730
+ let i = !1;
731
+ const o = s ? s.length : 0;
732
+ for (let t = 0; t < o; t++) {
733
+ const e = s[t];
734
+ i = i || "onAnyChange" === e, this._emitter.notify(e);
735
+ }
736
+ !i && s && o > 0 && this._emitter.notify("onAnyChange"), n ? r.amend(e) : r.commit(e);
737
+ } catch (t) {
738
+ throw r.rollback(), t;
739
+ }
740
+ return this;
741
+ }
742
+ _getEmitter() {
743
+ return this._emitter;
744
+ }
745
+ _processInit() {}
746
+ _processAfterStateChange(t, e) {}
747
+ _processRestoreOrRevert(t, e) {
748
+ this._emitter.notify("onInvalidated");
749
+ }
750
+ delete(t) {
751
+ this._getState().isDeleted || this._delete(t);
752
+ }
753
+ _delete(t) {
754
+ t = {
755
+ description: this._getActionDescription("delete") ?? s("op.delete"),
756
+ ...t
757
+ };
758
+ const e = this._beginCommit(t?.description);
759
+ try {
760
+ this._options.deleteFromContainer && this._options.deleteFromContainer?.(t), this._processDelete(), e.commit();
761
+ } catch (t) {
762
+ throw e.rollback(), t;
763
+ }
764
+ }
765
+ _processOnContainerDeleted() {
766
+ this._processDelete();
767
+ }
768
+ _processDelete() {
769
+ this._updateState({ isDeleted: !0 }, void 0, ["onDelete"]);
770
+ }
771
+ _processOnContainerReadOnly() {
772
+ this._emitter.notify("onReadOnlyChange");
773
+ }
774
+ addListeners(t, e) {
775
+ return this._emitter.addListeners(t, e);
776
+ }
777
+ getId() {
778
+ return this._id;
779
+ }
780
+ getVersionId() {
781
+ return this._transactions.getVersionId(this._id);
782
+ }
783
+ beginCommit(t) {
784
+ return this._beginCommit(t);
785
+ }
786
+ doBatch(t, e) {
787
+ const s = this;
788
+ return this._transactions.doBatch(t, "string" == typeof e ? { description: e } : e, (t) => {
789
+ s._processTransactionDone(t);
790
+ });
791
+ }
792
+ isClosed() {
793
+ return this._closed;
794
+ }
795
+ close() {
796
+ this._closed || (this._emitter.notify("onClose"), this._closed = !0, this._transactionsRemoveListener?.(), this._transactions.remove(this._id));
797
+ }
798
+ }, y = class t extends S {
799
+ static {
800
+ this.instanceCounter = 0;
801
+ }
802
+ constructor(e) {
803
+ super(e), this._watches = /* @__PURE__ */ new Set(), this._watchesReleased = !1, this._getMovable = e.getMovable ?? null, this._addWatchOption = e.addWatch ?? null, this._getRangeOption = e.getRange ?? null;
804
+ let s = e.name ?? null;
805
+ !s && this._getMovable && (s = `${this.getTypeDescription()} ${++t.instanceCounter}`);
806
+ const i = e.description ?? null;
807
+ null === s && null === i || this._updateState({
808
+ name: s,
809
+ description: i
810
+ });
811
+ }
812
+ getName() {
813
+ return this._closed ? null : this._getState()?.name ?? null;
814
+ }
815
+ setName(t) {
816
+ const e = { description: s("op.setMovableName") };
817
+ return this._protectionCheck(e.description), this._updateState({ name: t }, e, ["onAnyChange"]), this;
818
+ }
819
+ getDescription() {
820
+ return this._closed ? null : this._getState()?.description ?? null;
821
+ }
822
+ setDescription(t) {
823
+ const e = { description: s("op.setMovableDescription") };
824
+ return this._protectionCheck(e.description), this._updateState({ description: t || null }, e, ["onAnyChange"]), this;
825
+ }
826
+ getMovable() {
827
+ return this._getMovable?.() ?? null;
828
+ }
829
+ getReferences() {
830
+ if (this._closed || this._watchesReleased || 0 === this._watches.size) return null;
831
+ const t = [], e = /* @__PURE__ */ new Set();
832
+ for (const s of this._watches) {
833
+ const i = s.formula?.getReferences() ?? this._parseReference(s.expression);
834
+ if (!i) continue;
835
+ const n = i.getCount();
836
+ for (let s = 0; s < n; s++) {
837
+ const n = i.at(s);
838
+ if (n.isInvalid()) continue;
839
+ const r = `${n.getSheet().getId()}!${n.getAddress()}`;
840
+ e.has(r) || (e.add(r), t.push(n));
841
+ }
842
+ }
843
+ return 0 === t.length ? null : t[0].getSheet().getRanges(t);
844
+ }
845
+ _addWatch(t, e, s) {
846
+ const i = "string" == typeof t ? t : t.getExpression(), n = {
847
+ expression: i.startsWith("=") ? i.substring(1) : i,
848
+ formula: null,
849
+ callback: e,
850
+ options: s,
851
+ release: null
852
+ };
853
+ return this._watches.add(n), this._watchesReleased || this._hold(n, "string" == typeof t ? void 0 : t), () => {
854
+ this._watches.delete(n) && (n.release?.(), n.release = null, this._notifyReferencesChange());
855
+ };
856
+ }
857
+ _resolveRange(t) {
858
+ return this._getRangeOption?.(t) ?? null;
859
+ }
860
+ _hold(t, e) {
861
+ const s = this._addWatchOption;
862
+ s && (t.release = s(e ?? t.expression, (e) => {
863
+ t.formula = e.formula, t.expression = e.formula.getExpression(), t.callback?.(e), this._notifyReferencesChange();
864
+ }, t.options));
865
+ }
866
+ _parseReference(t) {
867
+ if (!t || t.includes("#REF!")) return null;
868
+ try {
869
+ const e = t.includes("!") ? null : this.getMovable()?.getRange().getSheet(), s = e ? e.getRange(t) : this._resolveRange(t);
870
+ return s && !s.isInvalid() ? s.getSheet().getRanges([s]) : null;
871
+ } catch {
872
+ return null;
873
+ }
874
+ }
875
+ _notifyReferencesChange() {
876
+ this._closed || (this._emitter.notify("onReferencesChange"), this._emitter.notify("onAnyChange"));
877
+ }
878
+ _releaseWatches() {
879
+ this._watchesReleased = !0;
880
+ for (const t of this._watches) t.release?.(), t.release = null;
881
+ }
882
+ _holdWatches() {
883
+ this._watchesReleased = !1;
884
+ for (const t of this._watches) this._hold(t, t.formula ?? void 0);
885
+ }
886
+ _processDelete() {
887
+ this._releaseWatches(), super._processDelete();
888
+ }
889
+ _processRestoreOrRevert(t, e) {
890
+ super._processRestoreOrRevert(t, e);
891
+ const s = void 0 === t || !0 === t.isDeleted;
892
+ s && !this._watchesReleased ? this._releaseWatches() : !s && this._watchesReleased && this._holdWatches();
893
+ }
894
+ _getSourceId() {
895
+ const t = this._getState()?.data;
896
+ return "number" == typeof t?.sourceId ? t.sourceId : void 0;
897
+ }
898
+ _ensureSourceId(t) {
899
+ const e = this._getSourceId();
900
+ if (void 0 !== e) return e;
901
+ const i = t(), n = this._getState()?.data ?? {};
902
+ return this._updateState({ data: {
903
+ ...n,
904
+ sourceId: i
905
+ } }, { description: s("op.connectShape") }), i;
906
+ }
907
+ _protectionCheck(t) {
908
+ if (this.isReadOnly()) throw new e(f(t));
909
+ }
910
+ };
911
+ export { p as a, g as i, S as n, h as o, f as r, l as s, y as t };