@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
@@ -0,0 +1,3342 @@
1
+ /**
2
+ * @license @sheetxl/studio-vanilla - SheetXL Studio - Vanilla entry point for integrating SheetXL UI. - v0.8.0-beta.3
3
+ *
4
+ * (C) 2026-present SheetXL Inc. & Michael T. Ford
5
+ * License: The license can be found at https://www.sheetxl.com/license.
6
+ */
7
+ import { C as e, K as t, L as n, M as r, P as i, a, b as o, i as s, k as c, l, n as u, p as d, q as f, w as p, x as m, z as h } from "./DB_I2ygTnDxYiYyc.mjs";
8
+ import { r as g } from "./S4MMwlNd4kcK3RDU.mjs";
9
+ import { i as _, t as v } from "./BSWXx2rKOMPxLLs8.mjs";
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 "./BH_qL-oGqwG-7JKF.mjs";
11
+ var et, tt = class extends i {
12
+ constructor(e, t = 50) {
13
+ super(t), this._transactions = e, this._floorId = e ? e.getCurrentCommit(!1).getId() : null, this._removeListener = e?.addListener({ onCommitChange: () => this._notifyOnStackChange() });
14
+ }
15
+ _undoCommits(e = this.maxStack) {
16
+ let t = this._transactions;
17
+ if (!t) return [];
18
+ let n = t.getLog(t.getCurrentCommit(!1).getId(), 2 ** 53 - 1), r = [];
19
+ for (let t = 0; t < n.length && r.length < e; t++) {
20
+ let e = n[t];
21
+ if (e.getId() === this._floorId || t === n.length - 1) break;
22
+ e.getDescription() && r.push(e);
23
+ }
24
+ return r;
25
+ }
26
+ _redoCommits(e = this.maxStack) {
27
+ let t = this._transactions;
28
+ if (!t) return [];
29
+ let n = t.getCurrentCommit(!1).getId(), r = t.getTipCommit().getId();
30
+ if (r === n) return [];
31
+ let i = t.getLog(r, 2 ** 53 - 1), a = [], o = !1;
32
+ for (let e of i) {
33
+ if (e.getId() === n) {
34
+ o = !0;
35
+ break;
36
+ }
37
+ a.push(e);
38
+ }
39
+ if (!o) return [];
40
+ a.reverse();
41
+ let s = [];
42
+ for (let t of a) if (t.getDescription() && s.push(t), s.length >= e) break;
43
+ return s;
44
+ }
45
+ undo(e = 1) {
46
+ let t = this._transactions;
47
+ if (!t) return;
48
+ let n = !1;
49
+ try {
50
+ for (let r = 0; r < e; r++) {
51
+ let [e] = this._undoCommits(1);
52
+ if (!e) break;
53
+ t.revert(e.getId()), n = !0;
54
+ }
55
+ } finally {
56
+ n && this._notifyOnStackChange();
57
+ }
58
+ }
59
+ redo(e = 1) {
60
+ let t = this._transactions;
61
+ if (!t) return;
62
+ let n = !1;
63
+ try {
64
+ for (let r = 0; r < e; r++) {
65
+ let [e] = this._redoCommits(1);
66
+ if (!e) {
67
+ r === 0 && this._repeatOperation?.repeat();
68
+ break;
69
+ }
70
+ t.restore(e.getId()), n = !0;
71
+ }
72
+ } finally {
73
+ n && this._notifyOnStackChange();
74
+ }
75
+ }
76
+ hasUndo() {
77
+ return this._undoCommits(1).length > 0;
78
+ }
79
+ hasRedo() {
80
+ return this._redoCommits(1).length > 0 || this._repeatOperation !== null;
81
+ }
82
+ getTopUndoDescription() {
83
+ return this._undoCommits(1)[0]?.getDescription() ?? null;
84
+ }
85
+ getTopRedoDescription() {
86
+ return this._repeatOperation === null ? this._redoCommits(1)[0]?.getDescription() ?? null : this._repeatOperation.description;
87
+ }
88
+ getUndoDescriptions() {
89
+ return this._undoCommits().map((e) => e.getDescription());
90
+ }
91
+ getRedoDescriptions() {
92
+ let e = this._redoCommits().map((e) => e.getDescription());
93
+ return e.length === 0 && this._repeatOperation !== null && e.push(this._repeatOperation.description), Object.freeze(e);
94
+ }
95
+ addUndoOperation() {
96
+ throw Error("TransactionUndoManager derives its stack from the commit log; commit a described transaction instead.");
97
+ }
98
+ clear(e = !0) {
99
+ this._transactions && (this._floorId = this._transactions.getCurrentCommit(!1).getId()), super.clear(e);
100
+ }
101
+ close() {
102
+ this._removeListener?.();
103
+ }
104
+ }, nt = class {
105
+ constructor(e, t) {
106
+ this._dirty = !1, this._store = e, this._savedCommitId = e.getCurrentCommit()?.getId() ?? null, this._emitter = new L(this);
107
+ let n = this;
108
+ this._removeStoreListener = e.addListener({
109
+ onCommitEnd() {
110
+ n._recompute();
111
+ },
112
+ onCommitChange() {
113
+ n._recompute();
114
+ }
115
+ }), this._removeCommitListener = t?.addCommitListener({ onCommit(e) {
116
+ e.store === n._store && n.markSaved(e.commitId);
117
+ } });
118
+ }
119
+ getStore() {
120
+ return this._store;
121
+ }
122
+ isDirty() {
123
+ return (this._store.getCurrentCommit()?.getId() ?? null) !== this._savedCommitId;
124
+ }
125
+ getSavedCommitId() {
126
+ return this._savedCommitId;
127
+ }
128
+ markSaved(e = this._store.getCurrentCommit()?.getId() ?? null) {
129
+ e !== this._savedCommitId && (this._savedCommitId = e ?? null, this._recompute());
130
+ }
131
+ addListeners(e, t) {
132
+ return this._emitter.addListeners(e, t);
133
+ }
134
+ _recompute() {
135
+ let e = this.isDirty();
136
+ e !== this._dirty && (this._dirty = e, this._emitter.notify(e ? "onDirty" : "onClean", { transactional: !1 }));
137
+ }
138
+ close() {
139
+ this._removeStoreListener?.(), this._removeCommitListener?.(), this._emitter.close();
140
+ }
141
+ };
142
+ et ||= {};
143
+ var R = class e {
144
+ constructor(t, n = {}) {
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;
146
+ }
147
+ static _defaultCanWrite(e) {
148
+ return !!e && !/^(https?:|data:|blob:)/i.test(e);
149
+ }
150
+ _cleanPath() {
151
+ return this._path ? this._path.split(/[?#]/)[0] : null;
152
+ }
153
+ getName() {
154
+ if (this._name !== null && this._name !== void 0) return this._name;
155
+ let e = this._cleanPath();
156
+ return e && O(e) || null;
157
+ }
158
+ getPath() {
159
+ return this._path;
160
+ }
161
+ getFormat() {
162
+ return this._format ? this._format : this.getExtension();
163
+ }
164
+ getExtension() {
165
+ let e = this._cleanPath();
166
+ if (!e) return null;
167
+ let t = b(e);
168
+ return t ? t.toLowerCase() : null;
169
+ }
170
+ getEncryption() {
171
+ return this._encryption;
172
+ }
173
+ isEncrypted() {
174
+ return this._encryption !== null || this._password !== null;
175
+ }
176
+ setPassword(e) {
177
+ this._password !== (e ?? null) && (this._password = e ?? null, this._password === null && (this._encryption = null), this._emitter.notify("onChange"));
178
+ }
179
+ getPassword() {
180
+ return this._password;
181
+ }
182
+ getSize() {
183
+ return this._size;
184
+ }
185
+ getLastModified() {
186
+ return this._lastModified;
187
+ }
188
+ canWrite() {
189
+ return this._canWrite;
190
+ }
191
+ setName(e) {
192
+ this.update({ name: e });
193
+ }
194
+ update(e) {
195
+ let t = !1;
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;
197
+ }
198
+ addListeners(e, t) {
199
+ return this._emitter.addListeners(e, t);
200
+ }
201
+ get [Symbol.toStringTag]() {
202
+ return "[Origin]";
203
+ }
204
+ toString() {
205
+ let e = this._cleanPath(), t = e ? e.split(/[/\\]/).pop() || e : this._name ?? "(unbound)", n = this._size;
206
+ if (n == null) return t;
207
+ if (n < 1024) return `${t} ${n}B`;
208
+ let r = Math.floor(Math.log(n) / Math.log(1024)), i = [
209
+ "B",
210
+ "KB",
211
+ "MB",
212
+ "GB",
213
+ "TB"
214
+ ];
215
+ return `${t} ${(n / 1024 ** r).toFixed(2)}${i[Math.min(r, i.length - 1)]}`;
216
+ }
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 {
237
+ constructor() {
238
+ this._defaultStringSourceType = "filepath";
239
+ }
240
+ async read(e) {
241
+ let t = e.options ?? {}, n = e.source;
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;
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") {
249
+ let e = typeof n == "string" && n.startsWith("file://") ? n.slice(7) : n;
250
+ n = await this.filePathToFile(e), o = "file", l = !0;
251
+ }
252
+ switch (o) {
253
+ case "file": {
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,
260
+ size: e.size,
261
+ lastModified: e.lastModified,
262
+ canWrite: !t.asCopy && (!!i || l && this._canWriteLocalPath())
263
+ };
264
+ break;
265
+ }
266
+ case "blob": {
267
+ let e = n;
268
+ s = await e.arrayBuffer(), c = {
269
+ format: a,
270
+ size: e.size
271
+ };
272
+ break;
273
+ }
274
+ case "base64": {
275
+ let e;
276
+ if (n && typeof n == "object" && "base64" in n) e = n.base64;
277
+ else if (typeof n == "string" && n.startsWith("data:")) {
278
+ let [, t] = n.split(",");
279
+ e = t;
280
+ } else e = n;
281
+ s = u.base64ToArrayBuffer(e), c = {
282
+ format: a,
283
+ size: e.length
284
+ };
285
+ break;
286
+ }
287
+ case "fetch": {
288
+ let e, t, r;
289
+ if (typeof n == "string") e = n;
290
+ else {
291
+ if (!n || typeof n != "object" || !("input" in n)) throw Error("Invalid fetch source provided.");
292
+ {
293
+ let i = n;
294
+ e = i.input, t = i.init, r = i.timeout;
295
+ }
296
+ }
297
+ let i = r || 3e4, o = new AbortController(), l = setTimeout(() => o.abort(), i), u = typeof e == "string" ? e : e.toString(), d = b(u);
298
+ try {
299
+ let n = await fetch(e, {
300
+ ...t,
301
+ signal: o.signal
302
+ });
303
+ if (clearTimeout(l), !n.ok) throw Error(`Failed to fetch: ${n.status} ${n.statusText}`);
304
+ let r = await n.arrayBuffer();
305
+ if (!r) throw Error(`Unable to fetched content: ${u}`);
306
+ s = r, c = {
307
+ format: a,
308
+ ext: d,
309
+ name: O(u, !0),
310
+ absolutePath: u
311
+ };
312
+ } catch (e) {
313
+ throw clearTimeout(l), e.name === "AbortError" ? Error(`Fetch timeout after ${i}ms: ${u}`) : e;
314
+ }
315
+ break;
316
+ }
317
+ case "buffer":
318
+ s = n, c = { format: a };
319
+ break;
320
+ case "stream": {
321
+ let e = n.getReader(), t = [], r = 0;
322
+ try {
323
+ for (;;) {
324
+ let { done: n, value: i } = await e.read();
325
+ if (n) break;
326
+ t.push(i), r += i.length;
327
+ }
328
+ } finally {
329
+ e.releaseLock();
330
+ }
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 };
334
+ break;
335
+ }
336
+ default: throw Error(`Unsupported source type: ${o}`);
337
+ }
338
+ c.canWrite && await this.findOpenOrigin(r, c) && (c.canWrite = !1);
339
+ let d = await e.decode(s, {
340
+ sourceType: o,
341
+ ...c
342
+ });
343
+ return d ? (await this.onWorkbookRead(d, r), d) : 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;
360
+ }
361
+ async resolveSource(e) {
362
+ return null;
363
+ }
364
+ async onWorkbookRead(e, t) {}
365
+ _canWriteLocalPath() {
366
+ return !1;
367
+ }
368
+ _detectSourceType(e) {
369
+ if (e && typeof e == "object" && "base64" in e) return "base64";
370
+ if (e && typeof e == "object" && "input" in e) return "fetch";
371
+ if (typeof e == "string") {
372
+ if (e.startsWith("data:")) return "base64";
373
+ if (e.startsWith("http://") || e.startsWith("https://")) return "fetch";
374
+ if (e.startsWith("file://")) return "filepath";
375
+ let t = this._defaultStringSourceType;
376
+ return e.startsWith("./") || e.startsWith("../") || e.startsWith("/") || /^[a-zA-Z]:[/\\]/.test(e), t;
377
+ }
378
+ if (typeof File < "u" && e instanceof File) return "file";
379
+ if (typeof Blob < "u" && e instanceof Blob) return "blob";
380
+ let t = e instanceof ArrayBuffer || Object.prototype.toString.call(e) === "[object ArrayBuffer]", n = ArrayBuffer.isView(e), r = u.isNodeBuffer(e);
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;
382
+ }
383
+ }, st = class extends ot {
384
+ constructor(e, t) {
385
+ super(), this._getWriteFormats = e, this._getReadFormats = t, this._defaultStringSourceType = "fetch", this._handleCache = /* @__PURE__ */ new WeakMap();
386
+ }
387
+ async fileFromHandle(e) {
388
+ return V(e) ? e.getFile() : null;
389
+ }
390
+ async resolveSource() {
391
+ let e = await this._getReadFormats?.() ?? [];
392
+ if (typeof globalThis.showOpenFilePicker == "function") try {
393
+ let t = function(e) {
394
+ let t = ct(e);
395
+ if (t.length <= 1) return t;
396
+ let n = /* @__PURE__ */ new Set(), r = {};
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));
398
+ return [{
399
+ description: "All Supported",
400
+ accept: r
401
+ }, ...t];
402
+ }(e), [n] = await globalThis.showOpenFilePicker(t.length ? { types: t } : void 0);
403
+ return n;
404
+ } catch (e) {
405
+ if (e?.name === "AbortError") return null;
406
+ throw e;
407
+ }
408
+ let t = e.flatMap((e) => e.exts.map((e) => "." + e)).join(", ");
409
+ return l.openFileDialog(t);
410
+ }
411
+ async findOpenOrigin(e) {
412
+ return V(e) ? this._findOpenHandle(e) : null;
413
+ }
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;
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);
426
+ }
427
+ async filePathToFile(e) {
428
+ throw Error(`Cannot read local file path '${e}' in browser environment. Use a file input element or fetch for remote URLs.`);
429
+ }
430
+ async write(e) {
431
+ let { origin: n, suggestedName: r, format: i, encode: a, prompt: s } = e, c = [i, ...(await this._getWriteFormats()).filter((e) => e.key !== i.key)], l = typeof globalThis.showSaveFilePicker == "function", u = !s && n.canWrite() ? this._handleCache.get(n) : void 0;
432
+ if (l) try {
433
+ if (u) {
434
+ let e = await async function(e) {
435
+ try {
436
+ if (typeof e.queryPermission != "function") return "granted";
437
+ let t = { mode: "readwrite" };
438
+ return await e.queryPermission(t) === "granted" || await e.requestPermission(t) === "granted" ? "granted" : "denied";
439
+ } catch {
440
+ return "unavailable";
441
+ }
442
+ }(u);
443
+ if (e === "denied") return null;
444
+ e !== "granted" && (u = void 0);
445
+ }
446
+ let s = !!u;
447
+ if (!s) {
448
+ u = await globalThis.showSaveFilePicker({
449
+ suggestedName: r,
450
+ types: ct(c)
451
+ });
452
+ let n = await this._findOpenHandle(u, e.workbook?.getOrigin?.());
453
+ if (n) throw new o(t("error.io.openElsewhere", { name: n.getName() ?? u.name ?? "" }));
454
+ }
455
+ let l = ut(u.name ?? r), d = c.find((e) => e.exts.some((e) => e.toLowerCase() === l)) ?? i, f = s ? n : new R(u.name ?? r, {
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;
469
+ } catch (e) {
470
+ if (e?.name === "AbortError") return null;
471
+ if (e instanceof o) throw e;
472
+ }
473
+ let d = n.getPath(), f = d ? d.split(/[/\\]/).pop() : null, p = f && i.exts.some((e) => e.toLowerCase() === ut(f)) ? f : r, m = d !== p || n.canWrite() ? new R(p, {
474
+ format: i.key,
475
+ canWrite: !1
476
+ }) : n, h = await a(i.key, m);
477
+ if (!h) return null;
478
+ let g = new Blob([lt(h)], { type: i.mimeType || "application/octet-stream" });
479
+ return function(e, t) {
480
+ let n = URL.createObjectURL(e), r = document.createElement("a");
481
+ r.style.display = "none", r.href = n, r.download = t, document.body.appendChild(r), r.click(), document.body.removeChild(r), URL.revokeObjectURL(n);
482
+ }(g, p), m instanceof R && m.update({ size: g.size }), m;
483
+ }
484
+ };
485
+ function ct(e) {
486
+ return e.map((e) => {
487
+ let t = e.mimeType && e.mimeType.includes("/") ? e.mimeType : "application/octet-stream";
488
+ return {
489
+ description: e.description ?? e.key,
490
+ accept: { [t]: e.exts.map((e) => "." + e) }
491
+ };
492
+ });
493
+ }
494
+ function V(e) {
495
+ return !!e && e.kind === "file" && typeof e.getFile == "function";
496
+ }
497
+ function lt(e) {
498
+ if (typeof SharedArrayBuffer < "u" && e instanceof SharedArrayBuffer) {
499
+ let t = new ArrayBuffer(e.byteLength);
500
+ return new Uint8Array(t).set(new Uint8Array(e)), t;
501
+ }
502
+ return e;
503
+ }
504
+ function ut(e) {
505
+ let t = e.lastIndexOf(".");
506
+ return t >= 0 ? e.slice(t + 1).toLowerCase() : "";
507
+ }
508
+ var dt = class {
509
+ constructor(e) {
510
+ this._private = { input: e }, typeof e == "string" ? this._private.name = e : Object.assign(this._private, e);
511
+ }
512
+ toJSON() {
513
+ return this._private.input;
514
+ }
515
+ getFamily() {
516
+ return this._private.name;
517
+ }
518
+ getPitch() {
519
+ return this._private.pitch;
520
+ }
521
+ getPanose() {
522
+ return this._private.panose;
523
+ }
524
+ toString() {
525
+ return typeof this._private.input == "string" ? this._private.input : JSON.stringify(this._private.input);
526
+ }
527
+ get isIFont() {
528
+ return !0;
529
+ }
530
+ }, ft = g({
531
+ findBestMatch: () => bt,
532
+ getFontList: () => gt,
533
+ setFontList: () => W
534
+ }), pt = [
535
+ "Arial",
536
+ "Arial Black",
537
+ "Brush Script MT",
538
+ "Calibri",
539
+ "Comic Sans MS",
540
+ "Courier New",
541
+ "Garamond",
542
+ "Georgia",
543
+ "Impact",
544
+ "Luminari",
545
+ "Palatino Linotype",
546
+ "Tahoma",
547
+ "Times New Roman",
548
+ "Trebuchet MS",
549
+ "Verdana"
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);
557
+ let t = [];
558
+ for (let n = 0; n < e.length; n++) {
559
+ let r = e[n];
560
+ typeof r == "string" && (r = new dt(r));
561
+ let i = !0;
562
+ try {
563
+ i = ht(`document.fonts.check('12px ${r.getFamily()}')`);
564
+ } catch {}
565
+ let a = {
566
+ fontRef: r,
567
+ loaded: i
568
+ };
569
+ t.push(a), U.set(r.getFamily(), a);
570
+ }
571
+ mt = Object.freeze(t);
572
+ }
573
+ function gt() {
574
+ return mt;
575
+ }
576
+ var _t, vt, G, yt, K = /* @__PURE__ */ new Map();
577
+ function bt(e, t) {
578
+ let n = K.get(e);
579
+ if (n) return n.fontRef === null ? null : n;
580
+ let r = [e];
581
+ t?.fallbacks && (r = r.concat(t.fallbacks));
582
+ let i = null;
583
+ for (let e = 0; !i && e < r.length; e++) {
584
+ let t = r[e];
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]);
588
+ }
589
+ }
590
+ return i ? K.set(e, i) : K.set(e, {
591
+ fontRef: null,
592
+ loaded: !1
593
+ }), i;
594
+ }
595
+ var xt = g({
596
+ DefaultFontSizes: () => St,
597
+ findNextFontSize: () => Ct
598
+ }), St = Object.freeze([
599
+ 8,
600
+ 9,
601
+ 10,
602
+ 11,
603
+ 12,
604
+ 14,
605
+ 16,
606
+ 18,
607
+ 20,
608
+ 22,
609
+ 24,
610
+ 26,
611
+ 28,
612
+ 30,
613
+ 36,
614
+ 48,
615
+ 72
616
+ ]);
617
+ function Ct(e, t = !0, n = St) {
618
+ if (!n || n.length === 0) return e;
619
+ if (e === void 0) return n[0];
620
+ if (t && e >= n[n.length - 1] || !t && e <= n[0]) return e;
621
+ let r = h.findEqualOrGreater(n, e);
622
+ return t ? (n[r] === e && (r += 1), n[r] || --r, n[r]) : (--r, n[r]);
623
+ }
624
+ (_t ||= {}).SortOn = {
625
+ Value: "value",
626
+ FillColor: "fillColor",
627
+ FontColor: "fontColor",
628
+ Icon: "icon"
629
+ }, (G = vt ||= {}).Compound = {
630
+ Single: "sng",
631
+ Double: "dbl",
632
+ ThickThin: "thickThin",
633
+ ThinThick: "thinThick",
634
+ Triple: "tri"
635
+ }, G.Align = {
636
+ Center: "ctr",
637
+ Inset: "in",
638
+ Outset: "outset"
639
+ }, G.LineCap = {
640
+ Butt: "butt",
641
+ Round: "round",
642
+ Square: "square"
643
+ }, G.LineJoin = {
644
+ Bevel: "bevel",
645
+ Miter: "miter",
646
+ Round: "round"
647
+ }, G.PresetMarkerShape = {
648
+ Single: "none",
649
+ Double: "double",
650
+ ThickThin: "thickThin",
651
+ ThinThick: "thinThick"
652
+ }, G.StrokeStyle = {
653
+ None: "none",
654
+ Dashed: "dashed",
655
+ Dotted: "dotted",
656
+ LargeDash: "lgDash",
657
+ LargeDashDot: "lgDashDot",
658
+ LargeDashDotDot: "lgDashDotDot",
659
+ Solid: "solid",
660
+ SysDash: "sysDash",
661
+ SysDashDot: "sysDashDot",
662
+ SysDashDotDot: "sysDashDotDot",
663
+ SysDot: "sysDot"
664
+ }, (yt ||= {}).Type = {
665
+ OuterShadow: "outerShadow",
666
+ InnerShadow: "innerShadow",
667
+ PresetShadow: "presetShadow",
668
+ Glow: "glow",
669
+ SoftEdge: "softEdge",
670
+ Reflection: "reflection"
671
+ };
672
+ var wt, Tt, Et, Dt, q = Oe.BuiltInName, Ot = {
673
+ [q.Normal]: p("style.builtin.normal"),
674
+ [q.Comma]: p("style.builtin.comma"),
675
+ [q.Currency]: p("style.builtin.currency"),
676
+ [q.Percent]: p("style.builtin.percent"),
677
+ [q.Comma0]: p("style.builtin.comma0"),
678
+ [q.Currency0]: p("style.builtin.currency0"),
679
+ [q.Hyperlink]: p("style.builtin.hyperlink"),
680
+ [q.FollowedHyperlink]: p("style.builtin.followedHyperlink"),
681
+ [q.Note]: p("style.builtin.note"),
682
+ [q.WarningText]: p("style.builtin.warningText"),
683
+ [q.Title]: p("style.builtin.title"),
684
+ [q.Input]: p("style.builtin.input"),
685
+ [q.Output]: p("style.builtin.output"),
686
+ [q.Calculation]: p("style.builtin.calculation"),
687
+ [q.CheckCell]: p("style.builtin.checkCell"),
688
+ [q.LinkedCell]: p("style.builtin.linkedCell"),
689
+ [q.Total]: p("style.builtin.total"),
690
+ [q.Good]: p("style.builtin.good"),
691
+ [q.Bad]: p("style.builtin.bad"),
692
+ [q.Neutral]: p("style.builtin.neutral"),
693
+ [q.ExplanatoryText]: p("style.builtin.explanatoryText")
694
+ }, kt = p("style.builtin.heading"), At = p("style.builtin.accent"), jt = p("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];
697
+ if (t) return { key: t };
698
+ let n = Mt.exec(e);
699
+ return n ? {
700
+ key: kt,
701
+ params: { n: +n[1] }
702
+ } : (n = Nt.exec(e), n ? {
703
+ key: At,
704
+ params: { n: +n[1] }
705
+ } : (n = Pt.exec(e), n ? {
706
+ key: jt,
707
+ params: {
708
+ pct: +n[1],
709
+ n: +n[2]
710
+ }
711
+ } : null));
712
+ }
713
+ var It = (e, n, r, i, a) => {
714
+ let o = JSON.parse(JSON.stringify(e.definition));
715
+ o.adjs ||= [];
716
+ let s = "", c = 0, l = 0;
717
+ n > 0 ? (l = n, c = 100 - n, s = t("op.lighterPercent", { percent: n })) : n < 0 && (c = 100 + n, s = t("op.darkerPercent", { percent: -n })), 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
+ }, r), d = u.toString();
722
+ i?.set(d, u);
723
+ let f = u.toRGBA().toString();
724
+ return a?.set(f, u), {
725
+ description: e.description + ", " + s,
726
+ definition: o
727
+ };
728
+ };
729
+ function Lt(e) {
730
+ let t, n = e.trim();
731
+ if (!n) return;
732
+ try {
733
+ let e = ze.shared().tokenize(n, !1);
734
+ if (e.errors.length > 0) return;
735
+ t = e.tokens;
736
+ } catch {
737
+ return;
738
+ }
739
+ let r = 0, i = 0;
740
+ if (t.length === 2) {
741
+ let e = t[0].tokenType?.name;
742
+ e === "MinOp" ? (r = -1, i = 1) : e === "PlusOp" && (r = 1, i = 1);
743
+ }
744
+ if (t.length - i !== 1) return;
745
+ let a = t[i], o = a.image;
746
+ try {
747
+ switch (a.tokenType?.name) {
748
+ case "NumberToken":
749
+ case "ScientificDigit":
750
+ case "DigitToken": {
751
+ let e = Te(o).value;
752
+ return r === 0 ? e : r * e;
753
+ }
754
+ case "StringToken": return r === 0 ? ae(o).value : void 0;
755
+ case "BooleanToken": return r === 0 ? ve(o).value : void 0;
756
+ case "LiteralError":
757
+ case "RefError": return r === 0 ? w(o).value : void 0;
758
+ default: return;
759
+ }
760
+ } catch {
761
+ return;
762
+ }
763
+ }
764
+ function Rt(e, t) {
765
+ let n = zt(e), r = zt(t);
766
+ return n === r ? e === t ? 0 : typeof e == "number" && typeof t == "number" ? e < t ? -1 : 1 : typeof e == "string" && typeof t == "string" ? e < t ? -1 : +(e > t) : typeof e == "boolean" ? e ? 1 : -1 : _.isError(e) && _.isError(t) ? e.getCode() - t.getCode() : 0 : n - r;
767
+ }
768
+ function zt(e) {
769
+ if (e === null) return 0;
770
+ switch (typeof e) {
771
+ case "number": return 1;
772
+ case "string": return 2;
773
+ case "boolean": return 3;
774
+ default: return _.isError(e) ? 4 : 5;
775
+ }
776
+ }
777
+ (wt ||= {}).buildPalette = function(e, t, n, r) {
778
+ let i = [];
779
+ for (let a = 0; a < e.length; a++) {
780
+ let o = [];
781
+ i.push(o);
782
+ let s = (i) => {
783
+ for (let s = 0; s < i.length; s++) o.push(It(e[a], i[s], t, n, r));
784
+ }, c = new Ce({
785
+ val: e[a].definition.val,
786
+ adjs: e[a].definition.adjs
787
+ }, t).toHSLA().lum;
788
+ s(c === 0 ? [
789
+ 50,
790
+ 35,
791
+ 25,
792
+ 15,
793
+ 5
794
+ ] : c === 100 ? [
795
+ -5,
796
+ -15,
797
+ -25,
798
+ -35,
799
+ -50
800
+ ] : c <= 20 ? [
801
+ 90,
802
+ 75,
803
+ 50,
804
+ 25,
805
+ 10
806
+ ] : c >= 80 ? [
807
+ -10,
808
+ -25,
809
+ -50,
810
+ -75,
811
+ -90
812
+ ] : [
813
+ 80,
814
+ 60,
815
+ 40,
816
+ -25,
817
+ -50
818
+ ]);
819
+ }
820
+ return i;
821
+ }, Tt ||= {}, Et ||= {}, Dt ||= {};
822
+ var Bt = class {
823
+ constructor(e) {
824
+ this._children = e;
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
+ }
839
+ getSize() {
840
+ let e = this._children, t = e.length, n = 0;
841
+ for (let r = 0; r < t; r++) n += e[r].getSize();
842
+ return n;
843
+ }
844
+ getCount() {
845
+ let e = this._children, t = e.length, n = 0;
846
+ for (let r = 0; r < t; r++) n += e[r].getCount();
847
+ return n;
848
+ }
849
+ getAggregates(e) {
850
+ if (e) return this._mergeAggregates(e);
851
+ let t = this._aggregates;
852
+ return t || (t = this._mergeAggregates(), this._aggregates = t), t;
853
+ }
854
+ getSnappedSum(e) {
855
+ let t = e ?? this.getAggregates().sum ?? 0, n = this._children;
856
+ for (let e = n.length - 1; e >= 0; e--) if (n[e].getAggregates().numericalCount > 0) return n[e].getSnappedSum(t);
857
+ return t;
858
+ }
859
+ getSortedNumbers() {
860
+ let e = this._sortedNumbers;
861
+ if (!e) {
862
+ let t = this._children, n = t.length, r = [];
863
+ for (let e = 0; e < n; e++) {
864
+ let n = t[e].getSortedNumbers().getValues();
865
+ n.length > 0 && r.push(n);
866
+ }
867
+ e = new fe(function(e) {
868
+ let t = e.length;
869
+ if (t === 0) return Vt;
870
+ if (t === 1) return e[0];
871
+ let n = e[0];
872
+ for (let r = 1; r < t; r++) n = Ht(n, e[r]);
873
+ return Object.freeze(n);
874
+ }(r)), this._sortedNumbers = e;
875
+ }
876
+ return e;
877
+ }
878
+ getRanked(e) {
879
+ return se(this._children, e, Rt)[Symbol.iterator]();
880
+ }
881
+ getFrequencies(e) {
882
+ if (e) return this._mergeFrequencies(e);
883
+ let t = this._frequencies;
884
+ return t || (t = this._mergeFrequencies(), this._frequencies = t), t;
885
+ }
886
+ _mergeFrequencies(e) {
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;
888
+ for (let l = 0; l < a; l++) {
889
+ let a = i[l].getFrequencies(e);
890
+ o += a.getVisitedCount(), s += a.getTotalCount(), c ||= a.isTruncated();
891
+ let u = a.getValueCounts(), d = u.next();
892
+ for (; !d.done;) {
893
+ let [e, i] = d.value, a = t(e), o = r.get(a);
894
+ o ? o.count += i : n === void 0 || r.size < n ? r.set(a, {
895
+ value: e,
896
+ count: i
897
+ }) : c = !0, d = u.next();
898
+ }
899
+ }
900
+ return re.fromGroups(r, t, e, Rt, o, s, c);
901
+ }
902
+ getTypedCounts(e) {
903
+ let t = this._typedCounts;
904
+ if (!t) {
905
+ let e = {
906
+ [v.Number]: 0,
907
+ [v.String]: 0,
908
+ [v.Boolean]: 0,
909
+ [v.Error]: 0,
910
+ [v.RichData]: 0,
911
+ [v.Null]: 0
912
+ }, n = this._children, r = n.length;
913
+ for (let t = 0; t < r; t++) {
914
+ let r = n[t].getTypedCounts();
915
+ e[v.Number] += r[v.Number] ?? 0, e[v.String] += r[v.String] ?? 0, e[v.Boolean] += r[v.Boolean] ?? 0, e[v.Error] += r[v.Error] ?? 0, e[v.RichData] += r[v.RichData] ?? 0, e[v.Null] += r[v.Null] ?? 0;
916
+ }
917
+ t = Object.freeze(e), this._typedCounts = t;
918
+ }
919
+ if (e === void 0) return t;
920
+ let n = {}, r = e.length;
921
+ for (let i = 0; i < r; i++) n[e[i]] = t[e[i]] ?? 0;
922
+ return n;
923
+ }
924
+ get isIRangeStats() {
925
+ return !0;
926
+ }
927
+ _mergeAggregates(e) {
928
+ let t = this._children, n = t.length, r = {
929
+ count: 0,
930
+ min: void 0,
931
+ max: void 0,
932
+ numericalCount: 0,
933
+ sum: 0,
934
+ sumSq: 0,
935
+ typed: {
936
+ [v.Number]: 0,
937
+ [v.String]: 0,
938
+ [v.Boolean]: 0,
939
+ [v.Error]: 0,
940
+ [v.RichData]: 0,
941
+ [v.Null]: 0
942
+ }
943
+ };
944
+ for (let i = 0; i < n; i++) {
945
+ let n = t[i].getAggregates(e);
946
+ r.count += n.count;
947
+ let a = n.numericalCount;
948
+ a <= 0 || (r.numericalCount += a, r.sum += n.sum, r.sumSq += n.varP * a + n.sum * n.sum / a, (r.min === void 0 || n.min < r.min) && (r.min = n.min), (r.max === void 0 || n.max > r.max) && (r.max = n.max));
949
+ }
950
+ return He(r);
951
+ }
952
+ }, Vt = Object.freeze([]);
953
+ function Ht(e, t) {
954
+ let n = e.length, r = t.length, i = Array(n + r), a = 0, o = 0, s = 0;
955
+ for (; a < n && o < r;) i[s++] = e[a] <= t[o] ? e[a++] : t[o++];
956
+ for (; a < n;) i[s++] = e[a++];
957
+ for (; o < r;) i[s++] = t[o++];
958
+ return i;
959
+ }
960
+ var Ut = class {
961
+ constructor(e, t) {
962
+ this._deleted = !1, this._json = { ...e }, this._deleteFromCollection = t ?? null;
963
+ }
964
+ getId() {
965
+ return this._json.id;
966
+ }
967
+ getDisplayName() {
968
+ return this._json.displayName;
969
+ }
970
+ getUserId() {
971
+ return this._json.userId ?? null;
972
+ }
973
+ getProviderId() {
974
+ return this._json.providerId ?? null;
975
+ }
976
+ delete() {
977
+ this._deleted || (this._deleted = !0, this._deleteFromCollection?.(this));
978
+ }
979
+ isDeleted() {
980
+ return this._deleted;
981
+ }
982
+ toJSON() {
983
+ return { ...this._json };
984
+ }
985
+ get [Symbol.toStringTag]() {
986
+ return "[Person]";
987
+ }
988
+ toString() {
989
+ return `Person:${this.getDisplayName()}`;
990
+ }
991
+ get isIPerson() {
992
+ return !0;
993
+ }
994
+ }, Wt = class extends Ke {
995
+ constructor(e) {
996
+ super(), this._byId = /* @__PURE__ */ new Map(), this._byDisplayName = /* @__PURE__ */ new Map(), this._items = null, this._current = null, e && this.fromJSON(e);
997
+ }
998
+ _getItems() {
999
+ return this._items ??= Array.from(this._byId.values());
1000
+ }
1001
+ getCount() {
1002
+ return this._byId.size;
1003
+ }
1004
+ add(e) {
1005
+ let t = typeof e == "string" ? { displayName: e } : e, n = t.id;
1006
+ if (n) {
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;
1014
+ }
1015
+ let i = new Ut({
1016
+ ...t,
1017
+ displayName: r,
1018
+ id: n ?? h.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;
1040
+ }
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());
1043
+ }
1044
+ toJSON() {
1045
+ return this._byId.size === 0 ? null : this._getItems().map((e) => e.toJSON());
1046
+ }
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
+ }
1054
+ }
1055
+ get isIPersonCollection() {
1056
+ return !0;
1057
+ }
1058
+ }, Gt = class {
1059
+ constructor(e) {
1060
+ this._options = e, this._emitter = new L(this), this._initState();
1061
+ }
1062
+ _initState() {}
1063
+ getModules() {
1064
+ return this._modules;
1065
+ }
1066
+ _builtInNames() {
1067
+ try {
1068
+ let e = this._options.getBuiltInFunctions?.();
1069
+ if (!e) return h.EmptyArray;
1070
+ let t = [];
1071
+ for (let n of e.getItems()) n.isBuiltIn() && t.push(n.getName());
1072
+ return t;
1073
+ } catch {
1074
+ return h.EmptyArray;
1075
+ }
1076
+ }
1077
+ async createModule(e) {
1078
+ let t = await (await import("./ByQakLd0YFwc0Lgl.mjs").then((e) => e.n)).ScriptCompiler.compile({
1079
+ builtInNames: this._builtInNames(),
1080
+ ...e
1081
+ });
1082
+ return t.module ? await A(S.DEFAULT_MODULE, t.module, e?.declarationsOnly ?? !1, t.diagnostics) : null;
1083
+ }
1084
+ addModule(e, t, n) {
1085
+ this._modules.add(e, t, n);
1086
+ }
1087
+ async addModuleFromJSON(e, t, n) {
1088
+ let r = await A(e, t);
1089
+ return this.addModule(e, r, n), r;
1090
+ }
1091
+ executeMacro(e, t, n) {
1092
+ let r = this._modules.getItems({ name: t }), i = r.length;
1093
+ for (let t = 0; t < i; t++) {
1094
+ let i = r[t].getFunctions().getByName(e);
1095
+ if (i) return i.execute(this._options.workbook, {
1096
+ applyResult: !0,
1097
+ ...n
1098
+ });
1099
+ }
1100
+ throw Error(`No macro ${e} found.`);
1101
+ }
1102
+ async run(e, t) {
1103
+ try {
1104
+ let n = typeof e == "string" ? await this.createModule({ source: e }) : await A(S.DEFAULT_MODULE, e), r = typeof e == "string" ? e : e?.source ?? "";
1105
+ return await this._runModule(n, r, t);
1106
+ } catch (e) {
1107
+ return {
1108
+ ok: !1,
1109
+ error: e
1110
+ };
1111
+ }
1112
+ }
1113
+ async _runModule(e, t, n) {
1114
+ let r = this._options?.workbook;
1115
+ if (!e) return {
1116
+ ok: !1,
1117
+ error: Error("The script did not compile to a module.")
1118
+ };
1119
+ let i = e.getDiagnostics(), a = i.filter((e) => e.severity === "error");
1120
+ if (a.length > 0) {
1121
+ let e = Error(((e, t) => {
1122
+ let n = [0];
1123
+ for (let t = 0; t < e.length; t++) e[t] === "\n" && n.push(t + 1);
1124
+ let r = t.map((e) => ` ${((e) => {
1125
+ let t = 0, r = n.length - 1;
1126
+ for (; t < r;) {
1127
+ let i = t + r + 1 >> 1;
1128
+ n[i] <= e ? t = i : r = i - 1;
1129
+ }
1130
+ return `${t + 1}:${e - n[t] + 1}`;
1131
+ })(e.start)} ${e.code}: ${e.message}`), i = t.length;
1132
+ return `Script has ${i} compile error${i === 1 ? "" : "s"}:\n${r.join("\n")}`;
1133
+ })(t, a));
1134
+ return e.diagnostics = a, {
1135
+ ok: !1,
1136
+ error: e,
1137
+ diagnostics: i
1138
+ };
1139
+ }
1140
+ let o = e.getFunctions(), s = (await o.search({ type: "autoRun" }))[0] ?? (await o.search({ type: "macro" }))[0] ?? null;
1141
+ if (!s) return {
1142
+ ok: !1,
1143
+ error: Error("The script has no runnable entry. Export a default function taking the script context, e.g. `export default function run(ctx: IScript.ScriptContext) { ... }` (the workbook is `ctx.wb`; a macro may instead take its target first, e.g. `(sheet: ISheet, ctx)`).")
1144
+ };
1145
+ let c = await s.execute(r, n);
1146
+ return {
1147
+ ok: !0,
1148
+ result: c?.results,
1149
+ commitId: c?.commitId,
1150
+ diagnostics: i
1151
+ };
1152
+ }
1153
+ async _searchable(e) {
1154
+ let t = [];
1155
+ if (e?.includeBuiltIn) {
1156
+ await this._options.workbook?.getCalculation()?.start();
1157
+ let e = this._options.getBuiltInFunctions?.();
1158
+ e && t.push(e);
1159
+ }
1160
+ let n = this._modules;
1161
+ if (!n || n.getCount() === 0) return t;
1162
+ let r = e?.moduleName, i = r ? n.getItems({ name: r }) : n.getItems(), a = i.length;
1163
+ for (let e = 0; e < a; e++) t.push(i[e].getFunctions());
1164
+ return t;
1165
+ }
1166
+ async searchFunctions(e) {
1167
+ await this._emitter.notify("onBeforeSearch", { async: !0 });
1168
+ let t = await this._searchable(e);
1169
+ if (t.length === 0) return h.EmptyArray;
1170
+ let n, r = e?.limit, i = r === void 0 ? e : {
1171
+ ...e,
1172
+ limit: void 0
1173
+ }, a = /* @__PURE__ */ new Set();
1174
+ for (let e = 0; e < t.length; e++) {
1175
+ let r = await t[e].search(i);
1176
+ if (r.length !== 0) {
1177
+ n ||= [];
1178
+ for (let e = 0; e < r.length; e++) {
1179
+ let t = r[e], i = t.getName().toUpperCase();
1180
+ a.has(i) || (a.add(i), n.push(t));
1181
+ }
1182
+ }
1183
+ }
1184
+ if (!n || n.length === 0) return h.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;
1187
+ }
1188
+ async getFunctionCategories(e) {
1189
+ await this._emitter.notify("onBeforeSearch", { async: !0 });
1190
+ let t = await this._searchable(e);
1191
+ if (t.length === 0) return h.EmptyArray;
1192
+ if (t.length === 1) return t[0].getCategories(e);
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, {
1196
+ name: e,
1197
+ count: 1
1198
+ });
1199
+ };
1200
+ for (let n of await t[0].getCategories(e)) r.set(n.name.toUpperCase(), {
1201
+ name: n.name,
1202
+ count: n.count
1203
+ });
1204
+ for (let r = 1; r < t.length; r++) {
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;
1208
+ for (let e = 0; e < r && !c; e++) c = !!t[e].getByName(s);
1209
+ if (c) continue;
1210
+ let l = await o.getDescriptor().catch(() => null);
1211
+ !n && l?.isDeprecated() || i(l?.getCategory() ?? "Uncategorized");
1212
+ }
1213
+ }
1214
+ let a = Array.from(r.values());
1215
+ return a.sort((e, t) => e.name.localeCompare(t.name)), a;
1216
+ }
1217
+ async start() {
1218
+ if (!this._modules) return this._startPromise || (this._startPromise = this._doStart(), this._startPromise.catch(() => {
1219
+ this._startPromise = void 0;
1220
+ })), this._startPromise;
1221
+ }
1222
+ async _doStart() {
1223
+ let e = this._options?.workbook, t = this._options?.json, n = {};
1224
+ if (t) {
1225
+ let r = Object.keys(t);
1226
+ for (let i = 0; i < r.length; i++) {
1227
+ let o = r[i], s = t[o];
1228
+ try {
1229
+ n[o] = await A(o, s, !1, [], s?.scope === "workbook" ? e : null);
1230
+ } catch (e) {
1231
+ a.error(`Could not load script '${o}'; it will be unavailable.`, e);
1232
+ }
1233
+ }
1234
+ }
1235
+ let r = this, i = new ce({
1236
+ transactions: this._options?.transactions,
1237
+ initial: n,
1238
+ isReadOnly: () => r.isReadOnly(),
1239
+ onRemove: (e, t) => {
1240
+ r._options?.onRemove?.(e, t);
1241
+ },
1242
+ onAdd: (e, t) => {
1243
+ r._emitter.notify("onChange"), r._options?.onAdd?.(e, t);
1244
+ }
1245
+ });
1246
+ this._modules = i;
1247
+ let o = i.getItems();
1248
+ if (o.length === 0) return Promise.resolve(h.EmptyArray);
1249
+ let s = o.length;
1250
+ for (let t = 0; t < s; t++) {
1251
+ let n = o[t];
1252
+ try {
1253
+ let t = await n.getFunctions().search({ type: "autoRun" }), r = t.length;
1254
+ for (let n = 0; n < r; n++) await t[n].execute(e);
1255
+ } catch (e) {
1256
+ a.error("Error executing autoRun script:", e);
1257
+ }
1258
+ }
1259
+ }
1260
+ addListeners(e, t) {
1261
+ return this._emitter.addListeners(e, t);
1262
+ }
1263
+ isReadOnly() {
1264
+ return this._options.workbook?._isStructureProtected?.() ?? !1;
1265
+ }
1266
+ toJSON() {
1267
+ this._emitter.notify("onBeforeSave");
1268
+ let e = this._modules;
1269
+ if (!e) throw Error("Scripts is initializing.");
1270
+ return e.toJSON();
1271
+ }
1272
+ get isIScript() {
1273
+ return !0;
1274
+ }
1275
+ }, Kt = class {
1276
+ constructor(e, t, n, r) {
1277
+ this._mergedReading = [], this._colsReading = [], this._rowsReading = [], this._styles = n, this._topLeft = t ?? d.EmptyCell, this._sheet = new y({
1278
+ runtime: e,
1279
+ styles: this._styles,
1280
+ calcOnLoad: "none",
1281
+ container: {
1282
+ getName: () => r,
1283
+ getIndex: () => 1
1284
+ }
1285
+ }), this._builder = this._sheet.getEntireRange().createSparseBuilder();
1286
+ }
1287
+ applyCSSStyle(e, t) {
1288
+ let n = !1;
1289
+ e.style || (e.style = {}, n = !0);
1290
+ let r = e.style, i = { ...t };
1291
+ if (t.msoIgnore) {
1292
+ let e = t.msoIgnore.split(","), n = Object.keys(i);
1293
+ for (let t = 0; t < n.length; t++) {
1294
+ let r = n[t];
1295
+ e.includes(r) && delete i[r];
1296
+ }
1297
+ }
1298
+ let a = ne(i.fontFamily);
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;
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);
1302
+ let s = null;
1303
+ if (i.background ? s = i.background : i.backgroundColor && (s = i.backgroundColor), s && (r.fill = { color: s }), i.msoPattern) {
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));
1306
+ }
1307
+ i.layoutFlow === "vertical" || i.layoutFlow === "vertical-ideographic" ? r.alignment.stacked = !0 : i.msoRotate !== void 0 && (r.alignment.rotation = me(i.msoRotate));
1308
+ let c = (e, t) => {
1309
+ e && (r.borders ||= {}, r.borders[e] = t);
1310
+ };
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);
1312
+ let l = r.numberFormat;
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;
1314
+ }
1315
+ onCell(e, t, n, r, i) {
1316
+ let a = r(i), o = { value: t === void 0 ? n ?? "" : t };
1317
+ if (typeof o.value == "string" && o.value.length === 0 && (o.value = void 0), a && this.applyCSSStyle(o, a), i?.tagName.toUpperCase() === "TD") {
1318
+ let e = o.style, t = e?.font ?? {};
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);
1320
+ let n = i.querySelectorAll("a");
1321
+ if (n.length > 0) {
1322
+ let e = n[0].getAttribute("href");
1323
+ e && (o.hyperlink = e);
1324
+ }
1325
+ }
1326
+ if (!d.isSingleCell(e)) {
1327
+ let t = {
1328
+ rowStart: this._topLeft.rowIndex + e.rowStart,
1329
+ colStart: this._topLeft.colIndex + e.colStart,
1330
+ rowEnd: this._topLeft.rowIndex + e.rowEnd,
1331
+ colEnd: this._topLeft.colIndex + e.colEnd
1332
+ };
1333
+ this._mergedReading.push(t);
1334
+ }
1335
+ if (o.value === void 0 && !o.style && Object.keys(o).length <= 1) return;
1336
+ let s = this._builder, c = this._topLeft;
1337
+ if (s.pushAt(c.rowIndex + e.rowStart, c.colIndex + e.colStart, o), !d.isSingleCell(e) && a.msoIgnore) {
1338
+ if (a.msoIgnore.includes("colspan")) {
1339
+ let t = {};
1340
+ a && this.applyCSSStyle(t, a);
1341
+ let n = e.colEnd - e.colStart, r = c.rowIndex + e.rowStart;
1342
+ for (let i = 1; i <= n; i++) s.pushAt(r, c.colIndex + e.colStart + i, t);
1343
+ e = {
1344
+ ...e,
1345
+ colEnd: e.colStart
1346
+ };
1347
+ }
1348
+ a.msoIgnore.includes("rowspan") && (e = {
1349
+ ...e,
1350
+ rowEnd: e.rowStart
1351
+ });
1352
+ }
1353
+ }
1354
+ onNoTable(e, t, n) {
1355
+ this.onCell({
1356
+ rowStart: this._topLeft.rowIndex,
1357
+ colStart: this._topLeft.colIndex,
1358
+ rowEnd: this._topLeft.rowIndex,
1359
+ colEnd: this._topLeft.colIndex
1360
+ }, e, null, t, n);
1361
+ }
1362
+ onRowStart(e, t, n, r) {
1363
+ let i = n(r);
1364
+ if (i.msoHeightSource !== "userset" || !r) return;
1365
+ let a = r.getAttribute("height") ?? i.height, o = null;
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");
1368
+ i !== null && (o = Math.max(i, o ?? 0));
1369
+ }
1370
+ o !== null && this._rowsReading.push({
1371
+ address: {
1372
+ min: this._topLeft.rowIndex + e,
1373
+ max: this._topLeft.rowIndex + e + t - 1
1374
+ },
1375
+ update: { size: o * P.getDeviceScale() }
1376
+ });
1377
+ }
1378
+ onColumn(e, t, n, r) {
1379
+ let i = n(r);
1380
+ if (i.msoWidthSource !== "userset" || !r) return;
1381
+ let a = r.getAttribute("width") ?? i.width, o = null;
1382
+ a && (o = k(a, this._styles.getNormal().getFont().getSize(), "px")), o !== null && this._colsReading.push({
1383
+ address: {
1384
+ min: this._topLeft.colIndex + e,
1385
+ max: this._topLeft.colIndex + e + t - 1
1386
+ },
1387
+ update: { size: o * P.getDeviceScale() }
1388
+ });
1389
+ }
1390
+ onDone() {
1391
+ this._colsReading.length > 0 && this._sheet.getColumnHeaders().updateHeaderPairs(this._colsReading), this._rowsReading.length > 0 && this._sheet.getRowHeaders().updateHeaderPairs(this._rowsReading), this._sheet.doBatch(() => {
1392
+ this._builder.apply();
1393
+ }), this._mergedReading.length > 0 && this._sheet.getRanges(this._mergedReading).merge();
1394
+ }
1395
+ sheet() {
1396
+ return this._sheet;
1397
+ }
1398
+ }, qt = class {
1399
+ constructor(t) {
1400
+ if (!t) throw new e("snapshot is required.");
1401
+ this._snapshot = t;
1402
+ }
1403
+ getItemType() {
1404
+ return "range";
1405
+ }
1406
+ getItem() {
1407
+ return this._snapshot;
1408
+ }
1409
+ editMode() {
1410
+ return this._snapshot?.getMarkOptions().editMode ?? null;
1411
+ }
1412
+ isCut() {
1413
+ return this._snapshot?.getMarkOptions().isCut ?? !1;
1414
+ }
1415
+ getName() {
1416
+ return this._snapshot.getName();
1417
+ }
1418
+ toText() {
1419
+ return this._snapshot.toText();
1420
+ }
1421
+ toHtml() {
1422
+ return this._snapshot.toHtml();
1423
+ }
1424
+ toImage() {
1425
+ return this._snapshot.toImage();
1426
+ }
1427
+ get isClipboardItem() {
1428
+ return !0;
1429
+ }
1430
+ }, Jt = class {
1431
+ constructor(t, n, r, i, a) {
1432
+ if (this._parsed = void 0, this._runtime = t, !n) throw new e("nativeItems are required.");
1433
+ this._topLeft = r ?? d.EmptyCell, this._native = n, this._markOptions = Object.freeze(i ?? {}), this._styles = a;
1434
+ }
1435
+ getItemType() {
1436
+ return "range";
1437
+ }
1438
+ isCut() {
1439
+ return !1;
1440
+ }
1441
+ toText() {
1442
+ return this._native?.text;
1443
+ }
1444
+ toHtml() {
1445
+ return this._native?.html?.documentElement.outerHTML || null;
1446
+ }
1447
+ toImage() {
1448
+ return this._native?.image;
1449
+ }
1450
+ getItem() {
1451
+ let e = this._parsed;
1452
+ if (e === void 0) throw Error("Must call 'parse()' before getItem().");
1453
+ if (e === null) return null;
1454
+ if (this._snapshot) return this._snapshot;
1455
+ let t = this;
1456
+ return this._snapshot = {
1457
+ copyTo: (n, r) => e.copyTo(n, {
1458
+ ...t._markOptions,
1459
+ ...r
1460
+ }),
1461
+ getMarkOptions: () => t._markOptions,
1462
+ getName: () => e?.getName() ?? "Clipboard Data",
1463
+ getCoords: () => e?.getCoords?.() ?? null,
1464
+ toText: () => t.toText(),
1465
+ toHtml: () => t.toHtml(),
1466
+ toImage: () => t.toImage(),
1467
+ getSource: () => e?.getSource?.() ?? null,
1468
+ isISnapshot: !0
1469
+ }, this._snapshot;
1470
+ }
1471
+ async parse() {
1472
+ let e, t = this._native?.text, r = this._native.html;
1473
+ if (r === null && t && t.includes("<table")) try {
1474
+ let e = new DOMParser().parseFromString(t, n.Html), i = e.querySelector("parsererror");
1475
+ if (i) throw new o("Unable to parse: " + i);
1476
+ r = e, t = null;
1477
+ } catch {
1478
+ console.warn("Discovered text as html table but could could not parse.");
1479
+ }
1480
+ try {
1481
+ let n, i = new Kt(this._runtime, this._topLeft, this._styles, r ? "HTML" : "Text"), a = await Promise.resolve(t ? Ee(t) : [[]]);
1482
+ if (ke(r, a, i) ? (e = i.sheet(), n = e.getUsedRange()) : r = null, n) return this._parsed = {
1483
+ copyTo: async (e, t) => (await e.copyFrom(n, t))?.getCoords() ?? null,
1484
+ getCoords: () => n.getCoords(),
1485
+ getSource: () => e,
1486
+ getName: () => e.getName()
1487
+ }, !0;
1488
+ } catch (e) {
1489
+ throw e;
1490
+ }
1491
+ if (!t && !r && this._native.image) {
1492
+ let e = this;
1493
+ return this._parsed = {
1494
+ async copyTo(t, n) {
1495
+ let r = t.getSheet(), i = await e._native.image.arrayBuffer(), a = await r.getMovables().addPicture({ source: { buffer: i } }, {
1496
+ type: "picture",
1497
+ description: p("op.copyImageFromClipboard")
1498
+ });
1499
+ return r.getView().selectMovables([a]), null;
1500
+ },
1501
+ getName: () => "Image"
1502
+ }, !0;
1503
+ }
1504
+ return this._parsed = null, !1;
1505
+ }
1506
+ get isClipboardItem() {
1507
+ return !0;
1508
+ }
1509
+ }, J = {
1510
+ showFormulaBar: !0,
1511
+ showTabs: !0,
1512
+ tabRatio: 600,
1513
+ showHorizontalScrollbar: !0,
1514
+ showVerticalScrollbar: !0,
1515
+ showStatusBar: !0,
1516
+ activeSheetId: 0
1517
+ }, Yt = class {
1518
+ constructor(e) {
1519
+ this._id = h.uuidV4(), this._emitter = new L(this), this._state = { ...J }, e?.json && this._fromJSON(e?.json);
1520
+ }
1521
+ getId() {
1522
+ return this._id;
1523
+ }
1524
+ isShowFormulaBar() {
1525
+ return this._state.showFormulaBar;
1526
+ }
1527
+ setShowFormulaBar(e) {
1528
+ return this._state.showFormulaBar = e, this._emitter.notify("onViewChange"), this;
1529
+ }
1530
+ isShowTabs() {
1531
+ return this._state.showTabs;
1532
+ }
1533
+ setShowTabs(e) {
1534
+ return this._state.showTabs = e, this._emitter.notify("onViewChange"), this;
1535
+ }
1536
+ getTabRatio() {
1537
+ return this._state.tabRatio;
1538
+ }
1539
+ setTabRatio(e) {
1540
+ return this._state.tabRatio = e, this._emitter.notify("onViewChange"), this;
1541
+ }
1542
+ isShowHorizontalScrollbar() {
1543
+ return this._state.showHorizontalScrollbar;
1544
+ }
1545
+ setShowHorizontalScrollbar(e) {
1546
+ return this._state.showHorizontalScrollbar = e, this._emitter.notify("onViewChange"), this;
1547
+ }
1548
+ isShowVerticalScrollbar() {
1549
+ return this._state.showVerticalScrollbar;
1550
+ }
1551
+ setShowVerticalScrollbar(e) {
1552
+ return this._state.showVerticalScrollbar = e, this._emitter.notify("onViewChange"), this;
1553
+ }
1554
+ isShowStatusBar() {
1555
+ return this._state.showStatusBar;
1556
+ }
1557
+ setShowStatusBar(e) {
1558
+ return this._state.showStatusBar = e, this._emitter.notify("onViewChange"), this;
1559
+ }
1560
+ getActiveSheetId() {
1561
+ return this._state.activeSheetId;
1562
+ }
1563
+ setActiveSheetId(e) {
1564
+ let t = this._state, n = t.activeSheetId;
1565
+ return t.activeSheetId = e, n !== e && this._emitter.notify("onViewChange"), this;
1566
+ }
1567
+ addListeners(e, t) {
1568
+ return this._emitter.addListeners(e, t);
1569
+ }
1570
+ toJSON() {
1571
+ let e = {}, t = Object.keys(this._state), n = t.length;
1572
+ for (let r = 0; r < n; r++) {
1573
+ let n = t[r], i = this._state[n];
1574
+ i != null && i !== J[n] && (e[n] = i);
1575
+ }
1576
+ return Object.keys(e).length === 0 && (e = null), e;
1577
+ }
1578
+ _fromJSON(e, t = !0) {
1579
+ let n = e || {};
1580
+ this.update(n, t);
1581
+ }
1582
+ update(e, t = !0) {
1583
+ this._state = {
1584
+ ...J,
1585
+ ...this._state,
1586
+ ...e
1587
+ }, t && this._emitter.notify("onViewChange");
1588
+ }
1589
+ get [Symbol.toStringTag]() {
1590
+ return "[WorkbookView]";
1591
+ }
1592
+ toString() {
1593
+ let e = this.toJSON();
1594
+ return e ? JSON.stringify(e) : "DefaultWorkbookView";
1595
+ }
1596
+ get isIWorkbookView() {
1597
+ return !0;
1598
+ }
1599
+ }, Xt = Object.freeze({
1600
+ structure: !1,
1601
+ windows: !1,
1602
+ revision: !1,
1603
+ password: null,
1604
+ revisionsPassword: null
1605
+ }), Y = class extends oe {
1606
+ isWindowsAllowed() {
1607
+ return this._isPropertyAllowed("windows");
1608
+ }
1609
+ isRevisionAllowed() {
1610
+ return this._isPropertyAllowed("revision");
1611
+ }
1612
+ isStructureAllowed() {
1613
+ return this._isPropertyAllowed("structure");
1614
+ }
1615
+ _getAllowedKey() {
1616
+ return "workbook";
1617
+ }
1618
+ _fromJSON(e) {
1619
+ this._properties = e;
1620
+ }
1621
+ _toJSON(e) {
1622
+ let t = this._properties;
1623
+ if (t) {
1624
+ let n = Object.keys(t), r = n.length;
1625
+ for (let i = 0; i < r; i++) {
1626
+ let r = n[i], a = t[r];
1627
+ a != null && a !== Xt[r] && (e[r] = a);
1628
+ }
1629
+ }
1630
+ return super._toJSON(e);
1631
+ }
1632
+ get [Symbol.toStringTag]() {
1633
+ return "[WorkbookProtection]";
1634
+ }
1635
+ get isIWorkbookProtection() {
1636
+ return !0;
1637
+ }
1638
+ };
1639
+ function X(e) {
1640
+ return t("error.workbook.invalidSheetKey", { key: e });
1641
+ }
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;
1645
+ }
1646
+ add(e) {
1647
+ return this._add(e);
1648
+ }
1649
+ _getItems(e) {
1650
+ return this._get(e?.name, e?.visibility);
1651
+ }
1652
+ getByName(e) {
1653
+ return this._get(e)?.[0] ?? null;
1654
+ }
1655
+ addListeners(e, t) {
1656
+ return this._addListeners(e, t);
1657
+ }
1658
+ get isISheetCollection() {
1659
+ return !0;
1660
+ }
1661
+ }, Z = /* @__PURE__ */ new RegExp(/[\\/\\*?:[\]]+/), nn = /* @__PURE__ */ new RegExp(/\(((\d+)(?!.*\d))\)$/, "g");
1662
+ function rn(e) {
1663
+ let n = t(p("workbook.defaultSheetName"), { n: e + 1 });
1664
+ return n === "workbook.defaultSheetName" ? `Sheet${e + 1}` : n;
1665
+ }
1666
+ function an(e, t) {
1667
+ return {
1668
+ ...te,
1669
+ getSheet: () => null,
1670
+ toString: () => N(e, t)
1671
+ };
1672
+ }
1673
+ function on(e, n = !1) {
1674
+ if (!e) throw Error(t("error.workbook.sheetNameBlank"));
1675
+ if (Z.test(e)) {
1676
+ if (!n) throw Error(function(e) {
1677
+ return e ? t("error.workbook.sheetNameInvalidCharsNamed", { sheetName: e }) : t("error.workbook.sheetNameInvalidChars");
1678
+ }(e));
1679
+ e = e.replace(Z, "");
1680
+ }
1681
+ if (e.length === 0) throw Error(t("error.workbook.sheetNameBlank"));
1682
+ let r = e.length;
1683
+ if (r > 31) {
1684
+ if (!n) throw Error(t("error.workbook.sheetNameTooLong"));
1685
+ e = e.substring(0, 31);
1686
+ }
1687
+ if (e.charAt(0) === "'" || e.charAt(r - 1) === "'") {
1688
+ if (!n) throw Error(t("error.workbook.sheetNameQuotes"));
1689
+ e = e.replace(/^'|'$/g, "");
1690
+ }
1691
+ return e;
1692
+ }
1693
+ var sn, cn = "workbook.activeSheet", Q = class e extends ee {
1694
+ constructor(e, t, n, r) {
1695
+ super(e, t, r), this._workbook = n;
1696
+ }
1697
+ getSource() {
1698
+ return this._workbook;
1699
+ }
1700
+ _createRanges(t, n) {
1701
+ let r = this._options;
1702
+ return n && (r = {
1703
+ ...this._options,
1704
+ getOptions: E(this._options?.getOptions, n)
1705
+ }), new e(t, this._internal, this._workbook, r);
1706
+ }
1707
+ _createRange(e, t) {
1708
+ let n = e ? { ...e } : null, r = n ? this._workbook._getSheetRef(n.scope, F.Visibility.VeryHidden) : null;
1709
+ if (!r) {
1710
+ let e = this._workbook.getSelectedSheet();
1711
+ return delete n?.scope, an(n, n ? {
1712
+ scope: T,
1713
+ ...e.getEntireRange().getCoords()
1714
+ } : null);
1715
+ }
1716
+ let i = this._options;
1717
+ return t && (i = {
1718
+ ...this._options,
1719
+ getOptions: E(this._options.getOptions, t)
1720
+ }), new ln(e, j(r.sheet), this._workbook, i);
1721
+ }
1722
+ async select(e) {
1723
+ let t = [], n = null, r = this.getCoords();
1724
+ for (let e = 0; e < r.length; e++) {
1725
+ let i = r[e];
1726
+ i && (n ||= i.scope, i && i.scope === n && t.push(i));
1727
+ }
1728
+ n ||= this._workbook.getSelectedSheet().getName();
1729
+ let i = this._workbook.getSheets().getByName(n);
1730
+ if (!i) return;
1731
+ let a = await i.getRanges(t).select(e), o = this._workbook._rangesAddressToCoords(a.getCoords());
1732
+ return this._createRanges(o);
1733
+ }
1734
+ addListener(e, t) {
1735
+ if (!this.getCoords()) return () => {};
1736
+ let n = this._workbook._sheetToWBEvent(e);
1737
+ return super.addListener(n, t);
1738
+ }
1739
+ get [Symbol.toStringTag]() {
1740
+ return "[WorkbookRanges]";
1741
+ }
1742
+ getAddress(e) {
1743
+ let t = this._internal.getSheet(), n = t.getEntireRange().getCoords();
1744
+ return je(this.getCoords(), {
1745
+ ...n,
1746
+ scope: t.getName()
1747
+ }, N, he, e);
1748
+ }
1749
+ toString() {
1750
+ return this.getAddress();
1751
+ }
1752
+ }, ln = class e extends De {
1753
+ constructor(e, t, n, r) {
1754
+ super(e, t, r), this._workbook = n;
1755
+ }
1756
+ _createRanges(e, t) {
1757
+ let n = this._options;
1758
+ return t && (n = {
1759
+ ...this._options,
1760
+ getOptions: E(this._options?.getOptions, t)
1761
+ }), new Q(e, this._internal, this._workbook, n);
1762
+ }
1763
+ _createRange(t, n) {
1764
+ let r = this._internal;
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);
1767
+ let i = this._options;
1768
+ return n && (i = {
1769
+ ...this._options,
1770
+ getOptions: E(this._options?.getOptions, n)
1771
+ }), new e(t, this._internal, this._workbook, i);
1772
+ }
1773
+ addListener(e, t) {
1774
+ if (!this.getCoords()) return () => {};
1775
+ let n = this._workbook._sheetToWBEvent(e);
1776
+ return super.addListener(n, t);
1777
+ }
1778
+ get [Symbol.toStringTag]() {
1779
+ return "[WorkbookRange]";
1780
+ }
1781
+ getAddress(e) {
1782
+ let t = this._internal.getSheet(), n = t?.getEntireRange().getCoords() ?? null;
1783
+ return N(this.getCoords(), {
1784
+ ...n,
1785
+ scope: t.getName()
1786
+ });
1787
+ }
1788
+ toString() {
1789
+ return this.getAddress();
1790
+ }
1791
+ }, un = (e) => !!e && typeof e == "object" && typeof e.getOrigin == "function", dn = class {
1792
+ constructor(e) {
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;
1811
+ let t = typeof e == "string" ? { origin: e } : { ...e }, n = t.origin;
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", {
1815
+ isDate1904: () => this._isDate1904,
1816
+ getNow: () => this._transactions.getCurrentCommit().getTimestamp(),
1817
+ getLocale: () => this._locale ?? ye() ?? Se(),
1818
+ getLocaleOverrides: () => this._localeOverrides
1819
+ }), this._listenerLanguage = c.addChangeListener(() => {
1820
+ this._closed || this._notifyAllChange();
1821
+ });
1822
+ let i = this, a = this._beginCommit({ description: p(r ? "op.openWorkbook" : "op.newWorkbook") });
1823
+ try {
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;
1825
+ let e = t.createSheetCallback;
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),
1840
+ container: {
1841
+ beforeFromJSON: (e) => {
1842
+ c = e, i._addSheetRef({
1843
+ name: n,
1844
+ id: t,
1845
+ visibility: r ?? F.Visibility.Visible,
1846
+ sheetId: o,
1847
+ sheet: e
1848
+ }, a);
1849
+ },
1850
+ getName: () => {
1851
+ let e = i._getSheetRef(c);
1852
+ return e ? e.name : n;
1853
+ },
1854
+ setName: (e, t) => {
1855
+ i._getSheetRef(c) && i._setSheetName(c, e, t);
1856
+ },
1857
+ setNameChangeCallback: (e) => {
1858
+ i._sheetOnNameChange.set(t, e);
1859
+ },
1860
+ getVisibility: () => {
1861
+ let e = i._getSheetRef(c);
1862
+ return e ? e.visibility : F.Visibility.Visible;
1863
+ },
1864
+ setVisibility: (e, t) => {
1865
+ i._setSheetVisibility(c, e, t);
1866
+ },
1867
+ setVisibilityCallback: (e) => {
1868
+ i._sheetOnVisibilityChange.set(t, e);
1869
+ },
1870
+ duplicate: () => i._duplicateSheet(c),
1871
+ getIndex: () => {
1872
+ let e = i._getSheetRef(c);
1873
+ return e ? i._getOffsetForId(e.id, i._getSheetRefs(F.Visibility.VeryHidden)) : a;
1874
+ },
1875
+ setIndex: (e, t) => {
1876
+ let n = i._getSheetRef(c, F.Visibility.VeryHidden);
1877
+ return !!n && (i._moveSheet(n, e, t), !0);
1878
+ },
1879
+ setIndexCallback: (e) => {
1880
+ i._sheetOnIndexChange.set(t, e);
1881
+ },
1882
+ requestSelect: async () => (i._setSelectedSheet(c), await this._emitter.notify("onRequestSelect", {
1883
+ source: i,
1884
+ params: c,
1885
+ async: !0
1886
+ }), i.getSelectedSheet() === c)
1887
+ }
1888
+ };
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() : h.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] : h.EmptyArray
1899
+ }), this._ownNames = !t.names, this._calculation = t.calculation ?? new Ge({
1900
+ runtime: i._runtime,
1901
+ functions: t.functions,
1902
+ json: r?.calc,
1903
+ isNamesReadOnly: () => i._isStructureProtected(),
1904
+ getActiveCell: () => {
1905
+ let e = i.getSelectedSheet(), t = e?.getSelectedRange()?.getCoords();
1906
+ return t ? {
1907
+ rowIndex: t.rowStart,
1908
+ colIndex: t.colStart,
1909
+ scope: e.getId()
1910
+ } : null;
1911
+ },
1912
+ getRange: i.getRange.bind(i),
1913
+ getRanges: i.getRanges.bind(i),
1914
+ createGraphRanges: (e, t) => i._createGraphRanges(e, t),
1915
+ getSheetIndex: (e) => {
1916
+ if (e === void 0) {
1917
+ let e = i.getSelectedSheet();
1918
+ return e ? this._getSheetRefs(F.Visibility.VeryHidden).findIndex((t) => t.sheet === e) : -1;
1919
+ }
1920
+ let t = this._getSheetRefs(F.Visibility.VeryHidden);
1921
+ e = e.toLowerCase();
1922
+ let n = t.length;
1923
+ for (let r = 0; r < n; r++) if (t[r].name.toLowerCase() === e) return r;
1924
+ try {
1925
+ fn.address = e;
1926
+ let t = this._names.getItems(fn);
1927
+ if (!t || t.length === 0) return -1;
1928
+ let n = t[0].getRanges?.()?.getCoords()?.[0]?.scope;
1929
+ if (!n) return -1;
1930
+ let r = this._getSheetRefs(F.Visibility.VeryHidden);
1931
+ n = n.toLowerCase();
1932
+ let i = r.length;
1933
+ for (let e = 0; e < i; e++) if (r[e].name.toLowerCase() === n) return e;
1934
+ } catch {
1935
+ return -1;
1936
+ }
1937
+ return -1;
1938
+ },
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),
1944
+ getSheetById: (e) => {
1945
+ let t = i.getSheets().getItems({ visibility: F.Visibility.VeryHidden }), n = t.length;
1946
+ for (let r = 0; r < n; r++) if (t[r].getId() === e) return t[r];
1947
+ return null;
1948
+ },
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) => {
1965
+ if (e) {
1966
+ let n = this._getSheetRef(e, t);
1967
+ return n ? [n.sheet] : h.EmptyArray;
1968
+ }
1969
+ return this._getSheets(t);
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();
1981
+ } catch (e) {
1982
+ throw a.rollback(), e;
1983
+ }
1984
+ this._initializing = !1;
1985
+ }
1986
+ _initState() {
1987
+ let e = this._getSheetRefs();
1988
+ for (let t = (e ? e.length : 0) - 1; t >= 0; t--);
1989
+ let t = this._options;
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) => {
1991
+ n._emitter.notify("onProtectionChange");
1992
+ } });
1993
+ let n = this;
1994
+ this._transactionsRemoveListener = this._transactions.addStateListener(this._id, {
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;
1999
+ try {
2000
+ n._emitter.notify("onSheetsChange");
2001
+ } finally {
2002
+ n._restoringSheets = !1;
2003
+ }
2004
+ }
2005
+ n._emitter.notify("onSelectedSheetChange"), n._emitter.notify("onViewChange");
2006
+ },
2007
+ onRestoreOrRevert() {
2008
+ n._ownCalculation, n._emitter.notify("onInvalidated");
2009
+ }
2010
+ });
2011
+ let r = this._getState();
2012
+ r?.listenersSheets && (r?.listenersSheets.forEach((e) => {
2013
+ e();
2014
+ }), r?.listenersSheets.clear()), this._updateState({
2015
+ sheetRefsAll: [],
2016
+ sheetRefsVisibleAndHidden: [],
2017
+ sheetRefsVisible: [],
2018
+ refsById: /* @__PURE__ */ new Map(),
2019
+ sheetsById: /* @__PURE__ */ new Map(),
2020
+ refsByLowerCaseName: /* @__PURE__ */ new Map(),
2021
+ sheetsByLowerCaseName: /* @__PURE__ */ new Map(),
2022
+ refsByInstance: /* @__PURE__ */ new Map(),
2023
+ lastId: -1,
2024
+ sheetsCreated: /* @__PURE__ */ new Set(),
2025
+ listenersSheets: /* @__PURE__ */ new Map()
2026
+ });
2027
+ }
2028
+ getId() {
2029
+ return this._id;
2030
+ }
2031
+ getVersionId() {
2032
+ return this._transactions.getVersionId(this._id);
2033
+ }
2034
+ getName() {
2035
+ return this._closed ? null : this._origin.getName();
2036
+ }
2037
+ getOrigin() {
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
+ } });
2054
+ }
2055
+ getView() {
2056
+ return this._view;
2057
+ }
2058
+ setView(e) {
2059
+ if (this._closed) throw Error(t("error.workbook.modelClosed"));
2060
+ if (!e) throw new o(t("error.sheet.emptyView"));
2061
+ this._listenerWorkbookView?.();
2062
+ let n = this, r = -1;
2063
+ return this._listenerWorkbookView = e.addListeners({ onViewChange: (e) => {
2064
+ let t = n._getState(), i = this._view.getActiveSheetId(), a = t.sheetRefsVisible, o = this._getOffsetForId(i, a);
2065
+ this._activeSheetOffset = o, n._emitter.notify("onViewChange"), r !== i && (n._emitter.notify("onSelectionChange"), n._emitter.notify("onSelectedSheetChange")), r = i;
2066
+ } }), this._view = e, n._emitter.notify("onViewChange"), this;
2067
+ }
2068
+ getRuntime() {
2069
+ return this._runtime;
2070
+ }
2071
+ setDate1904(e) {
2072
+ if (this._closed) throw Error(t("error.workbook.modelClosed"));
2073
+ return this._isDate1904 === e || (this._isDate1904 = e, this._emitter.notify("onRegionalChange")), this;
2074
+ }
2075
+ getLocale() {
2076
+ return this._runtime.getLocale();
2077
+ }
2078
+ getPinnedLocale() {
2079
+ return this._locale;
2080
+ }
2081
+ setLocale(e) {
2082
+ if (this._closed) throw Error(t("error.workbook.modelClosed"));
2083
+ if (e) try {
2084
+ new Intl.Locale(e);
2085
+ } catch {
2086
+ throw Error(t("error.workbook.invalidLocale", { locale: e }));
2087
+ }
2088
+ return this._locale === e || (this._locale = e, this._emitter.notify("onRegionalChange")), this;
2089
+ }
2090
+ getLocaleOverrides() {
2091
+ return this._localeOverrides;
2092
+ }
2093
+ setLocaleOverrides(e) {
2094
+ if (this._closed) throw Error(t("error.workbook.modelClosed"));
2095
+ let n = e && Object.keys(e).length > 0 ? e : null;
2096
+ return this._localeOverrides = n, this._emitter.notify("onRegionalChange"), this;
2097
+ }
2098
+ getStyles() {
2099
+ return this._styles;
2100
+ }
2101
+ getResources() {
2102
+ return this._resources;
2103
+ }
2104
+ getTransactions() {
2105
+ return this._transactions;
2106
+ }
2107
+ getStrings() {
2108
+ return this._strings;
2109
+ }
2110
+ getExternalBooks() {
2111
+ return this._calculation.getExternalBooks();
2112
+ }
2113
+ getUpdateLinks() {
2114
+ return this._updateLinks;
2115
+ }
2116
+ setUpdateLinks(e) {
2117
+ if (this._closed) throw Error(t("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;
2128
+ }
2129
+ getTheme() {
2130
+ return this._theme;
2131
+ }
2132
+ setTheme(e) {
2133
+ if (this._closed) throw Error(t("error.workbook.modelClosed"));
2134
+ if (!e) throw new o(t("error.workbook.notSetValue"));
2135
+ let n = this._theme;
2136
+ return this._theme = e, this.getStyles().setTheme(e), this._emitter.notify("onThemeChange"), n;
2137
+ }
2138
+ getSelectedSheetIndex() {
2139
+ return this._activeSheetOffset;
2140
+ }
2141
+ getSelectedSheet() {
2142
+ let e = this._getSheetRef(this.getSelectedSheetIndex());
2143
+ return e ? e?.sheet : null;
2144
+ }
2145
+ getSheet(e, n = F.Visibility.Visible) {
2146
+ if (e === void 0) return this.getSelectedSheet();
2147
+ if (!e) throw Error(t("error.workbook.sheetNameNotProvided"));
2148
+ let r = this._getSheetRef(e, n);
2149
+ if (!r) throw new f(t("error.workbook.sheetNameNotFound", { sheetName: e }));
2150
+ return r.sheet;
2151
+ }
2152
+ getSheetAt(e, n = F.Visibility.Visible) {
2153
+ let r = this._getSheetRef(e, n);
2154
+ if (!r) throw new f(function(e) {
2155
+ return t("error.workbook.sheetIndexNotFound", { index: e });
2156
+ }(e));
2157
+ return r.sheet;
2158
+ }
2159
+ getSheets() {
2160
+ return this._sheets;
2161
+ }
2162
+ addSheet(e) {
2163
+ return this.getSheets().add(e);
2164
+ }
2165
+ _getSheets(e = F.Visibility.Visible) {
2166
+ let t = this._getSheetRefs(e), n = [], r = t.length;
2167
+ for (let e = 0; e < r; e++) n.push(t[e].sheet);
2168
+ return n;
2169
+ }
2170
+ _getSheetRefs(e = F.Visibility.Visible) {
2171
+ let t = this._getState();
2172
+ return t ? e === F.Visibility.Visible ? t.sheetRefsVisible : e === F.Visibility.Hidden ? t.sheetRefsVisibleAndHidden : e === F.Visibility.VeryHidden ? t.sheetRefsAll : h.EmptyArray : [];
2173
+ }
2174
+ _getSheetRef(e, t = F.Visibility.Visible) {
2175
+ let n = null;
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);
2177
+ }
2178
+ _validateNewSheetName(e, n = !0) {
2179
+ if (e == null) return e;
2180
+ if (on(e), n && this._getState().sheetsByLowerCaseName.has(e.toLowerCase())) throw new o(t("error.workbook.nameTaken"));
2181
+ return e.substring(0, 31);
2182
+ }
2183
+ findValidSheetName(e) {
2184
+ e &&= on(e, !0);
2185
+ try {
2186
+ return function(e, t) {
2187
+ try {
2188
+ if (t(e)) return e;
2189
+ } catch {}
2190
+ let n, r, i = nn.exec(e);
2191
+ for (i === null ? (n = e + " ", r = 1) : (n = e.substring(0, i.index), r = parseFloat(i[1])); r < 256;) {
2192
+ r++;
2193
+ let e = "(" + r + ")", i = n.substring(0, 31 - e.length) + e;
2194
+ try {
2195
+ if (t(i)) return i;
2196
+ } catch {}
2197
+ }
2198
+ throw Error(e + " is not a valid sheet name");
2199
+ }(e, (e) => this._validateNewSheetName(e));
2200
+ } catch {
2201
+ return this._nextSheetName();
2202
+ }
2203
+ }
2204
+ isValidSheetNameCharacter(e) {
2205
+ return !Z.test(e);
2206
+ }
2207
+ _isStructureProtected() {
2208
+ return !this._initializing && !this.getProtection().isStructureAllowed();
2209
+ }
2210
+ _addSheetOptions(e) {
2211
+ if (this._closed) throw Error(t("error.workbook.modelClosed"));
2212
+ if (!this.getProtection().isStructureAllowed()) throw new r(t("error.workbook.protection"));
2213
+ let n, i = null;
2214
+ n = typeof e == "string" ? { name: e } : typeof e == "number" ? { index: e } : e, n = {
2215
+ ...n,
2216
+ description: n?.description ?? p("op.addSheet")
2217
+ };
2218
+ let a = this.beginCommit(n);
2219
+ try {
2220
+ let e = n?.autoSelect ?? !1;
2221
+ i = this._addSheet(!0, n.name, n.index ?? null);
2222
+ let r = this.getView().getActiveSheetId();
2223
+ if (e && this._recordActiveSheet(a, r, this._getSheetRef(i).id), a.commit({ description: t("op.addSheetNamed", { name: i.getName() }) }), !1 !== e) {
2224
+ let t = typeof e == "boolean" ? void 0 : e;
2225
+ i.select(t);
2226
+ }
2227
+ } catch (e) {
2228
+ throw a.rollback(), e;
2229
+ }
2230
+ return i;
2231
+ }
2232
+ _nextSheetName(e = null) {
2233
+ let n = e ? e.toLowerCase() : null, r = this._getState(), i = r.sheetsByLowerCaseName;
2234
+ if (e && i.has(n)) throw new o(function(e) {
2235
+ return t("error.workbook.nameDuplicate", { sheetName: e });
2236
+ }(e));
2237
+ n = (e = this._validateNewSheetName(e)) ? e.toLowerCase() : null;
2238
+ let a = r.lastId + 1;
2239
+ for (; !e;) {
2240
+ let t = this._createSheetName(a), n = t.toLowerCase();
2241
+ i.has(n) ? a++ : e = t;
2242
+ }
2243
+ return this._updateState({ lastId: a }), e;
2244
+ }
2245
+ _addSheet(e, n = null, r = null) {
2246
+ n = this._nextSheetName(n);
2247
+ let i = this._getState(), a = this._createSheet(i.lastId, n, F.Visibility.Visible, r, void 0, null);
2248
+ if (!a) throw new o(t("error.workbook.sheetNameBlank"));
2249
+ return e && this._emitter.notify("onSheetsChange"), a;
2250
+ }
2251
+ _updateSheetRefStates(e) {
2252
+ if (this._closed) throw Error(t("error.workbook.modelClosed"));
2253
+ if (!this._initializing && !this.getProtection().isStructureAllowed()) throw new r(t("error.workbook.protection"));
2254
+ let n = e, i = [], a = [], o = n.length;
2255
+ for (let e = 0; e < o; e++) n[e].visibility === F.Visibility.Visible ? (i.push(n[e]), a.push(n[e])) : n[e].visibility === F.Visibility.Hidden && a.push(n[e]);
2256
+ this._updateState({
2257
+ sheetRefsAll: n,
2258
+ sheetRefsVisible: i,
2259
+ sheetRefsVisibleAndHidden: a
2260
+ });
2261
+ }
2262
+ _addSheetRef(e, n = null) {
2263
+ let r = this._getState(), i = r.sheetRefsAll, a = Math.max(0, Math.min(i.length, n ?? i.length)), o = [
2264
+ ...i.slice(0, a),
2265
+ e,
2266
+ ...i.slice(a)
2267
+ ];
2268
+ this._updateSheetRefStates(o);
2269
+ let s = e.sheet, c = e.name.toLowerCase(), l = new Map(r.refsById);
2270
+ l.set(e.id, e);
2271
+ let u = new Map(r.refsByLowerCaseName);
2272
+ u.set(c, e);
2273
+ let d = new Map(r.refsByInstance);
2274
+ d.set(s, e);
2275
+ let f = new Map(r.sheetsById);
2276
+ f.set(e.id, s);
2277
+ let p = new Map(r.sheetsByLowerCaseName);
2278
+ p.set(c, s);
2279
+ let m = this, h = r.listenersSheets;
2280
+ if (s !== void 0) {
2281
+ let n = s.addListeners({
2282
+ onBeforeDelete: (e) => {
2283
+ m._validateDeleteSheet(e);
2284
+ },
2285
+ onDelete(e) {
2286
+ let n = m._getSheetRef(e, F.Visibility.VeryHidden);
2287
+ if (!n) return;
2288
+ let r = m._beginCommit({ description: t("op.deleteSheet", { name: n.name }) });
2289
+ try {
2290
+ let t = m._getState(), i = t.sheetRefsAll, a = m._getOffsetForId(n.id, i), o = [...i];
2291
+ o.splice(a, 1), m._updateSheetRefStates(o);
2292
+ let c = new Map(t.refsById);
2293
+ c.delete(n.id);
2294
+ let l = new Map(t.sheetsById);
2295
+ l.delete(n.id);
2296
+ let u = n.name.toLowerCase(), d = new Map(t.refsByLowerCaseName);
2297
+ d.delete(u);
2298
+ let f = new Map(t.sheetsByLowerCaseName);
2299
+ f.delete(u);
2300
+ let p = new Map(t.refsByInstance);
2301
+ p.delete(e), t.listenersSheets.get(n.id)();
2302
+ let h = new Map(t.listenersSheets);
2303
+ h.delete(n.id), m._adjustRemoveSelectionIfRequired(a, n.id), m._adjustSheetNamesIfRequired(), m._sheetOnNameChange.delete(n.id), m._sheetOnVisibilityChange.delete(n.id), m._sheetOnIndexChange.delete(n.id), m._emitter.notify("onSheetsChange");
2304
+ let g = new Set(t.sheetsCreated);
2305
+ g.has(s) && g.delete(s), m._updateState({
2306
+ refsById: c,
2307
+ sheetsById: l,
2308
+ refsByLowerCaseName: d,
2309
+ sheetsByLowerCaseName: f,
2310
+ refsByInstance: p,
2311
+ sheetsCreated: g,
2312
+ listenersSheets: h
2313
+ }), r.commit();
2314
+ } catch (e) {
2315
+ throw r.rollback(), e;
2316
+ }
2317
+ }
2318
+ }), i = s.addListeners({ onSelectionChange: (e) => {
2319
+ m.getView().getActiveSheetId() === m._getSheetRef(e)?.id && m._emitter.notify("onSelectionChange", {
2320
+ source: m,
2321
+ params: e
2322
+ });
2323
+ } }, { transactional: !1 });
2324
+ h = new Map(r.listenersSheets), h.set(e.id, () => {
2325
+ n(), i();
2326
+ });
2327
+ }
2328
+ let g = r.lastId;
2329
+ g !== -1 && (g = Math.max(g, e.id)), this._updateState({ lastId: g }), this._updateState({
2330
+ refsById: l,
2331
+ refsByLowerCaseName: u,
2332
+ refsByInstance: d,
2333
+ sheetsById: f,
2334
+ sheetsByLowerCaseName: p,
2335
+ listenersSheets: h
2336
+ }), this._adjustSheetNamesIfRequired();
2337
+ let _ = new Set(this._getState().sheetsCreated);
2338
+ return _.add(e.sheet), this._updateState({ sheetsCreated: _ }), e;
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
+ }
2360
+ _adjustRemoveSelectionIfRequired(e, t) {
2361
+ if (this._view.getActiveSheetId() === t) {
2362
+ let t, n = this._getState().sheetRefsVisible;
2363
+ t = e < n.length ? n[e].id : n[e - 1].id, this._view.setActiveSheetId(t);
2364
+ }
2365
+ }
2366
+ _adjustSheetNamesIfRequired() {
2367
+ let e = this._getState(), t = e.lastId;
2368
+ if (t === -1) return;
2369
+ let n = this._view.getActiveSheetId();
2370
+ n ??= (this._view.setActiveSheetId(t), t);
2371
+ let r = e.refsById.get(n);
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));
2373
+ }
2374
+ _validateDeleteSheet(e) {
2375
+ if (this._closed) throw Error(t("error.workbook.modelClosed"));
2376
+ if (!this.getProtection().isStructureAllowed()) throw new r(t("error.workbook.protection"));
2377
+ let n = this._getSheetRef(e);
2378
+ if (!n) throw new o(function(e) {
2379
+ return t("error.workbook.deleteKey", { key: e });
2380
+ }(e));
2381
+ let i = this._getState().sheetRefsVisible;
2382
+ if (i.length === 1 && i[0].id === n.id) throw new o(t("error.workbook.sheetOne"));
2383
+ }
2384
+ _getOffsetForId(e, n) {
2385
+ let r = n.length;
2386
+ for (let t = 0; t < r; t++) if (n[t].id === e) return t;
2387
+ throw new o(t("error.workbook.noVisibleRefs"));
2388
+ }
2389
+ find(e) {
2390
+ if (this._closed) throw Error(t("error.workbook.modelClosed"));
2391
+ let n = this._getSheets();
2392
+ if (n.length === 1) return n[0].find(e);
2393
+ typeof e == "string" && (e = { text: e });
2394
+ let r = !e?.reverse, i = e?.disableWrap ?? !1, a = this.getSelectedSheetIndex(), o = a, s = n[o], c = !1;
2395
+ e = {
2396
+ ...e,
2397
+ disableWrap: !0
2398
+ };
2399
+ let l, u = s.find(e), f = u.next(), p = !1;
2400
+ if (e?.from) {
2401
+ let t = this._rangesAddressToCoords(e?.from);
2402
+ l = {
2403
+ colIndex: t[0].colStart,
2404
+ rowIndex: t[0].rowStart
2405
+ };
2406
+ }
2407
+ let m = d.createCellComparator(e?.axis, e?.reverse);
2408
+ delete (e = { ...e }).from;
2409
+ let h = () => {
2410
+ if (!p && f.done && (c && o === a ? p = !0 : r ? (o++, o > n.length - 1 && (o = 0, c = !0)) : (o--, o < 0 && (o = n.length - 1, c = !0)), i && c && (p = !0), p || l || !c || o !== a || (p = !0), !p)) {
2411
+ s = n[o], u = s.find(e);
2412
+ let t = f;
2413
+ return f = u.next(), t;
2414
+ }
2415
+ if (!p && c && o === a && (f.done || !l || !f.done && m(f.value.getCoords(), l) >= 0) && (p = !0), p) {
2416
+ let e = f;
2417
+ return f = Me, e;
2418
+ }
2419
+ let t = f;
2420
+ return f = u.next(), t;
2421
+ };
2422
+ return { next: () => {
2423
+ let e = h();
2424
+ for (; !p && e.done;) e = h();
2425
+ return e;
2426
+ } };
2427
+ }
2428
+ replace(e, n, r) {
2429
+ let i = 0, a = null, o = typeof n == "function", s = r?.maxCount ?? 2 ** 53 - 1, c = !r?.maxCount, l = "", u = typeof n == "string" ? Pe(n) : null, d = r?.description ?? p("op.replace"), f = this._transactions.beginCommit({ description: d });
2430
+ try {
2431
+ let d = null, m = null, h = e.next();
2432
+ for (; !h.done && i < s;) {
2433
+ let t = h.value, s = t.getSheet();
2434
+ s !== d && (d = s, m !== null && m.apply(), m = d.getEntireRange().createSparseBuilder({
2435
+ axis: r?.axis,
2436
+ allowUnorderedWrites: !0
2437
+ }));
2438
+ let c = o ? n(t) : n;
2439
+ c !== void 0 && c !== t && (m.push(t, c), i++, a = t), h = e.next();
2440
+ }
2441
+ m?.apply(), i === 1 && s === 1 && a && (l = a.getAddress()), i === 0 ? f.rollback() : f.commit({ description: r?.description ?? (c ? u === null ? p("op.replaceAll") : t("op.replaceAllWith", { value: u }) : l ? u === null ? t("op.replaceAt", { address: l }) : t("op.replaceAtWith", {
2442
+ address: l,
2443
+ value: u
2444
+ }) : u === null ? p("op.replace") : t("op.replaceWith", { value: u })) });
2445
+ } catch (e) {
2446
+ throw f.rollback(), e;
2447
+ }
2448
+ return {
2449
+ count: i,
2450
+ last: a
2451
+ };
2452
+ }
2453
+ _nextSheetIndex(e, t = this._getSheetRefs()) {
2454
+ let n = t.length;
2455
+ return n === 1 ? 0 : (e === void 0 && (e = this.getSelectedSheetIndex()), (e = Math.max(0, Math.min(e, n - 1))) >= n - 1 ? 0 : e + 1);
2456
+ }
2457
+ _prevSheetIndex(e, t = this._getSheetRefs()) {
2458
+ let n = t.length;
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);
2460
+ }
2461
+ getNextSheet(e) {
2462
+ if (this._closed) throw Error(t("error.workbook.modelClosed"));
2463
+ let n = this._getSheetRefs();
2464
+ return n[this._nextSheetIndex(e, n)]?.sheet ?? null;
2465
+ }
2466
+ getPreviousSheet(e) {
2467
+ if (this._closed) throw Error(t("error.workbook.modelClosed"));
2468
+ let n = this._getSheetRefs();
2469
+ return n[this._prevSheetIndex(e, n)]?.sheet ?? null;
2470
+ }
2471
+ async _duplicateSheet(e) {
2472
+ if (this._closed) throw Error(t("error.workbook.modelClosed"));
2473
+ if (!this.getProtection().isStructureAllowed()) throw new r(t("error.workbook.protection"));
2474
+ let n = this._getSheetRefs(), i = this.getSelectedSheetIndex(), a = null;
2475
+ if (e) {
2476
+ if (a = this._getSheetRef(e), !a) throw new o(X(a));
2477
+ } else a = n[i];
2478
+ if (!a) return null;
2479
+ let s = a.sheet, c = this._strings.beginPersist(), l = this.getResources().beginPersist(), u = this.getStyles().beginPersist(), d = null, f = this.beginCommit(t("op.duplicateNamed", { name: s.getName() }));
2480
+ try {
2481
+ let e = this._getState().refsByInstance.get(s), t = await s.toJSON(), r = n.length + 1, a = this.findValidSheetName(e.name), o = this._createSheet(r, a, e.visibility, i, void 0, t);
2482
+ this._emitter.notify("onSheetsChange"), d = o, f.commit();
2483
+ } catch (e) {
2484
+ throw f.rollback(), e;
2485
+ } finally {
2486
+ u.endPersist(), l.endPersist(), c.endPersist();
2487
+ }
2488
+ return d;
2489
+ }
2490
+ _createRange(e, n) {
2491
+ let r = e ? { ...e } : null, i = r ? this._getSheetRef(r.scope, F.Visibility.VeryHidden) : null;
2492
+ if (!i) {
2493
+ let e = this.getSelectedSheet();
2494
+ return e ? (delete r?.scope, an(r, r ? {
2495
+ scope: T,
2496
+ ...e.getEntireRange().getCoords()
2497
+ } : null)) : void console.warn(t("error.workbook.noVisibleRefs"));
2498
+ }
2499
+ let a = i.sheet, o = null;
2500
+ return n && (o = { getOptions: n }), new ln(e, j(a), this, o);
2501
+ }
2502
+ _createRanges(e, t) {
2503
+ let n = this.getSelectedSheet(), r = null;
2504
+ return t && (r = { getOptions: t }), new Q(e, j(n), this, r);
2505
+ }
2506
+ getRange(e, n) {
2507
+ if (e === void 0) return this.getSelectedRange(n);
2508
+ try {
2509
+ let r = this._rangesAddressToCoords(e);
2510
+ if (r.length !== 1) throw new o(t("error.address.singleRangeOnlyAlt"));
2511
+ return this._createRange(r[0], n);
2512
+ } catch (t) {
2513
+ throw t instanceof f ? new f(t.message) : new o(t.message ?? xe(e));
2514
+ }
2515
+ }
2516
+ getCell(e) {
2517
+ if (e === void 0) return this.getSelectedCell();
2518
+ let n = this.getRange(e);
2519
+ if (n.size > 1) throw new o(t("error.address.singleCellOnly"));
2520
+ return n.getCell();
2521
+ }
2522
+ getRanges(e, t) {
2523
+ let n = this._rangesAddressToCoords(e);
2524
+ if (n.length === 0) throw new o(xe(e));
2525
+ return this._createRanges(n, t);
2526
+ }
2527
+ _createGraphRanges(e, t) {
2528
+ let n = [], r = this.getCalculation()?.getNamedFormulas() ?? null;
2529
+ for (let e = 0; e < t.length; e++) {
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));
2532
+ }
2533
+ for (let t = 0; t < e.length; t++) n.push(e[t]);
2534
+ return n.length === 0 ? null : new Q(n, j(this.getSelectedSheet()), this, null);
2535
+ }
2536
+ getStats(e) {
2537
+ if (this._closed) throw Error(t("error.workbook.modelClosed"));
2538
+ let n = this._getSheets(F.Visibility.VeryHidden), r = n.length;
2539
+ if (r === 1) return n[0].getStats(e);
2540
+ let i = Array(r);
2541
+ for (let t = 0; t < r; t++) i[t] = n[t].getStats(e);
2542
+ return new Bt(i);
2543
+ }
2544
+ _activeRangeCoords() {
2545
+ let e = this.getSelectedSheet(), t = e.getSelection().getRanges().getCoords(), n = e.getName(), r = t.length, i = Array(r);
2546
+ for (let e = 0; e < r; e++) {
2547
+ let r = t[e];
2548
+ i[e] = {
2549
+ colStart: r.colStart,
2550
+ colEnd: r.colEnd,
2551
+ rowStart: r.rowStart,
2552
+ rowEnd: r.rowEnd,
2553
+ scope: n
2554
+ };
2555
+ }
2556
+ return i;
2557
+ }
2558
+ getSelectedRange(e) {
2559
+ return this.getRange(this._activeRangeCoords()[0], e);
2560
+ }
2561
+ getSelectedRanges(e) {
2562
+ return this.getRanges(this._activeRangeCoords(), e);
2563
+ }
2564
+ getSelectedCell() {
2565
+ return this.getSelectedSheet().getSelectedCell();
2566
+ }
2567
+ _rangesAddressToCoords(e, n = !0, r = F.Visibility.Hidden) {
2568
+ if (!e) throw new o(t("error.address.noAddress"));
2569
+ let i = this.getSelectedSheet(), a = { ...i?.getEntireRange().getCoords() }, s = i?.getName();
2570
+ if (s && (a.scope = s), typeof e == "string") {
2571
+ let t = e.trim().toLowerCase();
2572
+ if (t === "r" || t === "c") {
2573
+ let n = this.getSelectedCell().getCoords(), r = {};
2574
+ t === "r" ? r.rowStart = r.rowEnd = n.rowIndex : r.colStart = r.colEnd = n.colIndex, e = r;
2575
+ }
2576
+ }
2577
+ let c = this, l = Je(e, a, ue, (e) => {
2578
+ if (!n) return null;
2579
+ if (typeof e == "string") {
2580
+ let t = c.getNames().getByName(e)?.getRanges?.();
2581
+ if (t) return t.getCoords();
2582
+ }
2583
+ throw new o(`Invalid sheet reference '${e}'.`);
2584
+ }), u = l.length;
2585
+ for (let e = 0; e < u; e++) this._validateCoords(l[e], r);
2586
+ return l;
2587
+ }
2588
+ _validateCoords(e, n = F.Visibility.Visible, r = t("error.sheet.oobRange")) {
2589
+ if (e === null) return;
2590
+ let i = this.getSheet(e.scope, n).getEntireRange().getCoords();
2591
+ if (!d.isRangeWithinRange(e, i)) throw new f(r);
2592
+ if (e.rowEnd < e.rowStart || e.colEnd < e.colStart) throw new o(t("error.address.invalidRangeInverted"));
2593
+ }
2594
+ _updateSheetRef(e, t) {
2595
+ let n = this._getState(), r = [...n.sheetRefsAll];
2596
+ r[this._getOffsetForId(e.id, n.sheetRefsAll)] = t, this._updateSheetRefStates(r);
2597
+ let i = new Map(n.refsById);
2598
+ i.set(e.id, t);
2599
+ let a = e.name.toLowerCase(), o = t.name.toLowerCase(), s = new Map(n.refsByLowerCaseName);
2600
+ s.delete(a), s.set(o, t);
2601
+ let c = new Map(n.sheetsByLowerCaseName), l = c.get(a);
2602
+ c.delete(a), c.set(o, l);
2603
+ let u = new Map(n.refsByInstance);
2604
+ return u.set(l, t), this._updateState({
2605
+ refsById: i,
2606
+ refsByLowerCaseName: s,
2607
+ sheetsByLowerCaseName: c,
2608
+ refsByInstance: u
2609
+ }), t;
2610
+ }
2611
+ _setSheetName(e, n, i) {
2612
+ if (this._closed) throw Error(t("error.workbook.modelClosed"));
2613
+ if (!this.getProtection().isStructureAllowed()) throw new r(t("error.workbook.protection"));
2614
+ let a = this._getSheetRef(e);
2615
+ if (!a) throw new o(X(e));
2616
+ if (n === a.name) return a.sheet;
2617
+ if ((n = this._validateNewSheetName(n)) == null) throw new o(t("error.workbook.sheetNameNotProvided"));
2618
+ let s = Object.freeze({
2619
+ ...a,
2620
+ name: n
2621
+ }), c = null, l = this.beginCommit(p("op.renameSheet"));
2622
+ try {
2623
+ let e = this._updateSheetRef(a, s);
2624
+ this._adjustSheetNamesIfRequired(), this._sheetOnNameChange.forEach((e, t) => {
2625
+ a.id === t && e();
2626
+ }), this._emitter.notify("onSheetsChange"), a.id === this.getView().getActiveSheetId() && this._emitter.notify("onSelectionChange"), c = e.sheet, l.commit(i);
2627
+ } catch (e) {
2628
+ throw l.rollback(), e;
2629
+ }
2630
+ return c;
2631
+ }
2632
+ _setSheetVisibility(e, n = F.Visibility.Visible, i) {
2633
+ if (this._closed) throw Error(t("error.workbook.modelClosed"));
2634
+ if (!this.getProtection().isStructureAllowed()) throw new r(t("error.workbook.protection"));
2635
+ let a = this._getSheetRef(e, F.Visibility.VeryHidden);
2636
+ if (!a) return null;
2637
+ if (n === a.visibility) return;
2638
+ let s = null, c = "";
2639
+ n === F.Visibility.Visible ? c = p("op.unhideSheet") : n === F.Visibility.Hidden ? c = p("op.hideSheet") : n === F.Visibility.VeryHidden && (c = p("op.veryHideSheet"));
2640
+ let l = this.beginCommit(c);
2641
+ try {
2642
+ let e = this._getState().sheetRefsVisible;
2643
+ if (n !== F.Visibility.Visible && e.length === 1 && e[0].id === a.id) throw new o(t("error.workbook.sheetOne"));
2644
+ let r = {
2645
+ ...a,
2646
+ visibility: n
2647
+ }, c = -1;
2648
+ n !== F.Visibility.Visible && (c = this._getOffsetForId(a.id, e)), s = this._updateSheetRef(a, r).sheet, n !== F.Visibility.Visible && this._adjustRemoveSelectionIfRequired(c, a.id), this._adjustSheetNamesIfRequired(), l.commit(i);
2649
+ } catch (e) {
2650
+ throw l.rollback(), e;
2651
+ }
2652
+ return this._sheetOnVisibilityChange.forEach((e, t) => {
2653
+ a.id === t && e();
2654
+ }), this._emitter.notify("onSheetsChange"), s;
2655
+ }
2656
+ _moveSheet(e, n, i) {
2657
+ if (this._closed) throw Error(t("error.workbook.modelClosed"));
2658
+ if (!this.getProtection().isStructureAllowed()) throw new r(t("error.workbook.protection"));
2659
+ let a = null, s = this.beginCommit(t("op.moveSheetNamed", { name: e.name }));
2660
+ try {
2661
+ let t = this._getState(), r = t.sheetRefsVisible;
2662
+ if (n < 0 || n > r.length - 1) throw new o(`Invalid to index: ${n}`);
2663
+ let c = this.getView().getActiveSheetId(), l = t.sheetRefsAll, u = this._getOffsetForId(e.id, l), d = this._getOffsetForId(r[n].id, l);
2664
+ if (u === d) return;
2665
+ let f = l[u], p = [...l];
2666
+ p.splice(u, 1), p.splice(d, 0, f), this._updateSheetRefStates(p), this._calculation._replaceSheetSpans?.(l.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"), a = f.sheet, this._recordActiveSheet(s, c, this.getView().getActiveSheetId()), s.commit(i);
2669
+ } catch (e) {
2670
+ throw s.rollback(), e;
2671
+ }
2672
+ return a;
2673
+ }
2674
+ _setSelectedSheet(e) {
2675
+ if (this._closed) throw Error(t("error.workbook.modelClosed"));
2676
+ let n = this._getSheetRef(e);
2677
+ if (!n) throw new o(X(e));
2678
+ let r = null;
2679
+ return n.visibility !== F.Visibility.Visible && this._setSheetVisibility(n, F.Visibility.Visible), this._view.setActiveSheetId(n.id), r = n.sheet, r;
2680
+ }
2681
+ getProtection() {
2682
+ return this._protection;
2683
+ }
2684
+ getCodeName() {
2685
+ return this._codeName;
2686
+ }
2687
+ getNames() {
2688
+ return this._names;
2689
+ }
2690
+ getCalculation() {
2691
+ return this._calculation;
2692
+ }
2693
+ createFormula(e, t, n) {
2694
+ return this.getCalculation().createFormula(e, t, n);
2695
+ }
2696
+ evaluate(e, t) {
2697
+ return this.getCalculation().evaluate(e, t);
2698
+ }
2699
+ whenCalculationReady() {
2700
+ let e = this._starting;
2701
+ return e ? e.then(() => this.getCalculation().ready()) : this.getCalculation().ready();
2702
+ }
2703
+ getScripts() {
2704
+ return this._scripts ||= this._createScripts(), this._scripts;
2705
+ }
2706
+ getModules() {
2707
+ return this.getScripts().getModules();
2708
+ }
2709
+ _notifyAllChange() {
2710
+ this._emitter.notify("onSheetsChange"), this._emitter.notify("onSelectedSheetChange"), this._emitter.notify("onViewChange");
2711
+ }
2712
+ addListeners(e, t) {
2713
+ return this._emitter.addListeners(e, t);
2714
+ }
2715
+ _sheetToWBEvent(e) {
2716
+ let t = this;
2717
+ return (n) => {
2718
+ let r = () => {
2719
+ let e = n.getSource();
2720
+ if (e.isInvalid()) return e;
2721
+ if (e.isICellRanges) {
2722
+ let n = [...e.getCoords()], r = n.length;
2723
+ for (let t = 0; t < r; t++) {
2724
+ let r = n[t];
2725
+ !r.scope && e.getSheet().getName() && (n[t] = {
2726
+ ...r,
2727
+ scope: e.getSheet().getName()
2728
+ });
2729
+ }
2730
+ return t.getRanges(n);
2731
+ }
2732
+ if (e.isICellRange) {
2733
+ let n = e.getCoords(), r = e.getSheet().getName();
2734
+ return t.getRange({
2735
+ ...n,
2736
+ scope: r
2737
+ });
2738
+ }
2739
+ };
2740
+ e({
2741
+ getSource: r,
2742
+ trigger: n.trigger,
2743
+ getFrom: () => t.getRanges(n.getFrom()),
2744
+ getTo: () => t.getRange(n.getTo()),
2745
+ isDataChange: n.isDataChange,
2746
+ getTransactionId: n.getTransactionId,
2747
+ isUndo: n.isUndo,
2748
+ toString: () => `WorkbookRangeEvent: ('${n.trigger}', ${r().toString()})`,
2749
+ timeStamp: Date.now()
2750
+ });
2751
+ };
2752
+ }
2753
+ _fromJSON(e) {
2754
+ if (this._emitter.notify("onBeforeLoad", { params: e }), this._initState(), !e.sheets || e.sheets.length === 0) throw new o(t("error.workbook.sheetOne"));
2755
+ e.theme && (this._theme = new C(e.theme), this._styles.setTheme(this._theme));
2756
+ let n = this._strings.beginPersist(), r = this._resources.beginPersist(), i = this._styles.beginPersist();
2757
+ try {
2758
+ n.fromJSON(e.strings), r.fromJSON(e.resources), i.fromJSON(e.styles), e.date1904 && (this._isDate1904 = !0), this._codeName = e.codeName ?? null, this._updateLinks = e.updateLinks ?? null, e.locale && (this._locale = e.locale), e.localeOverrides && (this._localeOverrides = e.localeOverrides), e.view ||= {};
2759
+ let t = [], a = e.pivotCaches;
2760
+ if (a) {
2761
+ let e = r.fromResourceId.bind(r);
2762
+ for (let n = 0; n < a.length; n++) {
2763
+ let r = a[n];
2764
+ r && typeof r.cacheId == "number" && t.push({
2765
+ cacheId: r.cacheId,
2766
+ part: D.fromJSON(r.part, e)
2767
+ });
2768
+ }
2769
+ }
2770
+ this._pivotCaches = t, 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");
2789
+ } finally {
2790
+ i.endPersist(), r.endPersist(), n.endPersist();
2791
+ }
2792
+ }
2793
+ _createScripts(e) {
2794
+ let t = this;
2795
+ return new Gt({
2796
+ transactions: this._transactions,
2797
+ json: e,
2798
+ workbook: t,
2799
+ getBuiltInFunctions: () => t._calculation?.getFunctions(),
2800
+ onAdd: (e, n) => {
2801
+ let r = t._calculation;
2802
+ r.getStatus() !== le.Status.Off && r.start().then(async () => {
2803
+ let e = n.getFunctions().getItems({ type: "formula" }), t = e.length;
2804
+ for (let n = 0; n < t; n++) {
2805
+ let t = e[n];
2806
+ try {
2807
+ await this._calculation.getFunctions().add(t);
2808
+ } catch (e) {
2809
+ a.error(e?.message ?? String(e), e);
2810
+ }
2811
+ }
2812
+ }).catch(() => {});
2813
+ },
2814
+ onRemove: (e, t) => {}
2815
+ });
2816
+ }
2817
+ async toJSON(e) {
2818
+ if (this._closed) throw Error(t("error.workbook.modelClosed"));
2819
+ await Promise.resolve(this._starting);
2820
+ let n = this.getCalculation();
2821
+ n.getStatus() !== le.Status.Off && (await n.ready(), await n._whenRequestsSettled?.()), await this._emitter.notify("onBeforeSave", { async: !0 });
2822
+ let r = { sheets: [] }, i = e?.ignoreStyles ?? !1;
2823
+ if (!i) {
2824
+ let e = this._theme.toJSON();
2825
+ (e ? Object.keys(e).length : 0) > 0 && (r.theme = e);
2826
+ }
2827
+ if (this._scripts) {
2828
+ let e = this._scripts.toJSON();
2829
+ e && Object.keys(e).length > 0 && (r.modules = e);
2830
+ }
2831
+ this._isDate1904 && (r.date1904 = !0), this._codeName && (r.codeName = this._codeName), this._updateLinks && (r.updateLinks = this._updateLinks), this._locale && (r.locale = this._locale), this._localeOverrides && (r.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();
2833
+ try {
2834
+ let t = this._getSheetRef(this.getSelectedSheetIndex()).id, n = t, u = null, d = this._getState(), f = d.sheetRefsAll, p = d.sheetsById, m = f.length;
2835
+ for (let i = 0; i < m; i++) {
2836
+ let a = f[i], o = i + 1, s = await p.get(a.id).toJSON(e), c = {
2837
+ name: a.name,
2838
+ sheet: s
2839
+ };
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 && (n = o), r.sheets.push(c);
2841
+ }
2842
+ if (!i) {
2843
+ let e = l.toJSON();
2844
+ e && Object.keys(e).length > 0 && (r.styles = e);
2845
+ }
2846
+ let h = this.getProtection().toJSON();
2847
+ h && (r.protection = h);
2848
+ let g = this._calculation.toJSON();
2849
+ Object.keys(g).length > 0 && (r.calc = g);
2850
+ let _ = await s.toJSONAsync();
2851
+ _ && _.length > 0 && (r.strings = _);
2852
+ let v = this._calculation.getExternalBooks().toJSON();
2853
+ v && (r.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 && (r.pivotCaches = t);
2862
+ }
2863
+ let b = this._people.toJSON();
2864
+ if (b && (r.people = b), !o) {
2865
+ let e = await c.toJSONAsync(typeof a == "function" ? a : void 0);
2866
+ e && e.length > 0 && (r.resources = e);
2867
+ }
2868
+ let x = this._calculation.getNamedFormulas().toJSON();
2869
+ x && x.length > 0 && (r.names = x);
2870
+ let S = this._view.toJSON();
2871
+ S && (n === u ? delete S.activeSheetId : S.activeSheetId = n, Object.keys(S).length > 0 && (r.view = S));
2872
+ } finally {
2873
+ l.endPersist(), o || c.endPersist(), s.endPersist();
2874
+ }
2875
+ return this._emitter.notify("onSave", { params: r }), r;
2876
+ }
2877
+ isClosed() {
2878
+ return this._closed;
2879
+ }
2880
+ close() {
2881
+ if (this._closed) return;
2882
+ this._emitter.notify("onClose");
2883
+ let e = this._getState();
2884
+ e.listenersSheets.forEach((e) => {
2885
+ e();
2886
+ }), e.listenersSheets.clear();
2887
+ let t = e.sheetRefsAll;
2888
+ for (let e = t.length - 1; e >= 0; e--) try {
2889
+ t[e].sheet.close();
2890
+ } catch (e) {
2891
+ console.warn("error on close", e);
2892
+ }
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;
2894
+ }
2895
+ beginCommit(e) {
2896
+ if (this._closed) throw Error(t("error.workbook.modelClosed"));
2897
+ return this._beginCommit(typeof e == "string" ? { description: e } : e);
2898
+ }
2899
+ doBatch(e, t) {
2900
+ let n = this;
2901
+ return t = typeof t == "string" ? { description: t } : {
2902
+ description: p("op.updateWorkbook"),
2903
+ ...t
2904
+ }, this._transactions.doBatch(e, t, (e, t) => {
2905
+ e.getDepth() === 0 && (n._lastTransactionUUID = e.getId());
2906
+ });
2907
+ }
2908
+ _beginCommit(e) {
2909
+ let t = this;
2910
+ return this._transactions.beginCommit(typeof e == "string" ? { description: e } : e, (e) => {
2911
+ e.getDepth() === 0 && (t._lastTransactionUUID = e.getId());
2912
+ });
2913
+ }
2914
+ _getState() {
2915
+ return this._transactions.getState(this._id);
2916
+ }
2917
+ _updateState(e, t = p("op.updateWorkbook"), n) {
2918
+ if (!e) return;
2919
+ let r = this._beginCommit(t);
2920
+ try {
2921
+ r.updateState(this._id, e), r.commit(n);
2922
+ } catch (e) {
2923
+ throw r.rollback(), e;
2924
+ }
2925
+ }
2926
+ get options() {
2927
+ return this._options;
2928
+ }
2929
+ get [Symbol.toStringTag]() {
2930
+ return "[Workbook]";
2931
+ }
2932
+ toString() {
2933
+ return `[${this.getName() ?? "(untitled)"}]`;
2934
+ }
2935
+ get isIWorkbook() {
2936
+ return !0;
2937
+ }
2938
+ }, fn = { address: null }, pn = class {
2939
+ constructor() {
2940
+ this._readFormats = [], this._writeFormats = [], this._encryptions = [];
2941
+ }
2942
+ async registerReadFormat(e) {
2943
+ this._readFormats = await this._registerFormatType(e, this._readFormats);
2944
+ }
2945
+ async registerWriteFormat(e) {
2946
+ this._writeFormats = await this._registerFormatType(e, this._writeFormats);
2947
+ }
2948
+ async registerEncryption(e) {
2949
+ if (!e) throw Error("encryption must be provided.");
2950
+ if (!e.key) throw Error("encryption.key must be provided.");
2951
+ let t = e.key.toLowerCase(), n = this._encryptions.findIndex((e) => e.key.toLowerCase() === t);
2952
+ if (n !== -1) {
2953
+ let t = [...this._encryptions];
2954
+ t[n] = e, this._encryptions = Object.freeze(t);
2955
+ return;
2956
+ }
2957
+ this._encryptions = Object.freeze([...this._encryptions, e]);
2958
+ }
2959
+ async getEncryption(e) {
2960
+ return this.peekEncryption(e);
2961
+ }
2962
+ peekEncryption(e) {
2963
+ if (!e) return this._encryptions[0] ?? null;
2964
+ let t = e.toLowerCase();
2965
+ return this._encryptions.find((e) => e.key.toLowerCase() === t) ?? null;
2966
+ }
2967
+ async detectEncryption(e) {
2968
+ for (let t of this._encryptions) if (await t.detect(e)) return t;
2969
+ return null;
2970
+ }
2971
+ async getReadFormats(e) {
2972
+ return e ? this._filterFormats(e, this._readFormats) : [...this._readFormats];
2973
+ }
2974
+ async getWriteFormats(e) {
2975
+ return this._writeFormats ? e ? this._filterFormats(e, this._writeFormats) : [...this._writeFormats] : [];
2976
+ }
2977
+ async _registerFormatType(e, t) {
2978
+ return this._registerFormatTypeSync(e, t);
2979
+ }
2980
+ _registerFormatTypeSync(e, t) {
2981
+ if (!e) throw Error("format must be provided.");
2982
+ if (!e.key) throw Error("format.key must be provided.");
2983
+ let n = e.key.toLowerCase(), r = t.findIndex((e) => e.key.toLowerCase() === n);
2984
+ if (r !== -1) {
2985
+ let n = [...t];
2986
+ return n[r] = e, Object.freeze(n);
2987
+ }
2988
+ return Object.freeze([...t, e]);
2989
+ }
2990
+ _filterFormats(e, t, n) {
2991
+ if (!e || Object.keys(e).length === 0) {
2992
+ if (!n) return [...t];
2993
+ e = { ext: n };
2994
+ }
2995
+ let r = e.search?.toLocaleLowerCase();
2996
+ return t.filter((t) => {
2997
+ if (r) {
2998
+ let e = t.key.toLocaleLowerCase().includes(r), n = !!t.exts && t.exts.some((e) => e.toLocaleLowerCase().includes(r)), i = !!t.mimeType && t.mimeType.toLocaleLowerCase().includes(r), a = !!t.tags && t.tags.some((e) => e.toLocaleLowerCase().includes(r)), o = !!t.description && t.description.toLocaleLowerCase().includes(r);
2999
+ if (!(e || n || i || a || o)) return !1;
3000
+ }
3001
+ let i = e.ext || n;
3002
+ if (i) {
3003
+ let e = i.toLocaleLowerCase();
3004
+ if (!t.exts.some((t) => t.toLocaleLowerCase() === e)) return !1;
3005
+ }
3006
+ if (e.mimeType && t.mimeType !== e.mimeType || e.key && t.key.toLocaleLowerCase() !== e.key.toLocaleLowerCase()) return !1;
3007
+ if (e.tags) {
3008
+ let n = t.tags || [];
3009
+ if (!(typeof e.tags == "string" ? [e.tags] : e.tags).every((e) => n.includes(e))) return !1;
3010
+ }
3011
+ return !0;
3012
+ });
3013
+ }
3014
+ }, $ = /* @__PURE__ */ new WeakMap(), mn = (e) => !!e && typeof e == "object" && typeof e.getPath == "function" && typeof e.canWrite == "function", hn = new class {
3015
+ constructor() {
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());
3017
+ }
3018
+ getBackingStore() {
3019
+ return this._backingStore ?? this._defaultStore;
3020
+ }
3021
+ setBackingStore(e) {
3022
+ this._backingStore = e ?? null;
3023
+ }
3024
+ canWrite() {
3025
+ return typeof this.getBackingStore().write == "function";
3026
+ }
3027
+ canRead() {
3028
+ return typeof this.getBackingStore().read == "function";
3029
+ }
3030
+ async install(e) {
3031
+ this._setInstalled.has(e) || (await e.register(this._registry), this._setInstalled.add(e));
3032
+ }
3033
+ addListeners(e, t) {
3034
+ return this._emitter.addListeners(e, t);
3035
+ }
3036
+ addCommitListener(e) {
3037
+ return this._emitter.addListeners({ onWrite: (t, n) => {
3038
+ n.save && e.onCommit?.({
3039
+ store: n.workbook.getTransactions(),
3040
+ commitId: n.commitId
3041
+ });
3042
+ } });
3043
+ }
3044
+ async getReadFormats(e) {
3045
+ return this._registry.getReadFormats(e);
3046
+ }
3047
+ async getWriteFormats(e) {
3048
+ return this._registry.getWriteFormats(e);
3049
+ }
3050
+ getOrigin(e) {
3051
+ return new R(e);
3052
+ }
3053
+ async read(e) {
3054
+ let t = null;
3055
+ if (typeof e == "string") e = { source: e };
3056
+ else if (mn(e)) {
3057
+ let n = e.getPath();
3058
+ if (!n) throw Error("Cannot read from an unbound origin (no path).");
3059
+ rt(e) ? e = {
3060
+ source: n,
3061
+ asCopy: !0
3062
+ } : (t = e, e = { source: n });
3063
+ }
3064
+ let n = e ?? {}, { source: r = null, ...i } = n, a = this.getBackingStore();
3065
+ return (a.read ? a : this._defaultStore).read({
3066
+ source: r,
3067
+ options: i,
3068
+ decode: (e, r) => this._decodeBuffer(e, r, n, t)
3069
+ });
3070
+ }
3071
+ async _decodeBuffer(e, n = {}, r, i = null) {
3072
+ let a = n.format, s = n.ext;
3073
+ if (!a && !s) throw Error("Either format or file extension must be provided to determine read type.");
3074
+ let c = (await this._registry.getReadFormats({
3075
+ search: a,
3076
+ ext: s
3077
+ }))[0];
3078
+ if (!c) throw new o(t("error.io.readFormatUnavailable", { format: a ?? s }));
3079
+ let l = r?.typedCreateWorkbookOptions, u = l ? Object.keys(l).find((e) => e.toLowerCase() === c.key.toLowerCase()) : void 0, d = {
3080
+ ...r,
3081
+ ...u === void 0 ? void 0 : l[u]
3082
+ };
3083
+ delete d.typedCreateWorkbookOptions, delete d.source, delete d.asCopy;
3084
+ let f = i ?? new R(n.absolutePath ?? null, {
3085
+ name: n.name ?? null,
3086
+ format: c.key,
3087
+ size: n.size ?? null,
3088
+ lastModified: n.lastModified ?? null,
3089
+ canWrite: n.canWrite ?? !1
3090
+ });
3091
+ i instanceof R && i.update({
3092
+ format: c.key,
3093
+ size: n.size ?? null,
3094
+ lastModified: n.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 = {
3102
+ disableLoadAutoFit: !0,
3103
+ ...d.createWorkbookOptions
3104
+ });
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, n.size));
3110
+ try {
3111
+ let t = await this._readArrayBuffer(e, c, d);
3112
+ return p.password !== null && f.setPassword(p.password), d?.progress?.onComplete?.(f), this._emitter.notify("onRead", {
3113
+ params: {
3114
+ workbook: t,
3115
+ origin: f
3116
+ },
3117
+ transactional: !1
3118
+ }), t;
3119
+ } catch (e) {
3120
+ throw d?.progress?.onError?.(e), d?.progress?.onComplete?.(null), e;
3121
+ }
3122
+ }
3123
+ async _decrypt(e, n, r) {
3124
+ let i = await this._registry.detectEncryption(e);
3125
+ if (n instanceof R && n.update({ encryption: i ? i.key : null }), !i) return {
3126
+ bytes: e,
3127
+ password: null
3128
+ };
3129
+ let a = null, o = async (t) => {
3130
+ try {
3131
+ return a = await i.decode(e, t), !0;
3132
+ } catch (e) {
3133
+ if (!(e instanceof s)) throw e;
3134
+ return !1;
3135
+ }
3136
+ };
3137
+ if (r?.password && await o(r.password)) return {
3138
+ bytes: a,
3139
+ password: r.password
3140
+ };
3141
+ if (!r?.onPassword) {
3142
+ let e = n.getName();
3143
+ throw new m(e ? t("error.io.passwordRequired", { name: e }) : t("error.io.passwordRequiredUnnamed"));
3144
+ }
3145
+ let c = await Promise.resolve(r.onPassword({
3146
+ origin: n,
3147
+ encryption: i.key,
3148
+ validate: o
3149
+ }));
3150
+ if (c == null) return null;
3151
+ if (a !== null || await o(c)) return {
3152
+ bytes: a,
3153
+ password: c
3154
+ };
3155
+ throw new s(t("error.io.passwordIncorrect"));
3156
+ }
3157
+ async writeArrayBuffer(e, n) {
3158
+ if (!n?.format) throw Error("A format must be specified to write to an ArrayBuffer (e.g. { format: 'xlsx' }).");
3159
+ let r = (await this._registry.getWriteFormats({ search: n.format }))[0];
3160
+ if (!r) throw new o(t("error.io.writeFormatUnavailable", { format: n.format }));
3161
+ return this._writeArrayBuffer(e, r, n);
3162
+ }
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, n, r, i) {
3171
+ if (!e) throw Error("Workbook must be provided.");
3172
+ if (!e.isIWorkbook) throw Error("Invalid workbook model provided. Must be an instance of IWorkbook.");
3173
+ let a, s = typeof n == "string" ? this.getOrigin(n) : n, c = s.getFormat();
3174
+ if ((i?.format || c) && (a = (await this._registry.getWriteFormats({ search: i?.format ?? c ?? 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 o(t("error.io.writeFormatUnresolved"));
3175
+ let l = s.getExtension();
3176
+ if (i?.format && l && s.getPath() && s.canWrite() && !a.exts.includes(l)) {
3177
+ let e = (await this._registry.getWriteFormats({ ext: l }))[0];
3178
+ if (e && e.key !== a.key) {
3179
+ let e = s.getPath().split(/[/\\]/).pop();
3180
+ throw new o(t("error.io.writeFormatMismatch", {
3181
+ format: i.format,
3182
+ file: e
3183
+ }));
3184
+ }
3185
+ }
3186
+ if (typeof n == "string") {
3187
+ let e = s.getPath();
3188
+ s = new R(b(e) ? e : `${e}.${a.exts[0]}`, { format: a.key });
3189
+ }
3190
+ let u = s.getEncryption(), d = e.getOrigin?.(), f = (s instanceof R ? s.getPassword() : null) ?? (d instanceof R ? d.getPassword() : null), p = s.isEncrypted() || (d?.isEncrypted() ?? !1), h = i?.password === void 0 ? f ?? (p ? void 0 : null) : i.password, g = null;
3191
+ if (h === void 0) {
3192
+ if (p) {
3193
+ let e = s.getName();
3194
+ throw new m(e ? t("error.io.passwordRequiredSave", { name: e }) : t("error.io.passwordRequiredSaveUnnamed"));
3195
+ }
3196
+ } else if (h !== null && (g = await this._registry.getEncryption(u), !g)) throw new o(t("error.io.encryptionUnavailable"));
3197
+ let _ = `${s.getName() ?? t("workbook.defaultName")}.${a.exts[0]}`, v = i?.progress, y = !s.getPath() || !s.canWrite() || !!i?.prompt, x = !1, S = this, C = null, w = [], T = {
3198
+ workbook: e,
3199
+ format: a,
3200
+ origin: s,
3201
+ suggestedName: _,
3202
+ prompt: i?.prompt,
3203
+ async encode(t, n) {
3204
+ let o = n ?? s;
3205
+ await (async (e) => {
3206
+ x || (x = !0, v?.onStart && await Promise.resolve(v.onStart(e)));
3207
+ })(o), 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
+ ...i,
3221
+ progress: u
3222
+ }), f = $.get(o);
3223
+ if (l.some((e) => !f?.has(e.message)) && i?.onWarnings) {
3224
+ let t = await Promise.resolve(i.onWarnings({
3225
+ workbook: e,
3226
+ origin: o,
3227
+ warnings: l,
3228
+ save: r,
3229
+ canCancel: !y
3230
+ }));
3231
+ if (!y && !1 === t) return null;
3232
+ }
3233
+ return w = l, g ? g.encode(d, h) : d;
3234
+ }
3235
+ }, E = null;
3236
+ try {
3237
+ let t = this.getBackingStore();
3238
+ if (!t.write) throw Error("The active backing store is read-only (no write implementation).");
3239
+ if (E = await t.write(T), E) {
3240
+ if (h !== void 0 && E instanceof R && (E.setPassword(h), E.update({ encryption: g ? g.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
+ r && E !== e.getOrigin() && rt(e.getOrigin())?.setOrigin(E);
3246
+ let t = C ?? e.getTransactions?.()?.getCurrentCommit() ?? null;
3247
+ this._emitter.notify("onWrite", {
3248
+ params: {
3249
+ workbook: e,
3250
+ origin: E,
3251
+ commitId: t?.getId() ?? null,
3252
+ save: r
3253
+ },
3254
+ transactional: !1
3255
+ });
3256
+ }
3257
+ v?.onComplete && await Promise.resolve(v.onComplete(E));
3258
+ } catch (e) {
3259
+ let n = e instanceof Error ? e : Error(String(e));
3260
+ throw v?.onError && await Promise.resolve(v.onError(n)), v?.onComplete && await Promise.resolve(v.onComplete(null)), n instanceof o ? n : Error(t("error.io.writeFailed", { reason: n.message }), { cause: e });
3261
+ }
3262
+ return E;
3263
+ }
3264
+ _stripExtension(e) {
3265
+ let t = b(e);
3266
+ return t ? e.slice(0, e.length - t.length - 1) : e;
3267
+ }
3268
+ _baseName(e) {
3269
+ if (!e) return null;
3270
+ let t = e.split(/[?#]/)[0], n = t.split(/[/\\]/).pop() ?? t;
3271
+ return this._stripExtension(n) || null;
3272
+ }
3273
+ async _writeArrayBuffer(e, t, n) {
3274
+ if (!t) throw Error("A write format must be provided.");
3275
+ let r = t.handler;
3276
+ if (!r) throw Error(`Unable to resolve a write handler for '${t.key}'.`);
3277
+ return r(e, {
3278
+ ...n,
3279
+ format: t.key
3280
+ });
3281
+ }
3282
+ async _readArrayBuffer(e, n, r) {
3283
+ if (!e) throw Error("ArrayBuffer must be specified.");
3284
+ if (!n) throw Error("format must be specified.");
3285
+ if (e.byteLength === 0) return new dn(r?.createWorkbookOptions);
3286
+ let i, a = n.handler;
3287
+ if (!a) throw Error(`Unable to resolve a read handler for '${n.key}'.`);
3288
+ try {
3289
+ i = await a(e, r);
3290
+ } catch (e) {
3291
+ throw e instanceof o ? e : new o(t("error.io.readFailed", {
3292
+ format: n.description ?? n.key,
3293
+ reason: e?.message ?? String(e)
3294
+ }), { cause: e });
3295
+ }
3296
+ return i;
3297
+ }
3298
+ get isIWorkbookIO() {
3299
+ return !0;
3300
+ }
3301
+ }();
3302
+ [
3303
+ ".woff2",
3304
+ ".woff",
3305
+ ".ttf",
3306
+ ".otf",
3307
+ ".ttc"
3308
+ ].map((e) => ({
3309
+ suffix: e,
3310
+ place: (e, t) => t ? `${t}/${e}` : e
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 {
3326
+ constructor(e) {
3327
+ super(e);
3328
+ }
3329
+ _initializeOptions(e) {
3330
+ return e = {
3331
+ ...e,
3332
+ coords: {
3333
+ colStart: 0,
3334
+ rowStart: 0,
3335
+ colEnd: (e?.size?.width ?? 5) - 1,
3336
+ rowEnd: (e?.size?.height ?? 5) - 1
3337
+ },
3338
+ getRanges: (e) => new Re(null)
3339
+ }, super._initializeOptions(e);
3340
+ }
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 };