@sheetxl/studio-vanilla 0.8.0-beta.10 → 0.8.0-beta.11

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 (477) hide show
  1. package/browser/esm/1oQRbol_4RzeM8pE.mjs +12 -0
  2. package/{cdn/assets/CwqRA5h1u92Cyit-.js → browser/esm/30kI2LkOs3zgefE5.mjs} +2 -2
  3. package/browser/esm/{BCWTI3jdTPG37r8W.mjs → 4JJNcz4YU6jhtSoO.mjs} +3 -3
  4. package/browser/esm/4o4C9bFlmQd0jPCw.mjs +310 -0
  5. package/browser/esm/6bLEYJYXAK-pOt4_.mjs +294 -0
  6. package/{cdn/assets/J3hutJxqQiHENpIe.js → browser/esm/8j7_68o_ftwk3Slv.mjs} +120 -118
  7. package/browser/esm/{BN2d5U1nw7pRtOrn.mjs → 9MTXF6MTjOgoHb-7.mjs} +1 -1
  8. package/browser/esm/9nCLSPKkGRmkIcuH.mjs +1694 -0
  9. package/browser/esm/{Dwxz0s23ra1tRtsH.mjs → 9wo9OtQmIPqM31Sy.mjs} +2 -2
  10. package/browser/esm/B-O2rWzzFV43__aU.mjs +9523 -0
  11. package/browser/esm/{B7iV5qzlmJlM2nQv.mjs → B-iVqSEgzuf6m47x.mjs} +2 -2
  12. package/browser/esm/{x6GcENwqoUVbd60j.mjs → B0ko2JVTNhsWWWTe.mjs} +1 -1
  13. package/{cdn/assets/pc49xtHdprXZLW2X.js → browser/esm/B1SstI4rcUe8OJ-b.mjs} +1 -1
  14. package/browser/esm/{CqoHxlGpZ3yzPj5V.mjs → B31Krc6W_iL-2TQt.mjs} +12 -12
  15. package/browser/esm/{B00ixdmb8-O5ijEp.mjs → B3ZFz_Z4E28AFJS3.mjs} +1 -1
  16. package/browser/esm/{PtGiIWFBYP-ujLmf.mjs → B5XpACGLcy3zYqlT.mjs} +1 -1
  17. package/browser/esm/{BsUrrzAgfyAdcCJW.mjs → B5cwFaYPxXTSh6vo.mjs} +2 -2
  18. package/browser/esm/{BAdRecWK1maKGOZd.mjs → B8VbElyA5zbjFNs1.mjs} +1 -1
  19. package/browser/esm/B90jZwl6n7fpLoRK.mjs +89 -0
  20. package/browser/esm/{ZbGPiRN9j0629JJQ.mjs → BBS47_AI2p2r0QxX.mjs} +2 -2
  21. package/browser/esm/BBrVIUFf4NJSXblH.mjs +3716 -0
  22. package/browser/esm/{DRm1R4uVOkaMfXNI.mjs → BDWKrgmyLVPkX3h0.mjs} +1 -1
  23. package/browser/esm/{qYca4mdySLkACfo1.mjs → BF9tQV6iUGvJK6QH.mjs} +1 -1
  24. package/browser/esm/{CRAzVh3CaAa16avf.mjs → BFL9_-ur7Lhhkg2F.mjs} +36 -35
  25. package/browser/esm/{ErIXJFPDFXwGEL8V.mjs → BFvZ5JI-hBk3FNJW.mjs} +2 -2
  26. package/browser/esm/{CSEMxasVyGCekxKf.mjs → BGDndra6U64QPYm4.mjs} +1 -1
  27. package/browser/esm/BHAYf-zNKfoCTsTT.mjs +86 -0
  28. package/browser/esm/{ClJvUf8aR8vNC_3Z.mjs → BHKm0iIUckEaUMLV.mjs} +3 -3
  29. package/browser/esm/{_MPToH4oMe4rhTdZ.mjs → BIo-ELlYF8kzkLvH.mjs} +3 -3
  30. package/browser/esm/{CCd192S7yVpc6iOe.mjs → BJKUgLha2XmF08mO.mjs} +17 -16
  31. package/browser/esm/{DvWCBuY0jAL-RmJV.mjs → BKS9kx_PEanwLUuU.mjs} +793 -787
  32. package/browser/esm/BLoUmwvJ5t1eBdZ8.mjs +104 -0
  33. package/browser/esm/{DSviq1TNoiIAGW7W.mjs → BN630GsmoKmNU7ur.mjs} +1 -1
  34. package/browser/esm/{CVxlfyE-gnJM8hOz.mjs → BNWxTMoiH1NkkmAh.mjs} +8 -8
  35. package/{cdn/assets/DQIRFXG4MveFkK3I.js → browser/esm/BNavcunnTVMpcxDs.mjs} +1 -1
  36. package/browser/esm/BRXV-NrDDC3ZrpMt.mjs +55466 -0
  37. package/browser/esm/{FO1Jezau486fH4kN.mjs → BRxDfB_xWCqmT-hR.mjs} +1 -1
  38. package/browser/esm/{DnyZmrwPxShyeUjm.mjs → BT-Bqh_7C0pZ5FlX.mjs} +118 -269
  39. package/{cdn/assets/DfESVLC8CAi8m8A7.js → browser/esm/BUWDOAY73JPQoNzs.mjs} +1 -1
  40. package/browser/esm/{CHMqT9DzYKTxPfP6.mjs → BV2wamfivt6aMUhk.mjs} +1 -1
  41. package/browser/esm/BWQqT6R8MZkUWAe9.mjs +7 -0
  42. package/browser/esm/BYBEZ_hZVBDv3eEU.mjs +1389 -0
  43. package/browser/esm/B_9GaCdaUs6AlWf3.mjs +1417 -0
  44. package/browser/esm/BaNdc_0Lf4FVPUW5.mjs +9715 -0
  45. package/{cdn/assets/BuYS_ZjSlcvWZ1JC.js → browser/esm/BaWDPv9pjRGmAQva.mjs} +2667 -2091
  46. package/{cdn/assets/i0P63Wd0RRlgJotb.js → browser/esm/BaaB1nz3Z8IIy5XL.mjs} +1 -1
  47. package/browser/esm/BbUF-CQBg3zQ_h9S.mjs +323 -0
  48. package/browser/esm/{cwuYkcKwsKkPe3gG.mjs → BdN5nsKULzTfOgkY.mjs} +2 -2
  49. package/{cdn/assets/DXo8mR6t5HGsmTcu.js → browser/esm/Bdt5IdX6u9CLkJdC.mjs} +1 -1
  50. package/browser/esm/BfyWJYjj89_N0zfg.mjs +213 -0
  51. package/browser/esm/{sDVzjXC1mS5rucF5.mjs → BgE-AWbezo3ZcNQU.mjs} +576 -696
  52. package/browser/esm/Bi8dy2A1euGZeE4C.mjs +780 -0
  53. package/browser/esm/{f1OJemsiZnbwnds-.mjs → BiJSAELjvcGbbrB5.mjs} +15 -15
  54. package/browser/esm/{sxxbiJiCMOW2Eivd.mjs → BiLb98_m7AwaRkX6.mjs} +7477 -5995
  55. package/{cdn/assets/FjNOhkR7-JAIaRP6.js → browser/esm/BiSGu7XE2wP-COS-.mjs} +1 -1
  56. package/browser/esm/Bj5v_mMZnT65-EYm.mjs +521 -0
  57. package/browser/esm/Bkf3SJynCJKiDDk9.mjs +1552 -0
  58. package/browser/esm/{iC69oOND5T8khIWf.mjs → BlC9vz791AaVSbC5.mjs} +6 -6
  59. package/browser/esm/{vGKTE7yjY8y-XnsW.mjs → BldyCakCtPYtGXcm.mjs} +2 -2
  60. package/{cdn/assets/DVpi1vC8ixXvUQG_.js → browser/esm/BovxopS-62ImjzWq.mjs} +1 -1
  61. package/browser/esm/BpJup_wq5-qM4TIN.mjs +390 -0
  62. package/browser/esm/Bqf1HNOGA-pPTdl2.mjs +322 -0
  63. package/browser/esm/{BlPn_DXaEXOPxMxC.mjs → Br1Vf_O1YcX7sOJE.mjs} +1 -1
  64. package/{cdn/assets/W1d6GQyySAHrtjEu.js → browser/esm/BsVFvNqmAQw6ai0x.mjs} +1626 -1018
  65. package/browser/esm/Bt4FhwPuIE1PRsBM.mjs +193 -0
  66. package/{cdn/assets/C3r_9RqlWrEmlXZ1.js → browser/esm/Bx9qg5bL1Fzbvk1z.mjs} +1 -1
  67. package/browser/esm/BzZWDsHSEnXClrlJ.mjs +7 -0
  68. package/browser/esm/{CaS8_J5HfBRk5_Nw.mjs → C02QWvfYw-El2r9j.mjs} +32 -32
  69. package/{cdn/assets/BSCja5yvevmKZPBB.js → browser/esm/C4Vjb-3d4J7GxBGw.mjs} +1 -1
  70. package/{cdn/assets/DjtXfgbmXjUAoG0y.js → browser/esm/C635yBozh_t0DPLr.mjs} +1 -1
  71. package/browser/esm/{djM9mJznx8GzVq51.mjs → C7GZIkD5Jz7A5r_a.mjs} +14 -14
  72. package/{cdn/assets/_t0Mx-mUFVtmVNkU.js → browser/esm/C7Yr6jxJx_xXDUR2.mjs} +1 -1
  73. package/browser/esm/C8XNRmzAp2MWyeej.mjs +42 -0
  74. package/{cdn/assets/CQOyeq_-pg3CM-uA.js → browser/esm/C9oBHe1kBAevREtg.mjs} +1 -1
  75. package/browser/esm/{_zRV52yhE4gPf3XI.mjs → C9oIU866QVMlgGyQ.mjs} +55 -55
  76. package/browser/esm/{SNze-adFJwKuGSQW.mjs → CAeD2o0Ls4sIyokt.mjs} +1 -1
  77. package/browser/esm/{C9NyIoUahFiyRCxP.mjs → CBRVZmrwcMfEHc5P.mjs} +1 -1
  78. package/browser/esm/{DTn9oYyiIYgyijAk.mjs → CDWuursC7HDw-bO8.mjs} +25 -24
  79. package/browser/esm/{DoS1sE431fEhdOQb.mjs → CF6TsrZkUX12RY9E.mjs} +4 -4
  80. package/browser/esm/{C4VT6lNbpaDXCpBb.mjs → CFPaTEuxUxH48Dnc.mjs} +2 -2
  81. package/browser/esm/{Dy44qJVkwNseMG-3.mjs → CHGtyPsxQrhRB5bz.mjs} +1 -1
  82. package/browser/esm/{pKc_RPdZPLAgvNDh.mjs → CI2oW6QUhftq4Zxe.mjs} +2 -2
  83. package/browser/esm/CIoNg-5VkB5Nf7xb.mjs +256 -0
  84. package/browser/esm/{CnWNviK4qlX2GVl6.mjs → CJJ6JyOoWWElIIFf.mjs} +12 -13
  85. package/{cdn/assets/gpQ4FdJMbIScKnS_.js → browser/esm/CJdgS3TQ_2BcjCW6.mjs} +8 -8
  86. package/browser/esm/{DNaPo7BQu6hr1fWq.mjs → CK5tMP35Iv98na5Z.mjs} +1 -1
  87. package/browser/esm/CLesyjpCdfNlo_s3.mjs +210 -0
  88. package/browser/esm/CMCV8PICIpUjWafw.mjs +12816 -0
  89. package/browser/esm/{D2coM-dNrlLpnUu5.mjs → CN1_Dq2VdyHJ8cMR.mjs} +6 -6
  90. package/browser/esm/{DLhK_oSGg71ry6-m.mjs → CNTmB0u0Mmzslqit.mjs} +6 -6
  91. package/browser/esm/{D-55MlIn7Wo_hdjI.mjs → CNsG-HP7MrYv4ANy.mjs} +328 -110
  92. package/browser/esm/{DAE3Kv0Vs0VuBecT.mjs → COtPL6l443kTvLpc.mjs} +1 -1
  93. package/browser/esm/{D7DWH3-5fBNx8jtc.mjs → CP_GYwZVbwA9vzxA.mjs} +2 -2
  94. package/{cdn/assets/CFvKDDbrL3wpXnQH.js → browser/esm/CRc3MloTINO1cx9Y.mjs} +1 -1
  95. package/browser/esm/{C5EKgE9Owsc_juw-.mjs → CSUhHtPXRx-MiOJ0.mjs} +1 -1
  96. package/browser/esm/CVB9R-zt99a3DSPN.mjs +3091 -0
  97. package/{cdn/assets/BoFx07POTorOb5g-.js → browser/esm/CVGsocXM6EdK3av8.mjs} +2538 -1728
  98. package/browser/esm/CVg6x0dnCUjr2iMY.mjs +7723 -0
  99. package/browser/esm/{DxwprgjYhcmfDbXH.mjs → CWLvkJU2bOMidhWV.mjs} +17 -17
  100. package/browser/esm/{BBjgqNlHm-ssbSAG.mjs → C_lz-BVnapcDsXH0.mjs} +1 -1
  101. package/browser/esm/C_x94fC0O4_OpNRB.mjs +101 -0
  102. package/browser/esm/CczQS-TJwiXbRhYC.mjs +200 -0
  103. package/{cdn/assets/RfHd1JATBlcsfLPv.js → browser/esm/CdOK8MepIC51cdz1.mjs} +1 -1
  104. package/browser/esm/{rkTVQiYG3wd8oPom.mjs → Cdg4TpupUeYIiz2B.mjs} +3 -3
  105. package/browser/esm/Cf-LLddGP5wUU4hH.mjs +8 -0
  106. package/browser/esm/Cf5dlM0Pkqz1y7Nw.mjs +387 -0
  107. package/{cdn/assets/BI6afPOpgNYkzIWv.js → browser/esm/CfGCIpWOVrKyroeI.mjs} +1775 -1731
  108. package/browser/esm/Cgff_mU98dEc-kSv.mjs +1723 -0
  109. package/browser/esm/{CvWGtHslTdesJik-.mjs → ChTKR1wEz8hgPWRE.mjs} +10 -9
  110. package/{cdn/assets/BAH_cWcQEIBKWnl6.js → browser/esm/Cl1bVTUk0rQUQT9p.mjs} +1 -1
  111. package/browser/esm/{CDsuiN--qdALFyql.mjs → ClKS_5IuXertzGEp.mjs} +2 -2
  112. package/browser/esm/{CWJzHmEgahdOfNjH.mjs → Cnx0vOv2ePi94hMN.mjs} +1 -1
  113. package/browser/esm/{BVJUL2HhoedhbwVy.mjs → CpUZbIdONEC6mghF.mjs} +11 -10
  114. package/browser/esm/{BxhKgo_rPQ2d12HT.mjs → CpzzMIebww7p4m_V.mjs} +4 -4
  115. package/browser/esm/CtX8ODZQGoUqUie3.mjs +162 -0
  116. package/browser/esm/{BeMLfv6hWo15VCIL.mjs → CwIcsETflE-gpYF6.mjs} +23 -23
  117. package/{cdn/assets/CVcCUfSRsiZ1-6hs.js → browser/esm/CzpnOqHBXxESl5Ts.mjs} +1 -1
  118. package/browser/esm/{mZ92wNrHVpYdli1U.mjs → D3HgYapmfdL-RhEV.mjs} +5 -5
  119. package/browser/esm/{ByUcqyCNfqi5Mm7w.mjs → D46u8d3O49bDLflJ.mjs} +1 -1
  120. package/browser/esm/{px-aQ8dMjiWag_pV.mjs → D5KlrP1rlBZO7HyP.mjs} +1 -1
  121. package/{cdn/assets/DONxZZT2Iwu7psS5.js → browser/esm/D5wm_fLXLK3Ve1ir.mjs} +6 -5
  122. package/browser/esm/{DLqc11Pf8vaE4Q5B.mjs → D90zUAjsvdYt4zAc.mjs} +1 -1
  123. package/browser/esm/DAEoN5lF7Xw1VMoH.mjs +520 -0
  124. package/browser/esm/DCA1pexOA5sUcYVT.mjs +181 -0
  125. package/browser/esm/{D0r2MPlWLnStWJNW.mjs → DD6l6wL5lCLFdLOw.mjs} +144 -134
  126. package/browser/esm/DFFX8FaN8Xyq2YvS.mjs +131 -0
  127. package/browser/esm/DFzpsLSn8pIrTlLO.mjs +95 -0
  128. package/browser/esm/DJMHQzwcPgTpS0f5.mjs +1240 -0
  129. package/browser/esm/{VwGokBaawZfZiV2X.mjs → DJhxuNvyE7FzNXTv.mjs} +1 -1
  130. package/{cdn/assets/H-JnJQMcZQbpvjdb.js → browser/esm/DK3BYp4NTX8n36q5.mjs} +1 -1
  131. package/browser/esm/DKXz55ACPsNADpJo.mjs +9 -0
  132. package/browser/esm/{CZOJogyZqMfUxcXj.mjs → DKxCeh3yib-owCxs.mjs} +1 -1
  133. package/browser/esm/{ycmpAs4kQfeh78Pa.mjs → DL57MpyMuNosTcrB.mjs} +1 -1
  134. package/browser/esm/DN14h84frphTmQnr.mjs +367 -0
  135. package/browser/esm/{Cpza4AeltEVHASij.mjs → DPE3kSrS3RMPgCwe.mjs} +3 -3
  136. package/browser/esm/DQsUwoGymfvPjfBo.mjs +86 -0
  137. package/browser/esm/{DJqj66SnUcx0QmSN.mjs → DUZyG-8cyY9A0Zg-.mjs} +1 -1
  138. package/browser/esm/{DNCqTF9EbT-U1TdV.mjs → DWlIofDXtKiTFRl3.mjs} +3 -3
  139. package/browser/esm/{CfltjY8hY-RPwwpd.mjs → DWs_Iccs4ADzMYw7.mjs} +7 -7
  140. package/browser/esm/DZU9jkqaNCYuvDzi.mjs +8196 -0
  141. package/browser/esm/DZxgKlZVMKS5Ta04.mjs +199 -0
  142. package/browser/esm/D_RNoIZHUhzXpaw6.mjs +232 -0
  143. package/{cdn/assets/anQDUZhHMDPi1eha.js → browser/esm/DaJhQHZ8na6yCHir.mjs} +149 -149
  144. package/{cdn/assets/BWo1N4YbK_zGU0nu.js → browser/esm/DagxhIjpKea9MwI8.mjs} +1 -1
  145. package/browser/esm/{DjdkGy-EI1kSo226.mjs → DbewMnLKZoGLGFNh.mjs} +1 -1
  146. package/browser/esm/DcuXU4w8jFVnuLgh.mjs +60 -0
  147. package/browser/esm/Df4WRA6refKZ9x9I.mjs +141 -0
  148. package/browser/esm/Dg8kGViumXiDAGwT.mjs +569 -0
  149. package/{cdn/assets/DWgp4t9N9u0eWthH.js → browser/esm/DhLN5r1sTHL_BWeH.mjs} +1 -1
  150. package/browser/esm/{ZxsFYopF0_WWqw4Q.mjs → DhU_l9pcEddg9s24.mjs} +1 -1
  151. package/browser/esm/{CTI-mCJbJzitJZwj.mjs → DiabpzKzIUUyat-1.mjs} +1 -1
  152. package/browser/esm/Dic2cHiohtgkK2jT.mjs +89 -0
  153. package/browser/esm/DizmXzo0RwB1aISW.mjs +86 -0
  154. package/browser/esm/{DrI_S0A9TQvriTua.mjs → Dl29uXIaOLiBIDEI.mjs} +1 -1
  155. package/browser/esm/{BtGmrIqU9W1L8zfZ.mjs → Dl40S1lFKvsN0DvK.mjs} +1 -1
  156. package/{cdn/assets/DxcRLd7wmBGDgJsA.js → browser/esm/DlWoVcsWZHiN-EYf.mjs} +1 -1
  157. package/{cdn/assets/DQjxp9lDP9DzP8ah.js → browser/esm/DmkrxPsGTgcfP5Rz.mjs} +56 -56
  158. package/browser/esm/{rY-dC3WB558TIbum.mjs → Dn6OF7owJvTQrrts.mjs} +4 -4
  159. package/browser/esm/DpRsbOf9X17if0J7.mjs +1645 -0
  160. package/browser/esm/Drw9hD1JE7JCMign.mjs +422 -0
  161. package/browser/esm/{BThOwSja2ra4xejQ.mjs → DsHzYBPSadCXZi-n.mjs} +1466 -1388
  162. package/browser/esm/{LAbUYeLiPG8z9cmA.mjs → DtegXHCQSKTTGQeu.mjs} +15 -15
  163. package/browser/esm/{C-0viTjg1dT2F-sk.mjs → Dut7EHGO0G5wuZvA.mjs} +2 -2
  164. package/browser/esm/{kVBPUUnVyZfb8pf3.mjs → DwhGTfGva3F7vuwp.mjs} +5 -5
  165. package/{cdn/assets/DYvBgX17ZerZSHEJ.js → browser/esm/DxwdHqgA78DuBgP5.mjs} +30 -31
  166. package/browser/esm/{aUREGNA8H7p4BpMK.mjs → DychvmektExlalXS.mjs} +3 -3
  167. package/{cdn/assets/CBdNC7BOfc5TewHU.js → browser/esm/DyeYHUP9q10K48wL.mjs} +1 -1
  168. package/{cdn/assets/BsTFy_iJXJYmaO3Z.js → browser/esm/DyvMwqOmBhQFYxOo.mjs} +5 -5
  169. package/browser/esm/{Cy00y9b9j17Txyv1.mjs → DzF6mYUZfggTAjhM.mjs} +1 -1
  170. package/browser/esm/Dzj3KK6YPVXSha8q.mjs +5117 -0
  171. package/browser/esm/Dzyz_pks7xPGZbyH.mjs +23434 -0
  172. package/browser/esm/{Dv8aQFTTaQBJKDDk.mjs → GA5X6vLsOcXufGyF.mjs} +1 -1
  173. package/browser/esm/Hx70AIfSA_0RVX86.mjs +415 -0
  174. package/browser/esm/{DaMKWQQTgIF08cT7.mjs → JIICfCUe6qam-nnP.mjs} +7 -7
  175. package/browser/esm/{UTZcodQydbuMfCOS.mjs → Jn0_AtebABdIzyQ8.mjs} +1 -1
  176. package/browser/esm/{CtZPEkaldpJpoGtW.mjs → KG-A3VX4kcf2uLJI.mjs} +67 -67
  177. package/browser/esm/{CMxbiQ5J79M3n1tk.mjs → PD_ckP5IyZurtALu.mjs} +723 -373
  178. package/{cdn/assets/lqknEt3DTma5Juxs.js → browser/esm/PFd1HLX9x3NbZS0Q.mjs} +1 -1
  179. package/browser/esm/{D2aQPiGg0ZoMYzuf.mjs → Q4gowihHveaVg346.mjs} +5 -5
  180. package/browser/esm/TEqlVdpb4Wjm-WJR.mjs +281 -0
  181. package/browser/esm/{DGcvio2uhlrsE3ZY.mjs → Ub7lo1Zsgc4OkWHw.mjs} +10 -10
  182. package/browser/esm/{CxCipDFamYSOctBo.mjs → VHANuEgclliEVOJy.mjs} +48 -46
  183. package/browser/esm/{Db6Tvr45TS9J5Qsb.mjs → WGYh_LRO1dkbp-TV.mjs} +35 -33
  184. package/browser/esm/{ByqhqEMBLrnkaPKE.mjs → WeD0V8DDCj3KQ_8p.mjs} +26 -24
  185. package/browser/esm/{DG3BfxRsbjey-B7E.mjs → XYN8zIYF95HfOLO2.mjs} +2 -2
  186. package/browser/esm/XvS1NvLqAFQgx6eS.mjs +7 -0
  187. package/{cdn/assets/Dc2ZwgbIEgYWwAsF.js → browser/esm/Z10MZFA0Sc2Zcelz.mjs} +1 -1
  188. package/browser/esm/{-LoBx7J6imeqaxCq.mjs → bFtJ6ds2ojy78Wre.mjs} +7 -7
  189. package/browser/esm/{DqBj-9o7UdXu4qhb.mjs → bTZCD31OE4KkUy4u.mjs} +1 -1
  190. package/browser/esm/{CQuv-nk5jtXUfu7C.mjs → bYlwY2JZnvT1cbtL.mjs} +2 -2
  191. package/browser/esm/{BaEZmurTZnX_yfKD.mjs → buJRIWKU9gQ4TTK_.mjs} +323 -369
  192. package/{cdn/assets/BPrHgyAsm2Htx15h.js → browser/esm/c6MwBF7fqj-4Wqct.mjs} +1 -1
  193. package/browser/esm/d3pzf6IOaGjo_S-F.mjs +2213 -0
  194. package/browser/esm/{DSf-Db1h8rlW2A6n.mjs → e5QfIq2gAzQVRtfG.mjs} +5 -5
  195. package/browser/esm/{DGuynZFJ9tqziqQs.mjs → gTTt3H5M0Lh8VxjO.mjs} +7 -7
  196. package/browser/esm/index.mjs +49 -645
  197. package/{cdn/assets/BhkeuRcx8RlLCQ5E.js → browser/esm/lPeOxAutCOlSB-aC.mjs} +1 -1
  198. package/browser/esm/{BRfat1fV3oGLwvin.mjs → mjkAWxWBrwQpoEkc.mjs} +15 -15
  199. package/browser/esm/{Bi5-feQLtwpV6Ai8.mjs → nmaneEnoRhUuMliV.mjs} +5 -5
  200. package/browser/esm/{DeUXRggj8Oz9ru_i.mjs → oLOwgPmipnKc68nJ.mjs} +1 -1
  201. package/browser/esm/{BMlPFJ1glExv-70Z.mjs → oY2yN-_0_AcCI46E.mjs} +1 -1
  202. package/browser/esm/szeZ7VgnRHyi2DxR.mjs +381 -0
  203. package/{cdn/assets/CTdFZ_I-41Vr6Dy4.js → browser/esm/tQAwA9RKsgzjziNe.mjs} +1 -1
  204. package/{cdn/assets/J9i3r1fU0H10b2hX.js → browser/esm/t_7A_GdY394OUV4v.mjs} +1 -1
  205. package/browser/esm/uBm_7th3ordJJKKM.mjs +1298 -0
  206. package/browser/esm/vY2ZLR024kVOwWej.mjs +36 -0
  207. package/browser/esm/{DQEjvIGMgEkiaP6J.mjs → xUNkyQFYnzQAzsVs.mjs} +1 -1
  208. package/browser/esm/xhVehZswNSGVAhdd.mjs +195 -0
  209. package/{cdn/assets/BwOxnbR61WFJwy0A.js → browser/esm/y-iW7vsJV47pYbw4.mjs} +1 -1
  210. package/browser/esm/y5zzqXzWZt9iBT17.mjs +5632 -0
  211. package/{cdn/assets/B0Wjc3lwtjKMwnvn.js → browser/esm/y8mfWM7VlyfJEEwg.mjs} +1 -1
  212. package/{browser/esm/M7RYrx20B_Yl_euJ.mjs → cdn/assets/03NnLxMlQLUwCU6J.js} +8 -8
  213. package/cdn/assets/1oQRbol_4RzeM8pE.js +12 -0
  214. package/cdn/assets/{CILUMtSddGz7WXEv.js → 3Oqq1u2C8zC0TeW9.js} +84 -84
  215. package/cdn/assets/4uPsJWrLx7xRHQAh.js +639 -0
  216. package/cdn/assets/{ENtt4kmaU9mJfVEp.js → 6GgPtwsOcxg8XpRN.js} +10 -10
  217. package/cdn/assets/{D8DghdqjOtBzO2Wx.js → 7twUDisI3AH_vo2v.js} +4 -4
  218. package/cdn/assets/{BeQ95CzwR65il0CK.js → 8CW-puLLSNyeaGce.js} +2 -3
  219. package/cdn/assets/{BB4MW8sSYEXjPvvf.js → 8yRVrfAZmWoSynP2.js} +5 -5
  220. package/cdn/assets/{BN2d5U1nw7pRtOrn.js → 9MTXF6MTjOgoHb-7.js} +1 -1
  221. package/cdn/assets/9zx-c-XsXQJu3H6F.js +237 -0
  222. package/cdn/assets/B-aF0nVKMi0rBQ-X.js +257 -0
  223. package/cdn/assets/{x6GcENwqoUVbd60j.js → B0ko2JVTNhsWWWTe.js} +1 -1
  224. package/{browser/esm/pc49xtHdprXZLW2X.mjs → cdn/assets/B1SstI4rcUe8OJ-b.js} +1 -1
  225. package/cdn/assets/{B00ixdmb8-O5ijEp.js → B3ZFz_Z4E28AFJS3.js} +1 -1
  226. package/cdn/assets/B4zK-38sPk49SiBE.js +9524 -0
  227. package/cdn/assets/{PtGiIWFBYP-ujLmf.js → B5XpACGLcy3zYqlT.js} +1 -1
  228. package/cdn/assets/B6hsm_RseP5jRKxa.js +100 -0
  229. package/cdn/assets/{DHH_uKVzQ_kRYO2N.js → B71MtA2mmixmeooi.js} +18 -18
  230. package/cdn/assets/B7L2gEZlcb8lr2A4.js +8196 -0
  231. package/cdn/assets/{BAdRecWK1maKGOZd.js → B8VbElyA5zbjFNs1.js} +1 -1
  232. package/cdn/assets/B9dUWlxApLMvjz60.js +220 -0
  233. package/cdn/assets/B9w9g_nectPJhun5.js +1724 -0
  234. package/cdn/assets/{AjMG7Fb9r4Fk7Hsf.js → BCypA6VuKdd2n_ru.js} +19 -18
  235. package/cdn/assets/{DRm1R4uVOkaMfXNI.js → BDWKrgmyLVPkX3h0.js} +1 -1
  236. package/cdn/assets/BETDm_1AaWuW6BVj.js +516 -0
  237. package/cdn/assets/{C32co-XulWTkEKrW.js → BEvqzG-mTBe_4aVC.js} +2 -2
  238. package/cdn/assets/{qYca4mdySLkACfo1.js → BF9tQV6iUGvJK6QH.js} +1 -1
  239. package/cdn/assets/BFKaVO5u424S8iQa.js +86 -0
  240. package/cdn/assets/{CSEMxasVyGCekxKf.js → BGDndra6U64QPYm4.js} +1 -1
  241. package/cdn/assets/BI1IDPvx--ARef3O.js +196 -0
  242. package/cdn/assets/{Cw7AJWd0S2sjRmr6.js → BJ5RRYxWA_yTbVpr.js} +1478 -1400
  243. package/cdn/assets/BJV4kSnvZHNfd68y.js +193 -0
  244. package/cdn/assets/BK2u8-YC8sG_k5G1.js +1299 -0
  245. package/cdn/assets/{DSviq1TNoiIAGW7W.js → BN630GsmoKmNU7ur.js} +1 -1
  246. package/{browser/esm/DQIRFXG4MveFkK3I.mjs → cdn/assets/BNavcunnTVMpcxDs.js} +1 -1
  247. package/cdn/assets/BORHWDUKR6caukc5.js +199 -0
  248. package/cdn/assets/BOeafp2_IuiQUCy9.js +7 -0
  249. package/cdn/assets/{FO1Jezau486fH4kN.js → BRxDfB_xWCqmT-hR.js} +1 -1
  250. package/{browser/esm/DfESVLC8CAi8m8A7.mjs → cdn/assets/BUWDOAY73JPQoNzs.js} +1 -1
  251. package/cdn/assets/{0vqRTRN0wEzWao1c.js → BUsC6YAGDNArajFL.js} +75 -74
  252. package/{browser/esm/ztqpWR65YYMZ3EPk.mjs → cdn/assets/BV13zVUdMca1rMPB.js} +120 -118
  253. package/cdn/assets/{C9NyIoUahFiyRCxP.js → BV2wamfivt6aMUhk.js} +1 -1
  254. package/cdn/assets/BWbSAM8vJA9oOVLo.js +46 -0
  255. package/cdn/assets/{De2z8LdHaWRFiR5T.js → BXVCl_xwTk61fpO9.js} +2 -2
  256. package/cdn/assets/BZEFRQpz68GXn6T9.js +96 -0
  257. package/cdn/assets/{wM7DzeOpoEGBVDBe.js → B_sANJqcUwqmlTx5.js} +2 -2
  258. package/{browser/esm/i0P63Wd0RRlgJotb.mjs → cdn/assets/BaaB1nz3Z8IIy5XL.js} +1 -1
  259. package/cdn/assets/{DckmFyHxGX4Y1gOq.js → BbO2UBFWu05VAtNb.js} +18 -17
  260. package/cdn/assets/{CCvBdPu7W2ZF6A9J.js → BdW05SsbRlVhxGr6.js} +3 -3
  261. package/cdn/assets/BdnTLvN0grpQAsLF.js +8 -0
  262. package/{browser/esm/DXo8mR6t5HGsmTcu.mjs → cdn/assets/Bdt5IdX6u9CLkJdC.js} +1 -1
  263. package/cdn/assets/Bebab8nHNHqve2AI.js +233 -0
  264. package/{browser/esm/FjNOhkR7-JAIaRP6.mjs → cdn/assets/BiSGu7XE2wP-COS-.js} +1 -1
  265. package/cdn/assets/BjAnEBtnBD5O0-sc.js +106 -0
  266. package/cdn/assets/{hg8WYI0Yy4WPPPoP.js → BmWMHgdcbZuZUGtm.js} +11 -11
  267. package/{browser/esm/DVpi1vC8ixXvUQG_.mjs → cdn/assets/BovxopS-62ImjzWq.js} +1 -1
  268. package/cdn/assets/Bqlj5Zz-vJpMDs6i.js +311 -0
  269. package/cdn/assets/{BlPn_DXaEXOPxMxC.js → Br1Vf_O1YcX7sOJE.js} +1 -1
  270. package/cdn/assets/{CSIZpJClc66_20kP.js → BuHsbgcxlvkOHGGR.js} +118 -269
  271. package/{browser/esm/C3r_9RqlWrEmlXZ1.mjs → cdn/assets/Bx9qg5bL1Fzbvk1z.js} +1 -1
  272. package/cdn/assets/BzZTldYRBXUqOINX.js +781 -0
  273. package/cdn/assets/C-_jzDXetpu0rH2K.js +8 -0
  274. package/cdn/assets/C2ydnpxcrFknfLw1.js +214 -0
  275. package/{browser/esm/BSCja5yvevmKZPBB.mjs → cdn/assets/C4Vjb-3d4J7GxBGw.js} +1 -1
  276. package/{browser/esm/DjtXfgbmXjUAoG0y.mjs → cdn/assets/C635yBozh_t0DPLr.js} +1 -1
  277. package/cdn/assets/C7FA7N-GON7DscOD.js +19 -0
  278. package/{browser/esm/_t0Mx-mUFVtmVNkU.mjs → cdn/assets/C7Yr6jxJx_xXDUR2.js} +1 -1
  279. package/cdn/assets/C7fZFw4yQ9VNHtnV.js +17 -0
  280. package/cdn/assets/C8XNRmzAp2MWyeej.js +42 -0
  281. package/{browser/esm/DAprxR00V9qvNLL2.mjs → cdn/assets/C9_WZzkqVDNPA1d0.js} +1708 -1660
  282. package/{browser/esm/CQOyeq_-pg3CM-uA.mjs → cdn/assets/C9oBHe1kBAevREtg.js} +1 -1
  283. package/cdn/assets/{SNze-adFJwKuGSQW.js → CAeD2o0Ls4sIyokt.js} +1 -1
  284. package/cdn/assets/{CHMqT9DzYKTxPfP6.js → CBRVZmrwcMfEHc5P.js} +1 -1
  285. package/cdn/assets/CBsadiIVpXoTVHLj.js +183 -0
  286. package/{browser/esm/D88StfSjZJi5E8Xb.mjs → cdn/assets/CDv_hXnUZNB1HY3N.js} +2384 -1905
  287. package/cdn/assets/{CFBgmXap8kmumhoz.js → CELW1QxGUlPfcuHG.js} +144 -134
  288. package/cdn/assets/CF6YxjWkuaqaHcCi.js +2230 -0
  289. package/cdn/assets/{CbTN0q6XnYGJqyEp.js → CGklNVK7pkjOQ6XF.js} +261 -261
  290. package/cdn/assets/{Dy44qJVkwNseMG-3.js → CHGtyPsxQrhRB5bz.js} +1 -1
  291. package/cdn/assets/{D32D_biNXRCZ24vG.js → CIa9t2NsEFKqvGac.js} +10 -10
  292. package/cdn/assets/CIfJsifn66BBcj2W.js +86 -0
  293. package/cdn/assets/CIscj5V7u9g5ZxM3.js +7 -0
  294. package/cdn/assets/{BNsqqoZY7a4N1wWC.js → CJgN6A7fquRRWJ9h.js} +328 -110
  295. package/cdn/assets/{DNaPo7BQu6hr1fWq.js → CK5tMP35Iv98na5Z.js} +1 -1
  296. package/cdn/assets/CLDXVyr5jbJC7Ldf.js +7 -0
  297. package/cdn/assets/CLesyjpCdfNlo_s3.js +210 -0
  298. package/cdn/assets/{Dp-GJXOMz_b8qAxD.js → CMRiIxUHB5XcDtA8.js} +2 -2
  299. package/cdn/assets/{DAE3Kv0Vs0VuBecT.js → COtPL6l443kTvLpc.js} +1 -1
  300. package/{browser/esm/CFvKDDbrL3wpXnQH.mjs → cdn/assets/CRc3MloTINO1cx9Y.js} +1 -1
  301. package/cdn/assets/CS7L0XE_IvJKdpQH.js +416 -0
  302. package/cdn/assets/{C5EKgE9Owsc_juw-.js → CSUhHtPXRx-MiOJ0.js} +1 -1
  303. package/cdn/assets/{D-yz3V2UC54rwctD.js → CSpWGMyjLegYuwTq.js} +2 -2
  304. package/cdn/assets/CVCFVKDhgOFbBNWn.js +382 -0
  305. package/cdn/assets/{DSXJHEORGmMQX_Mb.js → CViBm-zHl4k8Znzm.js} +12 -12
  306. package/cdn/assets/{DZRm4H75lnEtOG8e.js → CWRXS9rkz8fCwbZH.js} +48 -46
  307. package/cdn/assets/CZ0iN5i3edmVHcRK.js +323 -0
  308. package/cdn/assets/{B3NWCYKXucbHhOix.js → C_Q71OCVP6nPyP4U.js} +26 -26
  309. package/cdn/assets/{BBjgqNlHm-ssbSAG.js → C_lz-BVnapcDsXH0.js} +1 -1
  310. package/cdn/assets/CbKXmBz5CY-IwYsS.js +132 -0
  311. package/cdn/assets/CbqZMJ1c683b5iE7.js +278 -0
  312. package/cdn/assets/CdDIc0DsAwHzxpeO.js +5117 -0
  313. package/{browser/esm/RfHd1JATBlcsfLPv.mjs → cdn/assets/CdOK8MepIC51cdz1.js} +1 -1
  314. package/cdn/assets/{C6INLvBy8kdzFpsX.js → CdW0mis0FyG90paw.js} +576 -696
  315. package/cdn/assets/{DicTo_3G-KZyWDiE.js → CevaeSbWdKO5qeRu.js} +294 -340
  316. package/cdn/assets/{DxisV9_27l_WU-nk.js → CeySvrdNiT00QQJC.js} +5 -5
  317. package/cdn/assets/Cf-LLddGP5wUU4hH.js +8 -0
  318. package/cdn/assets/{CIyaijfp6itgRpFM.js → Cf0bbHHOW6iwvyXg.js} +2 -2
  319. package/cdn/assets/CixdB4xXcQhebm5U.js +73 -0
  320. package/cdn/assets/{BelX6bvQPsGuo-x3.js → Cj2lJ05kVoDb5HGx.js} +2 -2
  321. package/cdn/assets/{CsrTRThObSryov1b.js → CkfqUcoAlpPupbbK.js} +2 -2
  322. package/cdn/assets/CkgK3CrVsGp5FE2i.js +2213 -0
  323. package/{browser/esm/BAH_cWcQEIBKWnl6.mjs → cdn/assets/Cl1bVTUk0rQUQT9p.js} +1 -1
  324. package/cdn/assets/Cl3d4ILjFxp4IdO9.js +3716 -0
  325. package/cdn/assets/ClY9HTqosClkllrU.js +522 -0
  326. package/cdn/assets/Cllqhal9LBm1K8Yq.js +391 -0
  327. package/cdn/assets/CnVY0qezymE7-eML.js +89 -0
  328. package/cdn/assets/{CWJzHmEgahdOfNjH.js → Cnx0vOv2ePi94hMN.js} +1 -1
  329. package/cdn/assets/{C7fu6LrSMBlHqwUy.js → CqmrD2Xs8MKJTO4v.js} +4 -4
  330. package/cdn/assets/Cw6ozEzvtFq_HVef.js +8 -0
  331. package/cdn/assets/{BzbP4jaN13wC9aSi.js → CzG0p4x8L99XEdym.js} +40 -40
  332. package/{browser/esm/CVcCUfSRsiZ1-6hs.mjs → cdn/assets/CzpnOqHBXxESl5Ts.js} +1 -1
  333. package/cdn/assets/D-hAYmuTa0x0_oI-.js +1552 -0
  334. package/{browser/esm/By3a43qwWICwXRmw.mjs → cdn/assets/D2H92O2Ji36qebTp.js} +2667 -2091
  335. package/cdn/assets/{ByUcqyCNfqi5Mm7w.js → D46u8d3O49bDLflJ.js} +1 -1
  336. package/cdn/assets/D51TEwta0ZXmlNrx.js +570 -0
  337. package/cdn/assets/{px-aQ8dMjiWag_pV.js → D5KlrP1rlBZO7HyP.js} +1 -1
  338. package/cdn/assets/{Cfg4Dtndwurxv9LM.js → D7g9SLSLSONiRP8_.js} +8 -8
  339. package/cdn/assets/D8fBDoXy-QzJqIfC.js +132 -0
  340. package/cdn/assets/D97AuczhOIBnqMXI.js +55466 -0
  341. package/cdn/assets/DBnswN0nPHV8TM2q.js +8 -0
  342. package/cdn/assets/DE9bhDAlUdLUngdj.js +1646 -0
  343. package/cdn/assets/{D_pMOq6FdH4RSBLc.js → DG4PyKuuGu6RkAEv.js} +810 -804
  344. package/cdn/assets/DG8R6bLrQPHjouy2.js +86 -0
  345. package/cdn/assets/{VwGokBaawZfZiV2X.js → DJhxuNvyE7FzNXTv.js} +1 -1
  346. package/{browser/esm/H-JnJQMcZQbpvjdb.mjs → cdn/assets/DK3BYp4NTX8n36q5.js} +1 -1
  347. package/cdn/assets/{CZOJogyZqMfUxcXj.js → DKxCeh3yib-owCxs.js} +1 -1
  348. package/cdn/assets/{ycmpAs4kQfeh78Pa.js → DL57MpyMuNosTcrB.js} +1 -1
  349. package/{browser/esm/Dme0qpRinBnhzp53.mjs → cdn/assets/DLEPPn_cPPydMrpU.js} +150 -148
  350. package/cdn/assets/{D-bNmX0QsA8SuT0m.js → DP1jRSok-1NvqrBz.js} +34 -34
  351. package/cdn/assets/{DJqj66SnUcx0QmSN.js → DUZyG-8cyY9A0Zg-.js} +1 -1
  352. package/cdn/assets/{Cv5PLuhEmh5IDHjb.js → DWoFVKQrI917IanL.js} +23 -23
  353. package/cdn/assets/DXhizwpX3GUT2ECx.js +90 -0
  354. package/cdn/assets/DYbOfw0BRA2hWOCP.js +1390 -0
  355. package/cdn/assets/DZo_DGKkHCqIyM5N.js +388 -0
  356. package/{browser/esm/DlOVZD0OiAjouS6-.mjs → cdn/assets/D_d2cK3aSl0eMBpj.js} +1626 -1018
  357. package/{browser/esm/BWo1N4YbK_zGU0nu.mjs → cdn/assets/DagxhIjpKea9MwI8.js} +1 -1
  358. package/cdn/assets/{DjdkGy-EI1kSo226.js → DbewMnLKZoGLGFNh.js} +1 -1
  359. package/{browser/esm/8-jmVNNbOHuXFdVQ.mjs → cdn/assets/DdXikMOzMIALd8bz.js} +120 -118
  360. package/cdn/assets/Dg3UJabBou63ReiH.js +12816 -0
  361. package/cdn/assets/Dg9ALylpMhftKvuI.js +23434 -0
  362. package/cdn/assets/DgQFdPeLRIkg5O3C.js +3093 -0
  363. package/{browser/esm/DWgp4t9N9u0eWthH.mjs → cdn/assets/DhLN5r1sTHL_BWeH.js} +1 -1
  364. package/cdn/assets/{ZxsFYopF0_WWqw4Q.js → DhU_l9pcEddg9s24.js} +1 -1
  365. package/cdn/assets/{CTI-mCJbJzitJZwj.js → DiabpzKzIUUyat-1.js} +1 -1
  366. package/cdn/assets/{DrI_S0A9TQvriTua.js → Dl29uXIaOLiBIDEI.js} +1 -1
  367. package/cdn/assets/{BtGmrIqU9W1L8zfZ.js → Dl40S1lFKvsN0DvK.js} +1 -1
  368. package/{browser/esm/DxcRLd7wmBGDgJsA.mjs → cdn/assets/DlWoVcsWZHiN-EYf.js} +1 -1
  369. package/cdn/assets/{B27vTQlxbHhSQJx8.js → DliTwLXIImeC0eub.js} +7803 -6320
  370. package/cdn/assets/{aHTKr1ijZ6bRi3Zg.js → DsRSG0tf_a2zWfcu.js} +4 -4
  371. package/cdn/assets/{7i4WSxDsu2ApJJ2_.js → DsXc1EO6csuKfV4l.js} +3 -3
  372. package/cdn/assets/DtO07D35O2tAh7f4.js +1241 -0
  373. package/cdn/assets/{C-0viTjg1dT2F-sk.js → Dut7EHGO0G5wuZvA.js} +2 -2
  374. package/cdn/assets/DvBV9E2CaadV0-OK.js +104 -0
  375. package/cdn/assets/{CakrxSS_RXtKmcUX.js → Dw7mCCAZtWzy1kDg.js} +99 -98
  376. package/{browser/esm/DEvZj68igS7Q8SZE.mjs → cdn/assets/DwITQzYKh_c7vCO8.js} +5 -5
  377. package/cdn/assets/{C0CeCYdLWLjySEFe.js → DwTdBuvtngstv-Ee.js} +15 -15
  378. package/cdn/assets/{CMVTwWHsRgyfSEDM.js → Dwb9z-Om5vH_9GFX.js} +67 -65
  379. package/{browser/esm/D-KZpU6HMaP4VUva.mjs → cdn/assets/Dwd9mENEUTKk45OD.js} +56 -56
  380. package/cdn/assets/{BvlfKrfrDhE9Jw4d.js → Dwm4Q509nQKTAHZp.js} +2 -2
  381. package/cdn/assets/{mK8HcIZyXkOTvL6E.js → DxI14nqCsNi-yexx.js} +7 -7
  382. package/cdn/assets/Dy07J9xUgFU8srvP.js +7723 -0
  383. package/{browser/esm/CBdNC7BOfc5TewHU.mjs → cdn/assets/DyeYHUP9q10K48wL.js} +1 -1
  384. package/cdn/assets/{Cy00y9b9j17Txyv1.js → DzF6mYUZfggTAjhM.js} +1 -1
  385. package/cdn/assets/{BpZ7P0CO148rR4zW.js → Dzlfx9-RfNxYludH.js} +20 -20
  386. package/cdn/assets/FjjP2q5AOiFod5IL.js +282 -0
  387. package/cdn/assets/{Dv8aQFTTaQBJKDDk.js → GA5X6vLsOcXufGyF.js} +1 -1
  388. package/cdn/assets/Ga_dmEQPXt-tMjfv.js +7 -0
  389. package/cdn/assets/HMCOTgDNR6bpWL7f.js +163 -0
  390. package/cdn/assets/{UTZcodQydbuMfCOS.js → Jn0_AtebABdIzyQ8.js} +1 -1
  391. package/cdn/assets/{CMxbiQ5J79M3n1tk.js → PD_ckP5IyZurtALu.js} +723 -373
  392. package/{browser/esm/lqknEt3DTma5Juxs.mjs → cdn/assets/PFd1HLX9x3NbZS0Q.js} +1 -1
  393. package/{browser/esm/B3Ii8x6RquHW1jMc.mjs → cdn/assets/PlCjmMBePH7hotkL.js} +12 -11
  394. package/cdn/assets/{Bgbi7BFR3rN5qj51.js → RZYxEHY1tap8fDMU.js} +22 -22
  395. package/cdn/assets/{w5IQWbJETgHhqMsY.js → V3xJfVu5YgTJE15l.js} +33 -33
  396. package/cdn/assets/{dn69mDhY7Xcc91kF.js → VtDou2czLTs_x_lJ.js} +20 -20
  397. package/cdn/assets/Xr_m9JQCcD2iBqdf.js +324 -0
  398. package/cdn/assets/{VCiu_neIjCTg2NUa.js → Y0Uf_lVRToNYi395.js} +634 -634
  399. package/{browser/esm/Dc2ZwgbIEgYWwAsF.mjs → cdn/assets/Z10MZFA0Sc2Zcelz.js} +1 -1
  400. package/cdn/assets/ZHMYKkw9GtA9PmwP.js +61 -0
  401. package/cdn/assets/ZaFy1hzL6cnNlROy.js +1302 -0
  402. package/cdn/assets/__mMW0v3QyR1pQYO.js +294 -0
  403. package/cdn/assets/{DqBj-9o7UdXu4qhb.js → bTZCD31OE4KkUy4u.js} +1 -1
  404. package/{browser/esm/BPrHgyAsm2Htx15h.mjs → cdn/assets/c6MwBF7fqj-4Wqct.js} +1 -1
  405. package/cdn/assets/csh4FIrA7Yz0oQR4.js +9 -0
  406. package/cdn/assets/{CDAYVaQYywqaxg4O.js → eyjrmBPp0a3kmDM1.js} +2 -2
  407. package/{browser/esm/BtdRr6IbtO6Gypsk.mjs → cdn/assets/hlphmhe3M3MZPvOh.js} +6 -5
  408. package/cdn/assets/jJoDPeW_80P8c7ET.js +201 -0
  409. package/cdn/assets/kLmFvtw68s1_Kbq9.js +142 -0
  410. package/cdn/assets/kTq1x8_s5V2PwKeX.js +9715 -0
  411. package/{browser/esm/BhkeuRcx8RlLCQ5E.mjs → cdn/assets/lPeOxAutCOlSB-aC.js} +1 -1
  412. package/cdn/assets/{DeUXRggj8Oz9ru_i.js → oLOwgPmipnKc68nJ.js} +1 -1
  413. package/cdn/assets/{BMlPFJ1glExv-70Z.js → oY2yN-_0_AcCI46E.js} +1 -1
  414. package/cdn/assets/{G5z0uVlyF6CLw_PA.js → pS2054G_Le7EvgyY.js} +2 -2
  415. package/cdn/assets/qwL1y5daLJePT9OL.js +7 -0
  416. package/cdn/assets/rNuTuxLduwMl4Fyb.js +182 -0
  417. package/cdn/assets/sCeaYn7GnW1N9bKn.js +423 -0
  418. package/cdn/assets/{Bsn-tUx172sEG2kR.js → t8Ps76FWzb3VX_wg.js} +20 -20
  419. package/{browser/esm/CTdFZ_I-41Vr6Dy4.mjs → cdn/assets/tQAwA9RKsgzjziNe.js} +1 -1
  420. package/{browser/esm/J9i3r1fU0H10b2hX.mjs → cdn/assets/t_7A_GdY394OUV4v.js} +1 -1
  421. package/{browser/esm/CWoPWWRwMgkGPFFP.mjs → cdn/assets/u8iMUyjw60ayROFo.js} +2538 -1728
  422. package/cdn/assets/ubUqS2NO2sn4DX3v.js +1694 -0
  423. package/cdn/assets/vY2ZLR024kVOwWej.js +36 -0
  424. package/cdn/assets/{DQEjvIGMgEkiaP6J.js → xUNkyQFYnzQAzsVs.js} +1 -1
  425. package/{browser/esm/BwOxnbR61WFJwy0A.mjs → cdn/assets/y-iW7vsJV47pYbw4.js} +1 -1
  426. package/{browser/esm/B0Wjc3lwtjKMwnvn.mjs → cdn/assets/y8mfWM7VlyfJEEwg.js} +1 -1
  427. package/cdn/assets/{BIsbcP5RXRU2XPfx.js → yI2dKrysDG0lqxjX.js} +2 -2
  428. package/cdn/assets/{Ba8taVvLslFcKS72.js → yzl98RXbYvgX5DfY.js} +28 -27
  429. package/cdn/assets/z4XcPMxN5hfqRHIt.js +367 -0
  430. package/cdn/assets/{ZSYS1J3uR7UQuHwZ.js → zm4ZwKXeSetbtx9Z.js} +10 -10
  431. package/cdn/index.js +27 -17
  432. package/package.json +3 -3
  433. package/types/src/sheetxl.d.ts +1 -0
  434. package/browser/esm/BNIInlJQbJjH8B6G.mjs +0 -84250
  435. package/browser/esm/B_HB4y7AA88Z775Z.mjs +0 -91
  436. package/browser/esm/CdeXXPCp5cCYvGyD.mjs +0 -14
  437. package/browser/esm/Chr_TXM-48IsK8Va.mjs +0 -155
  438. package/browser/esm/Clx8vvGDOTWK_M2l.mjs +0 -484
  439. package/browser/esm/Cw-4uoMuq_m7ziA3.mjs +0 -36
  440. package/browser/esm/D-9f1NKcpuYSgond.mjs +0 -412
  441. package/browser/esm/D7CGuQcwpkiuesEI.mjs +0 -229
  442. package/browser/esm/D7kkzIFPqKBK94kO.mjs +0 -17952
  443. package/browser/esm/D8exjrado9TJrBp-.mjs +0 -1946
  444. package/browser/esm/DGCOPbZbEmt0x9z0.mjs +0 -155
  445. package/browser/esm/DZRmBfjn2TgOTu5e.mjs +0 -3604
  446. package/browser/esm/D_7BWdsu8yejhUxy.mjs +0 -2353
  447. package/browser/esm/D_thhK0vSez8Yfle.mjs +0 -798
  448. package/browser/esm/Dv2z0548SZRGTN3l.mjs +0 -149
  449. package/browser/esm/DyeY6XwMQ_XNUHiW.mjs +0 -89
  450. package/browser/esm/RLU85PsAYtKPUf6N.mjs +0 -71
  451. package/browser/esm/WMYR09ZOR8JbZEnx.mjs +0 -4748
  452. package/browser/esm/r2Az2Yc4_qj2-sn0.mjs +0 -398
  453. package/cdn/assets/514mXPTuNvdNgw35.js +0 -412
  454. package/cdn/assets/7Sg0ht_ZCMJkPurt.js +0 -516
  455. package/cdn/assets/B_3Musz0q2MSZ5H-.js +0 -799
  456. package/cdn/assets/BgyY4zVPZSXljoCZ.js +0 -14
  457. package/cdn/assets/BlIZ30huelIxNo6S.js +0 -91
  458. package/cdn/assets/BxqXOiOyI_XiOmvN.js +0 -156
  459. package/cdn/assets/CEYyp6Qrr_IopxpL.js +0 -22597
  460. package/cdn/assets/CL6Tgu_rUO6G-fyq.js +0 -2352
  461. package/cdn/assets/COMOqucXq7X1vi0P.js +0 -230
  462. package/cdn/assets/CRXSrbGNABtzf532.js +0 -399
  463. package/cdn/assets/CTvPIYWTcjwlJeEA.js +0 -237
  464. package/cdn/assets/CU5cKipVT1X8Xz7F.js +0 -156
  465. package/cdn/assets/ChAKLV5zrGAHAof2.js +0 -130
  466. package/cdn/assets/Cw-4uoMuq_m7ziA3.js +0 -36
  467. package/cdn/assets/DCnWyVXikb_8Dat3.js +0 -61
  468. package/cdn/assets/DHugYwX4_ZyqGn-C.js +0 -1947
  469. package/cdn/assets/DOHh3pUXxMM09UY5.js +0 -3604
  470. package/cdn/assets/DlpgIJxNq2V4gdDq.js +0 -74
  471. package/cdn/assets/DuAbY54w5gJpQgss.js +0 -84250
  472. package/cdn/assets/DviEoeWW0EvDg1hr.js +0 -149
  473. package/cdn/assets/PzWqv-oXxEuzKdaT.js +0 -484
  474. package/cdn/assets/QJ4AkDD269D1MzmI.js +0 -89
  475. package/cdn/assets/fm3mUdTDo-STB36M.js +0 -4749
  476. package/cdn/assets/lWY3TbG2NDscy9He.js +0 -72
  477. package/cdn/assets/xlXDq-qoj7eOE6_T.js +0 -5153
@@ -0,0 +1,3716 @@
1
+ /**
2
+ * @license @sheetxl/studio-vanilla - SheetXL Studio - Vanilla entry point for integrating SheetXL UI. - v0.8.0-beta.11
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 { B as e, N as t, W as n, Z as r, a as i, c as a, h as o, j as s, n as c, p as l, u, v as d, w as f, x as p, y as m, z as h } from "./PD_ckP5IyZurtALu.mjs";
8
+ import { c as g, i as _, s as v } from "./CNsG-HP7MrYv4ANy.mjs";
9
+ import { $t as y, Bt as b, K as x, Lt as S, Pt as C, U as w, Ut as T, Vt as ee, at as te, ct as ne, d as E, g as re, nt as ie, o as ae, st as oe, t as se, x as ce, yt as D, zt as le } from "./CVGsocXM6EdK3av8.mjs";
10
+ import { i as O, t as k } from "./Cl1bVTUk0rQUQT9p.mjs";
11
+ import { $ as A, C as j, Ci as ue, Dt as de, Er as fe, Et as pe, Ft as me, Hr as M, I as he, Jr as ge, Jt as _e, K as ve, Kr as ye, Lt as be, M as xe, Mt as Se, Nn as N, O as Ce, Ot as we, Q as P, R as Te, Ti as Ee, V as De, Yr as F, Yt as Oe, Zn as ke, Zr as I, _ as Ae, _t as je, ar as Me, at as Ne, bi as Pe, cn as Fe, ct as Ie, dr as Le, ei as L, et as R, fi as Re, fn as ze, hi as Be, hn as Ve, in as He, kn as Ue, l as z, ln as We, mi as Ge, mn as Ke, n as qe, nr as Je, o as Ye, pi as Xe, pt as Ze, rt as Qe, sn as $e, ti as et, u as tt, vi as nt, vn as rt, wr as it, xi as at, xn as ot, yi as st, yn as ct } from "./BRXV-NrDDC3ZrpMt.mjs";
12
+ var lt, ut, dt = class extends t {
13
+ constructor(e, t = 50) {
14
+ super(t), this._transactions = e, this._floorId = e ? e.getCurrentCommit(!1).getId() : null, this._removeListener = e?.addListener({ onCommitChange: () => this._notifyOnStackChange() });
15
+ }
16
+ _undoCommits(e = this.maxStack) {
17
+ let t = this._transactions;
18
+ if (!t) return [];
19
+ let n = t.getLog(t.getCurrentCommit(!1).getId(), 2 ** 53 - 1), r = [];
20
+ for (let t = 0; t < n.length && r.length < e; t++) {
21
+ let e = n[t];
22
+ if (e.getId() === this._floorId || t === n.length - 1) break;
23
+ e.getDescription() && r.push(e);
24
+ }
25
+ return r;
26
+ }
27
+ _redoCommits(e = this.maxStack) {
28
+ let t = this._transactions;
29
+ if (!t) return [];
30
+ let n = t.getCurrentCommit(!1).getId(), r = t.getTipCommit().getId();
31
+ if (r === n) return [];
32
+ let i = t.getLog(r, 2 ** 53 - 1), a = [], o = !1;
33
+ for (let e of i) {
34
+ if (e.getId() === n) {
35
+ o = !0;
36
+ break;
37
+ }
38
+ a.push(e);
39
+ }
40
+ if (!o) return [];
41
+ a.reverse();
42
+ let s = [];
43
+ for (let t of a) if (t.getDescription() && s.push(t), s.length >= e) break;
44
+ return s;
45
+ }
46
+ undo(e = 1) {
47
+ let t = this._transactions;
48
+ if (!t) return;
49
+ let n = !1;
50
+ try {
51
+ for (let r = 0; r < e; r++) {
52
+ let [e] = this._undoCommits(1);
53
+ if (!e) break;
54
+ t.revert(e.getId()), n = !0;
55
+ }
56
+ } finally {
57
+ n && this._notifyOnStackChange();
58
+ }
59
+ }
60
+ redo(e = 1) {
61
+ let t = this._transactions;
62
+ if (!t) return;
63
+ let n = !1;
64
+ try {
65
+ for (let r = 0; r < e; r++) {
66
+ let [e] = this._redoCommits(1);
67
+ if (!e) {
68
+ r === 0 && this._repeatOperation?.repeat();
69
+ break;
70
+ }
71
+ t.restore(e.getId()), n = !0;
72
+ }
73
+ } finally {
74
+ n && this._notifyOnStackChange();
75
+ }
76
+ }
77
+ hasUndo() {
78
+ return this._undoCommits(1).length > 0;
79
+ }
80
+ hasRedo() {
81
+ return this._redoCommits(1).length > 0 || this._repeatOperation !== null;
82
+ }
83
+ getTopUndoDescription() {
84
+ return this._undoCommits(1)[0]?.getDescription() ?? null;
85
+ }
86
+ getTopRedoDescription() {
87
+ return this._repeatOperation === null ? this._redoCommits(1)[0]?.getDescription() ?? null : this._repeatOperation.description;
88
+ }
89
+ getUndoDescriptions() {
90
+ return this._undoCommits().map((e) => e.getDescription());
91
+ }
92
+ getRedoDescriptions() {
93
+ let e = this._redoCommits().map((e) => e.getDescription());
94
+ return e.length === 0 && this._repeatOperation !== null && e.push(this._repeatOperation.description), Object.freeze(e);
95
+ }
96
+ getUndoEntries() {
97
+ return this._undoCommits().map(pt);
98
+ }
99
+ getRedoEntries() {
100
+ let e = this._redoCommits().map(pt);
101
+ return e.length === 0 && this._repeatOperation !== null && e.push({
102
+ description: this._repeatOperation.description,
103
+ author: null,
104
+ meta: ft
105
+ }), Object.freeze(e);
106
+ }
107
+ addUndoOperation() {
108
+ throw Error("TransactionUndoManager derives its stack from the commit log; commit a described transaction instead.");
109
+ }
110
+ clear(e = !0) {
111
+ this._transactions && (this._floorId = this._transactions.getCurrentCommit(!1).getId()), super.clear(e);
112
+ }
113
+ close() {
114
+ this._removeListener?.();
115
+ }
116
+ }, ft = Object.freeze({}), pt = (e) => ({
117
+ description: e.getDescription(),
118
+ author: e.getAuthor(),
119
+ meta: e.getMeta() ?? ft
120
+ }), mt = class {
121
+ constructor(e, t) {
122
+ this._dirty = !1, this._store = e, this._savedCommitId = e.getCurrentCommit()?.getId() ?? null, this._emitter = new _(this);
123
+ let n = this;
124
+ this._removeStoreListener = e.addListener({
125
+ onCommitEnd() {
126
+ n._recompute();
127
+ },
128
+ onCommitChange() {
129
+ n._recompute();
130
+ }
131
+ }), this._removeCommitListener = t?.addCommitListener({ onCommit(e) {
132
+ e.store === n._store && n.markSaved(e.commitId);
133
+ } });
134
+ }
135
+ getStore() {
136
+ return this._store;
137
+ }
138
+ isDirty() {
139
+ return (this._store.getCurrentCommit()?.getId() ?? null) !== this._savedCommitId;
140
+ }
141
+ getSavedCommitId() {
142
+ return this._savedCommitId;
143
+ }
144
+ markSaved(e = this._store.getCurrentCommit()?.getId() ?? null) {
145
+ e !== this._savedCommitId && (this._savedCommitId = e ?? null, this._recompute());
146
+ }
147
+ addListeners(e, t) {
148
+ return this._emitter.addListeners(e, t);
149
+ }
150
+ _recompute() {
151
+ let e = this.isDirty();
152
+ e !== this._dirty && (this._dirty = e, this._emitter.notify(e ? "onDirty" : "onClean", { transactional: !1 }));
153
+ }
154
+ close() {
155
+ this._removeStoreListener?.(), this._removeCommitListener?.(), this._emitter.close();
156
+ }
157
+ };
158
+ lt ||= {};
159
+ var B = class e {
160
+ constructor(t, n = {}) {
161
+ this._password = null, this._emitter = new _(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;
162
+ }
163
+ static _defaultCanWrite(e) {
164
+ return !!e && !/^(https?:|data:|blob:)/i.test(e);
165
+ }
166
+ _cleanPath() {
167
+ return this._path ? this._path.split(/[?#]/)[0] : null;
168
+ }
169
+ getName() {
170
+ if (this._name !== null && this._name !== void 0) return this._name;
171
+ let e = this._cleanPath();
172
+ return e && M(e) || null;
173
+ }
174
+ getPath() {
175
+ return this._path;
176
+ }
177
+ getFormat() {
178
+ return this._format ? this._format : this.getExtension();
179
+ }
180
+ getExtension() {
181
+ let e = this._cleanPath();
182
+ if (!e) return null;
183
+ let t = A(e);
184
+ return t ? t.toLowerCase() : null;
185
+ }
186
+ getEncryption() {
187
+ return this._encryption;
188
+ }
189
+ isEncrypted() {
190
+ return this._encryption !== null || this._password !== null;
191
+ }
192
+ setPassword(e) {
193
+ this._password !== (e ?? null) && (this._password = e ?? null, this._password === null && (this._encryption = null), this._emitter.notify("onChange"));
194
+ }
195
+ getPassword() {
196
+ return this._password;
197
+ }
198
+ getSize() {
199
+ return this._size;
200
+ }
201
+ getLastModified() {
202
+ return this._lastModified;
203
+ }
204
+ canWrite() {
205
+ return this._canWrite;
206
+ }
207
+ setName(e) {
208
+ this.update({ name: e });
209
+ }
210
+ update(e) {
211
+ let t = !1;
212
+ 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;
213
+ }
214
+ addListeners(e, t) {
215
+ return this._emitter.addListeners(e, t);
216
+ }
217
+ get [Symbol.toStringTag]() {
218
+ return "[Origin]";
219
+ }
220
+ toString() {
221
+ let e = this._cleanPath(), t = e ? e.split(/[/\\]/).pop() || e : this._name ?? "(unbound)", n = this._size;
222
+ if (n == null) return t;
223
+ if (n < 1024) return `${t} ${n}B`;
224
+ let r = Math.floor(Math.log(n) / Math.log(1024)), i = [
225
+ "B",
226
+ "KB",
227
+ "MB",
228
+ "GB",
229
+ "TB"
230
+ ];
231
+ return `${t} ${(n / 1024 ** r).toFixed(2)}${i[Math.min(r, i.length - 1)]}`;
232
+ }
233
+ }, V = /* @__PURE__ */ new WeakMap(), H = /* @__PURE__ */ new Set(), ht = (e) => V.get(e) ?? null, gt = () => Array.from(H, (e) => e.getOrigin()), _t = class e {
234
+ constructor(t) {
235
+ this._released = !1, e._assertFree(t), this._emitter = new _(this), this._origin = t, V.set(t, this), H.add(this);
236
+ }
237
+ getOrigin() {
238
+ return this._origin;
239
+ }
240
+ setOrigin(t) {
241
+ t !== this._origin && (e._assertFree(t), this._released || (V.delete(this._origin), V.set(t, this)), this._origin = t, this._emitter.notify("onOriginChange"));
242
+ }
243
+ release() {
244
+ this._released || (this._released = !0, V.get(this._origin) === this && V.delete(this._origin), H.delete(this));
245
+ }
246
+ addListeners(e, t) {
247
+ return this._emitter.addListeners(e, t);
248
+ }
249
+ static _assertFree(e) {
250
+ if (V.has(e)) throw Error("This origin already backs an open workbook; an origin backs one workbook at a time.");
251
+ }
252
+ }, vt = class {
253
+ constructor() {
254
+ this._defaultStringSourceType = "filepath";
255
+ }
256
+ async read(e) {
257
+ let t = e.options ?? {}, n = e.source;
258
+ 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;
259
+ let i = n, a = await this.fileFromHandle(n);
260
+ a && (n = a);
261
+ let o = t.format, s = this._detectSourceType(n);
262
+ if (!s) throw Error("Unable to detect source type from provided input.");
263
+ let c, l, u = !1;
264
+ if (s === "filepath") {
265
+ let e = typeof n == "string" && n.startsWith("file://") ? n.slice(7) : n;
266
+ n = await this.filePathToFile(e), s = "file", u = !0;
267
+ }
268
+ switch (s) {
269
+ case "file": {
270
+ let e = n, r = e?.name, i = r ? `${M(r)}` : "";
271
+ c = await e.arrayBuffer(), l = {
272
+ format: o,
273
+ ext: A(r),
274
+ name: i,
275
+ absolutePath: r,
276
+ size: e.size,
277
+ lastModified: e.lastModified,
278
+ canWrite: !t.asCopy && (!!a || u && this._canWriteLocalPath())
279
+ };
280
+ break;
281
+ }
282
+ case "blob": {
283
+ let e = n;
284
+ c = await e.arrayBuffer(), l = {
285
+ format: o,
286
+ size: e.size
287
+ };
288
+ break;
289
+ }
290
+ case "base64": {
291
+ let e;
292
+ if (n && typeof n == "object" && "base64" in n) e = n.base64;
293
+ else if (typeof n == "string" && n.startsWith("data:")) {
294
+ let [, t] = n.split(",");
295
+ e = t;
296
+ } else e = n;
297
+ c = r.base64ToArrayBuffer(e), l = {
298
+ format: o,
299
+ size: e.length
300
+ };
301
+ break;
302
+ }
303
+ case "fetch": {
304
+ let e, t, r;
305
+ if (typeof n == "string") e = n;
306
+ else {
307
+ if (!n || typeof n != "object" || !("input" in n)) throw Error("Invalid fetch source provided.");
308
+ {
309
+ let i = n;
310
+ e = i.input, t = i.init, r = i.timeout;
311
+ }
312
+ }
313
+ let i = r || 3e4, a = new AbortController(), s = setTimeout(() => a.abort(), i), u = typeof e == "string" ? e : e.toString(), d = A(u);
314
+ try {
315
+ let n = await fetch(e, {
316
+ ...t,
317
+ signal: a.signal
318
+ });
319
+ if (clearTimeout(s), !n.ok) throw Error(`Failed to fetch: ${n.status} ${n.statusText}`);
320
+ let r = await n.arrayBuffer();
321
+ if (!r) throw Error(`Unable to fetched content: ${u}`);
322
+ c = r, l = {
323
+ format: o,
324
+ ext: d,
325
+ name: M(u, !0),
326
+ absolutePath: u
327
+ };
328
+ } catch (e) {
329
+ throw clearTimeout(s), e.name === "AbortError" ? Error(`Fetch timeout after ${i}ms: ${u}`) : e;
330
+ }
331
+ break;
332
+ }
333
+ case "buffer":
334
+ c = n, l = { format: o };
335
+ break;
336
+ case "stream": {
337
+ let e = n.getReader(), t = [], r = 0;
338
+ try {
339
+ for (;;) {
340
+ let { done: n, value: i } = await e.read();
341
+ if (n) break;
342
+ t.push(i), r += i.length;
343
+ }
344
+ } finally {
345
+ e.releaseLock();
346
+ }
347
+ let i = new ArrayBuffer(r), a = new Uint8Array(i), s = 0;
348
+ for (let e of t) a.set(e, s), s += e.length;
349
+ c = i, l = { format: o };
350
+ break;
351
+ }
352
+ default: throw Error(`Unsupported source type: ${s}`);
353
+ }
354
+ l.canWrite && await this.findOpenOrigin(i, l) && (l.canWrite = !1);
355
+ let d = await e.decode(c, {
356
+ sourceType: s,
357
+ ...l
358
+ });
359
+ return d ? (await this.onWorkbookRead(d, i), d) : null;
360
+ }
361
+ async findOpenOrigin(e, t) {
362
+ return t.absolutePath ? this.findOpenPath(t.absolutePath) : null;
363
+ }
364
+ findOpenPath(e, t) {
365
+ return gt().find((n) => {
366
+ if (n === t || !n.canWrite()) return !1;
367
+ let r = n.getPath();
368
+ return !!r && this.isSamePath(r, e);
369
+ }) ?? null;
370
+ }
371
+ isSamePath(e, t) {
372
+ return e === t;
373
+ }
374
+ async fileFromHandle(e) {
375
+ return null;
376
+ }
377
+ async resolveSource(e) {
378
+ return null;
379
+ }
380
+ async onWorkbookRead(e, t) {}
381
+ _canWriteLocalPath() {
382
+ return !1;
383
+ }
384
+ _detectSourceType(e) {
385
+ if (e && typeof e == "object" && "base64" in e) return "base64";
386
+ if (e && typeof e == "object" && "input" in e) return "fetch";
387
+ if (typeof e == "string") {
388
+ if (e.startsWith("data:")) return "base64";
389
+ if (e.startsWith("http://") || e.startsWith("https://")) return "fetch";
390
+ if (e.startsWith("file://")) return "filepath";
391
+ let t = this._defaultStringSourceType;
392
+ return e.startsWith("./") || e.startsWith("../") || e.startsWith("/") || /^[a-zA-Z]:[/\\]/.test(e), t;
393
+ }
394
+ if (typeof File < "u" && e instanceof File) return "file";
395
+ if (typeof Blob < "u" && e instanceof Blob) return "blob";
396
+ let t = e instanceof ArrayBuffer || Object.prototype.toString.call(e) === "[object ArrayBuffer]", n = ArrayBuffer.isView(e), i = r.isNodeBuffer(e);
397
+ return t || n || i ? "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;
398
+ }
399
+ }, yt = class extends vt {
400
+ constructor(e, t) {
401
+ super(), this._getWriteFormats = e, this._getReadFormats = t, this._defaultStringSourceType = "fetch", this._handleCache = /* @__PURE__ */ new WeakMap();
402
+ }
403
+ async fileFromHandle(e) {
404
+ return U(e) ? e.getFile() : null;
405
+ }
406
+ async resolveSource() {
407
+ let e = await this._getReadFormats?.() ?? [];
408
+ if (typeof globalThis.showOpenFilePicker == "function") try {
409
+ let t = function(e) {
410
+ let t = bt(e);
411
+ if (t.length <= 1) return t;
412
+ let n = /* @__PURE__ */ new Set(), r = {};
413
+ 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));
414
+ return [{
415
+ description: "All Supported",
416
+ accept: r
417
+ }, ...t];
418
+ }(e), [n] = await globalThis.showOpenFilePicker(t.length ? { types: t } : void 0);
419
+ return n;
420
+ } catch (e) {
421
+ if (e?.name === "AbortError") return null;
422
+ throw e;
423
+ }
424
+ let t = e.flatMap((e) => e.exts.map((e) => "." + e)).join(", ");
425
+ return u.openFileDialog(t);
426
+ }
427
+ async findOpenOrigin(e) {
428
+ return U(e) ? this._findOpenHandle(e) : null;
429
+ }
430
+ async _findOpenHandle(e, t) {
431
+ for (let n of gt()) {
432
+ if (n === t || !n.canWrite()) continue;
433
+ let r = this._handleCache.get(n);
434
+ if (r && typeof r.isSameEntry == "function" && await r.isSameEntry(e)) return n;
435
+ }
436
+ return null;
437
+ }
438
+ async onWorkbookRead(e, t) {
439
+ if (!U(t)) return;
440
+ let n = e.getOrigin?.();
441
+ n?.canWrite() && this._handleCache.set(n, t);
442
+ }
443
+ async filePathToFile(e) {
444
+ throw Error(`Cannot read local file path '${e}' in browser environment. Use a file input element or fetch for remote URLs.`);
445
+ }
446
+ async write(e) {
447
+ let { origin: t, suggestedName: n, format: r, encode: i, prompt: s } = e, c = [r, ...(await this._getWriteFormats()).filter((e) => e.key !== r.key)], l = typeof globalThis.showSaveFilePicker == "function", u = !s && t.canWrite() ? this._handleCache.get(t) : void 0;
448
+ if (l) try {
449
+ if (u) {
450
+ let e = await async function(e) {
451
+ try {
452
+ if (typeof e.queryPermission != "function") return "granted";
453
+ let t = { mode: "readwrite" };
454
+ return await e.queryPermission(t) === "granted" || await e.requestPermission(t) === "granted" ? "granted" : "denied";
455
+ } catch {
456
+ return "unavailable";
457
+ }
458
+ }(u);
459
+ if (e === "denied") return null;
460
+ e !== "granted" && (u = void 0);
461
+ }
462
+ let s = !!u;
463
+ if (!s) {
464
+ u = await globalThis.showSaveFilePicker({
465
+ suggestedName: n,
466
+ types: bt(c)
467
+ });
468
+ let t = await this._findOpenHandle(u, e.workbook?.getOrigin?.());
469
+ if (t) throw new o(a("error.io.openElsewhere", { name: t.getName() ?? u.name ?? "" }));
470
+ }
471
+ let l = St(u.name ?? n), d = c.find((e) => e.exts.some((e) => e.toLowerCase() === l)) ?? r, f = s ? t : new B(u.name ?? n, {
472
+ format: d.key,
473
+ canWrite: !0
474
+ }), p = await i(d.key, f);
475
+ if (!p) return null;
476
+ let m = new Blob([xt(p)], { type: d.mimeType || "application/octet-stream" }), h = await u.createWritable();
477
+ if (await h.write(m), await h.close(), this._handleCache.set(f, u), f instanceof B) {
478
+ let e = await Promise.resolve(u.getFile?.()).then((e) => e?.lastModified ?? null, () => null);
479
+ f.update({
480
+ size: m.size,
481
+ lastModified: e
482
+ });
483
+ }
484
+ return f;
485
+ } catch (e) {
486
+ if (e?.name === "AbortError") return null;
487
+ if (e instanceof o) throw e;
488
+ }
489
+ let d = t.getPath(), f = d ? d.split(/[/\\]/).pop() : null, p = f && r.exts.some((e) => e.toLowerCase() === St(f)) ? f : n, m = d !== p || t.canWrite() ? new B(p, {
490
+ format: r.key,
491
+ canWrite: !1
492
+ }) : t, h = await i(r.key, m);
493
+ if (!h) return null;
494
+ let g = new Blob([xt(h)], { type: r.mimeType || "application/octet-stream" });
495
+ return function(e, t) {
496
+ let n = URL.createObjectURL(e), r = document.createElement("a");
497
+ r.style.display = "none", r.href = n, r.download = t, document.body.appendChild(r), r.click(), document.body.removeChild(r), URL.revokeObjectURL(n);
498
+ }(g, p), m instanceof B && m.update({ size: g.size }), m;
499
+ }
500
+ };
501
+ function bt(e) {
502
+ return e.map((e) => {
503
+ let t = e.mimeType && e.mimeType.includes("/") ? e.mimeType : "application/octet-stream";
504
+ return {
505
+ description: e.description ?? e.key,
506
+ accept: { [t]: e.exts.map((e) => "." + e) }
507
+ };
508
+ });
509
+ }
510
+ function U(e) {
511
+ return !!e && e.kind === "file" && typeof e.getFile == "function";
512
+ }
513
+ function xt(e) {
514
+ if (typeof SharedArrayBuffer < "u" && e instanceof SharedArrayBuffer) {
515
+ let t = new ArrayBuffer(e.byteLength);
516
+ return new Uint8Array(t).set(new Uint8Array(e)), t;
517
+ }
518
+ return e;
519
+ }
520
+ function St(e) {
521
+ let t = e.lastIndexOf(".");
522
+ return t >= 0 ? e.slice(t + 1).toLowerCase() : "";
523
+ }
524
+ (ut ||= {}).SortOn = {
525
+ Value: "value",
526
+ FillColor: "fillColor",
527
+ FontColor: "fontColor",
528
+ Icon: "icon"
529
+ };
530
+ var Ct, wt, Tt, Et, Dt = {
531
+ TopLeft: "tl",
532
+ Top: "t",
533
+ TopRight: "tr",
534
+ Left: "l",
535
+ Center: "ctr",
536
+ Right: "r",
537
+ BottomLeft: "bl",
538
+ Bottom: "b",
539
+ BottomRight: "br"
540
+ }, W = re.BuiltInName, Ot = {
541
+ [W.Normal]: l("style.builtin.normal"),
542
+ [W.Comma]: l("style.builtin.comma"),
543
+ [W.Currency]: l("style.builtin.currency"),
544
+ [W.Percent]: l("style.builtin.percent"),
545
+ [W.Comma0]: l("style.builtin.comma0"),
546
+ [W.Currency0]: l("style.builtin.currency0"),
547
+ [W.Hyperlink]: l("style.builtin.hyperlink"),
548
+ [W.FollowedHyperlink]: l("style.builtin.followedHyperlink"),
549
+ [W.Note]: l("style.builtin.note"),
550
+ [W.WarningText]: l("style.builtin.warningText"),
551
+ [W.Title]: l("style.builtin.title"),
552
+ [W.Input]: l("style.builtin.input"),
553
+ [W.Output]: l("style.builtin.output"),
554
+ [W.Calculation]: l("style.builtin.calculation"),
555
+ [W.CheckCell]: l("style.builtin.checkCell"),
556
+ [W.LinkedCell]: l("style.builtin.linkedCell"),
557
+ [W.Total]: l("style.builtin.total"),
558
+ [W.Good]: l("style.builtin.good"),
559
+ [W.Bad]: l("style.builtin.bad"),
560
+ [W.Neutral]: l("style.builtin.neutral"),
561
+ [W.ExplanatoryText]: l("style.builtin.explanatoryText")
562
+ }, kt = l("style.builtin.heading"), At = l("style.builtin.accent"), jt = l("style.builtin.accentTint"), Mt = /^Heading ([1-4])$/, Nt = /^Accent([1-6])$/, Pt = /^(20|40|60)% - Accent([1-6])$/;
563
+ function Ft(e) {
564
+ let t = Ot[e];
565
+ if (t) return { key: t };
566
+ let n = Mt.exec(e);
567
+ return n ? {
568
+ key: kt,
569
+ params: { n: +n[1] }
570
+ } : (n = Nt.exec(e), n ? {
571
+ key: At,
572
+ params: { n: +n[1] }
573
+ } : (n = Pt.exec(e), n ? {
574
+ key: jt,
575
+ params: {
576
+ pct: +n[1],
577
+ n: +n[2]
578
+ }
579
+ } : null));
580
+ }
581
+ var It, Lt = (e, t, n, r, i) => {
582
+ let o = JSON.parse(JSON.stringify(e.definition));
583
+ o.adjs ||= [];
584
+ let s = "", c = 0, l = 0;
585
+ t > 0 ? (l = t, c = 100 - t, s = a("op.lighterPercent", { percent: t })) : t < 0 && (c = 100 + t, s = a("op.darkerPercent", { percent: -t })), c && o.adjs.push({ [ce.AdjustmentType.LumMod]: c }), l && o.adjs.push({ [ce.AdjustmentType.LumOff]: l });
586
+ let u = new se({
587
+ val: o.val,
588
+ adjs: o.adjs
589
+ }, n), d = u.toString();
590
+ r?.set(d, u);
591
+ let f = u.toRGBA().toString();
592
+ return i?.set(f, u), {
593
+ description: e.description + ", " + s,
594
+ definition: o
595
+ };
596
+ };
597
+ function Rt(e) {
598
+ return Xe.peek()?.readFormulaLiteral(e);
599
+ }
600
+ function zt(e, t) {
601
+ let n = Bt(e), r = Bt(t);
602
+ 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 : O.isError(e) && O.isError(t) ? e.getCode() - t.getCode() : 0 : n - r;
603
+ }
604
+ function Bt(e) {
605
+ if (e === null) return 0;
606
+ switch (typeof e) {
607
+ case "number": return 1;
608
+ case "string": return 2;
609
+ case "boolean": return 3;
610
+ default: return O.isError(e) ? 4 : 5;
611
+ }
612
+ }
613
+ (Ct ||= {}).buildPalette = function(e, t, n, r) {
614
+ let i = [];
615
+ for (let a = 0; a < e.length; a++) {
616
+ let o = [];
617
+ i.push(o);
618
+ let s = (i) => {
619
+ for (let s = 0; s < i.length; s++) o.push(Lt(e[a], i[s], t, n, r));
620
+ }, c = new se({
621
+ val: e[a].definition.val,
622
+ adjs: e[a].definition.adjs
623
+ }, t).toHSLA().lum;
624
+ s(c === 0 ? [
625
+ 50,
626
+ 35,
627
+ 25,
628
+ 15,
629
+ 5
630
+ ] : c === 100 ? [
631
+ -5,
632
+ -15,
633
+ -25,
634
+ -35,
635
+ -50
636
+ ] : c <= 20 ? [
637
+ 90,
638
+ 75,
639
+ 50,
640
+ 25,
641
+ 10
642
+ ] : c >= 80 ? [
643
+ -10,
644
+ -25,
645
+ -50,
646
+ -75,
647
+ -90
648
+ ] : [
649
+ 80,
650
+ 60,
651
+ 40,
652
+ -25,
653
+ -50
654
+ ]);
655
+ }
656
+ return i;
657
+ }, wt ||= {}, Tt ||= {}, Et ||= {}, function(e) {
658
+ function t(e) {
659
+ return Xe.peek()?.getFunctionDeclaration(e) ?? null;
660
+ }
661
+ e.get = t, e.has = function(e) {
662
+ return t(e) !== null;
663
+ };
664
+ }(It ||= {});
665
+ var G, Vt = class {
666
+ constructor(e) {
667
+ this._children = e;
668
+ }
669
+ getCoords() {
670
+ let e = this._children, t = null;
671
+ for (let n = 0; n < e.length; n++) {
672
+ let r = e[n].getCoords();
673
+ r && (t = t ? {
674
+ rowStart: Math.min(t.rowStart, r.rowStart),
675
+ colStart: Math.min(t.colStart, r.colStart),
676
+ rowEnd: Math.max(t.rowEnd, r.rowEnd),
677
+ colEnd: Math.max(t.colEnd, r.colEnd)
678
+ } : r);
679
+ }
680
+ return t;
681
+ }
682
+ getSize() {
683
+ let e = this._children, t = e.length, n = 0;
684
+ for (let r = 0; r < t; r++) n += e[r].getSize();
685
+ return n;
686
+ }
687
+ getCount() {
688
+ let e = this._children, t = e.length, n = 0;
689
+ for (let r = 0; r < t; r++) n += e[r].getCount();
690
+ return n;
691
+ }
692
+ getAggregates(e) {
693
+ if (e) return this._mergeAggregates(e);
694
+ let t = this._aggregates;
695
+ return t || (t = this._mergeAggregates(), this._aggregates = t), t;
696
+ }
697
+ getSnappedSum(e) {
698
+ let t = e ?? this.getAggregates().sum ?? 0, n = this._children;
699
+ for (let e = n.length - 1; e >= 0; e--) if (n[e].getAggregates().numericalCount > 0) return n[e].getSnappedSum(t);
700
+ return t;
701
+ }
702
+ getSortedNumbers() {
703
+ let e = this._sortedNumbers;
704
+ if (!e) {
705
+ let t = this._children, n = t.length, r = [];
706
+ for (let e = 0; e < n; e++) {
707
+ let n = t[e].getSortedNumbers().getValues();
708
+ n.length > 0 && r.push(n);
709
+ }
710
+ e = new et(function(e) {
711
+ let t = e.length;
712
+ if (t === 0) return Ht;
713
+ if (t === 1) return e[0];
714
+ let n = e[0];
715
+ for (let r = 1; r < t; r++) n = Ut(n, e[r]);
716
+ return Object.freeze(n);
717
+ }(r)), this._sortedNumbers = e;
718
+ }
719
+ return e;
720
+ }
721
+ getRanked(e) {
722
+ return pe(this._children, e, zt)[Symbol.iterator]();
723
+ }
724
+ getFrequencies(e) {
725
+ if (e) return this._mergeFrequencies(e);
726
+ let t = this._frequencies;
727
+ return t || (t = this._mergeFrequencies(), this._frequencies = t), t;
728
+ }
729
+ _mergeFrequencies(e) {
730
+ let t = e?.keyFn ?? Ue, n = e?.limit, r = /* @__PURE__ */ new Map(), i = this._children, a = i.length, o = 0, s = 0, c = !1;
731
+ for (let l = 0; l < a; l++) {
732
+ let a = i[l].getFrequencies(e);
733
+ o += a.getVisitedCount(), s += a.getTotalCount(), c ||= a.isTruncated();
734
+ let u = a.getValueCounts(), d = u.next();
735
+ for (; !d.done;) {
736
+ let [e, i] = d.value, a = t(e), o = r.get(a);
737
+ o ? o.count += i : n === void 0 || r.size < n ? r.set(a, {
738
+ value: e,
739
+ count: i
740
+ }) : c = !0, d = u.next();
741
+ }
742
+ }
743
+ return st.fromGroups(r, t, e, zt, o, s, c);
744
+ }
745
+ getTypedCounts(e) {
746
+ let t = this._typedCounts;
747
+ if (!t) {
748
+ let e = {
749
+ [k.Number]: 0,
750
+ [k.String]: 0,
751
+ [k.Boolean]: 0,
752
+ [k.Error]: 0,
753
+ [k.RichData]: 0,
754
+ [k.Null]: 0
755
+ }, n = this._children, r = n.length;
756
+ for (let t = 0; t < r; t++) {
757
+ let r = n[t].getTypedCounts();
758
+ e[k.Number] += r[k.Number] ?? 0, e[k.String] += r[k.String] ?? 0, e[k.Boolean] += r[k.Boolean] ?? 0, e[k.Error] += r[k.Error] ?? 0, e[k.RichData] += r[k.RichData] ?? 0, e[k.Null] += r[k.Null] ?? 0;
759
+ }
760
+ t = Object.freeze(e), this._typedCounts = t;
761
+ }
762
+ if (e === void 0) return t;
763
+ let n = {}, r = e.length;
764
+ for (let i = 0; i < r; i++) n[e[i]] = t[e[i]] ?? 0;
765
+ return n;
766
+ }
767
+ get isIRangeStats() {
768
+ return !0;
769
+ }
770
+ _mergeAggregates(e) {
771
+ let t = this._children, n = t.length, r = {
772
+ count: 0,
773
+ min: void 0,
774
+ max: void 0,
775
+ numericalCount: 0,
776
+ sum: 0,
777
+ sumSq: 0,
778
+ typed: {
779
+ [k.Number]: 0,
780
+ [k.String]: 0,
781
+ [k.Boolean]: 0,
782
+ [k.Error]: 0,
783
+ [k.RichData]: 0,
784
+ [k.Null]: 0
785
+ }
786
+ };
787
+ for (let i = 0; i < n; i++) {
788
+ let n = t[i].getAggregates(e);
789
+ r.count += n.count;
790
+ let a = n.numericalCount;
791
+ 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));
792
+ }
793
+ return Ze(r);
794
+ }
795
+ }, Ht = Object.freeze([]);
796
+ function Ut(e, t) {
797
+ let n = e.length, r = t.length, i = Array(n + r), a = 0, o = 0, s = 0;
798
+ for (; a < n && o < r;) i[s++] = e[a] <= t[o] ? e[a++] : t[o++];
799
+ for (; a < n;) i[s++] = e[a++];
800
+ for (; o < r;) i[s++] = t[o++];
801
+ return i;
802
+ }
803
+ var K, Wt = class {
804
+ constructor(e, t) {
805
+ this._source = null, this.cacheId = e, this.part = t;
806
+ }
807
+ _hold(e) {
808
+ let t = this.part?.xml;
809
+ if (!t || this._source) return;
810
+ let n = Te(t, "worksheetSource", "ref"), r = Te(t, "worksheetSource", "sheet");
811
+ if (!n || !r || n.includes("#REF!")) return;
812
+ let i = e(r);
813
+ if (!i) return;
814
+ let a = {
815
+ formula: null,
816
+ wired: null,
817
+ last: null
818
+ };
819
+ this._source = a, i(`${be(r)}!${Oe(n)}`, (e) => {
820
+ a.formula = e.formula;
821
+ let t = e.formula.getExpression();
822
+ a.wired ??= t, e.formula.hasRefError() || (a.last = t);
823
+ });
824
+ }
825
+ getXML() {
826
+ let e = this.part?.xml ?? null, t = this._source;
827
+ if (!e || !t?.formula) return e;
828
+ let n = t.formula.hasRefError() ? t.last : t.formula.getExpression();
829
+ if (n === null || n === t.wired) return e;
830
+ let r = Se(n);
831
+ return r ? R(R(e, "worksheetSource", "ref", De(r.reference)), "worksheetSource", "sheet", r.sheet) : R(e, "worksheetSource", "ref", De(n));
832
+ }
833
+ toJSON(e) {
834
+ let t = { cacheId: this.cacheId }, n = j.toJSON(this.part, e);
835
+ if (n) {
836
+ let e = this.getXML();
837
+ e !== null && (n.xml = e), t.part = n;
838
+ }
839
+ return t;
840
+ }
841
+ }, Gt = class {
842
+ constructor(e, t) {
843
+ this._deleted = !1, this._json = { ...e }, this._deleteFromCollection = t ?? null;
844
+ }
845
+ getId() {
846
+ return this._json.id;
847
+ }
848
+ getDisplayName() {
849
+ return this._json.displayName;
850
+ }
851
+ getUserId() {
852
+ return this._json.userId ?? null;
853
+ }
854
+ getProviderId() {
855
+ return this._json.providerId ?? null;
856
+ }
857
+ delete() {
858
+ this._deleted || (this._deleted = !0, this._deleteFromCollection?.(this));
859
+ }
860
+ isDeleted() {
861
+ return this._deleted;
862
+ }
863
+ toJSON() {
864
+ return { ...this._json };
865
+ }
866
+ get [Symbol.toStringTag]() {
867
+ return "[Person]";
868
+ }
869
+ toString() {
870
+ return `Person:${this.getDisplayName()}`;
871
+ }
872
+ get isIPerson() {
873
+ return !0;
874
+ }
875
+ }, Kt = class extends _e {
876
+ constructor(e) {
877
+ super(), this._byId = /* @__PURE__ */ new Map(), this._byDisplayName = /* @__PURE__ */ new Map(), this._items = null, this._current = null, e && this.fromJSON(e);
878
+ }
879
+ _getItems() {
880
+ return this._items ??= Array.from(this._byId.values());
881
+ }
882
+ getCount() {
883
+ return this._byId.size;
884
+ }
885
+ add(e) {
886
+ let t = typeof e == "string" ? { displayName: e } : e, r = t.id;
887
+ if (r) {
888
+ let e = this._byId.get(r);
889
+ if (e) return e;
890
+ }
891
+ let i = t.displayName ?? "";
892
+ if (!r) {
893
+ let e = this._byDisplayName.get(i);
894
+ if (e) return e;
895
+ }
896
+ let a = new Gt({
897
+ ...t,
898
+ displayName: i,
899
+ id: r ?? n.uuidV4().toUpperCase()
900
+ }, (e) => this._remove(e));
901
+ return this._byId.set(a.getId(), a), i && !this._byDisplayName.has(i) && this._byDisplayName.set(i, a), this._items = null, this._notifyCollectionChange(), a;
902
+ }
903
+ getById(e) {
904
+ return typeof e == "string" ? this._byId.get(e) ?? null : null;
905
+ }
906
+ getByDisplayName(e) {
907
+ return typeof e == "string" ? this._byDisplayName.get(e) ?? null : null;
908
+ }
909
+ getCurrent() {
910
+ return this._current ??= this.add("Author");
911
+ }
912
+ setCurrent(e) {
913
+ if (e !== null) {
914
+ if (typeof e == "object" && e.isIPerson) {
915
+ let t = e;
916
+ this._current = this.getById(t.getId()) ?? this.add(t.toJSON());
917
+ return;
918
+ }
919
+ this._current = this.add(e);
920
+ } else this._current = null;
921
+ }
922
+ _remove(e) {
923
+ 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());
924
+ }
925
+ toJSON() {
926
+ return this._byId.size === 0 ? null : this._getItems().map((e) => e.toJSON());
927
+ }
928
+ fromJSON(e) {
929
+ if (!e) return;
930
+ let t = e.length;
931
+ for (let n = 0; n < t; n++) {
932
+ let t = e[n];
933
+ t && typeof t.id == "string" && this.add(t);
934
+ }
935
+ }
936
+ get isIPersonCollection() {
937
+ return !0;
938
+ }
939
+ }, qt = class {
940
+ constructor(e) {
941
+ this._options = e, this._emitter = new _(this), this._initState();
942
+ }
943
+ _initState() {}
944
+ getModules() {
945
+ return this._modules;
946
+ }
947
+ _builtInNames() {
948
+ try {
949
+ let e = this._options.getBuiltInFunctions?.();
950
+ if (!e) return n.EmptyArray;
951
+ let t = [];
952
+ for (let n of e.getItems({ includeHidden: !0 })) n.isBuiltIn() && t.push(n.getName());
953
+ return t;
954
+ } catch {
955
+ return n.EmptyArray;
956
+ }
957
+ }
958
+ async createModule(e) {
959
+ let t = await (await import("./DKXz55ACPsNADpJo.mjs")).ScriptCompiler.compile({
960
+ builtInNames: this._builtInNames(),
961
+ minify: !0,
962
+ ...e
963
+ });
964
+ return t.module ? await N(he.DEFAULT_MODULE, t.module, e?.declarationsOnly ?? !1, t.diagnostics) : null;
965
+ }
966
+ addModule(e, t, n) {
967
+ this._modules.add(e, t, n);
968
+ }
969
+ async addModuleFromJSON(e, t, n) {
970
+ let r = await N(e, t);
971
+ return this.addModule(e, r, n), r;
972
+ }
973
+ executeMacro(e, t, n) {
974
+ let r = this._modules.getItems({ name: t }), i = r.length;
975
+ for (let t = 0; t < i; t++) {
976
+ let i = r[t].getFunctions().getByName(e);
977
+ if (i) return i.execute(this._options.workbook, {
978
+ applyResult: !0,
979
+ ...n
980
+ });
981
+ }
982
+ throw Error(`No macro ${e} found.`);
983
+ }
984
+ async run(e, t) {
985
+ try {
986
+ let n = typeof e == "string" ? await this.createModule({ source: e }) : await N(he.DEFAULT_MODULE, e), r = typeof e == "string" ? e : e?.source ?? "";
987
+ return await this._runModule(n, r, t);
988
+ } catch (e) {
989
+ return {
990
+ ok: !1,
991
+ error: e
992
+ };
993
+ }
994
+ }
995
+ async _runModule(e, t, n) {
996
+ let r = this._options?.workbook;
997
+ if (!e) return {
998
+ ok: !1,
999
+ error: Error("The script did not compile to a module.")
1000
+ };
1001
+ let i = e.getDiagnostics(), a = i.filter((e) => e.severity === "error");
1002
+ if (a.length > 0) {
1003
+ let e = Error(((e, t) => {
1004
+ let n = [0];
1005
+ for (let t = 0; t < e.length; t++) e[t] === "\n" && n.push(t + 1);
1006
+ let r = t.map((e) => ` ${((e) => {
1007
+ let t = 0, r = n.length - 1;
1008
+ for (; t < r;) {
1009
+ let i = t + r + 1 >> 1;
1010
+ n[i] <= e ? t = i : r = i - 1;
1011
+ }
1012
+ return `${t + 1}:${e - n[t] + 1}`;
1013
+ })(e.start)} ${e.code}: ${e.message}`), i = t.length;
1014
+ return `Script has ${i} compile error${i === 1 ? "" : "s"}:\n${r.join("\n")}`;
1015
+ })(t, a));
1016
+ return e.diagnostics = a, {
1017
+ ok: !1,
1018
+ error: e,
1019
+ diagnostics: i
1020
+ };
1021
+ }
1022
+ let o = e.getFunctions(), s = o.getItems({
1023
+ type: "autoRun",
1024
+ includeHidden: !0
1025
+ })[0] ?? o.getItems({
1026
+ type: "macro",
1027
+ includeHidden: !0
1028
+ })[0] ?? null;
1029
+ if (!s) return {
1030
+ ok: !1,
1031
+ 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: IWorksheet, ctx)`).")
1032
+ };
1033
+ let c = await s.execute(r, n);
1034
+ return {
1035
+ ok: !0,
1036
+ result: c?.results,
1037
+ commitId: c?.commitId,
1038
+ diagnostics: i
1039
+ };
1040
+ }
1041
+ _searchable(e) {
1042
+ let t = this._modules;
1043
+ return t && t.getCount() !== 0 ? (e ? t.getItems({ name: e }) : t.getItems()).map((e) => e.getFunctions()) : n.EmptyArray;
1044
+ }
1045
+ async searchFunctions(e) {
1046
+ await this._emitter.notify("onBeforeSearch", { async: !0 });
1047
+ let t = this._searchable(e?.moduleName);
1048
+ if (t.length === 0) return n.EmptyArray;
1049
+ if (t.length === 1) return t[0].search(e);
1050
+ let r, i = e?.limit, a = i === void 0 ? e : {
1051
+ ...e,
1052
+ limit: void 0
1053
+ }, o = /* @__PURE__ */ new Set();
1054
+ for (let e = 0; e < t.length; e++) {
1055
+ let n = await t[e].search(a);
1056
+ if (n.length !== 0) {
1057
+ r ||= [];
1058
+ for (let e = 0; e < n.length; e++) {
1059
+ let t = n[e], i = t.getName().toUpperCase();
1060
+ o.has(i) || (o.add(i), r.push(t));
1061
+ }
1062
+ }
1063
+ }
1064
+ if (!r || r.length === 0) return n.EmptyArray;
1065
+ let s = e?.text ? e.text.trim().toUpperCase() : null;
1066
+ return s ? de(r, s) : r.sort((e, t) => {
1067
+ let n = e.getName().toUpperCase(), r = t.getName().toUpperCase();
1068
+ return n < r ? -1 : +(n > r);
1069
+ }), i !== void 0 && r.length > i ? r.slice(0, i) : r;
1070
+ }
1071
+ async start() {
1072
+ if (!this._modules) return this._startPromise || (this._startPromise = this._doStart(), this._startPromise.catch(() => {
1073
+ this._startPromise = void 0;
1074
+ })), this._startPromise;
1075
+ }
1076
+ async _doStart() {
1077
+ let e = this._options?.workbook, t = this._options?.json, r = {};
1078
+ if (t) {
1079
+ let n = Object.keys(t);
1080
+ for (let i = 0; i < n.length; i++) {
1081
+ let a = n[i], o = t[a];
1082
+ try {
1083
+ r[a] = await N(a, o, !1, [], o?.scope === "workbook" ? e : null);
1084
+ } catch (e) {
1085
+ m.error(`Could not load script '${a}'; it will be unavailable.`, e);
1086
+ }
1087
+ }
1088
+ }
1089
+ let i = this, a = new ue({
1090
+ transactions: this._options?.transactions,
1091
+ initial: r,
1092
+ isReadOnly: () => i.isReadOnly(),
1093
+ onRemove: (e, t) => {
1094
+ i._options?.onRemove?.(e, t);
1095
+ },
1096
+ onAdd: (e, t) => {
1097
+ i._emitter.notify("onChange"), i._options?.onAdd?.(e, t);
1098
+ }
1099
+ });
1100
+ this._modules = a;
1101
+ let o = a.getItems();
1102
+ if (o.length === 0) return Promise.resolve(n.EmptyArray);
1103
+ let s = o.length;
1104
+ for (let t = 0; t < s; t++) {
1105
+ let n = o[t];
1106
+ try {
1107
+ let t = n.getFunctions().getItems({
1108
+ type: "autoRun",
1109
+ includeHidden: !0
1110
+ }), r = t.length;
1111
+ for (let n = 0; n < r; n++) await t[n].execute(e);
1112
+ } catch (e) {
1113
+ m.error("Error executing autoRun script:", e);
1114
+ }
1115
+ }
1116
+ }
1117
+ addListeners(e, t) {
1118
+ return this._emitter.addListeners(e, t);
1119
+ }
1120
+ isReadOnly() {
1121
+ return this._options.workbook?._isStructureProtected?.() ?? !1;
1122
+ }
1123
+ toJSON() {
1124
+ this._emitter.notify("onBeforeSave");
1125
+ let e = this._modules;
1126
+ if (!e) throw Error("Scripts is initializing.");
1127
+ return e.toJSON();
1128
+ }
1129
+ get isIScript() {
1130
+ return !0;
1131
+ }
1132
+ }, Jt = class {
1133
+ constructor(e, t, n, r) {
1134
+ this._mergedReading = [], this._colsReading = [], this._rowsReading = [], this._styles = n, this._topLeft = t ?? f.EmptyCell, this._sheet = new F({
1135
+ runtime: e,
1136
+ styles: this._styles,
1137
+ calcOnLoad: "none",
1138
+ container: {
1139
+ getName: () => r,
1140
+ getIndex: () => 1
1141
+ }
1142
+ }), this._builder = this._sheet.getEntireRange().createSparseBuilder();
1143
+ }
1144
+ applyCSSStyle(e, t) {
1145
+ let n = !1;
1146
+ e.style || (e.style = {}, n = !0);
1147
+ let r = e.style, i = { ...t };
1148
+ if (t.msoIgnore) {
1149
+ let e = t.msoIgnore.split(","), n = Object.keys(i);
1150
+ for (let t = 0; t < n.length; t++) {
1151
+ let r = n[t];
1152
+ e.includes(r) && delete i[r];
1153
+ }
1154
+ }
1155
+ let a = le(i.fontFamily);
1156
+ 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;
1157
+ let o = ie(i.textDecoration);
1158
+ r.font.underline = o.underline, r.font.strike = o.strike ? E.StrikeStyle.Single : E.StrikeStyle.None, i.textUnderlineStyle && (r.font.underline = ee(i.textUnderlineStyle)), r.alignment = {}, i?.textAlign && (r.alignment.horizontal = y(i.textAlign)), i?.textAlign && !r.alignment.horizontal && i?.textAlign !== "general" && (i.textAlign === "center-across" ? r.alignment.horizontal = C.HorizontalAlignment.CenterContinuous : i.textAlign === "fill" ? r.alignment.horizontal = C.HorizontalAlignment.Fill : i.textAlign === "121" || i.textAlign === "010" ? (r.alignment.horizontal = C.HorizontalAlignment.Distributed, r.alignment.justifyLastLine = i.textAlign === "121") : console.warn("unknown text-align", i.textAlign)), i.verticalAlign && (i.verticalAlign.toLowerCase() === "super" ? r.font.baseline = b.Baseline.Superscript : i.verticalAlign.toLowerCase() === "sub" ? r.font.baseline = b.Baseline.Subscript : r.alignment.vertical = x(i.verticalAlign), r.alignment.vertical || (i.verticalAlign === "121" ? r.alignment.vertical = C.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" ? C.Overflow.Visible : C.Overflow.Wrap), i.msoTextControl === "shrinktofit" && (r.alignment.overflow = C.Overflow.Shrink);
1159
+ let s = null;
1160
+ if (i.background ? s = i.background : i.backgroundColor && (s = i.backgroundColor), s && (r.fill = { color: s }), i.msoPattern) {
1161
+ let e = ne(i.msoPattern);
1162
+ e && (e.patternType === w.BuiltInSheetPattern.Solid ? r.fill = { color: e.foreground } : e.patternType !== w.BuiltInSheetPattern.None && (s && (e.background = s), r.fill = e));
1163
+ }
1164
+ i.layoutFlow === "vertical" || i.layoutFlow === "vertical-ideographic" ? r.alignment.stacked = !0 : i.msoRotate !== void 0 && (r.alignment.rotation = oe(i.msoRotate));
1165
+ let c = (e, t) => {
1166
+ e && (r.borders ||= {}, r.borders[e] = t);
1167
+ };
1168
+ 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);
1169
+ let l = r.numberFormat;
1170
+ i.msoNumberFormat && (l = ae(i.msoNumberFormat), l.includes("\\") ? l = null : l === "Fixed" ? l = S.Styles.lookupStyle(r.numberFormat).formatType === S.Type.Number ? null : S.Type.Number : l === "Percent" && (l = S.Styles.lookupStyle(r.numberFormat).formatType === S.Type.Percentage ? null : S.Type.Percentage)), l && (r.numberFormat = l), e.style = this._styles.normalize(r), n && Object.keys(e.style).length === 0 && delete e.style;
1171
+ }
1172
+ onCell(e, t, n, r, i) {
1173
+ let a = r(i), o = { value: t === void 0 ? n ?? "" : t };
1174
+ if (typeof o.value == "string" && o.value.length === 0 && (o.value = void 0), a && this.applyCSSStyle(o, a), typeof o.value == "string" && /^#+$/.test(o.value)) {
1175
+ let e = o.style?.numberFormat;
1176
+ e && (te(e) || T(e)) && (o.value = O.BuiltIn.Num);
1177
+ }
1178
+ if (i?.tagName.toUpperCase() === "TD") {
1179
+ let e = o.style, t = e?.font ?? {};
1180
+ (i.querySelectorAll("s").length > 0 || i.querySelectorAll("strike").length > 0) && (t.strike = E.StrikeStyle.Single), i.querySelectorAll("sub").length > 0 && (t.baseline = b.Baseline.Subscript), i.querySelectorAll("sup").length > 0 && (t.baseline = b.Baseline.Superscript), (i.querySelectorAll("b").length > 0 || i.querySelectorAll("strong").length > 0) && (t.weight = 700), i.querySelectorAll("i").length > 0 && (t.style = E.Style.Italic), i.querySelectorAll("u").length > 0 && (t.underline = E.UnderlineStyle.Single), Object.keys(t).length > 0 && (e || (e = {}, o.style = e), e.font || (e.font = t));
1181
+ let n = i.querySelectorAll("a");
1182
+ if (n.length > 0) {
1183
+ let e = n[0].getAttribute("href");
1184
+ e && (o.hyperlink = e);
1185
+ }
1186
+ }
1187
+ if (!f.isSingleCell(e)) {
1188
+ let t = {
1189
+ rowStart: this._topLeft.rowIndex + e.rowStart,
1190
+ colStart: this._topLeft.colIndex + e.colStart,
1191
+ rowEnd: this._topLeft.rowIndex + e.rowEnd,
1192
+ colEnd: this._topLeft.colIndex + e.colEnd
1193
+ };
1194
+ this._mergedReading.push(t);
1195
+ }
1196
+ if (o.value === void 0 && !o.style && Object.keys(o).length <= 1) return;
1197
+ let s = this._builder, c = this._topLeft;
1198
+ if (s.pushAt(c.rowIndex + e.rowStart, c.colIndex + e.colStart, o), !f.isSingleCell(e) && a.msoIgnore) {
1199
+ if (a.msoIgnore.includes("colspan")) {
1200
+ let t = {};
1201
+ a && this.applyCSSStyle(t, a);
1202
+ let n = e.colEnd - e.colStart, r = c.rowIndex + e.rowStart;
1203
+ for (let i = 1; i <= n; i++) s.pushAt(r, c.colIndex + e.colStart + i, t);
1204
+ e = {
1205
+ ...e,
1206
+ colEnd: e.colStart
1207
+ };
1208
+ }
1209
+ a.msoIgnore.includes("rowspan") && (e = {
1210
+ ...e,
1211
+ rowEnd: e.rowStart
1212
+ });
1213
+ }
1214
+ }
1215
+ onNoTable(e, t, n) {
1216
+ this.onCell({
1217
+ rowStart: this._topLeft.rowIndex,
1218
+ colStart: this._topLeft.colIndex,
1219
+ rowEnd: this._topLeft.rowIndex,
1220
+ colEnd: this._topLeft.colIndex
1221
+ }, e, null, t, n);
1222
+ }
1223
+ onRowStart(e, t, n, r) {
1224
+ let i = n(r);
1225
+ if (i.msoHeightSource !== "userset" || !r) return;
1226
+ let a = r.getAttribute("height") ?? i.height, o = null;
1227
+ if (a && (o = D(a, this._styles.getNormal().getFont().getSize(), "px")), o === null) for (let e = 0; e < r.cells.length; e++) {
1228
+ let t = r.cells[e], i = t.getAttribute("height") ?? n(t).height, a = D(i, this._styles.getNormal().getFont().getSize(), "px");
1229
+ a !== null && (o = Math.max(a, o ?? 0));
1230
+ }
1231
+ o !== null && this._rowsReading.push({
1232
+ address: {
1233
+ min: this._topLeft.rowIndex + e,
1234
+ max: this._topLeft.rowIndex + e + t - 1
1235
+ },
1236
+ update: { size: o * E.getDeviceScale() }
1237
+ });
1238
+ }
1239
+ onColumn(e, t, n, r) {
1240
+ let i = n(r);
1241
+ if (i.msoWidthSource !== "userset" || !r) return;
1242
+ let a = r.getAttribute("width") ?? i.width, o = null;
1243
+ a && (o = D(a, this._styles.getNormal().getFont().getSize(), "px")), o !== null && this._colsReading.push({
1244
+ address: {
1245
+ min: this._topLeft.colIndex + e,
1246
+ max: this._topLeft.colIndex + e + t - 1
1247
+ },
1248
+ update: { size: o * E.getDeviceScale() }
1249
+ });
1250
+ }
1251
+ onDone() {
1252
+ this._colsReading.length > 0 && this._sheet.getColumnHeaders().updateHeaderPairs(this._colsReading), this._rowsReading.length > 0 && this._sheet.getRowHeaders().updateHeaderPairs(this._rowsReading), this._sheet.doBatch(() => {
1253
+ this._builder.apply();
1254
+ }), this._mergedReading.length > 0 && this._sheet.getRanges(this._mergedReading).merge();
1255
+ }
1256
+ sheet() {
1257
+ return this._sheet;
1258
+ }
1259
+ }, Yt = class {
1260
+ constructor(e) {
1261
+ if (!e) throw new p("snapshot is required.");
1262
+ this._snapshot = e;
1263
+ }
1264
+ getItemType() {
1265
+ return "range";
1266
+ }
1267
+ getItem() {
1268
+ return this._snapshot;
1269
+ }
1270
+ editMode() {
1271
+ return this._snapshot?.getMarkOptions().editMode ?? null;
1272
+ }
1273
+ isCut() {
1274
+ return this._snapshot?.getMarkOptions().isCut ?? !1;
1275
+ }
1276
+ getName() {
1277
+ return this._snapshot.getName();
1278
+ }
1279
+ toText() {
1280
+ return this._snapshot.toText();
1281
+ }
1282
+ toHtml() {
1283
+ return this._snapshot.toHtml();
1284
+ }
1285
+ toImage() {
1286
+ return this._snapshot.toImage();
1287
+ }
1288
+ get isClipboardItem() {
1289
+ return !0;
1290
+ }
1291
+ }, Xt = class {
1292
+ constructor(e, t, n, r, i) {
1293
+ if (this._parsed = void 0, this._runtime = e, !t) throw new p("nativeItems are required.");
1294
+ this._topLeft = n ?? f.EmptyCell, this._native = t, this._markOptions = Object.freeze(r ?? {}), this._styles = i;
1295
+ }
1296
+ getItemType() {
1297
+ return "range";
1298
+ }
1299
+ isCut() {
1300
+ return !1;
1301
+ }
1302
+ toText() {
1303
+ return this._native?.text;
1304
+ }
1305
+ toHtml() {
1306
+ return this._native?.html?.documentElement.outerHTML || null;
1307
+ }
1308
+ toImage() {
1309
+ return this._native?.image;
1310
+ }
1311
+ getItem() {
1312
+ let e = this._parsed;
1313
+ if (e === void 0) throw Error("Must call 'parse()' before getItem().");
1314
+ if (e === null) return null;
1315
+ if (this._snapshot) return this._snapshot;
1316
+ let t = this;
1317
+ return this._snapshot = {
1318
+ prepare: (n, r) => e.prepare?.(n, {
1319
+ ...t._markOptions,
1320
+ ...r
1321
+ }),
1322
+ copyTo: (n, r) => e.copyTo(n, {
1323
+ ...t._markOptions,
1324
+ ...r
1325
+ }),
1326
+ getMarkOptions: () => t._markOptions,
1327
+ getName: () => e?.getName() ?? "Clipboard Data",
1328
+ getCoords: () => e?.getCoords?.() ?? null,
1329
+ toText: () => t.toText(),
1330
+ toHtml: () => t.toHtml(),
1331
+ toImage: () => t.toImage(),
1332
+ getSource: () => e?.getSource?.() ?? null,
1333
+ isISnapshot: !0
1334
+ }, this._snapshot;
1335
+ }
1336
+ async parse() {
1337
+ let e, t = this._native?.text, n = this._native.html;
1338
+ if (n === null && t && t.includes("<table")) try {
1339
+ let e = new DOMParser().parseFromString(t, i.Html), r = e.querySelector("parsererror");
1340
+ if (r) throw new o("Unable to parse: " + r);
1341
+ n = e, t = null;
1342
+ } catch {
1343
+ console.warn("Discovered text as html table but could could not parse.");
1344
+ }
1345
+ try {
1346
+ let r, i = new Jt(this._runtime, this._topLeft, this._styles, n ? "HTML" : "Text"), a = await Promise.resolve(t ? Ie(t) : [[]]);
1347
+ if (Ce(n, a, i) ? (e = i.sheet(), r = e.getUsedRange()) : n = null, r) {
1348
+ let t = r.getSnapshot();
1349
+ return this._parsed = {
1350
+ prepare: (e, n) => t.prepare?.(e, n),
1351
+ copyTo: (e, n) => t.copyTo(e, n),
1352
+ getCoords: () => r.getCoords(),
1353
+ getSource: () => e,
1354
+ getName: () => e.getName()
1355
+ }, !0;
1356
+ }
1357
+ } catch (e) {
1358
+ throw e;
1359
+ }
1360
+ if (!t && !n && this._native.image) {
1361
+ let e = await this._native.image.arrayBuffer(), t = null;
1362
+ return this._parsed = {
1363
+ async prepare(n) {
1364
+ let r = n.getWorksheet();
1365
+ t = {
1366
+ sheet: r,
1367
+ options: await r.getMovables()._preparePicture({ source: { buffer: e } }, {
1368
+ type: "picture",
1369
+ description: l("op.copyImageFromClipboard"),
1370
+ autoSelect: !0
1371
+ })
1372
+ };
1373
+ },
1374
+ copyTo(e, n) {
1375
+ let r = e.getWorksheet();
1376
+ if (t?.sheet !== r) throw Error("The image was not prepared for this sheet.");
1377
+ return r.getMovables()._insertNow(t.options), null;
1378
+ },
1379
+ getName: () => "Image"
1380
+ }, !0;
1381
+ }
1382
+ return this._parsed = null, !1;
1383
+ }
1384
+ get isClipboardItem() {
1385
+ return !0;
1386
+ }
1387
+ }, Zt = class {
1388
+ constructor(e) {
1389
+ this._closed = !1, this._kind = e.kind, this._id = e.id, this._part = e.part, this._styles = e.styles, this._tabColor = e.tabColor ? this._styles.parseColor(e.tabColor) : null, this._transactions = e.transactions, this._workbook = e.workbook ?? null, this._container = e.container, this._emitter = new _(this, this._transactions);
1390
+ }
1391
+ getKind() {
1392
+ return this._kind;
1393
+ }
1394
+ getId() {
1395
+ return this._id;
1396
+ }
1397
+ getName() {
1398
+ return this._container.getName();
1399
+ }
1400
+ setName(e, t) {
1401
+ return this._assertOpen(), this._container.setName(e, t), this;
1402
+ }
1403
+ getVisibility() {
1404
+ return this._closed ? I.Visibility.VeryHidden : this._container.getVisibility();
1405
+ }
1406
+ setVisibility(e = !0, t) {
1407
+ let n;
1408
+ return this._assertOpen(), n = !0 === e ? I.Visibility.Visible : !1 === e ? I.Visibility.Hidden : e, this._container.setVisibility(n, t), this;
1409
+ }
1410
+ getIndex() {
1411
+ return this._container.getIndex();
1412
+ }
1413
+ setIndex(e, t) {
1414
+ return this._assertOpen(), this._container.setIndex(e, t), this;
1415
+ }
1416
+ getTabColor() {
1417
+ return this._tabColor;
1418
+ }
1419
+ setTabColor(e) {
1420
+ return this._assertOpen(), this._tabColor = typeof e == "string" ? this._styles.parseColor(e) : e ?? null, this._notify("onTabColorChange"), this;
1421
+ }
1422
+ getWorkbook() {
1423
+ return this._workbook;
1424
+ }
1425
+ async select(e) {
1426
+ return await this._container.requestSelect(e), this;
1427
+ }
1428
+ delete() {
1429
+ if (this._closed) return;
1430
+ let e = this._transactions.beginCommit({ description: a("op.deleteSheet", { name: this.getName() }) });
1431
+ try {
1432
+ try {
1433
+ this._notify("onBeforeDelete");
1434
+ } catch (e) {
1435
+ throw e instanceof Error ? e : new o(e?.message ?? a("error.sheet.modelDelete"));
1436
+ }
1437
+ this._notify("onDelete"), e.commit();
1438
+ } catch (t) {
1439
+ throw e.rollback(), t;
1440
+ }
1441
+ }
1442
+ isDeleted() {
1443
+ return !this._container.isAttached();
1444
+ }
1445
+ addListeners(e, t) {
1446
+ return this._emitter.addListeners(e, t);
1447
+ }
1448
+ close() {
1449
+ this._closed ||= (this._notify("onClose"), this._emitter.close(), !0);
1450
+ }
1451
+ isClosed() {
1452
+ return this._closed;
1453
+ }
1454
+ _getPart() {
1455
+ return this._part;
1456
+ }
1457
+ _notify(e) {
1458
+ this._emitter.notify(e);
1459
+ }
1460
+ _assertOpen() {
1461
+ if (this._closed) throw Error(a("error.sheet.modelClosed"));
1462
+ }
1463
+ get [Symbol.toStringTag]() {
1464
+ return "[OpaqueSheet]";
1465
+ }
1466
+ toString() {
1467
+ return `[${this.getName() ?? "(untitled)"}]`;
1468
+ }
1469
+ get isISheet() {
1470
+ return !0;
1471
+ }
1472
+ get isIOpaqueSheet() {
1473
+ return !0;
1474
+ }
1475
+ };
1476
+ (G ||= {}).Visibility = {
1477
+ Visible: "visible",
1478
+ Hidden: "hidden",
1479
+ VeryHidden: "veryHidden"
1480
+ };
1481
+ var q = {
1482
+ showFormulaBar: !0,
1483
+ showTabs: !0,
1484
+ tabRatio: 600,
1485
+ showHorizontalScrollbar: !0,
1486
+ showVerticalScrollbar: !0,
1487
+ showStatusBar: !0,
1488
+ activeSheetId: 0,
1489
+ firstTab: 0,
1490
+ windowBounds: null,
1491
+ minimized: !1,
1492
+ visibility: G.Visibility.Visible,
1493
+ autoFilterDateGrouping: !0
1494
+ }, Qt = class {
1495
+ constructor(e) {
1496
+ this._id = n.uuidV4(), this._emitter = new _(this), this._state = { ...q }, e?.json && this._fromJSON(e?.json);
1497
+ }
1498
+ getId() {
1499
+ return this._id;
1500
+ }
1501
+ isShowFormulaBar() {
1502
+ return this._state.showFormulaBar;
1503
+ }
1504
+ setShowFormulaBar(e) {
1505
+ return this._state.showFormulaBar = e, this._emitter.notify("onViewChange"), this;
1506
+ }
1507
+ isShowTabs() {
1508
+ return this._state.showTabs;
1509
+ }
1510
+ setShowTabs(e) {
1511
+ return this._state.showTabs = e, this._emitter.notify("onViewChange"), this;
1512
+ }
1513
+ getTabRatio() {
1514
+ return this._state.tabRatio;
1515
+ }
1516
+ setTabRatio(e) {
1517
+ return this._state.tabRatio = e, this._emitter.notify("onViewChange"), this;
1518
+ }
1519
+ isShowHorizontalScrollbar() {
1520
+ return this._state.showHorizontalScrollbar;
1521
+ }
1522
+ setShowHorizontalScrollbar(e) {
1523
+ return this._state.showHorizontalScrollbar = e, this._emitter.notify("onViewChange"), this;
1524
+ }
1525
+ isShowVerticalScrollbar() {
1526
+ return this._state.showVerticalScrollbar;
1527
+ }
1528
+ setShowVerticalScrollbar(e) {
1529
+ return this._state.showVerticalScrollbar = e, this._emitter.notify("onViewChange"), this;
1530
+ }
1531
+ isShowStatusBar() {
1532
+ return this._state.showStatusBar;
1533
+ }
1534
+ setShowStatusBar(e) {
1535
+ return this._state.showStatusBar = e, this._emitter.notify("onViewChange"), this;
1536
+ }
1537
+ getActiveSheetId() {
1538
+ return this._state.activeSheetId;
1539
+ }
1540
+ setActiveSheetId(e) {
1541
+ let t = this._state, n = t.activeSheetId;
1542
+ return t.activeSheetId = e, n !== e && this._emitter.notify("onViewChange"), this;
1543
+ }
1544
+ getFirstTab() {
1545
+ return this._state.firstTab;
1546
+ }
1547
+ setFirstTab(e) {
1548
+ return this._set("firstTab", Math.max(0, Math.trunc(e)));
1549
+ }
1550
+ getWindowBounds() {
1551
+ return this._state.windowBounds;
1552
+ }
1553
+ setWindowBounds(e) {
1554
+ return this._set("windowBounds", e ? Object.freeze({ ...e }) : null);
1555
+ }
1556
+ isMinimized() {
1557
+ return this._state.minimized;
1558
+ }
1559
+ setMinimized(e) {
1560
+ return this._set("minimized", e);
1561
+ }
1562
+ getVisibility() {
1563
+ return this._state.visibility;
1564
+ }
1565
+ setVisibility(e) {
1566
+ return this._set("visibility", e);
1567
+ }
1568
+ isAutoFilterDateGrouping() {
1569
+ return this._state.autoFilterDateGrouping;
1570
+ }
1571
+ setAutoFilterDateGrouping(e) {
1572
+ return this._set("autoFilterDateGrouping", e);
1573
+ }
1574
+ _set(e, t) {
1575
+ return this._state[e] === t || (this._state[e] = t, this._emitter.notify("onViewChange")), this;
1576
+ }
1577
+ addListeners(e, t) {
1578
+ return this._emitter.addListeners(e, t);
1579
+ }
1580
+ toJSON() {
1581
+ let e = {}, t = Object.keys(this._state), n = t.length;
1582
+ for (let r = 0; r < n; r++) {
1583
+ let n = t[r], i = this._state[n];
1584
+ i != null && i !== q[n] && (e[n] = i);
1585
+ }
1586
+ return Object.keys(e).length === 0 && (e = null), e;
1587
+ }
1588
+ _fromJSON(e, t = !0) {
1589
+ let n = e || {};
1590
+ this.update(n, t);
1591
+ }
1592
+ update(e, t = !0) {
1593
+ this._state = {
1594
+ ...q,
1595
+ ...this._state,
1596
+ ...e
1597
+ }, t && this._emitter.notify("onViewChange");
1598
+ }
1599
+ get [Symbol.toStringTag]() {
1600
+ return "[WorkbookView]";
1601
+ }
1602
+ toString() {
1603
+ let e = this.toJSON();
1604
+ return e ? JSON.stringify(e) : "DefaultWorkbookView";
1605
+ }
1606
+ get isIWorkbookView() {
1607
+ return !0;
1608
+ }
1609
+ }, $t = Object.freeze({
1610
+ structure: !1,
1611
+ windows: !1,
1612
+ revision: !0,
1613
+ password: null,
1614
+ revisionsPassword: null
1615
+ }), en = class extends Me {
1616
+ isWindowsAllowed() {
1617
+ return this._isPropertyAllowed("windows");
1618
+ }
1619
+ isRevisionAllowed() {
1620
+ return this.isLocked() && this._properties?.revision === void 0 ? !this._isReadOnly : this._isPropertyAllowed("revision");
1621
+ }
1622
+ isStructureAllowed() {
1623
+ return this._isPropertyAllowed("structure");
1624
+ }
1625
+ _getAllowedKey() {
1626
+ return "workbook";
1627
+ }
1628
+ _fromJSON(e) {
1629
+ this._properties = e;
1630
+ }
1631
+ _toJSON(e) {
1632
+ let t = this._properties;
1633
+ if (t) {
1634
+ let n = Object.keys(t), r = n.length;
1635
+ for (let i = 0; i < r; i++) {
1636
+ let r = n[i], a = t[r];
1637
+ a != null && a !== $t[r] && (e[r] = a);
1638
+ }
1639
+ }
1640
+ return super._toJSON(e);
1641
+ }
1642
+ get [Symbol.toStringTag]() {
1643
+ return "[WorkbookProtection]";
1644
+ }
1645
+ get isIWorkbookProtection() {
1646
+ return !0;
1647
+ }
1648
+ };
1649
+ (K ||= {}).Type = {
1650
+ Number: "number",
1651
+ Boolean: "boolean",
1652
+ Date: "date",
1653
+ String: "string",
1654
+ Float: "float"
1655
+ };
1656
+ var tn = (e) => {
1657
+ if (typeof e == "string") return {
1658
+ type: K.Type.String,
1659
+ value: e
1660
+ };
1661
+ if (typeof e == "boolean") return {
1662
+ type: K.Type.Boolean,
1663
+ value: e
1664
+ };
1665
+ if (typeof e == "number") {
1666
+ if (!Number.isFinite(e)) throw Error("A custom property value must be a finite number.");
1667
+ return {
1668
+ type: Number.isInteger(e) && e >= -2147483648 && e <= 2147483647 ? K.Type.Number : K.Type.Float,
1669
+ value: e
1670
+ };
1671
+ }
1672
+ if (e instanceof Date) {
1673
+ if (isNaN(e.getTime())) throw Error("A custom property value must be a valid date.");
1674
+ return {
1675
+ type: K.Type.Date,
1676
+ value: e.toISOString()
1677
+ };
1678
+ }
1679
+ throw Error("A custom property value must be a string, number, boolean or Date.");
1680
+ }, nn = class {
1681
+ constructor(e, t) {
1682
+ this._json = e, this._owner = t;
1683
+ }
1684
+ getKey() {
1685
+ return this._json.key;
1686
+ }
1687
+ getType() {
1688
+ return this._json.type;
1689
+ }
1690
+ getLinkTarget() {
1691
+ return this._json.linkTarget ?? null;
1692
+ }
1693
+ getValue() {
1694
+ let { type: e, value: t } = this._json;
1695
+ return e === K.Type.Date ? new Date(t) : t;
1696
+ }
1697
+ setValue(e) {
1698
+ this._owner._assertCustomEditable(this), this._json = {
1699
+ ...this._json,
1700
+ ...tn(e)
1701
+ };
1702
+ }
1703
+ delete() {
1704
+ this._owner._removeCustom(this);
1705
+ }
1706
+ toJSON() {
1707
+ return { ...this._json };
1708
+ }
1709
+ }, rn = class {
1710
+ constructor(e) {
1711
+ this._json = {}, this._custom = [], this._assertOpen = e;
1712
+ }
1713
+ _text(e) {
1714
+ return this._json[e] ?? null;
1715
+ }
1716
+ _setText(e, t) {
1717
+ return this._assertOpen(), t == null || t === "" ? delete this._json[e] : this._json[e] = t, this;
1718
+ }
1719
+ getAuthor() {
1720
+ return this._text("author");
1721
+ }
1722
+ setAuthor(e) {
1723
+ return this._setText("author", e);
1724
+ }
1725
+ getCategory() {
1726
+ return this._text("category");
1727
+ }
1728
+ setCategory(e) {
1729
+ return this._setText("category", e);
1730
+ }
1731
+ getComments() {
1732
+ return this._text("comments");
1733
+ }
1734
+ setComments(e) {
1735
+ return this._setText("comments", e);
1736
+ }
1737
+ getCompany() {
1738
+ return this._text("company");
1739
+ }
1740
+ setCompany(e) {
1741
+ return this._setText("company", e);
1742
+ }
1743
+ getContentStatus() {
1744
+ return this._text("contentStatus");
1745
+ }
1746
+ setContentStatus(e) {
1747
+ return this._setText("contentStatus", e);
1748
+ }
1749
+ getCreationDate() {
1750
+ let e = this._json.creationDate;
1751
+ if (!e) return null;
1752
+ let t = new Date(e);
1753
+ return isNaN(t.getTime()) ? null : t;
1754
+ }
1755
+ getKeywords() {
1756
+ return this._text("keywords");
1757
+ }
1758
+ setKeywords(e) {
1759
+ return this._setText("keywords", e);
1760
+ }
1761
+ getLastAuthor() {
1762
+ return this._json.lastAuthor ?? null;
1763
+ }
1764
+ getManager() {
1765
+ return this._text("manager");
1766
+ }
1767
+ setManager(e) {
1768
+ return this._setText("manager", e);
1769
+ }
1770
+ getRevisionNumber() {
1771
+ return this._json.revisionNumber ?? null;
1772
+ }
1773
+ setRevisionNumber(e) {
1774
+ return this._assertOpen(), e != null && Number.isFinite(e) ? this._json.revisionNumber = e : delete this._json.revisionNumber, this;
1775
+ }
1776
+ getSubject() {
1777
+ return this._text("subject");
1778
+ }
1779
+ setSubject(e) {
1780
+ return this._setText("subject", e);
1781
+ }
1782
+ getTitle() {
1783
+ return this._text("title");
1784
+ }
1785
+ setTitle(e) {
1786
+ return this._setText("title", e);
1787
+ }
1788
+ getCustom() {
1789
+ return this._custom.slice();
1790
+ }
1791
+ getCustomProperty(e) {
1792
+ let t = e.toLowerCase();
1793
+ return this._custom.find((e) => e.getKey().toLowerCase() === t);
1794
+ }
1795
+ addCustomProperty(e, t) {
1796
+ if (this._assertOpen(), typeof e != "string" || e === "") throw Error("A custom property needs a name.");
1797
+ let n = this.getCustomProperty(e);
1798
+ if (n) return n.setValue(t), n;
1799
+ let r = new nn({
1800
+ key: e,
1801
+ ...tn(t)
1802
+ }, this);
1803
+ return this._custom.push(r), r;
1804
+ }
1805
+ deleteAllCustomProperties() {
1806
+ this._assertOpen(), this._custom = [];
1807
+ }
1808
+ _assertCustomEditable(e) {
1809
+ if (this._assertOpen(), !this._custom.includes(e)) throw Error("The custom property has been deleted.");
1810
+ }
1811
+ _removeCustom(e) {
1812
+ this._assertCustomEditable(e), this._custom = this._custom.filter((t) => t !== e);
1813
+ }
1814
+ fromJSON(e) {
1815
+ let { custom: t, ...n } = e ?? {};
1816
+ this._json = n, this._custom = (t ?? []).map((e) => new nn({ ...e }, this));
1817
+ }
1818
+ toJSON() {
1819
+ let e = { ...this._json };
1820
+ return this._custom.length > 0 && (e.custom = this._custom.map((e) => e.toJSON())), e;
1821
+ }
1822
+ };
1823
+ function J(e) {
1824
+ return a("error.workbook.invalidSheetKey", { key: e });
1825
+ }
1826
+ function an(e) {
1827
+ return a("error.workbook.sheetNameNotFound", { sheetName: e });
1828
+ }
1829
+ function Y(e, t) {
1830
+ return a(t === "chart" ? "error.workbook.sheetIsChart" : t === "macro" ? "error.workbook.sheetIsMacro" : "error.workbook.sheetIsDialog", { sheetName: e });
1831
+ }
1832
+ function on(e, t) {
1833
+ return t === "chart" ? a("error.workbook.selectedIsChart", { sheetName: e }) : t === "macro" ? a("error.workbook.selectedIsMacro", { sheetName: e }) : t === "dialog" ? a("error.workbook.selectedIsDialog", { sheetName: e }) : a("error.workbook.noWorksheet");
1834
+ }
1835
+ var sn, cn = class extends _e {
1836
+ constructor(e, t, n, r) {
1837
+ super(), this._add = e, this._get = t, this._addListeners = n, this._getSelected = r;
1838
+ }
1839
+ getActive() {
1840
+ return this._getSelected();
1841
+ }
1842
+ getAt(e) {
1843
+ return this.getItems()[e] ?? null;
1844
+ }
1845
+ getByIndex(e) {
1846
+ return this.getItems()[e] ?? null;
1847
+ }
1848
+ getAll() {
1849
+ return this.getItems();
1850
+ }
1851
+ add(e) {
1852
+ return this._add(e);
1853
+ }
1854
+ _getItems(e) {
1855
+ return this._get(e?.name, e?.visibility);
1856
+ }
1857
+ getByName(e) {
1858
+ return this._get(e)?.[0] ?? null;
1859
+ }
1860
+ addListeners(e, t) {
1861
+ return this._addListeners(e, t);
1862
+ }
1863
+ get isIWorksheetCollection() {
1864
+ return !0;
1865
+ }
1866
+ }, X = /* @__PURE__ */ new RegExp(/[\\/\\*?:[\]]+/), ln = /* @__PURE__ */ new RegExp(/\(((\d+)(?!.*\d))\)$/, "g");
1867
+ function un(e) {
1868
+ let t = a(l("workbook.defaultSheetName"), { n: e + 1 });
1869
+ return t === "workbook.defaultSheetName" ? `Sheet${e + 1}` : t;
1870
+ }
1871
+ function dn(e, t) {
1872
+ return {
1873
+ ...He,
1874
+ getWorksheet: () => null,
1875
+ toString: () => P(e, t)
1876
+ };
1877
+ }
1878
+ function fn(e, t = !1) {
1879
+ if (!e) throw Error(a("error.workbook.sheetNameBlank"));
1880
+ if (X.test(e)) {
1881
+ if (!t) throw Error(function(e) {
1882
+ return e ? a("error.workbook.sheetNameInvalidCharsNamed", { sheetName: e }) : a("error.workbook.sheetNameInvalidChars");
1883
+ }(e));
1884
+ e = e.replace(X, "");
1885
+ }
1886
+ if (e.length === 0) throw Error(a("error.workbook.sheetNameBlank"));
1887
+ let n = e.length;
1888
+ if (n > 31) {
1889
+ if (!t) throw Error(a("error.workbook.sheetNameTooLong"));
1890
+ e = e.substring(0, 31);
1891
+ }
1892
+ if (e.charAt(0) === "'" || e.charAt(n - 1) === "'") {
1893
+ if (!t) throw Error(a("error.workbook.sheetNameQuotes"));
1894
+ e = e.replace(/^'|'$/g, "");
1895
+ }
1896
+ return e;
1897
+ }
1898
+ var pn, mn, hn, gn = "workbook.activeSheet", Z = class e extends xe {
1899
+ constructor(e, t, n, r) {
1900
+ super(e, t, r), this._workbook = n;
1901
+ }
1902
+ getSource() {
1903
+ return this._workbook;
1904
+ }
1905
+ _createRanges(t, n) {
1906
+ let r = this._options;
1907
+ return n && (r = {
1908
+ ...this._options,
1909
+ getOptions: z(this._options?.getOptions, n)
1910
+ }), new e(t, this._internal, this._workbook, r);
1911
+ }
1912
+ _createRange(e, t) {
1913
+ let n = e ? { ...e } : null, r = this._workbook, i = n ? r._getSheetRef(n.scope, I.Visibility.VeryHidden) : null;
1914
+ if (i && !i.sheet.isIWorksheet) throw new o(Y(i.name, i.sheet.getKind()));
1915
+ if (!i) {
1916
+ let e = r._anchorWorksheet();
1917
+ return delete n?.scope, dn(n, n ? {
1918
+ scope: Ae,
1919
+ ...e.getEntireRange().getCoords()
1920
+ } : null);
1921
+ }
1922
+ let a = this._options;
1923
+ return t && (a = {
1924
+ ...this._options,
1925
+ getOptions: z(this._options.getOptions, t)
1926
+ }), new _n(e, L(i.sheet), this._workbook, a);
1927
+ }
1928
+ async select(e) {
1929
+ let t = [], n = null, r = this.getCoords();
1930
+ for (let e = 0; e < r.length; e++) {
1931
+ let i = r[e];
1932
+ i && (n ||= i.scope, i && i.scope === n && t.push(i));
1933
+ }
1934
+ n ||= this._workbook.getWorksheet().getName();
1935
+ let i = this._workbook.getWorksheets().getByName(n);
1936
+ if (!i) return;
1937
+ let a = await i.getRanges(t).select(e), o = this._workbook._rangesAddressToCoords(a.getCoords());
1938
+ return this._createRanges(o);
1939
+ }
1940
+ addListener(e, t) {
1941
+ if (!this.getCoords()) return () => {};
1942
+ let n = this._workbook._sheetToWBEvent(e);
1943
+ return super.addListener(n, t);
1944
+ }
1945
+ get [Symbol.toStringTag]() {
1946
+ return "[WorkbookRanges]";
1947
+ }
1948
+ getAddress(e) {
1949
+ let t = this._internal.getSheet(), n = t.getEntireRange().getCoords();
1950
+ return Ye(this.getCoords(), {
1951
+ ...n,
1952
+ scope: t.getName()
1953
+ }, P, Qe, e);
1954
+ }
1955
+ toString() {
1956
+ return this.getAddress();
1957
+ }
1958
+ }, _n = class e extends ct {
1959
+ constructor(e, t, n, r) {
1960
+ super(e, t, r), this._workbook = n;
1961
+ }
1962
+ _createRanges(e, t) {
1963
+ let n = this._options;
1964
+ return t && (n = {
1965
+ ...this._options,
1966
+ getOptions: z(this._options?.getOptions, t)
1967
+ }), new Z(e, this._internal, this._workbook, n);
1968
+ }
1969
+ _createRange(t, n) {
1970
+ let r = this._internal;
1971
+ if (!t) return ot(r.getSheet(), r.getSheet().getEntireCoords());
1972
+ if (r.validateCoords(t), r.getSheet().isClosed()) return ot(null, r.getSheet().getEntireCoords(), t);
1973
+ let i = this._options;
1974
+ return n && (i = {
1975
+ ...this._options,
1976
+ getOptions: z(this._options?.getOptions, n)
1977
+ }), new e(t, this._internal, this._workbook, i);
1978
+ }
1979
+ addListener(e, t) {
1980
+ if (!this.getCoords()) return () => {};
1981
+ let n = this._workbook._sheetToWBEvent(e);
1982
+ return super.addListener(n, t);
1983
+ }
1984
+ get [Symbol.toStringTag]() {
1985
+ return "[WorkbookRange]";
1986
+ }
1987
+ getAddress(e) {
1988
+ let t = this._internal.getSheet(), n = t?.getEntireRange().getCoords() ?? null;
1989
+ return P(this.getCoords(), {
1990
+ ...n,
1991
+ scope: t.getName()
1992
+ });
1993
+ }
1994
+ toString() {
1995
+ return this.getAddress();
1996
+ }
1997
+ }, vn = (e) => !!e && typeof e == "object" && typeof e.getOrigin == "function", yn = class {
1998
+ constructor(e) {
1999
+ 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 ve(() => {
2000
+ let e = [];
2001
+ for (let t of this.getWorksheets()) e.push(...t.getPivotTables());
2002
+ return e;
2003
+ }), this._people = new Kt(), this._commentCollection = new We(null, (e, t, n) => {
2004
+ let r = [];
2005
+ for (let i of this.getWorksheets()) r.push(...i.getComments().getItems(e ? {
2006
+ address: e,
2007
+ ignoreHidden: t,
2008
+ fullyContained: n
2009
+ } : {
2010
+ ignoreHidden: t,
2011
+ fullyContained: n
2012
+ }));
2013
+ return r;
2014
+ }, (e, t) => this.addListeners({ onSheetsChange: e.onCollectionChange ? () => {
2015
+ e.onCollectionChange(this._commentCollection);
2016
+ } : void 0 }, t)), this._isDate1904 = !1, this._codeName = null, this._updateLinks = null, this._documentProperties = new rn(() => {
2017
+ if (this._closed) throw Error(a("error.workbook.modelClosed"));
2018
+ }), this._locale = null, this._localeOverrides = null;
2019
+ let t = typeof e == "string" ? { origin: e } : { ...e }, r = t.origin;
2020
+ this._ownOriginProvider = !vn(r), this._originProvider = vn(r) ? r : new _t(typeof r == "string" ? new B(null, { name: r }) : r ?? new B(null)), delete t.origin, this._bindOrigin(this._originProvider.getOrigin()), this._listenerOriginProvider = this._originProvider.addListeners({ onOriginChange: () => this._onOriginChange() });
2021
+ let i = t.json;
2022
+ delete t.json, this._transactions = t.transactions ?? new v(), this._id = this._transactions.create(), this._ownTransactions = !t.transactions, this._emitter = new _(this, this._transactions), this._runtime = t.runtime ?? new Le("Workbook Runtime", {
2023
+ isDate1904: () => this._isDate1904,
2024
+ getNow: () => this._transactions.getCurrentCommit().getTimestamp(),
2025
+ getLocale: () => this._locale ?? tt() ?? je(),
2026
+ getLocaleOverrides: () => this._localeOverrides
2027
+ }), this._listenerLanguage = s.addChangeListener(() => {
2028
+ this._closed || this._notifyAllChange();
2029
+ });
2030
+ let o = this, c = this._beginCommit({ description: l(i ? "op.openWorkbook" : "op.newWorkbook") });
2031
+ try {
2032
+ this._strings = t.strings ?? new qe(), this._ownStrings = !t.strings, this._resources = t.resources ?? new we(), this._ownResources = !t.resources, this._createSheetName = t.createSheetNameCallback ?? un;
2033
+ let e = t.createWorksheetCallback;
2034
+ e ||= (e) => new F(e), this._sheetOnNameChange = /* @__PURE__ */ new Map(), this._sheetOnVisibilityChange = /* @__PURE__ */ new Map(), this._sheetOnIndexChange = /* @__PURE__ */ new Map(), this._createSheet = (t, n, r, i, a, s, c) => {
2035
+ let l = null, u = {
2036
+ runtime: o._runtime,
2037
+ readonly: o._options.readonly ?? !1,
2038
+ disableLoadAutoFit: o._options.disableLoadAutoFit ?? !1,
2039
+ opener: o._options.opener,
2040
+ transactions: o._transactions,
2041
+ styles: o._styles,
2042
+ strings: o._strings,
2043
+ resources: o._resources,
2044
+ names: o._names,
2045
+ workbook: o,
2046
+ calculation: o._calculation,
2047
+ resolveRange: (e) => o._options.resolveRange?.(e) ?? o.getRange(e),
2048
+ container: {
2049
+ beforeFromJSON: (e) => {
2050
+ l = e, o._addSheetRef({
2051
+ name: n,
2052
+ id: t,
2053
+ visibility: r ?? I.Visibility.Visible,
2054
+ sheetId: a,
2055
+ sheet: e
2056
+ }, i);
2057
+ },
2058
+ getName: () => {
2059
+ let e = o._getSheetRef(l);
2060
+ return e ? e.name : n;
2061
+ },
2062
+ setName: (e, t) => {
2063
+ o._getSheetRef(l) && o._setSheetName(l, e, t);
2064
+ },
2065
+ setNameChangeCallback: (e) => {
2066
+ o._sheetOnNameChange.set(t, e);
2067
+ },
2068
+ getVisibility: () => {
2069
+ let e = o._getSheetRef(l);
2070
+ return e ? e.visibility : I.Visibility.Visible;
2071
+ },
2072
+ setVisibility: (e, t) => {
2073
+ o._setSheetVisibility(l, e, t);
2074
+ },
2075
+ setVisibilityCallback: (e) => {
2076
+ o._sheetOnVisibilityChange.set(t, e);
2077
+ },
2078
+ duplicate: () => o._duplicateSheet(l),
2079
+ getIndex: () => {
2080
+ let e = o._getSheetRef(l);
2081
+ return e ? o._getOffsetForId(e.id, o._getSheetRefs(I.Visibility.VeryHidden)) : i;
2082
+ },
2083
+ setIndex: (e, t) => {
2084
+ let n = o._getSheetRef(l, I.Visibility.VeryHidden);
2085
+ return !!n && (o._moveSheet(n, e, t), !0);
2086
+ },
2087
+ setIndexCallback: (e) => {
2088
+ o._sheetOnIndexChange.set(t, e);
2089
+ },
2090
+ requestSelect: () => o._requestSelect(l)
2091
+ }
2092
+ };
2093
+ return s && (u.json = s), c !== void 0 && (u.uid = () => c), l = e(u, n, i, r), l;
2094
+ }, this._namedTableSource = new ke({
2095
+ getSheets: () => o._sheets ? o.getWorksheets().getItems() : n.EmptyArray,
2096
+ addSheetsListener: (e, t) => o.addListeners({ onSheetsChange: e }, t)
2097
+ }), this._names = t.names ?? new Ne({
2098
+ addressToRanges: (e) => o.getRanges(e),
2099
+ getCurrentScope: () => o.getSelectedWorksheet()?.getName() ?? null,
2100
+ isReadOnly: () => (o._options.readonly ?? !1) || o._isStructureProtected(),
2101
+ transactions: o._transactions,
2102
+ getSources: () => o._calculation ? [o._calculation.getNamedFormulas(), o._namedTableSource] : n.EmptyArray
2103
+ }), this._ownNames = !t.names, this._calculation = t.calculation ?? new at({
2104
+ runtime: o._runtime,
2105
+ functions: t.functions,
2106
+ json: i?.calc,
2107
+ isNamesReadOnly: () => o._isStructureProtected(),
2108
+ getActiveCell: () => {
2109
+ let e = o.getSelectedWorksheet(), t = e?.getSelectedRange()?.getCoords();
2110
+ return e && t ? {
2111
+ rowIndex: t.rowStart,
2112
+ colIndex: t.colStart,
2113
+ scope: e.getId()
2114
+ } : null;
2115
+ },
2116
+ getRange: o.getRange.bind(o),
2117
+ getRanges: o.getRanges.bind(o),
2118
+ createGraphRanges: (e, t) => o._createGraphRanges(e, t),
2119
+ getSheetIndex: (e) => {
2120
+ if (e === void 0) {
2121
+ let e = o.getSelectedSheet();
2122
+ return e ? this._getSheetRefs(I.Visibility.VeryHidden).findIndex((t) => t.sheet === e) : -1;
2123
+ }
2124
+ let t = this._getSheetRefs(I.Visibility.VeryHidden);
2125
+ e = e.toLowerCase();
2126
+ let n = t.length;
2127
+ for (let r = 0; r < n; r++) if (t[r].name.toLowerCase() === e) return r;
2128
+ try {
2129
+ bn.address = e;
2130
+ let t = this._names.getItems(bn);
2131
+ if (!t || t.length === 0) return -1;
2132
+ let n = t[0].getRanges?.()?.getCoords()?.[0]?.scope;
2133
+ if (!n) return -1;
2134
+ let r = this._getSheetRefs(I.Visibility.VeryHidden);
2135
+ n = n.toLowerCase();
2136
+ let i = r.length;
2137
+ for (let e = 0; e < i; e++) if (r[e].name.toLowerCase() === n) return e;
2138
+ } catch {
2139
+ return -1;
2140
+ }
2141
+ return -1;
2142
+ },
2143
+ getSheetCount: () => o._getSheetRefs(I.Visibility.VeryHidden).length,
2144
+ externalBooks: i?.externalBooks,
2145
+ externalBookResolver: t.externalBookResolver,
2146
+ namedCollection: o._names,
2147
+ strings: o._strings,
2148
+ transactions: o._transactions,
2149
+ names: i?.names
2150
+ }), this._ownCalculation = !t.calculation, this._scripts = this._createScripts(i?.modules), this._ownNames = !t.names, this._options = Object.freeze({ ...t });
2151
+ let r = i?.sheets?.length ? i.sheets.map((e) => e.name) : [this._createSheetName(0)], a = r.map((e) => e + "-" + n.uuidV4()), s = (e) => {
2152
+ let t = i?.sheets?.[e]?.kind;
2153
+ return !!t && t !== I.Kind.Worksheet;
2154
+ };
2155
+ this._calculation._setSheets(r.map((e, t) => s(t) ? [
2156
+ a[t],
2157
+ e,
2158
+ !0
2159
+ ] : [a[t], e]));
2160
+ let l = t.calcOnLoad ?? "auto", u = !1, d = (async () => {
2161
+ try {
2162
+ if (this._ownCalculation && l !== "none" && (l === "full" || l === "auto" && !0 === i?.calc?.fullCalcOnLoad ? await this._calculation.calculate({ full: !0 }) : await this._calculation.start(), this._closed)) return;
2163
+ await this._scripts.start();
2164
+ } finally {
2165
+ u = !0, this._starting = null;
2166
+ }
2167
+ })();
2168
+ u || (this._starting = d), this._starting?.catch(() => {}), i ? this._fromJSON(i, a) : (this._initState(), this._addSheet(!1, r[0], null, a[0])), this._sheets = new cn((e) => o._addSheetOptions(e), (e, t) => {
2169
+ if (e) {
2170
+ let r = this._getSheetRef(e, t);
2171
+ return r && Q(r) ? [r.sheet] : n.EmptyArray;
2172
+ }
2173
+ return this._getWorksheets(t);
2174
+ }, (e, t) => {
2175
+ let n = e.onCollectionChange, r = e.onInvalidated;
2176
+ return o._emitter.addListeners({
2177
+ onSheetsChange: n ? () => {
2178
+ n(o._sheets);
2179
+ } : void 0,
2180
+ onInvalidated: r ? () => {
2181
+ r(o._sheets);
2182
+ } : void 0
2183
+ }, t);
2184
+ }, () => o.getSelectedWorksheet()), this._ownCalculation && (t.calcOnLoad ?? "auto") !== "none" && this._calculation.hydrateNames(), this._emitter.notify("onLoad"), this._ownTransactions ? c.amend() : c.commit();
2185
+ } catch (e) {
2186
+ throw c.rollback(), e;
2187
+ }
2188
+ this._initializing = !1;
2189
+ }
2190
+ _initState() {
2191
+ let e = this._getSheetRefs();
2192
+ for (let t = (e ? e.length : 0) - 1; t >= 0; t--);
2193
+ let t = this._options;
2194
+ this._isDate1904 = t.runtime?.isDate1904() ?? !1, this._locale = null, this._localeOverrides = null, this._theme = t.theme ?? new Re().getDefaultTheme(), this._styles = t?.styles ?? new Ge(this._theme), this._ownStyles = !t.styles, this._styles.getTheme() || this._styles.setTheme(this.getTheme()), this._activeSheetOffset = 0, this.setView(new Qt()), this._listenerProtection?.(), this._protection = new en(void 0, this._options.readonly ?? !1), this._listenerProtection = this._protection.addListeners({ onChange: (e) => {
2195
+ n._emitter.notify("onProtectionChange");
2196
+ } });
2197
+ let n = this;
2198
+ this._transactionsRemoveListener = this._transactions.addStateListener(this._id, {
2199
+ async onAfterStateChange(e, t, r, i, a) {
2200
+ let o = n._view, s = a?.[gn], 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;
2201
+ d ? await d.sheet.select() : n._resyncActiveSheet(u, e), n._lastTransactionUUID = t.getId(), (r || i) && n._emitter.notify("onSheetsChange"), n._emitter.notify("onSelectedSheetChange"), n._emitter.notify("onViewChange");
2202
+ },
2203
+ onRestoreOrRevert() {
2204
+ n._ownCalculation, n._emitter.notify("onInvalidated");
2205
+ }
2206
+ });
2207
+ let r = this._getState();
2208
+ r?.listenersSheets && (r?.listenersSheets.forEach((e) => {
2209
+ e();
2210
+ }), r?.listenersSheets.clear()), this._updateState({
2211
+ sheetRefsAll: [],
2212
+ sheetRefsVisibleAndHidden: [],
2213
+ sheetRefsVisible: [],
2214
+ refsById: /* @__PURE__ */ new Map(),
2215
+ sheetsById: /* @__PURE__ */ new Map(),
2216
+ refsByLowerCaseName: /* @__PURE__ */ new Map(),
2217
+ sheetsByLowerCaseName: /* @__PURE__ */ new Map(),
2218
+ refsByInstance: /* @__PURE__ */ new Map(),
2219
+ lastId: -1,
2220
+ sheetsCreated: /* @__PURE__ */ new Set(),
2221
+ listenersSheets: /* @__PURE__ */ new Map()
2222
+ });
2223
+ }
2224
+ getId() {
2225
+ return this._id;
2226
+ }
2227
+ getVersionId() {
2228
+ return this._transactions.getVersionId(this._id);
2229
+ }
2230
+ getName() {
2231
+ return this._closed ? null : this._origin.getName();
2232
+ }
2233
+ getOrigin() {
2234
+ return this._originProvider.getOrigin();
2235
+ }
2236
+ _onOriginChange() {
2237
+ if (this._closed) return;
2238
+ let e = this._originProvider.getOrigin();
2239
+ if (e === this._origin) return;
2240
+ this._listenerOrigin?.();
2241
+ let t = this._lastOriginName;
2242
+ this._bindOrigin(e), this._emitter.notify("onOriginChange"), this._lastOriginName !== t && this._emitter.notify("onNameChange");
2243
+ }
2244
+ _bindOrigin(e) {
2245
+ this._origin = e, this._lastOriginName = e.getName(), this._listenerOrigin = e.addListeners({ onChange: () => {
2246
+ if (this._closed) return;
2247
+ let t = e.getName();
2248
+ t !== this._lastOriginName && (this._lastOriginName = t, this._emitter.notify("onNameChange"));
2249
+ } });
2250
+ }
2251
+ getView() {
2252
+ return this._view;
2253
+ }
2254
+ setView(e) {
2255
+ if (this._closed) throw Error(a("error.workbook.modelClosed"));
2256
+ if (!e) throw new o(a("error.sheet.emptyView"));
2257
+ this._listenerWorkbookView?.();
2258
+ let t = this, n = -1;
2259
+ return this._listenerWorkbookView = e.addListeners({ onViewChange: (e) => {
2260
+ let r = t._getState(), i = this._view.getActiveSheetId(), a = r.sheetRefsVisible, o = this._getOffsetForId(i, a);
2261
+ this._activeSheetOffset = o, t._emitter.notify("onViewChange"), n !== i && (t._emitter.notify("onSelectionChange"), t._emitter.notify("onSelectedSheetChange")), n = i;
2262
+ } }), this._view = e, t._emitter.notify("onViewChange"), this;
2263
+ }
2264
+ getRuntime() {
2265
+ return this._runtime;
2266
+ }
2267
+ setDate1904(e) {
2268
+ if (this._closed) throw Error(a("error.workbook.modelClosed"));
2269
+ return this._isDate1904 === e || (this._isDate1904 = e, this._emitter.notify("onRegionalChange")), this;
2270
+ }
2271
+ getLocale() {
2272
+ return this._runtime.getLocale();
2273
+ }
2274
+ getPinnedLocale() {
2275
+ return this._locale;
2276
+ }
2277
+ setLocale(e) {
2278
+ if (this._closed) throw Error(a("error.workbook.modelClosed"));
2279
+ if (e) try {
2280
+ new Intl.Locale(e);
2281
+ } catch {
2282
+ throw Error(a("error.workbook.invalidLocale", { locale: e }));
2283
+ }
2284
+ return this._locale === e || (this._locale = e, this._emitter.notify("onRegionalChange")), this;
2285
+ }
2286
+ getLocaleOverrides() {
2287
+ return this._localeOverrides;
2288
+ }
2289
+ setLocaleOverrides(e) {
2290
+ if (this._closed) throw Error(a("error.workbook.modelClosed"));
2291
+ let t = e && Object.keys(e).length > 0 ? e : null;
2292
+ return this._localeOverrides = t, this._emitter.notify("onRegionalChange"), this;
2293
+ }
2294
+ getStyles() {
2295
+ return this._styles;
2296
+ }
2297
+ getResources() {
2298
+ return this._resources;
2299
+ }
2300
+ getTransactions() {
2301
+ return this._transactions;
2302
+ }
2303
+ getChanges(e) {
2304
+ let t = this._transactions, [n, r] = t.getLog(e ?? t.getCurrentCommit(!1).getId(), 2), i = [], a = this.getWorksheets().getItems({ visibility: I.Visibility.VeryHidden });
2305
+ for (let e = 0; e < a.length; e++) {
2306
+ let t = a[e];
2307
+ t instanceof F && i.push(...t._changeEventsOf(n, r ?? null));
2308
+ }
2309
+ return i;
2310
+ }
2311
+ getStrings() {
2312
+ return this._strings;
2313
+ }
2314
+ getExternalBooks() {
2315
+ return this._calculation.getExternalBooks();
2316
+ }
2317
+ getUpdateLinks() {
2318
+ return this._updateLinks;
2319
+ }
2320
+ setUpdateLinks(e) {
2321
+ if (this._closed) throw Error(a("error.workbook.modelClosed"));
2322
+ return this._updateLinks = e, this;
2323
+ }
2324
+ getPivotTables() {
2325
+ return this._pivotTableCollection;
2326
+ }
2327
+ getComments() {
2328
+ return this._commentCollection;
2329
+ }
2330
+ getPeople() {
2331
+ return this._people;
2332
+ }
2333
+ getTheme() {
2334
+ return this._theme;
2335
+ }
2336
+ setTheme(e) {
2337
+ if (this._closed) throw Error(a("error.workbook.modelClosed"));
2338
+ if (!e) throw new o(a("error.workbook.notSetValue"));
2339
+ let t = this._theme;
2340
+ return this._theme = e, this.getStyles().setTheme(e), this._emitter.notify("onThemeChange"), t;
2341
+ }
2342
+ getSelectedSheetIndex() {
2343
+ return this._activeSheetOffset;
2344
+ }
2345
+ getSelectedSheet() {
2346
+ let e = this._getSheetRef(this.getSelectedSheetIndex());
2347
+ return e ? e.sheet : null;
2348
+ }
2349
+ getSelectedWorksheet() {
2350
+ let e = this._getSheetRef(this.getSelectedSheetIndex());
2351
+ return e && Q(e) ? e.sheet : null;
2352
+ }
2353
+ getActiveSheet() {
2354
+ return this.getSelectedWorksheet();
2355
+ }
2356
+ getActiveWorksheet() {
2357
+ return this.getSelectedWorksheet();
2358
+ }
2359
+ getSheets(e) {
2360
+ let t = this._getSheetRefs(e?.visibility ?? I.Visibility.Visible), n = Array(t.length);
2361
+ for (let e = 0; e < t.length; e++) n[e] = t[e].sheet;
2362
+ return n;
2363
+ }
2364
+ getSheet(e) {
2365
+ if (e === void 0) return this.getSelectedSheet();
2366
+ if (!e) throw Error(a("error.workbook.sheetNameNotProvided"));
2367
+ let t = this._getSheetRef(e);
2368
+ if (!t) throw new c(an(e));
2369
+ return t.sheet;
2370
+ }
2371
+ getWorksheet(e, t = I.Visibility.Visible) {
2372
+ if (typeof e == "number") return this.getWorksheetAt(e, t);
2373
+ if (e === void 0) return this._requireSelectedWorksheet();
2374
+ if (!e) throw Error(a("error.workbook.sheetNameNotProvided"));
2375
+ let n = this._getSheetRef(e, t);
2376
+ if (!n) throw new c(an(e));
2377
+ if (!Q(n)) throw new c(Y(n.name, n.sheet.getKind()));
2378
+ return n.sheet;
2379
+ }
2380
+ getWorksheetAt(e, t = I.Visibility.Visible) {
2381
+ let n = this._getWorksheets(t)[e];
2382
+ if (!n) throw new c(function(e) {
2383
+ return a("error.workbook.sheetIndexNotFound", { index: e });
2384
+ }(e));
2385
+ return n;
2386
+ }
2387
+ _requireSelectedWorksheet() {
2388
+ let e = this.getSelectedWorksheet();
2389
+ if (e) return e;
2390
+ let t = this.getSelectedSheet();
2391
+ throw new o(on(t?.getName() ?? "", t?.getKind() ?? I.Kind.Worksheet));
2392
+ }
2393
+ _anchorWorksheet() {
2394
+ return this.getSelectedWorksheet() || (this._getWorksheets(I.Visibility.VeryHidden)[0] ?? null);
2395
+ }
2396
+ getWorksheets() {
2397
+ return this._sheets;
2398
+ }
2399
+ addWorksheet(e) {
2400
+ return this.getWorksheets().add(e);
2401
+ }
2402
+ _getWorksheets(e = I.Visibility.Visible) {
2403
+ let t = this._getSheetRefs(e), n = [], r = t.length;
2404
+ for (let e = 0; e < r; e++) {
2405
+ let r = t[e];
2406
+ Q(r) && n.push(r.sheet);
2407
+ }
2408
+ return n;
2409
+ }
2410
+ _getSheetRefs(e = I.Visibility.Visible) {
2411
+ let t = this._getState();
2412
+ return t ? e === I.Visibility.Visible ? t.sheetRefsVisible : e === I.Visibility.Hidden ? t.sheetRefsVisibleAndHidden : e === I.Visibility.VeryHidden ? t.sheetRefsAll : n.EmptyArray : [];
2413
+ }
2414
+ _getSheetRef(e, t = I.Visibility.Visible) {
2415
+ let n = null;
2416
+ return typeof e == "number" ? this._getSheetRefs(t)[e] : (typeof e == "string" ? n = this._getState().refsByLowerCaseName.get(e.toLowerCase()) : !0 === e?.isISheet ? n = this._getState().refsByInstance.get(e) : e?.id !== void 0 && (n = this._getState().refsById.get(e.id)), n);
2417
+ }
2418
+ _validateNewSheetName(e, t = !0) {
2419
+ if (e == null) return e;
2420
+ if (fn(e), t && this._getState().sheetsByLowerCaseName.has(e.toLowerCase())) throw new o(a("error.workbook.nameTaken"));
2421
+ return e.substring(0, 31);
2422
+ }
2423
+ findValidSheetName(e) {
2424
+ e &&= fn(e, !0);
2425
+ try {
2426
+ return function(e, t) {
2427
+ try {
2428
+ if (t(e)) return e;
2429
+ } catch {}
2430
+ let n, r, i = ln.exec(e);
2431
+ for (i === null ? (n = e + " ", r = 1) : (n = e.substring(0, i.index), r = parseFloat(i[1])); r < 256;) {
2432
+ r++;
2433
+ let e = "(" + r + ")", i = n.substring(0, 31 - e.length) + e;
2434
+ try {
2435
+ if (t(i)) return i;
2436
+ } catch {}
2437
+ }
2438
+ throw Error(e + " is not a valid sheet name");
2439
+ }(e, (e) => this._validateNewSheetName(e));
2440
+ } catch {
2441
+ return this._nextSheetName();
2442
+ }
2443
+ }
2444
+ isValidSheetNameCharacter(e) {
2445
+ return !X.test(e);
2446
+ }
2447
+ _isStructureProtected() {
2448
+ return !this._initializing && !this.getProtection().isStructureAllowed();
2449
+ }
2450
+ _addSheetOptions(t) {
2451
+ if (this._closed) throw Error(a("error.workbook.modelClosed"));
2452
+ if (!this.getProtection().isStructureAllowed()) throw new e(a("error.workbook.protection"));
2453
+ let n, r = null;
2454
+ n = typeof t == "string" ? { name: t } : typeof t == "number" ? { index: t } : t, n = {
2455
+ ...n,
2456
+ description: n?.description ?? l("op.addSheet")
2457
+ };
2458
+ let i = this.beginCommit(n);
2459
+ try {
2460
+ let e = n?.autoSelect ?? !1;
2461
+ r = this._addSheet(!0, n.name, n.index ?? null);
2462
+ let t = this.getView().getActiveSheetId();
2463
+ if (e && this._recordActiveSheet(i, t, this._getSheetRef(r).id), i.commit({ description: a("op.addSheetNamed", { name: r.getName() }) }), !1 !== e) {
2464
+ let t = typeof e == "boolean" ? void 0 : e;
2465
+ r.select(t);
2466
+ }
2467
+ } catch (e) {
2468
+ throw i.rollback(), e;
2469
+ }
2470
+ return r;
2471
+ }
2472
+ _nextSheetName(e = null) {
2473
+ let t = e ? e.toLowerCase() : null, n = this._getState(), r = n.sheetsByLowerCaseName;
2474
+ if (e && r.has(t)) throw new o(function(e) {
2475
+ return a("error.workbook.nameDuplicate", { sheetName: e });
2476
+ }(e));
2477
+ t = (e = this._validateNewSheetName(e)) ? e.toLowerCase() : null;
2478
+ let i = n.lastId + 1;
2479
+ for (; !e;) {
2480
+ let t = this._createSheetName(i), n = t.toLowerCase();
2481
+ r.has(n) ? i++ : e = t;
2482
+ }
2483
+ return this._updateState({ lastId: i }), e;
2484
+ }
2485
+ _addSheet(e, t = null, n = null, r) {
2486
+ t = this._nextSheetName(t);
2487
+ let i = this._getState(), s = this._createSheet(i.lastId, t, I.Visibility.Visible, n, void 0, null, r);
2488
+ if (!s) throw new o(a("error.workbook.sheetNameBlank"));
2489
+ return e && (this._tellSheets(), this._emitter.notify("onSheetsChange")), s;
2490
+ }
2491
+ _createOpaqueSheet(e, t, r, i, a, o, s, c, l) {
2492
+ let u = this, d = null;
2493
+ return d = new Zt({
2494
+ kind: o,
2495
+ id: l ?? t + "-" + n.uuidV4(),
2496
+ part: s,
2497
+ tabColor: c,
2498
+ styles: this._styles,
2499
+ transactions: this._transactions,
2500
+ workbook: this,
2501
+ container: {
2502
+ getName: () => u._getSheetRef(d)?.name ?? t,
2503
+ setName: (e, t) => {
2504
+ u._setSheetName(d, e, t);
2505
+ },
2506
+ getVisibility: () => u._getSheetRef(d, I.Visibility.VeryHidden)?.visibility ?? I.Visibility.Visible,
2507
+ setVisibility: (e, t) => {
2508
+ u._setSheetVisibility(d, e, t);
2509
+ },
2510
+ getIndex: () => {
2511
+ let e = u._getSheetRef(d, I.Visibility.VeryHidden);
2512
+ return e ? u._getOffsetForId(e.id, u._getSheetRefs(I.Visibility.VeryHidden)) : -1;
2513
+ },
2514
+ setIndex: (e, t) => {
2515
+ let n = u._getSheetRef(d, I.Visibility.VeryHidden);
2516
+ n && u._moveSheet(n, e, t);
2517
+ },
2518
+ requestSelect: () => u._requestSelect(d),
2519
+ isAttached: () => !!u._getSheetRef(d, I.Visibility.VeryHidden)
2520
+ }
2521
+ }), this._sheetOnNameChange.set(e, () => d._notify("onNameChange")), this._sheetOnVisibilityChange.set(e, () => d._notify("onVisibilityChange")), this._sheetOnIndexChange.set(e, () => d._notify("onIndexChange")), this._addSheetRef({
2522
+ name: t,
2523
+ id: e,
2524
+ visibility: r ?? I.Visibility.Visible,
2525
+ sheetId: a,
2526
+ sheet: d
2527
+ }, i), d;
2528
+ }
2529
+ async _requestSelect(e) {
2530
+ return this._setSelectedSheet(e), await this._emitter.notify("onRequestSelect", {
2531
+ source: this,
2532
+ params: e,
2533
+ async: !0
2534
+ }), this.getSelectedSheet() === e;
2535
+ }
2536
+ _updateSheetRefStates(t) {
2537
+ if (this._closed) throw Error(a("error.workbook.modelClosed"));
2538
+ if (!this._initializing && !this.getProtection().isStructureAllowed()) throw new e(a("error.workbook.protection"));
2539
+ let n = t, r = [], i = [], o = n.length;
2540
+ for (let e = 0; e < o; e++) n[e].visibility === I.Visibility.Visible ? (r.push(n[e]), i.push(n[e])) : n[e].visibility === I.Visibility.Hidden && i.push(n[e]);
2541
+ this._updateState({
2542
+ sheetRefsAll: n,
2543
+ sheetRefsVisible: r,
2544
+ sheetRefsVisibleAndHidden: i
2545
+ });
2546
+ }
2547
+ _tellSheets() {
2548
+ if (this._isLoadingSheets) return;
2549
+ let e = this._getState().sheetRefsAll;
2550
+ this._calculation._setSheets(e.map((e) => Q(e) ? [e.sheet.getId(), e.name] : [
2551
+ e.sheet.getId(),
2552
+ e.name,
2553
+ !0
2554
+ ]));
2555
+ }
2556
+ _addSheetRef(e, t = null) {
2557
+ let n = this._getState(), r = n.sheetRefsAll, i = Math.max(0, Math.min(r.length, t ?? r.length)), o = [
2558
+ ...r.slice(0, i),
2559
+ e,
2560
+ ...r.slice(i)
2561
+ ];
2562
+ this._updateSheetRefStates(o);
2563
+ let s = e.sheet, c = e.name.toLowerCase(), l = new Map(n.refsById);
2564
+ l.set(e.id, e);
2565
+ let u = new Map(n.refsByLowerCaseName);
2566
+ u.set(c, e);
2567
+ let d = new Map(n.refsByInstance);
2568
+ d.set(s, e);
2569
+ let f = new Map(n.sheetsById);
2570
+ f.set(e.id, s);
2571
+ let p = new Map(n.sheetsByLowerCaseName);
2572
+ p.set(c, s);
2573
+ let m = this, h = n.listenersSheets;
2574
+ if (s !== void 0) {
2575
+ let t = s.addListeners({
2576
+ onBeforeDelete: (e) => {
2577
+ m._validateDeleteSheet(e);
2578
+ },
2579
+ onDelete(e) {
2580
+ let t = m._getSheetRef(e, I.Visibility.VeryHidden);
2581
+ if (!t) return;
2582
+ let n = m._beginCommit({ description: a("op.deleteSheet", { name: t.name }) });
2583
+ try {
2584
+ let r = m._getState(), i = r.sheetRefsAll, a = m._getOffsetForId(t.id, i), o = [...i];
2585
+ o.splice(a, 1), m._updateSheetRefStates(o);
2586
+ let c = new Map(r.refsById);
2587
+ c.delete(t.id);
2588
+ let l = new Map(r.sheetsById);
2589
+ l.delete(t.id);
2590
+ let u = t.name.toLowerCase(), d = new Map(r.refsByLowerCaseName);
2591
+ d.delete(u);
2592
+ let f = new Map(r.sheetsByLowerCaseName);
2593
+ f.delete(u);
2594
+ let p = new Map(r.refsByInstance);
2595
+ p.delete(e), r.listenersSheets.get(t.id)();
2596
+ let h = new Map(r.listenersSheets);
2597
+ h.delete(t.id), m._adjustRemoveSelectionIfRequired(a, t.id), m._adjustSheetNamesIfRequired(), m._sheetOnNameChange.delete(t.id), m._sheetOnVisibilityChange.delete(t.id), m._sheetOnIndexChange.delete(t.id), m._tellSheets(), m._emitter.notify("onSheetsChange");
2598
+ let g = new Set(r.sheetsCreated);
2599
+ g.has(s) && g.delete(s), m._updateState({
2600
+ refsById: c,
2601
+ sheetsById: l,
2602
+ refsByLowerCaseName: d,
2603
+ sheetsByLowerCaseName: f,
2604
+ refsByInstance: p,
2605
+ sheetsCreated: g,
2606
+ listenersSheets: h
2607
+ }), n.commit();
2608
+ } catch (e) {
2609
+ throw n.rollback(), e;
2610
+ }
2611
+ }
2612
+ }, { transactional: !0 }), r = Q(e) ? e.sheet.addListeners({ onSelectionChange: (e) => {
2613
+ m.getView().getActiveSheetId() === m._getSheetRef(e)?.id && m._emitter.notify("onSelectionChange", {
2614
+ source: m,
2615
+ params: e
2616
+ });
2617
+ } }, { transactional: !1 }) : null;
2618
+ h = new Map(n.listenersSheets), h.set(e.id, () => {
2619
+ t(), r?.();
2620
+ });
2621
+ }
2622
+ let g = n.lastId;
2623
+ g !== -1 && (g = Math.max(g, e.id)), this._updateState({ lastId: g }), this._updateState({
2624
+ refsById: l,
2625
+ refsByLowerCaseName: u,
2626
+ refsByInstance: d,
2627
+ sheetsById: f,
2628
+ sheetsByLowerCaseName: p,
2629
+ listenersSheets: h
2630
+ }), this._adjustSheetNamesIfRequired();
2631
+ let _ = new Set(this._getState().sheetsCreated);
2632
+ return _.add(e.sheet), this._updateState({ sheetsCreated: _ }), this._tellSheets(), e;
2633
+ }
2634
+ _recordActiveSheet(e, t, n) {
2635
+ let r = this.getView().getId();
2636
+ e.setIntent(gn, (e) => ({
2637
+ viewId: r,
2638
+ before: e?.before ?? t,
2639
+ after: n
2640
+ }));
2641
+ }
2642
+ _resyncActiveSheet(e, t) {
2643
+ let n = t?.sheetRefsVisible;
2644
+ if (!n?.length) return;
2645
+ let r = -1, i = n.length;
2646
+ for (let t = 0; t < i; t++) if (n[t].id === e) {
2647
+ r = t;
2648
+ break;
2649
+ }
2650
+ r === -1 && (r = Math.min(Math.max(this._activeSheetOffset, 0), i - 1));
2651
+ let a = n[r].id;
2652
+ this._view.getActiveSheetId() === a ? this._activeSheetOffset = r : this._view.setActiveSheetId(a);
2653
+ }
2654
+ _adjustRemoveSelectionIfRequired(e, t) {
2655
+ if (this._view.getActiveSheetId() === t) {
2656
+ let t, n = this._getState().sheetRefsVisible;
2657
+ t = e < n.length ? n[e].id : n[e - 1].id, this._view.setActiveSheetId(t);
2658
+ }
2659
+ }
2660
+ _adjustSheetNamesIfRequired() {
2661
+ let e = this._getState(), t = e.lastId;
2662
+ if (t === -1) return;
2663
+ let n = this._view.getActiveSheetId();
2664
+ n ??= (this._view.setActiveSheetId(t), t);
2665
+ let r = e.refsById.get(n);
2666
+ r || (this._view.setActiveSheetId(t), r = e.refsById.get(t), n = t), r.visibility === I.Visibility.Visible && (this._activeSheetOffset = this._getOffsetForId(n, e.sheetRefsVisible));
2667
+ }
2668
+ _validateDeleteSheet(t) {
2669
+ if (this._closed) throw Error(a("error.workbook.modelClosed"));
2670
+ if (!this.getProtection().isStructureAllowed()) throw new e(a("error.workbook.protection"));
2671
+ let n = this._getSheetRef(t);
2672
+ if (!n) throw new o(function(e) {
2673
+ return a("error.workbook.deleteKey", { key: e });
2674
+ }(t));
2675
+ let r = this._getState().sheetRefsVisible;
2676
+ if (r.length === 1 && r[0].id === n.id) throw new o(a("error.workbook.sheetOne"));
2677
+ }
2678
+ _getOffsetForId(e, t) {
2679
+ let n = t.length;
2680
+ for (let r = 0; r < n; r++) if (t[r].id === e) return r;
2681
+ throw new o(a("error.workbook.noVisibleRefs"));
2682
+ }
2683
+ find(e) {
2684
+ if (this._closed) throw Error(a("error.workbook.modelClosed"));
2685
+ let t = this._getWorksheets();
2686
+ if (t.length === 0) return { next: () => Ve };
2687
+ if (t.length === 1) return t[0].find(e);
2688
+ typeof e == "string" && (e = { text: e });
2689
+ let n = !e?.reverse, r = e?.disableWrap ?? !1, i = this._worksheetOffsetFrom(this.getSelectedSheetIndex(), t), o = i, s = t[o], c = !1;
2690
+ e = {
2691
+ ...e,
2692
+ disableWrap: !0
2693
+ };
2694
+ let l, u = s.find(e), d = u.next(), p = !1;
2695
+ if (e?.from) {
2696
+ let t = this._rangesAddressToCoords(e?.from);
2697
+ l = {
2698
+ colIndex: t[0].colStart,
2699
+ rowIndex: t[0].rowStart
2700
+ };
2701
+ }
2702
+ let m = f.createCellComparator(e?.axis, e?.reverse);
2703
+ delete (e = { ...e }).from;
2704
+ let h = () => {
2705
+ if (!p && d.done && (c && o === i ? p = !0 : n ? (o++, o > t.length - 1 && (o = 0, c = !0)) : (o--, o < 0 && (o = t.length - 1, c = !0)), r && c && (p = !0), p || l || !c || o !== i || (p = !0), !p)) {
2706
+ s = t[o], u = s.find(e);
2707
+ let n = d;
2708
+ return d = u.next(), n;
2709
+ }
2710
+ if (!p && c && o === i && (d.done || !l || !d.done && m(d.value.getCoords(), l) >= 0) && (p = !0), p) {
2711
+ let e = d;
2712
+ return d = Ve, e;
2713
+ }
2714
+ let a = d;
2715
+ return d = u.next(), a;
2716
+ };
2717
+ return { next: () => {
2718
+ let e = h();
2719
+ for (; !p && e.done;) e = h();
2720
+ return e;
2721
+ } };
2722
+ }
2723
+ replace(e, t, n) {
2724
+ let r = 0, i = null, o = typeof t == "function", s = n?.maxCount ?? 2 ** 53 - 1, c = !n?.maxCount, u = "", d = typeof t == "string" ? Fe(t) : null, f = n?.description ?? l("op.replace"), p = this._transactions.beginCommit({ description: f });
2725
+ try {
2726
+ let f = null, m = null, h = e.next();
2727
+ for (; !h.done && r < s;) {
2728
+ let a = h.value, s = a.getWorksheet();
2729
+ s !== f && (f = s, m !== null && m.apply(), m = f.getEntireRange().createSparseBuilder({
2730
+ axis: n?.axis,
2731
+ allowUnorderedWrites: !0
2732
+ }));
2733
+ let c = o ? t(a) : t;
2734
+ c !== void 0 && c !== a && (m.push(a, c), r++, i = a), h = e.next();
2735
+ }
2736
+ m?.apply(), r === 1 && s === 1 && i && (u = i.getAddress()), r === 0 ? p.rollback() : p.commit({ description: n?.description ?? (c ? d === null ? l("op.replaceAll") : a("op.replaceAllWith", { value: d }) : u ? d === null ? a("op.replaceAt", { address: u }) : a("op.replaceAtWith", {
2737
+ address: u,
2738
+ value: d
2739
+ }) : d === null ? l("op.replace") : a("op.replaceWith", { value: d })) });
2740
+ } catch (e) {
2741
+ throw p.rollback(), e;
2742
+ }
2743
+ return {
2744
+ count: r,
2745
+ last: i
2746
+ };
2747
+ }
2748
+ _nextSheetIndex(e, t = this._getSheetRefs()) {
2749
+ let n = t.length;
2750
+ return n === 1 ? 0 : (e === void 0 && (e = this.getSelectedSheetIndex()), (e = Math.max(0, Math.min(e, n - 1))) >= n - 1 ? 0 : e + 1);
2751
+ }
2752
+ _prevSheetIndex(e, t = this._getSheetRefs()) {
2753
+ let n = t.length;
2754
+ return n === 1 ? 0 : (e === void 0 && (e = this.getSelectedSheetIndex()), (e = Math.max(0, Math.min(e, n - 1))) <= 0 ? n - 1 : e - 1);
2755
+ }
2756
+ _worksheetOffsetFrom(e, t) {
2757
+ let n = this._getSheetRefs(), r = n.length;
2758
+ for (let i = 0; i < r; i++) {
2759
+ let a = n[(e + i) % r];
2760
+ if (!Q(a)) continue;
2761
+ let o = t.indexOf(a.sheet);
2762
+ if (o !== -1) return o;
2763
+ }
2764
+ return 0;
2765
+ }
2766
+ getNextSheet(e) {
2767
+ if (this._closed) throw Error(a("error.workbook.modelClosed"));
2768
+ let t = this._getSheetRefs();
2769
+ return t[this._nextSheetIndex(e, t)]?.sheet ?? null;
2770
+ }
2771
+ getPreviousSheet(e) {
2772
+ if (this._closed) throw Error(a("error.workbook.modelClosed"));
2773
+ let t = this._getSheetRefs();
2774
+ return t[this._prevSheetIndex(e, t)]?.sheet ?? null;
2775
+ }
2776
+ async _duplicateSheet(t) {
2777
+ if (this._closed) throw Error(a("error.workbook.modelClosed"));
2778
+ if (!this.getProtection().isStructureAllowed()) throw new e(a("error.workbook.protection"));
2779
+ let n = this._getSheetRefs(), r = this.getSelectedSheetIndex(), i = null;
2780
+ if (t) {
2781
+ if (i = this._getSheetRef(t), !i) throw new o(J(i));
2782
+ } else i = n[r];
2783
+ if (!i) return null;
2784
+ if (!Q(i)) throw new o((s = i.name, a("error.workbook.sheetNotDuplicable", { sheetName: s })));
2785
+ var s;
2786
+ let c = i.sheet, l = this._strings.beginPersist(), u = this.getResources().beginPersist(), d = this.getStyles().beginPersist(), f = null, p = this.beginCommit(a("op.duplicateNamed", { name: c.getName() }));
2787
+ try {
2788
+ let e = this._getState().refsByInstance.get(c), t = await c.toJSON(), i = n.length + 1, a = this.findValidSheetName(e.name), o = this._createSheet(i, a, e.visibility, r, void 0, t);
2789
+ this._tellSheets(), this._emitter.notify("onSheetsChange"), f = o, p.commit();
2790
+ } catch (e) {
2791
+ throw p.rollback(), e;
2792
+ } finally {
2793
+ d.endPersist(), u.endPersist(), l.endPersist();
2794
+ }
2795
+ return f;
2796
+ }
2797
+ _createRange(e, t) {
2798
+ let n = e ? { ...e } : null, r = n ? this._getSheetRef(n.scope, I.Visibility.VeryHidden) : null;
2799
+ if (r && !Q(r)) throw new o(Y(r.name, r.sheet.getKind()));
2800
+ if (!r) {
2801
+ let e = this._anchorWorksheet();
2802
+ return e ? (delete n?.scope, dn(n, n ? {
2803
+ scope: Ae,
2804
+ ...e.getEntireRange().getCoords()
2805
+ } : null)) : void console.warn(a("error.workbook.noVisibleRefs"));
2806
+ }
2807
+ let i = r.sheet, s = null;
2808
+ return t && (s = { getOptions: t }), new _n(e, L(i), this, s);
2809
+ }
2810
+ _createRanges(e, t) {
2811
+ let n = this._anchorWorksheet();
2812
+ if (!n) throw new o(on("", I.Kind.Worksheet));
2813
+ let r = null;
2814
+ return t && (r = { getOptions: t }), new Z(e, L(n), this, r);
2815
+ }
2816
+ getRange(e, t) {
2817
+ if (e === void 0) return this.getSelectedRange(t);
2818
+ try {
2819
+ let n = this._rangesAddressToCoords(e);
2820
+ if (n.length !== 1) throw new o(a("error.address.singleRangeOnlyAlt"));
2821
+ return this._createRange(n[0], t);
2822
+ } catch (t) {
2823
+ throw t instanceof c ? new c(t.message) : new o(t.message ?? ge(e));
2824
+ }
2825
+ }
2826
+ getCell(e) {
2827
+ if (e === void 0) return this.getSelectedCell();
2828
+ let t = this.getRange(e);
2829
+ if (t.size > 1) throw new o(a("error.address.singleCellOnly"));
2830
+ return t.getCell();
2831
+ }
2832
+ getRanges(e, t) {
2833
+ let n = this._rangesAddressToCoords(e);
2834
+ if (n.length === 0) throw new o(ge(e));
2835
+ return this._createRanges(n, t);
2836
+ }
2837
+ _createGraphRanges(e, t) {
2838
+ let n = [], r = this.getCalculation()?.getNamedFormulas() ?? null;
2839
+ for (let e = 0; e < t.length; e++) {
2840
+ let i = t[e], a = i.sheetName ? this._getSheetRef(i.sheetName, I.Visibility.VeryHidden) : null, o = a && Q(a) ? a.sheet : this._anchorWorksheet();
2841
+ o && n.push(new Be(i, r, L(o), null));
2842
+ }
2843
+ for (let t = 0; t < e.length; t++) n.push(e[t]);
2844
+ let i = this._anchorWorksheet();
2845
+ return n.length !== 0 && i ? new Z(n, L(i), this, null) : null;
2846
+ }
2847
+ getAnomalies(e) {
2848
+ if (this._closed) throw Error(a("error.workbook.modelClosed"));
2849
+ let t = it(e), n = this._getWorksheets(I.Visibility.VeryHidden).map((e) => {
2850
+ let t = L(e);
2851
+ return {
2852
+ bounds: t.getSheet().getEntireCoords(),
2853
+ internal: t,
2854
+ qualified: !0
2855
+ };
2856
+ });
2857
+ return new Je(n, () => (this.getSelectedWorksheet() ?? this._getWorksheets(I.Visibility.VeryHidden)[0]).getEntireRange(), t);
2858
+ }
2859
+ getStats(e) {
2860
+ if (this._closed) throw Error(a("error.workbook.modelClosed"));
2861
+ let t = this._getWorksheets(I.Visibility.VeryHidden), n = t.length;
2862
+ if (n === 1) return t[0].getStats(e);
2863
+ let r = Array(n);
2864
+ for (let i = 0; i < n; i++) r[i] = t[i].getStats(e);
2865
+ return new Vt(r);
2866
+ }
2867
+ _activeRangeCoords() {
2868
+ let e = this._requireSelectedWorksheet(), t = e.getSelection().getRanges().getCoords(), n = e.getName(), r = t.length, i = Array(r);
2869
+ for (let e = 0; e < r; e++) {
2870
+ let r = t[e];
2871
+ i[e] = {
2872
+ colStart: r.colStart,
2873
+ colEnd: r.colEnd,
2874
+ rowStart: r.rowStart,
2875
+ rowEnd: r.rowEnd,
2876
+ scope: n
2877
+ };
2878
+ }
2879
+ return i;
2880
+ }
2881
+ getSelectedRange(e) {
2882
+ return this.getRange(this._activeRangeCoords()[0], e);
2883
+ }
2884
+ getSelectedRanges(e) {
2885
+ return this.getRanges(this._activeRangeCoords(), e);
2886
+ }
2887
+ getSelectedCell() {
2888
+ return this._requireSelectedWorksheet().getSelectedCell();
2889
+ }
2890
+ _rangesAddressToCoords(e, t = !0, n = I.Visibility.Hidden) {
2891
+ if (!e) throw new o(a("error.address.noAddress"));
2892
+ let r = this.getSelectedWorksheet(), i = { ...(r ?? this._anchorWorksheet())?.getEntireRange().getCoords() }, s = r?.getName();
2893
+ if (s && (i.scope = s), typeof e == "string") {
2894
+ let t = e.trim().toLowerCase();
2895
+ if (t === "r" || t === "c") {
2896
+ let n = this.getSelectedCell().getCoords(), r = {};
2897
+ t === "r" ? r.rowStart = r.rowEnd = n.rowIndex : r.colStart = r.colEnd = n.colIndex, e = r;
2898
+ }
2899
+ }
2900
+ let c = this, l = fe(e, i, $e, (e) => {
2901
+ if (!t) return null;
2902
+ if (typeof e == "string") {
2903
+ let t = Ee(e, {
2904
+ getTable: (e) => me(c.getNames().getByName(e)),
2905
+ getAnchor: () => r ? {
2906
+ sheet: r,
2907
+ coords: r.getSelectedCell().getCoords()
2908
+ } : null
2909
+ });
2910
+ if (t) return [t];
2911
+ let n = c.getNames().getByName(e)?.getRanges?.();
2912
+ if (n) return n.getCoords();
2913
+ }
2914
+ throw new o(`Invalid sheet reference '${e}'.`);
2915
+ }), u = l.length;
2916
+ for (let e = 0; e < u; e++) this._validateCoords(l[e], n);
2917
+ return l;
2918
+ }
2919
+ _validateCoords(e, t = I.Visibility.Visible, n = a("error.sheet.oobRange")) {
2920
+ if (e === null) return;
2921
+ let r = this.getWorksheet(e.scope ?? void 0, t).getEntireRange().getCoords();
2922
+ if (!f.isRangeWithinRange(e, r)) throw new c(n);
2923
+ if (e.rowEnd < e.rowStart || e.colEnd < e.colStart) throw new o(a("error.address.invalidRangeInverted"));
2924
+ }
2925
+ _updateSheetRef(e, t) {
2926
+ let n = this._getState(), r = [...n.sheetRefsAll];
2927
+ r[this._getOffsetForId(e.id, n.sheetRefsAll)] = t, this._updateSheetRefStates(r);
2928
+ let i = new Map(n.refsById);
2929
+ i.set(e.id, t);
2930
+ let a = e.name.toLowerCase(), o = t.name.toLowerCase(), s = new Map(n.refsByLowerCaseName);
2931
+ s.delete(a), s.set(o, t);
2932
+ let c = new Map(n.sheetsByLowerCaseName), l = c.get(a);
2933
+ c.delete(a), c.set(o, l);
2934
+ let u = new Map(n.refsByInstance);
2935
+ return u.set(l, t), this._updateState({
2936
+ refsById: i,
2937
+ refsByLowerCaseName: s,
2938
+ sheetsByLowerCaseName: c,
2939
+ refsByInstance: u
2940
+ }), this._tellSheets(), t;
2941
+ }
2942
+ _setSheetName(t, n, r) {
2943
+ if (this._closed) throw Error(a("error.workbook.modelClosed"));
2944
+ if (!this.getProtection().isStructureAllowed()) throw new e(a("error.workbook.protection"));
2945
+ let i = this._getSheetRef(t);
2946
+ if (!i) throw new o(J(t));
2947
+ if (n === i.name) return i.sheet;
2948
+ if ((n = this._validateNewSheetName(n)) == null) throw new o(a("error.workbook.sheetNameNotProvided"));
2949
+ let s = Object.freeze({
2950
+ ...i,
2951
+ name: n
2952
+ }), c = null, u = this.beginCommit(l("op.renameSheet"));
2953
+ try {
2954
+ let e = this._updateSheetRef(i, s);
2955
+ this._adjustSheetNamesIfRequired(), this._sheetOnNameChange.forEach((e, t) => {
2956
+ i.id === t && e();
2957
+ }), this._emitter.notify("onSheetsChange"), i.id === this.getView().getActiveSheetId() && this._emitter.notify("onSelectionChange"), c = e.sheet, u.commit(r);
2958
+ } catch (e) {
2959
+ throw u.rollback(), e;
2960
+ }
2961
+ return c;
2962
+ }
2963
+ _setSheetVisibility(t, n = I.Visibility.Visible, r) {
2964
+ if (this._closed) throw Error(a("error.workbook.modelClosed"));
2965
+ if (!this.getProtection().isStructureAllowed()) throw new e(a("error.workbook.protection"));
2966
+ let i = this._getSheetRef(t, I.Visibility.VeryHidden);
2967
+ if (!i) return null;
2968
+ if (n === i.visibility) return;
2969
+ let s = null, c = "";
2970
+ n === I.Visibility.Visible ? c = l("op.unhideSheet") : n === I.Visibility.Hidden ? c = l("op.hideSheet") : n === I.Visibility.VeryHidden && (c = l("op.veryHideSheet"));
2971
+ let u = this.beginCommit(c);
2972
+ try {
2973
+ let e = this._getState().sheetRefsVisible;
2974
+ if (n !== I.Visibility.Visible && e.length === 1 && e[0].id === i.id) throw new o(a("error.workbook.sheetOne"));
2975
+ let t = {
2976
+ ...i,
2977
+ visibility: n
2978
+ }, c = -1;
2979
+ n !== I.Visibility.Visible && (c = this._getOffsetForId(i.id, e)), s = this._updateSheetRef(i, t).sheet, n !== I.Visibility.Visible && this._adjustRemoveSelectionIfRequired(c, i.id), this._adjustSheetNamesIfRequired(), u.commit(r);
2980
+ } catch (e) {
2981
+ throw u.rollback(), e;
2982
+ }
2983
+ return this._sheetOnVisibilityChange.forEach((e, t) => {
2984
+ i.id === t && e();
2985
+ }), this._emitter.notify("onSheetsChange"), s;
2986
+ }
2987
+ _moveSheet(t, n, r) {
2988
+ if (this._closed) throw Error(a("error.workbook.modelClosed"));
2989
+ if (!this.getProtection().isStructureAllowed()) throw new e(a("error.workbook.protection"));
2990
+ let i = null, s = this.beginCommit(a("op.moveSheetNamed", { name: t.name }));
2991
+ try {
2992
+ let e = this._getState(), a = e.sheetRefsVisible;
2993
+ if (n < 0 || n > a.length - 1) throw new o(`Invalid to index: ${n}`);
2994
+ let c = this.getView().getActiveSheetId(), l = e.sheetRefsAll, u = this._getOffsetForId(t.id, l), d = this._getOffsetForId(a[n].id, l);
2995
+ if (u === d) return;
2996
+ let f = l[u], p = [...l];
2997
+ 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) => {
2998
+ t >= u && t <= d && e();
2999
+ }), this._tellSheets(), this._emitter.notify("onSheetsChange"), i = f.sheet, this._recordActiveSheet(s, c, this.getView().getActiveSheetId()), s.commit(r);
3000
+ } catch (e) {
3001
+ throw s.rollback(), e;
3002
+ }
3003
+ return i;
3004
+ }
3005
+ _setSelectedSheet(e) {
3006
+ if (this._closed) throw Error(a("error.workbook.modelClosed"));
3007
+ let t = this._getSheetRef(e);
3008
+ if (!t) throw new o(J(e));
3009
+ let n = null;
3010
+ return t.visibility !== I.Visibility.Visible && this._setSheetVisibility(t, I.Visibility.Visible), this._view.setActiveSheetId(t.id), n = t.sheet, n;
3011
+ }
3012
+ getProtection() {
3013
+ return this._protection;
3014
+ }
3015
+ getProperties() {
3016
+ return this._documentProperties;
3017
+ }
3018
+ getCodeName() {
3019
+ return this._codeName;
3020
+ }
3021
+ getNames() {
3022
+ return this._names;
3023
+ }
3024
+ getCalculation() {
3025
+ return this._calculation;
3026
+ }
3027
+ getFonts() {
3028
+ return ye.getShared();
3029
+ }
3030
+ createFormula(e, t, n) {
3031
+ return this.getCalculation().createFormula(e, t, n);
3032
+ }
3033
+ evaluate(e, t) {
3034
+ return this.getCalculation().evaluate(e, t);
3035
+ }
3036
+ async whenCalculationReady() {
3037
+ let e = this._starting;
3038
+ return e ? e.then(() => this.getCalculation().ready()) : this.getCalculation().ready();
3039
+ }
3040
+ whenFontsReady() {
3041
+ return this.getFonts().whenReady();
3042
+ }
3043
+ async whenReady() {
3044
+ await Promise.all([this.whenCalculationReady(), this.whenFontsReady()]);
3045
+ }
3046
+ getScripts() {
3047
+ return this._scripts ||= this._createScripts(), this._scripts;
3048
+ }
3049
+ getModules() {
3050
+ return this.getScripts().getModules();
3051
+ }
3052
+ _notifyAllChange() {
3053
+ this._emitter.notify("onSheetsChange"), this._emitter.notify("onSelectedSheetChange"), this._emitter.notify("onViewChange");
3054
+ }
3055
+ addListeners(e, t) {
3056
+ return this._emitter.addListeners(e, t);
3057
+ }
3058
+ _sheetToWBEvent(e) {
3059
+ let t = this;
3060
+ return (n) => {
3061
+ let r = () => {
3062
+ let e = n.getSource();
3063
+ if (e.isInvalid()) return e;
3064
+ if (e.isICellRanges) {
3065
+ let n = [...e.getCoords()], r = n.length;
3066
+ for (let t = 0; t < r; t++) {
3067
+ let r = n[t];
3068
+ !r.scope && e.getWorksheet().getName() && (n[t] = {
3069
+ ...r,
3070
+ scope: e.getWorksheet().getName()
3071
+ });
3072
+ }
3073
+ return t.getRanges(n);
3074
+ }
3075
+ if (e.isICellRange) {
3076
+ let n = e.getCoords(), r = e.getWorksheet().getName();
3077
+ return t.getRange({
3078
+ ...n,
3079
+ scope: r
3080
+ });
3081
+ }
3082
+ };
3083
+ e({
3084
+ getSource: r,
3085
+ trigger: n.trigger,
3086
+ getFrom: () => t.getRanges(n.getFrom()),
3087
+ isDataChange: n.isDataChange,
3088
+ getTransactionId: n.getTransactionId,
3089
+ isUndo: n.isUndo,
3090
+ toString: () => `WorkbookRangeEvent: ('${n.trigger}', ${r().toString()})`,
3091
+ timeStamp: Date.now()
3092
+ });
3093
+ };
3094
+ }
3095
+ _holdPivotCaches() {
3096
+ let e = this._pivotCaches;
3097
+ if (e.length === 0) return;
3098
+ let t = (e) => {
3099
+ let t = this._getSheetRef(e), n = t && Q(t) ? t.sheet : null;
3100
+ return n ? n._contentAddWatch(() => null) : null;
3101
+ };
3102
+ for (let n = 0; n < e.length; n++) e[n]._hold(t);
3103
+ }
3104
+ _fromJSON(e, t) {
3105
+ if (this._emitter.notify("onBeforeLoad", { params: e }), this._initState(), !e.sheets || e.sheets.length === 0) throw new o(a("error.workbook.sheetOne"));
3106
+ e.theme && (this._theme = new nt(e.theme), this._styles.setTheme(this._theme));
3107
+ let n = this._strings.beginPersist(), r = this._resources.beginPersist(), i = this._styles.beginPersist();
3108
+ try {
3109
+ 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, this._documentProperties.fromJSON(e.properties), e.locale && (this._locale = e.locale), e.localeOverrides && (this._localeOverrides = e.localeOverrides), e.view ||= {};
3110
+ let s = [], c = e.pivotCaches;
3111
+ if (c) {
3112
+ let e = r.fromResourceId.bind(r);
3113
+ for (let t = 0; t < c.length; t++) {
3114
+ let n = c[t];
3115
+ n && typeof n.cacheId == "number" && s.push(new Wt(n.cacheId, j.fromJSON(n.part, e)));
3116
+ }
3117
+ }
3118
+ this._pivotCaches = s, this._people.fromJSON(e.people);
3119
+ let l = e.sheets, u = l.length, d = e.view.activeSheetId ?? null;
3120
+ d !== null && (d = Math.min(Math.max(0, d), u - 1));
3121
+ let f = null, p = null;
3122
+ this._isLoadingSheets = !0;
3123
+ for (let e = 0; e < u; e++) {
3124
+ let n = l[e], i = n.visibility || I.Visibility.Visible, s = e;
3125
+ p = s, i === I.Visibility.Visible ? f === null && (f = s) : d !== null && d === s && (d = null);
3126
+ try {
3127
+ let c = n.kind ?? I.Kind.Worksheet;
3128
+ if (c !== I.Kind.Worksheet) {
3129
+ let l = n.sheet, u = j.fromJSON(l?.part, r.fromResourceId.bind(r));
3130
+ if (!u) throw new o(a("error.workbook.sheetPartMissing", { sheetName: n.name }));
3131
+ this._createOpaqueSheet(s, n.name, i, e, n.sheetId, c, u, l?.tabColor ?? null, t?.[e]);
3132
+ } else this._createSheet(s, n.name, i, e, n.sheetId, n.sheet, t?.[e]);
3133
+ } catch (e) {
3134
+ throw this._isLoadingSheets = !1, e;
3135
+ }
3136
+ }
3137
+ this._isLoadingSheets = !1, this._tellSheets(), this._holdPivotCaches(), this._updateState({ lastId: p }), e.view.activeSheetId = d ?? f, this.setView(new Qt({ json: e.view })), this._adjustSheetNamesIfRequired(), this._listenerProtection?.();
3138
+ let m = this;
3139
+ this._protection = new en(e?.protection, this._options?.readonly), this._listenerProtection = this._protection.addListeners({ onChange: (e) => {
3140
+ m._emitter.notify("onProtectionChange", { source: e });
3141
+ } }), this._emitter.notify("onLoad");
3142
+ } finally {
3143
+ i.endPersist(), r.endPersist(), n.endPersist();
3144
+ }
3145
+ }
3146
+ _createScripts(e) {
3147
+ let t = this;
3148
+ return new qt({
3149
+ transactions: this._transactions,
3150
+ json: e,
3151
+ workbook: t,
3152
+ getBuiltInFunctions: () => t._calculation?.getFunctions(),
3153
+ onAdd: (e, n) => {
3154
+ let r = t._calculation;
3155
+ r.getStatus() !== ze.Status.Off && r.start().then(async () => {
3156
+ let e = n.getFunctions().getItems({
3157
+ type: "formula",
3158
+ includeHidden: !0
3159
+ }), t = e.length;
3160
+ for (let n = 0; n < t; n++) {
3161
+ let t = e[n];
3162
+ try {
3163
+ await this._calculation.getFunctions().add(t);
3164
+ } catch (e) {
3165
+ m.error(e?.message ?? String(e), e);
3166
+ }
3167
+ }
3168
+ }).catch(() => {});
3169
+ },
3170
+ onRemove: (e, t) => {}
3171
+ });
3172
+ }
3173
+ async toJSON(e) {
3174
+ if (this._closed) throw Error(a("error.workbook.modelClosed"));
3175
+ await Promise.resolve(this._starting);
3176
+ let t = this.getCalculation();
3177
+ t.getStatus() !== ze.Status.Off && (await t.ready(), await t._whenRequestsSettled?.()), await this._emitter.notify("onBeforeSave", { async: !0 });
3178
+ let n = { sheets: [] }, r = e?.ignoreStyles ?? !1;
3179
+ if (!r) {
3180
+ let e = this._theme.toJSON();
3181
+ (e ? Object.keys(e).length : 0) > 0 && (n.theme = e);
3182
+ }
3183
+ if (this._scripts) {
3184
+ let e = this._scripts.toJSON();
3185
+ e && Object.keys(e).length > 0 && (n.modules = e);
3186
+ }
3187
+ this._isDate1904 && (n.date1904 = !0), this._codeName && (n.codeName = this._codeName), this._updateLinks && (n.updateLinks = this._updateLinks);
3188
+ let i = this._documentProperties.toJSON();
3189
+ Object.keys(i).length > 0 && (n.properties = i), this._locale && (n.locale = this._locale), this._localeOverrides && (n.localeOverrides = this._localeOverrides);
3190
+ let o = e?.resources ?? "embed", s = o === "ignore", c = this._strings.beginPersist(), l = s ? null : this._resources.beginPersist(), u = this._styles.beginPersist();
3191
+ try {
3192
+ let t = this._getSheetRef(this.getSelectedSheetIndex()).id, i = t, a = null, d = this._getState(), f = d.sheetRefsAll, p = d.sheetsById, m = f.length;
3193
+ for (let r = 0; r < m; r++) {
3194
+ let o, s = f[r], c = r + 1, u = p.get(s.id);
3195
+ if (Q(s)) o = {
3196
+ name: s.name,
3197
+ sheet: await s.sheet.toJSON(e)
3198
+ };
3199
+ else {
3200
+ let e = u, t = l ? l.toResourceId.bind(l) : () => null, n = { part: j.toJSON(e._getPart(), t) }, r = e.getTabColor();
3201
+ r && (n.tabColor = r.toString()), o = {
3202
+ name: s.name,
3203
+ kind: e.getKind(),
3204
+ sheet: n
3205
+ };
3206
+ }
3207
+ s.sheetId !== void 0 && (o.sheetId = s.sheetId), s.visibility === I.Visibility.Visible ? a === null && (a = c) : o.visibility = s.visibility, s.id === t && (i = c), n.sheets.push(o);
3208
+ }
3209
+ if (!r) {
3210
+ let e = u.toJSON();
3211
+ e && Object.keys(e).length > 0 && (n.styles = e);
3212
+ }
3213
+ let h = this.getProtection().toJSON();
3214
+ h && (n.protection = h);
3215
+ let g = this._calculation.toJSON();
3216
+ Object.keys(g).length > 0 && (n.calc = g);
3217
+ let _ = await c.toJSONAsync();
3218
+ _ && _.length > 0 && (n.strings = _);
3219
+ let v = this._calculation.getExternalBooks().toJSON();
3220
+ v && (n.externalBooks = v);
3221
+ let y = this._pivotCaches;
3222
+ if (y.length > 0) {
3223
+ let e = l ? l.toResourceId.bind(l) : () => null, t = /* @__PURE__ */ new Set();
3224
+ for (let e of this.getPivotTables()) t.add(e.getCacheId());
3225
+ let r = [];
3226
+ for (let n = 0; n < y.length; n++) t.has(y[n].cacheId) && r.push(y[n].toJSON(e));
3227
+ r.length > 0 && (n.pivotCaches = r);
3228
+ }
3229
+ let b = this._people.toJSON();
3230
+ if (b && (n.people = b), !s) {
3231
+ let e = await l.toJSONAsync(typeof o == "function" ? o : void 0);
3232
+ e && e.length > 0 && (n.resources = e);
3233
+ }
3234
+ let x = this._calculation.getNamedFormulas().toJSON();
3235
+ x && x.length > 0 && (n.names = x);
3236
+ let S = this._view.toJSON();
3237
+ S && (i === a ? delete S.activeSheetId : S.activeSheetId = i, Object.keys(S).length > 0 && (n.view = S));
3238
+ } finally {
3239
+ u.endPersist(), s || l.endPersist(), c.endPersist();
3240
+ }
3241
+ return this._emitter.notify("onSave", { params: n }), n;
3242
+ }
3243
+ isClosed() {
3244
+ return this._closed;
3245
+ }
3246
+ close() {
3247
+ if (this._closed) return;
3248
+ this._emitter.notify("onClose");
3249
+ let e = this._getState();
3250
+ e.listenersSheets.forEach((e) => {
3251
+ e();
3252
+ }), e.listenersSheets.clear();
3253
+ let t = e.sheetRefsAll;
3254
+ for (let e = t.length - 1; e >= 0; e--) try {
3255
+ t[e].sheet.close();
3256
+ } catch (e) {
3257
+ console.warn("error on close", e);
3258
+ }
3259
+ 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 _t && this._originProvider.release(), this._closed = !0;
3260
+ }
3261
+ beginCommit(e) {
3262
+ if (this._closed) throw Error(a("error.workbook.modelClosed"));
3263
+ return this._beginCommit(typeof e == "string" ? { description: e } : e);
3264
+ }
3265
+ doBatch(e, t) {
3266
+ let n = this;
3267
+ t = typeof t == "string" ? { description: t } : {
3268
+ description: l("op.updateWorkbook"),
3269
+ ...t
3270
+ };
3271
+ let r = g.bind(this._transactions, this, e);
3272
+ return this._transactions.doBatch(r.callback, {
3273
+ ...t,
3274
+ onChildCommit: r.onChildCommit
3275
+ }, (e, t) => {
3276
+ r.close(), e.getDepth() === 0 && (n._lastTransactionUUID = e.getId());
3277
+ });
3278
+ }
3279
+ _beginCommit(e) {
3280
+ let t = this;
3281
+ return this._transactions.beginCommit(typeof e == "string" ? { description: e } : e, (e) => {
3282
+ e.getDepth() === 0 && (t._lastTransactionUUID = e.getId());
3283
+ });
3284
+ }
3285
+ _getState() {
3286
+ return this._transactions.getState(this._id);
3287
+ }
3288
+ _updateState(e, t = l("op.updateWorkbook"), n) {
3289
+ if (!e) return;
3290
+ let r = this._beginCommit(t);
3291
+ try {
3292
+ r.updateState(this._id, e), r.commit(n);
3293
+ } catch (e) {
3294
+ throw r.rollback(), e;
3295
+ }
3296
+ }
3297
+ get options() {
3298
+ return this._options;
3299
+ }
3300
+ get [Symbol.toStringTag]() {
3301
+ return "[Workbook]";
3302
+ }
3303
+ toString() {
3304
+ return `[${this.getName() ?? "(untitled)"}]`;
3305
+ }
3306
+ get isIWorkbook() {
3307
+ return !0;
3308
+ }
3309
+ }, bn = { address: null }, Q = (e) => e.sheet.getKind() === I.Kind.Worksheet, xn = class {
3310
+ constructor() {
3311
+ this._readFormats = [], this._writeFormats = [], this._encryptions = [];
3312
+ }
3313
+ async registerReadFormat(e) {
3314
+ this._readFormats = await this._registerFormatType(e, this._readFormats);
3315
+ }
3316
+ async registerWriteFormat(e) {
3317
+ this._writeFormats = await this._registerFormatType(e, this._writeFormats);
3318
+ }
3319
+ async registerEncryption(e) {
3320
+ if (!e) throw Error("encryption must be provided.");
3321
+ if (!e.key) throw Error("encryption.key must be provided.");
3322
+ let t = e.key.toLowerCase(), n = this._encryptions.findIndex((e) => e.key.toLowerCase() === t);
3323
+ if (n !== -1) {
3324
+ let t = [...this._encryptions];
3325
+ t[n] = e, this._encryptions = Object.freeze(t);
3326
+ } else this._encryptions = Object.freeze([...this._encryptions, e]);
3327
+ }
3328
+ async getEncryption(e) {
3329
+ return this.peekEncryption(e);
3330
+ }
3331
+ peekEncryption(e) {
3332
+ if (!e) return this._encryptions[0] ?? null;
3333
+ let t = e.toLowerCase();
3334
+ return this._encryptions.find((e) => e.key.toLowerCase() === t) ?? null;
3335
+ }
3336
+ async detectEncryption(e) {
3337
+ for (let t of this._encryptions) if (await t.detect(e)) return t;
3338
+ return null;
3339
+ }
3340
+ async getReadFormats(e) {
3341
+ return e ? this._filterFormats(e, this._readFormats) : [...this._readFormats];
3342
+ }
3343
+ async getWriteFormats(e) {
3344
+ return this._writeFormats ? e ? this._filterFormats(e, this._writeFormats) : [...this._writeFormats] : [];
3345
+ }
3346
+ async _registerFormatType(e, t) {
3347
+ return this._registerFormatTypeSync(e, t);
3348
+ }
3349
+ _registerFormatTypeSync(e, t) {
3350
+ if (!e) throw Error("format must be provided.");
3351
+ if (!e.key) throw Error("format.key must be provided.");
3352
+ let n = e.key.toLowerCase(), r = t.findIndex((e) => e.key.toLowerCase() === n);
3353
+ if (r !== -1) {
3354
+ let n = [...t];
3355
+ return n[r] = e, Object.freeze(n);
3356
+ }
3357
+ return Object.freeze([...t, e]);
3358
+ }
3359
+ _filterFormats(e, t, n) {
3360
+ if (!e || Object.keys(e).length === 0) {
3361
+ if (!n) return [...t];
3362
+ e = { ext: n };
3363
+ }
3364
+ let r = e.search?.toLocaleLowerCase();
3365
+ return t.filter((t) => {
3366
+ if (r) {
3367
+ 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);
3368
+ if (!(e || n || i || a || o)) return !1;
3369
+ }
3370
+ let i = e.ext || n;
3371
+ if (i) {
3372
+ let e = i.toLocaleLowerCase();
3373
+ if (!t.exts.some((t) => t.toLocaleLowerCase() === e)) return !1;
3374
+ }
3375
+ if (e.mimeType && t.mimeType !== e.mimeType || e.key && t.key.toLocaleLowerCase() !== e.key.toLocaleLowerCase()) return !1;
3376
+ if (e.tags) {
3377
+ let n = t.tags || [];
3378
+ if (!(typeof e.tags == "string" ? [e.tags] : e.tags).every((e) => n.includes(e))) return !1;
3379
+ }
3380
+ return !0;
3381
+ });
3382
+ }
3383
+ }, $ = /* @__PURE__ */ new WeakMap(), Sn = (e) => !!e && typeof e == "object" && typeof e.getPath == "function" && typeof e.canWrite == "function", Cn = new class {
3384
+ constructor() {
3385
+ this._setInstalled = /* @__PURE__ */ new WeakSet(), this._backingStore = null, this._emitter = new _(this), this._registry = new xn(), this._defaultStore = new yt(() => this.getWriteFormats(), () => this.getReadFormats());
3386
+ }
3387
+ getBackingStore() {
3388
+ return this._backingStore ?? this._defaultStore;
3389
+ }
3390
+ setBackingStore(e) {
3391
+ this._backingStore = e ?? null;
3392
+ }
3393
+ canWrite() {
3394
+ return typeof this.getBackingStore().write == "function";
3395
+ }
3396
+ canRead() {
3397
+ return typeof this.getBackingStore().read == "function";
3398
+ }
3399
+ async install(e) {
3400
+ this._setInstalled.has(e) || (await e.register(this._registry), this._setInstalled.add(e));
3401
+ }
3402
+ addListeners(e, t) {
3403
+ return this._emitter.addListeners(e, t);
3404
+ }
3405
+ addCommitListener(e) {
3406
+ return this._emitter.addListeners({ onWrite: (t, n) => {
3407
+ n.save && e.onCommit?.({
3408
+ store: n.workbook.getTransactions(),
3409
+ commitId: n.commitId
3410
+ });
3411
+ } });
3412
+ }
3413
+ async getReadFormats(e) {
3414
+ return this._registry.getReadFormats(e);
3415
+ }
3416
+ async getWriteFormats(e) {
3417
+ return this._registry.getWriteFormats(e);
3418
+ }
3419
+ getOrigin(e) {
3420
+ return new B(e);
3421
+ }
3422
+ async read(e) {
3423
+ let t = null;
3424
+ if (typeof e == "string") e = { source: e };
3425
+ else if (Sn(e)) {
3426
+ let n = e.getPath();
3427
+ if (!n) throw Error("Cannot read from an unbound origin (no path).");
3428
+ ht(e) ? e = {
3429
+ source: n,
3430
+ asCopy: !0
3431
+ } : (t = e, e = { source: n });
3432
+ }
3433
+ let n = e ?? {}, { source: r = null, ...i } = n, a = this.getBackingStore();
3434
+ return (a.read ? a : this._defaultStore).read({
3435
+ source: r,
3436
+ options: i,
3437
+ decode: (e, r) => this._decodeBuffer(e, r, n, t)
3438
+ });
3439
+ }
3440
+ async _decodeBuffer(e, t = {}, n, r = null) {
3441
+ let i = t.format, s = t.ext;
3442
+ if (!i && !s) throw Error("Either format or file extension must be provided to determine read type.");
3443
+ let c = (await this._registry.getReadFormats({
3444
+ search: i,
3445
+ ext: s
3446
+ }))[0];
3447
+ if (!c) throw new o(a("error.io.readFormatUnavailable", { format: i ?? s }));
3448
+ let l = n?.typedCreateWorkbookOptions, u = l ? Object.keys(l).find((e) => e.toLowerCase() === c.key.toLowerCase()) : void 0, d = {
3449
+ ...n,
3450
+ ...u === void 0 ? void 0 : l[u]
3451
+ };
3452
+ delete d.typedCreateWorkbookOptions, delete d.source, delete d.asCopy;
3453
+ let f = r ?? new B(t.absolutePath ?? null, {
3454
+ name: t.name ?? null,
3455
+ format: c.key,
3456
+ size: t.size ?? null,
3457
+ lastModified: t.lastModified ?? null,
3458
+ canWrite: t.canWrite ?? !1
3459
+ });
3460
+ r instanceof B && r.update({
3461
+ format: c.key,
3462
+ size: t.size ?? null,
3463
+ lastModified: t.lastModified ?? null
3464
+ }), d.createWorkbookOptions = {
3465
+ ...d.createWorkbookOptions || {},
3466
+ origin: f
3467
+ }, d.readonly !== void 0 && (d.createWorkbookOptions = {
3468
+ readonly: d.readonly,
3469
+ ...d.createWorkbookOptions
3470
+ }, delete d.readonly), d.calcOnly && (d.createWorkbookOptions = {
3471
+ disableLoadAutoFit: !0,
3472
+ ...d.createWorkbookOptions
3473
+ });
3474
+ let p = await this._decrypt(e, f, d);
3475
+ if (p === null) return null;
3476
+ e = p.bytes;
3477
+ let m = d?.progress?.onStart?.bind(d.progress);
3478
+ m && await Promise.resolve(m(f, t.size));
3479
+ try {
3480
+ let t = await this._readArrayBuffer(e, c, d);
3481
+ return p.password !== null && f.setPassword(p.password), d?.progress?.onComplete?.(f), this._emitter.notify("onRead", {
3482
+ params: {
3483
+ workbook: t,
3484
+ origin: f
3485
+ },
3486
+ transactional: !1
3487
+ }), t;
3488
+ } catch (e) {
3489
+ throw d?.progress?.onError?.(e), d?.progress?.onComplete?.(null), e;
3490
+ }
3491
+ }
3492
+ async _decrypt(e, t, n) {
3493
+ let r = await this._registry.detectEncryption(e);
3494
+ if (t instanceof B && t.update({ encryption: r ? r.key : null }), !r) return {
3495
+ bytes: e,
3496
+ password: null
3497
+ };
3498
+ let i = null, o = async (t) => {
3499
+ try {
3500
+ return i = await r.decode(e, t), !0;
3501
+ } catch (e) {
3502
+ if (!(e instanceof d)) throw e;
3503
+ return !1;
3504
+ }
3505
+ };
3506
+ if (n?.password && await o(n.password)) return {
3507
+ bytes: i,
3508
+ password: n.password
3509
+ };
3510
+ if (!n?.onPassword) {
3511
+ let e = t.getName();
3512
+ throw new h(e ? a("error.io.passwordRequired", { name: e }) : a("error.io.passwordRequiredUnnamed"));
3513
+ }
3514
+ let s = await Promise.resolve(n.onPassword({
3515
+ origin: t,
3516
+ encryption: r.key,
3517
+ validate: o
3518
+ }));
3519
+ if (s == null) return null;
3520
+ if (i !== null || await o(s)) return {
3521
+ bytes: i,
3522
+ password: s
3523
+ };
3524
+ throw new d(a("error.io.passwordIncorrect"));
3525
+ }
3526
+ async writeArrayBuffer(e, t) {
3527
+ if (!t?.format) throw Error("A format must be specified to write to an ArrayBuffer (e.g. { format: 'xlsx' }).");
3528
+ let n = (await this._registry.getWriteFormats({ search: t.format }))[0];
3529
+ if (!n) throw new o(a("error.io.writeFormatUnavailable", { format: t.format }));
3530
+ return this._writeArrayBuffer(e, n, t);
3531
+ }
3532
+ async write(e, t, n) {
3533
+ return typeof t == "string" || Sn(t) ? this._write(e, t, !1, n) : this._write(e, e?.getOrigin?.(), !0, t ?? n);
3534
+ }
3535
+ async writeAs(e, t, n) {
3536
+ if (!t) throw Error("A target must be provided for writeAs (use write(workbook) for a plain save).");
3537
+ return this._write(e, t, !0, n);
3538
+ }
3539
+ async _write(e, t, n, r) {
3540
+ if (!e) throw Error("Workbook must be provided.");
3541
+ if (!e.isIWorkbook) throw Error("Invalid workbook model provided. Must be an instance of IWorkbook.");
3542
+ let i, s = typeof t == "string" ? this.getOrigin(t) : t, c = s.getFormat();
3543
+ if ((r?.format || c) && (i = (await this._registry.getWriteFormats({ search: r?.format ?? c ?? void 0 }))[0]), i || s.getPath() && s.canWrite() && s.getExtension() || (i = (await this._registry.getWriteFormats({ ext: "sxl" }))[0] ?? (await this._registry.getWriteFormats())[0]), !i) throw new o(a("error.io.writeFormatUnresolved"));
3544
+ let l = s.getExtension();
3545
+ if (r?.format && l && s.getPath() && s.canWrite() && !i.exts.includes(l)) {
3546
+ let e = (await this._registry.getWriteFormats({ ext: l }))[0];
3547
+ if (e && e.key !== i.key) {
3548
+ let e = s.getPath().split(/[/\\]/).pop();
3549
+ throw new o(a("error.io.writeFormatMismatch", {
3550
+ format: r.format,
3551
+ file: e
3552
+ }));
3553
+ }
3554
+ }
3555
+ if (typeof t == "string") {
3556
+ let e = s.getPath();
3557
+ s = new B(A(e) ? e : `${e}.${i.exts[0]}`, { format: i.key });
3558
+ }
3559
+ let u = s.getEncryption(), d = e.getOrigin?.(), f = (s instanceof B ? s.getPassword() : null) ?? (d instanceof B ? d.getPassword() : null), p = s.isEncrypted() || (d?.isEncrypted() ?? !1), m = r?.password === void 0 ? f ?? (p ? void 0 : null) : r.password, g = null;
3560
+ if (m === void 0) {
3561
+ if (p) {
3562
+ let e = s.getName();
3563
+ throw new h(e ? a("error.io.passwordRequiredSave", { name: e }) : a("error.io.passwordRequiredSaveUnnamed"));
3564
+ }
3565
+ } else if (m !== null && (g = await this._registry.getEncryption(u), !g)) throw new o(a("error.io.encryptionUnavailable"));
3566
+ let _ = `${s.getName() ?? a("workbook.defaultName")}.${i.exts[0]}`, v = r?.progress, y = !s.getPath() || !s.canWrite() || !!r?.prompt, b = !1, x = this, S = null, C = [], w = {
3567
+ workbook: e,
3568
+ format: i,
3569
+ origin: s,
3570
+ suggestedName: _,
3571
+ prompt: r?.prompt,
3572
+ async encode(t, a) {
3573
+ let o = a ?? s;
3574
+ await (async (e) => {
3575
+ b || (b = !0, v?.onStart && await Promise.resolve(v.onStart(e)));
3576
+ })(o), S = e.getTransactions?.()?.getCurrentCommit() ?? S;
3577
+ let c = t ? (await x._registry.getWriteFormats({ search: t }))[0] ?? i : i, l = [], u = ((e, t) => ({
3578
+ onStart: e?.onStart ? (t, n) => e.onStart(t, n) : void 0,
3579
+ onProgress: e?.onProgress ? (t, n) => e.onProgress(t, n) : void 0,
3580
+ onError: e?.onError ? (t) => e.onError(t) : void 0,
3581
+ onComplete: e?.onComplete ? (t) => e.onComplete(t) : void 0,
3582
+ onWarning: (n, r) => {
3583
+ t.push({
3584
+ message: n ?? "",
3585
+ context: r
3586
+ }), e?.onWarning?.(n, r);
3587
+ }
3588
+ }))(v, l), d = await x._writeArrayBuffer(e, c, {
3589
+ ...r,
3590
+ progress: u
3591
+ }), f = $.get(o);
3592
+ if (l.some((e) => !f?.has(e.message)) && r?.onWarnings) {
3593
+ let t = await Promise.resolve(r.onWarnings({
3594
+ workbook: e,
3595
+ origin: o,
3596
+ warnings: l,
3597
+ save: n,
3598
+ canCancel: !y
3599
+ }));
3600
+ if (!y && !1 === t) return null;
3601
+ }
3602
+ return C = l, g ? g.encode(d, m) : d;
3603
+ }
3604
+ }, T = null;
3605
+ try {
3606
+ let t = this.getBackingStore();
3607
+ if (!t.write) throw Error("The active backing store is read-only (no write implementation).");
3608
+ if (T = await t.write(w), T) {
3609
+ if (m !== void 0 && T instanceof B && (T.setPassword(m), T.update({ encryption: g ? g.key : null })), C.length) {
3610
+ let e = $.get(T) ?? /* @__PURE__ */ new Set();
3611
+ for (let t of C) e.add(t.message);
3612
+ $.set(T, e);
3613
+ }
3614
+ n && T !== e.getOrigin() && ht(e.getOrigin())?.setOrigin(T);
3615
+ let t = S ?? e.getTransactions?.()?.getCurrentCommit() ?? null;
3616
+ this._emitter.notify("onWrite", {
3617
+ params: {
3618
+ workbook: e,
3619
+ origin: T,
3620
+ commitId: t?.getId() ?? null,
3621
+ save: n
3622
+ },
3623
+ transactional: !1
3624
+ });
3625
+ }
3626
+ v?.onComplete && await Promise.resolve(v.onComplete(T));
3627
+ } catch (e) {
3628
+ let t = e instanceof Error ? e : Error(String(e));
3629
+ throw v?.onError && await Promise.resolve(v.onError(t)), v?.onComplete && await Promise.resolve(v.onComplete(null)), t instanceof o ? t : Error(a("error.io.writeFailed", { reason: t.message }), { cause: e });
3630
+ }
3631
+ return T;
3632
+ }
3633
+ _stripExtension(e) {
3634
+ let t = A(e);
3635
+ return t ? e.slice(0, e.length - t.length - 1) : e;
3636
+ }
3637
+ _baseName(e) {
3638
+ if (!e) return null;
3639
+ let t = e.split(/[?#]/)[0], n = t.split(/[/\\]/).pop() ?? t;
3640
+ return this._stripExtension(n) || null;
3641
+ }
3642
+ async _writeArrayBuffer(e, t, n) {
3643
+ if (!t) throw Error("A write format must be provided.");
3644
+ let r = t.handler;
3645
+ if (!r) throw Error(`Unable to resolve a write handler for '${t.key}'.`);
3646
+ return r(e, {
3647
+ ...n,
3648
+ format: t.key
3649
+ });
3650
+ }
3651
+ async _readArrayBuffer(e, t, n) {
3652
+ if (!e) throw Error("ArrayBuffer must be specified.");
3653
+ if (!t) throw Error("format must be specified.");
3654
+ if (e.byteLength === 0) return new yn(n?.createWorkbookOptions);
3655
+ let r, i = t.handler;
3656
+ if (!i) throw Error(`Unable to resolve a read handler for '${t.key}'.`);
3657
+ try {
3658
+ r = await i(e, n);
3659
+ } catch (e) {
3660
+ throw e instanceof o ? e : new o(a("error.io.readFailed", {
3661
+ format: t.description ?? t.key,
3662
+ reason: e?.message ?? String(e)
3663
+ }), { cause: e });
3664
+ }
3665
+ return await Pe(), r;
3666
+ }
3667
+ get isIWorkbookIO() {
3668
+ return !0;
3669
+ }
3670
+ }();
3671
+ [
3672
+ ".woff2",
3673
+ ".woff",
3674
+ ".ttf",
3675
+ ".otf",
3676
+ ".ttc",
3677
+ ".otc"
3678
+ ].map((e) => ({
3679
+ suffix: e,
3680
+ place: (e, t) => t ? `${t}/${e}` : e
3681
+ })), sn ||= {}, pn ||= {}, (mn ||= {}).Type = {
3682
+ Button: "button",
3683
+ CheckBox: "checkBox",
3684
+ OptionButton: "optionButton",
3685
+ ListBox: "listBox",
3686
+ DropDown: "dropDown",
3687
+ ScrollBar: "scrollBar",
3688
+ Spinner: "spinner",
3689
+ GroupBox: "groupBox",
3690
+ Label: "label",
3691
+ EditBox: "editBox",
3692
+ Dialog: "dialog",
3693
+ Unknown: "formControl"
3694
+ }, (hn ||= {}).DropStyle = {
3695
+ Combo: "combo",
3696
+ ComboEdit: "comboEdit",
3697
+ Simple: "simple"
3698
+ };
3699
+ var wn = class extends rt {
3700
+ constructor(e) {
3701
+ super(e);
3702
+ }
3703
+ _initializeOptions(e) {
3704
+ return e = {
3705
+ ...e,
3706
+ coords: {
3707
+ colStart: 0,
3708
+ rowStart: 0,
3709
+ colEnd: (e?.size?.width ?? 5) - 1,
3710
+ rowEnd: (e?.size?.height ?? 5) - 1
3711
+ },
3712
+ getRanges: (e) => new Ke(null)
3713
+ }, super._initializeOptions(e);
3714
+ }
3715
+ }, Tn = "0.8.0-beta.11";
3716
+ export { Yt as _, Dt as a, Cn as c, Rt as d, Xt as f, wn as g, G as h, B as i, K as l, Kt as m, yn as n, mt as o, Tn as p, Ft as r, Ct as s, ut as t, It as u, dt as v };