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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (564) hide show
  1. package/THIRD-PARTY-NOTICES.md +1 -1
  2. package/browser/esm/{B0HS42a7lga1k1U_.mjs → BEAY9XgKNx-bakXW.mjs} +2 -2
  3. package/browser/esm/BbSmt62FpFIpoVzu.mjs +392 -0
  4. package/browser/esm/BcHmrKHwMMOlzc9_.mjs +357 -0
  5. package/browser/esm/BgcZ-CoTbMfmyDJL.mjs +412 -0
  6. package/browser/esm/Bk7xxbdDpa7-sIwd.mjs +7 -0
  7. package/browser/esm/BqskM7wA8oPfFQue.mjs +20 -0
  8. package/browser/esm/Btg43M1Bf-ENDreu.mjs +540 -0
  9. package/browser/esm/BzLfNyc6OOShIErH.mjs +598 -0
  10. package/browser/esm/C9B0djuUarfNdoj0.mjs +466 -0
  11. package/browser/esm/{uyWBMSIxMlt8n5Z3.mjs → CSx9ed1JOs7K5BXO.mjs} +2 -2
  12. package/browser/esm/CYyv6uGjo10ig5FP.mjs +142 -0
  13. package/browser/esm/CZ5oa92wZEAXebgk.mjs +622 -0
  14. package/browser/esm/CdLZWVcH8cncBUPJ.mjs +849 -0
  15. package/browser/esm/Cgd5BnM3hg9RyUel.mjs +171 -0
  16. package/browser/esm/CjsUGJEQSbGjnH6R.mjs +1001 -0
  17. package/browser/esm/ClB5ix51roQOpZEr.mjs +7402 -0
  18. package/browser/esm/{DlPMeIyxT9tG_WDk.mjs → Cqr3knDsBvoVZ6MN.mjs} +179 -202
  19. package/browser/esm/D4uVlrG0xEFctsSM.mjs +905 -0
  20. package/browser/esm/DOMHmhYzPcLVcpAW.mjs +7 -0
  21. package/browser/esm/DUvUK61b2_4pf4tG.mjs +484 -0
  22. package/browser/esm/De175LygU7ot4nQm.mjs +441 -0
  23. package/browser/esm/DhKkrCVASZ6Isvz6.mjs +527 -0
  24. package/browser/esm/Di58Ji1n--3Mgc_2.mjs +607 -0
  25. package/browser/esm/Dtoyt8q5RyGAlxCp.mjs +1141 -0
  26. package/browser/esm/Y79I7Sm8kjaYexhf.mjs +167 -0
  27. package/browser/esm/index.mjs +1472 -1023
  28. package/browser/esm/o8MFgcVXns987D6_.mjs +400 -0
  29. package/browser/esm/zqJOaweiXE9D8RY1.mjs +66681 -0
  30. package/licenses/dependencies.txt +209 -209
  31. package/node/esm/B6D7sSetrcOWLsKj.mjs +1135 -0
  32. package/node/esm/B9ljpEIZg6wOTzRE.mjs +142 -0
  33. package/node/esm/BH1v-E4Ro3bR7Znw.mjs +962 -0
  34. package/node/esm/BN9j8V9gCExMjVtJ.mjs +540 -0
  35. package/node/esm/{Cku7XiUvw1xrRasi.mjs → Bh4dv6tMjXX3X4nI.mjs} +1 -1
  36. package/node/esm/Bqd62L8KFgdS0Vou.mjs +7 -0
  37. package/node/esm/Bsx9uijd4X_SKV3L.mjs +360 -0
  38. package/node/esm/BtuY37FumvLE7EBo.mjs +629 -0
  39. package/node/esm/C6ZXsNyLXI6zA63X.mjs +402 -0
  40. package/node/esm/CCouEwT37f08qO3V.mjs +7 -0
  41. package/node/esm/CD9wbvufChVYYkrI.mjs +451 -0
  42. package/node/esm/CImNvdz1iP-lUlro.mjs +610 -0
  43. package/node/esm/CT0CN82y0_Qgoryk.mjs +7568 -0
  44. package/node/esm/CUQi5ZtMO02nhG0W.mjs +596 -0
  45. package/node/esm/CUUoseJmFsCf82bb.mjs +28 -0
  46. package/node/esm/CnSQ7MTXAUAyBOoS.mjs +911 -0
  47. package/node/esm/D7MfcID2Wf6l6VpC.mjs +171 -0
  48. package/node/esm/DCplLG93GfTs1vNw.mjs +1860 -0
  49. package/node/esm/DHUADiCmxNQS1ARz.mjs +417 -0
  50. package/node/esm/DMD12JUh7HJw2-jl.mjs +638 -0
  51. package/node/esm/DdFgXl-Ux2cMBTs_.mjs +15 -0
  52. package/node/esm/DefYISWfdZJFx57m.mjs +255 -0
  53. package/node/esm/Ds0d8zXzmgOu3MGx.mjs +403 -0
  54. package/node/esm/MiU4rDOiocmJ-9Ry.mjs +1783 -0
  55. package/node/esm/index.mjs +51616 -39665
  56. package/package.json +15 -16
  57. package/resources/contents.json +64 -0
  58. package/resources/fonts/arial-bold-italic.metrics.json +139 -0
  59. package/resources/fonts/arial-bold.metrics.json +139 -0
  60. package/resources/fonts/arial-italic.metrics.json +139 -0
  61. package/resources/fonts/arial-regular.metrics.json +139 -0
  62. package/resources/fonts/calibri-bold-italic.metrics.json +137 -0
  63. package/resources/fonts/calibri-bold.metrics.json +137 -0
  64. package/resources/fonts/calibri-italic.metrics.json +137 -0
  65. package/resources/fonts/calibri-regular.metrics.json +137 -0
  66. package/resources/fonts/cambria-bold-italic.metrics.json +66 -0
  67. package/resources/fonts/cambria-bold.metrics.json +66 -0
  68. package/resources/fonts/cambria-italic.metrics.json +66 -0
  69. package/resources/fonts/cambria-regular.metrics.json +66 -0
  70. package/resources/fonts/contents.json +126 -0
  71. package/resources/fonts/courier-new-bold-italic.metrics.json +143 -0
  72. package/resources/fonts/courier-new-bold.metrics.json +143 -0
  73. package/resources/fonts/courier-new-italic.metrics.json +143 -0
  74. package/resources/fonts/courier-new-regular.metrics.json +143 -0
  75. package/resources/fonts/times-new-roman-bold-italic.metrics.json +141 -0
  76. package/resources/fonts/times-new-roman-bold.metrics.json +141 -0
  77. package/resources/fonts/times-new-roman-italic.metrics.json +143 -0
  78. package/resources/fonts/times-new-roman-regular.metrics.json +141 -0
  79. package/resources/locales/de/model.msg.json +112 -12
  80. package/resources/locales/en/model.msg.json +119 -13
  81. package/types/scripting-api.json +8048 -0
  82. package/types/scripting-enums.json +277 -110
  83. package/types/scripting.d.ts +13077 -3224
  84. package/types/src/anchored/AbstractAnchored.d.ts +18 -8
  85. package/types/src/anchored/AnchoredMap.d.ts +2 -0
  86. package/types/src/anchored/IAnchoredMap.d.ts +52 -4
  87. package/types/src/autoFill/AutoFill.d.ts +316 -32
  88. package/types/src/autoFill/IAutoFill.d.ts +232 -15
  89. package/types/src/border/{IBorder.d.ts → IBorders.d.ts} +42 -41
  90. package/types/src/border/index.d.ts +1 -1
  91. package/types/src/calculation/Calculation.d.ts +754 -49
  92. package/types/src/calculation/ExternalBookBindings.d.ts +118 -0
  93. package/types/src/calculation/FormulaText.d.ts +82 -0
  94. package/types/src/calculation/ICalculation.d.ts +318 -81
  95. package/types/src/calculation/INamedFormulasCollection.d.ts +5 -8
  96. package/types/src/calculation/NamedFormulaCollection.d.ts +139 -107
  97. package/types/src/calculation/NamedLambdaFunction.d.ts +28 -0
  98. package/types/src/calculation/TokenType.d.ts +9 -0
  99. package/types/src/calculation/Types.d.ts +83 -2
  100. package/types/src/calculation/_CloneBoundary.d.ts +80 -0
  101. package/types/src/calculation/_TableRename.d.ts +13 -0
  102. package/types/src/calculation/compiler/ASTTypes.d.ts +71 -0
  103. package/types/src/calculation/compiler/CompilerUtils.d.ts +135 -44
  104. package/types/src/calculation/compiler/FormulaCompiler.d.ts +29 -4
  105. package/types/src/calculation/compiler/FormulaParser.d.ts +1 -2
  106. package/types/src/calculation/compiler/LiteTransform.d.ts +17 -0
  107. package/types/src/calculation/compiler/ParserUtils.d.ts +26 -1
  108. package/types/src/calculation/compiler/SRParser.d.ts +2 -1
  109. package/types/src/calculation/compiler/Types.d.ts +79 -9
  110. package/types/src/calculation/executor/CalcExecutor.d.ts +312 -33
  111. package/types/src/calculation/executor/CalcExecutorUtils.d.ts +43 -2
  112. package/types/src/calculation/executor/CircularReference.d.ts +2 -0
  113. package/types/src/calculation/formula/Formula.d.ts +58 -21
  114. package/types/src/calculation/formula/FormulaBlock.d.ts +125 -23
  115. package/types/src/calculation/formula/FormulaRecordView.d.ts +79 -0
  116. package/types/src/calculation/formula/FunctionValues.d.ts +10 -0
  117. package/types/src/calculation/formula/IFormulaBlock.d.ts +261 -67
  118. package/types/src/calculation/formula/LambdaValue.d.ts +46 -23
  119. package/types/src/calculation/formula/LazyValue.d.ts +96 -0
  120. package/types/src/calculation/formula/TokenUtils.d.ts +25 -1
  121. package/types/src/calculation/formula/index.d.ts +1 -0
  122. package/types/src/calculation/functions/FunctionDeclarations.d.ts +31 -0
  123. package/types/src/calculation/functions/Operators.d.ts +8 -0
  124. package/types/src/calculation/functions/initializeFunctions.d.ts +15 -2
  125. package/types/src/calculation/grid/CalcGrid.d.ts +407 -158
  126. package/types/src/calculation/grid/CalcGridBackend.d.ts +493 -0
  127. package/types/src/calculation/grid/CalcGridProxy.d.ts +133 -0
  128. package/types/src/calculation/grid/CalcGridUtils.d.ts +62 -12
  129. package/types/src/calculation/grid/FormulaEntry.d.ts +129 -0
  130. package/types/src/calculation/grid/FormulaHost.d.ts +239 -0
  131. package/types/src/calculation/grid/ICalcGrid.d.ts +499 -141
  132. package/types/src/calculation/grid/_CalcRequest.d.ts +289 -0
  133. package/types/src/calculation/grid/index.d.ts +4 -0
  134. package/types/src/calculation/index.d.ts +2 -0
  135. package/types/src/calculation/spatial/ContentfulSpatialValue.d.ts +6 -2
  136. package/types/src/calculation/spatial/FormulaSpatialValue.d.ts +339 -11
  137. package/types/src/calculation/spatial/SpillEntry.d.ts +20 -5
  138. package/types/src/calculation/spatial/TouchedWindows.d.ts +86 -0
  139. package/types/src/calculation/spatial/index.d.ts +1 -0
  140. package/types/src/calculation/state/CalcInputs.d.ts +41 -0
  141. package/types/src/calculation/state/CalcNode.d.ts +141 -30
  142. package/types/src/calculation/state/CalcScope.d.ts +37 -0
  143. package/types/src/calculation/state/CalcState.d.ts +22 -1
  144. package/types/src/calculation/state/CalculationContext.d.ts +50 -3
  145. package/types/src/calculation/state/IContextContainer.d.ts +129 -27
  146. package/types/src/calculation/state/_PendingOverlayGrid.d.ts +163 -0
  147. package/types/src/calculation/state/_ReadObservedGrid.d.ts +74 -8
  148. package/types/src/calculation/state/index.d.ts +1 -0
  149. package/types/src/calculation/symbol/ExternalSheetSymbols.d.ts +80 -0
  150. package/types/src/calculation/symbol/ISymbolRegistry.d.ts +23 -0
  151. package/types/src/calculation/symbol/IndirectSymbolProvider.d.ts +16 -2
  152. package/types/src/calculation/symbol/SheetSymbolProvider.d.ts +63 -3
  153. package/types/src/calculation/symbol/SymbolRegistry.d.ts +20 -0
  154. package/types/src/calculation/symbol/index.d.ts +3 -2
  155. package/types/src/cell/ICell.d.ts +104 -29
  156. package/types/src/cell/ICellHeader.d.ts +24 -2
  157. package/types/src/cell/ICellProtection.d.ts +50 -10
  158. package/types/src/cellRange/ICellRange.d.ts +419 -79
  159. package/types/src/cellRange/ICellRanges.d.ts +23 -21
  160. package/types/src/chart/Chart.d.ts +41 -13
  161. package/types/src/chart/ChartCollection.d.ts +26 -0
  162. package/types/src/chart/IChart.d.ts +166 -12
  163. package/types/src/chart/IChartCollection.d.ts +25 -0
  164. package/types/src/chart/_ChartXml.d.ts +70 -0
  165. package/types/src/chart/index.d.ts +1 -3
  166. package/types/src/collections/ArraysGrid.d.ts +1 -1
  167. package/types/src/collections/IGrid.d.ts +1 -1
  168. package/types/src/collections/ISparseGrid.d.ts +9 -0
  169. package/types/src/collections/ISpatialMap.d.ts +59 -21
  170. package/types/src/collections/ImmutableList.d.ts +28 -0
  171. package/types/src/collections/MixedTypedArrayList.d.ts +168 -108
  172. package/types/src/collections/OverlappingRangeIterator.d.ts +13 -17
  173. package/types/src/collections/RepeatingList.d.ts +7 -0
  174. package/types/src/collections/ScalarGrid.d.ts +50 -0
  175. package/types/src/collections/SparseGrid.d.ts +1 -1
  176. package/types/src/collections/SpatialMap.d.ts +13 -21
  177. package/types/src/collections/Tuple.d.ts +128 -16
  178. package/types/src/collections/_GridUtils.d.ts +19 -6
  179. package/types/src/collections/_RangeSweep.d.ts +97 -0
  180. package/types/src/collections/_SpatialUtils.d.ts +20 -2
  181. package/types/src/collections/index.d.ts +1 -0
  182. package/types/src/color/_BuiltInIndexDefs.d.ts +6 -0
  183. package/types/src/comment/Comment.d.ts +223 -0
  184. package/types/src/comment/CommentCollection.d.ts +40 -0
  185. package/types/src/comment/IComment.d.ts +340 -50
  186. package/types/src/comment/ICommentCollection.d.ts +90 -0
  187. package/types/src/comment/NoteMovable.d.ts +26 -0
  188. package/types/src/comment/_CommentUtils.d.ts +50 -0
  189. package/types/src/comment/_NoteBox.d.ts +50 -0
  190. package/types/src/comment/index.d.ts +1 -0
  191. package/types/src/condition/AnchoredConditional.d.ts +82 -17
  192. package/types/src/condition/BuiltInOperators/AbstractOperator.d.ts +42 -12
  193. package/types/src/condition/BuiltInOperators/AfterEqualToOperator.d.ts +2 -0
  194. package/types/src/condition/BuiltInOperators/AfterOperator.d.ts +2 -0
  195. package/types/src/condition/BuiltInOperators/AndOperator.d.ts +3 -1
  196. package/types/src/condition/BuiltInOperators/AverageOperator.d.ts +2 -0
  197. package/types/src/condition/BuiltInOperators/BeforeEqualToOperator.d.ts +2 -0
  198. package/types/src/condition/BuiltInOperators/BeforeOperator.d.ts +2 -0
  199. package/types/src/condition/BuiltInOperators/BetweenOperator.d.ts +2 -0
  200. package/types/src/condition/BuiltInOperators/ColorOperator.d.ts +4 -0
  201. package/types/src/condition/BuiltInOperators/ContainsOperator.d.ts +2 -0
  202. package/types/src/condition/BuiltInOperators/EndsWithOperator.d.ts +2 -0
  203. package/types/src/condition/BuiltInOperators/EqualToOperator.d.ts +4 -1
  204. package/types/src/condition/BuiltInOperators/ExpressionOperator.d.ts +5 -6
  205. package/types/src/condition/BuiltInOperators/GreaterThanEqualToOperator.d.ts +2 -0
  206. package/types/src/condition/BuiltInOperators/GreaterThanOperator.d.ts +2 -0
  207. package/types/src/condition/BuiltInOperators/IconOperator.d.ts +4 -0
  208. package/types/src/condition/BuiltInOperators/InSetOperator.d.ts +22 -5
  209. package/types/src/condition/BuiltInOperators/LessThanEqualToOperator.d.ts +2 -0
  210. package/types/src/condition/BuiltInOperators/LessThanOperator.d.ts +2 -0
  211. package/types/src/condition/BuiltInOperators/NotOperator.d.ts +2 -0
  212. package/types/src/condition/BuiltInOperators/OrOperator.d.ts +3 -1
  213. package/types/src/condition/BuiltInOperators/StartsWithOperator.d.ts +2 -0
  214. package/types/src/condition/BuiltInOperators/TimePeriodOperator.d.ts +2 -0
  215. package/types/src/condition/BuiltInOperators/TopNOperator.d.ts +6 -0
  216. package/types/src/condition/BuiltinSelectors/BaseSelector.d.ts +21 -6
  217. package/types/src/condition/BuiltinSelectors/DateSelector.d.ts +4 -5
  218. package/types/src/condition/BuiltinSelectors/DisplaySelector.d.ts +20 -0
  219. package/types/src/condition/BuiltinSelectors/TextLengthSelector.d.ts +7 -5
  220. package/types/src/condition/BuiltinSelectors/TimeSelector.d.ts +3 -5
  221. package/types/src/condition/BuiltinSelectors/WholeSelector.d.ts +3 -5
  222. package/types/src/condition/BuiltinSelectors/index.d.ts +12 -6
  223. package/types/src/condition/Condition.d.ts +19 -1
  224. package/types/src/condition/ICondition.d.ts +293 -73
  225. package/types/src/condition/_ConditionFormula.d.ts +152 -0
  226. package/types/src/condition/_ConditionUtils.d.ts +167 -13
  227. package/types/src/conditionalFormat/ConditionalEntry.d.ts +3 -3
  228. package/types/src/conditionalFormat/ConditionalFormat.d.ts +25 -14
  229. package/types/src/conditionalFormat/ConditionalFormatCollection.d.ts +19 -8
  230. package/types/src/conditionalFormat/IConditionalFormat.d.ts +12 -10
  231. package/types/src/conditionalFormat/IConditionalFormatCollection.d.ts +2 -0
  232. package/types/src/dataValidation/DataValidation.d.ts +69 -3
  233. package/types/src/dataValidation/DataValidationCollection.d.ts +20 -9
  234. package/types/src/dataValidation/IDataValidation.d.ts +149 -30
  235. package/types/src/dataValidation/IDataValidationCollection.d.ts +10 -2
  236. package/types/src/date/DateUtils.d.ts +20 -0
  237. package/types/src/date/_DateUtils.d.ts +91 -7
  238. package/types/src/externalBook/ExternalBookCollection.d.ts +145 -12
  239. package/types/src/externalBook/ExternalBookName.d.ts +96 -0
  240. package/types/src/externalBook/IExternalBook.d.ts +170 -18
  241. package/types/src/externalBook/IExternalBookCollection.d.ts +79 -7
  242. package/types/src/externalBook/index.d.ts +1 -0
  243. package/types/src/{lib/file → file}/file.browser.d.ts +22 -8
  244. package/types/src/{lib/file → file}/file.node.d.ts +7 -2
  245. package/types/src/fill/IEffect.d.ts +5 -5
  246. package/types/src/fill/IFill.d.ts +123 -78
  247. package/types/src/fill/IStroke.d.ts +190 -64
  248. package/types/src/fill/RectAlignment.d.ts +20 -0
  249. package/types/src/fill/_Fills.d.ts +187 -0
  250. package/types/src/fill/_Stroke.d.ts +89 -0
  251. package/types/src/fill/index.d.ts +1 -0
  252. package/types/src/filter/IFilter.d.ts +188 -5
  253. package/types/src/font/AdvanceBuilder.d.ts +25 -0
  254. package/types/src/font/AdvanceTable.d.ts +114 -0
  255. package/types/src/font/FontCollection.d.ts +57 -0
  256. package/types/src/font/IFont.d.ts +17 -0
  257. package/types/src/font/IFontCollection.d.ts +120 -22
  258. package/types/src/font/TableFileAdvanceBuilder.d.ts +27 -0
  259. package/types/src/font/_BuiltinFontTables.d.ts +10 -0
  260. package/types/src/font/index.d.ts +4 -1
  261. package/types/src/group/Group.d.ts +136 -0
  262. package/types/src/group/GroupMovableCollection.d.ts +37 -0
  263. package/types/src/group/IGroup.d.ts +129 -0
  264. package/types/src/group/index.d.ts +2 -0
  265. package/types/src/history/IHistory.d.ts +3 -2
  266. package/types/src/hyperlink/IHyperlink.d.ts +13 -0
  267. package/types/src/hyperlink/_Hyperlink.d.ts +5 -1
  268. package/types/src/i18n/LanguagePack.d.ts +12 -4
  269. package/types/src/index.d.ts +5 -0
  270. package/types/src/io/AbstractBackingStore.d.ts +24 -1
  271. package/types/src/io/ArrayBackingStore.d.ts +1 -1
  272. package/types/src/io/EmbeddedPart.d.ts +20 -0
  273. package/types/src/io/IEmbeddedPart.d.ts +63 -0
  274. package/types/src/io/IWorkbookIO.d.ts +185 -18
  275. package/types/src/io/WorkbookIO.d.ts +9 -0
  276. package/types/src/io/WorkbookOrigin.d.ts +20 -11
  277. package/types/src/io/WorkbookOriginProvider.d.ts +46 -0
  278. package/types/src/io/_XmlFragment.d.ts +49 -0
  279. package/types/src/io/index.d.ts +1 -0
  280. package/types/src/license/LicenseDetails.d.ts +1 -0
  281. package/types/src/license/LicenseManager.d.ts +4 -1
  282. package/types/src/license/Types.d.ts +38 -0
  283. package/types/src/license/_Utils.d.ts +22 -0
  284. package/types/src/license/details.d.ts +24 -0
  285. package/types/src/license/license-key.d.ts +49 -2
  286. package/types/src/license/runtime.browser.d.ts +41 -0
  287. package/types/src/{lib/utils/utils.node.d.ts → license/runtime.node.d.ts} +9 -12
  288. package/types/src/listener/IListener.d.ts +12 -7
  289. package/types/src/listener/ListenerEmitter.d.ts +46 -5
  290. package/types/src/model/AbstractModel.d.ts +14 -5
  291. package/types/src/movable/AbstractMovableContent.d.ts +182 -0
  292. package/types/src/movable/CustomElement.d.ts +4 -5
  293. package/types/src/movable/ErrorContent.d.ts +49 -0
  294. package/types/src/movable/FormControl.d.ts +285 -0
  295. package/types/src/movable/GroupMember.d.ts +87 -0
  296. package/types/src/movable/ICustomElement.d.ts +7 -2
  297. package/types/src/movable/IErrorContent.d.ts +23 -0
  298. package/types/src/movable/IFormControl.d.ts +455 -0
  299. package/types/src/movable/IMovable.d.ts +378 -46
  300. package/types/src/movable/IMovableCollection.d.ts +63 -3
  301. package/types/src/movable/Movable.d.ts +149 -49
  302. package/types/src/movable/MovableCollection.d.ts +15 -8
  303. package/types/src/movable/MovableContentRegistry.d.ts +113 -0
  304. package/types/src/movable/_BuiltInContents.d.ts +14 -0
  305. package/types/src/movable/_ContentFactory.d.ts +35 -0
  306. package/types/src/movable/_DrawnBounds.d.ts +37 -0
  307. package/types/src/movable/_InsertableCollection.d.ts +28 -0
  308. package/types/src/movable/_MovableUtils.d.ts +5 -0
  309. package/types/src/movable/_PendingContent.d.ts +25 -0
  310. package/types/src/movable/_PlacementUtils.d.ts +55 -0
  311. package/types/src/movable/_RotatedFrame.d.ts +20 -0
  312. package/types/src/movable/index.d.ts +7 -1
  313. package/types/src/named/AbstractNamed.d.ts +1 -1
  314. package/types/src/named/INamed.d.ts +4 -1
  315. package/types/src/named/INamedCollection.d.ts +26 -0
  316. package/types/src/named/NamedCollection.d.ts +16 -15
  317. package/types/src/numFmt/BuiltInFormats.d.ts +20 -7
  318. package/types/src/numFmt/IFormatEngine.d.ts +2 -0
  319. package/types/src/numFmt/NumfmtFormatEngine.d.ts +2 -0
  320. package/types/src/numFmt/_FormatCell.d.ts +11 -2
  321. package/types/src/numFmt/_NumFmtUtils.d.ts +0 -1
  322. package/types/src/numFmt/vendor/numfmt/_sheetxl.d.ts +6 -0
  323. package/types/src/outline/IOutline.d.ts +186 -0
  324. package/types/src/outline/Outline.d.ts +157 -0
  325. package/types/src/outline/index.d.ts +2 -0
  326. package/types/src/person/IPerson.d.ts +99 -0
  327. package/types/src/person/IPersonCollection.d.ts +51 -0
  328. package/types/src/person/Person.d.ts +32 -0
  329. package/types/src/person/PersonCollection.d.ts +49 -0
  330. package/types/src/person/index.d.ts +4 -0
  331. package/types/src/picture/IPicture.d.ts +33 -3
  332. package/types/src/picture/Picture.d.ts +33 -13
  333. package/types/src/pivot/IPivotTable.d.ts +72 -0
  334. package/types/src/pivot/IPivotTableCollection.d.ts +25 -0
  335. package/types/src/pivot/PivotCache.d.ts +34 -0
  336. package/types/src/pivot/PivotTable.d.ts +61 -0
  337. package/types/src/pivot/PivotTableCollection.d.ts +25 -0
  338. package/types/src/pivot/_PivotXml.d.ts +24 -0
  339. package/types/src/pivot/index.d.ts +6 -0
  340. package/types/src/primitives/CompositeRangeStats.d.ts +2 -0
  341. package/types/src/primitives/Criteria.d.ts +1 -1
  342. package/types/src/primitives/Grouping.d.ts +65 -0
  343. package/types/src/primitives/LambdaBrand.d.ts +26 -0
  344. package/types/src/primitives/PrimitiveUtils.d.ts +56 -19
  345. package/types/src/primitives/Range.d.ts +133 -25
  346. package/types/src/primitives/RangeStats.d.ts +30 -2
  347. package/types/src/primitives/ReferenceRange.d.ts +44 -0
  348. package/types/src/primitives/Runtime.d.ts +15 -2
  349. package/types/src/primitives/environment.browser.d.ts +9 -0
  350. package/types/src/primitives/environment.node.d.ts +10 -0
  351. package/types/src/primitives/stats/AggregateStats.d.ts +49 -15
  352. package/types/src/primitives/stats/Cancellation.d.ts +13 -0
  353. package/types/src/primitives/stats/FrequencyStats.d.ts +10 -1
  354. package/types/src/primitives/stats/LookupIndex.d.ts +46 -0
  355. package/types/src/primitives/stats/Ranked.d.ts +1 -1
  356. package/types/src/primitives/stats/SortedNumbers.d.ts +4 -2
  357. package/types/src/primitives/stats/index.d.ts +1 -0
  358. package/types/src/print/IPrint.d.ts +0 -22
  359. package/types/src/protectedRange/IProtectedRange.d.ts +4 -0
  360. package/types/src/protectedRange/IProtectedRangeCollection.d.ts +2 -0
  361. package/types/src/protectedRange/ProtectedRange.d.ts +1 -4
  362. package/types/src/protectedRange/ProtectedRangeCollection.d.ts +19 -8
  363. package/types/src/protection/DefaultProtection.d.ts +12 -1
  364. package/types/src/protection/IProtection.d.ts +36 -2
  365. package/types/src/reference/ReferenceUtils.d.ts +80 -0
  366. package/types/src/reference/index.d.ts +2 -0
  367. package/types/src/resource/IResource.d.ts +21 -1
  368. package/types/src/resource/IResourceCollection.d.ts +9 -1
  369. package/types/src/resource/ResourceCollection.d.ts +6 -6
  370. package/types/src/scripting/FunctionCollection.d.ts +49 -15
  371. package/types/src/scripting/IFunctionCollection.d.ts +62 -32
  372. package/types/src/scripting/IModule.d.ts +25 -0
  373. package/types/src/scripting/IModuleCollection.d.ts +17 -0
  374. package/types/src/scripting/IScript.d.ts +28 -26
  375. package/types/src/scripting/Module.d.ts +34 -6
  376. package/types/src/scripting/ModuleCollection.d.ts +17 -12
  377. package/types/src/scripting/Runtime.d.ts +15 -0
  378. package/types/src/scripting/Scripts.d.ts +3 -7
  379. package/types/src/scripting/TypedFunction.d.ts +154 -18
  380. package/types/src/scripting/_FunctionIndex.d.ts +8 -3
  381. package/types/src/scripting/_ModuleUtils.d.ts +11 -1
  382. package/types/src/scripting/_ScriptUtils.d.ts +3 -0
  383. package/types/src/scripting/declarations.browser.d.ts +10 -0
  384. package/types/src/scripting/declarations.d.ts +49 -0
  385. package/types/src/scripting/declarations.node.d.ts +9 -0
  386. package/types/src/scripting/index.d.ts +3 -0
  387. package/types/src/selection/IMovableSelection.d.ts +148 -0
  388. package/types/src/selection/IRangeSelection.d.ts +9 -4
  389. package/types/src/selection/MovableSelection.d.ts +48 -0
  390. package/types/src/selection/RangeSelection.d.ts +15 -0
  391. package/types/src/selection/index.d.ts +1 -0
  392. package/types/src/shape/GeometryPreset.d.ts +197 -0
  393. package/types/src/shape/IGeometry.d.ts +380 -0
  394. package/types/src/shape/IShape.d.ts +341 -194
  395. package/types/src/shape/IShapeStyle.d.ts +135 -0
  396. package/types/src/shape/Shape.d.ts +107 -21
  397. package/types/src/shape/ShapeStyleUtils.d.ts +54 -0
  398. package/types/src/shape/_ConnectorFrame.d.ts +32 -0
  399. package/types/src/shape/_ConnectorRoute.d.ts +33 -0
  400. package/types/src/shape/_Connectors.d.ts +108 -0
  401. package/types/src/shape/_Geometry.d.ts +14 -0
  402. package/types/src/shape/_GeometryLoader.d.ts +21 -0
  403. package/types/src/shape/_ShapeStyle.d.ts +70 -0
  404. package/types/src/shape/_builtIn/_BuiltInChunks.d.ts +10 -0
  405. package/types/src/shape/_builtIn/_BuiltInDef.d.ts +9 -0
  406. package/types/src/shape/_builtIn/arrows.d.ts +6 -0
  407. package/types/src/shape/_builtIn/basic.d.ts +6 -0
  408. package/types/src/shape/_builtIn/callouts.d.ts +6 -0
  409. package/types/src/shape/_builtIn/flowchart.d.ts +6 -0
  410. package/types/src/shape/_builtIn/lines.d.ts +6 -0
  411. package/types/src/shape/_builtIn/math.d.ts +6 -0
  412. package/types/src/shape/_builtIn/other.d.ts +6 -0
  413. package/types/src/shape/_builtIn/rectangles.d.ts +6 -0
  414. package/types/src/shape/_builtIn/starsBanners.d.ts +6 -0
  415. package/types/src/shape/geometry/_strokeEnds.d.ts +7 -0
  416. package/types/src/shape/geometry/format.d.ts +3 -0
  417. package/types/src/shape/geometry/geometry.d.ts +85 -0
  418. package/types/src/shape/geometry/guides.d.ts +54 -0
  419. package/types/src/shape/geometry/handles.d.ts +14 -0
  420. package/types/src/shape/geometry/index.d.ts +7 -0
  421. package/types/src/shape/geometry/lineEnds.d.ts +54 -0
  422. package/types/src/shape/geometry/paths.d.ts +35 -0
  423. package/types/src/shape/geometry/segments.d.ts +114 -0
  424. package/types/src/shape/index.d.ts +3 -0
  425. package/types/src/sheet/CellRegion.d.ts +6 -0
  426. package/types/src/sheet/ICellContainerOptions.d.ts +50 -0
  427. package/types/src/sheet/ISheet.d.ts +197 -50
  428. package/types/src/sheet/ISheetCollection.d.ts +2 -5
  429. package/types/src/sheet/NamedCellRange.d.ts +16 -7
  430. package/types/src/sheet/NamedRange.d.ts +8 -0
  431. package/types/src/sheet/Sheet.d.ts +915 -138
  432. package/types/src/sheet/SheetCell.d.ts +92 -32
  433. package/types/src/sheet/SheetCollection.d.ts +19 -8
  434. package/types/src/sheet/SheetRange.d.ts +90 -18
  435. package/types/src/sheet/SheetRanges.d.ts +22 -9
  436. package/types/src/sheet/_CellBuffer.d.ts +214 -0
  437. package/types/src/sheet/_HeldFormula.d.ts +69 -0
  438. package/types/src/sheet/_InvalidSheetRange.d.ts +7 -7
  439. package/types/src/sheet/_ListenerAnchor.d.ts +104 -0
  440. package/types/src/sheet/_RangeStateSweep.d.ts +16 -0
  441. package/types/src/sheet/_ScalarListFactory.d.ts +61 -0
  442. package/types/src/sheet/_SheetAutoFillUtils.d.ts +74 -0
  443. package/types/src/sheet/_SheetAutoFitUtils.d.ts +2 -2
  444. package/types/src/sheet/_SheetEvents.d.ts +43 -0
  445. package/types/src/sheet/_SheetFilterUtils.d.ts +49 -1
  446. package/types/src/sheet/_SheetIntents.d.ts +296 -0
  447. package/types/src/sheet/_SheetMutations.d.ts +182 -62
  448. package/types/src/sheet/_SheetStateReader.d.ts +19 -13
  449. package/types/src/sheet/_SheetStateTypes.d.ts +83 -78
  450. package/types/src/sheet/_SheetUtils.d.ts +39 -22
  451. package/types/src/sheet/_WatchAnchor.d.ts +93 -0
  452. package/types/src/sheet/spatial/HeldFormulaEntry.d.ts +36 -0
  453. package/types/src/sheet/spatial/index.d.ts +1 -0
  454. package/types/src/sheet/style/SheetCellStyle.d.ts +209 -304
  455. package/types/src/sheet/style/SheetDirectStyle.d.ts +30 -19
  456. package/types/src/sheet/style/SheetNamedStyle.d.ts +17 -17
  457. package/types/src/sheet/style/SheetTableStyle.d.ts +5 -5
  458. package/types/src/sheet/style/_Resolvers.d.ts +14 -8
  459. package/types/src/sheet/style/_StyleUtils.d.ts +38 -8
  460. package/types/src/sheetHeader/ISheetHeader.d.ts +94 -53
  461. package/types/src/sheetHeader/SheetCellHeader.d.ts +4 -0
  462. package/types/src/sheetHeader/SheetHeader.d.ts +42 -22
  463. package/types/src/sheetHeader/_HeaderMetrics.d.ts +37 -0
  464. package/types/src/sheetHeader/_HeaderUtils.d.ts +5 -3
  465. package/types/src/sheetProtection/ISheetProtection.d.ts +41 -7
  466. package/types/src/sheetProtection/SheetProtection.d.ts +12 -0
  467. package/types/src/sheetView/ISheetView.d.ts +69 -15
  468. package/types/src/sheetView/SheetView.d.ts +20 -11
  469. package/types/src/slicer/ISlicer.d.ts +304 -17
  470. package/types/src/slicer/ISlicerStyle.d.ts +109 -0
  471. package/types/src/slicer/Slicer.d.ts +128 -13
  472. package/types/src/slicer/SlicerStyle.d.ts +25 -0
  473. package/types/src/slicer/_BuiltInSlicerStyles.d.ts +13 -0
  474. package/types/src/slicer/_SlicerUtils.d.ts +30 -0
  475. package/types/src/slicer/index.d.ts +1 -0
  476. package/types/src/sort/ISort.d.ts +4 -2
  477. package/types/src/string/IStringCollection.d.ts +5 -0
  478. package/types/src/string/StringCollection.d.ts +6 -6
  479. package/types/src/style/{IStyle.d.ts → ICellStyle.d.ts} +72 -52
  480. package/types/src/style/INamedStyleCollection.d.ts +72 -0
  481. package/types/src/style/ISlicerStyleCollection.d.ts +77 -0
  482. package/types/src/style/IStyleCollection.d.ts +91 -60
  483. package/types/src/style/ITableStyleCollection.d.ts +89 -0
  484. package/types/src/style/NamedStyleCollection.d.ts +39 -0
  485. package/types/src/style/SlicerStyleCollection.d.ts +46 -0
  486. package/types/src/style/StyleCollection.d.ts +81 -26
  487. package/types/src/style/TableStyleCollection.d.ts +49 -0
  488. package/types/src/style/_BuiltInStyleDefs.d.ts +6 -6
  489. package/types/src/style/_BuiltInStyleNames.d.ts +2 -2
  490. package/types/src/style/index.d.ts +7 -1
  491. package/types/src/table/AnchoredTable.d.ts +701 -72
  492. package/types/src/table/AutoTable.d.ts +7 -5
  493. package/types/src/table/ITable.d.ts +261 -34
  494. package/types/src/table/ITableCollection.d.ts +12 -0
  495. package/types/src/table/ITableStyle.d.ts +37 -37
  496. package/types/src/table/TableCollection.d.ts +19 -8
  497. package/types/src/table/_FilterField.d.ts +19 -6
  498. package/types/src/table/_NamedTable.d.ts +17 -1
  499. package/types/src/table/_NamedTableSource.d.ts +1 -0
  500. package/types/src/table/_SortField.d.ts +2 -0
  501. package/types/src/table/_TableColumn.d.ts +13 -2
  502. package/types/src/table/_TableMessages.d.ts +1 -0
  503. package/types/src/table/_TableUtils.d.ts +40 -0
  504. package/types/src/text/Bullet.d.ts +4 -0
  505. package/types/src/text/IText.d.ts +182 -0
  506. package/types/src/text/ITextFrame.d.ts +110 -1
  507. package/types/src/text/TextBoxAlignment.d.ts +25 -16
  508. package/types/src/text/TextFrame.d.ts +4 -0
  509. package/types/src/text/TextLine.d.ts +4 -0
  510. package/types/src/text/TextParagraph.d.ts +4 -0
  511. package/types/src/text/TextRotation.d.ts +3 -3
  512. package/types/src/text/TextRun.d.ts +9 -0
  513. package/types/src/text/TextStacked.d.ts +83 -0
  514. package/types/src/text/index.d.ts +1 -0
  515. package/types/src/text/richtext/IRichText.d.ts +36 -0
  516. package/types/src/text/richtext/IStyledFont.d.ts +18 -18
  517. package/types/src/text/richtext/index.d.ts +1 -0
  518. package/types/src/theme/ITheme.d.ts +45 -4
  519. package/types/src/theme/IThemeCollection.d.ts +2 -0
  520. package/types/src/theme/ThemeCollection.d.ts +11 -7
  521. package/types/src/theme/_OfficeFormatScheme.d.ts +3 -0
  522. package/types/src/transaction/ITransaction.d.ts +258 -45
  523. package/types/src/transaction/Transaction.d.ts +101 -11
  524. package/types/src/transaction/TransactionUndoManager.d.ts +4 -1
  525. package/types/src/type/AbstractCollection.d.ts +101 -0
  526. package/types/src/type/ICollection.d.ts +117 -0
  527. package/types/src/type/ITypes.d.ts +9 -7
  528. package/types/src/type/index.d.ts +1 -0
  529. package/types/src/utils/_CSSUtils.d.ts +3 -3
  530. package/types/src/wasm/_sdkWasm.d.ts +7 -0
  531. package/types/src/wasm/index.d.ts +2 -0
  532. package/types/src/wasm/sdkWasm.d.ts +29 -0
  533. package/types/src/workbook/IWorkbook.d.ts +180 -40
  534. package/types/src/workbook/Workbook.d.ts +123 -10
  535. package/types/src/workbook/_WorkbookIntents.d.ts +36 -0
  536. package/types/src/workbookProtection/IWorkbookProtection.d.ts +7 -0
  537. package/types/src/workbookProtection/WorkbookProtection.d.ts +3 -0
  538. package/types/src/workbookView/IWorkbookView.d.ts +12 -0
  539. package/types/src/workbookView/WorkbookView.d.ts +5 -0
  540. package/browser/cjs/B7_pDFYCVzt-3hUs.cjs +0 -1
  541. package/browser/cjs/BatsV2UUraVDCRXm.cjs +0 -57
  542. package/browser/cjs/CUz53T65cRGQRgvv.cjs +0 -33
  543. package/browser/cjs/DU0kYUtdFa3jK-im.cjs +0 -1
  544. package/browser/cjs/Dv3x6zut1ZRUt3IF.cjs +0 -10
  545. package/browser/cjs/Dv4yIPLV98M5zLHa.cjs +0 -1
  546. package/browser/cjs/a0Z-SXs_N71CtqYb.cjs +0 -1
  547. package/browser/cjs/index.cjs +0 -3
  548. package/browser/esm/6JKSOvc5czaQB2Bj.mjs +0 -109
  549. package/browser/esm/BtuJ9AGzeURtAsGo.mjs +0 -51241
  550. package/browser/esm/DGU6sM25u0EWCKl1.mjs +0 -824
  551. package/browser/esm/f2G3QRgEbvFJcoa2.mjs +0 -4436
  552. package/node/esm/-pxdn3M3tc6PLHs7.mjs +0 -114
  553. package/node/esm/0n5bslM9jhO1JnI2.mjs +0 -843
  554. package/types/src/cellRange/_GraphNode.d.ts +0 -38
  555. package/types/src/condition/BuiltinSelectors/ListSelector.d.ts +0 -12
  556. package/types/src/dataValidation/_Utils.d.ts +0 -10
  557. package/types/src/lib/utils/_Utils.d.ts +0 -27
  558. package/types/src/lib/utils/utils.browser.d.ts +0 -33
  559. package/types/src/movable/IGroup.d.ts +0 -30
  560. package/types/src/movable/IMovableSelection.d.ts +0 -49
  561. package/types/src/sheet/listener/RangesListener.d.ts +0 -32
  562. package/types/src/sheet/listener/RangesListenerEntry.d.ts +0 -19
  563. package/types/src/sheet/listener/index.d.ts +0 -3
  564. /package/types/src/{lib/utils → license}/banner.d.ts +0 -0
@@ -1,19 +1,19 @@
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.10
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";
10
- 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";
7
+ import { n as e } from "./BEAY9XgKNx-bakXW.mjs";
8
+ import { a as t, o as n, s as r, t as i } from "./D4uVlrG0xEFctsSM.mjs";
9
+ import { $ as a, $t as o, A as s, An as c, At as l, B as u, Bt as d, C as f, Cn as p, Ct as m, D as h, Dn as g, E as _, En as v, Ft as y, G as b, Gt as x, H as S, Ht as ee, I as te, It as ne, Jt as re, K as ie, Kt as ae, L as oe, Lt as se, M as ce, Mn as le, Mt as ue, N as de, Nn as fe, Nt as pe, O as me, On as he, Pn as ge, Q as _e, Qt as ve, Rt as ye, S as be, Sn as xe, St as Se, T as Ce, Tn as we, U as Te, Ut as Ee, V as De, Vt as Oe, W as ke, Wt as Ae, Xt as je, Yt as Me, Zt as Ne, _ as Pe, _n as Fe, a as C, an as Ie, b as Le, bn as Re, bt as ze, c as Be, cn as Ve, d as He, dn as w, en as Ue, et as We, f as Ge, fn as Ke, g as qe, gn as Je, h as Ye, hn as Xe, i as Ze, in as Qe, j as $e, jn as T, jt as et, k as tt, kn as nt, kt as rt, l as it, ln as at, m as ot, n as st, nn as ct, o as E, on as D, p as lt, pn as ut, qt as dt, r as ft, rn as pt, s as mt, sn as ht, t as gt, tn as _t, u as O, un as vt, vn as yt, vt as bt, w as xt, wn as St, wt as Ct, x as wt, xn as Tt, xt as Et, yn as Dt, yt as Ot, z as kt, zt as At } from "./zqJOaweiXE9D8RY1.mjs";
10
+ import { B as k, F as jt, Gt as Mt, H as Nt, Ht as Pt, I as Ft, Kt as A, L as It, P as Lt, R as Rt, Ut as j, Wt as zt, at as Bt, ct as Vt, it as Ht, lt as M, ot as N, rt as Ut, st as P, tt as Wt, ut as F, z as Gt } from "./ClB5ix51roQOpZEr.mjs";
11
+ import { n as Kt, o as qt, t as Jt } from "./DUvUK61b2_4pf4tG.mjs";
12
+ import { FormulaError as I, ScalarType as L } from "@sheetxl/primitives";
13
+ import { BufferUtils as Yt, CommonUtils as R, CoordUtils as z, DOMUtils as Xt, DefaultLanguagePackService as Zt, ExpectedError as B, InvalidPasswordError as Qt, MimeType as $t, Notifier as V, NullNotAllowedError as en, OutOfBoundsError as H, PasswordRequiredError as tn, ProtectedError as U, UndoManager as nn, loadResource as rn, messageKey as W, t as G } from "@sheetxl/utils";
12
14
  export * from "@sheetxl/primitives";
13
15
  export * from "@sheetxl/utils";
14
- var bt;
15
- bt ||= {};
16
- var xt = class extends yt {
16
+ var an, on = class extends nn {
17
17
  constructor(e, t = 50) {
18
18
  super(t), this._transactions = e, this._floorId = e ? e.getCurrentCommit(!1).getId() : null, this._removeListener = e?.addListener({ onCommitChange: () => this._notifyOnStackChange() });
19
19
  }
@@ -97,6 +97,17 @@ var xt = class extends yt {
97
97
  let e = this._redoCommits().map((e) => e.getDescription());
98
98
  return e.length === 0 && this._repeatOperation !== null && e.push(this._repeatOperation.description), Object.freeze(e);
99
99
  }
100
+ getUndoEntries() {
101
+ return this._undoCommits().map(cn);
102
+ }
103
+ getRedoEntries() {
104
+ let e = this._redoCommits().map(cn);
105
+ return e.length === 0 && this._repeatOperation !== null && e.push({
106
+ description: this._repeatOperation.description,
107
+ author: null,
108
+ meta: sn
109
+ }), Object.freeze(e);
110
+ }
100
111
  addUndoOperation() {
101
112
  throw Error("TransactionUndoManager derives its stack from the commit log; commit a described transaction instead.");
102
113
  }
@@ -106,19 +117,23 @@ var xt = class extends yt {
106
117
  close() {
107
118
  this._removeListener?.();
108
119
  }
109
- }, St = class {
110
- constructor(e, t) {
111
- this._dirty = !1, this._store = e, this._savedCommitId = e.getCurrentCommit()?.getId() ?? null, this._emitter = new S(this);
112
- let n = this;
120
+ }, sn = Object.freeze({}), cn = (e) => ({
121
+ description: e.getDescription(),
122
+ author: e.getAuthor(),
123
+ meta: e.getMeta() ?? sn
124
+ }), ln = class {
125
+ constructor(e, n) {
126
+ this._dirty = !1, this._store = e, this._savedCommitId = e.getCurrentCommit()?.getId() ?? null, this._emitter = new t(this);
127
+ let r = this;
113
128
  this._removeStoreListener = e.addListener({
114
129
  onCommitEnd() {
115
- n._recompute();
130
+ r._recompute();
116
131
  },
117
132
  onCommitChange() {
118
- n._recompute();
133
+ r._recompute();
119
134
  }
120
- }), this._removeCommitListener = t?.addCommitListener({ onCommit(e) {
121
- e.store === n._store && n.markSaved(e.commitId);
135
+ }), this._removeCommitListener = n?.addCommitListener({ onCommit(e) {
136
+ e.store === r._store && r.markSaved(e.commitId);
122
137
  } });
123
138
  }
124
139
  getStore() {
@@ -143,9 +158,11 @@ var xt = class extends yt {
143
158
  close() {
144
159
  this._removeStoreListener?.(), this._removeCommitListener?.(), this._emitter.close();
145
160
  }
146
- }, U = class e {
147
- 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;
161
+ };
162
+ an ||= {};
163
+ var K = class e {
164
+ constructor(n, r = {}) {
165
+ this._password = null, this._emitter = new t(this), this._path = n ?? null, this._name = r.name ?? null, this._format = r.format ?? null, this._size = r.size ?? null, this._lastModified = r.lastModified ?? null, this._canWrite = r.canWrite ?? e._defaultCanWrite(this._path), this._encryption = r.encryption ?? null;
149
166
  }
150
167
  static _defaultCanWrite(e) {
151
168
  return !!e && !/^(https?:|data:|blob:)/i.test(e);
@@ -156,7 +173,7 @@ var xt = class extends yt {
156
173
  getName() {
157
174
  if (this._name !== null && this._name !== void 0) return this._name;
158
175
  let e = this._cleanPath();
159
- return e && N(e) || null;
176
+ return e && c(e) || null;
160
177
  }
161
178
  getPath() {
162
179
  return this._path;
@@ -167,7 +184,7 @@ var xt = class extends yt {
167
184
  getExtension() {
168
185
  let e = this._cleanPath();
169
186
  if (!e) return null;
170
- let t = x(e);
187
+ let t = T(e);
171
188
  return t ? t.toLowerCase() : null;
172
189
  }
173
190
  getEncryption() {
@@ -185,6 +202,9 @@ var xt = class extends yt {
185
202
  getSize() {
186
203
  return this._size;
187
204
  }
205
+ getLastModified() {
206
+ return this._lastModified;
207
+ }
188
208
  canWrite() {
189
209
  return this._canWrite;
190
210
  }
@@ -193,7 +213,7 @@ var xt = class extends yt {
193
213
  }
194
214
  update(e) {
195
215
  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;
216
+ 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
217
  }
198
218
  addListeners(e, t) {
199
219
  return this._emitter.addListeners(e, t);
@@ -214,37 +234,59 @@ var xt = class extends yt {
214
234
  ];
215
235
  return `${t} ${(n / 1024 ** r).toFixed(2)}${i[Math.min(r, i.length - 1)]}`;
216
236
  }
217
- }, Ct = class {
237
+ }, q = /* @__PURE__ */ new WeakMap(), un = /* @__PURE__ */ new Set(), dn = (e) => q.get(e) ?? null, fn = () => Array.from(un, (e) => e.getOrigin()), pn = class e {
238
+ constructor(n) {
239
+ this._released = !1, e._assertFree(n), this._emitter = new t(this), this._origin = n, q.set(n, this), un.add(this);
240
+ }
241
+ getOrigin() {
242
+ return this._origin;
243
+ }
244
+ setOrigin(t) {
245
+ t !== this._origin && (e._assertFree(t), this._released || (q.delete(this._origin), q.set(t, this)), this._origin = t, this._emitter.notify("onOriginChange"));
246
+ }
247
+ release() {
248
+ this._released || (this._released = !0, q.get(this._origin) === this && q.delete(this._origin), un.delete(this));
249
+ }
250
+ addListeners(e, t) {
251
+ return this._emitter.addListeners(e, t);
252
+ }
253
+ static _assertFree(e) {
254
+ if (q.has(e)) throw Error("This origin already backs an open workbook; an origin backs one workbook at a time.");
255
+ }
256
+ }, mn = class {
218
257
  constructor() {
219
258
  this._defaultStringSourceType = "filepath";
220
259
  }
221
260
  async read(e) {
222
261
  let t = e.options ?? {}, n = e.source;
223
262
  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") {
263
+ let r = n, i = await this.fileFromHandle(n);
264
+ i && (n = i);
265
+ let a = t.format, o = this._detectSourceType(n);
266
+ if (!o) throw Error("Unable to detect source type from provided input.");
267
+ let s, l, u = !1;
268
+ if (o === "filepath") {
228
269
  let e = typeof n == "string" && n.startsWith("file://") ? n.slice(7) : n;
229
- n = await this.filePathToFile(e), i = "file", s = !0;
270
+ n = await this.filePathToFile(e), o = "file", u = !0;
230
271
  }
231
- switch (i) {
272
+ switch (o) {
232
273
  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,
274
+ let e = n, r = e?.name, o = r ? `${c(r)}` : "";
275
+ s = await e.arrayBuffer(), l = {
276
+ format: a,
277
+ ext: T(r),
278
+ name: o,
279
+ absolutePath: r,
239
280
  size: e.size,
240
- canWrite: s && this._canWriteLocalPath()
281
+ lastModified: e.lastModified,
282
+ canWrite: !t.asCopy && (!!i || u && this._canWriteLocalPath())
241
283
  };
242
284
  break;
243
285
  }
244
286
  case "blob": {
245
287
  let e = n;
246
- a = await e.arrayBuffer(), o = {
247
- format: r,
288
+ s = await e.arrayBuffer(), l = {
289
+ format: a,
248
290
  size: e.size
249
291
  };
250
292
  break;
@@ -256,68 +298,85 @@ var xt = class extends yt {
256
298
  let [, t] = n.split(",");
257
299
  e = t;
258
300
  } else e = n;
259
- a = ft.base64ToArrayBuffer(e), o = {
260
- format: r,
301
+ s = Yt.base64ToArrayBuffer(e), l = {
302
+ format: a,
261
303
  size: e.length
262
304
  };
263
305
  break;
264
306
  }
265
307
  case "fetch": {
266
- let e, t, i;
308
+ let e, t, r;
267
309
  if (typeof n == "string") e = n;
268
310
  else {
269
311
  if (!n || typeof n != "object" || !("input" in n)) throw Error("Invalid fetch source provided.");
270
312
  {
271
- let r = n;
272
- e = r.input, t = r.init, i = r.timeout;
313
+ let i = n;
314
+ e = i.input, t = i.init, r = i.timeout;
273
315
  }
274
316
  }
275
- let s = i || 3e4, c = new AbortController(), l = setTimeout(() => c.abort(), s), u = typeof e == "string" ? e : e.toString(), d = x(u);
317
+ let i = r || 3e4, o = new AbortController(), u = setTimeout(() => o.abort(), i), d = typeof e == "string" ? e : e.toString(), f = T(d);
276
318
  try {
277
319
  let n = await fetch(e, {
278
320
  ...t,
279
- signal: c.signal
321
+ signal: o.signal
280
322
  });
281
- 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,
286
- ext: d,
287
- name: N(u, !0),
288
- absolutePath: u
323
+ if (clearTimeout(u), !n.ok) throw Error(`Failed to fetch: ${n.status} ${n.statusText}`);
324
+ let r = await n.arrayBuffer();
325
+ if (!r) throw Error(`Unable to fetched content: ${d}`);
326
+ s = r, l = {
327
+ format: a,
328
+ ext: f,
329
+ name: c(d, !0),
330
+ absolutePath: d
289
331
  };
290
332
  } catch (e) {
291
- throw clearTimeout(l), e.name === "AbortError" ? Error(`Fetch timeout after ${s}ms: ${u}`) : e;
333
+ throw clearTimeout(u), e.name === "AbortError" ? Error(`Fetch timeout after ${i}ms: ${d}`) : e;
292
334
  }
293
335
  break;
294
336
  }
295
337
  case "buffer":
296
- a = n, o = { format: r };
338
+ s = n, l = { format: a };
297
339
  break;
298
340
  case "stream": {
299
- let e = n.getReader(), t = [], i = 0;
341
+ let e = n.getReader(), t = [], r = 0;
300
342
  try {
301
343
  for (;;) {
302
- let { done: n, value: r } = await e.read();
344
+ let { done: n, value: i } = await e.read();
303
345
  if (n) break;
304
- t.push(r), i += r.length;
346
+ t.push(i), r += i.length;
305
347
  }
306
348
  } finally {
307
349
  e.releaseLock();
308
350
  }
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 };
351
+ let i = new ArrayBuffer(r), o = new Uint8Array(i), c = 0;
352
+ for (let e of t) o.set(e, c), c += e.length;
353
+ s = i, l = { format: a };
312
354
  break;
313
355
  }
314
- default: throw Error(`Unsupported source type: ${i}`);
356
+ default: throw Error(`Unsupported source type: ${o}`);
315
357
  }
316
- let c = await e.decode(a, {
317
- sourceType: i,
318
- ...o
358
+ l.canWrite && await this.findOpenOrigin(r, l) && (l.canWrite = !1);
359
+ let d = await e.decode(s, {
360
+ sourceType: o,
361
+ ...l
319
362
  });
320
- return c ? (await this.onWorkbookRead(c, n), c) : null;
363
+ return d ? (await this.onWorkbookRead(d, r), d) : null;
364
+ }
365
+ async findOpenOrigin(e, t) {
366
+ return t.absolutePath ? this.findOpenPath(t.absolutePath) : null;
367
+ }
368
+ findOpenPath(e, t) {
369
+ return fn().find((n) => {
370
+ if (n === t || !n.canWrite()) return !1;
371
+ let r = n.getPath();
372
+ return !!r && this.isSamePath(r, e);
373
+ }) ?? null;
374
+ }
375
+ isSamePath(e, t) {
376
+ return e === t;
377
+ }
378
+ async fileFromHandle(e) {
379
+ return null;
321
380
  }
322
381
  async resolveSource(e) {
323
382
  return null;
@@ -338,25 +397,21 @@ var xt = class extends yt {
338
397
  }
339
398
  if (typeof File < "u" && e instanceof File) return "file";
340
399
  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);
400
+ let t = e instanceof ArrayBuffer || Object.prototype.toString.call(e) === "[object ArrayBuffer]", n = ArrayBuffer.isView(e), r = Yt.isNodeBuffer(e);
342
401
  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
402
  }
344
- }, wt = class extends Ct {
403
+ }, hn = class extends mn {
345
404
  constructor(e, t) {
346
- super(), this._getWriteFormats = e, this._getReadFormats = t, this._defaultStringSourceType = "fetch", this._handleCache = /* @__PURE__ */ new WeakMap(), this._pendingOpenHandle = null;
405
+ super(), this._getWriteFormats = e, this._getReadFormats = t, this._defaultStringSourceType = "fetch", this._handleCache = /* @__PURE__ */ new WeakMap();
347
406
  }
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);
407
+ async fileFromHandle(e) {
408
+ return _n(e) ? e.getFile() : null;
354
409
  }
355
410
  async resolveSource() {
356
411
  let e = await this._getReadFormats?.() ?? [];
357
412
  if (typeof globalThis.showOpenFilePicker == "function") try {
358
413
  let t = function(e) {
359
- let t = Tt(e);
414
+ let t = gn(e);
360
415
  if (t.length <= 1) return t;
361
416
  let n = /* @__PURE__ */ new Set(), r = {};
362
417
  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 +420,35 @@ var xt = class extends yt {
365
420
  accept: r
366
421
  }, ...t];
367
422
  }(e), [n] = await globalThis.showOpenFilePicker(t.length ? { types: t } : void 0);
368
- return this._pendingOpenHandle = n, await n.getFile();
423
+ return n;
369
424
  } catch (e) {
370
425
  if (e?.name === "AbortError") return null;
371
426
  throw e;
372
427
  }
373
428
  let t = e.flatMap((e) => e.exts.map((e) => "." + e)).join(", ");
374
- return pt.openFileDialog(t);
429
+ return Xt.openFileDialog(t);
430
+ }
431
+ async findOpenOrigin(e) {
432
+ return _n(e) ? this._findOpenHandle(e) : null;
375
433
  }
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;
434
+ async _findOpenHandle(e, t) {
435
+ for (let n of fn()) {
436
+ if (n === t || !n.canWrite()) continue;
437
+ let r = this._handleCache.get(n);
438
+ if (r && typeof r.isSameEntry == "function" && await r.isSameEntry(e)) return n;
380
439
  }
440
+ return null;
441
+ }
442
+ async onWorkbookRead(e, t) {
443
+ if (!_n(t)) return;
444
+ let n = e.getOrigin?.();
445
+ n?.canWrite() && this._handleCache.set(n, t);
381
446
  }
382
447
  async filePathToFile(e) {
383
448
  throw Error(`Cannot read local file path '${e}' in browser environment. Use a file input element or fetch for remote URLs.`);
384
449
  }
385
450
  async write(e) {
386
451
  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
452
  if (s) try {
393
453
  if (c) {
394
454
  let e = await async function(e) {
@@ -403,39 +463,46 @@ var xt = class extends yt {
403
463
  if (e === "denied") return null;
404
464
  e !== "granted" && (c = void 0);
405
465
  }
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;
466
+ let a = !!c;
467
+ if (!a) {
468
+ c = await globalThis.showSaveFilePicker({
469
+ suggestedName: n,
470
+ types: gn(o)
471
+ });
472
+ let t = await this._findOpenHandle(c, e.workbook?.getOrigin?.());
473
+ if (t) throw new B(G("error.io.openElsewhere", { name: t.getName() ?? c.name ?? "" }));
474
+ }
475
+ let s = yn(c.name ?? n), l = o.find((e) => e.exts.some((e) => e.toLowerCase() === s)) ?? r, u = a ? t : new K(c.name ?? n, {
476
+ format: l.key,
477
+ canWrite: !0
478
+ }), d = await i(l.key, u);
479
+ if (!d) return null;
480
+ let f = new Blob([vn(d)], { type: l.mimeType || "application/octet-stream" }), p = await c.createWritable();
481
+ if (await p.write(f), await p.close(), this._handleCache.set(u, c), u instanceof K) {
482
+ let e = await Promise.resolve(c.getFile?.()).then((e) => e?.lastModified ?? null, () => null);
483
+ u.update({
484
+ size: f.size,
485
+ lastModified: e
486
+ });
487
+ }
488
+ return u;
420
489
  } catch (e) {
421
490
  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;
491
+ if (e instanceof B) throw e;
492
+ }
493
+ let l = t.getPath(), u = l ? l.split(/[/\\]/).pop() : null, d = u && r.exts.some((e) => e.toLowerCase() === yn(u)) ? u : n, f = l !== d || t.canWrite() ? new K(d, {
494
+ format: r.key,
495
+ canWrite: !1
496
+ }) : t, p = await i(r.key, f);
497
+ if (!p) return null;
498
+ let m = new Blob([vn(p)], { type: r.mimeType || "application/octet-stream" });
424
499
  return function(e, t) {
425
500
  let n = URL.createObjectURL(e), r = document.createElement("a");
426
501
  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;
502
+ }(m, d), f instanceof K && f.update({ size: m.size }), f;
436
503
  }
437
504
  };
438
- function Tt(e) {
505
+ function gn(e) {
439
506
  return e.map((e) => {
440
507
  let t = e.mimeType && e.mimeType.includes("/") ? e.mimeType : "application/octet-stream";
441
508
  return {
@@ -444,18 +511,21 @@ function Tt(e) {
444
511
  };
445
512
  });
446
513
  }
447
- function Et(e) {
514
+ function _n(e) {
515
+ return !!e && e.kind === "file" && typeof e.getFile == "function";
516
+ }
517
+ function vn(e) {
448
518
  if (typeof SharedArrayBuffer < "u" && e instanceof SharedArrayBuffer) {
449
519
  let t = new ArrayBuffer(e.byteLength);
450
520
  return new Uint8Array(t).set(new Uint8Array(e)), t;
451
521
  }
452
522
  return e;
453
523
  }
454
- function Dt(e) {
524
+ function yn(e) {
455
525
  let t = e.lastIndexOf(".");
456
526
  return t >= 0 ? e.slice(t + 1).toLowerCase() : "";
457
527
  }
458
- var Ot = class {
528
+ var bn = class {
459
529
  constructor(e) {
460
530
  this._private = { input: e }, typeof e == "string" ? this._private.name = e : Object.assign(this._private, e);
461
531
  }
@@ -477,11 +547,98 @@ var Ot = class {
477
547
  get isIFont() {
478
548
  return !0;
479
549
  }
480
- }, kt = e({
481
- findBestMatch: () => Pt,
482
- getFontList: () => Nt,
483
- setFontList: () => K
484
- }), At = [
550
+ }, xn = /^\p{White_Space}$/u, Sn = (e) => Math.max(0, Math.floor(e + .5)) || 0, J = class e {
551
+ constructor(e, t) {
552
+ this._perEm = /* @__PURE__ */ new Map(), this.family = e.family, this.weight = e.weight, this.italic = e.italic, this._vertical = t;
553
+ }
554
+ static fromJSON(t) {
555
+ if (t?.format !== e.FORMAT) throw Error(`Not a font metrics table: format '${t?.format}', expected '${e.FORMAT}'.`);
556
+ let n = Math.max(1, t.unitsPerEm), r = (e) => e ? {
557
+ position: e[0] / n,
558
+ thickness: e[1] / n
559
+ } : null, i = new e({
560
+ family: t.family,
561
+ weight: t.weight,
562
+ italic: t.italic
563
+ }, {
564
+ ascent: t.winAscent / n,
565
+ descent: t.winDescent / n,
566
+ underline: r(t.underline),
567
+ strikeout: r(t.strikeout)
568
+ }), a = i._perEm;
569
+ for (let [e, r] of t.advances) for (let t = 0; t < r.length; t++) a.set(e + t, r[t] / n);
570
+ return i;
571
+ }
572
+ get size() {
573
+ return this._perEm.size;
574
+ }
575
+ advance(e) {
576
+ return this._perEm.get(e);
577
+ }
578
+ set(e) {
579
+ for (let [t, n] of e) this._perEm.set(t, n);
580
+ }
581
+ missing(e) {
582
+ let t = /* @__PURE__ */ new Set();
583
+ for (let n of e) this._perEm.has(n.codePointAt(0)) || t.add(n);
584
+ return [...t];
585
+ }
586
+ width(e, t, n) {
587
+ let r = this._perEm, i = r.get(32) ?? 0, a = 0, o = 0;
588
+ for (let t of e) a += r.get(t.codePointAt(0)) ?? (xn.test(t) ? i : 0), o++;
589
+ return a * t * (n?.superSub ? .6 : 1) + (n?.letterSpacing ?? 0) * Math.max(0, o - 1);
590
+ }
591
+ metrics(e) {
592
+ let t = Sn(e), n = Sn(this._vertical.ascent * t), r = Sn(this._vertical.descent * t), i = n + r + 2;
593
+ return {
594
+ ascent: n,
595
+ descent: r,
596
+ lineHeight: i,
597
+ baseline: Math.floor((i - (n + r)) / 2) + n,
598
+ lineGap: 2
599
+ };
600
+ }
601
+ underline(e) {
602
+ return Cn(this._vertical.underline, e);
603
+ }
604
+ strikeout(e) {
605
+ return Cn(this._vertical.strikeout, e);
606
+ }
607
+ measure(e, t, n) {
608
+ return {
609
+ width: this.width(e, t, n),
610
+ ...this.metrics(t)
611
+ };
612
+ }
613
+ };
614
+ function Cn(e, t) {
615
+ return e ? {
616
+ position: e.position * t,
617
+ thickness: e.thickness * t
618
+ } : null;
619
+ }
620
+ (J ||= {}).FORMAT = "sheetxl-font-metrics/1";
621
+ var wn = class {
622
+ constructor(e = null) {
623
+ this.name = "table-file", this.kind = "table", this._pending = /* @__PURE__ */ new Map(), this._base = e;
624
+ }
625
+ build(e) {
626
+ let t = function(e) {
627
+ let t = e.family.trim().toLowerCase().replace(/\s+/g, "-"), n = e.weight >= 600;
628
+ return `${t}-${n && e.italic ? "bold-italic" : n ? "bold" : e.italic ? "italic" : "regular"}.metrics.json`;
629
+ }(e), n = this._pending.get(t);
630
+ return n || (n = this._load(t), this._pending.set(t, n)), n;
631
+ }
632
+ async _load(e) {
633
+ let t;
634
+ try {
635
+ t = await rn("fonts", "@sheetxl/sdk", e, this._base, import.meta.url);
636
+ } catch {
637
+ return null;
638
+ }
639
+ return J.fromJSON(t);
640
+ }
641
+ }, Tn = "{\n \"format\": \"sheetxl-font-metrics/1\",\n \"family\": \"Arial\",\n \"weight\": 700,\n \"italic\": false,\n \"source\": { \"family\": \"Liberation Sans\", \"version\": \"Version 2.1.5\", \"license\": \"OFL-1.1\", \"notice\": \"Licensed under the SIL Open Font License, Version 1.1\" },\n \"unitsPerEm\": 2048,\n \"winAscent\": 1854,\n \"winDescent\": 434,\n \"underline\": [-2, 215],\n \"strikeout\": [530, 102],\n \"advances\": [\n [32, [569,682,971,1139,1139,1821,1479,487,682,682,797,1196,569,682,569,569,1139,1139,1139,1139,1139,1139,1139,1139,1139,1139,682,682,1196,1196,1196,1251,1997,1479,1479,1479,1479,1366,1251,1593,1479,569,1139,1479,1251,1706,1479,1593,1366,1593,1479,1366,1251,1479,1366,1933,1366,1366,1251,682,569,682,1196,1139,682,1139,1251,1139,1251,1139,682,1251,1251,569,569,1139,569,1821,1251,1251,1251,1251,797,1139,682,1251,1139,1593,1139,1139,1024,797,573,797,1196]],\n [160, [569,682,1139,1139,1139,1139,573,1139,682,1509,758,1139,1196,682,1509,1131,819,1124,682,682,682,1180,1139,682,682,682,748,1139,1708,1708,1708,1251,1479,1479,1479,1479,1479,1479,2048,1479,1366,1366,1366,1366,569,569,569,569,1479,1479,1593,1593,1593,1593,1593,1196,1593,1479,1479,1479,1479,1366,1366,1251,1139,1139,1139,1139,1139,1139,1821,1139,1139,1139,1139,1139,569,569,569,569,1251,1251,1251,1251,1251,1251,1251,1124,1251,1251,1251,1251,1251,1139,1251,1139,1479,1139,1479,1139,1479,1139,1479,1139,1479,1139,1479,1139,1479,1139,1479,1472,1479,1251,1366,1139,1366,1139,1366,1139,1366,1139,1366,1139,1593,1251,1593,1251,1593,1251,1593,1251,1479,1251,1479,1251,569,569,569,569,569,569,569,569,569,569,1607,1139,1139,569,1479,1139,1139,1251,569,1251,569,1251,789,1251,981,1251,569,1479,1251,1479,1251,1479,1251,1451,1481,1251,1593,1251,1593,1251,1593,1251,2048,1933,1479,797,1479,797,1479,797,1366,1139,1366,1139,1366,1139,1366,1139,1251,682,1251,981,1251,682,1479,1251,1479,1251,1479,1251,1479,1251,1479,1251,1479,1251,1933,1593,1366,1139,1366,1251,1024,1251,1024,1251,1024,569,1251,1713,1472,1251,1472,1251,1479,1479,1139,1479,1715,1472,1251,1242,1366,1487,1283,1251,1139,1593,1304,1906,569,569,1479,1139,569,1139,2031,1479,1251,1593,1747,1456,1816,1523,1601,1251,1366,1366,1139,1229,737,682,1251,682,1251,1699,1483,1642,1479,1577,1139,1251,1024,1251,1251,1078,1078,1139,1139,1018,1186,1251,573,1019,1197,682,2730,2503,2275,2390,1820,1138,2618,2048,1820,1479,1139,569,569,1593,1251,1479,1251,1479,1251,1479,1251,1479,1251,1479,1251,1139,1479,1139,1479,1139,2048,1821,1593,1251,1593,1251,1479,1139,1593,1251,1593,1251,1251,1078,569,2730,2503,2275,1593,1251,2115,1362,1479,1251,1479,1139,2048,1821,1593,1251,1479,1139,1479,1139,1366,1139,1366,1139,569,569,569,569,1593,1251,1593,1251,1479,797,1479,797,1479,1251,1479,1251,1366,1139,1251,682,1182,1065,1479,1251,1439,1715,1292,1292,1251,1024,1479,1139,1366,1139,1593,1251,1593,1251,1593,1251,1593,1251,1366,1139,1022,1707,1036,569,1953,1953,1479,1479,1139,1251,1251,1139,1024,1321,991,1479,1479,1366,1366,1139,1139,569,1587,1251,1479,797,1366,1139,1139,1251,1251,1251,1139,1139,1251,1251,1139,1139,1601,1018,1018,1415,1162,682,1251,1251,1200,1139,1230,1251,1251,1251,569,569,830,680,729,569,1236,1821,1821,1821,1251,1251,1259,1251,1707,1730,1535,797,797,797,797,797,797,797,1195,1195,1139,682,682,682,1105,682,682,1251,1272,1192,1139,1593,1139,1169,1024,1392,1078,1078,1139,1139,1139,1139,1593,1259,1162,1200,1237,939,1139,926,1251,1139,1139,2111,1929,2479,1666,1094,1688,1780,1589,1418,1093,1154,1494,1494,753,753,398,516,516,516,768,1071,738,487,971,569,569,569,682,682,768,768,1196,1196,1196,1196,682,682,682,682,682,682,682,682,682,682,682,682,682,682,682,682,682,682,682,682,682,682,682,682,682,682,749,289,770,750,768,784,784,784,784,784,682,682,682,682,1024,682,682,682,682,682,682,682,682,682,682,682,682,682,682,814,814,682,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]],\n [884, [682,682]],\n [890, [682,1139,1139,1139,682]],\n [900, [682,952,1479,682,1747,1855,970]],\n [908, [1689]],\n [910, [1899,1716,569,1479,1479,1231,1472,1366,1251,1479,1593,569,1479,1366,1706,1479,1318,1593,1479,1366]],\n [931, [1229,1251,1366,1681,1366,1657,1642,569,1366,1259,924,1251,569,1192,1259,1250,1139,1242,972,943,1251,1107,569,1142,1139,1253,1139,912,1251,1568,1267,1065,1401,914,1192,1465,1179,1543,1730,569,1192,1251,1192,1730]],\n [976, [1250,1192,1577,2050,1577,1535,1730,1385,1593,1251,1479,1139,1251,926,1539,1084,1647,1250,2031,1821,1439,1251,1439,1239,1366,1366,1316,1236,1505,1184,1038,900,1385,1265,1139,569,1593,980,980,1366,1251,1479,1706,1515,1267,1479,1479,1479,1366,1370,1813,1161,1457,1366,569,565,1139,2240,2176,1792,1250,1472,1274,1472,1479,1472,1479,1161,1459,1366,1851,1283,1472,1472,1250,1437,1706,1479,1593,1472,1366,1479,1251,1274,1748,1366,1496,1439,2058,2087,1781,2005,1472,1457,2112,1472,1139,1265,1259,853,1300,1139,1452,1018,1259,1259,1025,1301,1515,1237,1251,1237,1251,1139,1003,1139,1792,1139,1259,1189,1707,1728,1493,1749,1259,1131,1749,1195,1139,1139,1251,853,1131,1139,569,576,569,1984,1856,1251,1025,1259,1139,1237,2621,1594,1780,1439,1998,1630,1366,1139,1896,1639,1657,1543,2206,2008,1283,1018,1657,1543,1593,1251,1669,1324,1669,1324,2294,1995,1668,1306,2621,1845,2621,1594,1479,1139,1196,0,0,0,0,0,0,0,1472,1259,1472,1259,1366,1251,997,915,1161,853,1439,1225,1851,1452,1283,1018,1250,1025,1250,1025,1250,1025,1559,1276,1479,1237,1801,1462,2306,1887,1479,1183,1479,1139,1251,1003,1139,1139,1139,1139,1366,1139,1746,1411,1439,1189,1439,1189,1439,1251,1754,1389,1754,1389,569,1851,1452,1437,1224,1437,1301,1479,1237,1479,1237,1439,1189,1706,1515,569,1479,1139,1479,1139,2048,1821,1366,1139,1487,1139,1487,1139,1851,1452,1283,1018,1283,1078,1472,1259,1472,1259,1593,1251,1593,1251,1593,1251,1457,1131,1274,1139,1274,1139,1274,1139,1439,1189,1161,853,2005,1749,1161,853,1366,1139,1366,1139,1472,1251,2110,1914,1965,1732,1347,1098,2074,1957,2115,1894,1593,1200,1568,1435,1283,1018,1437,1301]],\n [1306, [1593,1251,1933,1593]],\n [1425, [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,784,0,1153,0,0,682,0,0,862,0]],\n [1488, [1397,1311,981,1192,1384,618,748,1434,1409,618,1180,1133,1171,1475,1487,618,883,1430,1266,1382,1335,1128,1247,1339,1180,1649,1470]],\n [1520, [1237,1237,1237,831,1278]],\n [7424, [1205,1589,1821,1259,1139,1177,1177,1025,1018,569,1039,1142,926,1515,1259,1251,1139,1265,1265,1265,1933,1170,1251,1251,1257,1195,1195,1003,1192,1251,1572,1248,1139,1593,1024,991,1010,1260,853,1139,1237,1257,1543,1301,995,1425,930,930,931,853,853,1027,892,370,734,944,798,1058,887,888,1062,890,859,940,887,891,1300,773,773,801,1206,801,801,770,770,719,719,800,289,714,1156,754,840,778,841,841,800,444,754,834,1156,745,844,795,745,835,986,776,289,516,754,745,795,745,834,986,776,1888,1251,1251,682,1821,1251,1251,797,797,1139,682,1024,1251,752,1244,1787,569,569,1251,1192,1272,1251,1251,682,1573,1139,569,1821,1251,1251,797,1139,954,1139,1139,1024,1139,1251,1251,1139,1018,1018,1342,569,1139,682,1251,1078,801,778,778,840,719,496,496,800,753,372,289,289,372,630,398,336,585,1156,1156,863,863,762,840,1027,770,569,444,832,862,746,746,745,740,740,958,778,744,0,0,0,0,0,0,0,0,0,0,0]],\n [7678, [0,0,1479,1139,1479,1251,1479,1251,1479,1251,1479,1139,1479,1251,1479,1251,1479,1251,1479,1251,1479,1251,1366,1139,1366,1139,1366,1139,1366,1139,1366,1139,1251,682,1593,1251,1479,1251,1479,1251,1479,1251,1479,1251,1479,1251,569,569,569,569,1479,1139,1479,1139,1479,1139,1251,569,1251,569,1251,569,1251,569,1706,1821,1706,1821,1706,1821,1479,1251,1479,1251,1479,1251,1479,1251,1593,1251,1593,1251,1593,1251,1593,1251,1366,1251,1366,1251,1479,797,1479,797,1479,797,1479,797,1366,1139,1366,1139,1366,1139,1366,1139,1366,1139,1251,682,1251,682,1251,682,1251,682,1479,1251,1479,1251,1479,1251,1479,1251,1479,1251,1366,1139,1366,1139,1933,1593,1933,1593,1933,1593,1933,1593,1933,1593,1366,1139,1366,1139,1366,1139,1251,1024,1251,1024,1251,1024,1251,682,1593,1139,1139,569]],\n [7838, [1465]],\n [7840, [1479,1139,1479,1139,1479,1139,1479,1139,1479,1139,1479,1139,1479,1139,1479,1139,1479,1139,1479,1139,1479,1139,1479,1139,1366,1139,1366,1139,1366,1139,1366,1139,1366,1139,1366,1139,1366,1139,1366,1139,569,569,569,569,1593,1251,1593,1251,1593,1251,1593,1251,1593,1251,1593,1251,1593,1251,1747,1456,1747,1456,1747,1456,1747,1456,1747,1456,1479,1251,1479,1251,1699,1483,1699,1483,1699,1483,1699,1483,1699,1483,1366,1139,1366,1139,1366,1139,1366,1139]],\n [7936, [1259,1259,1259,1259,1259,1259,1259,1259,1479,1479,1779,1779,1779,1779,1779,1779,972,972,972,972,972,972]],\n [7960, [1566,1566,1966,1966,1966,1966]],\n [7968, [1251,1251,1251,1251,1251,1251,1251,1251,1679,1679,2079,2079,2079,2079,2079,2079,569,569,569,569,569,569,569,569,769,769,1169,1169,1169,1169,1169,1169,1251,1251,1251,1251,1251,1251]],\n [8008, [1693,1693,2133,2133,1993,1993]],\n [8016, [1192,1192,1192,1192,1192,1192,1192,1192]],\n [8025, [1666]],\n [8027, [2046]],\n [8029, [2146]],\n [8031, [1966,1730,1730,1730,1730,1730,1730,1730,1730,1742,1742,2182,2182,2042,2042,2042,2042,1259,1259,972,972,1251,1251,569,569,1251,1251,1192,1192,1730,1730]],\n [8064, [1259,1259,1259,1259,1259,1259,1259,1259,1479,1479,1779,1779,1779,1779,1779,1779,1251,1251,1251,1251,1251,1251,1251,1251,1679,1679,2079,2079,2079,2079,2079,2079,1730,1730,1730,1730,1730,1730,1730,1730,1742,1742,2182,2182,2042,2042,2042,2042,1259,1259,1259,1259,1259]],\n [8118, [1259,1259,1479,1479,1479,1479,1479,682,682,682,682,682,1251,1251,1251]],\n [8134, [1251,1251,1766,1766,1879,1879,1479,682,682,682,569,569,569,569]],\n [8150, [569,569,569,569,969,969]],\n [8157, [682,682,682,1192,1192,1192,1192,1267,1267,1192,1192,1366,1366,1766,1866,1566,952,952,682]],\n [8178, [1730,1730,1730]],\n [8182, [1730,1730,1893,1693,1942,1742,1642,682,682]],\n [8192, [1024,2048,1024,2048,683,512,341,1139,569,410,171,0,0,0,0,0,682]],\n [8210, [1139,1139,2048,2048,1019,1131,569,569,569,569,1024,1024,1024,1024,1139,1139,717]],\n [8230, [2048]],\n [8234, [0,0,0,0,0,410,2048]],\n [8242, [491,981,981]],\n [8249, [682,682]],\n [8252, [1237]],\n [8254, [682]],\n [8260, [342]],\n [8286, [682]],\n [8298, [0,0,0,0,0,0]],\n [8308, [1013,962,943,845,968,972]],\n [8319, [811,923,847,910,947,976,939,930,819,959,922]],\n [8336, [773,770,840,750,770]],\n [8352, [1139,1479,1479,1139,1139,1821,1479,2240,2509,1933,1810,1051,1139,1479,1251,2224,1139,1366,1593,1479,1366,1479]],\n [8383, [1669]],\n [8432, [0]],\n [8453, [1813]],\n [8467, [1001]],\n [8470, [2283,1509]],\n [8482, [2048]],\n [8486, [1573]],\n [8494, [1229]],\n [8525, [2048,1025]],\n [8531, [1708,1708]],\n [8539, [1708,1708,1708,1708]],\n [8580, [1139]],\n [8592, [2048,1024,2048,1024,2048,1024]],\n [8616, [1024]],\n [8660, [2048]],\n [8706, [1012]],\n [8710, [1253]],\n [8719, [1686]],\n [8721, [1460,1196]],\n [8725, [342]],\n [8729, [569,1124]],\n [8734, [1460,2005]],\n [8745, [1479]],\n [8747, [561]],\n [8776, [1124]],\n [8800, [1124,1195,2048]],\n [8804, [1124,1124]],\n [8962, [1237]],\n [8976, [1196]],\n [8992, [1237,1237]],\n [9472, [1451]],\n [9474, [1280]],\n [9484, [1451]],\n [9488, [1451]],\n [9492, [1451]],\n [9496, [1451]],\n [9500, [1451]],\n [9508, [1451]],\n [9516, [1451]],\n [9524, [1451]],\n [9532, [1451]],\n [9552, [1451,1451,1451,1451,1451,1451,1451,1451,1451,1451,1451,1451,1451,1451,1451,1451,1451,1451,1451,1451,1451,1451,1451,1451,1451,1451,1451,1451,1451]],\n [9600, [1451]],\n [9604, [1451]],\n [9608, [1451]],\n [9612, [1451]],\n [9616, [1451,1451,1451,1493]],\n [9632, [1237,1237]],\n [9642, [726,726,2048]],\n [9650, [2027]],\n [9658, [2027]],\n [9660, [2027]],\n [9668, [2027]],\n [9674, [1012,1237,1217]],\n [9679, [1237,1237,1237,1237,1237,1237,1237,1237,1237,1237,1237]],\n [9702, [726]],\n [9786, [2091,2155,1877]],\n [9791, [1536,1536,1536,1536,1536,1536,1536,1536,1536]],\n [9824, [1088]],\n [9827, [1344]],\n [9829, [1216,1045]],\n [9833, [2048,1024,1536,2048]],\n [9839, [1024]],\n [11360, [1251,569,1251,1366,1479,1139,682,1479,1251,1479,1139,1251,1024,1563]],\n [11377, [1241,2139,1758,1139,1108,892,1465]],\n [11799, [682]],\n [42775, [0,0,0,0,1024,1024,682,682,682,0,0]],\n [42888, [682,682,796,487,487]],\n [64257, [1251,1251]],\n [64285, [618,0,1237,1266,1397,1192,1384,1133,1171,1475,1180,1470,1237,1649,1649,1649,1649,1397,1397,1397,1311,981,1192,1384,618,748]],\n [64312, [1409,618,1180,1133,1171]],\n [64318, [1487]],\n [64320, [883,1430]],\n [64323, [1382,1335]],\n [64326, [1247,1339,1180,1649,1470,618,1311,1133,1335,1368]],\n [65056, [0,0,0,0]],\n [65532, [2048]]\n ]\n}\n", En = "{\n \"format\": \"sheetxl-font-metrics/1\",\n \"family\": \"Arial\",\n \"weight\": 400,\n \"italic\": false,\n \"source\": { \"family\": \"Liberation Sans\", \"version\": \"Version 2.1.5\", \"license\": \"OFL-1.1\", \"notice\": \"Licensed under the SIL Open Font License, Version 1.1\" },\n \"unitsPerEm\": 2048,\n \"winAscent\": 1854,\n \"winDescent\": 434,\n \"underline\": [-67, 150],\n \"strikeout\": [530, 102],\n \"advances\": [\n [32, [569,569,727,1139,1139,1821,1366,391,682,682,797,1196,569,682,569,569,1139,1139,1139,1139,1139,1139,1139,1139,1139,1139,569,569,1196,1196,1196,1139,2079,1366,1366,1479,1479,1366,1251,1593,1479,569,1024,1366,1139,1706,1479,1593,1366,1593,1479,1366,1251,1479,1366,1933,1366,1366,1251,569,569,569,961,1139,682,1139,1139,1024,1139,1139,569,1139,1139,455,455,1024,455,1706,1139,1139,1139,1139,682,1024,569,1139,1024,1479,1024,1024,1024,684,532,684,1196]],\n [160, [569,682,1139,1139,1139,1139,532,1139,682,1509,758,1139,1196,682,1509,1131,819,1124,682,682,682,1180,1100,682,682,682,748,1139,1708,1708,1708,1251,1366,1366,1366,1366,1366,1366,2048,1479,1366,1366,1366,1366,569,569,569,569,1479,1479,1593,1593,1593,1593,1593,1196,1593,1479,1479,1479,1479,1366,1366,1251,1139,1139,1139,1139,1139,1139,1821,1024,1139,1139,1139,1139,569,569,569,569,1139,1139,1139,1139,1139,1139,1139,1124,1251,1139,1139,1139,1139,1024,1139,1024,1366,1139,1366,1139,1366,1139,1479,1024,1479,1024,1479,1024,1479,1024,1479,1259,1479,1139,1366,1139,1366,1139,1366,1139,1366,1139,1366,1139,1593,1139,1593,1139,1593,1139,1593,1139,1479,1139,1479,1139,569,569,569,569,569,569,569,455,569,569,1505,909,1024,455,1366,1024,1024,1139,455,1139,455,1139,597,1139,684,1139,455,1479,1139,1479,1139,1479,1139,1237,1481,1139,1593,1139,1593,1139,1593,1139,2048,1933,1479,682,1479,682,1479,682,1366,1024,1366,1024,1366,1024,1366,1024,1251,569,1251,768,1251,569,1479,1139,1479,1139,1479,1139,1479,1139,1479,1139,1479,1139,1933,1479,1366,1024,1366,1251,1024,1251,1024,1251,1024,455,1139,1553,1344,1139,1344,1139,1479,1479,1024,1479,1658,1344,1139,1140,1366,1541,1237,1251,1139,1593,1278,1804,455,569,1366,1024,455,1024,1824,1479,1139,1593,1756,1343,1778,1367,1545,1139,1366,1366,1024,1266,779,569,1251,569,1251,1749,1371,1531,1479,1582,1024,1251,1024,1251,1251,1116,1116,1139,1139,939,997,1139,532,846,1196,569,2730,2503,2148,2175,1706,924,2503,1934,1579,1366,1139,569,455,1593,1139,1479,1139,1479,1139,1479,1139,1479,1139,1479,1139,1139,1366,1139,1366,1139,2048,1821,1593,1139,1593,1139,1366,1024,1593,1139,1593,1139,1251,1116,455,2730,2503,2148,1593,1139,2118,1266,1479,1139,1366,1139,2048,1821,1593,1251,1366,1139,1366,1139,1366,1139,1366,1139,569,569,569,569,1593,1139,1593,1139,1479,682,1479,682,1479,1139,1479,1139,1366,1024,1251,569,1116,894,1479,1139,1446,1396,1238,1158,1251,1024,1366,1139,1366,1139,1593,1139,1593,1139,1593,1139,1593,1139,1366,1024,715,1402,752,455,1816,1816,1366,1479,1024,1139,1251,1024,1024,1189,928,1366,1479,1368,1366,1139,1024,455,1510,1139,1479,682,1366,1024,1139,1139,1139,1139,1024,1024,1139,1139,1139,1139,1513,939,939,1293,1039,569,1139,1139,1144,1026,1263,1139,1139,1139,455,455,729,670,622,455,1171,1706,1706,1706,1139,1139,1132,1139,1619,1599,1126,682,682,682,682,682,682,682,1109,1109,1024,455,532,455,715,569,569,1139,1164,1120,1024,1479,1024,1064,1024,1108,1116,1116,1024,1024,1024,1024,1593,1088,1039,1144,1131,814,1024,827,1139,1024,1024,1975,1856,2059,1459,879,1472,1564,1354,1295,994,1080,1407,1407,785,785,326,491,491,491,746,985,657,391,727,455,455,455,682,682,714,714,1196,1196,1196,1196,682,682,682,682,682,682,682,682,682,682,569,569,682,682,682,682,682,682,682,682,682,682,682,682,682,682,660,322,696,672,714,784,784,784,784,784,682,682,682,682,682,682,682,682,682,682,682,682,682,682,569,682,682,682,682,814,814,682,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]],\n [884, [682,682]],\n [890, [682,1024,1024,1024,569]],\n [900, [682,682,1367,569,1606,1716,786]],\n [908, [1586]],\n [910, [1752,1541,455,1366,1366,1128,1368,1366,1251,1479,1593,569,1366,1368,1706,1479,1331,1593,1479,1366]],\n [931, [1266,1251,1366,1634,1366,1711,1531,569,1366,1184,913,1139,455,1120,1184,1178,1024,1140,913,903,1139,1139,455,1024,1024,1180,1024,917,1139,1413,1165,987,1264,809,1120,1328,1075,1460,1599,455,1120,1139,1120,1599]],\n [976, [1178,1120,1582,1962,1582,1147,1599,1231,1593,1139,1479,1024,1251,827,1279,1084,1549,1181,1824,1706,1381,1139,1380,1024,1366,1366,1248,1221,1509,1134,950,839,1231,1173,1024,455,1593,905,905,1366,1139,1479,1706,1408,1165,1479,1479,1479,1366,1367,1771,1109,1472,1366,569,569,1024,2165,2069,1749,1193,1472,1301,1472,1366,1344,1366,1109,1387,1366,1891,1237,1472,1472,1193,1344,1706,1479,1593,1472,1366,1479,1251,1301,1557,1366,1515,1365,1877,1920,1621,1813,1344,1472,2069,1479,1139,1173,1088,747,1195,1139,1370,939,1144,1144,896,1195,1408,1131,1139,1109,1139,1024,938,1024,1685,1024,1173,1067,1643,1685,1280,1472,1067,1045,1536,1109,1139,1139,1139,747,1045,1024,455,569,455,1856,1664,1139,896,1144,1024,1131,2740,1278,1593,1255,1945,1461,1368,1024,1838,1424,1697,1403,2157,1776,1237,939,1631,1410,1593,1139,1645,1292,1645,1292,2200,1836,1706,1254,2439,1744,2740,1278,1479,1024,1031,0,0,0,0,0,0,0,1472,1144,1344,1067,1366,1139,1001,842,1109,747,1373,1124,1891,1370,1237,939,1193,896,1193,896,1193,896,1519,1097,1479,1131,1801,1327,2328,1782,1542,1067,1479,1024,1251,938,1139,1024,1139,1024,1366,1024,1895,1415,1365,1067,1365,1067,1365,1139,1764,1364,1764,1364,569,1891,1370,1367,1128,1344,1195,1479,1131,1479,1131,1365,1067,1706,1408,455,1366,1139,1366,1139,2048,1821,1366,1139,1541,1139,1541,1139,1891,1370,1237,939,1237,1116,1472,1144,1472,1144,1593,1139,1593,1139,1593,1139,1472,1045,1301,1024,1301,1024,1301,1024,1365,1067,1109,747,1813,1472,1109,747,1366,1024,1366,1024,1344,1139,1983,1795,1958,1670,1357,1043,1987,1863,2118,1799,1593,1144,1529,1363,1237,939,1344,1195]],\n [1306, [1593,1139,1933,1479]],\n [1425, [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,784,0,1153,0,0,569,0,0,776,0]],\n [1488, [1286,1225,866,1135,1298,532,662,1348,1337,532,1094,1075,1085,1389,1407,532,797,1343,1192,1276,1249,1032,1116,1208,1094,1495,1415]],\n [1520, [1042,1042,1042,788,1235]],\n [7424, [1016,1531,1821,1088,1024,1129,1129,1003,939,455,865,1024,822,1408,1144,1139,1024,1246,1246,1246,1933,936,1139,1139,1067,1109,1109,938,1120,1222,1502,1222,1024,1479,1024,939,875,1243,747,1024,1109,1067,1460,1195,928,1359,849,849,920,840,840,1016,878,342,644,870,720,1045,881,879,1048,783,857,924,886,879,1275,762,762,772,1228,773,773,761,761,652,652,772,322,694,1173,783,773,725,773,773,774,450,783,834,1173,658,800,789,658,774,901,703,322,491,783,658,789,658,777,901,703,1860,1139,1139,569,1706,1139,1139,682,682,1024,569,1024,1139,779,1140,1609,455,455,1139,1120,1164,1139,1139,569,1460,1024,455,1706,1139,1139,682,1024,792,1024,1024,1024,1139,1139,1139,1139,939,939,1332,455,1024,455,1139,1116,772,725,713,764,652,469,469,772,785,322,322,322,322,554,322,322,563,1171,1171,783,783,782,773,768,696,322,450,783,794,774,724,658,734,734,734,756,746,0,0,0,0,0,0,0,0,0,0,0]],\n [7678, [0,0,1366,1139,1366,1139,1366,1139,1366,1139,1479,1024,1479,1139,1479,1139,1479,1139,1479,1139,1479,1139,1366,1139,1366,1139,1366,1139,1366,1139,1366,1139,1251,569,1593,1139,1479,1139,1479,1139,1479,1139,1479,1139,1479,1139,569,455,569,569,1366,1024,1366,1024,1366,1024,1139,455,1139,455,1139,455,1139,455,1706,1706,1706,1706,1706,1706,1479,1139,1479,1139,1479,1139,1479,1139,1593,1139,1593,1139,1593,1139,1593,1139,1366,1139,1366,1139,1479,682,1479,682,1479,682,1479,682,1366,1024,1366,1024,1366,1024,1366,1024,1366,1024,1251,569,1251,569,1251,569,1251,569,1479,1139,1479,1139,1479,1139,1479,1139,1479,1139,1366,1024,1366,1024,1933,1479,1933,1479,1933,1479,1933,1479,1933,1479,1366,1024,1366,1024,1366,1024,1251,1024,1251,1024,1251,1024,1139,569,1479,1024,1139,455]],\n [7838, [1439]],\n [7840, [1366,1139,1366,1139,1366,1139,1366,1139,1366,1139,1366,1139,1366,1139,1366,1139,1366,1139,1366,1139,1366,1139,1366,1139,1366,1139,1366,1139,1366,1139,1366,1139,1366,1139,1366,1139,1366,1139,1366,1139,569,455,569,455,1593,1139,1593,1139,1593,1139,1593,1139,1593,1139,1593,1139,1593,1139,1756,1343,1756,1343,1756,1343,1756,1343,1756,1343,1479,1139,1479,1139,1749,1371,1749,1371,1749,1371,1749,1371,1749,1371,1366,1024,1366,1024,1366,1024,1366,1024]],\n [7936, [1184,1184,1184,1184,1184,1184,1184,1184,1366,1366,1666,1666,1666,1666,1666,1666,913,913,913,913,913,913]],\n [7960, [1566,1566,1900,1900,1900,1900]],\n [7968, [1139,1139,1139,1139,1139,1139,1139,1139,1679,1679,2079,2079,2079,2079,2079,2079,455,455,455,455,455,455,455,455,769,769,1169,1169,1169,1169,1169,1169,1139,1139,1139,1139,1139,1139]],\n [8008, [1693,1693,2093,2093,1993,1993]],\n [8016, [1120,1120,1120,1120,1120,1120,1120,1120]],\n [8025, [1666]],\n [8027, [1966]],\n [8029, [2066]],\n [8031, [1966,1599,1599,1599,1599,1599,1599,1599,1599,1631,1631,2031,2031,1931,1931,1931,1931,1184,1184,913,913,1139,1139,455,455,1139,1139,1120,1120,1599,1599]],\n [8064, [1184,1184,1184,1184,1184,1184,1184,1184,1366,1366,1666,1666,1666,1666,1666,1666,1139,1139,1139,1139,1139,1139,1139,1139,1679,1679,2079,2079,2079,2079,2079,2079,1599,1599,1599,1599,1599,1599,1599,1599,1631,1631,2031,2031,1931,1931,1931,1931,1184,1184,1184,1184,1184]],\n [8118, [1184,1184,1366,1366,1366,1366,1366,682,682,682,682,682,1139,1139,1139]],\n [8134, [1139,1139,1666,1666,1779,1779,1479,682,682,682,455,455,455,455]],\n [8150, [455,455,569,569,869,869]],\n [8157, [682,682,682,1120,1120,1120,1120,1165,1165,1120,1120,1366,1366,1766,1816,1566,682,682,682]],\n [8178, [1599,1599,1599]],\n [8182, [1599,1599,1893,1693,1831,1631,1531,682,682]],\n [8192, [1024,2048,1024,2048,683,512,341,1139,569,410,171,0,0,0,0,0,682]],\n [8210, [1139,1139,2048,2048,846,1131,455,455,455,455,682,682,682,682,1139,1139,717]],\n [8230, [2048]],\n [8234, [0,0,0,0,0,410,2048]],\n [8242, [384,725,725]],\n [8249, [682,682]],\n [8252, [1024]],\n [8254, [682]],\n [8260, [342]],\n [8286, [569]],\n [8298, [0,0,0,0,0,0]],\n [8308, [880,849,843,741,864,877]],\n [8319, [747,850,691,795,834,836,825,826,704,849,812]],\n [8336, [762,761,773,672,761]],\n [8352, [1139,1479,1479,1139,1139,1706,1479,2240,2384,1933,1739,1051,1139,1366,1251,2048,1067,1366,1593,1366,1139,1479]],\n [8383, [1516]],\n [8432, [0]],\n [8453, [1813]],\n [8467, [662]],\n [8470, [2197,1509]],\n [8482, [2048]],\n [8486, [1573]],\n [8494, [1229]],\n [8525, [1931,1003]],\n [8531, [1708,1708]],\n [8539, [1708,1708,1708,1708]],\n [8580, [1024]],\n [8592, [2048,1024,2048,1024,2048,1024]],\n [8616, [1024]],\n [8660, [2048]],\n [8706, [1012]],\n [8710, [1253]],\n [8719, [1686]],\n [8721, [1460,1196]],\n [8725, [342]],\n [8729, [569,1124]],\n [8734, [1460,2005]],\n [8745, [1472]],\n [8747, [561]],\n [8776, [1124]],\n [8800, [1124,1195,2048]],\n [8804, [1124,1124]],\n [8962, [1237]],\n [8976, [1196]],\n [8992, [1237,1237]],\n [9472, [1451]],\n [9474, [1280]],\n [9484, [1451]],\n [9488, [1451]],\n [9492, [1451]],\n [9496, [1451]],\n [9500, [1451]],\n [9508, [1451]],\n [9516, [1451]],\n [9524, [1451]],\n [9532, [1451]],\n [9552, [1451,1451,1451,1451,1451,1451,1451,1451,1451,1451,1451,1451,1451,1451,1451,1451,1451,1451,1451,1451,1451,1451,1451,1451,1451,1451,1451,1451,1451]],\n [9600, [1451]],\n [9604, [1451]],\n [9608, [1451]],\n [9612, [1451]],\n [9616, [1451,1451,1451,1493]],\n [9632, [1237,1237]],\n [9642, [726,726,2048]],\n [9650, [2027]],\n [9658, [2027]],\n [9660, [2027]],\n [9668, [2027]],\n [9674, [1012,1237,1217]],\n [9679, [1237,1237,1237,1237,1237,1237,1237,1237,1237,1237,1237]],\n [9702, [726]],\n [9786, [2091,2155,1877]],\n [9791, [1536,1536,1536,1536,1536,1536,1536,1536,1536]],\n [9824, [1088]],\n [9827, [1344]],\n [9829, [1216,1045]],\n [9833, [2048,1024,1536,2048]],\n [9839, [1024]],\n [11360, [1139,455,1139,1366,1479,1139,569,1479,1139,1366,1024,1251,1024,1500]],\n [11377, [1222,2124,1722,1024,1182,871,1328]],\n [11799, [682]],\n [42775, [0,0,0,0,1024,1024,569,569,569,0,0]],\n [42888, [682,569,896,391,391]],\n [64257, [1024,1024]],\n [64285, [532,0,1042,1192,1286,1135,1298,1075,1085,1389,1094,1415,1151,1495,1495,1495,1495,1286,1286,1286,1225,866,1135,1298,532,662]],\n [64312, [1337,532,1094,1075,1085]],\n [64318, [1407]],\n [64320, [797,1343]],\n [64323, [1276,1249]],\n [64326, [1116,1208,1094,1495,1415,532,1225,1075,1249,1286]],\n [65056, [0,0,0,0]],\n [65532, [2048]]\n ]\n}\n", Dn = "{\n \"format\": \"sheetxl-font-metrics/1\",\n \"family\": \"Calibri\",\n \"weight\": 700,\n \"italic\": false,\n \"source\": { \"family\": \"Carlito\", \"version\": \"Version 1.103\", \"license\": \"OFL-1.1\", \"notice\": \"Copyright (c) 2010-2013 by tyPoland Lukasz Dziedzic (http://www.typoland.com/) with Reserved Font Name \\\"Carlito\\\". Licensed under the SIL Open Font License, Version 1.1 (http://scripts.sil.org/OFL).\" },\n \"unitsPerEm\": 2048,\n \"winAscent\": 1950,\n \"winDescent\": 550,\n \"underline\": [-103, 194],\n \"strikeout\": [512, 134],\n \"advances\": [\n [0, [0]],\n [13, [0]],\n [32, [463,667,898,1020,1038,1493,1443,478,638,638,1020,1020,528,627,547,880,1038,1038,1038,1038,1038,1038,1038,1038,1038,1038,565,565,1020,1020,1020,949,1840,1241,1148,1084,1291,999,940,1305,1292,546,678,1120,866,1790,1349,1385,1090,1405,1153,968,1014,1337,1211,1856,1128,1064,979,665,880,665,1020,1020,615,1011,1099,857,1099,1031,648,971,1099,503,523,983,503,1666,1099,1101,1099,1099,728,817,710,1099,969,1526,941,970,814,704,973,704,1020]],\n [161, [667,1020,1038,1020,1038,1020,1020,849,1709,852,1103,1020]],\n [174, [1038,799,701,1020,692,688,616,1154,1224,548,621,517,891,1103,1347,1415,1437,949,1241,1241,1241,1241,1241,1241,1588,1084,999,999,999,999,546,546,546,546,1309,1349,1385,1385,1385,1385,1385,1020,1394,1337,1337,1337,1337,1064,1090,1136,1011,1011,1011,1011,1011,1011,1587,857,1031,1031,1031,1031,503,503,503,503,1099,1099,1101,1101,1101,1101,1101,1020,1114,1099,1099,1099,1099,970,1099,970,1241,1011,1241,1011,1241,1011,1084,857,1084,857,1084,857,1084,857,1291,1222,1309,1165,999,1031,999,1031,999,1031,999,1031,999,1031,1305,971,1305,971,1305,971,1305,971,1292,1099,1347,1121,546,503,546,503,546,503,546,503,546,503,1225,1027,678,523,1120,983,983,866,503,866,503,881,627,1150,865,886,540,1349,1099,1349,1099,1349,1099,1274,1313,1099,1385,1101,1385,1101,1385,1101,1790,1726,1153,728,1153,728,1153,728,968,817,968,817,968,817,968,817,1014,710,1014,744,1014,726,1337,1099,1337,1099,1337,1099,1337,1099,1337,1099,1337,1099,1856,1526,1064,970,1064,979,814,979,814,979,814,529,1170,1368,1138,1099,1171,1119,1075,1243,950,1309,1511,1138,1099,1091,999,1347,1009,940,1020,1395,1210,1646,614,616,1124,983,641,996,1820,1349,1099,1385,1566,1296,1642,1415,1310,1099,1153,975,826,962,913,749,1116,710,1014,1559,1326,1394,1337,1125,1052,979,814,1003,1009,981,884,1038,1038,866,805,1099,541,985,1203,667,2270,2105,1913,1577,1389,1026,2027,1872,1622,1241,1011,546,503,1385,1101,1337,1099,1337,1099,1337,1099,1337,1099,1337,1099,1031,1241,1011,1241,1011,1588,1587,1321,1140,1305,971,1120,983,1385,1101,1385,1101,1003,937,523,2245,2105,1913,1305,971,1812,1254,1349,1099,1241,1011,1588,1587,1394,1114,1241,1011,1241,1011,999,1031,999,1031,546,503,546,503,1385,1101,1385,1101,1153,728,1153,728,1337,1099,1337,1099,968,817,1014,710,1003,937,1292,1099,1315,1243,1081,1055,1004,826,1241,1011,999,1031,1385,1101,1385,1101,1385,1101,1385,1101,1064,970,676,1276,719,523,1693,1695,1241,1094,866,901,1034,817,814,898,890,1174,1374,1216,1000,1019,707,608,1295,1099,1181,776,1204,1010,1011,1099,1100,1099,867,904,1099,1121,1031,1031,1316,874,874,1103,1079,597,1118,1098,1098,980,992,1099,1099,1099,619,586,503,807,824,516,1195,1666,1666,1666,1099,1099,1128,1097,1473,1447,1432,728,728,729,728,728,672,672,1002,1002,817,494,582,494,671,710,710,1201,1197,1089,969,1526,970,948,824,981,937,942,898,898,898,857,1325,1013,1079,1108,1117,676,983,828,1120,898,898,1716,1789,1883,1314,1030,1439,1634,1268,1214,1075,1007,1117,1118,763,763,388,512,502,524,692,1051,678,439]],\n [699, [528,528,528,462,462,665,665,1020,1020,1099,1099,822,822,593]],\n [715, [615,593,807,615,616,569,569,462,462,682,682,682,682,788,482,671,646,910,995,682,682,682,374,570,681,665,784,784,784,784,784,682,682,822,1178,891,682,682,682,682,671]],\n [757, [961]],\n [759, [910,565,682,682,682,682,1088,1088,770]],\n [773, [0]],\n [781, [0,0,0,0,0]],\n [787, [0,0,508]],\n [792, [0,0,0,682,0,0,0,0,0,0,0]],\n [805, [0]],\n [809, [0,0,0]],\n [815, [0]],\n [818, [0,0]],\n [822, [0]],\n [825, [0,0,0,0,0,0,0]],\n [835, [0]],\n [838, [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]],\n [857, [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]],\n [884, [528,528]],\n [890, [562,867,857,867,565]],\n [900, [649,1012,1241,548,999,1292,546]],\n [908, [1385]],\n [910, [1064,1394,586,1241,1148,839,1183,999,979,1292,1385,546,1120,1216,1790,1349,1008,1385,1292,1090]],\n [931, [962,1014,1064,1641,1128,1654,1394,546,1064,1210,937,1114,586,1123,1210,1117,957,1091,937,746,1114,1116,586,983,996,1154,965,789,1101,1186,1086,833,1115,804,1123,1432,923,1511,1470,586,1123,1101,1123,1470]],\n [976, [1098,1208,1071,1071,1071,1441,1733,1252,1385,1101,1075,839,940,914,1131,967,1228,1232,1809,1666,1117,1081,1148,1067,1038,860,1190,974,1368,1105,1031,826,1239,1082,857,523,1385,916,916,1090,1119,1084,1470,1262,1086,1110,1084,1110,999,999,1302,885,1103,968,546,546,678,1834,1836,1295,1153,1335,1121,1287,1241,1138,1148,885,1378,999,1705,987,1335,1335,1153,1288,1790,1292,1385,1290,1090,1084,1014,1121,1482,1128,1347,1166,1837,1898,1309,1635,1133,1103,1871,1176,1011,1090,1013,726,1192,1031,1509,874,1140,1140,1013,1077,1461,1117,1101,1094,1099,857,798,970,1383,941,1151,1000,1563,1616,1143,1458,1013,895,1542,1020,1031,1031,1133,726,896,817,503,503,523,1590,1626,1121,1013,1140,970,1100,1938,1473,1306,1089,1599,1337,1333,1173,1832,1615,1490,1282,1960,1722,1010,870,1654,1511,1385,1097,1253,1017]],\n [1143, [1017,2250,1960,1465,1200,1938,1628,1938,1473,1060,834,1248,0,0,0,0]],\n [1160, [2018,1944,1416,1206,1163,1031,1090,1099,889,752,903,774,1135,935,1818,1598,987,874,1268,1099,1203,1083,1180,1047,1323,1165,1378,1172,1490,1269,1880,1524,1351,1155,1084,857,1014,797,1064,975,1064,975,1239,1026,1541,1254,1227,1086,1166,1030,1166,1030,1597,1285,1597,1285,546,1705,1509,1196,1040,1368,1143,1292,1116,1373,1182,1166,1030,1871,1505,546,1241,1011,1241,1011,1588,1587,999,1031,1347,1031,1347,1031,1705,1509,987,874,1003,937,1335,1140,1335,1140,1385,1101,1385,1101,1385,1101,1103,895,1121,970,1121,970,1121,970,1166,1000,874,726,1635,1458,903,774,1223,1022,1128,941,1133,1099,1673,1595,1536,1395,1078,970,1808,1584,1812,1623,1318,1117,1299,1157,1009,874,1348,1134]],\n [3647, [1038]],\n [7424, [1063,1399,1587,1061,955,1122,1122,864]],\n [7433, [503,621,994,762,1461,1140,1192,955,1162,1161,1320,1726,953,1101,1101,987,1014,1014,853,1158,1135,1507,1175,1033,1595,878,860,817,1012,780,1003,1141,987,1444,1098,787,1047,778,807,875,695,695,892,871,432,517,756,615,1178,914,909,929,761,756,781,688,888,1185,703,684,757,1068,757,757,711,696,635,631,668,378,704,1132,761,757,580,742,742,757,506,763]],\n [7514, [1132,677,679,754,638,732,977,706,378,512,763,677,754,638,749,977,706,1691,1247,1242,813,1907,1362,1212,870,829,1004,813,880,971,813,994,1711,620,669,1140,1250,1236,1099,1198,680,1461,1131,583,1751,1184,1099,728,941,876,979,1070,850,1208,1234,1130,1041,904,874,1041,630,867,494,1224,907,741,580,622,736,631,464,449,668,763,503,434,378,504,557,444,435,584,1132,1132,812,812,802,757,951,570,522,531,855,816,747,740,705,570,670,714,674,790,0,0,0,0,0,0,0,0,0,0,0]],\n [7678, [0,0,1241,1011,1148,1099,1148,1099,1148,1099,1084,857,1291,1099,1291,1099,1291,1099,1291,1099,1291,1099,999,1031,999,1031,999,1031,999,1031,999,1031,940,648,1305,971,1292,1099,1292,1099,1292,1099,1292,1099,1292,1099,546,503,546,503,1120,983,1120,983,1120,983,866,503,866,503,866,503,866,503,1790,1666,1790,1666,1790,1666,1349,1099,1349,1099,1349,1099,1349,1099,1385,1101,1385,1101,1385,1101,1385,1101,1090,1099,1090,1099,1153,728,1153,728,1153,728,1153,728,968,817,968,817,968,817,968,817,968,817,1014,710,1014,710,1014,710,1014,710,1337,1099,1337,1099,1337,1099,1337,1099,1337,1099,1211,969,1211,969,1856,1526,1856,1526,1856,1526,1856,1526,1856,1526,1128,941,1128,941,1064,970,979,814,979,814,979,814,1099,710,1526,970,1011,529]],\n [7838, [1173]],\n [7840, [1241,1011,1241,1011,1241,1011,1241,1011,1241,1011,1241,1011,1241,1011,1241,1011,1241,1011,1241,1011,1241,1011,1241,1011,999,1031,999,1031,999,1031,999,1031,999,1031,999,1031,999,1031,999,1031,546,503,546,503,1385,1101,1385,1101,1385,1101,1385,1101,1385,1101,1385,1101,1385,1101,1428,1296,1428,1296,1428,1296,1428,1296,1428,1296,1337,1099,1337,1099,1559,1326,1559,1326,1559,1326,1559,1326,1559,1326,1064,970,1064,970,1064,970,1064,970]],\n [7936, [1210,1210,1210,1210,1210,1210,1210,1210,1241,1241,1241,1241,1241,1241,1241,1241,937,937,937,937,937,937]],\n [7960, [999,999,1258,1258,1258,1258]],\n [7968, [1114,1114,1114,1114,1114,1114,1114,1114,1292,1292,1551,1551,1551,1551,1479,1479,586,586,586,586,586,586,586,586,546,546,805,805,805,805,733,546,1101,1101,1101,1101,1101,1101]],\n [8008, [1385,1385,1590,1590,1590,1590]],\n [8016, [1123,1123,1123,1123,1123,1123,1123,1123]],\n [8025, [1064]],\n [8027, [1425]],\n [8029, [1425]],\n [8031, [1425,1470,1470,1470,1470,1470,1470,1470,1470,1394,1394,1598,1598,1598,1598,1523,1530,1210,1210,937,937,1114,1114,586,586,1101,1101,1123,1123,1470,1470]],\n [8064, [1210,1210,1210,1210,1210,1210,1210,1210,1241,1241,1241,1241,1241,1241,1241,1241,1114,1114,1114,1114,1114,1114,1114,1114,1292,1292,1551,1551,1551,1551,1479,1479,1470,1470,1470,1470,1470,1470,1470,1470,1394,1394,1598,1598,1598,1598,1530,1530,1210,1210,1210,1210,1210]],\n [8118, [1210,1210,1241,1241,1241,1241,1241,473]],\n [8127, [473,922,804,1114,1114,1114]],\n [8134, [1114,1114,999,999,1292,1292,1292,809,809,804,586,586,586,586]],\n [8150, [586,586,546,546,546,546]],\n [8157, [809,809,804,1123,1123,1123,1123,1086,1086,1123,1123,1064,1064,1064,1064,1090,1012,1012,649]],\n [8178, [1470,1470,1470]],\n [8182, [1470,1470,1385,1385,1394,1394,1394,649,473]],\n [8192, [1024,2048,1024,2048,687,512,341,1038,444,409,256,0,0,0,0,0]],\n [8210, [1038,1020,1854,1854,985,1022,528,528,528,528,891,891,891,891,1020,1020,1020]],\n [8230, [1457]],\n [8239, [463,2174]],\n [8243, [835,1221]],\n [8249, [705,705]],\n [8252, [1202,1034,1020]],\n [8260, [728]],\n [8286, [601,455]],\n [8304, [815,378]],\n [8308, [749,690,740,669,749,740,727,720,711,455,455,761,815,517,692,688,749,690,740,669,749,740,727,720,711,455,455,652,703,696,757,681,711]],\n [8352, [1323,1114,1084,950,1038,1666,1411,1884,1563,1945,1565,1165,1038,1148,1014,2286,1149,1211,1249,1274,1063,1084]],\n [8376, [1038,1038]],\n [8413, [2036]],\n [8453, [1589]],\n [8467, [1081]],\n [8470, [2142,1709]],\n [8480, [1497]],\n [8482, [1475]],\n [8486, [1394]],\n [8494, [1513]],\n [8498, [940]],\n [8525, [1569,750]],\n [8531, [1428,1530,1428,1530,1515,1543,1370,1457,1426,1512,1512,1392,812]],\n [8579, [1084,867]],\n [8592, [1854,1854,1854,1854,2683,1574,1719,1719,1719,1719]],\n [8616, [967]],\n [8706, [1100]],\n [8710, [1183]],\n [8719, [1602]],\n [8721, [1127,1020]],\n [8725, [780]],\n [8730, [1020]],\n [8734, [1716,1400]],\n [8745, [1437]],\n [8747, [769]],\n [8776, [1020]],\n [8800, [1020,1020]],\n [8804, [1020,1020]],\n [8962, [1793]],\n [8976, [1020]],\n [8992, [1106,1106]],\n [9312, [2720,2720,2720,2720,2720,2720,2720,2720,2720,2720,2720,2720,2720,2720,2720,2720,2720,2720,2720,2720]],\n [9450, [2720,2720,2720,2720,2720,2720,2720,2720,2720,2720,2720]],\n [9471, [2720,1024]],\n [9474, [1024]],\n [9484, [1024]],\n [9488, [1024]],\n [9492, [1024]],\n [9496, [1024]],\n [9633, [1237]],\n [9642, [725,725]],\n [9674, [1093,1126,1217]],\n [9679, [1237]],\n [9702, [725]],\n [9728, [1506]],\n [9788, [1506]],\n [9833, [0]],\n [10102, [2720,2720,2720,2720,2720,2720,2720,2720,2720,2720]],\n [11360, [912,656,996,1123,1153,1011,761,1378,1160,1228,1069,1013,829]],\n [11380, [1012,1001,846,1433]],\n [11799, [656]],\n [42775, [807,807,804,682]],\n [42784, [1810,1810]],\n [63743, [1522]],\n [64256, [1230,1135,1135,1718,1718]],\n [65056, [0,0,0,0]],\n [65279, [0]]\n ]\n}\n", On = "{\n \"format\": \"sheetxl-font-metrics/1\",\n \"family\": \"Calibri\",\n \"weight\": 400,\n \"italic\": false,\n \"source\": { \"family\": \"Carlito\", \"version\": \"Version 1.103\", \"license\": \"OFL-1.1\", \"notice\": \"Copyright (c) 2010-2013 by tyPoland Lukasz Dziedzic (http://www.typoland.com/) with Reserved Font Name \\\"Carlito\\\". Licensed under the SIL Open Font License, Version 1.1 (http://scripts.sil.org/OFL).\" },\n \"unitsPerEm\": 2048,\n \"winAscent\": 1950,\n \"winDescent\": 550,\n \"underline\": [-103, 194],\n \"strikeout\": [512, 134],\n \"advances\": [\n [0, [0]],\n [13, [0]],\n [32, [463,667,821,1020,1038,1464,1397,452,621,621,1020,1020,511,627,517,791,1038,1038,1038,1038,1038,1038,1038,1038,1038,1038,548,548,1020,1020,1020,949,1831,1185,1114,1092,1260,1000,941,1292,1276,516,653,1064,861,1751,1322,1356,1058,1378,1112,941,998,1314,1162,1822,1063,998,959,628,791,628,1020,1020,596,981,1076,866,1076,1019,625,964,1076,470,490,931,470,1636,1076,1080,1076,1076,714,801,686,1076,925,1464,887,927,809,644,943,644,1020]],\n [161, [667,1020,1038,1020,1038,1020,1020,804,1709,824,1049,1020]],\n [174, [1038,807,694,1020,688,685,598,1126,1200,517,629,504,865,1049,1303,1375,1383,949,1185,1185,1185,1185,1185,1185,1563,1092,1000,1000,1000,1000,516,516,516,516,1279,1322,1356,1356,1356,1356,1356,1020,1359,1314,1314,1314,1314,998,1058,1080,981,981,981,981,981,981,1583,866,1019,1019,1019,1019,470,470,470,470,1076,1076,1080,1080,1080,1080,1080,1020,1084,1076,1076,1076,1076,927,1076,927,1185,981,1185,981,1185,981,1092,866,1092,866,1092,866,1092,866,1260,1164,1279,1130,1000,1019,1000,1019,1000,1019,1000,1019,1000,1019,1292,964,1292,964,1292,964,1292,964,1276,1076,1344,1091,516,470,516,470,516,470,516,470,516,470,1170,960,653,490,1064,931,931,861,470,861,470,866,540,1118,765,880,507,1322,1076,1322,1076,1322,1076,1186,1287,1076,1356,1080,1356,1080,1356,1080,1775,1740,1112,714,1112,714,1112,714,941,801,941,801,941,801,941,801,998,686,998,708,998,700,1314,1076,1314,1076,1314,1076,1314,1076,1314,1076,1314,1076,1822,1464,998,927,998,959,809,959,809,959,809,497,1130,1260,1101,1076,1088,1076,1122,1181,947,1279,1406,1101,1076,1072,1000,1317,970,941,1020,1294,1162,1603,592,550,1064,931,577,948,1801,1322,1100,1356,1428,1184,1583,1342,1252,1076,1112,941,801,939,882,736,1087,686,998,1478,1234,1360,1314,1090,1020,959,809,970,970,970,870,1038,1038,872,801,1076,499,809,1175,667,2219,2069,1885,1539,1351,960,1975,1812,1566,1185,981,516,470,1356,1080,1314,1076,1314,1076,1314,1076,1314,1076,1314,1076,1019,1185,981,1185,981,1563,1583,1292,1100,1292,964,1064,931,1356,1080,1356,1080,970,970,490,2197,2069,1885,1292,964,1832,1236,1322,1076,1185,981,1563,1583,1359,1084,1185,981,1185,981,1000,1019,1000,1019,516,470,516,470,1356,1080,1356,1080,1112,714,1112,714,1314,1076,1314,1076,941,801,998,686,970,970,1276,1076,1316,1229,1038,1038,1007,844,1185,981,1000,1019,1356,1080,1356,1080,1356,1080,1356,1080,998,927,649,1259,686,490,1683,1682,1185,1092,866,861,998,801,809,916,916,1131,1349,1173,1000,1019,673,576,1290,1076,1129,767,1184,994,981,1076,1076,1076,866,923,1076,1076,1019,1019,1307,866,866,1077,1083,577,1076,1076,1105,925,976,1075,1076,1076,577,562,470,743,761,470,1158,1635,1635,1636,1076,1076,1107,1080,1459,1426,1334,714,714,714,714,714,654,654,920,920,801,490,578,490,650,686,686,1188,1142,1109,925,1464,927,849,809,979,956,955,916,916,916,866,1287,981,1083,1131,1095,650,931,793,1076,916,916,1647,1748,1817,1267,964,1402,1548,1198,1129,1007,1007,1076,1101,745,745,365,502,502,515,651,1007,646,452]],\n [699, [511,511,511,462,462,665,665,1020,1020,1099,1099,809,809,593]],\n [715, [596,593,807,596,598,569,569,462,462,682,682,682,682,780,462,657,639,922,961,682,682,609,350,560,638,665,784,784,784,784,784,682,682,809,1178,857,682,682,682,682,657]],\n [757, [961]],\n [759, [922,548,682,682,682,682,1088,1088,770]],\n [773, [0]],\n [781, [0,0,0,0,0]],\n [787, [0,0,511]],\n [792, [0,0,0,682,0,0,0,0,0,0,0]],\n [805, [0]],\n [809, [0,0,0]],\n [815, [0]],\n [818, [0,0]],\n [822, [0]],\n [825, [0,0,0,0,0,0,0]],\n [835, [0]],\n [838, [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]],\n [857, [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]],\n [884, [511,511]],\n [890, [562,866,866,866,548]],\n [900, [649,1012,1185,517,1000,1276,516]],\n [908, [1356]],\n [910, [998,1360,562,1185,1114,851,1156,1000,959,1276,1356,516,1064,1173,1751,1322,1007,1356,1276,1058]],\n [931, [939,998,998,1555,1063,1536,1360,516,998,1162,933,1100,562,1109,1162,1088,914,1072,933,712,1100,1089,562,931,948,1126,919,770,1080,1132,1042,841,1089,793,1109,1334,873,1449,1426,562,1109,1080,1109,1426]],\n [976, [1074,1144,998,1110,998,1339,1668,1239,1356,1080,1092,841,941,888,1117,921,1186,1186,1801,1636,1116,1071,1138,1048,1092,858,1232,1035,1378,1089,969,806,1239,1042,866,490,1356,885,885,1058,1142,1092,1431,1221,1042,1092,1092,1092,1000,1000,1279,880,1121,941,516,516,653,1786,1795,1266,1112,1314,1080,1269,1185,1101,1114,880,1319,1000,1640,970,1314,1314,1112,1251,1751,1276,1356,1273,1058,1092,998,1080,1428,1063,1308,1138,1778,1822,1259,1560,1088,1122,1800,1137,981,1091,981,708,1143,1019,1411,866,1107,1107,950,1045,1385,1095,1080,1066,1076,866,793,927,1278,887,1109,960,1492,1534,1098,1364,962,907,1478,971,1019,1019,1107,708,909,801,470,470,490,1538,1576,1091,950,1107,927,1075,1900,1386,1284,1063,1601,1332,1291,1075,1703,1455,1480,1152,1855,1547,970,846,1536,1449,1356,1073,1208,978]],\n [1143, [978,2140,1861,1356,1180,1900,1602,1900,1386,1092,866,1248,0,0,0,0]],\n [1160, [2018,1944,1358,1119,1088,991,1058,1076,886,725,870,761,1089,927,1714,1472,970,866,1189,1012,1112,950,1130,1003,1292,1095,1316,1137,1457,1240,1848,1521,1323,1135,1092,866,998,793,998,925,998,925,1142,946,1490,1221,1178,1002,1138,960,1138,960,1526,1224,1526,1224,516,1640,1411,1119,975,1294,1057,1276,1095,1276,1108,1138,960,1799,1462,516,1185,981,1185,981,1563,1583,1000,1019,1317,1019,1317,1019,1640,1411,970,866,970,956,1314,1107,1314,1107,1356,1080,1356,1073,1356,1073,1122,907,1080,927,1080,927,1080,927,1138,960,851,708,1560,1364,870,761,1157,945,1063,887,1088,1076,1629,1621,1565,1435,1050,954,1807,1567,1832,1616,1301,1093,1313,1153,970,866,1289,1067]],\n [3647, [1038]],\n [7424, [982,1295,1583,1042,971,1092,1113,831]],\n [7433, [470,551,913,752,1385,1107,1140,971,1193,1192,1320,1740,872,1080,1080,936,975,975,831,1130,1125,1479,1636,990,1550,847,815,801,976,754,990,1104,936,1327,1038,757,1009,743,763,843,680,680,836,859,422,459,736,603,1133,885,885,885,690,728,667,599,788,1093,684,684,741,1067,741,741,696,696,631,631,663,355,663,1110,742,742,590,742,742,741,483,745]],\n [7514, [1110,645,586,702,582,643,869,607,355,502,745,645,702,582,741,869,607,1684,1211,1213,778,1692,1204,1214,850,794,925,783,809,964,772,964,1672,577,617,1128,1243,1220,1076,1105,625,1356,1054,496,1663,1105,1076,714,891,762,925,1005,828,1148,1240,1076,1019,866,866,1019,470,866,563,1240,886,741,590,622,690,631,449,449,663,745,402,426,355,402,485,404,379,548,1110,1110,795,796,772,742,822,560,365,484,745,696,742,742,645,567,660,678,626,742,0,0,0,0,0,0,0,0,0,0,0]],\n [7678, [0,0,1185,981,1114,1076,1114,1076,1114,1076,1092,866,1260,1076,1260,1076,1260,1076,1260,1076,1260,1076,1000,1019,1000,1019,1000,1019,1000,1019,1000,1019,941,625,1292,964,1276,1076,1276,1076,1276,1076,1276,1076,1276,1076,516,470,516,470,1064,931,1064,931,1064,931,861,470,861,470,861,470,861,470,1751,1636,1751,1636,1751,1636,1322,1076,1322,1076,1322,1076,1322,1076,1356,1080,1356,1080,1356,1080,1356,1080,1058,1076,1058,1076,1112,714,1112,714,1112,714,1112,714,941,801,941,801,941,801,941,801,941,801,998,686,998,686,998,686,998,686,1314,1076,1314,1076,1314,1076,1314,1076,1314,1076,1162,925,1162,925,1822,1464,1822,1464,1822,1464,1822,1464,1822,1464,1063,887,1063,887,998,927,959,809,959,809,959,809,1076,686,1464,927,981,497]],\n [7838, [1149]],\n [7840, [1185,981,1185,981,1185,981,1185,981,1185,981,1185,981,1185,981,1185,981,1185,981,1185,981,1185,981,1185,981,1000,1019,1000,1019,1000,1019,1000,1019,1000,1019,1000,1019,1000,1019,1000,1019,516,470,516,470,1356,1080,1356,1080,1356,1080,1356,1080,1356,1080,1356,1080,1356,1080,1428,1184,1428,1184,1428,1184,1428,1184,1428,1184,1314,1076,1314,1076,1478,1234,1478,1234,1478,1234,1478,1234,1478,1234,998,927,998,927,998,927,998,927]],\n [7936, [1162,1162,1162,1162,1162,1162,1162,1162,1185,1185,1185,1185,1185,1185,1185,1185,933,933,933,933,933,933]],\n [7960, [1000,1000,1213,1213,1213,1217]],\n [7968, [1100,1100,1100,1100,1100,1100,1100,1100,1276,1276,1489,1489,1489,1489,1369,1369,562,562,562,562,562,562,562,562,516,516,729,729,729,729,609,609,1080,1080,1080,1080,1080,1080]],\n [8008, [1356,1356,1548,1541,1525,1522]],\n [8016, [1109,1109,1109,1109,1109,1109,1109,1109]],\n [8025, [998]],\n [8027, [1299]],\n [8029, [1303]],\n [8031, [1183,1426,1426,1426,1426,1426,1426,1426,1426,1360,1360,1549,1553,1522,1522,1433,1433,1162,1162,933,933,1100,1100,562,562,1080,1080,1109,1109,1426,1426]],\n [8064, [1162,1162,1162,1162,1162,1162,1162,1162,1185,1185,1185,1185,1185,1185,1185,1185,1100,1100,1100,1100,1100,1100,1100,1100,1276,1276,1489,1489,1489,1489,1369,1369,1426,1426,1426,1426,1426,1426,1426,1426,1360,1360,1549,1553,1522,1522,1433,1433,1162,1162,1162,1162,1162]],\n [8118, [1162,1162,1185,1185,1185,1185,1185,473]],\n [8127, [473,922,804,1100,1100,1100]],\n [8134, [1100,1100,1000,1000,1276,1276,1276,809,809,804,562,562,562,562]],\n [8150, [562,562,516,516,516,516]],\n [8157, [809,809,804,1109,1109,1109,1109,1042,1042,1109,1109,998,998,998,998,1058,1012,1012,649]],\n [8178, [1426,1426,1426]],\n [8182, [1426,1426,1356,1356,1360,1360,1360,649,473]],\n [8192, [1024,2048,1024,2048,687,512,341,1104,444,409,256,0,0,0,0,0]],\n [8210, [1038,1020,1854,1854,809,1020,511,511,511,511,857,857,857,856,1020,1020,1020]],\n [8230, [1414]],\n [8239, [463,2126]],\n [8243, [820,1188]],\n [8249, [694,694]],\n [8252, [1142,990,1020]],\n [8260, [689]],\n [8286, [548,455]],\n [8304, [801,355]],\n [8308, [731,678,735,657,737,735,746,735,720,444,444,742,801,504,688,685,731,678,735,657,737,735,746,735,720,444,444,631,684,696,742,638,696]],\n [8352, [1262,1092,1092,941,1038,1636,1322,1888,1608,1822,1525,1130,1038,1064,998,2216,1082,1154,1202,1173,941,1092]],\n [8376, [1038,1038]],\n [8413, [2036]],\n [8453, [1569]],\n [8467, [1029]],\n [8470, [2099,1709]],\n [8480, [1452]],\n [8482, [1444]],\n [8486, [1360]],\n [8494, [1513]],\n [8498, [941]],\n [8525, [1569,750]],\n [8531, [1385,1481,1385,1481,1463,1485,1326,1405,1363,1442,1442,1322,787]],\n [8579, [1092,866]],\n [8592, [1854,1854,1854,1854,2638,1592,1806,1806,1806,1806]],\n [8616, [967]],\n [8706, [1091]],\n [8710, [1156]],\n [8719, [1637]],\n [8721, [1108,1020]],\n [8725, [689]],\n [8730, [1020]],\n [8734, [1747,1400]],\n [8745, [1437]],\n [8747, [749]],\n [8776, [1020]],\n [8800, [1020,1020]],\n [8804, [1020,1020]],\n [8962, [1793]],\n [8976, [1020]],\n [8992, [1106,1106]],\n [9312, [2720,2720,2720,2720,2720,2720,2720,2720,2720,2720,2720,2720,2720,2720,2720,2720,2720,2720,2720,2720]],\n [9450, [2720,2720,2720,2720,2720,2720,2720,2720,2720,2720,2720]],\n [9471, [2720,1024]],\n [9474, [1024]],\n [9484, [1024]],\n [9488, [1024]],\n [9492, [1024]],\n [9496, [1024]],\n [9633, [1237]],\n [9642, [725,725]],\n [9674, [1046,1126,1217]],\n [9679, [1237]],\n [9702, [725]],\n [9728, [1500]],\n [9788, [1500]],\n [9833, [0]],\n [10102, [2720,2720,2720,2720,2720,2720,2720,2720,2720,2720]],\n [11360, [861,577,962,1075,1112,981,686,1316,1123,1137,987,994,836]],\n [11380, [962,949,793,1339]],\n [11799, [627]],\n [42775, [807,807,804,682]],\n [42784, [1810,1810]],\n [63743, [1522]],\n [64256, [1195,1084,1084,1654,1654]],\n [65056, [0,0,0,0]],\n [65279, [0]]\n ]\n}\n", kn, An, jn = [
485
642
  "Arial",
486
643
  "Arial Black",
487
644
  "Brush Script MT",
@@ -497,55 +654,227 @@ var Ot = class {
497
654
  "Times New Roman",
498
655
  "Trebuchet MS",
499
656
  "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);
507
- let t = [];
508
- for (let n = 0; n < e.length; n++) {
509
- let r = e[n];
510
- typeof r == "string" && (r = new Ot(r));
511
- let i = !0;
512
- try {
513
- i = Mt(`document.fonts.check('12px ${r.getFamily()}')`);
514
- } catch {}
515
- let a = {
516
- fontRef: r,
517
- loaded: i
657
+ ], Mn = /* @__PURE__ */ new Map([
658
+ [j.GenericName.Serif, ["Tahoma"]],
659
+ [j.GenericName.SanSerif, ["Calibri"]],
660
+ [j.GenericName.MonoSpace, ["Courier New"]],
661
+ [j.GenericName.Cursive, ["Comic Sans MS"]],
662
+ [j.GenericName.Fantasy, ["Luminari"]],
663
+ [j.GenericName.UISystem, ["Arial"]],
664
+ [j.GenericName.UISerif, ["Tahoma"]],
665
+ [j.GenericName.UISanSerif, ["Arial"]],
666
+ [j.GenericName.UIMonoSpace, ["Courier New"]],
667
+ [j.GenericName.UIRounded, ["Arial"]],
668
+ [j.GenericName.Math, []],
669
+ [j.GenericName.Emoji, []],
670
+ [j.GenericName.Fangsong, []]
671
+ ]), Nn = /* @__PURE__ */ new Map([
672
+ ["aptos", "calibri"],
673
+ ["aptos narrow", "calibri"],
674
+ ["aptos display", "calibri"],
675
+ ["carlito", "calibri"],
676
+ ["caladea", "cambria"],
677
+ ["helvetica", "arial"],
678
+ ["helvetica neue", "arial"],
679
+ ["arial nova", "arial"],
680
+ ["liberation sans", "arial"],
681
+ ["arimo", "arial"],
682
+ ["times", "times new roman"],
683
+ ["liberation serif", "times new roman"],
684
+ ["tinos", "times new roman"],
685
+ ["courier", "courier new"],
686
+ ["liberation mono", "courier new"],
687
+ ["cousine", "courier new"],
688
+ ["sans-serif", "calibri"],
689
+ ["serif", "times new roman"],
690
+ ["monospace", "courier new"],
691
+ ["system-ui", "arial"],
692
+ ["ui-system", "arial"],
693
+ ["ui-sans-serif", "arial"],
694
+ ["ui-rounded", "arial"],
695
+ ["ui-serif", "times new roman"],
696
+ ["ui-monospace", "courier new"]
697
+ ]), Pn = /* @__PURE__ */ new Set([
698
+ "serif",
699
+ "sans-serif",
700
+ "monospace",
701
+ "cursive",
702
+ "fantasy",
703
+ "system-ui",
704
+ "ui-system",
705
+ "ui-serif",
706
+ "ui-sans-serif",
707
+ "ui-monospace",
708
+ "ui-rounded",
709
+ "math",
710
+ "emoji",
711
+ "fangsong"
712
+ ]), Fn = (e) => e.trim().replace(/\s+/g, " ").toLowerCase(), Y = (e, t, n) => `${Fn(e)}|${t ? "b" : ""}${n ? "i" : ""}`, In = eval, Ln = (e) => {
713
+ try {
714
+ return In(`document.fonts.check('12px ${e}')`);
715
+ } catch {
716
+ return !0;
717
+ }
718
+ }, Rn = class e {
719
+ static {
720
+ this._shared = null;
721
+ }
722
+ static getShared() {
723
+ return e._shared ??= new e([new wn()]), e._shared;
724
+ }
725
+ constructor(e) {
726
+ this._entries = /* @__PURE__ */ new Map(), this._resolutions = /* @__PURE__ */ new Map(), this._loading = /* @__PURE__ */ new Set(), this._builtins = /* @__PURE__ */ new Map(), this._fontList = [], this._fontsByFamily = /* @__PURE__ */ new Map(), this._bestMatches = /* @__PURE__ */ new Map(), this._builders = e, this._emitter = new t(this), this._seedBuiltins(), this.setFontList(null);
727
+ }
728
+ getByName(e, t) {
729
+ let n = t?.bold ?? !1, r = t?.italic ?? !1, i = Y(e, n, r), a = this._resolutions.get(i);
730
+ if (a) return a;
731
+ let o = this._resolve(e, n, r);
732
+ return this._resolutions.set(i, o), o;
733
+ }
734
+ load(e) {
735
+ let t = e.map((e) => {
736
+ let t = typeof e == "string" ? { family: e } : e, n = Fn(t.family);
737
+ return Pn.has(n) ? void 0 : this._ensure(n, t.bold ?? !1, t.italic ?? !1).done;
738
+ });
739
+ return Promise.all(t).then(() => {});
740
+ }
741
+ async whenReady() {
742
+ for (; this._loading.size > 0;) await Promise.all(this._loading);
743
+ }
744
+ isLoading() {
745
+ return this._loading.size > 0;
746
+ }
747
+ setAdvanceBuilders(e) {
748
+ this._builders = e, this._entries.clear(), this._seedBuiltins(), this._changed();
749
+ }
750
+ getFontList() {
751
+ return this._fontList;
752
+ }
753
+ setFontList(e) {
754
+ let t = [];
755
+ this._fontsByFamily.clear(), this._bestMatches.clear();
756
+ for (let n of e ?? jn) {
757
+ let e = typeof n == "string" ? new bn(n) : n, r = {
758
+ fontRef: e,
759
+ loaded: Ln(e.getFamily())
760
+ };
761
+ t.push(r), this._fontsByFamily.set(e.getFamily(), r);
762
+ }
763
+ this._fontList = Object.freeze(t);
764
+ }
765
+ findBestMatch(e, t) {
766
+ let n = this._bestMatches.get(e);
767
+ if (n) return n.fontRef ? n : null;
768
+ let r = null;
769
+ for (let n of [e, ...t?.fallbacks ?? []]) {
770
+ r = this._fontsByFamily.get(n) ?? null;
771
+ for (let e of r ? [] : Mn.get(n) ?? []) if (r = this._fontsByFamily.get(e) ?? null, r) break;
772
+ if (r) break;
773
+ }
774
+ return this._bestMatches.set(e, r ?? {
775
+ fontRef: null,
776
+ loaded: !1
777
+ }), r;
778
+ }
779
+ addListeners(e, t) {
780
+ return this._emitter.addListeners(e, t);
781
+ }
782
+ get isIFontCollection() {
783
+ return !0;
784
+ }
785
+ _seedBuiltins() {
786
+ this._builtins = /* @__PURE__ */ new Map();
787
+ for (let e of [
788
+ On,
789
+ Dn,
790
+ En,
791
+ Tn
792
+ ].map((e) => J.fromJSON(JSON.parse(e)))) {
793
+ let t = Y(e.family, e.weight >= 700, e.italic);
794
+ this._builtins.set(t, e), this._entries.set(t, {
795
+ state: "loaded",
796
+ table: e,
797
+ kind: "table",
798
+ done: Promise.resolve()
799
+ });
800
+ }
801
+ }
802
+ _resolve(e, t, n) {
803
+ let r = {
804
+ family: e,
805
+ weight: t ? 700 : 400,
806
+ italic: n
807
+ }, i = Fn(e), a = Pn.has(i) ? void 0 : this._ensure(i, t, n);
808
+ if (a?.state === "loaded") return {
809
+ table: a.table,
810
+ kind: a.kind,
811
+ status: "loaded",
812
+ requested: r
813
+ };
814
+ let o = a?.state === "loading", s = Nn.get(i);
815
+ if (s) {
816
+ let e = this._ensure(s, t, n);
817
+ if (e.state === "loaded") return {
818
+ table: e.table,
819
+ kind: "classified",
820
+ status: o ? "loading" : "loaded",
821
+ requested: r
822
+ };
823
+ o ||= e.state === "loading";
824
+ }
825
+ let c = s === "arial" || i === "arial" ? "arial" : "calibri";
826
+ return {
827
+ table: this._builtins.get(Y(c, t, !1)),
828
+ kind: "generic",
829
+ status: o ? "loading" : a?.state === "error" ? "error" : "loaded",
830
+ requested: r
518
831
  };
519
- t.push(a), G.set(r.getFamily(), a);
520
832
  }
521
- jt = Object.freeze(t);
522
- }
523
- function Nt() {
524
- return jt;
525
- }
526
- var q = /* @__PURE__ */ new Map();
527
- function Pt(e, t) {
528
- let n = q.get(e);
529
- if (n) return n.fontRef === null ? null : n;
530
- let r = [e];
531
- t?.fallbacks && (r = r.concat(t.fallbacks));
532
- let i = null;
533
- for (let e = 0; !i && e < r.length; e++) {
534
- 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]);
538
- }
539
- }
540
- return i ? q.set(e, i) : q.set(e, {
541
- fontRef: null,
542
- loaded: !1
543
- }), i;
544
- }
545
- var Ft, It, J, Lt, Rt = e({
546
- DefaultFontSizes: () => zt,
547
- findNextFontSize: () => Bt
548
- }), zt = Object.freeze([
833
+ _ensure(e, t, n) {
834
+ let r = Y(e, t, n), i = this._entries.get(r);
835
+ if (i) return i;
836
+ let a = {
837
+ state: "loading",
838
+ done: Promise.resolve()
839
+ }, o = {
840
+ family: e,
841
+ weight: t ? 700 : 400,
842
+ italic: n
843
+ }, s = this._builders, c = (async () => {
844
+ try {
845
+ for (let e of s) {
846
+ let t = await e.build(o);
847
+ if (t) return a.table = t, a.kind = e.kind, void (a.state = "loaded");
848
+ }
849
+ a.state = "missing";
850
+ } catch {
851
+ a.state = "error";
852
+ }
853
+ })().finally(() => {
854
+ this._loading.delete(c), this._entries.get(r) === a && this._changed();
855
+ });
856
+ return a.done = c, this._entries.set(r, a), this._loading.add(c), a;
857
+ }
858
+ _changed() {
859
+ this._resolutions.clear(), this._emitter.notify("onCollectionChange");
860
+ }
861
+ };
862
+ (An = kn ||= {}).getShared = function() {
863
+ return Rn.getShared();
864
+ }, An.ResolutionKind = {
865
+ Table: "table",
866
+ Exact: "exact",
867
+ Classified: "classified",
868
+ Generic: "generic"
869
+ }, An.FontStatus = {
870
+ Loading: "loading",
871
+ Loaded: "loaded",
872
+ Error: "error"
873
+ };
874
+ var zn, Bn = e({
875
+ DefaultFontSizes: () => Vn,
876
+ findNextFontSize: () => Hn
877
+ }), Vn = Object.freeze([
549
878
  8,
550
879
  9,
551
880
  10,
@@ -564,108 +893,76 @@ var Ft, It, J, Lt, Rt = e({
564
893
  48,
565
894
  72
566
895
  ]);
567
- function Bt(e, t = !0, n = zt) {
896
+ function Hn(e, t = !0, n = Vn) {
568
897
  if (!n || n.length === 0) return e;
569
898
  if (e === void 0) return n[0];
570
899
  if (t && e >= n[n.length - 1] || !t && e <= n[0]) return e;
571
- let r = I.findEqualOrGreater(n, e);
900
+ let r = R.findEqualOrGreater(n, e);
572
901
  return t ? (n[r] === e && (r += 1), n[r] || --r, n[r]) : (--r, n[r]);
573
902
  }
574
- (Ft ||= {}).SortOn = {
903
+ (zn ||= {}).SortOn = {
575
904
  Value: "value",
576
905
  FillColor: "fillColor",
577
906
  FontColor: "fontColor",
578
907
  Icon: "icon"
579
- }, (J = It ||= {}).Compound = {
580
- Single: "sng",
581
- Double: "dbl",
582
- ThickThin: "thickThin",
583
- ThinThick: "thinThick",
584
- Triple: "tri"
585
- }, J.Align = {
586
- Center: "ctr",
587
- Inset: "in",
588
- Outset: "outset"
589
- }, J.LineCap = {
590
- Butt: "butt",
591
- Round: "round",
592
- Square: "square"
593
- }, J.LineJoin = {
594
- Bevel: "bevel",
595
- Miter: "miter",
596
- Round: "round"
597
- }, J.PresetMarkerShape = {
598
- Single: "none",
599
- Double: "double",
600
- ThickThin: "thickThin",
601
- ThinThick: "thickThin"
602
- }, J.StrokeStyle = {
603
- None: "none",
604
- Dashed: "dashed",
605
- Dotted: "dotted",
606
- LargeDash: "lgDash",
607
- LargeDashDot: "lgDashDot",
608
- LargeDashDotDot: "lgDashDotDot",
609
- Solid: "solid",
610
- SysDash: "sysDash",
611
- SysDashDot: "sysDashDot",
612
- SysDashDotDot: "sysDashDotDot",
613
- SysDot: "sysDot"
614
- }, (Lt ||= {}).Type = {
615
- OuterShadow: "outerShadow",
616
- InnerShadow: "innerShadow",
617
- PresetShadow: "presetShadow",
618
- Glow: "glow",
619
- SoftEdge: "softEdge",
620
- Reflection: "reflection"
621
908
  };
622
- var Y = ut.BuiltInName, Vt = {
623
- [Y.Normal]: V("style.builtin.normal"),
624
- [Y.Comma]: V("style.builtin.comma"),
625
- [Y.Currency]: V("style.builtin.currency"),
626
- [Y.Percent]: V("style.builtin.percent"),
627
- [Y.Comma0]: V("style.builtin.comma0"),
628
- [Y.Currency0]: V("style.builtin.currency0"),
629
- [Y.Hyperlink]: V("style.builtin.hyperlink"),
630
- [Y.FollowedHyperlink]: V("style.builtin.followedHyperlink"),
631
- [Y.Note]: V("style.builtin.note"),
632
- [Y.WarningText]: V("style.builtin.warningText"),
633
- [Y.Title]: V("style.builtin.title"),
634
- [Y.Input]: V("style.builtin.input"),
635
- [Y.Output]: V("style.builtin.output"),
636
- [Y.Calculation]: V("style.builtin.calculation"),
637
- [Y.CheckCell]: V("style.builtin.checkCell"),
638
- [Y.LinkedCell]: V("style.builtin.linkedCell"),
639
- [Y.Total]: V("style.builtin.total"),
640
- [Y.Good]: V("style.builtin.good"),
641
- [Y.Bad]: V("style.builtin.bad"),
642
- [Y.Neutral]: V("style.builtin.neutral"),
643
- [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];
909
+ var Un = {
910
+ TopLeft: "tl",
911
+ Top: "t",
912
+ TopRight: "tr",
913
+ Left: "l",
914
+ Center: "ctr",
915
+ Right: "r",
916
+ BottomLeft: "bl",
917
+ Bottom: "b",
918
+ BottomRight: "br"
919
+ }, X = Ut.BuiltInName, Wn = {
920
+ [X.Normal]: W("style.builtin.normal"),
921
+ [X.Comma]: W("style.builtin.comma"),
922
+ [X.Currency]: W("style.builtin.currency"),
923
+ [X.Percent]: W("style.builtin.percent"),
924
+ [X.Comma0]: W("style.builtin.comma0"),
925
+ [X.Currency0]: W("style.builtin.currency0"),
926
+ [X.Hyperlink]: W("style.builtin.hyperlink"),
927
+ [X.FollowedHyperlink]: W("style.builtin.followedHyperlink"),
928
+ [X.Note]: W("style.builtin.note"),
929
+ [X.WarningText]: W("style.builtin.warningText"),
930
+ [X.Title]: W("style.builtin.title"),
931
+ [X.Input]: W("style.builtin.input"),
932
+ [X.Output]: W("style.builtin.output"),
933
+ [X.Calculation]: W("style.builtin.calculation"),
934
+ [X.CheckCell]: W("style.builtin.checkCell"),
935
+ [X.LinkedCell]: W("style.builtin.linkedCell"),
936
+ [X.Total]: W("style.builtin.total"),
937
+ [X.Good]: W("style.builtin.good"),
938
+ [X.Bad]: W("style.builtin.bad"),
939
+ [X.Neutral]: W("style.builtin.neutral"),
940
+ [X.ExplanatoryText]: W("style.builtin.explanatoryText")
941
+ }, Gn = W("style.builtin.heading"), Kn = W("style.builtin.accent"), qn = W("style.builtin.accentTint"), Jn = /^Heading ([1-4])$/, Yn = /^Accent([1-6])$/, Xn = /^(20|40|60)% - Accent([1-6])$/;
942
+ function Zn(e) {
943
+ let t = Wn[e];
647
944
  if (t) return { key: t };
648
- let n = Gt.exec(e);
945
+ let n = Jn.exec(e);
649
946
  return n ? {
650
- key: Ht,
947
+ key: Gn,
651
948
  params: { n: +n[1] }
652
- } : (n = Kt.exec(e), n ? {
653
- key: Ut,
949
+ } : (n = Yn.exec(e), n ? {
950
+ key: Kn,
654
951
  params: { n: +n[1] }
655
- } : (n = qt.exec(e), n ? {
656
- key: Wt,
952
+ } : (n = Xn.exec(e), n ? {
953
+ key: qn,
657
954
  params: {
658
955
  pct: +n[1],
659
956
  n: +n[2]
660
957
  }
661
958
  } : null));
662
959
  }
663
- var Yt, Xt, Zt, Qt, $t = (e, t, n, r, i) => {
960
+ var Qn, $n, er, tr, nr = (e, t, n, r, i) => {
664
961
  let a = JSON.parse(JSON.stringify(e.definition));
665
962
  a.adjs ||= [];
666
963
  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({
964
+ t > 0 ? (c = t, s = 100 - t, o = G("op.lighterPercent", { percent: t })) : t < 0 && (s = 100 + t, o = G("op.darkerPercent", { percent: -t })), s && a.adjs.push({ [M.AdjustmentType.LumMod]: s }), c && a.adjs.push({ [M.AdjustmentType.LumOff]: c });
965
+ let l = new P({
669
966
  val: a.val,
670
967
  adjs: a.adjs
671
968
  }, n), u = l.toString();
@@ -676,14 +973,14 @@ var Yt, Xt, Zt, Qt, $t = (e, t, n, r, i) => {
676
973
  definition: a
677
974
  };
678
975
  };
679
- function en(e, t, n, r) {
976
+ function rr(e, t, n, r) {
680
977
  let i = [];
681
978
  for (let a = 0; a < e.length; a++) {
682
979
  let o = [];
683
980
  i.push(o);
684
981
  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({
982
+ for (let s = 0; s < i.length; s++) o.push(nr(e[a], i[s], t, n, r));
983
+ }, c = new P({
687
984
  val: e[a].definition.val,
688
985
  adjs: e[a].definition.adjs
689
986
  }, t).toHSLA().lum;
@@ -721,73 +1018,86 @@ function en(e, t, n, r) {
721
1018
  }
722
1019
  return i;
723
1020
  }
724
- (Yt ||= {}).buildPalette = en, Xt ||= {}, Zt ||= {}, Qt ||= {};
725
- var X = null;
726
- function tn() {
727
- if (!X) {
728
- let e = import("./6JKSOvc5czaQB2Bj.mjs").then(({ initializeFunctions: e }) => {
1021
+ (Qn ||= {}).buildPalette = rr, $n ||= {}, er ||= {}, tr ||= {};
1022
+ var Z = null;
1023
+ function ir() {
1024
+ if (!Z) {
1025
+ let e = import("./DOMHmhYzPcLVcpAW.mjs").then(({ initializeFunctions: e }) => {
729
1026
  let t = e(() => null);
730
1027
  return Object.freeze(Array.from(t.keys()));
731
1028
  });
732
1029
  e.catch(() => {
733
- X = null;
734
- }), X = e;
1030
+ Z = null;
1031
+ }), Z = e;
735
1032
  }
736
- return X;
1033
+ return Z;
737
1034
  }
738
- function nn(e) {
1035
+ function ar(e) {
739
1036
  let t = e.trim();
740
1037
  if (!t) return;
741
1038
  let n;
742
1039
  try {
743
- let e = dt.shared().tokenize(t, !1);
1040
+ let e = pe.shared().tokenize(t, !1);
744
1041
  if (e.errors.length > 0) return;
745
1042
  n = e.tokens;
746
1043
  } catch {
747
1044
  return;
748
1045
  }
749
- let i = 0, a = 0;
1046
+ let r = 0, i = 0;
750
1047
  if (n.length === 2) {
751
1048
  let e = n[0].tokenType?.name;
752
- e === "MinOp" ? (i = -1, a = 1) : e === "PlusOp" && (i = 1, a = 1);
1049
+ e === "MinOp" ? (r = -1, i = 1) : e === "PlusOp" && (r = 1, i = 1);
753
1050
  }
754
- if (n.length - a !== 1) return;
755
- let o = n[a], s = o.image;
1051
+ if (n.length - i !== 1) return;
1052
+ let a = n[i], o = a.image;
756
1053
  try {
757
- switch (o.tokenType?.name) {
1054
+ switch (a.tokenType?.name) {
758
1055
  case "NumberToken":
759
1056
  case "ScientificDigit":
760
1057
  case "DigitToken": {
761
- let e = oe(s).value;
762
- return i === 0 ? e : i * e;
1058
+ let e = et(o).value;
1059
+ return r === 0 ? e : r * e;
763
1060
  }
764
- case "StringToken": return i === 0 ? se(s).value : void 0;
765
- case "BooleanToken": return i === 0 ? _(s).value : void 0;
1061
+ case "StringToken": return r === 0 ? ue(o).value : void 0;
1062
+ case "BooleanToken": return r === 0 ? rt(o).value : void 0;
766
1063
  case "LiteralError":
767
- case "RefError": return i === 0 ? r(s).value : void 0;
1064
+ case "RefError": return r === 0 ? l(o).value : void 0;
768
1065
  default: return;
769
1066
  }
770
1067
  } catch {
771
1068
  return;
772
1069
  }
773
1070
  }
774
- function rn(e, t) {
775
- let n = an(e), r = an(t);
776
- 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;
1071
+ function or(e, t) {
1072
+ let n = sr(e), r = sr(t);
1073
+ 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 : I.isError(e) && I.isError(t) ? e.getCode() - t.getCode() : 0 : n - r;
777
1074
  }
778
- function an(e) {
1075
+ function sr(e) {
779
1076
  if (e === null) return 0;
780
1077
  switch (typeof e) {
781
1078
  case "number": return 1;
782
1079
  case "string": return 2;
783
1080
  case "boolean": return 3;
784
- default: return P.isError(e) ? 4 : 5;
1081
+ default: return I.isError(e) ? 4 : 5;
785
1082
  }
786
1083
  }
787
- var on = class {
1084
+ var cr = class {
788
1085
  constructor(e) {
789
1086
  this._children = e;
790
1087
  }
1088
+ getCoords() {
1089
+ let e = this._children, t = null;
1090
+ for (let n = 0; n < e.length; n++) {
1091
+ let r = e[n].getCoords();
1092
+ r && (t = t ? {
1093
+ rowStart: Math.min(t.rowStart, r.rowStart),
1094
+ colStart: Math.min(t.colStart, r.colStart),
1095
+ rowEnd: Math.max(t.rowEnd, r.rowEnd),
1096
+ colEnd: Math.max(t.colEnd, r.colEnd)
1097
+ } : r);
1098
+ }
1099
+ return t;
1100
+ }
791
1101
  getSize() {
792
1102
  let e = this._children, t = e.length, n = 0;
793
1103
  for (let r = 0; r < t; r++) n += e[r].getSize();
@@ -816,19 +1126,19 @@ var on = class {
816
1126
  let n = t[e].getSortedNumbers().getValues();
817
1127
  n.length > 0 && r.push(n);
818
1128
  }
819
- e = new $e(function(e) {
1129
+ e = new gt(function(e) {
820
1130
  let t = e.length;
821
- if (t === 0) return sn;
1131
+ if (t === 0) return lr;
822
1132
  if (t === 1) return e[0];
823
1133
  let n = e[0];
824
- for (let r = 1; r < t; r++) n = cn(n, e[r]);
1134
+ for (let r = 1; r < t; r++) n = ur(n, e[r]);
825
1135
  return Object.freeze(n);
826
1136
  }(r)), this._sortedNumbers = e;
827
1137
  }
828
1138
  return e;
829
1139
  }
830
1140
  getRanked(e) {
831
- return ze(this._children, e, rn)[Symbol.iterator]();
1141
+ return st(this._children, e, or)[Symbol.iterator]();
832
1142
  }
833
1143
  getFrequencies(e) {
834
1144
  if (e) return this._mergeFrequencies(e);
@@ -836,7 +1146,7 @@ var on = class {
836
1146
  return t || (t = this._mergeFrequencies(), this._frequencies = t), t;
837
1147
  }
838
1148
  _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;
1149
+ let t = e?.keyFn ?? se, n = e?.limit, r = /* @__PURE__ */ new Map(), i = this._children, a = i.length, o = 0, s = 0, c = !1;
840
1150
  for (let l = 0; l < a; l++) {
841
1151
  let a = i[l].getFrequencies(e);
842
1152
  o += a.getVisitedCount(), s += a.getTotalCount(), c ||= a.isTruncated();
@@ -849,22 +1159,22 @@ var on = class {
849
1159
  }) : c = !0, d = u.next();
850
1160
  }
851
1161
  }
852
- return ke.fromGroups(r, t, e, rn, o, s, c);
1162
+ return ne.fromGroups(r, t, e, or, o, s, c);
853
1163
  }
854
1164
  getTypedCounts(e) {
855
1165
  let t = this._typedCounts;
856
1166
  if (!t) {
857
1167
  let e = {
858
- [F.Number]: 0,
859
- [F.String]: 0,
860
- [F.Boolean]: 0,
861
- [F.Error]: 0,
862
- [F.RichData]: 0,
863
- [F.Null]: 0
1168
+ [L.Number]: 0,
1169
+ [L.String]: 0,
1170
+ [L.Boolean]: 0,
1171
+ [L.Error]: 0,
1172
+ [L.RichData]: 0,
1173
+ [L.Null]: 0
864
1174
  }, n = this._children, r = n.length;
865
1175
  for (let t = 0; t < r; t++) {
866
1176
  let r = n[t].getTypedCounts();
867
- e[F.Number] += r[F.Number] ?? 0, e[F.String] += r[F.String] ?? 0, e[F.Boolean] += r[F.Boolean] ?? 0, e[F.Error] += r[F.Error] ?? 0, e[F.RichData] += r[F.RichData] ?? 0, e[F.Null] += r[F.Null] ?? 0;
1177
+ e[L.Number] += r[L.Number] ?? 0, e[L.String] += r[L.String] ?? 0, e[L.Boolean] += r[L.Boolean] ?? 0, e[L.Error] += r[L.Error] ?? 0, e[L.RichData] += r[L.RichData] ?? 0, e[L.Null] += r[L.Null] ?? 0;
868
1178
  }
869
1179
  t = Object.freeze(e), this._typedCounts = t;
870
1180
  }
@@ -885,12 +1195,12 @@ var on = class {
885
1195
  sum: 0,
886
1196
  sumSq: 0,
887
1197
  typed: {
888
- [F.Number]: 0,
889
- [F.String]: 0,
890
- [F.Boolean]: 0,
891
- [F.Error]: 0,
892
- [F.RichData]: 0,
893
- [F.Null]: 0
1198
+ [L.Number]: 0,
1199
+ [L.String]: 0,
1200
+ [L.Boolean]: 0,
1201
+ [L.Error]: 0,
1202
+ [L.RichData]: 0,
1203
+ [L.Null]: 0
894
1204
  }
895
1205
  };
896
1206
  for (let i = 0; i < n; i++) {
@@ -899,169 +1209,153 @@ var on = class {
899
1209
  let a = n.numericalCount;
900
1210
  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
1211
  }
902
- return qe(r);
1212
+ return ft(r);
903
1213
  }
904
- }, sn = Object.freeze([]);
905
- function cn(e, t) {
1214
+ }, lr = Object.freeze([]);
1215
+ function ur(e, t) {
906
1216
  let n = e.length, r = t.length, i = Array(n + r), a = 0, o = 0, s = 0;
907
1217
  for (; a < n && o < r;) i[s++] = e[a] <= t[o] ? e[a++] : t[o++];
908
1218
  for (; a < n;) i[s++] = e[a++];
909
1219
  for (; o < r;) i[s++] = t[o++];
910
1220
  return i;
911
1221
  }
912
- var ln = class {
913
- constructor(e) {
914
- this.isIExternalBook = !0, this._json = e;
915
- }
916
- getIdentity() {
917
- return this._json.identity;
1222
+ var dr = class {
1223
+ constructor(e, t) {
1224
+ this._source = null, this.cacheId = e, this.part = t;
1225
+ }
1226
+ _hold(e) {
1227
+ let t = this.part?.xml;
1228
+ if (!t || this._source) return;
1229
+ let n = s(t, "worksheetSource", "ref"), r = s(t, "worksheetSource", "sheet");
1230
+ if (!n || !r || n.includes("#REF!")) return;
1231
+ let i = e(r);
1232
+ if (!i) return;
1233
+ let a = {
1234
+ formula: null,
1235
+ wired: null,
1236
+ last: null
1237
+ };
1238
+ this._source = a, i(`${at(r)}!${tt(n)}`, (e) => {
1239
+ a.formula = e.formula;
1240
+ let t = e.formula.getExpression();
1241
+ a.wired ??= t, e.formula.hasRefError() || (a.last = t);
1242
+ });
918
1243
  }
919
- getSheetNames() {
920
- return this._json.sheetNames;
1244
+ getXML() {
1245
+ let e = this.part?.xml ?? null, t = this._source;
1246
+ if (!e || !t?.formula) return e;
1247
+ let n = t.formula.hasRefError() ? t.last : t.formula.getExpression();
1248
+ if (n === null || n === t.wired) return e;
1249
+ let r = Ge(n);
1250
+ return r ? ce(ce(e, "worksheetSource", "ref", $e(r.reference)), "worksheetSource", "sheet", r.sheet) : ce(e, "worksheetSource", "ref", $e(n));
921
1251
  }
922
- getDefinedNames() {
923
- return this._json.definedNames ?? [];
1252
+ toJSON(e) {
1253
+ let t = { cacheId: this.cacheId }, n = de.toJSON(this.part, e);
1254
+ if (n) {
1255
+ let e = this.getXML();
1256
+ e !== null && (n.xml = e), t.part = n;
1257
+ }
1258
+ return t;
924
1259
  }
925
- getSheetData(e) {
926
- return this._json.sheetDataSet?.find((t) => t.sheetIndex === e) ?? null;
1260
+ }, fr = class {
1261
+ constructor(e, t) {
1262
+ this._deleted = !1, this._json = { ...e }, this._deleteFromCollection = t ?? null;
927
1263
  }
928
- toJSON() {
929
- return this._json;
1264
+ getId() {
1265
+ return this._json.id;
930
1266
  }
931
- }, un = class {
932
- constructor(e) {
933
- this.isIExternalBookCollection = !0, this._items = (e?.json ?? []).map((e) => e ? new ln(e) : null);
1267
+ getDisplayName() {
1268
+ return this._json.displayName;
934
1269
  }
935
- [Symbol.iterator]() {
936
- return this.getItems()[Symbol.iterator]();
1270
+ getUserId() {
1271
+ return this._json.userId ?? null;
937
1272
  }
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;
1273
+ getProviderId() {
1274
+ return this._json.providerId ?? null;
945
1275
  }
946
- getCount() {
947
- return this.getItems().length;
1276
+ delete() {
1277
+ this._deleted || (this._deleted = !0, this._deleteFromCollection?.(this));
948
1278
  }
949
- getByIndex(e) {
950
- return this._items[e - 1] ?? null;
1279
+ isDeleted() {
1280
+ return this._deleted;
951
1281
  }
952
1282
  toJSON() {
953
- return this._items.length === 0 ? null : this._items.map((e) => e?.toJSON() ?? null);
1283
+ return { ...this._json };
954
1284
  }
955
- }, dn = class {
956
- 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;
995
- }
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;
1285
+ get [Symbol.toStringTag]() {
1286
+ return "[Person]";
1006
1287
  }
1007
- getCount() {
1008
- let e = this._getState();
1009
- return e ? Object.keys(e.modules).length : 0;
1288
+ toString() {
1289
+ return `Person:${this.getDisplayName()}`;
1010
1290
  }
1011
- beginCommit(e) {
1012
- return this._beginCommit(e);
1291
+ get isIPerson() {
1292
+ return !0;
1013
1293
  }
1014
- _getState() {
1015
- if (this._closed) throw Error(H("error.model.modelClosed"));
1016
- return this._transactions.getState(this._stateId);
1294
+ }, pr = class extends ge {
1295
+ constructor(e) {
1296
+ super(), this._byId = /* @__PURE__ */ new Map(), this._byDisplayName = /* @__PURE__ */ new Map(), this._items = null, this._current = null, e && this.fromJSON(e);
1017
1297
  }
1018
- _beginCommit(e) {
1019
- return this._transactions.beginCommit(typeof e == "string" ? { description: e } : e);
1298
+ _getItems() {
1299
+ return this._items ??= Array.from(this._byId.values());
1020
1300
  }
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
- }
1301
+ getCount() {
1302
+ return this._byId.size;
1029
1303
  }
1030
- _initState(e) {
1031
- let t = e ?? {};
1032
- this._updateState({ modules: t }, V("op.initialize"), { forceAmend: !0 });
1033
- let n = this._options.onAdd;
1304
+ add(e) {
1305
+ let t = typeof e == "string" ? { displayName: e } : e, n = t.id;
1034
1306
  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
- }
1307
+ let e = this._byId.get(n);
1308
+ if (e) return e;
1040
1309
  }
1310
+ let r = t.displayName ?? "";
1311
+ if (!n) {
1312
+ let e = this._byDisplayName.get(r);
1313
+ if (e) return e;
1314
+ }
1315
+ let i = new fr({
1316
+ ...t,
1317
+ displayName: r,
1318
+ id: n ?? R.uuidV4().toUpperCase()
1319
+ }, (e) => this._remove(e));
1320
+ return this._byId.set(i.getId(), i), r && !this._byDisplayName.has(r) && this._byDisplayName.set(r, i), this._items = null, this._notifyCollectionChange(), i;
1321
+ }
1322
+ getById(e) {
1323
+ return typeof e == "string" ? this._byId.get(e) ?? null : null;
1324
+ }
1325
+ getByDisplayName(e) {
1326
+ return typeof e == "string" ? this._byDisplayName.get(e) ?? null : null;
1327
+ }
1328
+ getCurrent() {
1329
+ return this._current ??= this.add("Author");
1330
+ }
1331
+ setCurrent(e) {
1332
+ if (e !== null) {
1333
+ if (typeof e == "object" && e.isIPerson) {
1334
+ let t = e;
1335
+ this._current = this.getById(t.getId()) ?? this.add(t.toJSON());
1336
+ return;
1337
+ }
1338
+ this._current = this.add(e);
1339
+ } else this._current = null;
1041
1340
  }
1042
- addListeners(e, t) {
1043
- return this._emitter.addListeners(e, t);
1341
+ _remove(e) {
1342
+ 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
1343
  }
1045
1344
  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;
1345
+ return this._byId.size === 0 ? null : this._getItems().map((e) => e.toJSON());
1057
1346
  }
1058
- close() {
1059
- this._closed || (this._emitter.notify("onClose"), this._closed = !0, this._transactionsRemoveListener?.());
1347
+ fromJSON(e) {
1348
+ if (!e) return;
1349
+ let t = e.length;
1350
+ for (let n = 0; n < t; n++) {
1351
+ let t = e[n];
1352
+ t && typeof t.id == "string" && this.add(t);
1353
+ }
1060
1354
  }
1061
- get isFunctionCollection() {
1355
+ get isIPersonCollection() {
1062
1356
  return !0;
1063
1357
  }
1064
- }, fn = (e, t) => {
1358
+ }, mr = (e, t) => {
1065
1359
  let n = [0];
1066
1360
  for (let t = 0; t < e.length; t++) e[t] === "\n" && n.push(t + 1);
1067
1361
  let r = t.map((e) => ` ${((e) => {
@@ -1073,9 +1367,9 @@ var ln = class {
1073
1367
  return `${t + 1}:${e - n[t] + 1}`;
1074
1368
  })(e.start)} ${e.code}: ${e.message}`), i = t.length;
1075
1369
  return `Script has ${i} compile error${i === 1 ? "" : "s"}:\n${r.join("\n")}`;
1076
- }, pn = class {
1370
+ }, hr = class {
1077
1371
  constructor(e) {
1078
- this._options = e, this._emitter = new S(this), this._initState();
1372
+ this._options = e, this._emitter = new t(this), this._initState();
1079
1373
  }
1080
1374
  _initState() {}
1081
1375
  getModules() {
@@ -1084,26 +1378,27 @@ var ln = class {
1084
1378
  _builtInNames() {
1085
1379
  try {
1086
1380
  let e = this._options.getBuiltInFunctions?.();
1087
- if (!e) return I.EmptyArray;
1381
+ if (!e) return R.EmptyArray;
1088
1382
  let t = [];
1089
- for (let n of e.getItems()) n.isBuiltIn() && t.push(n.getName());
1383
+ for (let n of e.getItems({ includeHidden: !0 })) n.isBuiltIn() && t.push(n.getName());
1090
1384
  return t;
1091
1385
  } catch {
1092
- return I.EmptyArray;
1386
+ return R.EmptyArray;
1093
1387
  }
1094
1388
  }
1095
1389
  async createModule(e) {
1096
1390
  let t = await (await import("@sheetxl/scripting")).ScriptCompiler.compile({
1097
1391
  builtInNames: this._builtInNames(),
1392
+ minify: !0,
1098
1393
  ...e
1099
1394
  });
1100
- return t.module ? await T("scripts", t.module, e?.declarationsOnly ?? !1, t.diagnostics) : null;
1395
+ return t.module ? await u(S.DEFAULT_MODULE, t.module, e?.declarationsOnly ?? !1, t.diagnostics) : null;
1101
1396
  }
1102
1397
  addModule(e, t, n) {
1103
1398
  this._modules.add(e, t, n);
1104
1399
  }
1105
1400
  async addModuleFromJSON(e, t, n) {
1106
- let r = await T(e, t);
1401
+ let r = await u(e, t);
1107
1402
  return this.addModule(e, r, n), r;
1108
1403
  }
1109
1404
  executeMacro(e, t, n) {
@@ -1119,7 +1414,7 @@ var ln = class {
1119
1414
  }
1120
1415
  async run(e, t) {
1121
1416
  try {
1122
- let n = typeof e == "string" ? await this.createModule({ source: e }) : await T("scripts", e), r = typeof e == "string" ? e : e?.source ?? "";
1417
+ let n = typeof e == "string" ? await this.createModule({ source: e }) : await u(S.DEFAULT_MODULE, e), r = typeof e == "string" ? e : e?.source ?? "";
1123
1418
  return await this._runModule(n, r, t);
1124
1419
  } catch (e) {
1125
1420
  return {
@@ -1136,14 +1431,20 @@ var ln = class {
1136
1431
  };
1137
1432
  let i = e.getDiagnostics(), a = i.filter((e) => e.severity === "error");
1138
1433
  if (a.length > 0) {
1139
- let e = Error(fn(t, a));
1434
+ let e = Error(mr(t, a));
1140
1435
  return e.diagnostics = a, {
1141
1436
  ok: !1,
1142
1437
  error: e,
1143
1438
  diagnostics: i
1144
1439
  };
1145
1440
  }
1146
- let o = e.getFunctions(), s = (await o.search({ type: "autoRun" }))[0] ?? (await o.search({ type: "macro" }))[0] ?? null;
1441
+ let o = e.getFunctions(), s = o.getItems({
1442
+ type: "autoRun",
1443
+ includeHidden: !0
1444
+ })[0] ?? o.getItems({
1445
+ type: "macro",
1446
+ includeHidden: !0
1447
+ })[0] ?? null;
1147
1448
  if (!s) return {
1148
1449
  ok: !1,
1149
1450
  error: /* @__PURE__ */ Error("The script has no runnable entry. Export a default function taking the script context, e.g. `export default function run(ctx: IScript.ScriptContext) { ... }` (the workbook is `ctx.wb`; a macro may instead take its target first, e.g. `(sheet: ISheet, ctx)`).")
@@ -1156,23 +1457,15 @@ var ln = class {
1156
1457
  diagnostics: i
1157
1458
  };
1158
1459
  }
1159
- async _searchable(e) {
1160
- let t = [];
1161
- if (e?.includeBuiltIn) {
1162
- await this._options.workbook?.getCalculation()?.start();
1163
- let e = this._options.getBuiltInFunctions?.();
1164
- e && t.push(e);
1165
- }
1166
- let n = this._modules;
1167
- if (!n || n.getCount() === 0) return t;
1168
- let r = e?.moduleName, i = r ? n.getItems({ name: r }) : n.getItems(), a = i.length;
1169
- for (let e = 0; e < a; e++) t.push(i[e].getFunctions());
1170
- return t;
1460
+ _searchable(e) {
1461
+ let t = this._modules;
1462
+ return t && t.getCount() !== 0 ? (e ? t.getItems({ name: e }) : t.getItems()).map((e) => e.getFunctions()) : R.EmptyArray;
1171
1463
  }
1172
1464
  async searchFunctions(e) {
1173
1465
  await this._emitter.notify("onBeforeSearch", { async: !0 });
1174
- let t = await this._searchable(e);
1175
- if (t.length === 0) return I.EmptyArray;
1466
+ let t = this._searchable(e?.moduleName);
1467
+ if (t.length === 0) return R.EmptyArray;
1468
+ if (t.length === 1) return t[0].search(e);
1176
1469
  let n = e?.limit, r = n === void 0 ? e : {
1177
1470
  ...e,
1178
1471
  limit: void 0
@@ -1187,38 +1480,12 @@ var ln = class {
1187
1480
  }
1188
1481
  }
1189
1482
  }
1190
- if (!i || i.length === 0) return I.EmptyArray;
1483
+ if (!i || i.length === 0) return R.EmptyArray;
1191
1484
  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;
1193
- }
1194
- async getFunctionCategories(e) {
1195
- await this._emitter.notify("onBeforeSearch", { async: !0 });
1196
- let t = await this._searchable(e);
1197
- if (t.length === 0) return I.EmptyArray;
1198
- if (t.length === 1) return t[0].getCategories(e);
1199
- let n = e?.includeDeprecated ?? !1, r = /* @__PURE__ */ new Map(), i = (e) => {
1200
- let t = e.toUpperCase(), n = r.get(t);
1201
- n ? n.count++ : r.set(t, {
1202
- name: e,
1203
- count: 1
1204
- });
1205
- };
1206
- for (let n of await t[0].getCategories(e)) r.set(n.name.toUpperCase(), {
1207
- name: n.name,
1208
- count: n.count
1209
- });
1210
- for (let r = 1; r < t.length; r++) {
1211
- let a = await t[r].search(e?.type ? { type: e.type } : void 0);
1212
- for (let e = 0; e < a.length; e++) {
1213
- let o = a[e], s = o.getName().toUpperCase(), c = !1;
1214
- for (let e = 0; e < r && !c; e++) c = !!t[e].getByName(s);
1215
- if (c) continue;
1216
- let l = await o.getDescriptor().catch(() => null);
1217
- !n && l?.isDeprecated() || i(l?.getCategory() ?? "Uncategorized");
1218
- }
1219
- }
1220
- let a = Array.from(r.values());
1221
- return a.sort((e, t) => e.name.localeCompare(t.name)), a;
1485
+ return o ? De(i, o) : i.sort((e, t) => {
1486
+ let n = e.getName().toUpperCase(), r = t.getName().toUpperCase();
1487
+ return n < r ? -1 : +(n > r);
1488
+ }), n !== void 0 && i.length > n ? i.slice(0, n) : i;
1222
1489
  }
1223
1490
  async start() {
1224
1491
  if (!this._modules) return this._startPromise || (this._startPromise = this._doStart(), this._startPromise.catch(() => {
@@ -1228,19 +1495,20 @@ var ln = class {
1228
1495
  async _doStart() {
1229
1496
  let e = this._options?.workbook, t = this._options?.json, n = {};
1230
1497
  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];
1498
+ let r = Object.keys(t);
1499
+ for (let i = 0; i < r.length; i++) {
1500
+ let a = r[i], o = t[a];
1234
1501
  try {
1235
- n[i] = await T(i, a);
1502
+ n[a] = await u(a, o, !1, [], o?.scope === "workbook" ? e : null);
1236
1503
  } catch (e) {
1237
- z.error(`Could not load script '${i}'; it will be unavailable.`, e);
1504
+ V.error(`Could not load script '${a}'; it will be unavailable.`, e);
1238
1505
  }
1239
1506
  }
1240
1507
  }
1241
- let r = this, i = new dn({
1508
+ let r = this, i = new b({
1242
1509
  transactions: this._options?.transactions,
1243
1510
  initial: n,
1511
+ isReadOnly: () => r.isReadOnly(),
1244
1512
  onRemove: (e, t) => {
1245
1513
  r._options?.onRemove?.(e, t);
1246
1514
  },
@@ -1250,15 +1518,18 @@ var ln = class {
1250
1518
  });
1251
1519
  this._modules = i;
1252
1520
  let a = i.getItems();
1253
- if (a.length === 0) return Promise.resolve(I.EmptyArray);
1521
+ if (a.length === 0) return Promise.resolve(R.EmptyArray);
1254
1522
  let o = a.length;
1255
1523
  for (let t = 0; t < o; t++) {
1256
1524
  let n = a[t];
1257
1525
  try {
1258
- let t = await n.getFunctions().search({ type: "autoRun" }), r = t.length;
1526
+ let t = n.getFunctions().getItems({
1527
+ type: "autoRun",
1528
+ includeHidden: !0
1529
+ }), r = t.length;
1259
1530
  for (let n = 0; n < r; n++) await t[n].execute(e);
1260
1531
  } catch (e) {
1261
- z.error("Error executing autoRun script:", e);
1532
+ V.error("Error executing autoRun script:", e);
1262
1533
  }
1263
1534
  }
1264
1535
  }
@@ -1266,7 +1537,7 @@ var ln = class {
1266
1537
  return this._emitter.addListeners(e, t);
1267
1538
  }
1268
1539
  isReadOnly() {
1269
- return !1 === this._options.workbook?.getProtection().isStructureAllowed();
1540
+ return this._options.workbook?._isStructureProtected?.() ?? !1;
1270
1541
  }
1271
1542
  toJSON() {
1272
1543
  this._emitter.notify("onBeforeSave");
@@ -1274,11 +1545,15 @@ var ln = class {
1274
1545
  if (!e) throw Error("Scripts is initializing.");
1275
1546
  return e.toJSON();
1276
1547
  }
1277
- }, mn = class {
1548
+ get isIScript() {
1549
+ return !0;
1550
+ }
1551
+ }, gr = class {
1278
1552
  constructor(e, t, n, r) {
1279
- this._mergedReading = [], this._colsReading = [], this._rowsReading = [], this._styles = n, this._topLeft = t ?? L.EmptyCell, this._sheet = new A({
1553
+ this._mergedReading = [], this._colsReading = [], this._rowsReading = [], this._styles = n, this._topLeft = t ?? z.EmptyCell, this._sheet = new O({
1280
1554
  runtime: e,
1281
1555
  styles: this._styles,
1556
+ calcOnLoad: "none",
1282
1557
  container: {
1283
1558
  getName: () => r,
1284
1559
  getIndex: () => 1
@@ -1286,45 +1561,45 @@ var ln = class {
1286
1561
  }), this._builder = this._sheet.getEntireRange().createSparseBuilder();
1287
1562
  }
1288
1563
  applyCSSStyle(e, t) {
1289
- let r = !1;
1290
- e.style || (e.style = {}, r = !0);
1291
- let o = e.style, s = { ...t };
1564
+ let n = !1;
1565
+ e.style || (e.style = {}, n = !0);
1566
+ let r = e.style, i = { ...t };
1292
1567
  if (t.msoIgnore) {
1293
- let e = t.msoIgnore.split(","), n = Object.keys(s);
1568
+ let e = t.msoIgnore.split(","), n = Object.keys(i);
1294
1569
  for (let t = 0; t < n.length; t++) {
1295
1570
  let r = n[t];
1296
- e.includes(r) && delete s[r];
1571
+ e.includes(r) && delete i[r];
1297
1572
  }
1298
1573
  }
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);
1574
+ let a = Gt(i.fontFamily);
1575
+ r.font = {}, a && (r.font.family = a.family, r.font.fallbacks = a.fallbacks, r.font.size = a.size), r.font.size = i.fontSize, r.font.weight = i.fontWeight, r.font.style = i.fontStyle, r.font.color = i.color;
1576
+ let o = Ft(i.textDecoration);
1577
+ r.font.underline = o.underline, r.font.strike = o.strike, i.textUnderlineStyle && (r.font.underline = It(i.textUnderlineStyle)), r.alignment = {}, i?.textAlign && (r.alignment.horizontal = jt(i.textAlign)), i?.textAlign && !r.alignment.horizontal && i?.textAlign !== "general" && (i.textAlign === "center-across" ? r.alignment.horizontal = A.HorizontalAlignment.CenterContinuous : i.textAlign === "fill" ? r.alignment.horizontal = A.HorizontalAlignment.Fill : i.textAlign === "121" || i.textAlign === "010" ? (r.alignment.horizontal = A.HorizontalAlignment.Distributed, r.alignment.justifyLastLine = i.textAlign === "121") : console.warn("unknown text-align", i.textAlign)), i.verticalAlign && (i.verticalAlign.toLowerCase() === "super" ? r.font.verticalAlign = j.VerticalAlignment.Super : i.verticalAlign.toLowerCase() === "sup" ? r.font.verticalAlign = j.VerticalAlignment.Sub : r.alignment.vertical = Rt(i.verticalAlign), r.alignment.vertical || (i.verticalAlign === "121" ? r.alignment.vertical = A.VerticalAlignment.Distributed : console.warn("unknown vertical-align", i.verticalAlign))), i.msoCharIndentCount && (r.alignment.indent = i.msoCharIndentCount), i.whiteSpace && (r.alignment.overflow = i.whiteSpace === "no-wrap" || i.whiteSpace === "nowrap" ? A.Overflow.Visible : A.Overflow.Wrap), i.msoTextControl === "shrinktofit" && (r.alignment.overflow = A.Overflow.Shrink);
1578
+ let s = null;
1579
+ if (i.background ? s = i.background : i.backgroundColor && (s = i.backgroundColor), s && (r.fill = { color: s }), i.msoPattern) {
1580
+ let e = Nt(i.msoPattern);
1581
+ e && (e.patternType === N.BuiltInSheetPattern.Solid ? r.fill = { color: e.foreground } : e.patternType !== N.BuiltInSheetPattern.None && (s && (e.background = s), r.fill = e));
1582
+ }
1583
+ i.layoutFlow === "vertical" || i.layoutFlow === "vertical-ideographic" ? r.alignment.stacked = !0 : i.msoRotate !== void 0 && (r.alignment.rotation = Lt(i.msoRotate));
1584
+ let c = (e, t) => {
1585
+ e && (r.borders ||= {}, r.borders[e] = t);
1311
1586
  };
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;
1587
+ i.border && i.border !== "none" && (c("top", i.border), c("left", i.border), c("right", i.border), c("bottom", i.border)), i.borderTop && c("top", i.borderTop), i.borderLeft && c("left", i.borderLeft), i.borderRight && c("right", i.borderRight), i.borderBottom && c("bottom", i.borderBottom), i.msoDiagonalUp && c("diagonalUp", i.msoDiagonalUp), i.msoDiagonalDown && c("diagonalDown", i.msoDiagonalDown);
1588
+ let l = r.numberFormat;
1589
+ i.msoNumberFormat && (l = Wt(i.msoNumberFormat), l.includes("\\") ? l = null : l === "Fixed" ? l = F.Styles.lookupStyle(r.numberFormat).formatType === F.Type.Number ? null : F.Type.Number : l === "Percent" && (l = F.Styles.lookupStyle(r.numberFormat).formatType === F.Type.Percentage ? null : F.Type.Percentage)), l && (r.numberFormat = l), e.style = this._styles.normalize(r), n && Object.keys(e.style).length === 0 && delete e.style;
1315
1590
  }
1316
1591
  onCell(e, t, n, r, i) {
1317
1592
  let a = r(i), o = { value: t === void 0 ? n ?? "" : t };
1318
1593
  if (typeof o.value == "string" && o.value.length === 0 && (o.value = void 0), a && this.applyCSSStyle(o, a), i?.tagName.toUpperCase() === "TD") {
1319
1594
  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);
1595
+ (i.querySelectorAll("s").length > 0 || i.querySelectorAll("strike").length > 0) && (t.strike = !0), i.querySelectorAll("sub").length > 0 && (t.verticalAlign = j.VerticalAlignment.Sub), i.querySelectorAll("sup").length > 0 && (t.verticalAlign = j.VerticalAlignment.Super), (i.querySelectorAll("b").length > 0 || i.querySelectorAll("strong").length > 0) && (t.weight = 700), i.querySelectorAll("i").length > 0 && (t.style = j.Style.Italic), i.querySelectorAll("u").length > 0 && (t.underline = j.UnderlineStyle.Single), Object.keys(t).length > 0 && (e || (e = {}, o.style = e), e.font || (e.font = t));
1321
1596
  let n = i.querySelectorAll("a");
1322
1597
  if (n.length > 0) {
1323
1598
  let e = n[0].getAttribute("href");
1324
1599
  e && (o.hyperlink = e);
1325
1600
  }
1326
1601
  }
1327
- if (!L.isSingleCell(e)) {
1602
+ if (!z.isSingleCell(e)) {
1328
1603
  let t = {
1329
1604
  rowStart: this._topLeft.rowIndex + e.rowStart,
1330
1605
  colStart: this._topLeft.colIndex + e.colStart,
@@ -1335,7 +1610,7 @@ var ln = class {
1335
1610
  }
1336
1611
  if (o.value === void 0 && !o.style && Object.keys(o).length <= 1) return;
1337
1612
  let s = this._builder, c = this._topLeft;
1338
- if (s.pushAt(c.rowIndex + e.rowStart, c.colIndex + e.colStart, o), !L.isSingleCell(e) && a.msoIgnore) {
1613
+ if (s.pushAt(c.rowIndex + e.rowStart, c.colIndex + e.colStart, o), !z.isSingleCell(e) && a.msoIgnore) {
1339
1614
  if (a.msoIgnore.includes("colspan")) {
1340
1615
  let t = {};
1341
1616
  a && this.applyCSSStyle(t, a);
@@ -1364,28 +1639,28 @@ var ln = class {
1364
1639
  let i = n(r);
1365
1640
  if (i.msoHeightSource !== "userset" || !r) return;
1366
1641
  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");
1369
- i !== null && (o = Math.max(i, o ?? 0));
1642
+ if (a && (o = k(a, this._styles.getNormal().getFont().getSize(), "px")), o === null) for (let e = 0; e < r.cells.length; e++) {
1643
+ let t = r.cells[e], i = t.getAttribute("height") ?? n(t).height, a = k(i, this._styles.getNormal().getFont().getSize(), "px");
1644
+ a !== null && (o = Math.max(a, o ?? 0));
1370
1645
  }
1371
1646
  o !== null && this._rowsReading.push({
1372
1647
  address: {
1373
1648
  min: this._topLeft.rowIndex + e,
1374
1649
  max: this._topLeft.rowIndex + e + t - 1
1375
1650
  },
1376
- update: { size: o * k.getDeviceScale() }
1651
+ update: { size: o * j.getDeviceScale() }
1377
1652
  });
1378
1653
  }
1379
1654
  onColumn(e, t, n, r) {
1380
1655
  let i = n(r);
1381
1656
  if (i.msoWidthSource !== "userset" || !r) return;
1382
1657
  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({
1658
+ a && (o = k(a, this._styles.getNormal().getFont().getSize(), "px")), o !== null && this._colsReading.push({
1384
1659
  address: {
1385
1660
  min: this._topLeft.colIndex + e,
1386
1661
  max: this._topLeft.colIndex + e + t - 1
1387
1662
  },
1388
- update: { size: o * k.getDeviceScale() }
1663
+ update: { size: o * j.getDeviceScale() }
1389
1664
  });
1390
1665
  }
1391
1666
  onDone() {
@@ -1396,9 +1671,9 @@ var ln = class {
1396
1671
  sheet() {
1397
1672
  return this._sheet;
1398
1673
  }
1399
- }, hn = class {
1674
+ }, _r = class {
1400
1675
  constructor(e) {
1401
- if (!e) throw new _t("snapshot is required.");
1676
+ if (!e) throw new en("snapshot is required.");
1402
1677
  this._snapshot = e;
1403
1678
  }
1404
1679
  getItemType() {
@@ -1428,10 +1703,10 @@ var ln = class {
1428
1703
  get isClipboardItem() {
1429
1704
  return !0;
1430
1705
  }
1431
- }, gn = class {
1706
+ }, vr = class {
1432
1707
  constructor(e, t, n, r, i) {
1433
- if (this._parsed = void 0, this._runtime = e, !t) throw new _t("nativeItems are required.");
1434
- this._topLeft = n ?? L.EmptyCell, this._native = t, this._markOptions = Object.freeze(r ?? {}), this._styles = i;
1708
+ if (this._parsed = void 0, this._runtime = e, !t) throw new en("nativeItems are required.");
1709
+ this._topLeft = n ?? z.EmptyCell, this._native = t, this._markOptions = Object.freeze(r ?? {}), this._styles = i;
1435
1710
  }
1436
1711
  getItemType() {
1437
1712
  return "range";
@@ -1472,17 +1747,15 @@ var ln = class {
1472
1747
  async parse() {
1473
1748
  let e, t = this._native?.text, n = this._native.html;
1474
1749
  if (n === null && t && t.includes("<table")) try {
1475
- let e = new DOMParser().parseFromString(t, gt.Html), r = e.querySelector("parsererror");
1476
- if (r) throw new R("Unable to parse: " + r);
1750
+ let e = new DOMParser().parseFromString(t, $t.Html), r = e.querySelector("parsererror");
1751
+ if (r) throw new B("Unable to parse: " + r);
1477
1752
  n = e, t = null;
1478
1753
  } catch {
1479
1754
  console.warn("Discovered text as html table but could could not parse.");
1480
1755
  }
1481
1756
  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 = {
1757
+ let r = new gr(this._runtime, this._topLeft, this._styles, n ? "HTML" : "Text"), i = await Promise.resolve(t ? qe(t) : [[]]), a;
1758
+ if (Ye(n, i, r) ? (e = r.sheet(), a = e.getUsedRange()) : n = null, a) return this._parsed = {
1486
1759
  copyTo: async (e, t) => (await e.copyFrom(a, t))?.getCoords() ?? null,
1487
1760
  getCoords: () => a.getCoords(),
1488
1761
  getSource: () => e,
@@ -1495,21 +1768,22 @@ var ln = class {
1495
1768
  let e = this;
1496
1769
  return this._parsed = {
1497
1770
  async copyTo(t, n) {
1498
- let r = t.getSheet(), i = await e._native.image.arrayBuffer(), a = await r.getMovables().addPicture({ source: { buffer: i } }, {
1771
+ let r = t.getSheet(), i = await e._native.image.arrayBuffer();
1772
+ return await r.getMovables().addPicture({ source: { buffer: i } }, {
1499
1773
  type: "picture",
1500
- description: V("op.copyImageFromClipboard")
1501
- });
1502
- return r.getView().selectMovables([a]), null;
1774
+ description: W("op.copyImageFromClipboard"),
1775
+ autoSelect: !0
1776
+ }), null;
1503
1777
  },
1504
1778
  getName: () => "Image"
1505
1779
  }, !0;
1506
1780
  }
1507
- return !1;
1781
+ return this._parsed = null, !1;
1508
1782
  }
1509
1783
  get isClipboardItem() {
1510
1784
  return !0;
1511
1785
  }
1512
- }, Z = {
1786
+ }, yr = {
1513
1787
  showFormulaBar: !0,
1514
1788
  showTabs: !0,
1515
1789
  tabRatio: 600,
@@ -1517,9 +1791,12 @@ var ln = class {
1517
1791
  showVerticalScrollbar: !0,
1518
1792
  showStatusBar: !0,
1519
1793
  activeSheetId: 0
1520
- }, Q = class {
1794
+ }, br = class {
1521
1795
  constructor(e) {
1522
- this._emitter = new S(this), this._state = { ...Z }, e?.json && this._fromJSON(e?.json);
1796
+ this._id = R.uuidV4(), this._emitter = new t(this), this._state = { ...yr }, e?.json && this._fromJSON(e?.json);
1797
+ }
1798
+ getId() {
1799
+ return this._id;
1523
1800
  }
1524
1801
  isShowFormulaBar() {
1525
1802
  return this._state.showFormulaBar;
@@ -1571,7 +1848,7 @@ var ln = class {
1571
1848
  let e = {}, t = Object.keys(this._state), n = t.length;
1572
1849
  for (let r = 0; r < n; r++) {
1573
1850
  let n = t[r], i = this._state[n];
1574
- i != null && i !== Z[n] && (e[n] = i);
1851
+ i != null && i !== yr[n] && (e[n] = i);
1575
1852
  }
1576
1853
  return Object.keys(e).length === 0 && (e = null), e;
1577
1854
  }
@@ -1581,7 +1858,7 @@ var ln = class {
1581
1858
  }
1582
1859
  update(e, t = !0) {
1583
1860
  this._state = {
1584
- ...Z,
1861
+ ...yr,
1585
1862
  ...this._state,
1586
1863
  ...e
1587
1864
  }, t && this._emitter.notify("onViewChange");
@@ -1593,13 +1870,16 @@ var ln = class {
1593
1870
  let e = this.toJSON();
1594
1871
  return e ? JSON.stringify(e) : "DefaultWorkbookView";
1595
1872
  }
1596
- }, _n = Object.freeze({
1873
+ get isIWorkbookView() {
1874
+ return !0;
1875
+ }
1876
+ }, xr = Object.freeze({
1597
1877
  structure: !1,
1598
1878
  windows: !1,
1599
1879
  revision: !1,
1600
1880
  password: null,
1601
1881
  revisionsPassword: null
1602
- }), vn = class extends ot {
1882
+ }), Sr = class extends dt {
1603
1883
  isWindowsAllowed() {
1604
1884
  return this._isPropertyAllowed("windows");
1605
1885
  }
@@ -1609,20 +1889,19 @@ var ln = class {
1609
1889
  isStructureAllowed() {
1610
1890
  return this._isPropertyAllowed("structure");
1611
1891
  }
1892
+ _getAllowedKey() {
1893
+ return "workbook";
1894
+ }
1612
1895
  _fromJSON(e) {
1613
1896
  this._properties = e;
1614
1897
  }
1615
1898
  _toJSON(e) {
1616
1899
  let t = this._properties;
1617
1900
  if (t) {
1618
- e = {
1619
- ...e,
1620
- ...t
1621
- };
1622
1901
  let n = Object.keys(t), r = n.length;
1623
1902
  for (let i = 0; i < r; i++) {
1624
1903
  let r = n[i], a = t[r];
1625
- a != null && a !== _n[r] && (e[r] = a);
1904
+ a != null && a !== xr[r] && (e[r] = a);
1626
1905
  }
1627
1906
  }
1628
1907
  return super._toJSON(e);
@@ -1630,62 +1909,65 @@ var ln = class {
1630
1909
  get [Symbol.toStringTag]() {
1631
1910
  return "[WorkbookProtection]";
1632
1911
  }
1912
+ get isIWorkbookProtection() {
1913
+ return !0;
1914
+ }
1633
1915
  };
1634
- function yn(e) {
1635
- return H("error.workbook.invalidSheetKey", { key: e });
1916
+ function Cr(e) {
1917
+ return G("error.workbook.invalidSheetKey", { key: e });
1636
1918
  }
1637
- var bn = class {
1638
- constructor(e, t) {
1639
- this._add = e, this._get = t;
1919
+ var wr = class extends ge {
1920
+ constructor(e, t, n) {
1921
+ super(), this._add = e, this._get = t, this._addListeners = n;
1640
1922
  }
1641
1923
  add(e) {
1642
1924
  return this._add(e);
1643
1925
  }
1644
- *[Symbol.iterator]() {
1645
- yield* this.getItems();
1646
- }
1647
- getItems(e) {
1926
+ _getItems(e) {
1648
1927
  return this._get(e?.name, e?.visibility);
1649
1928
  }
1650
1929
  getByName(e) {
1651
1930
  return this._get(e)?.[0] ?? null;
1652
1931
  }
1653
- getCount() {
1654
- return this._get().length;
1932
+ addListeners(e, t) {
1933
+ return this._addListeners(e, t);
1655
1934
  }
1656
- }, xn = /* @__PURE__ */ new RegExp(/[\\/\\*?:[\]]+/), Sn = /* @__PURE__ */ new RegExp(/\(((\d+)(?!.*\d))\)$/, "g");
1657
- function Cn(e) {
1658
- let t = H(V("workbook.defaultSheetName"), { n: e + 1 });
1935
+ get isISheetCollection() {
1936
+ return !0;
1937
+ }
1938
+ }, Tr = /* @__PURE__ */ new RegExp(/[\\/\\*?:[\]]+/), Er = /* @__PURE__ */ new RegExp(/\(((\d+)(?!.*\d))\)$/, "g");
1939
+ function Dr(e) {
1940
+ let t = G(W("workbook.defaultSheetName"), { n: e + 1 });
1659
1941
  return t === "workbook.defaultSheetName" ? `Sheet${e + 1}` : t;
1660
1942
  }
1661
- function wn(e, t) {
1943
+ function Or(e, t) {
1662
1944
  return {
1663
- ...Xe,
1945
+ ...mt,
1664
1946
  getSheet: () => null,
1665
- toString: () => E(e, t)
1947
+ toString: () => D(e, t)
1666
1948
  };
1667
1949
  }
1668
- function Tn(e, t = !1) {
1669
- if (!e) throw Error(H("error.workbook.sheetNameBlank"));
1670
- if (xn.test(e)) {
1950
+ function kr(e, t = !1) {
1951
+ if (!e) throw Error(G("error.workbook.sheetNameBlank"));
1952
+ if (Tr.test(e)) {
1671
1953
  if (!t) throw Error(function(e) {
1672
- return e ? H("error.workbook.sheetNameInvalidCharsNamed", { sheetName: e }) : H("error.workbook.sheetNameInvalidChars");
1954
+ return e ? G("error.workbook.sheetNameInvalidCharsNamed", { sheetName: e }) : G("error.workbook.sheetNameInvalidChars");
1673
1955
  }(e));
1674
- e = e.replace(xn, "");
1956
+ e = e.replace(Tr, "");
1675
1957
  }
1676
- if (e.length === 0) throw Error(H("error.workbook.sheetNameBlank"));
1958
+ if (e.length === 0) throw Error(G("error.workbook.sheetNameBlank"));
1677
1959
  let n = e.length;
1678
1960
  if (n > 31) {
1679
- if (!t) throw Error(H("error.workbook.sheetNameTooLong"));
1961
+ if (!t) throw Error(G("error.workbook.sheetNameTooLong"));
1680
1962
  e = e.substring(0, 31);
1681
1963
  }
1682
1964
  if (e.charAt(0) === "'" || e.charAt(n - 1) === "'") {
1683
- if (!t) throw Error(H("error.workbook.sheetNameQuotes"));
1965
+ if (!t) throw Error(G("error.workbook.sheetNameQuotes"));
1684
1966
  e = e.replace(/^'|'$/g, "");
1685
1967
  }
1686
1968
  return e;
1687
1969
  }
1688
- var En, Dn, $ = class e extends ge {
1970
+ var Ar, jr, Mr = "workbook.activeSheet", Nr = class e extends it {
1689
1971
  constructor(e, t, n, r) {
1690
1972
  super(e, t, r), this._workbook = n;
1691
1973
  }
@@ -1696,23 +1978,23 @@ var En, Dn, $ = class e extends ge {
1696
1978
  let r = this._options;
1697
1979
  return n && (r = {
1698
1980
  ...this._options,
1699
- getOptions: j(this._options?.getOptions, n)
1981
+ getOptions: E(this._options?.getOptions, n)
1700
1982
  }), new e(t, this._internal, this._workbook, r);
1701
1983
  }
1702
1984
  _createRange(e, t) {
1703
- let n = e ? { ...e } : null, r = n ? this._workbook._getSheetRef(n.scope, O.Visibility.VeryHidden) : null;
1985
+ let n = e ? { ...e } : null, r = n ? this._workbook._getSheetRef(n.scope, w.Visibility.VeryHidden) : null;
1704
1986
  if (!r) {
1705
1987
  let e = this._workbook.getSelectedSheet();
1706
- return delete n?.scope, wn(n, n ? {
1707
- scope: h,
1988
+ return delete n?.scope, Or(n, n ? {
1989
+ scope: Qe,
1708
1990
  ...e.getEntireRange().getCoords()
1709
1991
  } : null);
1710
1992
  }
1711
1993
  let i = this._options;
1712
1994
  return t && (i = {
1713
1995
  ...this._options,
1714
- getOptions: j(this._options.getOptions, t)
1715
- }), new On(e, D(r.sheet), this._workbook, i);
1996
+ getOptions: E(this._options.getOptions, t)
1997
+ }), new Pr(e, C(r.sheet), this._workbook, i);
1716
1998
  }
1717
1999
  async select(e) {
1718
2000
  let t = [], n = null, r = this.getCoords();
@@ -1736,15 +2018,15 @@ var En, Dn, $ = class e extends ge {
1736
2018
  }
1737
2019
  getAddress(e) {
1738
2020
  let t = this._internal.getSheet(), n = t.getEntireRange().getCoords();
1739
- return ce(this.getCoords(), {
2021
+ return Ie(this.getCoords(), {
1740
2022
  ...n,
1741
2023
  scope: t.getName()
1742
- }, E, ne, e);
2024
+ }, D, Ve, e);
1743
2025
  }
1744
2026
  toString() {
1745
2027
  return this.getAddress();
1746
2028
  }
1747
- }, On = class e extends pe {
2029
+ }, Pr = class e extends wt {
1748
2030
  constructor(e, t, n, r) {
1749
2031
  super(e, t, r), this._workbook = n;
1750
2032
  }
@@ -1752,17 +2034,17 @@ var En, Dn, $ = class e extends ge {
1752
2034
  let n = this._options;
1753
2035
  return t && (n = {
1754
2036
  ...this._options,
1755
- getOptions: j(this._options?.getOptions, t)
1756
- }), new $(e, this._internal, this._workbook, n);
2037
+ getOptions: E(this._options?.getOptions, t)
2038
+ }), new Nr(e, this._internal, this._workbook, n);
1757
2039
  }
1758
2040
  _createRange(t, n) {
1759
2041
  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);
2042
+ if (!t) return Ze(r.getSheet(), r.getSheet().getEntireCoords());
2043
+ if (r.validateCoords(t), r.getSheet().isClosed()) return Ze(null, r.getSheet().getEntireCoords(), t);
1762
2044
  let i = this._options;
1763
2045
  return n && (i = {
1764
2046
  ...this._options,
1765
- getOptions: j(this._options?.getOptions, n)
2047
+ getOptions: E(this._options?.getOptions, n)
1766
2048
  }), new e(t, this._internal, this._workbook, i);
1767
2049
  }
1768
2050
  addListener(e, t) {
@@ -1775,7 +2057,7 @@ var En, Dn, $ = class e extends ge {
1775
2057
  }
1776
2058
  getAddress(e) {
1777
2059
  let t = this._internal.getSheet(), n = t?.getEntireRange().getCoords() ?? null;
1778
- return E(this.getCoords(), {
2060
+ return D(this.getCoords(), {
1779
2061
  ...n,
1780
2062
  scope: t.getName()
1781
2063
  });
@@ -1783,131 +2065,146 @@ var En, Dn, $ = class e extends ge {
1783
2065
  toString() {
1784
2066
  return this.getAddress();
1785
2067
  }
1786
- }, kn = class {
2068
+ }, Fr = (e) => !!e && typeof e == "object" && typeof e.getOrigin == "function", Ir = class {
1787
2069
  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;
1789
- 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
- } });
1795
- 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", {
2070
+ 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 me(() => {
2071
+ let e = [];
2072
+ for (let t of this.getSheets()) e.push(...t.getPivotTables());
2073
+ return e;
2074
+ }), this._people = new pr(), this._commentCollection = new f(null, (e, t, n) => {
2075
+ let r = [];
2076
+ for (let i of this.getSheets()) r.push(...i.getComments().getItems(e ? {
2077
+ address: e,
2078
+ ignoreHidden: t,
2079
+ fullyContained: n
2080
+ } : {
2081
+ ignoreHidden: t,
2082
+ fullyContained: n
2083
+ }));
2084
+ return r;
2085
+ }, (e, t) => this.addListeners({ onSheetsChange: e.onCollectionChange ? () => {
2086
+ e.onCollectionChange(this._commentCollection);
2087
+ } : void 0 }, t)), this._isDate1904 = !1, this._codeName = null, this._updateLinks = null, this._locale = null, this._localeOverrides = null;
2088
+ let n = typeof e == "string" ? { origin: e } : { ...e }, i = n.origin;
2089
+ this._ownOriginProvider = !Fr(i), this._originProvider = Fr(i) ? i : new pn(typeof i == "string" ? new K(null, { name: i }) : i ?? new K(null)), delete n.origin, this._bindOrigin(this._originProvider.getOrigin()), this._listenerOriginProvider = this._originProvider.addListeners({ onOriginChange: () => this._onOriginChange() });
2090
+ let a = n.json;
2091
+ delete n.json, this._transactions = n.transactions ?? new r(), this._id = this._transactions.create(), this._ownTransactions = !n.transactions, this._emitter = new t(this, this._transactions), this._runtime = n.runtime ?? new p("Workbook Runtime", {
1797
2092
  isDate1904: () => this._isDate1904,
1798
- getLocale: () => this._locale ?? Oe() ?? Le(),
2093
+ getNow: () => this._transactions.getCurrentCommit().getTimestamp(),
2094
+ getLocale: () => this._locale ?? we() ?? St(),
1799
2095
  getLocaleOverrides: () => this._localeOverrides
1800
- }), this._listenerLanguage = mt.addChangeListener(() => {
1801
- this._locale !== null || this._closed || this._notifyAllChange();
2096
+ }), this._listenerLanguage = Zt.addChangeListener(() => {
2097
+ this._closed || this._notifyAllChange();
1802
2098
  });
1803
- let i = this, a = this._beginCommit({ description: V(r ? "op.openWorkbook" : "op.newWorkbook") });
2099
+ let o = this, s = this._beginCommit({ description: W(a ? "op.openWorkbook" : "op.newWorkbook") });
1804
2100
  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;
1806
- 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 = {
1809
- runtime: i._runtime,
1810
- readonly: i._options.readonly ?? !1,
1811
- disableLoadAutoFit: i._options.disableLoadAutoFit ?? !1,
1812
- formulaTransform: i._options.formulaTransform,
1813
- opener: i._options.opener,
1814
- transactions: i._transactions,
1815
- styles: i._styles,
1816
- strings: i._strings,
1817
- resources: i._resources,
1818
- names: i._names,
1819
- workbook: i,
1820
- calculation: i._calculation,
1821
- resolveRange: (e) => i._options.resolveRange?.(e) ?? i.getRange(e),
2101
+ this._strings = n.strings ?? new ee(), this._ownStrings = !n.strings, this._resources = n.resources ?? new Ee(), this._ownResources = !n.resources, this._createSheetName = n.createSheetNameCallback ?? Dr;
2102
+ let e = n.createSheetCallback;
2103
+ e ||= (e) => new O(e), this._sheetOnNameChange = /* @__PURE__ */ new Map(), this._sheetOnVisibilityChange = /* @__PURE__ */ new Map(), this._sheetOnIndexChange = /* @__PURE__ */ new Map(), this._createSheet = (t, n, r, i, a, s, c) => {
2104
+ let l = null, u = {
2105
+ runtime: o._runtime,
2106
+ readonly: o._options.readonly ?? !1,
2107
+ disableLoadAutoFit: o._options.disableLoadAutoFit ?? !1,
2108
+ opener: o._options.opener,
2109
+ transactions: o._transactions,
2110
+ styles: o._styles,
2111
+ strings: o._strings,
2112
+ resources: o._resources,
2113
+ names: o._names,
2114
+ workbook: o,
2115
+ calculation: o._calculation,
2116
+ resolveRange: (e) => o._options.resolveRange?.(e) ?? o.getRange(e),
1822
2117
  container: {
1823
2118
  beforeFromJSON: (e) => {
1824
- s = e, i._addSheetRef({
2119
+ l = e, o._addSheetRef({
1825
2120
  name: n,
1826
2121
  id: t,
1827
- visibility: r ?? O.Visibility.Visible,
2122
+ visibility: r ?? w.Visibility.Visible,
2123
+ sheetId: a,
1828
2124
  sheet: e
1829
- }, a);
2125
+ }, i);
1830
2126
  },
1831
2127
  getName: () => {
1832
- let e = i._getSheetRef(s);
2128
+ let e = o._getSheetRef(l);
1833
2129
  return e ? e.name : n;
1834
2130
  },
1835
2131
  setName: (e, t) => {
1836
- i._getSheetRef(s) && i._setSheetName(s, e, t);
2132
+ o._getSheetRef(l) && o._setSheetName(l, e, t);
1837
2133
  },
1838
2134
  setNameChangeCallback: (e) => {
1839
- i._sheetOnNameChange.set(t, e);
2135
+ o._sheetOnNameChange.set(t, e);
1840
2136
  },
1841
2137
  getVisibility: () => {
1842
- let e = i._getSheetRef(s);
1843
- return e ? e.visibility : O.Visibility.Visible;
2138
+ let e = o._getSheetRef(l);
2139
+ return e ? e.visibility : w.Visibility.Visible;
1844
2140
  },
1845
2141
  setVisibility: (e, t) => {
1846
- i._setSheetVisibility(s, e, t);
2142
+ o._setSheetVisibility(l, e, t);
1847
2143
  },
1848
2144
  setVisibilityCallback: (e) => {
1849
- i._sheetOnVisibilityChange.set(t, e);
2145
+ o._sheetOnVisibilityChange.set(t, e);
1850
2146
  },
1851
- duplicate: () => i._duplicateSheet(s),
2147
+ duplicate: () => o._duplicateSheet(l),
1852
2148
  getIndex: () => {
1853
- let e = i._getSheetRef(s);
1854
- return e ? i._getOffsetForId(e.id, i._getSheetRefs(O.Visibility.VeryHidden)) : a;
2149
+ let e = o._getSheetRef(l);
2150
+ return e ? o._getOffsetForId(e.id, o._getSheetRefs(w.Visibility.VeryHidden)) : i;
1855
2151
  },
1856
2152
  setIndex: (e, t) => {
1857
- let n = i._getSheetRef(s, O.Visibility.VeryHidden);
1858
- return !!n && (i._moveSheet(n, e, t), !0);
2153
+ let n = o._getSheetRef(l, w.Visibility.VeryHidden);
2154
+ return !!n && (o._moveSheet(n, e, t), !0);
1859
2155
  },
1860
2156
  setIndexCallback: (e) => {
1861
- i._sheetOnIndexChange.set(t, e);
2157
+ o._sheetOnIndexChange.set(t, e);
1862
2158
  },
1863
- requestSelect: async () => (i._setSelectedSheet(s), await this._emitter.notify("onRequestSelect", {
1864
- source: i,
1865
- params: s,
2159
+ requestSelect: async () => (o._setSelectedSheet(l), await this._emitter.notify("onRequestSelect", {
2160
+ source: o,
2161
+ params: l,
1866
2162
  async: !0
1867
- }), i.getSelectedSheet() === s)
2163
+ }), o.getSelectedSheet() === l)
1868
2164
  }
1869
2165
  };
1870
- return o && (c.json = o), s = e(c, n, a, r), s;
1871
- }, this._namedTableSource = new it({
1872
- getSheets: () => i._sheets ? i.getSheets().getItems() : I.EmptyArray,
1873
- addSheetsListener: (e, t) => i.addListeners({ onSheetsChange: e }, t)
1874
- }), this._names = t.names ?? new we({
1875
- addressToRanges: (e) => i.getRanges(e),
1876
- getCurrentScope: () => i.getSelectedSheet().getName(),
1877
- isReadOnly: () => i._options.readonly ?? !1,
1878
- transactions: i._transactions,
1879
- getSources: () => i._calculation ? [i._calculation.getNamedFormulas(), i._namedTableSource] : I.EmptyArray
1880
- }), this._ownNames = !t.names, this._calculation = t.calculation ?? new ye({
1881
- runtime: i._runtime,
1882
- functions: t.functions,
1883
- json: r?.calc,
2166
+ return s && (u.json = s), c !== void 0 && (u.uid = () => c), l = e(u, n, i, r), l;
2167
+ }, this._namedTableSource = new d({
2168
+ getSheets: () => o._sheets ? o.getSheets().getItems() : R.EmptyArray,
2169
+ addSheetsListener: (e, t) => o.addListeners({ onSheetsChange: e }, t)
2170
+ }), this._names = n.names ?? new oe({
2171
+ addressToRanges: (e) => o.getRanges(e),
2172
+ getCurrentScope: () => o.getSelectedSheet().getName(),
2173
+ isReadOnly: () => (o._options.readonly ?? !1) || o._isStructureProtected(),
2174
+ transactions: o._transactions,
2175
+ getSources: () => o._calculation ? [o._calculation.getNamedFormulas(), o._namedTableSource] : R.EmptyArray
2176
+ }), this._ownNames = !n.names, this._calculation = n.calculation ?? new lt({
2177
+ runtime: o._runtime,
2178
+ functions: n.functions,
2179
+ json: a?.calc,
2180
+ isNamesReadOnly: () => o._isStructureProtected(),
1884
2181
  getActiveCell: () => {
1885
- let e = i.getSelectedSheet(), t = e?.getSelectedRange()?.getCoords();
2182
+ let e = o.getSelectedSheet(), t = e?.getSelectedRange()?.getCoords();
1886
2183
  return t ? {
1887
2184
  rowIndex: t.rowStart,
1888
2185
  colIndex: t.colStart,
1889
2186
  scope: e.getId()
1890
2187
  } : null;
1891
2188
  },
1892
- getRange: i.getRange.bind(i),
1893
- getRanges: i.getRanges.bind(i),
1894
- createGraphRanges: (e, t) => i._createGraphRanges(e, t),
2189
+ getRange: o.getRange.bind(o),
2190
+ getRanges: o.getRanges.bind(o),
2191
+ createGraphRanges: (e, t) => o._createGraphRanges(e, t),
1895
2192
  getSheetIndex: (e) => {
1896
2193
  if (e === void 0) {
1897
- let e = i.getSelectedSheet();
1898
- return e ? this._getSheetRefs(O.Visibility.VeryHidden).findIndex((t) => t.sheet === e) : -1;
2194
+ let e = o.getSelectedSheet();
2195
+ return e ? this._getSheetRefs(w.Visibility.VeryHidden).findIndex((t) => t.sheet === e) : -1;
1899
2196
  }
1900
- let t = this._getSheetRefs(O.Visibility.VeryHidden);
2197
+ let t = this._getSheetRefs(w.Visibility.VeryHidden);
1901
2198
  e = e.toLowerCase();
1902
2199
  let n = t.length;
1903
2200
  for (let r = 0; r < n; r++) if (t[r].name.toLowerCase() === e) return r;
1904
2201
  try {
1905
- An.address = e;
1906
- let t = this._names.getItems(An);
2202
+ Lr.address = e;
2203
+ let t = this._names.getItems(Lr);
1907
2204
  if (!t || t.length === 0) return -1;
1908
2205
  let n = t[0].getRanges?.()?.getCoords()?.[0]?.scope;
1909
2206
  if (!n) return -1;
1910
- let r = this._getSheetRefs(O.Visibility.VeryHidden);
2207
+ let r = this._getSheetRefs(w.Visibility.VeryHidden);
1911
2208
  n = n.toLowerCase();
1912
2209
  let i = r.length;
1913
2210
  for (let e = 0; e < i; e++) if (r[e].name.toLowerCase() === n) return e;
@@ -1916,37 +2213,43 @@ var En, Dn, $ = class e extends ge {
1916
2213
  }
1917
2214
  return -1;
1918
2215
  },
1919
- getSheetCount: () => i.getSheets().getItems({ visibility: O.Visibility.VeryHidden }).length,
1920
- getSheetById: (e) => {
1921
- let t = i.getSheets().getItems({ visibility: O.Visibility.VeryHidden }), n = t.length;
1922
- for (let r = 0; r < n; r++) if (t[r].getId() === e) return t[r];
1923
- return null;
1924
- },
1925
- getSheetByName: (e) => {
1926
- try {
1927
- return i.getSheets().getByName(e) ?? null;
1928
- } catch {
1929
- return null;
1930
- }
1931
- },
1932
- namedCollection: i._names,
1933
- strings: i._strings,
1934
- 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) => {
2216
+ getSheetCount: () => o.getSheets().getItems({ visibility: w.Visibility.VeryHidden }).length,
2217
+ externalBooks: a?.externalBooks,
2218
+ externalBookResolver: n.externalBookResolver,
2219
+ namedCollection: o._names,
2220
+ strings: o._strings,
2221
+ transactions: o._transactions,
2222
+ names: a?.names
2223
+ }), this._ownCalculation = !n.calculation, this._scripts = this._createScripts(a?.modules), this._ownNames = !n.names, this._options = Object.freeze({ ...n });
2224
+ let t = a?.sheets?.length ? a.sheets.map((e) => e.name) : [this._createSheetName(0)], r = t.map((e) => e + "-" + R.uuidV4());
2225
+ this._calculation._setSheets(t.map((e, t) => [r[t], e]));
2226
+ let i = n.calcOnLoad ?? "auto", c = !1, l = (async () => {
2227
+ try {
2228
+ if (this._ownCalculation && i !== "none" && (i === "full" || i === "auto" && !0 === a?.calc?.fullCalcOnLoad ? await this._calculation.calculate({ full: !0 }) : await this._calculation.start(), this._closed)) return;
2229
+ await this._scripts.start();
2230
+ } finally {
2231
+ c = !0, this._starting = null;
2232
+ }
2233
+ })();
2234
+ c || (this._starting = l), this._starting?.catch(() => {}), a ? this._fromJSON(a, r) : (this._initState(), this._addSheet(!1, t[0], null, r[0])), this._sheets = new wr((e) => o._addSheetOptions(e), (e, t) => {
1942
2235
  if (e) {
1943
2236
  let n = this._getSheetRef(e, t);
1944
- return n ? [n.sheet] : I.EmptyArray;
2237
+ return n ? [n.sheet] : R.EmptyArray;
1945
2238
  }
1946
2239
  return this._getSheets(t);
1947
- }), this._ownCalculation && this._calculation.hydrateNames(), this._emitter.notify("onLoad"), a.commit({ forceAmend: this._ownTransactions });
2240
+ }, (e, t) => {
2241
+ let n = e.onCollectionChange, r = e.onInvalidated;
2242
+ return o._emitter.addListeners({
2243
+ onSheetsChange: n ? () => {
2244
+ n(o._sheets);
2245
+ } : void 0,
2246
+ onInvalidated: r ? () => {
2247
+ r(o._sheets);
2248
+ } : void 0
2249
+ }, t);
2250
+ }), this._ownCalculation && (n.calcOnLoad ?? "auto") !== "none" && this._calculation.hydrateNames(), this._emitter.notify("onLoad"), this._ownTransactions ? s.amend() : s.commit();
1948
2251
  } catch (e) {
1949
- throw a.rollback(), e;
2252
+ throw s.rollback(), e;
1950
2253
  }
1951
2254
  this._initializing = !1;
1952
2255
  }
@@ -1954,22 +2257,14 @@ var En, Dn, $ = class e extends ge {
1954
2257
  let e = this._getSheetRefs();
1955
2258
  for (let t = (e ? e.length : 0) - 1; t >= 0; t--);
1956
2259
  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) => {
2260
+ this._isDate1904 = t.runtime?.isDate1904() ?? !1, this._locale = null, this._localeOverrides = null, this._theme = t.theme ?? new ct().getDefaultTheme(), this._styles = t?.styles ?? new re(this._theme), this._ownStyles = !t.styles, this._styles.getTheme() || this._styles.setTheme(this.getTheme()), this._activeSheetOffset = 0, this.setView(new br()), this._listenerProtection?.(), this._protection = new Sr(void 0, this._options.readonly ?? !1), this._listenerProtection = this._protection.addListeners({ onChange: (e) => {
1958
2261
  n._emitter.notify("onProtectionChange");
1959
2262
  } });
1960
2263
  let n = this;
1961
2264
  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;
1967
- try {
1968
- i = n._getOffsetForId(r, e.sheetRefsVisible);
1969
- } catch {}
1970
- n._adjustRemoveSelectionIfRequired(i, r);
1971
- }
1972
- n._lastTransactionUUID = r.getId(), n._notifyAllChange();
2265
+ async onAfterStateChange(e, t, r, i, a) {
2266
+ let o = n._view, s = a?.[Mr], 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;
2267
+ d ? await d.sheet.select() : n._resyncActiveSheet(u, e), n._lastTransactionUUID = t.getId(), (r || i) && n._emitter.notify("onSheetsChange"), n._emitter.notify("onSelectedSheetChange"), n._emitter.notify("onViewChange");
1973
2268
  },
1974
2269
  onRestoreOrRevert() {
1975
2270
  n._ownCalculation, n._emitter.notify("onInvalidated");
@@ -2002,14 +2297,29 @@ var En, Dn, $ = class e extends ge {
2002
2297
  return this._closed ? null : this._origin.getName();
2003
2298
  }
2004
2299
  getOrigin() {
2005
- return this._origin;
2300
+ return this._originProvider.getOrigin();
2301
+ }
2302
+ _onOriginChange() {
2303
+ if (this._closed) return;
2304
+ let e = this._originProvider.getOrigin();
2305
+ if (e === this._origin) return;
2306
+ this._listenerOrigin?.();
2307
+ let t = this._lastOriginName;
2308
+ this._bindOrigin(e), this._emitter.notify("onOriginChange"), this._lastOriginName !== t && this._emitter.notify("onNameChange");
2309
+ }
2310
+ _bindOrigin(e) {
2311
+ this._origin = e, this._lastOriginName = e.getName(), this._listenerOrigin = e.addListeners({ onChange: () => {
2312
+ if (this._closed) return;
2313
+ let t = e.getName();
2314
+ t !== this._lastOriginName && (this._lastOriginName = t, this._emitter.notify("onNameChange"));
2315
+ } });
2006
2316
  }
2007
2317
  getView() {
2008
2318
  return this._view;
2009
2319
  }
2010
2320
  setView(e) {
2011
- if (this._closed) throw Error(H("error.workbook.modelClosed"));
2012
- if (!e) throw new R(H("error.sheet.emptyView"));
2321
+ if (this._closed) throw Error(G("error.workbook.modelClosed"));
2322
+ if (!e) throw new B(G("error.sheet.emptyView"));
2013
2323
  this._listenerWorkbookView?.();
2014
2324
  let t = this, n = -1;
2015
2325
  return this._listenerWorkbookView = e.addListeners({ onViewChange: (e) => {
@@ -2021,8 +2331,8 @@ var En, Dn, $ = class e extends ge {
2021
2331
  return this._runtime;
2022
2332
  }
2023
2333
  setDate1904(e) {
2024
- if (this._closed) throw Error(H("error.workbook.modelClosed"));
2025
- return this._isDate1904 = e, this._notifyAllChange(), this;
2334
+ if (this._closed) throw Error(G("error.workbook.modelClosed"));
2335
+ return this._isDate1904 === e || (this._isDate1904 = e, this._emitter.notify("onRegionalChange")), this;
2026
2336
  }
2027
2337
  getLocale() {
2028
2338
  return this._runtime.getLocale();
@@ -2031,21 +2341,21 @@ var En, Dn, $ = class e extends ge {
2031
2341
  return this._locale;
2032
2342
  }
2033
2343
  setLocale(e) {
2034
- if (this._closed) throw Error(H("error.workbook.modelClosed"));
2344
+ if (this._closed) throw Error(G("error.workbook.modelClosed"));
2035
2345
  if (e) try {
2036
2346
  new Intl.Locale(e);
2037
2347
  } catch {
2038
- throw Error(H("error.workbook.invalidLocale", { locale: e }));
2348
+ throw Error(G("error.workbook.invalidLocale", { locale: e }));
2039
2349
  }
2040
- return this._locale === e || (this._locale = e, this._notifyAllChange()), this;
2350
+ return this._locale === e || (this._locale = e, this._emitter.notify("onRegionalChange")), this;
2041
2351
  }
2042
2352
  getLocaleOverrides() {
2043
2353
  return this._localeOverrides;
2044
2354
  }
2045
2355
  setLocaleOverrides(e) {
2046
- if (this._closed) throw Error(H("error.workbook.modelClosed"));
2356
+ if (this._closed) throw Error(G("error.workbook.modelClosed"));
2047
2357
  let t = e && Object.keys(e).length > 0 ? e : null;
2048
- return this._localeOverrides = t, this._notifyAllChange(), this;
2358
+ return this._localeOverrides = t, this._emitter.notify("onRegionalChange"), this;
2049
2359
  }
2050
2360
  getStyles() {
2051
2361
  return this._styles;
@@ -2060,14 +2370,30 @@ var En, Dn, $ = class e extends ge {
2060
2370
  return this._strings;
2061
2371
  }
2062
2372
  getExternalBooks() {
2063
- return this._externalBooks;
2373
+ return this._calculation.getExternalBooks();
2374
+ }
2375
+ getUpdateLinks() {
2376
+ return this._updateLinks;
2377
+ }
2378
+ setUpdateLinks(e) {
2379
+ if (this._closed) throw Error(G("error.workbook.modelClosed"));
2380
+ return this._updateLinks = e, this;
2381
+ }
2382
+ getPivotTables() {
2383
+ return this._pivotTableCollection;
2384
+ }
2385
+ getComments() {
2386
+ return this._commentCollection;
2387
+ }
2388
+ getPeople() {
2389
+ return this._people;
2064
2390
  }
2065
2391
  getTheme() {
2066
2392
  return this._theme;
2067
2393
  }
2068
2394
  setTheme(e) {
2069
- if (this._closed) throw Error(H("error.workbook.modelClosed"));
2070
- if (!e) throw new R(H("error.workbook.notSetValue"));
2395
+ if (this._closed) throw Error(G("error.workbook.modelClosed"));
2396
+ if (!e) throw new B(G("error.workbook.notSetValue"));
2071
2397
  let t = this._theme;
2072
2398
  return this._theme = e, this.getStyles().setTheme(e), this._emitter.notify("onThemeChange"), t;
2073
2399
  }
@@ -2078,17 +2404,17 @@ var En, Dn, $ = class e extends ge {
2078
2404
  let e = this._getSheetRef(this.getSelectedSheetIndex());
2079
2405
  return e ? e?.sheet : null;
2080
2406
  }
2081
- getSheet(e, t = O.Visibility.Visible) {
2407
+ getSheet(e, t = w.Visibility.Visible) {
2082
2408
  if (e === void 0) return this.getSelectedSheet();
2083
- if (!e) throw Error(H("error.workbook.sheetNameNotProvided"));
2409
+ if (!e) throw Error(G("error.workbook.sheetNameNotProvided"));
2084
2410
  let n = this._getSheetRef(e, t);
2085
- if (!n) throw new B(H("error.workbook.sheetNameNotFound", { sheetName: e }));
2411
+ if (!n) throw new H(G("error.workbook.sheetNameNotFound", { sheetName: e }));
2086
2412
  return n.sheet;
2087
2413
  }
2088
- getSheetAt(e, t = O.Visibility.Visible) {
2414
+ getSheetAt(e, t = w.Visibility.Visible) {
2089
2415
  let n = this._getSheetRef(e, t);
2090
- if (!n) throw new B(function(e) {
2091
- return H("error.workbook.sheetIndexNotFound", { index: e });
2416
+ if (!n) throw new H(function(e) {
2417
+ return G("error.workbook.sheetIndexNotFound", { index: e });
2092
2418
  }(e));
2093
2419
  return n.sheet;
2094
2420
  }
@@ -2098,32 +2424,32 @@ var En, Dn, $ = class e extends ge {
2098
2424
  addSheet(e) {
2099
2425
  return this.getSheets().add(e);
2100
2426
  }
2101
- _getSheets(e = O.Visibility.Visible) {
2427
+ _getSheets(e = w.Visibility.Visible) {
2102
2428
  let t = this._getSheetRefs(e), n = [], r = t.length;
2103
2429
  for (let e = 0; e < r; e++) n.push(t[e].sheet);
2104
2430
  return n;
2105
2431
  }
2106
- _getSheetRefs(e = O.Visibility.Visible) {
2432
+ _getSheetRefs(e = w.Visibility.Visible) {
2107
2433
  let t = this._getState();
2108
- return t ? e === O.Visibility.Visible ? t.sheetRefsVisible : e === O.Visibility.Hidden ? t.sheetRefsVisibleAndHidden : e === O.Visibility.VeryHidden ? t.sheetRefsAll : I.EmptyArray : [];
2434
+ return t ? e === w.Visibility.Visible ? t.sheetRefsVisible : e === w.Visibility.Hidden ? t.sheetRefsVisibleAndHidden : e === w.Visibility.VeryHidden ? t.sheetRefsAll : R.EmptyArray : [];
2109
2435
  }
2110
- _getSheetRef(e, t = O.Visibility.Visible) {
2436
+ _getSheetRef(e, t = w.Visibility.Visible) {
2111
2437
  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);
2438
+ return typeof e == "number" ? this._getSheetRefs(t)[e] : (typeof e == "string" ? n = this._getState().refsByLowerCaseName.get(e.toLowerCase()) : e instanceof O ? n = this._getState().refsByInstance.get(e) : e?.id !== void 0 && (n = this._getState().refsById.get(e.id)), n);
2113
2439
  }
2114
2440
  _validateNewSheetName(e, t = !0) {
2115
2441
  if (e == null) return e;
2116
- if (Tn(e), t && this._getState().sheetsByLowerCaseName.has(e.toLowerCase())) throw new R(H("error.workbook.nameTaken"));
2442
+ if (kr(e), t && this._getState().sheetsByLowerCaseName.has(e.toLowerCase())) throw new B(G("error.workbook.nameTaken"));
2117
2443
  return e.substring(0, 31);
2118
2444
  }
2119
2445
  findValidSheetName(e) {
2120
- e &&= Tn(e, !0);
2446
+ e &&= kr(e, !0);
2121
2447
  try {
2122
2448
  return function(e, t) {
2123
2449
  try {
2124
2450
  if (t(e)) return e;
2125
2451
  } catch {}
2126
- let n, r, i = Sn.exec(e);
2452
+ let n, r, i = Er.exec(e);
2127
2453
  for (i === null ? (n = e + " ", r = 1) : (n = e.substring(0, i.index), r = parseFloat(i[1])); r < 256;) {
2128
2454
  r++;
2129
2455
  let e = "(" + r + ")", i = n.substring(0, 31 - e.length) + e;
@@ -2138,36 +2464,25 @@ var En, Dn, $ = class e extends ge {
2138
2464
  }
2139
2465
  }
2140
2466
  isValidSheetNameCharacter(e) {
2141
- return !xn.test(e);
2467
+ return !Tr.test(e);
2468
+ }
2469
+ _isStructureProtected() {
2470
+ return !this._initializing && !this.getProtection().isStructureAllowed();
2142
2471
  }
2143
2472
  _addSheetOptions(e) {
2144
- if (this._closed) throw Error(H("error.workbook.modelClosed"));
2145
- if (!this.getProtection().isStructureAllowed()) throw new R(H("error.workbook.protection"));
2473
+ if (this._closed) throw Error(G("error.workbook.modelClosed"));
2474
+ if (!this.getProtection().isStructureAllowed()) throw new U(G("error.workbook.protection"));
2146
2475
  let t, n = null;
2147
2476
  t = typeof e == "string" ? { name: e } : typeof e == "number" ? { index: e } : e, t = {
2148
2477
  ...t,
2149
- description: t?.description ?? V("op.addSheet")
2478
+ description: t?.description ?? W("op.addSheet")
2150
2479
  };
2151
2480
  let r = this.beginCommit(t);
2152
2481
  try {
2153
2482
  let e = t?.autoSelect ?? !1;
2154
2483
  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) {
2484
+ let i = this.getView().getActiveSheetId();
2485
+ if (e && this._recordActiveSheet(r, i, this._getSheetRef(n).id), r.commit({ description: G("op.addSheetNamed", { name: n.getName() }) }), !1 !== e) {
2171
2486
  let t = typeof e == "boolean" ? void 0 : e;
2172
2487
  n.select(t);
2173
2488
  }
@@ -2178,8 +2493,8 @@ var En, Dn, $ = class e extends ge {
2178
2493
  }
2179
2494
  _nextSheetName(e = null) {
2180
2495
  let t = e ? e.toLowerCase() : null, n = this._getState(), r = n.sheetsByLowerCaseName;
2181
- if (e && r.has(t)) throw new R(function(e) {
2182
- return H("error.workbook.nameDuplicate", { sheetName: e });
2496
+ if (e && r.has(t)) throw new B(function(e) {
2497
+ return G("error.workbook.nameDuplicate", { sheetName: e });
2183
2498
  }(e));
2184
2499
  t = (e = this._validateNewSheetName(e)) ? e.toLowerCase() : null;
2185
2500
  let i = n.lastId + 1;
@@ -2189,23 +2504,28 @@ var En, Dn, $ = class e extends ge {
2189
2504
  }
2190
2505
  return this._updateState({ lastId: i }), e;
2191
2506
  }
2192
- _addSheet(e, t = null, n = null) {
2507
+ _addSheet(e, t = null, n = null, r) {
2193
2508
  t = this._nextSheetName(t);
2194
- let r = this._getState(), i = this._createSheet(r.lastId, t, O.Visibility.Visible, n, null);
2195
- if (!i) throw new R(H("error.workbook.sheetNameBlank"));
2196
- return e && this._emitter.notify("onSheetsChange"), i;
2509
+ let i = this._getState(), a = this._createSheet(i.lastId, t, w.Visibility.Visible, n, void 0, null, r);
2510
+ if (!a) throw new B(G("error.workbook.sheetNameBlank"));
2511
+ return e && (this._tellSheets(), this._emitter.notify("onSheetsChange")), a;
2197
2512
  }
2198
2513
  _updateSheetRefStates(e) {
2199
- if (this._closed) throw Error(H("error.workbook.modelClosed"));
2200
- if (!this._initializing && !this.getProtection().isStructureAllowed()) throw new R(H("error.workbook.protection"));
2514
+ if (this._closed) throw Error(G("error.workbook.modelClosed"));
2515
+ if (!this._initializing && !this.getProtection().isStructureAllowed()) throw new U(G("error.workbook.protection"));
2201
2516
  let t = e, n = [], r = [], i = t.length;
2202
- 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]);
2517
+ for (let e = 0; e < i; e++) t[e].visibility === w.Visibility.Visible ? (n.push(t[e]), r.push(t[e])) : t[e].visibility === w.Visibility.Hidden && r.push(t[e]);
2203
2518
  this._updateState({
2204
2519
  sheetRefsAll: t,
2205
2520
  sheetRefsVisible: n,
2206
2521
  sheetRefsVisibleAndHidden: r
2207
2522
  });
2208
2523
  }
2524
+ _tellSheets() {
2525
+ if (this._isLoadingSheets) return;
2526
+ let e = this._getState().sheetRefsAll;
2527
+ this._calculation._setSheets(e.map((e) => [e.sheet.getId(), e.name]));
2528
+ }
2209
2529
  _addSheetRef(e, t = null) {
2210
2530
  let n = this._getState(), r = n.sheetRefsAll, i = Math.max(0, Math.min(r.length, t ?? r.length)), a = [
2211
2531
  ...r.slice(0, i),
@@ -2230,9 +2550,9 @@ var En, Dn, $ = class e extends ge {
2230
2550
  p._validateDeleteSheet(e);
2231
2551
  },
2232
2552
  onDelete(e) {
2233
- let t = p._getSheetRef(e, O.Visibility.VeryHidden);
2553
+ let t = p._getSheetRef(e, w.Visibility.VeryHidden);
2234
2554
  if (!t) return;
2235
- let n = p._beginCommit({ description: H("op.deleteSheet", { name: t.name }) });
2555
+ let n = p._beginCommit({ description: G("op.deleteSheet", { name: t.name }) });
2236
2556
  try {
2237
2557
  let r = p._getState(), i = r.sheetRefsAll, a = p._getOffsetForId(t.id, i), s = [...i];
2238
2558
  s.splice(a, 1), p._updateSheetRefStates(s);
@@ -2247,7 +2567,7 @@ var En, Dn, $ = class e extends ge {
2247
2567
  let m = new Map(r.refsByInstance);
2248
2568
  m.delete(e), r.listenersSheets.get(t.id)();
2249
2569
  let h = new Map(r.listenersSheets);
2250
- h.delete(t.id), p._adjustRemoveSelectionIfRequired(a, t.id), p._adjustSheetNamesIfRequired(), p._sheetOnNameChange.delete(t.id), p._sheetOnVisibilityChange.delete(t.id), p._sheetOnIndexChange.delete(t.id), p._emitter.notify("onSheetsChange");
2570
+ h.delete(t.id), p._adjustRemoveSelectionIfRequired(a, t.id), p._adjustSheetNamesIfRequired(), p._sheetOnNameChange.delete(t.id), p._sheetOnVisibilityChange.delete(t.id), p._sheetOnIndexChange.delete(t.id), p._tellSheets(), p._emitter.notify("onSheetsChange");
2251
2571
  let g = new Set(r.sheetsCreated);
2252
2572
  g.has(o) && g.delete(o), p._updateState({
2253
2573
  refsById: c,
@@ -2282,7 +2602,27 @@ var En, Dn, $ = class e extends ge {
2282
2602
  listenersSheets: m
2283
2603
  }), this._adjustSheetNamesIfRequired();
2284
2604
  let g = new Set(this._getState().sheetsCreated);
2285
- return g.add(e.sheet), this._updateState({ sheetsCreated: g }), e;
2605
+ return g.add(e.sheet), this._updateState({ sheetsCreated: g }), this._tellSheets(), e;
2606
+ }
2607
+ _recordActiveSheet(e, t, n) {
2608
+ let r = this.getView().getId();
2609
+ e.setIntent(Mr, (e) => ({
2610
+ viewId: r,
2611
+ before: e?.before ?? t,
2612
+ after: n
2613
+ }));
2614
+ }
2615
+ _resyncActiveSheet(e, t) {
2616
+ let n = t?.sheetRefsVisible;
2617
+ if (!n?.length) return;
2618
+ let r = -1, i = n.length;
2619
+ for (let t = 0; t < i; t++) if (n[t].id === e) {
2620
+ r = t;
2621
+ break;
2622
+ }
2623
+ r === -1 && (r = Math.min(Math.max(this._activeSheetOffset, 0), i - 1));
2624
+ let a = n[r].id;
2625
+ this._view.getActiveSheetId() === a ? this._activeSheetOffset = r : this._view.setActiveSheetId(a);
2286
2626
  }
2287
2627
  _adjustRemoveSelectionIfRequired(e, t) {
2288
2628
  if (this._view.getActiveSheetId() === t) {
@@ -2296,25 +2636,25 @@ var En, Dn, $ = class e extends ge {
2296
2636
  let n = this._view.getActiveSheetId();
2297
2637
  n ??= (this._view.setActiveSheetId(t), t);
2298
2638
  let r = e.refsById.get(n);
2299
- r || (this._view.setActiveSheetId(t), r = e.refsById.get(t), n = t), r.visibility === O.Visibility.Visible && (this._activeSheetOffset = this._getOffsetForId(n, e.sheetRefsVisible));
2639
+ r || (this._view.setActiveSheetId(t), r = e.refsById.get(t), n = t), r.visibility === w.Visibility.Visible && (this._activeSheetOffset = this._getOffsetForId(n, e.sheetRefsVisible));
2300
2640
  }
2301
2641
  _validateDeleteSheet(e) {
2302
- if (this._closed) throw Error(H("error.workbook.modelClosed"));
2303
- if (!this.getProtection().isStructureAllowed()) throw new R(H("error.workbook.protection"));
2642
+ if (this._closed) throw Error(G("error.workbook.modelClosed"));
2643
+ if (!this.getProtection().isStructureAllowed()) throw new U(G("error.workbook.protection"));
2304
2644
  let t = this._getSheetRef(e);
2305
- if (!t) throw new R(function(e) {
2306
- return H("error.workbook.deleteKey", { key: e });
2645
+ if (!t) throw new B(function(e) {
2646
+ return G("error.workbook.deleteKey", { key: e });
2307
2647
  }(e));
2308
2648
  let n = this._getState().sheetRefsVisible;
2309
- if (n.length === 1 && n[0].id === t.id) throw new R(H("error.workbook.sheetOne"));
2649
+ if (n.length === 1 && n[0].id === t.id) throw new B(G("error.workbook.sheetOne"));
2310
2650
  }
2311
2651
  _getOffsetForId(e, t) {
2312
2652
  let n = t.length;
2313
2653
  for (let r = 0; r < n; r++) if (t[r].id === e) return r;
2314
- throw new R(H("error.workbook.noVisibleRefs"));
2654
+ throw new B(G("error.workbook.noVisibleRefs"));
2315
2655
  }
2316
2656
  find(e) {
2317
- if (this._closed) throw Error(H("error.workbook.modelClosed"));
2657
+ if (this._closed) throw Error(G("error.workbook.modelClosed"));
2318
2658
  let t = this._getSheets();
2319
2659
  if (t.length === 1) return t[0].find(e);
2320
2660
  typeof e == "string" && (e = { text: e });
@@ -2331,7 +2671,7 @@ var En, Dn, $ = class e extends ge {
2331
2671
  rowIndex: t[0].rowStart
2332
2672
  };
2333
2673
  }
2334
- let f = L.createCellComparator(e?.axis, e?.reverse);
2674
+ let f = z.createCellComparator(e?.axis, e?.reverse);
2335
2675
  delete (e = { ...e }).from;
2336
2676
  let p = () => {
2337
2677
  if (!d && u.done && (s && a === i ? d = !0 : n ? (a++, a > t.length - 1 && (a = 0, s = !0)) : (a--, a < 0 && (a = t.length - 1, s = !0)), r && s && (d = !0), d || c || !s || a !== i || (d = !0), !d)) {
@@ -2341,7 +2681,7 @@ var En, Dn, $ = class e extends ge {
2341
2681
  }
2342
2682
  if (!d && s && a === i && (u.done || !c || !u.done && f(u.value.getCoords(), c) >= 0) && (d = !0), d) {
2343
2683
  let e = u;
2344
- return u = Ce, e;
2684
+ return u = xe, e;
2345
2685
  }
2346
2686
  let p = u;
2347
2687
  return u = l.next(), p;
@@ -2353,7 +2693,7 @@ var En, Dn, $ = class e extends ge {
2353
2693
  } };
2354
2694
  }
2355
2695
  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 });
2696
+ let r = 0, i = null, a = typeof t == "function", o = n?.maxCount ?? 2 ** 53 - 1, s = !n?.maxCount, c = "", l = typeof t == "string" ? nt(t) : null, u = n?.description ?? W("op.replace"), d = this._transactions.beginCommit({ description: u });
2357
2697
  try {
2358
2698
  let u = null, f = null, p = e.next();
2359
2699
  for (; !p.done && r < o;) {
@@ -2365,13 +2705,10 @@ var En, Dn, $ = class e extends ge {
2365
2705
  let c = a ? t(o) : t;
2366
2706
  c !== void 0 && c !== o && (f.push(o, c), r++, i = o), p = e.next();
2367
2707
  }
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
- });
2708
+ f?.apply(), r === 1 && o === 1 && i && (c = i.getAddress()), r === 0 ? d.rollback() : d.commit({ description: n?.description ?? (s ? l === null ? W("op.replaceAll") : G("op.replaceAllWith", { value: l }) : c ? l === null ? G("op.replaceAt", { address: c }) : G("op.replaceAtWith", {
2709
+ address: c,
2710
+ value: l
2711
+ }) : l === null ? W("op.replace") : G("op.replaceWith", { value: l })) });
2375
2712
  } catch (e) {
2376
2713
  throw d.rollback(), e;
2377
2714
  }
@@ -2389,27 +2726,27 @@ var En, Dn, $ = class e extends ge {
2389
2726
  return n === 1 ? 0 : (e === void 0 && (e = this.getSelectedSheetIndex()), (e = Math.max(0, Math.min(e, n - 1))) <= 0 ? n - 1 : e - 1);
2390
2727
  }
2391
2728
  getNextSheet(e) {
2392
- if (this._closed) throw Error(H("error.workbook.modelClosed"));
2729
+ if (this._closed) throw Error(G("error.workbook.modelClosed"));
2393
2730
  let t = this._getSheetRefs();
2394
2731
  return t[this._nextSheetIndex(e, t)]?.sheet ?? null;
2395
2732
  }
2396
2733
  getPreviousSheet(e) {
2397
- if (this._closed) throw Error(H("error.workbook.modelClosed"));
2734
+ if (this._closed) throw Error(G("error.workbook.modelClosed"));
2398
2735
  let t = this._getSheetRefs();
2399
2736
  return t[this._prevSheetIndex(e, t)]?.sheet ?? null;
2400
2737
  }
2401
2738
  async _duplicateSheet(e) {
2402
- if (this._closed) throw Error(H("error.workbook.modelClosed"));
2403
- if (!this.getProtection().isStructureAllowed()) throw new R(H("error.workbook.protection"));
2739
+ if (this._closed) throw Error(G("error.workbook.modelClosed"));
2740
+ if (!this.getProtection().isStructureAllowed()) throw new U(G("error.workbook.protection"));
2404
2741
  let t = this._getSheetRefs(), n = this.getSelectedSheetIndex(), r = null;
2405
2742
  if (e) {
2406
- if (r = this._getSheetRef(e), !r) throw new R(yn(r));
2743
+ if (r = this._getSheetRef(e), !r) throw new B(Cr(r));
2407
2744
  } else r = t[n];
2408
2745
  if (!r) return null;
2409
- 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() }));
2746
+ let i = r.sheet, a = this._strings.beginPersist(), o = this.getResources().beginPersist(), s = this.getStyles().beginPersist(), c = null, l = this.beginCommit(G("op.duplicateNamed", { name: i.getName() }));
2410
2747
  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);
2412
- this._emitter.notify("onSheetsChange"), c = s, l.commit();
2748
+ 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);
2749
+ this._tellSheets(), this._emitter.notify("onSheetsChange"), c = s, l.commit();
2413
2750
  } catch (e) {
2414
2751
  throw l.rollback(), e;
2415
2752
  } finally {
@@ -2418,58 +2755,58 @@ var En, Dn, $ = class e extends ge {
2418
2755
  return c;
2419
2756
  }
2420
2757
  _createRange(e, t) {
2421
- let n = e ? { ...e } : null, r = n ? this._getSheetRef(n.scope, O.Visibility.VeryHidden) : null;
2758
+ let n = e ? { ...e } : null, r = n ? this._getSheetRef(n.scope, w.Visibility.VeryHidden) : null;
2422
2759
  if (!r) {
2423
2760
  let e = this.getSelectedSheet();
2424
- return e ? (delete n?.scope, wn(n, n ? {
2425
- scope: h,
2761
+ return e ? (delete n?.scope, Or(n, n ? {
2762
+ scope: Qe,
2426
2763
  ...e.getEntireRange().getCoords()
2427
- } : null)) : void console.warn(H("error.workbook.noVisibleRefs"));
2764
+ } : null)) : void console.warn(G("error.workbook.noVisibleRefs"));
2428
2765
  }
2429
2766
  let i = r.sheet, a = null;
2430
- return t && (a = { getOptions: t }), new On(e, D(i), this, a);
2767
+ return t && (a = { getOptions: t }), new Pr(e, C(i), this, a);
2431
2768
  }
2432
2769
  _createRanges(e, t) {
2433
2770
  let n = this.getSelectedSheet(), r = null;
2434
- return t && (r = { getOptions: t }), new $(e, D(n), this, r);
2771
+ return t && (r = { getOptions: t }), new Nr(e, C(n), this, r);
2435
2772
  }
2436
2773
  getRange(e, t) {
2437
2774
  if (e === void 0) return this.getSelectedRange(t);
2438
2775
  try {
2439
2776
  let n = this._rangesAddressToCoords(e);
2440
- if (n.length !== 1) throw new R(H("error.address.singleRangeOnlyAlt"));
2777
+ if (n.length !== 1) throw new B(G("error.address.singleRangeOnlyAlt"));
2441
2778
  return this._createRange(n[0], t);
2442
2779
  } catch (t) {
2443
- throw t instanceof B ? new B(t.message) : new R(t.message ?? o(e));
2780
+ throw t instanceof H ? new H(t.message) : new B(t.message ?? ae(e));
2444
2781
  }
2445
2782
  }
2446
2783
  getCell(e) {
2447
2784
  if (e === void 0) return this.getSelectedCell();
2448
2785
  let t = this.getRange(e);
2449
- if (t.size > 1) throw new R(H("error.address.singleCellOnly"));
2786
+ if (t.size > 1) throw new B(G("error.address.singleCellOnly"));
2450
2787
  return t.getCell();
2451
2788
  }
2452
2789
  getRanges(e, t) {
2453
2790
  let n = this._rangesAddressToCoords(e);
2454
- if (n.length === 0) throw new R(o(e));
2791
+ if (n.length === 0) throw new B(ae(e));
2455
2792
  return this._createRanges(n, t);
2456
2793
  }
2457
2794
  _createGraphRanges(e, t) {
2458
- let n = [];
2795
+ let n = [], r = this.getCalculation()?.getNamedFormulas() ?? null;
2459
2796
  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));
2797
+ let i = t[e], a = (i.sheetName ? this._getSheetRef(i.sheetName, w.Visibility.VeryHidden) : null)?.sheet ?? this.getSelectedSheet();
2798
+ a && n.push(new Le(i, r, C(a), null));
2462
2799
  }
2463
2800
  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);
2801
+ return n.length === 0 ? null : new Nr(n, C(this.getSelectedSheet()), this, null);
2465
2802
  }
2466
2803
  getStats(e) {
2467
- if (this._closed) throw Error(H("error.workbook.modelClosed"));
2468
- let t = this._getSheets(O.Visibility.VeryHidden), n = t.length;
2804
+ if (this._closed) throw Error(G("error.workbook.modelClosed"));
2805
+ let t = this._getSheets(w.Visibility.VeryHidden), n = t.length;
2469
2806
  if (n === 1) return t[0].getStats(e);
2470
2807
  let r = Array(n);
2471
2808
  for (let i = 0; i < n; i++) r[i] = t[i].getStats(e);
2472
- return new on(r);
2809
+ return new cr(r);
2473
2810
  }
2474
2811
  _activeRangeCoords() {
2475
2812
  let e = this.getSelectedSheet(), t = e.getSelection().getRanges().getCoords(), n = e.getName(), r = t.length, i = Array(r);
@@ -2494,32 +2831,32 @@ var En, Dn, $ = class e extends ge {
2494
2831
  getSelectedCell() {
2495
2832
  return this.getSelectedSheet().getSelectedCell();
2496
2833
  }
2497
- _rangesAddressToCoords(e, n = !0, r = O.Visibility.Hidden) {
2498
- 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") {
2834
+ _rangesAddressToCoords(e, t = !0, n = w.Visibility.Hidden) {
2835
+ if (!e) throw new B(G("error.address.noAddress"));
2836
+ let r = this.getSelectedSheet(), i = { ...r?.getEntireRange().getCoords() }, a = r?.getName();
2837
+ if (a && (i.scope = a), typeof e == "string") {
2501
2838
  let t = e.trim().toLowerCase();
2502
2839
  if (t === "r" || t === "c") {
2503
2840
  let n = this.getSelectedCell().getCoords(), r = {};
2504
2841
  t === "r" ? r.rowStart = r.rowEnd = n.rowIndex : r.colStart = r.colEnd = n.colIndex, e = r;
2505
2842
  }
2506
2843
  }
2507
- let s = this, c = le(e, a, t, (e) => {
2508
- if (!n) return null;
2844
+ let o = this, s = ht(e, i, vt, (e) => {
2845
+ if (!t) return null;
2509
2846
  if (typeof e == "string") {
2510
- let t = s.getNames().getByName(e)?.getRanges?.();
2847
+ let t = o.getNames().getByName(e)?.getRanges?.();
2511
2848
  if (t) return t.getCoords();
2512
2849
  }
2513
- 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;
2850
+ throw new B(`Invalid sheet reference '${e}'.`);
2851
+ }), c = s.length;
2852
+ for (let e = 0; e < c; e++) this._validateCoords(s[e], n);
2853
+ return s;
2517
2854
  }
2518
- _validateCoords(e, t = O.Visibility.Visible, n = H("error.sheet.oobRange")) {
2855
+ _validateCoords(e, t = w.Visibility.Visible, n = G("error.sheet.oobRange")) {
2519
2856
  if (e === null) return;
2520
2857
  let r = this.getSheet(e.scope, t).getEntireRange().getCoords();
2521
- if (!L.isRangeWithinRange(e, r)) throw new B(n);
2522
- if (e.rowEnd < e.rowStart || e.colEnd < e.colStart) throw new R(H("error.address.invalidRangeInverted"));
2858
+ if (!z.isRangeWithinRange(e, r)) throw new H(n);
2859
+ if (e.rowEnd < e.rowStart || e.colEnd < e.colStart) throw new B(G("error.address.invalidRangeInverted"));
2523
2860
  }
2524
2861
  _updateSheetRef(e, t) {
2525
2862
  let n = this._getState(), r = [...n.sheetRefsAll];
@@ -2536,19 +2873,19 @@ var En, Dn, $ = class e extends ge {
2536
2873
  refsByLowerCaseName: s,
2537
2874
  sheetsByLowerCaseName: c,
2538
2875
  refsByInstance: u
2539
- }), t;
2876
+ }), this._tellSheets(), t;
2540
2877
  }
2541
2878
  _setSheetName(e, t, n) {
2542
- if (this._closed) throw Error(H("error.workbook.modelClosed"));
2543
- if (!this.getProtection().isStructureAllowed()) throw new R(H("error.workbook.protection"));
2879
+ if (this._closed) throw Error(G("error.workbook.modelClosed"));
2880
+ if (!this.getProtection().isStructureAllowed()) throw new U(G("error.workbook.protection"));
2544
2881
  let r = this._getSheetRef(e);
2545
- if (!r) throw new R(yn(e));
2882
+ if (!r) throw new B(Cr(e));
2546
2883
  if (t === r.name) return r.sheet;
2547
- if ((t = this._validateNewSheetName(t)) == null) throw new R(H("error.workbook.sheetNameNotProvided"));
2884
+ if ((t = this._validateNewSheetName(t)) == null) throw new B(G("error.workbook.sheetNameNotProvided"));
2548
2885
  let i = Object.freeze({
2549
2886
  ...r,
2550
2887
  name: t
2551
- }), a = null, o = this.beginCommit(V("op.renameSheet"));
2888
+ }), a = null, o = this.beginCommit(W("op.renameSheet"));
2552
2889
  try {
2553
2890
  let e = this._updateSheetRef(r, i);
2554
2891
  this._adjustSheetNamesIfRequired(), this._sheetOnNameChange.forEach((e, t) => {
@@ -2559,23 +2896,23 @@ var En, Dn, $ = class e extends ge {
2559
2896
  }
2560
2897
  return a;
2561
2898
  }
2562
- _setSheetVisibility(e, t = O.Visibility.Visible, n) {
2563
- if (this._closed) throw Error(H("error.workbook.modelClosed"));
2564
- if (!this.getProtection().isStructureAllowed()) throw new R(H("error.workbook.protection"));
2565
- let r = this._getSheetRef(e, O.Visibility.VeryHidden);
2899
+ _setSheetVisibility(e, t = w.Visibility.Visible, n) {
2900
+ if (this._closed) throw Error(G("error.workbook.modelClosed"));
2901
+ if (!this.getProtection().isStructureAllowed()) throw new U(G("error.workbook.protection"));
2902
+ let r = this._getSheetRef(e, w.Visibility.VeryHidden);
2566
2903
  if (!r) return null;
2567
2904
  if (t === r.visibility) return;
2568
2905
  let i = null, a = "";
2569
- t === O.Visibility.Visible ? a = V("op.unhideSheet") : t === O.Visibility.Hidden ? a = V("op.hideSheet") : t === O.Visibility.VeryHidden && (a = V("op.veryHideSheet"));
2906
+ t === w.Visibility.Visible ? a = W("op.unhideSheet") : t === w.Visibility.Hidden ? a = W("op.hideSheet") : t === w.Visibility.VeryHidden && (a = W("op.veryHideSheet"));
2570
2907
  let o = this.beginCommit(a);
2571
2908
  try {
2572
2909
  let e = this._getState().sheetRefsVisible;
2573
- if (t !== O.Visibility.Visible && e.length === 1 && e[0].id === r.id) throw new R(H("error.workbook.sheetOne"));
2910
+ if (t !== w.Visibility.Visible && e.length === 1 && e[0].id === r.id) throw new B(G("error.workbook.sheetOne"));
2574
2911
  let a = {
2575
2912
  ...r,
2576
2913
  visibility: t
2577
2914
  }, s = -1;
2578
- t !== O.Visibility.Visible && (s = this._getOffsetForId(r.id, e)), i = this._updateSheetRef(r, a).sheet, t !== O.Visibility.Visible && this._adjustRemoveSelectionIfRequired(s, r.id), this._adjustSheetNamesIfRequired(), o.commit(n);
2915
+ t !== w.Visibility.Visible && (s = this._getOffsetForId(r.id, e)), i = this._updateSheetRef(r, a).sheet, t !== w.Visibility.Visible && this._adjustRemoveSelectionIfRequired(s, r.id), this._adjustSheetNamesIfRequired(), o.commit(n);
2579
2916
  } catch (e) {
2580
2917
  throw o.rollback(), e;
2581
2918
  }
@@ -2584,61 +2921,61 @@ var En, Dn, $ = class e extends ge {
2584
2921
  }), this._emitter.notify("onSheetsChange"), i;
2585
2922
  }
2586
2923
  _moveSheet(e, t, n) {
2587
- if (this._closed) throw Error(H("error.workbook.modelClosed"));
2588
- if (!this.getProtection().isStructureAllowed()) throw new R(H("error.workbook.protection"));
2589
- let r = null, i = this.beginCommit(H("op.moveSheetNamed", { name: e.name }));
2924
+ if (this._closed) throw Error(G("error.workbook.modelClosed"));
2925
+ if (!this.getProtection().isStructureAllowed()) throw new U(G("error.workbook.protection"));
2926
+ let r = null, i = this.beginCommit(G("op.moveSheetNamed", { name: e.name }));
2590
2927
  try {
2591
2928
  let a = this._getState(), o = a.sheetRefsVisible;
2592
- 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);
2929
+ if (t < 0 || t > o.length - 1) throw new B(`Invalid to index: ${t}`);
2930
+ let s = this.getView().getActiveSheetId(), c = a.sheetRefsAll, l = this._getOffsetForId(e.id, c), u = this._getOffsetForId(o[t].id, c);
2597
2931
  if (l === u) return;
2598
2932
  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) => {
2933
+ 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
2934
  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
- });
2935
+ }), this._tellSheets(), this._emitter.notify("onSheetsChange"), r = d.sheet, this._recordActiveSheet(i, s, this.getView().getActiveSheetId()), i.commit(n);
2609
2936
  } catch (e) {
2610
2937
  throw i.rollback(), e;
2611
2938
  }
2612
2939
  return r;
2613
2940
  }
2614
2941
  _setSelectedSheet(e) {
2615
- if (this._closed) throw Error(H("error.workbook.modelClosed"));
2942
+ if (this._closed) throw Error(G("error.workbook.modelClosed"));
2616
2943
  let t = this._getSheetRef(e);
2617
- if (!t) throw new R(yn(e));
2944
+ if (!t) throw new B(Cr(e));
2618
2945
  let n = null;
2619
- return t.visibility !== O.Visibility.Visible && this._setSheetVisibility(t, O.Visibility.Visible), this._view.setActiveSheetId(t.id), n = t.sheet, n;
2946
+ return t.visibility !== w.Visibility.Visible && this._setSheetVisibility(t, w.Visibility.Visible), this._view.setActiveSheetId(t.id), n = t.sheet, n;
2620
2947
  }
2621
2948
  getProtection() {
2622
2949
  return this._protection;
2623
2950
  }
2951
+ getCodeName() {
2952
+ return this._codeName;
2953
+ }
2624
2954
  getNames() {
2625
2955
  return this._names;
2626
2956
  }
2627
2957
  getCalculation() {
2628
2958
  return this._calculation;
2629
2959
  }
2630
- createFormula(e, t) {
2631
- return this.getCalculation().createFormula(e, t);
2960
+ getFonts() {
2961
+ return kn.getShared();
2962
+ }
2963
+ createFormula(e, t, n) {
2964
+ return this.getCalculation().createFormula(e, t, n);
2632
2965
  }
2633
2966
  evaluate(e, t) {
2634
2967
  return this.getCalculation().evaluate(e, t);
2635
2968
  }
2636
- whenCalculationReady() {
2637
- return this.getCalculation().ready();
2969
+ async whenCalculationReady() {
2970
+ let e = this._starting;
2971
+ return e ? e.then(() => this.getCalculation().ready()) : this.getCalculation().ready();
2638
2972
  }
2639
2973
  getScripts() {
2640
2974
  return this._scripts ||= this._createScripts(), this._scripts;
2641
2975
  }
2976
+ getModules() {
2977
+ return this.getScripts().getModules();
2978
+ }
2642
2979
  _notifyAllChange() {
2643
2980
  this._emitter.notify("onSheetsChange"), this._emitter.notify("onSelectedSheetChange"), this._emitter.notify("onViewChange");
2644
2981
  }
@@ -2650,6 +2987,7 @@ var En, Dn, $ = class e extends ge {
2650
2987
  return (n) => {
2651
2988
  let r = () => {
2652
2989
  let e = n.getSource();
2990
+ if (e.isInvalid()) return e;
2653
2991
  if (e.isICellRanges) {
2654
2992
  let n = [...e.getCoords()], r = n.length;
2655
2993
  for (let t = 0; t < r; t++) {
@@ -2682,45 +3020,72 @@ var En, Dn, $ = class e extends ge {
2682
3020
  });
2683
3021
  };
2684
3022
  }
2685
- _fromJSON(e) {
2686
- 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));
2688
- let t = this._strings.beginPersist(), n = this._resources.beginPersist(), r = this._styles.beginPersist();
3023
+ _holdPivotCaches() {
3024
+ let e = this._pivotCaches;
3025
+ if (e.length === 0) return;
3026
+ let t = (e) => {
3027
+ let t = this._getSheetRef(e)?.sheet;
3028
+ return t ? t._contentAddWatch(() => null) : null;
3029
+ };
3030
+ for (let n = 0; n < e.length; n++) e[n]._hold(t);
3031
+ }
3032
+ _fromJSON(e, t) {
3033
+ if (this._emitter.notify("onBeforeLoad", { params: e }), this._initState(), !e.sheets || e.sheets.length === 0) throw new B(G("error.workbook.sheetOne"));
3034
+ e.theme && (this._theme = new _t(e.theme), this._styles.setTheme(this._theme));
3035
+ let n = this._strings.beginPersist(), r = this._resources.beginPersist(), i = this._styles.beginPersist();
2689
3036
  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);
3037
+ n.fromJSON(e.strings), r.fromJSON(e.resources), i.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 ||= {};
3038
+ let a = [], o = e.pivotCaches;
3039
+ if (o) {
3040
+ let e = r.fromResourceId.bind(r);
3041
+ for (let t = 0; t < o.length; t++) {
3042
+ let n = o[t];
3043
+ n && typeof n.cacheId == "number" && a.push(new dr(n.cacheId, de.fromJSON(n.part, e)));
3044
+ }
2697
3045
  }
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");
3046
+ this._pivotCaches = a, this._people.fromJSON(e.people);
3047
+ let s = e.sheets, c = s.length, l = e.view.activeSheetId ?? null;
3048
+ l !== null && (l = Math.min(Math.max(0, l), c - 1));
3049
+ let u = null, d = null;
3050
+ this._isLoadingSheets = !0;
3051
+ for (let e = 0; e < c; e++) {
3052
+ let n = s[e], r = n.visibility || w.Visibility.Visible, i = e;
3053
+ d = i, r === w.Visibility.Visible ? u === null && (u = i) : l !== null && l === i && (l = null);
3054
+ try {
3055
+ this._createSheet(i, n.name, r, e, n.sheetId, n.sheet, t?.[e]);
3056
+ } catch (e) {
3057
+ throw this._isLoadingSheets = !1, e;
3058
+ }
3059
+ }
3060
+ this._isLoadingSheets = !1, this._tellSheets(), this._holdPivotCaches(), this._updateState({ lastId: d }), e.view.activeSheetId = l ?? u, this.setView(new br({ json: e.view })), this._adjustSheetNamesIfRequired(), this._listenerProtection?.();
3061
+ let f = this;
3062
+ this._protection = new Sr(e?.protection, this._options?.readonly), this._listenerProtection = this._protection.addListeners({ onChange: (e) => {
3063
+ f._emitter.notify("onProtectionChange", { source: e });
3064
+ } }), this._emitter.notify("onLoad");
2703
3065
  } finally {
2704
- r.endPersist(), n.endPersist(), t.endPersist();
3066
+ i.endPersist(), r.endPersist(), n.endPersist();
2705
3067
  }
2706
3068
  }
2707
3069
  _createScripts(e) {
2708
3070
  let t = this;
2709
- return new pn({
3071
+ return new hr({
2710
3072
  transactions: this._transactions,
2711
3073
  json: e,
2712
3074
  workbook: t,
2713
3075
  getBuiltInFunctions: () => t._calculation?.getFunctions(),
2714
3076
  onAdd: (e, n) => {
2715
3077
  let r = t._calculation;
2716
- r.getStatus() !== Ye.Status.Off && r.start().then(async () => {
2717
- let e = n.getFunctions().getItems({ type: "formula" }), t = e.length;
3078
+ r.getStatus() !== y.Status.Off && r.start().then(async () => {
3079
+ let e = n.getFunctions().getItems({
3080
+ type: "formula",
3081
+ includeHidden: !0
3082
+ }), t = e.length;
2718
3083
  for (let n = 0; n < t; n++) {
2719
3084
  let t = e[n];
2720
3085
  try {
2721
3086
  await this._calculation.getFunctions().add(t);
2722
3087
  } catch (e) {
2723
- z.error(e?.message ?? String(e), e);
3088
+ V.error(e?.message ?? String(e), e);
2724
3089
  }
2725
3090
  }
2726
3091
  }).catch(() => {});
@@ -2729,51 +3094,63 @@ var En, Dn, $ = class e extends ge {
2729
3094
  });
2730
3095
  }
2731
3096
  async toJSON(e) {
2732
- 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) {
3097
+ if (this._closed) throw Error(G("error.workbook.modelClosed"));
3098
+ await Promise.resolve(this._starting);
3099
+ let t = this.getCalculation();
3100
+ t.getStatus() !== y.Status.Off && (await t.ready(), await t._whenRequestsSettled?.()), await this._emitter.notify("onBeforeSave", { async: !0 });
3101
+ let n = { sheets: [] }, r = e?.ignoreStyles ?? !1;
3102
+ if (!r) {
2736
3103
  let e = this._theme.toJSON();
2737
- (e ? Object.keys(e).length : 0) > 0 && (t.theme = e);
3104
+ (e ? Object.keys(e).length : 0) > 0 && (n.theme = e);
2738
3105
  }
2739
3106
  if (this._scripts) {
2740
3107
  let e = this._scripts.toJSON();
2741
- e && Object.keys(e).length > 0 && (t.scripts = e);
3108
+ e && Object.keys(e).length > 0 && (n.modules = e);
2742
3109
  }
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();
3110
+ 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);
3111
+ let i = e?.resources ?? "embed", a = i === "ignore", o = this._strings.beginPersist(), s = a ? null : this._resources.beginPersist(), c = this._styles.beginPersist();
2745
3112
  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
3113
+ let t = this._getSheetRef(this.getSelectedSheetIndex()).id, l = t, u = null, d = this._getState(), f = d.sheetRefsAll, p = d.sheetsById, m = f.length;
3114
+ for (let r = 0; r < m; r++) {
3115
+ let i = f[r], a = r + 1, o = await p.get(i.id).toJSON(e), s = {
3116
+ name: i.name,
3117
+ sheet: o
2751
3118
  };
2752
- r.visibility === O.Visibility.Visible ? l === null && (l = i) : o.visibility = r.visibility, r.id === s && (c = i), t.sheets.push(o);
3119
+ i.sheetId !== void 0 && (s.sheetId = i.sheetId), i.visibility === w.Visibility.Visible ? u === null && (u = a) : s.visibility = i.visibility, i.id === t && (l = a), n.sheets.push(s);
3120
+ }
3121
+ if (!r) {
3122
+ let e = c.toJSON();
3123
+ e && Object.keys(e).length > 0 && (n.styles = e);
2753
3124
  }
2754
- if (!n) {
2755
- let e = o.toJSON();
2756
- e && Object.keys(e).length > 0 && (t.styles = e);
3125
+ let h = this.getProtection().toJSON();
3126
+ h && (n.protection = h);
3127
+ let g = this._calculation.toJSON();
3128
+ Object.keys(g).length > 0 && (n.calc = g);
3129
+ let _ = await o.toJSONAsync();
3130
+ _ && _.length > 0 && (n.strings = _);
3131
+ let v = this._calculation.getExternalBooks().toJSON();
3132
+ v && (n.externalBooks = v);
3133
+ let y = this._pivotCaches;
3134
+ if (y.length > 0) {
3135
+ let e = s ? s.toResourceId.bind(s) : () => null, t = /* @__PURE__ */ new Set();
3136
+ for (let e of this.getPivotTables()) t.add(e.getCacheId());
3137
+ let r = [];
3138
+ for (let n = 0; n < y.length; n++) t.has(y[n].cacheId) && r.push(y[n].toJSON(e));
3139
+ r.length > 0 && (n.pivotCaches = r);
2757
3140
  }
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);
3141
+ let b = this._people.toJSON();
3142
+ if (b && (n.people = b), !a) {
3143
+ let e = await s.toJSONAsync(typeof i == "function" ? i : void 0);
3144
+ e && e.length > 0 && (n.resources = e);
2768
3145
  }
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));
3146
+ let x = this._calculation.getNamedFormulas().toJSON();
3147
+ x && x.length > 0 && (n.names = x);
3148
+ let S = this._view.toJSON();
3149
+ S && (l === u ? delete S.activeSheetId : S.activeSheetId = l, Object.keys(S).length > 0 && (n.view = S));
2773
3150
  } finally {
2774
- o.endPersist(), r || a.endPersist(), i.endPersist();
3151
+ c.endPersist(), a || s.endPersist(), o.endPersist();
2775
3152
  }
2776
- return this._emitter.notify("onSave", { params: t }), t;
3153
+ return this._emitter.notify("onSave", { params: n }), n;
2777
3154
  }
2778
3155
  isClosed() {
2779
3156
  return this._closed;
@@ -2791,16 +3168,16 @@ var En, Dn, $ = class e extends ge {
2791
3168
  } catch (e) {
2792
3169
  console.warn("error on close", e);
2793
3170
  }
2794
- this._ownResources, this._ownNames && this._names.close(), this._ownCalculation && this._calculation.close(), this._ownStyles, this._transactionsRemoveListener?.(), this._listenerLanguage?.(), this._listenerOrigin?.(), this._closed = !0;
3171
+ 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 pn && this._originProvider.release(), this._closed = !0;
2795
3172
  }
2796
3173
  beginCommit(e) {
2797
- if (this._closed) throw Error(H("error.workbook.modelClosed"));
3174
+ if (this._closed) throw Error(G("error.workbook.modelClosed"));
2798
3175
  return this._beginCommit(typeof e == "string" ? { description: e } : e);
2799
3176
  }
2800
3177
  doBatch(e, t) {
2801
3178
  let n = this;
2802
3179
  return t = typeof t == "string" ? { description: t } : {
2803
- description: V("op.updateWorkbook"),
3180
+ description: W("op.updateWorkbook"),
2804
3181
  ...t
2805
3182
  }, this._transactions.doBatch(e, t, (e, t) => {
2806
3183
  e.getDepth() === 0 && (n._lastTransactionUUID = e.getId());
@@ -2815,7 +3192,7 @@ var En, Dn, $ = class e extends ge {
2815
3192
  _getState() {
2816
3193
  return this._transactions.getState(this._id);
2817
3194
  }
2818
- _updateState(e, t = V("op.updateWorkbook"), n) {
3195
+ _updateState(e, t = W("op.updateWorkbook"), n) {
2819
3196
  if (!e) return;
2820
3197
  let r = this._beginCommit(t);
2821
3198
  try {
@@ -2836,7 +3213,7 @@ var En, Dn, $ = class e extends ge {
2836
3213
  get isIWorkbook() {
2837
3214
  return !0;
2838
3215
  }
2839
- }, An = { address: null }, jn = class {
3216
+ }, Lr = { address: null }, Rr = class {
2840
3217
  constructor() {
2841
3218
  this._readFormats = [], this._writeFormats = [], this._encryptions = [];
2842
3219
  }
@@ -2853,9 +3230,7 @@ var En, Dn, $ = class e extends ge {
2853
3230
  if (n !== -1) {
2854
3231
  let t = [...this._encryptions];
2855
3232
  t[n] = e, this._encryptions = Object.freeze(t);
2856
- return;
2857
- }
2858
- this._encryptions = Object.freeze([...this._encryptions, e]);
3233
+ } else this._encryptions = Object.freeze([...this._encryptions, e]);
2859
3234
  }
2860
3235
  async getEncryption(e) {
2861
3236
  return this.peekEncryption(e);
@@ -2912,9 +3287,9 @@ var En, Dn, $ = class e extends ge {
2912
3287
  return !0;
2913
3288
  });
2914
3289
  }
2915
- }, Mn = (e) => !!e && typeof e == "object" && typeof e.getPath == "function" && typeof e.canWrite == "function", Nn = class {
3290
+ }, zr = /* @__PURE__ */ new WeakMap(), Br = (e) => !!e && typeof e == "object" && typeof e.getPath == "function" && typeof e.canWrite == "function", Vr = class {
2916
3291
  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());
3292
+ this._setInstalled = /* @__PURE__ */ new WeakSet(), this._backingStore = null, this._emitter = new t(this), this._registry = new Rr(), this._defaultStore = new hn(() => this.getWriteFormats(), () => this.getReadFormats());
2918
3293
  }
2919
3294
  getBackingStore() {
2920
3295
  return this._backingStore ?? this._defaultStore;
@@ -2949,15 +3324,18 @@ var En, Dn, $ = class e extends ge {
2949
3324
  return this._registry.getWriteFormats(e);
2950
3325
  }
2951
3326
  getOrigin(e) {
2952
- return new U(e);
3327
+ return new K(e);
2953
3328
  }
2954
3329
  async read(e) {
2955
3330
  let t = null;
2956
3331
  if (typeof e == "string") e = { source: e };
2957
- else if (Mn(e)) {
3332
+ else if (Br(e)) {
2958
3333
  let n = e.getPath();
2959
3334
  if (!n) throw Error("Cannot read from an unbound origin (no path).");
2960
- t = e, e = { source: n };
3335
+ dn(e) ? e = {
3336
+ source: n,
3337
+ asCopy: !0
3338
+ } : (t = e, e = { source: n });
2961
3339
  }
2962
3340
  let n = e ?? {}, { source: r = null, ...i } = n, a = this.getBackingStore();
2963
3341
  return (a.read ? a : this._defaultStore).read({
@@ -2973,21 +3351,23 @@ var En, Dn, $ = class e extends ge {
2973
3351
  search: i,
2974
3352
  ext: a
2975
3353
  }))[0];
2976
- if (!o) throw new R(H("error.io.readFormatUnavailable", { format: i ?? a }));
3354
+ if (!o) throw new B(G("error.io.readFormatUnavailable", { format: i ?? a }));
2977
3355
  let s = n?.typedCreateWorkbookOptions, c = s ? Object.keys(s).find((e) => e.toLowerCase() === o.key.toLowerCase()) : void 0, l = {
2978
3356
  ...n,
2979
3357
  ...c === void 0 ? void 0 : s[c]
2980
3358
  };
2981
- delete l.typedCreateWorkbookOptions, delete l.source;
2982
- let u = r ?? new U(t.absolutePath ?? null, {
3359
+ delete l.typedCreateWorkbookOptions, delete l.source, delete l.asCopy;
3360
+ let u = r ?? new K(t.absolutePath ?? null, {
2983
3361
  name: t.name ?? null,
2984
3362
  format: o.key,
2985
3363
  size: t.size ?? null,
3364
+ lastModified: t.lastModified ?? null,
2986
3365
  canWrite: t.canWrite ?? !1
2987
3366
  });
2988
- r instanceof U && r.update({
3367
+ r instanceof K && r.update({
2989
3368
  format: o.key,
2990
- size: t.size ?? null
3369
+ size: t.size ?? null,
3370
+ lastModified: t.lastModified ?? null
2991
3371
  }), l.createWorkbookOptions = {
2992
3372
  ...l.createWorkbookOptions || {},
2993
3373
  origin: u
@@ -3018,7 +3398,7 @@ var En, Dn, $ = class e extends ge {
3018
3398
  }
3019
3399
  async _decrypt(e, t, n) {
3020
3400
  let r = await this._registry.detectEncryption(e);
3021
- if (t instanceof U && t.update({ encryption: r ? r.key : null }), !r) return {
3401
+ if (t instanceof K && t.update({ encryption: r ? r.key : null }), !r) return {
3022
3402
  bytes: e,
3023
3403
  password: null
3024
3404
  };
@@ -3026,7 +3406,7 @@ var En, Dn, $ = class e extends ge {
3026
3406
  try {
3027
3407
  return i = await r.decode(e, t), !0;
3028
3408
  } catch (e) {
3029
- if (!(e instanceof ht)) throw e;
3409
+ if (!(e instanceof Qt)) throw e;
3030
3410
  return !1;
3031
3411
  }
3032
3412
  };
@@ -3036,7 +3416,7 @@ var En, Dn, $ = class e extends ge {
3036
3416
  };
3037
3417
  if (!n?.onPassword) {
3038
3418
  let e = t.getName();
3039
- throw new vt(e ? H("error.io.passwordRequired", { name: e }) : H("error.io.passwordRequiredUnnamed"));
3419
+ throw new tn(e ? G("error.io.passwordRequired", { name: e }) : G("error.io.passwordRequiredUnnamed"));
3040
3420
  }
3041
3421
  let o = await Promise.resolve(n.onPassword({
3042
3422
  origin: t,
@@ -3048,95 +3428,117 @@ var En, Dn, $ = class e extends ge {
3048
3428
  bytes: i,
3049
3429
  password: o
3050
3430
  };
3051
- throw new ht(H("error.io.passwordIncorrect"));
3431
+ throw new Qt(G("error.io.passwordIncorrect"));
3052
3432
  }
3053
3433
  async writeArrayBuffer(e, t) {
3054
3434
  if (!t?.format) throw Error("A format must be specified to write to an ArrayBuffer (e.g. { format: 'xlsx' }).");
3055
3435
  let n = (await this._registry.getWriteFormats({ search: t.format }))[0];
3056
- if (!n) throw new R(H("error.io.writeFormatUnavailable", { format: t.format }));
3436
+ if (!n) throw new B(G("error.io.writeFormatUnavailable", { format: t.format }));
3057
3437
  return this._writeArrayBuffer(e, n, t);
3058
3438
  }
3059
3439
  async write(e, t, n) {
3440
+ return typeof t == "string" || Br(t) ? this._write(e, t, !1, n) : this._write(e, e?.getOrigin?.(), !0, t ?? n);
3441
+ }
3442
+ async writeAs(e, t, n) {
3443
+ if (!t) throw Error("A target must be provided for writeAs (use write(workbook) for a plain save).");
3444
+ return this._write(e, t, !0, n);
3445
+ }
3446
+ async _write(e, t, n, r) {
3060
3447
  if (!e) throw Error("Workbook must be provided.");
3061
3448
  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") {
3449
+ let i = typeof t == "string" ? this.getOrigin(t) : t, a = i.getFormat(), o;
3450
+ 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 B(G("error.io.writeFormatUnresolved"));
3451
+ let s = i.getExtension();
3452
+ if (r?.format && s && i.getPath() && i.canWrite() && !o.exts.includes(s)) {
3453
+ let e = (await this._registry.getWriteFormats({ ext: s }))[0];
3454
+ if (e && e.key !== o.key) {
3455
+ let e = i.getPath().split(/[/\\]/).pop();
3456
+ throw new B(G("error.io.writeFormatMismatch", {
3457
+ format: r.format,
3458
+ file: e
3459
+ }));
3460
+ }
3461
+ }
3462
+ if (typeof t == "string") {
3067
3463
  let e = i.getPath();
3068
- e && !x(e) && i.update?.({ path: `${e}.${c.exts[0]}` });
3464
+ i = new K(T(e) ? e : `${e}.${o.exts[0]}`, { format: o.key });
3069
3465
  }
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"));
3466
+ let c = i.getEncryption(), l = e.getOrigin?.(), u = (i instanceof K ? i.getPassword() : null) ?? (l instanceof K ? l.getPassword() : null), d = i.isEncrypted() || (l?.isEncrypted() ?? !1), f = r?.password === void 0 ? u ?? (d ? void 0 : null) : r.password, p = null;
3467
+ if (f === void 0) {
3468
+ if (d) {
3469
+ let e = i.getName();
3470
+ throw new tn(e ? G("error.io.passwordRequiredSave", { name: e }) : G("error.io.passwordRequiredSaveUnnamed"));
3075
3471
  }
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 = {
3472
+ } else if (f !== null && (p = await this._registry.getEncryption(c), !p)) throw new B(G("error.io.encryptionUnavailable"));
3473
+ let m = `${i.getName() ?? G("workbook.defaultName")}.${o.exts[0]}`, h = r?.progress, g = !i.getPath() || !i.canWrite() || !!r?.prompt, _ = !1, v = this, y = null, b = [], x = {
3078
3474
  workbook: e,
3079
- format: c,
3080
- origin: o,
3081
- suggestedName: h,
3475
+ format: o,
3476
+ origin: i,
3477
+ suggestedName: m,
3082
3478
  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;
3479
+ async encode(t, a) {
3480
+ let s = a ?? i;
3481
+ await (async (e) => {
3482
+ _ || (_ = !0, h?.onStart && await Promise.resolve(h.onStart(e)));
3483
+ })(s), y = e.getTransactions?.()?.getCurrentCommit() ?? y;
3484
+ let c = t ? (await v._registry.getWriteFormats({ search: t }))[0] ?? o : o, l = [], u = ((e, t) => ({
3485
+ onStart: e?.onStart ? (t, n) => e.onStart(t, n) : void 0,
3486
+ onProgress: e?.onProgress ? (t, n) => e.onProgress(t, n) : void 0,
3487
+ onError: e?.onError ? (t) => e.onError(t) : void 0,
3488
+ onComplete: e?.onComplete ? (t) => e.onComplete(t) : void 0,
3489
+ onWarning: (n, r) => {
3490
+ t.push({
3491
+ message: n ?? "",
3492
+ context: r
3493
+ }), e?.onWarning?.(n, r);
3494
+ }
3495
+ }))(h, l), d = await v._writeArrayBuffer(e, c, {
3496
+ ...r,
3497
+ progress: u
3498
+ }), m = zr.get(s);
3499
+ if (l.some((e) => !m?.has(e.message)) && r?.onWarnings) {
3500
+ let t = await Promise.resolve(r.onWarnings({
3501
+ workbook: e,
3502
+ origin: s,
3503
+ warnings: l,
3504
+ save: n,
3505
+ canCancel: !g
3506
+ }));
3507
+ if (!g && !1 === t) return null;
3508
+ }
3509
+ return b = l, p ? p.encode(d, f) : d;
3089
3510
  }
3090
- }, b = null;
3511
+ }, S = null;
3091
3512
  try {
3092
3513
  let t = this.getBackingStore();
3093
3514
  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 }));
3515
+ if (S = await t.write(x), S) {
3516
+ if (f !== void 0 && S instanceof K && (S.setPassword(f), S.update({ encryption: p ? p.key : null })), b.length) {
3517
+ let e = zr.get(S) ?? /* @__PURE__ */ new Set();
3518
+ for (let t of b) e.add(t.message);
3519
+ zr.set(S, e);
3520
+ }
3521
+ n && S !== e.getOrigin() && dn(e.getOrigin())?.setOrigin(S);
3096
3522
  let t = y ?? e.getTransactions?.()?.getCurrentCommit() ?? null;
3097
3523
  this._emitter.notify("onWrite", {
3098
3524
  params: {
3099
3525
  workbook: e,
3100
- origin: b,
3526
+ origin: S,
3101
3527
  commitId: t?.getId() ?? null,
3102
- save: a
3528
+ save: n
3103
3529
  },
3104
3530
  transactional: !1
3105
3531
  });
3106
3532
  }
3107
- g?.onComplete && await Promise.resolve(g.onComplete(b));
3533
+ h?.onComplete && await Promise.resolve(h.onComplete(S));
3108
3534
  } catch (e) {
3109
3535
  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 });
3536
+ throw h?.onError && await Promise.resolve(h.onError(t)), h?.onComplete && await Promise.resolve(h.onComplete(null)), t instanceof B ? t : Error(G("error.io.writeFailed", { reason: t.message }), { cause: e });
3111
3537
  }
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;
3538
+ return S;
3137
3539
  }
3138
3540
  _stripExtension(e) {
3139
- let t = x(e);
3541
+ let t = T(e);
3140
3542
  return t ? e.slice(0, e.length - t.length - 1) : e;
3141
3543
  }
3142
3544
  _baseName(e) {
@@ -3156,21 +3558,24 @@ var En, Dn, $ = class e extends ge {
3156
3558
  async _readArrayBuffer(e, t, n) {
3157
3559
  if (!e) throw Error("ArrayBuffer must be specified.");
3158
3560
  if (!t) throw Error("format must be specified.");
3159
- if (e.byteLength === 0) return new kn(n?.createWorkbookOptions);
3561
+ if (e.byteLength === 0) return new Ir(n?.createWorkbookOptions);
3160
3562
  let r = t.handler;
3161
3563
  if (!r) throw Error(`Unable to resolve a read handler for '${t.key}'.`);
3162
3564
  let i;
3163
3565
  try {
3164
3566
  i = await r(e, n);
3165
3567
  } catch (e) {
3166
- throw e instanceof R ? e : new R(H("error.io.readFailed", {
3568
+ throw e instanceof B ? e : new B(G("error.io.readFailed", {
3167
3569
  format: t.description ?? t.key,
3168
3570
  reason: e?.message ?? String(e)
3169
3571
  }), { cause: e });
3170
3572
  }
3171
- return i;
3573
+ return await kt(), i;
3574
+ }
3575
+ get isIWorkbookIO() {
3576
+ return !0;
3172
3577
  }
3173
- }, Pn = new Nn(), Fn = class {
3578
+ }, Hr = new Vr(), Ur = class {
3174
3579
  constructor() {
3175
3580
  this._buffer = null, this._formatKey = null;
3176
3581
  }
@@ -3179,44 +3584,88 @@ var En, Dn, $ = class e extends ge {
3179
3584
  }
3180
3585
  async write(e) {
3181
3586
  let t = await e.encode();
3182
- return this._buffer = t, this._formatKey = e.format.key, e.origin;
3587
+ return t ? (this._buffer = t, this._formatKey = e.format.key, e.origin) : null;
3183
3588
  }
3184
3589
  async read(e) {
3185
3590
  return this._buffer ? e.decode(this._buffer, { format: this._formatKey ?? void 0 }) : null;
3186
3591
  }
3187
- }, In = "locales", Ln = "fonts", Rn = [{
3188
- kind: In,
3592
+ }, Wr = "locales", Gr = "fonts", Kr = {
3593
+ suffix: ".msg.json",
3594
+ async extract(e) {
3595
+ let t = e.relPath.split("/");
3596
+ return t.length === 2 ? {
3597
+ locale: t[0],
3598
+ role: "messages"
3599
+ } : null;
3600
+ },
3601
+ place: (e, t) => t ? `${t}/${e}` : null
3602
+ }, qr = [
3603
+ ".woff2",
3604
+ ".woff",
3605
+ ".ttf",
3606
+ ".otf",
3607
+ ".ttc"
3608
+ ].map((e) => ({
3609
+ suffix: e,
3610
+ place: (e, t) => t ? `${t}/${e}` : e
3611
+ })), Jr = [{
3612
+ kind: Wr,
3613
+ files: [Kr]
3614
+ }, {
3615
+ kind: Gr,
3189
3616
  files: [{
3190
- suffix: ".msg.json",
3617
+ suffix: ".metrics.json",
3191
3618
  async extract(e) {
3192
- let t = e.relPath.split("/");
3193
- return t.length === 2 ? {
3194
- locale: t[0],
3195
- role: "messages"
3619
+ let t = await e.readJson();
3620
+ return t?.format === "sheetxl-font-metrics/1" ? {
3621
+ family: t.family,
3622
+ weight: t.weight,
3623
+ italic: t.italic
3196
3624
  } : null;
3197
3625
  },
3198
- place: (e, t) => t ? `${t}/${e}` : null
3199
- }]
3200
- }, {
3201
- kind: Ln,
3202
- files: [
3203
- ".woff2",
3204
- ".woff",
3205
- ".ttf",
3206
- ".otf",
3207
- ".ttc"
3208
- ].map((e) => ({
3209
- suffix: e,
3210
3626
  place: (e, t) => t ? `${t}/${e}` : e
3211
- }))
3627
+ }, ...qr]
3212
3628
  }];
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);
3629
+ Ar ||= {}, jr ||= {};
3630
+ var Q = null;
3631
+ function Yr() {
3632
+ if (!Q) {
3633
+ let e = import("./BqskM7wA8oPfFQue.mjs").then((e) => e.loadScriptingDeclarations());
3634
+ e.catch(() => {
3635
+ Q = null;
3636
+ }), Q = e;
3637
+ }
3638
+ return Q;
3217
3639
  }
3218
- zn ||= {};
3219
- var Hn = class extends Ge {
3640
+ var Xr, Zr, Qr, $ = null;
3641
+ function $r() {
3642
+ if (!$) {
3643
+ let e = import("./BqskM7wA8oPfFQue.mjs").then((e) => e.loadScriptingApi()).then((e) => JSON.parse(e));
3644
+ e.catch(() => {
3645
+ $ = null;
3646
+ }), $ = e;
3647
+ }
3648
+ return $;
3649
+ }
3650
+ Xr ||= {}, (Zr ||= {}).Type = {
3651
+ Button: "button",
3652
+ CheckBox: "checkBox",
3653
+ OptionButton: "optionButton",
3654
+ ListBox: "listBox",
3655
+ DropDown: "dropDown",
3656
+ ScrollBar: "scrollBar",
3657
+ Spinner: "spinner",
3658
+ GroupBox: "groupBox",
3659
+ Label: "label",
3660
+ EditBox: "editBox",
3661
+ Dialog: "dialog",
3662
+ Unknown: "formControl"
3663
+ }, (Qr ||= {}).DropStyle = {
3664
+ Combo: "combo",
3665
+ ComboEdit: "comboEdit",
3666
+ Simple: "simple"
3667
+ };
3668
+ var ei = class extends ie {
3220
3669
  constructor(e) {
3221
3670
  super(e);
3222
3671
  }
@@ -3229,8 +3678,8 @@ var Hn = class extends Ge {
3229
3678
  colEnd: (e?.size?.width ?? 5) - 1,
3230
3679
  rowEnd: (e?.size?.height ?? 5) - 1
3231
3680
  },
3232
- getRanges: (e) => null
3681
+ getRanges: (e) => new Be(null)
3233
3682
  }, super._initializeOptions(e);
3234
3683
  }
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 };
3684
+ }, ti = "0.8.0-beta.10", ni = "2026-10-16T12:44:53.600Z";
3685
+ export { ge as AbstractCollection, i as AbstractMovableContent, _ as AddressUtils, J as AdvanceTable, Ur as ArrayBackingStore, ot as AutoFill, ni as BUILD_DATE, P as Color, _e as Condition, Ke as DateUtils, Vr as DefaultWorkbookIO, bt as EXTERNAL_LINK_PATH_REL_TYPE, vr as ExternalRangeClipboardItem, Gr as FONTS_KIND, Bn as FontUtils, a as FormulaText, We as FunctionDeclarations, Pe as GeomUtils, Oe as IAnchored, Pt as IBorders, y as ICalculation, h as ICell, tr as ICellHeaderRange, At as ICellRange, er as ICellRanges, Ut as ICellStyle, M as IColor, ye as ICondition, Ce as IConditionalFormat, xt as IDataValidation, Qr as IDropDown, Ht as IEffect, N as IFill, j as IFont, kn as IFontCollection, Zr as IFormControl, Jt as IGeometry, Xr as IMovable, jr as IPicture, Ar as IPrint, $n as IResource, S as IScript, qt as IShape, w as ISheet, be as ISheetView, Me as ISlicerStyle, zn as ISort, Bt as IStroke, Ue as ITable, o as ITableStyle, le as IText, A as ITextFrame, Qn as ITheme, pt as IThemeCollection, an as IWorkbookIO, Wr as LOCALES_KIND, x as LicenseManager, te as MovableContentRegistry, ve as NamedStyleCollection, F as NumberFormat, pr as PersonCollection, _r as RangeClipboardItem, Un as RectAlignment, fe as Registry, Ae as Resource, Ee as ResourceCollection, Jr as SHEETXL_RESOURCE_KINDS, Vt as SYSTEM_COLOR_CSS_PREFIX, Kt as ShapeStyleUtils, O as Sheet, bn as SimpleFontFace, je as SlicerStyleCollection, ut as Sort, ee as StringCollection, re as StyleCollection, ei as Table, wn as TableFileAdvanceBuilder, Ne as TableStyleCollection, g as TextRotation, v as TextStacked, he as TextUtils, _t as Theme, ct as ThemeCollection, n as TransactionConflictError, ln as TransactionSaveStateManager, r as TransactionStore, on as TransactionUndoManager, Tt as Tuple, ti as VERSION, Ir as Workbook, Hr as WorkbookIO, K as WorkbookOrigin, br as WorkbookView, Zn as builtInStyleNameDisplay, He as createCellRangeCounts, Ot as externalBookClosedName, ze as externalBookFileName, Et as externalBookLocation, Se as externalBookOpenName, ir as getBuiltInFunctionNames, Je as getLanguagePack, zt as getLocaleProfile, Te as getScriptRuntime, $r as getScriptingApi, Yr as getScriptingDeclarations, Fe as localizeBoolean, yt as localizeErrorLabel, Mt as makeLocaleProfile, Dt as parseBooleanLocal, Re as parseErrorLocal, m as parseExternalScope, ar as parseFormulaLiteral, Xe as registerSdkLocales, Ct as sourceEntryFromPath, ke as withScriptRuntime };