@sheetxl/sdk 0.8.0-beta.1 → 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 (564) hide show
  1. package/THIRD-PARTY-NOTICES.md +1 -1
  2. package/browser/esm/{B0HS42a7lga1k1U_.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/{uyWBMSIxMlt8n5Z3.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/{DlPMeIyxT9tG_WDk.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/{Cku7XiUvw1xrRasi.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 +51616 -39665
  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 -110
  83. package/types/scripting.d.ts +13077 -3224
  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 +754 -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 +312 -33
  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 +141 -30
  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 +50 -3
  145. package/types/src/calculation/state/IContextContainer.d.ts +129 -27
  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 +419 -79
  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 +56 -19
  345. package/types/src/primitives/Range.d.ts +133 -25
  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/FunctionCollection.d.ts +49 -15
  371. package/types/src/scripting/IFunctionCollection.d.ts +62 -32
  372. package/types/src/scripting/IModule.d.ts +25 -0
  373. package/types/src/scripting/IModuleCollection.d.ts +17 -0
  374. package/types/src/scripting/IScript.d.ts +28 -26
  375. package/types/src/scripting/Module.d.ts +34 -6
  376. package/types/src/scripting/ModuleCollection.d.ts +17 -12
  377. package/types/src/scripting/Runtime.d.ts +15 -0
  378. package/types/src/scripting/Scripts.d.ts +3 -7
  379. package/types/src/scripting/TypedFunction.d.ts +154 -18
  380. package/types/src/scripting/_FunctionIndex.d.ts +8 -3
  381. package/types/src/scripting/_ModuleUtils.d.ts +11 -1
  382. package/types/src/scripting/_ScriptUtils.d.ts +3 -0
  383. package/types/src/scripting/declarations.browser.d.ts +10 -0
  384. package/types/src/scripting/declarations.d.ts +49 -0
  385. package/types/src/scripting/declarations.node.d.ts +9 -0
  386. package/types/src/scripting/index.d.ts +3 -0
  387. package/types/src/selection/IMovableSelection.d.ts +148 -0
  388. package/types/src/selection/IRangeSelection.d.ts +9 -4
  389. package/types/src/selection/MovableSelection.d.ts +48 -0
  390. package/types/src/selection/RangeSelection.d.ts +15 -0
  391. package/types/src/selection/index.d.ts +1 -0
  392. package/types/src/shape/GeometryPreset.d.ts +197 -0
  393. package/types/src/shape/IGeometry.d.ts +380 -0
  394. package/types/src/shape/IShape.d.ts +341 -194
  395. package/types/src/shape/IShapeStyle.d.ts +135 -0
  396. package/types/src/shape/Shape.d.ts +107 -21
  397. package/types/src/shape/ShapeStyleUtils.d.ts +54 -0
  398. package/types/src/shape/_ConnectorFrame.d.ts +32 -0
  399. package/types/src/shape/_ConnectorRoute.d.ts +33 -0
  400. package/types/src/shape/_Connectors.d.ts +108 -0
  401. package/types/src/shape/_Geometry.d.ts +14 -0
  402. package/types/src/shape/_GeometryLoader.d.ts +21 -0
  403. package/types/src/shape/_ShapeStyle.d.ts +70 -0
  404. package/types/src/shape/_builtIn/_BuiltInChunks.d.ts +10 -0
  405. package/types/src/shape/_builtIn/_BuiltInDef.d.ts +9 -0
  406. package/types/src/shape/_builtIn/arrows.d.ts +6 -0
  407. package/types/src/shape/_builtIn/basic.d.ts +6 -0
  408. package/types/src/shape/_builtIn/callouts.d.ts +6 -0
  409. package/types/src/shape/_builtIn/flowchart.d.ts +6 -0
  410. package/types/src/shape/_builtIn/lines.d.ts +6 -0
  411. package/types/src/shape/_builtIn/math.d.ts +6 -0
  412. package/types/src/shape/_builtIn/other.d.ts +6 -0
  413. package/types/src/shape/_builtIn/rectangles.d.ts +6 -0
  414. package/types/src/shape/_builtIn/starsBanners.d.ts +6 -0
  415. package/types/src/shape/geometry/_strokeEnds.d.ts +7 -0
  416. package/types/src/shape/geometry/format.d.ts +3 -0
  417. package/types/src/shape/geometry/geometry.d.ts +85 -0
  418. package/types/src/shape/geometry/guides.d.ts +54 -0
  419. package/types/src/shape/geometry/handles.d.ts +14 -0
  420. package/types/src/shape/geometry/index.d.ts +7 -0
  421. package/types/src/shape/geometry/lineEnds.d.ts +54 -0
  422. package/types/src/shape/geometry/paths.d.ts +35 -0
  423. package/types/src/shape/geometry/segments.d.ts +114 -0
  424. package/types/src/shape/index.d.ts +3 -0
  425. package/types/src/sheet/CellRegion.d.ts +6 -0
  426. package/types/src/sheet/ICellContainerOptions.d.ts +50 -0
  427. package/types/src/sheet/ISheet.d.ts +197 -50
  428. package/types/src/sheet/ISheetCollection.d.ts +2 -5
  429. package/types/src/sheet/NamedCellRange.d.ts +16 -7
  430. package/types/src/sheet/NamedRange.d.ts +8 -0
  431. package/types/src/sheet/Sheet.d.ts +915 -138
  432. package/types/src/sheet/SheetCell.d.ts +92 -32
  433. package/types/src/sheet/SheetCollection.d.ts +19 -8
  434. package/types/src/sheet/SheetRange.d.ts +90 -18
  435. package/types/src/sheet/SheetRanges.d.ts +22 -9
  436. package/types/src/sheet/_CellBuffer.d.ts +214 -0
  437. package/types/src/sheet/_HeldFormula.d.ts +69 -0
  438. package/types/src/sheet/_InvalidSheetRange.d.ts +7 -7
  439. package/types/src/sheet/_ListenerAnchor.d.ts +104 -0
  440. package/types/src/sheet/_RangeStateSweep.d.ts +16 -0
  441. package/types/src/sheet/_ScalarListFactory.d.ts +61 -0
  442. package/types/src/sheet/_SheetAutoFillUtils.d.ts +74 -0
  443. package/types/src/sheet/_SheetAutoFitUtils.d.ts +2 -2
  444. package/types/src/sheet/_SheetEvents.d.ts +43 -0
  445. package/types/src/sheet/_SheetFilterUtils.d.ts +49 -1
  446. package/types/src/sheet/_SheetIntents.d.ts +296 -0
  447. package/types/src/sheet/_SheetMutations.d.ts +182 -62
  448. package/types/src/sheet/_SheetStateReader.d.ts +19 -13
  449. package/types/src/sheet/_SheetStateTypes.d.ts +83 -78
  450. package/types/src/sheet/_SheetUtils.d.ts +39 -22
  451. package/types/src/sheet/_WatchAnchor.d.ts +93 -0
  452. package/types/src/sheet/spatial/HeldFormulaEntry.d.ts +36 -0
  453. package/types/src/sheet/spatial/index.d.ts +1 -0
  454. package/types/src/sheet/style/SheetCellStyle.d.ts +209 -304
  455. package/types/src/sheet/style/SheetDirectStyle.d.ts +30 -19
  456. package/types/src/sheet/style/SheetNamedStyle.d.ts +17 -17
  457. package/types/src/sheet/style/SheetTableStyle.d.ts +5 -5
  458. package/types/src/sheet/style/_Resolvers.d.ts +14 -8
  459. package/types/src/sheet/style/_StyleUtils.d.ts +38 -8
  460. package/types/src/sheetHeader/ISheetHeader.d.ts +94 -53
  461. package/types/src/sheetHeader/SheetCellHeader.d.ts +4 -0
  462. package/types/src/sheetHeader/SheetHeader.d.ts +42 -22
  463. package/types/src/sheetHeader/_HeaderMetrics.d.ts +37 -0
  464. package/types/src/sheetHeader/_HeaderUtils.d.ts +5 -3
  465. package/types/src/sheetProtection/ISheetProtection.d.ts +41 -7
  466. package/types/src/sheetProtection/SheetProtection.d.ts +12 -0
  467. package/types/src/sheetView/ISheetView.d.ts +69 -15
  468. package/types/src/sheetView/SheetView.d.ts +20 -11
  469. package/types/src/slicer/ISlicer.d.ts +304 -17
  470. package/types/src/slicer/ISlicerStyle.d.ts +109 -0
  471. package/types/src/slicer/Slicer.d.ts +128 -13
  472. package/types/src/slicer/SlicerStyle.d.ts +25 -0
  473. package/types/src/slicer/_BuiltInSlicerStyles.d.ts +13 -0
  474. package/types/src/slicer/_SlicerUtils.d.ts +30 -0
  475. package/types/src/slicer/index.d.ts +1 -0
  476. package/types/src/sort/ISort.d.ts +4 -2
  477. package/types/src/string/IStringCollection.d.ts +5 -0
  478. package/types/src/string/StringCollection.d.ts +6 -6
  479. package/types/src/style/{IStyle.d.ts → ICellStyle.d.ts} +72 -52
  480. package/types/src/style/INamedStyleCollection.d.ts +72 -0
  481. package/types/src/style/ISlicerStyleCollection.d.ts +77 -0
  482. package/types/src/style/IStyleCollection.d.ts +91 -60
  483. package/types/src/style/ITableStyleCollection.d.ts +89 -0
  484. package/types/src/style/NamedStyleCollection.d.ts +39 -0
  485. package/types/src/style/SlicerStyleCollection.d.ts +46 -0
  486. package/types/src/style/StyleCollection.d.ts +81 -26
  487. package/types/src/style/TableStyleCollection.d.ts +49 -0
  488. package/types/src/style/_BuiltInStyleDefs.d.ts +6 -6
  489. package/types/src/style/_BuiltInStyleNames.d.ts +2 -2
  490. package/types/src/style/index.d.ts +7 -1
  491. package/types/src/table/AnchoredTable.d.ts +701 -72
  492. package/types/src/table/AutoTable.d.ts +7 -5
  493. package/types/src/table/ITable.d.ts +261 -34
  494. package/types/src/table/ITableCollection.d.ts +12 -0
  495. package/types/src/table/ITableStyle.d.ts +37 -37
  496. package/types/src/table/TableCollection.d.ts +19 -8
  497. package/types/src/table/_FilterField.d.ts +19 -6
  498. package/types/src/table/_NamedTable.d.ts +17 -1
  499. package/types/src/table/_NamedTableSource.d.ts +1 -0
  500. package/types/src/table/_SortField.d.ts +2 -0
  501. package/types/src/table/_TableColumn.d.ts +13 -2
  502. package/types/src/table/_TableMessages.d.ts +1 -0
  503. package/types/src/table/_TableUtils.d.ts +40 -0
  504. package/types/src/text/Bullet.d.ts +4 -0
  505. package/types/src/text/IText.d.ts +182 -0
  506. package/types/src/text/ITextFrame.d.ts +110 -1
  507. package/types/src/text/TextBoxAlignment.d.ts +25 -16
  508. package/types/src/text/TextFrame.d.ts +4 -0
  509. package/types/src/text/TextLine.d.ts +4 -0
  510. package/types/src/text/TextParagraph.d.ts +4 -0
  511. package/types/src/text/TextRotation.d.ts +3 -3
  512. package/types/src/text/TextRun.d.ts +9 -0
  513. package/types/src/text/TextStacked.d.ts +83 -0
  514. package/types/src/text/index.d.ts +1 -0
  515. package/types/src/text/richtext/IRichText.d.ts +36 -0
  516. package/types/src/text/richtext/IStyledFont.d.ts +18 -18
  517. package/types/src/text/richtext/index.d.ts +1 -0
  518. package/types/src/theme/ITheme.d.ts +45 -4
  519. package/types/src/theme/IThemeCollection.d.ts +2 -0
  520. package/types/src/theme/ThemeCollection.d.ts +11 -7
  521. package/types/src/theme/_OfficeFormatScheme.d.ts +3 -0
  522. package/types/src/transaction/ITransaction.d.ts +258 -45
  523. package/types/src/transaction/Transaction.d.ts +101 -11
  524. package/types/src/transaction/TransactionUndoManager.d.ts +4 -1
  525. package/types/src/type/AbstractCollection.d.ts +101 -0
  526. package/types/src/type/ICollection.d.ts +117 -0
  527. package/types/src/type/ITypes.d.ts +9 -7
  528. package/types/src/type/index.d.ts +1 -0
  529. package/types/src/utils/_CSSUtils.d.ts +3 -3
  530. package/types/src/wasm/_sdkWasm.d.ts +7 -0
  531. package/types/src/wasm/index.d.ts +2 -0
  532. package/types/src/wasm/sdkWasm.d.ts +29 -0
  533. package/types/src/workbook/IWorkbook.d.ts +180 -40
  534. package/types/src/workbook/Workbook.d.ts +123 -10
  535. package/types/src/workbook/_WorkbookIntents.d.ts +36 -0
  536. package/types/src/workbookProtection/IWorkbookProtection.d.ts +7 -0
  537. package/types/src/workbookProtection/WorkbookProtection.d.ts +3 -0
  538. package/types/src/workbookView/IWorkbookView.d.ts +12 -0
  539. package/types/src/workbookView/WorkbookView.d.ts +5 -0
  540. package/browser/cjs/B7_pDFYCVzt-3hUs.cjs +0 -1
  541. package/browser/cjs/BatsV2UUraVDCRXm.cjs +0 -57
  542. package/browser/cjs/CUz53T65cRGQRgvv.cjs +0 -33
  543. package/browser/cjs/DU0kYUtdFa3jK-im.cjs +0 -1
  544. package/browser/cjs/Dv3x6zut1ZRUt3IF.cjs +0 -10
  545. package/browser/cjs/Dv4yIPLV98M5zLHa.cjs +0 -1
  546. package/browser/cjs/a0Z-SXs_N71CtqYb.cjs +0 -1
  547. package/browser/cjs/index.cjs +0 -3
  548. package/browser/esm/6JKSOvc5czaQB2Bj.mjs +0 -109
  549. package/browser/esm/BtuJ9AGzeURtAsGo.mjs +0 -51241
  550. package/browser/esm/DGU6sM25u0EWCKl1.mjs +0 -824
  551. package/browser/esm/f2G3QRgEbvFJcoa2.mjs +0 -4436
  552. package/node/esm/-pxdn3M3tc6PLHs7.mjs +0 -114
  553. package/node/esm/0n5bslM9jhO1JnI2.mjs +0 -843
  554. package/types/src/cellRange/_GraphNode.d.ts +0 -38
  555. package/types/src/condition/BuiltinSelectors/ListSelector.d.ts +0 -12
  556. package/types/src/dataValidation/_Utils.d.ts +0 -10
  557. package/types/src/lib/utils/_Utils.d.ts +0 -27
  558. package/types/src/lib/utils/utils.browser.d.ts +0 -33
  559. package/types/src/movable/IGroup.d.ts +0 -30
  560. package/types/src/movable/IMovableSelection.d.ts +0 -49
  561. package/types/src/sheet/listener/RangesListener.d.ts +0 -32
  562. package/types/src/sheet/listener/RangesListenerEntry.d.ts +0 -19
  563. package/types/src/sheet/listener/index.d.ts +0 -3
  564. /package/types/src/{lib/utils → license}/banner.d.ts +0 -0
@@ -0,0 +1,905 @@
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 e, ProtectedError as t, messageKey as n, t as r } from "@sheetxl/utils";
8
+ var i = (e, t) => {
9
+ let n = /* @__PURE__ */ new Map();
10
+ return e.forEach((e, r) => {
11
+ t.get(r) !== e && n.set(r, e);
12
+ }), n;
13
+ }, a = !1, o = 0, s = (e) => {
14
+ if (typeof e != "string") throw Error("A stateId (string) is required. Register with 'ITransaction.IStore.create'.");
15
+ return e;
16
+ }, c = class extends Error {
17
+ constructor(e, t, n) {
18
+ super(e === "open" ? `Transaction conflict: a transaction is already open (expected commit '${t}').` : `Transaction conflict: expected commit '${t}' but current is '${n}'.`), this.name = "TransactionConflictError", this.reason = e, this.expectedCommitId = t, this.actualCommitId = n;
19
+ }
20
+ }, l = class {
21
+ constructor(e) {
22
+ this._record = e;
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
+ }, u = class {
46
+ constructor(e) {
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 = e?.sync ?? a, this._isTransient = e?.transient ?? !1, this._author = e?.author, this._maxCommits = e?.maxCommits ?? 1e3;
48
+ let t = {
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
+ }, n = {
60
+ record: t,
61
+ commit: new l(t)
62
+ };
63
+ this._current = n, this._cacheId = null, this._cacheState = null, this._states = t.states, this._transactionStack = [], this._restoring = !1;
64
+ let r = /* @__PURE__ */ new Map();
65
+ r.set(t.id, n), this._commits = r, this._tipId = t.id;
66
+ }
67
+ static {
68
+ this.setDefaultSync = (e) => {
69
+ a = e;
70
+ };
71
+ }
72
+ getLog(e, t = 100) {
73
+ let n = [], r = e;
74
+ do {
75
+ let e = this._commits.get(r);
76
+ if (!e) throw Error(`Invalid commit id: '${r}'`);
77
+ if (n.push(e.commit), r = e.record.previousId, !r) return n;
78
+ } while (n.length < t);
79
+ return n;
80
+ }
81
+ getCommitCount() {
82
+ return this._commits.size;
83
+ }
84
+ isOpenTransaction() {
85
+ return this._transactionStack.length > 0;
86
+ }
87
+ isRestoring() {
88
+ return this._restoring;
89
+ }
90
+ isAmendingOtherCommit() {
91
+ let e = this._transactionStack[0];
92
+ return e instanceof f && e._isRetargeted();
93
+ }
94
+ getPendingTransaction() {
95
+ return this._transactionStack[0] ?? null;
96
+ }
97
+ getCurrentTransaction() {
98
+ let e = this._transactionStack;
99
+ return e[e.length - 1] ?? null;
100
+ }
101
+ amend(e, t) {
102
+ let n = this.beginCommit(), r = n.getDepth() === 0 ? this._commits.get(e) : void 0;
103
+ n.getDepth() === 0 && (n._setAmendOf(e), r && r !== this._current && n._retarget(r));
104
+ try {
105
+ let e = t(r ? r.commit : this._current.commit);
106
+ return n.commit(), e;
107
+ } catch (e) {
108
+ throw n.rollback(), e;
109
+ }
110
+ }
111
+ _squashTip(e) {
112
+ if (this._transactionStack.length > 0) return !1;
113
+ let t = this._commits.get(this._tipId), n = t?.record.previousId;
114
+ if (!t || !n) return !1;
115
+ let r = this._commits.get(n);
116
+ return !!r && (r.record.states = t.record.states, r.record.intents = e(r.record.intents, t.record.intents), r.record.timestamp = t.record.timestamp, this._commits.delete(t.record.id), this._tipId = n, this._current === t && (this._current = r, this._states = r.record.states, this._cacheId = null, this._cacheState = null), !0);
117
+ }
118
+ create(t) {
119
+ let n = e.uuidV4();
120
+ if (t !== void 0) {
121
+ let e = this.beginCommit();
122
+ try {
123
+ e.updateState(n, t), e.commit();
124
+ } catch (t) {
125
+ throw e.rollback(), t;
126
+ }
127
+ }
128
+ return n;
129
+ }
130
+ getStateAt(e, t) {
131
+ return s(t), this._commits.get(e)?.record.states.get(t);
132
+ }
133
+ getState(e) {
134
+ s(e);
135
+ let t = this._transactionStack;
136
+ if (t.length === 0) {
137
+ if (this._cacheId === e) return this._cacheState;
138
+ let t = this._states.get(e);
139
+ return this._cacheId = e, this._cacheState = t, t;
140
+ }
141
+ if (this._flushOnRead > 0) for (let n = t.length - 1; n >= 0; n--) t[n]._isFlushedBy(e) && t[n]._flush();
142
+ return t[t.length - 1].getState(e);
143
+ }
144
+ getCurrentCommit(e = !0) {
145
+ return (e ? this._pending?.commit : null) ?? this._current.commit;
146
+ }
147
+ getTipCommit() {
148
+ return this._commits.get(this._tipId).commit;
149
+ }
150
+ getVersionId(e) {
151
+ return s(e), this._states.get(e)?.version ?? 0;
152
+ }
153
+ restore(e, t) {
154
+ let n = this._getCommitContainer(e, t);
155
+ if (this._current.commit.getId() === n.commit.getId()) return n.commit;
156
+ let r = i(n.record.states, this._current.record.states);
157
+ this._notifyStates("onBeforeCommitStart", this._current, r, !0, !1, !1, n), this._current = n, this._states = this._current.record.states, this._cacheId = null, this._cacheState = null, this._notifyStates("onAfterStateChange", n, r, !1, !0, !0), this._notify("onCommitChange", n.commit, !0), this._restoring = !0;
158
+ try {
159
+ this._notifyStates("onRestoreOrRevert", n, n.record.states, !1, !0);
160
+ } finally {
161
+ this._restoring = !1;
162
+ }
163
+ return n.commit;
164
+ }
165
+ revert(e, t) {
166
+ let n = this._getCommitContainer(e, t), r = this._commits.get(n.record.previousId);
167
+ if (!r) throw Error(`Invalid commit id: '${n.record.previousId}'`);
168
+ let a = i(r.record.states, this._current.record.states);
169
+ this._notifyStates("onBeforeCommitStart", this._current, a, !0, !1, !1, n), this._current = r, this._states = this._current.record.states, this._cacheId = null, this._cacheState = null, this._notifyStates("onAfterStateChange", r, a, !0, !1, !0, n), this._notify("onCommitChange", r.commit, !0), this._restoring = !0;
170
+ try {
171
+ this._notifyStates("onRestoreOrRevert", r, r.record.states, !0, !0, !1, n);
172
+ } finally {
173
+ this._restoring = !1;
174
+ }
175
+ return r.commit;
176
+ }
177
+ _getCommitContainer(e, t) {
178
+ let n = this._commits.get(e);
179
+ if (!n) throw Error(`Invalid commit id: '${e}'`);
180
+ if (this._isTransient) throw Error("Cannot revert transient store");
181
+ if (t?.force && this._transactionStack.length > 0 && this._transactionStack[0].rollback(), this._transactionStack.length !== 0) throw Error("Open transactions.");
182
+ return n;
183
+ }
184
+ _pruneForwards(e) {
185
+ let t = this._tipId;
186
+ for (; t && t !== e;) {
187
+ let e = this._commits.get(t);
188
+ if (!e) break;
189
+ this._commits.delete(t), t = e.record.previousId;
190
+ }
191
+ }
192
+ _trimOldest() {
193
+ if (this._commits.size <= this._maxCommits) return;
194
+ let e = this._commits.keys();
195
+ for (; this._commits.size > this._maxCommits;) this._commits.delete(e.next().value);
196
+ let t = this._commits.get(e.next().value);
197
+ t && (t.record.previousId = null);
198
+ }
199
+ beginCommit(t, n) {
200
+ let r = this._transactionStack;
201
+ r.length > 0 && r[r.length - 1]._flush();
202
+ let i = r.length;
203
+ typeof t == "string" && (t = { description: t });
204
+ let a = t?.expectedCommitId;
205
+ if (a !== void 0) {
206
+ let e = this._current.record.id;
207
+ if (i > 0 || this._restoring) throw new c("open", a, e);
208
+ if (e !== a) throw new c("stale", a, e);
209
+ }
210
+ if (this._locked) throw console.warn("TransactionStore locked", r), /* @__PURE__ */ Error(`TransactionStore is locked by '${r[i - 1].getDescription()}`);
211
+ let o = t?.preventFurtherTransactions, s = this, u = (e, t, r) => {
212
+ let a = s._transactionStack;
213
+ i !== a.length - 1 && console.warn("Transaction stack out of sync", i, a.length, a), o && (this._locked = !1), a.pop(), e._isFlushedOnRead() && s._flushOnRead--, n?.(e, t, r), a.length === 0 && (s._pending = null, s._notifyClose(e._getCommit(), t, e._isElided(), e._isAmendClose()));
214
+ }, d;
215
+ if (r.length === 0) {
216
+ let n = this._current.record, r = {
217
+ states: /* @__PURE__ */ new Map(),
218
+ id: e.uuidV4(),
219
+ description: typeof t == "string" ? t : t?.description ?? null,
220
+ meta: {},
221
+ timestamp: Date.now(),
222
+ author: (typeof t == "object" ? t?.author : void 0) ?? this._author ?? null,
223
+ version: n.version + 1,
224
+ previousId: n.id,
225
+ intents: {},
226
+ intentWrites: [],
227
+ operation: t?.operation
228
+ }, i = {
229
+ record: r,
230
+ commit: new l(r)
231
+ };
232
+ this._pending = i, this._notify("onCommitStart", i.commit), d = new f(this, i, n?.states, t, u);
233
+ } else d = r[r.length - 1].beginTransaction(t, u);
234
+ return o && (this._locked = !0), this._transactionStack.push(d), d._isFlushedOnRead() && this._flushOnRead++, d;
235
+ }
236
+ doBatch(e, t, n) {
237
+ let r, i = this.beginCommit(t, n), a = this.getCurrentCommit();
238
+ try {
239
+ r = e?.(a);
240
+ let n = () => {
241
+ i.commit(t);
242
+ };
243
+ if (r && typeof r.then == "function") return new Promise((e, t) => {
244
+ r.then((r) => {
245
+ try {
246
+ n(), e(r);
247
+ } catch (e) {
248
+ t(e);
249
+ }
250
+ }).catch((e) => {
251
+ i.rollback(), t(e);
252
+ });
253
+ });
254
+ n();
255
+ } catch (e) {
256
+ throw i.rollback(), e;
257
+ }
258
+ return r;
259
+ }
260
+ remove(e) {
261
+ s(e);
262
+ let t = !1, n = this._listenersState.get(e);
263
+ if (n) {
264
+ let r = this.getCurrentCommit();
265
+ n.forEach((e) => {
266
+ e.onClose?.(r);
267
+ }), this._listenersState.delete(e), t = !0;
268
+ }
269
+ this._current.record.states.delete(e) && (t = !0), this._commits.forEach((n) => {
270
+ n.record.states.delete(e) && (t = !0);
271
+ });
272
+ let r = this._transactionStack;
273
+ return r.length > 0 && r[0]._purgeState(e), this._cacheId = null, this._cacheState = null, t;
274
+ }
275
+ addListener(e) {
276
+ let t = this._listeners;
277
+ return t.add(e), () => {
278
+ t.delete(e);
279
+ };
280
+ }
281
+ addStateListener(e, t) {
282
+ if (s(e), !t) throw Error("Listener is required");
283
+ let n = this._listenersState.get(e);
284
+ return n || (n = /* @__PURE__ */ new Set(), this._listenersState.set(e, n)), n.add(t), () => {
285
+ n.delete(t), n.size === 0 && this._listenersState.delete(e);
286
+ };
287
+ }
288
+ dispatchEvents(e, t = !1) {
289
+ !t || this._isSync ? e() : setTimeout(e, 0);
290
+ }
291
+ _commitRecord(t, n, r) {
292
+ let i = t.record, a = t.commit, o = t, s = ++this._versionCounter;
293
+ if (n.forEach((e, t) => {
294
+ e != null && ((e, t, n) => {
295
+ Object.defineProperty(e, "id", {
296
+ value: t,
297
+ enumerable: !1,
298
+ configurable: !0,
299
+ writable: !1
300
+ }), Object.defineProperty(e, "version", {
301
+ value: n,
302
+ enumerable: !1,
303
+ configurable: !0,
304
+ writable: !1
305
+ });
306
+ })(e, t, s);
307
+ }), !this._isTransient) {
308
+ let n = !1;
309
+ if (r !== null) {
310
+ let s = this._current, c = this._commits.get(r) ?? s, l = c.record, u = c !== s, d = u ? l.states : s.record.states;
311
+ if (i.states.forEach((e, t) => {
312
+ d.set(t, e);
313
+ }), ((e, t) => {
314
+ for (let n = 0; n < t.length; n++) {
315
+ let [r, i] = t[n];
316
+ e[r] = typeof i == "function" ? i(e[r]) : i;
317
+ }
318
+ })(l.intents, i.intentWrites), l.meta = {
319
+ ...l.meta,
320
+ ...i.meta
321
+ }, l.timestamp = i.timestamp, n = !0, u) return void (o.record.intentWrites = e.EmptyArray);
322
+ i = s.record, a = s.commit, t = s;
323
+ }
324
+ this._commits.set(i.id, t), n || (i.previousId !== this._tipId && this._pruneForwards(i.previousId), this._tipId = i.id, this._trimOldest());
325
+ }
326
+ this._current = t, this._states = this._current.record.states, this._cacheId = null, this._cacheState = null, o.record.intentWrites = e.EmptyArray, r === null && this._notify("onCommitChange", a), this._notifyStates("onAfterStateChange", t, n, !1, !1, !0, o), this._notify(r === null ? "onCommitEnd" : "onAmendEnd", a, !0);
327
+ }
328
+ _notifyStates(e, t, n, r = !1, i = !1, a = !1, o = t) {
329
+ let s = t.commit, c = o.record.intents, l = this._listenersState;
330
+ n.forEach((t, n) => {
331
+ let o = l.get(n);
332
+ o && this.dispatchEvents(() => {
333
+ o.forEach((n) => {
334
+ n[e]?.(t, s, r, i, c);
335
+ });
336
+ }, a);
337
+ });
338
+ }
339
+ _notifyClose(e, t, n = !1, r = !1) {
340
+ this._listeners.forEach((i) => {
341
+ i.onCommitClose?.(e, t, n, r);
342
+ });
343
+ }
344
+ _notify(e, t, n = !1) {
345
+ return this.dispatchEvents(() => {
346
+ this._listeners.forEach((n) => {
347
+ n[e]?.(t);
348
+ });
349
+ }, n);
350
+ }
351
+ }, d = class {
352
+ constructor(e, t, n) {
353
+ 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 = e, this._container = t, n = typeof n == "string" ? { description: n } : n, this._description = n?.description ?? "", this._operation = n?.operation ?? null, this._readOnly = n?.readOnly ?? !1, n?.flush || n?.onCommit || n?.onRollback) {
354
+ let e = {
355
+ flush: n.flush,
356
+ writes: n.writes,
357
+ onCommit: n.onCommit,
358
+ onRollback: n.onRollback
359
+ };
360
+ this._hooks = e, (e.onCommit || e.onRollback) && (this._outcomes = [e]);
361
+ }
362
+ }
363
+ _isFlushedOnRead() {
364
+ return !(!this._hooks?.flush || !this._hooks.writes?.length);
365
+ }
366
+ _isFlushedBy(e) {
367
+ let t = this._hooks?.writes;
368
+ return !!t && t.includes(e);
369
+ }
370
+ _flush() {
371
+ let e = this._hooks?.flush;
372
+ if (e && !this._flushing) {
373
+ this._flushing = !0;
374
+ try {
375
+ e();
376
+ } finally {
377
+ this._flushing = !1;
378
+ }
379
+ }
380
+ }
381
+ _settle(e) {
382
+ let t = this._children;
383
+ for (; t.size > 0;) t.values().next().value.commit(e);
384
+ this._flush();
385
+ }
386
+ _adoptOutcomes(e) {
387
+ let t = e._outcomes;
388
+ if (t) {
389
+ if (this._outcomes) for (let e = 0; e < t.length; e++) this._outcomes.push(t[e]);
390
+ else this._outcomes = t;
391
+ }
392
+ }
393
+ _notifyOutcome(e) {
394
+ let t = this._outcomes;
395
+ if (t) {
396
+ this._outcomes = null;
397
+ for (let n = 0; n < t.length; n++) try {
398
+ e ? t[n].onCommit?.(e) : t[n].onRollback?.();
399
+ } catch (e) {
400
+ console.warn(e);
401
+ }
402
+ }
403
+ }
404
+ _getCommit() {
405
+ return this._container.commit;
406
+ }
407
+ _isElided() {
408
+ return !1;
409
+ }
410
+ _setAmendOf(e) {
411
+ this._container.amendOf = e;
412
+ }
413
+ _isAmendClose() {
414
+ return this._isAmend || this._container.amendOf !== void 0;
415
+ }
416
+ getIntent(e) {
417
+ return this._container.record.intents?.[e];
418
+ }
419
+ setIntent(e, t) {
420
+ let n = this._container.record, r = n.intents ??= {};
421
+ r[e] = typeof t == "function" ? t(r[e]) : t, (n.intentWrites ??= []).push([e, t]);
422
+ }
423
+ getDepth() {
424
+ return this._depth;
425
+ }
426
+ getDescription() {
427
+ return this._description;
428
+ }
429
+ getOperation() {
430
+ return this._operation;
431
+ }
432
+ getStates() {
433
+ return this._states;
434
+ }
435
+ beginTransaction(e, t) {
436
+ this._ensureOpen();
437
+ let n = new p(this._store, this, this._container, typeof e == "string" ? { description: e } : e, t);
438
+ return this._children || this._children, this._children.add(n), n;
439
+ }
440
+ isReadOnly() {
441
+ return this._readOnly;
442
+ }
443
+ updateState(e, t) {
444
+ if (this._ensureOpen(), s(e), this._readOnly) throw Error("Transaction is read-only" + (this._description ? `: '${this._description}'` : ""));
445
+ let n = this.getState(e), r;
446
+ if (typeof t == "function") {
447
+ if (r = t(n), r === n) return n;
448
+ r &&= { ...r };
449
+ } else {
450
+ if (t === void 0) return n;
451
+ r = {
452
+ ...n,
453
+ ...t
454
+ };
455
+ }
456
+ if (r) {
457
+ let t = this._states;
458
+ t || (t = /* @__PURE__ */ new Map(), this._states = t), t.set(e, r);
459
+ }
460
+ return r;
461
+ }
462
+ amend(e) {
463
+ return this._isAmend = !0, this.commit(e);
464
+ }
465
+ commit(t) {
466
+ return this._ensureOpen(), typeof t == "string" && (t = { description: t }), t && (t.description && (this._description = t.description), t.meta && (this._meta = e.mergeContentful(t.meta, this._meta))), this._children && this._children.forEach((e) => {
467
+ e.commit(t);
468
+ }), this;
469
+ }
470
+ isClose() {
471
+ return this._closed;
472
+ }
473
+ _ensureOpen() {
474
+ if (this._closed) throw this._descriptions ? console.warn(`stack: [${this._descriptions.join(",")}]`) : this._description && console.warn(`description: [${this._description}]`), /* @__PURE__ */ Error("Transaction already closed");
475
+ }
476
+ _removeChild(e, t = !1) {
477
+ this._children.delete(e), t || this._mergeStates(e._states);
478
+ }
479
+ _purgeState(e) {
480
+ this._states?.delete(e), this._children.forEach((t) => {
481
+ t._purgeState(e);
482
+ });
483
+ }
484
+ _mergeStates(e) {
485
+ if (!e || e.size === 0) return;
486
+ let t = this._states;
487
+ return t ? (e.forEach((e, n) => {
488
+ t.set(n, e);
489
+ }), t) : (this._states = e, e);
490
+ }
491
+ get isITransaction() {
492
+ return !0;
493
+ }
494
+ }, f = class extends d {
495
+ constructor(e, t, n, r, i) {
496
+ super(e, t, r), this._retargeted = !1, this._elided = !1, this._prevStates = n, this._onClose = i, this._states = /* @__PURE__ */ new Map(), this._meta = t.record.meta;
497
+ }
498
+ _isElided() {
499
+ return this._elided;
500
+ }
501
+ _retarget(e) {
502
+ this._prevStates = e.record.states, this._retargeted = !0;
503
+ }
504
+ _isRetargeted() {
505
+ return this._retargeted;
506
+ }
507
+ getId() {
508
+ return this._container.commit.getId();
509
+ }
510
+ getSavepointId() {
511
+ return this.getId();
512
+ }
513
+ getParent() {
514
+ return this;
515
+ }
516
+ commit(e) {
517
+ this._ensureOpen(), this._settle(e);
518
+ let t = this._states, n = this._container;
519
+ if (this._store._notifyStates("onBeforeCommitStart", n, t, !1, !1), super.commit(e), this._states.size === 0) return this._closed = !0, this._elided = !0, this._onClose?.(this, !1, e), this._notifyOutcome(n.commit), this;
520
+ this._store._notifyStates("onBeforeCommitEnd", n, t, !1, !1), this._settle(e);
521
+ let r = new Map(this._prevStates);
522
+ this._states.forEach((e, t) => {
523
+ e === null ? r.delete(t) : r.set(t, e);
524
+ }), this._states = r, this._description && (n.record.description = this._description), this._meta && (n.record.meta = this._meta), n.record.states = r, this._closed = !0, this._onClose?.(this, !1, e);
525
+ let i = n.amendOf ?? (this._isAmend ? n.record.previousId : null);
526
+ return this._store._commitRecord(n, t, i), this._notifyOutcome(n.commit), this;
527
+ }
528
+ rollback() {
529
+ return this._ensureOpen(), this._children && this._children.forEach((e) => {
530
+ e.rollback();
531
+ }), this._notifyOutcome(null), this._closed = !0, this._onClose?.(this, !0, null), this;
532
+ }
533
+ updateState(e, t) {
534
+ let n = this.getState(e), r = super.updateState(e, t);
535
+ return r === n || this._states.set(e, r), r;
536
+ }
537
+ getState(e) {
538
+ s(e);
539
+ let t = this._states.get(e);
540
+ return t ||= this._prevStates.get(e), t;
541
+ }
542
+ }, p = class extends d {
543
+ constructor(e, t, n, r, i) {
544
+ if (super(e, n, r), this._savepointId = null, !t) throw Error("Parent transaction required");
545
+ this._parent = t, this._depth = this._parent.getDepth() + 1, !1 !== (typeof r == "string" ? void 0 : r?.savepoint) && (this._savepointId = `${t.getId()}:${++o}`), t.isReadOnly() && (this._readOnly = !0), this._onClose = i;
546
+ }
547
+ getId() {
548
+ return this._parent.getId();
549
+ }
550
+ getSavepointId() {
551
+ return this._savepointId ?? this._parent.getSavepointId();
552
+ }
553
+ getParent() {
554
+ return this._parent;
555
+ }
556
+ getState(e) {
557
+ if (this._states) {
558
+ let t = this._states.get(e);
559
+ if (t !== void 0) return t;
560
+ }
561
+ return this._parent.getState(e);
562
+ }
563
+ commit(e) {
564
+ return this._ensureOpen(), this._settle(e), super.commit(e), this._parent._removeChild(this), this._parent._adoptOutcomes(this), this._closed = !0, this._onClose?.(this, !1, e), this._parent ?? this;
565
+ }
566
+ rollback() {
567
+ return this._ensureOpen(), this._children && this._children.forEach((e) => {
568
+ e.rollback();
569
+ }), this._notifyOutcome(null), this._parent._removeChild(this, !0), this._closed = !0, this._onClose?.(this, !0, null), this._parent ?? this;
570
+ }
571
+ }, m = (e, t, ...n) => {
572
+ let r = globalThis.__SXL_LOG_EVENTS;
573
+ r && (typeof r != "string" || e.includes(r)) && console.log(`[sxl:${e}] ${t}`, ...n);
574
+ }, h = class {
575
+ constructor(e, t) {
576
+ this._listeners = /* @__PURE__ */ new Set(), this._pending = null, this._landing = null, this._listeners = /* @__PURE__ */ new Set(), this._transactions = t ?? new u({ transient: !0 }), this._stateId = this._transactions.create(), this._src = e;
577
+ let n = this, r = () => {
578
+ let e = n._landing;
579
+ if (m(n._label(), `drain landing=${e ? e.length : "null"}`), !e) return;
580
+ n._landing = null;
581
+ let t = /* @__PURE__ */ new Set(), r = e.length;
582
+ for (let i = 0; i < r; i++) {
583
+ let r = e[i];
584
+ n._doNotify(r.listeners, r.removes, r.options, t);
585
+ }
586
+ };
587
+ this._transactionsRemoveListener = this._transactions.addListener({
588
+ onCommitClose(e, t, i) {
589
+ let a = n._pending;
590
+ m(n._label(), `commitClose rollback=${t} elided=${i} pending=${a ? a.length : "null"}`), n._pending = null, t || (a && (n._landing ? n._landing.push(...a) : n._landing = a), i && r());
591
+ },
592
+ onCommitEnd: r,
593
+ onAmendEnd: r
594
+ });
595
+ }
596
+ _label() {
597
+ return this._src?.constructor?.name ?? "unknown";
598
+ }
599
+ _inOperation() {
600
+ return this._transactions.isOpenTransaction() || this._transactions.isRestoring();
601
+ }
602
+ addListeners(e, t) {
603
+ let n = t?.transactional ?? this._inOperation(), r = { listeners: e }, i = this, a = () => {
604
+ n ? i._updateEntries((e) => {
605
+ e.delete(r);
606
+ }) : i._listeners.delete(r);
607
+ };
608
+ return r.remove = t?.once ? a : null, n ? i._updateEntries((e) => {
609
+ e.add(r);
610
+ }) : i._listeners.add(r), a;
611
+ }
612
+ _updateEntries(e) {
613
+ let t = this._transactions, n = t.getState(this._stateId)?.listeners, r = new Set(n);
614
+ e(r);
615
+ let i = t.beginCommit();
616
+ try {
617
+ i.updateState(this._stateId, { listeners: r }), i.amend();
618
+ } catch (e) {
619
+ throw i.rollback(), e;
620
+ }
621
+ }
622
+ async _doNotify(e, t = null, n, r) {
623
+ let i = n?.source ?? this._src, a = [], o = n?.params, s = e.length;
624
+ for (let t = 0; t < s; t++) {
625
+ let n = e[t];
626
+ r && r.has(n) || (r?.add(n), a.push(n(i, o)));
627
+ }
628
+ let c = null;
629
+ if (t && (c = () => {
630
+ let e = t.length;
631
+ for (let n = 0; n < e; n++) t[n]();
632
+ }), n?.async) return new Promise(async (e, t) => {
633
+ try {
634
+ let t = await Promise.all(a);
635
+ c?.(), e(t);
636
+ } catch (e) {
637
+ c?.(), t(e);
638
+ }
639
+ });
640
+ c?.();
641
+ }
642
+ _collect(e, t) {
643
+ if (!e) return null;
644
+ let n = null, r = null;
645
+ return e.forEach((e) => {
646
+ let i = e.listeners[t];
647
+ i && ((n ??= []).push(i), e.remove && (r ??= []).push(e.remove));
648
+ }), n ? {
649
+ listeners: n,
650
+ removes: r
651
+ } : null;
652
+ }
653
+ notify(e, t) {
654
+ let n = this._transactions, r = t?.transactional ?? this._inOperation();
655
+ if (r) {
656
+ let r = this._collect(n.getState(this._stateId)?.listeners, e);
657
+ r && this._doNotify(r.listeners, r.removes, t);
658
+ }
659
+ let i = this._collect(this._listeners, e);
660
+ if (i) return !r || n.isRestoring() || t?.async ? (m(this._label(), `notify ${String(e)} delivered to ${i.listeners.length}`), this._doNotify(i.listeners, i.removes, t)) : ((this._pending ??= []).push({
661
+ listeners: i.listeners,
662
+ removes: i.removes,
663
+ options: t
664
+ }), void m(this._label(), `notify ${String(e)} QUEUED (open transaction) pending=${this._pending.length}`));
665
+ m(this._label(), `notify ${String(e)} inOperation=${r} listeners=0`);
666
+ }
667
+ close() {
668
+ this._transactions.remove(this._stateId), this._transactionsRemoveListener(), this._listeners.clear(), this._pending = null, this._landing = null;
669
+ }
670
+ }, g = "Item has been closed. No further operations are allowed.", _ = (e = n("op.update")) => r("error.anchor.protected", { description: r(e) }), v = class {
671
+ constructor(e) {
672
+ this._closed = !1, this._options = { ...e };
673
+ let t = this;
674
+ this._transactions = this._options?.transactions ?? new u({ transient: !0 }), this._id = this._transactions.create({ isDeleted: !1 }), this._emitter = new h(this, this._transactions), e?.json && this._fromJSON(e.json), this._options?.setContainerReadOnlyCallback?.(() => {
675
+ t._processOnContainerReadOnly();
676
+ }), this._transactionsRemoveListener = this._transactions.addStateListener(this._id, {
677
+ onAfterStateChange(e, n) {
678
+ t._processAfterStateChange(e, n);
679
+ },
680
+ onRestoreOrRevert(e, n) {
681
+ t._processRestoreOrRevert(e, n);
682
+ }
683
+ }), this._processInit();
684
+ }
685
+ _fromJSON(e) {}
686
+ isReadOnly() {
687
+ return this._options.isReadOnly?.() ?? !1;
688
+ }
689
+ isDeleted() {
690
+ let e = this._getState();
691
+ return e === void 0 || (e.isDeleted ?? !1);
692
+ }
693
+ getType() {
694
+ return this._options.type;
695
+ }
696
+ get isIModel() {
697
+ return !0;
698
+ }
699
+ _processTransactionDone(e) {}
700
+ _getActionDescription(e) {
701
+ return null;
702
+ }
703
+ _getState() {
704
+ if (this._closed) throw Error(r("error.model.modelClosed"));
705
+ return this._transactions.getState(this._id);
706
+ }
707
+ _beginCommit(e) {
708
+ return this._transactions.beginCommit(typeof e == "string" ? { description: e } : e);
709
+ }
710
+ _getTransactions() {
711
+ return this._transactions;
712
+ }
713
+ _updateState(e, t, n) {
714
+ return this._writeState(e, t, n, !1);
715
+ }
716
+ _amendState(e, t, n) {
717
+ return this._writeState(e, t, n, !0);
718
+ }
719
+ _writeState(e, t, n, i = !1) {
720
+ if (this._closed) throw Error(r("error.model.modelClosed"));
721
+ if (!e) return this;
722
+ let a = this._beginCommit(t?.description);
723
+ try {
724
+ a.updateState(this._id, e);
725
+ let r = !1, o = n ? n.length : 0;
726
+ for (let e = 0; e < o; e++) {
727
+ let t = n[e];
728
+ r ||= t === "onAnyChange", this._emitter.notify(t);
729
+ }
730
+ !r && n && o > 0 && this._emitter.notify("onAnyChange"), i ? a.amend(t) : a.commit(t);
731
+ } catch (e) {
732
+ throw a.rollback(), e;
733
+ }
734
+ return this;
735
+ }
736
+ _getEmitter() {
737
+ return this._emitter;
738
+ }
739
+ _processInit() {}
740
+ _processAfterStateChange(e, t) {}
741
+ _processRestoreOrRevert(e, t) {
742
+ this._emitter.notify("onInvalidated");
743
+ }
744
+ delete(e) {
745
+ this._getState().isDeleted || this._delete(e);
746
+ }
747
+ _delete(e) {
748
+ e = {
749
+ description: this._getActionDescription("delete") ?? n("op.delete"),
750
+ ...e
751
+ };
752
+ let t = this._beginCommit(e?.description);
753
+ try {
754
+ this._options.deleteFromContainer && this._options.deleteFromContainer?.(e), this._processDelete(), t.commit();
755
+ } catch (e) {
756
+ throw t.rollback(), e;
757
+ }
758
+ }
759
+ _processOnContainerDeleted() {
760
+ this._processDelete();
761
+ }
762
+ _processDelete() {
763
+ this._updateState({ isDeleted: !0 }, void 0, ["onDelete"]);
764
+ }
765
+ _processOnContainerReadOnly() {
766
+ this._emitter.notify("onReadOnlyChange");
767
+ }
768
+ addListeners(e, t) {
769
+ return this._emitter.addListeners(e, t);
770
+ }
771
+ getId() {
772
+ return this._id;
773
+ }
774
+ getVersionId() {
775
+ return this._transactions.getVersionId(this._id);
776
+ }
777
+ beginCommit(e) {
778
+ return this._beginCommit(e);
779
+ }
780
+ doBatch(e, t) {
781
+ let n = this;
782
+ return this._transactions.doBatch(e, typeof t == "string" ? { description: t } : t, (e) => {
783
+ n._processTransactionDone(e);
784
+ });
785
+ }
786
+ isClosed() {
787
+ return this._closed;
788
+ }
789
+ close() {
790
+ this._closed || (this._emitter.notify("onClose"), this._closed = !0, this._transactionsRemoveListener?.(), this._transactions.remove(this._id));
791
+ }
792
+ }, y = class e extends v {
793
+ static {
794
+ this.instanceCounter = 0;
795
+ }
796
+ constructor(t) {
797
+ super(t), this._watches = /* @__PURE__ */ new Set(), this._watchesReleased = !1, this._getMovable = t.getMovable ?? null, this._addWatchOption = t.addWatch ?? null, this._getRangeOption = t.getRange ?? null;
798
+ let n = t.name ?? null;
799
+ !n && this._getMovable && (n = `${this.getTypeDescription()} ${++e.instanceCounter}`);
800
+ let r = t.description ?? null;
801
+ n === null && r === null || this._updateState({
802
+ name: n,
803
+ description: r
804
+ });
805
+ }
806
+ getName() {
807
+ return this._closed ? null : this._getState()?.name ?? null;
808
+ }
809
+ setName(e) {
810
+ let t = { description: n("op.setMovableName") };
811
+ return this._protectionCheck(t.description), this._updateState({ name: e }, t, ["onAnyChange"]), this;
812
+ }
813
+ getDescription() {
814
+ return this._closed ? null : this._getState()?.description ?? null;
815
+ }
816
+ setDescription(e) {
817
+ let t = { description: n("op.setMovableDescription") };
818
+ return this._protectionCheck(t.description), this._updateState({ description: e || null }, t, ["onAnyChange"]), this;
819
+ }
820
+ getMovable() {
821
+ return this._getMovable?.() ?? null;
822
+ }
823
+ getReferences() {
824
+ if (this._closed || this._watchesReleased || this._watches.size === 0) return null;
825
+ let e = [], t = /* @__PURE__ */ new Set();
826
+ for (let n of this._watches) {
827
+ let r = n.formula?.getReferences() ?? this._parseReference(n.expression);
828
+ if (!r) continue;
829
+ let i = r.getCount();
830
+ for (let n = 0; n < i; n++) {
831
+ let i = r.at(n);
832
+ if (i.isInvalid()) continue;
833
+ let a = `${i.getSheet().getId()}!${i.getAddress()}`;
834
+ t.has(a) || (t.add(a), e.push(i));
835
+ }
836
+ }
837
+ return e.length === 0 ? null : e[0].getSheet().getRanges(e);
838
+ }
839
+ _addWatch(e, t, n) {
840
+ let r = typeof e == "string" ? e : e.getExpression(), i = {
841
+ expression: r.startsWith("=") ? r.substring(1) : r,
842
+ formula: null,
843
+ callback: t,
844
+ options: n,
845
+ release: null
846
+ };
847
+ return this._watches.add(i), this._watchesReleased || this._hold(i, typeof e == "string" ? void 0 : e), () => {
848
+ this._watches.delete(i) && (i.release?.(), i.release = null, this._notifyReferencesChange());
849
+ };
850
+ }
851
+ _resolveRange(e) {
852
+ return this._getRangeOption?.(e) ?? null;
853
+ }
854
+ _hold(e, t) {
855
+ let n = this._addWatchOption;
856
+ n && (e.release = n(t ?? e.expression, (t) => {
857
+ e.formula = t.formula, e.expression = t.formula.getExpression(), e.callback?.(t), this._notifyReferencesChange();
858
+ }, e.options));
859
+ }
860
+ _parseReference(e) {
861
+ if (!e || e.includes("#REF!")) return null;
862
+ try {
863
+ let t = e.includes("!") ? null : this.getMovable()?.getRange().getSheet(), n = t ? t.getRange(e) : this._resolveRange(e);
864
+ return n && !n.isInvalid() ? n.getSheet().getRanges([n]) : null;
865
+ } catch {
866
+ return null;
867
+ }
868
+ }
869
+ _notifyReferencesChange() {
870
+ this._closed || (this._emitter.notify("onReferencesChange"), this._emitter.notify("onAnyChange"));
871
+ }
872
+ _releaseWatches() {
873
+ this._watchesReleased = !0;
874
+ for (let e of this._watches) e.release?.(), e.release = null;
875
+ }
876
+ _holdWatches() {
877
+ this._watchesReleased = !1;
878
+ for (let e of this._watches) this._hold(e, e.formula ?? void 0);
879
+ }
880
+ _processDelete() {
881
+ this._releaseWatches(), super._processDelete();
882
+ }
883
+ _processRestoreOrRevert(e, t) {
884
+ super._processRestoreOrRevert(e, t);
885
+ let n = e === void 0 || !0 === e.isDeleted;
886
+ n && !this._watchesReleased ? this._releaseWatches() : !n && this._watchesReleased && this._holdWatches();
887
+ }
888
+ _getSourceId() {
889
+ let e = this._getState()?.data;
890
+ return typeof e?.sourceId == "number" ? e.sourceId : void 0;
891
+ }
892
+ _ensureSourceId(e) {
893
+ let t = this._getSourceId();
894
+ if (t !== void 0) return t;
895
+ let r = e(), i = this._getState()?.data ?? {};
896
+ return this._updateState({ data: {
897
+ ...i,
898
+ sourceId: r
899
+ } }, { description: n("op.connectShape") }), r;
900
+ }
901
+ _protectionCheck(e) {
902
+ if (this.isReadOnly()) throw new t(_(e));
903
+ }
904
+ };
905
+ export { h as a, g as i, v as n, c as o, _ as r, u as s, y as t };