@sheetxl/sdk 0.8.0-beta.1 → 0.8.0-beta.2

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 (353) hide show
  1. package/THIRD-PARTY-NOTICES.md +1 -1
  2. package/browser/cjs/4f5eoQQfV-V7LO2_.cjs +1 -0
  3. package/browser/cjs/BEnEDC1m546-gzWS.cjs +1 -0
  4. package/browser/cjs/CwCUa4IzGNGissLL.cjs +1 -0
  5. package/browser/cjs/{a0Z-SXs_N71CtqYb.cjs → Dg3GaW0QWwnlqetX.cjs} +1 -1
  6. package/browser/cjs/KWQPie2u7AP69web.cjs +93 -0
  7. package/browser/cjs/index.cjs +2 -2
  8. package/browser/esm/{B0HS42a7lga1k1U_.mjs → BJ9hcZAGY8Tj5_9L.mjs} +1 -1
  9. package/browser/esm/C8vpA2ZBtZf6w4nq.mjs +394 -0
  10. package/browser/esm/DDojiE2-oycJ7qGi.mjs +20 -0
  11. package/browser/esm/DEPT7zmpiMdZ-_qC.mjs +70253 -0
  12. package/browser/esm/DOvCi3lf49To36WP.mjs +8 -0
  13. package/browser/esm/{uyWBMSIxMlt8n5Z3.mjs → Dq3sc4B_HQHBrT5N.mjs} +2 -2
  14. package/browser/esm/index.mjs +871 -696
  15. package/browser/esm/{DlPMeIyxT9tG_WDk.mjs → trwZArJQQq7K9kL7.mjs} +2 -2
  16. package/licenses/dependencies.txt +204 -204
  17. package/node/esm/CGWsQOMWdnDeF4dX.mjs +8 -0
  18. package/node/esm/{Cku7XiUvw1xrRasi.mjs → CL9MI-b6D9BmtVXW.mjs} +1 -1
  19. package/node/esm/CressiwiIhxCVp1v.mjs +28 -0
  20. package/node/esm/O2cOO3xIynWUgOWe.mjs +403 -0
  21. package/node/esm/index.mjs +52356 -37345
  22. package/package.json +6 -7
  23. package/resources/locales/de/model.msg.json +45 -9
  24. package/resources/locales/en/model.msg.json +42 -9
  25. package/types/scripting-api.json +7093 -0
  26. package/types/scripting-enums.json +54 -8
  27. package/types/scripting.d.ts +7006 -1202
  28. package/types/src/anchored/AbstractAnchored.d.ts +18 -8
  29. package/types/src/anchored/AnchoredMap.d.ts +2 -0
  30. package/types/src/anchored/IAnchoredMap.d.ts +52 -4
  31. package/types/src/autoFill/AutoFill.d.ts +316 -32
  32. package/types/src/autoFill/IAutoFill.d.ts +232 -15
  33. package/types/src/border/{IBorder.d.ts → IBorders.d.ts} +41 -40
  34. package/types/src/border/index.d.ts +1 -1
  35. package/types/src/calculation/Calculation.d.ts +740 -35
  36. package/types/src/calculation/ExternalBookBindings.d.ts +118 -0
  37. package/types/src/calculation/FormulaText.d.ts +74 -0
  38. package/types/src/calculation/ICalculation.d.ts +318 -81
  39. package/types/src/calculation/INamedFormulasCollection.d.ts +5 -8
  40. package/types/src/calculation/NamedFormulaCollection.d.ts +139 -107
  41. package/types/src/calculation/NamedLambdaFunction.d.ts +28 -0
  42. package/types/src/calculation/TokenType.d.ts +9 -0
  43. package/types/src/calculation/Types.d.ts +83 -2
  44. package/types/src/calculation/_CloneBoundary.d.ts +80 -0
  45. package/types/src/calculation/compiler/ASTTypes.d.ts +58 -0
  46. package/types/src/calculation/compiler/CompilerUtils.d.ts +134 -12
  47. package/types/src/calculation/compiler/FormulaCompiler.d.ts +29 -4
  48. package/types/src/calculation/compiler/FormulaParser.d.ts +1 -2
  49. package/types/src/calculation/compiler/LiteTransform.d.ts +17 -0
  50. package/types/src/calculation/compiler/ParserUtils.d.ts +26 -1
  51. package/types/src/calculation/compiler/SRParser.d.ts +2 -1
  52. package/types/src/calculation/compiler/Types.d.ts +79 -9
  53. package/types/src/calculation/executor/CalcExecutor.d.ts +312 -33
  54. package/types/src/calculation/executor/CalcExecutorUtils.d.ts +43 -2
  55. package/types/src/calculation/executor/CircularReference.d.ts +2 -0
  56. package/types/src/calculation/formula/Formula.d.ts +58 -21
  57. package/types/src/calculation/formula/FormulaBlock.d.ts +124 -21
  58. package/types/src/calculation/formula/FormulaRecordView.d.ts +79 -0
  59. package/types/src/calculation/formula/IFormulaBlock.d.ts +261 -67
  60. package/types/src/calculation/formula/LambdaValue.d.ts +15 -16
  61. package/types/src/calculation/formula/LazyValue.d.ts +96 -0
  62. package/types/src/calculation/formula/TokenUtils.d.ts +25 -1
  63. package/types/src/calculation/formula/index.d.ts +1 -0
  64. package/types/src/calculation/functions/FunctionDeclarations.d.ts +31 -0
  65. package/types/src/calculation/functions/initializeFunctions.d.ts +15 -2
  66. package/types/src/calculation/grid/CalcGrid.d.ts +384 -158
  67. package/types/src/calculation/grid/CalcGridBackend.d.ts +450 -0
  68. package/types/src/calculation/grid/CalcGridProxy.d.ts +133 -0
  69. package/types/src/calculation/grid/CalcGridUtils.d.ts +62 -12
  70. package/types/src/calculation/grid/FormulaEntry.d.ts +129 -0
  71. package/types/src/calculation/grid/FormulaHost.d.ts +236 -0
  72. package/types/src/calculation/grid/ICalcGrid.d.ts +456 -143
  73. package/types/src/calculation/grid/_CalcRequest.d.ts +272 -0
  74. package/types/src/calculation/grid/index.d.ts +4 -0
  75. package/types/src/calculation/index.d.ts +2 -0
  76. package/types/src/calculation/spatial/ContentfulSpatialValue.d.ts +6 -2
  77. package/types/src/calculation/spatial/FormulaSpatialValue.d.ts +339 -11
  78. package/types/src/calculation/spatial/SpillEntry.d.ts +20 -5
  79. package/types/src/calculation/spatial/TouchedWindows.d.ts +86 -0
  80. package/types/src/calculation/spatial/index.d.ts +1 -0
  81. package/types/src/calculation/state/CalcInputs.d.ts +41 -0
  82. package/types/src/calculation/state/CalcNode.d.ts +141 -30
  83. package/types/src/calculation/state/CalcScope.d.ts +37 -0
  84. package/types/src/calculation/state/CalcState.d.ts +22 -1
  85. package/types/src/calculation/state/CalculationContext.d.ts +36 -2
  86. package/types/src/calculation/state/IContextContainer.d.ts +129 -27
  87. package/types/src/calculation/state/_PendingOverlayGrid.d.ts +163 -0
  88. package/types/src/calculation/state/_ReadObservedGrid.d.ts +74 -8
  89. package/types/src/calculation/state/index.d.ts +1 -0
  90. package/types/src/calculation/symbol/ExternalSheetSymbols.d.ts +80 -0
  91. package/types/src/calculation/symbol/ISymbolRegistry.d.ts +23 -0
  92. package/types/src/calculation/symbol/IndirectSymbolProvider.d.ts +16 -2
  93. package/types/src/calculation/symbol/SheetSymbolProvider.d.ts +63 -3
  94. package/types/src/calculation/symbol/SymbolRegistry.d.ts +20 -0
  95. package/types/src/calculation/symbol/index.d.ts +3 -2
  96. package/types/src/cell/ICell.d.ts +78 -23
  97. package/types/src/cell/ICellProtection.d.ts +50 -10
  98. package/types/src/cellRange/ICellRange.d.ts +329 -72
  99. package/types/src/cellRange/ICellRanges.d.ts +9 -7
  100. package/types/src/chart/Chart.d.ts +72 -2
  101. package/types/src/chart/ChartCollection.d.ts +26 -0
  102. package/types/src/chart/IChart.d.ts +162 -9
  103. package/types/src/chart/IChartCollection.d.ts +25 -0
  104. package/types/src/chart/_ChartXml.d.ts +70 -0
  105. package/types/src/chart/index.d.ts +1 -3
  106. package/types/src/collections/ArraysGrid.d.ts +1 -1
  107. package/types/src/collections/IGrid.d.ts +1 -1
  108. package/types/src/collections/ISparseGrid.d.ts +9 -0
  109. package/types/src/collections/ISpatialMap.d.ts +59 -21
  110. package/types/src/collections/ImmutableList.d.ts +28 -0
  111. package/types/src/collections/MixedTypedArrayList.d.ts +168 -108
  112. package/types/src/collections/OverlappingRangeIterator.d.ts +13 -17
  113. package/types/src/collections/RepeatingList.d.ts +7 -0
  114. package/types/src/collections/ScalarGrid.d.ts +50 -0
  115. package/types/src/collections/SparseGrid.d.ts +1 -1
  116. package/types/src/collections/SpatialMap.d.ts +13 -21
  117. package/types/src/collections/Tuple.d.ts +128 -16
  118. package/types/src/collections/_GridUtils.d.ts +19 -6
  119. package/types/src/collections/_RangeSweep.d.ts +97 -0
  120. package/types/src/collections/_SpatialUtils.d.ts +20 -2
  121. package/types/src/collections/index.d.ts +1 -0
  122. package/types/src/comment/Comment.d.ts +159 -0
  123. package/types/src/comment/CommentCollection.d.ts +40 -0
  124. package/types/src/comment/IComment.d.ts +319 -48
  125. package/types/src/comment/ICommentCollection.d.ts +90 -0
  126. package/types/src/comment/_CommentUtils.d.ts +28 -0
  127. package/types/src/comment/index.d.ts +1 -0
  128. package/types/src/condition/AnchoredConditional.d.ts +76 -17
  129. package/types/src/condition/BuiltInOperators/AbstractOperator.d.ts +8 -7
  130. package/types/src/condition/BuiltInOperators/EqualToOperator.d.ts +2 -1
  131. package/types/src/condition/BuiltInOperators/ExpressionOperator.d.ts +3 -6
  132. package/types/src/condition/BuiltInOperators/InSetOperator.d.ts +1 -1
  133. package/types/src/condition/BuiltinSelectors/BaseSelector.d.ts +7 -0
  134. package/types/src/condition/BuiltinSelectors/ListSelector.d.ts +9 -0
  135. package/types/src/condition/Condition.d.ts +16 -0
  136. package/types/src/condition/ICondition.d.ts +86 -33
  137. package/types/src/condition/_ConditionFormula.d.ts +152 -0
  138. package/types/src/condition/_ConditionUtils.d.ts +73 -10
  139. package/types/src/conditionalFormat/ConditionalFormat.d.ts +21 -10
  140. package/types/src/conditionalFormat/ConditionalFormatCollection.d.ts +19 -8
  141. package/types/src/conditionalFormat/IConditionalFormat.d.ts +5 -3
  142. package/types/src/conditionalFormat/IConditionalFormatCollection.d.ts +2 -0
  143. package/types/src/dataValidation/DataValidation.d.ts +50 -3
  144. package/types/src/dataValidation/DataValidationCollection.d.ts +20 -9
  145. package/types/src/dataValidation/IDataValidation.d.ts +119 -30
  146. package/types/src/dataValidation/IDataValidationCollection.d.ts +10 -2
  147. package/types/src/date/DateUtils.d.ts +20 -0
  148. package/types/src/date/_DateUtils.d.ts +91 -7
  149. package/types/src/externalBook/ExternalBookCollection.d.ts +145 -12
  150. package/types/src/externalBook/ExternalBookName.d.ts +96 -0
  151. package/types/src/externalBook/IExternalBook.d.ts +170 -18
  152. package/types/src/externalBook/IExternalBookCollection.d.ts +79 -7
  153. package/types/src/externalBook/index.d.ts +1 -0
  154. package/types/src/fill/IStroke.d.ts +1 -1
  155. package/types/src/filter/IFilter.d.ts +29 -4
  156. package/types/src/font/IFont.d.ts +17 -0
  157. package/types/src/history/IHistory.d.ts +3 -2
  158. package/types/src/i18n/LanguagePack.d.ts +12 -4
  159. package/types/src/index.d.ts +3 -0
  160. package/types/src/io/AbstractBackingStore.d.ts +24 -1
  161. package/types/src/io/ArrayBackingStore.d.ts +1 -1
  162. package/types/src/io/EmbeddedPart.d.ts +20 -0
  163. package/types/src/io/IEmbeddedPart.d.ts +63 -0
  164. package/types/src/io/IWorkbookIO.d.ts +185 -18
  165. package/types/src/io/WorkbookIO.d.ts +9 -0
  166. package/types/src/io/WorkbookOrigin.d.ts +20 -11
  167. package/types/src/io/WorkbookOriginProvider.d.ts +46 -0
  168. package/types/src/io/_XmlFragment.d.ts +49 -0
  169. package/types/src/io/index.d.ts +1 -0
  170. package/types/src/lib/file/file.browser.d.ts +19 -5
  171. package/types/src/lib/file/file.node.d.ts +5 -0
  172. package/types/src/lib/utils/_Utils.d.ts +11 -0
  173. package/types/src/lib/utils/utils.browser.d.ts +9 -3
  174. package/types/src/license/license-key.d.ts +27 -0
  175. package/types/src/listener/IListener.d.ts +12 -7
  176. package/types/src/listener/ListenerEmitter.d.ts +46 -5
  177. package/types/src/model/AbstractModel.d.ts +14 -5
  178. package/types/src/movable/Control.d.ts +57 -0
  179. package/types/src/movable/IControl.d.ts +84 -0
  180. package/types/src/movable/IMovable.d.ts +23 -1
  181. package/types/src/movable/IMovableCollection.d.ts +2 -0
  182. package/types/src/movable/Movable.d.ts +4 -6
  183. package/types/src/movable/MovableCollection.d.ts +7 -7
  184. package/types/src/movable/index.d.ts +4 -0
  185. package/types/src/named/AbstractNamed.d.ts +1 -1
  186. package/types/src/named/INamed.d.ts +4 -1
  187. package/types/src/named/INamedCollection.d.ts +26 -0
  188. package/types/src/named/NamedCollection.d.ts +16 -15
  189. package/types/src/numFmt/BuiltInFormats.d.ts +15 -7
  190. package/types/src/numFmt/IFormatEngine.d.ts +2 -0
  191. package/types/src/numFmt/NumfmtFormatEngine.d.ts +2 -0
  192. package/types/src/person/IPerson.d.ts +99 -0
  193. package/types/src/person/IPersonCollection.d.ts +51 -0
  194. package/types/src/person/Person.d.ts +32 -0
  195. package/types/src/person/PersonCollection.d.ts +49 -0
  196. package/types/src/person/index.d.ts +3 -0
  197. package/types/src/picture/IPicture.d.ts +2 -0
  198. package/types/src/picture/Picture.d.ts +2 -0
  199. package/types/src/pivot/IPivotTable.d.ts +107 -0
  200. package/types/src/pivot/IPivotTableCollection.d.ts +25 -0
  201. package/types/src/pivot/PivotTable.d.ts +57 -0
  202. package/types/src/pivot/PivotTableCollection.d.ts +25 -0
  203. package/types/src/pivot/index.d.ts +6 -0
  204. package/types/src/primitives/CompositeRangeStats.d.ts +2 -0
  205. package/types/src/primitives/Criteria.d.ts +1 -1
  206. package/types/src/primitives/LambdaBrand.d.ts +21 -0
  207. package/types/src/primitives/PrimitiveUtils.d.ts +56 -19
  208. package/types/src/primitives/Range.d.ts +102 -24
  209. package/types/src/primitives/RangeStats.d.ts +24 -1
  210. package/types/src/primitives/ReferenceRange.d.ts +42 -0
  211. package/types/src/primitives/Runtime.d.ts +15 -2
  212. package/types/src/primitives/stats/FrequencyStats.d.ts +9 -0
  213. package/types/src/primitives/stats/LookupIndex.d.ts +46 -0
  214. package/types/src/primitives/stats/SortedNumbers.d.ts +2 -0
  215. package/types/src/primitives/stats/index.d.ts +1 -0
  216. package/types/src/print/IPrint.d.ts +0 -22
  217. package/types/src/protectedRange/IProtectedRange.d.ts +4 -0
  218. package/types/src/protectedRange/IProtectedRangeCollection.d.ts +2 -0
  219. package/types/src/protectedRange/ProtectedRange.d.ts +1 -4
  220. package/types/src/protectedRange/ProtectedRangeCollection.d.ts +19 -8
  221. package/types/src/protection/DefaultProtection.d.ts +12 -1
  222. package/types/src/protection/IProtection.d.ts +36 -2
  223. package/types/src/reference/ReferenceUtils.d.ts +80 -0
  224. package/types/src/reference/index.d.ts +2 -0
  225. package/types/src/resource/IResource.d.ts +21 -1
  226. package/types/src/resource/IResourceCollection.d.ts +9 -1
  227. package/types/src/resource/ResourceCollection.d.ts +6 -6
  228. package/types/src/scripting/FunctionCollection.d.ts +41 -11
  229. package/types/src/scripting/IFunctionCollection.d.ts +41 -0
  230. package/types/src/scripting/IModule.d.ts +25 -0
  231. package/types/src/scripting/IModuleCollection.d.ts +17 -0
  232. package/types/src/scripting/IScript.d.ts +18 -0
  233. package/types/src/scripting/Module.d.ts +34 -6
  234. package/types/src/scripting/ModuleCollection.d.ts +17 -12
  235. package/types/src/scripting/Runtime.d.ts +15 -0
  236. package/types/src/scripting/Scripts.d.ts +2 -0
  237. package/types/src/scripting/TypedFunction.d.ts +151 -18
  238. package/types/src/scripting/_FunctionIndex.d.ts +5 -0
  239. package/types/src/scripting/_ModuleUtils.d.ts +11 -1
  240. package/types/src/scripting/_ScriptUtils.d.ts +3 -0
  241. package/types/src/scripting/declarations.browser.d.ts +10 -0
  242. package/types/src/scripting/declarations.d.ts +49 -0
  243. package/types/src/scripting/declarations.node.d.ts +9 -0
  244. package/types/src/scripting/index.d.ts +3 -0
  245. package/types/src/selection/IRangeSelection.d.ts +9 -4
  246. package/types/src/selection/RangeSelection.d.ts +2 -0
  247. package/types/src/shape/IShape.d.ts +41 -3
  248. package/types/src/shape/Shape.d.ts +10 -0
  249. package/types/src/shape/_ShapeXml.d.ts +28 -0
  250. package/types/src/sheet/CellRegion.d.ts +6 -0
  251. package/types/src/sheet/ICellContainerOptions.d.ts +50 -0
  252. package/types/src/sheet/ISheet.d.ts +224 -41
  253. package/types/src/sheet/ISheetCollection.d.ts +2 -5
  254. package/types/src/sheet/NamedCellRange.d.ts +16 -7
  255. package/types/src/sheet/Sheet.d.ts +749 -114
  256. package/types/src/sheet/SheetCell.d.ts +81 -21
  257. package/types/src/sheet/SheetCollection.d.ts +19 -8
  258. package/types/src/sheet/SheetRange.d.ts +62 -14
  259. package/types/src/sheet/SheetRanges.d.ts +4 -6
  260. package/types/src/sheet/_CellBuffer.d.ts +214 -0
  261. package/types/src/sheet/_InvalidSheetRange.d.ts +5 -5
  262. package/types/src/sheet/_ListenerAnchor.d.ts +104 -0
  263. package/types/src/sheet/_RangeStateSweep.d.ts +16 -0
  264. package/types/src/sheet/_ScalarListFactory.d.ts +61 -0
  265. package/types/src/sheet/_SheetAutoFillUtils.d.ts +74 -0
  266. package/types/src/sheet/_SheetAutoFitUtils.d.ts +2 -2
  267. package/types/src/sheet/_SheetEvents.d.ts +43 -0
  268. package/types/src/sheet/_SheetFilterUtils.d.ts +32 -1
  269. package/types/src/sheet/_SheetIntents.d.ts +250 -0
  270. package/types/src/sheet/_SheetMutations.d.ts +179 -59
  271. package/types/src/sheet/_SheetStateReader.d.ts +16 -10
  272. package/types/src/sheet/_SheetStateTypes.d.ts +57 -73
  273. package/types/src/sheet/_SheetUtils.d.ts +2 -18
  274. package/types/src/sheet/_WatchAnchor.d.ts +93 -0
  275. package/types/src/sheet/spatial/HeldFormulaEntry.d.ts +36 -0
  276. package/types/src/sheet/spatial/index.d.ts +1 -0
  277. package/types/src/sheet/style/SheetCellStyle.d.ts +91 -64
  278. package/types/src/sheet/style/SheetDirectStyle.d.ts +16 -5
  279. package/types/src/sheet/style/_Resolvers.d.ts +5 -3
  280. package/types/src/sheet/style/_StyleUtils.d.ts +37 -7
  281. package/types/src/sheetHeader/ISheetHeader.d.ts +2 -0
  282. package/types/src/sheetHeader/SheetHeader.d.ts +14 -0
  283. package/types/src/sheetProtection/ISheetProtection.d.ts +41 -7
  284. package/types/src/sheetProtection/SheetProtection.d.ts +12 -0
  285. package/types/src/sheetView/ISheetView.d.ts +45 -1
  286. package/types/src/sheetView/SheetView.d.ts +11 -0
  287. package/types/src/slicer/ISlicer.d.ts +2 -0
  288. package/types/src/slicer/Slicer.d.ts +2 -0
  289. package/types/src/sort/ISort.d.ts +2 -0
  290. package/types/src/string/IStringCollection.d.ts +5 -0
  291. package/types/src/string/StringCollection.d.ts +6 -6
  292. package/types/src/style/INamedStyleCollection.d.ts +72 -0
  293. package/types/src/style/IStyle.d.ts +30 -10
  294. package/types/src/style/IStyleCollection.d.ts +63 -42
  295. package/types/src/style/ITableStyleCollection.d.ts +89 -0
  296. package/types/src/style/NamedStyleCollection.d.ts +39 -0
  297. package/types/src/style/StyleCollection.d.ts +41 -5
  298. package/types/src/style/TableStyleCollection.d.ts +49 -0
  299. package/types/src/style/_BuiltInStyleDefs.d.ts +3 -3
  300. package/types/src/style/index.d.ts +4 -0
  301. package/types/src/table/AnchoredTable.d.ts +644 -68
  302. package/types/src/table/AutoTable.d.ts +5 -5
  303. package/types/src/table/ITable.d.ts +228 -30
  304. package/types/src/table/ITableCollection.d.ts +2 -0
  305. package/types/src/table/TableCollection.d.ts +19 -8
  306. package/types/src/table/_FilterField.d.ts +7 -5
  307. package/types/src/table/_NamedTable.d.ts +17 -1
  308. package/types/src/table/_NamedTableSource.d.ts +1 -0
  309. package/types/src/table/_SortField.d.ts +2 -0
  310. package/types/src/table/_TableColumn.d.ts +13 -2
  311. package/types/src/table/_TableMessages.d.ts +1 -0
  312. package/types/src/table/_TableUtils.d.ts +40 -0
  313. package/types/src/text/Bullet.d.ts +4 -0
  314. package/types/src/text/ITextFrame.d.ts +25 -1
  315. package/types/src/text/TextBoxAlignment.d.ts +15 -6
  316. package/types/src/text/TextFrame.d.ts +4 -0
  317. package/types/src/text/TextLine.d.ts +4 -0
  318. package/types/src/text/TextParagraph.d.ts +4 -0
  319. package/types/src/text/TextRun.d.ts +9 -0
  320. package/types/src/text/TextStacked.d.ts +83 -0
  321. package/types/src/text/index.d.ts +1 -0
  322. package/types/src/theme/ITheme.d.ts +2 -0
  323. package/types/src/theme/IThemeCollection.d.ts +2 -0
  324. package/types/src/theme/ThemeCollection.d.ts +8 -7
  325. package/types/src/transaction/ITransaction.d.ts +238 -36
  326. package/types/src/transaction/Transaction.d.ts +99 -11
  327. package/types/src/type/AbstractCollection.d.ts +101 -0
  328. package/types/src/type/ICollection.d.ts +117 -0
  329. package/types/src/type/ITypes.d.ts +9 -7
  330. package/types/src/type/index.d.ts +1 -0
  331. package/types/src/utils/_CSSUtils.d.ts +3 -3
  332. package/types/src/workbook/IWorkbook.d.ts +171 -40
  333. package/types/src/workbook/Workbook.d.ts +103 -7
  334. package/types/src/workbook/_WorkbookIntents.d.ts +36 -0
  335. package/types/src/workbookProtection/IWorkbookProtection.d.ts +7 -0
  336. package/types/src/workbookProtection/WorkbookProtection.d.ts +3 -0
  337. package/types/src/workbookView/IWorkbookView.d.ts +12 -0
  338. package/types/src/workbookView/WorkbookView.d.ts +5 -0
  339. package/browser/cjs/BatsV2UUraVDCRXm.cjs +0 -57
  340. package/browser/cjs/CUz53T65cRGQRgvv.cjs +0 -33
  341. package/browser/cjs/DU0kYUtdFa3jK-im.cjs +0 -1
  342. package/browser/cjs/Dv4yIPLV98M5zLHa.cjs +0 -1
  343. package/browser/esm/6JKSOvc5czaQB2Bj.mjs +0 -109
  344. package/browser/esm/BtuJ9AGzeURtAsGo.mjs +0 -51241
  345. package/browser/esm/DGU6sM25u0EWCKl1.mjs +0 -824
  346. package/browser/esm/f2G3QRgEbvFJcoa2.mjs +0 -4436
  347. package/node/esm/-pxdn3M3tc6PLHs7.mjs +0 -114
  348. package/node/esm/0n5bslM9jhO1JnI2.mjs +0 -843
  349. package/types/src/cellRange/_GraphNode.d.ts +0 -38
  350. package/types/src/dataValidation/_Utils.d.ts +0 -10
  351. package/types/src/sheet/listener/RangesListener.d.ts +0 -32
  352. package/types/src/sheet/listener/RangesListenerEntry.d.ts +0 -19
  353. package/types/src/sheet/listener/index.d.ts +0 -3
@@ -1,19 +1,16 @@
1
1
  /**
2
- * @license @sheetxl/sdk - SDK - A high-performance, embeddable spreadsheet engine. - v0.8.0-beta.1
2
+ * @license @sheetxl/sdk - SDK - A high-performance, embeddable spreadsheet engine. - v0.8.0-beta.2
3
3
  *
4
4
  * (C) 2026-present SheetXL Inc. & Michael T. Ford
5
5
  * License: The license can be found at https://www.sheetxl.com/license.
6
6
  */
7
- import { n as e } from "./B0HS42a7lga1k1U_.mjs";
8
- import { $t as t, At as n, B as r, Bt as i, Cn as a, Ct as o, Dn as s, Dt as c, En as l, Et as u, Ft as d, Gt as f, Ht as p, It as m, Jt as h, Lt as g, M as _, Mt as v, Nt as y, On as ee, Ot as b, Pt as te, Qt as ne, Rt as re, Sn as x, St as ie, Tn as S, Tt as ae, U as oe, Ut as C, Vt as w, Wt as T, Xt as E, Y as se, Yt as ce, Zt as le, _n as ue, _t as de, a as D, an as fe, at as pe, bn as me, bt as he, c as ge, cn as _e, ct as ve, d as ye, dn as be, dt as xe, en as O, f as Se, fn as Ce, ft as we, gn as Te, gt as Ee, h as De, hn as Oe, ht as ke, i as Ae, in as k, it as je, jt as Me, kt as Ne, l as A, ln as Pe, lt as Fe, m as Ie, mn as Le, mt as Re, n as ze, nn as Be, o as j, on as Ve, ot as He, p as Ue, pn as We, pt as Ge, qt as Ke, r as qe, rn as Je, rt as Ye, s as Xe, sn as Ze, st as Qe, t as $e, tn as M, u as et, un as tt, ut as nt, vn as rt, vt as it, wn as at, wt as ot, xn as N, xt as st, yn as ct, yt as lt, zt as ut } from "./BtuJ9AGzeURtAsGo.mjs";
9
- import { t as dt } from "./f2G3QRgEbvFJcoa2.mjs";
7
+ import { n as e } from "./BJ9hcZAGY8Tj5_9L.mjs";
8
+ import { $t as t, A as n, An as r, At as i, Bt as a, C as o, Cn as s, Ct as c, D as l, Dn as u, Dt as d, E as f, En as p, Et as m, F as h, Fn as g, Ft as _, Gt as v, Ht as y, I as b, In as x, It as S, Jt as C, Kt as ee, L as te, Lt as ne, M as re, Mn as ie, Mt as ae, N as oe, Nn as w, Nt as se, O as T, On as ce, Ot as le, P as ue, Pn as E, Pt as de, Qt as fe, Rt as pe, S as me, Sn as he, St as ge, T as _e, Tn as ve, Tt as ye, Ut as be, Vt as xe, Wt as Se, Xt as Ce, Yt as we, Zt as Te, _ as Ee, _n as De, a as D, an as O, at as Oe, b as ke, bn as Ae, bt as je, c as Me, cn as Ne, d as Pe, dn as Fe, en as Ie, f as Le, fn as Re, ft as ze, g as Be, gn as Ve, gt as He, h as Ue, hn as We, ht as Ge, i as Ke, in as qe, it as Je, j as Ye, jn as Xe, jt as Ze, k as Qe, kn as k, kt as $e, l as et, ln as tt, m as nt, mn as rt, mt as it, n as at, nn as ot, nt as st, o as A, on as j, ot as ct, p as lt, pn as ut, pt as dt, qt as ft, r as pt, rn as mt, rt as ht, s as gt, sn as _t, st as vt, t as yt, tn as bt, tt as xt, u as M, un as N, v as St, vn as Ct, vt as wt, w as Tt, wn as Et, wt as Dt, x as Ot, xn as kt, xt as At, y as jt, yn as Mt, yt as Nt, zt as Pt } from "./DEPT7zmpiMdZ-_qC.mjs";
10
9
  import { FormulaError as P, ScalarType as F } from "@sheetxl/primitives";
11
- import { BufferUtils as ft, CommonUtils as I, CoordUtils as L, DOMUtils as pt, DefaultLanguagePackService as mt, ExpectedError as R, InvalidPasswordError as ht, MimeType as gt, Notifier as z, NullNotAllowedError as _t, OutOfBoundsError as B, PasswordRequiredError as vt, UndoManager as yt, messageKey as V, t as H } from "@sheetxl/utils";
10
+ import { BufferUtils as Ft, CommonUtils as I, CoordUtils as L, DOMUtils as It, DefaultLanguagePackService as Lt, ExpectedError as R, InvalidPasswordError as Rt, MimeType as zt, Notifier as Bt, NullNotAllowedError as Vt, OutOfBoundsError as z, PasswordRequiredError as Ht, ProtectedError as B, UndoManager as Ut, messageKey as V, t as H } from "@sheetxl/utils";
12
11
  export * from "@sheetxl/primitives";
13
12
  export * from "@sheetxl/utils";
14
- var bt;
15
- bt ||= {};
16
- var xt = class extends yt {
13
+ var Wt, Gt = class extends Ut {
17
14
  constructor(e, t = 50) {
18
15
  super(t), this._transactions = e, this._floorId = e ? e.getCurrentCommit(!1).getId() : null, this._removeListener = e?.addListener({ onCommitChange: () => this._notifyOnStackChange() });
19
16
  }
@@ -106,9 +103,9 @@ var xt = class extends yt {
106
103
  close() {
107
104
  this._removeListener?.();
108
105
  }
109
- }, St = class {
106
+ }, Kt = class {
110
107
  constructor(e, t) {
111
- this._dirty = !1, this._store = e, this._savedCommitId = e.getCurrentCommit()?.getId() ?? null, this._emitter = new S(this);
108
+ this._dirty = !1, this._store = e, this._savedCommitId = e.getCurrentCommit()?.getId() ?? null, this._emitter = new E(this);
112
109
  let n = this;
113
110
  this._removeStoreListener = e.addListener({
114
111
  onCommitEnd() {
@@ -143,9 +140,11 @@ var xt = class extends yt {
143
140
  close() {
144
141
  this._removeStoreListener?.(), this._removeCommitListener?.(), this._emitter.close();
145
142
  }
146
- }, U = class e {
143
+ };
144
+ Wt ||= {};
145
+ var U = class e {
147
146
  constructor(t, n = {}) {
148
- this._password = null, this._emitter = new S(this), this._path = t ?? null, this._name = n.name ?? null, this._format = n.format ?? null, this._size = n.size ?? null, this._canWrite = n.canWrite ?? e._defaultCanWrite(this._path), this._encryption = n.encryption ?? null;
147
+ this._password = null, this._emitter = new E(this), this._path = t ?? null, this._name = n.name ?? null, this._format = n.format ?? null, this._size = n.size ?? null, this._lastModified = n.lastModified ?? null, this._canWrite = n.canWrite ?? e._defaultCanWrite(this._path), this._encryption = n.encryption ?? null;
149
148
  }
150
149
  static _defaultCanWrite(e) {
151
150
  return !!e && !/^(https?:|data:|blob:)/i.test(e);
@@ -156,7 +155,7 @@ var xt = class extends yt {
156
155
  getName() {
157
156
  if (this._name !== null && this._name !== void 0) return this._name;
158
157
  let e = this._cleanPath();
159
- return e && N(e) || null;
158
+ return e && ce(e) || null;
160
159
  }
161
160
  getPath() {
162
161
  return this._path;
@@ -167,7 +166,7 @@ var xt = class extends yt {
167
166
  getExtension() {
168
167
  let e = this._cleanPath();
169
168
  if (!e) return null;
170
- let t = x(e);
169
+ let t = k(e);
171
170
  return t ? t.toLowerCase() : null;
172
171
  }
173
172
  getEncryption() {
@@ -185,6 +184,9 @@ var xt = class extends yt {
185
184
  getSize() {
186
185
  return this._size;
187
186
  }
187
+ getLastModified() {
188
+ return this._lastModified;
189
+ }
188
190
  canWrite() {
189
191
  return this._canWrite;
190
192
  }
@@ -193,7 +195,7 @@ var xt = class extends yt {
193
195
  }
194
196
  update(e) {
195
197
  let t = !1;
196
- return e.path !== void 0 && e.path !== this._path && (this._path = e.path, t = !0), e.name !== void 0 && e.name !== this._name && (this._name = e.name, t = !0), e.format !== void 0 && e.format !== this._format && (this._format = e.format, t = !0), e.size !== void 0 && e.size !== this._size && (this._size = e.size, t = !0), e.canWrite !== void 0 && e.canWrite !== this._canWrite && (this._canWrite = e.canWrite, t = !0), e.encryption !== void 0 && e.encryption !== this._encryption && (this._encryption = e.encryption, t = !0), t && this._emitter.notify("onChange"), this;
198
+ return e.lastModified !== void 0 && e.lastModified !== this._lastModified && (this._lastModified = e.lastModified, t = !0), e.name !== void 0 && e.name !== this._name && (this._name = e.name, t = !0), e.format !== void 0 && e.format !== this._format && (this._format = e.format, t = !0), e.size !== void 0 && e.size !== this._size && (this._size = e.size, t = !0), e.canWrite !== void 0 && e.canWrite !== this._canWrite && (this._canWrite = e.canWrite, t = !0), e.encryption !== void 0 && e.encryption !== this._encryption && (this._encryption = e.encryption, t = !0), t && this._emitter.notify("onChange"), this;
197
199
  }
198
200
  addListeners(e, t) {
199
201
  return this._emitter.addListeners(e, t);
@@ -214,37 +216,59 @@ var xt = class extends yt {
214
216
  ];
215
217
  return `${t} ${(n / 1024 ** r).toFixed(2)}${i[Math.min(r, i.length - 1)]}`;
216
218
  }
217
- }, Ct = class {
219
+ }, W = /* @__PURE__ */ new WeakMap(), G = /* @__PURE__ */ new Set(), qt = (e) => W.get(e) ?? null, Jt = () => Array.from(G, (e) => e.getOrigin()), Yt = class e {
220
+ constructor(t) {
221
+ this._released = !1, e._assertFree(t), this._emitter = new E(this), this._origin = t, W.set(t, this), G.add(this);
222
+ }
223
+ getOrigin() {
224
+ return this._origin;
225
+ }
226
+ setOrigin(t) {
227
+ t !== this._origin && (e._assertFree(t), this._released || (W.delete(this._origin), W.set(t, this)), this._origin = t, this._emitter.notify("onOriginChange"));
228
+ }
229
+ release() {
230
+ this._released || (this._released = !0, W.get(this._origin) === this && W.delete(this._origin), G.delete(this));
231
+ }
232
+ addListeners(e, t) {
233
+ return this._emitter.addListeners(e, t);
234
+ }
235
+ static _assertFree(e) {
236
+ if (W.has(e)) throw Error("This origin already backs an open workbook; an origin backs one workbook at a time.");
237
+ }
238
+ }, Xt = class {
218
239
  constructor() {
219
240
  this._defaultStringSourceType = "filepath";
220
241
  }
221
242
  async read(e) {
222
243
  let t = e.options ?? {}, n = e.source;
223
244
  if (typeof n == "function" && (n = n()), n && typeof n == "object" && typeof n.then == "function" && (n = await Promise.resolve(n)), n == null && (n = await this.resolveSource(e), n == null)) return null;
224
- let r = t.format, i = this._detectSourceType(n);
225
- if (!i) throw Error("Unable to detect source type from provided input.");
226
- let a, o, s = !1;
227
- if (i === "filepath") {
245
+ let r = n, i = await this.fileFromHandle(n);
246
+ i && (n = i);
247
+ let a = t.format, o = this._detectSourceType(n);
248
+ if (!o) throw Error("Unable to detect source type from provided input.");
249
+ let s, c, l = !1;
250
+ if (o === "filepath") {
228
251
  let e = typeof n == "string" && n.startsWith("file://") ? n.slice(7) : n;
229
- n = await this.filePathToFile(e), i = "file", s = !0;
252
+ n = await this.filePathToFile(e), o = "file", l = !0;
230
253
  }
231
- switch (i) {
254
+ switch (o) {
232
255
  case "file": {
233
- let e = n, t = e?.name, i = t ? `${N(t)}` : "";
234
- a = await e.arrayBuffer(), o = {
235
- format: r,
236
- ext: x(t),
237
- name: i,
238
- absolutePath: t,
256
+ let e = n, r = e?.name, o = r ? `${ce(r)}` : "";
257
+ s = await e.arrayBuffer(), c = {
258
+ format: a,
259
+ ext: k(r),
260
+ name: o,
261
+ absolutePath: r,
239
262
  size: e.size,
240
- canWrite: s && this._canWriteLocalPath()
263
+ lastModified: e.lastModified,
264
+ canWrite: !t.asCopy && (!!i || l && this._canWriteLocalPath())
241
265
  };
242
266
  break;
243
267
  }
244
268
  case "blob": {
245
269
  let e = n;
246
- a = await e.arrayBuffer(), o = {
247
- format: r,
270
+ s = await e.arrayBuffer(), c = {
271
+ format: a,
248
272
  size: e.size
249
273
  };
250
274
  break;
@@ -256,68 +280,85 @@ var xt = class extends yt {
256
280
  let [, t] = n.split(",");
257
281
  e = t;
258
282
  } else e = n;
259
- a = ft.base64ToArrayBuffer(e), o = {
260
- format: r,
283
+ s = Ft.base64ToArrayBuffer(e), c = {
284
+ format: a,
261
285
  size: e.length
262
286
  };
263
287
  break;
264
288
  }
265
289
  case "fetch": {
266
- let e, t, i;
290
+ let e, t, r;
267
291
  if (typeof n == "string") e = n;
268
292
  else {
269
293
  if (!n || typeof n != "object" || !("input" in n)) throw Error("Invalid fetch source provided.");
270
294
  {
271
- let r = n;
272
- e = r.input, t = r.init, i = r.timeout;
295
+ let i = n;
296
+ e = i.input, t = i.init, r = i.timeout;
273
297
  }
274
298
  }
275
- let s = i || 3e4, c = new AbortController(), l = setTimeout(() => c.abort(), s), u = typeof e == "string" ? e : e.toString(), d = x(u);
299
+ let i = r || 3e4, o = new AbortController(), l = setTimeout(() => o.abort(), i), u = typeof e == "string" ? e : e.toString(), d = k(u);
276
300
  try {
277
301
  let n = await fetch(e, {
278
302
  ...t,
279
- signal: c.signal
303
+ signal: o.signal
280
304
  });
281
305
  if (clearTimeout(l), !n.ok) throw Error(`Failed to fetch: ${n.status} ${n.statusText}`);
282
- let i = await n.arrayBuffer();
283
- if (!i) throw Error(`Unable to fetched content: ${u}`);
284
- a = i, o = {
285
- format: r,
306
+ let r = await n.arrayBuffer();
307
+ if (!r) throw Error(`Unable to fetched content: ${u}`);
308
+ s = r, c = {
309
+ format: a,
286
310
  ext: d,
287
- name: N(u, !0),
311
+ name: ce(u, !0),
288
312
  absolutePath: u
289
313
  };
290
314
  } catch (e) {
291
- throw clearTimeout(l), e.name === "AbortError" ? Error(`Fetch timeout after ${s}ms: ${u}`) : e;
315
+ throw clearTimeout(l), e.name === "AbortError" ? Error(`Fetch timeout after ${i}ms: ${u}`) : e;
292
316
  }
293
317
  break;
294
318
  }
295
319
  case "buffer":
296
- a = n, o = { format: r };
320
+ s = n, c = { format: a };
297
321
  break;
298
322
  case "stream": {
299
- let e = n.getReader(), t = [], i = 0;
323
+ let e = n.getReader(), t = [], r = 0;
300
324
  try {
301
325
  for (;;) {
302
- let { done: n, value: r } = await e.read();
326
+ let { done: n, value: i } = await e.read();
303
327
  if (n) break;
304
- t.push(r), i += r.length;
328
+ t.push(i), r += i.length;
305
329
  }
306
330
  } finally {
307
331
  e.releaseLock();
308
332
  }
309
- let s = new ArrayBuffer(i), c = new Uint8Array(s), l = 0;
310
- for (let e of t) c.set(e, l), l += e.length;
311
- a = s, o = { format: r };
333
+ let i = new ArrayBuffer(r), o = new Uint8Array(i), l = 0;
334
+ for (let e of t) o.set(e, l), l += e.length;
335
+ s = i, c = { format: a };
312
336
  break;
313
337
  }
314
- default: throw Error(`Unsupported source type: ${i}`);
338
+ default: throw Error(`Unsupported source type: ${o}`);
315
339
  }
316
- let c = await e.decode(a, {
317
- sourceType: i,
318
- ...o
340
+ c.canWrite && await this.findOpenOrigin(r, c) && (c.canWrite = !1);
341
+ let u = await e.decode(s, {
342
+ sourceType: o,
343
+ ...c
319
344
  });
320
- return c ? (await this.onWorkbookRead(c, n), c) : null;
345
+ return u ? (await this.onWorkbookRead(u, r), u) : null;
346
+ }
347
+ async findOpenOrigin(e, t) {
348
+ return t.absolutePath ? this.findOpenPath(t.absolutePath) : null;
349
+ }
350
+ findOpenPath(e, t) {
351
+ return Jt().find((n) => {
352
+ if (n === t || !n.canWrite()) return !1;
353
+ let r = n.getPath();
354
+ return !!r && this.isSamePath(r, e);
355
+ }) ?? null;
356
+ }
357
+ isSamePath(e, t) {
358
+ return e === t;
359
+ }
360
+ async fileFromHandle(e) {
361
+ return null;
321
362
  }
322
363
  async resolveSource(e) {
323
364
  return null;
@@ -338,25 +379,21 @@ var xt = class extends yt {
338
379
  }
339
380
  if (typeof File < "u" && e instanceof File) return "file";
340
381
  if (typeof Blob < "u" && e instanceof Blob) return "blob";
341
- let t = e instanceof ArrayBuffer || Object.prototype.toString.call(e) === "[object ArrayBuffer]", n = ArrayBuffer.isView(e), r = ft.isNodeBuffer(e);
382
+ let t = e instanceof ArrayBuffer || Object.prototype.toString.call(e) === "[object ArrayBuffer]", n = ArrayBuffer.isView(e), r = Ft.isNodeBuffer(e);
342
383
  return t || n || r ? "buffer" : typeof ReadableStream < "u" && e instanceof ReadableStream || Object.prototype.toString.call(e) === "[object ReadableStream]" || e && typeof e.getReader == "function" && e.locked !== void 0 ? "stream" : null;
343
384
  }
344
- }, wt = class extends Ct {
385
+ }, Zt = class extends Xt {
345
386
  constructor(e, t) {
346
- super(), this._getWriteFormats = e, this._getReadFormats = t, this._defaultStringSourceType = "fetch", this._handleCache = /* @__PURE__ */ new WeakMap(), this._pendingOpenHandle = null;
387
+ super(), this._getWriteFormats = e, this._getReadFormats = t, this._defaultStringSourceType = "fetch", this._handleCache = /* @__PURE__ */ new WeakMap();
347
388
  }
348
- async read(e) {
349
- let t = e.source;
350
- return t && t.kind === "file" && typeof t.getFile == "function" ? (this._pendingOpenHandle = t, super.read({
351
- ...e,
352
- source: await t.getFile()
353
- })) : super.read(e);
389
+ async fileFromHandle(e) {
390
+ return K(e) ? e.getFile() : null;
354
391
  }
355
392
  async resolveSource() {
356
393
  let e = await this._getReadFormats?.() ?? [];
357
394
  if (typeof globalThis.showOpenFilePicker == "function") try {
358
395
  let t = function(e) {
359
- let t = Tt(e);
396
+ let t = Qt(e);
360
397
  if (t.length <= 1) return t;
361
398
  let n = /* @__PURE__ */ new Set(), r = {};
362
399
  for (let e of t) for (let [t, i] of Object.entries(e.accept)) for (let e of i) n.has(e) || (n.add(e), (r[t] ??= []).push(e));
@@ -365,30 +402,35 @@ var xt = class extends yt {
365
402
  accept: r
366
403
  }, ...t];
367
404
  }(e), [n] = await globalThis.showOpenFilePicker(t.length ? { types: t } : void 0);
368
- return this._pendingOpenHandle = n, await n.getFile();
405
+ return n;
369
406
  } catch (e) {
370
407
  if (e?.name === "AbortError") return null;
371
408
  throw e;
372
409
  }
373
410
  let t = e.flatMap((e) => e.exts.map((e) => "." + e)).join(", ");
374
- return pt.openFileDialog(t);
411
+ return It.openFileDialog(t);
412
+ }
413
+ async findOpenOrigin(e) {
414
+ return K(e) ? this._findOpenHandle(e) : null;
375
415
  }
376
- async onWorkbookRead(e) {
377
- if (this._pendingOpenHandle) {
378
- let t = e.getOrigin?.();
379
- t && (this._handleCache.set(t, this._pendingOpenHandle), t instanceof U && t.update({ canWrite: !0 })), this._pendingOpenHandle = null;
416
+ async _findOpenHandle(e, t) {
417
+ for (let n of Jt()) {
418
+ if (n === t || !n.canWrite()) continue;
419
+ let r = this._handleCache.get(n);
420
+ if (r && typeof r.isSameEntry == "function" && await r.isSameEntry(e)) return n;
380
421
  }
422
+ return null;
423
+ }
424
+ async onWorkbookRead(e, t) {
425
+ if (!K(t)) return;
426
+ let n = e.getOrigin?.();
427
+ n?.canWrite() && this._handleCache.set(n, t);
381
428
  }
382
429
  async filePathToFile(e) {
383
430
  throw Error(`Cannot read local file path '${e}' in browser environment. Use a file input element or fetch for remote URLs.`);
384
431
  }
385
432
  async write(e) {
386
433
  let { origin: t, suggestedName: n, format: r, encode: i, prompt: a } = e, o = [r, ...(await this._getWriteFormats()).filter((e) => e.key !== r.key)], s = typeof globalThis.showSaveFilePicker == "function", c = !a && t.canWrite() ? this._handleCache.get(t) : void 0;
387
- if (c?.name) {
388
- let e = t.getPath()?.split(/[/\\]/).pop();
389
- e && c.name !== e && (c = void 0);
390
- }
391
- let l = !!c;
392
434
  if (s) try {
393
435
  if (c) {
394
436
  let e = await async function(e) {
@@ -403,39 +445,46 @@ var xt = class extends yt {
403
445
  if (e === "denied") return null;
404
446
  e !== "granted" && (c = void 0);
405
447
  }
406
- c ||= await globalThis.showSaveFilePicker({
407
- suggestedName: n,
408
- types: Tt(o)
409
- });
410
- let e = Dt(c.name ?? n), a = o.find((t) => t.exts.some((t) => t.toLowerCase() === e)) ?? r, s = await i(a.key), u = new Blob([Et(s)], { type: a.mimeType || "application/octet-stream" }), d = await c.createWritable();
411
- return await d.write(u), await d.close(), this._handleCache.set(t, c), t instanceof U && t.update({
412
- size: u.size,
413
- ...l ? null : {
414
- path: c.name ?? n,
415
- name: null,
416
- format: a.key,
417
- canWrite: !0
418
- }
419
- }), t;
448
+ let a = !!c;
449
+ if (!a) {
450
+ c = await globalThis.showSaveFilePicker({
451
+ suggestedName: n,
452
+ types: Qt(o)
453
+ });
454
+ let t = await this._findOpenHandle(c, e.workbook?.getOrigin?.());
455
+ if (t) throw new R(H("error.io.openElsewhere", { name: t.getName() ?? c.name ?? "" }));
456
+ }
457
+ let s = en(c.name ?? n), l = o.find((e) => e.exts.some((e) => e.toLowerCase() === s)) ?? r, u = a ? t : new U(c.name ?? n, {
458
+ format: l.key,
459
+ canWrite: !0
460
+ }), d = await i(l.key, u);
461
+ if (!d) return null;
462
+ let f = new Blob([$t(d)], { type: l.mimeType || "application/octet-stream" }), p = await c.createWritable();
463
+ if (await p.write(f), await p.close(), this._handleCache.set(u, c), u instanceof U) {
464
+ let e = await Promise.resolve(c.getFile?.()).then((e) => e?.lastModified ?? null, () => null);
465
+ u.update({
466
+ size: f.size,
467
+ lastModified: e
468
+ });
469
+ }
470
+ return u;
420
471
  } catch (e) {
421
472
  if (e?.name === "AbortError") return null;
422
- }
423
- let u = await i(r.key), d = new Blob([Et(u)], { type: r.mimeType || "application/octet-stream" }), f = t.getPath(), p = f ? f.split(/[/\\]/).pop() : null, m = p && Dt(p) ? p : n;
473
+ if (e instanceof R) throw e;
474
+ }
475
+ let l = t.getPath(), u = l ? l.split(/[/\\]/).pop() : null, d = u && r.exts.some((e) => e.toLowerCase() === en(u)) ? u : n, f = l !== d || t.canWrite() ? new U(d, {
476
+ format: r.key,
477
+ canWrite: !1
478
+ }) : t, p = await i(r.key, f);
479
+ if (!p) return null;
480
+ let m = new Blob([$t(p)], { type: r.mimeType || "application/octet-stream" });
424
481
  return function(e, t) {
425
482
  let n = URL.createObjectURL(e), r = document.createElement("a");
426
483
  r.style.display = "none", r.href = n, r.download = t, document.body.appendChild(r), r.click(), document.body.removeChild(r), URL.revokeObjectURL(n);
427
- }(d, m), t instanceof U && t.update({
428
- size: d.size,
429
- ...t.getPath() === m ? null : {
430
- path: m,
431
- name: null,
432
- format: r.key,
433
- canWrite: !1
434
- }
435
- }), t;
484
+ }(m, d), f instanceof U && f.update({ size: m.size }), f;
436
485
  }
437
486
  };
438
- function Tt(e) {
487
+ function Qt(e) {
439
488
  return e.map((e) => {
440
489
  let t = e.mimeType && e.mimeType.includes("/") ? e.mimeType : "application/octet-stream";
441
490
  return {
@@ -444,18 +493,21 @@ function Tt(e) {
444
493
  };
445
494
  });
446
495
  }
447
- function Et(e) {
496
+ function K(e) {
497
+ return !!e && e.kind === "file" && typeof e.getFile == "function";
498
+ }
499
+ function $t(e) {
448
500
  if (typeof SharedArrayBuffer < "u" && e instanceof SharedArrayBuffer) {
449
501
  let t = new ArrayBuffer(e.byteLength);
450
502
  return new Uint8Array(t).set(new Uint8Array(e)), t;
451
503
  }
452
504
  return e;
453
505
  }
454
- function Dt(e) {
506
+ function en(e) {
455
507
  let t = e.lastIndexOf(".");
456
508
  return t >= 0 ? e.slice(t + 1).toLowerCase() : "";
457
509
  }
458
- var Ot = class {
510
+ var tn = class {
459
511
  constructor(e) {
460
512
  this._private = { input: e }, typeof e == "string" ? this._private.name = e : Object.assign(this._private, e);
461
513
  }
@@ -477,11 +529,11 @@ var Ot = class {
477
529
  get isIFont() {
478
530
  return !0;
479
531
  }
480
- }, kt = e({
481
- findBestMatch: () => Pt,
482
- getFontList: () => Nt,
483
- setFontList: () => K
484
- }), At = [
532
+ }, nn = e({
533
+ findBestMatch: () => dn,
534
+ getFontList: () => ln,
535
+ setFontList: () => cn
536
+ }), rn = [
485
537
  "Arial",
486
538
  "Arial Black",
487
539
  "Brush Script MT",
@@ -497,55 +549,55 @@ var Ot = class {
497
549
  "Times New Roman",
498
550
  "Trebuchet MS",
499
551
  "Verdana"
500
- ], W = /* @__PURE__ */ new Map();
501
- W.set(k.GenericName.Serif, ["Tahoma"]), W.set(k.GenericName.SanSerif, ["Calibri"]), W.set(k.GenericName.MonoSpace, ["Courier New"]), W.set(k.GenericName.Cursive, ["Comic Sans MS"]), W.set(k.GenericName.Fantasy, ["Luminari"]), W.set(k.GenericName.UISystem, ["Arial"]), W.set(k.GenericName.UISerif, ["Tahoma"]), W.set(k.GenericName.UISanSerif, ["Arial"]), W.set(k.GenericName.UIMonoSpace, ["Courier New"]), W.set(k.GenericName.UIRounded, ["Arial"]), W.set(k.GenericName.Math, []), W.set(k.GenericName.Emoji, []), W.set(k.GenericName.Fangsong, []);
502
- var G = /* @__PURE__ */ new Map(), jt = [];
503
- K(At);
504
- var Mt = eval;
505
- function K(e) {
506
- e || K(At);
552
+ ], q = /* @__PURE__ */ new Map();
553
+ q.set(N.GenericName.Serif, ["Tahoma"]), q.set(N.GenericName.SanSerif, ["Calibri"]), q.set(N.GenericName.MonoSpace, ["Courier New"]), q.set(N.GenericName.Cursive, ["Comic Sans MS"]), q.set(N.GenericName.Fantasy, ["Luminari"]), q.set(N.GenericName.UISystem, ["Arial"]), q.set(N.GenericName.UISerif, ["Tahoma"]), q.set(N.GenericName.UISanSerif, ["Arial"]), q.set(N.GenericName.UIMonoSpace, ["Courier New"]), q.set(N.GenericName.UIRounded, ["Arial"]), q.set(N.GenericName.Math, []), q.set(N.GenericName.Emoji, []), q.set(N.GenericName.Fangsong, []);
554
+ var an = /* @__PURE__ */ new Map(), on = [];
555
+ cn(rn);
556
+ var sn = eval;
557
+ function cn(e) {
558
+ e || cn(rn);
507
559
  let t = [];
508
560
  for (let n = 0; n < e.length; n++) {
509
561
  let r = e[n];
510
- typeof r == "string" && (r = new Ot(r));
562
+ typeof r == "string" && (r = new tn(r));
511
563
  let i = !0;
512
564
  try {
513
- i = Mt(`document.fonts.check('12px ${r.getFamily()}')`);
565
+ i = sn(`document.fonts.check('12px ${r.getFamily()}')`);
514
566
  } catch {}
515
567
  let a = {
516
568
  fontRef: r,
517
569
  loaded: i
518
570
  };
519
- t.push(a), G.set(r.getFamily(), a);
571
+ t.push(a), an.set(r.getFamily(), a);
520
572
  }
521
- jt = Object.freeze(t);
573
+ on = Object.freeze(t);
522
574
  }
523
- function Nt() {
524
- return jt;
575
+ function ln() {
576
+ return on;
525
577
  }
526
- var q = /* @__PURE__ */ new Map();
527
- function Pt(e, t) {
528
- let n = q.get(e);
578
+ var un = /* @__PURE__ */ new Map();
579
+ function dn(e, t) {
580
+ let n = un.get(e);
529
581
  if (n) return n.fontRef === null ? null : n;
530
582
  let r = [e];
531
583
  t?.fallbacks && (r = r.concat(t.fallbacks));
532
584
  let i = null;
533
585
  for (let e = 0; !i && e < r.length; e++) {
534
586
  let t = r[e];
535
- if (i = G.get(t), !i) {
536
- let e = W.get(t);
537
- if (e) for (let t = 0; !i && t < e.length; t++) i = G.get(e[t]);
587
+ if (i = an.get(t), !i) {
588
+ let e = q.get(t);
589
+ if (e) for (let t = 0; !i && t < e.length; t++) i = an.get(e[t]);
538
590
  }
539
591
  }
540
- return i ? q.set(e, i) : q.set(e, {
592
+ return i ? un.set(e, i) : un.set(e, {
541
593
  fontRef: null,
542
594
  loaded: !1
543
595
  }), i;
544
596
  }
545
- var Ft, It, J, Lt, Rt = e({
546
- DefaultFontSizes: () => zt,
547
- findNextFontSize: () => Bt
548
- }), zt = Object.freeze([
597
+ var fn, pn, J, mn, hn = e({
598
+ DefaultFontSizes: () => gn,
599
+ findNextFontSize: () => _n
600
+ }), gn = Object.freeze([
549
601
  8,
550
602
  9,
551
603
  10,
@@ -564,19 +616,19 @@ var Ft, It, J, Lt, Rt = e({
564
616
  48,
565
617
  72
566
618
  ]);
567
- function Bt(e, t = !0, n = zt) {
619
+ function _n(e, t = !0, n = gn) {
568
620
  if (!n || n.length === 0) return e;
569
621
  if (e === void 0) return n[0];
570
622
  if (t && e >= n[n.length - 1] || !t && e <= n[0]) return e;
571
623
  let r = I.findEqualOrGreater(n, e);
572
624
  return t ? (n[r] === e && (r += 1), n[r] || --r, n[r]) : (--r, n[r]);
573
625
  }
574
- (Ft ||= {}).SortOn = {
626
+ (fn ||= {}).SortOn = {
575
627
  Value: "value",
576
628
  FillColor: "fillColor",
577
629
  FontColor: "fontColor",
578
630
  Icon: "icon"
579
- }, (J = It ||= {}).Compound = {
631
+ }, (J = pn ||= {}).Compound = {
580
632
  Single: "sng",
581
633
  Double: "dbl",
582
634
  ThickThin: "thickThin",
@@ -598,7 +650,7 @@ function Bt(e, t = !0, n = zt) {
598
650
  Single: "none",
599
651
  Double: "double",
600
652
  ThickThin: "thickThin",
601
- ThinThick: "thickThin"
653
+ ThinThick: "thinThick"
602
654
  }, J.StrokeStyle = {
603
655
  None: "none",
604
656
  Dashed: "dashed",
@@ -611,7 +663,7 @@ function Bt(e, t = !0, n = zt) {
611
663
  SysDashDot: "sysDashDot",
612
664
  SysDashDotDot: "sysDashDotDot",
613
665
  SysDot: "sysDot"
614
- }, (Lt ||= {}).Type = {
666
+ }, (mn ||= {}).Type = {
615
667
  OuterShadow: "outerShadow",
616
668
  InnerShadow: "innerShadow",
617
669
  PresetShadow: "presetShadow",
@@ -619,7 +671,7 @@ function Bt(e, t = !0, n = zt) {
619
671
  SoftEdge: "softEdge",
620
672
  Reflection: "reflection"
621
673
  };
622
- var Y = ut.BuiltInName, Vt = {
674
+ var Y = C.BuiltInName, vn = {
623
675
  [Y.Normal]: V("style.builtin.normal"),
624
676
  [Y.Comma]: V("style.builtin.comma"),
625
677
  [Y.Currency]: V("style.builtin.currency"),
@@ -641,31 +693,31 @@ var Y = ut.BuiltInName, Vt = {
641
693
  [Y.Bad]: V("style.builtin.bad"),
642
694
  [Y.Neutral]: V("style.builtin.neutral"),
643
695
  [Y.ExplanatoryText]: V("style.builtin.explanatoryText")
644
- }, Ht = V("style.builtin.heading"), Ut = V("style.builtin.accent"), Wt = V("style.builtin.accentTint"), Gt = /^Heading ([1-4])$/, Kt = /^Accent([1-6])$/, qt = /^(20|40|60)% - Accent([1-6])$/;
645
- function Jt(e) {
646
- let t = Vt[e];
696
+ }, yn = V("style.builtin.heading"), bn = V("style.builtin.accent"), xn = V("style.builtin.accentTint"), Sn = /^Heading ([1-4])$/, Cn = /^Accent([1-6])$/, wn = /^(20|40|60)% - Accent([1-6])$/;
697
+ function Tn(e) {
698
+ let t = vn[e];
647
699
  if (t) return { key: t };
648
- let n = Gt.exec(e);
700
+ let n = Sn.exec(e);
649
701
  return n ? {
650
- key: Ht,
702
+ key: yn,
651
703
  params: { n: +n[1] }
652
- } : (n = Kt.exec(e), n ? {
653
- key: Ut,
704
+ } : (n = Cn.exec(e), n ? {
705
+ key: bn,
654
706
  params: { n: +n[1] }
655
- } : (n = qt.exec(e), n ? {
656
- key: Wt,
707
+ } : (n = wn.exec(e), n ? {
708
+ key: xn,
657
709
  params: {
658
710
  pct: +n[1],
659
711
  n: +n[2]
660
712
  }
661
713
  } : null));
662
714
  }
663
- var Yt, Xt, Zt, Qt, $t = (e, t, n, r, i) => {
715
+ var En, Dn, On, kn, An = (e, t, n, r, i) => {
664
716
  let a = JSON.parse(JSON.stringify(e.definition));
665
717
  a.adjs ||= [];
666
718
  let o = "", s = 0, c = 0;
667
- t > 0 ? (c = t, s = 100 - t, o = H("op.lighterPercent", { percent: t })) : t < 0 && (s = 100 + t, o = H("op.darkerPercent", { percent: -t })), s && a.adjs.push({ [C.AdjustmentType.LumMod]: s }), c && a.adjs.push({ [C.AdjustmentType.LumOff]: c });
668
- let l = new w({
719
+ t > 0 ? (c = t, s = 100 - t, o = H("op.lighterPercent", { percent: t })) : t < 0 && (s = 100 + t, o = H("op.darkerPercent", { percent: -t })), s && a.adjs.push({ [fe.AdjustmentType.LumMod]: s }), c && a.adjs.push({ [fe.AdjustmentType.LumOff]: c });
720
+ let l = new Ce({
669
721
  val: a.val,
670
722
  adjs: a.adjs
671
723
  }, n), u = l.toString();
@@ -676,14 +728,14 @@ var Yt, Xt, Zt, Qt, $t = (e, t, n, r, i) => {
676
728
  definition: a
677
729
  };
678
730
  };
679
- function en(e, t, n, r) {
731
+ function jn(e, t, n, r) {
680
732
  let i = [];
681
733
  for (let a = 0; a < e.length; a++) {
682
734
  let o = [];
683
735
  i.push(o);
684
736
  let s = (i) => {
685
- for (let s = 0; s < i.length; s++) o.push($t(e[a], i[s], t, n, r));
686
- }, c = new w({
737
+ for (let s = 0; s < i.length; s++) o.push(An(e[a], i[s], t, n, r));
738
+ }, c = new Ce({
687
739
  val: e[a].definition.val,
688
740
  adjs: e[a].definition.adjs
689
741
  }, t).toHSLA().lum;
@@ -721,11 +773,11 @@ function en(e, t, n, r) {
721
773
  }
722
774
  return i;
723
775
  }
724
- (Yt ||= {}).buildPalette = en, Xt ||= {}, Zt ||= {}, Qt ||= {};
776
+ (En ||= {}).buildPalette = jn, Dn ||= {}, On ||= {}, kn ||= {};
725
777
  var X = null;
726
- function tn() {
778
+ function Mn() {
727
779
  if (!X) {
728
- let e = import("./6JKSOvc5czaQB2Bj.mjs").then(({ initializeFunctions: e }) => {
780
+ let e = import("./DOvCi3lf49To36WP.mjs").then(({ initializeFunctions: e }) => {
729
781
  let t = e(() => null);
730
782
  return Object.freeze(Array.from(t.keys()));
731
783
  });
@@ -735,47 +787,47 @@ function tn() {
735
787
  }
736
788
  return X;
737
789
  }
738
- function nn(e) {
790
+ function Nn(e) {
739
791
  let t = e.trim();
740
792
  if (!t) return;
741
793
  let n;
742
794
  try {
743
- let e = dt.shared().tokenize(t, !1);
795
+ let e = He.shared().tokenize(t, !1);
744
796
  if (e.errors.length > 0) return;
745
797
  n = e.tokens;
746
798
  } catch {
747
799
  return;
748
800
  }
749
- let i = 0, a = 0;
801
+ let r = 0, i = 0;
750
802
  if (n.length === 2) {
751
803
  let e = n[0].tokenType?.name;
752
- e === "MinOp" ? (i = -1, a = 1) : e === "PlusOp" && (i = 1, a = 1);
804
+ e === "MinOp" ? (r = -1, i = 1) : e === "PlusOp" && (r = 1, i = 1);
753
805
  }
754
- if (n.length - a !== 1) return;
755
- let o = n[a], s = o.image;
806
+ if (n.length - i !== 1) return;
807
+ let a = n[i], o = a.image;
756
808
  try {
757
- switch (o.tokenType?.name) {
809
+ switch (a.tokenType?.name) {
758
810
  case "NumberToken":
759
811
  case "ScientificDigit":
760
812
  case "DigitToken": {
761
- let e = oe(s).value;
762
- return i === 0 ? e : i * e;
813
+ let e = it(o).value;
814
+ return r === 0 ? e : r * e;
763
815
  }
764
- case "StringToken": return i === 0 ? se(s).value : void 0;
765
- case "BooleanToken": return i === 0 ? _(s).value : void 0;
816
+ case "StringToken": return r === 0 ? Ge(o).value : void 0;
817
+ case "BooleanToken": return r === 0 ? ze(o).value : void 0;
766
818
  case "LiteralError":
767
- case "RefError": return i === 0 ? r(s).value : void 0;
819
+ case "RefError": return r === 0 ? dt(o).value : void 0;
768
820
  default: return;
769
821
  }
770
822
  } catch {
771
823
  return;
772
824
  }
773
825
  }
774
- function rn(e, t) {
775
- let n = an(e), r = an(t);
826
+ function Pn(e, t) {
827
+ let n = Fn(e), r = Fn(t);
776
828
  return n === r ? e === t ? 0 : typeof e == "number" && typeof t == "number" ? e < t ? -1 : 1 : typeof e == "string" && typeof t == "string" ? e < t ? -1 : +(e > t) : typeof e == "boolean" ? e ? 1 : -1 : P.isError(e) && P.isError(t) ? e.getCode() - t.getCode() : 0 : n - r;
777
829
  }
778
- function an(e) {
830
+ function Fn(e) {
779
831
  if (e === null) return 0;
780
832
  switch (typeof e) {
781
833
  case "number": return 1;
@@ -784,10 +836,23 @@ function an(e) {
784
836
  default: return P.isError(e) ? 4 : 5;
785
837
  }
786
838
  }
787
- var on = class {
839
+ var In = class {
788
840
  constructor(e) {
789
841
  this._children = e;
790
842
  }
843
+ getCoords() {
844
+ let e = this._children, t = null;
845
+ for (let n = 0; n < e.length; n++) {
846
+ let r = e[n].getCoords();
847
+ r && (t = t ? {
848
+ rowStart: Math.min(t.rowStart, r.rowStart),
849
+ colStart: Math.min(t.colStart, r.colStart),
850
+ rowEnd: Math.max(t.rowEnd, r.rowEnd),
851
+ colEnd: Math.max(t.colEnd, r.colEnd)
852
+ } : r);
853
+ }
854
+ return t;
855
+ }
791
856
  getSize() {
792
857
  let e = this._children, t = e.length, n = 0;
793
858
  for (let r = 0; r < t; r++) n += e[r].getSize();
@@ -816,19 +881,19 @@ var on = class {
816
881
  let n = t[e].getSortedNumbers().getValues();
817
882
  n.length > 0 && r.push(n);
818
883
  }
819
- e = new $e(function(e) {
884
+ e = new yt(function(e) {
820
885
  let t = e.length;
821
- if (t === 0) return sn;
886
+ if (t === 0) return Ln;
822
887
  if (t === 1) return e[0];
823
888
  let n = e[0];
824
- for (let r = 1; r < t; r++) n = cn(n, e[r]);
889
+ for (let r = 1; r < t; r++) n = Rn(n, e[r]);
825
890
  return Object.freeze(n);
826
891
  }(r)), this._sortedNumbers = e;
827
892
  }
828
893
  return e;
829
894
  }
830
895
  getRanked(e) {
831
- return ze(this._children, e, rn)[Symbol.iterator]();
896
+ return at(this._children, e, Pn)[Symbol.iterator]();
832
897
  }
833
898
  getFrequencies(e) {
834
899
  if (e) return this._mergeFrequencies(e);
@@ -836,7 +901,7 @@ var on = class {
836
901
  return t || (t = this._mergeFrequencies(), this._frequencies = t), t;
837
902
  }
838
903
  _mergeFrequencies(e) {
839
- let t = e?.keyFn ?? Ee, n = e?.limit, r = /* @__PURE__ */ new Map(), i = this._children, a = i.length, o = 0, s = 0, c = !1;
904
+ let t = e?.keyFn ?? je, n = e?.limit, r = /* @__PURE__ */ new Map(), i = this._children, a = i.length, o = 0, s = 0, c = !1;
840
905
  for (let l = 0; l < a; l++) {
841
906
  let a = i[l].getFrequencies(e);
842
907
  o += a.getVisitedCount(), s += a.getTotalCount(), c ||= a.isTruncated();
@@ -849,7 +914,7 @@ var on = class {
849
914
  }) : c = !0, d = u.next();
850
915
  }
851
916
  }
852
- return ke.fromGroups(r, t, e, rn, o, s, c);
917
+ return Nt.fromGroups(r, t, e, Pn, o, s, c);
853
918
  }
854
919
  getTypedCounts(e) {
855
920
  let t = this._typedCounts;
@@ -899,169 +964,115 @@ var on = class {
899
964
  let a = n.numericalCount;
900
965
  a <= 0 || (r.numericalCount += a, r.sum += n.sum, r.sumSq += n.varP * a + n.sum * n.sum / a, (r.min === void 0 || n.min < r.min) && (r.min = n.min), (r.max === void 0 || n.max > r.max) && (r.max = n.max));
901
966
  }
902
- return qe(r);
967
+ return pt(r);
903
968
  }
904
- }, sn = Object.freeze([]);
905
- function cn(e, t) {
969
+ }, Ln = Object.freeze([]);
970
+ function Rn(e, t) {
906
971
  let n = e.length, r = t.length, i = Array(n + r), a = 0, o = 0, s = 0;
907
972
  for (; a < n && o < r;) i[s++] = e[a] <= t[o] ? e[a++] : t[o++];
908
973
  for (; a < n;) i[s++] = e[a++];
909
974
  for (; o < r;) i[s++] = t[o++];
910
975
  return i;
911
976
  }
912
- var ln = class {
913
- constructor(e) {
914
- this.isIExternalBook = !0, this._json = e;
915
- }
916
- getIdentity() {
917
- return this._json.identity;
977
+ var zn = class {
978
+ constructor(e, t) {
979
+ this._deleted = !1, this._json = { ...e }, this._deleteFromCollection = t ?? null;
918
980
  }
919
- getSheetNames() {
920
- return this._json.sheetNames;
981
+ getId() {
982
+ return this._json.id;
921
983
  }
922
- getDefinedNames() {
923
- return this._json.definedNames ?? [];
984
+ getDisplayName() {
985
+ return this._json.displayName;
924
986
  }
925
- getSheetData(e) {
926
- return this._json.sheetDataSet?.find((t) => t.sheetIndex === e) ?? null;
987
+ getUserId() {
988
+ return this._json.userId ?? null;
927
989
  }
928
- toJSON() {
929
- return this._json;
990
+ getProviderId() {
991
+ return this._json.providerId ?? null;
930
992
  }
931
- }, un = class {
932
- constructor(e) {
933
- this.isIExternalBookCollection = !0, this._items = (e?.json ?? []).map((e) => e ? new ln(e) : null);
993
+ delete() {
994
+ this._deleted || (this._deleted = !0, this._deleteFromCollection?.(this));
934
995
  }
935
- [Symbol.iterator]() {
936
- return this.getItems()[Symbol.iterator]();
996
+ isDeleted() {
997
+ return this._deleted;
937
998
  }
938
- getItems() {
939
- let e = [], t = this._items.length;
940
- for (let n = 0; n < t; n++) {
941
- let t = this._items[n];
942
- t && e.push(t);
943
- }
944
- return e;
999
+ toJSON() {
1000
+ return { ...this._json };
945
1001
  }
946
- getCount() {
947
- return this.getItems().length;
1002
+ get [Symbol.toStringTag]() {
1003
+ return "[Person]";
948
1004
  }
949
- getByIndex(e) {
950
- return this._items[e - 1] ?? null;
1005
+ toString() {
1006
+ return `Person:${this.getDisplayName()}`;
951
1007
  }
952
- toJSON() {
953
- return this._items.length === 0 ? null : this._items.map((e) => e?.toJSON() ?? null);
1008
+ get isIPerson() {
1009
+ return !0;
954
1010
  }
955
- }, dn = class {
1011
+ }, Bn = class extends w {
956
1012
  constructor(e) {
957
- this._closed = !1, this._options = { ...e };
958
- let t = this;
959
- this._transactions = this._options.transactions ?? new s({ transient: !0 }), this._stateId = this._transactions.create(), this._transactionsRemoveListener = this._transactions.addStateListener(this._stateId, { onAfterStateChange(e, n, r) {
960
- t._emitter.notify("onCollectionChange");
961
- } }), this._emitter = new S(this, this._transactions), this._initState(e?.initial);
962
- }
963
- add(e, t, n) {
964
- let r = this;
965
- t && t.addListeners({ onDelete: (t) => {
966
- r._updateState((t) => {
967
- if (!t.modules[e]) return;
968
- let n = t.modules[e];
969
- if (n) {
970
- let i = { ...t };
971
- return r._options.onRemove?.(e, n), r._emitter.notify("onCollectionChange"), delete i.modules[e], i;
972
- }
973
- return t;
974
- }, V("op.deleteModule"));
975
- } }, { once: !0 });
976
- let i = this._getState()?.modules, a = i?.[e], o = n?.replace ?? !1;
977
- if (a && !o) throw Error(`Already existing '${e}'`);
978
- let s = { ...i };
979
- t ? (s[e] = t, r._options.onAdd?.(e, t), this._updateState({ modules: s }, V(o ? "op.saveScripts" : "op.addScript"))) : (delete s[e], r._options.onRemove?.(e, null), this._updateState({ modules: s }, V("op.removeScript"))), r._emitter.notify("onCollectionChange");
980
- }
981
- *[Symbol.iterator]() {
982
- yield* this.getItems();
983
- }
984
- getItems(e) {
985
- let t = this._getState();
986
- if (!t) return I.EmptyArray;
987
- let n = t.modules, r = Object.keys(n), i = r.length;
988
- if (i === 0) return I.EmptyArray;
989
- let a = [], o = e?.name ? e.name.toUpperCase() : null;
990
- for (let e = 0; e < i; e++) {
991
- let t = r[e], i = n[t], s = !0;
992
- o && o !== t.toUpperCase() && (s = !1), s && a.push(i);
993
- }
994
- return a ?? I.EmptyArray;
1013
+ super(), this._byId = /* @__PURE__ */ new Map(), this._byDisplayName = /* @__PURE__ */ new Map(), this._items = null, this._current = null, e && this.fromJSON(e);
995
1014
  }
996
- getByName(e) {
997
- if (!e) return null;
998
- let t = this._getState();
999
- if (!t) return null;
1000
- let n = e.toUpperCase(), r = t.modules, i = Object.keys(r), a = i.length;
1001
- for (let e = 0; e < a; e++) {
1002
- let t = i[e];
1003
- if (n === t.toUpperCase()) return r[t];
1004
- }
1005
- return null;
1015
+ _getItems() {
1016
+ return this._items ??= Array.from(this._byId.values());
1006
1017
  }
1007
1018
  getCount() {
1008
- let e = this._getState();
1009
- return e ? Object.keys(e.modules).length : 0;
1010
- }
1011
- beginCommit(e) {
1012
- return this._beginCommit(e);
1013
- }
1014
- _getState() {
1015
- if (this._closed) throw Error(H("error.model.modelClosed"));
1016
- return this._transactions.getState(this._stateId);
1017
- }
1018
- _beginCommit(e) {
1019
- return this._transactions.beginCommit(typeof e == "string" ? { description: e } : e);
1020
- }
1021
- _updateState(e, t = V("op.update"), n) {
1022
- if (!e) return;
1023
- let r = this._beginCommit(t);
1024
- try {
1025
- r.updateState(this._stateId, e), r.commit(n);
1026
- } catch (e) {
1027
- throw r.rollback(), e;
1028
- }
1019
+ return this._byId.size;
1029
1020
  }
1030
- _initState(e) {
1031
- let t = e ?? {};
1032
- this._updateState({ modules: t }, V("op.initialize"), { forceAmend: !0 });
1033
- let n = this._options.onAdd;
1021
+ add(e) {
1022
+ let t = typeof e == "string" ? { displayName: e } : e, n = t.id;
1034
1023
  if (n) {
1035
- let e = Object.keys(t), r = e.length;
1036
- for (let i = 0; i < r; i++) {
1037
- let r = e[i];
1038
- n(r, t[r]);
1039
- }
1024
+ let e = this._byId.get(n);
1025
+ if (e) return e;
1040
1026
  }
1027
+ let r = t.displayName ?? "";
1028
+ if (!n) {
1029
+ let e = this._byDisplayName.get(r);
1030
+ if (e) return e;
1031
+ }
1032
+ let i = new zn({
1033
+ ...t,
1034
+ displayName: r,
1035
+ id: n ?? I.uuidV4().toUpperCase()
1036
+ }, (e) => this._remove(e));
1037
+ return this._byId.set(i.getId(), i), r && !this._byDisplayName.has(r) && this._byDisplayName.set(r, i), this._items = null, this._notifyCollectionChange(), i;
1038
+ }
1039
+ getById(e) {
1040
+ return typeof e == "string" ? this._byId.get(e) ?? null : null;
1041
+ }
1042
+ getByDisplayName(e) {
1043
+ return typeof e == "string" ? this._byDisplayName.get(e) ?? null : null;
1044
+ }
1045
+ getCurrent() {
1046
+ return this._current ??= this.add("Author");
1047
+ }
1048
+ setCurrent(e) {
1049
+ if (e !== null) {
1050
+ if (typeof e == "object" && e.isIPerson) {
1051
+ let t = e;
1052
+ this._current = this.getById(t.getId()) ?? this.add(t.toJSON());
1053
+ return;
1054
+ }
1055
+ this._current = this.add(e);
1056
+ } else this._current = null;
1041
1057
  }
1042
- addListeners(e, t) {
1043
- return this._emitter.addListeners(e, t);
1058
+ _remove(e) {
1059
+ this._byId.get(e.getId()) === e && (this._byId.delete(e.getId()), this._byDisplayName.get(e.getDisplayName()) === e && this._byDisplayName.delete(e.getDisplayName()), this._current === e && (this._current = null), this._items = null, this._notifyCollectionChange());
1044
1060
  }
1045
1061
  toJSON() {
1046
- let e = this._getState();
1047
- if (!e) return I.EmptyArray;
1048
- let t = e.modules, n = Object.keys(t), r = n.length, i = {};
1049
- for (let e = 0; e < r; e++) {
1050
- let r = n[e];
1051
- i[r] = t[r].toJSON();
1052
- }
1053
- return i;
1054
- }
1055
- isClosed() {
1056
- return this._closed;
1062
+ return this._byId.size === 0 ? null : this._getItems().map((e) => e.toJSON());
1057
1063
  }
1058
- close() {
1059
- this._closed || (this._emitter.notify("onClose"), this._closed = !0, this._transactionsRemoveListener?.());
1064
+ fromJSON(e) {
1065
+ if (!e) return;
1066
+ let t = e.length;
1067
+ for (let n = 0; n < t; n++) {
1068
+ let t = e[n];
1069
+ t && typeof t.id == "string" && this.add(t);
1070
+ }
1060
1071
  }
1061
- get isFunctionCollection() {
1072
+ get isIPersonCollection() {
1062
1073
  return !0;
1063
1074
  }
1064
- }, fn = (e, t) => {
1075
+ }, Vn = (e, t) => {
1065
1076
  let n = [0];
1066
1077
  for (let t = 0; t < e.length; t++) e[t] === "\n" && n.push(t + 1);
1067
1078
  let r = t.map((e) => ` ${((e) => {
@@ -1073,9 +1084,9 @@ var ln = class {
1073
1084
  return `${t + 1}:${e - n[t] + 1}`;
1074
1085
  })(e.start)} ${e.code}: ${e.message}`), i = t.length;
1075
1086
  return `Script has ${i} compile error${i === 1 ? "" : "s"}:\n${r.join("\n")}`;
1076
- }, pn = class {
1087
+ }, Hn = class {
1077
1088
  constructor(e) {
1078
- this._options = e, this._emitter = new S(this), this._initState();
1089
+ this._options = e, this._emitter = new E(this), this._initState();
1079
1090
  }
1080
1091
  _initState() {}
1081
1092
  getModules() {
@@ -1097,7 +1108,7 @@ var ln = class {
1097
1108
  builtInNames: this._builtInNames(),
1098
1109
  ...e
1099
1110
  });
1100
- return t.module ? await T("scripts", t.module, e?.declarationsOnly ?? !1, t.diagnostics) : null;
1111
+ return t.module ? await T(n.DEFAULT_MODULE, t.module, e?.declarationsOnly ?? !1, t.diagnostics) : null;
1101
1112
  }
1102
1113
  addModule(e, t, n) {
1103
1114
  this._modules.add(e, t, n);
@@ -1119,8 +1130,8 @@ var ln = class {
1119
1130
  }
1120
1131
  async run(e, t) {
1121
1132
  try {
1122
- let n = typeof e == "string" ? await this.createModule({ source: e }) : await T("scripts", e), r = typeof e == "string" ? e : e?.source ?? "";
1123
- return await this._runModule(n, r, t);
1133
+ let r = typeof e == "string" ? await this.createModule({ source: e }) : await T(n.DEFAULT_MODULE, e), i = typeof e == "string" ? e : e?.source ?? "";
1134
+ return await this._runModule(r, i, t);
1124
1135
  } catch (e) {
1125
1136
  return {
1126
1137
  ok: !1,
@@ -1136,7 +1147,7 @@ var ln = class {
1136
1147
  };
1137
1148
  let i = e.getDiagnostics(), a = i.filter((e) => e.severity === "error");
1138
1149
  if (a.length > 0) {
1139
- let e = Error(fn(t, a));
1150
+ let e = Error(Vn(t, a));
1140
1151
  return e.diagnostics = a, {
1141
1152
  ok: !1,
1142
1153
  error: e,
@@ -1189,7 +1200,7 @@ var ln = class {
1189
1200
  }
1190
1201
  if (!i || i.length === 0) return I.EmptyArray;
1191
1202
  let o = e?.text ? e.text.trim().toUpperCase() : null;
1192
- return o && t.length > 1 && f(i, o), n !== void 0 && i.length > n ? i.slice(0, n) : i;
1203
+ return o && t.length > 1 && Qe(i, o), n !== void 0 && i.length > n ? i.slice(0, n) : i;
1193
1204
  }
1194
1205
  async getFunctionCategories(e) {
1195
1206
  await this._emitter.notify("onBeforeSearch", { async: !0 });
@@ -1228,19 +1239,20 @@ var ln = class {
1228
1239
  async _doStart() {
1229
1240
  let e = this._options?.workbook, t = this._options?.json, n = {};
1230
1241
  if (t) {
1231
- let e = Object.keys(t);
1232
- for (let r = 0; r < e.length; r++) {
1233
- let i = e[r], a = t[i];
1242
+ let r = Object.keys(t);
1243
+ for (let i = 0; i < r.length; i++) {
1244
+ let a = r[i], o = t[a];
1234
1245
  try {
1235
- n[i] = await T(i, a);
1246
+ n[a] = await T(a, o, !1, [], o?.scope === "workbook" ? e : null);
1236
1247
  } catch (e) {
1237
- z.error(`Could not load script '${i}'; it will be unavailable.`, e);
1248
+ Bt.error(`Could not load script '${a}'; it will be unavailable.`, e);
1238
1249
  }
1239
1250
  }
1240
1251
  }
1241
- let r = this, i = new dn({
1252
+ let r = this, i = new oe({
1242
1253
  transactions: this._options?.transactions,
1243
1254
  initial: n,
1255
+ isReadOnly: () => r.isReadOnly(),
1244
1256
  onRemove: (e, t) => {
1245
1257
  r._options?.onRemove?.(e, t);
1246
1258
  },
@@ -1258,7 +1270,7 @@ var ln = class {
1258
1270
  let t = await n.getFunctions().search({ type: "autoRun" }), r = t.length;
1259
1271
  for (let n = 0; n < r; n++) await t[n].execute(e);
1260
1272
  } catch (e) {
1261
- z.error("Error executing autoRun script:", e);
1273
+ Bt.error("Error executing autoRun script:", e);
1262
1274
  }
1263
1275
  }
1264
1276
  }
@@ -1266,7 +1278,7 @@ var ln = class {
1266
1278
  return this._emitter.addListeners(e, t);
1267
1279
  }
1268
1280
  isReadOnly() {
1269
- return !1 === this._options.workbook?.getProtection().isStructureAllowed();
1281
+ return this._options.workbook?._isStructureProtected?.() ?? !1;
1270
1282
  }
1271
1283
  toJSON() {
1272
1284
  this._emitter.notify("onBeforeSave");
@@ -1274,11 +1286,15 @@ var ln = class {
1274
1286
  if (!e) throw Error("Scripts is initializing.");
1275
1287
  return e.toJSON();
1276
1288
  }
1277
- }, mn = class {
1289
+ get isIScript() {
1290
+ return !0;
1291
+ }
1292
+ }, Un = class {
1278
1293
  constructor(e, t, n, r) {
1279
- this._mergedReading = [], this._colsReading = [], this._rowsReading = [], this._styles = n, this._topLeft = t ?? L.EmptyCell, this._sheet = new A({
1294
+ this._mergedReading = [], this._colsReading = [], this._rowsReading = [], this._styles = n, this._topLeft = t ?? L.EmptyCell, this._sheet = new M({
1280
1295
  runtime: e,
1281
1296
  styles: this._styles,
1297
+ calcOnLoad: "none",
1282
1298
  container: {
1283
1299
  getName: () => r,
1284
1300
  getIndex: () => 1
@@ -1286,38 +1302,38 @@ var ln = class {
1286
1302
  }), this._builder = this._sheet.getEntireRange().createSparseBuilder();
1287
1303
  }
1288
1304
  applyCSSStyle(e, t) {
1289
- let r = !1;
1290
- e.style || (e.style = {}, r = !0);
1291
- let o = e.style, s = { ...t };
1305
+ let n = !1;
1306
+ e.style || (e.style = {}, n = !0);
1307
+ let i = e.style, o = { ...t };
1292
1308
  if (t.msoIgnore) {
1293
- let e = t.msoIgnore.split(","), n = Object.keys(s);
1309
+ let e = t.msoIgnore.split(","), n = Object.keys(o);
1294
1310
  for (let t = 0; t < n.length; t++) {
1295
1311
  let r = n[t];
1296
- e.includes(r) && delete s[r];
1312
+ e.includes(r) && delete o[r];
1297
1313
  }
1298
1314
  }
1299
- let l = Me(s.fontFamily);
1300
- o.font = {}, l && (o.font.family = l.family, o.font.fallbacks = l.fallbacks, o.font.size = l.size), o.font.size = s.fontSize, o.font.weight = s.fontWeight, o.font.style = s.fontStyle, o.font.color = s.color;
1301
- let d = b(s.textDecoration);
1302
- o.font.underline = d.underline, o.font.strike = d.strike, s.textUnderlineStyle && (o.font.underline = Ne(s.textUnderlineStyle)), o.alignment = {}, s?.textAlign && (o.alignment.horizontal = c(s.textAlign)), s?.textAlign && !o.alignment.horizontal && s?.textAlign !== "general" && (s.textAlign === "center-across" ? o.alignment.horizontal = a.HorizontalAlignment.CenterContinuous : s.textAlign === "fill" ? o.alignment.horizontal = a.HorizontalAlignment.Fill : s.textAlign === "121" || s.textAlign === "010" ? (o.alignment.horizontal = a.HorizontalAlignment.Distributed, o.alignment.justifyLastLine = s.textAlign === "121") : console.warn("unknown text-align", s.textAlign)), s.verticalAlign && (s.verticalAlign.toLowerCase() === "super" ? o.font.verticalAlign = k.VerticalAlignment.Super : s.verticalAlign.toLowerCase() === "sup" ? o.font.verticalAlign = k.VerticalAlignment.Sub : o.alignment.vertical = n(s.verticalAlign), o.alignment.vertical || (s.verticalAlign === "121" ? o.alignment.vertical = a.VerticalAlignment.Distributed : console.warn("unknown vertical-align", s.verticalAlign))), s.msoCharIndentCount && (o.alignment.indent = s.msoCharIndentCount), s.whiteSpace && (o.alignment.overflow = s.whiteSpace === "no-wrap" || s.whiteSpace === "nowrap" ? a.Overflow.Visible : a.Overflow.Wrap), s.msoTextControl === "shrinktofit" && (o.alignment.overflow = a.Overflow.Shrink);
1303
- let f = null;
1304
- if (s.background ? f = s.background : s.backgroundColor && (f = s.backgroundColor), f && (o.fill = { color: f }), s.msoPattern) {
1305
- let e = y(s.msoPattern);
1306
- e && (e.patternType === i.BuiltInSheetPattern.Solid ? o.fill = { color: e.foreground } : e.patternType !== i.BuiltInSheetPattern.None && (f && (e.background = f), o.fill = e));
1307
- }
1308
- s.msoRotate !== void 0 && (o.alignment.rotation = u(s.msoRotate));
1309
- let p = (e, t) => {
1310
- e && (o.border ||= {}, o.border[e] = t);
1315
+ let s = ne(o.fontFamily);
1316
+ i.font = {}, s && (i.font.family = s.family, i.font.fallbacks = s.fallbacks, i.font.size = s.size), i.font.size = o.fontSize, i.font.weight = o.fontWeight, i.font.style = o.fontStyle, i.font.color = o.color;
1317
+ let c = de(o.textDecoration);
1318
+ i.font.underline = c.underline, i.font.strike = c.strike, o.textUnderlineStyle && (i.font.underline = _(o.textUnderlineStyle)), i.alignment = {}, o?.textAlign && (i.alignment.horizontal = se(o.textAlign)), o?.textAlign && !i.alignment.horizontal && o?.textAlign !== "general" && (o.textAlign === "center-across" ? i.alignment.horizontal = r.HorizontalAlignment.CenterContinuous : o.textAlign === "fill" ? i.alignment.horizontal = r.HorizontalAlignment.Fill : o.textAlign === "121" || o.textAlign === "010" ? (i.alignment.horizontal = r.HorizontalAlignment.Distributed, i.alignment.justifyLastLine = o.textAlign === "121") : console.warn("unknown text-align", o.textAlign)), o.verticalAlign && (o.verticalAlign.toLowerCase() === "super" ? i.font.verticalAlign = N.VerticalAlignment.Super : o.verticalAlign.toLowerCase() === "sup" ? i.font.verticalAlign = N.VerticalAlignment.Sub : i.alignment.vertical = S(o.verticalAlign), i.alignment.vertical || (o.verticalAlign === "121" ? i.alignment.vertical = r.VerticalAlignment.Distributed : console.warn("unknown vertical-align", o.verticalAlign))), o.msoCharIndentCount && (i.alignment.indent = o.msoCharIndentCount), o.whiteSpace && (i.alignment.overflow = o.whiteSpace === "no-wrap" || o.whiteSpace === "nowrap" ? r.Overflow.Visible : r.Overflow.Wrap), o.msoTextControl === "shrinktofit" && (i.alignment.overflow = r.Overflow.Shrink);
1319
+ let l = null;
1320
+ if (o.background ? l = o.background : o.backgroundColor && (l = o.backgroundColor), l && (i.fill = { color: l }), o.msoPattern) {
1321
+ let e = Pt(o.msoPattern);
1322
+ e && (e.patternType === we.BuiltInSheetPattern.Solid ? i.fill = { color: e.foreground } : e.patternType !== we.BuiltInSheetPattern.None && (l && (e.background = l), i.fill = e));
1323
+ }
1324
+ o.layoutFlow === "vertical" || o.layoutFlow === "vertical-ideographic" ? i.alignment.stacked = !0 : o.msoRotate !== void 0 && (i.alignment.rotation = ae(o.msoRotate));
1325
+ let u = (e, t) => {
1326
+ e && (i.borders ||= {}, i.borders[e] = t);
1311
1327
  };
1312
- s.border && s.border !== "none" && (p("top", s.border), p("left", s.border), p("right", s.border), p("bottom", s.border)), s.borderTop && p("top", s.borderTop), s.borderLeft && p("left", s.borderLeft), s.borderRight && p("right", s.borderRight), s.borderBottom && p("bottom", s.borderBottom), s.msoDiagonalUp && p("diagonalUp", s.msoDiagonalUp), s.msoDiagonalDown && p("diagonalDown", s.msoDiagonalDown);
1313
- let m = o.numberFormat;
1314
- s.msoNumberFormat && (m = te(s.msoNumberFormat), m.includes("\\") ? m = null : m === "Fixed" ? m = M.Styles.lookupStyle(o.numberFormat).formatType === M.Type.Number ? null : M.Type.Number : m === "Percent" && (m = M.Styles.lookupStyle(o.numberFormat).formatType === M.Type.Percentage ? null : M.Type.Percentage)), m && (o.numberFormat = m), e.style = this._styles.normalize(o), r && Object.keys(e.style).length === 0 && delete e.style;
1328
+ o.border && o.border !== "none" && (u("top", o.border), u("left", o.border), u("right", o.border), u("bottom", o.border)), o.borderTop && u("top", o.borderTop), o.borderLeft && u("left", o.borderLeft), o.borderRight && u("right", o.borderRight), o.borderBottom && u("bottom", o.borderBottom), o.msoDiagonalUp && u("diagonalUp", o.msoDiagonalUp), o.msoDiagonalDown && u("diagonalDown", o.msoDiagonalDown);
1329
+ let d = i.numberFormat;
1330
+ o.msoNumberFormat && (d = a(o.msoNumberFormat), d.includes("\\") ? d = null : d === "Fixed" ? d = j.Styles.lookupStyle(i.numberFormat).formatType === j.Type.Number ? null : j.Type.Number : d === "Percent" && (d = j.Styles.lookupStyle(i.numberFormat).formatType === j.Type.Percentage ? null : j.Type.Percentage)), d && (i.numberFormat = d), e.style = this._styles.normalize(i), n && Object.keys(e.style).length === 0 && delete e.style;
1315
1331
  }
1316
1332
  onCell(e, t, n, r, i) {
1317
1333
  let a = r(i), o = { value: t === void 0 ? n ?? "" : t };
1318
1334
  if (typeof o.value == "string" && o.value.length === 0 && (o.value = void 0), a && this.applyCSSStyle(o, a), i?.tagName.toUpperCase() === "TD") {
1319
1335
  let e = o.style, t = e?.font ?? {};
1320
- (i.querySelectorAll("s").length > 0 || i.querySelectorAll("strike").length > 0) && (t.strike = !0), i.querySelectorAll("sub").length > 0 && (t.verticalAlign = k.VerticalAlignment.Sub), i.querySelectorAll("sup").length > 0 && (t.verticalAlign = k.VerticalAlignment.Super), (i.querySelectorAll("b").length > 0 || i.querySelectorAll("strong").length > 0) && (t.weight = 700), i.querySelectorAll("i").length > 0 && (t.style = k.Style.Italic), i.querySelectorAll("u").length > 0 && (t.underline = k.UnderlineStyle.Single), Object.keys(t).length > 0 && (e || (e = {}, o.style = e), e.font ||= t);
1336
+ (i.querySelectorAll("s").length > 0 || i.querySelectorAll("strike").length > 0) && (t.strike = !0), i.querySelectorAll("sub").length > 0 && (t.verticalAlign = N.VerticalAlignment.Sub), i.querySelectorAll("sup").length > 0 && (t.verticalAlign = N.VerticalAlignment.Super), (i.querySelectorAll("b").length > 0 || i.querySelectorAll("strong").length > 0) && (t.weight = 700), i.querySelectorAll("i").length > 0 && (t.style = N.Style.Italic), i.querySelectorAll("u").length > 0 && (t.underline = N.UnderlineStyle.Single), Object.keys(t).length > 0 && (e || (e = {}, o.style = e), e.font ||= t);
1321
1337
  let n = i.querySelectorAll("a");
1322
1338
  if (n.length > 0) {
1323
1339
  let e = n[0].getAttribute("href");
@@ -1364,8 +1380,8 @@ var ln = class {
1364
1380
  let i = n(r);
1365
1381
  if (i.msoHeightSource !== "userset" || !r) return;
1366
1382
  let a = r.getAttribute("height") ?? i.height, o = null;
1367
- if (a && (o = v(a, this._styles.getNormal().getFont().getSize(), "px")), o === null) for (let e = 0; e < r.cells.length; e++) {
1368
- let t = r.cells[e], i = v(t.getAttribute("height") ?? n(t).height, this._styles.getNormal().getFont().getSize(), "px");
1383
+ if (a && (o = pe(a, this._styles.getNormal().getFont().getSize(), "px")), o === null) for (let e = 0; e < r.cells.length; e++) {
1384
+ let t = r.cells[e], i = pe(t.getAttribute("height") ?? n(t).height, this._styles.getNormal().getFont().getSize(), "px");
1369
1385
  i !== null && (o = Math.max(i, o ?? 0));
1370
1386
  }
1371
1387
  o !== null && this._rowsReading.push({
@@ -1373,19 +1389,19 @@ var ln = class {
1373
1389
  min: this._topLeft.rowIndex + e,
1374
1390
  max: this._topLeft.rowIndex + e + t - 1
1375
1391
  },
1376
- update: { size: o * k.getDeviceScale() }
1392
+ update: { size: o * N.getDeviceScale() }
1377
1393
  });
1378
1394
  }
1379
1395
  onColumn(e, t, n, r) {
1380
1396
  let i = n(r);
1381
1397
  if (i.msoWidthSource !== "userset" || !r) return;
1382
1398
  let a = r.getAttribute("width") ?? i.width, o = null;
1383
- a && (o = v(a, this._styles.getNormal().getFont().getSize(), "px")), o !== null && this._colsReading.push({
1399
+ a && (o = pe(a, this._styles.getNormal().getFont().getSize(), "px")), o !== null && this._colsReading.push({
1384
1400
  address: {
1385
1401
  min: this._topLeft.colIndex + e,
1386
1402
  max: this._topLeft.colIndex + e + t - 1
1387
1403
  },
1388
- update: { size: o * k.getDeviceScale() }
1404
+ update: { size: o * N.getDeviceScale() }
1389
1405
  });
1390
1406
  }
1391
1407
  onDone() {
@@ -1396,9 +1412,9 @@ var ln = class {
1396
1412
  sheet() {
1397
1413
  return this._sheet;
1398
1414
  }
1399
- }, hn = class {
1415
+ }, Wn = class {
1400
1416
  constructor(e) {
1401
- if (!e) throw new _t("snapshot is required.");
1417
+ if (!e) throw new Vt("snapshot is required.");
1402
1418
  this._snapshot = e;
1403
1419
  }
1404
1420
  getItemType() {
@@ -1428,9 +1444,9 @@ var ln = class {
1428
1444
  get isClipboardItem() {
1429
1445
  return !0;
1430
1446
  }
1431
- }, gn = class {
1447
+ }, Gn = class {
1432
1448
  constructor(e, t, n, r, i) {
1433
- if (this._parsed = void 0, this._runtime = e, !t) throw new _t("nativeItems are required.");
1449
+ if (this._parsed = void 0, this._runtime = e, !t) throw new Vt("nativeItems are required.");
1434
1450
  this._topLeft = n ?? L.EmptyCell, this._native = t, this._markOptions = Object.freeze(r ?? {}), this._styles = i;
1435
1451
  }
1436
1452
  getItemType() {
@@ -1472,17 +1488,15 @@ var ln = class {
1472
1488
  async parse() {
1473
1489
  let e, t = this._native?.text, n = this._native.html;
1474
1490
  if (n === null && t && t.includes("<table")) try {
1475
- let e = new DOMParser().parseFromString(t, gt.Html), r = e.querySelector("parsererror");
1491
+ let e = new DOMParser().parseFromString(t, zt.Html), r = e.querySelector("parsererror");
1476
1492
  if (r) throw new R("Unable to parse: " + r);
1477
1493
  n = e, t = null;
1478
1494
  } catch {
1479
1495
  console.warn("Discovered text as html table but could could not parse.");
1480
1496
  }
1481
1497
  try {
1482
- let r = new mn(this._runtime, this._topLeft, this._styles, n ? "HTML" : "Text");
1483
- await r.sheet().getCalculation().ready(), await r.sheet().getCalculation().stop();
1484
- let i = await Promise.resolve(t ? Ie(t) : [[]]), a;
1485
- if (Ue(n, i, r) ? (e = r.sheet(), a = e.getUsedRange()) : n = null, a) return this._parsed = {
1498
+ let r = new Un(this._runtime, this._topLeft, this._styles, n ? "HTML" : "Text"), i = await Promise.resolve(t ? Ue(t) : [[]]), a;
1499
+ if (nt(n, i, r) ? (e = r.sheet(), a = e.getUsedRange()) : n = null, a) return this._parsed = {
1486
1500
  copyTo: async (e, t) => (await e.copyFrom(a, t))?.getCoords() ?? null,
1487
1501
  getCoords: () => a.getCoords(),
1488
1502
  getSource: () => e,
@@ -1504,12 +1518,12 @@ var ln = class {
1504
1518
  getName: () => "Image"
1505
1519
  }, !0;
1506
1520
  }
1507
- return !1;
1521
+ return this._parsed = null, !1;
1508
1522
  }
1509
1523
  get isClipboardItem() {
1510
1524
  return !0;
1511
1525
  }
1512
- }, Z = {
1526
+ }, Kn = {
1513
1527
  showFormulaBar: !0,
1514
1528
  showTabs: !0,
1515
1529
  tabRatio: 600,
@@ -1517,9 +1531,12 @@ var ln = class {
1517
1531
  showVerticalScrollbar: !0,
1518
1532
  showStatusBar: !0,
1519
1533
  activeSheetId: 0
1520
- }, Q = class {
1534
+ }, qn = class {
1521
1535
  constructor(e) {
1522
- this._emitter = new S(this), this._state = { ...Z }, e?.json && this._fromJSON(e?.json);
1536
+ this._id = I.uuidV4(), this._emitter = new E(this), this._state = { ...Kn }, e?.json && this._fromJSON(e?.json);
1537
+ }
1538
+ getId() {
1539
+ return this._id;
1523
1540
  }
1524
1541
  isShowFormulaBar() {
1525
1542
  return this._state.showFormulaBar;
@@ -1571,7 +1588,7 @@ var ln = class {
1571
1588
  let e = {}, t = Object.keys(this._state), n = t.length;
1572
1589
  for (let r = 0; r < n; r++) {
1573
1590
  let n = t[r], i = this._state[n];
1574
- i != null && i !== Z[n] && (e[n] = i);
1591
+ i != null && i !== Kn[n] && (e[n] = i);
1575
1592
  }
1576
1593
  return Object.keys(e).length === 0 && (e = null), e;
1577
1594
  }
@@ -1581,7 +1598,7 @@ var ln = class {
1581
1598
  }
1582
1599
  update(e, t = !0) {
1583
1600
  this._state = {
1584
- ...Z,
1601
+ ...Kn,
1585
1602
  ...this._state,
1586
1603
  ...e
1587
1604
  }, t && this._emitter.notify("onViewChange");
@@ -1593,13 +1610,16 @@ var ln = class {
1593
1610
  let e = this.toJSON();
1594
1611
  return e ? JSON.stringify(e) : "DefaultWorkbookView";
1595
1612
  }
1596
- }, _n = Object.freeze({
1613
+ get isIWorkbookView() {
1614
+ return !0;
1615
+ }
1616
+ }, Jn = Object.freeze({
1597
1617
  structure: !1,
1598
1618
  windows: !1,
1599
1619
  revision: !1,
1600
1620
  password: null,
1601
1621
  revisionsPassword: null
1602
- }), vn = class extends ot {
1622
+ }), Yn = class extends i {
1603
1623
  isWindowsAllowed() {
1604
1624
  return this._isPropertyAllowed("windows");
1605
1625
  }
@@ -1609,20 +1629,19 @@ var ln = class {
1609
1629
  isStructureAllowed() {
1610
1630
  return this._isPropertyAllowed("structure");
1611
1631
  }
1632
+ _getAllowedKey() {
1633
+ return "workbook";
1634
+ }
1612
1635
  _fromJSON(e) {
1613
1636
  this._properties = e;
1614
1637
  }
1615
1638
  _toJSON(e) {
1616
1639
  let t = this._properties;
1617
1640
  if (t) {
1618
- e = {
1619
- ...e,
1620
- ...t
1621
- };
1622
1641
  let n = Object.keys(t), r = n.length;
1623
1642
  for (let i = 0; i < r; i++) {
1624
1643
  let r = n[i], a = t[r];
1625
- a != null && a !== _n[r] && (e[r] = a);
1644
+ a != null && a !== Jn[r] && (e[r] = a);
1626
1645
  }
1627
1646
  }
1628
1647
  return super._toJSON(e);
@@ -1630,48 +1649,51 @@ var ln = class {
1630
1649
  get [Symbol.toStringTag]() {
1631
1650
  return "[WorkbookProtection]";
1632
1651
  }
1652
+ get isIWorkbookProtection() {
1653
+ return !0;
1654
+ }
1633
1655
  };
1634
- function yn(e) {
1656
+ function Z(e) {
1635
1657
  return H("error.workbook.invalidSheetKey", { key: e });
1636
1658
  }
1637
- var bn = class {
1638
- constructor(e, t) {
1639
- this._add = e, this._get = t;
1659
+ var Xn = class extends w {
1660
+ constructor(e, t, n) {
1661
+ super(), this._add = e, this._get = t, this._addListeners = n;
1640
1662
  }
1641
1663
  add(e) {
1642
1664
  return this._add(e);
1643
1665
  }
1644
- *[Symbol.iterator]() {
1645
- yield* this.getItems();
1646
- }
1647
- getItems(e) {
1666
+ _getItems(e) {
1648
1667
  return this._get(e?.name, e?.visibility);
1649
1668
  }
1650
1669
  getByName(e) {
1651
1670
  return this._get(e)?.[0] ?? null;
1652
1671
  }
1653
- getCount() {
1654
- return this._get().length;
1672
+ addListeners(e, t) {
1673
+ return this._addListeners(e, t);
1674
+ }
1675
+ get isISheetCollection() {
1676
+ return !0;
1655
1677
  }
1656
- }, xn = /* @__PURE__ */ new RegExp(/[\\/\\*?:[\]]+/), Sn = /* @__PURE__ */ new RegExp(/\(((\d+)(?!.*\d))\)$/, "g");
1657
- function Cn(e) {
1678
+ }, Zn = /* @__PURE__ */ new RegExp(/[\\/\\*?:[\]]+/), Qn = /* @__PURE__ */ new RegExp(/\(((\d+)(?!.*\d))\)$/, "g");
1679
+ function $n(e) {
1658
1680
  let t = H(V("workbook.defaultSheetName"), { n: e + 1 });
1659
1681
  return t === "workbook.defaultSheetName" ? `Sheet${e + 1}` : t;
1660
1682
  }
1661
- function wn(e, t) {
1683
+ function er(e, t) {
1662
1684
  return {
1663
- ...Xe,
1685
+ ...gt,
1664
1686
  getSheet: () => null,
1665
- toString: () => E(e, t)
1687
+ toString: () => bt(e, t)
1666
1688
  };
1667
1689
  }
1668
- function Tn(e, t = !1) {
1690
+ function tr(e, t = !1) {
1669
1691
  if (!e) throw Error(H("error.workbook.sheetNameBlank"));
1670
- if (xn.test(e)) {
1692
+ if (Zn.test(e)) {
1671
1693
  if (!t) throw Error(function(e) {
1672
1694
  return e ? H("error.workbook.sheetNameInvalidCharsNamed", { sheetName: e }) : H("error.workbook.sheetNameInvalidChars");
1673
1695
  }(e));
1674
- e = e.replace(xn, "");
1696
+ e = e.replace(Zn, "");
1675
1697
  }
1676
1698
  if (e.length === 0) throw Error(H("error.workbook.sheetNameBlank"));
1677
1699
  let n = e.length;
@@ -1685,7 +1707,7 @@ function Tn(e, t = !1) {
1685
1707
  }
1686
1708
  return e;
1687
1709
  }
1688
- var En, Dn, $ = class e extends ge {
1710
+ var nr, rr, ir, ar, or = "workbook.activeSheet", sr = class e extends et {
1689
1711
  constructor(e, t, n, r) {
1690
1712
  super(e, t, r), this._workbook = n;
1691
1713
  }
@@ -1696,23 +1718,23 @@ var En, Dn, $ = class e extends ge {
1696
1718
  let r = this._options;
1697
1719
  return n && (r = {
1698
1720
  ...this._options,
1699
- getOptions: j(this._options?.getOptions, n)
1721
+ getOptions: A(this._options?.getOptions, n)
1700
1722
  }), new e(t, this._internal, this._workbook, r);
1701
1723
  }
1702
- _createRange(e, t) {
1703
- let n = e ? { ...e } : null, r = n ? this._workbook._getSheetRef(n.scope, O.Visibility.VeryHidden) : null;
1704
- if (!r) {
1724
+ _createRange(e, n) {
1725
+ let r = e ? { ...e } : null, i = r ? this._workbook._getSheetRef(r.scope, O.Visibility.VeryHidden) : null;
1726
+ if (!i) {
1705
1727
  let e = this._workbook.getSelectedSheet();
1706
- return delete n?.scope, wn(n, n ? {
1707
- scope: h,
1728
+ return delete r?.scope, er(r, r ? {
1729
+ scope: t,
1708
1730
  ...e.getEntireRange().getCoords()
1709
1731
  } : null);
1710
1732
  }
1711
- let i = this._options;
1712
- return t && (i = {
1733
+ let a = this._options;
1734
+ return n && (a = {
1713
1735
  ...this._options,
1714
- getOptions: j(this._options.getOptions, t)
1715
- }), new On(e, D(r.sheet), this._workbook, i);
1736
+ getOptions: A(this._options.getOptions, n)
1737
+ }), new cr(e, D(i.sheet), this._workbook, a);
1716
1738
  }
1717
1739
  async select(e) {
1718
1740
  let t = [], n = null, r = this.getCoords();
@@ -1736,15 +1758,15 @@ var En, Dn, $ = class e extends ge {
1736
1758
  }
1737
1759
  getAddress(e) {
1738
1760
  let t = this._internal.getSheet(), n = t.getEntireRange().getCoords();
1739
- return ce(this.getCoords(), {
1761
+ return Ie(this.getCoords(), {
1740
1762
  ...n,
1741
1763
  scope: t.getName()
1742
- }, E, ne, e);
1764
+ }, bt, mt, e);
1743
1765
  }
1744
1766
  toString() {
1745
1767
  return this.getAddress();
1746
1768
  }
1747
- }, On = class e extends pe {
1769
+ }, cr = class e extends St {
1748
1770
  constructor(e, t, n, r) {
1749
1771
  super(e, t, r), this._workbook = n;
1750
1772
  }
@@ -1752,17 +1774,17 @@ var En, Dn, $ = class e extends ge {
1752
1774
  let n = this._options;
1753
1775
  return t && (n = {
1754
1776
  ...this._options,
1755
- getOptions: j(this._options?.getOptions, t)
1756
- }), new $(e, this._internal, this._workbook, n);
1777
+ getOptions: A(this._options?.getOptions, t)
1778
+ }), new sr(e, this._internal, this._workbook, n);
1757
1779
  }
1758
1780
  _createRange(t, n) {
1759
1781
  let r = this._internal;
1760
- if (!t) return Ae(r.getSheet(), r.getSheet().getEntireCoords());
1761
- if (r.validateCoords(t), r.getSheet().isClosed()) return Ae(null, r.getSheet().getEntireCoords(), t);
1782
+ if (!t) return Ke(r.getSheet(), r.getSheet().getEntireCoords());
1783
+ if (r.validateCoords(t), r.getSheet().isClosed()) return Ke(null, r.getSheet().getEntireCoords(), t);
1762
1784
  let i = this._options;
1763
1785
  return n && (i = {
1764
1786
  ...this._options,
1765
- getOptions: j(this._options?.getOptions, n)
1787
+ getOptions: A(this._options?.getOptions, n)
1766
1788
  }), new e(t, this._internal, this._workbook, i);
1767
1789
  }
1768
1790
  addListener(e, t) {
@@ -1775,7 +1797,7 @@ var En, Dn, $ = class e extends ge {
1775
1797
  }
1776
1798
  getAddress(e) {
1777
1799
  let t = this._internal.getSheet(), n = t?.getEntireRange().getCoords() ?? null;
1778
- return E(this.getCoords(), {
1800
+ return bt(this.getCoords(), {
1779
1801
  ...n,
1780
1802
  scope: t.getName()
1781
1803
  });
@@ -1783,33 +1805,46 @@ var En, Dn, $ = class e extends ge {
1783
1805
  toString() {
1784
1806
  return this.getAddress();
1785
1807
  }
1786
- }, kn = class {
1808
+ }, lr = (e) => !!e && typeof e == "object" && typeof e.getOrigin == "function", ur = class {
1787
1809
  constructor(e) {
1788
- this._lastTransactionUUID = null, this._closed = !1, this._listenerOrigin = null, this._lastOriginName = null, this._initializing = !0, this._isDate1904 = !1, this._locale = null, this._localeOverrides = null;
1810
+ this._isLoadingSheets = !1, this._lastTransactionUUID = null, this._starting = null, this._closed = !1, this._listenerOriginProvider = null, this._listenerOrigin = null, this._lastOriginName = null, this._initializing = !0, this._pivotCaches = [], this._pivotTableCollection = new _e(() => {
1811
+ let e = [];
1812
+ for (let t of this.getSheets()) e.push(...t.getPivotTables());
1813
+ return e;
1814
+ }), this._people = new Bn(), this._commentCollection = new ke(null, (e, t, n) => {
1815
+ let r = [];
1816
+ for (let i of this.getSheets()) r.push(...i.getComments().getItems(e ? {
1817
+ address: e,
1818
+ ignoreHidden: t,
1819
+ fullyContained: n
1820
+ } : {
1821
+ ignoreHidden: t,
1822
+ fullyContained: n
1823
+ }));
1824
+ return r;
1825
+ }, (e, t) => this.addListeners({ onSheetsChange: e.onCollectionChange ? () => {
1826
+ e.onCollectionChange(this._commentCollection);
1827
+ } : void 0 }, t)), this._restoringSheets = !1, this._isDate1904 = !1, this._codeName = null, this._updateLinks = null, this._locale = null, this._localeOverrides = null;
1789
1828
  let t = typeof e == "string" ? { origin: e } : { ...e }, n = t.origin;
1790
- this._origin = typeof n == "string" ? new U(null, { name: n }) : n ?? new U(null), delete t.origin, this._lastOriginName = this._origin.getName(), this._listenerOrigin = this._origin.addListeners({ onChange: () => {
1791
- if (this._closed) return;
1792
- let e = this._origin.getName();
1793
- e !== this._lastOriginName && (this._lastOriginName = e, this._emitter.notify("onNameChange"));
1794
- } });
1829
+ this._ownOriginProvider = !lr(n), this._originProvider = lr(n) ? n : new Yt(typeof n == "string" ? new U(null, { name: n }) : n ?? new U(null)), delete t.origin, this._bindOrigin(this._originProvider.getOrigin()), this._listenerOriginProvider = this._originProvider.addListeners({ onOriginChange: () => this._onOriginChange() });
1795
1830
  let r = t.json;
1796
- delete t.json, this._transactions = t.transactions ?? new s(), this._id = this._transactions.create(), this._ownTransactions = !t.transactions, this._emitter = new S(this, this._transactions), this._runtime = t.runtime ?? new We("Workbook Runtime", {
1831
+ delete t.json, this._transactions = t.transactions ?? new x(), this._id = this._transactions.create(), this._ownTransactions = !t.transactions, this._emitter = new E(this, this._transactions), this._runtime = t.runtime ?? new Mt("Workbook Runtime", {
1797
1832
  isDate1904: () => this._isDate1904,
1798
- getLocale: () => this._locale ?? Oe() ?? Le(),
1833
+ getNow: () => this._transactions.getCurrentCommit().getTimestamp(),
1834
+ getLocale: () => this._locale ?? kt() ?? Ae(),
1799
1835
  getLocaleOverrides: () => this._localeOverrides
1800
- }), this._listenerLanguage = mt.addChangeListener(() => {
1801
- this._locale !== null || this._closed || this._notifyAllChange();
1836
+ }), this._listenerLanguage = Lt.addChangeListener(() => {
1837
+ this._closed || this._notifyAllChange();
1802
1838
  });
1803
1839
  let i = this, a = this._beginCommit({ description: V(r ? "op.openWorkbook" : "op.newWorkbook") });
1804
1840
  try {
1805
- this._strings = t.strings ?? new he(), this._ownStrings = !t.strings, this._externalBooks = new un({ json: r?.externalBooks }), this._resources = t.resources ?? new st(), this._ownResources = !t.resources, this._createSheetName = t.createSheetNameCallback ?? Cn;
1841
+ this._strings = t.strings ?? new ye(), this._ownStrings = !t.strings, this._resources = t.resources ?? new m(), this._ownResources = !t.resources, this._createSheetName = t.createSheetNameCallback ?? $n;
1806
1842
  let e = t.createSheetCallback;
1807
- e ||= (e) => new A(e), this._sheetOnNameChange = /* @__PURE__ */ new Map(), this._sheetOnVisibilityChange = /* @__PURE__ */ new Map(), this._sheetOnIndexChange = /* @__PURE__ */ new Map(), this._createSheet = (t, n, r, a, o) => {
1808
- let s = null, c = {
1843
+ e ||= (e) => new M(e), this._sheetOnNameChange = /* @__PURE__ */ new Map(), this._sheetOnVisibilityChange = /* @__PURE__ */ new Map(), this._sheetOnIndexChange = /* @__PURE__ */ new Map(), this._createSheet = (t, n, r, a, o, s) => {
1844
+ let c = null, l = {
1809
1845
  runtime: i._runtime,
1810
1846
  readonly: i._options.readonly ?? !1,
1811
1847
  disableLoadAutoFit: i._options.disableLoadAutoFit ?? !1,
1812
- formulaTransform: i._options.formulaTransform,
1813
1848
  opener: i._options.opener,
1814
1849
  transactions: i._transactions,
1815
1850
  styles: i._styles,
@@ -1821,66 +1856,68 @@ var En, Dn, $ = class e extends ge {
1821
1856
  resolveRange: (e) => i._options.resolveRange?.(e) ?? i.getRange(e),
1822
1857
  container: {
1823
1858
  beforeFromJSON: (e) => {
1824
- s = e, i._addSheetRef({
1859
+ c = e, i._addSheetRef({
1825
1860
  name: n,
1826
1861
  id: t,
1827
1862
  visibility: r ?? O.Visibility.Visible,
1863
+ sheetId: o,
1828
1864
  sheet: e
1829
1865
  }, a);
1830
1866
  },
1831
1867
  getName: () => {
1832
- let e = i._getSheetRef(s);
1868
+ let e = i._getSheetRef(c);
1833
1869
  return e ? e.name : n;
1834
1870
  },
1835
1871
  setName: (e, t) => {
1836
- i._getSheetRef(s) && i._setSheetName(s, e, t);
1872
+ i._getSheetRef(c) && i._setSheetName(c, e, t);
1837
1873
  },
1838
1874
  setNameChangeCallback: (e) => {
1839
1875
  i._sheetOnNameChange.set(t, e);
1840
1876
  },
1841
1877
  getVisibility: () => {
1842
- let e = i._getSheetRef(s);
1878
+ let e = i._getSheetRef(c);
1843
1879
  return e ? e.visibility : O.Visibility.Visible;
1844
1880
  },
1845
1881
  setVisibility: (e, t) => {
1846
- i._setSheetVisibility(s, e, t);
1882
+ i._setSheetVisibility(c, e, t);
1847
1883
  },
1848
1884
  setVisibilityCallback: (e) => {
1849
1885
  i._sheetOnVisibilityChange.set(t, e);
1850
1886
  },
1851
- duplicate: () => i._duplicateSheet(s),
1887
+ duplicate: () => i._duplicateSheet(c),
1852
1888
  getIndex: () => {
1853
- let e = i._getSheetRef(s);
1889
+ let e = i._getSheetRef(c);
1854
1890
  return e ? i._getOffsetForId(e.id, i._getSheetRefs(O.Visibility.VeryHidden)) : a;
1855
1891
  },
1856
1892
  setIndex: (e, t) => {
1857
- let n = i._getSheetRef(s, O.Visibility.VeryHidden);
1893
+ let n = i._getSheetRef(c, O.Visibility.VeryHidden);
1858
1894
  return !!n && (i._moveSheet(n, e, t), !0);
1859
1895
  },
1860
1896
  setIndexCallback: (e) => {
1861
1897
  i._sheetOnIndexChange.set(t, e);
1862
1898
  },
1863
- requestSelect: async () => (i._setSelectedSheet(s), await this._emitter.notify("onRequestSelect", {
1899
+ requestSelect: async () => (i._setSelectedSheet(c), await this._emitter.notify("onRequestSelect", {
1864
1900
  source: i,
1865
- params: s,
1901
+ params: c,
1866
1902
  async: !0
1867
- }), i.getSelectedSheet() === s)
1903
+ }), i.getSelectedSheet() === c)
1868
1904
  }
1869
1905
  };
1870
- return o && (c.json = o), s = e(c, n, a, r), s;
1871
- }, this._namedTableSource = new it({
1906
+ return s && (l.json = s), c = e(l, n, a, r), c;
1907
+ }, this._namedTableSource = new c({
1872
1908
  getSheets: () => i._sheets ? i.getSheets().getItems() : I.EmptyArray,
1873
1909
  addSheetsListener: (e, t) => i.addListeners({ onSheetsChange: e }, t)
1874
- }), this._names = t.names ?? new we({
1910
+ }), this._names = t.names ?? new l({
1875
1911
  addressToRanges: (e) => i.getRanges(e),
1876
1912
  getCurrentScope: () => i.getSelectedSheet().getName(),
1877
- isReadOnly: () => i._options.readonly ?? !1,
1913
+ isReadOnly: () => (i._options.readonly ?? !1) || i._isStructureProtected(),
1878
1914
  transactions: i._transactions,
1879
1915
  getSources: () => i._calculation ? [i._calculation.getNamedFormulas(), i._namedTableSource] : I.EmptyArray
1880
- }), this._ownNames = !t.names, this._calculation = t.calculation ?? new ye({
1916
+ }), this._ownNames = !t.names, this._calculation = t.calculation ?? new Le({
1881
1917
  runtime: i._runtime,
1882
1918
  functions: t.functions,
1883
1919
  json: r?.calc,
1920
+ isNamesReadOnly: () => i._isStructureProtected(),
1884
1921
  getActiveCell: () => {
1885
1922
  let e = i.getSelectedSheet(), t = e?.getSelectedRange()?.getCoords();
1886
1923
  return t ? {
@@ -1902,8 +1939,8 @@ var En, Dn, $ = class e extends ge {
1902
1939
  let n = t.length;
1903
1940
  for (let r = 0; r < n; r++) if (t[r].name.toLowerCase() === e) return r;
1904
1941
  try {
1905
- An.address = e;
1906
- let t = this._names.getItems(An);
1942
+ dr.address = e;
1943
+ let t = this._names.getItems(dr);
1907
1944
  if (!t || t.length === 0) return -1;
1908
1945
  let n = t[0].getRanges?.()?.getCoords()?.[0]?.scope;
1909
1946
  if (!n) return -1;
@@ -1917,34 +1954,47 @@ var En, Dn, $ = class e extends ge {
1917
1954
  return -1;
1918
1955
  },
1919
1956
  getSheetCount: () => i.getSheets().getItems({ visibility: O.Visibility.VeryHidden }).length,
1957
+ getSheetIds: () => i._sheets?.getItems({ visibility: O.Visibility.VeryHidden }).map((e) => e.getId()) ?? [],
1958
+ addSheetsListener: (e, t) => i.addListeners({ onSheetsChange: () => {
1959
+ i._restoringSheets || e();
1960
+ } }, t),
1920
1961
  getSheetById: (e) => {
1921
1962
  let t = i.getSheets().getItems({ visibility: O.Visibility.VeryHidden }), n = t.length;
1922
1963
  for (let r = 0; r < n; r++) if (t[r].getId() === e) return t[r];
1923
1964
  return null;
1924
1965
  },
1925
- getSheetByName: (e) => {
1926
- try {
1927
- return i.getSheets().getByName(e) ?? null;
1928
- } catch {
1929
- return null;
1930
- }
1931
- },
1966
+ externalBooks: r?.externalBooks,
1967
+ externalBookResolver: t.externalBookResolver,
1932
1968
  namedCollection: i._names,
1933
1969
  strings: i._strings,
1934
1970
  transactions: i._transactions,
1935
- names: r?.names,
1936
- formulaTransform: t.formulaTransform
1937
- }), this._ownCalculation = !t.calculation, this._scripts = this._createScripts(), this._ownNames = !t.names, this._options = Object.freeze({ ...t });
1938
- let n = async () => {
1939
- this._ownCalculation && await this._calculation.start(), await this._scripts.start(), this._starting = null;
1940
- };
1941
- this._starting = n(), this._starting?.catch(() => {}), r ? this._fromJSON(r) : (this._initState(), this._addSheet(!1)), this._sheets = new bn((e) => i._addSheetOptions(e), (e, t) => {
1971
+ names: r?.names
1972
+ }), this._ownCalculation = !t.calculation, this._scripts = this._createScripts(r?.modules), this._ownNames = !t.names, this._options = Object.freeze({ ...t });
1973
+ let n = t.calcOnLoad ?? "auto", o = !1, s = (async () => {
1974
+ try {
1975
+ if (this._ownCalculation && n !== "none" && (n === "full" || n === "auto" && !0 === r?.calc?.fullCalcOnLoad ? await this._calculation.calculate({ full: !0 }) : await this._calculation.start(), this._closed)) return;
1976
+ await this._scripts.start();
1977
+ } finally {
1978
+ o = !0, this._starting = null;
1979
+ }
1980
+ })();
1981
+ o || (this._starting = s), this._starting?.catch(() => {}), r ? this._fromJSON(r) : (this._initState(), this._addSheet(!1)), this._sheets = new Xn((e) => i._addSheetOptions(e), (e, t) => {
1942
1982
  if (e) {
1943
1983
  let n = this._getSheetRef(e, t);
1944
1984
  return n ? [n.sheet] : I.EmptyArray;
1945
1985
  }
1946
1986
  return this._getSheets(t);
1947
- }), this._ownCalculation && this._calculation.hydrateNames(), this._emitter.notify("onLoad"), a.commit({ forceAmend: this._ownTransactions });
1987
+ }, (e, t) => {
1988
+ let n = e.onCollectionChange, r = e.onInvalidated;
1989
+ return i._emitter.addListeners({
1990
+ onSheetsChange: n ? () => {
1991
+ n(i._sheets);
1992
+ } : void 0,
1993
+ onInvalidated: r ? () => {
1994
+ r(i._sheets);
1995
+ } : void 0
1996
+ }, t);
1997
+ }), this._ownCalculation && (t.calcOnLoad ?? "auto") !== "none" && this._calculation.hydrateNames(), this._emitter.notify("onLoad"), this._ownTransactions ? a.amend() : a.commit();
1948
1998
  } catch (e) {
1949
1999
  throw a.rollback(), e;
1950
2000
  }
@@ -1954,22 +2004,22 @@ var En, Dn, $ = class e extends ge {
1954
2004
  let e = this._getSheetRefs();
1955
2005
  for (let t = (e ? e.length : 0) - 1; t >= 0; t--);
1956
2006
  let t = this._options;
1957
- this._isDate1904 = t.runtime?.isDate1904() ?? !1, this._locale = null, this._localeOverrides = null, this._theme = t.theme ?? new g().getDefaultTheme(), this._styles = t?.styles ?? new ae(this._theme), this._ownStyles = !t.styles, this._styles.getTheme() || this._styles.setTheme(this.getTheme()), this._activeSheetOffset = 0, this.setView(new Q()), this._listenerProtection?.(), this._protection = new vn(void 0, this._options.readonly ?? !1), this._listenerProtection = this._protection.addListeners({ onChange: (e) => {
2007
+ this._isDate1904 = t.runtime?.isDate1904() ?? !1, this._locale = null, this._localeOverrides = null, this._theme = t.theme ?? new ee().getDefaultTheme(), this._styles = t?.styles ?? new Ze(this._theme), this._ownStyles = !t.styles, this._styles.getTheme() || this._styles.setTheme(this.getTheme()), this._activeSheetOffset = 0, this.setView(new qn()), this._listenerProtection?.(), this._protection = new Yn(void 0, this._options.readonly ?? !1), this._listenerProtection = this._protection.addListeners({ onChange: (e) => {
1958
2008
  n._emitter.notify("onProtectionChange");
1959
2009
  } });
1960
2010
  let n = this;
1961
2011
  this._transactionsRemoveListener = this._transactions.addStateListener(this._id, {
1962
- async onAfterStateChange(e, t, r) {
1963
- if (t && t.activeSheetId !== void 0 && t.view === n.getView() && r.getId() === n._lastTransactionUUID && await n._getSheetRef({ id: t.activeSheetId })?.sheet.select(), t && r.getId() !== n._lastTransactionUUID) {
1964
- let r = n.getView().getActiveSheetId();
1965
- t.view === n.getView() && (r = t.activeSheetId);
1966
- let i = 0;
2012
+ async onAfterStateChange(e, t, r, i, a) {
2013
+ let o = n._view, s = a?.[or], c = r ? s?.before : s?.after, l = s?.viewId === o.getId() && c != null, u = l ? c : o.getActiveSheetId(), d = l && t.getId() === n._lastTransactionUUID ? n._getSheetRef({ id: u }) : null;
2014
+ if (d ? await d.sheet.select() : n._resyncActiveSheet(u, e), n._lastTransactionUUID = t.getId(), r || i) {
2015
+ n._restoringSheets = !0;
1967
2016
  try {
1968
- i = n._getOffsetForId(r, e.sheetRefsVisible);
1969
- } catch {}
1970
- n._adjustRemoveSelectionIfRequired(i, r);
2017
+ n._emitter.notify("onSheetsChange");
2018
+ } finally {
2019
+ n._restoringSheets = !1;
2020
+ }
1971
2021
  }
1972
- n._lastTransactionUUID = r.getId(), n._notifyAllChange();
2022
+ n._emitter.notify("onSelectedSheetChange"), n._emitter.notify("onViewChange");
1973
2023
  },
1974
2024
  onRestoreOrRevert() {
1975
2025
  n._ownCalculation, n._emitter.notify("onInvalidated");
@@ -2002,7 +2052,22 @@ var En, Dn, $ = class e extends ge {
2002
2052
  return this._closed ? null : this._origin.getName();
2003
2053
  }
2004
2054
  getOrigin() {
2005
- return this._origin;
2055
+ return this._originProvider.getOrigin();
2056
+ }
2057
+ _onOriginChange() {
2058
+ if (this._closed) return;
2059
+ let e = this._originProvider.getOrigin();
2060
+ if (e === this._origin) return;
2061
+ this._listenerOrigin?.();
2062
+ let t = this._lastOriginName;
2063
+ this._bindOrigin(e), this._emitter.notify("onOriginChange"), this._lastOriginName !== t && this._emitter.notify("onNameChange");
2064
+ }
2065
+ _bindOrigin(e) {
2066
+ this._origin = e, this._lastOriginName = e.getName(), this._listenerOrigin = e.addListeners({ onChange: () => {
2067
+ if (this._closed) return;
2068
+ let t = e.getName();
2069
+ t !== this._lastOriginName && (this._lastOriginName = t, this._emitter.notify("onNameChange"));
2070
+ } });
2006
2071
  }
2007
2072
  getView() {
2008
2073
  return this._view;
@@ -2022,7 +2087,7 @@ var En, Dn, $ = class e extends ge {
2022
2087
  }
2023
2088
  setDate1904(e) {
2024
2089
  if (this._closed) throw Error(H("error.workbook.modelClosed"));
2025
- return this._isDate1904 = e, this._notifyAllChange(), this;
2090
+ return this._isDate1904 === e || (this._isDate1904 = e, this._emitter.notify("onRegionalChange")), this;
2026
2091
  }
2027
2092
  getLocale() {
2028
2093
  return this._runtime.getLocale();
@@ -2037,7 +2102,7 @@ var En, Dn, $ = class e extends ge {
2037
2102
  } catch {
2038
2103
  throw Error(H("error.workbook.invalidLocale", { locale: e }));
2039
2104
  }
2040
- return this._locale === e || (this._locale = e, this._notifyAllChange()), this;
2105
+ return this._locale === e || (this._locale = e, this._emitter.notify("onRegionalChange")), this;
2041
2106
  }
2042
2107
  getLocaleOverrides() {
2043
2108
  return this._localeOverrides;
@@ -2045,7 +2110,7 @@ var En, Dn, $ = class e extends ge {
2045
2110
  setLocaleOverrides(e) {
2046
2111
  if (this._closed) throw Error(H("error.workbook.modelClosed"));
2047
2112
  let t = e && Object.keys(e).length > 0 ? e : null;
2048
- return this._localeOverrides = t, this._notifyAllChange(), this;
2113
+ return this._localeOverrides = t, this._emitter.notify("onRegionalChange"), this;
2049
2114
  }
2050
2115
  getStyles() {
2051
2116
  return this._styles;
@@ -2060,7 +2125,23 @@ var En, Dn, $ = class e extends ge {
2060
2125
  return this._strings;
2061
2126
  }
2062
2127
  getExternalBooks() {
2063
- return this._externalBooks;
2128
+ return this._calculation.getExternalBooks();
2129
+ }
2130
+ getUpdateLinks() {
2131
+ return this._updateLinks;
2132
+ }
2133
+ setUpdateLinks(e) {
2134
+ if (this._closed) throw Error(H("error.workbook.modelClosed"));
2135
+ return this._updateLinks = e, this;
2136
+ }
2137
+ getPivotTables() {
2138
+ return this._pivotTableCollection;
2139
+ }
2140
+ getComments() {
2141
+ return this._commentCollection;
2142
+ }
2143
+ getPeople() {
2144
+ return this._people;
2064
2145
  }
2065
2146
  getTheme() {
2066
2147
  return this._theme;
@@ -2082,12 +2163,12 @@ var En, Dn, $ = class e extends ge {
2082
2163
  if (e === void 0) return this.getSelectedSheet();
2083
2164
  if (!e) throw Error(H("error.workbook.sheetNameNotProvided"));
2084
2165
  let n = this._getSheetRef(e, t);
2085
- if (!n) throw new B(H("error.workbook.sheetNameNotFound", { sheetName: e }));
2166
+ if (!n) throw new z(H("error.workbook.sheetNameNotFound", { sheetName: e }));
2086
2167
  return n.sheet;
2087
2168
  }
2088
2169
  getSheetAt(e, t = O.Visibility.Visible) {
2089
2170
  let n = this._getSheetRef(e, t);
2090
- if (!n) throw new B(function(e) {
2171
+ if (!n) throw new z(function(e) {
2091
2172
  return H("error.workbook.sheetIndexNotFound", { index: e });
2092
2173
  }(e));
2093
2174
  return n.sheet;
@@ -2109,21 +2190,21 @@ var En, Dn, $ = class e extends ge {
2109
2190
  }
2110
2191
  _getSheetRef(e, t = O.Visibility.Visible) {
2111
2192
  let n = null;
2112
- return typeof e == "number" ? this._getSheetRefs(t)[e] : (typeof e == "string" ? n = this._getState().refsByLowerCaseName.get(e.toLowerCase()) : e instanceof A ? n = this._getState().refsByInstance.get(e) : e?.id !== void 0 && (n = this._getState().refsById.get(e.id)), n);
2193
+ return typeof e == "number" ? this._getSheetRefs(t)[e] : (typeof e == "string" ? n = this._getState().refsByLowerCaseName.get(e.toLowerCase()) : e instanceof M ? n = this._getState().refsByInstance.get(e) : e?.id !== void 0 && (n = this._getState().refsById.get(e.id)), n);
2113
2194
  }
2114
2195
  _validateNewSheetName(e, t = !0) {
2115
2196
  if (e == null) return e;
2116
- if (Tn(e), t && this._getState().sheetsByLowerCaseName.has(e.toLowerCase())) throw new R(H("error.workbook.nameTaken"));
2197
+ if (tr(e), t && this._getState().sheetsByLowerCaseName.has(e.toLowerCase())) throw new R(H("error.workbook.nameTaken"));
2117
2198
  return e.substring(0, 31);
2118
2199
  }
2119
2200
  findValidSheetName(e) {
2120
- e &&= Tn(e, !0);
2201
+ e &&= tr(e, !0);
2121
2202
  try {
2122
2203
  return function(e, t) {
2123
2204
  try {
2124
2205
  if (t(e)) return e;
2125
2206
  } catch {}
2126
- let n, r, i = Sn.exec(e);
2207
+ let n, r, i = Qn.exec(e);
2127
2208
  for (i === null ? (n = e + " ", r = 1) : (n = e.substring(0, i.index), r = parseFloat(i[1])); r < 256;) {
2128
2209
  r++;
2129
2210
  let e = "(" + r + ")", i = n.substring(0, 31 - e.length) + e;
@@ -2138,11 +2219,14 @@ var En, Dn, $ = class e extends ge {
2138
2219
  }
2139
2220
  }
2140
2221
  isValidSheetNameCharacter(e) {
2141
- return !xn.test(e);
2222
+ return !Zn.test(e);
2223
+ }
2224
+ _isStructureProtected() {
2225
+ return !this._initializing && !this.getProtection().isStructureAllowed();
2142
2226
  }
2143
2227
  _addSheetOptions(e) {
2144
2228
  if (this._closed) throw Error(H("error.workbook.modelClosed"));
2145
- if (!this.getProtection().isStructureAllowed()) throw new R(H("error.workbook.protection"));
2229
+ if (!this.getProtection().isStructureAllowed()) throw new B(H("error.workbook.protection"));
2146
2230
  let t, n = null;
2147
2231
  t = typeof e == "string" ? { name: e } : typeof e == "number" ? { index: e } : e, t = {
2148
2232
  ...t,
@@ -2152,22 +2236,8 @@ var En, Dn, $ = class e extends ge {
2152
2236
  try {
2153
2237
  let e = t?.autoSelect ?? !1;
2154
2238
  n = this._addSheet(!0, t.name, t.index ?? null);
2155
- let i = this.getView().getActiveSheetId(), a, o;
2156
- if (!1 !== e) {
2157
- let t = this.getView().getActiveSheetId();
2158
- t = this._getSheetRef(n).id, e && (a = {
2159
- view: this.getView(),
2160
- activeSheetId: i
2161
- }, o = {
2162
- view: this.getView(),
2163
- activeSheetId: t
2164
- });
2165
- }
2166
- if (r.commit({
2167
- description: H("op.addSheetNamed", { name: n.getName() }),
2168
- viewBefore: a,
2169
- viewAfter: o
2170
- }), !1 !== e) {
2239
+ let i = this.getView().getActiveSheetId();
2240
+ if (e && this._recordActiveSheet(r, i, this._getSheetRef(n).id), r.commit({ description: H("op.addSheetNamed", { name: n.getName() }) }), !1 !== e) {
2171
2241
  let t = typeof e == "boolean" ? void 0 : e;
2172
2242
  n.select(t);
2173
2243
  }
@@ -2191,13 +2261,13 @@ var En, Dn, $ = class e extends ge {
2191
2261
  }
2192
2262
  _addSheet(e, t = null, n = null) {
2193
2263
  t = this._nextSheetName(t);
2194
- let r = this._getState(), i = this._createSheet(r.lastId, t, O.Visibility.Visible, n, null);
2264
+ let r = this._getState(), i = this._createSheet(r.lastId, t, O.Visibility.Visible, n, void 0, null);
2195
2265
  if (!i) throw new R(H("error.workbook.sheetNameBlank"));
2196
2266
  return e && this._emitter.notify("onSheetsChange"), i;
2197
2267
  }
2198
2268
  _updateSheetRefStates(e) {
2199
2269
  if (this._closed) throw Error(H("error.workbook.modelClosed"));
2200
- if (!this._initializing && !this.getProtection().isStructureAllowed()) throw new R(H("error.workbook.protection"));
2270
+ if (!this._initializing && !this.getProtection().isStructureAllowed()) throw new B(H("error.workbook.protection"));
2201
2271
  let t = e, n = [], r = [], i = t.length;
2202
2272
  for (let e = 0; e < i; e++) t[e].visibility === O.Visibility.Visible ? (n.push(t[e]), r.push(t[e])) : t[e].visibility === O.Visibility.Hidden && r.push(t[e]);
2203
2273
  this._updateState({
@@ -2284,6 +2354,26 @@ var En, Dn, $ = class e extends ge {
2284
2354
  let g = new Set(this._getState().sheetsCreated);
2285
2355
  return g.add(e.sheet), this._updateState({ sheetsCreated: g }), e;
2286
2356
  }
2357
+ _recordActiveSheet(e, t, n) {
2358
+ let r = this.getView().getId();
2359
+ e.setIntent(or, (e) => ({
2360
+ viewId: r,
2361
+ before: e?.before ?? t,
2362
+ after: n
2363
+ }));
2364
+ }
2365
+ _resyncActiveSheet(e, t) {
2366
+ let n = t?.sheetRefsVisible;
2367
+ if (!n?.length) return;
2368
+ let r = -1, i = n.length;
2369
+ for (let t = 0; t < i; t++) if (n[t].id === e) {
2370
+ r = t;
2371
+ break;
2372
+ }
2373
+ r === -1 && (r = Math.min(Math.max(this._activeSheetOffset, 0), i - 1));
2374
+ let a = n[r].id;
2375
+ this._view.getActiveSheetId() === a ? this._activeSheetOffset = r : this._view.setActiveSheetId(a);
2376
+ }
2287
2377
  _adjustRemoveSelectionIfRequired(e, t) {
2288
2378
  if (this._view.getActiveSheetId() === t) {
2289
2379
  let t, n = this._getState().sheetRefsVisible;
@@ -2300,7 +2390,7 @@ var En, Dn, $ = class e extends ge {
2300
2390
  }
2301
2391
  _validateDeleteSheet(e) {
2302
2392
  if (this._closed) throw Error(H("error.workbook.modelClosed"));
2303
- if (!this.getProtection().isStructureAllowed()) throw new R(H("error.workbook.protection"));
2393
+ if (!this.getProtection().isStructureAllowed()) throw new B(H("error.workbook.protection"));
2304
2394
  let t = this._getSheetRef(e);
2305
2395
  if (!t) throw new R(function(e) {
2306
2396
  return H("error.workbook.deleteKey", { key: e });
@@ -2341,7 +2431,7 @@ var En, Dn, $ = class e extends ge {
2341
2431
  }
2342
2432
  if (!d && s && a === i && (u.done || !c || !u.done && f(u.value.getCoords(), c) >= 0) && (d = !0), d) {
2343
2433
  let e = u;
2344
- return u = Ce, e;
2434
+ return u = Ct, e;
2345
2435
  }
2346
2436
  let p = u;
2347
2437
  return u = l.next(), p;
@@ -2353,27 +2443,24 @@ var En, Dn, $ = class e extends ge {
2353
2443
  } };
2354
2444
  }
2355
2445
  replace(e, t, n) {
2356
- let r = 0, i = null, a = typeof t == "function", o = n?.maxCount ?? 2 ** 53 - 1, s = !n?.maxCount, c = "", l = typeof t == "string" ? me(t) : null, u = n?.description ?? V("op.replace"), d = this._transactions.beginCommit({ description: u });
2446
+ let r = 0, i = null, a = typeof t == "function", o = n?.maxCount ?? 2 ** 53 - 1, s = !n?.maxCount, c = "", l = typeof t == "string" ? u(t) : null, d = n?.description ?? V("op.replace"), f = this._transactions.beginCommit({ description: d });
2357
2447
  try {
2358
- let u = null, f = null, p = e.next();
2448
+ let u = null, d = null, p = e.next();
2359
2449
  for (; !p.done && r < o;) {
2360
2450
  let o = p.value, s = o.getSheet();
2361
- s !== u && (u = s, f !== null && f.apply(), f = u.getEntireRange().createSparseBuilder({
2451
+ s !== u && (u = s, d !== null && d.apply(), d = u.getEntireRange().createSparseBuilder({
2362
2452
  axis: n?.axis,
2363
2453
  allowUnorderedWrites: !0
2364
2454
  }));
2365
2455
  let c = a ? t(o) : t;
2366
- c !== void 0 && c !== o && (f.push(o, c), r++, i = o), p = e.next();
2456
+ c !== void 0 && c !== o && (d.push(o, c), r++, i = o), p = e.next();
2367
2457
  }
2368
- f?.apply(), r === 1 && o === 1 && i && (c = i.getAddress()), r === 0 ? d.rollback() : d.commit({
2369
- description: n?.description ?? (s ? l === null ? V("op.replaceAll") : H("op.replaceAllWith", { value: l }) : c ? l === null ? H("op.replaceAt", { address: c }) : H("op.replaceAtWith", {
2370
- address: c,
2371
- value: l
2372
- }) : l === null ? V("op.replace") : H("op.replaceWith", { value: l })),
2373
- viewAfter: { selection: null }
2374
- });
2458
+ d?.apply(), r === 1 && o === 1 && i && (c = i.getAddress()), r === 0 ? f.rollback() : f.commit({ description: n?.description ?? (s ? l === null ? V("op.replaceAll") : H("op.replaceAllWith", { value: l }) : c ? l === null ? H("op.replaceAt", { address: c }) : H("op.replaceAtWith", {
2459
+ address: c,
2460
+ value: l
2461
+ }) : l === null ? V("op.replace") : H("op.replaceWith", { value: l })) });
2375
2462
  } catch (e) {
2376
- throw d.rollback(), e;
2463
+ throw f.rollback(), e;
2377
2464
  }
2378
2465
  return {
2379
2466
  count: r,
@@ -2400,15 +2487,15 @@ var En, Dn, $ = class e extends ge {
2400
2487
  }
2401
2488
  async _duplicateSheet(e) {
2402
2489
  if (this._closed) throw Error(H("error.workbook.modelClosed"));
2403
- if (!this.getProtection().isStructureAllowed()) throw new R(H("error.workbook.protection"));
2490
+ if (!this.getProtection().isStructureAllowed()) throw new B(H("error.workbook.protection"));
2404
2491
  let t = this._getSheetRefs(), n = this.getSelectedSheetIndex(), r = null;
2405
2492
  if (e) {
2406
- if (r = this._getSheetRef(e), !r) throw new R(yn(r));
2493
+ if (r = this._getSheetRef(e), !r) throw new R(Z(r));
2407
2494
  } else r = t[n];
2408
2495
  if (!r) return null;
2409
2496
  let i = r.sheet, a = this._strings.beginPersist(), o = this.getResources().beginPersist(), s = this.getStyles().beginPersist(), c = null, l = this.beginCommit(H("op.duplicateNamed", { name: i.getName() }));
2410
2497
  try {
2411
- let e = this._getState().refsByInstance.get(i), r = await i.toJSON(), a = t.length + 1, o = this.findValidSheetName(e.name), s = this._createSheet(a, o, e.visibility, n, r);
2498
+ let e = this._getState().refsByInstance.get(i), r = await i.toJSON(), a = t.length + 1, o = this.findValidSheetName(e.name), s = this._createSheet(a, o, e.visibility, n, void 0, r);
2412
2499
  this._emitter.notify("onSheetsChange"), c = s, l.commit();
2413
2500
  } catch (e) {
2414
2501
  throw l.rollback(), e;
@@ -2417,21 +2504,21 @@ var En, Dn, $ = class e extends ge {
2417
2504
  }
2418
2505
  return c;
2419
2506
  }
2420
- _createRange(e, t) {
2421
- let n = e ? { ...e } : null, r = n ? this._getSheetRef(n.scope, O.Visibility.VeryHidden) : null;
2422
- if (!r) {
2507
+ _createRange(e, n) {
2508
+ let r = e ? { ...e } : null, i = r ? this._getSheetRef(r.scope, O.Visibility.VeryHidden) : null;
2509
+ if (!i) {
2423
2510
  let e = this.getSelectedSheet();
2424
- return e ? (delete n?.scope, wn(n, n ? {
2425
- scope: h,
2511
+ return e ? (delete r?.scope, er(r, r ? {
2512
+ scope: t,
2426
2513
  ...e.getEntireRange().getCoords()
2427
2514
  } : null)) : void console.warn(H("error.workbook.noVisibleRefs"));
2428
2515
  }
2429
- let i = r.sheet, a = null;
2430
- return t && (a = { getOptions: t }), new On(e, D(i), this, a);
2516
+ let a = i.sheet, o = null;
2517
+ return n && (o = { getOptions: n }), new cr(e, D(a), this, o);
2431
2518
  }
2432
2519
  _createRanges(e, t) {
2433
2520
  let n = this.getSelectedSheet(), r = null;
2434
- return t && (r = { getOptions: t }), new $(e, D(n), this, r);
2521
+ return t && (r = { getOptions: t }), new sr(e, D(n), this, r);
2435
2522
  }
2436
2523
  getRange(e, t) {
2437
2524
  if (e === void 0) return this.getSelectedRange(t);
@@ -2440,7 +2527,7 @@ var En, Dn, $ = class e extends ge {
2440
2527
  if (n.length !== 1) throw new R(H("error.address.singleRangeOnlyAlt"));
2441
2528
  return this._createRange(n[0], t);
2442
2529
  } catch (t) {
2443
- throw t instanceof B ? new B(t.message) : new R(t.message ?? o(e));
2530
+ throw t instanceof z ? new z(t.message) : new R(t.message ?? $e(e));
2444
2531
  }
2445
2532
  }
2446
2533
  getCell(e) {
@@ -2451,17 +2538,17 @@ var En, Dn, $ = class e extends ge {
2451
2538
  }
2452
2539
  getRanges(e, t) {
2453
2540
  let n = this._rangesAddressToCoords(e);
2454
- if (n.length === 0) throw new R(o(e));
2541
+ if (n.length === 0) throw new R($e(e));
2455
2542
  return this._createRanges(n, t);
2456
2543
  }
2457
2544
  _createGraphRanges(e, t) {
2458
- let n = [];
2545
+ let n = [], r = this.getCalculation()?.getNamedFormulas() ?? null;
2459
2546
  for (let e = 0; e < t.length; e++) {
2460
- let r = t[e], i = (r.sheetName ? this._getSheetRef(r.sheetName, O.Visibility.VeryHidden) : null)?.sheet ?? this.getSelectedSheet();
2461
- i && n.push(new je(r, D(i), null));
2547
+ let i = t[e], a = (i.sheetName ? this._getSheetRef(i.sheetName, O.Visibility.VeryHidden) : null)?.sheet ?? this.getSelectedSheet();
2548
+ a && n.push(new Ee(i, r, D(a), null));
2462
2549
  }
2463
2550
  for (let t = 0; t < e.length; t++) n.push(e[t]);
2464
- return n.length === 0 ? null : new $(n, D(this.getSelectedSheet()), this, null);
2551
+ return n.length === 0 ? null : new sr(n, D(this.getSelectedSheet()), this, null);
2465
2552
  }
2466
2553
  getStats(e) {
2467
2554
  if (this._closed) throw Error(H("error.workbook.modelClosed"));
@@ -2469,7 +2556,7 @@ var En, Dn, $ = class e extends ge {
2469
2556
  if (n === 1) return t[0].getStats(e);
2470
2557
  let r = Array(n);
2471
2558
  for (let i = 0; i < n; i++) r[i] = t[i].getStats(e);
2472
- return new on(r);
2559
+ return new In(r);
2473
2560
  }
2474
2561
  _activeRangeCoords() {
2475
2562
  let e = this.getSelectedSheet(), t = e.getSelection().getRanges().getCoords(), n = e.getName(), r = t.length, i = Array(r);
@@ -2494,31 +2581,31 @@ var En, Dn, $ = class e extends ge {
2494
2581
  getSelectedCell() {
2495
2582
  return this.getSelectedSheet().getSelectedCell();
2496
2583
  }
2497
- _rangesAddressToCoords(e, n = !0, r = O.Visibility.Hidden) {
2584
+ _rangesAddressToCoords(e, t = !0, n = O.Visibility.Hidden) {
2498
2585
  if (!e) throw new R(H("error.address.noAddress"));
2499
- let i = this.getSelectedSheet(), a = { ...i?.getEntireRange().getCoords() }, o = i?.getName();
2500
- if (o && (a.scope = o), typeof e == "string") {
2586
+ let r = this.getSelectedSheet(), i = { ...r?.getEntireRange().getCoords() }, a = r?.getName();
2587
+ if (a && (i.scope = a), typeof e == "string") {
2501
2588
  let t = e.trim().toLowerCase();
2502
2589
  if (t === "r" || t === "c") {
2503
2590
  let n = this.getSelectedCell().getCoords(), r = {};
2504
2591
  t === "r" ? r.rowStart = r.rowEnd = n.rowIndex : r.colStart = r.colEnd = n.colIndex, e = r;
2505
2592
  }
2506
2593
  }
2507
- let s = this, c = le(e, a, t, (e) => {
2508
- if (!n) return null;
2594
+ let o = this, s = ot(e, i, qe, (e) => {
2595
+ if (!t) return null;
2509
2596
  if (typeof e == "string") {
2510
- let t = s.getNames().getByName(e)?.getRanges?.();
2597
+ let t = o.getNames().getByName(e)?.getRanges?.();
2511
2598
  if (t) return t.getCoords();
2512
2599
  }
2513
2600
  throw new R(`Invalid sheet reference '${e}'.`);
2514
- }), l = c.length;
2515
- for (let e = 0; e < l; e++) this._validateCoords(c[e], r);
2516
- return c;
2601
+ }), c = s.length;
2602
+ for (let e = 0; e < c; e++) this._validateCoords(s[e], n);
2603
+ return s;
2517
2604
  }
2518
2605
  _validateCoords(e, t = O.Visibility.Visible, n = H("error.sheet.oobRange")) {
2519
2606
  if (e === null) return;
2520
2607
  let r = this.getSheet(e.scope, t).getEntireRange().getCoords();
2521
- if (!L.isRangeWithinRange(e, r)) throw new B(n);
2608
+ if (!L.isRangeWithinRange(e, r)) throw new z(n);
2522
2609
  if (e.rowEnd < e.rowStart || e.colEnd < e.colStart) throw new R(H("error.address.invalidRangeInverted"));
2523
2610
  }
2524
2611
  _updateSheetRef(e, t) {
@@ -2540,9 +2627,9 @@ var En, Dn, $ = class e extends ge {
2540
2627
  }
2541
2628
  _setSheetName(e, t, n) {
2542
2629
  if (this._closed) throw Error(H("error.workbook.modelClosed"));
2543
- if (!this.getProtection().isStructureAllowed()) throw new R(H("error.workbook.protection"));
2630
+ if (!this.getProtection().isStructureAllowed()) throw new B(H("error.workbook.protection"));
2544
2631
  let r = this._getSheetRef(e);
2545
- if (!r) throw new R(yn(e));
2632
+ if (!r) throw new R(Z(e));
2546
2633
  if (t === r.name) return r.sheet;
2547
2634
  if ((t = this._validateNewSheetName(t)) == null) throw new R(H("error.workbook.sheetNameNotProvided"));
2548
2635
  let i = Object.freeze({
@@ -2561,7 +2648,7 @@ var En, Dn, $ = class e extends ge {
2561
2648
  }
2562
2649
  _setSheetVisibility(e, t = O.Visibility.Visible, n) {
2563
2650
  if (this._closed) throw Error(H("error.workbook.modelClosed"));
2564
- if (!this.getProtection().isStructureAllowed()) throw new R(H("error.workbook.protection"));
2651
+ if (!this.getProtection().isStructureAllowed()) throw new B(H("error.workbook.protection"));
2565
2652
  let r = this._getSheetRef(e, O.Visibility.VeryHidden);
2566
2653
  if (!r) return null;
2567
2654
  if (t === r.visibility) return;
@@ -2585,27 +2672,17 @@ var En, Dn, $ = class e extends ge {
2585
2672
  }
2586
2673
  _moveSheet(e, t, n) {
2587
2674
  if (this._closed) throw Error(H("error.workbook.modelClosed"));
2588
- if (!this.getProtection().isStructureAllowed()) throw new R(H("error.workbook.protection"));
2675
+ if (!this.getProtection().isStructureAllowed()) throw new B(H("error.workbook.protection"));
2589
2676
  let r = null, i = this.beginCommit(H("op.moveSheetNamed", { name: e.name }));
2590
2677
  try {
2591
2678
  let a = this._getState(), o = a.sheetRefsVisible;
2592
2679
  if (t < 0 || t > o.length - 1) throw new R(`Invalid to index: ${t}`);
2593
- let s = {
2594
- view: this.getView(),
2595
- activeSheetId: this.getView().getActiveSheetId()
2596
- }, c = a.sheetRefsAll, l = this._getOffsetForId(e.id, c), u = this._getOffsetForId(o[t].id, c);
2680
+ let s = this.getView().getActiveSheetId(), c = a.sheetRefsAll, l = this._getOffsetForId(e.id, c), u = this._getOffsetForId(o[t].id, c);
2597
2681
  if (l === u) return;
2598
2682
  let d = c[l], f = [...c];
2599
- f.splice(l, 1), f.splice(u, 0, d), this._updateSheetRefStates(f), this._adjustSheetNamesIfRequired(), this._sheetOnIndexChange.forEach((e, t) => {
2683
+ f.splice(l, 1), f.splice(u, 0, d), this._updateSheetRefStates(f), this._calculation._replaceSheetSpans?.(c.map((e) => e.sheet.getId()), f.map((e) => e.sheet.getId()), d.sheet.getId()), this._adjustSheetNamesIfRequired(), this._sheetOnIndexChange.forEach((e, t) => {
2600
2684
  t >= l && t <= u && e();
2601
- }), this._emitter.notify("onSheetsChange"), r = d.sheet, i.commit({
2602
- ...n,
2603
- viewBefore: s,
2604
- viewAfter: {
2605
- view: this.getView(),
2606
- activeSheetId: this.getView().getActiveSheetId()
2607
- }
2608
- });
2685
+ }), this._emitter.notify("onSheetsChange"), r = d.sheet, this._recordActiveSheet(i, s, this.getView().getActiveSheetId()), i.commit(n);
2609
2686
  } catch (e) {
2610
2687
  throw i.rollback(), e;
2611
2688
  }
@@ -2614,31 +2691,38 @@ var En, Dn, $ = class e extends ge {
2614
2691
  _setSelectedSheet(e) {
2615
2692
  if (this._closed) throw Error(H("error.workbook.modelClosed"));
2616
2693
  let t = this._getSheetRef(e);
2617
- if (!t) throw new R(yn(e));
2694
+ if (!t) throw new R(Z(e));
2618
2695
  let n = null;
2619
2696
  return t.visibility !== O.Visibility.Visible && this._setSheetVisibility(t, O.Visibility.Visible), this._view.setActiveSheetId(t.id), n = t.sheet, n;
2620
2697
  }
2621
2698
  getProtection() {
2622
2699
  return this._protection;
2623
2700
  }
2701
+ getCodeName() {
2702
+ return this._codeName;
2703
+ }
2624
2704
  getNames() {
2625
2705
  return this._names;
2626
2706
  }
2627
2707
  getCalculation() {
2628
2708
  return this._calculation;
2629
2709
  }
2630
- createFormula(e, t) {
2631
- return this.getCalculation().createFormula(e, t);
2710
+ createFormula(e, t, n) {
2711
+ return this.getCalculation().createFormula(e, t, n);
2632
2712
  }
2633
2713
  evaluate(e, t) {
2634
2714
  return this.getCalculation().evaluate(e, t);
2635
2715
  }
2636
2716
  whenCalculationReady() {
2637
- return this.getCalculation().ready();
2717
+ let e = this._starting;
2718
+ return e ? e.then(() => this.getCalculation().ready()) : this.getCalculation().ready();
2638
2719
  }
2639
2720
  getScripts() {
2640
2721
  return this._scripts ||= this._createScripts(), this._scripts;
2641
2722
  }
2723
+ getModules() {
2724
+ return this.getScripts().getModules();
2725
+ }
2642
2726
  _notifyAllChange() {
2643
2727
  this._emitter.notify("onSheetsChange"), this._emitter.notify("onSelectedSheetChange"), this._emitter.notify("onViewChange");
2644
2728
  }
@@ -2650,6 +2734,7 @@ var En, Dn, $ = class e extends ge {
2650
2734
  return (n) => {
2651
2735
  let r = () => {
2652
2736
  let e = n.getSource();
2737
+ if (e.isInvalid()) return e;
2653
2738
  if (e.isICellRanges) {
2654
2739
  let n = [...e.getCoords()], r = n.length;
2655
2740
  for (let t = 0; t < r; t++) {
@@ -2684,43 +2769,61 @@ var En, Dn, $ = class e extends ge {
2684
2769
  }
2685
2770
  _fromJSON(e) {
2686
2771
  if (this._emitter.notify("onBeforeLoad", { params: e }), this._initState(), !e.sheets || e.sheets.length === 0) throw new R(H("error.workbook.sheetOne"));
2687
- e.theme && (this._theme = new m(e.theme), this._styles.setTheme(this._theme));
2772
+ e.theme && (this._theme = new v(e.theme), this._styles.setTheme(this._theme));
2688
2773
  let t = this._strings.beginPersist(), n = this._resources.beginPersist(), r = this._styles.beginPersist();
2689
2774
  try {
2690
- t.fromJSON(e.strings), n.fromJSON(e.resources), r.fromJSON(e.styles), e.date1904 && (this._isDate1904 = !0), e.locale && (this._locale = e.locale), e.localeOverrides && (this._localeOverrides = e.localeOverrides), e.view ||= {};
2691
- let i = e.sheets, a = i.length, o = e.view.activeSheetId ?? null;
2692
- o !== null && (o = Math.min(Math.max(0, o), a - 1));
2693
- let s = null, c = null, l = -1;
2694
- for (let e = 0; e < a; e++) {
2695
- let t = i[e], n = t.visibility || O.Visibility.Visible, r = e;
2696
- c = r, n === O.Visibility.Visible ? (l++, s === null && (s = r)) : o !== null && o === r && (o = null), this._createSheet(r, t.name, n, l, t.sheet);
2775
+ t.fromJSON(e.strings), n.fromJSON(e.resources), r.fromJSON(e.styles), e.date1904 && (this._isDate1904 = !0), this._codeName = e.codeName ?? null, this._updateLinks = e.updateLinks ?? null, e.locale && (this._locale = e.locale), e.localeOverrides && (this._localeOverrides = e.localeOverrides), e.view ||= {};
2776
+ let i = [], a = e.pivotCaches;
2777
+ if (a) {
2778
+ let e = n.fromResourceId.bind(n);
2779
+ for (let t = 0; t < a.length; t++) {
2780
+ let n = a[t];
2781
+ n && typeof n.cacheId == "number" && i.push({
2782
+ cacheId: n.cacheId,
2783
+ part: f.fromJSON(n.part, e)
2784
+ });
2785
+ }
2697
2786
  }
2698
- this._updateState({ lastId: c }), e.view.activeSheetId = o ?? s, this.setView(new Q({ json: e.view })), this._adjustSheetNamesIfRequired(), this._listenerProtection?.();
2699
- let u = this;
2700
- this._protection = new vn(e?.protection, this._options?.readonly), this._listenerProtection = this._protection.addListeners({ onChange: (e) => {
2701
- u._emitter.notify("onProtectionChange", { source: e });
2702
- } }), e.scripts && (this._scripts = this._createScripts(e.scripts)), this._emitter.notify("onLoad");
2787
+ this._pivotCaches = i, this._people.fromJSON(e.people);
2788
+ let o = e.sheets, s = o.length, c = e.view.activeSheetId ?? null;
2789
+ c !== null && (c = Math.min(Math.max(0, c), s - 1));
2790
+ let l = null, u = null;
2791
+ this._isLoadingSheets = !0;
2792
+ for (let e = 0; e < s; e++) {
2793
+ let t = o[e], n = t.visibility || O.Visibility.Visible, r = e;
2794
+ u = r, n === O.Visibility.Visible ? l === null && (l = r) : c !== null && c === r && (c = null);
2795
+ try {
2796
+ this._createSheet(r, t.name, n, e, t.sheetId, t.sheet);
2797
+ } catch (e) {
2798
+ throw this._isLoadingSheets = !1, e;
2799
+ }
2800
+ }
2801
+ this._isLoadingSheets = !1, this._updateState({ lastId: u }), e.view.activeSheetId = c ?? l, this.setView(new qn({ json: e.view })), this._adjustSheetNamesIfRequired(), this._listenerProtection?.();
2802
+ let d = this;
2803
+ this._protection = new Yn(e?.protection, this._options?.readonly), this._listenerProtection = this._protection.addListeners({ onChange: (e) => {
2804
+ d._emitter.notify("onProtectionChange", { source: e });
2805
+ } }), this._emitter.notify("onLoad");
2703
2806
  } finally {
2704
2807
  r.endPersist(), n.endPersist(), t.endPersist();
2705
2808
  }
2706
2809
  }
2707
2810
  _createScripts(e) {
2708
2811
  let t = this;
2709
- return new pn({
2812
+ return new Hn({
2710
2813
  transactions: this._transactions,
2711
2814
  json: e,
2712
2815
  workbook: t,
2713
2816
  getBuiltInFunctions: () => t._calculation?.getFunctions(),
2714
2817
  onAdd: (e, n) => {
2715
2818
  let r = t._calculation;
2716
- r.getStatus() !== Ye.Status.Off && r.start().then(async () => {
2819
+ r.getStatus() !== wt.Status.Off && r.start().then(async () => {
2717
2820
  let e = n.getFunctions().getItems({ type: "formula" }), t = e.length;
2718
2821
  for (let n = 0; n < t; n++) {
2719
2822
  let t = e[n];
2720
2823
  try {
2721
2824
  await this._calculation.getFunctions().add(t);
2722
2825
  } catch (e) {
2723
- z.error(e?.message ?? String(e), e);
2826
+ Bt.error(e?.message ?? String(e), e);
2724
2827
  }
2725
2828
  }
2726
2829
  }).catch(() => {});
@@ -2730,50 +2833,63 @@ var En, Dn, $ = class e extends ge {
2730
2833
  }
2731
2834
  async toJSON(e) {
2732
2835
  if (this._closed) throw Error(H("error.workbook.modelClosed"));
2733
- await Promise.resolve(this._starting), await this._emitter.notify("onBeforeSave", { async: !0 });
2734
- let t = { sheets: [] }, n = e?.ignoreStyles ?? !1;
2735
- if (!n) {
2836
+ await Promise.resolve(this._starting);
2837
+ let t = this.getCalculation();
2838
+ t.getStatus() !== wt.Status.Off && (await t.ready(), await t._whenRequestsSettled?.()), await this._emitter.notify("onBeforeSave", { async: !0 });
2839
+ let n = { sheets: [] }, r = e?.ignoreStyles ?? !1;
2840
+ if (!r) {
2736
2841
  let e = this._theme.toJSON();
2737
- (e ? Object.keys(e).length : 0) > 0 && (t.theme = e);
2842
+ (e ? Object.keys(e).length : 0) > 0 && (n.theme = e);
2738
2843
  }
2739
2844
  if (this._scripts) {
2740
2845
  let e = this._scripts.toJSON();
2741
- e && Object.keys(e).length > 0 && (t.scripts = e);
2846
+ e && Object.keys(e).length > 0 && (n.modules = e);
2742
2847
  }
2743
- this._isDate1904 && (t.date1904 = !0), this._locale && (t.locale = this._locale), this._localeOverrides && (t.localeOverrides = this._localeOverrides);
2744
- let r = e?.ignoreResources ?? !1, i = this._strings.beginPersist(), a = r ? null : this._resources.beginPersist(), o = this._styles.beginPersist();
2848
+ this._isDate1904 && (n.date1904 = !0), this._codeName && (n.codeName = this._codeName), this._updateLinks && (n.updateLinks = this._updateLinks), this._locale && (n.locale = this._locale), this._localeOverrides && (n.localeOverrides = this._localeOverrides);
2849
+ let i = e?.resources ?? "embed", a = i === "ignore", o = this._strings.beginPersist(), s = a ? null : this._resources.beginPersist(), c = this._styles.beginPersist();
2745
2850
  try {
2746
- let s = this._getSheetRef(this.getSelectedSheetIndex()).id, c = s, l = null, u = this._getState(), d = u.sheetRefsAll, f = u.sheetsById, p = d.length;
2747
- for (let n = 0; n < p; n++) {
2748
- let r = d[n], i = n + 1, a = await f.get(r.id).toJSON(e), o = {
2749
- name: r.name,
2750
- sheet: a
2851
+ let t = this._getSheetRef(this.getSelectedSheetIndex()).id, l = t, u = null, d = this._getState(), p = d.sheetRefsAll, m = d.sheetsById, h = p.length;
2852
+ for (let r = 0; r < h; r++) {
2853
+ let i = p[r], a = r + 1, o = await m.get(i.id).toJSON(e), s = {
2854
+ name: i.name,
2855
+ sheet: o
2751
2856
  };
2752
- r.visibility === O.Visibility.Visible ? l === null && (l = i) : o.visibility = r.visibility, r.id === s && (c = i), t.sheets.push(o);
2857
+ i.sheetId !== void 0 && (s.sheetId = i.sheetId), i.visibility === O.Visibility.Visible ? u === null && (u = a) : s.visibility = i.visibility, i.id === t && (l = a), n.sheets.push(s);
2753
2858
  }
2754
- if (!n) {
2755
- let e = o.toJSON();
2756
- e && Object.keys(e).length > 0 && (t.styles = e);
2859
+ if (!r) {
2860
+ let e = c.toJSON();
2861
+ e && Object.keys(e).length > 0 && (n.styles = e);
2757
2862
  }
2758
- let m = this.getProtection().toJSON();
2759
- m && (t.protection = m);
2760
- let h = this._calculation.toJSON();
2761
- Object.keys(h).length > 0 && (t.calc = h);
2762
- let g = await i.toJSONAsync();
2763
- g && g.length > 0 && (t.strings = g);
2764
- let _ = this._externalBooks.toJSON();
2765
- if (_ && (t.externalBooks = _), !r) {
2766
- let e = await a.toJSONAsync();
2767
- e && e.length > 0 && (t.resources = e);
2863
+ let g = this.getProtection().toJSON();
2864
+ g && (n.protection = g);
2865
+ let _ = this._calculation.toJSON();
2866
+ Object.keys(_).length > 0 && (n.calc = _);
2867
+ let v = await o.toJSONAsync();
2868
+ v && v.length > 0 && (n.strings = v);
2869
+ let y = this._calculation.getExternalBooks().toJSON();
2870
+ y && (n.externalBooks = y);
2871
+ let b = this._pivotCaches;
2872
+ if (b.length > 0) {
2873
+ let e = s ? s.toResourceId.bind(s) : () => null, t = [];
2874
+ for (let n = 0; n < b.length; n++) {
2875
+ let r = { cacheId: b[n].cacheId }, i = f.toJSON(b[n].part, e);
2876
+ i && (r.part = i), t.push(r);
2877
+ }
2878
+ t.length > 0 && (n.pivotCaches = t);
2879
+ }
2880
+ let x = this._people.toJSON();
2881
+ if (x && (n.people = x), !a) {
2882
+ let e = await s.toJSONAsync(typeof i == "function" ? i : void 0);
2883
+ e && e.length > 0 && (n.resources = e);
2768
2884
  }
2769
- let v = this._calculation.getNamedFormulas().toJSON();
2770
- v && v.length > 0 && (t.names = v);
2771
- let y = this._view.toJSON();
2772
- y && (c === l ? delete y.activeSheetId : y.activeSheetId = c, Object.keys(y).length > 0 && (t.view = y));
2885
+ let S = this._calculation.getNamedFormulas().toJSON();
2886
+ S && S.length > 0 && (n.names = S);
2887
+ let C = this._view.toJSON();
2888
+ C && (l === u ? delete C.activeSheetId : C.activeSheetId = l, Object.keys(C).length > 0 && (n.view = C));
2773
2889
  } finally {
2774
- o.endPersist(), r || a.endPersist(), i.endPersist();
2890
+ c.endPersist(), a || s.endPersist(), o.endPersist();
2775
2891
  }
2776
- return this._emitter.notify("onSave", { params: t }), t;
2892
+ return this._emitter.notify("onSave", { params: n }), n;
2777
2893
  }
2778
2894
  isClosed() {
2779
2895
  return this._closed;
@@ -2791,7 +2907,7 @@ var En, Dn, $ = class e extends ge {
2791
2907
  } catch (e) {
2792
2908
  console.warn("error on close", e);
2793
2909
  }
2794
- this._ownResources, this._ownNames && this._names.close(), this._ownCalculation && this._calculation.close(), this._ownStyles, this._transactionsRemoveListener?.(), this._listenerLanguage?.(), this._listenerOrigin?.(), this._closed = !0;
2910
+ this._ownResources, this._ownNames && this._names.close(), this._ownCalculation && this._calculation.close(), this._ownStyles, this._transactionsRemoveListener?.(), this._listenerLanguage?.(), this._listenerOrigin?.(), this._listenerOriginProvider?.(), this._ownOriginProvider && this._originProvider instanceof Yt && this._originProvider.release(), this._closed = !0;
2795
2911
  }
2796
2912
  beginCommit(e) {
2797
2913
  if (this._closed) throw Error(H("error.workbook.modelClosed"));
@@ -2836,7 +2952,7 @@ var En, Dn, $ = class e extends ge {
2836
2952
  get isIWorkbook() {
2837
2953
  return !0;
2838
2954
  }
2839
- }, An = { address: null }, jn = class {
2955
+ }, dr = { address: null }, fr = class {
2840
2956
  constructor() {
2841
2957
  this._readFormats = [], this._writeFormats = [], this._encryptions = [];
2842
2958
  }
@@ -2912,9 +3028,9 @@ var En, Dn, $ = class e extends ge {
2912
3028
  return !0;
2913
3029
  });
2914
3030
  }
2915
- }, Mn = (e) => !!e && typeof e == "object" && typeof e.getPath == "function" && typeof e.canWrite == "function", Nn = class {
3031
+ }, pr = /* @__PURE__ */ new WeakMap(), mr = (e) => !!e && typeof e == "object" && typeof e.getPath == "function" && typeof e.canWrite == "function", hr = class {
2916
3032
  constructor() {
2917
- this._setInstalled = /* @__PURE__ */ new WeakSet(), this._backingStore = null, this._emitter = new S(this), this._registry = new jn(), this._defaultStore = new wt(() => this.getWriteFormats(), () => this.getReadFormats());
3033
+ this._setInstalled = /* @__PURE__ */ new WeakSet(), this._backingStore = null, this._emitter = new E(this), this._registry = new fr(), this._defaultStore = new Zt(() => this.getWriteFormats(), () => this.getReadFormats());
2918
3034
  }
2919
3035
  getBackingStore() {
2920
3036
  return this._backingStore ?? this._defaultStore;
@@ -2954,10 +3070,13 @@ var En, Dn, $ = class e extends ge {
2954
3070
  async read(e) {
2955
3071
  let t = null;
2956
3072
  if (typeof e == "string") e = { source: e };
2957
- else if (Mn(e)) {
3073
+ else if (mr(e)) {
2958
3074
  let n = e.getPath();
2959
3075
  if (!n) throw Error("Cannot read from an unbound origin (no path).");
2960
- t = e, e = { source: n };
3076
+ qt(e) ? e = {
3077
+ source: n,
3078
+ asCopy: !0
3079
+ } : (t = e, e = { source: n });
2961
3080
  }
2962
3081
  let n = e ?? {}, { source: r = null, ...i } = n, a = this.getBackingStore();
2963
3082
  return (a.read ? a : this._defaultStore).read({
@@ -2978,16 +3097,18 @@ var En, Dn, $ = class e extends ge {
2978
3097
  ...n,
2979
3098
  ...c === void 0 ? void 0 : s[c]
2980
3099
  };
2981
- delete l.typedCreateWorkbookOptions, delete l.source;
3100
+ delete l.typedCreateWorkbookOptions, delete l.source, delete l.asCopy;
2982
3101
  let u = r ?? new U(t.absolutePath ?? null, {
2983
3102
  name: t.name ?? null,
2984
3103
  format: o.key,
2985
3104
  size: t.size ?? null,
3105
+ lastModified: t.lastModified ?? null,
2986
3106
  canWrite: t.canWrite ?? !1
2987
3107
  });
2988
3108
  r instanceof U && r.update({
2989
3109
  format: o.key,
2990
- size: t.size ?? null
3110
+ size: t.size ?? null,
3111
+ lastModified: t.lastModified ?? null
2991
3112
  }), l.createWorkbookOptions = {
2992
3113
  ...l.createWorkbookOptions || {},
2993
3114
  origin: u
@@ -3026,7 +3147,7 @@ var En, Dn, $ = class e extends ge {
3026
3147
  try {
3027
3148
  return i = await r.decode(e, t), !0;
3028
3149
  } catch (e) {
3029
- if (!(e instanceof ht)) throw e;
3150
+ if (!(e instanceof Rt)) throw e;
3030
3151
  return !1;
3031
3152
  }
3032
3153
  };
@@ -3036,7 +3157,7 @@ var En, Dn, $ = class e extends ge {
3036
3157
  };
3037
3158
  if (!n?.onPassword) {
3038
3159
  let e = t.getName();
3039
- throw new vt(e ? H("error.io.passwordRequired", { name: e }) : H("error.io.passwordRequiredUnnamed"));
3160
+ throw new Ht(e ? H("error.io.passwordRequired", { name: e }) : H("error.io.passwordRequiredUnnamed"));
3040
3161
  }
3041
3162
  let o = await Promise.resolve(n.onPassword({
3042
3163
  origin: t,
@@ -3048,7 +3169,7 @@ var En, Dn, $ = class e extends ge {
3048
3169
  bytes: i,
3049
3170
  password: o
3050
3171
  };
3051
- throw new ht(H("error.io.passwordIncorrect"));
3172
+ throw new Rt(H("error.io.passwordIncorrect"));
3052
3173
  }
3053
3174
  async writeArrayBuffer(e, t) {
3054
3175
  if (!t?.format) throw Error("A format must be specified to write to an ArrayBuffer (e.g. { format: 'xlsx' }).");
@@ -3057,86 +3178,108 @@ var En, Dn, $ = class e extends ge {
3057
3178
  return this._writeArrayBuffer(e, n, t);
3058
3179
  }
3059
3180
  async write(e, t, n) {
3181
+ return typeof t == "string" || mr(t) ? this._write(e, t, !1, n) : this._write(e, e?.getOrigin?.(), !0, t ?? n);
3182
+ }
3183
+ async writeAs(e, t, n) {
3184
+ if (!t) throw Error("A target must be provided for writeAs (use write(workbook) for a plain save).");
3185
+ return this._write(e, t, !0, n);
3186
+ }
3187
+ async _write(e, t, n, r) {
3060
3188
  if (!e) throw Error("Workbook must be provided.");
3061
3189
  if (!e.isIWorkbook) throw Error("Invalid workbook model provided. Must be an instance of IWorkbook.");
3062
- let r = n, i = null;
3063
- typeof t == "string" ? i = this.getOrigin(t) : Mn(t) ? i = t : t && (r = t);
3064
- let a = !i, o = i ?? e.getOrigin(), s = o.getFormat(), c;
3065
- if ((r?.format || s) && (c = (await this._registry.getWriteFormats({ search: r?.format ?? s ?? void 0 }))[0]), c || o.getPath() && o.canWrite() && o.getExtension() || (c = (await this._registry.getWriteFormats({ ext: "sxl" }))[0] ?? (await this._registry.getWriteFormats())[0]), !c) throw new R(H("error.io.writeFormatUnresolved"));
3066
- if (i && typeof t == "string") {
3190
+ let i = typeof t == "string" ? this.getOrigin(t) : t, a = i.getFormat(), o;
3191
+ if ((r?.format || a) && (o = (await this._registry.getWriteFormats({ search: r?.format ?? a ?? void 0 }))[0]), o || i.getPath() && i.canWrite() && i.getExtension() || (o = (await this._registry.getWriteFormats({ ext: "sxl" }))[0] ?? (await this._registry.getWriteFormats())[0]), !o) throw new R(H("error.io.writeFormatUnresolved"));
3192
+ let s = i.getExtension();
3193
+ if (r?.format && s && i.getPath() && i.canWrite() && !o.exts.includes(s)) {
3194
+ let e = (await this._registry.getWriteFormats({ ext: s }))[0];
3195
+ if (e && e.key !== o.key) {
3196
+ let e = i.getPath().split(/[/\\]/).pop();
3197
+ throw new R(H("error.io.writeFormatMismatch", {
3198
+ format: r.format,
3199
+ file: e
3200
+ }));
3201
+ }
3202
+ }
3203
+ if (typeof t == "string") {
3067
3204
  let e = i.getPath();
3068
- e && !x(e) && i.update?.({ path: `${e}.${c.exts[0]}` });
3205
+ i = new U(k(e) ? e : `${e}.${o.exts[0]}`, { format: o.key });
3069
3206
  }
3070
- let l = o.getEncryption(), u = e.getOrigin?.(), d = (o instanceof U ? o.getPassword() : null) ?? (u instanceof U ? u.getPassword() : null), f = o.isEncrypted() || (u?.isEncrypted() ?? !1), p = r?.password === void 0 ? d ?? (f ? void 0 : null) : r.password, m = null;
3071
- if (p === void 0) {
3072
- if (f) {
3073
- let e = o.getName();
3074
- throw new vt(e ? H("error.io.passwordRequiredSave", { name: e }) : H("error.io.passwordRequiredSaveUnnamed"));
3207
+ let c = i.getEncryption(), l = e.getOrigin?.(), u = (i instanceof U ? i.getPassword() : null) ?? (l instanceof U ? l.getPassword() : null), d = i.isEncrypted() || (l?.isEncrypted() ?? !1), f = r?.password === void 0 ? u ?? (d ? void 0 : null) : r.password, p = null;
3208
+ if (f === void 0) {
3209
+ if (d) {
3210
+ let e = i.getName();
3211
+ throw new Ht(e ? H("error.io.passwordRequiredSave", { name: e }) : H("error.io.passwordRequiredSaveUnnamed"));
3075
3212
  }
3076
- } else if (p !== null && (m = await this._registry.getEncryption(l), !m)) throw new R(H("error.io.encryptionUnavailable"));
3077
- let h = `${o.getName() ?? H("workbook.defaultName")}.${c.exts[0]}`, g = r?.progress, _ = !1, v = this, y = null, ee = {
3213
+ } else if (f !== null && (p = await this._registry.getEncryption(c), !p)) throw new R(H("error.io.encryptionUnavailable"));
3214
+ let m = `${i.getName() ?? H("workbook.defaultName")}.${o.exts[0]}`, h = r?.progress, g = !i.getPath() || !i.canWrite() || !!r?.prompt, _ = !1, v = this, y = null, b = [], x = {
3078
3215
  workbook: e,
3079
- format: c,
3080
- origin: o,
3081
- suggestedName: h,
3216
+ format: o,
3217
+ origin: i,
3218
+ suggestedName: m,
3082
3219
  prompt: r?.prompt,
3083
- async encode(t) {
3084
- await (async () => {
3085
- _ || (_ = !0, g?.onStart && await Promise.resolve(g.onStart(o)));
3086
- })(), y = e.getTransactions?.()?.getCurrentCommit() ?? y;
3087
- let n = t ? (await v._registry.getWriteFormats({ search: t }))[0] ?? c : c, i = await v._writeArrayBuffer(e, n, r);
3088
- return m ? m.encode(i, p) : i;
3220
+ async encode(t, a) {
3221
+ let s = a ?? i;
3222
+ await (async (e) => {
3223
+ _ || (_ = !0, h?.onStart && await Promise.resolve(h.onStart(e)));
3224
+ })(s), y = e.getTransactions?.()?.getCurrentCommit() ?? y;
3225
+ let c = t ? (await v._registry.getWriteFormats({ search: t }))[0] ?? o : o, l = [], u = ((e, t) => ({
3226
+ onStart: e?.onStart ? (t, n) => e.onStart(t, n) : void 0,
3227
+ onProgress: e?.onProgress ? (t, n) => e.onProgress(t, n) : void 0,
3228
+ onError: e?.onError ? (t) => e.onError(t) : void 0,
3229
+ onComplete: e?.onComplete ? (t) => e.onComplete(t) : void 0,
3230
+ onWarning: (n, r) => {
3231
+ t.push({
3232
+ message: n ?? "",
3233
+ context: r
3234
+ }), e?.onWarning?.(n, r);
3235
+ }
3236
+ }))(h, l), d = await v._writeArrayBuffer(e, c, {
3237
+ ...r,
3238
+ progress: u
3239
+ }), m = pr.get(s);
3240
+ if (l.some((e) => !m?.has(e.message)) && r?.onWarnings) {
3241
+ let t = await Promise.resolve(r.onWarnings({
3242
+ workbook: e,
3243
+ origin: s,
3244
+ warnings: l,
3245
+ save: n,
3246
+ canCancel: !g
3247
+ }));
3248
+ if (!g && !1 === t) return null;
3249
+ }
3250
+ return b = l, p ? p.encode(d, f) : d;
3089
3251
  }
3090
- }, b = null;
3252
+ }, S = null;
3091
3253
  try {
3092
3254
  let t = this.getBackingStore();
3093
3255
  if (!t.write) throw Error("The active backing store is read-only (no write implementation).");
3094
- if (b = await t.write(ee), b) {
3095
- p !== void 0 && b instanceof U && (b.setPassword(p), b.update({ encryption: m ? m.key : null }));
3256
+ if (S = await t.write(x), S) {
3257
+ if (f !== void 0 && S instanceof U && (S.setPassword(f), S.update({ encryption: p ? p.key : null })), b.length) {
3258
+ let e = pr.get(S) ?? /* @__PURE__ */ new Set();
3259
+ for (let t of b) e.add(t.message);
3260
+ pr.set(S, e);
3261
+ }
3262
+ n && S !== e.getOrigin() && qt(e.getOrigin())?.setOrigin(S);
3096
3263
  let t = y ?? e.getTransactions?.()?.getCurrentCommit() ?? null;
3097
3264
  this._emitter.notify("onWrite", {
3098
3265
  params: {
3099
3266
  workbook: e,
3100
- origin: b,
3267
+ origin: S,
3101
3268
  commitId: t?.getId() ?? null,
3102
- save: a
3269
+ save: n
3103
3270
  },
3104
3271
  transactional: !1
3105
3272
  });
3106
3273
  }
3107
- g?.onComplete && await Promise.resolve(g.onComplete(b));
3274
+ h?.onComplete && await Promise.resolve(h.onComplete(S));
3108
3275
  } catch (e) {
3109
3276
  let t = e instanceof Error ? e : Error(String(e));
3110
- throw g?.onError && await Promise.resolve(g.onError(t)), g?.onComplete && await Promise.resolve(g.onComplete(null)), t instanceof R ? t : Error(H("error.io.writeFailed", { reason: t.message }), { cause: e });
3277
+ throw h?.onError && await Promise.resolve(h.onError(t)), h?.onComplete && await Promise.resolve(h.onComplete(null)), t instanceof R ? t : Error(H("error.io.writeFailed", { reason: t.message }), { cause: e });
3111
3278
  }
3112
- return b;
3113
- }
3114
- async writeAs(e, t, n) {
3115
- if (!t) throw Error("A target must be provided for writeAs (use write(workbook) for a plain save).");
3116
- let r = e?.getOrigin?.();
3117
- if (!(r instanceof U)) return this.write(e, t, n);
3118
- let i = typeof t == "string" ? t : t.getPath(), a = i && x(i)?.toLowerCase() || null, o = a ? (await this._registry.getWriteFormats({ search: a }))[0]?.key ?? a : null, s = {
3119
- path: r.getPath(),
3120
- name: r.getName(),
3121
- format: r.getFormat(),
3122
- canWrite: r.canWrite()
3123
- };
3124
- r.update({
3125
- path: i,
3126
- name: typeof t == "string" ? null : t.getName(),
3127
- format: o,
3128
- canWrite: i != null
3129
- });
3130
- let c = null;
3131
- try {
3132
- c = await this.write(e, void 0, n);
3133
- } finally {
3134
- c || r.update(s);
3135
- }
3136
- return c;
3279
+ return S;
3137
3280
  }
3138
3281
  _stripExtension(e) {
3139
- let t = x(e);
3282
+ let t = k(e);
3140
3283
  return t ? e.slice(0, e.length - t.length - 1) : e;
3141
3284
  }
3142
3285
  _baseName(e) {
@@ -3156,7 +3299,7 @@ var En, Dn, $ = class e extends ge {
3156
3299
  async _readArrayBuffer(e, t, n) {
3157
3300
  if (!e) throw Error("ArrayBuffer must be specified.");
3158
3301
  if (!t) throw Error("format must be specified.");
3159
- if (e.byteLength === 0) return new kn(n?.createWorkbookOptions);
3302
+ if (e.byteLength === 0) return new ur(n?.createWorkbookOptions);
3160
3303
  let r = t.handler;
3161
3304
  if (!r) throw Error(`Unable to resolve a read handler for '${t.key}'.`);
3162
3305
  let i;
@@ -3170,7 +3313,10 @@ var En, Dn, $ = class e extends ge {
3170
3313
  }
3171
3314
  return i;
3172
3315
  }
3173
- }, Pn = new Nn(), Fn = class {
3316
+ get isIWorkbookIO() {
3317
+ return !0;
3318
+ }
3319
+ }, gr = new hr(), _r = class {
3174
3320
  constructor() {
3175
3321
  this._buffer = null, this._formatKey = null;
3176
3322
  }
@@ -3179,13 +3325,13 @@ var En, Dn, $ = class e extends ge {
3179
3325
  }
3180
3326
  async write(e) {
3181
3327
  let t = await e.encode();
3182
- return this._buffer = t, this._formatKey = e.format.key, e.origin;
3328
+ return t ? (this._buffer = t, this._formatKey = e.format.key, e.origin) : null;
3183
3329
  }
3184
3330
  async read(e) {
3185
3331
  return this._buffer ? e.decode(this._buffer, { format: this._formatKey ?? void 0 }) : null;
3186
3332
  }
3187
- }, In = "locales", Ln = "fonts", Rn = [{
3188
- kind: In,
3333
+ }, vr = "locales", yr = "fonts", br = [{
3334
+ kind: vr,
3189
3335
  files: [{
3190
3336
  suffix: ".msg.json",
3191
3337
  async extract(e) {
@@ -3198,7 +3344,7 @@ var En, Dn, $ = class e extends ge {
3198
3344
  place: (e, t) => t ? `${t}/${e}` : null
3199
3345
  }]
3200
3346
  }, {
3201
- kind: Ln,
3347
+ kind: yr,
3202
3348
  files: [
3203
3349
  ".woff2",
3204
3350
  ".woff",
@@ -3210,13 +3356,42 @@ var En, Dn, $ = class e extends ge {
3210
3356
  place: (e, t) => t ? `${t}/${e}` : e
3211
3357
  }))
3212
3358
  }];
3213
- En ||= {}, Dn ||= {};
3214
- var zn, Bn = e({ nowWithPrecision: () => Vn });
3215
- function Vn(e = 6e4) {
3216
- return new Date(Math.floor(Date.now() / e) * e);
3359
+ nr ||= {}, rr ||= {}, (ar = ir ||= {}).PathFill = {
3360
+ Darken: "darken",
3361
+ DarkenLess: "darkenLess",
3362
+ Lighten: "lighten",
3363
+ LightenLess: "lightenLess",
3364
+ None: "none",
3365
+ Normal: "normal"
3366
+ }, ar.PresetGeometry = {
3367
+ Line: "line",
3368
+ LineInv: "lineInv",
3369
+ triangle: "triangle",
3370
+ rtTriangle: "rtTriangle",
3371
+ Rect: "rect"
3372
+ };
3373
+ var Q = null;
3374
+ function xr() {
3375
+ if (!Q) {
3376
+ let e = import("./DDojiE2-oycJ7qGi.mjs").then((e) => e.loadScriptingDeclarations());
3377
+ e.catch(() => {
3378
+ Q = null;
3379
+ }), Q = e;
3380
+ }
3381
+ return Q;
3382
+ }
3383
+ var Sr, $ = null;
3384
+ function Cr() {
3385
+ if (!$) {
3386
+ let e = import("./DDojiE2-oycJ7qGi.mjs").then((e) => e.loadScriptingApi()).then((e) => JSON.parse(e));
3387
+ e.catch(() => {
3388
+ $ = null;
3389
+ }), $ = e;
3390
+ }
3391
+ return $;
3217
3392
  }
3218
- zn ||= {};
3219
- var Hn = class extends Ge {
3393
+ Sr ||= {};
3394
+ var wr = class extends ue {
3220
3395
  constructor(e) {
3221
3396
  super(e);
3222
3397
  }
@@ -3229,8 +3404,8 @@ var Hn = class extends Ge {
3229
3404
  colEnd: (e?.size?.width ?? 5) - 1,
3230
3405
  rowEnd: (e?.size?.height ?? 5) - 1
3231
3406
  },
3232
- getRanges: (e) => null
3407
+ getRanges: (e) => new Me(null)
3233
3408
  }, super._initializeOptions(e);
3234
3409
  }
3235
- }, Un = "0.8.0-beta.1", Wn = "Fri Aug 28 2026";
3236
- export { Fe as AddressUtils, Fn as ArrayBackingStore, Se as AutoFill, Wn as BUILD_DATE, w as Color, Re as Condition, Bn as DateUtils, Nn as DefaultWorkbookIO, gn as ExternalRangeClipboardItem, Ln as FONTS_KIND, Rt as FontUtils, De as GeomUtils, lt as IAnchored, Je as IBorder, Ye as ICalculation, xe as ICell, Qt as ICellHeaderRange, nt as ICellRange, Zt as ICellRanges, C as IColor, de as ICondition, ve as IConditionalFormat, Qe as IDataValidation, Lt as IEffect, i as IFill, k as IFont, kt as IFontCollection, zn as IMovable, Dn as IPicture, En as IPrint, Xt as IResource, O as ISheet, He as ISheetView, Ft as ISort, It as IStroke, ut as IStyle, d as ITableStyle, at as IText, a as ITextFrame, Yt as ITheme, re as IThemeCollection, bt as IWorkbookIO, In as LOCALES_KIND, Ke as LicenseManager, M as NumberFormat, hn as RangeClipboardItem, ee as Registry, ie as Resource, st as ResourceCollection, Rn as SHEETXL_RESOURCE_KINDS, p as SYSTEM_COLOR_CSS_PREFIX, A as Sheet, Ot as SimpleFontFace, Be as Sort, he as StringCollection, ae as StyleCollection, Hn as Table, rt as TextRotation, ct as TextUtils, m as Theme, g as ThemeCollection, l as TransactionConflictError, St as TransactionSaveStateManager, s as TransactionStore, xt as TransactionUndoManager, be as Tuple, Un as VERSION, kn as Workbook, Pn as WorkbookIO, U as WorkbookOrigin, Q as WorkbookView, Jt as builtInStyleNameDisplay, et as createCellRangeCounts, tn as getBuiltInFunctionNames, Ve as getLanguagePack, Te as getLocaleProfile, Ze as localizeBoolean, _e as localizeErrorLabel, ue as makeLocaleProfile, Pe as parseBooleanLocal, tt as parseErrorLocal, nn as parseFormulaLiteral, fe as registerSdkLocales };
3410
+ }, Tr = "0.8.0-beta.2", Er = "2026-09-29T14:42:35.541Z";
3411
+ export { w as AbstractCollection, o as AddressUtils, _r as ArrayBackingStore, lt as AutoFill, Er as BUILD_DATE, Ce as Color, h as Condition, _t as DateUtils, hr as DefaultWorkbookIO, xt as EXTERNAL_LINK_PATH_REL_TYPE, Gn as ExternalRangeClipboardItem, yr as FONTS_KIND, hn as FontUtils, b as FormulaText, te as FunctionDeclarations, Be as GeomUtils, Dt as IAnchored, tt as IBorders, wt as ICalculation, Tt as ICell, kn as ICellHeaderRange, ge as ICellRange, On as ICellRanges, fe as IColor, At as ICondition, me as IConditionalFormat, Ot as IDataValidation, mn as IEffect, we as IFill, N as IFont, nn as IFontCollection, Sr as IMovable, rr as IPicture, nr as IPrint, Dn as IResource, n as IScript, ir as IShape, O as ISheet, jt as ISheetView, fn as ISort, pn as IStroke, C as IStyle, Se as ITable, be as ITableStyle, Xe as IText, r as ITextFrame, En as ITheme, ft as IThemeCollection, Wt as IWorkbookIO, vr as LOCALES_KIND, le as LicenseManager, y as NamedStyleCollection, j as NumberFormat, Wn as RangeClipboardItem, ie as Registry, d as Resource, m as ResourceCollection, br as SHEETXL_RESOURCE_KINDS, Te as SYSTEM_COLOR_CSS_PREFIX, M as Sheet, tn as SimpleFontFace, Ne as Sort, ye as StringCollection, Ze as StyleCollection, wr as Table, xe as TableStyleCollection, ve as TextRotation, Et as TextStacked, p as TextUtils, v as Theme, ee as ThemeCollection, g as TransactionConflictError, Kt as TransactionSaveStateManager, x as TransactionStore, Gt as TransactionUndoManager, De as Tuple, Tr as VERSION, ur as Workbook, gr as WorkbookIO, U as WorkbookOrigin, qn as WorkbookView, Tn as builtInStyleNameDisplay, Pe as createCellRangeCounts, st as externalBookClosedName, ht as externalBookFileName, Je as externalBookLocation, Oe as externalBookOpenName, Mn as getBuiltInFunctionNames, Re as getLanguagePack, he as getLocaleProfile, Ye as getScriptRuntime, Cr as getScriptingApi, xr as getScriptingDeclarations, ut as localizeBoolean, rt as localizeErrorLabel, s as makeLocaleProfile, We as parseBooleanLocal, Ve as parseErrorLocal, ct as parseExternalScope, Nn as parseFormulaLiteral, Fe as registerSdkLocales, vt as sourceEntryFromPath, re as withScriptRuntime };