@sheetxl/studio-vanilla 0.8.0-beta.1 → 0.8.0-beta.3

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 (478) hide show
  1. package/browser/cjs/00npLPxW7DhY7cIJ.cjs +5 -0
  2. package/browser/cjs/1gbSV4OYBoEWTygY2.cjs +1 -0
  3. package/browser/cjs/7SCJ4vwRZW4B71kq.cjs +8 -0
  4. package/browser/cjs/9LTjOB1_w-bikScD.cjs +1 -0
  5. package/browser/cjs/AVUt0iNPhRf4R5xb.cjs +1 -0
  6. package/browser/cjs/{aYuNpndpwcZG5eik2.cjs → B2fdTYeKGNugWRgn2.cjs} +2 -2
  7. package/browser/cjs/B4ANcw0mAmhe2Aeb2.cjs +1 -0
  8. package/browser/cjs/B6IXpae7f0J8Ocq62.cjs +1 -0
  9. package/browser/cjs/B6vy56yEA1I3B74O.cjs +1 -0
  10. package/browser/cjs/B7QDcu7uACQA1y3h.cjs +1 -0
  11. package/browser/cjs/B7oyN0rn95Kyes8D2.cjs +1 -0
  12. package/browser/cjs/BArvhvpcrQEcbcyY.cjs +1 -0
  13. package/browser/cjs/{Ci8Uu7_b4lwwRLAD2.cjs → BC3OSmoFNyA52TRp2.cjs} +1 -1
  14. package/browser/cjs/{_H5j4dU7HOBYTawU.cjs → BDmBYZigchoACsQx.cjs} +1 -1
  15. package/browser/cjs/BFmgMQoM5sQsWIxf2.cjs +1 -0
  16. package/browser/cjs/BIN8L9V0hoUwMh64.cjs +1 -0
  17. package/browser/cjs/BPWKnUtyoTrtW567.cjs +1 -0
  18. package/browser/cjs/BcROQ4pvVajDQ1em.cjs +1 -0
  19. package/browser/cjs/BjjAQLiorKWXy3g5.cjs +4 -0
  20. package/browser/cjs/Bncc0oXhFMdj_HuR2.cjs +1 -0
  21. package/browser/cjs/BoRfsJCaLzUHQseD.cjs +1 -0
  22. package/browser/cjs/BqQgEaUREvuFHYoW.cjs +1 -0
  23. package/browser/cjs/{Cm21F18ga8TluA9h.cjs → BtAs67e7WBCglqc5.cjs} +1 -1
  24. package/browser/cjs/BxFSy-hOEbyllj-r2.cjs +22 -0
  25. package/browser/cjs/{CRx1WvmgBjT8WVyB2.cjs → C0g87ndP2zMUbX6f2.cjs} +1 -1
  26. package/browser/cjs/C0xAhPzztP9a24zR.cjs +5 -0
  27. package/browser/cjs/C2SohnuJK8Urc7Fx2.cjs +2 -0
  28. package/browser/cjs/C3scwi-q2KqEM39H.cjs +126 -0
  29. package/browser/cjs/C4cZxb9nRtzTCA402.cjs +1 -0
  30. package/browser/cjs/C9q3zr8iCIoYDrdA2.cjs +1 -0
  31. package/browser/cjs/CBLwtHFYNB1BTpSS.cjs +1 -0
  32. package/browser/cjs/{lEQC21-Sk4lwHy2r2.cjs → CFxueP0tbpmvY1Ip2.cjs} +1 -1
  33. package/browser/cjs/CGtG2pvGgTAnImBg2.cjs +8 -0
  34. package/browser/cjs/CH0vbLpwoyU7oOFk.cjs +11 -0
  35. package/browser/cjs/CKtdmbeMjJ2udO8s.cjs +1 -0
  36. package/browser/cjs/CQ-W9AUNHdts8pmY.cjs +1 -0
  37. package/browser/cjs/CQ5x8oFPDaU6OCJf.cjs +3 -0
  38. package/browser/cjs/CRcv32tHTbGSGtkh2.cjs +1 -0
  39. package/browser/cjs/{DsIHLUKUrSrYhFHl.cjs → CTObzk4r7C71x9Ep2.cjs} +1 -1
  40. package/browser/cjs/CUyKbhM67853Rnt22.cjs +1 -0
  41. package/browser/cjs/CVHRh1RGDSgqfAm4.cjs +2 -0
  42. package/browser/cjs/CVHc_cJddJk7J3Zt.cjs +1 -0
  43. package/browser/cjs/CaJGoNwTL6pAJ6a42.cjs +1 -0
  44. package/browser/cjs/{bGMaev70Zd_NXqLM2.cjs → CcqhH_Ign02tLFbU2.cjs} +1 -1
  45. package/browser/cjs/CdsreHc3A0wBhEy9.cjs +14 -0
  46. package/browser/cjs/CfXcRa4RlFmqU0Op.cjs +1 -0
  47. package/browser/cjs/CgyU8XPzm6O1a93m.cjs +41 -0
  48. package/browser/cjs/CzGNIWwu8KL3tcCO2.cjs +1 -0
  49. package/browser/cjs/D-8QQWC-67PplJdV2.cjs +1 -0
  50. package/browser/cjs/D6XEHfNbKx-9qZye.cjs +32 -0
  51. package/browser/cjs/{a0Z-SXs_N71CtqYb2.cjs → D6YaqporVrSewZpm2.cjs} +1 -1
  52. package/browser/cjs/D6m2M4H6JZaYZ4El2.cjs +1 -0
  53. package/browser/cjs/{DIbdDzNf_3S2RYZN.cjs → D9SdUvJVa64UoGj9.cjs} +1 -1
  54. package/browser/cjs/DCVnwgmc5HuYp_iv2.cjs +1 -0
  55. package/browser/cjs/{EeOVMRq7TuptFKTc2.cjs → DF4l8xrxkcLkgExp.cjs} +1 -1
  56. package/browser/cjs/DNnMGL1ff8hutxSd.cjs +1 -0
  57. package/browser/cjs/{D19RglhKiroWfpQn2.cjs → DOEhH2HGT1Zv0irr2.cjs} +1 -1
  58. package/browser/cjs/DQOt8XSpXyhsrF9N.cjs +93 -0
  59. package/browser/cjs/{CnZfa45XxA-9Jhmp.cjs → DRmo6uoGoqtiVff82.cjs} +1 -1
  60. package/browser/cjs/DSXLVieENYN9qXYl.cjs +1 -0
  61. package/browser/cjs/{BEJFcqVMDMKOvs11.cjs → DUXRl3eYfSwbhAfx.cjs} +1 -1
  62. package/browser/cjs/{B9EI7wviSkHS9ZkH.cjs → DWdUSWl4MXn2-MLU.cjs} +1 -1
  63. package/browser/cjs/DWyoF5GqKXce_GmT2.cjs +3 -0
  64. package/browser/cjs/Df3jw0eHS0X-qFvT.cjs +1 -0
  65. package/browser/cjs/{DiZDRPIgbO3sQ8Vb.cjs → Doiqeo4Qlie45lbl.cjs} +1 -1
  66. package/browser/cjs/Dp2fPEReFhDsI01j.cjs +3 -0
  67. package/browser/cjs/DpFg69dDCPoOK2BY2.cjs +1 -0
  68. package/browser/cjs/{Du4jBiFxRIF1OjD4.cjs → Dtxj9JR14A-uliu52.cjs} +1 -1
  69. package/browser/cjs/{CpJJh4UnFl1_qFui.cjs → Dx7GQ4ALtNG3kshu.cjs} +1 -1
  70. package/browser/cjs/{DG-AY_xO8RKHtEBE.cjs → Dy50BSaRMmRISD2Y.cjs} +1 -2
  71. package/browser/cjs/LD1P-jAXleebK12X.cjs +7 -0
  72. package/browser/cjs/P0AUOlaMi9tyE0vN.cjs +3747 -0
  73. package/browser/cjs/PmwvZPFhqmL4DO58.cjs +1 -0
  74. package/browser/cjs/Qp04O3ALK3M9d3At.cjs +54 -0
  75. package/browser/cjs/SATfdSwNygvlOSKC2.cjs +1 -0
  76. package/browser/cjs/XRCcogT-Iqd3Wv6R2.cjs +1 -0
  77. package/browser/cjs/{BziOCn_XEGT4ynN5.cjs → Z_6RasaVpnIv1MHk.cjs} +1 -1
  78. package/browser/cjs/Zz5dLT_2gLI18Jmx.cjs +7 -0
  79. package/browser/cjs/a4xpA8d_d22-GKos.cjs +1 -0
  80. package/browser/cjs/cexWxRluo6g-NG_u.cjs +1 -0
  81. package/browser/cjs/{C5rQELB0TUeXY6VM.cjs → ge8Wd-0WC6oMuJZR.cjs} +1 -1
  82. package/browser/cjs/iYn00uzmSLl2T0oN2.cjs +1 -0
  83. package/browser/cjs/index.cjs +2 -2
  84. package/browser/cjs/kj_kwD7S9uUbhKiz2.cjs +1 -0
  85. package/browser/cjs/qA_ElZ6f49Un56OC.cjs +1 -0
  86. package/browser/cjs/s2c8Pr4obSACz8Lu2.cjs +1 -0
  87. package/browser/cjs/{hzUo76TXMOBqsI3U2.cjs → uAWsHfi-JD_ZQIT82.cjs} +1 -1
  88. package/browser/cjs/uRXkwHKoe-2HtXuR.cjs +1 -0
  89. package/browser/cjs/{DxQkFYAFNZubVdn22.cjs → y4KFnuCKf8r5oFal2.cjs} +1 -1
  90. package/browser/esm/{CZWIS7FuqNjbheSw.mjs → 2eBMkUK0-HxaCmDY.mjs} +40 -40
  91. package/browser/esm/{DzDwSOBdJh_lx_NM.mjs → 53nnk5W22gJW7Ddx.mjs} +241 -241
  92. package/{cdn/assets/BCZjYGV8AqIZghBH.js → browser/esm/5SHS088DeaZ82qmD2.mjs} +69 -4
  93. package/browser/esm/{B4vYIE3kSPTxCgpf2.mjs → 5shGy9JSRzvoIfDE2.mjs} +6 -6
  94. package/browser/esm/{-vgNEEXiEad4bltZ.mjs → 74Ynqpv5NPbb_8vB.mjs} +15762 -16413
  95. package/browser/esm/B-VKr_KwiWjDeAP5.mjs +3343 -0
  96. package/{cdn/assets/BDkVAo0CDCTE04ZJ.js → browser/esm/B08GCyGdLNiXtb_R.mjs} +1 -1
  97. package/browser/esm/{3y_bCend8tkaewDG2.mjs → B0F5gtNQjANAfRw32.mjs} +19 -27
  98. package/browser/esm/B0gZ5e38MXWbEDS_.mjs +25 -0
  99. package/browser/esm/{D3G3tI3DVCUF3Gdk.mjs → B45vVm2Ma1i2b6_F.mjs} +1 -1
  100. package/browser/esm/B5z-uoALcLY2ABTo.mjs +27 -0
  101. package/{cdn/assets/Bv_96nwOEMHN9Sa0.js → browser/esm/B72sK2NRGAke-aCk2.mjs} +27 -29
  102. package/{cdn/assets/DQ4o4dG7gWbL1X8F.js → browser/esm/B8q1hrKv7LAL4xmM2.mjs} +2 -2
  103. package/{cdn/assets/DIQf1pX-j-dWQu_e.js → browser/esm/BCQJVniXgm81YQ0v2.mjs} +141 -140
  104. package/browser/esm/{CR3jgkduTLczbMjH2.mjs → BCcbek_TFOdgqxXq.mjs} +1 -1
  105. package/browser/esm/{1guzFZp1LHz_FwfL.mjs → BEb3QhWwGW8rErZy.mjs} +1 -1
  106. package/browser/esm/{CU1d8OvDv5TU6fSd.mjs → BGRNyE5ar4c3ggrS.mjs} +465 -366
  107. package/browser/esm/{fJ1McMt7xzRA_lUX.mjs → BHIVjD6BdBS3BAWp.mjs} +15 -15
  108. package/browser/esm/BH_qL-oGqwG-7JKF.mjs +87746 -0
  109. package/browser/esm/BJ26E2DhS1Jz4nUY2.mjs +514 -0
  110. package/browser/esm/BJVcTpMN-u5XhMVE2.mjs +47 -0
  111. package/browser/esm/BNgf4HZDOKYBkvL3.mjs +15495 -0
  112. package/browser/esm/BOMJTicRKnx01hw-.mjs +155 -0
  113. package/browser/esm/{8V-VceXEjpADM8qK2.mjs → BPZxx-OH0wACHLsN2.mjs} +1 -1
  114. package/browser/esm/BQIRHi8T3P5MZtan.mjs +15 -0
  115. package/browser/esm/{Dc0BDcQUGy_WIVFa.mjs → BQhVWbI9uag9iRfX2.mjs} +1 -1
  116. package/{cdn/assets/D_t53-8k73CNpV-p2.js → browser/esm/BSWXx2rKOMPxLLs8.mjs} +88 -72
  117. package/browser/esm/{CJPemkFUzhcAD_qR.mjs → BUjTEjAeByh6MKpn.mjs} +1 -1
  118. package/{cdn/assets/B5ZqqASTcBEV5L9K.js → browser/esm/BUokT-PbfvYzD63f2.mjs} +1 -1
  119. package/browser/esm/BYAZ3XZq8XXkOulw.mjs +758 -0
  120. package/browser/esm/BYPIn5AkddMzMcsa2.mjs +117 -0
  121. package/browser/esm/{CH0of3GZTzHviuQV.mjs → BcPnGFFKCddWgOch.mjs} +1 -1
  122. package/browser/esm/{BCkXtOM3yKocv7L-2.mjs → BgwzL8v2pmR5HJXW.mjs} +1 -1
  123. package/browser/esm/BiomOxscV1M0Uw2n.mjs +37 -0
  124. package/browser/esm/{DTaVECXVrgvC48BE.mjs → Bj42pxe5AuY4bF2e.mjs} +3 -3
  125. package/browser/esm/{DBL3Qp5jyPrFg7KI2.mjs → BmC-_QeQ-53oyorq2.mjs} +1 -1
  126. package/browser/esm/{DW72HwfnJtQxzoGa.mjs → BnHE1Z6WkOfTWheU2.mjs} +2 -2
  127. package/{cdn/assets/BHBJtVTiQByD_y9j2.js → browser/esm/BoWCDK44X4tp02_4.mjs} +2 -2
  128. package/browser/esm/{DVZ_UnchuMRveDG32.mjs → Bq7qy-C7tVkiIaDE2.mjs} +42 -4
  129. package/browser/esm/{Cc5IufffX4N-8QpE.mjs → BrzXFBoYDjcG3ct8.mjs} +3 -3
  130. package/browser/esm/{BOl4FzJRD7MplCU72.mjs → BsY_DyFxoqjRHTv02.mjs} +1 -1
  131. package/{cdn/assets/COA_SZY2x8q6t4BD.js → browser/esm/Bsfof8nD-exhrNwn.mjs} +7 -6
  132. package/browser/esm/BtC6lEbd98TeKGsX2.mjs +298 -0
  133. package/browser/esm/BuoHLVUSwf-mq0hg2.mjs +32 -0
  134. package/browser/esm/{R5bs6kCQSZmsCXz-.mjs → BwbR2Dao5LgLYQgV.mjs} +1 -1
  135. package/browser/esm/ByQakLd0YFwc0Lgl.mjs +91 -0
  136. package/browser/esm/{DuPdSe-EXFTx9dsc2.mjs → C-97pwItkHA3s5rD2.mjs} +16 -16
  137. package/browser/esm/{DMLwXmjo28k_iNEU.mjs → C02og4vKxq9qpIUA.mjs} +1866 -1401
  138. package/{cdn/assets/BykiUmcpDgSRNQI1.js → browser/esm/C0HHZ3XLqp0LgRuW.mjs} +1 -1
  139. package/browser/esm/C213T1hhBphljJTF2.mjs +19 -0
  140. package/browser/esm/{Dnx3_xXfRlD6ECfZ2.mjs → C3A-yJ12PN-CPPnI2.mjs} +5 -5
  141. package/browser/esm/{DQ-0yyFAwoWtxmhV2.mjs → C5Oex2msskTvaCQ92.mjs} +1 -1
  142. package/{cdn/assets/8f9hCbpXTTYEgG31.js → browser/esm/C5u9ds7LUh9JJEbW2.mjs} +2 -2
  143. package/browser/esm/{BVRzmIk5PujkT_Ap.mjs → C6D3gk0GBvvDjawh.mjs} +563 -534
  144. package/browser/esm/{BHmYoIIbNW3GdcqV2.mjs → C7b3GyO7FCiMLeyn.mjs} +1 -1
  145. package/browser/esm/{BqTFwWLbXXJ0Fu-X2.mjs → C8qOmdaHh4WQkzEy.mjs} +2 -2
  146. package/browser/esm/CD44l4eg_lxr7kgn2.mjs +115 -0
  147. package/{cdn/assets/iXWgTu3qpYZHcx1J.js → browser/esm/CDxmuF7Iay8T4cnU.mjs} +963 -946
  148. package/browser/esm/CS38A8yr4eKvdDZm.mjs +159 -0
  149. package/browser/esm/CSu0Md4a1JIZrirV.mjs +3324 -0
  150. package/{cdn/assets/BMRav2VAqEzDSp3r.js → browser/esm/CU1J-I76aVm-KPP6.mjs} +37 -3
  151. package/{cdn/assets/D9-wpGVbTS9rRpxx.js → browser/esm/CVbPAnmNN3TxMkq4.mjs} +1 -1
  152. package/browser/esm/{qG5zdZZAe6mQIJo32.mjs → CXvcyGN4L9iDr1LK2.mjs} +5 -5
  153. package/{cdn/assets/CopfZ7Y1Zn_PDNXK.js → browser/esm/CZN6c8yBDjLVTVpH.mjs} +16 -11
  154. package/{cdn/assets/DOsbSsKsexrBoeXa2.js → browser/esm/C__tNzwz0i7bQrSu2.mjs} +17 -18
  155. package/browser/esm/CcPFyWALYlJWf17T2.mjs +58 -0
  156. package/browser/esm/{47Yv4X226-93If7L.mjs → CcuNkPxT6rqElgbZ2.mjs} +1 -1
  157. package/{cdn/assets/C1ZePT2B182vSnxW.js → browser/esm/Cjbksosgv7NZFNE0.mjs} +1 -1
  158. package/browser/esm/{BD7RxHQgrqy_4tb5.mjs → CjxOVBbWLFeUZza82.mjs} +2 -2
  159. package/browser/esm/CksEMRqAqI-_nekb.mjs +149 -0
  160. package/{cdn/assets/DZDynaLqNeVaDoiH2.js → browser/esm/CnB5AuoIz-49NXD_.mjs} +3 -3
  161. package/{cdn/assets/DRc_Wi5c7WdKHTVN.js → browser/esm/Co06Uf-tv1IuVQhe.mjs} +6 -6
  162. package/browser/esm/{D6SKy2BtcWkhfiA02.mjs → CpzLNwtfx0Zd0OZ0.mjs} +2 -5
  163. package/{cdn/assets/Cbw0JeJURvQyxIoa.js → browser/esm/CwRAK6IVjIYuwofE.mjs} +1 -1
  164. package/{cdn/assets/CtXoSHbCUKMY-tSJ2.js → browser/esm/CyS1VLOdAweeZsMV.mjs} +48 -2
  165. package/browser/esm/CyomJv3_vWy4trRe2.mjs +33 -0
  166. package/browser/esm/{Be4QC65cR8N84rTn.mjs → D-1WiFWkKNPWXppx2.mjs} +1 -1
  167. package/browser/esm/D16eCDM3k1_Fk-MN.mjs +225 -0
  168. package/browser/esm/{DZbR5R1fNikjgqYb.mjs → D3Qv3--VfvVHImXW.mjs} +1 -1
  169. package/{cdn/assets/BJEpPEyFWtLzMIq-2.js → browser/esm/D5j8qMZCamJQ82pi.mjs} +1809 -1038
  170. package/{cdn/assets/CdMv3f8Gyxh8q2RR.js → browser/esm/D718rIGL3d_m1mjm2.mjs} +1 -1
  171. package/browser/esm/{BPv6Pw1hW-sV5Fya.mjs → DAhlDEV6ehTRvrj72.mjs} +1 -1
  172. package/browser/esm/{CEN8dYSpN2oew8HH.mjs → DB_I2ygTnDxYiYyc.mjs} +526 -350
  173. package/browser/esm/{D4VqLbEWag8lTWzC2.mjs → DGde1GUi2j-ZUPJW2.mjs} +121 -94
  174. package/browser/esm/DJUnZsVsvwRT_Onq2.mjs +8 -0
  175. package/browser/esm/{DXWmgQSeh0_HDxZj.mjs → DLgM7RXEEfx33zms.mjs} +4 -4
  176. package/browser/esm/DNxL1aQIN6J2PLV7.mjs +35 -0
  177. package/browser/esm/{BjTf3XA9Swj0ngpH.mjs → DRRx9F2h6V-Q957j.mjs} +2 -2
  178. package/{cdn/assets/hFSDx-LnUOObv-6h.js → browser/esm/DZGMsbIACs9TKYrM2.mjs} +2 -2
  179. package/browser/esm/{DFdU1DsC1lXOrejZ.mjs → Dcpd3kkjvidrDQuN.mjs} +1814 -1737
  180. package/browser/esm/{7rixDGGrR72lXkMV.mjs → DevyWm6bXV7lW2dr.mjs} +97 -54
  181. package/browser/esm/{Gy0CHZTvn4hY-rkx2.mjs → DfIwClWz03Qw38-O.mjs} +1 -1
  182. package/{cdn/assets/CAPgMrAKg07EREFD2.js → browser/esm/Dg7wE0RZdHeJv537.mjs} +1 -1
  183. package/browser/esm/Dj_S0P34nk_fjFoh2.mjs +427 -0
  184. package/browser/esm/DjyzSKZNfvxPmFqi.mjs +3342 -0
  185. package/browser/esm/{9_bymSfTn_rR_v6W.mjs → DlHJ7zkV6AMCtYPP.mjs} +6 -6
  186. package/browser/esm/{B1NoGosH2YQh01g7.mjs → DnLi57ylUOd3DUek.mjs} +6 -6
  187. package/{cdn/assets/BVjXdv_wkL1x_8ZJ2.js → browser/esm/DoAKAH3cmECZGboo2.mjs} +1 -1
  188. package/browser/esm/Dok4MRpMgkcsNzp4.mjs +589 -0
  189. package/browser/esm/{Blc1T4zLkp8bRC_n2.mjs → DpORFFFF3LUx_zsT2.mjs} +22 -22
  190. package/{cdn/assets/DvlpP6sUZ9Qzl9s22.js → browser/esm/Ds5mE3-q83ZhE-2T.mjs} +193 -172
  191. package/browser/esm/Du5dlbWtpboIrJk-2.mjs +394 -0
  192. package/{cdn/assets/Chq4BwbjH0sbIkJN2.js → browser/esm/DuMveAGZv1j1YAwO.mjs} +28 -13
  193. package/browser/esm/{C6CK_4GD9IpxKglV2.mjs → GETgdmj9xZWcFrIC2.mjs} +2391 -2900
  194. package/browser/esm/GJUYPKfNptRZyU9r.mjs +267 -0
  195. package/browser/esm/{vcRSnmAqjwKglEkY.mjs → JDCQtP0lkncrmnpC2.mjs} +2 -2
  196. package/browser/esm/{BceIETi6JJRW6Ss62.mjs → OsRyVy3M_rNtmU472.mjs} +13 -13
  197. package/{cdn/assets/DrUEYcXg6N2D2s1Z.js → browser/esm/OtaDVRqZVyi7IBBa.mjs} +51 -11
  198. package/browser/esm/OyyHiDjohIf4lZX62.mjs +119 -0
  199. package/browser/esm/QEPUcBp4VkPz75h8.mjs +637 -0
  200. package/{cdn/assets/CpnA5TZRkPDt4HnM2.js → browser/esm/R0Xd51SJLUebJwYv.mjs} +2 -2
  201. package/browser/esm/{DMX-ZlC_ljcf7oUN.mjs → S4MMwlNd4kcK3RDU.mjs} +1 -1
  202. package/browser/esm/{CsufM5aF6VTLKDWM.mjs → VaST17rbOSkMsGyn.mjs} +12 -12
  203. package/browser/esm/{DtXC6uPF2LLktqFE.mjs → WfqSQXib2MuH663g.mjs} +2 -2
  204. package/browser/esm/{CG5v2hAwGR5Ptufn.mjs → XuGWliVSRCNi5it12.mjs} +1 -1
  205. package/browser/esm/Z83G4i9Tvq4z2kCB.mjs +87 -0
  206. package/browser/esm/_cZz4ZhEEr54LYNe2.mjs +32 -0
  207. package/browser/esm/{NekeSGoazNCraGNC2.mjs → cDMkMgN5tB-wni7c2.mjs} +15 -15
  208. package/{cdn/assets/Clfp7SznkOrJoQvL.js → browser/esm/efVOgresgMXMdh7J2.mjs} +3 -3
  209. package/{cdn/assets/CGqvy5LwQ4z9J2oD.js → browser/esm/gXemYPUoPvaUd055.mjs} +1 -1
  210. package/browser/esm/index.mjs +6 -6
  211. package/browser/esm/kef_IwcJES4VXcNa2.mjs +238 -0
  212. package/browser/esm/{oYdWyqsKo9ejAdVm.mjs → lfNgkSweNYs6v7g2.mjs} +2 -2
  213. package/browser/esm/{BLcn1kGRsjURZSzk.mjs → lfNgkSweNYs6v7g22.mjs} +2 -2
  214. package/{cdn/assets/EwzqnZl1lTr56hH-.js → browser/esm/mbUWaIl3SJkdbWx02.mjs} +1 -1
  215. package/browser/esm/vDg2R-517z6mPR3B2.mjs +280 -0
  216. package/browser/esm/{CfvrjQGuf7vXiQCB.mjs → vP8Rb-lgzeerBAx4.mjs} +1 -1
  217. package/cdn/assets/0uSu6ChH_CTmXM2q2.js +226 -0
  218. package/{browser/esm/BCZjYGV8AqIZghBH.mjs → cdn/assets/5SHS088DeaZ82qmD.js} +69 -4
  219. package/cdn/assets/8rILuc7bVIGEeb97.js +394 -0
  220. package/cdn/assets/9ra2y9Srlg_Pw7Q32.js +590 -0
  221. package/cdn/assets/B-ylRvlizyArIFrd.js +15496 -0
  222. package/{browser/esm/BDkVAo0CDCTE04ZJ2.mjs → cdn/assets/B08GCyGdLNiXtb_R2.js} +1 -1
  223. package/cdn/assets/B0gZ5e38MXWbEDS_.js +25 -0
  224. package/cdn/assets/{C8mUyjJ26jsHGl_D.js → B15uSTYXbbRVKP0X2.js} +7 -7
  225. package/cdn/assets/{BixsQGDDf3Iv_PtW2.js → B1Lxf24mP-fwn03r2.js} +1866 -1401
  226. package/cdn/assets/{D3G3tI3DVCUF3Gdk2.js → B45vVm2Ma1i2b6_F.js} +1 -1
  227. package/cdn/assets/B63SfOuKJt36aTr_.js +8 -0
  228. package/cdn/assets/B69EK_yDF3V8Rq2r2.js +299 -0
  229. package/{browser/esm/Bv_96nwOEMHN9Sa02.mjs → cdn/assets/B72sK2NRGAke-aCk.js} +27 -29
  230. package/cdn/assets/{DW7JlG-SQEdLYNar2.js → B7SJVFUHxy16UJRA.js} +41 -3
  231. package/{browser/esm/DQ4o4dG7gWbL1X8F2.mjs → cdn/assets/B8q1hrKv7LAL4xmM.js} +2 -2
  232. package/cdn/assets/{DVS_5oDniuAFH3vT2.js → BAbRLjxqebqVPyto2.js} +2451 -2960
  233. package/cdn/assets/BCOGONuWSq4hgADu.js +4426 -0
  234. package/cdn/assets/{CR3jgkduTLczbMjH.js → BCcbek_TFOdgqxXq2.js} +1 -1
  235. package/cdn/assets/{1guzFZp1LHz_FwfL2.js → BEb3QhWwGW8rErZy2.js} +1 -1
  236. package/cdn/assets/BHpE1nCbJEbRdzIG2.js +118 -0
  237. package/cdn/assets/BJVcTpMN-u5XhMVE.js +47 -0
  238. package/cdn/assets/{B55nrhIK6gAAu4ZA.js → BLpNuslYLGia3h9t2.js} +2 -2
  239. package/cdn/assets/{8V-VceXEjpADM8qK.js → BPZxx-OH0wACHLsN.js} +1 -1
  240. package/cdn/assets/BQIRHi8T3P5MZtan2.js +15 -0
  241. package/cdn/assets/{Dc0BDcQUGy_WIVFa.js → BQhVWbI9uag9iRfX.js} +1 -1
  242. package/{browser/esm/D_t53-8k73CNpV-p.mjs → cdn/assets/BSWXx2rKOMPxLLs82.js} +88 -72
  243. package/cdn/assets/{CBuvbUg67ah_3BOZ.js → BUeKY15yUtNX2nYg.js} +2 -2
  244. package/cdn/assets/{CJPemkFUzhcAD_qR.js → BUjTEjAeByh6MKpn.js} +1 -1
  245. package/{browser/esm/B5ZqqASTcBEV5L9K2.mjs → cdn/assets/BUokT-PbfvYzD63f.js} +1 -1
  246. package/cdn/assets/BWbSIhQVBaXJNFgl.js +3324 -0
  247. package/cdn/assets/{tVOVNvOs6ro8FXqa2.js → BZDRat2zTkUEg9cR.js} +16 -16
  248. package/cdn/assets/{c6VvwMHfXubjjtyj.js → BeFqINcF0gIgBnB1.js} +16 -16
  249. package/cdn/assets/{DJwQ9abZkyFO9Doy.js → Beyy1fJJeov2iYL4.js} +4 -4
  250. package/cdn/assets/{BCkXtOM3yKocv7L-.js → BgwzL8v2pmR5HJXW2.js} +1 -1
  251. package/cdn/assets/BiomOxscV1M0Uw2n.js +37 -0
  252. package/cdn/assets/{DBL3Qp5jyPrFg7KI.js → BmC-_QeQ-53oyorq.js} +1 -1
  253. package/{browser/esm/BHBJtVTiQByD_y9j.mjs → cdn/assets/BoWCDK44X4tp02_42.js} +2 -2
  254. package/cdn/assets/{BOl4FzJRD7MplCU7.js → BsY_DyFxoqjRHTv0.js} +1 -1
  255. package/{browser/esm/COA_SZY2x8q6t4BD.mjs → cdn/assets/Bsfof8nD-exhrNwn.js} +7 -6
  256. package/cdn/assets/{BzUU8y1IFjREzgog2.js → BsiuCRJjX2LRrDF22.js} +20 -28
  257. package/cdn/assets/BuPGWNRZMMyn4fm8.js +268 -0
  258. package/cdn/assets/Bub12rk6wWVZVNx62.js +496 -0
  259. package/cdn/assets/BuoHLVUSwf-mq0hg.js +32 -0
  260. package/cdn/assets/{DbEGszSW_J_k96KJ.js → ButSau4Lf36Oe3GD.js} +2 -2
  261. package/cdn/assets/{R5bs6kCQSZmsCXz-2.js → BwbR2Dao5LgLYQgV2.js} +1 -1
  262. package/{browser/esm/B0HA_dHcr0kKfudQ.mjs → cdn/assets/C-F-eIvIRbCAMD662.js} +194 -171
  263. package/cdn/assets/{BhDLR-jtbOOG-tl12.js → C-KWjRT0CUb-bkvj2.js} +8 -8
  264. package/{browser/esm/BykiUmcpDgSRNQI12.mjs → cdn/assets/C0HHZ3XLqp0LgRuW2.js} +1 -1
  265. package/cdn/assets/C213T1hhBphljJTF.js +19 -0
  266. package/cdn/assets/{Dnx3_xXfRlD6ECfZ.js → C3A-yJ12PN-CPPnI.js} +5 -5
  267. package/cdn/assets/C4vZWmW5DZLQTTAx.js +758 -0
  268. package/cdn/assets/{DQ-0yyFAwoWtxmhV2.js → C5Oex2msskTvaCQ9.js} +1 -1
  269. package/{browser/esm/8f9hCbpXTTYEgG312.mjs → cdn/assets/C5u9ds7LUh9JJEbW.js} +2 -2
  270. package/cdn/assets/{BHmYoIIbNW3GdcqV.js → C7b3GyO7FCiMLeyn2.js} +1 -1
  271. package/cdn/assets/C8W7e-O1V1Mo2HOp.js +35 -0
  272. package/cdn/assets/{BqTFwWLbXXJ0Fu-X.js → C8qOmdaHh4WQkzEy.js} +2 -2
  273. package/cdn/assets/{Ce5A_D4YBgi_s2KF.js → CEyEKBYpjE5GGcmE.js} +13 -13
  274. package/{browser/esm/Dg5wjQp0fArKXlM3.mjs → cdn/assets/CJoCbCtXkTbj6-nC.js} +16 -11
  275. package/cdn/assets/{j8nXVEYbO2kPuEYQ.js → CLEhV4ZVh2Jf4WLI.js} +3 -3
  276. package/{browser/esm/BMRav2VAqEzDSp3r2.mjs → cdn/assets/CU1J-I76aVm-KPP6.js} +37 -3
  277. package/{browser/esm/D9-wpGVbTS9rRpxx.mjs → cdn/assets/CVbPAnmNN3TxMkq4.js} +1 -1
  278. package/cdn/assets/{2CuCH0wi9XPgVzE42.js → CWIp4JC2SCM6lg-s.js} +11 -9
  279. package/cdn/assets/{BKEzd89UphJ8q1pp2.js → CXKguOBpJrsoXPTQ.js} +485 -386
  280. package/cdn/assets/CXgMJ_MuMQRu0isj2.js +159 -0
  281. package/cdn/assets/{qG5zdZZAe6mQIJo3.js → CXvcyGN4L9iDr1LK.js} +5 -5
  282. package/cdn/assets/{DnzDlqizzNkbhJP7.js → CYFmWcVbnUCDPJ8m.js} +2 -2
  283. package/cdn/assets/{CF8m5SqeMaRkGIYM.js → C_W3L9-im26Qc-Ub.js} +2 -2
  284. package/cdn/assets/Cb7x4GW2rRvj_q2Z.js +87 -0
  285. package/cdn/assets/CcOMQhQN8PPKQulw2.js +428 -0
  286. package/cdn/assets/CcPFyWALYlJWf17T.js +58 -0
  287. package/{browser/esm/Bl6bX86tSq8hfyb2.mjs → cdn/assets/CcXDdl0SsmyEFtmU.js} +965 -944
  288. package/cdn/assets/{47Yv4X226-93If7L2.js → CcuNkPxT6rqElgbZ.js} +1 -1
  289. package/cdn/assets/CdDTtABobc5txUF6.js +149 -0
  290. package/cdn/assets/CdTHBpWoW1Fu4Dg_.js +27 -0
  291. package/cdn/assets/{CT3G9YRPVfKtHWwf2.js → Cdm7E0sw56lpdqRU2.js} +17 -17
  292. package/cdn/assets/{mtrwY1hjJeYlmzC-.js → Cf-bndowUtxZ6tmG.js} +3 -3
  293. package/cdn/assets/{DaBczM5xU9ev5_or.js → CiTCEuoCSDCy9khR.js} +2 -2
  294. package/{browser/esm/C1ZePT2B182vSnxW2.mjs → cdn/assets/Cjbksosgv7NZFNE02.js} +1 -1
  295. package/cdn/assets/{DvItgGbf8IOWPyxd.js → CmRLwDXiK3woZrVI.js} +15461 -16112
  296. package/{browser/esm/DRc_Wi5c7WdKHTVN2.mjs → cdn/assets/Co06Uf-tv1IuVQhe.js} +6 -6
  297. package/cdn/assets/Cpkl0peJbfEXl6ta2.js +239 -0
  298. package/cdn/assets/{D6SKy2BtcWkhfiA0.js → CpzLNwtfx0Zd0OZ02.js} +2 -5
  299. package/cdn/assets/{CpYlf4dXa_V2v-iS2.js → CukMw9Sc4iO21aRQ2.js} +1109 -955
  300. package/cdn/assets/{EjOJX5m8OEL-IjPB.js → CwGEi_5ErUTrkWRj.js} +7 -7
  301. package/{browser/esm/Cbw0JeJURvQyxIoa.mjs → cdn/assets/CwRAK6IVjIYuwofE2.js} +1 -1
  302. package/cdn/assets/{-2S675KWulPRlVNb2.js → Cx1HsOCOdZoKJDEN2.js} +14 -14
  303. package/{browser/esm/BqwvP0318zI2izeL2.mjs → cdn/assets/Cy6Cst4s2vE_WWKK2.js} +27 -26
  304. package/{browser/esm/CtXoSHbCUKMY-tSJ.mjs → cdn/assets/CyS1VLOdAweeZsMV2.js} +48 -2
  305. package/cdn/assets/CyomJv3_vWy4trRe.js +33 -0
  306. package/cdn/assets/{Be4QC65cR8N84rTn2.js → D-1WiFWkKNPWXppx.js} +1 -1
  307. package/cdn/assets/{DZbR5R1fNikjgqYb.js → D3Qv3--VfvVHImXW.js} +1 -1
  308. package/cdn/assets/D6B6VvRh1cfT2e-M2.js +116 -0
  309. package/{browser/esm/CdMv3f8Gyxh8q2RR2.mjs → cdn/assets/D718rIGL3d_m1mjm.js} +1 -1
  310. package/cdn/assets/D7WMzCfJnKIfTbdg.js +280 -0
  311. package/cdn/assets/{C_Io1QC4CeLGRBrz.js → D8sc6gCXnfpn7W79.js} +2 -2
  312. package/cdn/assets/DA4QV7VUyNUEfx1k2.js +156 -0
  313. package/cdn/assets/{BPv6Pw1hW-sV5Fya.js → DAhlDEV6ehTRvrj7.js} +1 -1
  314. package/cdn/assets/{gspQcUnmlRIwG609.js → DBKHpCvbeQU-Y4eS2.js} +5 -5
  315. package/cdn/assets/{CEN8dYSpN2oew8HH2.js → DB_I2ygTnDxYiYyc2.js} +526 -350
  316. package/cdn/assets/{DLEdaT0MmrOxMa2h2.js → DKwpjlUd2pFOI9yp2.js} +64 -64
  317. package/cdn/assets/{BNybEGR813e3aNIv.js → DW3_Jr-4VdZZqNEg.js} +1817 -1740
  318. package/{browser/esm/hFSDx-LnUOObv-6h2.mjs → cdn/assets/DZGMsbIACs9TKYrM.js} +2 -2
  319. package/cdn/assets/{Gy0CHZTvn4hY-rkx.js → DfIwClWz03Qw38-O2.js} +1 -1
  320. package/{browser/esm/CAPgMrAKg07EREFD.mjs → cdn/assets/Dg7wE0RZdHeJv5372.js} +1 -1
  321. package/{browser/esm/BVjXdv_wkL1x_8ZJ2.mjs → cdn/assets/DoAKAH3cmECZGboo2.js} +1 -1
  322. package/cdn/assets/FAaqx6EbN4JxNuNL2.js +87746 -0
  323. package/{browser/esm/CPUlpDM6aAzZzCat2.mjs → cdn/assets/FHIg3Yb5Rn05W1F22.js} +142 -139
  324. package/{browser/esm/CQM87ZBN7Yzn4Yxr.mjs → cdn/assets/FbLFNYdTqRtQ7QiS.js} +9 -9
  325. package/cdn/assets/{vcRSnmAqjwKglEkY2.js → JDCQtP0lkncrmnpC.js} +2 -2
  326. package/cdn/assets/{D-fJXasEYyfRUcj2.js → KOiR-1SNAX7AiEes.js} +3 -3
  327. package/cdn/assets/KS5XJUWdKvEezJfs2.js +264 -0
  328. package/{browser/esm/B4iT_CduJeJunwBc.mjs → cdn/assets/OTQWLENoZ1cSiDQb2.js} +28 -13
  329. package/{browser/esm/DrUEYcXg6N2D2s1Z2.mjs → cdn/assets/OtaDVRqZVyi7IBBa2.js} +51 -11
  330. package/cdn/assets/OyyHiDjohIf4lZX6.js +119 -0
  331. package/cdn/assets/{DKeLjEJPO9nT3bpr.js → PLFw1pLjdLQLrlB0.js} +242 -242
  332. package/cdn/assets/S4MMwlNd4kcK3RDU.js +24 -0
  333. package/cdn/assets/S4MMwlNd4kcK3RDU2.js +24 -0
  334. package/cdn/assets/{CG5v2hAwGR5Ptufn2.js → XuGWliVSRCNi5it1.js} +1 -1
  335. package/cdn/assets/_cZz4ZhEEr54LYNe.js +32 -0
  336. package/cdn/assets/{DCnA2-zB7W_QB-tD2.js → bQ6G23JQrt4l2Ls92.js} +566 -537
  337. package/{browser/esm/Clfp7SznkOrJoQvL.mjs → cdn/assets/efVOgresgMXMdh7J.js} +3 -3
  338. package/{browser/esm/CGqvy5LwQ4z9J2oD2.mjs → cdn/assets/gXemYPUoPvaUd055.js} +1 -1
  339. package/cdn/assets/{UYgwKnPX3US3Cj2k2.js → hHkEq7qn0rj2XKD82.js} +75 -48
  340. package/cdn/assets/{D1MA2ed2cLMt7hV9.js → hqW1sMr576y2S1qX.js} +41 -41
  341. package/cdn/assets/mI8tvfP8ed2Zerre.js +3344 -0
  342. package/{browser/esm/EwzqnZl1lTr56hH-2.mjs → cdn/assets/mbUWaIl3SJkdbWx0.js} +1 -1
  343. package/{browser/esm/RW23HF8taEtW8q9D.mjs → cdn/assets/n_NkstgVVwl2iAnp.js} +2 -2
  344. package/cdn/assets/ryzcqI-93l1HBuTe2.js +91 -0
  345. package/cdn/assets/{CfvrjQGuf7vXiQCB2.js → vP8Rb-lgzeerBAx42.js} +1 -1
  346. package/cdn/assets/{CHttngK66Ido5dWW.js → w65zHFqjAp_NlbXg2.js} +7 -7
  347. package/cdn/index.js +2 -2
  348. package/package.json +3 -3
  349. package/browser/cjs/2zXD3NPfuQT2KSZq.cjs +0 -7
  350. package/browser/cjs/49_x589Na12sizKK.cjs +0 -1
  351. package/browser/cjs/B19QM3SGmPKKwD_o.cjs +0 -1
  352. package/browser/cjs/B4JJfKSI4ppwU8552.cjs +0 -1
  353. package/browser/cjs/B5YBx0GqLor3i0O1.cjs +0 -1
  354. package/browser/cjs/BC2gCQkR1iykfAuC.cjs +0 -1
  355. package/browser/cjs/BEVqcFGFU6Ri9y8T.cjs +0 -5
  356. package/browser/cjs/BEzaum_kgG4yAOx0.cjs +0 -1
  357. package/browser/cjs/BF-38Z7Z0FZOPl192.cjs +0 -1
  358. package/browser/cjs/BIQZDBQfv3Qm5iC8.cjs +0 -4
  359. package/browser/cjs/BSCgCfORdZz1Ii5S.cjs +0 -2
  360. package/browser/cjs/BZr-IqNS1skh1hr6.cjs +0 -21
  361. package/browser/cjs/BfzzZ9IR27ZPzj-8.cjs +0 -3
  362. package/browser/cjs/Bgke3PtMSF2Iaen4.cjs +0 -1
  363. package/browser/cjs/BnccBYHCCq9TGFx4.cjs +0 -8
  364. package/browser/cjs/BwLx9ix5Sq7suAYP2.cjs +0 -1
  365. package/browser/cjs/C-HOJozu5NgCil1q.cjs +0 -1
  366. package/browser/cjs/C2oTW2DjZypuqq7x.cjs +0 -1
  367. package/browser/cjs/C6yxQPAEgcGWAhYR.cjs +0 -33
  368. package/browser/cjs/C9C-pr-T_ThweQX92.cjs +0 -1
  369. package/browser/cjs/CPgCih_KEqnUZ9Rv.cjs +0 -3
  370. package/browser/cjs/CSNCOmYEOR-iTJ7K.cjs +0 -5
  371. package/browser/cjs/C_7w8EJZpHw8ueuq.cjs +0 -1
  372. package/browser/cjs/C_IEgjM-hSJCv6Gm.cjs +0 -1
  373. package/browser/cjs/CcneNtiqtKppCa-p.cjs +0 -57
  374. package/browser/cjs/CeF0DZ-k4DB8M47I.cjs +0 -1
  375. package/browser/cjs/Clu7XiAsCB48GDXN2.cjs +0 -1
  376. package/browser/cjs/CojEXZgX08waZOoq.cjs +0 -1
  377. package/browser/cjs/CrDTTLE9EvaGDSD4.cjs +0 -88
  378. package/browser/cjs/Cty5pi0fwToP1GWe.cjs +0 -7
  379. package/browser/cjs/CvV18ZJgssoHMkdf2.cjs +0 -2
  380. package/browser/cjs/Cy-4IMt-AbR-ifP3.cjs +0 -126
  381. package/browser/cjs/CyGzzWYDy-IniKCq2.cjs +0 -7
  382. package/browser/cjs/CzgwTfy2072Dmt5u.cjs +0 -1
  383. package/browser/cjs/DCIlWcGDrp-5PDoA.cjs +0 -1
  384. package/browser/cjs/DFHxNnJ-lHtv0hIq.cjs +0 -1
  385. package/browser/cjs/DH3WXPfGHwWJW0nH.cjs +0 -1
  386. package/browser/cjs/DNCC-QNp2I7saV-I.cjs +0 -1
  387. package/browser/cjs/DNy-UU3NKNqQQngF.cjs +0 -1
  388. package/browser/cjs/DPjEO7dwhCFd8DHR2.cjs +0 -2
  389. package/browser/cjs/DfMJOaJ0GcUiSn4Q.cjs +0 -1
  390. package/browser/cjs/DsFZgtSQpC75d1M02.cjs +0 -1
  391. package/browser/cjs/DvSvfeo9V0Abfd3q2.cjs +0 -1
  392. package/browser/cjs/E-IqDztfMb_xdszH.cjs +0 -1
  393. package/browser/cjs/ElcoSB--cCpS6i7R2.cjs +0 -1
  394. package/browser/cjs/KNCocKN9uPR0tvUS.cjs +0 -1
  395. package/browser/cjs/Kr8f1inOTt-MICaP2.cjs +0 -1
  396. package/browser/cjs/Kvn916ebqGc4t6hv2.cjs +0 -1
  397. package/browser/cjs/PM3PrEWG3WHKxaDx.cjs +0 -1
  398. package/browser/cjs/YG320hBA20Dl3HoU2.cjs +0 -1
  399. package/browser/cjs/bIaGoYEDSBCrAaB6.cjs +0 -1
  400. package/browser/cjs/fqTQ_p3ehzUvc1tF2.cjs +0 -1
  401. package/browser/cjs/h3dw1jAp2J5Pu4p32.cjs +0 -1
  402. package/browser/cjs/i2VboqjlOcozI9MQ.cjs +0 -12
  403. package/browser/cjs/jev6VGWTdgEgm4Yk2.cjs +0 -1
  404. package/browser/cjs/ppSJKdLn646BZOzg.cjs +0 -1
  405. package/browser/cjs/xBcvszV6x7ys-m532.cjs +0 -1
  406. package/browser/esm/At60x9FEPePwPP_J.mjs +0 -51151
  407. package/browser/esm/B4h6iO7hQ9lCR7kj.mjs +0 -11273
  408. package/browser/esm/BBtOlJMVlsWorNJH.mjs +0 -824
  409. package/browser/esm/BQDXkeSabbxB5DUB2.mjs +0 -47
  410. package/browser/esm/BUCKq_2lHPd1ndvw.mjs +0 -149
  411. package/browser/esm/BX4f6i2WMBMKFVCq.mjs +0 -99
  412. package/browser/esm/BZsx0QHg1RZlM9ZN.mjs +0 -15
  413. package/browser/esm/BhxX7CZWSOlV2Dsz.mjs +0 -224
  414. package/browser/esm/BhzLZRz2N8RxjQ_U.mjs +0 -34
  415. package/browser/esm/BkSb_vyWe-AhyEDa.mjs +0 -4423
  416. package/browser/esm/Bp9qFBIcpIGXvMgo.mjs +0 -134
  417. package/browser/esm/C0rS1uBqfsj-gPR8.mjs +0 -152
  418. package/browser/esm/CGGJWgWSPZ0aP_C3.mjs +0 -87
  419. package/browser/esm/CGyydD3tRb0ik50l2.mjs +0 -20
  420. package/browser/esm/CY1zykikO58_ADk8.mjs +0 -3188
  421. package/browser/esm/Cb-FUOYcyRSkHG6u2.mjs +0 -238
  422. package/browser/esm/Cd8HXAJlflkkTXxc.mjs +0 -53
  423. package/browser/esm/CfuhUkrvOq11d9FR.mjs +0 -44
  424. package/browser/esm/Ckl3FLCOeqw7yhkP2.mjs +0 -82
  425. package/browser/esm/CpjX81WsWJbXMUoT.mjs +0 -3655
  426. package/browser/esm/DDOO4tcrO4OfMUDe.mjs +0 -25
  427. package/browser/esm/DDUYQ8FPeh1TJU24.mjs +0 -538
  428. package/browser/esm/DVJd6McdAG5udItH.mjs +0 -27
  429. package/browser/esm/DVQNQmjI2PKkwiOw2.mjs +0 -514
  430. package/browser/esm/D_zNx76HGunFi7xJ.mjs +0 -509
  431. package/browser/esm/DfRGH6mEtIVDWEYN2.mjs +0 -304
  432. package/browser/esm/DnuaqN0xfgqzl8qG.mjs +0 -2687
  433. package/browser/esm/nguMxPB9LKexKBRX.mjs +0 -219
  434. package/browser/esm/qzhFT2j-mpQEQnKs.mjs +0 -16386
  435. package/cdn/assets/2UHIeioUPXrwtZy-2.js +0 -83
  436. package/cdn/assets/BAhvL7M7ZcgZ8eDc2.js +0 -48
  437. package/cdn/assets/BM7OqAUEUk-up7_82.js +0 -134
  438. package/cdn/assets/BNuoKAzs4zkxSocG2.js +0 -44
  439. package/cdn/assets/BU6uQhQhpaLElTT82.js +0 -225
  440. package/cdn/assets/BVgTMDEoPgsWFmku.js +0 -510
  441. package/cdn/assets/BWlMK76Aj2d4ygsH.js +0 -538
  442. package/cdn/assets/BZsx0QHg1RZlM9ZN2.js +0 -15
  443. package/cdn/assets/Bl6C6xWT8E6b7OwJ2.js +0 -239
  444. package/cdn/assets/CGyydD3tRb0ik50l.js +0 -20
  445. package/cdn/assets/CH0of3GZTzHviuQV.js +0 -24
  446. package/cdn/assets/CH0of3GZTzHviuQV2.js +0 -24
  447. package/cdn/assets/Crkvq5j5KIa6eTLI2.js +0 -51151
  448. package/cdn/assets/Cv-KXN9kl0UeMezQ.js +0 -824
  449. package/cdn/assets/CvtkpvGzCHhNuwTm.js +0 -16386
  450. package/cdn/assets/D9gETGi23d14kT7u2.js +0 -99
  451. package/cdn/assets/D9joTG0Z2zdWHAEa2.js +0 -4423
  452. package/cdn/assets/DC9obE_EVmxtvXCf.js +0 -11275
  453. package/cdn/assets/DDNivpFWzQ3AIJia.js +0 -2687
  454. package/cdn/assets/DDOO4tcrO4OfMUDe.js +0 -25
  455. package/cdn/assets/DEUY_zuVwmptMX4l.js +0 -150
  456. package/cdn/assets/DTCtbG90ip7Z7LaG.js +0 -220
  457. package/cdn/assets/D_HeH7AJqWoxehn52.js +0 -53
  458. package/cdn/assets/DfRGH6mEtIVDWEYN.js +0 -304
  459. package/cdn/assets/WLUhtyUNK5QJ7Pff.js +0 -34
  460. package/cdn/assets/c7aIqKLOO4pvUsV12.js +0 -220
  461. package/cdn/assets/mtI43hWjdp4E3Z_-.js +0 -152
  462. package/cdn/assets/nmR_PgTW7GrlbHHZ.js +0 -27
  463. package/cdn/assets/vTCuFafvRlSaT9wy.js +0 -87
  464. /package/browser/cjs/{1XrWGMP3GmsQOMIX2.cjs → 1XrWGMP3GmsQOMIX.cjs} +0 -0
  465. /package/browser/cjs/{4nReftSsKWmnRdtf2.cjs → 4nReftSsKWmnRdtf.cjs} +0 -0
  466. /package/browser/cjs/{507hQYooKKjnRzsZ2.cjs → 507hQYooKKjnRzsZ.cjs} +0 -0
  467. /package/browser/cjs/{BAxVLKkxFgI6cXnR.cjs → BAxVLKkxFgI6cXnR2.cjs} +0 -0
  468. /package/browser/cjs/{C2uDl8VIJqh58YF_.cjs → C2uDl8VIJqh58YF_2.cjs} +0 -0
  469. /package/browser/cjs/{CV4KQsHluMqo1I2Q.cjs → CV4KQsHluMqo1I2Q2.cjs} +0 -0
  470. /package/browser/cjs/{CXlzsh_WHCOsErJ12.cjs → CXlzsh_WHCOsErJ1.cjs} +0 -0
  471. /package/browser/cjs/{D8-KovdJ0LjxqCe2.cjs → D8-KovdJ0LjxqCe22.cjs} +0 -0
  472. /package/browser/cjs/{DDnGLOLTqLFsdUDS2.cjs → DDnGLOLTqLFsdUDS.cjs} +0 -0
  473. /package/browser/cjs/{DM7-R_ltoLbA9jde2.cjs → DM7-R_ltoLbA9jde.cjs} +0 -0
  474. /package/browser/cjs/{DNKyaSruDogoBd2H2.cjs → DNKyaSruDogoBd2H.cjs} +0 -0
  475. /package/browser/cjs/{Dx79LP1-YCQg8B87.cjs → Dx79LP1-YCQg8B872.cjs} +0 -0
  476. /package/browser/cjs/{JfM6P_qoQQTWakZf.cjs → JfM6P_qoQQTWakZf2.cjs} +0 -0
  477. /package/browser/cjs/{CbLXP9WY38wTcGn5.cjs → NcNz8RfT5V889CMT2.cjs} +0 -0
  478. /package/browser/cjs/{z_rZE1OHFPpdGBh42.cjs → z_rZE1OHFPpdGBh4.cjs} +0 -0
@@ -1,17 +1,14 @@
1
1
  /**
2
- * @license @sheetxl/studio-vanilla - SheetXL Studio - Vanilla entry point for integrating SheetXL UI. - v0.8.0-beta.1
2
+ * @license @sheetxl/studio-vanilla - SheetXL Studio - Vanilla entry point for integrating SheetXL UI. - v0.8.0-beta.3
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 { r as e } from "./CH0of3GZTzHviuQV2.js";
8
- import { o as t, t as n } from "./D_t53-8k73CNpV-p2.js";
9
- import { A as r, C as i, F as a, O as o, P as s, T as c, V as l, _ as u, d, l as f, m as p, r as m, s as h, t as g, v as _ } from "./CEN8dYSpN2oew8HH2.js";
10
- import { $ as v, $t as y, A as b, At as x, C as S, Ct as C, Dt as w, Et as T, F as ee, Ft as te, Gt as ne, Ht as re, J as ie, K as ae, L as oe, Lt as se, Mt as E, Nt as D, O, Pt as ce, Q as k, Qt as le, R as ue, Rt as A, St as de, Tt as fe, Ut as pe, V as j, W as me, X as he, Y as ge, Yt as _e, Z as M, Zt as ve, _t as N, at as ye, bt as be, c as xe, ct as Se, dn as P, dt as Ce, f as F, fn as I, gt as we, h as Te, i as Ee, in as L, k as De, ln as Oe, lt as ke, mt as Ae, n as je, nt as Me, on as Ne, ot as Pe, pn as Fe, rn as Ie, sn as Le, ut as Re, vt as ze, w as R, xt as Be, y as Ve, yt as He, zt as Ue } from "./Crkvq5j5KIa6eTLI2.js";
11
- import { r as We } from "./D9joTG0Z2zdWHAEa2.js";
12
- var Ge;
13
- Ge ||= {};
14
- var Ke = class extends p {
7
+ import { r as e } from "./BEb3QhWwGW8rErZy2.js";
8
+ import { i as t, t as n } from "./BSWXx2rKOMPxLLs82.js";
9
+ import { C as r, K as i, L as a, M as o, P as s, a as c, b as l, i as u, k as d, l as f, n as p, p as m, q as h, w as g, x as _, z as v } from "./DB_I2ygTnDxYiYyc2.js";
10
+ import { $t as y, A as b, At as x, B as S, Bt as C, Ct as w, D as T, Dt as E, E as ee, F as te, Ft as ne, Gt as re, It as ie, J as D, Jt as ae, K as oe, Lt as se, Mt as ce, N as le, Nt as ue, O as de, Ot as O, Pt as k, Q as fe, R as A, S as pe, St as me, T as he, Tt as ge, U as _e, Ut as j, Vt as ve, W as M, Wt as ye, X as be, Y as xe, Yt as N, Zt as Se, _ as P, _t as F, an as Ce, at as we, bt as Te, c as Ee, dt as De, et as Oe, f as ke, ft as Ae, gt as je, h as Me, in as Ne, jt as I, k as Pe, kt as Fe, ln as Ie, lt as Le, n as Re, p as ze, q as Be, qt as Ve, rn as He, rt as Ue, tn as We, tt as Ge, u as Ke, un as qe, vt as Je, w as Ye, x as Xe, xt as Ze, y as Qe, yt as $e, z as L } from "./FAaqx6EbN4JxNuNL2.js";
11
+ var et, tt = class extends s {
15
12
  constructor(e, t = 50) {
16
13
  super(t), this._transactions = e, this._floorId = e ? e.getCurrentCommit(!1).getId() : null, this._removeListener = e?.addListener({ onCommitChange: () => this._notifyOnStackChange() });
17
14
  }
@@ -104,9 +101,9 @@ var Ke = class extends p {
104
101
  close() {
105
102
  this._removeListener?.();
106
103
  }
107
- }, qe = class {
104
+ }, nt = class {
108
105
  constructor(e, t) {
109
- this._dirty = !1, this._store = e, this._savedCommitId = e.getCurrentCommit()?.getId() ?? null, this._emitter = new x(this);
106
+ this._dirty = !1, this._store = e, this._savedCommitId = e.getCurrentCommit()?.getId() ?? null, this._emitter = new L(this);
110
107
  let n = this;
111
108
  this._removeStoreListener = e.addListener({
112
109
  onCommitEnd() {
@@ -141,9 +138,11 @@ var Ke = class extends p {
141
138
  close() {
142
139
  this._removeStoreListener?.(), this._removeCommitListener?.(), this._emitter.close();
143
140
  }
144
- }, z = class e {
141
+ };
142
+ et ||= {};
143
+ var R = class e {
145
144
  constructor(t, n = {}) {
146
- this._password = null, this._emitter = new x(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;
145
+ this._password = null, this._emitter = new L(this), this._path = t ?? null, this._name = n.name ?? null, this._format = n.format ?? null, this._size = n.size ?? null, this._lastModified = n.lastModified ?? null, this._canWrite = n.canWrite ?? e._defaultCanWrite(this._path), this._encryption = n.encryption ?? null;
147
146
  }
148
147
  static _defaultCanWrite(e) {
149
148
  return !!e && !/^(https?:|data:|blob:)/i.test(e);
@@ -154,7 +153,7 @@ var Ke = class extends p {
154
153
  getName() {
155
154
  if (this._name !== null && this._name !== void 0) return this._name;
156
155
  let e = this._cleanPath();
157
- return e && N(e) || null;
156
+ return e && O(e) || null;
158
157
  }
159
158
  getPath() {
160
159
  return this._path;
@@ -165,7 +164,7 @@ var Ke = class extends p {
165
164
  getExtension() {
166
165
  let e = this._cleanPath();
167
166
  if (!e) return null;
168
- let t = D(e);
167
+ let t = b(e);
169
168
  return t ? t.toLowerCase() : null;
170
169
  }
171
170
  getEncryption() {
@@ -183,6 +182,9 @@ var Ke = class extends p {
183
182
  getSize() {
184
183
  return this._size;
185
184
  }
185
+ getLastModified() {
186
+ return this._lastModified;
187
+ }
186
188
  canWrite() {
187
189
  return this._canWrite;
188
190
  }
@@ -191,7 +193,7 @@ var Ke = class extends p {
191
193
  }
192
194
  update(e) {
193
195
  let t = !1;
194
- 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;
196
+ 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;
195
197
  }
196
198
  addListeners(e, t) {
197
199
  return this._emitter.addListeners(e, t);
@@ -212,37 +214,59 @@ var Ke = class extends p {
212
214
  ];
213
215
  return `${t} ${(n / 1024 ** r).toFixed(2)}${i[Math.min(r, i.length - 1)]}`;
214
216
  }
215
- }, Je = class {
217
+ }, z = /* @__PURE__ */ new WeakMap(), B = /* @__PURE__ */ new Set(), rt = (e) => z.get(e) ?? null, it = () => Array.from(B, (e) => e.getOrigin()), at = class e {
218
+ constructor(t) {
219
+ this._released = !1, e._assertFree(t), this._emitter = new L(this), this._origin = t, z.set(t, this), B.add(this);
220
+ }
221
+ getOrigin() {
222
+ return this._origin;
223
+ }
224
+ setOrigin(t) {
225
+ t !== this._origin && (e._assertFree(t), this._released || (z.delete(this._origin), z.set(t, this)), this._origin = t, this._emitter.notify("onOriginChange"));
226
+ }
227
+ release() {
228
+ this._released || (this._released = !0, z.get(this._origin) === this && z.delete(this._origin), B.delete(this));
229
+ }
230
+ addListeners(e, t) {
231
+ return this._emitter.addListeners(e, t);
232
+ }
233
+ static _assertFree(e) {
234
+ if (z.has(e)) throw Error("This origin already backs an open workbook; an origin backs one workbook at a time.");
235
+ }
236
+ }, ot = class {
216
237
  constructor() {
217
238
  this._defaultStringSourceType = "filepath";
218
239
  }
219
240
  async read(e) {
220
241
  let t = e.options ?? {}, n = e.source;
221
242
  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;
222
- let r = t.format, i = this._detectSourceType(n);
223
- if (!i) throw Error("Unable to detect source type from provided input.");
224
- let o, s, c = !1;
225
- if (i === "filepath") {
243
+ let r = n, i = await this.fileFromHandle(n);
244
+ i && (n = i);
245
+ let a = t.format, o = this._detectSourceType(n);
246
+ if (!o) throw Error("Unable to detect source type from provided input.");
247
+ let s, c, l = !1;
248
+ if (o === "filepath") {
226
249
  let e = typeof n == "string" && n.startsWith("file://") ? n.slice(7) : n;
227
- n = await this.filePathToFile(e), i = "file", c = !0;
250
+ n = await this.filePathToFile(e), o = "file", l = !0;
228
251
  }
229
- switch (i) {
252
+ switch (o) {
230
253
  case "file": {
231
- let e = n, t = e?.name, i = t ? `${N(t)}` : "";
232
- o = await e.arrayBuffer(), s = {
233
- format: r,
234
- ext: D(t),
235
- name: i,
236
- absolutePath: t,
254
+ let e = n, r = e?.name, o = r ? `${O(r)}` : "";
255
+ s = await e.arrayBuffer(), c = {
256
+ format: a,
257
+ ext: b(r),
258
+ name: o,
259
+ absolutePath: r,
237
260
  size: e.size,
238
- canWrite: c && this._canWriteLocalPath()
261
+ lastModified: e.lastModified,
262
+ canWrite: !t.asCopy && (!!i || l && this._canWriteLocalPath())
239
263
  };
240
264
  break;
241
265
  }
242
266
  case "blob": {
243
267
  let e = n;
244
- o = await e.arrayBuffer(), s = {
245
- format: r,
268
+ s = await e.arrayBuffer(), c = {
269
+ format: a,
246
270
  size: e.size
247
271
  };
248
272
  break;
@@ -254,68 +278,85 @@ var Ke = class extends p {
254
278
  let [, t] = n.split(",");
255
279
  e = t;
256
280
  } else e = n;
257
- o = a.base64ToArrayBuffer(e), s = {
258
- format: r,
281
+ s = p.base64ToArrayBuffer(e), c = {
282
+ format: a,
259
283
  size: e.length
260
284
  };
261
285
  break;
262
286
  }
263
287
  case "fetch": {
264
- let e, t, i;
288
+ let e, t, r;
265
289
  if (typeof n == "string") e = n;
266
290
  else {
267
291
  if (!n || typeof n != "object" || !("input" in n)) throw Error("Invalid fetch source provided.");
268
292
  {
269
- let r = n;
270
- e = r.input, t = r.init, i = r.timeout;
293
+ let i = n;
294
+ e = i.input, t = i.init, r = i.timeout;
271
295
  }
272
296
  }
273
- let a = i || 3e4, c = new AbortController(), l = setTimeout(() => c.abort(), a), u = typeof e == "string" ? e : e.toString(), d = D(u);
297
+ let i = r || 3e4, o = new AbortController(), l = setTimeout(() => o.abort(), i), u = typeof e == "string" ? e : e.toString(), d = b(u);
274
298
  try {
275
299
  let n = await fetch(e, {
276
300
  ...t,
277
- signal: c.signal
301
+ signal: o.signal
278
302
  });
279
303
  if (clearTimeout(l), !n.ok) throw Error(`Failed to fetch: ${n.status} ${n.statusText}`);
280
- let i = await n.arrayBuffer();
281
- if (!i) throw Error(`Unable to fetched content: ${u}`);
282
- o = i, s = {
283
- format: r,
304
+ let r = await n.arrayBuffer();
305
+ if (!r) throw Error(`Unable to fetched content: ${u}`);
306
+ s = r, c = {
307
+ format: a,
284
308
  ext: d,
285
- name: N(u, !0),
309
+ name: O(u, !0),
286
310
  absolutePath: u
287
311
  };
288
312
  } catch (e) {
289
- throw clearTimeout(l), e.name === "AbortError" ? Error(`Fetch timeout after ${a}ms: ${u}`) : e;
313
+ throw clearTimeout(l), e.name === "AbortError" ? Error(`Fetch timeout after ${i}ms: ${u}`) : e;
290
314
  }
291
315
  break;
292
316
  }
293
317
  case "buffer":
294
- o = n, s = { format: r };
318
+ s = n, c = { format: a };
295
319
  break;
296
320
  case "stream": {
297
- let e = n.getReader(), t = [], i = 0;
321
+ let e = n.getReader(), t = [], r = 0;
298
322
  try {
299
323
  for (;;) {
300
- let { done: n, value: r } = await e.read();
324
+ let { done: n, value: i } = await e.read();
301
325
  if (n) break;
302
- t.push(r), i += r.length;
326
+ t.push(i), r += i.length;
303
327
  }
304
328
  } finally {
305
329
  e.releaseLock();
306
330
  }
307
- let a = new ArrayBuffer(i), c = new Uint8Array(a), l = 0;
308
- for (let e of t) c.set(e, l), l += e.length;
309
- o = a, s = { format: r };
331
+ let i = new ArrayBuffer(r), o = new Uint8Array(i), l = 0;
332
+ for (let e of t) o.set(e, l), l += e.length;
333
+ s = i, c = { format: a };
310
334
  break;
311
335
  }
312
- default: throw Error(`Unsupported source type: ${i}`);
336
+ default: throw Error(`Unsupported source type: ${o}`);
313
337
  }
314
- let l = await e.decode(o, {
315
- sourceType: i,
316
- ...s
338
+ c.canWrite && await this.findOpenOrigin(r, c) && (c.canWrite = !1);
339
+ let u = await e.decode(s, {
340
+ sourceType: o,
341
+ ...c
317
342
  });
318
- return l ? (await this.onWorkbookRead(l, n), l) : null;
343
+ return u ? (await this.onWorkbookRead(u, r), u) : null;
344
+ }
345
+ async findOpenOrigin(e, t) {
346
+ return t.absolutePath ? this.findOpenPath(t.absolutePath) : null;
347
+ }
348
+ findOpenPath(e, t) {
349
+ return it().find((n) => {
350
+ if (n === t || !n.canWrite()) return !1;
351
+ let r = n.getPath();
352
+ return !!r && this.isSamePath(r, e);
353
+ }) ?? null;
354
+ }
355
+ isSamePath(e, t) {
356
+ return e === t;
357
+ }
358
+ async fileFromHandle(e) {
359
+ return null;
319
360
  }
320
361
  async resolveSource(e) {
321
362
  return null;
@@ -336,25 +377,21 @@ var Ke = class extends p {
336
377
  }
337
378
  if (typeof File < "u" && e instanceof File) return "file";
338
379
  if (typeof Blob < "u" && e instanceof Blob) return "blob";
339
- let t = e instanceof ArrayBuffer || Object.prototype.toString.call(e) === "[object ArrayBuffer]", n = ArrayBuffer.isView(e), r = a.isNodeBuffer(e);
380
+ let t = e instanceof ArrayBuffer || Object.prototype.toString.call(e) === "[object ArrayBuffer]", n = ArrayBuffer.isView(e), r = p.isNodeBuffer(e);
340
381
  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;
341
382
  }
342
- }, Ye = class extends Je {
383
+ }, st = class extends ot {
343
384
  constructor(e, t) {
344
- super(), this._getWriteFormats = e, this._getReadFormats = t, this._defaultStringSourceType = "fetch", this._handleCache = /* @__PURE__ */ new WeakMap(), this._pendingOpenHandle = null;
385
+ super(), this._getWriteFormats = e, this._getReadFormats = t, this._defaultStringSourceType = "fetch", this._handleCache = /* @__PURE__ */ new WeakMap();
345
386
  }
346
- async read(e) {
347
- let t = e.source;
348
- return t && t.kind === "file" && typeof t.getFile == "function" ? (this._pendingOpenHandle = t, super.read({
349
- ...e,
350
- source: await t.getFile()
351
- })) : super.read(e);
387
+ async fileFromHandle(e) {
388
+ return V(e) ? e.getFile() : null;
352
389
  }
353
390
  async resolveSource() {
354
391
  let e = await this._getReadFormats?.() ?? [];
355
392
  if (typeof globalThis.showOpenFilePicker == "function") try {
356
393
  let t = function(e) {
357
- let t = Xe(e);
394
+ let t = ct(e);
358
395
  if (t.length <= 1) return t;
359
396
  let n = /* @__PURE__ */ new Set(), r = {};
360
397
  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));
@@ -363,32 +400,37 @@ var Ke = class extends p {
363
400
  accept: r
364
401
  }, ...t];
365
402
  }(e), [n] = await globalThis.showOpenFilePicker(t.length ? { types: t } : void 0);
366
- return this._pendingOpenHandle = n, await n.getFile();
403
+ return n;
367
404
  } catch (e) {
368
405
  if (e?.name === "AbortError") return null;
369
406
  throw e;
370
407
  }
371
408
  let t = e.flatMap((e) => e.exts.map((e) => "." + e)).join(", ");
372
- return g.openFileDialog(t);
409
+ return f.openFileDialog(t);
410
+ }
411
+ async findOpenOrigin(e) {
412
+ return V(e) ? this._findOpenHandle(e) : null;
373
413
  }
374
- async onWorkbookRead(e) {
375
- if (this._pendingOpenHandle) {
376
- let t = e.getOrigin?.();
377
- t && (this._handleCache.set(t, this._pendingOpenHandle), t instanceof z && t.update({ canWrite: !0 })), this._pendingOpenHandle = null;
414
+ async _findOpenHandle(e, t) {
415
+ for (let n of it()) {
416
+ if (n === t || !n.canWrite()) continue;
417
+ let r = this._handleCache.get(n);
418
+ if (r && typeof r.isSameEntry == "function" && await r.isSameEntry(e)) return n;
378
419
  }
420
+ return null;
421
+ }
422
+ async onWorkbookRead(e, t) {
423
+ if (!V(t)) return;
424
+ let n = e.getOrigin?.();
425
+ n?.canWrite() && this._handleCache.set(n, t);
379
426
  }
380
427
  async filePathToFile(e) {
381
428
  throw Error(`Cannot read local file path '${e}' in browser environment. Use a file input element or fetch for remote URLs.`);
382
429
  }
383
430
  async write(e) {
384
- 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;
385
- if (c?.name) {
386
- let e = t.getPath()?.split(/[/\\]/).pop();
387
- e && c.name !== e && (c = void 0);
388
- }
389
- let l = !!c;
390
- if (s) try {
391
- if (c) {
431
+ let { origin: t, suggestedName: n, format: r, encode: a, prompt: o } = e, s = [r, ...(await this._getWriteFormats()).filter((e) => e.key !== r.key)], c = typeof globalThis.showSaveFilePicker == "function", u = !o && t.canWrite() ? this._handleCache.get(t) : void 0;
432
+ if (c) try {
433
+ if (u) {
392
434
  let e = await async function(e) {
393
435
  try {
394
436
  if (typeof e.queryPermission != "function") return "granted";
@@ -397,43 +439,50 @@ var Ke = class extends p {
397
439
  } catch {
398
440
  return "unavailable";
399
441
  }
400
- }(c);
442
+ }(u);
401
443
  if (e === "denied") return null;
402
- e !== "granted" && (c = void 0);
444
+ e !== "granted" && (u = void 0);
403
445
  }
404
- c ||= await globalThis.showSaveFilePicker({
405
- suggestedName: n,
406
- types: Xe(o)
407
- });
408
- let e = Qe(c.name ?? n), a = o.find((t) => t.exts.some((t) => t.toLowerCase() === e)) ?? r, s = await i(a.key), u = new Blob([Ze(s)], { type: a.mimeType || "application/octet-stream" }), d = await c.createWritable();
409
- return await d.write(u), await d.close(), this._handleCache.set(t, c), t instanceof z && t.update({
410
- size: u.size,
411
- ...l ? null : {
412
- path: c.name ?? n,
413
- name: null,
414
- format: a.key,
415
- canWrite: !0
416
- }
417
- }), t;
446
+ let o = !!u;
447
+ if (!o) {
448
+ u = await globalThis.showSaveFilePicker({
449
+ suggestedName: n,
450
+ types: ct(s)
451
+ });
452
+ let t = await this._findOpenHandle(u, e.workbook?.getOrigin?.());
453
+ if (t) throw new l(i("error.io.openElsewhere", { name: t.getName() ?? u.name ?? "" }));
454
+ }
455
+ let c = ut(u.name ?? n), d = s.find((e) => e.exts.some((e) => e.toLowerCase() === c)) ?? r, f = o ? t : new R(u.name ?? n, {
456
+ format: d.key,
457
+ canWrite: !0
458
+ }), p = await a(d.key, f);
459
+ if (!p) return null;
460
+ let m = new Blob([lt(p)], { type: d.mimeType || "application/octet-stream" }), h = await u.createWritable();
461
+ if (await h.write(m), await h.close(), this._handleCache.set(f, u), f instanceof R) {
462
+ let e = await Promise.resolve(u.getFile?.()).then((e) => e?.lastModified ?? null, () => null);
463
+ f.update({
464
+ size: m.size,
465
+ lastModified: e
466
+ });
467
+ }
468
+ return f;
418
469
  } catch (e) {
419
470
  if (e?.name === "AbortError") return null;
420
- }
421
- let u = await i(r.key), d = new Blob([Ze(u)], { type: r.mimeType || "application/octet-stream" }), f = t.getPath(), p = f ? f.split(/[/\\]/).pop() : null, m = p && Qe(p) ? p : n;
471
+ if (e instanceof l) throw e;
472
+ }
473
+ let d = t.getPath(), f = d ? d.split(/[/\\]/).pop() : null, p = f && r.exts.some((e) => e.toLowerCase() === ut(f)) ? f : n, m = d !== p || t.canWrite() ? new R(p, {
474
+ format: r.key,
475
+ canWrite: !1
476
+ }) : t, h = await a(r.key, m);
477
+ if (!h) return null;
478
+ let g = new Blob([lt(h)], { type: r.mimeType || "application/octet-stream" });
422
479
  return function(e, t) {
423
480
  let n = URL.createObjectURL(e), r = document.createElement("a");
424
481
  r.style.display = "none", r.href = n, r.download = t, document.body.appendChild(r), r.click(), document.body.removeChild(r), URL.revokeObjectURL(n);
425
- }(d, m), t instanceof z && t.update({
426
- size: d.size,
427
- ...t.getPath() === m ? null : {
428
- path: m,
429
- name: null,
430
- format: r.key,
431
- canWrite: !1
432
- }
433
- }), t;
482
+ }(g, p), m instanceof R && m.update({ size: g.size }), m;
434
483
  }
435
484
  };
436
- function Xe(e) {
485
+ function ct(e) {
437
486
  return e.map((e) => {
438
487
  let t = e.mimeType && e.mimeType.includes("/") ? e.mimeType : "application/octet-stream";
439
488
  return {
@@ -442,18 +491,21 @@ function Xe(e) {
442
491
  };
443
492
  });
444
493
  }
445
- function Ze(e) {
494
+ function V(e) {
495
+ return !!e && e.kind === "file" && typeof e.getFile == "function";
496
+ }
497
+ function lt(e) {
446
498
  if (typeof SharedArrayBuffer < "u" && e instanceof SharedArrayBuffer) {
447
499
  let t = new ArrayBuffer(e.byteLength);
448
500
  return new Uint8Array(t).set(new Uint8Array(e)), t;
449
501
  }
450
502
  return e;
451
503
  }
452
- function Qe(e) {
504
+ function ut(e) {
453
505
  let t = e.lastIndexOf(".");
454
506
  return t >= 0 ? e.slice(t + 1).toLowerCase() : "";
455
507
  }
456
- var $e = class {
508
+ var dt = class {
457
509
  constructor(e) {
458
510
  this._private = { input: e }, typeof e == "string" ? this._private.name = e : Object.assign(this._private, e);
459
511
  }
@@ -475,11 +527,11 @@ var $e = class {
475
527
  get isIFont() {
476
528
  return !0;
477
529
  }
478
- }, et = e({
479
- findBestMatch: () => at,
480
- getFontList: () => it,
481
- setFontList: () => H
482
- }), tt = [
530
+ }, ft = e({
531
+ findBestMatch: () => bt,
532
+ getFontList: () => gt,
533
+ setFontList: () => W
534
+ }), pt = [
483
535
  "Arial",
484
536
  "Arial Black",
485
537
  "Brush Script MT",
@@ -495,55 +547,55 @@ var $e = class {
495
547
  "Times New Roman",
496
548
  "Trebuchet MS",
497
549
  "Verdana"
498
- ], B = /* @__PURE__ */ new Map();
499
- B.set(k.GenericName.Serif, ["Tahoma"]), B.set(k.GenericName.SanSerif, ["Calibri"]), B.set(k.GenericName.MonoSpace, ["Courier New"]), B.set(k.GenericName.Cursive, ["Comic Sans MS"]), B.set(k.GenericName.Fantasy, ["Luminari"]), B.set(k.GenericName.UISystem, ["Arial"]), B.set(k.GenericName.UISerif, ["Tahoma"]), B.set(k.GenericName.UISanSerif, ["Arial"]), B.set(k.GenericName.UIMonoSpace, ["Courier New"]), B.set(k.GenericName.UIRounded, ["Arial"]), B.set(k.GenericName.Math, []), B.set(k.GenericName.Emoji, []), B.set(k.GenericName.Fangsong, []);
500
- var V = /* @__PURE__ */ new Map(), nt = [];
501
- H(tt);
502
- var rt = eval;
503
- function H(e) {
504
- e || H(tt);
550
+ ], H = /* @__PURE__ */ new Map();
551
+ H.set(P.GenericName.Serif, ["Tahoma"]), H.set(P.GenericName.SanSerif, ["Calibri"]), H.set(P.GenericName.MonoSpace, ["Courier New"]), H.set(P.GenericName.Cursive, ["Comic Sans MS"]), H.set(P.GenericName.Fantasy, ["Luminari"]), H.set(P.GenericName.UISystem, ["Arial"]), H.set(P.GenericName.UISerif, ["Tahoma"]), H.set(P.GenericName.UISanSerif, ["Arial"]), H.set(P.GenericName.UIMonoSpace, ["Courier New"]), H.set(P.GenericName.UIRounded, ["Arial"]), H.set(P.GenericName.Math, []), H.set(P.GenericName.Emoji, []), H.set(P.GenericName.Fangsong, []);
552
+ var U = /* @__PURE__ */ new Map(), mt = [];
553
+ W(pt);
554
+ var ht = eval;
555
+ function W(e) {
556
+ e || W(pt);
505
557
  let t = [];
506
558
  for (let n = 0; n < e.length; n++) {
507
559
  let r = e[n];
508
- typeof r == "string" && (r = new $e(r));
560
+ typeof r == "string" && (r = new dt(r));
509
561
  let i = !0;
510
562
  try {
511
- i = rt(`document.fonts.check('12px ${r.getFamily()}')`);
563
+ i = ht(`document.fonts.check('12px ${r.getFamily()}')`);
512
564
  } catch {}
513
565
  let a = {
514
566
  fontRef: r,
515
567
  loaded: i
516
568
  };
517
- t.push(a), V.set(r.getFamily(), a);
569
+ t.push(a), U.set(r.getFamily(), a);
518
570
  }
519
- nt = Object.freeze(t);
571
+ mt = Object.freeze(t);
520
572
  }
521
- function it() {
522
- return nt;
573
+ function gt() {
574
+ return mt;
523
575
  }
524
- var U, W, G, K, q = /* @__PURE__ */ new Map();
525
- function at(e, t) {
526
- let n = q.get(e);
576
+ var _t, vt, G, yt, K = /* @__PURE__ */ new Map();
577
+ function bt(e, t) {
578
+ let n = K.get(e);
527
579
  if (n) return n.fontRef === null ? null : n;
528
580
  let r = [e];
529
581
  t?.fallbacks && (r = r.concat(t.fallbacks));
530
582
  let i = null;
531
583
  for (let e = 0; !i && e < r.length; e++) {
532
584
  let t = r[e];
533
- if (i = V.get(t), !i) {
534
- let e = B.get(t);
535
- if (e) for (let t = 0; !i && t < e.length; t++) i = V.get(e[t]);
585
+ if (i = U.get(t), !i) {
586
+ let e = H.get(t);
587
+ if (e) for (let t = 0; !i && t < e.length; t++) i = U.get(e[t]);
536
588
  }
537
589
  }
538
- return i ? q.set(e, i) : q.set(e, {
590
+ return i ? K.set(e, i) : K.set(e, {
539
591
  fontRef: null,
540
592
  loaded: !1
541
593
  }), i;
542
594
  }
543
- var ot = e({
544
- DefaultFontSizes: () => st,
545
- findNextFontSize: () => ct
546
- }), st = Object.freeze([
595
+ var xt = e({
596
+ DefaultFontSizes: () => St,
597
+ findNextFontSize: () => Ct
598
+ }), St = Object.freeze([
547
599
  8,
548
600
  9,
549
601
  10,
@@ -562,19 +614,19 @@ var ot = e({
562
614
  48,
563
615
  72
564
616
  ]);
565
- function ct(e, t = !0, n = st) {
617
+ function Ct(e, t = !0, n = St) {
566
618
  if (!n || n.length === 0) return e;
567
619
  if (e === void 0) return n[0];
568
620
  if (t && e >= n[n.length - 1] || !t && e <= n[0]) return e;
569
- let i = r.findEqualOrGreater(n, e);
570
- return t ? (n[i] === e && (i += 1), n[i] || --i, n[i]) : (--i, n[i]);
621
+ let r = v.findEqualOrGreater(n, e);
622
+ return t ? (n[r] === e && (r += 1), n[r] || --r, n[r]) : (--r, n[r]);
571
623
  }
572
- (U ||= {}).SortOn = {
624
+ (_t ||= {}).SortOn = {
573
625
  Value: "value",
574
626
  FillColor: "fillColor",
575
627
  FontColor: "fontColor",
576
628
  Icon: "icon"
577
- }, (G = W ||= {}).Compound = {
629
+ }, (G = vt ||= {}).Compound = {
578
630
  Single: "sng",
579
631
  Double: "dbl",
580
632
  ThickThin: "thickThin",
@@ -596,7 +648,7 @@ function ct(e, t = !0, n = st) {
596
648
  Single: "none",
597
649
  Double: "double",
598
650
  ThickThin: "thickThin",
599
- ThinThick: "thickThin"
651
+ ThinThick: "thinThick"
600
652
  }, G.StrokeStyle = {
601
653
  None: "none",
602
654
  Dashed: "dashed",
@@ -609,7 +661,7 @@ function ct(e, t = !0, n = st) {
609
661
  SysDashDot: "sysDashDot",
610
662
  SysDashDotDot: "sysDashDotDot",
611
663
  SysDot: "sysDot"
612
- }, (K ||= {}).Type = {
664
+ }, (yt ||= {}).Type = {
613
665
  OuterShadow: "outerShadow",
614
666
  InnerShadow: "innerShadow",
615
667
  PresetShadow: "presetShadow",
@@ -617,68 +669,68 @@ function ct(e, t = !0, n = st) {
617
669
  SoftEdge: "softEdge",
618
670
  Reflection: "reflection"
619
671
  };
620
- var lt, ut, dt, ft, J = Se.BuiltInName, pt = {
621
- [J.Normal]: _("style.builtin.normal"),
622
- [J.Comma]: _("style.builtin.comma"),
623
- [J.Currency]: _("style.builtin.currency"),
624
- [J.Percent]: _("style.builtin.percent"),
625
- [J.Comma0]: _("style.builtin.comma0"),
626
- [J.Currency0]: _("style.builtin.currency0"),
627
- [J.Hyperlink]: _("style.builtin.hyperlink"),
628
- [J.FollowedHyperlink]: _("style.builtin.followedHyperlink"),
629
- [J.Note]: _("style.builtin.note"),
630
- [J.WarningText]: _("style.builtin.warningText"),
631
- [J.Title]: _("style.builtin.title"),
632
- [J.Input]: _("style.builtin.input"),
633
- [J.Output]: _("style.builtin.output"),
634
- [J.Calculation]: _("style.builtin.calculation"),
635
- [J.CheckCell]: _("style.builtin.checkCell"),
636
- [J.LinkedCell]: _("style.builtin.linkedCell"),
637
- [J.Total]: _("style.builtin.total"),
638
- [J.Good]: _("style.builtin.good"),
639
- [J.Bad]: _("style.builtin.bad"),
640
- [J.Neutral]: _("style.builtin.neutral"),
641
- [J.ExplanatoryText]: _("style.builtin.explanatoryText")
642
- }, mt = _("style.builtin.heading"), ht = _("style.builtin.accent"), gt = _("style.builtin.accentTint"), _t = /^Heading ([1-4])$/, vt = /^Accent([1-6])$/, yt = /^(20|40|60)% - Accent([1-6])$/;
643
- function bt(e) {
644
- let t = pt[e];
672
+ var wt, Tt, Et, Dt, q = Oe.BuiltInName, Ot = {
673
+ [q.Normal]: g("style.builtin.normal"),
674
+ [q.Comma]: g("style.builtin.comma"),
675
+ [q.Currency]: g("style.builtin.currency"),
676
+ [q.Percent]: g("style.builtin.percent"),
677
+ [q.Comma0]: g("style.builtin.comma0"),
678
+ [q.Currency0]: g("style.builtin.currency0"),
679
+ [q.Hyperlink]: g("style.builtin.hyperlink"),
680
+ [q.FollowedHyperlink]: g("style.builtin.followedHyperlink"),
681
+ [q.Note]: g("style.builtin.note"),
682
+ [q.WarningText]: g("style.builtin.warningText"),
683
+ [q.Title]: g("style.builtin.title"),
684
+ [q.Input]: g("style.builtin.input"),
685
+ [q.Output]: g("style.builtin.output"),
686
+ [q.Calculation]: g("style.builtin.calculation"),
687
+ [q.CheckCell]: g("style.builtin.checkCell"),
688
+ [q.LinkedCell]: g("style.builtin.linkedCell"),
689
+ [q.Total]: g("style.builtin.total"),
690
+ [q.Good]: g("style.builtin.good"),
691
+ [q.Bad]: g("style.builtin.bad"),
692
+ [q.Neutral]: g("style.builtin.neutral"),
693
+ [q.ExplanatoryText]: g("style.builtin.explanatoryText")
694
+ }, kt = g("style.builtin.heading"), At = g("style.builtin.accent"), jt = g("style.builtin.accentTint"), Mt = /^Heading ([1-4])$/, Nt = /^Accent([1-6])$/, Pt = /^(20|40|60)% - Accent([1-6])$/;
695
+ function Ft(e) {
696
+ let t = Ot[e];
645
697
  if (t) return { key: t };
646
- let n = _t.exec(e);
698
+ let n = Mt.exec(e);
647
699
  return n ? {
648
- key: mt,
700
+ key: kt,
649
701
  params: { n: +n[1] }
650
- } : (n = vt.exec(e), n ? {
651
- key: ht,
702
+ } : (n = Nt.exec(e), n ? {
703
+ key: At,
652
704
  params: { n: +n[1] }
653
- } : (n = yt.exec(e), n ? {
654
- key: gt,
705
+ } : (n = Pt.exec(e), n ? {
706
+ key: jt,
655
707
  params: {
656
708
  pct: +n[1],
657
709
  n: +n[2]
658
710
  }
659
711
  } : null));
660
712
  }
661
- var xt = (e, t, n, r, i) => {
662
- let a = JSON.parse(JSON.stringify(e.definition));
663
- a.adjs ||= [];
664
- let o = "", s = 0, c = 0;
665
- t > 0 ? (c = t, s = 100 - t, o = u("op.lighterPercent", { percent: t })) : t < 0 && (s = 100 + t, o = u("op.darkerPercent", { percent: -t })), s && a.adjs.push({ [S.AdjustmentType.LumMod]: s }), c && a.adjs.push({ [S.AdjustmentType.LumOff]: c });
666
- let l = new ge({
667
- val: a.val,
668
- adjs: a.adjs
669
- }, n), d = l.toString();
670
- r?.set(d, l);
671
- let f = l.toRGBA().toString();
672
- return i?.set(f, l), {
673
- description: e.description + ", " + o,
674
- definition: a
713
+ var It = (e, t, n, r, a) => {
714
+ let o = JSON.parse(JSON.stringify(e.definition));
715
+ o.adjs ||= [];
716
+ let s = "", c = 0, l = 0;
717
+ t > 0 ? (l = t, c = 100 - t, s = i("op.lighterPercent", { percent: t })) : t < 0 && (c = 100 + t, s = i("op.darkerPercent", { percent: -t })), c && o.adjs.push({ [ie.AdjustmentType.LumMod]: c }), l && o.adjs.push({ [ie.AdjustmentType.LumOff]: l });
718
+ let u = new Ce({
719
+ val: o.val,
720
+ adjs: o.adjs
721
+ }, n), d = u.toString();
722
+ r?.set(d, u);
723
+ let f = u.toRGBA().toString();
724
+ return a?.set(f, u), {
725
+ description: e.description + ", " + s,
726
+ definition: o
675
727
  };
676
728
  };
677
- function St(e) {
729
+ function Lt(e) {
678
730
  let t, n = e.trim();
679
731
  if (!n) return;
680
732
  try {
681
- let e = We.shared().tokenize(n, !1);
733
+ let e = ze.shared().tokenize(n, !1);
682
734
  if (e.errors.length > 0) return;
683
735
  t = e.tokens;
684
736
  } catch {
@@ -696,24 +748,24 @@ function St(e) {
696
748
  case "NumberToken":
697
749
  case "ScientificDigit":
698
750
  case "DigitToken": {
699
- let e = De(o).value;
751
+ let e = Te(o).value;
700
752
  return r === 0 ? e : r * e;
701
753
  }
702
- case "StringToken": return r === 0 ? _e(o).value : void 0;
703
- case "BooleanToken": return r === 0 ? ke(o).value : void 0;
754
+ case "StringToken": return r === 0 ? ae(o).value : void 0;
755
+ case "BooleanToken": return r === 0 ? ve(o).value : void 0;
704
756
  case "LiteralError":
705
- case "RefError": return r === 0 ? Ae(o).value : void 0;
757
+ case "RefError": return r === 0 ? w(o).value : void 0;
706
758
  default: return;
707
759
  }
708
760
  } catch {
709
761
  return;
710
762
  }
711
763
  }
712
- function Ct(e, n) {
713
- let r = wt(e), i = wt(n);
764
+ function Rt(e, n) {
765
+ let r = zt(e), i = zt(n);
714
766
  return r === i ? e === n ? 0 : typeof e == "number" && typeof n == "number" ? e < n ? -1 : 1 : typeof e == "string" && typeof n == "string" ? e < n ? -1 : +(e > n) : typeof e == "boolean" ? e ? 1 : -1 : t.isError(e) && t.isError(n) ? e.getCode() - n.getCode() : 0 : r - i;
715
767
  }
716
- function wt(e) {
768
+ function zt(e) {
717
769
  if (e === null) return 0;
718
770
  switch (typeof e) {
719
771
  case "number": return 1;
@@ -722,14 +774,14 @@ function wt(e) {
722
774
  default: return t.isError(e) ? 4 : 5;
723
775
  }
724
776
  }
725
- (lt ||= {}).buildPalette = function(e, t, n, r) {
777
+ (wt ||= {}).buildPalette = function(e, t, n, r) {
726
778
  let i = [];
727
779
  for (let a = 0; a < e.length; a++) {
728
780
  let o = [];
729
781
  i.push(o);
730
782
  let s = (i) => {
731
- for (let s = 0; s < i.length; s++) o.push(xt(e[a], i[s], t, n, r));
732
- }, c = new ge({
783
+ for (let s = 0; s < i.length; s++) o.push(It(e[a], i[s], t, n, r));
784
+ }, c = new Ce({
733
785
  val: e[a].definition.val,
734
786
  adjs: e[a].definition.adjs
735
787
  }, t).toHSLA().lum;
@@ -766,11 +818,24 @@ function wt(e) {
766
818
  ]);
767
819
  }
768
820
  return i;
769
- }, ut ||= {}, dt ||= {}, ft ||= {};
770
- var Tt = class {
821
+ }, Tt ||= {}, Et ||= {}, Dt ||= {};
822
+ var Bt = class {
771
823
  constructor(e) {
772
824
  this._children = e;
773
825
  }
826
+ getCoords() {
827
+ let e = this._children, t = null;
828
+ for (let n = 0; n < e.length; n++) {
829
+ let r = e[n].getCoords();
830
+ r && (t = t ? {
831
+ rowStart: Math.min(t.rowStart, r.rowStart),
832
+ colStart: Math.min(t.colStart, r.colStart),
833
+ rowEnd: Math.max(t.rowEnd, r.rowEnd),
834
+ colEnd: Math.max(t.colEnd, r.colEnd)
835
+ } : r);
836
+ }
837
+ return t;
838
+ }
774
839
  getSize() {
775
840
  let e = this._children, t = e.length, n = 0;
776
841
  for (let r = 0; r < t; r++) n += e[r].getSize();
@@ -799,19 +864,19 @@ var Tt = class {
799
864
  let n = t[e].getSortedNumbers().getValues();
800
865
  n.length > 0 && r.push(n);
801
866
  }
802
- e = new oe(function(e) {
867
+ e = new fe(function(e) {
803
868
  let t = e.length;
804
- if (t === 0) return Et;
869
+ if (t === 0) return Vt;
805
870
  if (t === 1) return e[0];
806
871
  let n = e[0];
807
- for (let r = 1; r < t; r++) n = Dt(n, e[r]);
872
+ for (let r = 1; r < t; r++) n = Ht(n, e[r]);
808
873
  return Object.freeze(n);
809
874
  }(r)), this._sortedNumbers = e;
810
875
  }
811
876
  return e;
812
877
  }
813
878
  getRanked(e) {
814
- return Ue(this._children, e, Ct)[Symbol.iterator]();
879
+ return se(this._children, e, Rt)[Symbol.iterator]();
815
880
  }
816
881
  getFrequencies(e) {
817
882
  if (e) return this._mergeFrequencies(e);
@@ -819,7 +884,7 @@ var Tt = class {
819
884
  return t || (t = this._mergeFrequencies(), this._frequencies = t), t;
820
885
  }
821
886
  _mergeFrequencies(e) {
822
- let t = e?.keyFn ?? le, n = e?.limit, r = /* @__PURE__ */ new Map(), i = this._children, a = i.length, o = 0, s = 0, c = !1;
887
+ let t = e?.keyFn ?? ge, n = e?.limit, r = /* @__PURE__ */ new Map(), i = this._children, a = i.length, o = 0, s = 0, c = !1;
823
888
  for (let l = 0; l < a; l++) {
824
889
  let a = i[l].getFrequencies(e);
825
890
  o += a.getVisitedCount(), s += a.getTotalCount(), c ||= a.isTruncated();
@@ -832,7 +897,7 @@ var Tt = class {
832
897
  }) : c = !0, d = u.next();
833
898
  }
834
899
  }
835
- return ne.fromGroups(r, t, e, Ct, o, s, c);
900
+ return re.fromGroups(r, t, e, Rt, o, s, c);
836
901
  }
837
902
  getTypedCounts(e) {
838
903
  let t = this._typedCounts;
@@ -882,171 +947,117 @@ var Tt = class {
882
947
  let a = r.numericalCount;
883
948
  a <= 0 || (i.numericalCount += a, i.sum += r.sum, i.sumSq += r.varP * a + r.sum * r.sum / a, (i.min === void 0 || r.min < i.min) && (i.min = r.min), (i.max === void 0 || r.max > i.max) && (i.max = r.max));
884
949
  }
885
- return Le(i);
950
+ return He(i);
886
951
  }
887
- }, Et = Object.freeze([]);
888
- function Dt(e, t) {
952
+ }, Vt = Object.freeze([]);
953
+ function Ht(e, t) {
889
954
  let n = e.length, r = t.length, i = Array(n + r), a = 0, o = 0, s = 0;
890
955
  for (; a < n && o < r;) i[s++] = e[a] <= t[o] ? e[a++] : t[o++];
891
956
  for (; a < n;) i[s++] = e[a++];
892
957
  for (; o < r;) i[s++] = t[o++];
893
958
  return i;
894
959
  }
895
- var Ot = class {
896
- constructor(e) {
897
- this.isIExternalBook = !0, this._json = e;
898
- }
899
- getIdentity() {
900
- return this._json.identity;
960
+ var Ut = class {
961
+ constructor(e, t) {
962
+ this._deleted = !1, this._json = { ...e }, this._deleteFromCollection = t ?? null;
901
963
  }
902
- getSheetNames() {
903
- return this._json.sheetNames;
964
+ getId() {
965
+ return this._json.id;
904
966
  }
905
- getDefinedNames() {
906
- return this._json.definedNames ?? [];
967
+ getDisplayName() {
968
+ return this._json.displayName;
907
969
  }
908
- getSheetData(e) {
909
- return this._json.sheetDataSet?.find((t) => t.sheetIndex === e) ?? null;
970
+ getUserId() {
971
+ return this._json.userId ?? null;
910
972
  }
911
- toJSON() {
912
- return this._json;
973
+ getProviderId() {
974
+ return this._json.providerId ?? null;
913
975
  }
914
- }, kt = class {
915
- constructor(e) {
916
- this.isIExternalBookCollection = !0, this._items = (e?.json ?? []).map((e) => e ? new Ot(e) : null);
976
+ delete() {
977
+ this._deleted || (this._deleted = !0, this._deleteFromCollection?.(this));
917
978
  }
918
- [Symbol.iterator]() {
919
- return this.getItems()[Symbol.iterator]();
979
+ isDeleted() {
980
+ return this._deleted;
920
981
  }
921
- getItems() {
922
- let e = [], t = this._items.length;
923
- for (let n = 0; n < t; n++) {
924
- let t = this._items[n];
925
- t && e.push(t);
926
- }
927
- return e;
982
+ toJSON() {
983
+ return { ...this._json };
928
984
  }
929
- getCount() {
930
- return this.getItems().length;
985
+ get [Symbol.toStringTag]() {
986
+ return "[Person]";
931
987
  }
932
- getByIndex(e) {
933
- return this._items[e - 1] ?? null;
988
+ toString() {
989
+ return `Person:${this.getDisplayName()}`;
934
990
  }
935
- toJSON() {
936
- return this._items.length === 0 ? null : this._items.map((e) => e?.toJSON() ?? null);
991
+ get isIPerson() {
992
+ return !0;
937
993
  }
938
- }, At = class {
994
+ }, Wt = class extends Ke {
939
995
  constructor(e) {
940
- this._closed = !1, this._options = { ...e };
941
- let t = this;
942
- this._transactions = this._options.transactions ?? new fe({ transient: !0 }), this._stateId = this._transactions.create(), this._transactionsRemoveListener = this._transactions.addStateListener(this._stateId, { onAfterStateChange(e, n, r) {
943
- t._emitter.notify("onCollectionChange");
944
- } }), this._emitter = new x(this, this._transactions), this._initState(e?.initial);
945
- }
946
- add(e, t, n) {
947
- let r = this;
948
- t && t.addListeners({ onDelete: (t) => {
949
- r._updateState((t) => {
950
- if (!t.modules[e]) return;
951
- let n = t.modules[e];
952
- if (n) {
953
- let i = { ...t };
954
- return r._options.onRemove?.(e, n), r._emitter.notify("onCollectionChange"), delete i.modules[e], i;
955
- }
956
- return t;
957
- }, _("op.deleteModule"));
958
- } }, { once: !0 });
959
- let i = this._getState()?.modules, a = i?.[e], o = n?.replace ?? !1;
960
- if (a && !o) throw Error(`Already existing '${e}'`);
961
- let s = { ...i };
962
- t ? (s[e] = t, r._options.onAdd?.(e, t), this._updateState({ modules: s }, _(o ? "op.saveScripts" : "op.addScript"))) : (delete s[e], r._options.onRemove?.(e, null), this._updateState({ modules: s }, _("op.removeScript"))), r._emitter.notify("onCollectionChange");
963
- }
964
- *[Symbol.iterator]() {
965
- yield* this.getItems();
966
- }
967
- getItems(e) {
968
- let t = this._getState();
969
- if (!t) return r.EmptyArray;
970
- let n = t.modules, i = Object.keys(n), a = i.length;
971
- if (a === 0) return r.EmptyArray;
972
- let o = [], s = e?.name ? e.name.toUpperCase() : null;
973
- for (let e = 0; e < a; e++) {
974
- let t = i[e], r = n[t], a = !0;
975
- s && s !== t.toUpperCase() && (a = !1), a && o.push(r);
976
- }
977
- return o ?? r.EmptyArray;
996
+ super(), this._byId = /* @__PURE__ */ new Map(), this._byDisplayName = /* @__PURE__ */ new Map(), this._items = null, this._current = null, e && this.fromJSON(e);
978
997
  }
979
- getByName(e) {
980
- if (!e) return null;
981
- let t = this._getState();
982
- if (!t) return null;
983
- let n = e.toUpperCase(), r = t.modules, i = Object.keys(r), a = i.length;
984
- for (let e = 0; e < a; e++) {
985
- let t = i[e];
986
- if (n === t.toUpperCase()) return r[t];
987
- }
988
- return null;
998
+ _getItems() {
999
+ return this._items ??= Array.from(this._byId.values());
989
1000
  }
990
1001
  getCount() {
991
- let e = this._getState();
992
- return e ? Object.keys(e.modules).length : 0;
993
- }
994
- beginCommit(e) {
995
- return this._beginCommit(e);
996
- }
997
- _getState() {
998
- if (this._closed) throw Error(u("error.model.modelClosed"));
999
- return this._transactions.getState(this._stateId);
1000
- }
1001
- _beginCommit(e) {
1002
- return this._transactions.beginCommit(typeof e == "string" ? { description: e } : e);
1002
+ return this._byId.size;
1003
1003
  }
1004
- _updateState(e, t = _("op.update"), n) {
1005
- if (!e) return;
1006
- let r = this._beginCommit(t);
1007
- try {
1008
- r.updateState(this._stateId, e), r.commit(n);
1009
- } catch (e) {
1010
- throw r.rollback(), e;
1011
- }
1012
- }
1013
- _initState(e) {
1014
- let t = e ?? {};
1015
- this._updateState({ modules: t }, _("op.initialize"), { forceAmend: !0 });
1016
- let n = this._options.onAdd;
1004
+ add(e) {
1005
+ let t = typeof e == "string" ? { displayName: e } : e, n = t.id;
1017
1006
  if (n) {
1018
- let e = Object.keys(t), r = e.length;
1019
- for (let i = 0; i < r; i++) {
1020
- let r = e[i];
1021
- n(r, t[r]);
1022
- }
1007
+ let e = this._byId.get(n);
1008
+ if (e) return e;
1009
+ }
1010
+ let r = t.displayName ?? "";
1011
+ if (!n) {
1012
+ let e = this._byDisplayName.get(r);
1013
+ if (e) return e;
1023
1014
  }
1015
+ let i = new Ut({
1016
+ ...t,
1017
+ displayName: r,
1018
+ id: n ?? v.uuidV4().toUpperCase()
1019
+ }, (e) => this._remove(e));
1020
+ return this._byId.set(i.getId(), i), r && !this._byDisplayName.has(r) && this._byDisplayName.set(r, i), this._items = null, this._notifyCollectionChange(), i;
1021
+ }
1022
+ getById(e) {
1023
+ return typeof e == "string" ? this._byId.get(e) ?? null : null;
1024
+ }
1025
+ getByDisplayName(e) {
1026
+ return typeof e == "string" ? this._byDisplayName.get(e) ?? null : null;
1027
+ }
1028
+ getCurrent() {
1029
+ return this._current ??= this.add("Author");
1030
+ }
1031
+ setCurrent(e) {
1032
+ if (e !== null) {
1033
+ if (typeof e == "object" && e.isIPerson) {
1034
+ let t = e;
1035
+ this._current = this.getById(t.getId()) ?? this.add(t.toJSON());
1036
+ return;
1037
+ }
1038
+ this._current = this.add(e);
1039
+ } else this._current = null;
1024
1040
  }
1025
- addListeners(e, t) {
1026
- return this._emitter.addListeners(e, t);
1041
+ _remove(e) {
1042
+ 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());
1027
1043
  }
1028
1044
  toJSON() {
1029
- let e = this._getState();
1030
- if (!e) return r.EmptyArray;
1031
- let t = e.modules, n = Object.keys(t), i = n.length, a = {};
1032
- for (let e = 0; e < i; e++) {
1033
- let r = n[e];
1034
- a[r] = t[r].toJSON();
1035
- }
1036
- return a;
1037
- }
1038
- isClosed() {
1039
- return this._closed;
1045
+ return this._byId.size === 0 ? null : this._getItems().map((e) => e.toJSON());
1040
1046
  }
1041
- close() {
1042
- this._closed || (this._emitter.notify("onClose"), this._closed = !0, this._transactionsRemoveListener?.());
1047
+ fromJSON(e) {
1048
+ if (!e) return;
1049
+ let t = e.length;
1050
+ for (let n = 0; n < t; n++) {
1051
+ let t = e[n];
1052
+ t && typeof t.id == "string" && this.add(t);
1053
+ }
1043
1054
  }
1044
- get isFunctionCollection() {
1055
+ get isIPersonCollection() {
1045
1056
  return !0;
1046
1057
  }
1047
- }, jt = class {
1058
+ }, Gt = class {
1048
1059
  constructor(e) {
1049
- this._options = e, this._emitter = new x(this), this._initState();
1060
+ this._options = e, this._emitter = new L(this), this._initState();
1050
1061
  }
1051
1062
  _initState() {}
1052
1063
  getModules() {
@@ -1055,26 +1066,26 @@ var Ot = class {
1055
1066
  _builtInNames() {
1056
1067
  try {
1057
1068
  let e = this._options.getBuiltInFunctions?.();
1058
- if (!e) return r.EmptyArray;
1069
+ if (!e) return v.EmptyArray;
1059
1070
  let t = [];
1060
1071
  for (let n of e.getItems()) n.isBuiltIn() && t.push(n.getName());
1061
1072
  return t;
1062
1073
  } catch {
1063
- return r.EmptyArray;
1074
+ return v.EmptyArray;
1064
1075
  }
1065
1076
  }
1066
1077
  async createModule(e) {
1067
- let t = await (await import("./BNuoKAzs4zkxSocG2.js").then((e) => e.t)).ScriptCompiler.compile({
1078
+ let t = await (await import("./ryzcqI-93l1HBuTe2.js").then((e) => e.n)).ScriptCompiler.compile({
1068
1079
  builtInNames: this._builtInNames(),
1069
1080
  ...e
1070
1081
  });
1071
- return t.module ? await L("scripts", t.module, e?.declarationsOnly ?? !1, t.diagnostics) : null;
1082
+ return t.module ? await A(S.DEFAULT_MODULE, t.module, e?.declarationsOnly ?? !1, t.diagnostics) : null;
1072
1083
  }
1073
1084
  addModule(e, t, n) {
1074
1085
  this._modules.add(e, t, n);
1075
1086
  }
1076
1087
  async addModuleFromJSON(e, t, n) {
1077
- let r = await L(e, t);
1088
+ let r = await A(e, t);
1078
1089
  return this.addModule(e, r, n), r;
1079
1090
  }
1080
1091
  executeMacro(e, t, n) {
@@ -1090,7 +1101,7 @@ var Ot = class {
1090
1101
  }
1091
1102
  async run(e, t) {
1092
1103
  try {
1093
- let n = typeof e == "string" ? await this.createModule({ source: e }) : await L("scripts", e), r = typeof e == "string" ? e : e?.source ?? "";
1104
+ let n = typeof e == "string" ? await this.createModule({ source: e }) : await A(S.DEFAULT_MODULE, e), r = typeof e == "string" ? e : e?.source ?? "";
1094
1105
  return await this._runModule(n, r, t);
1095
1106
  } catch (e) {
1096
1107
  return {
@@ -1155,53 +1166,53 @@ var Ot = class {
1155
1166
  async searchFunctions(e) {
1156
1167
  await this._emitter.notify("onBeforeSearch", { async: !0 });
1157
1168
  let t = await this._searchable(e);
1158
- if (t.length === 0) return r.EmptyArray;
1159
- let n, i = e?.limit, a = i === void 0 ? e : {
1169
+ if (t.length === 0) return v.EmptyArray;
1170
+ let n, r = e?.limit, i = r === void 0 ? e : {
1160
1171
  ...e,
1161
1172
  limit: void 0
1162
- }, o = /* @__PURE__ */ new Set();
1173
+ }, a = /* @__PURE__ */ new Set();
1163
1174
  for (let e = 0; e < t.length; e++) {
1164
- let r = await t[e].search(a);
1175
+ let r = await t[e].search(i);
1165
1176
  if (r.length !== 0) {
1166
1177
  n ||= [];
1167
1178
  for (let e = 0; e < r.length; e++) {
1168
1179
  let t = r[e], i = t.getName().toUpperCase();
1169
- o.has(i) || (o.add(i), n.push(t));
1180
+ a.has(i) || (a.add(i), n.push(t));
1170
1181
  }
1171
1182
  }
1172
1183
  }
1173
- if (!n || n.length === 0) return r.EmptyArray;
1174
- let s = e?.text ? e.text.trim().toUpperCase() : null;
1175
- return s && t.length > 1 && He(n, s), i !== void 0 && n.length > i ? n.slice(0, i) : n;
1184
+ if (!n || n.length === 0) return v.EmptyArray;
1185
+ let o = e?.text ? e.text.trim().toUpperCase() : null;
1186
+ return o && t.length > 1 && Fe(n, o), r !== void 0 && n.length > r ? n.slice(0, r) : n;
1176
1187
  }
1177
1188
  async getFunctionCategories(e) {
1178
1189
  await this._emitter.notify("onBeforeSearch", { async: !0 });
1179
1190
  let t = await this._searchable(e);
1180
- if (t.length === 0) return r.EmptyArray;
1191
+ if (t.length === 0) return v.EmptyArray;
1181
1192
  if (t.length === 1) return t[0].getCategories(e);
1182
- let n = e?.includeDeprecated ?? !1, i = /* @__PURE__ */ new Map(), a = (e) => {
1183
- let t = e.toUpperCase(), n = i.get(t);
1184
- n ? n.count++ : i.set(t, {
1193
+ let n = e?.includeDeprecated ?? !1, r = /* @__PURE__ */ new Map(), i = (e) => {
1194
+ let t = e.toUpperCase(), n = r.get(t);
1195
+ n ? n.count++ : r.set(t, {
1185
1196
  name: e,
1186
1197
  count: 1
1187
1198
  });
1188
1199
  };
1189
- for (let n of await t[0].getCategories(e)) i.set(n.name.toUpperCase(), {
1200
+ for (let n of await t[0].getCategories(e)) r.set(n.name.toUpperCase(), {
1190
1201
  name: n.name,
1191
1202
  count: n.count
1192
1203
  });
1193
1204
  for (let r = 1; r < t.length; r++) {
1194
- let i = await t[r].search(e?.type ? { type: e.type } : void 0);
1195
- for (let e = 0; e < i.length; e++) {
1196
- let o = i[e], s = o.getName().toUpperCase(), c = !1;
1205
+ let a = await t[r].search(e?.type ? { type: e.type } : void 0);
1206
+ for (let e = 0; e < a.length; e++) {
1207
+ let o = a[e], s = o.getName().toUpperCase(), c = !1;
1197
1208
  for (let e = 0; e < r && !c; e++) c = !!t[e].getByName(s);
1198
1209
  if (c) continue;
1199
1210
  let l = await o.getDescriptor().catch(() => null);
1200
- !n && l?.isDeprecated() || a(l?.getCategory() ?? "Uncategorized");
1211
+ !n && l?.isDeprecated() || i(l?.getCategory() ?? "Uncategorized");
1201
1212
  }
1202
1213
  }
1203
- let o = Array.from(i.values());
1204
- return o.sort((e, t) => e.name.localeCompare(t.name)), o;
1214
+ let a = Array.from(r.values());
1215
+ return a.sort((e, t) => e.name.localeCompare(t.name)), a;
1205
1216
  }
1206
1217
  async start() {
1207
1218
  if (!this._modules) return this._startPromise || (this._startPromise = this._doStart(), this._startPromise.catch(() => {
@@ -1211,37 +1222,38 @@ var Ot = class {
1211
1222
  async _doStart() {
1212
1223
  let e = this._options?.workbook, t = this._options?.json, n = {};
1213
1224
  if (t) {
1214
- let e = Object.keys(t);
1215
- for (let r = 0; r < e.length; r++) {
1216
- let i = e[r], a = t[i];
1225
+ let r = Object.keys(t);
1226
+ for (let i = 0; i < r.length; i++) {
1227
+ let a = r[i], o = t[a];
1217
1228
  try {
1218
- n[i] = await L(i, a);
1229
+ n[a] = await A(a, o, !1, [], o?.scope === "workbook" ? e : null);
1219
1230
  } catch (e) {
1220
- l.error(`Could not load script '${i}'; it will be unavailable.`, e);
1231
+ c.error(`Could not load script '${a}'; it will be unavailable.`, e);
1221
1232
  }
1222
1233
  }
1223
1234
  }
1224
- let i = this, a = new At({
1235
+ let r = this, i = new ce({
1225
1236
  transactions: this._options?.transactions,
1226
1237
  initial: n,
1238
+ isReadOnly: () => r.isReadOnly(),
1227
1239
  onRemove: (e, t) => {
1228
- i._options?.onRemove?.(e, t);
1240
+ r._options?.onRemove?.(e, t);
1229
1241
  },
1230
1242
  onAdd: (e, t) => {
1231
- i._emitter.notify("onChange"), i._options?.onAdd?.(e, t);
1243
+ r._emitter.notify("onChange"), r._options?.onAdd?.(e, t);
1232
1244
  }
1233
1245
  });
1234
- this._modules = a;
1235
- let o = a.getItems();
1236
- if (o.length === 0) return Promise.resolve(r.EmptyArray);
1237
- let s = o.length;
1238
- for (let t = 0; t < s; t++) {
1239
- let n = o[t];
1246
+ this._modules = i;
1247
+ let a = i.getItems();
1248
+ if (a.length === 0) return Promise.resolve(v.EmptyArray);
1249
+ let o = a.length;
1250
+ for (let t = 0; t < o; t++) {
1251
+ let n = a[t];
1240
1252
  try {
1241
1253
  let t = await n.getFunctions().search({ type: "autoRun" }), r = t.length;
1242
1254
  for (let n = 0; n < r; n++) await t[n].execute(e);
1243
1255
  } catch (e) {
1244
- l.error("Error executing autoRun script:", e);
1256
+ c.error("Error executing autoRun script:", e);
1245
1257
  }
1246
1258
  }
1247
1259
  }
@@ -1249,7 +1261,7 @@ var Ot = class {
1249
1261
  return this._emitter.addListeners(e, t);
1250
1262
  }
1251
1263
  isReadOnly() {
1252
- return !1 === this._options.workbook?.getProtection().isStructureAllowed();
1264
+ return this._options.workbook?._isStructureProtected?.() ?? !1;
1253
1265
  }
1254
1266
  toJSON() {
1255
1267
  this._emitter.notify("onBeforeSave");
@@ -1257,11 +1269,15 @@ var Ot = class {
1257
1269
  if (!e) throw Error("Scripts is initializing.");
1258
1270
  return e.toJSON();
1259
1271
  }
1260
- }, Mt = class {
1272
+ get isIScript() {
1273
+ return !0;
1274
+ }
1275
+ }, Kt = class {
1261
1276
  constructor(e, t, n, r) {
1262
- this._mergedReading = [], this._colsReading = [], this._rowsReading = [], this._styles = n, this._topLeft = t ?? f.EmptyCell, this._sheet = new E({
1277
+ this._mergedReading = [], this._colsReading = [], this._rowsReading = [], this._styles = n, this._topLeft = t ?? m.EmptyCell, this._sheet = new y({
1263
1278
  runtime: e,
1264
1279
  styles: this._styles,
1280
+ calcOnLoad: "none",
1265
1281
  container: {
1266
1282
  getName: () => r,
1267
1283
  getIndex: () => 1
@@ -1279,35 +1295,35 @@ var Ot = class {
1279
1295
  e.includes(r) && delete i[r];
1280
1296
  }
1281
1297
  }
1282
- let a = ze(i.fontFamily);
1298
+ let a = ne(i.fontFamily);
1283
1299
  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;
1284
- let o = Ie(i.textDecoration);
1285
- r.font.underline = o.underline, r.font.strike = o.strike, i.textUnderlineStyle && (r.font.underline = w(i.textUnderlineStyle)), r.alignment = {}, i?.textAlign && (r.alignment.horizontal = ue(i.textAlign)), i?.textAlign && !r.alignment.horizontal && i?.textAlign !== "general" && (i.textAlign === "center-across" ? r.alignment.horizontal = I.HorizontalAlignment.CenterContinuous : i.textAlign === "fill" ? r.alignment.horizontal = I.HorizontalAlignment.Fill : i.textAlign === "121" || i.textAlign === "010" ? (r.alignment.horizontal = I.HorizontalAlignment.Distributed, r.alignment.justifyLastLine = i.textAlign === "121") : console.warn("unknown text-align", i.textAlign)), i.verticalAlign && (i.verticalAlign.toLowerCase() === "super" ? r.font.verticalAlign = k.VerticalAlignment.Super : i.verticalAlign.toLowerCase() === "sup" ? r.font.verticalAlign = k.VerticalAlignment.Sub : r.alignment.vertical = Ve(i.verticalAlign), r.alignment.vertical || (i.verticalAlign === "121" ? r.alignment.vertical = I.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" ? I.Overflow.Visible : I.Overflow.Wrap), i.msoTextControl === "shrinktofit" && (r.alignment.overflow = I.Overflow.Shrink);
1300
+ let o = We(i.textDecoration);
1301
+ r.font.underline = o.underline, r.font.strike = o.strike, i.textUnderlineStyle && (r.font.underline = Ie(i.textUnderlineStyle)), r.alignment = {}, i?.textAlign && (r.alignment.horizontal = Qe(i.textAlign)), i?.textAlign && !r.alignment.horizontal && i?.textAlign !== "general" && (i.textAlign === "center-across" ? r.alignment.horizontal = M.HorizontalAlignment.CenterContinuous : i.textAlign === "fill" ? r.alignment.horizontal = M.HorizontalAlignment.Fill : i.textAlign === "121" || i.textAlign === "010" ? (r.alignment.horizontal = M.HorizontalAlignment.Distributed, r.alignment.justifyLastLine = i.textAlign === "121") : console.warn("unknown text-align", i.textAlign)), i.verticalAlign && (i.verticalAlign.toLowerCase() === "super" ? r.font.verticalAlign = P.VerticalAlignment.Super : i.verticalAlign.toLowerCase() === "sup" ? r.font.verticalAlign = P.VerticalAlignment.Sub : r.alignment.vertical = be(i.verticalAlign), r.alignment.vertical || (i.verticalAlign === "121" ? r.alignment.vertical = M.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" ? M.Overflow.Visible : M.Overflow.Wrap), i.msoTextControl === "shrinktofit" && (r.alignment.overflow = M.Overflow.Shrink);
1286
1302
  let s = null;
1287
1303
  if (i.background ? s = i.background : i.backgroundColor && (s = i.backgroundColor), s && (r.fill = { color: s }), i.msoPattern) {
1288
- let e = ve(i.msoPattern);
1289
- e && (e.patternType === Ce.BuiltInSheetPattern.Solid ? r.fill = { color: e.foreground } : e.patternType !== Ce.BuiltInSheetPattern.None && (s && (e.background = s), r.fill = e));
1304
+ let e = $e(i.msoPattern);
1305
+ e && (e.patternType === pe.BuiltInSheetPattern.Solid ? r.fill = { color: e.foreground } : e.patternType !== pe.BuiltInSheetPattern.None && (s && (e.background = s), r.fill = e));
1290
1306
  }
1291
- i.msoRotate !== void 0 && (r.alignment.rotation = se(i.msoRotate));
1307
+ i.layoutFlow === "vertical" || i.layoutFlow === "vertical-ideographic" ? r.alignment.stacked = !0 : i.msoRotate !== void 0 && (r.alignment.rotation = me(i.msoRotate));
1292
1308
  let c = (e, t) => {
1293
- e && (r.border ||= {}, r.border[e] = t);
1309
+ e && (r.borders ||= {}, r.borders[e] = t);
1294
1310
  };
1295
1311
  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);
1296
1312
  let l = r.numberFormat;
1297
- i.msoNumberFormat && (l = ce(i.msoNumberFormat), l.includes("\\") ? l = null : l === "Fixed" ? l = O.Styles.lookupStyle(r.numberFormat).formatType === O.Type.Number ? null : O.Type.Number : l === "Percent" && (l = O.Styles.lookupStyle(r.numberFormat).formatType === O.Type.Percentage ? null : O.Type.Percentage)), l && (r.numberFormat = l), e.style = this._styles.normalize(r), n && Object.keys(e.style).length === 0 && delete e.style;
1313
+ i.msoNumberFormat && (l = Ne(i.msoNumberFormat), l.includes("\\") ? l = null : l === "Fixed" ? l = I.Styles.lookupStyle(r.numberFormat).formatType === I.Type.Number ? null : I.Type.Number : l === "Percent" && (l = I.Styles.lookupStyle(r.numberFormat).formatType === I.Type.Percentage ? null : I.Type.Percentage)), l && (r.numberFormat = l), e.style = this._styles.normalize(r), n && Object.keys(e.style).length === 0 && delete e.style;
1298
1314
  }
1299
1315
  onCell(e, t, n, r, i) {
1300
1316
  let a = r(i), o = { value: t === void 0 ? n ?? "" : t };
1301
1317
  if (typeof o.value == "string" && o.value.length === 0 && (o.value = void 0), a && this.applyCSSStyle(o, a), i?.tagName.toUpperCase() === "TD") {
1302
1318
  let e = o.style, t = e?.font ?? {};
1303
- (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);
1319
+ (i.querySelectorAll("s").length > 0 || i.querySelectorAll("strike").length > 0) && (t.strike = !0), i.querySelectorAll("sub").length > 0 && (t.verticalAlign = P.VerticalAlignment.Sub), i.querySelectorAll("sup").length > 0 && (t.verticalAlign = P.VerticalAlignment.Super), (i.querySelectorAll("b").length > 0 || i.querySelectorAll("strong").length > 0) && (t.weight = 700), i.querySelectorAll("i").length > 0 && (t.style = P.Style.Italic), i.querySelectorAll("u").length > 0 && (t.underline = P.UnderlineStyle.Single), Object.keys(t).length > 0 && (e || (e = {}, o.style = e), e.font ||= t);
1304
1320
  let n = i.querySelectorAll("a");
1305
1321
  if (n.length > 0) {
1306
1322
  let e = n[0].getAttribute("href");
1307
1323
  e && (o.hyperlink = e);
1308
1324
  }
1309
1325
  }
1310
- if (!f.isSingleCell(e)) {
1326
+ if (!m.isSingleCell(e)) {
1311
1327
  let t = {
1312
1328
  rowStart: this._topLeft.rowIndex + e.rowStart,
1313
1329
  colStart: this._topLeft.colIndex + e.colStart,
@@ -1318,7 +1334,7 @@ var Ot = class {
1318
1334
  }
1319
1335
  if (o.value === void 0 && !o.style && Object.keys(o).length <= 1) return;
1320
1336
  let s = this._builder, c = this._topLeft;
1321
- if (s.pushAt(c.rowIndex + e.rowStart, c.colIndex + e.colStart, o), !f.isSingleCell(e) && a.msoIgnore) {
1337
+ if (s.pushAt(c.rowIndex + e.rowStart, c.colIndex + e.colStart, o), !m.isSingleCell(e) && a.msoIgnore) {
1322
1338
  if (a.msoIgnore.includes("colspan")) {
1323
1339
  let t = {};
1324
1340
  a && this.applyCSSStyle(t, a);
@@ -1347,8 +1363,8 @@ var Ot = class {
1347
1363
  let i = n(r);
1348
1364
  if (i.msoHeightSource !== "userset" || !r) return;
1349
1365
  let a = r.getAttribute("height") ?? i.height, o = null;
1350
- if (a && (o = j(a, this._styles.getNormal().getFont().getSize(), "px")), o === null) for (let e = 0; e < r.cells.length; e++) {
1351
- let t = r.cells[e], i = j(t.getAttribute("height") ?? n(t).height, this._styles.getNormal().getFont().getSize(), "px");
1366
+ if (a && (o = k(a, this._styles.getNormal().getFont().getSize(), "px")), o === null) for (let e = 0; e < r.cells.length; e++) {
1367
+ let t = r.cells[e], i = k(t.getAttribute("height") ?? n(t).height, this._styles.getNormal().getFont().getSize(), "px");
1352
1368
  i !== null && (o = Math.max(i, o ?? 0));
1353
1369
  }
1354
1370
  o !== null && this._rowsReading.push({
@@ -1356,19 +1372,19 @@ var Ot = class {
1356
1372
  min: this._topLeft.rowIndex + e,
1357
1373
  max: this._topLeft.rowIndex + e + t - 1
1358
1374
  },
1359
- update: { size: o * k.getDeviceScale() }
1375
+ update: { size: o * P.getDeviceScale() }
1360
1376
  });
1361
1377
  }
1362
1378
  onColumn(e, t, n, r) {
1363
1379
  let i = n(r);
1364
1380
  if (i.msoWidthSource !== "userset" || !r) return;
1365
1381
  let a = r.getAttribute("width") ?? i.width, o = null;
1366
- a && (o = j(a, this._styles.getNormal().getFont().getSize(), "px")), o !== null && this._colsReading.push({
1382
+ a && (o = k(a, this._styles.getNormal().getFont().getSize(), "px")), o !== null && this._colsReading.push({
1367
1383
  address: {
1368
1384
  min: this._topLeft.colIndex + e,
1369
1385
  max: this._topLeft.colIndex + e + t - 1
1370
1386
  },
1371
- update: { size: o * k.getDeviceScale() }
1387
+ update: { size: o * P.getDeviceScale() }
1372
1388
  });
1373
1389
  }
1374
1390
  onDone() {
@@ -1379,9 +1395,9 @@ var Ot = class {
1379
1395
  sheet() {
1380
1396
  return this._sheet;
1381
1397
  }
1382
- }, Nt = class {
1398
+ }, qt = class {
1383
1399
  constructor(e) {
1384
- if (!e) throw new o("snapshot is required.");
1400
+ if (!e) throw new r("snapshot is required.");
1385
1401
  this._snapshot = e;
1386
1402
  }
1387
1403
  getItemType() {
@@ -1411,10 +1427,10 @@ var Ot = class {
1411
1427
  get isClipboardItem() {
1412
1428
  return !0;
1413
1429
  }
1414
- }, Pt = class {
1415
- constructor(e, t, n, r, i) {
1416
- if (this._parsed = void 0, this._runtime = e, !t) throw new o("nativeItems are required.");
1417
- this._topLeft = n ?? f.EmptyCell, this._native = t, this._markOptions = Object.freeze(r ?? {}), this._styles = i;
1430
+ }, Jt = class {
1431
+ constructor(e, t, n, i, a) {
1432
+ if (this._parsed = void 0, this._runtime = e, !t) throw new r("nativeItems are required.");
1433
+ this._topLeft = n ?? m.EmptyCell, this._native = t, this._markOptions = Object.freeze(i ?? {}), this._styles = a;
1418
1434
  }
1419
1435
  getItemType() {
1420
1436
  return "range";
@@ -1455,19 +1471,17 @@ var Ot = class {
1455
1471
  async parse() {
1456
1472
  let e, t = this._native?.text, n = this._native.html;
1457
1473
  if (n === null && t && t.includes("<table")) try {
1458
- let e = new DOMParser().parseFromString(t, m.Html), r = e.querySelector("parsererror");
1459
- if (r) throw new h("Unable to parse: " + r);
1474
+ let e = new DOMParser().parseFromString(t, a.Html), r = e.querySelector("parsererror");
1475
+ if (r) throw new l("Unable to parse: " + r);
1460
1476
  n = e, t = null;
1461
1477
  } catch {
1462
1478
  console.warn("Discovered text as html table but could could not parse.");
1463
1479
  }
1464
1480
  try {
1465
- let r = new Mt(this._runtime, this._topLeft, this._styles, n ? "HTML" : "Text");
1466
- await r.sheet().getCalculation().ready(), await r.sheet().getCalculation().stop();
1467
- let i, a = await Promise.resolve(t ? we(t) : [[]]);
1468
- if (be(n, a, r) ? (e = r.sheet(), i = e.getUsedRange()) : n = null, i) return this._parsed = {
1469
- copyTo: async (e, t) => (await e.copyFrom(i, t))?.getCoords() ?? null,
1470
- getCoords: () => i.getCoords(),
1481
+ let r, i = new Kt(this._runtime, this._topLeft, this._styles, n ? "HTML" : "Text"), a = await Promise.resolve(t ? Ee(t) : [[]]);
1482
+ if (ke(n, a, i) ? (e = i.sheet(), r = e.getUsedRange()) : n = null, r) return this._parsed = {
1483
+ copyTo: async (e, t) => (await e.copyFrom(r, t))?.getCoords() ?? null,
1484
+ getCoords: () => r.getCoords(),
1471
1485
  getSource: () => e,
1472
1486
  getName: () => e.getName()
1473
1487
  }, !0;
@@ -1480,19 +1494,19 @@ var Ot = class {
1480
1494
  async copyTo(t, n) {
1481
1495
  let r = t.getSheet(), i = await e._native.image.arrayBuffer(), a = await r.getMovables().addPicture({ source: { buffer: i } }, {
1482
1496
  type: "picture",
1483
- description: _("op.copyImageFromClipboard")
1497
+ description: g("op.copyImageFromClipboard")
1484
1498
  });
1485
1499
  return r.getView().selectMovables([a]), null;
1486
1500
  },
1487
1501
  getName: () => "Image"
1488
1502
  }, !0;
1489
1503
  }
1490
- return !1;
1504
+ return this._parsed = null, !1;
1491
1505
  }
1492
1506
  get isClipboardItem() {
1493
1507
  return !0;
1494
1508
  }
1495
- }, Y = {
1509
+ }, J = {
1496
1510
  showFormulaBar: !0,
1497
1511
  showTabs: !0,
1498
1512
  tabRatio: 600,
@@ -1500,9 +1514,12 @@ var Ot = class {
1500
1514
  showVerticalScrollbar: !0,
1501
1515
  showStatusBar: !0,
1502
1516
  activeSheetId: 0
1503
- }, Ft = class {
1517
+ }, Yt = class {
1504
1518
  constructor(e) {
1505
- this._emitter = new x(this), this._state = { ...Y }, e?.json && this._fromJSON(e?.json);
1519
+ this._id = v.uuidV4(), this._emitter = new L(this), this._state = { ...J }, e?.json && this._fromJSON(e?.json);
1520
+ }
1521
+ getId() {
1522
+ return this._id;
1506
1523
  }
1507
1524
  isShowFormulaBar() {
1508
1525
  return this._state.showFormulaBar;
@@ -1554,7 +1571,7 @@ var Ot = class {
1554
1571
  let e = {}, t = Object.keys(this._state), n = t.length;
1555
1572
  for (let r = 0; r < n; r++) {
1556
1573
  let n = t[r], i = this._state[n];
1557
- i != null && i !== Y[n] && (e[n] = i);
1574
+ i != null && i !== J[n] && (e[n] = i);
1558
1575
  }
1559
1576
  return Object.keys(e).length === 0 && (e = null), e;
1560
1577
  }
@@ -1564,7 +1581,7 @@ var Ot = class {
1564
1581
  }
1565
1582
  update(e, t = !0) {
1566
1583
  this._state = {
1567
- ...Y,
1584
+ ...J,
1568
1585
  ...this._state,
1569
1586
  ...e
1570
1587
  }, t && this._emitter.notify("onViewChange");
@@ -1576,13 +1593,16 @@ var Ot = class {
1576
1593
  let e = this.toJSON();
1577
1594
  return e ? JSON.stringify(e) : "DefaultWorkbookView";
1578
1595
  }
1579
- }, It = Object.freeze({
1596
+ get isIWorkbookView() {
1597
+ return !0;
1598
+ }
1599
+ }, Xt = Object.freeze({
1580
1600
  structure: !1,
1581
1601
  windows: !1,
1582
1602
  revision: !1,
1583
1603
  password: null,
1584
1604
  revisionsPassword: null
1585
- }), Lt = class extends te {
1605
+ }), Y = class extends oe {
1586
1606
  isWindowsAllowed() {
1587
1607
  return this._isPropertyAllowed("windows");
1588
1608
  }
@@ -1592,20 +1612,19 @@ var Ot = class {
1592
1612
  isStructureAllowed() {
1593
1613
  return this._isPropertyAllowed("structure");
1594
1614
  }
1615
+ _getAllowedKey() {
1616
+ return "workbook";
1617
+ }
1595
1618
  _fromJSON(e) {
1596
1619
  this._properties = e;
1597
1620
  }
1598
1621
  _toJSON(e) {
1599
1622
  let t = this._properties;
1600
1623
  if (t) {
1601
- e = {
1602
- ...e,
1603
- ...t
1604
- };
1605
1624
  let n = Object.keys(t), r = n.length;
1606
1625
  for (let i = 0; i < r; i++) {
1607
1626
  let r = n[i], a = t[r];
1608
- a != null && a !== It[r] && (e[r] = a);
1627
+ a != null && a !== Xt[r] && (e[r] = a);
1609
1628
  }
1610
1629
  }
1611
1630
  return super._toJSON(e);
@@ -1613,62 +1632,65 @@ var Ot = class {
1613
1632
  get [Symbol.toStringTag]() {
1614
1633
  return "[WorkbookProtection]";
1615
1634
  }
1635
+ get isIWorkbookProtection() {
1636
+ return !0;
1637
+ }
1616
1638
  };
1617
1639
  function X(e) {
1618
- return u("error.workbook.invalidSheetKey", { key: e });
1640
+ return i("error.workbook.invalidSheetKey", { key: e });
1619
1641
  }
1620
- var Rt, zt, Bt = class {
1621
- constructor(e, t) {
1622
- this._add = e, this._get = t;
1642
+ var Zt, Qt, $t, en, tn = class extends Ke {
1643
+ constructor(e, t, n) {
1644
+ super(), this._add = e, this._get = t, this._addListeners = n;
1623
1645
  }
1624
1646
  add(e) {
1625
1647
  return this._add(e);
1626
1648
  }
1627
- *[Symbol.iterator]() {
1628
- yield* this.getItems();
1629
- }
1630
- getItems(e) {
1649
+ _getItems(e) {
1631
1650
  return this._get(e?.name, e?.visibility);
1632
1651
  }
1633
1652
  getByName(e) {
1634
1653
  return this._get(e)?.[0] ?? null;
1635
1654
  }
1636
- getCount() {
1637
- return this._get().length;
1655
+ addListeners(e, t) {
1656
+ return this._addListeners(e, t);
1657
+ }
1658
+ get isISheetCollection() {
1659
+ return !0;
1638
1660
  }
1639
- }, Z = /* @__PURE__ */ new RegExp(/[\\/\\*?:[\]]+/), Vt = /* @__PURE__ */ new RegExp(/\(((\d+)(?!.*\d))\)$/, "g");
1640
- function Ht(e) {
1641
- let t = u(_("workbook.defaultSheetName"), { n: e + 1 });
1661
+ }, Z = /* @__PURE__ */ new RegExp(/[\\/\\*?:[\]]+/), nn = /* @__PURE__ */ new RegExp(/\(((\d+)(?!.*\d))\)$/, "g");
1662
+ function rn(e) {
1663
+ let t = i(g("workbook.defaultSheetName"), { n: e + 1 });
1642
1664
  return t === "workbook.defaultSheetName" ? `Sheet${e + 1}` : t;
1643
1665
  }
1644
- function Ut(e, t) {
1666
+ function an(e, t) {
1645
1667
  return {
1646
- ...je,
1668
+ ...te,
1647
1669
  getSheet: () => null,
1648
- toString: () => F(e, t)
1670
+ toString: () => N(e, t)
1649
1671
  };
1650
1672
  }
1651
- function Wt(e, t = !1) {
1652
- if (!e) throw Error(u("error.workbook.sheetNameBlank"));
1673
+ function on(e, t = !1) {
1674
+ if (!e) throw Error(i("error.workbook.sheetNameBlank"));
1653
1675
  if (Z.test(e)) {
1654
1676
  if (!t) throw Error(function(e) {
1655
- return e ? u("error.workbook.sheetNameInvalidCharsNamed", { sheetName: e }) : u("error.workbook.sheetNameInvalidChars");
1677
+ return e ? i("error.workbook.sheetNameInvalidCharsNamed", { sheetName: e }) : i("error.workbook.sheetNameInvalidChars");
1656
1678
  }(e));
1657
1679
  e = e.replace(Z, "");
1658
1680
  }
1659
- if (e.length === 0) throw Error(u("error.workbook.sheetNameBlank"));
1681
+ if (e.length === 0) throw Error(i("error.workbook.sheetNameBlank"));
1660
1682
  let n = e.length;
1661
1683
  if (n > 31) {
1662
- if (!t) throw Error(u("error.workbook.sheetNameTooLong"));
1684
+ if (!t) throw Error(i("error.workbook.sheetNameTooLong"));
1663
1685
  e = e.substring(0, 31);
1664
1686
  }
1665
1687
  if (e.charAt(0) === "'" || e.charAt(n - 1) === "'") {
1666
- if (!t) throw Error(u("error.workbook.sheetNameQuotes"));
1688
+ if (!t) throw Error(i("error.workbook.sheetNameQuotes"));
1667
1689
  e = e.replace(/^'|'$/g, "");
1668
1690
  }
1669
1691
  return e;
1670
1692
  }
1671
- var Gt, Q = class e extends me {
1693
+ var sn, cn = "workbook.activeSheet", Q = class e extends ee {
1672
1694
  constructor(e, t, n, r) {
1673
1695
  super(e, t, r), this._workbook = n;
1674
1696
  }
@@ -1679,23 +1701,23 @@ var Gt, Q = class e extends me {
1679
1701
  let r = this._options;
1680
1702
  return n && (r = {
1681
1703
  ...this._options,
1682
- getOptions: M(this._options?.getOptions, n)
1704
+ getOptions: E(this._options?.getOptions, n)
1683
1705
  }), new e(t, this._internal, this._workbook, r);
1684
1706
  }
1685
1707
  _createRange(e, t) {
1686
- let n = e ? { ...e } : null, r = n ? this._workbook._getSheetRef(n.scope, R.Visibility.VeryHidden) : null;
1708
+ let n = e ? { ...e } : null, r = n ? this._workbook._getSheetRef(n.scope, F.Visibility.VeryHidden) : null;
1687
1709
  if (!r) {
1688
1710
  let e = this._workbook.getSelectedSheet();
1689
- return delete n?.scope, Ut(n, n ? {
1690
- scope: C,
1711
+ return delete n?.scope, an(n, n ? {
1712
+ scope: T,
1691
1713
  ...e.getEntireRange().getCoords()
1692
1714
  } : null);
1693
1715
  }
1694
1716
  let i = this._options;
1695
1717
  return t && (i = {
1696
1718
  ...this._options,
1697
- getOptions: M(this._options.getOptions, t)
1698
- }), new Kt(e, A(r.sheet), this._workbook, i);
1719
+ getOptions: E(this._options.getOptions, t)
1720
+ }), new ln(e, j(r.sheet), this._workbook, i);
1699
1721
  }
1700
1722
  async select(e) {
1701
1723
  let t = [], n = null, r = this.getCoords();
@@ -1719,15 +1741,15 @@ var Gt, Q = class e extends me {
1719
1741
  }
1720
1742
  getAddress(e) {
1721
1743
  let t = this._internal.getSheet(), n = t.getEntireRange().getCoords();
1722
- return Me(this.getCoords(), {
1744
+ return je(this.getCoords(), {
1723
1745
  ...n,
1724
1746
  scope: t.getName()
1725
- }, F, ee, e);
1747
+ }, N, he, e);
1726
1748
  }
1727
1749
  toString() {
1728
1750
  return this.getAddress();
1729
1751
  }
1730
- }, Kt = class e extends Ne {
1752
+ }, ln = class e extends De {
1731
1753
  constructor(e, t, n, r) {
1732
1754
  super(e, t, r), this._workbook = n;
1733
1755
  }
@@ -1735,17 +1757,17 @@ var Gt, Q = class e extends me {
1735
1757
  let n = this._options;
1736
1758
  return t && (n = {
1737
1759
  ...this._options,
1738
- getOptions: M(this._options?.getOptions, t)
1760
+ getOptions: E(this._options?.getOptions, t)
1739
1761
  }), new Q(e, this._internal, this._workbook, n);
1740
1762
  }
1741
1763
  _createRange(t, n) {
1742
1764
  let r = this._internal;
1743
- if (!t) return T(r.getSheet(), r.getSheet().getEntireCoords());
1744
- if (r.validateCoords(t), r.getSheet().isClosed()) return T(null, r.getSheet().getEntireCoords(), t);
1765
+ if (!t) return Ve(r.getSheet(), r.getSheet().getEntireCoords());
1766
+ if (r.validateCoords(t), r.getSheet().isClosed()) return Ve(null, r.getSheet().getEntireCoords(), t);
1745
1767
  let i = this._options;
1746
1768
  return n && (i = {
1747
1769
  ...this._options,
1748
- getOptions: M(this._options?.getOptions, n)
1770
+ getOptions: E(this._options?.getOptions, n)
1749
1771
  }), new e(t, this._internal, this._workbook, i);
1750
1772
  }
1751
1773
  addListener(e, t) {
@@ -1758,7 +1780,7 @@ var Gt, Q = class e extends me {
1758
1780
  }
1759
1781
  getAddress(e) {
1760
1782
  let t = this._internal.getSheet(), n = t?.getEntireRange().getCoords() ?? null;
1761
- return F(this.getCoords(), {
1783
+ return N(this.getCoords(), {
1762
1784
  ...n,
1763
1785
  scope: t.getName()
1764
1786
  });
@@ -1766,131 +1788,146 @@ var Gt, Q = class e extends me {
1766
1788
  toString() {
1767
1789
  return this.getAddress();
1768
1790
  }
1769
- }, $ = class {
1791
+ }, un = (e) => !!e && typeof e == "object" && typeof e.getOrigin == "function", dn = class {
1770
1792
  constructor(e) {
1771
- this._lastTransactionUUID = null, this._closed = !1, this._listenerOrigin = null, this._lastOriginName = null, this._initializing = !0, this._isDate1904 = !1, this._locale = null, this._localeOverrides = null;
1793
+ 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 qe(() => {
1794
+ let e = [];
1795
+ for (let t of this.getSheets()) e.push(...t.getPivotTables());
1796
+ return e;
1797
+ }), this._people = new Wt(), this._commentCollection = new Be(null, (e, t, n) => {
1798
+ let r = [];
1799
+ for (let i of this.getSheets()) r.push(...i.getComments().getItems(e ? {
1800
+ address: e,
1801
+ ignoreHidden: t,
1802
+ fullyContained: n
1803
+ } : {
1804
+ ignoreHidden: t,
1805
+ fullyContained: n
1806
+ }));
1807
+ return r;
1808
+ }, (e, t) => this.addListeners({ onSheetsChange: e.onCollectionChange ? () => {
1809
+ e.onCollectionChange(this._commentCollection);
1810
+ } : void 0 }, t)), this._restoringSheets = !1, this._isDate1904 = !1, this._codeName = null, this._updateLinks = null, this._locale = null, this._localeOverrides = null;
1772
1811
  let t = typeof e == "string" ? { origin: e } : { ...e }, n = t.origin;
1773
- this._origin = typeof n == "string" ? new z(null, { name: n }) : n ?? new z(null), delete t.origin, this._lastOriginName = this._origin.getName(), this._listenerOrigin = this._origin.addListeners({ onChange: () => {
1774
- if (this._closed) return;
1775
- let e = this._origin.getName();
1776
- e !== this._lastOriginName && (this._lastOriginName = e, this._emitter.notify("onNameChange"));
1777
- } });
1778
- let i = t.json;
1779
- delete t.json, this._transactions = t.transactions ?? new fe(), this._id = this._transactions.create(), this._ownTransactions = !t.transactions, this._emitter = new x(this, this._transactions), this._runtime = t.runtime ?? new xe("Workbook Runtime", {
1812
+ this._ownOriginProvider = !un(n), this._originProvider = un(n) ? n : new at(typeof n == "string" ? new R(null, { name: n }) : n ?? new R(null)), delete t.origin, this._bindOrigin(this._originProvider.getOrigin()), this._listenerOriginProvider = this._originProvider.addListeners({ onOriginChange: () => this._onOriginChange() });
1813
+ let r = t.json;
1814
+ delete t.json, this._transactions = t.transactions ?? new Le(), this._id = this._transactions.create(), this._ownTransactions = !t.transactions, this._emitter = new L(this, this._transactions), this._runtime = t.runtime ?? new Ae("Workbook Runtime", {
1780
1815
  isDate1904: () => this._isDate1904,
1781
- getLocale: () => this._locale ?? ie() ?? de(),
1816
+ getNow: () => this._transactions.getCurrentCommit().getTimestamp(),
1817
+ getLocale: () => this._locale ?? ye() ?? Se(),
1782
1818
  getLocaleOverrides: () => this._localeOverrides
1783
1819
  }), this._listenerLanguage = d.addChangeListener(() => {
1784
- this._locale !== null || this._closed || this._notifyAllChange();
1820
+ this._closed || this._notifyAllChange();
1785
1821
  });
1786
- let a = this, o = this._beginCommit({ description: _(i ? "op.openWorkbook" : "op.newWorkbook") });
1822
+ let i = this, a = this._beginCommit({ description: g(r ? "op.openWorkbook" : "op.newWorkbook") });
1787
1823
  try {
1788
- this._strings = t.strings ?? new ae(), this._ownStrings = !t.strings, this._externalBooks = new kt({ json: i?.externalBooks }), this._resources = t.resources ?? new b(), this._ownResources = !t.resources, this._createSheetName = t.createSheetNameCallback ?? Ht;
1824
+ this._strings = t.strings ?? new de(), this._ownStrings = !t.strings, this._resources = t.resources ?? new Xe(), this._ownResources = !t.resources, this._createSheetName = t.createSheetNameCallback ?? rn;
1789
1825
  let e = t.createSheetCallback;
1790
- e ||= (e) => new E(e), this._sheetOnNameChange = /* @__PURE__ */ new Map(), this._sheetOnVisibilityChange = /* @__PURE__ */ new Map(), this._sheetOnIndexChange = /* @__PURE__ */ new Map(), this._createSheet = (t, n, r, i, o) => {
1791
- let s = null, c = {
1792
- runtime: a._runtime,
1793
- readonly: a._options.readonly ?? !1,
1794
- disableLoadAutoFit: a._options.disableLoadAutoFit ?? !1,
1795
- formulaTransform: a._options.formulaTransform,
1796
- opener: a._options.opener,
1797
- transactions: a._transactions,
1798
- styles: a._styles,
1799
- strings: a._strings,
1800
- resources: a._resources,
1801
- names: a._names,
1802
- workbook: a,
1803
- calculation: a._calculation,
1804
- resolveRange: (e) => a._options.resolveRange?.(e) ?? a.getRange(e),
1826
+ e ||= (e) => new y(e), this._sheetOnNameChange = /* @__PURE__ */ new Map(), this._sheetOnVisibilityChange = /* @__PURE__ */ new Map(), this._sheetOnIndexChange = /* @__PURE__ */ new Map(), this._createSheet = (t, n, r, a, o, s) => {
1827
+ let c = null, l = {
1828
+ runtime: i._runtime,
1829
+ readonly: i._options.readonly ?? !1,
1830
+ disableLoadAutoFit: i._options.disableLoadAutoFit ?? !1,
1831
+ opener: i._options.opener,
1832
+ transactions: i._transactions,
1833
+ styles: i._styles,
1834
+ strings: i._strings,
1835
+ resources: i._resources,
1836
+ names: i._names,
1837
+ workbook: i,
1838
+ calculation: i._calculation,
1839
+ resolveRange: (e) => i._options.resolveRange?.(e) ?? i.getRange(e),
1805
1840
  container: {
1806
1841
  beforeFromJSON: (e) => {
1807
- s = e, a._addSheetRef({
1842
+ c = e, i._addSheetRef({
1808
1843
  name: n,
1809
1844
  id: t,
1810
- visibility: r ?? R.Visibility.Visible,
1845
+ visibility: r ?? F.Visibility.Visible,
1846
+ sheetId: o,
1811
1847
  sheet: e
1812
- }, i);
1848
+ }, a);
1813
1849
  },
1814
1850
  getName: () => {
1815
- let e = a._getSheetRef(s);
1851
+ let e = i._getSheetRef(c);
1816
1852
  return e ? e.name : n;
1817
1853
  },
1818
1854
  setName: (e, t) => {
1819
- a._getSheetRef(s) && a._setSheetName(s, e, t);
1855
+ i._getSheetRef(c) && i._setSheetName(c, e, t);
1820
1856
  },
1821
1857
  setNameChangeCallback: (e) => {
1822
- a._sheetOnNameChange.set(t, e);
1858
+ i._sheetOnNameChange.set(t, e);
1823
1859
  },
1824
1860
  getVisibility: () => {
1825
- let e = a._getSheetRef(s);
1826
- return e ? e.visibility : R.Visibility.Visible;
1861
+ let e = i._getSheetRef(c);
1862
+ return e ? e.visibility : F.Visibility.Visible;
1827
1863
  },
1828
1864
  setVisibility: (e, t) => {
1829
- a._setSheetVisibility(s, e, t);
1865
+ i._setSheetVisibility(c, e, t);
1830
1866
  },
1831
1867
  setVisibilityCallback: (e) => {
1832
- a._sheetOnVisibilityChange.set(t, e);
1868
+ i._sheetOnVisibilityChange.set(t, e);
1833
1869
  },
1834
- duplicate: () => a._duplicateSheet(s),
1870
+ duplicate: () => i._duplicateSheet(c),
1835
1871
  getIndex: () => {
1836
- let e = a._getSheetRef(s);
1837
- return e ? a._getOffsetForId(e.id, a._getSheetRefs(R.Visibility.VeryHidden)) : i;
1872
+ let e = i._getSheetRef(c);
1873
+ return e ? i._getOffsetForId(e.id, i._getSheetRefs(F.Visibility.VeryHidden)) : a;
1838
1874
  },
1839
1875
  setIndex: (e, t) => {
1840
- let n = a._getSheetRef(s, R.Visibility.VeryHidden);
1841
- return !!n && (a._moveSheet(n, e, t), !0);
1876
+ let n = i._getSheetRef(c, F.Visibility.VeryHidden);
1877
+ return !!n && (i._moveSheet(n, e, t), !0);
1842
1878
  },
1843
1879
  setIndexCallback: (e) => {
1844
- a._sheetOnIndexChange.set(t, e);
1880
+ i._sheetOnIndexChange.set(t, e);
1845
1881
  },
1846
- requestSelect: async () => (a._setSelectedSheet(s), await this._emitter.notify("onRequestSelect", {
1847
- source: a,
1848
- params: s,
1882
+ requestSelect: async () => (i._setSelectedSheet(c), await this._emitter.notify("onRequestSelect", {
1883
+ source: i,
1884
+ params: c,
1849
1885
  async: !0
1850
- }), a.getSelectedSheet() === s)
1886
+ }), i.getSelectedSheet() === c)
1851
1887
  }
1852
1888
  };
1853
- return o && (c.json = o), s = e(c, n, i, r), s;
1854
- }, this._namedTableSource = new Ee({
1855
- getSheets: () => a._sheets ? a.getSheets().getItems() : r.EmptyArray,
1856
- addSheetsListener: (e, t) => a.addListeners({ onSheetsChange: e }, t)
1857
- }), this._names = t.names ?? new pe({
1858
- addressToRanges: (e) => a.getRanges(e),
1859
- getCurrentScope: () => a.getSelectedSheet().getName(),
1860
- isReadOnly: () => a._options.readonly ?? !1,
1861
- transactions: a._transactions,
1862
- getSources: () => a._calculation ? [a._calculation.getNamedFormulas(), a._namedTableSource] : r.EmptyArray
1863
- }), this._ownNames = !t.names, this._calculation = t.calculation ?? new re({
1864
- runtime: a._runtime,
1889
+ return s && (l.json = s), c = e(l, n, a, r), c;
1890
+ }, this._namedTableSource = new Ze({
1891
+ getSheets: () => i._sheets ? i.getSheets().getItems() : v.EmptyArray,
1892
+ addSheetsListener: (e, t) => i.addListeners({ onSheetsChange: e }, t)
1893
+ }), this._names = t.names ?? new Ue({
1894
+ addressToRanges: (e) => i.getRanges(e),
1895
+ getCurrentScope: () => i.getSelectedSheet().getName(),
1896
+ isReadOnly: () => (i._options.readonly ?? !1) || i._isStructureProtected(),
1897
+ transactions: i._transactions,
1898
+ getSources: () => i._calculation ? [i._calculation.getNamedFormulas(), i._namedTableSource] : v.EmptyArray
1899
+ }), this._ownNames = !t.names, this._calculation = t.calculation ?? new Ge({
1900
+ runtime: i._runtime,
1865
1901
  functions: t.functions,
1866
- json: i?.calc,
1902
+ json: r?.calc,
1903
+ isNamesReadOnly: () => i._isStructureProtected(),
1867
1904
  getActiveCell: () => {
1868
- let e = a.getSelectedSheet(), t = e?.getSelectedRange()?.getCoords();
1905
+ let e = i.getSelectedSheet(), t = e?.getSelectedRange()?.getCoords();
1869
1906
  return t ? {
1870
1907
  rowIndex: t.rowStart,
1871
1908
  colIndex: t.colStart,
1872
1909
  scope: e.getId()
1873
1910
  } : null;
1874
1911
  },
1875
- getRange: a.getRange.bind(a),
1876
- getRanges: a.getRanges.bind(a),
1877
- createGraphRanges: (e, t) => a._createGraphRanges(e, t),
1912
+ getRange: i.getRange.bind(i),
1913
+ getRanges: i.getRanges.bind(i),
1914
+ createGraphRanges: (e, t) => i._createGraphRanges(e, t),
1878
1915
  getSheetIndex: (e) => {
1879
1916
  if (e === void 0) {
1880
- let e = a.getSelectedSheet();
1881
- return e ? this._getSheetRefs(R.Visibility.VeryHidden).findIndex((t) => t.sheet === e) : -1;
1917
+ let e = i.getSelectedSheet();
1918
+ return e ? this._getSheetRefs(F.Visibility.VeryHidden).findIndex((t) => t.sheet === e) : -1;
1882
1919
  }
1883
- let t = this._getSheetRefs(R.Visibility.VeryHidden);
1920
+ let t = this._getSheetRefs(F.Visibility.VeryHidden);
1884
1921
  e = e.toLowerCase();
1885
1922
  let n = t.length;
1886
1923
  for (let r = 0; r < n; r++) if (t[r].name.toLowerCase() === e) return r;
1887
1924
  try {
1888
- qt.address = e;
1889
- let t = this._names.getItems(qt);
1925
+ fn.address = e;
1926
+ let t = this._names.getItems(fn);
1890
1927
  if (!t || t.length === 0) return -1;
1891
1928
  let n = t[0].getRanges?.()?.getCoords()?.[0]?.scope;
1892
1929
  if (!n) return -1;
1893
- let r = this._getSheetRefs(R.Visibility.VeryHidden);
1930
+ let r = this._getSheetRefs(F.Visibility.VeryHidden);
1894
1931
  n = n.toLowerCase();
1895
1932
  let i = r.length;
1896
1933
  for (let e = 0; e < i; e++) if (r[e].name.toLowerCase() === n) return e;
@@ -1899,37 +1936,50 @@ var Gt, Q = class e extends me {
1899
1936
  }
1900
1937
  return -1;
1901
1938
  },
1902
- getSheetCount: () => a.getSheets().getItems({ visibility: R.Visibility.VeryHidden }).length,
1939
+ getSheetCount: () => i.getSheets().getItems({ visibility: F.Visibility.VeryHidden }).length,
1940
+ getSheetIds: () => i._sheets?.getItems({ visibility: F.Visibility.VeryHidden }).map((e) => e.getId()) ?? [],
1941
+ addSheetsListener: (e, t) => i.addListeners({ onSheetsChange: () => {
1942
+ i._restoringSheets || e();
1943
+ } }, t),
1903
1944
  getSheetById: (e) => {
1904
- let t = a.getSheets().getItems({ visibility: R.Visibility.VeryHidden }), n = t.length;
1945
+ let t = i.getSheets().getItems({ visibility: F.Visibility.VeryHidden }), n = t.length;
1905
1946
  for (let r = 0; r < n; r++) if (t[r].getId() === e) return t[r];
1906
1947
  return null;
1907
1948
  },
1908
- getSheetByName: (e) => {
1909
- try {
1910
- return a.getSheets().getByName(e) ?? null;
1911
- } catch {
1912
- return null;
1913
- }
1914
- },
1915
- namedCollection: a._names,
1916
- strings: a._strings,
1917
- transactions: a._transactions,
1918
- names: i?.names,
1919
- formulaTransform: t.formulaTransform
1920
- }), this._ownCalculation = !t.calculation, this._scripts = this._createScripts(), this._ownNames = !t.names, this._options = Object.freeze({ ...t });
1921
- let n = async () => {
1922
- this._ownCalculation && await this._calculation.start(), await this._scripts.start(), this._starting = null;
1923
- };
1924
- this._starting = n(), this._starting?.catch(() => {}), i ? this._fromJSON(i) : (this._initState(), this._addSheet(!1)), this._sheets = new Bt((e) => a._addSheetOptions(e), (e, t) => {
1949
+ externalBooks: r?.externalBooks,
1950
+ externalBookResolver: t.externalBookResolver,
1951
+ namedCollection: i._names,
1952
+ strings: i._strings,
1953
+ transactions: i._transactions,
1954
+ names: r?.names
1955
+ }), this._ownCalculation = !t.calculation, this._scripts = this._createScripts(r?.modules), this._ownNames = !t.names, this._options = Object.freeze({ ...t });
1956
+ let n = t.calcOnLoad ?? "auto", o = !1, s = (async () => {
1957
+ try {
1958
+ if (this._ownCalculation && n !== "none" && (n === "full" || n === "auto" && !0 === r?.calc?.fullCalcOnLoad ? await this._calculation.calculate({ full: !0 }) : await this._calculation.start(), this._closed)) return;
1959
+ await this._scripts.start();
1960
+ } finally {
1961
+ o = !0, this._starting = null;
1962
+ }
1963
+ })();
1964
+ o || (this._starting = s), this._starting?.catch(() => {}), r ? this._fromJSON(r) : (this._initState(), this._addSheet(!1)), this._sheets = new tn((e) => i._addSheetOptions(e), (e, t) => {
1925
1965
  if (e) {
1926
1966
  let n = this._getSheetRef(e, t);
1927
- return n ? [n.sheet] : r.EmptyArray;
1967
+ return n ? [n.sheet] : v.EmptyArray;
1928
1968
  }
1929
1969
  return this._getSheets(t);
1930
- }), this._ownCalculation && this._calculation.hydrateNames(), this._emitter.notify("onLoad"), o.commit({ forceAmend: this._ownTransactions });
1970
+ }, (e, t) => {
1971
+ let n = e.onCollectionChange, r = e.onInvalidated;
1972
+ return i._emitter.addListeners({
1973
+ onSheetsChange: n ? () => {
1974
+ n(i._sheets);
1975
+ } : void 0,
1976
+ onInvalidated: r ? () => {
1977
+ r(i._sheets);
1978
+ } : void 0
1979
+ }, t);
1980
+ }), this._ownCalculation && (t.calcOnLoad ?? "auto") !== "none" && this._calculation.hydrateNames(), this._emitter.notify("onLoad"), this._ownTransactions ? a.amend() : a.commit();
1931
1981
  } catch (e) {
1932
- throw o.rollback(), e;
1982
+ throw a.rollback(), e;
1933
1983
  }
1934
1984
  this._initializing = !1;
1935
1985
  }
@@ -1937,22 +1987,22 @@ var Gt, Q = class e extends me {
1937
1987
  let e = this._getSheetRefs();
1938
1988
  for (let t = (e ? e.length : 0) - 1; t >= 0; t--);
1939
1989
  let t = this._options;
1940
- this._isDate1904 = t.runtime?.isDate1904() ?? !1, this._locale = null, this._localeOverrides = null, this._theme = t.theme ?? new Te().getDefaultTheme(), this._styles = t?.styles ?? new Oe(this._theme), this._ownStyles = !t.styles, this._styles.getTheme() || this._styles.setTheme(this.getTheme()), this._activeSheetOffset = 0, this.setView(new Ft()), this._listenerProtection?.(), this._protection = new Lt(void 0, this._options.readonly ?? !1), this._listenerProtection = this._protection.addListeners({ onChange: (e) => {
1990
+ this._isDate1904 = t.runtime?.isDate1904() ?? !1, this._locale = null, this._localeOverrides = null, this._theme = t.theme ?? new we().getDefaultTheme(), this._styles = t?.styles ?? new _e(this._theme), this._ownStyles = !t.styles, this._styles.getTheme() || this._styles.setTheme(this.getTheme()), this._activeSheetOffset = 0, this.setView(new Yt()), this._listenerProtection?.(), this._protection = new Y(void 0, this._options.readonly ?? !1), this._listenerProtection = this._protection.addListeners({ onChange: (e) => {
1941
1991
  n._emitter.notify("onProtectionChange");
1942
1992
  } });
1943
1993
  let n = this;
1944
1994
  this._transactionsRemoveListener = this._transactions.addStateListener(this._id, {
1945
- async onAfterStateChange(e, t, r) {
1946
- 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) {
1947
- let r = n.getView().getActiveSheetId();
1948
- t.view === n.getView() && (r = t.activeSheetId);
1949
- let i = 0;
1995
+ async onAfterStateChange(e, t, r, i, a) {
1996
+ let o = n._view, s = a?.[cn], 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;
1997
+ if (d ? await d.sheet.select() : n._resyncActiveSheet(u, e), n._lastTransactionUUID = t.getId(), r || i) {
1998
+ n._restoringSheets = !0;
1950
1999
  try {
1951
- i = n._getOffsetForId(r, e.sheetRefsVisible);
1952
- } catch {}
1953
- n._adjustRemoveSelectionIfRequired(i, r);
2000
+ n._emitter.notify("onSheetsChange");
2001
+ } finally {
2002
+ n._restoringSheets = !1;
2003
+ }
1954
2004
  }
1955
- n._lastTransactionUUID = r.getId(), n._notifyAllChange();
2005
+ n._emitter.notify("onSelectedSheetChange"), n._emitter.notify("onViewChange");
1956
2006
  },
1957
2007
  onRestoreOrRevert() {
1958
2008
  n._ownCalculation, n._emitter.notify("onInvalidated");
@@ -1985,14 +2035,29 @@ var Gt, Q = class e extends me {
1985
2035
  return this._closed ? null : this._origin.getName();
1986
2036
  }
1987
2037
  getOrigin() {
1988
- return this._origin;
2038
+ return this._originProvider.getOrigin();
2039
+ }
2040
+ _onOriginChange() {
2041
+ if (this._closed) return;
2042
+ let e = this._originProvider.getOrigin();
2043
+ if (e === this._origin) return;
2044
+ this._listenerOrigin?.();
2045
+ let t = this._lastOriginName;
2046
+ this._bindOrigin(e), this._emitter.notify("onOriginChange"), this._lastOriginName !== t && this._emitter.notify("onNameChange");
2047
+ }
2048
+ _bindOrigin(e) {
2049
+ this._origin = e, this._lastOriginName = e.getName(), this._listenerOrigin = e.addListeners({ onChange: () => {
2050
+ if (this._closed) return;
2051
+ let t = e.getName();
2052
+ t !== this._lastOriginName && (this._lastOriginName = t, this._emitter.notify("onNameChange"));
2053
+ } });
1989
2054
  }
1990
2055
  getView() {
1991
2056
  return this._view;
1992
2057
  }
1993
2058
  setView(e) {
1994
- if (this._closed) throw Error(u("error.workbook.modelClosed"));
1995
- if (!e) throw new h(u("error.sheet.emptyView"));
2059
+ if (this._closed) throw Error(i("error.workbook.modelClosed"));
2060
+ if (!e) throw new l(i("error.sheet.emptyView"));
1996
2061
  this._listenerWorkbookView?.();
1997
2062
  let t = this, n = -1;
1998
2063
  return this._listenerWorkbookView = e.addListeners({ onViewChange: (e) => {
@@ -2004,8 +2069,8 @@ var Gt, Q = class e extends me {
2004
2069
  return this._runtime;
2005
2070
  }
2006
2071
  setDate1904(e) {
2007
- if (this._closed) throw Error(u("error.workbook.modelClosed"));
2008
- return this._isDate1904 = e, this._notifyAllChange(), this;
2072
+ if (this._closed) throw Error(i("error.workbook.modelClosed"));
2073
+ return this._isDate1904 === e || (this._isDate1904 = e, this._emitter.notify("onRegionalChange")), this;
2009
2074
  }
2010
2075
  getLocale() {
2011
2076
  return this._runtime.getLocale();
@@ -2014,21 +2079,21 @@ var Gt, Q = class e extends me {
2014
2079
  return this._locale;
2015
2080
  }
2016
2081
  setLocale(e) {
2017
- if (this._closed) throw Error(u("error.workbook.modelClosed"));
2082
+ if (this._closed) throw Error(i("error.workbook.modelClosed"));
2018
2083
  if (e) try {
2019
2084
  new Intl.Locale(e);
2020
2085
  } catch {
2021
- throw Error(u("error.workbook.invalidLocale", { locale: e }));
2086
+ throw Error(i("error.workbook.invalidLocale", { locale: e }));
2022
2087
  }
2023
- return this._locale === e || (this._locale = e, this._notifyAllChange()), this;
2088
+ return this._locale === e || (this._locale = e, this._emitter.notify("onRegionalChange")), this;
2024
2089
  }
2025
2090
  getLocaleOverrides() {
2026
2091
  return this._localeOverrides;
2027
2092
  }
2028
2093
  setLocaleOverrides(e) {
2029
- if (this._closed) throw Error(u("error.workbook.modelClosed"));
2094
+ if (this._closed) throw Error(i("error.workbook.modelClosed"));
2030
2095
  let t = e && Object.keys(e).length > 0 ? e : null;
2031
- return this._localeOverrides = t, this._notifyAllChange(), this;
2096
+ return this._localeOverrides = t, this._emitter.notify("onRegionalChange"), this;
2032
2097
  }
2033
2098
  getStyles() {
2034
2099
  return this._styles;
@@ -2043,14 +2108,30 @@ var Gt, Q = class e extends me {
2043
2108
  return this._strings;
2044
2109
  }
2045
2110
  getExternalBooks() {
2046
- return this._externalBooks;
2111
+ return this._calculation.getExternalBooks();
2112
+ }
2113
+ getUpdateLinks() {
2114
+ return this._updateLinks;
2115
+ }
2116
+ setUpdateLinks(e) {
2117
+ if (this._closed) throw Error(i("error.workbook.modelClosed"));
2118
+ return this._updateLinks = e, this;
2119
+ }
2120
+ getPivotTables() {
2121
+ return this._pivotTableCollection;
2122
+ }
2123
+ getComments() {
2124
+ return this._commentCollection;
2125
+ }
2126
+ getPeople() {
2127
+ return this._people;
2047
2128
  }
2048
2129
  getTheme() {
2049
2130
  return this._theme;
2050
2131
  }
2051
2132
  setTheme(e) {
2052
- if (this._closed) throw Error(u("error.workbook.modelClosed"));
2053
- if (!e) throw new h(u("error.workbook.notSetValue"));
2133
+ if (this._closed) throw Error(i("error.workbook.modelClosed"));
2134
+ if (!e) throw new l(i("error.workbook.notSetValue"));
2054
2135
  let t = this._theme;
2055
2136
  return this._theme = e, this.getStyles().setTheme(e), this._emitter.notify("onThemeChange"), t;
2056
2137
  }
@@ -2061,17 +2142,17 @@ var Gt, Q = class e extends me {
2061
2142
  let e = this._getSheetRef(this.getSelectedSheetIndex());
2062
2143
  return e ? e?.sheet : null;
2063
2144
  }
2064
- getSheet(e, t = R.Visibility.Visible) {
2145
+ getSheet(e, t = F.Visibility.Visible) {
2065
2146
  if (e === void 0) return this.getSelectedSheet();
2066
- if (!e) throw Error(u("error.workbook.sheetNameNotProvided"));
2147
+ if (!e) throw Error(i("error.workbook.sheetNameNotProvided"));
2067
2148
  let n = this._getSheetRef(e, t);
2068
- if (!n) throw new i(u("error.workbook.sheetNameNotFound", { sheetName: e }));
2149
+ if (!n) throw new h(i("error.workbook.sheetNameNotFound", { sheetName: e }));
2069
2150
  return n.sheet;
2070
2151
  }
2071
- getSheetAt(e, t = R.Visibility.Visible) {
2152
+ getSheetAt(e, t = F.Visibility.Visible) {
2072
2153
  let n = this._getSheetRef(e, t);
2073
- if (!n) throw new i(function(e) {
2074
- return u("error.workbook.sheetIndexNotFound", { index: e });
2154
+ if (!n) throw new h(function(e) {
2155
+ return i("error.workbook.sheetIndexNotFound", { index: e });
2075
2156
  }(e));
2076
2157
  return n.sheet;
2077
2158
  }
@@ -2081,32 +2162,32 @@ var Gt, Q = class e extends me {
2081
2162
  addSheet(e) {
2082
2163
  return this.getSheets().add(e);
2083
2164
  }
2084
- _getSheets(e = R.Visibility.Visible) {
2165
+ _getSheets(e = F.Visibility.Visible) {
2085
2166
  let t = this._getSheetRefs(e), n = [], r = t.length;
2086
2167
  for (let e = 0; e < r; e++) n.push(t[e].sheet);
2087
2168
  return n;
2088
2169
  }
2089
- _getSheetRefs(e = R.Visibility.Visible) {
2170
+ _getSheetRefs(e = F.Visibility.Visible) {
2090
2171
  let t = this._getState();
2091
- return t ? e === R.Visibility.Visible ? t.sheetRefsVisible : e === R.Visibility.Hidden ? t.sheetRefsVisibleAndHidden : e === R.Visibility.VeryHidden ? t.sheetRefsAll : r.EmptyArray : [];
2172
+ return t ? e === F.Visibility.Visible ? t.sheetRefsVisible : e === F.Visibility.Hidden ? t.sheetRefsVisibleAndHidden : e === F.Visibility.VeryHidden ? t.sheetRefsAll : v.EmptyArray : [];
2092
2173
  }
2093
- _getSheetRef(e, t = R.Visibility.Visible) {
2174
+ _getSheetRef(e, t = F.Visibility.Visible) {
2094
2175
  let n = null;
2095
- return typeof e == "number" ? this._getSheetRefs(t)[e] : (typeof e == "string" ? n = this._getState().refsByLowerCaseName.get(e.toLowerCase()) : e instanceof E ? n = this._getState().refsByInstance.get(e) : e?.id !== void 0 && (n = this._getState().refsById.get(e.id)), n);
2176
+ return typeof e == "number" ? this._getSheetRefs(t)[e] : (typeof e == "string" ? n = this._getState().refsByLowerCaseName.get(e.toLowerCase()) : e instanceof y ? n = this._getState().refsByInstance.get(e) : e?.id !== void 0 && (n = this._getState().refsById.get(e.id)), n);
2096
2177
  }
2097
2178
  _validateNewSheetName(e, t = !0) {
2098
2179
  if (e == null) return e;
2099
- if (Wt(e), t && this._getState().sheetsByLowerCaseName.has(e.toLowerCase())) throw new h(u("error.workbook.nameTaken"));
2180
+ if (on(e), t && this._getState().sheetsByLowerCaseName.has(e.toLowerCase())) throw new l(i("error.workbook.nameTaken"));
2100
2181
  return e.substring(0, 31);
2101
2182
  }
2102
2183
  findValidSheetName(e) {
2103
- e &&= Wt(e, !0);
2184
+ e &&= on(e, !0);
2104
2185
  try {
2105
2186
  return function(e, t) {
2106
2187
  try {
2107
2188
  if (t(e)) return e;
2108
2189
  } catch {}
2109
- let n, r, i = Vt.exec(e);
2190
+ let n, r, i = nn.exec(e);
2110
2191
  for (i === null ? (n = e + " ", r = 1) : (n = e.substring(0, i.index), r = parseFloat(i[1])); r < 256;) {
2111
2192
  r++;
2112
2193
  let e = "(" + r + ")", i = n.substring(0, 31 - e.length) + e;
@@ -2123,34 +2204,23 @@ var Gt, Q = class e extends me {
2123
2204
  isValidSheetNameCharacter(e) {
2124
2205
  return !Z.test(e);
2125
2206
  }
2207
+ _isStructureProtected() {
2208
+ return !this._initializing && !this.getProtection().isStructureAllowed();
2209
+ }
2126
2210
  _addSheetOptions(e) {
2127
- if (this._closed) throw Error(u("error.workbook.modelClosed"));
2128
- if (!this.getProtection().isStructureAllowed()) throw new h(u("error.workbook.protection"));
2211
+ if (this._closed) throw Error(i("error.workbook.modelClosed"));
2212
+ if (!this.getProtection().isStructureAllowed()) throw new o(i("error.workbook.protection"));
2129
2213
  let t, n = null;
2130
2214
  t = typeof e == "string" ? { name: e } : typeof e == "number" ? { index: e } : e, t = {
2131
2215
  ...t,
2132
- description: t?.description ?? _("op.addSheet")
2216
+ description: t?.description ?? g("op.addSheet")
2133
2217
  };
2134
2218
  let r = this.beginCommit(t);
2135
2219
  try {
2136
2220
  let e = t?.autoSelect ?? !1;
2137
2221
  n = this._addSheet(!0, t.name, t.index ?? null);
2138
- let i, a, o = this.getView().getActiveSheetId();
2139
- if (!1 !== e) {
2140
- let t = this.getView().getActiveSheetId();
2141
- t = this._getSheetRef(n).id, e && (i = {
2142
- view: this.getView(),
2143
- activeSheetId: o
2144
- }, a = {
2145
- view: this.getView(),
2146
- activeSheetId: t
2147
- });
2148
- }
2149
- if (r.commit({
2150
- description: u("op.addSheetNamed", { name: n.getName() }),
2151
- viewBefore: i,
2152
- viewAfter: a
2153
- }), !1 !== e) {
2222
+ let a = this.getView().getActiveSheetId();
2223
+ if (e && this._recordActiveSheet(r, a, this._getSheetRef(n).id), r.commit({ description: i("op.addSheetNamed", { name: n.getName() }) }), !1 !== e) {
2154
2224
  let t = typeof e == "boolean" ? void 0 : e;
2155
2225
  n.select(t);
2156
2226
  }
@@ -2161,28 +2231,28 @@ var Gt, Q = class e extends me {
2161
2231
  }
2162
2232
  _nextSheetName(e = null) {
2163
2233
  let t = e ? e.toLowerCase() : null, n = this._getState(), r = n.sheetsByLowerCaseName;
2164
- if (e && r.has(t)) throw new h(function(e) {
2165
- return u("error.workbook.nameDuplicate", { sheetName: e });
2234
+ if (e && r.has(t)) throw new l(function(e) {
2235
+ return i("error.workbook.nameDuplicate", { sheetName: e });
2166
2236
  }(e));
2167
2237
  t = (e = this._validateNewSheetName(e)) ? e.toLowerCase() : null;
2168
- let i = n.lastId + 1;
2238
+ let a = n.lastId + 1;
2169
2239
  for (; !e;) {
2170
- let t = this._createSheetName(i), n = t.toLowerCase();
2171
- r.has(n) ? i++ : e = t;
2240
+ let t = this._createSheetName(a), n = t.toLowerCase();
2241
+ r.has(n) ? a++ : e = t;
2172
2242
  }
2173
- return this._updateState({ lastId: i }), e;
2243
+ return this._updateState({ lastId: a }), e;
2174
2244
  }
2175
2245
  _addSheet(e, t = null, n = null) {
2176
2246
  t = this._nextSheetName(t);
2177
- let r = this._getState(), i = this._createSheet(r.lastId, t, R.Visibility.Visible, n, null);
2178
- if (!i) throw new h(u("error.workbook.sheetNameBlank"));
2179
- return e && this._emitter.notify("onSheetsChange"), i;
2247
+ let r = this._getState(), a = this._createSheet(r.lastId, t, F.Visibility.Visible, n, void 0, null);
2248
+ if (!a) throw new l(i("error.workbook.sheetNameBlank"));
2249
+ return e && this._emitter.notify("onSheetsChange"), a;
2180
2250
  }
2181
2251
  _updateSheetRefStates(e) {
2182
- if (this._closed) throw Error(u("error.workbook.modelClosed"));
2183
- if (!this._initializing && !this.getProtection().isStructureAllowed()) throw new h(u("error.workbook.protection"));
2184
- let t = e, n = [], r = [], i = t.length;
2185
- for (let e = 0; e < i; e++) t[e].visibility === R.Visibility.Visible ? (n.push(t[e]), r.push(t[e])) : t[e].visibility === R.Visibility.Hidden && r.push(t[e]);
2252
+ if (this._closed) throw Error(i("error.workbook.modelClosed"));
2253
+ if (!this._initializing && !this.getProtection().isStructureAllowed()) throw new o(i("error.workbook.protection"));
2254
+ let t = e, n = [], r = [], a = t.length;
2255
+ for (let e = 0; e < a; e++) t[e].visibility === F.Visibility.Visible ? (n.push(t[e]), r.push(t[e])) : t[e].visibility === F.Visibility.Hidden && r.push(t[e]);
2186
2256
  this._updateState({
2187
2257
  sheetRefsAll: t,
2188
2258
  sheetRefsVisible: n,
@@ -2190,35 +2260,35 @@ var Gt, Q = class e extends me {
2190
2260
  });
2191
2261
  }
2192
2262
  _addSheetRef(e, t = null) {
2193
- let n = this._getState(), r = n.sheetRefsAll, i = Math.max(0, Math.min(r.length, t ?? r.length)), a = [
2194
- ...r.slice(0, i),
2263
+ let n = this._getState(), r = n.sheetRefsAll, a = Math.max(0, Math.min(r.length, t ?? r.length)), o = [
2264
+ ...r.slice(0, a),
2195
2265
  e,
2196
- ...r.slice(i)
2266
+ ...r.slice(a)
2197
2267
  ];
2198
- this._updateSheetRefStates(a);
2199
- let o = e.sheet, s = e.name.toLowerCase(), c = new Map(n.refsById);
2200
- c.set(e.id, e);
2201
- let l = new Map(n.refsByLowerCaseName);
2202
- l.set(s, e);
2268
+ this._updateSheetRefStates(o);
2269
+ let s = e.sheet, c = e.name.toLowerCase(), l = new Map(n.refsById);
2270
+ l.set(e.id, e);
2271
+ let u = new Map(n.refsByLowerCaseName);
2272
+ u.set(c, e);
2203
2273
  let d = new Map(n.refsByInstance);
2204
- d.set(o, e);
2274
+ d.set(s, e);
2205
2275
  let f = new Map(n.sheetsById);
2206
- f.set(e.id, o);
2276
+ f.set(e.id, s);
2207
2277
  let p = new Map(n.sheetsByLowerCaseName);
2208
- p.set(s, o);
2278
+ p.set(c, s);
2209
2279
  let m = this, h = n.listenersSheets;
2210
- if (o !== void 0) {
2211
- let t = o.addListeners({
2280
+ if (s !== void 0) {
2281
+ let t = s.addListeners({
2212
2282
  onBeforeDelete: (e) => {
2213
2283
  m._validateDeleteSheet(e);
2214
2284
  },
2215
2285
  onDelete(e) {
2216
- let t = m._getSheetRef(e, R.Visibility.VeryHidden);
2286
+ let t = m._getSheetRef(e, F.Visibility.VeryHidden);
2217
2287
  if (!t) return;
2218
- let n = m._beginCommit({ description: u("op.deleteSheet", { name: t.name }) });
2288
+ let n = m._beginCommit({ description: i("op.deleteSheet", { name: t.name }) });
2219
2289
  try {
2220
- let r = m._getState(), i = r.sheetRefsAll, a = m._getOffsetForId(t.id, i), s = [...i];
2221
- s.splice(a, 1), m._updateSheetRefStates(s);
2290
+ let r = m._getState(), i = r.sheetRefsAll, a = m._getOffsetForId(t.id, i), o = [...i];
2291
+ o.splice(a, 1), m._updateSheetRefStates(o);
2222
2292
  let c = new Map(r.refsById);
2223
2293
  c.delete(t.id);
2224
2294
  let l = new Map(r.sheetsById);
@@ -2232,7 +2302,7 @@ var Gt, Q = class e extends me {
2232
2302
  let h = new Map(r.listenersSheets);
2233
2303
  h.delete(t.id), m._adjustRemoveSelectionIfRequired(a, t.id), m._adjustSheetNamesIfRequired(), m._sheetOnNameChange.delete(t.id), m._sheetOnVisibilityChange.delete(t.id), m._sheetOnIndexChange.delete(t.id), m._emitter.notify("onSheetsChange");
2234
2304
  let g = new Set(r.sheetsCreated);
2235
- g.has(o) && g.delete(o), m._updateState({
2305
+ g.has(s) && g.delete(s), m._updateState({
2236
2306
  refsById: c,
2237
2307
  sheetsById: l,
2238
2308
  refsByLowerCaseName: d,
@@ -2245,7 +2315,7 @@ var Gt, Q = class e extends me {
2245
2315
  throw n.rollback(), e;
2246
2316
  }
2247
2317
  }
2248
- }), r = o.addListeners({ onSelectionChange: (e) => {
2318
+ }), r = s.addListeners({ onSelectionChange: (e) => {
2249
2319
  m.getView().getActiveSheetId() === m._getSheetRef(e)?.id && m._emitter.notify("onSelectionChange", {
2250
2320
  source: m,
2251
2321
  params: e
@@ -2257,8 +2327,8 @@ var Gt, Q = class e extends me {
2257
2327
  }
2258
2328
  let g = n.lastId;
2259
2329
  g !== -1 && (g = Math.max(g, e.id)), this._updateState({ lastId: g }), this._updateState({
2260
- refsById: c,
2261
- refsByLowerCaseName: l,
2330
+ refsById: l,
2331
+ refsByLowerCaseName: u,
2262
2332
  refsByInstance: d,
2263
2333
  sheetsById: f,
2264
2334
  sheetsByLowerCaseName: p,
@@ -2267,6 +2337,26 @@ var Gt, Q = class e extends me {
2267
2337
  let _ = new Set(this._getState().sheetsCreated);
2268
2338
  return _.add(e.sheet), this._updateState({ sheetsCreated: _ }), e;
2269
2339
  }
2340
+ _recordActiveSheet(e, t, n) {
2341
+ let r = this.getView().getId();
2342
+ e.setIntent(cn, (e) => ({
2343
+ viewId: r,
2344
+ before: e?.before ?? t,
2345
+ after: n
2346
+ }));
2347
+ }
2348
+ _resyncActiveSheet(e, t) {
2349
+ let n = t?.sheetRefsVisible;
2350
+ if (!n?.length) return;
2351
+ let r = -1, i = n.length;
2352
+ for (let t = 0; t < i; t++) if (n[t].id === e) {
2353
+ r = t;
2354
+ break;
2355
+ }
2356
+ r === -1 && (r = Math.min(Math.max(this._activeSheetOffset, 0), i - 1));
2357
+ let a = n[r].id;
2358
+ this._view.getActiveSheetId() === a ? this._activeSheetOffset = r : this._view.setActiveSheetId(a);
2359
+ }
2270
2360
  _adjustRemoveSelectionIfRequired(e, t) {
2271
2361
  if (this._view.getActiveSheetId() === t) {
2272
2362
  let t, n = this._getState().sheetRefsVisible;
@@ -2279,88 +2369,85 @@ var Gt, Q = class e extends me {
2279
2369
  let n = this._view.getActiveSheetId();
2280
2370
  n ??= (this._view.setActiveSheetId(t), t);
2281
2371
  let r = e.refsById.get(n);
2282
- r || (this._view.setActiveSheetId(t), r = e.refsById.get(t), n = t), r.visibility === R.Visibility.Visible && (this._activeSheetOffset = this._getOffsetForId(n, e.sheetRefsVisible));
2372
+ r || (this._view.setActiveSheetId(t), r = e.refsById.get(t), n = t), r.visibility === F.Visibility.Visible && (this._activeSheetOffset = this._getOffsetForId(n, e.sheetRefsVisible));
2283
2373
  }
2284
2374
  _validateDeleteSheet(e) {
2285
- if (this._closed) throw Error(u("error.workbook.modelClosed"));
2286
- if (!this.getProtection().isStructureAllowed()) throw new h(u("error.workbook.protection"));
2375
+ if (this._closed) throw Error(i("error.workbook.modelClosed"));
2376
+ if (!this.getProtection().isStructureAllowed()) throw new o(i("error.workbook.protection"));
2287
2377
  let t = this._getSheetRef(e);
2288
- if (!t) throw new h(function(e) {
2289
- return u("error.workbook.deleteKey", { key: e });
2378
+ if (!t) throw new l(function(e) {
2379
+ return i("error.workbook.deleteKey", { key: e });
2290
2380
  }(e));
2291
2381
  let n = this._getState().sheetRefsVisible;
2292
- if (n.length === 1 && n[0].id === t.id) throw new h(u("error.workbook.sheetOne"));
2382
+ if (n.length === 1 && n[0].id === t.id) throw new l(i("error.workbook.sheetOne"));
2293
2383
  }
2294
2384
  _getOffsetForId(e, t) {
2295
2385
  let n = t.length;
2296
2386
  for (let r = 0; r < n; r++) if (t[r].id === e) return r;
2297
- throw new h(u("error.workbook.noVisibleRefs"));
2387
+ throw new l(i("error.workbook.noVisibleRefs"));
2298
2388
  }
2299
2389
  find(e) {
2300
- if (this._closed) throw Error(u("error.workbook.modelClosed"));
2390
+ if (this._closed) throw Error(i("error.workbook.modelClosed"));
2301
2391
  let t = this._getSheets();
2302
2392
  if (t.length === 1) return t[0].find(e);
2303
2393
  typeof e == "string" && (e = { text: e });
2304
- let n = !e?.reverse, r = e?.disableWrap ?? !1, i = this.getSelectedSheetIndex(), a = i, o = t[a], s = !1;
2394
+ let n = !e?.reverse, r = e?.disableWrap ?? !1, a = this.getSelectedSheetIndex(), o = a, s = t[o], c = !1;
2305
2395
  e = {
2306
2396
  ...e,
2307
2397
  disableWrap: !0
2308
2398
  };
2309
- let c, l = o.find(e), d = l.next(), p = !1;
2399
+ let l, u = s.find(e), d = u.next(), f = !1;
2310
2400
  if (e?.from) {
2311
2401
  let t = this._rangesAddressToCoords(e?.from);
2312
- c = {
2402
+ l = {
2313
2403
  colIndex: t[0].colStart,
2314
2404
  rowIndex: t[0].rowStart
2315
2405
  };
2316
2406
  }
2317
- let m = f.createCellComparator(e?.axis, e?.reverse);
2407
+ let p = m.createCellComparator(e?.axis, e?.reverse);
2318
2408
  delete (e = { ...e }).from;
2319
2409
  let h = () => {
2320
- if (!p && d.done && (s && a === i ? p = !0 : n ? (a++, a > t.length - 1 && (a = 0, s = !0)) : (a--, a < 0 && (a = t.length - 1, s = !0)), r && s && (p = !0), p || c || !s || a !== i || (p = !0), !p)) {
2321
- o = t[a], l = o.find(e);
2410
+ if (!f && d.done && (c && o === a ? f = !0 : n ? (o++, o > t.length - 1 && (o = 0, c = !0)) : (o--, o < 0 && (o = t.length - 1, c = !0)), r && c && (f = !0), f || l || !c || o !== a || (f = !0), !f)) {
2411
+ s = t[o], u = s.find(e);
2322
2412
  let n = d;
2323
- return d = l.next(), n;
2413
+ return d = u.next(), n;
2324
2414
  }
2325
- if (!p && s && a === i && (d.done || !c || !d.done && m(d.value.getCoords(), c) >= 0) && (p = !0), p) {
2415
+ if (!f && c && o === a && (d.done || !l || !d.done && p(d.value.getCoords(), l) >= 0) && (f = !0), f) {
2326
2416
  let e = d;
2327
- return d = ye, e;
2417
+ return d = Me, e;
2328
2418
  }
2329
- let u = d;
2330
- return d = l.next(), u;
2419
+ let i = d;
2420
+ return d = u.next(), i;
2331
2421
  };
2332
2422
  return { next: () => {
2333
2423
  let e = h();
2334
- for (; !p && e.done;) e = h();
2424
+ for (; !f && e.done;) e = h();
2335
2425
  return e;
2336
2426
  } };
2337
2427
  }
2338
2428
  replace(e, t, n) {
2339
- let r = 0, i = null, a = typeof t == "function", o = n?.maxCount ?? 2 ** 53 - 1, s = !n?.maxCount, c = "", l = typeof t == "string" ? Be(t) : null, d = n?.description ?? _("op.replace"), f = this._transactions.beginCommit({ description: d });
2429
+ let r = 0, a = null, o = typeof t == "function", s = n?.maxCount ?? 2 ** 53 - 1, c = !n?.maxCount, l = "", u = typeof t == "string" ? Pe(t) : null, d = n?.description ?? g("op.replace"), f = this._transactions.beginCommit({ description: d });
2340
2430
  try {
2341
2431
  let d = null, p = null, m = e.next();
2342
- for (; !m.done && r < o;) {
2343
- let o = m.value, s = o.getSheet();
2432
+ for (; !m.done && r < s;) {
2433
+ let i = m.value, s = i.getSheet();
2344
2434
  s !== d && (d = s, p !== null && p.apply(), p = d.getEntireRange().createSparseBuilder({
2345
2435
  axis: n?.axis,
2346
2436
  allowUnorderedWrites: !0
2347
2437
  }));
2348
- let c = a ? t(o) : t;
2349
- c !== void 0 && c !== o && (p.push(o, c), r++, i = o), m = e.next();
2438
+ let c = o ? t(i) : t;
2439
+ c !== void 0 && c !== i && (p.push(i, c), r++, a = i), m = e.next();
2350
2440
  }
2351
- p?.apply(), r === 1 && o === 1 && i && (c = i.getAddress()), r === 0 ? f.rollback() : f.commit({
2352
- description: n?.description ?? (s ? l === null ? _("op.replaceAll") : u("op.replaceAllWith", { value: l }) : c ? l === null ? u("op.replaceAt", { address: c }) : u("op.replaceAtWith", {
2353
- address: c,
2354
- value: l
2355
- }) : l === null ? _("op.replace") : u("op.replaceWith", { value: l })),
2356
- viewAfter: { selection: null }
2357
- });
2441
+ p?.apply(), r === 1 && s === 1 && a && (l = a.getAddress()), r === 0 ? f.rollback() : f.commit({ description: n?.description ?? (c ? u === null ? g("op.replaceAll") : i("op.replaceAllWith", { value: u }) : l ? u === null ? i("op.replaceAt", { address: l }) : i("op.replaceAtWith", {
2442
+ address: l,
2443
+ value: u
2444
+ }) : u === null ? g("op.replace") : i("op.replaceWith", { value: u })) });
2358
2445
  } catch (e) {
2359
2446
  throw f.rollback(), e;
2360
2447
  }
2361
2448
  return {
2362
2449
  count: r,
2363
- last: i
2450
+ last: a
2364
2451
  };
2365
2452
  }
2366
2453
  _nextSheetIndex(e, t = this._getSheetRefs()) {
@@ -2372,87 +2459,87 @@ var Gt, Q = class e extends me {
2372
2459
  return n === 1 ? 0 : (e === void 0 && (e = this.getSelectedSheetIndex()), (e = Math.max(0, Math.min(e, n - 1))) <= 0 ? n - 1 : e - 1);
2373
2460
  }
2374
2461
  getNextSheet(e) {
2375
- if (this._closed) throw Error(u("error.workbook.modelClosed"));
2462
+ if (this._closed) throw Error(i("error.workbook.modelClosed"));
2376
2463
  let t = this._getSheetRefs();
2377
2464
  return t[this._nextSheetIndex(e, t)]?.sheet ?? null;
2378
2465
  }
2379
2466
  getPreviousSheet(e) {
2380
- if (this._closed) throw Error(u("error.workbook.modelClosed"));
2467
+ if (this._closed) throw Error(i("error.workbook.modelClosed"));
2381
2468
  let t = this._getSheetRefs();
2382
2469
  return t[this._prevSheetIndex(e, t)]?.sheet ?? null;
2383
2470
  }
2384
2471
  async _duplicateSheet(e) {
2385
- if (this._closed) throw Error(u("error.workbook.modelClosed"));
2386
- if (!this.getProtection().isStructureAllowed()) throw new h(u("error.workbook.protection"));
2472
+ if (this._closed) throw Error(i("error.workbook.modelClosed"));
2473
+ if (!this.getProtection().isStructureAllowed()) throw new o(i("error.workbook.protection"));
2387
2474
  let t = this._getSheetRefs(), n = this.getSelectedSheetIndex(), r = null;
2388
2475
  if (e) {
2389
- if (r = this._getSheetRef(e), !r) throw new h(X(r));
2476
+ if (r = this._getSheetRef(e), !r) throw new l(X(r));
2390
2477
  } else r = t[n];
2391
2478
  if (!r) return null;
2392
- let i = r.sheet, a = this._strings.beginPersist(), o = this.getResources().beginPersist(), s = this.getStyles().beginPersist(), c = null, l = this.beginCommit(u("op.duplicateNamed", { name: i.getName() }));
2479
+ let a = r.sheet, s = this._strings.beginPersist(), c = this.getResources().beginPersist(), u = this.getStyles().beginPersist(), d = null, f = this.beginCommit(i("op.duplicateNamed", { name: a.getName() }));
2393
2480
  try {
2394
- 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);
2395
- this._emitter.notify("onSheetsChange"), c = s, l.commit();
2481
+ let e = this._getState().refsByInstance.get(a), r = await a.toJSON(), i = t.length + 1, o = this.findValidSheetName(e.name), s = this._createSheet(i, o, e.visibility, n, void 0, r);
2482
+ this._emitter.notify("onSheetsChange"), d = s, f.commit();
2396
2483
  } catch (e) {
2397
- throw l.rollback(), e;
2484
+ throw f.rollback(), e;
2398
2485
  } finally {
2399
- s.endPersist(), o.endPersist(), a.endPersist();
2486
+ u.endPersist(), c.endPersist(), s.endPersist();
2400
2487
  }
2401
- return c;
2488
+ return d;
2402
2489
  }
2403
2490
  _createRange(e, t) {
2404
- let n = e ? { ...e } : null, r = n ? this._getSheetRef(n.scope, R.Visibility.VeryHidden) : null;
2491
+ let n = e ? { ...e } : null, r = n ? this._getSheetRef(n.scope, F.Visibility.VeryHidden) : null;
2405
2492
  if (!r) {
2406
2493
  let e = this.getSelectedSheet();
2407
- return e ? (delete n?.scope, Ut(n, n ? {
2408
- scope: C,
2494
+ return e ? (delete n?.scope, an(n, n ? {
2495
+ scope: T,
2409
2496
  ...e.getEntireRange().getCoords()
2410
- } : null)) : void console.warn(u("error.workbook.noVisibleRefs"));
2497
+ } : null)) : void console.warn(i("error.workbook.noVisibleRefs"));
2411
2498
  }
2412
- let i = r.sheet, a = null;
2413
- return t && (a = { getOptions: t }), new Kt(e, A(i), this, a);
2499
+ let a = r.sheet, o = null;
2500
+ return t && (o = { getOptions: t }), new ln(e, j(a), this, o);
2414
2501
  }
2415
2502
  _createRanges(e, t) {
2416
2503
  let n = this.getSelectedSheet(), r = null;
2417
- return t && (r = { getOptions: t }), new Q(e, A(n), this, r);
2504
+ return t && (r = { getOptions: t }), new Q(e, j(n), this, r);
2418
2505
  }
2419
2506
  getRange(e, t) {
2420
2507
  if (e === void 0) return this.getSelectedRange(t);
2421
2508
  try {
2422
2509
  let n = this._rangesAddressToCoords(e);
2423
- if (n.length !== 1) throw new h(u("error.address.singleRangeOnlyAlt"));
2510
+ if (n.length !== 1) throw new l(i("error.address.singleRangeOnlyAlt"));
2424
2511
  return this._createRange(n[0], t);
2425
2512
  } catch (t) {
2426
- throw t instanceof i ? new i(t.message) : new h(t.message ?? P(e));
2513
+ throw t instanceof h ? new h(t.message) : new l(t.message ?? xe(e));
2427
2514
  }
2428
2515
  }
2429
2516
  getCell(e) {
2430
2517
  if (e === void 0) return this.getSelectedCell();
2431
2518
  let t = this.getRange(e);
2432
- if (t.size > 1) throw new h(u("error.address.singleCellOnly"));
2519
+ if (t.size > 1) throw new l(i("error.address.singleCellOnly"));
2433
2520
  return t.getCell();
2434
2521
  }
2435
2522
  getRanges(e, t) {
2436
2523
  let n = this._rangesAddressToCoords(e);
2437
- if (n.length === 0) throw new h(P(e));
2524
+ if (n.length === 0) throw new l(xe(e));
2438
2525
  return this._createRanges(n, t);
2439
2526
  }
2440
2527
  _createGraphRanges(e, t) {
2441
- let n = [];
2528
+ let n = [], r = this.getCalculation()?.getNamedFormulas() ?? null;
2442
2529
  for (let e = 0; e < t.length; e++) {
2443
- let r = t[e], i = (r.sheetName ? this._getSheetRef(r.sheetName, R.Visibility.VeryHidden) : null)?.sheet ?? this.getSelectedSheet();
2444
- i && n.push(new he(r, A(i), null));
2530
+ let i = t[e], a = (i.sheetName ? this._getSheetRef(i.sheetName, F.Visibility.VeryHidden) : null)?.sheet ?? this.getSelectedSheet();
2531
+ a && n.push(new x(i, r, j(a), null));
2445
2532
  }
2446
2533
  for (let t = 0; t < e.length; t++) n.push(e[t]);
2447
- return n.length === 0 ? null : new Q(n, A(this.getSelectedSheet()), this, null);
2534
+ return n.length === 0 ? null : new Q(n, j(this.getSelectedSheet()), this, null);
2448
2535
  }
2449
2536
  getStats(e) {
2450
- if (this._closed) throw Error(u("error.workbook.modelClosed"));
2451
- let t = this._getSheets(R.Visibility.VeryHidden), n = t.length;
2537
+ if (this._closed) throw Error(i("error.workbook.modelClosed"));
2538
+ let t = this._getSheets(F.Visibility.VeryHidden), n = t.length;
2452
2539
  if (n === 1) return t[0].getStats(e);
2453
2540
  let r = Array(n);
2454
2541
  for (let i = 0; i < n; i++) r[i] = t[i].getStats(e);
2455
- return new Tt(r);
2542
+ return new Bt(r);
2456
2543
  }
2457
2544
  _activeRangeCoords() {
2458
2545
  let e = this.getSelectedSheet(), t = e.getSelection().getRanges().getCoords(), n = e.getName(), r = t.length, i = Array(r);
@@ -2477,32 +2564,32 @@ var Gt, Q = class e extends me {
2477
2564
  getSelectedCell() {
2478
2565
  return this.getSelectedSheet().getSelectedCell();
2479
2566
  }
2480
- _rangesAddressToCoords(e, t = !0, n = R.Visibility.Hidden) {
2481
- if (!e) throw new h(u("error.address.noAddress"));
2482
- let r = this.getSelectedSheet(), i = { ...r?.getEntireRange().getCoords() }, a = r?.getName();
2483
- if (a && (i.scope = a), typeof e == "string") {
2567
+ _rangesAddressToCoords(e, t = !0, n = F.Visibility.Hidden) {
2568
+ if (!e) throw new l(i("error.address.noAddress"));
2569
+ let r = this.getSelectedSheet(), a = { ...r?.getEntireRange().getCoords() }, o = r?.getName();
2570
+ if (o && (a.scope = o), typeof e == "string") {
2484
2571
  let t = e.trim().toLowerCase();
2485
2572
  if (t === "r" || t === "c") {
2486
2573
  let n = this.getSelectedCell().getCoords(), r = {};
2487
2574
  t === "r" ? r.rowStart = r.rowEnd = n.rowIndex : r.colStart = r.colEnd = n.colIndex, e = r;
2488
2575
  }
2489
2576
  }
2490
- let o = this, s = Pe(e, i, Fe, (e) => {
2577
+ let s = this, c = Je(e, a, ue, (e) => {
2491
2578
  if (!t) return null;
2492
2579
  if (typeof e == "string") {
2493
- let t = o.getNames().getByName(e)?.getRanges?.();
2580
+ let t = s.getNames().getByName(e)?.getRanges?.();
2494
2581
  if (t) return t.getCoords();
2495
2582
  }
2496
- throw new h(`Invalid sheet reference '${e}'.`);
2497
- }), c = s.length;
2498
- for (let e = 0; e < c; e++) this._validateCoords(s[e], n);
2499
- return s;
2583
+ throw new l(`Invalid sheet reference '${e}'.`);
2584
+ }), u = c.length;
2585
+ for (let e = 0; e < u; e++) this._validateCoords(c[e], n);
2586
+ return c;
2500
2587
  }
2501
- _validateCoords(e, t = R.Visibility.Visible, n = u("error.sheet.oobRange")) {
2588
+ _validateCoords(e, t = F.Visibility.Visible, n = i("error.sheet.oobRange")) {
2502
2589
  if (e === null) return;
2503
2590
  let r = this.getSheet(e.scope, t).getEntireRange().getCoords();
2504
- if (!f.isRangeWithinRange(e, r)) throw new i(n);
2505
- if (e.rowEnd < e.rowStart || e.colEnd < e.colStart) throw new h(u("error.address.invalidRangeInverted"));
2591
+ if (!m.isRangeWithinRange(e, r)) throw new h(n);
2592
+ if (e.rowEnd < e.rowStart || e.colEnd < e.colStart) throw new l(i("error.address.invalidRangeInverted"));
2506
2593
  }
2507
2594
  _updateSheetRef(e, t) {
2508
2595
  let n = this._getState(), r = [...n.sheetRefsAll];
@@ -2522,106 +2609,103 @@ var Gt, Q = class e extends me {
2522
2609
  }), t;
2523
2610
  }
2524
2611
  _setSheetName(e, t, n) {
2525
- if (this._closed) throw Error(u("error.workbook.modelClosed"));
2526
- if (!this.getProtection().isStructureAllowed()) throw new h(u("error.workbook.protection"));
2612
+ if (this._closed) throw Error(i("error.workbook.modelClosed"));
2613
+ if (!this.getProtection().isStructureAllowed()) throw new o(i("error.workbook.protection"));
2527
2614
  let r = this._getSheetRef(e);
2528
- if (!r) throw new h(X(e));
2615
+ if (!r) throw new l(X(e));
2529
2616
  if (t === r.name) return r.sheet;
2530
- if ((t = this._validateNewSheetName(t)) == null) throw new h(u("error.workbook.sheetNameNotProvided"));
2531
- let i = Object.freeze({
2617
+ if ((t = this._validateNewSheetName(t)) == null) throw new l(i("error.workbook.sheetNameNotProvided"));
2618
+ let a = Object.freeze({
2532
2619
  ...r,
2533
2620
  name: t
2534
- }), a = null, o = this.beginCommit(_("op.renameSheet"));
2621
+ }), s = null, c = this.beginCommit(g("op.renameSheet"));
2535
2622
  try {
2536
- let e = this._updateSheetRef(r, i);
2623
+ let e = this._updateSheetRef(r, a);
2537
2624
  this._adjustSheetNamesIfRequired(), this._sheetOnNameChange.forEach((e, t) => {
2538
2625
  r.id === t && e();
2539
- }), this._emitter.notify("onSheetsChange"), r.id === this.getView().getActiveSheetId() && this._emitter.notify("onSelectionChange"), a = e.sheet, o.commit(n);
2626
+ }), this._emitter.notify("onSheetsChange"), r.id === this.getView().getActiveSheetId() && this._emitter.notify("onSelectionChange"), s = e.sheet, c.commit(n);
2540
2627
  } catch (e) {
2541
- throw o.rollback(), e;
2628
+ throw c.rollback(), e;
2542
2629
  }
2543
- return a;
2630
+ return s;
2544
2631
  }
2545
- _setSheetVisibility(e, t = R.Visibility.Visible, n) {
2546
- if (this._closed) throw Error(u("error.workbook.modelClosed"));
2547
- if (!this.getProtection().isStructureAllowed()) throw new h(u("error.workbook.protection"));
2548
- let r = this._getSheetRef(e, R.Visibility.VeryHidden);
2632
+ _setSheetVisibility(e, t = F.Visibility.Visible, n) {
2633
+ if (this._closed) throw Error(i("error.workbook.modelClosed"));
2634
+ if (!this.getProtection().isStructureAllowed()) throw new o(i("error.workbook.protection"));
2635
+ let r = this._getSheetRef(e, F.Visibility.VeryHidden);
2549
2636
  if (!r) return null;
2550
2637
  if (t === r.visibility) return;
2551
- let i = null, a = "";
2552
- t === R.Visibility.Visible ? a = _("op.unhideSheet") : t === R.Visibility.Hidden ? a = _("op.hideSheet") : t === R.Visibility.VeryHidden && (a = _("op.veryHideSheet"));
2553
- let o = this.beginCommit(a);
2638
+ let a = null, s = "";
2639
+ t === F.Visibility.Visible ? s = g("op.unhideSheet") : t === F.Visibility.Hidden ? s = g("op.hideSheet") : t === F.Visibility.VeryHidden && (s = g("op.veryHideSheet"));
2640
+ let c = this.beginCommit(s);
2554
2641
  try {
2555
2642
  let e = this._getState().sheetRefsVisible;
2556
- if (t !== R.Visibility.Visible && e.length === 1 && e[0].id === r.id) throw new h(u("error.workbook.sheetOne"));
2557
- let a = {
2643
+ if (t !== F.Visibility.Visible && e.length === 1 && e[0].id === r.id) throw new l(i("error.workbook.sheetOne"));
2644
+ let o = {
2558
2645
  ...r,
2559
2646
  visibility: t
2560
2647
  }, s = -1;
2561
- t !== R.Visibility.Visible && (s = this._getOffsetForId(r.id, e)), i = this._updateSheetRef(r, a).sheet, t !== R.Visibility.Visible && this._adjustRemoveSelectionIfRequired(s, r.id), this._adjustSheetNamesIfRequired(), o.commit(n);
2648
+ t !== F.Visibility.Visible && (s = this._getOffsetForId(r.id, e)), a = this._updateSheetRef(r, o).sheet, t !== F.Visibility.Visible && this._adjustRemoveSelectionIfRequired(s, r.id), this._adjustSheetNamesIfRequired(), c.commit(n);
2562
2649
  } catch (e) {
2563
- throw o.rollback(), e;
2650
+ throw c.rollback(), e;
2564
2651
  }
2565
2652
  return this._sheetOnVisibilityChange.forEach((e, t) => {
2566
2653
  r.id === t && e();
2567
- }), this._emitter.notify("onSheetsChange"), i;
2654
+ }), this._emitter.notify("onSheetsChange"), a;
2568
2655
  }
2569
2656
  _moveSheet(e, t, n) {
2570
- if (this._closed) throw Error(u("error.workbook.modelClosed"));
2571
- if (!this.getProtection().isStructureAllowed()) throw new h(u("error.workbook.protection"));
2572
- let r = null, i = this.beginCommit(u("op.moveSheetNamed", { name: e.name }));
2657
+ if (this._closed) throw Error(i("error.workbook.modelClosed"));
2658
+ if (!this.getProtection().isStructureAllowed()) throw new o(i("error.workbook.protection"));
2659
+ let r = null, a = this.beginCommit(i("op.moveSheetNamed", { name: e.name }));
2573
2660
  try {
2574
- let a = this._getState(), o = a.sheetRefsVisible;
2575
- if (t < 0 || t > o.length - 1) throw new h(`Invalid to index: ${t}`);
2576
- let s = {
2577
- view: this.getView(),
2578
- activeSheetId: this.getView().getActiveSheetId()
2579
- }, c = a.sheetRefsAll, l = this._getOffsetForId(e.id, c), u = this._getOffsetForId(o[t].id, c);
2580
- if (l === u) return;
2581
- let d = c[l], f = [...c];
2582
- f.splice(l, 1), f.splice(u, 0, d), this._updateSheetRefStates(f), this._adjustSheetNamesIfRequired(), this._sheetOnIndexChange.forEach((e, t) => {
2583
- t >= l && t <= u && e();
2584
- }), this._emitter.notify("onSheetsChange"), r = d.sheet, i.commit({
2585
- ...n,
2586
- viewBefore: s,
2587
- viewAfter: {
2588
- view: this.getView(),
2589
- activeSheetId: this.getView().getActiveSheetId()
2590
- }
2591
- });
2661
+ let i = this._getState(), o = i.sheetRefsVisible;
2662
+ if (t < 0 || t > o.length - 1) throw new l(`Invalid to index: ${t}`);
2663
+ let s = this.getView().getActiveSheetId(), c = i.sheetRefsAll, u = this._getOffsetForId(e.id, c), d = this._getOffsetForId(o[t].id, c);
2664
+ if (u === d) return;
2665
+ let f = c[u], p = [...c];
2666
+ p.splice(u, 1), p.splice(d, 0, f), this._updateSheetRefStates(p), this._calculation._replaceSheetSpans?.(c.map((e) => e.sheet.getId()), p.map((e) => e.sheet.getId()), f.sheet.getId()), this._adjustSheetNamesIfRequired(), this._sheetOnIndexChange.forEach((e, t) => {
2667
+ t >= u && t <= d && e();
2668
+ }), this._emitter.notify("onSheetsChange"), r = f.sheet, this._recordActiveSheet(a, s, this.getView().getActiveSheetId()), a.commit(n);
2592
2669
  } catch (e) {
2593
- throw i.rollback(), e;
2670
+ throw a.rollback(), e;
2594
2671
  }
2595
2672
  return r;
2596
2673
  }
2597
2674
  _setSelectedSheet(e) {
2598
- if (this._closed) throw Error(u("error.workbook.modelClosed"));
2675
+ if (this._closed) throw Error(i("error.workbook.modelClosed"));
2599
2676
  let t = this._getSheetRef(e);
2600
- if (!t) throw new h(X(e));
2677
+ if (!t) throw new l(X(e));
2601
2678
  let n = null;
2602
- return t.visibility !== R.Visibility.Visible && this._setSheetVisibility(t, R.Visibility.Visible), this._view.setActiveSheetId(t.id), n = t.sheet, n;
2679
+ return t.visibility !== F.Visibility.Visible && this._setSheetVisibility(t, F.Visibility.Visible), this._view.setActiveSheetId(t.id), n = t.sheet, n;
2603
2680
  }
2604
2681
  getProtection() {
2605
2682
  return this._protection;
2606
2683
  }
2684
+ getCodeName() {
2685
+ return this._codeName;
2686
+ }
2607
2687
  getNames() {
2608
2688
  return this._names;
2609
2689
  }
2610
2690
  getCalculation() {
2611
2691
  return this._calculation;
2612
2692
  }
2613
- createFormula(e, t) {
2614
- return this.getCalculation().createFormula(e, t);
2693
+ createFormula(e, t, n) {
2694
+ return this.getCalculation().createFormula(e, t, n);
2615
2695
  }
2616
2696
  evaluate(e, t) {
2617
2697
  return this.getCalculation().evaluate(e, t);
2618
2698
  }
2619
2699
  whenCalculationReady() {
2620
- return this.getCalculation().ready();
2700
+ let e = this._starting;
2701
+ return e ? e.then(() => this.getCalculation().ready()) : this.getCalculation().ready();
2621
2702
  }
2622
2703
  getScripts() {
2623
2704
  return this._scripts ||= this._createScripts(), this._scripts;
2624
2705
  }
2706
+ getModules() {
2707
+ return this.getScripts().getModules();
2708
+ }
2625
2709
  _notifyAllChange() {
2626
2710
  this._emitter.notify("onSheetsChange"), this._emitter.notify("onSelectedSheetChange"), this._emitter.notify("onViewChange");
2627
2711
  }
@@ -2633,6 +2717,7 @@ var Gt, Q = class e extends me {
2633
2717
  return (n) => {
2634
2718
  let r = () => {
2635
2719
  let e = n.getSource();
2720
+ if (e.isInvalid()) return e;
2636
2721
  if (e.isICellRanges) {
2637
2722
  let n = [...e.getCoords()], r = n.length;
2638
2723
  for (let t = 0; t < r; t++) {
@@ -2666,44 +2751,62 @@ var Gt, Q = class e extends me {
2666
2751
  };
2667
2752
  }
2668
2753
  _fromJSON(e) {
2669
- if (this._emitter.notify("onBeforeLoad", { params: e }), this._initState(), !e.sheets || e.sheets.length === 0) throw new h(u("error.workbook.sheetOne"));
2670
- e.theme && (this._theme = new v(e.theme), this._styles.setTheme(this._theme));
2754
+ if (this._emitter.notify("onBeforeLoad", { params: e }), this._initState(), !e.sheets || e.sheets.length === 0) throw new l(i("error.workbook.sheetOne"));
2755
+ e.theme && (this._theme = new C(e.theme), this._styles.setTheme(this._theme));
2671
2756
  let t = this._strings.beginPersist(), n = this._resources.beginPersist(), r = this._styles.beginPersist();
2672
2757
  try {
2673
- 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 ||= {};
2674
- let i = e.sheets, a = i.length, o = e.view.activeSheetId ?? null;
2675
- o !== null && (o = Math.min(Math.max(0, o), a - 1));
2676
- let s = null, c = null, l = -1;
2677
- for (let e = 0; e < a; e++) {
2678
- let t = i[e], n = t.visibility || R.Visibility.Visible, r = e;
2679
- c = r, n === R.Visibility.Visible ? (l++, s === null && (s = r)) : o !== null && o === r && (o = null), this._createSheet(r, t.name, n, l, t.sheet);
2758
+ t.fromJSON(e.strings), n.fromJSON(e.resources), r.fromJSON(e.styles), e.date1904 && (this._isDate1904 = !0), this._codeName = e.codeName ?? null, this._updateLinks = e.updateLinks ?? null, e.locale && (this._locale = e.locale), e.localeOverrides && (this._localeOverrides = e.localeOverrides), e.view ||= {};
2759
+ let i = [], a = e.pivotCaches;
2760
+ if (a) {
2761
+ let e = n.fromResourceId.bind(n);
2762
+ for (let t = 0; t < a.length; t++) {
2763
+ let n = a[t];
2764
+ n && typeof n.cacheId == "number" && i.push({
2765
+ cacheId: n.cacheId,
2766
+ part: D.fromJSON(n.part, e)
2767
+ });
2768
+ }
2680
2769
  }
2681
- this._updateState({ lastId: c }), e.view.activeSheetId = o ?? s, this.setView(new Ft({ json: e.view })), this._adjustSheetNamesIfRequired(), this._listenerProtection?.();
2682
- let u = this;
2683
- this._protection = new Lt(e?.protection, this._options?.readonly), this._listenerProtection = this._protection.addListeners({ onChange: (e) => {
2684
- u._emitter.notify("onProtectionChange", { source: e });
2685
- } }), e.scripts && (this._scripts = this._createScripts(e.scripts)), this._emitter.notify("onLoad");
2770
+ this._pivotCaches = i, this._people.fromJSON(e.people);
2771
+ let o = e.sheets, s = o.length, c = e.view.activeSheetId ?? null;
2772
+ c !== null && (c = Math.min(Math.max(0, c), s - 1));
2773
+ let l = null, u = null;
2774
+ this._isLoadingSheets = !0;
2775
+ for (let e = 0; e < s; e++) {
2776
+ let t = o[e], n = t.visibility || F.Visibility.Visible, r = e;
2777
+ u = r, n === F.Visibility.Visible ? l === null && (l = r) : c !== null && c === r && (c = null);
2778
+ try {
2779
+ this._createSheet(r, t.name, n, e, t.sheetId, t.sheet);
2780
+ } catch (e) {
2781
+ throw this._isLoadingSheets = !1, e;
2782
+ }
2783
+ }
2784
+ this._isLoadingSheets = !1, this._updateState({ lastId: u }), e.view.activeSheetId = c ?? l, this.setView(new Yt({ json: e.view })), this._adjustSheetNamesIfRequired(), this._listenerProtection?.();
2785
+ let d = this;
2786
+ this._protection = new Y(e?.protection, this._options?.readonly), this._listenerProtection = this._protection.addListeners({ onChange: (e) => {
2787
+ d._emitter.notify("onProtectionChange", { source: e });
2788
+ } }), this._emitter.notify("onLoad");
2686
2789
  } finally {
2687
2790
  r.endPersist(), n.endPersist(), t.endPersist();
2688
2791
  }
2689
2792
  }
2690
2793
  _createScripts(e) {
2691
2794
  let t = this;
2692
- return new jt({
2795
+ return new Gt({
2693
2796
  transactions: this._transactions,
2694
2797
  json: e,
2695
2798
  workbook: t,
2696
2799
  getBuiltInFunctions: () => t._calculation?.getFunctions(),
2697
2800
  onAdd: (e, n) => {
2698
2801
  let r = t._calculation;
2699
- r.getStatus() !== y.Status.Off && r.start().then(async () => {
2802
+ r.getStatus() !== le.Status.Off && r.start().then(async () => {
2700
2803
  let e = n.getFunctions().getItems({ type: "formula" }), t = e.length;
2701
2804
  for (let n = 0; n < t; n++) {
2702
2805
  let t = e[n];
2703
2806
  try {
2704
2807
  await this._calculation.getFunctions().add(t);
2705
2808
  } catch (e) {
2706
- l.error(e?.message ?? String(e), e);
2809
+ c.error(e?.message ?? String(e), e);
2707
2810
  }
2708
2811
  }
2709
2812
  }).catch(() => {});
@@ -2712,51 +2815,64 @@ var Gt, Q = class e extends me {
2712
2815
  });
2713
2816
  }
2714
2817
  async toJSON(e) {
2715
- if (this._closed) throw Error(u("error.workbook.modelClosed"));
2716
- await Promise.resolve(this._starting), await this._emitter.notify("onBeforeSave", { async: !0 });
2717
- let t = { sheets: [] }, n = e?.ignoreStyles ?? !1;
2718
- if (!n) {
2818
+ if (this._closed) throw Error(i("error.workbook.modelClosed"));
2819
+ await Promise.resolve(this._starting);
2820
+ let t = this.getCalculation();
2821
+ t.getStatus() !== le.Status.Off && (await t.ready(), await t._whenRequestsSettled?.()), await this._emitter.notify("onBeforeSave", { async: !0 });
2822
+ let n = { sheets: [] }, r = e?.ignoreStyles ?? !1;
2823
+ if (!r) {
2719
2824
  let e = this._theme.toJSON();
2720
- (e ? Object.keys(e).length : 0) > 0 && (t.theme = e);
2825
+ (e ? Object.keys(e).length : 0) > 0 && (n.theme = e);
2721
2826
  }
2722
2827
  if (this._scripts) {
2723
2828
  let e = this._scripts.toJSON();
2724
- e && Object.keys(e).length > 0 && (t.scripts = e);
2829
+ e && Object.keys(e).length > 0 && (n.modules = e);
2725
2830
  }
2726
- this._isDate1904 && (t.date1904 = !0), this._locale && (t.locale = this._locale), this._localeOverrides && (t.localeOverrides = this._localeOverrides);
2727
- let r = e?.ignoreResources ?? !1, i = this._strings.beginPersist(), a = r ? null : this._resources.beginPersist(), o = this._styles.beginPersist();
2831
+ 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);
2832
+ let a = e?.resources ?? "embed", o = a === "ignore", s = this._strings.beginPersist(), c = o ? null : this._resources.beginPersist(), l = this._styles.beginPersist();
2728
2833
  try {
2729
- let s = this._getSheetRef(this.getSelectedSheetIndex()).id, c = s, l = null, u = this._getState(), d = u.sheetRefsAll, f = u.sheetsById, p = d.length;
2730
- for (let n = 0; n < p; n++) {
2731
- let r = d[n], i = n + 1, a = await f.get(r.id).toJSON(e), o = {
2732
- name: r.name,
2733
- sheet: a
2834
+ let t = this._getSheetRef(this.getSelectedSheetIndex()).id, i = t, u = null, d = this._getState(), f = d.sheetRefsAll, p = d.sheetsById, m = f.length;
2835
+ for (let r = 0; r < m; r++) {
2836
+ let a = f[r], o = r + 1, s = await p.get(a.id).toJSON(e), c = {
2837
+ name: a.name,
2838
+ sheet: s
2734
2839
  };
2735
- r.visibility === R.Visibility.Visible ? l === null && (l = i) : o.visibility = r.visibility, r.id === s && (c = i), t.sheets.push(o);
2840
+ a.sheetId !== void 0 && (c.sheetId = a.sheetId), a.visibility === F.Visibility.Visible ? u === null && (u = o) : c.visibility = a.visibility, a.id === t && (i = o), n.sheets.push(c);
2736
2841
  }
2737
- if (!n) {
2738
- let e = o.toJSON();
2739
- e && Object.keys(e).length > 0 && (t.styles = e);
2842
+ if (!r) {
2843
+ let e = l.toJSON();
2844
+ e && Object.keys(e).length > 0 && (n.styles = e);
2740
2845
  }
2741
- let m = this.getProtection().toJSON();
2742
- m && (t.protection = m);
2743
- let h = this._calculation.toJSON();
2744
- Object.keys(h).length > 0 && (t.calc = h);
2745
- let g = await i.toJSONAsync();
2746
- g && g.length > 0 && (t.strings = g);
2747
- let _ = this._externalBooks.toJSON();
2748
- if (_ && (t.externalBooks = _), !r) {
2749
- let e = await a.toJSONAsync();
2750
- e && e.length > 0 && (t.resources = e);
2846
+ let h = this.getProtection().toJSON();
2847
+ h && (n.protection = h);
2848
+ let g = this._calculation.toJSON();
2849
+ Object.keys(g).length > 0 && (n.calc = g);
2850
+ let _ = await s.toJSONAsync();
2851
+ _ && _.length > 0 && (n.strings = _);
2852
+ let v = this._calculation.getExternalBooks().toJSON();
2853
+ v && (n.externalBooks = v);
2854
+ let y = this._pivotCaches;
2855
+ if (y.length > 0) {
2856
+ let e = c ? c.toResourceId.bind(c) : () => null, t = [];
2857
+ for (let n = 0; n < y.length; n++) {
2858
+ let r = { cacheId: y[n].cacheId }, i = D.toJSON(y[n].part, e);
2859
+ i && (r.part = i), t.push(r);
2860
+ }
2861
+ t.length > 0 && (n.pivotCaches = t);
2862
+ }
2863
+ let b = this._people.toJSON();
2864
+ if (b && (n.people = b), !o) {
2865
+ let e = await c.toJSONAsync(typeof a == "function" ? a : void 0);
2866
+ e && e.length > 0 && (n.resources = e);
2751
2867
  }
2752
- let v = this._calculation.getNamedFormulas().toJSON();
2753
- v && v.length > 0 && (t.names = v);
2754
- let y = this._view.toJSON();
2755
- y && (c === l ? delete y.activeSheetId : y.activeSheetId = c, Object.keys(y).length > 0 && (t.view = y));
2868
+ let x = this._calculation.getNamedFormulas().toJSON();
2869
+ x && x.length > 0 && (n.names = x);
2870
+ let S = this._view.toJSON();
2871
+ S && (i === u ? delete S.activeSheetId : S.activeSheetId = i, Object.keys(S).length > 0 && (n.view = S));
2756
2872
  } finally {
2757
- o.endPersist(), r || a.endPersist(), i.endPersist();
2873
+ l.endPersist(), o || c.endPersist(), s.endPersist();
2758
2874
  }
2759
- return this._emitter.notify("onSave", { params: t }), t;
2875
+ return this._emitter.notify("onSave", { params: n }), n;
2760
2876
  }
2761
2877
  isClosed() {
2762
2878
  return this._closed;
@@ -2774,16 +2890,16 @@ var Gt, Q = class e extends me {
2774
2890
  } catch (e) {
2775
2891
  console.warn("error on close", e);
2776
2892
  }
2777
- this._ownResources, this._ownNames && this._names.close(), this._ownCalculation && this._calculation.close(), this._ownStyles, this._transactionsRemoveListener?.(), this._listenerLanguage?.(), this._listenerOrigin?.(), this._closed = !0;
2893
+ 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 at && this._originProvider.release(), this._closed = !0;
2778
2894
  }
2779
2895
  beginCommit(e) {
2780
- if (this._closed) throw Error(u("error.workbook.modelClosed"));
2896
+ if (this._closed) throw Error(i("error.workbook.modelClosed"));
2781
2897
  return this._beginCommit(typeof e == "string" ? { description: e } : e);
2782
2898
  }
2783
2899
  doBatch(e, t) {
2784
2900
  let n = this;
2785
2901
  return t = typeof t == "string" ? { description: t } : {
2786
- description: _("op.updateWorkbook"),
2902
+ description: g("op.updateWorkbook"),
2787
2903
  ...t
2788
2904
  }, this._transactions.doBatch(e, t, (e, t) => {
2789
2905
  e.getDepth() === 0 && (n._lastTransactionUUID = e.getId());
@@ -2798,7 +2914,7 @@ var Gt, Q = class e extends me {
2798
2914
  _getState() {
2799
2915
  return this._transactions.getState(this._id);
2800
2916
  }
2801
- _updateState(e, t = _("op.updateWorkbook"), n) {
2917
+ _updateState(e, t = g("op.updateWorkbook"), n) {
2802
2918
  if (!e) return;
2803
2919
  let r = this._beginCommit(t);
2804
2920
  try {
@@ -2819,7 +2935,7 @@ var Gt, Q = class e extends me {
2819
2935
  get isIWorkbook() {
2820
2936
  return !0;
2821
2937
  }
2822
- }, qt = { address: null }, Jt = class {
2938
+ }, fn = { address: null }, pn = class {
2823
2939
  constructor() {
2824
2940
  this._readFormats = [], this._writeFormats = [], this._encryptions = [];
2825
2941
  }
@@ -2895,9 +3011,9 @@ var Gt, Q = class e extends me {
2895
3011
  return !0;
2896
3012
  });
2897
3013
  }
2898
- }, Yt = (e) => !!e && typeof e == "object" && typeof e.getPath == "function" && typeof e.canWrite == "function", Xt = new class {
3014
+ }, $ = /* @__PURE__ */ new WeakMap(), mn = (e) => !!e && typeof e == "object" && typeof e.getPath == "function" && typeof e.canWrite == "function", hn = new class {
2899
3015
  constructor() {
2900
- this._setInstalled = /* @__PURE__ */ new WeakSet(), this._backingStore = null, this._emitter = new x(this), this._registry = new Jt(), this._defaultStore = new Ye(() => this.getWriteFormats(), () => this.getReadFormats());
3016
+ this._setInstalled = /* @__PURE__ */ new WeakSet(), this._backingStore = null, this._emitter = new L(this), this._registry = new pn(), this._defaultStore = new st(() => this.getWriteFormats(), () => this.getReadFormats());
2901
3017
  }
2902
3018
  getBackingStore() {
2903
3019
  return this._backingStore ?? this._defaultStore;
@@ -2932,15 +3048,18 @@ var Gt, Q = class e extends me {
2932
3048
  return this._registry.getWriteFormats(e);
2933
3049
  }
2934
3050
  getOrigin(e) {
2935
- return new z(e);
3051
+ return new R(e);
2936
3052
  }
2937
3053
  async read(e) {
2938
3054
  let t = null;
2939
3055
  if (typeof e == "string") e = { source: e };
2940
- else if (Yt(e)) {
3056
+ else if (mn(e)) {
2941
3057
  let n = e.getPath();
2942
3058
  if (!n) throw Error("Cannot read from an unbound origin (no path).");
2943
- t = e, e = { source: n };
3059
+ rt(e) ? e = {
3060
+ source: n,
3061
+ asCopy: !0
3062
+ } : (t = e, e = { source: n });
2944
3063
  }
2945
3064
  let n = e ?? {}, { source: r = null, ...i } = n, a = this.getBackingStore();
2946
3065
  return (a.read ? a : this._defaultStore).read({
@@ -2950,176 +3069,200 @@ var Gt, Q = class e extends me {
2950
3069
  });
2951
3070
  }
2952
3071
  async _decodeBuffer(e, t = {}, n, r = null) {
2953
- let i = t.format, a = t.ext;
2954
- if (!i && !a) throw Error("Either format or file extension must be provided to determine read type.");
2955
- let o = (await this._registry.getReadFormats({
2956
- search: i,
2957
- ext: a
3072
+ let a = t.format, o = t.ext;
3073
+ if (!a && !o) throw Error("Either format or file extension must be provided to determine read type.");
3074
+ let s = (await this._registry.getReadFormats({
3075
+ search: a,
3076
+ ext: o
2958
3077
  }))[0];
2959
- if (!o) throw new h(u("error.io.readFormatUnavailable", { format: i ?? a }));
2960
- let s = n?.typedCreateWorkbookOptions, c = s ? Object.keys(s).find((e) => e.toLowerCase() === o.key.toLowerCase()) : void 0, l = {
3078
+ if (!s) throw new l(i("error.io.readFormatUnavailable", { format: a ?? o }));
3079
+ let c = n?.typedCreateWorkbookOptions, u = c ? Object.keys(c).find((e) => e.toLowerCase() === s.key.toLowerCase()) : void 0, d = {
2961
3080
  ...n,
2962
- ...c === void 0 ? void 0 : s[c]
3081
+ ...u === void 0 ? void 0 : c[u]
2963
3082
  };
2964
- delete l.typedCreateWorkbookOptions, delete l.source;
2965
- let d = r ?? new z(t.absolutePath ?? null, {
3083
+ delete d.typedCreateWorkbookOptions, delete d.source, delete d.asCopy;
3084
+ let f = r ?? new R(t.absolutePath ?? null, {
2966
3085
  name: t.name ?? null,
2967
- format: o.key,
3086
+ format: s.key,
2968
3087
  size: t.size ?? null,
3088
+ lastModified: t.lastModified ?? null,
2969
3089
  canWrite: t.canWrite ?? !1
2970
3090
  });
2971
- r instanceof z && r.update({
2972
- format: o.key,
2973
- size: t.size ?? null
2974
- }), l.createWorkbookOptions = {
2975
- ...l.createWorkbookOptions || {},
2976
- origin: d
2977
- }, l.readonly !== void 0 && (l.createWorkbookOptions = {
2978
- readonly: l.readonly,
2979
- ...l.createWorkbookOptions
2980
- }, delete l.readonly), l.calcOnly && (l.createWorkbookOptions = {
3091
+ r instanceof R && r.update({
3092
+ format: s.key,
3093
+ size: t.size ?? null,
3094
+ lastModified: t.lastModified ?? null
3095
+ }), d.createWorkbookOptions = {
3096
+ ...d.createWorkbookOptions || {},
3097
+ origin: f
3098
+ }, d.readonly !== void 0 && (d.createWorkbookOptions = {
3099
+ readonly: d.readonly,
3100
+ ...d.createWorkbookOptions
3101
+ }, delete d.readonly), d.calcOnly && (d.createWorkbookOptions = {
2981
3102
  disableLoadAutoFit: !0,
2982
- ...l.createWorkbookOptions
3103
+ ...d.createWorkbookOptions
2983
3104
  });
2984
- let f = await this._decrypt(e, d, l);
2985
- if (f === null) return null;
2986
- e = f.bytes;
2987
- let p = l?.progress?.onStart?.bind(l.progress);
2988
- p && await Promise.resolve(p(d, t.size));
3105
+ let p = await this._decrypt(e, f, d);
3106
+ if (p === null) return null;
3107
+ e = p.bytes;
3108
+ let m = d?.progress?.onStart?.bind(d.progress);
3109
+ m && await Promise.resolve(m(f, t.size));
2989
3110
  try {
2990
- let t = await this._readArrayBuffer(e, o, l);
2991
- return f.password !== null && d.setPassword(f.password), l?.progress?.onComplete?.(d), this._emitter.notify("onRead", {
3111
+ let t = await this._readArrayBuffer(e, s, d);
3112
+ return p.password !== null && f.setPassword(p.password), d?.progress?.onComplete?.(f), this._emitter.notify("onRead", {
2992
3113
  params: {
2993
3114
  workbook: t,
2994
- origin: d
3115
+ origin: f
2995
3116
  },
2996
3117
  transactional: !1
2997
3118
  }), t;
2998
3119
  } catch (e) {
2999
- throw l?.progress?.onError?.(e), l?.progress?.onComplete?.(null), e;
3120
+ throw d?.progress?.onError?.(e), d?.progress?.onComplete?.(null), e;
3000
3121
  }
3001
3122
  }
3002
3123
  async _decrypt(e, t, n) {
3003
3124
  let r = await this._registry.detectEncryption(e);
3004
- if (t instanceof z && t.update({ encryption: r ? r.key : null }), !r) return {
3125
+ if (t instanceof R && t.update({ encryption: r ? r.key : null }), !r) return {
3005
3126
  bytes: e,
3006
3127
  password: null
3007
3128
  };
3008
- let i = null, a = async (t) => {
3129
+ let a = null, o = async (t) => {
3009
3130
  try {
3010
- return i = await r.decode(e, t), !0;
3131
+ return a = await r.decode(e, t), !0;
3011
3132
  } catch (e) {
3012
- if (!(e instanceof s)) throw e;
3133
+ if (!(e instanceof u)) throw e;
3013
3134
  return !1;
3014
3135
  }
3015
3136
  };
3016
- if (n?.password && await a(n.password)) return {
3017
- bytes: i,
3137
+ if (n?.password && await o(n.password)) return {
3138
+ bytes: a,
3018
3139
  password: n.password
3019
3140
  };
3020
3141
  if (!n?.onPassword) {
3021
3142
  let e = t.getName();
3022
- throw new c(e ? u("error.io.passwordRequired", { name: e }) : u("error.io.passwordRequiredUnnamed"));
3143
+ throw new _(e ? i("error.io.passwordRequired", { name: e }) : i("error.io.passwordRequiredUnnamed"));
3023
3144
  }
3024
- let o = await Promise.resolve(n.onPassword({
3145
+ let s = await Promise.resolve(n.onPassword({
3025
3146
  origin: t,
3026
3147
  encryption: r.key,
3027
- validate: a
3148
+ validate: o
3028
3149
  }));
3029
- if (o == null) return null;
3030
- if (i !== null || await a(o)) return {
3031
- bytes: i,
3032
- password: o
3150
+ if (s == null) return null;
3151
+ if (a !== null || await o(s)) return {
3152
+ bytes: a,
3153
+ password: s
3033
3154
  };
3034
- throw new s(u("error.io.passwordIncorrect"));
3155
+ throw new u(i("error.io.passwordIncorrect"));
3035
3156
  }
3036
3157
  async writeArrayBuffer(e, t) {
3037
3158
  if (!t?.format) throw Error("A format must be specified to write to an ArrayBuffer (e.g. { format: 'xlsx' }).");
3038
3159
  let n = (await this._registry.getWriteFormats({ search: t.format }))[0];
3039
- if (!n) throw new h(u("error.io.writeFormatUnavailable", { format: t.format }));
3160
+ if (!n) throw new l(i("error.io.writeFormatUnavailable", { format: t.format }));
3040
3161
  return this._writeArrayBuffer(e, n, t);
3041
3162
  }
3042
3163
  async write(e, t, n) {
3164
+ return typeof t == "string" || mn(t) ? this._write(e, t, !1, n) : this._write(e, e?.getOrigin?.(), !0, t ?? n);
3165
+ }
3166
+ async writeAs(e, t, n) {
3167
+ if (!t) throw Error("A target must be provided for writeAs (use write(workbook) for a plain save).");
3168
+ return this._write(e, t, !0, n);
3169
+ }
3170
+ async _write(e, t, n, r) {
3043
3171
  if (!e) throw Error("Workbook must be provided.");
3044
3172
  if (!e.isIWorkbook) throw Error("Invalid workbook model provided. Must be an instance of IWorkbook.");
3045
- let r = n, i = null;
3046
- typeof t == "string" ? i = this.getOrigin(t) : Yt(t) ? i = t : t && (r = t);
3047
- let a, o = !i, s = i ?? e.getOrigin(), l = s.getFormat();
3048
- if ((r?.format || l) && (a = (await this._registry.getWriteFormats({ search: r?.format ?? l ?? void 0 }))[0]), a || s.getPath() && s.canWrite() && s.getExtension() || (a = (await this._registry.getWriteFormats({ ext: "sxl" }))[0] ?? (await this._registry.getWriteFormats())[0]), !a) throw new h(u("error.io.writeFormatUnresolved"));
3049
- if (i && typeof t == "string") {
3050
- let e = i.getPath();
3051
- e && !D(e) && i.update?.({ path: `${e}.${a.exts[0]}` });
3052
- }
3053
- let d = s.getEncryption(), f = e.getOrigin?.(), p = (s instanceof z ? s.getPassword() : null) ?? (f instanceof z ? f.getPassword() : null), m = s.isEncrypted() || (f?.isEncrypted() ?? !1), g = r?.password === void 0 ? p ?? (m ? void 0 : null) : r.password, _ = null;
3054
- if (g === void 0) {
3055
- if (m) {
3056
- let e = s.getName();
3057
- throw new c(e ? u("error.io.passwordRequiredSave", { name: e }) : u("error.io.passwordRequiredSaveUnnamed"));
3173
+ let a, o = typeof t == "string" ? this.getOrigin(t) : t, s = o.getFormat();
3174
+ if ((r?.format || s) && (a = (await this._registry.getWriteFormats({ search: r?.format ?? s ?? void 0 }))[0]), a || o.getPath() && o.canWrite() && o.getExtension() || (a = (await this._registry.getWriteFormats({ ext: "sxl" }))[0] ?? (await this._registry.getWriteFormats())[0]), !a) throw new l(i("error.io.writeFormatUnresolved"));
3175
+ let c = o.getExtension();
3176
+ if (r?.format && c && o.getPath() && o.canWrite() && !a.exts.includes(c)) {
3177
+ let e = (await this._registry.getWriteFormats({ ext: c }))[0];
3178
+ if (e && e.key !== a.key) {
3179
+ let e = o.getPath().split(/[/\\]/).pop();
3180
+ throw new l(i("error.io.writeFormatMismatch", {
3181
+ format: r.format,
3182
+ file: e
3183
+ }));
3184
+ }
3185
+ }
3186
+ if (typeof t == "string") {
3187
+ let e = o.getPath();
3188
+ o = new R(b(e) ? e : `${e}.${a.exts[0]}`, { format: a.key });
3189
+ }
3190
+ let u = o.getEncryption(), d = e.getOrigin?.(), f = (o instanceof R ? o.getPassword() : null) ?? (d instanceof R ? d.getPassword() : null), p = o.isEncrypted() || (d?.isEncrypted() ?? !1), m = r?.password === void 0 ? f ?? (p ? void 0 : null) : r.password, h = null;
3191
+ if (m === void 0) {
3192
+ if (p) {
3193
+ let e = o.getName();
3194
+ throw new _(e ? i("error.io.passwordRequiredSave", { name: e }) : i("error.io.passwordRequiredSaveUnnamed"));
3058
3195
  }
3059
- } else if (g !== null && (_ = await this._registry.getEncryption(d), !_)) throw new h(u("error.io.encryptionUnavailable"));
3060
- let v = `${s.getName() ?? u("workbook.defaultName")}.${a.exts[0]}`, y = r?.progress, b = !1, x = this, S = null, C = {
3196
+ } else if (m !== null && (h = await this._registry.getEncryption(u), !h)) throw new l(i("error.io.encryptionUnavailable"));
3197
+ let g = `${o.getName() ?? i("workbook.defaultName")}.${a.exts[0]}`, v = r?.progress, y = !o.getPath() || !o.canWrite() || !!r?.prompt, x = !1, S = this, C = null, w = [], T = {
3061
3198
  workbook: e,
3062
3199
  format: a,
3063
- origin: s,
3064
- suggestedName: v,
3200
+ origin: o,
3201
+ suggestedName: g,
3065
3202
  prompt: r?.prompt,
3066
- async encode(t) {
3067
- await (async () => {
3068
- b || (b = !0, y?.onStart && await Promise.resolve(y.onStart(s)));
3069
- })(), S = e.getTransactions?.()?.getCurrentCommit() ?? S;
3070
- let n = t ? (await x._registry.getWriteFormats({ search: t }))[0] ?? a : a, i = await x._writeArrayBuffer(e, n, r);
3071
- return _ ? _.encode(i, g) : i;
3203
+ async encode(t, i) {
3204
+ let s = i ?? o;
3205
+ await (async (e) => {
3206
+ x || (x = !0, v?.onStart && await Promise.resolve(v.onStart(e)));
3207
+ })(s), C = e.getTransactions?.()?.getCurrentCommit() ?? C;
3208
+ let c = t ? (await S._registry.getWriteFormats({ search: t }))[0] ?? a : a, l = [], u = ((e, t) => ({
3209
+ onStart: e?.onStart ? (t, n) => e.onStart(t, n) : void 0,
3210
+ onProgress: e?.onProgress ? (t, n) => e.onProgress(t, n) : void 0,
3211
+ onError: e?.onError ? (t) => e.onError(t) : void 0,
3212
+ onComplete: e?.onComplete ? (t) => e.onComplete(t) : void 0,
3213
+ onWarning: (n, r) => {
3214
+ t.push({
3215
+ message: n ?? "",
3216
+ context: r
3217
+ }), e?.onWarning?.(n, r);
3218
+ }
3219
+ }))(v, l), d = await S._writeArrayBuffer(e, c, {
3220
+ ...r,
3221
+ progress: u
3222
+ }), f = $.get(s);
3223
+ if (l.some((e) => !f?.has(e.message)) && r?.onWarnings) {
3224
+ let t = await Promise.resolve(r.onWarnings({
3225
+ workbook: e,
3226
+ origin: s,
3227
+ warnings: l,
3228
+ save: n,
3229
+ canCancel: !y
3230
+ }));
3231
+ if (!y && !1 === t) return null;
3232
+ }
3233
+ return w = l, h ? h.encode(d, m) : d;
3072
3234
  }
3073
- }, w = null;
3235
+ }, E = null;
3074
3236
  try {
3075
3237
  let t = this.getBackingStore();
3076
3238
  if (!t.write) throw Error("The active backing store is read-only (no write implementation).");
3077
- if (w = await t.write(C), w) {
3078
- g !== void 0 && w instanceof z && (w.setPassword(g), w.update({ encryption: _ ? _.key : null }));
3079
- let t = S ?? e.getTransactions?.()?.getCurrentCommit() ?? null;
3239
+ if (E = await t.write(T), E) {
3240
+ if (m !== void 0 && E instanceof R && (E.setPassword(m), E.update({ encryption: h ? h.key : null })), w.length) {
3241
+ let e = $.get(E) ?? /* @__PURE__ */ new Set();
3242
+ for (let t of w) e.add(t.message);
3243
+ $.set(E, e);
3244
+ }
3245
+ n && E !== e.getOrigin() && rt(e.getOrigin())?.setOrigin(E);
3246
+ let t = C ?? e.getTransactions?.()?.getCurrentCommit() ?? null;
3080
3247
  this._emitter.notify("onWrite", {
3081
3248
  params: {
3082
3249
  workbook: e,
3083
- origin: w,
3250
+ origin: E,
3084
3251
  commitId: t?.getId() ?? null,
3085
- save: o
3252
+ save: n
3086
3253
  },
3087
3254
  transactional: !1
3088
3255
  });
3089
3256
  }
3090
- y?.onComplete && await Promise.resolve(y.onComplete(w));
3257
+ v?.onComplete && await Promise.resolve(v.onComplete(E));
3091
3258
  } catch (e) {
3092
3259
  let t = e instanceof Error ? e : Error(String(e));
3093
- throw y?.onError && await Promise.resolve(y.onError(t)), y?.onComplete && await Promise.resolve(y.onComplete(null)), t instanceof h ? t : Error(u("error.io.writeFailed", { reason: t.message }), { cause: e });
3260
+ throw v?.onError && await Promise.resolve(v.onError(t)), v?.onComplete && await Promise.resolve(v.onComplete(null)), t instanceof l ? t : Error(i("error.io.writeFailed", { reason: t.message }), { cause: e });
3094
3261
  }
3095
- return w;
3096
- }
3097
- async writeAs(e, t, n) {
3098
- if (!t) throw Error("A target must be provided for writeAs (use write(workbook) for a plain save).");
3099
- let r = e?.getOrigin?.();
3100
- if (!(r instanceof z)) return this.write(e, t, n);
3101
- let i = typeof t == "string" ? t : t.getPath(), a = i && D(i)?.toLowerCase() || null, o = a ? (await this._registry.getWriteFormats({ search: a }))[0]?.key ?? a : null, s = {
3102
- path: r.getPath(),
3103
- name: r.getName(),
3104
- format: r.getFormat(),
3105
- canWrite: r.canWrite()
3106
- };
3107
- r.update({
3108
- path: i,
3109
- name: typeof t == "string" ? null : t.getName(),
3110
- format: o,
3111
- canWrite: i != null
3112
- });
3113
- let c = null;
3114
- try {
3115
- c = await this.write(e, void 0, n);
3116
- } finally {
3117
- c || r.update(s);
3118
- }
3119
- return c;
3262
+ return E;
3120
3263
  }
3121
3264
  _stripExtension(e) {
3122
- let t = D(e);
3265
+ let t = b(e);
3123
3266
  return t ? e.slice(0, e.length - t.length - 1) : e;
3124
3267
  }
3125
3268
  _baseName(e) {
@@ -3139,19 +3282,22 @@ var Gt, Q = class e extends me {
3139
3282
  async _readArrayBuffer(e, t, n) {
3140
3283
  if (!e) throw Error("ArrayBuffer must be specified.");
3141
3284
  if (!t) throw Error("format must be specified.");
3142
- if (e.byteLength === 0) return new $(n?.createWorkbookOptions);
3143
- let r, i = t.handler;
3144
- if (!i) throw Error(`Unable to resolve a read handler for '${t.key}'.`);
3285
+ if (e.byteLength === 0) return new dn(n?.createWorkbookOptions);
3286
+ let r, a = t.handler;
3287
+ if (!a) throw Error(`Unable to resolve a read handler for '${t.key}'.`);
3145
3288
  try {
3146
- r = await i(e, n);
3289
+ r = await a(e, n);
3147
3290
  } catch (e) {
3148
- throw e instanceof h ? e : new h(u("error.io.readFailed", {
3291
+ throw e instanceof l ? e : new l(i("error.io.readFailed", {
3149
3292
  format: t.description ?? t.key,
3150
3293
  reason: e?.message ?? String(e)
3151
3294
  }), { cause: e });
3152
3295
  }
3153
3296
  return r;
3154
3297
  }
3298
+ get isIWorkbookIO() {
3299
+ return !0;
3300
+ }
3155
3301
  }();
3156
3302
  [
3157
3303
  ".woff2",
@@ -3162,13 +3308,21 @@ var Gt, Q = class e extends me {
3162
3308
  ].map((e) => ({
3163
3309
  suffix: e,
3164
3310
  place: (e, t) => t ? `${t}/${e}` : e
3165
- })), Rt ||= {}, zt ||= {};
3166
- var Zt = e({ nowWithPrecision: () => Qt });
3167
- function Qt(e = 6e4) {
3168
- return new Date(Math.floor(Date.now() / e) * e);
3169
- }
3170
- Gt ||= {};
3171
- var $t = class extends Re {
3311
+ })), Zt ||= {}, Qt ||= {}, (en = $t ||= {}).PathFill = {
3312
+ Darken: "darken",
3313
+ DarkenLess: "darkenLess",
3314
+ Lighten: "lighten",
3315
+ LightenLess: "lightenLess",
3316
+ None: "none",
3317
+ Normal: "normal"
3318
+ }, en.PresetGeometry = {
3319
+ Line: "line",
3320
+ LineInv: "lineInv",
3321
+ triangle: "triangle",
3322
+ rtTriangle: "rtTriangle",
3323
+ Rect: "rect"
3324
+ }, sn ||= {};
3325
+ var gn = class extends Ye {
3172
3326
  constructor(e) {
3173
3327
  super(e);
3174
3328
  }
@@ -3181,8 +3335,8 @@ var $t = class extends Re {
3181
3335
  colEnd: (e?.size?.width ?? 5) - 1,
3182
3336
  rowEnd: (e?.size?.height ?? 5) - 1
3183
3337
  },
3184
- getRanges: (e) => null
3338
+ getRanges: (e) => new Re(null)
3185
3339
  }, super._initializeOptions(e);
3186
3340
  }
3187
- };
3188
- export { Ke as _, bt as a, ot as c, lt as d, Pt as f, St as g, et as h, W as i, qe as l, $ as m, U as n, K as o, Nt as p, $t as r, Xt as s, Zt as t, z as u };
3341
+ }, _n = "0.8.0-beta.3";
3342
+ export { gn as _, Lt as a, R as c, hn as d, xt as f, dn as g, vt as h, nt as i, qt as l, ft as m, Jt as n, Ft as o, yt as p, tt as r, _n as s, wt as t, _t as u };